From: support Date: Mon, 1 Aug 2022 14:37:44 +0000 (+0000) Subject: Built motion from commit f6d7e26c.|2.6.14 X-Git-Url: http://repos.xcallymotion.com/base/%22https:/wiki.xcallymotion.com/display/XMV//%22%7B%7Blicense.messaging?a=commitdiff_plain;h=0fd45454d829cb1f367922ca1b55351b49b297ee;p=motion2.git Built motion from commit f6d7e26c.|2.6.14 --- diff --git a/apidoc/api_project.js b/apidoc/api_project.js index 4847a36..e23c2b5 100644 --- a/apidoc/api_project.js +++ b/apidoc/api_project.js @@ -17,7 +17,7 @@ define({ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-31T21:16:14.105Z", + "time": "2022-08-01T14:30:13.026Z", "url": "http://apidocjs.com", "version": "0.24.0" } diff --git a/apidoc/api_project.json b/apidoc/api_project.json index abac729..bcb7a2a 100644 --- a/apidoc/api_project.json +++ b/apidoc/api_project.json @@ -17,7 +17,7 @@ "apidoc": "0.3.0", "generator": { "name": "apidoc", - "time": "2022-07-31T21:16:14.105Z", + "time": "2022-08-01T14:30:13.026Z", "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 c92de10..c6f4aab 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 _0x46c3=['urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','sequelize','exports','action','contactManager','integration','motionbar','jscripty','bot','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'];(function(_0x5eabd7,_0x408f8f){var _0x47e0ae=function(_0x18d813){while(--_0x18d813){_0x5eabd7['push'](_0x5eabd7['shift']());}};_0x47e0ae(++_0x408f8f);}(_0x46c3,0x13e));var _0x346c=function(_0x1d0934,_0x3bbb10){_0x1d0934=_0x1d0934-0x0;var _0x4575c5=_0x46c3[_0x1d0934];return _0x4575c5;};'use strict';var Sequelize=require(_0x346c('0x0'));module[_0x346c('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0xc7a813){return this['getDataValue'](_0x346c('0x2'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0x346c('0x3'),_0x346c('0x4'),_0x346c('0x5'),_0x346c('0x6'),'urlForward','browser',_0x346c('0x7'),'script']],'msg':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'}},'comment':'Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script'},'data1':{'type':Sequelize[_0x346c('0x8')](0x1000),'comment':_0x346c('0x9')},'data2':{'type':Sequelize['STRING'](0x1000),'comment':_0x346c('0xa')},'data3':{'type':Sequelize[_0x346c('0x8')](0x1000),'comment':'contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]'},'data4':{'type':Sequelize[_0x346c('0x8')](0x1000),'comments':_0x346c('0xb')},'data5':{'type':Sequelize[_0x346c('0x8')](0x1000),'comments':_0x346c('0xc')},'data6':{'type':Sequelize['STRING'],'comments':_0x346c('0xd')},'data7':{'type':Sequelize[_0x346c('0xe')],'comments':'urlForward[body]'}}; \ No newline at end of file +var _0x6ece=['urlForward[timeout],\x20browser[windowWidth],\x20contactManager[ignoreDialerContactId]','urlForward[headers],\x20browser[wsindowHeight]','TEXT','urlForward[body]','sequelize','exports','getDataValue','action','contactManager','integration','jscripty','urlForward','browser','bot','script','Allowed\x20values:\x20contactManager,\x20integration,\x20motionbar,\x20jscripty,\x20urlForward,\x20browser,\x20bot,\x20script','STRING','jscripty[ProjectId],\x20browser[type(0=Popup,1=CTI\x20URL)],\x20contactManager[ListId],\x20urlForward[type(GET,POST,PUT,DELETE)],\x20script[info],\x20integration[intName(desk,dynamics365,freshdesk,freshsales,salesforce,sugarcrm,vtiger,zendesk,zoho)],\x20motionbar[type(0=Popup,1=CTI\x20URL,2=WinApp)]','contactManager[autoCreate(0=No,1=Yes)],\x20urlForward[URL],\x20script[type],\x20integration[AccountId],\x20motionbar[TemplateId,URL,WinAppPath],\x20browser[TemplateId,URL]','contactManager[searchFields],\x20script[script],\x20integration[ConfigurationId],\x20motionbar[NULL,eventVariables(0=No,1=Yes),WinAppArguments],\x20browser[NULL,eventVariables(0=No,1=Yes)]','browser[location(0=NewTab,1=NewWindow,2=MotionTab)],\x20contactManager[autoCreateField]'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x6ece,0x13f));var _0xe6ec=function(_0x5261d5,_0x2854f5){_0x5261d5=_0x5261d5-0x0;var _0xd340a8=_0x6ece[_0x5261d5];return _0xd340a8;};'use strict';var Sequelize=require(_0xe6ec('0x0'));module[_0xe6ec('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x358259){return this[_0xe6ec('0x2')](_0xe6ec('0x3'));}},'action':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'isIn':{'args':[[_0xe6ec('0x4'),_0xe6ec('0x5'),'motionbar',_0xe6ec('0x6'),_0xe6ec('0x7'),_0xe6ec('0x8'),_0xe6ec('0x9'),_0xe6ec('0xa')]],'msg':_0xe6ec('0xb')}},'comment':_0xe6ec('0xb')},'data1':{'type':Sequelize[_0xe6ec('0xc')](0x1000),'comment':_0xe6ec('0xd')},'data2':{'type':Sequelize[_0xe6ec('0xc')](0x1000),'comment':_0xe6ec('0xe')},'data3':{'type':Sequelize[_0xe6ec('0xc')](0x1000),'comment':_0xe6ec('0xf')},'data4':{'type':Sequelize['STRING'](0x1000),'comments':_0xe6ec('0x10')},'data5':{'type':Sequelize[_0xe6ec('0xc')](0x1000),'comments':_0xe6ec('0x11')},'data6':{'type':Sequelize[_0xe6ec('0xc')],'comments':_0xe6ec('0x12')},'data7':{'type':Sequelize[_0xe6ec('0x13')],'comments':_0xe6ec('0x14')}}; \ No newline at end of file diff --git a/server/api/action/action.controller.js b/server/api/action/action.controller.js index eedade1..81c7c2d 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 _0x9f95=['count','offset','set','Content-Range','apply','reject','update','destroy','then','error','stack','name','send','body','Action','params','catch','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit'];(function(_0x5e5218,_0x4226ef){var _0x2dcd35=function(_0x11049f){while(--_0x11049f){_0x5e5218['push'](_0x5e5218['shift']());}};_0x2dcd35(++_0x4226ef);}(_0x9f95,0x1c2));var _0x59f9=function(_0x399e3b,_0x5dd3d2){_0x399e3b=_0x399e3b-0x0;var _0x28c6a4=_0x9f95[_0x399e3b];return _0x28c6a4;};'use strict';var emlformat=require(_0x59f9('0x0'));var rimraf=require(_0x59f9('0x1'));var zipdir=require(_0x59f9('0x2'));var jsonpatch=require(_0x59f9('0x3'));var rp=require('request-promise');var moment=require(_0x59f9('0x4'));var BPromise=require(_0x59f9('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x59f9('0x6'));var sox=require('sox');var csv=require(_0x59f9('0x7'));var ejs=require(_0x59f9('0x8'));var fs=require('fs');var fs_extra=require(_0x59f9('0x9'));var _=require(_0x59f9('0xa'));var squel=require(_0x59f9('0xb'));var crypto=require(_0x59f9('0xc'));var jsforce=require(_0x59f9('0xd'));var deskjs=require(_0x59f9('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x59f9('0xf'));var Redis=require(_0x59f9('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x59f9('0x11'));var hardwareService=require(_0x59f9('0x12'));var logger=require(_0x59f9('0x13'))(_0x59f9('0x14'));var utils=require('../../config/utils');var config=require(_0x59f9('0x15'));var licenseUtil=require(_0x59f9('0x16'));var db=require(_0x59f9('0x17'))['db'];function respondWithStatusCode(_0x3a049e,_0x3676cb){_0x3676cb=_0x3676cb||0xcc;return function(_0x4439e1){if(_0x4439e1){return _0x3a049e[_0x59f9('0x18')](_0x3676cb);}return _0x3a049e[_0x59f9('0x19')](_0x3676cb)[_0x59f9('0x1a')]();};}function respondWithResult(_0x3f907f,_0x996924){_0x996924=_0x996924||0xc8;return function(_0x26aaab){if(_0x26aaab){return _0x3f907f[_0x59f9('0x19')](_0x996924)[_0x59f9('0x1b')](_0x26aaab);}};}function respondWithFilteredResult(_0x317952,_0x33d05d){return function(_0x335e4c){if(_0x335e4c){var _0x1fbeeb=typeof _0x33d05d['offset']===_0x59f9('0x1c')&&typeof _0x33d05d[_0x59f9('0x1d')]===_0x59f9('0x1c');var _0x48d5cd=_0x335e4c['count'];var _0x55dd44=_0x1fbeeb?0x0:_0x33d05d['offset'];var _0x49e44a=_0x1fbeeb?_0x335e4c[_0x59f9('0x1e')]:_0x33d05d[_0x59f9('0x1f')]+_0x33d05d[_0x59f9('0x1d')];var _0x37a6df;if(_0x49e44a>=_0x48d5cd){_0x49e44a=_0x48d5cd;_0x37a6df=0xc8;}else{_0x37a6df=0xce;}_0x317952[_0x59f9('0x19')](_0x37a6df);return _0x317952[_0x59f9('0x20')](_0x59f9('0x21'),_0x55dd44+'-'+_0x49e44a+'/'+_0x48d5cd)[_0x59f9('0x1b')](_0x335e4c);}return null;};}function patchUpdates(_0x10d8c8){return function(_0x36ce7a){try{jsonpatch[_0x59f9('0x22')](_0x36ce7a,_0x10d8c8,!![]);}catch(_0xb64b52){return BPromise[_0x59f9('0x23')](_0xb64b52);}return _0x36ce7a['save']();};}function saveUpdates(_0x543d07,_0x40ae28){return function(_0x745517){if(_0x745517){return _0x745517[_0x59f9('0x24')](_0x543d07)['then'](function(_0x554bdd){return _0x554bdd;});}return null;};}function removeEntity(_0x24f202,_0xc2ea4f){return function(_0x1818dd){if(_0x1818dd){return _0x1818dd[_0x59f9('0x25')]()[_0x59f9('0x26')](function(){_0x24f202[_0x59f9('0x19')](0xcc)[_0x59f9('0x1a')]();});}};}function handleEntityNotFound(_0x21c984,_0x3cd53e){return function(_0x4f5b7c){if(!_0x4f5b7c){_0x21c984[_0x59f9('0x18')](0x194);}return _0x4f5b7c;};}function handleError(_0x3ffb5b,_0x2fb99d){_0x2fb99d=_0x2fb99d||0x1f4;return function(_0x3da7e4){logger[_0x59f9('0x27')](_0x3da7e4[_0x59f9('0x28')]);if(_0x3da7e4[_0x59f9('0x29')]){delete _0x3da7e4[_0x59f9('0x29')];}_0x3ffb5b[_0x59f9('0x19')](_0x2fb99d)[_0x59f9('0x2a')](_0x3da7e4);};}exports['update']=function(_0x1f1ee5,_0x36afd4){if(_0x1f1ee5[_0x59f9('0x2b')]['id']){delete _0x1f1ee5[_0x59f9('0x2b')]['id'];}return db[_0x59f9('0x2c')]['find']({'where':{'id':_0x1f1ee5[_0x59f9('0x2d')]['id']}})[_0x59f9('0x26')](handleEntityNotFound(_0x36afd4,null))[_0x59f9('0x26')](saveUpdates(_0x1f1ee5[_0x59f9('0x2b')],null))[_0x59f9('0x26')](respondWithResult(_0x36afd4,null))[_0x59f9('0x2e')](handleError(_0x36afd4,null));};exports[_0x59f9('0x25')]=function(_0x39b93d,_0x274ffb){return db[_0x59f9('0x2c')][_0x59f9('0x2f')]({'where':{'id':_0x39b93d[_0x59f9('0x2d')]['id']}})[_0x59f9('0x26')](handleEntityNotFound(_0x274ffb,null))[_0x59f9('0x26')](removeEntity(_0x274ffb,null))['catch'](handleError(_0x274ffb,null));}; \ No newline at end of file +var _0x339e=['../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','save','update','destroy','end','stack','name','send','body','Action','find','params','then','catch','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0x339e,0xa3));var _0xe339=function(_0x13ac10,_0x46e79e){_0x13ac10=_0x13ac10-0x0;var _0x28eda2=_0x339e[_0x13ac10];return _0x28eda2;};'use strict';var emlformat=require(_0xe339('0x0'));var rimraf=require(_0xe339('0x1'));var zipdir=require(_0xe339('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xe339('0x3'));var moment=require(_0xe339('0x4'));var BPromise=require(_0xe339('0x5'));var Mustache=require(_0xe339('0x6'));var util=require(_0xe339('0x7'));var path=require(_0xe339('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe339('0x9'));var _=require(_0xe339('0xa'));var squel=require(_0xe339('0xb'));var crypto=require(_0xe339('0xc'));var jsforce=require(_0xe339('0xd'));var deskjs=require(_0xe339('0xe'));var toCsv=require(_0xe339('0xf'));var querystring=require(_0xe339('0x10'));var Papa=require(_0xe339('0x11'));var Redis=require(_0xe339('0x12'));var authService=require(_0xe339('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe339('0x14'));var logger=require('../../config/logger')(_0xe339('0x15'));var utils=require(_0xe339('0x16'));var config=require(_0xe339('0x17'));var licenseUtil=require(_0xe339('0x18'));var db=require(_0xe339('0x19'))['db'];function respondWithStatusCode(_0x3345b7,_0x516e20){_0x516e20=_0x516e20||0xcc;return function(_0x182577){if(_0x182577){return _0x3345b7[_0xe339('0x1a')](_0x516e20);}return _0x3345b7[_0xe339('0x1b')](_0x516e20)['end']();};}function respondWithResult(_0x38c116,_0x2f9c4b){_0x2f9c4b=_0x2f9c4b||0xc8;return function(_0x6f1555){if(_0x6f1555){return _0x38c116['status'](_0x2f9c4b)[_0xe339('0x1c')](_0x6f1555);}};}function respondWithFilteredResult(_0x545ecf,_0x347f07){return function(_0xa31607){if(_0xa31607){var _0x5cafb9=typeof _0x347f07[_0xe339('0x1d')]===_0xe339('0x1e')&&typeof _0x347f07[_0xe339('0x1f')]===_0xe339('0x1e');var _0x27c60f=_0xa31607[_0xe339('0x20')];var _0xf52dc1=_0x5cafb9?0x0:_0x347f07[_0xe339('0x1d')];var _0x1a5245=_0x5cafb9?_0xa31607[_0xe339('0x20')]:_0x347f07['offset']+_0x347f07[_0xe339('0x1f')];var _0x5e506b;if(_0x1a5245>=_0x27c60f){_0x1a5245=_0x27c60f;_0x5e506b=0xc8;}else{_0x5e506b=0xce;}_0x545ecf[_0xe339('0x1b')](_0x5e506b);return _0x545ecf[_0xe339('0x21')]('Content-Range',_0xf52dc1+'-'+_0x1a5245+'/'+_0x27c60f)['json'](_0xa31607);}return null;};}function patchUpdates(_0x1265d5){return function(_0x3a410a){try{jsonpatch['apply'](_0x3a410a,_0x1265d5,!![]);}catch(_0x2e6d59){return BPromise['reject'](_0x2e6d59);}return _0x3a410a[_0xe339('0x22')]();};}function saveUpdates(_0x2d0695,_0x5f3331){return function(_0x115d34){if(_0x115d34){return _0x115d34[_0xe339('0x23')](_0x2d0695)['then'](function(_0x55f8f1){return _0x55f8f1;});}return null;};}function removeEntity(_0x552d95,_0xbfe710){return function(_0x4c66ae){if(_0x4c66ae){return _0x4c66ae[_0xe339('0x24')]()['then'](function(){_0x552d95[_0xe339('0x1b')](0xcc)[_0xe339('0x25')]();});}};}function handleEntityNotFound(_0x5a85e2,_0x552784){return function(_0x457089){if(!_0x457089){_0x5a85e2[_0xe339('0x1a')](0x194);}return _0x457089;};}function handleError(_0x36502d,_0x3dbd10){_0x3dbd10=_0x3dbd10||0x1f4;return function(_0x25dfbd){logger['error'](_0x25dfbd[_0xe339('0x26')]);if(_0x25dfbd[_0xe339('0x27')]){delete _0x25dfbd['name'];}_0x36502d[_0xe339('0x1b')](_0x3dbd10)[_0xe339('0x28')](_0x25dfbd);};}exports[_0xe339('0x23')]=function(_0x1d4a55,_0x46d188){if(_0x1d4a55[_0xe339('0x29')]['id']){delete _0x1d4a55[_0xe339('0x29')]['id'];}return db[_0xe339('0x2a')][_0xe339('0x2b')]({'where':{'id':_0x1d4a55[_0xe339('0x2c')]['id']}})[_0xe339('0x2d')](handleEntityNotFound(_0x46d188,null))[_0xe339('0x2d')](saveUpdates(_0x1d4a55['body'],null))['then'](respondWithResult(_0x46d188,null))[_0xe339('0x2e')](handleError(_0x46d188,null));};exports['destroy']=function(_0xac9faa,_0x245188){return db[_0xe339('0x2a')][_0xe339('0x2b')]({'where':{'id':_0xac9faa['params']['id']}})[_0xe339('0x2d')](handleEntityNotFound(_0x245188,null))[_0xe339('0x2d')](removeEntity(_0x245188,null))[_0xe339('0x2e')](handleError(_0x245188,null));}; \ No newline at end of file diff --git a/server/api/action/action.model.js b/server/api/action/action.model.js index d59fa75..e3333b7 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 _0x4fab=['moment','request-promise','path','rimraf','../../config/environment','tools_actions','util','../../config/logger','api'];(function(_0x64f937,_0x204fb1){var _0x5e32c0=function(_0x31eb33){while(--_0x31eb33){_0x64f937['push'](_0x64f937['shift']());}};_0x5e32c0(++_0x204fb1);}(_0x4fab,0x72));var _0xb4fa=function(_0x8c324c,_0xe6ae64){_0x8c324c=_0x8c324c-0x0;var _0x12bbb9=_0x4fab[_0x8c324c];return _0x12bbb9;};'use strict';var _=require('lodash');var util=require(_0xb4fa('0x0'));var logger=require(_0xb4fa('0x1'))(_0xb4fa('0x2'));var moment=require(_0xb4fa('0x3'));var BPromise=require('bluebird');var rp=require(_0xb4fa('0x4'));var fs=require('fs');var path=require(_0xb4fa('0x5'));var rimraf=require(_0xb4fa('0x6'));var config=require(_0xb4fa('0x7'));var attributes=require('./action.attributes');module['exports']=function(_0x4cfd88,_0x21c30a){return _0x4cfd88['define']('Action',attributes,{'tableName':_0xb4fa('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8998=['Action','tools_actions','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./action.attributes','exports'];(function(_0x53a0ce,_0x5eaa86){var _0x491112=function(_0xb4b450){while(--_0xb4b450){_0x53a0ce['push'](_0x53a0ce['shift']());}};_0x491112(++_0x5eaa86);}(_0x8998,0x1ca));var _0x8899=function(_0x44b3d0,_0x5e2592){_0x44b3d0=_0x44b3d0-0x0;var _0x14e438=_0x8998[_0x44b3d0];return _0x14e438;};'use strict';var _=require(_0x8899('0x0'));var util=require(_0x8899('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8899('0x2'));var BPromise=require(_0x8899('0x3'));var rp=require(_0x8899('0x4'));var fs=require('fs');var path=require(_0x8899('0x5'));var rimraf=require(_0x8899('0x6'));var config=require(_0x8899('0x7'));var attributes=require(_0x8899('0x8'));module[_0x8899('0x9')]=function(_0x333623,_0x28947d){return _0x333623['define'](_0x8899('0xa'),attributes,{'tableName':_0x8899('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 f35d47a..72d8db6 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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x5054c0,_0x3213da){var _0x127010=function(_0x16d5ef){while(--_0x16d5ef){_0x5054c0['push'](_0x5054c0['shift']());}};_0x127010(++_0x3213da);}(_0xabce,0x103));var _0xeabc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xabce[_0x1facfa];return _0x9ec701;};'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')]('Action,\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 _0xabce=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','client','then','info','Action,\x20%s,\x20%s','request\x20sent','debug','Action,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash'];(function(_0x263785,_0xfc374c){var _0x23f2a3=function(_0x26a168){while(--_0x26a168){_0x263785['push'](_0x263785['shift']());}};_0x23f2a3(++_0xfc374c);}(_0xabce,0x103));var _0xeabc=function(_0x2160a9,_0x3cbd9e){_0x2160a9=_0x2160a9-0x0;var _0xa88cf7=_0xabce[_0x2160a9];return _0xa88cf7;};'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')]('Action,\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 diff --git a/server/api/action/index.js b/server/api/action/index.js index aaf97de..763f7ed 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 _0x50e0=['util','path','connect-timeout','Router','./action.controller','put','/:id','isAuthenticated','update','delete','destroy','exports','multer'];(function(_0x1eb82d,_0x1e23cb){var _0x2c9502=function(_0x4a3500){while(--_0x4a3500){_0x1eb82d['push'](_0x1eb82d['shift']());}};_0x2c9502(++_0x1e23cb);}(_0x50e0,0x19f));var _0x050e=function(_0x427fbd,_0xfa52d){_0x427fbd=_0x427fbd-0x0;var _0x4eddcc=_0x50e0[_0x427fbd];return _0x4eddcc;};'use strict';var multer=require(_0x050e('0x0'));var util=require(_0x050e('0x1'));var path=require(_0x050e('0x2'));var timeout=require(_0x050e('0x3'));var express=require('express');var router=express[_0x050e('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x050e('0x5'));router[_0x050e('0x6')](_0x050e('0x7'),auth[_0x050e('0x8')](),controller[_0x050e('0x9')]);router[_0x050e('0xa')](_0x050e('0x7'),auth['isAuthenticated'](),controller[_0x050e('0xb')]);module[_0x050e('0xc')]=router; \ No newline at end of file +var _0xd8e2=['isAuthenticated','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','put','/:id'];(function(_0x4a632f,_0x200ab6){var _0x306a2c=function(_0x3e4988){while(--_0x3e4988){_0x4a632f['push'](_0x4a632f['shift']());}};_0x306a2c(++_0x200ab6);}(_0xd8e2,0x6f));var _0x2d8e=function(_0x351e48,_0x1c29df){_0x351e48=_0x351e48-0x0;var _0x326d3a=_0xd8e2[_0x351e48];return _0x326d3a;};'use strict';var multer=require('multer');var util=require(_0x2d8e('0x0'));var path=require(_0x2d8e('0x1'));var timeout=require(_0x2d8e('0x2'));var express=require('express');var router=express[_0x2d8e('0x3')]();var fs_extra=require(_0x2d8e('0x4'));var auth=require(_0x2d8e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2d8e('0x6'));var controller=require('./action.controller');router[_0x2d8e('0x7')](_0x2d8e('0x8'),auth[_0x2d8e('0x9')](),controller['update']);router['delete'](_0x2d8e('0x8'),auth[_0x2d8e('0x9')](),controller[_0x2d8e('0xa')]);module[_0x2d8e('0xb')]=router; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.attributes.js b/server/api/analyticCustomReport/analyticCustomReport.attributes.js index 1c446ce..c35ad2c 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 _0x98a8=['sequelize','exports','STRING','TEXT'];(function(_0x5b7c74,_0x489563){var _0x303ee0=function(_0x15abd7){while(--_0x15abd7){_0x5b7c74['push'](_0x5b7c74['shift']());}};_0x303ee0(++_0x489563);}(_0x98a8,0x12c));var _0x898a=function(_0x2d4c6f,_0x246d71){_0x2d4c6f=_0x2d4c6f-0x0;var _0x4445a6=_0x98a8[_0x2d4c6f];return _0x4445a6;};'use strict';var Sequelize=require(_0x898a('0x0'));module[_0x898a('0x1')]={'name':{'type':Sequelize[_0x898a('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x898a('0x2')]},'parent':{'type':Sequelize[_0x898a('0x2')]},'table':{'type':Sequelize[_0x898a('0x2')]},'conditions':{'type':Sequelize[_0x898a('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file +var _0xa630=['STRING','TEXT','sequelize','exports'];(function(_0x267096,_0x549583){var _0x4c4847=function(_0x5a56f5){while(--_0x5a56f5){_0x267096['push'](_0x267096['shift']());}};_0x4c4847(++_0x549583);}(_0xa630,0xbe));var _0x0a63=function(_0x107a52,_0x298ca2){_0x107a52=_0x107a52-0x0;var _0xffd148=_0xa630[_0x107a52];return _0xffd148;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'parent':{'type':Sequelize[_0x0a63('0x2')]},'table':{'type':Sequelize['STRING']},'conditions':{'type':Sequelize[_0x0a63('0x3')]},'joins':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.controller.js b/server/api/analyticCustomReport/analyticCustomReport.controller.js index e70b361..baa5fea 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 _0x9c7d=['findAll','rows','catch','params','keys','include','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','Reports','UserProfileSection','userProfileId','error','update','destroy','preview','join','left_join','right_join','COUNT(DISTINCT\x20%s)','MAX(%s)','MIN(%s)','AVG(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','HOUR(%s)','ROUND(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','operator','rules','group','field','condition','value','getFields','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','keyBy','select','table','MetricId','metric','function','replace','format','groupBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','foreignKey','conditions','clone','Limited\x20Query:','toString','sequelize','SELECT','SUM(%s)','COUNT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','UNIX_TIMESTAMP(%s)','IS\x20EMPTY','from','orderBy','output','web','fullPath','randomstring','generate','csv','custom','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','Run\x20Query:','child_process','fork','../../components/export/','savename','countTable','COUNT(*)','QueryTypes','run','runReport','cross_join','debug','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','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/utils','../../config/environment','../../mysqldb','dbH','sendStatus','status','json','offset','limit','undefined','count','Content-Range','reject','then','get','CustomReports','UserProfileResource','end','name','send','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','AnalyticCustomReport','includeAll'];(function(_0x458ca7,_0x55cbb2){var _0x4a0935=function(_0x268442){while(--_0x268442){_0x458ca7['push'](_0x458ca7['shift']());}};_0x4a0935(++_0x55cbb2);}(_0x9c7d,0x1ba));var _0xd9c7=function(_0x57486e,_0x32283b){_0x57486e=_0x57486e-0x0;var _0x5f110b=_0x9c7d[_0x57486e];return _0x5f110b;};'use strict';var emlformat=require(_0xd9c7('0x0'));var rimraf=require(_0xd9c7('0x1'));var zipdir=require(_0xd9c7('0x2'));var jsonpatch=require(_0xd9c7('0x3'));var rp=require(_0xd9c7('0x4'));var moment=require(_0xd9c7('0x5'));var BPromise=require(_0xd9c7('0x6'));var Mustache=require(_0xd9c7('0x7'));var util=require('util');var path=require(_0xd9c7('0x8'));var sox=require(_0xd9c7('0x9'));var csv=require(_0xd9c7('0xa'));var ejs=require(_0xd9c7('0xb'));var fs=require('fs');var fs_extra=require(_0xd9c7('0xc'));var _=require('lodash');var squel=require(_0xd9c7('0xd'));var crypto=require('crypto');var jsforce=require(_0xd9c7('0xe'));var deskjs=require(_0xd9c7('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd9c7('0x10'));var Papa=require(_0xd9c7('0x11'));var Redis=require(_0xd9c7('0x12'));var authService=require(_0xd9c7('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xd9c7('0x14'));var hardwareService=require(_0xd9c7('0x15'));var logger=require(_0xd9c7('0x16'))(_0xd9c7('0x17'));var utils=require(_0xd9c7('0x18'));var config=require(_0xd9c7('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xd9c7('0x1a'))['db'];var dbH=require(_0xd9c7('0x1a'))[_0xd9c7('0x1b')];function respondWithStatusCode(_0x1e4842,_0xb1e072){_0xb1e072=_0xb1e072||0xcc;return function(_0x4e0cb3){if(_0x4e0cb3){return _0x1e4842[_0xd9c7('0x1c')](_0xb1e072);}return _0x1e4842[_0xd9c7('0x1d')](_0xb1e072)['end']();};}function respondWithResult(_0x518b40,_0x204b0e){_0x204b0e=_0x204b0e||0xc8;return function(_0x5605e1){if(_0x5605e1){return _0x518b40['status'](_0x204b0e)[_0xd9c7('0x1e')](_0x5605e1);}};}function respondWithFilteredResult(_0x169e91,_0x2a4650){return function(_0x2d8e5c){if(_0x2d8e5c){var _0x1e07d9=typeof _0x2a4650[_0xd9c7('0x1f')]==='undefined'&&typeof _0x2a4650[_0xd9c7('0x20')]===_0xd9c7('0x21');var _0x490350=_0x2d8e5c[_0xd9c7('0x22')];var _0x28700b=_0x1e07d9?0x0:_0x2a4650[_0xd9c7('0x1f')];var _0x396dc3=_0x1e07d9?_0x2d8e5c['count']:_0x2a4650[_0xd9c7('0x1f')]+_0x2a4650[_0xd9c7('0x20')];var _0x7e6d78;if(_0x396dc3>=_0x490350){_0x396dc3=_0x490350;_0x7e6d78=0xc8;}else{_0x7e6d78=0xce;}_0x169e91['status'](_0x7e6d78);return _0x169e91['set'](_0xd9c7('0x23'),_0x28700b+'-'+_0x396dc3+'/'+_0x490350)[_0xd9c7('0x1e')](_0x2d8e5c);}return null;};}function patchUpdates(_0x5e85e6){return function(_0x38cd8d){try{jsonpatch['apply'](_0x38cd8d,_0x5e85e6,!![]);}catch(_0x4a9bc6){return BPromise[_0xd9c7('0x24')](_0x4a9bc6);}return _0x38cd8d['save']();};}function saveUpdates(_0x7d4146,_0x363a3c){return function(_0x542159){if(_0x542159){return _0x542159['update'](_0x7d4146)[_0xd9c7('0x25')](function(_0x12b7b3){return _0x12b7b3;});}return null;};}function removeEntity(_0x34daa5,_0x1b3992){return function(_0x4d9427){if(_0x4d9427){return _0x4d9427['destroy']()['then'](function(){var _0x291a60=_0x4d9427[_0xd9c7('0x26')]({'plain':!![]});var _0x116ba4=_0xd9c7('0x27');return db[_0xd9c7('0x28')]['destroy']({'where':{'type':_0x116ba4,'resourceId':_0x291a60['id']}})[_0xd9c7('0x25')](function(){return _0x4d9427;});})[_0xd9c7('0x25')](function(){_0x34daa5[_0xd9c7('0x1d')](0xcc)[_0xd9c7('0x29')]();});}};}function handleEntityNotFound(_0x15620c,_0x1a2227){return function(_0x1c7d2b){if(!_0x1c7d2b){_0x15620c[_0xd9c7('0x1c')](0x194);}return _0x1c7d2b;};}function handleError(_0x561d8d,_0x35d66a){_0x35d66a=_0x35d66a||0x1f4;return function(_0x2fe1b9){logger['error'](_0x2fe1b9['stack']);if(_0x2fe1b9[_0xd9c7('0x2a')]){delete _0x2fe1b9[_0xd9c7('0x2a')];}_0x561d8d[_0xd9c7('0x1d')](_0x35d66a)[_0xd9c7('0x2b')](_0x2fe1b9);};}exports[_0xd9c7('0x2c')]=function(_0x5dcbb4,_0x1056c7){var _0x3af43b={},_0x496319={},_0x38b3bb={'count':0x0,'rows':[]};var _0x14aedb=_[_0xd9c7('0x2d')](db['AnalyticCustomReport'][_0xd9c7('0x2e')],function(_0x4d5e83){return{'name':_0x4d5e83[_0xd9c7('0x2f')],'type':_0x4d5e83[_0xd9c7('0x30')][_0xd9c7('0x31')]};});_0x496319['model']=_[_0xd9c7('0x2d')](_0x14aedb,'name');_0x496319[_0xd9c7('0x32')]=_['keys'](_0x5dcbb4[_0xd9c7('0x32')]);_0x496319[_0xd9c7('0x33')]=_[_0xd9c7('0x34')](_0x496319[_0xd9c7('0x35')],_0x496319[_0xd9c7('0x32')]);_0x3af43b[_0xd9c7('0x36')]=_[_0xd9c7('0x34')](_0x496319[_0xd9c7('0x35')],qs[_0xd9c7('0x37')](_0x5dcbb4['query'][_0xd9c7('0x37')]));_0x3af43b[_0xd9c7('0x36')]=_0x3af43b[_0xd9c7('0x36')][_0xd9c7('0x38')]?_0x3af43b[_0xd9c7('0x36')]:_0x496319[_0xd9c7('0x35')];if(!_0x5dcbb4[_0xd9c7('0x32')][_0xd9c7('0x39')](_0xd9c7('0x3a'))){_0x3af43b['limit']=qs[_0xd9c7('0x20')](_0x5dcbb4[_0xd9c7('0x32')][_0xd9c7('0x20')]);_0x3af43b[_0xd9c7('0x1f')]=qs[_0xd9c7('0x1f')](_0x5dcbb4[_0xd9c7('0x32')]['offset']);}_0x3af43b[_0xd9c7('0x3b')]=qs[_0xd9c7('0x3c')](_0x5dcbb4['query']['sort']);_0x3af43b['where']=qs[_0xd9c7('0x33')](_[_0xd9c7('0x3d')](_0x5dcbb4['query'],_0x496319[_0xd9c7('0x33')]),_0x14aedb);if(_0x5dcbb4[_0xd9c7('0x32')]['filter']){_0x3af43b[_0xd9c7('0x3e')]=_[_0xd9c7('0x3f')](_0x3af43b[_0xd9c7('0x3e')],{'$or':_[_0xd9c7('0x2d')](_0x14aedb,function(_0x4ad8cb){if(_0x4ad8cb['type']!=='VIRTUAL'){var _0x3cb0f9={};_0x3cb0f9[_0x4ad8cb[_0xd9c7('0x2a')]]={'$like':'%'+_0x5dcbb4[_0xd9c7('0x32')][_0xd9c7('0x40')]+'%'};return _0x3cb0f9;}})});}_0x3af43b=_[_0xd9c7('0x3f')]({},_0x3af43b,_0x5dcbb4[_0xd9c7('0x41')]);var _0x174e21={'where':_0x3af43b['where']};return db[_0xd9c7('0x42')][_0xd9c7('0x22')](_0x174e21)[_0xd9c7('0x25')](function(_0x1dad62){_0x38b3bb['count']=_0x1dad62;if(_0x5dcbb4[_0xd9c7('0x32')][_0xd9c7('0x43')]){_0x3af43b['include']=[{'all':!![]}];}return db[_0xd9c7('0x42')][_0xd9c7('0x44')](_0x3af43b);})[_0xd9c7('0x25')](function(_0x2c0d2e){_0x38b3bb[_0xd9c7('0x45')]=_0x2c0d2e;return _0x38b3bb;})[_0xd9c7('0x25')](respondWithFilteredResult(_0x1056c7,_0x3af43b))[_0xd9c7('0x46')](handleError(_0x1056c7,null));};exports['show']=function(_0x2be492,_0x25ad14){var _0x8035be={'raw':![],'where':{'id':_0x2be492[_0xd9c7('0x47')]['id']}},_0x398fc9={};_0x398fc9[_0xd9c7('0x35')]=_['keys'](db[_0xd9c7('0x42')][_0xd9c7('0x2e')]);_0x398fc9[_0xd9c7('0x32')]=_[_0xd9c7('0x48')](_0x2be492[_0xd9c7('0x32')]);_0x398fc9[_0xd9c7('0x33')]=_[_0xd9c7('0x34')](_0x398fc9[_0xd9c7('0x35')],_0x398fc9[_0xd9c7('0x32')]);_0x8035be[_0xd9c7('0x36')]=_['intersection'](_0x398fc9[_0xd9c7('0x35')],qs['fields'](_0x2be492[_0xd9c7('0x32')][_0xd9c7('0x37')]));_0x8035be[_0xd9c7('0x36')]=_0x8035be['attributes']['length']?_0x8035be[_0xd9c7('0x36')]:_0x398fc9[_0xd9c7('0x35')];if(_0x2be492['query'][_0xd9c7('0x43')]){_0x8035be[_0xd9c7('0x49')]=[{'all':!![]}];}_0x8035be=_[_0xd9c7('0x3f')]({},_0x8035be,_0x2be492[_0xd9c7('0x41')]);return db[_0xd9c7('0x42')][_0xd9c7('0x4a')](_0x8035be)[_0xd9c7('0x25')](handleEntityNotFound(_0x25ad14,null))[_0xd9c7('0x25')](respondWithResult(_0x25ad14,null))[_0xd9c7('0x46')](handleError(_0x25ad14,null));};exports[_0xd9c7('0x4b')]=function(_0x3c9ecd,_0x6e25dc){return db['AnalyticCustomReport'][_0xd9c7('0x4b')](_0x3c9ecd[_0xd9c7('0x4c')],{})[_0xd9c7('0x25')](function(_0x17cabc){var _0x1e6260=_0x3c9ecd['user'][_0xd9c7('0x26')]({'plain':!![]});if(!_0x1e6260)throw new Error(_0xd9c7('0x4d'));if(_0x1e6260[_0xd9c7('0x4e')]===_0xd9c7('0x4f')){var _0x395d3f=_0x17cabc['get']({'plain':!![]});var _0x5ddb96=_0xd9c7('0x50');return db[_0xd9c7('0x51')][_0xd9c7('0x4a')]({'where':{'name':_0x5ddb96,'userProfileId':_0x1e6260[_0xd9c7('0x52')]},'raw':!![]})['then'](function(_0x5c44b1){if(_0x5c44b1&&_0x5c44b1['autoAssociation']===0x0){return db[_0xd9c7('0x28')][_0xd9c7('0x4b')]({'name':_0x395d3f[_0xd9c7('0x2a')],'resourceId':_0x395d3f['id'],'type':_0xd9c7('0x27'),'sectionId':_0x5c44b1['id']},{})[_0xd9c7('0x25')](function(){return _0x17cabc;});}else{return _0x17cabc;}})[_0xd9c7('0x46')](function(_0x2431f1){logger[_0xd9c7('0x53')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2431f1);throw _0x2431f1;});}return _0x17cabc;})[_0xd9c7('0x25')](respondWithResult(_0x6e25dc,0xc9))[_0xd9c7('0x46')](handleError(_0x6e25dc,null));};exports[_0xd9c7('0x54')]=function(_0x324ddb,_0x11628c){if(_0x324ddb['body']['id']){delete _0x324ddb[_0xd9c7('0x4c')]['id'];}return db[_0xd9c7('0x42')]['find']({'where':{'id':_0x324ddb[_0xd9c7('0x47')]['id']}})[_0xd9c7('0x25')](handleEntityNotFound(_0x11628c,null))['then'](saveUpdates(_0x324ddb[_0xd9c7('0x4c')],null))[_0xd9c7('0x25')](respondWithResult(_0x11628c,null))[_0xd9c7('0x46')](handleError(_0x11628c,null));};exports[_0xd9c7('0x55')]=function(_0x48c59e,_0x1e5633){return db[_0xd9c7('0x42')][_0xd9c7('0x4a')]({'where':{'id':_0x48c59e[_0xd9c7('0x47')]['id']}})['then'](handleEntityNotFound(_0x1e5633,null))[_0xd9c7('0x25')](removeEntity(_0x1e5633,null))[_0xd9c7('0x46')](handleError(_0x1e5633,null));};exports[_0xd9c7('0x56')]=function(_0x56a46e,_0x35bd8e){var _0x45d648=0xa;var _0x1bd3c8=[_0xd9c7('0x57'),_0xd9c7('0x58'),_0xd9c7('0x59'),'cross_join'];var _0xacd55c={'SUM':'SUM(%s)','COUNT':'COUNT(%s)','COUNT DISTINCT':_0xd9c7('0x5a'),'MAX':_0xd9c7('0x5b'),'MIN':_0xd9c7('0x5c'),'AVG':_0xd9c7('0x5d'),'GROUP_CONCAT':_0xd9c7('0x5e'),'GROUP_CONCAT ASC':_0xd9c7('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3e2fa7={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':'DATE(%s)','HOUR':_0xd9c7('0x60'),'ROUND':_0xd9c7('0x61'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x164dd5=function(_0x4d885c){return!_[_0xd9c7('0x62')]([_0xd9c7('0x63'),_0xd9c7('0x64'),'IS\x20EMPTY',_0xd9c7('0x65')],_0x4d885c);};var _0x51de1a=function(_0x3c8488){if(!_0x3c8488||!_0x3c8488['rules'][_0xd9c7('0x38')]){return'';}for(var _0x2b9c22='(',_0x41fd6f=0x0;_0x41fd6f<_0x3c8488['rules'][_0xd9c7('0x38')];_0x41fd6f+=0x1){_0x41fd6f>0x0&&(_0x2b9c22+='\x20'+_0x3c8488[_0xd9c7('0x66')]+'\x20');_0x2b9c22+=_0x3c8488[_0xd9c7('0x67')][_0x41fd6f][_0xd9c7('0x68')]?_0x51de1a(_0x3c8488[_0xd9c7('0x67')][_0x41fd6f][_0xd9c7('0x68')]):_0x3c8488[_0xd9c7('0x67')][_0x41fd6f][_0xd9c7('0x69')]+'\x20'+_0x3c8488[_0xd9c7('0x67')][_0x41fd6f][_0xd9c7('0x6a')]+(_0x164dd5(_0x3c8488[_0xd9c7('0x67')][_0x41fd6f]['condition'])?'\x20'+_0x3c8488[_0xd9c7('0x67')][_0x41fd6f][_0xd9c7('0x6b')]:'');}return _0x2b9c22+')';};var _0x4a8e84={'where':{'id':_0x56a46e[_0xd9c7('0x47')]['id']}},_0xa13c7e,_0x134eeb,_0x22093a,_0x32a230,_0x37d59b;_0x4a8e84=_[_0xd9c7('0x3f')]({},_0x4a8e84,_0x56a46e[_0xd9c7('0x41')]);return db['AnalyticCustomReport'][_0xd9c7('0x4a')](_0x4a8e84)[_0xd9c7('0x25')](function(_0x560586){if(_0x560586){_0xa13c7e=_0x560586;return _0x560586[_0xd9c7('0x6c')]();}return null;})['then'](function(_0x179eaf){if(_0x179eaf){if(!_0x179eaf[_0xd9c7('0x38')]){throw new db[(_0xd9c7('0x6d'))][(_0xd9c7('0x6e'))](_0xd9c7('0x6f'),0x193);}_0x134eeb=_0x179eaf;return db[_0xd9c7('0x70')][_0xd9c7('0x44')]({'raw':!![]});}return null;})[_0xd9c7('0x25')](function(_0x5ad050){if(_0x5ad050){_0x22093a=_[_0xd9c7('0x71')](_0x5ad050,'id');var _0xb5131d;var _0x3fe930=squel[_0xd9c7('0x72')]();_0x3fe930['from'](_0xa13c7e[_0xd9c7('0x73')]);for(var _0x5db7f4=0x0;_0x5db7f4<_0x134eeb['length'];_0x5db7f4+=0x1){_0xb5131d=_0x134eeb[_0x5db7f4]['MetricId']?_0x22093a[_0x134eeb[_0x5db7f4][_0xd9c7('0x74')]][_0xd9c7('0x75')]:_0x134eeb[_0x5db7f4][_0xd9c7('0x69')];_0xb5131d=_0x134eeb[_0x5db7f4][_0xd9c7('0x76')]?_[_0xd9c7('0x77')](_0xacd55c[_0x134eeb[_0x5db7f4][_0xd9c7('0x76')]],'%s',_0xb5131d):_0xb5131d;_0xb5131d=_0x134eeb[_0x5db7f4]['format']?_[_0xd9c7('0x77')](_0x3e2fa7[_0x134eeb[_0x5db7f4][_0xd9c7('0x78')]],'%s',_0xb5131d):_0xb5131d;if(_0x134eeb[_0x5db7f4][_0xd9c7('0x79')]){_0x3fe930[_0xd9c7('0x68')](_0xb5131d);}_0x134eeb[_0x5db7f4]['orderBy']&&_0x3fe930['order'](_0xb5131d,_0x134eeb[_0x5db7f4]['orderBy']===_0xd9c7('0x7a')?![]:!![]);_0x3fe930[_0xd9c7('0x69')](_0xb5131d,_0x134eeb[_0x5db7f4][_0xd9c7('0x7b')]||_0xb5131d);}if(_0xa13c7e['joins']){_0xa13c7e[_0xd9c7('0x7c')]=JSON[_0xd9c7('0x7d')](_0xa13c7e[_0xd9c7('0x7c')]);for(var _0x4b8dae=0x0;_0x4b8dae<_0xa13c7e['joins']['length'];_0x4b8dae+=0x1){if(_0xa13c7e[_0xd9c7('0x7c')][_0x4b8dae]['type']&&_[_0xd9c7('0x62')](_0x1bd3c8,_0xa13c7e[_0xd9c7('0x7c')][_0x4b8dae][_0xd9c7('0x30')])&&_0xa13c7e[_0xd9c7('0x7c')][_0x4b8dae][_0xd9c7('0x7e')]&&_0xa13c7e[_0xd9c7('0x7c')][_0x4b8dae][_0xd9c7('0x7f')]&&_0xa13c7e[_0xd9c7('0x7c')][_0x4b8dae]['foreignKey']){_0x3fe930[_0xa13c7e['joins'][_0x4b8dae][_0xd9c7('0x30')]](_0xa13c7e[_0xd9c7('0x7c')][_0x4b8dae][_0xd9c7('0x7f')],null,util[_0xd9c7('0x78')](_0xd9c7('0x80'),_0xa13c7e['table'],_0xa13c7e['joins'][_0x4b8dae][_0xd9c7('0x7e')],_0xa13c7e[_0xd9c7('0x7c')][_0x4b8dae]['foreignTable'],_0xa13c7e[_0xd9c7('0x7c')][_0x4b8dae][_0xd9c7('0x81')]));}}}if(_0xa13c7e[_0xd9c7('0x82')]){_0xa13c7e['conditions']=JSON[_0xd9c7('0x7d')](_0xa13c7e[_0xd9c7('0x82')]);_0x3fe930[_0xd9c7('0x3e')](_0x51de1a(_0xa13c7e[_0xd9c7('0x82')][_0xd9c7('0x68')]));}_0x37d59b=_0x3fe930[_0xd9c7('0x83')]();_0x3fe930[_0xd9c7('0x20')](_0x45d648);_0x3fe930[_0xd9c7('0x1f')](0x0);logger['debug'](_0xd9c7('0x84'),_0x3fe930[_0xd9c7('0x85')]());return dbH[_0xd9c7('0x86')][_0xd9c7('0x32')](_0x3fe930[_0xd9c7('0x85')](),{'type':dbH['sequelize']['QueryTypes'][_0xd9c7('0x87')]});}})[_0xd9c7('0x25')](respondWithResult(_0x35bd8e,null))[_0xd9c7('0x46')](handleError(_0x35bd8e,null));};function runReport(_0x5095a8,_0x5bae9e,_0x99d829){var _0x31ee60=_0x5bae9e['name'];var _0xd065a3=0xa;var _0x398eaf=[_0xd9c7('0x57'),_0xd9c7('0x58'),'right_join','cross_join'];var _0x131f73={'SUM':_0xd9c7('0x88'),'COUNT':_0xd9c7('0x89'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':_0xd9c7('0x5b'),'MIN':_0xd9c7('0x5c'),'AVG':_0xd9c7('0x5d'),'GROUP_CONCAT':_0xd9c7('0x5e'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xd9c7('0x8a')};var _0x508ff1={'SEC_TO_TIME':_0xd9c7('0x8b'),'DATE':_0xd9c7('0x8c'),'HOUR':_0xd9c7('0x60'),'ROUND':_0xd9c7('0x61'),'UNIX_TIMESTAMP':_0xd9c7('0x8d')};var _0x344357=function(_0x8b54c5){return!_[_0xd9c7('0x62')]([_0xd9c7('0x63'),_0xd9c7('0x64'),_0xd9c7('0x8e'),'IS\x20NOT\x20EMPTY'],_0x8b54c5);};var _0x492e9e=function(_0x1e5808){if(!_0x1e5808||!_0x1e5808[_0xd9c7('0x67')][_0xd9c7('0x38')]){return'';}for(var _0x11a6bf='(',_0x25e4cb=0x0;_0x25e4cb<_0x1e5808[_0xd9c7('0x67')][_0xd9c7('0x38')];_0x25e4cb+=0x1){_0x25e4cb>0x0&&(_0x11a6bf+='\x20'+_0x1e5808[_0xd9c7('0x66')]+'\x20');_0x11a6bf+=_0x1e5808[_0xd9c7('0x67')][_0x25e4cb]['group']?_0x492e9e(_0x1e5808[_0xd9c7('0x67')][_0x25e4cb][_0xd9c7('0x68')]):_0x1e5808[_0xd9c7('0x67')][_0x25e4cb][_0xd9c7('0x69')]+'\x20'+_0x1e5808[_0xd9c7('0x67')][_0x25e4cb][_0xd9c7('0x6a')]+(_0x344357(_0x1e5808['rules'][_0x25e4cb][_0xd9c7('0x6a')])?'\x20'+_0x1e5808[_0xd9c7('0x67')][_0x25e4cb][_0xd9c7('0x6b')]:'');}return _0x11a6bf+')';};var _0xbd7a88={'where':{'id':_0x5095a8['id']}},_0xa90f3b,_0x154ae5,_0x8ad105,_0x2b46aa,_0x5c2b34;_0xbd7a88=_[_0xd9c7('0x3f')]({},_0xbd7a88,_0x99d829);return db[_0xd9c7('0x42')][_0xd9c7('0x4a')](_0xbd7a88)['then'](function(_0x6d3627){if(_0x6d3627){_0xa90f3b=_0x6d3627;return _0x6d3627[_0xd9c7('0x6c')]();}return null;})[_0xd9c7('0x25')](function(_0x5cebb5){if(_0x5cebb5){if(!_0x5cebb5[_0xd9c7('0x38')]){throw new db['Sequelize'][(_0xd9c7('0x6e'))](_0xd9c7('0x6f'),0x193);}_0x154ae5=_0x5cebb5;return db[_0xd9c7('0x70')][_0xd9c7('0x44')]({'raw':!![]});}return null;})[_0xd9c7('0x25')](function(_0x1bcd9a){if(_0x1bcd9a){_0x8ad105=_[_0xd9c7('0x71')](_0x1bcd9a,'id');var _0x339019;var _0x236fa2=squel[_0xd9c7('0x72')]();_0x236fa2[_0xd9c7('0x8f')](_0xa90f3b[_0xd9c7('0x73')]);for(var _0x15b36e=0x0;_0x15b36e<_0x154ae5[_0xd9c7('0x38')];_0x15b36e+=0x1){_0x339019=_0x154ae5[_0x15b36e][_0xd9c7('0x74')]?_0x8ad105[_0x154ae5[_0x15b36e][_0xd9c7('0x74')]][_0xd9c7('0x75')]:_0x154ae5[_0x15b36e][_0xd9c7('0x69')];_0x339019=_0x154ae5[_0x15b36e][_0xd9c7('0x76')]?_[_0xd9c7('0x77')](_0x131f73[_0x154ae5[_0x15b36e][_0xd9c7('0x76')]],'%s',_0x339019):_0x339019;_0x339019=_0x154ae5[_0x15b36e][_0xd9c7('0x78')]?_[_0xd9c7('0x77')](_0x508ff1[_0x154ae5[_0x15b36e][_0xd9c7('0x78')]],'%s',_0x339019):_0x339019;if(_0x154ae5[_0x15b36e][_0xd9c7('0x79')]){_0x236fa2['group'](_0x339019);}_0x154ae5[_0x15b36e][_0xd9c7('0x90')]&&_0x236fa2[_0xd9c7('0x3b')](_0x339019,_0x154ae5[_0x15b36e][_0xd9c7('0x90')]===_0xd9c7('0x7a')?![]:!![]);_0x236fa2['field'](_0x339019,_0x154ae5[_0x15b36e][_0xd9c7('0x7b')]||_0x339019);}if(_0xa90f3b['joins']){_0xa90f3b['joins']=JSON[_0xd9c7('0x7d')](_0xa90f3b[_0xd9c7('0x7c')]);for(var _0x5e8f53=0x0;_0x5e8f53<_0xa90f3b[_0xd9c7('0x7c')][_0xd9c7('0x38')];_0x5e8f53+=0x1){if(_0xa90f3b[_0xd9c7('0x7c')][_0x5e8f53][_0xd9c7('0x30')]&&_[_0xd9c7('0x62')](_0x398eaf,_0xa90f3b['joins'][_0x5e8f53][_0xd9c7('0x30')])&&_0xa90f3b[_0xd9c7('0x7c')][_0x5e8f53][_0xd9c7('0x7e')]&&_0xa90f3b[_0xd9c7('0x7c')][_0x5e8f53][_0xd9c7('0x7f')]&&_0xa90f3b[_0xd9c7('0x7c')][_0x5e8f53][_0xd9c7('0x81')]){_0x236fa2[_0xa90f3b[_0xd9c7('0x7c')][_0x5e8f53][_0xd9c7('0x30')]](_0xa90f3b[_0xd9c7('0x7c')][_0x5e8f53][_0xd9c7('0x7f')],null,util[_0xd9c7('0x78')](_0xd9c7('0x80'),_0xa90f3b[_0xd9c7('0x73')],_0xa90f3b[_0xd9c7('0x7c')][_0x5e8f53][_0xd9c7('0x7e')],_0xa90f3b[_0xd9c7('0x7c')][_0x5e8f53][_0xd9c7('0x7f')],_0xa90f3b['joins'][_0x5e8f53][_0xd9c7('0x81')]));}}}if(_0xa90f3b[_0xd9c7('0x82')]){_0xa90f3b[_0xd9c7('0x82')]=JSON[_0xd9c7('0x7d')](_0xa90f3b[_0xd9c7('0x82')]);_0x236fa2[_0xd9c7('0x3e')](_0x492e9e(_0xa90f3b[_0xd9c7('0x82')][_0xd9c7('0x68')]));}_0x5c2b34=_0x236fa2[_0xd9c7('0x83')]();_0x236fa2[_0xd9c7('0x20')](_0xd065a3);_0x236fa2[_0xd9c7('0x1f')](0x0);return;}})[_0xd9c7('0x25')](function(){if(_0x5bae9e[_0xd9c7('0x91')]===_0xd9c7('0x92')){return null;}var _0x130cd8=_['merge'](_0x5bae9e,{'name':_0x5bae9e[_0xd9c7('0x93')]||_0x5bae9e[_0xd9c7('0x2a')]||_0xa90f3b[_0xd9c7('0x2a')],'basename':_0x31ee60,'savename':util['format']('%s-%s.%s',_0x5bae9e[_0xd9c7('0x2a')]||_0xa90f3b[_0xd9c7('0x2a')],require(_0xd9c7('0x94'))[_0xd9c7('0x95')](0x4),_0x5bae9e[_0xd9c7('0x91')]||_0xd9c7('0x96')),'reportId':_0xa90f3b['id'],'reportType':_0xd9c7('0x97')});return db[_0xd9c7('0x98')][_0xd9c7('0x4b')](_0x130cd8,{'raw':!![]});})['then'](function(_0x3660a5){if(_0xa90f3b[_0xd9c7('0x73')]===_0xd9c7('0x99')){_0x5c2b34['where'](_0xa90f3b[_0xd9c7('0x73')]+_0xd9c7('0x9a'),_0x5bae9e[_0xd9c7('0x9b')],_0x5bae9e[_0xd9c7('0x9c')]);}else{_0x5c2b34[_0xd9c7('0x3e')](_0xa90f3b[_0xd9c7('0x73')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x5bae9e[_0xd9c7('0x9b')],_0x5bae9e['endDate']);}if(_0x3660a5){logger[_0xd9c7('0x9d')](_0xd9c7('0x9e'),_0x5c2b34['toString']());require(_0xd9c7('0x9f'))[_0xd9c7('0xa0')](path[_0xd9c7('0x57')](__dirname,_0xd9c7('0xa1'),_0x3660a5[_0xd9c7('0x91')]),[_0x3660a5['id'],_0x5c2b34[_0xd9c7('0x85')](),path[_0xd9c7('0x57')](__dirname,'../../files/reports',_0x3660a5[_0xd9c7('0xa2')]),_0x31ee60]);return _0x3660a5;}else{var _0x59b95b=squel['select']();_0x59b95b['from']('('+_0x5c2b34[_0xd9c7('0x85')]()+')',_0xd9c7('0xa3'));_0x59b95b[_0xd9c7('0x69')](_0xd9c7('0xa4'),_0xd9c7('0x22'));_0x5c2b34['limit'](_0x5bae9e['limit']||_0xd065a3);_0x5c2b34[_0xd9c7('0x1f')](_0x5bae9e[_0xd9c7('0x1f')]||0x0);return dbH[_0xd9c7('0x86')][_0xd9c7('0x32')](_0x59b95b[_0xd9c7('0x85')](),{'type':dbH[_0xd9c7('0x86')]['QueryTypes']['SELECT']})['then'](function(_0x11f57d){if(!_0x11f57d[_0xd9c7('0x38')]){_0x2b46aa=0x0;}else{_0x2b46aa=_0x11f57d[0x0]['count']||0x0;}return dbH[_0xd9c7('0x86')]['query'](_0x5c2b34['toString'](),{'type':dbH[_0xd9c7('0x86')][_0xd9c7('0xa5')]['SELECT']});})[_0xd9c7('0x25')](function(_0x14ff65){return{'rows':_0x14ff65||[],'count':_0x2b46aa};});}});}exports[_0xd9c7('0xa6')]=function(_0x6a0db2,_0x4dfa62){return runReport(_0x6a0db2[_0xd9c7('0x47')],_0x6a0db2['query'],_0x6a0db2[_0xd9c7('0x41')])[_0xd9c7('0x25')](respondWithResult(_0x4dfa62,null))[_0xd9c7('0x46')](handleError(_0x4dfa62,null));};exports[_0xd9c7('0xa7')]=runReport;exports['query']=function(_0x429752,_0xca33c9){var _0x33aa61=0xa;var _0xbe2257=[_0xd9c7('0x57'),_0xd9c7('0x58'),_0xd9c7('0x59'),_0xd9c7('0xa8')];var _0x5c8b1a={'SUM':'SUM(%s)','COUNT':_0xd9c7('0x89'),'COUNT DISTINCT':_0xd9c7('0x5a'),'MAX':_0xd9c7('0x5b'),'MIN':_0xd9c7('0x5c'),'AVG':_0xd9c7('0x5d'),'GROUP_CONCAT':_0xd9c7('0x5e'),'GROUP_CONCAT ASC':_0xd9c7('0x5f'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x3e8824={'SEC_TO_TIME':_0xd9c7('0x8b'),'DATE':_0xd9c7('0x8c'),'HOUR':_0xd9c7('0x60'),'ROUND':_0xd9c7('0x61'),'UNIX_TIMESTAMP':_0xd9c7('0x8d')};var _0x55c522=function(_0x574b75){return!_[_0xd9c7('0x62')]([_0xd9c7('0x63'),_0xd9c7('0x64'),_0xd9c7('0x8e'),_0xd9c7('0x65')],_0x574b75);};var _0x563fd9=function(_0x4ec2ec){if(!_0x4ec2ec||!_0x4ec2ec[_0xd9c7('0x67')][_0xd9c7('0x38')]){return'';}for(var _0x14c607='(',_0x410454=0x0;_0x410454<_0x4ec2ec[_0xd9c7('0x67')][_0xd9c7('0x38')];_0x410454+=0x1){_0x410454>0x0&&(_0x14c607+='\x20'+_0x4ec2ec[_0xd9c7('0x66')]+'\x20');_0x14c607+=_0x4ec2ec['rules'][_0x410454][_0xd9c7('0x68')]?_0x563fd9(_0x4ec2ec[_0xd9c7('0x67')][_0x410454][_0xd9c7('0x68')]):_0x4ec2ec[_0xd9c7('0x67')][_0x410454]['field']+'\x20'+_0x4ec2ec[_0xd9c7('0x67')][_0x410454][_0xd9c7('0x6a')]+(_0x55c522(_0x4ec2ec['rules'][_0x410454]['condition'])?'\x20'+_0x4ec2ec[_0xd9c7('0x67')][_0x410454]['value']:'');}return _0x14c607+')';};var _0x3b2a8e={'where':{'id':_0x429752[_0xd9c7('0x47')]['id']}},_0x3d6267,_0x39ef57,_0x5be25f,_0x3a85f8,_0x45e48b;_0x3b2a8e=_[_0xd9c7('0x3f')]({},_0x3b2a8e,_0x429752[_0xd9c7('0x41')]);return db[_0xd9c7('0x42')]['find'](_0x3b2a8e)[_0xd9c7('0x25')](function(_0x4334bc){if(_0x4334bc){_0x3d6267=_0x4334bc;return _0x4334bc['getFields']();}return null;})[_0xd9c7('0x25')](function(_0x27378e){if(_0x27378e){if(!_0x27378e[_0xd9c7('0x38')]){throw new db[(_0xd9c7('0x6d'))]['ValidationErrorItem'](_0xd9c7('0x6f'),0x193);}_0x39ef57=_0x27378e;return db[_0xd9c7('0x70')][_0xd9c7('0x44')]({'raw':!![]});}return null;})[_0xd9c7('0x25')](function(_0x3de58b){if(_0x3de58b){_0x5be25f=_['keyBy'](_0x3de58b,'id');var _0x59d652;var _0x5124db=squel[_0xd9c7('0x72')]();_0x5124db[_0xd9c7('0x8f')](_0x3d6267[_0xd9c7('0x73')]);for(var _0x5f03d5=0x0;_0x5f03d5<_0x39ef57[_0xd9c7('0x38')];_0x5f03d5+=0x1){_0x59d652=_0x39ef57[_0x5f03d5][_0xd9c7('0x74')]?_0x5be25f[_0x39ef57[_0x5f03d5]['MetricId']]['metric']:_0x39ef57[_0x5f03d5][_0xd9c7('0x69')];_0x59d652=_0x39ef57[_0x5f03d5]['function']?_[_0xd9c7('0x77')](_0x5c8b1a[_0x39ef57[_0x5f03d5][_0xd9c7('0x76')]],'%s',_0x59d652):_0x59d652;_0x59d652=_0x39ef57[_0x5f03d5][_0xd9c7('0x78')]?_[_0xd9c7('0x77')](_0x3e8824[_0x39ef57[_0x5f03d5]['format']],'%s',_0x59d652):_0x59d652;if(_0x39ef57[_0x5f03d5][_0xd9c7('0x79')]){_0x5124db[_0xd9c7('0x68')](_0x59d652);}_0x39ef57[_0x5f03d5][_0xd9c7('0x90')]&&_0x5124db['order'](_0x59d652,_0x39ef57[_0x5f03d5][_0xd9c7('0x90')]==='DESC'?![]:!![]);_0x5124db[_0xd9c7('0x69')](_0x59d652,_0x39ef57[_0x5f03d5][_0xd9c7('0x7b')]||_0x59d652);}if(_0x3d6267[_0xd9c7('0x7c')]){_0x3d6267[_0xd9c7('0x7c')]=JSON[_0xd9c7('0x7d')](_0x3d6267['joins']);for(var _0x5f05c7=0x0;_0x5f05c7<_0x3d6267['joins'][_0xd9c7('0x38')];_0x5f05c7+=0x1){if(_0x3d6267[_0xd9c7('0x7c')][_0x5f05c7][_0xd9c7('0x30')]&&_[_0xd9c7('0x62')](_0xbe2257,_0x3d6267['joins'][_0x5f05c7][_0xd9c7('0x30')])&&_0x3d6267[_0xd9c7('0x7c')][_0x5f05c7][_0xd9c7('0x7e')]&&_0x3d6267[_0xd9c7('0x7c')][_0x5f05c7][_0xd9c7('0x7f')]&&_0x3d6267['joins'][_0x5f05c7][_0xd9c7('0x81')]){_0x5124db[_0x3d6267[_0xd9c7('0x7c')][_0x5f05c7][_0xd9c7('0x30')]](_0x3d6267[_0xd9c7('0x7c')][_0x5f05c7][_0xd9c7('0x7f')],null,util['format']('%s.%s\x20=\x20%s.%s',_0x3d6267[_0xd9c7('0x73')],_0x3d6267['joins'][_0x5f05c7][_0xd9c7('0x7e')],_0x3d6267[_0xd9c7('0x7c')][_0x5f05c7][_0xd9c7('0x7f')],_0x3d6267[_0xd9c7('0x7c')][_0x5f05c7][_0xd9c7('0x81')]));}}}if(_0x3d6267[_0xd9c7('0x82')]){_0x3d6267['conditions']=JSON['parse'](_0x3d6267[_0xd9c7('0x82')]);_0x5124db[_0xd9c7('0x3e')](_0x563fd9(_0x3d6267[_0xd9c7('0x82')][_0xd9c7('0x68')]));}_0x45e48b=_0x5124db[_0xd9c7('0x83')]();_0x5124db[_0xd9c7('0x20')](_0x33aa61);_0x5124db[_0xd9c7('0x1f')](0x0);logger[_0xd9c7('0xa9')](_0xd9c7('0x84'),_0x5124db[_0xd9c7('0x85')]());return dbH['sequelize']['query'](_0x5124db[_0xd9c7('0x85')](),{'type':dbH['sequelize'][_0xd9c7('0xa5')]['SELECT']});}})[_0xd9c7('0x25')](function(){return{'sql':_0x45e48b[_0xd9c7('0x85')]()};})[_0xd9c7('0x25')](respondWithResult(_0xca33c9,null))[_0xd9c7('0x46')](handleError(_0xca33c9,null));}; \ No newline at end of file +var _0x83bf=['attributes','fields','hasOwnProperty','nolimit','order','sort','pick','where','merge','include','rows','catch','show','params','length','options','create','body','role','user','Reports','UserProfileSection','userProfileId','autoAssociation','error','find','preview','left_join','right_join','cross_join','SUM(%s)','COUNT(%s)','COUNT(DISTINCT\x20%s)','AVG(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','ROUND(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','operator','group','condition','Sequelize','ValidationErrorItem','Please\x20insert\x20at\x20least\x20one\x20field','AnalyticMetric','findAll','select','MetricId','metric','field','replace','function','format','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','%s.%s\x20=\x20%s.%s','table','foreignKey','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','join','MAX(%s)','MIN(%s)','GROUP_CONCAT(%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','IS\x20EMPTY','from','groupBy','output','web','%s-%s.%s','generate','csv','custom','AnalyticExtractedReport','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','endDate','info','fork','../../components/export/','countTable','COUNT(*)','QueryTypes','run','runReport','getFields','keyBy','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','lodash','crypto','jsforce','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','dbH','sendStatus','status','end','offset','limit','undefined','count','set','apply','reject','save','update','destroy','then','get','CustomReports','UserProfileResource','stack','name','index','map','AnalyticCustomReport','fieldName','type','key','model','keys','query','filters','intersection'];(function(_0x147463,_0x483448){var _0x433933=function(_0x166238){while(--_0x166238){_0x147463['push'](_0x147463['shift']());}};_0x433933(++_0x483448);}(_0x83bf,0x69));var _0xf83b=function(_0x1a6c94,_0x445053){_0x1a6c94=_0x1a6c94-0x0;var _0x4a2d59=_0x83bf[_0x1a6c94];return _0x4a2d59;};'use strict';var emlformat=require(_0xf83b('0x0'));var rimraf=require(_0xf83b('0x1'));var zipdir=require(_0xf83b('0x2'));var jsonpatch=require(_0xf83b('0x3'));var rp=require('request-promise');var moment=require(_0xf83b('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xf83b('0x5'));var util=require(_0xf83b('0x6'));var path=require(_0xf83b('0x7'));var sox=require(_0xf83b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf83b('0x9'));var squel=require('squel');var crypto=require(_0xf83b('0xa'));var jsforce=require(_0xf83b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0xf83b('0xc'));var querystring=require('querystring');var Papa=require(_0xf83b('0xd'));var Redis=require(_0xf83b('0xe'));var authService=require(_0xf83b('0xf'));var qs=require(_0xf83b('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf83b('0x11'));var logger=require(_0xf83b('0x12'))(_0xf83b('0x13'));var utils=require(_0xf83b('0x14'));var config=require(_0xf83b('0x15'));var licenseUtil=require(_0xf83b('0x16'));var db=require('../../mysqldb')['db'];var dbH=require(_0xf83b('0x17'))[_0xf83b('0x18')];function respondWithStatusCode(_0x3e1bfa,_0x2d8d5f){_0x2d8d5f=_0x2d8d5f||0xcc;return function(_0xf8141c){if(_0xf8141c){return _0x3e1bfa[_0xf83b('0x19')](_0x2d8d5f);}return _0x3e1bfa[_0xf83b('0x1a')](_0x2d8d5f)[_0xf83b('0x1b')]();};}function respondWithResult(_0x1b5b16,_0x589b47){_0x589b47=_0x589b47||0xc8;return function(_0x2ddb04){if(_0x2ddb04){return _0x1b5b16['status'](_0x589b47)['json'](_0x2ddb04);}};}function respondWithFilteredResult(_0x174a50,_0x28e517){return function(_0x2b17a6){if(_0x2b17a6){var _0x124804=typeof _0x28e517[_0xf83b('0x1c')]==='undefined'&&typeof _0x28e517[_0xf83b('0x1d')]===_0xf83b('0x1e');var _0x288073=_0x2b17a6[_0xf83b('0x1f')];var _0x326c25=_0x124804?0x0:_0x28e517[_0xf83b('0x1c')];var _0x2c89b3=_0x124804?_0x2b17a6['count']:_0x28e517[_0xf83b('0x1c')]+_0x28e517[_0xf83b('0x1d')];var _0x4a8eb0;if(_0x2c89b3>=_0x288073){_0x2c89b3=_0x288073;_0x4a8eb0=0xc8;}else{_0x4a8eb0=0xce;}_0x174a50[_0xf83b('0x1a')](_0x4a8eb0);return _0x174a50[_0xf83b('0x20')]('Content-Range',_0x326c25+'-'+_0x2c89b3+'/'+_0x288073)['json'](_0x2b17a6);}return null;};}function patchUpdates(_0x14ae04){return function(_0x4e038e){try{jsonpatch[_0xf83b('0x21')](_0x4e038e,_0x14ae04,!![]);}catch(_0x18ce08){return BPromise[_0xf83b('0x22')](_0x18ce08);}return _0x4e038e[_0xf83b('0x23')]();};}function saveUpdates(_0x21199c,_0x1cd1cf){return function(_0x33cae8){if(_0x33cae8){return _0x33cae8[_0xf83b('0x24')](_0x21199c)['then'](function(_0x310ac8){return _0x310ac8;});}return null;};}function removeEntity(_0x25d581,_0x3303c5){return function(_0x1b826a){if(_0x1b826a){return _0x1b826a[_0xf83b('0x25')]()[_0xf83b('0x26')](function(){var _0x511676=_0x1b826a[_0xf83b('0x27')]({'plain':!![]});var _0x5d9a6e=_0xf83b('0x28');return db[_0xf83b('0x29')][_0xf83b('0x25')]({'where':{'type':_0x5d9a6e,'resourceId':_0x511676['id']}})[_0xf83b('0x26')](function(){return _0x1b826a;});})['then'](function(){_0x25d581[_0xf83b('0x1a')](0xcc)[_0xf83b('0x1b')]();});}};}function handleEntityNotFound(_0x55882c,_0x558726){return function(_0x5e855c){if(!_0x5e855c){_0x55882c[_0xf83b('0x19')](0x194);}return _0x5e855c;};}function handleError(_0x5cb660,_0x493ee4){_0x493ee4=_0x493ee4||0x1f4;return function(_0x3b448b){logger['error'](_0x3b448b[_0xf83b('0x2a')]);if(_0x3b448b[_0xf83b('0x2b')]){delete _0x3b448b[_0xf83b('0x2b')];}_0x5cb660[_0xf83b('0x1a')](_0x493ee4)['send'](_0x3b448b);};}exports[_0xf83b('0x2c')]=function(_0x1bdf11,_0x37212d){var _0x1d649b={},_0x2a3550={},_0x44ad18={'count':0x0,'rows':[]};var _0x1a3a5c=_[_0xf83b('0x2d')](db[_0xf83b('0x2e')]['rawAttributes'],function(_0x652e9a){return{'name':_0x652e9a[_0xf83b('0x2f')],'type':_0x652e9a[_0xf83b('0x30')][_0xf83b('0x31')]};});_0x2a3550[_0xf83b('0x32')]=_[_0xf83b('0x2d')](_0x1a3a5c,_0xf83b('0x2b'));_0x2a3550['query']=_[_0xf83b('0x33')](_0x1bdf11[_0xf83b('0x34')]);_0x2a3550[_0xf83b('0x35')]=_[_0xf83b('0x36')](_0x2a3550[_0xf83b('0x32')],_0x2a3550[_0xf83b('0x34')]);_0x1d649b[_0xf83b('0x37')]=_[_0xf83b('0x36')](_0x2a3550[_0xf83b('0x32')],qs[_0xf83b('0x38')](_0x1bdf11[_0xf83b('0x34')][_0xf83b('0x38')]));_0x1d649b[_0xf83b('0x37')]=_0x1d649b['attributes']['length']?_0x1d649b['attributes']:_0x2a3550[_0xf83b('0x32')];if(!_0x1bdf11[_0xf83b('0x34')][_0xf83b('0x39')](_0xf83b('0x3a'))){_0x1d649b[_0xf83b('0x1d')]=qs[_0xf83b('0x1d')](_0x1bdf11[_0xf83b('0x34')][_0xf83b('0x1d')]);_0x1d649b[_0xf83b('0x1c')]=qs[_0xf83b('0x1c')](_0x1bdf11[_0xf83b('0x34')][_0xf83b('0x1c')]);}_0x1d649b[_0xf83b('0x3b')]=qs[_0xf83b('0x3c')](_0x1bdf11[_0xf83b('0x34')][_0xf83b('0x3c')]);_0x1d649b['where']=qs[_0xf83b('0x35')](_[_0xf83b('0x3d')](_0x1bdf11[_0xf83b('0x34')],_0x2a3550[_0xf83b('0x35')]),_0x1a3a5c);if(_0x1bdf11[_0xf83b('0x34')]['filter']){_0x1d649b[_0xf83b('0x3e')]=_[_0xf83b('0x3f')](_0x1d649b[_0xf83b('0x3e')],{'$or':_[_0xf83b('0x2d')](_0x1a3a5c,function(_0x193995){if(_0x193995[_0xf83b('0x30')]!=='VIRTUAL'){var _0x2bf682={};_0x2bf682[_0x193995[_0xf83b('0x2b')]]={'$like':'%'+_0x1bdf11['query']['filter']+'%'};return _0x2bf682;}})});}_0x1d649b=_[_0xf83b('0x3f')]({},_0x1d649b,_0x1bdf11['options']);var _0x4940ee={'where':_0x1d649b['where']};return db[_0xf83b('0x2e')][_0xf83b('0x1f')](_0x4940ee)['then'](function(_0x371eb6){_0x44ad18['count']=_0x371eb6;if(_0x1bdf11[_0xf83b('0x34')]['includeAll']){_0x1d649b[_0xf83b('0x40')]=[{'all':!![]}];}return db[_0xf83b('0x2e')]['findAll'](_0x1d649b);})[_0xf83b('0x26')](function(_0x511452){_0x44ad18[_0xf83b('0x41')]=_0x511452;return _0x44ad18;})['then'](respondWithFilteredResult(_0x37212d,_0x1d649b))[_0xf83b('0x42')](handleError(_0x37212d,null));};exports[_0xf83b('0x43')]=function(_0x3e904e,_0x320944){var _0x27c6a9={'raw':![],'where':{'id':_0x3e904e[_0xf83b('0x44')]['id']}},_0x433edd={};_0x433edd[_0xf83b('0x32')]=_[_0xf83b('0x33')](db['AnalyticCustomReport']['rawAttributes']);_0x433edd[_0xf83b('0x34')]=_['keys'](_0x3e904e[_0xf83b('0x34')]);_0x433edd['filters']=_[_0xf83b('0x36')](_0x433edd[_0xf83b('0x32')],_0x433edd['query']);_0x27c6a9[_0xf83b('0x37')]=_[_0xf83b('0x36')](_0x433edd[_0xf83b('0x32')],qs['fields'](_0x3e904e[_0xf83b('0x34')][_0xf83b('0x38')]));_0x27c6a9['attributes']=_0x27c6a9[_0xf83b('0x37')][_0xf83b('0x45')]?_0x27c6a9[_0xf83b('0x37')]:_0x433edd[_0xf83b('0x32')];if(_0x3e904e[_0xf83b('0x34')]['includeAll']){_0x27c6a9[_0xf83b('0x40')]=[{'all':!![]}];}_0x27c6a9=_[_0xf83b('0x3f')]({},_0x27c6a9,_0x3e904e[_0xf83b('0x46')]);return db[_0xf83b('0x2e')]['find'](_0x27c6a9)['then'](handleEntityNotFound(_0x320944,null))[_0xf83b('0x26')](respondWithResult(_0x320944,null))['catch'](handleError(_0x320944,null));};exports[_0xf83b('0x47')]=function(_0xcc1882,_0x86c292){return db[_0xf83b('0x2e')][_0xf83b('0x47')](_0xcc1882[_0xf83b('0x48')],{})['then'](function(_0x201373){var _0x2d6c0c=_0xcc1882['user'][_0xf83b('0x27')]({'plain':!![]});if(!_0x2d6c0c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2d6c0c[_0xf83b('0x49')]===_0xf83b('0x4a')){var _0x45237f=_0x201373[_0xf83b('0x27')]({'plain':!![]});var _0x49a022=_0xf83b('0x4b');return db[_0xf83b('0x4c')]['find']({'where':{'name':_0x49a022,'userProfileId':_0x2d6c0c[_0xf83b('0x4d')]},'raw':!![]})[_0xf83b('0x26')](function(_0x26bbd9){if(_0x26bbd9&&_0x26bbd9[_0xf83b('0x4e')]===0x0){return db[_0xf83b('0x29')][_0xf83b('0x47')]({'name':_0x45237f[_0xf83b('0x2b')],'resourceId':_0x45237f['id'],'type':_0xf83b('0x28'),'sectionId':_0x26bbd9['id']},{})[_0xf83b('0x26')](function(){return _0x201373;});}else{return _0x201373;}})[_0xf83b('0x42')](function(_0x799d4d){logger[_0xf83b('0x4f')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x799d4d);throw _0x799d4d;});}return _0x201373;})[_0xf83b('0x26')](respondWithResult(_0x86c292,0xc9))[_0xf83b('0x42')](handleError(_0x86c292,null));};exports['update']=function(_0x40e85f,_0x594ded){if(_0x40e85f[_0xf83b('0x48')]['id']){delete _0x40e85f[_0xf83b('0x48')]['id'];}return db[_0xf83b('0x2e')]['find']({'where':{'id':_0x40e85f[_0xf83b('0x44')]['id']}})[_0xf83b('0x26')](handleEntityNotFound(_0x594ded,null))[_0xf83b('0x26')](saveUpdates(_0x40e85f[_0xf83b('0x48')],null))['then'](respondWithResult(_0x594ded,null))['catch'](handleError(_0x594ded,null));};exports[_0xf83b('0x25')]=function(_0x54b143,_0x513ec6){return db['AnalyticCustomReport'][_0xf83b('0x50')]({'where':{'id':_0x54b143[_0xf83b('0x44')]['id']}})[_0xf83b('0x26')](handleEntityNotFound(_0x513ec6,null))[_0xf83b('0x26')](removeEntity(_0x513ec6,null))[_0xf83b('0x42')](handleError(_0x513ec6,null));};exports[_0xf83b('0x51')]=function(_0x15e13c,_0x2d4c42){var _0xcfcdd1=0xa;var _0x75beb6=['join',_0xf83b('0x52'),_0xf83b('0x53'),_0xf83b('0x54')];var _0x5242cf={'SUM':_0xf83b('0x55'),'COUNT':_0xf83b('0x56'),'COUNT DISTINCT':_0xf83b('0x57'),'MAX':'MAX(%s)','MIN':'MIN(%s)','AVG':_0xf83b('0x58'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0xf83b('0x59')};var _0x58c89c={'SEC_TO_TIME':_0xf83b('0x5a'),'DATE':_0xf83b('0x5b'),'HOUR':_0xf83b('0x5c'),'ROUND':_0xf83b('0x5d'),'UNIX_TIMESTAMP':_0xf83b('0x5e')};var _0x2128a0=function(_0x7df085){return!_[_0xf83b('0x5f')]([_0xf83b('0x60'),_0xf83b('0x61'),'IS\x20EMPTY',_0xf83b('0x62')],_0x7df085);};var _0x10a549=function(_0x26ec02){if(!_0x26ec02||!_0x26ec02[_0xf83b('0x63')][_0xf83b('0x45')]){return'';}for(var _0x4109a2='(',_0x40a58b=0x0;_0x40a58b<_0x26ec02[_0xf83b('0x63')][_0xf83b('0x45')];_0x40a58b+=0x1){_0x40a58b>0x0&&(_0x4109a2+='\x20'+_0x26ec02[_0xf83b('0x64')]+'\x20');_0x4109a2+=_0x26ec02[_0xf83b('0x63')][_0x40a58b][_0xf83b('0x65')]?_0x10a549(_0x26ec02['rules'][_0x40a58b][_0xf83b('0x65')]):_0x26ec02['rules'][_0x40a58b]['field']+'\x20'+_0x26ec02[_0xf83b('0x63')][_0x40a58b][_0xf83b('0x66')]+(_0x2128a0(_0x26ec02[_0xf83b('0x63')][_0x40a58b][_0xf83b('0x66')])?'\x20'+_0x26ec02['rules'][_0x40a58b]['value']:'');}return _0x4109a2+')';};var _0x18bb80={'where':{'id':_0x15e13c[_0xf83b('0x44')]['id']}},_0x602cbc,_0x8a0cf9,_0x2185ac,_0x661643,_0x3b2f08;_0x18bb80=_[_0xf83b('0x3f')]({},_0x18bb80,_0x15e13c[_0xf83b('0x46')]);return db[_0xf83b('0x2e')][_0xf83b('0x50')](_0x18bb80)[_0xf83b('0x26')](function(_0x3d37ad){if(_0x3d37ad){_0x602cbc=_0x3d37ad;return _0x3d37ad['getFields']();}return null;})[_0xf83b('0x26')](function(_0x11d8d6){if(_0x11d8d6){if(!_0x11d8d6[_0xf83b('0x45')]){throw new db[(_0xf83b('0x67'))][(_0xf83b('0x68'))](_0xf83b('0x69'),0x193);}_0x8a0cf9=_0x11d8d6;return db[_0xf83b('0x6a')][_0xf83b('0x6b')]({'raw':!![]});}return null;})['then'](function(_0x12dfb8){if(_0x12dfb8){_0x2185ac=_['keyBy'](_0x12dfb8,'id');var _0xc79c76;var _0x1a0892=squel[_0xf83b('0x6c')]();_0x1a0892['from'](_0x602cbc['table']);for(var _0x152a09=0x0;_0x152a09<_0x8a0cf9[_0xf83b('0x45')];_0x152a09+=0x1){_0xc79c76=_0x8a0cf9[_0x152a09][_0xf83b('0x6d')]?_0x2185ac[_0x8a0cf9[_0x152a09][_0xf83b('0x6d')]][_0xf83b('0x6e')]:_0x8a0cf9[_0x152a09][_0xf83b('0x6f')];_0xc79c76=_0x8a0cf9[_0x152a09]['function']?_[_0xf83b('0x70')](_0x5242cf[_0x8a0cf9[_0x152a09][_0xf83b('0x71')]],'%s',_0xc79c76):_0xc79c76;_0xc79c76=_0x8a0cf9[_0x152a09]['format']?_[_0xf83b('0x70')](_0x58c89c[_0x8a0cf9[_0x152a09][_0xf83b('0x72')]],'%s',_0xc79c76):_0xc79c76;if(_0x8a0cf9[_0x152a09]['groupBy']){_0x1a0892[_0xf83b('0x65')](_0xc79c76);}_0x8a0cf9[_0x152a09][_0xf83b('0x73')]&&_0x1a0892['order'](_0xc79c76,_0x8a0cf9[_0x152a09][_0xf83b('0x73')]===_0xf83b('0x74')?![]:!![]);_0x1a0892[_0xf83b('0x6f')](_0xc79c76,_0x8a0cf9[_0x152a09][_0xf83b('0x75')]||_0xc79c76);}if(_0x602cbc['joins']){_0x602cbc[_0xf83b('0x76')]=JSON[_0xf83b('0x77')](_0x602cbc[_0xf83b('0x76')]);for(var _0x2396ed=0x0;_0x2396ed<_0x602cbc[_0xf83b('0x76')][_0xf83b('0x45')];_0x2396ed+=0x1){if(_0x602cbc[_0xf83b('0x76')][_0x2396ed]['type']&&_[_0xf83b('0x5f')](_0x75beb6,_0x602cbc[_0xf83b('0x76')][_0x2396ed]['type'])&&_0x602cbc[_0xf83b('0x76')][_0x2396ed][_0xf83b('0x78')]&&_0x602cbc[_0xf83b('0x76')][_0x2396ed][_0xf83b('0x79')]&&_0x602cbc[_0xf83b('0x76')][_0x2396ed]['foreignKey']){_0x1a0892[_0x602cbc[_0xf83b('0x76')][_0x2396ed][_0xf83b('0x30')]](_0x602cbc[_0xf83b('0x76')][_0x2396ed]['foreignTable'],null,util[_0xf83b('0x72')](_0xf83b('0x7a'),_0x602cbc[_0xf83b('0x7b')],_0x602cbc['joins'][_0x2396ed]['parentKey'],_0x602cbc[_0xf83b('0x76')][_0x2396ed][_0xf83b('0x79')],_0x602cbc[_0xf83b('0x76')][_0x2396ed][_0xf83b('0x7c')]));}}}if(_0x602cbc[_0xf83b('0x7d')]){_0x602cbc[_0xf83b('0x7d')]=JSON[_0xf83b('0x77')](_0x602cbc[_0xf83b('0x7d')]);_0x1a0892['where'](_0x10a549(_0x602cbc[_0xf83b('0x7d')][_0xf83b('0x65')]));}_0x3b2f08=_0x1a0892[_0xf83b('0x7e')]();_0x1a0892[_0xf83b('0x1d')](_0xcfcdd1);_0x1a0892[_0xf83b('0x1c')](0x0);logger[_0xf83b('0x7f')](_0xf83b('0x80'),_0x1a0892['toString']());return dbH['sequelize'][_0xf83b('0x34')](_0x1a0892[_0xf83b('0x81')](),{'type':dbH[_0xf83b('0x82')]['QueryTypes'][_0xf83b('0x83')]});}})['then'](respondWithResult(_0x2d4c42,null))[_0xf83b('0x42')](handleError(_0x2d4c42,null));};function runReport(_0x3ac9ed,_0x2e56a5,_0x4e69c4){var _0x4cc184=_0x2e56a5[_0xf83b('0x2b')];var _0x140074=0xa;var _0x563794=[_0xf83b('0x84'),_0xf83b('0x52'),'right_join',_0xf83b('0x54')];var _0x3b13c0={'SUM':_0xf83b('0x55'),'COUNT':_0xf83b('0x56'),'COUNT DISTINCT':_0xf83b('0x57'),'MAX':_0xf83b('0x85'),'MIN':_0xf83b('0x86'),'AVG':_0xf83b('0x58'),'GROUP_CONCAT':_0xf83b('0x87'),'GROUP_CONCAT ASC':_0xf83b('0x88'),'GROUP_CONCAT DESC':_0xf83b('0x59')};var _0x2a333b={'SEC_TO_TIME':_0xf83b('0x5a'),'DATE':_0xf83b('0x5b'),'HOUR':_0xf83b('0x5c'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf83b('0x5e')};var _0x18855a=function(_0x41a9c8){return!_[_0xf83b('0x5f')]([_0xf83b('0x60'),'IS\x20NOT\x20NULL',_0xf83b('0x89'),_0xf83b('0x62')],_0x41a9c8);};var _0x12e80d=function(_0x31beb8){if(!_0x31beb8||!_0x31beb8[_0xf83b('0x63')]['length']){return'';}for(var _0x4cb1b5='(',_0x9885df=0x0;_0x9885df<_0x31beb8[_0xf83b('0x63')][_0xf83b('0x45')];_0x9885df+=0x1){_0x9885df>0x0&&(_0x4cb1b5+='\x20'+_0x31beb8[_0xf83b('0x64')]+'\x20');_0x4cb1b5+=_0x31beb8[_0xf83b('0x63')][_0x9885df][_0xf83b('0x65')]?_0x12e80d(_0x31beb8[_0xf83b('0x63')][_0x9885df][_0xf83b('0x65')]):_0x31beb8[_0xf83b('0x63')][_0x9885df][_0xf83b('0x6f')]+'\x20'+_0x31beb8['rules'][_0x9885df][_0xf83b('0x66')]+(_0x18855a(_0x31beb8['rules'][_0x9885df][_0xf83b('0x66')])?'\x20'+_0x31beb8[_0xf83b('0x63')][_0x9885df]['value']:'');}return _0x4cb1b5+')';};var _0x304bc3={'where':{'id':_0x3ac9ed['id']}},_0x595339,_0x2a6c40,_0x2b8e45,_0x24232d,_0x486d87;_0x304bc3=_[_0xf83b('0x3f')]({},_0x304bc3,_0x4e69c4);return db[_0xf83b('0x2e')][_0xf83b('0x50')](_0x304bc3)[_0xf83b('0x26')](function(_0x37e36d){if(_0x37e36d){_0x595339=_0x37e36d;return _0x37e36d['getFields']();}return null;})[_0xf83b('0x26')](function(_0x28a828){if(_0x28a828){if(!_0x28a828[_0xf83b('0x45')]){throw new db[(_0xf83b('0x67'))]['ValidationErrorItem'](_0xf83b('0x69'),0x193);}_0x2a6c40=_0x28a828;return db[_0xf83b('0x6a')]['findAll']({'raw':!![]});}return null;})['then'](function(_0x195980){if(_0x195980){_0x2b8e45=_['keyBy'](_0x195980,'id');var _0x3c064b;var _0x182f82=squel[_0xf83b('0x6c')]();_0x182f82[_0xf83b('0x8a')](_0x595339['table']);for(var _0x5d1b87=0x0;_0x5d1b87<_0x2a6c40[_0xf83b('0x45')];_0x5d1b87+=0x1){_0x3c064b=_0x2a6c40[_0x5d1b87][_0xf83b('0x6d')]?_0x2b8e45[_0x2a6c40[_0x5d1b87]['MetricId']][_0xf83b('0x6e')]:_0x2a6c40[_0x5d1b87][_0xf83b('0x6f')];_0x3c064b=_0x2a6c40[_0x5d1b87]['function']?_[_0xf83b('0x70')](_0x3b13c0[_0x2a6c40[_0x5d1b87][_0xf83b('0x71')]],'%s',_0x3c064b):_0x3c064b;_0x3c064b=_0x2a6c40[_0x5d1b87][_0xf83b('0x72')]?_[_0xf83b('0x70')](_0x2a333b[_0x2a6c40[_0x5d1b87]['format']],'%s',_0x3c064b):_0x3c064b;if(_0x2a6c40[_0x5d1b87][_0xf83b('0x8b')]){_0x182f82[_0xf83b('0x65')](_0x3c064b);}_0x2a6c40[_0x5d1b87][_0xf83b('0x73')]&&_0x182f82[_0xf83b('0x3b')](_0x3c064b,_0x2a6c40[_0x5d1b87][_0xf83b('0x73')]===_0xf83b('0x74')?![]:!![]);_0x182f82[_0xf83b('0x6f')](_0x3c064b,_0x2a6c40[_0x5d1b87][_0xf83b('0x75')]||_0x3c064b);}if(_0x595339[_0xf83b('0x76')]){_0x595339[_0xf83b('0x76')]=JSON[_0xf83b('0x77')](_0x595339['joins']);for(var _0x314ee1=0x0;_0x314ee1<_0x595339[_0xf83b('0x76')][_0xf83b('0x45')];_0x314ee1+=0x1){if(_0x595339[_0xf83b('0x76')][_0x314ee1]['type']&&_[_0xf83b('0x5f')](_0x563794,_0x595339[_0xf83b('0x76')][_0x314ee1][_0xf83b('0x30')])&&_0x595339[_0xf83b('0x76')][_0x314ee1][_0xf83b('0x78')]&&_0x595339['joins'][_0x314ee1][_0xf83b('0x79')]&&_0x595339[_0xf83b('0x76')][_0x314ee1][_0xf83b('0x7c')]){_0x182f82[_0x595339[_0xf83b('0x76')][_0x314ee1][_0xf83b('0x30')]](_0x595339[_0xf83b('0x76')][_0x314ee1][_0xf83b('0x79')],null,util[_0xf83b('0x72')](_0xf83b('0x7a'),_0x595339[_0xf83b('0x7b')],_0x595339[_0xf83b('0x76')][_0x314ee1]['parentKey'],_0x595339['joins'][_0x314ee1][_0xf83b('0x79')],_0x595339['joins'][_0x314ee1]['foreignKey']));}}}if(_0x595339['conditions']){_0x595339[_0xf83b('0x7d')]=JSON[_0xf83b('0x77')](_0x595339[_0xf83b('0x7d')]);_0x182f82[_0xf83b('0x3e')](_0x12e80d(_0x595339[_0xf83b('0x7d')][_0xf83b('0x65')]));}_0x486d87=_0x182f82[_0xf83b('0x7e')]();_0x182f82[_0xf83b('0x1d')](_0x140074);_0x182f82['offset'](0x0);return;}})['then'](function(){if(_0x2e56a5[_0xf83b('0x8c')]===_0xf83b('0x8d')){return null;}var _0x271ceb=_['merge'](_0x2e56a5,{'name':_0x2e56a5['fullPath']||_0x2e56a5[_0xf83b('0x2b')]||_0x595339[_0xf83b('0x2b')],'basename':_0x4cc184,'savename':util['format'](_0xf83b('0x8e'),_0x2e56a5[_0xf83b('0x2b')]||_0x595339[_0xf83b('0x2b')],require('randomstring')[_0xf83b('0x8f')](0x4),_0x2e56a5[_0xf83b('0x8c')]||_0xf83b('0x90')),'reportId':_0x595339['id'],'reportType':_0xf83b('0x91')});return db[_0xf83b('0x92')][_0xf83b('0x47')](_0x271ceb,{'raw':!![]});})[_0xf83b('0x26')](function(_0x220865){if(_0x595339[_0xf83b('0x7b')]==='cdr'){_0x486d87[_0xf83b('0x3e')](_0x595339[_0xf83b('0x7b')]+_0xf83b('0x93'),_0x2e56a5[_0xf83b('0x94')],_0x2e56a5['endDate']);}else{_0x486d87[_0xf83b('0x3e')](_0x595339[_0xf83b('0x7b')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x2e56a5[_0xf83b('0x94')],_0x2e56a5[_0xf83b('0x95')]);}if(_0x220865){logger[_0xf83b('0x96')]('Run\x20Query:',_0x486d87[_0xf83b('0x81')]());require('child_process')[_0xf83b('0x97')](path[_0xf83b('0x84')](__dirname,_0xf83b('0x98'),_0x220865[_0xf83b('0x8c')]),[_0x220865['id'],_0x486d87[_0xf83b('0x81')](),path[_0xf83b('0x84')](__dirname,'../../files/reports',_0x220865['savename']),_0x4cc184]);return _0x220865;}else{var _0x592e98=squel[_0xf83b('0x6c')]();_0x592e98['from']('('+_0x486d87[_0xf83b('0x81')]()+')',_0xf83b('0x99'));_0x592e98[_0xf83b('0x6f')](_0xf83b('0x9a'),'count');_0x486d87[_0xf83b('0x1d')](_0x2e56a5[_0xf83b('0x1d')]||_0x140074);_0x486d87[_0xf83b('0x1c')](_0x2e56a5[_0xf83b('0x1c')]||0x0);return dbH[_0xf83b('0x82')][_0xf83b('0x34')](_0x592e98[_0xf83b('0x81')](),{'type':dbH['sequelize'][_0xf83b('0x9b')][_0xf83b('0x83')]})['then'](function(_0x43885b){if(!_0x43885b['length']){_0x24232d=0x0;}else{_0x24232d=_0x43885b[0x0][_0xf83b('0x1f')]||0x0;}return dbH[_0xf83b('0x82')][_0xf83b('0x34')](_0x486d87[_0xf83b('0x81')](),{'type':dbH['sequelize']['QueryTypes'][_0xf83b('0x83')]});})[_0xf83b('0x26')](function(_0x1085bf){return{'rows':_0x1085bf||[],'count':_0x24232d};});}});}exports[_0xf83b('0x9c')]=function(_0x36908e,_0x3065c4){return runReport(_0x36908e['params'],_0x36908e['query'],_0x36908e[_0xf83b('0x46')])[_0xf83b('0x26')](respondWithResult(_0x3065c4,null))[_0xf83b('0x42')](handleError(_0x3065c4,null));};exports[_0xf83b('0x9d')]=runReport;exports[_0xf83b('0x34')]=function(_0x5c3d28,_0x5a72da){var _0x58127f=0xa;var _0x1c64a0=[_0xf83b('0x84'),'left_join',_0xf83b('0x53'),_0xf83b('0x54')];var _0x1d5d09={'SUM':_0xf83b('0x55'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0xf83b('0x57'),'MAX':_0xf83b('0x85'),'MIN':_0xf83b('0x86'),'AVG':_0xf83b('0x58'),'GROUP_CONCAT':_0xf83b('0x87'),'GROUP_CONCAT ASC':_0xf83b('0x88'),'GROUP_CONCAT DESC':_0xf83b('0x59')};var _0x9e3d26={'SEC_TO_TIME':_0xf83b('0x5a'),'DATE':_0xf83b('0x5b'),'HOUR':'HOUR(%s)','ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0xf83b('0x5e')};var _0x4af980=function(_0x5e83f7){return!_['includes']([_0xf83b('0x60'),_0xf83b('0x61'),'IS\x20EMPTY',_0xf83b('0x62')],_0x5e83f7);};var _0x3a3618=function(_0x1bec76){if(!_0x1bec76||!_0x1bec76[_0xf83b('0x63')][_0xf83b('0x45')]){return'';}for(var _0x1e1bb5='(',_0x6cf5f9=0x0;_0x6cf5f9<_0x1bec76[_0xf83b('0x63')]['length'];_0x6cf5f9+=0x1){_0x6cf5f9>0x0&&(_0x1e1bb5+='\x20'+_0x1bec76['operator']+'\x20');_0x1e1bb5+=_0x1bec76[_0xf83b('0x63')][_0x6cf5f9][_0xf83b('0x65')]?_0x3a3618(_0x1bec76['rules'][_0x6cf5f9][_0xf83b('0x65')]):_0x1bec76[_0xf83b('0x63')][_0x6cf5f9][_0xf83b('0x6f')]+'\x20'+_0x1bec76[_0xf83b('0x63')][_0x6cf5f9][_0xf83b('0x66')]+(_0x4af980(_0x1bec76[_0xf83b('0x63')][_0x6cf5f9][_0xf83b('0x66')])?'\x20'+_0x1bec76[_0xf83b('0x63')][_0x6cf5f9]['value']:'');}return _0x1e1bb5+')';};var _0x2fec34={'where':{'id':_0x5c3d28[_0xf83b('0x44')]['id']}},_0xad26b3,_0x25d414,_0x110e63,_0x64e99b,_0x20f1b9;_0x2fec34=_[_0xf83b('0x3f')]({},_0x2fec34,_0x5c3d28[_0xf83b('0x46')]);return db[_0xf83b('0x2e')][_0xf83b('0x50')](_0x2fec34)[_0xf83b('0x26')](function(_0x3db044){if(_0x3db044){_0xad26b3=_0x3db044;return _0x3db044[_0xf83b('0x9e')]();}return null;})[_0xf83b('0x26')](function(_0x44c0f0){if(_0x44c0f0){if(!_0x44c0f0[_0xf83b('0x45')]){throw new db['Sequelize'][(_0xf83b('0x68'))](_0xf83b('0x69'),0x193);}_0x25d414=_0x44c0f0;return db['AnalyticMetric'][_0xf83b('0x6b')]({'raw':!![]});}return null;})['then'](function(_0x501edd){if(_0x501edd){_0x110e63=_[_0xf83b('0x9f')](_0x501edd,'id');var _0x37c2e7;var _0x4a07b4=squel[_0xf83b('0x6c')]();_0x4a07b4[_0xf83b('0x8a')](_0xad26b3[_0xf83b('0x7b')]);for(var _0x46cb40=0x0;_0x46cb40<_0x25d414[_0xf83b('0x45')];_0x46cb40+=0x1){_0x37c2e7=_0x25d414[_0x46cb40]['MetricId']?_0x110e63[_0x25d414[_0x46cb40]['MetricId']][_0xf83b('0x6e')]:_0x25d414[_0x46cb40][_0xf83b('0x6f')];_0x37c2e7=_0x25d414[_0x46cb40][_0xf83b('0x71')]?_[_0xf83b('0x70')](_0x1d5d09[_0x25d414[_0x46cb40][_0xf83b('0x71')]],'%s',_0x37c2e7):_0x37c2e7;_0x37c2e7=_0x25d414[_0x46cb40]['format']?_[_0xf83b('0x70')](_0x9e3d26[_0x25d414[_0x46cb40]['format']],'%s',_0x37c2e7):_0x37c2e7;if(_0x25d414[_0x46cb40][_0xf83b('0x8b')]){_0x4a07b4[_0xf83b('0x65')](_0x37c2e7);}_0x25d414[_0x46cb40][_0xf83b('0x73')]&&_0x4a07b4[_0xf83b('0x3b')](_0x37c2e7,_0x25d414[_0x46cb40]['orderBy']===_0xf83b('0x74')?![]:!![]);_0x4a07b4[_0xf83b('0x6f')](_0x37c2e7,_0x25d414[_0x46cb40][_0xf83b('0x75')]||_0x37c2e7);}if(_0xad26b3[_0xf83b('0x76')]){_0xad26b3[_0xf83b('0x76')]=JSON['parse'](_0xad26b3[_0xf83b('0x76')]);for(var _0x85679b=0x0;_0x85679b<_0xad26b3['joins'][_0xf83b('0x45')];_0x85679b+=0x1){if(_0xad26b3[_0xf83b('0x76')][_0x85679b]['type']&&_[_0xf83b('0x5f')](_0x1c64a0,_0xad26b3['joins'][_0x85679b][_0xf83b('0x30')])&&_0xad26b3[_0xf83b('0x76')][_0x85679b][_0xf83b('0x78')]&&_0xad26b3[_0xf83b('0x76')][_0x85679b][_0xf83b('0x79')]&&_0xad26b3[_0xf83b('0x76')][_0x85679b][_0xf83b('0x7c')]){_0x4a07b4[_0xad26b3[_0xf83b('0x76')][_0x85679b][_0xf83b('0x30')]](_0xad26b3['joins'][_0x85679b][_0xf83b('0x79')],null,util[_0xf83b('0x72')](_0xf83b('0x7a'),_0xad26b3[_0xf83b('0x7b')],_0xad26b3[_0xf83b('0x76')][_0x85679b][_0xf83b('0x78')],_0xad26b3[_0xf83b('0x76')][_0x85679b][_0xf83b('0x79')],_0xad26b3[_0xf83b('0x76')][_0x85679b][_0xf83b('0x7c')]));}}}if(_0xad26b3[_0xf83b('0x7d')]){_0xad26b3[_0xf83b('0x7d')]=JSON[_0xf83b('0x77')](_0xad26b3[_0xf83b('0x7d')]);_0x4a07b4[_0xf83b('0x3e')](_0x3a3618(_0xad26b3[_0xf83b('0x7d')][_0xf83b('0x65')]));}_0x20f1b9=_0x4a07b4[_0xf83b('0x7e')]();_0x4a07b4[_0xf83b('0x1d')](_0x58127f);_0x4a07b4[_0xf83b('0x1c')](0x0);logger['debug']('Limited\x20Query:',_0x4a07b4[_0xf83b('0x81')]());return dbH[_0xf83b('0x82')][_0xf83b('0x34')](_0x4a07b4[_0xf83b('0x81')](),{'type':dbH[_0xf83b('0x82')]['QueryTypes']['SELECT']});}})[_0xf83b('0x26')](function(){return{'sql':_0x20f1b9['toString']()};})[_0xf83b('0x26')](respondWithResult(_0x5a72da,null))[_0xf83b('0x42')](handleError(_0x5a72da,null));}; \ No newline at end of file diff --git a/server/api/analyticCustomReport/analyticCustomReport.model.js b/server/api/analyticCustomReport/analyticCustomReport.model.js index cc814b7..39fbee1 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 _0xfd17=['lodash','util','api','bluebird','request-promise','path','rimraf','../../config/environment','./analyticCustomReport.attributes','exports','AnalyticCustomReport'];(function(_0x4350c2,_0x112f3c){var _0x8b6406=function(_0x49e845){while(--_0x49e845){_0x4350c2['push'](_0x4350c2['shift']());}};_0x8b6406(++_0x112f3c);}(_0xfd17,0x8f));var _0x7fd1=function(_0x53f707,_0x51a2f7){_0x53f707=_0x53f707-0x0;var _0x10a9f5=_0xfd17[_0x53f707];return _0x10a9f5;};'use strict';var _=require(_0x7fd1('0x0'));var util=require(_0x7fd1('0x1'));var logger=require('../../config/logger')(_0x7fd1('0x2'));var moment=require('moment');var BPromise=require(_0x7fd1('0x3'));var rp=require(_0x7fd1('0x4'));var fs=require('fs');var path=require(_0x7fd1('0x5'));var rimraf=require(_0x7fd1('0x6'));var config=require(_0x7fd1('0x7'));var attributes=require(_0x7fd1('0x8'));module[_0x7fd1('0x9')]=function(_0x4cbebb,_0x45d26c){return _0x4cbebb['define'](_0x7fd1('0xa'),attributes,{'tableName':'analytics_custom_reports','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4bb3=['../../config/logger','api','moment','bluebird','path','../../config/environment','./analyticCustomReport.attributes','exports','define','AnalyticCustomReport','analytics_custom_reports','lodash','util'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4bb3,0x1df));var _0x34bb=function(_0x459b74,_0x5773bd){_0x459b74=_0x459b74-0x0;var _0x46cb16=_0x4bb3[_0x459b74];return _0x46cb16;};'use strict';var _=require(_0x34bb('0x0'));var util=require(_0x34bb('0x1'));var logger=require(_0x34bb('0x2'))(_0x34bb('0x3'));var moment=require(_0x34bb('0x4'));var BPromise=require(_0x34bb('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x34bb('0x6'));var rimraf=require('rimraf');var config=require(_0x34bb('0x7'));var attributes=require(_0x34bb('0x8'));module[_0x34bb('0x9')]=function(_0x500399,_0x466e79){return _0x500399[_0x34bb('0xa')](_0x34bb('0xb'),attributes,{'tableName':_0x34bb('0xc'),'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 675228b..0e136bc 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 _0xbb0f=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','AnalyticCustomReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','bluebird'];(function(_0x115d1f,_0x28e745){var _0x5a1663=function(_0x29b593){while(--_0x29b593){_0x115d1f['push'](_0x115d1f['shift']());}};_0x5a1663(++_0x28e745);}(_0xbb0f,0xe5));var _0xfbb0=function(_0x271870,_0x50c22d){_0x271870=_0x271870-0x0;var _0x17b9f8=_0xbb0f[_0x271870];return _0x17b9f8;};'use strict';var _=require('lodash');var util=require(_0xfbb0('0x0'));var moment=require('moment');var BPromise=require(_0xfbb0('0x1'));var rs=require(_0xfbb0('0x2'));var fs=require('fs');var Redis=require(_0xfbb0('0x3'));var db=require(_0xfbb0('0x4'))['db'];var utils=require(_0xfbb0('0x5'));var logger=require(_0xfbb0('0x6'))('rpc');var config=require(_0xfbb0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xfbb0('0x8')][_0xfbb0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x506d2b,_0x156dd7,_0x336a6a){return new BPromise(function(_0xa41f43,_0x5071c7){return client['request'](_0x506d2b,_0x336a6a)['then'](function(_0x1a717b){logger['info'](_0xfbb0('0xa'),_0x156dd7,_0xfbb0('0xb'));logger[_0xfbb0('0xc')](_0xfbb0('0xd'),_0x156dd7,_0xfbb0('0xb'),JSON[_0xfbb0('0xe')](_0x1a717b));if(_0x1a717b[_0xfbb0('0xf')]){if(_0x1a717b[_0xfbb0('0xf')][_0xfbb0('0x10')]===0x1f4){logger[_0xfbb0('0xf')](_0xfbb0('0xa'),_0x156dd7,_0x1a717b[_0xfbb0('0xf')][_0xfbb0('0x11')]);return _0x5071c7(_0x1a717b['error'][_0xfbb0('0x11')]);}logger[_0xfbb0('0xf')]('AnalyticCustomReport,\x20%s,\x20%s',_0x156dd7,_0x1a717b[_0xfbb0('0xf')][_0xfbb0('0x11')]);return _0xa41f43(_0x1a717b[_0xfbb0('0xf')][_0xfbb0('0x11')]);}else{logger[_0xfbb0('0x12')](_0xfbb0('0xa'),_0x156dd7,_0xfbb0('0xb'));_0xa41f43(_0x1a717b[_0xfbb0('0x13')][_0xfbb0('0x11')]);}})[_0xfbb0('0x14')](function(_0x4f9946){logger[_0xfbb0('0xf')](_0xfbb0('0xa'),_0x156dd7,_0x4f9946);_0x5071c7(_0x4f9946);});});} \ No newline at end of file +var _0x9489=['message','result','catch','lodash','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','AnalyticCustomReport,\x20%s,\x20%s','AnalyticCustomReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0xc0720,_0x59b1cf){var _0x12b094=function(_0x545f66){while(--_0x545f66){_0xc0720['push'](_0xc0720['shift']());}};_0x12b094(++_0x59b1cf);}(_0x9489,0xfa));var _0x9948=function(_0x3a1426,_0x217db0){_0x3a1426=_0x3a1426-0x0;var _0x42bc44=_0x9489[_0x3a1426];return _0x42bc44;};'use strict';var _=require(_0x9948('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9948('0x1'));var db=require(_0x9948('0x2'))['db'];var utils=require(_0x9948('0x3'));var logger=require(_0x9948('0x4'))(_0x9948('0x5'));var config=require(_0x9948('0x6'));var jayson=require(_0x9948('0x7'));var client=jayson[_0x9948('0x8')][_0x9948('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x283356,_0x2d55bf,_0x50992a){return new BPromise(function(_0x546686,_0x1d004f){return client['request'](_0x283356,_0x50992a)['then'](function(_0x3f35ae){logger[_0x9948('0xa')](_0x9948('0xb'),_0x2d55bf,'request\x20sent');logger['debug'](_0x9948('0xc'),_0x2d55bf,_0x9948('0xd'),JSON[_0x9948('0xe')](_0x3f35ae));if(_0x3f35ae[_0x9948('0xf')]){if(_0x3f35ae[_0x9948('0xf')]['code']===0x1f4){logger['error'](_0x9948('0xb'),_0x2d55bf,_0x3f35ae[_0x9948('0xf')]['message']);return _0x1d004f(_0x3f35ae['error'][_0x9948('0x10')]);}logger[_0x9948('0xf')](_0x9948('0xb'),_0x2d55bf,_0x3f35ae[_0x9948('0xf')][_0x9948('0x10')]);return _0x546686(_0x3f35ae[_0x9948('0xf')]['message']);}else{logger['info'](_0x9948('0xb'),_0x2d55bf,_0x9948('0xd'));_0x546686(_0x3f35ae[_0x9948('0x11')]['message']);}})[_0x9948('0x12')](function(_0x357981){logger['error'](_0x9948('0xb'),_0x2d55bf,_0x357981);_0x1d004f(_0x357981);});});} \ No newline at end of file diff --git a/server/api/analyticCustomReport/index.js b/server/api/analyticCustomReport/index.js index 5da93e2..c83d990 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 _0x475f=['query','post','create','put','/:id','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','index','show','isAuthenticated','/:id/run','/:id/query'];(function(_0x636d1c,_0x29a72d){var _0x57d743=function(_0x4def0e){while(--_0x4def0e){_0x636d1c['push'](_0x636d1c['shift']());}};_0x57d743(++_0x29a72d);}(_0x475f,0xbf));var _0xf475=function(_0x330525,_0x3cf1fb){_0x330525=_0x330525-0x0;var _0x4e6ce3=_0x475f[_0x330525];return _0x4e6ce3;};'use strict';var multer=require(_0xf475('0x0'));var util=require(_0xf475('0x1'));var path=require(_0xf475('0x2'));var timeout=require(_0xf475('0x3'));var express=require('express');var router=express[_0xf475('0x4')]();var fs_extra=require(_0xf475('0x5'));var auth=require(_0xf475('0x6'));var interaction=require(_0xf475('0x7'));var config=require(_0xf475('0x8'));var controller=require(_0xf475('0x9'));router[_0xf475('0xa')]('/',auth['isAuthenticated'](),controller[_0xf475('0xb')]);router[_0xf475('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xf475('0xc')]);router[_0xf475('0xa')]('/:id/preview',auth[_0xf475('0xd')](),controller['preview']);router['get'](_0xf475('0xe'),auth[_0xf475('0xd')](),controller['run']);router[_0xf475('0xa')](_0xf475('0xf'),auth['isAuthenticated'](),controller[_0xf475('0x10')]);router[_0xf475('0x11')]('/',auth[_0xf475('0xd')](),controller[_0xf475('0x12')]);router[_0xf475('0x13')](_0xf475('0x14'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xf475('0xd')](),controller[_0xf475('0x15')]);module[_0xf475('0x16')]=router; \ No newline at end of file +var _0xff9d=['/:id/query','query','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticCustomReport.controller','get','isAuthenticated','index','show','preview','/:id/run'];(function(_0x2aec31,_0x19962c){var _0xfb303e=function(_0x3a34f9){while(--_0x3a34f9){_0x2aec31['push'](_0x2aec31['shift']());}};_0xfb303e(++_0x19962c);}(_0xff9d,0x141));var _0xdff9=function(_0x432f7e,_0x10e4f0){_0x432f7e=_0x432f7e-0x0;var _0x58a5f3=_0xff9d[_0x432f7e];return _0x58a5f3;};'use strict';var multer=require(_0xdff9('0x0'));var util=require(_0xdff9('0x1'));var path=require(_0xdff9('0x2'));var timeout=require(_0xdff9('0x3'));var express=require('express');var router=express[_0xdff9('0x4')]();var fs_extra=require(_0xdff9('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdff9('0x6'));var config=require(_0xdff9('0x7'));var controller=require(_0xdff9('0x8'));router[_0xdff9('0x9')]('/',auth[_0xdff9('0xa')](),controller[_0xdff9('0xb')]);router[_0xdff9('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xdff9('0xc')]);router[_0xdff9('0x9')]('/:id/preview',auth[_0xdff9('0xa')](),controller[_0xdff9('0xd')]);router[_0xdff9('0x9')](_0xdff9('0xe'),auth[_0xdff9('0xa')](),controller['run']);router[_0xdff9('0x9')](_0xdff9('0xf'),auth[_0xdff9('0xa')](),controller[_0xdff9('0x10')]);router[_0xdff9('0x11')]('/',auth[_0xdff9('0xa')](),controller[_0xdff9('0x12')]);router[_0xdff9('0x13')](_0xdff9('0x14'),auth[_0xdff9('0xa')](),controller[_0xdff9('0x15')]);router['delete'](_0xdff9('0x14'),auth[_0xdff9('0xa')](),controller[_0xdff9('0x16')]);module[_0xdff9('0x17')]=router; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js b/server/api/analyticDefaultReport/analyticDefaultReport.attributes.js index 88f82be..e177e76 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 _0xee14=['STRING','TEXT'];(function(_0x5c1514,_0x26126a){var _0x396a97=function(_0x1fb619){while(--_0x1fb619){_0x5c1514['push'](_0x5c1514['shift']());}};_0x396a97(++_0x26126a);}(_0xee14,0x13a));var _0x4ee1=function(_0x5e5fbf,_0x4d8450){_0x5e5fbf=_0x5e5fbf-0x0;var _0x598f4f=_0xee14[_0x5e5fbf];return _0x598f4f;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x4ee1('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x4ee1('0x0')]},'parent':{'type':Sequelize[_0x4ee1('0x0')]},'table':{'type':Sequelize[_0x4ee1('0x0')]},'conditions':{'type':Sequelize[_0x4ee1('0x1')]},'joins':{'type':Sequelize[_0x4ee1('0x1')]}}; \ No newline at end of file +var _0x1883=['exports','STRING','TEXT','sequelize'];(function(_0x2ed999,_0x2e7c4d){var _0x49c1cc=function(_0x3be581){while(--_0x3be581){_0x2ed999['push'](_0x2ed999['shift']());}};_0x49c1cc(++_0x2e7c4d);}(_0x1883,0xab));var _0x3188=function(_0x563169,_0x4be6bc){_0x563169=_0x563169-0x0;var _0x4796e2=_0x1883[_0x563169];return _0x4796e2;};'use strict';var Sequelize=require(_0x3188('0x0'));module[_0x3188('0x1')]={'name':{'type':Sequelize[_0x3188('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x3188('0x2')]},'parent':{'type':Sequelize[_0x3188('0x2')]},'table':{'type':Sequelize[_0x3188('0x2')]},'conditions':{'type':Sequelize[_0x3188('0x3')]},'joins':{'type':Sequelize[_0x3188('0x3')]}}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.controller.js b/server/api/analyticDefaultReport/analyticDefaultReport.controller.js index 1174869..986822d 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 _0x0295=['default','AnalyticExtractedReport','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','startDate','.createdAt\x20BETWEEN\x20?\x20AND\x20?','endDate','info','Run\x20Query:','fork','../../files/reports','COUNT(*)','SELECT','run','runReport','MAX(%s)','eml-format','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','get','UserProfileResource','destroy','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','Reports','UserProfileSection','autoAssociation','DefaultReports','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','preview','join','left_join','right_join','cross_join','SUM(%s)','COUNT(%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\x20NOT\x20NULL','IS\x20NOT\x20EMPTY','rules','field','condition','value','Sequelize','ValidationErrorItem','AnalyticMetric','keyBy','from','table','MetricId','metric','function','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignTable','foreignKey','%s.%s\x20=\x20%s.%s','conditions','group','clone','debug','Limited\x20Query:','sequelize','toString','QueryTypes','COUNT(DISTINCT\x20%s)','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)','IS\x20EMPTY','operator','getFields','findAll','select','replace','output','web','%s-%s.%s','randomstring','generate','csv'];(function(_0x1bfe44,_0x4e410e){var _0x1103cb=function(_0x1e850e){while(--_0x1e850e){_0x1bfe44['push'](_0x1bfe44['shift']());}};_0x1103cb(++_0x4e410e);}(_0x0295,0x1f0));var _0x5029=function(_0xa7fcdd,_0x2316e2){_0xa7fcdd=_0xa7fcdd-0x0;var _0x44f3c2=_0x0295[_0xa7fcdd];return _0x44f3c2;};'use strict';var emlformat=require(_0x5029('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5029('0x1'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x5029('0x2'));var Mustache=require(_0x5029('0x3'));var util=require(_0x5029('0x4'));var path=require(_0x5029('0x5'));var sox=require(_0x5029('0x6'));var csv=require(_0x5029('0x7'));var ejs=require(_0x5029('0x8'));var fs=require('fs');var fs_extra=require(_0x5029('0x9'));var _=require(_0x5029('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x5029('0xb'));var toCsv=require('to-csv');var querystring=require(_0x5029('0xc'));var Papa=require('papaparse');var Redis=require(_0x5029('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x5029('0xe'));var as=require(_0x5029('0xf'));var hardwareService=require(_0x5029('0x10'));var logger=require('../../config/logger')(_0x5029('0x11'));var utils=require(_0x5029('0x12'));var config=require(_0x5029('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x5029('0x14'))['db'];var dbH=require(_0x5029('0x14'))['dbH'];function respondWithStatusCode(_0x4fa22d,_0x49f836){_0x49f836=_0x49f836||0xcc;return function(_0x4aebb6){if(_0x4aebb6){return _0x4fa22d[_0x5029('0x15')](_0x49f836);}return _0x4fa22d[_0x5029('0x16')](_0x49f836)[_0x5029('0x17')]();};}function respondWithResult(_0x434630,_0x2c0b33){_0x2c0b33=_0x2c0b33||0xc8;return function(_0x11c24b){if(_0x11c24b){return _0x434630[_0x5029('0x16')](_0x2c0b33)[_0x5029('0x18')](_0x11c24b);}};}function respondWithFilteredResult(_0x10bf55,_0x326923){return function(_0x457c73){if(_0x457c73){var _0x353cba=typeof _0x326923[_0x5029('0x19')]===_0x5029('0x1a')&&typeof _0x326923[_0x5029('0x1b')]==='undefined';var _0x1ed567=_0x457c73[_0x5029('0x1c')];var _0x35de81=_0x353cba?0x0:_0x326923[_0x5029('0x19')];var _0x8cea01=_0x353cba?_0x457c73[_0x5029('0x1c')]:_0x326923[_0x5029('0x19')]+_0x326923['limit'];var _0x226a5c;if(_0x8cea01>=_0x1ed567){_0x8cea01=_0x1ed567;_0x226a5c=0xc8;}else{_0x226a5c=0xce;}_0x10bf55['status'](_0x226a5c);return _0x10bf55[_0x5029('0x1d')](_0x5029('0x1e'),_0x35de81+'-'+_0x8cea01+'/'+_0x1ed567)[_0x5029('0x18')](_0x457c73);}return null;};}function patchUpdates(_0x3cf0fb){return function(_0x4b5854){try{jsonpatch['apply'](_0x4b5854,_0x3cf0fb,!![]);}catch(_0x4c9184){return BPromise['reject'](_0x4c9184);}return _0x4b5854[_0x5029('0x1f')]();};}function saveUpdates(_0x853a34,_0x1eb228){return function(_0x2bbbcb){if(_0x2bbbcb){return _0x2bbbcb[_0x5029('0x20')](_0x853a34)[_0x5029('0x21')](function(_0x125c26){return _0x125c26;});}return null;};}function removeEntity(_0x356dac,_0x3e857d){return function(_0x4ceaae){if(_0x4ceaae){return _0x4ceaae['destroy']()['then'](function(){var _0x588d90=_0x4ceaae[_0x5029('0x22')]({'plain':!![]});var _0x51093c='DefaultReports';return db[_0x5029('0x23')][_0x5029('0x24')]({'where':{'type':_0x51093c,'resourceId':_0x588d90['id']}})[_0x5029('0x21')](function(){return _0x4ceaae;});})['then'](function(){_0x356dac[_0x5029('0x16')](0xcc)[_0x5029('0x17')]();});}};}function handleEntityNotFound(_0x5e45c4,_0x2b6d99){return function(_0x31f0a0){if(!_0x31f0a0){_0x5e45c4[_0x5029('0x15')](0x194);}return _0x31f0a0;};}function handleError(_0x4a24b9,_0x32da06){_0x32da06=_0x32da06||0x1f4;return function(_0x251f99){logger[_0x5029('0x25')](_0x251f99['stack']);if(_0x251f99[_0x5029('0x26')]){delete _0x251f99[_0x5029('0x26')];}_0x4a24b9['status'](_0x32da06)[_0x5029('0x27')](_0x251f99);};}exports[_0x5029('0x28')]=function(_0x4434ff,_0x1c3dd9){var _0x196830={},_0x2a1ed6={},_0x44255a={'count':0x0,'rows':[]};var _0x465153=_[_0x5029('0x29')](db[_0x5029('0x2a')][_0x5029('0x2b')],function(_0x4519c8){return{'name':_0x4519c8['fieldName'],'type':_0x4519c8[_0x5029('0x2c')]['key']};});_0x2a1ed6[_0x5029('0x2d')]=_['map'](_0x465153,'name');_0x2a1ed6[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x4434ff[_0x5029('0x2e')]);_0x2a1ed6['filters']=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],_0x2a1ed6[_0x5029('0x2e')]);_0x196830[_0x5029('0x31')]=_[_0x5029('0x30')](_0x2a1ed6[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x32')]));_0x196830['attributes']=_0x196830[_0x5029('0x31')][_0x5029('0x33')]?_0x196830[_0x5029('0x31')]:_0x2a1ed6[_0x5029('0x2d')];if(!_0x4434ff['query'][_0x5029('0x34')](_0x5029('0x35'))){_0x196830[_0x5029('0x1b')]=qs['limit'](_0x4434ff['query'][_0x5029('0x1b')]);_0x196830[_0x5029('0x19')]=qs['offset'](_0x4434ff['query'][_0x5029('0x19')]);}_0x196830[_0x5029('0x36')]=qs[_0x5029('0x37')](_0x4434ff[_0x5029('0x2e')][_0x5029('0x37')]);_0x196830[_0x5029('0x38')]=qs[_0x5029('0x39')](_[_0x5029('0x3a')](_0x4434ff[_0x5029('0x2e')],_0x2a1ed6[_0x5029('0x39')]),_0x465153);if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3b')]){_0x196830[_0x5029('0x38')]=_[_0x5029('0x3c')](_0x196830['where'],{'$or':_['map'](_0x465153,function(_0x73797c){if(_0x73797c[_0x5029('0x2c')]!==_0x5029('0x3d')){var _0x48c9eb={};_0x48c9eb[_0x73797c[_0x5029('0x26')]]={'$like':'%'+_0x4434ff[_0x5029('0x2e')]['filter']+'%'};return _0x48c9eb;}})});}_0x196830=_[_0x5029('0x3c')]({},_0x196830,_0x4434ff['options']);var _0x506f0d={'where':_0x196830['where']};return db[_0x5029('0x2a')][_0x5029('0x1c')](_0x506f0d)[_0x5029('0x21')](function(_0x78768){_0x44255a[_0x5029('0x1c')]=_0x78768;if(_0x4434ff[_0x5029('0x2e')][_0x5029('0x3e')]){_0x196830[_0x5029('0x3f')]=[{'all':!![]}];}return db[_0x5029('0x2a')]['findAll'](_0x196830);})[_0x5029('0x21')](function(_0x236455){_0x44255a[_0x5029('0x40')]=_0x236455;return _0x44255a;})[_0x5029('0x21')](respondWithFilteredResult(_0x1c3dd9,_0x196830))[_0x5029('0x41')](handleError(_0x1c3dd9,null));};exports[_0x5029('0x42')]=function(_0x5658a7,_0x259db8){var _0xa1580a={'raw':!![],'where':{'id':_0x5658a7[_0x5029('0x43')]['id']}},_0x9434ed={};_0x9434ed[_0x5029('0x2d')]=_['keys'](db[_0x5029('0x2a')][_0x5029('0x2b')]);_0x9434ed[_0x5029('0x2e')]=_[_0x5029('0x2f')](_0x5658a7[_0x5029('0x2e')]);_0x9434ed[_0x5029('0x39')]=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],_0x9434ed[_0x5029('0x2e')]);_0xa1580a['attributes']=_[_0x5029('0x30')](_0x9434ed[_0x5029('0x2d')],qs[_0x5029('0x32')](_0x5658a7[_0x5029('0x2e')]['fields']));_0xa1580a['attributes']=_0xa1580a[_0x5029('0x31')][_0x5029('0x33')]?_0xa1580a[_0x5029('0x31')]:_0x9434ed[_0x5029('0x2d')];if(_0x5658a7[_0x5029('0x2e')][_0x5029('0x3e')]){_0xa1580a[_0x5029('0x3f')]=[{'all':!![]}];}_0xa1580a=_[_0x5029('0x3c')]({},_0xa1580a,_0x5658a7[_0x5029('0x44')]);return db[_0x5029('0x2a')][_0x5029('0x45')](_0xa1580a)[_0x5029('0x21')](handleEntityNotFound(_0x259db8,null))[_0x5029('0x21')](respondWithResult(_0x259db8,null))[_0x5029('0x41')](handleError(_0x259db8,null));};exports[_0x5029('0x46')]=function(_0x175cc0,_0x10fc07){return db[_0x5029('0x2a')][_0x5029('0x46')](_0x175cc0[_0x5029('0x47')],{})[_0x5029('0x21')](function(_0x489457){var _0x1069c4=_0x175cc0['user'][_0x5029('0x22')]({'plain':!![]});if(!_0x1069c4)throw new Error(_0x5029('0x48'));if(_0x1069c4['role']==='user'){var _0x319bff=_0x489457['get']({'plain':!![]});var _0x4aaa43=_0x5029('0x49');return db[_0x5029('0x4a')][_0x5029('0x45')]({'where':{'name':_0x4aaa43,'userProfileId':_0x1069c4['userProfileId']},'raw':!![]})['then'](function(_0x1510bb){if(_0x1510bb&&_0x1510bb[_0x5029('0x4b')]===0x0){return db['UserProfileResource'][_0x5029('0x46')]({'name':_0x319bff['name'],'resourceId':_0x319bff['id'],'type':_0x5029('0x4c'),'sectionId':_0x1510bb['id']},{})['then'](function(){return _0x489457;});}else{return _0x489457;}})[_0x5029('0x41')](function(_0x27e1c0){logger[_0x5029('0x25')](_0x5029('0x4d'),_0x27e1c0);throw _0x27e1c0;});}return _0x489457;})[_0x5029('0x21')](respondWithResult(_0x10fc07,0xc9))[_0x5029('0x41')](handleError(_0x10fc07,null));};exports[_0x5029('0x20')]=function(_0xa25013,_0x586936){if(_0xa25013[_0x5029('0x47')]['id']){delete _0xa25013['body']['id'];}return db[_0x5029('0x2a')][_0x5029('0x45')]({'where':{'id':_0xa25013['params']['id']}})[_0x5029('0x21')](handleEntityNotFound(_0x586936,null))['then'](saveUpdates(_0xa25013['body'],null))['then'](respondWithResult(_0x586936,null))[_0x5029('0x41')](handleError(_0x586936,null));};exports['destroy']=function(_0x49d1db,_0x353ae4){return db[_0x5029('0x2a')]['find']({'where':{'id':_0x49d1db[_0x5029('0x43')]['id']}})['then'](handleEntityNotFound(_0x353ae4,null))['then'](removeEntity(_0x353ae4,null))[_0x5029('0x41')](handleError(_0x353ae4,null));};exports[_0x5029('0x4e')]=function(_0x81e39c,_0x448273){var _0x164179=0xa;var _0x4e8d9f=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x4dca54={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':'COUNT(DISTINCT\x20%s)','MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x4208ab={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x59a718=function(_0x560324){return!_[_0x5029('0x5e')]([_0x5029('0x5f'),_0x5029('0x60'),'IS\x20EMPTY',_0x5029('0x61')],_0x560324);};var _0x2d439a=function(_0x105638){if(!_0x105638||!_0x105638[_0x5029('0x62')][_0x5029('0x33')]){return'';}for(var _0x5264c6='(',_0x2ec5d0=0x0;_0x2ec5d0<_0x105638[_0x5029('0x62')][_0x5029('0x33')];_0x2ec5d0+=0x1){_0x2ec5d0>0x0&&(_0x5264c6+='\x20'+_0x105638['operator']+'\x20');_0x5264c6+=_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']?_0x2d439a(_0x105638[_0x5029('0x62')][_0x2ec5d0]['group']):_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x63')]+'\x20'+_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')]+(_0x59a718(_0x105638[_0x5029('0x62')][_0x2ec5d0][_0x5029('0x64')])?'\x20'+_0x105638['rules'][_0x2ec5d0][_0x5029('0x65')]:'');}return _0x5264c6+')';};var _0x19220d={'where':{'id':_0x81e39c['params']['id']}},_0x1ff8df,_0x151562,_0x389700,_0x506f74,_0x13ca47;_0x19220d=_[_0x5029('0x3c')]({},_0x19220d,_0x81e39c['options']);return db[_0x5029('0x2a')]['find'](_0x19220d)[_0x5029('0x21')](function(_0x54daf9){if(_0x54daf9){_0x1ff8df=_0x54daf9;return _0x54daf9['getFields']();}return null;})[_0x5029('0x21')](function(_0x575f09){if(_0x575f09){if(!_0x575f09[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x151562=_0x575f09;return db[_0x5029('0x68')]['findAll']({'raw':!![]});}return null;})[_0x5029('0x21')](function(_0x255dfb){if(_0x255dfb){_0x389700=_[_0x5029('0x69')](_0x255dfb,'id');var _0x1cca02;var _0x1deed7=squel['select']();_0x1deed7[_0x5029('0x6a')](_0x1ff8df[_0x5029('0x6b')]);for(var _0x5890ac=0x0;_0x5890ac<_0x151562[_0x5029('0x33')];_0x5890ac+=0x1){_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6c')]?_0x389700[_0x151562[_0x5890ac][_0x5029('0x6c')]][_0x5029('0x6d')]:_0x151562[_0x5890ac][_0x5029('0x63')];_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6e')]?_['replace'](_0x4dca54[_0x151562[_0x5890ac]['function']],'%s',_0x1cca02):_0x1cca02;_0x1cca02=_0x151562[_0x5890ac][_0x5029('0x6f')]?_['replace'](_0x4208ab[_0x151562[_0x5890ac][_0x5029('0x6f')]],'%s',_0x1cca02):_0x1cca02;if(_0x151562[_0x5890ac][_0x5029('0x70')]){_0x1deed7['group'](_0x1cca02);}_0x151562[_0x5890ac][_0x5029('0x71')]&&_0x1deed7['order'](_0x1cca02,_0x151562[_0x5890ac]['orderBy']===_0x5029('0x72')?![]:!![]);_0x1deed7[_0x5029('0x63')](_0x1cca02,_0x151562[_0x5890ac][_0x5029('0x73')]||_0x1cca02);}if(_0x1ff8df[_0x5029('0x74')]){_0x1ff8df['joins']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x74')]);for(var _0x4a2ce8=0x0;_0x4a2ce8<_0x1ff8df[_0x5029('0x74')][_0x5029('0x33')];_0x4a2ce8+=0x1){if(_0x1ff8df['joins'][_0x4a2ce8]['type']&&_['includes'](_0x4e8d9f,_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x2c')])&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x77')]&&_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]){_0x1deed7[_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['type']](_0x1ff8df['joins'][_0x4a2ce8][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x1ff8df[_0x5029('0x6b')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x76')],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8]['foreignTable'],_0x1ff8df[_0x5029('0x74')][_0x4a2ce8][_0x5029('0x78')]));}}}if(_0x1ff8df[_0x5029('0x7a')]){_0x1ff8df['conditions']=JSON[_0x5029('0x75')](_0x1ff8df[_0x5029('0x7a')]);_0x1deed7[_0x5029('0x38')](_0x2d439a(_0x1ff8df['conditions'][_0x5029('0x7b')]));}_0x13ca47=_0x1deed7[_0x5029('0x7c')]();_0x1deed7[_0x5029('0x1b')](_0x164179);_0x1deed7['offset'](0x0);logger[_0x5029('0x7d')](_0x5029('0x7e'),_0x1deed7['toString']());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1deed7[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')]['SELECT']});}})[_0x5029('0x21')](respondWithResult(_0x448273,null))[_0x5029('0x41')](handleError(_0x448273,null));};function runReport(_0x426d70,_0xe6ac28,_0x153cdc){var _0x5e7f50=_0xe6ac28[_0x5029('0x26')];var _0x202c51=0xa;var _0x344203=['join',_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x3e47bd={'SUM':_0x5029('0x53'),'COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':'MAX(%s)','MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':_0x5029('0x57'),'GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x4c40d1={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x5029('0x5d')};var _0x41e2d8=function(_0x51098a){return!_['includes'](['IS\x20NULL',_0x5029('0x60'),_0x5029('0x84'),_0x5029('0x61')],_0x51098a);};var _0x4007c8=function(_0x3dc05a){if(!_0x3dc05a||!_0x3dc05a['rules'][_0x5029('0x33')]){return'';}for(var _0x2e4782='(',_0x2c0540=0x0;_0x2c0540<_0x3dc05a['rules']['length'];_0x2c0540+=0x1){_0x2c0540>0x0&&(_0x2e4782+='\x20'+_0x3dc05a[_0x5029('0x85')]+'\x20');_0x2e4782+=_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x7b')]?_0x4007c8(_0x3dc05a[_0x5029('0x62')][_0x2c0540]['group']):_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x63')]+'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')]+(_0x41e2d8(_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x64')])?'\x20'+_0x3dc05a[_0x5029('0x62')][_0x2c0540][_0x5029('0x65')]:'');}return _0x2e4782+')';};var _0x5aecc2={'where':{'id':_0x426d70['id']}},_0x159450,_0x556c7a,_0x48bbe2,_0x3e3150,_0x533ee2;_0x5aecc2=_[_0x5029('0x3c')]({},_0x5aecc2,_0x153cdc);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x5aecc2)[_0x5029('0x21')](function(_0x1b6f4c){if(_0x1b6f4c){_0x159450=_0x1b6f4c;return _0x1b6f4c[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x1d6092){if(_0x1d6092){if(!_0x1d6092['length']){throw new db['Sequelize'][(_0x5029('0x67'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x556c7a=_0x1d6092;return db['AnalyticMetric'][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x4b25ed){if(_0x4b25ed){_0x48bbe2=_[_0x5029('0x69')](_0x4b25ed,'id');var _0xb8da0b;var _0x13e07e=squel[_0x5029('0x88')]();_0x13e07e[_0x5029('0x6a')](_0x159450['table']);for(var _0x38c02a=0x0;_0x38c02a<_0x556c7a[_0x5029('0x33')];_0x38c02a+=0x1){_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6c')]?_0x48bbe2[_0x556c7a[_0x38c02a]['MetricId']][_0x5029('0x6d')]:_0x556c7a[_0x38c02a][_0x5029('0x63')];_0xb8da0b=_0x556c7a[_0x38c02a][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x3e47bd[_0x556c7a[_0x38c02a][_0x5029('0x6e')]],'%s',_0xb8da0b):_0xb8da0b;_0xb8da0b=_0x556c7a[_0x38c02a]['format']?_['replace'](_0x4c40d1[_0x556c7a[_0x38c02a][_0x5029('0x6f')]],'%s',_0xb8da0b):_0xb8da0b;if(_0x556c7a[_0x38c02a][_0x5029('0x70')]){_0x13e07e['group'](_0xb8da0b);}_0x556c7a[_0x38c02a][_0x5029('0x71')]&&_0x13e07e[_0x5029('0x36')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x13e07e[_0x5029('0x63')](_0xb8da0b,_0x556c7a[_0x38c02a][_0x5029('0x73')]||_0xb8da0b);}if(_0x159450[_0x5029('0x74')]){_0x159450[_0x5029('0x74')]=JSON['parse'](_0x159450['joins']);for(var _0x4243c3=0x0;_0x4243c3<_0x159450['joins'][_0x5029('0x33')];_0x4243c3+=0x1){if(_0x159450['joins'][_0x4243c3][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x344203,_0x159450[_0x5029('0x74')][_0x4243c3]['type'])&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')]&&_0x159450[_0x5029('0x74')][_0x4243c3]['foreignTable']&&_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]){_0x13e07e[_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x2c')]](_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x159450[_0x5029('0x6b')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x76')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x77')],_0x159450[_0x5029('0x74')][_0x4243c3][_0x5029('0x78')]));}}}if(_0x159450[_0x5029('0x7a')]){_0x159450[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x159450['conditions']);_0x13e07e[_0x5029('0x38')](_0x4007c8(_0x159450[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x533ee2=_0x13e07e[_0x5029('0x7c')]();_0x13e07e[_0x5029('0x1b')](_0x202c51);_0x13e07e['offset'](0x0);return;}})[_0x5029('0x21')](function(){if(_0xe6ac28[_0x5029('0x8a')]===_0x5029('0x8b')){return null;}var _0xf7729c=_[_0x5029('0x3c')](_0xe6ac28,{'name':_0xe6ac28['fullPath']||_0xe6ac28[_0x5029('0x26')]||_0x159450[_0x5029('0x26')],'basename':_0x5e7f50,'savename':util[_0x5029('0x6f')](_0x5029('0x8c'),_0xe6ac28[_0x5029('0x26')]||_0x159450['name'],require(_0x5029('0x8d'))[_0x5029('0x8e')](0x4),_0xe6ac28[_0x5029('0x8a')]||_0x5029('0x8f')),'reportId':_0x159450['id'],'reportType':_0x5029('0x90')});return db[_0x5029('0x91')][_0x5029('0x46')](_0xf7729c,{'raw':!![]});})[_0x5029('0x21')](function(_0x4a7535){if(_0x159450['table']===_0x5029('0x92')){_0x533ee2[_0x5029('0x38')](_0x159450[_0x5029('0x6b')]+_0x5029('0x93'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28['endDate']);}else{_0x533ee2[_0x5029('0x38')](_0x159450['table']+_0x5029('0x95'),_0xe6ac28[_0x5029('0x94')],_0xe6ac28[_0x5029('0x96')]);}if(_0x4a7535){logger[_0x5029('0x97')](_0x5029('0x98'),_0x533ee2[_0x5029('0x80')]());require('child_process')[_0x5029('0x99')](path[_0x5029('0x4f')](__dirname,'../../components/export/',_0x4a7535[_0x5029('0x8a')]),[_0x4a7535['id'],_0x533ee2[_0x5029('0x80')](),path['join'](__dirname,_0x5029('0x9a'),_0x4a7535['savename']),_0x5e7f50]);return _0x4a7535;}else{var _0x54c0f3=squel['select']();_0x54c0f3['from']('('+_0x533ee2[_0x5029('0x80')]()+')','countTable');_0x54c0f3[_0x5029('0x63')](_0x5029('0x9b'),'count');_0x533ee2[_0x5029('0x1b')](_0xe6ac28[_0x5029('0x1b')]||_0x202c51);_0x533ee2['offset'](_0xe6ac28[_0x5029('0x19')]||0x0);return dbH[_0x5029('0x7f')]['query'](_0x54c0f3[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')]['QueryTypes'][_0x5029('0x9c')]})[_0x5029('0x21')](function(_0x17c755){if(!_0x17c755[_0x5029('0x33')]){_0x3e3150=0x0;}else{_0x3e3150=_0x17c755[0x0][_0x5029('0x1c')]||0x0;}return dbH[_0x5029('0x7f')]['query'](_0x533ee2[_0x5029('0x80')](),{'type':dbH['sequelize'][_0x5029('0x81')][_0x5029('0x9c')]});})[_0x5029('0x21')](function(_0x3ebe00){return{'rows':_0x3ebe00||[],'count':_0x3e3150};});}});}exports[_0x5029('0x9d')]=function(_0x2138cc,_0x331af8){return runReport(_0x2138cc[_0x5029('0x43')],_0x2138cc[_0x5029('0x2e')],_0x2138cc[_0x5029('0x44')])[_0x5029('0x21')](respondWithResult(_0x331af8,null))[_0x5029('0x41')](handleError(_0x331af8,null));};exports[_0x5029('0x9e')]=runReport;exports[_0x5029('0x2e')]=function(_0x9de076,_0x2ac88e){var _0x55ee4f=0xa;var _0x1fa9eb=[_0x5029('0x4f'),_0x5029('0x50'),_0x5029('0x51'),_0x5029('0x52')];var _0x405d47={'SUM':'SUM(%s)','COUNT':_0x5029('0x54'),'COUNT DISTINCT':_0x5029('0x82'),'MAX':_0x5029('0x9f'),'MIN':_0x5029('0x55'),'AVG':_0x5029('0x56'),'GROUP_CONCAT':'GROUP_CONCAT(%s)','GROUP_CONCAT ASC':_0x5029('0x58'),'GROUP_CONCAT DESC':_0x5029('0x83')};var _0x29c3a2={'SEC_TO_TIME':_0x5029('0x59'),'DATE':_0x5029('0x5a'),'HOUR':_0x5029('0x5b'),'ROUND':_0x5029('0x5c'),'UNIX_TIMESTAMP':_0x5029('0x5d')};var _0xb39e9d=function(_0x124c5e){return!_['includes']([_0x5029('0x5f'),'IS\x20NOT\x20NULL',_0x5029('0x84'),_0x5029('0x61')],_0x124c5e);};var _0x120acc=function(_0x21bb22){if(!_0x21bb22||!_0x21bb22['rules'][_0x5029('0x33')]){return'';}for(var _0x339112='(',_0x5d7c1a=0x0;_0x5d7c1a<_0x21bb22[_0x5029('0x62')][_0x5029('0x33')];_0x5d7c1a+=0x1){_0x5d7c1a>0x0&&(_0x339112+='\x20'+_0x21bb22['operator']+'\x20');_0x339112+=_0x21bb22[_0x5029('0x62')][_0x5d7c1a][_0x5029('0x7b')]?_0x120acc(_0x21bb22['rules'][_0x5d7c1a]['group']):_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['field']+'\x20'+_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')]+(_0xb39e9d(_0x21bb22['rules'][_0x5d7c1a][_0x5029('0x64')])?'\x20'+_0x21bb22[_0x5029('0x62')][_0x5d7c1a]['value']:'');}return _0x339112+')';};var _0x327299={'where':{'id':_0x9de076['params']['id']}},_0x3463cc,_0x590cc2,_0x3ac39a,_0x37c47b,_0x62e4af;_0x327299=_[_0x5029('0x3c')]({},_0x327299,_0x9de076['options']);return db[_0x5029('0x2a')][_0x5029('0x45')](_0x327299)[_0x5029('0x21')](function(_0x5e7ec8){if(_0x5e7ec8){_0x3463cc=_0x5e7ec8;return _0x5e7ec8[_0x5029('0x86')]();}return null;})[_0x5029('0x21')](function(_0x5aa480){if(_0x5aa480){if(!_0x5aa480[_0x5029('0x33')]){throw new db[(_0x5029('0x66'))]['ValidationErrorItem']('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x590cc2=_0x5aa480;return db[_0x5029('0x68')][_0x5029('0x87')]({'raw':!![]});}return null;})['then'](function(_0x5842a5){if(_0x5842a5){_0x3ac39a=_['keyBy'](_0x5842a5,'id');var _0x313bdb;var _0x1d38e0=squel[_0x5029('0x88')]();_0x1d38e0['from'](_0x3463cc[_0x5029('0x6b')]);for(var _0x581237=0x0;_0x581237<_0x590cc2[_0x5029('0x33')];_0x581237+=0x1){_0x313bdb=_0x590cc2[_0x581237]['MetricId']?_0x3ac39a[_0x590cc2[_0x581237]['MetricId']]['metric']:_0x590cc2[_0x581237]['field'];_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6e')]?_[_0x5029('0x89')](_0x405d47[_0x590cc2[_0x581237][_0x5029('0x6e')]],'%s',_0x313bdb):_0x313bdb;_0x313bdb=_0x590cc2[_0x581237][_0x5029('0x6f')]?_[_0x5029('0x89')](_0x29c3a2[_0x590cc2[_0x581237]['format']],'%s',_0x313bdb):_0x313bdb;if(_0x590cc2[_0x581237][_0x5029('0x70')]){_0x1d38e0[_0x5029('0x7b')](_0x313bdb);}_0x590cc2[_0x581237][_0x5029('0x71')]&&_0x1d38e0[_0x5029('0x36')](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x71')]===_0x5029('0x72')?![]:!![]);_0x1d38e0['field'](_0x313bdb,_0x590cc2[_0x581237][_0x5029('0x73')]||_0x313bdb);}if(_0x3463cc[_0x5029('0x74')]){_0x3463cc[_0x5029('0x74')]=JSON['parse'](_0x3463cc['joins']);for(var _0xd05bc9=0x0;_0xd05bc9<_0x3463cc[_0x5029('0x74')][_0x5029('0x33')];_0xd05bc9+=0x1){if(_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')]&&_[_0x5029('0x5e')](_0x1fa9eb,_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x2c')])&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x76')]&&_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')]&&_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]){_0x1d38e0[_0x3463cc['joins'][_0xd05bc9][_0x5029('0x2c')]](_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x77')],null,util[_0x5029('0x6f')](_0x5029('0x79'),_0x3463cc[_0x5029('0x6b')],_0x3463cc[_0x5029('0x74')][_0xd05bc9][_0x5029('0x76')],_0x3463cc['joins'][_0xd05bc9]['foreignTable'],_0x3463cc['joins'][_0xd05bc9][_0x5029('0x78')]));}}}if(_0x3463cc[_0x5029('0x7a')]){_0x3463cc[_0x5029('0x7a')]=JSON[_0x5029('0x75')](_0x3463cc[_0x5029('0x7a')]);_0x1d38e0['where'](_0x120acc(_0x3463cc[_0x5029('0x7a')][_0x5029('0x7b')]));}_0x62e4af=_0x1d38e0[_0x5029('0x7c')]();_0x1d38e0[_0x5029('0x1b')](_0x55ee4f);_0x1d38e0[_0x5029('0x19')](0x0);logger['debug'](_0x5029('0x7e'),_0x1d38e0[_0x5029('0x80')]());return dbH[_0x5029('0x7f')][_0x5029('0x2e')](_0x1d38e0[_0x5029('0x80')](),{'type':dbH[_0x5029('0x7f')][_0x5029('0x81')][_0x5029('0x9c')]});}})[_0x5029('0x21')](function(){return{'sql':_0x62e4af[_0x5029('0x80')]()};})[_0x5029('0x21')](respondWithResult(_0x2ac88e,null))[_0x5029('0x41')](handleError(_0x2ac88e,null));}; \ No newline at end of file +var _0xba34=['save','then','destroy','get','DefaultReports','UserProfileResource','error','name','send','index','map','AnalyticDefaultReport','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','show','params','find','create','body','user','role','UserProfileSection','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','preview','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\x20DESC)','SEC_TO_TIME(%s)','DATE(%s)','HOUR(%s)','UNIX_TIMESTAMP(%s)','includes','IS\x20NULL','IS\x20EMPTY','IS\x20NOT\x20EMPTY','rules','operator','group','field','condition','getFields','Sequelize','ValidationErrorItem','keyBy','select','from','table','MetricId','metric','function','replace','format','groupBy','orderBy','DESC','alias','joins','parse','parentKey','foreignKey','foreignTable','%s.%s\x20=\x20%s.%s','conditions','clone','debug','Limited\x20Query:','toString','sequelize','SELECT','COUNT(%s)','AVG(%s)','IS\x20NOT\x20NULL','value','order','output','%s-%s.%s','randomstring','generate','cdr','.calldate\x20BETWEEN\x20?\x20AND\x20?','endDate','startDate','info','Run\x20Query:','fork','countTable','QueryTypes','runReport','GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','ROUND(%s)','Please\x20insert\x20at\x20least\x20one\x20field','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject'];(function(_0x205401,_0x3832c4){var _0x569ec1=function(_0x21d59f){while(--_0x21d59f){_0x205401['push'](_0x205401['shift']());}};_0x569ec1(++_0x3832c4);}(_0xba34,0x119));var _0x4ba3=function(_0x31ff15,_0x1d43e3){_0x31ff15=_0x31ff15-0x0;var _0x226877=_0xba34[_0x31ff15];return _0x226877;};'use strict';var emlformat=require(_0x4ba3('0x0'));var rimraf=require(_0x4ba3('0x1'));var zipdir=require(_0x4ba3('0x2'));var jsonpatch=require(_0x4ba3('0x3'));var rp=require(_0x4ba3('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x4ba3('0x5'));var path=require(_0x4ba3('0x6'));var sox=require(_0x4ba3('0x7'));var csv=require(_0x4ba3('0x8'));var ejs=require(_0x4ba3('0x9'));var fs=require('fs');var fs_extra=require(_0x4ba3('0xa'));var _=require(_0x4ba3('0xb'));var squel=require('squel');var crypto=require(_0x4ba3('0xc'));var jsforce=require(_0x4ba3('0xd'));var deskjs=require(_0x4ba3('0xe'));var toCsv=require(_0x4ba3('0x8'));var querystring=require(_0x4ba3('0xf'));var Papa=require(_0x4ba3('0x10'));var Redis=require(_0x4ba3('0x11'));var authService=require(_0x4ba3('0x12'));var qs=require(_0x4ba3('0x13'));var as=require(_0x4ba3('0x14'));var hardwareService=require(_0x4ba3('0x15'));var logger=require('../../config/logger')(_0x4ba3('0x16'));var utils=require(_0x4ba3('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x4ba3('0x18'));var db=require('../../mysqldb')['db'];var dbH=require(_0x4ba3('0x19'))['dbH'];function respondWithStatusCode(_0x256f02,_0x4419b4){_0x4419b4=_0x4419b4||0xcc;return function(_0x29e498){if(_0x29e498){return _0x256f02[_0x4ba3('0x1a')](_0x4419b4);}return _0x256f02[_0x4ba3('0x1b')](_0x4419b4)[_0x4ba3('0x1c')]();};}function respondWithResult(_0x3a74f7,_0x12ac90){_0x12ac90=_0x12ac90||0xc8;return function(_0x1dec48){if(_0x1dec48){return _0x3a74f7[_0x4ba3('0x1b')](_0x12ac90)[_0x4ba3('0x1d')](_0x1dec48);}};}function respondWithFilteredResult(_0x301359,_0x29a9d1){return function(_0x25f584){if(_0x25f584){var _0x40e75b=typeof _0x29a9d1[_0x4ba3('0x1e')]==='undefined'&&typeof _0x29a9d1[_0x4ba3('0x1f')]===_0x4ba3('0x20');var _0x5ff7ce=_0x25f584[_0x4ba3('0x21')];var _0x556290=_0x40e75b?0x0:_0x29a9d1[_0x4ba3('0x1e')];var _0xe4eff9=_0x40e75b?_0x25f584[_0x4ba3('0x21')]:_0x29a9d1[_0x4ba3('0x1e')]+_0x29a9d1[_0x4ba3('0x1f')];var _0x125944;if(_0xe4eff9>=_0x5ff7ce){_0xe4eff9=_0x5ff7ce;_0x125944=0xc8;}else{_0x125944=0xce;}_0x301359['status'](_0x125944);return _0x301359['set'](_0x4ba3('0x22'),_0x556290+'-'+_0xe4eff9+'/'+_0x5ff7ce)['json'](_0x25f584);}return null;};}function patchUpdates(_0x18dff5){return function(_0x163967){try{jsonpatch[_0x4ba3('0x23')](_0x163967,_0x18dff5,!![]);}catch(_0xbc7023){return BPromise[_0x4ba3('0x24')](_0xbc7023);}return _0x163967[_0x4ba3('0x25')]();};}function saveUpdates(_0x4a0823,_0x143c78){return function(_0x1f87e1){if(_0x1f87e1){return _0x1f87e1['update'](_0x4a0823)[_0x4ba3('0x26')](function(_0x4ffe39){return _0x4ffe39;});}return null;};}function removeEntity(_0x1ae4de,_0x18abb3){return function(_0x11a917){if(_0x11a917){return _0x11a917[_0x4ba3('0x27')]()[_0x4ba3('0x26')](function(){var _0xe29a49=_0x11a917[_0x4ba3('0x28')]({'plain':!![]});var _0xe1f7d2=_0x4ba3('0x29');return db[_0x4ba3('0x2a')]['destroy']({'where':{'type':_0xe1f7d2,'resourceId':_0xe29a49['id']}})[_0x4ba3('0x26')](function(){return _0x11a917;});})[_0x4ba3('0x26')](function(){_0x1ae4de[_0x4ba3('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x10537e,_0x1fe5e2){return function(_0x44d78c){if(!_0x44d78c){_0x10537e['sendStatus'](0x194);}return _0x44d78c;};}function handleError(_0x10cae6,_0x843276){_0x843276=_0x843276||0x1f4;return function(_0x34ecb4){logger[_0x4ba3('0x2b')](_0x34ecb4['stack']);if(_0x34ecb4['name']){delete _0x34ecb4[_0x4ba3('0x2c')];}_0x10cae6[_0x4ba3('0x1b')](_0x843276)[_0x4ba3('0x2d')](_0x34ecb4);};}exports[_0x4ba3('0x2e')]=function(_0x2cb5d5,_0x11f88f){var _0x48b3b7={},_0x27444b={},_0x28f36c={'count':0x0,'rows':[]};var _0x24d8fc=_[_0x4ba3('0x2f')](db[_0x4ba3('0x30')][_0x4ba3('0x31')],function(_0x457236){return{'name':_0x457236[_0x4ba3('0x32')],'type':_0x457236[_0x4ba3('0x33')][_0x4ba3('0x34')]};});_0x27444b['model']=_['map'](_0x24d8fc,'name');_0x27444b[_0x4ba3('0x35')]=_[_0x4ba3('0x36')](_0x2cb5d5[_0x4ba3('0x35')]);_0x27444b[_0x4ba3('0x37')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],_0x27444b[_0x4ba3('0x35')]);_0x48b3b7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x27444b[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x2cb5d5[_0x4ba3('0x35')]['fields']));_0x48b3b7[_0x4ba3('0x3a')]=_0x48b3b7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x48b3b7['attributes']:_0x27444b[_0x4ba3('0x39')];if(!_0x2cb5d5['query'][_0x4ba3('0x3d')](_0x4ba3('0x3e'))){_0x48b3b7[_0x4ba3('0x1f')]=qs[_0x4ba3('0x1f')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1f')]);_0x48b3b7['offset']=qs[_0x4ba3('0x1e')](_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x1e')]);}_0x48b3b7['order']=qs[_0x4ba3('0x3f')](_0x2cb5d5[_0x4ba3('0x35')]['sort']);_0x48b3b7[_0x4ba3('0x40')]=qs['filters'](_['pick'](_0x2cb5d5[_0x4ba3('0x35')],_0x27444b[_0x4ba3('0x37')]),_0x24d8fc);if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x41')]){_0x48b3b7[_0x4ba3('0x40')]=_['merge'](_0x48b3b7[_0x4ba3('0x40')],{'$or':_[_0x4ba3('0x2f')](_0x24d8fc,function(_0x46d2ca){if(_0x46d2ca[_0x4ba3('0x33')]!==_0x4ba3('0x42')){var _0x2acc92={};_0x2acc92[_0x46d2ca[_0x4ba3('0x2c')]]={'$like':'%'+_0x2cb5d5[_0x4ba3('0x35')]['filter']+'%'};return _0x2acc92;}})});}_0x48b3b7=_[_0x4ba3('0x43')]({},_0x48b3b7,_0x2cb5d5[_0x4ba3('0x44')]);var _0x3cb07f={'where':_0x48b3b7[_0x4ba3('0x40')]};return db[_0x4ba3('0x30')][_0x4ba3('0x21')](_0x3cb07f)[_0x4ba3('0x26')](function(_0xdcc2a2){_0x28f36c[_0x4ba3('0x21')]=_0xdcc2a2;if(_0x2cb5d5[_0x4ba3('0x35')][_0x4ba3('0x45')]){_0x48b3b7[_0x4ba3('0x46')]=[{'all':!![]}];}return db[_0x4ba3('0x30')][_0x4ba3('0x47')](_0x48b3b7);})['then'](function(_0x5af671){_0x28f36c['rows']=_0x5af671;return _0x28f36c;})['then'](respondWithFilteredResult(_0x11f88f,_0x48b3b7))['catch'](handleError(_0x11f88f,null));};exports[_0x4ba3('0x48')]=function(_0x5c4659,_0x29e74d){var _0x5567c7={'raw':!![],'where':{'id':_0x5c4659[_0x4ba3('0x49')]['id']}},_0x53d6eb={};_0x53d6eb[_0x4ba3('0x39')]=_[_0x4ba3('0x36')](db[_0x4ba3('0x30')]['rawAttributes']);_0x53d6eb[_0x4ba3('0x35')]=_['keys'](_0x5c4659[_0x4ba3('0x35')]);_0x53d6eb['filters']=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],_0x53d6eb[_0x4ba3('0x35')]);_0x5567c7[_0x4ba3('0x3a')]=_[_0x4ba3('0x38')](_0x53d6eb[_0x4ba3('0x39')],qs[_0x4ba3('0x3b')](_0x5c4659['query'][_0x4ba3('0x3b')]));_0x5567c7[_0x4ba3('0x3a')]=_0x5567c7[_0x4ba3('0x3a')][_0x4ba3('0x3c')]?_0x5567c7[_0x4ba3('0x3a')]:_0x53d6eb['model'];if(_0x5c4659['query'][_0x4ba3('0x45')]){_0x5567c7[_0x4ba3('0x46')]=[{'all':!![]}];}_0x5567c7=_[_0x4ba3('0x43')]({},_0x5567c7,_0x5c4659['options']);return db[_0x4ba3('0x30')][_0x4ba3('0x4a')](_0x5567c7)[_0x4ba3('0x26')](handleEntityNotFound(_0x29e74d,null))['then'](respondWithResult(_0x29e74d,null))['catch'](handleError(_0x29e74d,null));};exports[_0x4ba3('0x4b')]=function(_0x482a83,_0x439acf){return db[_0x4ba3('0x30')][_0x4ba3('0x4b')](_0x482a83[_0x4ba3('0x4c')],{})[_0x4ba3('0x26')](function(_0x213eb0){var _0x590739=_0x482a83[_0x4ba3('0x4d')][_0x4ba3('0x28')]({'plain':!![]});if(!_0x590739)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x590739[_0x4ba3('0x4e')]===_0x4ba3('0x4d')){var _0x156c2d=_0x213eb0[_0x4ba3('0x28')]({'plain':!![]});var _0x360472='Reports';return db[_0x4ba3('0x4f')][_0x4ba3('0x4a')]({'where':{'name':_0x360472,'userProfileId':_0x590739['userProfileId']},'raw':!![]})[_0x4ba3('0x26')](function(_0x19d70f){if(_0x19d70f&&_0x19d70f[_0x4ba3('0x50')]===0x0){return db[_0x4ba3('0x2a')][_0x4ba3('0x4b')]({'name':_0x156c2d[_0x4ba3('0x2c')],'resourceId':_0x156c2d['id'],'type':_0x4ba3('0x29'),'sectionId':_0x19d70f['id']},{})[_0x4ba3('0x26')](function(){return _0x213eb0;});}else{return _0x213eb0;}})[_0x4ba3('0x51')](function(_0x428a27){logger[_0x4ba3('0x2b')](_0x4ba3('0x52'),_0x428a27);throw _0x428a27;});}return _0x213eb0;})[_0x4ba3('0x26')](respondWithResult(_0x439acf,0xc9))[_0x4ba3('0x51')](handleError(_0x439acf,null));};exports[_0x4ba3('0x53')]=function(_0x48a3d4,_0x5e7ed5){if(_0x48a3d4['body']['id']){delete _0x48a3d4[_0x4ba3('0x4c')]['id'];}return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x48a3d4[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x5e7ed5,null))['then'](saveUpdates(_0x48a3d4[_0x4ba3('0x4c')],null))[_0x4ba3('0x26')](respondWithResult(_0x5e7ed5,null))[_0x4ba3('0x51')](handleError(_0x5e7ed5,null));};exports[_0x4ba3('0x27')]=function(_0x5359d1,_0x1e83fb){return db[_0x4ba3('0x30')][_0x4ba3('0x4a')]({'where':{'id':_0x5359d1[_0x4ba3('0x49')]['id']}})[_0x4ba3('0x26')](handleEntityNotFound(_0x1e83fb,null))[_0x4ba3('0x26')](removeEntity(_0x1e83fb,null))[_0x4ba3('0x51')](handleError(_0x1e83fb,null));};exports[_0x4ba3('0x54')]=function(_0x328314,_0x4fa64d){var _0x20c849=0xa;var _0x42bb4b=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x40827a={'SUM':_0x4ba3('0x59'),'COUNT':'COUNT(%s)','COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':_0x4ba3('0x5b'),'MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x4cc10a={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':_0x4ba3('0x62')};var _0xaef1b=function(_0x2a48fe){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),'IS\x20NOT\x20NULL',_0x4ba3('0x65'),_0x4ba3('0x66')],_0x2a48fe);};var _0x34cc21=function(_0x469ef0){if(!_0x469ef0||!_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')]){return'';}for(var _0x3fdf7f='(',_0x38699e=0x0;_0x38699e<_0x469ef0[_0x4ba3('0x67')][_0x4ba3('0x3c')];_0x38699e+=0x1){_0x38699e>0x0&&(_0x3fdf7f+='\x20'+_0x469ef0[_0x4ba3('0x68')]+'\x20');_0x3fdf7f+=_0x469ef0['rules'][_0x38699e][_0x4ba3('0x69')]?_0x34cc21(_0x469ef0[_0x4ba3('0x67')][_0x38699e]['group']):_0x469ef0['rules'][_0x38699e][_0x4ba3('0x6a')]+'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['condition']+(_0xaef1b(_0x469ef0[_0x4ba3('0x67')][_0x38699e][_0x4ba3('0x6b')])?'\x20'+_0x469ef0[_0x4ba3('0x67')][_0x38699e]['value']:'');}return _0x3fdf7f+')';};var _0x1f5815={'where':{'id':_0x328314['params']['id']}},_0x46224,_0x1af489,_0x11209b,_0x24a75a,_0x3a4838;_0x1f5815=_[_0x4ba3('0x43')]({},_0x1f5815,_0x328314[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x1f5815)[_0x4ba3('0x26')](function(_0x2f8bcc){if(_0x2f8bcc){_0x46224=_0x2f8bcc;return _0x2f8bcc[_0x4ba3('0x6c')]();}return null;})[_0x4ba3('0x26')](function(_0x21c8b1){if(_0x21c8b1){if(!_0x21c8b1[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x1af489=_0x21c8b1;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})['then'](function(_0x13ee2c){if(_0x13ee2c){_0x11209b=_[_0x4ba3('0x6f')](_0x13ee2c,'id');var _0x442d66;var _0x5c7fc2=squel[_0x4ba3('0x70')]();_0x5c7fc2[_0x4ba3('0x71')](_0x46224[_0x4ba3('0x72')]);for(var _0x5baf26=0x0;_0x5baf26<_0x1af489[_0x4ba3('0x3c')];_0x5baf26+=0x1){_0x442d66=_0x1af489[_0x5baf26]['MetricId']?_0x11209b[_0x1af489[_0x5baf26][_0x4ba3('0x73')]][_0x4ba3('0x74')]:_0x1af489[_0x5baf26]['field'];_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x40827a[_0x1af489[_0x5baf26][_0x4ba3('0x75')]],'%s',_0x442d66):_0x442d66;_0x442d66=_0x1af489[_0x5baf26][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x4cc10a[_0x1af489[_0x5baf26][_0x4ba3('0x77')]],'%s',_0x442d66):_0x442d66;if(_0x1af489[_0x5baf26][_0x4ba3('0x78')]){_0x5c7fc2[_0x4ba3('0x69')](_0x442d66);}_0x1af489[_0x5baf26][_0x4ba3('0x79')]&&_0x5c7fc2['order'](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x5c7fc2[_0x4ba3('0x6a')](_0x442d66,_0x1af489[_0x5baf26][_0x4ba3('0x7b')]||_0x442d66);}if(_0x46224[_0x4ba3('0x7c')]){_0x46224[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x7c')]);for(var _0x365d94=0x0;_0x365d94<_0x46224[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x365d94+=0x1){if(_0x46224[_0x4ba3('0x7c')][_0x365d94]['type']&&_[_0x4ba3('0x63')](_0x42bb4b,_0x46224[_0x4ba3('0x7c')][_0x365d94]['type'])&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7e')]&&_0x46224['joins'][_0x365d94]['foreignTable']&&_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]){_0x5c7fc2[_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x33')]](_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x46224['table'],_0x46224[_0x4ba3('0x7c')][_0x365d94]['parentKey'],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x80')],_0x46224[_0x4ba3('0x7c')][_0x365d94][_0x4ba3('0x7f')]));}}}if(_0x46224[_0x4ba3('0x82')]){_0x46224[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x46224[_0x4ba3('0x82')]);_0x5c7fc2['where'](_0x34cc21(_0x46224[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x3a4838=_0x5c7fc2[_0x4ba3('0x83')]();_0x5c7fc2['limit'](_0x20c849);_0x5c7fc2[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x5c7fc2[_0x4ba3('0x86')]());return dbH[_0x4ba3('0x87')][_0x4ba3('0x35')](_0x5c7fc2[_0x4ba3('0x86')](),{'type':dbH['sequelize']['QueryTypes'][_0x4ba3('0x88')]});}})['then'](respondWithResult(_0x4fa64d,null))[_0x4ba3('0x51')](handleError(_0x4fa64d,null));};function runReport(_0x15508f,_0x108679,_0x20f7db){var _0x5a3c63=_0x108679['name'];var _0x2d16e5=0xa;var _0x2b2132=['join',_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x1e8232={'SUM':_0x4ba3('0x59'),'COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':_0x4ba3('0x8a'),'GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20ASC)','GROUP_CONCAT DESC':_0x4ba3('0x5e')};var _0x13dbc4={'SEC_TO_TIME':'SEC_TO_TIME(%s)','DATE':_0x4ba3('0x60'),'HOUR':_0x4ba3('0x61'),'ROUND':'ROUND(%s)','UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x5aa412=function(_0x4ec70e){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),_0x4ba3('0x65'),_0x4ba3('0x66')],_0x4ec70e);};var _0x333a97=function(_0x30d7a9){if(!_0x30d7a9||!_0x30d7a9['rules'][_0x4ba3('0x3c')]){return'';}for(var _0x4cd4a2='(',_0x31a725=0x0;_0x31a725<_0x30d7a9['rules'][_0x4ba3('0x3c')];_0x31a725+=0x1){_0x31a725>0x0&&(_0x4cd4a2+='\x20'+_0x30d7a9[_0x4ba3('0x68')]+'\x20');_0x4cd4a2+=_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x69')]?_0x333a97(_0x30d7a9[_0x4ba3('0x67')][_0x31a725]['group']):_0x30d7a9['rules'][_0x31a725][_0x4ba3('0x6a')]+'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')]+(_0x5aa412(_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x6b')])?'\x20'+_0x30d7a9[_0x4ba3('0x67')][_0x31a725][_0x4ba3('0x8c')]:'');}return _0x4cd4a2+')';};var _0x3d8606={'where':{'id':_0x15508f['id']}},_0x2d00e3,_0x35441e,_0x217ea4,_0x40dcee,_0x5ea9d0;_0x3d8606=_[_0x4ba3('0x43')]({},_0x3d8606,_0x20f7db);return db['AnalyticDefaultReport'][_0x4ba3('0x4a')](_0x3d8606)[_0x4ba3('0x26')](function(_0x17b970){if(_0x17b970){_0x2d00e3=_0x17b970;return _0x17b970[_0x4ba3('0x6c')]();}return null;})['then'](function(_0x2a2dc2){if(_0x2a2dc2){if(!_0x2a2dc2[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))]('Please\x20insert\x20at\x20least\x20one\x20field',0x193);}_0x35441e=_0x2a2dc2;return db['AnalyticMetric'][_0x4ba3('0x47')]({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0x3188c8){if(_0x3188c8){_0x217ea4=_['keyBy'](_0x3188c8,'id');var _0x2f793a;var _0x1194a5=squel[_0x4ba3('0x70')]();_0x1194a5[_0x4ba3('0x71')](_0x2d00e3[_0x4ba3('0x72')]);for(var _0x1e2134=0x0;_0x1e2134<_0x35441e['length'];_0x1e2134+=0x1){_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x73')]?_0x217ea4[_0x35441e[_0x1e2134]['MetricId']][_0x4ba3('0x74')]:_0x35441e[_0x1e2134][_0x4ba3('0x6a')];_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x75')]?_[_0x4ba3('0x76')](_0x1e8232[_0x35441e[_0x1e2134]['function']],'%s',_0x2f793a):_0x2f793a;_0x2f793a=_0x35441e[_0x1e2134][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x13dbc4[_0x35441e[_0x1e2134]['format']],'%s',_0x2f793a):_0x2f793a;if(_0x35441e[_0x1e2134][_0x4ba3('0x78')]){_0x1194a5['group'](_0x2f793a);}_0x35441e[_0x1e2134][_0x4ba3('0x79')]&&_0x1194a5[_0x4ba3('0x8d')](_0x2f793a,_0x35441e[_0x1e2134][_0x4ba3('0x79')]===_0x4ba3('0x7a')?![]:!![]);_0x1194a5[_0x4ba3('0x6a')](_0x2f793a,_0x35441e[_0x1e2134]['alias']||_0x2f793a);}if(_0x2d00e3['joins']){_0x2d00e3[_0x4ba3('0x7c')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x7c')]);for(var _0x56244e=0x0;_0x56244e<_0x2d00e3[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x56244e+=0x1){if(_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x2b2132,_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')])&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')]&&_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')]&&_0x2d00e3['joins'][_0x56244e][_0x4ba3('0x7f')]){_0x1194a5[_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x33')]](_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x2d00e3[_0x4ba3('0x72')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x7e')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e][_0x4ba3('0x80')],_0x2d00e3[_0x4ba3('0x7c')][_0x56244e]['foreignKey']));}}}if(_0x2d00e3['conditions']){_0x2d00e3[_0x4ba3('0x82')]=JSON[_0x4ba3('0x7d')](_0x2d00e3[_0x4ba3('0x82')]);_0x1194a5[_0x4ba3('0x40')](_0x333a97(_0x2d00e3[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x5ea9d0=_0x1194a5[_0x4ba3('0x83')]();_0x1194a5['limit'](_0x2d16e5);_0x1194a5['offset'](0x0);return;}})[_0x4ba3('0x26')](function(){if(_0x108679[_0x4ba3('0x8e')]==='web'){return null;}var _0x4fb6b5=_['merge'](_0x108679,{'name':_0x108679['fullPath']||_0x108679[_0x4ba3('0x2c')]||_0x2d00e3[_0x4ba3('0x2c')],'basename':_0x5a3c63,'savename':util[_0x4ba3('0x77')](_0x4ba3('0x8f'),_0x108679[_0x4ba3('0x2c')]||_0x2d00e3['name'],require(_0x4ba3('0x90'))[_0x4ba3('0x91')](0x4),_0x108679[_0x4ba3('0x8e')]||'csv'),'reportId':_0x2d00e3['id'],'reportType':'default'});return db['AnalyticExtractedReport']['create'](_0x4fb6b5,{'raw':!![]});})[_0x4ba3('0x26')](function(_0x17d501){if(_0x2d00e3[_0x4ba3('0x72')]===_0x4ba3('0x92')){_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3['table']+_0x4ba3('0x93'),_0x108679['startDate'],_0x108679[_0x4ba3('0x94')]);}else{_0x5ea9d0[_0x4ba3('0x40')](_0x2d00e3[_0x4ba3('0x72')]+'.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x108679[_0x4ba3('0x95')],_0x108679[_0x4ba3('0x94')]);}if(_0x17d501){logger[_0x4ba3('0x96')](_0x4ba3('0x97'),_0x5ea9d0['toString']());require('child_process')[_0x4ba3('0x98')](path[_0x4ba3('0x55')](__dirname,'../../components/export/',_0x17d501[_0x4ba3('0x8e')]),[_0x17d501['id'],_0x5ea9d0['toString'](),path['join'](__dirname,'../../files/reports',_0x17d501['savename']),_0x5a3c63]);return _0x17d501;}else{var _0x2d2ca3=squel[_0x4ba3('0x70')]();_0x2d2ca3[_0x4ba3('0x71')]('('+_0x5ea9d0[_0x4ba3('0x86')]()+')',_0x4ba3('0x99'));_0x2d2ca3['field']('COUNT(*)',_0x4ba3('0x21'));_0x5ea9d0['limit'](_0x108679[_0x4ba3('0x1f')]||_0x2d16e5);_0x5ea9d0[_0x4ba3('0x1e')](_0x108679[_0x4ba3('0x1e')]||0x0);return dbH['sequelize'][_0x4ba3('0x35')](_0x2d2ca3[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]})[_0x4ba3('0x26')](function(_0xc938c){if(!_0xc938c[_0x4ba3('0x3c')]){_0x40dcee=0x0;}else{_0x40dcee=_0xc938c[0x0][_0x4ba3('0x21')]||0x0;}return dbH['sequelize']['query'](_0x5ea9d0[_0x4ba3('0x86')](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')][_0x4ba3('0x88')]});})[_0x4ba3('0x26')](function(_0xd97c26){return{'rows':_0xd97c26||[],'count':_0x40dcee};});}});}exports['run']=function(_0x1fbdc7,_0x9e45ec){return runReport(_0x1fbdc7['params'],_0x1fbdc7[_0x4ba3('0x35')],_0x1fbdc7[_0x4ba3('0x44')])[_0x4ba3('0x26')](respondWithResult(_0x9e45ec,null))[_0x4ba3('0x51')](handleError(_0x9e45ec,null));};exports[_0x4ba3('0x9b')]=runReport;exports[_0x4ba3('0x35')]=function(_0xddfb0c,_0x41c531){var _0x25bf75=0xa;var _0x18bd77=[_0x4ba3('0x55'),_0x4ba3('0x56'),_0x4ba3('0x57'),_0x4ba3('0x58')];var _0x2e812b={'SUM':'SUM(%s)','COUNT':_0x4ba3('0x89'),'COUNT DISTINCT':_0x4ba3('0x5a'),'MAX':'MAX(%s)','MIN':_0x4ba3('0x5c'),'AVG':'AVG(%s)','GROUP_CONCAT':_0x4ba3('0x5d'),'GROUP_CONCAT ASC':_0x4ba3('0x9c'),'GROUP_CONCAT DESC':'GROUP_CONCAT(%s\x20ORDER\x20BY\x20%s\x20DESC)'};var _0x5dc74f={'SEC_TO_TIME':_0x4ba3('0x5f'),'DATE':'DATE(%s)','HOUR':_0x4ba3('0x61'),'ROUND':_0x4ba3('0x9d'),'UNIX_TIMESTAMP':'UNIX_TIMESTAMP(%s)'};var _0x1590f0=function(_0x5efab9){return!_[_0x4ba3('0x63')]([_0x4ba3('0x64'),_0x4ba3('0x8b'),'IS\x20EMPTY',_0x4ba3('0x66')],_0x5efab9);};var _0x4d3262=function(_0x4ad4d3){if(!_0x4ad4d3||!_0x4ad4d3[_0x4ba3('0x67')]['length']){return'';}for(var _0x4529a3='(',_0x9b9c64=0x0;_0x9b9c64<_0x4ad4d3[_0x4ba3('0x67')]['length'];_0x9b9c64+=0x1){_0x9b9c64>0x0&&(_0x4529a3+='\x20'+_0x4ad4d3['operator']+'\x20');_0x4529a3+=_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]?_0x4d3262(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x69')]):_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64]['field']+'\x20'+_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')]+(_0x1590f0(_0x4ad4d3[_0x4ba3('0x67')][_0x9b9c64][_0x4ba3('0x6b')])?'\x20'+_0x4ad4d3['rules'][_0x9b9c64][_0x4ba3('0x8c')]:'');}return _0x4529a3+')';};var _0x3073c5={'where':{'id':_0xddfb0c[_0x4ba3('0x49')]['id']}},_0x3d1c11,_0xa41747,_0x25c92c,_0x422a8d,_0x225746;_0x3073c5=_[_0x4ba3('0x43')]({},_0x3073c5,_0xddfb0c[_0x4ba3('0x44')]);return db[_0x4ba3('0x30')]['find'](_0x3073c5)[_0x4ba3('0x26')](function(_0x3db4c2){if(_0x3db4c2){_0x3d1c11=_0x3db4c2;return _0x3db4c2['getFields']();}return null;})[_0x4ba3('0x26')](function(_0x4a8449){if(_0x4a8449){if(!_0x4a8449[_0x4ba3('0x3c')]){throw new db[(_0x4ba3('0x6d'))][(_0x4ba3('0x6e'))](_0x4ba3('0x9e'),0x193);}_0xa41747=_0x4a8449;return db['AnalyticMetric']['findAll']({'raw':!![]});}return null;})[_0x4ba3('0x26')](function(_0xfaf98a){if(_0xfaf98a){_0x25c92c=_['keyBy'](_0xfaf98a,'id');var _0x30c904;var _0x267801=squel[_0x4ba3('0x70')]();_0x267801[_0x4ba3('0x71')](_0x3d1c11['table']);for(var _0x1bae1b=0x0;_0x1bae1b<_0xa41747[_0x4ba3('0x3c')];_0x1bae1b+=0x1){_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x73')]?_0x25c92c[_0xa41747[_0x1bae1b][_0x4ba3('0x73')]]['metric']:_0xa41747[_0x1bae1b][_0x4ba3('0x6a')];_0x30c904=_0xa41747[_0x1bae1b]['function']?_[_0x4ba3('0x76')](_0x2e812b[_0xa41747[_0x1bae1b][_0x4ba3('0x75')]],'%s',_0x30c904):_0x30c904;_0x30c904=_0xa41747[_0x1bae1b][_0x4ba3('0x77')]?_[_0x4ba3('0x76')](_0x5dc74f[_0xa41747[_0x1bae1b]['format']],'%s',_0x30c904):_0x30c904;if(_0xa41747[_0x1bae1b]['groupBy']){_0x267801[_0x4ba3('0x69')](_0x30c904);}_0xa41747[_0x1bae1b][_0x4ba3('0x79')]&&_0x267801[_0x4ba3('0x8d')](_0x30c904,_0xa41747[_0x1bae1b]['orderBy']==='DESC'?![]:!![]);_0x267801[_0x4ba3('0x6a')](_0x30c904,_0xa41747[_0x1bae1b][_0x4ba3('0x7b')]||_0x30c904);}if(_0x3d1c11[_0x4ba3('0x7c')]){_0x3d1c11[_0x4ba3('0x7c')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x7c')]);for(var _0x2f4966=0x0;_0x2f4966<_0x3d1c11[_0x4ba3('0x7c')][_0x4ba3('0x3c')];_0x2f4966+=0x1){if(_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]&&_[_0x4ba3('0x63')](_0x18bd77,_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')])&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x80')]&&_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7f')]){_0x267801[_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x33')]](_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],null,util[_0x4ba3('0x77')](_0x4ba3('0x81'),_0x3d1c11[_0x4ba3('0x72')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966][_0x4ba3('0x7e')],_0x3d1c11[_0x4ba3('0x7c')][_0x2f4966]['foreignTable'],_0x3d1c11['joins'][_0x2f4966][_0x4ba3('0x7f')]));}}}if(_0x3d1c11[_0x4ba3('0x82')]){_0x3d1c11[_0x4ba3('0x82')]=JSON['parse'](_0x3d1c11[_0x4ba3('0x82')]);_0x267801[_0x4ba3('0x40')](_0x4d3262(_0x3d1c11[_0x4ba3('0x82')][_0x4ba3('0x69')]));}_0x225746=_0x267801[_0x4ba3('0x83')]();_0x267801[_0x4ba3('0x1f')](_0x25bf75);_0x267801[_0x4ba3('0x1e')](0x0);logger[_0x4ba3('0x84')](_0x4ba3('0x85'),_0x267801['toString']());return dbH[_0x4ba3('0x87')]['query'](_0x267801['toString'](),{'type':dbH[_0x4ba3('0x87')][_0x4ba3('0x9a')]['SELECT']});}})[_0x4ba3('0x26')](function(){return{'sql':_0x225746[_0x4ba3('0x86')]()};})[_0x4ba3('0x26')](respondWithResult(_0x41c531,null))[_0x4ba3('0x51')](handleError(_0x41c531,null));}; \ No newline at end of file diff --git a/server/api/analyticDefaultReport/analyticDefaultReport.model.js b/server/api/analyticDefaultReport/analyticDefaultReport.model.js index afa420e..c2389b8 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 _0xb94e=['../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','AnalyticDefaultReport','analytics_default_reports','lodash','util'];(function(_0x541a78,_0x219591){var _0x3107f3=function(_0x153053){while(--_0x153053){_0x541a78['push'](_0x541a78['shift']());}};_0x3107f3(++_0x219591);}(_0xb94e,0x1ae));var _0xeb94=function(_0x331dfe,_0x13f0fc){_0x331dfe=_0x331dfe-0x0;var _0x104132=_0xb94e[_0x331dfe];return _0x104132;};'use strict';var _=require(_0xeb94('0x0'));var util=require(_0xeb94('0x1'));var logger=require(_0xeb94('0x2'))(_0xeb94('0x3'));var moment=require(_0xeb94('0x4'));var BPromise=require('bluebird');var rp=require(_0xeb94('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xeb94('0x6'));var config=require(_0xeb94('0x7'));var attributes=require('./analyticDefaultReport.attributes');module[_0xeb94('0x8')]=function(_0xec68b1,_0x4cbaba){return _0xec68b1[_0xeb94('0x9')](_0xeb94('0xa'),attributes,{'tableName':_0xeb94('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7df3=['exports','define','analytics_default_reports','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./analyticDefaultReport.attributes'];(function(_0x33ac17,_0x11fe15){var _0x3f7203=function(_0x2f70b9){while(--_0x2f70b9){_0x33ac17['push'](_0x33ac17['shift']());}};_0x3f7203(++_0x11fe15);}(_0x7df3,0x1ef));var _0x37df=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0x7df3[_0x4154a6];return _0x3b2786;};'use strict';var _=require('lodash');var util=require(_0x37df('0x0'));var logger=require(_0x37df('0x1'))(_0x37df('0x2'));var moment=require(_0x37df('0x3'));var BPromise=require('bluebird');var rp=require(_0x37df('0x4'));var fs=require('fs');var path=require(_0x37df('0x5'));var rimraf=require(_0x37df('0x6'));var config=require(_0x37df('0x7'));var attributes=require(_0x37df('0x8'));module[_0x37df('0x9')]=function(_0x1ea9db,_0x29c895){return _0x1ea9db[_0x37df('0xa')]('AnalyticDefaultReport',attributes,{'tableName':_0x37df('0xb'),'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 473f808..4fee913 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 _0xf124=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','client','http','request','then','info','AnalyticDefaultReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x113a6c,_0x10df30){var _0x1ac632=function(_0xbd4fb9){while(--_0xbd4fb9){_0x113a6c['push'](_0x113a6c['shift']());}};_0x1ac632(++_0x10df30);}(_0xf124,0x98));var _0x4f12=function(_0x4471b3,_0x511a9f){_0x4471b3=_0x4471b3-0x0;var _0x386593=_0xf124[_0x4471b3];return _0x386593;};'use strict';var _=require(_0x4f12('0x0'));var util=require(_0x4f12('0x1'));var moment=require(_0x4f12('0x2'));var BPromise=require(_0x4f12('0x3'));var rs=require(_0x4f12('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4f12('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4f12('0x6'))(_0x4f12('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4f12('0x8')][_0x4f12('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4fca4d,_0xcfe045,_0x5c4fb3){return new BPromise(function(_0x26972d,_0x50284e){return client[_0x4f12('0xa')](_0x4fca4d,_0x5c4fb3)[_0x4f12('0xb')](function(_0xcb39f1){logger[_0x4f12('0xc')](_0x4f12('0xd'),_0xcfe045,_0x4f12('0xe'));logger[_0x4f12('0xf')]('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0xcfe045,_0x4f12('0xe'),JSON[_0x4f12('0x10')](_0xcb39f1));if(_0xcb39f1[_0x4f12('0x11')]){if(_0xcb39f1[_0x4f12('0x11')]['code']===0x1f4){logger[_0x4f12('0x11')](_0x4f12('0xd'),_0xcfe045,_0xcb39f1[_0x4f12('0x11')][_0x4f12('0x12')]);return _0x50284e(_0xcb39f1['error']['message']);}logger['error']('AnalyticDefaultReport,\x20%s,\x20%s',_0xcfe045,_0xcb39f1[_0x4f12('0x11')]['message']);return _0x26972d(_0xcb39f1['error'][_0x4f12('0x12')]);}else{logger[_0x4f12('0xc')](_0x4f12('0xd'),_0xcfe045,_0x4f12('0xe'));_0x26972d(_0xcb39f1[_0x4f12('0x13')]['message']);}})[_0x4f12('0x14')](function(_0x1e0c30){logger[_0x4f12('0x11')](_0x4f12('0xd'),_0xcfe045,_0x1e0c30);_0x50284e(_0x1e0c30);});});} \ No newline at end of file +var _0x1d7c=['../../config/environment','client','http','request','info','request\x20sent','error','AnalyticDefaultReport,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x295811,_0x2825f4){var _0x147146=function(_0x939636){while(--_0x939636){_0x295811['push'](_0x295811['shift']());}};_0x147146(++_0x2825f4);}(_0x1d7c,0x101));var _0xc1d7=function(_0x42167f,_0x36c277){_0x42167f=_0x42167f-0x0;var _0x20f119=_0x1d7c[_0x42167f];return _0x20f119;};'use strict';var _=require(_0xc1d7('0x0'));var util=require(_0xc1d7('0x1'));var moment=require(_0xc1d7('0x2'));var BPromise=require(_0xc1d7('0x3'));var rs=require(_0xc1d7('0x4'));var fs=require('fs');var Redis=require(_0xc1d7('0x5'));var db=require(_0xc1d7('0x6'))['db'];var utils=require(_0xc1d7('0x7'));var logger=require(_0xc1d7('0x8'))('rpc');var config=require(_0xc1d7('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc1d7('0xa')][_0xc1d7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x9f83bc,_0x3883f6,_0x4ae70a){return new BPromise(function(_0x4d14da,_0x49a948){return client[_0xc1d7('0xc')](_0x9f83bc,_0x4ae70a)['then'](function(_0x6b8a89){logger[_0xc1d7('0xd')]('AnalyticDefaultReport,\x20%s,\x20%s',_0x3883f6,'request\x20sent');logger['debug']('AnalyticDefaultReport,\x20%s,\x20%s,\x20%s',_0x3883f6,_0xc1d7('0xe'),JSON['stringify'](_0x6b8a89));if(_0x6b8a89[_0xc1d7('0xf')]){if(_0x6b8a89[_0xc1d7('0xf')]['code']===0x1f4){logger['error'](_0xc1d7('0x10'),_0x3883f6,_0x6b8a89[_0xc1d7('0xf')][_0xc1d7('0x11')]);return _0x49a948(_0x6b8a89['error'][_0xc1d7('0x11')]);}logger[_0xc1d7('0xf')](_0xc1d7('0x10'),_0x3883f6,_0x6b8a89['error'][_0xc1d7('0x11')]);return _0x4d14da(_0x6b8a89['error'][_0xc1d7('0x11')]);}else{logger[_0xc1d7('0xd')](_0xc1d7('0x10'),_0x3883f6,_0xc1d7('0xe'));_0x4d14da(_0x6b8a89[_0xc1d7('0x12')][_0xc1d7('0x11')]);}})['catch'](function(_0x4dc5cb){logger['error'](_0xc1d7('0x10'),_0x3883f6,_0x4dc5cb);_0x49a948(_0x4dc5cb);});});} \ No newline at end of file diff --git a/server/api/analyticDefaultReport/index.js b/server/api/analyticDefaultReport/index.js index bb45aba..f88f8fc 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 _0x27fa=['Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticDefaultReport.controller','get','isAuthenticated','/:id','show','preview','run','/:id/query','query','post','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x29771f,_0x1189ae){var _0x279baf=function(_0xd66325){while(--_0xd66325){_0x29771f['push'](_0x29771f['shift']());}};_0x279baf(++_0x1189ae);}(_0x27fa,0x1c3));var _0xa27f=function(_0x349983,_0x108690){_0x349983=_0x349983-0x0;var _0x2277cb=_0x27fa[_0x349983];return _0x2277cb;};'use strict';var multer=require(_0xa27f('0x0'));var util=require(_0xa27f('0x1'));var path=require(_0xa27f('0x2'));var timeout=require(_0xa27f('0x3'));var express=require(_0xa27f('0x4'));var router=express[_0xa27f('0x5')]();var fs_extra=require(_0xa27f('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xa27f('0x7'));var config=require(_0xa27f('0x8'));var controller=require(_0xa27f('0x9'));router[_0xa27f('0xa')]('/',auth[_0xa27f('0xb')](),controller['index']);router[_0xa27f('0xa')](_0xa27f('0xc'),auth[_0xa27f('0xb')](),controller[_0xa27f('0xd')]);router[_0xa27f('0xa')]('/:id/preview',auth[_0xa27f('0xb')](),controller[_0xa27f('0xe')]);router[_0xa27f('0xa')]('/:id/run',auth[_0xa27f('0xb')](),controller[_0xa27f('0xf')]);router['get'](_0xa27f('0x10'),auth['isAuthenticated'](),controller[_0xa27f('0x11')]);router[_0xa27f('0x12')]('/',auth[_0xa27f('0xb')](),controller['create']);router[_0xa27f('0x13')](_0xa27f('0xc'),auth[_0xa27f('0xb')](),controller[_0xa27f('0x14')]);router[_0xa27f('0x15')](_0xa27f('0xc'),auth['isAuthenticated'](),controller[_0xa27f('0x16')]);module[_0xa27f('0x17')]=router; \ No newline at end of file +var _0x23ce=['/:id/preview','preview','/:id/run','query','post','delete','destroy','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show'];(function(_0x53a231,_0x11303a){var _0x5b69b0=function(_0x23862c){while(--_0x23862c){_0x53a231['push'](_0x53a231['shift']());}};_0x5b69b0(++_0x11303a);}(_0x23ce,0x1e2));var _0xe23c=function(_0x1d2128,_0x52ed41){_0x1d2128=_0x1d2128-0x0;var _0x98cc02=_0x23ce[_0x1d2128];return _0x98cc02;};'use strict';var multer=require(_0xe23c('0x0'));var util=require(_0xe23c('0x1'));var path=require('path');var timeout=require(_0xe23c('0x2'));var express=require(_0xe23c('0x3'));var router=express['Router']();var fs_extra=require(_0xe23c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xe23c('0x5'));var config=require(_0xe23c('0x6'));var controller=require('./analyticDefaultReport.controller');router[_0xe23c('0x7')]('/',auth[_0xe23c('0x8')](),controller[_0xe23c('0x9')]);router[_0xe23c('0x7')](_0xe23c('0xa'),auth[_0xe23c('0x8')](),controller[_0xe23c('0xb')]);router[_0xe23c('0x7')](_0xe23c('0xc'),auth[_0xe23c('0x8')](),controller[_0xe23c('0xd')]);router[_0xe23c('0x7')](_0xe23c('0xe'),auth['isAuthenticated'](),controller['run']);router[_0xe23c('0x7')]('/:id/query',auth['isAuthenticated'](),controller[_0xe23c('0xf')]);router[_0xe23c('0x10')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xe23c('0xa'),auth[_0xe23c('0x8')](),controller['update']);router[_0xe23c('0x11')](_0xe23c('0xa'),auth[_0xe23c('0x8')](),controller[_0xe23c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js b/server/api/analyticExtractedReport/analyticExtractedReport.attributes.js index a122fff..6b3d10b 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 _0x3d34=['xlsx','DATE','Loading','manual','scheduled','INTEGER','sequelize','moment','STRING','ENUM','csv','pdf'];(function(_0x3f62b4,_0x3bfcec){var _0x2668d6=function(_0x245070){while(--_0x245070){_0x3f62b4['push'](_0x3f62b4['shift']());}};_0x2668d6(++_0x3bfcec);}(_0x3d34,0xa2));var _0x43d3=function(_0x749614,_0x9c4b56){_0x749614=_0x749614-0x0;var _0x4cacdf=_0x3d34[_0x749614];return _0x4cacdf;};'use strict';var Sequelize=require(_0x43d3('0x0'));var moment=require(_0x43d3('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'basename':{'type':Sequelize[_0x43d3('0x2')],'allowNull':![]},'output':{'type':Sequelize[_0x43d3('0x3')](_0x43d3('0x4'),_0x43d3('0x5'),_0x43d3('0x6')),'allowNull':![],'defaultValue':_0x43d3('0x4')},'savename':{'type':Sequelize[_0x43d3('0x2')],'allowNull':![]},'startDate':{'type':Sequelize[_0x43d3('0x7')]},'endDate':{'type':Sequelize[_0x43d3('0x7')]},'status':{'type':Sequelize[_0x43d3('0x2')],'defaultValue':_0x43d3('0x8')},'type':{'type':Sequelize[_0x43d3('0x3')](_0x43d3('0x9'),_0x43d3('0xa')),'allowNull':![],'defaultValue':_0x43d3('0x9')},'reportId':{'type':Sequelize[_0x43d3('0xb')](0xb)['UNSIGNED']},'reportType':{'type':Sequelize[_0x43d3('0x2')]}}; \ No newline at end of file +var _0x03bf=['sequelize','moment','exports','STRING','ENUM','csv','pdf','xlsx','DATE','Loading','manual'];(function(_0x120ab6,_0x65fbd6){var _0x4ab62f=function(_0x13d64c){while(--_0x13d64c){_0x120ab6['push'](_0x120ab6['shift']());}};_0x4ab62f(++_0x65fbd6);}(_0x03bf,0xdc));var _0xf03b=function(_0x5cd8b1,_0x489d74){_0x5cd8b1=_0x5cd8b1-0x0;var _0x365e56=_0x03bf[_0x5cd8b1];return _0x365e56;};'use strict';var Sequelize=require(_0xf03b('0x0'));var moment=require(_0xf03b('0x1'));module[_0xf03b('0x2')]={'name':{'type':Sequelize[_0xf03b('0x3')],'allowNull':![]},'basename':{'type':Sequelize[_0xf03b('0x3')],'allowNull':![]},'output':{'type':Sequelize[_0xf03b('0x4')](_0xf03b('0x5'),_0xf03b('0x6'),_0xf03b('0x7')),'allowNull':![],'defaultValue':_0xf03b('0x5')},'savename':{'type':Sequelize[_0xf03b('0x3')],'allowNull':![]},'startDate':{'type':Sequelize[_0xf03b('0x8')]},'endDate':{'type':Sequelize['DATE']},'status':{'type':Sequelize['STRING'],'defaultValue':_0xf03b('0x9')},'type':{'type':Sequelize[_0xf03b('0x4')](_0xf03b('0xa'),'scheduled'),'allowNull':![],'defaultValue':_0xf03b('0xa')},'reportId':{'type':Sequelize['INTEGER'](0xb)['UNSIGNED']},'reportType':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.controller.js b/server/api/analyticExtractedReport/analyticExtractedReport.controller.js index 499135c..7e8628c 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 _0xc738=['%s.%s','toLowerCase','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','get','ExtractedReports','sendStatus','error','stack','name','send','index','map','AnalyticExtractedReport','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','length','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','body','download','basename','savename','output','existsSync','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','join','format'];(function(_0x2c37b2,_0x107055){var _0x559312=function(_0x53e3d3){while(--_0x53e3d3){_0x2c37b2['push'](_0x2c37b2['shift']());}};_0x559312(++_0x107055);}(_0xc738,0x69));var _0x8c73=function(_0x2e50a2,_0x27f31e){_0x2e50a2=_0x2e50a2-0x0;var _0x47e5de=_0xc738[_0x2e50a2];return _0x47e5de;};'use strict';var emlformat=require(_0x8c73('0x0'));var rimraf=require(_0x8c73('0x1'));var zipdir=require(_0x8c73('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8c73('0x3'));var moment=require(_0x8c73('0x4'));var BPromise=require(_0x8c73('0x5'));var Mustache=require(_0x8c73('0x6'));var util=require(_0x8c73('0x7'));var path=require(_0x8c73('0x8'));var sox=require(_0x8c73('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8c73('0xa'));var _=require('lodash');var squel=require(_0x8c73('0xb'));var crypto=require(_0x8c73('0xc'));var jsforce=require(_0x8c73('0xd'));var deskjs=require(_0x8c73('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8c73('0xf'));var Papa=require(_0x8c73('0x10'));var Redis=require(_0x8c73('0x11'));var authService=require(_0x8c73('0x12'));var qs=require(_0x8c73('0x13'));var as=require(_0x8c73('0x14'));var hardwareService=require(_0x8c73('0x15'));var logger=require(_0x8c73('0x16'))(_0x8c73('0x17'));var utils=require(_0x8c73('0x18'));var config=require(_0x8c73('0x19'));var licenseUtil=require(_0x8c73('0x1a'));var db=require(_0x8c73('0x1b'))['db'];function respondWithStatusCode(_0xce8162,_0x4035ee){_0x4035ee=_0x4035ee||0xcc;return function(_0x15d950){if(_0x15d950){return _0xce8162['sendStatus'](_0x4035ee);}return _0xce8162[_0x8c73('0x1c')](_0x4035ee)[_0x8c73('0x1d')]();};}function respondWithResult(_0x437167,_0x5cf4e2){_0x5cf4e2=_0x5cf4e2||0xc8;return function(_0x1d7a39){if(_0x1d7a39){return _0x437167[_0x8c73('0x1c')](_0x5cf4e2)[_0x8c73('0x1e')](_0x1d7a39);}};}function respondWithFilteredResult(_0x38c537,_0x1ce25d){return function(_0x3cf092){if(_0x3cf092){var _0x3673b5=typeof _0x1ce25d[_0x8c73('0x1f')]==='undefined'&&typeof _0x1ce25d[_0x8c73('0x20')]===_0x8c73('0x21');var _0x262dac=_0x3cf092['count'];var _0x3550e4=_0x3673b5?0x0:_0x1ce25d['offset'];var _0x169349=_0x3673b5?_0x3cf092[_0x8c73('0x22')]:_0x1ce25d[_0x8c73('0x1f')]+_0x1ce25d['limit'];var _0x14e57b;if(_0x169349>=_0x262dac){_0x169349=_0x262dac;_0x14e57b=0xc8;}else{_0x14e57b=0xce;}_0x38c537['status'](_0x14e57b);return _0x38c537[_0x8c73('0x23')](_0x8c73('0x24'),_0x3550e4+'-'+_0x169349+'/'+_0x262dac)['json'](_0x3cf092);}return null;};}function patchUpdates(_0x3b188b){return function(_0x22bfe8){try{jsonpatch[_0x8c73('0x25')](_0x22bfe8,_0x3b188b,!![]);}catch(_0x4c7dea){return BPromise[_0x8c73('0x26')](_0x4c7dea);}return _0x22bfe8[_0x8c73('0x27')]();};}function saveUpdates(_0x34153c,_0xcde10c){return function(_0xd3d6a4){if(_0xd3d6a4){return _0xd3d6a4[_0x8c73('0x28')](_0x34153c)['then'](function(_0x331673){return _0x331673;});}return null;};}function removeEntity(_0x6f5d62,_0x25fb4d){return function(_0x3dab72){if(_0x3dab72){return _0x3dab72[_0x8c73('0x29')]()[_0x8c73('0x2a')](function(){var _0x405d5f=_0x3dab72[_0x8c73('0x2b')]({'plain':!![]});var _0x3c2da1=_0x8c73('0x2c');return db['UserProfileResource']['destroy']({'where':{'type':_0x3c2da1,'resourceId':_0x405d5f['id']}})[_0x8c73('0x2a')](function(){return _0x3dab72;});})['then'](function(){_0x6f5d62['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x30a84d,_0x1a5ead){return function(_0x529f82){if(!_0x529f82){_0x30a84d[_0x8c73('0x2d')](0x194);}return _0x529f82;};}function handleError(_0x1f2795,_0x591973){_0x591973=_0x591973||0x1f4;return function(_0xfa830b){logger[_0x8c73('0x2e')](_0xfa830b[_0x8c73('0x2f')]);if(_0xfa830b[_0x8c73('0x30')]){delete _0xfa830b[_0x8c73('0x30')];}_0x1f2795[_0x8c73('0x1c')](_0x591973)[_0x8c73('0x31')](_0xfa830b);};}exports[_0x8c73('0x32')]=function(_0x419a48,_0xd81dbd){var _0x4d09fb={},_0x28a731={},_0x36b2d8={'count':0x0,'rows':[]};var _0xbfe6ea=_[_0x8c73('0x33')](db[_0x8c73('0x34')][_0x8c73('0x35')],function(_0x451123){return{'name':_0x451123[_0x8c73('0x36')],'type':_0x451123[_0x8c73('0x37')]['key']};});_0x28a731[_0x8c73('0x38')]=_[_0x8c73('0x33')](_0xbfe6ea,_0x8c73('0x30'));_0x28a731[_0x8c73('0x39')]=_[_0x8c73('0x3a')](_0x419a48['query']);_0x28a731[_0x8c73('0x3b')]=_[_0x8c73('0x3c')](_0x28a731['model'],_0x28a731[_0x8c73('0x39')]);_0x4d09fb[_0x8c73('0x3d')]=_[_0x8c73('0x3c')](_0x28a731[_0x8c73('0x38')],qs[_0x8c73('0x3e')](_0x419a48['query'][_0x8c73('0x3e')]));_0x4d09fb[_0x8c73('0x3d')]=_0x4d09fb[_0x8c73('0x3d')]['length']?_0x4d09fb['attributes']:_0x28a731[_0x8c73('0x38')];if(!_0x419a48['query'][_0x8c73('0x3f')](_0x8c73('0x40'))){_0x4d09fb[_0x8c73('0x20')]=qs[_0x8c73('0x20')](_0x419a48[_0x8c73('0x39')]['limit']);_0x4d09fb['offset']=qs[_0x8c73('0x1f')](_0x419a48[_0x8c73('0x39')]['offset']);}_0x4d09fb[_0x8c73('0x41')]=qs[_0x8c73('0x42')](_0x419a48[_0x8c73('0x39')]['sort']);_0x4d09fb['where']=qs['filters'](_[_0x8c73('0x43')](_0x419a48[_0x8c73('0x39')],_0x28a731[_0x8c73('0x3b')]),_0xbfe6ea);if(_0x419a48[_0x8c73('0x39')][_0x8c73('0x44')]){_0x4d09fb[_0x8c73('0x45')]=_[_0x8c73('0x46')](_0x4d09fb['where'],{'$or':_[_0x8c73('0x33')](_0xbfe6ea,function(_0xe5d5e4){if(_0xe5d5e4[_0x8c73('0x37')]!==_0x8c73('0x47')){var _0x3f47dd={};_0x3f47dd[_0xe5d5e4[_0x8c73('0x30')]]={'$like':'%'+_0x419a48['query'][_0x8c73('0x44')]+'%'};return _0x3f47dd;}})});}_0x4d09fb=_[_0x8c73('0x46')]({},_0x4d09fb,_0x419a48[_0x8c73('0x48')]);var _0x13d776={'where':_0x4d09fb[_0x8c73('0x45')]};return db['AnalyticExtractedReport']['count'](_0x13d776)[_0x8c73('0x2a')](function(_0x4a4a72){_0x36b2d8[_0x8c73('0x22')]=_0x4a4a72;if(_0x419a48[_0x8c73('0x39')][_0x8c73('0x49')]){_0x4d09fb[_0x8c73('0x4a')]=[{'all':!![]}];}return db['AnalyticExtractedReport'][_0x8c73('0x4b')](_0x4d09fb);})[_0x8c73('0x2a')](function(_0x3a1a31){_0x36b2d8['rows']=_0x3a1a31;return _0x36b2d8;})[_0x8c73('0x2a')](respondWithFilteredResult(_0xd81dbd,_0x4d09fb))[_0x8c73('0x4c')](handleError(_0xd81dbd,null));};exports['show']=function(_0x4dd1fa,_0x45c1e7){var _0x413bf7={'raw':!![],'where':{'id':_0x4dd1fa[_0x8c73('0x4d')]['id']}},_0x337fe3={};_0x337fe3[_0x8c73('0x38')]=_[_0x8c73('0x3a')](db[_0x8c73('0x34')]['rawAttributes']);_0x337fe3[_0x8c73('0x39')]=_[_0x8c73('0x3a')](_0x4dd1fa[_0x8c73('0x39')]);_0x337fe3[_0x8c73('0x3b')]=_[_0x8c73('0x3c')](_0x337fe3[_0x8c73('0x38')],_0x337fe3[_0x8c73('0x39')]);_0x413bf7['attributes']=_['intersection'](_0x337fe3[_0x8c73('0x38')],qs['fields'](_0x4dd1fa[_0x8c73('0x39')][_0x8c73('0x3e')]));_0x413bf7[_0x8c73('0x3d')]=_0x413bf7[_0x8c73('0x3d')][_0x8c73('0x4e')]?_0x413bf7[_0x8c73('0x3d')]:_0x337fe3[_0x8c73('0x38')];if(_0x4dd1fa['query'][_0x8c73('0x49')]){_0x413bf7[_0x8c73('0x4a')]=[{'all':!![]}];}_0x413bf7=_[_0x8c73('0x46')]({},_0x413bf7,_0x4dd1fa['options']);return db[_0x8c73('0x34')][_0x8c73('0x4f')](_0x413bf7)[_0x8c73('0x2a')](handleEntityNotFound(_0x45c1e7,null))['then'](respondWithResult(_0x45c1e7,null))[_0x8c73('0x4c')](handleError(_0x45c1e7,null));};exports[_0x8c73('0x50')]=function(_0x28f29d,_0xe852d1){return db[_0x8c73('0x34')][_0x8c73('0x50')](_0x28f29d['body'],{})['then'](function(_0x43a4ad){var _0xda6931=_0x28f29d[_0x8c73('0x51')][_0x8c73('0x2b')]({'plain':!![]});if(!_0xda6931)throw new Error(_0x8c73('0x52'));if(_0xda6931[_0x8c73('0x53')]===_0x8c73('0x51')){var _0x16ee93=_0x43a4ad[_0x8c73('0x2b')]({'plain':!![]});var _0x52c806=_0x8c73('0x2c');return db[_0x8c73('0x54')][_0x8c73('0x4f')]({'where':{'name':_0x52c806,'userProfileId':_0xda6931[_0x8c73('0x55')]},'raw':!![]})[_0x8c73('0x2a')](function(_0x5c1a84){if(_0x5c1a84&&_0x5c1a84['autoAssociation']===0x0){return db[_0x8c73('0x56')][_0x8c73('0x50')]({'name':_0x16ee93[_0x8c73('0x30')],'resourceId':_0x16ee93['id'],'type':_0x5c1a84[_0x8c73('0x30')],'sectionId':_0x5c1a84['id']},{})[_0x8c73('0x2a')](function(){return _0x43a4ad;});}else{return _0x43a4ad;}})['catch'](function(_0x1e3043){logger[_0x8c73('0x2e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1e3043);throw _0x1e3043;});}return _0x43a4ad;})['then'](respondWithResult(_0xe852d1,0xc9))['catch'](handleError(_0xe852d1,null));};exports[_0x8c73('0x28')]=function(_0x13ba7d,_0x459f1f){if(_0x13ba7d[_0x8c73('0x57')]['id']){delete _0x13ba7d['body']['id'];}return db[_0x8c73('0x34')][_0x8c73('0x4f')]({'where':{'id':_0x13ba7d['params']['id']}})['then'](handleEntityNotFound(_0x459f1f,null))[_0x8c73('0x2a')](saveUpdates(_0x13ba7d[_0x8c73('0x57')],null))[_0x8c73('0x2a')](respondWithResult(_0x459f1f,null))[_0x8c73('0x4c')](handleError(_0x459f1f,null));};exports[_0x8c73('0x29')]=function(_0x4b09d8,_0x118aa1){return db[_0x8c73('0x34')][_0x8c73('0x4f')]({'where':{'id':_0x4b09d8[_0x8c73('0x4d')]['id']}})['then'](handleEntityNotFound(_0x118aa1,null))[_0x8c73('0x2a')](removeEntity(_0x118aa1,null))[_0x8c73('0x4c')](handleError(_0x118aa1,null));};exports[_0x8c73('0x58')]=function(_0x20f2f6,_0x34b2de,_0x3e37cd){return db[_0x8c73('0x34')][_0x8c73('0x4f')]({'where':{'id':_0x20f2f6['params']['id']},'attributes':[_0x8c73('0x30'),_0x8c73('0x59'),_0x8c73('0x5a'),_0x8c73('0x5b')],'raw':!![]})[_0x8c73('0x2a')](handleEntityNotFound(_0x34b2de,null))[_0x8c73('0x2a')](function(_0x52f061){if(_0x52f061){if(!fs[_0x8c73('0x5c')](path['join'](config[_0x8c73('0x5d')],_0x8c73('0x5e'),_0x52f061['savename']))){throw new db[(_0x8c73('0x5f'))][(_0x8c73('0x60'))](_0x8c73('0x61'));}if(_0x20f2f6[_0x8c73('0x39')][_0x8c73('0x62')]){return _0x34b2de[_0x8c73('0x2d')](0xc8);}return _0x34b2de['download'](path[_0x8c73('0x63')](config['root'],_0x8c73('0x5e'),_0x52f061[_0x8c73('0x5a')]),util[_0x8c73('0x64')](_0x8c73('0x65'),_0x52f061[_0x8c73('0x59')]||_0x52f061[_0x8c73('0x30')],_0x52f061[_0x8c73('0x5b')][_0x8c73('0x66')]()));}})[_0x8c73('0x4c')](handleError(_0x34b2de,null));}; \ No newline at end of file +var _0xc2a2=['fast-json-patch','request-promise','moment','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','get','ExtractedReports','UserProfileResource','destroy','error','stack','name','send','map','AnalyticExtractedReport','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','keys','rawAttributes','include','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','basename','savename','output','existsSync','join','root','server/files/reports','Sequelize','ValidationError','Report\x20not\x20found\x20or\x20empty','exists','toLowerCase','eml-format','zip-dir'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc2a2,0x1e3));var _0x2c2a=function(_0x1655ba,_0x305a62){_0x1655ba=_0x1655ba-0x0;var _0x2571a9=_0xc2a2[_0x1655ba];return _0x2571a9;};'use strict';var emlformat=require(_0x2c2a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2c2a('0x1'));var jsonpatch=require(_0x2c2a('0x2'));var rp=require(_0x2c2a('0x3'));var moment=require(_0x2c2a('0x4'));var BPromise=require(_0x2c2a('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x2c2a('0x6'));var sox=require('sox');var csv=require(_0x2c2a('0x7'));var ejs=require(_0x2c2a('0x8'));var fs=require('fs');var fs_extra=require(_0x2c2a('0x9'));var _=require(_0x2c2a('0xa'));var squel=require(_0x2c2a('0xb'));var crypto=require(_0x2c2a('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x2c2a('0xd'));var toCsv=require(_0x2c2a('0x7'));var querystring=require(_0x2c2a('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x2c2a('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2c2a('0x10'));var hardwareService=require(_0x2c2a('0x11'));var logger=require('../../config/logger')(_0x2c2a('0x12'));var utils=require(_0x2c2a('0x13'));var config=require(_0x2c2a('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x2c2a('0x15'))['db'];function respondWithStatusCode(_0x5381b7,_0x529064){_0x529064=_0x529064||0xcc;return function(_0x1386e9){if(_0x1386e9){return _0x5381b7[_0x2c2a('0x16')](_0x529064);}return _0x5381b7[_0x2c2a('0x17')](_0x529064)[_0x2c2a('0x18')]();};}function respondWithResult(_0xaa319d,_0x28117a){_0x28117a=_0x28117a||0xc8;return function(_0x39d42e){if(_0x39d42e){return _0xaa319d[_0x2c2a('0x17')](_0x28117a)['json'](_0x39d42e);}};}function respondWithFilteredResult(_0x3215aa,_0x5dc1a2){return function(_0x2fdc77){if(_0x2fdc77){var _0x4bc219=typeof _0x5dc1a2[_0x2c2a('0x19')]===_0x2c2a('0x1a')&&typeof _0x5dc1a2[_0x2c2a('0x1b')]===_0x2c2a('0x1a');var _0x4bafba=_0x2fdc77['count'];var _0x492c40=_0x4bc219?0x0:_0x5dc1a2[_0x2c2a('0x19')];var _0x47974d=_0x4bc219?_0x2fdc77[_0x2c2a('0x1c')]:_0x5dc1a2[_0x2c2a('0x19')]+_0x5dc1a2[_0x2c2a('0x1b')];var _0x43d706;if(_0x47974d>=_0x4bafba){_0x47974d=_0x4bafba;_0x43d706=0xc8;}else{_0x43d706=0xce;}_0x3215aa[_0x2c2a('0x17')](_0x43d706);return _0x3215aa[_0x2c2a('0x1d')](_0x2c2a('0x1e'),_0x492c40+'-'+_0x47974d+'/'+_0x4bafba)[_0x2c2a('0x1f')](_0x2fdc77);}return null;};}function patchUpdates(_0x3a3848){return function(_0x875807){try{jsonpatch[_0x2c2a('0x20')](_0x875807,_0x3a3848,!![]);}catch(_0x1404ec){return BPromise[_0x2c2a('0x21')](_0x1404ec);}return _0x875807[_0x2c2a('0x22')]();};}function saveUpdates(_0x4fe707,_0x42cd0e){return function(_0x134c59){if(_0x134c59){return _0x134c59[_0x2c2a('0x23')](_0x4fe707)[_0x2c2a('0x24')](function(_0x8845f9){return _0x8845f9;});}return null;};}function removeEntity(_0x41e4ee,_0x5f3738){return function(_0x5094f1){if(_0x5094f1){return _0x5094f1['destroy']()[_0x2c2a('0x24')](function(){var _0x538bbb=_0x5094f1[_0x2c2a('0x25')]({'plain':!![]});var _0x35dccc=_0x2c2a('0x26');return db[_0x2c2a('0x27')][_0x2c2a('0x28')]({'where':{'type':_0x35dccc,'resourceId':_0x538bbb['id']}})['then'](function(){return _0x5094f1;});})[_0x2c2a('0x24')](function(){_0x41e4ee[_0x2c2a('0x17')](0xcc)[_0x2c2a('0x18')]();});}};}function handleEntityNotFound(_0x2a056a,_0x191e64){return function(_0xa99bd2){if(!_0xa99bd2){_0x2a056a[_0x2c2a('0x16')](0x194);}return _0xa99bd2;};}function handleError(_0x14ccb4,_0x3187b0){_0x3187b0=_0x3187b0||0x1f4;return function(_0x4e6fb3){logger[_0x2c2a('0x29')](_0x4e6fb3[_0x2c2a('0x2a')]);if(_0x4e6fb3[_0x2c2a('0x2b')]){delete _0x4e6fb3['name'];}_0x14ccb4[_0x2c2a('0x17')](_0x3187b0)[_0x2c2a('0x2c')](_0x4e6fb3);};}exports['index']=function(_0x3469dc,_0x2eca97){var _0x5d18af={},_0x4eea88={},_0x4cc126={'count':0x0,'rows':[]};var _0x5e2b84=_[_0x2c2a('0x2d')](db[_0x2c2a('0x2e')]['rawAttributes'],function(_0x503ef9){return{'name':_0x503ef9['fieldName'],'type':_0x503ef9[_0x2c2a('0x2f')][_0x2c2a('0x30')]};});_0x4eea88[_0x2c2a('0x31')]=_['map'](_0x5e2b84,_0x2c2a('0x2b'));_0x4eea88['query']=_['keys'](_0x3469dc[_0x2c2a('0x32')]);_0x4eea88[_0x2c2a('0x33')]=_[_0x2c2a('0x34')](_0x4eea88[_0x2c2a('0x31')],_0x4eea88['query']);_0x5d18af[_0x2c2a('0x35')]=_[_0x2c2a('0x34')](_0x4eea88[_0x2c2a('0x31')],qs['fields'](_0x3469dc['query'][_0x2c2a('0x36')]));_0x5d18af[_0x2c2a('0x35')]=_0x5d18af[_0x2c2a('0x35')][_0x2c2a('0x37')]?_0x5d18af[_0x2c2a('0x35')]:_0x4eea88[_0x2c2a('0x31')];if(!_0x3469dc[_0x2c2a('0x32')][_0x2c2a('0x38')](_0x2c2a('0x39'))){_0x5d18af['limit']=qs[_0x2c2a('0x1b')](_0x3469dc[_0x2c2a('0x32')][_0x2c2a('0x1b')]);_0x5d18af[_0x2c2a('0x19')]=qs[_0x2c2a('0x19')](_0x3469dc[_0x2c2a('0x32')][_0x2c2a('0x19')]);}_0x5d18af[_0x2c2a('0x3a')]=qs[_0x2c2a('0x3b')](_0x3469dc[_0x2c2a('0x32')][_0x2c2a('0x3b')]);_0x5d18af[_0x2c2a('0x3c')]=qs[_0x2c2a('0x33')](_[_0x2c2a('0x3d')](_0x3469dc[_0x2c2a('0x32')],_0x4eea88['filters']),_0x5e2b84);if(_0x3469dc[_0x2c2a('0x32')][_0x2c2a('0x3e')]){_0x5d18af[_0x2c2a('0x3c')]=_[_0x2c2a('0x3f')](_0x5d18af['where'],{'$or':_[_0x2c2a('0x2d')](_0x5e2b84,function(_0x340a82){if(_0x340a82[_0x2c2a('0x2f')]!==_0x2c2a('0x40')){var _0x45651b={};_0x45651b[_0x340a82[_0x2c2a('0x2b')]]={'$like':'%'+_0x3469dc[_0x2c2a('0x32')][_0x2c2a('0x3e')]+'%'};return _0x45651b;}})});}_0x5d18af=_[_0x2c2a('0x3f')]({},_0x5d18af,_0x3469dc[_0x2c2a('0x41')]);var _0xc1e43c={'where':_0x5d18af[_0x2c2a('0x3c')]};return db[_0x2c2a('0x2e')][_0x2c2a('0x1c')](_0xc1e43c)['then'](function(_0x557a01){_0x4cc126[_0x2c2a('0x1c')]=_0x557a01;if(_0x3469dc[_0x2c2a('0x32')][_0x2c2a('0x42')]){_0x5d18af['include']=[{'all':!![]}];}return db[_0x2c2a('0x2e')][_0x2c2a('0x43')](_0x5d18af);})['then'](function(_0x4bc4ed){_0x4cc126[_0x2c2a('0x44')]=_0x4bc4ed;return _0x4cc126;})[_0x2c2a('0x24')](respondWithFilteredResult(_0x2eca97,_0x5d18af))[_0x2c2a('0x45')](handleError(_0x2eca97,null));};exports[_0x2c2a('0x46')]=function(_0x1a9c6c,_0x2dd3e2){var _0x4f2502={'raw':!![],'where':{'id':_0x1a9c6c[_0x2c2a('0x47')]['id']}},_0x1bbb69={};_0x1bbb69['model']=_[_0x2c2a('0x48')](db[_0x2c2a('0x2e')][_0x2c2a('0x49')]);_0x1bbb69[_0x2c2a('0x32')]=_['keys'](_0x1a9c6c['query']);_0x1bbb69[_0x2c2a('0x33')]=_[_0x2c2a('0x34')](_0x1bbb69[_0x2c2a('0x31')],_0x1bbb69[_0x2c2a('0x32')]);_0x4f2502[_0x2c2a('0x35')]=_['intersection'](_0x1bbb69[_0x2c2a('0x31')],qs[_0x2c2a('0x36')](_0x1a9c6c[_0x2c2a('0x32')]['fields']));_0x4f2502[_0x2c2a('0x35')]=_0x4f2502[_0x2c2a('0x35')][_0x2c2a('0x37')]?_0x4f2502['attributes']:_0x1bbb69[_0x2c2a('0x31')];if(_0x1a9c6c[_0x2c2a('0x32')][_0x2c2a('0x42')]){_0x4f2502[_0x2c2a('0x4a')]=[{'all':!![]}];}_0x4f2502=_['merge']({},_0x4f2502,_0x1a9c6c[_0x2c2a('0x41')]);return db[_0x2c2a('0x2e')][_0x2c2a('0x4b')](_0x4f2502)[_0x2c2a('0x24')](handleEntityNotFound(_0x2dd3e2,null))[_0x2c2a('0x24')](respondWithResult(_0x2dd3e2,null))['catch'](handleError(_0x2dd3e2,null));};exports[_0x2c2a('0x4c')]=function(_0x21262f,_0x15d917){return db[_0x2c2a('0x2e')][_0x2c2a('0x4c')](_0x21262f[_0x2c2a('0x4d')],{})[_0x2c2a('0x24')](function(_0x49e7da){var _0x149dab=_0x21262f[_0x2c2a('0x4e')][_0x2c2a('0x25')]({'plain':!![]});if(!_0x149dab)throw new Error(_0x2c2a('0x4f'));if(_0x149dab[_0x2c2a('0x50')]===_0x2c2a('0x4e')){var _0x5a25b8=_0x49e7da['get']({'plain':!![]});var _0x11e40a=_0x2c2a('0x26');return db[_0x2c2a('0x51')][_0x2c2a('0x4b')]({'where':{'name':_0x11e40a,'userProfileId':_0x149dab[_0x2c2a('0x52')]},'raw':!![]})[_0x2c2a('0x24')](function(_0x28c9f5){if(_0x28c9f5&&_0x28c9f5[_0x2c2a('0x53')]===0x0){return db[_0x2c2a('0x27')][_0x2c2a('0x4c')]({'name':_0x5a25b8['name'],'resourceId':_0x5a25b8['id'],'type':_0x28c9f5[_0x2c2a('0x2b')],'sectionId':_0x28c9f5['id']},{})[_0x2c2a('0x24')](function(){return _0x49e7da;});}else{return _0x49e7da;}})[_0x2c2a('0x45')](function(_0x411bd6){logger[_0x2c2a('0x29')](_0x2c2a('0x54'),_0x411bd6);throw _0x411bd6;});}return _0x49e7da;})[_0x2c2a('0x24')](respondWithResult(_0x15d917,0xc9))[_0x2c2a('0x45')](handleError(_0x15d917,null));};exports[_0x2c2a('0x23')]=function(_0x210b27,_0x296417){if(_0x210b27['body']['id']){delete _0x210b27['body']['id'];}return db[_0x2c2a('0x2e')][_0x2c2a('0x4b')]({'where':{'id':_0x210b27['params']['id']}})['then'](handleEntityNotFound(_0x296417,null))[_0x2c2a('0x24')](saveUpdates(_0x210b27[_0x2c2a('0x4d')],null))[_0x2c2a('0x24')](respondWithResult(_0x296417,null))['catch'](handleError(_0x296417,null));};exports[_0x2c2a('0x28')]=function(_0x9ff4f4,_0x1c45db){return db[_0x2c2a('0x2e')]['find']({'where':{'id':_0x9ff4f4[_0x2c2a('0x47')]['id']}})[_0x2c2a('0x24')](handleEntityNotFound(_0x1c45db,null))[_0x2c2a('0x24')](removeEntity(_0x1c45db,null))[_0x2c2a('0x45')](handleError(_0x1c45db,null));};exports['download']=function(_0x2a70d0,_0x558f3f,_0x203c72){return db['AnalyticExtractedReport'][_0x2c2a('0x4b')]({'where':{'id':_0x2a70d0[_0x2c2a('0x47')]['id']},'attributes':[_0x2c2a('0x2b'),_0x2c2a('0x55'),_0x2c2a('0x56'),_0x2c2a('0x57')],'raw':!![]})[_0x2c2a('0x24')](handleEntityNotFound(_0x558f3f,null))[_0x2c2a('0x24')](function(_0x3bd7a4){if(_0x3bd7a4){if(!fs[_0x2c2a('0x58')](path[_0x2c2a('0x59')](config[_0x2c2a('0x5a')],_0x2c2a('0x5b'),_0x3bd7a4[_0x2c2a('0x56')]))){throw new db[(_0x2c2a('0x5c'))][(_0x2c2a('0x5d'))](_0x2c2a('0x5e'));}if(_0x2a70d0[_0x2c2a('0x32')][_0x2c2a('0x5f')]){return _0x558f3f[_0x2c2a('0x16')](0xc8);}return _0x558f3f['download'](path[_0x2c2a('0x59')](config['root'],_0x2c2a('0x5b'),_0x3bd7a4[_0x2c2a('0x56')]),util['format']('%s.%s',_0x3bd7a4[_0x2c2a('0x55')]||_0x3bd7a4[_0x2c2a('0x2b')],_0x3bd7a4['output'][_0x2c2a('0x60')]()));}})[_0x2c2a('0x45')](handleError(_0x558f3f,null));}; \ No newline at end of file diff --git a/server/api/analyticExtractedReport/analyticExtractedReport.model.js b/server/api/analyticExtractedReport/analyticExtractedReport.model.js index aa5b82e..2a80ef4 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 _0x95d0=['define','AnalyticExtractedReport','analytics_extracted_reports','lodash','bluebird','request-promise','path','rimraf','../../config/environment','./analyticExtractedReport.attributes'];(function(_0x16d4a3,_0x10f630){var _0x3f3c04=function(_0x32be71){while(--_0x32be71){_0x16d4a3['push'](_0x16d4a3['shift']());}};_0x3f3c04(++_0x10f630);}(_0x95d0,0xad));var _0x095d=function(_0x182224,_0x2542c6){_0x182224=_0x182224-0x0;var _0x409b05=_0x95d0[_0x182224];return _0x409b05;};'use strict';var _=require(_0x095d('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x095d('0x1'));var rp=require(_0x095d('0x2'));var fs=require('fs');var path=require(_0x095d('0x3'));var rimraf=require(_0x095d('0x4'));var config=require(_0x095d('0x5'));var attributes=require(_0x095d('0x6'));module['exports']=function(_0x4ac31b,_0xa366){return _0x4ac31b[_0x095d('0x7')](_0x095d('0x8'),attributes,{'tableName':_0x095d('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x175a=['moment','bluebird','path','rimraf','../../config/environment','./analyticExtractedReport.attributes','define','lodash'];(function(_0x37dfc3,_0x44f556){var _0x45281d=function(_0x12d603){while(--_0x12d603){_0x37dfc3['push'](_0x37dfc3['shift']());}};_0x45281d(++_0x44f556);}(_0x175a,0xef));var _0xa175=function(_0x45927b,_0xd1f41b){_0x45927b=_0x45927b-0x0;var _0x440315=_0x175a[_0x45927b];return _0x440315;};'use strict';var _=require(_0xa175('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xa175('0x1'));var BPromise=require(_0xa175('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xa175('0x3'));var rimraf=require(_0xa175('0x4'));var config=require(_0xa175('0x5'));var attributes=require(_0xa175('0x6'));module['exports']=function(_0x1b9c61,_0x5697fe){return _0x1b9c61[_0xa175('0x7')]('AnalyticExtractedReport',attributes,{'tableName':'analytics_extracted_reports','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 2d03e53..bc185d0 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 _0x2572=['AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then'];(function(_0x3060e3,_0x14f2c6){var _0x497d2c=function(_0x2a274a){while(--_0x2a274a){_0x3060e3['push'](_0x3060e3['shift']());}};_0x497d2c(++_0x14f2c6);}(_0x2572,0x110));var _0x2257=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x2572[_0x4cf98e];return _0x1623ac;};'use strict';var _=require(_0x2257('0x0'));var util=require(_0x2257('0x1'));var moment=require(_0x2257('0x2'));var BPromise=require(_0x2257('0x3'));var rs=require(_0x2257('0x4'));var fs=require('fs');var Redis=require(_0x2257('0x5'));var db=require(_0x2257('0x6'))['db'];var utils=require(_0x2257('0x7'));var logger=require(_0x2257('0x8'))('rpc');var config=require(_0x2257('0x9'));var jayson=require(_0x2257('0xa'));var client=jayson[_0x2257('0xb')][_0x2257('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x26b2c6,_0x339619,_0x74aec6){return new BPromise(function(_0x380460,_0xee7249){return client['request'](_0x26b2c6,_0x74aec6)[_0x2257('0xd')](function(_0x3e088a){logger['info'](_0x2257('0xe'),_0x339619,_0x2257('0xf'));logger[_0x2257('0x10')]('AnalyticExtractedReport,\x20%s,\x20%s,\x20%s',_0x339619,_0x2257('0xf'),JSON[_0x2257('0x11')](_0x3e088a));if(_0x3e088a[_0x2257('0x12')]){if(_0x3e088a[_0x2257('0x12')]['code']===0x1f4){logger[_0x2257('0x12')]('AnalyticExtractedReport,\x20%s,\x20%s',_0x339619,_0x3e088a['error'][_0x2257('0x13')]);return _0xee7249(_0x3e088a[_0x2257('0x12')][_0x2257('0x13')]);}logger[_0x2257('0x12')](_0x2257('0xe'),_0x339619,_0x3e088a[_0x2257('0x12')][_0x2257('0x13')]);return _0x380460(_0x3e088a['error']['message']);}else{logger[_0x2257('0x14')](_0x2257('0xe'),_0x339619,_0x2257('0xf'));_0x380460(_0x3e088a[_0x2257('0x15')]['message']);}})['catch'](function(_0x330216){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x339619,_0x330216);_0xee7249(_0x330216);});});} \ No newline at end of file +var _0x851f=['info','AnalyticExtractedReport,\x20%s,\x20%s','request\x20sent','debug','AnalyticExtractedReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','client','http','then'];(function(_0x3bbb75,_0x5c9781){var _0x903cb=function(_0x35616c){while(--_0x35616c){_0x3bbb75['push'](_0x3bbb75['shift']());}};_0x903cb(++_0x5c9781);}(_0x851f,0x185));var _0xf851=function(_0x3c5aa6,_0x4c4f86){_0x3c5aa6=_0x3c5aa6-0x0;var _0x49e397=_0x851f[_0x3c5aa6];return _0x49e397;};'use strict';var _=require(_0xf851('0x0'));var util=require(_0xf851('0x1'));var moment=require(_0xf851('0x2'));var BPromise=require('bluebird');var rs=require(_0xf851('0x3'));var fs=require('fs');var Redis=require(_0xf851('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf851('0x5'));var logger=require(_0xf851('0x6'))('rpc');var config=require(_0xf851('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf851('0x8')][_0xf851('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x17e8fc,_0x176f70,_0x328346){return new BPromise(function(_0x3c4e2b,_0x1cba38){return client['request'](_0x17e8fc,_0x328346)[_0xf851('0xa')](function(_0x480ee1){logger[_0xf851('0xb')](_0xf851('0xc'),_0x176f70,_0xf851('0xd'));logger[_0xf851('0xe')](_0xf851('0xf'),_0x176f70,'request\x20sent',JSON[_0xf851('0x10')](_0x480ee1));if(_0x480ee1[_0xf851('0x11')]){if(_0x480ee1[_0xf851('0x11')]['code']===0x1f4){logger['error']('AnalyticExtractedReport,\x20%s,\x20%s',_0x176f70,_0x480ee1[_0xf851('0x11')][_0xf851('0x12')]);return _0x1cba38(_0x480ee1[_0xf851('0x11')][_0xf851('0x12')]);}logger[_0xf851('0x11')](_0xf851('0xc'),_0x176f70,_0x480ee1[_0xf851('0x11')][_0xf851('0x12')]);return _0x3c4e2b(_0x480ee1[_0xf851('0x11')]['message']);}else{logger['info'](_0xf851('0xc'),_0x176f70,'request\x20sent');_0x3c4e2b(_0x480ee1['result'][_0xf851('0x12')]);}})[_0xf851('0x13')](function(_0x34feed){logger[_0xf851('0x11')](_0xf851('0xc'),_0x176f70,_0x34feed);_0x1cba38(_0x34feed);});});} \ No newline at end of file diff --git a/server/api/analyticExtractedReport/index.js b/server/api/analyticExtractedReport/index.js index 069f2f9..c9647de 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 _0xeb1d=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./analyticExtractedReport.controller','isAuthenticated','index','get','post','create','put','/:id','update','delete','destroy','exports'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0xeb1d,0x78));var _0xdeb1=function(_0x156a5a,_0x25f590){_0x156a5a=_0x156a5a-0x0;var _0x5a0a16=_0xeb1d[_0x156a5a];return _0x5a0a16;};'use strict';var multer=require(_0xdeb1('0x0'));var util=require(_0xdeb1('0x1'));var path=require(_0xdeb1('0x2'));var timeout=require(_0xdeb1('0x3'));var express=require(_0xdeb1('0x4'));var router=express['Router']();var fs_extra=require(_0xdeb1('0x5'));var auth=require(_0xdeb1('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xdeb1('0x7'));var controller=require(_0xdeb1('0x8'));router['get']('/',auth[_0xdeb1('0x9')](),controller[_0xdeb1('0xa')]);router[_0xdeb1('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0xdeb1('0xb')]('/:id/download',auth[_0xdeb1('0x9')](),controller['download']);router[_0xdeb1('0xc')]('/',auth[_0xdeb1('0x9')](),controller[_0xdeb1('0xd')]);router[_0xdeb1('0xe')](_0xdeb1('0xf'),auth[_0xdeb1('0x9')](),controller[_0xdeb1('0x10')]);router[_0xdeb1('0x11')](_0xdeb1('0xf'),auth[_0xdeb1('0x9')](),controller[_0xdeb1('0x12')]);module[_0xdeb1('0x13')]=router; \ No newline at end of file +var _0x0565=['index','/:id','show','/:id/download','post','create','put','destroy','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./analyticExtractedReport.controller','get','isAuthenticated'];(function(_0x279368,_0x41c002){var _0x40b6d0=function(_0x493776){while(--_0x493776){_0x279368['push'](_0x279368['shift']());}};_0x40b6d0(++_0x41c002);}(_0x0565,0x13a));var _0x5056=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x0565[_0x725b8e];return _0x43ac45;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5056('0x0'));var timeout=require(_0x5056('0x1'));var express=require(_0x5056('0x2'));var router=express[_0x5056('0x3')]();var fs_extra=require(_0x5056('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x5056('0x5'));var config=require(_0x5056('0x6'));var controller=require(_0x5056('0x7'));router[_0x5056('0x8')]('/',auth[_0x5056('0x9')](),controller[_0x5056('0xa')]);router[_0x5056('0x8')](_0x5056('0xb'),auth[_0x5056('0x9')](),controller[_0x5056('0xc')]);router[_0x5056('0x8')](_0x5056('0xd'),auth[_0x5056('0x9')](),controller['download']);router[_0x5056('0xe')]('/',auth['isAuthenticated'](),controller[_0x5056('0xf')]);router[_0x5056('0x10')]('/:id',auth[_0x5056('0x9')](),controller['update']);router['delete'](_0x5056('0xb'),auth[_0x5056('0x9')](),controller[_0x5056('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.attributes.js b/server/api/analyticFieldReport/analyticFieldReport.attributes.js index c6c9c64..33f0043 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 _0xdf7d=['BOOLEAN','sequelize','exports','TEXT','STRING'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdf7d,0x15f));var _0xddf7=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdf7d[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0xddf7('0x0'));module[_0xddf7('0x1')]={'field':{'type':Sequelize[_0xddf7('0x2')]},'alias':{'type':Sequelize[_0xddf7('0x3')]},'function':{'type':Sequelize[_0xddf7('0x3')]},'format':{'type':Sequelize[_0xddf7('0x3')]},'groupBy':{'type':Sequelize[_0xddf7('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xddf7('0x3')]},'custom':{'type':Sequelize[_0xddf7('0x4')],'defaultValue':![]}}; \ No newline at end of file +var _0xdfba=['STRING','BOOLEAN','sequelize','exports','TEXT'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xdfba,0x1ab));var _0xadfb=function(_0x2c77b1,_0xd77fc4){_0x2c77b1=_0x2c77b1-0x0;var _0x16427b=_0xdfba[_0x2c77b1];return _0x16427b;};'use strict';var Sequelize=require(_0xadfb('0x0'));module[_0xadfb('0x1')]={'field':{'type':Sequelize[_0xadfb('0x2')]},'alias':{'type':Sequelize[_0xadfb('0x3')]},'function':{'type':Sequelize[_0xadfb('0x3')]},'format':{'type':Sequelize[_0xadfb('0x3')]},'groupBy':{'type':Sequelize[_0xadfb('0x4')],'defaultValue':![]},'orderBy':{'type':Sequelize[_0xadfb('0x3')]},'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 bef23cc..637c352 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 _0xcf76=['send','index','map','AnalyticFieldReport','rawAttributes','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','params','length','catch','create','body','bulkCreate','update','find','bulkDestroy','ids','AnalyticCustomReport','findOne','sequelize','transaction','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','then','destroy','error','name'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xcf76,0x15b));var _0x6cf7=function(_0x102299,_0x35ef65){_0x102299=_0x102299-0x0;var _0x5ea176=_0xcf76[_0x102299];return _0x5ea176;};'use strict';var emlformat=require(_0x6cf7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x6cf7('0x1'));var jsonpatch=require(_0x6cf7('0x2'));var rp=require(_0x6cf7('0x3'));var moment=require(_0x6cf7('0x4'));var BPromise=require(_0x6cf7('0x5'));var Mustache=require('mustache');var util=require(_0x6cf7('0x6'));var path=require('path');var sox=require(_0x6cf7('0x7'));var csv=require(_0x6cf7('0x8'));var ejs=require(_0x6cf7('0x9'));var fs=require('fs');var fs_extra=require(_0x6cf7('0xa'));var _=require(_0x6cf7('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6cf7('0xc'));var deskjs=require(_0x6cf7('0xd'));var toCsv=require(_0x6cf7('0x8'));var querystring=require(_0x6cf7('0xe'));var Papa=require(_0x6cf7('0xf'));var Redis=require(_0x6cf7('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x6cf7('0x11'));var as=require(_0x6cf7('0x12'));var hardwareService=require(_0x6cf7('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x6cf7('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6cf7('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1f8798,_0x32be41){_0x32be41=_0x32be41||0xcc;return function(_0x396652){if(_0x396652){return _0x1f8798[_0x6cf7('0x16')](_0x32be41);}return _0x1f8798[_0x6cf7('0x17')](_0x32be41)[_0x6cf7('0x18')]();};}function respondWithResult(_0x1a4de3,_0xda253c){_0xda253c=_0xda253c||0xc8;return function(_0x139a03){if(_0x139a03){return _0x1a4de3[_0x6cf7('0x17')](_0xda253c)['json'](_0x139a03);}};}function respondWithFilteredResult(_0x3409d5,_0x953c48){return function(_0x447373){if(_0x447373){var _0x408b9d=typeof _0x953c48['offset']===_0x6cf7('0x19')&&typeof _0x953c48[_0x6cf7('0x1a')]===_0x6cf7('0x19');var _0xf2eec4=_0x447373[_0x6cf7('0x1b')];var _0x3c04a6=_0x408b9d?0x0:_0x953c48['offset'];var _0x4a1305=_0x408b9d?_0x447373[_0x6cf7('0x1b')]:_0x953c48[_0x6cf7('0x1c')]+_0x953c48[_0x6cf7('0x1a')];var _0x26a751;if(_0x4a1305>=_0xf2eec4){_0x4a1305=_0xf2eec4;_0x26a751=0xc8;}else{_0x26a751=0xce;}_0x3409d5[_0x6cf7('0x17')](_0x26a751);return _0x3409d5[_0x6cf7('0x1d')](_0x6cf7('0x1e'),_0x3c04a6+'-'+_0x4a1305+'/'+_0xf2eec4)[_0x6cf7('0x1f')](_0x447373);}return null;};}function patchUpdates(_0x5173e1){return function(_0x1c76f3){try{jsonpatch[_0x6cf7('0x20')](_0x1c76f3,_0x5173e1,!![]);}catch(_0x2c49f1){return BPromise[_0x6cf7('0x21')](_0x2c49f1);}return _0x1c76f3['save']();};}function saveUpdates(_0x4a2039,_0x1eb0ed){return function(_0x16e0ef){if(_0x16e0ef){return _0x16e0ef['update'](_0x4a2039)[_0x6cf7('0x22')](function(_0x2f4fad){return _0x2f4fad;});}return null;};}function removeEntity(_0x2ff9e9,_0x1bf2fc){return function(_0x4a2020){if(_0x4a2020){return _0x4a2020[_0x6cf7('0x23')]()[_0x6cf7('0x22')](function(){_0x2ff9e9[_0x6cf7('0x17')](0xcc)[_0x6cf7('0x18')]();});}};}function handleEntityNotFound(_0x748172,_0x58d6cc){return function(_0x3b8240){if(!_0x3b8240){_0x748172[_0x6cf7('0x16')](0x194);}return _0x3b8240;};}function handleError(_0x5d2c23,_0x439eed){_0x439eed=_0x439eed||0x1f4;return function(_0x411780){logger[_0x6cf7('0x24')](_0x411780['stack']);if(_0x411780[_0x6cf7('0x25')]){delete _0x411780[_0x6cf7('0x25')];}_0x5d2c23[_0x6cf7('0x17')](_0x439eed)[_0x6cf7('0x26')](_0x411780);};}exports[_0x6cf7('0x27')]=function(_0x5d8292,_0x152b10){var _0x1ce5cb={},_0x7e2086={},_0x2b7f66={'count':0x0,'rows':[]};var _0x39f454=_[_0x6cf7('0x28')](db[_0x6cf7('0x29')][_0x6cf7('0x2a')],function(_0x17da27){return{'name':_0x17da27[_0x6cf7('0x2b')],'type':_0x17da27['type']['key']};});_0x7e2086[_0x6cf7('0x2c')]=_[_0x6cf7('0x28')](_0x39f454,_0x6cf7('0x25'));_0x7e2086[_0x6cf7('0x2d')]=_[_0x6cf7('0x2e')](_0x5d8292[_0x6cf7('0x2d')]);_0x7e2086[_0x6cf7('0x2f')]=_[_0x6cf7('0x30')](_0x7e2086[_0x6cf7('0x2c')],_0x7e2086[_0x6cf7('0x2d')]);_0x1ce5cb['attributes']=_[_0x6cf7('0x30')](_0x7e2086[_0x6cf7('0x2c')],qs[_0x6cf7('0x31')](_0x5d8292[_0x6cf7('0x2d')][_0x6cf7('0x31')]));_0x1ce5cb[_0x6cf7('0x32')]=_0x1ce5cb[_0x6cf7('0x32')]['length']?_0x1ce5cb[_0x6cf7('0x32')]:_0x7e2086['model'];if(!_0x5d8292['query'][_0x6cf7('0x33')](_0x6cf7('0x34'))){_0x1ce5cb['limit']=qs[_0x6cf7('0x1a')](_0x5d8292[_0x6cf7('0x2d')][_0x6cf7('0x1a')]);_0x1ce5cb[_0x6cf7('0x1c')]=qs[_0x6cf7('0x1c')](_0x5d8292[_0x6cf7('0x2d')][_0x6cf7('0x1c')]);}_0x1ce5cb['order']=qs[_0x6cf7('0x35')](_0x5d8292[_0x6cf7('0x2d')][_0x6cf7('0x35')]);_0x1ce5cb[_0x6cf7('0x36')]=qs[_0x6cf7('0x2f')](_['pick'](_0x5d8292[_0x6cf7('0x2d')],_0x7e2086['filters']),_0x39f454);if(_0x5d8292[_0x6cf7('0x2d')]['filter']){_0x1ce5cb['where']=_[_0x6cf7('0x37')](_0x1ce5cb[_0x6cf7('0x36')],{'$or':_[_0x6cf7('0x28')](_0x39f454,function(_0x3ce7d1){if(_0x3ce7d1[_0x6cf7('0x38')]!==_0x6cf7('0x39')){var _0x1df349={};_0x1df349[_0x3ce7d1[_0x6cf7('0x25')]]={'$like':'%'+_0x5d8292['query'][_0x6cf7('0x3a')]+'%'};return _0x1df349;}})});}_0x1ce5cb=_[_0x6cf7('0x37')]({},_0x1ce5cb,_0x5d8292[_0x6cf7('0x3b')]);var _0x3e9663={'where':_0x1ce5cb[_0x6cf7('0x36')]};return db['AnalyticFieldReport'][_0x6cf7('0x1b')](_0x3e9663)[_0x6cf7('0x22')](function(_0x474d95){_0x2b7f66[_0x6cf7('0x1b')]=_0x474d95;if(_0x5d8292[_0x6cf7('0x2d')][_0x6cf7('0x3c')]){_0x1ce5cb[_0x6cf7('0x3d')]=[{'all':!![]}];}return db[_0x6cf7('0x29')][_0x6cf7('0x3e')](_0x1ce5cb);})[_0x6cf7('0x22')](function(_0x208fb1){_0x2b7f66['rows']=_0x208fb1;return _0x2b7f66;})[_0x6cf7('0x22')](respondWithFilteredResult(_0x152b10,_0x1ce5cb))['catch'](handleError(_0x152b10,null));};exports['show']=function(_0x26fdf0,_0x5d5f28){var _0x3d9aae={'raw':![],'where':{'id':_0x26fdf0[_0x6cf7('0x3f')]['id']}},_0x227232={};_0x227232['model']=_['keys'](db['AnalyticFieldReport'][_0x6cf7('0x2a')]);_0x227232[_0x6cf7('0x2d')]=_[_0x6cf7('0x2e')](_0x26fdf0['query']);_0x227232[_0x6cf7('0x2f')]=_[_0x6cf7('0x30')](_0x227232['model'],_0x227232['query']);_0x3d9aae['attributes']=_[_0x6cf7('0x30')](_0x227232['model'],qs[_0x6cf7('0x31')](_0x26fdf0['query']['fields']));_0x3d9aae[_0x6cf7('0x32')]=_0x3d9aae[_0x6cf7('0x32')][_0x6cf7('0x40')]?_0x3d9aae[_0x6cf7('0x32')]:_0x227232['model'];if(_0x26fdf0[_0x6cf7('0x2d')]['includeAll']){_0x3d9aae[_0x6cf7('0x3d')]=[{'all':!![]}];}_0x3d9aae=_[_0x6cf7('0x37')]({},_0x3d9aae,_0x26fdf0['options']);return db[_0x6cf7('0x29')]['find'](_0x3d9aae)[_0x6cf7('0x22')](handleEntityNotFound(_0x5d5f28,null))[_0x6cf7('0x22')](respondWithResult(_0x5d5f28,null))[_0x6cf7('0x41')](handleError(_0x5d5f28,null));};exports[_0x6cf7('0x42')]=function(_0x15881b,_0x458a64){return db[_0x6cf7('0x29')][_0x6cf7('0x42')](_0x15881b[_0x6cf7('0x43')],{})[_0x6cf7('0x22')](respondWithResult(_0x458a64,0xc9))[_0x6cf7('0x41')](handleError(_0x458a64,null));};exports[_0x6cf7('0x44')]=function(_0xa8620f,_0x2bb62d){return db[_0x6cf7('0x29')][_0x6cf7('0x44')](_0xa8620f[_0x6cf7('0x43')],{'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x2bb62d,0xc9))[_0x6cf7('0x41')](handleError(_0x2bb62d,null));};exports[_0x6cf7('0x45')]=function(_0x17597,_0x2d7c16){if(_0x17597[_0x6cf7('0x43')]['id']){delete _0x17597[_0x6cf7('0x43')]['id'];}return db[_0x6cf7('0x29')][_0x6cf7('0x46')]({'where':{'id':_0x17597['params']['id']}})[_0x6cf7('0x22')](handleEntityNotFound(_0x2d7c16,null))[_0x6cf7('0x22')](saveUpdates(_0x17597[_0x6cf7('0x43')],null))[_0x6cf7('0x22')](respondWithResult(_0x2d7c16,null))[_0x6cf7('0x41')](handleError(_0x2d7c16,null));};exports['destroy']=function(_0x3d12bf,_0x5e6be0){return db[_0x6cf7('0x29')][_0x6cf7('0x46')]({'where':{'id':_0x3d12bf[_0x6cf7('0x3f')]['id']}})[_0x6cf7('0x22')](handleEntityNotFound(_0x5e6be0,null))[_0x6cf7('0x22')](removeEntity(_0x5e6be0,null))[_0x6cf7('0x41')](handleError(_0x5e6be0,null));};exports[_0x6cf7('0x47')]=function(_0x4d5a8a,_0x3c37f7){return db[_0x6cf7('0x29')][_0x6cf7('0x23')]({'where':{'id':_0x4d5a8a[_0x6cf7('0x2d')][_0x6cf7('0x48')]||[]},'raw':![],'individualHooks':!![]})['then'](respondWithResult(_0x3c37f7,0xcc))[_0x6cf7('0x41')](handleError(_0x3c37f7,null));};exports['addFields']=function(_0xfcf6ee,_0x3dd04f,_0x43bfd8){return db[_0x6cf7('0x49')][_0x6cf7('0x4a')]({'where':{'id':_0xfcf6ee[_0x6cf7('0x3f')]['id']}})[_0x6cf7('0x22')](handleEntityNotFound(_0x3dd04f,null))[_0x6cf7('0x22')](function(_0x5a3254){if(_0x5a3254){return db[_0x6cf7('0x4b')][_0x6cf7('0x4c')](function(_0x39c822){return db['AnalyticFieldReport']['destroy']({'where':{'CustomReportId':_0xfcf6ee[_0x6cf7('0x3f')]['id']},'transaction':_0x39c822})[_0x6cf7('0x22')](function(_0x32268c){var _0x13f9e6=_[_0x6cf7('0x28')](_0xfcf6ee[_0x6cf7('0x43')],function(_0x596b0f){delete _0x596b0f['id'];_0x596b0f['CustomReportId']=_0xfcf6ee[_0x6cf7('0x3f')]['id'];return _0x596b0f;});return db['AnalyticFieldReport'][_0x6cf7('0x44')](_0x13f9e6,{'transaction':_0x39c822});});})[_0x6cf7('0x22')](function(){return db[_0x6cf7('0x29')][_0x6cf7('0x3e')]({'where':{'CustomReportId':_0xfcf6ee[_0x6cf7('0x3f')]['id']}});});}})['then'](respondWithResult(_0x3dd04f,null))[_0x6cf7('0x41')](handleError(_0x3dd04f,null));}; \ No newline at end of file +var _0x64f4=['ejs','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','undefined','limit','count','offset','status','Content-Range','apply','reject','save','update','then','destroy','name','index','map','AnalyticFieldReport','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','include','findAll','catch','show','params','includeAll','options','find','create','body','bulkCreate','bulkDestroy','ids','addFields','sequelize','transaction','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv'];(function(_0x37fe54,_0x19bc2d){var _0x140281=function(_0x5718dd){while(--_0x5718dd){_0x37fe54['push'](_0x37fe54['shift']());}};_0x140281(++_0x19bc2d);}(_0x64f4,0x180));var _0x464f=function(_0xa1f909,_0x19a33a){_0xa1f909=_0xa1f909-0x0;var _0x4b45de=_0x64f4[_0xa1f909];return _0x4b45de;};'use strict';var emlformat=require(_0x464f('0x0'));var rimraf=require(_0x464f('0x1'));var zipdir=require(_0x464f('0x2'));var jsonpatch=require(_0x464f('0x3'));var rp=require(_0x464f('0x4'));var moment=require(_0x464f('0x5'));var BPromise=require(_0x464f('0x6'));var Mustache=require('mustache');var util=require(_0x464f('0x7'));var path=require(_0x464f('0x8'));var sox=require(_0x464f('0x9'));var csv=require(_0x464f('0xa'));var ejs=require(_0x464f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x464f('0xc'));var crypto=require(_0x464f('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x464f('0xe'));var toCsv=require(_0x464f('0xa'));var querystring=require('querystring');var Papa=require(_0x464f('0xf'));var Redis=require(_0x464f('0x10'));var authService=require(_0x464f('0x11'));var qs=require(_0x464f('0x12'));var as=require(_0x464f('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x464f('0x14'))(_0x464f('0x15'));var utils=require(_0x464f('0x16'));var config=require(_0x464f('0x17'));var licenseUtil=require(_0x464f('0x18'));var db=require(_0x464f('0x19'))['db'];function respondWithStatusCode(_0x365713,_0x572175){_0x572175=_0x572175||0xcc;return function(_0x44969f){if(_0x44969f){return _0x365713['sendStatus'](_0x572175);}return _0x365713['status'](_0x572175)[_0x464f('0x1a')]();};}function respondWithResult(_0xc03de6,_0x3adfd2){_0x3adfd2=_0x3adfd2||0xc8;return function(_0x47b322){if(_0x47b322){return _0xc03de6['status'](_0x3adfd2)['json'](_0x47b322);}};}function respondWithFilteredResult(_0x33ffb1,_0x58589a){return function(_0x13a4f0){if(_0x13a4f0){var _0x4f834e=typeof _0x58589a['offset']===_0x464f('0x1b')&&typeof _0x58589a[_0x464f('0x1c')]===_0x464f('0x1b');var _0x1e9736=_0x13a4f0[_0x464f('0x1d')];var _0x48958d=_0x4f834e?0x0:_0x58589a[_0x464f('0x1e')];var _0x2b6db6=_0x4f834e?_0x13a4f0[_0x464f('0x1d')]:_0x58589a[_0x464f('0x1e')]+_0x58589a[_0x464f('0x1c')];var _0x3eebc2;if(_0x2b6db6>=_0x1e9736){_0x2b6db6=_0x1e9736;_0x3eebc2=0xc8;}else{_0x3eebc2=0xce;}_0x33ffb1[_0x464f('0x1f')](_0x3eebc2);return _0x33ffb1['set'](_0x464f('0x20'),_0x48958d+'-'+_0x2b6db6+'/'+_0x1e9736)['json'](_0x13a4f0);}return null;};}function patchUpdates(_0x4d35c3){return function(_0x36a027){try{jsonpatch[_0x464f('0x21')](_0x36a027,_0x4d35c3,!![]);}catch(_0x14ff7a){return BPromise[_0x464f('0x22')](_0x14ff7a);}return _0x36a027[_0x464f('0x23')]();};}function saveUpdates(_0x2e7c5d,_0x813d4a){return function(_0x22231d){if(_0x22231d){return _0x22231d[_0x464f('0x24')](_0x2e7c5d)[_0x464f('0x25')](function(_0x4d40d4){return _0x4d40d4;});}return null;};}function removeEntity(_0xcaf6ac,_0x338534){return function(_0x26d1d5){if(_0x26d1d5){return _0x26d1d5[_0x464f('0x26')]()[_0x464f('0x25')](function(){_0xcaf6ac[_0x464f('0x1f')](0xcc)[_0x464f('0x1a')]();});}};}function handleEntityNotFound(_0x5e52ed,_0x389a59){return function(_0x280a54){if(!_0x280a54){_0x5e52ed['sendStatus'](0x194);}return _0x280a54;};}function handleError(_0x23fc1b,_0x3d4923){_0x3d4923=_0x3d4923||0x1f4;return function(_0x3152f6){logger['error'](_0x3152f6['stack']);if(_0x3152f6[_0x464f('0x27')]){delete _0x3152f6['name'];}_0x23fc1b[_0x464f('0x1f')](_0x3d4923)['send'](_0x3152f6);};}exports[_0x464f('0x28')]=function(_0x4184a1,_0x294e1e){var _0x3503f5={},_0x55819a={},_0xf45fe9={'count':0x0,'rows':[]};var _0x5910cd=_[_0x464f('0x29')](db[_0x464f('0x2a')][_0x464f('0x2b')],function(_0x5164bb){return{'name':_0x5164bb[_0x464f('0x2c')],'type':_0x5164bb[_0x464f('0x2d')][_0x464f('0x2e')]};});_0x55819a[_0x464f('0x2f')]=_[_0x464f('0x29')](_0x5910cd,_0x464f('0x27'));_0x55819a[_0x464f('0x30')]=_[_0x464f('0x31')](_0x4184a1[_0x464f('0x30')]);_0x55819a[_0x464f('0x32')]=_[_0x464f('0x33')](_0x55819a[_0x464f('0x2f')],_0x55819a[_0x464f('0x30')]);_0x3503f5[_0x464f('0x34')]=_[_0x464f('0x33')](_0x55819a[_0x464f('0x2f')],qs['fields'](_0x4184a1[_0x464f('0x30')][_0x464f('0x35')]));_0x3503f5[_0x464f('0x34')]=_0x3503f5['attributes'][_0x464f('0x36')]?_0x3503f5['attributes']:_0x55819a[_0x464f('0x2f')];if(!_0x4184a1['query'][_0x464f('0x37')](_0x464f('0x38'))){_0x3503f5[_0x464f('0x1c')]=qs[_0x464f('0x1c')](_0x4184a1[_0x464f('0x30')]['limit']);_0x3503f5[_0x464f('0x1e')]=qs[_0x464f('0x1e')](_0x4184a1[_0x464f('0x30')][_0x464f('0x1e')]);}_0x3503f5[_0x464f('0x39')]=qs['sort'](_0x4184a1[_0x464f('0x30')][_0x464f('0x3a')]);_0x3503f5[_0x464f('0x3b')]=qs[_0x464f('0x32')](_['pick'](_0x4184a1[_0x464f('0x30')],_0x55819a[_0x464f('0x32')]),_0x5910cd);if(_0x4184a1[_0x464f('0x30')][_0x464f('0x3c')]){_0x3503f5[_0x464f('0x3b')]=_[_0x464f('0x3d')](_0x3503f5[_0x464f('0x3b')],{'$or':_[_0x464f('0x29')](_0x5910cd,function(_0x37e3b4){if(_0x37e3b4[_0x464f('0x2d')]!==_0x464f('0x3e')){var _0x254f78={};_0x254f78[_0x37e3b4[_0x464f('0x27')]]={'$like':'%'+_0x4184a1[_0x464f('0x30')][_0x464f('0x3c')]+'%'};return _0x254f78;}})});}_0x3503f5=_[_0x464f('0x3d')]({},_0x3503f5,_0x4184a1['options']);var _0xf17c87={'where':_0x3503f5[_0x464f('0x3b')]};return db[_0x464f('0x2a')]['count'](_0xf17c87)[_0x464f('0x25')](function(_0x200d1a){_0xf45fe9[_0x464f('0x1d')]=_0x200d1a;if(_0x4184a1[_0x464f('0x30')]['includeAll']){_0x3503f5[_0x464f('0x3f')]=[{'all':!![]}];}return db[_0x464f('0x2a')][_0x464f('0x40')](_0x3503f5);})[_0x464f('0x25')](function(_0x139fe1){_0xf45fe9['rows']=_0x139fe1;return _0xf45fe9;})[_0x464f('0x25')](respondWithFilteredResult(_0x294e1e,_0x3503f5))[_0x464f('0x41')](handleError(_0x294e1e,null));};exports[_0x464f('0x42')]=function(_0x1e7eac,_0x5d3423){var _0x201412={'raw':![],'where':{'id':_0x1e7eac[_0x464f('0x43')]['id']}},_0x528880={};_0x528880['model']=_[_0x464f('0x31')](db[_0x464f('0x2a')]['rawAttributes']);_0x528880[_0x464f('0x30')]=_[_0x464f('0x31')](_0x1e7eac[_0x464f('0x30')]);_0x528880['filters']=_['intersection'](_0x528880['model'],_0x528880[_0x464f('0x30')]);_0x201412['attributes']=_[_0x464f('0x33')](_0x528880['model'],qs[_0x464f('0x35')](_0x1e7eac['query'][_0x464f('0x35')]));_0x201412['attributes']=_0x201412[_0x464f('0x34')][_0x464f('0x36')]?_0x201412['attributes']:_0x528880[_0x464f('0x2f')];if(_0x1e7eac[_0x464f('0x30')][_0x464f('0x44')]){_0x201412[_0x464f('0x3f')]=[{'all':!![]}];}_0x201412=_[_0x464f('0x3d')]({},_0x201412,_0x1e7eac[_0x464f('0x45')]);return db[_0x464f('0x2a')][_0x464f('0x46')](_0x201412)[_0x464f('0x25')](handleEntityNotFound(_0x5d3423,null))[_0x464f('0x25')](respondWithResult(_0x5d3423,null))['catch'](handleError(_0x5d3423,null));};exports[_0x464f('0x47')]=function(_0x1180aa,_0x3a200a){return db['AnalyticFieldReport']['create'](_0x1180aa[_0x464f('0x48')],{})[_0x464f('0x25')](respondWithResult(_0x3a200a,0xc9))[_0x464f('0x41')](handleError(_0x3a200a,null));};exports['bulkCreate']=function(_0x53d648,_0x2b4502){return db[_0x464f('0x2a')][_0x464f('0x49')](_0x53d648['body'],{'raw':![],'individualHooks':!![]})[_0x464f('0x25')](respondWithResult(_0x2b4502,0xc9))[_0x464f('0x41')](handleError(_0x2b4502,null));};exports[_0x464f('0x24')]=function(_0x6c8fb8,_0x309c08){if(_0x6c8fb8[_0x464f('0x48')]['id']){delete _0x6c8fb8['body']['id'];}return db[_0x464f('0x2a')][_0x464f('0x46')]({'where':{'id':_0x6c8fb8[_0x464f('0x43')]['id']}})[_0x464f('0x25')](handleEntityNotFound(_0x309c08,null))[_0x464f('0x25')](saveUpdates(_0x6c8fb8[_0x464f('0x48')],null))[_0x464f('0x25')](respondWithResult(_0x309c08,null))[_0x464f('0x41')](handleError(_0x309c08,null));};exports[_0x464f('0x26')]=function(_0x39d1d2,_0x4fc5e3){return db[_0x464f('0x2a')][_0x464f('0x46')]({'where':{'id':_0x39d1d2[_0x464f('0x43')]['id']}})[_0x464f('0x25')](handleEntityNotFound(_0x4fc5e3,null))[_0x464f('0x25')](removeEntity(_0x4fc5e3,null))['catch'](handleError(_0x4fc5e3,null));};exports[_0x464f('0x4a')]=function(_0x1b2474,_0x4039a8){return db[_0x464f('0x2a')]['destroy']({'where':{'id':_0x1b2474[_0x464f('0x30')][_0x464f('0x4b')]||[]},'raw':![],'individualHooks':!![]})[_0x464f('0x25')](respondWithResult(_0x4039a8,0xcc))[_0x464f('0x41')](handleError(_0x4039a8,null));};exports[_0x464f('0x4c')]=function(_0x43ccd9,_0x4eccf0,_0x5cd605){return db['AnalyticCustomReport']['findOne']({'where':{'id':_0x43ccd9[_0x464f('0x43')]['id']}})[_0x464f('0x25')](handleEntityNotFound(_0x4eccf0,null))[_0x464f('0x25')](function(_0x1353ab){if(_0x1353ab){return db[_0x464f('0x4d')][_0x464f('0x4e')](function(_0x5cebf6){return db[_0x464f('0x2a')]['destroy']({'where':{'CustomReportId':_0x43ccd9['params']['id']},'transaction':_0x5cebf6})[_0x464f('0x25')](function(_0x39d5d0){var _0x423184=_[_0x464f('0x29')](_0x43ccd9[_0x464f('0x48')],function(_0x2349af){delete _0x2349af['id'];_0x2349af['CustomReportId']=_0x43ccd9[_0x464f('0x43')]['id'];return _0x2349af;});return db[_0x464f('0x2a')][_0x464f('0x49')](_0x423184,{'transaction':_0x5cebf6});});})[_0x464f('0x25')](function(){return db['AnalyticFieldReport'][_0x464f('0x40')]({'where':{'CustomReportId':_0x43ccd9[_0x464f('0x43')]['id']}});});}})['then'](respondWithResult(_0x4eccf0,null))[_0x464f('0x41')](handleError(_0x4eccf0,null));}; \ No newline at end of file diff --git a/server/api/analyticFieldReport/analyticFieldReport.model.js b/server/api/analyticFieldReport/analyticFieldReport.model.js index ce0dcef..696d2c2 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 _0xfd07=['analytics_report_fields','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./analyticFieldReport.attributes','define'];(function(_0x84653a,_0x3710e6){var _0x17662f=function(_0x640b1f){while(--_0x640b1f){_0x84653a['push'](_0x84653a['shift']());}};_0x17662f(++_0x3710e6);}(_0xfd07,0x151));var _0x7fd0=function(_0x12877b,_0x8650cf){_0x12877b=_0x12877b-0x0;var _0x3549ff=_0xfd07[_0x12877b];return _0x3549ff;};'use strict';var _=require(_0x7fd0('0x0'));var util=require(_0x7fd0('0x1'));var logger=require(_0x7fd0('0x2'))('api');var moment=require(_0x7fd0('0x3'));var BPromise=require(_0x7fd0('0x4'));var rp=require(_0x7fd0('0x5'));var fs=require('fs');var path=require(_0x7fd0('0x6'));var rimraf=require(_0x7fd0('0x7'));var config=require(_0x7fd0('0x8'));var attributes=require(_0x7fd0('0x9'));module['exports']=function(_0x39ecc8,_0x30280a){return _0x39ecc8[_0x7fd0('0xa')]('AnalyticFieldReport',attributes,{'tableName':_0x7fd0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0535=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','AnalyticFieldReport','analytics_report_fields','lodash','../../config/logger'];(function(_0x581db0,_0x31d992){var _0x198b98=function(_0x3de413){while(--_0x3de413){_0x581db0['push'](_0x581db0['shift']());}};_0x198b98(++_0x31d992);}(_0x0535,0x166));var _0x5053=function(_0x367d18,_0x490319){_0x367d18=_0x367d18-0x0;var _0x88274=_0x0535[_0x367d18];return _0x88274;};'use strict';var _=require(_0x5053('0x0'));var util=require('util');var logger=require(_0x5053('0x1'))(_0x5053('0x2'));var moment=require(_0x5053('0x3'));var BPromise=require(_0x5053('0x4'));var rp=require(_0x5053('0x5'));var fs=require('fs');var path=require(_0x5053('0x6'));var rimraf=require(_0x5053('0x7'));var config=require(_0x5053('0x8'));var attributes=require('./analyticFieldReport.attributes');module['exports']=function(_0x3a5a5b,_0x586df2){return _0x3a5a5b[_0x5053('0x9')](_0x5053('0xa'),attributes,{'tableName':_0x5053('0xb'),'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 58857dc..b8fb3ad 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 _0x2b6f=['../../config/environment','http','request','then','info','AnalyticFieldReport,\x20%s,\x20%s','request\x20sent','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger'];(function(_0x49684e,_0x9a24fb){var _0x54062f=function(_0x4e410a){while(--_0x4e410a){_0x49684e['push'](_0x49684e['shift']());}};_0x54062f(++_0x9a24fb);}(_0x2b6f,0x111));var _0xf2b6=function(_0x459423,_0x3416a8){_0x459423=_0x459423-0x0;var _0x42ed14=_0x2b6f[_0x459423];return _0x42ed14;};'use strict';var _=require(_0xf2b6('0x0'));var util=require('util');var moment=require(_0xf2b6('0x1'));var BPromise=require(_0xf2b6('0x2'));var rs=require(_0xf2b6('0x3'));var fs=require('fs');var Redis=require(_0xf2b6('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xf2b6('0x5'));var logger=require(_0xf2b6('0x6'))('rpc');var config=require(_0xf2b6('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0xf2b6('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3fb41b,_0x242e68,_0x4112bd){return new BPromise(function(_0x24699e,_0x48aee5){return client[_0xf2b6('0x9')](_0x3fb41b,_0x4112bd)[_0xf2b6('0xa')](function(_0x253389){logger[_0xf2b6('0xb')](_0xf2b6('0xc'),_0x242e68,_0xf2b6('0xd'));logger['debug'](_0xf2b6('0xe'),_0x242e68,_0xf2b6('0xd'),JSON[_0xf2b6('0xf')](_0x253389));if(_0x253389[_0xf2b6('0x10')]){if(_0x253389['error'][_0xf2b6('0x11')]===0x1f4){logger['error'](_0xf2b6('0xc'),_0x242e68,_0x253389[_0xf2b6('0x10')][_0xf2b6('0x12')]);return _0x48aee5(_0x253389[_0xf2b6('0x10')][_0xf2b6('0x12')]);}logger['error'](_0xf2b6('0xc'),_0x242e68,_0x253389[_0xf2b6('0x10')][_0xf2b6('0x12')]);return _0x24699e(_0x253389['error'][_0xf2b6('0x12')]);}else{logger[_0xf2b6('0xb')]('AnalyticFieldReport,\x20%s,\x20%s',_0x242e68,_0xf2b6('0xd'));_0x24699e(_0x253389['result'][_0xf2b6('0x12')]);}})[_0xf2b6('0x13')](function(_0x31c145){logger[_0xf2b6('0x10')](_0xf2b6('0xc'),_0x242e68,_0x31c145);_0x48aee5(_0x31c145);});});} \ No newline at end of file +var _0xf064=['randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','request','then','debug','AnalyticFieldReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','AnalyticFieldReport,\x20%s,\x20%s','info','result','catch','lodash','util','moment'];(function(_0x371172,_0x386170){var _0x18eeee=function(_0x4dbf66){while(--_0x4dbf66){_0x371172['push'](_0x371172['shift']());}};_0x18eeee(++_0x386170);}(_0xf064,0xcc));var _0x4f06=function(_0xd9f102,_0x5a0d28){_0xd9f102=_0xd9f102-0x0;var _0x2652e4=_0xf064[_0xd9f102];return _0x2652e4;};'use strict';var _=require(_0x4f06('0x0'));var util=require(_0x4f06('0x1'));var moment=require(_0x4f06('0x2'));var BPromise=require('bluebird');var rs=require(_0x4f06('0x3'));var fs=require('fs');var Redis=require(_0x4f06('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4f06('0x5'))(_0x4f06('0x6'));var config=require('../../config/environment');var jayson=require(_0x4f06('0x7'));var client=jayson[_0x4f06('0x8')][_0x4f06('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x14aa1f,_0x393575,_0x53ee9f){return new BPromise(function(_0x191619,_0x7915ac){return client[_0x4f06('0xa')](_0x14aa1f,_0x53ee9f)[_0x4f06('0xb')](function(_0x430cbd){logger['info']('AnalyticFieldReport,\x20%s,\x20%s',_0x393575,'request\x20sent');logger[_0x4f06('0xc')](_0x4f06('0xd'),_0x393575,_0x4f06('0xe'),JSON[_0x4f06('0xf')](_0x430cbd));if(_0x430cbd[_0x4f06('0x10')]){if(_0x430cbd[_0x4f06('0x10')][_0x4f06('0x11')]===0x1f4){logger[_0x4f06('0x10')]('AnalyticFieldReport,\x20%s,\x20%s',_0x393575,_0x430cbd[_0x4f06('0x10')]['message']);return _0x7915ac(_0x430cbd['error'][_0x4f06('0x12')]);}logger[_0x4f06('0x10')](_0x4f06('0x13'),_0x393575,_0x430cbd[_0x4f06('0x10')][_0x4f06('0x12')]);return _0x191619(_0x430cbd['error'][_0x4f06('0x12')]);}else{logger[_0x4f06('0x14')]('AnalyticFieldReport,\x20%s,\x20%s',_0x393575,_0x4f06('0xe'));_0x191619(_0x430cbd[_0x4f06('0x15')][_0x4f06('0x12')]);}})[_0x4f06('0x16')](function(_0x6c5161){logger[_0x4f06('0x10')](_0x4f06('0x13'),_0x393575,_0x6c5161);_0x7915ac(_0x6c5161);});});} \ No newline at end of file diff --git a/server/api/analyticFieldReport/index.js b/server/api/analyticFieldReport/index.js index f5ccc07..c33f20f 100644 --- a/server/api/analyticFieldReport/index.js +++ b/server/api/analyticFieldReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x39c13a,_0x5f01a5){var _0x481d01=function(_0x327444){while(--_0x327444){_0x39c13a['push'](_0x39c13a['shift']());}};_0x481d01(++_0x5f01a5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file +var _0xa9e0=['delete','/destroy_many','bulkDestroy','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticFieldReport.controller','get','index','/:id','post','/create_many','isAuthenticated','bulkCreate','/:id/create_many','update'];(function(_0x308abf,_0x2dce56){var _0x24a5b4=function(_0x162d5a){while(--_0x162d5a){_0x308abf['push'](_0x308abf['shift']());}};_0x24a5b4(++_0x2dce56);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router[_0x0a9e('0xb')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xb')](_0x0a9e('0xf'),auth['isAuthenticated'](),controller['addFields']);router['put']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x14')]);module[_0x0a9e('0x15')]=router; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.attributes.js b/server/api/analyticMetric/analyticMetric.attributes.js index 9d97898..94eba2a 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 _0x7b37=['STRING','sequelize','exports','name'];(function(_0x220f3f,_0x11c540){var _0x1f170e=function(_0x2c0ec9){while(--_0x2c0ec9){_0x220f3f['push'](_0x220f3f['shift']());}};_0x1f170e(++_0x11c540);}(_0x7b37,0xd9));var _0x77b3=function(_0x4452f1,_0x5ad396){_0x4452f1=_0x4452f1-0x0;var _0x6cedd0=_0x7b37[_0x4452f1];return _0x6cedd0;};'use strict';var Sequelize=require(_0x77b3('0x0'));module[_0x77b3('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x77b3('0x2')},'table':{'type':Sequelize[_0x77b3('0x3')]},'metric':{'type':Sequelize['TEXT']},'description':{'type':Sequelize[_0x77b3('0x3')]}}; \ No newline at end of file +var _0x373d=['name','TEXT','sequelize','STRING'];(function(_0x5cd2ab,_0x2d162b){var _0x4663db=function(_0x54a66d){while(--_0x54a66d){_0x5cd2ab['push'](_0x5cd2ab['shift']());}};_0x4663db(++_0x2d162b);}(_0x373d,0x1e2));var _0xd373=function(_0x4e56a2,_0x5a241c){_0x4e56a2=_0x4e56a2-0x0;var _0x1e819c=_0x373d[_0x4e56a2];return _0x1e819c;};'use strict';var Sequelize=require(_0xd373('0x0'));module['exports']={'name':{'type':Sequelize[_0xd373('0x1')],'allowNull':![],'unique':_0xd373('0x2')},'table':{'type':Sequelize[_0xd373('0x1')]},'metric':{'type':Sequelize[_0xd373('0x3')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.controller.js b/server/api/analyticMetric/analyticMetric.controller.js index 79aed05..4883f13 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 _0xf2ca=['filter','merge','map','type','VIRTUAL','options','AnalyticMetric','count','includeAll','findAll','rows','catch','keys','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','then','get','Metrics','UserProfileResource','destroy','stack','name','send','index','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where'];(function(_0x38e290,_0x3db827){var _0x1e957c=function(_0x7070b1){while(--_0x7070b1){_0x38e290['push'](_0x38e290['shift']());}};_0x1e957c(++_0x3db827);}(_0xf2ca,0x16a));var _0xaf2c=function(_0x1c3370,_0xf617e8){_0x1c3370=_0x1c3370-0x0;var _0xa9b358=_0xf2ca[_0x1c3370];return _0xa9b358;};'use strict';var emlformat=require(_0xaf2c('0x0'));var rimraf=require(_0xaf2c('0x1'));var zipdir=require(_0xaf2c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xaf2c('0x3'));var moment=require(_0xaf2c('0x4'));var BPromise=require(_0xaf2c('0x5'));var Mustache=require(_0xaf2c('0x6'));var util=require(_0xaf2c('0x7'));var path=require(_0xaf2c('0x8'));var sox=require('sox');var csv=require(_0xaf2c('0x9'));var ejs=require(_0xaf2c('0xa'));var fs=require('fs');var fs_extra=require(_0xaf2c('0xb'));var _=require(_0xaf2c('0xc'));var squel=require('squel');var crypto=require(_0xaf2c('0xd'));var jsforce=require(_0xaf2c('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xaf2c('0x9'));var querystring=require('querystring');var Papa=require(_0xaf2c('0xf'));var Redis=require('ioredis');var authService=require(_0xaf2c('0x10'));var qs=require(_0xaf2c('0x11'));var as=require(_0xaf2c('0x12'));var hardwareService=require(_0xaf2c('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0xaf2c('0x14'));var config=require(_0xaf2c('0x15'));var licenseUtil=require(_0xaf2c('0x16'));var db=require(_0xaf2c('0x17'))['db'];function respondWithStatusCode(_0x285dac,_0x59a59b){_0x59a59b=_0x59a59b||0xcc;return function(_0x590126){if(_0x590126){return _0x285dac[_0xaf2c('0x18')](_0x59a59b);}return _0x285dac[_0xaf2c('0x19')](_0x59a59b)[_0xaf2c('0x1a')]();};}function respondWithResult(_0x18a8a5,_0x293ca6){_0x293ca6=_0x293ca6||0xc8;return function(_0x152c73){if(_0x152c73){return _0x18a8a5[_0xaf2c('0x19')](_0x293ca6)[_0xaf2c('0x1b')](_0x152c73);}};}function respondWithFilteredResult(_0x2119c8,_0x1d0633){return function(_0x6ac8e){if(_0x6ac8e){var _0x2b4d13=typeof _0x1d0633[_0xaf2c('0x1c')]===_0xaf2c('0x1d')&&typeof _0x1d0633[_0xaf2c('0x1e')]==='undefined';var _0x3ca650=_0x6ac8e['count'];var _0x278a28=_0x2b4d13?0x0:_0x1d0633[_0xaf2c('0x1c')];var _0x1d544a=_0x2b4d13?_0x6ac8e['count']:_0x1d0633[_0xaf2c('0x1c')]+_0x1d0633[_0xaf2c('0x1e')];var _0x1fec4c;if(_0x1d544a>=_0x3ca650){_0x1d544a=_0x3ca650;_0x1fec4c=0xc8;}else{_0x1fec4c=0xce;}_0x2119c8[_0xaf2c('0x19')](_0x1fec4c);return _0x2119c8[_0xaf2c('0x1f')](_0xaf2c('0x20'),_0x278a28+'-'+_0x1d544a+'/'+_0x3ca650)['json'](_0x6ac8e);}return null;};}function patchUpdates(_0x35e712){return function(_0x164bcb){try{jsonpatch[_0xaf2c('0x21')](_0x164bcb,_0x35e712,!![]);}catch(_0x3bfd3f){return BPromise[_0xaf2c('0x22')](_0x3bfd3f);}return _0x164bcb['save']();};}function saveUpdates(_0x396646,_0xbf6f62){return function(_0x18153c){if(_0x18153c){return _0x18153c['update'](_0x396646)['then'](function(_0x29cbdf){return _0x29cbdf;});}return null;};}function removeEntity(_0x303546,_0x1cafad){return function(_0x99f78d){if(_0x99f78d){return _0x99f78d['destroy']()[_0xaf2c('0x23')](function(){var _0xf1a7cf=_0x99f78d[_0xaf2c('0x24')]({'plain':!![]});var _0x3c1ae6=_0xaf2c('0x25');return db[_0xaf2c('0x26')][_0xaf2c('0x27')]({'where':{'type':_0x3c1ae6,'resourceId':_0xf1a7cf['id']}})['then'](function(){return _0x99f78d;});})[_0xaf2c('0x23')](function(){_0x303546[_0xaf2c('0x19')](0xcc)[_0xaf2c('0x1a')]();});}};}function handleEntityNotFound(_0x410536,_0x4b7cf2){return function(_0x3fb190){if(!_0x3fb190){_0x410536['sendStatus'](0x194);}return _0x3fb190;};}function handleError(_0x38db1b,_0x42f980){_0x42f980=_0x42f980||0x1f4;return function(_0x15466b){logger['error'](_0x15466b[_0xaf2c('0x28')]);if(_0x15466b[_0xaf2c('0x29')]){delete _0x15466b[_0xaf2c('0x29')];}_0x38db1b['status'](_0x42f980)[_0xaf2c('0x2a')](_0x15466b);};}exports[_0xaf2c('0x2b')]=function(_0x42e2a5,_0x19364e){var _0x59d858={},_0x3da072={},_0x4072ff={'count':0x0,'rows':[]};var _0x1be1ef=_['map'](db['AnalyticMetric'][_0xaf2c('0x2c')],function(_0x4c9b4f){return{'name':_0x4c9b4f[_0xaf2c('0x2d')],'type':_0x4c9b4f['type'][_0xaf2c('0x2e')]};});_0x3da072[_0xaf2c('0x2f')]=_['map'](_0x1be1ef,_0xaf2c('0x29'));_0x3da072[_0xaf2c('0x30')]=_['keys'](_0x42e2a5[_0xaf2c('0x30')]);_0x3da072[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x3da072[_0xaf2c('0x2f')],_0x3da072[_0xaf2c('0x30')]);_0x59d858[_0xaf2c('0x33')]=_['intersection'](_0x3da072[_0xaf2c('0x2f')],qs['fields'](_0x42e2a5[_0xaf2c('0x30')]['fields']));_0x59d858[_0xaf2c('0x33')]=_0x59d858['attributes'][_0xaf2c('0x34')]?_0x59d858['attributes']:_0x3da072[_0xaf2c('0x2f')];if(!_0x42e2a5['query'][_0xaf2c('0x35')](_0xaf2c('0x36'))){_0x59d858[_0xaf2c('0x1e')]=qs[_0xaf2c('0x1e')](_0x42e2a5[_0xaf2c('0x30')]['limit']);_0x59d858['offset']=qs[_0xaf2c('0x1c')](_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x1c')]);}_0x59d858[_0xaf2c('0x37')]=qs[_0xaf2c('0x38')](_0x42e2a5[_0xaf2c('0x30')]['sort']);_0x59d858[_0xaf2c('0x39')]=qs[_0xaf2c('0x31')](_['pick'](_0x42e2a5[_0xaf2c('0x30')],_0x3da072[_0xaf2c('0x31')]),_0x1be1ef);if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x3a')]){_0x59d858[_0xaf2c('0x39')]=_[_0xaf2c('0x3b')](_0x59d858[_0xaf2c('0x39')],{'$or':_[_0xaf2c('0x3c')](_0x1be1ef,function(_0x296ca8){if(_0x296ca8[_0xaf2c('0x3d')]!==_0xaf2c('0x3e')){var _0x43f606={};_0x43f606[_0x296ca8[_0xaf2c('0x29')]]={'$like':'%'+_0x42e2a5['query']['filter']+'%'};return _0x43f606;}})});}_0x59d858=_['merge']({},_0x59d858,_0x42e2a5[_0xaf2c('0x3f')]);var _0x3cb075={'where':_0x59d858[_0xaf2c('0x39')]};return db[_0xaf2c('0x40')][_0xaf2c('0x41')](_0x3cb075)[_0xaf2c('0x23')](function(_0x51c441){_0x4072ff[_0xaf2c('0x41')]=_0x51c441;if(_0x42e2a5[_0xaf2c('0x30')][_0xaf2c('0x42')]){_0x59d858['include']=[{'all':!![]}];}return db['AnalyticMetric'][_0xaf2c('0x43')](_0x59d858);})['then'](function(_0x181787){_0x4072ff[_0xaf2c('0x44')]=_0x181787;return _0x4072ff;})[_0xaf2c('0x23')](respondWithFilteredResult(_0x19364e,_0x59d858))[_0xaf2c('0x45')](handleError(_0x19364e,null));};exports['show']=function(_0x2091eb,_0x532d5f){var _0x2056b8={'raw':!![],'where':{'id':_0x2091eb['params']['id']}},_0x8ebb65={};_0x8ebb65[_0xaf2c('0x2f')]=_['keys'](db[_0xaf2c('0x40')][_0xaf2c('0x2c')]);_0x8ebb65[_0xaf2c('0x30')]=_[_0xaf2c('0x46')](_0x2091eb[_0xaf2c('0x30')]);_0x8ebb65[_0xaf2c('0x31')]=_[_0xaf2c('0x32')](_0x8ebb65[_0xaf2c('0x2f')],_0x8ebb65[_0xaf2c('0x30')]);_0x2056b8['attributes']=_['intersection'](_0x8ebb65[_0xaf2c('0x2f')],qs['fields'](_0x2091eb['query']['fields']));_0x2056b8[_0xaf2c('0x33')]=_0x2056b8[_0xaf2c('0x33')][_0xaf2c('0x34')]?_0x2056b8[_0xaf2c('0x33')]:_0x8ebb65['model'];if(_0x2091eb[_0xaf2c('0x30')]['includeAll']){_0x2056b8[_0xaf2c('0x47')]=[{'all':!![]}];}_0x2056b8=_['merge']({},_0x2056b8,_0x2091eb[_0xaf2c('0x3f')]);return db[_0xaf2c('0x40')][_0xaf2c('0x48')](_0x2056b8)[_0xaf2c('0x23')](handleEntityNotFound(_0x532d5f,null))[_0xaf2c('0x23')](respondWithResult(_0x532d5f,null))['catch'](handleError(_0x532d5f,null));};exports[_0xaf2c('0x49')]=function(_0x26afee,_0x4b3ca4){return db['AnalyticMetric'][_0xaf2c('0x49')](_0x26afee['body'],{})[_0xaf2c('0x23')](function(_0x23642b){var _0x17b9ec=_0x26afee[_0xaf2c('0x4a')][_0xaf2c('0x24')]({'plain':!![]});if(!_0x17b9ec)throw new Error(_0xaf2c('0x4b'));if(_0x17b9ec[_0xaf2c('0x4c')]===_0xaf2c('0x4a')){var _0x31ccfe=_0x23642b[_0xaf2c('0x24')]({'plain':!![]});var _0x371486='Metrics';return db[_0xaf2c('0x4d')][_0xaf2c('0x48')]({'where':{'name':_0x371486,'userProfileId':_0x17b9ec['userProfileId']},'raw':!![]})['then'](function(_0x56d7ce){if(_0x56d7ce&&_0x56d7ce[_0xaf2c('0x4e')]===0x0){return db[_0xaf2c('0x26')]['create']({'name':_0x31ccfe[_0xaf2c('0x29')],'resourceId':_0x31ccfe['id'],'type':_0x56d7ce[_0xaf2c('0x29')],'sectionId':_0x56d7ce['id']},{})[_0xaf2c('0x23')](function(){return _0x23642b;});}else{return _0x23642b;}})[_0xaf2c('0x45')](function(_0x265748){logger[_0xaf2c('0x4f')](_0xaf2c('0x50'),_0x265748);throw _0x265748;});}return _0x23642b;})['then'](respondWithResult(_0x4b3ca4,0xc9))[_0xaf2c('0x45')](handleError(_0x4b3ca4,null));};exports[_0xaf2c('0x51')]=function(_0x5771e5,_0x245797){if(_0x5771e5[_0xaf2c('0x52')]['id']){delete _0x5771e5[_0xaf2c('0x52')]['id'];}return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x5771e5[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x245797,null))[_0xaf2c('0x23')](saveUpdates(_0x5771e5[_0xaf2c('0x52')],null))[_0xaf2c('0x23')](respondWithResult(_0x245797,null))[_0xaf2c('0x45')](handleError(_0x245797,null));};exports[_0xaf2c('0x27')]=function(_0x411e84,_0x2356a0){return db[_0xaf2c('0x40')][_0xaf2c('0x48')]({'where':{'id':_0x411e84[_0xaf2c('0x53')]['id']}})[_0xaf2c('0x23')](handleEntityNotFound(_0x2356a0,null))[_0xaf2c('0x23')](removeEntity(_0x2356a0,null))[_0xaf2c('0x45')](handleError(_0x2356a0,null));}; \ No newline at end of file +var _0x55ca=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','get','Metrics','UserProfileResource','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','merge','AnalyticMetric','findAll','catch','show','include','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware'];(function(_0x4f30bd,_0x2403c0){var _0x3a2b60=function(_0x5202ff){while(--_0x5202ff){_0x4f30bd['push'](_0x4f30bd['shift']());}};_0x3a2b60(++_0x2403c0);}(_0x55ca,0x126));var _0xa55c=function(_0x29c3b2,_0x3c12ac){_0x29c3b2=_0x29c3b2-0x0;var _0x4b3aa7=_0x55ca[_0x29c3b2];return _0x4b3aa7;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){var _0x54b038=_0x5ba836[_0xa55c('0x21')]({'plain':!![]});var _0x190757=_0xa55c('0x22');return db[_0xa55c('0x23')][_0xa55c('0x24')]({'where':{'type':_0x190757,'resourceId':_0x54b038['id']}})[_0xa55c('0x20')](function(){return _0x5ba836;});})[_0xa55c('0x20')](function(){_0x1fc828[_0xa55c('0x18')](0xcc)[_0xa55c('0x25')]();});}};}function handleEntityNotFound(_0x3cd152,_0x1273d7){return function(_0x57f271){if(!_0x57f271){_0x3cd152[_0xa55c('0x26')](0x194);}return _0x57f271;};}function handleError(_0x28814f,_0x1c9f6b){_0x1c9f6b=_0x1c9f6b||0x1f4;return function(_0x906caa){logger['error'](_0x906caa[_0xa55c('0x27')]);if(_0x906caa[_0xa55c('0x28')]){delete _0x906caa[_0xa55c('0x28')];}_0x28814f[_0xa55c('0x18')](_0x1c9f6b)[_0xa55c('0x29')](_0x906caa);};}exports[_0xa55c('0x2a')]=function(_0x52d37f,_0x23e698){var _0x490b7d={},_0x35c9c2={},_0x1d730b={'count':0x0,'rows':[]};var _0x1cc53e=_[_0xa55c('0x2b')](db['AnalyticMetric'][_0xa55c('0x2c')],function(_0x2096ae){return{'name':_0x2096ae[_0xa55c('0x2d')],'type':_0x2096ae[_0xa55c('0x2e')][_0xa55c('0x2f')]};});_0x35c9c2[_0xa55c('0x30')]=_[_0xa55c('0x2b')](_0x1cc53e,_0xa55c('0x28'));_0x35c9c2[_0xa55c('0x31')]=_[_0xa55c('0x32')](_0x52d37f[_0xa55c('0x31')]);_0x35c9c2['filters']=_['intersection'](_0x35c9c2[_0xa55c('0x30')],_0x35c9c2[_0xa55c('0x31')]);_0x490b7d['attributes']=_[_0xa55c('0x33')](_0x35c9c2[_0xa55c('0x30')],qs[_0xa55c('0x34')](_0x52d37f[_0xa55c('0x31')][_0xa55c('0x34')]));_0x490b7d[_0xa55c('0x35')]=_0x490b7d[_0xa55c('0x35')][_0xa55c('0x36')]?_0x490b7d[_0xa55c('0x35')]:_0x35c9c2['model'];if(!_0x52d37f['query']['hasOwnProperty'](_0xa55c('0x37'))){_0x490b7d[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x52d37f['query'][_0xa55c('0x1c')]);_0x490b7d['offset']=qs[_0xa55c('0x1a')](_0x52d37f['query'][_0xa55c('0x1a')]);}_0x490b7d[_0xa55c('0x38')]=qs[_0xa55c('0x39')](_0x52d37f['query'][_0xa55c('0x39')]);_0x490b7d[_0xa55c('0x3a')]=qs['filters'](_[_0xa55c('0x3b')](_0x52d37f[_0xa55c('0x31')],_0x35c9c2['filters']),_0x1cc53e);if(_0x52d37f['query'][_0xa55c('0x3c')]){_0x490b7d['where']=_[_0xa55c('0x3d')](_0x490b7d[_0xa55c('0x3a')],{'$or':_['map'](_0x1cc53e,function(_0x542d76){if(_0x542d76['type']!=='VIRTUAL'){var _0x3b3308={};_0x3b3308[_0x542d76[_0xa55c('0x28')]]={'$like':'%'+_0x52d37f[_0xa55c('0x31')][_0xa55c('0x3c')]+'%'};return _0x3b3308;}})});}_0x490b7d=_[_0xa55c('0x3d')]({},_0x490b7d,_0x52d37f['options']);var _0x3d52d8={'where':_0x490b7d[_0xa55c('0x3a')]};return db[_0xa55c('0x3e')][_0xa55c('0x1d')](_0x3d52d8)[_0xa55c('0x20')](function(_0x23cef5){_0x1d730b['count']=_0x23cef5;if(_0x52d37f[_0xa55c('0x31')]['includeAll']){_0x490b7d['include']=[{'all':!![]}];}return db[_0xa55c('0x3e')][_0xa55c('0x3f')](_0x490b7d);})['then'](function(_0x2bd98b){_0x1d730b['rows']=_0x2bd98b;return _0x1d730b;})['then'](respondWithFilteredResult(_0x23e698,_0x490b7d))[_0xa55c('0x40')](handleError(_0x23e698,null));};exports[_0xa55c('0x41')]=function(_0x1630ac,_0x540337){var _0x1b2708={'raw':!![],'where':{'id':_0x1630ac['params']['id']}},_0xd5a006={};_0xd5a006[_0xa55c('0x30')]=_['keys'](db[_0xa55c('0x3e')][_0xa55c('0x2c')]);_0xd5a006['query']=_[_0xa55c('0x32')](_0x1630ac[_0xa55c('0x31')]);_0xd5a006['filters']=_[_0xa55c('0x33')](_0xd5a006[_0xa55c('0x30')],_0xd5a006[_0xa55c('0x31')]);_0x1b2708['attributes']=_[_0xa55c('0x33')](_0xd5a006['model'],qs[_0xa55c('0x34')](_0x1630ac[_0xa55c('0x31')][_0xa55c('0x34')]));_0x1b2708['attributes']=_0x1b2708[_0xa55c('0x35')][_0xa55c('0x36')]?_0x1b2708['attributes']:_0xd5a006[_0xa55c('0x30')];if(_0x1630ac[_0xa55c('0x31')]['includeAll']){_0x1b2708[_0xa55c('0x42')]=[{'all':!![]}];}_0x1b2708=_[_0xa55c('0x3d')]({},_0x1b2708,_0x1630ac['options']);return db[_0xa55c('0x3e')][_0xa55c('0x43')](_0x1b2708)[_0xa55c('0x20')](handleEntityNotFound(_0x540337,null))[_0xa55c('0x20')](respondWithResult(_0x540337,null))['catch'](handleError(_0x540337,null));};exports[_0xa55c('0x44')]=function(_0x58a7ea,_0x2157d6){return db[_0xa55c('0x3e')][_0xa55c('0x44')](_0x58a7ea['body'],{})[_0xa55c('0x20')](function(_0x250b00){var _0x574fe9=_0x58a7ea[_0xa55c('0x45')][_0xa55c('0x21')]({'plain':!![]});if(!_0x574fe9)throw new Error(_0xa55c('0x46'));if(_0x574fe9[_0xa55c('0x47')]===_0xa55c('0x45')){var _0x1c84d9=_0x250b00[_0xa55c('0x21')]({'plain':!![]});var _0x129626=_0xa55c('0x22');return db[_0xa55c('0x48')]['find']({'where':{'name':_0x129626,'userProfileId':_0x574fe9[_0xa55c('0x49')]},'raw':!![]})[_0xa55c('0x20')](function(_0x216de8){if(_0x216de8&&_0x216de8['autoAssociation']===0x0){return db[_0xa55c('0x23')][_0xa55c('0x44')]({'name':_0x1c84d9['name'],'resourceId':_0x1c84d9['id'],'type':_0x216de8[_0xa55c('0x28')],'sectionId':_0x216de8['id']},{})['then'](function(){return _0x250b00;});}else{return _0x250b00;}})[_0xa55c('0x40')](function(_0x228df4){logger[_0xa55c('0x4a')](_0xa55c('0x4b'),_0x228df4);throw _0x228df4;});}return _0x250b00;})[_0xa55c('0x20')](respondWithResult(_0x2157d6,0xc9))['catch'](handleError(_0x2157d6,null));};exports[_0xa55c('0x1f')]=function(_0x4607ca,_0x4b85cc){if(_0x4607ca[_0xa55c('0x4c')]['id']){delete _0x4607ca[_0xa55c('0x4c')]['id'];}return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x4607ca['params']['id']}})['then'](handleEntityNotFound(_0x4b85cc,null))[_0xa55c('0x20')](saveUpdates(_0x4607ca[_0xa55c('0x4c')],null))[_0xa55c('0x20')](respondWithResult(_0x4b85cc,null))[_0xa55c('0x40')](handleError(_0x4b85cc,null));};exports['destroy']=function(_0x30c0c9,_0x5ce463){return db[_0xa55c('0x3e')][_0xa55c('0x43')]({'where':{'id':_0x30c0c9[_0xa55c('0x4d')]['id']}})[_0xa55c('0x20')](handleEntityNotFound(_0x5ce463,null))[_0xa55c('0x20')](removeEntity(_0x5ce463,null))['catch'](handleError(_0x5ce463,null));}; \ No newline at end of file diff --git a/server/api/analyticMetric/analyticMetric.model.js b/server/api/analyticMetric/analyticMetric.model.js index 2a34251..7a32b4d 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 _0x96f1=['./analyticMetric.attributes','exports','define','analytics_metrics','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x36a2d2,_0xe0d35b){var _0x5b0069=function(_0x4f7c23){while(--_0x4f7c23){_0x36a2d2['push'](_0x36a2d2['shift']());}};_0x5b0069(++_0xe0d35b);}(_0x96f1,0x19c));var _0x196f=function(_0x315b12,_0xf7f8c7){_0x315b12=_0x315b12-0x0;var _0x40a925=_0x96f1[_0x315b12];return _0x40a925;};'use strict';var _=require(_0x196f('0x0'));var util=require(_0x196f('0x1'));var logger=require(_0x196f('0x2'))(_0x196f('0x3'));var moment=require(_0x196f('0x4'));var BPromise=require(_0x196f('0x5'));var rp=require(_0x196f('0x6'));var fs=require('fs');var path=require(_0x196f('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x196f('0x8'));module[_0x196f('0x9')]=function(_0x267906,_0x1f401c){return _0x267906[_0x196f('0xa')]('AnalyticMetric',attributes,{'tableName':_0x196f('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9432=['exports','AnalyticMetric','analytics_metrics','lodash','util','api','moment','request-promise','../../config/environment','./analyticMetric.attributes'];(function(_0x1c289a,_0x277fe7){var _0x28d68e=function(_0x2f8e98){while(--_0x2f8e98){_0x1c289a['push'](_0x1c289a['shift']());}};_0x28d68e(++_0x277fe7);}(_0x9432,0x1e3));var _0x2943=function(_0x521e56,_0x5c2807){_0x521e56=_0x521e56-0x0;var _0x5267ae=_0x9432[_0x521e56];return _0x5267ae;};'use strict';var _=require(_0x2943('0x0'));var util=require(_0x2943('0x1'));var logger=require('../../config/logger')(_0x2943('0x2'));var moment=require(_0x2943('0x3'));var BPromise=require('bluebird');var rp=require(_0x2943('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x2943('0x5'));var attributes=require(_0x2943('0x6'));module[_0x2943('0x7')]=function(_0x27641b,_0x191c65){return _0x27641b['define'](_0x2943('0x8'),attributes,{'tableName':_0x2943('0x9'),'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 f170a80..8bc9f7f 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 _0xdb05=['debug','stringify','error','code','message','info','result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','http','request','then','AnalyticMetric,\x20%s,\x20%s','request\x20sent'];(function(_0x8ef282,_0x417529){var _0x491b86=function(_0x3e7127){while(--_0x3e7127){_0x8ef282['push'](_0x8ef282['shift']());}};_0x491b86(++_0x417529);}(_0xdb05,0x86));var _0x5db0=function(_0x5ad11b,_0x2e602a){_0x5ad11b=_0x5ad11b-0x0;var _0x5edfb6=_0xdb05[_0x5ad11b];return _0x5edfb6;};'use strict';var _=require(_0x5db0('0x0'));var util=require(_0x5db0('0x1'));var moment=require('moment');var BPromise=require(_0x5db0('0x2'));var rs=require(_0x5db0('0x3'));var fs=require('fs');var Redis=require(_0x5db0('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5db0('0x5'));var logger=require('../../config/logger')(_0x5db0('0x6'));var config=require(_0x5db0('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x5db0('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x38007b,_0x332c68,_0x4d3dcc){return new BPromise(function(_0x2e102d,_0x55afff){return client[_0x5db0('0x9')](_0x38007b,_0x4d3dcc)[_0x5db0('0xa')](function(_0x296ddd){logger['info'](_0x5db0('0xb'),_0x332c68,_0x5db0('0xc'));logger[_0x5db0('0xd')]('AnalyticMetric,\x20%s,\x20%s,\x20%s',_0x332c68,_0x5db0('0xc'),JSON[_0x5db0('0xe')](_0x296ddd));if(_0x296ddd[_0x5db0('0xf')]){if(_0x296ddd[_0x5db0('0xf')][_0x5db0('0x10')]===0x1f4){logger[_0x5db0('0xf')]('AnalyticMetric,\x20%s,\x20%s',_0x332c68,_0x296ddd[_0x5db0('0xf')][_0x5db0('0x11')]);return _0x55afff(_0x296ddd[_0x5db0('0xf')][_0x5db0('0x11')]);}logger[_0x5db0('0xf')](_0x5db0('0xb'),_0x332c68,_0x296ddd[_0x5db0('0xf')][_0x5db0('0x11')]);return _0x2e102d(_0x296ddd[_0x5db0('0xf')][_0x5db0('0x11')]);}else{logger[_0x5db0('0x12')](_0x5db0('0xb'),_0x332c68,_0x5db0('0xc'));_0x2e102d(_0x296ddd[_0x5db0('0x13')][_0x5db0('0x11')]);}})[_0x5db0('0x14')](function(_0x15f096){logger[_0x5db0('0xf')](_0x5db0('0xb'),_0x332c68,_0x15f096);_0x55afff(_0x15f096);});});} \ No newline at end of file +var _0x6246=['error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','http','request','info','AnalyticMetric,\x20%s,\x20%s','request\x20sent','debug','AnalyticMetric,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x4c7fb5,_0x2548ef){var _0x2e10ac=function(_0xf7e27c){while(--_0xf7e27c){_0x4c7fb5['push'](_0x4c7fb5['shift']());}};_0x2e10ac(++_0x2548ef);}(_0x6246,0x153));var _0x6624=function(_0x9dbfc6,_0x2c9e46){_0x9dbfc6=_0x9dbfc6-0x0;var _0x521cc5=_0x6246[_0x9dbfc6];return _0x521cc5;};'use strict';var _=require(_0x6624('0x0'));var util=require(_0x6624('0x1'));var moment=require(_0x6624('0x2'));var BPromise=require(_0x6624('0x3'));var rs=require(_0x6624('0x4'));var fs=require('fs');var Redis=require(_0x6624('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6624('0x6'));var logger=require('../../config/logger')(_0x6624('0x7'));var config=require(_0x6624('0x8'));var jayson=require(_0x6624('0x9'));var client=jayson['client'][_0x6624('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x346a58,_0x350129,_0x169f7c){return new BPromise(function(_0x35bff4,_0x65665d){return client[_0x6624('0xb')](_0x346a58,_0x169f7c)['then'](function(_0xd464fe){logger[_0x6624('0xc')](_0x6624('0xd'),_0x350129,_0x6624('0xe'));logger[_0x6624('0xf')](_0x6624('0x10'),_0x350129,_0x6624('0xe'),JSON[_0x6624('0x11')](_0xd464fe));if(_0xd464fe[_0x6624('0x12')]){if(_0xd464fe[_0x6624('0x12')][_0x6624('0x13')]===0x1f4){logger[_0x6624('0x12')](_0x6624('0xd'),_0x350129,_0xd464fe[_0x6624('0x12')][_0x6624('0x14')]);return _0x65665d(_0xd464fe['error'][_0x6624('0x14')]);}logger['error'](_0x6624('0xd'),_0x350129,_0xd464fe[_0x6624('0x12')][_0x6624('0x14')]);return _0x35bff4(_0xd464fe[_0x6624('0x12')]['message']);}else{logger[_0x6624('0xc')](_0x6624('0xd'),_0x350129,_0x6624('0xe'));_0x35bff4(_0xd464fe['result']['message']);}})['catch'](function(_0x1f1ec1){logger[_0x6624('0x12')](_0x6624('0xd'),_0x350129,_0x1f1ec1);_0x65665d(_0x1f1ec1);});});} \ No newline at end of file diff --git a/server/api/analyticMetric/index.js b/server/api/analyticMetric/index.js index c1585e6..b891c1c 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 _0x6dac=['../../components/interaction/service','../../config/environment','./analyticMetric.controller','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x4bd67a,_0x4f9725){var _0x2be5fb=function(_0x33e132){while(--_0x33e132){_0x4bd67a['push'](_0x4bd67a['shift']());}};_0x2be5fb(++_0x4f9725);}(_0x6dac,0x16e));var _0xc6da=function(_0x5ceab5,_0x190d14){_0x5ceab5=_0x5ceab5-0x0;var _0x59cebf=_0x6dac[_0x5ceab5];return _0x59cebf;};'use strict';var multer=require(_0xc6da('0x0'));var util=require(_0xc6da('0x1'));var path=require(_0xc6da('0x2'));var timeout=require(_0xc6da('0x3'));var express=require(_0xc6da('0x4'));var router=express[_0xc6da('0x5')]();var fs_extra=require(_0xc6da('0x6'));var auth=require(_0xc6da('0x7'));var interaction=require(_0xc6da('0x8'));var config=require(_0xc6da('0x9'));var controller=require(_0xc6da('0xa'));router[_0xc6da('0xb')]('/',auth[_0xc6da('0xc')](),controller['index']);router[_0xc6da('0xb')](_0xc6da('0xd'),auth[_0xc6da('0xc')](),controller[_0xc6da('0xe')]);router[_0xc6da('0xf')]('/',auth[_0xc6da('0xc')](),controller[_0xc6da('0x10')]);router[_0xc6da('0x11')](_0xc6da('0xd'),auth['isAuthenticated'](),controller[_0xc6da('0x12')]);router[_0xc6da('0x13')](_0xc6da('0xd'),auth[_0xc6da('0xc')](),controller[_0xc6da('0x14')]);module[_0xc6da('0x15')]=router; \ No newline at end of file +var _0x7cab=['destroy','multer','util','path','express','Router','fs-extra','../../components/interaction/service','get','isAuthenticated','show','post','create','put','update','delete'];(function(_0x4780ae,_0x572fb2){var _0x453ed7=function(_0x328e1e){while(--_0x328e1e){_0x4780ae['push'](_0x4780ae['shift']());}};_0x453ed7(++_0x572fb2);}(_0x7cab,0x91));var _0xb7ca=function(_0x4c445a,_0x4ee80f){_0x4c445a=_0x4c445a-0x0;var _0x2f611c=_0x7cab[_0x4c445a];return _0x2f611c;};'use strict';var multer=require(_0xb7ca('0x0'));var util=require(_0xb7ca('0x1'));var path=require(_0xb7ca('0x2'));var timeout=require('connect-timeout');var express=require(_0xb7ca('0x3'));var router=express[_0xb7ca('0x4')]();var fs_extra=require(_0xb7ca('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb7ca('0x6'));var config=require('../../config/environment');var controller=require('./analyticMetric.controller');router[_0xb7ca('0x7')]('/',auth[_0xb7ca('0x8')](),controller['index']);router[_0xb7ca('0x7')]('/:id',auth[_0xb7ca('0x8')](),controller[_0xb7ca('0x9')]);router[_0xb7ca('0xa')]('/',auth[_0xb7ca('0x8')](),controller[_0xb7ca('0xb')]);router[_0xb7ca('0xc')]('/:id',auth[_0xb7ca('0x8')](),controller[_0xb7ca('0xd')]);router[_0xb7ca('0xe')]('/:id',auth[_0xb7ca('0x8')](),controller[_0xb7ca('0xf')]);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 1d23141..8c1abf0 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 _0x8065=['exports'];(function(_0x519bc2,_0x2274f6){var _0x3ac8e4=function(_0x27b030){while(--_0x27b030){_0x519bc2['push'](_0x519bc2['shift']());}};_0x3ac8e4(++_0x2274f6);}(_0x8065,0x187));var _0x5806=function(_0x19dfbd,_0x1ad8bc){_0x19dfbd=_0x19dfbd-0x0;var _0x3032a4=_0x8065[_0x19dfbd];return _0x3032a4;};'use strict';var Sequelize=require('sequelize');module[_0x5806('0x0')]={'tree':{'type':Sequelize['TEXT'],'allowNull':![]}}; \ No newline at end of file +var _0x5b3f=['sequelize','exports','TEXT'];(function(_0x2678d6,_0x4e2001){var _0x475503=function(_0x34b23d){while(--_0x34b23d){_0x2678d6['push'](_0x2678d6['shift']());}};_0x475503(++_0x4e2001);}(_0x5b3f,0x159));var _0xf5b3=function(_0x19decf,_0x1ffaae){_0x19decf=_0x19decf-0x0;var _0x56e7eb=_0x5b3f[_0x19decf];return _0x56e7eb;};'use strict';var Sequelize=require(_0xf5b3('0x0'));module[_0xf5b3('0x1')]={'tree':{'type':Sequelize[_0xf5b3('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.controller.js b/server/api/analyticTreeReport/analyticTreeReport.controller.js index 1ce41b3..143a32d 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 _0xdd0a=['nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','index','map','AnalyticTreeReport','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','hasOwnProperty'];(function(_0x58f1f2,_0x5d44a8){var _0x1c96b5=function(_0x6d56fa){while(--_0x6d56fa){_0x58f1f2['push'](_0x58f1f2['shift']());}};_0x1c96b5(++_0x5d44a8);}(_0xdd0a,0xfe));var _0xadd0=function(_0x48e370,_0x4b7b22){_0x48e370=_0x48e370-0x0;var _0x2ac719=_0xdd0a[_0x48e370];return _0x2ac719;};'use strict';var emlformat=require(_0xadd0('0x0'));var rimraf=require(_0xadd0('0x1'));var zipdir=require(_0xadd0('0x2'));var jsonpatch=require(_0xadd0('0x3'));var rp=require(_0xadd0('0x4'));var moment=require(_0xadd0('0x5'));var BPromise=require(_0xadd0('0x6'));var Mustache=require(_0xadd0('0x7'));var util=require(_0xadd0('0x8'));var path=require(_0xadd0('0x9'));var sox=require(_0xadd0('0xa'));var csv=require('to-csv');var ejs=require(_0xadd0('0xb'));var fs=require('fs');var fs_extra=require(_0xadd0('0xc'));var _=require('lodash');var squel=require(_0xadd0('0xd'));var crypto=require(_0xadd0('0xe'));var jsforce=require(_0xadd0('0xf'));var deskjs=require(_0xadd0('0x10'));var toCsv=require(_0xadd0('0x11'));var querystring=require(_0xadd0('0x12'));var Papa=require(_0xadd0('0x13'));var Redis=require(_0xadd0('0x14'));var authService=require(_0xadd0('0x15'));var qs=require(_0xadd0('0x16'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xadd0('0x17'));var logger=require(_0xadd0('0x18'))('api');var utils=require('../../config/utils');var config=require(_0xadd0('0x19'));var licenseUtil=require(_0xadd0('0x1a'));var db=require(_0xadd0('0x1b'))['db'];function respondWithStatusCode(_0x11ab4c,_0x59d81a){_0x59d81a=_0x59d81a||0xcc;return function(_0x2c5fcb){if(_0x2c5fcb){return _0x11ab4c['sendStatus'](_0x59d81a);}return _0x11ab4c[_0xadd0('0x1c')](_0x59d81a)[_0xadd0('0x1d')]();};}function respondWithResult(_0x4825f8,_0x2a36be){_0x2a36be=_0x2a36be||0xc8;return function(_0x47d362){if(_0x47d362){return _0x4825f8[_0xadd0('0x1c')](_0x2a36be)['json'](_0x47d362);}};}function respondWithFilteredResult(_0xcb2918,_0x192345){return function(_0x1180b4){if(_0x1180b4){var _0x5dcfcc=typeof _0x192345[_0xadd0('0x1e')]===_0xadd0('0x1f')&&typeof _0x192345[_0xadd0('0x20')]==='undefined';var _0x2f4c0c=_0x1180b4[_0xadd0('0x21')];var _0x6995ab=_0x5dcfcc?0x0:_0x192345[_0xadd0('0x1e')];var _0x18cc19=_0x5dcfcc?_0x1180b4[_0xadd0('0x21')]:_0x192345[_0xadd0('0x1e')]+_0x192345['limit'];var _0x9b2cc4;if(_0x18cc19>=_0x2f4c0c){_0x18cc19=_0x2f4c0c;_0x9b2cc4=0xc8;}else{_0x9b2cc4=0xce;}_0xcb2918[_0xadd0('0x1c')](_0x9b2cc4);return _0xcb2918[_0xadd0('0x22')](_0xadd0('0x23'),_0x6995ab+'-'+_0x18cc19+'/'+_0x2f4c0c)[_0xadd0('0x24')](_0x1180b4);}return null;};}function patchUpdates(_0x25649f){return function(_0x1c1a1e){try{jsonpatch[_0xadd0('0x25')](_0x1c1a1e,_0x25649f,!![]);}catch(_0xee88ca){return BPromise[_0xadd0('0x26')](_0xee88ca);}return _0x1c1a1e[_0xadd0('0x27')]();};}function saveUpdates(_0x5bd1ca,_0x4754c7){return function(_0x1702fb){if(_0x1702fb){return _0x1702fb[_0xadd0('0x28')](_0x5bd1ca)[_0xadd0('0x29')](function(_0x3a6722){return _0x3a6722;});}return null;};}function removeEntity(_0x361028,_0x5154d2){return function(_0x3e24e6){if(_0x3e24e6){return _0x3e24e6['destroy']()[_0xadd0('0x29')](function(){_0x361028[_0xadd0('0x1c')](0xcc)[_0xadd0('0x1d')]();});}};}function handleEntityNotFound(_0x2b5227,_0x1d68c7){return function(_0x452886){if(!_0x452886){_0x2b5227['sendStatus'](0x194);}return _0x452886;};}function handleError(_0x3a4c87,_0x5eb4f2){_0x5eb4f2=_0x5eb4f2||0x1f4;return function(_0x4dc423){logger[_0xadd0('0x2a')](_0x4dc423[_0xadd0('0x2b')]);if(_0x4dc423[_0xadd0('0x2c')]){delete _0x4dc423[_0xadd0('0x2c')];}_0x3a4c87[_0xadd0('0x1c')](_0x5eb4f2)['send'](_0x4dc423);};}exports[_0xadd0('0x2d')]=function(_0x119bec,_0x5960e8){var _0x45b04a={},_0x42281f={},_0x1ed7ac={'count':0x0,'rows':[]};var _0x30a192=_[_0xadd0('0x2e')](db[_0xadd0('0x2f')][_0xadd0('0x30')],function(_0x194ba4){return{'name':_0x194ba4[_0xadd0('0x31')],'type':_0x194ba4[_0xadd0('0x32')]['key']};});_0x42281f[_0xadd0('0x33')]=_[_0xadd0('0x2e')](_0x30a192,_0xadd0('0x2c'));_0x42281f[_0xadd0('0x34')]=_[_0xadd0('0x35')](_0x119bec['query']);_0x42281f['filters']=_[_0xadd0('0x36')](_0x42281f[_0xadd0('0x33')],_0x42281f[_0xadd0('0x34')]);_0x45b04a[_0xadd0('0x37')]=_['intersection'](_0x42281f[_0xadd0('0x33')],qs[_0xadd0('0x38')](_0x119bec[_0xadd0('0x34')]['fields']));_0x45b04a['attributes']=_0x45b04a[_0xadd0('0x37')]['length']?_0x45b04a['attributes']:_0x42281f['model'];if(!_0x119bec[_0xadd0('0x34')][_0xadd0('0x39')](_0xadd0('0x3a'))){_0x45b04a[_0xadd0('0x20')]=qs['limit'](_0x119bec[_0xadd0('0x34')][_0xadd0('0x20')]);_0x45b04a[_0xadd0('0x1e')]=qs[_0xadd0('0x1e')](_0x119bec['query'][_0xadd0('0x1e')]);}_0x45b04a[_0xadd0('0x3b')]=qs['sort'](_0x119bec[_0xadd0('0x34')][_0xadd0('0x3c')]);_0x45b04a['where']=qs[_0xadd0('0x3d')](_[_0xadd0('0x3e')](_0x119bec['query'],_0x42281f[_0xadd0('0x3d')]),_0x30a192);if(_0x119bec[_0xadd0('0x34')][_0xadd0('0x3f')]){_0x45b04a['where']=_['merge'](_0x45b04a[_0xadd0('0x40')],{'$or':_[_0xadd0('0x2e')](_0x30a192,function(_0x1a40a1){if(_0x1a40a1[_0xadd0('0x32')]!=='VIRTUAL'){var _0x2e5a3c={};_0x2e5a3c[_0x1a40a1[_0xadd0('0x2c')]]={'$like':'%'+_0x119bec[_0xadd0('0x34')][_0xadd0('0x3f')]+'%'};return _0x2e5a3c;}})});}_0x45b04a=_[_0xadd0('0x41')]({},_0x45b04a,_0x119bec[_0xadd0('0x42')]);var _0x3fb1be={'where':_0x45b04a['where']};return db[_0xadd0('0x2f')][_0xadd0('0x21')](_0x3fb1be)['then'](function(_0x5d5769){_0x1ed7ac[_0xadd0('0x21')]=_0x5d5769;if(_0x119bec[_0xadd0('0x34')][_0xadd0('0x43')]){_0x45b04a[_0xadd0('0x44')]=[{'all':!![]}];}return db[_0xadd0('0x2f')][_0xadd0('0x45')](_0x45b04a);})['then'](function(_0x185512){_0x1ed7ac[_0xadd0('0x46')]=_0x185512;return _0x1ed7ac;})['then'](respondWithFilteredResult(_0x5960e8,_0x45b04a))[_0xadd0('0x47')](handleError(_0x5960e8,null));};exports[_0xadd0('0x48')]=function(_0x203a83,_0x4fc4e8){var _0x4e9053={'raw':!![],'where':{'id':_0x203a83[_0xadd0('0x49')]['id']}},_0x4f6f0c={};_0x4f6f0c[_0xadd0('0x33')]=_[_0xadd0('0x35')](db[_0xadd0('0x2f')][_0xadd0('0x30')]);_0x4f6f0c[_0xadd0('0x34')]=_['keys'](_0x203a83[_0xadd0('0x34')]);_0x4f6f0c[_0xadd0('0x3d')]=_[_0xadd0('0x36')](_0x4f6f0c[_0xadd0('0x33')],_0x4f6f0c[_0xadd0('0x34')]);_0x4e9053[_0xadd0('0x37')]=_[_0xadd0('0x36')](_0x4f6f0c[_0xadd0('0x33')],qs[_0xadd0('0x38')](_0x203a83[_0xadd0('0x34')][_0xadd0('0x38')]));_0x4e9053[_0xadd0('0x37')]=_0x4e9053[_0xadd0('0x37')]['length']?_0x4e9053[_0xadd0('0x37')]:_0x4f6f0c[_0xadd0('0x33')];if(_0x203a83[_0xadd0('0x34')][_0xadd0('0x43')]){_0x4e9053[_0xadd0('0x44')]=[{'all':!![]}];}_0x4e9053=_['merge']({},_0x4e9053,_0x203a83['options']);return db[_0xadd0('0x2f')][_0xadd0('0x4a')](_0x4e9053)['then'](handleEntityNotFound(_0x4fc4e8,null))['then'](respondWithResult(_0x4fc4e8,null))[_0xadd0('0x47')](handleError(_0x4fc4e8,null));};exports['create']=function(_0x376fa5,_0x289e6f){return db[_0xadd0('0x2f')][_0xadd0('0x4b')](_0x376fa5['body'],{})[_0xadd0('0x29')](respondWithResult(_0x289e6f,0xc9))['catch'](handleError(_0x289e6f,null));};exports[_0xadd0('0x28')]=function(_0x5dbc57,_0x37f751){if(_0x5dbc57[_0xadd0('0x4c')]['id']){delete _0x5dbc57[_0xadd0('0x4c')]['id'];}return db[_0xadd0('0x2f')][_0xadd0('0x4a')]({'where':{'id':_0x5dbc57['params']['id']}})[_0xadd0('0x29')](handleEntityNotFound(_0x37f751,null))[_0xadd0('0x29')](saveUpdates(_0x5dbc57['body'],null))[_0xadd0('0x29')](respondWithResult(_0x37f751,null))[_0xadd0('0x47')](handleError(_0x37f751,null));};exports[_0xadd0('0x4d')]=function(_0x3f8cc3,_0x352142){return db[_0xadd0('0x2f')][_0xadd0('0x4a')]({'where':{'id':_0x3f8cc3[_0xadd0('0x49')]['id']}})[_0xadd0('0x29')](handleEntityNotFound(_0x352142,null))[_0xadd0('0x29')](removeEntity(_0x352142,null))['catch'](handleError(_0x352142,null));}; \ No newline at end of file +var _0x2575=['type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','rawAttributes','keys','include','find','create','body','eml-format','fast-json-patch','moment','bluebird','mustache','util','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/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','AnalyticTreeReport','fieldName'];(function(_0xd4a717,_0x423213){var _0x22c4f6=function(_0x3c602f){while(--_0x3c602f){_0xd4a717['push'](_0xd4a717['shift']());}};_0x22c4f6(++_0x423213);}(_0x2575,0x1e5));var _0x5257=function(_0x1de390,_0x2fec64){_0x1de390=_0x1de390-0x0;var _0x438b39=_0x2575[_0x1de390];return _0x438b39;};'use strict';var emlformat=require(_0x5257('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5257('0x1'));var rp=require('request-promise');var moment=require(_0x5257('0x2'));var BPromise=require(_0x5257('0x3'));var Mustache=require(_0x5257('0x4'));var util=require(_0x5257('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0x5257('0x6'));var ejs=require(_0x5257('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x5257('0x8'));var squel=require(_0x5257('0x9'));var crypto=require(_0x5257('0xa'));var jsforce=require(_0x5257('0xb'));var deskjs=require(_0x5257('0xc'));var toCsv=require(_0x5257('0x6'));var querystring=require(_0x5257('0xd'));var Papa=require(_0x5257('0xe'));var Redis=require(_0x5257('0xf'));var authService=require(_0x5257('0x10'));var qs=require(_0x5257('0x11'));var as=require(_0x5257('0x12'));var hardwareService=require(_0x5257('0x13'));var logger=require(_0x5257('0x14'))(_0x5257('0x15'));var utils=require(_0x5257('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5257('0x17'));var db=require(_0x5257('0x18'))['db'];function respondWithStatusCode(_0x514a94,_0x4ae497){_0x4ae497=_0x4ae497||0xcc;return function(_0x1a790e){if(_0x1a790e){return _0x514a94[_0x5257('0x19')](_0x4ae497);}return _0x514a94[_0x5257('0x1a')](_0x4ae497)[_0x5257('0x1b')]();};}function respondWithResult(_0x53377c,_0x2441ae){_0x2441ae=_0x2441ae||0xc8;return function(_0x27750e){if(_0x27750e){return _0x53377c['status'](_0x2441ae)['json'](_0x27750e);}};}function respondWithFilteredResult(_0x33c9fb,_0x5e26f9){return function(_0x479624){if(_0x479624){var _0x184940=typeof _0x5e26f9['offset']===_0x5257('0x1c')&&typeof _0x5e26f9[_0x5257('0x1d')]===_0x5257('0x1c');var _0x5acf4b=_0x479624[_0x5257('0x1e')];var _0x134920=_0x184940?0x0:_0x5e26f9[_0x5257('0x1f')];var _0x4c4c18=_0x184940?_0x479624[_0x5257('0x1e')]:_0x5e26f9[_0x5257('0x1f')]+_0x5e26f9[_0x5257('0x1d')];var _0x3637e5;if(_0x4c4c18>=_0x5acf4b){_0x4c4c18=_0x5acf4b;_0x3637e5=0xc8;}else{_0x3637e5=0xce;}_0x33c9fb[_0x5257('0x1a')](_0x3637e5);return _0x33c9fb[_0x5257('0x20')](_0x5257('0x21'),_0x134920+'-'+_0x4c4c18+'/'+_0x5acf4b)['json'](_0x479624);}return null;};}function patchUpdates(_0x5c3045){return function(_0x360860){try{jsonpatch[_0x5257('0x22')](_0x360860,_0x5c3045,!![]);}catch(_0x1013e2){return BPromise['reject'](_0x1013e2);}return _0x360860[_0x5257('0x23')]();};}function saveUpdates(_0x144285,_0x104beb){return function(_0x53ee70){if(_0x53ee70){return _0x53ee70[_0x5257('0x24')](_0x144285)[_0x5257('0x25')](function(_0x5c7e1f){return _0x5c7e1f;});}return null;};}function removeEntity(_0xb1296d,_0x213f2a){return function(_0x336df3){if(_0x336df3){return _0x336df3[_0x5257('0x26')]()[_0x5257('0x25')](function(){_0xb1296d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x3fb12a,_0x4768bc){return function(_0x59b947){if(!_0x59b947){_0x3fb12a[_0x5257('0x19')](0x194);}return _0x59b947;};}function handleError(_0x3615bf,_0x4c8aee){_0x4c8aee=_0x4c8aee||0x1f4;return function(_0x46639a){logger[_0x5257('0x27')](_0x46639a[_0x5257('0x28')]);if(_0x46639a['name']){delete _0x46639a[_0x5257('0x29')];}_0x3615bf[_0x5257('0x1a')](_0x4c8aee)[_0x5257('0x2a')](_0x46639a);};}exports[_0x5257('0x2b')]=function(_0x4e58c3,_0x4fc24a){var _0x396d5e={},_0x1b4ff6={},_0x4d8fff={'count':0x0,'rows':[]};var _0x428153=_[_0x5257('0x2c')](db[_0x5257('0x2d')]['rawAttributes'],function(_0x25805a){return{'name':_0x25805a[_0x5257('0x2e')],'type':_0x25805a[_0x5257('0x2f')]['key']};});_0x1b4ff6[_0x5257('0x30')]=_['map'](_0x428153,'name');_0x1b4ff6[_0x5257('0x31')]=_['keys'](_0x4e58c3[_0x5257('0x31')]);_0x1b4ff6[_0x5257('0x32')]=_[_0x5257('0x33')](_0x1b4ff6[_0x5257('0x30')],_0x1b4ff6[_0x5257('0x31')]);_0x396d5e[_0x5257('0x34')]=_[_0x5257('0x33')](_0x1b4ff6[_0x5257('0x30')],qs[_0x5257('0x35')](_0x4e58c3[_0x5257('0x31')]['fields']));_0x396d5e[_0x5257('0x34')]=_0x396d5e[_0x5257('0x34')][_0x5257('0x36')]?_0x396d5e['attributes']:_0x1b4ff6[_0x5257('0x30')];if(!_0x4e58c3[_0x5257('0x31')][_0x5257('0x37')](_0x5257('0x38'))){_0x396d5e[_0x5257('0x1d')]=qs['limit'](_0x4e58c3['query'][_0x5257('0x1d')]);_0x396d5e[_0x5257('0x1f')]=qs[_0x5257('0x1f')](_0x4e58c3['query'][_0x5257('0x1f')]);}_0x396d5e['order']=qs[_0x5257('0x39')](_0x4e58c3['query'][_0x5257('0x39')]);_0x396d5e[_0x5257('0x3a')]=qs[_0x5257('0x32')](_[_0x5257('0x3b')](_0x4e58c3['query'],_0x1b4ff6['filters']),_0x428153);if(_0x4e58c3[_0x5257('0x31')][_0x5257('0x3c')]){_0x396d5e[_0x5257('0x3a')]=_[_0x5257('0x3d')](_0x396d5e['where'],{'$or':_[_0x5257('0x2c')](_0x428153,function(_0x43b509){if(_0x43b509[_0x5257('0x2f')]!==_0x5257('0x3e')){var _0x4a3ab7={};_0x4a3ab7[_0x43b509[_0x5257('0x29')]]={'$like':'%'+_0x4e58c3[_0x5257('0x31')]['filter']+'%'};return _0x4a3ab7;}})});}_0x396d5e=_[_0x5257('0x3d')]({},_0x396d5e,_0x4e58c3[_0x5257('0x3f')]);var _0x5e3010={'where':_0x396d5e[_0x5257('0x3a')]};return db[_0x5257('0x2d')][_0x5257('0x1e')](_0x5e3010)[_0x5257('0x25')](function(_0x2cf2f8){_0x4d8fff[_0x5257('0x1e')]=_0x2cf2f8;if(_0x4e58c3['query'][_0x5257('0x40')]){_0x396d5e['include']=[{'all':!![]}];}return db[_0x5257('0x2d')][_0x5257('0x41')](_0x396d5e);})[_0x5257('0x25')](function(_0x1ad9c5){_0x4d8fff[_0x5257('0x42')]=_0x1ad9c5;return _0x4d8fff;})[_0x5257('0x25')](respondWithFilteredResult(_0x4fc24a,_0x396d5e))[_0x5257('0x43')](handleError(_0x4fc24a,null));};exports[_0x5257('0x44')]=function(_0x5ba067,_0x248c4c){var _0x281ed1={'raw':!![],'where':{'id':_0x5ba067[_0x5257('0x45')]['id']}},_0x38229e={};_0x38229e[_0x5257('0x30')]=_['keys'](db[_0x5257('0x2d')][_0x5257('0x46')]);_0x38229e[_0x5257('0x31')]=_[_0x5257('0x47')](_0x5ba067['query']);_0x38229e[_0x5257('0x32')]=_[_0x5257('0x33')](_0x38229e['model'],_0x38229e[_0x5257('0x31')]);_0x281ed1[_0x5257('0x34')]=_[_0x5257('0x33')](_0x38229e[_0x5257('0x30')],qs[_0x5257('0x35')](_0x5ba067[_0x5257('0x31')][_0x5257('0x35')]));_0x281ed1[_0x5257('0x34')]=_0x281ed1['attributes'][_0x5257('0x36')]?_0x281ed1[_0x5257('0x34')]:_0x38229e[_0x5257('0x30')];if(_0x5ba067[_0x5257('0x31')]['includeAll']){_0x281ed1[_0x5257('0x48')]=[{'all':!![]}];}_0x281ed1=_[_0x5257('0x3d')]({},_0x281ed1,_0x5ba067[_0x5257('0x3f')]);return db[_0x5257('0x2d')][_0x5257('0x49')](_0x281ed1)[_0x5257('0x25')](handleEntityNotFound(_0x248c4c,null))['then'](respondWithResult(_0x248c4c,null))[_0x5257('0x43')](handleError(_0x248c4c,null));};exports[_0x5257('0x4a')]=function(_0x4295af,_0x5646ba){return db[_0x5257('0x2d')][_0x5257('0x4a')](_0x4295af[_0x5257('0x4b')],{})['then'](respondWithResult(_0x5646ba,0xc9))[_0x5257('0x43')](handleError(_0x5646ba,null));};exports[_0x5257('0x24')]=function(_0x589565,_0x11c116){if(_0x589565[_0x5257('0x4b')]['id']){delete _0x589565[_0x5257('0x4b')]['id'];}return db[_0x5257('0x2d')][_0x5257('0x49')]({'where':{'id':_0x589565[_0x5257('0x45')]['id']}})[_0x5257('0x25')](handleEntityNotFound(_0x11c116,null))[_0x5257('0x25')](saveUpdates(_0x589565[_0x5257('0x4b')],null))['then'](respondWithResult(_0x11c116,null))[_0x5257('0x43')](handleError(_0x11c116,null));};exports[_0x5257('0x26')]=function(_0x4fd948,_0x11ca9f){return db[_0x5257('0x2d')][_0x5257('0x49')]({'where':{'id':_0x4fd948['params']['id']}})['then'](handleEntityNotFound(_0x11ca9f,null))[_0x5257('0x25')](removeEntity(_0x11ca9f,null))[_0x5257('0x43')](handleError(_0x11ca9f,null));}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.model.js b/server/api/analyticTreeReport/analyticTreeReport.model.js index 7be2760..f75f43f 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 _0x606a=['AnalyticTreeReport','analytics_report_trees','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./analyticTreeReport.attributes','exports','define'];(function(_0x5d4600,_0x2c572f){var _0x5e71ef=function(_0x4f046f){while(--_0x4f046f){_0x5d4600['push'](_0x5d4600['shift']());}};_0x5e71ef(++_0x2c572f);}(_0x606a,0x16e));var _0xa606=function(_0xbc2a02,_0xc8d757){_0xbc2a02=_0xbc2a02-0x0;var _0x133be5=_0x606a[_0xbc2a02];return _0x133be5;};'use strict';var _=require('lodash');var util=require(_0xa606('0x0'));var logger=require(_0xa606('0x1'))(_0xa606('0x2'));var moment=require(_0xa606('0x3'));var BPromise=require(_0xa606('0x4'));var rp=require(_0xa606('0x5'));var fs=require('fs');var path=require(_0xa606('0x6'));var rimraf=require('rimraf');var config=require(_0xa606('0x7'));var attributes=require(_0xa606('0x8'));module[_0xa606('0x9')]=function(_0x12852c,_0x20756a){return _0x12852c[_0xa606('0xa')](_0xa606('0xb'),attributes,{'tableName':_0xa606('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7b91=['rimraf','./analyticTreeReport.attributes','exports','define','AnalyticTreeReport','analytics_report_trees','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x20ef6a,_0x2c72ec){var _0x3397e9=function(_0x2e5c0b){while(--_0x2e5c0b){_0x20ef6a['push'](_0x20ef6a['shift']());}};_0x3397e9(++_0x2c72ec);}(_0x7b91,0xe3));var _0x17b9=function(_0x30535a,_0x12f97e){_0x30535a=_0x30535a-0x0;var _0x4f4d39=_0x7b91[_0x30535a];return _0x4f4d39;};'use strict';var _=require(_0x17b9('0x0'));var util=require(_0x17b9('0x1'));var logger=require('../../config/logger')(_0x17b9('0x2'));var moment=require(_0x17b9('0x3'));var BPromise=require(_0x17b9('0x4'));var rp=require(_0x17b9('0x5'));var fs=require('fs');var path=require(_0x17b9('0x6'));var rimraf=require(_0x17b9('0x7'));var config=require('../../config/environment');var attributes=require(_0x17b9('0x8'));module[_0x17b9('0x9')]=function(_0x5dd8ba,_0x32227c){return _0x5dd8ba[_0x17b9('0xa')](_0x17b9('0xb'),attributes,{'tableName':_0x17b9('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/analyticTreeReport/analyticTreeReport.rpc.js b/server/api/analyticTreeReport/analyticTreeReport.rpc.js index 2aeab97..46f4677 100644 --- a/server/api/analyticTreeReport/analyticTreeReport.rpc.js +++ b/server/api/analyticTreeReport/analyticTreeReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','AnalyticTreeReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x38f619,_0x10675e){var _0x4554ab=function(_0x367abf){while(--_0x367abf){_0x38f619['push'](_0x38f619['shift']());}};_0x4554ab(++_0x10675e);}(_0x5f2f,0x73));var _0xf5f2=function(_0x201b89,_0x4fd21f){_0x201b89=_0x201b89-0x0;var _0x2a7b85=_0x5f2f[_0x201b89];return _0x2a7b85;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('AnalyticTreeReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});} \ No newline at end of file +var _0x1261=['then','info','AnalyticTreeReport,\x20%s,\x20%s','request\x20sent','AnalyticTreeReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request'];(function(_0x1a3796,_0x1ac06a){var _0x132cca=function(_0x110e21){while(--_0x110e21){_0x1a3796['push'](_0x1a3796['shift']());}};_0x132cca(++_0x1ac06a);}(_0x1261,0x144));var _0x1126=function(_0x4b15a4,_0x4241fe){_0x4b15a4=_0x4b15a4-0x0;var _0x40a783=_0x1261[_0x4b15a4];return _0x40a783;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require(_0x1126('0x3'));var fs=require('fs');var Redis=require(_0x1126('0x4'));var db=require(_0x1126('0x5'))['db'];var utils=require(_0x1126('0x6'));var logger=require(_0x1126('0x7'))(_0x1126('0x8'));var config=require(_0x1126('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x1126('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x907180,_0x4f239c,_0x17e5f0){return new BPromise(function(_0x28772d,_0x245be9){return client[_0x1126('0xb')](_0x907180,_0x17e5f0)[_0x1126('0xc')](function(_0x59cfa1){logger[_0x1126('0xd')](_0x1126('0xe'),_0x4f239c,_0x1126('0xf'));logger['debug'](_0x1126('0x10'),_0x4f239c,'request\x20sent',JSON['stringify'](_0x59cfa1));if(_0x59cfa1[_0x1126('0x11')]){if(_0x59cfa1['error'][_0x1126('0x12')]===0x1f4){logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);return _0x245be9(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}logger[_0x1126('0x11')](_0x1126('0xe'),_0x4f239c,_0x59cfa1['error']['message']);return _0x28772d(_0x59cfa1[_0x1126('0x11')][_0x1126('0x13')]);}else{logger[_0x1126('0xd')]('AnalyticTreeReport,\x20%s,\x20%s',_0x4f239c,_0x1126('0xf'));_0x28772d(_0x59cfa1['result'][_0x1126('0x13')]);}})[_0x1126('0x14')](function(_0x257b5f){logger['error'](_0x1126('0xe'),_0x4f239c,_0x257b5f);_0x245be9(_0x257b5f);});});} \ No newline at end of file diff --git a/server/api/analyticTreeReport/index.js b/server/api/analyticTreeReport/index.js index 9627699..c4b254d 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 _0x5e6c=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./analyticTreeReport.controller','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x58ffd1,_0x1fbfc5){var _0x255219=function(_0x2be155){while(--_0x2be155){_0x58ffd1['push'](_0x58ffd1['shift']());}};_0x255219(++_0x1fbfc5);}(_0x5e6c,0x1dc));var _0xc5e6=function(_0x596e08,_0x552c0a){_0x596e08=_0x596e08-0x0;var _0x25cd55=_0x5e6c[_0x596e08];return _0x25cd55;};'use strict';var multer=require(_0xc5e6('0x0'));var util=require(_0xc5e6('0x1'));var path=require(_0xc5e6('0x2'));var timeout=require(_0xc5e6('0x3'));var express=require('express');var router=express[_0xc5e6('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc5e6('0x5'));var interaction=require(_0xc5e6('0x6'));var config=require(_0xc5e6('0x7'));var controller=require(_0xc5e6('0x8'));router['get']('/',auth[_0xc5e6('0x9')](),controller[_0xc5e6('0xa')]);router['get'](_0xc5e6('0xb'),auth[_0xc5e6('0x9')](),controller[_0xc5e6('0xc')]);router[_0xc5e6('0xd')]('/',auth[_0xc5e6('0x9')](),controller[_0xc5e6('0xe')]);router[_0xc5e6('0xf')]('/:id',auth['isAuthenticated'](),controller[_0xc5e6('0x10')]);router[_0xc5e6('0x11')](_0xc5e6('0xb'),auth[_0xc5e6('0x9')](),controller[_0xc5e6('0x12')]);module[_0xc5e6('0x13')]=router; \ No newline at end of file +var _0x4b9a=['util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','/:id','show','post','put','delete','destroy','multer'];(function(_0x30a976,_0x1df714){var _0x67299a=function(_0x20f909){while(--_0x20f909){_0x30a976['push'](_0x30a976['shift']());}};_0x67299a(++_0x1df714);}(_0x4b9a,0x1d0));var _0xa4b9=function(_0x4d767f,_0x4473ec){_0x4d767f=_0x4d767f-0x0;var _0x3b096d=_0x4b9a[_0x4d767f];return _0x3b096d;};'use strict';var multer=require(_0xa4b9('0x0'));var util=require(_0xa4b9('0x1'));var path=require(_0xa4b9('0x2'));var timeout=require(_0xa4b9('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0xa4b9('0x4'));var auth=require(_0xa4b9('0x5'));var interaction=require(_0xa4b9('0x6'));var config=require('../../config/environment');var controller=require('./analyticTreeReport.controller');router[_0xa4b9('0x7')]('/',auth[_0xa4b9('0x8')](),controller['index']);router['get'](_0xa4b9('0x9'),auth['isAuthenticated'](),controller[_0xa4b9('0xa')]);router[_0xa4b9('0xb')]('/',auth[_0xa4b9('0x8')](),controller['create']);router[_0xa4b9('0xc')](_0xa4b9('0x9'),auth[_0xa4b9('0x8')](),controller['update']);router[_0xa4b9('0xd')](_0xa4b9('0x9'),auth[_0xa4b9('0x8')](),controller[_0xa4b9('0xe')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/attachment/attachment.attributes.js b/server/api/attachment/attachment.attributes.js index 7fa1e49..124cd43 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 _0xe189=['sequelize','STRING'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xe189,0x194));var _0x9e18=function(_0x10ac9a,_0x2f67a6){_0x10ac9a=_0x10ac9a-0x0;var _0x198567=_0xe189[_0x10ac9a];return _0x198567;};'use strict';var Sequelize=require(_0x9e18('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0x9e18('0x1')]},'type':{'type':Sequelize[_0x9e18('0x1')]}}; \ No newline at end of file +var _0xf0cc=['STRING','sequelize'];(function(_0x5318eb,_0x166f7d){var _0x188659=function(_0x4ef5dd){while(--_0x4ef5dd){_0x5318eb['push'](_0x5318eb['shift']());}};_0x188659(++_0x166f7d);}(_0xf0cc,0xa7));var _0xcf0c=function(_0x571035,_0x1ebfc7){_0x571035=_0x571035-0x0;var _0x369f11=_0xf0cc[_0x571035];return _0x369f11;};'use strict';var Sequelize=require(_0xcf0c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'basename':{'type':Sequelize[_0xcf0c('0x1')]},'type':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/attachment/attachment.controller.js b/server/api/attachment/attachment.controller.js index 0dfd2c6..f2015be 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 _0x9f1e=['file','originalname','basename','mimetype','download','findOne','ChatOfflineMessageId','join','offline-chat/','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','count','offset','set','json','apply','reject','save','update','then','destroy','name','index','map','rawAttributes','fieldName','type','key','query','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','filter','options','Attachment','include','findAll','rows','keys','length','find','catch','clone','params','includeAll','get','omit','createdAt','updatedAt','body','create'];(function(_0x197abc,_0x2c6868){var _0xa85206=function(_0x3dbe6a){while(--_0x3dbe6a){_0x197abc['push'](_0x197abc['shift']());}};_0xa85206(++_0x2c6868);}(_0x9f1e,0x1b7));var _0xe9f1=function(_0x20ad38,_0x5492a5){_0x20ad38=_0x20ad38-0x0;var _0xb41a2c=_0x9f1e[_0x20ad38];return _0xb41a2c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe9f1('0x0'));var zipdir=require(_0xe9f1('0x1'));var jsonpatch=require(_0xe9f1('0x2'));var rp=require(_0xe9f1('0x3'));var moment=require('moment');var BPromise=require(_0xe9f1('0x4'));var Mustache=require(_0xe9f1('0x5'));var util=require(_0xe9f1('0x6'));var path=require(_0xe9f1('0x7'));var sox=require('sox');var csv=require(_0xe9f1('0x8'));var ejs=require(_0xe9f1('0x9'));var fs=require('fs');var fs_extra=require(_0xe9f1('0xa'));var _=require(_0xe9f1('0xb'));var squel=require(_0xe9f1('0xc'));var crypto=require('crypto');var jsforce=require(_0xe9f1('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xe9f1('0x8'));var querystring=require(_0xe9f1('0xe'));var Papa=require('papaparse');var Redis=require(_0xe9f1('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xe9f1('0x10'));var as=require(_0xe9f1('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xe9f1('0x12'));var utils=require(_0xe9f1('0x13'));var config=require(_0xe9f1('0x14'));var licenseUtil=require(_0xe9f1('0x15'));var db=require(_0xe9f1('0x16'))['db'];function respondWithStatusCode(_0x240e3f,_0x579165){_0x579165=_0x579165||0xcc;return function(_0x43269f){if(_0x43269f){return _0x240e3f[_0xe9f1('0x17')](_0x579165);}return _0x240e3f[_0xe9f1('0x18')](_0x579165)[_0xe9f1('0x19')]();};}function respondWithResult(_0x5949b9,_0x4b42a7){_0x4b42a7=_0x4b42a7||0xc8;return function(_0x46b028){if(_0x46b028){return _0x5949b9[_0xe9f1('0x18')](_0x4b42a7)['json'](_0x46b028);}};}function respondWithFilteredResult(_0x4e524f,_0x170fd0){return function(_0x2eaf3d){if(_0x2eaf3d){var _0x26b1a1=typeof _0x170fd0['offset']===_0xe9f1('0x1a')&&typeof _0x170fd0[_0xe9f1('0x1b')]===_0xe9f1('0x1a');var _0x415b4a=_0x2eaf3d[_0xe9f1('0x1c')];var _0x2b1851=_0x26b1a1?0x0:_0x170fd0[_0xe9f1('0x1d')];var _0x2d448e=_0x26b1a1?_0x2eaf3d['count']:_0x170fd0[_0xe9f1('0x1d')]+_0x170fd0['limit'];var _0x1d15b8;if(_0x2d448e>=_0x415b4a){_0x2d448e=_0x415b4a;_0x1d15b8=0xc8;}else{_0x1d15b8=0xce;}_0x4e524f[_0xe9f1('0x18')](_0x1d15b8);return _0x4e524f[_0xe9f1('0x1e')]('Content-Range',_0x2b1851+'-'+_0x2d448e+'/'+_0x415b4a)[_0xe9f1('0x1f')](_0x2eaf3d);}return null;};}function patchUpdates(_0x297a84){return function(_0x513c57){try{jsonpatch[_0xe9f1('0x20')](_0x513c57,_0x297a84,!![]);}catch(_0x34aff5){return BPromise[_0xe9f1('0x21')](_0x34aff5);}return _0x513c57[_0xe9f1('0x22')]();};}function saveUpdates(_0x226510,_0x1784ab){return function(_0x3871fa){if(_0x3871fa){return _0x3871fa[_0xe9f1('0x23')](_0x226510)[_0xe9f1('0x24')](function(_0x13e7ac){return _0x13e7ac;});}return null;};}function removeEntity(_0x26e9fa,_0x5cf313){return function(_0x4c7184){if(_0x4c7184){return _0x4c7184[_0xe9f1('0x25')]()[_0xe9f1('0x24')](function(){_0x26e9fa[_0xe9f1('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x31597f,_0x35831b){return function(_0x48c84b){if(!_0x48c84b){_0x31597f[_0xe9f1('0x17')](0x194);}return _0x48c84b;};}function handleError(_0x4e66dc,_0xcac115){_0xcac115=_0xcac115||0x1f4;return function(_0x1075da){logger['error'](_0x1075da['stack']);if(_0x1075da[_0xe9f1('0x26')]){delete _0x1075da[_0xe9f1('0x26')];}_0x4e66dc[_0xe9f1('0x18')](_0xcac115)['send'](_0x1075da);};}exports[_0xe9f1('0x27')]=function(_0x198cc7,_0x34362b){var _0x448e56={},_0x148a72={},_0x2878a8={'count':0x0,'rows':[]};var _0x256237=_[_0xe9f1('0x28')](db['Attachment'][_0xe9f1('0x29')],function(_0xe44ae4){return{'name':_0xe44ae4[_0xe9f1('0x2a')],'type':_0xe44ae4[_0xe9f1('0x2b')][_0xe9f1('0x2c')]};});_0x148a72['model']=_[_0xe9f1('0x28')](_0x256237,_0xe9f1('0x26'));_0x148a72[_0xe9f1('0x2d')]=_['keys'](_0x198cc7[_0xe9f1('0x2d')]);_0x148a72['filters']=_[_0xe9f1('0x2e')](_0x148a72['model'],_0x148a72[_0xe9f1('0x2d')]);_0x448e56[_0xe9f1('0x2f')]=_['intersection'](_0x148a72[_0xe9f1('0x30')],qs[_0xe9f1('0x31')](_0x198cc7['query'][_0xe9f1('0x31')]));_0x448e56[_0xe9f1('0x2f')]=_0x448e56[_0xe9f1('0x2f')]['length']?_0x448e56['attributes']:_0x148a72[_0xe9f1('0x30')];if(!_0x198cc7[_0xe9f1('0x2d')][_0xe9f1('0x32')](_0xe9f1('0x33'))){_0x448e56[_0xe9f1('0x1b')]=qs[_0xe9f1('0x1b')](_0x198cc7['query']['limit']);_0x448e56[_0xe9f1('0x1d')]=qs[_0xe9f1('0x1d')](_0x198cc7[_0xe9f1('0x2d')][_0xe9f1('0x1d')]);}_0x448e56[_0xe9f1('0x34')]=qs[_0xe9f1('0x35')](_0x198cc7[_0xe9f1('0x2d')][_0xe9f1('0x35')]);_0x448e56[_0xe9f1('0x36')]=qs['filters'](_[_0xe9f1('0x37')](_0x198cc7['query'],_0x148a72[_0xe9f1('0x38')]),_0x256237);if(_0x198cc7[_0xe9f1('0x2d')]['filter']){_0x448e56[_0xe9f1('0x36')]=_[_0xe9f1('0x39')](_0x448e56[_0xe9f1('0x36')],{'$or':_[_0xe9f1('0x28')](_0x256237,function(_0x2225e6){if(_0x2225e6[_0xe9f1('0x2b')]!=='VIRTUAL'){var _0x5dd32f={};_0x5dd32f[_0x2225e6[_0xe9f1('0x26')]]={'$like':'%'+_0x198cc7[_0xe9f1('0x2d')][_0xe9f1('0x3a')]+'%'};return _0x5dd32f;}})});}_0x448e56=_[_0xe9f1('0x39')]({},_0x448e56,_0x198cc7[_0xe9f1('0x3b')]);var _0x5c4a6a={'where':_0x448e56[_0xe9f1('0x36')]};return db[_0xe9f1('0x3c')][_0xe9f1('0x1c')](_0x5c4a6a)['then'](function(_0x4bef15){_0x2878a8[_0xe9f1('0x1c')]=_0x4bef15;if(_0x198cc7[_0xe9f1('0x2d')]['includeAll']){_0x448e56[_0xe9f1('0x3d')]=[{'all':!![]}];}return db[_0xe9f1('0x3c')][_0xe9f1('0x3e')](_0x448e56);})[_0xe9f1('0x24')](function(_0x4abdc4){_0x2878a8[_0xe9f1('0x3f')]=_0x4abdc4;return _0x2878a8;})[_0xe9f1('0x24')](respondWithFilteredResult(_0x34362b,_0x448e56))['catch'](handleError(_0x34362b,null));};exports['show']=function(_0x9bd41e,_0x10dbe6){var _0x33e228={'raw':!![],'where':{'id':_0x9bd41e['params']['id']}},_0x26304d={};_0x26304d['model']=_[_0xe9f1('0x40')](db[_0xe9f1('0x3c')][_0xe9f1('0x29')]);_0x26304d['query']=_[_0xe9f1('0x40')](_0x9bd41e['query']);_0x26304d[_0xe9f1('0x38')]=_['intersection'](_0x26304d[_0xe9f1('0x30')],_0x26304d[_0xe9f1('0x2d')]);_0x33e228[_0xe9f1('0x2f')]=_[_0xe9f1('0x2e')](_0x26304d[_0xe9f1('0x30')],qs['fields'](_0x9bd41e[_0xe9f1('0x2d')]['fields']));_0x33e228['attributes']=_0x33e228[_0xe9f1('0x2f')][_0xe9f1('0x41')]?_0x33e228['attributes']:_0x26304d[_0xe9f1('0x30')];if(_0x9bd41e['query']['includeAll']){_0x33e228[_0xe9f1('0x3d')]=[{'all':!![]}];}_0x33e228=_[_0xe9f1('0x39')]({},_0x33e228,_0x9bd41e[_0xe9f1('0x3b')]);return db['Attachment'][_0xe9f1('0x42')](_0x33e228)[_0xe9f1('0x24')](handleEntityNotFound(_0x10dbe6,null))[_0xe9f1('0x24')](respondWithResult(_0x10dbe6,null))[_0xe9f1('0x43')](handleError(_0x10dbe6,null));};exports[_0xe9f1('0x44')]=function(_0x107476,_0x5a4981){var _0x1ddf0b={'where':{'id':_0x107476[_0xe9f1('0x45')]['id']}},_0x4fba21={};_0x4fba21[_0xe9f1('0x30')]=_[_0xe9f1('0x40')](db[_0xe9f1('0x3c')]['rawAttributes']);_0x1ddf0b['attributes']=_[_0xe9f1('0x2e')](_0x4fba21[_0xe9f1('0x30')],qs[_0xe9f1('0x31')](_0x107476[_0xe9f1('0x2d')]['fields']));_0x1ddf0b[_0xe9f1('0x2f')]=_0x1ddf0b[_0xe9f1('0x2f')][_0xe9f1('0x41')]?_0x1ddf0b[_0xe9f1('0x2f')]:_0x4fba21[_0xe9f1('0x30')];if(_0x107476[_0xe9f1('0x2d')][_0xe9f1('0x46')]){_0x1ddf0b['include']=[{'all':!![]}];}_0x1ddf0b=_[_0xe9f1('0x39')]({},_0x1ddf0b,_0x107476[_0xe9f1('0x3b')]);return db['Attachment'][_0xe9f1('0x42')](_0x1ddf0b)['then'](handleEntityNotFound(_0x5a4981,null))[_0xe9f1('0x24')](function(_0x14f2a2){if(_0x14f2a2){var _0x2b1167=_0x14f2a2[_0xe9f1('0x47')]({'plain':!![]});_0x2b1167=qs[_0xe9f1('0x48')](_0x2b1167,['id',_0xe9f1('0x49'),_0xe9f1('0x4a')]);_0x107476[_0xe9f1('0x4b')]=_[_0xe9f1('0x48')](_0x107476[_0xe9f1('0x4b')],['id',_0xe9f1('0x49'),_0xe9f1('0x4a')]);return db[_0xe9f1('0x3c')][_0xe9f1('0x4c')](_[_0xe9f1('0x39')](_0x2b1167,_0x107476[_0xe9f1('0x4b')]),{'include':_0x107476[_0xe9f1('0x2d')][_0xe9f1('0x46')]?[{'all':!![]}]:undefined});}})['then'](respondWithResult(_0x5a4981,0xc9))[_0xe9f1('0x43')](handleError(_0x5a4981,null));};exports[_0xe9f1('0x23')]=function(_0x35d223,_0x72325){if(_0x35d223[_0xe9f1('0x4b')]['id']){delete _0x35d223[_0xe9f1('0x4b')]['id'];}return db[_0xe9f1('0x3c')][_0xe9f1('0x42')]({'where':{'id':_0x35d223[_0xe9f1('0x45')]['id']}})[_0xe9f1('0x24')](handleEntityNotFound(_0x72325,null))[_0xe9f1('0x24')](saveUpdates(_0x35d223[_0xe9f1('0x4b')],null))[_0xe9f1('0x24')](respondWithResult(_0x72325,null))[_0xe9f1('0x43')](handleError(_0x72325,null));};exports[_0xe9f1('0x25')]=function(_0x358970,_0x2f67cb){return db[_0xe9f1('0x3c')][_0xe9f1('0x42')]({'where':{'id':_0x358970[_0xe9f1('0x45')]['id']}})[_0xe9f1('0x24')](handleEntityNotFound(_0x2f67cb,null))[_0xe9f1('0x24')](removeEntity(_0x2f67cb,null))[_0xe9f1('0x43')](handleError(_0x2f67cb,null));};exports[_0xe9f1('0x4c')]=function(_0x13c89b,_0x1a1ce2,_0x5322e8){_0x13c89b['body'][_0xe9f1('0x26')]=_0x13c89b[_0xe9f1('0x4d')][_0xe9f1('0x4e')];_0x13c89b[_0xe9f1('0x4b')][_0xe9f1('0x4f')]=_0x13c89b[_0xe9f1('0x4d')]['filename'];_0x13c89b[_0xe9f1('0x4b')][_0xe9f1('0x2b')]=_0x13c89b['file'][_0xe9f1('0x50')];return db[_0xe9f1('0x3c')]['create'](_0x13c89b[_0xe9f1('0x4b')])[_0xe9f1('0x24')](respondWithResult(_0x1a1ce2,0xc9))['catch'](handleError(_0x1a1ce2,null));};exports[_0xe9f1('0x51')]=function(_0x4ca6f8,_0x4ffdd0,_0x401d58){return db[_0xe9f1('0x3c')][_0xe9f1('0x52')]({'where':{'id':_0x4ca6f8[_0xe9f1('0x45')]['id']},'raw':!![]})['then'](handleEntityNotFound(_0x4ffdd0,null))[_0xe9f1('0x24')](function(_0x4b8888){if(_0x4b8888){var _0x464e9b=_0x4b8888[_0xe9f1('0x53')]!==null;var _0x378418=path[_0xe9f1('0x54')](config['root'],'server/files/attachments/');if(_0x464e9b){_0x378418=path[_0xe9f1('0x54')](_0x378418,_0xe9f1('0x55'));}var _0xb53a10=path[_0xe9f1('0x54')](_0x378418,_0x4b8888[_0xe9f1('0x4f')]);return _0x4ffdd0['download'](_0xb53a10);}})[_0xe9f1('0x43')](handleError(_0x4ffdd0,null));}; \ No newline at end of file +var _0x347a=['stack','name','send','map','Attachment','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','rows','catch','show','params','rawAttributes','include','find','clone','get','omit','createdAt','updatedAt','body','create','file','originalname','basename','filename','download','findOne','ChatOfflineMessageId','join','root','server/files/attachments/','offline-chat/','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','update','then','destroy'];(function(_0x4c5a5d,_0x59797c){var _0x3ad927=function(_0x2cabb9){while(--_0x2cabb9){_0x4c5a5d['push'](_0x4c5a5d['shift']());}};_0x3ad927(++_0x59797c);}(_0x347a,0x90));var _0xa347=function(_0xbd3a05,_0xe6c6b7){_0xbd3a05=_0xbd3a05-0x0;var _0x101f90=_0x347a[_0xbd3a05];return _0x101f90;};'use strict';var emlformat=require(_0xa347('0x0'));var rimraf=require(_0xa347('0x1'));var zipdir=require(_0xa347('0x2'));var jsonpatch=require(_0xa347('0x3'));var rp=require(_0xa347('0x4'));var moment=require(_0xa347('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xa347('0x6'));var util=require(_0xa347('0x7'));var path=require(_0xa347('0x8'));var sox=require(_0xa347('0x9'));var csv=require(_0xa347('0xa'));var ejs=require(_0xa347('0xb'));var fs=require('fs');var fs_extra=require(_0xa347('0xc'));var _=require(_0xa347('0xd'));var squel=require(_0xa347('0xe'));var crypto=require('crypto');var jsforce=require(_0xa347('0xf'));var deskjs=require(_0xa347('0x10'));var toCsv=require('to-csv');var querystring=require(_0xa347('0x11'));var Papa=require(_0xa347('0x12'));var Redis=require('ioredis');var authService=require(_0xa347('0x13'));var qs=require(_0xa347('0x14'));var as=require(_0xa347('0x15'));var hardwareService=require(_0xa347('0x16'));var logger=require(_0xa347('0x17'))('api');var utils=require(_0xa347('0x18'));var config=require(_0xa347('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xa347('0x1a'))['db'];function respondWithStatusCode(_0xf8e12c,_0x5044de){_0x5044de=_0x5044de||0xcc;return function(_0x22361d){if(_0x22361d){return _0xf8e12c[_0xa347('0x1b')](_0x5044de);}return _0xf8e12c[_0xa347('0x1c')](_0x5044de)[_0xa347('0x1d')]();};}function respondWithResult(_0x3e2d62,_0x248b28){_0x248b28=_0x248b28||0xc8;return function(_0x2641a5){if(_0x2641a5){return _0x3e2d62['status'](_0x248b28)[_0xa347('0x1e')](_0x2641a5);}};}function respondWithFilteredResult(_0x5c4825,_0x687f81){return function(_0x1be092){if(_0x1be092){var _0xb4ce05=typeof _0x687f81[_0xa347('0x1f')]===_0xa347('0x20')&&typeof _0x687f81[_0xa347('0x21')]===_0xa347('0x20');var _0x2a5097=_0x1be092['count'];var _0x2a52c0=_0xb4ce05?0x0:_0x687f81[_0xa347('0x1f')];var _0x536fe2=_0xb4ce05?_0x1be092['count']:_0x687f81['offset']+_0x687f81[_0xa347('0x21')];var _0x10373a;if(_0x536fe2>=_0x2a5097){_0x536fe2=_0x2a5097;_0x10373a=0xc8;}else{_0x10373a=0xce;}_0x5c4825[_0xa347('0x1c')](_0x10373a);return _0x5c4825[_0xa347('0x22')](_0xa347('0x23'),_0x2a52c0+'-'+_0x536fe2+'/'+_0x2a5097)[_0xa347('0x1e')](_0x1be092);}return null;};}function patchUpdates(_0x287bd8){return function(_0x2de98d){try{jsonpatch[_0xa347('0x24')](_0x2de98d,_0x287bd8,!![]);}catch(_0x45113c){return BPromise[_0xa347('0x25')](_0x45113c);}return _0x2de98d[_0xa347('0x26')]();};}function saveUpdates(_0x4fd10e,_0x1b0ba2){return function(_0x72904a){if(_0x72904a){return _0x72904a[_0xa347('0x27')](_0x4fd10e)[_0xa347('0x28')](function(_0x28fb61){return _0x28fb61;});}return null;};}function removeEntity(_0x1f0d3e,_0x167e21){return function(_0xa6a323){if(_0xa6a323){return _0xa6a323[_0xa347('0x29')]()[_0xa347('0x28')](function(){_0x1f0d3e[_0xa347('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2ad8b2,_0x2878c0){return function(_0x53056d){if(!_0x53056d){_0x2ad8b2[_0xa347('0x1b')](0x194);}return _0x53056d;};}function handleError(_0x3d92f5,_0x46829d){_0x46829d=_0x46829d||0x1f4;return function(_0x1c9e4c){logger['error'](_0x1c9e4c[_0xa347('0x2a')]);if(_0x1c9e4c[_0xa347('0x2b')]){delete _0x1c9e4c[_0xa347('0x2b')];}_0x3d92f5[_0xa347('0x1c')](_0x46829d)[_0xa347('0x2c')](_0x1c9e4c);};}exports['index']=function(_0x1d26ba,_0x3e61f1){var _0x2cdd79={},_0x288a69={},_0x427edd={'count':0x0,'rows':[]};var _0x34842d=_[_0xa347('0x2d')](db[_0xa347('0x2e')]['rawAttributes'],function(_0x4ef7d3){return{'name':_0x4ef7d3['fieldName'],'type':_0x4ef7d3[_0xa347('0x2f')]['key']};});_0x288a69[_0xa347('0x30')]=_[_0xa347('0x2d')](_0x34842d,_0xa347('0x2b'));_0x288a69[_0xa347('0x31')]=_[_0xa347('0x32')](_0x1d26ba[_0xa347('0x31')]);_0x288a69[_0xa347('0x33')]=_[_0xa347('0x34')](_0x288a69['model'],_0x288a69[_0xa347('0x31')]);_0x2cdd79['attributes']=_[_0xa347('0x34')](_0x288a69[_0xa347('0x30')],qs[_0xa347('0x35')](_0x1d26ba[_0xa347('0x31')][_0xa347('0x35')]));_0x2cdd79[_0xa347('0x36')]=_0x2cdd79[_0xa347('0x36')][_0xa347('0x37')]?_0x2cdd79['attributes']:_0x288a69[_0xa347('0x30')];if(!_0x1d26ba[_0xa347('0x31')][_0xa347('0x38')](_0xa347('0x39'))){_0x2cdd79[_0xa347('0x21')]=qs[_0xa347('0x21')](_0x1d26ba[_0xa347('0x31')]['limit']);_0x2cdd79[_0xa347('0x1f')]=qs[_0xa347('0x1f')](_0x1d26ba[_0xa347('0x31')][_0xa347('0x1f')]);}_0x2cdd79[_0xa347('0x3a')]=qs[_0xa347('0x3b')](_0x1d26ba['query'][_0xa347('0x3b')]);_0x2cdd79[_0xa347('0x3c')]=qs[_0xa347('0x33')](_[_0xa347('0x3d')](_0x1d26ba[_0xa347('0x31')],_0x288a69['filters']),_0x34842d);if(_0x1d26ba[_0xa347('0x31')][_0xa347('0x3e')]){_0x2cdd79[_0xa347('0x3c')]=_[_0xa347('0x3f')](_0x2cdd79['where'],{'$or':_[_0xa347('0x2d')](_0x34842d,function(_0x1be04b){if(_0x1be04b['type']!==_0xa347('0x40')){var _0x115d2a={};_0x115d2a[_0x1be04b[_0xa347('0x2b')]]={'$like':'%'+_0x1d26ba[_0xa347('0x31')][_0xa347('0x3e')]+'%'};return _0x115d2a;}})});}_0x2cdd79=_['merge']({},_0x2cdd79,_0x1d26ba[_0xa347('0x41')]);var _0x423b12={'where':_0x2cdd79[_0xa347('0x3c')]};return db[_0xa347('0x2e')]['count'](_0x423b12)[_0xa347('0x28')](function(_0x56d9d4){_0x427edd[_0xa347('0x42')]=_0x56d9d4;if(_0x1d26ba['query'][_0xa347('0x43')]){_0x2cdd79['include']=[{'all':!![]}];}return db[_0xa347('0x2e')]['findAll'](_0x2cdd79);})[_0xa347('0x28')](function(_0x535a97){_0x427edd[_0xa347('0x44')]=_0x535a97;return _0x427edd;})[_0xa347('0x28')](respondWithFilteredResult(_0x3e61f1,_0x2cdd79))[_0xa347('0x45')](handleError(_0x3e61f1,null));};exports[_0xa347('0x46')]=function(_0x3b7ea6,_0x2d96c6){var _0x5e23af={'raw':!![],'where':{'id':_0x3b7ea6[_0xa347('0x47')]['id']}},_0x2f5abc={};_0x2f5abc['model']=_[_0xa347('0x32')](db['Attachment'][_0xa347('0x48')]);_0x2f5abc[_0xa347('0x31')]=_[_0xa347('0x32')](_0x3b7ea6['query']);_0x2f5abc[_0xa347('0x33')]=_[_0xa347('0x34')](_0x2f5abc['model'],_0x2f5abc[_0xa347('0x31')]);_0x5e23af['attributes']=_[_0xa347('0x34')](_0x2f5abc['model'],qs['fields'](_0x3b7ea6['query'][_0xa347('0x35')]));_0x5e23af[_0xa347('0x36')]=_0x5e23af['attributes'][_0xa347('0x37')]?_0x5e23af[_0xa347('0x36')]:_0x2f5abc[_0xa347('0x30')];if(_0x3b7ea6[_0xa347('0x31')][_0xa347('0x43')]){_0x5e23af[_0xa347('0x49')]=[{'all':!![]}];}_0x5e23af=_['merge']({},_0x5e23af,_0x3b7ea6['options']);return db['Attachment'][_0xa347('0x4a')](_0x5e23af)[_0xa347('0x28')](handleEntityNotFound(_0x2d96c6,null))[_0xa347('0x28')](respondWithResult(_0x2d96c6,null))[_0xa347('0x45')](handleError(_0x2d96c6,null));};exports[_0xa347('0x4b')]=function(_0x333137,_0x5b7632){var _0x16af0c={'where':{'id':_0x333137[_0xa347('0x47')]['id']}},_0xca6645={};_0xca6645['model']=_[_0xa347('0x32')](db['Attachment'][_0xa347('0x48')]);_0x16af0c[_0xa347('0x36')]=_[_0xa347('0x34')](_0xca6645[_0xa347('0x30')],qs[_0xa347('0x35')](_0x333137[_0xa347('0x31')][_0xa347('0x35')]));_0x16af0c[_0xa347('0x36')]=_0x16af0c[_0xa347('0x36')][_0xa347('0x37')]?_0x16af0c[_0xa347('0x36')]:_0xca6645[_0xa347('0x30')];if(_0x333137[_0xa347('0x31')][_0xa347('0x43')]){_0x16af0c[_0xa347('0x49')]=[{'all':!![]}];}_0x16af0c=_['merge']({},_0x16af0c,_0x333137['options']);return db[_0xa347('0x2e')]['find'](_0x16af0c)[_0xa347('0x28')](handleEntityNotFound(_0x5b7632,null))[_0xa347('0x28')](function(_0x575e1c){if(_0x575e1c){var _0x5a83de=_0x575e1c[_0xa347('0x4c')]({'plain':!![]});_0x5a83de=qs[_0xa347('0x4d')](_0x5a83de,['id',_0xa347('0x4e'),_0xa347('0x4f')]);_0x333137[_0xa347('0x50')]=_[_0xa347('0x4d')](_0x333137[_0xa347('0x50')],['id',_0xa347('0x4e'),'updatedAt']);return db[_0xa347('0x2e')][_0xa347('0x51')](_[_0xa347('0x3f')](_0x5a83de,_0x333137[_0xa347('0x50')]),{'include':_0x333137[_0xa347('0x31')]['includeAll']?[{'all':!![]}]:undefined});}})[_0xa347('0x28')](respondWithResult(_0x5b7632,0xc9))['catch'](handleError(_0x5b7632,null));};exports['update']=function(_0x4fa0ab,_0x171b8f){if(_0x4fa0ab[_0xa347('0x50')]['id']){delete _0x4fa0ab[_0xa347('0x50')]['id'];}return db[_0xa347('0x2e')][_0xa347('0x4a')]({'where':{'id':_0x4fa0ab[_0xa347('0x47')]['id']}})[_0xa347('0x28')](handleEntityNotFound(_0x171b8f,null))['then'](saveUpdates(_0x4fa0ab['body'],null))[_0xa347('0x28')](respondWithResult(_0x171b8f,null))[_0xa347('0x45')](handleError(_0x171b8f,null));};exports[_0xa347('0x29')]=function(_0x1022f5,_0x1b5cf6){return db[_0xa347('0x2e')][_0xa347('0x4a')]({'where':{'id':_0x1022f5[_0xa347('0x47')]['id']}})[_0xa347('0x28')](handleEntityNotFound(_0x1b5cf6,null))['then'](removeEntity(_0x1b5cf6,null))[_0xa347('0x45')](handleError(_0x1b5cf6,null));};exports['create']=function(_0x497f26,_0x50443b,_0x281fa2){_0x497f26[_0xa347('0x50')][_0xa347('0x2b')]=_0x497f26[_0xa347('0x52')][_0xa347('0x53')];_0x497f26['body'][_0xa347('0x54')]=_0x497f26['file'][_0xa347('0x55')];_0x497f26[_0xa347('0x50')][_0xa347('0x2f')]=_0x497f26[_0xa347('0x52')]['mimetype'];return db[_0xa347('0x2e')][_0xa347('0x51')](_0x497f26[_0xa347('0x50')])[_0xa347('0x28')](respondWithResult(_0x50443b,0xc9))['catch'](handleError(_0x50443b,null));};exports[_0xa347('0x56')]=function(_0xa50f98,_0xa90636,_0x5ad076){return db['Attachment'][_0xa347('0x57')]({'where':{'id':_0xa50f98['params']['id']},'raw':!![]})[_0xa347('0x28')](handleEntityNotFound(_0xa90636,null))['then'](function(_0x21e23c){if(_0x21e23c){var _0x546415=_0x21e23c[_0xa347('0x58')]!==null;var _0x4027e7=path[_0xa347('0x59')](config[_0xa347('0x5a')],_0xa347('0x5b'));if(_0x546415){_0x4027e7=path['join'](_0x4027e7,_0xa347('0x5c'));}var _0x37f2be=path[_0xa347('0x59')](_0x4027e7,_0x21e23c[_0xa347('0x54')]);return _0xa90636[_0xa347('0x56')](_0x37f2be);}})['catch'](handleError(_0xa90636,null));}; \ No newline at end of file diff --git a/server/api/attachment/attachment.model.js b/server/api/attachment/attachment.model.js index 22a01e0..f68968f 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 _0x13be=['Attachment','attachments','lodash','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./attachment.attributes','exports','define'];(function(_0x4e1521,_0x19bb66){var _0x2dc388=function(_0x17ed4a){while(--_0x17ed4a){_0x4e1521['push'](_0x4e1521['shift']());}};_0x2dc388(++_0x19bb66);}(_0x13be,0xf2));var _0xe13b=function(_0x509cd3,_0x2f3032){_0x509cd3=_0x509cd3-0x0;var _0x3cdd06=_0x13be[_0x509cd3];return _0x3cdd06;};'use strict';var _=require(_0xe13b('0x0'));var util=require('util');var logger=require(_0xe13b('0x1'))(_0xe13b('0x2'));var moment=require('moment');var BPromise=require(_0xe13b('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe13b('0x4'));var rimraf=require(_0xe13b('0x5'));var config=require(_0xe13b('0x6'));var attributes=require(_0xe13b('0x7'));module[_0xe13b('0x8')]=function(_0x49b29f,_0x57441b){return _0x49b29f[_0xe13b('0x9')](_0xe13b('0xa'),attributes,{'tableName':_0xe13b('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfab9=['exports','define','Attachment','attachments','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./attachment.attributes'];(function(_0x295af8,_0x36c177){var _0x55ff03=function(_0x156e44){while(--_0x156e44){_0x295af8['push'](_0x295af8['shift']());}};_0x55ff03(++_0x36c177);}(_0xfab9,0x82));var _0x9fab=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfab9[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9fab('0x0'));var util=require(_0x9fab('0x1'));var logger=require(_0x9fab('0x2'))(_0x9fab('0x3'));var moment=require(_0x9fab('0x4'));var BPromise=require(_0x9fab('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9fab('0x6'));var rimraf=require(_0x9fab('0x7'));var config=require(_0x9fab('0x8'));var attributes=require(_0x9fab('0x9'));module[_0x9fab('0xa')]=function(_0x44bb79,_0x293968){return _0x44bb79[_0x9fab('0xb')](_0x9fab('0xc'),attributes,{'tableName':_0x9fab('0xd'),'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 306cbe5..1dd7ae9 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 _0xf25a=['Attachment','create','body','options','debug','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','http','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','CreateAttachment'];(function(_0x3fb5eb,_0x5947a6){var _0x481291=function(_0x74e4e){while(--_0x74e4e){_0x3fb5eb['push'](_0x3fb5eb['shift']());}};_0x481291(++_0x5947a6);}(_0xf25a,0x195));var _0xaf25=function(_0x2a42ce,_0x38d859){_0x2a42ce=_0x2a42ce-0x0;var _0x4bce71=_0xf25a[_0x2a42ce];return _0x4bce71;};'use strict';var _=require(_0xaf25('0x0'));var util=require(_0xaf25('0x1'));var moment=require(_0xaf25('0x2'));var BPromise=require('bluebird');var rs=require(_0xaf25('0x3'));var fs=require('fs');var Redis=require(_0xaf25('0x4'));var db=require(_0xaf25('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xaf25('0x6'))(_0xaf25('0x7'));var config=require(_0xaf25('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xaf25('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48c6e6,_0x4b7258,_0x457ba5){return new BPromise(function(_0x41b3cd,_0x61e8d){return client['request'](_0x48c6e6,_0x457ba5)[_0xaf25('0xa')](function(_0x24ac0a){logger[_0xaf25('0xb')](_0xaf25('0xc'),_0x4b7258,_0xaf25('0xd'));logger['debug'](_0xaf25('0xe'),_0x4b7258,_0xaf25('0xd'),JSON[_0xaf25('0xf')](_0x24ac0a));if(_0x24ac0a[_0xaf25('0x10')]){if(_0x24ac0a['error']['code']===0x1f4){logger[_0xaf25('0x10')](_0xaf25('0xc'),_0x4b7258,_0x24ac0a[_0xaf25('0x10')][_0xaf25('0x11')]);return _0x61e8d(_0x24ac0a[_0xaf25('0x10')]['message']);}logger['error'](_0xaf25('0xc'),_0x4b7258,_0x24ac0a['error'][_0xaf25('0x11')]);return _0x41b3cd(_0x24ac0a[_0xaf25('0x10')][_0xaf25('0x11')]);}else{logger[_0xaf25('0xb')]('Attachment,\x20%s,\x20%s',_0x4b7258,_0xaf25('0xd'));_0x41b3cd(_0x24ac0a['result']['message']);}})[_0xaf25('0x12')](function(_0x4b396d){logger[_0xaf25('0x10')](_0xaf25('0xc'),_0x4b7258,_0x4b396d);_0x61e8d(_0x4b396d);});});}exports[_0xaf25('0x13')]=function(_0x2c815a){var _0x28bb0e=this;return new Promise(function(_0x10ed9a,_0x615537){return db[_0xaf25('0x14')][_0xaf25('0x15')](_0x2c815a[_0xaf25('0x16')],{'raw':_0x2c815a['options']?_0x2c815a[_0xaf25('0x17')]['raw']===undefined?!![]:![]:!![]})[_0xaf25('0xa')](function(_0x396af4){logger[_0xaf25('0xb')](_0xaf25('0x13'),_0x2c815a);logger[_0xaf25('0x18')](_0xaf25('0x13'),_0x2c815a,JSON[_0xaf25('0xf')](_0x396af4));_0x10ed9a(_0x396af4);})[_0xaf25('0x12')](function(_0x2d8b66){logger[_0xaf25('0x10')](_0xaf25('0x13'),_0x2d8b66[_0xaf25('0x11')],_0x2c815a);_0x615537(_0x28bb0e[_0xaf25('0x10')](0x1f4,_0x2d8b66[_0xaf25('0x11')]));});});}; \ No newline at end of file +var _0xf323=['create','options','raw','debug','CreateAttachment','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','Attachment,\x20%s,\x20%s','request\x20sent','Attachment,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','Attachment'];(function(_0x3fefe4,_0x2e4831){var _0x2d4204=function(_0x4b234a){while(--_0x4b234a){_0x3fefe4['push'](_0x3fefe4['shift']());}};_0x2d4204(++_0x2e4831);}(_0xf323,0x1c6));var _0x3f32=function(_0x2b5441,_0x1b1c92){_0x2b5441=_0x2b5441-0x0;var _0x1a7533=_0xf323[_0x2b5441];return _0x1a7533;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3f32('0x0'));var BPromise=require(_0x3f32('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3f32('0x2'));var db=require(_0x3f32('0x3'))['db'];var utils=require(_0x3f32('0x4'));var logger=require(_0x3f32('0x5'))(_0x3f32('0x6'));var config=require('../../config/environment');var jayson=require(_0x3f32('0x7'));var client=jayson[_0x3f32('0x8')][_0x3f32('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1134e9,_0x5c9dc2,_0x567ab1){return new BPromise(function(_0x34b93e,_0x109af2){return client[_0x3f32('0xa')](_0x1134e9,_0x567ab1)[_0x3f32('0xb')](function(_0x22a9d3){logger[_0x3f32('0xc')](_0x3f32('0xd'),_0x5c9dc2,_0x3f32('0xe'));logger['debug'](_0x3f32('0xf'),_0x5c9dc2,_0x3f32('0xe'),JSON[_0x3f32('0x10')](_0x22a9d3));if(_0x22a9d3['error']){if(_0x22a9d3[_0x3f32('0x11')][_0x3f32('0x12')]===0x1f4){logger[_0x3f32('0x11')](_0x3f32('0xd'),_0x5c9dc2,_0x22a9d3['error']['message']);return _0x109af2(_0x22a9d3[_0x3f32('0x11')][_0x3f32('0x13')]);}logger['error'](_0x3f32('0xd'),_0x5c9dc2,_0x22a9d3[_0x3f32('0x11')][_0x3f32('0x13')]);return _0x34b93e(_0x22a9d3['error']['message']);}else{logger[_0x3f32('0xc')](_0x3f32('0xd'),_0x5c9dc2,_0x3f32('0xe'));_0x34b93e(_0x22a9d3[_0x3f32('0x14')]['message']);}})['catch'](function(_0x352010){logger[_0x3f32('0x11')](_0x3f32('0xd'),_0x5c9dc2,_0x352010);_0x109af2(_0x352010);});});}exports['CreateAttachment']=function(_0x5c36d9){var _0x1697c9=this;return new Promise(function(_0x19ec90,_0x8d70ee){return db[_0x3f32('0x15')][_0x3f32('0x16')](_0x5c36d9['body'],{'raw':_0x5c36d9[_0x3f32('0x17')]?_0x5c36d9[_0x3f32('0x17')][_0x3f32('0x18')]===undefined?!![]:![]:!![]})[_0x3f32('0xb')](function(_0xbc366b){logger[_0x3f32('0xc')]('CreateAttachment',_0x5c36d9);logger[_0x3f32('0x19')](_0x3f32('0x1a'),_0x5c36d9,JSON['stringify'](_0xbc366b));_0x19ec90(_0xbc366b);})[_0x3f32('0x1b')](function(_0x21cf2e){logger[_0x3f32('0x11')](_0x3f32('0x1a'),_0x21cf2e['message'],_0x5c36d9);_0x8d70ee(_0x1697c9[_0x3f32('0x11')](0x1f4,_0x21cf2e[_0x3f32('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/attachment/index.js b/server/api/attachment/index.js index 4daba56..2f7b474 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 _0xb10b=['originalname','replace','single','file','create','put','/:id','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./attachment.controller','get','index','isAuthenticated','show','/:id/download','download','post','/:id/clone','diskStorage','join','server/files/attachments/','format','%s-%s'];(function(_0x98c52d,_0x4136ec){var _0x295938=function(_0x588010){while(--_0x588010){_0x98c52d['push'](_0x98c52d['shift']());}};_0x295938(++_0x4136ec);}(_0xb10b,0x12a));var _0xbb10=function(_0xbaf094,_0x2f86ad){_0xbaf094=_0xbaf094-0x0;var _0x3974fd=_0xb10b[_0xbaf094];return _0x3974fd;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')](_0xbb10('0x10'),auth['isAuthenticated'](),controller['clone']);var upload=multer({'storage':multer[_0xbb10('0x11')]({'destination':function(_0x118a74,_0xce64f3,_0x5e136d){_0x5e136d(null,path[_0xbb10('0x12')](config['root'],_0xbb10('0x13')));},'filename':function(_0x916a32,_0x285009,_0x193a27){_0x193a27(null,util[_0xbb10('0x14')](_0xbb10('0x15'),Date['now'](),_0x285009[_0xbb10('0x16')][_0xbb10('0x17')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xbb10('0xf')]('/',upload[_0xbb10('0x18')](_0xbb10('0x19')),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1d')]);router['delete'](_0xbb10('0x1c'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);module[_0xbb10('0x1f')]=router; \ No newline at end of file +var _0x2032=['./attachment.controller','get','isAuthenticated','index','/:id','show','download','/:id/clone','clone','root','server/files/attachments/','now','post','single','file','create','put','update','delete','destroy','exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x22dba1,_0x452303){var _0x5252ff=function(_0xc58c3f){while(--_0xc58c3f){_0x22dba1['push'](_0x22dba1['shift']());}};_0x5252ff(++_0x452303);}(_0x2032,0xd9));var _0x2203=function(_0x2e6230,_0x35b650){_0x2e6230=_0x2e6230-0x0;var _0x443fa8=_0x2032[_0x2e6230];return _0x443fa8;};'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/download',auth['isAuthenticated'](),controller[_0x2203('0xd')]);router['post'](_0x2203('0xe'),auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x849049,_0x4a6832,_0x3f690a){_0x3f690a(null,path['join'](config[_0x2203('0x10')],_0x2203('0x11')));},'filename':function(_0x4b9376,_0x583bc7,_0x585c76){_0x585c76(null,util['format']('%s-%s',Date[_0x2203('0x12')](),_0x583bc7['originalname']['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0x2203('0x13')]('/',upload[_0x2203('0x14')](_0x2203('0x15')),controller[_0x2203('0x16')]);router[_0x2203('0x17')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0x18')]);router[_0x2203('0x19')](_0x2203('0xb'),auth['isAuthenticated'](),controller[_0x2203('0x1a')]);module[_0x2203('0x1b')]=router; \ No newline at end of file diff --git a/server/api/authActiveDirectory/authActiveDirectory.controller.js b/server/api/authActiveDirectory/authActiveDirectory.controller.js index 0b8920b..0b2572a 100644 --- a/server/api/authActiveDirectory/authActiveDirectory.controller.js +++ b/server/api/authActiveDirectory/authActiveDirectory.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3772=['adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','findOne','name','password','salt','role','disabled','blocked','blockedAt','online','admin','agent','add','minutes','clearBlockUser','getLicense','catch','status','message','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','use','ad-login','User','passport','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../components/auth/service','../../config/environment','../../config/logger','api','undefined','baseDN','activedirectory','url','domain','Error\x20authenticate\x20%s:\x20%s','error','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3772,0x1d5));var _0x2377=function(_0x2d24e2,_0x38c3af){_0x2d24e2=_0x2d24e2-0x0;var _0x330f61=_0x3772[_0x2d24e2];return _0x330f61;};'use strict';var passport=require(_0x2377('0x0'));var LocalStrategy=require(_0x2377('0x1'))[_0x2377('0x2')];var moment=require(_0x2377('0x3'));var ActiveDirectory=require(_0x2377('0x4'));var BPromise=require(_0x2377('0x5'));var util=require(_0x2377('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0x2377('0x7'));var utils=require('../../config/utils');var config=require(_0x2377('0x8'));var logger=require(_0x2377('0x9'))(_0x2377('0xa'));function isActiveDirectoryConfigured(_0x2be407){var _0x1835c9=![];if(typeof _0x2be407['activedirectory']!==_0x2377('0xb')){_0x1835c9=_0x2be407['activedirectory'][_0x2377('0xc')]&&_0x2be407[_0x2377('0xd')][_0x2377('0xe')]&&_0x2be407[_0x2377('0xd')][_0x2377('0xf')];}return _0x1835c9;}function adAuthenticate(_0x4ee5f3,_0x565503,_0x57b727){return new BPromise(function(_0x42916d,_0x1c6533){try{var _0xfa2a59=new ActiveDirectory(_0x4ee5f3);_0xfa2a59['authenticate'](_0x565503,_0x57b727,function(_0x39e596,_0x38240b){if(_0x39e596){logger['error'](_0x2377('0x10'),_0x565503,util['inspect'](_0x39e596,{'showHidden':![],'depth':null}));_0x1c6533('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else if(!_0x38240b){logger[_0x2377('0x11')](_0x2377('0x12'),_0x565503);_0x1c6533('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x42916d(_0x38240b);}});}catch(_0x4c2600){_0x1c6533(_0x4c2600);}});}function ActiveDirectoryAuthenticate(_0x202e61,_0x229cd5,_0x2aab47,_0x279e04){var _0x389a44,_0x2de57c;if(!isActiveDirectoryConfigured(config)){logger[_0x2377('0x11')](_0x2377('0x13'),_0x229cd5);return _0x279e04(null,![],{'message':_0x2377('0x14')});}return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0x2377('0x15'),_0x2377('0x16')],'raw':!![]})[_0x2377('0x17')](function(_0x356443){_0x389a44=_0x356443;if(!_0x389a44['adSsoEnabled']){logger['error'](_0x2377('0x18'),_0x229cd5);throw new Error(_0x2377('0x14'));}return _0x202e61[_0x2377('0x19')]({'attributes':['id',_0x2377('0x1a'),_0x2377('0x1b'),_0x2377('0x1c'),_0x2377('0x1d'),_0x2377('0x1e'),_0x2377('0x1f'),_0x2377('0x20'),_0x2377('0x21')],'where':{'name':_0x229cd5,'role':{'$or':[_0x2377('0x22'),'user',_0x2377('0x23')]},'adSsoEnabled':!![]}});})[_0x2377('0x17')](function(_0x1d2b8d){if(!_0x1d2b8d||_0x1d2b8d&&_0x1d2b8d[_0x2377('0x1a')]!==_0x229cd5){throw new Error(_0x2377('0x14'));}_0x2de57c=_0x1d2b8d;var _0x5e90c5=_0x2de57c[_0x2377('0x1a')]+'@'+config[_0x2377('0xd')][_0x2377('0xf')];return adAuthenticate(config[_0x2377('0xd')],_0x5e90c5,_0x2aab47);})['then'](function(_0x7ff330){if(_0x2de57c[_0x2377('0x1e')]){throw new Error(_0x2377('0x14'));}if(_0x389a44['blockDuration']>0x0){if(_0x2de57c[_0x2377('0x1f')]){if(moment(_0x2de57c[_0x2377('0x20')])[_0x2377('0x24')](_0x389a44['blockDuration'],_0x2377('0x25'))>moment()){throw new Error('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}return utils[_0x2377('0x26')](_0x2de57c,0x0,![],null)[_0x2377('0x17')](function(){return utils[_0x2377('0x27')](_0x2de57c);})['then'](function(){return _0x279e04(null,_0x2de57c);});}else{return utils[_0x2377('0x27')](_0x2de57c)[_0x2377('0x17')](function(){return _0x279e04(null,_0x2de57c);});}}else{return utils['getLicense'](_0x2de57c)['then'](function(){return _0x279e04(null,_0x2de57c);});}})[_0x2377('0x28')](function(_0xae1ad2){return _0x279e04(null,![],_0xae1ad2);});}function handleError(_0x3475fc,_0xf91a0d,_0x4059b4){return _0x3475fc[_0x2377('0x29')](_0xf91a0d||0x1f4)['send']({'message':_0x4059b4?_0x4059b4[_0x2377('0x2a')]||_0x4059b4:''});}exports['login']=function(_0x1a0d37,_0x5aa89f,_0x141427){passport['authenticate']('ad-login',function(_0x4ce1bd,_0x4531ab,_0x4f0b84){var _0x1c3551=_0x4ce1bd||_0x4f0b84;if(_0x1c3551){return handleError(_0x5aa89f,0x191,_0x1c3551);}if(!_0x4531ab){return handleError(_0x5aa89f,0x194,{'message':_0x2377('0x2b')});}else{var _0x44bb90={'payload':{'id':_0x4531ab['id'],'role':_0x4531ab[_0x2377('0x1d')]},'options':{'expiresIn':0x15180}};return authService[_0x2377('0x2c')](_0x44bb90)[_0x2377('0x17')](function(_0x2a44fa){_0x5aa89f[_0x2377('0x2d')]({'id':_0x4531ab['id'],'token':_0x2a44fa,'statusCall':'','isAlreadyLogged':_0x4531ab['online']});});}})(_0x1a0d37,_0x5aa89f,_0x141427);};passport[_0x2377('0x2e')](_0x2377('0x2f'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x340ed6,_0x32b836,_0x46ffd1){return ActiveDirectoryAuthenticate(db[_0x2377('0x30')],_0x340ed6,_0x32b836,_0x46ffd1);})); \ No newline at end of file +var _0xe3ef=['minutes','clearBlockUser','getLicense','catch','status','message','login','ad-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','signToken','json','passport-local','Strategy','moment','activedirectory2','bluebird','util','../../config/utils','../../config/environment','../../config/logger','api','activedirectory','undefined','baseDN','url','domain','authenticate','error','Error\x20authenticate\x20%s:\x20%s','inspect','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','Error\x20authenticate\x20%s:\x20Wrong\x20credentials','Setting','findOne','adSsoEnabled','blockDuration','then','Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20enabled','name','password','salt','role','blockedAt','online','user','agent','disabled','blocked'];(function(_0x21087c,_0x24aaf2){var _0x4b2f07=function(_0x52a5f1){while(--_0x52a5f1){_0x21087c['push'](_0x21087c['shift']());}};_0x4b2f07(++_0x24aaf2);}(_0xe3ef,0x1bb));var _0xfe3e=function(_0x3d0df3,_0x13464c){_0x3d0df3=_0x3d0df3-0x0;var _0x44e7e1=_0xe3ef[_0x3d0df3];return _0x44e7e1;};'use strict';var passport=require('passport');var LocalStrategy=require(_0xfe3e('0x0'))[_0xfe3e('0x1')];var moment=require(_0xfe3e('0x2'));var ActiveDirectory=require(_0xfe3e('0x3'));var BPromise=require(_0xfe3e('0x4'));var util=require(_0xfe3e('0x5'));var db=require('../../mysqldb')['db'];var authService=require('../../components/auth/service');var utils=require(_0xfe3e('0x6'));var config=require(_0xfe3e('0x7'));var logger=require(_0xfe3e('0x8'))(_0xfe3e('0x9'));function isActiveDirectoryConfigured(_0x5c5788){var _0x3d31a3=![];if(typeof _0x5c5788[_0xfe3e('0xa')]!==_0xfe3e('0xb')){_0x3d31a3=_0x5c5788['activedirectory'][_0xfe3e('0xc')]&&_0x5c5788['activedirectory'][_0xfe3e('0xd')]&&_0x5c5788[_0xfe3e('0xa')][_0xfe3e('0xe')];}return _0x3d31a3;}function adAuthenticate(_0x332127,_0x2fa473,_0x55d1db){return new BPromise(function(_0x2ba2f2,_0x32c34c){try{var _0x3ffe3e=new ActiveDirectory(_0x332127);_0x3ffe3e[_0xfe3e('0xf')](_0x2fa473,_0x55d1db,function(_0x3efe56,_0x3c2028){if(_0x3efe56){logger[_0xfe3e('0x10')](_0xfe3e('0x11'),_0x2fa473,util[_0xfe3e('0x12')](_0x3efe56,{'showHidden':![],'depth':null}));_0x32c34c(_0xfe3e('0x13'));}else if(!_0x3c2028){logger[_0xfe3e('0x10')](_0xfe3e('0x14'),_0x2fa473);_0x32c34c('Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.');}else{_0x2ba2f2(_0x3c2028);}});}catch(_0x147880){_0x32c34c(_0x147880);}});}function ActiveDirectoryAuthenticate(_0x58e7ac,_0x452eda,_0x5c8f2f,_0x56c04c){var _0x1fd579,_0x11a470;if(!isActiveDirectoryConfigured(config)){logger[_0xfe3e('0x10')]('Error\x20authenticate\x20%s:\x20Active\x20Directory\x20not\x20configured',_0x452eda);return _0x56c04c(null,![],{'message':_0xfe3e('0x13')});}return db[_0xfe3e('0x15')][_0xfe3e('0x16')]({'where':{'id':0x1},'attributes':[_0xfe3e('0x17'),_0xfe3e('0x18')],'raw':!![]})[_0xfe3e('0x19')](function(_0x75cf94){_0x1fd579=_0x75cf94;if(!_0x1fd579[_0xfe3e('0x17')]){logger[_0xfe3e('0x10')](_0xfe3e('0x1a'),_0x452eda);throw new Error(_0xfe3e('0x13'));}return _0x58e7ac['findOne']({'attributes':['id',_0xfe3e('0x1b'),_0xfe3e('0x1c'),_0xfe3e('0x1d'),_0xfe3e('0x1e'),'disabled','blocked',_0xfe3e('0x1f'),_0xfe3e('0x20')],'where':{'name':_0x452eda,'role':{'$or':['admin',_0xfe3e('0x21'),_0xfe3e('0x22')]},'adSsoEnabled':!![]}});})[_0xfe3e('0x19')](function(_0x38f82d){if(!_0x38f82d||_0x38f82d&&_0x38f82d['name']!==_0x452eda){throw new Error(_0xfe3e('0x13'));}_0x11a470=_0x38f82d;var _0x28aa94=_0x11a470[_0xfe3e('0x1b')]+'@'+config[_0xfe3e('0xa')][_0xfe3e('0xe')];return adAuthenticate(config[_0xfe3e('0xa')],_0x28aa94,_0x5c8f2f);})[_0xfe3e('0x19')](function(_0x42395a){if(_0x11a470[_0xfe3e('0x23')]){throw new Error(_0xfe3e('0x13'));}if(_0x1fd579[_0xfe3e('0x18')]>0x0){if(_0x11a470[_0xfe3e('0x24')]){if(moment(_0x11a470[_0xfe3e('0x1f')])['add'](_0x1fd579[_0xfe3e('0x18')],_0xfe3e('0x25'))>moment()){throw new Error(_0xfe3e('0x13'));}return utils[_0xfe3e('0x26')](_0x11a470,0x0,![],null)['then'](function(){return utils[_0xfe3e('0x27')](_0x11a470);})[_0xfe3e('0x19')](function(){return _0x56c04c(null,_0x11a470);});}else{return utils['getLicense'](_0x11a470)['then'](function(){return _0x56c04c(null,_0x11a470);});}}else{return utils[_0xfe3e('0x27')](_0x11a470)[_0xfe3e('0x19')](function(){return _0x56c04c(null,_0x11a470);});}})[_0xfe3e('0x28')](function(_0x199519){return _0x56c04c(null,![],_0x199519);});}function handleError(_0x24b723,_0x3376c8,_0x20a8e3){return _0x24b723[_0xfe3e('0x29')](_0x3376c8||0x1f4)['send']({'message':_0x20a8e3?_0x20a8e3[_0xfe3e('0x2a')]||_0x20a8e3:''});}exports[_0xfe3e('0x2b')]=function(_0x179b43,_0x1a5929,_0x5403ae){passport[_0xfe3e('0xf')](_0xfe3e('0x2c'),function(_0xe6dc54,_0x546aba,_0x4b90b4){var _0x696ee7=_0xe6dc54||_0x4b90b4;if(_0x696ee7){return handleError(_0x1a5929,0x191,_0x696ee7);}if(!_0x546aba){return handleError(_0x1a5929,0x194,{'message':_0xfe3e('0x2d')});}else{var _0x58e7ff={'payload':{'id':_0x546aba['id'],'role':_0x546aba[_0xfe3e('0x1e')]},'options':{'expiresIn':0x15180}};return authService[_0xfe3e('0x2e')](_0x58e7ff)[_0xfe3e('0x19')](function(_0x107c83){_0x1a5929[_0xfe3e('0x2f')]({'id':_0x546aba['id'],'token':_0x107c83,'statusCall':'','isAlreadyLogged':_0x546aba[_0xfe3e('0x20')]});});}})(_0x179b43,_0x1a5929,_0x5403ae);};passport['use'](_0xfe3e('0x2c'),new LocalStrategy({'usernameField':'name','passwordField':'password'},function(_0x3fbc0b,_0x321b06,_0x5636bc){return ActiveDirectoryAuthenticate(db['User'],_0x3fbc0b,_0x321b06,_0x5636bc);})); \ No newline at end of file diff --git a/server/api/authActiveDirectory/index.js b/server/api/authActiveDirectory/index.js index a2a1b27..4abd547 100644 --- a/server/api/authActiveDirectory/index.js +++ b/server/api/authActiveDirectory/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb8bf=['express','Router','./authActiveDirectory.controller','post','login','exports'];(function(_0x2b4546,_0x4ca951){var _0x3d6ec5=function(_0x460361){while(--_0x460361){_0x2b4546['push'](_0x2b4546['shift']());}};_0x3d6ec5(++_0x4ca951);}(_0xb8bf,0xa8));var _0xfb8b=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xb8bf[_0x3947c9];return _0x2e7871;};'use strict';var express=require(_0xfb8b('0x0'));var router=express[_0xfb8b('0x1')]();var controller=require(_0xfb8b('0x2'));router[_0xfb8b('0x3')]('/',controller[_0xfb8b('0x4')]);module[_0xfb8b('0x5')]=router; \ No newline at end of file +var _0x1703=['exports','express','Router','./authActiveDirectory.controller','post'];(function(_0x4d8bcf,_0x2adfe7){var _0xe3ad0d=function(_0x2b32b5){while(--_0x2b32b5){_0x4d8bcf['push'](_0x4d8bcf['shift']());}};_0xe3ad0d(++_0x2adfe7);}(_0x1703,0x1be));var _0x3170=function(_0x11497b,_0x36d4af){_0x11497b=_0x11497b-0x0;var _0x1dd503=_0x1703[_0x11497b];return _0x1dd503;};'use strict';var express=require(_0x3170('0x0'));var router=express[_0x3170('0x1')]();var controller=require(_0x3170('0x2'));router[_0x3170('0x3')]('/',controller['login']);module[_0x3170('0x4')]=router; \ No newline at end of file diff --git a/server/api/authGoogle/authGoogle.controller.js b/server/api/authGoogle/authGoogle.controller.js index 7ae9fa1..93e1f4a 100644 --- a/server/api/authGoogle/authGoogle.controller.js +++ b/server/api/authGoogle/authGoogle.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x122096,_0x60c295){var _0x3d1966=function(_0x3d569e){while(--_0x3d569e){_0x122096['push'](_0x122096['shift']());}};_0x3d1966(++_0x60c295);}(_0x7a54,0x106));var _0x47a5=function(_0x51087e,_0x5eb300){_0x51087e=_0x51087e-0x0;var _0x5e8a9=_0x7a54[_0x51087e];return _0x5e8a9;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file +var _0x7a54=['blockedAt','add','minutes','clearBlockUser','getLicense','catch','lodash','passport','passport-google-oauth20','moment','../../mysqldb','../../config/utils','login','authenticate','google','/login','email','use','secret','callbackURL','findOne','allowedLoginAttempts','blockDuration','then','User','find','map','value','admin','user','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'];(function(_0x1abb09,_0x18ee91){var _0xea1c07=function(_0x38f42c){while(--_0x38f42c){_0x1abb09['push'](_0x1abb09['shift']());}};_0xea1c07(++_0x18ee91);}(_0x7a54,0x106));var _0x47a5=function(_0x2b25af,_0x405a1b){_0x2b25af=_0x2b25af-0x0;var _0x159edc=_0x7a54[_0x2b25af];return _0x159edc;};'use strict';var _=require(_0x47a5('0x0'));var passport=require(_0x47a5('0x1'));var GoogleStrategy=require(_0x47a5('0x2'))['Strategy'];var moment=require(_0x47a5('0x3'));var db=require(_0x47a5('0x4'))['db'];var config=require('../../config/environment');var utils=require(_0x47a5('0x5'));exports[_0x47a5('0x6')]=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':_0x47a5('0x9'),'scope':['profile',_0x47a5('0xa')],'session':![]});exports['callback']=passport[_0x47a5('0x7')](_0x47a5('0x8'),{'failureRedirect':'/login','session':![]});passport[_0x47a5('0xb')](new GoogleStrategy({'clientID':config['google']?config['google']['clientID']:'id','clientSecret':config[_0x47a5('0x8')]?config[_0x47a5('0x8')]['clientSecret']:_0x47a5('0xc'),'callbackURL':config['google']?config['google'][_0x47a5('0xd')]:''},function(_0x69e4d4,_0x2f399b,_0x250fad,_0xd612dd){var _0xd308b8,_0x1eae59;return db['Setting'][_0x47a5('0xe')]({'where':{'id':0x1},'attributes':[_0x47a5('0xf'),_0x47a5('0x10')],'raw':!![]})[_0x47a5('0x11')](function(_0x139f25){_0xd308b8=_0x139f25;return db[_0x47a5('0x12')][_0x47a5('0x13')]({'where':{'email':_[_0x47a5('0x14')](_0x250fad['emails'],_0x47a5('0x15')),'role':{'$or':[_0x47a5('0x16'),_0x47a5('0x17'),_0x47a5('0x18')]}}});})[_0x47a5('0x11')](function(_0x574af6){_0x1eae59=_0x574af6;if(_0x1eae59){if(_0x1eae59['disabled']){return _0xd612dd(_0x47a5('0x19'));}else if(_0xd308b8['blockDuration']>0x0){if(_0x1eae59['blocked']){if(moment(_0x1eae59[_0x47a5('0x1a')])[_0x47a5('0x1b')](_0xd308b8[_0x47a5('0x10')],_0x47a5('0x1c'))>moment()){return _0xd612dd(_0x47a5('0x19'));}else{return utils[_0x47a5('0x1d')](_0x1eae59,0x0,![],null)[_0x47a5('0x11')](function(){return utils[_0x47a5('0x1e')](_0x1eae59);})[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils['getLicense'](_0x1eae59)[_0x47a5('0x11')](function(){return _0xd612dd(null,_0x1eae59);});}}else{return utils[_0x47a5('0x1e')](_0x1eae59)['then'](function(){return _0xd612dd(null,_0x1eae59);});}}return _0xd612dd(_0x47a5('0x19'));})[_0x47a5('0x1f')](function(_0x36874d){_0xd612dd(_0x36874d);});})); \ No newline at end of file diff --git a/server/api/authGoogle/index.js b/server/api/authGoogle/index.js index d7f761b..5703d0f 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 _0x09d3=['express','passport','Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','isMiddleware','exports'];(function(_0x16183a,_0x482430){var _0x1f03d8=function(_0x1a0dae){while(--_0x1a0dae){_0x16183a['push'](_0x16183a['shift']());}};_0x1f03d8(++_0x482430);}(_0x09d3,0xa5));var _0x309d=function(_0x5a5af6,_0x1859de){_0x5a5af6=_0x5a5af6-0x0;var _0xddbe9b=_0x09d3[_0x5a5af6];return _0xddbe9b;};'use strict';var express=require(_0x309d('0x0'));var passport=require(_0x309d('0x1'));var router=express[_0x309d('0x2')]();var controller=require(_0x309d('0x3'));var userController=require(_0x309d('0x4'));var authService=require(_0x309d('0x5'));router[_0x309d('0x6')]('/',controller[_0x309d('0x7')]);router['get'](_0x309d('0x8'),controller['callback'],authService[_0x309d('0x9')],userController[_0x309d('0x7')],authService['setTokenCookie']);module[_0x309d('0xa')]=router; \ No newline at end of file +var _0x37a6=['Router','./authGoogle.controller','../user/user.controller.js','../../components/auth/service','get','login','/callback','callback','isMiddleware','setTokenCookie','exports','express','passport'];(function(_0x4fc3cb,_0x3cd460){var _0x16c8ee=function(_0xe0d443){while(--_0xe0d443){_0x4fc3cb['push'](_0x4fc3cb['shift']());}};_0x16c8ee(++_0x3cd460);}(_0x37a6,0x8d));var _0x637a=function(_0x304102,_0x43e4f6){_0x304102=_0x304102-0x0;var _0x15e403=_0x37a6[_0x304102];return _0x15e403;};'use strict';var express=require(_0x637a('0x0'));var passport=require(_0x637a('0x1'));var router=express[_0x637a('0x2')]();var controller=require(_0x637a('0x3'));var userController=require(_0x637a('0x4'));var authService=require(_0x637a('0x5'));router[_0x637a('0x6')]('/',controller[_0x637a('0x7')]);router[_0x637a('0x6')](_0x637a('0x8'),controller[_0x637a('0x9')],authService[_0x637a('0xa')],userController['login'],authService[_0x637a('0xb')]);module[_0x637a('0xc')]=router; \ No newline at end of file diff --git a/server/api/authLocal/authLocal.controller.js b/server/api/authLocal/authLocal.controller.js index 91f286a..2ef2f12 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 _0xbf7e=['name','password','salt','blocked','blockedAt','loginAttempts','admin','agent','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','authenticate','disabled','blockDuration','clearBlockUser','add','minutes','getLicense','catch','MailAccount','find','email','MailServerOut','Smtp','CloudProvider','getSmtpOptions','merge','\x22%s\x22\x20<%s>','SendMail','error','format','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','stringify','status','send','login','local-login','role','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','User','This\x20email\x20is\x20not\x20registered.','The\x20user\x20is\x20disabled.\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://','host','/reset/','If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a','reset','params','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','passwordHistoryLimit','securePassword','validatePasswordPattern','previousPasswords','validatePasswordHistory','use','util','passport','passport-local','Strategy','jayson/promise','lodash','moment','../../components/auth/service','../../config/utils','client','findOne','allowedLoginAttempts','then'];(function(_0x2688d5,_0x45db72){var _0x372637=function(_0x51c20d){while(--_0x51c20d){_0x2688d5['push'](_0x2688d5['shift']());}};_0x372637(++_0x45db72);}(_0xbf7e,0x183));var _0xebf7=function(_0x277522,_0x43d899){_0x277522=_0x277522-0x0;var _0x36c2de=_0xbf7e[_0x277522];return _0x36c2de;};'use strict';var util=require(_0xebf7('0x0'));var passport=require(_0xebf7('0x1'));var LocalStrategy=require(_0xebf7('0x2'))[_0xebf7('0x3')];var jayson=require(_0xebf7('0x4'));var _=require(_0xebf7('0x5'));var rs=require('randomstring');var moment=require(_0xebf7('0x6'));var db=require('../../mysqldb')['db'];var authService=require(_0xebf7('0x7'));var utils=require(_0xebf7('0x8'));var client=jayson[_0xebf7('0x9')]['http']({'port':0x232b});function localAuthenticate(_0x44df47,_0x4368af,_0x1f0698,_0x712e67){var _0x4c6fd8,_0x37fc0d;return db['Setting'][_0xebf7('0xa')]({'where':{'id':0x1},'attributes':[_0xebf7('0xb'),'blockDuration'],'raw':!![]})[_0xebf7('0xc')](function(_0x3ccb9d){_0x4c6fd8=_0x3ccb9d;return _0x44df47[_0xebf7('0xa')]({'attributes':['id',_0xebf7('0xd'),_0xebf7('0xe'),_0xebf7('0xf'),'role','disabled',_0xebf7('0x10'),_0xebf7('0x11'),_0xebf7('0x12')],'where':{'name':_0x4368af,'role':{'$or':[_0xebf7('0x13'),'user',_0xebf7('0x14')]}}});})[_0xebf7('0xc')](function(_0x105a46){if(!_0x105a46||_0x105a46&&_0x105a46[_0xebf7('0xd')]!==_0x4368af){throw new Error(_0xebf7('0x15'));}else{_0x37fc0d=_0x105a46;return _0x37fc0d;}})[_0xebf7('0xc')](function(){_0x37fc0d[_0xebf7('0x16')](_0x1f0698,function(_0x5bb6bf,_0x5d97d4){var _0x13c5b6=_0x37fc0d[_0xebf7('0x12')]+0x1;if(_0x5bb6bf){return _0x712e67(_0x5bb6bf);}else if(!_0x5d97d4){if(_0x37fc0d[_0xebf7('0x17')]){return _0x712e67(null,![],{'message':_0xebf7('0x15')});}else if(_0x4c6fd8[_0xebf7('0xb')]>0x0){if(_0x37fc0d[_0xebf7('0x10')]){if(_0x4c6fd8[_0xebf7('0x18')]>0x0){if(moment(_0x37fc0d[_0xebf7('0x11')])['add'](_0x4c6fd8[_0xebf7('0x18')],'minutes')>moment()){return _0x712e67(null,![],{'message':_0xebf7('0x15')});}else{return utils[_0xebf7('0x19')](_0x37fc0d,_0x13c5b6,![],null)[_0xebf7('0xc')](function(){return _0x712e67(null,![],{'message':_0xebf7('0x15')});});}}else{return _0x712e67(null,![],{'message':_0xebf7('0x15')});}}else{if(_0x13c5b6>=_0x4c6fd8[_0xebf7('0xb')]){return utils[_0xebf7('0x19')](_0x37fc0d,0x0,!![],moment())[_0xebf7('0xc')](function(){return _0x712e67(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});});}else{return utils[_0xebf7('0x19')](_0x37fc0d,_0x13c5b6,![],null)[_0xebf7('0xc')](function(){return _0x712e67(null,![],{'message':_0xebf7('0x15')});});}}}else{return _0x712e67(null,![],{'message':_0xebf7('0x15')});}}else{if(_0x37fc0d[_0xebf7('0x17')]){return _0x712e67(null,![],{'message':_0xebf7('0x15')});}else if(_0x4c6fd8[_0xebf7('0xb')]>0x0){if(_0x37fc0d[_0xebf7('0x10')]){if(_0x4c6fd8[_0xebf7('0x18')]>0x0){if(moment(_0x37fc0d[_0xebf7('0x11')])[_0xebf7('0x1a')](_0x4c6fd8[_0xebf7('0x18')],_0xebf7('0x1b'))>moment()){return _0x712e67(null,![],{'message':_0xebf7('0x15')});}else{return utils[_0xebf7('0x19')](_0x37fc0d,0x0,![],null)[_0xebf7('0xc')](function(){return utils[_0xebf7('0x1c')](_0x37fc0d);})[_0xebf7('0xc')](function(){return _0x712e67(null,_0x37fc0d);});}}else{return _0x712e67(null,![],{'message':_0xebf7('0x15')});}}else{return utils['clearBlockUser'](_0x37fc0d,0x0,![],null)['then'](function(){return utils[_0xebf7('0x1c')](_0x37fc0d);})['then'](function(){return _0x712e67(null,_0x37fc0d);})[_0xebf7('0x1d')](function(_0x16ed6a){return _0x712e67(null,![],_0x16ed6a);});}}else{if(_0x37fc0d[_0xebf7('0x10')]){return _0x712e67(null,![],{'message':_0xebf7('0x15')});}else{return utils[_0xebf7('0x1c')](_0x37fc0d)[_0xebf7('0xc')](function(){return _0x712e67(null,_0x37fc0d);});}}}});})[_0xebf7('0x1d')](function(_0xfa4e80){return _0x712e67(null,![],_0xfa4e80);});}function sendServiceMail(_0x27cb46){return db[_0xebf7('0x1e')][_0xebf7('0x1f')]({'where':{'service':!![]},'attributes':['id',_0xebf7('0xd'),_0xebf7('0x20')],'include':[{'model':db[_0xebf7('0x21')],'as':_0xebf7('0x22'),'include':[{'model':db[_0xebf7('0x23')],'as':_0xebf7('0x23')}]}]})[_0xebf7('0xc')](function(_0x2fdf4d){if(!_0x2fdf4d){throw new Error('Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!');}var _0x289474=_0x2fdf4d[_0xebf7('0x24')]();var _0x21f6a8={'account':_0x289474,'message':_[_0xebf7('0x25')]({'from':util['format'](_0xebf7('0x26'),_0x2fdf4d['name'],_0x2fdf4d[_0xebf7('0x20')]||_0x2fdf4d[_0xebf7('0x22')]['user'])},_0x27cb46)};return client['request'](_0xebf7('0x27'),_0x21f6a8);})[_0xebf7('0xc')](function(_0x599b27){if(_0x599b27[_0xebf7('0x28')]){throw new Error(util[_0xebf7('0x29')](_0xebf7('0x2a'),_0x599b27[_0xebf7('0x28')][_0xebf7('0x2b')]||JSON[_0xebf7('0x2c')](_0x599b27['error'])));}return!![];});}function handleError(_0xd6e1e8,_0x27fe82,_0x397abf){return _0xd6e1e8[_0xebf7('0x2d')](_0x27fe82||0x1f4)[_0xebf7('0x2e')]({'message':_0x397abf?_0x397abf[_0xebf7('0x2b')]||_0x397abf:''});}exports[_0xebf7('0x2f')]=function(_0x21a22d,_0xf1b194,_0xbea225){passport[_0xebf7('0x16')](_0xebf7('0x30'),function(_0x300548,_0x5ace5c,_0x405d6c){var _0x1d9b2b=_0x300548||_0x405d6c;if(_0x1d9b2b){return handleError(_0xf1b194,0x191,_0x1d9b2b);}if(!_0x5ace5c){return handleError(_0xf1b194,0x194,{'message':'Something\x20went\x20wrong,\x20please\x20try\x20again.'});}else{var _0x3f54ff={'payload':{'id':_0x5ace5c['id'],'role':_0x5ace5c[_0xebf7('0x31')]},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x3f54ff)[_0xebf7('0xc')](function(_0x4685d8){_0xf1b194[_0xebf7('0x32')]({'id':_0x5ace5c['id'],'token':_0x4685d8,'statusCall':'','isAlreadyLogged':_0x5ace5c[_0xebf7('0x33')]});});}})(_0x21a22d,_0xf1b194,_0xbea225);};exports[_0xebf7('0x34')]=function(_0x37291c,_0x50faf7){if(!_0x37291c[_0xebf7('0x35')][_0xebf7('0x20')]){return handleError(_0x50faf7,0x1f4,{'message':_0xebf7('0x36')});}var _0x1633aa=rs[_0xebf7('0x37')]();_0x37291c[_0xebf7('0x35')][_0xebf7('0x20')]=_0x37291c[_0xebf7('0x35')][_0xebf7('0x20')][_0xebf7('0x38')]()[_0xebf7('0x39')]();var _0x29b9c9;return db['Setting'][_0xebf7('0xa')]({'where':{'id':0x1},'attributes':[_0xebf7('0xb'),_0xebf7('0x18')],'raw':!![]})['then'](function(_0x3deb2a){_0x29b9c9=_0x3deb2a;return db[_0xebf7('0x3a')][_0xebf7('0x1f')]({'where':{'email':_0x37291c['body'][_0xebf7('0x20')]}});})[_0xebf7('0xc')](function(_0x52ea54){if(!_0x52ea54){throw new Error(_0xebf7('0x3b'));}if(_0x52ea54[_0xebf7('0x17')]){throw new Error(_0xebf7('0x3c'));}if(_0x52ea54[_0xebf7('0x10')]){if(moment(_0x52ea54[_0xebf7('0x11')])[_0xebf7('0x1a')](_0x29b9c9[_0xebf7('0x18')],'minutes')>moment()){throw new Error('The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.');}else{_0x52ea54[_0xebf7('0x10')]=![];_0x52ea54['blockedAt']=null;}}_0x52ea54[_0xebf7('0x3d')]=_0x1633aa;_0x52ea54[_0xebf7('0x3e')]=Date[_0xebf7('0x3f')]()+0x36ee80;return _0x52ea54[_0xebf7('0x40')]();})[_0xebf7('0xc')](function(){return sendServiceMail({'to':_0x37291c['body']['email'],'subject':_0xebf7('0x41'),'text':_0xebf7('0x42')+'Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a'+_0xebf7('0x43')+_0x37291c['headers'][_0xebf7('0x44')]+_0xebf7('0x45')+_0x1633aa+'\x0a\x0a'+_0xebf7('0x46')});})[_0xebf7('0xc')](function(){_0x50faf7['status'](0xc8)[_0xebf7('0x2e')]({'message':'Reset\x20Email\x20sent!'});})[_0xebf7('0x1d')](function(_0x764f7d){return handleError(_0x50faf7,0x1f4,_0x764f7d);});};exports[_0xebf7('0x47')]=function(_0x2a3cf7,_0x3efa79){return db['User'][_0xebf7('0x1f')]({'where':{'resetPasswordToken':_0x2a3cf7[_0xebf7('0x48')]['token'],'resetPasswordExpires':{'$gt':Date[_0xebf7('0x3f')]()}}})[_0xebf7('0xc')](function(_0x5401bf){if(!_0x5401bf){throw new Error(_0xebf7('0x49'));}return db['Setting'][_0xebf7('0xa')]({'attributes':['id','securePassword','enforcePasswordHistory',_0xebf7('0x4a')]})[_0xebf7('0xc')](function(_0x12aa0f){if(_0x12aa0f[_0xebf7('0x4b')])authService[_0xebf7('0x4c')](_0x2a3cf7['body']['password']);if(!_0x12aa0f['enforcePasswordHistory']||!_0x5401bf[_0xebf7('0x4d')])return _0x5401bf;authService[_0xebf7('0x4e')](_0x2a3cf7[_0xebf7('0x35')]['password'],_0x5401bf[_0xebf7('0x4d')],_0x12aa0f['passwordHistoryLimit']);return _0x5401bf;})['then'](function(){_0x5401bf[_0xebf7('0xe')]=_0x2a3cf7['body'][_0xebf7('0xe')];_0x5401bf[_0xebf7('0x3d')]=null;_0x5401bf['resetPasswordExpires']=null;return _0x5401bf[_0xebf7('0x40')]();});})[_0xebf7('0xc')](function(){_0x3efa79[_0xebf7('0x2d')](0xc8)[_0xebf7('0x2e')]({'message':'Password\x20reset!'});})[_0xebf7('0x1d')](function(_0x3727ff){return handleError(_0x3efa79,0x1f4,_0x3727ff);});};passport[_0xebf7('0x4f')](_0xebf7('0x30'),new LocalStrategy({'usernameField':'name','passwordField':_0xebf7('0xe')},function(_0x331942,_0x5a930e,_0x419217){return localAuthenticate(db[_0xebf7('0x3a')],_0x331942,_0x5a930e,_0x419217);})); \ No newline at end of file +var _0xb476=['token','Password\x20reset\x20token\x20is\x20invalid\x20or\x20has\x20expired.','securePassword','enforcePasswordHistory','passwordHistoryLimit','validatePasswordPattern','previousPasswords','resetPasswordToken','Password\x20reset!','use','util','passport','passport-local','Strategy','jayson/promise','lodash','randomstring','moment','../../mysqldb','../../config/utils','findOne','allowedLoginAttempts','then','password','role','disabled','blocked','agent','name','Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.','blockDuration','blockedAt','add','minutes','clearBlockUser','getLicense','catch','find','email','MailServerOut','Smtp','CloudProvider','Unable\x20to\x20find\x20a\x20configured\x20SMTP\x20service!','getSmtpOptions','format','user','request','error','SendMail\x20error:\x20%s.\x20Please\x20contact\x20your\x20Administrator!','message','status','send','login','authenticate','local-login','Something\x20went\x20wrong,\x20please\x20try\x20again.','json','online','forgot','body','Email\x20parameter\x20is\x20missing','generate','trim','toLowerCase','Setting','The\x20user\x20is\x20disabled.\x20Please\x20contact\x20the\x20administrator.','The\x20user\x20is\x20blocked.\x20Please\x20contact\x20the\x20administrator.','resetPasswordExpires','now','save','Please\x20click\x20on\x20the\x20following\x20link,\x20or\x20paste\x20this\x20into\x20your\x20browser\x20to\x20complete\x20the\x20process:\x0a\x0a','https://','host','User'];(function(_0x245b11,_0x37bb3f){var _0x434d15=function(_0xae0870){while(--_0xae0870){_0x245b11['push'](_0x245b11['shift']());}};_0x434d15(++_0x37bb3f);}(_0xb476,0x9e));var _0x6b47=function(_0x24fa1a,_0x16d9c2){_0x24fa1a=_0x24fa1a-0x0;var _0xc5621f=_0xb476[_0x24fa1a];return _0xc5621f;};'use strict';var util=require(_0x6b47('0x0'));var passport=require(_0x6b47('0x1'));var LocalStrategy=require(_0x6b47('0x2'))[_0x6b47('0x3')];var jayson=require(_0x6b47('0x4'));var _=require(_0x6b47('0x5'));var rs=require(_0x6b47('0x6'));var moment=require(_0x6b47('0x7'));var db=require(_0x6b47('0x8'))['db'];var authService=require('../../components/auth/service');var utils=require(_0x6b47('0x9'));var client=jayson['client']['http']({'port':0x232b});function localAuthenticate(_0xa542b6,_0x3cf785,_0x50bef6,_0x1f0375){var _0x42eff5,_0x3aa43b;return db['Setting'][_0x6b47('0xa')]({'where':{'id':0x1},'attributes':[_0x6b47('0xb'),'blockDuration'],'raw':!![]})[_0x6b47('0xc')](function(_0x579160){_0x42eff5=_0x579160;return _0xa542b6[_0x6b47('0xa')]({'attributes':['id','name',_0x6b47('0xd'),'salt',_0x6b47('0xe'),_0x6b47('0xf'),_0x6b47('0x10'),'blockedAt','loginAttempts'],'where':{'name':_0x3cf785,'role':{'$or':['admin','user',_0x6b47('0x11')]}}});})['then'](function(_0x531ac7){if(!_0x531ac7||_0x531ac7&&_0x531ac7[_0x6b47('0x12')]!==_0x3cf785){throw new Error(_0x6b47('0x13'));}else{_0x3aa43b=_0x531ac7;return _0x3aa43b;}})[_0x6b47('0xc')](function(){_0x3aa43b['authenticate'](_0x50bef6,function(_0x3c67be,_0x203952){var _0x2a9cd9=_0x3aa43b['loginAttempts']+0x1;if(_0x3c67be){return _0x1f0375(_0x3c67be);}else if(!_0x203952){if(_0x3aa43b['disabled']){return _0x1f0375(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else if(_0x42eff5[_0x6b47('0xb')]>0x0){if(_0x3aa43b[_0x6b47('0x10')]){if(_0x42eff5[_0x6b47('0x14')]>0x0){if(moment(_0x3aa43b[_0x6b47('0x15')])[_0x6b47('0x16')](_0x42eff5[_0x6b47('0x14')],_0x6b47('0x17'))>moment()){return _0x1f0375(null,![],{'message':'Incorrect\x20username\x20and/or\x20password.\x20Please\x20retry\x20again\x20or\x20contact\x20the\x20administrator.'});}else{return utils['clearBlockUser'](_0x3aa43b,_0x2a9cd9,![],null)[_0x6b47('0xc')](function(){return _0x1f0375(null,![],{'message':_0x6b47('0x13')});});}}else{return _0x1f0375(null,![],{'message':_0x6b47('0x13')});}}else{if(_0x2a9cd9>=_0x42eff5[_0x6b47('0xb')]){return utils[_0x6b47('0x18')](_0x3aa43b,0x0,!![],moment())[_0x6b47('0xc')](function(){return _0x1f0375(null,![],{'message':_0x6b47('0x13')});});}else{return utils[_0x6b47('0x18')](_0x3aa43b,_0x2a9cd9,![],null)[_0x6b47('0xc')](function(){return _0x1f0375(null,![],{'message':_0x6b47('0x13')});});}}}else{return _0x1f0375(null,![],{'message':_0x6b47('0x13')});}}else{if(_0x3aa43b[_0x6b47('0xf')]){return _0x1f0375(null,![],{'message':_0x6b47('0x13')});}else if(_0x42eff5['allowedLoginAttempts']>0x0){if(_0x3aa43b[_0x6b47('0x10')]){if(_0x42eff5['blockDuration']>0x0){if(moment(_0x3aa43b['blockedAt'])[_0x6b47('0x16')](_0x42eff5[_0x6b47('0x14')],'minutes')>moment()){return _0x1f0375(null,![],{'message':_0x6b47('0x13')});}else{return utils[_0x6b47('0x18')](_0x3aa43b,0x0,![],null)['then'](function(){return utils[_0x6b47('0x19')](_0x3aa43b);})['then'](function(){return _0x1f0375(null,_0x3aa43b);});}}else{return _0x1f0375(null,![],{'message':_0x6b47('0x13')});}}else{return utils['clearBlockUser'](_0x3aa43b,0x0,![],null)[_0x6b47('0xc')](function(){return utils[_0x6b47('0x19')](_0x3aa43b);})['then'](function(){return _0x1f0375(null,_0x3aa43b);})['catch'](function(_0x248419){return _0x1f0375(null,![],_0x248419);});}}else{if(_0x3aa43b['blocked']){return _0x1f0375(null,![],{'message':_0x6b47('0x13')});}else{return utils[_0x6b47('0x19')](_0x3aa43b)['then'](function(){return _0x1f0375(null,_0x3aa43b);});}}}});})[_0x6b47('0x1a')](function(_0x58b83d){return _0x1f0375(null,![],_0x58b83d);});}function sendServiceMail(_0x4ba711){return db['MailAccount'][_0x6b47('0x1b')]({'where':{'service':!![]},'attributes':['id','name',_0x6b47('0x1c')],'include':[{'model':db[_0x6b47('0x1d')],'as':_0x6b47('0x1e'),'include':[{'model':db[_0x6b47('0x1f')],'as':_0x6b47('0x1f')}]}]})[_0x6b47('0xc')](function(_0x34efcd){if(!_0x34efcd){throw new Error(_0x6b47('0x20'));}var _0x2a6449=_0x34efcd[_0x6b47('0x21')]();var _0x430105={'account':_0x2a6449,'message':_['merge']({'from':util[_0x6b47('0x22')]('\x22%s\x22\x20<%s>',_0x34efcd[_0x6b47('0x12')],_0x34efcd[_0x6b47('0x1c')]||_0x34efcd[_0x6b47('0x1e')][_0x6b47('0x23')])},_0x4ba711)};return client[_0x6b47('0x24')]('SendMail',_0x430105);})['then'](function(_0x2dcf95){if(_0x2dcf95[_0x6b47('0x25')]){throw new Error(util[_0x6b47('0x22')](_0x6b47('0x26'),_0x2dcf95[_0x6b47('0x25')][_0x6b47('0x27')]||JSON['stringify'](_0x2dcf95[_0x6b47('0x25')])));}return!![];});}function handleError(_0x4d75d0,_0x5c07b4,_0x3b124c){return _0x4d75d0[_0x6b47('0x28')](_0x5c07b4||0x1f4)[_0x6b47('0x29')]({'message':_0x3b124c?_0x3b124c[_0x6b47('0x27')]||_0x3b124c:''});}exports[_0x6b47('0x2a')]=function(_0x2cebf7,_0x556cf2,_0x2eea78){passport[_0x6b47('0x2b')](_0x6b47('0x2c'),function(_0x19cd56,_0x2a44a3,_0x1ce5d3){var _0x2a7146=_0x19cd56||_0x1ce5d3;if(_0x2a7146){return handleError(_0x556cf2,0x191,_0x2a7146);}if(!_0x2a44a3){return handleError(_0x556cf2,0x194,{'message':_0x6b47('0x2d')});}else{var _0x35430a={'payload':{'id':_0x2a44a3['id'],'role':_0x2a44a3['role']},'options':{'expiresIn':0x15180}};return authService['signToken'](_0x35430a)['then'](function(_0x470f3a){_0x556cf2[_0x6b47('0x2e')]({'id':_0x2a44a3['id'],'token':_0x470f3a,'statusCall':'','isAlreadyLogged':_0x2a44a3[_0x6b47('0x2f')]});});}})(_0x2cebf7,_0x556cf2,_0x2eea78);};exports[_0x6b47('0x30')]=function(_0x32df0b,_0x143007){if(!_0x32df0b[_0x6b47('0x31')][_0x6b47('0x1c')]){return handleError(_0x143007,0x1f4,{'message':_0x6b47('0x32')});}var _0xc8813=rs[_0x6b47('0x33')]();_0x32df0b['body'][_0x6b47('0x1c')]=_0x32df0b[_0x6b47('0x31')][_0x6b47('0x1c')][_0x6b47('0x34')]()[_0x6b47('0x35')]();var _0x1056b2;return db[_0x6b47('0x36')][_0x6b47('0xa')]({'where':{'id':0x1},'attributes':[_0x6b47('0xb'),_0x6b47('0x14')],'raw':!![]})[_0x6b47('0xc')](function(_0x2fb127){_0x1056b2=_0x2fb127;return db['User'][_0x6b47('0x1b')]({'where':{'email':_0x32df0b[_0x6b47('0x31')][_0x6b47('0x1c')]}});})[_0x6b47('0xc')](function(_0x576b3b){if(!_0x576b3b){throw new Error('This\x20email\x20is\x20not\x20registered.');}if(_0x576b3b[_0x6b47('0xf')]){throw new Error(_0x6b47('0x37'));}if(_0x576b3b[_0x6b47('0x10')]){if(moment(_0x576b3b['blockedAt'])[_0x6b47('0x16')](_0x1056b2['blockDuration'],'minutes')>moment()){throw new Error(_0x6b47('0x38'));}else{_0x576b3b[_0x6b47('0x10')]=![];_0x576b3b['blockedAt']=null;}}_0x576b3b['resetPasswordToken']=_0xc8813;_0x576b3b[_0x6b47('0x39')]=Date[_0x6b47('0x3a')]()+0x36ee80;return _0x576b3b[_0x6b47('0x3b')]();})[_0x6b47('0xc')](function(){return sendServiceMail({'to':_0x32df0b['body']['email'],'subject':'xCally\x20Motion\x20Password\x20Reset','text':'You\x20are\x20receiving\x20this\x20because\x20you\x20(or\x20someone\x20else)\x20have\x20requested\x20the\x20reset\x20of\x20the\x20password\x20for\x20your\x20account.\x0a\x0a'+_0x6b47('0x3c')+_0x6b47('0x3d')+_0x32df0b['headers'][_0x6b47('0x3e')]+'/reset/'+_0xc8813+'\x0a\x0a'+'If\x20you\x20did\x20not\x20request\x20this,\x20please\x20ignore\x20this\x20email\x20and\x20your\x20password\x20will\x20remain\x20unchanged.\x0a'});})[_0x6b47('0xc')](function(){_0x143007['status'](0xc8)[_0x6b47('0x29')]({'message':'Reset\x20Email\x20sent!'});})['catch'](function(_0x3155d1){return handleError(_0x143007,0x1f4,_0x3155d1);});};exports['reset']=function(_0x34d277,_0x3f164f){return db[_0x6b47('0x3f')][_0x6b47('0x1b')]({'where':{'resetPasswordToken':_0x34d277['params'][_0x6b47('0x40')],'resetPasswordExpires':{'$gt':Date[_0x6b47('0x3a')]()}}})[_0x6b47('0xc')](function(_0x23750f){if(!_0x23750f){throw new Error(_0x6b47('0x41'));}return db[_0x6b47('0x36')][_0x6b47('0xa')]({'attributes':['id',_0x6b47('0x42'),_0x6b47('0x43'),_0x6b47('0x44')]})[_0x6b47('0xc')](function(_0x38fe1c){if(_0x38fe1c[_0x6b47('0x42')])authService[_0x6b47('0x45')](_0x34d277['body'][_0x6b47('0xd')]);if(!_0x38fe1c[_0x6b47('0x43')]||!_0x23750f[_0x6b47('0x46')])return _0x23750f;authService['validatePasswordHistory'](_0x34d277['body'][_0x6b47('0xd')],_0x23750f[_0x6b47('0x46')],_0x38fe1c['passwordHistoryLimit']);return _0x23750f;})[_0x6b47('0xc')](function(){_0x23750f['password']=_0x34d277[_0x6b47('0x31')][_0x6b47('0xd')];_0x23750f[_0x6b47('0x47')]=null;_0x23750f[_0x6b47('0x39')]=null;return _0x23750f['save']();});})[_0x6b47('0xc')](function(){_0x3f164f[_0x6b47('0x28')](0xc8)[_0x6b47('0x29')]({'message':_0x6b47('0x48')});})[_0x6b47('0x1a')](function(_0x4203b4){return handleError(_0x3f164f,0x1f4,_0x4203b4);});};passport[_0x6b47('0x49')]('local-login',new LocalStrategy({'usernameField':_0x6b47('0x12'),'passwordField':_0x6b47('0xd')},function(_0x25ab8a,_0x590160,_0x5041c7){return localAuthenticate(db[_0x6b47('0x3f')],_0x25ab8a,_0x590160,_0x5041c7);})); \ No newline at end of file diff --git a/server/api/authLocal/index.js b/server/api/authLocal/index.js index 188b5ec..85201bf 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 _0x91ad=['/forgot','forgot','/reset/:token','reset','exports','post'];(function(_0x4f8d61,_0x29eff0){var _0x3bc078=function(_0x4c7203){while(--_0x4c7203){_0x4f8d61['push'](_0x4f8d61['shift']());}};_0x3bc078(++_0x29eff0);}(_0x91ad,0xb9));var _0xd91a=function(_0x2c9b13,_0x4fa585){_0x2c9b13=_0x2c9b13-0x0;var _0x351b56=_0x91ad[_0x2c9b13];return _0x351b56;};'use strict';var express=require('express');var router=express['Router']();var controller=require('./authLocal.controller');router['post']('/',controller['login']);router[_0xd91a('0x0')](_0xd91a('0x1'),controller[_0xd91a('0x2')]);router[_0xd91a('0x0')](_0xd91a('0x3'),controller[_0xd91a('0x4')]);module[_0xd91a('0x5')]=router; \ No newline at end of file +var _0x8cc5=['login','/forgot','forgot','/reset/:token','reset','exports','express','Router','./authLocal.controller','post'];(function(_0x4c250d,_0x3acd62){var _0x285449=function(_0x437583){while(--_0x437583){_0x4c250d['push'](_0x4c250d['shift']());}};_0x285449(++_0x3acd62);}(_0x8cc5,0xe2));var _0x58cc=function(_0x222ca9,_0x5a6023){_0x222ca9=_0x222ca9-0x0;var _0x2eb5c0=_0x8cc5[_0x222ca9];return _0x2eb5c0;};'use strict';var express=require(_0x58cc('0x0'));var router=express[_0x58cc('0x1')]();var controller=require(_0x58cc('0x2'));router[_0x58cc('0x3')]('/',controller[_0x58cc('0x4')]);router[_0x58cc('0x3')](_0x58cc('0x5'),controller[_0x58cc('0x6')]);router[_0x58cc('0x3')](_0x58cc('0x7'),controller[_0x58cc('0x8')]);module[_0x58cc('0x9')]=router; \ No newline at end of file diff --git a/server/api/automation/automation.attributes.js b/server/api/automation/automation.attributes.js index 40ae4dc..ba334cd 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 _0xbaf9=['STRING','BOOLEAN','INTEGER','sequelize'];(function(_0x443f2e,_0x26e706){var _0x17070d=function(_0x595f67){while(--_0x595f67){_0x443f2e['push'](_0x443f2e['shift']());}};_0x17070d(++_0x26e706);}(_0xbaf9,0x97));var _0x9baf=function(_0x48b94d,_0x2f1b95){_0x48b94d=_0x48b94d-0x0;var _0x30ca8f=_0xbaf9[_0x48b94d];return _0x30ca8f;};'use strict';var Sequelize=require(_0x9baf('0x0'));module['exports']={'name':{'type':Sequelize[_0x9baf('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0x9baf('0x1')]},'description':{'type':Sequelize[_0x9baf('0x1')]},'status':{'type':Sequelize[_0x9baf('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize[_0x9baf('0x3')],'defaultValue':0xa}}; \ No newline at end of file +var _0x7e3d=['sequelize','STRING','BOOLEAN'];(function(_0x36e265,_0x4b41d0){var _0x4c46f0=function(_0x266fda){while(--_0x266fda){_0x36e265['push'](_0x36e265['shift']());}};_0x4c46f0(++_0x4b41d0);}(_0x7e3d,0x189));var _0xd7e3=function(_0x5eb456,_0x11789b){_0x5eb456=_0x5eb456-0x0;var _0x435279=_0x7e3d[_0x5eb456];return _0x435279;};'use strict';var Sequelize=require(_0xd7e3('0x0'));module['exports']={'name':{'type':Sequelize[_0xd7e3('0x1')],'allowNull':![]},'channel':{'type':Sequelize[_0xd7e3('0x1')]},'description':{'type':Sequelize[_0xd7e3('0x1')]},'status':{'type':Sequelize[_0xd7e3('0x2')],'defaultValue':![]},'timeout':{'type':Sequelize['INTEGER'],'defaultValue':0xa}}; \ No newline at end of file diff --git a/server/api/automation/automation.controller.js b/server/api/automation/automation.controller.js index fe3a6cd..8e43039 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 _0xd9c2=['intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','update','body','addConditions','omit','ids','getConditions','findOne','keys','Condition','addActions','Action','getActions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','to-csv','ejs','fs-extra','lodash','squel','crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','save','then','stack','name','send','index','map','Automation','fieldName','type','key','model','query','filters'];(function(_0x20ef64,_0x4a8fe9){var _0x3707d8=function(_0x5b9a88){while(--_0x5b9a88){_0x20ef64['push'](_0x20ef64['shift']());}};_0x3707d8(++_0x4a8fe9);}(_0xd9c2,0x74));var _0x2d9c=function(_0x533897,_0x34e7c8){_0x533897=_0x533897-0x0;var _0x340bbd=_0xd9c2[_0x533897];return _0x340bbd;};'use strict';var emlformat=require(_0x2d9c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2d9c('0x1'));var jsonpatch=require(_0x2d9c('0x2'));var rp=require(_0x2d9c('0x3'));var moment=require(_0x2d9c('0x4'));var BPromise=require(_0x2d9c('0x5'));var Mustache=require(_0x2d9c('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x2d9c('0x7'));var ejs=require(_0x2d9c('0x8'));var fs=require('fs');var fs_extra=require(_0x2d9c('0x9'));var _=require(_0x2d9c('0xa'));var squel=require(_0x2d9c('0xb'));var crypto=require(_0x2d9c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x2d9c('0x7'));var querystring=require('querystring');var Papa=require(_0x2d9c('0xd'));var Redis=require(_0x2d9c('0xe'));var authService=require(_0x2d9c('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x2d9c('0x10'));var hardwareService=require(_0x2d9c('0x11'));var logger=require('../../config/logger')(_0x2d9c('0x12'));var utils=require(_0x2d9c('0x13'));var config=require(_0x2d9c('0x14'));var licenseUtil=require(_0x2d9c('0x15'));var db=require(_0x2d9c('0x16'))['db'];function respondWithStatusCode(_0x1d5895,_0x383e30){_0x383e30=_0x383e30||0xcc;return function(_0xca2101){if(_0xca2101){return _0x1d5895[_0x2d9c('0x17')](_0x383e30);}return _0x1d5895[_0x2d9c('0x18')](_0x383e30)[_0x2d9c('0x19')]();};}function respondWithResult(_0x220d87,_0x7c3f66){_0x7c3f66=_0x7c3f66||0xc8;return function(_0x19d81b){if(_0x19d81b){return _0x220d87[_0x2d9c('0x18')](_0x7c3f66)[_0x2d9c('0x1a')](_0x19d81b);}};}function respondWithFilteredResult(_0x369a4e,_0x2b36e1){return function(_0x12e37d){if(_0x12e37d){var _0x11e73d=typeof _0x2b36e1['offset']==='undefined'&&typeof _0x2b36e1[_0x2d9c('0x1b')]===_0x2d9c('0x1c');var _0x22290c=_0x12e37d[_0x2d9c('0x1d')];var _0x47a561=_0x11e73d?0x0:_0x2b36e1[_0x2d9c('0x1e')];var _0x22b083=_0x11e73d?_0x12e37d[_0x2d9c('0x1d')]:_0x2b36e1[_0x2d9c('0x1e')]+_0x2b36e1[_0x2d9c('0x1b')];var _0x1b60b1;if(_0x22b083>=_0x22290c){_0x22b083=_0x22290c;_0x1b60b1=0xc8;}else{_0x1b60b1=0xce;}_0x369a4e[_0x2d9c('0x18')](_0x1b60b1);return _0x369a4e['set'](_0x2d9c('0x1f'),_0x47a561+'-'+_0x22b083+'/'+_0x22290c)[_0x2d9c('0x1a')](_0x12e37d);}return null;};}function patchUpdates(_0x1381da){return function(_0x504a82){try{jsonpatch[_0x2d9c('0x20')](_0x504a82,_0x1381da,!![]);}catch(_0x5260fe){return BPromise[_0x2d9c('0x21')](_0x5260fe);}return _0x504a82[_0x2d9c('0x22')]();};}function saveUpdates(_0x3e5f8f,_0x38a760){return function(_0x54f15f){if(_0x54f15f){return _0x54f15f['update'](_0x3e5f8f)[_0x2d9c('0x23')](function(_0x1d5d3b){return _0x1d5d3b;});}return null;};}function removeEntity(_0x1d9838,_0x3e78ca){return function(_0x4c07d5){if(_0x4c07d5){return _0x4c07d5['destroy']()[_0x2d9c('0x23')](function(){_0x1d9838[_0x2d9c('0x18')](0xcc)[_0x2d9c('0x19')]();});}};}function handleEntityNotFound(_0x5c86b6,_0x59b1a9){return function(_0x10174e){if(!_0x10174e){_0x5c86b6[_0x2d9c('0x17')](0x194);}return _0x10174e;};}function handleError(_0x29a16f,_0x5e7d08){_0x5e7d08=_0x5e7d08||0x1f4;return function(_0x5d7838){logger['error'](_0x5d7838[_0x2d9c('0x24')]);if(_0x5d7838[_0x2d9c('0x25')]){delete _0x5d7838[_0x2d9c('0x25')];}_0x29a16f[_0x2d9c('0x18')](_0x5e7d08)[_0x2d9c('0x26')](_0x5d7838);};}exports[_0x2d9c('0x27')]=function(_0x1984ae,_0x5f57ce){var _0x39f356={},_0x5e29ce={},_0x40288f={'count':0x0,'rows':[]};var _0x2bf25d=_[_0x2d9c('0x28')](db[_0x2d9c('0x29')]['rawAttributes'],function(_0xea9ca){return{'name':_0xea9ca[_0x2d9c('0x2a')],'type':_0xea9ca[_0x2d9c('0x2b')][_0x2d9c('0x2c')]};});_0x5e29ce[_0x2d9c('0x2d')]=_[_0x2d9c('0x28')](_0x2bf25d,'name');_0x5e29ce[_0x2d9c('0x2e')]=_['keys'](_0x1984ae[_0x2d9c('0x2e')]);_0x5e29ce[_0x2d9c('0x2f')]=_[_0x2d9c('0x30')](_0x5e29ce[_0x2d9c('0x2d')],_0x5e29ce[_0x2d9c('0x2e')]);_0x39f356[_0x2d9c('0x31')]=_[_0x2d9c('0x30')](_0x5e29ce[_0x2d9c('0x2d')],qs[_0x2d9c('0x32')](_0x1984ae[_0x2d9c('0x2e')]['fields']));_0x39f356['attributes']=_0x39f356[_0x2d9c('0x31')][_0x2d9c('0x33')]?_0x39f356[_0x2d9c('0x31')]:_0x5e29ce[_0x2d9c('0x2d')];if(!_0x1984ae[_0x2d9c('0x2e')][_0x2d9c('0x34')](_0x2d9c('0x35'))){_0x39f356[_0x2d9c('0x1b')]=qs[_0x2d9c('0x1b')](_0x1984ae[_0x2d9c('0x2e')]['limit']);_0x39f356['offset']=qs['offset'](_0x1984ae['query'][_0x2d9c('0x1e')]);}_0x39f356[_0x2d9c('0x36')]=qs[_0x2d9c('0x37')](_0x1984ae[_0x2d9c('0x2e')]['sort']);_0x39f356['where']=qs[_0x2d9c('0x2f')](_[_0x2d9c('0x38')](_0x1984ae[_0x2d9c('0x2e')],_0x5e29ce[_0x2d9c('0x2f')]),_0x2bf25d);if(_0x1984ae[_0x2d9c('0x2e')]['filter']){_0x39f356[_0x2d9c('0x39')]=_[_0x2d9c('0x3a')](_0x39f356[_0x2d9c('0x39')],{'$or':_[_0x2d9c('0x28')](_0x2bf25d,function(_0x10164c){if(_0x10164c[_0x2d9c('0x2b')]!=='VIRTUAL'){var _0x69b60f={};_0x69b60f[_0x10164c[_0x2d9c('0x25')]]={'$like':'%'+_0x1984ae[_0x2d9c('0x2e')][_0x2d9c('0x3b')]+'%'};return _0x69b60f;}})});}_0x39f356=_[_0x2d9c('0x3a')]({},_0x39f356,_0x1984ae[_0x2d9c('0x3c')]);var _0x34b33f={'where':_0x39f356[_0x2d9c('0x39')]};return db[_0x2d9c('0x29')][_0x2d9c('0x1d')](_0x34b33f)[_0x2d9c('0x23')](function(_0x22b9e7){_0x40288f[_0x2d9c('0x1d')]=_0x22b9e7;if(_0x1984ae[_0x2d9c('0x2e')][_0x2d9c('0x3d')]){_0x39f356['include']=[{'all':!![]}];}return db[_0x2d9c('0x29')][_0x2d9c('0x3e')](_0x39f356);})[_0x2d9c('0x23')](function(_0x9304c8){_0x40288f[_0x2d9c('0x3f')]=_0x9304c8;return _0x40288f;})['then'](respondWithFilteredResult(_0x5f57ce,_0x39f356))[_0x2d9c('0x40')](handleError(_0x5f57ce,null));};exports[_0x2d9c('0x41')]=function(_0x14a407,_0x2ec049){var _0x193a83={'raw':![],'where':{'id':_0x14a407[_0x2d9c('0x42')]['id']}},_0x2a9783={};_0x2a9783[_0x2d9c('0x2d')]=_['keys'](db['Automation'][_0x2d9c('0x43')]);_0x2a9783[_0x2d9c('0x2e')]=_['keys'](_0x14a407['query']);_0x2a9783['filters']=_[_0x2d9c('0x30')](_0x2a9783['model'],_0x2a9783['query']);_0x193a83[_0x2d9c('0x31')]=_['intersection'](_0x2a9783[_0x2d9c('0x2d')],qs[_0x2d9c('0x32')](_0x14a407['query'][_0x2d9c('0x32')]));_0x193a83[_0x2d9c('0x31')]=_0x193a83['attributes'][_0x2d9c('0x33')]?_0x193a83[_0x2d9c('0x31')]:_0x2a9783[_0x2d9c('0x2d')];if(_0x14a407[_0x2d9c('0x2e')][_0x2d9c('0x3d')]){_0x193a83['include']=[{'all':!![]}];}_0x193a83=_[_0x2d9c('0x3a')]({},_0x193a83,_0x14a407[_0x2d9c('0x3c')]);return db['Automation'][_0x2d9c('0x44')](_0x193a83)[_0x2d9c('0x23')](handleEntityNotFound(_0x2ec049,null))['then'](respondWithResult(_0x2ec049,null))['catch'](handleError(_0x2ec049,null));};exports[_0x2d9c('0x45')]=function(_0x2fbf04,_0x5ca015){return db[_0x2d9c('0x29')][_0x2d9c('0x45')](_0x2fbf04['body'],{})[_0x2d9c('0x23')](respondWithResult(_0x5ca015,0xc9))[_0x2d9c('0x40')](handleError(_0x5ca015,null));};exports[_0x2d9c('0x46')]=function(_0x281957,_0x27203c){if(_0x281957[_0x2d9c('0x47')]['id']){delete _0x281957['body']['id'];}return db[_0x2d9c('0x29')][_0x2d9c('0x44')]({'where':{'id':_0x281957[_0x2d9c('0x42')]['id']}})[_0x2d9c('0x23')](handleEntityNotFound(_0x27203c,null))[_0x2d9c('0x23')](saveUpdates(_0x281957[_0x2d9c('0x47')],null))[_0x2d9c('0x23')](respondWithResult(_0x27203c,null))[_0x2d9c('0x40')](handleError(_0x27203c,null));};exports['destroy']=function(_0xb7f9c1,_0x762cc){return db['Automation'][_0x2d9c('0x44')]({'where':{'id':_0xb7f9c1[_0x2d9c('0x42')]['id']}})[_0x2d9c('0x23')](handleEntityNotFound(_0x762cc,null))[_0x2d9c('0x23')](removeEntity(_0x762cc,null))['catch'](handleError(_0x762cc,null));};exports['addConditions']=function(_0x2e17eb,_0x271e90,_0x50bfec){return db['Condition'][_0x2d9c('0x44')]({'where':{'id':_0x2e17eb[_0x2d9c('0x42')]['id']}})[_0x2d9c('0x23')](handleEntityNotFound(_0x271e90,null))['then'](function(_0x226de1){if(_0x226de1){return _0x226de1[_0x2d9c('0x48')](_0x2e17eb['body']['ids'],_[_0x2d9c('0x49')](_0x2e17eb[_0x2d9c('0x47')],[_0x2d9c('0x4a'),'id'])||{});}})[_0x2d9c('0x23')](respondWithResult(_0x271e90,null))[_0x2d9c('0x40')](handleError(_0x271e90,null));};exports[_0x2d9c('0x4b')]=function(_0xc25431,_0xf097a2,_0x414a9d){var _0x4d42dd={};var _0x14434d={};var _0x3ab8e2;var _0x3fee87;return db[_0x2d9c('0x29')][_0x2d9c('0x4c')]({'where':{'id':_0xc25431[_0x2d9c('0x42')]['id']}})[_0x2d9c('0x23')](handleEntityNotFound(_0xf097a2,null))[_0x2d9c('0x23')](function(_0x4ad90b){if(_0x4ad90b){_0x3ab8e2=_0x4ad90b;_0x14434d[_0x2d9c('0x2d')]=_[_0x2d9c('0x4d')](db[_0x2d9c('0x4e')][_0x2d9c('0x43')]);_0x14434d['query']=_['keys'](_0xc25431[_0x2d9c('0x2e')]);_0x14434d[_0x2d9c('0x2f')]=_[_0x2d9c('0x30')](_0x14434d[_0x2d9c('0x2d')],_0x14434d[_0x2d9c('0x2e')]);_0x4d42dd[_0x2d9c('0x31')]=_['intersection'](_0x14434d[_0x2d9c('0x2d')],qs[_0x2d9c('0x32')](_0xc25431[_0x2d9c('0x2e')][_0x2d9c('0x32')]));_0x4d42dd['attributes']=_0x4d42dd[_0x2d9c('0x31')][_0x2d9c('0x33')]?_0x4d42dd[_0x2d9c('0x31')]:_0x14434d[_0x2d9c('0x2d')];_0x4d42dd[_0x2d9c('0x36')]=qs[_0x2d9c('0x37')](_0xc25431['query']['sort']);_0x4d42dd['where']=qs[_0x2d9c('0x2f')](_[_0x2d9c('0x38')](_0xc25431[_0x2d9c('0x2e')],_0x14434d[_0x2d9c('0x2f')]));if(_0xc25431[_0x2d9c('0x2e')][_0x2d9c('0x3b')]){_0x4d42dd['where']=_['merge'](_0x4d42dd[_0x2d9c('0x39')],{'$or':_['map'](_0x4d42dd[_0x2d9c('0x31')],function(_0x2f94bc){var _0x3cc86b={};_0x3cc86b[_0x2f94bc]={'$like':'%'+_0xc25431['query'][_0x2d9c('0x3b')]+'%'};return _0x3cc86b;})});}_0x4d42dd=_['merge']({},_0x4d42dd,_0xc25431[_0x2d9c('0x3c')]);return _0x3ab8e2['getConditions'](_0x4d42dd);}})[_0x2d9c('0x23')](function(_0x4fcbe8){if(_0x4fcbe8){_0x3fee87=_0x4fcbe8[_0x2d9c('0x33')];if(!_0xc25431[_0x2d9c('0x2e')][_0x2d9c('0x34')](_0x2d9c('0x35'))){_0x4d42dd[_0x2d9c('0x1b')]=qs['limit'](_0xc25431[_0x2d9c('0x2e')][_0x2d9c('0x1b')]);_0x4d42dd[_0x2d9c('0x1e')]=qs[_0x2d9c('0x1e')](_0xc25431[_0x2d9c('0x2e')]['offset']);}return _0x3ab8e2[_0x2d9c('0x4b')](_0x4d42dd);}})['then'](function(_0x5c4756){if(_0x5c4756){return _0x5c4756?{'count':_0x3fee87,'rows':_0x5c4756}:null;}})['then'](respondWithResult(_0xf097a2,null))['catch'](handleError(_0xf097a2,null));};exports[_0x2d9c('0x4f')]=function(_0x4cecac,_0x1624d8,_0x215706){return db[_0x2d9c('0x50')]['find']({'where':{'id':_0x4cecac['params']['id']}})[_0x2d9c('0x23')](handleEntityNotFound(_0x1624d8,null))['then'](function(_0x57a3af){if(_0x57a3af){return _0x57a3af[_0x2d9c('0x4f')](_0x4cecac['body']['ids'],_[_0x2d9c('0x49')](_0x4cecac[_0x2d9c('0x47')],['ids','id'])||{});}})[_0x2d9c('0x23')](respondWithResult(_0x1624d8,null))[_0x2d9c('0x40')](handleError(_0x1624d8,null));};exports[_0x2d9c('0x51')]=function(_0x45f7f8,_0x121bfd,_0x5f0e31){var _0x577a57={};var _0x13a24e={};var _0x4ad7bd;var _0x3b0855;return db[_0x2d9c('0x29')][_0x2d9c('0x4c')]({'where':{'id':_0x45f7f8['params']['id']}})[_0x2d9c('0x23')](handleEntityNotFound(_0x121bfd,null))['then'](function(_0x567184){if(_0x567184){_0x4ad7bd=_0x567184;_0x13a24e[_0x2d9c('0x2d')]=_[_0x2d9c('0x4d')](db['Action'][_0x2d9c('0x43')]);_0x13a24e['query']=_[_0x2d9c('0x4d')](_0x45f7f8['query']);_0x13a24e[_0x2d9c('0x2f')]=_[_0x2d9c('0x30')](_0x13a24e[_0x2d9c('0x2d')],_0x13a24e[_0x2d9c('0x2e')]);_0x577a57[_0x2d9c('0x31')]=_[_0x2d9c('0x30')](_0x13a24e['model'],qs[_0x2d9c('0x32')](_0x45f7f8[_0x2d9c('0x2e')][_0x2d9c('0x32')]));_0x577a57['attributes']=_0x577a57['attributes'][_0x2d9c('0x33')]?_0x577a57['attributes']:_0x13a24e[_0x2d9c('0x2d')];_0x577a57[_0x2d9c('0x36')]=qs[_0x2d9c('0x37')](_0x45f7f8[_0x2d9c('0x2e')]['sort']);_0x577a57[_0x2d9c('0x39')]=qs[_0x2d9c('0x2f')](_[_0x2d9c('0x38')](_0x45f7f8[_0x2d9c('0x2e')],_0x13a24e[_0x2d9c('0x2f')]));if(_0x45f7f8[_0x2d9c('0x2e')][_0x2d9c('0x3b')]){_0x577a57[_0x2d9c('0x39')]=_[_0x2d9c('0x3a')](_0x577a57['where'],{'$or':_[_0x2d9c('0x28')](_0x577a57['attributes'],function(_0x3443ae){var _0x583b8f={};_0x583b8f[_0x3443ae]={'$like':'%'+_0x45f7f8['query'][_0x2d9c('0x3b')]+'%'};return _0x583b8f;})});}_0x577a57=_[_0x2d9c('0x3a')]({},_0x577a57,_0x45f7f8[_0x2d9c('0x3c')]);return _0x4ad7bd[_0x2d9c('0x51')](_0x577a57);}})[_0x2d9c('0x23')](function(_0x1ce6d0){if(_0x1ce6d0){_0x3b0855=_0x1ce6d0['length'];if(!_0x45f7f8[_0x2d9c('0x2e')][_0x2d9c('0x34')](_0x2d9c('0x35'))){_0x577a57[_0x2d9c('0x1b')]=qs[_0x2d9c('0x1b')](_0x45f7f8['query'][_0x2d9c('0x1b')]);_0x577a57[_0x2d9c('0x1e')]=qs[_0x2d9c('0x1e')](_0x45f7f8[_0x2d9c('0x2e')][_0x2d9c('0x1e')]);}return _0x4ad7bd['getActions'](_0x577a57);}})[_0x2d9c('0x23')](function(_0x29e545){if(_0x29e545){return _0x29e545?{'count':_0x3b0855,'rows':_0x29e545}:null;}})['then'](respondWithResult(_0x121bfd,null))[_0x2d9c('0x40')](handleError(_0x121bfd,null));}; \ No newline at end of file +var _0x7b36=['order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','show','params','find','create','body','addConditions','Condition','ids','omit','getConditions','findOne','addActions','getActions','Action','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','fs-extra','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','save','update','destroy','then','error','stack','send','index','map','Automation','rawAttributes','fieldName','type','name','keys','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit'];(function(_0x1d66d4,_0x4a4a3c){var _0x1fde89=function(_0x13f737){while(--_0x13f737){_0x1d66d4['push'](_0x1d66d4['shift']());}};_0x1fde89(++_0x4a4a3c);}(_0x7b36,0x6f));var _0x67b3=function(_0x3cd5c4,_0x14421b){_0x3cd5c4=_0x3cd5c4-0x0;var _0x47433a=_0x7b36[_0x3cd5c4];return _0x47433a;};'use strict';var emlformat=require(_0x67b3('0x0'));var rimraf=require(_0x67b3('0x1'));var zipdir=require(_0x67b3('0x2'));var jsonpatch=require(_0x67b3('0x3'));var rp=require('request-promise');var moment=require(_0x67b3('0x4'));var BPromise=require(_0x67b3('0x5'));var Mustache=require(_0x67b3('0x6'));var util=require('util');var path=require(_0x67b3('0x7'));var sox=require('sox');var csv=require(_0x67b3('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x67b3('0x9'));var _=require(_0x67b3('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x67b3('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x67b3('0x8'));var querystring=require(_0x67b3('0xc'));var Papa=require(_0x67b3('0xd'));var Redis=require(_0x67b3('0xe'));var authService=require(_0x67b3('0xf'));var qs=require(_0x67b3('0x10'));var as=require(_0x67b3('0x11'));var hardwareService=require(_0x67b3('0x12'));var logger=require(_0x67b3('0x13'))(_0x67b3('0x14'));var utils=require(_0x67b3('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x67b3('0x16'));var db=require(_0x67b3('0x17'))['db'];function respondWithStatusCode(_0x26c07a,_0x36890f){_0x36890f=_0x36890f||0xcc;return function(_0x3edfa2){if(_0x3edfa2){return _0x26c07a[_0x67b3('0x18')](_0x36890f);}return _0x26c07a[_0x67b3('0x19')](_0x36890f)[_0x67b3('0x1a')]();};}function respondWithResult(_0x37e54d,_0x5dc548){_0x5dc548=_0x5dc548||0xc8;return function(_0x59b752){if(_0x59b752){return _0x37e54d[_0x67b3('0x19')](_0x5dc548)[_0x67b3('0x1b')](_0x59b752);}};}function respondWithFilteredResult(_0x728a0a,_0x42f79c){return function(_0x1d1364){if(_0x1d1364){var _0x1f4fa6=typeof _0x42f79c[_0x67b3('0x1c')]===_0x67b3('0x1d')&&typeof _0x42f79c[_0x67b3('0x1e')]===_0x67b3('0x1d');var _0x838484=_0x1d1364['count'];var _0x35b1e1=_0x1f4fa6?0x0:_0x42f79c[_0x67b3('0x1c')];var _0x4849b1=_0x1f4fa6?_0x1d1364[_0x67b3('0x1f')]:_0x42f79c['offset']+_0x42f79c[_0x67b3('0x1e')];var _0x1e4411;if(_0x4849b1>=_0x838484){_0x4849b1=_0x838484;_0x1e4411=0xc8;}else{_0x1e4411=0xce;}_0x728a0a['status'](_0x1e4411);return _0x728a0a[_0x67b3('0x20')]('Content-Range',_0x35b1e1+'-'+_0x4849b1+'/'+_0x838484)['json'](_0x1d1364);}return null;};}function patchUpdates(_0x57a485){return function(_0x594dfe){try{jsonpatch['apply'](_0x594dfe,_0x57a485,!![]);}catch(_0x5dc05c){return BPromise[_0x67b3('0x21')](_0x5dc05c);}return _0x594dfe[_0x67b3('0x22')]();};}function saveUpdates(_0x261ead,_0xd4dc40){return function(_0x1a3965){if(_0x1a3965){return _0x1a3965[_0x67b3('0x23')](_0x261ead)['then'](function(_0x193ab9){return _0x193ab9;});}return null;};}function removeEntity(_0x3dca39,_0x1898c8){return function(_0x29265b){if(_0x29265b){return _0x29265b[_0x67b3('0x24')]()[_0x67b3('0x25')](function(){_0x3dca39[_0x67b3('0x19')](0xcc)[_0x67b3('0x1a')]();});}};}function handleEntityNotFound(_0xd7c5a1,_0x54eba3){return function(_0xd5a020){if(!_0xd5a020){_0xd7c5a1[_0x67b3('0x18')](0x194);}return _0xd5a020;};}function handleError(_0x242105,_0x3d6648){_0x3d6648=_0x3d6648||0x1f4;return function(_0x5b5ff0){logger[_0x67b3('0x26')](_0x5b5ff0[_0x67b3('0x27')]);if(_0x5b5ff0['name']){delete _0x5b5ff0['name'];}_0x242105[_0x67b3('0x19')](_0x3d6648)[_0x67b3('0x28')](_0x5b5ff0);};}exports[_0x67b3('0x29')]=function(_0x1e64d9,_0xdb8e2d){var _0x2b0b44={},_0x4a347b={},_0x8e626e={'count':0x0,'rows':[]};var _0x362ab7=_[_0x67b3('0x2a')](db[_0x67b3('0x2b')][_0x67b3('0x2c')],function(_0x522cc9){return{'name':_0x522cc9[_0x67b3('0x2d')],'type':_0x522cc9[_0x67b3('0x2e')]['key']};});_0x4a347b['model']=_[_0x67b3('0x2a')](_0x362ab7,_0x67b3('0x2f'));_0x4a347b['query']=_[_0x67b3('0x30')](_0x1e64d9[_0x67b3('0x31')]);_0x4a347b['filters']=_[_0x67b3('0x32')](_0x4a347b[_0x67b3('0x33')],_0x4a347b[_0x67b3('0x31')]);_0x2b0b44[_0x67b3('0x34')]=_[_0x67b3('0x32')](_0x4a347b[_0x67b3('0x33')],qs['fields'](_0x1e64d9[_0x67b3('0x31')][_0x67b3('0x35')]));_0x2b0b44['attributes']=_0x2b0b44[_0x67b3('0x34')][_0x67b3('0x36')]?_0x2b0b44['attributes']:_0x4a347b['model'];if(!_0x1e64d9[_0x67b3('0x31')][_0x67b3('0x37')](_0x67b3('0x38'))){_0x2b0b44[_0x67b3('0x1e')]=qs[_0x67b3('0x1e')](_0x1e64d9[_0x67b3('0x31')][_0x67b3('0x1e')]);_0x2b0b44['offset']=qs['offset'](_0x1e64d9[_0x67b3('0x31')][_0x67b3('0x1c')]);}_0x2b0b44[_0x67b3('0x39')]=qs['sort'](_0x1e64d9[_0x67b3('0x31')][_0x67b3('0x3a')]);_0x2b0b44[_0x67b3('0x3b')]=qs[_0x67b3('0x3c')](_[_0x67b3('0x3d')](_0x1e64d9['query'],_0x4a347b[_0x67b3('0x3c')]),_0x362ab7);if(_0x1e64d9[_0x67b3('0x31')][_0x67b3('0x3e')]){_0x2b0b44['where']=_[_0x67b3('0x3f')](_0x2b0b44['where'],{'$or':_[_0x67b3('0x2a')](_0x362ab7,function(_0x569c3f){if(_0x569c3f[_0x67b3('0x2e')]!==_0x67b3('0x40')){var _0x4ca89a={};_0x4ca89a[_0x569c3f[_0x67b3('0x2f')]]={'$like':'%'+_0x1e64d9['query']['filter']+'%'};return _0x4ca89a;}})});}_0x2b0b44=_[_0x67b3('0x3f')]({},_0x2b0b44,_0x1e64d9[_0x67b3('0x41')]);var _0x3d89d1={'where':_0x2b0b44['where']};return db[_0x67b3('0x2b')][_0x67b3('0x1f')](_0x3d89d1)[_0x67b3('0x25')](function(_0x14bbf2){_0x8e626e[_0x67b3('0x1f')]=_0x14bbf2;if(_0x1e64d9[_0x67b3('0x31')][_0x67b3('0x42')]){_0x2b0b44[_0x67b3('0x43')]=[{'all':!![]}];}return db[_0x67b3('0x2b')][_0x67b3('0x44')](_0x2b0b44);})[_0x67b3('0x25')](function(_0x2c0ab0){_0x8e626e['rows']=_0x2c0ab0;return _0x8e626e;})[_0x67b3('0x25')](respondWithFilteredResult(_0xdb8e2d,_0x2b0b44))[_0x67b3('0x45')](handleError(_0xdb8e2d,null));};exports[_0x67b3('0x46')]=function(_0x549dc8,_0xc61b9d){var _0x5c103c={'raw':![],'where':{'id':_0x549dc8[_0x67b3('0x47')]['id']}},_0x2534eb={};_0x2534eb[_0x67b3('0x33')]=_[_0x67b3('0x30')](db[_0x67b3('0x2b')][_0x67b3('0x2c')]);_0x2534eb['query']=_['keys'](_0x549dc8[_0x67b3('0x31')]);_0x2534eb['filters']=_['intersection'](_0x2534eb[_0x67b3('0x33')],_0x2534eb['query']);_0x5c103c[_0x67b3('0x34')]=_[_0x67b3('0x32')](_0x2534eb[_0x67b3('0x33')],qs[_0x67b3('0x35')](_0x549dc8[_0x67b3('0x31')]['fields']));_0x5c103c['attributes']=_0x5c103c[_0x67b3('0x34')][_0x67b3('0x36')]?_0x5c103c[_0x67b3('0x34')]:_0x2534eb[_0x67b3('0x33')];if(_0x549dc8[_0x67b3('0x31')]['includeAll']){_0x5c103c[_0x67b3('0x43')]=[{'all':!![]}];}_0x5c103c=_[_0x67b3('0x3f')]({},_0x5c103c,_0x549dc8[_0x67b3('0x41')]);return db[_0x67b3('0x2b')][_0x67b3('0x48')](_0x5c103c)[_0x67b3('0x25')](handleEntityNotFound(_0xc61b9d,null))[_0x67b3('0x25')](respondWithResult(_0xc61b9d,null))[_0x67b3('0x45')](handleError(_0xc61b9d,null));};exports['create']=function(_0x32c202,_0x42dc1f){return db[_0x67b3('0x2b')][_0x67b3('0x49')](_0x32c202[_0x67b3('0x4a')],{})[_0x67b3('0x25')](respondWithResult(_0x42dc1f,0xc9))[_0x67b3('0x45')](handleError(_0x42dc1f,null));};exports[_0x67b3('0x23')]=function(_0x2a7ec3,_0xfdc0e4){if(_0x2a7ec3[_0x67b3('0x4a')]['id']){delete _0x2a7ec3[_0x67b3('0x4a')]['id'];}return db[_0x67b3('0x2b')]['find']({'where':{'id':_0x2a7ec3[_0x67b3('0x47')]['id']}})[_0x67b3('0x25')](handleEntityNotFound(_0xfdc0e4,null))[_0x67b3('0x25')](saveUpdates(_0x2a7ec3['body'],null))[_0x67b3('0x25')](respondWithResult(_0xfdc0e4,null))[_0x67b3('0x45')](handleError(_0xfdc0e4,null));};exports[_0x67b3('0x24')]=function(_0x38a8ae,_0x64c6f9){return db[_0x67b3('0x2b')][_0x67b3('0x48')]({'where':{'id':_0x38a8ae[_0x67b3('0x47')]['id']}})[_0x67b3('0x25')](handleEntityNotFound(_0x64c6f9,null))[_0x67b3('0x25')](removeEntity(_0x64c6f9,null))[_0x67b3('0x45')](handleError(_0x64c6f9,null));};exports[_0x67b3('0x4b')]=function(_0x2a1d64,_0x212b45,_0x4ccbcf){return db[_0x67b3('0x4c')]['find']({'where':{'id':_0x2a1d64['params']['id']}})[_0x67b3('0x25')](handleEntityNotFound(_0x212b45,null))['then'](function(_0x3e754f){if(_0x3e754f){return _0x3e754f['addConditions'](_0x2a1d64[_0x67b3('0x4a')][_0x67b3('0x4d')],_[_0x67b3('0x4e')](_0x2a1d64[_0x67b3('0x4a')],[_0x67b3('0x4d'),'id'])||{});}})[_0x67b3('0x25')](respondWithResult(_0x212b45,null))[_0x67b3('0x45')](handleError(_0x212b45,null));};exports[_0x67b3('0x4f')]=function(_0x176c59,_0x33ebfd,_0x53f89d){var _0x5156fd={};var _0x5375dc={};var _0x5625e2;var _0x5dcb20;return db['Automation'][_0x67b3('0x50')]({'where':{'id':_0x176c59[_0x67b3('0x47')]['id']}})[_0x67b3('0x25')](handleEntityNotFound(_0x33ebfd,null))['then'](function(_0x518a54){if(_0x518a54){_0x5625e2=_0x518a54;_0x5375dc[_0x67b3('0x33')]=_[_0x67b3('0x30')](db['Condition'][_0x67b3('0x2c')]);_0x5375dc[_0x67b3('0x31')]=_[_0x67b3('0x30')](_0x176c59[_0x67b3('0x31')]);_0x5375dc[_0x67b3('0x3c')]=_['intersection'](_0x5375dc[_0x67b3('0x33')],_0x5375dc[_0x67b3('0x31')]);_0x5156fd[_0x67b3('0x34')]=_[_0x67b3('0x32')](_0x5375dc[_0x67b3('0x33')],qs[_0x67b3('0x35')](_0x176c59[_0x67b3('0x31')][_0x67b3('0x35')]));_0x5156fd[_0x67b3('0x34')]=_0x5156fd[_0x67b3('0x34')][_0x67b3('0x36')]?_0x5156fd['attributes']:_0x5375dc[_0x67b3('0x33')];_0x5156fd['order']=qs[_0x67b3('0x3a')](_0x176c59['query'][_0x67b3('0x3a')]);_0x5156fd[_0x67b3('0x3b')]=qs[_0x67b3('0x3c')](_[_0x67b3('0x3d')](_0x176c59['query'],_0x5375dc[_0x67b3('0x3c')]));if(_0x176c59[_0x67b3('0x31')]['filter']){_0x5156fd['where']=_['merge'](_0x5156fd[_0x67b3('0x3b')],{'$or':_['map'](_0x5156fd['attributes'],function(_0x36ecf5){var _0x53d3e9={};_0x53d3e9[_0x36ecf5]={'$like':'%'+_0x176c59[_0x67b3('0x31')]['filter']+'%'};return _0x53d3e9;})});}_0x5156fd=_[_0x67b3('0x3f')]({},_0x5156fd,_0x176c59[_0x67b3('0x41')]);return _0x5625e2[_0x67b3('0x4f')](_0x5156fd);}})[_0x67b3('0x25')](function(_0x80ab0e){if(_0x80ab0e){_0x5dcb20=_0x80ab0e[_0x67b3('0x36')];if(!_0x176c59[_0x67b3('0x31')]['hasOwnProperty']('nolimit')){_0x5156fd[_0x67b3('0x1e')]=qs['limit'](_0x176c59[_0x67b3('0x31')][_0x67b3('0x1e')]);_0x5156fd[_0x67b3('0x1c')]=qs[_0x67b3('0x1c')](_0x176c59[_0x67b3('0x31')][_0x67b3('0x1c')]);}return _0x5625e2[_0x67b3('0x4f')](_0x5156fd);}})[_0x67b3('0x25')](function(_0x5459d2){if(_0x5459d2){return _0x5459d2?{'count':_0x5dcb20,'rows':_0x5459d2}:null;}})[_0x67b3('0x25')](respondWithResult(_0x33ebfd,null))['catch'](handleError(_0x33ebfd,null));};exports[_0x67b3('0x51')]=function(_0x2c0dbf,_0x71d2a6,_0x16d805){return db['Action'][_0x67b3('0x48')]({'where':{'id':_0x2c0dbf[_0x67b3('0x47')]['id']}})[_0x67b3('0x25')](handleEntityNotFound(_0x71d2a6,null))[_0x67b3('0x25')](function(_0x487810){if(_0x487810){return _0x487810['addActions'](_0x2c0dbf[_0x67b3('0x4a')][_0x67b3('0x4d')],_[_0x67b3('0x4e')](_0x2c0dbf[_0x67b3('0x4a')],[_0x67b3('0x4d'),'id'])||{});}})[_0x67b3('0x25')](respondWithResult(_0x71d2a6,null))[_0x67b3('0x45')](handleError(_0x71d2a6,null));};exports[_0x67b3('0x52')]=function(_0x2e8d8f,_0x357109,_0x594a6d){var _0x17f2f6={};var _0x284bc4={};var _0x2e1287;var _0x151a7e;return db[_0x67b3('0x2b')][_0x67b3('0x50')]({'where':{'id':_0x2e8d8f[_0x67b3('0x47')]['id']}})['then'](handleEntityNotFound(_0x357109,null))['then'](function(_0x10978c){if(_0x10978c){_0x2e1287=_0x10978c;_0x284bc4['model']=_[_0x67b3('0x30')](db[_0x67b3('0x53')][_0x67b3('0x2c')]);_0x284bc4[_0x67b3('0x31')]=_[_0x67b3('0x30')](_0x2e8d8f[_0x67b3('0x31')]);_0x284bc4[_0x67b3('0x3c')]=_[_0x67b3('0x32')](_0x284bc4[_0x67b3('0x33')],_0x284bc4[_0x67b3('0x31')]);_0x17f2f6[_0x67b3('0x34')]=_['intersection'](_0x284bc4[_0x67b3('0x33')],qs['fields'](_0x2e8d8f[_0x67b3('0x31')]['fields']));_0x17f2f6['attributes']=_0x17f2f6[_0x67b3('0x34')]['length']?_0x17f2f6['attributes']:_0x284bc4[_0x67b3('0x33')];_0x17f2f6[_0x67b3('0x39')]=qs[_0x67b3('0x3a')](_0x2e8d8f[_0x67b3('0x31')][_0x67b3('0x3a')]);_0x17f2f6[_0x67b3('0x3b')]=qs[_0x67b3('0x3c')](_[_0x67b3('0x3d')](_0x2e8d8f[_0x67b3('0x31')],_0x284bc4['filters']));if(_0x2e8d8f[_0x67b3('0x31')][_0x67b3('0x3e')]){_0x17f2f6['where']=_['merge'](_0x17f2f6[_0x67b3('0x3b')],{'$or':_[_0x67b3('0x2a')](_0x17f2f6[_0x67b3('0x34')],function(_0x41203c){var _0x47966a={};_0x47966a[_0x41203c]={'$like':'%'+_0x2e8d8f[_0x67b3('0x31')][_0x67b3('0x3e')]+'%'};return _0x47966a;})});}_0x17f2f6=_['merge']({},_0x17f2f6,_0x2e8d8f[_0x67b3('0x41')]);return _0x2e1287[_0x67b3('0x52')](_0x17f2f6);}})['then'](function(_0x4a1cf4){if(_0x4a1cf4){_0x151a7e=_0x4a1cf4[_0x67b3('0x36')];if(!_0x2e8d8f['query']['hasOwnProperty'](_0x67b3('0x38'))){_0x17f2f6[_0x67b3('0x1e')]=qs[_0x67b3('0x1e')](_0x2e8d8f[_0x67b3('0x31')][_0x67b3('0x1e')]);_0x17f2f6[_0x67b3('0x1c')]=qs[_0x67b3('0x1c')](_0x2e8d8f[_0x67b3('0x31')][_0x67b3('0x1c')]);}return _0x2e1287['getActions'](_0x17f2f6);}})[_0x67b3('0x25')](function(_0x885f35){if(_0x885f35){return _0x885f35?{'count':_0x151a7e,'rows':_0x885f35}:null;}})[_0x67b3('0x25')](respondWithResult(_0x357109,null))[_0x67b3('0x45')](handleError(_0x357109,null));}; \ No newline at end of file diff --git a/server/api/automation/automation.model.js b/server/api/automation/automation.model.js index 09cbc51..dff20c1 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 _0x3d64=['moment','request-promise','path','rimraf','../../config/environment','./automation.attributes','exports','Automation','tools_automations','lodash','util','api'];(function(_0x32a06a,_0x3ab4ac){var _0x30a560=function(_0x7eb26e){while(--_0x7eb26e){_0x32a06a['push'](_0x32a06a['shift']());}};_0x30a560(++_0x3ab4ac);}(_0x3d64,0x141));var _0x43d6=function(_0x52a678,_0x481ebc){_0x52a678=_0x52a678-0x0;var _0x1f5f7e=_0x3d64[_0x52a678];return _0x1f5f7e;};'use strict';var _=require(_0x43d6('0x0'));var util=require(_0x43d6('0x1'));var logger=require('../../config/logger')(_0x43d6('0x2'));var moment=require(_0x43d6('0x3'));var BPromise=require('bluebird');var rp=require(_0x43d6('0x4'));var fs=require('fs');var path=require(_0x43d6('0x5'));var rimraf=require(_0x43d6('0x6'));var config=require(_0x43d6('0x7'));var attributes=require(_0x43d6('0x8'));module[_0x43d6('0x9')]=function(_0x371e67,_0xd9a72e){return _0x371e67['define'](_0x43d6('0xa'),attributes,{'tableName':_0x43d6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xe612=['Automation','tools_automations','lodash','util','moment','request-promise','path','rimraf','../../config/environment','exports','define'];(function(_0x478bad,_0x350f03){var _0x2e8c4a=function(_0x2b054f){while(--_0x2b054f){_0x478bad['push'](_0x478bad['shift']());}};_0x2e8c4a(++_0x350f03);}(_0xe612,0x199));var _0x2e61=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xe612[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x2e61('0x0'));var util=require(_0x2e61('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x2e61('0x2'));var BPromise=require('bluebird');var rp=require(_0x2e61('0x3'));var fs=require('fs');var path=require(_0x2e61('0x4'));var rimraf=require(_0x2e61('0x5'));var config=require(_0x2e61('0x6'));var attributes=require('./automation.attributes');module[_0x2e61('0x7')]=function(_0x7c4986,_0x346d31){return _0x7c4986[_0x2e61('0x8')](_0x2e61('0x9'),attributes,{'tableName':_0x2e61('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/automation/automation.rpc.js b/server/api/automation/automation.rpc.js index 96864c9..d8478f9 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 _0x3c32=['request\x20sent','debug','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Automation,\x20%s,\x20%s'];(function(_0x17651e,_0x1c2e74){var _0x48b243=function(_0x16924c){while(--_0x16924c){_0x17651e['push'](_0x17651e['shift']());}};_0x48b243(++_0x1c2e74);}(_0x3c32,0x161));var _0x23c3=function(_0x255b7c,_0x88677e){_0x255b7c=_0x255b7c-0x0;var _0x850556=_0x3c32[_0x255b7c];return _0x850556;};'use strict';var _=require(_0x23c3('0x0'));var util=require(_0x23c3('0x1'));var moment=require(_0x23c3('0x2'));var BPromise=require('bluebird');var rs=require(_0x23c3('0x3'));var fs=require('fs');var Redis=require(_0x23c3('0x4'));var db=require(_0x23c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x23c3('0x6'))('rpc');var config=require(_0x23c3('0x7'));var jayson=require(_0x23c3('0x8'));var client=jayson[_0x23c3('0x9')][_0x23c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a6364,_0x56568e,_0x493ca6){return new BPromise(function(_0x4df5ee,_0x422558){return client[_0x23c3('0xb')](_0x4a6364,_0x493ca6)[_0x23c3('0xc')](function(_0x420987){logger[_0x23c3('0xd')](_0x23c3('0xe'),_0x56568e,_0x23c3('0xf'));logger[_0x23c3('0x10')](_0x23c3('0x11'),_0x56568e,_0x23c3('0xf'),JSON[_0x23c3('0x12')](_0x420987));if(_0x420987[_0x23c3('0x13')]){if(_0x420987[_0x23c3('0x13')][_0x23c3('0x14')]===0x1f4){logger[_0x23c3('0x13')](_0x23c3('0xe'),_0x56568e,_0x420987[_0x23c3('0x13')][_0x23c3('0x15')]);return _0x422558(_0x420987[_0x23c3('0x13')][_0x23c3('0x15')]);}logger['error']('Automation,\x20%s,\x20%s',_0x56568e,_0x420987[_0x23c3('0x13')][_0x23c3('0x15')]);return _0x4df5ee(_0x420987[_0x23c3('0x13')][_0x23c3('0x15')]);}else{logger[_0x23c3('0xd')](_0x23c3('0xe'),_0x56568e,_0x23c3('0xf'));_0x4df5ee(_0x420987['result']['message']);}})[_0x23c3('0x16')](function(_0x43534b){logger['error'](_0x23c3('0xe'),_0x56568e,_0x43534b);_0x422558(_0x43534b);});});} \ No newline at end of file +var _0x9d5b=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','Automation,\x20%s,\x20%s','request\x20sent','Automation,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x45cb10,_0x40a5e0){var _0x16c0b2=function(_0x1ca44d){while(--_0x1ca44d){_0x45cb10['push'](_0x45cb10['shift']());}};_0x16c0b2(++_0x40a5e0);}(_0x9d5b,0x14d));var _0xb9d5=function(_0x578a84,_0x100967){_0x578a84=_0x578a84-0x0;var _0x204af0=_0x9d5b[_0x578a84];return _0x204af0;};'use strict';var _=require('lodash');var util=require(_0xb9d5('0x0'));var moment=require(_0xb9d5('0x1'));var BPromise=require(_0xb9d5('0x2'));var rs=require(_0xb9d5('0x3'));var fs=require('fs');var Redis=require(_0xb9d5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xb9d5('0x5'));var logger=require('../../config/logger')(_0xb9d5('0x6'));var config=require(_0xb9d5('0x7'));var jayson=require(_0xb9d5('0x8'));var client=jayson[_0xb9d5('0x9')][_0xb9d5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5144c7,_0x1ddb78,_0x35cf2){return new BPromise(function(_0x4dc4be,_0x2d3f66){return client[_0xb9d5('0xb')](_0x5144c7,_0x35cf2)[_0xb9d5('0xc')](function(_0x94e766){logger['info'](_0xb9d5('0xd'),_0x1ddb78,_0xb9d5('0xe'));logger['debug'](_0xb9d5('0xf'),_0x1ddb78,_0xb9d5('0xe'),JSON[_0xb9d5('0x10')](_0x94e766));if(_0x94e766[_0xb9d5('0x11')]){if(_0x94e766[_0xb9d5('0x11')][_0xb9d5('0x12')]===0x1f4){logger[_0xb9d5('0x11')](_0xb9d5('0xd'),_0x1ddb78,_0x94e766[_0xb9d5('0x11')][_0xb9d5('0x13')]);return _0x2d3f66(_0x94e766[_0xb9d5('0x11')]['message']);}logger[_0xb9d5('0x11')](_0xb9d5('0xd'),_0x1ddb78,_0x94e766['error'][_0xb9d5('0x13')]);return _0x4dc4be(_0x94e766[_0xb9d5('0x11')][_0xb9d5('0x13')]);}else{logger['info'](_0xb9d5('0xd'),_0x1ddb78,_0xb9d5('0xe'));_0x4dc4be(_0x94e766[_0xb9d5('0x14')][_0xb9d5('0x13')]);}})[_0xb9d5('0x15')](function(_0x321a77){logger[_0xb9d5('0x11')](_0xb9d5('0xd'),_0x1ddb78,_0x321a77);_0x2d3f66(_0x321a77);});});} \ No newline at end of file diff --git a/server/api/automation/index.js b/server/api/automation/index.js index 5601ed1..979f9cb 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 _0x0faf=['../../components/auth/service','../../components/interaction/service','../../config/environment','./automation.controller','isAuthenticated','index','get','/:id','/:id/conditions','/:id/actions','getActions','post','create','addActions','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0faf,0x132));var _0xf0fa=function(_0x50aa2e,_0xfbd6f0){_0x50aa2e=_0x50aa2e-0x0;var _0x5e07f0=_0x0faf[_0x50aa2e];return _0x5e07f0;};'use strict';var multer=require(_0xf0fa('0x0'));var util=require('util');var path=require(_0xf0fa('0x1'));var timeout=require(_0xf0fa('0x2'));var express=require(_0xf0fa('0x3'));var router=express[_0xf0fa('0x4')]();var fs_extra=require(_0xf0fa('0x5'));var auth=require(_0xf0fa('0x6'));var interaction=require(_0xf0fa('0x7'));var config=require(_0xf0fa('0x8'));var controller=require(_0xf0fa('0x9'));router['get']('/',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0xb')]);router[_0xf0fa('0xc')](_0xf0fa('0xd'),auth[_0xf0fa('0xa')](),controller['show']);router[_0xf0fa('0xc')](_0xf0fa('0xe'),auth['isAuthenticated'](),controller['getConditions']);router[_0xf0fa('0xc')](_0xf0fa('0xf'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x10')]);router[_0xf0fa('0x11')]('/',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x12')]);router[_0xf0fa('0x11')]('/:id/conditions',auth[_0xf0fa('0xa')](),controller['addConditions']);router[_0xf0fa('0x11')]('/:id/actions',auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x13')]);router[_0xf0fa('0x14')]('/:id',auth['isAuthenticated'](),controller[_0xf0fa('0x15')]);router['delete'](_0xf0fa('0xd'),auth[_0xf0fa('0xa')](),controller[_0xf0fa('0x16')]);module[_0xf0fa('0x17')]=router; \ No newline at end of file +var _0xb4a3=['express','Router','../../components/auth/service','../../components/interaction/service','./automation.controller','isAuthenticated','index','get','show','getConditions','/:id/actions','getActions','create','post','/:id/conditions','addConditions','addActions','put','/:id','update','delete','exports','multer','util','connect-timeout'];(function(_0x199bc4,_0x338105){var _0x136ffb=function(_0x3e7ced){while(--_0x3e7ced){_0x199bc4['push'](_0x199bc4['shift']());}};_0x136ffb(++_0x338105);}(_0xb4a3,0x174));var _0x3b4a=function(_0x31df6f,_0x380e73){_0x31df6f=_0x31df6f-0x0;var _0x31e353=_0xb4a3[_0x31df6f];return _0x31e353;};'use strict';var multer=require(_0x3b4a('0x0'));var util=require(_0x3b4a('0x1'));var path=require('path');var timeout=require(_0x3b4a('0x2'));var express=require(_0x3b4a('0x3'));var router=express[_0x3b4a('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3b4a('0x5'));var interaction=require(_0x3b4a('0x6'));var config=require('../../config/environment');var controller=require(_0x3b4a('0x7'));router['get']('/',auth[_0x3b4a('0x8')](),controller[_0x3b4a('0x9')]);router[_0x3b4a('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x3b4a('0xb')]);router[_0x3b4a('0xa')]('/:id/conditions',auth['isAuthenticated'](),controller[_0x3b4a('0xc')]);router[_0x3b4a('0xa')](_0x3b4a('0xd'),auth[_0x3b4a('0x8')](),controller[_0x3b4a('0xe')]);router['post']('/',auth[_0x3b4a('0x8')](),controller[_0x3b4a('0xf')]);router[_0x3b4a('0x10')](_0x3b4a('0x11'),auth['isAuthenticated'](),controller[_0x3b4a('0x12')]);router[_0x3b4a('0x10')]('/:id/actions',auth[_0x3b4a('0x8')](),controller[_0x3b4a('0x13')]);router[_0x3b4a('0x14')](_0x3b4a('0x15'),auth[_0x3b4a('0x8')](),controller[_0x3b4a('0x16')]);router[_0x3b4a('0x17')]('/:id',auth[_0x3b4a('0x8')](),controller['destroy']);module[_0x3b4a('0x18')]=router; \ No newline at end of file diff --git a/server/api/campaign/campaign.attributes.js b/server/api/campaign/campaign.attributes.js index 5c227b3..5e3f104 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 _0x812c=['#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','DESC','ASC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','exports','STRING','name','ENUM','BOOLEAN','Active/Disactive\x20Campaign','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)','07:00-22:00,*,*,*','always','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time'];(function(_0x480843,_0x8121e6){var _0x1d5cd9=function(_0x54ca2a){while(--_0x54ca2a){_0x480843['push'](_0x480843['shift']());}};_0x1d5cd9(++_0x8121e6);}(_0x812c,0xae));var _0xc812=function(_0x3b6c46,_0x1a9710){_0x3b6c46=_0x3b6c46-0x0;var _0x4178a4=_0x812c[_0x3b6c46];return _0x4178a4;};'use strict';var Sequelize=require('sequelize');module[_0xc812('0x0')]={'name':{'type':Sequelize[_0xc812('0x1')],'unique':_0xc812('0x2'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize[_0xc812('0x3')]('ivr'),'allowNull':![],'defaultValue':'ivr'},'description':{'type':Sequelize['STRING']},'active':{'type':Sequelize[_0xc812('0x4')],'defaultValue':0x0,'comment':_0xc812('0x5')},'limitCalls':{'type':Sequelize[_0xc812('0x6')](0x4)[_0xc812('0x7')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xc812('0x8')},'dialOriginateCallerIdName':{'type':Sequelize[_0xc812('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xc812('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0xc812('0x6')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc812('0x9')},'dialCongestionMaxRetry':{'type':Sequelize[_0xc812('0x6')](0x3)[_0xc812('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc812('0xa')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xc812('0x6')](0x5)[_0xc812('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc812('0xb')},'dialBusyMaxRetry':{'type':Sequelize[_0xc812('0x6')](0x3)[_0xc812('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc812('0xc')},'dialBusyRetryFrequency':{'type':Sequelize[_0xc812('0x6')](0x5)[_0xc812('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc812('0xd')},'dialNoAnswerMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc812('0x7')],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xc812('0x6')](0x5)[_0xc812('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc812('0xe')},'dialGlobalMaxRetry':{'type':Sequelize[_0xc812('0x6')](0x3)[_0xc812('0x7')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xc812('0x1')],'defaultValue':_0xc812('0xf')},'dialCheckDuplicateType':{'type':Sequelize[_0xc812('0x3')](_0xc812('0x10'),'never','onlyIfOpen'),'defaultValue':_0xc812('0x10')},'dialAMDActive':{'type':Sequelize[_0xc812('0x4')],'defaultValue':0x0,'comment':'Active/Disactive\x20AMD'},'dialAMDInitialSilence':{'type':Sequelize[_0xc812('0x6')](0x9)[_0xc812('0x7')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xc812('0x11')},'dialAMDGreeting':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xc812('0x12')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0xc812('0x6')](0x9)[_0xc812('0x7')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xc812('0x13')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xc812('0x6')](0x9)[_0xc812('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc812('0x14')},'dialAMDMinWordLength':{'type':Sequelize[_0xc812('0x6')](0x9)[_0xc812('0x7')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xc812('0x15')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xc812('0x6')](0x9)[_0xc812('0x7')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xc812('0x16')},'dialAMDMaximumNumberOfWords':{'type':Sequelize['INTEGER'](0x9)[_0xc812('0x7')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0xc812('0x17')},'dialAMDSilenceThreshold':{'type':Sequelize[_0xc812('0x6')](0x5)[_0xc812('0x7')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xc812('0x18')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xc812('0x6')](0x9)[_0xc812('0x7')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xc812('0x19')},'dialOrderByScheduledAt':{'type':Sequelize['ENUM'](_0xc812('0x1a'),_0xc812('0x1b')),'defaultValue':_0xc812('0x1a')},'dialPrefix':{'type':Sequelize[_0xc812('0x1')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc812('0x1c')},'dialCutDigit':{'type':Sequelize['INTEGER'](0x3)['UNSIGNED'],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xc812('0x1d')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0xc812('0x6')](0x3)[_0xc812('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc812('0x1e')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xc812('0x6')](0x5)[_0xc812('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc812('0x1f')},'dialDropMaxRetry':{'type':Sequelize[_0xc812('0x6')](0x3)[_0xc812('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc812('0x20')},'dialDropRetryFrequency':{'type':Sequelize[_0xc812('0x6')](0x5)[_0xc812('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc812('0x21')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xc812('0x6')](0x3)[_0xc812('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc812('0x22')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xc812('0x6')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc812('0x23')},'dialMachineMaxRetry':{'type':Sequelize[_0xc812('0x6')](0x3)[_0xc812('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc812('0x24')},'dialMachineRetryFrequency':{'type':Sequelize[_0xc812('0x6')](0x5)[_0xc812('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xc812('0x7')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xc812('0x25')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xc812('0x6')](0x5)[_0xc812('0x7')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xc812('0x26')}}; \ No newline at end of file +var _0x6f0b=['ENUM','always','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','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\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','STRING','name','ivr','BOOLEAN','Active/Disactive\x20Campaign','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\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*'];(function(_0x16432c,_0x209963){var _0x36aab0=function(_0x3ddfbd){while(--_0x3ddfbd){_0x16432c['push'](_0x16432c['shift']());}};_0x36aab0(++_0x209963);}(_0x6f0b,0xf4));var _0xb6f0=function(_0xc749c8,_0x341fe6){_0xc749c8=_0xc749c8-0x0;var _0x26b29c=_0x6f0b[_0xc749c8];return _0x26b29c;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0xb6f0('0x0')],'unique':_0xb6f0('0x1'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'type':{'type':Sequelize['ENUM'](_0xb6f0('0x2')),'allowNull':![],'defaultValue':_0xb6f0('0x2')},'description':{'type':Sequelize[_0xb6f0('0x0')]},'active':{'type':Sequelize[_0xb6f0('0x3')],'defaultValue':0x0,'comment':_0xb6f0('0x4')},'limitCalls':{'type':Sequelize[_0xb6f0('0x5')](0x4)[_0xb6f0('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0xc8},'comment':_0xb6f0('0x7')},'dialOriginateCallerIdName':{'type':Sequelize[_0xb6f0('0x0')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0xb6f0('0x0')]},'dialOriginateTimeout':{'type':Sequelize[_0xb6f0('0x5')](0x3)[_0xb6f0('0x6')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb6f0('0x8')},'dialCongestionMaxRetry':{'type':Sequelize[_0xb6f0('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb6f0('0x9')},'dialCongestionRetryFrequency':{'type':Sequelize[_0xb6f0('0x5')](0x5)[_0xb6f0('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb6f0('0xa')},'dialBusyMaxRetry':{'type':Sequelize[_0xb6f0('0x5')](0x3)[_0xb6f0('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0xb6f0('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb6f0('0xb')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0xb6f0('0x5')](0x3)[_0xb6f0('0x6')],'defaultValue':0x3,'comment':_0xb6f0('0xc')},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0xb6f0('0x5')](0x5)[_0xb6f0('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb6f0('0xd')},'dialGlobalMaxRetry':{'type':Sequelize[_0xb6f0('0x5')](0x3)[_0xb6f0('0x6')],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0xb6f0('0x0')],'defaultValue':_0xb6f0('0xe')},'dialCheckDuplicateType':{'type':Sequelize[_0xb6f0('0xf')](_0xb6f0('0x10'),'never',_0xb6f0('0x11')),'defaultValue':_0xb6f0('0x10')},'dialAMDActive':{'type':Sequelize[_0xb6f0('0x3')],'defaultValue':0x0,'comment':_0xb6f0('0x12')},'dialAMDInitialSilence':{'type':Sequelize[_0xb6f0('0x5')](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0xb6f0('0x13')},'dialAMDGreeting':{'type':Sequelize[_0xb6f0('0x5')](0x9)[_0xb6f0('0x6')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0xb6f0('0x14')},'dialAMDAfterGreetingSilence':{'type':Sequelize['INTEGER'](0x9)[_0xb6f0('0x6')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0xb6f0('0x15')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0xb6f0('0x5')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb6f0('0x16')},'dialAMDMinWordLength':{'type':Sequelize[_0xb6f0('0x5')](0x9)[_0xb6f0('0x6')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0xb6f0('0x17')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0xb6f0('0x5')](0x9)[_0xb6f0('0x6')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0xb6f0('0x18')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0xb6f0('0x5')](0x9)[_0xb6f0('0x6')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0xb6f0('0x5')](0x5)[_0xb6f0('0x6')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0xb6f0('0x19')},'dialAMDMaximumWordLength':{'type':Sequelize[_0xb6f0('0x5')](0x9)[_0xb6f0('0x6')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0xb6f0('0x1a')},'dialOrderByScheduledAt':{'type':Sequelize[_0xb6f0('0xf')](_0xb6f0('0x1b'),'ASC'),'defaultValue':'DESC'},'dialPrefix':{'type':Sequelize[_0xb6f0('0x0')],'defaultValue':null},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0xb6f0('0x5')](0x3)[_0xb6f0('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0xb6f0('0x1c')},'dialCutDigit':{'type':Sequelize[_0xb6f0('0x5')](0x3)[_0xb6f0('0x6')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':'Cut\x20Digit\x20(min:1,\x20max:15)'},'dialNoSuchNumberMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0xb6f0('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb6f0('0x1d')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0xb6f0('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb6f0('0x1e')},'dialDropMaxRetry':{'type':Sequelize[_0xb6f0('0x5')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb6f0('0x1f')},'dialDropRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb6f0('0x20')},'dialAbandonedMaxRetry':{'type':Sequelize[_0xb6f0('0x5')](0x3)[_0xb6f0('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0xb6f0('0x5')](0x5)[_0xb6f0('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0xb6f0('0x5')](0x3)[_0xb6f0('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb6f0('0x21')},'dialMachineRetryFrequency':{'type':Sequelize[_0xb6f0('0x5')](0x5)[_0xb6f0('0x6')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb6f0('0x22')},'dialAgentRejectMaxRetry':{'type':Sequelize[_0xb6f0('0x5')](0x3)[_0xb6f0('0x6')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0xb6f0('0x23')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0xb6f0('0x5')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0xb6f0('0x24')}}; \ No newline at end of file diff --git a/server/api/campaign/campaign.controller.js b/server/api/campaign/campaign.controller.js index 67dd923..07c3d96 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 _0xae88=['COALESCE(calleridnum,\x27\x27)','cm_hopper_final','CampaignId\x20=\x20?','COALESCE(phone,\x27\x27)','insert','cm_hopper_additional_phones','OrderBy','ci.OrderBY','cm_contact_has_items','join','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','all','removeLists','getBlackLists','addBlackLists','YYYY-MM-DD\x20HH:mm:ss','cm_contacts','removeBlackLists','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','limit','undefined','offset','count','set','Content-Range','then','IvrCampaigns','UserProfileResource','end','error','name','index','map','Campaign','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','options','findAll','rows','catch','show','params','includeAll','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','length','include','omit','updatedAt','createdAt','update','destroy','getHoppers','findOne','nolimit','CmHopper','getHopperHistories','CmHopperHistory','CampaignId','getHopperFinals','CmHopperFinal','CmHopperBlack','getLists','CmList','addLists','format','ids','spread','dialCheckDuplicateType','into','cm_hopper','fromQuery','scheduledAt','ContactId','ListId','select','phone','field','NOW()','CmListId','toString','from','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)'];(function(_0xf89c3,_0x351bf1){var _0x274fc8=function(_0x5e0c91){while(--_0x5e0c91){_0xf89c3['push'](_0xf89c3['shift']());}};_0x274fc8(++_0x351bf1);}(_0xae88,0xa1));var _0x8ae8=function(_0x5e11dc,_0x21406e){_0x5e11dc=_0x5e11dc-0x0;var _0x530af1=_0xae88[_0x5e11dc];return _0x530af1;};'use strict';var emlformat=require(_0x8ae8('0x0'));var rimraf=require(_0x8ae8('0x1'));var zipdir=require(_0x8ae8('0x2'));var jsonpatch=require(_0x8ae8('0x3'));var rp=require(_0x8ae8('0x4'));var moment=require('moment');var BPromise=require(_0x8ae8('0x5'));var Mustache=require('mustache');var util=require(_0x8ae8('0x6'));var path=require('path');var sox=require(_0x8ae8('0x7'));var csv=require('to-csv');var ejs=require(_0x8ae8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ae8('0x9'));var squel=require(_0x8ae8('0xa'));var crypto=require('crypto');var jsforce=require(_0x8ae8('0xb'));var deskjs=require(_0x8ae8('0xc'));var toCsv=require('to-csv');var querystring=require(_0x8ae8('0xd'));var Papa=require(_0x8ae8('0xe'));var Redis=require(_0x8ae8('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x8ae8('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8ae8('0x11'))(_0x8ae8('0x12'));var utils=require(_0x8ae8('0x13'));var config=require(_0x8ae8('0x14'));var licenseUtil=require(_0x8ae8('0x15'));var db=require(_0x8ae8('0x16'))['db'];function respondWithStatusCode(_0x56ca5d,_0x1e0ca9){_0x1e0ca9=_0x1e0ca9||0xcc;return function(_0xca6f82){if(_0xca6f82){return _0x56ca5d[_0x8ae8('0x17')](_0x1e0ca9);}return _0x56ca5d[_0x8ae8('0x18')](_0x1e0ca9)['end']();};}function respondWithResult(_0x2f47ca,_0x13b09a){_0x13b09a=_0x13b09a||0xc8;return function(_0x30b12c){if(_0x30b12c){return _0x2f47ca[_0x8ae8('0x18')](_0x13b09a)[_0x8ae8('0x19')](_0x30b12c);}};}function respondWithFilteredResult(_0x19a1d9,_0x2df77c){return function(_0x1eb2a9){if(_0x1eb2a9){var _0x3c674f=typeof _0x2df77c['offset']==='undefined'&&typeof _0x2df77c[_0x8ae8('0x1a')]===_0x8ae8('0x1b');var _0x3bc66c=_0x1eb2a9['count'];var _0x2620de=_0x3c674f?0x0:_0x2df77c[_0x8ae8('0x1c')];var _0x3909c7=_0x3c674f?_0x1eb2a9[_0x8ae8('0x1d')]:_0x2df77c['offset']+_0x2df77c['limit'];var _0x3c276c;if(_0x3909c7>=_0x3bc66c){_0x3909c7=_0x3bc66c;_0x3c276c=0xc8;}else{_0x3c276c=0xce;}_0x19a1d9['status'](_0x3c276c);return _0x19a1d9[_0x8ae8('0x1e')](_0x8ae8('0x1f'),_0x2620de+'-'+_0x3909c7+'/'+_0x3bc66c)[_0x8ae8('0x19')](_0x1eb2a9);}return null;};}function patchUpdates(_0x76554d){return function(_0x472718){try{jsonpatch['apply'](_0x472718,_0x76554d,!![]);}catch(_0x9ec156){return BPromise['reject'](_0x9ec156);}return _0x472718['save']();};}function saveUpdates(_0x1ee2a8,_0x20756c){return function(_0xd8b0f6){if(_0xd8b0f6){return _0xd8b0f6['update'](_0x1ee2a8)[_0x8ae8('0x20')](function(_0x5a3df6){return _0x5a3df6;});}return null;};}function removeEntity(_0x2136e0,_0x2e46af){return function(_0x205214){if(_0x205214){return _0x205214['destroy']()[_0x8ae8('0x20')](function(){var _0x25ce3a=_0x205214['get']({'plain':!![]});var _0x2c8ce3=_0x8ae8('0x21');return db[_0x8ae8('0x22')]['destroy']({'where':{'type':_0x2c8ce3,'resourceId':_0x25ce3a['id']}})['then'](function(){return _0x205214;});})[_0x8ae8('0x20')](function(){_0x2136e0[_0x8ae8('0x18')](0xcc)[_0x8ae8('0x23')]();});}};}function handleEntityNotFound(_0xbc7b86,_0x465254){return function(_0x1872d5){if(!_0x1872d5){_0xbc7b86[_0x8ae8('0x17')](0x194);}return _0x1872d5;};}function handleError(_0x5567e4,_0x2b014d){_0x2b014d=_0x2b014d||0x1f4;return function(_0x209bbd){logger[_0x8ae8('0x24')](_0x209bbd['stack']);if(_0x209bbd[_0x8ae8('0x25')]){delete _0x209bbd[_0x8ae8('0x25')];}_0x5567e4[_0x8ae8('0x18')](_0x2b014d)['send'](_0x209bbd);};}exports[_0x8ae8('0x26')]=function(_0x578e8c,_0xfb5c29){var _0x47cbfa={},_0x201bef={},_0x349eae={'count':0x0,'rows':[]};var _0x4e99b2=_[_0x8ae8('0x27')](db[_0x8ae8('0x28')][_0x8ae8('0x29')],function(_0x49d1e5){return{'name':_0x49d1e5[_0x8ae8('0x2a')],'type':_0x49d1e5[_0x8ae8('0x2b')][_0x8ae8('0x2c')]};});_0x201bef[_0x8ae8('0x2d')]=_[_0x8ae8('0x27')](_0x4e99b2,_0x8ae8('0x25'));_0x201bef[_0x8ae8('0x2e')]=_[_0x8ae8('0x2f')](_0x578e8c[_0x8ae8('0x2e')]);_0x201bef[_0x8ae8('0x30')]=_[_0x8ae8('0x31')](_0x201bef[_0x8ae8('0x2d')],_0x201bef[_0x8ae8('0x2e')]);_0x47cbfa[_0x8ae8('0x32')]=_[_0x8ae8('0x31')](_0x201bef['model'],qs['fields'](_0x578e8c[_0x8ae8('0x2e')][_0x8ae8('0x33')]));_0x47cbfa['attributes']=_0x47cbfa[_0x8ae8('0x32')]['length']?_0x47cbfa[_0x8ae8('0x32')]:_0x201bef[_0x8ae8('0x2d')];if(!_0x578e8c[_0x8ae8('0x2e')][_0x8ae8('0x34')]('nolimit')){_0x47cbfa['limit']=qs[_0x8ae8('0x1a')](_0x578e8c[_0x8ae8('0x2e')]['limit']);_0x47cbfa[_0x8ae8('0x1c')]=qs[_0x8ae8('0x1c')](_0x578e8c[_0x8ae8('0x2e')][_0x8ae8('0x1c')]);}_0x47cbfa[_0x8ae8('0x35')]=qs[_0x8ae8('0x36')](_0x578e8c[_0x8ae8('0x2e')][_0x8ae8('0x36')]);_0x47cbfa[_0x8ae8('0x37')]=qs[_0x8ae8('0x30')](_[_0x8ae8('0x38')](_0x578e8c[_0x8ae8('0x2e')],_0x201bef['filters']),_0x4e99b2);if(_0x578e8c['query'][_0x8ae8('0x39')]){_0x47cbfa['where']=_[_0x8ae8('0x3a')](_0x47cbfa[_0x8ae8('0x37')],{'$or':_[_0x8ae8('0x27')](_0x4e99b2,function(_0x12af7c){if(_0x12af7c[_0x8ae8('0x2b')]!=='VIRTUAL'){var _0x9692e4={};_0x9692e4[_0x12af7c[_0x8ae8('0x25')]]={'$like':'%'+_0x578e8c[_0x8ae8('0x2e')][_0x8ae8('0x39')]+'%'};return _0x9692e4;}})});}_0x47cbfa=_[_0x8ae8('0x3a')]({},_0x47cbfa,_0x578e8c[_0x8ae8('0x3b')]);var _0x46b57e={'where':_0x47cbfa['where']};return db['Campaign'][_0x8ae8('0x1d')](_0x46b57e)[_0x8ae8('0x20')](function(_0x9eef24){_0x349eae[_0x8ae8('0x1d')]=_0x9eef24;if(_0x578e8c[_0x8ae8('0x2e')]['includeAll']){_0x47cbfa['include']=[{'all':!![]}];}return db[_0x8ae8('0x28')][_0x8ae8('0x3c')](_0x47cbfa);})[_0x8ae8('0x20')](function(_0x4646e2){_0x349eae[_0x8ae8('0x3d')]=_0x4646e2;return _0x349eae;})[_0x8ae8('0x20')](respondWithFilteredResult(_0xfb5c29,_0x47cbfa))[_0x8ae8('0x3e')](handleError(_0xfb5c29,null));};exports[_0x8ae8('0x3f')]=function(_0x4e6c94,_0x264d86){var _0x424dd8={'raw':![],'where':{'id':_0x4e6c94[_0x8ae8('0x40')]['id']}},_0x3a6c6e={};_0x3a6c6e[_0x8ae8('0x2d')]=_[_0x8ae8('0x2f')](db['Campaign'][_0x8ae8('0x29')]);_0x3a6c6e[_0x8ae8('0x2e')]=_[_0x8ae8('0x2f')](_0x4e6c94['query']);_0x3a6c6e[_0x8ae8('0x30')]=_[_0x8ae8('0x31')](_0x3a6c6e[_0x8ae8('0x2d')],_0x3a6c6e[_0x8ae8('0x2e')]);_0x424dd8[_0x8ae8('0x32')]=_[_0x8ae8('0x31')](_0x3a6c6e[_0x8ae8('0x2d')],qs[_0x8ae8('0x33')](_0x4e6c94[_0x8ae8('0x2e')][_0x8ae8('0x33')]));_0x424dd8[_0x8ae8('0x32')]=_0x424dd8[_0x8ae8('0x32')]['length']?_0x424dd8[_0x8ae8('0x32')]:_0x3a6c6e['model'];if(_0x4e6c94['query'][_0x8ae8('0x41')]){_0x424dd8['include']=[{'all':!![]}];}_0x424dd8=_[_0x8ae8('0x3a')]({},_0x424dd8,_0x4e6c94[_0x8ae8('0x3b')]);return db['Campaign']['find'](_0x424dd8)[_0x8ae8('0x20')](handleEntityNotFound(_0x264d86,null))[_0x8ae8('0x20')](respondWithResult(_0x264d86,null))[_0x8ae8('0x3e')](handleError(_0x264d86,null));};exports[_0x8ae8('0x42')]=function(_0x2de81d,_0x12c4bb){return db[_0x8ae8('0x28')]['create'](_0x2de81d[_0x8ae8('0x43')],{})[_0x8ae8('0x20')](function(_0xbea562){var _0xc7ed31=_0x2de81d[_0x8ae8('0x44')][_0x8ae8('0x45')]({'plain':!![]});if(!_0xc7ed31)throw new Error(_0x8ae8('0x46'));if(_0xc7ed31[_0x8ae8('0x47')]===_0x8ae8('0x44')){var _0x32f674=_0xbea562[_0x8ae8('0x45')]({'plain':!![]});var _0x1e3bd3=_0x8ae8('0x21');return db[_0x8ae8('0x48')][_0x8ae8('0x49')]({'where':{'name':_0x1e3bd3,'userProfileId':_0xc7ed31[_0x8ae8('0x4a')]},'raw':!![]})['then'](function(_0x116090){if(_0x116090&&_0x116090[_0x8ae8('0x4b')]===0x0){return db[_0x8ae8('0x22')]['create']({'name':_0x32f674[_0x8ae8('0x25')],'resourceId':_0x32f674['id'],'type':_0x116090[_0x8ae8('0x25')],'sectionId':_0x116090['id']},{})['then'](function(){return _0xbea562;});}else{return _0xbea562;}})[_0x8ae8('0x3e')](function(_0x52de05){logger[_0x8ae8('0x24')](_0x8ae8('0x4c'),_0x52de05);throw _0x52de05;});}return _0xbea562;})[_0x8ae8('0x20')](respondWithResult(_0x12c4bb,0xc9))[_0x8ae8('0x3e')](handleError(_0x12c4bb,null));};exports[_0x8ae8('0x4d')]=function(_0x1d057b,_0x52e8f4){var _0x12d376={'where':{'id':_0x1d057b['params']['id']}},_0x27cb15={};_0x27cb15[_0x8ae8('0x2d')]=_[_0x8ae8('0x2f')](db[_0x8ae8('0x28')][_0x8ae8('0x29')]);_0x12d376['attributes']=_[_0x8ae8('0x31')](_0x27cb15['model'],qs[_0x8ae8('0x33')](_0x1d057b[_0x8ae8('0x2e')][_0x8ae8('0x33')]));_0x12d376[_0x8ae8('0x32')]=_0x12d376[_0x8ae8('0x32')][_0x8ae8('0x4e')]?_0x12d376[_0x8ae8('0x32')]:_0x27cb15[_0x8ae8('0x2d')];if(_0x1d057b[_0x8ae8('0x2e')][_0x8ae8('0x41')]){_0x12d376[_0x8ae8('0x4f')]=[{'all':!![]}];}_0x12d376=_['merge']({},_0x12d376,_0x1d057b[_0x8ae8('0x3b')]);return db['Campaign'][_0x8ae8('0x49')](_0x12d376)[_0x8ae8('0x20')](handleEntityNotFound(_0x52e8f4,null))[_0x8ae8('0x20')](function(_0x3d4987){if(_0x3d4987){var _0x4a2207=_0x3d4987['get']({'plain':!![]});_0x4a2207=qs[_0x8ae8('0x50')](_0x4a2207,['id','createdAt',_0x8ae8('0x51')]);_0x1d057b['body']=_[_0x8ae8('0x50')](_0x1d057b['body'],['id',_0x8ae8('0x52'),_0x8ae8('0x51')]);return db[_0x8ae8('0x28')][_0x8ae8('0x42')](_[_0x8ae8('0x3a')](_0x4a2207,_0x1d057b[_0x8ae8('0x43')]),{'include':_0x1d057b['query'][_0x8ae8('0x41')]?[{'all':!![]}]:undefined})[_0x8ae8('0x20')](function(_0x1fc36a){var _0x3f7593=_0x1d057b['user'][_0x8ae8('0x45')]({'plain':!![]});if(!_0x3f7593)throw new Error(_0x8ae8('0x46'));if(_0x3f7593[_0x8ae8('0x47')]==='user'){var _0x3cff74=_0x1fc36a[_0x8ae8('0x45')]({'plain':!![]});var _0x471b1e=_0x8ae8('0x21');return db['UserProfileSection'][_0x8ae8('0x49')]({'where':{'name':_0x471b1e,'userProfileId':_0x3f7593[_0x8ae8('0x4a')]},'raw':!![]})[_0x8ae8('0x20')](function(_0x1f7b8f){if(_0x1f7b8f&&_0x1f7b8f['autoAssociation']===0x0){return db[_0x8ae8('0x22')]['create']({'name':_0x3cff74[_0x8ae8('0x25')],'resourceId':_0x3cff74['id'],'type':_0x1f7b8f[_0x8ae8('0x25')],'sectionId':_0x1f7b8f['id']},{})[_0x8ae8('0x20')](function(){return _0x1fc36a;});}else{return _0x1fc36a;}})['catch'](function(_0x2ad525){logger[_0x8ae8('0x24')](_0x8ae8('0x4c'),_0x2ad525);throw _0x2ad525;});}return _0x1fc36a;});}})[_0x8ae8('0x20')](respondWithResult(_0x52e8f4,0xc9))[_0x8ae8('0x3e')](handleError(_0x52e8f4,null));};exports[_0x8ae8('0x53')]=function(_0xe32f4e,_0x53c5fd){if(_0xe32f4e[_0x8ae8('0x43')]['id']){delete _0xe32f4e['body']['id'];}return db[_0x8ae8('0x28')]['find']({'where':{'id':_0xe32f4e[_0x8ae8('0x40')]['id']}})['then'](handleEntityNotFound(_0x53c5fd,null))[_0x8ae8('0x20')](saveUpdates(_0xe32f4e[_0x8ae8('0x43')],null))[_0x8ae8('0x20')](respondWithResult(_0x53c5fd,null))['catch'](handleError(_0x53c5fd,null));};exports[_0x8ae8('0x54')]=function(_0xd4a348,_0x131ec9){return db['Campaign'][_0x8ae8('0x49')]({'where':{'id':_0xd4a348['params']['id']}})['then'](handleEntityNotFound(_0x131ec9,null))[_0x8ae8('0x20')](removeEntity(_0x131ec9,null))['catch'](handleError(_0x131ec9,null));};exports[_0x8ae8('0x55')]=function(_0x233fd1,_0x218e9d,_0x3ae3ee){var _0x520915={'raw':!![],'where':{}};var _0x2b9ae8={};var _0x58def5={'count':0x0,'rows':[]};return db[_0x8ae8('0x28')][_0x8ae8('0x56')]({'where':{'id':_0x233fd1[_0x8ae8('0x40')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x218e9d,null))[_0x8ae8('0x20')](function(_0x21293c){if(_0x21293c){_0x2b9ae8[_0x8ae8('0x2d')]=_[_0x8ae8('0x2f')](db['CmHopper'][_0x8ae8('0x29')]);_0x2b9ae8[_0x8ae8('0x2e')]=_[_0x8ae8('0x2f')](_0x233fd1['query']);_0x2b9ae8['filters']=_[_0x8ae8('0x31')](_0x2b9ae8[_0x8ae8('0x2d')],_0x2b9ae8[_0x8ae8('0x2e')]);_0x520915[_0x8ae8('0x32')]=_[_0x8ae8('0x31')](_0x2b9ae8[_0x8ae8('0x2d')],qs[_0x8ae8('0x33')](_0x233fd1[_0x8ae8('0x2e')]['fields']));_0x520915['attributes']=_0x520915[_0x8ae8('0x32')][_0x8ae8('0x4e')]?_0x520915[_0x8ae8('0x32')]:_0x2b9ae8[_0x8ae8('0x2d')];if(!_0x233fd1['query'][_0x8ae8('0x34')](_0x8ae8('0x57'))){_0x520915[_0x8ae8('0x1a')]=qs[_0x8ae8('0x1a')](_0x233fd1[_0x8ae8('0x2e')]['limit']);_0x520915[_0x8ae8('0x1c')]=qs[_0x8ae8('0x1c')](_0x233fd1[_0x8ae8('0x2e')][_0x8ae8('0x1c')]);}_0x520915['order']=qs[_0x8ae8('0x36')](_0x233fd1[_0x8ae8('0x2e')][_0x8ae8('0x36')]);_0x520915['where']=qs[_0x8ae8('0x30')](_['pick'](_0x233fd1[_0x8ae8('0x2e')],_0x2b9ae8['filters']));_0x520915['where']['CampaignId']=_0x21293c['id'];if(_0x233fd1['query'][_0x8ae8('0x39')]){_0x520915[_0x8ae8('0x37')]=_[_0x8ae8('0x3a')](_0x520915[_0x8ae8('0x37')],{'$or':_[_0x8ae8('0x27')](_0x520915[_0x8ae8('0x32')],function(_0x249885){var _0x29a34b={};_0x29a34b[_0x249885]={'$like':'%'+_0x233fd1[_0x8ae8('0x2e')][_0x8ae8('0x39')]+'%'};return _0x29a34b;})});}_0x520915=_[_0x8ae8('0x3a')]({},_0x520915,_0x233fd1[_0x8ae8('0x3b')]);return db[_0x8ae8('0x58')]['count']({'where':_0x520915[_0x8ae8('0x37')]})[_0x8ae8('0x20')](function(_0x16a65e){_0x58def5['count']=_0x16a65e;if(_0x233fd1[_0x8ae8('0x2e')][_0x8ae8('0x41')]){_0x520915[_0x8ae8('0x4f')]=[{'all':!![]}];}return db[_0x8ae8('0x58')][_0x8ae8('0x3c')](_0x520915);})[_0x8ae8('0x20')](function(_0x49441b){_0x58def5[_0x8ae8('0x3d')]=_0x49441b;return _0x58def5;});}})[_0x8ae8('0x20')](respondWithFilteredResult(_0x218e9d,_0x520915))[_0x8ae8('0x3e')](handleError(_0x218e9d,null));};exports[_0x8ae8('0x59')]=function(_0x39398c,_0x5e8f60,_0x530bc0){var _0x4684b5={'raw':!![],'where':{}};var _0x17c6af={};var _0x51c184={'count':0x0,'rows':[]};return db[_0x8ae8('0x28')][_0x8ae8('0x56')]({'where':{'id':_0x39398c[_0x8ae8('0x40')]['id']}})['then'](handleEntityNotFound(_0x5e8f60,null))[_0x8ae8('0x20')](function(_0x1f9256){if(_0x1f9256){_0x17c6af[_0x8ae8('0x2d')]=_['keys'](db[_0x8ae8('0x5a')]['rawAttributes']);_0x17c6af[_0x8ae8('0x2e')]=_[_0x8ae8('0x2f')](_0x39398c[_0x8ae8('0x2e')]);_0x17c6af['filters']=_['intersection'](_0x17c6af[_0x8ae8('0x2d')],_0x17c6af[_0x8ae8('0x2e')]);_0x4684b5[_0x8ae8('0x32')]=_[_0x8ae8('0x31')](_0x17c6af[_0x8ae8('0x2d')],qs[_0x8ae8('0x33')](_0x39398c['query']['fields']));_0x4684b5[_0x8ae8('0x32')]=_0x4684b5[_0x8ae8('0x32')]['length']?_0x4684b5['attributes']:_0x17c6af['model'];if(!_0x39398c[_0x8ae8('0x2e')][_0x8ae8('0x34')]('nolimit')){_0x4684b5[_0x8ae8('0x1a')]=qs[_0x8ae8('0x1a')](_0x39398c['query'][_0x8ae8('0x1a')]);_0x4684b5[_0x8ae8('0x1c')]=qs[_0x8ae8('0x1c')](_0x39398c[_0x8ae8('0x2e')][_0x8ae8('0x1c')]);}_0x4684b5[_0x8ae8('0x35')]=qs[_0x8ae8('0x36')](_0x39398c[_0x8ae8('0x2e')]['sort']);_0x4684b5[_0x8ae8('0x37')]=qs['filters'](_[_0x8ae8('0x38')](_0x39398c[_0x8ae8('0x2e')],_0x17c6af[_0x8ae8('0x30')]));_0x4684b5[_0x8ae8('0x37')][_0x8ae8('0x5b')]=_0x1f9256['id'];if(_0x39398c[_0x8ae8('0x2e')]['filter']){_0x4684b5[_0x8ae8('0x37')]=_[_0x8ae8('0x3a')](_0x4684b5['where'],{'$or':_[_0x8ae8('0x27')](_0x4684b5[_0x8ae8('0x32')],function(_0xa6b101){var _0x5810d1={};_0x5810d1[_0xa6b101]={'$like':'%'+_0x39398c[_0x8ae8('0x2e')][_0x8ae8('0x39')]+'%'};return _0x5810d1;})});}_0x4684b5=_['merge']({},_0x4684b5,_0x39398c[_0x8ae8('0x3b')]);return db[_0x8ae8('0x5a')][_0x8ae8('0x1d')]({'where':_0x4684b5[_0x8ae8('0x37')]})[_0x8ae8('0x20')](function(_0x5c60fd){_0x51c184[_0x8ae8('0x1d')]=_0x5c60fd;if(_0x39398c[_0x8ae8('0x2e')][_0x8ae8('0x41')]){_0x4684b5[_0x8ae8('0x4f')]=[{'all':!![]}];}return db['CmHopperHistory'][_0x8ae8('0x3c')](_0x4684b5);})[_0x8ae8('0x20')](function(_0x167652){_0x51c184[_0x8ae8('0x3d')]=_0x167652;return _0x51c184;});}})['then'](respondWithFilteredResult(_0x5e8f60,_0x4684b5))[_0x8ae8('0x3e')](handleError(_0x5e8f60,null));};exports[_0x8ae8('0x5c')]=function(_0x421c51,_0x269c53,_0x2230d9){var _0x5483b1={'raw':!![],'where':{}};var _0x4fddc6={};var _0x42f7b9={'count':0x0,'rows':[]};return db[_0x8ae8('0x28')][_0x8ae8('0x56')]({'where':{'id':_0x421c51[_0x8ae8('0x40')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x269c53,null))['then'](function(_0x237a86){if(_0x237a86){_0x4fddc6[_0x8ae8('0x2d')]=_[_0x8ae8('0x2f')](db['CmHopperFinal'][_0x8ae8('0x29')]);_0x4fddc6[_0x8ae8('0x2e')]=_[_0x8ae8('0x2f')](_0x421c51[_0x8ae8('0x2e')]);_0x4fddc6['filters']=_['intersection'](_0x4fddc6['model'],_0x4fddc6['query']);_0x5483b1['attributes']=_['intersection'](_0x4fddc6[_0x8ae8('0x2d')],qs[_0x8ae8('0x33')](_0x421c51[_0x8ae8('0x2e')]['fields']));_0x5483b1[_0x8ae8('0x32')]=_0x5483b1[_0x8ae8('0x32')][_0x8ae8('0x4e')]?_0x5483b1[_0x8ae8('0x32')]:_0x4fddc6[_0x8ae8('0x2d')];if(!_0x421c51[_0x8ae8('0x2e')][_0x8ae8('0x34')](_0x8ae8('0x57'))){_0x5483b1['limit']=qs[_0x8ae8('0x1a')](_0x421c51[_0x8ae8('0x2e')][_0x8ae8('0x1a')]);_0x5483b1['offset']=qs[_0x8ae8('0x1c')](_0x421c51['query'][_0x8ae8('0x1c')]);}_0x5483b1[_0x8ae8('0x35')]=qs[_0x8ae8('0x36')](_0x421c51['query'][_0x8ae8('0x36')]);_0x5483b1['where']=qs[_0x8ae8('0x30')](_['pick'](_0x421c51[_0x8ae8('0x2e')],_0x4fddc6[_0x8ae8('0x30')]));_0x5483b1[_0x8ae8('0x37')][_0x8ae8('0x5b')]=_0x237a86['id'];if(_0x421c51[_0x8ae8('0x2e')][_0x8ae8('0x39')]){_0x5483b1[_0x8ae8('0x37')]=_[_0x8ae8('0x3a')](_0x5483b1[_0x8ae8('0x37')],{'$or':_['map'](_0x5483b1['attributes'],function(_0x58baa3){var _0x58aecc={};_0x58aecc[_0x58baa3]={'$like':'%'+_0x421c51['query'][_0x8ae8('0x39')]+'%'};return _0x58aecc;})});}_0x5483b1=_[_0x8ae8('0x3a')]({},_0x5483b1,_0x421c51[_0x8ae8('0x3b')]);return db['CmHopperFinal'][_0x8ae8('0x1d')]({'where':_0x5483b1['where']})[_0x8ae8('0x20')](function(_0x373572){_0x42f7b9[_0x8ae8('0x1d')]=_0x373572;if(_0x421c51[_0x8ae8('0x2e')]['includeAll']){_0x5483b1[_0x8ae8('0x4f')]=[{'all':!![]}];}return db[_0x8ae8('0x5d')]['findAll'](_0x5483b1);})[_0x8ae8('0x20')](function(_0x473850){_0x42f7b9[_0x8ae8('0x3d')]=_0x473850;return _0x42f7b9;});}})[_0x8ae8('0x20')](respondWithFilteredResult(_0x269c53,_0x5483b1))[_0x8ae8('0x3e')](handleError(_0x269c53,null));};exports['getHopperBlacks']=function(_0x5311ac,_0x22e322,_0x119296){var _0xce2d44={'raw':!![],'where':{}};var _0x18f9f3={};var _0x2af79b={'count':0x0,'rows':[]};return db[_0x8ae8('0x28')][_0x8ae8('0x56')]({'where':{'id':_0x5311ac[_0x8ae8('0x40')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x22e322,null))[_0x8ae8('0x20')](function(_0x3cbe55){if(_0x3cbe55){_0x18f9f3[_0x8ae8('0x2d')]=_[_0x8ae8('0x2f')](db[_0x8ae8('0x5e')][_0x8ae8('0x29')]);_0x18f9f3[_0x8ae8('0x2e')]=_[_0x8ae8('0x2f')](_0x5311ac[_0x8ae8('0x2e')]);_0x18f9f3[_0x8ae8('0x30')]=_[_0x8ae8('0x31')](_0x18f9f3[_0x8ae8('0x2d')],_0x18f9f3[_0x8ae8('0x2e')]);_0xce2d44['attributes']=_['intersection'](_0x18f9f3[_0x8ae8('0x2d')],qs[_0x8ae8('0x33')](_0x5311ac[_0x8ae8('0x2e')][_0x8ae8('0x33')]));_0xce2d44['attributes']=_0xce2d44['attributes'][_0x8ae8('0x4e')]?_0xce2d44[_0x8ae8('0x32')]:_0x18f9f3['model'];if(!_0x5311ac[_0x8ae8('0x2e')]['hasOwnProperty'](_0x8ae8('0x57'))){_0xce2d44[_0x8ae8('0x1a')]=qs[_0x8ae8('0x1a')](_0x5311ac[_0x8ae8('0x2e')]['limit']);_0xce2d44[_0x8ae8('0x1c')]=qs['offset'](_0x5311ac['query']['offset']);}_0xce2d44[_0x8ae8('0x35')]=qs[_0x8ae8('0x36')](_0x5311ac[_0x8ae8('0x2e')][_0x8ae8('0x36')]);_0xce2d44[_0x8ae8('0x37')]=qs[_0x8ae8('0x30')](_['pick'](_0x5311ac[_0x8ae8('0x2e')],_0x18f9f3[_0x8ae8('0x30')]));_0xce2d44[_0x8ae8('0x37')]['CampaignId']=_0x3cbe55['id'];if(_0x5311ac[_0x8ae8('0x2e')][_0x8ae8('0x39')]){_0xce2d44[_0x8ae8('0x37')]=_[_0x8ae8('0x3a')](_0xce2d44[_0x8ae8('0x37')],{'$or':_[_0x8ae8('0x27')](_0xce2d44[_0x8ae8('0x32')],function(_0x7cfc10){var _0x2fc658={};_0x2fc658[_0x7cfc10]={'$like':'%'+_0x5311ac[_0x8ae8('0x2e')][_0x8ae8('0x39')]+'%'};return _0x2fc658;})});}_0xce2d44=_['merge']({},_0xce2d44,_0x5311ac[_0x8ae8('0x3b')]);return db[_0x8ae8('0x5e')]['count']({'where':_0xce2d44['where']})[_0x8ae8('0x20')](function(_0x220907){_0x2af79b[_0x8ae8('0x1d')]=_0x220907;if(_0x5311ac['query'][_0x8ae8('0x41')]){_0xce2d44[_0x8ae8('0x4f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x8ae8('0x3c')](_0xce2d44);})[_0x8ae8('0x20')](function(_0x127186){_0x2af79b['rows']=_0x127186;return _0x2af79b;});}})['then'](respondWithFilteredResult(_0x22e322,_0xce2d44))[_0x8ae8('0x3e')](handleError(_0x22e322,null));};exports[_0x8ae8('0x5f')]=function(_0x5b8fa1,_0xa9f8a6,_0x5a6471){var _0x1123b2={};var _0x22ed19={};var _0x154096;var _0x166c41;return db[_0x8ae8('0x28')][_0x8ae8('0x56')]({'where':{'id':_0x5b8fa1['params']['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0xa9f8a6,null))['then'](function(_0x279abc){if(_0x279abc){_0x154096=_0x279abc;_0x22ed19[_0x8ae8('0x2d')]=_[_0x8ae8('0x2f')](db[_0x8ae8('0x60')][_0x8ae8('0x29')]);_0x22ed19[_0x8ae8('0x2e')]=_['keys'](_0x5b8fa1[_0x8ae8('0x2e')]);_0x22ed19[_0x8ae8('0x30')]=_['intersection'](_0x22ed19[_0x8ae8('0x2d')],_0x22ed19[_0x8ae8('0x2e')]);_0x1123b2[_0x8ae8('0x32')]=_[_0x8ae8('0x31')](_0x22ed19[_0x8ae8('0x2d')],qs['fields'](_0x5b8fa1['query'][_0x8ae8('0x33')]));_0x1123b2[_0x8ae8('0x32')]=_0x1123b2[_0x8ae8('0x32')][_0x8ae8('0x4e')]?_0x1123b2['attributes']:_0x22ed19[_0x8ae8('0x2d')];_0x1123b2[_0x8ae8('0x35')]=qs[_0x8ae8('0x36')](_0x5b8fa1[_0x8ae8('0x2e')]['sort']);_0x1123b2[_0x8ae8('0x37')]=qs[_0x8ae8('0x30')](_[_0x8ae8('0x38')](_0x5b8fa1[_0x8ae8('0x2e')],_0x22ed19[_0x8ae8('0x30')]));if(_0x5b8fa1['query'][_0x8ae8('0x39')]){_0x1123b2[_0x8ae8('0x37')]=_['merge'](_0x1123b2[_0x8ae8('0x37')],{'$or':_[_0x8ae8('0x27')](_0x1123b2[_0x8ae8('0x32')],function(_0x93518b){var _0x5908a7={};_0x5908a7[_0x93518b]={'$like':'%'+_0x5b8fa1[_0x8ae8('0x2e')][_0x8ae8('0x39')]+'%'};return _0x5908a7;})});}_0x1123b2=_[_0x8ae8('0x3a')]({},_0x1123b2,_0x5b8fa1['options']);return _0x154096[_0x8ae8('0x5f')](_0x1123b2);}})[_0x8ae8('0x20')](function(_0xe9379c){if(_0xe9379c){_0x166c41=_0xe9379c[_0x8ae8('0x4e')];if(!_0x5b8fa1[_0x8ae8('0x2e')][_0x8ae8('0x34')](_0x8ae8('0x57'))){_0x1123b2[_0x8ae8('0x1a')]=qs[_0x8ae8('0x1a')](_0x5b8fa1['query']['limit']);_0x1123b2[_0x8ae8('0x1c')]=qs[_0x8ae8('0x1c')](_0x5b8fa1[_0x8ae8('0x2e')]['offset']);}return _0x154096['getLists'](_0x1123b2);}})[_0x8ae8('0x20')](function(_0x278600){if(_0x278600){return _0x278600?{'count':_0x166c41,'rows':_0x278600}:null;}})[_0x8ae8('0x20')](respondWithResult(_0xa9f8a6,null))[_0x8ae8('0x3e')](handleError(_0xa9f8a6,null));};exports[_0x8ae8('0x61')]=function(_0x3f7be6,_0x51e7e3,_0x463e18){var _0xc51a79,_0x3cd185;var _0x2280a2=[];var _0x1e4934=moment()[_0x8ae8('0x62')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0x8ae8('0x28')][_0x8ae8('0x49')]({'where':{'id':_0x3f7be6[_0x8ae8('0x40')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x51e7e3,null))[_0x8ae8('0x20')](function(_0x1a2340){if(_0x1a2340){_0x3cd185=_0x1a2340;return _0x1a2340[_0x8ae8('0x61')](_0x3f7be6[_0x8ae8('0x43')][_0x8ae8('0x63')],_[_0x8ae8('0x50')](_0x3f7be6[_0x8ae8('0x43')],['ids','id'])||{});}return null;})[_0x8ae8('0x64')](function(_0x305418){var _0x18870e;var _0x35a0c3;_0xc51a79=_0x305418||[];var _0x51fcac=[];if(_0x305418){for(var _0x364ea7=0x0;_0x364ea7<_0x305418[_0x8ae8('0x4e')];_0x364ea7+=0x1){var _0x4ab562=_0x305418[_0x364ea7]['get']({'plain':!![]});_0x3cd185[_0x8ae8('0x65')]=_0x3f7be6[_0x8ae8('0x43')][_0x8ae8('0x65')]?_0x3f7be6[_0x8ae8('0x43')]['dialCheckDuplicateType']:_0x3cd185[_0x8ae8('0x65')];switch(_0x3cd185[_0x8ae8('0x65')]){case'always':_0x18870e=squel['insert']()[_0x8ae8('0x66')](_0x8ae8('0x67'))[_0x8ae8('0x68')](['phone',_0x8ae8('0x69'),_0x8ae8('0x6a'),_0x8ae8('0x6b'),_0x8ae8('0x5b'),'createdAt',_0x8ae8('0x51')],squel[_0x8ae8('0x6c')]()['field']('phone',_0x8ae8('0x6d'))[_0x8ae8('0x6e')](_0x8ae8('0x6f'),_0x8ae8('0x69'))['field']('id','ContactId')[_0x8ae8('0x6e')](_0x4ab562[_0x8ae8('0x70')][_0x8ae8('0x71')](),_0x8ae8('0x6b'))[_0x8ae8('0x6e')](_0x3f7be6[_0x8ae8('0x40')]['id'][_0x8ae8('0x71')](),_0x8ae8('0x5b'))['field']('\x27'+_0x1e4934+'\x27',_0x8ae8('0x52'))['field']('\x27'+_0x1e4934+'\x27',_0x8ae8('0x51'))[_0x8ae8('0x72')]('cm_contacts')[_0x8ae8('0x37')](_0x8ae8('0x73'))[_0x8ae8('0x37')](_0x8ae8('0x74'),_0x4ab562[_0x8ae8('0x70')][_0x8ae8('0x71')]())[_0x8ae8('0x37')](_0x8ae8('0x75'))[_0x8ae8('0x37')](_0x8ae8('0x76'),squel[_0x8ae8('0x6c')]()[_0x8ae8('0x6e')](_0x8ae8('0x77'))[_0x8ae8('0x72')](_0x8ae8('0x78'))[_0x8ae8('0x37')](_0x8ae8('0x79'),_0x3f7be6[_0x8ae8('0x40')]['id'][_0x8ae8('0x71')]()))[_0x8ae8('0x37')](_0x8ae8('0x76'),squel[_0x8ae8('0x6c')]()['field'](_0x8ae8('0x7a'))[_0x8ae8('0x72')](_0x8ae8('0x67'))[_0x8ae8('0x37')](_0x8ae8('0x79'),_0x3f7be6[_0x8ae8('0x40')]['id'][_0x8ae8('0x71')]())))[_0x8ae8('0x71')]();break;case'onlyIfOpen':_0x18870e=squel['insert']()['into'](_0x8ae8('0x67'))[_0x8ae8('0x68')]([_0x8ae8('0x6d'),_0x8ae8('0x69'),_0x8ae8('0x6a'),_0x8ae8('0x6b'),_0x8ae8('0x5b'),'createdAt',_0x8ae8('0x51')],squel[_0x8ae8('0x6c')]()['field']('phone','phone')[_0x8ae8('0x6e')](_0x8ae8('0x6f'),_0x8ae8('0x69'))[_0x8ae8('0x6e')]('id',_0x8ae8('0x6a'))['field'](_0x4ab562[_0x8ae8('0x70')]['toString'](),_0x8ae8('0x6b'))[_0x8ae8('0x6e')](_0x3f7be6[_0x8ae8('0x40')]['id'][_0x8ae8('0x71')](),_0x8ae8('0x5b'))[_0x8ae8('0x6e')]('\x27'+_0x1e4934+'\x27',_0x8ae8('0x52'))[_0x8ae8('0x6e')]('\x27'+_0x1e4934+'\x27',_0x8ae8('0x51'))[_0x8ae8('0x72')]('cm_contacts')[_0x8ae8('0x37')](_0x8ae8('0x73'))['where'](_0x8ae8('0x74'),_0x4ab562['CmListId'][_0x8ae8('0x71')]())[_0x8ae8('0x37')](_0x8ae8('0x75'))[_0x8ae8('0x37')](_0x8ae8('0x76'),squel[_0x8ae8('0x6c')]()[_0x8ae8('0x6e')](_0x8ae8('0x7a'))[_0x8ae8('0x72')]('cm_hopper')['where'](_0x8ae8('0x79'),_0x3f7be6[_0x8ae8('0x40')]['id']['toString']())))[_0x8ae8('0x71')]();break;default:_0x18870e=squel['insert']()[_0x8ae8('0x66')](_0x8ae8('0x67'))['fromQuery']([_0x8ae8('0x6d'),'scheduledAt','ContactId',_0x8ae8('0x6b'),_0x8ae8('0x5b'),'createdAt',_0x8ae8('0x51')],squel[_0x8ae8('0x6c')]()[_0x8ae8('0x6e')](_0x8ae8('0x6d'),_0x8ae8('0x6d'))['field'](_0x8ae8('0x6f'),_0x8ae8('0x69'))[_0x8ae8('0x6e')]('id','ContactId')[_0x8ae8('0x6e')](_0x4ab562['CmListId']['toString'](),_0x8ae8('0x6b'))['field'](_0x3f7be6[_0x8ae8('0x40')]['id'][_0x8ae8('0x71')](),_0x8ae8('0x5b'))[_0x8ae8('0x6e')]('\x27'+_0x1e4934+'\x27',_0x8ae8('0x52'))[_0x8ae8('0x6e')]('\x27'+_0x1e4934+'\x27',_0x8ae8('0x51'))['from']('cm_contacts')[_0x8ae8('0x37')](_0x8ae8('0x73'))[_0x8ae8('0x37')](_0x8ae8('0x74'),_0x4ab562[_0x8ae8('0x70')][_0x8ae8('0x71')]())[_0x8ae8('0x37')](_0x8ae8('0x75')))[_0x8ae8('0x71')]();}_0x35a0c3=squel[_0x8ae8('0x7b')]()[_0x8ae8('0x66')](_0x8ae8('0x7c'))[_0x8ae8('0x68')](['cmHopperId','scheduledAt','phone',_0x8ae8('0x7d'),_0x8ae8('0x52'),_0x8ae8('0x51')],squel[_0x8ae8('0x6c')]()[_0x8ae8('0x6e')]('h.id','id')['field'](_0x8ae8('0x6f'),'scheduledAt')['field']('ci.item',_0x8ae8('0x6d'))['field'](_0x8ae8('0x7e'),_0x8ae8('0x7d'))[_0x8ae8('0x6e')]('\x27'+_0x1e4934+'\x27',_0x8ae8('0x52'))[_0x8ae8('0x6e')]('\x27'+_0x1e4934+'\x27',_0x8ae8('0x51'))[_0x8ae8('0x72')](_0x8ae8('0x7f'),'ci')[_0x8ae8('0x80')]('cm_hopper','h','h.ContactId\x20=\x20ci.CmContactId')[_0x8ae8('0x37')](_0x8ae8('0x81'),_0x4ab562[_0x8ae8('0x70')][_0x8ae8('0x71')]())[_0x8ae8('0x37')](_0x8ae8('0x82'),_0x3f7be6[_0x8ae8('0x40')]['id']['toString']())[_0x8ae8('0x37')]('h.createdAt\x20=\x20?',_0x1e4934))[_0x8ae8('0x71')]();_0x51fcac[_0x8ae8('0x83')](db[_0x8ae8('0x84')][_0x8ae8('0x2e')](_0x18870e));_0x2280a2[_0x8ae8('0x83')](db[_0x8ae8('0x84')][_0x8ae8('0x2e')](_0x35a0c3));}return BPromise['all'](_0x51fcac);}})[_0x8ae8('0x20')](function(){return BPromise[_0x8ae8('0x85')](_0x2280a2);})[_0x8ae8('0x20')](function(){return _0xc51a79;})[_0x8ae8('0x20')](respondWithResult(_0x51e7e3,null))[_0x8ae8('0x3e')](handleError(_0x51e7e3,null));};exports[_0x8ae8('0x86')]=function(_0x4f4c52,_0x3f54a0,_0x2a51b8){return db[_0x8ae8('0x28')]['find']({'where':{'id':_0x4f4c52['params']['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x3f54a0,null))[_0x8ae8('0x20')](function(_0x2acdbc){if(_0x2acdbc){return _0x2acdbc[_0x8ae8('0x86')](_0x4f4c52[_0x8ae8('0x2e')][_0x8ae8('0x63')]);}})[_0x8ae8('0x20')](function(_0xcfeb08){if(_0xcfeb08){return db[_0x8ae8('0x58')][_0x8ae8('0x54')]({'where':{'ListId':_0x4f4c52[_0x8ae8('0x2e')][_0x8ae8('0x63')],'CampaignId':_0x4f4c52['params']['id']}})[_0x8ae8('0x20')](function(){return _0xcfeb08;});}})[_0x8ae8('0x20')](respondWithStatusCode(_0x3f54a0,null))[_0x8ae8('0x3e')](handleError(_0x3f54a0,null));};exports[_0x8ae8('0x87')]=function(_0x52e487,_0x657eda,_0x26aeca){var _0x41ea3e={};var _0x11b0a8={};var _0x33f65c;var _0x304707;return db[_0x8ae8('0x28')][_0x8ae8('0x56')]({'where':{'id':_0x52e487['params']['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x657eda,null))[_0x8ae8('0x20')](function(_0xd3aae6){if(_0xd3aae6){_0x33f65c=_0xd3aae6;_0x11b0a8[_0x8ae8('0x2d')]=_['keys'](db[_0x8ae8('0x60')][_0x8ae8('0x29')]);_0x11b0a8[_0x8ae8('0x2e')]=_[_0x8ae8('0x2f')](_0x52e487[_0x8ae8('0x2e')]);_0x11b0a8[_0x8ae8('0x30')]=_[_0x8ae8('0x31')](_0x11b0a8[_0x8ae8('0x2d')],_0x11b0a8[_0x8ae8('0x2e')]);_0x41ea3e[_0x8ae8('0x32')]=_[_0x8ae8('0x31')](_0x11b0a8[_0x8ae8('0x2d')],qs[_0x8ae8('0x33')](_0x52e487[_0x8ae8('0x2e')]['fields']));_0x41ea3e[_0x8ae8('0x32')]=_0x41ea3e[_0x8ae8('0x32')][_0x8ae8('0x4e')]?_0x41ea3e[_0x8ae8('0x32')]:_0x11b0a8[_0x8ae8('0x2d')];_0x41ea3e[_0x8ae8('0x35')]=qs[_0x8ae8('0x36')](_0x52e487[_0x8ae8('0x2e')][_0x8ae8('0x36')]);_0x41ea3e['where']=qs['filters'](_[_0x8ae8('0x38')](_0x52e487[_0x8ae8('0x2e')],_0x11b0a8[_0x8ae8('0x30')]));if(_0x52e487[_0x8ae8('0x2e')][_0x8ae8('0x39')]){_0x41ea3e['where']=_['merge'](_0x41ea3e['where'],{'$or':_[_0x8ae8('0x27')](_0x41ea3e[_0x8ae8('0x32')],function(_0xbf361b){var _0x476af1={};_0x476af1[_0xbf361b]={'$like':'%'+_0x52e487[_0x8ae8('0x2e')]['filter']+'%'};return _0x476af1;})});}_0x41ea3e=_[_0x8ae8('0x3a')]({},_0x41ea3e,_0x52e487[_0x8ae8('0x3b')]);return _0x33f65c[_0x8ae8('0x87')](_0x41ea3e);}})[_0x8ae8('0x20')](function(_0x4fdcd5){if(_0x4fdcd5){_0x304707=_0x4fdcd5[_0x8ae8('0x4e')];if(!_0x52e487[_0x8ae8('0x2e')][_0x8ae8('0x34')](_0x8ae8('0x57'))){_0x41ea3e[_0x8ae8('0x1a')]=qs[_0x8ae8('0x1a')](_0x52e487['query'][_0x8ae8('0x1a')]);_0x41ea3e[_0x8ae8('0x1c')]=qs['offset'](_0x52e487[_0x8ae8('0x2e')][_0x8ae8('0x1c')]);}return _0x33f65c[_0x8ae8('0x87')](_0x41ea3e);}})[_0x8ae8('0x20')](function(_0x5a5245){if(_0x5a5245){return _0x5a5245?{'count':_0x304707,'rows':_0x5a5245}:null;}})[_0x8ae8('0x20')](respondWithResult(_0x657eda,null))[_0x8ae8('0x3e')](handleError(_0x657eda,null));};exports[_0x8ae8('0x88')]=function(_0xc52744,_0x4bae66,_0x2bf8e8){var _0x208d4f,_0x4937be;var _0x420074=[];var _0x5eed8c=moment()[_0x8ae8('0x62')](_0x8ae8('0x89'));return db[_0x8ae8('0x28')][_0x8ae8('0x49')]({'where':{'id':_0xc52744[_0x8ae8('0x40')]['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x4bae66,null))[_0x8ae8('0x20')](function(_0x421fe1){if(_0x421fe1){_0x4937be=_0x421fe1;return _0x421fe1[_0x8ae8('0x88')](_0xc52744['body'][_0x8ae8('0x63')],_['omit'](_0xc52744[_0x8ae8('0x43')],[_0x8ae8('0x63'),'id'])||{});}return null;})[_0x8ae8('0x64')](function(_0x2bf902){var _0x2c6ba3;var _0x2dda05;_0x208d4f=_0x2bf902||[];var _0x332acf=[];if(_0x2bf902){for(var _0x487e7a=0x0;_0x487e7a<_0x2bf902['length'];_0x487e7a+=0x1){var _0x26cfab=_0x2bf902[_0x487e7a][_0x8ae8('0x45')]({'plain':!![]});_0x2c6ba3=squel[_0x8ae8('0x7b')]()[_0x8ae8('0x66')]('cm_hopper_black')[_0x8ae8('0x68')]([_0x8ae8('0x6d'),_0x8ae8('0x6a'),_0x8ae8('0x6b'),'CampaignId',_0x8ae8('0x52'),_0x8ae8('0x51')],squel['select']()[_0x8ae8('0x6e')]('phone',_0x8ae8('0x6d'))[_0x8ae8('0x6e')]('id','ContactId')['field'](_0x26cfab['CmListId']['toString'](),_0x8ae8('0x6b'))['field'](_0xc52744[_0x8ae8('0x40')]['id'][_0x8ae8('0x71')](),_0x8ae8('0x5b'))[_0x8ae8('0x6e')](_0x8ae8('0x6f'),_0x8ae8('0x52'))[_0x8ae8('0x6e')](_0x8ae8('0x6f'),_0x8ae8('0x51'))['from'](_0x8ae8('0x8a'))['where'](_0x8ae8('0x73'))[_0x8ae8('0x37')](_0x8ae8('0x74'),_0x26cfab['CmListId'][_0x8ae8('0x71')]())['where'](_0x8ae8('0x75')))['toString']();_0x332acf['push'](db[_0x8ae8('0x84')]['query'](_0x2c6ba3));}return BPromise['all'](_0x332acf);}})['then'](function(){return _0x208d4f;})[_0x8ae8('0x20')](respondWithResult(_0x4bae66,null))[_0x8ae8('0x3e')](handleError(_0x4bae66,null));};exports['removeBlackLists']=function(_0x85110,_0x44e366,_0x4edc32){return db[_0x8ae8('0x28')]['find']({'where':{'id':_0x85110['params']['id']}})[_0x8ae8('0x20')](handleEntityNotFound(_0x44e366,null))[_0x8ae8('0x20')](function(_0x317d36){if(_0x317d36){return _0x317d36[_0x8ae8('0x8b')](_0x85110[_0x8ae8('0x2e')]['ids']);}})['then'](function(_0xc8d209){if(_0xc8d209){return db[_0x8ae8('0x5e')][_0x8ae8('0x54')]({'where':{'ListId':_0x85110['query'][_0x8ae8('0x63')],'CampaignId':_0x85110[_0x8ae8('0x40')]['id']}})[_0x8ae8('0x20')](function(){return _0xc8d209;});}})['then'](respondWithStatusCode(_0x44e366,null))['catch'](handleError(_0x44e366,null));}; \ No newline at end of file +var _0x2b4f=['phone','NOW()','CmListId','toString','cm_contacts','ListId\x20=\x20?','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','from','CampaignId\x20=\x20?','select','COALESCE(phone,\x27\x27)','onlyIfOpen','insert','into','deletedAt\x20IS\x20NULL','ListId','cmHopperId','h.id','ci.item','ci.OrderBY','join','h.ContactId\x20=\x20ci.CmContactId','h.ListId\x20=\x20?','h.CampaignId=?','push','sequelize','removeLists','getBlackLists','addBlackLists','spread','cm_hopper_black','removeBlackLists','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','status','offset','limit','count','set','Content-Range','json','apply','reject','save','then','destroy','get','sendStatus','error','stack','name','index','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','Campaign','rows','catch','show','params','keys','fields','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','IvrCampaigns','UserProfileSection','userProfileId','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','createdAt','updatedAt','omit','autoAssociation','findOne','CmHopper','nolimit','CampaignId','map','findAll','CmHopperHistory','getHopperFinals','CmHopperFinal','getHopperBlacks','CmHopperBlack','getLists','CmList','format','YYYY-MM-DD\x20HH:mm:ss','ids','dialCheckDuplicateType','always','cm_hopper','fromQuery','scheduledAt','ContactId','field'];(function(_0x2a07bc,_0x4b9718){var _0x5bd06=function(_0x43dc1e){while(--_0x43dc1e){_0x2a07bc['push'](_0x2a07bc['shift']());}};_0x5bd06(++_0x4b9718);}(_0x2b4f,0x142));var _0xf2b4=function(_0x1b3401,_0x3086cb){_0x1b3401=_0x1b3401-0x0;var _0x1e80bc=_0x2b4f[_0x1b3401];return _0x1e80bc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf2b4('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf2b4('0x1'));var rp=require(_0xf2b4('0x2'));var moment=require(_0xf2b4('0x3'));var BPromise=require(_0xf2b4('0x4'));var Mustache=require(_0xf2b4('0x5'));var util=require('util');var path=require(_0xf2b4('0x6'));var sox=require(_0xf2b4('0x7'));var csv=require(_0xf2b4('0x8'));var ejs=require(_0xf2b4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf2b4('0xa'));var squel=require('squel');var crypto=require(_0xf2b4('0xb'));var jsforce=require(_0xf2b4('0xc'));var deskjs=require(_0xf2b4('0xd'));var toCsv=require(_0xf2b4('0x8'));var querystring=require(_0xf2b4('0xe'));var Papa=require(_0xf2b4('0xf'));var Redis=require(_0xf2b4('0x10'));var authService=require(_0xf2b4('0x11'));var qs=require(_0xf2b4('0x12'));var as=require(_0xf2b4('0x13'));var hardwareService=require(_0xf2b4('0x14'));var logger=require(_0xf2b4('0x15'))(_0xf2b4('0x16'));var utils=require(_0xf2b4('0x17'));var config=require(_0xf2b4('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf2b4('0x19'))['db'];function respondWithStatusCode(_0x39f318,_0x25942b){_0x25942b=_0x25942b||0xcc;return function(_0x2c4495){if(_0x2c4495){return _0x39f318['sendStatus'](_0x25942b);}return _0x39f318['status'](_0x25942b)[_0xf2b4('0x1a')]();};}function respondWithResult(_0x5172c0,_0x435022){_0x435022=_0x435022||0xc8;return function(_0x1f5b60){if(_0x1f5b60){return _0x5172c0[_0xf2b4('0x1b')](_0x435022)['json'](_0x1f5b60);}};}function respondWithFilteredResult(_0x4fcecf,_0x39fcea){return function(_0x235ad7){if(_0x235ad7){var _0x3daaf6=typeof _0x39fcea[_0xf2b4('0x1c')]==='undefined'&&typeof _0x39fcea[_0xf2b4('0x1d')]==='undefined';var _0x1872ef=_0x235ad7[_0xf2b4('0x1e')];var _0x1b0a12=_0x3daaf6?0x0:_0x39fcea[_0xf2b4('0x1c')];var _0x1b2429=_0x3daaf6?_0x235ad7[_0xf2b4('0x1e')]:_0x39fcea[_0xf2b4('0x1c')]+_0x39fcea[_0xf2b4('0x1d')];var _0x4a1b6a;if(_0x1b2429>=_0x1872ef){_0x1b2429=_0x1872ef;_0x4a1b6a=0xc8;}else{_0x4a1b6a=0xce;}_0x4fcecf[_0xf2b4('0x1b')](_0x4a1b6a);return _0x4fcecf[_0xf2b4('0x1f')](_0xf2b4('0x20'),_0x1b0a12+'-'+_0x1b2429+'/'+_0x1872ef)[_0xf2b4('0x21')](_0x235ad7);}return null;};}function patchUpdates(_0x38afe7){return function(_0x305fa0){try{jsonpatch[_0xf2b4('0x22')](_0x305fa0,_0x38afe7,!![]);}catch(_0x4f84c8){return BPromise[_0xf2b4('0x23')](_0x4f84c8);}return _0x305fa0[_0xf2b4('0x24')]();};}function saveUpdates(_0x2b3897,_0x5fc66e){return function(_0x51330b){if(_0x51330b){return _0x51330b['update'](_0x2b3897)[_0xf2b4('0x25')](function(_0x1244f2){return _0x1244f2;});}return null;};}function removeEntity(_0x18d28b,_0x290658){return function(_0x7daac1){if(_0x7daac1){return _0x7daac1[_0xf2b4('0x26')]()[_0xf2b4('0x25')](function(){var _0x4346c1=_0x7daac1[_0xf2b4('0x27')]({'plain':!![]});var _0x1b9fb4='IvrCampaigns';return db['UserProfileResource'][_0xf2b4('0x26')]({'where':{'type':_0x1b9fb4,'resourceId':_0x4346c1['id']}})[_0xf2b4('0x25')](function(){return _0x7daac1;});})['then'](function(){_0x18d28b[_0xf2b4('0x1b')](0xcc)[_0xf2b4('0x1a')]();});}};}function handleEntityNotFound(_0x3007eb,_0x19eec2){return function(_0x181e50){if(!_0x181e50){_0x3007eb[_0xf2b4('0x28')](0x194);}return _0x181e50;};}function handleError(_0xcff709,_0x444875){_0x444875=_0x444875||0x1f4;return function(_0x506bab){logger[_0xf2b4('0x29')](_0x506bab[_0xf2b4('0x2a')]);if(_0x506bab[_0xf2b4('0x2b')]){delete _0x506bab['name'];}_0xcff709[_0xf2b4('0x1b')](_0x444875)['send'](_0x506bab);};}exports[_0xf2b4('0x2c')]=function(_0x128658,_0x42ad93){var _0x5db7c2={},_0x4a95e2={},_0x15ebd9={'count':0x0,'rows':[]};var _0x5487e3=_['map'](db['Campaign'][_0xf2b4('0x2d')],function(_0x2384c1){return{'name':_0x2384c1[_0xf2b4('0x2e')],'type':_0x2384c1[_0xf2b4('0x2f')]['key']};});_0x4a95e2[_0xf2b4('0x30')]=_['map'](_0x5487e3,_0xf2b4('0x2b'));_0x4a95e2[_0xf2b4('0x31')]=_['keys'](_0x128658['query']);_0x4a95e2[_0xf2b4('0x32')]=_[_0xf2b4('0x33')](_0x4a95e2[_0xf2b4('0x30')],_0x4a95e2[_0xf2b4('0x31')]);_0x5db7c2[_0xf2b4('0x34')]=_[_0xf2b4('0x33')](_0x4a95e2[_0xf2b4('0x30')],qs['fields'](_0x128658[_0xf2b4('0x31')]['fields']));_0x5db7c2[_0xf2b4('0x34')]=_0x5db7c2[_0xf2b4('0x34')][_0xf2b4('0x35')]?_0x5db7c2[_0xf2b4('0x34')]:_0x4a95e2['model'];if(!_0x128658[_0xf2b4('0x31')][_0xf2b4('0x36')]('nolimit')){_0x5db7c2[_0xf2b4('0x1d')]=qs[_0xf2b4('0x1d')](_0x128658['query'][_0xf2b4('0x1d')]);_0x5db7c2[_0xf2b4('0x1c')]=qs[_0xf2b4('0x1c')](_0x128658[_0xf2b4('0x31')][_0xf2b4('0x1c')]);}_0x5db7c2[_0xf2b4('0x37')]=qs[_0xf2b4('0x38')](_0x128658['query'][_0xf2b4('0x38')]);_0x5db7c2[_0xf2b4('0x39')]=qs[_0xf2b4('0x32')](_[_0xf2b4('0x3a')](_0x128658[_0xf2b4('0x31')],_0x4a95e2[_0xf2b4('0x32')]),_0x5487e3);if(_0x128658[_0xf2b4('0x31')][_0xf2b4('0x3b')]){_0x5db7c2[_0xf2b4('0x39')]=_[_0xf2b4('0x3c')](_0x5db7c2['where'],{'$or':_['map'](_0x5487e3,function(_0x2185f6){if(_0x2185f6[_0xf2b4('0x2f')]!==_0xf2b4('0x3d')){var _0x872df7={};_0x872df7[_0x2185f6['name']]={'$like':'%'+_0x128658[_0xf2b4('0x31')][_0xf2b4('0x3b')]+'%'};return _0x872df7;}})});}_0x5db7c2=_[_0xf2b4('0x3c')]({},_0x5db7c2,_0x128658[_0xf2b4('0x3e')]);var _0x43768c={'where':_0x5db7c2[_0xf2b4('0x39')]};return db['Campaign'][_0xf2b4('0x1e')](_0x43768c)[_0xf2b4('0x25')](function(_0x3968d4){_0x15ebd9[_0xf2b4('0x1e')]=_0x3968d4;if(_0x128658[_0xf2b4('0x31')][_0xf2b4('0x3f')]){_0x5db7c2[_0xf2b4('0x40')]=[{'all':!![]}];}return db[_0xf2b4('0x41')]['findAll'](_0x5db7c2);})['then'](function(_0x42e154){_0x15ebd9[_0xf2b4('0x42')]=_0x42e154;return _0x15ebd9;})['then'](respondWithFilteredResult(_0x42ad93,_0x5db7c2))[_0xf2b4('0x43')](handleError(_0x42ad93,null));};exports[_0xf2b4('0x44')]=function(_0x590ea5,_0x554121){var _0x1f2c5f={'raw':![],'where':{'id':_0x590ea5[_0xf2b4('0x45')]['id']}},_0x362ccd={};_0x362ccd[_0xf2b4('0x30')]=_[_0xf2b4('0x46')](db[_0xf2b4('0x41')][_0xf2b4('0x2d')]);_0x362ccd[_0xf2b4('0x31')]=_[_0xf2b4('0x46')](_0x590ea5[_0xf2b4('0x31')]);_0x362ccd[_0xf2b4('0x32')]=_['intersection'](_0x362ccd[_0xf2b4('0x30')],_0x362ccd['query']);_0x1f2c5f[_0xf2b4('0x34')]=_[_0xf2b4('0x33')](_0x362ccd['model'],qs[_0xf2b4('0x47')](_0x590ea5[_0xf2b4('0x31')][_0xf2b4('0x47')]));_0x1f2c5f[_0xf2b4('0x34')]=_0x1f2c5f[_0xf2b4('0x34')][_0xf2b4('0x35')]?_0x1f2c5f[_0xf2b4('0x34')]:_0x362ccd['model'];if(_0x590ea5['query'][_0xf2b4('0x3f')]){_0x1f2c5f[_0xf2b4('0x40')]=[{'all':!![]}];}_0x1f2c5f=_[_0xf2b4('0x3c')]({},_0x1f2c5f,_0x590ea5[_0xf2b4('0x3e')]);return db[_0xf2b4('0x41')][_0xf2b4('0x48')](_0x1f2c5f)[_0xf2b4('0x25')](handleEntityNotFound(_0x554121,null))['then'](respondWithResult(_0x554121,null))['catch'](handleError(_0x554121,null));};exports[_0xf2b4('0x49')]=function(_0x40aa02,_0x22b9e6){return db['Campaign']['create'](_0x40aa02[_0xf2b4('0x4a')],{})['then'](function(_0x333cd2){var _0x144cf7=_0x40aa02[_0xf2b4('0x4b')][_0xf2b4('0x27')]({'plain':!![]});if(!_0x144cf7)throw new Error(_0xf2b4('0x4c'));if(_0x144cf7['role']==='user'){var _0x36c9bb=_0x333cd2[_0xf2b4('0x27')]({'plain':!![]});var _0x432cb2=_0xf2b4('0x4d');return db[_0xf2b4('0x4e')][_0xf2b4('0x48')]({'where':{'name':_0x432cb2,'userProfileId':_0x144cf7[_0xf2b4('0x4f')]},'raw':!![]})[_0xf2b4('0x25')](function(_0x34578a){if(_0x34578a&&_0x34578a['autoAssociation']===0x0){return db[_0xf2b4('0x50')]['create']({'name':_0x36c9bb[_0xf2b4('0x2b')],'resourceId':_0x36c9bb['id'],'type':_0x34578a[_0xf2b4('0x2b')],'sectionId':_0x34578a['id']},{})[_0xf2b4('0x25')](function(){return _0x333cd2;});}else{return _0x333cd2;}})[_0xf2b4('0x43')](function(_0x3aca99){logger[_0xf2b4('0x29')](_0xf2b4('0x51'),_0x3aca99);throw _0x3aca99;});}return _0x333cd2;})[_0xf2b4('0x25')](respondWithResult(_0x22b9e6,0xc9))[_0xf2b4('0x43')](handleError(_0x22b9e6,null));};exports[_0xf2b4('0x52')]=function(_0x66e6c5,_0x2a6a20){var _0x336127={'where':{'id':_0x66e6c5[_0xf2b4('0x45')]['id']}},_0x242e61={};_0x242e61[_0xf2b4('0x30')]=_['keys'](db[_0xf2b4('0x41')]['rawAttributes']);_0x336127[_0xf2b4('0x34')]=_[_0xf2b4('0x33')](_0x242e61['model'],qs[_0xf2b4('0x47')](_0x66e6c5[_0xf2b4('0x31')][_0xf2b4('0x47')]));_0x336127[_0xf2b4('0x34')]=_0x336127[_0xf2b4('0x34')][_0xf2b4('0x35')]?_0x336127[_0xf2b4('0x34')]:_0x242e61[_0xf2b4('0x30')];if(_0x66e6c5[_0xf2b4('0x31')]['includeAll']){_0x336127[_0xf2b4('0x40')]=[{'all':!![]}];}_0x336127=_['merge']({},_0x336127,_0x66e6c5[_0xf2b4('0x3e')]);return db[_0xf2b4('0x41')][_0xf2b4('0x48')](_0x336127)[_0xf2b4('0x25')](handleEntityNotFound(_0x2a6a20,null))[_0xf2b4('0x25')](function(_0xb7bc70){if(_0xb7bc70){var _0x25f757=_0xb7bc70[_0xf2b4('0x27')]({'plain':!![]});_0x25f757=qs['omit'](_0x25f757,['id',_0xf2b4('0x53'),_0xf2b4('0x54')]);_0x66e6c5['body']=_[_0xf2b4('0x55')](_0x66e6c5[_0xf2b4('0x4a')],['id',_0xf2b4('0x53'),'updatedAt']);return db[_0xf2b4('0x41')][_0xf2b4('0x49')](_[_0xf2b4('0x3c')](_0x25f757,_0x66e6c5['body']),{'include':_0x66e6c5[_0xf2b4('0x31')][_0xf2b4('0x3f')]?[{'all':!![]}]:undefined})['then'](function(_0x45b0eb){var _0xc5097e=_0x66e6c5[_0xf2b4('0x4b')][_0xf2b4('0x27')]({'plain':!![]});if(!_0xc5097e)throw new Error(_0xf2b4('0x4c'));if(_0xc5097e['role']===_0xf2b4('0x4b')){var _0x3a775d=_0x45b0eb[_0xf2b4('0x27')]({'plain':!![]});var _0x557717=_0xf2b4('0x4d');return db[_0xf2b4('0x4e')][_0xf2b4('0x48')]({'where':{'name':_0x557717,'userProfileId':_0xc5097e[_0xf2b4('0x4f')]},'raw':!![]})[_0xf2b4('0x25')](function(_0x196d78){if(_0x196d78&&_0x196d78[_0xf2b4('0x56')]===0x0){return db[_0xf2b4('0x50')][_0xf2b4('0x49')]({'name':_0x3a775d['name'],'resourceId':_0x3a775d['id'],'type':_0x196d78[_0xf2b4('0x2b')],'sectionId':_0x196d78['id']},{})[_0xf2b4('0x25')](function(){return _0x45b0eb;});}else{return _0x45b0eb;}})[_0xf2b4('0x43')](function(_0x20d1ee){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x20d1ee);throw _0x20d1ee;});}return _0x45b0eb;});}})[_0xf2b4('0x25')](respondWithResult(_0x2a6a20,0xc9))[_0xf2b4('0x43')](handleError(_0x2a6a20,null));};exports['update']=function(_0x4b98fc,_0x3fe745){if(_0x4b98fc[_0xf2b4('0x4a')]['id']){delete _0x4b98fc[_0xf2b4('0x4a')]['id'];}return db[_0xf2b4('0x41')][_0xf2b4('0x48')]({'where':{'id':_0x4b98fc[_0xf2b4('0x45')]['id']}})[_0xf2b4('0x25')](handleEntityNotFound(_0x3fe745,null))['then'](saveUpdates(_0x4b98fc['body'],null))[_0xf2b4('0x25')](respondWithResult(_0x3fe745,null))[_0xf2b4('0x43')](handleError(_0x3fe745,null));};exports[_0xf2b4('0x26')]=function(_0x5a142a,_0x3bf626){return db[_0xf2b4('0x41')]['find']({'where':{'id':_0x5a142a[_0xf2b4('0x45')]['id']}})[_0xf2b4('0x25')](handleEntityNotFound(_0x3bf626,null))[_0xf2b4('0x25')](removeEntity(_0x3bf626,null))[_0xf2b4('0x43')](handleError(_0x3bf626,null));};exports['getHoppers']=function(_0xab59d0,_0x454fd3,_0x2cda30){var _0x1f6537={'raw':!![],'where':{}};var _0x987c09={};var _0x3e7b56={'count':0x0,'rows':[]};return db['Campaign'][_0xf2b4('0x57')]({'where':{'id':_0xab59d0['params']['id']}})[_0xf2b4('0x25')](handleEntityNotFound(_0x454fd3,null))[_0xf2b4('0x25')](function(_0x42608c){if(_0x42608c){_0x987c09['model']=_[_0xf2b4('0x46')](db[_0xf2b4('0x58')][_0xf2b4('0x2d')]);_0x987c09[_0xf2b4('0x31')]=_[_0xf2b4('0x46')](_0xab59d0['query']);_0x987c09['filters']=_[_0xf2b4('0x33')](_0x987c09['model'],_0x987c09[_0xf2b4('0x31')]);_0x1f6537[_0xf2b4('0x34')]=_['intersection'](_0x987c09[_0xf2b4('0x30')],qs[_0xf2b4('0x47')](_0xab59d0[_0xf2b4('0x31')]['fields']));_0x1f6537[_0xf2b4('0x34')]=_0x1f6537['attributes'][_0xf2b4('0x35')]?_0x1f6537['attributes']:_0x987c09[_0xf2b4('0x30')];if(!_0xab59d0[_0xf2b4('0x31')]['hasOwnProperty'](_0xf2b4('0x59'))){_0x1f6537[_0xf2b4('0x1d')]=qs[_0xf2b4('0x1d')](_0xab59d0[_0xf2b4('0x31')][_0xf2b4('0x1d')]);_0x1f6537[_0xf2b4('0x1c')]=qs[_0xf2b4('0x1c')](_0xab59d0[_0xf2b4('0x31')][_0xf2b4('0x1c')]);}_0x1f6537[_0xf2b4('0x37')]=qs[_0xf2b4('0x38')](_0xab59d0['query'][_0xf2b4('0x38')]);_0x1f6537['where']=qs['filters'](_[_0xf2b4('0x3a')](_0xab59d0[_0xf2b4('0x31')],_0x987c09[_0xf2b4('0x32')]));_0x1f6537['where'][_0xf2b4('0x5a')]=_0x42608c['id'];if(_0xab59d0[_0xf2b4('0x31')][_0xf2b4('0x3b')]){_0x1f6537[_0xf2b4('0x39')]=_[_0xf2b4('0x3c')](_0x1f6537[_0xf2b4('0x39')],{'$or':_[_0xf2b4('0x5b')](_0x1f6537['attributes'],function(_0x172b4e){var _0x566383={};_0x566383[_0x172b4e]={'$like':'%'+_0xab59d0['query']['filter']+'%'};return _0x566383;})});}_0x1f6537=_[_0xf2b4('0x3c')]({},_0x1f6537,_0xab59d0[_0xf2b4('0x3e')]);return db[_0xf2b4('0x58')][_0xf2b4('0x1e')]({'where':_0x1f6537[_0xf2b4('0x39')]})[_0xf2b4('0x25')](function(_0x418e45){_0x3e7b56[_0xf2b4('0x1e')]=_0x418e45;if(_0xab59d0[_0xf2b4('0x31')][_0xf2b4('0x3f')]){_0x1f6537[_0xf2b4('0x40')]=[{'all':!![]}];}return db['CmHopper'][_0xf2b4('0x5c')](_0x1f6537);})[_0xf2b4('0x25')](function(_0x13d46c){_0x3e7b56['rows']=_0x13d46c;return _0x3e7b56;});}})[_0xf2b4('0x25')](respondWithFilteredResult(_0x454fd3,_0x1f6537))[_0xf2b4('0x43')](handleError(_0x454fd3,null));};exports['getHopperHistories']=function(_0x2fa166,_0xc167b9,_0x493a05){var _0x117ce0={'raw':!![],'where':{}};var _0x21b391={};var _0x5015dd={'count':0x0,'rows':[]};return db[_0xf2b4('0x41')]['findOne']({'where':{'id':_0x2fa166[_0xf2b4('0x45')]['id']}})[_0xf2b4('0x25')](handleEntityNotFound(_0xc167b9,null))[_0xf2b4('0x25')](function(_0x1e69b8){if(_0x1e69b8){_0x21b391['model']=_[_0xf2b4('0x46')](db['CmHopperHistory'][_0xf2b4('0x2d')]);_0x21b391[_0xf2b4('0x31')]=_[_0xf2b4('0x46')](_0x2fa166['query']);_0x21b391[_0xf2b4('0x32')]=_[_0xf2b4('0x33')](_0x21b391[_0xf2b4('0x30')],_0x21b391[_0xf2b4('0x31')]);_0x117ce0[_0xf2b4('0x34')]=_['intersection'](_0x21b391[_0xf2b4('0x30')],qs[_0xf2b4('0x47')](_0x2fa166[_0xf2b4('0x31')][_0xf2b4('0x47')]));_0x117ce0[_0xf2b4('0x34')]=_0x117ce0[_0xf2b4('0x34')][_0xf2b4('0x35')]?_0x117ce0[_0xf2b4('0x34')]:_0x21b391[_0xf2b4('0x30')];if(!_0x2fa166[_0xf2b4('0x31')][_0xf2b4('0x36')](_0xf2b4('0x59'))){_0x117ce0['limit']=qs[_0xf2b4('0x1d')](_0x2fa166[_0xf2b4('0x31')][_0xf2b4('0x1d')]);_0x117ce0[_0xf2b4('0x1c')]=qs[_0xf2b4('0x1c')](_0x2fa166[_0xf2b4('0x31')][_0xf2b4('0x1c')]);}_0x117ce0[_0xf2b4('0x37')]=qs[_0xf2b4('0x38')](_0x2fa166[_0xf2b4('0x31')]['sort']);_0x117ce0[_0xf2b4('0x39')]=qs[_0xf2b4('0x32')](_[_0xf2b4('0x3a')](_0x2fa166[_0xf2b4('0x31')],_0x21b391[_0xf2b4('0x32')]));_0x117ce0[_0xf2b4('0x39')][_0xf2b4('0x5a')]=_0x1e69b8['id'];if(_0x2fa166[_0xf2b4('0x31')]['filter']){_0x117ce0[_0xf2b4('0x39')]=_[_0xf2b4('0x3c')](_0x117ce0[_0xf2b4('0x39')],{'$or':_[_0xf2b4('0x5b')](_0x117ce0[_0xf2b4('0x34')],function(_0x373a7e){var _0x47a3dc={};_0x47a3dc[_0x373a7e]={'$like':'%'+_0x2fa166[_0xf2b4('0x31')][_0xf2b4('0x3b')]+'%'};return _0x47a3dc;})});}_0x117ce0=_[_0xf2b4('0x3c')]({},_0x117ce0,_0x2fa166[_0xf2b4('0x3e')]);return db[_0xf2b4('0x5d')][_0xf2b4('0x1e')]({'where':_0x117ce0[_0xf2b4('0x39')]})[_0xf2b4('0x25')](function(_0x1a4a27){_0x5015dd[_0xf2b4('0x1e')]=_0x1a4a27;if(_0x2fa166['query'][_0xf2b4('0x3f')]){_0x117ce0[_0xf2b4('0x40')]=[{'all':!![]}];}return db[_0xf2b4('0x5d')][_0xf2b4('0x5c')](_0x117ce0);})[_0xf2b4('0x25')](function(_0x5a36f8){_0x5015dd[_0xf2b4('0x42')]=_0x5a36f8;return _0x5015dd;});}})['then'](respondWithFilteredResult(_0xc167b9,_0x117ce0))[_0xf2b4('0x43')](handleError(_0xc167b9,null));};exports[_0xf2b4('0x5e')]=function(_0x32c50b,_0x679c2,_0x28c2cb){var _0x1c4f6f={'raw':!![],'where':{}};var _0x11e750={};var _0x44b487={'count':0x0,'rows':[]};return db['Campaign'][_0xf2b4('0x57')]({'where':{'id':_0x32c50b[_0xf2b4('0x45')]['id']}})[_0xf2b4('0x25')](handleEntityNotFound(_0x679c2,null))[_0xf2b4('0x25')](function(_0x2815e9){if(_0x2815e9){_0x11e750[_0xf2b4('0x30')]=_[_0xf2b4('0x46')](db[_0xf2b4('0x5f')][_0xf2b4('0x2d')]);_0x11e750[_0xf2b4('0x31')]=_[_0xf2b4('0x46')](_0x32c50b[_0xf2b4('0x31')]);_0x11e750[_0xf2b4('0x32')]=_[_0xf2b4('0x33')](_0x11e750[_0xf2b4('0x30')],_0x11e750['query']);_0x1c4f6f['attributes']=_[_0xf2b4('0x33')](_0x11e750[_0xf2b4('0x30')],qs[_0xf2b4('0x47')](_0x32c50b[_0xf2b4('0x31')]['fields']));_0x1c4f6f[_0xf2b4('0x34')]=_0x1c4f6f[_0xf2b4('0x34')][_0xf2b4('0x35')]?_0x1c4f6f[_0xf2b4('0x34')]:_0x11e750[_0xf2b4('0x30')];if(!_0x32c50b[_0xf2b4('0x31')][_0xf2b4('0x36')](_0xf2b4('0x59'))){_0x1c4f6f[_0xf2b4('0x1d')]=qs[_0xf2b4('0x1d')](_0x32c50b['query'][_0xf2b4('0x1d')]);_0x1c4f6f[_0xf2b4('0x1c')]=qs['offset'](_0x32c50b[_0xf2b4('0x31')][_0xf2b4('0x1c')]);}_0x1c4f6f[_0xf2b4('0x37')]=qs[_0xf2b4('0x38')](_0x32c50b[_0xf2b4('0x31')][_0xf2b4('0x38')]);_0x1c4f6f['where']=qs[_0xf2b4('0x32')](_[_0xf2b4('0x3a')](_0x32c50b[_0xf2b4('0x31')],_0x11e750[_0xf2b4('0x32')]));_0x1c4f6f['where'][_0xf2b4('0x5a')]=_0x2815e9['id'];if(_0x32c50b[_0xf2b4('0x31')][_0xf2b4('0x3b')]){_0x1c4f6f[_0xf2b4('0x39')]=_[_0xf2b4('0x3c')](_0x1c4f6f['where'],{'$or':_[_0xf2b4('0x5b')](_0x1c4f6f['attributes'],function(_0x49a76b){var _0x1b664f={};_0x1b664f[_0x49a76b]={'$like':'%'+_0x32c50b[_0xf2b4('0x31')][_0xf2b4('0x3b')]+'%'};return _0x1b664f;})});}_0x1c4f6f=_[_0xf2b4('0x3c')]({},_0x1c4f6f,_0x32c50b[_0xf2b4('0x3e')]);return db['CmHopperFinal'][_0xf2b4('0x1e')]({'where':_0x1c4f6f['where']})[_0xf2b4('0x25')](function(_0x5f3123){_0x44b487[_0xf2b4('0x1e')]=_0x5f3123;if(_0x32c50b['query'][_0xf2b4('0x3f')]){_0x1c4f6f['include']=[{'all':!![]}];}return db[_0xf2b4('0x5f')][_0xf2b4('0x5c')](_0x1c4f6f);})['then'](function(_0x398637){_0x44b487[_0xf2b4('0x42')]=_0x398637;return _0x44b487;});}})[_0xf2b4('0x25')](respondWithFilteredResult(_0x679c2,_0x1c4f6f))[_0xf2b4('0x43')](handleError(_0x679c2,null));};exports[_0xf2b4('0x60')]=function(_0x37c075,_0x2a626c,_0x48beb){var _0x224ede={'raw':!![],'where':{}};var _0x44940a={};var _0x449012={'count':0x0,'rows':[]};return db[_0xf2b4('0x41')][_0xf2b4('0x57')]({'where':{'id':_0x37c075['params']['id']}})['then'](handleEntityNotFound(_0x2a626c,null))[_0xf2b4('0x25')](function(_0x1ba6c5){if(_0x1ba6c5){_0x44940a[_0xf2b4('0x30')]=_['keys'](db[_0xf2b4('0x61')]['rawAttributes']);_0x44940a['query']=_[_0xf2b4('0x46')](_0x37c075[_0xf2b4('0x31')]);_0x44940a[_0xf2b4('0x32')]=_[_0xf2b4('0x33')](_0x44940a[_0xf2b4('0x30')],_0x44940a['query']);_0x224ede['attributes']=_[_0xf2b4('0x33')](_0x44940a[_0xf2b4('0x30')],qs['fields'](_0x37c075[_0xf2b4('0x31')][_0xf2b4('0x47')]));_0x224ede[_0xf2b4('0x34')]=_0x224ede['attributes']['length']?_0x224ede['attributes']:_0x44940a[_0xf2b4('0x30')];if(!_0x37c075[_0xf2b4('0x31')][_0xf2b4('0x36')](_0xf2b4('0x59'))){_0x224ede[_0xf2b4('0x1d')]=qs[_0xf2b4('0x1d')](_0x37c075[_0xf2b4('0x31')][_0xf2b4('0x1d')]);_0x224ede['offset']=qs['offset'](_0x37c075[_0xf2b4('0x31')][_0xf2b4('0x1c')]);}_0x224ede[_0xf2b4('0x37')]=qs[_0xf2b4('0x38')](_0x37c075[_0xf2b4('0x31')][_0xf2b4('0x38')]);_0x224ede[_0xf2b4('0x39')]=qs[_0xf2b4('0x32')](_['pick'](_0x37c075[_0xf2b4('0x31')],_0x44940a[_0xf2b4('0x32')]));_0x224ede[_0xf2b4('0x39')]['CampaignId']=_0x1ba6c5['id'];if(_0x37c075[_0xf2b4('0x31')][_0xf2b4('0x3b')]){_0x224ede['where']=_['merge'](_0x224ede[_0xf2b4('0x39')],{'$or':_[_0xf2b4('0x5b')](_0x224ede[_0xf2b4('0x34')],function(_0x207cfd){var _0x441e55={};_0x441e55[_0x207cfd]={'$like':'%'+_0x37c075[_0xf2b4('0x31')][_0xf2b4('0x3b')]+'%'};return _0x441e55;})});}_0x224ede=_[_0xf2b4('0x3c')]({},_0x224ede,_0x37c075['options']);return db[_0xf2b4('0x61')]['count']({'where':_0x224ede['where']})[_0xf2b4('0x25')](function(_0x1d68cc){_0x449012[_0xf2b4('0x1e')]=_0x1d68cc;if(_0x37c075[_0xf2b4('0x31')][_0xf2b4('0x3f')]){_0x224ede[_0xf2b4('0x40')]=[{'all':!![]}];}return db[_0xf2b4('0x61')][_0xf2b4('0x5c')](_0x224ede);})['then'](function(_0x3c37cc){_0x449012['rows']=_0x3c37cc;return _0x449012;});}})[_0xf2b4('0x25')](respondWithFilteredResult(_0x2a626c,_0x224ede))[_0xf2b4('0x43')](handleError(_0x2a626c,null));};exports[_0xf2b4('0x62')]=function(_0x252e01,_0x1178bd,_0x2339cf){var _0x140ae8={};var _0x1efa44={};var _0x281529;var _0x125bcd;return db[_0xf2b4('0x41')][_0xf2b4('0x57')]({'where':{'id':_0x252e01['params']['id']}})[_0xf2b4('0x25')](handleEntityNotFound(_0x1178bd,null))[_0xf2b4('0x25')](function(_0x51a749){if(_0x51a749){_0x281529=_0x51a749;_0x1efa44[_0xf2b4('0x30')]=_[_0xf2b4('0x46')](db[_0xf2b4('0x63')][_0xf2b4('0x2d')]);_0x1efa44[_0xf2b4('0x31')]=_[_0xf2b4('0x46')](_0x252e01['query']);_0x1efa44[_0xf2b4('0x32')]=_[_0xf2b4('0x33')](_0x1efa44['model'],_0x1efa44['query']);_0x140ae8[_0xf2b4('0x34')]=_[_0xf2b4('0x33')](_0x1efa44[_0xf2b4('0x30')],qs[_0xf2b4('0x47')](_0x252e01['query'][_0xf2b4('0x47')]));_0x140ae8[_0xf2b4('0x34')]=_0x140ae8[_0xf2b4('0x34')]['length']?_0x140ae8[_0xf2b4('0x34')]:_0x1efa44['model'];_0x140ae8['order']=qs[_0xf2b4('0x38')](_0x252e01['query'][_0xf2b4('0x38')]);_0x140ae8[_0xf2b4('0x39')]=qs['filters'](_[_0xf2b4('0x3a')](_0x252e01['query'],_0x1efa44['filters']));if(_0x252e01[_0xf2b4('0x31')][_0xf2b4('0x3b')]){_0x140ae8[_0xf2b4('0x39')]=_[_0xf2b4('0x3c')](_0x140ae8['where'],{'$or':_['map'](_0x140ae8[_0xf2b4('0x34')],function(_0x551dc4){var _0x14ad45={};_0x14ad45[_0x551dc4]={'$like':'%'+_0x252e01[_0xf2b4('0x31')][_0xf2b4('0x3b')]+'%'};return _0x14ad45;})});}_0x140ae8=_[_0xf2b4('0x3c')]({},_0x140ae8,_0x252e01['options']);return _0x281529[_0xf2b4('0x62')](_0x140ae8);}})[_0xf2b4('0x25')](function(_0x54cb60){if(_0x54cb60){_0x125bcd=_0x54cb60[_0xf2b4('0x35')];if(!_0x252e01[_0xf2b4('0x31')][_0xf2b4('0x36')]('nolimit')){_0x140ae8[_0xf2b4('0x1d')]=qs[_0xf2b4('0x1d')](_0x252e01[_0xf2b4('0x31')][_0xf2b4('0x1d')]);_0x140ae8['offset']=qs[_0xf2b4('0x1c')](_0x252e01['query'][_0xf2b4('0x1c')]);}return _0x281529[_0xf2b4('0x62')](_0x140ae8);}})[_0xf2b4('0x25')](function(_0x31db50){if(_0x31db50){return _0x31db50?{'count':_0x125bcd,'rows':_0x31db50}:null;}})[_0xf2b4('0x25')](respondWithResult(_0x1178bd,null))[_0xf2b4('0x43')](handleError(_0x1178bd,null));};exports['addLists']=function(_0x48de2f,_0x47a142,_0x1c2f77){var _0x159123,_0x4365a2;var _0x15d123=[];var _0x3f1ce4=moment()[_0xf2b4('0x64')](_0xf2b4('0x65'));return db[_0xf2b4('0x41')]['find']({'where':{'id':_0x48de2f[_0xf2b4('0x45')]['id']}})['then'](handleEntityNotFound(_0x47a142,null))[_0xf2b4('0x25')](function(_0x2c8f2f){if(_0x2c8f2f){_0x4365a2=_0x2c8f2f;return _0x2c8f2f['addLists'](_0x48de2f['body']['ids'],_[_0xf2b4('0x55')](_0x48de2f[_0xf2b4('0x4a')],[_0xf2b4('0x66'),'id'])||{});}return null;})['spread'](function(_0x202b4c){var _0x2e590e;var _0x4b3bf0;_0x159123=_0x202b4c||[];var _0x460a75=[];if(_0x202b4c){for(var _0x10cf95=0x0;_0x10cf95<_0x202b4c['length'];_0x10cf95+=0x1){var _0x444a6f=_0x202b4c[_0x10cf95][_0xf2b4('0x27')]({'plain':!![]});_0x4365a2['dialCheckDuplicateType']=_0x48de2f[_0xf2b4('0x4a')][_0xf2b4('0x67')]?_0x48de2f[_0xf2b4('0x4a')][_0xf2b4('0x67')]:_0x4365a2['dialCheckDuplicateType'];switch(_0x4365a2[_0xf2b4('0x67')]){case _0xf2b4('0x68'):_0x2e590e=squel['insert']()['into'](_0xf2b4('0x69'))[_0xf2b4('0x6a')](['phone',_0xf2b4('0x6b'),_0xf2b4('0x6c'),'ListId',_0xf2b4('0x5a'),_0xf2b4('0x53'),_0xf2b4('0x54')],squel['select']()[_0xf2b4('0x6d')](_0xf2b4('0x6e'),_0xf2b4('0x6e'))['field'](_0xf2b4('0x6f'),_0xf2b4('0x6b'))[_0xf2b4('0x6d')]('id','ContactId')['field'](_0x444a6f[_0xf2b4('0x70')]['toString'](),'ListId')[_0xf2b4('0x6d')](_0x48de2f['params']['id'][_0xf2b4('0x71')](),'CampaignId')['field']('\x27'+_0x3f1ce4+'\x27',_0xf2b4('0x53'))[_0xf2b4('0x6d')]('\x27'+_0x3f1ce4+'\x27',_0xf2b4('0x54'))['from'](_0xf2b4('0x72'))[_0xf2b4('0x39')]('deletedAt\x20IS\x20NULL')[_0xf2b4('0x39')](_0xf2b4('0x73'),_0x444a6f[_0xf2b4('0x70')]['toString']())[_0xf2b4('0x39')](_0xf2b4('0x74'))[_0xf2b4('0x39')](_0xf2b4('0x75'),squel['select']()[_0xf2b4('0x6d')](_0xf2b4('0x76'))[_0xf2b4('0x77')]('cm_hopper_final')[_0xf2b4('0x39')](_0xf2b4('0x78'),_0x48de2f[_0xf2b4('0x45')]['id']['toString']()))[_0xf2b4('0x39')](_0xf2b4('0x75'),squel[_0xf2b4('0x79')]()[_0xf2b4('0x6d')](_0xf2b4('0x7a'))[_0xf2b4('0x77')](_0xf2b4('0x69'))[_0xf2b4('0x39')](_0xf2b4('0x78'),_0x48de2f[_0xf2b4('0x45')]['id'][_0xf2b4('0x71')]())))['toString']();break;case _0xf2b4('0x7b'):_0x2e590e=squel[_0xf2b4('0x7c')]()[_0xf2b4('0x7d')](_0xf2b4('0x69'))[_0xf2b4('0x6a')](['phone',_0xf2b4('0x6b'),_0xf2b4('0x6c'),'ListId','CampaignId','createdAt',_0xf2b4('0x54')],squel['select']()[_0xf2b4('0x6d')](_0xf2b4('0x6e'),_0xf2b4('0x6e'))['field'](_0xf2b4('0x6f'),'scheduledAt')[_0xf2b4('0x6d')]('id','ContactId')[_0xf2b4('0x6d')](_0x444a6f[_0xf2b4('0x70')]['toString'](),'ListId')[_0xf2b4('0x6d')](_0x48de2f[_0xf2b4('0x45')]['id'][_0xf2b4('0x71')](),'CampaignId')[_0xf2b4('0x6d')]('\x27'+_0x3f1ce4+'\x27',_0xf2b4('0x53'))[_0xf2b4('0x6d')]('\x27'+_0x3f1ce4+'\x27',_0xf2b4('0x54'))[_0xf2b4('0x77')](_0xf2b4('0x72'))[_0xf2b4('0x39')](_0xf2b4('0x7e'))[_0xf2b4('0x39')]('ListId\x20=\x20?',_0x444a6f['CmListId'][_0xf2b4('0x71')]())[_0xf2b4('0x39')](_0xf2b4('0x74'))[_0xf2b4('0x39')]('phone\x20NOT\x20IN\x20(?)',squel[_0xf2b4('0x79')]()[_0xf2b4('0x6d')](_0xf2b4('0x7a'))['from'](_0xf2b4('0x69'))[_0xf2b4('0x39')](_0xf2b4('0x78'),_0x48de2f[_0xf2b4('0x45')]['id'][_0xf2b4('0x71')]())))[_0xf2b4('0x71')]();break;default:_0x2e590e=squel[_0xf2b4('0x7c')]()['into'](_0xf2b4('0x69'))[_0xf2b4('0x6a')]([_0xf2b4('0x6e'),'scheduledAt','ContactId',_0xf2b4('0x7f'),'CampaignId','createdAt',_0xf2b4('0x54')],squel[_0xf2b4('0x79')]()[_0xf2b4('0x6d')](_0xf2b4('0x6e'),_0xf2b4('0x6e'))[_0xf2b4('0x6d')](_0xf2b4('0x6f'),'scheduledAt')[_0xf2b4('0x6d')]('id',_0xf2b4('0x6c'))[_0xf2b4('0x6d')](_0x444a6f['CmListId'][_0xf2b4('0x71')](),_0xf2b4('0x7f'))[_0xf2b4('0x6d')](_0x48de2f[_0xf2b4('0x45')]['id']['toString'](),_0xf2b4('0x5a'))['field']('\x27'+_0x3f1ce4+'\x27',_0xf2b4('0x53'))[_0xf2b4('0x6d')]('\x27'+_0x3f1ce4+'\x27',_0xf2b4('0x54'))['from']('cm_contacts')[_0xf2b4('0x39')](_0xf2b4('0x7e'))[_0xf2b4('0x39')]('ListId\x20=\x20?',_0x444a6f[_0xf2b4('0x70')][_0xf2b4('0x71')]())[_0xf2b4('0x39')]('phone\x20IS\x20NOT\x20NULL'))[_0xf2b4('0x71')]();}_0x4b3bf0=squel['insert']()[_0xf2b4('0x7d')]('cm_hopper_additional_phones')[_0xf2b4('0x6a')]([_0xf2b4('0x80'),_0xf2b4('0x6b'),'phone','OrderBy',_0xf2b4('0x53'),_0xf2b4('0x54')],squel[_0xf2b4('0x79')]()[_0xf2b4('0x6d')](_0xf2b4('0x81'),'id')[_0xf2b4('0x6d')]('NOW()',_0xf2b4('0x6b'))[_0xf2b4('0x6d')](_0xf2b4('0x82'),_0xf2b4('0x6e'))[_0xf2b4('0x6d')](_0xf2b4('0x83'),'OrderBy')['field']('\x27'+_0x3f1ce4+'\x27','createdAt')[_0xf2b4('0x6d')]('\x27'+_0x3f1ce4+'\x27','updatedAt')[_0xf2b4('0x77')]('cm_contact_has_items','ci')[_0xf2b4('0x84')](_0xf2b4('0x69'),'h',_0xf2b4('0x85'))['where'](_0xf2b4('0x86'),_0x444a6f['CmListId']['toString']())[_0xf2b4('0x39')](_0xf2b4('0x87'),_0x48de2f[_0xf2b4('0x45')]['id']['toString']())[_0xf2b4('0x39')]('h.createdAt\x20=\x20?',_0x3f1ce4))[_0xf2b4('0x71')]();_0x460a75[_0xf2b4('0x88')](db[_0xf2b4('0x89')][_0xf2b4('0x31')](_0x2e590e));_0x15d123[_0xf2b4('0x88')](db['sequelize'][_0xf2b4('0x31')](_0x4b3bf0));}return BPromise['all'](_0x460a75);}})[_0xf2b4('0x25')](function(){return BPromise['all'](_0x15d123);})[_0xf2b4('0x25')](function(){return _0x159123;})[_0xf2b4('0x25')](respondWithResult(_0x47a142,null))[_0xf2b4('0x43')](handleError(_0x47a142,null));};exports[_0xf2b4('0x8a')]=function(_0x574db1,_0x487f23,_0x34449a){return db[_0xf2b4('0x41')]['find']({'where':{'id':_0x574db1[_0xf2b4('0x45')]['id']}})[_0xf2b4('0x25')](handleEntityNotFound(_0x487f23,null))['then'](function(_0x167221){if(_0x167221){return _0x167221[_0xf2b4('0x8a')](_0x574db1[_0xf2b4('0x31')][_0xf2b4('0x66')]);}})['then'](function(_0x2aef41){if(_0x2aef41){return db[_0xf2b4('0x58')][_0xf2b4('0x26')]({'where':{'ListId':_0x574db1[_0xf2b4('0x31')]['ids'],'CampaignId':_0x574db1[_0xf2b4('0x45')]['id']}})['then'](function(){return _0x2aef41;});}})[_0xf2b4('0x25')](respondWithStatusCode(_0x487f23,null))['catch'](handleError(_0x487f23,null));};exports[_0xf2b4('0x8b')]=function(_0x55ae10,_0x215137,_0x23e0ef){var _0xa692cc={};var _0x2a2e07={};var _0xb33fe5;var _0x4e5585;return db[_0xf2b4('0x41')]['findOne']({'where':{'id':_0x55ae10['params']['id']}})[_0xf2b4('0x25')](handleEntityNotFound(_0x215137,null))[_0xf2b4('0x25')](function(_0x5f4fcb){if(_0x5f4fcb){_0xb33fe5=_0x5f4fcb;_0x2a2e07[_0xf2b4('0x30')]=_['keys'](db[_0xf2b4('0x63')][_0xf2b4('0x2d')]);_0x2a2e07[_0xf2b4('0x31')]=_[_0xf2b4('0x46')](_0x55ae10['query']);_0x2a2e07[_0xf2b4('0x32')]=_['intersection'](_0x2a2e07['model'],_0x2a2e07[_0xf2b4('0x31')]);_0xa692cc[_0xf2b4('0x34')]=_[_0xf2b4('0x33')](_0x2a2e07[_0xf2b4('0x30')],qs[_0xf2b4('0x47')](_0x55ae10[_0xf2b4('0x31')][_0xf2b4('0x47')]));_0xa692cc['attributes']=_0xa692cc[_0xf2b4('0x34')][_0xf2b4('0x35')]?_0xa692cc[_0xf2b4('0x34')]:_0x2a2e07[_0xf2b4('0x30')];_0xa692cc['order']=qs[_0xf2b4('0x38')](_0x55ae10[_0xf2b4('0x31')][_0xf2b4('0x38')]);_0xa692cc[_0xf2b4('0x39')]=qs['filters'](_['pick'](_0x55ae10[_0xf2b4('0x31')],_0x2a2e07[_0xf2b4('0x32')]));if(_0x55ae10['query'][_0xf2b4('0x3b')]){_0xa692cc['where']=_[_0xf2b4('0x3c')](_0xa692cc[_0xf2b4('0x39')],{'$or':_[_0xf2b4('0x5b')](_0xa692cc['attributes'],function(_0x113073){var _0x227d33={};_0x227d33[_0x113073]={'$like':'%'+_0x55ae10[_0xf2b4('0x31')][_0xf2b4('0x3b')]+'%'};return _0x227d33;})});}_0xa692cc=_[_0xf2b4('0x3c')]({},_0xa692cc,_0x55ae10[_0xf2b4('0x3e')]);return _0xb33fe5[_0xf2b4('0x8b')](_0xa692cc);}})[_0xf2b4('0x25')](function(_0x45a61f){if(_0x45a61f){_0x4e5585=_0x45a61f['length'];if(!_0x55ae10[_0xf2b4('0x31')][_0xf2b4('0x36')]('nolimit')){_0xa692cc[_0xf2b4('0x1d')]=qs['limit'](_0x55ae10[_0xf2b4('0x31')][_0xf2b4('0x1d')]);_0xa692cc[_0xf2b4('0x1c')]=qs[_0xf2b4('0x1c')](_0x55ae10[_0xf2b4('0x31')][_0xf2b4('0x1c')]);}return _0xb33fe5[_0xf2b4('0x8b')](_0xa692cc);}})['then'](function(_0x486141){if(_0x486141){return _0x486141?{'count':_0x4e5585,'rows':_0x486141}:null;}})[_0xf2b4('0x25')](respondWithResult(_0x215137,null))[_0xf2b4('0x43')](handleError(_0x215137,null));};exports[_0xf2b4('0x8c')]=function(_0x47e8a3,_0x1de253,_0x47a1b5){var _0x5413cb,_0x4eee8c;var _0x1579a0=[];var _0x1a7723=moment()[_0xf2b4('0x64')]('YYYY-MM-DD\x20HH:mm:ss');return db[_0xf2b4('0x41')][_0xf2b4('0x48')]({'where':{'id':_0x47e8a3[_0xf2b4('0x45')]['id']}})['then'](handleEntityNotFound(_0x1de253,null))[_0xf2b4('0x25')](function(_0x3c312b){if(_0x3c312b){_0x4eee8c=_0x3c312b;return _0x3c312b['addBlackLists'](_0x47e8a3[_0xf2b4('0x4a')][_0xf2b4('0x66')],_['omit'](_0x47e8a3[_0xf2b4('0x4a')],[_0xf2b4('0x66'),'id'])||{});}return null;})[_0xf2b4('0x8d')](function(_0x393b24){var _0x25f4c8;var _0x5a9c87;_0x5413cb=_0x393b24||[];var _0x1183bb=[];if(_0x393b24){for(var _0x2b003a=0x0;_0x2b003a<_0x393b24[_0xf2b4('0x35')];_0x2b003a+=0x1){var _0x6f48a7=_0x393b24[_0x2b003a][_0xf2b4('0x27')]({'plain':!![]});_0x25f4c8=squel[_0xf2b4('0x7c')]()[_0xf2b4('0x7d')](_0xf2b4('0x8e'))[_0xf2b4('0x6a')]([_0xf2b4('0x6e'),_0xf2b4('0x6c'),'ListId','CampaignId',_0xf2b4('0x53'),'updatedAt'],squel['select']()['field'](_0xf2b4('0x6e'),_0xf2b4('0x6e'))[_0xf2b4('0x6d')]('id',_0xf2b4('0x6c'))[_0xf2b4('0x6d')](_0x6f48a7[_0xf2b4('0x70')][_0xf2b4('0x71')](),'ListId')['field'](_0x47e8a3[_0xf2b4('0x45')]['id'][_0xf2b4('0x71')](),'CampaignId')[_0xf2b4('0x6d')](_0xf2b4('0x6f'),_0xf2b4('0x53'))[_0xf2b4('0x6d')](_0xf2b4('0x6f'),_0xf2b4('0x54'))[_0xf2b4('0x77')]('cm_contacts')['where'](_0xf2b4('0x7e'))['where'](_0xf2b4('0x73'),_0x6f48a7[_0xf2b4('0x70')][_0xf2b4('0x71')]())[_0xf2b4('0x39')](_0xf2b4('0x74')))['toString']();_0x1183bb[_0xf2b4('0x88')](db[_0xf2b4('0x89')][_0xf2b4('0x31')](_0x25f4c8));}return BPromise['all'](_0x1183bb);}})[_0xf2b4('0x25')](function(){return _0x5413cb;})['then'](respondWithResult(_0x1de253,null))['catch'](handleError(_0x1de253,null));};exports[_0xf2b4('0x8f')]=function(_0x3b6bea,_0x169bf8,_0x436f69){return db[_0xf2b4('0x41')]['find']({'where':{'id':_0x3b6bea[_0xf2b4('0x45')]['id']}})[_0xf2b4('0x25')](handleEntityNotFound(_0x169bf8,null))[_0xf2b4('0x25')](function(_0x4e3d7e){if(_0x4e3d7e){return _0x4e3d7e[_0xf2b4('0x8f')](_0x3b6bea[_0xf2b4('0x31')][_0xf2b4('0x66')]);}})[_0xf2b4('0x25')](function(_0x1b12f4){if(_0x1b12f4){return db['CmHopperBlack'][_0xf2b4('0x26')]({'where':{'ListId':_0x3b6bea[_0xf2b4('0x31')][_0xf2b4('0x66')],'CampaignId':_0x3b6bea[_0xf2b4('0x45')]['id']}})['then'](function(){return _0x1b12f4;});}})[_0xf2b4('0x25')](respondWithStatusCode(_0x169bf8,null))[_0xf2b4('0x43')](handleError(_0x169bf8,null));}; \ No newline at end of file diff --git a/server/api/campaign/campaign.model.js b/server/api/campaign/campaign.model.js index a563a67..603eb46 100644 --- a/server/api/campaign/campaign.model.js +++ b/server/api/campaign/campaign.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x197fe4,_0x31e2bc){var _0x4e68a1=function(_0xae0b9e){while(--_0xae0b9e){_0x197fe4['push'](_0x197fe4['shift']());}};_0x4e68a1(++_0x31e2bc);}(_0x7a54,0x106));var _0x47a5=function(_0x48ad2c,_0x478aa2){_0x48ad2c=_0x48ad2c-0x0;var _0x3f17d2=_0x7a54[_0x48ad2c];return _0x3f17d2;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7a54=['../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./campaign.attributes','exports','Campaign','campaigns','lodash','util'];(function(_0x539ce1,_0x4a65eb){var _0x20be8e=function(_0x45efa4){while(--_0x45efa4){_0x539ce1['push'](_0x539ce1['shift']());}};_0x20be8e(++_0x4a65eb);}(_0x7a54,0x106));var _0x47a5=function(_0x37bd0f,_0x16e0e5){_0x37bd0f=_0x37bd0f-0x0;var _0x28a4b8=_0x7a54[_0x37bd0f];return _0x28a4b8;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/campaign/campaign.rpc.js b/server/api/campaign/campaign.rpc.js index 710862b..87c33e8 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 _0xb201=['Campaign,\x20%s,\x20%s','message','result','GetCampaign','Campaign','findAll','options','raw','map','include','model','attributes','debug','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','then','info','request\x20sent','Campaign,\x20%s,\x20%s,\x20%s','error','code'];(function(_0xc23311,_0x4b4373){var _0xfb9532=function(_0x25f56b){while(--_0x25f56b){_0xc23311['push'](_0xc23311['shift']());}};_0xfb9532(++_0x4b4373);}(_0xb201,0x1b1));var _0x1b20=function(_0x14ee16,_0x5443e9){_0x14ee16=_0x14ee16-0x0;var _0x5296a0=_0xb201[_0x14ee16];return _0x5296a0;};'use strict';var _=require(_0x1b20('0x0'));var util=require('util');var moment=require(_0x1b20('0x1'));var BPromise=require(_0x1b20('0x2'));var rs=require(_0x1b20('0x3'));var fs=require('fs');var Redis=require(_0x1b20('0x4'));var db=require(_0x1b20('0x5'))['db'];var utils=require(_0x1b20('0x6'));var logger=require('../../config/logger')(_0x1b20('0x7'));var config=require(_0x1b20('0x8'));var jayson=require(_0x1b20('0x9'));var client=jayson['client'][_0x1b20('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x50cdbc,_0x34304b,_0x2a184f){return new BPromise(function(_0x3cc600,_0x426ae9){return client['request'](_0x50cdbc,_0x2a184f)[_0x1b20('0xb')](function(_0x1f5ae4){logger[_0x1b20('0xc')]('Campaign,\x20%s,\x20%s',_0x34304b,_0x1b20('0xd'));logger['debug'](_0x1b20('0xe'),_0x34304b,'request\x20sent',JSON['stringify'](_0x1f5ae4));if(_0x1f5ae4[_0x1b20('0xf')]){if(_0x1f5ae4[_0x1b20('0xf')][_0x1b20('0x10')]===0x1f4){logger[_0x1b20('0xf')](_0x1b20('0x11'),_0x34304b,_0x1f5ae4['error'][_0x1b20('0x12')]);return _0x426ae9(_0x1f5ae4[_0x1b20('0xf')][_0x1b20('0x12')]);}logger[_0x1b20('0xf')](_0x1b20('0x11'),_0x34304b,_0x1f5ae4['error'][_0x1b20('0x12')]);return _0x3cc600(_0x1f5ae4[_0x1b20('0xf')][_0x1b20('0x12')]);}else{logger['info'](_0x1b20('0x11'),_0x34304b,'request\x20sent');_0x3cc600(_0x1f5ae4[_0x1b20('0x13')][_0x1b20('0x12')]);}})['catch'](function(_0x44e713){logger[_0x1b20('0xf')](_0x1b20('0x11'),_0x34304b,_0x44e713);_0x426ae9(_0x44e713);});});}exports[_0x1b20('0x14')]=function(_0xff7c72){var _0xf9078e=this;return new Promise(function(_0x34517f,_0x46bb09){return db[_0x1b20('0x15')][_0x1b20('0x16')]({'raw':_0xff7c72[_0x1b20('0x17')]?_0xff7c72[_0x1b20('0x17')][_0x1b20('0x18')]===undefined?!![]:![]:!![],'where':_0xff7c72[_0x1b20('0x17')]?_0xff7c72[_0x1b20('0x17')]['where']||null:null,'attributes':_0xff7c72[_0x1b20('0x17')]?_0xff7c72['options']['attributes']||null:null,'limit':_0xff7c72['options']?_0xff7c72[_0x1b20('0x17')]['limit']||null:null,'include':_0xff7c72['options']?_0xff7c72[_0x1b20('0x17')]['include']?_[_0x1b20('0x19')](_0xff7c72['options'][_0x1b20('0x1a')],function(_0x33e6ae){return{'model':db[_0x33e6ae[_0x1b20('0x1b')]],'as':_0x33e6ae['as'],'attributes':_0x33e6ae[_0x1b20('0x1c')],'include':_0x33e6ae[_0x1b20('0x1a')]?_[_0x1b20('0x19')](_0x33e6ae['include'],function(_0x590b44){return{'model':db[_0x590b44[_0x1b20('0x1b')]],'as':_0x590b44['as'],'attributes':_0x590b44[_0x1b20('0x1c')],'include':_0x590b44[_0x1b20('0x1a')]?_[_0x1b20('0x19')](_0x590b44[_0x1b20('0x1a')],function(_0x3a5cda){return{'model':db[_0x3a5cda[_0x1b20('0x1b')]],'as':_0x3a5cda['as'],'attributes':_0x3a5cda[_0x1b20('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x1b20('0xb')](function(_0xefa7f3){logger['info']('GetCampaign',_0xff7c72);logger[_0x1b20('0x1d')]('GetCampaign',_0xff7c72,JSON['stringify'](_0xefa7f3));_0x34517f(_0xefa7f3);})['catch'](function(_0x342a84){logger[_0x1b20('0xf')](_0x1b20('0x14'),_0x342a84[_0x1b20('0x12')],_0xff7c72);_0x46bb09(_0xf9078e[_0x1b20('0xf')](0x1f4,_0x342a84[_0x1b20('0x12')]));});});}; \ No newline at end of file +var _0x758e=['debug','error','code','message','catch','GetCampaign','options','raw','attributes','include','map','model','then','info','stringify','lodash','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','Campaign,\x20%s,\x20%s','request\x20sent'];(function(_0x2744c5,_0x3caacd){var _0x4d044b=function(_0x2e2f0c){while(--_0x2e2f0c){_0x2744c5['push'](_0x2744c5['shift']());}};_0x4d044b(++_0x3caacd);}(_0x758e,0x1af));var _0xe758=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x758e[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xe758('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xe758('0x1'));var rs=require(_0xe758('0x2'));var fs=require('fs');var Redis=require(_0xe758('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xe758('0x4'))(_0xe758('0x5'));var config=require(_0xe758('0x6'));var jayson=require(_0xe758('0x7'));var client=jayson['client'][_0xe758('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x21e792,_0x46eec3,_0x5357cf){return new BPromise(function(_0x4c03ba,_0x454ee0){return client['request'](_0x21e792,_0x5357cf)['then'](function(_0x4c16c3){logger['info'](_0xe758('0x9'),_0x46eec3,_0xe758('0xa'));logger[_0xe758('0xb')]('Campaign,\x20%s,\x20%s,\x20%s',_0x46eec3,_0xe758('0xa'),JSON['stringify'](_0x4c16c3));if(_0x4c16c3[_0xe758('0xc')]){if(_0x4c16c3[_0xe758('0xc')][_0xe758('0xd')]===0x1f4){logger['error'](_0xe758('0x9'),_0x46eec3,_0x4c16c3['error'][_0xe758('0xe')]);return _0x454ee0(_0x4c16c3[_0xe758('0xc')][_0xe758('0xe')]);}logger[_0xe758('0xc')](_0xe758('0x9'),_0x46eec3,_0x4c16c3[_0xe758('0xc')][_0xe758('0xe')]);return _0x4c03ba(_0x4c16c3[_0xe758('0xc')][_0xe758('0xe')]);}else{logger['info'](_0xe758('0x9'),_0x46eec3,'request\x20sent');_0x4c03ba(_0x4c16c3['result'][_0xe758('0xe')]);}})[_0xe758('0xf')](function(_0x540eb6){logger['error'](_0xe758('0x9'),_0x46eec3,_0x540eb6);_0x454ee0(_0x540eb6);});});}exports[_0xe758('0x10')]=function(_0x38c30c){var _0xfdf5b0=this;return new Promise(function(_0x3fe7e8,_0x3ee871){return db['Campaign']['findAll']({'raw':_0x38c30c[_0xe758('0x11')]?_0x38c30c[_0xe758('0x11')][_0xe758('0x12')]===undefined?!![]:![]:!![],'where':_0x38c30c[_0xe758('0x11')]?_0x38c30c[_0xe758('0x11')]['where']||null:null,'attributes':_0x38c30c['options']?_0x38c30c[_0xe758('0x11')][_0xe758('0x13')]||null:null,'limit':_0x38c30c[_0xe758('0x11')]?_0x38c30c[_0xe758('0x11')]['limit']||null:null,'include':_0x38c30c[_0xe758('0x11')]?_0x38c30c[_0xe758('0x11')][_0xe758('0x14')]?_[_0xe758('0x15')](_0x38c30c[_0xe758('0x11')][_0xe758('0x14')],function(_0x108bfe){return{'model':db[_0x108bfe['model']],'as':_0x108bfe['as'],'attributes':_0x108bfe['attributes'],'include':_0x108bfe['include']?_['map'](_0x108bfe[_0xe758('0x14')],function(_0x145beb){return{'model':db[_0x145beb[_0xe758('0x16')]],'as':_0x145beb['as'],'attributes':_0x145beb[_0xe758('0x13')],'include':_0x145beb['include']?_[_0xe758('0x15')](_0x145beb['include'],function(_0x3bcdac){return{'model':db[_0x3bcdac['model']],'as':_0x3bcdac['as'],'attributes':_0x3bcdac['attributes']};}):[]};}):[]};}):[]:[]})[_0xe758('0x17')](function(_0x177db1){logger[_0xe758('0x18')](_0xe758('0x10'),_0x38c30c);logger['debug'](_0xe758('0x10'),_0x38c30c,JSON[_0xe758('0x19')](_0x177db1));_0x3fe7e8(_0x177db1);})[_0xe758('0xf')](function(_0x1934d9){logger['error'](_0xe758('0x10'),_0x1934d9['message'],_0x38c30c);_0x3ee871(_0xfdf5b0[_0xe758('0xc')](0x1f4,_0x1934d9[_0xe758('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/campaign/index.js b/server/api/campaign/index.js index e43861a..fb80f2c 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 _0xd377=['getHoppers','/:id/hopper_histories','getHopperHistories','/:id/hopper_finals','/:id/hopper_black','getLists','/:id/blacklists','getBlackLists','post','/:id/lists','update','destroy','delete','removeLists','removeBlackLists','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','show'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xd377,0x1a3));var _0x7d37=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd377[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x7d37('0x0'));var path=require(_0x7d37('0x1'));var timeout=require(_0x7d37('0x2'));var express=require(_0x7d37('0x3'));var router=express[_0x7d37('0x4')]();var fs_extra=require(_0x7d37('0x5'));var auth=require(_0x7d37('0x6'));var interaction=require(_0x7d37('0x7'));var config=require(_0x7d37('0x8'));var controller=require(_0x7d37('0x9'));router[_0x7d37('0xa')]('/',auth['isAuthenticated'](),controller[_0x7d37('0xb')]);router[_0x7d37('0xa')](_0x7d37('0xc'),auth[_0x7d37('0xd')](),controller[_0x7d37('0xe')]);router['get']('/:id/hoppers',auth['isAuthenticated'](),controller[_0x7d37('0xf')]);router[_0x7d37('0xa')](_0x7d37('0x10'),auth[_0x7d37('0xd')](),controller[_0x7d37('0x11')]);router[_0x7d37('0xa')](_0x7d37('0x12'),auth[_0x7d37('0xd')](),controller['getHopperFinals']);router[_0x7d37('0xa')](_0x7d37('0x13'),auth[_0x7d37('0xd')](),controller['getHopperBlacks']);router[_0x7d37('0xa')]('/:id/lists',auth[_0x7d37('0xd')](),controller[_0x7d37('0x14')]);router[_0x7d37('0xa')](_0x7d37('0x15'),auth[_0x7d37('0xd')](),controller[_0x7d37('0x16')]);router[_0x7d37('0x17')]('/',auth[_0x7d37('0xd')](),controller['create']);router[_0x7d37('0x17')]('/:id/clone',auth['isAuthenticated'](),controller['clone']);router[_0x7d37('0x17')](_0x7d37('0x18'),auth['isAuthenticated'](),controller['addLists']);router[_0x7d37('0x17')](_0x7d37('0x15'),auth[_0x7d37('0xd')](),controller['addBlackLists']);router['put']('/:id',auth[_0x7d37('0xd')](),controller[_0x7d37('0x19')]);router['delete'](_0x7d37('0xc'),auth[_0x7d37('0xd')](),controller[_0x7d37('0x1a')]);router[_0x7d37('0x1b')](_0x7d37('0x18'),auth['isAuthenticated'](),controller[_0x7d37('0x1c')]);router['delete'](_0x7d37('0x15'),auth[_0x7d37('0xd')](),controller[_0x7d37('0x1d')]);module[_0x7d37('0x1e')]=router; \ No newline at end of file +var _0x8906=['delete','/:id/lists','removeLists','/:id/blacklists','exports','util','path','express','../../components/auth/service','../../config/environment','./campaign.controller','get','index','/:id','isAuthenticated','/:id/hopper_histories','getHopperFinals','/:id/hopper_black','getLists','getBlackLists','post','/:id/clone','clone','addLists','addBlackLists','put','destroy'];(function(_0x1b6c6d,_0x2983b0){var _0x290d9d=function(_0x5b9779){while(--_0x5b9779){_0x1b6c6d['push'](_0x1b6c6d['shift']());}};_0x290d9d(++_0x2983b0);}(_0x8906,0x149));var _0x6890=function(_0x5dd85a,_0x17e2ad){_0x5dd85a=_0x5dd85a-0x0;var _0x57bf23=_0x8906[_0x5dd85a];return _0x57bf23;};'use strict';var multer=require('multer');var util=require(_0x6890('0x0'));var path=require(_0x6890('0x1'));var timeout=require('connect-timeout');var express=require(_0x6890('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6890('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x6890('0x4'));var controller=require(_0x6890('0x5'));router[_0x6890('0x6')]('/',auth['isAuthenticated'](),controller[_0x6890('0x7')]);router['get'](_0x6890('0x8'),auth[_0x6890('0x9')](),controller['show']);router[_0x6890('0x6')]('/:id/hoppers',auth[_0x6890('0x9')](),controller['getHoppers']);router['get'](_0x6890('0xa'),auth[_0x6890('0x9')](),controller['getHopperHistories']);router[_0x6890('0x6')]('/:id/hopper_finals',auth[_0x6890('0x9')](),controller[_0x6890('0xb')]);router[_0x6890('0x6')](_0x6890('0xc'),auth[_0x6890('0x9')](),controller['getHopperBlacks']);router[_0x6890('0x6')]('/:id/lists',auth[_0x6890('0x9')](),controller[_0x6890('0xd')]);router['get']('/:id/blacklists',auth[_0x6890('0x9')](),controller[_0x6890('0xe')]);router[_0x6890('0xf')]('/',auth['isAuthenticated'](),controller['create']);router[_0x6890('0xf')](_0x6890('0x10'),auth[_0x6890('0x9')](),controller[_0x6890('0x11')]);router['post']('/:id/lists',auth[_0x6890('0x9')](),controller[_0x6890('0x12')]);router[_0x6890('0xf')]('/:id/blacklists',auth['isAuthenticated'](),controller[_0x6890('0x13')]);router[_0x6890('0x14')](_0x6890('0x8'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x6890('0x8'),auth[_0x6890('0x9')](),controller[_0x6890('0x15')]);router[_0x6890('0x16')](_0x6890('0x17'),auth[_0x6890('0x9')](),controller[_0x6890('0x18')]);router[_0x6890('0x16')](_0x6890('0x19'),auth[_0x6890('0x9')](),controller['removeBlackLists']);module[_0x6890('0x1a')]=router; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.attributes.js b/server/api/cannedAnswer/cannedAnswer.attributes.js index 5ab9b2c..66d265a 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 _0x6c53=['VIRTUAL','getDataValue','key','sequelize','STRING','TEXT'];(function(_0x4087db,_0x1dad01){var _0x50be2f=function(_0x1257fe){while(--_0x1257fe){_0x4087db['push'](_0x4087db['shift']());}};_0x50be2f(++_0x1dad01);}(_0x6c53,0x18f));var _0x36c5=function(_0x5ccf2a,_0xb837f1){_0x5ccf2a=_0x5ccf2a-0x0;var _0xb1b8ab=_0x6c53[_0x5ccf2a];return _0xb1b8ab;};'use strict';var Sequelize=require(_0x36c5('0x0'));module['exports']={'key':{'type':Sequelize[_0x36c5('0x1')],'allowNull':![]},'value':{'type':Sequelize[_0x36c5('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0x36c5('0x1')]},'name':{'type':Sequelize[_0x36c5('0x3')],'get':function(){return this[_0x36c5('0x4')](_0x36c5('0x5'));}}}; \ No newline at end of file +var _0x2616=['STRING','TEXT','getDataValue','sequelize','exports'];(function(_0xe39277,_0x42cf78){var _0x265220=function(_0x40ec04){while(--_0x40ec04){_0xe39277['push'](_0xe39277['shift']());}};_0x265220(++_0x42cf78);}(_0x2616,0x16b));var _0x6261=function(_0x3e0b8f,_0x1cddeb){_0x3e0b8f=_0x3e0b8f-0x0;var _0x22f742=_0x2616[_0x3e0b8f];return _0x22f742;};'use strict';var Sequelize=require(_0x6261('0x0'));module[_0x6261('0x1')]={'key':{'type':Sequelize[_0x6261('0x2')],'allowNull':![]},'value':{'type':Sequelize[_0x6261('0x3')],'allowNull':![]},'description':{'type':Sequelize[_0x6261('0x2')]},'name':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x6261('0x4')]('key');}}}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.controller.js b/server/api/cannedAnswer/cannedAnswer.controller.js index 7cef628..149ce28 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 _0x8aab=['eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','save','update','then','destroy','get','CannedAnswers','UserProfileResource','stack','name','send','index','map','CannedAnswer','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','findAll','rows','show','params','include','options','find','body','catch','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','Sequelize','ValidationError','The\x20inserted\x20key\x20already\x20exists.','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x2cdc4a,_0xa97f65){var _0x1e2341=function(_0x54d5cc){while(--_0x54d5cc){_0x2cdc4a['push'](_0x2cdc4a['shift']());}};_0x1e2341(++_0xa97f65);}(_0x8aab,0x114));var _0xb8aa=function(_0x736b3c,_0x132551){_0x736b3c=_0x736b3c-0x0;var _0x409141=_0x8aab[_0x736b3c];return _0x409141;};'use strict';var emlformat=require(_0xb8aa('0x0'));var rimraf=require(_0xb8aa('0x1'));var zipdir=require(_0xb8aa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb8aa('0x3'));var moment=require('moment');var BPromise=require(_0xb8aa('0x4'));var Mustache=require(_0xb8aa('0x5'));var util=require(_0xb8aa('0x6'));var path=require(_0xb8aa('0x7'));var sox=require('sox');var csv=require(_0xb8aa('0x8'));var ejs=require(_0xb8aa('0x9'));var fs=require('fs');var fs_extra=require(_0xb8aa('0xa'));var _=require(_0xb8aa('0xb'));var squel=require(_0xb8aa('0xc'));var crypto=require(_0xb8aa('0xd'));var jsforce=require(_0xb8aa('0xe'));var deskjs=require(_0xb8aa('0xf'));var toCsv=require(_0xb8aa('0x8'));var querystring=require(_0xb8aa('0x10'));var Papa=require(_0xb8aa('0x11'));var Redis=require('ioredis');var authService=require(_0xb8aa('0x12'));var qs=require(_0xb8aa('0x13'));var as=require(_0xb8aa('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb8aa('0x15'));var utils=require(_0xb8aa('0x16'));var config=require(_0xb8aa('0x17'));var licenseUtil=require(_0xb8aa('0x18'));var db=require(_0xb8aa('0x19'))['db'];function respondWithStatusCode(_0x289fb7,_0x3200f1){_0x3200f1=_0x3200f1||0xcc;return function(_0x32074d){if(_0x32074d){return _0x289fb7[_0xb8aa('0x1a')](_0x3200f1);}return _0x289fb7[_0xb8aa('0x1b')](_0x3200f1)[_0xb8aa('0x1c')]();};}function respondWithResult(_0x499c56,_0x4e5c89){_0x4e5c89=_0x4e5c89||0xc8;return function(_0x4c4906){if(_0x4c4906){return _0x499c56['status'](_0x4e5c89)[_0xb8aa('0x1d')](_0x4c4906);}};}function respondWithFilteredResult(_0x32dccf,_0x5b5bb0){return function(_0x678ff){if(_0x678ff){var _0x38e33c=typeof _0x5b5bb0['offset']===_0xb8aa('0x1e')&&typeof _0x5b5bb0[_0xb8aa('0x1f')]===_0xb8aa('0x1e');var _0x293841=_0x678ff[_0xb8aa('0x20')];var _0x1e9726=_0x38e33c?0x0:_0x5b5bb0[_0xb8aa('0x21')];var _0x122fed=_0x38e33c?_0x678ff[_0xb8aa('0x20')]:_0x5b5bb0[_0xb8aa('0x21')]+_0x5b5bb0['limit'];var _0x3267d3;if(_0x122fed>=_0x293841){_0x122fed=_0x293841;_0x3267d3=0xc8;}else{_0x3267d3=0xce;}_0x32dccf['status'](_0x3267d3);return _0x32dccf[_0xb8aa('0x22')]('Content-Range',_0x1e9726+'-'+_0x122fed+'/'+_0x293841)[_0xb8aa('0x1d')](_0x678ff);}return null;};}function patchUpdates(_0xbf27ce){return function(_0x34de86){try{jsonpatch[_0xb8aa('0x23')](_0x34de86,_0xbf27ce,!![]);}catch(_0xc7affc){return BPromise['reject'](_0xc7affc);}return _0x34de86[_0xb8aa('0x24')]();};}function saveUpdates(_0x4b927b,_0x1ea017){return function(_0x396197){if(_0x396197){return _0x396197[_0xb8aa('0x25')](_0x4b927b)[_0xb8aa('0x26')](function(_0x570663){return _0x570663;});}return null;};}function removeEntity(_0x4d07a0,_0x38f94c){return function(_0x3ce4e4){if(_0x3ce4e4){return _0x3ce4e4[_0xb8aa('0x27')]()[_0xb8aa('0x26')](function(){var _0x58b125=_0x3ce4e4[_0xb8aa('0x28')]({'plain':!![]});var _0x5ccfb8=_0xb8aa('0x29');return db[_0xb8aa('0x2a')][_0xb8aa('0x27')]({'where':{'type':_0x5ccfb8,'resourceId':_0x58b125['id']}})[_0xb8aa('0x26')](function(){return _0x3ce4e4;});})[_0xb8aa('0x26')](function(){_0x4d07a0[_0xb8aa('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x65ec2,_0xed999){return function(_0x5d5b6e){if(!_0x5d5b6e){_0x65ec2[_0xb8aa('0x1a')](0x194);}return _0x5d5b6e;};}function handleError(_0x1e051d,_0x492037){_0x492037=_0x492037||0x1f4;return function(_0x470bf2){logger['error'](_0x470bf2[_0xb8aa('0x2b')]);if(_0x470bf2[_0xb8aa('0x2c')]){delete _0x470bf2[_0xb8aa('0x2c')];}_0x1e051d[_0xb8aa('0x1b')](_0x492037)[_0xb8aa('0x2d')](_0x470bf2);};}exports[_0xb8aa('0x2e')]=function(_0x10908c,_0xa4e929){var _0x465f95={},_0x321d60={},_0x172447={'count':0x0,'rows':[]};var _0x8414e2=_[_0xb8aa('0x2f')](db[_0xb8aa('0x30')]['rawAttributes'],function(_0x4c0645){return{'name':_0x4c0645['fieldName'],'type':_0x4c0645[_0xb8aa('0x31')][_0xb8aa('0x32')]};});_0x321d60[_0xb8aa('0x33')]=_[_0xb8aa('0x2f')](_0x8414e2,'name');_0x321d60[_0xb8aa('0x34')]=_[_0xb8aa('0x35')](_0x10908c[_0xb8aa('0x34')]);_0x321d60[_0xb8aa('0x36')]=_['intersection'](_0x321d60['model'],_0x321d60['query']);_0x465f95[_0xb8aa('0x37')]=_[_0xb8aa('0x38')](_0x321d60[_0xb8aa('0x33')],qs[_0xb8aa('0x39')](_0x10908c[_0xb8aa('0x34')][_0xb8aa('0x39')]));_0x465f95[_0xb8aa('0x37')]=_0x465f95[_0xb8aa('0x37')][_0xb8aa('0x3a')]?_0x465f95[_0xb8aa('0x37')]:_0x321d60[_0xb8aa('0x33')];if(!_0x10908c[_0xb8aa('0x34')][_0xb8aa('0x3b')](_0xb8aa('0x3c'))){_0x465f95[_0xb8aa('0x1f')]=qs['limit'](_0x10908c[_0xb8aa('0x34')][_0xb8aa('0x1f')]);_0x465f95[_0xb8aa('0x21')]=qs['offset'](_0x10908c[_0xb8aa('0x34')][_0xb8aa('0x21')]);}_0x465f95[_0xb8aa('0x3d')]=qs['sort'](_0x10908c[_0xb8aa('0x34')][_0xb8aa('0x3e')]);_0x465f95[_0xb8aa('0x3f')]=qs['filters'](_[_0xb8aa('0x40')](_0x10908c[_0xb8aa('0x34')],_0x321d60['filters']),_0x8414e2);if(_0x10908c[_0xb8aa('0x34')]['filter']){_0x465f95[_0xb8aa('0x3f')]=_[_0xb8aa('0x41')](_0x465f95[_0xb8aa('0x3f')],{'$or':[{'key':{'$like':'%'+_0x10908c[_0xb8aa('0x34')]['filter']+'%'}},{'value':{'$like':'%'+_0x10908c[_0xb8aa('0x34')][_0xb8aa('0x42')]+'%'}}]});}_0x465f95=_[_0xb8aa('0x41')]({},_0x465f95,_0x10908c['options']);var _0x1545e5={'where':_0x465f95[_0xb8aa('0x3f')]};return db[_0xb8aa('0x30')][_0xb8aa('0x20')](_0x1545e5)['then'](function(_0x153620){_0x172447[_0xb8aa('0x20')]=_0x153620;if(_0x10908c[_0xb8aa('0x34')][_0xb8aa('0x43')]){_0x465f95['include']=[{'all':!![]}];}return db['CannedAnswer'][_0xb8aa('0x44')](_0x465f95);})[_0xb8aa('0x26')](function(_0x540e58){_0x172447[_0xb8aa('0x45')]=_0x540e58;return _0x172447;})[_0xb8aa('0x26')](respondWithFilteredResult(_0xa4e929,_0x465f95))['catch'](handleError(_0xa4e929,null));};exports[_0xb8aa('0x46')]=function(_0x18d24a,_0x1a7a0e){var _0x24bd88={'raw':!![],'where':{'id':_0x18d24a[_0xb8aa('0x47')]['id']}},_0x4b0562={};_0x4b0562[_0xb8aa('0x33')]=_[_0xb8aa('0x35')](db[_0xb8aa('0x30')]['rawAttributes']);_0x4b0562[_0xb8aa('0x34')]=_['keys'](_0x18d24a[_0xb8aa('0x34')]);_0x4b0562['filters']=_[_0xb8aa('0x38')](_0x4b0562[_0xb8aa('0x33')],_0x4b0562['query']);_0x24bd88[_0xb8aa('0x37')]=_[_0xb8aa('0x38')](_0x4b0562['model'],qs['fields'](_0x18d24a[_0xb8aa('0x34')][_0xb8aa('0x39')]));_0x24bd88['attributes']=_0x24bd88['attributes'][_0xb8aa('0x3a')]?_0x24bd88[_0xb8aa('0x37')]:_0x4b0562[_0xb8aa('0x33')];if(_0x18d24a[_0xb8aa('0x34')]['includeAll']){_0x24bd88[_0xb8aa('0x48')]=[{'all':!![]}];}_0x24bd88=_[_0xb8aa('0x41')]({},_0x24bd88,_0x18d24a[_0xb8aa('0x49')]);return db[_0xb8aa('0x30')][_0xb8aa('0x4a')](_0x24bd88)['then'](handleEntityNotFound(_0x1a7a0e,null))[_0xb8aa('0x26')](respondWithResult(_0x1a7a0e,null))['catch'](handleError(_0x1a7a0e,null));};exports[_0xb8aa('0x25')]=function(_0x31b25c,_0x35acbd){if(_0x31b25c[_0xb8aa('0x4b')]['id']){delete _0x31b25c[_0xb8aa('0x4b')]['id'];}return db[_0xb8aa('0x30')][_0xb8aa('0x4a')]({'where':{'id':_0x31b25c['params']['id']}})[_0xb8aa('0x26')](handleEntityNotFound(_0x35acbd,null))[_0xb8aa('0x26')](saveUpdates(_0x31b25c[_0xb8aa('0x4b')],null))[_0xb8aa('0x26')](respondWithResult(_0x35acbd,null))[_0xb8aa('0x4c')](handleError(_0x35acbd,null));};exports[_0xb8aa('0x27')]=function(_0x408054,_0x1fc912){return db[_0xb8aa('0x30')][_0xb8aa('0x4a')]({'where':{'id':_0x408054['params']['id']}})[_0xb8aa('0x26')](handleEntityNotFound(_0x1fc912,null))['then'](removeEntity(_0x1fc912,null))[_0xb8aa('0x4c')](handleError(_0x1fc912,null));};exports['create']=function(_0x26dffe,_0xc33a81){var _0x565bf6={'key':_0x26dffe[_0xb8aa('0x4b')][_0xb8aa('0x32')]};if(_0x26dffe['body'][_0xb8aa('0x4d')]){_0x565bf6[_0xb8aa('0x4d')]=_0x26dffe[_0xb8aa('0x4b')][_0xb8aa('0x4d')];}else if(_0x26dffe[_0xb8aa('0x4b')][_0xb8aa('0x4e')]){_0x565bf6[_0xb8aa('0x4e')]=_0x26dffe['body']['SmsAccountId'];}else if(_0x26dffe['body'][_0xb8aa('0x4f')]){_0x565bf6[_0xb8aa('0x4f')]=_0x26dffe[_0xb8aa('0x4b')][_0xb8aa('0x4f')];}else if(_0x26dffe['body'][_0xb8aa('0x50')]){_0x565bf6[_0xb8aa('0x50')]=_0x26dffe[_0xb8aa('0x4b')][_0xb8aa('0x50')];}return db['CannedAnswer'][_0xb8aa('0x4a')]({'where':_0x565bf6})[_0xb8aa('0x26')](function(_0x39a0f9){if(_0x39a0f9){throw new db[(_0xb8aa('0x51'))][(_0xb8aa('0x52'))](_0xb8aa('0x53'));}return db[_0xb8aa('0x30')][_0xb8aa('0x54')](_0x26dffe[_0xb8aa('0x4b')]);})[_0xb8aa('0x26')](function(_0x1e5263){var _0x1390ad=_0x26dffe[_0xb8aa('0x55')][_0xb8aa('0x28')]({'plain':!![]});if(!_0x1390ad)throw new Error(_0xb8aa('0x56'));if(_0x1390ad[_0xb8aa('0x57')]==='user'){var _0x1745cd=_0x1e5263['get']({'plain':!![]});return db[_0xb8aa('0x58')][_0xb8aa('0x4a')]({'where':{'name':_0xb8aa('0x29'),'userProfileId':_0x1390ad[_0xb8aa('0x59')]},'raw':!![]})[_0xb8aa('0x26')](function(_0x46a707){if(_0x46a707&&_0x46a707[_0xb8aa('0x5a')]===0x0){return db[_0xb8aa('0x2a')][_0xb8aa('0x54')]({'name':_0x1745cd[_0xb8aa('0x2c')],'resourceId':_0x1745cd['id'],'type':_0x46a707[_0xb8aa('0x2c')],'sectionId':_0x46a707['id']},{})[_0xb8aa('0x26')](function(){return _0x1e5263;});}else{return _0x1e5263;}})[_0xb8aa('0x4c')](function(_0x5a3ed4){logger['error'](_0xb8aa('0x5b'),_0x5a3ed4);throw _0x5a3ed4;});}return _0x1e5263;})[_0xb8aa('0x26')](respondWithResult(_0xc33a81,0xc9))[_0xb8aa('0x4c')](handleError(_0xc33a81,null));}; \ No newline at end of file +var _0x923b=['save','update','destroy','then','UserProfileResource','name','index','CannedAnswer','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','catch','show','params','include','body','find','create','MailAccountId','SmsAccountId','OpenchannelAccountId','ChatWebsiteId','The\x20inserted\x20key\x20already\x20exists.','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','apply'];(function(_0x57dff9,_0x37bd67){var _0x346ae6=function(_0x14197b){while(--_0x14197b){_0x57dff9['push'](_0x57dff9['shift']());}};_0x346ae6(++_0x37bd67);}(_0x923b,0x85));var _0xb923=function(_0x2055a7,_0x415a4c){_0x2055a7=_0x2055a7-0x0;var _0x42a14d=_0x923b[_0x2055a7];return _0x42a14d;};'use strict';var emlformat=require(_0xb923('0x0'));var rimraf=require(_0xb923('0x1'));var zipdir=require(_0xb923('0x2'));var jsonpatch=require(_0xb923('0x3'));var rp=require(_0xb923('0x4'));var moment=require(_0xb923('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb923('0x6'));var sox=require('sox');var csv=require(_0xb923('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb923('0x8'));var _=require(_0xb923('0x9'));var squel=require(_0xb923('0xa'));var crypto=require(_0xb923('0xb'));var jsforce=require(_0xb923('0xc'));var deskjs=require(_0xb923('0xd'));var toCsv=require(_0xb923('0x7'));var querystring=require(_0xb923('0xe'));var Papa=require('papaparse');var Redis=require(_0xb923('0xf'));var authService=require(_0xb923('0x10'));var qs=require(_0xb923('0x11'));var as=require(_0xb923('0x12'));var hardwareService=require(_0xb923('0x13'));var logger=require(_0xb923('0x14'))('api');var utils=require(_0xb923('0x15'));var config=require(_0xb923('0x16'));var licenseUtil=require(_0xb923('0x17'));var db=require(_0xb923('0x18'))['db'];function respondWithStatusCode(_0xb457f5,_0x4ab220){_0x4ab220=_0x4ab220||0xcc;return function(_0x815e4c){if(_0x815e4c){return _0xb457f5[_0xb923('0x19')](_0x4ab220);}return _0xb457f5[_0xb923('0x1a')](_0x4ab220)[_0xb923('0x1b')]();};}function respondWithResult(_0x2e3f01,_0x374bee){_0x374bee=_0x374bee||0xc8;return function(_0x4a5934){if(_0x4a5934){return _0x2e3f01[_0xb923('0x1a')](_0x374bee)['json'](_0x4a5934);}};}function respondWithFilteredResult(_0x4e1fbd,_0x375048){return function(_0x36c49e){if(_0x36c49e){var _0x814d18=typeof _0x375048[_0xb923('0x1c')]===_0xb923('0x1d')&&typeof _0x375048[_0xb923('0x1e')]===_0xb923('0x1d');var _0x55d9e9=_0x36c49e['count'];var _0x543191=_0x814d18?0x0:_0x375048[_0xb923('0x1c')];var _0x34502=_0x814d18?_0x36c49e[_0xb923('0x1f')]:_0x375048[_0xb923('0x1c')]+_0x375048['limit'];var _0x155627;if(_0x34502>=_0x55d9e9){_0x34502=_0x55d9e9;_0x155627=0xc8;}else{_0x155627=0xce;}_0x4e1fbd['status'](_0x155627);return _0x4e1fbd[_0xb923('0x20')](_0xb923('0x21'),_0x543191+'-'+_0x34502+'/'+_0x55d9e9)['json'](_0x36c49e);}return null;};}function patchUpdates(_0x51dce7){return function(_0x1d4c12){try{jsonpatch[_0xb923('0x22')](_0x1d4c12,_0x51dce7,!![]);}catch(_0x376e0a){return BPromise['reject'](_0x376e0a);}return _0x1d4c12[_0xb923('0x23')]();};}function saveUpdates(_0xcb373a,_0xedceaa){return function(_0x3fc66e){if(_0x3fc66e){return _0x3fc66e[_0xb923('0x24')](_0xcb373a)['then'](function(_0x20dfd9){return _0x20dfd9;});}return null;};}function removeEntity(_0xa63741,_0x14226a){return function(_0x1a3830){if(_0x1a3830){return _0x1a3830[_0xb923('0x25')]()[_0xb923('0x26')](function(){var _0x4658a7=_0x1a3830['get']({'plain':!![]});var _0x1c1419='CannedAnswers';return db[_0xb923('0x27')][_0xb923('0x25')]({'where':{'type':_0x1c1419,'resourceId':_0x4658a7['id']}})[_0xb923('0x26')](function(){return _0x1a3830;});})[_0xb923('0x26')](function(){_0xa63741[_0xb923('0x1a')](0xcc)[_0xb923('0x1b')]();});}};}function handleEntityNotFound(_0x505d47,_0x22d08f){return function(_0x5cf546){if(!_0x5cf546){_0x505d47['sendStatus'](0x194);}return _0x5cf546;};}function handleError(_0x4033db,_0x3d0b32){_0x3d0b32=_0x3d0b32||0x1f4;return function(_0x25889c){logger['error'](_0x25889c['stack']);if(_0x25889c[_0xb923('0x28')]){delete _0x25889c[_0xb923('0x28')];}_0x4033db[_0xb923('0x1a')](_0x3d0b32)['send'](_0x25889c);};}exports[_0xb923('0x29')]=function(_0x511008,_0x49cf52){var _0x555707={},_0x432d68={},_0x2e4bb4={'count':0x0,'rows':[]};var _0x44e34f=_['map'](db[_0xb923('0x2a')][_0xb923('0x2b')],function(_0x388b72){return{'name':_0x388b72['fieldName'],'type':_0x388b72[_0xb923('0x2c')][_0xb923('0x2d')]};});_0x432d68[_0xb923('0x2e')]=_['map'](_0x44e34f,_0xb923('0x28'));_0x432d68['query']=_[_0xb923('0x2f')](_0x511008[_0xb923('0x30')]);_0x432d68[_0xb923('0x31')]=_[_0xb923('0x32')](_0x432d68['model'],_0x432d68[_0xb923('0x30')]);_0x555707[_0xb923('0x33')]=_['intersection'](_0x432d68[_0xb923('0x2e')],qs[_0xb923('0x34')](_0x511008[_0xb923('0x30')][_0xb923('0x34')]));_0x555707['attributes']=_0x555707[_0xb923('0x33')][_0xb923('0x35')]?_0x555707['attributes']:_0x432d68[_0xb923('0x2e')];if(!_0x511008[_0xb923('0x30')][_0xb923('0x36')]('nolimit')){_0x555707['limit']=qs['limit'](_0x511008['query'][_0xb923('0x1e')]);_0x555707[_0xb923('0x1c')]=qs[_0xb923('0x1c')](_0x511008[_0xb923('0x30')][_0xb923('0x1c')]);}_0x555707[_0xb923('0x37')]=qs[_0xb923('0x38')](_0x511008[_0xb923('0x30')][_0xb923('0x38')]);_0x555707[_0xb923('0x39')]=qs['filters'](_[_0xb923('0x3a')](_0x511008[_0xb923('0x30')],_0x432d68[_0xb923('0x31')]),_0x44e34f);if(_0x511008['query'][_0xb923('0x3b')]){_0x555707['where']=_[_0xb923('0x3c')](_0x555707[_0xb923('0x39')],{'$or':[{'key':{'$like':'%'+_0x511008[_0xb923('0x30')]['filter']+'%'}},{'value':{'$like':'%'+_0x511008[_0xb923('0x30')][_0xb923('0x3b')]+'%'}}]});}_0x555707=_[_0xb923('0x3c')]({},_0x555707,_0x511008[_0xb923('0x3d')]);var _0x12b800={'where':_0x555707[_0xb923('0x39')]};return db[_0xb923('0x2a')]['count'](_0x12b800)[_0xb923('0x26')](function(_0x2fbcaa){_0x2e4bb4[_0xb923('0x1f')]=_0x2fbcaa;if(_0x511008[_0xb923('0x30')][_0xb923('0x3e')]){_0x555707['include']=[{'all':!![]}];}return db[_0xb923('0x2a')]['findAll'](_0x555707);})[_0xb923('0x26')](function(_0x31bb07){_0x2e4bb4['rows']=_0x31bb07;return _0x2e4bb4;})[_0xb923('0x26')](respondWithFilteredResult(_0x49cf52,_0x555707))[_0xb923('0x3f')](handleError(_0x49cf52,null));};exports[_0xb923('0x40')]=function(_0x12a2f7,_0x482e6f){var _0x7e328a={'raw':!![],'where':{'id':_0x12a2f7[_0xb923('0x41')]['id']}},_0x3c783e={};_0x3c783e['model']=_[_0xb923('0x2f')](db[_0xb923('0x2a')]['rawAttributes']);_0x3c783e[_0xb923('0x30')]=_['keys'](_0x12a2f7[_0xb923('0x30')]);_0x3c783e[_0xb923('0x31')]=_[_0xb923('0x32')](_0x3c783e['model'],_0x3c783e[_0xb923('0x30')]);_0x7e328a['attributes']=_[_0xb923('0x32')](_0x3c783e[_0xb923('0x2e')],qs['fields'](_0x12a2f7[_0xb923('0x30')][_0xb923('0x34')]));_0x7e328a[_0xb923('0x33')]=_0x7e328a[_0xb923('0x33')]['length']?_0x7e328a[_0xb923('0x33')]:_0x3c783e[_0xb923('0x2e')];if(_0x12a2f7['query'][_0xb923('0x3e')]){_0x7e328a[_0xb923('0x42')]=[{'all':!![]}];}_0x7e328a=_[_0xb923('0x3c')]({},_0x7e328a,_0x12a2f7['options']);return db['CannedAnswer']['find'](_0x7e328a)['then'](handleEntityNotFound(_0x482e6f,null))[_0xb923('0x26')](respondWithResult(_0x482e6f,null))[_0xb923('0x3f')](handleError(_0x482e6f,null));};exports['update']=function(_0x37440d,_0x207b46){if(_0x37440d[_0xb923('0x43')]['id']){delete _0x37440d[_0xb923('0x43')]['id'];}return db[_0xb923('0x2a')][_0xb923('0x44')]({'where':{'id':_0x37440d[_0xb923('0x41')]['id']}})[_0xb923('0x26')](handleEntityNotFound(_0x207b46,null))['then'](saveUpdates(_0x37440d[_0xb923('0x43')],null))[_0xb923('0x26')](respondWithResult(_0x207b46,null))[_0xb923('0x3f')](handleError(_0x207b46,null));};exports[_0xb923('0x25')]=function(_0x46abcc,_0x4c7266){return db['CannedAnswer'][_0xb923('0x44')]({'where':{'id':_0x46abcc['params']['id']}})[_0xb923('0x26')](handleEntityNotFound(_0x4c7266,null))[_0xb923('0x26')](removeEntity(_0x4c7266,null))[_0xb923('0x3f')](handleError(_0x4c7266,null));};exports[_0xb923('0x45')]=function(_0x2722e4,_0x2d3141){var _0x10635b={'key':_0x2722e4[_0xb923('0x43')][_0xb923('0x2d')]};if(_0x2722e4[_0xb923('0x43')]['MailAccountId']){_0x10635b[_0xb923('0x46')]=_0x2722e4[_0xb923('0x43')][_0xb923('0x46')];}else if(_0x2722e4[_0xb923('0x43')]['SmsAccountId']){_0x10635b[_0xb923('0x47')]=_0x2722e4[_0xb923('0x43')][_0xb923('0x47')];}else if(_0x2722e4[_0xb923('0x43')][_0xb923('0x48')]){_0x10635b['OpenchannelAccountId']=_0x2722e4[_0xb923('0x43')][_0xb923('0x48')];}else if(_0x2722e4[_0xb923('0x43')][_0xb923('0x49')]){_0x10635b[_0xb923('0x49')]=_0x2722e4[_0xb923('0x43')][_0xb923('0x49')];}return db[_0xb923('0x2a')]['find']({'where':_0x10635b})[_0xb923('0x26')](function(_0x45df91){if(_0x45df91){throw new db['Sequelize']['ValidationError'](_0xb923('0x4a'));}return db[_0xb923('0x2a')]['create'](_0x2722e4[_0xb923('0x43')]);})[_0xb923('0x26')](function(_0x20a814){var _0x14f9ae=_0x2722e4['user'][_0xb923('0x4b')]({'plain':!![]});if(!_0x14f9ae)throw new Error(_0xb923('0x4c'));if(_0x14f9ae[_0xb923('0x4d')]===_0xb923('0x4e')){var _0x1977f2=_0x20a814[_0xb923('0x4b')]({'plain':!![]});return db[_0xb923('0x4f')]['find']({'where':{'name':'CannedAnswers','userProfileId':_0x14f9ae[_0xb923('0x50')]},'raw':!![]})[_0xb923('0x26')](function(_0x11733b){if(_0x11733b&&_0x11733b[_0xb923('0x51')]===0x0){return db[_0xb923('0x27')]['create']({'name':_0x1977f2[_0xb923('0x28')],'resourceId':_0x1977f2['id'],'type':_0x11733b[_0xb923('0x28')],'sectionId':_0x11733b['id']},{})[_0xb923('0x26')](function(){return _0x20a814;});}else{return _0x20a814;}})['catch'](function(_0x3a5da2){logger[_0xb923('0x52')](_0xb923('0x53'),_0x3a5da2);throw _0x3a5da2;});}return _0x20a814;})[_0xb923('0x26')](respondWithResult(_0x2d3141,0xc9))[_0xb923('0x3f')](handleError(_0x2d3141,null));}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.model.js b/server/api/cannedAnswer/cannedAnswer.model.js index 0c171f5..c49b182 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 _0x3095=['util','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./cannedAnswer.attributes','exports','define','CannedAnswer','tools_canned_answers','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0xa201ee,_0x37da32){var _0x3e104d=function(_0x4cd637){while(--_0x4cd637){_0xa201ee['push'](_0xa201ee['shift']());}};_0x3e104d(++_0x37da32);}(_0x3095,0x158));var _0x5309=function(_0x5c5904,_0xa16eeb){_0x5c5904=_0x5c5904-0x0;var _0x1eb4b8=_0x3095[_0x5c5904];return _0x1eb4b8;};'use strict';var _=require(_0x5309('0x0'));var util=require(_0x5309('0x1'));var logger=require(_0x5309('0x2'))('api');var moment=require('moment');var BPromise=require(_0x5309('0x3'));var rp=require(_0x5309('0x4'));var fs=require('fs');var path=require(_0x5309('0x5'));var rimraf=require(_0x5309('0x6'));var config=require(_0x5309('0x7'));var attributes=require(_0x5309('0x8'));module[_0x5309('0x9')]=function(_0x11d1e5,_0x12b620){return _0x11d1e5[_0x5309('0xa')](_0x5309('0xb'),attributes,{'tableName':_0x5309('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x5309('0xd'),'collate':_0x5309('0xe')});}; \ No newline at end of file +var _0x7044=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path','../../config/environment','exports','CannedAnswer','tools_canned_answers'];(function(_0x5b1d1b,_0xa6de7b){var _0x5c30ae=function(_0x50f391){while(--_0x50f391){_0x5b1d1b['push'](_0x5b1d1b['shift']());}};_0x5c30ae(++_0xa6de7b);}(_0x7044,0x147));var _0x4704=function(_0x389aff,_0x16144e){_0x389aff=_0x389aff-0x0;var _0x33d2fc=_0x7044[_0x389aff];return _0x33d2fc;};'use strict';var _=require(_0x4704('0x0'));var util=require(_0x4704('0x1'));var logger=require(_0x4704('0x2'))('api');var moment=require(_0x4704('0x3'));var BPromise=require(_0x4704('0x4'));var rp=require(_0x4704('0x5'));var fs=require('fs');var path=require(_0x4704('0x6'));var rimraf=require('rimraf');var config=require(_0x4704('0x7'));var attributes=require('./cannedAnswer.attributes');module[_0x4704('0x8')]=function(_0x43bc86,_0x48e7b8){return _0x43bc86['define'](_0x4704('0x9'),attributes,{'tableName':_0x4704('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x4704('0xb'),'collate':_0x4704('0xc')});}; \ No newline at end of file diff --git a/server/api/cannedAnswer/cannedAnswer.rpc.js b/server/api/cannedAnswer/cannedAnswer.rpc.js index 242e68e..b5a38d7 100644 --- a/server/api/cannedAnswer/cannedAnswer.rpc.js +++ b/server/api/cannedAnswer/cannedAnswer.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x15d76a,_0x3ef920){var _0x56402b=function(_0x4421a4){while(--_0x4421a4){_0x15d76a['push'](_0x15d76a['shift']());}};_0x56402b(++_0x3ef920);}(_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);});});} \ No newline at end of file +var _0xa9e0=['http','info','CannedAnswer,\x20%s,\x20%s','request\x20sent','debug','CannedAnswer,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x26d542,_0xdc260){var _0x43c146=function(_0x439916){while(--_0x439916){_0x26d542['push'](_0x26d542['shift']());}};_0x43c146(++_0xdc260);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1b828b,_0x344400){_0x1b828b=_0x1b828b-0x0;var _0x98da1a=_0xa9e0[_0x1b828b];return _0x98da1a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/cannedAnswer/index.js b/server/api/cannedAnswer/index.js index 79b2834..f59edcc 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 _0x78c7=['isAuthenticated','/:id','show','post','delete','destroy','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./cannedAnswer.controller','get'];(function(_0x2a5dbb,_0x2fb0ce){var _0x55f92e=function(_0x433f9e){while(--_0x433f9e){_0x2a5dbb['push'](_0x2a5dbb['shift']());}};_0x55f92e(++_0x2fb0ce);}(_0x78c7,0xfd));var _0x778c=function(_0x725b8e,_0xc22b48){_0x725b8e=_0x725b8e-0x0;var _0x43ac45=_0x78c7[_0x725b8e];return _0x43ac45;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x778c('0x0'));var timeout=require(_0x778c('0x1'));var express=require('express');var router=express[_0x778c('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x778c('0x3'));var interaction=require(_0x778c('0x4'));var config=require('../../config/environment');var controller=require(_0x778c('0x5'));router[_0x778c('0x6')]('/',auth[_0x778c('0x7')](),controller['index']);router[_0x778c('0x6')](_0x778c('0x8'),auth[_0x778c('0x7')](),controller[_0x778c('0x9')]);router[_0x778c('0xa')]('/',auth[_0x778c('0x7')](),controller['create']);router['put'](_0x778c('0x8'),auth[_0x778c('0x7')](),controller['update']);router[_0x778c('0xb')](_0x778c('0x8'),auth[_0x778c('0x7')](),controller[_0x778c('0xc')]);module['exports']=router; \ No newline at end of file +var _0x285d=['delete','destroy','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cannedAnswer.controller','get','isAuthenticated','show','post','put','/:id'];(function(_0x3747e5,_0x3bbc85){var _0x4f878f=function(_0x345cb3){while(--_0x345cb3){_0x3747e5['push'](_0x3747e5['shift']());}};_0x4f878f(++_0x3bbc85);}(_0x285d,0x1cd));var _0xd285=function(_0x5608a3,_0x5b33c5){_0x5608a3=_0x5608a3-0x0;var _0x1ed50a=_0x285d[_0x5608a3];return _0x1ed50a;};'use strict';var multer=require('multer');var util=require(_0xd285('0x0'));var path=require(_0xd285('0x1'));var timeout=require(_0xd285('0x2'));var express=require('express');var router=express[_0xd285('0x3')]();var fs_extra=require(_0xd285('0x4'));var auth=require(_0xd285('0x5'));var interaction=require(_0xd285('0x6'));var config=require(_0xd285('0x7'));var controller=require(_0xd285('0x8'));router[_0xd285('0x9')]('/',auth[_0xd285('0xa')](),controller['index']);router[_0xd285('0x9')]('/:id',auth[_0xd285('0xa')](),controller[_0xd285('0xb')]);router[_0xd285('0xc')]('/',auth[_0xd285('0xa')](),controller['create']);router[_0xd285('0xd')](_0xd285('0xe'),auth[_0xd285('0xa')](),controller['update']);router[_0xd285('0xf')](_0xd285('0xe'),auth[_0xd285('0xa')](),controller[_0xd285('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cdr/cdr.attributes.js b/server/api/cdr/cdr.attributes.js index a845021..ec403e5 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 _0x3338=['DATE','1970-01-01\x2000:00:01','STRING','INTEGER','sequelize','exports'];(function(_0x4405dc,_0x2ce0f5){var _0x9e5ab5=function(_0x4edc4f){while(--_0x4edc4f){_0x4405dc['push'](_0x4405dc['shift']());}};_0x9e5ab5(++_0x2ce0f5);}(_0x3338,0xfa));var _0x8333=function(_0xb8111f,_0x2b0a3b){_0xb8111f=_0xb8111f-0x0;var _0x233d1b=_0x3338[_0xb8111f];return _0x233d1b;};'use strict';var Sequelize=require(_0x8333('0x0'));module[_0x8333('0x1')]={'calldate':{'type':Sequelize[_0x8333('0x2')],'allowNull':![],'defaultValue':_0x8333('0x3')},'clid':{'type':Sequelize[_0x8333('0x4')]},'src':{'type':Sequelize['STRING']},'dst':{'type':Sequelize[_0x8333('0x4')]},'dcontext':{'type':Sequelize[_0x8333('0x4')]},'channel':{'type':Sequelize[_0x8333('0x4')]},'dstchannel':{'type':Sequelize[_0x8333('0x4')]},'lastapp':{'type':Sequelize[_0x8333('0x4')]},'lastdata':{'type':Sequelize['STRING']},'duration':{'type':Sequelize[_0x8333('0x5')],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize[_0x8333('0x5')],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize[_0x8333('0x4')]},'amaflags':{'type':Sequelize[_0x8333('0x5')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize[_0x8333('0x4')]},'userfield':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x8333('0x4')]},'linkedid':{'type':Sequelize['STRING']},'sequence':{'type':Sequelize[_0x8333('0x4')]},'peeraccount':{'type':Sequelize[_0x8333('0x4')]},'type':{'type':Sequelize[_0x8333('0x4')]},'tag':{'type':Sequelize[_0x8333('0x4')]}}; \ No newline at end of file +var _0x24cf=['INTEGER','DATE','1970-01-01\x2000:00:01','STRING'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x24cf,0x1d5));var _0xf24c=function(_0x8811fd,_0x2c02bd){_0x8811fd=_0x8811fd-0x0;var _0x443a8d=_0x24cf[_0x8811fd];return _0x443a8d;};'use strict';var Sequelize=require('sequelize');module['exports']={'calldate':{'type':Sequelize[_0xf24c('0x0')],'allowNull':![],'defaultValue':_0xf24c('0x1')},'clid':{'type':Sequelize[_0xf24c('0x2')]},'src':{'type':Sequelize[_0xf24c('0x2')]},'dst':{'type':Sequelize[_0xf24c('0x2')]},'dcontext':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xf24c('0x2')]},'dstchannel':{'type':Sequelize[_0xf24c('0x2')]},'lastapp':{'type':Sequelize[_0xf24c('0x2')]},'lastdata':{'type':Sequelize[_0xf24c('0x2')]},'duration':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'billsec':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x0},'disposition':{'type':Sequelize['STRING']},'amaflags':{'type':Sequelize[_0xf24c('0x3')],'allowNull':![],'defaultValue':0x0},'accountcode':{'type':Sequelize['STRING']},'userfield':{'type':Sequelize[_0xf24c('0x2')]},'uniqueid':{'type':Sequelize[_0xf24c('0x2')]},'linkedid':{'type':Sequelize[_0xf24c('0x2')]},'sequence':{'type':Sequelize[_0xf24c('0x2')]},'peeraccount':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf24c('0x2')]},'tag':{'type':Sequelize[_0xf24c('0x2')]}}; \ No newline at end of file diff --git a/server/api/cdr/cdr.controller.js b/server/api/cdr/cdr.controller.js index afe0c0c..a452bb4 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 _0xe181=['keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','filter','findAll','rows','catch','show','params','fields','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','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','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','Cdr','rawAttributes','fieldName','type','key','model','map','query'];(function(_0x3be2e2,_0x5c166d){var _0x53b9c5=function(_0x248aa7){while(--_0x248aa7){_0x3be2e2['push'](_0x3be2e2['shift']());}};_0x53b9c5(++_0x5c166d);}(_0xe181,0x68));var _0x1e18=function(_0x2bd443,_0x3b60d8){_0x2bd443=_0x2bd443-0x0;var _0x45159a=_0xe181[_0x2bd443];return _0x45159a;};'use strict';var emlformat=require(_0x1e18('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e18('0x1'));var jsonpatch=require(_0x1e18('0x2'));var rp=require(_0x1e18('0x3'));var moment=require(_0x1e18('0x4'));var BPromise=require(_0x1e18('0x5'));var Mustache=require(_0x1e18('0x6'));var util=require(_0x1e18('0x7'));var path=require('path');var sox=require(_0x1e18('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1e18('0x9'));var _=require(_0x1e18('0xa'));var squel=require(_0x1e18('0xb'));var crypto=require(_0x1e18('0xc'));var jsforce=require(_0x1e18('0xd'));var deskjs=require(_0x1e18('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1e18('0xf'));var Papa=require(_0x1e18('0x10'));var Redis=require(_0x1e18('0x11'));var authService=require(_0x1e18('0x12'));var qs=require(_0x1e18('0x13'));var as=require(_0x1e18('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1e18('0x15'))(_0x1e18('0x16'));var utils=require(_0x1e18('0x17'));var config=require(_0x1e18('0x18'));var licenseUtil=require(_0x1e18('0x19'));var db=require(_0x1e18('0x1a'))['db'];function respondWithStatusCode(_0x1743c3,_0x33a98d){_0x33a98d=_0x33a98d||0xcc;return function(_0x531e1b){if(_0x531e1b){return _0x1743c3[_0x1e18('0x1b')](_0x33a98d);}return _0x1743c3['status'](_0x33a98d)[_0x1e18('0x1c')]();};}function respondWithResult(_0x563eff,_0x404b7f){_0x404b7f=_0x404b7f||0xc8;return function(_0x36b583){if(_0x36b583){return _0x563eff[_0x1e18('0x1d')](_0x404b7f)[_0x1e18('0x1e')](_0x36b583);}};}function respondWithFilteredResult(_0x1687ba,_0x1e1ce6){return function(_0x39bc56){if(_0x39bc56){var _0x33fea1=typeof _0x1e1ce6[_0x1e18('0x1f')]===_0x1e18('0x20')&&typeof _0x1e1ce6[_0x1e18('0x21')]===_0x1e18('0x20');var _0x349f3c=_0x39bc56[_0x1e18('0x22')];var _0x21b851=_0x33fea1?0x0:_0x1e1ce6['offset'];var _0x1c91d2=_0x33fea1?_0x39bc56[_0x1e18('0x22')]:_0x1e1ce6[_0x1e18('0x1f')]+_0x1e1ce6[_0x1e18('0x21')];var _0x2834ee;if(_0x1c91d2>=_0x349f3c){_0x1c91d2=_0x349f3c;_0x2834ee=0xc8;}else{_0x2834ee=0xce;}_0x1687ba[_0x1e18('0x1d')](_0x2834ee);return _0x1687ba[_0x1e18('0x23')](_0x1e18('0x24'),_0x21b851+'-'+_0x1c91d2+'/'+_0x349f3c)[_0x1e18('0x1e')](_0x39bc56);}return null;};}function patchUpdates(_0x22baca){return function(_0x2489c3){try{jsonpatch[_0x1e18('0x25')](_0x2489c3,_0x22baca,!![]);}catch(_0x3c4fdf){return BPromise[_0x1e18('0x26')](_0x3c4fdf);}return _0x2489c3[_0x1e18('0x27')]();};}function saveUpdates(_0x975df0,_0x3fd0a7){return function(_0x5eb6b4){if(_0x5eb6b4){return _0x5eb6b4[_0x1e18('0x28')](_0x975df0)[_0x1e18('0x29')](function(_0x3e9b2c){return _0x3e9b2c;});}return null;};}function removeEntity(_0x52d5e2,_0xf74622){return function(_0xdda2ce){if(_0xdda2ce){return _0xdda2ce[_0x1e18('0x2a')]()[_0x1e18('0x29')](function(){_0x52d5e2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x6fa4db,_0x53f9d7){return function(_0x5bb03c){if(!_0x5bb03c){_0x6fa4db['sendStatus'](0x194);}return _0x5bb03c;};}function handleError(_0x32a196,_0x29cac0){_0x29cac0=_0x29cac0||0x1f4;return function(_0x41b67d){logger[_0x1e18('0x2b')](_0x41b67d[_0x1e18('0x2c')]);if(_0x41b67d[_0x1e18('0x2d')]){delete _0x41b67d[_0x1e18('0x2d')];}_0x32a196[_0x1e18('0x1d')](_0x29cac0)[_0x1e18('0x2e')](_0x41b67d);};}exports[_0x1e18('0x2f')]=function(_0x1015a3,_0x42c638){var _0x40d0af={},_0x1be225={},_0x558d01={'count':0x0,'rows':[]};var _0x57000b=_['map'](db[_0x1e18('0x30')][_0x1e18('0x31')],function(_0x1f75cd){return{'name':_0x1f75cd[_0x1e18('0x32')],'type':_0x1f75cd[_0x1e18('0x33')][_0x1e18('0x34')]};});_0x1be225[_0x1e18('0x35')]=_[_0x1e18('0x36')](_0x57000b,'name');_0x1be225[_0x1e18('0x37')]=_[_0x1e18('0x38')](_0x1015a3['query']);_0x1be225[_0x1e18('0x39')]=_[_0x1e18('0x3a')](_0x1be225[_0x1e18('0x35')],_0x1be225['query']);_0x40d0af[_0x1e18('0x3b')]=_['intersection'](_0x1be225['model'],qs['fields'](_0x1015a3[_0x1e18('0x37')]['fields']));_0x40d0af[_0x1e18('0x3b')]=_0x40d0af[_0x1e18('0x3b')][_0x1e18('0x3c')]?_0x40d0af['attributes']:_0x1be225['model'];if(!_0x1015a3[_0x1e18('0x37')][_0x1e18('0x3d')](_0x1e18('0x3e'))){_0x40d0af[_0x1e18('0x21')]=qs[_0x1e18('0x21')](_0x1015a3[_0x1e18('0x37')][_0x1e18('0x21')]);_0x40d0af[_0x1e18('0x1f')]=qs[_0x1e18('0x1f')](_0x1015a3[_0x1e18('0x37')][_0x1e18('0x1f')]);}_0x40d0af[_0x1e18('0x3f')]=qs['sort'](_0x1015a3['query'][_0x1e18('0x40')]);_0x40d0af[_0x1e18('0x41')]=qs[_0x1e18('0x39')](_['pick'](_0x1015a3[_0x1e18('0x37')],_0x1be225['filters']),_0x57000b);if(_0x1015a3[_0x1e18('0x37')]['filter']){_0x40d0af['where']=_[_0x1e18('0x42')](_0x40d0af[_0x1e18('0x41')],{'$or':_[_0x1e18('0x36')](_0x57000b,function(_0x206b44){if(_0x206b44[_0x1e18('0x33')]!==_0x1e18('0x43')){var _0x4e2ca3={};_0x4e2ca3[_0x206b44[_0x1e18('0x2d')]]={'$like':'%'+_0x1015a3[_0x1e18('0x37')][_0x1e18('0x44')]+'%'};return _0x4e2ca3;}})});}_0x40d0af=_[_0x1e18('0x42')]({},_0x40d0af,_0x1015a3['options']);var _0x11f839={'where':_0x40d0af['where']};return db[_0x1e18('0x30')][_0x1e18('0x22')](_0x11f839)['then'](function(_0x41c2bd){_0x558d01[_0x1e18('0x22')]=_0x41c2bd;if(_0x1015a3['query']['includeAll']){_0x40d0af['include']=[{'all':!![]}];}return db[_0x1e18('0x30')][_0x1e18('0x45')](_0x40d0af);})[_0x1e18('0x29')](function(_0x602a85){_0x558d01[_0x1e18('0x46')]=_0x602a85;return _0x558d01;})[_0x1e18('0x29')](respondWithFilteredResult(_0x42c638,_0x40d0af))[_0x1e18('0x47')](handleError(_0x42c638,null));};exports[_0x1e18('0x48')]=function(_0x1cae7e,_0x354832){var _0x16ee40={'raw':!![],'where':{'id':_0x1cae7e[_0x1e18('0x49')]['id']}},_0x4821f9={};_0x4821f9['model']=_[_0x1e18('0x38')](db[_0x1e18('0x30')]['rawAttributes']);_0x4821f9['query']=_['keys'](_0x1cae7e[_0x1e18('0x37')]);_0x4821f9[_0x1e18('0x39')]=_['intersection'](_0x4821f9[_0x1e18('0x35')],_0x4821f9[_0x1e18('0x37')]);_0x16ee40['attributes']=_['intersection'](_0x4821f9[_0x1e18('0x35')],qs[_0x1e18('0x4a')](_0x1cae7e[_0x1e18('0x37')][_0x1e18('0x4a')]));_0x16ee40[_0x1e18('0x3b')]=_0x16ee40[_0x1e18('0x3b')][_0x1e18('0x3c')]?_0x16ee40[_0x1e18('0x3b')]:_0x4821f9[_0x1e18('0x35')];if(_0x1cae7e[_0x1e18('0x37')]['includeAll']){_0x16ee40['include']=[{'all':!![]}];}_0x16ee40=_[_0x1e18('0x42')]({},_0x16ee40,_0x1cae7e[_0x1e18('0x4b')]);return db[_0x1e18('0x30')][_0x1e18('0x4c')](_0x16ee40)[_0x1e18('0x29')](handleEntityNotFound(_0x354832,null))[_0x1e18('0x29')](respondWithResult(_0x354832,null))[_0x1e18('0x47')](handleError(_0x354832,null));};exports['create']=function(_0x54f69b,_0x54cd71){return db[_0x1e18('0x30')][_0x1e18('0x4d')](_0x54f69b[_0x1e18('0x4e')],{})[_0x1e18('0x29')](respondWithResult(_0x54cd71,0xc9))[_0x1e18('0x47')](handleError(_0x54cd71,null));};exports[_0x1e18('0x28')]=function(_0x191c18,_0x190af4){if(_0x191c18[_0x1e18('0x4e')]['id']){delete _0x191c18[_0x1e18('0x4e')]['id'];}return db[_0x1e18('0x30')][_0x1e18('0x4c')]({'where':{'id':_0x191c18[_0x1e18('0x49')]['id']}})[_0x1e18('0x29')](handleEntityNotFound(_0x190af4,null))[_0x1e18('0x29')](saveUpdates(_0x191c18[_0x1e18('0x4e')],null))[_0x1e18('0x29')](respondWithResult(_0x190af4,null))[_0x1e18('0x47')](handleError(_0x190af4,null));};exports[_0x1e18('0x2a')]=function(_0x11d573,_0x5d4cbb){return db[_0x1e18('0x30')][_0x1e18('0x4c')]({'where':{'id':_0x11d573[_0x1e18('0x49')]['id']}})[_0x1e18('0x29')](handleEntityNotFound(_0x5d4cbb,null))[_0x1e18('0x29')](removeEntity(_0x5d4cbb,null))['catch'](handleError(_0x5d4cbb,null));};exports['describe']=function(_0x16b51a,_0x30dc06){return db['Cdr'][_0x1e18('0x4f')]()[_0x1e18('0x29')](respondWithResult(_0x30dc06,null))[_0x1e18('0x47')](handleError(_0x30dc06,null));}; \ No newline at end of file +var _0x9206=['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','end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','error','stack','name','send','index','Cdr','fieldName','key','model','map','keys','intersection','query','attributes','fields','hasOwnProperty','nolimit','sort','where','filters','filter','merge','type','VIRTUAL','options','findAll','catch','show','params','length','includeAll','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','ejs','lodash','squel'];(function(_0x143b18,_0xa59bc0){var _0x472c2e=function(_0x463e39){while(--_0x463e39){_0x143b18['push'](_0x143b18['shift']());}};_0x472c2e(++_0xa59bc0);}(_0x9206,0x176));var _0x6920=function(_0xfabeec,_0x2b5e5f){_0xfabeec=_0xfabeec-0x0;var _0x2892b8=_0x9206[_0xfabeec];return _0x2892b8;};'use strict';var emlformat=require(_0x6920('0x0'));var rimraf=require(_0x6920('0x1'));var zipdir=require(_0x6920('0x2'));var jsonpatch=require(_0x6920('0x3'));var rp=require(_0x6920('0x4'));var moment=require(_0x6920('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x6920('0x6'));var path=require(_0x6920('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x6920('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x6920('0x9'));var squel=require(_0x6920('0xa'));var crypto=require(_0x6920('0xb'));var jsforce=require(_0x6920('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6920('0xd'));var Papa=require(_0x6920('0xe'));var Redis=require(_0x6920('0xf'));var authService=require(_0x6920('0x10'));var qs=require(_0x6920('0x11'));var as=require(_0x6920('0x12'));var hardwareService=require(_0x6920('0x13'));var logger=require(_0x6920('0x14'))(_0x6920('0x15'));var utils=require(_0x6920('0x16'));var config=require(_0x6920('0x17'));var licenseUtil=require(_0x6920('0x18'));var db=require(_0x6920('0x19'))['db'];function respondWithStatusCode(_0x5ad438,_0x4f8430){_0x4f8430=_0x4f8430||0xcc;return function(_0x31730c){if(_0x31730c){return _0x5ad438[_0x6920('0x1a')](_0x4f8430);}return _0x5ad438['status'](_0x4f8430)[_0x6920('0x1b')]();};}function respondWithResult(_0xfa2823,_0x18140a){_0x18140a=_0x18140a||0xc8;return function(_0x2c3a35){if(_0x2c3a35){return _0xfa2823[_0x6920('0x1c')](_0x18140a)['json'](_0x2c3a35);}};}function respondWithFilteredResult(_0x338e5f,_0x20cdfb){return function(_0x15d8af){if(_0x15d8af){var _0xa64034=typeof _0x20cdfb[_0x6920('0x1d')]===_0x6920('0x1e')&&typeof _0x20cdfb[_0x6920('0x1f')]===_0x6920('0x1e');var _0x11ce91=_0x15d8af[_0x6920('0x20')];var _0x462500=_0xa64034?0x0:_0x20cdfb[_0x6920('0x1d')];var _0xc6e86b=_0xa64034?_0x15d8af[_0x6920('0x20')]:_0x20cdfb[_0x6920('0x1d')]+_0x20cdfb['limit'];var _0x3a0c0c;if(_0xc6e86b>=_0x11ce91){_0xc6e86b=_0x11ce91;_0x3a0c0c=0xc8;}else{_0x3a0c0c=0xce;}_0x338e5f[_0x6920('0x1c')](_0x3a0c0c);return _0x338e5f[_0x6920('0x21')](_0x6920('0x22'),_0x462500+'-'+_0xc6e86b+'/'+_0x11ce91)[_0x6920('0x23')](_0x15d8af);}return null;};}function patchUpdates(_0x16cb96){return function(_0x2cce0b){try{jsonpatch[_0x6920('0x24')](_0x2cce0b,_0x16cb96,!![]);}catch(_0xaf93ba){return BPromise[_0x6920('0x25')](_0xaf93ba);}return _0x2cce0b[_0x6920('0x26')]();};}function saveUpdates(_0x39013e,_0x1df372){return function(_0x2dd788){if(_0x2dd788){return _0x2dd788[_0x6920('0x27')](_0x39013e)[_0x6920('0x28')](function(_0x1ae686){return _0x1ae686;});}return null;};}function removeEntity(_0x3a6e48,_0xa8f55){return function(_0x258986){if(_0x258986){return _0x258986['destroy']()[_0x6920('0x28')](function(){_0x3a6e48['status'](0xcc)[_0x6920('0x1b')]();});}};}function handleEntityNotFound(_0x4dd08b,_0x72316a){return function(_0x32a6ae){if(!_0x32a6ae){_0x4dd08b[_0x6920('0x1a')](0x194);}return _0x32a6ae;};}function handleError(_0xd069c,_0x5868e1){_0x5868e1=_0x5868e1||0x1f4;return function(_0x1cab00){logger[_0x6920('0x29')](_0x1cab00[_0x6920('0x2a')]);if(_0x1cab00[_0x6920('0x2b')]){delete _0x1cab00[_0x6920('0x2b')];}_0xd069c[_0x6920('0x1c')](_0x5868e1)[_0x6920('0x2c')](_0x1cab00);};}exports[_0x6920('0x2d')]=function(_0x400894,_0x2f5ce8){var _0x6860c7={},_0x2b2cd9={},_0x548fbc={'count':0x0,'rows':[]};var _0x182f1b=_['map'](db[_0x6920('0x2e')]['rawAttributes'],function(_0x31aa90){return{'name':_0x31aa90[_0x6920('0x2f')],'type':_0x31aa90['type'][_0x6920('0x30')]};});_0x2b2cd9[_0x6920('0x31')]=_[_0x6920('0x32')](_0x182f1b,'name');_0x2b2cd9['query']=_[_0x6920('0x33')](_0x400894['query']);_0x2b2cd9['filters']=_[_0x6920('0x34')](_0x2b2cd9[_0x6920('0x31')],_0x2b2cd9[_0x6920('0x35')]);_0x6860c7[_0x6920('0x36')]=_[_0x6920('0x34')](_0x2b2cd9[_0x6920('0x31')],qs[_0x6920('0x37')](_0x400894['query'][_0x6920('0x37')]));_0x6860c7['attributes']=_0x6860c7[_0x6920('0x36')]['length']?_0x6860c7['attributes']:_0x2b2cd9[_0x6920('0x31')];if(!_0x400894[_0x6920('0x35')][_0x6920('0x38')](_0x6920('0x39'))){_0x6860c7[_0x6920('0x1f')]=qs[_0x6920('0x1f')](_0x400894[_0x6920('0x35')][_0x6920('0x1f')]);_0x6860c7[_0x6920('0x1d')]=qs[_0x6920('0x1d')](_0x400894[_0x6920('0x35')][_0x6920('0x1d')]);}_0x6860c7['order']=qs[_0x6920('0x3a')](_0x400894['query'][_0x6920('0x3a')]);_0x6860c7[_0x6920('0x3b')]=qs[_0x6920('0x3c')](_['pick'](_0x400894[_0x6920('0x35')],_0x2b2cd9[_0x6920('0x3c')]),_0x182f1b);if(_0x400894[_0x6920('0x35')][_0x6920('0x3d')]){_0x6860c7['where']=_[_0x6920('0x3e')](_0x6860c7[_0x6920('0x3b')],{'$or':_['map'](_0x182f1b,function(_0x49be52){if(_0x49be52[_0x6920('0x3f')]!==_0x6920('0x40')){var _0x56ca8f={};_0x56ca8f[_0x49be52[_0x6920('0x2b')]]={'$like':'%'+_0x400894[_0x6920('0x35')]['filter']+'%'};return _0x56ca8f;}})});}_0x6860c7=_['merge']({},_0x6860c7,_0x400894[_0x6920('0x41')]);var _0x1f0c5f={'where':_0x6860c7[_0x6920('0x3b')]};return db[_0x6920('0x2e')][_0x6920('0x20')](_0x1f0c5f)['then'](function(_0x58f0e8){_0x548fbc['count']=_0x58f0e8;if(_0x400894[_0x6920('0x35')]['includeAll']){_0x6860c7['include']=[{'all':!![]}];}return db[_0x6920('0x2e')][_0x6920('0x42')](_0x6860c7);})['then'](function(_0x3aad11){_0x548fbc['rows']=_0x3aad11;return _0x548fbc;})[_0x6920('0x28')](respondWithFilteredResult(_0x2f5ce8,_0x6860c7))[_0x6920('0x43')](handleError(_0x2f5ce8,null));};exports[_0x6920('0x44')]=function(_0x1b3ebb,_0x3a994d){var _0x55d7b5={'raw':!![],'where':{'id':_0x1b3ebb[_0x6920('0x45')]['id']}},_0x4dfa0c={};_0x4dfa0c['model']=_['keys'](db['Cdr']['rawAttributes']);_0x4dfa0c[_0x6920('0x35')]=_[_0x6920('0x33')](_0x1b3ebb[_0x6920('0x35')]);_0x4dfa0c['filters']=_[_0x6920('0x34')](_0x4dfa0c[_0x6920('0x31')],_0x4dfa0c[_0x6920('0x35')]);_0x55d7b5[_0x6920('0x36')]=_[_0x6920('0x34')](_0x4dfa0c[_0x6920('0x31')],qs['fields'](_0x1b3ebb[_0x6920('0x35')][_0x6920('0x37')]));_0x55d7b5[_0x6920('0x36')]=_0x55d7b5[_0x6920('0x36')][_0x6920('0x46')]?_0x55d7b5[_0x6920('0x36')]:_0x4dfa0c[_0x6920('0x31')];if(_0x1b3ebb[_0x6920('0x35')][_0x6920('0x47')]){_0x55d7b5[_0x6920('0x48')]=[{'all':!![]}];}_0x55d7b5=_[_0x6920('0x3e')]({},_0x55d7b5,_0x1b3ebb[_0x6920('0x41')]);return db['Cdr'][_0x6920('0x49')](_0x55d7b5)[_0x6920('0x28')](handleEntityNotFound(_0x3a994d,null))['then'](respondWithResult(_0x3a994d,null))['catch'](handleError(_0x3a994d,null));};exports[_0x6920('0x4a')]=function(_0x3c231e,_0x20fab4){return db[_0x6920('0x2e')][_0x6920('0x4a')](_0x3c231e['body'],{})[_0x6920('0x28')](respondWithResult(_0x20fab4,0xc9))[_0x6920('0x43')](handleError(_0x20fab4,null));};exports[_0x6920('0x27')]=function(_0x51b12d,_0x4d1c79){if(_0x51b12d[_0x6920('0x4b')]['id']){delete _0x51b12d[_0x6920('0x4b')]['id'];}return db[_0x6920('0x2e')][_0x6920('0x49')]({'where':{'id':_0x51b12d['params']['id']}})[_0x6920('0x28')](handleEntityNotFound(_0x4d1c79,null))[_0x6920('0x28')](saveUpdates(_0x51b12d[_0x6920('0x4b')],null))[_0x6920('0x28')](respondWithResult(_0x4d1c79,null))[_0x6920('0x43')](handleError(_0x4d1c79,null));};exports['destroy']=function(_0x1c0dd9,_0x3fe81d){return db[_0x6920('0x2e')][_0x6920('0x49')]({'where':{'id':_0x1c0dd9[_0x6920('0x45')]['id']}})[_0x6920('0x28')](handleEntityNotFound(_0x3fe81d,null))[_0x6920('0x28')](removeEntity(_0x3fe81d,null))[_0x6920('0x43')](handleError(_0x3fe81d,null));};exports[_0x6920('0x4c')]=function(_0x1c6bba,_0x492a02){return db[_0x6920('0x2e')][_0x6920('0x4c')]()[_0x6920('0x28')](respondWithResult(_0x492a02,null))[_0x6920('0x43')](handleError(_0x492a02,null));}; \ No newline at end of file diff --git a/server/api/cdr/cdr.model.js b/server/api/cdr/cdr.model.js index 24e5d99..947df13 100644 --- a/server/api/cdr/cdr.model.js +++ b/server/api/cdr/cdr.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Cdr','cdr','accountcode','disposition','dst','src','uniqueid','lodash','util','../../config/logger','moment','bluebird','path','rimraf','../../config/environment','./cdr.attributes','exports'];(function(_0x52259c,_0x3667cf){var _0x26cbfb=function(_0x207b2e){while(--_0x207b2e){_0x52259c['push'](_0x52259c['shift']());}};_0x26cbfb(++_0x3667cf);}(_0x7a54,0x106));var _0x47a5=function(_0x5533e8,_0x383f07){_0x5533e8=_0x5533e8-0x0;var _0x3c287e=_0x7a54[_0x5533e8];return _0x3c287e;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var logger=require(_0x47a5('0x2'))('api');var moment=require(_0x47a5('0x3'));var BPromise=require(_0x47a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x47a5('0x5'));var rimraf=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var attributes=require(_0x47a5('0x8'));module[_0x47a5('0x9')]=function(_0x545a97,_0x3d5629){return _0x545a97['define'](_0x47a5('0xa'),attributes,{'tableName':_0x47a5('0xb'),'paranoid':![],'indexes':[{'name':'accountcode','fields':[_0x47a5('0xc')]},{'name':'calldate','fields':['calldate']},{'name':'disposition','fields':[_0x47a5('0xd')]},{'name':_0x47a5('0xe'),'fields':['dst']},{'name':_0x47a5('0xf'),'fields':['src']},{'name':'uniqueid','fields':[_0x47a5('0x10')]}],'timestamps':![]});}; \ No newline at end of file +var _0x9957=['dst','src','uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./cdr.attributes','exports','define','Cdr','accountcode','calldate','disposition'];(function(_0x5453ee,_0x2dd831){var _0xefc1ef=function(_0x3ca505){while(--_0x3ca505){_0x5453ee['push'](_0x5453ee['shift']());}};_0xefc1ef(++_0x2dd831);}(_0x9957,0x93));var _0x7995=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0x9957[_0x1ac595];return _0x455fff;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var logger=require(_0x7995('0x2'))(_0x7995('0x3'));var moment=require('moment');var BPromise=require(_0x7995('0x4'));var rp=require(_0x7995('0x5'));var fs=require('fs');var path=require(_0x7995('0x6'));var rimraf=require(_0x7995('0x7'));var config=require('../../config/environment');var attributes=require(_0x7995('0x8'));module[_0x7995('0x9')]=function(_0x137b6b,_0x219534){return _0x137b6b[_0x7995('0xa')](_0x7995('0xb'),attributes,{'tableName':'cdr','paranoid':![],'indexes':[{'name':_0x7995('0xc'),'fields':[_0x7995('0xc')]},{'name':'calldate','fields':[_0x7995('0xd')]},{'name':_0x7995('0xe'),'fields':[_0x7995('0xe')]},{'name':_0x7995('0xf'),'fields':[_0x7995('0xf')]},{'name':_0x7995('0x10'),'fields':[_0x7995('0x10')]},{'name':'uniqueid','fields':[_0x7995('0x11')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/cdr/cdr.rpc.js b/server/api/cdr/cdr.rpc.js index 10305a7..c981395 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 _0x97d0=['Cdr,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Cdr,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x17b558,_0x19c462){var _0x2a3535=function(_0x24e4b1){while(--_0x24e4b1){_0x17b558['push'](_0x17b558['shift']());}};_0x2a3535(++_0x19c462);}(_0x97d0,0x1a7));var _0x097d=function(_0x38aecb,_0x52a548){_0x38aecb=_0x38aecb-0x0;var _0x58a70a=_0x97d0[_0x38aecb];return _0x58a70a;};'use strict';var _=require(_0x097d('0x0'));var util=require(_0x097d('0x1'));var moment=require(_0x097d('0x2'));var BPromise=require('bluebird');var rs=require(_0x097d('0x3'));var fs=require('fs');var Redis=require(_0x097d('0x4'));var db=require(_0x097d('0x5'))['db'];var utils=require(_0x097d('0x6'));var logger=require(_0x097d('0x7'))(_0x097d('0x8'));var config=require(_0x097d('0x9'));var jayson=require(_0x097d('0xa'));var client=jayson[_0x097d('0xb')][_0x097d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x4bcd05,_0x315c3a,_0x105632){return new BPromise(function(_0x4fc89e,_0x160aee){return client[_0x097d('0xd')](_0x4bcd05,_0x105632)[_0x097d('0xe')](function(_0x3df163){logger[_0x097d('0xf')](_0x097d('0x10'),_0x315c3a,_0x097d('0x11'));logger[_0x097d('0x12')](_0x097d('0x13'),_0x315c3a,'request\x20sent',JSON[_0x097d('0x14')](_0x3df163));if(_0x3df163[_0x097d('0x15')]){if(_0x3df163[_0x097d('0x15')][_0x097d('0x16')]===0x1f4){logger[_0x097d('0x15')](_0x097d('0x10'),_0x315c3a,_0x3df163['error']['message']);return _0x160aee(_0x3df163[_0x097d('0x15')][_0x097d('0x17')]);}logger[_0x097d('0x15')](_0x097d('0x10'),_0x315c3a,_0x3df163[_0x097d('0x15')][_0x097d('0x17')]);return _0x4fc89e(_0x3df163[_0x097d('0x15')][_0x097d('0x17')]);}else{logger[_0x097d('0xf')](_0x097d('0x10'),_0x315c3a,_0x097d('0x11'));_0x4fc89e(_0x3df163[_0x097d('0x18')][_0x097d('0x17')]);}})[_0x097d('0x19')](function(_0x475b6d){logger[_0x097d('0x15')](_0x097d('0x10'),_0x315c3a,_0x475b6d);_0x160aee(_0x475b6d);});});} \ No newline at end of file +var _0xfdab=['stringify','error','message','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','Cdr,\x20%s,\x20%s','debug','Cdr,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x529f7e,_0x24b033){var _0x234b87=function(_0x4abefe){while(--_0x4abefe){_0x529f7e['push'](_0x529f7e['shift']());}};_0x234b87(++_0x24b033);}(_0xfdab,0x180));var _0xbfda=function(_0x525fbb,_0x25e110){_0x525fbb=_0x525fbb-0x0;var _0x402595=_0xfdab[_0x525fbb];return _0x402595;};'use strict';var _=require(_0xbfda('0x0'));var util=require(_0xbfda('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xbfda('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbfda('0x3'))['db'];var utils=require(_0xbfda('0x4'));var logger=require(_0xbfda('0x5'))(_0xbfda('0x6'));var config=require('../../config/environment');var jayson=require(_0xbfda('0x7'));var client=jayson[_0xbfda('0x8')][_0xbfda('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33f0ec,_0x1c4c46,_0x1f5ea3){return new BPromise(function(_0x463ff3,_0x1b191d){return client[_0xbfda('0xa')](_0x33f0ec,_0x1f5ea3)['then'](function(_0x52901f){logger[_0xbfda('0xb')](_0xbfda('0xc'),_0x1c4c46,'request\x20sent');logger[_0xbfda('0xd')](_0xbfda('0xe'),_0x1c4c46,_0xbfda('0xf'),JSON[_0xbfda('0x10')](_0x52901f));if(_0x52901f[_0xbfda('0x11')]){if(_0x52901f[_0xbfda('0x11')]['code']===0x1f4){logger['error'](_0xbfda('0xc'),_0x1c4c46,_0x52901f[_0xbfda('0x11')]['message']);return _0x1b191d(_0x52901f[_0xbfda('0x11')]['message']);}logger[_0xbfda('0x11')]('Cdr,\x20%s,\x20%s',_0x1c4c46,_0x52901f[_0xbfda('0x11')]['message']);return _0x463ff3(_0x52901f['error'][_0xbfda('0x12')]);}else{logger[_0xbfda('0xb')]('Cdr,\x20%s,\x20%s',_0x1c4c46,_0xbfda('0xf'));_0x463ff3(_0x52901f['result'][_0xbfda('0x12')]);}})[_0xbfda('0x13')](function(_0x3fab1f){logger[_0xbfda('0x11')](_0xbfda('0xc'),_0x1c4c46,_0x3fab1f);_0x1b191d(_0x3fab1f);});});} \ No newline at end of file diff --git a/server/api/cdr/index.js b/server/api/cdr/index.js index cc0d8e8..7f88b06 100644 --- a/server/api/cdr/index.js +++ b/server/api/cdr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['destroy','exports','multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','describe','/:id','show','post','create','put','update'];(function(_0x409f3f,_0x476945){var _0x5753c8=function(_0x421196){while(--_0x421196){_0x409f3f['push'](_0x409f3f['shift']());}};_0x5753c8(++_0x476945);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var controller=require('./cdr.controller');router['get']('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x8')]);router[_0x0d8b('0x9')]('/describe',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xa')]);router['get'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xc')]);router[_0x0d8b('0xd')]('/',auth[_0x0d8b('0x7')](),controller[_0x0d8b('0xe')]);router[_0x0d8b('0xf')](_0x0d8b('0xb'),auth['isAuthenticated'](),controller[_0x0d8b('0x10')]);router['delete'](_0x0d8b('0xb'),auth[_0x0d8b('0x7')](),controller[_0x0d8b('0x11')]);module[_0x0d8b('0x12')]=router; \ No newline at end of file +var _0xb10b=['../../components/interaction/service','../../config/environment','./cdr.controller','get','index','isAuthenticated','describe','/:id','show','post','update','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service'];(function(_0x1295da,_0x5022dd){var _0x4af824=function(_0x2cd85d){while(--_0x2cd85d){_0x1295da['push'](_0x1295da['shift']());}};_0x4af824(++_0x5022dd);}(_0xb10b,0x12a));var _0xbb10=function(_0x11f345,_0x3d1ac3){_0x11f345=_0x11f345-0x0;var _0x5d66c9=_0xb10b[_0x11f345];return _0x5d66c9;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/describe',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0xf')]('/',auth[_0xbb10('0xb')](),controller['create']);router['put'](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x10')]);router['delete'](_0xbb10('0xd'),auth['isAuthenticated'](),controller[_0xbb10('0x11')]);module[_0xbb10('0x12')]=router; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.attributes.js b/server/api/chatApplication/chatApplication.attributes.js index 908884b..0782dbd 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 _0x01f6=['sequelize','exports','INTEGER','STRING','noop'];(function(_0x5f2c9d,_0x59e9d9){var _0xd99ee4=function(_0x1e5a5e){while(--_0x1e5a5e){_0x5f2c9d['push'](_0x5f2c9d['shift']());}};_0xd99ee4(++_0x59e9d9);}(_0x01f6,0xe6));var _0x601f=function(_0x4bc532,_0x42f9c5){_0x4bc532=_0x4bc532-0x0;var _0x2b20f1=_0x01f6[_0x4bc532];return _0x2b20f1;};'use strict';var Sequelize=require(_0x601f('0x0'));module[_0x601f('0x1')]={'priority':{'type':Sequelize[_0x601f('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x601f('0x3')],'allowNull':![],'defaultValue':_0x601f('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x601f('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x8210=['noop','STRING','sequelize','exports','INTEGER'];(function(_0x5b3b7b,_0x20ed67){var _0x2a1b8b=function(_0x24dce4){while(--_0x24dce4){_0x5b3b7b['push'](_0x5b3b7b['shift']());}};_0x2a1b8b(++_0x20ed67);}(_0x8210,0x1c9));var _0x0821=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0x8210[_0x465a0c];return _0x1e202e;};'use strict';var Sequelize=require(_0x0821('0x0'));module[_0x0821('0x1')]={'priority':{'type':Sequelize[_0x0821('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0821('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x0821('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.controller.js b/server/api/chatApplication/chatApplication.controller.js index 39537fa..6e24fb7 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 _0x12fd=['util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','../../mysqldb','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','destroy','sendStatus','stack','name','show','params','ChatApplication','query','model','attributes','intersection','includeAll','include','merge','options','body','find','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x12fd,0x199));var _0xd12f=function(_0xc7b9d8,_0xfee50c){_0xc7b9d8=_0xc7b9d8-0x0;var _0x4aa9b3=_0x12fd[_0xc7b9d8];return _0x4aa9b3;};'use strict';var emlformat=require(_0xd12f('0x0'));var rimraf=require(_0xd12f('0x1'));var zipdir=require(_0xd12f('0x2'));var jsonpatch=require(_0xd12f('0x3'));var rp=require(_0xd12f('0x4'));var moment=require('moment');var BPromise=require(_0xd12f('0x5'));var Mustache=require(_0xd12f('0x6'));var util=require(_0xd12f('0x7'));var path=require(_0xd12f('0x8'));var sox=require(_0xd12f('0x9'));var csv=require(_0xd12f('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd12f('0xb'));var _=require('lodash');var squel=require(_0xd12f('0xc'));var crypto=require(_0xd12f('0xd'));var jsforce=require(_0xd12f('0xe'));var deskjs=require(_0xd12f('0xf'));var toCsv=require('to-csv');var querystring=require(_0xd12f('0x10'));var Papa=require('papaparse');var Redis=require(_0xd12f('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd12f('0x12'));var logger=require(_0xd12f('0x13'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xd12f('0x14'))['db'];function respondWithStatusCode(_0x5add68,_0x1a5818){_0x1a5818=_0x1a5818||0xcc;return function(_0x16f77b){if(_0x16f77b){return _0x5add68['sendStatus'](_0x1a5818);}return _0x5add68[_0xd12f('0x15')](_0x1a5818)[_0xd12f('0x16')]();};}function respondWithResult(_0x59d592,_0x5d686e){_0x5d686e=_0x5d686e||0xc8;return function(_0x49afdf){if(_0x49afdf){return _0x59d592[_0xd12f('0x15')](_0x5d686e)[_0xd12f('0x17')](_0x49afdf);}};}function respondWithFilteredResult(_0x98947b,_0xb6233a){return function(_0x18a844){if(_0x18a844){var _0x60b06a=typeof _0xb6233a[_0xd12f('0x18')]===_0xd12f('0x19')&&typeof _0xb6233a[_0xd12f('0x1a')]==='undefined';var _0x4b00a2=_0x18a844[_0xd12f('0x1b')];var _0x45ff4d=_0x60b06a?0x0:_0xb6233a['offset'];var _0x14c619=_0x60b06a?_0x18a844[_0xd12f('0x1b')]:_0xb6233a[_0xd12f('0x18')]+_0xb6233a['limit'];var _0x5c4a4c;if(_0x14c619>=_0x4b00a2){_0x14c619=_0x4b00a2;_0x5c4a4c=0xc8;}else{_0x5c4a4c=0xce;}_0x98947b[_0xd12f('0x15')](_0x5c4a4c);return _0x98947b[_0xd12f('0x1c')](_0xd12f('0x1d'),_0x45ff4d+'-'+_0x14c619+'/'+_0x4b00a2)[_0xd12f('0x17')](_0x18a844);}return null;};}function patchUpdates(_0x410073){return function(_0x354cf0){try{jsonpatch['apply'](_0x354cf0,_0x410073,!![]);}catch(_0x2cb62b){return BPromise[_0xd12f('0x1e')](_0x2cb62b);}return _0x354cf0[_0xd12f('0x1f')]();};}function saveUpdates(_0x52f59d,_0x3a0c41){return function(_0x3c0aed){if(_0x3c0aed){return _0x3c0aed[_0xd12f('0x20')](_0x52f59d)[_0xd12f('0x21')](function(_0xd40a69){return _0xd40a69;});}return null;};}function removeEntity(_0x1d5168,_0x42eb92){return function(_0x322f78){if(_0x322f78){return _0x322f78[_0xd12f('0x22')]()[_0xd12f('0x21')](function(){_0x1d5168[_0xd12f('0x15')](0xcc)[_0xd12f('0x16')]();});}};}function handleEntityNotFound(_0x2218fe,_0x3d55d2){return function(_0x315276){if(!_0x315276){_0x2218fe[_0xd12f('0x23')](0x194);}return _0x315276;};}function handleError(_0x13fe26,_0x306c0a){_0x306c0a=_0x306c0a||0x1f4;return function(_0x3d71be){logger['error'](_0x3d71be[_0xd12f('0x24')]);if(_0x3d71be['name']){delete _0x3d71be[_0xd12f('0x25')];}_0x13fe26[_0xd12f('0x15')](_0x306c0a)['send'](_0x3d71be);};}exports[_0xd12f('0x26')]=function(_0x59b166,_0x11b590){var _0x31ae8e={'raw':!![],'where':{'id':_0x59b166[_0xd12f('0x27')]['id']}},_0x3418de={};_0x3418de['model']=_['keys'](db[_0xd12f('0x28')]['rawAttributes']);_0x3418de[_0xd12f('0x29')]=_['keys'](_0x59b166['query']);_0x3418de['filters']=_['intersection'](_0x3418de[_0xd12f('0x2a')],_0x3418de['query']);_0x31ae8e[_0xd12f('0x2b')]=_[_0xd12f('0x2c')](_0x3418de[_0xd12f('0x2a')],qs['fields'](_0x59b166[_0xd12f('0x29')]['fields']));_0x31ae8e[_0xd12f('0x2b')]=_0x31ae8e['attributes']['length']?_0x31ae8e[_0xd12f('0x2b')]:_0x3418de[_0xd12f('0x2a')];if(_0x59b166[_0xd12f('0x29')][_0xd12f('0x2d')]){_0x31ae8e[_0xd12f('0x2e')]=[{'all':!![]}];}_0x31ae8e=_[_0xd12f('0x2f')]({},_0x31ae8e,_0x59b166[_0xd12f('0x30')]);return db[_0xd12f('0x28')]['find'](_0x31ae8e)['then'](handleEntityNotFound(_0x11b590,null))[_0xd12f('0x21')](respondWithResult(_0x11b590,null))['catch'](handleError(_0x11b590,null));};exports[_0xd12f('0x20')]=function(_0x185a7c,_0x4bb940){if(_0x185a7c[_0xd12f('0x31')]['id']){delete _0x185a7c[_0xd12f('0x31')]['id'];}return db[_0xd12f('0x28')]['find']({'where':{'id':_0x185a7c['params']['id']}})['then'](handleEntityNotFound(_0x4bb940,null))['then'](saveUpdates(_0x185a7c[_0xd12f('0x31')],null))[_0xd12f('0x21')](respondWithResult(_0x4bb940,null))['catch'](handleError(_0x4bb940,null));};exports[_0xd12f('0x22')]=function(_0x2e30e0,_0x1a06c5){return db['ChatApplication'][_0xd12f('0x32')]({'where':{'id':_0x2e30e0['params']['id']}})['then'](handleEntityNotFound(_0x1a06c5,null))['then'](removeEntity(_0x1a06c5,null))[_0xd12f('0x33')](handleError(_0x1a06c5,null));}; \ No newline at end of file +var _0xf45e=['end','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','destroy','then','sendStatus','stack','show','params','keys','rawAttributes','query','filters','intersection','model','fields','attributes','length','includeAll','merge','ChatApplication','find','catch','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x3fe343,_0x5ab266){var _0x3d689b=function(_0x2bf29e){while(--_0x2bf29e){_0x3fe343['push'](_0x3fe343['shift']());}};_0x3d689b(++_0x5ab266);}(_0xf45e,0x115));var _0xef45=function(_0x4303e1,_0x492c81){_0x4303e1=_0x4303e1-0x0;var _0x548ec9=_0xf45e[_0x4303e1];return _0x548ec9;};'use strict';var emlformat=require(_0xef45('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xef45('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xef45('0x2'));var moment=require(_0xef45('0x3'));var BPromise=require(_0xef45('0x4'));var Mustache=require(_0xef45('0x5'));var util=require(_0xef45('0x6'));var path=require(_0xef45('0x7'));var sox=require(_0xef45('0x8'));var csv=require(_0xef45('0x9'));var ejs=require(_0xef45('0xa'));var fs=require('fs');var fs_extra=require(_0xef45('0xb'));var _=require(_0xef45('0xc'));var squel=require(_0xef45('0xd'));var crypto=require(_0xef45('0xe'));var jsforce=require(_0xef45('0xf'));var deskjs=require(_0xef45('0x10'));var toCsv=require(_0xef45('0x9'));var querystring=require(_0xef45('0x11'));var Papa=require(_0xef45('0x12'));var Redis=require(_0xef45('0x13'));var authService=require('../../components/auth/service');var qs=require(_0xef45('0x14'));var as=require(_0xef45('0x15'));var hardwareService=require(_0xef45('0x16'));var logger=require(_0xef45('0x17'))(_0xef45('0x18'));var utils=require(_0xef45('0x19'));var config=require('../../config/environment');var licenseUtil=require(_0xef45('0x1a'));var db=require(_0xef45('0x1b'))['db'];function respondWithStatusCode(_0x30babb,_0x433be9){_0x433be9=_0x433be9||0xcc;return function(_0x476739){if(_0x476739){return _0x30babb['sendStatus'](_0x433be9);}return _0x30babb['status'](_0x433be9)[_0xef45('0x1c')]();};}function respondWithResult(_0x47fd96,_0x2ae89a){_0x2ae89a=_0x2ae89a||0xc8;return function(_0xb0fc43){if(_0xb0fc43){return _0x47fd96[_0xef45('0x1d')](_0x2ae89a)['json'](_0xb0fc43);}};}function respondWithFilteredResult(_0x5b3136,_0x29c0c4){return function(_0x5530e6){if(_0x5530e6){var _0x11cd3a=typeof _0x29c0c4[_0xef45('0x1e')]===_0xef45('0x1f')&&typeof _0x29c0c4[_0xef45('0x20')]==='undefined';var _0x560b2f=_0x5530e6[_0xef45('0x21')];var _0x219778=_0x11cd3a?0x0:_0x29c0c4[_0xef45('0x1e')];var _0x258785=_0x11cd3a?_0x5530e6['count']:_0x29c0c4['offset']+_0x29c0c4[_0xef45('0x20')];var _0x20ef26;if(_0x258785>=_0x560b2f){_0x258785=_0x560b2f;_0x20ef26=0xc8;}else{_0x20ef26=0xce;}_0x5b3136[_0xef45('0x1d')](_0x20ef26);return _0x5b3136[_0xef45('0x22')](_0xef45('0x23'),_0x219778+'-'+_0x258785+'/'+_0x560b2f)[_0xef45('0x24')](_0x5530e6);}return null;};}function patchUpdates(_0x375cbd){return function(_0x4a6217){try{jsonpatch[_0xef45('0x25')](_0x4a6217,_0x375cbd,!![]);}catch(_0x3e2a47){return BPromise[_0xef45('0x26')](_0x3e2a47);}return _0x4a6217[_0xef45('0x27')]();};}function saveUpdates(_0x27322f,_0x5205bf){return function(_0x40abc8){if(_0x40abc8){return _0x40abc8['update'](_0x27322f)['then'](function(_0x7707a1){return _0x7707a1;});}return null;};}function removeEntity(_0x2b41d8,_0xbb859b){return function(_0x7817d0){if(_0x7817d0){return _0x7817d0[_0xef45('0x28')]()[_0xef45('0x29')](function(){_0x2b41d8[_0xef45('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208b35,_0x5f0593){return function(_0x38b470){if(!_0x38b470){_0x208b35[_0xef45('0x2a')](0x194);}return _0x38b470;};}function handleError(_0x578f03,_0x46e423){_0x46e423=_0x46e423||0x1f4;return function(_0x2c356d){logger['error'](_0x2c356d[_0xef45('0x2b')]);if(_0x2c356d['name']){delete _0x2c356d['name'];}_0x578f03['status'](_0x46e423)['send'](_0x2c356d);};}exports[_0xef45('0x2c')]=function(_0x2f72ef,_0x217e8d){var _0x15ad38={'raw':!![],'where':{'id':_0x2f72ef[_0xef45('0x2d')]['id']}},_0x5782d0={};_0x5782d0['model']=_[_0xef45('0x2e')](db['ChatApplication'][_0xef45('0x2f')]);_0x5782d0['query']=_['keys'](_0x2f72ef[_0xef45('0x30')]);_0x5782d0[_0xef45('0x31')]=_[_0xef45('0x32')](_0x5782d0[_0xef45('0x33')],_0x5782d0[_0xef45('0x30')]);_0x15ad38['attributes']=_['intersection'](_0x5782d0['model'],qs[_0xef45('0x34')](_0x2f72ef[_0xef45('0x30')][_0xef45('0x34')]));_0x15ad38[_0xef45('0x35')]=_0x15ad38[_0xef45('0x35')][_0xef45('0x36')]?_0x15ad38[_0xef45('0x35')]:_0x5782d0['model'];if(_0x2f72ef['query'][_0xef45('0x37')]){_0x15ad38['include']=[{'all':!![]}];}_0x15ad38=_[_0xef45('0x38')]({},_0x15ad38,_0x2f72ef['options']);return db[_0xef45('0x39')][_0xef45('0x3a')](_0x15ad38)[_0xef45('0x29')](handleEntityNotFound(_0x217e8d,null))[_0xef45('0x29')](respondWithResult(_0x217e8d,null))[_0xef45('0x3b')](handleError(_0x217e8d,null));};exports['update']=function(_0x372689,_0x331fdb){if(_0x372689[_0xef45('0x3c')]['id']){delete _0x372689['body']['id'];}return db['ChatApplication'][_0xef45('0x3a')]({'where':{'id':_0x372689[_0xef45('0x2d')]['id']}})['then'](handleEntityNotFound(_0x331fdb,null))[_0xef45('0x29')](saveUpdates(_0x372689['body'],null))['then'](respondWithResult(_0x331fdb,null))[_0xef45('0x3b')](handleError(_0x331fdb,null));};exports[_0xef45('0x28')]=function(_0x2688c9,_0x573caf){return db[_0xef45('0x39')][_0xef45('0x3a')]({'where':{'id':_0x2688c9[_0xef45('0x2d')]['id']}})[_0xef45('0x29')](handleEntityNotFound(_0x573caf,null))['then'](removeEntity(_0x573caf,null))['catch'](handleError(_0x573caf,null));}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.model.js b/server/api/chatApplication/chatApplication.model.js index 708b81c..6996cc9 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 _0x60cb=['bluebird','path','rimraf','../../config/environment','./chatApplication.attributes','exports','define','chat_applications','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x60cb,0x172));var _0xb60c=function(_0x4a3bdb,_0x35ace0){_0x4a3bdb=_0x4a3bdb-0x0;var _0x4c1626=_0x60cb[_0x4a3bdb];return _0x4c1626;};'use strict';var _=require(_0xb60c('0x0'));var util=require('util');var logger=require(_0xb60c('0x1'))('api');var moment=require('moment');var BPromise=require(_0xb60c('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb60c('0x3'));var rimraf=require(_0xb60c('0x4'));var config=require(_0xb60c('0x5'));var attributes=require(_0xb60c('0x6'));module[_0xb60c('0x7')]=function(_0x467dcb,_0x177339){return _0x467dcb[_0xb60c('0x8')]('ChatApplication',attributes,{'tableName':_0xb60c('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb60c('0xa'),'collate':_0xb60c('0xb')});}; \ No newline at end of file +var _0xb2ed=['bluebird','request-promise','rimraf','../../config/environment','./chatApplication.attributes','exports','ChatApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x228c6c,_0x155629){var _0x2d5278=function(_0x1b5bba){while(--_0x1b5bba){_0x228c6c['push'](_0x228c6c['shift']());}};_0x2d5278(++_0x155629);}(_0xb2ed,0x127));var _0xdb2e=function(_0x47c5bf,_0x45977e){_0x47c5bf=_0x47c5bf-0x0;var _0x11b779=_0xb2ed[_0x47c5bf];return _0x11b779;};'use strict';var _=require(_0xdb2e('0x0'));var util=require(_0xdb2e('0x1'));var logger=require(_0xdb2e('0x2'))(_0xdb2e('0x3'));var moment=require('moment');var BPromise=require(_0xdb2e('0x4'));var rp=require(_0xdb2e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdb2e('0x6'));var config=require(_0xdb2e('0x7'));var attributes=require(_0xdb2e('0x8'));module[_0xdb2e('0x9')]=function(_0x2761f1,_0x1dcc25){return _0x2761f1['define'](_0xdb2e('0xa'),attributes,{'tableName':'chat_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xdb2e('0xb'),'collate':_0xdb2e('0xc')});}; \ No newline at end of file diff --git a/server/api/chatApplication/chatApplication.rpc.js b/server/api/chatApplication/chatApplication.rpc.js index 0f23d9f..eebda9c 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 _0x0195=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','then','info','ChatApplication,\x20%s,\x20%s','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x4eb4c4,_0x35e92b){var _0x35e842=function(_0x1fdb48){while(--_0x1fdb48){_0x4eb4c4['push'](_0x4eb4c4['shift']());}};_0x35e842(++_0x35e92b);}(_0x0195,0x103));var _0x5019=function(_0x3dbf6c,_0x55cb15){_0x3dbf6c=_0x3dbf6c-0x0;var _0x46d71f=_0x0195[_0x3dbf6c];return _0x46d71f;};'use strict';var _=require(_0x5019('0x0'));var util=require(_0x5019('0x1'));var moment=require(_0x5019('0x2'));var BPromise=require(_0x5019('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5019('0x4'))['db'];var utils=require(_0x5019('0x5'));var logger=require(_0x5019('0x6'))('rpc');var config=require(_0x5019('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3e68d8,_0x26c086,_0xf5e11){return new BPromise(function(_0x4cb336,_0xfcb753){return client['request'](_0x3e68d8,_0xf5e11)[_0x5019('0x8')](function(_0x3b49a0){logger[_0x5019('0x9')](_0x5019('0xa'),_0x26c086,_0x5019('0xb'));logger[_0x5019('0xc')](_0x5019('0xd'),_0x26c086,'request\x20sent',JSON[_0x5019('0xe')](_0x3b49a0));if(_0x3b49a0[_0x5019('0xf')]){if(_0x3b49a0[_0x5019('0xf')][_0x5019('0x10')]===0x1f4){logger['error'](_0x5019('0xa'),_0x26c086,_0x3b49a0[_0x5019('0xf')][_0x5019('0x11')]);return _0xfcb753(_0x3b49a0['error'][_0x5019('0x11')]);}logger[_0x5019('0xf')](_0x5019('0xa'),_0x26c086,_0x3b49a0['error'][_0x5019('0x11')]);return _0x4cb336(_0x3b49a0[_0x5019('0xf')][_0x5019('0x11')]);}else{logger[_0x5019('0x9')](_0x5019('0xa'),_0x26c086,_0x5019('0xb'));_0x4cb336(_0x3b49a0[_0x5019('0x12')][_0x5019('0x11')]);}})[_0x5019('0x13')](function(_0x4a411b){logger[_0x5019('0xf')]('ChatApplication,\x20%s,\x20%s',_0x26c086,_0x4a411b);_0xfcb753(_0x4a411b);});});} \ No newline at end of file +var _0xc629=['client','http','then','info','request\x20sent','debug','ChatApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatApplication,\x20%s,\x20%s','message','catch','lodash','util','moment','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc629,0x172));var _0x9c62=function(_0x345114,_0x4923df){_0x345114=_0x345114-0x0;var _0x328e36=_0xc629[_0x345114];return _0x328e36;};'use strict';var _=require(_0x9c62('0x0'));var util=require(_0x9c62('0x1'));var moment=require(_0x9c62('0x2'));var BPromise=require('bluebird');var rs=require(_0x9c62('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9c62('0x4'));var logger=require('../../config/logger')(_0x9c62('0x5'));var config=require(_0x9c62('0x6'));var jayson=require(_0x9c62('0x7'));var client=jayson[_0x9c62('0x8')][_0x9c62('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x39f92f,_0xfa2008,_0x35fbf7){return new BPromise(function(_0x451ed4,_0x258024){return client['request'](_0x39f92f,_0x35fbf7)[_0x9c62('0xa')](function(_0x4a4f69){logger[_0x9c62('0xb')]('ChatApplication,\x20%s,\x20%s',_0xfa2008,_0x9c62('0xc'));logger[_0x9c62('0xd')](_0x9c62('0xe'),_0xfa2008,_0x9c62('0xc'),JSON[_0x9c62('0xf')](_0x4a4f69));if(_0x4a4f69['error']){if(_0x4a4f69[_0x9c62('0x10')][_0x9c62('0x11')]===0x1f4){logger[_0x9c62('0x10')](_0x9c62('0x12'),_0xfa2008,_0x4a4f69[_0x9c62('0x10')][_0x9c62('0x13')]);return _0x258024(_0x4a4f69['error'][_0x9c62('0x13')]);}logger[_0x9c62('0x10')](_0x9c62('0x12'),_0xfa2008,_0x4a4f69[_0x9c62('0x10')]['message']);return _0x451ed4(_0x4a4f69['error'][_0x9c62('0x13')]);}else{logger[_0x9c62('0xb')](_0x9c62('0x12'),_0xfa2008,_0x9c62('0xc'));_0x451ed4(_0x4a4f69['result'][_0x9c62('0x13')]);}})[_0x9c62('0x14')](function(_0x3683aa){logger['error'](_0x9c62('0x12'),_0xfa2008,_0x3683aa);_0x258024(_0x3683aa);});});} \ No newline at end of file diff --git a/server/api/chatApplication/index.js b/server/api/chatApplication/index.js index e01bca5..97664b4 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 _0xccea=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports','express'];(function(_0x290fa6,_0x16d017){var _0x47f1f3=function(_0x2b5eb8){while(--_0x2b5eb8){_0x290fa6['push'](_0x290fa6['shift']());}};_0x47f1f3(++_0x16d017);}(_0xccea,0x1df));var _0xacce=function(_0x102e37,_0x14a181){_0x102e37=_0x102e37-0x0;var _0x35a07c=_0xccea[_0x102e37];return _0x35a07c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xacce('0x0'));var router=express[_0xacce('0x1')]();var fs_extra=require('fs-extra');var auth=require(_0xacce('0x2'));var interaction=require(_0xacce('0x3'));var config=require(_0xacce('0x4'));var controller=require(_0xacce('0x5'));router[_0xacce('0x6')](_0xacce('0x7'),auth[_0xacce('0x8')](),controller[_0xacce('0x9')]);router[_0xacce('0xa')](_0xacce('0x7'),auth[_0xacce('0x8')](),controller[_0xacce('0xb')]);router[_0xacce('0xc')]('/:id',auth[_0xacce('0x8')](),controller[_0xacce('0xd')]);module[_0xacce('0xe')]=router; \ No newline at end of file +var _0xa867=['show','put','isAuthenticated','delete','destroy','exports','multer','util','../../components/interaction/service','/:id'];(function(_0xef8146,_0x459c34){var _0x5a6cb0=function(_0x2f84ec){while(--_0x2f84ec){_0xef8146['push'](_0xef8146['shift']());}};_0x5a6cb0(++_0x459c34);}(_0xa867,0x15a));var _0x7a86=function(_0x1abf57,_0x155dbd){_0x1abf57=_0x1abf57-0x0;var _0x1d5706=_0xa867[_0x1abf57];return _0x1d5706;};'use strict';var multer=require(_0x7a86('0x0'));var util=require(_0x7a86('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x7a86('0x2'));var config=require('../../config/environment');var controller=require('./chatApplication.controller');router['get'](_0x7a86('0x3'),auth['isAuthenticated'](),controller[_0x7a86('0x4')]);router[_0x7a86('0x5')](_0x7a86('0x3'),auth[_0x7a86('0x6')](),controller['update']);router[_0x7a86('0x7')](_0x7a86('0x3'),auth[_0x7a86('0x6')](),controller[_0x7a86('0x8')]);module[_0x7a86('0x9')]=router; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.attributes.js b/server/api/chatGroup/chatGroup.attributes.js index 0a7ffbf..f224f45 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 _0x6c20=['BOOLEAN','sequelize','exports'];(function(_0x2d1016,_0x4db53d){var _0x5ca283=function(_0x593d8b){while(--_0x593d8b){_0x2d1016['push'](_0x2d1016['shift']());}};_0x5ca283(++_0x4db53d);}(_0x6c20,0x88));var _0x06c2=function(_0xbdedcd,_0x4064d8){_0xbdedcd=_0xbdedcd-0x0;var _0x32d3d1=_0x6c20[_0xbdedcd];return _0x32d3d1;};'use strict';var Sequelize=require(_0x06c2('0x0'));module[_0x06c2('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize['STRING']},'write':{'type':Sequelize[_0x06c2('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0xdafc=['sequelize','STRING'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xdafc,0x1a6));var _0xcdaf=function(_0x44e40a,_0x5998ef){_0x44e40a=_0x44e40a-0x0;var _0x48e9b4=_0xdafc[_0x44e40a];return _0x48e9b4;};'use strict';var Sequelize=require(_0xcdaf('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'description':{'type':Sequelize[_0xcdaf('0x1')]},'write':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.controller.js b/server/api/chatGroup/chatGroup.controller.js index 60a88c6..0535a8c 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 _0x717d=['removeMembers','ids','addMessage','getMessages','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./chatGroup.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','then','error','name','send','index','map','ChatGroup','type','key','model','query','keys','filters','attributes','fields','hasOwnProperty','order','sort','filter','where','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','intersection','length','includeAll','create','body','find','describe','getUnread','ChatInternalMessage','user','toInteger','addMembers','omit','getMembers','findOne','merge','nolimit'];(function(_0x4ee386,_0x1a9032){var _0x42450c=function(_0x51d08c){while(--_0x51d08c){_0x4ee386['push'](_0x4ee386['shift']());}};_0x42450c(++_0x1a9032);}(_0x717d,0xcf));var _0xd717=function(_0x2d364e,_0x301c5e){_0x2d364e=_0x2d364e-0x0;var _0x1b9312=_0x717d[_0x2d364e];return _0x1b9312;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd717('0x0'));var zipdir=require(_0xd717('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xd717('0x2'));var moment=require(_0xd717('0x3'));var BPromise=require(_0xd717('0x4'));var Mustache=require(_0xd717('0x5'));var util=require(_0xd717('0x6'));var path=require(_0xd717('0x7'));var sox=require(_0xd717('0x8'));var csv=require(_0xd717('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd717('0xa'));var _=require(_0xd717('0xb'));var squel=require('squel');var crypto=require(_0xd717('0xc'));var jsforce=require(_0xd717('0xd'));var deskjs=require(_0xd717('0xe'));var toCsv=require(_0xd717('0x9'));var querystring=require(_0xd717('0xf'));var Papa=require('papaparse');var Redis=require(_0xd717('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xd717('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd717('0x12'));var logger=require(_0xd717('0x13'))(_0xd717('0x14'));var utils=require(_0xd717('0x15'));var config=require(_0xd717('0x16'));var licenseUtil=require(_0xd717('0x17'));var db=require(_0xd717('0x18'))['db'];config['redis']=_['defaults'](config[_0xd717('0x19')],{'host':_0xd717('0x1a'),'port':0x18eb});var socket=require(_0xd717('0x1b'))(new Redis(config['redis']));require(_0xd717('0x1c'))[_0xd717('0x1d')](socket);function respondWithStatusCode(_0x1f3405,_0x57c602){_0x57c602=_0x57c602||0xcc;return function(_0x532698){if(_0x532698){return _0x1f3405[_0xd717('0x1e')](_0x57c602);}return _0x1f3405[_0xd717('0x1f')](_0x57c602)[_0xd717('0x20')]();};}function respondWithResult(_0x260148,_0x4d0a93){_0x4d0a93=_0x4d0a93||0xc8;return function(_0x43af6b){if(_0x43af6b){return _0x260148[_0xd717('0x1f')](_0x4d0a93)[_0xd717('0x21')](_0x43af6b);}};}function respondWithFilteredResult(_0x5d9ee3,_0x4e9aa8){return function(_0x381f34){if(_0x381f34){var _0x45a37a=typeof _0x4e9aa8[_0xd717('0x22')]===_0xd717('0x23')&&typeof _0x4e9aa8[_0xd717('0x24')]==='undefined';var _0x3e4e62=_0x381f34['count'];var _0x5a3d14=_0x45a37a?0x0:_0x4e9aa8[_0xd717('0x22')];var _0x384beb=_0x45a37a?_0x381f34[_0xd717('0x25')]:_0x4e9aa8[_0xd717('0x22')]+_0x4e9aa8[_0xd717('0x24')];var _0xccccc9;if(_0x384beb>=_0x3e4e62){_0x384beb=_0x3e4e62;_0xccccc9=0xc8;}else{_0xccccc9=0xce;}_0x5d9ee3[_0xd717('0x1f')](_0xccccc9);return _0x5d9ee3[_0xd717('0x26')]('Content-Range',_0x5a3d14+'-'+_0x384beb+'/'+_0x3e4e62)[_0xd717('0x21')](_0x381f34);}return null;};}function patchUpdates(_0x348b6f){return function(_0x474fec){try{jsonpatch[_0xd717('0x27')](_0x474fec,_0x348b6f,!![]);}catch(_0x2d2869){return BPromise[_0xd717('0x28')](_0x2d2869);}return _0x474fec[_0xd717('0x29')]();};}function saveUpdates(_0x5a640e,_0x287f32){return function(_0x468413){if(_0x468413){return _0x468413[_0xd717('0x2a')](_0x5a640e)['then'](function(_0x35a78c){return _0x35a78c;});}return null;};}function removeEntity(_0x4b240,_0x1b91a8){return function(_0x47bcc5){if(_0x47bcc5){return _0x47bcc5[_0xd717('0x2b')]()[_0xd717('0x2c')](function(){_0x4b240[_0xd717('0x1f')](0xcc)[_0xd717('0x20')]();});}};}function handleEntityNotFound(_0x997031,_0x181da5){return function(_0x4c4c63){if(!_0x4c4c63){_0x997031[_0xd717('0x1e')](0x194);}return _0x4c4c63;};}function handleError(_0x2ebf55,_0x445e90){_0x445e90=_0x445e90||0x1f4;return function(_0x14bb87){logger[_0xd717('0x2d')](_0x14bb87['stack']);if(_0x14bb87['name']){delete _0x14bb87[_0xd717('0x2e')];}_0x2ebf55[_0xd717('0x1f')](_0x445e90)[_0xd717('0x2f')](_0x14bb87);};}exports[_0xd717('0x30')]=function(_0x32f5e0,_0x1edf09){var _0x322a94={},_0x471496={},_0x48ebc6={'count':0x0,'rows':[]};var _0x205366=_[_0xd717('0x31')](db[_0xd717('0x32')]['rawAttributes'],function(_0x53668a){return{'name':_0x53668a['fieldName'],'type':_0x53668a[_0xd717('0x33')][_0xd717('0x34')]};});_0x471496[_0xd717('0x35')]=_[_0xd717('0x31')](_0x205366,'name');_0x471496[_0xd717('0x36')]=_[_0xd717('0x37')](_0x32f5e0[_0xd717('0x36')]);_0x471496[_0xd717('0x38')]=_['intersection'](_0x471496[_0xd717('0x35')],_0x471496['query']);_0x322a94[_0xd717('0x39')]=_['intersection'](_0x471496['model'],qs[_0xd717('0x3a')](_0x32f5e0[_0xd717('0x36')][_0xd717('0x3a')]));_0x322a94[_0xd717('0x39')]=_0x322a94['attributes']['length']?_0x322a94['attributes']:_0x471496[_0xd717('0x35')];if(!_0x32f5e0[_0xd717('0x36')][_0xd717('0x3b')]('nolimit')){_0x322a94['limit']=qs['limit'](_0x32f5e0[_0xd717('0x36')][_0xd717('0x24')]);_0x322a94[_0xd717('0x22')]=qs['offset'](_0x32f5e0[_0xd717('0x36')][_0xd717('0x22')]);}_0x322a94[_0xd717('0x3c')]=qs[_0xd717('0x3d')](_0x32f5e0[_0xd717('0x36')][_0xd717('0x3d')]);_0x322a94['where']=qs[_0xd717('0x38')](_['pick'](_0x32f5e0[_0xd717('0x36')],_0x471496[_0xd717('0x38')]),_0x205366);if(_0x32f5e0[_0xd717('0x36')][_0xd717('0x3e')]){_0x322a94['where']=_['merge'](_0x322a94[_0xd717('0x3f')],{'$or':_['map'](_0x205366,function(_0x1fe3b9){if(_0x1fe3b9[_0xd717('0x33')]!==_0xd717('0x40')){var _0x10aa09={};_0x10aa09[_0x1fe3b9[_0xd717('0x2e')]]={'$like':'%'+_0x32f5e0['query'][_0xd717('0x3e')]+'%'};return _0x10aa09;}})});}_0x322a94=_['merge']({},_0x322a94,_0x32f5e0[_0xd717('0x41')]);var _0x5e6a11={'where':_0x322a94['where']};return db['ChatGroup'][_0xd717('0x25')](_0x5e6a11)[_0xd717('0x2c')](function(_0x128a1a){_0x48ebc6[_0xd717('0x25')]=_0x128a1a;if(_0x32f5e0[_0xd717('0x36')]['includeAll']){_0x322a94[_0xd717('0x42')]=[{'all':!![]}];}return db['ChatGroup'][_0xd717('0x43')](_0x322a94);})[_0xd717('0x2c')](function(_0x3bdb51){_0x48ebc6[_0xd717('0x44')]=_0x3bdb51;return _0x48ebc6;})[_0xd717('0x2c')](respondWithFilteredResult(_0x1edf09,_0x322a94))[_0xd717('0x45')](handleError(_0x1edf09,null));};exports[_0xd717('0x46')]=function(_0x454563,_0x4848b7){var _0x55325e={'raw':!![],'where':{'id':_0x454563[_0xd717('0x47')]['id']}},_0x4d72bf={};_0x4d72bf[_0xd717('0x35')]=_[_0xd717('0x37')](db[_0xd717('0x32')][_0xd717('0x48')]);_0x4d72bf[_0xd717('0x36')]=_['keys'](_0x454563['query']);_0x4d72bf['filters']=_[_0xd717('0x49')](_0x4d72bf['model'],_0x4d72bf[_0xd717('0x36')]);_0x55325e[_0xd717('0x39')]=_[_0xd717('0x49')](_0x4d72bf[_0xd717('0x35')],qs[_0xd717('0x3a')](_0x454563['query'][_0xd717('0x3a')]));_0x55325e['attributes']=_0x55325e[_0xd717('0x39')][_0xd717('0x4a')]?_0x55325e[_0xd717('0x39')]:_0x4d72bf[_0xd717('0x35')];if(_0x454563[_0xd717('0x36')][_0xd717('0x4b')]){_0x55325e[_0xd717('0x42')]=[{'all':!![]}];}_0x55325e=_['merge']({},_0x55325e,_0x454563[_0xd717('0x41')]);return db[_0xd717('0x32')]['find'](_0x55325e)['then'](handleEntityNotFound(_0x4848b7,null))['then'](respondWithResult(_0x4848b7,null))[_0xd717('0x45')](handleError(_0x4848b7,null));};exports['create']=function(_0x124d55,_0x422099){return db['ChatGroup'][_0xd717('0x4c')](_0x124d55[_0xd717('0x4d')],{})['then'](respondWithResult(_0x422099,0xc9))['catch'](handleError(_0x422099,null));};exports[_0xd717('0x2a')]=function(_0x35c49e,_0x97dd0e){if(_0x35c49e[_0xd717('0x4d')]['id']){delete _0x35c49e['body']['id'];}return db[_0xd717('0x32')][_0xd717('0x4e')]({'where':{'id':_0x35c49e[_0xd717('0x47')]['id']}})[_0xd717('0x2c')](handleEntityNotFound(_0x97dd0e,null))[_0xd717('0x2c')](saveUpdates(_0x35c49e[_0xd717('0x4d')],null))['then'](respondWithResult(_0x97dd0e,null))[_0xd717('0x45')](handleError(_0x97dd0e,null));};exports[_0xd717('0x2b')]=function(_0x29727b,_0x21e211){return db[_0xd717('0x32')][_0xd717('0x4e')]({'where':{'id':_0x29727b[_0xd717('0x47')]['id']}})[_0xd717('0x2c')](handleEntityNotFound(_0x21e211,null))['then'](removeEntity(_0x21e211,null))['catch'](handleError(_0x21e211,null));};exports[_0xd717('0x4f')]=function(_0x2857c0,_0x395518){return db[_0xd717('0x32')]['describe']()[_0xd717('0x2c')](respondWithResult(_0x395518,null))[_0xd717('0x45')](handleError(_0x395518,null));};exports[_0xd717('0x50')]=function(_0x4ef4cc,_0x1b5875,_0x514282){return db[_0xd717('0x51')]['count']({'where':{'ChatGroupId':_0x4ef4cc[_0xd717('0x47')]['id'],'ToId':_0x4ef4cc[_0xd717('0x52')]['id'],'read':![]}})[_0xd717('0x2c')](function(_0x2832ca){return{'id':_[_0xd717('0x53')](_0x4ef4cc[_0xd717('0x47')]['id']),'count':_0x2832ca};})[_0xd717('0x2c')](respondWithResult(_0x1b5875,null))[_0xd717('0x45')](handleError(_0x1b5875,null));};exports[_0xd717('0x54')]=function(_0x5347f1,_0x3678fb,_0x244c8e){return db['ChatGroup'][_0xd717('0x4e')]({'where':{'id':_0x5347f1[_0xd717('0x47')]['id']}})[_0xd717('0x2c')](handleEntityNotFound(_0x3678fb,null))[_0xd717('0x2c')](function(_0x262537){if(_0x262537){return _0x262537[_0xd717('0x54')](_0x5347f1['body']['ids'],_[_0xd717('0x55')](_0x5347f1[_0xd717('0x4d')],['ids','id'])||{});}})['then'](respondWithResult(_0x3678fb,null))[_0xd717('0x45')](handleError(_0x3678fb,null));};exports[_0xd717('0x56')]=function(_0xfdb6de,_0x5668d5,_0x2eda30){var _0x4a6f73={};var _0x2f220={};var _0xc874af;var _0x5833e3;return db[_0xd717('0x32')][_0xd717('0x57')]({'where':{'id':_0xfdb6de[_0xd717('0x47')]['id']}})[_0xd717('0x2c')](handleEntityNotFound(_0x5668d5,null))[_0xd717('0x2c')](function(_0x3a62a1){if(_0x3a62a1){_0xc874af=_0x3a62a1;_0x2f220[_0xd717('0x35')]=_[_0xd717('0x37')](db['User'][_0xd717('0x48')]);_0x2f220[_0xd717('0x36')]=_[_0xd717('0x37')](_0xfdb6de[_0xd717('0x36')]);_0x2f220[_0xd717('0x38')]=_[_0xd717('0x49')](_0x2f220[_0xd717('0x35')],_0x2f220[_0xd717('0x36')]);_0x4a6f73[_0xd717('0x39')]=_[_0xd717('0x49')](_0x2f220['model'],qs[_0xd717('0x3a')](_0xfdb6de['query']['fields']));_0x4a6f73[_0xd717('0x39')]=_0x4a6f73['attributes']['length']?_0x4a6f73['attributes']:_0x2f220[_0xd717('0x35')];_0x4a6f73[_0xd717('0x3c')]=qs[_0xd717('0x3d')](_0xfdb6de[_0xd717('0x36')][_0xd717('0x3d')]);_0x4a6f73[_0xd717('0x3f')]=qs[_0xd717('0x38')](_['pick'](_0xfdb6de[_0xd717('0x36')],_0x2f220['filters']));if(_0xfdb6de[_0xd717('0x36')][_0xd717('0x3e')]){_0x4a6f73['where']=_[_0xd717('0x58')](_0x4a6f73[_0xd717('0x3f')],{'$or':_['map'](_0x4a6f73[_0xd717('0x39')],function(_0x2e4799){var _0x447e0f={};_0x447e0f[_0x2e4799]={'$like':'%'+_0xfdb6de[_0xd717('0x36')][_0xd717('0x3e')]+'%'};return _0x447e0f;})});}_0x4a6f73=_[_0xd717('0x58')]({},_0x4a6f73,_0xfdb6de[_0xd717('0x41')]);return _0xc874af[_0xd717('0x56')](_0x4a6f73);}})[_0xd717('0x2c')](function(_0x1f98c5){if(_0x1f98c5){_0x5833e3=_0x1f98c5[_0xd717('0x4a')];if(!_0xfdb6de[_0xd717('0x36')][_0xd717('0x3b')](_0xd717('0x59'))){_0x4a6f73[_0xd717('0x24')]=qs[_0xd717('0x24')](_0xfdb6de[_0xd717('0x36')][_0xd717('0x24')]);_0x4a6f73['offset']=qs['offset'](_0xfdb6de[_0xd717('0x36')]['offset']);}return _0xc874af[_0xd717('0x56')](_0x4a6f73);}})[_0xd717('0x2c')](function(_0x5a9c97){if(_0x5a9c97){return _0x5a9c97?{'count':_0x5833e3,'rows':_0x5a9c97}:null;}})['then'](respondWithResult(_0x5668d5,null))[_0xd717('0x45')](handleError(_0x5668d5,null));};exports[_0xd717('0x5a')]=function(_0x5a9404,_0xba82f6,_0x1c4642){return db[_0xd717('0x32')][_0xd717('0x4e')]({'where':{'id':_0x5a9404[_0xd717('0x47')]['id']}})[_0xd717('0x2c')](handleEntityNotFound(_0xba82f6,null))[_0xd717('0x2c')](function(_0xb58b60){if(_0xb58b60){return _0xb58b60[_0xd717('0x5a')](_0x5a9404[_0xd717('0x36')][_0xd717('0x5b')]);}})[_0xd717('0x2c')](respondWithStatusCode(_0xba82f6,null))['catch'](handleError(_0xba82f6,null));};exports[_0xd717('0x5c')]=function(_0x36de90,_0x92dc4c,_0x51d007){if(_0x36de90[_0xd717('0x4d')]['id']){delete _0x36de90['body']['id'];}return db[_0xd717('0x32')][_0xd717('0x4e')]({'where':{'id':_0x36de90[_0xd717('0x47')]['id']}})[_0xd717('0x2c')](handleEntityNotFound(_0x92dc4c,null))[_0xd717('0x2c')](function(_0x7c4bf5){if(_0x7c4bf5){_0x36de90[_0xd717('0x4d')]['ChatGroupId']=_0x7c4bf5['id'];return db[_0xd717('0x51')][_0xd717('0x4c')](_0x36de90[_0xd717('0x4d')]);}})[_0xd717('0x2c')](respondWithResult(_0x92dc4c,null))['catch'](handleError(_0x92dc4c,null));};exports[_0xd717('0x5d')]=function(_0x43ac5f,_0x59f202,_0x14fa16){var _0x8ba9a0={};var _0x2856f0={};var _0x41665b;var _0x2c42eb;return db[_0xd717('0x32')][_0xd717('0x57')]({'where':{'id':_0x43ac5f[_0xd717('0x47')]['id']}})[_0xd717('0x2c')](handleEntityNotFound(_0x59f202,null))[_0xd717('0x2c')](function(_0x25d57d){if(_0x25d57d){_0x41665b=_0x25d57d;_0x2856f0['model']=_[_0xd717('0x37')](db[_0xd717('0x51')][_0xd717('0x48')]);_0x2856f0['query']=_[_0xd717('0x37')](_0x43ac5f[_0xd717('0x36')]);_0x2856f0[_0xd717('0x38')]=_[_0xd717('0x49')](_0x2856f0[_0xd717('0x35')],_0x2856f0[_0xd717('0x36')]);_0x8ba9a0['attributes']=_[_0xd717('0x49')](_0x2856f0[_0xd717('0x35')],qs[_0xd717('0x3a')](_0x43ac5f[_0xd717('0x36')][_0xd717('0x3a')]));_0x8ba9a0[_0xd717('0x39')]=_0x8ba9a0[_0xd717('0x39')][_0xd717('0x4a')]?_0x8ba9a0[_0xd717('0x39')]:_0x2856f0[_0xd717('0x35')];_0x8ba9a0[_0xd717('0x3c')]=qs[_0xd717('0x3d')](_0x43ac5f[_0xd717('0x36')][_0xd717('0x3d')]);_0x8ba9a0[_0xd717('0x3f')]=qs[_0xd717('0x38')](_[_0xd717('0x5e')](_0x43ac5f[_0xd717('0x36')],_0x2856f0[_0xd717('0x38')]));if(_0x43ac5f['query'][_0xd717('0x3e')]){_0x8ba9a0[_0xd717('0x3f')]=_['merge'](_0x8ba9a0[_0xd717('0x3f')],{'$or':_[_0xd717('0x31')](_0x8ba9a0[_0xd717('0x39')],function(_0xc1ddcb){var _0x360cb1={};_0x360cb1[_0xc1ddcb]={'$like':'%'+_0x43ac5f[_0xd717('0x36')]['filter']+'%'};return _0x360cb1;})});}if(_0x43ac5f[_0xd717('0x36')][_0xd717('0x5f')]){var _0x58a27d=_0x43ac5f[_0xd717('0x36')][_0xd717('0x5f')][_0xd717('0x60')](',');var _0x47f524={};_0x47f524[_0x58a27d[0x0]]={'$gte':moment(_0x58a27d[0x1])[_0xd717('0x61')](_0xd717('0x62'))};_0x8ba9a0[_0xd717('0x3f')]=_[_0xd717('0x58')](_0x8ba9a0[_0xd717('0x3f')],_0x47f524);}_0x8ba9a0=_['merge']({},_0x8ba9a0,_0x43ac5f[_0xd717('0x41')]);return _0x41665b['getMessages'](_0x8ba9a0);}})[_0xd717('0x2c')](function(_0x15b6a4){if(_0x15b6a4){_0x2c42eb=_0x15b6a4[_0xd717('0x4a')];if(!_0x43ac5f[_0xd717('0x36')]['hasOwnProperty'](_0xd717('0x59'))){_0x8ba9a0[_0xd717('0x24')]=qs[_0xd717('0x24')](_0x43ac5f[_0xd717('0x36')][_0xd717('0x24')]);_0x8ba9a0['offset']=qs[_0xd717('0x22')](_0x43ac5f[_0xd717('0x36')]['offset']);}return _0x41665b[_0xd717('0x5d')](_0x8ba9a0);}})['then'](function(_0x1ced42){if(_0x1ced42){return _0x1ced42?{'count':_0x2c42eb,'rows':_0x1ced42}:null;}})[_0xd717('0x2c')](respondWithResult(_0x59f202,null))[_0xd717('0x45')](handleError(_0x59f202,null));}; \ No newline at end of file +var _0x5def=['ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','ChatGroup','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','rows','catch','show','params','options','find','create','body','describe','getUnread','ChatInternalMessage','user','addMembers','ids','omit','getMembers','User','hasOwnProperty','removeMembers','addMessage','ChatGroupId','getMessages','findOne','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0x5def,0x1e7));var _0xf5de=function(_0x3fbdf6,_0x47945b){_0x3fbdf6=_0x3fbdf6-0x0;var _0x1d948f=_0x5def[_0x3fbdf6];return _0x1d948f;};'use strict';var emlformat=require(_0xf5de('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf5de('0x1'));var rp=require('request-promise');var moment=require(_0xf5de('0x2'));var BPromise=require(_0xf5de('0x3'));var Mustache=require(_0xf5de('0x4'));var util=require(_0xf5de('0x5'));var path=require(_0xf5de('0x6'));var sox=require(_0xf5de('0x7'));var csv=require('to-csv');var ejs=require(_0xf5de('0x8'));var fs=require('fs');var fs_extra=require(_0xf5de('0x9'));var _=require(_0xf5de('0xa'));var squel=require(_0xf5de('0xb'));var crypto=require(_0xf5de('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xf5de('0xd'));var toCsv=require(_0xf5de('0xe'));var querystring=require(_0xf5de('0xf'));var Papa=require(_0xf5de('0x10'));var Redis=require(_0xf5de('0x11'));var authService=require(_0xf5de('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5de('0x13'));var hardwareService=require(_0xf5de('0x14'));var logger=require(_0xf5de('0x15'))('api');var utils=require(_0xf5de('0x16'));var config=require(_0xf5de('0x17'));var licenseUtil=require(_0xf5de('0x18'));var db=require(_0xf5de('0x19'))['db'];config[_0xf5de('0x1a')]=_['defaults'](config[_0xf5de('0x1a')],{'host':_0xf5de('0x1b'),'port':0x18eb});var socket=require(_0xf5de('0x1c'))(new Redis(config[_0xf5de('0x1a')]));require('./chatGroup.socket')[_0xf5de('0x1d')](socket);function respondWithStatusCode(_0x309969,_0x537aac){_0x537aac=_0x537aac||0xcc;return function(_0x57c66c){if(_0x57c66c){return _0x309969[_0xf5de('0x1e')](_0x537aac);}return _0x309969['status'](_0x537aac)[_0xf5de('0x1f')]();};}function respondWithResult(_0x2b0720,_0x125eb9){_0x125eb9=_0x125eb9||0xc8;return function(_0x2afb43){if(_0x2afb43){return _0x2b0720[_0xf5de('0x20')](_0x125eb9)[_0xf5de('0x21')](_0x2afb43);}};}function respondWithFilteredResult(_0x182888,_0x4d1852){return function(_0x2b1213){if(_0x2b1213){var _0x1999cb=typeof _0x4d1852[_0xf5de('0x22')]===_0xf5de('0x23')&&typeof _0x4d1852[_0xf5de('0x24')]==='undefined';var _0x26f451=_0x2b1213[_0xf5de('0x25')];var _0x2305ee=_0x1999cb?0x0:_0x4d1852[_0xf5de('0x22')];var _0x525a86=_0x1999cb?_0x2b1213[_0xf5de('0x25')]:_0x4d1852[_0xf5de('0x22')]+_0x4d1852[_0xf5de('0x24')];var _0x4d6742;if(_0x525a86>=_0x26f451){_0x525a86=_0x26f451;_0x4d6742=0xc8;}else{_0x4d6742=0xce;}_0x182888[_0xf5de('0x20')](_0x4d6742);return _0x182888[_0xf5de('0x26')](_0xf5de('0x27'),_0x2305ee+'-'+_0x525a86+'/'+_0x26f451)['json'](_0x2b1213);}return null;};}function patchUpdates(_0x26322c){return function(_0x2c08a2){try{jsonpatch[_0xf5de('0x28')](_0x2c08a2,_0x26322c,!![]);}catch(_0x22d7e0){return BPromise[_0xf5de('0x29')](_0x22d7e0);}return _0x2c08a2[_0xf5de('0x2a')]();};}function saveUpdates(_0x14f1b1,_0x513a22){return function(_0x2f9b50){if(_0x2f9b50){return _0x2f9b50[_0xf5de('0x2b')](_0x14f1b1)['then'](function(_0x1b526d){return _0x1b526d;});}return null;};}function removeEntity(_0x53e606,_0x12d456){return function(_0x5f213d){if(_0x5f213d){return _0x5f213d[_0xf5de('0x2c')]()[_0xf5de('0x2d')](function(){_0x53e606[_0xf5de('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36986c,_0x4ce080){return function(_0x388b1a){if(!_0x388b1a){_0x36986c[_0xf5de('0x1e')](0x194);}return _0x388b1a;};}function handleError(_0x2bf9d4,_0x36f052){_0x36f052=_0x36f052||0x1f4;return function(_0xce2dff){logger[_0xf5de('0x2e')](_0xce2dff[_0xf5de('0x2f')]);if(_0xce2dff[_0xf5de('0x30')]){delete _0xce2dff[_0xf5de('0x30')];}_0x2bf9d4[_0xf5de('0x20')](_0x36f052)[_0xf5de('0x31')](_0xce2dff);};}exports[_0xf5de('0x32')]=function(_0x340c95,_0x3cb8d3){var _0x1ab697={},_0x473726={},_0x53dc0e={'count':0x0,'rows':[]};var _0x79b8f2=_[_0xf5de('0x33')](db[_0xf5de('0x34')][_0xf5de('0x35')],function(_0x559689){return{'name':_0x559689['fieldName'],'type':_0x559689[_0xf5de('0x36')][_0xf5de('0x37')]};});_0x473726[_0xf5de('0x38')]=_[_0xf5de('0x33')](_0x79b8f2,_0xf5de('0x30'));_0x473726[_0xf5de('0x39')]=_[_0xf5de('0x3a')](_0x340c95[_0xf5de('0x39')]);_0x473726[_0xf5de('0x3b')]=_[_0xf5de('0x3c')](_0x473726[_0xf5de('0x38')],_0x473726[_0xf5de('0x39')]);_0x1ab697[_0xf5de('0x3d')]=_[_0xf5de('0x3c')](_0x473726[_0xf5de('0x38')],qs[_0xf5de('0x3e')](_0x340c95[_0xf5de('0x39')]['fields']));_0x1ab697['attributes']=_0x1ab697[_0xf5de('0x3d')][_0xf5de('0x3f')]?_0x1ab697[_0xf5de('0x3d')]:_0x473726[_0xf5de('0x38')];if(!_0x340c95[_0xf5de('0x39')]['hasOwnProperty'](_0xf5de('0x40'))){_0x1ab697[_0xf5de('0x24')]=qs[_0xf5de('0x24')](_0x340c95[_0xf5de('0x39')][_0xf5de('0x24')]);_0x1ab697['offset']=qs[_0xf5de('0x22')](_0x340c95[_0xf5de('0x39')][_0xf5de('0x22')]);}_0x1ab697['order']=qs[_0xf5de('0x41')](_0x340c95['query'][_0xf5de('0x41')]);_0x1ab697[_0xf5de('0x42')]=qs[_0xf5de('0x3b')](_[_0xf5de('0x43')](_0x340c95['query'],_0x473726[_0xf5de('0x3b')]),_0x79b8f2);if(_0x340c95[_0xf5de('0x39')][_0xf5de('0x44')]){_0x1ab697[_0xf5de('0x42')]=_[_0xf5de('0x45')](_0x1ab697[_0xf5de('0x42')],{'$or':_[_0xf5de('0x33')](_0x79b8f2,function(_0x307dcf){if(_0x307dcf[_0xf5de('0x36')]!==_0xf5de('0x46')){var _0x45bdef={};_0x45bdef[_0x307dcf[_0xf5de('0x30')]]={'$like':'%'+_0x340c95[_0xf5de('0x39')][_0xf5de('0x44')]+'%'};return _0x45bdef;}})});}_0x1ab697=_['merge']({},_0x1ab697,_0x340c95['options']);var _0x485ed7={'where':_0x1ab697[_0xf5de('0x42')]};return db[_0xf5de('0x34')][_0xf5de('0x25')](_0x485ed7)[_0xf5de('0x2d')](function(_0x2060dd){_0x53dc0e['count']=_0x2060dd;if(_0x340c95[_0xf5de('0x39')][_0xf5de('0x47')]){_0x1ab697['include']=[{'all':!![]}];}return db['ChatGroup']['findAll'](_0x1ab697);})['then'](function(_0x26bda2){_0x53dc0e[_0xf5de('0x48')]=_0x26bda2;return _0x53dc0e;})[_0xf5de('0x2d')](respondWithFilteredResult(_0x3cb8d3,_0x1ab697))[_0xf5de('0x49')](handleError(_0x3cb8d3,null));};exports[_0xf5de('0x4a')]=function(_0x3a62f5,_0x15bed0){var _0x25eddd={'raw':!![],'where':{'id':_0x3a62f5[_0xf5de('0x4b')]['id']}},_0xd06e83={};_0xd06e83[_0xf5de('0x38')]=_[_0xf5de('0x3a')](db['ChatGroup']['rawAttributes']);_0xd06e83[_0xf5de('0x39')]=_[_0xf5de('0x3a')](_0x3a62f5['query']);_0xd06e83[_0xf5de('0x3b')]=_[_0xf5de('0x3c')](_0xd06e83['model'],_0xd06e83[_0xf5de('0x39')]);_0x25eddd[_0xf5de('0x3d')]=_[_0xf5de('0x3c')](_0xd06e83['model'],qs[_0xf5de('0x3e')](_0x3a62f5[_0xf5de('0x39')][_0xf5de('0x3e')]));_0x25eddd['attributes']=_0x25eddd[_0xf5de('0x3d')][_0xf5de('0x3f')]?_0x25eddd[_0xf5de('0x3d')]:_0xd06e83[_0xf5de('0x38')];if(_0x3a62f5[_0xf5de('0x39')][_0xf5de('0x47')]){_0x25eddd['include']=[{'all':!![]}];}_0x25eddd=_[_0xf5de('0x45')]({},_0x25eddd,_0x3a62f5[_0xf5de('0x4c')]);return db[_0xf5de('0x34')][_0xf5de('0x4d')](_0x25eddd)['then'](handleEntityNotFound(_0x15bed0,null))['then'](respondWithResult(_0x15bed0,null))[_0xf5de('0x49')](handleError(_0x15bed0,null));};exports[_0xf5de('0x4e')]=function(_0x3a9afb,_0xe510fe){return db['ChatGroup'][_0xf5de('0x4e')](_0x3a9afb[_0xf5de('0x4f')],{})[_0xf5de('0x2d')](respondWithResult(_0xe510fe,0xc9))[_0xf5de('0x49')](handleError(_0xe510fe,null));};exports[_0xf5de('0x2b')]=function(_0x4a17dc,_0x16816f){if(_0x4a17dc[_0xf5de('0x4f')]['id']){delete _0x4a17dc[_0xf5de('0x4f')]['id'];}return db[_0xf5de('0x34')]['find']({'where':{'id':_0x4a17dc[_0xf5de('0x4b')]['id']}})[_0xf5de('0x2d')](handleEntityNotFound(_0x16816f,null))[_0xf5de('0x2d')](saveUpdates(_0x4a17dc[_0xf5de('0x4f')],null))[_0xf5de('0x2d')](respondWithResult(_0x16816f,null))[_0xf5de('0x49')](handleError(_0x16816f,null));};exports[_0xf5de('0x2c')]=function(_0x580e27,_0x36e22e){return db['ChatGroup'][_0xf5de('0x4d')]({'where':{'id':_0x580e27[_0xf5de('0x4b')]['id']}})[_0xf5de('0x2d')](handleEntityNotFound(_0x36e22e,null))['then'](removeEntity(_0x36e22e,null))[_0xf5de('0x49')](handleError(_0x36e22e,null));};exports['describe']=function(_0x2d6cf9,_0x441b8d){return db[_0xf5de('0x34')][_0xf5de('0x50')]()[_0xf5de('0x2d')](respondWithResult(_0x441b8d,null))[_0xf5de('0x49')](handleError(_0x441b8d,null));};exports[_0xf5de('0x51')]=function(_0x37c667,_0x5c4c83,_0x336c39){return db[_0xf5de('0x52')]['count']({'where':{'ChatGroupId':_0x37c667[_0xf5de('0x4b')]['id'],'ToId':_0x37c667[_0xf5de('0x53')]['id'],'read':![]}})[_0xf5de('0x2d')](function(_0x3fcb7c){return{'id':_['toInteger'](_0x37c667[_0xf5de('0x4b')]['id']),'count':_0x3fcb7c};})['then'](respondWithResult(_0x5c4c83,null))[_0xf5de('0x49')](handleError(_0x5c4c83,null));};exports['addMembers']=function(_0x59bf2c,_0x16499f,_0x515b0d){return db[_0xf5de('0x34')][_0xf5de('0x4d')]({'where':{'id':_0x59bf2c[_0xf5de('0x4b')]['id']}})[_0xf5de('0x2d')](handleEntityNotFound(_0x16499f,null))['then'](function(_0x380d47){if(_0x380d47){return _0x380d47[_0xf5de('0x54')](_0x59bf2c['body'][_0xf5de('0x55')],_[_0xf5de('0x56')](_0x59bf2c['body'],[_0xf5de('0x55'),'id'])||{});}})[_0xf5de('0x2d')](respondWithResult(_0x16499f,null))['catch'](handleError(_0x16499f,null));};exports[_0xf5de('0x57')]=function(_0x164fd5,_0x1fc2cd,_0x244115){var _0x453a9a={};var _0xc776a9={};var _0x526d4d;var _0x1ff6b5;return db[_0xf5de('0x34')]['findOne']({'where':{'id':_0x164fd5[_0xf5de('0x4b')]['id']}})[_0xf5de('0x2d')](handleEntityNotFound(_0x1fc2cd,null))[_0xf5de('0x2d')](function(_0x190adb){if(_0x190adb){_0x526d4d=_0x190adb;_0xc776a9[_0xf5de('0x38')]=_[_0xf5de('0x3a')](db[_0xf5de('0x58')][_0xf5de('0x35')]);_0xc776a9[_0xf5de('0x39')]=_['keys'](_0x164fd5[_0xf5de('0x39')]);_0xc776a9[_0xf5de('0x3b')]=_[_0xf5de('0x3c')](_0xc776a9['model'],_0xc776a9['query']);_0x453a9a[_0xf5de('0x3d')]=_[_0xf5de('0x3c')](_0xc776a9[_0xf5de('0x38')],qs['fields'](_0x164fd5[_0xf5de('0x39')][_0xf5de('0x3e')]));_0x453a9a[_0xf5de('0x3d')]=_0x453a9a['attributes'][_0xf5de('0x3f')]?_0x453a9a[_0xf5de('0x3d')]:_0xc776a9[_0xf5de('0x38')];_0x453a9a['order']=qs['sort'](_0x164fd5['query']['sort']);_0x453a9a[_0xf5de('0x42')]=qs[_0xf5de('0x3b')](_[_0xf5de('0x43')](_0x164fd5[_0xf5de('0x39')],_0xc776a9[_0xf5de('0x3b')]));if(_0x164fd5['query'][_0xf5de('0x44')]){_0x453a9a[_0xf5de('0x42')]=_['merge'](_0x453a9a['where'],{'$or':_[_0xf5de('0x33')](_0x453a9a[_0xf5de('0x3d')],function(_0x102617){var _0x575688={};_0x575688[_0x102617]={'$like':'%'+_0x164fd5['query']['filter']+'%'};return _0x575688;})});}_0x453a9a=_[_0xf5de('0x45')]({},_0x453a9a,_0x164fd5[_0xf5de('0x4c')]);return _0x526d4d[_0xf5de('0x57')](_0x453a9a);}})[_0xf5de('0x2d')](function(_0x911b58){if(_0x911b58){_0x1ff6b5=_0x911b58[_0xf5de('0x3f')];if(!_0x164fd5[_0xf5de('0x39')][_0xf5de('0x59')]('nolimit')){_0x453a9a[_0xf5de('0x24')]=qs[_0xf5de('0x24')](_0x164fd5[_0xf5de('0x39')][_0xf5de('0x24')]);_0x453a9a[_0xf5de('0x22')]=qs['offset'](_0x164fd5[_0xf5de('0x39')][_0xf5de('0x22')]);}return _0x526d4d['getMembers'](_0x453a9a);}})[_0xf5de('0x2d')](function(_0xc5ca21){if(_0xc5ca21){return _0xc5ca21?{'count':_0x1ff6b5,'rows':_0xc5ca21}:null;}})[_0xf5de('0x2d')](respondWithResult(_0x1fc2cd,null))[_0xf5de('0x49')](handleError(_0x1fc2cd,null));};exports[_0xf5de('0x5a')]=function(_0x22345c,_0x23df7f,_0x45e577){return db['ChatGroup'][_0xf5de('0x4d')]({'where':{'id':_0x22345c[_0xf5de('0x4b')]['id']}})[_0xf5de('0x2d')](handleEntityNotFound(_0x23df7f,null))[_0xf5de('0x2d')](function(_0x5e8ab5){if(_0x5e8ab5){return _0x5e8ab5[_0xf5de('0x5a')](_0x22345c[_0xf5de('0x39')][_0xf5de('0x55')]);}})[_0xf5de('0x2d')](respondWithStatusCode(_0x23df7f,null))[_0xf5de('0x49')](handleError(_0x23df7f,null));};exports[_0xf5de('0x5b')]=function(_0x24936e,_0x41586b,_0x263474){if(_0x24936e[_0xf5de('0x4f')]['id']){delete _0x24936e[_0xf5de('0x4f')]['id'];}return db[_0xf5de('0x34')]['find']({'where':{'id':_0x24936e['params']['id']}})[_0xf5de('0x2d')](handleEntityNotFound(_0x41586b,null))[_0xf5de('0x2d')](function(_0x21cac8){if(_0x21cac8){_0x24936e[_0xf5de('0x4f')][_0xf5de('0x5c')]=_0x21cac8['id'];return db['ChatInternalMessage']['create'](_0x24936e[_0xf5de('0x4f')]);}})[_0xf5de('0x2d')](respondWithResult(_0x41586b,null))[_0xf5de('0x49')](handleError(_0x41586b,null));};exports[_0xf5de('0x5d')]=function(_0x249a32,_0x446fd7,_0x424d72){var _0x48f3c9={};var _0x52c8a4={};var _0x20c5b6;var _0xc4b1c0;return db['ChatGroup'][_0xf5de('0x5e')]({'where':{'id':_0x249a32[_0xf5de('0x4b')]['id']}})[_0xf5de('0x2d')](handleEntityNotFound(_0x446fd7,null))['then'](function(_0x21245f){if(_0x21245f){_0x20c5b6=_0x21245f;_0x52c8a4[_0xf5de('0x38')]=_[_0xf5de('0x3a')](db[_0xf5de('0x52')][_0xf5de('0x35')]);_0x52c8a4['query']=_[_0xf5de('0x3a')](_0x249a32[_0xf5de('0x39')]);_0x52c8a4[_0xf5de('0x3b')]=_[_0xf5de('0x3c')](_0x52c8a4[_0xf5de('0x38')],_0x52c8a4[_0xf5de('0x39')]);_0x48f3c9['attributes']=_['intersection'](_0x52c8a4[_0xf5de('0x38')],qs['fields'](_0x249a32[_0xf5de('0x39')][_0xf5de('0x3e')]));_0x48f3c9[_0xf5de('0x3d')]=_0x48f3c9[_0xf5de('0x3d')]['length']?_0x48f3c9['attributes']:_0x52c8a4[_0xf5de('0x38')];_0x48f3c9['order']=qs['sort'](_0x249a32[_0xf5de('0x39')][_0xf5de('0x41')]);_0x48f3c9[_0xf5de('0x42')]=qs[_0xf5de('0x3b')](_[_0xf5de('0x43')](_0x249a32[_0xf5de('0x39')],_0x52c8a4[_0xf5de('0x3b')]));if(_0x249a32[_0xf5de('0x39')][_0xf5de('0x44')]){_0x48f3c9[_0xf5de('0x42')]=_['merge'](_0x48f3c9[_0xf5de('0x42')],{'$or':_[_0xf5de('0x33')](_0x48f3c9[_0xf5de('0x3d')],function(_0x2a854a){var _0x53af41={};_0x53af41[_0x2a854a]={'$like':'%'+_0x249a32['query'][_0xf5de('0x44')]+'%'};return _0x53af41;})});}if(_0x249a32[_0xf5de('0x39')][_0xf5de('0x5f')]){var _0x5f8c28=_0x249a32[_0xf5de('0x39')][_0xf5de('0x5f')][_0xf5de('0x60')](',');var _0x45ff05={};_0x45ff05[_0x5f8c28[0x0]]={'$gte':moment(_0x5f8c28[0x1])[_0xf5de('0x61')](_0xf5de('0x62'))};_0x48f3c9[_0xf5de('0x42')]=_[_0xf5de('0x45')](_0x48f3c9['where'],_0x45ff05);}_0x48f3c9=_['merge']({},_0x48f3c9,_0x249a32['options']);return _0x20c5b6[_0xf5de('0x5d')](_0x48f3c9);}})[_0xf5de('0x2d')](function(_0x2477ba){if(_0x2477ba){_0xc4b1c0=_0x2477ba['length'];if(!_0x249a32[_0xf5de('0x39')]['hasOwnProperty'](_0xf5de('0x40'))){_0x48f3c9['limit']=qs[_0xf5de('0x24')](_0x249a32[_0xf5de('0x39')][_0xf5de('0x24')]);_0x48f3c9[_0xf5de('0x22')]=qs[_0xf5de('0x22')](_0x249a32[_0xf5de('0x39')][_0xf5de('0x22')]);}return _0x20c5b6[_0xf5de('0x5d')](_0x48f3c9);}})[_0xf5de('0x2d')](function(_0x220c54){if(_0x220c54){return _0x220c54?{'count':_0xc4b1c0,'rows':_0x220c54}:null;}})['then'](respondWithResult(_0x446fd7,null))['catch'](handleError(_0x446fd7,null));}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.events.js b/server/api/chatGroup/chatGroup.events.js index a0a7731..01e37d0 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 _0xc376=['hook','exports','../../mysqldb','save','update','remove','emit'];(function(_0x576e2b,_0x328953){var _0x46461a=function(_0xce4d9e){while(--_0xce4d9e){_0x576e2b['push'](_0x576e2b['shift']());}};_0x46461a(++_0x328953);}(_0xc376,0x14b));var _0x6c37=function(_0x5e6cb8,_0x16cf56){_0x5e6cb8=_0x5e6cb8-0x0;var _0x3faeb3=_0xc376[_0x5e6cb8];return _0x3faeb3;};'use strict';var EventEmitter=require('events');var ChatGroup=require(_0x6c37('0x0'))['db']['ChatGroup'];var ChatGroupEvents=new EventEmitter();ChatGroupEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6c37('0x1'),'afterUpdate':_0x6c37('0x2'),'afterDestroy':_0x6c37('0x3')};function emitEvent(_0x40031c){return function(_0x47f6fb,_0x42aced,_0x5dfa69){ChatGroupEvents[_0x6c37('0x4')](_0x40031c+':'+_0x47f6fb['id'],_0x47f6fb);ChatGroupEvents[_0x6c37('0x4')](_0x40031c,_0x47f6fb);_0x5dfa69(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatGroup[_0x6c37('0x5')](e,emitEvent(event));}}module[_0x6c37('0x6')]=ChatGroupEvents; \ No newline at end of file +var _0xf55c=['exports','events','ChatGroup','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x172a45,_0xdcfdb1){var _0x2ece46=function(_0x5be386){while(--_0x5be386){_0x172a45['push'](_0x172a45['shift']());}};_0x2ece46(++_0xdcfdb1);}(_0xf55c,0x1e7));var _0xcf55=function(_0x220dbb,_0x99328d){_0x220dbb=_0x220dbb-0x0;var _0x2b77de=_0xf55c[_0x220dbb];return _0x2b77de;};'use strict';var EventEmitter=require(_0xcf55('0x0'));var ChatGroup=require('../../mysqldb')['db'][_0xcf55('0x1')];var ChatGroupEvents=new EventEmitter();ChatGroupEvents[_0xcf55('0x2')](0x0);var events={'afterCreate':_0xcf55('0x3'),'afterUpdate':_0xcf55('0x4'),'afterDestroy':_0xcf55('0x5')};function emitEvent(_0x2c24c8){return function(_0x3cd699,_0x5d1baf,_0x2bff1a){ChatGroupEvents[_0xcf55('0x6')](_0x2c24c8+':'+_0x3cd699['id'],_0x3cd699);ChatGroupEvents[_0xcf55('0x6')](_0x2c24c8,_0x3cd699);_0x2bff1a(null);};}for(var e in events){if(events[_0xcf55('0x7')](e)){var event=events[e];ChatGroup['hook'](e,emitEvent(event));}}module[_0xcf55('0x8')]=ChatGroupEvents; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.model.js b/server/api/chatGroup/chatGroup.model.js index f426a7a..8e52307 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 _0x76a5=['ChatGroup','chat_groups','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define'];(function(_0xbfb72,_0x112b64){var _0x4a4476=function(_0xa544b7){while(--_0xa544b7){_0xbfb72['push'](_0xbfb72['shift']());}};_0x4a4476(++_0x112b64);}(_0x76a5,0x1a2));var _0x576a=function(_0x180216,_0x4ea427){_0x180216=_0x180216-0x0;var _0x2fc363=_0x76a5[_0x180216];return _0x2fc363;};'use strict';var _=require(_0x576a('0x0'));var util=require(_0x576a('0x1'));var logger=require(_0x576a('0x2'))(_0x576a('0x3'));var moment=require(_0x576a('0x4'));var BPromise=require(_0x576a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x576a('0x6'));var rimraf=require(_0x576a('0x7'));var config=require(_0x576a('0x8'));var attributes=require('./chatGroup.attributes');module[_0x576a('0x9')]=function(_0x2b36da,_0x1aa5f5){return _0x2b36da[_0x576a('0xa')](_0x576a('0xb'),attributes,{'tableName':_0x576a('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb9dd=['exports','define','ChatGroup','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./chatGroup.attributes'];(function(_0x10e31a,_0x6a302d){var _0xa3e8a0=function(_0x581919){while(--_0x581919){_0x10e31a['push'](_0x10e31a['shift']());}};_0xa3e8a0(++_0x6a302d);}(_0xb9dd,0x16f));var _0xdb9d=function(_0x13035d,_0x15a2a8){_0x13035d=_0x13035d-0x0;var _0x3ae36d=_0xb9dd[_0x13035d];return _0x3ae36d;};'use strict';var _=require(_0xdb9d('0x0'));var util=require(_0xdb9d('0x1'));var logger=require(_0xdb9d('0x2'))(_0xdb9d('0x3'));var moment=require(_0xdb9d('0x4'));var BPromise=require(_0xdb9d('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xdb9d('0x6'));var rimraf=require(_0xdb9d('0x7'));var config=require(_0xdb9d('0x8'));var attributes=require(_0xdb9d('0x9'));module[_0xdb9d('0xa')]=function(_0x2d4bcc,_0x1fce08){return _0x2d4bcc[_0xdb9d('0xb')](_0xdb9d('0xc'),attributes,{'tableName':'chat_groups','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.rpc.js b/server/api/chatGroup/chatGroup.rpc.js index 16c7b40..deb7fcf 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 _0x0298=['request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','stringify','error','code','ChatGroup,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','request','then','info'];(function(_0x56c1ab,_0x100638){var _0x564b35=function(_0x49927e){while(--_0x49927e){_0x56c1ab['push'](_0x56c1ab['shift']());}};_0x564b35(++_0x100638);}(_0x0298,0x95));var _0x8029=function(_0x14f41c,_0x3becf3){_0x14f41c=_0x14f41c-0x0;var _0x18fcd8=_0x0298[_0x14f41c];return _0x18fcd8;};'use strict';var _=require(_0x8029('0x0'));var util=require('util');var moment=require(_0x8029('0x1'));var BPromise=require(_0x8029('0x2'));var rs=require(_0x8029('0x3'));var fs=require('fs');var Redis=require(_0x8029('0x4'));var db=require(_0x8029('0x5'))['db'];var utils=require(_0x8029('0x6'));var logger=require(_0x8029('0x7'))(_0x8029('0x8'));var config=require(_0x8029('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x8029('0xa')][_0x8029('0xb')]({'port':0x232a});config['redis']=_[_0x8029('0xc')](config[_0x8029('0xd')],{'host':_0x8029('0xe'),'port':0x18eb});var socket=require(_0x8029('0xf'))(new Redis(config[_0x8029('0xd')]));require('./chatGroup.socket')['register'](socket);function respondWithRpcPromise(_0x1a94ef,_0x1b93b9,_0x288b07){return new BPromise(function(_0x4ebfb4,_0x56e850){return client[_0x8029('0x10')](_0x1a94ef,_0x288b07)[_0x8029('0x11')](function(_0x4943a3){logger[_0x8029('0x12')]('ChatGroup,\x20%s,\x20%s',_0x1b93b9,_0x8029('0x13'));logger[_0x8029('0x14')](_0x8029('0x15'),_0x1b93b9,_0x8029('0x13'),JSON[_0x8029('0x16')](_0x4943a3));if(_0x4943a3[_0x8029('0x17')]){if(_0x4943a3['error'][_0x8029('0x18')]===0x1f4){logger[_0x8029('0x17')](_0x8029('0x19'),_0x1b93b9,_0x4943a3[_0x8029('0x17')]['message']);return _0x56e850(_0x4943a3['error']['message']);}logger[_0x8029('0x17')](_0x8029('0x19'),_0x1b93b9,_0x4943a3[_0x8029('0x17')][_0x8029('0x1a')]);return _0x4ebfb4(_0x4943a3[_0x8029('0x17')][_0x8029('0x1a')]);}else{logger['info'](_0x8029('0x19'),_0x1b93b9,_0x8029('0x13'));_0x4ebfb4(_0x4943a3[_0x8029('0x1b')][_0x8029('0x1a')]);}})['catch'](function(_0x3e3ab2){logger[_0x8029('0x17')]('ChatGroup,\x20%s,\x20%s',_0x1b93b9,_0x3e3ab2);_0x56e850(_0x3e3ab2);});});} \ No newline at end of file +var _0x34d2=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./chatGroup.socket','info','ChatGroup,\x20%s,\x20%s','request\x20sent','debug','ChatGroup,\x20%s,\x20%s,\x20%s','error','message','result','catch','util','moment'];(function(_0x2f6d5c,_0x3d1c70){var _0xbc4e8=function(_0x273a34){while(--_0x273a34){_0x2f6d5c['push'](_0x2f6d5c['shift']());}};_0xbc4e8(++_0x3d1c70);}(_0x34d2,0x7b));var _0x234d=function(_0x2d2846,_0x21c4b7){_0x2d2846=_0x2d2846-0x0;var _0x4ecb5b=_0x34d2[_0x2d2846];return _0x4ecb5b;};'use strict';var _=require('lodash');var util=require(_0x234d('0x0'));var moment=require(_0x234d('0x1'));var BPromise=require(_0x234d('0x2'));var rs=require(_0x234d('0x3'));var fs=require('fs');var Redis=require(_0x234d('0x4'));var db=require(_0x234d('0x5'))['db'];var utils=require(_0x234d('0x6'));var logger=require(_0x234d('0x7'))('rpc');var config=require(_0x234d('0x8'));var jayson=require(_0x234d('0x9'));var client=jayson['client'][_0x234d('0xa')]({'port':0x232a});config[_0x234d('0xb')]=_[_0x234d('0xc')](config[_0x234d('0xb')],{'host':_0x234d('0xd'),'port':0x18eb});var socket=require(_0x234d('0xe'))(new Redis(config[_0x234d('0xb')]));require(_0x234d('0xf'))['register'](socket);function respondWithRpcPromise(_0x5d25c9,_0x4d8b16,_0x4f6810){return new BPromise(function(_0x50fdaa,_0x48d44e){return client['request'](_0x5d25c9,_0x4f6810)['then'](function(_0x3ed84f){logger[_0x234d('0x10')](_0x234d('0x11'),_0x4d8b16,_0x234d('0x12'));logger[_0x234d('0x13')](_0x234d('0x14'),_0x4d8b16,'request\x20sent',JSON['stringify'](_0x3ed84f));if(_0x3ed84f['error']){if(_0x3ed84f['error']['code']===0x1f4){logger['error'](_0x234d('0x11'),_0x4d8b16,_0x3ed84f[_0x234d('0x15')][_0x234d('0x16')]);return _0x48d44e(_0x3ed84f['error'][_0x234d('0x16')]);}logger[_0x234d('0x15')](_0x234d('0x11'),_0x4d8b16,_0x3ed84f['error']['message']);return _0x50fdaa(_0x3ed84f['error']['message']);}else{logger[_0x234d('0x10')](_0x234d('0x11'),_0x4d8b16,_0x234d('0x12'));_0x50fdaa(_0x3ed84f[_0x234d('0x17')][_0x234d('0x16')]);}})[_0x234d('0x18')](function(_0x2b4ed2){logger[_0x234d('0x15')](_0x234d('0x11'),_0x4d8b16,_0x2b4ed2);_0x48d44e(_0x2b4ed2);});});} \ No newline at end of file diff --git a/server/api/chatGroup/chatGroup.socket.js b/server/api/chatGroup/chatGroup.socket.js index c84b88f..87827af 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 _0x36dd=['save','remove','update','register','length','./chatGroup.events'];(function(_0x2b6e53,_0x4ed0d2){var _0x35bab1=function(_0x138843){while(--_0x138843){_0x2b6e53['push'](_0x2b6e53['shift']());}};_0x35bab1(++_0x4ed0d2);}(_0x36dd,0x1f1));var _0xd36d=function(_0x479160,_0x3ab560){_0x479160=_0x479160-0x0;var _0x47ac6d=_0x36dd[_0x479160];return _0x47ac6d;};'use strict';var ChatGroupEvents=require(_0xd36d('0x0'));var events=[_0xd36d('0x1'),_0xd36d('0x2'),_0xd36d('0x3')];function createListener(_0x1ac633,_0x2ea9bc){return function(_0x3de051){_0x2ea9bc['emit'](_0x1ac633,_0x3de051);};}function removeListener(_0x10e576,_0x462d98){return function(){ChatGroupEvents['removeListener'](_0x10e576,_0x462d98);};}exports[_0xd36d('0x4')]=function(_0x55a41f){for(var _0x1a937c=0x0,_0x3a7afd=events[_0xd36d('0x5')];_0x1a937c<_0x3a7afd;_0x1a937c++){var _0x1e06c6=events[_0x1a937c];var _0x239b84=createListener('chatGroup:'+_0x1e06c6,_0x55a41f);ChatGroupEvents['on'](_0x1e06c6,_0x239b84);}}; \ No newline at end of file +var _0xe9c0=['chatGroup:','./chatGroup.events','emit','removeListener','register','length'];(function(_0x1d13b4,_0x49e300){var _0x29059e=function(_0x74e05c){while(--_0x74e05c){_0x1d13b4['push'](_0x1d13b4['shift']());}};_0x29059e(++_0x49e300);}(_0xe9c0,0xaf));var _0x0e9c=function(_0x13c729,_0x5bea49){_0x13c729=_0x13c729-0x0;var _0x3673c5=_0xe9c0[_0x13c729];return _0x3673c5;};'use strict';var ChatGroupEvents=require(_0x0e9c('0x0'));var events=['save','remove','update'];function createListener(_0x2752b5,_0x8f5833){return function(_0x14b5aa){_0x8f5833[_0x0e9c('0x1')](_0x2752b5,_0x14b5aa);};}function removeListener(_0x44024b,_0xd1b8){return function(){ChatGroupEvents[_0x0e9c('0x2')](_0x44024b,_0xd1b8);};}exports[_0x0e9c('0x3')]=function(_0x526c98){for(var _0x27335d=0x0,_0x214160=events[_0x0e9c('0x4')];_0x27335d<_0x214160;_0x27335d++){var _0x3a2bc7=events[_0x27335d];var _0x4ad6ee=createListener(_0x0e9c('0x5')+_0x3a2bc7,_0x526c98);ChatGroupEvents['on'](_0x3a2bc7,_0x4ad6ee);}}; \ No newline at end of file diff --git a/server/api/chatGroup/index.js b/server/api/chatGroup/index.js index 2bb5bdb..ae3558c 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 _0x3aac=['../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/unread','getUnread','getMembers','/:id/messages','getMessages','post','/:id/members','addMembers','addMessage','put','update','delete','destroy','removeMembers','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x313c96,_0x3cee6e){var _0x522f53=function(_0x8961e){while(--_0x8961e){_0x313c96['push'](_0x313c96['shift']());}};_0x522f53(++_0x3cee6e);}(_0x3aac,0x1bb));var _0xc3aa=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x3aac[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc3aa('0x0'));var timeout=require(_0xc3aa('0x1'));var express=require(_0xc3aa('0x2'));var router=express[_0xc3aa('0x3')]();var fs_extra=require(_0xc3aa('0x4'));var auth=require(_0xc3aa('0x5'));var interaction=require(_0xc3aa('0x6'));var config=require(_0xc3aa('0x7'));var controller=require('./chatGroup.controller');router[_0xc3aa('0x8')]('/',auth[_0xc3aa('0x9')](),controller[_0xc3aa('0xa')]);router[_0xc3aa('0x8')](_0xc3aa('0xb'),auth['isAuthenticated'](),controller[_0xc3aa('0xc')]);router[_0xc3aa('0x8')](_0xc3aa('0xd'),auth[_0xc3aa('0x9')](),controller[_0xc3aa('0xe')]);router[_0xc3aa('0x8')](_0xc3aa('0xf'),auth[_0xc3aa('0x9')](),controller[_0xc3aa('0x10')]);router[_0xc3aa('0x8')]('/:id/members',auth[_0xc3aa('0x9')](),controller[_0xc3aa('0x11')]);router[_0xc3aa('0x8')](_0xc3aa('0x12'),auth['isAuthenticated'](),controller[_0xc3aa('0x13')]);router[_0xc3aa('0x14')]('/',auth[_0xc3aa('0x9')](),controller['create']);router[_0xc3aa('0x14')](_0xc3aa('0x15'),auth[_0xc3aa('0x9')](),controller[_0xc3aa('0x16')]);router[_0xc3aa('0x14')](_0xc3aa('0x12'),auth[_0xc3aa('0x9')](),controller[_0xc3aa('0x17')]);router[_0xc3aa('0x18')](_0xc3aa('0xd'),auth[_0xc3aa('0x9')](),controller[_0xc3aa('0x19')]);router[_0xc3aa('0x1a')]('/:id',auth[_0xc3aa('0x9')](),controller[_0xc3aa('0x1b')]);router[_0xc3aa('0x1a')](_0xc3aa('0x15'),auth[_0xc3aa('0x9')](),controller[_0xc3aa('0x1c')]);module[_0xc3aa('0x1d')]=router; \ No newline at end of file +var _0xbeec=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','./chatGroup.controller','get','index','/describe','/:id','isAuthenticated','show','getUnread','/:id/members','/:id/messages','getMessages','post','create','addMembers','put'];(function(_0x41d2d4,_0x12bcf4){var _0x225e0f=function(_0x8464f5){while(--_0x8464f5){_0x41d2d4['push'](_0x41d2d4['shift']());}};_0x225e0f(++_0x12bcf4);}(_0xbeec,0x122));var _0xcbee=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xbeec[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require(_0xcbee('0x0'));var util=require(_0xcbee('0x1'));var path=require(_0xcbee('0x2'));var timeout=require(_0xcbee('0x3'));var express=require(_0xcbee('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xcbee('0x5'));var interaction=require(_0xcbee('0x6'));var config=require('../../config/environment');var controller=require(_0xcbee('0x7'));router[_0xcbee('0x8')]('/',auth['isAuthenticated'](),controller[_0xcbee('0x9')]);router['get'](_0xcbee('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0xcbee('0x8')](_0xcbee('0xb'),auth[_0xcbee('0xc')](),controller[_0xcbee('0xd')]);router[_0xcbee('0x8')]('/:id/unread',auth['isAuthenticated'](),controller[_0xcbee('0xe')]);router['get'](_0xcbee('0xf'),auth[_0xcbee('0xc')](),controller['getMembers']);router[_0xcbee('0x8')](_0xcbee('0x10'),auth[_0xcbee('0xc')](),controller[_0xcbee('0x11')]);router[_0xcbee('0x12')]('/',auth[_0xcbee('0xc')](),controller[_0xcbee('0x13')]);router[_0xcbee('0x12')]('/:id/members',auth[_0xcbee('0xc')](),controller[_0xcbee('0x14')]);router[_0xcbee('0x12')](_0xcbee('0x10'),auth[_0xcbee('0xc')](),controller['addMessage']);router[_0xcbee('0x15')](_0xcbee('0xb'),auth[_0xcbee('0xc')](),controller[_0xcbee('0x16')]);router[_0xcbee('0x17')](_0xcbee('0xb'),auth[_0xcbee('0xc')](),controller[_0xcbee('0x18')]);router['delete'](_0xcbee('0xf'),auth['isAuthenticated'](),controller['removeMembers']);module[_0xcbee('0x19')]=router; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.attributes.js b/server/api/chatInteraction/chatInteraction.attributes.js index fa3fb2b..b27a3fb 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 _0x1678=['exports','BOOLEAN','INTEGER','ENUM','star','TEXT','STRING','DATE','long','sequelize'];(function(_0x35007a,_0x58a0d4){var _0x574f68=function(_0xd1c129){while(--_0xd1c129){_0x35007a['push'](_0x35007a['shift']());}};_0x574f68(++_0x58a0d4);}(_0x1678,0x17b));var _0x8167=function(_0x17a09d,_0x1ed2f1){_0x17a09d=_0x17a09d-0x0;var _0x31a422=_0x1678[_0x17a09d];return _0x31a422;};'use strict';var Sequelize=require(_0x8167('0x0'));module[_0x8167('0x1')]={'closed':{'type':Sequelize[_0x8167('0x2')],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x8167('0x3')]},'ratingType':{'type':Sequelize[_0x8167('0x4')]('star','thumb'),'defaultValue':_0x8167('0x5')},'ratingMessage':{'type':Sequelize[_0x8167('0x6')]},'pathTranscript':{'type':Sequelize[_0x8167('0x6')]},'mailTranscript':{'type':Sequelize[_0x8167('0x7')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize[_0x8167('0x8')]},'disposition':{'type':Sequelize[_0x8167('0x7')]},'secondDisposition':{'type':Sequelize[_0x8167('0x7')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x8167('0x7')]},'browserName':{'type':Sequelize[_0x8167('0x7')]},'browserVersion':{'type':Sequelize[_0x8167('0x7')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize[_0x8167('0x7')]},'deviceVendor':{'type':Sequelize[_0x8167('0x7')]},'deviceType':{'type':Sequelize['STRING']},'referer':{'type':Sequelize[_0x8167('0x6')]},'customerIp':{'type':Sequelize[_0x8167('0x7')]},'formData':{'type':Sequelize[_0x8167('0x6')](_0x8167('0x9'))},'read1stAt':{'type':Sequelize[_0x8167('0x8')]},'lastMsgAt':{'type':Sequelize[_0x8167('0x8')]},'lastMsgDirection':{'type':Sequelize[_0x8167('0x4')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize['STRING']},'customerPort':{'type':Sequelize[_0x8167('0x7')]},'vidaooSessionId':{'type':Sequelize['TEXT']},'autoreplyExecuted':{'type':Sequelize[_0x8167('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0x49f8=['long','DATE','BOOLEAN','sequelize','INTEGER','ENUM','thumb','TEXT','STRING'];(function(_0x486043,_0x58dad9){var _0x2c0a3b=function(_0x2bad97){while(--_0x2bad97){_0x486043['push'](_0x486043['shift']());}};_0x2c0a3b(++_0x58dad9);}(_0x49f8,0xff));var _0x849f=function(_0x9b6cd6,_0x360ac0){_0x9b6cd6=_0x9b6cd6-0x0;var _0x7c35a2=_0x49f8[_0x9b6cd6];return _0x7c35a2;};'use strict';var Sequelize=require(_0x849f('0x0'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'ratingValue':{'type':Sequelize[_0x849f('0x1')]},'ratingType':{'type':Sequelize[_0x849f('0x2')]('star',_0x849f('0x3')),'defaultValue':'star'},'ratingMessage':{'type':Sequelize[_0x849f('0x4')]},'pathTranscript':{'type':Sequelize['TEXT']},'mailTranscript':{'type':Sequelize[_0x849f('0x5')],'validate':{'isEmail':!![]}},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x849f('0x5')]},'secondDisposition':{'type':Sequelize[_0x849f('0x5')]},'thirdDisposition':{'type':Sequelize[_0x849f('0x5')]},'note':{'type':Sequelize[_0x849f('0x5')]},'browserName':{'type':Sequelize[_0x849f('0x5')]},'browserVersion':{'type':Sequelize[_0x849f('0x5')]},'osName':{'type':Sequelize['STRING']},'osVersion':{'type':Sequelize['STRING']},'deviceModel':{'type':Sequelize['STRING']},'deviceVendor':{'type':Sequelize[_0x849f('0x5')]},'deviceType':{'type':Sequelize[_0x849f('0x5')]},'referer':{'type':Sequelize[_0x849f('0x4')]},'customerIp':{'type':Sequelize[_0x849f('0x5')]},'formData':{'type':Sequelize[_0x849f('0x4')](_0x849f('0x6'))},'read1stAt':{'type':Sequelize[_0x849f('0x7')]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x849f('0x2')]('in','out'),'defaultValue':'in','allowNull':![]},'closeReason':{'type':Sequelize[_0x849f('0x5')]},'customerPort':{'type':Sequelize[_0x849f('0x5')]},'vidaooSessionId':{'type':Sequelize[_0x849f('0x4')]},'autoreplyExecuted':{'type':Sequelize[_0x849f('0x8')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.controller.js b/server/api/chatInteraction/chatInteraction.controller.js index 0d5c816..25ecd3d 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 _0xfa91=['files','tmp','attachments','lastName','Attachment','read','Account','Owner','get','mkdirSync','Chat','toString','closedAt','disposition','browserName','osName','referer','customerIp','tail','createReadStream','pipe','firstName','value','renderFile','downloadInteraction.ejs','.pdf','createPdfFromHTML','err','unlinkSync','rimraf','zip-dir','request-promise','moment','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./chatInteraction.socket','register','jayson/promise','http','client','request','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','debug','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','destroy','name','send','render','merge','body','contact','agent','interaction','account','index','map','ChatInteraction','rawAttributes','fieldName','type','key','getOptions','findAll','chat','show','params','model','keys','query','intersection','attributes','fields','length','include','options','create','find','describe','findOne','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooTopic','vidaooMetadata','user','fullname','email','POST','vidaooNote','follow','isNull','parse','metadata','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Sequelize','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','updateAttributes','customUpdate','Contact','abandonInteraction,\x20%s,\x20%s,\x20%s','abandon','Interaction\x20already\x20assigned','closed','AbandonInteraction','attachmentUpload','file','originalname','basename','attachmentDownload','Unauthorized','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','download','close','mailTranscript','root','server/files/chat/upload/','format','transcript-%s.txt','now','pathTranscript','Messages','User','CmContact','ContactId','UserId','%s%d','agentAlias','System','Visitor','agentIdentifier','website_alias','agent_alias','alias','agent_fullname','[%s]\x20%s:\x20%s\x0a','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','CloudProvider','Smtp','getSmtpOptions','SendMail','sendMail','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','filters','hasOwnProperty','nolimit','order','sort','pick','where','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','includeAll','rows','getMyMessages','includeAgent','push','addTags','setTags','omit','Tag','color','emit','removeTags','unix','server'];(function(_0x261d17,_0x115fe1){var _0x5a50da=function(_0x409fc0){while(--_0x409fc0){_0x261d17['push'](_0x261d17['shift']());}};_0x5a50da(++_0x115fe1);}(_0xfa91,0x1cd));var _0x1fa9=function(_0x465a0c,_0x19d4d5){_0x465a0c=_0x465a0c-0x0;var _0x1e202e=_0xfa91[_0x465a0c];return _0x1e202e;};'use strict';var rimraf=require(_0x1fa9('0x0'));var zipdir=require(_0x1fa9('0x1'));var rp=require(_0x1fa9('0x2'));var moment=require(_0x1fa9('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x1fa9('0x4'));var path=require(_0x1fa9('0x5'));var ejs=require(_0x1fa9('0x6'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x1fa9('0x7'));var interaction=require(_0x1fa9('0x8'));var qs=require(_0x1fa9('0x9'));var pdf=require(_0x1fa9('0xa'));var logger=require(_0x1fa9('0xb'))(_0x1fa9('0xc'));var config=require(_0x1fa9('0xd'));var db=require(_0x1fa9('0xe'))['db'];config[_0x1fa9('0xf')]=_['defaults'](config['redis'],{'host':_0x1fa9('0x10'),'port':0x18eb});var socket=require(_0x1fa9('0x11'))(new Redis(config['redis']));require(_0x1fa9('0x12'))[_0x1fa9('0x13')](socket);var jayson=require(_0x1fa9('0x14'));var client=jayson['client'][_0x1fa9('0x15')]({'port':0x232b});var client9004=jayson[_0x1fa9('0x16')][_0x1fa9('0x15')]({'port':0x232c});function respondWithRpcPromise(_0x5bc1cf,_0x1e61bd,_0x18c54f,_0x27208c){return new BPromise(function(_0x7d865f,_0x38eb26){var _0x37cc46=_0x27208c||client;return _0x37cc46[_0x1fa9('0x17')](_0x5bc1cf,_0x18c54f)[_0x1fa9('0x18')](function(_0x28fd97){logger[_0x1fa9('0x19')](_0x1fa9('0x1a'),_0x1e61bd,_0x1fa9('0x1b'));logger[_0x1fa9('0x1c')](_0x1fa9('0x1d'),_0x1e61bd,_0x1fa9('0x1b'),JSON[_0x1fa9('0x1e')](_0x28fd97));if(_0x28fd97[_0x1fa9('0x1f')]){if(_0x28fd97[_0x1fa9('0x1f')][_0x1fa9('0x20')]===0x1f4){logger['error'](_0x1fa9('0x1a'),_0x1e61bd,_0x28fd97[_0x1fa9('0x1f')][_0x1fa9('0x21')]);return _0x38eb26(_0x28fd97[_0x1fa9('0x1f')][_0x1fa9('0x21')]);}logger[_0x1fa9('0x1f')]('ChatInteraction,\x20%s,\x20%s',_0x1e61bd,_0x28fd97[_0x1fa9('0x1f')]['message']);return _0x7d865f(_0x28fd97[_0x1fa9('0x1f')]['message']);}else{logger[_0x1fa9('0x19')](_0x1fa9('0x1a'),_0x1e61bd,_0x1fa9('0x1b'));_0x7d865f(_0x28fd97[_0x1fa9('0x22')][_0x1fa9('0x21')]);}})[_0x1fa9('0x23')](function(_0x5419b3){logger[_0x1fa9('0x1f')](_0x1fa9('0x1a'),_0x1e61bd,_0x5419b3);_0x38eb26(_0x5419b3);});});}function respondWithStatusCode(_0x451dc8,_0x153b94){_0x153b94=_0x153b94||0xcc;return function(_0xdbead7){if(_0xdbead7){return _0x451dc8[_0x1fa9('0x24')](_0x153b94);}return _0x451dc8[_0x1fa9('0x25')](_0x153b94)[_0x1fa9('0x26')]();};}function respondWithResult(_0x5a5dad,_0x3d8ff6){_0x3d8ff6=_0x3d8ff6||0xc8;return function(_0x24234f){if(_0x24234f){return _0x5a5dad[_0x1fa9('0x25')](_0x3d8ff6)[_0x1fa9('0x27')](_0x24234f);}};}function respondWithFilteredResult(_0x311f82,_0x3ad311){return function(_0x32fd3a){if(_0x32fd3a){var _0x4d86d8=typeof _0x3ad311[_0x1fa9('0x28')]===_0x1fa9('0x29')&&typeof _0x3ad311[_0x1fa9('0x2a')]===_0x1fa9('0x29');var _0x2e15d6=_0x32fd3a[_0x1fa9('0x2b')];var _0x3bbbd2=_0x4d86d8?0x0:_0x3ad311[_0x1fa9('0x28')];var _0x4532fa=_0x4d86d8?_0x32fd3a[_0x1fa9('0x2b')]:_0x3ad311[_0x1fa9('0x28')]+_0x3ad311['limit'];var _0x2e4246;if(_0x4532fa>=_0x2e15d6){_0x4532fa=_0x2e15d6;_0x2e4246=0xc8;}else{_0x2e4246=0xce;}_0x311f82[_0x1fa9('0x25')](_0x2e4246);return _0x311f82[_0x1fa9('0x2c')](_0x1fa9('0x2d'),_0x3bbbd2+'-'+_0x4532fa+'/'+_0x2e15d6)['json'](_0x32fd3a);}return null;};}function saveUpdates(_0x39267d){return function(_0x23164f){if(_0x23164f){return _0x23164f[_0x1fa9('0x2e')](_0x39267d)[_0x1fa9('0x18')](function(_0x40f21a){return _0x40f21a;});}return null;};}function removeEntity(_0x317dc2){return function(_0xe4a639){if(_0xe4a639){return _0xe4a639[_0x1fa9('0x2f')]()[_0x1fa9('0x18')](function(){_0x317dc2['status'](0xcc)[_0x1fa9('0x26')]();});}};}function handleEntityNotFound(_0x1a774f){return function(_0xf5d196){if(!_0xf5d196){_0x1a774f[_0x1fa9('0x24')](0x194);}return _0xf5d196;};}function handleError(_0x41d9ef,_0x14c0a2){_0x14c0a2=_0x14c0a2||0x1f4;return function(_0x4df67a){logger[_0x1fa9('0x1f')](_0x4df67a['stack']);if(_0x4df67a[_0x1fa9('0x30')]){delete _0x4df67a[_0x1fa9('0x30')];}_0x41d9ef[_0x1fa9('0x25')](_0x14c0a2)[_0x1fa9('0x31')](_0x4df67a);};}function getMustacheRender(_0x2d4062,_0x4c9722){return Mustache[_0x1fa9('0x32')](_0x2d4062,_[_0x1fa9('0x33')](_0x4c9722[_0x1fa9('0x34')],{'contact':_0x4c9722[_0x1fa9('0x35')],'message':_0x4c9722[_0x1fa9('0x21')],'agent':_0x4c9722[_0x1fa9('0x36')],'interaction':_0x4c9722[_0x1fa9('0x37')],'account':_0x4c9722[_0x1fa9('0x38')]}))||'';}exports[_0x1fa9('0x39')]=function(_0x40d90a,_0xa2f99c){var _0x2dcdd7={};var _0x3e4759=_[_0x1fa9('0x3a')](db[_0x1fa9('0x3b')][_0x1fa9('0x3c')],function(_0x1ade1d){return{'name':_0x1ade1d[_0x1fa9('0x3d')],'type':_0x1ade1d[_0x1fa9('0x3e')][_0x1fa9('0x3f')]};});_0x2dcdd7=qs[_0x1fa9('0x40')](_0x3e4759,_0x40d90a);return interaction[_0x1fa9('0x41')](_0x1fa9('0x42'),_0x40d90a['query'],_0x40d90a['user'],_0x2dcdd7,_0x3e4759)['then'](respondWithFilteredResult(_0xa2f99c,_0x2dcdd7))['catch'](handleError(_0xa2f99c,null));};exports[_0x1fa9('0x43')]=function(_0x917dbc,_0x5bc8cf){var _0x458a45={'raw':![],'where':{'id':_0x917dbc[_0x1fa9('0x44')]['id']}},_0x4cd237={};_0x4cd237[_0x1fa9('0x45')]=_[_0x1fa9('0x46')](db['ChatInteraction'][_0x1fa9('0x3c')]);_0x4cd237[_0x1fa9('0x47')]=_['keys'](_0x917dbc[_0x1fa9('0x47')]);_0x4cd237['filters']=_[_0x1fa9('0x48')](_0x4cd237[_0x1fa9('0x45')],_0x4cd237['query']);_0x458a45[_0x1fa9('0x49')]=_[_0x1fa9('0x48')](_0x4cd237['model'],qs[_0x1fa9('0x4a')](_0x917dbc[_0x1fa9('0x47')][_0x1fa9('0x4a')]));_0x458a45[_0x1fa9('0x49')]=_0x458a45[_0x1fa9('0x49')][_0x1fa9('0x4b')]?_0x458a45['attributes']:_0x4cd237[_0x1fa9('0x45')];if(_0x917dbc[_0x1fa9('0x47')]['includeAll']){_0x458a45[_0x1fa9('0x4c')]=[{'all':!![]}];}_0x458a45=_['merge']({},_0x458a45,_0x917dbc[_0x1fa9('0x4d')]);return db['ChatInteraction']['find'](_0x458a45)[_0x1fa9('0x18')](handleEntityNotFound(_0x5bc8cf,null))['then'](respondWithResult(_0x5bc8cf,null))[_0x1fa9('0x23')](handleError(_0x5bc8cf,null));};exports[_0x1fa9('0x4e')]=function(_0x875b,_0x1b8418){return db[_0x1fa9('0x3b')][_0x1fa9('0x4e')](_0x875b[_0x1fa9('0x34')],{})['then'](respondWithResult(_0x1b8418,0xc9))[_0x1fa9('0x23')](handleError(_0x1b8418,null));};exports['update']=function(_0x273509,_0x27da0c){if(_0x273509[_0x1fa9('0x34')]['id']){delete _0x273509['body']['id'];}return db[_0x1fa9('0x3b')]['find']({'where':{'id':_0x273509[_0x1fa9('0x44')]['id']}})[_0x1fa9('0x18')](handleEntityNotFound(_0x27da0c,null))[_0x1fa9('0x18')](saveUpdates(_0x273509[_0x1fa9('0x34')],null))[_0x1fa9('0x18')](respondWithResult(_0x27da0c,null))[_0x1fa9('0x23')](handleError(_0x27da0c,null));};exports['destroy']=function(_0xb00fb5,_0x2acccf){return db[_0x1fa9('0x3b')][_0x1fa9('0x4f')]({'where':{'id':_0xb00fb5[_0x1fa9('0x44')]['id']}})[_0x1fa9('0x18')](handleEntityNotFound(_0x2acccf,null))[_0x1fa9('0x18')](removeEntity(_0x2acccf,null))['catch'](handleError(_0x2acccf,null));};exports[_0x1fa9('0x50')]=function(_0x449e3e,_0x5497ea){return db['ChatInteraction'][_0x1fa9('0x50')]()[_0x1fa9('0x18')](respondWithResult(_0x5497ea,null))['catch'](handleError(_0x5497ea,null));};exports['createVidaooSession']=function(_0x4d6a6e,_0x226bb5){var _0x810053=_0x4d6a6e['params']['id'];var _0x2ba742;var _0x85d52;var _0x23ee2c;return db['ChatInteraction'][_0x1fa9('0x51')]({'where':{'id':_0x810053}})['then'](function(_0xa9c1ad){_0x2ba742=_0xa9c1ad;return db['ChatWebsite'][_0x1fa9('0x51')]({'where':{'id':_0xa9c1ad[_0x1fa9('0x52')]},'attributes':['id',_0x1fa9('0x53'),_0x1fa9('0x54'),_0x1fa9('0x55'),'vidaooNote',_0x1fa9('0x56')],'raw':!![]});})[_0x1fa9('0x18')](function(_0x607e84){if(_0x607e84&&_0x607e84['vidaooApiKey']&&_0x607e84[_0x1fa9('0x54')]){_0x85d52=_0x607e84;var _0x1f7ddf={'interaction':{'id':_0x810053},'agent':{'id':_0x4d6a6e['user']['id'],'name':_0x4d6a6e['user'][_0x1fa9('0x30')],'fullname':_0x4d6a6e[_0x1fa9('0x57')][_0x1fa9('0x58')],'email':_0x4d6a6e[_0x1fa9('0x57')][_0x1fa9('0x59')]},'contact':_0x4d6a6e[_0x1fa9('0x34')][_0x1fa9('0x35')],'account':_0x4d6a6e[_0x1fa9('0x34')][_0x1fa9('0x38')]};var _0x1931a8={'rejectUnauthorized':![],'method':_0x1fa9('0x5a'),'url':'https://api-vidaoo.xcally.com/api/v1/meetings','headers':{'X-APIKEY':_0x607e84[_0x1fa9('0x53')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x4d6a6e[_0x1fa9('0x57')]['email']],'buttons':null,'topic':_0x85d52[_0x1fa9('0x55')],'note':_['isNull'](_0x85d52['vidaooNote'])?null:getMustacheRender(_0x85d52[_0x1fa9('0x5b')],_0x1f7ddf),'metadata':null},'redirect':_0x1fa9('0x5c'),'json':!![]};try{if(!_[_0x1fa9('0x5d')](_0x85d52[_0x1fa9('0x56')])){var _0xd109b2=getMustacheRender(_0x85d52[_0x1fa9('0x56')],_0x1f7ddf);var _0x5e443d=JSON[_0x1fa9('0x5e')](_0xd109b2);_0x1931a8[_0x1fa9('0x34')][_0x1fa9('0x5f')]=_0x5e443d;}}catch(_0x2175e1){throw new db['Sequelize'][(_0x1fa9('0x60'))](_0x1fa9('0x61'));}return rp(_0x1931a8);}else{throw new db[(_0x1fa9('0x62'))][(_0x1fa9('0x60'))](_0x1fa9('0x63'));}})[_0x1fa9('0x18')](function(_0x4d7290){_0x23ee2c=_0x4d7290;if(_0x23ee2c['id']){var _0x580242={'body':_0x23ee2c['join_url'],'ChatWebsiteId':_0x85d52['id'],'ChatInteractionId':_0x2ba742['id'],'direction':_0x1fa9('0x64'),'UserId':_0x4d6a6e[_0x1fa9('0x57')]['id']};return db[_0x1fa9('0x65')][_0x1fa9('0x4e')](_0x580242,{});}else{throw new db[(_0x1fa9('0x62'))][(_0x1fa9('0x60'))](_0x1fa9('0x66'));}})[_0x1fa9('0x18')](function(){return _0x2ba742[_0x1fa9('0x67')]({'vidaooSessionId':_0x23ee2c['id']});})['then'](respondWithResult(_0x226bb5,null))[_0x1fa9('0x23')](handleError(_0x226bb5,null));};exports[_0x1fa9('0x68')]=function(_0x2077c6,_0x4e9494){if(_0x2077c6[_0x1fa9('0x34')]['id']){delete _0x2077c6[_0x1fa9('0x34')]['id'];}return db[_0x1fa9('0x3b')][_0x1fa9('0x4f')]({'where':{'id':_0x2077c6[_0x1fa9('0x44')]['id']},'include':[{'model':db['CmContact'],'as':_0x1fa9('0x69')}]})['then'](handleEntityNotFound(_0x4e9494,null))[_0x1fa9('0x18')](saveUpdates(_0x2077c6[_0x1fa9('0x34')],null))['then'](respondWithResult(_0x4e9494,null))['catch'](handleError(_0x4e9494,null));};exports['abandon']=function(_0x4736c1,_0x47774c){if(_0x4736c1['body']['id']){delete _0x4736c1['body']['id'];}return db[_0x1fa9('0x3b')][_0x1fa9('0x4f')]({'where':{'id':_0x4736c1[_0x1fa9('0x44')]['id']}})[_0x1fa9('0x18')](function(_0x516ecc){if(!_0x516ecc){logger['error'](_0x1fa9('0x6a'),_0x1fa9('0x6b'),0x194,'entity\x20not\x20found');_0x47774c[_0x1fa9('0x24')](0x194);}else{if(_0x516ecc['UserId']){throw new db[(_0x1fa9('0x62'))][(_0x1fa9('0x60'))](_0x1fa9('0x6c'));}}return _0x516ecc;})[_0x1fa9('0x18')](function(_0x514cc0){if(_0x514cc0){return _0x514cc0['update']({'closed':_0x4736c1['body'][_0x1fa9('0x6d')],'disposition':_0x4736c1[_0x1fa9('0x34')]['disposition']})['then'](function(_0x51053f){return _0x51053f;});}})[_0x1fa9('0x18')](function(){return respondWithRpcPromise(_0x1fa9('0x6e'),_0x1fa9('0x6b'),_0x4736c1[_0x1fa9('0x34')],client9004);})['then'](respondWithResult(_0x47774c,null))[_0x1fa9('0x23')](handleError(_0x47774c,null));};exports[_0x1fa9('0x6f')]=function(_0x17ffa8,_0x5bb0db){_0x17ffa8[_0x1fa9('0x34')]['name']=_0x17ffa8[_0x1fa9('0x70')][_0x1fa9('0x71')];_0x17ffa8[_0x1fa9('0x34')][_0x1fa9('0x72')]=_0x17ffa8[_0x1fa9('0x70')]['filename'];_0x17ffa8['body'][_0x1fa9('0x3e')]=_0x17ffa8[_0x1fa9('0x70')]['mimetype'];return db['Attachment'][_0x1fa9('0x4e')](_0x17ffa8[_0x1fa9('0x34')])['then'](respondWithResult(_0x5bb0db,0xc9))[_0x1fa9('0x23')](handleError(_0x5bb0db,null));};exports[_0x1fa9('0x73')]=function(_0x4ca258,_0x1003d6){return db[_0x1fa9('0x3b')][_0x1fa9('0x51')]({'where':{'id':_0x4ca258[_0x1fa9('0x44')]['id']},'raw':!![]})[_0x1fa9('0x18')](handleEntityNotFound(_0x1003d6,null))['then'](function(_0x52ecf0){if(_0x52ecf0){if(_0x52ecf0[_0x1fa9('0x6d')]){return _0x1003d6[_0x1fa9('0x25')](0x193)[_0x1fa9('0x27')]({'status':0x193,'message':_0x1fa9('0x74')});}return db['Attachment'][_0x1fa9('0x51')]({'where':{'id':_0x4ca258[_0x1fa9('0x47')]['attachId']},'raw':!![]})[_0x1fa9('0x18')](handleEntityNotFound(_0x1003d6,null));}})[_0x1fa9('0x18')](function(_0x3ae33a){if(_0x3ae33a){var _0x2c84ff=_0x3ae33a[_0x1fa9('0x75')]!==null;var _0x36a468=path[_0x1fa9('0x76')](config['root'],_0x1fa9('0x77'));if(_0x2c84ff){_0x36a468=path['join'](_0x36a468,_0x1fa9('0x78'));}var _0x1222e3=path[_0x1fa9('0x76')](_0x36a468,_0x3ae33a['basename']);return _0x1003d6[_0x1fa9('0x79')](_0x1222e3);}})[_0x1fa9('0x23')](handleError(_0x1003d6,null));};exports[_0x1fa9('0x7a')]=function(_0x319907,_0x19eae0){var _0x351029=null;var _0x3de2ec=null;var _0x39b8e4=null;if(_0x319907[_0x1fa9('0x34')]['id']){delete _0x319907[_0x1fa9('0x34')]['id'];}if(_0x319907[_0x1fa9('0x34')][_0x1fa9('0x7b')]){_0x39b8e4=path[_0x1fa9('0x76')](config[_0x1fa9('0x7c')],_0x1fa9('0x7d'),util[_0x1fa9('0x7e')](_0x1fa9('0x7f'),Date[_0x1fa9('0x80')]()));_0x319907[_0x1fa9('0x34')][_0x1fa9('0x81')]=_0x39b8e4;}return db['ChatInteraction']['find']({'where':{'id':_0x319907[_0x1fa9('0x44')]['id']},'include':[{'model':db[_0x1fa9('0x65')],'as':_0x1fa9('0x82'),'include':[{'model':db[_0x1fa9('0x83')],'as':_0x1fa9('0x83')}]}]})['then'](handleEntityNotFound(_0x19eae0,null))['then'](saveUpdates(_0x319907[_0x1fa9('0x34')],null))[_0x1fa9('0x18')](function(_0x34c1a6){if(_0x34c1a6){_0x351029=_0x34c1a6;return db['ChatWebsite'][_0x1fa9('0x4f')]({'where':{'id':_0x351029['ChatWebsiteId']}});}})[_0x1fa9('0x18')](function(_0x153ccd){if(_0x153ccd){_0x3de2ec=_0x153ccd;return db[_0x1fa9('0x84')][_0x1fa9('0x4f')]({'where':{'id':_0x351029[_0x1fa9('0x85')]}});}})[_0x1fa9('0x18')](function(_0x476b18){if(_0x476b18){if(_0x39b8e4){var _0x2ce50a=null;for(var _0x5ca72c=0x1;_0x5ca72c<_0x351029['Messages'][_0x1fa9('0x4b')];++_0x5ca72c){_0x2ce50a=_0x351029[_0x1fa9('0x82')][_0x5ca72c];var _0x3151ae=_0x2ce50a[_0x1fa9('0x86')]?util[_0x1fa9('0x7e')](_0x1fa9('0x87'),_0x3de2ec[_0x1fa9('0x88')],_0x2ce50a[_0x1fa9('0x86')]):_0x1fa9('0x89');var _0x43d34c=_0x319907[_0x1fa9('0x34')]['customer']||util[_0x1fa9('0x7e')](_0x1fa9('0x87'),_0x1fa9('0x8a'),_0x2ce50a[_0x1fa9('0x85')]);switch(_0x3de2ec[_0x1fa9('0x8b')]){case _0x1fa9('0x8c'):_0x3151ae=_0x2ce50a[_0x1fa9('0x86')]?util['format'](_0x1fa9('0x87'),_0x3de2ec[_0x1fa9('0x88')],_0x2ce50a[_0x1fa9('0x86')]):_0x1fa9('0x89');break;case _0x1fa9('0x8d'):_0x3151ae=_0x2ce50a['UserId']?_0x2ce50a['User'][_0x1fa9('0x8e')]||_0x2ce50a[_0x1fa9('0x83')][_0x1fa9('0x58')]:_0x1fa9('0x89');break;case _0x1fa9('0x8f'):_0x3151ae=_0x2ce50a[_0x1fa9('0x86')]?_0x2ce50a[_0x1fa9('0x83')][_0x1fa9('0x58')]:_0x1fa9('0x89');break;default:_0x3151ae=_0x2ce50a['UserId']?util[_0x1fa9('0x7e')](_0x1fa9('0x87'),_0x3de2ec[_0x1fa9('0x88')],_0x2ce50a[_0x1fa9('0x86')]):_0x1fa9('0x89');}var _0x2732c5=util[_0x1fa9('0x7e')](_0x1fa9('0x90'),moment(_0x2ce50a[_0x1fa9('0x91')])[_0x1fa9('0x7e')](_0x1fa9('0x92')),_0x2ce50a[_0x1fa9('0x93')]==='in'?_0x43d34c:_0x3151ae,_0x2ce50a[_0x1fa9('0x34')]);if(!_0x2ce50a[_0x1fa9('0x94')]){fs[_0x1fa9('0x95')](_0x39b8e4,_0x2732c5);}}return db[_0x1fa9('0x96')][_0x1fa9('0x51')]({'where':{'service':!![]},'include':[{'model':db[_0x1fa9('0x97')],'as':'Smtp','raw':!![],'include':[{'model':db['CloudProvider'],'as':_0x1fa9('0x98'),'raw':!![]}]}]});}}})[_0x1fa9('0x18')](function(_0x336b84){if(!_0x336b84||!_0x336b84[_0x1fa9('0x99')]||!_0x319907['body'])return _0x351029;var _0x3ff20f=_0x336b84[_0x1fa9('0x9a')]();return respondWithRpcPromise(_0x1fa9('0x9b'),_0x1fa9('0x9c'),{'account':_0x3ff20f,'message':{'from':util[_0x1fa9('0x7e')]('\x22%s\x22\x20<%s>',_0x336b84[_0x1fa9('0x30')],_0x336b84[_0x1fa9('0x59')]||_0x336b84[_0x1fa9('0x99')][_0x1fa9('0x57')]),'to':_0x319907[_0x1fa9('0x34')][_0x1fa9('0x7b')],'subject':_0x1fa9('0x9d'),'text':util[_0x1fa9('0x7e')](_0x1fa9('0x9e'),_0x319907[_0x1fa9('0x34')][_0x1fa9('0x7b')]),'attachments':[{'path':_0x39b8e4}]}})[_0x1fa9('0x18')](function(){return _0x351029;})[_0x1fa9('0x23')](function(_0x32b9d1){logger[_0x1fa9('0x1f')](_0x32b9d1);});})['then'](respondWithStatusCode(_0x19eae0,0xc8))[_0x1fa9('0x23')](handleError(_0x19eae0,null));};exports[_0x1fa9('0x9f')]=function(_0x35f46f,_0x32c1db){return db[_0x1fa9('0x65')]['find']({'where':{'id':_0x35f46f[_0x1fa9('0x44')]['id']}})['then'](handleEntityNotFound(_0x32c1db,null))[_0x1fa9('0x18')](function(_0x555ee6){if(_0x555ee6){return _0x555ee6[_0x1fa9('0x9f')](_0x35f46f['body']['ids'],_['omit'](_0x35f46f['body'],[_0x1fa9('0xa0'),'id'])||{});}})[_0x1fa9('0x18')](respondWithResult(_0x32c1db,null))[_0x1fa9('0x23')](handleError(_0x32c1db,null));};exports['getMessages']=function(_0x513529,_0x71329f){var _0x592669={'raw':![],'where':{}};var _0x1e6dc9={};var _0x39cc38={'count':0x0,'rows':[]};return db[_0x1fa9('0x3b')][_0x1fa9('0x51')]({'where':{'id':_0x513529[_0x1fa9('0x44')]['id']}})[_0x1fa9('0x18')](handleEntityNotFound(_0x71329f,null))['then'](function(_0x42c533){if(_0x42c533){_0x1e6dc9[_0x1fa9('0x45')]=_[_0x1fa9('0x46')](db[_0x1fa9('0x65')][_0x1fa9('0x3c')]);_0x1e6dc9[_0x1fa9('0x47')]=_[_0x1fa9('0x46')](_0x513529[_0x1fa9('0x47')]);_0x1e6dc9[_0x1fa9('0xa1')]=_[_0x1fa9('0x48')](_0x1e6dc9[_0x1fa9('0x45')],_0x1e6dc9[_0x1fa9('0x47')]);_0x592669[_0x1fa9('0x49')]=_['intersection'](_0x1e6dc9[_0x1fa9('0x45')],qs[_0x1fa9('0x4a')](_0x513529[_0x1fa9('0x47')][_0x1fa9('0x4a')]));_0x592669[_0x1fa9('0x49')]=_0x592669[_0x1fa9('0x49')]['length']?_0x592669['attributes']:_0x1e6dc9[_0x1fa9('0x45')];if(!_0x513529[_0x1fa9('0x47')][_0x1fa9('0xa2')](_0x1fa9('0xa3'))){_0x592669[_0x1fa9('0x2a')]=qs[_0x1fa9('0x2a')](_0x513529[_0x1fa9('0x47')][_0x1fa9('0x2a')]);_0x592669[_0x1fa9('0x28')]=qs[_0x1fa9('0x28')](_0x513529[_0x1fa9('0x47')][_0x1fa9('0x28')]);}_0x592669[_0x1fa9('0xa4')]=qs[_0x1fa9('0xa5')](_0x513529['query'][_0x1fa9('0xa5')]);_0x592669['where']=qs[_0x1fa9('0xa1')](_[_0x1fa9('0xa6')](_0x513529[_0x1fa9('0x47')],_0x1e6dc9['filters']));_0x592669[_0x1fa9('0xa7')][_0x1fa9('0xa8')]=_0x42c533['id'];if(_0x513529[_0x1fa9('0x47')][_0x1fa9('0xa9')]){_0x592669['where']=_[_0x1fa9('0x33')](_0x592669['where'],{'$or':_[_0x1fa9('0x3a')](_0x592669[_0x1fa9('0x49')],function(_0x59242c){var _0x333a7e={};_0x333a7e[_0x59242c]={'$like':'%'+_0x513529['query'][_0x1fa9('0xa9')]+'%'};return _0x333a7e;})});}if(_0x513529[_0x1fa9('0x47')]['$gte']){var _0xa0cc25=_0x513529['query'][_0x1fa9('0xaa')][_0x1fa9('0xab')](',');var _0xff26af={};_0xff26af[_0xa0cc25[0x0]]={'$gte':moment(_0xa0cc25[0x1])[_0x1fa9('0x7e')](_0x1fa9('0xac'))};_0x592669[_0x1fa9('0xa7')]=_[_0x1fa9('0x33')](_0x592669['where'],_0xff26af);}_0x592669=_[_0x1fa9('0x33')]({},_0x592669,_0x513529['options']);return db[_0x1fa9('0x65')]['count']({'where':_0x592669[_0x1fa9('0xa7')]})[_0x1fa9('0x18')](function(_0x54fe4a){_0x39cc38[_0x1fa9('0x2b')]=_0x54fe4a;if(_0x513529['query'][_0x1fa9('0xad')]){_0x592669['include']=[{'all':!![]}];}return db[_0x1fa9('0x65')]['findAll'](_0x592669);})[_0x1fa9('0x18')](function(_0x3db28a){_0x39cc38[_0x1fa9('0xae')]=_0x3db28a;return _0x39cc38;});}})[_0x1fa9('0x18')](respondWithFilteredResult(_0x71329f,_0x592669))['catch'](handleError(_0x71329f,null));};exports[_0x1fa9('0xaf')]=function(_0x2ee337,_0x40bcbc){var _0x53dfc9={'where':{}},_0x47138e={},_0x2f2166={'count':0x0,'rows':[]};return db[_0x1fa9('0x3b')][_0x1fa9('0x51')]({'where':{'id':_0x2ee337[_0x1fa9('0x44')]['id']}})[_0x1fa9('0x18')](handleEntityNotFound(_0x40bcbc,null))[_0x1fa9('0x18')](function(_0x319ee6){if(_0x319ee6){_0x47138e[_0x1fa9('0x45')]=_[_0x1fa9('0x46')](db['ChatMessage']['rawAttributes']);_0x47138e['query']=_[_0x1fa9('0x46')](_0x2ee337[_0x1fa9('0x47')]);_0x47138e[_0x1fa9('0xa1')]=_[_0x1fa9('0x48')](_0x47138e[_0x1fa9('0x45')],_0x47138e[_0x1fa9('0x47')]);_0x53dfc9[_0x1fa9('0x49')]=_['intersection'](_0x47138e[_0x1fa9('0x45')],qs['fields'](_0x2ee337[_0x1fa9('0x47')]['fields']));_0x53dfc9['attributes']=_0x53dfc9['attributes'][_0x1fa9('0x4b')]?_0x53dfc9['attributes']:_0x47138e[_0x1fa9('0x45')];if(!_0x2ee337[_0x1fa9('0x47')]['hasOwnProperty']('nolimit')){_0x53dfc9['limit']=qs[_0x1fa9('0x2a')](_0x2ee337[_0x1fa9('0x47')][_0x1fa9('0x2a')]);_0x53dfc9[_0x1fa9('0x28')]=qs['offset'](_0x2ee337['query'][_0x1fa9('0x28')]);}_0x53dfc9[_0x1fa9('0xa4')]=qs[_0x1fa9('0xa5')](_0x2ee337[_0x1fa9('0x47')]['sort']);_0x53dfc9[_0x1fa9('0xa7')]=qs[_0x1fa9('0xa1')](_[_0x1fa9('0xa6')](_0x2ee337[_0x1fa9('0x47')],_0x47138e[_0x1fa9('0xa1')]));_0x53dfc9['where']['ChatInteractionId']=_0x319ee6['id'];if(_0x2ee337[_0x1fa9('0x47')][_0x1fa9('0xa9')]){_0x53dfc9[_0x1fa9('0xa7')]=_[_0x1fa9('0x33')](_0x53dfc9[_0x1fa9('0xa7')],{'$or':_[_0x1fa9('0x3a')](_0x53dfc9[_0x1fa9('0x49')],function(_0xfdb5f3){var _0x15a5c0={};_0x15a5c0[_0xfdb5f3]={'$like':'%'+_0x2ee337['query']['filter']+'%'};return _0x15a5c0;})});}_0x53dfc9[_0x1fa9('0xa7')][_0x1fa9('0x94')]=![];if(_0x2ee337[_0x1fa9('0x47')]['id']){_0x53dfc9[_0x1fa9('0xa7')]['id']={'$gt':_0x2ee337[_0x1fa9('0x47')]['id']};}_0x53dfc9=_['merge']({},_0x53dfc9,_0x2ee337[_0x1fa9('0x4d')]);return db[_0x1fa9('0x65')]['count']({'where':_0x53dfc9['where']})[_0x1fa9('0x18')](function(_0x367e3d){_0x2f2166[_0x1fa9('0x2b')]=_0x367e3d;_0x53dfc9[_0x1fa9('0x4c')]=[];if(_0x2ee337[_0x1fa9('0x47')][_0x1fa9('0xb0')]){_0x53dfc9[_0x1fa9('0x4c')][_0x1fa9('0xb1')]({'model':db[_0x1fa9('0x83')],'as':_0x1fa9('0x83'),'attributes':['id',_0x1fa9('0x58'),_0x1fa9('0x8e')]});}if(_0x2ee337[_0x1fa9('0x47')][_0x1fa9('0xad')]){_0x53dfc9[_0x1fa9('0x4c')]=[{'all':!![]}];}return db[_0x1fa9('0x65')][_0x1fa9('0x41')](_0x53dfc9);})[_0x1fa9('0x18')](function(_0x3e5380){_0x2f2166['rows']=_0x3e5380;return _0x2f2166;});}})[_0x1fa9('0x18')](respondWithFilteredResult(_0x40bcbc,_0x53dfc9))[_0x1fa9('0x23')](handleError(_0x40bcbc,null));};exports[_0x1fa9('0xb2')]=function(_0x137334,_0x56422f){return db['ChatInteraction'][_0x1fa9('0x4f')]({'where':{'id':_0x137334[_0x1fa9('0x44')]['id']}})[_0x1fa9('0x18')](handleEntityNotFound(_0x56422f,null))['then'](function(_0x56de60){if(_0x56de60){return _0x56de60[_0x1fa9('0xb3')](_0x137334[_0x1fa9('0x34')][_0x1fa9('0xa0')],_[_0x1fa9('0xb4')](_0x137334[_0x1fa9('0x34')],[_0x1fa9('0xa0'),'id'])||{})['spread'](function(){return db[_0x1fa9('0xb5')][_0x1fa9('0x41')]({'attributes':['id',_0x1fa9('0x30'),_0x1fa9('0xb6')],'where':{'id':_0x137334[_0x1fa9('0x34')][_0x1fa9('0xa0')]}});})[_0x1fa9('0x18')](function(_0x306541){socket[_0x1fa9('0xb7')]('chatInteractionTags:save',{'id':Number(_0x137334[_0x1fa9('0x44')]['id']),'tags':_0x306541||[]});return{'id':Number(_0x137334[_0x1fa9('0x44')]['id']),'tags':_0x306541||[]};});}})[_0x1fa9('0x18')](respondWithResult(_0x56422f,null))[_0x1fa9('0x23')](handleError(_0x56422f,null));};exports[_0x1fa9('0xb8')]=function(_0x481ba3,_0x115b68){return db['ChatInteraction'][_0x1fa9('0x4f')]({'where':{'id':_0x481ba3['params']['id']}})['then'](handleEntityNotFound(_0x115b68,null))[_0x1fa9('0x18')](function(_0x33dac2){if(_0x33dac2){return _0x33dac2[_0x1fa9('0xb8')](_0x481ba3['query']['ids']);}})[_0x1fa9('0x18')](respondWithStatusCode(_0x115b68,null))['catch'](handleError(_0x115b68,null));};exports[_0x1fa9('0x79')]=function(_0x29fd88,_0x5489ab){var _0x31df58=moment()[_0x1fa9('0xb9')]()['toString']();var _0x5a9db3=path[_0x1fa9('0x76')](config['root'],_0x1fa9('0xba'),_0x1fa9('0xbb'),_0x1fa9('0xbc'));var _0x3127a5=path['join'](config[_0x1fa9('0x7c')],_0x1fa9('0xba'),_0x1fa9('0xbb'),_0x1fa9('0xbd'));var _0x19678c=path[_0x1fa9('0x76')](_0x5a9db3,_0x31df58);var _0x4ecbbd=util[_0x1fa9('0x7e')]('transcript-%d-%s.zip',_0x29fd88['params']['id'],_0x31df58);var _0x3054b6=path[_0x1fa9('0x76')](_0x5a9db3,_0x4ecbbd);var _0x12a367=[];_0x12a367[_0x1fa9('0xb1')]({'model':db[_0x1fa9('0x83')],'as':_0x1fa9('0x83'),'attributes':['id',_0x1fa9('0x58')],'raw':!![]});_0x12a367['push']({'model':db[_0x1fa9('0x84')],'as':_0x1fa9('0x69'),'attributes':['id','firstName',_0x1fa9('0xbe')],'raw':!![]});if(_0x29fd88[_0x1fa9('0x47')][_0x1fa9('0xbd')]){_0x12a367[_0x1fa9('0xb1')]({'model':db['Attachment'],'as':_0x1fa9('0xbf'),'raw':!![]});}var _0x14408d=[{'model':db[_0x1fa9('0x65')],'as':'Messages','attributes':['id',_0x1fa9('0x34'),_0x1fa9('0x91'),_0x1fa9('0x93'),_0x1fa9('0x94'),_0x1fa9('0xc0')],'include':_0x12a367}];_0x14408d['push']({'model':db['ChatWebsite'],'as':_0x1fa9('0xc1'),'attributes':['id',_0x1fa9('0x30')]});_0x14408d[_0x1fa9('0xb1')]({'model':db[_0x1fa9('0x83')],'as':_0x1fa9('0xc2'),'attributes':['id',_0x1fa9('0x58')]});return db['ChatInteraction'][_0x1fa9('0x4f')]({'where':{'id':_0x29fd88['params']['id']},'include':_0x14408d})[_0x1fa9('0x18')](handleEntityNotFound(_0x5489ab,null))['then'](function(_0xcd877b){if(_0xcd877b){var _0x547de5=_0xcd877b[_0x1fa9('0xc3')]({'plain':!![]});fs[_0x1fa9('0xc4')](_0x19678c);var _0x2be029={'channel':_0x1fa9('0xc5'),'account':_0x547de5['Account'][_0x1fa9('0x30')],'agent':_0x547de5[_0x1fa9('0xc2')]?_0x547de5['Owner'][_0x1fa9('0x58')]:'N.A.','createdAt':moment(_0x547de5[_0x1fa9('0x91')])['format'](_0x1fa9('0xac'))[_0x1fa9('0xc6')](),'closedAt':_0x547de5[_0x1fa9('0x6d')]?moment(_0x547de5[_0x1fa9('0xc7')])['format'](_0x1fa9('0xac'))[_0x1fa9('0xc6')]():'','disposition':_0x547de5[_0x1fa9('0xc8')],'chatInfo':{'browser':_0x547de5[_0x1fa9('0xc9')],'os':_0x547de5[_0x1fa9('0xca')],'referer':_0x547de5[_0x1fa9('0xcb')],'customerIp':_0x547de5[_0x1fa9('0xcc')],'customerPort':_0x547de5['customerPort']?_0x547de5['customerPort']:'N.A.'},'messages':_(_0x547de5['Messages'])[_0x1fa9('0xcd')]()[_0x1fa9('0xa9')]({'secret':![]})[_0x1fa9('0x3a')](function(_0x4a1049){if(_0x4a1049[_0x1fa9('0xbf')]){var _0x55f8a6=path[_0x1fa9('0x76')](_0x3127a5,_0x4a1049[_0x1fa9('0xbf')][_0x1fa9('0x72')]);if(fs['existsSync'](_0x55f8a6)){fs[_0x1fa9('0xce')](_0x55f8a6)[_0x1fa9('0xcf')](fs['createWriteStream'](path[_0x1fa9('0x76')](_0x19678c,_0x4a1049[_0x1fa9('0xbf')][_0x1fa9('0x72')])));}}return{'date':moment(_0x4a1049[_0x1fa9('0x91')])[_0x1fa9('0x7e')]('YYYY-MM-DD\x20HH:mm:ss')[_0x1fa9('0xc6')](),'sender':_0x4a1049[_0x1fa9('0x93')]==='out'?_0x4a1049[_0x1fa9('0x83')]?_0x4a1049[_0x1fa9('0x83')][_0x1fa9('0x58')]:_0x1fa9('0x89'):_0x4a1049[_0x1fa9('0x69')][_0x1fa9('0xd0')]+(_0x4a1049['Contact'][_0x1fa9('0xbe')]?'\x20'+_0x4a1049[_0x1fa9('0x69')]['lastName']:''),'body':_0x4a1049[_0x1fa9('0xbf')]?_0x4a1049[_0x1fa9('0xbf')][_0x1fa9('0x72')]:_0x4a1049[_0x1fa9('0x34')],'direction':_0x4a1049['direction']==='out'?'A':'C','secret':_0x4a1049['secret'],'read':_0x4a1049[_0x1fa9('0xc0')],'attachment':_0x4a1049[_0x1fa9('0xbf')]};})[_0x1fa9('0xd1')]()};return ejs[_0x1fa9('0xd2')](path[_0x1fa9('0x76')](config['root'],_0x1fa9('0xba'),'views',_0x1fa9('0xd3')),{'interaction':_0x2be029})[_0x1fa9('0x18')](function(_0x56907a){var _0x1d267b=path['join'](_0x19678c,'transcript-'+_0x547de5['id']+'-'+_0x31df58+_0x1fa9('0xd4'));var _0x445107={'path':_0x1d267b,'channel':_0x1fa9('0xc5'),'interactionId':_0x547de5['id']};return pdf[_0x1fa9('0xd5')](_0x56907a,_0x445107);})[_0x1fa9('0x18')](function(){return new Promise(function(_0x494114,_0x912e5a){zipdir(_0x19678c,{'saveTo':_0x3054b6},function(_0x13479e,_0x1e5bf3){if(_0x13479e)return _0x912e5a(_0x13479e);return _0x494114(_0x1e5bf3);});})['then'](function(){return new BPromise(function(_0x40ca14,_0x1d4c7a){rimraf(_0x19678c,function(_0x4771e2){if(_0x4771e2)_0x1d4c7a(_0x4771e2);return _0x40ca14();});});})[_0x1fa9('0x18')](function(){return _0x5489ab[_0x1fa9('0x79')](_0x3054b6,_0x4ecbbd,function(_0x25ac70){if(_0x25ac70){logger[_0x1fa9('0x1f')](_0x1fa9('0xd6'),_0x25ac70);}else{fs[_0x1fa9('0xd7')](_0x3054b6);}});});});}else{return _0x5489ab[_0x1fa9('0x24')](0xc8);}})[_0x1fa9('0x23')](handleError(_0x5489ab,null));}; \ No newline at end of file +var _0x4169=['catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','destroy','stack','name','send','render','merge','index','map','ChatInteraction','rawAttributes','fieldName','type','key','findAll','query','user','params','model','keys','filters','intersection','fields','attributes','length','includeAll','include','find','create','update','body','describe','findOne','ChatWebsite','ChatWebsiteId','vidaooApiKey','vidaooEscalation','vidaooNote','vidaooMetadata','fullname','email','account','https://api-vidaoo.xcally.com/api/v1/meetings','vidaooTopic','isNull','follow','parse','Sequelize','ValidationError','Error\x20in\x20conversion\x20vidaooMetadata','Error\x20in\x20Vidaoo\x20configuration','out','ChatMessage','Unable\x20to\x20create\x20Vidaoo\x20session','customUpdate','CmContact','Contact','abandon','entity\x20not\x20found','UserId','closed','disposition','attachmentUpload','file','filename','mimetype','Attachment','attachmentDownload','Unauthorized','attachId','ChatOfflineMessageId','join','server/files/attachments/','offline-chat/','basename','download','close','mailTranscript','root','server/files/chat/upload/','transcript-%s.txt','now','Messages','User','ContactId','format','%s%d','System','customer','Visitor','agentIdentifier','agentAlias','agent_alias','alias','createdAt','MM/DD/YYYY\x20HH:mm:ss','direction','secret','appendFileSync','MailAccount','MailServerOut','Smtp','CloudProvider','getSmtpOptions','\x22%s\x22\x20<%s>','Mail\x20Transcript','Hi\x20%s,\x20attached\x20you\x20can\x20find\x20your\x20transcript\x20file.\x20\x0a\x0aRegards.\x20\x0a\x0a','addMessage','ids','getMessages','hasOwnProperty','nolimit','order','sort','where','pick','ChatInteractionId','filter','$gte','split','YYYY-MM-DD\x20HH:mm:ss','options','rows','includeAgent','push','addTags','omit','spread','Tag','color','emit','chatInteractionTags:save','removeTags','toString','files','server','attachments','transcript-%d-%s.zip','firstName','lastName','read','Account','Owner','get','mkdirSync','Chat','N.A.','closedAt','osName','referer','customerIp','customerPort','tail','existsSync','createReadStream','value','renderFile','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','unlinkSync','rimraf','request-promise','moment','path','ioredis','../../components/interaction/service','../../config/logger','api','../../config/environment','defaults','localhost','redis','register','jayson/promise','client','http','request','then','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','code','error','message','ChatInteraction,\x20%s,\x20%s','info','result'];(function(_0x22ee1e,_0x3eff80){var _0x49a5c9=function(_0x373480){while(--_0x373480){_0x22ee1e['push'](_0x22ee1e['shift']());}};_0x49a5c9(++_0x3eff80);}(_0x4169,0xab));var _0x9416=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x4169[_0x321bb2];return _0x9c12ed;};'use strict';var rimraf=require(_0x9416('0x0'));var zipdir=require('zip-dir');var rp=require(_0x9416('0x1'));var moment=require(_0x9416('0x2'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x9416('0x3'));var ejs=require('ejs');var fs=require('fs');var _=require('lodash');var Redis=require(_0x9416('0x4'));var interaction=require(_0x9416('0x5'));var qs=require('../../components/parsers/qs');var pdf=require('../../components/export/pdf');var logger=require(_0x9416('0x6'))(_0x9416('0x7'));var config=require(_0x9416('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x9416('0x9')](config['redis'],{'host':_0x9416('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9416('0xb')]));require('./chatInteraction.socket')[_0x9416('0xc')](socket);var jayson=require(_0x9416('0xd'));var client=jayson['client']['http']({'port':0x232b});var client9004=jayson[_0x9416('0xe')][_0x9416('0xf')]({'port':0x232c});function respondWithRpcPromise(_0x4fa699,_0x401928,_0x111033,_0x3ca315){return new BPromise(function(_0x1bcb6b,_0x2317cb){var _0x3b6212=_0x3ca315||client;return _0x3b6212[_0x9416('0x10')](_0x4fa699,_0x111033)[_0x9416('0x11')](function(_0x357dae){logger['info']('ChatInteraction,\x20%s,\x20%s',_0x401928,_0x9416('0x12'));logger['debug'](_0x9416('0x13'),_0x401928,_0x9416('0x12'),JSON[_0x9416('0x14')](_0x357dae));if(_0x357dae['error']){if(_0x357dae['error'][_0x9416('0x15')]===0x1f4){logger[_0x9416('0x16')]('ChatInteraction,\x20%s,\x20%s',_0x401928,_0x357dae['error'][_0x9416('0x17')]);return _0x2317cb(_0x357dae[_0x9416('0x16')][_0x9416('0x17')]);}logger[_0x9416('0x16')](_0x9416('0x18'),_0x401928,_0x357dae['error']['message']);return _0x1bcb6b(_0x357dae[_0x9416('0x16')][_0x9416('0x17')]);}else{logger[_0x9416('0x19')]('ChatInteraction,\x20%s,\x20%s',_0x401928,_0x9416('0x12'));_0x1bcb6b(_0x357dae[_0x9416('0x1a')]['message']);}})[_0x9416('0x1b')](function(_0x598737){logger['error'](_0x9416('0x18'),_0x401928,_0x598737);_0x2317cb(_0x598737);});});}function respondWithStatusCode(_0x3919de,_0x3f0b9e){_0x3f0b9e=_0x3f0b9e||0xcc;return function(_0x5313fc){if(_0x5313fc){return _0x3919de[_0x9416('0x1c')](_0x3f0b9e);}return _0x3919de[_0x9416('0x1d')](_0x3f0b9e)[_0x9416('0x1e')]();};}function respondWithResult(_0x43e5da,_0x58287b){_0x58287b=_0x58287b||0xc8;return function(_0x25deb2){if(_0x25deb2){return _0x43e5da['status'](_0x58287b)[_0x9416('0x1f')](_0x25deb2);}};}function respondWithFilteredResult(_0x4eb486,_0xfa7e7){return function(_0x3b1668){if(_0x3b1668){var _0x52a10d=typeof _0xfa7e7[_0x9416('0x20')]===_0x9416('0x21')&&typeof _0xfa7e7[_0x9416('0x22')]===_0x9416('0x21');var _0x33e336=_0x3b1668['count'];var _0x15d0a4=_0x52a10d?0x0:_0xfa7e7['offset'];var _0x5f528d=_0x52a10d?_0x3b1668[_0x9416('0x23')]:_0xfa7e7[_0x9416('0x20')]+_0xfa7e7[_0x9416('0x22')];var _0x5917d8;if(_0x5f528d>=_0x33e336){_0x5f528d=_0x33e336;_0x5917d8=0xc8;}else{_0x5917d8=0xce;}_0x4eb486[_0x9416('0x1d')](_0x5917d8);return _0x4eb486['set'](_0x9416('0x24'),_0x15d0a4+'-'+_0x5f528d+'/'+_0x33e336)[_0x9416('0x1f')](_0x3b1668);}return null;};}function saveUpdates(_0x343786){return function(_0x5a196a){if(_0x5a196a){return _0x5a196a['update'](_0x343786)['then'](function(_0x3b097b){return _0x3b097b;});}return null;};}function removeEntity(_0x206b7b){return function(_0x378bef){if(_0x378bef){return _0x378bef[_0x9416('0x25')]()[_0x9416('0x11')](function(){_0x206b7b['status'](0xcc)[_0x9416('0x1e')]();});}};}function handleEntityNotFound(_0x15b4b5){return function(_0x2c8e40){if(!_0x2c8e40){_0x15b4b5[_0x9416('0x1c')](0x194);}return _0x2c8e40;};}function handleError(_0x2739b9,_0xc3b84a){_0xc3b84a=_0xc3b84a||0x1f4;return function(_0x2e29d6){logger[_0x9416('0x16')](_0x2e29d6[_0x9416('0x26')]);if(_0x2e29d6[_0x9416('0x27')]){delete _0x2e29d6[_0x9416('0x27')];}_0x2739b9[_0x9416('0x1d')](_0xc3b84a)[_0x9416('0x28')](_0x2e29d6);};}function getMustacheRender(_0x2d5d48,_0x31751d){return Mustache[_0x9416('0x29')](_0x2d5d48,_[_0x9416('0x2a')](_0x31751d['body'],{'contact':_0x31751d['contact'],'message':_0x31751d[_0x9416('0x17')],'agent':_0x31751d['agent'],'interaction':_0x31751d['interaction'],'account':_0x31751d['account']}))||'';}exports[_0x9416('0x2b')]=function(_0x4e4ee6,_0x20c39e){var _0x529018={};var _0x32663e=_[_0x9416('0x2c')](db[_0x9416('0x2d')][_0x9416('0x2e')],function(_0x560d06){return{'name':_0x560d06[_0x9416('0x2f')],'type':_0x560d06[_0x9416('0x30')][_0x9416('0x31')]};});_0x529018=qs['getOptions'](_0x32663e,_0x4e4ee6);return interaction[_0x9416('0x32')]('chat',_0x4e4ee6[_0x9416('0x33')],_0x4e4ee6[_0x9416('0x34')],_0x529018,_0x32663e)['then'](respondWithFilteredResult(_0x20c39e,_0x529018))[_0x9416('0x1b')](handleError(_0x20c39e,null));};exports['show']=function(_0x460727,_0x1501de){var _0x157d4d={'raw':![],'where':{'id':_0x460727[_0x9416('0x35')]['id']}},_0x2c2b3d={};_0x2c2b3d[_0x9416('0x36')]=_[_0x9416('0x37')](db[_0x9416('0x2d')][_0x9416('0x2e')]);_0x2c2b3d[_0x9416('0x33')]=_[_0x9416('0x37')](_0x460727[_0x9416('0x33')]);_0x2c2b3d[_0x9416('0x38')]=_[_0x9416('0x39')](_0x2c2b3d[_0x9416('0x36')],_0x2c2b3d[_0x9416('0x33')]);_0x157d4d['attributes']=_[_0x9416('0x39')](_0x2c2b3d[_0x9416('0x36')],qs['fields'](_0x460727[_0x9416('0x33')][_0x9416('0x3a')]));_0x157d4d[_0x9416('0x3b')]=_0x157d4d[_0x9416('0x3b')][_0x9416('0x3c')]?_0x157d4d[_0x9416('0x3b')]:_0x2c2b3d[_0x9416('0x36')];if(_0x460727['query'][_0x9416('0x3d')]){_0x157d4d[_0x9416('0x3e')]=[{'all':!![]}];}_0x157d4d=_['merge']({},_0x157d4d,_0x460727['options']);return db[_0x9416('0x2d')][_0x9416('0x3f')](_0x157d4d)['then'](handleEntityNotFound(_0x1501de,null))[_0x9416('0x11')](respondWithResult(_0x1501de,null))[_0x9416('0x1b')](handleError(_0x1501de,null));};exports[_0x9416('0x40')]=function(_0x4666a2,_0x16a6a8){return db[_0x9416('0x2d')][_0x9416('0x40')](_0x4666a2['body'],{})[_0x9416('0x11')](respondWithResult(_0x16a6a8,0xc9))['catch'](handleError(_0x16a6a8,null));};exports[_0x9416('0x41')]=function(_0x27ec1b,_0x43c263){if(_0x27ec1b[_0x9416('0x42')]['id']){delete _0x27ec1b[_0x9416('0x42')]['id'];}return db['ChatInteraction'][_0x9416('0x3f')]({'where':{'id':_0x27ec1b['params']['id']}})['then'](handleEntityNotFound(_0x43c263,null))[_0x9416('0x11')](saveUpdates(_0x27ec1b['body'],null))['then'](respondWithResult(_0x43c263,null))[_0x9416('0x1b')](handleError(_0x43c263,null));};exports[_0x9416('0x25')]=function(_0x25085e,_0xe4f723){return db[_0x9416('0x2d')][_0x9416('0x3f')]({'where':{'id':_0x25085e[_0x9416('0x35')]['id']}})[_0x9416('0x11')](handleEntityNotFound(_0xe4f723,null))[_0x9416('0x11')](removeEntity(_0xe4f723,null))[_0x9416('0x1b')](handleError(_0xe4f723,null));};exports[_0x9416('0x43')]=function(_0x871477,_0x116759){return db[_0x9416('0x2d')][_0x9416('0x43')]()['then'](respondWithResult(_0x116759,null))[_0x9416('0x1b')](handleError(_0x116759,null));};exports['createVidaooSession']=function(_0x475404,_0x329d0d){var _0x4a4f0f=_0x475404['params']['id'];var _0x546494;var _0x15fe6e;var _0x590370;return db[_0x9416('0x2d')][_0x9416('0x44')]({'where':{'id':_0x4a4f0f}})[_0x9416('0x11')](function(_0x2b3058){_0x546494=_0x2b3058;return db[_0x9416('0x45')][_0x9416('0x44')]({'where':{'id':_0x2b3058[_0x9416('0x46')]},'attributes':['id',_0x9416('0x47'),_0x9416('0x48'),'vidaooTopic',_0x9416('0x49'),_0x9416('0x4a')],'raw':!![]});})[_0x9416('0x11')](function(_0x593f0f){if(_0x593f0f&&_0x593f0f[_0x9416('0x47')]&&_0x593f0f[_0x9416('0x48')]){_0x15fe6e=_0x593f0f;var _0x272ada={'interaction':{'id':_0x4a4f0f},'agent':{'id':_0x475404[_0x9416('0x34')]['id'],'name':_0x475404[_0x9416('0x34')][_0x9416('0x27')],'fullname':_0x475404['user'][_0x9416('0x4b')],'email':_0x475404[_0x9416('0x34')][_0x9416('0x4c')]},'contact':_0x475404['body']['contact'],'account':_0x475404[_0x9416('0x42')][_0x9416('0x4d')]};var _0x2bf284={'rejectUnauthorized':![],'method':'POST','url':_0x9416('0x4e'),'headers':{'X-APIKEY':_0x593f0f[_0x9416('0x47')]},'body':{'duration':null,'scheduledAt':null,'participants':[_0x475404[_0x9416('0x34')][_0x9416('0x4c')]],'buttons':null,'topic':_0x15fe6e[_0x9416('0x4f')],'note':_[_0x9416('0x50')](_0x15fe6e[_0x9416('0x49')])?null:getMustacheRender(_0x15fe6e[_0x9416('0x49')],_0x272ada),'metadata':null},'redirect':_0x9416('0x51'),'json':!![]};try{if(!_[_0x9416('0x50')](_0x15fe6e[_0x9416('0x4a')])){var _0x4a6fc4=getMustacheRender(_0x15fe6e['vidaooMetadata'],_0x272ada);var _0x2aeb82=JSON[_0x9416('0x52')](_0x4a6fc4);_0x2bf284[_0x9416('0x42')]['metadata']=_0x2aeb82;}}catch(_0x4276e9){throw new db[(_0x9416('0x53'))][(_0x9416('0x54'))](_0x9416('0x55'));}return rp(_0x2bf284);}else{throw new db['Sequelize'][(_0x9416('0x54'))](_0x9416('0x56'));}})[_0x9416('0x11')](function(_0x3a746c){_0x590370=_0x3a746c;if(_0x590370['id']){var _0x1c37ba={'body':_0x590370['join_url'],'ChatWebsiteId':_0x15fe6e['id'],'ChatInteractionId':_0x546494['id'],'direction':_0x9416('0x57'),'UserId':_0x475404[_0x9416('0x34')]['id']};return db[_0x9416('0x58')][_0x9416('0x40')](_0x1c37ba,{});}else{throw new db[(_0x9416('0x53'))][(_0x9416('0x54'))](_0x9416('0x59'));}})['then'](function(){return _0x546494['updateAttributes']({'vidaooSessionId':_0x590370['id']});})[_0x9416('0x11')](respondWithResult(_0x329d0d,null))[_0x9416('0x1b')](handleError(_0x329d0d,null));};exports[_0x9416('0x5a')]=function(_0x18158c,_0x52caae){if(_0x18158c['body']['id']){delete _0x18158c[_0x9416('0x42')]['id'];}return db[_0x9416('0x2d')][_0x9416('0x3f')]({'where':{'id':_0x18158c[_0x9416('0x35')]['id']},'include':[{'model':db[_0x9416('0x5b')],'as':_0x9416('0x5c')}]})[_0x9416('0x11')](handleEntityNotFound(_0x52caae,null))['then'](saveUpdates(_0x18158c[_0x9416('0x42')],null))['then'](respondWithResult(_0x52caae,null))[_0x9416('0x1b')](handleError(_0x52caae,null));};exports[_0x9416('0x5d')]=function(_0x2b060d,_0x2be2de){if(_0x2b060d[_0x9416('0x42')]['id']){delete _0x2b060d['body']['id'];}return db[_0x9416('0x2d')]['find']({'where':{'id':_0x2b060d[_0x9416('0x35')]['id']}})[_0x9416('0x11')](function(_0x2f8371){if(!_0x2f8371){logger[_0x9416('0x16')]('abandonInteraction,\x20%s,\x20%s,\x20%s',_0x9416('0x5d'),0x194,_0x9416('0x5e'));_0x2be2de[_0x9416('0x1c')](0x194);}else{if(_0x2f8371[_0x9416('0x5f')]){throw new db[(_0x9416('0x53'))][(_0x9416('0x54'))]('Interaction\x20already\x20assigned');}}return _0x2f8371;})[_0x9416('0x11')](function(_0x83bde){if(_0x83bde){return _0x83bde[_0x9416('0x41')]({'closed':_0x2b060d[_0x9416('0x42')][_0x9416('0x60')],'disposition':_0x2b060d[_0x9416('0x42')][_0x9416('0x61')]})[_0x9416('0x11')](function(_0x5bcb0f){return _0x5bcb0f;});}})['then'](function(){return respondWithRpcPromise('AbandonInteraction',_0x9416('0x5d'),_0x2b060d[_0x9416('0x42')],client9004);})[_0x9416('0x11')](respondWithResult(_0x2be2de,null))['catch'](handleError(_0x2be2de,null));};exports[_0x9416('0x62')]=function(_0x497c4d,_0x6a0e28){_0x497c4d['body'][_0x9416('0x27')]=_0x497c4d[_0x9416('0x63')]['originalname'];_0x497c4d['body']['basename']=_0x497c4d[_0x9416('0x63')][_0x9416('0x64')];_0x497c4d[_0x9416('0x42')][_0x9416('0x30')]=_0x497c4d[_0x9416('0x63')][_0x9416('0x65')];return db[_0x9416('0x66')]['create'](_0x497c4d['body'])[_0x9416('0x11')](respondWithResult(_0x6a0e28,0xc9))[_0x9416('0x1b')](handleError(_0x6a0e28,null));};exports[_0x9416('0x67')]=function(_0x45a7cf,_0x198ebb){return db[_0x9416('0x2d')]['findOne']({'where':{'id':_0x45a7cf[_0x9416('0x35')]['id']},'raw':!![]})[_0x9416('0x11')](handleEntityNotFound(_0x198ebb,null))['then'](function(_0x4fb5a0){if(_0x4fb5a0){if(_0x4fb5a0['closed']){return _0x198ebb[_0x9416('0x1d')](0x193)[_0x9416('0x1f')]({'status':0x193,'message':_0x9416('0x68')});}return db[_0x9416('0x66')][_0x9416('0x44')]({'where':{'id':_0x45a7cf[_0x9416('0x33')][_0x9416('0x69')]},'raw':!![]})[_0x9416('0x11')](handleEntityNotFound(_0x198ebb,null));}})[_0x9416('0x11')](function(_0x55998c){if(_0x55998c){var _0x421fed=_0x55998c[_0x9416('0x6a')]!==null;var _0x1d4f5f=path[_0x9416('0x6b')](config['root'],_0x9416('0x6c'));if(_0x421fed){_0x1d4f5f=path[_0x9416('0x6b')](_0x1d4f5f,_0x9416('0x6d'));}var _0x2832c4=path[_0x9416('0x6b')](_0x1d4f5f,_0x55998c[_0x9416('0x6e')]);return _0x198ebb[_0x9416('0x6f')](_0x2832c4);}})[_0x9416('0x1b')](handleError(_0x198ebb,null));};exports[_0x9416('0x70')]=function(_0x434d18,_0x4811c0){var _0x233d26=null;var _0x2a8cfe=null;var _0x40c4f2=null;if(_0x434d18[_0x9416('0x42')]['id']){delete _0x434d18['body']['id'];}if(_0x434d18['body'][_0x9416('0x71')]){_0x40c4f2=path[_0x9416('0x6b')](config[_0x9416('0x72')],_0x9416('0x73'),util['format'](_0x9416('0x74'),Date[_0x9416('0x75')]()));_0x434d18['body']['pathTranscript']=_0x40c4f2;}return db[_0x9416('0x2d')][_0x9416('0x3f')]({'where':{'id':_0x434d18['params']['id']},'include':[{'model':db[_0x9416('0x58')],'as':_0x9416('0x76'),'include':[{'model':db[_0x9416('0x77')],'as':_0x9416('0x77')}]}]})[_0x9416('0x11')](handleEntityNotFound(_0x4811c0,null))[_0x9416('0x11')](saveUpdates(_0x434d18[_0x9416('0x42')],null))[_0x9416('0x11')](function(_0x4b9da6){if(_0x4b9da6){_0x233d26=_0x4b9da6;return db[_0x9416('0x45')]['find']({'where':{'id':_0x233d26[_0x9416('0x46')]}});}})[_0x9416('0x11')](function(_0x263bc5){if(_0x263bc5){_0x2a8cfe=_0x263bc5;return db[_0x9416('0x5b')][_0x9416('0x3f')]({'where':{'id':_0x233d26[_0x9416('0x78')]}});}})['then'](function(_0xf7dfa1){if(_0xf7dfa1){if(_0x40c4f2){var _0x1cd1c9=null;for(var _0x4becc1=0x1;_0x4becc1<_0x233d26[_0x9416('0x76')][_0x9416('0x3c')];++_0x4becc1){_0x1cd1c9=_0x233d26[_0x9416('0x76')][_0x4becc1];var _0x5a0a7a=_0x1cd1c9['UserId']?util[_0x9416('0x79')](_0x9416('0x7a'),_0x2a8cfe['agentAlias'],_0x1cd1c9[_0x9416('0x5f')]):_0x9416('0x7b');var _0x519058=_0x434d18[_0x9416('0x42')][_0x9416('0x7c')]||util[_0x9416('0x79')](_0x9416('0x7a'),_0x9416('0x7d'),_0x1cd1c9[_0x9416('0x78')]);switch(_0x2a8cfe[_0x9416('0x7e')]){case'website_alias':_0x5a0a7a=_0x1cd1c9[_0x9416('0x5f')]?util[_0x9416('0x79')](_0x9416('0x7a'),_0x2a8cfe[_0x9416('0x7f')],_0x1cd1c9[_0x9416('0x5f')]):_0x9416('0x7b');break;case _0x9416('0x80'):_0x5a0a7a=_0x1cd1c9[_0x9416('0x5f')]?_0x1cd1c9[_0x9416('0x77')][_0x9416('0x81')]||_0x1cd1c9[_0x9416('0x77')][_0x9416('0x4b')]:_0x9416('0x7b');break;case'agent_fullname':_0x5a0a7a=_0x1cd1c9[_0x9416('0x5f')]?_0x1cd1c9[_0x9416('0x77')][_0x9416('0x4b')]:_0x9416('0x7b');break;default:_0x5a0a7a=_0x1cd1c9['UserId']?util[_0x9416('0x79')]('%s%d',_0x2a8cfe[_0x9416('0x7f')],_0x1cd1c9[_0x9416('0x5f')]):_0x9416('0x7b');}var _0x19c602=util['format']('[%s]\x20%s:\x20%s\x0a',moment(_0x1cd1c9[_0x9416('0x82')])[_0x9416('0x79')](_0x9416('0x83')),_0x1cd1c9[_0x9416('0x84')]==='in'?_0x519058:_0x5a0a7a,_0x1cd1c9[_0x9416('0x42')]);if(!_0x1cd1c9[_0x9416('0x85')]){fs[_0x9416('0x86')](_0x40c4f2,_0x19c602);}}return db[_0x9416('0x87')][_0x9416('0x44')]({'where':{'service':!![]},'include':[{'model':db[_0x9416('0x88')],'as':_0x9416('0x89'),'raw':!![],'include':[{'model':db[_0x9416('0x8a')],'as':_0x9416('0x8a'),'raw':!![]}]}]});}}})['then'](function(_0x4b5158){if(!_0x4b5158||!_0x4b5158[_0x9416('0x89')]||!_0x434d18[_0x9416('0x42')])return _0x233d26;var _0xec617a=_0x4b5158[_0x9416('0x8b')]();return respondWithRpcPromise('SendMail','sendMail',{'account':_0xec617a,'message':{'from':util[_0x9416('0x79')](_0x9416('0x8c'),_0x4b5158['name'],_0x4b5158[_0x9416('0x4c')]||_0x4b5158[_0x9416('0x89')][_0x9416('0x34')]),'to':_0x434d18[_0x9416('0x42')][_0x9416('0x71')],'subject':_0x9416('0x8d'),'text':util[_0x9416('0x79')](_0x9416('0x8e'),_0x434d18[_0x9416('0x42')]['mailTranscript']),'attachments':[{'path':_0x40c4f2}]}})[_0x9416('0x11')](function(){return _0x233d26;})['catch'](function(_0x45e2bb){logger[_0x9416('0x16')](_0x45e2bb);});})[_0x9416('0x11')](respondWithStatusCode(_0x4811c0,0xc8))[_0x9416('0x1b')](handleError(_0x4811c0,null));};exports[_0x9416('0x8f')]=function(_0xe17583,_0x51eb67){return db[_0x9416('0x58')]['find']({'where':{'id':_0xe17583[_0x9416('0x35')]['id']}})[_0x9416('0x11')](handleEntityNotFound(_0x51eb67,null))[_0x9416('0x11')](function(_0x4cb675){if(_0x4cb675){return _0x4cb675['addMessage'](_0xe17583[_0x9416('0x42')][_0x9416('0x90')],_['omit'](_0xe17583[_0x9416('0x42')],[_0x9416('0x90'),'id'])||{});}})[_0x9416('0x11')](respondWithResult(_0x51eb67,null))[_0x9416('0x1b')](handleError(_0x51eb67,null));};exports[_0x9416('0x91')]=function(_0x51d7dd,_0x9e90d8){var _0x528571={'raw':![],'where':{}};var _0x19871d={};var _0x81f2c5={'count':0x0,'rows':[]};return db['ChatInteraction'][_0x9416('0x44')]({'where':{'id':_0x51d7dd[_0x9416('0x35')]['id']}})[_0x9416('0x11')](handleEntityNotFound(_0x9e90d8,null))[_0x9416('0x11')](function(_0x281dfb){if(_0x281dfb){_0x19871d[_0x9416('0x36')]=_[_0x9416('0x37')](db[_0x9416('0x58')][_0x9416('0x2e')]);_0x19871d[_0x9416('0x33')]=_[_0x9416('0x37')](_0x51d7dd[_0x9416('0x33')]);_0x19871d['filters']=_[_0x9416('0x39')](_0x19871d[_0x9416('0x36')],_0x19871d[_0x9416('0x33')]);_0x528571[_0x9416('0x3b')]=_['intersection'](_0x19871d[_0x9416('0x36')],qs[_0x9416('0x3a')](_0x51d7dd[_0x9416('0x33')][_0x9416('0x3a')]));_0x528571[_0x9416('0x3b')]=_0x528571['attributes'][_0x9416('0x3c')]?_0x528571[_0x9416('0x3b')]:_0x19871d['model'];if(!_0x51d7dd[_0x9416('0x33')][_0x9416('0x92')](_0x9416('0x93'))){_0x528571['limit']=qs[_0x9416('0x22')](_0x51d7dd[_0x9416('0x33')]['limit']);_0x528571[_0x9416('0x20')]=qs[_0x9416('0x20')](_0x51d7dd['query']['offset']);}_0x528571[_0x9416('0x94')]=qs[_0x9416('0x95')](_0x51d7dd[_0x9416('0x33')][_0x9416('0x95')]);_0x528571[_0x9416('0x96')]=qs['filters'](_[_0x9416('0x97')](_0x51d7dd['query'],_0x19871d[_0x9416('0x38')]));_0x528571['where'][_0x9416('0x98')]=_0x281dfb['id'];if(_0x51d7dd['query'][_0x9416('0x99')]){_0x528571[_0x9416('0x96')]=_[_0x9416('0x2a')](_0x528571[_0x9416('0x96')],{'$or':_[_0x9416('0x2c')](_0x528571[_0x9416('0x3b')],function(_0x49216c){var _0x5245ba={};_0x5245ba[_0x49216c]={'$like':'%'+_0x51d7dd['query'][_0x9416('0x99')]+'%'};return _0x5245ba;})});}if(_0x51d7dd[_0x9416('0x33')]['$gte']){var _0x17aab4=_0x51d7dd['query'][_0x9416('0x9a')][_0x9416('0x9b')](',');var _0x3dcd78={};_0x3dcd78[_0x17aab4[0x0]]={'$gte':moment(_0x17aab4[0x1])[_0x9416('0x79')](_0x9416('0x9c'))};_0x528571[_0x9416('0x96')]=_[_0x9416('0x2a')](_0x528571[_0x9416('0x96')],_0x3dcd78);}_0x528571=_[_0x9416('0x2a')]({},_0x528571,_0x51d7dd[_0x9416('0x9d')]);return db['ChatMessage'][_0x9416('0x23')]({'where':_0x528571[_0x9416('0x96')]})[_0x9416('0x11')](function(_0x4dca15){_0x81f2c5[_0x9416('0x23')]=_0x4dca15;if(_0x51d7dd['query'][_0x9416('0x3d')]){_0x528571[_0x9416('0x3e')]=[{'all':!![]}];}return db['ChatMessage'][_0x9416('0x32')](_0x528571);})[_0x9416('0x11')](function(_0x18ef9e){_0x81f2c5[_0x9416('0x9e')]=_0x18ef9e;return _0x81f2c5;});}})['then'](respondWithFilteredResult(_0x9e90d8,_0x528571))[_0x9416('0x1b')](handleError(_0x9e90d8,null));};exports['getMyMessages']=function(_0x4eaf10,_0x4e9588){var _0xf80f26={'where':{}},_0x41a48b={},_0x52f253={'count':0x0,'rows':[]};return db[_0x9416('0x2d')][_0x9416('0x44')]({'where':{'id':_0x4eaf10[_0x9416('0x35')]['id']}})[_0x9416('0x11')](handleEntityNotFound(_0x4e9588,null))[_0x9416('0x11')](function(_0x141c10){if(_0x141c10){_0x41a48b[_0x9416('0x36')]=_[_0x9416('0x37')](db['ChatMessage'][_0x9416('0x2e')]);_0x41a48b[_0x9416('0x33')]=_['keys'](_0x4eaf10[_0x9416('0x33')]);_0x41a48b[_0x9416('0x38')]=_['intersection'](_0x41a48b[_0x9416('0x36')],_0x41a48b[_0x9416('0x33')]);_0xf80f26['attributes']=_[_0x9416('0x39')](_0x41a48b[_0x9416('0x36')],qs[_0x9416('0x3a')](_0x4eaf10[_0x9416('0x33')][_0x9416('0x3a')]));_0xf80f26[_0x9416('0x3b')]=_0xf80f26[_0x9416('0x3b')][_0x9416('0x3c')]?_0xf80f26[_0x9416('0x3b')]:_0x41a48b['model'];if(!_0x4eaf10[_0x9416('0x33')][_0x9416('0x92')]('nolimit')){_0xf80f26[_0x9416('0x22')]=qs[_0x9416('0x22')](_0x4eaf10[_0x9416('0x33')][_0x9416('0x22')]);_0xf80f26[_0x9416('0x20')]=qs[_0x9416('0x20')](_0x4eaf10['query'][_0x9416('0x20')]);}_0xf80f26[_0x9416('0x94')]=qs[_0x9416('0x95')](_0x4eaf10[_0x9416('0x33')][_0x9416('0x95')]);_0xf80f26[_0x9416('0x96')]=qs[_0x9416('0x38')](_[_0x9416('0x97')](_0x4eaf10[_0x9416('0x33')],_0x41a48b[_0x9416('0x38')]));_0xf80f26[_0x9416('0x96')][_0x9416('0x98')]=_0x141c10['id'];if(_0x4eaf10[_0x9416('0x33')][_0x9416('0x99')]){_0xf80f26['where']=_[_0x9416('0x2a')](_0xf80f26['where'],{'$or':_[_0x9416('0x2c')](_0xf80f26[_0x9416('0x3b')],function(_0x55ae10){var _0x4b0d0a={};_0x4b0d0a[_0x55ae10]={'$like':'%'+_0x4eaf10[_0x9416('0x33')][_0x9416('0x99')]+'%'};return _0x4b0d0a;})});}_0xf80f26[_0x9416('0x96')][_0x9416('0x85')]=![];if(_0x4eaf10[_0x9416('0x33')]['id']){_0xf80f26[_0x9416('0x96')]['id']={'$gt':_0x4eaf10[_0x9416('0x33')]['id']};}_0xf80f26=_[_0x9416('0x2a')]({},_0xf80f26,_0x4eaf10[_0x9416('0x9d')]);return db['ChatMessage'][_0x9416('0x23')]({'where':_0xf80f26['where']})[_0x9416('0x11')](function(_0x2264cf){_0x52f253[_0x9416('0x23')]=_0x2264cf;_0xf80f26['include']=[];if(_0x4eaf10[_0x9416('0x33')][_0x9416('0x9f')]){_0xf80f26['include'][_0x9416('0xa0')]({'model':db['User'],'as':_0x9416('0x77'),'attributes':['id','fullname','alias']});}if(_0x4eaf10[_0x9416('0x33')][_0x9416('0x3d')]){_0xf80f26['include']=[{'all':!![]}];}return db[_0x9416('0x58')][_0x9416('0x32')](_0xf80f26);})[_0x9416('0x11')](function(_0x3ebf9b){_0x52f253[_0x9416('0x9e')]=_0x3ebf9b;return _0x52f253;});}})[_0x9416('0x11')](respondWithFilteredResult(_0x4e9588,_0xf80f26))[_0x9416('0x1b')](handleError(_0x4e9588,null));};exports[_0x9416('0xa1')]=function(_0x2f6e35,_0x1971e4){return db[_0x9416('0x2d')][_0x9416('0x3f')]({'where':{'id':_0x2f6e35[_0x9416('0x35')]['id']}})[_0x9416('0x11')](handleEntityNotFound(_0x1971e4,null))[_0x9416('0x11')](function(_0x3c84b5){if(_0x3c84b5){return _0x3c84b5['setTags'](_0x2f6e35['body'][_0x9416('0x90')],_[_0x9416('0xa2')](_0x2f6e35[_0x9416('0x42')],[_0x9416('0x90'),'id'])||{})[_0x9416('0xa3')](function(){return db[_0x9416('0xa4')]['findAll']({'attributes':['id','name',_0x9416('0xa5')],'where':{'id':_0x2f6e35[_0x9416('0x42')]['ids']}});})[_0x9416('0x11')](function(_0x1588d2){socket[_0x9416('0xa6')](_0x9416('0xa7'),{'id':Number(_0x2f6e35[_0x9416('0x35')]['id']),'tags':_0x1588d2||[]});return{'id':Number(_0x2f6e35['params']['id']),'tags':_0x1588d2||[]};});}})['then'](respondWithResult(_0x1971e4,null))[_0x9416('0x1b')](handleError(_0x1971e4,null));};exports[_0x9416('0xa8')]=function(_0x26cc26,_0x15c651){return db[_0x9416('0x2d')][_0x9416('0x3f')]({'where':{'id':_0x26cc26['params']['id']}})[_0x9416('0x11')](handleEntityNotFound(_0x15c651,null))[_0x9416('0x11')](function(_0xe76b87){if(_0xe76b87){return _0xe76b87[_0x9416('0xa8')](_0x26cc26['query'][_0x9416('0x90')]);}})[_0x9416('0x11')](respondWithStatusCode(_0x15c651,null))[_0x9416('0x1b')](handleError(_0x15c651,null));};exports['download']=function(_0x447c04,_0x3f86af){var _0x40e71f=moment()['unix']()[_0x9416('0xa9')]();var _0x3f1e1f=path[_0x9416('0x6b')](config[_0x9416('0x72')],'server',_0x9416('0xaa'),'tmp');var _0x2567b4=path[_0x9416('0x6b')](config[_0x9416('0x72')],_0x9416('0xab'),_0x9416('0xaa'),_0x9416('0xac'));var _0x328f8b=path[_0x9416('0x6b')](_0x3f1e1f,_0x40e71f);var _0x466d8d=util[_0x9416('0x79')](_0x9416('0xad'),_0x447c04['params']['id'],_0x40e71f);var _0x33ea1a=path[_0x9416('0x6b')](_0x3f1e1f,_0x466d8d);var _0x5e6e2b=[];_0x5e6e2b[_0x9416('0xa0')]({'model':db[_0x9416('0x77')],'as':_0x9416('0x77'),'attributes':['id','fullname'],'raw':!![]});_0x5e6e2b[_0x9416('0xa0')]({'model':db[_0x9416('0x5b')],'as':'Contact','attributes':['id',_0x9416('0xae'),_0x9416('0xaf')],'raw':!![]});if(_0x447c04[_0x9416('0x33')][_0x9416('0xac')]){_0x5e6e2b[_0x9416('0xa0')]({'model':db[_0x9416('0x66')],'as':_0x9416('0x66'),'raw':!![]});}var _0x8e6566=[{'model':db[_0x9416('0x58')],'as':_0x9416('0x76'),'attributes':['id',_0x9416('0x42'),_0x9416('0x82'),_0x9416('0x84'),_0x9416('0x85'),_0x9416('0xb0')],'include':_0x5e6e2b}];_0x8e6566[_0x9416('0xa0')]({'model':db[_0x9416('0x45')],'as':_0x9416('0xb1'),'attributes':['id',_0x9416('0x27')]});_0x8e6566[_0x9416('0xa0')]({'model':db['User'],'as':_0x9416('0xb2'),'attributes':['id','fullname']});return db[_0x9416('0x2d')]['find']({'where':{'id':_0x447c04['params']['id']},'include':_0x8e6566})[_0x9416('0x11')](handleEntityNotFound(_0x3f86af,null))[_0x9416('0x11')](function(_0x44b899){if(_0x44b899){var _0x355b32=_0x44b899[_0x9416('0xb3')]({'plain':!![]});fs[_0x9416('0xb4')](_0x328f8b);var _0x11daae={'channel':_0x9416('0xb5'),'account':_0x355b32[_0x9416('0xb1')][_0x9416('0x27')],'agent':_0x355b32[_0x9416('0xb2')]?_0x355b32['Owner']['fullname']:_0x9416('0xb6'),'createdAt':moment(_0x355b32['createdAt'])[_0x9416('0x79')](_0x9416('0x9c'))[_0x9416('0xa9')](),'closedAt':_0x355b32['closed']?moment(_0x355b32[_0x9416('0xb7')])[_0x9416('0x79')](_0x9416('0x9c'))[_0x9416('0xa9')]():'','disposition':_0x355b32['disposition'],'chatInfo':{'browser':_0x355b32['browserName'],'os':_0x355b32[_0x9416('0xb8')],'referer':_0x355b32[_0x9416('0xb9')],'customerIp':_0x355b32[_0x9416('0xba')],'customerPort':_0x355b32[_0x9416('0xbb')]?_0x355b32[_0x9416('0xbb')]:'N.A.'},'messages':_(_0x355b32[_0x9416('0x76')])[_0x9416('0xbc')]()[_0x9416('0x99')]({'secret':![]})['map'](function(_0x13ba57){if(_0x13ba57[_0x9416('0x66')]){var _0x357048=path[_0x9416('0x6b')](_0x2567b4,_0x13ba57[_0x9416('0x66')][_0x9416('0x6e')]);if(fs[_0x9416('0xbd')](_0x357048)){fs[_0x9416('0xbe')](_0x357048)['pipe'](fs['createWriteStream'](path[_0x9416('0x6b')](_0x328f8b,_0x13ba57['Attachment']['basename'])));}}return{'date':moment(_0x13ba57[_0x9416('0x82')])[_0x9416('0x79')](_0x9416('0x9c'))[_0x9416('0xa9')](),'sender':_0x13ba57[_0x9416('0x84')]===_0x9416('0x57')?_0x13ba57[_0x9416('0x77')]?_0x13ba57[_0x9416('0x77')]['fullname']:_0x9416('0x7b'):_0x13ba57[_0x9416('0x5c')][_0x9416('0xae')]+(_0x13ba57[_0x9416('0x5c')][_0x9416('0xaf')]?'\x20'+_0x13ba57[_0x9416('0x5c')][_0x9416('0xaf')]:''),'body':_0x13ba57[_0x9416('0x66')]?_0x13ba57[_0x9416('0x66')][_0x9416('0x6e')]:_0x13ba57['body'],'direction':_0x13ba57['direction']===_0x9416('0x57')?'A':'C','secret':_0x13ba57['secret'],'read':_0x13ba57[_0x9416('0xb0')],'attachment':_0x13ba57['Attachment']};})[_0x9416('0xbf')]()};return ejs[_0x9416('0xc0')](path[_0x9416('0x6b')](config[_0x9416('0x72')],_0x9416('0xab'),'views',_0x9416('0xc1')),{'interaction':_0x11daae})[_0x9416('0x11')](function(_0x5c58a8){var _0x32745c=path[_0x9416('0x6b')](_0x328f8b,_0x9416('0xc2')+_0x355b32['id']+'-'+_0x40e71f+_0x9416('0xc3'));var _0xf66d4a={'path':_0x32745c,'channel':_0x9416('0xb5'),'interactionId':_0x355b32['id']};return pdf[_0x9416('0xc4')](_0x5c58a8,_0xf66d4a);})[_0x9416('0x11')](function(){return new Promise(function(_0x26cc20,_0x11779b){zipdir(_0x328f8b,{'saveTo':_0x33ea1a},function(_0x1cc995,_0x1ebc5a){if(_0x1cc995)return _0x11779b(_0x1cc995);return _0x26cc20(_0x1ebc5a);});})[_0x9416('0x11')](function(){return new BPromise(function(_0x9656a6,_0x15d7f0){rimraf(_0x328f8b,function(_0x57bfab){if(_0x57bfab)_0x15d7f0(_0x57bfab);return _0x9656a6();});});})[_0x9416('0x11')](function(){return _0x3f86af[_0x9416('0x6f')](_0x33ea1a,_0x466d8d,function(_0x1457fd){if(_0x1457fd){logger[_0x9416('0x16')]('err',_0x1457fd);}else{fs[_0x9416('0xc5')](_0x33ea1a);}});});});}else{return _0x3f86af[_0x9416('0x1c')](0xc8);}})['catch'](handleError(_0x3f86af,null));}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.events.js b/server/api/chatInteraction/chatInteraction.events.js index 9648f27..df2a361 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 _0x268a=['emit','catch','hasOwnProperty','hook','exports','../../mysqldb','ChatInteraction','ChatMessage','save','update','remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length'];(function(_0x133ca5,_0x4822ba){var _0x2d9eb3=function(_0x10ce83){while(--_0x10ce83){_0x133ca5['push'](_0x133ca5['shift']());}};_0x2d9eb3(++_0x4822ba);}(_0x268a,0x113));var _0xa268=function(_0x1ccbcc,_0x5c948b){_0x1ccbcc=_0x1ccbcc-0x0;var _0x1e873f=_0x268a[_0x1ccbcc];return _0x1e873f;};'use strict';var EventEmitter=require('events');var ChatInteraction=require(_0xa268('0x0'))['db'][_0xa268('0x1')];var ChatMessage=require('../../mysqldb')['db'][_0xa268('0x2')];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xa268('0x3'),'afterUpdate':_0xa268('0x4'),'afterDestroy':_0xa268('0x5')};function emitEvent(_0x39e14d){return function(_0x53fc42,_0x1f691d,_0xf4d548){_0x53fc42[_0xa268('0x6')]({'attributes':['id'],'raw':!![]})[_0xa268('0x7')](function(_0x28bf33){_0x53fc42[_0xa268('0x8')]('Users',_0x28bf33[_0xa268('0x9')](function(_0x3215bc){return{'id':_0x3215bc['id']};}));return ChatMessage[_0xa268('0xa')]({'where':{'ChatInteractionId':_0x53fc42['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa268('0x7')](function(_0x137d13){_0x53fc42[_0xa268('0x8')](_0xa268('0xb'),_0x137d13[_0xa268('0xc')]);ChatInteractionEvents[_0xa268('0xd')](_0x39e14d+':'+_0x53fc42['id'],_0x53fc42);ChatInteractionEvents[_0xa268('0xd')](_0x39e14d,_0x53fc42);_0xf4d548(null);})[_0xa268('0xe')](_0xf4d548(null));};}for(var e in events){if(events[_0xa268('0xf')](e)){var event=events[e];ChatInteraction[_0xa268('0x10')](e,emitEvent(event));}}module[_0xa268('0x11')]=ChatInteractionEvents; \ No newline at end of file +var _0xd205=['hasOwnProperty','hook','exports','events','../../mysqldb','ChatInteraction','setMaxListeners','update','getUsers','then','Users','setDataValue','unreadMessages','emit','catch'];(function(_0x543084,_0x4337f5){var _0x306a57=function(_0x2769ed){while(--_0x2769ed){_0x543084['push'](_0x543084['shift']());}};_0x306a57(++_0x4337f5);}(_0xd205,0x99));var _0x5d20=function(_0x3ca9c7,_0x36c71c){_0x3ca9c7=_0x3ca9c7-0x0;var _0xd68797=_0xd205[_0x3ca9c7];return _0xd68797;};'use strict';var EventEmitter=require(_0x5d20('0x0'));var ChatInteraction=require(_0x5d20('0x1'))['db'][_0x5d20('0x2')];var ChatMessage=require(_0x5d20('0x1'))['db']['ChatMessage'];var ChatInteractionEvents=new EventEmitter();ChatInteractionEvents[_0x5d20('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x5d20('0x4'),'afterDestroy':'remove'};function emitEvent(_0x5f227e){return function(_0x2d7204,_0x15fd16,_0xdfb4a8){_0x2d7204[_0x5d20('0x5')]({'attributes':['id'],'raw':!![]})[_0x5d20('0x6')](function(_0x263b19){_0x2d7204['setDataValue'](_0x5d20('0x7'),_0x263b19['map'](function(_0x387cb8){return{'id':_0x387cb8['id']};}));return ChatMessage['findAll']({'where':{'ChatInteractionId':_0x2d7204['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x4cbae6){_0x2d7204[_0x5d20('0x8')](_0x5d20('0x9'),_0x4cbae6['length']);ChatInteractionEvents[_0x5d20('0xa')](_0x5f227e+':'+_0x2d7204['id'],_0x2d7204);ChatInteractionEvents[_0x5d20('0xa')](_0x5f227e,_0x2d7204);_0xdfb4a8(null);})[_0x5d20('0xb')](_0xdfb4a8(null));};}for(var e in events){if(events[_0x5d20('0xc')](e)){var event=events[e];ChatInteraction[_0x5d20('0xd')](e,emitEvent(event));}}module[_0x5d20('0xe')]=ChatInteractionEvents; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.model.js b/server/api/chatInteraction/chatInteraction.model.js index 38f423f..2d74954 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 _0xcc8e=['../../config/logger','api','moment','request-promise','path','rimraf','exports','define','ChatInteraction','chat_interactions','closed','utf8mb4','utf8mb4_unicode_ci','lodash'];(function(_0x665846,_0x5503d8){var _0x16c349=function(_0x2b34a9){while(--_0x2b34a9){_0x665846['push'](_0x665846['shift']());}};_0x16c349(++_0x5503d8);}(_0xcc8e,0x1bf));var _0xecc8=function(_0x49dc71,_0x799325){_0x49dc71=_0x49dc71-0x0;var _0xe9def6=_0xcc8e[_0x49dc71];return _0xe9def6;};'use strict';var _=require(_0xecc8('0x0'));var util=require('util');var logger=require(_0xecc8('0x1'))(_0xecc8('0x2'));var moment=require(_0xecc8('0x3'));var BPromise=require('bluebird');var rp=require(_0xecc8('0x4'));var fs=require('fs');var path=require(_0xecc8('0x5'));var rimraf=require(_0xecc8('0x6'));var config=require('../../config/environment');var attributes=require('./chatInteraction.attributes');module[_0xecc8('0x7')]=function(_0x152724,_0x3e6d49){return _0x152724[_0xecc8('0x8')](_0xecc8('0x9'),attributes,{'tableName':_0xecc8('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x38c1f2,_0x73e0da,_0x2e1a33){if(_0x38c1f2['changed'](_0xecc8('0xb'))){_0x38c1f2['closedAt']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x2e1a33(null,_0x38c1f2);}},'charset':_0xecc8('0xc'),'collate':_0xecc8('0xd')});}; \ No newline at end of file +var _0x40c3=['utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./chatInteraction.attributes','exports','ChatInteraction','closed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3a7374,_0xfc6988){var _0x252741=function(_0x4ae397){while(--_0x4ae397){_0x3a7374['push'](_0x3a7374['shift']());}};_0x252741(++_0xfc6988);}(_0x40c3,0x16b));var _0x340c=function(_0x1ae5ab,_0xc5d441){_0x1ae5ab=_0x1ae5ab-0x0;var _0x1ce001=_0x40c3[_0x1ae5ab];return _0x1ce001;};'use strict';var _=require(_0x340c('0x0'));var util=require(_0x340c('0x1'));var logger=require(_0x340c('0x2'))(_0x340c('0x3'));var moment=require(_0x340c('0x4'));var BPromise=require(_0x340c('0x5'));var rp=require(_0x340c('0x6'));var fs=require('fs');var path=require(_0x340c('0x7'));var rimraf=require(_0x340c('0x8'));var config=require(_0x340c('0x9'));var attributes=require(_0x340c('0xa'));module[_0x340c('0xb')]=function(_0x5b70e4,_0x3ac2af){return _0x5b70e4['define'](_0x340c('0xc'),attributes,{'tableName':'chat_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1a092b,_0x469d76,_0xdb82f8){if(_0x1a092b['changed'](_0x340c('0xd'))){_0x1a092b[_0x340c('0xe')]=moment()[_0x340c('0xf')](_0x340c('0x10'));}_0xdb82f8(null,_0x1a092b);}},'charset':_0x340c('0x11'),'collate':_0x340c('0x12')});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.rpc.js b/server/api/chatInteraction/chatInteraction.rpc.js index 19d2df5..c17f57d 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 _0xf6b6=['socket.io-emitter','./chatInteraction.socket','register','then','info','ChatInteraction,\x20%s,\x20%s','request\x20sent','ChatInteraction,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','UpdateChatInteraction','update','body','options','attributes','limit','debug','AddTagsToChatInteraction','find','addTags','ids','omit','AddTags','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','defaults','localhost'];(function(_0x254067,_0x4d151a){var _0x5e225a=function(_0x1f3e2b){while(--_0x1f3e2b){_0x254067['push'](_0x254067['shift']());}};_0x5e225a(++_0x4d151a);}(_0xf6b6,0x1ee));var _0x6f6b=function(_0x20040f,_0x4969ba){_0x20040f=_0x20040f-0x0;var _0x539e5b=_0xf6b6[_0x20040f];return _0x539e5b;};'use strict';var _=require('lodash');var util=require(_0x6f6b('0x0'));var moment=require(_0x6f6b('0x1'));var BPromise=require(_0x6f6b('0x2'));var rs=require(_0x6f6b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f6b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6f6b('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x6f6b('0x6'));var client=jayson[_0x6f6b('0x7')]['http']({'port':0x232a});config['redis']=_[_0x6f6b('0x8')](config['redis'],{'host':_0x6f6b('0x9'),'port':0x18eb});var socket=require(_0x6f6b('0xa'))(new Redis(config['redis']));require(_0x6f6b('0xb'))[_0x6f6b('0xc')](socket);function respondWithRpcPromise(_0x371ffd,_0x4672e6,_0x6fdc31){return new BPromise(function(_0x2e8dd7,_0x5eb3b0){return client['request'](_0x371ffd,_0x6fdc31)[_0x6f6b('0xd')](function(_0x23f2b9){logger[_0x6f6b('0xe')](_0x6f6b('0xf'),_0x4672e6,_0x6f6b('0x10'));logger['debug'](_0x6f6b('0x11'),_0x4672e6,'request\x20sent',JSON[_0x6f6b('0x12')](_0x23f2b9));if(_0x23f2b9[_0x6f6b('0x13')]){if(_0x23f2b9[_0x6f6b('0x13')]['code']===0x1f4){logger[_0x6f6b('0x13')](_0x6f6b('0xf'),_0x4672e6,_0x23f2b9[_0x6f6b('0x13')][_0x6f6b('0x14')]);return _0x5eb3b0(_0x23f2b9[_0x6f6b('0x13')][_0x6f6b('0x14')]);}logger['error'](_0x6f6b('0xf'),_0x4672e6,_0x23f2b9['error'][_0x6f6b('0x14')]);return _0x2e8dd7(_0x23f2b9['error'][_0x6f6b('0x14')]);}else{logger[_0x6f6b('0xe')](_0x6f6b('0xf'),_0x4672e6,_0x6f6b('0x10'));_0x2e8dd7(_0x23f2b9[_0x6f6b('0x15')][_0x6f6b('0x14')]);}})[_0x6f6b('0x16')](function(_0x364156){logger['error'](_0x6f6b('0xf'),_0x4672e6,_0x364156);_0x5eb3b0(_0x364156);});});}exports[_0x6f6b('0x17')]=function(_0x2f8af7){var _0x3f992f=this;return new Promise(function(_0x158a9a,_0x522397){return db['ChatInteraction'][_0x6f6b('0x18')](_0x2f8af7[_0x6f6b('0x19')],{'raw':_0x2f8af7[_0x6f6b('0x1a')]?_0x2f8af7['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2f8af7[_0x6f6b('0x1a')]?_0x2f8af7[_0x6f6b('0x1a')]['where']||null:null,'attributes':_0x2f8af7[_0x6f6b('0x1a')]?_0x2f8af7[_0x6f6b('0x1a')][_0x6f6b('0x1b')]||null:null,'limit':_0x2f8af7['options']?_0x2f8af7['options'][_0x6f6b('0x1c')]||null:null})[_0x6f6b('0xd')](function(_0x41f61c){logger[_0x6f6b('0xe')]('UpdateChatInteraction',_0x2f8af7);logger[_0x6f6b('0x1d')](_0x6f6b('0x17'),_0x2f8af7,JSON['stringify'](_0x41f61c));_0x158a9a(_0x41f61c);})['catch'](function(_0x49387b){logger[_0x6f6b('0x13')](_0x6f6b('0x17'),_0x49387b['message'],_0x2f8af7);_0x522397(_0x3f992f[_0x6f6b('0x13')](0x1f4,_0x49387b[_0x6f6b('0x14')]));});});};exports[_0x6f6b('0x1e')]=function(_0x4d15f8){return new Promise(function(_0x31ac09,_0x43c806){return db['ChatInteraction'][_0x6f6b('0x1f')]({'where':_0x4d15f8[_0x6f6b('0x1a')]?_0x4d15f8[_0x6f6b('0x1a')]['where']||null:null})['then'](function(_0x5dd367){if(_0x5dd367){return _0x5dd367[_0x6f6b('0x20')](_0x4d15f8[_0x6f6b('0x19')][_0x6f6b('0x21')],_[_0x6f6b('0x22')](_0x4d15f8[_0x6f6b('0x19')],['ids','id'])||{});}})['spread'](function(_0x486fed){logger[_0x6f6b('0xe')]('AddTags',_0x4d15f8);logger['debug'](_0x6f6b('0x23'),_0x4d15f8,JSON['stringify'](_0x486fed));_0x31ac09(_0x486fed);})[_0x6f6b('0x16')](function(_0x5de1e1){logger[_0x6f6b('0x13')]('AddTags',_0x5de1e1[_0x6f6b('0x14')],_0x4d15f8);_0x43c806(_this[_0x6f6b('0x13')](0x1f4,_0x5de1e1['message']));});});}; \ No newline at end of file +var _0xa3e9=['defaults','redis','socket.io-emitter','./chatInteraction.socket','register','request','then','ChatInteraction,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','UpdateChatInteraction','ChatInteraction','update','options','raw','where','attributes','info','body','ids','spread','AddTags','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http'];(function(_0x3504ec,_0x4d738f){var _0xfb3f61=function(_0x140d2e){while(--_0x140d2e){_0x3504ec['push'](_0x3504ec['shift']());}};_0xfb3f61(++_0x4d738f);}(_0xa3e9,0x106));var _0x9a3e=function(_0xa312ca,_0x275d91){_0xa312ca=_0xa312ca-0x0;var _0x4a34fb=_0xa3e9[_0xa312ca];return _0x4a34fb;};'use strict';var _=require(_0x9a3e('0x0'));var util=require(_0x9a3e('0x1'));var moment=require(_0x9a3e('0x2'));var BPromise=require(_0x9a3e('0x3'));var rs=require(_0x9a3e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x9a3e('0x5'));var logger=require(_0x9a3e('0x6'))(_0x9a3e('0x7'));var config=require(_0x9a3e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9a3e('0x9')][_0x9a3e('0xa')]({'port':0x232a});config['redis']=_[_0x9a3e('0xb')](config[_0x9a3e('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x9a3e('0xd'))(new Redis(config[_0x9a3e('0xc')]));require(_0x9a3e('0xe'))[_0x9a3e('0xf')](socket);function respondWithRpcPromise(_0x125ded,_0x444865,_0x5cd6ce){return new BPromise(function(_0x5cb494,_0x565a53){return client[_0x9a3e('0x10')](_0x125ded,_0x5cd6ce)[_0x9a3e('0x11')](function(_0x5614f8){logger['info'](_0x9a3e('0x12'),_0x444865,'request\x20sent');logger[_0x9a3e('0x13')]('ChatInteraction,\x20%s,\x20%s,\x20%s',_0x444865,'request\x20sent',JSON[_0x9a3e('0x14')](_0x5614f8));if(_0x5614f8[_0x9a3e('0x15')]){if(_0x5614f8['error'][_0x9a3e('0x16')]===0x1f4){logger[_0x9a3e('0x15')](_0x9a3e('0x12'),_0x444865,_0x5614f8[_0x9a3e('0x15')][_0x9a3e('0x17')]);return _0x565a53(_0x5614f8[_0x9a3e('0x15')][_0x9a3e('0x17')]);}logger[_0x9a3e('0x15')](_0x9a3e('0x12'),_0x444865,_0x5614f8['error'][_0x9a3e('0x17')]);return _0x5cb494(_0x5614f8[_0x9a3e('0x15')][_0x9a3e('0x17')]);}else{logger['info']('ChatInteraction,\x20%s,\x20%s',_0x444865,_0x9a3e('0x18'));_0x5cb494(_0x5614f8[_0x9a3e('0x19')][_0x9a3e('0x17')]);}})[_0x9a3e('0x1a')](function(_0x173044){logger[_0x9a3e('0x15')](_0x9a3e('0x12'),_0x444865,_0x173044);_0x565a53(_0x173044);});});}exports[_0x9a3e('0x1b')]=function(_0x2852f5){var _0x1232e=this;return new Promise(function(_0x3dfbed,_0x45f6cd){return db[_0x9a3e('0x1c')][_0x9a3e('0x1d')](_0x2852f5['body'],{'raw':_0x2852f5[_0x9a3e('0x1e')]?_0x2852f5['options'][_0x9a3e('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2852f5[_0x9a3e('0x1e')]?_0x2852f5[_0x9a3e('0x1e')][_0x9a3e('0x20')]||null:null,'attributes':_0x2852f5[_0x9a3e('0x1e')]?_0x2852f5['options'][_0x9a3e('0x21')]||null:null,'limit':_0x2852f5[_0x9a3e('0x1e')]?_0x2852f5[_0x9a3e('0x1e')]['limit']||null:null})[_0x9a3e('0x11')](function(_0x48e69c){logger[_0x9a3e('0x22')]('UpdateChatInteraction',_0x2852f5);logger[_0x9a3e('0x13')]('UpdateChatInteraction',_0x2852f5,JSON[_0x9a3e('0x14')](_0x48e69c));_0x3dfbed(_0x48e69c);})['catch'](function(_0x113edb){logger[_0x9a3e('0x15')](_0x9a3e('0x1b'),_0x113edb[_0x9a3e('0x17')],_0x2852f5);_0x45f6cd(_0x1232e[_0x9a3e('0x15')](0x1f4,_0x113edb['message']));});});};exports['AddTagsToChatInteraction']=function(_0x24119b){return new Promise(function(_0xfd761b,_0x4f2f84){return db['ChatInteraction']['find']({'where':_0x24119b[_0x9a3e('0x1e')]?_0x24119b[_0x9a3e('0x1e')]['where']||null:null})[_0x9a3e('0x11')](function(_0xd8af1a){if(_0xd8af1a){return _0xd8af1a['addTags'](_0x24119b[_0x9a3e('0x23')][_0x9a3e('0x24')],_['omit'](_0x24119b['body'],[_0x9a3e('0x24'),'id'])||{});}})[_0x9a3e('0x25')](function(_0x147ee2){logger[_0x9a3e('0x22')]('AddTags',_0x24119b);logger[_0x9a3e('0x13')]('AddTags',_0x24119b,JSON[_0x9a3e('0x14')](_0x147ee2));_0xfd761b(_0x147ee2);})[_0x9a3e('0x1a')](function(_0x44f5c5){logger[_0x9a3e('0x15')](_0x9a3e('0x26'),_0x44f5c5['message'],_0x24119b);_0x4f2f84(_this[_0x9a3e('0x15')](0x1f4,_0x44f5c5['message']));});});}; \ No newline at end of file diff --git a/server/api/chatInteraction/chatInteraction.socket.js b/server/api/chatInteraction/chatInteraction.socket.js index e7b3ea0..8c824e9 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 _0x7c91=['remove','update','emit','removeListener','chatInteraction:','./chatInteraction.events'];(function(_0x1b389d,_0x11579d){var _0x4704f2=function(_0x62739f){while(--_0x62739f){_0x1b389d['push'](_0x1b389d['shift']());}};_0x4704f2(++_0x11579d);}(_0x7c91,0x119));var _0x17c9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7c91[_0x3dd15e];return _0x231fd0;};'use strict';var ChatInteractionEvents=require(_0x17c9('0x0'));var events=['save',_0x17c9('0x1'),_0x17c9('0x2')];function createListener(_0x182a97,_0x2c8dac){return function(_0x1e74d4){_0x2c8dac[_0x17c9('0x3')](_0x182a97,_0x1e74d4);};}function removeListener(_0x5b486f,_0x6f7866){return function(){ChatInteractionEvents[_0x17c9('0x4')](_0x5b486f,_0x6f7866);};}exports['register']=function(_0x498e9e){for(var _0x298fc2=0x0,_0x4b5030=events['length'];_0x298fc2<_0x4b5030;_0x298fc2++){var _0xfbd1d4=events[_0x298fc2];var _0x4d7861=createListener(_0x17c9('0x5')+_0xfbd1d4,_0x498e9e);ChatInteractionEvents['on'](_0xfbd1d4,_0x4d7861);}}; \ No newline at end of file +var _0x09bf=['removeListener','register','length','chatInteraction:','./chatInteraction.events','remove','update'];(function(_0x5b013d,_0xc7691c){var _0x2b6eef=function(_0x3143ca){while(--_0x3143ca){_0x5b013d['push'](_0x5b013d['shift']());}};_0x2b6eef(++_0xc7691c);}(_0x09bf,0xa5));var _0xf09b=function(_0x5e3536,_0xace10d){_0x5e3536=_0x5e3536-0x0;var _0x3eb375=_0x09bf[_0x5e3536];return _0x3eb375;};'use strict';var ChatInteractionEvents=require(_0xf09b('0x0'));var events=['save',_0xf09b('0x1'),_0xf09b('0x2')];function createListener(_0x2c20e0,_0x5e2268){return function(_0x51e3b2){_0x5e2268['emit'](_0x2c20e0,_0x51e3b2);};}function removeListener(_0x457683,_0x2e575e){return function(){ChatInteractionEvents[_0xf09b('0x3')](_0x457683,_0x2e575e);};}exports[_0xf09b('0x4')]=function(_0xc2e1df){for(var _0xdcbbcb=0x0,_0xfe69b=events[_0xf09b('0x5')];_0xdcbbcb<_0xfe69b;_0xdcbbcb++){var _0x5b83b4=events[_0xdcbbcb];var _0x52828a=createListener(_0xf09b('0x6')+_0x5b83b4,_0xc2e1df);ChatInteractionEvents['on'](_0x5b83b4,_0x52828a);}}; \ No newline at end of file diff --git a/server/api/chatInteraction/index.js b/server/api/chatInteraction/index.js index 54aa5ad..6c72873 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 _0x46bf=['./chatInteraction.controller','get','isAuthenticated','/describe','describe','isChatInteractionAuthorized','/:id/attachment_download','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','getMyMessages','post','create','/:id/vidaoo','createVidaooSession','join','root','server/files/attachments/','format','%s-%s','now','originalname','replace','/:id/attachment_upload','file','attachmentUpload','addMessage','chat','addTags','chatinteraction:update','update','put','/:id/abandon','abandon','/:id/close','close','delete','/:id','chatinteraction:destroy','destroy','/:id/tags','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x46bf,0x1dc));var _0xf46b=function(_0x120123,_0x4eff59){_0x120123=_0x120123-0x0;var _0x3bec4c=_0x46bf[_0x120123];return _0x3bec4c;};'use strict';var multer=require(_0xf46b('0x0'));var util=require(_0xf46b('0x1'));var path=require(_0xf46b('0x2'));var timeout=require(_0xf46b('0x3'));var express=require(_0xf46b('0x4'));var router=express[_0xf46b('0x5')]();var fs_extra=require(_0xf46b('0x6'));var auth=require(_0xf46b('0x7'));var interaction=require(_0xf46b('0x8'));var config=require(_0xf46b('0x9'));var controller=require(_0xf46b('0xa'));router[_0xf46b('0xb')]('/',auth[_0xf46b('0xc')](),controller['index']);router[_0xf46b('0xb')](_0xf46b('0xd'),auth[_0xf46b('0xc')](),controller[_0xf46b('0xe')]);router['get']('/:id',auth[_0xf46b('0xf')](),controller['show']);router[_0xf46b('0xb')](_0xf46b('0x10'),auth[_0xf46b('0xf')](),controller[_0xf46b('0x11')]);router[_0xf46b('0xb')](_0xf46b('0x12'),auth[_0xf46b('0xc')](),controller[_0xf46b('0x13')]);router[_0xf46b('0xb')](_0xf46b('0x14'),auth[_0xf46b('0xf')](),controller[_0xf46b('0x15')]);router[_0xf46b('0xb')]('/:id/download',auth[_0xf46b('0xc')](),controller['download']);router[_0xf46b('0x16')]('/',auth[_0xf46b('0xc')](),controller[_0xf46b('0x17')]);router[_0xf46b('0x16')](_0xf46b('0x18'),auth[_0xf46b('0xc')](),controller[_0xf46b('0x19')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x1cc1b6,_0x5ceb1d,_0x23a1d5){_0x23a1d5(null,path[_0xf46b('0x1a')](config[_0xf46b('0x1b')],_0xf46b('0x1c')));},'filename':function(_0x4dd30a,_0x5ad220,_0x39f48a){_0x39f48a(null,util[_0xf46b('0x1d')](_0xf46b('0x1e'),Date[_0xf46b('0x1f')](),_0x5ad220[_0xf46b('0x20')][_0xf46b('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xf46b('0x16')](_0xf46b('0x22'),upload['single'](_0xf46b('0x23')),controller[_0xf46b('0x24')]);router[_0xf46b('0x16')](_0xf46b('0x12'),auth[_0xf46b('0xf')](),controller[_0xf46b('0x25')]);router[_0xf46b('0x16')]('/:id/tags',auth[_0xf46b('0xc')](),interaction['tracked'](_0xf46b('0x26'),'chatinteraction:addtags'),controller[_0xf46b('0x27')]);router['put']('/:id',auth[_0xf46b('0xc')](),interaction['tracked'](_0xf46b('0x26'),_0xf46b('0x28')),controller[_0xf46b('0x29')]);router[_0xf46b('0x2a')]('/:id/custom_update',controller['customUpdate']);router[_0xf46b('0x2a')](_0xf46b('0x2b'),auth[_0xf46b('0xf')](),controller[_0xf46b('0x2c')]);router[_0xf46b('0x2a')](_0xf46b('0x2d'),controller[_0xf46b('0x2e')]);router[_0xf46b('0x2f')](_0xf46b('0x30'),auth[_0xf46b('0xc')](),interaction['tracked'](_0xf46b('0x26'),_0xf46b('0x31')),controller[_0xf46b('0x32')]);router[_0xf46b('0x2f')](_0xf46b('0x33'),auth[_0xf46b('0xc')](),controller[_0xf46b('0x34')]);module[_0xf46b('0x35')]=router; \ No newline at end of file +var _0x707e=['close','destroy','delete','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInteraction.controller','get','isAuthenticated','index','/describe','/:id','isChatInteractionAuthorized','show','attachmentDownload','/:id/messages','getMessages','/:id/my_messages','/:id/download','download','post','create','/:id/vidaoo','createVidaooSession','diskStorage','root','server/files/attachments/','format','now','originalname','replace','/:id/attachment_upload','single','attachmentUpload','addMessage','/:id/tags','tracked','chat','chatinteraction:addtags','addTags','put','chatinteraction:update','/:id/custom_update','customUpdate','/:id/abandon','/:id/close'];(function(_0x465a0c,_0x19d4d5){var _0x1e202e=function(_0x27bd8a){while(--_0x27bd8a){_0x465a0c['push'](_0x465a0c['shift']());}};_0x1e202e(++_0x19d4d5);}(_0x707e,0xd8));var _0xe707=function(_0xc8a931,_0x260690){_0xc8a931=_0xc8a931-0x0;var _0x28bd27=_0x707e[_0xc8a931];return _0x28bd27;};'use strict';var multer=require(_0xe707('0x0'));var util=require(_0xe707('0x1'));var path=require(_0xe707('0x2'));var timeout=require(_0xe707('0x3'));var express=require(_0xe707('0x4'));var router=express['Router']();var fs_extra=require(_0xe707('0x5'));var auth=require(_0xe707('0x6'));var interaction=require(_0xe707('0x7'));var config=require(_0xe707('0x8'));var controller=require(_0xe707('0x9'));router[_0xe707('0xa')]('/',auth[_0xe707('0xb')](),controller[_0xe707('0xc')]);router[_0xe707('0xa')](_0xe707('0xd'),auth[_0xe707('0xb')](),controller['describe']);router['get'](_0xe707('0xe'),auth[_0xe707('0xf')](),controller[_0xe707('0x10')]);router['get']('/:id/attachment_download',auth[_0xe707('0xf')](),controller[_0xe707('0x11')]);router[_0xe707('0xa')](_0xe707('0x12'),auth[_0xe707('0xb')](),controller[_0xe707('0x13')]);router['get'](_0xe707('0x14'),auth['isChatInteractionAuthorized'](),controller['getMyMessages']);router['get'](_0xe707('0x15'),auth[_0xe707('0xb')](),controller[_0xe707('0x16')]);router[_0xe707('0x17')]('/',auth[_0xe707('0xb')](),controller[_0xe707('0x18')]);router[_0xe707('0x17')](_0xe707('0x19'),auth[_0xe707('0xb')](),controller[_0xe707('0x1a')]);var upload=multer({'storage':multer[_0xe707('0x1b')]({'destination':function(_0x4eb2a6,_0x5872c4,_0x976f89){_0x976f89(null,path['join'](config[_0xe707('0x1c')],_0xe707('0x1d')));},'filename':function(_0x4b4aae,_0x3e3d82,_0x510703){_0x510703(null,util[_0xe707('0x1e')]('%s-%s',Date[_0xe707('0x1f')](),_0x3e3d82[_0xe707('0x20')][_0xe707('0x21')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-')));}})});router[_0xe707('0x17')](_0xe707('0x22'),upload[_0xe707('0x23')]('file'),controller[_0xe707('0x24')]);router[_0xe707('0x17')](_0xe707('0x12'),auth[_0xe707('0xf')](),controller[_0xe707('0x25')]);router[_0xe707('0x17')](_0xe707('0x26'),auth[_0xe707('0xb')](),interaction[_0xe707('0x27')](_0xe707('0x28'),_0xe707('0x29')),controller[_0xe707('0x2a')]);router[_0xe707('0x2b')](_0xe707('0xe'),auth[_0xe707('0xb')](),interaction[_0xe707('0x27')]('chat',_0xe707('0x2c')),controller['update']);router[_0xe707('0x2b')](_0xe707('0x2d'),controller[_0xe707('0x2e')]);router['put'](_0xe707('0x2f'),auth['isChatInteractionAuthorized'](),controller['abandon']);router[_0xe707('0x2b')](_0xe707('0x30'),controller[_0xe707('0x31')]);router['delete'](_0xe707('0xe'),auth['isAuthenticated'](),interaction[_0xe707('0x27')]('chat','chatinteraction:destroy'),controller[_0xe707('0x32')]);router[_0xe707('0x33')](_0xe707('0x26'),auth[_0xe707('0xb')](),controller['removeTags']);module[_0xe707('0x34')]=router; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.attributes.js b/server/api/chatInternalMessage/chatInternalMessage.attributes.js index 5adeac7..42c40d3 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 _0xf981=['BOOLEAN','INTEGER','sequelize','exports','medium'];(function(_0x5794cd,_0x4fb20c){var _0x4cb669=function(_0x18df71){while(--_0x18df71){_0x5794cd['push'](_0x5794cd['shift']());}};_0x4cb669(++_0x4fb20c);}(_0xf981,0x197));var _0x1f98=function(_0x38f061,_0x3ef289){_0x38f061=_0x38f061-0x0;var _0x472e32=_0xf981[_0x38f061];return _0x472e32;};'use strict';var Sequelize=require(_0x1f98('0x0'));module[_0x1f98('0x1')]={'body':{'type':Sequelize['TEXT'](_0x1f98('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x1f98('0x3')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0x1f98('0x4')]}}; \ No newline at end of file +var _0x659d=['exports','BOOLEAN','INTEGER','sequelize'];(function(_0x33694e,_0x3b7ca9){var _0x5c0ef0=function(_0x472e){while(--_0x472e){_0x33694e['push'](_0x33694e['shift']());}};_0x5c0ef0(++_0x3b7ca9);}(_0x659d,0xb3));var _0xd659=function(_0x4c6d6f,_0x291557){_0x4c6d6f=_0x4c6d6f-0x0;var _0x2d4478=_0x659d[_0x4c6d6f];return _0x2d4478;};'use strict';var Sequelize=require(_0xd659('0x0'));module[_0xd659('0x1')]={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xd659('0x2')],'defaultValue':![]},'ChatInternalMessageId':{'type':Sequelize[_0xd659('0x3')]}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.controller.js b/server/api/chatInternalMessage/chatInternalMessage.controller.js index e293e45..2d8daa7 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 _0x28d6=['model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','include','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','create','body','update','find','describe','get','messages','lastMessageAt','createdAt','lastMessage','format','getUsers','User','agent','admin','fullname','role','online','lastLoginAt','allowmessenger','showWebBar','-online','VoiceQueue','VoiceQueues','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','Agents','userProfileId','autoAssociation','UserProfileResource','isEmpty','resourceId','push','read','-createdAt','all','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./chatInternalMessage.socket','sendStatus','end','status','offset','count','limit','Content-Range','json','apply','reject','save','then','destroy','name','map','ChatInternalMessage','fieldName','key'];(function(_0x411559,_0x29ad23){var _0x3b51b5=function(_0x59424f){while(--_0x59424f){_0x411559['push'](_0x411559['shift']());}};_0x3b51b5(++_0x29ad23);}(_0x28d6,0x11d));var _0x628d=function(_0x526119,_0x5c4b34){_0x526119=_0x526119-0x0;var _0x402da2=_0x28d6[_0x526119];return _0x402da2;};'use strict';var emlformat=require(_0x628d('0x0'));var rimraf=require(_0x628d('0x1'));var zipdir=require(_0x628d('0x2'));var jsonpatch=require(_0x628d('0x3'));var rp=require(_0x628d('0x4'));var moment=require('moment');var BPromise=require(_0x628d('0x5'));var Mustache=require('mustache');var util=require(_0x628d('0x6'));var path=require('path');var sox=require(_0x628d('0x7'));var csv=require(_0x628d('0x8'));var ejs=require(_0x628d('0x9'));var fs=require('fs');var fs_extra=require(_0x628d('0xa'));var _=require(_0x628d('0xb'));var squel=require('squel');var crypto=require(_0x628d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x628d('0xd'));var toCsv=require(_0x628d('0x8'));var querystring=require(_0x628d('0xe'));var Papa=require(_0x628d('0xf'));var Redis=require('ioredis');var authService=require(_0x628d('0x10'));var qs=require(_0x628d('0x11'));var as=require(_0x628d('0x12'));var hardwareService=require(_0x628d('0x13'));var logger=require(_0x628d('0x14'))(_0x628d('0x15'));var utils=require(_0x628d('0x16'));var config=require(_0x628d('0x17'));var licenseUtil=require(_0x628d('0x18'));var db=require(_0x628d('0x19'))['db'];config[_0x628d('0x1a')]=_[_0x628d('0x1b')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x628d('0x1c'))(new Redis(config['redis']));require(_0x628d('0x1d'))['register'](socket);function respondWithStatusCode(_0x1c4975,_0x4993b4){_0x4993b4=_0x4993b4||0xcc;return function(_0x34dd6c){if(_0x34dd6c){return _0x1c4975[_0x628d('0x1e')](_0x4993b4);}return _0x1c4975['status'](_0x4993b4)[_0x628d('0x1f')]();};}function respondWithResult(_0x3c738f,_0x2c71a0){_0x2c71a0=_0x2c71a0||0xc8;return function(_0xd30ca6){if(_0xd30ca6){return _0x3c738f[_0x628d('0x20')](_0x2c71a0)['json'](_0xd30ca6);}};}function respondWithFilteredResult(_0x175248,_0x126c0b){return function(_0x3438e7){if(_0x3438e7){var _0x3091bb=typeof _0x126c0b[_0x628d('0x21')]==='undefined'&&typeof _0x126c0b['limit']==='undefined';var _0xc3622d=_0x3438e7[_0x628d('0x22')];var _0x3e56c7=_0x3091bb?0x0:_0x126c0b[_0x628d('0x21')];var _0x2dcc43=_0x3091bb?_0x3438e7[_0x628d('0x22')]:_0x126c0b[_0x628d('0x21')]+_0x126c0b[_0x628d('0x23')];var _0x3a4045;if(_0x2dcc43>=_0xc3622d){_0x2dcc43=_0xc3622d;_0x3a4045=0xc8;}else{_0x3a4045=0xce;}_0x175248['status'](_0x3a4045);return _0x175248['set'](_0x628d('0x24'),_0x3e56c7+'-'+_0x2dcc43+'/'+_0xc3622d)[_0x628d('0x25')](_0x3438e7);}return null;};}function patchUpdates(_0x571fdd){return function(_0x58acea){try{jsonpatch[_0x628d('0x26')](_0x58acea,_0x571fdd,!![]);}catch(_0x30d13c){return BPromise[_0x628d('0x27')](_0x30d13c);}return _0x58acea[_0x628d('0x28')]();};}function saveUpdates(_0x5832c4,_0x3b68d9){return function(_0x2bcd96){if(_0x2bcd96){return _0x2bcd96['update'](_0x5832c4)[_0x628d('0x29')](function(_0x5e542b){return _0x5e542b;});}return null;};}function removeEntity(_0x31e9c0,_0x510471){return function(_0xfdefca){if(_0xfdefca){return _0xfdefca[_0x628d('0x2a')]()['then'](function(){_0x31e9c0[_0x628d('0x20')](0xcc)[_0x628d('0x1f')]();});}};}function handleEntityNotFound(_0x5d126d,_0x3f1441){return function(_0x2cd367){if(!_0x2cd367){_0x5d126d[_0x628d('0x1e')](0x194);}return _0x2cd367;};}function handleError(_0x3480ae,_0x41bdc6){_0x41bdc6=_0x41bdc6||0x1f4;return function(_0x4fbf38){logger['error'](_0x4fbf38['stack']);if(_0x4fbf38[_0x628d('0x2b')]){delete _0x4fbf38[_0x628d('0x2b')];}_0x3480ae['status'](_0x41bdc6)['send'](_0x4fbf38);};}exports['index']=function(_0xf8a59b,_0x15706b){var _0x5bd5dd={},_0x5ace9d={},_0x225265={'count':0x0,'rows':[]};var _0x212812=_[_0x628d('0x2c')](db[_0x628d('0x2d')]['rawAttributes'],function(_0x5a5e18){return{'name':_0x5a5e18[_0x628d('0x2e')],'type':_0x5a5e18['type'][_0x628d('0x2f')]};});_0x5ace9d[_0x628d('0x30')]=_['map'](_0x212812,'name');_0x5ace9d[_0x628d('0x31')]=_[_0x628d('0x32')](_0xf8a59b[_0x628d('0x31')]);_0x5ace9d[_0x628d('0x33')]=_[_0x628d('0x34')](_0x5ace9d['model'],_0x5ace9d[_0x628d('0x31')]);_0x5bd5dd[_0x628d('0x35')]=_[_0x628d('0x34')](_0x5ace9d[_0x628d('0x30')],qs['fields'](_0xf8a59b[_0x628d('0x31')]['fields']));_0x5bd5dd[_0x628d('0x35')]=_0x5bd5dd['attributes'][_0x628d('0x36')]?_0x5bd5dd[_0x628d('0x35')]:_0x5ace9d[_0x628d('0x30')];if(!_0xf8a59b['query']['hasOwnProperty'](_0x628d('0x37'))){_0x5bd5dd['limit']=qs[_0x628d('0x23')](_0xf8a59b[_0x628d('0x31')][_0x628d('0x23')]);_0x5bd5dd['offset']=qs[_0x628d('0x21')](_0xf8a59b[_0x628d('0x31')][_0x628d('0x21')]);}_0x5bd5dd[_0x628d('0x38')]=qs[_0x628d('0x39')](_0xf8a59b['query'][_0x628d('0x39')]);_0x5bd5dd[_0x628d('0x3a')]=qs[_0x628d('0x33')](_[_0x628d('0x3b')](_0xf8a59b['query'],_0x5ace9d[_0x628d('0x33')]),_0x212812);if(_0xf8a59b[_0x628d('0x31')][_0x628d('0x3c')]){_0x5bd5dd[_0x628d('0x3a')]=_[_0x628d('0x3d')](_0x5bd5dd[_0x628d('0x3a')],{'$or':_[_0x628d('0x2c')](_0x212812,function(_0x18558f){if(_0x18558f[_0x628d('0x3e')]!==_0x628d('0x3f')){var _0x398cdf={};_0x398cdf[_0x18558f[_0x628d('0x2b')]]={'$like':'%'+_0xf8a59b['query'][_0x628d('0x3c')]+'%'};return _0x398cdf;}})});}_0x5bd5dd=_['merge']({},_0x5bd5dd,_0xf8a59b[_0x628d('0x40')]);var _0x3968ff={'where':_0x5bd5dd[_0x628d('0x3a')]};return db[_0x628d('0x2d')][_0x628d('0x22')](_0x3968ff)[_0x628d('0x29')](function(_0x25852a){_0x225265[_0x628d('0x22')]=_0x25852a;if(_0xf8a59b[_0x628d('0x31')]['includeAll']){_0x5bd5dd[_0x628d('0x41')]=[{'all':!![]}];}return db[_0x628d('0x2d')][_0x628d('0x42')](_0x5bd5dd);})[_0x628d('0x29')](function(_0x2b46f2){_0x225265[_0x628d('0x43')]=_0x2b46f2;return _0x225265;})[_0x628d('0x29')](respondWithFilteredResult(_0x15706b,_0x5bd5dd))[_0x628d('0x44')](handleError(_0x15706b,null));};exports[_0x628d('0x45')]=function(_0x2a23aa,_0x18962b){var _0xa35248={'raw':!![],'where':{'id':_0x2a23aa[_0x628d('0x46')]['id']}},_0x175c6e={};_0x175c6e['model']=_[_0x628d('0x32')](db[_0x628d('0x2d')][_0x628d('0x47')]);_0x175c6e[_0x628d('0x31')]=_[_0x628d('0x32')](_0x2a23aa[_0x628d('0x31')]);_0x175c6e[_0x628d('0x33')]=_['intersection'](_0x175c6e['model'],_0x175c6e['query']);_0xa35248[_0x628d('0x35')]=_[_0x628d('0x34')](_0x175c6e[_0x628d('0x30')],qs[_0x628d('0x48')](_0x2a23aa[_0x628d('0x31')][_0x628d('0x48')]));_0xa35248[_0x628d('0x35')]=_0xa35248[_0x628d('0x35')][_0x628d('0x36')]?_0xa35248[_0x628d('0x35')]:_0x175c6e['model'];if(_0x2a23aa[_0x628d('0x31')][_0x628d('0x49')]){_0xa35248[_0x628d('0x41')]=[{'all':!![]}];}_0xa35248=_[_0x628d('0x3d')]({},_0xa35248,_0x2a23aa[_0x628d('0x40')]);return db[_0x628d('0x2d')]['find'](_0xa35248)[_0x628d('0x29')](handleEntityNotFound(_0x18962b,null))[_0x628d('0x29')](respondWithResult(_0x18962b,null))[_0x628d('0x44')](handleError(_0x18962b,null));};exports[_0x628d('0x4a')]=function(_0x27f291,_0x508aa1){return db['ChatInternalMessage'][_0x628d('0x4a')](_0x27f291[_0x628d('0x4b')],{})[_0x628d('0x29')](respondWithResult(_0x508aa1,0xc9))['catch'](handleError(_0x508aa1,null));};exports[_0x628d('0x4c')]=function(_0x27fbf6,_0x5e72c7){if(_0x27fbf6['body']['id']){delete _0x27fbf6[_0x628d('0x4b')]['id'];}return db[_0x628d('0x2d')][_0x628d('0x4d')]({'where':{'id':_0x27fbf6[_0x628d('0x46')]['id']}})['then'](handleEntityNotFound(_0x5e72c7,null))[_0x628d('0x29')](saveUpdates(_0x27fbf6[_0x628d('0x4b')],null))[_0x628d('0x29')](respondWithResult(_0x5e72c7,null))[_0x628d('0x44')](handleError(_0x5e72c7,null));};exports[_0x628d('0x2a')]=function(_0x166c50,_0x22e9b2){return db[_0x628d('0x2d')][_0x628d('0x4d')]({'where':{'id':_0x166c50[_0x628d('0x46')]['id']}})['then'](handleEntityNotFound(_0x22e9b2,null))[_0x628d('0x29')](removeEntity(_0x22e9b2,null))[_0x628d('0x44')](handleError(_0x22e9b2,null));};exports[_0x628d('0x4e')]=function(_0x10849c,_0x5e2c1d){return db[_0x628d('0x2d')][_0x628d('0x4e')]()['then'](respondWithResult(_0x5e2c1d,null))[_0x628d('0x44')](handleError(_0x5e2c1d,null));};function wrapUser(_0x2c5261){return function(_0x9597a){var _0x3b4c0b=_0x2c5261[_0x628d('0x4f')]({'plain':!![]});_0x3b4c0b[_0x628d('0x50')]=[];if(_0x9597a){_0x3b4c0b[_0x628d('0x51')]=_0x9597a[_0x628d('0x52')];_0x3b4c0b[_0x628d('0x53')]=_0x9597a;}else{_0x3b4c0b[_0x628d('0x51')]=moment(0x0)[_0x628d('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x3b4c0b[_0x628d('0x53')]={};}return _0x3b4c0b;};}exports[_0x628d('0x55')]=function(_0x39c1b3,_0x3f312b,_0x46d54d){var _0x48c15e=[];return db[_0x628d('0x56')]['findAll']({'where':{'role':[_0x628d('0x57'),_0x628d('0x58'),'user']},'attributes':['id',_0x628d('0x59'),'name',_0x628d('0x5a'),'userpic','internal',_0x628d('0x5b'),_0x628d('0x5c'),_0x628d('0x5d'),_0x628d('0x5e')],'order':qs[_0x628d('0x39')](_0x628d('0x5f')),'include':[{'model':db[_0x628d('0x60')],'as':_0x628d('0x61'),'attributes':['id',_0x628d('0x2b'),_0x628d('0x3e')],'through':{'attributes':[]}}]})[_0x628d('0x29')](function(_0x77a14b){if(_0x77a14b){var _0x4d66ba=_0x39c1b3[_0x628d('0x62')]['get']({'plain':!![]});if(!_0x4d66ba)throw new Error(_0x628d('0x63'));if(_0x4d66ba[_0x628d('0x5a')]==='user'){return db[_0x628d('0x64')]['find']({'where':{'name':_0x628d('0x65'),'userProfileId':_0x4d66ba[_0x628d('0x66')]},'raw':!![]})[_0x628d('0x29')](function(_0x16d0e5){if(_0x16d0e5){if(_0x16d0e5[_0x628d('0x67')]===0x0){return db[_0x628d('0x68')][_0x628d('0x42')]({'where':{'sectionId':_0x16d0e5['id']},'raw':!![]})['then'](function(_0x2ebba5){var _0x3818ab=[];if(_[_0x628d('0x69')](_0x2ebba5)){_0x3818ab=_[_0x628d('0x3c')](_0x77a14b,function(_0x21ff6b){if(_0x21ff6b['role']!=='agent'){return _0x21ff6b;}});return _0x3818ab;}else{for(var _0x54eb00=0x0;_0x54eb00<_0x77a14b[_0x628d('0x36')];_0x54eb00++){var _0x16a24b=_0x77a14b[_0x54eb00];if(_0x16a24b[_0x628d('0x5a')]==='agent'){var _0xc27752=_[_0x628d('0x4d')](_0x2ebba5,function(_0xa43811){return _0xa43811[_0x628d('0x6a')]===_0x16a24b['id'];});if(_0xc27752)_0x3818ab[_0x628d('0x6b')](_0x16a24b);}else{_0x3818ab[_0x628d('0x6b')](_0x16a24b);}}return _0x3818ab;}});}else{return _0x77a14b;}}else{var _0x38b01b=_['filter'](_0x77a14b,function(_0x5e284e){if(_0x5e284e[_0x628d('0x5a')]!==_0x628d('0x57')){return _0x5e284e;}});return _0x38b01b;}});}else{return _0x77a14b;}}})[_0x628d('0x29')](function(_0x40e568){var _0x525076=[];if(_0x40e568){_0x48c15e=_0x40e568;for(var _0x45a0d8=0x0;_0x45a0d8<_0x40e568[_0x628d('0x36')];_0x45a0d8+=0x1){_0x48c15e[_0x45a0d8][_0x628d('0x50')]=[];_0x525076[_0x628d('0x6b')](db[_0x628d('0x2d')][_0x628d('0x4d')]({'where':{'FromId':[_0x39c1b3['user']['id'],_0x40e568[_0x45a0d8]['id']],'ToId':[_0x39c1b3['user']['id'],_0x40e568[_0x45a0d8]['id']],'ChatGroupId':null},'attributes':['id',_0x628d('0x52'),'FromId','ToId',_0x628d('0x6c'),_0x628d('0x4b')],'order':qs[_0x628d('0x39')](_0x628d('0x6d')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x628d('0x29')](wrapUser(_0x40e568[_0x45a0d8])));}return BPromise[_0x628d('0x6e')](_0x525076);}return[];})[_0x628d('0x29')](function(_0x2b0cf6){return{'rows':_0x2b0cf6,'count':_0x2b0cf6['length']};})[_0x628d('0x29')](respondWithResult(_0x3f312b,null))[_0x628d('0x44')](handleError(_0x3f312b,null));}; \ No newline at end of file +var _0x5e74=['describe','messages','lastMessageAt','lastMessage','format','YYYY-MM-DD\x20HH:mm:ss','getUsers','User','admin','role','userpic','online','lastLoginAt','allowmessenger','showWebBar','VoiceQueue','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','UserProfileResource','isEmpty','agent','push','createdAt','FromId','ToId','-createdAt','all','rimraf','zip-dir','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','ChatInternalMessage','includeAll','findAll','rows','catch','show','params','include','merge','options','create','body','find'];(function(_0x14fa15,_0x2b8f8d){var _0xad984d=function(_0x2da1f6){while(--_0x2da1f6){_0x14fa15['push'](_0x14fa15['shift']());}};_0xad984d(++_0x2b8f8d);}(_0x5e74,0x161));var _0x45e7=function(_0x53228b,_0x4c83eb){_0x53228b=_0x53228b-0x0;var _0x5d5d6a=_0x5e74[_0x53228b];return _0x5d5d6a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x45e7('0x0'));var zipdir=require(_0x45e7('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x45e7('0x2'));var moment=require(_0x45e7('0x3'));var BPromise=require(_0x45e7('0x4'));var Mustache=require('mustache');var util=require(_0x45e7('0x5'));var path=require(_0x45e7('0x6'));var sox=require(_0x45e7('0x7'));var csv=require(_0x45e7('0x8'));var ejs=require(_0x45e7('0x9'));var fs=require('fs');var fs_extra=require(_0x45e7('0xa'));var _=require(_0x45e7('0xb'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x45e7('0xc'));var toCsv=require(_0x45e7('0x8'));var querystring=require(_0x45e7('0xd'));var Papa=require(_0x45e7('0xe'));var Redis=require(_0x45e7('0xf'));var authService=require(_0x45e7('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x45e7('0x11'));var hardwareService=require(_0x45e7('0x12'));var logger=require(_0x45e7('0x13'))(_0x45e7('0x14'));var utils=require(_0x45e7('0x15'));var config=require(_0x45e7('0x16'));var licenseUtil=require(_0x45e7('0x17'));var db=require(_0x45e7('0x18'))['db'];config[_0x45e7('0x19')]=_[_0x45e7('0x1a')](config[_0x45e7('0x19')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x45e7('0x19')]));require('./chatInternalMessage.socket')[_0x45e7('0x1b')](socket);function respondWithStatusCode(_0x424eff,_0x51f3cb){_0x51f3cb=_0x51f3cb||0xcc;return function(_0x2fba9d){if(_0x2fba9d){return _0x424eff[_0x45e7('0x1c')](_0x51f3cb);}return _0x424eff[_0x45e7('0x1d')](_0x51f3cb)[_0x45e7('0x1e')]();};}function respondWithResult(_0x34491e,_0x3b0eb9){_0x3b0eb9=_0x3b0eb9||0xc8;return function(_0x1b6a91){if(_0x1b6a91){return _0x34491e[_0x45e7('0x1d')](_0x3b0eb9)[_0x45e7('0x1f')](_0x1b6a91);}};}function respondWithFilteredResult(_0x206ac6,_0x2fe01f){return function(_0x41543f){if(_0x41543f){var _0x41b2fe=typeof _0x2fe01f[_0x45e7('0x20')]==='undefined'&&typeof _0x2fe01f[_0x45e7('0x21')]===_0x45e7('0x22');var _0x5355f7=_0x41543f[_0x45e7('0x23')];var _0x310fe3=_0x41b2fe?0x0:_0x2fe01f[_0x45e7('0x20')];var _0xbe667e=_0x41b2fe?_0x41543f['count']:_0x2fe01f[_0x45e7('0x20')]+_0x2fe01f[_0x45e7('0x21')];var _0x596f52;if(_0xbe667e>=_0x5355f7){_0xbe667e=_0x5355f7;_0x596f52=0xc8;}else{_0x596f52=0xce;}_0x206ac6[_0x45e7('0x1d')](_0x596f52);return _0x206ac6[_0x45e7('0x24')](_0x45e7('0x25'),_0x310fe3+'-'+_0xbe667e+'/'+_0x5355f7)[_0x45e7('0x1f')](_0x41543f);}return null;};}function patchUpdates(_0xd00b5a){return function(_0xea441){try{jsonpatch[_0x45e7('0x26')](_0xea441,_0xd00b5a,!![]);}catch(_0xd17106){return BPromise['reject'](_0xd17106);}return _0xea441[_0x45e7('0x27')]();};}function saveUpdates(_0x341dd6,_0x32940e){return function(_0x432aa4){if(_0x432aa4){return _0x432aa4[_0x45e7('0x28')](_0x341dd6)[_0x45e7('0x29')](function(_0x4bdab2){return _0x4bdab2;});}return null;};}function removeEntity(_0x700d2e,_0x12f57c){return function(_0x388dc1){if(_0x388dc1){return _0x388dc1[_0x45e7('0x2a')]()['then'](function(){_0x700d2e[_0x45e7('0x1d')](0xcc)[_0x45e7('0x1e')]();});}};}function handleEntityNotFound(_0x81866f,_0x96f295){return function(_0x356350){if(!_0x356350){_0x81866f[_0x45e7('0x1c')](0x194);}return _0x356350;};}function handleError(_0x40f0e8,_0x50c95f){_0x50c95f=_0x50c95f||0x1f4;return function(_0x40dd93){logger[_0x45e7('0x2b')](_0x40dd93[_0x45e7('0x2c')]);if(_0x40dd93[_0x45e7('0x2d')]){delete _0x40dd93[_0x45e7('0x2d')];}_0x40f0e8[_0x45e7('0x1d')](_0x50c95f)[_0x45e7('0x2e')](_0x40dd93);};}exports[_0x45e7('0x2f')]=function(_0x5b506c,_0x38644e){var _0x15d9a7={},_0x447fb1={},_0x54ecab={'count':0x0,'rows':[]};var _0x5b73f1=_[_0x45e7('0x30')](db['ChatInternalMessage'][_0x45e7('0x31')],function(_0x172f42){return{'name':_0x172f42[_0x45e7('0x32')],'type':_0x172f42[_0x45e7('0x33')][_0x45e7('0x34')]};});_0x447fb1[_0x45e7('0x35')]=_[_0x45e7('0x30')](_0x5b73f1,_0x45e7('0x2d'));_0x447fb1['query']=_[_0x45e7('0x36')](_0x5b506c[_0x45e7('0x37')]);_0x447fb1[_0x45e7('0x38')]=_[_0x45e7('0x39')](_0x447fb1[_0x45e7('0x35')],_0x447fb1['query']);_0x15d9a7[_0x45e7('0x3a')]=_[_0x45e7('0x39')](_0x447fb1['model'],qs[_0x45e7('0x3b')](_0x5b506c[_0x45e7('0x37')][_0x45e7('0x3b')]));_0x15d9a7[_0x45e7('0x3a')]=_0x15d9a7[_0x45e7('0x3a')][_0x45e7('0x3c')]?_0x15d9a7['attributes']:_0x447fb1[_0x45e7('0x35')];if(!_0x5b506c[_0x45e7('0x37')][_0x45e7('0x3d')](_0x45e7('0x3e'))){_0x15d9a7[_0x45e7('0x21')]=qs[_0x45e7('0x21')](_0x5b506c[_0x45e7('0x37')][_0x45e7('0x21')]);_0x15d9a7[_0x45e7('0x20')]=qs[_0x45e7('0x20')](_0x5b506c['query'][_0x45e7('0x20')]);}_0x15d9a7['order']=qs[_0x45e7('0x3f')](_0x5b506c['query'][_0x45e7('0x3f')]);_0x15d9a7[_0x45e7('0x40')]=qs['filters'](_['pick'](_0x5b506c[_0x45e7('0x37')],_0x447fb1[_0x45e7('0x38')]),_0x5b73f1);if(_0x5b506c[_0x45e7('0x37')][_0x45e7('0x41')]){_0x15d9a7[_0x45e7('0x40')]=_['merge'](_0x15d9a7[_0x45e7('0x40')],{'$or':_[_0x45e7('0x30')](_0x5b73f1,function(_0x21ba5d){if(_0x21ba5d[_0x45e7('0x33')]!=='VIRTUAL'){var _0x58108d={};_0x58108d[_0x21ba5d[_0x45e7('0x2d')]]={'$like':'%'+_0x5b506c[_0x45e7('0x37')][_0x45e7('0x41')]+'%'};return _0x58108d;}})});}_0x15d9a7=_['merge']({},_0x15d9a7,_0x5b506c['options']);var _0x2d3067={'where':_0x15d9a7[_0x45e7('0x40')]};return db[_0x45e7('0x42')][_0x45e7('0x23')](_0x2d3067)[_0x45e7('0x29')](function(_0x10e3d9){_0x54ecab[_0x45e7('0x23')]=_0x10e3d9;if(_0x5b506c[_0x45e7('0x37')][_0x45e7('0x43')]){_0x15d9a7['include']=[{'all':!![]}];}return db[_0x45e7('0x42')][_0x45e7('0x44')](_0x15d9a7);})[_0x45e7('0x29')](function(_0x2166d5){_0x54ecab[_0x45e7('0x45')]=_0x2166d5;return _0x54ecab;})[_0x45e7('0x29')](respondWithFilteredResult(_0x38644e,_0x15d9a7))[_0x45e7('0x46')](handleError(_0x38644e,null));};exports[_0x45e7('0x47')]=function(_0x483dcf,_0x10e4c){var _0xffd3e5={'raw':!![],'where':{'id':_0x483dcf[_0x45e7('0x48')]['id']}},_0x265a49={};_0x265a49['model']=_['keys'](db[_0x45e7('0x42')][_0x45e7('0x31')]);_0x265a49[_0x45e7('0x37')]=_[_0x45e7('0x36')](_0x483dcf[_0x45e7('0x37')]);_0x265a49[_0x45e7('0x38')]=_['intersection'](_0x265a49[_0x45e7('0x35')],_0x265a49[_0x45e7('0x37')]);_0xffd3e5['attributes']=_[_0x45e7('0x39')](_0x265a49['model'],qs[_0x45e7('0x3b')](_0x483dcf['query'][_0x45e7('0x3b')]));_0xffd3e5[_0x45e7('0x3a')]=_0xffd3e5[_0x45e7('0x3a')][_0x45e7('0x3c')]?_0xffd3e5['attributes']:_0x265a49[_0x45e7('0x35')];if(_0x483dcf[_0x45e7('0x37')][_0x45e7('0x43')]){_0xffd3e5[_0x45e7('0x49')]=[{'all':!![]}];}_0xffd3e5=_[_0x45e7('0x4a')]({},_0xffd3e5,_0x483dcf[_0x45e7('0x4b')]);return db[_0x45e7('0x42')]['find'](_0xffd3e5)['then'](handleEntityNotFound(_0x10e4c,null))[_0x45e7('0x29')](respondWithResult(_0x10e4c,null))[_0x45e7('0x46')](handleError(_0x10e4c,null));};exports[_0x45e7('0x4c')]=function(_0xac7350,_0x5cd02a){return db[_0x45e7('0x42')][_0x45e7('0x4c')](_0xac7350[_0x45e7('0x4d')],{})[_0x45e7('0x29')](respondWithResult(_0x5cd02a,0xc9))[_0x45e7('0x46')](handleError(_0x5cd02a,null));};exports[_0x45e7('0x28')]=function(_0x2da8ac,_0x50fc0a){if(_0x2da8ac[_0x45e7('0x4d')]['id']){delete _0x2da8ac[_0x45e7('0x4d')]['id'];}return db[_0x45e7('0x42')][_0x45e7('0x4e')]({'where':{'id':_0x2da8ac[_0x45e7('0x48')]['id']}})[_0x45e7('0x29')](handleEntityNotFound(_0x50fc0a,null))['then'](saveUpdates(_0x2da8ac[_0x45e7('0x4d')],null))['then'](respondWithResult(_0x50fc0a,null))[_0x45e7('0x46')](handleError(_0x50fc0a,null));};exports['destroy']=function(_0x2ade59,_0x5eaa66){return db[_0x45e7('0x42')]['find']({'where':{'id':_0x2ade59[_0x45e7('0x48')]['id']}})['then'](handleEntityNotFound(_0x5eaa66,null))[_0x45e7('0x29')](removeEntity(_0x5eaa66,null))[_0x45e7('0x46')](handleError(_0x5eaa66,null));};exports[_0x45e7('0x4f')]=function(_0x4abc41,_0x3f7f68){return db[_0x45e7('0x42')]['describe']()[_0x45e7('0x29')](respondWithResult(_0x3f7f68,null))[_0x45e7('0x46')](handleError(_0x3f7f68,null));};function wrapUser(_0x11a411){return function(_0x4f6e09){var _0x491ab0=_0x11a411['get']({'plain':!![]});_0x491ab0[_0x45e7('0x50')]=[];if(_0x4f6e09){_0x491ab0[_0x45e7('0x51')]=_0x4f6e09['createdAt'];_0x491ab0[_0x45e7('0x52')]=_0x4f6e09;}else{_0x491ab0[_0x45e7('0x51')]=moment(0x0)[_0x45e7('0x53')](_0x45e7('0x54'));_0x491ab0[_0x45e7('0x52')]={};}return _0x491ab0;};}exports[_0x45e7('0x55')]=function(_0xb087e5,_0x2227c0,_0x2af321){var _0x2effba=[];return db[_0x45e7('0x56')]['findAll']({'where':{'role':['agent',_0x45e7('0x57'),'user']},'attributes':['id','fullname',_0x45e7('0x2d'),_0x45e7('0x58'),_0x45e7('0x59'),'internal',_0x45e7('0x5a'),_0x45e7('0x5b'),_0x45e7('0x5c'),_0x45e7('0x5d')],'order':qs[_0x45e7('0x3f')]('-online'),'include':[{'model':db[_0x45e7('0x5e')],'as':'VoiceQueues','attributes':['id',_0x45e7('0x2d'),_0x45e7('0x33')],'through':{'attributes':[]}}]})[_0x45e7('0x29')](function(_0xb3a958){if(_0xb3a958){var _0x3525b5=_0xb087e5[_0x45e7('0x5f')]['get']({'plain':!![]});if(!_0x3525b5)throw new Error(_0x45e7('0x60'));if(_0x3525b5[_0x45e7('0x58')]==='user'){return db[_0x45e7('0x61')]['find']({'where':{'name':'Agents','userProfileId':_0x3525b5[_0x45e7('0x62')]},'raw':!![]})['then'](function(_0x41e92d){if(_0x41e92d){if(_0x41e92d['autoAssociation']===0x0){return db[_0x45e7('0x63')][_0x45e7('0x44')]({'where':{'sectionId':_0x41e92d['id']},'raw':!![]})[_0x45e7('0x29')](function(_0x271c60){var _0xac8aa0=[];if(_[_0x45e7('0x64')](_0x271c60)){_0xac8aa0=_[_0x45e7('0x41')](_0xb3a958,function(_0xdb080a){if(_0xdb080a['role']!==_0x45e7('0x65')){return _0xdb080a;}});return _0xac8aa0;}else{for(var _0x295ade=0x0;_0x295ade<_0xb3a958[_0x45e7('0x3c')];_0x295ade++){var _0x228022=_0xb3a958[_0x295ade];if(_0x228022[_0x45e7('0x58')]===_0x45e7('0x65')){var _0xf22f0=_[_0x45e7('0x4e')](_0x271c60,function(_0x2f999e){return _0x2f999e['resourceId']===_0x228022['id'];});if(_0xf22f0)_0xac8aa0[_0x45e7('0x66')](_0x228022);}else{_0xac8aa0['push'](_0x228022);}}return _0xac8aa0;}});}else{return _0xb3a958;}}else{var _0xd229b7=_[_0x45e7('0x41')](_0xb3a958,function(_0x2eec30){if(_0x2eec30['role']!==_0x45e7('0x65')){return _0x2eec30;}});return _0xd229b7;}});}else{return _0xb3a958;}}})[_0x45e7('0x29')](function(_0x4596cd){var _0x43d0cb=[];if(_0x4596cd){_0x2effba=_0x4596cd;for(var _0x1c3aa3=0x0;_0x1c3aa3<_0x4596cd['length'];_0x1c3aa3+=0x1){_0x2effba[_0x1c3aa3]['messages']=[];_0x43d0cb[_0x45e7('0x66')](db[_0x45e7('0x42')][_0x45e7('0x4e')]({'where':{'FromId':[_0xb087e5[_0x45e7('0x5f')]['id'],_0x4596cd[_0x1c3aa3]['id']],'ToId':[_0xb087e5[_0x45e7('0x5f')]['id'],_0x4596cd[_0x1c3aa3]['id']],'ChatGroupId':null},'attributes':['id',_0x45e7('0x67'),_0x45e7('0x68'),_0x45e7('0x69'),'read',_0x45e7('0x4d')],'order':qs[_0x45e7('0x3f')](_0x45e7('0x6a')),'limit':0x1,'offset':0x0,'raw':!![]})[_0x45e7('0x29')](wrapUser(_0x4596cd[_0x1c3aa3])));}return BPromise[_0x45e7('0x6b')](_0x43d0cb);}return[];})[_0x45e7('0x29')](function(_0x13c231){return{'rows':_0x13c231,'count':_0x13c231[_0x45e7('0x3c')]};})[_0x45e7('0x29')](respondWithResult(_0x2227c0,null))[_0x45e7('0x46')](handleError(_0x2227c0,null));}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.events.js b/server/api/chatInternalMessage/chatInternalMessage.events.js index 469cc73..3bb5e00 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 _0x3f13=['emit','hook','exports','events','setMaxListeners','remove'];(function(_0x90f6be,_0x5ebf25){var _0x41f160=function(_0x4ea5f6){while(--_0x4ea5f6){_0x90f6be['push'](_0x90f6be['shift']());}};_0x41f160(++_0x5ebf25);}(_0x3f13,0x10b));var _0x33f1=function(_0x4d63a3,_0x1b5e8f){_0x4d63a3=_0x4d63a3-0x0;var _0x1ed1f4=_0x3f13[_0x4d63a3];return _0x1ed1f4;};'use strict';var EventEmitter=require(_0x33f1('0x0'));var ChatInternalMessage=require('../../mysqldb')['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents[_0x33f1('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x33f1('0x2')};function emitEvent(_0x19c54b){return function(_0xee5a5,_0xa0e1de,_0x4458eb){ChatInternalMessageEvents[_0x33f1('0x3')](_0x19c54b+':'+_0xee5a5['id'],_0xee5a5);ChatInternalMessageEvents[_0x33f1('0x3')](_0x19c54b,_0xee5a5);_0x4458eb(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatInternalMessage[_0x33f1('0x4')](e,emitEvent(event));}}module[_0x33f1('0x5')]=ChatInternalMessageEvents; \ No newline at end of file +var _0xbca0=['../../mysqldb','update','remove','emit','hasOwnProperty','hook','events'];(function(_0x44fd6b,_0x5c9794){var _0x1ca5df=function(_0x3d471e){while(--_0x3d471e){_0x44fd6b['push'](_0x44fd6b['shift']());}};_0x1ca5df(++_0x5c9794);}(_0xbca0,0x8b));var _0x0bca=function(_0x327690,_0x34adb1){_0x327690=_0x327690-0x0;var _0xad5ead=_0xbca0[_0x327690];return _0xad5ead;};'use strict';var EventEmitter=require(_0x0bca('0x0'));var ChatInternalMessage=require(_0x0bca('0x1'))['db']['ChatInternalMessage'];var ChatInternalMessageEvents=new EventEmitter();ChatInternalMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x0bca('0x2'),'afterDestroy':_0x0bca('0x3')};function emitEvent(_0x3ce28e){return function(_0x1a6cb5,_0x595711,_0x494f51){ChatInternalMessageEvents[_0x0bca('0x4')](_0x3ce28e+':'+_0x1a6cb5['id'],_0x1a6cb5);ChatInternalMessageEvents[_0x0bca('0x4')](_0x3ce28e,_0x1a6cb5);_0x494f51(null);};}for(var e in events){if(events[_0x0bca('0x5')](e)){var event=events[e];ChatInternalMessage[_0x0bca('0x6')](e,emitEvent(event));}}module['exports']=ChatInternalMessageEvents; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.model.js b/server/api/chatInternalMessage/chatInternalMessage.model.js index 9aa9dec..c0dec1d 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 _0xab2c=['utf8mb4','lodash','../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','./chatInternalMessage.attributes','exports','define','ChatInternalMessage','chat_internal_messages'];(function(_0x5cb278,_0x4f721e){var _0x9dd564=function(_0x14798c){while(--_0x14798c){_0x5cb278['push'](_0x5cb278['shift']());}};_0x9dd564(++_0x4f721e);}(_0xab2c,0xb7));var _0xcab2=function(_0x2f2d88,_0x32815c){_0x2f2d88=_0x2f2d88-0x0;var _0x4742ee=_0xab2c[_0x2f2d88];return _0x4742ee;};'use strict';var _=require(_0xcab2('0x0'));var util=require('util');var logger=require(_0xcab2('0x1'))(_0xcab2('0x2'));var moment=require('moment');var BPromise=require(_0xcab2('0x3'));var rp=require(_0xcab2('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xcab2('0x5'));var config=require(_0xcab2('0x6'));var attributes=require(_0xcab2('0x7'));module[_0xcab2('0x8')]=function(_0x2cd871,_0x379ef3){return _0x2cd871[_0xcab2('0x9')](_0xcab2('0xa'),attributes,{'tableName':_0xcab2('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcab2('0xc'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc232=['utf8mb4','lodash','util','../../config/logger','moment','bluebird','path','exports','chat_internal_messages'];(function(_0x5b4070,_0x27332f){var _0x4db834=function(_0x29cab5){while(--_0x29cab5){_0x5b4070['push'](_0x5b4070['shift']());}};_0x4db834(++_0x27332f);}(_0xc232,0x118));var _0x2c23=function(_0x3b970b,_0x2ff4aa){_0x3b970b=_0x3b970b-0x0;var _0x202d50=_0xc232[_0x3b970b];return _0x202d50;};'use strict';var _=require(_0x2c23('0x0'));var util=require(_0x2c23('0x1'));var logger=require(_0x2c23('0x2'))('api');var moment=require(_0x2c23('0x3'));var BPromise=require(_0x2c23('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2c23('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./chatInternalMessage.attributes');module[_0x2c23('0x6')]=function(_0x243128,_0x21738b){return _0x243128['define']('ChatInternalMessage',attributes,{'tableName':_0x2c23('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x2c23('0x8'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.rpc.js b/server/api/chatInternalMessage/chatInternalMessage.rpc.js index 95c3a6c..c0f8c4b 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 _0xa271=['message','util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','redis','localhost','./chatInternalMessage.socket','register','request','then','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','ChatInternalMessage,\x20%s,\x20%s,\x20%s','error','code'];(function(_0x3b59e8,_0x117635){var _0x441493=function(_0x22802d){while(--_0x22802d){_0x3b59e8['push'](_0x3b59e8['shift']());}};_0x441493(++_0x117635);}(_0xa271,0xe8));var _0x1a27=function(_0x5124d2,_0x3400cb){_0x5124d2=_0x5124d2-0x0;var _0x361478=_0xa271[_0x5124d2];return _0x361478;};'use strict';var _=require('lodash');var util=require(_0x1a27('0x0'));var moment=require(_0x1a27('0x1'));var BPromise=require(_0x1a27('0x2'));var rs=require(_0x1a27('0x3'));var fs=require('fs');var Redis=require(_0x1a27('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1a27('0x5'));var logger=require('../../config/logger')(_0x1a27('0x6'));var config=require('../../config/environment');var jayson=require(_0x1a27('0x7'));var client=jayson['client']['http']({'port':0x232a});config[_0x1a27('0x8')]=_['defaults'](config[_0x1a27('0x8')],{'host':_0x1a27('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x1a27('0x8')]));require(_0x1a27('0xa'))[_0x1a27('0xb')](socket);function respondWithRpcPromise(_0x1167c6,_0x42e712,_0x19def0){return new BPromise(function(_0x5538bd,_0x5656c5){return client[_0x1a27('0xc')](_0x1167c6,_0x19def0)[_0x1a27('0xd')](function(_0x5dcbba){logger[_0x1a27('0xe')](_0x1a27('0xf'),_0x42e712,_0x1a27('0x10'));logger['debug'](_0x1a27('0x11'),_0x42e712,_0x1a27('0x10'),JSON['stringify'](_0x5dcbba));if(_0x5dcbba[_0x1a27('0x12')]){if(_0x5dcbba[_0x1a27('0x12')][_0x1a27('0x13')]===0x1f4){logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x42e712,_0x5dcbba[_0x1a27('0x12')][_0x1a27('0x14')]);return _0x5656c5(_0x5dcbba[_0x1a27('0x12')][_0x1a27('0x14')]);}logger['error']('ChatInternalMessage,\x20%s,\x20%s',_0x42e712,_0x5dcbba[_0x1a27('0x12')][_0x1a27('0x14')]);return _0x5538bd(_0x5dcbba[_0x1a27('0x12')][_0x1a27('0x14')]);}else{logger[_0x1a27('0xe')](_0x1a27('0xf'),_0x42e712,'request\x20sent');_0x5538bd(_0x5dcbba['result'][_0x1a27('0x14')]);}})['catch'](function(_0x56b530){logger[_0x1a27('0x12')](_0x1a27('0xf'),_0x42e712,_0x56b530);_0x5656c5(_0x56b530);});});} \ No newline at end of file +var _0x0a5c=['request','info','ChatInternalMessage,\x20%s,\x20%s','request\x20sent','debug','ChatInternalMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','./chatInternalMessage.socket','register'];(function(_0x243a75,_0x4acb96){var _0x2cdf79=function(_0x15e913){while(--_0x15e913){_0x243a75['push'](_0x243a75['shift']());}};_0x2cdf79(++_0x4acb96);}(_0x0a5c,0x97));var _0xc0a5=function(_0x4792c8,_0x5158a1){_0x4792c8=_0x4792c8-0x0;var _0x35edb1=_0x0a5c[_0x4792c8];return _0x35edb1;};'use strict';var _=require(_0xc0a5('0x0'));var util=require('util');var moment=require(_0xc0a5('0x1'));var BPromise=require(_0xc0a5('0x2'));var rs=require(_0xc0a5('0x3'));var fs=require('fs');var Redis=require(_0xc0a5('0x4'));var db=require(_0xc0a5('0x5'))['db'];var utils=require(_0xc0a5('0x6'));var logger=require(_0xc0a5('0x7'))(_0xc0a5('0x8'));var config=require('../../config/environment');var jayson=require(_0xc0a5('0x9'));var client=jayson[_0xc0a5('0xa')][_0xc0a5('0xb')]({'port':0x232a});config[_0xc0a5('0xc')]=_[_0xc0a5('0xd')](config[_0xc0a5('0xc')],{'host':_0xc0a5('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc0a5('0xc')]));require(_0xc0a5('0xf'))[_0xc0a5('0x10')](socket);function respondWithRpcPromise(_0x3b9a82,_0x40cf1e,_0x1f1435){return new BPromise(function(_0x95f509,_0x2396d8){return client[_0xc0a5('0x11')](_0x3b9a82,_0x1f1435)['then'](function(_0x45f0c6){logger[_0xc0a5('0x12')](_0xc0a5('0x13'),_0x40cf1e,_0xc0a5('0x14'));logger[_0xc0a5('0x15')](_0xc0a5('0x16'),_0x40cf1e,_0xc0a5('0x14'),JSON[_0xc0a5('0x17')](_0x45f0c6));if(_0x45f0c6[_0xc0a5('0x18')]){if(_0x45f0c6[_0xc0a5('0x18')][_0xc0a5('0x19')]===0x1f4){logger[_0xc0a5('0x18')](_0xc0a5('0x13'),_0x40cf1e,_0x45f0c6[_0xc0a5('0x18')][_0xc0a5('0x1a')]);return _0x2396d8(_0x45f0c6[_0xc0a5('0x18')][_0xc0a5('0x1a')]);}logger[_0xc0a5('0x18')](_0xc0a5('0x13'),_0x40cf1e,_0x45f0c6[_0xc0a5('0x18')][_0xc0a5('0x1a')]);return _0x95f509(_0x45f0c6[_0xc0a5('0x18')][_0xc0a5('0x1a')]);}else{logger[_0xc0a5('0x12')](_0xc0a5('0x13'),_0x40cf1e,_0xc0a5('0x14'));_0x95f509(_0x45f0c6[_0xc0a5('0x1b')][_0xc0a5('0x1a')]);}})['catch'](function(_0x37d92e){logger[_0xc0a5('0x18')]('ChatInternalMessage,\x20%s,\x20%s',_0x40cf1e,_0x37d92e);_0x2396d8(_0x37d92e);});});} \ No newline at end of file diff --git a/server/api/chatInternalMessage/chatInternalMessage.socket.js b/server/api/chatInternalMessage/chatInternalMessage.socket.js index 49f9048..66d26ec 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 _0xe9c7=['register','./chatInternalMessage.events','remove','update','emit'];(function(_0x53959f,_0x518993){var _0x30c6cd=function(_0x4971b5){while(--_0x4971b5){_0x53959f['push'](_0x53959f['shift']());}};_0x30c6cd(++_0x518993);}(_0xe9c7,0x105));var _0x7e9c=function(_0x1fc7ea,_0x1eb959){_0x1fc7ea=_0x1fc7ea-0x0;var _0x390677=_0xe9c7[_0x1fc7ea];return _0x390677;};'use strict';var ChatInternalMessageEvents=require(_0x7e9c('0x0'));var events=['save',_0x7e9c('0x1'),_0x7e9c('0x2')];function createListener(_0x4e5f4b,_0x2b9e27){return function(_0x425284){_0x2b9e27[_0x7e9c('0x3')](_0x4e5f4b,_0x425284);};}function removeListener(_0x4146a6,_0x3b9123){return function(){ChatInternalMessageEvents['removeListener'](_0x4146a6,_0x3b9123);};}exports[_0x7e9c('0x4')]=function(_0x55891f){for(var _0x9be77f=0x0,_0x16ad53=events['length'];_0x9be77f<_0x16ad53;_0x9be77f++){var _0xe94f56=events[_0x9be77f];var _0x5ac58e=createListener('chatInternalMessage:'+_0xe94f56,_0x55891f);ChatInternalMessageEvents['on'](_0xe94f56,_0x5ac58e);}}; \ No newline at end of file +var _0x05b2=['./chatInternalMessage.events','update','removeListener','length','chatInternalMessage:'];(function(_0x266885,_0x54ae3b){var _0x1f4936=function(_0x32e545){while(--_0x32e545){_0x266885['push'](_0x266885['shift']());}};_0x1f4936(++_0x54ae3b);}(_0x05b2,0x163));var _0x205b=function(_0x5642e0,_0x5910dc){_0x5642e0=_0x5642e0-0x0;var _0x5c9d47=_0x05b2[_0x5642e0];return _0x5c9d47;};'use strict';var ChatInternalMessageEvents=require(_0x205b('0x0'));var events=['save','remove',_0x205b('0x1')];function createListener(_0x3a470a,_0x478ce9){return function(_0x6cbeda){_0x478ce9['emit'](_0x3a470a,_0x6cbeda);};}function removeListener(_0x416f3b,_0x4ef4d3){return function(){ChatInternalMessageEvents[_0x205b('0x2')](_0x416f3b,_0x4ef4d3);};}exports['register']=function(_0x33b52b){for(var _0x5baa0a=0x0,_0x2826ae=events[_0x205b('0x3')];_0x5baa0a<_0x2826ae;_0x5baa0a++){var _0x47e0d6=events[_0x5baa0a];var _0xc1a43a=createListener(_0x205b('0x4')+_0x47e0d6,_0x33b52b);ChatInternalMessageEvents['on'](_0x47e0d6,_0xc1a43a);}}; \ No newline at end of file diff --git a/server/api/chatInternalMessage/index.js b/server/api/chatInternalMessage/index.js index 07058ea..5a3d57d 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 _0x0002=['exports','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./chatInternalMessage.controller','get','/describe','isAuthenticated','describe','getUsers','/:id','show','create','put','update','delete','destroy'];(function(_0x7c9341,_0x92e3ca){var _0x14c09f=function(_0x34efa6){while(--_0x34efa6){_0x7c9341['push'](_0x7c9341['shift']());}};_0x14c09f(++_0x92e3ca);}(_0x0002,0x119));var _0x2000=function(_0x53755f,_0x28e72e){_0x53755f=_0x53755f-0x0;var _0x46539d=_0x0002[_0x53755f];return _0x46539d;};'use strict';var multer=require('multer');var util=require(_0x2000('0x0'));var path=require('path');var timeout=require(_0x2000('0x1'));var express=require(_0x2000('0x2'));var router=express[_0x2000('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2000('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2000('0x5'));var controller=require(_0x2000('0x6'));router[_0x2000('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0x2000('0x7')](_0x2000('0x8'),auth[_0x2000('0x9')](),controller[_0x2000('0xa')]);router[_0x2000('0x7')]('/users',auth['isAuthenticated'](),controller[_0x2000('0xb')]);router[_0x2000('0x7')](_0x2000('0xc'),auth[_0x2000('0x9')](),controller[_0x2000('0xd')]);router['post']('/',auth[_0x2000('0x9')](),controller[_0x2000('0xe')]);router[_0x2000('0xf')](_0x2000('0xc'),controller[_0x2000('0x10')]);router[_0x2000('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x2000('0x12')]);module[_0x2000('0x13')]=router; \ No newline at end of file +var _0xceeb=['get','index','/describe','isAuthenticated','describe','/users','getUsers','/:id','show','post','put','destroy','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatInternalMessage.controller'];(function(_0x5ad512,_0x587a7d){var _0x5b78c1=function(_0x550665){while(--_0x550665){_0x5ad512['push'](_0x5ad512['shift']());}};_0x5b78c1(++_0x587a7d);}(_0xceeb,0x147));var _0xbcee=function(_0x2b4b3f,_0x3699b3){_0x2b4b3f=_0x2b4b3f-0x0;var _0xd54c71=_0xceeb[_0x2b4b3f];return _0xd54c71;};'use strict';var multer=require('multer');var util=require(_0xbcee('0x0'));var path=require('path');var timeout=require(_0xbcee('0x1'));var express=require(_0xbcee('0x2'));var router=express[_0xbcee('0x3')]();var fs_extra=require(_0xbcee('0x4'));var auth=require(_0xbcee('0x5'));var interaction=require(_0xbcee('0x6'));var config=require(_0xbcee('0x7'));var controller=require(_0xbcee('0x8'));router[_0xbcee('0x9')]('/',auth['isAuthenticated'](),controller[_0xbcee('0xa')]);router[_0xbcee('0x9')](_0xbcee('0xb'),auth[_0xbcee('0xc')](),controller[_0xbcee('0xd')]);router[_0xbcee('0x9')](_0xbcee('0xe'),auth[_0xbcee('0xc')](),controller[_0xbcee('0xf')]);router[_0xbcee('0x9')](_0xbcee('0x10'),auth[_0xbcee('0xc')](),controller[_0xbcee('0x11')]);router[_0xbcee('0x12')]('/',auth['isAuthenticated'](),controller['create']);router[_0xbcee('0x13')](_0xbcee('0x10'),controller['update']);router['delete'](_0xbcee('0x10'),auth[_0xbcee('0xc')](),controller[_0xbcee('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 85e803b..808d0da 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 _0xb4f8=['medium','BOOLEAN','ENUM','out','STRING','exports','TEXT'];(function(_0x307831,_0x508287){var _0x12ed17=function(_0x223253){while(--_0x223253){_0x307831['push'](_0x307831['shift']());}};_0x12ed17(++_0x508287);}(_0xb4f8,0x83));var _0x8b4f=function(_0x1a36a5,_0x746928){_0x1a36a5=_0x1a36a5-0x0;var _0x746243=_0xb4f8[_0x1a36a5];return _0x746243;};'use strict';var Sequelize=require('sequelize');module[_0x8b4f('0x0')]={'body':{'type':Sequelize[_0x8b4f('0x1')](_0x8b4f('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x8b4f('0x3')],'defaultValue':![]},'secret':{'type':Sequelize[_0x8b4f('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x8b4f('0x4')]('in','out'),'defaultValue':_0x8b4f('0x5'),'allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0x8b4f('0x6')]},'providerResponse':{'type':Sequelize[_0x8b4f('0x1')]}}; \ No newline at end of file +var _0x4227=['TEXT','sequelize','medium','BOOLEAN','ENUM','out','DATE','STRING'];(function(_0x3a209c,_0x9bd72a){var _0x506f6b=function(_0x2995f7){while(--_0x2995f7){_0x3a209c['push'](_0x3a209c['shift']());}};_0x506f6b(++_0x9bd72a);}(_0x4227,0x89));var _0x7422=function(_0xe5eebe,_0x5a87b2){_0xe5eebe=_0xe5eebe-0x0;var _0x4581c3=_0x4227[_0xe5eebe];return _0x4581c3;};'use strict';var Sequelize=require(_0x7422('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x7422('0x1')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'secret':{'type':Sequelize[_0x7422('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x7422('0x3')]('in',_0x7422('0x4')),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize[_0x7422('0x5')]},'providerName':{'type':Sequelize[_0x7422('0x6')]},'providerResponse':{'type':Sequelize[_0x7422('0x7')]}}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.controller.js b/server/api/chatMessage/chatMessage.controller.js index 21316b6..7660ecc 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 _0x9e25=['../../config/environment','../../config/license/util','redis','defaults','localhost','./chatMessage.socket','register','jayson/promise','client','http','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','sendStatus','status','json','offset','undefined','limit','set','Content-Range','reject','save','update','destroy','stack','name','map','ChatMessage','rawAttributes','type','key','model','query','keys','intersection','attributes','length','nolimit','order','sort','where','filters','pick','filter','options','count','includeAll','include','findAll','rows','show','params','fields','merge','find','create','body','describe','chat-interactions','accept','chat','format','UserId','user','agent','get','ChatInteraction','ChatInteractionId','interaction','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','RejectMessage','rejectMessage','event','parse','formData','eml-format','rimraf','fast-json-patch','moment','mustache','util','sox','ejs','lodash','crypto','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils'];(function(_0x44bcb0,_0x235aa9){var _0xfaf881=function(_0x25d81d){while(--_0x25d81d){_0x44bcb0['push'](_0x44bcb0['shift']());}};_0xfaf881(++_0x235aa9);}(_0x9e25,0x15c));var _0x59e2=function(_0x3aa79d,_0x4872bb){_0x3aa79d=_0x3aa79d-0x0;var _0x40e15f=_0x9e25[_0x3aa79d];return _0x40e15f;};'use strict';var emlformat=require(_0x59e2('0x0'));var rimraf=require(_0x59e2('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x59e2('0x2'));var rp=require('request-promise');var moment=require(_0x59e2('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x59e2('0x4'));var util=require(_0x59e2('0x5'));var path=require('path');var sox=require(_0x59e2('0x6'));var csv=require('to-csv');var ejs=require(_0x59e2('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x59e2('0x8'));var squel=require('squel');var crypto=require(_0x59e2('0x9'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x59e2('0xa'));var querystring=require(_0x59e2('0xb'));var Papa=require(_0x59e2('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x59e2('0xd'));var as=require(_0x59e2('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x59e2('0xf'))(_0x59e2('0x10'));var utils=require(_0x59e2('0x11'));var config=require(_0x59e2('0x12'));var licenseUtil=require(_0x59e2('0x13'));var db=require('../../mysqldb')['db'];config[_0x59e2('0x14')]=_[_0x59e2('0x15')](config[_0x59e2('0x14')],{'host':_0x59e2('0x16'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x59e2('0x17'))[_0x59e2('0x18')](socket);var jayson=require(_0x59e2('0x19'));var client=jayson[_0x59e2('0x1a')][_0x59e2('0x1b')]({'port':0x232c});var client9002=jayson[_0x59e2('0x1a')]['http']({'port':0x232a});function respondWithRpcPromise(_0x338d8d,_0x2558b8,_0x5713bd,_0x6673fc){return new BPromise(function(_0x2e9923,_0x4a8f8c){var _0x498756=_0x6673fc||client;return _0x498756[_0x59e2('0x1c')](_0x338d8d,_0x5713bd)[_0x59e2('0x1d')](function(_0x19309c){logger[_0x59e2('0x1e')](_0x59e2('0x1f'),_0x2558b8,_0x59e2('0x20'));logger[_0x59e2('0x21')](_0x59e2('0x22'),_0x2558b8,_0x59e2('0x20'),JSON[_0x59e2('0x23')](_0x19309c));if(_0x19309c[_0x59e2('0x24')]){if(_0x19309c[_0x59e2('0x24')]['code']===0x1f4){logger[_0x59e2('0x24')](_0x59e2('0x1f'),_0x2558b8,_0x19309c[_0x59e2('0x24')][_0x59e2('0x25')]);return _0x4a8f8c(_0x19309c[_0x59e2('0x24')]['message']);}logger[_0x59e2('0x24')](_0x59e2('0x1f'),_0x2558b8,_0x19309c[_0x59e2('0x24')][_0x59e2('0x25')]);return _0x2e9923(_0x19309c[_0x59e2('0x24')][_0x59e2('0x25')]);}else{logger[_0x59e2('0x1e')](_0x59e2('0x1f'),_0x2558b8,_0x59e2('0x20'));_0x2e9923(_0x19309c['result']['message']);}})[_0x59e2('0x26')](function(_0x4b34e9){logger['error'](_0x59e2('0x1f'),_0x2558b8,_0x4b34e9);_0x4a8f8c(_0x4b34e9);});});}function respondWithStatusCode(_0x2783f9,_0xb488d3){_0xb488d3=_0xb488d3||0xcc;return function(_0x13ae5d){if(_0x13ae5d){return _0x2783f9[_0x59e2('0x27')](_0xb488d3);}return _0x2783f9[_0x59e2('0x28')](_0xb488d3)['end']();};}function respondWithResult(_0x56fc6f,_0x223c71){_0x223c71=_0x223c71||0xc8;return function(_0x4745fa){if(_0x4745fa){return _0x56fc6f[_0x59e2('0x28')](_0x223c71)[_0x59e2('0x29')](_0x4745fa);}};}function respondWithFilteredResult(_0x6ef7d5,_0x18de1c){return function(_0x161889){if(_0x161889){var _0x206829=typeof _0x18de1c[_0x59e2('0x2a')]===_0x59e2('0x2b')&&typeof _0x18de1c[_0x59e2('0x2c')]==='undefined';var _0x90e79b=_0x161889['count'];var _0x26c37c=_0x206829?0x0:_0x18de1c[_0x59e2('0x2a')];var _0x227341=_0x206829?_0x161889['count']:_0x18de1c[_0x59e2('0x2a')]+_0x18de1c['limit'];var _0x4068ba;if(_0x227341>=_0x90e79b){_0x227341=_0x90e79b;_0x4068ba=0xc8;}else{_0x4068ba=0xce;}_0x6ef7d5[_0x59e2('0x28')](_0x4068ba);return _0x6ef7d5[_0x59e2('0x2d')](_0x59e2('0x2e'),_0x26c37c+'-'+_0x227341+'/'+_0x90e79b)[_0x59e2('0x29')](_0x161889);}return null;};}function patchUpdates(_0x4f6bf8){return function(_0x26643f){try{jsonpatch['apply'](_0x26643f,_0x4f6bf8,!![]);}catch(_0x552676){return BPromise[_0x59e2('0x2f')](_0x552676);}return _0x26643f[_0x59e2('0x30')]();};}function saveUpdates(_0x35b6db,_0x587f4e){return function(_0x577b7f){if(_0x577b7f){return _0x577b7f[_0x59e2('0x31')](_0x35b6db)[_0x59e2('0x1d')](function(_0x2d2c74){return _0x2d2c74;});}return null;};}function removeEntity(_0x1cc729,_0x244651){return function(_0x5425b3){if(_0x5425b3){return _0x5425b3[_0x59e2('0x32')]()[_0x59e2('0x1d')](function(){_0x1cc729[_0x59e2('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x449250,_0x2ffc5e){return function(_0x53a17b){if(!_0x53a17b){_0x449250[_0x59e2('0x27')](0x194);}return _0x53a17b;};}function handleError(_0x2b7064,_0x1d593b){_0x1d593b=_0x1d593b||0x1f4;return function(_0x3645e0){logger[_0x59e2('0x24')](_0x3645e0[_0x59e2('0x33')]);if(_0x3645e0[_0x59e2('0x34')]){delete _0x3645e0[_0x59e2('0x34')];}_0x2b7064[_0x59e2('0x28')](_0x1d593b)['send'](_0x3645e0);};}exports['index']=function(_0x8b456,_0x1b5690){var _0x2bf868={},_0x2e0aed={},_0x2d5829={'count':0x0,'rows':[]};var _0x5c6a66=_[_0x59e2('0x35')](db[_0x59e2('0x36')][_0x59e2('0x37')],function(_0x81ca4a){return{'name':_0x81ca4a['fieldName'],'type':_0x81ca4a[_0x59e2('0x38')][_0x59e2('0x39')]};});_0x2e0aed[_0x59e2('0x3a')]=_[_0x59e2('0x35')](_0x5c6a66,_0x59e2('0x34'));_0x2e0aed[_0x59e2('0x3b')]=_[_0x59e2('0x3c')](_0x8b456[_0x59e2('0x3b')]);_0x2e0aed['filters']=_[_0x59e2('0x3d')](_0x2e0aed[_0x59e2('0x3a')],_0x2e0aed[_0x59e2('0x3b')]);_0x2bf868[_0x59e2('0x3e')]=_['intersection'](_0x2e0aed['model'],qs['fields'](_0x8b456[_0x59e2('0x3b')]['fields']));_0x2bf868[_0x59e2('0x3e')]=_0x2bf868[_0x59e2('0x3e')][_0x59e2('0x3f')]?_0x2bf868[_0x59e2('0x3e')]:_0x2e0aed[_0x59e2('0x3a')];if(!_0x8b456['query']['hasOwnProperty'](_0x59e2('0x40'))){_0x2bf868[_0x59e2('0x2c')]=qs[_0x59e2('0x2c')](_0x8b456[_0x59e2('0x3b')][_0x59e2('0x2c')]);_0x2bf868[_0x59e2('0x2a')]=qs[_0x59e2('0x2a')](_0x8b456[_0x59e2('0x3b')][_0x59e2('0x2a')]);}_0x2bf868[_0x59e2('0x41')]=qs[_0x59e2('0x42')](_0x8b456['query'][_0x59e2('0x42')]);_0x2bf868[_0x59e2('0x43')]=qs[_0x59e2('0x44')](_[_0x59e2('0x45')](_0x8b456['query'],_0x2e0aed[_0x59e2('0x44')]),_0x5c6a66);if(_0x8b456[_0x59e2('0x3b')][_0x59e2('0x46')]){_0x2bf868[_0x59e2('0x43')]=_['merge'](_0x2bf868[_0x59e2('0x43')],{'$or':_[_0x59e2('0x35')](_0x5c6a66,function(_0x14a505){if(_0x14a505[_0x59e2('0x38')]!=='VIRTUAL'){var _0x4eacc6={};_0x4eacc6[_0x14a505[_0x59e2('0x34')]]={'$like':'%'+_0x8b456[_0x59e2('0x3b')]['filter']+'%'};return _0x4eacc6;}})});}_0x2bf868=_['merge']({},_0x2bf868,_0x8b456[_0x59e2('0x47')]);var _0x4d303c={'where':_0x2bf868[_0x59e2('0x43')]};return db[_0x59e2('0x36')][_0x59e2('0x48')](_0x4d303c)['then'](function(_0x1e0ebd){_0x2d5829['count']=_0x1e0ebd;if(_0x8b456[_0x59e2('0x3b')][_0x59e2('0x49')]){_0x2bf868[_0x59e2('0x4a')]=[{'all':!![]}];}return db[_0x59e2('0x36')][_0x59e2('0x4b')](_0x2bf868);})[_0x59e2('0x1d')](function(_0x3af978){_0x2d5829[_0x59e2('0x4c')]=_0x3af978;return _0x2d5829;})[_0x59e2('0x1d')](respondWithFilteredResult(_0x1b5690,_0x2bf868))[_0x59e2('0x26')](handleError(_0x1b5690,null));};exports[_0x59e2('0x4d')]=function(_0x7ce3e5,_0x3ba99e){var _0x27d687={'raw':!![],'where':{'id':_0x7ce3e5[_0x59e2('0x4e')]['id']}},_0x5edc96={};_0x5edc96[_0x59e2('0x3a')]=_[_0x59e2('0x3c')](db[_0x59e2('0x36')][_0x59e2('0x37')]);_0x5edc96['query']=_[_0x59e2('0x3c')](_0x7ce3e5[_0x59e2('0x3b')]);_0x5edc96[_0x59e2('0x44')]=_[_0x59e2('0x3d')](_0x5edc96['model'],_0x5edc96[_0x59e2('0x3b')]);_0x27d687[_0x59e2('0x3e')]=_['intersection'](_0x5edc96[_0x59e2('0x3a')],qs[_0x59e2('0x4f')](_0x7ce3e5[_0x59e2('0x3b')][_0x59e2('0x4f')]));_0x27d687[_0x59e2('0x3e')]=_0x27d687[_0x59e2('0x3e')][_0x59e2('0x3f')]?_0x27d687['attributes']:_0x5edc96[_0x59e2('0x3a')];if(_0x7ce3e5[_0x59e2('0x3b')]['includeAll']){_0x27d687[_0x59e2('0x4a')]=[{'all':!![]}];}_0x27d687=_[_0x59e2('0x50')]({},_0x27d687,_0x7ce3e5[_0x59e2('0x47')]);return db[_0x59e2('0x36')][_0x59e2('0x51')](_0x27d687)[_0x59e2('0x1d')](handleEntityNotFound(_0x3ba99e,null))['then'](respondWithResult(_0x3ba99e,null))[_0x59e2('0x26')](handleError(_0x3ba99e,null));};exports[_0x59e2('0x52')]=function(_0x1c7ad8,_0x133db6){return db[_0x59e2('0x36')][_0x59e2('0x52')](_0x1c7ad8[_0x59e2('0x53')],{})[_0x59e2('0x1d')](respondWithResult(_0x133db6,0xc9))[_0x59e2('0x26')](handleError(_0x133db6,null));};exports[_0x59e2('0x31')]=function(_0x3f6b23,_0x25e2ff){if(_0x3f6b23[_0x59e2('0x53')]['id']){delete _0x3f6b23['body']['id'];}return db[_0x59e2('0x36')][_0x59e2('0x51')]({'where':{'id':_0x3f6b23[_0x59e2('0x4e')]['id']}})[_0x59e2('0x1d')](handleEntityNotFound(_0x25e2ff,null))[_0x59e2('0x1d')](saveUpdates(_0x3f6b23[_0x59e2('0x53')],null))['then'](respondWithResult(_0x25e2ff,null))[_0x59e2('0x26')](handleError(_0x25e2ff,null));};exports[_0x59e2('0x32')]=function(_0x19233f,_0x1c65ee){return db['ChatMessage'][_0x59e2('0x51')]({'where':{'id':_0x19233f['params']['id']}})[_0x59e2('0x1d')](handleEntityNotFound(_0x1c65ee,null))[_0x59e2('0x1d')](removeEntity(_0x1c65ee,null))['catch'](handleError(_0x1c65ee,null));};exports[_0x59e2('0x54')]=function(_0x4ed8ee,_0x165100){return db[_0x59e2('0x36')][_0x59e2('0x54')]()[_0x59e2('0x1d')](respondWithResult(_0x165100,null))[_0x59e2('0x26')](handleError(_0x165100,null));};var interaction_log=require('../../config/logger')(_0x59e2('0x55'));exports[_0x59e2('0x56')]=function(_0x7bac43,_0x323b86,_0x4dba0e){var _0x256ec7={'agent':{},'channel':_0x59e2('0x57')};if(_0x7bac43[_0x59e2('0x53')]['id']){delete _0x7bac43[_0x59e2('0x53')]['id'];}_0x7bac43['body']['read']=!![];_0x7bac43[_0x59e2('0x53')]['readAt']=moment()[_0x59e2('0x58')]('YYYY-MM-DD\x20HH:mm:ss');_0x7bac43[_0x59e2('0x53')][_0x59e2('0x59')]=_0x7bac43[_0x59e2('0x53')][_0x59e2('0x59')]||_0x7bac43[_0x59e2('0x5a')]['id'];_0x256ec7[_0x59e2('0x5b')]['id']=_0x7bac43[_0x59e2('0x53')][_0x59e2('0x59')];return db[_0x59e2('0x36')]['find']({'where':{'id':_0x7bac43[_0x59e2('0x4e')]['id'],'UserId':null}})[_0x59e2('0x1d')](handleEntityNotFound(_0x323b86,null))[_0x59e2('0x1d')](saveUpdates(_0x7bac43[_0x59e2('0x53')],null))['then'](function(_0x5012e1){if(_0x5012e1){_0x256ec7['message']=_0x5012e1[_0x59e2('0x5c')]({'plain':!![]});return db[_0x59e2('0x5d')]['find']({'where':{'id':_0x5012e1[_0x59e2('0x5e')]}});}return null;})['then'](handleEntityNotFound(_0x323b86,null))['then'](function(_0x163f47){if(_0x163f47){return _0x163f47[_0x59e2('0x31')]({'UserId':_0x7bac43[_0x59e2('0x53')][_0x59e2('0x59')],'read1stAt':_['isNil'](_0x163f47['read1stAt'])?moment()[_0x59e2('0x58')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x59e2('0x1d')](function(_0x95f421){if(_0x95f421){_0x256ec7[_0x59e2('0x5f')]=_0x95f421['get']({'plain':!![]});interaction_log['info'](_0x59e2('0x60'),_0x7bac43[_0x59e2('0x5a')]['id'],_0x7bac43['user'][_0x59e2('0x34')],_0x7bac43[_0x59e2('0x5a')][_0x59e2('0x61')],_0x256ec7[_0x59e2('0x5f')]['id'],_0x7bac43[_0x59e2('0x53')]?JSON[_0x59e2('0x23')](_0x7bac43[_0x59e2('0x53')]):_0x59e2('0x62'));return respondWithRpcPromise(_0x59e2('0x63'),'acceptMessage',_0x256ec7);}return null;})[_0x59e2('0x1d')](function(_0x3c46bb){var _0x359b10=_0x59e2('0x64')+_0x3c46bb[_0x59e2('0x25')][_0x59e2('0x65')];return db[_0x59e2('0x66')][_0x59e2('0x3b')](_0x359b10,{'type':db[_0x59e2('0x67')][_0x59e2('0x68')][_0x59e2('0x69')],'raw':!![]})[_0x59e2('0x1d')](function(_0x1ade2d){return _0x1ade2d;});})[_0x59e2('0x1d')](function(_0x5014a7){if(_0x5014a7){_0x256ec7['message'][_0x59e2('0x6a')]=_0x5014a7[0x0];if(!_0x7bac43[_0x59e2('0x53')][_0x59e2('0x59')])return;return db[_0x59e2('0x6b')][_0x59e2('0x51')]({'where':{'id':_0x7bac43[_0x59e2('0x53')][_0x59e2('0x59')],'role':_0x59e2('0x5b')},'attributes':['id',_0x59e2('0x34'),_0x59e2('0x6c'),_0x59e2('0x6d'),_0x59e2('0x6e')],'raw':!![]});}return null;})[_0x59e2('0x1d')](function(_0x18a09c){if(!_0x18a09c)return null;_0x256ec7[_0x59e2('0x25')][_0x59e2('0x5b')]=_0x18a09c;return _0x256ec7;})[_0x59e2('0x1d')](function(_0x50ec04){if(_0x50ec04){if(_0x7bac43[_0x59e2('0x53')][_0x59e2('0x6f')]){_0x256ec7[_0x59e2('0x25')][_0x59e2('0x70')]=util[_0x59e2('0x58')](_0x59e2('0x71'),_0x7bac43[_0x59e2('0x5a')][_0x59e2('0x34')]);_0x256ec7['message'][_0x59e2('0x72')]=_0x256ec7[_0x59e2('0x72')];_0x256ec7[_0x59e2('0x25')][_0x59e2('0x73')]=_0x256ec7[_0x59e2('0x72')];_0x256ec7[_0x59e2('0x25')]['event']=_0x59e2('0x56');return respondWithRpcPromise('EventManager',_0x59e2('0x74'),{'event':'acceptmessage','message':_[_0x59e2('0x50')](_0x256ec7[_0x59e2('0x25')],JSON['parse'](_0x256ec7[_0x59e2('0x5f')]['formData']))},client9002)[_0x59e2('0x1d')](function(){return _0x256ec7;});}return _0x256ec7;}return null;})[_0x59e2('0x1d')](respondWithResult(_0x323b86,null))[_0x59e2('0x26')](handleError(_0x323b86,null));};var interaction_log=require(_0x59e2('0xf'))('chat-interactions');exports[_0x59e2('0x2f')]=function(_0x44662b,_0x29fa53,_0x1eef4d){var _0x162a65={'agent':{},'channel':_0x59e2('0x57')};if(_0x44662b['body']['id']){delete _0x44662b[_0x59e2('0x53')]['id'];}_0x44662b['body'][_0x59e2('0x59')]=_0x44662b['body'][_0x59e2('0x59')]||_0x44662b[_0x59e2('0x5a')]['id'];_0x162a65[_0x59e2('0x5b')]['id']=_0x44662b['body'][_0x59e2('0x59')];return db[_0x59e2('0x36')][_0x59e2('0x51')]({'where':{'id':_0x44662b[_0x59e2('0x4e')]['id'],'UserId':null}})[_0x59e2('0x1d')](handleEntityNotFound(_0x29fa53,null))['then'](function(_0x39395f){if(_0x39395f){_0x162a65[_0x59e2('0x25')]=_0x39395f['get']({'plain':!![]});return db[_0x59e2('0x5d')]['find']({'where':{'id':_0x39395f[_0x59e2('0x5e')]}});}return null;})[_0x59e2('0x1d')](handleEntityNotFound(_0x29fa53,null))[_0x59e2('0x1d')](function(_0x8c1243){if(_0x8c1243){_0x162a65[_0x59e2('0x5f')]=_0x8c1243[_0x59e2('0x5c')]({'plain':!![]});interaction_log['info']('[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x44662b[_0x59e2('0x5a')]['id'],_0x44662b['user'][_0x59e2('0x34')],_0x44662b['user']['role'],_0x162a65['interaction']['id'],_0x44662b[_0x59e2('0x53')]?JSON['stringify'](_0x44662b['body']):_0x59e2('0x62'));return respondWithRpcPromise(_0x59e2('0x75'),_0x59e2('0x76'),_0x162a65);}return null;})['then'](function(_0x53aa05){var _0xed2f54=_0x59e2('0x64')+_0x53aa05[_0x59e2('0x25')]['ContactId'];return db['sequelize']['query'](_0xed2f54,{'type':db[_0x59e2('0x67')][_0x59e2('0x68')]['SELECT'],'raw':!![]})[_0x59e2('0x1d')](function(_0x25227c){return _0x25227c;});})[_0x59e2('0x1d')](function(_0xb69821){if(_0xb69821){_0x162a65['message'][_0x59e2('0x6a')]=_0xb69821[0x0];if(!_0x44662b[_0x59e2('0x53')][_0x59e2('0x59')])return;return db[_0x59e2('0x6b')]['find']({'where':{'id':_0x44662b[_0x59e2('0x53')][_0x59e2('0x59')],'role':_0x59e2('0x5b')},'attributes':['id',_0x59e2('0x34'),_0x59e2('0x6c'),'email',_0x59e2('0x6e')],'raw':!![]});}return null;})[_0x59e2('0x1d')](function(_0x361296){if(!_0x361296)return null;_0x162a65['message'][_0x59e2('0x5b')]=_0x361296;return _0x162a65;})[_0x59e2('0x1d')](function(_0x25acf6){if(_0x25acf6){_0x25acf6[_0x59e2('0x25')]['interface']=util[_0x59e2('0x58')]('SIP/%s',_0x44662b['user'][_0x59e2('0x34')]);_0x25acf6['message'][_0x59e2('0x72')]=_0x162a65[_0x59e2('0x72')];_0x25acf6[_0x59e2('0x25')][_0x59e2('0x73')]=_0x162a65[_0x59e2('0x72')];_0x25acf6['message'][_0x59e2('0x77')]=_0x59e2('0x2f');respondWithRpcPromise(_0x59e2('0x74'),_0x59e2('0x74'),{'event':'rejectmessage','message':_[_0x59e2('0x50')](_0x162a65[_0x59e2('0x25')],JSON[_0x59e2('0x78')](_0x162a65[_0x59e2('0x5f')][_0x59e2('0x79')]))},client9002);return _0x162a65;}return null;})[_0x59e2('0x1d')](respondWithResult(_0x29fa53,null))[_0x59e2('0x26')](handleError(_0x29fa53,null));}; \ No newline at end of file +var _0x010c=['accept','chat','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','ChatInteraction','ChatInteractionId','read1stAt','[CHATMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','Sequelize','QueryTypes','SELECT','contact','agent','email','internal','manual','interface','SIP/%s','channel','event','EventManager','acceptmessage','parse','formData','chat-interactions','interaction','[CHATMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','sequelize','User','fullname','motionChannel','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','client','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','stack','name','send','index','map','ChatMessage','rawAttributes','fieldName','type','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','update','params','describe'];(function(_0x2dfd68,_0x2fa790){var _0x4a2a63=function(_0xd74a90){while(--_0xd74a90){_0x2dfd68['push'](_0x2dfd68['shift']());}};_0x4a2a63(++_0x2fa790);}(_0x010c,0x136));var _0xc010=function(_0x3c7ddf,_0x356b4b){_0x3c7ddf=_0x3c7ddf-0x0;var _0x25b44b=_0x010c[_0x3c7ddf];return _0x25b44b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc010('0x0'));var zipdir=require(_0xc010('0x1'));var jsonpatch=require(_0xc010('0x2'));var rp=require(_0xc010('0x3'));var moment=require(_0xc010('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc010('0x5'));var util=require(_0xc010('0x6'));var path=require('path');var sox=require(_0xc010('0x7'));var csv=require(_0xc010('0x8'));var ejs=require(_0xc010('0x9'));var fs=require('fs');var fs_extra=require(_0xc010('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc010('0xb'));var jsforce=require(_0xc010('0xc'));var deskjs=require(_0xc010('0xd'));var toCsv=require(_0xc010('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xc010('0xe'));var qs=require(_0xc010('0xf'));var as=require(_0xc010('0x10'));var hardwareService=require(_0xc010('0x11'));var logger=require(_0xc010('0x12'))('api');var utils=require(_0xc010('0x13'));var config=require(_0xc010('0x14'));var licenseUtil=require(_0xc010('0x15'));var db=require(_0xc010('0x16'))['db'];config[_0xc010('0x17')]=_[_0xc010('0x18')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xc010('0x19'))(new Redis(config[_0xc010('0x17')]));require('./chatMessage.socket')[_0xc010('0x1a')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});var client9002=jayson[_0xc010('0x1b')]['http']({'port':0x232a});function respondWithRpcPromise(_0xb465dc,_0x127393,_0x4d4e8f,_0x2c19c8){return new BPromise(function(_0x1197c2,_0x51798a){var _0x4bea55=_0x2c19c8||client;return _0x4bea55[_0xc010('0x1c')](_0xb465dc,_0x4d4e8f)[_0xc010('0x1d')](function(_0x5d2c35){logger[_0xc010('0x1e')](_0xc010('0x1f'),_0x127393,_0xc010('0x20'));logger[_0xc010('0x21')](_0xc010('0x22'),_0x127393,_0xc010('0x20'),JSON[_0xc010('0x23')](_0x5d2c35));if(_0x5d2c35['error']){if(_0x5d2c35[_0xc010('0x24')][_0xc010('0x25')]===0x1f4){logger[_0xc010('0x24')](_0xc010('0x1f'),_0x127393,_0x5d2c35[_0xc010('0x24')][_0xc010('0x26')]);return _0x51798a(_0x5d2c35[_0xc010('0x24')][_0xc010('0x26')]);}logger[_0xc010('0x24')]('ChatMessage,\x20%s,\x20%s',_0x127393,_0x5d2c35[_0xc010('0x24')][_0xc010('0x26')]);return _0x1197c2(_0x5d2c35[_0xc010('0x24')]['message']);}else{logger[_0xc010('0x1e')]('ChatMessage,\x20%s,\x20%s',_0x127393,_0xc010('0x20'));_0x1197c2(_0x5d2c35[_0xc010('0x27')][_0xc010('0x26')]);}})['catch'](function(_0x4116a5){logger[_0xc010('0x24')](_0xc010('0x1f'),_0x127393,_0x4116a5);_0x51798a(_0x4116a5);});});}function respondWithStatusCode(_0x24e8d5,_0x21bf5f){_0x21bf5f=_0x21bf5f||0xcc;return function(_0x5be09f){if(_0x5be09f){return _0x24e8d5[_0xc010('0x28')](_0x21bf5f);}return _0x24e8d5[_0xc010('0x29')](_0x21bf5f)[_0xc010('0x2a')]();};}function respondWithResult(_0x526d30,_0x4a6e66){_0x4a6e66=_0x4a6e66||0xc8;return function(_0x52821b){if(_0x52821b){return _0x526d30[_0xc010('0x29')](_0x4a6e66)[_0xc010('0x2b')](_0x52821b);}};}function respondWithFilteredResult(_0x28e771,_0x4982b7){return function(_0x56e37b){if(_0x56e37b){var _0x2549cf=typeof _0x4982b7['offset']===_0xc010('0x2c')&&typeof _0x4982b7[_0xc010('0x2d')]===_0xc010('0x2c');var _0x3ecbbe=_0x56e37b[_0xc010('0x2e')];var _0x58d102=_0x2549cf?0x0:_0x4982b7[_0xc010('0x2f')];var _0x2906d6=_0x2549cf?_0x56e37b[_0xc010('0x2e')]:_0x4982b7['offset']+_0x4982b7[_0xc010('0x2d')];var _0x1d1843;if(_0x2906d6>=_0x3ecbbe){_0x2906d6=_0x3ecbbe;_0x1d1843=0xc8;}else{_0x1d1843=0xce;}_0x28e771[_0xc010('0x29')](_0x1d1843);return _0x28e771[_0xc010('0x30')](_0xc010('0x31'),_0x58d102+'-'+_0x2906d6+'/'+_0x3ecbbe)[_0xc010('0x2b')](_0x56e37b);}return null;};}function patchUpdates(_0x1c5611){return function(_0xeab590){try{jsonpatch[_0xc010('0x32')](_0xeab590,_0x1c5611,!![]);}catch(_0x5b56eb){return BPromise[_0xc010('0x33')](_0x5b56eb);}return _0xeab590[_0xc010('0x34')]();};}function saveUpdates(_0x573c28,_0x57cb7a){return function(_0x3e9bba){if(_0x3e9bba){return _0x3e9bba['update'](_0x573c28)[_0xc010('0x1d')](function(_0x191ecc){return _0x191ecc;});}return null;};}function removeEntity(_0x18bf00,_0x3cdd7c){return function(_0x26edf8){if(_0x26edf8){return _0x26edf8[_0xc010('0x35')]()['then'](function(){_0x18bf00['status'](0xcc)[_0xc010('0x2a')]();});}};}function handleEntityNotFound(_0x54dd1e,_0x31dd22){return function(_0xad5e0f){if(!_0xad5e0f){_0x54dd1e[_0xc010('0x28')](0x194);}return _0xad5e0f;};}function handleError(_0x2faf17,_0x2cc6d1){_0x2cc6d1=_0x2cc6d1||0x1f4;return function(_0x88bb44){logger[_0xc010('0x24')](_0x88bb44[_0xc010('0x36')]);if(_0x88bb44[_0xc010('0x37')]){delete _0x88bb44['name'];}_0x2faf17[_0xc010('0x29')](_0x2cc6d1)[_0xc010('0x38')](_0x88bb44);};}exports[_0xc010('0x39')]=function(_0x1e6b22,_0x4dfcdc){var _0x740794={},_0x5b1bb2={},_0x2de299={'count':0x0,'rows':[]};var _0x3d0cb3=_[_0xc010('0x3a')](db[_0xc010('0x3b')][_0xc010('0x3c')],function(_0x157d22){return{'name':_0x157d22[_0xc010('0x3d')],'type':_0x157d22[_0xc010('0x3e')]['key']};});_0x5b1bb2[_0xc010('0x3f')]=_[_0xc010('0x3a')](_0x3d0cb3,_0xc010('0x37'));_0x5b1bb2['query']=_[_0xc010('0x40')](_0x1e6b22[_0xc010('0x41')]);_0x5b1bb2[_0xc010('0x42')]=_[_0xc010('0x43')](_0x5b1bb2[_0xc010('0x3f')],_0x5b1bb2[_0xc010('0x41')]);_0x740794['attributes']=_[_0xc010('0x43')](_0x5b1bb2[_0xc010('0x3f')],qs[_0xc010('0x44')](_0x1e6b22[_0xc010('0x41')][_0xc010('0x44')]));_0x740794[_0xc010('0x45')]=_0x740794[_0xc010('0x45')][_0xc010('0x46')]?_0x740794[_0xc010('0x45')]:_0x5b1bb2['model'];if(!_0x1e6b22[_0xc010('0x41')][_0xc010('0x47')](_0xc010('0x48'))){_0x740794[_0xc010('0x2d')]=qs[_0xc010('0x2d')](_0x1e6b22[_0xc010('0x41')]['limit']);_0x740794['offset']=qs[_0xc010('0x2f')](_0x1e6b22[_0xc010('0x41')][_0xc010('0x2f')]);}_0x740794[_0xc010('0x49')]=qs['sort'](_0x1e6b22[_0xc010('0x41')]['sort']);_0x740794[_0xc010('0x4a')]=qs[_0xc010('0x42')](_[_0xc010('0x4b')](_0x1e6b22[_0xc010('0x41')],_0x5b1bb2[_0xc010('0x42')]),_0x3d0cb3);if(_0x1e6b22[_0xc010('0x41')][_0xc010('0x4c')]){_0x740794[_0xc010('0x4a')]=_[_0xc010('0x4d')](_0x740794[_0xc010('0x4a')],{'$or':_[_0xc010('0x3a')](_0x3d0cb3,function(_0x5bca4a){if(_0x5bca4a['type']!==_0xc010('0x4e')){var _0x3e194a={};_0x3e194a[_0x5bca4a[_0xc010('0x37')]]={'$like':'%'+_0x1e6b22['query']['filter']+'%'};return _0x3e194a;}})});}_0x740794=_[_0xc010('0x4d')]({},_0x740794,_0x1e6b22[_0xc010('0x4f')]);var _0x557ebf={'where':_0x740794[_0xc010('0x4a')]};return db['ChatMessage']['count'](_0x557ebf)['then'](function(_0x421a0f){_0x2de299[_0xc010('0x2e')]=_0x421a0f;if(_0x1e6b22['query'][_0xc010('0x50')]){_0x740794[_0xc010('0x51')]=[{'all':!![]}];}return db[_0xc010('0x3b')][_0xc010('0x52')](_0x740794);})[_0xc010('0x1d')](function(_0x3fa8a6){_0x2de299[_0xc010('0x53')]=_0x3fa8a6;return _0x2de299;})[_0xc010('0x1d')](respondWithFilteredResult(_0x4dfcdc,_0x740794))[_0xc010('0x54')](handleError(_0x4dfcdc,null));};exports[_0xc010('0x55')]=function(_0x2cdfd3,_0x464752){var _0x1cd11d={'raw':!![],'where':{'id':_0x2cdfd3['params']['id']}},_0x324e19={};_0x324e19[_0xc010('0x3f')]=_[_0xc010('0x40')](db['ChatMessage'][_0xc010('0x3c')]);_0x324e19[_0xc010('0x41')]=_[_0xc010('0x40')](_0x2cdfd3[_0xc010('0x41')]);_0x324e19[_0xc010('0x42')]=_[_0xc010('0x43')](_0x324e19[_0xc010('0x3f')],_0x324e19[_0xc010('0x41')]);_0x1cd11d['attributes']=_[_0xc010('0x43')](_0x324e19[_0xc010('0x3f')],qs[_0xc010('0x44')](_0x2cdfd3[_0xc010('0x41')][_0xc010('0x44')]));_0x1cd11d['attributes']=_0x1cd11d[_0xc010('0x45')]['length']?_0x1cd11d[_0xc010('0x45')]:_0x324e19['model'];if(_0x2cdfd3[_0xc010('0x41')][_0xc010('0x50')]){_0x1cd11d[_0xc010('0x51')]=[{'all':!![]}];}_0x1cd11d=_['merge']({},_0x1cd11d,_0x2cdfd3[_0xc010('0x4f')]);return db['ChatMessage'][_0xc010('0x56')](_0x1cd11d)[_0xc010('0x1d')](handleEntityNotFound(_0x464752,null))[_0xc010('0x1d')](respondWithResult(_0x464752,null))[_0xc010('0x54')](handleError(_0x464752,null));};exports['create']=function(_0x3896c7,_0x15870e){return db[_0xc010('0x3b')][_0xc010('0x57')](_0x3896c7[_0xc010('0x58')],{})[_0xc010('0x1d')](respondWithResult(_0x15870e,0xc9))[_0xc010('0x54')](handleError(_0x15870e,null));};exports[_0xc010('0x59')]=function(_0x2515db,_0x38cc62){if(_0x2515db[_0xc010('0x58')]['id']){delete _0x2515db[_0xc010('0x58')]['id'];}return db[_0xc010('0x3b')]['find']({'where':{'id':_0x2515db[_0xc010('0x5a')]['id']}})[_0xc010('0x1d')](handleEntityNotFound(_0x38cc62,null))[_0xc010('0x1d')](saveUpdates(_0x2515db['body'],null))[_0xc010('0x1d')](respondWithResult(_0x38cc62,null))['catch'](handleError(_0x38cc62,null));};exports[_0xc010('0x35')]=function(_0x2d10d6,_0x3a7c6d){return db['ChatMessage'][_0xc010('0x56')]({'where':{'id':_0x2d10d6[_0xc010('0x5a')]['id']}})[_0xc010('0x1d')](handleEntityNotFound(_0x3a7c6d,null))[_0xc010('0x1d')](removeEntity(_0x3a7c6d,null))[_0xc010('0x54')](handleError(_0x3a7c6d,null));};exports[_0xc010('0x5b')]=function(_0x48d702,_0x6396d7){return db['ChatMessage']['describe']()[_0xc010('0x1d')](respondWithResult(_0x6396d7,null))['catch'](handleError(_0x6396d7,null));};var interaction_log=require(_0xc010('0x12'))('chat-interactions');exports[_0xc010('0x5c')]=function(_0x31cb98,_0x452526,_0x2ca006){var _0x527da3={'agent':{},'channel':_0xc010('0x5d')};if(_0x31cb98[_0xc010('0x58')]['id']){delete _0x31cb98['body']['id'];}_0x31cb98[_0xc010('0x58')]['read']=!![];_0x31cb98[_0xc010('0x58')][_0xc010('0x5e')]=moment()[_0xc010('0x5f')](_0xc010('0x60'));_0x31cb98['body'][_0xc010('0x61')]=_0x31cb98[_0xc010('0x58')][_0xc010('0x61')]||_0x31cb98[_0xc010('0x62')]['id'];_0x527da3['agent']['id']=_0x31cb98['body'][_0xc010('0x61')];return db[_0xc010('0x3b')][_0xc010('0x56')]({'where':{'id':_0x31cb98[_0xc010('0x5a')]['id'],'UserId':null}})[_0xc010('0x1d')](handleEntityNotFound(_0x452526,null))[_0xc010('0x1d')](saveUpdates(_0x31cb98['body'],null))[_0xc010('0x1d')](function(_0x4acda1){if(_0x4acda1){_0x527da3['message']=_0x4acda1[_0xc010('0x63')]({'plain':!![]});return db[_0xc010('0x64')]['find']({'where':{'id':_0x4acda1[_0xc010('0x65')]}});}return null;})[_0xc010('0x1d')](handleEntityNotFound(_0x452526,null))[_0xc010('0x1d')](function(_0x255200){if(_0x255200){return _0x255200[_0xc010('0x59')]({'UserId':_0x31cb98['body'][_0xc010('0x61')],'read1stAt':_['isNil'](_0x255200[_0xc010('0x66')])?moment()[_0xc010('0x5f')](_0xc010('0x60')):undefined});}return null;})['then'](function(_0x2aa9b2){if(_0x2aa9b2){_0x527da3['interaction']=_0x2aa9b2[_0xc010('0x63')]({'plain':!![]});interaction_log[_0xc010('0x1e')](_0xc010('0x67'),_0x31cb98[_0xc010('0x62')]['id'],_0x31cb98['user'][_0xc010('0x37')],_0x31cb98['user'][_0xc010('0x68')],_0x527da3['interaction']['id'],_0x31cb98[_0xc010('0x58')]?JSON[_0xc010('0x23')](_0x31cb98['body']):_0xc010('0x69'));return respondWithRpcPromise(_0xc010('0x6a'),'acceptMessage',_0x527da3);}return null;})[_0xc010('0x1d')](function(_0x57c994){var _0x89991c=_0xc010('0x6b')+_0x57c994[_0xc010('0x26')][_0xc010('0x6c')];return db['sequelize'][_0xc010('0x41')](_0x89991c,{'type':db[_0xc010('0x6d')][_0xc010('0x6e')][_0xc010('0x6f')],'raw':!![]})[_0xc010('0x1d')](function(_0x2ea0f4){return _0x2ea0f4;});})[_0xc010('0x1d')](function(_0x3875a4){if(_0x3875a4){_0x527da3[_0xc010('0x26')][_0xc010('0x70')]=_0x3875a4[0x0];if(!_0x31cb98['body'][_0xc010('0x61')])return;return db['User']['find']({'where':{'id':_0x31cb98[_0xc010('0x58')][_0xc010('0x61')],'role':_0xc010('0x71')},'attributes':['id',_0xc010('0x37'),'fullname',_0xc010('0x72'),_0xc010('0x73')],'raw':!![]});}return null;})['then'](function(_0x207542){if(!_0x207542)return null;_0x527da3[_0xc010('0x26')][_0xc010('0x71')]=_0x207542;return _0x527da3;})['then'](function(_0x3ab21f){if(_0x3ab21f){if(_0x31cb98[_0xc010('0x58')][_0xc010('0x74')]){_0x527da3[_0xc010('0x26')][_0xc010('0x75')]=util[_0xc010('0x5f')](_0xc010('0x76'),_0x31cb98[_0xc010('0x62')][_0xc010('0x37')]);_0x527da3[_0xc010('0x26')][_0xc010('0x77')]=_0x527da3['channel'];_0x527da3['message']['motionChannel']=_0x527da3['channel'];_0x527da3[_0xc010('0x26')][_0xc010('0x78')]=_0xc010('0x5c');return respondWithRpcPromise(_0xc010('0x79'),_0xc010('0x79'),{'event':_0xc010('0x7a'),'message':_[_0xc010('0x4d')](_0x527da3[_0xc010('0x26')],JSON[_0xc010('0x7b')](_0x527da3['interaction'][_0xc010('0x7c')]))},client9002)['then'](function(){return _0x527da3;});}return _0x527da3;}return null;})[_0xc010('0x1d')](respondWithResult(_0x452526,null))[_0xc010('0x54')](handleError(_0x452526,null));};var interaction_log=require('../../config/logger')(_0xc010('0x7d'));exports[_0xc010('0x33')]=function(_0x516a18,_0x197274,_0x375d37){var _0x4125d5={'agent':{},'channel':_0xc010('0x5d')};if(_0x516a18['body']['id']){delete _0x516a18['body']['id'];}_0x516a18[_0xc010('0x58')][_0xc010('0x61')]=_0x516a18[_0xc010('0x58')]['UserId']||_0x516a18[_0xc010('0x62')]['id'];_0x4125d5[_0xc010('0x71')]['id']=_0x516a18[_0xc010('0x58')][_0xc010('0x61')];return db[_0xc010('0x3b')][_0xc010('0x56')]({'where':{'id':_0x516a18[_0xc010('0x5a')]['id'],'UserId':null}})[_0xc010('0x1d')](handleEntityNotFound(_0x197274,null))[_0xc010('0x1d')](function(_0xa598e1){if(_0xa598e1){_0x4125d5['message']=_0xa598e1[_0xc010('0x63')]({'plain':!![]});return db[_0xc010('0x64')][_0xc010('0x56')]({'where':{'id':_0xa598e1[_0xc010('0x65')]}});}return null;})[_0xc010('0x1d')](handleEntityNotFound(_0x197274,null))[_0xc010('0x1d')](function(_0x3b4caf){if(_0x3b4caf){_0x4125d5[_0xc010('0x7e')]=_0x3b4caf['get']({'plain':!![]});interaction_log[_0xc010('0x1e')](_0xc010('0x7f'),_0x516a18[_0xc010('0x62')]['id'],_0x516a18[_0xc010('0x62')][_0xc010('0x37')],_0x516a18[_0xc010('0x62')][_0xc010('0x68')],_0x4125d5['interaction']['id'],_0x516a18[_0xc010('0x58')]?JSON[_0xc010('0x23')](_0x516a18[_0xc010('0x58')]):'null');return respondWithRpcPromise(_0xc010('0x80'),_0xc010('0x81'),_0x4125d5);}return null;})[_0xc010('0x1d')](function(_0x28e95c){var _0x5eed56=_0xc010('0x6b')+_0x28e95c[_0xc010('0x26')]['ContactId'];return db[_0xc010('0x82')][_0xc010('0x41')](_0x5eed56,{'type':db[_0xc010('0x6d')][_0xc010('0x6e')]['SELECT'],'raw':!![]})['then'](function(_0x4c2932){return _0x4c2932;});})[_0xc010('0x1d')](function(_0x1c56c6){if(_0x1c56c6){_0x4125d5[_0xc010('0x26')][_0xc010('0x70')]=_0x1c56c6[0x0];if(!_0x516a18[_0xc010('0x58')][_0xc010('0x61')])return;return db[_0xc010('0x83')][_0xc010('0x56')]({'where':{'id':_0x516a18[_0xc010('0x58')]['UserId'],'role':_0xc010('0x71')},'attributes':['id',_0xc010('0x37'),_0xc010('0x84'),_0xc010('0x72'),_0xc010('0x73')],'raw':!![]});}return null;})['then'](function(_0x525ad2){if(!_0x525ad2)return null;_0x4125d5[_0xc010('0x26')]['agent']=_0x525ad2;return _0x4125d5;})['then'](function(_0x51c103){if(_0x51c103){_0x51c103[_0xc010('0x26')][_0xc010('0x75')]=util[_0xc010('0x5f')](_0xc010('0x76'),_0x516a18[_0xc010('0x62')][_0xc010('0x37')]);_0x51c103[_0xc010('0x26')][_0xc010('0x77')]=_0x4125d5[_0xc010('0x77')];_0x51c103[_0xc010('0x26')][_0xc010('0x85')]=_0x4125d5['channel'];_0x51c103['message'][_0xc010('0x78')]='reject';respondWithRpcPromise('EventManager',_0xc010('0x79'),{'event':'rejectmessage','message':_[_0xc010('0x4d')](_0x4125d5[_0xc010('0x26')],JSON[_0xc010('0x7b')](_0x4125d5[_0xc010('0x7e')][_0xc010('0x7c')]))},client9002);return _0x4125d5;}return null;})[_0xc010('0x1d')](respondWithResult(_0x197274,null))[_0xc010('0x54')](handleError(_0x197274,null));}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.events.js b/server/api/chatMessage/chatMessage.events.js index 0005a06..539ebf2 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 _0x3074=['../../mysqldb','ChatMessage','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x3f92fb,_0x4b8915){var _0x5ecb4e=function(_0x131a8d){while(--_0x131a8d){_0x3f92fb['push'](_0x3f92fb['shift']());}};_0x5ecb4e(++_0x4b8915);}(_0x3074,0x182));var _0x4307=function(_0x3a491a,_0x23fd55){_0x3a491a=_0x3a491a-0x0;var _0x2feee6=_0x3074[_0x3a491a];return _0x2feee6;};'use strict';var EventEmitter=require(_0x4307('0x0'));var ChatMessage=require(_0x4307('0x1'))['db'][_0x4307('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x4307('0x3'),'afterDestroy':_0x4307('0x4')};function emitEvent(_0x22b41c){return function(_0x2c42b2,_0x381ea8,_0x902a0a){ChatMessageEvents['emit'](_0x22b41c+':'+_0x2c42b2['id'],_0x2c42b2);ChatMessageEvents[_0x4307('0x5')](_0x22b41c,_0x2c42b2);_0x902a0a(null);};}for(var e in events){if(events[_0x4307('0x6')](e)){var event=events[e];ChatMessage[_0x4307('0x7')](e,emitEvent(event));}}module[_0x4307('0x8')]=ChatMessageEvents; \ No newline at end of file +var _0xec5f=['setMaxListeners','save','emit','hasOwnProperty','events','../../mysqldb','ChatMessage'];(function(_0x539914,_0x297a87){var _0x513e1d=function(_0x35ba25){while(--_0x35ba25){_0x539914['push'](_0x539914['shift']());}};_0x513e1d(++_0x297a87);}(_0xec5f,0xac));var _0xfec5=function(_0x3d4b8e,_0x21e8fd){_0x3d4b8e=_0x3d4b8e-0x0;var _0x390efb=_0xec5f[_0x3d4b8e];return _0x390efb;};'use strict';var EventEmitter=require(_0xfec5('0x0'));var ChatMessage=require(_0xfec5('0x1'))['db'][_0xfec5('0x2')];var ChatMessageEvents=new EventEmitter();ChatMessageEvents[_0xfec5('0x3')](0x0);var events={'afterCreate':_0xfec5('0x4'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x1f5c1c){return function(_0x5b4c5e,_0x4f111b,_0x448658){ChatMessageEvents[_0xfec5('0x5')](_0x1f5c1c+':'+_0x5b4c5e['id'],_0x5b4c5e);ChatMessageEvents[_0xfec5('0x5')](_0x1f5c1c,_0x5b4c5e);_0x448658(null);};}for(var e in events){if(events[_0xfec5('0x6')](e)){var event=events[e];ChatMessage['hook'](e,emitEvent(event));}}module['exports']=ChatMessageEvents; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.model.js b/server/api/chatMessage/chatMessage.model.js index a9a8cb7..de2ccfd 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 _0xe81d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','ChatMessage','chat_messages','fti_chat_messages','body','models','toLowerCase','direction','out','isNil','findOne','ChatInteractionId','then','update','createdAt','catch','error','utf8mb4'];(function(_0x2c3370,_0x36b5f5){var _0x209bb5=function(_0x109922){while(--_0x109922){_0x2c3370['push'](_0x2c3370['shift']());}};_0x209bb5(++_0x36b5f5);}(_0xe81d,0xc4));var _0xde81=function(_0x444196,_0x5659c7){_0x444196=_0x444196-0x0;var _0x49e3b1=_0xe81d[_0x444196];return _0x49e3b1;};'use strict';var _=require(_0xde81('0x0'));var util=require(_0xde81('0x1'));var logger=require(_0xde81('0x2'))(_0xde81('0x3'));var moment=require(_0xde81('0x4'));var BPromise=require(_0xde81('0x5'));var rp=require(_0xde81('0x6'));var fs=require('fs');var path=require(_0xde81('0x7'));var rimraf=require(_0xde81('0x8'));var config=require('../../config/environment');var attributes=require('./chatMessage.attributes');module[_0xde81('0x9')]=function(_0x29bb24,_0x4b9051){return _0x29bb24[_0xde81('0xa')](_0xde81('0xb'),attributes,{'tableName':_0xde81('0xc'),'paranoid':![],'indexes':[{'name':_0xde81('0xd'),'fields':[_0xde81('0xe')],'type':'FULLTEXT'}],'timestamps':!![],'hooks':{'afterCreate':function(_0x11fe4d,_0x585b32,_0x4186b9){var _0x118eff=_0x29bb24[_0xde81('0xf')];var _0x4074ef=_0x11fe4d['get']({'plain':!![]});if(_0x4074ef['direction'][_0xde81('0x10')]()==='in'||_0x4074ef[_0xde81('0x11')][_0xde81('0x10')]()===_0xde81('0x12')&&!_0x4074ef['secret']&&!_[_0xde81('0x13')](_0x4074ef['UserId'])){_0x118eff['ChatInteraction'][_0xde81('0x14')]({'where':{'id':_0x4074ef[_0xde81('0x15')]}})[_0xde81('0x16')](function(_0x4df5ca){if(_0x4df5ca){_0x4df5ca[_0xde81('0x17')]({'lastMsgAt':_0x4074ef[_0xde81('0x18')],'lastMsgDirection':_0x4074ef[_0xde81('0x11')]['toLowerCase']()});}})[_0xde81('0x19')](function(_0x2fe19d){console[_0xde81('0x1a')](_0x2fe19d);});}_0x4186b9();}},'charset':_0xde81('0x1b'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x1f36=['UserId','ChatInteraction','ChatInteractionId','update','catch','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./chatMessage.attributes','exports','ChatMessage','chat_messages','fti_chat_messages','body','FULLTEXT','models','get','direction','out','secret'];(function(_0x4e5552,_0x19ec4e){var _0x60a338=function(_0x40c70e){while(--_0x40c70e){_0x4e5552['push'](_0x4e5552['shift']());}};_0x60a338(++_0x19ec4e);}(_0x1f36,0x1ed));var _0x61f3=function(_0xc07e77,_0x131f5f){_0xc07e77=_0xc07e77-0x0;var _0x8a489e=_0x1f36[_0xc07e77];return _0x8a489e;};'use strict';var _=require(_0x61f3('0x0'));var util=require(_0x61f3('0x1'));var logger=require(_0x61f3('0x2'))(_0x61f3('0x3'));var moment=require('moment');var BPromise=require(_0x61f3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x61f3('0x5'));var rimraf=require(_0x61f3('0x6'));var config=require(_0x61f3('0x7'));var attributes=require(_0x61f3('0x8'));module[_0x61f3('0x9')]=function(_0x12c372,_0x72af3d){return _0x12c372['define'](_0x61f3('0xa'),attributes,{'tableName':_0x61f3('0xb'),'paranoid':![],'indexes':[{'name':_0x61f3('0xc'),'fields':[_0x61f3('0xd')],'type':_0x61f3('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x3e184d,_0x3e7987,_0x51f786){var _0x1dba23=_0x12c372[_0x61f3('0xf')];var _0x14b24e=_0x3e184d[_0x61f3('0x10')]({'plain':!![]});if(_0x14b24e[_0x61f3('0x11')]['toLowerCase']()==='in'||_0x14b24e[_0x61f3('0x11')]['toLowerCase']()===_0x61f3('0x12')&&!_0x14b24e[_0x61f3('0x13')]&&!_['isNil'](_0x14b24e[_0x61f3('0x14')])){_0x1dba23[_0x61f3('0x15')]['findOne']({'where':{'id':_0x14b24e[_0x61f3('0x16')]}})['then'](function(_0x42c8b4){if(_0x42c8b4){_0x42c8b4[_0x61f3('0x17')]({'lastMsgAt':_0x14b24e['createdAt'],'lastMsgDirection':_0x14b24e[_0x61f3('0x11')]['toLowerCase']()});}})[_0x61f3('0x18')](function(_0x222d54){console[_0x61f3('0x19')](_0x222d54);});}_0x51f786();}},'charset':'utf8mb4','collate':_0x61f3('0x1a')});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.rpc.js b/server/api/chatMessage/chatMessage.rpc.js index 3f2776d..64cec23 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 _0x95a8=['lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','register','request','info','ChatMessage,\x20%s,\x20%s','debug','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','catch','ChatMessage','create','body','options','then','CreateChatMessage'];(function(_0x2148d3,_0x30176c){var _0x5c1de7=function(_0x137fef){while(--_0x137fef){_0x2148d3['push'](_0x2148d3['shift']());}};_0x5c1de7(++_0x30176c);}(_0x95a8,0x1dc));var _0x895a=function(_0x123f6c,_0x3e34bc){_0x123f6c=_0x123f6c-0x0;var _0x1a35d0=_0x95a8[_0x123f6c];return _0x1a35d0;};'use strict';var _=require(_0x895a('0x0'));var util=require('util');var moment=require(_0x895a('0x1'));var BPromise=require('bluebird');var rs=require(_0x895a('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x895a('0x3'))['db'];var utils=require(_0x895a('0x4'));var logger=require(_0x895a('0x5'))(_0x895a('0x6'));var config=require(_0x895a('0x7'));var jayson=require(_0x895a('0x8'));var client=jayson[_0x895a('0x9')][_0x895a('0xa')]({'port':0x232a});config['redis']=_[_0x895a('0xb')](config[_0x895a('0xc')],{'host':_0x895a('0xd'),'port':0x18eb});var socket=require(_0x895a('0xe'))(new Redis(config[_0x895a('0xc')]));require(_0x895a('0xf'))[_0x895a('0x10')](socket);function respondWithRpcPromise(_0x3d049e,_0x2d712b,_0x525965){return new BPromise(function(_0x4e15f3,_0xf82301){return client[_0x895a('0x11')](_0x3d049e,_0x525965)['then'](function(_0x336662){logger[_0x895a('0x12')](_0x895a('0x13'),_0x2d712b,'request\x20sent');logger[_0x895a('0x14')](_0x895a('0x15'),_0x2d712b,'request\x20sent',JSON[_0x895a('0x16')](_0x336662));if(_0x336662['error']){if(_0x336662['error']['code']===0x1f4){logger[_0x895a('0x17')]('ChatMessage,\x20%s,\x20%s',_0x2d712b,_0x336662[_0x895a('0x17')][_0x895a('0x18')]);return _0xf82301(_0x336662['error'][_0x895a('0x18')]);}logger['error'](_0x895a('0x13'),_0x2d712b,_0x336662[_0x895a('0x17')][_0x895a('0x18')]);return _0x4e15f3(_0x336662[_0x895a('0x17')]['message']);}else{logger[_0x895a('0x12')]('ChatMessage,\x20%s,\x20%s',_0x2d712b,_0x895a('0x19'));_0x4e15f3(_0x336662[_0x895a('0x1a')][_0x895a('0x18')]);}})[_0x895a('0x1b')](function(_0x15c196){logger[_0x895a('0x17')]('ChatMessage,\x20%s,\x20%s',_0x2d712b,_0x15c196);_0xf82301(_0x15c196);});});}exports['CreateChatMessage']=function(_0x4198f4){var _0x38726c=this;return new Promise(function(_0x360604,_0x13ce10){return db[_0x895a('0x1c')][_0x895a('0x1d')](_0x4198f4[_0x895a('0x1e')],{'raw':_0x4198f4['options']?_0x4198f4[_0x895a('0x1f')]['raw']===undefined?!![]:![]:!![]})[_0x895a('0x20')](function(_0x342d07){logger[_0x895a('0x12')](_0x895a('0x21'),_0x4198f4);logger[_0x895a('0x14')](_0x895a('0x21'),_0x4198f4,JSON['stringify'](_0x342d07));_0x360604(_0x342d07);})[_0x895a('0x1b')](function(_0x20cbfa){logger[_0x895a('0x17')](_0x895a('0x21'),_0x20cbfa[_0x895a('0x18')],_0x4198f4);_0x13ce10(_0x38726c[_0x895a('0x17')](0x1f4,_0x20cbfa['message']));});});}; \ No newline at end of file +var _0xd89d=['result','catch','ChatMessage','create','body','options','CreateChatMessage','debug','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','defaults','redis','localhost','socket.io-emitter','./chatMessage.socket','request','then','info','ChatMessage,\x20%s,\x20%s','request\x20sent','ChatMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x37c172,_0x201798){var _0x48f0f8=function(_0x9d6780){while(--_0x9d6780){_0x37c172['push'](_0x37c172['shift']());}};_0x48f0f8(++_0x201798);}(_0xd89d,0xce));var _0xdd89=function(_0x4b7898,_0x2eae9a){_0x4b7898=_0x4b7898-0x0;var _0x38fc2e=_0xd89d[_0x4b7898];return _0x38fc2e;};'use strict';var _=require(_0xdd89('0x0'));var util=require('util');var moment=require(_0xdd89('0x1'));var BPromise=require(_0xdd89('0x2'));var rs=require(_0xdd89('0x3'));var fs=require('fs');var Redis=require(_0xdd89('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xdd89('0x5'));var logger=require('../../config/logger')(_0xdd89('0x6'));var config=require(_0xdd89('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xdd89('0x8')][_0xdd89('0x9')]({'port':0x232a});config['redis']=_[_0xdd89('0xa')](config[_0xdd89('0xb')],{'host':_0xdd89('0xc'),'port':0x18eb});var socket=require(_0xdd89('0xd'))(new Redis(config[_0xdd89('0xb')]));require(_0xdd89('0xe'))['register'](socket);function respondWithRpcPromise(_0x306d11,_0x5554e6,_0x187021){return new BPromise(function(_0xe1e2af,_0x3bdb4c){return client[_0xdd89('0xf')](_0x306d11,_0x187021)[_0xdd89('0x10')](function(_0x13fb3c){logger[_0xdd89('0x11')](_0xdd89('0x12'),_0x5554e6,_0xdd89('0x13'));logger['debug'](_0xdd89('0x14'),_0x5554e6,_0xdd89('0x13'),JSON[_0xdd89('0x15')](_0x13fb3c));if(_0x13fb3c[_0xdd89('0x16')]){if(_0x13fb3c[_0xdd89('0x16')][_0xdd89('0x17')]===0x1f4){logger[_0xdd89('0x16')](_0xdd89('0x12'),_0x5554e6,_0x13fb3c['error'][_0xdd89('0x18')]);return _0x3bdb4c(_0x13fb3c[_0xdd89('0x16')][_0xdd89('0x18')]);}logger[_0xdd89('0x16')]('ChatMessage,\x20%s,\x20%s',_0x5554e6,_0x13fb3c['error']['message']);return _0xe1e2af(_0x13fb3c[_0xdd89('0x16')][_0xdd89('0x18')]);}else{logger[_0xdd89('0x11')]('ChatMessage,\x20%s,\x20%s',_0x5554e6,_0xdd89('0x13'));_0xe1e2af(_0x13fb3c[_0xdd89('0x19')]['message']);}})[_0xdd89('0x1a')](function(_0x13d96f){logger[_0xdd89('0x16')]('ChatMessage,\x20%s,\x20%s',_0x5554e6,_0x13d96f);_0x3bdb4c(_0x13d96f);});});}exports['CreateChatMessage']=function(_0x126117){var _0x23a002=this;return new Promise(function(_0x13c0db,_0x578260){return db[_0xdd89('0x1b')][_0xdd89('0x1c')](_0x126117[_0xdd89('0x1d')],{'raw':_0x126117[_0xdd89('0x1e')]?_0x126117[_0xdd89('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0xdd89('0x10')](function(_0x49b0d6){logger[_0xdd89('0x11')](_0xdd89('0x1f'),_0x126117);logger[_0xdd89('0x20')](_0xdd89('0x1f'),_0x126117,JSON[_0xdd89('0x15')](_0x49b0d6));_0x13c0db(_0x49b0d6);})['catch'](function(_0x57f496){logger[_0xdd89('0x16')](_0xdd89('0x1f'),_0x57f496[_0xdd89('0x18')],_0x126117);_0x578260(_0x23a002[_0xdd89('0x16')](0x1f4,_0x57f496[_0xdd89('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/chatMessage/chatMessage.socket.js b/server/api/chatMessage/chatMessage.socket.js index 5e960cf..fe7f570 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 _0x46ed=['./chatMessage.events','save','update','emit','removeListener','register','length','chatMessage:'];(function(_0x19d828,_0x2439ce){var _0x25b133=function(_0x5214a8){while(--_0x5214a8){_0x19d828['push'](_0x19d828['shift']());}};_0x25b133(++_0x2439ce);}(_0x46ed,0x168));var _0xd46e=function(_0x4ae6ef,_0xc2af80){_0x4ae6ef=_0x4ae6ef-0x0;var _0x3cbb4e=_0x46ed[_0x4ae6ef];return _0x3cbb4e;};'use strict';var ChatMessageEvents=require(_0xd46e('0x0'));var events=[_0xd46e('0x1'),'remove',_0xd46e('0x2')];function createListener(_0x1df30e,_0x1f15e7){return function(_0x537ad5){_0x1f15e7[_0xd46e('0x3')](_0x1df30e,_0x537ad5);};}function removeListener(_0x4518b8,_0x54ef98){return function(){ChatMessageEvents[_0xd46e('0x4')](_0x4518b8,_0x54ef98);};}exports[_0xd46e('0x5')]=function(_0x160bcf){for(var _0x25cf78=0x0,_0x45e680=events[_0xd46e('0x6')];_0x25cf78<_0x45e680;_0x25cf78++){var _0x437ea0=events[_0x25cf78];var _0x144687=createListener(_0xd46e('0x7')+_0x437ea0,_0x160bcf);ChatMessageEvents['on'](_0x437ea0,_0x144687);}}; \ No newline at end of file +var _0x9d92=['update','emit','removeListener','register','length','chatMessage:','./chatMessage.events'];(function(_0x457712,_0x1f9a75){var _0x21f9bd=function(_0x2fad00){while(--_0x2fad00){_0x457712['push'](_0x457712['shift']());}};_0x21f9bd(++_0x1f9a75);}(_0x9d92,0xdf));var _0x29d9=function(_0x4ffa64,_0x271035){_0x4ffa64=_0x4ffa64-0x0;var _0x5da001=_0x9d92[_0x4ffa64];return _0x5da001;};'use strict';var ChatMessageEvents=require(_0x29d9('0x0'));var events=['save','remove',_0x29d9('0x1')];function createListener(_0x3d33ba,_0x48fe57){return function(_0x3dbd9e){_0x48fe57[_0x29d9('0x2')](_0x3d33ba,_0x3dbd9e);};}function removeListener(_0x18371b,_0x6e12eb){return function(){ChatMessageEvents[_0x29d9('0x3')](_0x18371b,_0x6e12eb);};}exports[_0x29d9('0x4')]=function(_0x27d032){for(var _0x52932b=0x0,_0x209595=events[_0x29d9('0x5')];_0x52932b<_0x209595;_0x52932b++){var _0x392265=events[_0x52932b];var _0x5aeb53=createListener(_0x29d9('0x6')+_0x392265,_0x27d032);ChatMessageEvents['on'](_0x392265,_0x5aeb53);}}; \ No newline at end of file diff --git a/server/api/chatMessage/index.js b/server/api/chatMessage/index.js index ba3e6b8..03e8f4d 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 _0x7186=['get','index','isAuthenticated','describe','show','post','tracked','chat','chatmessage:create','put','update','/:id/accept','/:id/reject','reject','delete','/:id','exports','multer','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller'];(function(_0x2b98ee,_0x29387b){var _0x3de098=function(_0x25e6c5){while(--_0x25e6c5){_0x2b98ee['push'](_0x2b98ee['shift']());}};_0x3de098(++_0x29387b);}(_0x7186,0xa1));var _0x6718=function(_0x4eeb7d,_0x3bdc50){_0x4eeb7d=_0x4eeb7d-0x0;var _0x4f1b1c=_0x7186[_0x4eeb7d];return _0x4f1b1c;};'use strict';var multer=require(_0x6718('0x0'));var util=require('util');var path=require(_0x6718('0x1'));var timeout=require(_0x6718('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6718('0x3'));var interaction=require(_0x6718('0x4'));var config=require(_0x6718('0x5'));var controller=require(_0x6718('0x6'));router[_0x6718('0x7')]('/',auth['isAuthenticated'](),controller[_0x6718('0x8')]);router[_0x6718('0x7')]('/describe',auth[_0x6718('0x9')](),controller[_0x6718('0xa')]);router['get']('/:id',auth[_0x6718('0x9')](),controller[_0x6718('0xb')]);router[_0x6718('0xc')]('/',auth[_0x6718('0x9')](),interaction[_0x6718('0xd')](_0x6718('0xe'),_0x6718('0xf')),controller['create']);router[_0x6718('0x10')]('/:id',controller[_0x6718('0x11')]);router[_0x6718('0x10')](_0x6718('0x12'),auth['isAuthenticated'](),controller['accept']);router[_0x6718('0x10')](_0x6718('0x13'),auth[_0x6718('0x9')](),controller[_0x6718('0x14')]);router[_0x6718('0x15')](_0x6718('0x16'),auth[_0x6718('0x9')](),controller['destroy']);module[_0x6718('0x17')]=router; \ No newline at end of file +var _0xf36c=['/:id','update','/:id/accept','/:id/reject','reject','destroy','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatMessage.controller','get','isAuthenticated','/describe','describe','show','post','tracked','chat','chatmessage:create','put'];(function(_0x331d53,_0x543db0){var _0x1a6f98=function(_0x3cd123){while(--_0x3cd123){_0x331d53['push'](_0x331d53['shift']());}};_0x1a6f98(++_0x543db0);}(_0xf36c,0xd5));var _0xcf36=function(_0x3393a8,_0x88c1cd){_0x3393a8=_0x3393a8-0x0;var _0x42a50a=_0xf36c[_0x3393a8];return _0x42a50a;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xcf36('0x0'));var express=require('express');var router=express[_0xcf36('0x1')]();var fs_extra=require(_0xcf36('0x2'));var auth=require(_0xcf36('0x3'));var interaction=require(_0xcf36('0x4'));var config=require(_0xcf36('0x5'));var controller=require(_0xcf36('0x6'));router[_0xcf36('0x7')]('/',auth[_0xcf36('0x8')](),controller['index']);router[_0xcf36('0x7')](_0xcf36('0x9'),auth[_0xcf36('0x8')](),controller[_0xcf36('0xa')]);router[_0xcf36('0x7')]('/:id',auth['isAuthenticated'](),controller[_0xcf36('0xb')]);router[_0xcf36('0xc')]('/',auth['isAuthenticated'](),interaction[_0xcf36('0xd')](_0xcf36('0xe'),_0xcf36('0xf')),controller['create']);router[_0xcf36('0x10')](_0xcf36('0x11'),controller[_0xcf36('0x12')]);router[_0xcf36('0x10')](_0xcf36('0x13'),auth['isAuthenticated'](),controller['accept']);router[_0xcf36('0x10')](_0xcf36('0x14'),auth['isAuthenticated'](),controller[_0xcf36('0x15')]);router['delete']('/:id',auth[_0xcf36('0x8')](),controller[_0xcf36('0x16')]);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 49b8a31..a6029c9 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['medium','sequelize','TEXT'];(function(_0x1e38c0,_0x213478){var _0x14415e=function(_0x385329){while(--_0x385329){_0x1e38c0['push'](_0x1e38c0['shift']());}};_0x14415e(++_0x213478);}(_0xb10b,0x12a));var _0xbb10=function(_0x2697d9,_0x26806a){_0x2697d9=_0x2697d9-0x0;var _0x25e6ae=_0xb10b[_0x2697d9];return _0x25e6ae;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'body':{'type':Sequelize[_0xbb10('0x1')](_0xbb10('0x2')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xbb10('0x1')]('medium'),'allowNull':![]}}; \ No newline at end of file +var _0x5f2f=['exports','TEXT','medium','sequelize'];(function(_0x503aff,_0x96d567){var _0x5be37d=function(_0xe68e0b){while(--_0xe68e0b){_0x503aff['push'](_0x503aff['shift']());}};_0x5be37d(++_0x96d567);}(_0x5f2f,0x73));var _0xf5f2=function(_0x47b038,_0x1b0295){_0x47b038=_0x47b038-0x0;var _0xf5a7f1=_0x5f2f[_0x47b038];return _0xf5a7f1;};'use strict';var Sequelize=require(_0xf5f2('0x0'));module[_0xf5f2('0x1')]={'body':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0xf5f2('0x2')](_0xf5f2('0x3')),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js index 48ccbe8..efae7ce 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.controller.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x5b8cdc,_0x5373b1){var _0x29a185=function(_0x351044){while(--_0x351044){_0x5b8cdc['push'](_0x5b8cdc['shift']());}};_0x29a185(++_0x5373b1);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file +var _0x9957=['sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filter','merge','VIRTUAL','options','ChatOfflineMessage','findAll','rows','show','rawAttributes','includeAll','include','find','create','catch','body','params','Attachment','forEach','join','root','server','files','attachments','basename','existsSync','remove','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb'];(function(_0x3a301d,_0x2e751f){var _0x1f8298=function(_0xf0c31e){while(--_0xf0c31e){_0x3a301d['push'](_0x3a301d['shift']());}};_0x1f8298(++_0x2e751f);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){var _0x514445={},_0x456a28={},_0x3250e0={'count':0x0,'rows':[]};var _0x4253e5=_['map'](db['ChatOfflineMessage']['rawAttributes'],function(_0x3573be){return{'name':_0x3573be[_0x7995('0x2c')],'type':_0x3573be[_0x7995('0x2d')][_0x7995('0x2e')]};});_0x456a28[_0x7995('0x2f')]=_[_0x7995('0x30')](_0x4253e5,'name');_0x456a28['query']=_[_0x7995('0x31')](_0x4b6f99['query']);_0x456a28[_0x7995('0x32')]=_[_0x7995('0x33')](_0x456a28[_0x7995('0x2f')],_0x456a28[_0x7995('0x34')]);_0x514445[_0x7995('0x35')]=_['intersection'](_0x456a28[_0x7995('0x2f')],qs[_0x7995('0x36')](_0x4b6f99['query']['fields']));_0x514445['attributes']=_0x514445[_0x7995('0x35')][_0x7995('0x37')]?_0x514445['attributes']:_0x456a28[_0x7995('0x2f')];if(!_0x4b6f99['query'][_0x7995('0x38')](_0x7995('0x39'))){_0x514445[_0x7995('0x21')]=qs['limit'](_0x4b6f99['query'][_0x7995('0x21')]);_0x514445['offset']=qs['offset'](_0x4b6f99[_0x7995('0x34')][_0x7995('0x20')]);}_0x514445['order']=qs[_0x7995('0x3a')](_0x4b6f99[_0x7995('0x34')][_0x7995('0x3a')]);_0x514445[_0x7995('0x3b')]=qs[_0x7995('0x32')](_['pick'](_0x4b6f99[_0x7995('0x34')],_0x456a28[_0x7995('0x32')]),_0x4253e5);if(_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]){_0x514445['where']=_[_0x7995('0x3d')](_0x514445[_0x7995('0x3b')],{'$or':_[_0x7995('0x30')](_0x4253e5,function(_0xe5ea43){if(_0xe5ea43[_0x7995('0x2d')]!==_0x7995('0x3e')){var _0x5688a1={};_0x5688a1[_0xe5ea43[_0x7995('0x29')]]={'$like':'%'+_0x4b6f99[_0x7995('0x34')][_0x7995('0x3c')]+'%'};return _0x5688a1;}})});}_0x514445=_[_0x7995('0x3d')]({},_0x514445,_0x4b6f99[_0x7995('0x3f')]);var _0x298fc2={'where':_0x514445[_0x7995('0x3b')]};return db[_0x7995('0x40')][_0x7995('0x1f')](_0x298fc2)[_0x7995('0x26')](function(_0x6fe77b){_0x3250e0[_0x7995('0x1f')]=_0x6fe77b;if(_0x4b6f99[_0x7995('0x34')]['includeAll']){_0x514445['include']=[{'all':!![]}];}return db[_0x7995('0x40')][_0x7995('0x41')](_0x514445);})['then'](function(_0x4b0855){_0x3250e0[_0x7995('0x42')]=_0x4b0855;return _0x3250e0;})['then'](respondWithFilteredResult(_0x9b2a15,_0x514445))['catch'](handleError(_0x9b2a15,null));};exports[_0x7995('0x43')]=function(_0x36e28b,_0x35c8ff){var _0x576b96={'raw':!![],'where':{'id':_0x36e28b['params']['id']}},_0x46ac4f={};_0x46ac4f[_0x7995('0x2f')]=_['keys'](db['ChatOfflineMessage'][_0x7995('0x44')]);_0x46ac4f[_0x7995('0x34')]=_[_0x7995('0x31')](_0x36e28b[_0x7995('0x34')]);_0x46ac4f['filters']=_[_0x7995('0x33')](_0x46ac4f[_0x7995('0x2f')],_0x46ac4f[_0x7995('0x34')]);_0x576b96[_0x7995('0x35')]=_['intersection'](_0x46ac4f['model'],qs[_0x7995('0x36')](_0x36e28b['query'][_0x7995('0x36')]));_0x576b96['attributes']=_0x576b96[_0x7995('0x35')]['length']?_0x576b96[_0x7995('0x35')]:_0x46ac4f[_0x7995('0x2f')];if(_0x36e28b['query'][_0x7995('0x45')]){_0x576b96[_0x7995('0x46')]=[{'all':!![]}];}_0x576b96=_[_0x7995('0x3d')]({},_0x576b96,_0x36e28b[_0x7995('0x3f')]);return db['ChatOfflineMessage'][_0x7995('0x47')](_0x576b96)[_0x7995('0x26')](handleEntityNotFound(_0x35c8ff,null))[_0x7995('0x26')](respondWithResult(_0x35c8ff,null))['catch'](handleError(_0x35c8ff,null));};exports[_0x7995('0x48')]=function(_0x44f516,_0x511567){return db[_0x7995('0x40')][_0x7995('0x48')](_0x44f516['body'],{})[_0x7995('0x26')](respondWithResult(_0x511567,0xc9))[_0x7995('0x49')](handleError(_0x511567,null));};exports['update']=function(_0x3d1dbb,_0x5843ba){if(_0x3d1dbb[_0x7995('0x4a')]['id']){delete _0x3d1dbb[_0x7995('0x4a')]['id'];}return db[_0x7995('0x40')][_0x7995('0x47')]({'where':{'id':_0x3d1dbb[_0x7995('0x4b')]['id']}})[_0x7995('0x26')](handleEntityNotFound(_0x5843ba,null))[_0x7995('0x26')](saveUpdates(_0x3d1dbb['body'],null))[_0x7995('0x26')](respondWithResult(_0x5843ba,null))[_0x7995('0x49')](handleError(_0x5843ba,null));};exports[_0x7995('0x27')]=function(_0x4ffc8a,_0x19da63){return db[_0x7995('0x4c')][_0x7995('0x41')]({'where':{'ChatOfflineMessageId':_0x4ffc8a['params']['id']},'raw':!![]})['then'](function(_0x5a592e){_0x5a592e[_0x7995('0x4d')](function(_0x1fd1ca){var _0x4cf5db=path[_0x7995('0x4e')](config[_0x7995('0x4f')],_0x7995('0x50'),_0x7995('0x51'),_0x7995('0x52'),'offline-chat',_0x1fd1ca[_0x7995('0x53')]);var _0x4ab09f=fs[_0x7995('0x54')](_0x4cf5db);if(_0x4ab09f)fs_extra[_0x7995('0x55')](_0x4cf5db);});})[_0x7995('0x26')](function(){return db['ChatOfflineMessage']['find']({'where':{'id':_0x4ffc8a['params']['id']},'individualHooks':!![]});})['then'](handleEntityNotFound(_0x19da63,null))[_0x7995('0x26')](removeEntity(_0x19da63,null))[_0x7995('0x49')](handleError(_0x19da63,null));};exports[_0x7995('0x56')]=function(_0x150261,_0x1d957e){return db[_0x7995('0x40')][_0x7995('0x56')]()[_0x7995('0x26')](respondWithResult(_0x1d957e,null))[_0x7995('0x49')](handleError(_0x1d957e,null));}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.events.js b/server/api/chatOfflineMessage/chatOfflineMessage.events.js index 992f939..11ee921 100644 --- a/server/api/chatOfflineMessage/chatOfflineMessage.events.js +++ b/server/api/chatOfflineMessage/chatOfflineMessage.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xee55=['events','ChatOfflineMessage','save','remove','emit','hasOwnProperty','hook','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xee55,0x1a0));var _0x5ee5=function(_0x20cc29,_0x30a46d){_0x20cc29=_0x20cc29-0x0;var _0x28d513=_0xee55[_0x20cc29];return _0x28d513;};'use strict';var EventEmitter=require(_0x5ee5('0x0'));var ChatOfflineMessage=require('../../mysqldb')['db'][_0x5ee5('0x1')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5ee5('0x2'),'afterUpdate':'update','afterDestroy':_0x5ee5('0x3')};function emitEvent(_0x2fc0fd){return function(_0x4e5f9b,_0x394334,_0x119392){ChatOfflineMessageEvents[_0x5ee5('0x4')](_0x2fc0fd+':'+_0x4e5f9b['id'],_0x4e5f9b);ChatOfflineMessageEvents[_0x5ee5('0x4')](_0x2fc0fd,_0x4e5f9b);_0x119392(null);};}for(var e in events){if(events[_0x5ee5('0x5')](e)){var event=events[e];ChatOfflineMessage[_0x5ee5('0x6')](e,emitEvent(event));}}module[_0x5ee5('0x7')]=ChatOfflineMessageEvents; \ No newline at end of file +var _0xbcf1=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','ChatOfflineMessage'];(function(_0x14f6fa,_0x44743d){var _0x2c62a5=function(_0x398da0){while(--_0x398da0){_0x14f6fa['push'](_0x14f6fa['shift']());}};_0x2c62a5(++_0x44743d);}(_0xbcf1,0x18d));var _0x1bcf=function(_0x1d70db,_0x142b63){_0x1d70db=_0x1d70db-0x0;var _0x3060c6=_0xbcf1[_0x1d70db];return _0x3060c6;};'use strict';var EventEmitter=require(_0x1bcf('0x0'));var ChatOfflineMessage=require(_0x1bcf('0x1'))['db'][_0x1bcf('0x2')];var ChatOfflineMessageEvents=new EventEmitter();ChatOfflineMessageEvents[_0x1bcf('0x3')](0x0);var events={'afterCreate':_0x1bcf('0x4'),'afterUpdate':_0x1bcf('0x5'),'afterDestroy':'remove'};function emitEvent(_0x26993a){return function(_0x2923bd,_0x526daf,_0x52a65e){ChatOfflineMessageEvents[_0x1bcf('0x6')](_0x26993a+':'+_0x2923bd['id'],_0x2923bd);ChatOfflineMessageEvents[_0x1bcf('0x6')](_0x26993a,_0x2923bd);_0x52a65e(null);};}for(var e in events){if(events[_0x1bcf('0x7')](e)){var event=events[e];ChatOfflineMessage[_0x1bcf('0x8')](e,emitEvent(event));}}module[_0x1bcf('0x9')]=ChatOfflineMessageEvents; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.model.js b/server/api/chatOfflineMessage/chatOfflineMessage.model.js index 7c9036a..35b23fc 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 _0x7731=['chat_offline_messages','./chatOfflineMessage.attributes','define','ChatOfflineMessage'];(function(_0x305a94,_0xa1ba1e){var _0x3b0b5a=function(_0x1bd1a0){while(--_0x1bd1a0){_0x305a94['push'](_0x305a94['shift']());}};_0x3b0b5a(++_0xa1ba1e);}(_0x7731,0x199));var _0x1773=function(_0x5662f2,_0x550cb0){_0x5662f2=_0x5662f2-0x0;var _0x2469f5=_0x7731[_0x5662f2];return _0x2469f5;};'use strict';var attributes=require(_0x1773('0x0'));module['exports']=function(_0x43f726){return _0x43f726[_0x1773('0x1')](_0x1773('0x2'),attributes,{'tableName':_0x1773('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xc4ec=['utf8mb4_unicode_ci','./chatOfflineMessage.attributes','exports','define','utf8mb4'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc4ec,0x88));var _0xcc4e=function(_0x7b5cdd,_0x8c88d8){_0x7b5cdd=_0x7b5cdd-0x0;var _0x3a29ae=_0xc4ec[_0x7b5cdd];return _0x3a29ae;};'use strict';var attributes=require(_0xcc4e('0x0'));module[_0xcc4e('0x1')]=function(_0x1b7c7d){return _0x1b7c7d[_0xcc4e('0x2')]('ChatOfflineMessage',attributes,{'tableName':'chat_offline_messages','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xcc4e('0x3'),'collate':_0xcc4e('0x4')});}; \ No newline at end of file diff --git a/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js b/server/api/chatOfflineMessage/chatOfflineMessage.rpc.js index c7481b7..8c7cffa 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 _0xaeff=['code','message','error','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x3d6e20,_0x121fa5){var _0x118138=function(_0x476504){while(--_0x476504){_0x3d6e20['push'](_0x3d6e20['shift']());}};_0x118138(++_0x121fa5);}(_0xaeff,0xea));var _0xfaef=function(_0x3f7692,_0x4ab6fa){_0x3f7692=_0x3f7692-0x0;var _0x24dd38=_0xaeff[_0x3f7692];return _0x24dd38;};'use strict';var _=require(_0xfaef('0x0'));var util=require(_0xfaef('0x1'));var moment=require(_0xfaef('0x2'));var BPromise=require(_0xfaef('0x3'));var rs=require(_0xfaef('0x4'));var fs=require('fs');var Redis=require(_0xfaef('0x5'));var db=require(_0xfaef('0x6'))['db'];var utils=require(_0xfaef('0x7'));var logger=require('../../config/logger')(_0xfaef('0x8'));var config=require('../../config/environment');var jayson=require(_0xfaef('0x9'));var client=jayson[_0xfaef('0xa')][_0xfaef('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b5dca,_0x20f62a,_0x5626c0){return new BPromise(function(_0x4e76eb,_0x397223){return client[_0xfaef('0xc')](_0x4b5dca,_0x5626c0)[_0xfaef('0xd')](function(_0x1c6086){logger[_0xfaef('0xe')](_0xfaef('0xf'),_0x20f62a,_0xfaef('0x10'));logger['debug'](_0xfaef('0x11'),_0x20f62a,_0xfaef('0x10'),JSON[_0xfaef('0x12')](_0x1c6086));if(_0x1c6086['error']){if(_0x1c6086['error'][_0xfaef('0x13')]===0x1f4){logger['error']('ChatOfflineMessage,\x20%s,\x20%s',_0x20f62a,_0x1c6086['error'][_0xfaef('0x14')]);return _0x397223(_0x1c6086['error'][_0xfaef('0x14')]);}logger[_0xfaef('0x15')](_0xfaef('0xf'),_0x20f62a,_0x1c6086[_0xfaef('0x15')]['message']);return _0x4e76eb(_0x1c6086['error'][_0xfaef('0x14')]);}else{logger['info'](_0xfaef('0xf'),_0x20f62a,_0xfaef('0x10'));_0x4e76eb(_0x1c6086['result'][_0xfaef('0x14')]);}})[_0xfaef('0x16')](function(_0x5e758d){logger['error'](_0xfaef('0xf'),_0x20f62a,_0x5e758d);_0x397223(_0x5e758d);});});} \ No newline at end of file +var _0xe5ef=['util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','http','request','ChatOfflineMessage,\x20%s,\x20%s','request\x20sent','ChatOfflineMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash'];(function(_0x17931e,_0x57738a){var _0xd23227=function(_0x3d6be9){while(--_0x3d6be9){_0x17931e['push'](_0x17931e['shift']());}};_0xd23227(++_0x57738a);}(_0xe5ef,0x13a));var _0xfe5e=function(_0x266888,_0x46ac0a){_0x266888=_0x266888-0x0;var _0x5427d5=_0xe5ef[_0x266888];return _0x5427d5;};'use strict';var _=require(_0xfe5e('0x0'));var util=require(_0xfe5e('0x1'));var moment=require(_0xfe5e('0x2'));var BPromise=require(_0xfe5e('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfe5e('0x4'));var db=require(_0xfe5e('0x5'))['db'];var utils=require(_0xfe5e('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0xfe5e('0x7'));var jayson=require(_0xfe5e('0x8'));var client=jayson['client'][_0xfe5e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd0aaac,_0x5f45ef,_0x4ff9a3){return new BPromise(function(_0x3beff4,_0x182ce3){return client[_0xfe5e('0xa')](_0xd0aaac,_0x4ff9a3)['then'](function(_0x3dc0e3){logger['info'](_0xfe5e('0xb'),_0x5f45ef,_0xfe5e('0xc'));logger['debug'](_0xfe5e('0xd'),_0x5f45ef,_0xfe5e('0xc'),JSON[_0xfe5e('0xe')](_0x3dc0e3));if(_0x3dc0e3[_0xfe5e('0xf')]){if(_0x3dc0e3[_0xfe5e('0xf')][_0xfe5e('0x10')]===0x1f4){logger[_0xfe5e('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5f45ef,_0x3dc0e3[_0xfe5e('0xf')][_0xfe5e('0x11')]);return _0x182ce3(_0x3dc0e3[_0xfe5e('0xf')][_0xfe5e('0x11')]);}logger[_0xfe5e('0xf')](_0xfe5e('0xb'),_0x5f45ef,_0x3dc0e3[_0xfe5e('0xf')][_0xfe5e('0x11')]);return _0x3beff4(_0x3dc0e3[_0xfe5e('0xf')]['message']);}else{logger[_0xfe5e('0x12')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5f45ef,'request\x20sent');_0x3beff4(_0x3dc0e3[_0xfe5e('0x13')][_0xfe5e('0x11')]);}})[_0xfe5e('0x14')](function(_0x5c0fe5){logger[_0xfe5e('0xf')]('ChatOfflineMessage,\x20%s,\x20%s',_0x5f45ef,_0x5c0fe5);_0x182ce3(_0x5c0fe5);});});} \ No newline at end of file diff --git a/server/api/chatOfflineMessage/index.js b/server/api/chatOfflineMessage/index.js index c04a87f..3005470 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 _0x6c2d=['util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatOfflineMessage.controller','index','get','/:id','isAuthenticated','show','post','create','put','delete','destroy','multer'];(function(_0x5cc89b,_0x4b942a){var _0x5dc5a0=function(_0x40b02c){while(--_0x40b02c){_0x5cc89b['push'](_0x5cc89b['shift']());}};_0x5dc5a0(++_0x4b942a);}(_0x6c2d,0x19d));var _0xd6c2=function(_0x36dfbd,_0x5bfe2d){_0x36dfbd=_0x36dfbd-0x0;var _0x4ecad9=_0x6c2d[_0x36dfbd];return _0x4ecad9;};'use strict';var multer=require(_0xd6c2('0x0'));var util=require(_0xd6c2('0x1'));var path=require(_0xd6c2('0x2'));var timeout=require('connect-timeout');var express=require(_0xd6c2('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xd6c2('0x4'));var interaction=require(_0xd6c2('0x5'));var config=require(_0xd6c2('0x6'));var controller=require(_0xd6c2('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0xd6c2('0x8')]);router[_0xd6c2('0x9')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xd6c2('0x9')](_0xd6c2('0xa'),auth[_0xd6c2('0xb')](),controller[_0xd6c2('0xc')]);router[_0xd6c2('0xd')]('/',auth[_0xd6c2('0xb')](),controller[_0xd6c2('0xe')]);router[_0xd6c2('0xf')](_0xd6c2('0xa'),auth[_0xd6c2('0xb')](),controller['update']);router[_0xd6c2('0x10')](_0xd6c2('0xa'),auth[_0xd6c2('0xb')](),controller[_0xd6c2('0x11')]);module['exports']=router; \ No newline at end of file +var _0xd27e=['put','/:id','delete','destroy','exports','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','/describe','describe','post','create'];(function(_0x266618,_0x18f637){var _0x54dbf5=function(_0x1f7985){while(--_0x1f7985){_0x266618['push'](_0x266618['shift']());}};_0x54dbf5(++_0x18f637);}(_0xd27e,0x105));var _0xed27=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xd27e[_0x17d9e3];return _0x14192d;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xed27('0x0'));var timeout=require('connect-timeout');var express=require(_0xed27('0x1'));var router=express['Router']();var fs_extra=require(_0xed27('0x2'));var auth=require(_0xed27('0x3'));var interaction=require(_0xed27('0x4'));var config=require(_0xed27('0x5'));var controller=require('./chatOfflineMessage.controller');router['get']('/',auth[_0xed27('0x6')](),controller['index']);router['get'](_0xed27('0x7'),auth['isAuthenticated'](),controller[_0xed27('0x8')]);router['get']('/:id',auth[_0xed27('0x6')](),controller['show']);router[_0xed27('0x9')]('/',auth[_0xed27('0x6')](),controller[_0xed27('0xa')]);router[_0xed27('0xb')](_0xed27('0xc'),auth[_0xed27('0x6')](),controller['update']);router[_0xed27('0xd')](_0xed27('0xc'),auth['isAuthenticated'](),controller[_0xed27('0xe')]);module[_0xed27('0xf')]=router; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.attributes.js b/server/api/chatProactiveAction/chatProactiveAction.attributes.js index 1b54caa..dd79434 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 _0x3d3a=['ENUM','mouseOver','timeout','sequelize','exports','STRING'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3d3a,0x1b9));var _0xa3d3=function(_0x5dfc1e,_0x164a3f){_0x5dfc1e=_0x5dfc1e-0x0;var _0x3904f6=_0x3d3a[_0x5dfc1e];return _0x3904f6;};'use strict';var Sequelize=require(_0xa3d3('0x0'));module[_0xa3d3('0x1')]={'name':{'type':Sequelize[_0xa3d3('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xa3d3('0x3')](_0xa3d3('0x4'),_0xa3d3('0x5')),'defaultValue':_0xa3d3('0x4')},'selector':{'type':Sequelize[_0xa3d3('0x2')]},'timeout':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xdba1=['timeout','mouseOver','STRING','INTEGER','sequelize','exports','ENUM'];(function(_0x2595a6,_0x48fc45){var _0x460197=function(_0x18f9db){while(--_0x18f9db){_0x2595a6['push'](_0x2595a6['shift']());}};_0x460197(++_0x48fc45);}(_0xdba1,0xe4));var _0x1dba=function(_0x192501,_0xd3e01c){_0x192501=_0x192501-0x0;var _0x1cd198=_0xdba1[_0x192501];return _0x1cd198;};'use strict';var Sequelize=require(_0x1dba('0x0'));module[_0x1dba('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x1dba('0x2')]('mouseOver',_0x1dba('0x3')),'defaultValue':_0x1dba('0x4')},'selector':{'type':Sequelize[_0x1dba('0x5')]},'timeout':{'type':Sequelize[_0x1dba('0x6')]}}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.controller.js b/server/api/chatProactiveAction/chatProactiveAction.controller.js index c258e95..e9d1695 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 _0x7579=['desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','update','then','error','name','show','params','model','keys','ChatProactiveAction','rawAttributes','query','filters','intersection','attributes','fields','length','includeAll','merge','options','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','ejs','fs-extra','lodash','crypto'];(function(_0x52c4e9,_0x5412d0){var _0x252a03=function(_0x57857c){while(--_0x57857c){_0x52c4e9['push'](_0x52c4e9['shift']());}};_0x252a03(++_0x5412d0);}(_0x7579,0x1e2));var _0x9757=function(_0x3660b3,_0x52ad09){_0x3660b3=_0x3660b3-0x0;var _0x497363=_0x7579[_0x3660b3];return _0x497363;};'use strict';var emlformat=require(_0x9757('0x0'));var rimraf=require(_0x9757('0x1'));var zipdir=require(_0x9757('0x2'));var jsonpatch=require(_0x9757('0x3'));var rp=require(_0x9757('0x4'));var moment=require(_0x9757('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9757('0x6'));var util=require(_0x9757('0x7'));var path=require(_0x9757('0x8'));var sox=require(_0x9757('0x9'));var csv=require('to-csv');var ejs=require(_0x9757('0xa'));var fs=require('fs');var fs_extra=require(_0x9757('0xb'));var _=require(_0x9757('0xc'));var squel=require('squel');var crypto=require(_0x9757('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x9757('0xe'));var toCsv=require(_0x9757('0xf'));var querystring=require(_0x9757('0x10'));var Papa=require('papaparse');var Redis=require(_0x9757('0x11'));var authService=require(_0x9757('0x12'));var qs=require(_0x9757('0x13'));var as=require(_0x9757('0x14'));var hardwareService=require(_0x9757('0x15'));var logger=require(_0x9757('0x16'))(_0x9757('0x17'));var utils=require(_0x9757('0x18'));var config=require(_0x9757('0x19'));var licenseUtil=require(_0x9757('0x1a'));var db=require(_0x9757('0x1b'))['db'];function respondWithStatusCode(_0x5c19c9,_0x2f2200){_0x2f2200=_0x2f2200||0xcc;return function(_0x1d32ee){if(_0x1d32ee){return _0x5c19c9[_0x9757('0x1c')](_0x2f2200);}return _0x5c19c9['status'](_0x2f2200)[_0x9757('0x1d')]();};}function respondWithResult(_0x39fa5c,_0x413d55){_0x413d55=_0x413d55||0xc8;return function(_0x14f67c){if(_0x14f67c){return _0x39fa5c[_0x9757('0x1e')](_0x413d55)[_0x9757('0x1f')](_0x14f67c);}};}function respondWithFilteredResult(_0x105e56,_0x4b994d){return function(_0x1fd6f6){if(_0x1fd6f6){var _0x55ded7=typeof _0x4b994d[_0x9757('0x20')]===_0x9757('0x21')&&typeof _0x4b994d[_0x9757('0x22')]===_0x9757('0x21');var _0x3f6be9=_0x1fd6f6[_0x9757('0x23')];var _0x57e309=_0x55ded7?0x0:_0x4b994d[_0x9757('0x20')];var _0x2aa360=_0x55ded7?_0x1fd6f6[_0x9757('0x23')]:_0x4b994d[_0x9757('0x20')]+_0x4b994d[_0x9757('0x22')];var _0xd2306b;if(_0x2aa360>=_0x3f6be9){_0x2aa360=_0x3f6be9;_0xd2306b=0xc8;}else{_0xd2306b=0xce;}_0x105e56[_0x9757('0x1e')](_0xd2306b);return _0x105e56['set'](_0x9757('0x24'),_0x57e309+'-'+_0x2aa360+'/'+_0x3f6be9)['json'](_0x1fd6f6);}return null;};}function patchUpdates(_0x517504){return function(_0x37c889){try{jsonpatch[_0x9757('0x25')](_0x37c889,_0x517504,!![]);}catch(_0x1443a9){return BPromise[_0x9757('0x26')](_0x1443a9);}return _0x37c889['save']();};}function saveUpdates(_0x4ef000,_0x53d21c){return function(_0x73dac4){if(_0x73dac4){return _0x73dac4[_0x9757('0x27')](_0x4ef000)[_0x9757('0x28')](function(_0x21435e){return _0x21435e;});}return null;};}function removeEntity(_0x5dc2fa,_0x11f5ac){return function(_0x160108){if(_0x160108){return _0x160108['destroy']()[_0x9757('0x28')](function(){_0x5dc2fa[_0x9757('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b6915,_0x1a7036){return function(_0x172e8c){if(!_0x172e8c){_0x2b6915[_0x9757('0x1c')](0x194);}return _0x172e8c;};}function handleError(_0x115e33,_0x19588f){_0x19588f=_0x19588f||0x1f4;return function(_0x4e6b86){logger[_0x9757('0x29')](_0x4e6b86['stack']);if(_0x4e6b86[_0x9757('0x2a')]){delete _0x4e6b86[_0x9757('0x2a')];}_0x115e33['status'](_0x19588f)['send'](_0x4e6b86);};}exports[_0x9757('0x2b')]=function(_0x21a4bd,_0xc81976){var _0x3aae8b={'raw':!![],'where':{'id':_0x21a4bd[_0x9757('0x2c')]['id']}},_0x4ebdb6={};_0x4ebdb6[_0x9757('0x2d')]=_[_0x9757('0x2e')](db[_0x9757('0x2f')][_0x9757('0x30')]);_0x4ebdb6[_0x9757('0x31')]=_['keys'](_0x21a4bd[_0x9757('0x31')]);_0x4ebdb6[_0x9757('0x32')]=_[_0x9757('0x33')](_0x4ebdb6[_0x9757('0x2d')],_0x4ebdb6[_0x9757('0x31')]);_0x3aae8b[_0x9757('0x34')]=_[_0x9757('0x33')](_0x4ebdb6['model'],qs[_0x9757('0x35')](_0x21a4bd[_0x9757('0x31')][_0x9757('0x35')]));_0x3aae8b[_0x9757('0x34')]=_0x3aae8b[_0x9757('0x34')][_0x9757('0x36')]?_0x3aae8b[_0x9757('0x34')]:_0x4ebdb6[_0x9757('0x2d')];if(_0x21a4bd['query'][_0x9757('0x37')]){_0x3aae8b['include']=[{'all':!![]}];}_0x3aae8b=_[_0x9757('0x38')]({},_0x3aae8b,_0x21a4bd[_0x9757('0x39')]);return db['ChatProactiveAction'][_0x9757('0x3a')](_0x3aae8b)[_0x9757('0x28')](handleEntityNotFound(_0xc81976,null))[_0x9757('0x28')](respondWithResult(_0xc81976,null))[_0x9757('0x3b')](handleError(_0xc81976,null));};exports[_0x9757('0x3c')]=function(_0x2f2688,_0x3c94b2){return db[_0x9757('0x2f')][_0x9757('0x3c')](_0x2f2688[_0x9757('0x3d')],{})['then'](respondWithResult(_0x3c94b2,0xc9))[_0x9757('0x3b')](handleError(_0x3c94b2,null));};exports[_0x9757('0x27')]=function(_0x457d6c,_0x4f2ea4){if(_0x457d6c[_0x9757('0x3d')]['id']){delete _0x457d6c[_0x9757('0x3d')]['id'];}return db[_0x9757('0x2f')][_0x9757('0x3a')]({'where':{'id':_0x457d6c[_0x9757('0x2c')]['id']}})[_0x9757('0x28')](handleEntityNotFound(_0x4f2ea4,null))[_0x9757('0x28')](saveUpdates(_0x457d6c[_0x9757('0x3d')],null))[_0x9757('0x28')](respondWithResult(_0x4f2ea4,null))['catch'](handleError(_0x4f2ea4,null));};exports['destroy']=function(_0x2cf830,_0x2d0a6e){return db[_0x9757('0x2f')][_0x9757('0x3a')]({'where':{'id':_0x2cf830['params']['id']}})[_0x9757('0x28')](handleEntityNotFound(_0x2d0a6e,null))['then'](removeEntity(_0x2d0a6e,null))[_0x9757('0x3b')](handleError(_0x2d0a6e,null));}; \ No newline at end of file +var _0x04de=['query','keys','filters','intersection','attributes','length','includeAll','merge','options','ChatProactiveAction','find','catch','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','then','error','stack','name','send','params','model','rawAttributes'];(function(_0x503254,_0x29e551){var _0x383dcc=function(_0x3c27fb){while(--_0x3c27fb){_0x503254['push'](_0x503254['shift']());}};_0x383dcc(++_0x29e551);}(_0x04de,0x107));var _0xe04d=function(_0xaa6c12,_0xa3fbbd){_0xaa6c12=_0xaa6c12-0x0;var _0x4a7877=_0x04de[_0xaa6c12];return _0x4a7877;};'use strict';var emlformat=require(_0xe04d('0x0'));var rimraf=require(_0xe04d('0x1'));var zipdir=require(_0xe04d('0x2'));var jsonpatch=require(_0xe04d('0x3'));var rp=require(_0xe04d('0x4'));var moment=require(_0xe04d('0x5'));var BPromise=require(_0xe04d('0x6'));var Mustache=require(_0xe04d('0x7'));var util=require(_0xe04d('0x8'));var path=require(_0xe04d('0x9'));var sox=require(_0xe04d('0xa'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xe04d('0xb'));var crypto=require(_0xe04d('0xc'));var jsforce=require(_0xe04d('0xd'));var deskjs=require(_0xe04d('0xe'));var toCsv=require(_0xe04d('0xf'));var querystring=require(_0xe04d('0x10'));var Papa=require(_0xe04d('0x11'));var Redis=require(_0xe04d('0x12'));var authService=require('../../components/auth/service');var qs=require(_0xe04d('0x13'));var as=require(_0xe04d('0x14'));var hardwareService=require(_0xe04d('0x15'));var logger=require(_0xe04d('0x16'))(_0xe04d('0x17'));var utils=require(_0xe04d('0x18'));var config=require(_0xe04d('0x19'));var licenseUtil=require(_0xe04d('0x1a'));var db=require(_0xe04d('0x1b'))['db'];function respondWithStatusCode(_0x53f59a,_0x8bf2d2){_0x8bf2d2=_0x8bf2d2||0xcc;return function(_0x1d3f03){if(_0x1d3f03){return _0x53f59a[_0xe04d('0x1c')](_0x8bf2d2);}return _0x53f59a[_0xe04d('0x1d')](_0x8bf2d2)[_0xe04d('0x1e')]();};}function respondWithResult(_0xa2521,_0xf205f5){_0xf205f5=_0xf205f5||0xc8;return function(_0x143019){if(_0x143019){return _0xa2521[_0xe04d('0x1d')](_0xf205f5)[_0xe04d('0x1f')](_0x143019);}};}function respondWithFilteredResult(_0xbc5cc7,_0x1aa69b){return function(_0x5cfd5b){if(_0x5cfd5b){var _0x1f29a7=typeof _0x1aa69b['offset']===_0xe04d('0x20')&&typeof _0x1aa69b['limit']===_0xe04d('0x20');var _0xbd5fa1=_0x5cfd5b[_0xe04d('0x21')];var _0x93b107=_0x1f29a7?0x0:_0x1aa69b[_0xe04d('0x22')];var _0x35a2b4=_0x1f29a7?_0x5cfd5b[_0xe04d('0x21')]:_0x1aa69b[_0xe04d('0x22')]+_0x1aa69b[_0xe04d('0x23')];var _0x5d8a1e;if(_0x35a2b4>=_0xbd5fa1){_0x35a2b4=_0xbd5fa1;_0x5d8a1e=0xc8;}else{_0x5d8a1e=0xce;}_0xbc5cc7[_0xe04d('0x1d')](_0x5d8a1e);return _0xbc5cc7[_0xe04d('0x24')](_0xe04d('0x25'),_0x93b107+'-'+_0x35a2b4+'/'+_0xbd5fa1)[_0xe04d('0x1f')](_0x5cfd5b);}return null;};}function patchUpdates(_0x2ac847){return function(_0x34e15f){try{jsonpatch['apply'](_0x34e15f,_0x2ac847,!![]);}catch(_0x3b1f42){return BPromise[_0xe04d('0x26')](_0x3b1f42);}return _0x34e15f['save']();};}function saveUpdates(_0x4b4d8b,_0x5bcfc3){return function(_0x46fab1){if(_0x46fab1){return _0x46fab1['update'](_0x4b4d8b)['then'](function(_0x185d42){return _0x185d42;});}return null;};}function removeEntity(_0x26a869,_0x495f73){return function(_0x942d8a){if(_0x942d8a){return _0x942d8a['destroy']()[_0xe04d('0x27')](function(){_0x26a869['status'](0xcc)[_0xe04d('0x1e')]();});}};}function handleEntityNotFound(_0x456822,_0x48db4e){return function(_0x29ad33){if(!_0x29ad33){_0x456822[_0xe04d('0x1c')](0x194);}return _0x29ad33;};}function handleError(_0x51540e,_0x10aa20){_0x10aa20=_0x10aa20||0x1f4;return function(_0x3e43ca){logger[_0xe04d('0x28')](_0x3e43ca[_0xe04d('0x29')]);if(_0x3e43ca['name']){delete _0x3e43ca[_0xe04d('0x2a')];}_0x51540e[_0xe04d('0x1d')](_0x10aa20)[_0xe04d('0x2b')](_0x3e43ca);};}exports['show']=function(_0x187c29,_0x5a3899){var _0x4f5883={'raw':!![],'where':{'id':_0x187c29[_0xe04d('0x2c')]['id']}},_0x569e4b={};_0x569e4b[_0xe04d('0x2d')]=_['keys'](db['ChatProactiveAction'][_0xe04d('0x2e')]);_0x569e4b[_0xe04d('0x2f')]=_[_0xe04d('0x30')](_0x187c29['query']);_0x569e4b[_0xe04d('0x31')]=_[_0xe04d('0x32')](_0x569e4b['model'],_0x569e4b[_0xe04d('0x2f')]);_0x4f5883['attributes']=_[_0xe04d('0x32')](_0x569e4b[_0xe04d('0x2d')],qs['fields'](_0x187c29[_0xe04d('0x2f')]['fields']));_0x4f5883[_0xe04d('0x33')]=_0x4f5883[_0xe04d('0x33')][_0xe04d('0x34')]?_0x4f5883[_0xe04d('0x33')]:_0x569e4b[_0xe04d('0x2d')];if(_0x187c29[_0xe04d('0x2f')][_0xe04d('0x35')]){_0x4f5883['include']=[{'all':!![]}];}_0x4f5883=_[_0xe04d('0x36')]({},_0x4f5883,_0x187c29[_0xe04d('0x37')]);return db[_0xe04d('0x38')][_0xe04d('0x39')](_0x4f5883)[_0xe04d('0x27')](handleEntityNotFound(_0x5a3899,null))[_0xe04d('0x27')](respondWithResult(_0x5a3899,null))[_0xe04d('0x3a')](handleError(_0x5a3899,null));};exports[_0xe04d('0x3b')]=function(_0x26c6c5,_0x59ed1c){return db[_0xe04d('0x38')]['create'](_0x26c6c5[_0xe04d('0x3c')],{})['then'](respondWithResult(_0x59ed1c,0xc9))['catch'](handleError(_0x59ed1c,null));};exports[_0xe04d('0x3d')]=function(_0x9353a1,_0x261116){if(_0x9353a1[_0xe04d('0x3c')]['id']){delete _0x9353a1['body']['id'];}return db[_0xe04d('0x38')][_0xe04d('0x39')]({'where':{'id':_0x9353a1[_0xe04d('0x2c')]['id']}})[_0xe04d('0x27')](handleEntityNotFound(_0x261116,null))[_0xe04d('0x27')](saveUpdates(_0x9353a1['body'],null))['then'](respondWithResult(_0x261116,null))[_0xe04d('0x3a')](handleError(_0x261116,null));};exports['destroy']=function(_0x53c072,_0x23e4b2){return db[_0xe04d('0x38')][_0xe04d('0x39')]({'where':{'id':_0x53c072[_0xe04d('0x2c')]['id']}})['then'](handleEntityNotFound(_0x23e4b2,null))['then'](removeEntity(_0x23e4b2,null))[_0xe04d('0x3a')](handleError(_0x23e4b2,null));}; \ No newline at end of file diff --git a/server/api/chatProactiveAction/chatProactiveAction.model.js b/server/api/chatProactiveAction/chatProactiveAction.model.js index a1c6601..8ac8fe5 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 _0xaeba=['bluebird','path','rimraf','../../config/environment','./chatProactiveAction.attributes','exports','define','ChatProactiveAction','lodash','util','api','moment'];(function(_0x5dc8b3,_0x56d6e8){var _0xf1289b=function(_0x1770b6){while(--_0x1770b6){_0x5dc8b3['push'](_0x5dc8b3['shift']());}};_0xf1289b(++_0x56d6e8);}(_0xaeba,0x170));var _0xaaeb=function(_0x34f95e,_0x3e6f32){_0x34f95e=_0x34f95e-0x0;var _0x2264e3=_0xaeba[_0x34f95e];return _0x2264e3;};'use strict';var _=require(_0xaaeb('0x0'));var util=require(_0xaaeb('0x1'));var logger=require('../../config/logger')(_0xaaeb('0x2'));var moment=require(_0xaaeb('0x3'));var BPromise=require(_0xaaeb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xaaeb('0x5'));var rimraf=require(_0xaaeb('0x6'));var config=require(_0xaaeb('0x7'));var attributes=require(_0xaaeb('0x8'));module[_0xaaeb('0x9')]=function(_0x214ca2,_0xcbe11c){return _0x214ca2[_0xaaeb('0xa')](_0xaaeb('0xb'),attributes,{'tableName':'chat_proactive_actions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1835=['exports','ChatProactiveAction','chat_proactive_actions','lodash','util','api','bluebird','request-promise','path','rimraf','./chatProactiveAction.attributes'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1835,0xea));var _0x5183=function(_0x11edb7,_0x2e4952){_0x11edb7=_0x11edb7-0x0;var _0x29235b=_0x1835[_0x11edb7];return _0x29235b;};'use strict';var _=require(_0x5183('0x0'));var util=require(_0x5183('0x1'));var logger=require('../../config/logger')(_0x5183('0x2'));var moment=require('moment');var BPromise=require(_0x5183('0x3'));var rp=require(_0x5183('0x4'));var fs=require('fs');var path=require(_0x5183('0x5'));var rimraf=require(_0x5183('0x6'));var config=require('../../config/environment');var attributes=require(_0x5183('0x7'));module[_0x5183('0x8')]=function(_0x521aeb,_0x5a81ef){return _0x521aeb['define'](_0x5183('0x9'),attributes,{'tableName':_0x5183('0xa'),'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 4171dda..a43880e 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 _0xb7ec=['util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','ChatProactiveAction,\x20%s,\x20%s','ChatProactiveAction,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash'];(function(_0xe4e303,_0x8f9657){var _0x39021e=function(_0x134b8a){while(--_0x134b8a){_0xe4e303['push'](_0xe4e303['shift']());}};_0x39021e(++_0x8f9657);}(_0xb7ec,0xbc));var _0xcb7e=function(_0x18b85e,_0x1a4727){_0x18b85e=_0x18b85e-0x0;var _0xdb0129=_0xb7ec[_0x18b85e];return _0xdb0129;};'use strict';var _=require(_0xcb7e('0x0'));var util=require(_0xcb7e('0x1'));var moment=require(_0xcb7e('0x2'));var BPromise=require(_0xcb7e('0x3'));var rs=require(_0xcb7e('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcb7e('0x5'))['db'];var utils=require(_0xcb7e('0x6'));var logger=require(_0xcb7e('0x7'))(_0xcb7e('0x8'));var config=require('../../config/environment');var jayson=require(_0xcb7e('0x9'));var client=jayson[_0xcb7e('0xa')][_0xcb7e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x446bbf,_0x949e08,_0x51f096){return new BPromise(function(_0x14d042,_0x9cac9){return client[_0xcb7e('0xc')](_0x446bbf,_0x51f096)['then'](function(_0xbec63c){logger[_0xcb7e('0xd')](_0xcb7e('0xe'),_0x949e08,'request\x20sent');logger['debug'](_0xcb7e('0xf'),_0x949e08,_0xcb7e('0x10'),JSON['stringify'](_0xbec63c));if(_0xbec63c[_0xcb7e('0x11')]){if(_0xbec63c[_0xcb7e('0x11')][_0xcb7e('0x12')]===0x1f4){logger[_0xcb7e('0x11')](_0xcb7e('0xe'),_0x949e08,_0xbec63c[_0xcb7e('0x11')]['message']);return _0x9cac9(_0xbec63c[_0xcb7e('0x11')][_0xcb7e('0x13')]);}logger['error'](_0xcb7e('0xe'),_0x949e08,_0xbec63c[_0xcb7e('0x11')][_0xcb7e('0x13')]);return _0x14d042(_0xbec63c['error'][_0xcb7e('0x13')]);}else{logger[_0xcb7e('0xd')](_0xcb7e('0xe'),_0x949e08,_0xcb7e('0x10'));_0x14d042(_0xbec63c['result']['message']);}})[_0xcb7e('0x14')](function(_0x433cd6){logger[_0xcb7e('0x11')](_0xcb7e('0xe'),_0x949e08,_0x433cd6);_0x9cac9(_0x433cd6);});});} \ No newline at end of file +var _0xa58e=['info','debug','ChatProactiveAction,\x20%s,\x20%s,\x20%s','stringify','error','ChatProactiveAction,\x20%s,\x20%s','message','request\x20sent','catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x4f6278,_0xac8b23){var _0x158f78=function(_0x37bc4a){while(--_0x37bc4a){_0x4f6278['push'](_0x4f6278['shift']());}};_0x158f78(++_0xac8b23);}(_0xa58e,0x172));var _0xea58=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0xa58e[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xea58('0x0'));var util=require('util');var moment=require(_0xea58('0x1'));var BPromise=require(_0xea58('0x2'));var rs=require(_0xea58('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xea58('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xea58('0x5'))(_0xea58('0x6'));var config=require('../../config/environment');var jayson=require(_0xea58('0x7'));var client=jayson[_0xea58('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5dfb24,_0x3b9805,_0x2dc007){return new BPromise(function(_0x4d9150,_0x363937){return client[_0xea58('0x9')](_0x5dfb24,_0x2dc007)['then'](function(_0x417f7e){logger[_0xea58('0xa')]('ChatProactiveAction,\x20%s,\x20%s',_0x3b9805,'request\x20sent');logger[_0xea58('0xb')](_0xea58('0xc'),_0x3b9805,'request\x20sent',JSON[_0xea58('0xd')](_0x417f7e));if(_0x417f7e[_0xea58('0xe')]){if(_0x417f7e['error']['code']===0x1f4){logger[_0xea58('0xe')](_0xea58('0xf'),_0x3b9805,_0x417f7e[_0xea58('0xe')][_0xea58('0x10')]);return _0x363937(_0x417f7e[_0xea58('0xe')][_0xea58('0x10')]);}logger[_0xea58('0xe')](_0xea58('0xf'),_0x3b9805,_0x417f7e['error']['message']);return _0x4d9150(_0x417f7e[_0xea58('0xe')][_0xea58('0x10')]);}else{logger[_0xea58('0xa')](_0xea58('0xf'),_0x3b9805,_0xea58('0x11'));_0x4d9150(_0x417f7e['result'][_0xea58('0x10')]);}})[_0xea58('0x12')](function(_0x518e75){logger[_0xea58('0xe')](_0xea58('0xf'),_0x3b9805,_0x518e75);_0x363937(_0x518e75);});});} \ No newline at end of file diff --git a/server/api/chatProactiveAction/index.js b/server/api/chatProactiveAction/index.js index d8ef343..e74bb9a 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 _0xb4c7=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','show','create'];(function(_0x2080a3,_0x48acfa){var _0x8d7d17=function(_0x2dbc06){while(--_0x2dbc06){_0x2080a3['push'](_0x2080a3['shift']());}};_0x8d7d17(++_0x48acfa);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x29b0c4,_0x54ffdd){_0x29b0c4=_0x29b0c4-0x0;var _0x470785=_0xb4c7[_0x29b0c4];return _0x470785;};'use strict';var multer=require(_0x7b4c('0x0'));var util=require(_0x7b4c('0x1'));var path=require(_0x7b4c('0x2'));var timeout=require(_0x7b4c('0x3'));var express=require(_0x7b4c('0x4'));var router=express['Router']();var fs_extra=require(_0x7b4c('0x5'));var auth=require(_0x7b4c('0x6'));var interaction=require(_0x7b4c('0x7'));var config=require(_0x7b4c('0x8'));var controller=require(_0x7b4c('0x9'));router['get'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xc')]);router['post']('/',auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xd')]);router['put'](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0xe')]);router[_0x7b4c('0xf')](_0x7b4c('0xa'),auth[_0x7b4c('0xb')](),controller[_0x7b4c('0x10')]);module[_0x7b4c('0x11')]=router; \ No newline at end of file +var _0xeec6=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatProactiveAction.controller','/:id','isAuthenticated','post','create','put','update','delete','exports'];(function(_0x560232,_0x3d3008){var _0x478ab6=function(_0x20e131){while(--_0x20e131){_0x560232['push'](_0x560232['shift']());}};_0x478ab6(++_0x3d3008);}(_0xeec6,0x1c2));var _0x6eec=function(_0x324d02,_0x6d9c0b){_0x324d02=_0x324d02-0x0;var _0x3d4f59=_0xeec6[_0x324d02];return _0x3d4f59;};'use strict';var multer=require(_0x6eec('0x0'));var util=require(_0x6eec('0x1'));var path=require(_0x6eec('0x2'));var timeout=require(_0x6eec('0x3'));var express=require('express');var router=express[_0x6eec('0x4')]();var fs_extra=require(_0x6eec('0x5'));var auth=require(_0x6eec('0x6'));var interaction=require(_0x6eec('0x7'));var config=require(_0x6eec('0x8'));var controller=require(_0x6eec('0x9'));router['get'](_0x6eec('0xa'),auth[_0x6eec('0xb')](),controller['show']);router[_0x6eec('0xc')]('/',auth[_0x6eec('0xb')](),controller[_0x6eec('0xd')]);router[_0x6eec('0xe')]('/:id',auth[_0x6eec('0xb')](),controller[_0x6eec('0xf')]);router[_0x6eec('0x10')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6eec('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.attributes.js b/server/api/chatQueue/chatQueue.attributes.js index 9c7cae9..0a2c6ab 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 _0x27b5=['sequelize','STRING','name','INTEGER','beepall'];(function(_0x2442dd,_0x269ded){var _0x9d4594=function(_0x4964ff){while(--_0x4964ff){_0x2442dd['push'](_0x2442dd['shift']());}};_0x9d4594(++_0x269ded);}(_0x27b5,0x131));var _0x527b=function(_0x4b6507,_0x5518b5){_0x4b6507=_0x4b6507-0x0;var _0x2001ec=_0x27b5[_0x4b6507];return _0x2001ec;};'use strict';var Sequelize=require(_0x527b('0x0'));module['exports']={'name':{'type':Sequelize[_0x527b('0x1')],'unique':_0x527b('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x527b('0x1')]},'timeout':{'type':Sequelize[_0x527b('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM']('rrmemory',_0x527b('0x4'),'roundrobin')}}; \ No newline at end of file +var _0xf7ad=['INTEGER','rrmemory','beepall','sequelize','STRING','name'];(function(_0x2a16cb,_0x3d646e){var _0x379416=function(_0x8503e4){while(--_0x8503e4){_0x2a16cb['push'](_0x2a16cb['shift']());}};_0x379416(++_0x3d646e);}(_0xf7ad,0x17d));var _0xdf7a=function(_0x16c5a0,_0x253b66){_0x16c5a0=_0x16c5a0-0x0;var _0xc380b5=_0xf7ad[_0x16c5a0];return _0xc380b5;};'use strict';var Sequelize=require(_0xdf7a('0x0'));module['exports']={'name':{'type':Sequelize[_0xdf7a('0x1')],'unique':_0xdf7a('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0xdf7a('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xdf7a('0x4'),_0xdf7a('0x5'),'roundrobin')}}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.controller.js b/server/api/chatQueue/chatQueue.controller.js index 2973953..b1f7ebf 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 _0x09ca=['rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./chatQueue.socket','register','jayson/promise','client','request','then','request\x20sent','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','ChatQueue,\x20%s,\x20%s','error','message','info','catch','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','ChatQueues','end','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','ChatQueue','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','describe','getMembers','findOne','keys','UserChatQueue','ChatQueueId','User','findAndCountAll','UserId','agent','updatedAt','rows','%s/%s','SIP','chatPause','createdAt','getTeams','addTeams','ids','Agents','voicePause','interface','flatMap','sequelize','each','findOrCreate','userChatQueue:save','removeTeams','Team','select','field','tq.TeamId','team_has_chat_queues','join','ut.TeamId\x20=\x20tq.TeamId','ChatQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','toString','SELECT','TeamId','includes','union','compact','transaction','forEach','emit','userChatQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format'];(function(_0xef49d1,_0x5a9893){var _0x3b5eac=function(_0x5d5305){while(--_0x5d5305){_0xef49d1['push'](_0xef49d1['shift']());}};_0x3b5eac(++_0x5a9893);}(_0x09ca,0x131));var _0xa09c=function(_0x30fb3d,_0x246528){_0x30fb3d=_0x30fb3d-0x0;var _0x4e3adf=_0x09ca[_0x30fb3d];return _0x4e3adf;};'use strict';var emlformat=require(_0xa09c('0x0'));var rimraf=require(_0xa09c('0x1'));var zipdir=require(_0xa09c('0x2'));var jsonpatch=require(_0xa09c('0x3'));var rp=require(_0xa09c('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa09c('0x5'));var util=require(_0xa09c('0x6'));var path=require(_0xa09c('0x7'));var sox=require('sox');var csv=require(_0xa09c('0x8'));var ejs=require(_0xa09c('0x9'));var fs=require('fs');var fs_extra=require(_0xa09c('0xa'));var _=require(_0xa09c('0xb'));var squel=require(_0xa09c('0xc'));var crypto=require(_0xa09c('0xd'));var jsforce=require(_0xa09c('0xe'));var deskjs=require(_0xa09c('0xf'));var toCsv=require('to-csv');var querystring=require(_0xa09c('0x10'));var Papa=require('papaparse');var Redis=require(_0xa09c('0x11'));var authService=require(_0xa09c('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xa09c('0x13'));var hardwareService=require(_0xa09c('0x14'));var logger=require(_0xa09c('0x15'))(_0xa09c('0x16'));var utils=require('../../config/utils');var config=require(_0xa09c('0x17'));var licenseUtil=require(_0xa09c('0x18'));var db=require(_0xa09c('0x19'))['db'];config['redis']=_[_0xa09c('0x1a')](config[_0xa09c('0x1b')],{'host':_0xa09c('0x1c'),'port':0x18eb});var socket=require(_0xa09c('0x1d'))(new Redis(config[_0xa09c('0x1b')]));require(_0xa09c('0x1e'))[_0xa09c('0x1f')](socket);var jayson=require(_0xa09c('0x20'));var client=jayson[_0xa09c('0x21')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31a572,_0x4a2f04,_0x51d447,_0x3775b8){return new BPromise(function(_0x45d18a,_0x426dba){var _0x58e186=_0x3775b8||client;return _0x58e186[_0xa09c('0x22')](_0x31a572,_0x51d447)[_0xa09c('0x23')](function(_0x424299){logger['info']('ChatQueue,\x20%s,\x20%s',_0x4a2f04,_0xa09c('0x24'));logger['debug'](_0xa09c('0x25'),_0x4a2f04,'request\x20sent',JSON[_0xa09c('0x26')](_0x424299));if(_0x424299['error']){if(_0x424299['error']['code']===0x1f4){logger['error'](_0xa09c('0x27'),_0x4a2f04,_0x424299[_0xa09c('0x28')][_0xa09c('0x29')]);return _0x426dba(_0x424299['error'][_0xa09c('0x29')]);}logger['error']('ChatQueue,\x20%s,\x20%s',_0x4a2f04,_0x424299['error']['message']);return _0x45d18a(_0x424299[_0xa09c('0x28')][_0xa09c('0x29')]);}else{logger[_0xa09c('0x2a')](_0xa09c('0x27'),_0x4a2f04,_0xa09c('0x24'));_0x45d18a(_0x424299['result'][_0xa09c('0x29')]);}})[_0xa09c('0x2b')](function(_0x25b26e){logger['error']('ChatQueue,\x20%s,\x20%s',_0x4a2f04,_0x25b26e);_0x426dba(_0x25b26e);});});}function respondWithStatusCode(_0x13c20a,_0x302107){_0x302107=_0x302107||0xcc;return function(_0x38edd6){if(_0x38edd6){return _0x13c20a[_0xa09c('0x2c')](_0x302107);}return _0x13c20a[_0xa09c('0x2d')](_0x302107)['end']();};}function respondWithResult(_0x3c43a3,_0x22ca52){_0x22ca52=_0x22ca52||0xc8;return function(_0x3f921a){if(_0x3f921a){return _0x3c43a3[_0xa09c('0x2d')](_0x22ca52)[_0xa09c('0x2e')](_0x3f921a);}};}function respondWithFilteredResult(_0x45f523,_0x42739){return function(_0x764a2d){if(_0x764a2d){var _0xa1e6d8=typeof _0x42739['offset']===_0xa09c('0x2f')&&typeof _0x42739[_0xa09c('0x30')]==='undefined';var _0x16787d=_0x764a2d[_0xa09c('0x31')];var _0x135df5=_0xa1e6d8?0x0:_0x42739['offset'];var _0x57887e=_0xa1e6d8?_0x764a2d[_0xa09c('0x31')]:_0x42739[_0xa09c('0x32')]+_0x42739['limit'];var _0x4e7b6e;if(_0x57887e>=_0x16787d){_0x57887e=_0x16787d;_0x4e7b6e=0xc8;}else{_0x4e7b6e=0xce;}_0x45f523[_0xa09c('0x2d')](_0x4e7b6e);return _0x45f523[_0xa09c('0x33')](_0xa09c('0x34'),_0x135df5+'-'+_0x57887e+'/'+_0x16787d)['json'](_0x764a2d);}return null;};}function patchUpdates(_0x53ea14){return function(_0xc4ca7f){try{jsonpatch[_0xa09c('0x35')](_0xc4ca7f,_0x53ea14,!![]);}catch(_0x25639d){return BPromise[_0xa09c('0x36')](_0x25639d);}return _0xc4ca7f[_0xa09c('0x37')]();};}function saveUpdates(_0x4e59d9,_0x16052b){return function(_0x187f1f){if(_0x187f1f){return _0x187f1f[_0xa09c('0x38')](_0x4e59d9)[_0xa09c('0x23')](function(_0x2e4734){return _0x2e4734;});}return null;};}function removeEntity(_0x3fc70a,_0x3ea1aa){return function(_0x2e17f1){if(_0x2e17f1){return _0x2e17f1[_0xa09c('0x39')]()[_0xa09c('0x23')](function(){var _0x4faa07=_0x2e17f1[_0xa09c('0x3a')]({'plain':!![]});var _0x2ebd10=_0xa09c('0x3b');return db['UserProfileResource'][_0xa09c('0x39')]({'where':{'type':_0x2ebd10,'resourceId':_0x4faa07['id']}})[_0xa09c('0x23')](function(){return _0x2e17f1;});})[_0xa09c('0x23')](function(){_0x3fc70a[_0xa09c('0x2d')](0xcc)[_0xa09c('0x3c')]();});}};}function handleEntityNotFound(_0x342241,_0x1a524b){return function(_0x17d153){if(!_0x17d153){_0x342241['sendStatus'](0x194);}return _0x17d153;};}function handleError(_0x45ceda,_0x1f3744){_0x1f3744=_0x1f3744||0x1f4;return function(_0x12e6b7){logger[_0xa09c('0x28')](_0x12e6b7[_0xa09c('0x3d')]);if(_0x12e6b7['name']){delete _0x12e6b7[_0xa09c('0x3e')];}_0x45ceda[_0xa09c('0x2d')](_0x1f3744)[_0xa09c('0x3f')](_0x12e6b7);};}exports[_0xa09c('0x40')]=function(_0x3b039c,_0x147a26){var _0x13a4b5={},_0x3f2ce1={},_0x48988f={'count':0x0,'rows':[]};var _0x2c4580=_[_0xa09c('0x41')](db['ChatQueue'][_0xa09c('0x42')],function(_0x580b64){return{'name':_0x580b64[_0xa09c('0x43')],'type':_0x580b64[_0xa09c('0x44')]['key']};});_0x3f2ce1[_0xa09c('0x45')]=_[_0xa09c('0x41')](_0x2c4580,_0xa09c('0x3e'));_0x3f2ce1[_0xa09c('0x46')]=_['keys'](_0x3b039c[_0xa09c('0x46')]);_0x3f2ce1[_0xa09c('0x47')]=_[_0xa09c('0x48')](_0x3f2ce1[_0xa09c('0x45')],_0x3f2ce1[_0xa09c('0x46')]);_0x13a4b5['attributes']=_[_0xa09c('0x48')](_0x3f2ce1['model'],qs[_0xa09c('0x49')](_0x3b039c[_0xa09c('0x46')][_0xa09c('0x49')]));_0x13a4b5[_0xa09c('0x4a')]=_0x13a4b5[_0xa09c('0x4a')][_0xa09c('0x4b')]?_0x13a4b5['attributes']:_0x3f2ce1[_0xa09c('0x45')];if(!_0x3b039c[_0xa09c('0x46')][_0xa09c('0x4c')](_0xa09c('0x4d'))){_0x13a4b5[_0xa09c('0x30')]=qs[_0xa09c('0x30')](_0x3b039c['query']['limit']);_0x13a4b5[_0xa09c('0x32')]=qs['offset'](_0x3b039c[_0xa09c('0x46')][_0xa09c('0x32')]);}_0x13a4b5[_0xa09c('0x4e')]=qs[_0xa09c('0x4f')](_0x3b039c[_0xa09c('0x46')]['sort']);_0x13a4b5[_0xa09c('0x50')]=qs[_0xa09c('0x47')](_[_0xa09c('0x51')](_0x3b039c[_0xa09c('0x46')],_0x3f2ce1[_0xa09c('0x47')]),_0x2c4580);if(_0x3b039c[_0xa09c('0x46')][_0xa09c('0x52')]){_0x13a4b5['where']=_[_0xa09c('0x53')](_0x13a4b5[_0xa09c('0x50')],{'$or':_[_0xa09c('0x41')](_0x2c4580,function(_0x5ea94f){if(_0x5ea94f[_0xa09c('0x44')]!==_0xa09c('0x54')){var _0xa6f3d4={};_0xa6f3d4[_0x5ea94f['name']]={'$like':'%'+_0x3b039c[_0xa09c('0x46')]['filter']+'%'};return _0xa6f3d4;}})});}_0x13a4b5=_['merge']({},_0x13a4b5,_0x3b039c[_0xa09c('0x55')]);var _0x10dfe8={'where':_0x13a4b5[_0xa09c('0x50')]};return db['ChatQueue']['count'](_0x10dfe8)[_0xa09c('0x23')](function(_0x206c65){_0x48988f['count']=_0x206c65;if(_0x3b039c[_0xa09c('0x46')][_0xa09c('0x56')]){_0x13a4b5[_0xa09c('0x57')]=[{'all':!![]}];}return db['ChatQueue'][_0xa09c('0x58')](_0x13a4b5);})[_0xa09c('0x23')](function(_0x3ecf40){_0x48988f['rows']=_0x3ecf40;return _0x48988f;})['then'](respondWithFilteredResult(_0x147a26,_0x13a4b5))['catch'](handleError(_0x147a26,null));};exports['show']=function(_0x182723,_0x7e9a27){var _0x441d7f={'raw':!![],'where':{'id':_0x182723['params']['id']}},_0x4e0575={};_0x4e0575[_0xa09c('0x45')]=_['keys'](db[_0xa09c('0x59')][_0xa09c('0x42')]);_0x4e0575['query']=_['keys'](_0x182723[_0xa09c('0x46')]);_0x4e0575['filters']=_[_0xa09c('0x48')](_0x4e0575['model'],_0x4e0575[_0xa09c('0x46')]);_0x441d7f[_0xa09c('0x4a')]=_['intersection'](_0x4e0575['model'],qs[_0xa09c('0x49')](_0x182723['query']['fields']));_0x441d7f[_0xa09c('0x4a')]=_0x441d7f[_0xa09c('0x4a')][_0xa09c('0x4b')]?_0x441d7f[_0xa09c('0x4a')]:_0x4e0575[_0xa09c('0x45')];if(_0x182723[_0xa09c('0x46')][_0xa09c('0x56')]){_0x441d7f[_0xa09c('0x57')]=[{'all':!![]}];}_0x441d7f=_['merge']({},_0x441d7f,_0x182723[_0xa09c('0x55')]);return db[_0xa09c('0x59')][_0xa09c('0x5a')](_0x441d7f)[_0xa09c('0x23')](handleEntityNotFound(_0x7e9a27,null))[_0xa09c('0x23')](respondWithResult(_0x7e9a27,null))[_0xa09c('0x2b')](handleError(_0x7e9a27,null));};exports[_0xa09c('0x5b')]=function(_0x1dd58c,_0x33624c){return db[_0xa09c('0x59')]['create'](_0x1dd58c['body'],{})[_0xa09c('0x23')](function(_0x16a8ed){var _0x286a24=_0x1dd58c['user'][_0xa09c('0x3a')]({'plain':!![]});if(!_0x286a24)throw new Error(_0xa09c('0x5c'));if(_0x286a24['role']===_0xa09c('0x5d')){var _0xb53951=_0x16a8ed[_0xa09c('0x3a')]({'plain':!![]});var _0x322c30=_0xa09c('0x3b');return db[_0xa09c('0x5e')][_0xa09c('0x5a')]({'where':{'name':_0x322c30,'userProfileId':_0x286a24['userProfileId']},'raw':!![]})[_0xa09c('0x23')](function(_0x3fcea5){if(_0x3fcea5&&_0x3fcea5[_0xa09c('0x5f')]===0x0){return db['UserProfileResource'][_0xa09c('0x5b')]({'name':_0xb53951[_0xa09c('0x3e')],'resourceId':_0xb53951['id'],'type':_0x3fcea5[_0xa09c('0x3e')],'sectionId':_0x3fcea5['id']},{})[_0xa09c('0x23')](function(){return _0x16a8ed;});}else{return _0x16a8ed;}})[_0xa09c('0x2b')](function(_0x1b7bd5){logger[_0xa09c('0x28')](_0xa09c('0x60'),_0x1b7bd5);throw _0x1b7bd5;});}return _0x16a8ed;})[_0xa09c('0x23')](respondWithResult(_0x33624c,0xc9))[_0xa09c('0x2b')](handleError(_0x33624c,null));};exports[_0xa09c('0x38')]=function(_0x20bb79,_0x3af94d){if(_0x20bb79[_0xa09c('0x61')]['id']){delete _0x20bb79[_0xa09c('0x61')]['id'];}return db[_0xa09c('0x59')][_0xa09c('0x5a')]({'where':{'id':_0x20bb79[_0xa09c('0x62')]['id']}})['then'](handleEntityNotFound(_0x3af94d,null))[_0xa09c('0x23')](saveUpdates(_0x20bb79[_0xa09c('0x61')],null))[_0xa09c('0x23')](respondWithResult(_0x3af94d,null))['catch'](handleError(_0x3af94d,null));};exports[_0xa09c('0x39')]=function(_0x4f6034,_0x34e076){return db[_0xa09c('0x59')][_0xa09c('0x5a')]({'where':{'id':_0x4f6034[_0xa09c('0x62')]['id']}})[_0xa09c('0x23')](handleEntityNotFound(_0x34e076,null))[_0xa09c('0x23')](removeEntity(_0x34e076,null))['catch'](handleError(_0x34e076,null));};exports[_0xa09c('0x63')]=function(_0x3d54fa,_0x3f5b3a){return db['ChatQueue'][_0xa09c('0x63')]()['then'](respondWithResult(_0x3f5b3a,null))[_0xa09c('0x2b')](handleError(_0x3f5b3a,null));};exports[_0xa09c('0x64')]=function(_0x9bb70b,_0x4dc961,_0x362d04){var _0x56e378={'raw':!![],'where':{}},_0x454a08={},_0x4cbc28;return db[_0xa09c('0x59')][_0xa09c('0x65')]({'where':{'id':_0x9bb70b[_0xa09c('0x62')]['id']}})[_0xa09c('0x23')](handleEntityNotFound(_0x4dc961,null))['then'](function(_0xddfc4f){if(_0xddfc4f){_0x4cbc28=_0xddfc4f[_0xa09c('0x3a')]({'plain':!![]});_0x454a08[_0xa09c('0x45')]=_[_0xa09c('0x66')](db[_0xa09c('0x67')][_0xa09c('0x42')]);_0x454a08[_0xa09c('0x46')]=_['keys'](_0x9bb70b['query']);_0x454a08[_0xa09c('0x47')]=_[_0xa09c('0x48')](_0x454a08[_0xa09c('0x45')],_0x454a08[_0xa09c('0x46')]);_0x56e378['attributes']=_[_0xa09c('0x48')](_0x454a08['model'],qs[_0xa09c('0x49')](_0x9bb70b[_0xa09c('0x46')][_0xa09c('0x49')]));_0x56e378[_0xa09c('0x4a')]=_0x56e378[_0xa09c('0x4a')][_0xa09c('0x4b')]?_0x56e378[_0xa09c('0x4a')]:_0x454a08['model'];if(!_0x9bb70b[_0xa09c('0x46')][_0xa09c('0x4c')]('nolimit')){_0x56e378[_0xa09c('0x30')]=qs[_0xa09c('0x30')](_0x9bb70b[_0xa09c('0x46')][_0xa09c('0x30')]);_0x56e378[_0xa09c('0x32')]=qs[_0xa09c('0x32')](_0x9bb70b[_0xa09c('0x46')][_0xa09c('0x32')]);}_0x56e378[_0xa09c('0x4e')]=qs[_0xa09c('0x4f')](_0x9bb70b[_0xa09c('0x46')][_0xa09c('0x4f')]);_0x56e378[_0xa09c('0x50')]=qs[_0xa09c('0x47')](_['pick'](_0x9bb70b['query'],_0x454a08[_0xa09c('0x47')]));_0x56e378[_0xa09c('0x50')][_0xa09c('0x68')]=_0xddfc4f['id'];if(_0x9bb70b[_0xa09c('0x46')][_0xa09c('0x52')]){_0x56e378['where']=_[_0xa09c('0x53')](_0x56e378[_0xa09c('0x50')],{'$or':_[_0xa09c('0x41')](_0x56e378[_0xa09c('0x4a')],function(_0x548452){var _0x6516e8={};_0x6516e8[_0x548452]={'$like':'%'+_0x9bb70b['query']['filter']+'%'};return _0x6516e8;})});}_0x56e378=_['merge']({},_0x56e378,_0x9bb70b[_0xa09c('0x55')]);return db['UserChatQueue'][_0xa09c('0x58')](_0x56e378);}})[_0xa09c('0x23')](function(_0x23360e){if(_0x23360e){return db[_0xa09c('0x69')][_0xa09c('0x6a')]({'where':{'id':_[_0xa09c('0x41')](_0x23360e,_0xa09c('0x6b')),'role':_0xa09c('0x6c')},'attributes':['id',_0xa09c('0x3e'),'chatPause',_0xa09c('0x6d'),'createdAt']});}})[_0xa09c('0x23')](function(_0x3111ec){if(_0x3111ec){return{'count':_0x3111ec[_0xa09c('0x31')],'rows':_[_0xa09c('0x41')](_0x3111ec[_0xa09c('0x6e')],function(_0x3e1308){return{'membername':_0x3e1308['name'],'UserId':_0x3e1308['id'],'queue_name':_0x4cbc28[_0xa09c('0x3e')],'ChatQueueId':_0x4cbc28['id'],'interface':util['format'](_0xa09c('0x6f'),_0xa09c('0x70'),_0x3e1308[_0xa09c('0x3e')]),'penalty':0x0,'paused':_0x3e1308[_0xa09c('0x71')],'createdAt':_0x3e1308[_0xa09c('0x72')],'updatedAt':_0x3e1308['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x4dc961,_0x56e378))[_0xa09c('0x2b')](handleError(_0x4dc961,null));};exports['getTeams']=function(_0x271460,_0x13ae72,_0x3657f8){var _0x3f87b8={};var _0x1a392a={};var _0x543cab;var _0x4ed3f9;return db[_0xa09c('0x59')][_0xa09c('0x65')]({'where':{'id':_0x271460['params']['id']}})[_0xa09c('0x23')](handleEntityNotFound(_0x13ae72,null))[_0xa09c('0x23')](function(_0x263e57){if(_0x263e57){_0x543cab=_0x263e57;_0x1a392a[_0xa09c('0x45')]=_['keys'](db['Team']['rawAttributes']);_0x1a392a[_0xa09c('0x46')]=_[_0xa09c('0x66')](_0x271460[_0xa09c('0x46')]);_0x1a392a['filters']=_[_0xa09c('0x48')](_0x1a392a[_0xa09c('0x45')],_0x1a392a[_0xa09c('0x46')]);_0x3f87b8[_0xa09c('0x4a')]=_[_0xa09c('0x48')](_0x1a392a[_0xa09c('0x45')],qs[_0xa09c('0x49')](_0x271460[_0xa09c('0x46')]['fields']));_0x3f87b8[_0xa09c('0x4a')]=_0x3f87b8['attributes'][_0xa09c('0x4b')]?_0x3f87b8[_0xa09c('0x4a')]:_0x1a392a[_0xa09c('0x45')];_0x3f87b8[_0xa09c('0x4e')]=qs[_0xa09c('0x4f')](_0x271460[_0xa09c('0x46')][_0xa09c('0x4f')]);_0x3f87b8[_0xa09c('0x50')]=qs[_0xa09c('0x47')](_['pick'](_0x271460[_0xa09c('0x46')],_0x1a392a[_0xa09c('0x47')]));if(_0x271460[_0xa09c('0x46')][_0xa09c('0x52')]){_0x3f87b8['where']=_[_0xa09c('0x53')](_0x3f87b8[_0xa09c('0x50')],{'$or':_['map'](_0x3f87b8[_0xa09c('0x4a')],function(_0x459f30){var _0x14e02f={};_0x14e02f[_0x459f30]={'$like':'%'+_0x271460[_0xa09c('0x46')][_0xa09c('0x52')]+'%'};return _0x14e02f;})});}_0x3f87b8=_['merge']({},_0x3f87b8,_0x271460[_0xa09c('0x55')]);return _0x543cab[_0xa09c('0x73')](_0x3f87b8);}})[_0xa09c('0x23')](function(_0x58d126){if(_0x58d126){_0x4ed3f9=_0x58d126['length'];if(!_0x271460[_0xa09c('0x46')][_0xa09c('0x4c')](_0xa09c('0x4d'))){_0x3f87b8[_0xa09c('0x30')]=qs[_0xa09c('0x30')](_0x271460['query'][_0xa09c('0x30')]);_0x3f87b8[_0xa09c('0x32')]=qs[_0xa09c('0x32')](_0x271460[_0xa09c('0x46')]['offset']);}return _0x543cab['getTeams'](_0x3f87b8);}})[_0xa09c('0x23')](function(_0x2abb18){if(_0x2abb18){return _0x2abb18?{'count':_0x4ed3f9,'rows':_0x2abb18}:null;}})[_0xa09c('0x23')](respondWithResult(_0x13ae72,null))[_0xa09c('0x2b')](handleError(_0x13ae72,null));};exports[_0xa09c('0x74')]=function(_0x4decae,_0x24d4c1,_0x3385cf){var _0x11cc0c=_0x4decae['body'][_0xa09c('0x75')];return db['Team'][_0xa09c('0x58')]({'where':{'id':_0x11cc0c},'attributes':['id'],'include':[{'model':db[_0xa09c('0x69')],'as':_0xa09c('0x76'),'attributes':['id',_0xa09c('0x3e'),'online',_0xa09c('0x77'),_0xa09c('0x78')],'raw':!![]}]})[_0xa09c('0x23')](function(_0x12ab52){if(_0x12ab52){var _0x121d18=_[_0xa09c('0x79')](_0x12ab52,function(_0x2309b5){var _0xe48cd7=_0x2309b5[_0xa09c('0x3a')]({'plain':!![]});return _0xe48cd7[_0xa09c('0x76')];});return db[_0xa09c('0x59')][_0xa09c('0x5a')]({'where':{'id':_0x4decae[_0xa09c('0x62')]['id']}})[_0xa09c('0x23')](function(_0x4461b1){return db[_0xa09c('0x7a')]['transaction'](function(_0x3eeb69){return _0x4461b1[_0xa09c('0x74')](_0x11cc0c,{'transaction':_0x3eeb69})['then'](function(){return BPromise[_0xa09c('0x7b')](_0x121d18,function(_0x52cf4d){return db[_0xa09c('0x67')][_0xa09c('0x7c')]({'where':{'UserId':_0x52cf4d['id'],'ChatQueueId':_0x4decae[_0xa09c('0x62')]['id']},'transaction':_0x3eeb69});});})[_0xa09c('0x23')](function(){_0x121d18['forEach'](function(_0x2077ce){socket['emit'](_0xa09c('0x7d'),{'UserId':_0x2077ce['id'],'ChatQueueId':_0x4461b1['id']});});});});});}})['then'](respondWithStatusCode(_0x24d4c1,null))[_0xa09c('0x2b')](handleError(_0x24d4c1,null));};exports[_0xa09c('0x7e')]=function(_0xc3c061,_0x5204ec,_0x38e879){return db[_0xa09c('0x7f')][_0xa09c('0x58')]({'where':{'id':_0xc3c061[_0xa09c('0x46')][_0xa09c('0x75')]},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x5204ec,null))['then'](function(_0x48f5f7){var _0x2c4ef7=_[_0xa09c('0x41')](_0x48f5f7,'id');var _0x3fbbd7=[];var _0x29f7ec=[];var _0x2dd16e=squel[_0xa09c('0x80')]();_0x2dd16e[_0xa09c('0x81')](_0xa09c('0x82'))['from'](_0xa09c('0x83'),'tq')[_0xa09c('0x84')]('user_has_teams','ut',_0xa09c('0x85'))['where'](_0xa09c('0x86'),_0xc3c061['params']['id']);for(var _0x32565b=0x0;_0x32565b<_0x48f5f7[_0xa09c('0x4b')];_0x32565b+=0x1){let _0x2ae69c=_0x48f5f7[_0x32565b];for(var _0x4d180d=0x0;_0x4d180d<_0x2ae69c[_0xa09c('0x76')]['length'];_0x4d180d+=0x1){let _0x24945b=_0x2ae69c[_0xa09c('0x76')][_0x4d180d];var _0x47219b=_0x2dd16e['clone']();_0x47219b['where'](_0xa09c('0x87'),_0x24945b['id']);_0x29f7ec[_0xa09c('0x88')](db[_0xa09c('0x7a')][_0xa09c('0x46')](_0x47219b[_0xa09c('0x89')](),{'type':db['sequelize']['QueryTypes'][_0xa09c('0x8a')]})['then'](function(_0x2b6677){if(_0x2b6677['length']===0x1){return _0x24945b['id'];}else{var _0x404558=_['every'](_[_0xa09c('0x41')](_0x2b6677,_0xa09c('0x8b')),function(_0x4658d8){return _[_0xa09c('0x8c')](_0x2c4ef7,_0x4658d8);});if(_0x404558){return _0x24945b['id'];}}}));}}return BPromise['all'](_0x29f7ec)[_0xa09c('0x23')](function(_0x47df44){_0x3fbbd7=_(_0x3fbbd7)[_0xa09c('0x8d')](_0x47df44)[_0xa09c('0x8e')]()['value']();return db[_0xa09c('0x59')][_0xa09c('0x5a')]({'where':{'id':_0xc3c061[_0xa09c('0x62')]['id']}})[_0xa09c('0x23')](function(_0x79dc83){return db[_0xa09c('0x7a')][_0xa09c('0x8f')](function(_0x54b52a){return _0x79dc83['removeTeams'](_0xc3c061[_0xa09c('0x46')][_0xa09c('0x75')],{'transaction':_0x54b52a})[_0xa09c('0x23')](function(){if(!_['isEmpty'](_0x3fbbd7)){return _0x79dc83['removeAgents'](_0x3fbbd7,{'transaction':_0x54b52a});}})[_0xa09c('0x23')](function(){_0x3fbbd7[_0xa09c('0x90')](function(_0x46b27b){socket[_0xa09c('0x91')](_0xa09c('0x92'),{'UserId':_0x46b27b,'ChatQueueId':_0x79dc83['id']});});});});});});})[_0xa09c('0x23')](respondWithStatusCode(_0x5204ec,null))['catch'](handleError(_0x5204ec,null));};exports['addAgents']=function(_0x4d4227,_0x16b345,_0x315c1d){return db[_0xa09c('0x59')]['find']({'where':{'id':_0x4d4227[_0xa09c('0x62')]['id']}})[_0xa09c('0x23')](handleEntityNotFound(_0x16b345,null))[_0xa09c('0x23')](function(_0x10c37f){if(_0x10c37f){return _0x10c37f[_0xa09c('0x93')](_0x4d4227[_0xa09c('0x61')][_0xa09c('0x75')],_[_0xa09c('0x94')](_0x4d4227[_0xa09c('0x61')],[_0xa09c('0x75'),'id'])||{})[_0xa09c('0x95')](function(_0x597cb1){for(var _0x10fecc=0x0;_0x10fecc<_0x4d4227[_0xa09c('0x61')][_0xa09c('0x75')][_0xa09c('0x4b')];_0x10fecc+=0x1){socket['emit']('userChatQueue:save',{'UserId':Number(_0x4d4227[_0xa09c('0x61')]['ids'][_0x10fecc]),'ChatQueueId':Number(_0x4d4227[_0xa09c('0x62')]['id'])});}return _0x597cb1;});}})['then'](respondWithResult(_0x16b345,null))['catch'](handleError(_0x16b345,null));};exports[_0xa09c('0x96')]=function(_0x52588a,_0x204455,_0x5b99b2){return db[_0xa09c('0x59')][_0xa09c('0x5a')]({'where':{'id':_0x52588a[_0xa09c('0x62')]['id']}})[_0xa09c('0x23')](handleEntityNotFound(_0x204455,null))[_0xa09c('0x23')](function(_0x8bdf93){if(_0x8bdf93){return _0x8bdf93[_0xa09c('0x96')](_0x52588a[_0xa09c('0x46')][_0xa09c('0x75')])[_0xa09c('0x23')](function(){if(_[_0xa09c('0x97')](_0x52588a[_0xa09c('0x46')][_0xa09c('0x75')])){for(var _0x29d3fd=0x0;_0x29d3fd<_0x52588a[_0xa09c('0x46')][_0xa09c('0x75')][_0xa09c('0x4b')];_0x29d3fd+=0x1){socket[_0xa09c('0x91')]('userChatQueue:remove',{'UserId':Number(_0x52588a['query'][_0xa09c('0x75')][_0x29d3fd]),'ChatQueueId':Number(_0x52588a[_0xa09c('0x62')]['id'])});}}else{socket[_0xa09c('0x91')](_0xa09c('0x92'),{'UserId':Number(_0x52588a[_0xa09c('0x46')]['ids']),'ChatQueueId':Number(_0x52588a[_0xa09c('0x62')]['id'])});}});}})[_0xa09c('0x23')](respondWithStatusCode(_0x204455,null))[_0xa09c('0x2b')](handleError(_0x204455,null));};exports[_0xa09c('0x98')]=function(_0x29bb68,_0x67bd64,_0x354655){var _0xa8fe2f={};var _0x422ad8={};var _0x117599;var _0x18d0e5;return db[_0xa09c('0x59')][_0xa09c('0x65')]({'where':{'id':_0x29bb68[_0xa09c('0x62')]['id']}})[_0xa09c('0x23')](handleEntityNotFound(_0x67bd64,null))[_0xa09c('0x23')](function(_0x11d6f8){if(_0x11d6f8){_0x117599=_0x11d6f8;_0x422ad8[_0xa09c('0x45')]=_[_0xa09c('0x66')](db[_0xa09c('0x69')][_0xa09c('0x42')]);_0x422ad8[_0xa09c('0x46')]=_[_0xa09c('0x66')](_0x29bb68[_0xa09c('0x46')]);_0x422ad8['filters']=_[_0xa09c('0x48')](_0x422ad8[_0xa09c('0x45')],_0x422ad8[_0xa09c('0x46')]);_0xa8fe2f[_0xa09c('0x4a')]=_[_0xa09c('0x48')](_0x422ad8['model'],qs[_0xa09c('0x49')](_0x29bb68[_0xa09c('0x46')][_0xa09c('0x49')]));_0xa8fe2f[_0xa09c('0x4a')]=_0xa8fe2f[_0xa09c('0x4a')]['length']?_0xa8fe2f[_0xa09c('0x4a')]:_0x422ad8[_0xa09c('0x45')];_0xa8fe2f['order']=qs[_0xa09c('0x4f')](_0x29bb68[_0xa09c('0x46')][_0xa09c('0x4f')]);_0xa8fe2f[_0xa09c('0x50')]=qs[_0xa09c('0x47')](_['pick'](_0x29bb68['query'],_0x422ad8['filters']));if(_0x29bb68[_0xa09c('0x46')]['filter']){_0xa8fe2f[_0xa09c('0x50')]=_[_0xa09c('0x53')](_0xa8fe2f[_0xa09c('0x50')],{'$or':_[_0xa09c('0x41')](_0xa8fe2f['attributes'],function(_0x427a08){var _0x1b9d32={};_0x1b9d32[_0x427a08]={'$like':'%'+_0x29bb68['query'][_0xa09c('0x52')]+'%'};return _0x1b9d32;})});}_0xa8fe2f=_[_0xa09c('0x53')]({},_0xa8fe2f,_0x29bb68[_0xa09c('0x55')]);return _0x117599['getAgents'](_0xa8fe2f);}})[_0xa09c('0x23')](function(_0x507c3c){if(_0x507c3c){_0x18d0e5=_0x507c3c[_0xa09c('0x4b')];if(!_0x29bb68[_0xa09c('0x46')]['hasOwnProperty'](_0xa09c('0x4d'))){_0xa8fe2f[_0xa09c('0x30')]=qs[_0xa09c('0x30')](_0x29bb68['query'][_0xa09c('0x30')]);_0xa8fe2f['offset']=qs[_0xa09c('0x32')](_0x29bb68['query']['offset']);}return _0x117599[_0xa09c('0x98')](_0xa8fe2f);}})['then'](function(_0x53e641){if(_0x53e641){return _0x53e641?{'count':_0x18d0e5,'rows':_0x53e641}:null;}})[_0xa09c('0x23')](respondWithResult(_0x67bd64,null))[_0xa09c('0x2b')](handleError(_0x67bd64,null));}; \ No newline at end of file +var _0xa70e=['send','index','map','ChatQueue','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','includeAll','include','findAll','rows','catch','show','params','length','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','describe','getMembers','UserChatQueue','nolimit','ChatQueueId','User','findAndCountAll','UserId','chatPause','updatedAt','format','%s/%s','SIP','createdAt','getTeams','Team','addTeams','ids','Agents','online','interface','flatMap','transaction','each','findOrCreate','forEach','field','tq.TeamId','from','team_has_chat_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','SELECT','every','TeamId','includes','all','compact','value','removeTeams','removeAgents','userChatQueue:remove','addAgents','omit','spread','userChatQueue:save','isArray','emit','getAgents','rawAttributes','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','socket.io-emitter','./chatQueue.socket','register','jayson/promise','http','request','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','result','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','get','UserProfileResource','destroy','sendStatus','stack','name'];(function(_0x824626,_0x590cd4){var _0x7247cb=function(_0x18b0b9){while(--_0x18b0b9){_0x824626['push'](_0x824626['shift']());}};_0x7247cb(++_0x590cd4);}(_0xa70e,0xfd));var _0xea70=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa70e[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xea70('0x0'));var rimraf=require(_0xea70('0x1'));var zipdir=require(_0xea70('0x2'));var jsonpatch=require(_0xea70('0x3'));var rp=require('request-promise');var moment=require(_0xea70('0x4'));var BPromise=require(_0xea70('0x5'));var Mustache=require(_0xea70('0x6'));var util=require(_0xea70('0x7'));var path=require('path');var sox=require(_0xea70('0x8'));var csv=require(_0xea70('0x9'));var ejs=require(_0xea70('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xea70('0xb'));var squel=require(_0xea70('0xc'));var crypto=require('crypto');var jsforce=require(_0xea70('0xd'));var deskjs=require(_0xea70('0xe'));var toCsv=require(_0xea70('0x9'));var querystring=require(_0xea70('0xf'));var Papa=require(_0xea70('0x10'));var Redis=require(_0xea70('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xea70('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xea70('0x13'))(_0xea70('0x14'));var utils=require(_0xea70('0x15'));var config=require(_0xea70('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xea70('0x17'))['db'];config['redis']=_[_0xea70('0x18')](config[_0xea70('0x19')],{'host':'localhost','port':0x18eb});var socket=require(_0xea70('0x1a'))(new Redis(config[_0xea70('0x19')]));require(_0xea70('0x1b'))[_0xea70('0x1c')](socket);var jayson=require(_0xea70('0x1d'));var client=jayson['client'][_0xea70('0x1e')]({'port':0x232a});function respondWithRpcPromise(_0x3d7fd8,_0x27a68d,_0x4f9a06,_0x543d5f){return new BPromise(function(_0x15283a,_0x133c03){var _0x3bb471=_0x543d5f||client;return _0x3bb471[_0xea70('0x1f')](_0x3d7fd8,_0x4f9a06)['then'](function(_0x24163f){logger['info'](_0xea70('0x20'),_0x27a68d,_0xea70('0x21'));logger[_0xea70('0x22')](_0xea70('0x23'),_0x27a68d,'request\x20sent',JSON['stringify'](_0x24163f));if(_0x24163f[_0xea70('0x24')]){if(_0x24163f[_0xea70('0x24')][_0xea70('0x25')]===0x1f4){logger[_0xea70('0x24')](_0xea70('0x20'),_0x27a68d,_0x24163f[_0xea70('0x24')][_0xea70('0x26')]);return _0x133c03(_0x24163f[_0xea70('0x24')][_0xea70('0x26')]);}logger[_0xea70('0x24')](_0xea70('0x20'),_0x27a68d,_0x24163f[_0xea70('0x24')][_0xea70('0x26')]);return _0x15283a(_0x24163f[_0xea70('0x24')][_0xea70('0x26')]);}else{logger[_0xea70('0x27')](_0xea70('0x20'),_0x27a68d,_0xea70('0x21'));_0x15283a(_0x24163f[_0xea70('0x28')][_0xea70('0x26')]);}})['catch'](function(_0x91347a){logger[_0xea70('0x24')](_0xea70('0x20'),_0x27a68d,_0x91347a);_0x133c03(_0x91347a);});});}function respondWithStatusCode(_0x11698c,_0x42b189){_0x42b189=_0x42b189||0xcc;return function(_0xcd5427){if(_0xcd5427){return _0x11698c['sendStatus'](_0x42b189);}return _0x11698c[_0xea70('0x29')](_0x42b189)[_0xea70('0x2a')]();};}function respondWithResult(_0x257fc9,_0xe438aa){_0xe438aa=_0xe438aa||0xc8;return function(_0x4a4378){if(_0x4a4378){return _0x257fc9[_0xea70('0x29')](_0xe438aa)[_0xea70('0x2b')](_0x4a4378);}};}function respondWithFilteredResult(_0x4083d8,_0x3d24ef){return function(_0x215707){if(_0x215707){var _0x3e1b32=typeof _0x3d24ef[_0xea70('0x2c')]===_0xea70('0x2d')&&typeof _0x3d24ef[_0xea70('0x2e')]===_0xea70('0x2d');var _0xe66be8=_0x215707[_0xea70('0x2f')];var _0x9485f2=_0x3e1b32?0x0:_0x3d24ef[_0xea70('0x2c')];var _0x243087=_0x3e1b32?_0x215707[_0xea70('0x2f')]:_0x3d24ef[_0xea70('0x2c')]+_0x3d24ef[_0xea70('0x2e')];var _0x2919d3;if(_0x243087>=_0xe66be8){_0x243087=_0xe66be8;_0x2919d3=0xc8;}else{_0x2919d3=0xce;}_0x4083d8['status'](_0x2919d3);return _0x4083d8[_0xea70('0x30')](_0xea70('0x31'),_0x9485f2+'-'+_0x243087+'/'+_0xe66be8)['json'](_0x215707);}return null;};}function patchUpdates(_0xfe8c66){return function(_0x332a5d){try{jsonpatch[_0xea70('0x32')](_0x332a5d,_0xfe8c66,!![]);}catch(_0x1a951a){return BPromise[_0xea70('0x33')](_0x1a951a);}return _0x332a5d['save']();};}function saveUpdates(_0x3fe6aa,_0x28b304){return function(_0x42618a){if(_0x42618a){return _0x42618a['update'](_0x3fe6aa)[_0xea70('0x34')](function(_0xdd629e){return _0xdd629e;});}return null;};}function removeEntity(_0x37a8b9,_0x579561){return function(_0x130e7b){if(_0x130e7b){return _0x130e7b['destroy']()[_0xea70('0x34')](function(){var _0x3b350f=_0x130e7b[_0xea70('0x35')]({'plain':!![]});var _0x3ba9e9='ChatQueues';return db[_0xea70('0x36')][_0xea70('0x37')]({'where':{'type':_0x3ba9e9,'resourceId':_0x3b350f['id']}})[_0xea70('0x34')](function(){return _0x130e7b;});})[_0xea70('0x34')](function(){_0x37a8b9[_0xea70('0x29')](0xcc)[_0xea70('0x2a')]();});}};}function handleEntityNotFound(_0x2ad6c2,_0x4bd078){return function(_0x59a7ef){if(!_0x59a7ef){_0x2ad6c2[_0xea70('0x38')](0x194);}return _0x59a7ef;};}function handleError(_0x100118,_0x18e87d){_0x18e87d=_0x18e87d||0x1f4;return function(_0x3ad920){logger[_0xea70('0x24')](_0x3ad920[_0xea70('0x39')]);if(_0x3ad920[_0xea70('0x3a')]){delete _0x3ad920[_0xea70('0x3a')];}_0x100118[_0xea70('0x29')](_0x18e87d)[_0xea70('0x3b')](_0x3ad920);};}exports[_0xea70('0x3c')]=function(_0x21eca2,_0x2c589e){var _0x8b4aca={},_0x40b284={},_0x43ad0c={'count':0x0,'rows':[]};var _0x3ca589=_[_0xea70('0x3d')](db[_0xea70('0x3e')]['rawAttributes'],function(_0x290b6c){return{'name':_0x290b6c[_0xea70('0x3f')],'type':_0x290b6c[_0xea70('0x40')][_0xea70('0x41')]};});_0x40b284[_0xea70('0x42')]=_[_0xea70('0x3d')](_0x3ca589,_0xea70('0x3a'));_0x40b284[_0xea70('0x43')]=_[_0xea70('0x44')](_0x21eca2['query']);_0x40b284[_0xea70('0x45')]=_['intersection'](_0x40b284[_0xea70('0x42')],_0x40b284[_0xea70('0x43')]);_0x8b4aca['attributes']=_[_0xea70('0x46')](_0x40b284['model'],qs['fields'](_0x21eca2['query'][_0xea70('0x47')]));_0x8b4aca['attributes']=_0x8b4aca[_0xea70('0x48')]['length']?_0x8b4aca[_0xea70('0x48')]:_0x40b284['model'];if(!_0x21eca2[_0xea70('0x43')][_0xea70('0x49')]('nolimit')){_0x8b4aca[_0xea70('0x2e')]=qs[_0xea70('0x2e')](_0x21eca2[_0xea70('0x43')][_0xea70('0x2e')]);_0x8b4aca[_0xea70('0x2c')]=qs[_0xea70('0x2c')](_0x21eca2[_0xea70('0x43')][_0xea70('0x2c')]);}_0x8b4aca[_0xea70('0x4a')]=qs[_0xea70('0x4b')](_0x21eca2[_0xea70('0x43')][_0xea70('0x4b')]);_0x8b4aca[_0xea70('0x4c')]=qs[_0xea70('0x45')](_[_0xea70('0x4d')](_0x21eca2['query'],_0x40b284['filters']),_0x3ca589);if(_0x21eca2[_0xea70('0x43')][_0xea70('0x4e')]){_0x8b4aca[_0xea70('0x4c')]=_[_0xea70('0x4f')](_0x8b4aca[_0xea70('0x4c')],{'$or':_[_0xea70('0x3d')](_0x3ca589,function(_0x493322){if(_0x493322[_0xea70('0x40')]!=='VIRTUAL'){var _0x3fcf77={};_0x3fcf77[_0x493322[_0xea70('0x3a')]]={'$like':'%'+_0x21eca2[_0xea70('0x43')]['filter']+'%'};return _0x3fcf77;}})});}_0x8b4aca=_['merge']({},_0x8b4aca,_0x21eca2['options']);var _0x46a23b={'where':_0x8b4aca[_0xea70('0x4c')]};return db['ChatQueue']['count'](_0x46a23b)[_0xea70('0x34')](function(_0x283656){_0x43ad0c[_0xea70('0x2f')]=_0x283656;if(_0x21eca2[_0xea70('0x43')][_0xea70('0x50')]){_0x8b4aca[_0xea70('0x51')]=[{'all':!![]}];}return db[_0xea70('0x3e')][_0xea70('0x52')](_0x8b4aca);})[_0xea70('0x34')](function(_0x575cf7){_0x43ad0c[_0xea70('0x53')]=_0x575cf7;return _0x43ad0c;})[_0xea70('0x34')](respondWithFilteredResult(_0x2c589e,_0x8b4aca))[_0xea70('0x54')](handleError(_0x2c589e,null));};exports[_0xea70('0x55')]=function(_0x340038,_0x2aa83f){var _0x5b99ad={'raw':!![],'where':{'id':_0x340038[_0xea70('0x56')]['id']}},_0x186679={};_0x186679[_0xea70('0x42')]=_[_0xea70('0x44')](db['ChatQueue']['rawAttributes']);_0x186679[_0xea70('0x43')]=_[_0xea70('0x44')](_0x340038['query']);_0x186679['filters']=_['intersection'](_0x186679['model'],_0x186679[_0xea70('0x43')]);_0x5b99ad[_0xea70('0x48')]=_['intersection'](_0x186679['model'],qs[_0xea70('0x47')](_0x340038[_0xea70('0x43')]['fields']));_0x5b99ad[_0xea70('0x48')]=_0x5b99ad['attributes'][_0xea70('0x57')]?_0x5b99ad[_0xea70('0x48')]:_0x186679[_0xea70('0x42')];if(_0x340038[_0xea70('0x43')][_0xea70('0x50')]){_0x5b99ad['include']=[{'all':!![]}];}_0x5b99ad=_[_0xea70('0x4f')]({},_0x5b99ad,_0x340038[_0xea70('0x58')]);return db[_0xea70('0x3e')][_0xea70('0x59')](_0x5b99ad)[_0xea70('0x34')](handleEntityNotFound(_0x2aa83f,null))[_0xea70('0x34')](respondWithResult(_0x2aa83f,null))[_0xea70('0x54')](handleError(_0x2aa83f,null));};exports['create']=function(_0x3eba53,_0x14a55a){return db[_0xea70('0x3e')][_0xea70('0x5a')](_0x3eba53['body'],{})['then'](function(_0x27c6cd){var _0x54d0d1=_0x3eba53[_0xea70('0x5b')][_0xea70('0x35')]({'plain':!![]});if(!_0x54d0d1)throw new Error(_0xea70('0x5c'));if(_0x54d0d1[_0xea70('0x5d')]==='user'){var _0x5d415c=_0x27c6cd['get']({'plain':!![]});var _0x1109f0=_0xea70('0x5e');return db[_0xea70('0x5f')]['find']({'where':{'name':_0x1109f0,'userProfileId':_0x54d0d1[_0xea70('0x60')]},'raw':!![]})[_0xea70('0x34')](function(_0x160c33){if(_0x160c33&&_0x160c33[_0xea70('0x61')]===0x0){return db['UserProfileResource'][_0xea70('0x5a')]({'name':_0x5d415c[_0xea70('0x3a')],'resourceId':_0x5d415c['id'],'type':_0x160c33[_0xea70('0x3a')],'sectionId':_0x160c33['id']},{})[_0xea70('0x34')](function(){return _0x27c6cd;});}else{return _0x27c6cd;}})[_0xea70('0x54')](function(_0x29af5e){logger['error'](_0xea70('0x62'),_0x29af5e);throw _0x29af5e;});}return _0x27c6cd;})[_0xea70('0x34')](respondWithResult(_0x14a55a,0xc9))[_0xea70('0x54')](handleError(_0x14a55a,null));};exports[_0xea70('0x63')]=function(_0x56c453,_0x45cbdc){if(_0x56c453[_0xea70('0x64')]['id']){delete _0x56c453[_0xea70('0x64')]['id'];}return db['ChatQueue'][_0xea70('0x59')]({'where':{'id':_0x56c453[_0xea70('0x56')]['id']}})[_0xea70('0x34')](handleEntityNotFound(_0x45cbdc,null))[_0xea70('0x34')](saveUpdates(_0x56c453[_0xea70('0x64')],null))['then'](respondWithResult(_0x45cbdc,null))[_0xea70('0x54')](handleError(_0x45cbdc,null));};exports[_0xea70('0x37')]=function(_0x28aa68,_0x44950f){return db[_0xea70('0x3e')][_0xea70('0x59')]({'where':{'id':_0x28aa68['params']['id']}})[_0xea70('0x34')](handleEntityNotFound(_0x44950f,null))['then'](removeEntity(_0x44950f,null))[_0xea70('0x54')](handleError(_0x44950f,null));};exports[_0xea70('0x65')]=function(_0x40fb63,_0x244f5d){return db[_0xea70('0x3e')]['describe']()[_0xea70('0x34')](respondWithResult(_0x244f5d,null))[_0xea70('0x54')](handleError(_0x244f5d,null));};exports[_0xea70('0x66')]=function(_0x5e3eaf,_0x55e055,_0x351cb2){var _0x3314f9={'raw':!![],'where':{}},_0x1937ea={},_0x2b20a8;return db[_0xea70('0x3e')]['findOne']({'where':{'id':_0x5e3eaf['params']['id']}})[_0xea70('0x34')](handleEntityNotFound(_0x55e055,null))[_0xea70('0x34')](function(_0x5cf62e){if(_0x5cf62e){_0x2b20a8=_0x5cf62e['get']({'plain':!![]});_0x1937ea['model']=_[_0xea70('0x44')](db[_0xea70('0x67')]['rawAttributes']);_0x1937ea['query']=_['keys'](_0x5e3eaf['query']);_0x1937ea[_0xea70('0x45')]=_[_0xea70('0x46')](_0x1937ea[_0xea70('0x42')],_0x1937ea[_0xea70('0x43')]);_0x3314f9[_0xea70('0x48')]=_['intersection'](_0x1937ea[_0xea70('0x42')],qs[_0xea70('0x47')](_0x5e3eaf['query']['fields']));_0x3314f9['attributes']=_0x3314f9[_0xea70('0x48')][_0xea70('0x57')]?_0x3314f9[_0xea70('0x48')]:_0x1937ea[_0xea70('0x42')];if(!_0x5e3eaf[_0xea70('0x43')][_0xea70('0x49')](_0xea70('0x68'))){_0x3314f9[_0xea70('0x2e')]=qs[_0xea70('0x2e')](_0x5e3eaf[_0xea70('0x43')]['limit']);_0x3314f9[_0xea70('0x2c')]=qs[_0xea70('0x2c')](_0x5e3eaf[_0xea70('0x43')][_0xea70('0x2c')]);}_0x3314f9[_0xea70('0x4a')]=qs['sort'](_0x5e3eaf[_0xea70('0x43')][_0xea70('0x4b')]);_0x3314f9[_0xea70('0x4c')]=qs[_0xea70('0x45')](_['pick'](_0x5e3eaf['query'],_0x1937ea['filters']));_0x3314f9[_0xea70('0x4c')][_0xea70('0x69')]=_0x5cf62e['id'];if(_0x5e3eaf[_0xea70('0x43')][_0xea70('0x4e')]){_0x3314f9[_0xea70('0x4c')]=_['merge'](_0x3314f9[_0xea70('0x4c')],{'$or':_['map'](_0x3314f9[_0xea70('0x48')],function(_0x2a7c51){var _0x230c2a={};_0x230c2a[_0x2a7c51]={'$like':'%'+_0x5e3eaf[_0xea70('0x43')]['filter']+'%'};return _0x230c2a;})});}_0x3314f9=_['merge']({},_0x3314f9,_0x5e3eaf[_0xea70('0x58')]);return db[_0xea70('0x67')][_0xea70('0x52')](_0x3314f9);}})[_0xea70('0x34')](function(_0x2f4d56){if(_0x2f4d56){return db[_0xea70('0x6a')][_0xea70('0x6b')]({'where':{'id':_[_0xea70('0x3d')](_0x2f4d56,_0xea70('0x6c')),'role':'agent'},'attributes':['id',_0xea70('0x3a'),_0xea70('0x6d'),_0xea70('0x6e'),'createdAt']});}})[_0xea70('0x34')](function(_0x41c9d4){if(_0x41c9d4){return{'count':_0x41c9d4['count'],'rows':_[_0xea70('0x3d')](_0x41c9d4[_0xea70('0x53')],function(_0x3245e4){return{'membername':_0x3245e4[_0xea70('0x3a')],'UserId':_0x3245e4['id'],'queue_name':_0x2b20a8[_0xea70('0x3a')],'ChatQueueId':_0x2b20a8['id'],'interface':util[_0xea70('0x6f')](_0xea70('0x70'),_0xea70('0x71'),_0x3245e4['name']),'penalty':0x0,'paused':_0x3245e4[_0xea70('0x6d')],'createdAt':_0x3245e4[_0xea70('0x72')],'updatedAt':_0x3245e4[_0xea70('0x6e')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xea70('0x34')](respondWithFilteredResult(_0x55e055,_0x3314f9))[_0xea70('0x54')](handleError(_0x55e055,null));};exports[_0xea70('0x73')]=function(_0x4b3975,_0x377704,_0x1762d1){var _0x120b59={};var _0x3537c6={};var _0x3cea6d;var _0x3623d4;return db[_0xea70('0x3e')]['findOne']({'where':{'id':_0x4b3975['params']['id']}})[_0xea70('0x34')](handleEntityNotFound(_0x377704,null))[_0xea70('0x34')](function(_0x1af8fd){if(_0x1af8fd){_0x3cea6d=_0x1af8fd;_0x3537c6['model']=_[_0xea70('0x44')](db[_0xea70('0x74')]['rawAttributes']);_0x3537c6[_0xea70('0x43')]=_[_0xea70('0x44')](_0x4b3975[_0xea70('0x43')]);_0x3537c6[_0xea70('0x45')]=_[_0xea70('0x46')](_0x3537c6[_0xea70('0x42')],_0x3537c6[_0xea70('0x43')]);_0x120b59[_0xea70('0x48')]=_[_0xea70('0x46')](_0x3537c6['model'],qs[_0xea70('0x47')](_0x4b3975['query'][_0xea70('0x47')]));_0x120b59[_0xea70('0x48')]=_0x120b59[_0xea70('0x48')][_0xea70('0x57')]?_0x120b59[_0xea70('0x48')]:_0x3537c6['model'];_0x120b59['order']=qs[_0xea70('0x4b')](_0x4b3975[_0xea70('0x43')][_0xea70('0x4b')]);_0x120b59['where']=qs[_0xea70('0x45')](_['pick'](_0x4b3975[_0xea70('0x43')],_0x3537c6[_0xea70('0x45')]));if(_0x4b3975['query'][_0xea70('0x4e')]){_0x120b59[_0xea70('0x4c')]=_[_0xea70('0x4f')](_0x120b59[_0xea70('0x4c')],{'$or':_[_0xea70('0x3d')](_0x120b59['attributes'],function(_0x38a7dd){var _0x29e914={};_0x29e914[_0x38a7dd]={'$like':'%'+_0x4b3975['query'][_0xea70('0x4e')]+'%'};return _0x29e914;})});}_0x120b59=_[_0xea70('0x4f')]({},_0x120b59,_0x4b3975[_0xea70('0x58')]);return _0x3cea6d['getTeams'](_0x120b59);}})[_0xea70('0x34')](function(_0x33e60d){if(_0x33e60d){_0x3623d4=_0x33e60d[_0xea70('0x57')];if(!_0x4b3975[_0xea70('0x43')][_0xea70('0x49')](_0xea70('0x68'))){_0x120b59['limit']=qs[_0xea70('0x2e')](_0x4b3975['query'][_0xea70('0x2e')]);_0x120b59['offset']=qs['offset'](_0x4b3975['query'][_0xea70('0x2c')]);}return _0x3cea6d['getTeams'](_0x120b59);}})['then'](function(_0x4ed4b6){if(_0x4ed4b6){return _0x4ed4b6?{'count':_0x3623d4,'rows':_0x4ed4b6}:null;}})[_0xea70('0x34')](respondWithResult(_0x377704,null))[_0xea70('0x54')](handleError(_0x377704,null));};exports[_0xea70('0x75')]=function(_0x2e29c6,_0x5155bd,_0x25c817){var _0xe597a9=_0x2e29c6[_0xea70('0x64')][_0xea70('0x76')];return db[_0xea70('0x74')][_0xea70('0x52')]({'where':{'id':_0xe597a9},'attributes':['id'],'include':[{'model':db[_0xea70('0x6a')],'as':_0xea70('0x77'),'attributes':['id','name',_0xea70('0x78'),'voicePause',_0xea70('0x79')],'raw':!![]}]})[_0xea70('0x34')](function(_0x1095e8){if(_0x1095e8){var _0x52391f=_[_0xea70('0x7a')](_0x1095e8,function(_0x47d1d9){var _0x3b6428=_0x47d1d9[_0xea70('0x35')]({'plain':!![]});return _0x3b6428[_0xea70('0x77')];});return db[_0xea70('0x3e')][_0xea70('0x59')]({'where':{'id':_0x2e29c6[_0xea70('0x56')]['id']}})['then'](function(_0x210302){return db['sequelize'][_0xea70('0x7b')](function(_0x5eb32d){return _0x210302[_0xea70('0x75')](_0xe597a9,{'transaction':_0x5eb32d})[_0xea70('0x34')](function(){return BPromise[_0xea70('0x7c')](_0x52391f,function(_0x1346d8){return db['UserChatQueue'][_0xea70('0x7d')]({'where':{'UserId':_0x1346d8['id'],'ChatQueueId':_0x2e29c6[_0xea70('0x56')]['id']},'transaction':_0x5eb32d});});})[_0xea70('0x34')](function(){_0x52391f[_0xea70('0x7e')](function(_0x55ba65){socket['emit']('userChatQueue:save',{'UserId':_0x55ba65['id'],'ChatQueueId':_0x210302['id']});});});});});}})[_0xea70('0x34')](respondWithStatusCode(_0x5155bd,null))[_0xea70('0x54')](handleError(_0x5155bd,null));};exports['removeTeams']=function(_0x29cf95,_0x59ecb1,_0xcd3ac9){return db['Team'][_0xea70('0x52')]({'where':{'id':_0x29cf95[_0xea70('0x43')][_0xea70('0x76')]},'attributes':['id'],'include':[{'model':db[_0xea70('0x6a')],'as':_0xea70('0x77'),'attributes':['id'],'raw':!![]}]})[_0xea70('0x34')](handleEntityNotFound(_0x59ecb1,null))[_0xea70('0x34')](function(_0x79428d){var _0x3658eb=_['map'](_0x79428d,'id');var _0xb1401e=[];var _0x197087=[];var _0x365921=squel['select']();_0x365921[_0xea70('0x7f')](_0xea70('0x80'))[_0xea70('0x81')](_0xea70('0x82'),'tq')['join'](_0xea70('0x83'),'ut',_0xea70('0x84'))[_0xea70('0x4c')]('ChatQueueId\x20=\x20?',_0x29cf95['params']['id']);for(var _0x12d150=0x0;_0x12d150<_0x79428d[_0xea70('0x57')];_0x12d150+=0x1){let _0x22cc62=_0x79428d[_0x12d150];for(var _0x234523=0x0;_0x234523<_0x22cc62[_0xea70('0x77')][_0xea70('0x57')];_0x234523+=0x1){let _0x144a28=_0x22cc62[_0xea70('0x77')][_0x234523];var _0x1a6380=_0x365921[_0xea70('0x85')]();_0x1a6380[_0xea70('0x4c')](_0xea70('0x86'),_0x144a28['id']);_0x197087[_0xea70('0x87')](db[_0xea70('0x88')][_0xea70('0x43')](_0x1a6380[_0xea70('0x89')](),{'type':db[_0xea70('0x88')]['QueryTypes'][_0xea70('0x8a')]})['then'](function(_0x153fcf){if(_0x153fcf[_0xea70('0x57')]===0x1){return _0x144a28['id'];}else{var _0x20d780=_[_0xea70('0x8b')](_['map'](_0x153fcf,_0xea70('0x8c')),function(_0x455799){return _[_0xea70('0x8d')](_0x3658eb,_0x455799);});if(_0x20d780){return _0x144a28['id'];}}}));}}return BPromise[_0xea70('0x8e')](_0x197087)[_0xea70('0x34')](function(_0x5f4d47){_0xb1401e=_(_0xb1401e)['union'](_0x5f4d47)[_0xea70('0x8f')]()[_0xea70('0x90')]();return db[_0xea70('0x3e')][_0xea70('0x59')]({'where':{'id':_0x29cf95[_0xea70('0x56')]['id']}})[_0xea70('0x34')](function(_0x5a96bb){return db[_0xea70('0x88')][_0xea70('0x7b')](function(_0x5c5fc2){return _0x5a96bb[_0xea70('0x91')](_0x29cf95[_0xea70('0x43')][_0xea70('0x76')],{'transaction':_0x5c5fc2})['then'](function(){if(!_['isEmpty'](_0xb1401e)){return _0x5a96bb[_0xea70('0x92')](_0xb1401e,{'transaction':_0x5c5fc2});}})[_0xea70('0x34')](function(){_0xb1401e[_0xea70('0x7e')](function(_0x41f9f6){socket['emit'](_0xea70('0x93'),{'UserId':_0x41f9f6,'ChatQueueId':_0x5a96bb['id']});});});});});});})[_0xea70('0x34')](respondWithStatusCode(_0x59ecb1,null))[_0xea70('0x54')](handleError(_0x59ecb1,null));};exports['addAgents']=function(_0x208198,_0x23633e,_0x24c266){return db[_0xea70('0x3e')][_0xea70('0x59')]({'where':{'id':_0x208198[_0xea70('0x56')]['id']}})[_0xea70('0x34')](handleEntityNotFound(_0x23633e,null))['then'](function(_0x30fd95){if(_0x30fd95){return _0x30fd95[_0xea70('0x94')](_0x208198[_0xea70('0x64')][_0xea70('0x76')],_[_0xea70('0x95')](_0x208198[_0xea70('0x64')],[_0xea70('0x76'),'id'])||{})[_0xea70('0x96')](function(_0x419f8c){for(var _0x2e5651=0x0;_0x2e5651<_0x208198[_0xea70('0x64')][_0xea70('0x76')]['length'];_0x2e5651+=0x1){socket['emit'](_0xea70('0x97'),{'UserId':Number(_0x208198[_0xea70('0x64')][_0xea70('0x76')][_0x2e5651]),'ChatQueueId':Number(_0x208198[_0xea70('0x56')]['id'])});}return _0x419f8c;});}})[_0xea70('0x34')](respondWithResult(_0x23633e,null))[_0xea70('0x54')](handleError(_0x23633e,null));};exports[_0xea70('0x92')]=function(_0x41c732,_0x226d66,_0x2fa9de){return db[_0xea70('0x3e')][_0xea70('0x59')]({'where':{'id':_0x41c732[_0xea70('0x56')]['id']}})['then'](handleEntityNotFound(_0x226d66,null))[_0xea70('0x34')](function(_0x6955db){if(_0x6955db){return _0x6955db[_0xea70('0x92')](_0x41c732[_0xea70('0x43')][_0xea70('0x76')])[_0xea70('0x34')](function(){if(_[_0xea70('0x98')](_0x41c732['query'][_0xea70('0x76')])){for(var _0x9552a5=0x0;_0x9552a5<_0x41c732[_0xea70('0x43')][_0xea70('0x76')][_0xea70('0x57')];_0x9552a5+=0x1){socket['emit']('userChatQueue:remove',{'UserId':Number(_0x41c732[_0xea70('0x43')][_0xea70('0x76')][_0x9552a5]),'ChatQueueId':Number(_0x41c732[_0xea70('0x56')]['id'])});}}else{socket[_0xea70('0x99')]('userChatQueue:remove',{'UserId':Number(_0x41c732['query'][_0xea70('0x76')]),'ChatQueueId':Number(_0x41c732[_0xea70('0x56')]['id'])});}});}})[_0xea70('0x34')](respondWithStatusCode(_0x226d66,null))[_0xea70('0x54')](handleError(_0x226d66,null));};exports[_0xea70('0x9a')]=function(_0x2fc519,_0x345db7,_0x5d5315){var _0x19623f={};var _0xe4905b={};var _0x524d37;var _0x5799f4;return db[_0xea70('0x3e')]['findOne']({'where':{'id':_0x2fc519[_0xea70('0x56')]['id']}})[_0xea70('0x34')](handleEntityNotFound(_0x345db7,null))[_0xea70('0x34')](function(_0x1eff33){if(_0x1eff33){_0x524d37=_0x1eff33;_0xe4905b['model']=_['keys'](db[_0xea70('0x6a')][_0xea70('0x9b')]);_0xe4905b[_0xea70('0x43')]=_[_0xea70('0x44')](_0x2fc519['query']);_0xe4905b[_0xea70('0x45')]=_[_0xea70('0x46')](_0xe4905b[_0xea70('0x42')],_0xe4905b['query']);_0x19623f[_0xea70('0x48')]=_[_0xea70('0x46')](_0xe4905b[_0xea70('0x42')],qs[_0xea70('0x47')](_0x2fc519['query'][_0xea70('0x47')]));_0x19623f[_0xea70('0x48')]=_0x19623f['attributes']['length']?_0x19623f['attributes']:_0xe4905b[_0xea70('0x42')];_0x19623f[_0xea70('0x4a')]=qs[_0xea70('0x4b')](_0x2fc519[_0xea70('0x43')][_0xea70('0x4b')]);_0x19623f[_0xea70('0x4c')]=qs[_0xea70('0x45')](_['pick'](_0x2fc519[_0xea70('0x43')],_0xe4905b[_0xea70('0x45')]));if(_0x2fc519['query']['filter']){_0x19623f[_0xea70('0x4c')]=_['merge'](_0x19623f[_0xea70('0x4c')],{'$or':_[_0xea70('0x3d')](_0x19623f[_0xea70('0x48')],function(_0x13241c){var _0x18d461={};_0x18d461[_0x13241c]={'$like':'%'+_0x2fc519[_0xea70('0x43')]['filter']+'%'};return _0x18d461;})});}_0x19623f=_['merge']({},_0x19623f,_0x2fc519['options']);return _0x524d37[_0xea70('0x9a')](_0x19623f);}})[_0xea70('0x34')](function(_0x575be3){if(_0x575be3){_0x5799f4=_0x575be3[_0xea70('0x57')];if(!_0x2fc519[_0xea70('0x43')][_0xea70('0x49')](_0xea70('0x68'))){_0x19623f[_0xea70('0x2e')]=qs[_0xea70('0x2e')](_0x2fc519['query'][_0xea70('0x2e')]);_0x19623f[_0xea70('0x2c')]=qs[_0xea70('0x2c')](_0x2fc519[_0xea70('0x43')]['offset']);}return _0x524d37[_0xea70('0x9a')](_0x19623f);}})[_0xea70('0x34')](function(_0x367786){if(_0x367786){return _0x367786?{'count':_0x5799f4,'rows':_0x367786}:null;}})['then'](respondWithResult(_0x345db7,null))[_0xea70('0x54')](handleError(_0x345db7,null));}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.events.js b/server/api/chatQueue/chatQueue.events.js index e79c28b..c2eac07 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 _0x4283=['setMaxListeners','save','remove','hasOwnProperty','hook','events'];(function(_0x14866a,_0x127ada){var _0x40b973=function(_0x34bad3){while(--_0x34bad3){_0x14866a['push'](_0x14866a['shift']());}};_0x40b973(++_0x127ada);}(_0x4283,0x119));var _0x3428=function(_0x16806e,_0x4d52c4){_0x16806e=_0x16806e-0x0;var _0x553909=_0x4283[_0x16806e];return _0x553909;};'use strict';var EventEmitter=require(_0x3428('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x3428('0x1')](0x0);var events={'afterCreate':_0x3428('0x2'),'afterUpdate':'update','afterDestroy':_0x3428('0x3')};function emitEvent(_0x19fe15){return function(_0xa7f10e,_0x5eceda,_0x445574){ChatQueueEvents['emit'](_0x19fe15+':'+_0xa7f10e['id'],_0xa7f10e);ChatQueueEvents['emit'](_0x19fe15,_0xa7f10e);_0x445574(null);};}for(var e in events){if(events[_0x3428('0x4')](e)){var event=events[e];ChatQueue[_0x3428('0x5')](e,emitEvent(event));}}module['exports']=ChatQueueEvents; \ No newline at end of file +var _0x32c3=['setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x288949,_0x54a8c2){var _0x4e4953=function(_0x25b1c0){while(--_0x25b1c0){_0x288949['push'](_0x288949['shift']());}};_0x4e4953(++_0x54a8c2);}(_0x32c3,0xfb));var _0x332c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x32c3[_0x14add3];return _0x4a174f;};'use strict';var EventEmitter=require(_0x332c('0x0'));var ChatQueue=require('../../mysqldb')['db']['ChatQueue'];var ChatQueueEvents=new EventEmitter();ChatQueueEvents[_0x332c('0x1')](0x0);var events={'afterCreate':_0x332c('0x2'),'afterUpdate':_0x332c('0x3'),'afterDestroy':_0x332c('0x4')};function emitEvent(_0x135bd0){return function(_0x3c2159,_0x5f36bf,_0x300afd){ChatQueueEvents[_0x332c('0x5')](_0x135bd0+':'+_0x3c2159['id'],_0x3c2159);ChatQueueEvents['emit'](_0x135bd0,_0x3c2159);_0x300afd(null);};}for(var e in events){if(events[_0x332c('0x6')](e)){var event=events[e];ChatQueue[_0x332c('0x7')](e,emitEvent(event));}}module[_0x332c('0x8')]=ChatQueueEvents; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.model.js b/server/api/chatQueue/chatQueue.model.js index 6aabe75..ea2a3da 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 _0x9258=['ChatQueue','chat_queues','lodash','util','../../config/logger','bluebird','path','../../config/environment','./chatQueue.attributes','exports'];(function(_0x478618,_0x484e97){var _0x3e1d5a=function(_0x5ceaed){while(--_0x5ceaed){_0x478618['push'](_0x478618['shift']());}};_0x3e1d5a(++_0x484e97);}(_0x9258,0xc0));var _0x8925=function(_0x44bcca,_0x494157){_0x44bcca=_0x44bcca-0x0;var _0x1becb6=_0x9258[_0x44bcca];return _0x1becb6;};'use strict';var _=require(_0x8925('0x0'));var util=require(_0x8925('0x1'));var logger=require(_0x8925('0x2'))('api');var moment=require('moment');var BPromise=require(_0x8925('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8925('0x4'));var rimraf=require('rimraf');var config=require(_0x8925('0x5'));var attributes=require(_0x8925('0x6'));module[_0x8925('0x7')]=function(_0x1ce2f0,_0x17d797){return _0x1ce2f0['define'](_0x8925('0x8'),attributes,{'tableName':_0x8925('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x11bd=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./chatQueue.attributes','exports','define','ChatQueue','lodash','util'];(function(_0x3914e6,_0x1147ab){var _0x313082=function(_0x38acc6){while(--_0x38acc6){_0x3914e6['push'](_0x3914e6['shift']());}};_0x313082(++_0x1147ab);}(_0x11bd,0x1d2));var _0xd11b=function(_0x2afde7,_0x3ef21d){_0x2afde7=_0x2afde7-0x0;var _0x45fd31=_0x11bd[_0x2afde7];return _0x45fd31;};'use strict';var _=require(_0xd11b('0x0'));var util=require(_0xd11b('0x1'));var logger=require(_0xd11b('0x2'))(_0xd11b('0x3'));var moment=require(_0xd11b('0x4'));var BPromise=require(_0xd11b('0x5'));var rp=require(_0xd11b('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xd11b('0x7'));var config=require(_0xd11b('0x8'));var attributes=require(_0xd11b('0x9'));module[_0xd11b('0xa')]=function(_0x1b76f8,_0x389516){return _0x1b76f8[_0xd11b('0xb')](_0xd11b('0xc'),attributes,{'tableName':'chat_queues','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 108b173..9608854 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 _0x8ff4=['include','map','model','attributes','ShowChatQueue','find','catch','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','request\x20sent','debug','ChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetChatQueue','ChatQueue','options','raw','where'];(function(_0x4e9628,_0x250573){var _0x27bc8c=function(_0xb3b7ae){while(--_0xb3b7ae){_0x4e9628['push'](_0x4e9628['shift']());}};_0x27bc8c(++_0x250573);}(_0x8ff4,0x11f));var _0x48ff=function(_0x2786ea,_0x16c3c3){_0x2786ea=_0x2786ea-0x0;var _0x5c38e5=_0x8ff4[_0x2786ea];return _0x5c38e5;};'use strict';var _=require(_0x48ff('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x48ff('0x1'));var rs=require(_0x48ff('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x48ff('0x3'))['db'];var utils=require(_0x48ff('0x4'));var logger=require(_0x48ff('0x5'))(_0x48ff('0x6'));var config=require(_0x48ff('0x7'));var jayson=require(_0x48ff('0x8'));var client=jayson[_0x48ff('0x9')][_0x48ff('0xa')]({'port':0x232a});config[_0x48ff('0xb')]=_[_0x48ff('0xc')](config[_0x48ff('0xb')],{'host':_0x48ff('0xd'),'port':0x18eb});var socket=require(_0x48ff('0xe'))(new Redis(config[_0x48ff('0xb')]));require('./chatQueue.socket')[_0x48ff('0xf')](socket);function respondWithRpcPromise(_0x312c3f,_0x5eb71f,_0x37027d){return new BPromise(function(_0x140a23,_0x5754e1){return client[_0x48ff('0x10')](_0x312c3f,_0x37027d)[_0x48ff('0x11')](function(_0x5a3f0a){logger[_0x48ff('0x12')](_0x48ff('0x13'),_0x5eb71f,_0x48ff('0x14'));logger[_0x48ff('0x15')](_0x48ff('0x16'),_0x5eb71f,_0x48ff('0x14'),JSON[_0x48ff('0x17')](_0x5a3f0a));if(_0x5a3f0a[_0x48ff('0x18')]){if(_0x5a3f0a[_0x48ff('0x18')][_0x48ff('0x19')]===0x1f4){logger[_0x48ff('0x18')](_0x48ff('0x13'),_0x5eb71f,_0x5a3f0a[_0x48ff('0x18')][_0x48ff('0x1a')]);return _0x5754e1(_0x5a3f0a['error'][_0x48ff('0x1a')]);}logger[_0x48ff('0x18')]('ChatQueue,\x20%s,\x20%s',_0x5eb71f,_0x5a3f0a[_0x48ff('0x18')][_0x48ff('0x1a')]);return _0x140a23(_0x5a3f0a[_0x48ff('0x18')]['message']);}else{logger[_0x48ff('0x12')](_0x48ff('0x13'),_0x5eb71f,'request\x20sent');_0x140a23(_0x5a3f0a[_0x48ff('0x1b')][_0x48ff('0x1a')]);}})['catch'](function(_0x24d4fb){logger[_0x48ff('0x18')]('ChatQueue,\x20%s,\x20%s',_0x5eb71f,_0x24d4fb);_0x5754e1(_0x24d4fb);});});}exports[_0x48ff('0x1c')]=function(_0x1a4111){var _0x2fe32f=this;return new Promise(function(_0x55bc40,_0x57c773){return db[_0x48ff('0x1d')]['findAll']({'raw':_0x1a4111[_0x48ff('0x1e')]?_0x1a4111[_0x48ff('0x1e')][_0x48ff('0x1f')]===undefined?!![]:![]:!![],'where':_0x1a4111[_0x48ff('0x1e')]?_0x1a4111[_0x48ff('0x1e')][_0x48ff('0x20')]||null:null,'attributes':_0x1a4111[_0x48ff('0x1e')]?_0x1a4111[_0x48ff('0x1e')]['attributes']||null:null,'limit':_0x1a4111[_0x48ff('0x1e')]?_0x1a4111[_0x48ff('0x1e')]['limit']||null:null,'include':_0x1a4111[_0x48ff('0x1e')]?_0x1a4111[_0x48ff('0x1e')][_0x48ff('0x21')]?_[_0x48ff('0x22')](_0x1a4111[_0x48ff('0x1e')][_0x48ff('0x21')],function(_0x4ff1b7){return{'model':db[_0x4ff1b7[_0x48ff('0x23')]],'as':_0x4ff1b7['as'],'attributes':_0x4ff1b7[_0x48ff('0x24')],'include':_0x4ff1b7['include']?_[_0x48ff('0x22')](_0x4ff1b7[_0x48ff('0x21')],function(_0x39088f){return{'model':db[_0x39088f[_0x48ff('0x23')]],'as':_0x39088f['as'],'attributes':_0x39088f[_0x48ff('0x24')],'include':_0x39088f[_0x48ff('0x21')]?_[_0x48ff('0x22')](_0x39088f[_0x48ff('0x21')],function(_0x2b92ad){return{'model':db[_0x2b92ad[_0x48ff('0x23')]],'as':_0x2b92ad['as'],'attributes':_0x2b92ad[_0x48ff('0x24')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x34def7){logger[_0x48ff('0x12')](_0x48ff('0x1c'),_0x1a4111);logger[_0x48ff('0x15')]('GetChatQueue',_0x1a4111,JSON[_0x48ff('0x17')](_0x34def7));_0x55bc40(_0x34def7);})['catch'](function(_0x2c9185){logger['error'](_0x48ff('0x1c'),_0x2c9185[_0x48ff('0x1a')],_0x1a4111);_0x57c773(_0x2fe32f[_0x48ff('0x18')](0x1f4,_0x2c9185[_0x48ff('0x1a')]));});});};exports[_0x48ff('0x25')]=function(_0x182289){var _0x536eb4=this;return new Promise(function(_0x31f896,_0x6fa03c){return db[_0x48ff('0x1d')][_0x48ff('0x26')]({'raw':_0x182289[_0x48ff('0x1e')]?_0x182289[_0x48ff('0x1e')][_0x48ff('0x1f')]===undefined?!![]:![]:!![],'where':_0x182289['options']?_0x182289[_0x48ff('0x1e')][_0x48ff('0x20')]||null:null,'attributes':_0x182289['options']?_0x182289[_0x48ff('0x1e')][_0x48ff('0x24')]||null:null,'include':_0x182289[_0x48ff('0x1e')]?_0x182289[_0x48ff('0x1e')][_0x48ff('0x21')]?_[_0x48ff('0x22')](_0x182289[_0x48ff('0x1e')][_0x48ff('0x21')],function(_0x36100d){return{'model':db[_0x36100d[_0x48ff('0x23')]],'as':_0x36100d['as'],'attributes':_0x36100d[_0x48ff('0x24')],'include':_0x36100d[_0x48ff('0x21')]?_[_0x48ff('0x22')](_0x36100d[_0x48ff('0x21')],function(_0x58955d){return{'model':db[_0x58955d[_0x48ff('0x23')]],'as':_0x58955d['as'],'attributes':_0x58955d[_0x48ff('0x24')],'include':_0x58955d[_0x48ff('0x21')]?_[_0x48ff('0x22')](_0x58955d['include'],function(_0x5c277d){return{'model':db[_0x5c277d[_0x48ff('0x23')]],'as':_0x5c277d['as'],'attributes':_0x5c277d['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x907224){logger[_0x48ff('0x12')](_0x48ff('0x25'),_0x182289);logger[_0x48ff('0x15')]('ShowChatQueue',_0x182289,JSON[_0x48ff('0x17')](_0x907224));_0x31f896(_0x907224);})[_0x48ff('0x27')](function(_0x5a66c4){logger[_0x48ff('0x18')](_0x48ff('0x25'),_0x5a66c4['message'],_0x182289);_0x6fa03c(_0x536eb4[_0x48ff('0x18')](0x1f4,_0x5a66c4['message']));});});}; \ No newline at end of file +var _0x8cce=['jayson/promise','client','redis','socket.io-emitter','register','request','then','info','ChatQueue,\x20%s,\x20%s','ChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','GetChatQueue','ChatQueue','options','where','attributes','limit','include','map','model','debug','stringify','catch','ShowChatQueue','find','raw','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x4eec9b,_0x4aea09){var _0x2e3849=function(_0x24c06d){while(--_0x24c06d){_0x4eec9b['push'](_0x4eec9b['shift']());}};_0x2e3849(++_0x4aea09);}(_0x8cce,0xd6));var _0xe8cc=function(_0x4fdcf7,_0x5735b0){_0x4fdcf7=_0x4fdcf7-0x0;var _0x1a69ab=_0x8cce[_0x4fdcf7];return _0x1a69ab;};'use strict';var _=require('lodash');var util=require(_0xe8cc('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xe8cc('0x1'));var fs=require('fs');var Redis=require(_0xe8cc('0x2'));var db=require(_0xe8cc('0x3'))['db'];var utils=require(_0xe8cc('0x4'));var logger=require(_0xe8cc('0x5'))(_0xe8cc('0x6'));var config=require(_0xe8cc('0x7'));var jayson=require(_0xe8cc('0x8'));var client=jayson[_0xe8cc('0x9')]['http']({'port':0x232a});config[_0xe8cc('0xa')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0xe8cc('0xb'))(new Redis(config[_0xe8cc('0xa')]));require('./chatQueue.socket')[_0xe8cc('0xc')](socket);function respondWithRpcPromise(_0x4c211b,_0x22ca98,_0x401515){return new BPromise(function(_0xcbf3ec,_0x826385){return client[_0xe8cc('0xd')](_0x4c211b,_0x401515)[_0xe8cc('0xe')](function(_0x4d499c){logger[_0xe8cc('0xf')](_0xe8cc('0x10'),_0x22ca98,'request\x20sent');logger['debug'](_0xe8cc('0x11'),_0x22ca98,'request\x20sent',JSON['stringify'](_0x4d499c));if(_0x4d499c[_0xe8cc('0x12')]){if(_0x4d499c['error'][_0xe8cc('0x13')]===0x1f4){logger[_0xe8cc('0x12')](_0xe8cc('0x10'),_0x22ca98,_0x4d499c['error'][_0xe8cc('0x14')]);return _0x826385(_0x4d499c[_0xe8cc('0x12')][_0xe8cc('0x14')]);}logger[_0xe8cc('0x12')](_0xe8cc('0x10'),_0x22ca98,_0x4d499c[_0xe8cc('0x12')][_0xe8cc('0x14')]);return _0xcbf3ec(_0x4d499c[_0xe8cc('0x12')][_0xe8cc('0x14')]);}else{logger[_0xe8cc('0xf')]('ChatQueue,\x20%s,\x20%s',_0x22ca98,'request\x20sent');_0xcbf3ec(_0x4d499c[_0xe8cc('0x15')][_0xe8cc('0x14')]);}})['catch'](function(_0x53014b){logger[_0xe8cc('0x12')](_0xe8cc('0x10'),_0x22ca98,_0x53014b);_0x826385(_0x53014b);});});}exports[_0xe8cc('0x16')]=function(_0x403f91){var _0xbafd99=this;return new Promise(function(_0x21e933,_0x445f4f){return db[_0xe8cc('0x17')]['findAll']({'raw':_0x403f91['options']?_0x403f91[_0xe8cc('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x403f91['options']?_0x403f91[_0xe8cc('0x18')][_0xe8cc('0x19')]||null:null,'attributes':_0x403f91[_0xe8cc('0x18')]?_0x403f91['options'][_0xe8cc('0x1a')]||null:null,'limit':_0x403f91[_0xe8cc('0x18')]?_0x403f91[_0xe8cc('0x18')][_0xe8cc('0x1b')]||null:null,'include':_0x403f91[_0xe8cc('0x18')]?_0x403f91[_0xe8cc('0x18')][_0xe8cc('0x1c')]?_[_0xe8cc('0x1d')](_0x403f91['options'][_0xe8cc('0x1c')],function(_0x34d6e0){return{'model':db[_0x34d6e0[_0xe8cc('0x1e')]],'as':_0x34d6e0['as'],'attributes':_0x34d6e0[_0xe8cc('0x1a')],'include':_0x34d6e0[_0xe8cc('0x1c')]?_[_0xe8cc('0x1d')](_0x34d6e0[_0xe8cc('0x1c')],function(_0x2c5fb2){return{'model':db[_0x2c5fb2[_0xe8cc('0x1e')]],'as':_0x2c5fb2['as'],'attributes':_0x2c5fb2[_0xe8cc('0x1a')],'include':_0x2c5fb2[_0xe8cc('0x1c')]?_[_0xe8cc('0x1d')](_0x2c5fb2[_0xe8cc('0x1c')],function(_0x35029c){return{'model':db[_0x35029c['model']],'as':_0x35029c['as'],'attributes':_0x35029c[_0xe8cc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe8cc('0xe')](function(_0x4bed04){logger[_0xe8cc('0xf')](_0xe8cc('0x16'),_0x403f91);logger[_0xe8cc('0x1f')](_0xe8cc('0x16'),_0x403f91,JSON[_0xe8cc('0x20')](_0x4bed04));_0x21e933(_0x4bed04);})[_0xe8cc('0x21')](function(_0xdc9b1b){logger[_0xe8cc('0x12')](_0xe8cc('0x16'),_0xdc9b1b['message'],_0x403f91);_0x445f4f(_0xbafd99[_0xe8cc('0x12')](0x1f4,_0xdc9b1b[_0xe8cc('0x14')]));});});};exports[_0xe8cc('0x22')]=function(_0x5f6a3c){var _0x1518ce=this;return new Promise(function(_0x5048a7,_0x17405d){return db[_0xe8cc('0x17')][_0xe8cc('0x23')]({'raw':_0x5f6a3c[_0xe8cc('0x18')]?_0x5f6a3c[_0xe8cc('0x18')][_0xe8cc('0x24')]===undefined?!![]:![]:!![],'where':_0x5f6a3c['options']?_0x5f6a3c['options']['where']||null:null,'attributes':_0x5f6a3c['options']?_0x5f6a3c[_0xe8cc('0x18')][_0xe8cc('0x1a')]||null:null,'include':_0x5f6a3c[_0xe8cc('0x18')]?_0x5f6a3c['options'][_0xe8cc('0x1c')]?_[_0xe8cc('0x1d')](_0x5f6a3c[_0xe8cc('0x18')][_0xe8cc('0x1c')],function(_0x550d9a){return{'model':db[_0x550d9a[_0xe8cc('0x1e')]],'as':_0x550d9a['as'],'attributes':_0x550d9a['attributes'],'include':_0x550d9a[_0xe8cc('0x1c')]?_[_0xe8cc('0x1d')](_0x550d9a['include'],function(_0x1dcf5b){return{'model':db[_0x1dcf5b[_0xe8cc('0x1e')]],'as':_0x1dcf5b['as'],'attributes':_0x1dcf5b[_0xe8cc('0x1a')],'include':_0x1dcf5b['include']?_[_0xe8cc('0x1d')](_0x1dcf5b[_0xe8cc('0x1c')],function(_0x531555){return{'model':db[_0x531555[_0xe8cc('0x1e')]],'as':_0x531555['as'],'attributes':_0x531555[_0xe8cc('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xe8cc('0xe')](function(_0x286685){logger[_0xe8cc('0xf')](_0xe8cc('0x22'),_0x5f6a3c);logger[_0xe8cc('0x1f')](_0xe8cc('0x22'),_0x5f6a3c,JSON[_0xe8cc('0x20')](_0x286685));_0x5048a7(_0x286685);})[_0xe8cc('0x21')](function(_0x2e6e13){logger[_0xe8cc('0x12')](_0xe8cc('0x22'),_0x2e6e13[_0xe8cc('0x14')],_0x5f6a3c);_0x17405d(_0x1518ce[_0xe8cc('0x12')](0x1f4,_0x2e6e13['message']));});});}; \ No newline at end of file diff --git a/server/api/chatQueue/chatQueue.socket.js b/server/api/chatQueue/chatQueue.socket.js index 321d97d..794e646 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 _0xed1f=['register','length','./chatQueue.events','save','remove','update','emit','removeListener'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0xed1f,0x6a));var _0xfed1=function(_0x556927,_0x34b53f){_0x556927=_0x556927-0x0;var _0x5f1235=_0xed1f[_0x556927];return _0x5f1235;};'use strict';var ChatQueueEvents=require(_0xfed1('0x0'));var events=[_0xfed1('0x1'),_0xfed1('0x2'),_0xfed1('0x3')];function createListener(_0xa45937,_0x25f345){return function(_0x1dd614){_0x25f345[_0xfed1('0x4')](_0xa45937,_0x1dd614);};}function removeListener(_0x2209b3,_0x45c3c1){return function(){ChatQueueEvents[_0xfed1('0x5')](_0x2209b3,_0x45c3c1);};}exports[_0xfed1('0x6')]=function(_0x3d6706){for(var _0x42751d=0x0,_0x380e18=events[_0xfed1('0x7')];_0x42751d<_0x380e18;_0x42751d++){var _0x2a6082=events[_0x42751d];var _0x2967ef=createListener('chatQueue:'+_0x2a6082,_0x3d6706);ChatQueueEvents['on'](_0x2a6082,_0x2967ef);}}; \ No newline at end of file +var _0x29d4=['removeListener','register','length','./chatQueue.events','remove','update'];(function(_0x2303b0,_0xe92fed){var _0x5afab4=function(_0x4dbdc6){while(--_0x4dbdc6){_0x2303b0['push'](_0x2303b0['shift']());}};_0x5afab4(++_0xe92fed);}(_0x29d4,0x1a1));var _0x429d=function(_0x56482c,_0x16118d){_0x56482c=_0x56482c-0x0;var _0x5aae7a=_0x29d4[_0x56482c];return _0x5aae7a;};'use strict';var ChatQueueEvents=require(_0x429d('0x0'));var events=['save',_0x429d('0x1'),_0x429d('0x2')];function createListener(_0x16ce75,_0x472fc9){return function(_0x45df1c){_0x472fc9['emit'](_0x16ce75,_0x45df1c);};}function removeListener(_0xc3989d,_0x3f43f5){return function(){ChatQueueEvents[_0x429d('0x3')](_0xc3989d,_0x3f43f5);};}exports[_0x429d('0x4')]=function(_0x1c55aa){for(var _0xa71445=0x0,_0x56aa2f=events[_0x429d('0x5')];_0xa71445<_0x56aa2f;_0xa71445++){var _0x4befb9=events[_0xa71445];var _0x9fc337=createListener('chatQueue:'+_0x4befb9,_0x1c55aa);ChatQueueEvents['on'](_0x4befb9,_0x9fc337);}}; \ No newline at end of file diff --git a/server/api/chatQueue/index.js b/server/api/chatQueue/index.js index 922d1f3..b3832f7 100644 --- a/server/api/chatQueue/index.js +++ b/server/api/chatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getMembers','/:id/teams','getTeams','getAgents','post','addTeams','addAgents','put','delete','removeTeams','/:id/users','removeAgents','exports','multer','path','connect-timeout','express','../../components/auth/service'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x3e74,0x175));var _0x43e7=function(_0x491eee,_0x1a0eaa){_0x491eee=_0x491eee-0x0;var _0x19d78a=_0x3e74[_0x491eee];return _0x19d78a;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0x7')](_0x43e7('0xc'),auth['isAuthenticated'](),controller[_0x43e7('0xd')]);router['get']('/:id/members',auth[_0x43e7('0x8')](),controller[_0x43e7('0xe')]);router['get'](_0x43e7('0xf'),auth['isAuthenticated'](),controller[_0x43e7('0x10')]);router[_0x43e7('0x7')]('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x11')]);router[_0x43e7('0x12')]('/',auth[_0x43e7('0x8')](),controller['create']);router['post'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x13')]);router['post']('/:id/users',auth[_0x43e7('0x8')](),controller[_0x43e7('0x14')]);router[_0x43e7('0x15')](_0x43e7('0xc'),auth['isAuthenticated'](),controller['update']);router[_0x43e7('0x16')](_0x43e7('0xc'),auth[_0x43e7('0x8')](),controller['destroy']);router['delete'](_0x43e7('0xf'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x17')]);router[_0x43e7('0x16')](_0x43e7('0x18'),auth[_0x43e7('0x8')](),controller[_0x43e7('0x19')]);module[_0x43e7('0x1a')]=router; \ No newline at end of file +var _0x008c=['../../config/environment','./chatQueue.controller','get','isAuthenticated','index','show','/:id/teams','getTeams','/:id/users','getAgents','post','addTeams','addAgents','update','delete','/:id','removeTeams','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x4249a2,_0x536828){var _0x326233=function(_0x20c5b6){while(--_0x20c5b6){_0x4249a2['push'](_0x4249a2['shift']());}};_0x326233(++_0x536828);}(_0x008c,0x188));var _0xc008=function(_0x46fe6a,_0x58ff06){_0x46fe6a=_0x46fe6a-0x0;var _0x58cb14=_0x008c[_0x46fe6a];return _0x58cb14;};'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')]('/describe',auth[_0xc008('0xb')](),controller['describe']);router[_0xc008('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xc008('0xd')]);router[_0xc008('0xa')]('/:id/members',auth['isAuthenticated'](),controller['getMembers']);router[_0xc008('0xa')](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0xf')]);router[_0xc008('0xa')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x11')]);router[_0xc008('0x12')]('/',auth[_0xc008('0xb')](),controller['create']);router['post'](_0xc008('0xe'),auth['isAuthenticated'](),controller[_0xc008('0x13')]);router[_0xc008('0x12')](_0xc008('0x10'),auth[_0xc008('0xb')](),controller[_0xc008('0x14')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xc008('0x15')]);router[_0xc008('0x16')](_0xc008('0x17'),auth[_0xc008('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth['isAuthenticated'](),controller[_0xc008('0x18')]);router[_0xc008('0x16')]('/:id/users',auth[_0xc008('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.attributes.js b/server/api/chatQueueReport/chatQueueReport.attributes.js index b552532..93cc2c6 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 _0xc470=['DATE','moment','sequelize','exports','STRING'];(function(_0x289891,_0x49a0fa){var _0x31cf2e=function(_0x8cebce){while(--_0x8cebce){_0x289891['push'](_0x289891['shift']());}};_0x31cf2e(++_0x49a0fa);}(_0xc470,0x155));var _0x0c47=function(_0x57d740,_0x50be99){_0x57d740=_0x57d740-0x0;var _0x6607ef=_0xc470[_0x57d740];return _0x6607ef;};'use strict';var moment=require(_0x0c47('0x0'));var Sequelize=require(_0x0c47('0x1'));module[_0x0c47('0x2')]={'uniqueid':{'type':Sequelize[_0x0c47('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x0c47('0x4')]},'leaveAt':{'type':Sequelize[_0x0c47('0x4')]},'acceptAt':{'type':Sequelize[_0x0c47('0x4')]},'exitAt':{'type':Sequelize[_0x0c47('0x4')]},'reason':{'type':Sequelize[_0x0c47('0x3')]}}; \ No newline at end of file +var _0xb479=['STRING','DATE','sequelize','exports'];(function(_0x360849,_0x3fd95c){var _0x5c9370=function(_0x18862d){while(--_0x18862d){_0x360849['push'](_0x360849['shift']());}};_0x5c9370(++_0x3fd95c);}(_0xb479,0x1ee));var _0x9b47=function(_0x2d1a42,_0x5e804e){_0x2d1a42=_0x2d1a42-0x0;var _0x1d92e1=_0xb479[_0x2d1a42];return _0x1d92e1;};'use strict';var moment=require('moment');var Sequelize=require(_0x9b47('0x0'));module[_0x9b47('0x1')]={'uniqueid':{'type':Sequelize[_0x9b47('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x9b47('0x2')]},'joinAt':{'type':Sequelize[_0x9b47('0x3')]},'leaveAt':{'type':Sequelize[_0x9b47('0x3')]},'acceptAt':{'type':Sequelize[_0x9b47('0x3')]},'exitAt':{'type':Sequelize[_0x9b47('0x3')]},'reason':{'type':Sequelize[_0x9b47('0x2')]}}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.controller.js b/server/api/chatQueueReport/chatQueueReport.controller.js index f789d33..cf0c9bf 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 _0x4351=['../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','status','end','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ChatQueueReport','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','rows','show','params','fields','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','querystring','papaparse','ioredis'];(function(_0x4aecd9,_0x54c49d){var _0x4089dc=function(_0x3a7a85){while(--_0x3a7a85){_0x4aecd9['push'](_0x4aecd9['shift']());}};_0x4089dc(++_0x54c49d);}(_0x4351,0x1b5));var _0x1435=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x4351[_0x5b644e];return _0x49c6bf;};'use strict';var emlformat=require(_0x1435('0x0'));var rimraf=require(_0x1435('0x1'));var zipdir=require(_0x1435('0x2'));var jsonpatch=require(_0x1435('0x3'));var rp=require(_0x1435('0x4'));var moment=require(_0x1435('0x5'));var BPromise=require(_0x1435('0x6'));var Mustache=require(_0x1435('0x7'));var util=require(_0x1435('0x8'));var path=require(_0x1435('0x9'));var sox=require(_0x1435('0xa'));var csv=require(_0x1435('0xb'));var ejs=require(_0x1435('0xc'));var fs=require('fs');var fs_extra=require(_0x1435('0xd'));var _=require(_0x1435('0xe'));var squel=require('squel');var crypto=require(_0x1435('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x1435('0xb'));var querystring=require(_0x1435('0x10'));var Papa=require(_0x1435('0x11'));var Redis=require(_0x1435('0x12'));var authService=require(_0x1435('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x1435('0x14'));var hardwareService=require(_0x1435('0x15'));var logger=require('../../config/logger')('api');var utils=require(_0x1435('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x1435('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1632ac,_0x5137c0){_0x5137c0=_0x5137c0||0xcc;return function(_0x47daf0){if(_0x47daf0){return _0x1632ac['sendStatus'](_0x5137c0);}return _0x1632ac[_0x1435('0x18')](_0x5137c0)[_0x1435('0x19')]();};}function respondWithResult(_0x243669,_0x4a80bc){_0x4a80bc=_0x4a80bc||0xc8;return function(_0x4a52ba){if(_0x4a52ba){return _0x243669[_0x1435('0x18')](_0x4a80bc)['json'](_0x4a52ba);}};}function respondWithFilteredResult(_0x39405c,_0x3f0b08){return function(_0x1f5fc3){if(_0x1f5fc3){var _0x202744=typeof _0x3f0b08[_0x1435('0x1a')]===_0x1435('0x1b')&&typeof _0x3f0b08[_0x1435('0x1c')]===_0x1435('0x1b');var _0x2c1a6b=_0x1f5fc3[_0x1435('0x1d')];var _0x430367=_0x202744?0x0:_0x3f0b08[_0x1435('0x1a')];var _0x68f503=_0x202744?_0x1f5fc3[_0x1435('0x1d')]:_0x3f0b08[_0x1435('0x1a')]+_0x3f0b08['limit'];var _0x26da28;if(_0x68f503>=_0x2c1a6b){_0x68f503=_0x2c1a6b;_0x26da28=0xc8;}else{_0x26da28=0xce;}_0x39405c[_0x1435('0x18')](_0x26da28);return _0x39405c['set'](_0x1435('0x1e'),_0x430367+'-'+_0x68f503+'/'+_0x2c1a6b)['json'](_0x1f5fc3);}return null;};}function patchUpdates(_0x15d7c0){return function(_0x2a72aa){try{jsonpatch[_0x1435('0x1f')](_0x2a72aa,_0x15d7c0,!![]);}catch(_0x28bc0a){return BPromise[_0x1435('0x20')](_0x28bc0a);}return _0x2a72aa[_0x1435('0x21')]();};}function saveUpdates(_0x543209,_0x17ed76){return function(_0x437f61){if(_0x437f61){return _0x437f61[_0x1435('0x22')](_0x543209)[_0x1435('0x23')](function(_0x57a94f){return _0x57a94f;});}return null;};}function removeEntity(_0x1b6259,_0x302831){return function(_0xab77fa){if(_0xab77fa){return _0xab77fa[_0x1435('0x24')]()[_0x1435('0x23')](function(){_0x1b6259[_0x1435('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x523792,_0x22241f){return function(_0x2b4828){if(!_0x2b4828){_0x523792[_0x1435('0x25')](0x194);}return _0x2b4828;};}function handleError(_0x4f86f0,_0x42599d){_0x42599d=_0x42599d||0x1f4;return function(_0x25cf29){logger[_0x1435('0x26')](_0x25cf29[_0x1435('0x27')]);if(_0x25cf29[_0x1435('0x28')]){delete _0x25cf29['name'];}_0x4f86f0[_0x1435('0x18')](_0x42599d)[_0x1435('0x29')](_0x25cf29);};}exports[_0x1435('0x2a')]=function(_0x453d68,_0x1c3b7e){var _0x108c25={},_0x2e0e72={},_0x57a02f={'count':0x0,'rows':[]};var _0x31ab10=_[_0x1435('0x2b')](db[_0x1435('0x2c')][_0x1435('0x2d')],function(_0x297edf){return{'name':_0x297edf['fieldName'],'type':_0x297edf[_0x1435('0x2e')][_0x1435('0x2f')]};});_0x2e0e72[_0x1435('0x30')]=_[_0x1435('0x2b')](_0x31ab10,'name');_0x2e0e72[_0x1435('0x31')]=_[_0x1435('0x32')](_0x453d68['query']);_0x2e0e72[_0x1435('0x33')]=_['intersection'](_0x2e0e72[_0x1435('0x30')],_0x2e0e72[_0x1435('0x31')]);_0x108c25['attributes']=_[_0x1435('0x34')](_0x2e0e72[_0x1435('0x30')],qs['fields'](_0x453d68['query']['fields']));_0x108c25[_0x1435('0x35')]=_0x108c25['attributes'][_0x1435('0x36')]?_0x108c25['attributes']:_0x2e0e72[_0x1435('0x30')];if(!_0x453d68['query'][_0x1435('0x37')](_0x1435('0x38'))){_0x108c25[_0x1435('0x1c')]=qs[_0x1435('0x1c')](_0x453d68[_0x1435('0x31')][_0x1435('0x1c')]);_0x108c25['offset']=qs[_0x1435('0x1a')](_0x453d68[_0x1435('0x31')][_0x1435('0x1a')]);}_0x108c25[_0x1435('0x39')]=qs[_0x1435('0x3a')](_0x453d68['query'][_0x1435('0x3a')]);_0x108c25['where']=qs[_0x1435('0x33')](_[_0x1435('0x3b')](_0x453d68['query'],_0x2e0e72[_0x1435('0x33')]),_0x31ab10);if(_0x453d68[_0x1435('0x31')][_0x1435('0x3c')]){_0x108c25[_0x1435('0x3d')]=_[_0x1435('0x3e')](_0x108c25[_0x1435('0x3d')],{'$or':_[_0x1435('0x2b')](_0x31ab10,function(_0x176dbd){if(_0x176dbd[_0x1435('0x2e')]!==_0x1435('0x3f')){var _0x3ecac4={};_0x3ecac4[_0x176dbd[_0x1435('0x28')]]={'$like':'%'+_0x453d68['query'][_0x1435('0x3c')]+'%'};return _0x3ecac4;}})});}_0x108c25=_['merge']({},_0x108c25,_0x453d68[_0x1435('0x40')]);var _0x5b24ab={'where':_0x108c25[_0x1435('0x3d')]};return db['ChatQueueReport'][_0x1435('0x1d')](_0x5b24ab)['then'](function(_0x36bc74){_0x57a02f[_0x1435('0x1d')]=_0x36bc74;if(_0x453d68[_0x1435('0x31')]['includeAll']){_0x108c25[_0x1435('0x41')]=[{'all':!![]}];}return db[_0x1435('0x2c')][_0x1435('0x42')](_0x108c25);})['then'](function(_0x1d6417){_0x57a02f[_0x1435('0x43')]=_0x1d6417;return _0x57a02f;})['then'](respondWithFilteredResult(_0x1c3b7e,_0x108c25))['catch'](handleError(_0x1c3b7e,null));};exports[_0x1435('0x44')]=function(_0x40e9eb,_0x2dd1f5){var _0x5986f8={'raw':!![],'where':{'id':_0x40e9eb[_0x1435('0x45')]['id']}},_0x4e5d0a={};_0x4e5d0a['model']=_[_0x1435('0x32')](db['ChatQueueReport'][_0x1435('0x2d')]);_0x4e5d0a['query']=_[_0x1435('0x32')](_0x40e9eb['query']);_0x4e5d0a[_0x1435('0x33')]=_['intersection'](_0x4e5d0a[_0x1435('0x30')],_0x4e5d0a[_0x1435('0x31')]);_0x5986f8['attributes']=_[_0x1435('0x34')](_0x4e5d0a['model'],qs[_0x1435('0x46')](_0x40e9eb[_0x1435('0x31')][_0x1435('0x46')]));_0x5986f8['attributes']=_0x5986f8[_0x1435('0x35')][_0x1435('0x36')]?_0x5986f8['attributes']:_0x4e5d0a[_0x1435('0x30')];if(_0x40e9eb[_0x1435('0x31')]['includeAll']){_0x5986f8[_0x1435('0x41')]=[{'all':!![]}];}_0x5986f8=_[_0x1435('0x3e')]({},_0x5986f8,_0x40e9eb['options']);return db[_0x1435('0x2c')][_0x1435('0x47')](_0x5986f8)['then'](handleEntityNotFound(_0x2dd1f5,null))[_0x1435('0x23')](respondWithResult(_0x2dd1f5,null))[_0x1435('0x48')](handleError(_0x2dd1f5,null));};exports[_0x1435('0x49')]=function(_0x4b254e,_0x57b5d4){return db[_0x1435('0x2c')]['create'](_0x4b254e[_0x1435('0x4a')],{})['then'](respondWithResult(_0x57b5d4,0xc9))[_0x1435('0x48')](handleError(_0x57b5d4,null));};exports[_0x1435('0x22')]=function(_0x1f8899,_0x148862){if(_0x1f8899[_0x1435('0x4a')]['id']){delete _0x1f8899[_0x1435('0x4a')]['id'];}return db[_0x1435('0x2c')]['find']({'where':{'id':_0x1f8899[_0x1435('0x45')]['id']}})[_0x1435('0x23')](handleEntityNotFound(_0x148862,null))[_0x1435('0x23')](saveUpdates(_0x1f8899['body'],null))[_0x1435('0x23')](respondWithResult(_0x148862,null))[_0x1435('0x48')](handleError(_0x148862,null));};exports[_0x1435('0x24')]=function(_0x24c5d0,_0x118c06){return db[_0x1435('0x2c')][_0x1435('0x47')]({'where':{'id':_0x24c5d0[_0x1435('0x45')]['id']}})['then'](handleEntityNotFound(_0x118c06,null))[_0x1435('0x23')](removeEntity(_0x118c06,null))[_0x1435('0x48')](handleError(_0x118c06,null));};exports[_0x1435('0x4b')]=function(_0x4244e1,_0x5953ce){return db['ChatQueueReport'][_0x1435('0x4b')]()[_0x1435('0x23')](respondWithResult(_0x5953ce,null))[_0x1435('0x48')](handleError(_0x5953ce,null));}; \ No newline at end of file +var _0x63a6=['findAll','rows','catch','show','rawAttributes','options','find','create','body','params','describe','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','lodash','squel','desk.js','to-csv','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','end','json','undefined','count','status','apply','reject','save','update','then','destroy','error','name','send','index','map','ChatQueueReport','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','offset','order','sort','pick','filter','merge','where','VIRTUAL','includeAll','include'];(function(_0x16ace9,_0xe208f0){var _0x5bf5f8=function(_0x3e9ac0){while(--_0x3e9ac0){_0x16ace9['push'](_0x16ace9['shift']());}};_0x5bf5f8(++_0xe208f0);}(_0x63a6,0x1c7));var _0x663a=function(_0x5200c4,_0x4d59a6){_0x5200c4=_0x5200c4-0x0;var _0x36cb24=_0x63a6[_0x5200c4];return _0x36cb24;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x663a('0x0'));var zipdir=require(_0x663a('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x663a('0x2'));var moment=require(_0x663a('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x663a('0x4'));var util=require(_0x663a('0x5'));var path=require(_0x663a('0x6'));var sox=require(_0x663a('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x663a('0x8'));var squel=require(_0x663a('0x9'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x663a('0xa'));var toCsv=require(_0x663a('0xb'));var querystring=require(_0x663a('0xc'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x663a('0xd'));var qs=require(_0x663a('0xe'));var as=require(_0x663a('0xf'));var hardwareService=require(_0x663a('0x10'));var logger=require(_0x663a('0x11'))(_0x663a('0x12'));var utils=require('../../config/utils');var config=require(_0x663a('0x13'));var licenseUtil=require(_0x663a('0x14'));var db=require(_0x663a('0x15'))['db'];function respondWithStatusCode(_0x581440,_0x583366){_0x583366=_0x583366||0xcc;return function(_0x3f3ef4){if(_0x3f3ef4){return _0x581440['sendStatus'](_0x583366);}return _0x581440['status'](_0x583366)[_0x663a('0x16')]();};}function respondWithResult(_0x39d5d4,_0x558f2f){_0x558f2f=_0x558f2f||0xc8;return function(_0x1eaf35){if(_0x1eaf35){return _0x39d5d4['status'](_0x558f2f)[_0x663a('0x17')](_0x1eaf35);}};}function respondWithFilteredResult(_0x1eab42,_0x15afa0){return function(_0x2d794f){if(_0x2d794f){var _0x1a8d76=typeof _0x15afa0['offset']===_0x663a('0x18')&&typeof _0x15afa0['limit']===_0x663a('0x18');var _0x45f489=_0x2d794f[_0x663a('0x19')];var _0x1508ab=_0x1a8d76?0x0:_0x15afa0['offset'];var _0x2a1f33=_0x1a8d76?_0x2d794f['count']:_0x15afa0['offset']+_0x15afa0['limit'];var _0x2d006c;if(_0x2a1f33>=_0x45f489){_0x2a1f33=_0x45f489;_0x2d006c=0xc8;}else{_0x2d006c=0xce;}_0x1eab42[_0x663a('0x1a')](_0x2d006c);return _0x1eab42['set']('Content-Range',_0x1508ab+'-'+_0x2a1f33+'/'+_0x45f489)[_0x663a('0x17')](_0x2d794f);}return null;};}function patchUpdates(_0x173a10){return function(_0x89d455){try{jsonpatch[_0x663a('0x1b')](_0x89d455,_0x173a10,!![]);}catch(_0x221c83){return BPromise[_0x663a('0x1c')](_0x221c83);}return _0x89d455[_0x663a('0x1d')]();};}function saveUpdates(_0x52d97b,_0x1586f3){return function(_0x21152c){if(_0x21152c){return _0x21152c[_0x663a('0x1e')](_0x52d97b)[_0x663a('0x1f')](function(_0x3d4e7c){return _0x3d4e7c;});}return null;};}function removeEntity(_0x207b26,_0x5e1bd1){return function(_0x310339){if(_0x310339){return _0x310339[_0x663a('0x20')]()['then'](function(){_0x207b26[_0x663a('0x1a')](0xcc)[_0x663a('0x16')]();});}};}function handleEntityNotFound(_0x5463d5,_0x3cb58a){return function(_0x2b2762){if(!_0x2b2762){_0x5463d5['sendStatus'](0x194);}return _0x2b2762;};}function handleError(_0x1e2653,_0x41c552){_0x41c552=_0x41c552||0x1f4;return function(_0x57131d){logger[_0x663a('0x21')](_0x57131d['stack']);if(_0x57131d[_0x663a('0x22')]){delete _0x57131d[_0x663a('0x22')];}_0x1e2653[_0x663a('0x1a')](_0x41c552)[_0x663a('0x23')](_0x57131d);};}exports[_0x663a('0x24')]=function(_0x57f93d,_0xcf9f0a){var _0x71efb={},_0x1ab286={},_0xf68801={'count':0x0,'rows':[]};var _0x210f03=_[_0x663a('0x25')](db[_0x663a('0x26')]['rawAttributes'],function(_0x3b4329){return{'name':_0x3b4329[_0x663a('0x27')],'type':_0x3b4329[_0x663a('0x28')][_0x663a('0x29')]};});_0x1ab286[_0x663a('0x2a')]=_['map'](_0x210f03,_0x663a('0x22'));_0x1ab286['query']=_[_0x663a('0x2b')](_0x57f93d[_0x663a('0x2c')]);_0x1ab286[_0x663a('0x2d')]=_[_0x663a('0x2e')](_0x1ab286[_0x663a('0x2a')],_0x1ab286['query']);_0x71efb[_0x663a('0x2f')]=_['intersection'](_0x1ab286[_0x663a('0x2a')],qs[_0x663a('0x30')](_0x57f93d[_0x663a('0x2c')][_0x663a('0x30')]));_0x71efb['attributes']=_0x71efb[_0x663a('0x2f')][_0x663a('0x31')]?_0x71efb[_0x663a('0x2f')]:_0x1ab286[_0x663a('0x2a')];if(!_0x57f93d[_0x663a('0x2c')][_0x663a('0x32')](_0x663a('0x33'))){_0x71efb[_0x663a('0x34')]=qs['limit'](_0x57f93d[_0x663a('0x2c')][_0x663a('0x34')]);_0x71efb['offset']=qs[_0x663a('0x35')](_0x57f93d[_0x663a('0x2c')][_0x663a('0x35')]);}_0x71efb[_0x663a('0x36')]=qs[_0x663a('0x37')](_0x57f93d['query'][_0x663a('0x37')]);_0x71efb['where']=qs[_0x663a('0x2d')](_[_0x663a('0x38')](_0x57f93d['query'],_0x1ab286['filters']),_0x210f03);if(_0x57f93d[_0x663a('0x2c')][_0x663a('0x39')]){_0x71efb['where']=_[_0x663a('0x3a')](_0x71efb[_0x663a('0x3b')],{'$or':_[_0x663a('0x25')](_0x210f03,function(_0x4d0b8d){if(_0x4d0b8d[_0x663a('0x28')]!==_0x663a('0x3c')){var _0x5e2826={};_0x5e2826[_0x4d0b8d[_0x663a('0x22')]]={'$like':'%'+_0x57f93d['query'][_0x663a('0x39')]+'%'};return _0x5e2826;}})});}_0x71efb=_[_0x663a('0x3a')]({},_0x71efb,_0x57f93d['options']);var _0x1aff26={'where':_0x71efb[_0x663a('0x3b')]};return db['ChatQueueReport'][_0x663a('0x19')](_0x1aff26)[_0x663a('0x1f')](function(_0x5de40d){_0xf68801['count']=_0x5de40d;if(_0x57f93d[_0x663a('0x2c')][_0x663a('0x3d')]){_0x71efb[_0x663a('0x3e')]=[{'all':!![]}];}return db[_0x663a('0x26')][_0x663a('0x3f')](_0x71efb);})[_0x663a('0x1f')](function(_0x110afa){_0xf68801[_0x663a('0x40')]=_0x110afa;return _0xf68801;})['then'](respondWithFilteredResult(_0xcf9f0a,_0x71efb))[_0x663a('0x41')](handleError(_0xcf9f0a,null));};exports[_0x663a('0x42')]=function(_0x252963,_0x2e0df7){var _0x51fd91={'raw':!![],'where':{'id':_0x252963['params']['id']}},_0x285ed3={};_0x285ed3['model']=_['keys'](db['ChatQueueReport'][_0x663a('0x43')]);_0x285ed3[_0x663a('0x2c')]=_[_0x663a('0x2b')](_0x252963['query']);_0x285ed3[_0x663a('0x2d')]=_['intersection'](_0x285ed3[_0x663a('0x2a')],_0x285ed3[_0x663a('0x2c')]);_0x51fd91['attributes']=_[_0x663a('0x2e')](_0x285ed3[_0x663a('0x2a')],qs[_0x663a('0x30')](_0x252963[_0x663a('0x2c')][_0x663a('0x30')]));_0x51fd91[_0x663a('0x2f')]=_0x51fd91[_0x663a('0x2f')][_0x663a('0x31')]?_0x51fd91['attributes']:_0x285ed3[_0x663a('0x2a')];if(_0x252963[_0x663a('0x2c')]['includeAll']){_0x51fd91['include']=[{'all':!![]}];}_0x51fd91=_[_0x663a('0x3a')]({},_0x51fd91,_0x252963[_0x663a('0x44')]);return db[_0x663a('0x26')][_0x663a('0x45')](_0x51fd91)['then'](handleEntityNotFound(_0x2e0df7,null))['then'](respondWithResult(_0x2e0df7,null))[_0x663a('0x41')](handleError(_0x2e0df7,null));};exports[_0x663a('0x46')]=function(_0x55b3ed,_0x5efe40){return db[_0x663a('0x26')][_0x663a('0x46')](_0x55b3ed[_0x663a('0x47')],{})[_0x663a('0x1f')](respondWithResult(_0x5efe40,0xc9))[_0x663a('0x41')](handleError(_0x5efe40,null));};exports[_0x663a('0x1e')]=function(_0x1c3bc4,_0x5ec404){if(_0x1c3bc4[_0x663a('0x47')]['id']){delete _0x1c3bc4[_0x663a('0x47')]['id'];}return db[_0x663a('0x26')][_0x663a('0x45')]({'where':{'id':_0x1c3bc4[_0x663a('0x48')]['id']}})[_0x663a('0x1f')](handleEntityNotFound(_0x5ec404,null))[_0x663a('0x1f')](saveUpdates(_0x1c3bc4[_0x663a('0x47')],null))[_0x663a('0x1f')](respondWithResult(_0x5ec404,null))[_0x663a('0x41')](handleError(_0x5ec404,null));};exports[_0x663a('0x20')]=function(_0x4a61f5,_0x32fbe2){return db[_0x663a('0x26')]['find']({'where':{'id':_0x4a61f5[_0x663a('0x48')]['id']}})[_0x663a('0x1f')](handleEntityNotFound(_0x32fbe2,null))[_0x663a('0x1f')](removeEntity(_0x32fbe2,null))['catch'](handleError(_0x32fbe2,null));};exports[_0x663a('0x49')]=function(_0x384629,_0x5462d4){return db[_0x663a('0x26')][_0x663a('0x49')]()['then'](respondWithResult(_0x5462d4,null))['catch'](handleError(_0x5462d4,null));}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.model.js b/server/api/chatQueueReport/chatQueueReport.model.js index 9126ef7..ac72346 100644 --- a/server/api/chatQueueReport/chatQueueReport.model.js +++ b/server/api/chatQueueReport/chatQueueReport.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['report_chat_queue','uniqueid','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./chatQueueReport.attributes','exports','define'];(function(_0x309e28,_0x5824b3){var _0x550306=function(_0x19da3e){while(--_0x19da3e){_0x309e28['push'](_0x309e28['shift']());}};_0x550306(++_0x5824b3);}(_0x757a,0xde));var _0xa757=function(_0x2d2b29,_0x53e623){_0x2d2b29=_0x2d2b29-0x0;var _0x4fff94=_0x757a[_0x2d2b29];return _0x4fff94;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));module[_0xa757('0x7')]=function(_0x5edca8,_0xae0e7c){return _0x5edca8[_0xa757('0x8')]('ChatQueueReport',attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[{'name':_0xa757('0xa'),'fields':[_0xa757('0xa')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b0=['define','report_chat_queue','uniqueid','lodash','util','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x390906,_0xdea321){var _0x1d0ffb=function(_0x4759e7){while(--_0x4759e7){_0x390906['push'](_0x390906['shift']());}};_0x1d0ffb(++_0xdea321);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x0d8b('0x2'));var rp=require(_0x0d8b('0x3'));var fs=require('fs');var path=require(_0x0d8b('0x4'));var rimraf=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));var attributes=require('./chatQueueReport.attributes');module['exports']=function(_0x3f8b6f,_0x227c63){return _0x3f8b6f[_0x0d8b('0x7')]('ChatQueueReport',attributes,{'tableName':_0x0d8b('0x8'),'paranoid':![],'indexes':[{'name':_0x0d8b('0x9'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/chatQueueReport.rpc.js b/server/api/chatQueueReport/chatQueueReport.rpc.js index 156481d..62fbdc2 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 _0x6313=['limit','util','../../mysqldb','rpc','../../config/environment','jayson/promise','request','then','info','request\x20sent','ChatQueueReport,\x20%s,\x20%s,\x20%s','error','code','ChatQueueReport,\x20%s,\x20%s','message','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','raw','debug','stringify','UpdateChatQueueReport','update','where','attributes'];(function(_0x219c7d,_0x4b3506){var _0x4459aa=function(_0x3e7121){while(--_0x3e7121){_0x219c7d['push'](_0x219c7d['shift']());}};_0x4459aa(++_0x4b3506);}(_0x6313,0x135));var _0x3631=function(_0x521378,_0x2f8004){_0x521378=_0x521378-0x0;var _0x4b2fc4=_0x6313[_0x521378];return _0x4b2fc4;};'use strict';var _=require('lodash');var util=require(_0x3631('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3631('0x1'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x3631('0x2'));var config=require(_0x3631('0x3'));var jayson=require(_0x3631('0x4'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xccc881,_0x49211e,_0x26000d){return new BPromise(function(_0x547fc8,_0x350a0f){return client[_0x3631('0x5')](_0xccc881,_0x26000d)[_0x3631('0x6')](function(_0x2545df){logger[_0x3631('0x7')]('ChatQueueReport,\x20%s,\x20%s',_0x49211e,_0x3631('0x8'));logger['debug'](_0x3631('0x9'),_0x49211e,_0x3631('0x8'),JSON['stringify'](_0x2545df));if(_0x2545df['error']){if(_0x2545df[_0x3631('0xa')][_0x3631('0xb')]===0x1f4){logger['error'](_0x3631('0xc'),_0x49211e,_0x2545df[_0x3631('0xa')][_0x3631('0xd')]);return _0x350a0f(_0x2545df[_0x3631('0xa')][_0x3631('0xd')]);}logger['error'](_0x3631('0xc'),_0x49211e,_0x2545df['error'][_0x3631('0xd')]);return _0x547fc8(_0x2545df['error'][_0x3631('0xd')]);}else{logger[_0x3631('0x7')](_0x3631('0xc'),_0x49211e,_0x3631('0x8'));_0x547fc8(_0x2545df[_0x3631('0xe')][_0x3631('0xd')]);}})[_0x3631('0xf')](function(_0x4a8970){logger[_0x3631('0xa')](_0x3631('0xc'),_0x49211e,_0x4a8970);_0x350a0f(_0x4a8970);});});}exports[_0x3631('0x10')]=function(_0x3f8713){var _0x81cfc5=this;return new Promise(function(_0x31585d,_0x240ca9){return db[_0x3631('0x11')]['create'](_0x3f8713[_0x3631('0x12')],{'raw':_0x3f8713[_0x3631('0x13')]?_0x3f8713[_0x3631('0x13')][_0x3631('0x14')]===undefined?!![]:![]:!![]})[_0x3631('0x6')](function(_0x366239){logger['info'](_0x3631('0x10'),_0x3f8713);logger[_0x3631('0x15')](_0x3631('0x10'),_0x3f8713,JSON[_0x3631('0x16')](_0x366239));_0x31585d(_0x366239);})[_0x3631('0xf')](function(_0x582c64){logger[_0x3631('0xa')](_0x3631('0x10'),_0x582c64[_0x3631('0xd')],_0x3f8713);_0x240ca9(_0x81cfc5['error'](0x1f4,_0x582c64[_0x3631('0xd')]));});});};exports[_0x3631('0x17')]=function(_0x360f09){var _0x4b93fb=this;return new Promise(function(_0x257ab3,_0x4122bf){return db[_0x3631('0x11')][_0x3631('0x18')](_0x360f09[_0x3631('0x12')],{'raw':_0x360f09[_0x3631('0x13')]?_0x360f09[_0x3631('0x13')][_0x3631('0x14')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x360f09[_0x3631('0x13')]?_0x360f09['options'][_0x3631('0x19')]||null:null,'attributes':_0x360f09['options']?_0x360f09[_0x3631('0x13')][_0x3631('0x1a')]||null:null,'limit':_0x360f09[_0x3631('0x13')]?_0x360f09[_0x3631('0x13')][_0x3631('0x1b')]||null:null})[_0x3631('0x6')](function(_0xd9f26a){logger['info']('UpdateChatQueueReport',_0x360f09);logger[_0x3631('0x15')](_0x3631('0x17'),_0x360f09,JSON['stringify'](_0xd9f26a));_0x257ab3(_0xd9f26a);})[_0x3631('0xf')](function(_0x33bb98){logger['error']('UpdateChatQueueReport',_0x33bb98['message'],_0x360f09);_0x4122bf(_0x4b93fb[_0x3631('0xa')](0x1f4,_0x33bb98[_0x3631('0xd')]));});});}; \ No newline at end of file +var _0x8d46=['stringify','error','message','ChatQueueReport,\x20%s,\x20%s','result','catch','CreateChatQueueReport','ChatQueueReport','body','options','debug','UpdateChatQueueReport','raw','where','attributes','limit','lodash','util','moment','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ChatQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x18c492,_0x540756){var _0x274e04=function(_0x2b4d7a){while(--_0x2b4d7a){_0x18c492['push'](_0x18c492['shift']());}};_0x274e04(++_0x540756);}(_0x8d46,0x184));var _0x68d4=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x8d46[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x68d4('0x0'));var util=require(_0x68d4('0x1'));var moment=require(_0x68d4('0x2'));var BPromise=require('bluebird');var rs=require(_0x68d4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x68d4('0x4'));var logger=require(_0x68d4('0x5'))(_0x68d4('0x6'));var config=require(_0x68d4('0x7'));var jayson=require(_0x68d4('0x8'));var client=jayson[_0x68d4('0x9')][_0x68d4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a10d7,_0x395903,_0x108c90){return new BPromise(function(_0x5b9b83,_0x5b2c1a){return client['request'](_0x1a10d7,_0x108c90)[_0x68d4('0xb')](function(_0x239090){logger[_0x68d4('0xc')]('ChatQueueReport,\x20%s,\x20%s',_0x395903,'request\x20sent');logger['debug'](_0x68d4('0xd'),_0x395903,_0x68d4('0xe'),JSON[_0x68d4('0xf')](_0x239090));if(_0x239090[_0x68d4('0x10')]){if(_0x239090[_0x68d4('0x10')]['code']===0x1f4){logger['error']('ChatQueueReport,\x20%s,\x20%s',_0x395903,_0x239090[_0x68d4('0x10')][_0x68d4('0x11')]);return _0x5b2c1a(_0x239090[_0x68d4('0x10')][_0x68d4('0x11')]);}logger[_0x68d4('0x10')]('ChatQueueReport,\x20%s,\x20%s',_0x395903,_0x239090['error'][_0x68d4('0x11')]);return _0x5b9b83(_0x239090[_0x68d4('0x10')][_0x68d4('0x11')]);}else{logger[_0x68d4('0xc')](_0x68d4('0x12'),_0x395903,'request\x20sent');_0x5b9b83(_0x239090[_0x68d4('0x13')]['message']);}})[_0x68d4('0x14')](function(_0x21a7be){logger[_0x68d4('0x10')](_0x68d4('0x12'),_0x395903,_0x21a7be);_0x5b2c1a(_0x21a7be);});});}exports[_0x68d4('0x15')]=function(_0x30f03c){var _0x23f20b=this;return new Promise(function(_0x361b6e,_0x561849){return db[_0x68d4('0x16')]['create'](_0x30f03c[_0x68d4('0x17')],{'raw':_0x30f03c[_0x68d4('0x18')]?_0x30f03c[_0x68d4('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x68d4('0xb')](function(_0x51589f){logger[_0x68d4('0xc')](_0x68d4('0x15'),_0x30f03c);logger[_0x68d4('0x19')]('CreateChatQueueReport',_0x30f03c,JSON[_0x68d4('0xf')](_0x51589f));_0x361b6e(_0x51589f);})['catch'](function(_0x345f14){logger[_0x68d4('0x10')](_0x68d4('0x15'),_0x345f14[_0x68d4('0x11')],_0x30f03c);_0x561849(_0x23f20b['error'](0x1f4,_0x345f14[_0x68d4('0x11')]));});});};exports[_0x68d4('0x1a')]=function(_0x27f5df){var _0x5e7776=this;return new Promise(function(_0x5b70bf,_0x36c3d0){return db[_0x68d4('0x16')]['update'](_0x27f5df[_0x68d4('0x17')],{'raw':_0x27f5df[_0x68d4('0x18')]?_0x27f5df['options'][_0x68d4('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x27f5df[_0x68d4('0x18')]?_0x27f5df['options'][_0x68d4('0x1c')]||null:null,'attributes':_0x27f5df[_0x68d4('0x18')]?_0x27f5df[_0x68d4('0x18')][_0x68d4('0x1d')]||null:null,'limit':_0x27f5df[_0x68d4('0x18')]?_0x27f5df[_0x68d4('0x18')][_0x68d4('0x1e')]||null:null})['then'](function(_0x4c905b){logger['info'](_0x68d4('0x1a'),_0x27f5df);logger[_0x68d4('0x19')](_0x68d4('0x1a'),_0x27f5df,JSON[_0x68d4('0xf')](_0x4c905b));_0x5b70bf(_0x4c905b);})[_0x68d4('0x14')](function(_0x43bebc){logger['error']('UpdateChatQueueReport',_0x43bebc[_0x68d4('0x11')],_0x27f5df);_0x36c3d0(_0x5e7776[_0x68d4('0x10')](0x1f4,_0x43bebc[_0x68d4('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/chatQueueReport/index.js b/server/api/chatQueueReport/index.js index 8c1799a..d8b6559 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 _0x613b=['destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','create','put','update','delete'];(function(_0x5d90b8,_0x528b3a){var _0x5712b3=function(_0x478049){while(--_0x478049){_0x5d90b8['push'](_0x5d90b8['shift']());}};_0x5712b3(++_0x528b3a);}(_0x613b,0x1b9));var _0xb613=function(_0x1fd69c,_0x1b925b){_0x1fd69c=_0x1fd69c-0x0;var _0x421119=_0x613b[_0x1fd69c];return _0x421119;};'use strict';var multer=require(_0xb613('0x0'));var util=require(_0xb613('0x1'));var path=require(_0xb613('0x2'));var timeout=require(_0xb613('0x3'));var express=require('express');var router=express[_0xb613('0x4')]();var fs_extra=require(_0xb613('0x5'));var auth=require(_0xb613('0x6'));var interaction=require(_0xb613('0x7'));var config=require(_0xb613('0x8'));var controller=require(_0xb613('0x9'));router[_0xb613('0xa')]('/',auth[_0xb613('0xb')](),controller[_0xb613('0xc')]);router[_0xb613('0xa')](_0xb613('0xd'),auth[_0xb613('0xb')](),controller[_0xb613('0xe')]);router['get'](_0xb613('0xf'),auth[_0xb613('0xb')](),controller[_0xb613('0x10')]);router['post']('/',auth[_0xb613('0xb')](),controller[_0xb613('0x11')]);router[_0xb613('0x12')](_0xb613('0xf'),auth[_0xb613('0xb')](),controller[_0xb613('0x13')]);router[_0xb613('0x14')](_0xb613('0xf'),auth[_0xb613('0xb')](),controller[_0xb613('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe145=['../../components/interaction/service','../../config/environment','./chatQueueReport.controller','isAuthenticated','index','/describe','describe','/:id','show','post','put','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x3064a2,_0x5bc059){var _0x484180=function(_0x20322a){while(--_0x20322a){_0x3064a2['push'](_0x3064a2['shift']());}};_0x484180(++_0x5bc059);}(_0xe145,0xd5));var _0x5e14=function(_0x2a123f,_0x277688){_0x2a123f=_0x2a123f-0x0;var _0x548d77=_0xe145[_0x2a123f];return _0x548d77;};'use strict';var multer=require(_0x5e14('0x0'));var util=require(_0x5e14('0x1'));var path=require('path');var timeout=require(_0x5e14('0x2'));var express=require(_0x5e14('0x3'));var router=express[_0x5e14('0x4')]();var fs_extra=require(_0x5e14('0x5'));var auth=require(_0x5e14('0x6'));var interaction=require(_0x5e14('0x7'));var config=require(_0x5e14('0x8'));var controller=require(_0x5e14('0x9'));router['get']('/',auth[_0x5e14('0xa')](),controller[_0x5e14('0xb')]);router['get'](_0x5e14('0xc'),auth['isAuthenticated'](),controller[_0x5e14('0xd')]);router['get'](_0x5e14('0xe'),auth[_0x5e14('0xa')](),controller[_0x5e14('0xf')]);router[_0x5e14('0x10')]('/',auth[_0x5e14('0xa')](),controller['create']);router[_0x5e14('0x11')](_0x5e14('0xe'),auth[_0x5e14('0xa')](),controller['update']);router[_0x5e14('0x12')](_0x5e14('0xe'),auth[_0x5e14('0xa')](),controller['destroy']);module[_0x5e14('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 7681e76..83c16ad 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 _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x4aa25e,_0x58c68b){var _0x36dea5=function(_0xcb3ffe){while(--_0xcb3ffe){_0x4aa25e['push'](_0x4aa25e['shift']());}};_0x36dea5(++_0x58c68b);}(_0x4b84,0x1cc));var _0x44b8=function(_0x23f8c8,_0xb536b9){_0x23f8c8=_0x23f8c8-0x0;var _0x3dc718=_0x4b84[_0x23f8c8];return _0x3dc718;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0x008c=['ENUM','agent','queue','DATE','NOW','moment','sequelize','exports','STRING'];(function(_0x3725ee,_0x543bd9){var _0x399c71=function(_0xaf9400){while(--_0xaf9400){_0x3725ee['push'](_0x3725ee['shift']());}};_0x399c71(++_0x543bd9);}(_0x008c,0x188));var _0xc008=function(_0x22c2da,_0x569b31){_0x22c2da=_0x22c2da-0x0;var _0x65a816=_0x008c[_0x22c2da];return _0x65a816;};'use strict';var moment=require(_0xc008('0x0'));var Sequelize=require(_0xc008('0x1'));module[_0xc008('0x2')]={'uniqueid':{'type':Sequelize[_0xc008('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xc008('0x4')]('account',_0xc008('0x5'),_0xc008('0x6')),'allowNull':![],'defaultValue':_0xc008('0x6')},'transferredAt':{'type':Sequelize[_0xc008('0x7')],'allowNull':![],'defaultValue':Sequelize[_0xc008('0x8')]}}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.controller.js b/server/api/chatTransferReport/chatTransferReport.controller.js index ffd157b..5ca7297 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 _0x3cf5=['map','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','catch','show','ChatTransferReport','length','include','find','create','body','params','eml-format','rimraf','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','count','Content-Range','reject','update','then','error','name','send','index'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x3cf5,0xa6));var _0x53cf=function(_0x319fc1,_0x29179b){_0x319fc1=_0x319fc1-0x0;var _0xb768af=_0x3cf5[_0x319fc1];return _0xb768af;};'use strict';var emlformat=require(_0x53cf('0x0'));var rimraf=require(_0x53cf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x53cf('0x2'));var rp=require(_0x53cf('0x3'));var moment=require(_0x53cf('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x53cf('0x5'));var path=require('path');var sox=require(_0x53cf('0x6'));var csv=require(_0x53cf('0x7'));var ejs=require(_0x53cf('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require('squel');var crypto=require(_0x53cf('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x53cf('0xa'));var toCsv=require(_0x53cf('0x7'));var querystring=require(_0x53cf('0xb'));var Papa=require(_0x53cf('0xc'));var Redis=require(_0x53cf('0xd'));var authService=require(_0x53cf('0xe'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x53cf('0xf'))(_0x53cf('0x10'));var utils=require(_0x53cf('0x11'));var config=require('../../config/environment');var licenseUtil=require(_0x53cf('0x12'));var db=require(_0x53cf('0x13'))['db'];function respondWithStatusCode(_0x33bede,_0xc34a56){_0xc34a56=_0xc34a56||0xcc;return function(_0x3b3b20){if(_0x3b3b20){return _0x33bede[_0x53cf('0x14')](_0xc34a56);}return _0x33bede['status'](_0xc34a56)[_0x53cf('0x15')]();};}function respondWithResult(_0x1623d3,_0x49e73d){_0x49e73d=_0x49e73d||0xc8;return function(_0x943f2e){if(_0x943f2e){return _0x1623d3[_0x53cf('0x16')](_0x49e73d)[_0x53cf('0x17')](_0x943f2e);}};}function respondWithFilteredResult(_0x4ef376,_0x4b79cf){return function(_0x328dcf){if(_0x328dcf){var _0x1c5322=typeof _0x4b79cf[_0x53cf('0x18')]==='undefined'&&typeof _0x4b79cf[_0x53cf('0x19')]==='undefined';var _0x29ecc9=_0x328dcf[_0x53cf('0x1a')];var _0x1878d9=_0x1c5322?0x0:_0x4b79cf[_0x53cf('0x18')];var _0x50d673=_0x1c5322?_0x328dcf[_0x53cf('0x1a')]:_0x4b79cf['offset']+_0x4b79cf[_0x53cf('0x19')];var _0x355dc7;if(_0x50d673>=_0x29ecc9){_0x50d673=_0x29ecc9;_0x355dc7=0xc8;}else{_0x355dc7=0xce;}_0x4ef376[_0x53cf('0x16')](_0x355dc7);return _0x4ef376['set'](_0x53cf('0x1b'),_0x1878d9+'-'+_0x50d673+'/'+_0x29ecc9)['json'](_0x328dcf);}return null;};}function patchUpdates(_0x4897d7){return function(_0x17df3b){try{jsonpatch['apply'](_0x17df3b,_0x4897d7,!![]);}catch(_0x20af67){return BPromise[_0x53cf('0x1c')](_0x20af67);}return _0x17df3b['save']();};}function saveUpdates(_0x2202a8,_0x149546){return function(_0x4c3227){if(_0x4c3227){return _0x4c3227[_0x53cf('0x1d')](_0x2202a8)[_0x53cf('0x1e')](function(_0x279f45){return _0x279f45;});}return null;};}function removeEntity(_0xdc49ce,_0x58f56a){return function(_0x3ee430){if(_0x3ee430){return _0x3ee430['destroy']()[_0x53cf('0x1e')](function(){_0xdc49ce[_0x53cf('0x16')](0xcc)[_0x53cf('0x15')]();});}};}function handleEntityNotFound(_0x3df440,_0x17b536){return function(_0xed826c){if(!_0xed826c){_0x3df440['sendStatus'](0x194);}return _0xed826c;};}function handleError(_0x46199e,_0xde4b6d){_0xde4b6d=_0xde4b6d||0x1f4;return function(_0x397866){logger[_0x53cf('0x1f')](_0x397866['stack']);if(_0x397866['name']){delete _0x397866[_0x53cf('0x20')];}_0x46199e['status'](_0xde4b6d)[_0x53cf('0x21')](_0x397866);};}exports[_0x53cf('0x22')]=function(_0x479d1a,_0x410e98){var _0x46c60e={},_0x3a6fdb={},_0x5586cc={'count':0x0,'rows':[]};var _0x4dec0e=_[_0x53cf('0x23')](db['ChatTransferReport'][_0x53cf('0x24')],function(_0x5c9f25){return{'name':_0x5c9f25[_0x53cf('0x25')],'type':_0x5c9f25[_0x53cf('0x26')][_0x53cf('0x27')]};});_0x3a6fdb[_0x53cf('0x28')]=_[_0x53cf('0x23')](_0x4dec0e,_0x53cf('0x20'));_0x3a6fdb[_0x53cf('0x29')]=_[_0x53cf('0x2a')](_0x479d1a[_0x53cf('0x29')]);_0x3a6fdb[_0x53cf('0x2b')]=_['intersection'](_0x3a6fdb['model'],_0x3a6fdb[_0x53cf('0x29')]);_0x46c60e[_0x53cf('0x2c')]=_[_0x53cf('0x2d')](_0x3a6fdb[_0x53cf('0x28')],qs[_0x53cf('0x2e')](_0x479d1a['query'][_0x53cf('0x2e')]));_0x46c60e[_0x53cf('0x2c')]=_0x46c60e[_0x53cf('0x2c')]['length']?_0x46c60e[_0x53cf('0x2c')]:_0x3a6fdb[_0x53cf('0x28')];if(!_0x479d1a[_0x53cf('0x29')]['hasOwnProperty'](_0x53cf('0x2f'))){_0x46c60e[_0x53cf('0x19')]=qs['limit'](_0x479d1a['query'][_0x53cf('0x19')]);_0x46c60e['offset']=qs[_0x53cf('0x18')](_0x479d1a[_0x53cf('0x29')][_0x53cf('0x18')]);}_0x46c60e[_0x53cf('0x30')]=qs[_0x53cf('0x31')](_0x479d1a[_0x53cf('0x29')][_0x53cf('0x31')]);_0x46c60e[_0x53cf('0x32')]=qs[_0x53cf('0x2b')](_[_0x53cf('0x33')](_0x479d1a['query'],_0x3a6fdb[_0x53cf('0x2b')]),_0x4dec0e);if(_0x479d1a[_0x53cf('0x29')][_0x53cf('0x34')]){_0x46c60e[_0x53cf('0x32')]=_[_0x53cf('0x35')](_0x46c60e['where'],{'$or':_[_0x53cf('0x23')](_0x4dec0e,function(_0x37bea8){if(_0x37bea8[_0x53cf('0x26')]!==_0x53cf('0x36')){var _0x4527ac={};_0x4527ac[_0x37bea8['name']]={'$like':'%'+_0x479d1a[_0x53cf('0x29')][_0x53cf('0x34')]+'%'};return _0x4527ac;}})});}_0x46c60e=_[_0x53cf('0x35')]({},_0x46c60e,_0x479d1a[_0x53cf('0x37')]);var _0x377a36={'where':_0x46c60e[_0x53cf('0x32')]};return db['ChatTransferReport']['count'](_0x377a36)[_0x53cf('0x1e')](function(_0x1d79dc){_0x5586cc[_0x53cf('0x1a')]=_0x1d79dc;if(_0x479d1a[_0x53cf('0x29')][_0x53cf('0x38')]){_0x46c60e['include']=[{'all':!![]}];}return db['ChatTransferReport'][_0x53cf('0x39')](_0x46c60e);})[_0x53cf('0x1e')](function(_0x108a22){_0x5586cc['rows']=_0x108a22;return _0x5586cc;})[_0x53cf('0x1e')](respondWithFilteredResult(_0x410e98,_0x46c60e))[_0x53cf('0x3a')](handleError(_0x410e98,null));};exports[_0x53cf('0x3b')]=function(_0x17cb20,_0x43e588){var _0x27a4df={'raw':!![],'where':{'id':_0x17cb20['params']['id']}},_0x552931={};_0x552931[_0x53cf('0x28')]=_[_0x53cf('0x2a')](db[_0x53cf('0x3c')][_0x53cf('0x24')]);_0x552931[_0x53cf('0x29')]=_['keys'](_0x17cb20[_0x53cf('0x29')]);_0x552931[_0x53cf('0x2b')]=_[_0x53cf('0x2d')](_0x552931['model'],_0x552931['query']);_0x27a4df['attributes']=_['intersection'](_0x552931['model'],qs[_0x53cf('0x2e')](_0x17cb20[_0x53cf('0x29')][_0x53cf('0x2e')]));_0x27a4df[_0x53cf('0x2c')]=_0x27a4df[_0x53cf('0x2c')][_0x53cf('0x3d')]?_0x27a4df['attributes']:_0x552931[_0x53cf('0x28')];if(_0x17cb20[_0x53cf('0x29')][_0x53cf('0x38')]){_0x27a4df[_0x53cf('0x3e')]=[{'all':!![]}];}_0x27a4df=_[_0x53cf('0x35')]({},_0x27a4df,_0x17cb20[_0x53cf('0x37')]);return db[_0x53cf('0x3c')][_0x53cf('0x3f')](_0x27a4df)[_0x53cf('0x1e')](handleEntityNotFound(_0x43e588,null))[_0x53cf('0x1e')](respondWithResult(_0x43e588,null))[_0x53cf('0x3a')](handleError(_0x43e588,null));};exports[_0x53cf('0x40')]=function(_0x367c22,_0x2f7a4d){return db[_0x53cf('0x3c')]['create'](_0x367c22[_0x53cf('0x41')],{})[_0x53cf('0x1e')](respondWithResult(_0x2f7a4d,0xc9))['catch'](handleError(_0x2f7a4d,null));};exports[_0x53cf('0x1d')]=function(_0x2beb72,_0x87e272){if(_0x2beb72[_0x53cf('0x41')]['id']){delete _0x2beb72[_0x53cf('0x41')]['id'];}return db[_0x53cf('0x3c')]['find']({'where':{'id':_0x2beb72[_0x53cf('0x42')]['id']}})[_0x53cf('0x1e')](handleEntityNotFound(_0x87e272,null))[_0x53cf('0x1e')](saveUpdates(_0x2beb72[_0x53cf('0x41')],null))[_0x53cf('0x1e')](respondWithResult(_0x87e272,null))[_0x53cf('0x3a')](handleError(_0x87e272,null));};exports['destroy']=function(_0x51b661,_0x166a58){return db[_0x53cf('0x3c')][_0x53cf('0x3f')]({'where':{'id':_0x51b661['params']['id']}})[_0x53cf('0x1e')](handleEntityNotFound(_0x166a58,null))[_0x53cf('0x1e')](removeEntity(_0x166a58,null))[_0x53cf('0x3a')](handleError(_0x166a58,null));};exports['describe']=function(_0x42f826,_0x5c096c){return db[_0x53cf('0x3c')]['describe']()[_0x53cf('0x1e')](respondWithResult(_0x5c096c,null))['catch'](handleError(_0x5c096c,null));}; \ No newline at end of file +var _0xa5eb=['apply','save','then','error','stack','send','index','map','ChatTransferReport','rawAttributes','fieldName','type','key','name','query','keys','intersection','model','attributes','fields','length','nolimit','limit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','update','body','destroy','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','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','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','set'];(function(_0x5a413c,_0x2d9f78){var _0x145472=function(_0x177721){while(--_0x177721){_0x5a413c['push'](_0x5a413c['shift']());}};_0x145472(++_0x2d9f78);}(_0xa5eb,0x1ae));var _0xba5e=function(_0x1832cd,_0x5015c4){_0x1832cd=_0x1832cd-0x0;var _0x46bf3b=_0xa5eb[_0x1832cd];return _0x46bf3b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xba5e('0x0'));var zipdir=require(_0xba5e('0x1'));var jsonpatch=require(_0xba5e('0x2'));var rp=require(_0xba5e('0x3'));var moment=require(_0xba5e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xba5e('0x5'));var util=require(_0xba5e('0x6'));var path=require(_0xba5e('0x7'));var sox=require(_0xba5e('0x8'));var csv=require('to-csv');var ejs=require(_0xba5e('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba5e('0xa'));var squel=require(_0xba5e('0xb'));var crypto=require(_0xba5e('0xc'));var jsforce=require(_0xba5e('0xd'));var deskjs=require(_0xba5e('0xe'));var toCsv=require(_0xba5e('0xf'));var querystring=require(_0xba5e('0x10'));var Papa=require('papaparse');var Redis=require(_0xba5e('0x11'));var authService=require(_0xba5e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xba5e('0x13'));var hardwareService=require(_0xba5e('0x14'));var logger=require('../../config/logger')(_0xba5e('0x15'));var utils=require('../../config/utils');var config=require(_0xba5e('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xba5e('0x17'))['db'];function respondWithStatusCode(_0x50363f,_0x2966f4){_0x2966f4=_0x2966f4||0xcc;return function(_0x23cbcc){if(_0x23cbcc){return _0x50363f[_0xba5e('0x18')](_0x2966f4);}return _0x50363f[_0xba5e('0x19')](_0x2966f4)[_0xba5e('0x1a')]();};}function respondWithResult(_0x444908,_0x28c378){_0x28c378=_0x28c378||0xc8;return function(_0x543b11){if(_0x543b11){return _0x444908[_0xba5e('0x19')](_0x28c378)[_0xba5e('0x1b')](_0x543b11);}};}function respondWithFilteredResult(_0x8d3e0,_0x4fc979){return function(_0xc4e688){if(_0xc4e688){var _0x430e2e=typeof _0x4fc979[_0xba5e('0x1c')]===_0xba5e('0x1d')&&typeof _0x4fc979['limit']===_0xba5e('0x1d');var _0xae37df=_0xc4e688[_0xba5e('0x1e')];var _0x15c270=_0x430e2e?0x0:_0x4fc979[_0xba5e('0x1c')];var _0x2a2f2c=_0x430e2e?_0xc4e688[_0xba5e('0x1e')]:_0x4fc979[_0xba5e('0x1c')]+_0x4fc979['limit'];var _0x19ebbb;if(_0x2a2f2c>=_0xae37df){_0x2a2f2c=_0xae37df;_0x19ebbb=0xc8;}else{_0x19ebbb=0xce;}_0x8d3e0['status'](_0x19ebbb);return _0x8d3e0[_0xba5e('0x1f')]('Content-Range',_0x15c270+'-'+_0x2a2f2c+'/'+_0xae37df)[_0xba5e('0x1b')](_0xc4e688);}return null;};}function patchUpdates(_0x372d8f){return function(_0x4f7ac2){try{jsonpatch[_0xba5e('0x20')](_0x4f7ac2,_0x372d8f,!![]);}catch(_0x5f23a4){return BPromise['reject'](_0x5f23a4);}return _0x4f7ac2[_0xba5e('0x21')]();};}function saveUpdates(_0x6f3d1b,_0x24dbee){return function(_0x32bdf8){if(_0x32bdf8){return _0x32bdf8['update'](_0x6f3d1b)['then'](function(_0x21414a){return _0x21414a;});}return null;};}function removeEntity(_0x3cb6d3,_0x3cd348){return function(_0x241c27){if(_0x241c27){return _0x241c27['destroy']()[_0xba5e('0x22')](function(){_0x3cb6d3['status'](0xcc)[_0xba5e('0x1a')]();});}};}function handleEntityNotFound(_0x46ae09,_0x58ab56){return function(_0x3a027d){if(!_0x3a027d){_0x46ae09[_0xba5e('0x18')](0x194);}return _0x3a027d;};}function handleError(_0x561c4d,_0x4db62f){_0x4db62f=_0x4db62f||0x1f4;return function(_0xe1bf7f){logger[_0xba5e('0x23')](_0xe1bf7f[_0xba5e('0x24')]);if(_0xe1bf7f['name']){delete _0xe1bf7f['name'];}_0x561c4d['status'](_0x4db62f)[_0xba5e('0x25')](_0xe1bf7f);};}exports[_0xba5e('0x26')]=function(_0x4996b5,_0x1335e3){var _0x1b5f4a={},_0x33a72f={},_0x212ab6={'count':0x0,'rows':[]};var _0xbcd96=_[_0xba5e('0x27')](db[_0xba5e('0x28')][_0xba5e('0x29')],function(_0x4d0c9f){return{'name':_0x4d0c9f[_0xba5e('0x2a')],'type':_0x4d0c9f[_0xba5e('0x2b')][_0xba5e('0x2c')]};});_0x33a72f['model']=_[_0xba5e('0x27')](_0xbcd96,_0xba5e('0x2d'));_0x33a72f[_0xba5e('0x2e')]=_[_0xba5e('0x2f')](_0x4996b5[_0xba5e('0x2e')]);_0x33a72f['filters']=_[_0xba5e('0x30')](_0x33a72f[_0xba5e('0x31')],_0x33a72f['query']);_0x1b5f4a[_0xba5e('0x32')]=_[_0xba5e('0x30')](_0x33a72f[_0xba5e('0x31')],qs[_0xba5e('0x33')](_0x4996b5['query'][_0xba5e('0x33')]));_0x1b5f4a[_0xba5e('0x32')]=_0x1b5f4a[_0xba5e('0x32')][_0xba5e('0x34')]?_0x1b5f4a[_0xba5e('0x32')]:_0x33a72f['model'];if(!_0x4996b5[_0xba5e('0x2e')]['hasOwnProperty'](_0xba5e('0x35'))){_0x1b5f4a[_0xba5e('0x36')]=qs[_0xba5e('0x36')](_0x4996b5[_0xba5e('0x2e')][_0xba5e('0x36')]);_0x1b5f4a[_0xba5e('0x1c')]=qs[_0xba5e('0x1c')](_0x4996b5[_0xba5e('0x2e')][_0xba5e('0x1c')]);}_0x1b5f4a[_0xba5e('0x37')]=qs[_0xba5e('0x38')](_0x4996b5[_0xba5e('0x2e')][_0xba5e('0x38')]);_0x1b5f4a[_0xba5e('0x39')]=qs[_0xba5e('0x3a')](_[_0xba5e('0x3b')](_0x4996b5[_0xba5e('0x2e')],_0x33a72f['filters']),_0xbcd96);if(_0x4996b5[_0xba5e('0x2e')][_0xba5e('0x3c')]){_0x1b5f4a[_0xba5e('0x39')]=_[_0xba5e('0x3d')](_0x1b5f4a['where'],{'$or':_['map'](_0xbcd96,function(_0x1278aa){if(_0x1278aa[_0xba5e('0x2b')]!==_0xba5e('0x3e')){var _0x55f5cb={};_0x55f5cb[_0x1278aa['name']]={'$like':'%'+_0x4996b5[_0xba5e('0x2e')][_0xba5e('0x3c')]+'%'};return _0x55f5cb;}})});}_0x1b5f4a=_[_0xba5e('0x3d')]({},_0x1b5f4a,_0x4996b5[_0xba5e('0x3f')]);var _0x6ac2ee={'where':_0x1b5f4a[_0xba5e('0x39')]};return db[_0xba5e('0x28')][_0xba5e('0x1e')](_0x6ac2ee)[_0xba5e('0x22')](function(_0x1a5a56){_0x212ab6[_0xba5e('0x1e')]=_0x1a5a56;if(_0x4996b5[_0xba5e('0x2e')][_0xba5e('0x40')]){_0x1b5f4a[_0xba5e('0x41')]=[{'all':!![]}];}return db['ChatTransferReport'][_0xba5e('0x42')](_0x1b5f4a);})[_0xba5e('0x22')](function(_0x575af2){_0x212ab6[_0xba5e('0x43')]=_0x575af2;return _0x212ab6;})[_0xba5e('0x22')](respondWithFilteredResult(_0x1335e3,_0x1b5f4a))[_0xba5e('0x44')](handleError(_0x1335e3,null));};exports[_0xba5e('0x45')]=function(_0x485750,_0x3d3d5d){var _0x100d70={'raw':!![],'where':{'id':_0x485750[_0xba5e('0x46')]['id']}},_0x1a38a4={};_0x1a38a4['model']=_[_0xba5e('0x2f')](db[_0xba5e('0x28')][_0xba5e('0x29')]);_0x1a38a4[_0xba5e('0x2e')]=_['keys'](_0x485750['query']);_0x1a38a4[_0xba5e('0x3a')]=_['intersection'](_0x1a38a4[_0xba5e('0x31')],_0x1a38a4[_0xba5e('0x2e')]);_0x100d70[_0xba5e('0x32')]=_['intersection'](_0x1a38a4[_0xba5e('0x31')],qs[_0xba5e('0x33')](_0x485750['query'][_0xba5e('0x33')]));_0x100d70[_0xba5e('0x32')]=_0x100d70[_0xba5e('0x32')]['length']?_0x100d70[_0xba5e('0x32')]:_0x1a38a4[_0xba5e('0x31')];if(_0x485750[_0xba5e('0x2e')][_0xba5e('0x40')]){_0x100d70[_0xba5e('0x41')]=[{'all':!![]}];}_0x100d70=_[_0xba5e('0x3d')]({},_0x100d70,_0x485750[_0xba5e('0x3f')]);return db[_0xba5e('0x28')][_0xba5e('0x47')](_0x100d70)[_0xba5e('0x22')](handleEntityNotFound(_0x3d3d5d,null))['then'](respondWithResult(_0x3d3d5d,null))[_0xba5e('0x44')](handleError(_0x3d3d5d,null));};exports[_0xba5e('0x48')]=function(_0x359d54,_0xc87e74){return db[_0xba5e('0x28')][_0xba5e('0x48')](_0x359d54['body'],{})[_0xba5e('0x22')](respondWithResult(_0xc87e74,0xc9))[_0xba5e('0x44')](handleError(_0xc87e74,null));};exports[_0xba5e('0x49')]=function(_0x4baddd,_0x571316){if(_0x4baddd[_0xba5e('0x4a')]['id']){delete _0x4baddd['body']['id'];}return db['ChatTransferReport']['find']({'where':{'id':_0x4baddd[_0xba5e('0x46')]['id']}})[_0xba5e('0x22')](handleEntityNotFound(_0x571316,null))[_0xba5e('0x22')](saveUpdates(_0x4baddd['body'],null))[_0xba5e('0x22')](respondWithResult(_0x571316,null))[_0xba5e('0x44')](handleError(_0x571316,null));};exports[_0xba5e('0x4b')]=function(_0x37d11c,_0x50b476){return db['ChatTransferReport'][_0xba5e('0x47')]({'where':{'id':_0x37d11c[_0xba5e('0x46')]['id']}})['then'](handleEntityNotFound(_0x50b476,null))[_0xba5e('0x22')](removeEntity(_0x50b476,null))[_0xba5e('0x44')](handleError(_0x50b476,null));};exports[_0xba5e('0x4c')]=function(_0x4e81ab,_0x486568){return db[_0xba5e('0x28')][_0xba5e('0x4c')]()[_0xba5e('0x22')](respondWithResult(_0x486568,null))[_0xba5e('0x44')](handleError(_0x486568,null));}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.model.js b/server/api/chatTransferReport/chatTransferReport.model.js index a38ed22..9fa8938 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 _0xe0a3=['ChatTransferReport','report_chat_transfer','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','./chatTransferReport.attributes','exports'];(function(_0x4cbf22,_0x2c4b7e){var _0x517c08=function(_0x428735){while(--_0x428735){_0x4cbf22['push'](_0x4cbf22['shift']());}};_0x517c08(++_0x2c4b7e);}(_0xe0a3,0x1bf));var _0x3e0a=function(_0xb66df,_0x4fb5ce){_0xb66df=_0xb66df-0x0;var _0x42a702=_0xe0a3[_0xb66df];return _0x42a702;};'use strict';var _=require(_0x3e0a('0x0'));var util=require(_0x3e0a('0x1'));var logger=require(_0x3e0a('0x2'))(_0x3e0a('0x3'));var moment=require(_0x3e0a('0x4'));var BPromise=require(_0x3e0a('0x5'));var rp=require(_0x3e0a('0x6'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3e0a('0x7'));module[_0x3e0a('0x8')]=function(_0x373be0,_0x5c7a1f){return _0x373be0['define'](_0x3e0a('0x9'),attributes,{'tableName':_0x3e0a('0xa'),'paranoid':![],'indexes':[{'name':_0x3e0a('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x4258=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','ChatTransferReport','report_chat_transfer','uniqueid'];(function(_0x4259a3,_0x2f9e82){var _0x5dfed4=function(_0x443519){while(--_0x443519){_0x4259a3['push'](_0x4259a3['shift']());}};_0x5dfed4(++_0x2f9e82);}(_0x4258,0x198));var _0x8425=function(_0x42da91,_0x337a6d){_0x42da91=_0x42da91-0x0;var _0xeef503=_0x4258[_0x42da91];return _0xeef503;};'use strict';var _=require(_0x8425('0x0'));var util=require('util');var logger=require(_0x8425('0x1'))(_0x8425('0x2'));var moment=require(_0x8425('0x3'));var BPromise=require(_0x8425('0x4'));var rp=require(_0x8425('0x5'));var fs=require('fs');var path=require(_0x8425('0x6'));var rimraf=require(_0x8425('0x7'));var config=require(_0x8425('0x8'));var attributes=require('./chatTransferReport.attributes');module['exports']=function(_0x56b3e9,_0x5a87c4){return _0x56b3e9['define'](_0x8425('0x9'),attributes,{'tableName':_0x8425('0xa'),'paranoid':![],'indexes':[{'name':_0x8425('0xb'),'fields':[_0x8425('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatTransferReport/chatTransferReport.rpc.js b/server/api/chatTransferReport/chatTransferReport.rpc.js index 975d41e..de9d1f4 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 _0x92e3=['ChatTransferReport,\x20%s,\x20%s','ChatTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','then','info'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x92e3,0x15d));var _0x392e=function(_0x1fe3ff,_0x4ba5b7){_0x1fe3ff=_0x1fe3ff-0x0;var _0x11b4f2=_0x92e3[_0x1fe3ff];return _0x11b4f2;};'use strict';var _=require('lodash');var util=require(_0x392e('0x0'));var moment=require(_0x392e('0x1'));var BPromise=require(_0x392e('0x2'));var rs=require(_0x392e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x392e('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x392e('0x5'))('rpc');var config=require(_0x392e('0x6'));var jayson=require(_0x392e('0x7'));var client=jayson['client'][_0x392e('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x36abc4,_0xb14b69,_0x3b20bb){return new BPromise(function(_0x48c77e,_0x14ca70){return client['request'](_0x36abc4,_0x3b20bb)[_0x392e('0x9')](function(_0x3139a5){logger[_0x392e('0xa')](_0x392e('0xb'),_0xb14b69,'request\x20sent');logger['debug'](_0x392e('0xc'),_0xb14b69,_0x392e('0xd'),JSON[_0x392e('0xe')](_0x3139a5));if(_0x3139a5['error']){if(_0x3139a5[_0x392e('0xf')][_0x392e('0x10')]===0x1f4){logger[_0x392e('0xf')](_0x392e('0xb'),_0xb14b69,_0x3139a5[_0x392e('0xf')][_0x392e('0x11')]);return _0x14ca70(_0x3139a5[_0x392e('0xf')][_0x392e('0x11')]);}logger[_0x392e('0xf')](_0x392e('0xb'),_0xb14b69,_0x3139a5[_0x392e('0xf')][_0x392e('0x11')]);return _0x48c77e(_0x3139a5[_0x392e('0xf')]['message']);}else{logger[_0x392e('0xa')]('ChatTransferReport,\x20%s,\x20%s',_0xb14b69,_0x392e('0xd'));_0x48c77e(_0x3139a5[_0x392e('0x12')][_0x392e('0x11')]);}})[_0x392e('0x13')](function(_0x3b6e11){logger[_0x392e('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0xb14b69,_0x3b6e11);_0x14ca70(_0x3b6e11);});});} \ No newline at end of file +var _0xfb0c=['ChatTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','ChatTransferReport,\x20%s,\x20%s','request\x20sent'];(function(_0x55cd92,_0x2af5b1){var _0x102822=function(_0x49ef9a){while(--_0x49ef9a){_0x55cd92['push'](_0x55cd92['shift']());}};_0x102822(++_0x2af5b1);}(_0xfb0c,0xa7));var _0xcfb0=function(_0x2978a2,_0x462bb8){_0x2978a2=_0x2978a2-0x0;var _0x3e21c8=_0xfb0c[_0x2978a2];return _0x3e21c8;};'use strict';var _=require(_0xcfb0('0x0'));var util=require(_0xcfb0('0x1'));var moment=require('moment');var BPromise=require(_0xcfb0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcfb0('0x3'));var db=require(_0xcfb0('0x4'))['db'];var utils=require(_0xcfb0('0x5'));var logger=require(_0xcfb0('0x6'))(_0xcfb0('0x7'));var config=require('../../config/environment');var jayson=require(_0xcfb0('0x8'));var client=jayson[_0xcfb0('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x20b294,_0x5c27bf,_0x4edda1){return new BPromise(function(_0x122f09,_0x42269){return client[_0xcfb0('0xa')](_0x20b294,_0x4edda1)['then'](function(_0x246a8e){logger['info'](_0xcfb0('0xb'),_0x5c27bf,_0xcfb0('0xc'));logger['debug'](_0xcfb0('0xd'),_0x5c27bf,_0xcfb0('0xc'),JSON[_0xcfb0('0xe')](_0x246a8e));if(_0x246a8e[_0xcfb0('0xf')]){if(_0x246a8e[_0xcfb0('0xf')][_0xcfb0('0x10')]===0x1f4){logger['error'](_0xcfb0('0xb'),_0x5c27bf,_0x246a8e[_0xcfb0('0xf')][_0xcfb0('0x11')]);return _0x42269(_0x246a8e[_0xcfb0('0xf')]['message']);}logger[_0xcfb0('0xf')]('ChatTransferReport,\x20%s,\x20%s',_0x5c27bf,_0x246a8e[_0xcfb0('0xf')][_0xcfb0('0x11')]);return _0x122f09(_0x246a8e['error'][_0xcfb0('0x11')]);}else{logger[_0xcfb0('0x12')](_0xcfb0('0xb'),_0x5c27bf,_0xcfb0('0xc'));_0x122f09(_0x246a8e[_0xcfb0('0x13')]['message']);}})['catch'](function(_0xb110ed){logger[_0xcfb0('0xf')](_0xcfb0('0xb'),_0x5c27bf,_0xb110ed);_0x42269(_0xb110ed);});});} \ No newline at end of file diff --git a/server/api/chatTransferReport/index.js b/server/api/chatTransferReport/index.js index f490ecd..055bc0e 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 _0x8c17=['create','put','update','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./chatTransferReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show'];(function(_0x4829dd,_0x50391e){var _0x353a08=function(_0x210fc0){while(--_0x210fc0){_0x4829dd['push'](_0x4829dd['shift']());}};_0x353a08(++_0x50391e);}(_0x8c17,0xd7));var _0x78c1=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0x8c17[_0x138adb];return _0x1b27f2;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x78c1('0x0'));var timeout=require(_0x78c1('0x1'));var express=require(_0x78c1('0x2'));var router=express[_0x78c1('0x3')]();var fs_extra=require(_0x78c1('0x4'));var auth=require(_0x78c1('0x5'));var interaction=require(_0x78c1('0x6'));var config=require(_0x78c1('0x7'));var controller=require(_0x78c1('0x8'));router[_0x78c1('0x9')]('/',auth['isAuthenticated'](),controller[_0x78c1('0xa')]);router[_0x78c1('0x9')](_0x78c1('0xb'),auth['isAuthenticated'](),controller[_0x78c1('0xc')]);router[_0x78c1('0x9')](_0x78c1('0xd'),auth[_0x78c1('0xe')](),controller[_0x78c1('0xf')]);router['post']('/',auth[_0x78c1('0xe')](),controller[_0x78c1('0x10')]);router[_0x78c1('0x11')](_0x78c1('0xd'),auth[_0x78c1('0xe')](),controller[_0x78c1('0x12')]);router['delete'](_0x78c1('0xd'),auth[_0x78c1('0xe')](),controller[_0x78c1('0x13')]);module[_0x78c1('0x14')]=router; \ No newline at end of file +var _0xf00d=['get','index','/describe','isAuthenticated','describe','/:id','show','create','put','update','destroy','exports','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','./chatTransferReport.controller'];(function(_0xec9d8a,_0x3d89cd){var _0x4f3496=function(_0x1acbdc){while(--_0x1acbdc){_0xec9d8a['push'](_0xec9d8a['shift']());}};_0x4f3496(++_0x3d89cd);}(_0xf00d,0x1ce));var _0xdf00=function(_0x3efadf,_0x364aa4){_0x3efadf=_0x3efadf-0x0;var _0x1d1e97=_0xf00d[_0x3efadf];return _0x1d1e97;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xdf00('0x0'));var timeout=require(_0xdf00('0x1'));var express=require('express');var router=express[_0xdf00('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xdf00('0x3'));var interaction=require(_0xdf00('0x4'));var config=require('../../config/environment');var controller=require(_0xdf00('0x5'));router[_0xdf00('0x6')]('/',auth['isAuthenticated'](),controller[_0xdf00('0x7')]);router[_0xdf00('0x6')](_0xdf00('0x8'),auth[_0xdf00('0x9')](),controller[_0xdf00('0xa')]);router[_0xdf00('0x6')](_0xdf00('0xb'),auth[_0xdf00('0x9')](),controller[_0xdf00('0xc')]);router['post']('/',auth[_0xdf00('0x9')](),controller[_0xdf00('0xd')]);router[_0xdf00('0xe')](_0xdf00('0xb'),auth[_0xdf00('0x9')](),controller[_0xdf00('0xf')]);router['delete'](_0xdf00('0xb'),auth[_0xdf00('0x9')](),controller[_0xdf00('0x10')]);module[_0xdf00('0x11')]=router; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.attributes.js b/server/api/chatWebsite/chatWebsite.attributes.js index 99c508c..b49e034 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 _0xda55=['alternate','#fafafa','System','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','sequelize','randomstring','STRING','address','email','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','rounded','squared','We\x20are\x20here!','Send','Contact\x20us','TEXT','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Note','Type\x20a\x20message','Thanks\x20you\x20for\x20your\x20time!','Skip','Feedback','thumb','star','stringify','input','text','getDataValue','onlineForm','parse','Comments','Leave\x20your\x20comments','offlineForm','setDataValue','generate','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','website_alias','bottom_right','CHAT'];(function(_0x3f6e27,_0x188bd7){var _0x2ab5e6=function(_0x3a21b5){while(--_0x3a21b5){_0x3f6e27['push'](_0x3f6e27['shift']());}};_0x2ab5e6(++_0x188bd7);}(_0xda55,0x6d));var _0x5da5=function(_0x15a34f,_0x1378ba){_0x15a34f=_0x15a34f-0x0;var _0x2e7b6b=_0xda55[_0x15a34f];return _0x2e7b6b;};'use strict';var Sequelize=require(_0x5da5('0x0'));var rs=require(_0x5da5('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'unique':_0x5da5('0x3')},'description':{'type':Sequelize[_0x5da5('0x2')]},'mapKey':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x4')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0x5da5('0x4')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Agent'},'customerAlias':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'defaultValue':_0x5da5('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'defaultValue':_0x5da5('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'defaultValue':_0x5da5('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'defaultValue':'#ffffff','validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0x5da5('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize[_0x5da5('0x2')]},'animation':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0x5da5('0x9')](_0x5da5('0xa'),_0x5da5('0xb')),'defaultValue':_0x5da5('0xa')},'header_online':{'type':Sequelize['STRING'],'defaultValue':_0x5da5('0xc')},'start_chat_button':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Chat'},'offline_chat_button':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0xd')},'header_offline':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0xe')},'download_transcript':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0x5da5('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize['STRING'],'defaultValue':'Powered\x20by\x20xCALLY'},'defaultWhiteLabel':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'sitepic':{'type':Sequelize[_0x5da5('0xf')]},'closingQuestion':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x12')},'noteTitle':{'type':Sequelize['STRING'],'defaultValue':_0x5da5('0x13')},'placeholderMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x14')},'closingMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x15')},'closingMessageButton':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Send'},'skipMessageButton':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x16')},'conditionAgreement':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x17')},'ratingType':{'type':Sequelize[_0x5da5('0x9')]('star',_0x5da5('0x18')),'defaultValue':_0x5da5('0x19')},'ratingStarsNumber':{'type':Sequelize[_0x5da5('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0x5da5('0xf')],'defaultValue':function(){return JSON[_0x5da5('0x1a')]({'items':[{'type':_0x5da5('0x1b'),'variable':null,'config':{'placeholder':'name','type':_0x5da5('0x1c'),'required':!![]},'props':{'title':'name','helpText':''}},{'type':_0x5da5('0x1b'),'props':{'title':_0x5da5('0x4'),'helpText':''},'config':{'required':!![],'placeholder':_0x5da5('0x4'),'type':'email'},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0x5da5('0x1d')](_0x5da5('0x1e'))?JSON[_0x5da5('0x1f')](this[_0x5da5('0x1d')]('onlineForm')):{};},'set':function(_0x5b0b43){return this['setDataValue'](_0x5da5('0x1e'),JSON['stringify'](_0x5b0b43));}},'offlineForm':{'type':Sequelize['TEXT'],'defaultValue':function(){return JSON[_0x5da5('0x1a')]({'items':[{'type':_0x5da5('0x1b'),'props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':_0x5da5('0x4'),'type':_0x5da5('0x4')},'variable':null},{'type':'textarea','config':{'placeholder':_0x5da5('0x20')},'props':{'title':_0x5da5('0x20'),'helpText':_0x5da5('0x21')}}],'fromKey':0x0});},'get':function(){return this[_0x5da5('0x1d')](_0x5da5('0x22'))?JSON['parse'](this[_0x5da5('0x1d')](_0x5da5('0x22'))):{};},'set':function(_0x31cb5f){return this[_0x5da5('0x23')]('offlineForm',JSON['stringify'](_0x31cb5f));}},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x5da5('0x24')]();}},'autoclose':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize['STRING']},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0x5da5('0x2')]},'waitingTitle':{'type':Sequelize['STRING'],'defaultValue':'All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.'},'waitingMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.'},'offlineMessageSubject':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x25')},'offlineMessageBody':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x26')},'enableUnmanagedNote':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x27')},'skipUnmanaged':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Skip'},'sendUnmanaged':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0x5da5('0xf')]},'showAgentAvatar':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize[_0x5da5('0x2')]},'notificationTemplate':{'type':Sequelize[_0x5da5('0xf')],'defaultValue':function(){return _0x5da5('0x28');}},'notificationSound':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'agentIdentifier':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x29')},'waitForTheAssignedAgent':{'type':Sequelize[_0x5da5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize['STRING'],'defaultValue':_0x5da5('0x2a')},'verticalAlignment':{'type':Sequelize['INTEGER'],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x2b')},'messagesAlignment':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x2c')},'defaultTitle':{'type':Sequelize['STRING']},'customerAvatar':{'type':Sequelize[_0x5da5('0xf')]},'showCustomerAvatar':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0x5da5('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x5da5('0x2d'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x5da5('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0x5da5('0x2')],'defaultValue':_0x5da5('0x2e')},'systemAvatar':{'type':Sequelize[_0x5da5('0xf')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x5da5('0x7')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![],'comment':_0x5da5('0x2f'),'set':function(_0x14c3f5){if(!_0x14c3f5)this[_0x5da5('0x23')](_0x5da5('0x30'),null);this['setDataValue'](_0x5da5('0x31'),_0x14c3f5);}},'vidaooEscalation':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0x5da5('0x2')],'allowNull':![],'defaultValue':'Generated\x20by\x20XCALLY\x20Motion'},'vidaooNote':{'type':Sequelize['STRING'],'defaultValue':function(){return _0x5da5('0x32');}},'vidaooMetadata':{'type':Sequelize[_0x5da5('0xf')],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0x5da5('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0x5da5('0xf')]}}; \ No newline at end of file +var _0xa74f=['Meeting\x20generated\x20for\x20interaction\x20#{{interaction.id}}\x20by\x20{{agent.name}}','exports','address','STRING','email','Agent','#011F6A','#ffffff','INTEGER','BOOLEAN','ENUM','squared','rounded','We\x20are\x20here!','Chat','Send','Powered\x20by\x20xCALLY','Do\x20you\x20want\x20to\x20close\x20the\x20interaction?','Form\x20properly\x20submitted','Form\x20submission\x20error','Type\x20a\x20message','Feedback','star','TEXT','stringify','input','name','getDataValue','onlineForm','textarea','Comments','Leave\x20your\x20comments','offlineForm','All\x20of\x20our\x20agents\x20are\x20busy\x20at\x20this\x20time.\x20Your\x20chat\x20is\x20very\x20important\x20to\x20us.','Please\x20hold\x20and\x20we\x20will\x20answer\x20your\x20request\x20as\x20soon\x20as\x20possible.','New\x20offline\x20message\x20from\x20websiteName','You\x20received\x20a\x20new\x20offline\x20message\x20from\x20websiteName.\x20Here\x20you\x20can\x20find\x20the\x20details\x20of\x20the\x20request:','Your\x20request\x20has\x20not\x20been\x20processed.','Skip','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','bottom_right','CHAT','alternate','#fafafa','System','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','Generated\x20by\x20XCALLY\x20Motion'];(function(_0x3f25db,_0x1d3686){var _0x54f29d=function(_0x2963bb){while(--_0x2963bb){_0x3f25db['push'](_0x3f25db['shift']());}};_0x54f29d(++_0x1d3686);}(_0xa74f,0x9a));var _0xfa74=function(_0x207811,_0x3420a6){_0x207811=_0x207811-0x0;var _0x170d56=_0xa74f[_0x207811];return _0x170d56;};'use strict';var Sequelize=require('sequelize');var rs=require('randomstring');module[_0xfa74('0x0')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'address':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0xfa74('0x1')},'description':{'type':Sequelize[_0xfa74('0x2')]},'mapKey':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x3')},'mapKeyOffline':{'type':Sequelize['STRING'],'defaultValue':_0xfa74('0x3')},'key':{'type':Sequelize['STRING'],'allowNull':![]},'agentAlias':{'type':Sequelize['STRING'],'defaultValue':_0xfa74('0x4')},'customerAlias':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':'Me'},'color':{'type':Sequelize[_0xfa74('0x2')],'allowNull':![],'defaultValue':_0xfa74('0x5'),'validate':{'notEmpty':!![]}},'color_button':{'type':Sequelize[_0xfa74('0x2')],'allowNull':![],'defaultValue':_0xfa74('0x5'),'validate':{'notEmpty':!![]}},'textColor':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xfa74('0x6'),'validate':{'notEmpty':!![]}},'textButtonColor':{'type':Sequelize[_0xfa74('0x2')],'allowNull':![],'defaultValue':_0xfa74('0x6'),'validate':{'notEmpty':!![]}},'fontSize':{'type':Sequelize[_0xfa74('0x7')],'defaultValue':0xf},'remote':{'type':Sequelize['STRING']},'animation':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':!![]},'header_shape':{'type':Sequelize[_0xfa74('0x9')]('rounded',_0xfa74('0xa')),'defaultValue':_0xfa74('0xb')},'header_online':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0xc')},'start_chat_button':{'type':Sequelize['STRING'],'defaultValue':_0xfa74('0xd')},'offline_chat_button':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0xe')},'header_offline':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':'Contact\x20us'},'download_transcript':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':!![]},'timeout':{'type':Sequelize[_0xfa74('0x7')],'defaultValue':0x0},'whiteLabel':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0xf')},'defaultWhiteLabel':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':!![]},'sitepic':{'type':Sequelize['TEXT']},'closingQuestion':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x10')},'formSubmitSuccessMessage':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x11')},'formSubmitFailureMessage':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x12')},'noteTitle':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':'Note'},'placeholderMessage':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x13')},'closingMessage':{'type':Sequelize['STRING'],'defaultValue':'Thanks\x20you\x20for\x20your\x20time!'},'closingMessageButton':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0xe')},'skipMessageButton':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':'Skip'},'conditionAgreement':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'enableRating':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'enableFeedback':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'enableSendButton':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'feedbackTitle':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x14')},'ratingType':{'type':Sequelize[_0xfa74('0x9')]('star','thumb'),'defaultValue':_0xfa74('0x15')},'ratingStarsNumber':{'type':Sequelize[_0xfa74('0x7')],'defaultValue':0x5},'onlineForm':{'type':Sequelize[_0xfa74('0x16')],'defaultValue':function(){return JSON[_0xfa74('0x17')]({'items':[{'type':_0xfa74('0x18'),'variable':null,'config':{'placeholder':'name','type':'text','required':!![]},'props':{'title':_0xfa74('0x19'),'helpText':''}},{'type':'input','props':{'title':'email','helpText':''},'config':{'required':!![],'placeholder':'email','type':_0xfa74('0x3')},'variable':null}],'fromKey':0x1});},'get':function(){return this[_0xfa74('0x1a')](_0xfa74('0x1b'))?JSON['parse'](this['getDataValue'](_0xfa74('0x1b'))):{};},'set':function(_0xeb6c11){return this['setDataValue'](_0xfa74('0x1b'),JSON['stringify'](_0xeb6c11));}},'offlineForm':{'type':Sequelize[_0xfa74('0x16')],'defaultValue':function(){return JSON[_0xfa74('0x17')]({'items':[{'type':'input','props':{'title':_0xfa74('0x3'),'helpText':''},'config':{'required':!![],'placeholder':_0xfa74('0x3'),'type':_0xfa74('0x3')},'variable':null},{'type':_0xfa74('0x1c'),'config':{'placeholder':'Comments'},'props':{'title':_0xfa74('0x1d'),'helpText':_0xfa74('0x1e')}}],'fromKey':0x0});},'get':function(){return this[_0xfa74('0x1a')]('offlineForm')?JSON['parse'](this[_0xfa74('0x1a')](_0xfa74('0x1f'))):{};},'set':function(_0x5df5cd){return this['setDataValue'](_0xfa74('0x1f'),JSON['stringify'](_0x5df5cd));}},'token':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':function(){return rs['generate']();}},'autoclose':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':!![]},'enableCustomerWriting':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'forwardTranscript':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'forwardTranscriptMessage':{'type':Sequelize[_0xfa74('0x2')]},'forwardOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'forwardOfflineAddress':{'type':Sequelize[_0xfa74('0x2')]},'waitingTitle':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x20')},'waitingMessage':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x21')},'offlineMessageSubject':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x22')},'offlineMessageBody':{'type':Sequelize['STRING'],'defaultValue':_0xfa74('0x23')},'enableUnmanagedNote':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'unmanagedMessage':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x24')},'skipUnmanaged':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x25')},'sendUnmanaged':{'type':Sequelize['STRING'],'defaultValue':'Send'},'enableCustomerAttachment':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'enableCustomerCheckmarks':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'agentAvatar':{'type':Sequelize[_0xfa74('0x16')]},'showAgentAvatar':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'timezone':{'type':Sequelize['STRING']},'notificationTemplate':{'type':Sequelize[_0xfa74('0x16')],'defaultValue':function(){return _0xfa74('0x26');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'hideWhenOffline':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentIdentifier':{'type':Sequelize['STRING'],'defaultValue':'website_alias'},'waitForTheAssignedAgent':{'type':Sequelize[_0xfa74('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'alignment':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x27')},'verticalAlignment':{'type':Sequelize[_0xfa74('0x7')],'defaultValue':0x1e},'labelText':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x28')},'messagesAlignment':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x29')},'defaultTitle':{'type':Sequelize[_0xfa74('0x2')]},'customerAvatar':{'type':Sequelize['TEXT']},'showCustomerAvatar':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'messageFontSize':{'type':Sequelize[_0xfa74('0x7')],'defaultValue':0xc},'backgroundColor':{'type':Sequelize[_0xfa74('0x2')],'allowNull':![],'defaultValue':_0xfa74('0x2a'),'validate':{'notEmpty':!![]}},'queueTransfer':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xfa74('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfa74('0x7')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'systemAlias':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':_0xfa74('0x2b')},'systemAvatar':{'type':Sequelize[_0xfa74('0x16')]},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0xfa74('0x2c')},'mandatoryDisposition':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![],'comment':_0xfa74('0x2d'),'set':function(_0x35f252){if(!_0x35f252)this['setDataValue'](_0xfa74('0x2e'),null);this[_0xfa74('0x2f')](_0xfa74('0x30'),_0x35f252);}},'vidaooEscalation':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'vidaooApiKey':{'type':Sequelize['STRING']},'vidaooTopic':{'type':Sequelize[_0xfa74('0x2')],'allowNull':![],'defaultValue':_0xfa74('0x31')},'vidaooNote':{'type':Sequelize[_0xfa74('0x2')],'defaultValue':function(){return _0xfa74('0x32');}},'vidaooMetadata':{'type':Sequelize['TEXT'],'defaultValue':null},'openNewInteraction':{'type':Sequelize[_0xfa74('0x8')],'defaultValue':![],'allowNull':!![]},'subjectOffline':{'type':Sequelize[_0xfa74('0x16')]}}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.controller.js b/server/api/chatWebsite/chatWebsite.controller.js index ce04604..e0ba382 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 _0x1c60=['x-real-ip','connection','remoteAddress','replace','alignment','verticalAlignment','labelText','textColor','color_button','backgroundColor','hideWhenOffline','IntervalId','addApplications','transaction','Transaction','READ_COMMITTED','findAndCountAll','finally','getApplications','addProactiveActions','chatProactiveAction','getProactiveActions','ChatProactiveAction','getFields','online','onlineForm','items','fromKey','getOfflineMessages','Attachments','addAgents','removeAgents','userChatWebsite:remove','emit','getAgents','bluebird','mustache','util','fs-extra','lodash','querystring','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./chatWebsite.socket','html-to-text','http','client','request','then','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','ChatWebsite,\x20%s,\x20%s,\x20%s','error','code','message','catch','status','end','json','offset','undefined','limit','count','Content-Range','update','get','UserProfileResource','destroy','sendStatus','stack','name','send','index','ChatWebsite','rawAttributes','fieldName','key','model','map','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','where','merge','type','VIRTUAL','options','rows','params','Pause','mandatoryDispositionPause','keys','intersection','includeAll','include','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ChatWebsites','userProfileId','describe','addDisposition','Disposition','filter','findAll','ids','addAnswer','ChatWebsiteId','getAnswers','findOne','CannedAnswer','pick','removeAnswers','addLogo','sitepic','file','filename','addAvatar','agentAvatar','addCustomerAvatar','customerAvatar','systemAvatar','getLogo','join','root','../../config/license/util','getLicense','custom','isNil','server/files/images/logos/','download','getAvatar','existsSync','server/files/images/avatars/','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','getSystemAvatar','server/files/images/avatars/system_avatar.png','user-agent-parser','setUA','headers','user-agent','getResult','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','CmList','DESC','ChatApplication','Applications','List','account','applications','list','orderBy','priority','asc','contact','customerIp','cf-connecting-ip','first','x-forwarded-for','split','firstName','lastName','x-real-port','referer','browser','version','format','%s\x20%s','device','vendor','%s\x20%s\x20%s','stringify','threadId','ChatInteraction','externalUrl','ContactId','interaction','spread','messageId','created','autoclose','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','User','UserId','unshift','Start','startRouting','EventManager','notify','offline','files','from\x20is\x20mandatory','mapKeyOffline','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','ListId','findOrCreate','readFileSync','server/files/templates/chatOfflineMessage.ejs','render','offlineMessageBody','ChatOfflineMessage','fromString','originalname','mimetype','server','attachments','offline-chat','basename','openNewInteraction','sequelize','Attachment','bulkCreate','MailServerOut','Smtp','CloudProvider','forwardOfflineAddress','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','toPairsIn','email','MailAccountId','NotifyMailAccount','notifyMail','remove','addInteraction','omit','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','Command','getSnippet','interval','iftime\x20%s','indexOf','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','timezone','No\x20timezone','inspect','Interval','Intervals','virtual','License','increment','chatLicenseExceeded','all','server/files/chat/iframe.ejs','origin'];(function(_0x153810,_0x4b3117){var _0x3df31a=function(_0x239357){while(--_0x239357){_0x153810['push'](_0x153810['shift']());}};_0x3df31a(++_0x4b3117);}(_0x1c60,0x145));var _0x01c6=function(_0x3a166a,_0x2018be){_0x3a166a=_0x3a166a-0x0;var _0x1b0279=_0x1c60[_0x3a166a];return _0x1b0279;};'use strict';var BPromise=require(_0x01c6('0x0'));var Mustache=require(_0x01c6('0x1'));var util=require(_0x01c6('0x2'));var path=require('path');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x01c6('0x3'));var _=require(_0x01c6('0x4'));var querystring=require(_0x01c6('0x5'));var Redis=require(_0x01c6('0x6'));var qs=require('../../components/parsers/qs');var logger=require(_0x01c6('0x7'))(_0x01c6('0x8'));var config=require(_0x01c6('0x9'));var url=require('url');var db=require(_0x01c6('0xa'))['db'];config[_0x01c6('0xb')]=_[_0x01c6('0xc')](config[_0x01c6('0xb')],{'host':_0x01c6('0xd'),'port':0x18eb});var socket=require(_0x01c6('0xe'))(new Redis(config[_0x01c6('0xb')]));require(_0x01c6('0xf'))['register'](socket);var htmlToText=require(_0x01c6('0x10'));var jayson=require('jayson/promise');var client=jayson['client'][_0x01c6('0x11')]({'port':0x232c});var client9002=jayson[_0x01c6('0x12')][_0x01c6('0x11')]({'port':0x232a});var client9003=jayson[_0x01c6('0x12')]['http']({'port':0x232b});var client9001=jayson[_0x01c6('0x12')][_0x01c6('0x11')]({'port':0x2329});function respondWithRpcPromise(_0x1826c4,_0xf701b5,_0x51ae53,_0x29016f){return new BPromise(function(_0x307d30,_0x504f96){var _0x555fb6=_0x29016f||client;return _0x555fb6[_0x01c6('0x13')](_0x1826c4,_0x51ae53)[_0x01c6('0x14')](function(_0x460d78){logger[_0x01c6('0x15')](_0x01c6('0x16'),_0xf701b5,_0x01c6('0x17'));logger['debug'](_0x01c6('0x18'),_0xf701b5,_0x01c6('0x17'),JSON['stringify'](_0x460d78));if(_0x460d78[_0x01c6('0x19')]){if(_0x460d78[_0x01c6('0x19')][_0x01c6('0x1a')]===0x1f4){logger[_0x01c6('0x19')]('ChatWebsite,\x20%s,\x20%s',_0xf701b5,_0x460d78[_0x01c6('0x19')][_0x01c6('0x1b')]);return _0x504f96(_0x460d78[_0x01c6('0x19')][_0x01c6('0x1b')]);}logger[_0x01c6('0x19')](_0x01c6('0x16'),_0xf701b5,_0x460d78[_0x01c6('0x19')][_0x01c6('0x1b')]);return _0x307d30(_0x460d78[_0x01c6('0x19')]['message']);}else{logger[_0x01c6('0x15')](_0x01c6('0x16'),_0xf701b5,'request\x20sent');_0x307d30(_0x460d78['result'][_0x01c6('0x1b')]);}})[_0x01c6('0x1c')](function(_0x55e8e0){logger[_0x01c6('0x19')](_0x01c6('0x16'),_0xf701b5,_0x55e8e0);_0x504f96(_0x55e8e0);});});}function respondWithStatusCode(_0x3a2ea8,_0x286511){_0x286511=_0x286511||0xcc;return function(_0x5f9bd){if(_0x5f9bd){return _0x3a2ea8['sendStatus'](_0x286511);}return _0x3a2ea8[_0x01c6('0x1d')](_0x286511)[_0x01c6('0x1e')]();};}function respondWithResult(_0xce16d2,_0x7d5f0f){_0x7d5f0f=_0x7d5f0f||0xc8;return function(_0x5037c0){if(_0x5037c0){return _0xce16d2[_0x01c6('0x1d')](_0x7d5f0f)[_0x01c6('0x1f')](_0x5037c0);}};}function respondWithFilteredResult(_0x126eeb,_0x3d2ff0){return function(_0x57c376){if(_0x57c376){var _0xff3973=typeof _0x3d2ff0[_0x01c6('0x20')]===_0x01c6('0x21')&&typeof _0x3d2ff0[_0x01c6('0x22')]===_0x01c6('0x21');var _0x5d3076=_0x57c376[_0x01c6('0x23')];var _0x7dbc18=_0xff3973?0x0:_0x3d2ff0[_0x01c6('0x20')];var _0x566ffc=_0xff3973?_0x57c376[_0x01c6('0x23')]:_0x3d2ff0[_0x01c6('0x20')]+_0x3d2ff0[_0x01c6('0x22')];var _0x5337f8;if(_0x566ffc>=_0x5d3076){_0x566ffc=_0x5d3076;_0x5337f8=0xc8;}else{_0x5337f8=0xce;}_0x126eeb[_0x01c6('0x1d')](_0x5337f8);return _0x126eeb['set'](_0x01c6('0x24'),_0x7dbc18+'-'+_0x566ffc+'/'+_0x5d3076)[_0x01c6('0x1f')](_0x57c376);}return null;};}function saveUpdates(_0x5c11d1){return function(_0x3a8a21){if(_0x3a8a21){return _0x3a8a21[_0x01c6('0x25')](_0x5c11d1)[_0x01c6('0x14')](function(_0x41fdc1){return _0x41fdc1;});}return null;};}function removeEntity(_0x3ece58){return function(_0xa5ae44){if(_0xa5ae44){return _0xa5ae44['destroy']()[_0x01c6('0x14')](function(){var _0x59f600=_0xa5ae44[_0x01c6('0x26')]({'plain':!![]});var _0x5c81d1='ChatWebsites';return db[_0x01c6('0x27')][_0x01c6('0x28')]({'where':{'type':_0x5c81d1,'resourceId':_0x59f600['id']}})[_0x01c6('0x14')](function(){return _0xa5ae44;});})[_0x01c6('0x14')](function(){_0x3ece58['status'](0xcc)[_0x01c6('0x1e')]();});}};}function handleEntityNotFound(_0x114da6){return function(_0x13ccff){if(!_0x13ccff){_0x114da6[_0x01c6('0x29')](0x194);}return _0x13ccff;};}function handleError(_0x20584e,_0x817ce3){_0x817ce3=_0x817ce3||0x1f4;return function(_0x34a011){logger[_0x01c6('0x19')](_0x34a011[_0x01c6('0x2a')]);if(_0x34a011[_0x01c6('0x2b')]){delete _0x34a011[_0x01c6('0x2b')];}_0x20584e[_0x01c6('0x1d')](_0x817ce3)[_0x01c6('0x2c')](_0x34a011);};}exports[_0x01c6('0x2d')]=function(_0xeb05c,_0x480985){var _0x3de85c={'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x42e851={},_0x200b31={'count':0x0,'rows':[]};var _0x207bc6=_['map'](db[_0x01c6('0x2e')][_0x01c6('0x2f')],function(_0x5c57b9){return{'name':_0x5c57b9[_0x01c6('0x30')],'type':_0x5c57b9['type'][_0x01c6('0x31')]};});_0x42e851[_0x01c6('0x32')]=_[_0x01c6('0x33')](_0x207bc6,_0x01c6('0x2b'));_0x42e851[_0x01c6('0x34')]=_['keys'](_0xeb05c[_0x01c6('0x34')]);_0x42e851['filters']=_['intersection'](_0x42e851['model'],_0x42e851[_0x01c6('0x34')]);_0x3de85c[_0x01c6('0x35')]=_['intersection'](_0x42e851[_0x01c6('0x32')],qs[_0x01c6('0x36')](_0xeb05c[_0x01c6('0x34')][_0x01c6('0x36')]));_0x3de85c[_0x01c6('0x35')]=_0x3de85c[_0x01c6('0x35')][_0x01c6('0x37')]?_0x3de85c['attributes']:_0x42e851['model'];if(!_0xeb05c[_0x01c6('0x34')][_0x01c6('0x38')](_0x01c6('0x39'))){_0x3de85c[_0x01c6('0x22')]=qs[_0x01c6('0x22')](_0xeb05c['query'][_0x01c6('0x22')]);_0x3de85c['offset']=qs['offset'](_0xeb05c['query'][_0x01c6('0x20')]);}_0x3de85c[_0x01c6('0x3a')]=qs['sort'](_0xeb05c[_0x01c6('0x34')][_0x01c6('0x3b')]);_0x3de85c['where']=qs[_0x01c6('0x3c')](_['pick'](_0xeb05c['query'],_0x42e851[_0x01c6('0x3c')]),_0x207bc6);if(_0xeb05c[_0x01c6('0x34')]['filter']){_0x3de85c[_0x01c6('0x3d')]=_[_0x01c6('0x3e')](_0x3de85c[_0x01c6('0x3d')],{'$or':_[_0x01c6('0x33')](_0x207bc6,function(_0x15ddb3){if(_0x15ddb3[_0x01c6('0x3f')]!==_0x01c6('0x40')){var _0x5ad96={};_0x5ad96[_0x15ddb3[_0x01c6('0x2b')]]={'$like':'%'+_0xeb05c[_0x01c6('0x34')]['filter']+'%'};return _0x5ad96;}})});}_0x3de85c=_[_0x01c6('0x3e')]({},_0x3de85c,_0xeb05c[_0x01c6('0x41')]);var _0x8b8e63={'where':_0x3de85c[_0x01c6('0x3d')]};return db['ChatWebsite']['count'](_0x8b8e63)[_0x01c6('0x14')](function(_0x31687c){_0x200b31[_0x01c6('0x23')]=_0x31687c;if(_0xeb05c['query']['includeAll']){_0x3de85c['include']=[{'all':!![]}];}return db['ChatWebsite']['findAll'](_0x3de85c);})[_0x01c6('0x14')](function(_0x12296c){_0x200b31[_0x01c6('0x42')]=_0x12296c;return _0x200b31;})[_0x01c6('0x14')](respondWithFilteredResult(_0x480985,_0x3de85c))['catch'](handleError(_0x480985,null));};exports['show']=function(_0x2a1631,_0xb3a8dd){var _0x34a96c={'raw':![],'where':{'id':_0x2a1631[_0x01c6('0x43')]['id']},'include':[{'model':db[_0x01c6('0x44')],'as':_0x01c6('0x45')}]},_0x39741a={};_0x39741a['model']=_[_0x01c6('0x46')](db[_0x01c6('0x2e')][_0x01c6('0x2f')]);_0x39741a[_0x01c6('0x34')]=_['keys'](_0x2a1631[_0x01c6('0x34')]);_0x39741a[_0x01c6('0x3c')]=_['intersection'](_0x39741a[_0x01c6('0x32')],_0x39741a['query']);_0x34a96c[_0x01c6('0x35')]=_[_0x01c6('0x47')](_0x39741a[_0x01c6('0x32')],qs[_0x01c6('0x36')](_0x2a1631[_0x01c6('0x34')][_0x01c6('0x36')]));_0x34a96c[_0x01c6('0x35')]=_0x34a96c[_0x01c6('0x35')]['length']?_0x34a96c[_0x01c6('0x35')]:_0x39741a['model'];if(_0x2a1631[_0x01c6('0x34')][_0x01c6('0x48')]){_0x34a96c[_0x01c6('0x49')]=[{'all':!![]}];}_0x34a96c=_[_0x01c6('0x3e')]({},_0x34a96c,_0x2a1631[_0x01c6('0x41')]);return db[_0x01c6('0x2e')][_0x01c6('0x4a')](_0x34a96c)[_0x01c6('0x14')](handleEntityNotFound(_0xb3a8dd,null))[_0x01c6('0x14')](respondWithResult(_0xb3a8dd,null))[_0x01c6('0x1c')](handleError(_0xb3a8dd,null));};exports[_0x01c6('0x4b')]=function(_0x9ffa2e,_0x1be4b3){return db[_0x01c6('0x2e')][_0x01c6('0x4b')](_0x9ffa2e[_0x01c6('0x4c')],{})['then'](function(_0x33c137){var _0x14b3eb=_0x9ffa2e[_0x01c6('0x4d')][_0x01c6('0x26')]({'plain':!![]});if(!_0x14b3eb)throw new Error(_0x01c6('0x4e'));if(_0x14b3eb[_0x01c6('0x4f')]===_0x01c6('0x4d')){var _0x5528f2=_0x33c137[_0x01c6('0x26')]({'plain':!![]});var _0xded1e7=_0x01c6('0x50');return db['UserProfileSection'][_0x01c6('0x4a')]({'where':{'name':_0xded1e7,'userProfileId':_0x14b3eb[_0x01c6('0x51')]},'raw':!![]})['then'](function(_0x352d3f){if(_0x352d3f&&_0x352d3f['autoAssociation']===0x0){return db[_0x01c6('0x27')][_0x01c6('0x4b')]({'name':_0x5528f2[_0x01c6('0x2b')],'resourceId':_0x5528f2['id'],'type':_0x352d3f[_0x01c6('0x2b')],'sectionId':_0x352d3f['id']},{})[_0x01c6('0x14')](function(){return _0x33c137;});}else{return _0x33c137;}})['catch'](function(_0x2f35e1){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2f35e1);throw _0x2f35e1;});}return _0x33c137;})[_0x01c6('0x14')](respondWithResult(_0x1be4b3,0xc9))[_0x01c6('0x1c')](handleError(_0x1be4b3,null));};exports['update']=function(_0x4b5d62,_0x1469b2){if(_0x4b5d62['body']['id']){delete _0x4b5d62[_0x01c6('0x4c')]['id'];}return db[_0x01c6('0x2e')][_0x01c6('0x4a')]({'where':{'id':_0x4b5d62[_0x01c6('0x43')]['id']},'include':[{'model':db[_0x01c6('0x44')],'as':_0x01c6('0x45')}]})[_0x01c6('0x14')](handleEntityNotFound(_0x1469b2,null))[_0x01c6('0x14')](saveUpdates(_0x4b5d62['body'],null))['then'](respondWithResult(_0x1469b2,null))['catch'](handleError(_0x1469b2,null));};exports[_0x01c6('0x28')]=function(_0x470ad9,_0xf3f2d1){return db[_0x01c6('0x2e')]['find']({'where':{'id':_0x470ad9[_0x01c6('0x43')]['id']}})[_0x01c6('0x14')](handleEntityNotFound(_0xf3f2d1,null))[_0x01c6('0x14')](removeEntity(_0xf3f2d1,null))['catch'](handleError(_0xf3f2d1,null));};exports[_0x01c6('0x52')]=function(_0x34d6dc,_0x472583){return db[_0x01c6('0x2e')][_0x01c6('0x52')]()[_0x01c6('0x14')](respondWithResult(_0x472583,null))['catch'](handleError(_0x472583,null));};exports[_0x01c6('0x53')]=function(_0x37beb2,_0xefb6ac){if(_0x37beb2[_0x01c6('0x4c')]['id']){delete _0x37beb2['body']['id'];}return db[_0x01c6('0x2e')][_0x01c6('0x4a')]({'where':{'id':_0x37beb2[_0x01c6('0x43')]['id']}})[_0x01c6('0x14')](handleEntityNotFound(_0xefb6ac,null))['then'](function(_0x5213a9){if(_0x5213a9){_0x37beb2[_0x01c6('0x4c')]['ChatWebsiteId']=_0x5213a9['id'];return db[_0x01c6('0x54')]['create'](_0x37beb2['body']);}})[_0x01c6('0x14')](respondWithResult(_0xefb6ac,null))[_0x01c6('0x1c')](handleError(_0xefb6ac,null));};exports['getDispositions']=function(_0xd8424d,_0x49f10d){var _0x219f03={'raw':![],'where':{}};var _0x248185={};var _0x4a8b43={'count':0x0,'rows':[]};return db['ChatWebsite']['findOne']({'where':{'id':_0xd8424d['params']['id']}})['then'](handleEntityNotFound(_0x49f10d,null))[_0x01c6('0x14')](function(_0x5a0ac8){if(_0x5a0ac8){_0x248185[_0x01c6('0x32')]=_[_0x01c6('0x46')](db[_0x01c6('0x54')][_0x01c6('0x2f')]);_0x248185[_0x01c6('0x34')]=_[_0x01c6('0x46')](_0xd8424d[_0x01c6('0x34')]);_0x248185['filters']=_['intersection'](_0x248185[_0x01c6('0x32')],_0x248185[_0x01c6('0x34')]);_0x219f03['attributes']=_['intersection'](_0x248185[_0x01c6('0x32')],qs[_0x01c6('0x36')](_0xd8424d[_0x01c6('0x34')]['fields']));_0x219f03[_0x01c6('0x35')]=_0x219f03[_0x01c6('0x35')]['length']?_0x219f03['attributes']:_0x248185['model'];if(!_0xd8424d[_0x01c6('0x34')]['hasOwnProperty']('nolimit')){_0x219f03[_0x01c6('0x22')]=qs[_0x01c6('0x22')](_0xd8424d[_0x01c6('0x34')][_0x01c6('0x22')]);_0x219f03[_0x01c6('0x20')]=qs[_0x01c6('0x20')](_0xd8424d[_0x01c6('0x34')][_0x01c6('0x20')]);}_0x219f03['order']=qs[_0x01c6('0x3b')](_0xd8424d[_0x01c6('0x34')][_0x01c6('0x3b')]);_0x219f03['where']=qs['filters'](_['pick'](_0xd8424d[_0x01c6('0x34')],_0x248185[_0x01c6('0x3c')]));_0x219f03[_0x01c6('0x3d')]['ChatWebsiteId']=_0x5a0ac8['id'];if(_0xd8424d[_0x01c6('0x34')][_0x01c6('0x55')]){_0x219f03[_0x01c6('0x3d')]=_[_0x01c6('0x3e')](_0x219f03[_0x01c6('0x3d')],{'$or':_['map'](_0x219f03['attributes'],function(_0x5479d7){var _0x3c0954={};_0x3c0954[_0x5479d7]={'$like':'%'+_0xd8424d[_0x01c6('0x34')]['filter']+'%'};return _0x3c0954;})});}_0x219f03=_['merge']({},_0x219f03,_0xd8424d[_0x01c6('0x41')]);return db[_0x01c6('0x54')][_0x01c6('0x23')]({'where':_0x219f03['where']})['then'](function(_0x2f685d){_0x4a8b43[_0x01c6('0x23')]=_0x2f685d;if(_0xd8424d[_0x01c6('0x34')][_0x01c6('0x48')]){_0x219f03[_0x01c6('0x49')]=[{'all':!![]}];}return db[_0x01c6('0x54')][_0x01c6('0x56')](_0x219f03);})[_0x01c6('0x14')](function(_0x2961e3){_0x4a8b43[_0x01c6('0x42')]=_0x2961e3;return _0x4a8b43;});}})[_0x01c6('0x14')](respondWithFilteredResult(_0x49f10d,_0x219f03))[_0x01c6('0x1c')](handleError(_0x49f10d,null));};exports['removeDispositions']=function(_0x5c7e32,_0x339eda){return db['ChatWebsite']['find']({'where':{'id':_0x5c7e32[_0x01c6('0x43')]['id']}})[_0x01c6('0x14')](handleEntityNotFound(_0x339eda,null))[_0x01c6('0x14')](function(_0x38ba10){if(_0x38ba10){return _0x38ba10['removeDispositions'](_0x5c7e32[_0x01c6('0x34')][_0x01c6('0x57')]);}})['then'](respondWithStatusCode(_0x339eda,null))[_0x01c6('0x1c')](handleError(_0x339eda,null));};exports[_0x01c6('0x58')]=function(_0x2b208d,_0x1d1901){if(_0x2b208d[_0x01c6('0x4c')]['id']){delete _0x2b208d[_0x01c6('0x4c')]['id'];}return db[_0x01c6('0x2e')]['find']({'where':{'id':_0x2b208d['params']['id']}})[_0x01c6('0x14')](handleEntityNotFound(_0x1d1901,null))[_0x01c6('0x14')](function(_0x56e885){if(_0x56e885){_0x2b208d[_0x01c6('0x4c')][_0x01c6('0x59')]=_0x56e885['id'];return db['CannedAnswer'][_0x01c6('0x4b')](_0x2b208d[_0x01c6('0x4c')]);}})[_0x01c6('0x14')](respondWithResult(_0x1d1901,null))['catch'](handleError(_0x1d1901,null));};exports[_0x01c6('0x5a')]=function(_0x114033,_0x468201){var _0x33b123={'raw':![],'where':{}};var _0x2b64b5={};var _0x42613c={'count':0x0,'rows':[]};return db[_0x01c6('0x2e')][_0x01c6('0x5b')]({'where':{'id':_0x114033[_0x01c6('0x43')]['id']}})[_0x01c6('0x14')](handleEntityNotFound(_0x468201,null))['then'](function(_0x40a29e){if(_0x40a29e){_0x2b64b5[_0x01c6('0x32')]=_['keys'](db[_0x01c6('0x5c')]['rawAttributes']);_0x2b64b5[_0x01c6('0x34')]=_['keys'](_0x114033[_0x01c6('0x34')]);_0x2b64b5[_0x01c6('0x3c')]=_['intersection'](_0x2b64b5[_0x01c6('0x32')],_0x2b64b5[_0x01c6('0x34')]);_0x33b123['attributes']=_['intersection'](_0x2b64b5[_0x01c6('0x32')],qs[_0x01c6('0x36')](_0x114033[_0x01c6('0x34')][_0x01c6('0x36')]));_0x33b123[_0x01c6('0x35')]=_0x33b123[_0x01c6('0x35')][_0x01c6('0x37')]?_0x33b123[_0x01c6('0x35')]:_0x2b64b5['model'];if(!_0x114033[_0x01c6('0x34')][_0x01c6('0x38')](_0x01c6('0x39'))){_0x33b123['limit']=qs[_0x01c6('0x22')](_0x114033[_0x01c6('0x34')][_0x01c6('0x22')]);_0x33b123[_0x01c6('0x20')]=qs[_0x01c6('0x20')](_0x114033[_0x01c6('0x34')][_0x01c6('0x20')]);}_0x33b123[_0x01c6('0x3a')]=qs[_0x01c6('0x3b')](_0x114033[_0x01c6('0x34')][_0x01c6('0x3b')]);_0x33b123[_0x01c6('0x3d')]=qs[_0x01c6('0x3c')](_[_0x01c6('0x5d')](_0x114033['query'],_0x2b64b5['filters']));_0x33b123[_0x01c6('0x3d')][_0x01c6('0x59')]=_0x40a29e['id'];if(_0x114033[_0x01c6('0x34')][_0x01c6('0x55')]){_0x33b123[_0x01c6('0x3d')]=_['merge'](_0x33b123[_0x01c6('0x3d')],{'$or':_[_0x01c6('0x33')](_0x33b123['attributes'],function(_0x4f10b9){var _0x239025={};_0x239025[_0x4f10b9]={'$like':'%'+_0x114033[_0x01c6('0x34')][_0x01c6('0x55')]+'%'};return _0x239025;})});}_0x33b123=_[_0x01c6('0x3e')]({},_0x33b123,_0x114033[_0x01c6('0x41')]);return db['CannedAnswer']['count']({'where':_0x33b123[_0x01c6('0x3d')]})[_0x01c6('0x14')](function(_0xee8c6c){_0x42613c[_0x01c6('0x23')]=_0xee8c6c;if(_0x114033[_0x01c6('0x34')][_0x01c6('0x48')]){_0x33b123[_0x01c6('0x49')]=[{'all':!![]}];}return db[_0x01c6('0x5c')]['findAll'](_0x33b123);})['then'](function(_0x292847){_0x42613c[_0x01c6('0x42')]=_0x292847;return _0x42613c;});}})[_0x01c6('0x14')](respondWithFilteredResult(_0x468201,_0x33b123))['catch'](handleError(_0x468201,null));};exports[_0x01c6('0x5e')]=function(_0x206790,_0x1d01f8){return db[_0x01c6('0x2e')]['find']({'where':{'id':_0x206790[_0x01c6('0x43')]['id']}})['then'](handleEntityNotFound(_0x1d01f8,null))['then'](function(_0x10be76){if(_0x10be76){return _0x10be76[_0x01c6('0x5e')](_0x206790['query']['ids']);}})[_0x01c6('0x14')](respondWithStatusCode(_0x1d01f8,null))[_0x01c6('0x1c')](handleError(_0x1d01f8,null));};exports[_0x01c6('0x5f')]=function(_0x50e180,_0x2c029a){_0x50e180[_0x01c6('0x4c')][_0x01c6('0x60')]=_0x50e180[_0x01c6('0x61')][_0x01c6('0x62')];return db[_0x01c6('0x2e')][_0x01c6('0x4a')]({'where':{'id':_0x50e180[_0x01c6('0x43')]['id']}})[_0x01c6('0x14')](handleEntityNotFound(_0x2c029a,null))[_0x01c6('0x14')](saveUpdates(_0x50e180['body'],null))[_0x01c6('0x14')](respondWithResult(_0x2c029a,null))[_0x01c6('0x1c')](handleError(_0x2c029a,null));};exports[_0x01c6('0x63')]=function(_0x52e1f2,_0x5d994e){_0x52e1f2[_0x01c6('0x4c')][_0x01c6('0x64')]=_0x52e1f2[_0x01c6('0x61')][_0x01c6('0x62')];return db['ChatWebsite'][_0x01c6('0x4a')]({'where':{'id':_0x52e1f2[_0x01c6('0x43')]['id']}})['then'](handleEntityNotFound(_0x5d994e,null))[_0x01c6('0x14')](saveUpdates(_0x52e1f2[_0x01c6('0x4c')],null))[_0x01c6('0x14')](respondWithResult(_0x5d994e,null))[_0x01c6('0x1c')](handleError(_0x5d994e,null));};exports[_0x01c6('0x65')]=function(_0x2d0fb2,_0x186413){_0x2d0fb2['body'][_0x01c6('0x66')]=_0x2d0fb2[_0x01c6('0x61')][_0x01c6('0x62')];return db[_0x01c6('0x2e')][_0x01c6('0x4a')]({'where':{'id':_0x2d0fb2[_0x01c6('0x43')]['id']}})[_0x01c6('0x14')](handleEntityNotFound(_0x186413,null))[_0x01c6('0x14')](saveUpdates(_0x2d0fb2[_0x01c6('0x4c')],null))['then'](respondWithResult(_0x186413,null))['catch'](handleError(_0x186413,null));};exports['addSystemAvatar']=function(_0x1e83d1,_0x1d3688){_0x1e83d1[_0x01c6('0x4c')][_0x01c6('0x67')]=_0x1e83d1['file'][_0x01c6('0x62')];return db['ChatWebsite'][_0x01c6('0x4a')]({'where':{'id':_0x1e83d1['params']['id']}})[_0x01c6('0x14')](handleEntityNotFound(_0x1d3688,null))[_0x01c6('0x14')](saveUpdates(_0x1e83d1[_0x01c6('0x4c')],null))[_0x01c6('0x14')](respondWithResult(_0x1d3688,null))[_0x01c6('0x1c')](handleError(_0x1d3688,null));};exports[_0x01c6('0x68')]=function(_0x7c2b12,_0x462598){var _0x16a51a=path[_0x01c6('0x69')](config[_0x01c6('0x6a')],'server/files/images/logos/default_logo.svg');var _0x35169f={'where':{'id':_0x7c2b12[_0x01c6('0x43')]['id']},'attributes':['id',_0x01c6('0x60')],'raw':!![]};var _0x73671f=![];return require(_0x01c6('0x6b'))[_0x01c6('0x6c')]()[_0x01c6('0x14')](function(_0x1497cb){if(_0x1497cb){_0x73671f=_0x1497cb[_0x01c6('0x6d')];}})[_0x01c6('0x14')](function(){return db['ChatWebsite']['find'](_0x35169f);})['then'](handleEntityNotFound(_0x462598,null))[_0x01c6('0x14')](function(_0x41e991){if(_0x41e991){if(!_[_0x01c6('0x6e')](_0x41e991[_0x01c6('0x60')])){if(fs['existsSync'](path[_0x01c6('0x69')](config[_0x01c6('0x6a')],_0x01c6('0x6f'),_0x41e991[_0x01c6('0x60')]))&&_0x73671f){_0x16a51a=path[_0x01c6('0x69')](config[_0x01c6('0x6a')],_0x01c6('0x6f'),_0x41e991['sitepic']);}}return _0x462598[_0x01c6('0x70')](_0x16a51a);}})['catch'](handleError(_0x462598,null));};exports[_0x01c6('0x71')]=function(_0x2c3066,_0xff1a06){var _0x5d5e27=path['join'](config['root'],'server/files/images/avatars/default_avatar.png');var _0x8d1cc1={'where':{'id':_0x2c3066[_0x01c6('0x43')]['id']},'attributes':['id','agentAvatar'],'raw':!![]};return db[_0x01c6('0x2e')][_0x01c6('0x4a')](_0x8d1cc1)[_0x01c6('0x14')](handleEntityNotFound(_0xff1a06,null))['then'](function(_0x4d9cec){if(_0x4d9cec){if(!_[_0x01c6('0x6e')](_0x4d9cec['agentAvatar'])){if(fs[_0x01c6('0x72')](path[_0x01c6('0x69')](config[_0x01c6('0x6a')],_0x01c6('0x73'),_0x4d9cec[_0x01c6('0x64')]))){_0x5d5e27=path[_0x01c6('0x69')](config['root'],_0x01c6('0x73'),_0x4d9cec[_0x01c6('0x64')]);}}return _0xff1a06['download'](_0x5d5e27);}})['catch'](handleError(_0xff1a06,null));};exports[_0x01c6('0x74')]=function(_0x405d50,_0x40d276){var _0x1df500=path[_0x01c6('0x69')](config['root'],_0x01c6('0x75'));var _0x2ac796={'where':{'id':_0x405d50[_0x01c6('0x43')]['id']},'attributes':['id',_0x01c6('0x66'),_0x01c6('0x76')],'raw':!![]};return db[_0x01c6('0x2e')][_0x01c6('0x4a')](_0x2ac796)[_0x01c6('0x14')](handleEntityNotFound(_0x40d276,null))[_0x01c6('0x14')](function(_0x28319a){if(_0x28319a){if(!_[_0x01c6('0x6e')](_0x28319a['customerAvatar'])){if(fs[_0x01c6('0x72')](path['join'](config[_0x01c6('0x6a')],_0x01c6('0x73'),_0x28319a[_0x01c6('0x66')]))&&_0x28319a[_0x01c6('0x76')]){_0x1df500=path[_0x01c6('0x69')](config[_0x01c6('0x6a')],_0x01c6('0x73'),_0x28319a['customerAvatar']);}}return _0x40d276[_0x01c6('0x70')](_0x1df500);}})[_0x01c6('0x1c')](handleError(_0x40d276,null));};exports[_0x01c6('0x77')]=function(_0x4baeef,_0xdd22e2){var _0x604baf=path[_0x01c6('0x69')](config[_0x01c6('0x6a')],_0x01c6('0x78'));var _0x3497bc={'where':{'id':_0x4baeef[_0x01c6('0x43')]['id']},'attributes':['id',_0x01c6('0x67')],'raw':!![]};return db[_0x01c6('0x2e')][_0x01c6('0x4a')](_0x3497bc)[_0x01c6('0x14')](handleEntityNotFound(_0xdd22e2,null))[_0x01c6('0x14')](function(_0x360e91){if(_0x360e91){if(!_[_0x01c6('0x6e')](_0x360e91[_0x01c6('0x67')])){if(fs[_0x01c6('0x72')](path[_0x01c6('0x69')](config[_0x01c6('0x6a')],_0x01c6('0x73'),_0x360e91[_0x01c6('0x67')]))){_0x604baf=path['join'](config[_0x01c6('0x6a')],_0x01c6('0x73'),_0x360e91[_0x01c6('0x67')]);}}return _0xdd22e2[_0x01c6('0x70')](_0x604baf);}})[_0x01c6('0x1c')](handleError(_0xdd22e2,null));};exports['notify']=function(_0x3a08d,_0xcfbe0d){var _0x2a68e8=require(_0x01c6('0x79'));var _0x47e3c5=new _0x2a68e8();var _0x3511ce=_0x47e3c5[_0x01c6('0x7a')](_0x3a08d[_0x01c6('0x7b')][_0x01c6('0x7c')])[_0x01c6('0x7d')]();var _0x116632={'body':_0x3a08d[_0x01c6('0x4c')],'channel':'chat'};var _0x506e3e=[];var _0x462ad9=[];var _0x1989c5={};var _0xb29707=![];return db[_0x01c6('0x7e')][_0x01c6('0x52')]()['then'](function(_0x4a19d2){if(!_0x4a19d2){throw new db[(_0x01c6('0x7f'))][(_0x01c6('0x80'))](_0x01c6('0x81'));}_0x506e3e=_[_0x01c6('0x82')](_[_0x01c6('0x46')](_0x4a19d2),[_0x01c6('0x83'),_0x01c6('0x84')]);_0x462ad9=_[_0x01c6('0x82')](_[_0x01c6('0x46')](_0x4a19d2),['createdAt','updatedAt',_0x01c6('0x85'),'ListId']);if(_0x3a08d[_0x01c6('0x4c')]['id']){delete _0x3a08d[_0x01c6('0x4c')]['id'];}if(_['isNil'](_0x3a08d[_0x01c6('0x4c')]['from'])){throw new db[(_0x01c6('0x7f'))]['ValidationError']('from\x20is\x20mandatory');}if(_['isNil'](_0x3a08d[_0x01c6('0x4c')][_0x01c6('0x4c')])||_0x3a08d[_0x01c6('0x4c')][_0x01c6('0x4c')]===''){throw new db['Sequelize']['ValidationError'](_0x01c6('0x86'));}if(_['isNil'](_0x3a08d['body'][_0x01c6('0x87')])){throw new db[(_0x01c6('0x7f'))][(_0x01c6('0x80'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x462ad9);}if(!_['includes'](_0x462ad9,_0x3a08d[_0x01c6('0x4c')][_0x01c6('0x87')])){throw new db[(_0x01c6('0x7f'))][(_0x01c6('0x80'))](_0x01c6('0x88')+_0x462ad9);}_0x1989c5[_0x3a08d[_0x01c6('0x4c')]['mapKey']]=_0x3a08d[_0x01c6('0x4c')][_0x01c6('0x89')];})[_0x01c6('0x14')](function(){return db['ChatWebsite'][_0x01c6('0x4a')]({'where':{'id':_0x3a08d['params']['id']},'include':[{'model':db[_0x01c6('0x8a')],'as':'List','include':[{'model':db[_0x01c6('0x7e')],'as':'Contacts','where':_0x1989c5,'limit':0x1,'order':[['updatedAt',_0x01c6('0x8b')]]}]},{'model':db[_0x01c6('0x8c')],'as':_0x01c6('0x8d')}]});})[_0x01c6('0x14')](handleEntityNotFound(_0xcfbe0d,null))['then'](function(_0xf57315){if(_0xf57315&&_0xf57315[_0x01c6('0x8e')]){_0x116632[_0x01c6('0x8f')]=_0xf57315;_0x116632[_0x01c6('0x90')]=_0xf57315['Applications'];_0x116632[_0x01c6('0x91')]=_0xf57315[_0x01c6('0x8e')];_0x116632[_0x01c6('0x90')]=_[_0x01c6('0x92')](_0x116632[_0x01c6('0x90')],[_0x01c6('0x93')],[_0x01c6('0x94')]);if(_0x116632[_0x01c6('0x8f')][_0x01c6('0x8d')]){delete _0x116632[_0x01c6('0x8f')][_0x01c6('0x8d')];}if(_0x116632['account'][_0x01c6('0x8e')]&&_0x116632['account'][_0x01c6('0x8e')]['Contacts']['length']){return _0x116632['account'][_0x01c6('0x8e')]['Contacts'][0x0];}var _0x4814eb=_[_0x01c6('0xc')](_0x3a08d[_0x01c6('0x4c')],{'firstName':_0x3a08d[_0x01c6('0x4c')][_0x01c6('0x89')],'ListId':_0xf57315['ListId']});_0x4814eb[_0x3a08d[_0x01c6('0x4c')][_0x01c6('0x87')]]=_0x3a08d[_0x01c6('0x4c')]['from'];return db[_0x01c6('0x7e')][_0x01c6('0x4b')](_0x4814eb,{'fields':_0x506e3e,'raw':!![]});}})[_0x01c6('0x14')](handleEntityNotFound(_0xcfbe0d,null))[_0x01c6('0x14')](function(_0x4b8c8b){_0x116632[_0x01c6('0x95')]=_0x4b8c8b;var _0x2d66c5=_0x3a08d['body'][_0x01c6('0x96')];if(_0x3a08d[_0x01c6('0x7b')]['cf-connecting-ip']){_0x2d66c5=_0x3a08d[_0x01c6('0x7b')][_0x01c6('0x97')];}else if(_0x3a08d[_0x01c6('0x7b')]['x-forwarded-for']){_0x2d66c5=_[_0x01c6('0x98')](_0x3a08d[_0x01c6('0x7b')][_0x01c6('0x99')][_0x01c6('0x9a')](','));}if(_0x4b8c8b){var _0x89d485={'ContactId':_0x4b8c8b['id'],'ChatWebsiteId':_0x3a08d[_0x01c6('0x43')]['id'],'from':(_0x4b8c8b[_0x01c6('0x9b')]||'')+'\x20'+(_0x4b8c8b[_0x01c6('0x9c')]||''),'customerIp':_0x2d66c5,'customerPort':_0x3a08d[_0x01c6('0x7b')][_0x01c6('0x9d')]?_0x3a08d[_0x01c6('0x7b')][_0x01c6('0x9d')]:null,'referer':_0x3a08d[_0x01c6('0x4c')][_0x01c6('0x9e')],'browserName':_0x3511ce[_0x01c6('0x9f')]['name']&&_0x3511ce[_0x01c6('0x9f')][_0x01c6('0xa0')]?util[_0x01c6('0xa1')]('%s\x20%s',_0x3511ce[_0x01c6('0x9f')][_0x01c6('0x2b')],_0x3511ce[_0x01c6('0x9f')][_0x01c6('0xa0')]):'unknown','browserVersion':_0x3511ce[_0x01c6('0x9f')][_0x01c6('0xa0')]||'unknown','osName':util[_0x01c6('0xa1')](_0x01c6('0xa2'),_0x3511ce['os']['name'],_0x3511ce['os'][_0x01c6('0xa0')]),'osVersion':_0x3511ce['os'][_0x01c6('0xa0')],'deviceModel':_0x3511ce['device'][_0x01c6('0x32')]&&_0x3511ce[_0x01c6('0xa3')][_0x01c6('0xa4')]?util[_0x01c6('0xa1')](_0x01c6('0xa5'),_0x3511ce[_0x01c6('0xa3')][_0x01c6('0x32')],_0x3511ce[_0x01c6('0xa3')]['vendor'],_0x3511ce[_0x01c6('0xa3')][_0x01c6('0x3f')]):null,'deviceVendor':_0x3511ce[_0x01c6('0xa3')]['vendor'],'deviceType':_0x3511ce[_0x01c6('0xa3')][_0x01c6('0x3f')],'formData':JSON[_0x01c6('0xa6')](_0x3a08d[_0x01c6('0x4c')])};var _0x49ac8d={'ChatWebsiteId':_0x3a08d['params']['id'],'closed':![]};if(_0x3a08d['body'][_0x01c6('0xa7')]){_0x49ac8d[_0x01c6('0xa7')]=_0x3a08d[_0x01c6('0x4c')]['threadId'];return db[_0x01c6('0xa8')][_0x01c6('0x4a')]({'where':_0x49ac8d})[_0x01c6('0x14')](function(_0xdd8fcb){if(_0xdd8fcb){return[_0xdd8fcb,![]];}_0x89d485[_0x01c6('0xa7')]=_0x3a08d[_0x01c6('0x4c')][_0x01c6('0xa7')];_0x89d485['externalUrl']=_0x3a08d[_0x01c6('0x4c')][_0x01c6('0xa9')];return db[_0x01c6('0xa8')][_0x01c6('0x4b')](_0x89d485)[_0x01c6('0x14')](function(_0x5a6fec){return[_0x5a6fec,!![]];});});}_0x49ac8d[_0x01c6('0xaa')]=_0x4b8c8b['id'];if(_0x3a08d[_0x01c6('0x4c')]['interaction']&&_0x3a08d['body'][_0x01c6('0xab')]['id']){_0x49ac8d['id']=_0x3a08d[_0x01c6('0x4c')]['interaction']['id'];return db[_0x01c6('0xa8')][_0x01c6('0x4a')]({'where':_0x49ac8d})[_0x01c6('0x14')](function(_0x2a06c4){if(_0x2a06c4){return[_0x2a06c4,![]];}return db['ChatInteraction'][_0x01c6('0x4b')](_0x89d485)[_0x01c6('0x14')](function(_0x11f3db){return[_0x11f3db,!![]];});});}return db[_0x01c6('0xa8')][_0x01c6('0x4b')](_0x89d485)[_0x01c6('0x14')](function(_0x2bf91f){return[_0x2bf91f,!![]];});}})[_0x01c6('0xac')](function(_0x596e97,_0x9a30d4){if(_0x596e97){_0xb29707=_0x9a30d4;if(!_0x9a30d4){var _0x5b6b76={'from':(_0x116632[_0x01c6('0x95')][_0x01c6('0x9b')]||'')+'\x20'+(_0x116632['contact'][_0x01c6('0x9c')]||'')};if(_0x3a08d[_0x01c6('0x4c')][_0x01c6('0xa7')]&&_0x3a08d['body'][_0x01c6('0xad')]&&_0x3a08d['body'][_0x01c6('0xa7')]!=_0x3a08d['body']['messageId']){_0x5b6b76[_0x01c6('0xa7')]=_0x3a08d['body'][_0x01c6('0xad')];}return _0x596e97['update'](_0x5b6b76);}else{return _0x596e97;}}})[_0x01c6('0x14')](function(_0xfc46a){_0x116632[_0x01c6('0xab')]=_0xfc46a[_0x01c6('0x26')]({'plain':!![]});_0x116632[_0x01c6('0xab')][_0x01c6('0xae')]=_0xb29707;if(_0x116632[_0x01c6('0xab')][_0x01c6('0xae')]){if(_0x116632[_0x01c6('0x8f')][_0x01c6('0xaf')]){_0x116632[_0x01c6('0x90')][_0x01c6('0xb0')]({'id':0x0,'priority':_0x116632['applications']['length']+0x1,'app':_0x01c6('0xb1'),'appdata':_0x01c6('0xb2'),'interval':_0x01c6('0xb3')});}}return db[_0x01c6('0xb4')][_0x01c6('0x4b')]({'body':_0x3a08d['body'][_0x01c6('0x4c')],'ChatWebsiteId':_0x3a08d['params']['id'],'ChatInteractionId':_0xfc46a['id'],'direction':'in','ContactId':_0x116632[_0x01c6('0x95')]['id'],'AttachmentId':_0x3a08d['body'][_0x01c6('0xb5')]});})[_0x01c6('0x14')](function(_0x3e4669){_0x116632[_0x01c6('0x1b')]=_0x3e4669;if(_0x116632[_0x01c6('0xab')]['UserId']){return db[_0x01c6('0xb6')]['find']({'attributes':['id',_0x01c6('0x2b')],'where':{'id':_0x116632[_0x01c6('0xab')][_0x01c6('0xb7')]}})[_0x01c6('0x14')](function(_0x4ba28a){if(_0x4ba28a){_0x116632[_0x01c6('0x90')][_0x01c6('0xb8')]({'id':0x0,'priority':0x0,'app':'agent','appdata':_0x4ba28a[_0x01c6('0x2b')]+','+(_0x116632['account']['waitForTheAssignedAgent']||0xa),'interval':_0x01c6('0xb3')});_0x116632['forcedOwnership']=!![];}return respondWithRpcPromise(_0x01c6('0xb9'),_0x01c6('0xba'),_0x116632);});}return respondWithRpcPromise('Start',_0x01c6('0xba'),_0x116632);})['then'](function(_0x1edf67){respondWithRpcPromise(_0x01c6('0xbb'),'EventManager',{'event':_0x01c6('0xbc'),'message':_0x1edf67},client9002);return _0x1edf67;})[_0x01c6('0x14')](respondWithResult(_0xcfbe0d,null))['catch'](handleError(_0xcfbe0d,null));};exports[_0x01c6('0xbd')]=function(_0x12d023,_0x2fe7ea){var _0x3d8f2e,_0x13ae75,_0x50dbc8;var _0x274dbb=[];var _0x28c365={};var _0x29da69=_0x12d023[_0x01c6('0xbe')]||[];var _0x3d2b37=[];var _0x18c1ba;return db['CmContact'][_0x01c6('0x52')]()[_0x01c6('0x14')](function(_0x1c9d8){if(!_0x1c9d8){throw new db[(_0x01c6('0x7f'))][(_0x01c6('0x80'))]('no\x20available\x20attributes');}_0x274dbb=_[_0x01c6('0x82')](_['keys'](_0x1c9d8),[_0x01c6('0x83'),_0x01c6('0x84'),_0x01c6('0x85'),'ListId']);if(_0x12d023[_0x01c6('0x4c')]['id']){delete _0x12d023[_0x01c6('0x4c')]['id'];}if(_[_0x01c6('0x6e')](_0x12d023[_0x01c6('0x4c')][_0x01c6('0x89')])){throw _0x2fe7ea['status'](0x1f4)[_0x01c6('0x2c')](new db['Sequelize']['ValidationError'](_0x01c6('0xbf')));}if(_[_0x01c6('0x6e')](_0x12d023[_0x01c6('0x4c')][_0x01c6('0x4c')])||_0x12d023[_0x01c6('0x4c')]['body']===''){throw _0x2fe7ea['status'](0x1f4)[_0x01c6('0x2c')](new db[(_0x01c6('0x7f'))][(_0x01c6('0x80'))](_0x01c6('0x86')));}if(_[_0x01c6('0x6e')](_0x12d023[_0x01c6('0x4c')][_0x01c6('0xc0')])){throw _0x2fe7ea['status'](0x1f4)[_0x01c6('0x2c')](new db[(_0x01c6('0x7f'))][(_0x01c6('0x80'))]('mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x274dbb));}if(!_['includes'](_0x274dbb,_0x12d023['body'][_0x01c6('0xc0')])){throw _0x2fe7ea[_0x01c6('0x1d')](0x1f4)[_0x01c6('0x2c')](new db[(_0x01c6('0x7f'))][(_0x01c6('0x80'))](_0x01c6('0xc1')+_0x274dbb));}_0x28c365[_0x12d023['body'][_0x01c6('0xc0')]]=_0x12d023[_0x01c6('0x4c')][_0x01c6('0x89')];})['then'](function(){return db[_0x01c6('0x2e')][_0x01c6('0x4a')]({'where':{'id':_0x12d023[_0x01c6('0x43')]['id']},'include':[{'model':db[_0x01c6('0x8a')],'as':_0x01c6('0x8e')},{'model':db[_0x01c6('0xc2')],'as':_0x01c6('0xc2')}]});})['then'](handleEntityNotFound(_0x2fe7ea,null))[_0x01c6('0x14')](function(_0x1a257f){if(_0x1a257f&&_0x1a257f[_0x01c6('0x8e')]){_0x13ae75=_0x1a257f;var _0x1ca746=_[_0x01c6('0xc')](_0x12d023[_0x01c6('0x4c')],{'firstName':_0x12d023[_0x01c6('0x4c')]['from'],'phone':_0x12d023['body'][_0x01c6('0x89')],'ListId':_0x1a257f[_0x01c6('0xc3')]});_0x1ca746[_0x12d023[_0x01c6('0x4c')][_0x01c6('0xc0')]]=_0x12d023[_0x01c6('0x4c')][_0x01c6('0x89')];return db[_0x01c6('0x7e')][_0x01c6('0xc4')]({'where':_0x28c365,'defaults':_0x1ca746});}})['spread'](function(_0x54d841){if(_0x54d841){_0x50dbc8=_0x54d841;var _0x1a1b17=fs[_0x01c6('0xc5')](path[_0x01c6('0x69')](config[_0x01c6('0x6a')],_0x01c6('0xc6')),'utf8');var _0x2f8244=ejs[_0x01c6('0xc7')](_0x1a1b17,{'body':_['toPairs'](_0x12d023['body'][_0x01c6('0x4c')]),'bodyTitle':_0x13ae75[_0x01c6('0xc8')]});return db[_0x01c6('0xc9')][_0x01c6('0x4b')]({'body':_0x2f8244,'plainBody':htmlToText[_0x01c6('0xca')](_0x2f8244),'ContactId':_0x54d841['id'],'ChatWebsiteId':_0x13ae75['id']});}})['then'](function(_0x317773){_0x18c1ba=_0x317773;if(_0x29da69[_0x01c6('0x37')]){var _0x483fb6=_0x29da69[_0x01c6('0x33')](function(_0x3c0987){return{'name':_0x3c0987[_0x01c6('0xcb')],'basename':_0x3c0987['filename'],'type':_0x3c0987[_0x01c6('0xcc')],'ChatOfflineMessageId':_0x317773['id']};});_0x3d2b37=_0x483fb6['map'](_0x1735ca=>{var _0x13cce8={'filename':_0x1735ca[_0x01c6('0x2b')],'path':path[_0x01c6('0x69')](config[_0x01c6('0x6a')],_0x01c6('0xcd'),'files',_0x01c6('0xce'),_0x01c6('0xcf'),_0x1735ca[_0x01c6('0xd0')])};return _0x13cce8;});if(!_0x13ae75[_0x01c6('0xd1')]){return db[_0x01c6('0xd2')]['transaction'](function(_0x5a03ee){return db[_0x01c6('0xd3')][_0x01c6('0xd4')](_0x483fb6,{'transaction':_0x5a03ee});});}}})[_0x01c6('0x14')](function(){if(_0x18c1ba){_0x3d8f2e=_0x18c1ba;return db[_0x01c6('0xc2')]['findOne']({'where':{'service':!![]},'include':[{'model':db[_0x01c6('0xd5')],'as':_0x01c6('0xd6'),'raw':!![],'include':[{'model':db[_0x01c6('0xd7')],'as':_0x01c6('0xd7'),'raw':!![]}]}]});}})[_0x01c6('0x14')](function(_0x5acf4a){if(_0x5acf4a&&_0x5acf4a[_0x01c6('0xd6')]&&_0x13ae75['forwardOffline']&&_0x13ae75[_0x01c6('0xd8')]){var _0x29c36a=_0x5acf4a['getSmtpOptions']();return respondWithRpcPromise(_0x01c6('0xd9'),_0x01c6('0xda'),{'account':_0x29c36a,'message':{'from':util[_0x01c6('0xa1')](_0x01c6('0xdb'),_0x5acf4a[_0x01c6('0x2b')],_0x5acf4a['email']||_0x5acf4a[_0x01c6('0xd6')][_0x01c6('0x4d')]),'to':_0x13ae75[_0x01c6('0xd8')],'subject':_0x13ae75[_0x01c6('0xdc')],'html':_0x3d8f2e['body'],'attachments':_0x3d2b37}},client9003)['then'](function(){return _0x3d8f2e;})[_0x01c6('0x1c')](function(_0x55c705){logger[_0x01c6('0x19')](_0x55c705);});}})[_0x01c6('0x14')](function(){if(_0x13ae75&&_0x13ae75[_0x01c6('0xd1')]&&_0x13ae75['MailAccountId']){var _0x486eb6=[];if(_0x29da69[_0x01c6('0x37')]){_0x486eb6=_0x29da69[_0x01c6('0x33')](function(_0x3e05d9){return{'name':_0x3e05d9[_0x01c6('0xcb')],'basename':_0x3e05d9[_0x01c6('0x62')],'type':_0x3e05d9['mimetype'],'ChatOfflineMessageId':_0x18c1ba['id']};});}var _0x41a206;if(!_['isNil'](_0x13ae75['subjectOffline'])){var _0x33edd7=_['map'](_0x12d023[_0x01c6('0x4c')],function(_0x2d9e4d){return _0x2d9e4d;});var _0x598f33=_[_0x01c6('0xdd')](_0x33edd7)[0x0];var _0x2c751e=_['mapValues'](_0x598f33,function(_0x527e86){return _0x527e86;});_0x41a206=_0x2c751e[0x1][_0x13ae75['subjectOffline']];}var _0x27b096={'from':_0x50dbc8[_0x01c6('0xde')],'firstName':_0x50dbc8['firstName'],'lastName':_0x50dbc8['lastName'],'mapKey':'email','message':{'from':_0x50dbc8[_0x01c6('0xde')],'to':_0x13ae75[_0x01c6('0xc2')][_0x01c6('0xde')],'cc':'','subject':_[_0x01c6('0x6e')](_0x41a206)?_0x13ae75[_0x01c6('0xdc')]:_0x41a206,'messageId':'','sentAt':new Date(),'attach':_0x486eb6[_0x01c6('0x37')],'attachments':_0x486eb6,'originChannel':'Chat','ChatWebsiteId':_0x13ae75['id'],'ChatOfflineMessageId':_0x3d8f2e['id'],'originTo':_0x13ae75[_0x01c6('0xc2')][_0x01c6('0xde')]},'body':_0x3d8f2e[_0x01c6('0x4c')]};var _0x5e404c={'account':{'id':_0x13ae75[_0x01c6('0xdf')]},'body':_0x27b096,'log':_0x01c6('0xe0')};return respondWithRpcPromise('NotifyMailAccount',_0x01c6('0xe1'),_0x5e404c,client9001)[_0x01c6('0x14')](function(){return _0x3d8f2e;})[_0x01c6('0x1c')](function(_0x2d1bd0){logger[_0x01c6('0x19')](_0x2d1bd0);});}return;})[_0x01c6('0x14')](function(){if(_0x3d8f2e){return _0x3d8f2e;}})[_0x01c6('0x14')](respondWithResult(_0x2fe7ea,null))['catch'](function(_0x17db17){logger['error'](_0x01c6('0x1c'),_0x17db17);for(var _0x1ad6cf of _0x29da69){var _0x3452dc=path[_0x01c6('0x69')](config[_0x01c6('0x6a')],'server',_0x01c6('0xbe'),_0x01c6('0xce'),_0x01c6('0xcf'),_0x1ad6cf['filename']);fs_extra[_0x01c6('0xe2')](_0x3452dc)[_0x01c6('0x1c')](function(_0x16b01d){logger['error']('Could\x20not\x20remove\x20attachment\x20file',_0x3452dc,_0x16b01d);});}});};exports['addInteraction']=function(_0x10c538,_0x49752c){return db[_0x01c6('0xa8')][_0x01c6('0x4a')]({'where':{'id':_0x10c538[_0x01c6('0x43')]['id']}})['then'](handleEntityNotFound(_0x49752c,null))[_0x01c6('0x14')](function(_0x4a823f){if(_0x4a823f){return _0x4a823f[_0x01c6('0xe3')](_0x10c538[_0x01c6('0x4c')]['ids'],_[_0x01c6('0xe4')](_0x10c538[_0x01c6('0x4c')],[_0x01c6('0x57'),'id'])||{});}})['then'](respondWithResult(_0x49752c,null))[_0x01c6('0x1c')](handleError(_0x49752c,null));};exports[_0x01c6('0xe5')]=function(_0xfa55c4,_0x45bba6){var _0x5e7e29={'raw':![],'where':{}};var _0x3f8122={};var _0x260a25={'count':0x0,'rows':[]};return db[_0x01c6('0x2e')]['findOne']({'where':{'id':_0xfa55c4[_0x01c6('0x43')]['id']}})['then'](handleEntityNotFound(_0x45bba6,null))[_0x01c6('0x14')](function(_0x3aba39){if(_0x3aba39){_0x3f8122[_0x01c6('0x32')]=_[_0x01c6('0x46')](db[_0x01c6('0xa8')]['rawAttributes']);_0x3f8122[_0x01c6('0x34')]=_[_0x01c6('0x46')](_0xfa55c4[_0x01c6('0x34')]);_0x3f8122[_0x01c6('0x3c')]=_[_0x01c6('0x47')](_0x3f8122['model'],_0x3f8122[_0x01c6('0x34')]);_0x5e7e29[_0x01c6('0x35')]=_['intersection'](_0x3f8122['model'],qs[_0x01c6('0x36')](_0xfa55c4[_0x01c6('0x34')][_0x01c6('0x36')]));_0x5e7e29['attributes']=_0x5e7e29[_0x01c6('0x35')][_0x01c6('0x37')]?_0x5e7e29['attributes']:_0x3f8122[_0x01c6('0x32')];if(!_0xfa55c4[_0x01c6('0x34')]['hasOwnProperty'](_0x01c6('0x39'))){_0x5e7e29[_0x01c6('0x22')]=qs[_0x01c6('0x22')](_0xfa55c4['query']['limit']);_0x5e7e29[_0x01c6('0x20')]=qs[_0x01c6('0x20')](_0xfa55c4[_0x01c6('0x34')][_0x01c6('0x20')]);}_0x5e7e29[_0x01c6('0x3a')]=qs[_0x01c6('0x3b')](_0xfa55c4[_0x01c6('0x34')][_0x01c6('0x3b')]);_0x5e7e29[_0x01c6('0x3d')]=qs[_0x01c6('0x3c')](_['pick'](_0xfa55c4[_0x01c6('0x34')],_0x3f8122[_0x01c6('0x3c')]));_0x5e7e29[_0x01c6('0x3d')]['ChatWebsiteId']=_0x3aba39['id'];if(_0xfa55c4[_0x01c6('0x34')][_0x01c6('0x55')]){_0x5e7e29['where']=_[_0x01c6('0x3e')](_0x5e7e29['where'],{'$or':_[_0x01c6('0x33')](_0x5e7e29[_0x01c6('0x35')],function(_0x1be0dc){var _0x5e69b1={};_0x5e69b1[_0x1be0dc]={'$like':'%'+_0xfa55c4[_0x01c6('0x34')][_0x01c6('0x55')]+'%'};return _0x5e69b1;})});}_0x5e7e29=_['merge']({},_0x5e7e29,_0xfa55c4[_0x01c6('0x41')]);return db['ChatInteraction'][_0x01c6('0x23')]({'where':_0x5e7e29[_0x01c6('0x3d')]})[_0x01c6('0x14')](function(_0x2a7abb){_0x260a25[_0x01c6('0x23')]=_0x2a7abb;if(_0xfa55c4[_0x01c6('0x34')]['includeAll']){_0x5e7e29[_0x01c6('0x49')]=[{'model':db[_0x01c6('0x7e')],'as':_0x01c6('0xe6'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0x01c6('0x2b'),_0x01c6('0xe7'),_0x01c6('0xe8')],'required':![]},{'model':db[_0x01c6('0xe9')],'as':_0x01c6('0xea'),'attributes':['id',_0x01c6('0x2b'),_0x01c6('0xeb')],'where':_0xfa55c4['query'][_0x01c6('0xec')]?{'id':_0xfa55c4[_0x01c6('0x34')][_0x01c6('0xec')]}:undefined,'required':_0xfa55c4[_0x01c6('0x34')]['tag']?!![]:![]}];}return db[_0x01c6('0xa8')][_0x01c6('0x56')](_0x5e7e29);})['then'](function(_0x358300){_0x260a25[_0x01c6('0x42')]=_0x358300;return _0x260a25;});}})[_0x01c6('0x14')](respondWithFilteredResult(_0x45bba6,_0x5e7e29))[_0x01c6('0x1c')](handleError(_0x45bba6,null));};function iftimePromise(_0x454b8d,_0x1cf51f){return respondWithRpcPromise(_0x01c6('0xed'),_0x01c6('0xee'),{'command':_0x1cf51f['timezone']?util[_0x01c6('0xa1')]('iftime\x20%s,%s',_0x454b8d[_0x01c6('0xef')],_0x1cf51f['timezone']):util['format'](_0x01c6('0xf0'),_0x454b8d['interval'])},client9002)[_0x01c6('0x14')](function(_0x237d44){var _0x46a28a=_0x237d44&&_0x237d44[_0x01c6('0xf1')]('true')>=0x0?!![]:![];logger[_0x01c6('0x15')](_0x01c6('0xf2'),_0x1cf51f['id'],_0x454b8d['id'],_0x454b8d[_0x01c6('0xef')],_0x46a28a?'ONLINE':'OFFLINE',_0x1cf51f[_0x01c6('0xf3')]?_0x1cf51f[_0x01c6('0xf3')]:_0x01c6('0xf4'));return _0x46a28a;})[_0x01c6('0x1c')](function(_0x22e68e){logger[_0x01c6('0x19')](_0x01c6('0xf2'),_0x1cf51f['id'],_0x454b8d['id'],_0x454b8d[_0x01c6('0xef')],util[_0x01c6('0xf5')](_0x22e68e,{'showHidden':![],'depth':null}),_0x1cf51f[_0x01c6('0xf3')]?_0x1cf51f[_0x01c6('0xf3')]:_0x01c6('0xf4'));return![];});}exports['getSnippet']=function(_0x5168c7,_0x52fc91){var _0x563dea=0x0;var _0x149f7c=0x0;var _0x50eb3f=![];var _0x31dac6;var _0xb3b3c;return db[_0x01c6('0x2e')][_0x01c6('0x4a')]({'where':{'id':_0x5168c7[_0x01c6('0x43')]['id']},'include':[{'model':db[_0x01c6('0xf6')],'as':_0x01c6('0xf6'),'include':[{'model':db[_0x01c6('0xf6')],'as':_0x01c6('0xf7'),'attributes':['id',_0x01c6('0xef')],'raw':!![]}]}]})[_0x01c6('0x14')](handleEntityNotFound(_0x52fc91,null))['then'](function(_0x3c778a){if(_0x3c778a){_0x31dac6=_0x3c778a;return _0x3c778a['getProactiveActions']({'raw':!![]});}})[_0x01c6('0x14')](function(_0x4c86af){if(_0x31dac6){if(_0x4c86af){_0xb3b3c=_0x4c86af;}}return require(_0x01c6('0x6b'))['getLicense']();})[_0x01c6('0x14')](function(_0x192775){if(_0x192775){_0x149f7c=_0x192775[_0x01c6('0xf8')];_0x50eb3f=_0x192775[_0x01c6('0x6d')];}})[_0x01c6('0x14')](function(){return db[_0x01c6('0xa8')]['count']({'where':{'closed':![]}});})['then'](function(_0x2b3381){_0x563dea=_0x2b3381;if(_0x149f7c&&_0x2b3381>_0x149f7c){return db[_0x01c6('0xf9')][_0x01c6('0x5b')]({'where':{'id':0x1}})[_0x01c6('0x14')](function(_0x59138a){if(_0x59138a){_0x59138a[_0x01c6('0xfa')](_0x01c6('0xfb'));}});}})[_0x01c6('0x14')](function(){if(_0x31dac6[_0x01c6('0xf6')]&&_0x31dac6['Interval'][_0x01c6('0xf7')]){var _0xbbfad0=[];for(var _0x56e445=0x0;_0x56e445<_0x31dac6['Interval'][_0x01c6('0xf7')][_0x01c6('0x37')];_0x56e445++){var _0x1c7b71=_0x31dac6[_0x01c6('0xf6')][_0x01c6('0xf7')][_0x56e445][_0x01c6('0x26')]({'plain':!![]});_0xbbfad0[_0x01c6('0xb0')](iftimePromise(_0x1c7b71,_0x31dac6));}return BPromise[_0x01c6('0xfc')](_0xbbfad0)[_0x01c6('0x14')](function(_0x421382){return _['some'](_0x421382);});}else{return!![];}})[_0x01c6('0x14')](function(_0x480e9d){var _0x51a72b=fs['readFileSync'](path[_0x01c6('0x69')](config[_0x01c6('0x6a')],_0x01c6('0xfd')),'utf8');var _0x1d4536=new url['URL'](_0x31dac6['address'])[_0x01c6('0xfe')];var _0x506d6b='3.1.0';var _0x18696e=![];var _0x554d7b={'chatVersion':_0x506d6b,'chatWebsiteAddressOrigin':_0x1d4536,'remote':_0x31dac6['remote'],'query':querystring[_0x01c6('0xa6')](_['merge'](_0x31dac6[_0x01c6('0x26')]({'plain':!![]}),{'customerIp':_0x5168c7[_0x01c6('0x7b')][_0x01c6('0x99')]||_0x5168c7['headers'][_0x01c6('0xff')]||_0x5168c7[_0x01c6('0x100')][_0x01c6('0x101')]||_0x5168c7['ip'],'referer':_0x5168c7[_0x01c6('0x7b')][_0x01c6('0x9e')],'openedInteractions':_0x563dea,'maxInteractions':_0x149f7c,'virtual':_0x50eb3f[_0x01c6('0xf8')],'online':_0x480e9d,'custom':_0x50eb3f}))[_0x01c6('0x102')](/'/g,'\x5c\x27')};_0x52fc91[_0x01c6('0x2c')](ejs[_0x01c6('0xc7')](Mustache[_0x01c6('0xc7')](_0x51a72b,_0x554d7b),{'proactiveActions':_0xb3b3c,'alignment':_0x31dac6[_0x01c6('0x103')],'verticalAlignment':_0x31dac6[_0x01c6('0x104')],'div_color':_0x31dac6[_0x01c6('0xeb')],'labelText':_0x31dac6[_0x01c6('0x105')],'text_color':_0x31dac6[_0x01c6('0x106')],'text_button_color':_0x31dac6['textButtonColor'],'button_color':_0x31dac6[_0x01c6('0x107')],'background_color':_0x31dac6[_0x01c6('0x108')],'hideWhenOffline':_0x31dac6[_0x01c6('0x109')],'intervalId':_0x31dac6[_0x01c6('0x10a')],'isDevelopment':_0x18696e,'chatVersion':_0x506d6b}));})['catch'](handleError(_0x52fc91,null));};exports[_0x01c6('0x10b')]=function(_0x5a264e,_0x3e5e56){var _0x44a7c0=_0x5a264e[_0x01c6('0x43')]['id'];var _0x4a4a90=_0x5a264e[_0x01c6('0x4c')];var _0xdbc4f4=0xc8;var _0x52fcf4=null;return db['sequelize'][_0x01c6('0x10c')]({'isolationLevel':db[_0x01c6('0xd2')][_0x01c6('0x10d')]['ISOLATION_LEVELS'][_0x01c6('0x10e')]},function(_0x1aba14){return db[_0x01c6('0x2e')][_0x01c6('0x5b')]({'where':{'id':_0x44a7c0},'transaction':_0x1aba14})[_0x01c6('0x14')](function(_0x4f2336){if(_0x4f2336){return db[_0x01c6('0x8c')][_0x01c6('0x28')]({'where':{'ChatWebsiteId':_0x44a7c0},'transaction':_0x1aba14})[_0x01c6('0x14')](function(){var _0x1cc775=_[_0x01c6('0x33')](_0x4a4a90,function(_0x344ebd){_0x344ebd[_0x01c6('0x59')]=_0x44a7c0;return _0x344ebd;});return db[_0x01c6('0x8c')][_0x01c6('0xd4')](_0x1cc775,{'transaction':_0x1aba14});});}else{_0xdbc4f4=0x194;_0x52fcf4=[];}});})['then'](function(){if(_0xdbc4f4!==0x194){return db[_0x01c6('0x8c')][_0x01c6('0x10f')]({'where':{'ChatWebsiteId':_0x44a7c0},'order':_0x01c6('0x93')})[_0x01c6('0x14')](function(_0x37f793){_0x52fcf4=_0x37f793;});}})['catch'](function(_0x4e685b){_0xdbc4f4=0x1f4;logger[_0x01c6('0x19')](_0x4e685b[_0x01c6('0x2a')]);if(_0x4e685b['name']){delete _0x4e685b[_0x01c6('0x2b')];}_0x52fcf4=_0x4e685b;})[_0x01c6('0x110')](function(){if(_0x52fcf4===null){_0x3e5e56['sendStatus'](_0xdbc4f4);}else{if(_0xdbc4f4===0x1f4){_0x3e5e56['status'](_0xdbc4f4)[_0x01c6('0x2c')](_0x52fcf4);}else{_0x3e5e56[_0x01c6('0x1d')](_0xdbc4f4)[_0x01c6('0x1f')](_0x52fcf4);}}});};exports[_0x01c6('0x111')]=function(_0x379894,_0x7a09c5){var _0x3c82cd={};var _0x15f2b7={};var _0x1cebf7;var _0x2cbbcb;return db[_0x01c6('0x2e')][_0x01c6('0x5b')]({'where':{'id':_0x379894[_0x01c6('0x43')]['id']}})[_0x01c6('0x14')](handleEntityNotFound(_0x7a09c5,null))[_0x01c6('0x14')](function(_0x340a63){if(_0x340a63){_0x1cebf7=_0x340a63;_0x15f2b7['model']=_[_0x01c6('0x46')](db['ChatApplication']['rawAttributes']);_0x15f2b7[_0x01c6('0x34')]=_[_0x01c6('0x46')](_0x379894[_0x01c6('0x34')]);_0x15f2b7[_0x01c6('0x3c')]=_[_0x01c6('0x47')](_0x15f2b7[_0x01c6('0x32')],_0x15f2b7[_0x01c6('0x34')]);_0x3c82cd[_0x01c6('0x35')]=_['intersection'](_0x15f2b7[_0x01c6('0x32')],qs[_0x01c6('0x36')](_0x379894[_0x01c6('0x34')][_0x01c6('0x36')]));_0x3c82cd[_0x01c6('0x35')]=_0x3c82cd[_0x01c6('0x35')][_0x01c6('0x37')]?_0x3c82cd[_0x01c6('0x35')]:_0x15f2b7['model'];_0x3c82cd[_0x01c6('0x3a')]=qs[_0x01c6('0x3b')](_0x379894['query'][_0x01c6('0x3b')]);_0x3c82cd['where']=qs[_0x01c6('0x3c')](_['pick'](_0x379894[_0x01c6('0x34')],_0x15f2b7[_0x01c6('0x3c')]));if(_0x379894['query'][_0x01c6('0x55')]){_0x3c82cd['where']=_[_0x01c6('0x3e')](_0x3c82cd[_0x01c6('0x3d')],{'$or':_[_0x01c6('0x33')](_0x3c82cd[_0x01c6('0x35')],function(_0x54b7bb){var _0x1ac454={};_0x1ac454[_0x54b7bb]={'$like':'%'+_0x379894[_0x01c6('0x34')][_0x01c6('0x55')]+'%'};return _0x1ac454;})});}_0x3c82cd=_[_0x01c6('0x3e')]({},_0x3c82cd,_0x379894['options']);return _0x1cebf7[_0x01c6('0x111')](_0x3c82cd);}})[_0x01c6('0x14')](function(_0x29f90d){if(_0x29f90d){_0x2cbbcb=_0x29f90d[_0x01c6('0x37')];if(!_0x379894[_0x01c6('0x34')][_0x01c6('0x38')](_0x01c6('0x39'))){_0x3c82cd[_0x01c6('0x22')]=qs[_0x01c6('0x22')](_0x379894[_0x01c6('0x34')][_0x01c6('0x22')]);_0x3c82cd[_0x01c6('0x20')]=qs[_0x01c6('0x20')](_0x379894[_0x01c6('0x34')]['offset']);}return _0x1cebf7[_0x01c6('0x111')](_0x3c82cd);}})[_0x01c6('0x14')](function(_0x1de683){if(_0x1de683){return _0x1de683?{'count':_0x2cbbcb,'rows':_0x1de683}:null;}})[_0x01c6('0x14')](respondWithResult(_0x7a09c5,null))[_0x01c6('0x1c')](handleError(_0x7a09c5,null));};exports[_0x01c6('0x112')]=function(_0x18e348,_0x4b18c2){return db[_0x01c6('0x113')][_0x01c6('0x4a')]({'where':{'id':_0x18e348[_0x01c6('0x43')]['id']}})['then'](handleEntityNotFound(_0x4b18c2,null))[_0x01c6('0x14')](function(_0x295781){if(_0x295781){return _0x295781[_0x01c6('0x112')](_0x18e348[_0x01c6('0x4c')][_0x01c6('0x57')],_[_0x01c6('0xe4')](_0x18e348[_0x01c6('0x4c')],[_0x01c6('0x57'),'id'])||{});}})[_0x01c6('0x14')](respondWithResult(_0x4b18c2,null))[_0x01c6('0x1c')](handleError(_0x4b18c2,null));};exports[_0x01c6('0x114')]=function(_0x3546b4,_0x57764d){var _0x4cc779={};var _0x172c13={};var _0x13f4ec;var _0x3adac5;return db['ChatWebsite']['findOne']({'where':{'id':_0x3546b4[_0x01c6('0x43')]['id']}})['then'](handleEntityNotFound(_0x57764d,null))[_0x01c6('0x14')](function(_0x3f1408){if(_0x3f1408){_0x13f4ec=_0x3f1408;_0x172c13[_0x01c6('0x32')]=_[_0x01c6('0x46')](db[_0x01c6('0x115')][_0x01c6('0x2f')]);_0x172c13['query']=_['keys'](_0x3546b4[_0x01c6('0x34')]);_0x172c13[_0x01c6('0x3c')]=_[_0x01c6('0x47')](_0x172c13[_0x01c6('0x32')],_0x172c13[_0x01c6('0x34')]);_0x4cc779[_0x01c6('0x35')]=_[_0x01c6('0x47')](_0x172c13['model'],qs[_0x01c6('0x36')](_0x3546b4['query']['fields']));_0x4cc779['attributes']=_0x4cc779[_0x01c6('0x35')][_0x01c6('0x37')]?_0x4cc779[_0x01c6('0x35')]:_0x172c13[_0x01c6('0x32')];_0x4cc779[_0x01c6('0x3a')]=qs[_0x01c6('0x3b')](_0x3546b4[_0x01c6('0x34')]['sort']);_0x4cc779[_0x01c6('0x3d')]=qs[_0x01c6('0x3c')](_[_0x01c6('0x5d')](_0x3546b4[_0x01c6('0x34')],_0x172c13[_0x01c6('0x3c')]));if(_0x3546b4[_0x01c6('0x34')][_0x01c6('0x55')]){_0x4cc779[_0x01c6('0x3d')]=_[_0x01c6('0x3e')](_0x4cc779[_0x01c6('0x3d')],{'$or':_[_0x01c6('0x33')](_0x4cc779['attributes'],function(_0xa99809){var _0x37c049={};_0x37c049[_0xa99809]={'$like':'%'+_0x3546b4[_0x01c6('0x34')][_0x01c6('0x55')]+'%'};return _0x37c049;})});}_0x4cc779=_['merge']({},_0x4cc779,_0x3546b4[_0x01c6('0x41')]);return _0x13f4ec['getProactiveActions'](_0x4cc779);}})[_0x01c6('0x14')](function(_0x1d1d1f){if(_0x1d1d1f){_0x3adac5=_0x1d1d1f[_0x01c6('0x37')];if(!_0x3546b4['query'][_0x01c6('0x38')](_0x01c6('0x39'))){_0x4cc779[_0x01c6('0x22')]=qs['limit'](_0x3546b4['query'][_0x01c6('0x22')]);_0x4cc779['offset']=qs[_0x01c6('0x20')](_0x3546b4['query']['offset']);}return _0x13f4ec[_0x01c6('0x114')](_0x4cc779);}})[_0x01c6('0x14')](function(_0x48fd07){if(_0x48fd07){return _0x48fd07?{'count':_0x3adac5,'rows':_0x48fd07}:null;}})[_0x01c6('0x14')](respondWithResult(_0x57764d,null))[_0x01c6('0x1c')](handleError(_0x57764d,null));};exports[_0x01c6('0x116')]=function(_0x4a7d1d,_0x45c720){var _0x365d6e=_0x4a7d1d[_0x01c6('0x34')][_0x01c6('0x117')]==='false'?'offlineForm':_0x01c6('0x118');return db[_0x01c6('0x2e')][_0x01c6('0x4a')]({'attributes':['id',_0x365d6e],'where':{'id':_0x4a7d1d[_0x01c6('0x43')]['id']}})[_0x01c6('0x14')](handleEntityNotFound(_0x45c720,null))[_0x01c6('0x14')](function(_0x3b0683){if(_0x3b0683){var _0x95d7d0=_0x3b0683[_0x365d6e];var _0x261d62=_0x95d7d0&&_0x95d7d0['items']?_0x95d7d0[_0x01c6('0x119')]:[];_0x45c720[_0x01c6('0x2c')]({'fromKey':_['isNil'](_0x95d7d0[_0x01c6('0x11a')])?undefined:_0x95d7d0[_0x01c6('0x11a')],'count':_0x261d62[_0x01c6('0x37')],'rows':_0x261d62});}})[_0x01c6('0x1c')](handleError(_0x45c720,null));};exports[_0x01c6('0x11b')]=function(_0x34d5eb,_0x269cd8){var _0x5f1785={'raw':![],'where':{}};var _0x4ac78e={};var _0x432369={'count':0x0,'rows':[]};return db[_0x01c6('0x2e')][_0x01c6('0x5b')]({'where':{'id':_0x34d5eb['params']['id']}})[_0x01c6('0x14')](handleEntityNotFound(_0x269cd8,null))[_0x01c6('0x14')](function(_0xfa3890){if(_0xfa3890){_0x4ac78e['model']=_[_0x01c6('0x46')](db[_0x01c6('0xc9')][_0x01c6('0x2f')]);_0x4ac78e[_0x01c6('0x34')]=_['keys'](_0x34d5eb[_0x01c6('0x34')]);_0x4ac78e[_0x01c6('0x3c')]=_[_0x01c6('0x47')](_0x4ac78e[_0x01c6('0x32')],_0x4ac78e[_0x01c6('0x34')]);_0x5f1785['attributes']=_[_0x01c6('0x47')](_0x4ac78e['model'],qs[_0x01c6('0x36')](_0x34d5eb[_0x01c6('0x34')][_0x01c6('0x36')]));_0x5f1785[_0x01c6('0x35')]=_0x5f1785[_0x01c6('0x35')]['length']?_0x5f1785['attributes']:_0x4ac78e[_0x01c6('0x32')];if(!_0x34d5eb['query'][_0x01c6('0x38')](_0x01c6('0x39'))){_0x5f1785[_0x01c6('0x22')]=qs['limit'](_0x34d5eb[_0x01c6('0x34')][_0x01c6('0x22')]);_0x5f1785[_0x01c6('0x20')]=qs[_0x01c6('0x20')](_0x34d5eb[_0x01c6('0x34')][_0x01c6('0x20')]);}_0x5f1785[_0x01c6('0x3a')]=qs['sort'](_0x34d5eb[_0x01c6('0x34')][_0x01c6('0x3b')]);_0x5f1785[_0x01c6('0x3d')]=qs[_0x01c6('0x3c')](_['pick'](_0x34d5eb[_0x01c6('0x34')],_0x4ac78e['filters']));_0x5f1785[_0x01c6('0x3d')]['ChatWebsiteId']=_0xfa3890['id'];if(_0x34d5eb[_0x01c6('0x34')][_0x01c6('0x55')]){_0x5f1785[_0x01c6('0x3d')]=_[_0x01c6('0x3e')](_0x5f1785['where'],{'$or':_[_0x01c6('0x33')](_0x5f1785[_0x01c6('0x35')],function(_0x4e5512){var _0x4ec163={};_0x4ec163[_0x4e5512]={'$like':'%'+_0x34d5eb[_0x01c6('0x34')]['filter']+'%'};return _0x4ec163;})});}_0x5f1785=_[_0x01c6('0x3e')]({},_0x5f1785,_0x34d5eb['options']);return db[_0x01c6('0xc9')][_0x01c6('0x23')]({'where':_0x5f1785[_0x01c6('0x3d')]})[_0x01c6('0x14')](function(_0x164d79){_0x432369[_0x01c6('0x23')]=_0x164d79;if(_0x34d5eb['query'][_0x01c6('0x48')]){_0x5f1785[_0x01c6('0x49')]=[{'all':!![]}];}else{_0x5f1785[_0x01c6('0x49')]=[{'model':db[_0x01c6('0x7e')],'as':_0x01c6('0xe6'),'required':![]},{'model':db['Attachment'],'as':_0x01c6('0x11c'),'required':![]}];}return db[_0x01c6('0xc9')][_0x01c6('0x56')](_0x5f1785);})['then'](function(_0x2e040e){_0x432369[_0x01c6('0x42')]=_0x2e040e;return _0x432369;});}})[_0x01c6('0x14')](respondWithFilteredResult(_0x269cd8,_0x5f1785))[_0x01c6('0x1c')](handleError(_0x269cd8,null));};exports[_0x01c6('0x11d')]=function(_0x2f1608,_0x2bc974){return db[_0x01c6('0x2e')][_0x01c6('0x4a')]({'where':{'id':_0x2f1608[_0x01c6('0x43')]['id']}})[_0x01c6('0x14')](handleEntityNotFound(_0x2bc974,null))['then'](function(_0x52cd9d){if(_0x52cd9d){return _0x52cd9d[_0x01c6('0x11d')](_0x2f1608[_0x01c6('0x4c')][_0x01c6('0x57')],_[_0x01c6('0xe4')](_0x2f1608['body'],[_0x01c6('0x57'),'id'])||{})['spread'](function(_0xa1a828){for(var _0x9c1c50=0x0;_0x9c1c50<_0x2f1608[_0x01c6('0x4c')][_0x01c6('0x57')]['length'];_0x9c1c50+=0x1){socket['emit']('userChatWebsite:save',{'UserId':Number(_0x2f1608[_0x01c6('0x4c')][_0x01c6('0x57')][_0x9c1c50]),'ChatWebsiteId':Number(_0x2f1608[_0x01c6('0x43')]['id'])});}return _0xa1a828;});}})[_0x01c6('0x14')](respondWithResult(_0x2bc974,null))['catch'](handleError(_0x2bc974,null));};exports['removeAgents']=function(_0x20b905,_0x2fe409){return db['ChatWebsite'][_0x01c6('0x4a')]({'where':{'id':_0x20b905[_0x01c6('0x43')]['id']}})[_0x01c6('0x14')](handleEntityNotFound(_0x2fe409,null))[_0x01c6('0x14')](function(_0x3b5664){if(_0x3b5664){return _0x3b5664[_0x01c6('0x11e')](_0x20b905['query'][_0x01c6('0x57')])[_0x01c6('0x14')](function(){if(_['isArray'](_0x20b905['query'][_0x01c6('0x57')])){for(var _0x4fe9a6=0x0;_0x4fe9a6<_0x20b905[_0x01c6('0x34')][_0x01c6('0x57')][_0x01c6('0x37')];_0x4fe9a6+=0x1){socket['emit'](_0x01c6('0x11f'),{'UserId':Number(_0x20b905['query'][_0x01c6('0x57')][_0x4fe9a6]),'ChatWebsiteId':Number(_0x20b905[_0x01c6('0x43')]['id'])});}}else{socket[_0x01c6('0x120')](_0x01c6('0x11f'),{'UserId':Number(_0x20b905[_0x01c6('0x34')][_0x01c6('0x57')]),'ChatWebsiteId':Number(_0x20b905[_0x01c6('0x43')]['id'])});}});}})['then'](respondWithStatusCode(_0x2fe409,null))[_0x01c6('0x1c')](handleError(_0x2fe409,null));};exports[_0x01c6('0x121')]=function(_0x107e01,_0x469d4e){var _0x52075d={};var _0x1d3c14={};var _0x4a0a91;var _0x1bacda;return db[_0x01c6('0x2e')][_0x01c6('0x5b')]({'where':{'id':_0x107e01[_0x01c6('0x43')]['id']}})[_0x01c6('0x14')](handleEntityNotFound(_0x469d4e,null))['then'](function(_0x8ab039){if(_0x8ab039){_0x4a0a91=_0x8ab039;_0x1d3c14[_0x01c6('0x32')]=_[_0x01c6('0x46')](db['User']['rawAttributes']);_0x1d3c14['query']=_[_0x01c6('0x46')](_0x107e01['query']);_0x1d3c14[_0x01c6('0x3c')]=_[_0x01c6('0x47')](_0x1d3c14[_0x01c6('0x32')],_0x1d3c14[_0x01c6('0x34')]);_0x52075d['attributes']=_[_0x01c6('0x47')](_0x1d3c14[_0x01c6('0x32')],qs[_0x01c6('0x36')](_0x107e01[_0x01c6('0x34')]['fields']));_0x52075d['attributes']=_0x52075d[_0x01c6('0x35')]['length']?_0x52075d['attributes']:_0x1d3c14[_0x01c6('0x32')];_0x52075d[_0x01c6('0x3a')]=qs['sort'](_0x107e01['query']['sort']);_0x52075d[_0x01c6('0x3d')]=qs[_0x01c6('0x3c')](_[_0x01c6('0x5d')](_0x107e01[_0x01c6('0x34')],_0x1d3c14[_0x01c6('0x3c')]));if(_0x107e01[_0x01c6('0x34')][_0x01c6('0x55')]){_0x52075d[_0x01c6('0x3d')]=_['merge'](_0x52075d['where'],{'$or':_[_0x01c6('0x33')](_0x52075d['attributes'],function(_0x269845){var _0x27ad50={};_0x27ad50[_0x269845]={'$like':'%'+_0x107e01[_0x01c6('0x34')]['filter']+'%'};return _0x27ad50;})});}_0x52075d=_['merge']({},_0x52075d,_0x107e01[_0x01c6('0x41')]);return _0x4a0a91['getAgents'](_0x52075d);}})[_0x01c6('0x14')](function(_0xe5c04d){if(_0xe5c04d){_0x1bacda=_0xe5c04d[_0x01c6('0x37')];if(!_0x107e01[_0x01c6('0x34')]['hasOwnProperty'](_0x01c6('0x39'))){_0x52075d[_0x01c6('0x22')]=qs['limit'](_0x107e01[_0x01c6('0x34')][_0x01c6('0x22')]);_0x52075d[_0x01c6('0x20')]=qs[_0x01c6('0x20')](_0x107e01['query']['offset']);}return _0x4a0a91[_0x01c6('0x121')](_0x52075d);}})['then'](function(_0x288302){if(_0x288302){return _0x288302?{'count':_0x1bacda,'rows':_0x288302}:null;}})['then'](respondWithResult(_0x469d4e,null))[_0x01c6('0x1c')](handleError(_0x469d4e,null));}; \ No newline at end of file +var _0x8e3c=['List','CmContact','Contacts','DESC','ChatApplication','account','applications','Applications','list','contact','headers','cf-connecting-ip','x-forwarded-for','split','firstName','lastName','x-real-port','browser','version','format','%s\x20%s','unknown','device','vendor','%s\x20%s\x20%s','threadId','externalUrl','ChatInteraction','spread','messageId','interaction','created','push','close','unmanaged','*,*,*,*','ChatMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','Start','EventManager','offline','files','send','mapKeyOffline','mapKeyOffline\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','mapKeyOffline\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','MailAccount','findOrCreate','server/files/templates/chatOfflineMessage.ejs','utf8','render','offlineMessageBody','fromString','originalname','mimetype','server','attachments','offline-chat','openNewInteraction','transaction','bulkCreate','Smtp','CloudProvider','forwardOffline','forwardOfflineAddress','getSmtpOptions','SendMail','sendMail','\x22%s\x22\x20<%s>','offlineMessageSubject','subjectOffline','toPairsIn','mapValues','email','Chat','MailAccountId','NotifyMailAccount','notifyMail','remove','Could\x20not\x20remove\x20attachment\x20file','addInteraction','getInteractions','Contact','User','Owner','fullname','Tags','color','tag','Command','timezone','iftime\x20%s,%s','interval','iftime\x20%s','true','ONLINE','OFFLINE','No\x20timezone','[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)','inspect','getSnippet','Interval','Intervals','getProactiveActions','virtual','License','increment','chatLicenseExceeded','some','readFileSync','URL','origin','connection','remoteAddress','referer','replace','verticalAlignment','labelText','textColor','backgroundColor','hideWhenOffline','IntervalId','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','priority','finally','getApplications','addProactiveActions','omit','ChatProactiveAction','getFields','online','false','offlineForm','onlineForm','items','fromKey','getOfflineMessages','ChatOfflineMessage','Attachment','Attachments','addAgents','userChatWebsite:save','removeAgents','userChatWebsite:remove','emit','getAgents','bluebird','util','ejs','fs-extra','lodash','ioredis','api','../../config/environment','url','defaults','redis','localhost','socket.io-emitter','./chatWebsite.socket','html-to-text','client','http','request','info','request\x20sent','debug','ChatWebsite,\x20%s,\x20%s,\x20%s','stringify','error','ChatWebsite,\x20%s,\x20%s','message','result','status','end','json','offset','undefined','limit','count','set','Content-Range','then','destroy','get','ChatWebsites','UserProfileResource','sendStatus','stack','name','index','Pause','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','ChatWebsite','include','findAll','rows','catch','show','mandatoryDispositionPause','length','includeAll','find','create','body','user','UserProfileSection','userProfileId','autoAssociation','update','params','describe','ChatWebsiteId','Disposition','findOne','pick','removeDispositions','addAnswer','CannedAnswer','getAnswers','removeAnswers','ids','addLogo','sitepic','addAvatar','agentAvatar','file','addCustomerAvatar','customerAvatar','filename','addSystemAvatar','systemAvatar','getLogo','join','root','server/files/images/logos/default_logo.svg','getLicense','custom','isNil','existsSync','server/files/images/logos/','getAvatar','server/files/images/avatars/default_avatar.png','server/files/images/avatars/','download','getCustomerAvatar','server/files/images/avatars/customer_avatar.png','showCustomerAvatar','notify','user-agent-parser','setUA','getResult','Sequelize','ValidationError','no\x20available\x20attributes','createdAt','difference','updatedAt','CompanyId','ListId','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList'];(function(_0x3a04f4,_0x325bea){var _0x49a842=function(_0x480659){while(--_0x480659){_0x3a04f4['push'](_0x3a04f4['shift']());}};_0x49a842(++_0x325bea);}(_0x8e3c,0x1c2));var _0xc8e3=function(_0x119cd8,_0x556b73){_0x119cd8=_0x119cd8-0x0;var _0x7072a3=_0x8e3c[_0x119cd8];return _0x7072a3;};'use strict';var BPromise=require(_0xc8e3('0x0'));var Mustache=require('mustache');var util=require(_0xc8e3('0x1'));var path=require('path');var ejs=require(_0xc8e3('0x2'));var fs=require('fs');var fs_extra=require(_0xc8e3('0x3'));var _=require(_0xc8e3('0x4'));var querystring=require('querystring');var Redis=require(_0xc8e3('0x5'));var qs=require('../../components/parsers/qs');var logger=require('../../config/logger')(_0xc8e3('0x6'));var config=require(_0xc8e3('0x7'));var url=require(_0xc8e3('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xc8e3('0x9')](config[_0xc8e3('0xa')],{'host':_0xc8e3('0xb'),'port':0x18eb});var socket=require(_0xc8e3('0xc'))(new Redis(config['redis']));require(_0xc8e3('0xd'))['register'](socket);var htmlToText=require(_0xc8e3('0xe'));var jayson=require('jayson/promise');var client=jayson[_0xc8e3('0xf')]['http']({'port':0x232c});var client9002=jayson[_0xc8e3('0xf')]['http']({'port':0x232a});var client9003=jayson['client'][_0xc8e3('0x10')]({'port':0x232b});var client9001=jayson['client']['http']({'port':0x2329});function respondWithRpcPromise(_0x4e5799,_0x4bd85a,_0x59917d,_0x467c1d){return new BPromise(function(_0x2c0b29,_0x6d5418){var _0x4fd0e1=_0x467c1d||client;return _0x4fd0e1[_0xc8e3('0x11')](_0x4e5799,_0x59917d)['then'](function(_0x2e6ac2){logger[_0xc8e3('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x4bd85a,_0xc8e3('0x13'));logger[_0xc8e3('0x14')](_0xc8e3('0x15'),_0x4bd85a,_0xc8e3('0x13'),JSON[_0xc8e3('0x16')](_0x2e6ac2));if(_0x2e6ac2[_0xc8e3('0x17')]){if(_0x2e6ac2[_0xc8e3('0x17')]['code']===0x1f4){logger[_0xc8e3('0x17')](_0xc8e3('0x18'),_0x4bd85a,_0x2e6ac2[_0xc8e3('0x17')][_0xc8e3('0x19')]);return _0x6d5418(_0x2e6ac2[_0xc8e3('0x17')]['message']);}logger[_0xc8e3('0x17')]('ChatWebsite,\x20%s,\x20%s',_0x4bd85a,_0x2e6ac2['error'][_0xc8e3('0x19')]);return _0x2c0b29(_0x2e6ac2[_0xc8e3('0x17')][_0xc8e3('0x19')]);}else{logger[_0xc8e3('0x12')]('ChatWebsite,\x20%s,\x20%s',_0x4bd85a,'request\x20sent');_0x2c0b29(_0x2e6ac2[_0xc8e3('0x1a')]['message']);}})['catch'](function(_0x1ea732){logger[_0xc8e3('0x17')](_0xc8e3('0x18'),_0x4bd85a,_0x1ea732);_0x6d5418(_0x1ea732);});});}function respondWithStatusCode(_0x48e379,_0x447ef5){_0x447ef5=_0x447ef5||0xcc;return function(_0x37c41e){if(_0x37c41e){return _0x48e379['sendStatus'](_0x447ef5);}return _0x48e379[_0xc8e3('0x1b')](_0x447ef5)[_0xc8e3('0x1c')]();};}function respondWithResult(_0x1f7660,_0x1d89a0){_0x1d89a0=_0x1d89a0||0xc8;return function(_0x504d7f){if(_0x504d7f){return _0x1f7660['status'](_0x1d89a0)[_0xc8e3('0x1d')](_0x504d7f);}};}function respondWithFilteredResult(_0x2e769d,_0x1b900f){return function(_0x337c7c){if(_0x337c7c){var _0xd45b7=typeof _0x1b900f[_0xc8e3('0x1e')]===_0xc8e3('0x1f')&&typeof _0x1b900f[_0xc8e3('0x20')]===_0xc8e3('0x1f');var _0x2f0037=_0x337c7c['count'];var _0x5a604b=_0xd45b7?0x0:_0x1b900f[_0xc8e3('0x1e')];var _0xc9f368=_0xd45b7?_0x337c7c[_0xc8e3('0x21')]:_0x1b900f[_0xc8e3('0x1e')]+_0x1b900f[_0xc8e3('0x20')];var _0x16afce;if(_0xc9f368>=_0x2f0037){_0xc9f368=_0x2f0037;_0x16afce=0xc8;}else{_0x16afce=0xce;}_0x2e769d['status'](_0x16afce);return _0x2e769d[_0xc8e3('0x22')](_0xc8e3('0x23'),_0x5a604b+'-'+_0xc9f368+'/'+_0x2f0037)['json'](_0x337c7c);}return null;};}function saveUpdates(_0x153c8d){return function(_0x1d373b){if(_0x1d373b){return _0x1d373b['update'](_0x153c8d)[_0xc8e3('0x24')](function(_0x395b13){return _0x395b13;});}return null;};}function removeEntity(_0x389dcb){return function(_0x7a9379){if(_0x7a9379){return _0x7a9379[_0xc8e3('0x25')]()[_0xc8e3('0x24')](function(){var _0x19ccac=_0x7a9379[_0xc8e3('0x26')]({'plain':!![]});var _0x4a996c=_0xc8e3('0x27');return db[_0xc8e3('0x28')][_0xc8e3('0x25')]({'where':{'type':_0x4a996c,'resourceId':_0x19ccac['id']}})[_0xc8e3('0x24')](function(){return _0x7a9379;});})[_0xc8e3('0x24')](function(){_0x389dcb[_0xc8e3('0x1b')](0xcc)[_0xc8e3('0x1c')]();});}};}function handleEntityNotFound(_0x370b9c){return function(_0x5b8b3c){if(!_0x5b8b3c){_0x370b9c[_0xc8e3('0x29')](0x194);}return _0x5b8b3c;};}function handleError(_0x519457,_0x2acf8d){_0x2acf8d=_0x2acf8d||0x1f4;return function(_0x5782f7){logger[_0xc8e3('0x17')](_0x5782f7[_0xc8e3('0x2a')]);if(_0x5782f7[_0xc8e3('0x2b')]){delete _0x5782f7[_0xc8e3('0x2b')];}_0x519457['status'](_0x2acf8d)['send'](_0x5782f7);};}exports[_0xc8e3('0x2c')]=function(_0x147f60,_0xdbf802){var _0x31cbd4={'include':[{'model':db[_0xc8e3('0x2d')],'as':'mandatoryDispositionPause'}]},_0x5646c9={},_0x58b161={'count':0x0,'rows':[]};var _0x555e2d=_[_0xc8e3('0x2e')](db['ChatWebsite'][_0xc8e3('0x2f')],function(_0x35e9cd){return{'name':_0x35e9cd[_0xc8e3('0x30')],'type':_0x35e9cd[_0xc8e3('0x31')]['key']};});_0x5646c9[_0xc8e3('0x32')]=_['map'](_0x555e2d,_0xc8e3('0x2b'));_0x5646c9[_0xc8e3('0x33')]=_[_0xc8e3('0x34')](_0x147f60[_0xc8e3('0x33')]);_0x5646c9[_0xc8e3('0x35')]=_[_0xc8e3('0x36')](_0x5646c9[_0xc8e3('0x32')],_0x5646c9['query']);_0x31cbd4[_0xc8e3('0x37')]=_[_0xc8e3('0x36')](_0x5646c9['model'],qs[_0xc8e3('0x38')](_0x147f60[_0xc8e3('0x33')]['fields']));_0x31cbd4[_0xc8e3('0x37')]=_0x31cbd4[_0xc8e3('0x37')]['length']?_0x31cbd4[_0xc8e3('0x37')]:_0x5646c9['model'];if(!_0x147f60[_0xc8e3('0x33')][_0xc8e3('0x39')](_0xc8e3('0x3a'))){_0x31cbd4['limit']=qs[_0xc8e3('0x20')](_0x147f60['query'][_0xc8e3('0x20')]);_0x31cbd4['offset']=qs[_0xc8e3('0x1e')](_0x147f60['query'][_0xc8e3('0x1e')]);}_0x31cbd4[_0xc8e3('0x3b')]=qs[_0xc8e3('0x3c')](_0x147f60[_0xc8e3('0x33')]['sort']);_0x31cbd4[_0xc8e3('0x3d')]=qs[_0xc8e3('0x35')](_['pick'](_0x147f60['query'],_0x5646c9[_0xc8e3('0x35')]),_0x555e2d);if(_0x147f60['query'][_0xc8e3('0x3e')]){_0x31cbd4[_0xc8e3('0x3d')]=_[_0xc8e3('0x3f')](_0x31cbd4[_0xc8e3('0x3d')],{'$or':_[_0xc8e3('0x2e')](_0x555e2d,function(_0x259aea){if(_0x259aea['type']!=='VIRTUAL'){var _0x53c5a2={};_0x53c5a2[_0x259aea['name']]={'$like':'%'+_0x147f60[_0xc8e3('0x33')][_0xc8e3('0x3e')]+'%'};return _0x53c5a2;}})});}_0x31cbd4=_['merge']({},_0x31cbd4,_0x147f60[_0xc8e3('0x40')]);var _0x445f3f={'where':_0x31cbd4[_0xc8e3('0x3d')]};return db[_0xc8e3('0x41')][_0xc8e3('0x21')](_0x445f3f)[_0xc8e3('0x24')](function(_0x17ff26){_0x58b161[_0xc8e3('0x21')]=_0x17ff26;if(_0x147f60[_0xc8e3('0x33')]['includeAll']){_0x31cbd4[_0xc8e3('0x42')]=[{'all':!![]}];}return db['ChatWebsite'][_0xc8e3('0x43')](_0x31cbd4);})['then'](function(_0x53d0ed){_0x58b161[_0xc8e3('0x44')]=_0x53d0ed;return _0x58b161;})[_0xc8e3('0x24')](respondWithFilteredResult(_0xdbf802,_0x31cbd4))[_0xc8e3('0x45')](handleError(_0xdbf802,null));};exports[_0xc8e3('0x46')]=function(_0x5ccfdb,_0x3e1c49){var _0x340a20={'raw':![],'where':{'id':_0x5ccfdb['params']['id']},'include':[{'model':db['Pause'],'as':_0xc8e3('0x47')}]},_0x3d4ba6={};_0x3d4ba6[_0xc8e3('0x32')]=_['keys'](db[_0xc8e3('0x41')][_0xc8e3('0x2f')]);_0x3d4ba6['query']=_[_0xc8e3('0x34')](_0x5ccfdb['query']);_0x3d4ba6['filters']=_[_0xc8e3('0x36')](_0x3d4ba6['model'],_0x3d4ba6['query']);_0x340a20['attributes']=_[_0xc8e3('0x36')](_0x3d4ba6['model'],qs[_0xc8e3('0x38')](_0x5ccfdb[_0xc8e3('0x33')][_0xc8e3('0x38')]));_0x340a20[_0xc8e3('0x37')]=_0x340a20[_0xc8e3('0x37')][_0xc8e3('0x48')]?_0x340a20[_0xc8e3('0x37')]:_0x3d4ba6[_0xc8e3('0x32')];if(_0x5ccfdb['query'][_0xc8e3('0x49')]){_0x340a20[_0xc8e3('0x42')]=[{'all':!![]}];}_0x340a20=_[_0xc8e3('0x3f')]({},_0x340a20,_0x5ccfdb[_0xc8e3('0x40')]);return db[_0xc8e3('0x41')][_0xc8e3('0x4a')](_0x340a20)[_0xc8e3('0x24')](handleEntityNotFound(_0x3e1c49,null))[_0xc8e3('0x24')](respondWithResult(_0x3e1c49,null))[_0xc8e3('0x45')](handleError(_0x3e1c49,null));};exports[_0xc8e3('0x4b')]=function(_0x2b1cd7,_0x235d28){return db[_0xc8e3('0x41')][_0xc8e3('0x4b')](_0x2b1cd7[_0xc8e3('0x4c')],{})['then'](function(_0x4e4102){var _0x5681bf=_0x2b1cd7[_0xc8e3('0x4d')][_0xc8e3('0x26')]({'plain':!![]});if(!_0x5681bf)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5681bf['role']===_0xc8e3('0x4d')){var _0x5133f5=_0x4e4102['get']({'plain':!![]});var _0x468e61=_0xc8e3('0x27');return db[_0xc8e3('0x4e')][_0xc8e3('0x4a')]({'where':{'name':_0x468e61,'userProfileId':_0x5681bf[_0xc8e3('0x4f')]},'raw':!![]})['then'](function(_0x59032e){if(_0x59032e&&_0x59032e[_0xc8e3('0x50')]===0x0){return db[_0xc8e3('0x28')][_0xc8e3('0x4b')]({'name':_0x5133f5[_0xc8e3('0x2b')],'resourceId':_0x5133f5['id'],'type':_0x59032e[_0xc8e3('0x2b')],'sectionId':_0x59032e['id']},{})[_0xc8e3('0x24')](function(){return _0x4e4102;});}else{return _0x4e4102;}})[_0xc8e3('0x45')](function(_0x5bcb34){logger[_0xc8e3('0x17')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x5bcb34);throw _0x5bcb34;});}return _0x4e4102;})[_0xc8e3('0x24')](respondWithResult(_0x235d28,0xc9))[_0xc8e3('0x45')](handleError(_0x235d28,null));};exports[_0xc8e3('0x51')]=function(_0x4d2201,_0xc874c3){if(_0x4d2201[_0xc8e3('0x4c')]['id']){delete _0x4d2201['body']['id'];}return db[_0xc8e3('0x41')]['find']({'where':{'id':_0x4d2201[_0xc8e3('0x52')]['id']},'include':[{'model':db[_0xc8e3('0x2d')],'as':_0xc8e3('0x47')}]})[_0xc8e3('0x24')](handleEntityNotFound(_0xc874c3,null))['then'](saveUpdates(_0x4d2201['body'],null))[_0xc8e3('0x24')](respondWithResult(_0xc874c3,null))[_0xc8e3('0x45')](handleError(_0xc874c3,null));};exports[_0xc8e3('0x25')]=function(_0x46b15f,_0x323c23){return db['ChatWebsite'][_0xc8e3('0x4a')]({'where':{'id':_0x46b15f['params']['id']}})[_0xc8e3('0x24')](handleEntityNotFound(_0x323c23,null))[_0xc8e3('0x24')](removeEntity(_0x323c23,null))[_0xc8e3('0x45')](handleError(_0x323c23,null));};exports[_0xc8e3('0x53')]=function(_0x3c5238,_0x7847ec){return db['ChatWebsite']['describe']()[_0xc8e3('0x24')](respondWithResult(_0x7847ec,null))['catch'](handleError(_0x7847ec,null));};exports['addDisposition']=function(_0x553ab7,_0x3e49bd){if(_0x553ab7[_0xc8e3('0x4c')]['id']){delete _0x553ab7[_0xc8e3('0x4c')]['id'];}return db['ChatWebsite'][_0xc8e3('0x4a')]({'where':{'id':_0x553ab7['params']['id']}})[_0xc8e3('0x24')](handleEntityNotFound(_0x3e49bd,null))[_0xc8e3('0x24')](function(_0x5c11d0){if(_0x5c11d0){_0x553ab7['body'][_0xc8e3('0x54')]=_0x5c11d0['id'];return db[_0xc8e3('0x55')][_0xc8e3('0x4b')](_0x553ab7[_0xc8e3('0x4c')]);}})['then'](respondWithResult(_0x3e49bd,null))[_0xc8e3('0x45')](handleError(_0x3e49bd,null));};exports['getDispositions']=function(_0x2f0944,_0x4b97b8){var _0xa4f420={'raw':![],'where':{}};var _0x15e23c={};var _0x163f41={'count':0x0,'rows':[]};return db[_0xc8e3('0x41')][_0xc8e3('0x56')]({'where':{'id':_0x2f0944[_0xc8e3('0x52')]['id']}})['then'](handleEntityNotFound(_0x4b97b8,null))[_0xc8e3('0x24')](function(_0x41a432){if(_0x41a432){_0x15e23c[_0xc8e3('0x32')]=_['keys'](db[_0xc8e3('0x55')]['rawAttributes']);_0x15e23c[_0xc8e3('0x33')]=_['keys'](_0x2f0944[_0xc8e3('0x33')]);_0x15e23c[_0xc8e3('0x35')]=_[_0xc8e3('0x36')](_0x15e23c[_0xc8e3('0x32')],_0x15e23c[_0xc8e3('0x33')]);_0xa4f420[_0xc8e3('0x37')]=_[_0xc8e3('0x36')](_0x15e23c[_0xc8e3('0x32')],qs[_0xc8e3('0x38')](_0x2f0944[_0xc8e3('0x33')]['fields']));_0xa4f420[_0xc8e3('0x37')]=_0xa4f420[_0xc8e3('0x37')][_0xc8e3('0x48')]?_0xa4f420[_0xc8e3('0x37')]:_0x15e23c[_0xc8e3('0x32')];if(!_0x2f0944['query'][_0xc8e3('0x39')]('nolimit')){_0xa4f420[_0xc8e3('0x20')]=qs[_0xc8e3('0x20')](_0x2f0944[_0xc8e3('0x33')][_0xc8e3('0x20')]);_0xa4f420[_0xc8e3('0x1e')]=qs[_0xc8e3('0x1e')](_0x2f0944[_0xc8e3('0x33')][_0xc8e3('0x1e')]);}_0xa4f420[_0xc8e3('0x3b')]=qs[_0xc8e3('0x3c')](_0x2f0944['query'][_0xc8e3('0x3c')]);_0xa4f420['where']=qs[_0xc8e3('0x35')](_[_0xc8e3('0x57')](_0x2f0944[_0xc8e3('0x33')],_0x15e23c[_0xc8e3('0x35')]));_0xa4f420[_0xc8e3('0x3d')][_0xc8e3('0x54')]=_0x41a432['id'];if(_0x2f0944[_0xc8e3('0x33')]['filter']){_0xa4f420[_0xc8e3('0x3d')]=_[_0xc8e3('0x3f')](_0xa4f420['where'],{'$or':_[_0xc8e3('0x2e')](_0xa4f420['attributes'],function(_0x109f75){var _0x47daaa={};_0x47daaa[_0x109f75]={'$like':'%'+_0x2f0944[_0xc8e3('0x33')][_0xc8e3('0x3e')]+'%'};return _0x47daaa;})});}_0xa4f420=_[_0xc8e3('0x3f')]({},_0xa4f420,_0x2f0944[_0xc8e3('0x40')]);return db['Disposition'][_0xc8e3('0x21')]({'where':_0xa4f420['where']})[_0xc8e3('0x24')](function(_0x5757c0){_0x163f41[_0xc8e3('0x21')]=_0x5757c0;if(_0x2f0944['query'][_0xc8e3('0x49')]){_0xa4f420[_0xc8e3('0x42')]=[{'all':!![]}];}return db[_0xc8e3('0x55')][_0xc8e3('0x43')](_0xa4f420);})['then'](function(_0x567b96){_0x163f41[_0xc8e3('0x44')]=_0x567b96;return _0x163f41;});}})[_0xc8e3('0x24')](respondWithFilteredResult(_0x4b97b8,_0xa4f420))[_0xc8e3('0x45')](handleError(_0x4b97b8,null));};exports[_0xc8e3('0x58')]=function(_0x20ff86,_0x21e211){return db['ChatWebsite']['find']({'where':{'id':_0x20ff86['params']['id']}})[_0xc8e3('0x24')](handleEntityNotFound(_0x21e211,null))['then'](function(_0x51658f){if(_0x51658f){return _0x51658f['removeDispositions'](_0x20ff86[_0xc8e3('0x33')]['ids']);}})[_0xc8e3('0x24')](respondWithStatusCode(_0x21e211,null))[_0xc8e3('0x45')](handleError(_0x21e211,null));};exports[_0xc8e3('0x59')]=function(_0x2350ab,_0x595fb7){if(_0x2350ab[_0xc8e3('0x4c')]['id']){delete _0x2350ab[_0xc8e3('0x4c')]['id'];}return db[_0xc8e3('0x41')]['find']({'where':{'id':_0x2350ab[_0xc8e3('0x52')]['id']}})[_0xc8e3('0x24')](handleEntityNotFound(_0x595fb7,null))[_0xc8e3('0x24')](function(_0x4656f9){if(_0x4656f9){_0x2350ab[_0xc8e3('0x4c')][_0xc8e3('0x54')]=_0x4656f9['id'];return db[_0xc8e3('0x5a')][_0xc8e3('0x4b')](_0x2350ab[_0xc8e3('0x4c')]);}})['then'](respondWithResult(_0x595fb7,null))[_0xc8e3('0x45')](handleError(_0x595fb7,null));};exports[_0xc8e3('0x5b')]=function(_0x49e860,_0x2fca37){var _0x49fb52={'raw':![],'where':{}};var _0xa6e5bb={};var _0x198c71={'count':0x0,'rows':[]};return db[_0xc8e3('0x41')][_0xc8e3('0x56')]({'where':{'id':_0x49e860[_0xc8e3('0x52')]['id']}})['then'](handleEntityNotFound(_0x2fca37,null))[_0xc8e3('0x24')](function(_0x2ef9b7){if(_0x2ef9b7){_0xa6e5bb[_0xc8e3('0x32')]=_[_0xc8e3('0x34')](db[_0xc8e3('0x5a')][_0xc8e3('0x2f')]);_0xa6e5bb[_0xc8e3('0x33')]=_[_0xc8e3('0x34')](_0x49e860[_0xc8e3('0x33')]);_0xa6e5bb['filters']=_[_0xc8e3('0x36')](_0xa6e5bb[_0xc8e3('0x32')],_0xa6e5bb[_0xc8e3('0x33')]);_0x49fb52['attributes']=_[_0xc8e3('0x36')](_0xa6e5bb[_0xc8e3('0x32')],qs['fields'](_0x49e860[_0xc8e3('0x33')][_0xc8e3('0x38')]));_0x49fb52[_0xc8e3('0x37')]=_0x49fb52['attributes'][_0xc8e3('0x48')]?_0x49fb52[_0xc8e3('0x37')]:_0xa6e5bb['model'];if(!_0x49e860[_0xc8e3('0x33')][_0xc8e3('0x39')](_0xc8e3('0x3a'))){_0x49fb52[_0xc8e3('0x20')]=qs[_0xc8e3('0x20')](_0x49e860[_0xc8e3('0x33')]['limit']);_0x49fb52[_0xc8e3('0x1e')]=qs[_0xc8e3('0x1e')](_0x49e860['query'][_0xc8e3('0x1e')]);}_0x49fb52[_0xc8e3('0x3b')]=qs[_0xc8e3('0x3c')](_0x49e860['query']['sort']);_0x49fb52[_0xc8e3('0x3d')]=qs['filters'](_['pick'](_0x49e860[_0xc8e3('0x33')],_0xa6e5bb[_0xc8e3('0x35')]));_0x49fb52[_0xc8e3('0x3d')][_0xc8e3('0x54')]=_0x2ef9b7['id'];if(_0x49e860['query'][_0xc8e3('0x3e')]){_0x49fb52[_0xc8e3('0x3d')]=_[_0xc8e3('0x3f')](_0x49fb52[_0xc8e3('0x3d')],{'$or':_['map'](_0x49fb52[_0xc8e3('0x37')],function(_0x5240f6){var _0x22c81f={};_0x22c81f[_0x5240f6]={'$like':'%'+_0x49e860['query'][_0xc8e3('0x3e')]+'%'};return _0x22c81f;})});}_0x49fb52=_[_0xc8e3('0x3f')]({},_0x49fb52,_0x49e860[_0xc8e3('0x40')]);return db[_0xc8e3('0x5a')][_0xc8e3('0x21')]({'where':_0x49fb52[_0xc8e3('0x3d')]})['then'](function(_0x55b931){_0x198c71['count']=_0x55b931;if(_0x49e860[_0xc8e3('0x33')][_0xc8e3('0x49')]){_0x49fb52[_0xc8e3('0x42')]=[{'all':!![]}];}return db['CannedAnswer'][_0xc8e3('0x43')](_0x49fb52);})['then'](function(_0x37e858){_0x198c71[_0xc8e3('0x44')]=_0x37e858;return _0x198c71;});}})['then'](respondWithFilteredResult(_0x2fca37,_0x49fb52))[_0xc8e3('0x45')](handleError(_0x2fca37,null));};exports['removeAnswers']=function(_0x43846c,_0x4ebe67){return db[_0xc8e3('0x41')][_0xc8e3('0x4a')]({'where':{'id':_0x43846c[_0xc8e3('0x52')]['id']}})[_0xc8e3('0x24')](handleEntityNotFound(_0x4ebe67,null))[_0xc8e3('0x24')](function(_0x4636bf){if(_0x4636bf){return _0x4636bf[_0xc8e3('0x5c')](_0x43846c[_0xc8e3('0x33')][_0xc8e3('0x5d')]);}})[_0xc8e3('0x24')](respondWithStatusCode(_0x4ebe67,null))[_0xc8e3('0x45')](handleError(_0x4ebe67,null));};exports[_0xc8e3('0x5e')]=function(_0x59149b,_0x5df620){_0x59149b[_0xc8e3('0x4c')][_0xc8e3('0x5f')]=_0x59149b['file']['filename'];return db['ChatWebsite'][_0xc8e3('0x4a')]({'where':{'id':_0x59149b['params']['id']}})['then'](handleEntityNotFound(_0x5df620,null))[_0xc8e3('0x24')](saveUpdates(_0x59149b[_0xc8e3('0x4c')],null))[_0xc8e3('0x24')](respondWithResult(_0x5df620,null))[_0xc8e3('0x45')](handleError(_0x5df620,null));};exports[_0xc8e3('0x60')]=function(_0x3f7090,_0x5383f9){_0x3f7090[_0xc8e3('0x4c')][_0xc8e3('0x61')]=_0x3f7090[_0xc8e3('0x62')]['filename'];return db['ChatWebsite'][_0xc8e3('0x4a')]({'where':{'id':_0x3f7090['params']['id']}})[_0xc8e3('0x24')](handleEntityNotFound(_0x5383f9,null))[_0xc8e3('0x24')](saveUpdates(_0x3f7090[_0xc8e3('0x4c')],null))[_0xc8e3('0x24')](respondWithResult(_0x5383f9,null))['catch'](handleError(_0x5383f9,null));};exports[_0xc8e3('0x63')]=function(_0x59447d,_0x328ee9){_0x59447d['body'][_0xc8e3('0x64')]=_0x59447d[_0xc8e3('0x62')][_0xc8e3('0x65')];return db[_0xc8e3('0x41')][_0xc8e3('0x4a')]({'where':{'id':_0x59447d[_0xc8e3('0x52')]['id']}})[_0xc8e3('0x24')](handleEntityNotFound(_0x328ee9,null))['then'](saveUpdates(_0x59447d[_0xc8e3('0x4c')],null))[_0xc8e3('0x24')](respondWithResult(_0x328ee9,null))[_0xc8e3('0x45')](handleError(_0x328ee9,null));};exports[_0xc8e3('0x66')]=function(_0x53fdb0,_0x11cdfa){_0x53fdb0[_0xc8e3('0x4c')][_0xc8e3('0x67')]=_0x53fdb0[_0xc8e3('0x62')][_0xc8e3('0x65')];return db['ChatWebsite']['find']({'where':{'id':_0x53fdb0[_0xc8e3('0x52')]['id']}})[_0xc8e3('0x24')](handleEntityNotFound(_0x11cdfa,null))[_0xc8e3('0x24')](saveUpdates(_0x53fdb0[_0xc8e3('0x4c')],null))[_0xc8e3('0x24')](respondWithResult(_0x11cdfa,null))[_0xc8e3('0x45')](handleError(_0x11cdfa,null));};exports[_0xc8e3('0x68')]=function(_0x553785,_0x250c49){var _0x303370=path[_0xc8e3('0x69')](config[_0xc8e3('0x6a')],_0xc8e3('0x6b'));var _0x12f1be={'where':{'id':_0x553785[_0xc8e3('0x52')]['id']},'attributes':['id',_0xc8e3('0x5f')],'raw':!![]};var _0x1b74d8=![];return require('../../config/license/util')[_0xc8e3('0x6c')]()[_0xc8e3('0x24')](function(_0x932f0f){if(_0x932f0f){_0x1b74d8=_0x932f0f[_0xc8e3('0x6d')];}})[_0xc8e3('0x24')](function(){return db[_0xc8e3('0x41')]['find'](_0x12f1be);})[_0xc8e3('0x24')](handleEntityNotFound(_0x250c49,null))[_0xc8e3('0x24')](function(_0x5b542c){if(_0x5b542c){if(!_[_0xc8e3('0x6e')](_0x5b542c[_0xc8e3('0x5f')])){if(fs[_0xc8e3('0x6f')](path[_0xc8e3('0x69')](config[_0xc8e3('0x6a')],'server/files/images/logos/',_0x5b542c[_0xc8e3('0x5f')]))&&_0x1b74d8){_0x303370=path[_0xc8e3('0x69')](config[_0xc8e3('0x6a')],_0xc8e3('0x70'),_0x5b542c[_0xc8e3('0x5f')]);}}return _0x250c49['download'](_0x303370);}})[_0xc8e3('0x45')](handleError(_0x250c49,null));};exports[_0xc8e3('0x71')]=function(_0x1eec65,_0x474e27){var _0x9a3d89=path[_0xc8e3('0x69')](config[_0xc8e3('0x6a')],_0xc8e3('0x72'));var _0x40f357={'where':{'id':_0x1eec65[_0xc8e3('0x52')]['id']},'attributes':['id',_0xc8e3('0x61')],'raw':!![]};return db[_0xc8e3('0x41')]['find'](_0x40f357)[_0xc8e3('0x24')](handleEntityNotFound(_0x474e27,null))[_0xc8e3('0x24')](function(_0x5ecc92){if(_0x5ecc92){if(!_[_0xc8e3('0x6e')](_0x5ecc92['agentAvatar'])){if(fs[_0xc8e3('0x6f')](path[_0xc8e3('0x69')](config[_0xc8e3('0x6a')],'server/files/images/avatars/',_0x5ecc92[_0xc8e3('0x61')]))){_0x9a3d89=path[_0xc8e3('0x69')](config[_0xc8e3('0x6a')],_0xc8e3('0x73'),_0x5ecc92[_0xc8e3('0x61')]);}}return _0x474e27[_0xc8e3('0x74')](_0x9a3d89);}})['catch'](handleError(_0x474e27,null));};exports[_0xc8e3('0x75')]=function(_0x12c866,_0x52e286){var _0x3c050f=path[_0xc8e3('0x69')](config[_0xc8e3('0x6a')],_0xc8e3('0x76'));var _0x2f5e61={'where':{'id':_0x12c866[_0xc8e3('0x52')]['id']},'attributes':['id','customerAvatar',_0xc8e3('0x77')],'raw':!![]};return db[_0xc8e3('0x41')][_0xc8e3('0x4a')](_0x2f5e61)[_0xc8e3('0x24')](handleEntityNotFound(_0x52e286,null))[_0xc8e3('0x24')](function(_0x911c1a){if(_0x911c1a){if(!_[_0xc8e3('0x6e')](_0x911c1a['customerAvatar'])){if(fs[_0xc8e3('0x6f')](path[_0xc8e3('0x69')](config[_0xc8e3('0x6a')],_0xc8e3('0x73'),_0x911c1a[_0xc8e3('0x64')]))&&_0x911c1a['showCustomerAvatar']){_0x3c050f=path['join'](config[_0xc8e3('0x6a')],'server/files/images/avatars/',_0x911c1a[_0xc8e3('0x64')]);}}return _0x52e286['download'](_0x3c050f);}})[_0xc8e3('0x45')](handleError(_0x52e286,null));};exports['getSystemAvatar']=function(_0x404dfa,_0x8bea50){var _0x3f3131=path[_0xc8e3('0x69')](config[_0xc8e3('0x6a')],'server/files/images/avatars/system_avatar.png');var _0x5d5f89={'where':{'id':_0x404dfa['params']['id']},'attributes':['id','systemAvatar'],'raw':!![]};return db['ChatWebsite']['find'](_0x5d5f89)[_0xc8e3('0x24')](handleEntityNotFound(_0x8bea50,null))[_0xc8e3('0x24')](function(_0x4dda83){if(_0x4dda83){if(!_[_0xc8e3('0x6e')](_0x4dda83[_0xc8e3('0x67')])){if(fs[_0xc8e3('0x6f')](path['join'](config[_0xc8e3('0x6a')],'server/files/images/avatars/',_0x4dda83[_0xc8e3('0x67')]))){_0x3f3131=path['join'](config['root'],_0xc8e3('0x73'),_0x4dda83[_0xc8e3('0x67')]);}}return _0x8bea50[_0xc8e3('0x74')](_0x3f3131);}})['catch'](handleError(_0x8bea50,null));};exports[_0xc8e3('0x78')]=function(_0x360e78,_0xb3652e){var _0x2ae062=require(_0xc8e3('0x79'));var _0x6523b8=new _0x2ae062();var _0x3a2aa0=_0x6523b8[_0xc8e3('0x7a')](_0x360e78['headers']['user-agent'])[_0xc8e3('0x7b')]();var _0x16070d={'body':_0x360e78[_0xc8e3('0x4c')],'channel':'chat'};var _0x1f4f65=[];var _0x5e0361=[];var _0x1010ae={};var _0x380f57=![];return db['CmContact'][_0xc8e3('0x53')]()[_0xc8e3('0x24')](function(_0x373a9a){if(!_0x373a9a){throw new db[(_0xc8e3('0x7c'))][(_0xc8e3('0x7d'))](_0xc8e3('0x7e'));}_0x1f4f65=_['difference'](_[_0xc8e3('0x34')](_0x373a9a),[_0xc8e3('0x7f'),'updatedAt']);_0x5e0361=_[_0xc8e3('0x80')](_[_0xc8e3('0x34')](_0x373a9a),[_0xc8e3('0x7f'),_0xc8e3('0x81'),_0xc8e3('0x82'),_0xc8e3('0x83')]);if(_0x360e78[_0xc8e3('0x4c')]['id']){delete _0x360e78[_0xc8e3('0x4c')]['id'];}if(_['isNil'](_0x360e78['body'][_0xc8e3('0x84')])){throw new db['Sequelize'][(_0xc8e3('0x7d'))](_0xc8e3('0x85'));}if(_[_0xc8e3('0x6e')](_0x360e78[_0xc8e3('0x4c')][_0xc8e3('0x4c')])||_0x360e78[_0xc8e3('0x4c')][_0xc8e3('0x4c')]===''){throw new db[(_0xc8e3('0x7c'))]['ValidationError'](_0xc8e3('0x86'));}if(_[_0xc8e3('0x6e')](_0x360e78['body']['mapKey'])){throw new db[(_0xc8e3('0x7c'))]['ValidationError'](_0xc8e3('0x87')+_0x5e0361);}if(!_[_0xc8e3('0x88')](_0x5e0361,_0x360e78[_0xc8e3('0x4c')][_0xc8e3('0x89')])){throw new db['Sequelize'][(_0xc8e3('0x7d'))](_0xc8e3('0x8a')+_0x5e0361);}_0x1010ae[_0x360e78['body']['mapKey']]=_0x360e78[_0xc8e3('0x4c')][_0xc8e3('0x84')];})[_0xc8e3('0x24')](function(){return db[_0xc8e3('0x41')][_0xc8e3('0x4a')]({'where':{'id':_0x360e78['params']['id']},'include':[{'model':db[_0xc8e3('0x8b')],'as':_0xc8e3('0x8c'),'include':[{'model':db[_0xc8e3('0x8d')],'as':_0xc8e3('0x8e'),'where':_0x1010ae,'limit':0x1,'order':[['updatedAt',_0xc8e3('0x8f')]]}]},{'model':db[_0xc8e3('0x90')],'as':'Applications'}]});})[_0xc8e3('0x24')](handleEntityNotFound(_0xb3652e,null))['then'](function(_0x3b3320){if(_0x3b3320&&_0x3b3320[_0xc8e3('0x8c')]){_0x16070d[_0xc8e3('0x91')]=_0x3b3320;_0x16070d[_0xc8e3('0x92')]=_0x3b3320[_0xc8e3('0x93')];_0x16070d[_0xc8e3('0x94')]=_0x3b3320[_0xc8e3('0x8c')];_0x16070d[_0xc8e3('0x92')]=_['orderBy'](_0x16070d[_0xc8e3('0x92')],['priority'],['asc']);if(_0x16070d[_0xc8e3('0x91')]['Applications']){delete _0x16070d['account'][_0xc8e3('0x93')];}if(_0x16070d[_0xc8e3('0x91')][_0xc8e3('0x8c')]&&_0x16070d[_0xc8e3('0x91')][_0xc8e3('0x8c')][_0xc8e3('0x8e')]['length']){return _0x16070d[_0xc8e3('0x91')][_0xc8e3('0x8c')]['Contacts'][0x0];}var _0xa4aee8=_[_0xc8e3('0x9')](_0x360e78[_0xc8e3('0x4c')],{'firstName':_0x360e78['body'][_0xc8e3('0x84')],'ListId':_0x3b3320[_0xc8e3('0x83')]});_0xa4aee8[_0x360e78[_0xc8e3('0x4c')]['mapKey']]=_0x360e78['body'][_0xc8e3('0x84')];return db[_0xc8e3('0x8d')][_0xc8e3('0x4b')](_0xa4aee8,{'fields':_0x1f4f65,'raw':!![]});}})[_0xc8e3('0x24')](handleEntityNotFound(_0xb3652e,null))[_0xc8e3('0x24')](function(_0x28ebe2){_0x16070d[_0xc8e3('0x95')]=_0x28ebe2;var _0x39b023=_0x360e78['body']['customerIp'];if(_0x360e78[_0xc8e3('0x96')][_0xc8e3('0x97')]){_0x39b023=_0x360e78['headers'][_0xc8e3('0x97')];}else if(_0x360e78['headers'][_0xc8e3('0x98')]){_0x39b023=_['first'](_0x360e78['headers']['x-forwarded-for'][_0xc8e3('0x99')](','));}if(_0x28ebe2){var _0x225eb0={'ContactId':_0x28ebe2['id'],'ChatWebsiteId':_0x360e78[_0xc8e3('0x52')]['id'],'from':(_0x28ebe2[_0xc8e3('0x9a')]||'')+'\x20'+(_0x28ebe2[_0xc8e3('0x9b')]||''),'customerIp':_0x39b023,'customerPort':_0x360e78[_0xc8e3('0x96')][_0xc8e3('0x9c')]?_0x360e78[_0xc8e3('0x96')][_0xc8e3('0x9c')]:null,'referer':_0x360e78[_0xc8e3('0x4c')]['referer'],'browserName':_0x3a2aa0[_0xc8e3('0x9d')][_0xc8e3('0x2b')]&&_0x3a2aa0[_0xc8e3('0x9d')][_0xc8e3('0x9e')]?util[_0xc8e3('0x9f')](_0xc8e3('0xa0'),_0x3a2aa0['browser'][_0xc8e3('0x2b')],_0x3a2aa0['browser'][_0xc8e3('0x9e')]):_0xc8e3('0xa1'),'browserVersion':_0x3a2aa0[_0xc8e3('0x9d')][_0xc8e3('0x9e')]||_0xc8e3('0xa1'),'osName':util['format'](_0xc8e3('0xa0'),_0x3a2aa0['os']['name'],_0x3a2aa0['os']['version']),'osVersion':_0x3a2aa0['os'][_0xc8e3('0x9e')],'deviceModel':_0x3a2aa0['device'][_0xc8e3('0x32')]&&_0x3a2aa0[_0xc8e3('0xa2')][_0xc8e3('0xa3')]?util[_0xc8e3('0x9f')](_0xc8e3('0xa4'),_0x3a2aa0[_0xc8e3('0xa2')]['model'],_0x3a2aa0['device'][_0xc8e3('0xa3')],_0x3a2aa0[_0xc8e3('0xa2')][_0xc8e3('0x31')]):null,'deviceVendor':_0x3a2aa0['device']['vendor'],'deviceType':_0x3a2aa0['device'][_0xc8e3('0x31')],'formData':JSON[_0xc8e3('0x16')](_0x360e78[_0xc8e3('0x4c')])};var _0x2e9a4f={'ChatWebsiteId':_0x360e78[_0xc8e3('0x52')]['id'],'closed':![]};if(_0x360e78[_0xc8e3('0x4c')]['threadId']){_0x2e9a4f['threadId']=_0x360e78[_0xc8e3('0x4c')][_0xc8e3('0xa5')];return db['ChatInteraction']['find']({'where':_0x2e9a4f})[_0xc8e3('0x24')](function(_0x5e12d4){if(_0x5e12d4){return[_0x5e12d4,![]];}_0x225eb0['threadId']=_0x360e78[_0xc8e3('0x4c')][_0xc8e3('0xa5')];_0x225eb0[_0xc8e3('0xa6')]=_0x360e78[_0xc8e3('0x4c')][_0xc8e3('0xa6')];return db[_0xc8e3('0xa7')][_0xc8e3('0x4b')](_0x225eb0)['then'](function(_0x4d278c){return[_0x4d278c,!![]];});});}_0x2e9a4f['ContactId']=_0x28ebe2['id'];if(_0x360e78[_0xc8e3('0x4c')]['interaction']&&_0x360e78[_0xc8e3('0x4c')]['interaction']['id']){_0x2e9a4f['id']=_0x360e78[_0xc8e3('0x4c')]['interaction']['id'];return db[_0xc8e3('0xa7')][_0xc8e3('0x4a')]({'where':_0x2e9a4f})[_0xc8e3('0x24')](function(_0x53f208){if(_0x53f208){return[_0x53f208,![]];}return db[_0xc8e3('0xa7')][_0xc8e3('0x4b')](_0x225eb0)['then'](function(_0x534e87){return[_0x534e87,!![]];});});}return db[_0xc8e3('0xa7')][_0xc8e3('0x4b')](_0x225eb0)[_0xc8e3('0x24')](function(_0x511fe8){return[_0x511fe8,!![]];});}})[_0xc8e3('0xa8')](function(_0x1d8b68,_0x4eef2c){if(_0x1d8b68){_0x380f57=_0x4eef2c;if(!_0x4eef2c){var _0x466368={'from':(_0x16070d[_0xc8e3('0x95')]['firstName']||'')+'\x20'+(_0x16070d[_0xc8e3('0x95')]['lastName']||'')};if(_0x360e78[_0xc8e3('0x4c')]['threadId']&&_0x360e78['body']['messageId']&&_0x360e78[_0xc8e3('0x4c')][_0xc8e3('0xa5')]!=_0x360e78['body'][_0xc8e3('0xa9')]){_0x466368['threadId']=_0x360e78['body']['messageId'];}return _0x1d8b68[_0xc8e3('0x51')](_0x466368);}else{return _0x1d8b68;}}})[_0xc8e3('0x24')](function(_0x4d1f65){_0x16070d[_0xc8e3('0xaa')]=_0x4d1f65[_0xc8e3('0x26')]({'plain':!![]});_0x16070d[_0xc8e3('0xaa')][_0xc8e3('0xab')]=_0x380f57;if(_0x16070d[_0xc8e3('0xaa')][_0xc8e3('0xab')]){if(_0x16070d['account']['autoclose']){_0x16070d[_0xc8e3('0x92')][_0xc8e3('0xac')]({'id':0x0,'priority':_0x16070d[_0xc8e3('0x92')][_0xc8e3('0x48')]+0x1,'app':_0xc8e3('0xad'),'appdata':_0xc8e3('0xae'),'interval':_0xc8e3('0xaf')});}}return db[_0xc8e3('0xb0')]['create']({'body':_0x360e78[_0xc8e3('0x4c')][_0xc8e3('0x4c')],'ChatWebsiteId':_0x360e78[_0xc8e3('0x52')]['id'],'ChatInteractionId':_0x4d1f65['id'],'direction':'in','ContactId':_0x16070d[_0xc8e3('0x95')]['id'],'AttachmentId':_0x360e78[_0xc8e3('0x4c')][_0xc8e3('0xb1')]});})[_0xc8e3('0x24')](function(_0x3148a8){_0x16070d[_0xc8e3('0x19')]=_0x3148a8;if(_0x16070d[_0xc8e3('0xaa')]['UserId']){return db['User'][_0xc8e3('0x4a')]({'attributes':['id',_0xc8e3('0x2b')],'where':{'id':_0x16070d['interaction'][_0xc8e3('0xb2')]}})[_0xc8e3('0x24')](function(_0x2d152){if(_0x2d152){_0x16070d[_0xc8e3('0x92')][_0xc8e3('0xb3')]({'id':0x0,'priority':0x0,'app':_0xc8e3('0xb4'),'appdata':_0x2d152[_0xc8e3('0x2b')]+','+(_0x16070d[_0xc8e3('0x91')][_0xc8e3('0xb5')]||0xa),'interval':'*,*,*,*'});_0x16070d['forcedOwnership']=!![];}return respondWithRpcPromise(_0xc8e3('0xb6'),'startRouting',_0x16070d);});}return respondWithRpcPromise(_0xc8e3('0xb6'),'startRouting',_0x16070d);})[_0xc8e3('0x24')](function(_0x6d3afb){respondWithRpcPromise(_0xc8e3('0xb7'),_0xc8e3('0xb7'),{'event':_0xc8e3('0x78'),'message':_0x6d3afb},client9002);return _0x6d3afb;})['then'](respondWithResult(_0xb3652e,null))['catch'](handleError(_0xb3652e,null));};exports[_0xc8e3('0xb8')]=function(_0x41ed50,_0x593458){var _0x3044f2,_0x2f57cf,_0x4a8dd0;var _0x5708b7=[];var _0x25eb3a={};var _0x9c5dfa=_0x41ed50[_0xc8e3('0xb9')]||[];var _0x2d2053=[];var _0x4d751e;return db['CmContact']['describe']()[_0xc8e3('0x24')](function(_0x40ef4c){if(!_0x40ef4c){throw new db[(_0xc8e3('0x7c'))][(_0xc8e3('0x7d'))](_0xc8e3('0x7e'));}_0x5708b7=_[_0xc8e3('0x80')](_[_0xc8e3('0x34')](_0x40ef4c),[_0xc8e3('0x7f'),_0xc8e3('0x81'),_0xc8e3('0x82'),_0xc8e3('0x83')]);if(_0x41ed50[_0xc8e3('0x4c')]['id']){delete _0x41ed50[_0xc8e3('0x4c')]['id'];}if(_['isNil'](_0x41ed50[_0xc8e3('0x4c')]['from'])){throw _0x593458[_0xc8e3('0x1b')](0x1f4)[_0xc8e3('0xba')](new db[(_0xc8e3('0x7c'))]['ValidationError'](_0xc8e3('0x85')));}if(_['isNil'](_0x41ed50['body']['body'])||_0x41ed50[_0xc8e3('0x4c')][_0xc8e3('0x4c')]===''){throw _0x593458['status'](0x1f4)[_0xc8e3('0xba')](new db[(_0xc8e3('0x7c'))][(_0xc8e3('0x7d'))](_0xc8e3('0x86')));}if(_[_0xc8e3('0x6e')](_0x41ed50['body'][_0xc8e3('0xbb')])){throw _0x593458[_0xc8e3('0x1b')](0x1f4)[_0xc8e3('0xba')](new db[(_0xc8e3('0x7c'))][(_0xc8e3('0x7d'))](_0xc8e3('0xbc')+_0x5708b7));}if(!_[_0xc8e3('0x88')](_0x5708b7,_0x41ed50[_0xc8e3('0x4c')][_0xc8e3('0xbb')])){throw _0x593458[_0xc8e3('0x1b')](0x1f4)['send'](new db['Sequelize'][(_0xc8e3('0x7d'))](_0xc8e3('0xbd')+_0x5708b7));}_0x25eb3a[_0x41ed50['body'][_0xc8e3('0xbb')]]=_0x41ed50['body'][_0xc8e3('0x84')];})[_0xc8e3('0x24')](function(){return db[_0xc8e3('0x41')]['find']({'where':{'id':_0x41ed50[_0xc8e3('0x52')]['id']},'include':[{'model':db[_0xc8e3('0x8b')],'as':'List'},{'model':db[_0xc8e3('0xbe')],'as':_0xc8e3('0xbe')}]});})['then'](handleEntityNotFound(_0x593458,null))[_0xc8e3('0x24')](function(_0x3aef10){if(_0x3aef10&&_0x3aef10[_0xc8e3('0x8c')]){_0x2f57cf=_0x3aef10;var _0x3fec45=_[_0xc8e3('0x9')](_0x41ed50[_0xc8e3('0x4c')],{'firstName':_0x41ed50[_0xc8e3('0x4c')][_0xc8e3('0x84')],'phone':_0x41ed50[_0xc8e3('0x4c')][_0xc8e3('0x84')],'ListId':_0x3aef10[_0xc8e3('0x83')]});_0x3fec45[_0x41ed50['body'][_0xc8e3('0xbb')]]=_0x41ed50[_0xc8e3('0x4c')][_0xc8e3('0x84')];return db[_0xc8e3('0x8d')][_0xc8e3('0xbf')]({'where':_0x25eb3a,'defaults':_0x3fec45});}})[_0xc8e3('0xa8')](function(_0xd34e2b){if(_0xd34e2b){_0x4a8dd0=_0xd34e2b;var _0x1640d0=fs['readFileSync'](path[_0xc8e3('0x69')](config[_0xc8e3('0x6a')],_0xc8e3('0xc0')),_0xc8e3('0xc1'));var _0x220fe1=ejs[_0xc8e3('0xc2')](_0x1640d0,{'body':_['toPairs'](_0x41ed50['body'][_0xc8e3('0x4c')]),'bodyTitle':_0x2f57cf[_0xc8e3('0xc3')]});return db['ChatOfflineMessage']['create']({'body':_0x220fe1,'plainBody':htmlToText[_0xc8e3('0xc4')](_0x220fe1),'ContactId':_0xd34e2b['id'],'ChatWebsiteId':_0x2f57cf['id']});}})[_0xc8e3('0x24')](function(_0x4e5a87){_0x4d751e=_0x4e5a87;if(_0x9c5dfa[_0xc8e3('0x48')]){var _0x5b27b4=_0x9c5dfa[_0xc8e3('0x2e')](function(_0xd9694d){return{'name':_0xd9694d[_0xc8e3('0xc5')],'basename':_0xd9694d[_0xc8e3('0x65')],'type':_0xd9694d[_0xc8e3('0xc6')],'ChatOfflineMessageId':_0x4e5a87['id']};});_0x2d2053=_0x5b27b4[_0xc8e3('0x2e')](_0x633abb=>{var _0x584048={'filename':_0x633abb[_0xc8e3('0x2b')],'path':path[_0xc8e3('0x69')](config['root'],_0xc8e3('0xc7'),_0xc8e3('0xb9'),_0xc8e3('0xc8'),_0xc8e3('0xc9'),_0x633abb['basename'])};return _0x584048;});if(!_0x2f57cf[_0xc8e3('0xca')]){return db['sequelize'][_0xc8e3('0xcb')](function(_0x196f5e){return db['Attachment'][_0xc8e3('0xcc')](_0x5b27b4,{'transaction':_0x196f5e});});}}})[_0xc8e3('0x24')](function(){if(_0x4d751e){_0x3044f2=_0x4d751e;return db[_0xc8e3('0xbe')][_0xc8e3('0x56')]({'where':{'service':!![]},'include':[{'model':db['MailServerOut'],'as':_0xc8e3('0xcd'),'raw':!![],'include':[{'model':db['CloudProvider'],'as':_0xc8e3('0xce'),'raw':!![]}]}]});}})['then'](function(_0x11ec00){if(_0x11ec00&&_0x11ec00[_0xc8e3('0xcd')]&&_0x2f57cf[_0xc8e3('0xcf')]&&_0x2f57cf[_0xc8e3('0xd0')]){var _0x375e1a=_0x11ec00[_0xc8e3('0xd1')]();return respondWithRpcPromise(_0xc8e3('0xd2'),_0xc8e3('0xd3'),{'account':_0x375e1a,'message':{'from':util['format'](_0xc8e3('0xd4'),_0x11ec00[_0xc8e3('0x2b')],_0x11ec00['email']||_0x11ec00['Smtp'][_0xc8e3('0x4d')]),'to':_0x2f57cf[_0xc8e3('0xd0')],'subject':_0x2f57cf[_0xc8e3('0xd5')],'html':_0x3044f2['body'],'attachments':_0x2d2053}},client9003)[_0xc8e3('0x24')](function(){return _0x3044f2;})[_0xc8e3('0x45')](function(_0x23cde1){logger[_0xc8e3('0x17')](_0x23cde1);});}})['then'](function(){if(_0x2f57cf&&_0x2f57cf[_0xc8e3('0xca')]&&_0x2f57cf['MailAccountId']){var _0x33e778=[];if(_0x9c5dfa[_0xc8e3('0x48')]){_0x33e778=_0x9c5dfa['map'](function(_0x1e5e9e){return{'name':_0x1e5e9e[_0xc8e3('0xc5')],'basename':_0x1e5e9e['filename'],'type':_0x1e5e9e[_0xc8e3('0xc6')],'ChatOfflineMessageId':_0x4d751e['id']};});}var _0x48ff90;if(!_[_0xc8e3('0x6e')](_0x2f57cf[_0xc8e3('0xd6')])){var _0xc097aa=_['map'](_0x41ed50[_0xc8e3('0x4c')],function(_0x4c487c){return _0x4c487c;});var _0x385906=_[_0xc8e3('0xd7')](_0xc097aa)[0x0];var _0x1a4ceb=_[_0xc8e3('0xd8')](_0x385906,function(_0x4bc97e){return _0x4bc97e;});_0x48ff90=_0x1a4ceb[0x1][_0x2f57cf[_0xc8e3('0xd6')]];}var _0x376000={'from':_0x4a8dd0[_0xc8e3('0xd9')],'firstName':_0x4a8dd0[_0xc8e3('0x9a')],'lastName':_0x4a8dd0['lastName'],'mapKey':_0xc8e3('0xd9'),'message':{'from':_0x4a8dd0[_0xc8e3('0xd9')],'to':_0x2f57cf[_0xc8e3('0xbe')]['email'],'cc':'','subject':_['isNil'](_0x48ff90)?_0x2f57cf[_0xc8e3('0xd5')]:_0x48ff90,'messageId':'','sentAt':new Date(),'attach':_0x33e778[_0xc8e3('0x48')],'attachments':_0x33e778,'originChannel':_0xc8e3('0xda'),'ChatWebsiteId':_0x2f57cf['id'],'ChatOfflineMessageId':_0x3044f2['id'],'originTo':_0x2f57cf[_0xc8e3('0xbe')][_0xc8e3('0xd9')]},'body':_0x3044f2['body']};var _0xdd9ed7={'account':{'id':_0x2f57cf[_0xc8e3('0xdb')]},'body':_0x376000,'log':_0xc8e3('0xdc')};return respondWithRpcPromise(_0xc8e3('0xdc'),_0xc8e3('0xdd'),_0xdd9ed7,client9001)['then'](function(){return _0x3044f2;})['catch'](function(_0x4f586c){logger[_0xc8e3('0x17')](_0x4f586c);});}return;})['then'](function(){if(_0x3044f2){return _0x3044f2;}})['then'](respondWithResult(_0x593458,null))[_0xc8e3('0x45')](function(_0x96f5f0){logger['error']('catch',_0x96f5f0);for(var _0x3c9cd9 of _0x9c5dfa){var _0x8a5573=path[_0xc8e3('0x69')](config[_0xc8e3('0x6a')],_0xc8e3('0xc7'),'files',_0xc8e3('0xc8'),_0xc8e3('0xc9'),_0x3c9cd9[_0xc8e3('0x65')]);fs_extra[_0xc8e3('0xde')](_0x8a5573)[_0xc8e3('0x45')](function(_0x39416d){logger[_0xc8e3('0x17')](_0xc8e3('0xdf'),_0x8a5573,_0x39416d);});}});};exports[_0xc8e3('0xe0')]=function(_0x175dbe,_0x6fb923){return db[_0xc8e3('0xa7')][_0xc8e3('0x4a')]({'where':{'id':_0x175dbe[_0xc8e3('0x52')]['id']}})[_0xc8e3('0x24')](handleEntityNotFound(_0x6fb923,null))[_0xc8e3('0x24')](function(_0x3ced1f){if(_0x3ced1f){return _0x3ced1f['addInteraction'](_0x175dbe[_0xc8e3('0x4c')]['ids'],_['omit'](_0x175dbe['body'],[_0xc8e3('0x5d'),'id'])||{});}})[_0xc8e3('0x24')](respondWithResult(_0x6fb923,null))['catch'](handleError(_0x6fb923,null));};exports[_0xc8e3('0xe1')]=function(_0x3ec7ba,_0x291438){var _0x3b79d6={'raw':![],'where':{}};var _0x339d0e={};var _0x35aaff={'count':0x0,'rows':[]};return db[_0xc8e3('0x41')][_0xc8e3('0x56')]({'where':{'id':_0x3ec7ba[_0xc8e3('0x52')]['id']}})[_0xc8e3('0x24')](handleEntityNotFound(_0x291438,null))[_0xc8e3('0x24')](function(_0x39cbe2){if(_0x39cbe2){_0x339d0e[_0xc8e3('0x32')]=_[_0xc8e3('0x34')](db[_0xc8e3('0xa7')][_0xc8e3('0x2f')]);_0x339d0e[_0xc8e3('0x33')]=_['keys'](_0x3ec7ba[_0xc8e3('0x33')]);_0x339d0e['filters']=_[_0xc8e3('0x36')](_0x339d0e[_0xc8e3('0x32')],_0x339d0e[_0xc8e3('0x33')]);_0x3b79d6[_0xc8e3('0x37')]=_[_0xc8e3('0x36')](_0x339d0e[_0xc8e3('0x32')],qs[_0xc8e3('0x38')](_0x3ec7ba[_0xc8e3('0x33')][_0xc8e3('0x38')]));_0x3b79d6[_0xc8e3('0x37')]=_0x3b79d6[_0xc8e3('0x37')][_0xc8e3('0x48')]?_0x3b79d6[_0xc8e3('0x37')]:_0x339d0e['model'];if(!_0x3ec7ba[_0xc8e3('0x33')]['hasOwnProperty'](_0xc8e3('0x3a'))){_0x3b79d6['limit']=qs[_0xc8e3('0x20')](_0x3ec7ba[_0xc8e3('0x33')][_0xc8e3('0x20')]);_0x3b79d6[_0xc8e3('0x1e')]=qs[_0xc8e3('0x1e')](_0x3ec7ba[_0xc8e3('0x33')][_0xc8e3('0x1e')]);}_0x3b79d6[_0xc8e3('0x3b')]=qs[_0xc8e3('0x3c')](_0x3ec7ba[_0xc8e3('0x33')][_0xc8e3('0x3c')]);_0x3b79d6[_0xc8e3('0x3d')]=qs[_0xc8e3('0x35')](_[_0xc8e3('0x57')](_0x3ec7ba['query'],_0x339d0e[_0xc8e3('0x35')]));_0x3b79d6['where'][_0xc8e3('0x54')]=_0x39cbe2['id'];if(_0x3ec7ba[_0xc8e3('0x33')]['filter']){_0x3b79d6[_0xc8e3('0x3d')]=_[_0xc8e3('0x3f')](_0x3b79d6[_0xc8e3('0x3d')],{'$or':_['map'](_0x3b79d6[_0xc8e3('0x37')],function(_0x4392fa){var _0x5b638e={};_0x5b638e[_0x4392fa]={'$like':'%'+_0x3ec7ba['query'][_0xc8e3('0x3e')]+'%'};return _0x5b638e;})});}_0x3b79d6=_[_0xc8e3('0x3f')]({},_0x3b79d6,_0x3ec7ba[_0xc8e3('0x40')]);return db[_0xc8e3('0xa7')][_0xc8e3('0x21')]({'where':_0x3b79d6[_0xc8e3('0x3d')]})['then'](function(_0x7b62e7){_0x35aaff[_0xc8e3('0x21')]=_0x7b62e7;if(_0x3ec7ba[_0xc8e3('0x33')][_0xc8e3('0x49')]){_0x3b79d6[_0xc8e3('0x42')]=[{'model':db[_0xc8e3('0x8d')],'as':_0xc8e3('0xe2'),'required':![]},{'model':db[_0xc8e3('0xe3')],'as':_0xc8e3('0xe4'),'attributes':[_0xc8e3('0x2b'),_0xc8e3('0xe5'),'internal'],'required':![]},{'model':db['Tag'],'as':_0xc8e3('0xe6'),'attributes':['id','name',_0xc8e3('0xe7')],'where':_0x3ec7ba[_0xc8e3('0x33')][_0xc8e3('0xe8')]?{'id':_0x3ec7ba[_0xc8e3('0x33')][_0xc8e3('0xe8')]}:undefined,'required':_0x3ec7ba['query'][_0xc8e3('0xe8')]?!![]:![]}];}return db['ChatInteraction']['findAll'](_0x3b79d6);})[_0xc8e3('0x24')](function(_0x20ee28){_0x35aaff[_0xc8e3('0x44')]=_0x20ee28;return _0x35aaff;});}})['then'](respondWithFilteredResult(_0x291438,_0x3b79d6))[_0xc8e3('0x45')](handleError(_0x291438,null));};function iftimePromise(_0x1703bf,_0x5f11e8){return respondWithRpcPromise(_0xc8e3('0xe9'),'getSnippet',{'command':_0x5f11e8[_0xc8e3('0xea')]?util['format'](_0xc8e3('0xeb'),_0x1703bf[_0xc8e3('0xec')],_0x5f11e8[_0xc8e3('0xea')]):util[_0xc8e3('0x9f')](_0xc8e3('0xed'),_0x1703bf[_0xc8e3('0xec')])},client9002)[_0xc8e3('0x24')](function(_0x584ba9){var _0x3673b0=_0x584ba9&&_0x584ba9['indexOf'](_0xc8e3('0xee'))>=0x0?!![]:![];logger['info']('[%s][INTERVAL][%s]\x20%s\x20%s\x20(%s)',_0x5f11e8['id'],_0x1703bf['id'],_0x1703bf['interval'],_0x3673b0?_0xc8e3('0xef'):_0xc8e3('0xf0'),_0x5f11e8[_0xc8e3('0xea')]?_0x5f11e8[_0xc8e3('0xea')]:_0xc8e3('0xf1'));return _0x3673b0;})[_0xc8e3('0x45')](function(_0x36793f){logger[_0xc8e3('0x17')](_0xc8e3('0xf2'),_0x5f11e8['id'],_0x1703bf['id'],_0x1703bf['interval'],util[_0xc8e3('0xf3')](_0x36793f,{'showHidden':![],'depth':null}),_0x5f11e8[_0xc8e3('0xea')]?_0x5f11e8[_0xc8e3('0xea')]:_0xc8e3('0xf1'));return![];});}exports[_0xc8e3('0xf4')]=function(_0x478942,_0x103006){var _0x183c46=0x0;var _0x169653=0x0;var _0x598d3=![];var _0x233393;var _0x383224;return db[_0xc8e3('0x41')]['find']({'where':{'id':_0x478942[_0xc8e3('0x52')]['id']},'include':[{'model':db[_0xc8e3('0xf5')],'as':_0xc8e3('0xf5'),'include':[{'model':db[_0xc8e3('0xf5')],'as':_0xc8e3('0xf6'),'attributes':['id','interval'],'raw':!![]}]}]})[_0xc8e3('0x24')](handleEntityNotFound(_0x103006,null))[_0xc8e3('0x24')](function(_0x778e51){if(_0x778e51){_0x233393=_0x778e51;return _0x778e51[_0xc8e3('0xf7')]({'raw':!![]});}})[_0xc8e3('0x24')](function(_0x45adf8){if(_0x233393){if(_0x45adf8){_0x383224=_0x45adf8;}}return require('../../config/license/util')[_0xc8e3('0x6c')]();})['then'](function(_0x1d0a34){if(_0x1d0a34){_0x169653=_0x1d0a34[_0xc8e3('0xf8')];_0x598d3=_0x1d0a34[_0xc8e3('0x6d')];}})['then'](function(){return db[_0xc8e3('0xa7')]['count']({'where':{'closed':![]}});})[_0xc8e3('0x24')](function(_0x2eae2e){_0x183c46=_0x2eae2e;if(_0x169653&&_0x2eae2e>_0x169653){return db[_0xc8e3('0xf9')]['findOne']({'where':{'id':0x1}})[_0xc8e3('0x24')](function(_0x3f5929){if(_0x3f5929){_0x3f5929[_0xc8e3('0xfa')](_0xc8e3('0xfb'));}});}})[_0xc8e3('0x24')](function(){if(_0x233393[_0xc8e3('0xf5')]&&_0x233393[_0xc8e3('0xf5')][_0xc8e3('0xf6')]){var _0x515d40=[];for(var _0x101f23=0x0;_0x101f23<_0x233393[_0xc8e3('0xf5')]['Intervals']['length'];_0x101f23++){var _0x11b352=_0x233393[_0xc8e3('0xf5')][_0xc8e3('0xf6')][_0x101f23][_0xc8e3('0x26')]({'plain':!![]});_0x515d40['push'](iftimePromise(_0x11b352,_0x233393));}return BPromise['all'](_0x515d40)[_0xc8e3('0x24')](function(_0x44d6fb){return _[_0xc8e3('0xfc')](_0x44d6fb);});}else{return!![];}})[_0xc8e3('0x24')](function(_0x28ff9d){var _0x31763d=fs[_0xc8e3('0xfd')](path[_0xc8e3('0x69')](config[_0xc8e3('0x6a')],'server/files/chat/iframe.ejs'),_0xc8e3('0xc1'));var _0x1d97d2=new url[(_0xc8e3('0xfe'))](_0x233393['address'])[_0xc8e3('0xff')];var _0x10bc82='3.1.0';var _0x2bf265=![];var _0x5114d8={'chatVersion':_0x10bc82,'chatWebsiteAddressOrigin':_0x1d97d2,'remote':_0x233393['remote'],'query':querystring['stringify'](_[_0xc8e3('0x3f')](_0x233393[_0xc8e3('0x26')]({'plain':!![]}),{'customerIp':_0x478942[_0xc8e3('0x96')]['x-forwarded-for']||_0x478942['headers']['x-real-ip']||_0x478942[_0xc8e3('0x100')][_0xc8e3('0x101')]||_0x478942['ip'],'referer':_0x478942['headers'][_0xc8e3('0x102')],'openedInteractions':_0x183c46,'maxInteractions':_0x169653,'virtual':_0x598d3['virtual'],'online':_0x28ff9d,'custom':_0x598d3}))[_0xc8e3('0x103')](/'/g,'\x5c\x27')};_0x103006['send'](ejs[_0xc8e3('0xc2')](Mustache[_0xc8e3('0xc2')](_0x31763d,_0x5114d8),{'proactiveActions':_0x383224,'alignment':_0x233393['alignment'],'verticalAlignment':_0x233393[_0xc8e3('0x104')],'div_color':_0x233393[_0xc8e3('0xe7')],'labelText':_0x233393[_0xc8e3('0x105')],'text_color':_0x233393[_0xc8e3('0x106')],'text_button_color':_0x233393['textButtonColor'],'button_color':_0x233393['color_button'],'background_color':_0x233393[_0xc8e3('0x107')],'hideWhenOffline':_0x233393[_0xc8e3('0x108')],'intervalId':_0x233393[_0xc8e3('0x109')],'isDevelopment':_0x2bf265,'chatVersion':_0x10bc82}));})[_0xc8e3('0x45')](handleError(_0x103006,null));};exports[_0xc8e3('0x10a')]=function(_0xb991e3,_0x966688){var _0x4b7041=_0xb991e3[_0xc8e3('0x52')]['id'];var _0x16b53b=_0xb991e3['body'];var _0x2f125b=0xc8;var _0x42963b=null;return db[_0xc8e3('0x10b')][_0xc8e3('0xcb')]({'isolationLevel':db[_0xc8e3('0x10b')][_0xc8e3('0x10c')][_0xc8e3('0x10d')][_0xc8e3('0x10e')]},function(_0x4ddb9a){return db['ChatWebsite'][_0xc8e3('0x56')]({'where':{'id':_0x4b7041},'transaction':_0x4ddb9a})[_0xc8e3('0x24')](function(_0x594189){if(_0x594189){return db[_0xc8e3('0x90')][_0xc8e3('0x25')]({'where':{'ChatWebsiteId':_0x4b7041},'transaction':_0x4ddb9a})['then'](function(){var _0x52bd0f=_[_0xc8e3('0x2e')](_0x16b53b,function(_0x22a05f){_0x22a05f[_0xc8e3('0x54')]=_0x4b7041;return _0x22a05f;});return db[_0xc8e3('0x90')][_0xc8e3('0xcc')](_0x52bd0f,{'transaction':_0x4ddb9a});});}else{_0x2f125b=0x194;_0x42963b=[];}});})[_0xc8e3('0x24')](function(){if(_0x2f125b!==0x194){return db['ChatApplication'][_0xc8e3('0x10f')]({'where':{'ChatWebsiteId':_0x4b7041},'order':_0xc8e3('0x110')})['then'](function(_0x3d02c7){_0x42963b=_0x3d02c7;});}})['catch'](function(_0x396f0b){_0x2f125b=0x1f4;logger['error'](_0x396f0b[_0xc8e3('0x2a')]);if(_0x396f0b[_0xc8e3('0x2b')]){delete _0x396f0b[_0xc8e3('0x2b')];}_0x42963b=_0x396f0b;})[_0xc8e3('0x111')](function(){if(_0x42963b===null){_0x966688['sendStatus'](_0x2f125b);}else{if(_0x2f125b===0x1f4){_0x966688[_0xc8e3('0x1b')](_0x2f125b)[_0xc8e3('0xba')](_0x42963b);}else{_0x966688[_0xc8e3('0x1b')](_0x2f125b)['json'](_0x42963b);}}});};exports[_0xc8e3('0x112')]=function(_0x2d0b54,_0x35cc86){var _0x24dea8={};var _0x515cc9={};var _0x3fc185;var _0x29eea9;return db[_0xc8e3('0x41')]['findOne']({'where':{'id':_0x2d0b54[_0xc8e3('0x52')]['id']}})['then'](handleEntityNotFound(_0x35cc86,null))[_0xc8e3('0x24')](function(_0x4173d4){if(_0x4173d4){_0x3fc185=_0x4173d4;_0x515cc9[_0xc8e3('0x32')]=_['keys'](db['ChatApplication']['rawAttributes']);_0x515cc9[_0xc8e3('0x33')]=_['keys'](_0x2d0b54[_0xc8e3('0x33')]);_0x515cc9[_0xc8e3('0x35')]=_[_0xc8e3('0x36')](_0x515cc9[_0xc8e3('0x32')],_0x515cc9[_0xc8e3('0x33')]);_0x24dea8['attributes']=_[_0xc8e3('0x36')](_0x515cc9[_0xc8e3('0x32')],qs[_0xc8e3('0x38')](_0x2d0b54[_0xc8e3('0x33')][_0xc8e3('0x38')]));_0x24dea8['attributes']=_0x24dea8[_0xc8e3('0x37')][_0xc8e3('0x48')]?_0x24dea8['attributes']:_0x515cc9['model'];_0x24dea8[_0xc8e3('0x3b')]=qs[_0xc8e3('0x3c')](_0x2d0b54['query'][_0xc8e3('0x3c')]);_0x24dea8[_0xc8e3('0x3d')]=qs[_0xc8e3('0x35')](_[_0xc8e3('0x57')](_0x2d0b54[_0xc8e3('0x33')],_0x515cc9[_0xc8e3('0x35')]));if(_0x2d0b54['query'][_0xc8e3('0x3e')]){_0x24dea8['where']=_[_0xc8e3('0x3f')](_0x24dea8['where'],{'$or':_[_0xc8e3('0x2e')](_0x24dea8[_0xc8e3('0x37')],function(_0x506f2b){var _0x18a104={};_0x18a104[_0x506f2b]={'$like':'%'+_0x2d0b54['query']['filter']+'%'};return _0x18a104;})});}_0x24dea8=_['merge']({},_0x24dea8,_0x2d0b54[_0xc8e3('0x40')]);return _0x3fc185[_0xc8e3('0x112')](_0x24dea8);}})[_0xc8e3('0x24')](function(_0x45ee75){if(_0x45ee75){_0x29eea9=_0x45ee75[_0xc8e3('0x48')];if(!_0x2d0b54['query'][_0xc8e3('0x39')](_0xc8e3('0x3a'))){_0x24dea8['limit']=qs[_0xc8e3('0x20')](_0x2d0b54[_0xc8e3('0x33')]['limit']);_0x24dea8[_0xc8e3('0x1e')]=qs[_0xc8e3('0x1e')](_0x2d0b54[_0xc8e3('0x33')][_0xc8e3('0x1e')]);}return _0x3fc185[_0xc8e3('0x112')](_0x24dea8);}})[_0xc8e3('0x24')](function(_0x18edae){if(_0x18edae){return _0x18edae?{'count':_0x29eea9,'rows':_0x18edae}:null;}})[_0xc8e3('0x24')](respondWithResult(_0x35cc86,null))[_0xc8e3('0x45')](handleError(_0x35cc86,null));};exports[_0xc8e3('0x113')]=function(_0x51e590,_0x576129){return db['chatProactiveAction'][_0xc8e3('0x4a')]({'where':{'id':_0x51e590['params']['id']}})['then'](handleEntityNotFound(_0x576129,null))[_0xc8e3('0x24')](function(_0xeedfe7){if(_0xeedfe7){return _0xeedfe7[_0xc8e3('0x113')](_0x51e590[_0xc8e3('0x4c')]['ids'],_[_0xc8e3('0x114')](_0x51e590[_0xc8e3('0x4c')],[_0xc8e3('0x5d'),'id'])||{});}})['then'](respondWithResult(_0x576129,null))[_0xc8e3('0x45')](handleError(_0x576129,null));};exports[_0xc8e3('0xf7')]=function(_0x3639ba,_0x3e8f41){var _0x4f6293={};var _0x2839d1={};var _0xe846a5;var _0x1d8b5f;return db[_0xc8e3('0x41')][_0xc8e3('0x56')]({'where':{'id':_0x3639ba[_0xc8e3('0x52')]['id']}})[_0xc8e3('0x24')](handleEntityNotFound(_0x3e8f41,null))[_0xc8e3('0x24')](function(_0x3a28ad){if(_0x3a28ad){_0xe846a5=_0x3a28ad;_0x2839d1[_0xc8e3('0x32')]=_[_0xc8e3('0x34')](db[_0xc8e3('0x115')][_0xc8e3('0x2f')]);_0x2839d1[_0xc8e3('0x33')]=_[_0xc8e3('0x34')](_0x3639ba[_0xc8e3('0x33')]);_0x2839d1[_0xc8e3('0x35')]=_[_0xc8e3('0x36')](_0x2839d1[_0xc8e3('0x32')],_0x2839d1[_0xc8e3('0x33')]);_0x4f6293[_0xc8e3('0x37')]=_[_0xc8e3('0x36')](_0x2839d1[_0xc8e3('0x32')],qs[_0xc8e3('0x38')](_0x3639ba[_0xc8e3('0x33')]['fields']));_0x4f6293['attributes']=_0x4f6293[_0xc8e3('0x37')][_0xc8e3('0x48')]?_0x4f6293[_0xc8e3('0x37')]:_0x2839d1['model'];_0x4f6293[_0xc8e3('0x3b')]=qs[_0xc8e3('0x3c')](_0x3639ba[_0xc8e3('0x33')][_0xc8e3('0x3c')]);_0x4f6293[_0xc8e3('0x3d')]=qs[_0xc8e3('0x35')](_['pick'](_0x3639ba[_0xc8e3('0x33')],_0x2839d1[_0xc8e3('0x35')]));if(_0x3639ba['query']['filter']){_0x4f6293[_0xc8e3('0x3d')]=_[_0xc8e3('0x3f')](_0x4f6293[_0xc8e3('0x3d')],{'$or':_[_0xc8e3('0x2e')](_0x4f6293[_0xc8e3('0x37')],function(_0x3070b5){var _0x517c21={};_0x517c21[_0x3070b5]={'$like':'%'+_0x3639ba[_0xc8e3('0x33')][_0xc8e3('0x3e')]+'%'};return _0x517c21;})});}_0x4f6293=_[_0xc8e3('0x3f')]({},_0x4f6293,_0x3639ba[_0xc8e3('0x40')]);return _0xe846a5[_0xc8e3('0xf7')](_0x4f6293);}})[_0xc8e3('0x24')](function(_0xe58d50){if(_0xe58d50){_0x1d8b5f=_0xe58d50[_0xc8e3('0x48')];if(!_0x3639ba[_0xc8e3('0x33')][_0xc8e3('0x39')]('nolimit')){_0x4f6293['limit']=qs[_0xc8e3('0x20')](_0x3639ba[_0xc8e3('0x33')][_0xc8e3('0x20')]);_0x4f6293[_0xc8e3('0x1e')]=qs['offset'](_0x3639ba[_0xc8e3('0x33')]['offset']);}return _0xe846a5[_0xc8e3('0xf7')](_0x4f6293);}})['then'](function(_0x3f8a86){if(_0x3f8a86){return _0x3f8a86?{'count':_0x1d8b5f,'rows':_0x3f8a86}:null;}})[_0xc8e3('0x24')](respondWithResult(_0x3e8f41,null))[_0xc8e3('0x45')](handleError(_0x3e8f41,null));};exports[_0xc8e3('0x116')]=function(_0x4d59b9,_0x53fce2){var _0x6f70eb=_0x4d59b9['query'][_0xc8e3('0x117')]===_0xc8e3('0x118')?_0xc8e3('0x119'):_0xc8e3('0x11a');return db[_0xc8e3('0x41')][_0xc8e3('0x4a')]({'attributes':['id',_0x6f70eb],'where':{'id':_0x4d59b9[_0xc8e3('0x52')]['id']}})[_0xc8e3('0x24')](handleEntityNotFound(_0x53fce2,null))['then'](function(_0x51c3d4){if(_0x51c3d4){var _0x133c08=_0x51c3d4[_0x6f70eb];var _0xc4f443=_0x133c08&&_0x133c08[_0xc8e3('0x11b')]?_0x133c08[_0xc8e3('0x11b')]:[];_0x53fce2[_0xc8e3('0xba')]({'fromKey':_[_0xc8e3('0x6e')](_0x133c08[_0xc8e3('0x11c')])?undefined:_0x133c08[_0xc8e3('0x11c')],'count':_0xc4f443[_0xc8e3('0x48')],'rows':_0xc4f443});}})['catch'](handleError(_0x53fce2,null));};exports[_0xc8e3('0x11d')]=function(_0x61d73b,_0x392c2f){var _0x57f2d7={'raw':![],'where':{}};var _0xe1d4ca={};var _0x22bb7f={'count':0x0,'rows':[]};return db[_0xc8e3('0x41')][_0xc8e3('0x56')]({'where':{'id':_0x61d73b['params']['id']}})[_0xc8e3('0x24')](handleEntityNotFound(_0x392c2f,null))[_0xc8e3('0x24')](function(_0x126442){if(_0x126442){_0xe1d4ca[_0xc8e3('0x32')]=_['keys'](db[_0xc8e3('0x11e')][_0xc8e3('0x2f')]);_0xe1d4ca[_0xc8e3('0x33')]=_[_0xc8e3('0x34')](_0x61d73b[_0xc8e3('0x33')]);_0xe1d4ca[_0xc8e3('0x35')]=_[_0xc8e3('0x36')](_0xe1d4ca[_0xc8e3('0x32')],_0xe1d4ca[_0xc8e3('0x33')]);_0x57f2d7[_0xc8e3('0x37')]=_[_0xc8e3('0x36')](_0xe1d4ca['model'],qs[_0xc8e3('0x38')](_0x61d73b[_0xc8e3('0x33')][_0xc8e3('0x38')]));_0x57f2d7[_0xc8e3('0x37')]=_0x57f2d7[_0xc8e3('0x37')][_0xc8e3('0x48')]?_0x57f2d7[_0xc8e3('0x37')]:_0xe1d4ca['model'];if(!_0x61d73b['query'][_0xc8e3('0x39')](_0xc8e3('0x3a'))){_0x57f2d7[_0xc8e3('0x20')]=qs['limit'](_0x61d73b['query'][_0xc8e3('0x20')]);_0x57f2d7[_0xc8e3('0x1e')]=qs[_0xc8e3('0x1e')](_0x61d73b['query'][_0xc8e3('0x1e')]);}_0x57f2d7[_0xc8e3('0x3b')]=qs[_0xc8e3('0x3c')](_0x61d73b[_0xc8e3('0x33')]['sort']);_0x57f2d7[_0xc8e3('0x3d')]=qs[_0xc8e3('0x35')](_[_0xc8e3('0x57')](_0x61d73b[_0xc8e3('0x33')],_0xe1d4ca[_0xc8e3('0x35')]));_0x57f2d7[_0xc8e3('0x3d')][_0xc8e3('0x54')]=_0x126442['id'];if(_0x61d73b[_0xc8e3('0x33')][_0xc8e3('0x3e')]){_0x57f2d7[_0xc8e3('0x3d')]=_[_0xc8e3('0x3f')](_0x57f2d7['where'],{'$or':_[_0xc8e3('0x2e')](_0x57f2d7['attributes'],function(_0x53c09d){var _0x32120d={};_0x32120d[_0x53c09d]={'$like':'%'+_0x61d73b[_0xc8e3('0x33')]['filter']+'%'};return _0x32120d;})});}_0x57f2d7=_['merge']({},_0x57f2d7,_0x61d73b[_0xc8e3('0x40')]);return db[_0xc8e3('0x11e')][_0xc8e3('0x21')]({'where':_0x57f2d7[_0xc8e3('0x3d')]})[_0xc8e3('0x24')](function(_0x357793){_0x22bb7f[_0xc8e3('0x21')]=_0x357793;if(_0x61d73b[_0xc8e3('0x33')][_0xc8e3('0x49')]){_0x57f2d7[_0xc8e3('0x42')]=[{'all':!![]}];}else{_0x57f2d7[_0xc8e3('0x42')]=[{'model':db[_0xc8e3('0x8d')],'as':'Contact','required':![]},{'model':db[_0xc8e3('0x11f')],'as':_0xc8e3('0x120'),'required':![]}];}return db['ChatOfflineMessage']['findAll'](_0x57f2d7);})[_0xc8e3('0x24')](function(_0x47933b){_0x22bb7f[_0xc8e3('0x44')]=_0x47933b;return _0x22bb7f;});}})[_0xc8e3('0x24')](respondWithFilteredResult(_0x392c2f,_0x57f2d7))[_0xc8e3('0x45')](handleError(_0x392c2f,null));};exports[_0xc8e3('0x121')]=function(_0x2c2e36,_0xa20126){return db[_0xc8e3('0x41')][_0xc8e3('0x4a')]({'where':{'id':_0x2c2e36[_0xc8e3('0x52')]['id']}})['then'](handleEntityNotFound(_0xa20126,null))[_0xc8e3('0x24')](function(_0x36f74f){if(_0x36f74f){return _0x36f74f['addAgents'](_0x2c2e36[_0xc8e3('0x4c')][_0xc8e3('0x5d')],_['omit'](_0x2c2e36[_0xc8e3('0x4c')],['ids','id'])||{})['spread'](function(_0x244531){for(var _0x1447d9=0x0;_0x1447d9<_0x2c2e36['body'][_0xc8e3('0x5d')][_0xc8e3('0x48')];_0x1447d9+=0x1){socket['emit'](_0xc8e3('0x122'),{'UserId':Number(_0x2c2e36['body']['ids'][_0x1447d9]),'ChatWebsiteId':Number(_0x2c2e36[_0xc8e3('0x52')]['id'])});}return _0x244531;});}})[_0xc8e3('0x24')](respondWithResult(_0xa20126,null))[_0xc8e3('0x45')](handleError(_0xa20126,null));};exports[_0xc8e3('0x123')]=function(_0x1ccd37,_0x22aa11){return db['ChatWebsite'][_0xc8e3('0x4a')]({'where':{'id':_0x1ccd37[_0xc8e3('0x52')]['id']}})['then'](handleEntityNotFound(_0x22aa11,null))[_0xc8e3('0x24')](function(_0x169fe3){if(_0x169fe3){return _0x169fe3[_0xc8e3('0x123')](_0x1ccd37[_0xc8e3('0x33')][_0xc8e3('0x5d')])['then'](function(){if(_['isArray'](_0x1ccd37[_0xc8e3('0x33')][_0xc8e3('0x5d')])){for(var _0x34e170=0x0;_0x34e170<_0x1ccd37['query'][_0xc8e3('0x5d')][_0xc8e3('0x48')];_0x34e170+=0x1){socket['emit'](_0xc8e3('0x124'),{'UserId':Number(_0x1ccd37[_0xc8e3('0x33')]['ids'][_0x34e170]),'ChatWebsiteId':Number(_0x1ccd37[_0xc8e3('0x52')]['id'])});}}else{socket[_0xc8e3('0x125')](_0xc8e3('0x124'),{'UserId':Number(_0x1ccd37[_0xc8e3('0x33')]['ids']),'ChatWebsiteId':Number(_0x1ccd37[_0xc8e3('0x52')]['id'])});}});}})[_0xc8e3('0x24')](respondWithStatusCode(_0x22aa11,null))[_0xc8e3('0x45')](handleError(_0x22aa11,null));};exports[_0xc8e3('0x126')]=function(_0xb98996,_0x2e4917){var _0x558edf={};var _0x4bbc2d={};var _0x4941d1;var _0x4236ae;return db[_0xc8e3('0x41')][_0xc8e3('0x56')]({'where':{'id':_0xb98996['params']['id']}})[_0xc8e3('0x24')](handleEntityNotFound(_0x2e4917,null))[_0xc8e3('0x24')](function(_0x5e4ede){if(_0x5e4ede){_0x4941d1=_0x5e4ede;_0x4bbc2d['model']=_[_0xc8e3('0x34')](db[_0xc8e3('0xe3')][_0xc8e3('0x2f')]);_0x4bbc2d['query']=_[_0xc8e3('0x34')](_0xb98996[_0xc8e3('0x33')]);_0x4bbc2d[_0xc8e3('0x35')]=_[_0xc8e3('0x36')](_0x4bbc2d[_0xc8e3('0x32')],_0x4bbc2d[_0xc8e3('0x33')]);_0x558edf[_0xc8e3('0x37')]=_[_0xc8e3('0x36')](_0x4bbc2d['model'],qs[_0xc8e3('0x38')](_0xb98996[_0xc8e3('0x33')][_0xc8e3('0x38')]));_0x558edf[_0xc8e3('0x37')]=_0x558edf['attributes'][_0xc8e3('0x48')]?_0x558edf[_0xc8e3('0x37')]:_0x4bbc2d[_0xc8e3('0x32')];_0x558edf[_0xc8e3('0x3b')]=qs['sort'](_0xb98996[_0xc8e3('0x33')][_0xc8e3('0x3c')]);_0x558edf[_0xc8e3('0x3d')]=qs[_0xc8e3('0x35')](_['pick'](_0xb98996[_0xc8e3('0x33')],_0x4bbc2d[_0xc8e3('0x35')]));if(_0xb98996['query']['filter']){_0x558edf[_0xc8e3('0x3d')]=_[_0xc8e3('0x3f')](_0x558edf[_0xc8e3('0x3d')],{'$or':_[_0xc8e3('0x2e')](_0x558edf[_0xc8e3('0x37')],function(_0x688491){var _0x45e73e={};_0x45e73e[_0x688491]={'$like':'%'+_0xb98996[_0xc8e3('0x33')][_0xc8e3('0x3e')]+'%'};return _0x45e73e;})});}_0x558edf=_[_0xc8e3('0x3f')]({},_0x558edf,_0xb98996[_0xc8e3('0x40')]);return _0x4941d1[_0xc8e3('0x126')](_0x558edf);}})['then'](function(_0x11caf7){if(_0x11caf7){_0x4236ae=_0x11caf7['length'];if(!_0xb98996[_0xc8e3('0x33')][_0xc8e3('0x39')](_0xc8e3('0x3a'))){_0x558edf['limit']=qs[_0xc8e3('0x20')](_0xb98996[_0xc8e3('0x33')]['limit']);_0x558edf[_0xc8e3('0x1e')]=qs['offset'](_0xb98996[_0xc8e3('0x33')]['offset']);}return _0x4941d1[_0xc8e3('0x126')](_0x558edf);}})[_0xc8e3('0x24')](function(_0x293c7f){if(_0x293c7f){return _0x293c7f?{'count':_0x4236ae,'rows':_0x293c7f}:null;}})['then'](respondWithResult(_0x2e4917,null))[_0xc8e3('0x45')](handleError(_0x2e4917,null));}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.events.js b/server/api/chatWebsite/chatWebsite.events.js index 9c05bd1..9f322fe 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 _0xeb5d=['hasOwnProperty','hook','exports','../../mysqldb','ChatWebsite','setMaxListeners','save','emit'];(function(_0x119d5a,_0x19b457){var _0x15bff4=function(_0x1b7c78){while(--_0x1b7c78){_0x119d5a['push'](_0x119d5a['shift']());}};_0x15bff4(++_0x19b457);}(_0xeb5d,0x16b));var _0xdeb5=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0xeb5d[_0x46e363];return _0x3fb059;};'use strict';var EventEmitter=require('events');var ChatWebsite=require(_0xdeb5('0x0'))['db'][_0xdeb5('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xdeb5('0x2')](0x0);var events={'afterCreate':_0xdeb5('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x17d77f){return function(_0x16c31b,_0x546313,_0x19de5e){ChatWebsiteEvents[_0xdeb5('0x4')](_0x17d77f+':'+_0x16c31b['id'],_0x16c31b);ChatWebsiteEvents[_0xdeb5('0x4')](_0x17d77f,_0x16c31b);_0x19de5e(null);};}for(var e in events){if(events[_0xdeb5('0x5')](e)){var event=events[e];ChatWebsite[_0xdeb5('0x6')](e,emitEvent(event));}}module[_0xdeb5('0x7')]=ChatWebsiteEvents; \ No newline at end of file +var _0xb43b=['ChatWebsite','setMaxListeners','save','update','remove','emit','hook','events'];(function(_0x28654e,_0x1eae0a){var _0x52d6c8=function(_0x34e45d){while(--_0x34e45d){_0x28654e['push'](_0x28654e['shift']());}};_0x52d6c8(++_0x1eae0a);}(_0xb43b,0xbf));var _0xbb43=function(_0x3e3b67,_0x8d1bf6){_0x3e3b67=_0x3e3b67-0x0;var _0x4463f9=_0xb43b[_0x3e3b67];return _0x4463f9;};'use strict';var EventEmitter=require(_0xbb43('0x0'));var ChatWebsite=require('../../mysqldb')['db'][_0xbb43('0x1')];var ChatWebsiteEvents=new EventEmitter();ChatWebsiteEvents[_0xbb43('0x2')](0x0);var events={'afterCreate':_0xbb43('0x3'),'afterUpdate':_0xbb43('0x4'),'afterDestroy':_0xbb43('0x5')};function emitEvent(_0xeeec7c){return function(_0x2e9c09,_0x25f690,_0x24edde){ChatWebsiteEvents[_0xbb43('0x6')](_0xeeec7c+':'+_0x2e9c09['id'],_0x2e9c09);ChatWebsiteEvents[_0xbb43('0x6')](_0xeeec7c,_0x2e9c09);_0x24edde(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];ChatWebsite[_0xbb43('0x7')](e,emitEvent(event));}}module['exports']=ChatWebsiteEvents; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.model.js b/server/api/chatWebsite/chatWebsite.model.js index 2009d90..2462f69 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 _0xdf62=['exports','ChatWebsite','lodash','api','moment','bluebird','rimraf','../../config/environment'];(function(_0x56a89b,_0x5106a4){var _0xdf565b=function(_0x3dfbfd){while(--_0x3dfbfd){_0x56a89b['push'](_0x56a89b['shift']());}};_0xdf565b(++_0x5106a4);}(_0xdf62,0x152));var _0x2df6=function(_0x42fcd9,_0x2676b7){_0x42fcd9=_0x42fcd9-0x0;var _0x3d2b5a=_0xdf62[_0x42fcd9];return _0x3d2b5a;};'use strict';var _=require(_0x2df6('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x2df6('0x1'));var moment=require(_0x2df6('0x2'));var BPromise=require(_0x2df6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x2df6('0x4'));var config=require(_0x2df6('0x5'));var attributes=require('./chatWebsite.attributes');module[_0x2df6('0x6')]=function(_0x45f80b,_0x165db8){return _0x45f80b['define'](_0x2df6('0x7'),attributes,{'tableName':'chat_websites','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc5c8=['rimraf','../../config/environment','define','ChatWebsite','chat_websites','lodash','../../config/logger','api','bluebird','request-promise','path'];(function(_0x55c947,_0x5e20a8){var _0x2556b3=function(_0x239288){while(--_0x239288){_0x55c947['push'](_0x55c947['shift']());}};_0x2556b3(++_0x5e20a8);}(_0xc5c8,0xe1));var _0x8c5c=function(_0x47db40,_0x5a1d4d){_0x47db40=_0x47db40-0x0;var _0x1aafa8=_0xc5c8[_0x47db40];return _0x1aafa8;};'use strict';var _=require(_0x8c5c('0x0'));var util=require('util');var logger=require(_0x8c5c('0x1'))(_0x8c5c('0x2'));var moment=require('moment');var BPromise=require(_0x8c5c('0x3'));var rp=require(_0x8c5c('0x4'));var fs=require('fs');var path=require(_0x8c5c('0x5'));var rimraf=require(_0x8c5c('0x6'));var config=require(_0x8c5c('0x7'));var attributes=require('./chatWebsite.attributes');module['exports']=function(_0x103327,_0x8d508b){return _0x103327[_0x8c5c('0x8')](_0x8c5c('0x9'),attributes,{'tableName':_0x8c5c('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.rpc.js b/server/api/chatWebsite/chatWebsite.rpc.js index 4ea2f3f..cfa017b 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 _0x5f10=['rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./chatWebsite.socket','register','request','then','ChatWebsite,\x20%s,\x20%s','debug','error','code','message','request\x20sent','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x2f418c,_0x100ca7){var _0x1b5aa2=function(_0x241a67){while(--_0x241a67){_0x2f418c['push'](_0x2f418c['shift']());}};_0x1b5aa2(++_0x100ca7);}(_0x5f10,0x14a));var _0x05f1=function(_0x5b26cb,_0x527ab0){_0x5b26cb=_0x5b26cb-0x0;var _0x563d12=_0x5f10[_0x5b26cb];return _0x563d12;};'use strict';var _=require(_0x05f1('0x0'));var util=require(_0x05f1('0x1'));var moment=require(_0x05f1('0x2'));var BPromise=require(_0x05f1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x05f1('0x4'));var db=require(_0x05f1('0x5'))['db'];var utils=require(_0x05f1('0x6'));var logger=require(_0x05f1('0x7'))(_0x05f1('0x8'));var config=require(_0x05f1('0x9'));var jayson=require(_0x05f1('0xa'));var client=jayson['client'][_0x05f1('0xb')]({'port':0x232a});config[_0x05f1('0xc')]=_[_0x05f1('0xd')](config[_0x05f1('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x05f1('0xe'))(new Redis(config[_0x05f1('0xc')]));require(_0x05f1('0xf'))[_0x05f1('0x10')](socket);function respondWithRpcPromise(_0x5257b4,_0x553351,_0x588d92){return new BPromise(function(_0x1a1ac6,_0x201614){return client[_0x05f1('0x11')](_0x5257b4,_0x588d92)[_0x05f1('0x12')](function(_0x4c738f){logger['info'](_0x05f1('0x13'),_0x553351,'request\x20sent');logger[_0x05f1('0x14')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x553351,'request\x20sent',JSON['stringify'](_0x4c738f));if(_0x4c738f[_0x05f1('0x15')]){if(_0x4c738f['error'][_0x05f1('0x16')]===0x1f4){logger[_0x05f1('0x15')](_0x05f1('0x13'),_0x553351,_0x4c738f[_0x05f1('0x15')][_0x05f1('0x17')]);return _0x201614(_0x4c738f['error'][_0x05f1('0x17')]);}logger[_0x05f1('0x15')](_0x05f1('0x13'),_0x553351,_0x4c738f['error']['message']);return _0x1a1ac6(_0x4c738f[_0x05f1('0x15')][_0x05f1('0x17')]);}else{logger['info'](_0x05f1('0x13'),_0x553351,_0x05f1('0x18'));_0x1a1ac6(_0x4c738f['result']['message']);}})[_0x05f1('0x19')](function(_0x4b0875){logger[_0x05f1('0x15')](_0x05f1('0x13'),_0x553351,_0x4b0875);_0x201614(_0x4b0875);});});} \ No newline at end of file +var _0x2464=['./chatWebsite.socket','request','info','ChatWebsite,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','http','defaults','socket.io-emitter','redis'];(function(_0x29bd77,_0x805140){var _0x3bee2c=function(_0x4d5b2f){while(--_0x4d5b2f){_0x29bd77['push'](_0x29bd77['shift']());}};_0x3bee2c(++_0x805140);}(_0x2464,0x1e0));var _0x4246=function(_0xbced34,_0x1a4691){_0xbced34=_0xbced34-0x0;var _0x46e614=_0x2464[_0xbced34];return _0x46e614;};'use strict';var _=require(_0x4246('0x0'));var util=require(_0x4246('0x1'));var moment=require(_0x4246('0x2'));var BPromise=require(_0x4246('0x3'));var rs=require(_0x4246('0x4'));var fs=require('fs');var Redis=require(_0x4246('0x5'));var db=require(_0x4246('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4246('0x7'))(_0x4246('0x8'));var config=require('../../config/environment');var jayson=require(_0x4246('0x9'));var client=jayson['client'][_0x4246('0xa')]({'port':0x232a});config['redis']=_[_0x4246('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x4246('0xc'))(new Redis(config[_0x4246('0xd')]));require(_0x4246('0xe'))['register'](socket);function respondWithRpcPromise(_0x538e80,_0x4fd057,_0x45bee9){return new BPromise(function(_0x457522,_0x4ae189){return client[_0x4246('0xf')](_0x538e80,_0x45bee9)['then'](function(_0x2f0c31){logger[_0x4246('0x10')](_0x4246('0x11'),_0x4fd057,_0x4246('0x12'));logger[_0x4246('0x13')]('ChatWebsite,\x20%s,\x20%s,\x20%s',_0x4fd057,_0x4246('0x12'),JSON[_0x4246('0x14')](_0x2f0c31));if(_0x2f0c31[_0x4246('0x15')]){if(_0x2f0c31[_0x4246('0x15')][_0x4246('0x16')]===0x1f4){logger[_0x4246('0x15')](_0x4246('0x11'),_0x4fd057,_0x2f0c31[_0x4246('0x15')][_0x4246('0x17')]);return _0x4ae189(_0x2f0c31[_0x4246('0x15')]['message']);}logger[_0x4246('0x15')]('ChatWebsite,\x20%s,\x20%s',_0x4fd057,_0x2f0c31[_0x4246('0x15')][_0x4246('0x17')]);return _0x457522(_0x2f0c31[_0x4246('0x15')]['message']);}else{logger[_0x4246('0x10')]('ChatWebsite,\x20%s,\x20%s',_0x4fd057,'request\x20sent');_0x457522(_0x2f0c31[_0x4246('0x18')]['message']);}})[_0x4246('0x19')](function(_0x39c3e8){logger[_0x4246('0x15')](_0x4246('0x11'),_0x4fd057,_0x39c3e8);_0x4ae189(_0x39c3e8);});});} \ No newline at end of file diff --git a/server/api/chatWebsite/chatWebsite.socket.js b/server/api/chatWebsite/chatWebsite.socket.js index 94caf7e..ca0d72f 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 _0x725d=['register','length','./chatWebsite.events','save','remove','update','removeListener'];(function(_0x361d3f,_0x3be2aa){var _0x320229=function(_0x138319){while(--_0x138319){_0x361d3f['push'](_0x361d3f['shift']());}};_0x320229(++_0x3be2aa);}(_0x725d,0x159));var _0xd725=function(_0x442dcb,_0x179c35){_0x442dcb=_0x442dcb-0x0;var _0x593554=_0x725d[_0x442dcb];return _0x593554;};'use strict';var ChatWebsiteEvents=require(_0xd725('0x0'));var events=[_0xd725('0x1'),_0xd725('0x2'),_0xd725('0x3')];function createListener(_0x39a1d2,_0x54a7ef){return function(_0x4f4d2f){_0x54a7ef['emit'](_0x39a1d2,_0x4f4d2f);};}function removeListener(_0x4dc885,_0x3f9518){return function(){ChatWebsiteEvents[_0xd725('0x4')](_0x4dc885,_0x3f9518);};}exports[_0xd725('0x5')]=function(_0x2b34e7){for(var _0x294d9b=0x0,_0x323ee8=events[_0xd725('0x6')];_0x294d9b<_0x323ee8;_0x294d9b++){var _0x58c1fa=events[_0x294d9b];var _0x34281e=createListener('chatWebsite:'+_0x58c1fa,_0x2b34e7);ChatWebsiteEvents['on'](_0x58c1fa,_0x34281e);}}; \ No newline at end of file +var _0x2ca0=['register','length','chatWebsite:','./chatWebsite.events','remove','update','emit'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2ca0,0xc0));var _0x02ca=function(_0x546ac5,_0x59e59b){_0x546ac5=_0x546ac5-0x0;var _0x56a6d8=_0x2ca0[_0x546ac5];return _0x56a6d8;};'use strict';var ChatWebsiteEvents=require(_0x02ca('0x0'));var events=['save',_0x02ca('0x1'),_0x02ca('0x2')];function createListener(_0x112149,_0x3a0ecf){return function(_0x38d5b8){_0x3a0ecf[_0x02ca('0x3')](_0x112149,_0x38d5b8);};}function removeListener(_0x51ba9a,_0x52dddd){return function(){ChatWebsiteEvents['removeListener'](_0x51ba9a,_0x52dddd);};}exports[_0x02ca('0x4')]=function(_0x48ccd1){for(var _0x477438=0x0,_0x12033d=events[_0x02ca('0x5')];_0x477438<_0x12033d;_0x477438++){var _0x43b2c7=events[_0x477438];var _0x41864a=createListener(_0x02ca('0x6')+_0x43b2c7,_0x48ccd1);ChatWebsiteEvents['on'](_0x43b2c7,_0x41864a);}}; \ No newline at end of file diff --git a/server/api/chatWebsite/index.js b/server/api/chatWebsite/index.js index 73ab982..fe14695 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 _0x6d78=['/:id/proactive_actions','getFields','/:id/offline_messages','/:id/users','post','addDisposition','/:id/canned_answers','diskStorage','root','format','%s-%s','now','originalname','/:id/logo','single','file','addLogo','server/files/images/avatars/','addAvatar','join','addSystemAvatar','/:id/notify','server/files','attachments','ensureDir','extname','replace','/:id/offline','/:id/interactions','addInteraction','addApplications','addProactiveActions','addAgents','update','delete','destroy','removeDispositions','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','./chatWebsite.controller','get','describe','/:id','isAuthenticated','show','/:id/dispositions','getDispositions','getLogo','/:id/avatar','getAvatar','/:id/customer_avatar','/:id/system_avatar','getSystemAvatar','getInteractions','/:id/snippet','getSnippet','/:id/applications','getApplications'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x6d78,0x121));var _0x86d7=function(_0x1a8d04,_0x50ba5b){_0x1a8d04=_0x1a8d04-0x0;var _0x409144=_0x6d78[_0x1a8d04];return _0x409144;};'use strict';var multer=require(_0x86d7('0x0'));var util=require(_0x86d7('0x1'));var path=require('path');var timeout=require(_0x86d7('0x2'));var express=require(_0x86d7('0x3'));var router=express[_0x86d7('0x4')]();var fs_extra=require(_0x86d7('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x86d7('0x6'));var config=require('../../config/environment');var controller=require(_0x86d7('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0x86d7('0x8')]('/describe',auth['isAuthenticated'](),controller[_0x86d7('0x9')]);router[_0x86d7('0x8')](_0x86d7('0xa'),auth[_0x86d7('0xb')](),controller[_0x86d7('0xc')]);router[_0x86d7('0x8')](_0x86d7('0xd'),auth[_0x86d7('0xb')](),controller[_0x86d7('0xe')]);router['get']('/:id/canned_answers',auth[_0x86d7('0xb')](),controller['getAnswers']);router['get']('/:id/logo',controller[_0x86d7('0xf')]);router[_0x86d7('0x8')](_0x86d7('0x10'),controller[_0x86d7('0x11')]);router[_0x86d7('0x8')](_0x86d7('0x12'),controller['getCustomerAvatar']);router[_0x86d7('0x8')](_0x86d7('0x13'),controller[_0x86d7('0x14')]);router['get']('/:id/interactions',auth[_0x86d7('0xb')](),controller[_0x86d7('0x15')]);router['get'](_0x86d7('0x16'),controller[_0x86d7('0x17')]);router['get'](_0x86d7('0x18'),auth[_0x86d7('0xb')](),controller[_0x86d7('0x19')]);router[_0x86d7('0x8')](_0x86d7('0x1a'),auth[_0x86d7('0xb')](),controller['getProactiveActions']);router[_0x86d7('0x8')]('/:id/fields',controller[_0x86d7('0x1b')]);router[_0x86d7('0x8')](_0x86d7('0x1c'),auth[_0x86d7('0xb')](),controller['getOfflineMessages']);router[_0x86d7('0x8')](_0x86d7('0x1d'),auth['isAuthenticated'](),controller['getAgents']);router[_0x86d7('0x1e')]('/',auth[_0x86d7('0xb')](),controller['create']);router['post']('/:id/dispositions',auth[_0x86d7('0xb')](),controller[_0x86d7('0x1f')]);router[_0x86d7('0x1e')](_0x86d7('0x20'),auth['isAuthenticated'](),controller['addAnswer']);var upload=multer({'storage':multer[_0x86d7('0x21')]({'destination':function(_0x43b55c,_0x2fc787,_0x586e5a){_0x586e5a(null,path['join'](config[_0x86d7('0x22')],'server/files/images/logos/'));},'filename':function(_0x41792f,_0x3d5a46,_0x487e81){_0x487e81(null,util[_0x86d7('0x23')](_0x86d7('0x24'),Date[_0x86d7('0x25')](),_0x3d5a46[_0x86d7('0x26')]));}})});router[_0x86d7('0x1e')](_0x86d7('0x27'),upload[_0x86d7('0x28')](_0x86d7('0x29')),controller[_0x86d7('0x2a')]);var upload=multer({'storage':multer[_0x86d7('0x21')]({'destination':function(_0x37c966,_0x19511f,_0x47909c){_0x47909c(null,path['join'](config[_0x86d7('0x22')],_0x86d7('0x2b')));},'filename':function(_0x26b3b5,_0x2bdc68,_0x59977b){_0x59977b(null,util[_0x86d7('0x23')](_0x86d7('0x24'),Date[_0x86d7('0x25')](),_0x2bdc68[_0x86d7('0x26')]));}})});router[_0x86d7('0x1e')](_0x86d7('0x10'),upload[_0x86d7('0x28')](_0x86d7('0x29')),controller[_0x86d7('0x2c')]);var upload=multer({'storage':multer[_0x86d7('0x21')]({'destination':function(_0x29141c,_0x92a0d3,_0x4b6df5){_0x4b6df5(null,path[_0x86d7('0x2d')](config[_0x86d7('0x22')],_0x86d7('0x2b')));},'filename':function(_0x5153a9,_0x4105e8,_0x4ce8e0){_0x4ce8e0(null,util['format'](_0x86d7('0x24'),Date[_0x86d7('0x25')](),_0x4105e8[_0x86d7('0x26')]));}})});router[_0x86d7('0x1e')](_0x86d7('0x12'),upload[_0x86d7('0x28')](_0x86d7('0x29')),controller['addCustomerAvatar']);var upload=multer({'storage':multer[_0x86d7('0x21')]({'destination':function(_0x10bbb8,_0x2e4648,_0x2f2219){_0x2f2219(null,path['join'](config['root'],'server/files/images/avatars/'));},'filename':function(_0x463e8b,_0x43e5d4,_0x39e748){_0x39e748(null,util['format'](_0x86d7('0x24'),Date[_0x86d7('0x25')](),_0x43e5d4[_0x86d7('0x26')]));}})});router[_0x86d7('0x1e')]('/:id/system_avatar',upload[_0x86d7('0x28')](_0x86d7('0x29')),controller[_0x86d7('0x2e')]);router[_0x86d7('0x1e')](_0x86d7('0x2f'),controller['notify']);const offlineUploadMulter=multer({'storage':multer['diskStorage']({'destination':function(_0x9fb50c,_0x53ce03,_0x3531a5){const _0x523dba=path[_0x86d7('0x2d')](config[_0x86d7('0x22')],_0x86d7('0x30'),_0x86d7('0x31'),'offline-chat');fs_extra[_0x86d7('0x32')](_0x523dba,function(){_0x3531a5(null,_0x523dba);});},'filename':function(_0x2f87c9,_0x2b9dc2,_0x362830){const _0x12f5b2=_0x2b9dc2[_0x86d7('0x26')]['replace'](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x1898b6=path[_0x86d7('0x33')](_0x12f5b2);const _0x1c9313=Date[_0x86d7('0x25')]()+'-'+_0x12f5b2[_0x86d7('0x34')](_0x1898b6,'')+_0x1898b6;_0x362830(null,_0x1c9313);}})});router[_0x86d7('0x1e')](_0x86d7('0x35'),offlineUploadMulter['any'](),controller['offline']);router['post'](_0x86d7('0x36'),auth[_0x86d7('0xb')](),controller[_0x86d7('0x37')]);router['post'](_0x86d7('0x18'),auth[_0x86d7('0xb')](),controller[_0x86d7('0x38')]);router[_0x86d7('0x1e')](_0x86d7('0x1a'),auth[_0x86d7('0xb')](),controller[_0x86d7('0x39')]);router[_0x86d7('0x1e')](_0x86d7('0x1d'),auth['isAuthenticated'](),controller[_0x86d7('0x3a')]);router['put'](_0x86d7('0xa'),auth['isAuthenticated'](),controller[_0x86d7('0x3b')]);router[_0x86d7('0x3c')](_0x86d7('0xa'),auth[_0x86d7('0xb')](),controller[_0x86d7('0x3d')]);router[_0x86d7('0x3c')](_0x86d7('0xd'),auth[_0x86d7('0xb')](),controller[_0x86d7('0x3e')]);router[_0x86d7('0x3c')](_0x86d7('0x20'),auth[_0x86d7('0xb')](),controller['removeAnswers']);router['delete'](_0x86d7('0x1d'),auth[_0x86d7('0xb')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0x5b0b=['/:id/customer_avatar','addCustomerAvatar','/:id/notify','notify','server/files','offline-chat','ensureDir','replace','extname','any','offline','/:id/interactions','addInteraction','addProactiveActions','addAgents','put','update','destroy','delete','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../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','getInteractions','/:id/snippet','getSnippet','getApplications','/:id/proactive_actions','getProactiveActions','/:id/fields','getFields','/:id/offline_messages','getOfflineMessages','/:id/users','getAgents','post','create','/:id/dispositions','addDisposition','addAnswer','diskStorage','root','server/files/images/logos/','format','%s-%s','single','file','addLogo','join','now','originalname','addAvatar','server/files/images/avatars/'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5b0b,0x19c));var _0xb5b0=function(_0xd66a31,_0xacd08d){_0xd66a31=_0xd66a31-0x0;var _0x2f4fa4=_0x5b0b[_0xd66a31];return _0x2f4fa4;};'use strict';var multer=require(_0xb5b0('0x0'));var util=require('util');var path=require(_0xb5b0('0x1'));var timeout=require(_0xb5b0('0x2'));var express=require(_0xb5b0('0x3'));var router=express[_0xb5b0('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xb5b0('0x5'));var interaction=require(_0xb5b0('0x6'));var config=require(_0xb5b0('0x7'));var controller=require(_0xb5b0('0x8'));router[_0xb5b0('0x9')]('/',auth[_0xb5b0('0xa')](),controller[_0xb5b0('0xb')]);router[_0xb5b0('0x9')](_0xb5b0('0xc'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0xd')]);router[_0xb5b0('0x9')](_0xb5b0('0xe'),auth['isAuthenticated'](),controller[_0xb5b0('0xf')]);router[_0xb5b0('0x9')]('/:id/dispositions',auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x10')]);router[_0xb5b0('0x9')](_0xb5b0('0x11'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x12')]);router[_0xb5b0('0x9')](_0xb5b0('0x13'),controller[_0xb5b0('0x14')]);router[_0xb5b0('0x9')](_0xb5b0('0x15'),controller[_0xb5b0('0x16')]);router['get']('/:id/customer_avatar',controller[_0xb5b0('0x17')]);router[_0xb5b0('0x9')](_0xb5b0('0x18'),controller[_0xb5b0('0x19')]);router[_0xb5b0('0x9')]('/:id/interactions',auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x1a')]);router['get'](_0xb5b0('0x1b'),controller[_0xb5b0('0x1c')]);router[_0xb5b0('0x9')]('/:id/applications',auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x1d')]);router[_0xb5b0('0x9')](_0xb5b0('0x1e'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x1f')]);router['get'](_0xb5b0('0x20'),controller[_0xb5b0('0x21')]);router[_0xb5b0('0x9')](_0xb5b0('0x22'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x23')]);router[_0xb5b0('0x9')](_0xb5b0('0x24'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x25')]);router[_0xb5b0('0x26')]('/',auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x27')]);router['post'](_0xb5b0('0x28'),auth['isAuthenticated'](),controller[_0xb5b0('0x29')]);router[_0xb5b0('0x26')]('/:id/canned_answers',auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x2a')]);var upload=multer({'storage':multer[_0xb5b0('0x2b')]({'destination':function(_0x315b62,_0x43b5dc,_0x28db99){_0x28db99(null,path['join'](config[_0xb5b0('0x2c')],_0xb5b0('0x2d')));},'filename':function(_0x236287,_0xa31597,_0x4be787){_0x4be787(null,util[_0xb5b0('0x2e')](_0xb5b0('0x2f'),Date['now'](),_0xa31597['originalname']));}})});router[_0xb5b0('0x26')]('/:id/logo',upload[_0xb5b0('0x30')](_0xb5b0('0x31')),controller[_0xb5b0('0x32')]);var upload=multer({'storage':multer[_0xb5b0('0x2b')]({'destination':function(_0x5a5403,_0x4d331e,_0xaa37e){_0xaa37e(null,path[_0xb5b0('0x33')](config[_0xb5b0('0x2c')],'server/files/images/avatars/'));},'filename':function(_0x4a1e85,_0x25a568,_0x2dbe06){_0x2dbe06(null,util[_0xb5b0('0x2e')]('%s-%s',Date[_0xb5b0('0x34')](),_0x25a568[_0xb5b0('0x35')]));}})});router['post'](_0xb5b0('0x15'),upload['single']('file'),controller[_0xb5b0('0x36')]);var upload=multer({'storage':multer[_0xb5b0('0x2b')]({'destination':function(_0x2d2dd0,_0x231ef6,_0x11eb8f){_0x11eb8f(null,path[_0xb5b0('0x33')](config[_0xb5b0('0x2c')],_0xb5b0('0x37')));},'filename':function(_0x2df4f8,_0x50744b,_0x42fec9){_0x42fec9(null,util[_0xb5b0('0x2e')](_0xb5b0('0x2f'),Date[_0xb5b0('0x34')](),_0x50744b[_0xb5b0('0x35')]));}})});router[_0xb5b0('0x26')](_0xb5b0('0x38'),upload[_0xb5b0('0x30')]('file'),controller[_0xb5b0('0x39')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x7f4b3b,_0x374520,_0x11d09){_0x11d09(null,path[_0xb5b0('0x33')](config['root'],'server/files/images/avatars/'));},'filename':function(_0x473259,_0x162dc8,_0x2e6016){_0x2e6016(null,util[_0xb5b0('0x2e')](_0xb5b0('0x2f'),Date[_0xb5b0('0x34')](),_0x162dc8['originalname']));}})});router[_0xb5b0('0x26')](_0xb5b0('0x18'),upload[_0xb5b0('0x30')]('file'),controller['addSystemAvatar']);router[_0xb5b0('0x26')](_0xb5b0('0x3a'),controller[_0xb5b0('0x3b')]);const offlineUploadMulter=multer({'storage':multer[_0xb5b0('0x2b')]({'destination':function(_0x6eb78b,_0x28db43,_0x5f3bd3){const _0x334312=path[_0xb5b0('0x33')](config['root'],_0xb5b0('0x3c'),'attachments',_0xb5b0('0x3d'));fs_extra[_0xb5b0('0x3e')](_0x334312,function(){_0x5f3bd3(null,_0x334312);});},'filename':function(_0x6956da,_0x3e9c1b,_0x2274f3){const _0x358fbd=_0x3e9c1b[_0xb5b0('0x35')][_0xb5b0('0x3f')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');const _0x3b327e=path[_0xb5b0('0x40')](_0x358fbd);const _0x5a1f84=Date[_0xb5b0('0x34')]()+'-'+_0x358fbd[_0xb5b0('0x3f')](_0x3b327e,'')+_0x3b327e;_0x2274f3(null,_0x5a1f84);}})});router[_0xb5b0('0x26')]('/:id/offline',offlineUploadMulter[_0xb5b0('0x41')](),controller[_0xb5b0('0x42')]);router['post'](_0xb5b0('0x43'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x44')]);router[_0xb5b0('0x26')]('/:id/applications',auth[_0xb5b0('0xa')](),controller['addApplications']);router[_0xb5b0('0x26')](_0xb5b0('0x1e'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x45')]);router[_0xb5b0('0x26')]('/:id/users',auth['isAuthenticated'](),controller[_0xb5b0('0x46')]);router[_0xb5b0('0x47')](_0xb5b0('0xe'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x48')]);router['delete']('/:id',auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x49')]);router[_0xb5b0('0x4a')](_0xb5b0('0x28'),auth[_0xb5b0('0xa')](),controller['removeDispositions']);router[_0xb5b0('0x4a')](_0xb5b0('0x11'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x4b')]);router['delete'](_0xb5b0('0x24'),auth[_0xb5b0('0xa')](),controller[_0xb5b0('0x4c')]);module[_0xb5b0('0x4d')]=router; \ No newline at end of file diff --git a/server/api/client-side-logs.js b/server/api/client-side-logs.js index d469e49..c796a13 100644 --- a/server/api/client-side-logs.js +++ b/server/api/client-side-logs.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xebc8=['isAuthenticated','exports','beaver-logger/server','../config/environment','Router','env','production','app','get','client-side-logger'];(function(_0xea6b4d,_0x36a149){var _0x504db3=function(_0x3f3163){while(--_0x3f3163){_0xea6b4d['push'](_0xea6b4d['shift']());}};_0x504db3(++_0x36a149);}(_0xebc8,0x124));var _0x8ebc=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xebc8[_0x3b380d];return _0x54502b;};var beaverLogger=require(_0x8ebc('0x0'));var express=require('express');var auth=require('../components/auth/service');var config=require(_0x8ebc('0x1'));var router=express[_0x8ebc('0x2')]();var isProduction=config[_0x8ebc('0x3')]===_0x8ebc('0x4')||![];function clientSideLogs(_0x35a4fa,_0x1048fc,_0x43ed06){var _0x80af24=_0x35a4fa[_0x8ebc('0x5')][_0x8ebc('0x6')](_0x8ebc('0x7'));if(!_0x80af24){throw new Error('Client-Side\x20logger\x20not\x20found!');}return beaverLogger['expressEndpoint']({'uri':'/client-logs','logger':_0x80af24,'enableCors':!isProduction})(_0x35a4fa,_0x1048fc,_0x43ed06);}router['use'](auth[_0x8ebc('0x8')](),clientSideLogs);module[_0x8ebc('0x9')]=router; \ No newline at end of file +var _0xca6c=['Client-Side\x20logger\x20not\x20found!','expressEndpoint','use','exports','beaver-logger/server','express','../components/auth/service','../config/environment','env','get'];(function(_0x263f05,_0x1a2c41){var _0x167369=function(_0x3c3ae0){while(--_0x3c3ae0){_0x263f05['push'](_0x263f05['shift']());}};_0x167369(++_0x1a2c41);}(_0xca6c,0x68));var _0xcca6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xca6c[_0x3dd15e];return _0x231fd0;};var beaverLogger=require(_0xcca6('0x0'));var express=require(_0xcca6('0x1'));var auth=require(_0xcca6('0x2'));var config=require(_0xcca6('0x3'));var router=express['Router']();var isProduction=config[_0xcca6('0x4')]==='production'||![];function clientSideLogs(_0x717da9,_0x2bcf59,_0x1e66ab){var _0x1525f9=_0x717da9['app'][_0xcca6('0x5')]('client-side-logger');if(!_0x1525f9){throw new Error(_0xcca6('0x6'));}return beaverLogger[_0xcca6('0x7')]({'uri':'/client-logs','logger':_0x1525f9,'enableCors':!isProduction})(_0x717da9,_0x2bcf59,_0x1e66ab);}router[_0xcca6('0x8')](auth['isAuthenticated'](),clientSideLogs);module[_0xcca6('0x9')]=router; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.attributes.js b/server/api/cloudProvider/cloudProvider.attributes.js index 17fe71f..bd6b910 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 _0x85ac=['MicrosoftAzure','Outlook365','Dynamics365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20client_secret','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','Google'];(function(_0x378752,_0x158b32){var _0xd5a262=function(_0x3c6f94){while(--_0x3c6f94){_0x378752['push'](_0x378752['shift']());}};_0xd5a262(++_0x158b32);}(_0x85ac,0x1f2));var _0xc85a=function(_0x54d4a8,_0x585a59){_0x54d4a8=_0x54d4a8-0x0;var _0x3b321b=_0x85ac[_0x54d4a8];return _0x3b321b;};'use strict';var Sequelize=require(_0xc85a('0x0'));module[_0xc85a('0x1')]={'name':{'type':Sequelize[_0xc85a('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0xc85a('0x3')](_0xc85a('0x4'),_0xc85a('0x5'),_0xc85a('0x6')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0xc85a('0x3')](_0xc85a('0x7'),_0xc85a('0x8'))},'data1':{'type':Sequelize[_0xc85a('0x2')],'comment':_0xc85a('0x9')},'data2':{'type':Sequelize[_0xc85a('0x2')],'comment':'MicrosoftAzure\x20=>\x20tenant'},'data3':{'type':Sequelize[_0xc85a('0x2')],'comment':_0xc85a('0xa')},'data4':{'type':Sequelize[_0xc85a('0x2')],'comment':'MicrosoftAzure\x20=>\x20redirect_uri'},'data5':{'type':Sequelize[_0xc85a('0xb')],'comment':_0xc85a('0xc')},'data6':{'type':Sequelize[_0xc85a('0xb')],'comment':'MicrosoftAzure\x20=>\x20refresh_token'},'data7':{'type':Sequelize[_0xc85a('0xb')],'comment':_0xc85a('0xd')}}; \ No newline at end of file +var _0x0265=['MicrosoftAzure\x20=>\x20client_secret','MicrosoftAzure\x20=>\x20redirect_uri','TEXT','MicrosoftAzure\x20=>\x20access_token','MicrosoftAzure\x20=>\x20refresh_token','MicrosoftAzure\x20=>\x20Dynamics365\x20=>\x20remote_uri','sequelize','exports','STRING','ENUM','AmazonAWS','MicrosoftAzure','Outlook365','MicrosoftAzure\x20=>\x20client_id','MicrosoftAzure\x20=>\x20tenant'];(function(_0x4c8184,_0x1363f9){var _0x22a8d5=function(_0x5537c8){while(--_0x5537c8){_0x4c8184['push'](_0x4c8184['shift']());}};_0x22a8d5(++_0x1363f9);}(_0x0265,0xc9));var _0x5026=function(_0x155f85,_0x2ba3d4){_0x155f85=_0x155f85-0x0;var _0x313887=_0x0265[_0x155f85];return _0x313887;};'use strict';var Sequelize=require(_0x5026('0x0'));module[_0x5026('0x1')]={'name':{'type':Sequelize[_0x5026('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'service':{'type':Sequelize[_0x5026('0x3')](_0x5026('0x4'),'Google',_0x5026('0x5')),'allowNull':![],'validate':{'notEmpty':!![]}},'type':{'type':Sequelize[_0x5026('0x3')](_0x5026('0x6'),'Dynamics365')},'data1':{'type':Sequelize[_0x5026('0x2')],'comment':_0x5026('0x7')},'data2':{'type':Sequelize[_0x5026('0x2')],'comment':_0x5026('0x8')},'data3':{'type':Sequelize[_0x5026('0x2')],'comment':_0x5026('0x9')},'data4':{'type':Sequelize[_0x5026('0x2')],'comment':_0x5026('0xa')},'data5':{'type':Sequelize[_0x5026('0xb')],'comment':_0x5026('0xc')},'data6':{'type':Sequelize[_0x5026('0xb')],'comment':_0x5026('0xd')},'data7':{'type':Sequelize[_0x5026('0xb')],'comment':_0x5026('0xe')}}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.controller.js b/server/api/cloudProvider/cloudProvider.controller.js index c814d7c..4af4d68 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 _0xfd60=['MicrosoftAzure','decryptString','data3','catch','keys','CloudProvider','attributes','fields','find','service','create','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','encryptString','params','findOne','oauth2MicrosoftCallback','get','state','Invalid\x20state\x20parameter','parse','from','toString','ascii','id_token','oauth2Claims','Unable\x20to\x20validate\x20id_token','del','code','data5','access_token','data6','refresh_token','emit','microsoftAuthorization:success','Invalid\x20authentication\x20state\x20parameter','message','stringify','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','api','../../mysqldb','./cloudProvider.oauth','redis','defaults','localhost','socket.io-emitter','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','update','then','destroy','error','name','send','padEnd','map','rawAttributes','fieldName','type','key','model','query','filters','intersection','length','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','includeAll','include','findAll','rows'];(function(_0x5e1bc0,_0x103ecf){var _0xc3685f=function(_0x4767a3){while(--_0x4767a3){_0x5e1bc0['push'](_0x5e1bc0['shift']());}};_0xc3685f(++_0x103ecf);}(_0xfd60,0xe2));var _0x0fd6=function(_0x43941d,_0x45fd0d){_0x43941d=_0x43941d-0x0;var _0x27b82a=_0xfd60[_0x43941d];return _0x27b82a;};'use strict';var _=require('lodash');var Redis=require(_0x0fd6('0x0'));var qs=require(_0x0fd6('0x1'));var encryptor=require(_0x0fd6('0x2'));var config=require(_0x0fd6('0x3'));var logger=require(_0x0fd6('0x4'))(_0x0fd6('0x5'));var db=require(_0x0fd6('0x6'))['db'];var oauth=require(_0x0fd6('0x7'));config[_0x0fd6('0x8')]=_[_0x0fd6('0x9')](config[_0x0fd6('0x8')],{'host':_0x0fd6('0xa'),'port':0x18eb});var socket=require(_0x0fd6('0xb'))(new Redis(config[_0x0fd6('0x8')]));var redis=new Redis(config[_0x0fd6('0x8')]);function respondWithStatusCode(_0x4e81b7,_0x3b91dd){_0x3b91dd=_0x3b91dd||0xcc;return function(_0x586d43){if(_0x586d43){return _0x4e81b7[_0x0fd6('0xc')](_0x3b91dd);}return _0x4e81b7['status'](_0x3b91dd)[_0x0fd6('0xd')]();};}function respondWithResult(_0x540bc1,_0x120ae8){_0x120ae8=_0x120ae8||0xc8;return function(_0x30f4eb){if(_0x30f4eb){return _0x540bc1[_0x0fd6('0xe')](_0x120ae8)[_0x0fd6('0xf')](_0x30f4eb);}};}function respondWithFilteredResult(_0x4c9ed2,_0x59c873){return function(_0x4a43b1){if(_0x4a43b1){var _0x5de61c=typeof _0x59c873[_0x0fd6('0x10')]===_0x0fd6('0x11')&&typeof _0x59c873[_0x0fd6('0x12')]==='undefined';var _0x4dde80=_0x4a43b1[_0x0fd6('0x13')];var _0x5a055f=_0x5de61c?0x0:_0x59c873[_0x0fd6('0x10')];var _0x292bc1=_0x5de61c?_0x4a43b1[_0x0fd6('0x13')]:_0x59c873['offset']+_0x59c873[_0x0fd6('0x12')];var _0x4ebc63;if(_0x292bc1>=_0x4dde80){_0x292bc1=_0x4dde80;_0x4ebc63=0xc8;}else{_0x4ebc63=0xce;}_0x4c9ed2[_0x0fd6('0xe')](_0x4ebc63);return _0x4c9ed2['set'](_0x0fd6('0x14'),_0x5a055f+'-'+_0x292bc1+'/'+_0x4dde80)['json'](_0x4a43b1);}return null;};}function saveUpdates(_0xe52b67){return function(_0x5df0d4){if(_0x5df0d4){return _0x5df0d4[_0x0fd6('0x15')](_0xe52b67)[_0x0fd6('0x16')](function(_0x30896b){return _0x30896b;});}return null;};}function removeEntity(_0x4316db){return function(_0x7052bb){if(_0x7052bb){return _0x7052bb[_0x0fd6('0x17')]()['then'](function(){_0x4316db[_0x0fd6('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39b8af){return function(_0x1d8079){if(!_0x1d8079){_0x39b8af[_0x0fd6('0xc')](0x194);}return _0x1d8079;};}function handleError(_0x4dd12c,_0x3f4c46){_0x3f4c46=_0x3f4c46||0x1f4;return function(_0x454a8c){logger[_0x0fd6('0x18')](_0x454a8c['stack']);if(_0x454a8c[_0x0fd6('0x19')]){delete _0x454a8c['name'];}_0x4dd12c[_0x0fd6('0xe')](_0x3f4c46)[_0x0fd6('0x1a')](_0x454a8c);};}function maskClientSecret(_0x20735a){return _[_0x0fd6('0x1b')](_0x20735a['slice'](0x0,0x3),0x14,'*');}exports['index']=function(_0x42986e,_0x14bda2){var _0x3919bb={},_0x2f9e71={},_0x13dc78={'count':0x0,'rows':[]};var _0xbe653a=_[_0x0fd6('0x1c')](db['CloudProvider'][_0x0fd6('0x1d')],function(_0x4b8d40){return{'name':_0x4b8d40[_0x0fd6('0x1e')],'type':_0x4b8d40[_0x0fd6('0x1f')][_0x0fd6('0x20')]};});_0x2f9e71[_0x0fd6('0x21')]=_[_0x0fd6('0x1c')](_0xbe653a,_0x0fd6('0x19'));_0x2f9e71[_0x0fd6('0x22')]=_['keys'](_0x42986e[_0x0fd6('0x22')]);_0x2f9e71[_0x0fd6('0x23')]=_['intersection'](_0x2f9e71[_0x0fd6('0x21')],_0x2f9e71[_0x0fd6('0x22')]);_0x3919bb['attributes']=_[_0x0fd6('0x24')](_0x2f9e71[_0x0fd6('0x21')],qs['fields'](_0x42986e['query']['fields']));_0x3919bb['attributes']=_0x3919bb['attributes'][_0x0fd6('0x25')]?_0x3919bb['attributes']:_0x2f9e71[_0x0fd6('0x21')];if(!_0x42986e['query']['hasOwnProperty'](_0x0fd6('0x26'))){_0x3919bb[_0x0fd6('0x12')]=qs[_0x0fd6('0x12')](_0x42986e[_0x0fd6('0x22')][_0x0fd6('0x12')]);_0x3919bb[_0x0fd6('0x10')]=qs[_0x0fd6('0x10')](_0x42986e[_0x0fd6('0x22')][_0x0fd6('0x10')]);}_0x3919bb[_0x0fd6('0x27')]=qs['sort'](_0x42986e[_0x0fd6('0x22')][_0x0fd6('0x28')]);_0x3919bb['where']=qs[_0x0fd6('0x23')](_[_0x0fd6('0x29')](_0x42986e['query'],_0x2f9e71['filters']),_0xbe653a);if(_0x42986e[_0x0fd6('0x22')]['filter']){_0x3919bb[_0x0fd6('0x2a')]=_[_0x0fd6('0x2b')](_0x3919bb[_0x0fd6('0x2a')],{'$or':_[_0x0fd6('0x1c')](_0xbe653a,function(_0x2bebf9){if(_0x2bebf9[_0x0fd6('0x1f')]!==_0x0fd6('0x2c')){var _0x16112b={};_0x16112b[_0x2bebf9[_0x0fd6('0x19')]]={'$like':'%'+_0x42986e[_0x0fd6('0x22')][_0x0fd6('0x2d')]+'%'};return _0x16112b;}})});}_0x3919bb=_[_0x0fd6('0x2b')]({},_0x3919bb,_0x42986e['options']);var _0x4d53ff={'where':_0x3919bb[_0x0fd6('0x2a')]};return db['CloudProvider'][_0x0fd6('0x13')](_0x4d53ff)['then'](function(_0x5ab885){_0x13dc78[_0x0fd6('0x13')]=_0x5ab885;if(_0x42986e['query'][_0x0fd6('0x2e')]){_0x3919bb[_0x0fd6('0x2f')]=[{'all':!![]}];}return db['CloudProvider'][_0x0fd6('0x30')](_0x3919bb);})[_0x0fd6('0x16')](function(_0x513317){_0x13dc78[_0x0fd6('0x31')]=_[_0x0fd6('0x1c')](_0x513317,function(_0x17c827){if(_0x17c827['service']===_0x0fd6('0x32')){var _0x44eb6d=encryptor[_0x0fd6('0x33')](_0x17c827[_0x0fd6('0x34')]);_0x17c827['data3']=maskClientSecret(_0x44eb6d);}return _0x17c827;});return _0x13dc78;})[_0x0fd6('0x16')](respondWithFilteredResult(_0x14bda2,_0x3919bb))[_0x0fd6('0x35')](handleError(_0x14bda2,null));};exports['show']=function(_0x10244f,_0x5a1eba){var _0x5829d9={'raw':!![],'where':{'id':_0x10244f['params']['id']}},_0x13de3c={};_0x13de3c[_0x0fd6('0x21')]=_[_0x0fd6('0x36')](db[_0x0fd6('0x37')][_0x0fd6('0x1d')]);_0x13de3c['query']=_['keys'](_0x10244f[_0x0fd6('0x22')]);_0x13de3c[_0x0fd6('0x23')]=_['intersection'](_0x13de3c[_0x0fd6('0x21')],_0x13de3c[_0x0fd6('0x22')]);_0x5829d9[_0x0fd6('0x38')]=_[_0x0fd6('0x24')](_0x13de3c[_0x0fd6('0x21')],qs[_0x0fd6('0x39')](_0x10244f[_0x0fd6('0x22')][_0x0fd6('0x39')]));_0x5829d9[_0x0fd6('0x38')]=_0x5829d9[_0x0fd6('0x38')]['length']?_0x5829d9[_0x0fd6('0x38')]:_0x13de3c[_0x0fd6('0x21')];if(_0x10244f['query'][_0x0fd6('0x2e')]){_0x5829d9[_0x0fd6('0x2f')]=[{'all':!![]}];}_0x5829d9=_[_0x0fd6('0x2b')]({},_0x5829d9,_0x10244f['options']);return db[_0x0fd6('0x37')][_0x0fd6('0x3a')](_0x5829d9)[_0x0fd6('0x16')](handleEntityNotFound(_0x5a1eba,null))['then'](function(_0x387e94){if(_0x387e94[_0x0fd6('0x3b')]===_0x0fd6('0x32')){var _0x10cd04=encryptor[_0x0fd6('0x33')](_0x387e94['data3']);_0x387e94[_0x0fd6('0x34')]=maskClientSecret(_0x10cd04);}return _0x387e94;})['then'](respondWithResult(_0x5a1eba,null))[_0x0fd6('0x35')](handleError(_0x5a1eba,null));};exports[_0x0fd6('0x3c')]=function(_0x18452d,_0x14a289){if(!_0x18452d[_0x0fd6('0x3d')][_0x0fd6('0x19')])throw new Error(_0x0fd6('0x3e'));if(!_0x18452d[_0x0fd6('0x3d')][_0x0fd6('0x3b')])throw new Error(_0x0fd6('0x3f'));var _0x674186=db[_0x0fd6('0x37')][_0x0fd6('0x1d')]['service']['values'];if(!_0x674186[_0x0fd6('0x40')](_0x18452d[_0x0fd6('0x3d')][_0x0fd6('0x3b')]))throw new Error(_0x0fd6('0x41')+_0x674186[_0x0fd6('0x42')](',\x20'));if(_0x18452d['body'][_0x0fd6('0x3b')]===_0x0fd6('0x32')&&_0x18452d[_0x0fd6('0x3d')][_0x0fd6('0x34')]){_0x18452d[_0x0fd6('0x3d')][_0x0fd6('0x34')]=encryptor[_0x0fd6('0x43')](_0x18452d['body'][_0x0fd6('0x34')]);}return db[_0x0fd6('0x37')][_0x0fd6('0x3c')](_0x18452d[_0x0fd6('0x3d')],{})[_0x0fd6('0x16')](respondWithResult(_0x14a289,0xc9))[_0x0fd6('0x35')](handleError(_0x14a289,null));};exports[_0x0fd6('0x15')]=function(_0x4990b,_0x1eda8a){if(_0x4990b[_0x0fd6('0x3d')]['id']){delete _0x4990b[_0x0fd6('0x3d')]['id'];}return db[_0x0fd6('0x37')][_0x0fd6('0x3a')]({'where':{'id':_0x4990b[_0x0fd6('0x44')]['id']}})[_0x0fd6('0x16')](handleEntityNotFound(_0x1eda8a,null))['then'](function(_0x469ca9){if(_0x469ca9[_0x0fd6('0x3b')]===_0x0fd6('0x32')&&_0x4990b[_0x0fd6('0x3d')][_0x0fd6('0x34')]){_0x4990b[_0x0fd6('0x3d')]['data3']=encryptor[_0x0fd6('0x43')](_0x4990b[_0x0fd6('0x3d')]['data3']);}return _0x469ca9;})[_0x0fd6('0x16')](saveUpdates(_0x4990b[_0x0fd6('0x3d')],null))[_0x0fd6('0x16')](respondWithResult(_0x1eda8a,null))['catch'](handleError(_0x1eda8a,null));};exports[_0x0fd6('0x17')]=function(_0x2465fb,_0x37702a){return db[_0x0fd6('0x37')][_0x0fd6('0x3a')]({'where':{'id':_0x2465fb[_0x0fd6('0x44')]['id']}})[_0x0fd6('0x16')](handleEntityNotFound(_0x37702a,null))[_0x0fd6('0x16')](removeEntity(_0x37702a,null))['catch'](handleError(_0x37702a,null));};exports['oauth2MicrosoftAuthorize']=function(_0x58583f,_0x3bbee7){return db[_0x0fd6('0x37')][_0x0fd6('0x45')]({'where':{'id':_0x58583f[_0x0fd6('0x44')]['id']},'raw':!![]})[_0x0fd6('0x16')](function(_0x20b75c){if(!_0x20b75c)return _0x3bbee7['sendStatus'](0x194);return{'url':oauth['generateMicrosoftAuthorizationUrl'](_0x20b75c,_0x58583f['user']['id'])};})[_0x0fd6('0x16')](respondWithResult(_0x3bbee7,null))[_0x0fd6('0x35')](handleError(_0x3bbee7,null));};exports[_0x0fd6('0x46')]=function(_0x59732a,_0x20c4aa){var _0x5e1540=_0x59732a[_0x0fd6('0x3d')];var _0x512d46;var _0x13d681;if(_0x5e1540[_0x0fd6('0x18')])throw _0x5e1540;redis[_0x0fd6('0x47')](_0x5e1540[_0x0fd6('0x48')])[_0x0fd6('0x16')](function(_0x129c48){if(!_0x129c48)throw new Error(_0x0fd6('0x49'));_0x512d46=JSON[_0x0fd6('0x4a')](_0x129c48);var _0x53d554=Buffer[_0x0fd6('0x4b')](_0x5e1540[_0x0fd6('0x48')],'base64')[_0x0fd6('0x4c')](_0x0fd6('0x4d'));_0x13d681=JSON[_0x0fd6('0x4a')](_0x53d554);if(!oauth['isValidIdToken'](_0x5e1540[_0x0fd6('0x4e')],_0x512d46[_0x0fd6('0x4f')]))throw new Error(_0x0fd6('0x50'));redis[_0x0fd6('0x51')](_0x5e1540[_0x0fd6('0x48')]);return oauth['getOauth2MicrosoftAccessToken'](_0x5e1540[_0x0fd6('0x52')],_0x512d46);})[_0x0fd6('0x16')](function(_0x2deb81){_0x512d46[_0x0fd6('0x53')]=_0x2deb81[_0x0fd6('0x54')];_0x512d46[_0x0fd6('0x55')]=_0x2deb81[_0x0fd6('0x56')];return db[_0x0fd6('0x37')][_0x0fd6('0x15')]({'data5':_0x512d46[_0x0fd6('0x53')],'data6':_0x512d46['data6']},{'where':{'id':_0x512d46['id']}});})[_0x0fd6('0x16')](function(){oauth['startRefreshInterval'](_0x512d46);socket[_0x0fd6('0x57')](_0x0fd6('0x58'),{'id':_0x13d681['id']});return;})[_0x0fd6('0x16')](respondWithStatusCode(_0x20c4aa,null))[_0x0fd6('0x35')](function(_0x379450){if(_0x13d681){socket[_0x0fd6('0x57')]('microsoftAuthorization:error',{'id':_0x13d681['id']});}if(!_0x512d46){logger['error'](_0x0fd6('0x59'),_0x379450);return _0x20c4aa['status'](0x1f4)[_0x0fd6('0x1a')](_0x379450[_0x0fd6('0x5a')]);}logger[_0x0fd6('0x18')]('Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s',_0x512d46['id'],JSON[_0x0fd6('0x5b')](_0x379450));});}; \ No newline at end of file +var _0x7cd3=['type','key','query','filters','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','filter','options','include','findAll','service','data3','catch','show','params','keys','includeAll','find','decryptString','body','Name\x20parameter\x20not\x20specified','Service\x20parameter\x20not\x20specified','values','includes','Invalid\x20service\x20parameter.\x20Allowed\x20values:\x20','join','MicrosoftAzure','encryptString','create','oauth2MicrosoftAuthorize','findOne','generateMicrosoftAuthorizationUrl','user','get','state','Invalid\x20state\x20parameter','parse','base64','toString','ascii','id_token','Unable\x20to\x20validate\x20id_token','getOauth2MicrosoftAccessToken','code','data5','access_token','data6','refresh_token','startRefreshInterval','microsoftAuthorization:success','microsoftAuthorization:error','Invalid\x20authentication\x20state\x20parameter','message','Authentication\x20failed\x20for\x20cloud\x20provider\x20#%s,\x20err:%s','stringify','lodash','ioredis','../../components/parsers/qs','../../components/encryptor','../../config/environment','../../config/logger','../../mysqldb','redis','localhost','sendStatus','status','end','json','offset','undefined','limit','count','set','update','then','destroy','error','stack','name','send','padEnd','slice','map','CloudProvider','rawAttributes'];(function(_0x1d3046,_0x8b14e1){var _0x3b9b62=function(_0xb69d69){while(--_0xb69d69){_0x1d3046['push'](_0x1d3046['shift']());}};_0x3b9b62(++_0x8b14e1);}(_0x7cd3,0x156));var _0x37cd=function(_0x4c655b,_0x47f61e){_0x4c655b=_0x4c655b-0x0;var _0x52a131=_0x7cd3[_0x4c655b];return _0x52a131;};'use strict';var _=require(_0x37cd('0x0'));var Redis=require(_0x37cd('0x1'));var qs=require(_0x37cd('0x2'));var encryptor=require(_0x37cd('0x3'));var config=require(_0x37cd('0x4'));var logger=require(_0x37cd('0x5'))('api');var db=require(_0x37cd('0x6'))['db'];var oauth=require('./cloudProvider.oauth');config[_0x37cd('0x7')]=_['defaults'](config[_0x37cd('0x7')],{'host':_0x37cd('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x37cd('0x7')]));var redis=new Redis(config[_0x37cd('0x7')]);function respondWithStatusCode(_0x1c585e,_0x3a0555){_0x3a0555=_0x3a0555||0xcc;return function(_0x1b7016){if(_0x1b7016){return _0x1c585e[_0x37cd('0x9')](_0x3a0555);}return _0x1c585e[_0x37cd('0xa')](_0x3a0555)[_0x37cd('0xb')]();};}function respondWithResult(_0x28c4aa,_0xc8cb99){_0xc8cb99=_0xc8cb99||0xc8;return function(_0x58a479){if(_0x58a479){return _0x28c4aa[_0x37cd('0xa')](_0xc8cb99)[_0x37cd('0xc')](_0x58a479);}};}function respondWithFilteredResult(_0x20ce4a,_0x376ec4){return function(_0x2a9523){if(_0x2a9523){var _0x5ab46f=typeof _0x376ec4[_0x37cd('0xd')]===_0x37cd('0xe')&&typeof _0x376ec4[_0x37cd('0xf')]===_0x37cd('0xe');var _0x4f7555=_0x2a9523[_0x37cd('0x10')];var _0x6352e6=_0x5ab46f?0x0:_0x376ec4['offset'];var _0x3e0acc=_0x5ab46f?_0x2a9523[_0x37cd('0x10')]:_0x376ec4[_0x37cd('0xd')]+_0x376ec4[_0x37cd('0xf')];var _0x5efcc1;if(_0x3e0acc>=_0x4f7555){_0x3e0acc=_0x4f7555;_0x5efcc1=0xc8;}else{_0x5efcc1=0xce;}_0x20ce4a[_0x37cd('0xa')](_0x5efcc1);return _0x20ce4a[_0x37cd('0x11')]('Content-Range',_0x6352e6+'-'+_0x3e0acc+'/'+_0x4f7555)[_0x37cd('0xc')](_0x2a9523);}return null;};}function saveUpdates(_0x34501f){return function(_0x199dc8){if(_0x199dc8){return _0x199dc8[_0x37cd('0x12')](_0x34501f)[_0x37cd('0x13')](function(_0x17897d){return _0x17897d;});}return null;};}function removeEntity(_0xfddbcd){return function(_0x243f56){if(_0x243f56){return _0x243f56[_0x37cd('0x14')]()[_0x37cd('0x13')](function(){_0xfddbcd['status'](0xcc)[_0x37cd('0xb')]();});}};}function handleEntityNotFound(_0x1d472a){return function(_0x8e932f){if(!_0x8e932f){_0x1d472a[_0x37cd('0x9')](0x194);}return _0x8e932f;};}function handleError(_0x4118bc,_0x2f4a10){_0x2f4a10=_0x2f4a10||0x1f4;return function(_0x4af0ea){logger[_0x37cd('0x15')](_0x4af0ea[_0x37cd('0x16')]);if(_0x4af0ea[_0x37cd('0x17')]){delete _0x4af0ea[_0x37cd('0x17')];}_0x4118bc['status'](_0x2f4a10)[_0x37cd('0x18')](_0x4af0ea);};}function maskClientSecret(_0x111495){return _[_0x37cd('0x19')](_0x111495[_0x37cd('0x1a')](0x0,0x3),0x14,'*');}exports['index']=function(_0x1d1ace,_0x53c998){var _0x2866e1={},_0x2661dd={},_0xaed9a3={'count':0x0,'rows':[]};var _0x4d9256=_[_0x37cd('0x1b')](db[_0x37cd('0x1c')][_0x37cd('0x1d')],function(_0x4a48f4){return{'name':_0x4a48f4['fieldName'],'type':_0x4a48f4[_0x37cd('0x1e')][_0x37cd('0x1f')]};});_0x2661dd['model']=_['map'](_0x4d9256,_0x37cd('0x17'));_0x2661dd[_0x37cd('0x20')]=_['keys'](_0x1d1ace[_0x37cd('0x20')]);_0x2661dd[_0x37cd('0x21')]=_['intersection'](_0x2661dd[_0x37cd('0x22')],_0x2661dd[_0x37cd('0x20')]);_0x2866e1[_0x37cd('0x23')]=_['intersection'](_0x2661dd[_0x37cd('0x22')],qs[_0x37cd('0x24')](_0x1d1ace[_0x37cd('0x20')][_0x37cd('0x24')]));_0x2866e1[_0x37cd('0x23')]=_0x2866e1['attributes'][_0x37cd('0x25')]?_0x2866e1[_0x37cd('0x23')]:_0x2661dd['model'];if(!_0x1d1ace[_0x37cd('0x20')][_0x37cd('0x26')]('nolimit')){_0x2866e1['limit']=qs[_0x37cd('0xf')](_0x1d1ace[_0x37cd('0x20')][_0x37cd('0xf')]);_0x2866e1['offset']=qs[_0x37cd('0xd')](_0x1d1ace[_0x37cd('0x20')][_0x37cd('0xd')]);}_0x2866e1[_0x37cd('0x27')]=qs[_0x37cd('0x28')](_0x1d1ace['query']['sort']);_0x2866e1[_0x37cd('0x29')]=qs[_0x37cd('0x21')](_[_0x37cd('0x2a')](_0x1d1ace[_0x37cd('0x20')],_0x2661dd[_0x37cd('0x21')]),_0x4d9256);if(_0x1d1ace['query']['filter']){_0x2866e1['where']=_[_0x37cd('0x2b')](_0x2866e1[_0x37cd('0x29')],{'$or':_['map'](_0x4d9256,function(_0xdd1d73){if(_0xdd1d73['type']!=='VIRTUAL'){var _0x178f90={};_0x178f90[_0xdd1d73[_0x37cd('0x17')]]={'$like':'%'+_0x1d1ace[_0x37cd('0x20')][_0x37cd('0x2c')]+'%'};return _0x178f90;}})});}_0x2866e1=_[_0x37cd('0x2b')]({},_0x2866e1,_0x1d1ace[_0x37cd('0x2d')]);var _0x4ec47d={'where':_0x2866e1[_0x37cd('0x29')]};return db[_0x37cd('0x1c')][_0x37cd('0x10')](_0x4ec47d)[_0x37cd('0x13')](function(_0x265b86){_0xaed9a3[_0x37cd('0x10')]=_0x265b86;if(_0x1d1ace[_0x37cd('0x20')]['includeAll']){_0x2866e1[_0x37cd('0x2e')]=[{'all':!![]}];}return db[_0x37cd('0x1c')][_0x37cd('0x2f')](_0x2866e1);})['then'](function(_0x37dbf1){_0xaed9a3['rows']=_[_0x37cd('0x1b')](_0x37dbf1,function(_0x2e98c4){if(_0x2e98c4[_0x37cd('0x30')]==='MicrosoftAzure'){var _0x43e5b1=encryptor['decryptString'](_0x2e98c4['data3']);_0x2e98c4[_0x37cd('0x31')]=maskClientSecret(_0x43e5b1);}return _0x2e98c4;});return _0xaed9a3;})[_0x37cd('0x13')](respondWithFilteredResult(_0x53c998,_0x2866e1))[_0x37cd('0x32')](handleError(_0x53c998,null));};exports[_0x37cd('0x33')]=function(_0xdc33e8,_0x1b6a2a){var _0x119d21={'raw':!![],'where':{'id':_0xdc33e8[_0x37cd('0x34')]['id']}},_0x216a79={};_0x216a79[_0x37cd('0x22')]=_['keys'](db[_0x37cd('0x1c')][_0x37cd('0x1d')]);_0x216a79['query']=_[_0x37cd('0x35')](_0xdc33e8[_0x37cd('0x20')]);_0x216a79[_0x37cd('0x21')]=_['intersection'](_0x216a79[_0x37cd('0x22')],_0x216a79['query']);_0x119d21['attributes']=_['intersection'](_0x216a79[_0x37cd('0x22')],qs[_0x37cd('0x24')](_0xdc33e8[_0x37cd('0x20')][_0x37cd('0x24')]));_0x119d21[_0x37cd('0x23')]=_0x119d21['attributes']['length']?_0x119d21['attributes']:_0x216a79[_0x37cd('0x22')];if(_0xdc33e8['query'][_0x37cd('0x36')]){_0x119d21[_0x37cd('0x2e')]=[{'all':!![]}];}_0x119d21=_[_0x37cd('0x2b')]({},_0x119d21,_0xdc33e8[_0x37cd('0x2d')]);return db['CloudProvider'][_0x37cd('0x37')](_0x119d21)['then'](handleEntityNotFound(_0x1b6a2a,null))[_0x37cd('0x13')](function(_0x2ae6b4){if(_0x2ae6b4[_0x37cd('0x30')]==='MicrosoftAzure'){var _0x302c80=encryptor[_0x37cd('0x38')](_0x2ae6b4[_0x37cd('0x31')]);_0x2ae6b4[_0x37cd('0x31')]=maskClientSecret(_0x302c80);}return _0x2ae6b4;})[_0x37cd('0x13')](respondWithResult(_0x1b6a2a,null))[_0x37cd('0x32')](handleError(_0x1b6a2a,null));};exports['create']=function(_0x6850c,_0x2fd543){if(!_0x6850c[_0x37cd('0x39')]['name'])throw new Error(_0x37cd('0x3a'));if(!_0x6850c[_0x37cd('0x39')][_0x37cd('0x30')])throw new Error(_0x37cd('0x3b'));var _0x3d30a8=db['CloudProvider'][_0x37cd('0x1d')]['service'][_0x37cd('0x3c')];if(!_0x3d30a8[_0x37cd('0x3d')](_0x6850c['body']['service']))throw new Error(_0x37cd('0x3e')+_0x3d30a8[_0x37cd('0x3f')](',\x20'));if(_0x6850c['body'][_0x37cd('0x30')]===_0x37cd('0x40')&&_0x6850c[_0x37cd('0x39')][_0x37cd('0x31')]){_0x6850c[_0x37cd('0x39')][_0x37cd('0x31')]=encryptor[_0x37cd('0x41')](_0x6850c[_0x37cd('0x39')][_0x37cd('0x31')]);}return db[_0x37cd('0x1c')][_0x37cd('0x42')](_0x6850c[_0x37cd('0x39')],{})['then'](respondWithResult(_0x2fd543,0xc9))[_0x37cd('0x32')](handleError(_0x2fd543,null));};exports['update']=function(_0x560c17,_0x3f8ad0){if(_0x560c17[_0x37cd('0x39')]['id']){delete _0x560c17['body']['id'];}return db['CloudProvider'][_0x37cd('0x37')]({'where':{'id':_0x560c17[_0x37cd('0x34')]['id']}})[_0x37cd('0x13')](handleEntityNotFound(_0x3f8ad0,null))['then'](function(_0x51ac2c){if(_0x51ac2c[_0x37cd('0x30')]==='MicrosoftAzure'&&_0x560c17[_0x37cd('0x39')][_0x37cd('0x31')]){_0x560c17[_0x37cd('0x39')][_0x37cd('0x31')]=encryptor[_0x37cd('0x41')](_0x560c17[_0x37cd('0x39')][_0x37cd('0x31')]);}return _0x51ac2c;})['then'](saveUpdates(_0x560c17['body'],null))['then'](respondWithResult(_0x3f8ad0,null))[_0x37cd('0x32')](handleError(_0x3f8ad0,null));};exports[_0x37cd('0x14')]=function(_0x593998,_0x379c3f){return db[_0x37cd('0x1c')]['find']({'where':{'id':_0x593998[_0x37cd('0x34')]['id']}})[_0x37cd('0x13')](handleEntityNotFound(_0x379c3f,null))['then'](removeEntity(_0x379c3f,null))[_0x37cd('0x32')](handleError(_0x379c3f,null));};exports[_0x37cd('0x43')]=function(_0x675ec,_0x2d8e7c){return db[_0x37cd('0x1c')][_0x37cd('0x44')]({'where':{'id':_0x675ec[_0x37cd('0x34')]['id']},'raw':!![]})[_0x37cd('0x13')](function(_0x21fe35){if(!_0x21fe35)return _0x2d8e7c[_0x37cd('0x9')](0x194);return{'url':oauth[_0x37cd('0x45')](_0x21fe35,_0x675ec[_0x37cd('0x46')]['id'])};})['then'](respondWithResult(_0x2d8e7c,null))['catch'](handleError(_0x2d8e7c,null));};exports['oauth2MicrosoftCallback']=function(_0x215fce,_0x1eedcc){var _0x463120=_0x215fce[_0x37cd('0x39')];var _0x411ea8;var _0x577868;if(_0x463120[_0x37cd('0x15')])throw _0x463120;redis[_0x37cd('0x47')](_0x463120[_0x37cd('0x48')])['then'](function(_0x7ad407){if(!_0x7ad407)throw new Error(_0x37cd('0x49'));_0x411ea8=JSON[_0x37cd('0x4a')](_0x7ad407);var _0x307281=Buffer['from'](_0x463120[_0x37cd('0x48')],_0x37cd('0x4b'))[_0x37cd('0x4c')](_0x37cd('0x4d'));_0x577868=JSON['parse'](_0x307281);if(!oauth['isValidIdToken'](_0x463120[_0x37cd('0x4e')],_0x411ea8['oauth2Claims']))throw new Error(_0x37cd('0x4f'));redis['del'](_0x463120['state']);return oauth[_0x37cd('0x50')](_0x463120[_0x37cd('0x51')],_0x411ea8);})[_0x37cd('0x13')](function(_0x58697f){_0x411ea8[_0x37cd('0x52')]=_0x58697f[_0x37cd('0x53')];_0x411ea8[_0x37cd('0x54')]=_0x58697f[_0x37cd('0x55')];return db[_0x37cd('0x1c')]['update']({'data5':_0x411ea8[_0x37cd('0x52')],'data6':_0x411ea8[_0x37cd('0x54')]},{'where':{'id':_0x411ea8['id']}});})['then'](function(){oauth[_0x37cd('0x56')](_0x411ea8);socket['emit'](_0x37cd('0x57'),{'id':_0x577868['id']});return;})[_0x37cd('0x13')](respondWithStatusCode(_0x1eedcc,null))[_0x37cd('0x32')](function(_0x28dc24){if(_0x577868){socket['emit'](_0x37cd('0x58'),{'id':_0x577868['id']});}if(!_0x411ea8){logger[_0x37cd('0x15')](_0x37cd('0x59'),_0x28dc24);return _0x1eedcc[_0x37cd('0xa')](0x1f4)['send'](_0x28dc24[_0x37cd('0x5a')]);}logger[_0x37cd('0x15')](_0x37cd('0x5b'),_0x411ea8['id'],JSON[_0x37cd('0x5c')](_0x28dc24));});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.model.js b/server/api/cloudProvider/cloudProvider.model.js index 2356e37..ad56f36 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 _0x6c87=['../../config/logger','moment','bluebird','request-promise','path','../../config/environment','./cloudProvider.attributes','exports','define','CloudProvider','util'];(function(_0x9333e2,_0x533acc){var _0xa4a57a=function(_0x27ca38){while(--_0x27ca38){_0x9333e2['push'](_0x9333e2['shift']());}};_0xa4a57a(++_0x533acc);}(_0x6c87,0xdb));var _0x76c8=function(_0x572bbe,_0x3da3b2){_0x572bbe=_0x572bbe-0x0;var _0x6b4827=_0x6c87[_0x572bbe];return _0x6b4827;};'use strict';var _=require('lodash');var util=require(_0x76c8('0x0'));var logger=require(_0x76c8('0x1'))('api');var moment=require(_0x76c8('0x2'));var BPromise=require(_0x76c8('0x3'));var rp=require(_0x76c8('0x4'));var fs=require('fs');var path=require(_0x76c8('0x5'));var rimraf=require('rimraf');var config=require(_0x76c8('0x6'));var attributes=require(_0x76c8('0x7'));module[_0x76c8('0x8')]=function(_0x3116ed,_0x522e9c){return _0x3116ed[_0x76c8('0x9')](_0x76c8('0xa'),attributes,{'tableName':'cloud_providers','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9511=['api','moment','bluebird','request-promise','path','rimraf','./cloudProvider.attributes','exports','define','CloudProvider','cloud_providers','lodash','util'];(function(_0x47c5bf,_0x45977e){var _0x11b779=function(_0x1bd585){while(--_0x1bd585){_0x47c5bf['push'](_0x47c5bf['shift']());}};_0x11b779(++_0x45977e);}(_0x9511,0x1df));var _0x1951=function(_0x7bc4a8,_0x19022a){_0x7bc4a8=_0x7bc4a8-0x0;var _0x4a13e9=_0x9511[_0x7bc4a8];return _0x4a13e9;};'use strict';var _=require(_0x1951('0x0'));var util=require(_0x1951('0x1'));var logger=require('../../config/logger')(_0x1951('0x2'));var moment=require(_0x1951('0x3'));var BPromise=require(_0x1951('0x4'));var rp=require(_0x1951('0x5'));var fs=require('fs');var path=require(_0x1951('0x6'));var rimraf=require(_0x1951('0x7'));var config=require('../../config/environment');var attributes=require(_0x1951('0x8'));module[_0x1951('0x9')]=function(_0x96c7b2,_0x10effc){return _0x96c7b2[_0x1951('0xa')](_0x1951('0xb'),attributes,{'tableName':_0x1951('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.oauth.js b/server/api/cloudProvider/cloudProvider.oauth.js index 36bbe29..272e5c3 100644 --- a/server/api/cloudProvider/cloudProvider.oauth.js +++ b/server/api/cloudProvider/cloudProvider.oauth.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x29db=['email','offline_access','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','https://outlook.office.com/SMTP.Send','/authorize','/token','map','type','Dynamics365','data7','/.default','Outlook365','replace','{TENANT_ID}','data2','from','toString','base64','hex','client_id','data1','response_type','join','redirect_uri','data4','form_post','state','nonce','prompt','login','key','value','oauth2Claims','oauth2/','set','payload','iss','issuer','aud','audience','isAfter','unix','exp','then','data3','findOne','refresh_token','data6','decryptString','POST','access_token','CloudProvider','data5','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','jsonwebtoken','moment','request-promise','../../components/encryptor','../../config/environment','../../config/logger','api','../../config/schedule/cloud-provider','defaults','redis','localhost','profile'];(function(_0x46cad4,_0x2002aa){var _0x2468c6=function(_0x57f73a){while(--_0x57f73a){_0x46cad4['push'](_0x46cad4['shift']());}};_0x2468c6(++_0x2002aa);}(_0x29db,0x8d));var _0xb29d=function(_0x843b07,_0x155d72){_0x843b07=_0x843b07-0x0;var _0x3ed748=_0x29db[_0x843b07];return _0x3ed748;};'use strict';var _=require(_0xb29d('0x0'));var crypto=require('crypto');var jwt=require(_0xb29d('0x1'));var moment=require(_0xb29d('0x2'));var Redis=require('ioredis');var rp=require(_0xb29d('0x3'));var util=require('util');var encryptor=require(_0xb29d('0x4'));var config=require(_0xb29d('0x5'));var logger=require(_0xb29d('0x6'))(_0xb29d('0x7'));var schedule=require(_0xb29d('0x8'));var db=require('../../mysqldb')['db'];config['redis']=_[_0xb29d('0x9')](config[_0xb29d('0xa')],{'host':_0xb29d('0xb'),'port':0x18eb});var redis=new Redis(config[_0xb29d('0xa')]);var MICROSOFT_AUTH_URL='https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0';var AZURE_AUTH_SCOPES={'Outlook365':['openid',_0xb29d('0xc'),_0xb29d('0xd'),_0xb29d('0xe'),_0xb29d('0xf'),_0xb29d('0x10'),_0xb29d('0x11')],'Dynamics365':['openid',_0xb29d('0xe')]};var MICROSOFT_AUTH_ENDPOINT=_0xb29d('0x12');var MICROSOFT_TOKEN_ENDPOINT=_0xb29d('0x13');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x5c3e8f){var _0x2b9349=_[_0xb29d('0x14')](AZURE_AUTH_SCOPES[_0x5c3e8f[_0xb29d('0x15')]]);if(_0x5c3e8f[_0xb29d('0x15')]===_0xb29d('0x16'))_0x2b9349['push'](_0x5c3e8f[_0xb29d('0x17')]+_0xb29d('0x18'));return _0x2b9349['join']('\x20');}function getAccessTokenScope(_0x2b4f49){if(_0x2b4f49[_0xb29d('0x15')]===_0xb29d('0x19'))return _0xb29d('0xf');if(_0x2b4f49[_0xb29d('0x15')]==='Dynamics365')return _0x2b4f49['data7']+_0xb29d('0x18');}function generateMicrosoftAuthorizationUrl(_0x202318,_0x374394){var _0x29de33=MICROSOFT_AUTH_URL[_0xb29d('0x1a')](_0xb29d('0x1b'),_0x202318[_0xb29d('0x1c')]);var _0x5217e7=['code','id_token'];var _0x36673e=Buffer[_0xb29d('0x1d')](JSON['stringify']({'id':_0x374394}))[_0xb29d('0x1e')](_0xb29d('0x1f'));var _0xee9d5a=crypto['randomBytes'](0x10)[_0xb29d('0x1e')](_0xb29d('0x20'));var _0x5817cc=getAuthorizationScopes(_0x202318);var _0x343ccd=[{'key':_0xb29d('0x21'),'value':_0x202318[_0xb29d('0x22')]},{'key':_0xb29d('0x23'),'value':encodeURIComponent(_0x5217e7[_0xb29d('0x24')]('\x20'))},{'key':_0xb29d('0x25'),'value':_0x202318[_0xb29d('0x26')]},{'key':'response_mode','value':_0xb29d('0x27')},{'key':'scope','value':encodeURIComponent(_0x5817cc)},{'key':_0xb29d('0x28'),'value':_0x36673e},{'key':_0xb29d('0x29'),'value':_0xee9d5a},{'key':_0xb29d('0x2a'),'value':_0xb29d('0x2b')}];var _0x4fbde8=_0x29de33+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xb29d('0x14')](_0x343ccd,function(_0x2dc158){return _0x2dc158[_0xb29d('0x2c')]+'='+_0x2dc158[_0xb29d('0x2d')];})[_0xb29d('0x24')]('&');_0x202318[_0xb29d('0x2e')]={'issuer':_0x29de33['replace'](_0xb29d('0x2f'),''),'audience':_0x202318['data1'],'state':_0x36673e,'nonce':_0xee9d5a};redis[_0xb29d('0x30')](_0x36673e,JSON['stringify'](_0x202318));return _0x4fbde8;}function isValidIdToken(_0x497441,_0x2be86a){try{var _0x52b105=jwt['decode'](_0x497441,{'complete':!![]});var _0x4ef3f4=_0x52b105[_0xb29d('0x31')];if(_0x4ef3f4[_0xb29d('0x32')]!==_0x2be86a[_0xb29d('0x33')])return![];if(_0x4ef3f4[_0xb29d('0x34')]!==_0x2be86a[_0xb29d('0x35')])return![];if(_0x4ef3f4['nonce']!==_0x2be86a[_0xb29d('0x29')])return![];if(moment()[_0xb29d('0x36')](moment[_0xb29d('0x37')](_0x4ef3f4[_0xb29d('0x38')])))return![];return!![];}catch(_0x9d2b6d){throw _0x9d2b6d;}}function refreshOauth2MicrosoftAccessToken(_0x383a16){return Promise['resolve']()[_0xb29d('0x39')](function(){if(_0x383a16[_0xb29d('0x3a')])return _0x383a16;return db['CloudProvider'][_0xb29d('0x3b')]({'where':{'id':_0x383a16['id']},'raw':!![]});})[_0xb29d('0x39')](function(_0xed6083){var _0x2fb545={'grant_type':_0xb29d('0x3c'),'refresh_token':_0xed6083[_0xb29d('0x3d')],'scope':getAccessTokenScope(_0xed6083),'redirect_uri':_0xed6083[_0xb29d('0x26')],'client_id':_0xed6083[_0xb29d('0x22')],'client_secret':encryptor[_0xb29d('0x3e')](_0xed6083[_0xb29d('0x3a')])};var _0x4444da={'method':_0xb29d('0x3f'),'uri':MICROSOFT_AUTH_URL[_0xb29d('0x1a')](_0xb29d('0x1b'),_0xed6083[_0xb29d('0x1c')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x2fb545,'json':!![]};return rp(_0x4444da);})['then'](function(_0x4ab342){_0x383a16['data5']=_0x4ab342[_0xb29d('0x40')];_0x383a16[_0xb29d('0x3d')]=_0x4ab342[_0xb29d('0x3c')];return db[_0xb29d('0x41')]['update']({'data5':_0x383a16[_0xb29d('0x42')],'data6':_0x383a16[_0xb29d('0x3d')]},{'where':{'id':_0x383a16['id']}});})[_0xb29d('0x39')](function(){return _0x383a16;})[_0xb29d('0x43')](function(_0x49d478){logger[_0xb29d('0x44')](_0xb29d('0x45'),_0x383a16['id'],_0x49d478);});}function getOauth2MicrosoftAccessToken(_0x46194c,_0x41872d){var _0x5ee4c8={'grant_type':_0xb29d('0x46'),'code':_0x46194c,'scope':getAccessTokenScope(_0x41872d),'redirect_uri':_0x41872d[_0xb29d('0x26')],'client_id':_0x41872d[_0xb29d('0x22')],'client_secret':encryptor['decryptString'](_0x41872d[_0xb29d('0x3a')])};var _0x2a6bc2={'method':_0xb29d('0x3f'),'uri':MICROSOFT_AUTH_URL['replace'](_0xb29d('0x1b'),_0x41872d['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x5ee4c8,'json':!![]};return rp(_0x2a6bc2);}function startRefreshInterval(_0x1fe968){var _0x3c0e04=schedule[_0xb29d('0x47')];if(_0x3c0e04[_0x1fe968['id']])clearInterval(_0x3c0e04[_0x1fe968['id']]);_0x3c0e04[_0x1fe968['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0x1fe968['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule[_0xb29d('0x47')]=_0x3c0e04;}function startAllRefreshIntervals(){return db[_0xb29d('0x41')][_0xb29d('0x48')]({'where':{'data6':{'$ne':null}},'raw':!![]})[_0xb29d('0x39')](function(_0x40ac5d){var _0x59affc=_0x40ac5d['map'](function(_0x3b7384){return refreshOauth2MicrosoftAccessToken(_0x3b7384)[_0xb29d('0x39')](function(_0x18cae6){startRefreshInterval(_0x18cae6);});});return Promise[_0xb29d('0x49')](_0x59affc);})[_0xb29d('0x43')](function(_0x10afdf){var _0x21b422=_0x10afdf?util[_0xb29d('0x4a')](_0x10afdf,{'showHidden':![],'depth':null}):'';logger[_0xb29d('0x44')](_0xb29d('0x4b'),_0x21b422);});}module[_0xb29d('0x4c')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file +var _0x26bd=['data6','decryptString','POST','data2','data5','access_token','catch','error','Failed\x20to\x20refresh\x20access\x20token\x20for\x20cloud\x20provider\x20#%s,\x20-\x20err:%s','authorization_code','intervals','findAll','all','inspect','[CLOUD_PROVIDER]\x20Error\x20while\x20refreshing\x20the\x20tokens\x20after\x20service\x20restart\x20error:%s','exports','lodash','crypto','jsonwebtoken','moment','ioredis','request-promise','util','../../components/encryptor','../../mysqldb','redis','defaults','localhost','https://login.microsoftonline.com/{TENANT_ID}/oauth2/v2.0','openid','profile','email','https://outlook.office365.com/IMAP.AccessAsUser.All','https://outlook.office.com/POP.AccessAsUser.All','offline_access','/authorize','/token','map','type','Dynamics365','push','data7','/.default','join','Outlook365','{TENANT_ID}','code','id_token','stringify','base64','toString','hex','client_id','data1','redirect_uri','data4','response_mode','form_post','state','prompt','key','oauth2Claims','replace','set','decode','iss','issuer','aud','audience','nonce','then','data3','CloudProvider','findOne','refresh_token'];(function(_0x226d27,_0x7229f){var _0xae723c=function(_0x209946){while(--_0x209946){_0x226d27['push'](_0x226d27['shift']());}};_0xae723c(++_0x7229f);}(_0x26bd,0x1d2));var _0xd26b=function(_0x742f13,_0x1344d8){_0x742f13=_0x742f13-0x0;var _0x236415=_0x26bd[_0x742f13];return _0x236415;};'use strict';var _=require(_0xd26b('0x0'));var crypto=require(_0xd26b('0x1'));var jwt=require(_0xd26b('0x2'));var moment=require(_0xd26b('0x3'));var Redis=require(_0xd26b('0x4'));var rp=require(_0xd26b('0x5'));var util=require(_0xd26b('0x6'));var encryptor=require(_0xd26b('0x7'));var config=require('../../config/environment');var logger=require('../../config/logger')('api');var schedule=require('../../config/schedule/cloud-provider');var db=require(_0xd26b('0x8'))['db'];config[_0xd26b('0x9')]=_[_0xd26b('0xa')](config['redis'],{'host':_0xd26b('0xb'),'port':0x18eb});var redis=new Redis(config[_0xd26b('0x9')]);var MICROSOFT_AUTH_URL=_0xd26b('0xc');var AZURE_AUTH_SCOPES={'Outlook365':[_0xd26b('0xd'),_0xd26b('0xe'),_0xd26b('0xf'),'offline_access',_0xd26b('0x10'),_0xd26b('0x11'),'https://outlook.office.com/SMTP.Send'],'Dynamics365':[_0xd26b('0xd'),_0xd26b('0x12')]};var MICROSOFT_AUTH_ENDPOINT=_0xd26b('0x13');var MICROSOFT_TOKEN_ENDPOINT=_0xd26b('0x14');var OAUTH_REFRESH_INTERVAL=0xfa;function getAuthorizationScopes(_0x484642){var _0x2e2f76=_[_0xd26b('0x15')](AZURE_AUTH_SCOPES[_0x484642[_0xd26b('0x16')]]);if(_0x484642[_0xd26b('0x16')]===_0xd26b('0x17'))_0x2e2f76[_0xd26b('0x18')](_0x484642[_0xd26b('0x19')]+_0xd26b('0x1a'));return _0x2e2f76[_0xd26b('0x1b')]('\x20');}function getAccessTokenScope(_0x28b3a1){if(_0x28b3a1[_0xd26b('0x16')]===_0xd26b('0x1c'))return _0xd26b('0x10');if(_0x28b3a1[_0xd26b('0x16')]===_0xd26b('0x17'))return _0x28b3a1[_0xd26b('0x19')]+'/.default';}function generateMicrosoftAuthorizationUrl(_0x51b6c4,_0x4dc42a){var _0x576f6f=MICROSOFT_AUTH_URL['replace'](_0xd26b('0x1d'),_0x51b6c4['data2']);var _0x332581=[_0xd26b('0x1e'),_0xd26b('0x1f')];var _0x588e3a=Buffer['from'](JSON[_0xd26b('0x20')]({'id':_0x4dc42a}))['toString'](_0xd26b('0x21'));var _0x1b20ff=crypto['randomBytes'](0x10)[_0xd26b('0x22')](_0xd26b('0x23'));var _0x1599a6=getAuthorizationScopes(_0x51b6c4);var _0x9095c9=[{'key':_0xd26b('0x24'),'value':_0x51b6c4[_0xd26b('0x25')]},{'key':'response_type','value':encodeURIComponent(_0x332581[_0xd26b('0x1b')]('\x20'))},{'key':_0xd26b('0x26'),'value':_0x51b6c4[_0xd26b('0x27')]},{'key':_0xd26b('0x28'),'value':_0xd26b('0x29')},{'key':'scope','value':encodeURIComponent(_0x1599a6)},{'key':_0xd26b('0x2a'),'value':_0x588e3a},{'key':'nonce','value':_0x1b20ff},{'key':_0xd26b('0x2b'),'value':'login'}];var _0xb8c7b2=_0x576f6f+MICROSOFT_AUTH_ENDPOINT+'?'+_[_0xd26b('0x15')](_0x9095c9,function(_0x84590f){return _0x84590f[_0xd26b('0x2c')]+'='+_0x84590f['value'];})['join']('&');_0x51b6c4[_0xd26b('0x2d')]={'issuer':_0x576f6f[_0xd26b('0x2e')]('oauth2/',''),'audience':_0x51b6c4[_0xd26b('0x25')],'state':_0x588e3a,'nonce':_0x1b20ff};redis[_0xd26b('0x2f')](_0x588e3a,JSON[_0xd26b('0x20')](_0x51b6c4));return _0xb8c7b2;}function isValidIdToken(_0x1ec083,_0x1b6f01){try{var _0x2a1da0=jwt[_0xd26b('0x30')](_0x1ec083,{'complete':!![]});var _0x446700=_0x2a1da0['payload'];if(_0x446700[_0xd26b('0x31')]!==_0x1b6f01[_0xd26b('0x32')])return![];if(_0x446700[_0xd26b('0x33')]!==_0x1b6f01[_0xd26b('0x34')])return![];if(_0x446700[_0xd26b('0x35')]!==_0x1b6f01[_0xd26b('0x35')])return![];if(moment()['isAfter'](moment['unix'](_0x446700['exp'])))return![];return!![];}catch(_0x3f5a73){throw _0x3f5a73;}}function refreshOauth2MicrosoftAccessToken(_0x4d968b){return Promise['resolve']()[_0xd26b('0x36')](function(){if(_0x4d968b[_0xd26b('0x37')])return _0x4d968b;return db[_0xd26b('0x38')][_0xd26b('0x39')]({'where':{'id':_0x4d968b['id']},'raw':!![]});})[_0xd26b('0x36')](function(_0x4bde23){var _0x51d767={'grant_type':_0xd26b('0x3a'),'refresh_token':_0x4bde23[_0xd26b('0x3b')],'scope':getAccessTokenScope(_0x4bde23),'redirect_uri':_0x4bde23['data4'],'client_id':_0x4bde23[_0xd26b('0x25')],'client_secret':encryptor[_0xd26b('0x3c')](_0x4bde23[_0xd26b('0x37')])};var _0x3a435e={'method':_0xd26b('0x3d'),'uri':MICROSOFT_AUTH_URL['replace']('{TENANT_ID}',_0x4bde23[_0xd26b('0x3e')])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x51d767,'json':!![]};return rp(_0x3a435e);})[_0xd26b('0x36')](function(_0x37a272){_0x4d968b[_0xd26b('0x3f')]=_0x37a272[_0xd26b('0x40')];_0x4d968b[_0xd26b('0x3b')]=_0x37a272['refresh_token'];return db['CloudProvider']['update']({'data5':_0x4d968b['data5'],'data6':_0x4d968b[_0xd26b('0x3b')]},{'where':{'id':_0x4d968b['id']}});})[_0xd26b('0x36')](function(){return _0x4d968b;})[_0xd26b('0x41')](function(_0x4108c3){logger[_0xd26b('0x42')](_0xd26b('0x43'),_0x4d968b['id'],_0x4108c3);});}function getOauth2MicrosoftAccessToken(_0x176974,_0x500803){var _0x35e224={'grant_type':_0xd26b('0x44'),'code':_0x176974,'scope':getAccessTokenScope(_0x500803),'redirect_uri':_0x500803[_0xd26b('0x27')],'client_id':_0x500803[_0xd26b('0x25')],'client_secret':encryptor[_0xd26b('0x3c')](_0x500803['data3'])};var _0x1db87c={'method':_0xd26b('0x3d'),'uri':MICROSOFT_AUTH_URL[_0xd26b('0x2e')](_0xd26b('0x1d'),_0x500803['data2'])+MICROSOFT_TOKEN_ENDPOINT,'form':_0x35e224,'json':!![]};return rp(_0x1db87c);}function startRefreshInterval(_0xc79b80){var _0x38f38b=schedule[_0xd26b('0x45')];if(_0x38f38b[_0xc79b80['id']])clearInterval(_0x38f38b[_0xc79b80['id']]);_0x38f38b[_0xc79b80['id']]=setInterval(refreshOauth2MicrosoftAccessToken['bind'](this,{'id':_0xc79b80['id']}),OAUTH_REFRESH_INTERVAL*0x3e8);schedule['intervals']=_0x38f38b;}function startAllRefreshIntervals(){return db[_0xd26b('0x38')][_0xd26b('0x46')]({'where':{'data6':{'$ne':null}},'raw':!![]})['then'](function(_0x34366c){var _0x210295=_0x34366c[_0xd26b('0x15')](function(_0x4f6f5d){return refreshOauth2MicrosoftAccessToken(_0x4f6f5d)['then'](function(_0x4c845a){startRefreshInterval(_0x4c845a);});});return Promise[_0xd26b('0x47')](_0x210295);})[_0xd26b('0x41')](function(_0x5effc7){var _0x3534de=_0x5effc7?util[_0xd26b('0x48')](_0x5effc7,{'showHidden':![],'depth':null}):'';logger[_0xd26b('0x42')](_0xd26b('0x49'),_0x3534de);});}module[_0xd26b('0x4a')]={'generateMicrosoftAuthorizationUrl':generateMicrosoftAuthorizationUrl,'getOauth2MicrosoftAccessToken':getOauth2MicrosoftAccessToken,'isValidIdToken':isValidIdToken,'startAllRefreshIntervals':startAllRefreshIntervals,'refreshOauth2MicrosoftAccessToken':refreshOauth2MicrosoftAccessToken,'startRefreshInterval':startRefreshInterval}; \ No newline at end of file diff --git a/server/api/cloudProvider/cloudProvider.rpc.js b/server/api/cloudProvider/cloudProvider.rpc.js index fc3245c..2e557be 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 _0x36fe=['info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','then'];(function(_0x344f0b,_0x82aaa2){var _0x483ed5=function(_0x586f8a){while(--_0x586f8a){_0x344f0b['push'](_0x344f0b['shift']());}};_0x483ed5(++_0x82aaa2);}(_0x36fe,0x127));var _0xe36f=function(_0xee1ec9,_0x2f0599){_0xee1ec9=_0xee1ec9-0x0;var _0x102a53=_0x36fe[_0xee1ec9];return _0x102a53;};'use strict';var _=require(_0xe36f('0x0'));var util=require(_0xe36f('0x1'));var moment=require(_0xe36f('0x2'));var BPromise=require(_0xe36f('0x3'));var rs=require(_0xe36f('0x4'));var fs=require('fs');var Redis=require(_0xe36f('0x5'));var db=require(_0xe36f('0x6'))['db'];var utils=require(_0xe36f('0x7'));var logger=require(_0xe36f('0x8'))(_0xe36f('0x9'));var config=require(_0xe36f('0xa'));var jayson=require('jayson/promise');var client=jayson[_0xe36f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x349c9e,_0xdae131,_0x5a0d3c){return new BPromise(function(_0x1ecd6b,_0x21f2a5){return client['request'](_0x349c9e,_0x5a0d3c)[_0xe36f('0xc')](function(_0x386c00){logger[_0xe36f('0xd')](_0xe36f('0xe'),_0xdae131,_0xe36f('0xf'));logger['debug'](_0xe36f('0x10'),_0xdae131,'request\x20sent',JSON[_0xe36f('0x11')](_0x386c00));if(_0x386c00[_0xe36f('0x12')]){if(_0x386c00[_0xe36f('0x12')]['code']===0x1f4){logger[_0xe36f('0x12')](_0xe36f('0xe'),_0xdae131,_0x386c00['error'][_0xe36f('0x13')]);return _0x21f2a5(_0x386c00[_0xe36f('0x12')][_0xe36f('0x13')]);}logger[_0xe36f('0x12')]('CloudProvider,\x20%s,\x20%s',_0xdae131,_0x386c00[_0xe36f('0x12')][_0xe36f('0x13')]);return _0x1ecd6b(_0x386c00[_0xe36f('0x12')]['message']);}else{logger[_0xe36f('0xd')](_0xe36f('0xe'),_0xdae131,'request\x20sent');_0x1ecd6b(_0x386c00[_0xe36f('0x14')][_0xe36f('0x13')]);}})[_0xe36f('0x15')](function(_0x3f8f9f){logger[_0xe36f('0x12')](_0xe36f('0xe'),_0xdae131,_0x3f8f9f);_0x21f2a5(_0x3f8f9f);});});} \ No newline at end of file +var _0x58c9=['client','request','then','info','CloudProvider,\x20%s,\x20%s','request\x20sent','CloudProvider,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x10b30,_0x5f4b99){var _0x1f19f9=function(_0x5aff95){while(--_0x5aff95){_0x10b30['push'](_0x10b30['shift']());}};_0x1f19f9(++_0x5f4b99);}(_0x58c9,0x1bc));var _0x958c=function(_0x57b67e,_0xc5f902){_0x57b67e=_0x57b67e-0x0;var _0x36cc1b=_0x58c9[_0x57b67e];return _0x36cc1b;};'use strict';var _=require(_0x958c('0x0'));var util=require(_0x958c('0x1'));var moment=require(_0x958c('0x2'));var BPromise=require(_0x958c('0x3'));var rs=require(_0x958c('0x4'));var fs=require('fs');var Redis=require(_0x958c('0x5'));var db=require(_0x958c('0x6'))['db'];var utils=require(_0x958c('0x7'));var logger=require(_0x958c('0x8'))(_0x958c('0x9'));var config=require(_0x958c('0xa'));var jayson=require(_0x958c('0xb'));var client=jayson[_0x958c('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0x158388,_0xa44c9,_0xf10ad3){return new BPromise(function(_0x2e37a6,_0x31e668){return client[_0x958c('0xd')](_0x158388,_0xf10ad3)[_0x958c('0xe')](function(_0x128ef6){logger[_0x958c('0xf')](_0x958c('0x10'),_0xa44c9,_0x958c('0x11'));logger['debug'](_0x958c('0x12'),_0xa44c9,_0x958c('0x11'),JSON[_0x958c('0x13')](_0x128ef6));if(_0x128ef6[_0x958c('0x14')]){if(_0x128ef6[_0x958c('0x14')][_0x958c('0x15')]===0x1f4){logger[_0x958c('0x14')]('CloudProvider,\x20%s,\x20%s',_0xa44c9,_0x128ef6[_0x958c('0x14')][_0x958c('0x16')]);return _0x31e668(_0x128ef6['error'][_0x958c('0x16')]);}logger[_0x958c('0x14')]('CloudProvider,\x20%s,\x20%s',_0xa44c9,_0x128ef6[_0x958c('0x14')][_0x958c('0x16')]);return _0x2e37a6(_0x128ef6['error']['message']);}else{logger[_0x958c('0xf')]('CloudProvider,\x20%s,\x20%s',_0xa44c9,'request\x20sent');_0x2e37a6(_0x128ef6['result'][_0x958c('0x16')]);}})[_0x958c('0x17')](function(_0x26c739){logger[_0x958c('0x14')]('CloudProvider,\x20%s,\x20%s',_0xa44c9,_0x26c739);_0x31e668(_0x26c739);});});} \ No newline at end of file diff --git a/server/api/cloudProvider/index.js b/server/api/cloudProvider/index.js index 5b1235c..99930b9 100644 --- a/server/api/cloudProvider/index.js +++ b/server/api/cloudProvider/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xadb5=['put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','Router','./cloudProvider.controller','get','isAuthenticated','/:id','post','create'];(function(_0x3fbfc6,_0x508769){var _0x57fe79=function(_0x2b6e9c){while(--_0x2b6e9c){_0x3fbfc6['push'](_0x3fbfc6['shift']());}};_0x57fe79(++_0x508769);}(_0xadb5,0xad));var _0x5adb=function(_0x21c58c,_0x5c9439){_0x21c58c=_0x21c58c-0x0;var _0xa1fe=_0xadb5[_0x21c58c];return _0xa1fe;};'use strict';var express=require('express');var router=express[_0x5adb('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x5adb('0x1'));router[_0x5adb('0x2')]('/',auth[_0x5adb('0x3')](),controller['index']);router[_0x5adb('0x2')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller['show']);router[_0x5adb('0x5')]('/',auth[_0x5adb('0x3')](),controller[_0x5adb('0x6')]);router[_0x5adb('0x7')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0x8')]);router[_0x5adb('0x9')](_0x5adb('0x4'),auth[_0x5adb('0x3')](),controller[_0x5adb('0xa')]);router[_0x5adb('0x2')](_0x5adb('0xb'),auth[_0x5adb('0x3')](),controller['oauth2MicrosoftAuthorize']);router['post'](_0x5adb('0xc'),controller[_0x5adb('0xd')]);module[_0x5adb('0xe')]=router; \ No newline at end of file +var _0x2ef3=['Router','../../components/auth/service','./cloudProvider.controller','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','/:id/oauth2/microsoft/authorize/','/oauth2/microsoft/callback','oauth2MicrosoftCallback','exports','express'];(function(_0x3c8212,_0x59abf8){var _0x1a7462=function(_0x51f7c9){while(--_0x51f7c9){_0x3c8212['push'](_0x3c8212['shift']());}};_0x1a7462(++_0x59abf8);}(_0x2ef3,0xba));var _0x32ef=function(_0x33f9aa,_0x5cf5f){_0x33f9aa=_0x33f9aa-0x0;var _0x471a74=_0x2ef3[_0x33f9aa];return _0x471a74;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['index']);router[_0x32ef('0x4')](_0x32ef('0x6'),auth['isAuthenticated'](),controller[_0x32ef('0x7')]);router[_0x32ef('0x8')]('/',auth['isAuthenticated'](),controller['create']);router[_0x32ef('0x9')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xa')]);router[_0x32ef('0xb')](_0x32ef('0x6'),auth[_0x32ef('0x5')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x4')](_0x32ef('0xd'),auth['isAuthenticated'](),controller['oauth2MicrosoftAuthorize']);router[_0x32ef('0x8')](_0x32ef('0xe'),controller[_0x32ef('0xf')]);module[_0x32ef('0x10')]=router; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.attributes.js b/server/api/cmCompany/cmCompany.attributes.js index 3bbf77a..746eb52 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 _0xe168=['name','sequelize','exports','STRING'];(function(_0x28b2a7,_0x3c07fa){var _0x1e628a=function(_0x1b3073){while(--_0x1b3073){_0x28b2a7['push'](_0x28b2a7['shift']());}};_0x1e628a(++_0x3c07fa);}(_0xe168,0x159));var _0x8e16=function(_0xd6eaf,_0x41ece8){_0xd6eaf=_0xd6eaf-0x0;var _0x59296b=_0xe168[_0xd6eaf];return _0x59296b;};'use strict';var Sequelize=require(_0x8e16('0x0'));module[_0x8e16('0x1')]={'name':{'type':Sequelize[_0x8e16('0x2')],'unique':_0x8e16('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0x8e16('0x2')]},'companyId':{'type':Sequelize[_0x8e16('0x2')]},'website':{'type':Sequelize[_0x8e16('0x2')]},'phone':{'type':Sequelize[_0x8e16('0x2')]},'fax':{'type':Sequelize[_0x8e16('0x2')]},'type':{'type':Sequelize[_0x8e16('0x2')]},'street':{'type':Sequelize[_0x8e16('0x2')]},'postalCode':{'type':Sequelize[_0x8e16('0x2')]},'city':{'type':Sequelize[_0x8e16('0x2')]},'country':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x8e16('0x2')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0x8e16('0x2')]},'sStreet':{'type':Sequelize[_0x8e16('0x2')]},'sPostalCode':{'type':Sequelize[_0x8e16('0x2')]},'sCity':{'type':Sequelize['STRING']},'sCountry':{'type':Sequelize[_0x8e16('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x3b2b=['sequelize','exports','name','STRING'];(function(_0x352740,_0x10bd9b){var _0x26c2f7=function(_0x359661){while(--_0x359661){_0x352740['push'](_0x352740['shift']());}};_0x26c2f7(++_0x10bd9b);}(_0x3b2b,0x64));var _0xb3b2=function(_0x4c7fb5,_0x2548ef){_0x4c7fb5=_0x4c7fb5-0x0;var _0x2e10ac=_0x3b2b[_0x4c7fb5];return _0x2e10ac;};'use strict';var Sequelize=require(_0xb3b2('0x0'));module[_0xb3b2('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xb3b2('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'vat':{'type':Sequelize[_0xb3b2('0x3')]},'companyId':{'type':Sequelize[_0xb3b2('0x3')]},'website':{'type':Sequelize[_0xb3b2('0x3')]},'phone':{'type':Sequelize[_0xb3b2('0x3')]},'fax':{'type':Sequelize[_0xb3b2('0x3')]},'type':{'type':Sequelize[_0xb3b2('0x3')]},'street':{'type':Sequelize[_0xb3b2('0x3')]},'postalCode':{'type':Sequelize[_0xb3b2('0x3')]},'city':{'type':Sequelize[_0xb3b2('0x3')]},'country':{'type':Sequelize[_0xb3b2('0x3')]},'email':{'type':Sequelize[_0xb3b2('0x3')],'validate':{'isEmail':!![]}},'emailDomain':{'type':Sequelize[_0xb3b2('0x3')]},'sStreet':{'type':Sequelize[_0xb3b2('0x3')]},'sPostalCode':{'type':Sequelize[_0xb3b2('0x3')]},'sCity':{'type':Sequelize[_0xb3b2('0x3')]},'sCountry':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xb3b2('0x3')]}}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.controller.js b/server/api/cmCompany/cmCompany.controller.js index 2ce65f9..7821eee 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 _0x2f0f=['jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','limit','set','Content-Range','json','save','update','destroy','then','get','UserProfileResource','error','stack','name','send','index','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','map','CmCompany','includeAll','findAll','rows','catch','rawAttributes','include','options','create','body','user','Companies','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','addContacts','CmContact','ids','omit','getContacts','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto'];(function(_0x46ba2f,_0x49ef17){var _0x25e4c7=function(_0x5ab706){while(--_0x5ab706){_0x46ba2f['push'](_0x46ba2f['shift']());}};_0x25e4c7(++_0x49ef17);}(_0x2f0f,0xa6));var _0xf2f0=function(_0x5efb3c,_0x852a5a){_0x5efb3c=_0x5efb3c-0x0;var _0x349be3=_0x2f0f[_0x5efb3c];return _0x349be3;};'use strict';var emlformat=require(_0xf2f0('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf2f0('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf2f0('0x2'));var moment=require(_0xf2f0('0x3'));var BPromise=require(_0xf2f0('0x4'));var Mustache=require(_0xf2f0('0x5'));var util=require(_0xf2f0('0x6'));var path=require(_0xf2f0('0x7'));var sox=require(_0xf2f0('0x8'));var csv=require(_0xf2f0('0x9'));var ejs=require(_0xf2f0('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf2f0('0xb'));var squel=require(_0xf2f0('0xc'));var crypto=require(_0xf2f0('0xd'));var jsforce=require(_0xf2f0('0xe'));var deskjs=require(_0xf2f0('0xf'));var toCsv=require(_0xf2f0('0x9'));var querystring=require(_0xf2f0('0x10'));var Papa=require(_0xf2f0('0x11'));var Redis=require(_0xf2f0('0x12'));var authService=require(_0xf2f0('0x13'));var qs=require(_0xf2f0('0x14'));var as=require(_0xf2f0('0x15'));var hardwareService=require(_0xf2f0('0x16'));var logger=require('../../config/logger')(_0xf2f0('0x17'));var utils=require(_0xf2f0('0x18'));var config=require(_0xf2f0('0x19'));var licenseUtil=require(_0xf2f0('0x1a'));var db=require(_0xf2f0('0x1b'))['db'];function respondWithStatusCode(_0x568816,_0x2a9c9d){_0x2a9c9d=_0x2a9c9d||0xcc;return function(_0x22bd7a){if(_0x22bd7a){return _0x568816[_0xf2f0('0x1c')](_0x2a9c9d);}return _0x568816[_0xf2f0('0x1d')](_0x2a9c9d)[_0xf2f0('0x1e')]();};}function respondWithResult(_0xa4e04b,_0x4fe18e){_0x4fe18e=_0x4fe18e||0xc8;return function(_0x3a3197){if(_0x3a3197){return _0xa4e04b[_0xf2f0('0x1d')](_0x4fe18e)['json'](_0x3a3197);}};}function respondWithFilteredResult(_0x48a80c,_0x1567a3){return function(_0x5a27ad){if(_0x5a27ad){var _0x398bf3=typeof _0x1567a3['offset']===_0xf2f0('0x1f')&&typeof _0x1567a3['limit']===_0xf2f0('0x1f');var _0x1a4b21=_0x5a27ad[_0xf2f0('0x20')];var _0x1d5e9d=_0x398bf3?0x0:_0x1567a3[_0xf2f0('0x21')];var _0xae8fcb=_0x398bf3?_0x5a27ad['count']:_0x1567a3[_0xf2f0('0x21')]+_0x1567a3[_0xf2f0('0x22')];var _0x1a9a61;if(_0xae8fcb>=_0x1a4b21){_0xae8fcb=_0x1a4b21;_0x1a9a61=0xc8;}else{_0x1a9a61=0xce;}_0x48a80c[_0xf2f0('0x1d')](_0x1a9a61);return _0x48a80c[_0xf2f0('0x23')](_0xf2f0('0x24'),_0x1d5e9d+'-'+_0xae8fcb+'/'+_0x1a4b21)[_0xf2f0('0x25')](_0x5a27ad);}return null;};}function patchUpdates(_0x19b4a3){return function(_0x33dcc1){try{jsonpatch['apply'](_0x33dcc1,_0x19b4a3,!![]);}catch(_0x31b015){return BPromise['reject'](_0x31b015);}return _0x33dcc1[_0xf2f0('0x26')]();};}function saveUpdates(_0x2f4683,_0x22006e){return function(_0x5bd429){if(_0x5bd429){return _0x5bd429[_0xf2f0('0x27')](_0x2f4683)['then'](function(_0x9d7743){return _0x9d7743;});}return null;};}function removeEntity(_0x4818c6,_0x29b7ea){return function(_0xc46fb6){if(_0xc46fb6){return _0xc46fb6[_0xf2f0('0x28')]()[_0xf2f0('0x29')](function(){var _0x514030=_0xc46fb6[_0xf2f0('0x2a')]({'plain':!![]});var _0x260981='Companies';return db[_0xf2f0('0x2b')][_0xf2f0('0x28')]({'where':{'type':_0x260981,'resourceId':_0x514030['id']}})[_0xf2f0('0x29')](function(){return _0xc46fb6;});})['then'](function(){_0x4818c6[_0xf2f0('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x208cb7,_0x10ac53){return function(_0x4f0020){if(!_0x4f0020){_0x208cb7[_0xf2f0('0x1c')](0x194);}return _0x4f0020;};}function handleError(_0x3b2c0f,_0x37657c){_0x37657c=_0x37657c||0x1f4;return function(_0x990107){logger[_0xf2f0('0x2c')](_0x990107[_0xf2f0('0x2d')]);if(_0x990107['name']){delete _0x990107[_0xf2f0('0x2e')];}_0x3b2c0f[_0xf2f0('0x1d')](_0x37657c)[_0xf2f0('0x2f')](_0x990107);};}exports[_0xf2f0('0x30')]=function(_0x56d5a2,_0x120f80){var _0x5ac264={},_0x3629cf={},_0x452a24={'count':0x0,'rows':[]};return db['CmCompany']['describe']()[_0xf2f0('0x29')](function(_0x230c50){_0x3629cf[_0xf2f0('0x31')]=_[_0xf2f0('0x32')](_0x230c50);_0x3629cf[_0xf2f0('0x33')]=_[_0xf2f0('0x32')](_0x56d5a2['query']);_0x3629cf['filters']=_[_0xf2f0('0x34')](_0x3629cf[_0xf2f0('0x31')],_0x3629cf['query']);_0x5ac264[_0xf2f0('0x35')]=_[_0xf2f0('0x34')](_0x3629cf[_0xf2f0('0x31')],qs['fields'](_0x56d5a2[_0xf2f0('0x33')][_0xf2f0('0x36')]));_0x5ac264['attributes']=_0x5ac264[_0xf2f0('0x35')][_0xf2f0('0x37')]?_0x5ac264[_0xf2f0('0x35')]:_0x3629cf['model'];if(!_0x56d5a2[_0xf2f0('0x33')][_0xf2f0('0x38')](_0xf2f0('0x39'))){_0x5ac264[_0xf2f0('0x22')]=qs[_0xf2f0('0x22')](_0x56d5a2[_0xf2f0('0x33')][_0xf2f0('0x22')]);_0x5ac264[_0xf2f0('0x21')]=qs[_0xf2f0('0x21')](_0x56d5a2[_0xf2f0('0x33')]['offset']);}_0x5ac264[_0xf2f0('0x3a')]=qs[_0xf2f0('0x3b')](_0x56d5a2[_0xf2f0('0x33')][_0xf2f0('0x3b')]);_0x5ac264[_0xf2f0('0x3c')]=qs['filters'](_[_0xf2f0('0x3d')](_0x56d5a2[_0xf2f0('0x33')],_0x3629cf[_0xf2f0('0x3e')]),_0x230c50);if(_0x56d5a2[_0xf2f0('0x33')][_0xf2f0('0x3f')]){_0x5ac264['where']=_[_0xf2f0('0x40')](_0x5ac264['where'],{'$or':_[_0xf2f0('0x41')](_0x5ac264['attributes'],function(_0xc5ccd3){var _0x5bf973={};_0x5bf973[_0xc5ccd3]={'$like':'%'+_0x56d5a2['query'][_0xf2f0('0x3f')]+'%'};return _0x5bf973;})});}_0x5ac264=_[_0xf2f0('0x40')]({},_0x5ac264,_0x56d5a2['options']);var _0x583c90={'where':_0x5ac264['where']};return db[_0xf2f0('0x42')]['count'](_0x583c90)['then'](function(_0x1073c7){_0x452a24['count']=_0x1073c7;if(_0x56d5a2[_0xf2f0('0x33')][_0xf2f0('0x43')]){_0x5ac264['include']=[{'all':!![]}];}return db['CmCompany'][_0xf2f0('0x44')](_0x5ac264);})[_0xf2f0('0x29')](function(_0x550f5a){_0x452a24[_0xf2f0('0x45')]=_0x550f5a;return _0x452a24;})[_0xf2f0('0x29')](respondWithFilteredResult(_0x120f80,_0x5ac264))[_0xf2f0('0x46')](handleError(_0x120f80,null));})[_0xf2f0('0x46')](handleError(_0x120f80,null));};exports['show']=function(_0x5d6193,_0x15c50b){var _0x5e439e={'raw':![],'where':{'id':_0x5d6193['params']['id']}},_0x2e512f={};_0x2e512f[_0xf2f0('0x31')]=_[_0xf2f0('0x32')](db[_0xf2f0('0x42')][_0xf2f0('0x47')]);_0x2e512f['query']=_['keys'](_0x5d6193[_0xf2f0('0x33')]);_0x2e512f[_0xf2f0('0x3e')]=_[_0xf2f0('0x34')](_0x2e512f[_0xf2f0('0x31')],_0x2e512f[_0xf2f0('0x33')]);_0x5e439e[_0xf2f0('0x35')]=_[_0xf2f0('0x34')](_0x2e512f[_0xf2f0('0x31')],qs[_0xf2f0('0x36')](_0x5d6193['query'][_0xf2f0('0x36')]));_0x5e439e['attributes']=_0x5e439e[_0xf2f0('0x35')]['length']?_0x5e439e[_0xf2f0('0x35')]:_0x2e512f[_0xf2f0('0x31')];if(_0x5d6193[_0xf2f0('0x33')]['includeAll']){_0x5e439e[_0xf2f0('0x48')]=[{'all':!![]}];}_0x5e439e=_[_0xf2f0('0x40')]({},_0x5e439e,_0x5d6193[_0xf2f0('0x49')]);return db[_0xf2f0('0x42')]['find'](_0x5e439e)[_0xf2f0('0x29')](handleEntityNotFound(_0x15c50b,null))[_0xf2f0('0x29')](respondWithResult(_0x15c50b,null))['catch'](handleError(_0x15c50b,null));};exports[_0xf2f0('0x4a')]=function(_0x20ff43,_0x19a5ed){return db['CmCompany'][_0xf2f0('0x4a')](_0x20ff43[_0xf2f0('0x4b')],{})[_0xf2f0('0x29')](function(_0x26553c){var _0x40de15=_0x20ff43[_0xf2f0('0x4c')][_0xf2f0('0x2a')]({'plain':!![]});if(!_0x40de15)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x40de15['role']===_0xf2f0('0x4c')){var _0x5a86f9=_0x26553c[_0xf2f0('0x2a')]({'plain':!![]});var _0x257f12=_0xf2f0('0x4d');return db[_0xf2f0('0x4e')][_0xf2f0('0x4f')]({'where':{'name':_0x257f12,'userProfileId':_0x40de15[_0xf2f0('0x50')]},'raw':!![]})['then'](function(_0x4a1679){if(_0x4a1679&&_0x4a1679[_0xf2f0('0x51')]===0x0){return db['UserProfileResource'][_0xf2f0('0x4a')]({'name':_0x5a86f9[_0xf2f0('0x2e')],'resourceId':_0x5a86f9['id'],'type':_0x4a1679[_0xf2f0('0x2e')],'sectionId':_0x4a1679['id']},{})[_0xf2f0('0x29')](function(){return _0x26553c;});}else{return _0x26553c;}})[_0xf2f0('0x46')](function(_0xcd6831){logger['error'](_0xf2f0('0x52'),_0xcd6831);throw _0xcd6831;});}return _0x26553c;})[_0xf2f0('0x29')](respondWithResult(_0x19a5ed,0xc9))[_0xf2f0('0x46')](handleError(_0x19a5ed,null));};exports[_0xf2f0('0x27')]=function(_0x2dbf41,_0x15a2fb){if(_0x2dbf41[_0xf2f0('0x4b')]['id']){delete _0x2dbf41[_0xf2f0('0x4b')]['id'];}return db['CmCompany']['find']({'where':{'id':_0x2dbf41[_0xf2f0('0x53')]['id']}})['then'](handleEntityNotFound(_0x15a2fb,null))[_0xf2f0('0x29')](saveUpdates(_0x2dbf41[_0xf2f0('0x4b')],null))[_0xf2f0('0x29')](respondWithResult(_0x15a2fb,null))['catch'](handleError(_0x15a2fb,null));};exports['destroy']=function(_0x1a1b05,_0x8cc308){return db[_0xf2f0('0x42')]['find']({'where':{'id':_0x1a1b05['params']['id']}})[_0xf2f0('0x29')](handleEntityNotFound(_0x8cc308,null))[_0xf2f0('0x29')](removeEntity(_0x8cc308,null))[_0xf2f0('0x46')](handleError(_0x8cc308,null));};exports[_0xf2f0('0x54')]=function(_0x1f7bc0,_0x46a19d){return db[_0xf2f0('0x42')][_0xf2f0('0x54')]()[_0xf2f0('0x29')](respondWithResult(_0x46a19d,null))[_0xf2f0('0x46')](handleError(_0x46a19d,null));};exports[_0xf2f0('0x55')]=function(_0x427a98,_0x369e1d,_0x2ef0a4){return db[_0xf2f0('0x56')][_0xf2f0('0x4f')]({'where':{'id':_0x427a98[_0xf2f0('0x53')]['id']}})['then'](handleEntityNotFound(_0x369e1d,null))[_0xf2f0('0x29')](function(_0x188787){if(_0x188787){return _0x188787['addContacts'](_0x427a98[_0xf2f0('0x4b')][_0xf2f0('0x57')],_[_0xf2f0('0x58')](_0x427a98[_0xf2f0('0x4b')],[_0xf2f0('0x57'),'id'])||{});}})[_0xf2f0('0x29')](respondWithResult(_0x369e1d,null))[_0xf2f0('0x46')](handleError(_0x369e1d,null));};exports[_0xf2f0('0x59')]=function(_0x9f7666,_0x4b62e7,_0x1da1d6){var _0x19f12b={};var _0x3de1f2={};var _0x57d6e5;var _0xc8e9a4;return db['CmCompany']['findOne']({'where':{'id':_0x9f7666[_0xf2f0('0x53')]['id']}})['then'](handleEntityNotFound(_0x4b62e7,null))['then'](function(_0x4e09fa){if(_0x4e09fa){_0x57d6e5=_0x4e09fa;_0x3de1f2[_0xf2f0('0x31')]=_[_0xf2f0('0x32')](db[_0xf2f0('0x56')]['rawAttributes']);_0x3de1f2['query']=_['keys'](_0x9f7666[_0xf2f0('0x33')]);_0x3de1f2[_0xf2f0('0x3e')]=_['intersection'](_0x3de1f2[_0xf2f0('0x31')],_0x3de1f2[_0xf2f0('0x33')]);_0x19f12b[_0xf2f0('0x35')]=_['intersection'](_0x3de1f2[_0xf2f0('0x31')],qs[_0xf2f0('0x36')](_0x9f7666['query'][_0xf2f0('0x36')]));_0x19f12b[_0xf2f0('0x35')]=_0x19f12b[_0xf2f0('0x35')]['length']?_0x19f12b[_0xf2f0('0x35')]:_0x3de1f2['model'];_0x19f12b[_0xf2f0('0x3a')]=qs[_0xf2f0('0x3b')](_0x9f7666[_0xf2f0('0x33')]['sort']);_0x19f12b[_0xf2f0('0x3c')]=qs[_0xf2f0('0x3e')](_[_0xf2f0('0x3d')](_0x9f7666['query'],_0x3de1f2['filters']));if(_0x9f7666[_0xf2f0('0x33')]['filter']){_0x19f12b[_0xf2f0('0x3c')]=_[_0xf2f0('0x40')](_0x19f12b['where'],{'$or':_[_0xf2f0('0x41')](_0x19f12b[_0xf2f0('0x35')],function(_0x3b5fb9){var _0x298a5={};_0x298a5[_0x3b5fb9]={'$like':'%'+_0x9f7666[_0xf2f0('0x33')][_0xf2f0('0x3f')]+'%'};return _0x298a5;})});}_0x19f12b=_['merge']({},_0x19f12b,_0x9f7666[_0xf2f0('0x49')]);return _0x57d6e5[_0xf2f0('0x59')](_0x19f12b);}})[_0xf2f0('0x29')](function(_0x4f85fd){if(_0x4f85fd){_0xc8e9a4=_0x4f85fd['length'];if(!_0x9f7666['query']['hasOwnProperty'](_0xf2f0('0x39'))){_0x19f12b['limit']=qs[_0xf2f0('0x22')](_0x9f7666[_0xf2f0('0x33')]['limit']);_0x19f12b['offset']=qs[_0xf2f0('0x21')](_0x9f7666['query'][_0xf2f0('0x21')]);}return _0x57d6e5[_0xf2f0('0x59')](_0x19f12b);}})[_0xf2f0('0x29')](function(_0x35906f){if(_0x35906f){return _0x35906f?{'count':_0xc8e9a4,'rows':_0x35906f}:null;}})[_0xf2f0('0x29')](respondWithResult(_0x4b62e7,null))[_0xf2f0('0x46')](handleError(_0x4b62e7,null));}; \ No newline at end of file +var _0x7113=['body','describe','addContacts','CmContact','ids','omit','findOne','map','getContacts','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','to-csv','ejs','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','update','destroy','then','get','error','stack','name','index','CmCompany','model','keys','query','intersection','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','include','findAll','rows','catch','show','params','rawAttributes','fields','includeAll','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x25a1dc,_0x536cdf){var _0x248360=function(_0x415614){while(--_0x415614){_0x25a1dc['push'](_0x25a1dc['shift']());}};_0x248360(++_0x536cdf);}(_0x7113,0x10b));var _0x3711=function(_0x294fe1,_0x9e5abf){_0x294fe1=_0x294fe1-0x0;var _0x79432d=_0x7113[_0x294fe1];return _0x79432d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x3711('0x0'));var zipdir=require(_0x3711('0x1'));var jsonpatch=require(_0x3711('0x2'));var rp=require(_0x3711('0x3'));var moment=require(_0x3711('0x4'));var BPromise=require(_0x3711('0x5'));var Mustache=require('mustache');var util=require(_0x3711('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x3711('0x7'));var ejs=require(_0x3711('0x8'));var fs=require('fs');var fs_extra=require(_0x3711('0x9'));var _=require(_0x3711('0xa'));var squel=require(_0x3711('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x3711('0xc'));var toCsv=require(_0x3711('0x7'));var querystring=require('querystring');var Papa=require(_0x3711('0xd'));var Redis=require(_0x3711('0xe'));var authService=require(_0x3711('0xf'));var qs=require(_0x3711('0x10'));var as=require(_0x3711('0x11'));var hardwareService=require(_0x3711('0x12'));var logger=require(_0x3711('0x13'))(_0x3711('0x14'));var utils=require(_0x3711('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x3711('0x16'));var db=require(_0x3711('0x17'))['db'];function respondWithStatusCode(_0x4b8c93,_0x36215d){_0x36215d=_0x36215d||0xcc;return function(_0x4f0973){if(_0x4f0973){return _0x4b8c93[_0x3711('0x18')](_0x36215d);}return _0x4b8c93[_0x3711('0x19')](_0x36215d)[_0x3711('0x1a')]();};}function respondWithResult(_0x50c381,_0x1c22ac){_0x1c22ac=_0x1c22ac||0xc8;return function(_0x18cd60){if(_0x18cd60){return _0x50c381[_0x3711('0x19')](_0x1c22ac)[_0x3711('0x1b')](_0x18cd60);}};}function respondWithFilteredResult(_0x3626cc,_0x3341ee){return function(_0x554bd6){if(_0x554bd6){var _0x21317b=typeof _0x3341ee[_0x3711('0x1c')]===_0x3711('0x1d')&&typeof _0x3341ee[_0x3711('0x1e')]==='undefined';var _0x343d9a=_0x554bd6[_0x3711('0x1f')];var _0x7b0dfc=_0x21317b?0x0:_0x3341ee['offset'];var _0x424932=_0x21317b?_0x554bd6[_0x3711('0x1f')]:_0x3341ee[_0x3711('0x1c')]+_0x3341ee[_0x3711('0x1e')];var _0x4d1fbc;if(_0x424932>=_0x343d9a){_0x424932=_0x343d9a;_0x4d1fbc=0xc8;}else{_0x4d1fbc=0xce;}_0x3626cc[_0x3711('0x19')](_0x4d1fbc);return _0x3626cc[_0x3711('0x20')]('Content-Range',_0x7b0dfc+'-'+_0x424932+'/'+_0x343d9a)['json'](_0x554bd6);}return null;};}function patchUpdates(_0x3d131e){return function(_0x5af898){try{jsonpatch[_0x3711('0x21')](_0x5af898,_0x3d131e,!![]);}catch(_0x20374a){return BPromise['reject'](_0x20374a);}return _0x5af898['save']();};}function saveUpdates(_0x377f6c,_0x518d80){return function(_0x2e54d3){if(_0x2e54d3){return _0x2e54d3[_0x3711('0x22')](_0x377f6c)['then'](function(_0x58c563){return _0x58c563;});}return null;};}function removeEntity(_0x54c216,_0xe7d4e5){return function(_0x320a6b){if(_0x320a6b){return _0x320a6b[_0x3711('0x23')]()[_0x3711('0x24')](function(){var _0x47c84e=_0x320a6b[_0x3711('0x25')]({'plain':!![]});var _0x1cdeb2='Companies';return db['UserProfileResource'][_0x3711('0x23')]({'where':{'type':_0x1cdeb2,'resourceId':_0x47c84e['id']}})['then'](function(){return _0x320a6b;});})[_0x3711('0x24')](function(){_0x54c216['status'](0xcc)[_0x3711('0x1a')]();});}};}function handleEntityNotFound(_0x54a2fe,_0x4850a4){return function(_0x19ed2c){if(!_0x19ed2c){_0x54a2fe[_0x3711('0x18')](0x194);}return _0x19ed2c;};}function handleError(_0x3b6810,_0x1996fd){_0x1996fd=_0x1996fd||0x1f4;return function(_0x59d618){logger[_0x3711('0x26')](_0x59d618[_0x3711('0x27')]);if(_0x59d618[_0x3711('0x28')]){delete _0x59d618[_0x3711('0x28')];}_0x3b6810[_0x3711('0x19')](_0x1996fd)['send'](_0x59d618);};}exports[_0x3711('0x29')]=function(_0x52d266,_0x214c79){var _0x19bbd9={},_0x24491a={},_0x2cea90={'count':0x0,'rows':[]};return db[_0x3711('0x2a')]['describe']()['then'](function(_0x42b41c){_0x24491a[_0x3711('0x2b')]=_[_0x3711('0x2c')](_0x42b41c);_0x24491a[_0x3711('0x2d')]=_[_0x3711('0x2c')](_0x52d266[_0x3711('0x2d')]);_0x24491a['filters']=_[_0x3711('0x2e')](_0x24491a[_0x3711('0x2b')],_0x24491a[_0x3711('0x2d')]);_0x19bbd9[_0x3711('0x2f')]=_[_0x3711('0x2e')](_0x24491a[_0x3711('0x2b')],qs['fields'](_0x52d266[_0x3711('0x2d')]['fields']));_0x19bbd9[_0x3711('0x2f')]=_0x19bbd9[_0x3711('0x2f')][_0x3711('0x30')]?_0x19bbd9['attributes']:_0x24491a['model'];if(!_0x52d266['query'][_0x3711('0x31')](_0x3711('0x32'))){_0x19bbd9[_0x3711('0x1e')]=qs[_0x3711('0x1e')](_0x52d266[_0x3711('0x2d')]['limit']);_0x19bbd9[_0x3711('0x1c')]=qs[_0x3711('0x1c')](_0x52d266[_0x3711('0x2d')]['offset']);}_0x19bbd9[_0x3711('0x33')]=qs[_0x3711('0x34')](_0x52d266[_0x3711('0x2d')][_0x3711('0x34')]);_0x19bbd9[_0x3711('0x35')]=qs[_0x3711('0x36')](_[_0x3711('0x37')](_0x52d266[_0x3711('0x2d')],_0x24491a[_0x3711('0x36')]),_0x42b41c);if(_0x52d266['query'][_0x3711('0x38')]){_0x19bbd9['where']=_[_0x3711('0x39')](_0x19bbd9['where'],{'$or':_['map'](_0x19bbd9[_0x3711('0x2f')],function(_0x481f16){var _0x20af79={};_0x20af79[_0x481f16]={'$like':'%'+_0x52d266[_0x3711('0x2d')]['filter']+'%'};return _0x20af79;})});}_0x19bbd9=_[_0x3711('0x39')]({},_0x19bbd9,_0x52d266[_0x3711('0x3a')]);var _0x107e16={'where':_0x19bbd9['where']};return db[_0x3711('0x2a')][_0x3711('0x1f')](_0x107e16)[_0x3711('0x24')](function(_0x450361){_0x2cea90[_0x3711('0x1f')]=_0x450361;if(_0x52d266[_0x3711('0x2d')]['includeAll']){_0x19bbd9[_0x3711('0x3b')]=[{'all':!![]}];}return db['CmCompany'][_0x3711('0x3c')](_0x19bbd9);})[_0x3711('0x24')](function(_0x53476c){_0x2cea90[_0x3711('0x3d')]=_0x53476c;return _0x2cea90;})[_0x3711('0x24')](respondWithFilteredResult(_0x214c79,_0x19bbd9))['catch'](handleError(_0x214c79,null));})[_0x3711('0x3e')](handleError(_0x214c79,null));};exports[_0x3711('0x3f')]=function(_0x381ee8,_0x167edc){var _0x30b6c5={'raw':![],'where':{'id':_0x381ee8[_0x3711('0x40')]['id']}},_0x13692c={};_0x13692c[_0x3711('0x2b')]=_[_0x3711('0x2c')](db['CmCompany'][_0x3711('0x41')]);_0x13692c[_0x3711('0x2d')]=_[_0x3711('0x2c')](_0x381ee8['query']);_0x13692c[_0x3711('0x36')]=_[_0x3711('0x2e')](_0x13692c[_0x3711('0x2b')],_0x13692c[_0x3711('0x2d')]);_0x30b6c5['attributes']=_[_0x3711('0x2e')](_0x13692c[_0x3711('0x2b')],qs[_0x3711('0x42')](_0x381ee8[_0x3711('0x2d')][_0x3711('0x42')]));_0x30b6c5[_0x3711('0x2f')]=_0x30b6c5[_0x3711('0x2f')][_0x3711('0x30')]?_0x30b6c5['attributes']:_0x13692c[_0x3711('0x2b')];if(_0x381ee8[_0x3711('0x2d')][_0x3711('0x43')]){_0x30b6c5[_0x3711('0x3b')]=[{'all':!![]}];}_0x30b6c5=_['merge']({},_0x30b6c5,_0x381ee8[_0x3711('0x3a')]);return db['CmCompany'][_0x3711('0x44')](_0x30b6c5)[_0x3711('0x24')](handleEntityNotFound(_0x167edc,null))[_0x3711('0x24')](respondWithResult(_0x167edc,null))[_0x3711('0x3e')](handleError(_0x167edc,null));};exports[_0x3711('0x45')]=function(_0x2cd5e7,_0xe5a450){return db[_0x3711('0x2a')][_0x3711('0x45')](_0x2cd5e7['body'],{})[_0x3711('0x24')](function(_0x11b5bd){var _0x31be32=_0x2cd5e7[_0x3711('0x46')][_0x3711('0x25')]({'plain':!![]});if(!_0x31be32)throw new Error(_0x3711('0x47'));if(_0x31be32['role']===_0x3711('0x46')){var _0x44efbf=_0x11b5bd[_0x3711('0x25')]({'plain':!![]});var _0x2cc176='Companies';return db[_0x3711('0x48')]['find']({'where':{'name':_0x2cc176,'userProfileId':_0x31be32[_0x3711('0x49')]},'raw':!![]})[_0x3711('0x24')](function(_0x4935f8){if(_0x4935f8&&_0x4935f8[_0x3711('0x4a')]===0x0){return db[_0x3711('0x4b')][_0x3711('0x45')]({'name':_0x44efbf[_0x3711('0x28')],'resourceId':_0x44efbf['id'],'type':_0x4935f8[_0x3711('0x28')],'sectionId':_0x4935f8['id']},{})[_0x3711('0x24')](function(){return _0x11b5bd;});}else{return _0x11b5bd;}})[_0x3711('0x3e')](function(_0x56647b){logger['error'](_0x3711('0x4c'),_0x56647b);throw _0x56647b;});}return _0x11b5bd;})['then'](respondWithResult(_0xe5a450,0xc9))['catch'](handleError(_0xe5a450,null));};exports[_0x3711('0x22')]=function(_0x2d1005,_0x1949c4){if(_0x2d1005[_0x3711('0x4d')]['id']){delete _0x2d1005['body']['id'];}return db[_0x3711('0x2a')][_0x3711('0x44')]({'where':{'id':_0x2d1005[_0x3711('0x40')]['id']}})[_0x3711('0x24')](handleEntityNotFound(_0x1949c4,null))[_0x3711('0x24')](saveUpdates(_0x2d1005['body'],null))[_0x3711('0x24')](respondWithResult(_0x1949c4,null))[_0x3711('0x3e')](handleError(_0x1949c4,null));};exports[_0x3711('0x23')]=function(_0x3501ba,_0x5a5307){return db[_0x3711('0x2a')][_0x3711('0x44')]({'where':{'id':_0x3501ba[_0x3711('0x40')]['id']}})[_0x3711('0x24')](handleEntityNotFound(_0x5a5307,null))[_0x3711('0x24')](removeEntity(_0x5a5307,null))[_0x3711('0x3e')](handleError(_0x5a5307,null));};exports['describe']=function(_0x265519,_0x3a0d6e){return db[_0x3711('0x2a')][_0x3711('0x4e')]()[_0x3711('0x24')](respondWithResult(_0x3a0d6e,null))[_0x3711('0x3e')](handleError(_0x3a0d6e,null));};exports[_0x3711('0x4f')]=function(_0x2957d6,_0x4a6c57,_0x7e328e){return db[_0x3711('0x50')]['find']({'where':{'id':_0x2957d6[_0x3711('0x40')]['id']}})[_0x3711('0x24')](handleEntityNotFound(_0x4a6c57,null))['then'](function(_0x486187){if(_0x486187){return _0x486187[_0x3711('0x4f')](_0x2957d6[_0x3711('0x4d')][_0x3711('0x51')],_[_0x3711('0x52')](_0x2957d6[_0x3711('0x4d')],[_0x3711('0x51'),'id'])||{});}})[_0x3711('0x24')](respondWithResult(_0x4a6c57,null))[_0x3711('0x3e')](handleError(_0x4a6c57,null));};exports['getContacts']=function(_0x4d00db,_0x2e46ac,_0x4c35de){var _0xe623fb={};var _0x2c065a={};var _0x455808;var _0x907bbc;return db['CmCompany'][_0x3711('0x53')]({'where':{'id':_0x4d00db[_0x3711('0x40')]['id']}})['then'](handleEntityNotFound(_0x2e46ac,null))[_0x3711('0x24')](function(_0xe2dcc0){if(_0xe2dcc0){_0x455808=_0xe2dcc0;_0x2c065a['model']=_[_0x3711('0x2c')](db[_0x3711('0x50')]['rawAttributes']);_0x2c065a[_0x3711('0x2d')]=_[_0x3711('0x2c')](_0x4d00db[_0x3711('0x2d')]);_0x2c065a[_0x3711('0x36')]=_[_0x3711('0x2e')](_0x2c065a[_0x3711('0x2b')],_0x2c065a[_0x3711('0x2d')]);_0xe623fb[_0x3711('0x2f')]=_['intersection'](_0x2c065a[_0x3711('0x2b')],qs['fields'](_0x4d00db[_0x3711('0x2d')][_0x3711('0x42')]));_0xe623fb[_0x3711('0x2f')]=_0xe623fb['attributes']['length']?_0xe623fb[_0x3711('0x2f')]:_0x2c065a[_0x3711('0x2b')];_0xe623fb[_0x3711('0x33')]=qs['sort'](_0x4d00db[_0x3711('0x2d')][_0x3711('0x34')]);_0xe623fb[_0x3711('0x35')]=qs[_0x3711('0x36')](_[_0x3711('0x37')](_0x4d00db['query'],_0x2c065a['filters']));if(_0x4d00db[_0x3711('0x2d')][_0x3711('0x38')]){_0xe623fb[_0x3711('0x35')]=_['merge'](_0xe623fb[_0x3711('0x35')],{'$or':_[_0x3711('0x54')](_0xe623fb['attributes'],function(_0x575e76){var _0x207a31={};_0x207a31[_0x575e76]={'$like':'%'+_0x4d00db['query'][_0x3711('0x38')]+'%'};return _0x207a31;})});}_0xe623fb=_['merge']({},_0xe623fb,_0x4d00db[_0x3711('0x3a')]);return _0x455808[_0x3711('0x55')](_0xe623fb);}})[_0x3711('0x24')](function(_0x27e028){if(_0x27e028){_0x907bbc=_0x27e028[_0x3711('0x30')];if(!_0x4d00db[_0x3711('0x2d')][_0x3711('0x31')](_0x3711('0x32'))){_0xe623fb['limit']=qs['limit'](_0x4d00db[_0x3711('0x2d')][_0x3711('0x1e')]);_0xe623fb[_0x3711('0x1c')]=qs[_0x3711('0x1c')](_0x4d00db['query'][_0x3711('0x1c')]);}return _0x455808[_0x3711('0x55')](_0xe623fb);}})[_0x3711('0x24')](function(_0x1fc89b){if(_0x1fc89b){return _0x1fc89b?{'count':_0x907bbc,'rows':_0x1fc89b}:null;}})['then'](respondWithResult(_0x2e46ac,null))[_0x3711('0x3e')](handleError(_0x2e46ac,null));}; \ No newline at end of file diff --git a/server/api/cmCompany/cmCompany.model.js b/server/api/cmCompany/cmCompany.model.js index 01c51ea..16c98a5 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 _0x24a7=['bluebird','path','../../config/environment','./cmCompany.attributes','exports','define','cm_companies','lodash','../../config/logger','api','moment'];(function(_0x441819,_0x5b8d0a){var _0x478882=function(_0x369786){while(--_0x369786){_0x441819['push'](_0x441819['shift']());}};_0x478882(++_0x5b8d0a);}(_0x24a7,0xf9));var _0x724a=function(_0x3e6e76,_0x2131b1){_0x3e6e76=_0x3e6e76-0x0;var _0x282488=_0x24a7[_0x3e6e76];return _0x282488;};'use strict';var _=require(_0x724a('0x0'));var util=require('util');var logger=require(_0x724a('0x1'))(_0x724a('0x2'));var moment=require(_0x724a('0x3'));var BPromise=require(_0x724a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x724a('0x5'));var rimraf=require('rimraf');var config=require(_0x724a('0x6'));var attributes=require(_0x724a('0x7'));module[_0x724a('0x8')]=function(_0x2ac538,_0x96ee1f){return _0x2ac538[_0x724a('0x9')]('CmCompany',attributes,{'tableName':_0x724a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xefa1=['cm_companies','lodash','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./cmCompany.attributes','define','CmCompany'];(function(_0x173441,_0x26b0d9){var _0x2423a8=function(_0x4d96c2){while(--_0x4d96c2){_0x173441['push'](_0x173441['shift']());}};_0x2423a8(++_0x26b0d9);}(_0xefa1,0x12a));var _0x1efa=function(_0x153e95,_0x3687bc){_0x153e95=_0x153e95-0x0;var _0x463c22=_0xefa1[_0x153e95];return _0x463c22;};'use strict';var _=require(_0x1efa('0x0'));var util=require('util');var logger=require(_0x1efa('0x1'))(_0x1efa('0x2'));var moment=require('moment');var BPromise=require(_0x1efa('0x3'));var rp=require(_0x1efa('0x4'));var fs=require('fs');var path=require(_0x1efa('0x5'));var rimraf=require('rimraf');var config=require(_0x1efa('0x6'));var attributes=require(_0x1efa('0x7'));module['exports']=function(_0x1afad7,_0x5ae457){return _0x1afad7[_0x1efa('0x8')](_0x1efa('0x9'),attributes,{'tableName':_0x1efa('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 c3032ce..8f6e18a 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 _0xbbfb=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xbbfb,0xa1));var _0xbbbf=function(_0x8b6ca5,_0x3c3384){_0x8b6ca5=_0x8b6ca5-0x0;var _0x303384=_0xbbfb[_0x8b6ca5];return _0x303384;};'use strict';var _=require(_0xbbbf('0x0'));var util=require(_0xbbbf('0x1'));var moment=require(_0xbbbf('0x2'));var BPromise=require(_0xbbbf('0x3'));var rs=require(_0xbbbf('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbbbf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xbbbf('0x6'))(_0xbbbf('0x7'));var config=require(_0xbbbf('0x8'));var jayson=require(_0xbbbf('0x9'));var client=jayson[_0xbbbf('0xa')][_0xbbbf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3d153c,_0x372301,_0x5109c9){return new BPromise(function(_0x34c16f,_0x2b0b51){return client[_0xbbbf('0xc')](_0x3d153c,_0x5109c9)[_0xbbbf('0xd')](function(_0x416786){logger[_0xbbbf('0xe')](_0xbbbf('0xf'),_0x372301,_0xbbbf('0x10'));logger[_0xbbbf('0x11')](_0xbbbf('0x12'),_0x372301,'request\x20sent',JSON[_0xbbbf('0x13')](_0x416786));if(_0x416786[_0xbbbf('0x14')]){if(_0x416786[_0xbbbf('0x14')][_0xbbbf('0x15')]===0x1f4){logger[_0xbbbf('0x14')](_0xbbbf('0xf'),_0x372301,_0x416786[_0xbbbf('0x14')][_0xbbbf('0x16')]);return _0x2b0b51(_0x416786['error'][_0xbbbf('0x16')]);}logger[_0xbbbf('0x14')]('CmCompany,\x20%s,\x20%s',_0x372301,_0x416786[_0xbbbf('0x14')][_0xbbbf('0x16')]);return _0x34c16f(_0x416786[_0xbbbf('0x14')]['message']);}else{logger['info']('CmCompany,\x20%s,\x20%s',_0x372301,_0xbbbf('0x10'));_0x34c16f(_0x416786[_0xbbbf('0x17')][_0xbbbf('0x16')]);}})[_0xbbbf('0x18')](function(_0x46f647){logger[_0xbbbf('0x14')](_0xbbbf('0xf'),_0x372301,_0x46f647);_0x2b0b51(_0x46f647);});});} \ No newline at end of file +var _0x3892=['info','CmCompany,\x20%s,\x20%s','request\x20sent','debug','CmCompany,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x3bbd69,_0xbdd1c1){var _0x4ac244=function(_0x2a7405){while(--_0x2a7405){_0x3bbd69['push'](_0x3bbd69['shift']());}};_0x4ac244(++_0xbdd1c1);}(_0x3892,0x82));var _0x2389=function(_0x3c3639,_0x5ba1f1){_0x3c3639=_0x3c3639-0x0;var _0x1c793e=_0x3892[_0x3c3639];return _0x1c793e;};'use strict';var _=require(_0x2389('0x0'));var util=require(_0x2389('0x1'));var moment=require('moment');var BPromise=require(_0x2389('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2389('0x3'));var db=require(_0x2389('0x4'))['db'];var utils=require(_0x2389('0x5'));var logger=require(_0x2389('0x6'))(_0x2389('0x7'));var config=require(_0x2389('0x8'));var jayson=require(_0x2389('0x9'));var client=jayson[_0x2389('0xa')][_0x2389('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2563c9,_0x245d32,_0x5b9372){return new BPromise(function(_0x313375,_0x28089c){return client[_0x2389('0xc')](_0x2563c9,_0x5b9372)[_0x2389('0xd')](function(_0x113ef1){logger[_0x2389('0xe')](_0x2389('0xf'),_0x245d32,_0x2389('0x10'));logger[_0x2389('0x11')](_0x2389('0x12'),_0x245d32,_0x2389('0x10'),JSON['stringify'](_0x113ef1));if(_0x113ef1[_0x2389('0x13')]){if(_0x113ef1['error'][_0x2389('0x14')]===0x1f4){logger[_0x2389('0x13')]('CmCompany,\x20%s,\x20%s',_0x245d32,_0x113ef1['error']['message']);return _0x28089c(_0x113ef1[_0x2389('0x13')][_0x2389('0x15')]);}logger[_0x2389('0x13')](_0x2389('0xf'),_0x245d32,_0x113ef1[_0x2389('0x13')][_0x2389('0x15')]);return _0x313375(_0x113ef1[_0x2389('0x13')]['message']);}else{logger[_0x2389('0xe')](_0x2389('0xf'),_0x245d32,'request\x20sent');_0x313375(_0x113ef1[_0x2389('0x16')]['message']);}})[_0x2389('0x17')](function(_0x1fb0fa){logger[_0x2389('0x13')](_0x2389('0xf'),_0x245d32,_0x1fb0fa);_0x28089c(_0x1fb0fa);});});} \ No newline at end of file diff --git a/server/api/cmCompany/index.js b/server/api/cmCompany/index.js index 4bddc3e..9353e4b 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 _0x49b4=['fs-extra','../../components/auth/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/contacts','getContacts','post','create','addContacts','update','exports','multer','path','connect-timeout','express'];(function(_0x16213f,_0xc89b41){var _0x38f224=function(_0x134c4c){while(--_0x134c4c){_0x16213f['push'](_0x16213f['shift']());}};_0x38f224(++_0xc89b41);}(_0x49b4,0xce));var _0x449b=function(_0x49d794,_0x7ac3c7){_0x49d794=_0x49d794-0x0;var _0x2d5a1a=_0x49b4[_0x49d794];return _0x2d5a1a;};'use strict';var multer=require(_0x449b('0x0'));var util=require('util');var path=require(_0x449b('0x1'));var timeout=require(_0x449b('0x2'));var express=require(_0x449b('0x3'));var router=express['Router']();var fs_extra=require(_0x449b('0x4'));var auth=require(_0x449b('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x449b('0x6'));var controller=require(_0x449b('0x7'));router[_0x449b('0x8')]('/',auth[_0x449b('0x9')](),controller[_0x449b('0xa')]);router[_0x449b('0x8')](_0x449b('0xb'),auth['isAuthenticated'](),controller[_0x449b('0xc')]);router[_0x449b('0x8')](_0x449b('0xd'),auth[_0x449b('0x9')](),controller['show']);router[_0x449b('0x8')](_0x449b('0xe'),auth['isAuthenticated'](),controller[_0x449b('0xf')]);router[_0x449b('0x10')]('/',auth['isAuthenticated'](),controller[_0x449b('0x11')]);router['post'](_0x449b('0xe'),auth[_0x449b('0x9')](),controller[_0x449b('0x12')]);router['put'](_0x449b('0xd'),auth[_0x449b('0x9')](),controller[_0x449b('0x13')]);router['delete']('/:id',auth[_0x449b('0x9')](),controller['destroy']);module[_0x449b('0x14')]=router; \ No newline at end of file +var _0xc63b=['put','update','delete','destroy','exports','multer','util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCompany.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/contacts','create','post'];(function(_0x385d5f,_0x43c178){var _0x17dcd8=function(_0xc597ea){while(--_0xc597ea){_0x385d5f['push'](_0x385d5f['shift']());}};_0x17dcd8(++_0x43c178);}(_0xc63b,0x1ba));var _0xbc63=function(_0x4a3898,_0x4c9853){_0x4a3898=_0x4a3898-0x0;var _0x25ceb0=_0xc63b[_0x4a3898];return _0x25ceb0;};'use strict';var multer=require(_0xbc63('0x0'));var util=require(_0xbc63('0x1'));var path=require(_0xbc63('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xbc63('0x3')]();var fs_extra=require(_0xbc63('0x4'));var auth=require(_0xbc63('0x5'));var interaction=require(_0xbc63('0x6'));var config=require(_0xbc63('0x7'));var controller=require(_0xbc63('0x8'));router[_0xbc63('0x9')]('/',auth[_0xbc63('0xa')](),controller['index']);router['get'](_0xbc63('0xb'),auth[_0xbc63('0xa')](),controller[_0xbc63('0xc')]);router[_0xbc63('0x9')](_0xbc63('0xd'),auth[_0xbc63('0xa')](),controller[_0xbc63('0xe')]);router[_0xbc63('0x9')](_0xbc63('0xf'),auth[_0xbc63('0xa')](),controller['getContacts']);router['post']('/',auth[_0xbc63('0xa')](),controller[_0xbc63('0x10')]);router[_0xbc63('0x11')](_0xbc63('0xf'),auth[_0xbc63('0xa')](),controller['addContacts']);router[_0xbc63('0x12')](_0xbc63('0xd'),auth[_0xbc63('0xa')](),controller[_0xbc63('0x13')]);router[_0xbc63('0x14')](_0xbc63('0xd'),auth[_0xbc63('0xa')](),controller[_0xbc63('0x15')]);module[_0xbc63('0x16')]=router; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.attributes.js b/server/api/cmContact/cmContact.attributes.js index f455759..1dc4b98 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 _0x9447=['exports','STRING','TEXT','INTEGER','UNSIGNED','DATE','NOW','sequelize'];(function(_0x444a02,_0x4abdd1){var _0x25fc20=function(_0x1c0b4f){while(--_0x1c0b4f){_0x444a02['push'](_0x444a02['shift']());}};_0x25fc20(++_0x4abdd1);}(_0x9447,0x197));var _0x7944=function(_0x56ef5c,_0x53d2a7){_0x56ef5c=_0x56ef5c-0x0;var _0x521fd8=_0x9447[_0x56ef5c];return _0x521fd8;};'use strict';var _=require('lodash');var Sequelize=require(_0x7944('0x0'));module[_0x7944('0x1')]={'firstName':{'type':Sequelize[_0x7944('0x2')],'allowNull':![]},'lastName':{'type':Sequelize[_0x7944('0x2')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x7944('0x2')]},'country':{'type':Sequelize[_0x7944('0x2')]},'dateOfBirth':{'type':Sequelize[_0x7944('0x2')]},'description':{'type':Sequelize[_0x7944('0x3')]},'phone':{'type':Sequelize[_0x7944('0x2')]},'mobile':{'type':Sequelize[_0x7944('0x2')]},'fax':{'type':Sequelize[_0x7944('0x2')]},'email':{'type':Sequelize[_0x7944('0x2')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize['STRING']},'fb_data':{'type':Sequelize[_0x7944('0x2')]},'twitter':{'type':Sequelize[_0x7944('0x2')]},'skype':{'type':Sequelize[_0x7944('0x2')]},'teams':{'type':Sequelize[_0x7944('0x2')]},'viber':{'type':Sequelize['STRING']},'line':{'type':Sequelize[_0x7944('0x2')]},'wechat':{'type':Sequelize[_0x7944('0x2')]},'telegram':{'type':Sequelize[_0x7944('0x2')]},'UserId':{'type':Sequelize[_0x7944('0x4')]},'AdditionalPhones':{'type':Sequelize[_0x7944('0x2')]},'priority':{'type':Sequelize[_0x7944('0x4')](0x2)[_0x7944('0x5')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0x7944('0x6')],'defaultValue':Sequelize[_0x7944('0x7')]},'dialTimezone':{'type':Sequelize[_0x7944('0x2')]},'utcOffset':{'type':Sequelize[_0x7944('0x4')]}}; \ No newline at end of file +var _0x9e3a=['NOW','lodash','sequelize','exports','STRING','TEXT','INTEGER','UNSIGNED','DATE'];(function(_0x561111,_0x4fdfbd){var _0x3c1fd9=function(_0x1e6b83){while(--_0x1e6b83){_0x561111['push'](_0x561111['shift']());}};_0x3c1fd9(++_0x4fdfbd);}(_0x9e3a,0x1ba));var _0xa9e3=function(_0xb2a12b,_0x1511d0){_0xb2a12b=_0xb2a12b-0x0;var _0x4acc72=_0x9e3a[_0xb2a12b];return _0x4acc72;};'use strict';var _=require(_0xa9e3('0x0'));var Sequelize=require(_0xa9e3('0x1'));module[_0xa9e3('0x2')]={'firstName':{'type':Sequelize['STRING'],'allowNull':![]},'lastName':{'type':Sequelize[_0xa9e3('0x3')]},'street':{'type':Sequelize['STRING']},'postalCode':{'type':Sequelize[_0xa9e3('0x3')]},'city':{'type':Sequelize[_0xa9e3('0x3')]},'country':{'type':Sequelize[_0xa9e3('0x3')]},'dateOfBirth':{'type':Sequelize[_0xa9e3('0x3')]},'description':{'type':Sequelize[_0xa9e3('0x4')]},'phone':{'type':Sequelize[_0xa9e3('0x3')]},'mobile':{'type':Sequelize[_0xa9e3('0x3')]},'fax':{'type':Sequelize[_0xa9e3('0x3')]},'email':{'type':Sequelize[_0xa9e3('0x3')]},'url':{'type':Sequelize['STRING']},'facebook':{'type':Sequelize[_0xa9e3('0x3')]},'fb_data':{'type':Sequelize['STRING']},'twitter':{'type':Sequelize[_0xa9e3('0x3')]},'skype':{'type':Sequelize[_0xa9e3('0x3')]},'teams':{'type':Sequelize[_0xa9e3('0x3')]},'viber':{'type':Sequelize[_0xa9e3('0x3')]},'line':{'type':Sequelize[_0xa9e3('0x3')]},'wechat':{'type':Sequelize[_0xa9e3('0x3')]},'telegram':{'type':Sequelize[_0xa9e3('0x3')]},'UserId':{'type':Sequelize[_0xa9e3('0x5')]},'AdditionalPhones':{'type':Sequelize[_0xa9e3('0x3')]},'priority':{'type':Sequelize[_0xa9e3('0x5')](0x2)[_0xa9e3('0x6')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'scheduledat':{'type':Sequelize[_0xa9e3('0x7')],'defaultValue':Sequelize[_0xa9e3('0x8')]},'dialTimezone':{'type':Sequelize[_0xa9e3('0x3')]},'utcOffset':{'type':Sequelize[_0xa9e3('0x5')]}}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.controller.js b/server/api/cmContact/cmContact.controller.js index 0e223e5..094d2d1 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 _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x5d80de,_0x2cf15d){var _0x1c7556=function(_0x5bd806){while(--_0x5bd806){_0x5d80de['push'](_0x5d80de['shift']());}};_0x1c7556(++_0x2cf15d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4fc9e6,_0xc51915){_0x4fc9e6=_0x4fc9e6-0x0;var _0x551d28=_0xa9e0[_0x4fc9e6];return _0x551d28;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file +var _0xa9e0=['source','destination','endtime','duration','note','createdAt','userDisposition','userSecondDisposition','userThirdDisposition','UserId','fullname','alias','DESC','findAndCountAll','startCase','Website','Account','closedAt','disposition','secondDisposition','thirdDisposition','Owner','browserName','customerIp','osName','ratingType','subject','substatus','externalUrl','threadId','Interaction','flatten','reverse','value','slice','moment','bluebird','util','squel','ioredis','../../components/contacts','../../components/parsers/qs','../../config/logger','api','../../config/environment/shared','../../mysqldb','redis','localhost','./cmContact.socket','register','status','offset','undefined','limit','count','Content-Range','then','destroy','end','sendStatus','stack','name','describe','getOptions','findAll','query','user','catch','CmContact','find','params','tags','keys','startsWith','cf_','displayName','analytics','CmCustomField','length','columnName','custom','type','values','forEach','hasOwnProperty','body','from','get','isArray','join','info','[CmContact][merge]\x20to\x20%s\x20from\x20%s','CmHopper','[CmContact][merge][destroy][CmHopper],\x20%s','CmHopperBlack','[CmContact][merge][destroy][CmHopperBlack],\x20%s','create','ChatInteraction','update','ChatMessage','ChatOfflineMessage','MailInteraction','MailMessage','SmsInteraction','SmsMessage','FaxInteraction','FaxMessage','OpenchannelInteraction','OpenchannelMessage','CmContactHasItem','CmHopperFinal','ReportAgentPreview','VoiceCallReport','ChatQueueReport','MailQueueReport','OpenchannelQueueReport','SmsQueueReport','WhatsappInteraction','WhatsappMessage','WhatsappQueueReport','dialTimezone','isNil','timezones','utcOffset','additionalPhones','bulkCreate','duplicates','where','$or','push','ListId','findOrCreate','spread','all','show','Tag','color','tag','Phones','ContactItemType','ItemType','literal','Phones.OrderBy','$and','map','format','omit','cf_%d','isEmpty','cm_contacts','id\x20=\x20?','toParam','text','phone','getTags','model','rawAttributes','filters','intersection','attributes','fields','order','sort','pick','filter','merge','nolimit','setTags','findOne','ids','setAdditionalPhones','OrderBy','items','item_types','ItemTypeId','description','contact\x20phone\x20exists','CmHopperAdditionalPhone','item','sequelize','`ItemType`.OrderBy','CmHopperId','ItemType.OrderBy','getAdditionalPhones','PHONE','duplicateAdditionalPhones','CmContactId','toContactId','rescheduleAdditionalPhones','ContactId','options','includeAll','include','getHopperHistories','CmHopperHistory','rows','getJscriptySessions','JscriptySessionReport','uploadCsv','No\x20ListId\x20specified','binding_keys','No\x20association\x20keys\x20specified!','binding_values','No\x20association\x20values\x20specified!','socket_timestamp','Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed','split','Incorrect\x20binding\x20parameters\x20passed!','zipObject','No\x20phone\x20column\x20specified','firstName','No\x20firstName\x20column\x20specified','root','file','chmodSync','0777','child_process','fork','../../components/import/cm/csv','CompanyId','json','File\x20uploaded\x20correctly!','pid','send','path','meta','import','agent','binding','stringify','message','start\x20child\x20process\x20correctly!','error\x20child\x20process','importUpdates','User','../../components/import/cm/csvUpdates','exit','getJourney','mail','chat','sms','openchannel','fax','whatsapp','voice','-createdAt','resolve','channel','includes','toLowerCase','Invalid\x20channel','range','parse','isValid','Invalid\x20date\x20for\x20range\x20to\x20filter','Invalid\x20createdAt\x20filter'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xa9e0,0x123));var _0x0a9e=function(_0x13ea00,_0x12f610){_0x13ea00=_0x13ea00-0x0;var _0x1f7347=_0xa9e0[_0x13ea00];return _0x1f7347;};'use strict';var moment=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var path=require('path');var fs=require('fs');var _=require('lodash');var squel=require(_0x0a9e('0x3'));var Papa=require('papaparse');var Redis=require(_0x0a9e('0x4'));var contacts=require(_0x0a9e('0x5'));var qs=require(_0x0a9e('0x6'));var logger=require(_0x0a9e('0x7'))(_0x0a9e('0x8'));var config=require('../../config/environment');var shared=require(_0x0a9e('0x9'));var db=require(_0x0a9e('0xa'))['db'];config[_0x0a9e('0xb')]=_['defaults'](config['redis'],{'host':_0x0a9e('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x0a9e('0xd'))[_0x0a9e('0xe')](socket);function respondWithResult(_0x307b3e,_0x3ab53f){_0x3ab53f=_0x3ab53f||0xc8;return function(_0xfeb75b){if(_0xfeb75b){return _0x307b3e[_0x0a9e('0xf')](_0x3ab53f)['json'](_0xfeb75b);}};}function respondWithFilteredResult(_0x50dfb2,_0x527cdd){return function(_0x4cfe67){if(_0x4cfe67){var _0x273d4d=typeof _0x527cdd[_0x0a9e('0x10')]===_0x0a9e('0x11')&&typeof _0x527cdd[_0x0a9e('0x12')]===_0x0a9e('0x11');var _0x69aeb7=_0x4cfe67['count'];var _0x4283ce=_0x273d4d?0x0:_0x527cdd[_0x0a9e('0x10')];var _0x2b4227=_0x273d4d?_0x4cfe67[_0x0a9e('0x13')]:_0x527cdd[_0x0a9e('0x10')]+_0x527cdd[_0x0a9e('0x12')];var _0x52a03d;if(_0x2b4227>=_0x69aeb7){_0x2b4227=_0x69aeb7;_0x52a03d=0xc8;}else{_0x52a03d=0xce;}_0x50dfb2[_0x0a9e('0xf')](_0x52a03d);return _0x50dfb2['set'](_0x0a9e('0x14'),_0x4283ce+'-'+_0x2b4227+'/'+_0x69aeb7)['json'](_0x4cfe67);}return null;};}function saveUpdates(_0x16033c){return function(_0x12066b){if(_0x12066b){return _0x12066b['update'](_0x16033c)[_0x0a9e('0x15')](function(_0x5a0a06){return _0x5a0a06;});}return null;};}function removeEntity(_0x459eb1){return function(_0x478723){if(_0x478723){return _0x478723[_0x0a9e('0x16')]()[_0x0a9e('0x15')](function(){_0x459eb1[_0x0a9e('0xf')](0xcc)[_0x0a9e('0x17')]();});}};}function handleEntityNotFound(_0x530eb7){return function(_0x20559e){if(!_0x20559e){_0x530eb7[_0x0a9e('0x18')](0x194);}return _0x20559e;};}function handleError(_0x112016,_0x1c696a){_0x1c696a=_0x1c696a||0x1f4;return function(_0x105080){logger['error'](_0x105080[_0x0a9e('0x19')]);if(_0x105080[_0x0a9e('0x1a')]){delete _0x105080['name'];}_0x112016[_0x0a9e('0xf')](_0x1c696a)['send'](_0x105080);};}exports['index']=function(_0x3a02e1,_0x432e56){var _0x38e7c4={};return contacts[_0x0a9e('0x1b')]()['then'](function(_0xfb6e48){_0x38e7c4=qs[_0x0a9e('0x1c')](_0xfb6e48,_0x3a02e1);return contacts[_0x0a9e('0x1d')](_0x3a02e1[_0x0a9e('0x1e')],_0x3a02e1[_0x0a9e('0x1f')],_0x38e7c4,_0xfb6e48);})[_0x0a9e('0x15')](respondWithFilteredResult(_0x432e56,_0x38e7c4))[_0x0a9e('0x20')](handleError(_0x432e56,null));};exports['destroy']=function(_0x59181e,_0x197ec0){return db[_0x0a9e('0x21')][_0x0a9e('0x22')]({'where':{'id':_0x59181e[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x197ec0,null))[_0x0a9e('0x15')](removeEntity(_0x197ec0,null))['catch'](handleError(_0x197ec0,null));};exports[_0x0a9e('0x1b')]=function(_0x5bfb33,_0x1dc186){return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x140511){delete _0x140511[_0x0a9e('0x24')];for(var _0x11c3b6=0x0;_0x11c3b60x0){return new Promise(function(_0x56e31e){var _0x3ef315=[];for(var _0x427946=0x0;_0x427946<_0x401837[_0x0a9e('0x2b')];_0x427946++){_0x3ef315['push'](insertAdditionalPhones(_0x401837[_0x427946]['contact'],_0x401837[_0x427946]['additionalPhones']));}Promise[_0x0a9e('0x62')](_0x3ef315)[_0x0a9e('0x15')](function(){_0x56e31e(0x1);});})[_0x0a9e('0x15')](function(){return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};});}else{return{'success':_0x17e88c,'failure':_0x88dcbf,'duplicates':_0x409b29};}}})[_0x0a9e('0x15')](respondWithResult(_0x797b45,0xc9))[_0x0a9e('0x20')](handleError(_0x797b45,null));};exports[_0x0a9e('0x63')]=function(_0xeef20,_0x1a0677){var _0x5512d1;return db[_0x0a9e('0x21')][_0x0a9e('0x1b')]()[_0x0a9e('0x15')](function(_0x4a4fc7){return db[_0x0a9e('0x21')]['find']({'where':{'id':_0xeef20[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x0a9e('0x64')],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'required':_0xeef20[_0x0a9e('0x1e')][_0x0a9e('0x66')]?!![]:![]},{'model':db['CmContactHasItem'],'as':_0x0a9e('0x67'),'where':{'CmContactId':_0xeef20[_0x0a9e('0x23')]['id']},'required':![],'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}]}],'order':[db['sequelize'][_0x0a9e('0x6a')](_0x0a9e('0x6b'))],'attributes':_[_0x0a9e('0x25')](_0x4a4fc7)});})[_0x0a9e('0x15')](function(_0x4abc8f){if(!_[_0x0a9e('0x56')](_0x4abc8f)){_0x5512d1=_0x4abc8f[_0x0a9e('0x34')]({'plain':!![]});var _0x30a4c7={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0x4abc8f&&_0x4abc8f[_0x0a9e('0x5f')]){if(_0x4abc8f[_0x0a9e('0x5f')]){_0x30a4c7[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0x4abc8f[_0x0a9e('0x5f')]}});}}return db[_0x0a9e('0x2a')][_0x0a9e('0x1d')](_0x30a4c7);}})[_0x0a9e('0x15')](function(_0x25744a){if(!_[_0x0a9e('0x56')](_0x25744a)){return _['omit'](_0x5512d1,_[_0x0a9e('0x6d')](_0x25744a,function(_0x11da9c){return util[_0x0a9e('0x6e')]('cf_%d',_0x11da9c['id']);}));}})[_0x0a9e('0x15')](handleEntityNotFound(_0x1a0677,null))[_0x0a9e('0x15')](respondWithResult(_0x1a0677,null))[_0x0a9e('0x20')](handleError(_0x1a0677,null));};exports[_0x0a9e('0x3f')]=function(_0x56d650,_0x541e80){var _0x7ebea8;if(_0x56d650[_0x0a9e('0x32')]['id']){delete _0x56d650['body']['id'];}if(!_[_0x0a9e('0x56')](_0x56d650['body'][_0x0a9e('0x55')])){var _0x8ebf02=_0x56d650['body'][_0x0a9e('0x55')];if(!_[_0x0a9e('0x56')](shared[_0x0a9e('0x57')][_0x8ebf02]))_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x58')]=shared[_0x0a9e('0x57')][_0x8ebf02][_0x0a9e('0x58')];}return db['CmContact'][_0x0a9e('0x22')]({'where':{'id':_0x56d650[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x541e80,null))[_0x0a9e('0x15')](saveUpdates(_0x56d650['body'],null))[_0x0a9e('0x15')](function(_0xf0db1){_0x7ebea8=_0xf0db1;var _0x4bf3a5={'where':{'$and':[{'ListId':{'$ne':null}}]}};if(_0xf0db1&&_0xf0db1[_0x0a9e('0x5f')]){if(_0xf0db1['ListId']){_0x4bf3a5[_0x0a9e('0x5c')][_0x0a9e('0x6c')][_0x0a9e('0x5e')]({'ListId':{'$ne':_0xf0db1[_0x0a9e('0x5f')]}});}}return db['CmCustomField']['findAll'](_0x4bf3a5);})[_0x0a9e('0x15')](function(_0x2b9c01){if(_0x2b9c01){return _[_0x0a9e('0x6f')](_['pickBy'](_0x56d650[_0x0a9e('0x32')],function(_0x36e975,_0x524e38){return _['startsWith'](_0x524e38,_0x0a9e('0x27'));}),_['map'](_0x2b9c01,function(_0x5ea541){return util['format'](_0x0a9e('0x70'),_0x5ea541['id']);}));}})[_0x0a9e('0x15')](function(_0x9044fe){if(_0x9044fe&&!_[_0x0a9e('0x71')](_0x9044fe)){var _0x3c6dd6=squel[_0x0a9e('0x3f')]()['table'](_0x0a9e('0x72'))['setFields'](_0x9044fe)[_0x0a9e('0x5c')](_0x0a9e('0x73'),_0x56d650[_0x0a9e('0x23')]['id'])[_0x0a9e('0x74')]();return db['sequelize'][_0x0a9e('0x1e')](_0x3c6dd6[_0x0a9e('0x75')],{'replacements':_0x3c6dd6[_0x0a9e('0x2f')]});}})['then'](function(){if(_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')]&&_0x7ebea8){return db[_0x0a9e('0x39')][_0x0a9e('0x3f')]({'phone':_0x56d650[_0x0a9e('0x32')][_0x0a9e('0x76')],'OrderBy':0x0},{'where':{'ContactId':_0x7ebea8['id']}});}})[_0x0a9e('0x15')](function(){return _0x7ebea8;})[_0x0a9e('0x15')](respondWithResult(_0x541e80,null))['catch'](handleError(_0x541e80,null));};exports[_0x0a9e('0x77')]=function(_0x3325c5,_0x589ff3){var _0x40e0f0={};var _0x982340={};var _0x3a1974;var _0x5a26c8;return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x3325c5[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x589ff3,null))[_0x0a9e('0x15')](function(_0x1f29bd){if(_0x1f29bd){_0x3a1974=_0x1f29bd;_0x982340[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x64')][_0x0a9e('0x79')]);_0x982340['query']=_[_0x0a9e('0x25')](_0x3325c5[_0x0a9e('0x1e')]);_0x982340[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],_0x982340[_0x0a9e('0x1e')]);_0x40e0f0[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x982340[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x40e0f0[_0x0a9e('0x7c')]=_0x40e0f0['attributes'][_0x0a9e('0x2b')]?_0x40e0f0[_0x0a9e('0x7c')]:_0x982340[_0x0a9e('0x78')];_0x40e0f0[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x3325c5['query'][_0x0a9e('0x7f')]);_0x40e0f0[_0x0a9e('0x5c')]=qs['filters'](_[_0x0a9e('0x80')](_0x3325c5['query'],_0x982340[_0x0a9e('0x7a')]));if(_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x40e0f0[_0x0a9e('0x5c')]=_['merge'](_0x40e0f0[_0x0a9e('0x5c')],{'$or':_['map'](_0x40e0f0[_0x0a9e('0x7c')],function(_0x3d0a77){var _0x5e5b89={};_0x5e5b89[_0x3d0a77]={'$like':'%'+_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x5e5b89;})});}_0x40e0f0=_[_0x0a9e('0x82')]({},_0x40e0f0,_0x3325c5['options']);return _0x3a1974['getTags'](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x6ba2be){if(_0x6ba2be){_0x5a26c8=_0x6ba2be[_0x0a9e('0x2b')];if(!_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x40e0f0[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3325c5[_0x0a9e('0x1e')]['limit']);_0x40e0f0[_0x0a9e('0x10')]=qs['offset'](_0x3325c5[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}return _0x3a1974[_0x0a9e('0x77')](_0x40e0f0);}})[_0x0a9e('0x15')](function(_0x1b61d5){if(_0x1b61d5){return _0x1b61d5?{'count':_0x5a26c8,'rows':_0x1b61d5}:null;}})['then'](respondWithResult(_0x589ff3,null))[_0x0a9e('0x20')](handleError(_0x589ff3,null));};exports[_0x0a9e('0x84')]=function(_0x2791c5,_0x2aa5f2){if(_0x2791c5[_0x0a9e('0x32')]['id']){delete _0x2791c5['body']['id'];}return db['CmContact'][_0x0a9e('0x85')]({'where':{'id':_0x2791c5['params']['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x2aa5f2,null))[_0x0a9e('0x15')](function(_0x4672e1){if(_0x4672e1){return _0x4672e1[_0x0a9e('0x84')](_0x2791c5[_0x0a9e('0x32')][_0x0a9e('0x86')]||[]);}return null;})['then'](respondWithResult(_0x2aa5f2,null))['catch'](handleError(_0x2aa5f2,null));};exports[_0x0a9e('0x87')]=function(_0x5dfbe2,_0x2469d1){var _0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](addAdditionalPhones(_0x5dfbe2['body']));Promise['all'](_0x5c689c)[_0x0a9e('0x15')](function(){_0x5c689c=[];_0x5c689c[_0x0a9e('0x5e')](deleteCmHopperPhones(_0x5dfbe2['body']['id']));_0x5c689c[_0x0a9e('0x5e')](addCmHopperPhones(_0x5dfbe2[_0x0a9e('0x32')]['id']));Promise[_0x0a9e('0x62')](_0x5c689c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x2469d1,null));});};function addAdditionalPhones(_0x5ab0bc){var _0x5505f4;return new Promise(function(_0x16449b){return db[_0x0a9e('0x4a')][_0x0a9e('0x16')]({'where':{'CmContactId':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){db[_0x0a9e('0x68')]['findAll']({'raw':!![],'attributes':['id',_0x0a9e('0x88')]})[_0x0a9e('0x15')](function(_0x5416a9){var _0x3c313d=[];for(var _0x19fd11=0x0;_0x19fd11<_0x5ab0bc[_0x0a9e('0x89')][_0x0a9e('0x2b')];_0x19fd11++){var _0x23b25b=_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?'':_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['ItemTypeId']?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:'';var _0x2ada60=_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11]['description'])?'':_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8c')];var _0x16ae1a=_0x23b25b+':'+_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')]+'§'+_0x2ada60;if(_[_0x0a9e('0x56')](_0x5505f4))_0x5505f4=_0x16ae1a;else _0x5505f4+=';'+_0x16ae1a;var _0x59e46f=null;var _0x1339d0=null;if(_0x5ab0bc[_0x0a9e('0x8a')]){if(!_[_0x0a9e('0x56')](_0x5ab0bc['item_types'][_0x19fd11])){_0x1339d0=_[_0x0a9e('0x22')](_0x5416a9,function(_0x59aa7b){return _0x59aa7b['id']===_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11];});if(!_['isNil'](_0x1339d0)){_0x59e46f=_0x1339d0[_0x0a9e('0x88')];}}}else{if(!_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11])){_0x1339d0=_['find'](_0x5416a9,function(_0xc9529d){return _0xc9529d['id']===_0x5ab0bc['items'][_0x19fd11][_0x0a9e('0x8b')];});if(!_[_0x0a9e('0x56')](_0x1339d0)){_0x59e46f=_0x19fd11;}}}if(_[_0x0a9e('0x56')](_0x59e46f)){_0x59e46f=0x64;}_0x3c313d[_0x0a9e('0x5e')](addAdditionalPhone(_0x5ab0bc['id'],_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x76')],_0x5ab0bc[_0x0a9e('0x8a')]?_[_0x0a9e('0x56')](_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11])?null:_0x5ab0bc[_0x0a9e('0x8a')][_0x19fd11]:_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]?_0x5ab0bc[_0x0a9e('0x89')][_0x19fd11][_0x0a9e('0x8b')]:null,_0x59e46f,_0x2ada60));}Promise[_0x0a9e('0x62')](_0x3c313d)[_0x0a9e('0x15')](function(){db['CmContact']['update']({'AdditionalPhones':_0x5505f4},{'where':{'id':_0x5ab0bc['id']}})[_0x0a9e('0x15')](function(){_0x16449b(0x1);});});});});});}function addAdditionalPhone(_0x5c4be0,_0x1d999b,_0x3428c9,_0x5d6b69,_0x1a3754){return db[_0x0a9e('0x4a')][_0x0a9e('0x22')]({'where':{'CmContactId':_0x5c4be0,'item':_0x1d999b}})[_0x0a9e('0x15')](function(_0x5585d5){if(_0x5585d5)logger[_0x0a9e('0x37')](_0x0a9e('0x8d'),_0x5585d5);else{db[_0x0a9e('0x4a')][_0x0a9e('0x3d')]({'CmContactId':_0x5c4be0,'item':_0x1d999b,'ItemTypeId':_0x3428c9,'OrderBy':_0x5d6b69,'ItemClass':'PHONE','description':_0x1a3754});}});}function deleteCmHopperPhones(_0x19e9ed){return new Promise(function(_0x1a0b08){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x19e9ed}})[_0x0a9e('0x15')](function(_0x270df8){db[_0x0a9e('0x8e')]['destroy']({'where':{'CmHopperId':{'$in':_[_0x0a9e('0x6d')](_0x270df8,'id')}}});})[_0x0a9e('0x15')](function(){_0x1a0b08(0x1);});});}function addCmHopperPhones(_0x1d9b57){return new Promise(function(_0x1a7f58){return db[_0x0a9e('0x39')]['findAll']({'raw':!![],'attributes':['id'],'where':{'ContactId':_0x1d9b57}})[_0x0a9e('0x15')](function(_0x289e65){var _0x4795ae=[];_[_0x0a9e('0x6d')](_0x289e65,function(_0x1fcfe6){_0x4795ae[_0x0a9e('0x5e')](createCmHopperPhone(_0x1d9b57,_0x1fcfe6['id']));});Promise['all'](_0x4795ae)['then'](function(){_0x1a7f58(0x1);});});});}function createCmHopperPhone(_0x523d08,_0x1015aa){return new Promise(function(_0x4a70ce){db['CmContactHasItem'][_0x0a9e('0x1d')]({'raw':!![],'attributes':[_0x0a9e('0x8f'),_0x0a9e('0x88')],'where':{'CmContactId':_0x523d08,'ItemClass':'PHONE'},'include':[{'model':db[_0x0a9e('0x68')],'attributes':[_0x0a9e('0x88')],'as':_0x0a9e('0x69')}],'order':[_0x0a9e('0x88'),db[_0x0a9e('0x90')][_0x0a9e('0x6a')](_0x0a9e('0x91'))]})[_0x0a9e('0x15')](function(_0x3b5bda){var _0x5a1848=0x1;var _0x43c397=_['map'](_0x3b5bda,function(_0x138cf5){_0x138cf5[_0x0a9e('0x92')]=_0x1015aa;_0x138cf5[_0x0a9e('0x76')]=_0x138cf5[_0x0a9e('0x8f')];_0x138cf5[_0x0a9e('0x88')]=_0x5a1848;delete _0x138cf5[_0x0a9e('0x93')];_0x5a1848=_0x5a1848+0x1;return _0x138cf5;});return db['CmHopperAdditionalPhone'][_0x0a9e('0x5a')](_0x43c397,{});})[_0x0a9e('0x15')](function(){_0x4a70ce(0x1);});});}function insertAdditionalPhones(_0xe25eb5,_0x1af799){return new Promise(function(_0x51aa2f){var _0x2e4887=[];for(var _0x3c9135=0x0;_0x3c9135<_0x1af799[_0x0a9e('0x2b')];_0x3c9135++){var _0x1c9539=_0x1af799[_0x3c9135];_0x2e4887[_0x0a9e('0x5e')](parseContactItemType(_0x1c9539));}Promise[_0x0a9e('0x62')](_0x2e4887)[_0x0a9e('0x15')](function(){var _0x25931e={'id':_0xe25eb5['id'],'items':_0x1af799};return addAdditionalPhones(_0x25931e)[_0x0a9e('0x15')](function(){return addCmHopperPhones(_0xe25eb5['id']);});})[_0x0a9e('0x15')](function(){_0x51aa2f(_0xe25eb5);});});}function parseContactItemType(_0x57f0ad){return new Promise(function(_0x2272bc){if(_0x57f0ad[_0x0a9e('0x31')](_0x0a9e('0x8b'))){_0x2272bc(_0x57f0ad);}else{return db[_0x0a9e('0x68')][_0x0a9e('0x22')]({'where':{'name':_0x57f0ad[_0x0a9e('0x69')]}})[_0x0a9e('0x15')](function(_0x20ae21){if(_['isNil'](_0x20ae21))_0x57f0ad[_0x0a9e('0x8b')]=null;else _0x57f0ad[_0x0a9e('0x8b')]=_0x20ae21['id'];_0x2272bc(_0x57f0ad);});}});}exports[_0x0a9e('0x94')]=function(_0x5c65fc,_0x1402c7){return db[_0x0a9e('0x4a')][_0x0a9e('0x1d')]({'raw':!![],'where':{'CmContactId':_0x5c65fc[_0x0a9e('0x23')]['id'],'ItemClass':_0x0a9e('0x95')},'include':[{'model':db[_0x0a9e('0x68')],'as':_0x0a9e('0x69')}],'order':[[_0x0a9e('0x88')],[db[_0x0a9e('0x90')][_0x0a9e('0x6a')]('`ItemType`.OrderBy')]]})[_0x0a9e('0x15')](function(_0x446e6){return _0x446e6;})[_0x0a9e('0x15')](respondWithResult(_0x1402c7,null))[_0x0a9e('0x20')](handleError(_0x1402c7,null));};exports[_0x0a9e('0x96')]=function(_0x3942fd,_0x5cb48d){return db[_0x0a9e('0x4a')]['findAll']({'raw':!![],'where':{'CmContactId':_0x3942fd['body']['fromContactId']}})[_0x0a9e('0x15')](function(_0x3fa3f2){var _0x426cb4=_[_0x0a9e('0x6d')](_0x3fa3f2,function(_0x4d99a8){_0x4d99a8[_0x0a9e('0x97')]=_0x3942fd[_0x0a9e('0x32')][_0x0a9e('0x98')];return _0x4d99a8;});return db[_0x0a9e('0x4a')][_0x0a9e('0x5a')](_0x426cb4,{});})['then'](function(){return addCmHopperPhones(_0x3942fd['body'][_0x0a9e('0x98')]);})[_0x0a9e('0x15')](function(){return['ok'];})[_0x0a9e('0x15')](respondWithResult(_0x5cb48d,null))['catch'](handleError(_0x5cb48d,null));};exports[_0x0a9e('0x99')]=function(_0x248a9a,_0x422f0a){var _0x4cee8c=[];_0x4cee8c[_0x0a9e('0x5e')](createCmHopperPhone(_0x248a9a[_0x0a9e('0x32')]['id'],_0x248a9a[_0x0a9e('0x32')]['hopperId']));Promise[_0x0a9e('0x62')](_0x4cee8c)[_0x0a9e('0x15')](function(){return[0x1];})[_0x0a9e('0x15')](respondWithResult(_0x422f0a,null));};exports['getHoppers']=function(_0x549697,_0x53ef46){var _0x3b04fd={'raw':![],'where':{}};var _0x1f50db={};var _0xcbc73c={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')]['findOne']({'where':{'id':_0x549697[_0x0a9e('0x23')]['id']}})['then'](handleEntityNotFound(_0x53ef46,null))[_0x0a9e('0x15')](function(_0x2ff2ab){if(_0x2ff2ab){_0x1f50db[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x39')][_0x0a9e('0x79')]);_0x1f50db[_0x0a9e('0x1e')]=_['keys'](_0x549697[_0x0a9e('0x1e')]);_0x1f50db['filters']=_[_0x0a9e('0x7b')](_0x1f50db['model'],_0x1f50db[_0x0a9e('0x1e')]);_0x3b04fd['attributes']=_[_0x0a9e('0x7b')](_0x1f50db[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x3b04fd[_0x0a9e('0x7c')]=_0x3b04fd[_0x0a9e('0x7c')]['length']?_0x3b04fd[_0x0a9e('0x7c')]:_0x1f50db[_0x0a9e('0x78')];if(!_0x549697['query'][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x3b04fd['limit']=qs[_0x0a9e('0x12')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x3b04fd['offset']=qs[_0x0a9e('0x10')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x3b04fd[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x3b04fd[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x549697['query'],_0x1f50db[_0x0a9e('0x7a')]));_0x3b04fd['where'][_0x0a9e('0x9a')]=_0x2ff2ab['id'];if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x3b04fd[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x3b04fd[_0x0a9e('0x5c')],{'$or':_['map'](_0x3b04fd[_0x0a9e('0x7c')],function(_0x469035){var _0x2977a7={};_0x2977a7[_0x469035]={'$like':'%'+_0x549697['query'][_0x0a9e('0x81')]+'%'};return _0x2977a7;})});}_0x3b04fd=_[_0x0a9e('0x82')]({},_0x3b04fd,_0x549697[_0x0a9e('0x9b')]);return db[_0x0a9e('0x39')][_0x0a9e('0x13')]({'where':_0x3b04fd[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x5f2c51){_0xcbc73c[_0x0a9e('0x13')]=_0x5f2c51;if(_0x549697[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x3b04fd[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x39')][_0x0a9e('0x1d')](_0x3b04fd);})[_0x0a9e('0x15')](function(_0x5d6a48){_0xcbc73c['rows']=_0x5d6a48;return _0xcbc73c;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x53ef46,_0x3b04fd))[_0x0a9e('0x20')](handleError(_0x53ef46,null));};exports[_0x0a9e('0x9e')]=function(_0x1bf692,_0x40e2da){var _0x131da8={'raw':!![],'where':{}};var _0x609711={};var _0x584854={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x1bf692[_0x0a9e('0x23')]['id']}})[_0x0a9e('0x15')](handleEntityNotFound(_0x40e2da,null))[_0x0a9e('0x15')](function(_0x3c6082){if(_0x3c6082){_0x609711[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0x9f')][_0x0a9e('0x79')]);_0x609711[_0x0a9e('0x1e')]=_['keys'](_0x1bf692[_0x0a9e('0x1e')]);_0x609711[_0x0a9e('0x7a')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],_0x609711['query']);_0x131da8[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x609711[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x131da8[_0x0a9e('0x7c')]=_0x131da8[_0x0a9e('0x7c')]['length']?_0x131da8[_0x0a9e('0x7c')]:_0x609711[_0x0a9e('0x78')];if(!_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0x131da8['limit']=qs[_0x0a9e('0x12')](_0x1bf692[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x131da8['offset']=qs[_0x0a9e('0x10')](_0x1bf692[_0x0a9e('0x1e')]['offset']);}_0x131da8[_0x0a9e('0x7e')]=qs['sort'](_0x1bf692[_0x0a9e('0x1e')]['sort']);_0x131da8['where']=qs['filters'](_[_0x0a9e('0x80')](_0x1bf692[_0x0a9e('0x1e')],_0x609711[_0x0a9e('0x7a')]));_0x131da8[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x3c6082['id'];if(_0x1bf692[_0x0a9e('0x1e')]['filter']){_0x131da8[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x131da8[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x131da8[_0x0a9e('0x7c')],function(_0x18dccf){var _0x31c937={};_0x31c937[_0x18dccf]={'$like':'%'+_0x1bf692['query']['filter']+'%'};return _0x31c937;})});}_0x131da8=_[_0x0a9e('0x82')]({},_0x131da8,_0x1bf692['options']);return db[_0x0a9e('0x9f')][_0x0a9e('0x13')]({'where':_0x131da8[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x37a448){_0x584854[_0x0a9e('0x13')]=_0x37a448;if(_0x1bf692['query'][_0x0a9e('0x9c')]){_0x131da8['include']=[{'all':!![]}];}return db['CmHopperHistory'][_0x0a9e('0x1d')](_0x131da8);})['then'](function(_0x38dceb){_0x584854['rows']=_0x38dceb;return _0x584854;});}})['then'](respondWithFilteredResult(_0x40e2da,_0x131da8))[_0x0a9e('0x20')](handleError(_0x40e2da,null));};exports['getHopperFinals']=function(_0x24470a,_0x142e53){var _0xe1ab0d={'raw':!![],'where':{}};var _0x48f532={};var _0x4152cd={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x24470a['params']['id']}})['then'](handleEntityNotFound(_0x142e53,null))[_0x0a9e('0x15')](function(_0x948aab){if(_0x948aab){_0x48f532[_0x0a9e('0x78')]=_[_0x0a9e('0x25')](db[_0x0a9e('0x4b')][_0x0a9e('0x79')]);_0x48f532[_0x0a9e('0x1e')]=_[_0x0a9e('0x25')](_0x24470a[_0x0a9e('0x1e')]);_0x48f532[_0x0a9e('0x7a')]=_['intersection'](_0x48f532['model'],_0x48f532['query']);_0xe1ab0d[_0x0a9e('0x7c')]=_[_0x0a9e('0x7b')](_0x48f532[_0x0a9e('0x78')],qs[_0x0a9e('0x7d')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0xe1ab0d[_0x0a9e('0x7c')]=_0xe1ab0d[_0x0a9e('0x7c')]['length']?_0xe1ab0d['attributes']:_0x48f532[_0x0a9e('0x78')];if(!_0x24470a[_0x0a9e('0x1e')]['hasOwnProperty'](_0x0a9e('0x83'))){_0xe1ab0d[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0xe1ab0d[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0xe1ab0d[_0x0a9e('0x7e')]=qs[_0x0a9e('0x7f')](_0x24470a[_0x0a9e('0x1e')]['sort']);_0xe1ab0d[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_[_0x0a9e('0x80')](_0x24470a[_0x0a9e('0x1e')],_0x48f532[_0x0a9e('0x7a')]));_0xe1ab0d[_0x0a9e('0x5c')][_0x0a9e('0x9a')]=_0x948aab['id'];if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0xe1ab0d[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0xe1ab0d[_0x0a9e('0x5c')],{'$or':_['map'](_0xe1ab0d['attributes'],function(_0x3e5182){var _0x401207={};_0x401207[_0x3e5182]={'$like':'%'+_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x81')]+'%'};return _0x401207;})});}_0xe1ab0d=_[_0x0a9e('0x82')]({},_0xe1ab0d,_0x24470a[_0x0a9e('0x9b')]);return db[_0x0a9e('0x4b')]['count']({'where':_0xe1ab0d[_0x0a9e('0x5c')]})['then'](function(_0x26aa44){_0x4152cd[_0x0a9e('0x13')]=_0x26aa44;if(_0x24470a[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0xe1ab0d[_0x0a9e('0x9d')]=[{'all':!![]}];}return db[_0x0a9e('0x4b')][_0x0a9e('0x1d')](_0xe1ab0d);})[_0x0a9e('0x15')](function(_0xa7a754){_0x4152cd[_0x0a9e('0xa0')]=_0xa7a754;return _0x4152cd;});}})[_0x0a9e('0x15')](respondWithFilteredResult(_0x142e53,_0xe1ab0d))[_0x0a9e('0x20')](handleError(_0x142e53,null));};exports[_0x0a9e('0xa1')]=function(_0x3f7cb6,_0x3c8a9a){var _0x2d5e00={'raw':!![],'where':{}};var _0x5b78a8={};var _0x54cf62={'count':0x0,'rows':[]};return db[_0x0a9e('0x21')][_0x0a9e('0x85')]({'where':{'id':_0x3f7cb6['params']['id']}})['then'](handleEntityNotFound(_0x3c8a9a,null))[_0x0a9e('0x15')](function(_0x1feb9){if(_0x1feb9){_0x5b78a8[_0x0a9e('0x78')]=_['keys'](db[_0x0a9e('0xa2')]['rawAttributes']);_0x5b78a8[_0x0a9e('0x1e')]=_['keys'](_0x3f7cb6[_0x0a9e('0x1e')]);_0x5b78a8['filters']=_[_0x0a9e('0x7b')](_0x5b78a8[_0x0a9e('0x78')],_0x5b78a8[_0x0a9e('0x1e')]);_0x2d5e00['attributes']=_[_0x0a9e('0x7b')](_0x5b78a8['model'],qs['fields'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7d')]));_0x2d5e00[_0x0a9e('0x7c')]=_0x2d5e00[_0x0a9e('0x7c')][_0x0a9e('0x2b')]?_0x2d5e00[_0x0a9e('0x7c')]:_0x5b78a8[_0x0a9e('0x78')];if(!_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x31')](_0x0a9e('0x83'))){_0x2d5e00[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x12')]);_0x2d5e00[_0x0a9e('0x10')]=qs[_0x0a9e('0x10')](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}_0x2d5e00[_0x0a9e('0x7e')]=qs['sort'](_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x7f')]);_0x2d5e00[_0x0a9e('0x5c')]=qs[_0x0a9e('0x7a')](_['pick'](_0x3f7cb6['query'],_0x5b78a8['filters']));_0x2d5e00[_0x0a9e('0x5c')]['ContactId']=_0x1feb9['id'];if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x81')]){_0x2d5e00[_0x0a9e('0x5c')]=_[_0x0a9e('0x82')](_0x2d5e00[_0x0a9e('0x5c')],{'$or':_[_0x0a9e('0x6d')](_0x2d5e00[_0x0a9e('0x7c')],function(_0x1cc73e){var _0x2154d8={};_0x2154d8[_0x1cc73e]={'$like':'%'+_0x3f7cb6[_0x0a9e('0x1e')]['filter']+'%'};return _0x2154d8;})});}_0x2d5e00=_[_0x0a9e('0x82')]({},_0x2d5e00,_0x3f7cb6['options']);return db[_0x0a9e('0xa2')]['count']({'where':_0x2d5e00[_0x0a9e('0x5c')]})[_0x0a9e('0x15')](function(_0x216791){_0x54cf62['count']=_0x216791;if(_0x3f7cb6[_0x0a9e('0x1e')][_0x0a9e('0x9c')]){_0x2d5e00['include']=[{'all':!![]}];}return db['JscriptySessionReport'][_0x0a9e('0x1d')](_0x2d5e00);})[_0x0a9e('0x15')](function(_0x1262ff){_0x54cf62['rows']=_0x1262ff;return _0x54cf62;});}})['then'](respondWithFilteredResult(_0x3c8a9a,_0x2d5e00))['catch'](handleError(_0x3c8a9a,null));};exports[_0x0a9e('0xa3')]=function(_0x22c591,_0x2b7ba9){try{if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]){throw new Error(_0x0a9e('0xa6'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')]){throw new Error(_0x0a9e('0xa8'));}if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error(_0x0a9e('0xaa'));}var _0x1a74c4=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa5')]['split'](',');var _0xb33e27=_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')][_0x0a9e('0xab')](',');if(!_0x1a74c4[_0x0a9e('0x2b')]||!_0xb33e27[_0x0a9e('0x2b')]||_0x1a74c4['length']!==_0xb33e27[_0x0a9e('0x2b')]){throw new Error(_0x0a9e('0xac'));}_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')]=_[_0x0a9e('0xad')](_0x1a74c4,_0xb33e27);if(!_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x7d')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x22c591['body']['fields'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}var _0x5c2996=path[_0x0a9e('0x36')](config[_0x0a9e('0xb1')],'server/files/tmp',_0x22c591[_0x0a9e('0xb2')]['filename']);fs[_0x0a9e('0xb3')](_0x5c2996,parseInt(_0x0a9e('0xb4'),0x8));var _0x58c53c=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xb7')),[_0x5c2996,_0x22c591[_0x0a9e('0x32')]['binding_keys'],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xa7')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0x5f')],_0x22c591[_0x0a9e('0x32')][_0x0a9e('0xb8')],_0x22c591['body'][_0x0a9e('0x5b')],_0x22c591[_0x0a9e('0x32')]['socket_timestamp']]);return _0x2b7ba9[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xba'),'pid':_0x58c53c[_0x0a9e('0xbb')]});}catch(_0x3fae71){return _0x2b7ba9[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xbc')](_0x3fae71);}};exports['upload']=function(_0x49e1b8,_0x5a2013){var _0x55d764=fs['createReadStream'](_0x49e1b8[_0x0a9e('0xb2')][_0x0a9e('0xbd')]);Papa['parse'](_0x55d764,{'header':!![],'skipEmptyLines':!![],'preview':0x1,'complete':function(_0x5c23aa){return _0x5a2013[_0x0a9e('0xf')](0xc8)['json']({'file':_0x49e1b8[_0x0a9e('0xb2')],'fields':_0x5c23aa[_0x0a9e('0xbe')][_0x0a9e('0x7d')]});}});};exports[_0x0a9e('0xbf')]=function(_0x336518,_0x14a683){return db['User'][_0x0a9e('0x1d')]({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})['then'](function(_0x44cdb8){var _0x1c0d54=![];if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xc1')]['phone']){throw new Error(_0x0a9e('0xae'));}if(!_0x336518['body'][_0x0a9e('0xc1')][_0x0a9e('0xaf')]){throw new Error('No\x20firstName\x20column\x20specified');}if(!_0x336518[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x78a398=require('child_process')[_0x0a9e('0xb6')](path[_0x0a9e('0x36')](__dirname,'../../components/import/cm/csv2'),[_0x336518[_0x0a9e('0x23')]['id'],JSON['stringify'](_0x336518[_0x0a9e('0x32')]),JSON[_0x0a9e('0xc2')](_0x44cdb8)]);_0x78a398['on'](_0x0a9e('0xc3'),function(){_0x1c0d54=!![];return _0x14a683[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x78a398[_0x0a9e('0xbb')]});});_0x78a398['on']('exit',function(_0x36318d){if(_0x36318d&&!_0x1c0d54){return _0x14a683[_0x0a9e('0xf')](0x1f4)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc5'),'pid':_0x78a398[_0x0a9e('0xbb')]});}});})['catch'](handleError(_0x14a683,null));};exports[_0x0a9e('0xc6')]=function(_0x49a6b2,_0x5d1159){return db[_0x0a9e('0xc7')]['findAll']({'raw':!![],'attributes':['id'],'where':{'role':_0x0a9e('0xc0')}})[_0x0a9e('0x15')](function(_0x58d5fd){var _0x171a69=![];if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0x5f')]){throw new Error(_0x0a9e('0xa4'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xc1')][_0x0a9e('0x76')]){throw new Error(_0x0a9e('0xae'));}if(!_0x49a6b2[_0x0a9e('0x32')]['binding'][_0x0a9e('0xaf')]){throw new Error(_0x0a9e('0xb0'));}if(!_0x49a6b2[_0x0a9e('0x32')][_0x0a9e('0xa9')]){throw new Error('Unable\x20to\x20synchronize\x20socket,\x20no\x20timestamp\x20passed');}var _0x38d95a=require(_0x0a9e('0xb5'))[_0x0a9e('0xb6')](path['join'](__dirname,_0x0a9e('0xc8')),[_0x49a6b2[_0x0a9e('0x23')]['id'],JSON[_0x0a9e('0xc2')](_0x49a6b2['body']),JSON[_0x0a9e('0xc2')](_0x58d5fd)]);_0x38d95a['on']('message',function(){_0x171a69=!![];return _0x5d1159[_0x0a9e('0xf')](0xc8)[_0x0a9e('0xb9')]({'message':_0x0a9e('0xc4'),'pid':_0x38d95a[_0x0a9e('0xbb')]});});_0x38d95a['on'](_0x0a9e('0xc9'),function(_0x1b86e6){if(_0x1b86e6&&!_0x171a69){return _0x5d1159[_0x0a9e('0xf')](0x1f4)['json']({'message':_0x0a9e('0xc5'),'pid':_0x38d95a[_0x0a9e('0xbb')]});}});})[_0x0a9e('0x20')](handleError(_0x5d1159,null));};exports[_0x0a9e('0xca')]=function(_0x1eb768,_0x117694){var _0x3a4def=[_0x0a9e('0xcb'),_0x0a9e('0xcc'),_0x0a9e('0xcd'),_0x0a9e('0xce'),_0x0a9e('0xcf'),_0x0a9e('0xd0'),_0x0a9e('0xd1')];var _0xdce963={'offset':0x0,'order':qs[_0x0a9e('0x7f')](_0x0a9e('0xd2'))},_0xfc4f={'count':0x0,'rows':[]};Promise[_0x0a9e('0xd3')]()[_0x0a9e('0x15')](function(){if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd4')]){if(!_[_0x0a9e('0xd5')](_0x3a4def,_0x1eb768['query'][_0x0a9e('0xd4')][_0x0a9e('0xd6')]())){throw new Error(_0x0a9e('0xd7'));}_0x3a4def=[_0x1eb768['query'][_0x0a9e('0xd4')]['toLowerCase']()];}if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){try{var _0x20a292=JSON[_0x0a9e('0xd9')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]);if(!moment(_0x20a292[_0x0a9e('0x33')])[_0x0a9e('0xda')]()){throw new Error('Invalid\x20date\x20for\x20range\x20from\x20filter');}if(!moment(_0x20a292['to'])[_0x0a9e('0xda')]()){throw new Error(_0x0a9e('0xdb'));}}catch(_0x4d6f2d){throw new Error(_0x0a9e('0xdc'));}}if(!_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x31')]('nolimit')){_0xdce963[_0x0a9e('0x12')]=qs[_0x0a9e('0x12')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x12')]||0xa);_0xdce963['offset']=qs[_0x0a9e('0x10')](_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0x10')]);}var _0x2b8eed=_0x3a4def[_0x0a9e('0x6d')](function(_0x4ea917){if(_0x4ea917===_0x0a9e('0xd1')){var _0x3fc431={'attributes':['id','uniqueid',_0x0a9e('0x2e'),_0x0a9e('0xdd'),_0x0a9e('0xde'),'callerid','starttime',_0x0a9e('0xdf'),_0x0a9e('0xe0'),_0x0a9e('0xe1'),_0x0a9e('0xe2'),_0x0a9e('0xe3'),_0x0a9e('0xe4'),_0x0a9e('0xe5'),_0x0a9e('0xe6')],'where':{'ContactId':_0x1eb768['params']['id']},'include':[{'model':db['User'],'as':_0x0a9e('0xc7'),'attributes':['id','name',_0x0a9e('0xe7'),_0x0a9e('0xe8')]}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768['query'][_0x0a9e('0xd8')]){_0x3fc431[_0x0a9e('0x5c')]['createdAt']={'$gte':_0x20a292[_0x0a9e('0x33')],'$lte':_0x20a292['to']};}return db['VoiceCallReport'][_0x0a9e('0xea')](_0x3fc431)[_0x0a9e('0x15')](function(_0xd63c87){_0xfc4f[_0x0a9e('0x13')]+=_0xd63c87[_0x0a9e('0x13')];return _[_0x0a9e('0x6d')](_0xd63c87['rows'],function(_0x16d50b){var _0x580dd2=_0x16d50b[_0x0a9e('0x34')]({'plain':!![]});_0x580dd2[_0x0a9e('0xd4')]=_0x4ea917;if(_0x580dd2[_0x0a9e('0xc7')]){_0x580dd2[_0x0a9e('0xc7')]={'id':_0x580dd2[_0x0a9e('0xc7')]['id'],'name':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0x1a')],'fullname':_0x580dd2['User'][_0x0a9e('0xe7')],'alias':_0x580dd2[_0x0a9e('0xc7')][_0x0a9e('0xe8')]};}return _0x580dd2;});});}else{var _0x188231=_[_0x0a9e('0xeb')](_0x4ea917)+(_0x4ea917==='chat'?_0x0a9e('0xec'):_0x0a9e('0xed'));var _0x488d6c={'attributes':['id','closed',_0x0a9e('0xee'),_0x0a9e('0xe2'),_0x0a9e('0xe1'),_0x0a9e('0xef'),_0x0a9e('0xf0'),_0x0a9e('0xf1'),'UserId',_0x188231+'Id'],'where':{'ContactId':_0x1eb768[_0x0a9e('0x23')]['id']},'include':[{'model':db[_0x188231],'as':_0x0a9e('0xed'),'attributes':['id',_0x0a9e('0x1a'),'key']},{'model':db[_0x0a9e('0xc7')],'as':_0x0a9e('0xf2'),'attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0xe7')]},{'model':db['Tag'],'as':'Tags','attributes':['id',_0x0a9e('0x1a'),_0x0a9e('0x65')],'through':{'attributes':[]}}],'order':[[_0x0a9e('0xe2'),_0x0a9e('0xe9')]]};if(_0x1eb768[_0x0a9e('0x1e')][_0x0a9e('0xd8')]){_0x488d6c[_0x0a9e('0x5c')][_0x0a9e('0xe2')]={'$gte':_0x20a292['from'],'$lte':_0x20a292['to']};}switch(_0x4ea917){case _0x0a9e('0xcc'):_0x488d6c['attributes'][_0x0a9e('0x5e')](_0x0a9e('0xf3'),_0x0a9e('0xf4'),'customerPort','deviceModel',_0x0a9e('0xf5'),'ratingMessage',_0x0a9e('0xf6'),'ratingValue','referer');break;case _0x0a9e('0xcb'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf7'),_0x0a9e('0xf8'));break;case _0x0a9e('0xce'):_0x488d6c[_0x0a9e('0x7c')][_0x0a9e('0x5e')](_0x0a9e('0xf9'),_0x0a9e('0xfa'));break;}return db[_[_0x0a9e('0xeb')](_0x4ea917)+_0x0a9e('0xfb')][_0x0a9e('0xea')](_0x488d6c)['then'](function(_0x58f251){_0xfc4f[_0x0a9e('0x13')]+=_0x58f251['count'];return _[_0x0a9e('0x6d')](_0x58f251[_0x0a9e('0xa0')],function(_0x27be90){var _0x54befc=_0x27be90['get']({'plain':!![]});_0x54befc[_0x0a9e('0xd4')]=_0x4ea917;if(_0x54befc[_0x0a9e('0xf2')]){_0x54befc[_0x0a9e('0xf2')]={'id':_0x54befc[_0x0a9e('0xf2')]['id'],'name':_0x54befc[_0x0a9e('0xf2')][_0x0a9e('0x1a')],'fullname':_0x54befc[_0x0a9e('0xf2')]['fullname']};}return _0x54befc;});});}});return Promise[_0x0a9e('0x62')](_0x2b8eed);})['then'](function(_0x46b11b){return _(_0x46b11b)[_0x0a9e('0xfc')]()['sortBy'](_0x0a9e('0xe2'))[_0x0a9e('0xfd')]()[_0x0a9e('0xfe')]();})[_0x0a9e('0x15')](function(_0xb0fb60){_0xfc4f[_0x0a9e('0xa0')]=_0xdce963['limit']?_0xb0fb60[_0x0a9e('0xff')](_0xdce963[_0x0a9e('0x10')],_0xdce963[_0x0a9e('0x10')]+_0xdce963['limit']):_0xb0fb60;return _0xfc4f;})[_0x0a9e('0x15')](respondWithFilteredResult(_0x117694,_0xdce963))[_0x0a9e('0x20')](handleError(_0x117694,null));}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.events.js b/server/api/cmContact/cmContact.events.js index 38632e2..9e87991 100644 --- a/server/api/cmContact/cmContact.events.js +++ b/server/api/cmContact/cmContact.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b6c=['exports','events','CmContact','setMaxListeners','save','update','remove','emit','hook'];(function(_0x5f3042,_0x9b07ac){var _0x4eeb84=function(_0x4adbea){while(--_0x4adbea){_0x5f3042['push'](_0x5f3042['shift']());}};_0x4eeb84(++_0x9b07ac);}(_0x4b6c,0xe2));var _0xc4b6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b6c[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0xc4b6('0x0'));var CmContact=require('../../mysqldb')['db'][_0xc4b6('0x1')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xc4b6('0x2')](0x0);var events={'afterCreate':_0xc4b6('0x3'),'afterUpdate':_0xc4b6('0x4'),'afterDestroy':_0xc4b6('0x5')};function emitEvent(_0x376f5d){return function(_0x1cc0e1,_0xa4a081,_0x99c53a){CmContactEvents[_0xc4b6('0x6')](_0x376f5d+':'+_0x1cc0e1['id'],_0x1cc0e1);CmContactEvents[_0xc4b6('0x6')](_0x376f5d,_0x1cc0e1);_0x99c53a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact[_0xc4b6('0x7')](e,emitEvent(event));}}module[_0xc4b6('0x8')]=CmContactEvents; \ No newline at end of file +var _0x81ec=['CmContact','setMaxListeners','save','update','remove','emit','exports','events','../../mysqldb'];(function(_0x35c718,_0x33a696){var _0x5c3099=function(_0x2810cd){while(--_0x2810cd){_0x35c718['push'](_0x35c718['shift']());}};_0x5c3099(++_0x33a696);}(_0x81ec,0x1e4));var _0xc81e=function(_0x2aade0,_0x2e182b){_0x2aade0=_0x2aade0-0x0;var _0xc68ecf=_0x81ec[_0x2aade0];return _0xc68ecf;};'use strict';var EventEmitter=require(_0xc81e('0x0'));var CmContact=require(_0xc81e('0x1'))['db'][_0xc81e('0x2')];var CmContactEvents=new EventEmitter();CmContactEvents[_0xc81e('0x3')](0x0);var events={'afterCreate':_0xc81e('0x4'),'afterUpdate':_0xc81e('0x5'),'afterDestroy':_0xc81e('0x6')};function emitEvent(_0xf32170){return function(_0x2fdb51,_0x475575,_0x4a6777){CmContactEvents[_0xc81e('0x7')](_0xf32170+':'+_0x2fdb51['id'],_0x2fdb51);CmContactEvents[_0xc81e('0x7')](_0xf32170,_0x2fdb51);_0x4a6777(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];CmContact['hook'](e,emitEvent(event));}}module[_0xc81e('0x8')]=CmContactEvents; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.model.js b/server/api/cmContact/cmContact.model.js index 00791dc..34bba61 100644 --- a/server/api/cmContact/cmContact.model.js +++ b/server/api/cmContact/cmContact.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbda0=['\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','catch','error','cmContact','Campaign','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','CmHopperFinal','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20','VoiceQueue','findAll','outbound','dialCheckDuplicateType','CmList','Lists','get','always','onlyIfOpen','length','CmHopperBlack','cmContact,\x20%s,\x20%s','BlackLists','message','List\x20not\x20found','ContactId','VoiceQueueId','CampaignId','push','all','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','util','../../config/logger','api','moment','path','rimraf','../../config/environment','exports','define','cm_contacts','fti_cm_contacts','firstName','lastName','FULLTEXT','utf8mb4','utf8mb4_unicode_ci','models','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','findOne','then','dialTimezone','timezones','utcOffset','add','minutes','ret','phone','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopper','create','ListId','priority','callbackUniqueid','cmContact,\x20afterCreate,\x20'];(function(_0x21263c,_0x21d491){var _0x1b33f3=function(_0x116251){while(--_0x116251){_0x21263c['push'](_0x21263c['shift']());}};_0x1b33f3(++_0x21d491);}(_0xbda0,0x1c9));var _0x0bda=function(_0x88d23a,_0x985cf1){_0x88d23a=_0x88d23a-0x0;var _0xf511b1=_0xbda0[_0x88d23a];return _0xf511b1;};'use strict';var _=require('lodash');var util=require(_0x0bda('0x0'));var logger=require(_0x0bda('0x1'))(_0x0bda('0x2'));var moment=require(_0x0bda('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x0bda('0x4'));var rimraf=require(_0x0bda('0x5'));var config=require(_0x0bda('0x6'));var shared=require('../../config/environment/shared');var attributes=require('./cmContact.attributes');module[_0x0bda('0x7')]=function(_0x1fa71c,_0x57af74){return _0x1fa71c[_0x0bda('0x8')]('CmContact',attributes,{'tableName':_0x0bda('0x9'),'paranoid':!![],'indexes':[{'name':'phone','fields':['phone']},{'name':_0x0bda('0xa'),'fields':[_0x0bda('0xb'),_0x0bda('0xc'),'phone','mobile','fax','email'],'type':_0x0bda('0xd')}],'timestamps':!![],'charset':_0x0bda('0xe'),'collate':_0x0bda('0xf'),'hooks':{'afterCreate':function(_0x31818f,_0x5cfdb8,_0x217507){var _0x9ee87b=_0x1fa71c[_0x0bda('0x10')];var _0x53147a=_0x31818f['get']({'plain':!![]});function _0x2f54ef(){return function(_0x4479a4){logger['error']('cmContact',_0x0bda('0x11'),util[_0x0bda('0x12')](_0x4479a4,{'showHidden':![],'depth':null}));};}function _0x4ae55a(_0x8f015b,_0xf87e7c){var _0x41ecf2=_0xf87e7c[_0x0bda('0x13')]?_0xf87e7c[_0x0bda('0x13')]:moment()[_0x0bda('0x14')](_0x0bda('0x15'));return new BPromise(function(_0x35e93a,_0x4e8a1f){if(_[_0x0bda('0x16')](_0xf87e7c['dialTimezone'])){_0x35e93a({'ret':_0x41ecf2});}else{_0x9ee87b['VoiceQueue'][_0x0bda('0x17')]({'where':{'id':_0x8f015b['id']}})[_0x0bda('0x18')](function(_0x3c857d){if(!_[_0x0bda('0x16')](_0x3c857d)){var _0x2a2c5e=_0x3c857d[_0x0bda('0x19')];if(!_[_0x0bda('0x16')](_0x2a2c5e)){var _0x44795c=shared[_0x0bda('0x1a')];var _0x1679d0=_0x44795c[_0x2a2c5e];var _0x29ad7b=_0x44795c[_0xf87e7c['dialTimezone']];if(!_[_0x0bda('0x16')](_0x1679d0)&&!_[_0x0bda('0x16')](_0x29ad7b)){var _0x15c028=_0x1679d0[_0x0bda('0x1b')]-_0x29ad7b[_0x0bda('0x1b')];_0x41ecf2=_0xf87e7c[_0x0bda('0x13')]?_0xf87e7c['scheduledat']:moment();var _0x557a16=moment(_0x41ecf2)[_0x0bda('0x1c')](_0x15c028,_0x0bda('0x1d'));_0x35e93a({'ret':_0x557a16['format'](_0x0bda('0x15'))});}else _0x35e93a({'ret':_0x41ecf2});}else _0x35e93a({'ret':_0x41ecf2});}else{_0x35e93a({'ret':_0x41ecf2});}});}});return 0xa;}var _0x17357c=function(_0x365a34){return new BPromise(function(_0x200aab,_0x58604a){_0x4ae55a(_0x365a34,_0x53147a)['then'](function(_0xb6b6ac){_0x53147a[_0x0bda('0x13')]=_0xb6b6ac[_0x0bda('0x1e')];_0x9ee87b['CmHopper'][_0x0bda('0x17')]({'where':{'phone':_0x53147a[_0x0bda('0x1f')],'VoiceQueueId':_0x365a34['id']}})[_0x0bda('0x18')](function(_0x564438){if(!_[_0x0bda('0x16')](_0x564438)){throw new Error(_0x0bda('0x20')+_0x53147a[_0x0bda('0x1f')]+_0x0bda('0x21')+_0x365a34['id']);}return _0x9ee87b[_0x0bda('0x22')][_0x0bda('0x23')]({'phone':_0x53147a[_0x0bda('0x1f')],'ContactId':_0x53147a['id'],'ListId':_0x53147a[_0x0bda('0x24')],'priority':_0x53147a['priority']?_0x53147a[_0x0bda('0x25')]:0x2,'scheduledat':_0x53147a[_0x0bda('0x13')]?_0x53147a[_0x0bda('0x13')]:moment()[_0x0bda('0x14')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x53147a[_0x0bda('0x26')]?!![]:![],'callbackuniqueid':_0x53147a[_0x0bda('0x26')]?_0x53147a[_0x0bda('0x26')]:undefined,'callbackat':_0x53147a[_0x0bda('0x26')]?moment()[_0x0bda('0x14')](_0x0bda('0x15')):undefined,'VoiceQueueId':_0x365a34['id']});})['catch'](function(_0x1fe768){_0x58604a(_0x1fe768);});});});};var _0x159e5c=function(_0x27898b){return new BPromise(function(_0x3cd019,_0xc8046e){_0x4ae55a(_0x27898b,_0x53147a)[_0x0bda('0x18')](function(_0x8fc45a){_0x53147a[_0x0bda('0x13')]=_0x8fc45a[_0x0bda('0x1e')];_0x9ee87b[_0x0bda('0x22')]['findOne']({'where':{'phone':_0x53147a[_0x0bda('0x1f')],'VoiceQueueId':_0x27898b['id']}})['then'](function(_0x136022){if(!_['isNil'](_0x136022)){throw new Error(_0x0bda('0x20')+_0x53147a[_0x0bda('0x1f')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20'+_0x27898b['id']);}return _0x9ee87b['CmHopperFinal'][_0x0bda('0x17')]({'where':{'calleridnum':_0x53147a[_0x0bda('0x1f')],'VoiceQueueId':_0x27898b['id']}});})[_0x0bda('0x18')](function(_0x1bb452){if(!_[_0x0bda('0x16')](_0x1bb452)){throw new Error(_0x0bda('0x27')+_0x53147a[_0x0bda('0x1f')]+_0x0bda('0x28')+_0x27898b['id']);}return _0x9ee87b[_0x0bda('0x22')][_0x0bda('0x23')]({'phone':_0x53147a[_0x0bda('0x1f')],'ContactId':_0x53147a['id'],'ListId':_0x53147a['ListId'],'priority':_0x53147a[_0x0bda('0x25')]?_0x53147a[_0x0bda('0x25')]:0x2,'scheduledat':_0x53147a['scheduledat']?_0x53147a[_0x0bda('0x13')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x53147a[_0x0bda('0x26')]?!![]:![],'callbackuniqueid':_0x53147a[_0x0bda('0x26')]?_0x53147a[_0x0bda('0x26')]:undefined,'callbackat':_0x53147a[_0x0bda('0x26')]?moment()[_0x0bda('0x14')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x27898b['id']});})[_0x0bda('0x29')](function(_0x2489da){_0xc8046e(_0x2489da);});});});};function _0x85d6ef(){return function(_0x37b02c){logger[_0x0bda('0x2a')](_0x0bda('0x2b'),_0x0bda('0x11'),util['inspect'](_0x37b02c,{'showHidden':![],'depth':null}));};}function _0x13c986(_0xece4f,_0x1a02e8){var _0x385fb6=_0x1a02e8['scheduledat']?_0x1a02e8[_0x0bda('0x13')]:moment()[_0x0bda('0x14')](_0x0bda('0x15'));return new BPromise(function(_0x131dff,_0x11d0c5){if(_['isNil'](_0x1a02e8[_0x0bda('0x19')])){_0x131dff({'ret':_0x385fb6});}else{_0x9ee87b[_0x0bda('0x2c')][_0x0bda('0x17')]({'where':{'id':_0xece4f['id']}})[_0x0bda('0x18')](function(_0x3901ed){if(!_[_0x0bda('0x16')](_0x3901ed)){var _0x8574f9=_0x3901ed[_0x0bda('0x19')];if(!_[_0x0bda('0x16')](_0x8574f9)){var _0x1f2b21=shared[_0x0bda('0x1a')];var _0x55d28a=_0x1f2b21[_0x8574f9];var _0x2e1e9e=_0x1f2b21[_0x1a02e8['dialTimezone']];if(!_[_0x0bda('0x16')](_0x55d28a)&&!_[_0x0bda('0x16')](_0x2e1e9e)){var _0x575535=_0x55d28a[_0x0bda('0x1b')]-_0x2e1e9e[_0x0bda('0x1b')];_0x385fb6=_0x1a02e8[_0x0bda('0x13')]?_0x1a02e8[_0x0bda('0x13')]:moment();var _0x21a89c=moment(_0x385fb6)[_0x0bda('0x1c')](_0x575535,_0x0bda('0x1d'));_0x131dff({'ret':_0x21a89c[_0x0bda('0x14')](_0x0bda('0x15'))});}else _0x131dff({'ret':_0x385fb6});}else _0x131dff({'ret':_0x385fb6});}else{_0x131dff({'ret':_0x385fb6});}});}});return 0xa;}var _0x5e3f21=function(_0x56e391){return new BPromise(function(_0x2e41b0,_0x3a8206){_0x13c986(_0x56e391,_0x53147a)['then'](function(_0x21f99a){_0x53147a[_0x0bda('0x13')]=_0x21f99a[_0x0bda('0x1e')];_0x9ee87b[_0x0bda('0x22')][_0x0bda('0x17')]({'where':{'phone':_0x53147a[_0x0bda('0x1f')],'CampaignId':_0x56e391['id']}})[_0x0bda('0x18')](function(_0x5c8b1a){if(!_[_0x0bda('0x16')](_0x5c8b1a)){throw new Error(_0x0bda('0x20')+_0x53147a['phone']+_0x0bda('0x2d')+_0x56e391['id']);}return _0x9ee87b[_0x0bda('0x22')]['create']({'phone':_0x53147a[_0x0bda('0x1f')],'ContactId':_0x53147a['id'],'ListId':_0x53147a[_0x0bda('0x24')],'priority':_0x53147a[_0x0bda('0x25')]?_0x53147a['priority']:0x2,'scheduledat':_0x53147a[_0x0bda('0x13')]?_0x53147a[_0x0bda('0x13')]:moment()[_0x0bda('0x14')](_0x0bda('0x15')),'callback':_0x53147a['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x53147a[_0x0bda('0x26')]?_0x53147a[_0x0bda('0x26')]:undefined,'callbackat':_0x53147a['callbackUniqueid']?moment()[_0x0bda('0x14')](_0x0bda('0x15')):undefined,'CampaignId':_0x56e391['id']});})[_0x0bda('0x29')](function(_0x4f58a8){_0x3a8206(_0x4f58a8);});});});};var _0x83e0c3=function(_0x59f4bc){return new BPromise(function(_0x360f43,_0x1e4e93){_0x13c986(_0x59f4bc,_0x53147a)[_0x0bda('0x18')](function(_0x5c8532){_0x53147a['scheduledat']=_0x5c8532[_0x0bda('0x1e')];_0x9ee87b[_0x0bda('0x22')][_0x0bda('0x17')]({'where':{'phone':_0x53147a[_0x0bda('0x1f')],'CampaignId':_0x59f4bc['id']}})[_0x0bda('0x18')](function(_0xfe7ae5){if(!_[_0x0bda('0x16')](_0xfe7ae5)){throw new Error(_0x0bda('0x20')+_0x53147a[_0x0bda('0x1f')]+_0x0bda('0x2e')+_0x59f4bc['id']);}return _0x9ee87b[_0x0bda('0x2f')][_0x0bda('0x17')]({'where':{'calleridnum':_0x53147a[_0x0bda('0x1f')],'CampaignId':_0x59f4bc['id']}});})[_0x0bda('0x18')](function(_0xa2f98f){if(!_[_0x0bda('0x16')](_0xa2f98f)){throw new Error(_0x0bda('0x27')+_0x53147a[_0x0bda('0x1f')]+_0x0bda('0x30')+_0x59f4bc['id']);}return _0x9ee87b[_0x0bda('0x22')]['create']({'phone':_0x53147a[_0x0bda('0x1f')],'ContactId':_0x53147a['id'],'ListId':_0x53147a[_0x0bda('0x24')],'priority':_0x53147a['priority']?_0x53147a['priority']:0x2,'scheduledat':_0x53147a[_0x0bda('0x13')]?_0x53147a['scheduledat']:moment()[_0x0bda('0x14')](_0x0bda('0x15')),'callback':_0x53147a[_0x0bda('0x26')]?!![]:![],'callbackuniqueid':_0x53147a[_0x0bda('0x26')]?_0x53147a[_0x0bda('0x26')]:undefined,'callbackat':_0x53147a[_0x0bda('0x26')]?moment()[_0x0bda('0x14')](_0x0bda('0x15')):undefined,'CampaignId':_0x59f4bc['id']});})[_0x0bda('0x29')](function(_0x512b2d){_0x1e4e93(_0x512b2d);});});});};if(_0x53147a['ListId']){_0x9ee87b[_0x0bda('0x31')][_0x0bda('0x32')]({'where':{'type':_0x0bda('0x33')},'attributes':['id',_0x0bda('0x34'),_0x0bda('0x19')],'include':[{'model':_0x9ee87b[_0x0bda('0x35')],'as':_0x0bda('0x36'),'where':{'id':_0x53147a[_0x0bda('0x24')]}}]})['then'](function(_0x5a9e4f){if(_0x5a9e4f){var _0x55f3df=[];for(var _0x34420a=0x0,_0x5923f4;_0x34420a<_0x5a9e4f['length'];_0x34420a+=0x1){_0x5923f4=_0x5a9e4f[_0x34420a][_0x0bda('0x37')]({'plain':!![]});switch(_0x5923f4['dialCheckDuplicateType']){case _0x0bda('0x38'):_0x159e5c(_0x5923f4)['catch'](_0x2f54ef());break;case _0x0bda('0x39'):_0x17357c(_0x5923f4)['catch'](_0x2f54ef());break;default:_0x13c986(_0x5923f4,_0x53147a)[_0x0bda('0x18')](function(_0x57241b){_0x53147a[_0x0bda('0x13')]=_0x57241b['ret'];_0x9ee87b[_0x0bda('0x22')]['create']({'phone':_0x53147a[_0x0bda('0x1f')],'ContactId':_0x53147a['id'],'ListId':_0x53147a[_0x0bda('0x24')],'scheduledat':_0x53147a[_0x0bda('0x13')]?_0x53147a[_0x0bda('0x13')]:moment()[_0x0bda('0x14')](_0x0bda('0x15')),'priority':_0x53147a[_0x0bda('0x25')]?_0x53147a[_0x0bda('0x25')]:0x2,'callback':_0x53147a['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x53147a[_0x0bda('0x26')]?_0x53147a[_0x0bda('0x26')]:undefined,'callbackat':_0x53147a[_0x0bda('0x26')]?moment()[_0x0bda('0x14')](_0x0bda('0x15')):undefined,'VoiceQueueId':_0x5923f4['id']})[_0x0bda('0x29')](_0x2f54ef());});}}}})[_0x0bda('0x18')](function(){return _0x9ee87b['VoiceQueue']['findAll']({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x9ee87b['CmList'],'as':'BlackLists','where':{'id':_0x53147a[_0x0bda('0x24')]}}]})[_0x0bda('0x18')](function(_0x392eaa){if(_0x392eaa){var _0x1d50ea=[];for(var _0x49070b=0x0,_0x116035;_0x49070b<_0x392eaa[_0x0bda('0x3a')];_0x49070b+=0x1){_0x116035=_0x392eaa[_0x49070b][_0x0bda('0x37')]({'plain':!![]});_0x9ee87b[_0x0bda('0x3b')][_0x0bda('0x23')]({'phone':_0x53147a[_0x0bda('0x1f')],'ContactId':_0x53147a['id'],'ListId':_0x53147a[_0x0bda('0x24')],'VoiceQueueId':_0x116035['id']})[_0x0bda('0x29')](function(_0x3724a1){logger[_0x0bda('0x2a')](_0x0bda('0x3c'),_0x0bda('0x11'),_0x3724a1['message']);});}}});})[_0x0bda('0x18')](function(){return _0x9ee87b['Campaign'][_0x0bda('0x32')]({'attributes':['id',_0x0bda('0x34'),_0x0bda('0x19')],'include':[{'model':_0x9ee87b[_0x0bda('0x35')],'as':_0x0bda('0x36'),'where':{'id':_0x53147a[_0x0bda('0x24')]}}]})[_0x0bda('0x18')](function(_0x1fae53){if(_0x1fae53){var _0x2d56aa=[];for(var _0x5a7c3d=0x0,_0x4d47d0;_0x5a7c3d<_0x1fae53[_0x0bda('0x3a')];_0x5a7c3d+=0x1){_0x4d47d0=_0x1fae53[_0x5a7c3d][_0x0bda('0x37')]({'plain':!![]});switch(_0x4d47d0['dialCheckDuplicateType']){case _0x0bda('0x38'):_0x83e0c3(_0x4d47d0)[_0x0bda('0x29')](_0x85d6ef());break;case _0x0bda('0x39'):_0x5e3f21(_0x4d47d0)[_0x0bda('0x29')](_0x85d6ef());break;default:_0x9ee87b[_0x0bda('0x22')][_0x0bda('0x23')]({'phone':_0x53147a[_0x0bda('0x1f')],'ContactId':_0x53147a['id'],'ListId':_0x53147a[_0x0bda('0x24')],'scheduledat':_0x53147a[_0x0bda('0x13')]?_0x53147a['scheduledat']:moment()[_0x0bda('0x14')](_0x0bda('0x15')),'priority':_0x53147a[_0x0bda('0x25')]?_0x53147a[_0x0bda('0x25')]:0x2,'callback':_0x53147a[_0x0bda('0x26')]?!![]:![],'callbackuniqueid':_0x53147a['callbackUniqueid']?_0x53147a[_0x0bda('0x26')]:undefined,'callbackat':_0x53147a[_0x0bda('0x26')]?moment()[_0x0bda('0x14')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x4d47d0['id']})[_0x0bda('0x29')](_0x85d6ef());}}}});})[_0x0bda('0x18')](function(){return _0x9ee87b[_0x0bda('0x2c')][_0x0bda('0x32')]({'attributes':['id'],'include':[{'model':_0x9ee87b[_0x0bda('0x35')],'as':_0x0bda('0x3d'),'where':{'id':_0x53147a['ListId']}}]})['then'](function(_0x5d667a){if(_0x5d667a){var _0x435138=[];for(var _0x3918d8=0x0,_0x2f7889;_0x3918d8<_0x5d667a[_0x0bda('0x3a')];_0x3918d8+=0x1){_0x2f7889=_0x5d667a[_0x3918d8]['get']({'plain':!![]});_0x9ee87b[_0x0bda('0x3b')][_0x0bda('0x23')]({'phone':_0x53147a[_0x0bda('0x1f')],'ContactId':_0x53147a['id'],'ListId':_0x53147a[_0x0bda('0x24')],'CampaignId':_0x2f7889['id']})[_0x0bda('0x29')](function(_0x43b716){logger[_0x0bda('0x2a')](_0x0bda('0x3c'),_0x0bda('0x11'),_0x43b716[_0x0bda('0x3e')]);});}}});})[_0x0bda('0x18')](function(){_0x217507();})[_0x0bda('0x29')](function(_0x10652b){logger['error'](_0x0bda('0x3c'),_0x0bda('0x11'),_0x10652b[_0x0bda('0x3e')]);_0x217507(_0x10652b);});}else{_0x217507(new Error(_0x0bda('0x3f')));}},'afterDestroy':function(_0x2b3400,_0x279bc6,_0x2929a2){var _0x542b27=_0x1fa71c[_0x0bda('0x10')];var _0xb21535=_0x2b3400['get']({'plain':!![]});return _0x542b27[_0x0bda('0x22')][_0x0bda('0x32')]({'raw':!![],'where':{'ListId':_0xb21535[_0x0bda('0x24')],'ContactId':_0xb21535['id']}})['then'](function(_0x5a2790){if(!_['isEmpty'](_0x5a2790)){var _0x401ec8=[];for(var _0x2bb1cb=0x0;_0x2bb1cb<_0x5a2790['length'];_0x2bb1cb+=0x1){var _0x545310=_0x542b27[_0x0bda('0x22')]['destroy']({'where':{'ListId':_0x5a2790[_0x2bb1cb]['ListId'],'ContactId':_0x5a2790[_0x2bb1cb][_0x0bda('0x40')],'VoiceQueueId':_0x5a2790[_0x2bb1cb][_0x0bda('0x41')],'CampaignId':_0x5a2790[_0x2bb1cb][_0x0bda('0x42')]}});_0x401ec8[_0x0bda('0x43')](_0x545310);}return BPromise[_0x0bda('0x44')](_0x401ec8);}})[_0x0bda('0x18')](function(_0x42b612){logger['info'](_0x0bda('0x45'),util[_0x0bda('0x12')](_0x42b612,{'showHidden':![],'depth':null}));_0x2929a2();})[_0x0bda('0x29')](function(_0x1a26bb){logger[_0x0bda('0x2a')](_0x0bda('0x46'),util['inspect'](_0x1a26bb,{'showHidden':![],'depth':null}));_0x2929a2(_0x1a26bb);});}}});}; \ No newline at end of file +var _0x3594=['onlyIfOpen','VoiceQueue','findAll','CmList','CmHopperBlack','cmContact,\x20%s,\x20%s','message','always','BlackLists','List\x20not\x20found','models','isEmpty','ContactId','VoiceQueueId','CampaignId','all','info','[CmContact][afterDestroy][Succesfull]','[CmContact][afterDestroy][Error]','lodash','util','../../config/logger','bluebird','request-promise','../../config/environment','../../config/environment/shared','./cmContact.attributes','cm_contacts','phone','fti_cm_contacts','lastName','mobile','fax','email','FULLTEXT','utf8mb4_unicode_ci','get','cmContact','afterCreate','inspect','scheduledat','format','YYYY-MM-DD\x20HH:mm:ss','isNil','dialTimezone','findOne','timezones','utcOffset','add','minutes','ret','CmHopper','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','create','ListId','priority','callbackUniqueid','then','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20VoiceQueue\x20','CmHopperFinal','cmContact,\x20afterCreate,\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20VoiceQueue\x20','catch','error','Campaign','cmContact,\x20afterCreate\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20onlyIfOpen,\x20exist\x20in\x20hopper\x20Campaign\x20','\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopper\x20Campaign\x20','outbound','Lists','length','dialCheckDuplicateType'];(function(_0x872f6f,_0x5efe7b){var _0x59a5f4=function(_0x147463){while(--_0x147463){_0x872f6f['push'](_0x872f6f['shift']());}};_0x59a5f4(++_0x5efe7b);}(_0x3594,0x133));var _0x4359=function(_0x1dd826,_0x1a6b8f){_0x1dd826=_0x1dd826-0x0;var _0x17314f=_0x3594[_0x1dd826];return _0x17314f;};'use strict';var _=require(_0x4359('0x0'));var util=require(_0x4359('0x1'));var logger=require(_0x4359('0x2'))('api');var moment=require('moment');var BPromise=require(_0x4359('0x3'));var rp=require(_0x4359('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x4359('0x5'));var shared=require(_0x4359('0x6'));var attributes=require(_0x4359('0x7'));module['exports']=function(_0x5b404c,_0xcf7ec7){return _0x5b404c['define']('CmContact',attributes,{'tableName':_0x4359('0x8'),'paranoid':!![],'indexes':[{'name':_0x4359('0x9'),'fields':[_0x4359('0x9')]},{'name':_0x4359('0xa'),'fields':['firstName',_0x4359('0xb'),_0x4359('0x9'),_0x4359('0xc'),_0x4359('0xd'),_0x4359('0xe')],'type':_0x4359('0xf')}],'timestamps':!![],'charset':'utf8mb4','collate':_0x4359('0x10'),'hooks':{'afterCreate':function(_0x33f7df,_0x4bbf10,_0xfbc5b2){var _0x381b7e=_0x5b404c['models'];var _0x343edc=_0x33f7df[_0x4359('0x11')]({'plain':!![]});function _0x201a3d(){return function(_0x2e3e92){logger['error'](_0x4359('0x12'),_0x4359('0x13'),util[_0x4359('0x14')](_0x2e3e92,{'showHidden':![],'depth':null}));};}function _0xfad751(_0x3c8c10,_0x1307cf){var _0x4f3352=_0x1307cf[_0x4359('0x15')]?_0x1307cf[_0x4359('0x15')]:moment()[_0x4359('0x16')](_0x4359('0x17'));return new BPromise(function(_0x1bb958,_0x55d447){if(_[_0x4359('0x18')](_0x1307cf[_0x4359('0x19')])){_0x1bb958({'ret':_0x4f3352});}else{_0x381b7e['VoiceQueue'][_0x4359('0x1a')]({'where':{'id':_0x3c8c10['id']}})['then'](function(_0x5348bb){if(!_[_0x4359('0x18')](_0x5348bb)){var _0x1c27ea=_0x5348bb[_0x4359('0x19')];if(!_[_0x4359('0x18')](_0x1c27ea)){var _0x3ae795=shared[_0x4359('0x1b')];var _0x159631=_0x3ae795[_0x1c27ea];var _0x42b873=_0x3ae795[_0x1307cf['dialTimezone']];if(!_['isNil'](_0x159631)&&!_[_0x4359('0x18')](_0x42b873)){var _0x1f52e1=_0x159631['utcOffset']-_0x42b873[_0x4359('0x1c')];_0x4f3352=_0x1307cf['scheduledat']?_0x1307cf['scheduledat']:moment();var _0x49f568=moment(_0x4f3352)[_0x4359('0x1d')](_0x1f52e1,_0x4359('0x1e'));_0x1bb958({'ret':_0x49f568[_0x4359('0x16')](_0x4359('0x17'))});}else _0x1bb958({'ret':_0x4f3352});}else _0x1bb958({'ret':_0x4f3352});}else{_0x1bb958({'ret':_0x4f3352});}});}});return 0xa;}var _0x4be34d=function(_0x6c99c8){return new BPromise(function(_0x3bce06,_0x5b00f5){_0xfad751(_0x6c99c8,_0x343edc)['then'](function(_0x363a82){_0x343edc[_0x4359('0x15')]=_0x363a82[_0x4359('0x1f')];_0x381b7e[_0x4359('0x20')][_0x4359('0x1a')]({'where':{'phone':_0x343edc[_0x4359('0x9')],'VoiceQueueId':_0x6c99c8['id']}})['then'](function(_0xdc63c4){if(!_[_0x4359('0x18')](_0xdc63c4)){throw new Error('cmContact,\x20afterCreate\x20'+_0x343edc[_0x4359('0x9')]+_0x4359('0x21')+_0x6c99c8['id']);}return _0x381b7e[_0x4359('0x20')][_0x4359('0x22')]({'phone':_0x343edc['phone'],'ContactId':_0x343edc['id'],'ListId':_0x343edc[_0x4359('0x23')],'priority':_0x343edc[_0x4359('0x24')]?_0x343edc['priority']:0x2,'scheduledat':_0x343edc[_0x4359('0x15')]?_0x343edc[_0x4359('0x15')]:moment()[_0x4359('0x16')](_0x4359('0x17')),'callback':_0x343edc[_0x4359('0x25')]?!![]:![],'callbackuniqueid':_0x343edc[_0x4359('0x25')]?_0x343edc[_0x4359('0x25')]:undefined,'callbackat':_0x343edc['callbackUniqueid']?moment()[_0x4359('0x16')](_0x4359('0x17')):undefined,'VoiceQueueId':_0x6c99c8['id']});})['catch'](function(_0x3c00c0){_0x5b00f5(_0x3c00c0);});});});};var _0x5eea57=function(_0x112a8d){return new BPromise(function(_0x258181,_0x3313b6){_0xfad751(_0x112a8d,_0x343edc)[_0x4359('0x26')](function(_0x48a011){_0x343edc['scheduledat']=_0x48a011[_0x4359('0x1f')];_0x381b7e[_0x4359('0x20')][_0x4359('0x1a')]({'where':{'phone':_0x343edc[_0x4359('0x9')],'VoiceQueueId':_0x112a8d['id']}})[_0x4359('0x26')](function(_0x2f0cee){if(!_[_0x4359('0x18')](_0x2f0cee)){throw new Error('cmContact,\x20afterCreate\x20'+_0x343edc['phone']+_0x4359('0x27')+_0x112a8d['id']);}return _0x381b7e[_0x4359('0x28')][_0x4359('0x1a')]({'where':{'calleridnum':_0x343edc[_0x4359('0x9')],'VoiceQueueId':_0x112a8d['id']}});})[_0x4359('0x26')](function(_0xcd88b3){if(!_[_0x4359('0x18')](_0xcd88b3)){throw new Error(_0x4359('0x29')+_0x343edc[_0x4359('0x9')]+_0x4359('0x2a')+_0x112a8d['id']);}return _0x381b7e[_0x4359('0x20')][_0x4359('0x22')]({'phone':_0x343edc[_0x4359('0x9')],'ContactId':_0x343edc['id'],'ListId':_0x343edc[_0x4359('0x23')],'priority':_0x343edc[_0x4359('0x24')]?_0x343edc[_0x4359('0x24')]:0x2,'scheduledat':_0x343edc['scheduledat']?_0x343edc[_0x4359('0x15')]:moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x343edc['callbackUniqueid']?!![]:![],'callbackuniqueid':_0x343edc[_0x4359('0x25')]?_0x343edc['callbackUniqueid']:undefined,'callbackat':_0x343edc['callbackUniqueid']?moment()[_0x4359('0x16')](_0x4359('0x17')):undefined,'VoiceQueueId':_0x112a8d['id']});})[_0x4359('0x2b')](function(_0x1c6607){_0x3313b6(_0x1c6607);});});});};function _0x1a6bed(){return function(_0x2ce6be){logger[_0x4359('0x2c')](_0x4359('0x12'),'afterCreate',util['inspect'](_0x2ce6be,{'showHidden':![],'depth':null}));};}function _0x2f93b9(_0x236f11,_0x1345df){var _0x2f81cf=_0x1345df[_0x4359('0x15')]?_0x1345df[_0x4359('0x15')]:moment()['format'](_0x4359('0x17'));return new BPromise(function(_0x79075,_0x27b296){if(_['isNil'](_0x1345df[_0x4359('0x19')])){_0x79075({'ret':_0x2f81cf});}else{_0x381b7e[_0x4359('0x2d')][_0x4359('0x1a')]({'where':{'id':_0x236f11['id']}})[_0x4359('0x26')](function(_0x21e8b3){if(!_[_0x4359('0x18')](_0x21e8b3)){var _0x175a46=_0x21e8b3[_0x4359('0x19')];if(!_[_0x4359('0x18')](_0x175a46)){var _0x53c740=shared[_0x4359('0x1b')];var _0x1f91f3=_0x53c740[_0x175a46];var _0x2a6368=_0x53c740[_0x1345df[_0x4359('0x19')]];if(!_['isNil'](_0x1f91f3)&&!_[_0x4359('0x18')](_0x2a6368)){var _0x20bfed=_0x1f91f3[_0x4359('0x1c')]-_0x2a6368[_0x4359('0x1c')];_0x2f81cf=_0x1345df[_0x4359('0x15')]?_0x1345df['scheduledat']:moment();var _0x45057e=moment(_0x2f81cf)[_0x4359('0x1d')](_0x20bfed,_0x4359('0x1e'));_0x79075({'ret':_0x45057e[_0x4359('0x16')]('YYYY-MM-DD\x20HH:mm:ss')});}else _0x79075({'ret':_0x2f81cf});}else _0x79075({'ret':_0x2f81cf});}else{_0x79075({'ret':_0x2f81cf});}});}});return 0xa;}var _0x520443=function(_0x235e95){return new BPromise(function(_0x554145,_0x341d52){_0x2f93b9(_0x235e95,_0x343edc)['then'](function(_0xa1d7d3){_0x343edc[_0x4359('0x15')]=_0xa1d7d3[_0x4359('0x1f')];_0x381b7e[_0x4359('0x20')]['findOne']({'where':{'phone':_0x343edc['phone'],'CampaignId':_0x235e95['id']}})[_0x4359('0x26')](function(_0x112ce3){if(!_[_0x4359('0x18')](_0x112ce3)){throw new Error(_0x4359('0x2e')+_0x343edc[_0x4359('0x9')]+_0x4359('0x2f')+_0x235e95['id']);}return _0x381b7e[_0x4359('0x20')][_0x4359('0x22')]({'phone':_0x343edc[_0x4359('0x9')],'ContactId':_0x343edc['id'],'ListId':_0x343edc[_0x4359('0x23')],'priority':_0x343edc['priority']?_0x343edc[_0x4359('0x24')]:0x2,'scheduledat':_0x343edc[_0x4359('0x15')]?_0x343edc[_0x4359('0x15')]:moment()[_0x4359('0x16')](_0x4359('0x17')),'callback':_0x343edc[_0x4359('0x25')]?!![]:![],'callbackuniqueid':_0x343edc['callbackUniqueid']?_0x343edc[_0x4359('0x25')]:undefined,'callbackat':_0x343edc[_0x4359('0x25')]?moment()[_0x4359('0x16')](_0x4359('0x17')):undefined,'CampaignId':_0x235e95['id']});})[_0x4359('0x2b')](function(_0x5f4cf4){_0x341d52(_0x5f4cf4);});});});};var _0x7f8a05=function(_0x3f6fa1){return new BPromise(function(_0x1adaa0,_0xae9786){_0x2f93b9(_0x3f6fa1,_0x343edc)[_0x4359('0x26')](function(_0x55cb33){_0x343edc[_0x4359('0x15')]=_0x55cb33[_0x4359('0x1f')];_0x381b7e['CmHopper'][_0x4359('0x1a')]({'where':{'phone':_0x343edc[_0x4359('0x9')],'CampaignId':_0x3f6fa1['id']}})['then'](function(_0x5038b8){if(!_[_0x4359('0x18')](_0x5038b8)){throw new Error(_0x4359('0x2e')+_0x343edc[_0x4359('0x9')]+_0x4359('0x30')+_0x3f6fa1['id']);}return _0x381b7e[_0x4359('0x28')]['findOne']({'where':{'calleridnum':_0x343edc['phone'],'CampaignId':_0x3f6fa1['id']}});})[_0x4359('0x26')](function(_0x51c537){if(!_[_0x4359('0x18')](_0x51c537)){throw new Error(_0x4359('0x29')+_0x343edc[_0x4359('0x9')]+'\x20contact\x20not\x20insert\x20in\x20hopper,\x20check\x20duplicate\x20always,\x20exist\x20in\x20hopperFinal\x20Campaign\x20'+_0x3f6fa1['id']);}return _0x381b7e[_0x4359('0x20')][_0x4359('0x22')]({'phone':_0x343edc[_0x4359('0x9')],'ContactId':_0x343edc['id'],'ListId':_0x343edc[_0x4359('0x23')],'priority':_0x343edc[_0x4359('0x24')]?_0x343edc[_0x4359('0x24')]:0x2,'scheduledat':_0x343edc[_0x4359('0x15')]?_0x343edc[_0x4359('0x15')]:moment()[_0x4359('0x16')]('YYYY-MM-DD\x20HH:mm:ss'),'callback':_0x343edc[_0x4359('0x25')]?!![]:![],'callbackuniqueid':_0x343edc[_0x4359('0x25')]?_0x343edc[_0x4359('0x25')]:undefined,'callbackat':_0x343edc[_0x4359('0x25')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0x3f6fa1['id']});})[_0x4359('0x2b')](function(_0x5eec7d){_0xae9786(_0x5eec7d);});});});};if(_0x343edc[_0x4359('0x23')]){_0x381b7e['VoiceQueue']['findAll']({'where':{'type':_0x4359('0x31')},'attributes':['id','dialCheckDuplicateType',_0x4359('0x19')],'include':[{'model':_0x381b7e['CmList'],'as':_0x4359('0x32'),'where':{'id':_0x343edc[_0x4359('0x23')]}}]})[_0x4359('0x26')](function(_0x5f3437){if(_0x5f3437){var _0x23c545=[];for(var _0x43d7bd=0x0,_0x12ee7;_0x43d7bd<_0x5f3437[_0x4359('0x33')];_0x43d7bd+=0x1){_0x12ee7=_0x5f3437[_0x43d7bd][_0x4359('0x11')]({'plain':!![]});switch(_0x12ee7[_0x4359('0x34')]){case'always':_0x5eea57(_0x12ee7)['catch'](_0x201a3d());break;case _0x4359('0x35'):_0x4be34d(_0x12ee7)['catch'](_0x201a3d());break;default:_0x2f93b9(_0x12ee7,_0x343edc)['then'](function(_0x4e0d7e){_0x343edc[_0x4359('0x15')]=_0x4e0d7e['ret'];_0x381b7e['CmHopper'][_0x4359('0x22')]({'phone':_0x343edc['phone'],'ContactId':_0x343edc['id'],'ListId':_0x343edc[_0x4359('0x23')],'scheduledat':_0x343edc[_0x4359('0x15')]?_0x343edc[_0x4359('0x15')]:moment()['format'](_0x4359('0x17')),'priority':_0x343edc[_0x4359('0x24')]?_0x343edc[_0x4359('0x24')]:0x2,'callback':_0x343edc[_0x4359('0x25')]?!![]:![],'callbackuniqueid':_0x343edc['callbackUniqueid']?_0x343edc[_0x4359('0x25')]:undefined,'callbackat':_0x343edc[_0x4359('0x25')]?moment()['format']('YYYY-MM-DD\x20HH:mm:ss'):undefined,'VoiceQueueId':_0x12ee7['id']})[_0x4359('0x2b')](_0x201a3d());});}}}})['then'](function(){return _0x381b7e[_0x4359('0x36')][_0x4359('0x37')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':_0x381b7e[_0x4359('0x38')],'as':'BlackLists','where':{'id':_0x343edc[_0x4359('0x23')]}}]})['then'](function(_0x17bb45){if(_0x17bb45){var _0x308378=[];for(var _0x397944=0x0,_0x496914;_0x397944<_0x17bb45[_0x4359('0x33')];_0x397944+=0x1){_0x496914=_0x17bb45[_0x397944]['get']({'plain':!![]});_0x381b7e[_0x4359('0x39')][_0x4359('0x22')]({'phone':_0x343edc[_0x4359('0x9')],'ContactId':_0x343edc['id'],'ListId':_0x343edc[_0x4359('0x23')],'VoiceQueueId':_0x496914['id']})[_0x4359('0x2b')](function(_0x17ce47){logger[_0x4359('0x2c')](_0x4359('0x3a'),_0x4359('0x13'),_0x17ce47[_0x4359('0x3b')]);});}}});})[_0x4359('0x26')](function(){return _0x381b7e['Campaign'][_0x4359('0x37')]({'attributes':['id',_0x4359('0x34'),_0x4359('0x19')],'include':[{'model':_0x381b7e['CmList'],'as':_0x4359('0x32'),'where':{'id':_0x343edc[_0x4359('0x23')]}}]})[_0x4359('0x26')](function(_0xbc2ef4){if(_0xbc2ef4){var _0x3fe6c8=[];for(var _0x4866c5=0x0,_0xab7054;_0x4866c5<_0xbc2ef4['length'];_0x4866c5+=0x1){_0xab7054=_0xbc2ef4[_0x4866c5]['get']({'plain':!![]});switch(_0xab7054[_0x4359('0x34')]){case _0x4359('0x3c'):_0x7f8a05(_0xab7054)['catch'](_0x1a6bed());break;case _0x4359('0x35'):_0x520443(_0xab7054)[_0x4359('0x2b')](_0x1a6bed());break;default:_0x381b7e[_0x4359('0x20')]['create']({'phone':_0x343edc[_0x4359('0x9')],'ContactId':_0x343edc['id'],'ListId':_0x343edc[_0x4359('0x23')],'scheduledat':_0x343edc['scheduledat']?_0x343edc[_0x4359('0x15')]:moment()[_0x4359('0x16')](_0x4359('0x17')),'priority':_0x343edc[_0x4359('0x24')]?_0x343edc['priority']:0x2,'callback':_0x343edc[_0x4359('0x25')]?!![]:![],'callbackuniqueid':_0x343edc['callbackUniqueid']?_0x343edc[_0x4359('0x25')]:undefined,'callbackat':_0x343edc[_0x4359('0x25')]?moment()[_0x4359('0x16')]('YYYY-MM-DD\x20HH:mm:ss'):undefined,'CampaignId':_0xab7054['id']})[_0x4359('0x2b')](_0x1a6bed());}}}});})[_0x4359('0x26')](function(){return _0x381b7e[_0x4359('0x2d')][_0x4359('0x37')]({'attributes':['id'],'include':[{'model':_0x381b7e[_0x4359('0x38')],'as':_0x4359('0x3d'),'where':{'id':_0x343edc['ListId']}}]})[_0x4359('0x26')](function(_0x338885){if(_0x338885){var _0x3b423f=[];for(var _0x7e4fc0=0x0,_0x4ee50c;_0x7e4fc0<_0x338885[_0x4359('0x33')];_0x7e4fc0+=0x1){_0x4ee50c=_0x338885[_0x7e4fc0][_0x4359('0x11')]({'plain':!![]});_0x381b7e['CmHopperBlack'][_0x4359('0x22')]({'phone':_0x343edc[_0x4359('0x9')],'ContactId':_0x343edc['id'],'ListId':_0x343edc[_0x4359('0x23')],'CampaignId':_0x4ee50c['id']})[_0x4359('0x2b')](function(_0x208de7){logger[_0x4359('0x2c')]('cmContact,\x20%s,\x20%s',_0x4359('0x13'),_0x208de7[_0x4359('0x3b')]);});}}});})[_0x4359('0x26')](function(){_0xfbc5b2();})[_0x4359('0x2b')](function(_0x3b40ac){logger[_0x4359('0x2c')]('cmContact,\x20%s,\x20%s',_0x4359('0x13'),_0x3b40ac[_0x4359('0x3b')]);_0xfbc5b2(_0x3b40ac);});}else{_0xfbc5b2(new Error(_0x4359('0x3e')));}},'afterDestroy':function(_0x3bc1e3,_0x3e3cde,_0x309b43){var _0x109dae=_0x5b404c[_0x4359('0x3f')];var _0x640275=_0x3bc1e3[_0x4359('0x11')]({'plain':!![]});return _0x109dae[_0x4359('0x20')][_0x4359('0x37')]({'raw':!![],'where':{'ListId':_0x640275[_0x4359('0x23')],'ContactId':_0x640275['id']}})['then'](function(_0x163a08){if(!_[_0x4359('0x40')](_0x163a08)){var _0x1ea54b=[];for(var _0x13a9c0=0x0;_0x13a9c0<_0x163a08['length'];_0x13a9c0+=0x1){var _0x55f6fb=_0x109dae[_0x4359('0x20')]['destroy']({'where':{'ListId':_0x163a08[_0x13a9c0][_0x4359('0x23')],'ContactId':_0x163a08[_0x13a9c0][_0x4359('0x41')],'VoiceQueueId':_0x163a08[_0x13a9c0][_0x4359('0x42')],'CampaignId':_0x163a08[_0x13a9c0][_0x4359('0x43')]}});_0x1ea54b['push'](_0x55f6fb);}return BPromise[_0x4359('0x44')](_0x1ea54b);}})[_0x4359('0x26')](function(_0x45c508){logger[_0x4359('0x45')](_0x4359('0x46'),util['inspect'](_0x45c508,{'showHidden':![],'depth':null}));_0x309b43();})[_0x4359('0x2b')](function(_0x4177d8){logger['error'](_0x4359('0x47'),util['inspect'](_0x4177d8,{'showHidden':![],'depth':null}));_0x309b43(_0x4177d8);});}}});}; \ No newline at end of file diff --git a/server/api/cmContact/cmContact.rpc.js b/server/api/cmContact/cmContact.rpc.js index 0302b9b..421ffc2 100644 --- a/server/api/cmContact/cmContact.rpc.js +++ b/server/api/cmContact/cmContact.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['include','model','length','CmContactHasItem','find','ListId','Contact','isNil','CmContactId','CmContact','catch','CreateCmContact','create','body','keys','startsWith','cf_','table','cm_contacts','set','where','id\x20=\x20?','toString','sequelize','query','lodash','util','moment','bluebird','ioredis','squel','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','./cmContact.socket','register','request','then','info','CmContact,\x20%s,\x20%s','request\x20sent','debug','CmContact,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result','GetCmContact','findAll','options','raw','attributes','limit','map'];(function(_0x39dd52,_0x366476){var _0x43b377=function(_0x4c39ae){while(--_0x4c39ae){_0x39dd52['push'](_0x39dd52['shift']());}};_0x43b377(++_0x366476);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var squel=require(_0x7995('0x5'));var db=require(_0x7995('0x6'))['db'];var utils=require(_0x7995('0x7'));var logger=require('../../config/logger')(_0x7995('0x8'));var config=require(_0x7995('0x9'));var jayson=require(_0x7995('0xa'));var client=jayson[_0x7995('0xb')][_0x7995('0xc')]({'port':0x232a});config[_0x7995('0xd')]=_['defaults'](config[_0x7995('0xd')],{'host':_0x7995('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7995('0xd')]));require(_0x7995('0xf'))[_0x7995('0x10')](socket);function respondWithRpcPromise(_0x35b5fe,_0x3c1d19,_0x1e400a){return new BPromise(function(_0x341672,_0x524f7b){return client[_0x7995('0x11')](_0x35b5fe,_0x1e400a)[_0x7995('0x12')](function(_0x581f22){logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));logger[_0x7995('0x16')](_0x7995('0x17'),_0x3c1d19,_0x7995('0x15'),JSON[_0x7995('0x18')](_0x581f22));if(_0x581f22['error']){if(_0x581f22['error'][_0x7995('0x19')]===0x1f4){logger[_0x7995('0x1a')](_0x7995('0x14'),_0x3c1d19,_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);return _0x524f7b(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}logger[_0x7995('0x1a')]('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x581f22[_0x7995('0x1a')]['message']);return _0x341672(_0x581f22[_0x7995('0x1a')][_0x7995('0x1b')]);}else{logger[_0x7995('0x13')](_0x7995('0x14'),_0x3c1d19,_0x7995('0x15'));_0x341672(_0x581f22[_0x7995('0x1c')]['message']);}})['catch'](function(_0x2536c8){logger['error']('CmContact,\x20%s,\x20%s',_0x3c1d19,_0x2536c8);_0x524f7b(_0x2536c8);});});}exports[_0x7995('0x1d')]=function(_0x3d463e){var _0x4cbe10=this;return new Promise(function(_0x3a9b54,_0x51f276){return db['CmContact'][_0x7995('0x1e')]({'raw':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![],'where':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['where']||null:null,'attributes':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x21')]||null:null,'limit':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')][_0x7995('0x22')]||null:null,'include':_0x3d463e[_0x7995('0x1f')]?_0x3d463e[_0x7995('0x1f')]['include']?_[_0x7995('0x23')](_0x3d463e[_0x7995('0x1f')][_0x7995('0x24')],function(_0x268ce7){return{'model':db[_0x268ce7[_0x7995('0x25')]],'as':_0x268ce7['as'],'attributes':_0x268ce7[_0x7995('0x21')],'include':_0x268ce7['include']?_[_0x7995('0x23')](_0x268ce7['include'],function(_0x229742){return{'model':db[_0x229742[_0x7995('0x25')]],'as':_0x229742['as'],'attributes':_0x229742[_0x7995('0x21')],'include':_0x229742[_0x7995('0x24')]?_[_0x7995('0x23')](_0x229742['include'],function(_0x9b2a15){return{'model':db[_0x9b2a15['model']],'as':_0x9b2a15['as'],'attributes':_0x9b2a15[_0x7995('0x21')]};}):[]};}):[]};}):[]:[]})[_0x7995('0x12')](function(_0x4253e5){logger['info']('GetCmContact',_0x3d463e);logger['debug'](_0x7995('0x1d'),_0x3d463e,JSON[_0x7995('0x18')](_0x4253e5));if(_0x4253e5[_0x7995('0x26')]==0x0){return db[_0x7995('0x27')][_0x7995('0x28')]({'raw':!![],'where':{'item':_0x3d463e[_0x7995('0x1f')]['phone']},'include':[{'model':db['CmContact'],'where':{'ListId':_0x3d463e[_0x7995('0x1f')]['where'][_0x7995('0x29')],'deletedAt':{'$eq':null}},'as':_0x7995('0x2a')}]})[_0x7995('0x12')](function(_0x1e9fa4){if(_[_0x7995('0x2b')](_0x1e9fa4)){_0x3a9b54(_0x4253e5);}else{var _0x510841=_0x1e9fa4[_0x7995('0x2c')];return db[_0x7995('0x2d')]['findAll']({'raw':!![],'where':{'id':_0x510841},'attributes':_0x3d463e['options']?_0x3d463e['options'][_0x7995('0x21')]||null:null})[_0x7995('0x12')](function(_0x4a176f){_0x3a9b54(_0x4a176f);});}});}else{_0x3a9b54(_0x4253e5);}})[_0x7995('0x2e')](function(_0x51b95d){logger[_0x7995('0x1a')](_0x7995('0x1d'),_0x51b95d[_0x7995('0x1b')],_0x3d463e);_0x51f276(_0x4cbe10['error'](0x1f4,_0x51b95d['message']));});});};exports[_0x7995('0x2f')]=function(_0x5e67fe){var _0x5d2428=this;return new Promise(function(_0x3e99cd,_0xe328b1){return db['CmContact'][_0x7995('0x30')](_0x5e67fe[_0x7995('0x31')],{'raw':_0x5e67fe[_0x7995('0x1f')]?_0x5e67fe[_0x7995('0x1f')][_0x7995('0x20')]===undefined?!![]:![]:!![]})['then'](function(_0x2d4285){var _0x242713;for(var _0xf612e6=0x0;_0xf612e6{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file +var _0xa9e0=['basename','extname','now','/csv','single','file','uploadCsv','%s-%s%s','upload','/upload/:id','import','put','/:id','update','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContact.controller','get','index','/describe','show','/:id/tags','isAuthenticated','getTags','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperFinals','/:id/jscripty_sessions','getJscriptySessions','/:id/journey','getJourney','post','create','/create_many','bulkCreate','setTags','setAdditionalPhones','/:id/duplicateAdditionalPhones','/:id/rescheduleAdditionalPhones','rescheduleAdditionalPhones','join','root','server/files/tmp','originalname','replace','format'];(function(_0x3ff091,_0x24eaa0){var _0x32bd00=function(_0x18ba76){while(--_0x18ba76){_0x3ff091['push'](_0x3ff091['shift']());}};_0x32bd00(++_0x24eaa0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x481bf7,_0x437f69){_0x481bf7=_0x481bf7-0x0;var _0x461787=_0xa9e0[_0x481bf7];return _0x461787;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/phones',auth['isAuthenticated'](),controller['getAdditionalPhones']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getHopperHistories']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x18')]('/merge',auth[_0x0a9e('0xd')](),controller['merge']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/phones',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x1e'),auth['isAuthenticated'](),controller['duplicateAdditionalPhones']);router[_0x0a9e('0x18')](_0x0a9e('0x1f'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0xfb6e48,_0x2fb0e4,_0x3b45bc){_0x3b45bc(null,path[_0x0a9e('0x21')](config[_0x0a9e('0x22')],_0x0a9e('0x23')));},'filename':function(_0x16b1ca,_0x5ea472,_0x59181e){_0x5ea472[_0x0a9e('0x24')]=_0x5ea472[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x59181e(null,util[_0x0a9e('0x26')]('%s-%s%s',path[_0x0a9e('0x27')](_0x5ea472['originalname'],path[_0x0a9e('0x28')](_0x5ea472['originalname'])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x5ea472[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')](_0x0a9e('0x2a'),upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2d')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x3652a7,_0x468813,_0x2b1f27){_0x2b1f27(null,path[_0x0a9e('0x21')](config['root'],_0x0a9e('0x23')));},'filename':function(_0x40e7a3,_0x1843b2,_0x824a4f){_0x1843b2[_0x0a9e('0x24')]=_0x1843b2[_0x0a9e('0x24')][_0x0a9e('0x25')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x824a4f(null,util[_0x0a9e('0x26')](_0x0a9e('0x2e'),path['basename'](_0x1843b2[_0x0a9e('0x24')],path['extname'](_0x1843b2[_0x0a9e('0x24')])),Date[_0x0a9e('0x29')](),path[_0x0a9e('0x28')](_0x1843b2[_0x0a9e('0x24')])));}})});router[_0x0a9e('0x18')]('/upload',upload[_0x0a9e('0x2b')](_0x0a9e('0x2c')),controller[_0x0a9e('0x2f')]);router[_0x0a9e('0x18')](_0x0a9e('0x30'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x31')]);router[_0x0a9e('0x18')]('/uploadUpdates/:id',auth[_0x0a9e('0xd')](),controller['importUpdates']);router[_0x0a9e('0x32')](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x34')]);router['delete'](_0x0a9e('0x33'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x35')]);module[_0x0a9e('0x36')]=router; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.attributes.js b/server/api/cmContactHasItem/cmContactHasItem.attributes.js index 37d67b1..1c37b5b 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.attributes.js +++ b/server/api/cmContactHasItem/cmContactHasItem.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4b1f=['INTEGER','sequelize','exports','STRING'];(function(_0x14ad0b,_0x33a8d6){var _0x29666c=function(_0x1aa90e){while(--_0x1aa90e){_0x14ad0b['push'](_0x14ad0b['shift']());}};_0x29666c(++_0x33a8d6);}(_0x4b1f,0x195));var _0xf4b1=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0x4b1f[_0x25e7cb];return _0x375d92;};'use strict';var Sequelize=require(_0xf4b1('0x0'));module[_0xf4b1('0x1')]={'CmContactId':{'type':Sequelize['INTEGER'],'primaryKey':!![]},'item':{'type':Sequelize[_0xf4b1('0x2')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0xf4b1('0x3')],'defaultValue':null},'ItemClass':{'type':Sequelize[_0xf4b1('0x2')],'defaultValue':'PHONE'},'OrderBy':{'type':Sequelize[_0xf4b1('0x3')],'defaultValue':null},'description':{'type':Sequelize[_0xf4b1('0x2')],'defaultValue':null}}; \ No newline at end of file +var _0x5ab4=['exports','INTEGER','STRING','PHONE','sequelize'];(function(_0x586dee,_0x39da32){var _0xe02274=function(_0x5639fa){while(--_0x5639fa){_0x586dee['push'](_0x586dee['shift']());}};_0xe02274(++_0x39da32);}(_0x5ab4,0x9f));var _0x45ab=function(_0x159d0e,_0x569b9a){_0x159d0e=_0x159d0e-0x0;var _0x11b437=_0x5ab4[_0x159d0e];return _0x11b437;};'use strict';var Sequelize=require(_0x45ab('0x0'));module[_0x45ab('0x1')]={'CmContactId':{'type':Sequelize[_0x45ab('0x2')],'primaryKey':!![]},'item':{'type':Sequelize[_0x45ab('0x3')],'defaultValue':'','primaryKey':!![]},'ItemTypeId':{'type':Sequelize[_0x45ab('0x2')],'defaultValue':null},'ItemClass':{'type':Sequelize['STRING'],'defaultValue':_0x45ab('0x4')},'OrderBy':{'type':Sequelize[_0x45ab('0x2')],'defaultValue':null},'description':{'type':Sequelize[_0x45ab('0x3')],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.controller.js b/server/api/cmContactHasItem/cmContactHasItem.controller.js index 2516b62..22edb66 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.controller.js +++ b/server/api/cmContactHasItem/cmContactHasItem.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe038=['fast-json-patch','mustache','util','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','set','apply','save','update','then','destroy','CmContactHasItems','UserProfileResource','error','stack','name','send','CmContactHasItem','rawAttributes','fieldName','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','rimraf','zip-dir'];(function(_0x54bac5,_0x8d3a16){var _0xc15971=function(_0x254653){while(--_0x254653){_0x54bac5['push'](_0x54bac5['shift']());}};_0xc15971(++_0x8d3a16);}(_0xe038,0x13e));var _0x8e03=function(_0x53ccf2,_0x13cb67){_0x53ccf2=_0x53ccf2-0x0;var _0x5a2964=_0xe038[_0x53ccf2];return _0x5a2964;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8e03('0x0'));var zipdir=require(_0x8e03('0x1'));var jsonpatch=require(_0x8e03('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8e03('0x3'));var util=require(_0x8e03('0x4'));var path=require(_0x8e03('0x5'));var sox=require('sox');var csv=require(_0x8e03('0x6'));var ejs=require(_0x8e03('0x7'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8e03('0x8'));var squel=require(_0x8e03('0x9'));var crypto=require(_0x8e03('0xa'));var jsforce=require(_0x8e03('0xb'));var deskjs=require(_0x8e03('0xc'));var toCsv=require(_0x8e03('0x6'));var querystring=require(_0x8e03('0xd'));var Papa=require(_0x8e03('0xe'));var Redis=require(_0x8e03('0xf'));var authService=require(_0x8e03('0x10'));var qs=require(_0x8e03('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x8e03('0x12'))(_0x8e03('0x13'));var utils=require(_0x8e03('0x14'));var config=require(_0x8e03('0x15'));var licenseUtil=require(_0x8e03('0x16'));var db=require(_0x8e03('0x17'))['db'];function respondWithStatusCode(_0x2a23ca,_0x4fa792){_0x4fa792=_0x4fa792||0xcc;return function(_0x2f68df){if(_0x2f68df){return _0x2a23ca['sendStatus'](_0x4fa792);}return _0x2a23ca[_0x8e03('0x18')](_0x4fa792)[_0x8e03('0x19')]();};}function respondWithResult(_0xc91924,_0x1fd49b){_0x1fd49b=_0x1fd49b||0xc8;return function(_0x2e798b){if(_0x2e798b){return _0xc91924['status'](_0x1fd49b)[_0x8e03('0x1a')](_0x2e798b);}};}function respondWithFilteredResult(_0x29a10d,_0x22a9e6){return function(_0x263fad){if(_0x263fad){var _0x4b17f8=typeof _0x22a9e6['offset']===_0x8e03('0x1b')&&typeof _0x22a9e6['limit']==='undefined';var _0x9e37cb=_0x263fad[_0x8e03('0x1c')];var _0x6cf14b=_0x4b17f8?0x0:_0x22a9e6[_0x8e03('0x1d')];var _0x2940b1=_0x4b17f8?_0x263fad[_0x8e03('0x1c')]:_0x22a9e6[_0x8e03('0x1d')]+_0x22a9e6[_0x8e03('0x1e')];var _0x32505b;if(_0x2940b1>=_0x9e37cb){_0x2940b1=_0x9e37cb;_0x32505b=0xc8;}else{_0x32505b=0xce;}_0x29a10d['status'](_0x32505b);return _0x29a10d[_0x8e03('0x1f')]('Content-Range',_0x6cf14b+'-'+_0x2940b1+'/'+_0x9e37cb)['json'](_0x263fad);}return null;};}function patchUpdates(_0x2cf3a4){return function(_0x392ff5){try{jsonpatch[_0x8e03('0x20')](_0x392ff5,_0x2cf3a4,!![]);}catch(_0x4e97e1){return BPromise['reject'](_0x4e97e1);}return _0x392ff5[_0x8e03('0x21')]();};}function saveUpdates(_0x17a04a,_0x991b61){return function(_0x1d76e5){if(_0x1d76e5){return _0x1d76e5[_0x8e03('0x22')](_0x17a04a)[_0x8e03('0x23')](function(_0x11e938){return _0x11e938;});}return null;};}function removeEntity(_0x39fa79,_0x34c986){return function(_0x1b6cb0){if(_0x1b6cb0){return _0x1b6cb0[_0x8e03('0x24')]()[_0x8e03('0x23')](function(){var _0x5b7ca8=_0x1b6cb0['get']({'plain':!![]});var _0x2ce00a=_0x8e03('0x25');return db[_0x8e03('0x26')][_0x8e03('0x24')]({'where':{'type':_0x2ce00a,'resourceId':_0x5b7ca8['id']}})[_0x8e03('0x23')](function(){return _0x1b6cb0;});})[_0x8e03('0x23')](function(){_0x39fa79[_0x8e03('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x228d13,_0x1375e4){return function(_0x5c142f){if(!_0x5c142f){_0x228d13['sendStatus'](0x194);}return _0x5c142f;};}function handleError(_0x88a4cc,_0x3a88b4){_0x3a88b4=_0x3a88b4||0x1f4;return function(_0xeb4bb6){logger[_0x8e03('0x27')](_0xeb4bb6[_0x8e03('0x28')]);if(_0xeb4bb6[_0x8e03('0x29')]){delete _0xeb4bb6['name'];}_0x88a4cc[_0x8e03('0x18')](_0x3a88b4)[_0x8e03('0x2a')](_0xeb4bb6);};}exports['index']=function(_0x10ff71,_0x4c8640){var _0x111e30={},_0x2b6db0={},_0x52f5e5={'count':0x0,'rows':[]};var _0x126c45=_['map'](db[_0x8e03('0x2b')][_0x8e03('0x2c')],function(_0xe0ea6b){return{'name':_0xe0ea6b[_0x8e03('0x2d')],'type':_0xe0ea6b['type']['key']};});_0x2b6db0[_0x8e03('0x2e')]=_[_0x8e03('0x2f')](_0x126c45,_0x8e03('0x29'));_0x2b6db0[_0x8e03('0x30')]=_[_0x8e03('0x31')](_0x10ff71[_0x8e03('0x30')]);_0x2b6db0[_0x8e03('0x32')]=_[_0x8e03('0x33')](_0x2b6db0[_0x8e03('0x2e')],_0x2b6db0[_0x8e03('0x30')]);_0x111e30[_0x8e03('0x34')]=_['intersection'](_0x2b6db0['model'],qs[_0x8e03('0x35')](_0x10ff71[_0x8e03('0x30')]['fields']));_0x111e30[_0x8e03('0x34')]=_0x111e30['attributes'][_0x8e03('0x36')]?_0x111e30[_0x8e03('0x34')]:_0x2b6db0[_0x8e03('0x2e')];if(!_0x10ff71['query'][_0x8e03('0x37')]('nolimit')){_0x111e30[_0x8e03('0x1e')]=qs[_0x8e03('0x1e')](_0x10ff71[_0x8e03('0x30')][_0x8e03('0x1e')]);_0x111e30['offset']=qs[_0x8e03('0x1d')](_0x10ff71['query'][_0x8e03('0x1d')]);}_0x111e30['order']=qs['sort'](_0x10ff71[_0x8e03('0x30')][_0x8e03('0x38')]);_0x111e30[_0x8e03('0x39')]=qs['filters'](_[_0x8e03('0x3a')](_0x10ff71['query'],_0x2b6db0['filters']),_0x126c45);if(_0x10ff71[_0x8e03('0x30')][_0x8e03('0x3b')]){_0x111e30[_0x8e03('0x39')]=_[_0x8e03('0x3c')](_0x111e30[_0x8e03('0x39')],{'$or':_[_0x8e03('0x2f')](_0x126c45,function(_0x2dbe21){if(_0x2dbe21[_0x8e03('0x3d')]!==_0x8e03('0x3e')){var _0xb8f152={};_0xb8f152[_0x2dbe21[_0x8e03('0x29')]]={'$like':'%'+_0x10ff71[_0x8e03('0x30')][_0x8e03('0x3b')]+'%'};return _0xb8f152;}})});}_0x111e30=_['merge']({},_0x111e30,_0x10ff71[_0x8e03('0x3f')]);var _0x5a4b65={'where':_0x111e30['where']};return db['CmContactHasItem'][_0x8e03('0x1c')](_0x5a4b65)[_0x8e03('0x23')](function(_0x4e4b54){_0x52f5e5['count']=_0x4e4b54;if(_0x10ff71['query'][_0x8e03('0x40')]){_0x111e30[_0x8e03('0x41')]=[{'all':!![]}];}return db[_0x8e03('0x2b')][_0x8e03('0x42')](_0x111e30);})[_0x8e03('0x23')](function(_0x46b896){_0x52f5e5[_0x8e03('0x43')]=_0x46b896;return _0x52f5e5;})[_0x8e03('0x23')](respondWithFilteredResult(_0x4c8640,_0x111e30))[_0x8e03('0x44')](handleError(_0x4c8640,null));};exports['show']=function(_0x48f00c,_0x1a1e12){var _0x17638b={'raw':!![],'where':{'id':_0x48f00c[_0x8e03('0x45')]['id']}},_0x214fc9={};_0x214fc9[_0x8e03('0x2e')]=_[_0x8e03('0x31')](db[_0x8e03('0x2b')][_0x8e03('0x2c')]);_0x214fc9['query']=_[_0x8e03('0x31')](_0x48f00c[_0x8e03('0x30')]);_0x214fc9[_0x8e03('0x32')]=_[_0x8e03('0x33')](_0x214fc9[_0x8e03('0x2e')],_0x214fc9[_0x8e03('0x30')]);_0x17638b[_0x8e03('0x34')]=_['intersection'](_0x214fc9['model'],qs[_0x8e03('0x35')](_0x48f00c['query'][_0x8e03('0x35')]));_0x17638b[_0x8e03('0x34')]=_0x17638b[_0x8e03('0x34')][_0x8e03('0x36')]?_0x17638b['attributes']:_0x214fc9['model'];if(_0x48f00c['query'][_0x8e03('0x40')]){_0x17638b['include']=[{'all':!![]}];}_0x17638b=_[_0x8e03('0x3c')]({},_0x17638b,_0x48f00c['options']);return db[_0x8e03('0x2b')][_0x8e03('0x46')](_0x17638b)['then'](handleEntityNotFound(_0x1a1e12,null))[_0x8e03('0x23')](respondWithResult(_0x1a1e12,null))['catch'](handleError(_0x1a1e12,null));};exports[_0x8e03('0x47')]=function(_0x1e1c2c,_0x404071){return db[_0x8e03('0x2b')][_0x8e03('0x47')](_0x1e1c2c[_0x8e03('0x48')],{})[_0x8e03('0x23')](function(_0x2f587d){var _0x3715d5=_0x1e1c2c['user'][_0x8e03('0x49')]({'plain':!![]});if(!_0x3715d5)throw new Error(_0x8e03('0x4a'));if(_0x3715d5[_0x8e03('0x4b')]===_0x8e03('0x4c')){var _0x4ca30d=_0x2f587d[_0x8e03('0x49')]({'plain':!![]});var _0x1a869e=_0x8e03('0x25');return db[_0x8e03('0x4d')][_0x8e03('0x46')]({'where':{'name':_0x1a869e,'userProfileId':_0x3715d5[_0x8e03('0x4e')]},'raw':!![]})[_0x8e03('0x23')](function(_0x14b670){if(_0x14b670&&_0x14b670['autoAssociation']===0x0){return db[_0x8e03('0x26')]['create']({'name':_0x4ca30d[_0x8e03('0x29')],'resourceId':_0x4ca30d['id'],'type':_0x14b670[_0x8e03('0x29')],'sectionId':_0x14b670['id']},{})[_0x8e03('0x23')](function(){return _0x2f587d;});}else{return _0x2f587d;}})[_0x8e03('0x44')](function(_0x5850b8){logger[_0x8e03('0x27')](_0x8e03('0x4f'),_0x5850b8);throw _0x5850b8;});}return _0x2f587d;})[_0x8e03('0x23')](respondWithResult(_0x404071,0xc9))[_0x8e03('0x44')](handleError(_0x404071,null));};exports[_0x8e03('0x22')]=function(_0x4398fe,_0x1cef64){if(_0x4398fe[_0x8e03('0x48')]['id']){delete _0x4398fe[_0x8e03('0x48')]['id'];}return db[_0x8e03('0x2b')][_0x8e03('0x46')]({'where':{'id':_0x4398fe['params']['id']}})[_0x8e03('0x23')](handleEntityNotFound(_0x1cef64,null))[_0x8e03('0x23')](saveUpdates(_0x4398fe[_0x8e03('0x48')],null))[_0x8e03('0x23')](respondWithResult(_0x1cef64,null))[_0x8e03('0x44')](handleError(_0x1cef64,null));};exports[_0x8e03('0x24')]=function(_0x3a5762,_0x3138bd){return db[_0x8e03('0x2b')]['find']({'where':{'id':_0x3a5762[_0x8e03('0x45')]['id']}})[_0x8e03('0x23')](handleEntityNotFound(_0x3138bd,null))[_0x8e03('0x23')](removeEntity(_0x3138bd,null))[_0x8e03('0x44')](handleError(_0x3138bd,null));}; \ No newline at end of file +var _0xff45=['model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','CmContactHasItem','count','include','findAll','catch','show','params','length','includeAll','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','CmContactHasItems','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','rimraf','zip-dir','fast-json-patch','moment','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','set','Content-Range','apply','save','then','destroy','get','UserProfileResource','stack','name','send','index','map','rawAttributes','fieldName','type','key'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xff45,0x79));var _0x5ff4=function(_0x5a523a,_0x45f545){_0x5a523a=_0x5a523a-0x0;var _0x534585=_0xff45[_0x5a523a];return _0x534585;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5ff4('0x0'));var zipdir=require(_0x5ff4('0x1'));var jsonpatch=require(_0x5ff4('0x2'));var rp=require('request-promise');var moment=require(_0x5ff4('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5ff4('0x4'));var util=require('util');var path=require('path');var sox=require(_0x5ff4('0x5'));var csv=require(_0x5ff4('0x6'));var ejs=require(_0x5ff4('0x7'));var fs=require('fs');var fs_extra=require(_0x5ff4('0x8'));var _=require(_0x5ff4('0x9'));var squel=require(_0x5ff4('0xa'));var crypto=require(_0x5ff4('0xb'));var jsforce=require(_0x5ff4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x5ff4('0xd'));var Papa=require(_0x5ff4('0xe'));var Redis=require(_0x5ff4('0xf'));var authService=require(_0x5ff4('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x5ff4('0x11'));var hardwareService=require(_0x5ff4('0x12'));var logger=require(_0x5ff4('0x13'))(_0x5ff4('0x14'));var utils=require(_0x5ff4('0x15'));var config=require(_0x5ff4('0x16'));var licenseUtil=require(_0x5ff4('0x17'));var db=require(_0x5ff4('0x18'))['db'];function respondWithStatusCode(_0x11c7c1,_0x3e5703){_0x3e5703=_0x3e5703||0xcc;return function(_0x1e847d){if(_0x1e847d){return _0x11c7c1['sendStatus'](_0x3e5703);}return _0x11c7c1[_0x5ff4('0x19')](_0x3e5703)[_0x5ff4('0x1a')]();};}function respondWithResult(_0x38f214,_0x3581c8){_0x3581c8=_0x3581c8||0xc8;return function(_0x5b81e1){if(_0x5b81e1){return _0x38f214[_0x5ff4('0x19')](_0x3581c8)[_0x5ff4('0x1b')](_0x5b81e1);}};}function respondWithFilteredResult(_0x338a54,_0x28098c){return function(_0x23169a){if(_0x23169a){var _0x23992e=typeof _0x28098c[_0x5ff4('0x1c')]===_0x5ff4('0x1d')&&typeof _0x28098c['limit']===_0x5ff4('0x1d');var _0x14712c=_0x23169a['count'];var _0x218288=_0x23992e?0x0:_0x28098c[_0x5ff4('0x1c')];var _0x25b6b5=_0x23992e?_0x23169a['count']:_0x28098c[_0x5ff4('0x1c')]+_0x28098c['limit'];var _0x5419bd;if(_0x25b6b5>=_0x14712c){_0x25b6b5=_0x14712c;_0x5419bd=0xc8;}else{_0x5419bd=0xce;}_0x338a54[_0x5ff4('0x19')](_0x5419bd);return _0x338a54[_0x5ff4('0x1e')](_0x5ff4('0x1f'),_0x218288+'-'+_0x25b6b5+'/'+_0x14712c)['json'](_0x23169a);}return null;};}function patchUpdates(_0x3b978c){return function(_0x3154c8){try{jsonpatch[_0x5ff4('0x20')](_0x3154c8,_0x3b978c,!![]);}catch(_0x299c31){return BPromise['reject'](_0x299c31);}return _0x3154c8[_0x5ff4('0x21')]();};}function saveUpdates(_0x174056,_0x135a5a){return function(_0x468099){if(_0x468099){return _0x468099['update'](_0x174056)[_0x5ff4('0x22')](function(_0x2607e4){return _0x2607e4;});}return null;};}function removeEntity(_0x4dbc1b,_0x3d9e8c){return function(_0x3295f4){if(_0x3295f4){return _0x3295f4[_0x5ff4('0x23')]()[_0x5ff4('0x22')](function(){var _0xd83c44=_0x3295f4[_0x5ff4('0x24')]({'plain':!![]});var _0x1db22c='CmContactHasItems';return db[_0x5ff4('0x25')][_0x5ff4('0x23')]({'where':{'type':_0x1db22c,'resourceId':_0xd83c44['id']}})[_0x5ff4('0x22')](function(){return _0x3295f4;});})[_0x5ff4('0x22')](function(){_0x4dbc1b[_0x5ff4('0x19')](0xcc)[_0x5ff4('0x1a')]();});}};}function handleEntityNotFound(_0xdced7e,_0x2eb261){return function(_0x4e5e01){if(!_0x4e5e01){_0xdced7e['sendStatus'](0x194);}return _0x4e5e01;};}function handleError(_0x2bab3e,_0xc3678c){_0xc3678c=_0xc3678c||0x1f4;return function(_0x433f01){logger['error'](_0x433f01[_0x5ff4('0x26')]);if(_0x433f01[_0x5ff4('0x27')]){delete _0x433f01[_0x5ff4('0x27')];}_0x2bab3e['status'](_0xc3678c)[_0x5ff4('0x28')](_0x433f01);};}exports[_0x5ff4('0x29')]=function(_0x42f964,_0x88ae03){var _0x28b60e={},_0xf1391b={},_0x8dc3d={'count':0x0,'rows':[]};var _0x46ff12=_[_0x5ff4('0x2a')](db['CmContactHasItem'][_0x5ff4('0x2b')],function(_0x1eb99f){return{'name':_0x1eb99f[_0x5ff4('0x2c')],'type':_0x1eb99f[_0x5ff4('0x2d')][_0x5ff4('0x2e')]};});_0xf1391b[_0x5ff4('0x2f')]=_[_0x5ff4('0x2a')](_0x46ff12,_0x5ff4('0x27'));_0xf1391b[_0x5ff4('0x30')]=_[_0x5ff4('0x31')](_0x42f964[_0x5ff4('0x30')]);_0xf1391b[_0x5ff4('0x32')]=_[_0x5ff4('0x33')](_0xf1391b['model'],_0xf1391b[_0x5ff4('0x30')]);_0x28b60e[_0x5ff4('0x34')]=_[_0x5ff4('0x33')](_0xf1391b[_0x5ff4('0x2f')],qs[_0x5ff4('0x35')](_0x42f964[_0x5ff4('0x30')][_0x5ff4('0x35')]));_0x28b60e[_0x5ff4('0x34')]=_0x28b60e[_0x5ff4('0x34')]['length']?_0x28b60e[_0x5ff4('0x34')]:_0xf1391b['model'];if(!_0x42f964[_0x5ff4('0x30')][_0x5ff4('0x36')](_0x5ff4('0x37'))){_0x28b60e['limit']=qs[_0x5ff4('0x38')](_0x42f964[_0x5ff4('0x30')]['limit']);_0x28b60e[_0x5ff4('0x1c')]=qs['offset'](_0x42f964[_0x5ff4('0x30')]['offset']);}_0x28b60e[_0x5ff4('0x39')]=qs[_0x5ff4('0x3a')](_0x42f964[_0x5ff4('0x30')][_0x5ff4('0x3a')]);_0x28b60e[_0x5ff4('0x3b')]=qs[_0x5ff4('0x32')](_[_0x5ff4('0x3c')](_0x42f964[_0x5ff4('0x30')],_0xf1391b['filters']),_0x46ff12);if(_0x42f964[_0x5ff4('0x30')][_0x5ff4('0x3d')]){_0x28b60e['where']=_['merge'](_0x28b60e[_0x5ff4('0x3b')],{'$or':_[_0x5ff4('0x2a')](_0x46ff12,function(_0x13361d){if(_0x13361d[_0x5ff4('0x2d')]!=='VIRTUAL'){var _0x12f924={};_0x12f924[_0x13361d['name']]={'$like':'%'+_0x42f964['query'][_0x5ff4('0x3d')]+'%'};return _0x12f924;}})});}_0x28b60e=_[_0x5ff4('0x3e')]({},_0x28b60e,_0x42f964[_0x5ff4('0x3f')]);var _0x2fc536={'where':_0x28b60e[_0x5ff4('0x3b')]};return db[_0x5ff4('0x40')][_0x5ff4('0x41')](_0x2fc536)[_0x5ff4('0x22')](function(_0x33ace5){_0x8dc3d['count']=_0x33ace5;if(_0x42f964['query']['includeAll']){_0x28b60e[_0x5ff4('0x42')]=[{'all':!![]}];}return db[_0x5ff4('0x40')][_0x5ff4('0x43')](_0x28b60e);})['then'](function(_0x31fea6){_0x8dc3d['rows']=_0x31fea6;return _0x8dc3d;})[_0x5ff4('0x22')](respondWithFilteredResult(_0x88ae03,_0x28b60e))[_0x5ff4('0x44')](handleError(_0x88ae03,null));};exports[_0x5ff4('0x45')]=function(_0x3f40f3,_0x511f43){var _0x33e869={'raw':!![],'where':{'id':_0x3f40f3[_0x5ff4('0x46')]['id']}},_0x3f22e7={};_0x3f22e7[_0x5ff4('0x2f')]=_[_0x5ff4('0x31')](db[_0x5ff4('0x40')][_0x5ff4('0x2b')]);_0x3f22e7[_0x5ff4('0x30')]=_['keys'](_0x3f40f3['query']);_0x3f22e7[_0x5ff4('0x32')]=_[_0x5ff4('0x33')](_0x3f22e7[_0x5ff4('0x2f')],_0x3f22e7[_0x5ff4('0x30')]);_0x33e869[_0x5ff4('0x34')]=_[_0x5ff4('0x33')](_0x3f22e7['model'],qs[_0x5ff4('0x35')](_0x3f40f3['query'][_0x5ff4('0x35')]));_0x33e869[_0x5ff4('0x34')]=_0x33e869[_0x5ff4('0x34')][_0x5ff4('0x47')]?_0x33e869[_0x5ff4('0x34')]:_0x3f22e7[_0x5ff4('0x2f')];if(_0x3f40f3[_0x5ff4('0x30')][_0x5ff4('0x48')]){_0x33e869[_0x5ff4('0x42')]=[{'all':!![]}];}_0x33e869=_[_0x5ff4('0x3e')]({},_0x33e869,_0x3f40f3[_0x5ff4('0x3f')]);return db[_0x5ff4('0x40')][_0x5ff4('0x49')](_0x33e869)[_0x5ff4('0x22')](handleEntityNotFound(_0x511f43,null))['then'](respondWithResult(_0x511f43,null))[_0x5ff4('0x44')](handleError(_0x511f43,null));};exports[_0x5ff4('0x4a')]=function(_0x49f38d,_0x2f147d){return db['CmContactHasItem']['create'](_0x49f38d[_0x5ff4('0x4b')],{})[_0x5ff4('0x22')](function(_0x28b28a){var _0x422d9d=_0x49f38d[_0x5ff4('0x4c')][_0x5ff4('0x24')]({'plain':!![]});if(!_0x422d9d)throw new Error(_0x5ff4('0x4d'));if(_0x422d9d['role']===_0x5ff4('0x4c')){var _0x3d98f8=_0x28b28a[_0x5ff4('0x24')]({'plain':!![]});var _0x275c5e=_0x5ff4('0x4e');return db[_0x5ff4('0x4f')][_0x5ff4('0x49')]({'where':{'name':_0x275c5e,'userProfileId':_0x422d9d[_0x5ff4('0x50')]},'raw':!![]})[_0x5ff4('0x22')](function(_0x3b4112){if(_0x3b4112&&_0x3b4112['autoAssociation']===0x0){return db[_0x5ff4('0x25')][_0x5ff4('0x4a')]({'name':_0x3d98f8['name'],'resourceId':_0x3d98f8['id'],'type':_0x3b4112[_0x5ff4('0x27')],'sectionId':_0x3b4112['id']},{})[_0x5ff4('0x22')](function(){return _0x28b28a;});}else{return _0x28b28a;}})[_0x5ff4('0x44')](function(_0x5ed9a1){logger[_0x5ff4('0x51')](_0x5ff4('0x52'),_0x5ed9a1);throw _0x5ed9a1;});}return _0x28b28a;})[_0x5ff4('0x22')](respondWithResult(_0x2f147d,0xc9))['catch'](handleError(_0x2f147d,null));};exports[_0x5ff4('0x53')]=function(_0x2c5c2e,_0x40fa8d){if(_0x2c5c2e['body']['id']){delete _0x2c5c2e[_0x5ff4('0x4b')]['id'];}return db[_0x5ff4('0x40')]['find']({'where':{'id':_0x2c5c2e['params']['id']}})[_0x5ff4('0x22')](handleEntityNotFound(_0x40fa8d,null))[_0x5ff4('0x22')](saveUpdates(_0x2c5c2e[_0x5ff4('0x4b')],null))[_0x5ff4('0x22')](respondWithResult(_0x40fa8d,null))[_0x5ff4('0x44')](handleError(_0x40fa8d,null));};exports[_0x5ff4('0x23')]=function(_0x45d068,_0x115845){return db[_0x5ff4('0x40')][_0x5ff4('0x49')]({'where':{'id':_0x45d068['params']['id']}})[_0x5ff4('0x22')](handleEntityNotFound(_0x115845,null))[_0x5ff4('0x22')](removeEntity(_0x115845,null))[_0x5ff4('0x44')](handleError(_0x115845,null));}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.model.js b/server/api/cmContactHasItem/cmContactHasItem.model.js index 4f536a6..4a9a093 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.model.js +++ b/server/api/cmContactHasItem/cmContactHasItem.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x704d=['lodash','util','api','moment','./cmContactHasItem.attributes','exports','define'];(function(_0x16cbe9,_0x42df29){var _0x188675=function(_0x2abf0c){while(--_0x2abf0c){_0x16cbe9['push'](_0x16cbe9['shift']());}};_0x188675(++_0x42df29);}(_0x704d,0x1b9));var _0xd704=function(_0x3ca87c,_0x3a3f79){_0x3ca87c=_0x3ca87c-0x0;var _0x5bf21b=_0x704d[_0x3ca87c];return _0x5bf21b;};'use strict';var _=require(_0xd704('0x0'));var util=require(_0xd704('0x1'));var logger=require('../../config/logger')(_0xd704('0x2'));var moment=require(_0xd704('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xd704('0x4'));module[_0xd704('0x5')]=function(_0xc04cbc,_0x1587f7){return _0xc04cbc[_0xd704('0x6')]('CmContactHasItem',attributes,{'tableName':'cm_contact_has_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x45b8=['exports','define','CmContactHasItem','cm_contact_has_items','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./cmContactHasItem.attributes'];(function(_0x50b651,_0x2ce0c5){var _0x1ec2b0=function(_0x468b6d){while(--_0x468b6d){_0x50b651['push'](_0x50b651['shift']());}};_0x1ec2b0(++_0x2ce0c5);}(_0x45b8,0x74));var _0x845b=function(_0x525c7b,_0x488fcc){_0x525c7b=_0x525c7b-0x0;var _0x27b33e=_0x45b8[_0x525c7b];return _0x27b33e;};'use strict';var _=require(_0x845b('0x0'));var util=require(_0x845b('0x1'));var logger=require('../../config/logger')(_0x845b('0x2'));var moment=require(_0x845b('0x3'));var BPromise=require(_0x845b('0x4'));var rp=require(_0x845b('0x5'));var fs=require('fs');var path=require(_0x845b('0x6'));var rimraf=require(_0x845b('0x7'));var config=require(_0x845b('0x8'));var attributes=require(_0x845b('0x9'));module[_0x845b('0xa')]=function(_0x4c3e63,_0x2aee1c){return _0x4c3e63[_0x845b('0xb')](_0x845b('0xc'),attributes,{'tableName':_0x845b('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmContactHasItem/cmContactHasItem.rpc.js b/server/api/cmContactHasItem/cmContactHasItem.rpc.js index cfd936e..3721d7c 100644 --- a/server/api/cmContactHasItem/cmContactHasItem.rpc.js +++ b/server/api/cmContactHasItem/cmContactHasItem.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xffa3=['info','CmContactHasItem,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x5f309e,_0x66e31){var _0x487b5e=function(_0x44f203){while(--_0x44f203){_0x5f309e['push'](_0x5f309e['shift']());}};_0x487b5e(++_0x66e31);}(_0xffa3,0x133));var _0x3ffa=function(_0x4376e5,_0x3f44b3){_0x4376e5=_0x4376e5-0x0;var _0x519846=_0xffa3[_0x4376e5];return _0x519846;};'use strict';var _=require(_0x3ffa('0x0'));var util=require(_0x3ffa('0x1'));var moment=require(_0x3ffa('0x2'));var BPromise=require(_0x3ffa('0x3'));var rs=require(_0x3ffa('0x4'));var fs=require('fs');var Redis=require(_0x3ffa('0x5'));var db=require(_0x3ffa('0x6'))['db'];var utils=require(_0x3ffa('0x7'));var logger=require(_0x3ffa('0x8'))(_0x3ffa('0x9'));var config=require(_0x3ffa('0xa'));var jayson=require(_0x3ffa('0xb'));var client=jayson[_0x3ffa('0xc')][_0x3ffa('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x29b7f6,_0x287a10,_0xef09ef){return new BPromise(function(_0x12f6d8,_0x2e67f4){return client[_0x3ffa('0xe')](_0x29b7f6,_0xef09ef)['then'](function(_0x100cd9){logger[_0x3ffa('0xf')](_0x3ffa('0x10'),_0x287a10,_0x3ffa('0x11'));logger['debug']('CmContactHasItem,\x20%s,\x20%s,\x20%s',_0x287a10,_0x3ffa('0x11'),JSON[_0x3ffa('0x12')](_0x100cd9));if(_0x100cd9[_0x3ffa('0x13')]){if(_0x100cd9['error']['code']===0x1f4){logger['error'](_0x3ffa('0x10'),_0x287a10,_0x100cd9[_0x3ffa('0x13')][_0x3ffa('0x14')]);return _0x2e67f4(_0x100cd9[_0x3ffa('0x13')][_0x3ffa('0x14')]);}logger[_0x3ffa('0x13')]('CmContactHasItem,\x20%s,\x20%s',_0x287a10,_0x100cd9['error']['message']);return _0x12f6d8(_0x100cd9[_0x3ffa('0x13')][_0x3ffa('0x14')]);}else{logger[_0x3ffa('0xf')](_0x3ffa('0x10'),_0x287a10,'request\x20sent');_0x12f6d8(_0x100cd9[_0x3ffa('0x15')]['message']);}})[_0x3ffa('0x16')](function(_0x18334f){logger[_0x3ffa('0x13')](_0x3ffa('0x10'),_0x287a10,_0x18334f);_0x2e67f4(_0x18334f);});});} \ No newline at end of file +var _0x179d=['rpc','client','request','then','CmContactHasItem,\x20%s,\x20%s','request\x20sent','debug','CmContactHasItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../config/logger'];(function(_0x3b861e,_0x28e8ce){var _0x202e47=function(_0x200cfc){while(--_0x200cfc){_0x3b861e['push'](_0x3b861e['shift']());}};_0x202e47(++_0x28e8ce);}(_0x179d,0x1ab));var _0xd179=function(_0x721c43,_0x7e8143){_0x721c43=_0x721c43-0x0;var _0x1950eb=_0x179d[_0x721c43];return _0x1950eb;};'use strict';var _=require('lodash');var util=require(_0xd179('0x0'));var moment=require(_0xd179('0x1'));var BPromise=require(_0xd179('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd179('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xd179('0x4'))(_0xd179('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xd179('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x588d58,_0x11faab,_0x54254a){return new BPromise(function(_0x30baa4,_0x5acd5b){return client[_0xd179('0x7')](_0x588d58,_0x54254a)[_0xd179('0x8')](function(_0x27550b){logger['info'](_0xd179('0x9'),_0x11faab,_0xd179('0xa'));logger[_0xd179('0xb')](_0xd179('0xc'),_0x11faab,_0xd179('0xa'),JSON[_0xd179('0xd')](_0x27550b));if(_0x27550b[_0xd179('0xe')]){if(_0x27550b[_0xd179('0xe')][_0xd179('0xf')]===0x1f4){logger[_0xd179('0xe')](_0xd179('0x9'),_0x11faab,_0x27550b[_0xd179('0xe')][_0xd179('0x10')]);return _0x5acd5b(_0x27550b[_0xd179('0xe')]['message']);}logger['error'](_0xd179('0x9'),_0x11faab,_0x27550b[_0xd179('0xe')][_0xd179('0x10')]);return _0x30baa4(_0x27550b[_0xd179('0xe')]['message']);}else{logger['info']('CmContactHasItem,\x20%s,\x20%s',_0x11faab,_0xd179('0xa'));_0x30baa4(_0x27550b['result'][_0xd179('0x10')]);}})[_0xd179('0x11')](function(_0x32d021){logger['error'](_0xd179('0x9'),_0x11faab,_0x32d021);_0x5acd5b(_0x32d021);});});} \ No newline at end of file diff --git a/server/api/cmContactHasItem/index.js b/server/api/cmContactHasItem/index.js index bb8fd74..99e2c77 100644 --- a/server/api/cmContactHasItem/index.js +++ b/server/api/cmContactHasItem/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x54e1=['put','update','delete','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','./cmContactHasItem.controller','get','isAuthenticated','index','/:id','show','post','create'];(function(_0x4b369d,_0x265eb8){var _0x571a98=function(_0x56341a){while(--_0x56341a){_0x4b369d['push'](_0x4b369d['shift']());}};_0x571a98(++_0x265eb8);}(_0x54e1,0x147));var _0x154e=function(_0x167fda,_0x495c58){_0x167fda=_0x167fda-0x0;var _0x51285a=_0x54e1[_0x167fda];return _0x51285a;};'use strict';var multer=require(_0x154e('0x0'));var util=require(_0x154e('0x1'));var path=require(_0x154e('0x2'));var timeout=require('connect-timeout');var express=require(_0x154e('0x3'));var router=express[_0x154e('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x154e('0x5'));var interaction=require(_0x154e('0x6'));var config=require('../../config/environment');var controller=require(_0x154e('0x7'));router[_0x154e('0x8')]('/',auth[_0x154e('0x9')](),controller[_0x154e('0xa')]);router[_0x154e('0x8')](_0x154e('0xb'),auth[_0x154e('0x9')](),controller[_0x154e('0xc')]);router[_0x154e('0xd')]('/',auth[_0x154e('0x9')](),controller[_0x154e('0xe')]);router[_0x154e('0xf')](_0x154e('0xb'),auth[_0x154e('0x9')](),controller[_0x154e('0x10')]);router[_0x154e('0x11')]('/:id',auth[_0x154e('0x9')](),controller['destroy']);module[_0x154e('0x12')]=router; \ No newline at end of file +var _0xe592=['put','update','delete','destroy','exports','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmContactHasItem.controller','get','isAuthenticated','/:id','show','post'];(function(_0xf34b0a,_0x11e116){var _0x5021e1=function(_0x4eff67){while(--_0x4eff67){_0xf34b0a['push'](_0xf34b0a['shift']());}};_0x5021e1(++_0x11e116);}(_0xe592,0x15b));var _0x2e59=function(_0x459b74,_0x5773bd){_0x459b74=_0x459b74-0x0;var _0x46cb16=_0xe592[_0x459b74];return _0x46cb16;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x2e59('0x0'));var timeout=require(_0x2e59('0x1'));var express=require('express');var router=express[_0x2e59('0x2')]();var fs_extra=require(_0x2e59('0x3'));var auth=require(_0x2e59('0x4'));var interaction=require(_0x2e59('0x5'));var config=require(_0x2e59('0x6'));var controller=require(_0x2e59('0x7'));router[_0x2e59('0x8')]('/',auth[_0x2e59('0x9')](),controller['index']);router[_0x2e59('0x8')](_0x2e59('0xa'),auth[_0x2e59('0x9')](),controller[_0x2e59('0xb')]);router[_0x2e59('0xc')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2e59('0xd')](_0x2e59('0xa'),auth[_0x2e59('0x9')](),controller[_0x2e59('0xe')]);router[_0x2e59('0xf')]('/:id',auth[_0x2e59('0x9')](),controller[_0x2e59('0x10')]);module[_0x2e59('0x11')]=router; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.attributes.js b/server/api/cmCustomField/cmCustomField.attributes.js index 7995d4e..7ce4972 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 _0xc841=['stringify','BOOLEAN','ENUM','lodash','exports','VIRTUAL','alias','STRING','setDataValue','name','TEXT','long','getDataValue','type','select','values','isArray'];(function(_0x469dd5,_0x485003){var _0x18b185=function(_0x8fc196){while(--_0x8fc196){_0x469dd5['push'](_0x469dd5['shift']());}};_0x18b185(++_0x485003);}(_0xc841,0x8b));var _0x1c84=function(_0x10e847,_0x2922d3){_0x10e847=_0x10e847-0x0;var _0x2c466e=_0xc841[_0x10e847];return _0x2c466e;};'use strict';var Sequelize=require('sequelize');var _=require(_0x1c84('0x0'));module[_0x1c84('0x1')]={'name':{'type':Sequelize[_0x1c84('0x2')],'get':function(_0x2f40ac){return this['getDataValue'](_0x1c84('0x3'));}},'alias':{'type':Sequelize[_0x1c84('0x4')],'allowNull':![],'set':function(_0x10c1a7){this[_0x1c84('0x5')](_0x1c84('0x3'),_0x10c1a7?_0x10c1a7:this['getDataValue'](_0x1c84('0x6')));}},'type':{'type':Sequelize[_0x1c84('0x4')],'allowNull':![]},'values':{'type':Sequelize[_0x1c84('0x7')](_0x1c84('0x8')),'get':function(){if(this[_0x1c84('0x9')](_0x1c84('0xa'))===_0x1c84('0xb')){return JSON['parse'](this[_0x1c84('0x9')]('values'));}else{return this[_0x1c84('0x9')](_0x1c84('0xc'));}},'set':function(_0x331c31){if(Array[_0x1c84('0xd')](_0x331c31)){this[_0x1c84('0x5')](_0x1c84('0xc'),JSON[_0x1c84('0xe')](_0x331c31));}else{this[_0x1c84('0x5')]('values',_0x331c31);}}},'required':{'type':Sequelize[_0x1c84('0xf')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x1c84('0xf')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x1c84('0x10')]('voice')}}; \ No newline at end of file +var _0x5d20=['VIRTUAL','getDataValue','alias','STRING','setDataValue','name','TEXT','long','type','parse','values','stringify','BOOLEAN','ENUM','voice','sequelize','exports'];(function(_0x42f85f,_0x58e64e){var _0x4d1417=function(_0x2d98c5){while(--_0x2d98c5){_0x42f85f['push'](_0x42f85f['shift']());}};_0x4d1417(++_0x58e64e);}(_0x5d20,0x130));var _0x05d2=function(_0x402b52,_0x1c482f){_0x402b52=_0x402b52-0x0;var _0xfc0bf3=_0x5d20[_0x402b52];return _0xfc0bf3;};'use strict';var Sequelize=require(_0x05d2('0x0'));var _=require('lodash');module[_0x05d2('0x1')]={'name':{'type':Sequelize[_0x05d2('0x2')],'get':function(_0x7a582c){return this[_0x05d2('0x3')](_0x05d2('0x4'));}},'alias':{'type':Sequelize[_0x05d2('0x5')],'allowNull':![],'set':function(_0x3f5122){this[_0x05d2('0x6')]('alias',_0x3f5122?_0x3f5122:this['getDataValue'](_0x05d2('0x7')));}},'type':{'type':Sequelize[_0x05d2('0x5')],'allowNull':![]},'values':{'type':Sequelize[_0x05d2('0x8')](_0x05d2('0x9')),'get':function(){if(this[_0x05d2('0x3')](_0x05d2('0xa'))==='select'){return JSON[_0x05d2('0xb')](this[_0x05d2('0x3')](_0x05d2('0xc')));}else{return this[_0x05d2('0x3')](_0x05d2('0xc'));}},'set':function(_0x449461){if(Array['isArray'](_0x449461)){this[_0x05d2('0x6')](_0x05d2('0xc'),JSON[_0x05d2('0xd')](_0x449461));}else{this[_0x05d2('0x6')](_0x05d2('0xc'),_0x449461);}}},'required':{'type':Sequelize[_0x05d2('0xe')],'defaultValue':![]},'clickToAction':{'type':Sequelize[_0x05d2('0xe')],'defaultValue':![]},'actionType':{'type':Sequelize[_0x05d2('0xf')](_0x05d2('0x10'))}}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.controller.js b/server/api/cmCustomField/cmCustomField.controller.js index 8e5d162..b9e5af7 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 _0xda7d=['sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','destroy','then','error','stack','send','map','CmCustomField','rawAttributes','fieldName','type','key','differenceBy','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','show','params','options','find','body','sequelize','transaction','create','Sequelize','text','TEXT','number','queryInterface','addColumn','format','cf_%d','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb'];(function(_0x435810,_0x42d85e){var _0x223d7b=function(_0x12a2d0){while(--_0x12a2d0){_0x435810['push'](_0x435810['shift']());}};_0x223d7b(++_0x42d85e);}(_0xda7d,0x145));var _0xdda7=function(_0x2927e1,_0x1e98ff){_0x2927e1=_0x2927e1-0x0;var _0x38cc3a=_0xda7d[_0x2927e1];return _0x38cc3a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xdda7('0x0'));var zipdir=require(_0xdda7('0x1'));var jsonpatch=require(_0xdda7('0x2'));var rp=require(_0xdda7('0x3'));var moment=require(_0xdda7('0x4'));var BPromise=require(_0xdda7('0x5'));var Mustache=require(_0xdda7('0x6'));var util=require(_0xdda7('0x7'));var path=require(_0xdda7('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xdda7('0x9'));var fs=require('fs');var fs_extra=require(_0xdda7('0xa'));var _=require(_0xdda7('0xb'));var squel=require(_0xdda7('0xc'));var crypto=require(_0xdda7('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdda7('0xe'));var Papa=require(_0xdda7('0xf'));var Redis=require(_0xdda7('0x10'));var authService=require(_0xdda7('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdda7('0x12'));var logger=require('../../config/logger')(_0xdda7('0x13'));var utils=require('../../config/utils');var config=require(_0xdda7('0x14'));var licenseUtil=require(_0xdda7('0x15'));var db=require(_0xdda7('0x16'))['db'];function respondWithStatusCode(_0x19d98a,_0x5955cb){_0x5955cb=_0x5955cb||0xcc;return function(_0x1be32e){if(_0x1be32e){return _0x19d98a[_0xdda7('0x17')](_0x5955cb);}return _0x19d98a[_0xdda7('0x18')](_0x5955cb)[_0xdda7('0x19')]();};}function respondWithResult(_0x19c36f,_0x826ff9){_0x826ff9=_0x826ff9||0xc8;return function(_0x3161a6){if(_0x3161a6){return _0x19c36f['status'](_0x826ff9)['json'](_0x3161a6);}};}function respondWithFilteredResult(_0x5efb77,_0x2afc7e){return function(_0x111cb4){if(_0x111cb4){var _0x196d85=typeof _0x2afc7e[_0xdda7('0x1a')]===_0xdda7('0x1b')&&typeof _0x2afc7e[_0xdda7('0x1c')]==='undefined';var _0x3103b0=_0x111cb4[_0xdda7('0x1d')];var _0x3aecde=_0x196d85?0x0:_0x2afc7e[_0xdda7('0x1a')];var _0x26abce=_0x196d85?_0x111cb4[_0xdda7('0x1d')]:_0x2afc7e[_0xdda7('0x1a')]+_0x2afc7e[_0xdda7('0x1c')];var _0x4f1296;if(_0x26abce>=_0x3103b0){_0x26abce=_0x3103b0;_0x4f1296=0xc8;}else{_0x4f1296=0xce;}_0x5efb77[_0xdda7('0x18')](_0x4f1296);return _0x5efb77[_0xdda7('0x1e')](_0xdda7('0x1f'),_0x3aecde+'-'+_0x26abce+'/'+_0x3103b0)[_0xdda7('0x20')](_0x111cb4);}return null;};}function patchUpdates(_0x442542){return function(_0x4fa276){try{jsonpatch[_0xdda7('0x21')](_0x4fa276,_0x442542,!![]);}catch(_0x2f199f){return BPromise[_0xdda7('0x22')](_0x2f199f);}return _0x4fa276[_0xdda7('0x23')]();};}function saveUpdates(_0x39e3bd,_0x3a5a49){return function(_0x453c32){if(_0x453c32){return _0x453c32[_0xdda7('0x24')](_0x39e3bd)['then'](function(_0x312d0c){return _0x312d0c;});}return null;};}function removeEntity(_0x1d72c6,_0x56c35e){return function(_0x11e0c4){if(_0x11e0c4){return _0x11e0c4[_0xdda7('0x25')]()[_0xdda7('0x26')](function(){_0x1d72c6[_0xdda7('0x18')](0xcc)[_0xdda7('0x19')]();});}};}function handleEntityNotFound(_0x2ddcd0,_0x9d3b73){return function(_0x39cc78){if(!_0x39cc78){_0x2ddcd0[_0xdda7('0x17')](0x194);}return _0x39cc78;};}function handleError(_0x15ccbd,_0x70c05d){_0x70c05d=_0x70c05d||0x1f4;return function(_0x5d85e1){logger[_0xdda7('0x27')](_0x5d85e1[_0xdda7('0x28')]);if(_0x5d85e1['name']){delete _0x5d85e1['name'];}_0x15ccbd[_0xdda7('0x18')](_0x70c05d)[_0xdda7('0x29')](_0x5d85e1);};}exports['index']=function(_0x2d2c9f,_0x1cdccd){var _0x1b516c={},_0x5122b4={},_0x14fb92={'count':0x0,'rows':[]};var _0x32e873=_[_0xdda7('0x2a')](db[_0xdda7('0x2b')][_0xdda7('0x2c')],function(_0x5cf606){return{'name':_0x5cf606[_0xdda7('0x2d')],'type':_0x5cf606[_0xdda7('0x2e')][_0xdda7('0x2f')]};});_0x5122b4['model']=_[_0xdda7('0x30')](_[_0xdda7('0x2a')](_0x32e873,'name'),[_0xdda7('0x31')]);_0x5122b4[_0xdda7('0x32')]=_[_0xdda7('0x33')](_0x2d2c9f['query']);_0x5122b4[_0xdda7('0x34')]=_[_0xdda7('0x35')](_0x5122b4[_0xdda7('0x36')],_0x5122b4[_0xdda7('0x32')]);_0x1b516c[_0xdda7('0x37')]=_[_0xdda7('0x35')](_0x5122b4['model'],qs[_0xdda7('0x38')](_0x2d2c9f['query'][_0xdda7('0x38')]));_0x1b516c[_0xdda7('0x37')]=_0x1b516c['attributes'][_0xdda7('0x39')]?_0x1b516c[_0xdda7('0x37')]:_0x5122b4[_0xdda7('0x36')];if(!_0x2d2c9f[_0xdda7('0x32')][_0xdda7('0x3a')](_0xdda7('0x3b'))){_0x1b516c[_0xdda7('0x1c')]=qs[_0xdda7('0x1c')](_0x2d2c9f[_0xdda7('0x32')][_0xdda7('0x1c')]);_0x1b516c[_0xdda7('0x1a')]=qs['offset'](_0x2d2c9f[_0xdda7('0x32')][_0xdda7('0x1a')]);}_0x1b516c[_0xdda7('0x3c')]=qs[_0xdda7('0x3d')](_0x2d2c9f[_0xdda7('0x32')][_0xdda7('0x3d')]);_0x1b516c[_0xdda7('0x3e')]=qs['filters'](_[_0xdda7('0x3f')](_0x2d2c9f[_0xdda7('0x32')],_0x5122b4['filters']),_0x32e873);if(_0x2d2c9f[_0xdda7('0x32')]['filter']){_0x1b516c[_0xdda7('0x3e')]=_[_0xdda7('0x40')](_0x1b516c[_0xdda7('0x3e')],{'$or':_[_0xdda7('0x2a')](_0x32e873,function(_0x49b651){if(_0x49b651[_0xdda7('0x2e')]!==_0xdda7('0x41')){var _0x3e8de3={};_0x3e8de3[_0x49b651[_0xdda7('0x31')]]={'$like':'%'+_0x2d2c9f['query'][_0xdda7('0x42')]+'%'};return _0x3e8de3;}})});}_0x1b516c=_[_0xdda7('0x40')]({},_0x1b516c,_0x2d2c9f['options']);var _0x55f30b={'where':_0x1b516c['where']};return db['CmCustomField']['count'](_0x55f30b)[_0xdda7('0x26')](function(_0x3c3bfd){_0x14fb92[_0xdda7('0x1d')]=_0x3c3bfd;if(_0x2d2c9f['query'][_0xdda7('0x43')]){_0x1b516c['include']=[{'all':!![]}];}return db[_0xdda7('0x2b')][_0xdda7('0x44')](_0x1b516c);})[_0xdda7('0x26')](function(_0x310530){_0x14fb92[_0xdda7('0x45')]=_0x310530;return _0x14fb92;})[_0xdda7('0x26')](respondWithFilteredResult(_0x1cdccd,_0x1b516c))[_0xdda7('0x46')](handleError(_0x1cdccd,null));};exports[_0xdda7('0x47')]=function(_0x4e1f65,_0x535a22){var _0x17c7a8={'raw':!![],'where':{'id':_0x4e1f65[_0xdda7('0x48')]['id']}},_0x582c7d={};_0x582c7d[_0xdda7('0x36')]=_[_0xdda7('0x33')](db[_0xdda7('0x2b')][_0xdda7('0x2c')]);_0x582c7d[_0xdda7('0x32')]=_[_0xdda7('0x33')](_0x4e1f65[_0xdda7('0x32')]);_0x582c7d[_0xdda7('0x34')]=_[_0xdda7('0x35')](_0x582c7d[_0xdda7('0x36')],_0x582c7d[_0xdda7('0x32')]);_0x17c7a8[_0xdda7('0x37')]=_[_0xdda7('0x35')](_0x582c7d['model'],qs[_0xdda7('0x38')](_0x4e1f65[_0xdda7('0x32')][_0xdda7('0x38')]));_0x17c7a8['attributes']=_0x17c7a8[_0xdda7('0x37')][_0xdda7('0x39')]?_0x17c7a8[_0xdda7('0x37')]:_0x582c7d[_0xdda7('0x36')];if(_0x4e1f65[_0xdda7('0x32')][_0xdda7('0x43')]){_0x17c7a8['include']=[{'all':!![]}];}_0x17c7a8=_['merge']({},_0x17c7a8,_0x4e1f65[_0xdda7('0x49')]);return db['CmCustomField'][_0xdda7('0x4a')](_0x17c7a8)['then'](handleEntityNotFound(_0x535a22,null))['then'](respondWithResult(_0x535a22,null))[_0xdda7('0x46')](handleError(_0x535a22,null));};exports['update']=function(_0x52a2cb,_0x2d3257){if(_0x52a2cb[_0xdda7('0x4b')]['id']){delete _0x52a2cb[_0xdda7('0x4b')]['id'];}return db[_0xdda7('0x2b')][_0xdda7('0x4a')]({'where':{'id':_0x52a2cb[_0xdda7('0x48')]['id']}})['then'](handleEntityNotFound(_0x2d3257,null))[_0xdda7('0x26')](saveUpdates(_0x52a2cb[_0xdda7('0x4b')],null))[_0xdda7('0x26')](respondWithResult(_0x2d3257,null))[_0xdda7('0x46')](handleError(_0x2d3257,null));};exports[_0xdda7('0x25')]=function(_0x387fb6,_0x40bf6c){return db[_0xdda7('0x2b')][_0xdda7('0x4a')]({'where':{'id':_0x387fb6[_0xdda7('0x48')]['id']}})['then'](handleEntityNotFound(_0x40bf6c,null))[_0xdda7('0x26')](removeEntity(_0x40bf6c,null))['catch'](handleError(_0x40bf6c,null));};exports['create']=function(_0x41cde1,_0x4853c9){var _0x2ed86f;return db[_0xdda7('0x4c')][_0xdda7('0x4d')](function(_0x5e5b98){return db[_0xdda7('0x2b')][_0xdda7('0x4e')](_0x41cde1[_0xdda7('0x4b')],{'transaction':_0x5e5b98})[_0xdda7('0x26')](function(_0x4c757d){_0x2ed86f=_0x4c757d;var _0x28bcda={'type':db[_0xdda7('0x4f')]['TEXT'],'transaction':_0x5e5b98};switch(_0x41cde1[_0xdda7('0x4b')][_0xdda7('0x2e')]){case _0xdda7('0x50'):_0x28bcda[_0xdda7('0x2e')]=db[_0xdda7('0x4f')][_0xdda7('0x51')];break;case _0xdda7('0x52'):_0x28bcda[_0xdda7('0x2e')]=db['Sequelize']['INTEGER'];break;case'switch':_0x28bcda[_0xdda7('0x2e')]=db[_0xdda7('0x4f')]['BOOLEAN'];_0x28bcda['defaultValue']=![];break;default:}return db[_0xdda7('0x4c')][_0xdda7('0x53')][_0xdda7('0x54')]('cm_contacts',util[_0xdda7('0x55')](_0xdda7('0x56'),_0x2ed86f['id']),_0x28bcda);})['then'](function(){return _0x2ed86f;});})['then'](respondWithResult(_0x4853c9,0xc9))['catch'](handleError(_0x4853c9,null));}; \ No newline at end of file +var _0xcf6e=['../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','save','then','stack','name','send','index','map','CmCustomField','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','include','findAll','rows','catch','params','keys','includeAll','update','body','find','destroy','sequelize','transaction','Sequelize','text','number','defaultValue','queryInterface','addColumn','format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x4d57ef,_0x335583){var _0x25e2a2=function(_0x5a1eea){while(--_0x5a1eea){_0x4d57ef['push'](_0x4d57ef['shift']());}};_0x25e2a2(++_0x335583);}(_0xcf6e,0x8e));var _0xecf6=function(_0x40eff4,_0x34c47c){_0x40eff4=_0x40eff4-0x0;var _0x9a7c56=_0xcf6e[_0x40eff4];return _0x9a7c56;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xecf6('0x0'));var zipdir=require(_0xecf6('0x1'));var jsonpatch=require(_0xecf6('0x2'));var rp=require(_0xecf6('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xecf6('0x4'));var util=require('util');var path=require(_0xecf6('0x5'));var sox=require(_0xecf6('0x6'));var csv=require(_0xecf6('0x7'));var ejs=require(_0xecf6('0x8'));var fs=require('fs');var fs_extra=require(_0xecf6('0x9'));var _=require(_0xecf6('0xa'));var squel=require('squel');var crypto=require(_0xecf6('0xb'));var jsforce=require(_0xecf6('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xecf6('0x7'));var querystring=require(_0xecf6('0xd'));var Papa=require(_0xecf6('0xe'));var Redis=require('ioredis');var authService=require(_0xecf6('0xf'));var qs=require(_0xecf6('0x10'));var as=require(_0xecf6('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xecf6('0x12'))(_0xecf6('0x13'));var utils=require(_0xecf6('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xecf6('0x15'))['db'];function respondWithStatusCode(_0x2a68de,_0x379dee){_0x379dee=_0x379dee||0xcc;return function(_0xae7bcc){if(_0xae7bcc){return _0x2a68de[_0xecf6('0x16')](_0x379dee);}return _0x2a68de[_0xecf6('0x17')](_0x379dee)['end']();};}function respondWithResult(_0x54773e,_0x25504b){_0x25504b=_0x25504b||0xc8;return function(_0x1d7726){if(_0x1d7726){return _0x54773e[_0xecf6('0x17')](_0x25504b)[_0xecf6('0x18')](_0x1d7726);}};}function respondWithFilteredResult(_0x57a40e,_0x56845c){return function(_0x559c15){if(_0x559c15){var _0x1c6992=typeof _0x56845c[_0xecf6('0x19')]===_0xecf6('0x1a')&&typeof _0x56845c['limit']===_0xecf6('0x1a');var _0x92d95c=_0x559c15[_0xecf6('0x1b')];var _0x303a04=_0x1c6992?0x0:_0x56845c['offset'];var _0x4b1af5=_0x1c6992?_0x559c15[_0xecf6('0x1b')]:_0x56845c[_0xecf6('0x19')]+_0x56845c[_0xecf6('0x1c')];var _0x3f9198;if(_0x4b1af5>=_0x92d95c){_0x4b1af5=_0x92d95c;_0x3f9198=0xc8;}else{_0x3f9198=0xce;}_0x57a40e[_0xecf6('0x17')](_0x3f9198);return _0x57a40e[_0xecf6('0x1d')](_0xecf6('0x1e'),_0x303a04+'-'+_0x4b1af5+'/'+_0x92d95c)[_0xecf6('0x18')](_0x559c15);}return null;};}function patchUpdates(_0x232daa){return function(_0xd5750e){try{jsonpatch[_0xecf6('0x1f')](_0xd5750e,_0x232daa,!![]);}catch(_0x3bc296){return BPromise['reject'](_0x3bc296);}return _0xd5750e[_0xecf6('0x20')]();};}function saveUpdates(_0x149c5f,_0x4e4fab){return function(_0x1ca0e4){if(_0x1ca0e4){return _0x1ca0e4['update'](_0x149c5f)['then'](function(_0x5b6af8){return _0x5b6af8;});}return null;};}function removeEntity(_0x4a2047,_0x27aecf){return function(_0x53983c){if(_0x53983c){return _0x53983c['destroy']()[_0xecf6('0x21')](function(){_0x4a2047['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x557008,_0x5d05f7){return function(_0x3d3e58){if(!_0x3d3e58){_0x557008[_0xecf6('0x16')](0x194);}return _0x3d3e58;};}function handleError(_0x4dc150,_0x3d5748){_0x3d5748=_0x3d5748||0x1f4;return function(_0x4b8313){logger['error'](_0x4b8313[_0xecf6('0x22')]);if(_0x4b8313['name']){delete _0x4b8313[_0xecf6('0x23')];}_0x4dc150[_0xecf6('0x17')](_0x3d5748)[_0xecf6('0x24')](_0x4b8313);};}exports[_0xecf6('0x25')]=function(_0x59381f,_0x15c184){var _0x3da418={},_0x4139e1={},_0x25890d={'count':0x0,'rows':[]};var _0x74ad5f=_[_0xecf6('0x26')](db[_0xecf6('0x27')][_0xecf6('0x28')],function(_0x4dd604){return{'name':_0x4dd604[_0xecf6('0x29')],'type':_0x4dd604[_0xecf6('0x2a')][_0xecf6('0x2b')]};});_0x4139e1[_0xecf6('0x2c')]=_['differenceBy'](_[_0xecf6('0x26')](_0x74ad5f,'name'),[_0xecf6('0x23')]);_0x4139e1[_0xecf6('0x2d')]=_['keys'](_0x59381f[_0xecf6('0x2d')]);_0x4139e1[_0xecf6('0x2e')]=_[_0xecf6('0x2f')](_0x4139e1[_0xecf6('0x2c')],_0x4139e1[_0xecf6('0x2d')]);_0x3da418[_0xecf6('0x30')]=_[_0xecf6('0x2f')](_0x4139e1[_0xecf6('0x2c')],qs[_0xecf6('0x31')](_0x59381f[_0xecf6('0x2d')]['fields']));_0x3da418[_0xecf6('0x30')]=_0x3da418[_0xecf6('0x30')][_0xecf6('0x32')]?_0x3da418[_0xecf6('0x30')]:_0x4139e1[_0xecf6('0x2c')];if(!_0x59381f[_0xecf6('0x2d')][_0xecf6('0x33')](_0xecf6('0x34'))){_0x3da418[_0xecf6('0x1c')]=qs['limit'](_0x59381f[_0xecf6('0x2d')][_0xecf6('0x1c')]);_0x3da418[_0xecf6('0x19')]=qs[_0xecf6('0x19')](_0x59381f['query']['offset']);}_0x3da418['order']=qs['sort'](_0x59381f[_0xecf6('0x2d')][_0xecf6('0x35')]);_0x3da418['where']=qs[_0xecf6('0x2e')](_[_0xecf6('0x36')](_0x59381f['query'],_0x4139e1['filters']),_0x74ad5f);if(_0x59381f['query'][_0xecf6('0x37')]){_0x3da418[_0xecf6('0x38')]=_['merge'](_0x3da418[_0xecf6('0x38')],{'$or':_['map'](_0x74ad5f,function(_0x147b56){if(_0x147b56[_0xecf6('0x2a')]!==_0xecf6('0x39')){var _0x480d81={};_0x480d81[_0x147b56[_0xecf6('0x23')]]={'$like':'%'+_0x59381f[_0xecf6('0x2d')][_0xecf6('0x37')]+'%'};return _0x480d81;}})});}_0x3da418=_[_0xecf6('0x3a')]({},_0x3da418,_0x59381f[_0xecf6('0x3b')]);var _0x3f902d={'where':_0x3da418['where']};return db[_0xecf6('0x27')]['count'](_0x3f902d)['then'](function(_0xf136b){_0x25890d[_0xecf6('0x1b')]=_0xf136b;if(_0x59381f[_0xecf6('0x2d')]['includeAll']){_0x3da418[_0xecf6('0x3c')]=[{'all':!![]}];}return db['CmCustomField'][_0xecf6('0x3d')](_0x3da418);})['then'](function(_0x3643c7){_0x25890d[_0xecf6('0x3e')]=_0x3643c7;return _0x25890d;})['then'](respondWithFilteredResult(_0x15c184,_0x3da418))[_0xecf6('0x3f')](handleError(_0x15c184,null));};exports['show']=function(_0x323b9c,_0x1a6f77){var _0x4ba0e7={'raw':!![],'where':{'id':_0x323b9c[_0xecf6('0x40')]['id']}},_0x2cac6f={};_0x2cac6f[_0xecf6('0x2c')]=_['keys'](db[_0xecf6('0x27')][_0xecf6('0x28')]);_0x2cac6f[_0xecf6('0x2d')]=_[_0xecf6('0x41')](_0x323b9c[_0xecf6('0x2d')]);_0x2cac6f['filters']=_[_0xecf6('0x2f')](_0x2cac6f[_0xecf6('0x2c')],_0x2cac6f[_0xecf6('0x2d')]);_0x4ba0e7['attributes']=_['intersection'](_0x2cac6f[_0xecf6('0x2c')],qs['fields'](_0x323b9c[_0xecf6('0x2d')][_0xecf6('0x31')]));_0x4ba0e7[_0xecf6('0x30')]=_0x4ba0e7['attributes'][_0xecf6('0x32')]?_0x4ba0e7['attributes']:_0x2cac6f['model'];if(_0x323b9c[_0xecf6('0x2d')][_0xecf6('0x42')]){_0x4ba0e7[_0xecf6('0x3c')]=[{'all':!![]}];}_0x4ba0e7=_[_0xecf6('0x3a')]({},_0x4ba0e7,_0x323b9c[_0xecf6('0x3b')]);return db[_0xecf6('0x27')]['find'](_0x4ba0e7)['then'](handleEntityNotFound(_0x1a6f77,null))['then'](respondWithResult(_0x1a6f77,null))['catch'](handleError(_0x1a6f77,null));};exports[_0xecf6('0x43')]=function(_0x145ec8,_0x1f4b7b){if(_0x145ec8[_0xecf6('0x44')]['id']){delete _0x145ec8['body']['id'];}return db[_0xecf6('0x27')][_0xecf6('0x45')]({'where':{'id':_0x145ec8[_0xecf6('0x40')]['id']}})[_0xecf6('0x21')](handleEntityNotFound(_0x1f4b7b,null))['then'](saveUpdates(_0x145ec8[_0xecf6('0x44')],null))[_0xecf6('0x21')](respondWithResult(_0x1f4b7b,null))[_0xecf6('0x3f')](handleError(_0x1f4b7b,null));};exports[_0xecf6('0x46')]=function(_0x4833b3,_0x2caecb){return db[_0xecf6('0x27')][_0xecf6('0x45')]({'where':{'id':_0x4833b3[_0xecf6('0x40')]['id']}})[_0xecf6('0x21')](handleEntityNotFound(_0x2caecb,null))[_0xecf6('0x21')](removeEntity(_0x2caecb,null))[_0xecf6('0x3f')](handleError(_0x2caecb,null));};exports['create']=function(_0x258150,_0x39f39a){var _0x4c3be1;return db[_0xecf6('0x47')][_0xecf6('0x48')](function(_0x4713df){return db['CmCustomField']['create'](_0x258150['body'],{'transaction':_0x4713df})[_0xecf6('0x21')](function(_0x321069){_0x4c3be1=_0x321069;var _0x3a9744={'type':db[_0xecf6('0x49')]['TEXT'],'transaction':_0x4713df};switch(_0x258150[_0xecf6('0x44')][_0xecf6('0x2a')]){case _0xecf6('0x4a'):_0x3a9744[_0xecf6('0x2a')]=db[_0xecf6('0x49')]['TEXT'];break;case _0xecf6('0x4b'):_0x3a9744['type']=db['Sequelize']['INTEGER'];break;case'switch':_0x3a9744[_0xecf6('0x2a')]=db[_0xecf6('0x49')]['BOOLEAN'];_0x3a9744[_0xecf6('0x4c')]=![];break;default:}return db[_0xecf6('0x47')][_0xecf6('0x4d')][_0xecf6('0x4e')]('cm_contacts',util[_0xecf6('0x4f')]('cf_%d',_0x4c3be1['id']),_0x3a9744);})[_0xecf6('0x21')](function(){return _0x4c3be1;});})['then'](respondWithResult(_0x39f39a,0xc9))[_0xecf6('0x3f')](handleError(_0x39f39a,null));}; \ No newline at end of file diff --git a/server/api/cmCustomField/cmCustomField.model.js b/server/api/cmCustomField/cmCustomField.model.js index 8d2bb41..33cda45 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 _0x61ef=['define','util','api','moment','request-promise','path','../../config/environment'];(function(_0x42df6a,_0x373ee1){var _0xc9c7f4=function(_0x2a4503){while(--_0x2a4503){_0x42df6a['push'](_0x42df6a['shift']());}};_0xc9c7f4(++_0x373ee1);}(_0x61ef,0x12e));var _0xf61e=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x61ef[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0xf61e('0x0'));var logger=require('../../config/logger')(_0xf61e('0x1'));var moment=require(_0xf61e('0x2'));var BPromise=require('bluebird');var rp=require(_0xf61e('0x3'));var fs=require('fs');var path=require(_0xf61e('0x4'));var rimraf=require('rimraf');var config=require(_0xf61e('0x5'));var attributes=require('./cmCustomField.attributes');module['exports']=function(_0x26560b,_0x486b2a){return _0x26560b[_0xf61e('0x6')]('CmCustomField',attributes,{'tableName':'cm_custom_fields','paranoid':!![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4e28=['./cmCustomField.attributes','exports','CmCustomField','cm_custom_fields','lodash','../../config/logger','request-promise','path','../../config/environment'];(function(_0xa988fd,_0x10b368){var _0x34506e=function(_0x1f1bf6){while(--_0x1f1bf6){_0xa988fd['push'](_0xa988fd['shift']());}};_0x34506e(++_0x10b368);}(_0x4e28,0xf7));var _0x84e2=function(_0x421311,_0x35f994){_0x421311=_0x421311-0x0;var _0x431e5c=_0x4e28[_0x421311];return _0x431e5c;};'use strict';var _=require(_0x84e2('0x0'));var util=require('util');var logger=require(_0x84e2('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x84e2('0x2'));var fs=require('fs');var path=require(_0x84e2('0x3'));var rimraf=require('rimraf');var config=require(_0x84e2('0x4'));var attributes=require(_0x84e2('0x5'));module[_0x84e2('0x6')]=function(_0x9b2c8f,_0xe1a518){return _0x9b2c8f['define'](_0x84e2('0x7'),attributes,{'tableName':_0x84e2('0x8'),'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 704745f..01808bf 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 _0xab31=['CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request','CmCustomField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x423567,_0x1b732f){var _0x25eefc=function(_0x261248){while(--_0x261248){_0x423567['push'](_0x423567['shift']());}};_0x25eefc(++_0x1b732f);}(_0xab31,0x1d6));var _0x1ab3=function(_0x3165eb,_0x2b1792){_0x3165eb=_0x3165eb-0x0;var _0x234d44=_0xab31[_0x3165eb];return _0x234d44;};'use strict';var _=require(_0x1ab3('0x0'));var util=require(_0x1ab3('0x1'));var moment=require(_0x1ab3('0x2'));var BPromise=require('bluebird');var rs=require(_0x1ab3('0x3'));var fs=require('fs');var Redis=require(_0x1ab3('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1ab3('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x1ab3('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x1ab3('0x7')][_0x1ab3('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xa72e44,_0x31a9ff,_0x33d1e9){return new BPromise(function(_0x5f2105,_0x2d649b){return client[_0x1ab3('0x9')](_0xa72e44,_0x33d1e9)['then'](function(_0x44eb80){logger['info'](_0x1ab3('0xa'),_0x31a9ff,_0x1ab3('0xb'));logger[_0x1ab3('0xc')](_0x1ab3('0xd'),_0x31a9ff,_0x1ab3('0xb'),JSON[_0x1ab3('0xe')](_0x44eb80));if(_0x44eb80[_0x1ab3('0xf')]){if(_0x44eb80['error'][_0x1ab3('0x10')]===0x1f4){logger[_0x1ab3('0xf')]('CmCustomField,\x20%s,\x20%s',_0x31a9ff,_0x44eb80[_0x1ab3('0xf')][_0x1ab3('0x11')]);return _0x2d649b(_0x44eb80[_0x1ab3('0xf')][_0x1ab3('0x11')]);}logger['error'](_0x1ab3('0xa'),_0x31a9ff,_0x44eb80[_0x1ab3('0xf')][_0x1ab3('0x11')]);return _0x5f2105(_0x44eb80['error']['message']);}else{logger[_0x1ab3('0x12')](_0x1ab3('0xa'),_0x31a9ff,_0x1ab3('0xb'));_0x5f2105(_0x44eb80[_0x1ab3('0x13')]['message']);}})[_0x1ab3('0x14')](function(_0x39811a){logger[_0x1ab3('0xf')](_0x1ab3('0xa'),_0x31a9ff,_0x39811a);_0x2d649b(_0x39811a);});});} \ No newline at end of file +var _0x9a4e=['../../config/environment','jayson/promise','client','http','request','then','info','CmCustomField,\x20%s,\x20%s','request\x20sent','debug','CmCustomField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9a4e,0x1ba));var _0xe9a4=function(_0x4ec88f,_0x49e102){_0x4ec88f=_0x4ec88f-0x0;var _0x3067fc=_0x9a4e[_0x4ec88f];return _0x3067fc;};'use strict';var _=require(_0xe9a4('0x0'));var util=require(_0xe9a4('0x1'));var moment=require(_0xe9a4('0x2'));var BPromise=require('bluebird');var rs=require(_0xe9a4('0x3'));var fs=require('fs');var Redis=require(_0xe9a4('0x4'));var db=require(_0xe9a4('0x5'))['db'];var utils=require(_0xe9a4('0x6'));var logger=require(_0xe9a4('0x7'))('rpc');var config=require(_0xe9a4('0x8'));var jayson=require(_0xe9a4('0x9'));var client=jayson[_0xe9a4('0xa')][_0xe9a4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4f07f9,_0x3926c7,_0x5b7005){return new BPromise(function(_0x198632,_0x19979c){return client[_0xe9a4('0xc')](_0x4f07f9,_0x5b7005)[_0xe9a4('0xd')](function(_0x34e0b1){logger[_0xe9a4('0xe')](_0xe9a4('0xf'),_0x3926c7,_0xe9a4('0x10'));logger[_0xe9a4('0x11')](_0xe9a4('0x12'),_0x3926c7,_0xe9a4('0x10'),JSON[_0xe9a4('0x13')](_0x34e0b1));if(_0x34e0b1[_0xe9a4('0x14')]){if(_0x34e0b1[_0xe9a4('0x14')][_0xe9a4('0x15')]===0x1f4){logger[_0xe9a4('0x14')](_0xe9a4('0xf'),_0x3926c7,_0x34e0b1[_0xe9a4('0x14')]['message']);return _0x19979c(_0x34e0b1['error'][_0xe9a4('0x16')]);}logger[_0xe9a4('0x14')](_0xe9a4('0xf'),_0x3926c7,_0x34e0b1[_0xe9a4('0x14')]['message']);return _0x198632(_0x34e0b1[_0xe9a4('0x14')][_0xe9a4('0x16')]);}else{logger['info']('CmCustomField,\x20%s,\x20%s',_0x3926c7,'request\x20sent');_0x198632(_0x34e0b1[_0xe9a4('0x17')][_0xe9a4('0x16')]);}})[_0xe9a4('0x18')](function(_0x393c40){logger[_0xe9a4('0x14')](_0xe9a4('0xf'),_0x3926c7,_0x393c40);_0x19979c(_0x393c40);});});} \ No newline at end of file diff --git a/server/api/cmCustomField/index.js b/server/api/cmCustomField/index.js index 5cb1e25..f035db1 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 _0x194c=['../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','show','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x3a0585,_0x12062b){var _0xbdc3fc=function(_0x38fba7){while(--_0x38fba7){_0x3a0585['push'](_0x3a0585['shift']());}};_0xbdc3fc(++_0x12062b);}(_0x194c,0x19b));var _0xc194=function(_0x2be75d,_0x6c1aef){_0x2be75d=_0x2be75d-0x0;var _0x3f52aa=_0x194c[_0x2be75d];return _0x3f52aa;};'use strict';var multer=require(_0xc194('0x0'));var util=require(_0xc194('0x1'));var path=require(_0xc194('0x2'));var timeout=require(_0xc194('0x3'));var express=require(_0xc194('0x4'));var router=express[_0xc194('0x5')]();var fs_extra=require(_0xc194('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xc194('0x7'));var config=require(_0xc194('0x8'));var controller=require(_0xc194('0x9'));router[_0xc194('0xa')]('/',auth[_0xc194('0xb')](),controller[_0xc194('0xc')]);router[_0xc194('0xa')](_0xc194('0xd'),auth[_0xc194('0xb')](),controller[_0xc194('0xe')]);router['post']('/',auth[_0xc194('0xb')](),controller['create']);router[_0xc194('0xf')](_0xc194('0xd'),auth[_0xc194('0xb')](),controller['update']);router[_0xc194('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xc194('0x11')]);module[_0xc194('0x12')]=router; \ No newline at end of file +var _0x6a39=['multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmCustomField.controller','get','isAuthenticated','index','/:id','post','create','update','delete','destroy','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a39,0x140));var _0x96a3=function(_0x30cf8d,_0x286354){_0x30cf8d=_0x30cf8d-0x0;var _0x92e924=_0x6a39[_0x30cf8d];return _0x92e924;};'use strict';var multer=require(_0x96a3('0x0'));var util=require(_0x96a3('0x1'));var path=require(_0x96a3('0x2'));var timeout=require(_0x96a3('0x3'));var express=require(_0x96a3('0x4'));var router=express[_0x96a3('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x96a3('0x6'));var interaction=require(_0x96a3('0x7'));var config=require(_0x96a3('0x8'));var controller=require(_0x96a3('0x9'));router[_0x96a3('0xa')]('/',auth[_0x96a3('0xb')](),controller[_0x96a3('0xc')]);router[_0x96a3('0xa')](_0x96a3('0xd'),auth[_0x96a3('0xb')](),controller['show']);router[_0x96a3('0xe')]('/',auth[_0x96a3('0xb')](),controller[_0x96a3('0xf')]);router['put'](_0x96a3('0xd'),auth[_0x96a3('0xb')](),controller[_0x96a3('0x10')]);router[_0x96a3('0x11')](_0x96a3('0xd'),auth[_0x96a3('0xb')](),controller[_0x96a3('0x12')]);module[_0x96a3('0x13')]=router; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.attributes.js b/server/api/cmHopper/cmHopper.attributes.js index ce5f614..a758904 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 _0xac68=['YYYY-MM-DD\x20HH:mm:ss','INTEGER','STRING','DATE','UNSIGNED','contactListQueue','moment','exports','BOOLEAN','format'];(function(_0x3c490,_0x45bb10){var _0x44d479=function(_0x1d0225){while(--_0x1d0225){_0x3c490['push'](_0x3c490['shift']());}};_0x44d479(++_0x45bb10);}(_0xac68,0x1be));var _0x8ac6=function(_0x45fc6a,_0x166adb){_0x45fc6a=_0x45fc6a-0x0;var _0x14bcfd=_0xac68[_0x45fc6a];return _0x14bcfd;};'use strict';var moment=require(_0x8ac6('0x0'));var Sequelize=require('sequelize');module[_0x8ac6('0x1')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'active':{'type':Sequelize[_0x8ac6('0x2')],'defaultValue':![]},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x8ac6('0x3')](_0x8ac6('0x4'))},'countbusyretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x8ac6('0x5')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x8ac6('0x5')],'defaultValue':0x0},'callback':{'type':Sequelize[_0x8ac6('0x2')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x8ac6('0x6')],'defaultValue':null},'callbackat':{'type':Sequelize[_0x8ac6('0x7')]},'priority':{'type':Sequelize['INTEGER'](0x2)[_0x8ac6('0x8')],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0x8ac6('0x2')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0x8ac6('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize[_0x8ac6('0x5')]},'VoiceQueueId':{'type':Sequelize[_0x8ac6('0x5')],'unique':_0x8ac6('0x9')},'CampaignId':{'type':Sequelize[_0x8ac6('0x5')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x8ac6('0x5')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x8ac6('0x5')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x8ac6('0x5')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x8ac6('0x5')],'defaultValue':0x0},'OrderBy':{'type':Sequelize[_0x8ac6('0x5')],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0x8ac6('0x6')]},'recallmeNotifiedDate':{'type':Sequelize['DATE'],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file +var _0x31cf=['format','YYYY-MM-DD\x20HH:mm:ss','INTEGER','contactListQueue','moment','sequelize','exports','STRING','BOOLEAN','DATE'];(function(_0x1ac772,_0x1fbbbc){var _0x916af4=function(_0x165f09){while(--_0x165f09){_0x1ac772['push'](_0x1ac772['shift']());}};_0x916af4(++_0x1fbbbc);}(_0x31cf,0x1a8));var _0xf31c=function(_0x18ab2a,_0x4debcd){_0x18ab2a=_0x18ab2a-0x0;var _0x16dcee=_0x31cf[_0x18ab2a];return _0x16dcee;};'use strict';var moment=require(_0xf31c('0x0'));var Sequelize=require(_0xf31c('0x1'));module[_0xf31c('0x2')]={'phone':{'type':Sequelize[_0xf31c('0x3')],'allowNull':![]},'active':{'type':Sequelize[_0xf31c('0x4')],'defaultValue':![]},'scheduledat':{'type':Sequelize[_0xf31c('0x5')],'defaultValue':moment()[_0xf31c('0x6')](_0xf31c('0x7'))},'countbusyretry':{'type':Sequelize[_0xf31c('0x8')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'callback':{'type':Sequelize[_0xf31c('0x4')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize['STRING'],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'priority':{'type':Sequelize[_0xf31c('0x8')](0x2)['UNSIGNED'],'defaultValue':0x2,'validate':{'min':0x0,'max':0x4}},'recallme':{'type':Sequelize[_0xf31c('0x4')],'defaultValue':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':_0xf31c('0x9')},'ListId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'UserId':{'type':Sequelize['INTEGER']},'VoiceQueueId':{'type':Sequelize[_0xf31c('0x8')],'unique':'contactListQueue'},'CampaignId':{'type':Sequelize[_0xf31c('0x8')]},'countnosuchnumberretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countdropretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xf31c('0x8')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xf31c('0x8')],'defaultValue':0x0},'OrderBy':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xf31c('0x3')]},'recallmeNotifiedDate':{'type':Sequelize[_0xf31c('0x5')],'allowNull':!![],'defaultValue':null}}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.controller.js b/server/api/cmHopper/cmHopper.controller.js index 4eb83af..6776d37 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 _0xed1f=['$lte','$eq','$not','$notBetween','$in','$notIn','$like','$notLike','$iLike','$contains','attributes','fields','length','hasOwnProperty','order','sort','filters','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','keys','find','create','body','update','params','describe','destroy','VoiceQueueId','VoiceQueue','Campaign','CampaignId','omit','dataValues','createdAt','updatedAt','state','statedesc','deleted','campaign','UserId','user','deletedat','format','YYYY-MM-DD\x20HH:mm:ss','calleridnum','phone','campaigntype','queue','ivr','CmContact','ContactId','firstName','isNil','calleridname','lastName','finally','CmHopperFinal','CmHopperAdditionalPhone','getVoiceQueues','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','sequelize','transaction','value','direction','prev','isEmpty','hopperIds','priority','ASC','DESC','literal','COALESCE(CmHopper.UserId,\x200)\x20DESC','scheduledat','LOCK','UPDATE','Contact','CmCompany','Company','List','Queue','dialActive','getPreviewRecall','findOne','CmList','getOpenContacts','outbound','isNumber','CmHopper,\x20%s,\x20%s,\x20%s','entity\x20not\x20found','sendStatus','getTimezones','timezones','push','utcOffset','getTimezone','moment','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','status','json','offset','undefined','count','limit','Content-Range','then','error','name','send','CmHopper','rawAttributes','fieldName','type','model','map','query','intersection','concat','$and','$or','$gt','$gte','$lt'];(function(_0x1f08e3,_0x4afd87){var _0x85cb4=function(_0x3ebe48){while(--_0x3ebe48){_0x1f08e3['push'](_0x1f08e3['shift']());}};_0x85cb4(++_0x4afd87);}(_0xed1f,0x6a));var _0xfed1=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0xed1f[_0x5c2e3e];return _0x53f64a;};'use strict';var moment=require(_0xfed1('0x0'));var _=require(_0xfed1('0x1'));var qs=require(_0xfed1('0x2'));var logger=require(_0xfed1('0x3'))(_0xfed1('0x4'));var shared=require(_0xfed1('0x5'));var db=require(_0xfed1('0x6'))['db'];function respondWithResult(_0xa68587,_0x2209b3){_0x2209b3=_0x2209b3||0xc8;return function(_0x45c3c1){if(_0x45c3c1){return _0xa68587[_0xfed1('0x7')](_0x2209b3)[_0xfed1('0x8')](_0x45c3c1);}};}function respondWithFilteredResult(_0x3d6706,_0x42751d){return function(_0x380e18){if(_0x380e18){var _0x612b38=typeof _0x42751d[_0xfed1('0x9')]===_0xfed1('0xa')&&typeof _0x42751d['limit']===_0xfed1('0xa');var _0x305d19=_0x380e18['count'];var _0x1414be=_0x612b38?0x0:_0x42751d[_0xfed1('0x9')];var _0x4a564e=_0x612b38?_0x380e18[_0xfed1('0xb')]:_0x42751d['offset']+_0x42751d[_0xfed1('0xc')];var _0x234f4e;if(_0x4a564e>=_0x305d19){_0x4a564e=_0x305d19;_0x234f4e=0xc8;}else{_0x234f4e=0xce;}_0x3d6706['status'](_0x234f4e);return _0x3d6706['set'](_0xfed1('0xd'),_0x1414be+'-'+_0x4a564e+'/'+_0x305d19)[_0xfed1('0x8')](_0x380e18);}return null;};}function saveUpdates(_0x569a6e,_0x17f4fe){return function(_0x5a3469){if(_0x5a3469){return _0x5a3469['update'](_0x569a6e)[_0xfed1('0xe')](function(_0x397af9){return _0x397af9;});}return null;};}function handleEntityNotFound(_0x532537,_0x2dde3a){return function(_0x5b9455){if(!_0x5b9455){_0x532537['sendStatus'](0x194);}return _0x5b9455;};}function handleError(_0xde25db,_0x39aa0c){_0x39aa0c=_0x39aa0c||0x1f4;return function(_0x1fbb7a){logger[_0xfed1('0xf')](_0x1fbb7a['stack']);if(_0x1fbb7a[_0xfed1('0x10')]){delete _0x1fbb7a['name'];}_0xde25db[_0xfed1('0x7')](_0x39aa0c)[_0xfed1('0x11')](_0x1fbb7a);};}exports['index']=function(_0x3d0517,_0xa72a20){var _0x5c0d9f={},_0x59509b={},_0x586ea6={'count':0x0,'rows':[]};var _0x1e5afb=_['map'](db[_0xfed1('0x12')][_0xfed1('0x13')],function(_0x51a860){return{'name':_0x51a860[_0xfed1('0x14')],'type':_0x51a860[_0xfed1('0x15')]['key']};});_0x59509b[_0xfed1('0x16')]=_[_0xfed1('0x17')](_0x1e5afb,_0xfed1('0x10'));_0x59509b[_0xfed1('0x18')]=_['keys'](_0x3d0517[_0xfed1('0x18')]);_0x59509b['filters']=_[_0xfed1('0x19')](_0x59509b[_0xfed1('0x16')],_0x59509b[_0xfed1('0x18')]);_0x59509b['filters']=_[_0xfed1('0x1a')](_0x59509b['filters'],[_0xfed1('0x1b'),_0xfed1('0x1c'),_0xfed1('0x1d'),_0xfed1('0x1e'),_0xfed1('0x1f'),_0xfed1('0x20'),'$ne',_0xfed1('0x21'),_0xfed1('0x22'),'$between',_0xfed1('0x23'),_0xfed1('0x24'),_0xfed1('0x25'),_0xfed1('0x26'),_0xfed1('0x27'),_0xfed1('0x28'),'$notILike',_0xfed1('0x26'),'$overlap',_0xfed1('0x29'),'$contained','$any']);_0x5c0d9f[_0xfed1('0x2a')]=_[_0xfed1('0x19')](_0x59509b[_0xfed1('0x16')],qs['fields'](_0x3d0517[_0xfed1('0x18')][_0xfed1('0x2b')]));_0x5c0d9f[_0xfed1('0x2a')]=_0x5c0d9f[_0xfed1('0x2a')][_0xfed1('0x2c')]?_0x5c0d9f[_0xfed1('0x2a')]:_0x59509b['model'];if(!_0x3d0517[_0xfed1('0x18')][_0xfed1('0x2d')]('nolimit')){_0x5c0d9f['limit']=qs[_0xfed1('0xc')](_0x3d0517[_0xfed1('0x18')][_0xfed1('0xc')]);_0x5c0d9f[_0xfed1('0x9')]=qs[_0xfed1('0x9')](_0x3d0517['query'][_0xfed1('0x9')]);}_0x5c0d9f[_0xfed1('0x2e')]=qs[_0xfed1('0x2f')](_0x3d0517[_0xfed1('0x18')][_0xfed1('0x2f')]);_0x5c0d9f['where']=qs[_0xfed1('0x30')](_['pick'](_0x3d0517[_0xfed1('0x18')],_0x59509b[_0xfed1('0x30')]),_0x1e5afb);if(_0x3d0517[_0xfed1('0x18')][_0xfed1('0x31')]){_0x5c0d9f[_0xfed1('0x32')]=_[_0xfed1('0x33')](_0x5c0d9f[_0xfed1('0x32')],{'$or':_[_0xfed1('0x17')](_0x1e5afb,function(_0x4d6aa3){if(_0x4d6aa3[_0xfed1('0x15')]!==_0xfed1('0x34')){var _0x45f106={};_0x45f106[_0x4d6aa3[_0xfed1('0x10')]]={'$like':'%'+_0x3d0517['query']['filter']+'%'};return _0x45f106;}})});}_0x5c0d9f=_[_0xfed1('0x33')]({},_0x5c0d9f,_0x3d0517[_0xfed1('0x35')]);var _0x1d06af={'where':_0x5c0d9f[_0xfed1('0x32')]};return db[_0xfed1('0x12')][_0xfed1('0xb')](_0x1d06af)[_0xfed1('0xe')](function(_0x2f183c){_0x586ea6['count']=_0x2f183c;if(_0x3d0517['query'][_0xfed1('0x36')]){_0x5c0d9f[_0xfed1('0x37')]=[{'all':!![]}];}return db['CmHopper'][_0xfed1('0x38')](_0x5c0d9f);})[_0xfed1('0xe')](function(_0x3b0973){_0x586ea6[_0xfed1('0x39')]=_0x3b0973;return _0x586ea6;})[_0xfed1('0xe')](respondWithFilteredResult(_0xa72a20,_0x5c0d9f))[_0xfed1('0x3a')](handleError(_0xa72a20,null));};exports[_0xfed1('0x3b')]=function(_0x4118d4,_0x3c27de){var _0x5f3e1f={'raw':!![],'where':{'id':_0x4118d4['params']['id']}},_0x4eec55={};_0x4eec55[_0xfed1('0x16')]=_[_0xfed1('0x3c')](db[_0xfed1('0x12')]['rawAttributes']);_0x4eec55[_0xfed1('0x18')]=_['keys'](_0x4118d4[_0xfed1('0x18')]);_0x4eec55[_0xfed1('0x30')]=_[_0xfed1('0x19')](_0x4eec55['model'],_0x4eec55[_0xfed1('0x18')]);_0x5f3e1f[_0xfed1('0x2a')]=_[_0xfed1('0x19')](_0x4eec55['model'],qs[_0xfed1('0x2b')](_0x4118d4['query'][_0xfed1('0x2b')]));_0x5f3e1f[_0xfed1('0x2a')]=_0x5f3e1f[_0xfed1('0x2a')][_0xfed1('0x2c')]?_0x5f3e1f[_0xfed1('0x2a')]:_0x4eec55[_0xfed1('0x16')];if(_0x4118d4[_0xfed1('0x18')][_0xfed1('0x36')]){_0x5f3e1f[_0xfed1('0x37')]=[{'all':!![]}];}_0x5f3e1f=_['merge']({},_0x5f3e1f,_0x4118d4[_0xfed1('0x35')]);return db[_0xfed1('0x12')][_0xfed1('0x3d')](_0x5f3e1f)['then'](handleEntityNotFound(_0x3c27de,null))['then'](respondWithResult(_0x3c27de,null))[_0xfed1('0x3a')](handleError(_0x3c27de,null));};exports[_0xfed1('0x3e')]=function(_0x46f9d3,_0xf39b8c){return db[_0xfed1('0x12')][_0xfed1('0x3e')](_0x46f9d3[_0xfed1('0x3f')],{})[_0xfed1('0xe')](respondWithResult(_0xf39b8c,0xc9))[_0xfed1('0x3a')](handleError(_0xf39b8c,null));};exports[_0xfed1('0x40')]=function(_0x61f65b,_0x1db6dc){if(_0x61f65b['body']['id']){delete _0x61f65b[_0xfed1('0x3f')]['id'];}return db[_0xfed1('0x12')][_0xfed1('0x3d')]({'where':{'id':_0x61f65b[_0xfed1('0x41')]['id']}})[_0xfed1('0xe')](handleEntityNotFound(_0x1db6dc,null))[_0xfed1('0xe')](saveUpdates(_0x61f65b['body'],null))[_0xfed1('0xe')](respondWithResult(_0x1db6dc,null))[_0xfed1('0x3a')](handleError(_0x1db6dc,null));};exports[_0xfed1('0x42')]=function(_0x4afcc1,_0x22874a){return db[_0xfed1('0x12')][_0xfed1('0x42')]()[_0xfed1('0xe')](respondWithResult(_0x22874a,null))['catch'](handleError(_0x22874a,null));};exports[_0xfed1('0x43')]=function(_0x2a346e,_0x2c32af){var _0x42761f;var _0x14745e=_0x2a346e[_0xfed1('0x41')]['id'];return db[_0xfed1('0x12')][_0xfed1('0x3d')]({'where':{'id':_0x2a346e[_0xfed1('0x41')]['id']}})[_0xfed1('0xe')](handleEntityNotFound(_0x2c32af,null))[_0xfed1('0xe')](function(_0xb3a534){if(_0xb3a534){return _0xb3a534[_0xfed1('0x43')]()[_0xfed1('0xe')](function(_0x33c77a){return _0x33c77a;});}})[_0xfed1('0xe')](function(_0xd1f984){_0x42761f=_0xd1f984;if(_0xd1f984){if(_0xd1f984[_0xfed1('0x44')]||_0xd1f984['CampaignId']){return db[_0xd1f984['VoiceQueueId']?_0xfed1('0x45'):_0xfed1('0x46')][_0xfed1('0x3d')]({'where':{'id':_0xd1f984[_0xfed1('0x44')]?_0xd1f984['VoiceQueueId']:_0xd1f984[_0xfed1('0x47')]},'attributes':['id',_0xfed1('0x10')],'raw':!![]});}}})['then'](function(_0x4f393c){var _0x49f696={};if(_0x4f393c){_[_0xfed1('0x33')](_0x49f696,_[_0xfed1('0x48')](_0x42761f[_0xfed1('0x49')],[_0xfed1('0x4a'),_0xfed1('0x4b'),'id']));_0x49f696[_0xfed1('0x4c')]=0x15;_0x49f696[_0xfed1('0x4d')]=_0xfed1('0x4e');_0x49f696[_0xfed1('0x4f')]=_0x4f393c[_0xfed1('0x10')];_0x49f696['membername']=_0x2a346e['user'][_0xfed1('0x10')];_0x49f696[_0xfed1('0x50')]=_0x2a346e[_0xfed1('0x51')]['id'];_0x49f696[_0xfed1('0x4e')]=!![];_0x49f696[_0xfed1('0x52')]=moment()[_0xfed1('0x53')](_0xfed1('0x54'));_0x49f696[_0xfed1('0x55')]=_0x42761f[_0xfed1('0x56')];_0x49f696[_0xfed1('0x57')]=_0x42761f[_0xfed1('0x44')]?_0xfed1('0x58'):_0xfed1('0x59');return db[_0xfed1('0x5a')][_0xfed1('0x3d')]({'where':{'id':_0x49f696[_0xfed1('0x5b')]},'attributes':[_0xfed1('0x5c'),'lastName']})['then'](function(_0x2fe019){if(!_[_0xfed1('0x5d')](_0x2c32af)&&!_[_0xfed1('0x5d')](_0x2fe019[_0xfed1('0x5c')])){_0x49f696[_0xfed1('0x5e')]=_0x2fe019[_0xfed1('0x5c')];if(!_[_0xfed1('0x5d')](_0x2fe019[_0xfed1('0x5f')])){_0x49f696[_0xfed1('0x5e')]+='\x20'+_0x2fe019[_0xfed1('0x5f')];}}})[_0xfed1('0x60')](function(){return db[_0xfed1('0x61')][_0xfed1('0x3e')](_0x49f696);});}})[_0xfed1('0xe')](function(_0x59ecc4){return db[_0xfed1('0x62')]['destroy']({'where':{'CmHopperId':_0x14745e}});})['then'](function(){return _0x2c32af[_0xfed1('0x7')](0xcc)['end']();})[_0xfed1('0x3a')](handleError(_0x2c32af,null));};exports['getPreview']=function(_0x390fc0,_0x8e29d1){var _0x53f0ab=[];return db[_0xfed1('0x5a')][_0xfed1('0x42')]()['then'](function(_0x29b51e){_0x53f0ab=_[_0xfed1('0x3c')](_0x29b51e);return _0x390fc0[_0xfed1('0x51')][_0xfed1('0x63')]({'where':{'type':'outbound','dialActive':!![],'dialMethod':_0xfed1('0x64')},'attributes':['id',_0xfed1('0x65'),_0xfed1('0x66')],'raw':!![]});})[_0xfed1('0xe')](function(_0x23347a){if(_0x23347a&&_0x23347a[_0xfed1('0x2c')]){return db[_0xfed1('0x67')][_0xfed1('0x68')](function(_0x5c043d){var _0x2d66ec={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xfed1('0x53')](_0xfed1('0x54'))},'VoiceQueueId':{'$in':_[_0xfed1('0x17')](_0x23347a,'id')},'$or':[{'UserId':null},{'UserId':_0x390fc0[_0xfed1('0x51')]['id']}]};var _0x3d7be2={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x23347a)['filter'](['dialPreviewAutoRecallMe',0x0])['map']('id')[_0xfed1('0x69')]()},'$or':[{'UserId':null},{'UserId':_0x390fc0[_0xfed1('0x51')]['id']}]};var _0x3aea22={'$or':[_0x2d66ec,_0x3d7be2]};var _0x2fb9b2=[];if(_0x390fc0['body'][_0xfed1('0x6a')]&&_0x390fc0['body'][_0xfed1('0x6a')]===_0xfed1('0x6b')){if(!_[_0xfed1('0x6c')](_0x390fc0[_0xfed1('0x3f')][_0xfed1('0x6d')])){_0x3aea22['id']={'$in':_0x390fc0['body'][_0xfed1('0x6d')]};}_0x2fb9b2=[[_0xfed1('0x6e'),_0xfed1('0x6f')],['scheduledAt',_0x23347a[0x0][_0xfed1('0x65')]===_0xfed1('0x6f')?_0xfed1('0x70'):_0xfed1('0x6f')],db['sequelize'][_0xfed1('0x71')]('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id',_0xfed1('0x70')]];}else{if(!_[_0xfed1('0x6c')](_0x390fc0['body']['hopperIds'])){_0x3aea22['id']={'$notIn':_0x390fc0[_0xfed1('0x3f')][_0xfed1('0x6d')]};}_0x2fb9b2=[[_0xfed1('0x6e'),_0xfed1('0x70')],['scheduledAt',_0x23347a[0x0][_0xfed1('0x65')]],db[_0xfed1('0x67')][_0xfed1('0x71')](_0xfed1('0x72')),['id',_0xfed1('0x6f')]];}return db[_0xfed1('0x12')]['findOne']({'attributes':['id',_0xfed1('0x73'),_0xfed1('0x56'),'recallme'],'where':_0x3aea22,'order':_0x2fb9b2,'transaction':_0x5c043d,'lock':_0x5c043d[_0xfed1('0x74')][_0xfed1('0x75')],'include':[{'model':db[_0xfed1('0x5a')],'as':_0xfed1('0x76'),'attributes':_0x53f0ab,'include':[{'model':db[_0xfed1('0x77')],'as':_0xfed1('0x78'),'attributes':['id','name']}]},{'model':db['CmList'],'as':_0xfed1('0x79'),'attributes':['id','name']},{'model':db[_0xfed1('0x45')],'as':_0xfed1('0x7a'),'attributes':['id',_0xfed1('0x10'),_0xfed1('0x7b')]}]})[_0xfed1('0xe')](function(_0x179f85){if(_0x179f85){return _0x179f85[_0xfed1('0x40')]({'UserId':_0x390fc0[_0xfed1('0x51')]['id']},{'transaction':_0x5c043d});}});});}})[_0xfed1('0xe')](handleEntityNotFound(_0x8e29d1,null))[_0xfed1('0xe')](respondWithResult(_0x8e29d1,null))['catch'](handleError(_0x8e29d1,null));};exports[_0xfed1('0x7c')]=function(_0xef7276,_0x56421e,_0x544605){var _0x2d6692=[];var _0x51994d=_0xef7276[_0xfed1('0x41')]['id'];var _0x1497fb=_0xef7276[_0xfed1('0x51')]['id'];return db['CmContact'][_0xfed1('0x42')]()[_0xfed1('0xe')](function(_0x368dd9){_0x2d6692=_[_0xfed1('0x3c')](_0x368dd9);return db[_0xfed1('0x67')]['transaction'](function(_0x287b63){const _0x34f590={'id':_0x51994d};return db[_0xfed1('0x12')][_0xfed1('0x7d')]({'attributes':['id',_0xfed1('0x73'),'recallme'],'where':_0x34f590,'transaction':_0x287b63,'lock':_0x287b63[_0xfed1('0x74')][_0xfed1('0x75')],'include':[{'model':db[_0xfed1('0x5a')],'as':_0xfed1('0x76'),'attributes':_0x2d6692,'include':[{'model':db[_0xfed1('0x77')],'as':_0xfed1('0x78'),'attributes':['id',_0xfed1('0x10')]}]},{'model':db[_0xfed1('0x7e')],'as':_0xfed1('0x79'),'attributes':['id',_0xfed1('0x10')]},{'model':db['VoiceQueue'],'as':_0xfed1('0x7a'),'attributes':['id',_0xfed1('0x10'),_0xfed1('0x7b')]}]})[_0xfed1('0xe')](function(_0x194f42){if(_0x194f42){return _0x194f42['update']({'UserId':_0x1497fb},{'transaction':_0x287b63});}});});})[_0xfed1('0xe')](handleEntityNotFound(_0x56421e,null))[_0xfed1('0xe')](respondWithResult(_0x56421e,null))[_0xfed1('0x3a')](handleError(_0x56421e,null));};exports[_0xfed1('0x7f')]=function(_0x221ed8,_0xb76860){return _0x221ed8[_0xfed1('0x51')][_0xfed1('0x63')]({'where':{'type':_0xfed1('0x80'),'dialActive':!![],'dialMethod':'preview'},'attributes':['id'],'raw':!![]})['then'](function(_0xc3b72a){if(_0xc3b72a&&_0xc3b72a['length']){return db[_0xfed1('0x12')][_0xfed1('0xb')]({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0xfed1('0x53')]('YYYY-MM-DD\x20HH:mm:ss')},'VoiceQueueId':{'$in':_['map'](_0xc3b72a,'id')},'$or':[{'UserId':null},{'UserId':_0x221ed8[_0xfed1('0x51')]['id']}]}});}return 0x0;})['then'](function(_0x173790){if(!_['isNil'](_0x173790)&&_[_0xfed1('0x81')](_0x173790)){return _0xb76860[_0xfed1('0x7')](0xc8)[_0xfed1('0x8')]({'contacts':_0x173790});}else{logger[_0xfed1('0xf')](_0xfed1('0x82'),'getOpenContacts',0x194,_0xfed1('0x83'));_0xb76860[_0xfed1('0x84')](0x194);}})['catch'](handleError(_0xb76860,null));};exports[_0xfed1('0x85')]=function(_0x130b1f,_0x4f879d){var _0x12ce90=shared[_0xfed1('0x86')];var _0x3668c2=[];_['map'](_0x12ce90,function(_0x473d4a){_0x3668c2[_0xfed1('0x87')]({'id':_0x473d4a['name'],'name':_0x473d4a[_0xfed1('0x10')],'utcOffset':_0x473d4a[_0xfed1('0x88')]});});return _0x4f879d[_0xfed1('0x7')](0xc8)['json']({'tz':_0x3668c2});};exports[_0xfed1('0x89')]=function(_0x36d7de,_0x49f600){var _0x48172c=shared[_0xfed1('0x86')];var _0x33755c={};if(!_[_0xfed1('0x5d')](_0x48172c[_0x36d7de[_0xfed1('0x3f')]['id']]))_0x33755c=_0x48172c[_0x36d7de[_0xfed1('0x3f')]['id']];return _0x49f600[_0xfed1('0x7')](0xc8)[_0xfed1('0x8')](_0x33755c);}; \ No newline at end of file +var _0x5c12=['error','send','rawAttributes','fieldName','type','model','map','name','query','filters','intersection','concat','$and','$or','$gt','$gte','$lt','$lte','$eq','$not','$between','$notBetween','$in','$notIn','$notLike','$iLike','$notILike','$like','$overlap','$contains','$any','fields','attributes','length','order','sort','where','pick','filter','merge','VIRTUAL','options','CmHopper','then','include','rows','catch','show','params','keys','includeAll','create','body','find','describe','destroy','VoiceQueueId','CampaignId','VoiceQueue','Campaign','omit','dataValues','createdAt','updatedAt','statedesc','deleted','campaign','membername','user','UserId','deletedat','format','calleridnum','phone','queue','ivr','CmContact','ContactId','lastName','isNil','firstName','calleridname','finally','CmHopperFinal','CmHopperAdditionalPhone','end','getPreview','outbound','preview','dialOrderByScheduledAt','dialPreviewAutoRecallMe','transaction','YYYY-MM-DD\x20HH:mm:ss','direction','isEmpty','hopperIds','priority','scheduledAt','ASC','sequelize','DESC','literal','findOne','LOCK','UPDATE','CmCompany','Company','List','Queue','dialActive','update','getPreviewRecall','scheduledat','recallme','getOpenContacts','getVoiceQueues','isNumber','entity\x20not\x20found','getTimezones','timezones','push','utcOffset','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','status','undefined','limit','count','offset','set','json','sendStatus'];(function(_0x1a4b42,_0x198645){var _0x4e78a9=function(_0x36b49b){while(--_0x36b49b){_0x1a4b42['push'](_0x1a4b42['shift']());}};_0x4e78a9(++_0x198645);}(_0x5c12,0x188));var _0x25c1=function(_0x550e29,_0x4047f){_0x550e29=_0x550e29-0x0;var _0x3515b6=_0x5c12[_0x550e29];return _0x3515b6;};'use strict';var moment=require('moment');var _=require(_0x25c1('0x0'));var qs=require(_0x25c1('0x1'));var logger=require('../../config/logger')(_0x25c1('0x2'));var shared=require(_0x25c1('0x3'));var db=require(_0x25c1('0x4'))['db'];function respondWithResult(_0x10f10c,_0x2c5df0){_0x2c5df0=_0x2c5df0||0xc8;return function(_0x21ec20){if(_0x21ec20){return _0x10f10c[_0x25c1('0x5')](_0x2c5df0)['json'](_0x21ec20);}};}function respondWithFilteredResult(_0x204287,_0x42ac16){return function(_0x382922){if(_0x382922){var _0x4ab674=typeof _0x42ac16['offset']===_0x25c1('0x6')&&typeof _0x42ac16[_0x25c1('0x7')]===_0x25c1('0x6');var _0x22a7b0=_0x382922[_0x25c1('0x8')];var _0x588f30=_0x4ab674?0x0:_0x42ac16[_0x25c1('0x9')];var _0x41c89d=_0x4ab674?_0x382922[_0x25c1('0x8')]:_0x42ac16[_0x25c1('0x9')]+_0x42ac16[_0x25c1('0x7')];var _0x5e44e2;if(_0x41c89d>=_0x22a7b0){_0x41c89d=_0x22a7b0;_0x5e44e2=0xc8;}else{_0x5e44e2=0xce;}_0x204287[_0x25c1('0x5')](_0x5e44e2);return _0x204287[_0x25c1('0xa')]('Content-Range',_0x588f30+'-'+_0x41c89d+'/'+_0x22a7b0)[_0x25c1('0xb')](_0x382922);}return null;};}function saveUpdates(_0x209af5,_0x323d3c){return function(_0x329ba9){if(_0x329ba9){return _0x329ba9['update'](_0x209af5)['then'](function(_0x4ef5d7){return _0x4ef5d7;});}return null;};}function handleEntityNotFound(_0x54f6f4,_0x3ef429){return function(_0x1412ed){if(!_0x1412ed){_0x54f6f4[_0x25c1('0xc')](0x194);}return _0x1412ed;};}function handleError(_0x6eba15,_0x17a032){_0x17a032=_0x17a032||0x1f4;return function(_0x4ea926){logger[_0x25c1('0xd')](_0x4ea926['stack']);if(_0x4ea926['name']){delete _0x4ea926['name'];}_0x6eba15[_0x25c1('0x5')](_0x17a032)[_0x25c1('0xe')](_0x4ea926);};}exports['index']=function(_0x4c55e7,_0x61a29f){var _0x4c0d49={},_0x7175d4={},_0x23a418={'count':0x0,'rows':[]};var _0x5c3c5d=_['map'](db['CmHopper'][_0x25c1('0xf')],function(_0x3d3149){return{'name':_0x3d3149[_0x25c1('0x10')],'type':_0x3d3149[_0x25c1('0x11')]['key']};});_0x7175d4[_0x25c1('0x12')]=_[_0x25c1('0x13')](_0x5c3c5d,_0x25c1('0x14'));_0x7175d4[_0x25c1('0x15')]=_['keys'](_0x4c55e7['query']);_0x7175d4[_0x25c1('0x16')]=_[_0x25c1('0x17')](_0x7175d4[_0x25c1('0x12')],_0x7175d4[_0x25c1('0x15')]);_0x7175d4[_0x25c1('0x16')]=_[_0x25c1('0x18')](_0x7175d4[_0x25c1('0x16')],[_0x25c1('0x19'),_0x25c1('0x1a'),_0x25c1('0x1b'),_0x25c1('0x1c'),_0x25c1('0x1d'),_0x25c1('0x1e'),'$ne',_0x25c1('0x1f'),_0x25c1('0x20'),_0x25c1('0x21'),_0x25c1('0x22'),_0x25c1('0x23'),_0x25c1('0x24'),'$like',_0x25c1('0x25'),_0x25c1('0x26'),_0x25c1('0x27'),_0x25c1('0x28'),_0x25c1('0x29'),_0x25c1('0x2a'),'$contained',_0x25c1('0x2b')]);_0x4c0d49['attributes']=_[_0x25c1('0x17')](_0x7175d4[_0x25c1('0x12')],qs[_0x25c1('0x2c')](_0x4c55e7[_0x25c1('0x15')][_0x25c1('0x2c')]));_0x4c0d49[_0x25c1('0x2d')]=_0x4c0d49[_0x25c1('0x2d')][_0x25c1('0x2e')]?_0x4c0d49[_0x25c1('0x2d')]:_0x7175d4['model'];if(!_0x4c55e7[_0x25c1('0x15')]['hasOwnProperty']('nolimit')){_0x4c0d49[_0x25c1('0x7')]=qs[_0x25c1('0x7')](_0x4c55e7['query'][_0x25c1('0x7')]);_0x4c0d49['offset']=qs[_0x25c1('0x9')](_0x4c55e7['query'][_0x25c1('0x9')]);}_0x4c0d49[_0x25c1('0x2f')]=qs[_0x25c1('0x30')](_0x4c55e7[_0x25c1('0x15')][_0x25c1('0x30')]);_0x4c0d49[_0x25c1('0x31')]=qs[_0x25c1('0x16')](_[_0x25c1('0x32')](_0x4c55e7['query'],_0x7175d4[_0x25c1('0x16')]),_0x5c3c5d);if(_0x4c55e7['query'][_0x25c1('0x33')]){_0x4c0d49['where']=_[_0x25c1('0x34')](_0x4c0d49[_0x25c1('0x31')],{'$or':_[_0x25c1('0x13')](_0x5c3c5d,function(_0x2f86de){if(_0x2f86de[_0x25c1('0x11')]!==_0x25c1('0x35')){var _0x35e632={};_0x35e632[_0x2f86de[_0x25c1('0x14')]]={'$like':'%'+_0x4c55e7[_0x25c1('0x15')][_0x25c1('0x33')]+'%'};return _0x35e632;}})});}_0x4c0d49=_[_0x25c1('0x34')]({},_0x4c0d49,_0x4c55e7[_0x25c1('0x36')]);var _0x1041a3={'where':_0x4c0d49[_0x25c1('0x31')]};return db[_0x25c1('0x37')][_0x25c1('0x8')](_0x1041a3)[_0x25c1('0x38')](function(_0x30b1d7){_0x23a418[_0x25c1('0x8')]=_0x30b1d7;if(_0x4c55e7[_0x25c1('0x15')]['includeAll']){_0x4c0d49[_0x25c1('0x39')]=[{'all':!![]}];}return db[_0x25c1('0x37')]['findAll'](_0x4c0d49);})[_0x25c1('0x38')](function(_0x5eca99){_0x23a418[_0x25c1('0x3a')]=_0x5eca99;return _0x23a418;})['then'](respondWithFilteredResult(_0x61a29f,_0x4c0d49))[_0x25c1('0x3b')](handleError(_0x61a29f,null));};exports[_0x25c1('0x3c')]=function(_0x1cf0b8,_0x3d6135){var _0xbc20a3={'raw':!![],'where':{'id':_0x1cf0b8[_0x25c1('0x3d')]['id']}},_0x5d4688={};_0x5d4688['model']=_[_0x25c1('0x3e')](db[_0x25c1('0x37')][_0x25c1('0xf')]);_0x5d4688[_0x25c1('0x15')]=_['keys'](_0x1cf0b8['query']);_0x5d4688['filters']=_[_0x25c1('0x17')](_0x5d4688[_0x25c1('0x12')],_0x5d4688['query']);_0xbc20a3[_0x25c1('0x2d')]=_['intersection'](_0x5d4688[_0x25c1('0x12')],qs[_0x25c1('0x2c')](_0x1cf0b8[_0x25c1('0x15')]['fields']));_0xbc20a3['attributes']=_0xbc20a3['attributes'][_0x25c1('0x2e')]?_0xbc20a3[_0x25c1('0x2d')]:_0x5d4688['model'];if(_0x1cf0b8[_0x25c1('0x15')][_0x25c1('0x3f')]){_0xbc20a3[_0x25c1('0x39')]=[{'all':!![]}];}_0xbc20a3=_['merge']({},_0xbc20a3,_0x1cf0b8['options']);return db['CmHopper']['find'](_0xbc20a3)[_0x25c1('0x38')](handleEntityNotFound(_0x3d6135,null))[_0x25c1('0x38')](respondWithResult(_0x3d6135,null))['catch'](handleError(_0x3d6135,null));};exports[_0x25c1('0x40')]=function(_0x350e2a,_0x1aaedd){return db[_0x25c1('0x37')][_0x25c1('0x40')](_0x350e2a[_0x25c1('0x41')],{})[_0x25c1('0x38')](respondWithResult(_0x1aaedd,0xc9))['catch'](handleError(_0x1aaedd,null));};exports['update']=function(_0x28fc89,_0x43d96a){if(_0x28fc89[_0x25c1('0x41')]['id']){delete _0x28fc89['body']['id'];}return db[_0x25c1('0x37')][_0x25c1('0x42')]({'where':{'id':_0x28fc89[_0x25c1('0x3d')]['id']}})[_0x25c1('0x38')](handleEntityNotFound(_0x43d96a,null))['then'](saveUpdates(_0x28fc89[_0x25c1('0x41')],null))[_0x25c1('0x38')](respondWithResult(_0x43d96a,null))[_0x25c1('0x3b')](handleError(_0x43d96a,null));};exports[_0x25c1('0x43')]=function(_0x5d2ecc,_0x59e96b){return db[_0x25c1('0x37')][_0x25c1('0x43')]()[_0x25c1('0x38')](respondWithResult(_0x59e96b,null))[_0x25c1('0x3b')](handleError(_0x59e96b,null));};exports['destroy']=function(_0x6eff9e,_0x32943c){var _0x5770dd;var _0x102f5=_0x6eff9e[_0x25c1('0x3d')]['id'];return db[_0x25c1('0x37')][_0x25c1('0x42')]({'where':{'id':_0x6eff9e['params']['id']}})['then'](handleEntityNotFound(_0x32943c,null))[_0x25c1('0x38')](function(_0x3e8e2c){if(_0x3e8e2c){return _0x3e8e2c[_0x25c1('0x44')]()['then'](function(_0x19028a){return _0x19028a;});}})[_0x25c1('0x38')](function(_0x483721){_0x5770dd=_0x483721;if(_0x483721){if(_0x483721[_0x25c1('0x45')]||_0x483721[_0x25c1('0x46')]){return db[_0x483721[_0x25c1('0x45')]?_0x25c1('0x47'):_0x25c1('0x48')][_0x25c1('0x42')]({'where':{'id':_0x483721[_0x25c1('0x45')]?_0x483721['VoiceQueueId']:_0x483721['CampaignId']},'attributes':['id','name'],'raw':!![]});}}})[_0x25c1('0x38')](function(_0x5c588c){var _0x133d1d={};if(_0x5c588c){_[_0x25c1('0x34')](_0x133d1d,_[_0x25c1('0x49')](_0x5770dd[_0x25c1('0x4a')],[_0x25c1('0x4b'),_0x25c1('0x4c'),'id']));_0x133d1d['state']=0x15;_0x133d1d[_0x25c1('0x4d')]=_0x25c1('0x4e');_0x133d1d[_0x25c1('0x4f')]=_0x5c588c[_0x25c1('0x14')];_0x133d1d[_0x25c1('0x50')]=_0x6eff9e[_0x25c1('0x51')]['name'];_0x133d1d[_0x25c1('0x52')]=_0x6eff9e[_0x25c1('0x51')]['id'];_0x133d1d[_0x25c1('0x4e')]=!![];_0x133d1d[_0x25c1('0x53')]=moment()[_0x25c1('0x54')]('YYYY-MM-DD\x20HH:mm:ss');_0x133d1d[_0x25c1('0x55')]=_0x5770dd[_0x25c1('0x56')];_0x133d1d['campaigntype']=_0x5770dd[_0x25c1('0x45')]?_0x25c1('0x57'):_0x25c1('0x58');return db[_0x25c1('0x59')][_0x25c1('0x42')]({'where':{'id':_0x133d1d[_0x25c1('0x5a')]},'attributes':['firstName',_0x25c1('0x5b')]})[_0x25c1('0x38')](function(_0x2760ef){if(!_[_0x25c1('0x5c')](_0x32943c)&&!_[_0x25c1('0x5c')](_0x2760ef[_0x25c1('0x5d')])){_0x133d1d[_0x25c1('0x5e')]=_0x2760ef[_0x25c1('0x5d')];if(!_[_0x25c1('0x5c')](_0x2760ef[_0x25c1('0x5b')])){_0x133d1d[_0x25c1('0x5e')]+='\x20'+_0x2760ef[_0x25c1('0x5b')];}}})[_0x25c1('0x5f')](function(){return db[_0x25c1('0x60')]['create'](_0x133d1d);});}})[_0x25c1('0x38')](function(_0x247983){return db[_0x25c1('0x61')][_0x25c1('0x44')]({'where':{'CmHopperId':_0x102f5}});})[_0x25c1('0x38')](function(){return _0x32943c[_0x25c1('0x5')](0xcc)[_0x25c1('0x62')]();})['catch'](handleError(_0x32943c,null));};exports[_0x25c1('0x63')]=function(_0x571d1a,_0x20fc2e){var _0x24568c=[];return db[_0x25c1('0x59')][_0x25c1('0x43')]()[_0x25c1('0x38')](function(_0x23ba04){_0x24568c=_[_0x25c1('0x3e')](_0x23ba04);return _0x571d1a[_0x25c1('0x51')]['getVoiceQueues']({'where':{'type':_0x25c1('0x64'),'dialActive':!![],'dialMethod':_0x25c1('0x65')},'attributes':['id',_0x25c1('0x66'),_0x25c1('0x67')],'raw':!![]});})[_0x25c1('0x38')](function(_0x338f70){if(_0x338f70&&_0x338f70[_0x25c1('0x2e')]){return db['sequelize'][_0x25c1('0x68')](function(_0x51e747){var _0x5e1517={'active':![],'recallme':![],'scheduledAt':{'$lte':moment()['format'](_0x25c1('0x69'))},'VoiceQueueId':{'$in':_[_0x25c1('0x13')](_0x338f70,'id')},'$or':[{'UserId':null},{'UserId':_0x571d1a[_0x25c1('0x51')]['id']}]};var _0x15cd6d={'active':![],'recallme':!![],'VoiceQueueId':{'$in':_(_0x338f70)[_0x25c1('0x33')](['dialPreviewAutoRecallMe',0x0])[_0x25c1('0x13')]('id')['value']()},'$or':[{'UserId':null},{'UserId':_0x571d1a[_0x25c1('0x51')]['id']}]};var _0x36aa98={'$or':[_0x5e1517,_0x15cd6d]};var _0x2029ac=[];if(_0x571d1a[_0x25c1('0x41')][_0x25c1('0x6a')]&&_0x571d1a[_0x25c1('0x41')][_0x25c1('0x6a')]==='prev'){if(!_[_0x25c1('0x6b')](_0x571d1a[_0x25c1('0x41')][_0x25c1('0x6c')])){_0x36aa98['id']={'$in':_0x571d1a[_0x25c1('0x41')][_0x25c1('0x6c')]};}_0x2029ac=[[_0x25c1('0x6d'),'ASC'],[_0x25c1('0x6e'),_0x338f70[0x0]['dialOrderByScheduledAt']===_0x25c1('0x6f')?'DESC':'ASC'],db[_0x25c1('0x70')]['literal']('COALESCE(CmHopper.UserId,\x200)\x20ASC'),['id','DESC']];}else{if(!_['isEmpty'](_0x571d1a[_0x25c1('0x41')]['hopperIds'])){_0x36aa98['id']={'$notIn':_0x571d1a[_0x25c1('0x41')][_0x25c1('0x6c')]};}_0x2029ac=[[_0x25c1('0x6d'),_0x25c1('0x71')],['scheduledAt',_0x338f70[0x0]['dialOrderByScheduledAt']],db[_0x25c1('0x70')][_0x25c1('0x72')]('COALESCE(CmHopper.UserId,\x200)\x20DESC'),['id',_0x25c1('0x6f')]];}return db[_0x25c1('0x37')][_0x25c1('0x73')]({'attributes':['id','scheduledat',_0x25c1('0x56'),'recallme'],'where':_0x36aa98,'order':_0x2029ac,'transaction':_0x51e747,'lock':_0x51e747[_0x25c1('0x74')][_0x25c1('0x75')],'include':[{'model':db[_0x25c1('0x59')],'as':'Contact','attributes':_0x24568c,'include':[{'model':db[_0x25c1('0x76')],'as':_0x25c1('0x77'),'attributes':['id',_0x25c1('0x14')]}]},{'model':db['CmList'],'as':_0x25c1('0x78'),'attributes':['id',_0x25c1('0x14')]},{'model':db[_0x25c1('0x47')],'as':_0x25c1('0x79'),'attributes':['id',_0x25c1('0x14'),_0x25c1('0x7a')]}]})[_0x25c1('0x38')](function(_0x373979){if(_0x373979){return _0x373979[_0x25c1('0x7b')]({'UserId':_0x571d1a[_0x25c1('0x51')]['id']},{'transaction':_0x51e747});}});});}})[_0x25c1('0x38')](handleEntityNotFound(_0x20fc2e,null))[_0x25c1('0x38')](respondWithResult(_0x20fc2e,null))[_0x25c1('0x3b')](handleError(_0x20fc2e,null));};exports[_0x25c1('0x7c')]=function(_0x4e4cac,_0x5bd3df,_0x634f6c){var _0x138376=[];var _0x35792c=_0x4e4cac[_0x25c1('0x3d')]['id'];var _0x16ca04=_0x4e4cac[_0x25c1('0x51')]['id'];return db[_0x25c1('0x59')][_0x25c1('0x43')]()[_0x25c1('0x38')](function(_0x3c3ba1){_0x138376=_['keys'](_0x3c3ba1);return db[_0x25c1('0x70')]['transaction'](function(_0x13bcd4){const _0x2c7636={'id':_0x35792c};return db['CmHopper'][_0x25c1('0x73')]({'attributes':['id',_0x25c1('0x7d'),_0x25c1('0x7e')],'where':_0x2c7636,'transaction':_0x13bcd4,'lock':_0x13bcd4['LOCK'][_0x25c1('0x75')],'include':[{'model':db[_0x25c1('0x59')],'as':'Contact','attributes':_0x138376,'include':[{'model':db[_0x25c1('0x76')],'as':_0x25c1('0x77'),'attributes':['id',_0x25c1('0x14')]}]},{'model':db['CmList'],'as':_0x25c1('0x78'),'attributes':['id',_0x25c1('0x14')]},{'model':db[_0x25c1('0x47')],'as':_0x25c1('0x79'),'attributes':['id','name',_0x25c1('0x7a')]}]})['then'](function(_0xd389b7){if(_0xd389b7){return _0xd389b7[_0x25c1('0x7b')]({'UserId':_0x16ca04},{'transaction':_0x13bcd4});}});});})['then'](handleEntityNotFound(_0x5bd3df,null))[_0x25c1('0x38')](respondWithResult(_0x5bd3df,null))['catch'](handleError(_0x5bd3df,null));};exports[_0x25c1('0x7f')]=function(_0x20dc44,_0x397459){return _0x20dc44[_0x25c1('0x51')][_0x25c1('0x80')]({'where':{'type':_0x25c1('0x64'),'dialActive':!![],'dialMethod':_0x25c1('0x65')},'attributes':['id'],'raw':!![]})['then'](function(_0x5e2054){if(_0x5e2054&&_0x5e2054[_0x25c1('0x2e')]){return db[_0x25c1('0x37')]['count']({'where':{'active':![],'recallme':![],'scheduledAt':{'$lte':moment()[_0x25c1('0x54')](_0x25c1('0x69'))},'VoiceQueueId':{'$in':_[_0x25c1('0x13')](_0x5e2054,'id')},'$or':[{'UserId':null},{'UserId':_0x20dc44['user']['id']}]}});}return 0x0;})['then'](function(_0xf6ba5d){if(!_['isNil'](_0xf6ba5d)&&_[_0x25c1('0x81')](_0xf6ba5d)){return _0x397459[_0x25c1('0x5')](0xc8)[_0x25c1('0xb')]({'contacts':_0xf6ba5d});}else{logger[_0x25c1('0xd')]('CmHopper,\x20%s,\x20%s,\x20%s','getOpenContacts',0x194,_0x25c1('0x82'));_0x397459['sendStatus'](0x194);}})[_0x25c1('0x3b')](handleError(_0x397459,null));};exports[_0x25c1('0x83')]=function(_0x2ae699,_0x48460f){var _0x46b6bc=shared[_0x25c1('0x84')];var _0x45168b=[];_[_0x25c1('0x13')](_0x46b6bc,function(_0x41f4e1){_0x45168b[_0x25c1('0x85')]({'id':_0x41f4e1[_0x25c1('0x14')],'name':_0x41f4e1[_0x25c1('0x14')],'utcOffset':_0x41f4e1[_0x25c1('0x86')]});});return _0x48460f[_0x25c1('0x5')](0xc8)[_0x25c1('0xb')]({'tz':_0x45168b});};exports['getTimezone']=function(_0x2fba76,_0x4a2d19){var _0x16616f=shared[_0x25c1('0x84')];var _0x196587={};if(!_[_0x25c1('0x5c')](_0x16616f[_0x2fba76[_0x25c1('0x41')]['id']]))_0x196587=_0x16616f[_0x2fba76[_0x25c1('0x41')]['id']];return _0x4a2d19[_0x25c1('0x5')](0xc8)['json'](_0x196587);}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.model.js b/server/api/cmHopper/cmHopper.model.js index eafa02a..17dcdf4 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 _0x814b=['phone','priority','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./cmHopper.attributes','exports','define','CmHopper','scheduledat'];(function(_0x2c4c15,_0x49245d){var _0x4499d7=function(_0x1ed911){while(--_0x1ed911){_0x2c4c15['push'](_0x2c4c15['shift']());}};_0x4499d7(++_0x49245d);}(_0x814b,0x1a2));var _0xb814=function(_0x347399,_0x42bbda){_0x347399=_0x347399-0x0;var _0x24e7be=_0x814b[_0x347399];return _0x24e7be;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'cm_hopper','paranoid':![],'indexes':[{'name':_0xb814('0xd'),'fields':[_0xb814('0xd')]},{'name':_0xb814('0xe'),'fields':[_0xb814('0xe')]},{'name':_0xb814('0xf'),'fields':[_0xb814('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5496=['request-promise','rimraf','../../config/environment','./cmHopper.attributes','define','cm_hopper','scheduledat','phone','priority','lodash','util','../../config/logger','api','moment'];(function(_0x1aac31,_0x609961){var _0x1dc582=function(_0xabe7d0){while(--_0xabe7d0){_0x1aac31['push'](_0x1aac31['shift']());}};_0x1dc582(++_0x609961);}(_0x5496,0x175));var _0x6549=function(_0x2778c9,_0xc3fe2b){_0x2778c9=_0x2778c9-0x0;var _0x5bcd31=_0x5496[_0x2778c9];return _0x5bcd31;};'use strict';var _=require(_0x6549('0x0'));var util=require(_0x6549('0x1'));var logger=require(_0x6549('0x2'))(_0x6549('0x3'));var moment=require(_0x6549('0x4'));var BPromise=require('bluebird');var rp=require(_0x6549('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x6549('0x6'));var config=require(_0x6549('0x7'));var attributes=require(_0x6549('0x8'));module['exports']=function(_0x5a4658,_0x43cb17){return _0x5a4658[_0x6549('0x9')]('CmHopper',attributes,{'tableName':_0x6549('0xa'),'paranoid':![],'indexes':[{'name':_0x6549('0xb'),'fields':[_0x6549('0xb')]},{'name':'phone','fields':[_0x6549('0xc')]},{'name':_0x6549('0xd'),'fields':[_0x6549('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopper/cmHopper.rpc.js b/server/api/cmHopper/cmHopper.rpc.js index b235b5d..60f933b 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 _0x9dde=['then','info','GetCmHopper','debug','stringify','error','message','ShowCmHopper','catch','CreateCmHopper','create','body','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','CmContact','describe','transaction','order','UPDATE','Contact','keys','User','name','voicePause','push','all','length','GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]','dataValues','ContactId','GetContactDialer','MoveContactManagedDialer','sequelize','CmHopperFinal','CountReScheduled','COUNT','literal','`scheduledat`\x20>=\x20','format','\x22%s\x22','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','contactsRescheduled','GetContactRecallMe','LOCK','GetCmHopperPreview','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','NOW()\x20+\x20INTERVAL\x20','\x20MINUTE','NOW()','Agent','CmList','List','util','moment','bluebird','../../mysqldb','../../config/logger','rpc','CmHopper','findAll','options','raw','where','limit','include','map','model','attributes'];(function(_0x2ac0df,_0x4f0ffe){var _0x662592=function(_0x1228a9){while(--_0x1228a9){_0x2ac0df['push'](_0x2ac0df['shift']());}};_0x662592(++_0x4f0ffe);}(_0x9dde,0x1e2));var _0xe9dd=function(_0x145cd6,_0x55b5a5){_0x145cd6=_0x145cd6-0x0;var _0x535c8f=_0x9dde[_0x145cd6];return _0x535c8f;};'use strict';var _=require('lodash');var util=require(_0xe9dd('0x0'));var moment=require(_0xe9dd('0x1'));var BPromise=require(_0xe9dd('0x2'));var db=require(_0xe9dd('0x3'))['db'];var logger=require(_0xe9dd('0x4'))(_0xe9dd('0x5'));exports['GetCmHopper']=function(_0x28acc0){var _0x54078b=this;return new Promise(function(_0x349e0e,_0x38e1b9){return db[_0xe9dd('0x6')][_0xe9dd('0x7')]({'raw':_0x28acc0[_0xe9dd('0x8')]?_0x28acc0[_0xe9dd('0x8')][_0xe9dd('0x9')]===undefined?!![]:![]:!![],'where':_0x28acc0[_0xe9dd('0x8')]?_0x28acc0['options'][_0xe9dd('0xa')]||null:null,'attributes':_0x28acc0['options']?_0x28acc0[_0xe9dd('0x8')]['attributes']||null:null,'limit':_0x28acc0['options']?_0x28acc0[_0xe9dd('0x8')][_0xe9dd('0xb')]||null:null,'include':_0x28acc0[_0xe9dd('0x8')]?_0x28acc0[_0xe9dd('0x8')][_0xe9dd('0xc')]?_[_0xe9dd('0xd')](_0x28acc0['options']['include'],function(_0x227832){return{'model':db[_0x227832[_0xe9dd('0xe')]],'as':_0x227832['as'],'attributes':_0x227832[_0xe9dd('0xf')],'include':_0x227832['include']?_['map'](_0x227832[_0xe9dd('0xc')],function(_0x57baea){return{'model':db[_0x57baea[_0xe9dd('0xe')]],'as':_0x57baea['as'],'attributes':_0x57baea[_0xe9dd('0xf')],'include':_0x57baea[_0xe9dd('0xc')]?_[_0xe9dd('0xd')](_0x57baea[_0xe9dd('0xc')],function(_0x1e5eaa){return{'model':db[_0x1e5eaa[_0xe9dd('0xe')]],'as':_0x1e5eaa['as'],'attributes':_0x1e5eaa[_0xe9dd('0xf')]};}):[]};}):[]};}):[]:[]})[_0xe9dd('0x10')](function(_0x1e5256){logger[_0xe9dd('0x11')](_0xe9dd('0x12'),_0x28acc0);logger[_0xe9dd('0x13')](_0xe9dd('0x12'),_0x28acc0,JSON[_0xe9dd('0x14')](_0x1e5256));_0x349e0e(_0x1e5256);})['catch'](function(_0x1b5e85){logger[_0xe9dd('0x15')](_0xe9dd('0x12'),_0x1b5e85[_0xe9dd('0x16')],_0x28acc0);_0x38e1b9(_0x54078b[_0xe9dd('0x15')](0x1f4,_0x1b5e85[_0xe9dd('0x16')]));});});};exports[_0xe9dd('0x17')]=function(_0x4ef7e4){var _0x45feaf=this;return new Promise(function(_0x50700a,_0x26a787){return db['CmHopper']['find']({'raw':_0x4ef7e4[_0xe9dd('0x8')]?_0x4ef7e4['options'][_0xe9dd('0x9')]===undefined?!![]:![]:!![],'where':_0x4ef7e4[_0xe9dd('0x8')]?_0x4ef7e4[_0xe9dd('0x8')][_0xe9dd('0xa')]||null:null,'attributes':_0x4ef7e4[_0xe9dd('0x8')]?_0x4ef7e4['options']['attributes']||null:null,'include':_0x4ef7e4['options']?_0x4ef7e4[_0xe9dd('0x8')][_0xe9dd('0xc')]?_[_0xe9dd('0xd')](_0x4ef7e4[_0xe9dd('0x8')]['include'],function(_0x349e1c){return{'model':db[_0x349e1c['model']],'as':_0x349e1c['as'],'attributes':_0x349e1c[_0xe9dd('0xf')],'include':_0x349e1c[_0xe9dd('0xc')]?_[_0xe9dd('0xd')](_0x349e1c[_0xe9dd('0xc')],function(_0x10c99d){return{'model':db[_0x10c99d[_0xe9dd('0xe')]],'as':_0x10c99d['as'],'attributes':_0x10c99d[_0xe9dd('0xf')],'include':_0x10c99d['include']?_[_0xe9dd('0xd')](_0x10c99d[_0xe9dd('0xc')],function(_0x52969a){return{'model':db[_0x52969a[_0xe9dd('0xe')]],'as':_0x52969a['as'],'attributes':_0x52969a['attributes']};}):[]};}):[]};}):[]:[]})[_0xe9dd('0x10')](function(_0x1ec997){logger[_0xe9dd('0x11')](_0xe9dd('0x17'),_0x4ef7e4);logger[_0xe9dd('0x13')](_0xe9dd('0x17'),_0x4ef7e4,JSON[_0xe9dd('0x14')](_0x1ec997));_0x50700a(_0x1ec997);})[_0xe9dd('0x18')](function(_0xa8c3fe){logger[_0xe9dd('0x15')](_0xe9dd('0x17'),_0xa8c3fe[_0xe9dd('0x16')],_0x4ef7e4);_0x26a787(_0x45feaf[_0xe9dd('0x15')](0x1f4,_0xa8c3fe[_0xe9dd('0x16')]));});});};exports[_0xe9dd('0x19')]=function(_0xe5fa56){var _0x381878=this;return new Promise(function(_0x393d96,_0x230085){return db[_0xe9dd('0x6')][_0xe9dd('0x1a')](_0xe5fa56[_0xe9dd('0x1b')],{'raw':_0xe5fa56['options']?_0xe5fa56[_0xe9dd('0x8')][_0xe9dd('0x9')]===undefined?!![]:![]:!![]})['then'](function(_0x3bcd14){logger[_0xe9dd('0x11')](_0xe9dd('0x19'),_0xe5fa56);logger[_0xe9dd('0x13')]('CreateCmHopper',_0xe5fa56,JSON[_0xe9dd('0x14')](_0x3bcd14));_0x393d96(_0x3bcd14);})[_0xe9dd('0x18')](function(_0x18d71a){logger[_0xe9dd('0x15')](_0xe9dd('0x19'),_0x18d71a[_0xe9dd('0x16')],_0xe5fa56);_0x230085(_0x381878['error'](0x1f4,_0x18d71a[_0xe9dd('0x16')]));});});};exports[_0xe9dd('0x1c')]=function(_0x4ed3ee){var _0x4cd61c=this;return new Promise(function(_0x576f0e,_0x462d6e){return db[_0xe9dd('0x6')][_0xe9dd('0x1d')](_0x4ed3ee['body'],{'raw':_0x4ed3ee[_0xe9dd('0x8')]?_0x4ed3ee['options'][_0xe9dd('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4ed3ee[_0xe9dd('0x8')]?_0x4ed3ee[_0xe9dd('0x8')]['where']||null:null,'attributes':_0x4ed3ee[_0xe9dd('0x8')]?_0x4ed3ee[_0xe9dd('0x8')][_0xe9dd('0xf')]||null:null,'limit':_0x4ed3ee[_0xe9dd('0x8')]?_0x4ed3ee[_0xe9dd('0x8')]['limit']||null:null})[_0xe9dd('0x10')](function(_0x2c9987){logger[_0xe9dd('0x11')](_0xe9dd('0x1c'),_0x4ed3ee);logger[_0xe9dd('0x11')](_0xe9dd('0x1e'),JSON[_0xe9dd('0x14')](_0x4ed3ee[_0xe9dd('0x8')][_0xe9dd('0xa')]),_0x4ed3ee[_0xe9dd('0x1b')][_0xe9dd('0x1f')]);logger[_0xe9dd('0x13')](_0xe9dd('0x1c'),_0x4ed3ee,JSON[_0xe9dd('0x14')](_0x2c9987));_0x576f0e(_0x2c9987);})[_0xe9dd('0x18')](function(_0x4435d1){logger[_0xe9dd('0x15')](_0xe9dd('0x1c'),_0x4435d1[_0xe9dd('0x16')],_0x4ed3ee);_0x462d6e(_0x4cd61c[_0xe9dd('0x15')](0x1f4,_0x4435d1['message']));});});};exports[_0xe9dd('0x20')]=function(_0x3cceca){var _0x5dc27b=this;return new Promise(function(_0x31cc0f,_0x33b449){return db[_0xe9dd('0x6')][_0xe9dd('0x21')]({'where':_0x3cceca['options']?_0x3cceca[_0xe9dd('0x8')][_0xe9dd('0xa')]||null:null})['then'](function(_0xd85494){logger[_0xe9dd('0x11')](_0xe9dd('0x20'),_0x3cceca);logger[_0xe9dd('0x13')]('DestroyCmHopper',_0x3cceca,JSON[_0xe9dd('0x14')](_0xd85494));_0x31cc0f(_0xd85494);})['catch'](function(_0x12c7df){logger[_0xe9dd('0x15')](_0xe9dd('0x20'),_0x12c7df['message'],_0x3cceca);_0x33b449(_0x5dc27b[_0xe9dd('0x15')](0x1f4,_0x12c7df[_0xe9dd('0x16')]));});});};exports['GetContactDialer']=function(_0x31ba68){var _0x434f4b=this;return new Promise(function(_0xb22b73,_0x48bd27){return db[_0xe9dd('0x22')][_0xe9dd('0x23')]()[_0xe9dd('0x10')](function(_0x5d5554){return db['sequelize'][_0xe9dd('0x24')](function(_0x1c1246){return db[_0xe9dd('0x6')][_0xe9dd('0x7')]({'where':_0x31ba68[_0xe9dd('0x8')]?_0x31ba68[_0xe9dd('0x8')][_0xe9dd('0xa')]||null:null,'attributes':_0x31ba68['options']?_0x31ba68[_0xe9dd('0x8')]['attributes']||null:null,'limit':_0x31ba68['options']?_0x31ba68[_0xe9dd('0x8')][_0xe9dd('0xb')]||null:null,'order':_0x31ba68[_0xe9dd('0x8')]?_0x31ba68['options'][_0xe9dd('0x25')]||null:null,'transaction':_0x1c1246,'lock':_0x1c1246['LOCK'][_0xe9dd('0x26')],'include':[{'model':db[_0xe9dd('0x22')],'as':_0xe9dd('0x27'),'attributes':_[_0xe9dd('0x28')](_0x5d5554)},{'model':db[_0xe9dd('0x29')],'as':'Agent','attributes':['id',_0xe9dd('0x2a'),_0xe9dd('0x2b')]}]})['then'](function(_0x33dc2f){var _0x2d1e3a=[];var _0x178162=[];for(var _0xfb11b4=0x0;_0xfb11b4<_0x33dc2f['length'];_0xfb11b4+=0x1){var _0x163613=_0x33dc2f[_0xfb11b4]['UserId'];if(_0x163613===null){_0x2d1e3a[_0xe9dd('0x2c')](_0x33dc2f[_0xfb11b4][_0xe9dd('0x1d')](_0x31ba68[_0xe9dd('0x1b')],{'transaction':_0x1c1246}));}else if(!_0x178162['includes'](_0x163613)){_0x178162[_0xe9dd('0x2c')](_0x163613);_0x2d1e3a['push'](_0x33dc2f[_0xfb11b4][_0xe9dd('0x1d')](_0x31ba68['body'],{'transaction':_0x1c1246}));}}return BPromise[_0xe9dd('0x2d')](_0x2d1e3a);});})[_0xe9dd('0x10')](function(_0x305844){logger[_0xe9dd('0x11')]('GetContactDialer',_0x31ba68);if(_0x305844[_0xe9dd('0x2e')]>0x0){logger[_0xe9dd('0x11')](_0xe9dd('0x2f'),_0x305844[0x0]['dataValues']['id'],_0x305844[0x0][_0xe9dd('0x30')][_0xe9dd('0x31')],_0x305844[0x0][_0xe9dd('0x30')][_0xe9dd('0x1f')]);}logger['debug'](_0xe9dd('0x32'),_0x31ba68,JSON[_0xe9dd('0x14')](_0x305844));_0xb22b73(_0x305844);})[_0xe9dd('0x18')](function(_0x29c7a2){logger[_0xe9dd('0x15')](_0xe9dd('0x32'),_0x29c7a2[_0xe9dd('0x16')],_0x31ba68);_0x48bd27(_0x434f4b['error'](0x1f4,_0x29c7a2['message']));});});});};exports[_0xe9dd('0x33')]=function(_0x52de31){var _0x18d135=this;return new Promise(function(_0x155d6c,_0x3b97d7){return db[_0xe9dd('0x34')][_0xe9dd('0x24')](function(_0x14c740){return db[_0xe9dd('0x35')][_0xe9dd('0x1a')](_0x52de31[_0xe9dd('0x1b')],{'raw':_0x52de31[_0xe9dd('0x8')]?_0x52de31[_0xe9dd('0x8')][_0xe9dd('0x9')]===undefined?!![]:![]:!![],'transaction':_0x14c740})['then'](function(){logger[_0xe9dd('0x11')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x52de31[_0xe9dd('0x8')][_0xe9dd('0xa')]),_0x52de31[_0xe9dd('0x8')]['where'][_0xe9dd('0x1f')]);return db['CmHopper'][_0xe9dd('0x21')]({'where':_0x52de31['options']?_0x52de31['options'][_0xe9dd('0xa')]||null:null,'transaction':_0x14c740});});})['then'](function(_0x55e1f7){logger['info'](_0xe9dd('0x33'),_0x52de31);logger['debug']('MoveContactManagedDialer',_0x52de31,JSON['stringify'](_0x55e1f7));_0x155d6c(_0x55e1f7);})[_0xe9dd('0x18')](function(_0x38c0ed){logger[_0xe9dd('0x15')]('MoveContactManagedDialer',_0x38c0ed[_0xe9dd('0x16')],_0x52de31);_0x3b97d7(_0x18d135['error'](0x1f4,_0x38c0ed[_0xe9dd('0x16')]));});});};exports[_0xe9dd('0x36')]=function(_0x402024){var _0x213918=this;return new Promise(function(_0x3f5a35,_0x2495e6){return db['CmHopper'][_0xe9dd('0x7')]({'raw':_0x402024[_0xe9dd('0x8')]?_0x402024[_0xe9dd('0x8')][_0xe9dd('0x9')]===undefined?!![]:![]:!![],'where':_0x402024[_0xe9dd('0x8')]?_0x402024['options']['where']||null:null,'attributes':[[db[_0xe9dd('0x34')]['fn'](_0xe9dd('0x37'),db[_0xe9dd('0x34')]['fn']('IF',db[_0xe9dd('0x34')][_0xe9dd('0x38')](_0xe9dd('0x39')+util[_0xe9dd('0x3a')](_0xe9dd('0x3b'),moment()[_0xe9dd('0x3a')](_0xe9dd('0x3c')))+_0xe9dd('0x3d')))),_0xe9dd('0x3e')]]})[_0xe9dd('0x10')](function(_0x346f79){logger[_0xe9dd('0x11')](_0xe9dd('0x36'),_0x402024);logger['debug'](_0xe9dd('0x36'),_0x402024,JSON['stringify'](_0x346f79));_0x3f5a35(_0x346f79);})[_0xe9dd('0x18')](function(_0x10ebdd){logger['error'](_0xe9dd('0x36'),_0x10ebdd[_0xe9dd('0x16')],_0x402024);_0x2495e6(_0x213918['error'](0x1f4,_0x10ebdd[_0xe9dd('0x16')]));});});};exports[_0xe9dd('0x3f')]=function(_0x551928){var _0x3431e4=this;return new Promise(function(_0x496eb5,_0x636ca9){return db['CmContact'][_0xe9dd('0x23')]()[_0xe9dd('0x10')](function(){return db['sequelize'][_0xe9dd('0x24')](function(_0xf45158){return db[_0xe9dd('0x6')][_0xe9dd('0x7')]({'where':_0x551928['options']?_0x551928[_0xe9dd('0x8')][_0xe9dd('0xa')]||null:null,'attributes':_0x551928[_0xe9dd('0x8')]?_0x551928[_0xe9dd('0x8')][_0xe9dd('0xf')]||null:null,'limit':0x1,'order':_0x551928[_0xe9dd('0x8')]?_0x551928[_0xe9dd('0x8')]['order']||null:null,'group':db['CmHopper']['UserId'],'transaction':_0xf45158,'lock':_0xf45158[_0xe9dd('0x40')]['UPDATE'],'include':_0x551928['options']?_0x551928[_0xe9dd('0x8')][_0xe9dd('0xc')]?_[_0xe9dd('0xd')](_0x551928[_0xe9dd('0x8')][_0xe9dd('0xc')],function(_0x228dc5){return{'model':db[_0x228dc5['model']],'as':_0x228dc5['as'],'attributes':_0x228dc5['attributes'],'include':_0x228dc5[_0xe9dd('0xc')]?_[_0xe9dd('0xd')](_0x228dc5[_0xe9dd('0xc')],function(_0x31bf88){return{'model':db[_0x31bf88[_0xe9dd('0xe')]],'as':_0x31bf88['as'],'attributes':_0x31bf88[_0xe9dd('0xf')],'include':_0x31bf88[_0xe9dd('0xc')]?_['map'](_0x31bf88[_0xe9dd('0xc')],function(_0x38c3b7){return{'model':db[_0x38c3b7['model']],'as':_0x38c3b7['as'],'attributes':_0x38c3b7[_0xe9dd('0xf')]};}):[]};}):[]};}):[]:[]})[_0xe9dd('0x10')](function(_0x4e1fb8){var _0x502cb1=[];for(var _0x138fb2=0x0;_0x138fb2<_0x4e1fb8[_0xe9dd('0x2e')];_0x138fb2+=0x1){_0x502cb1[_0xe9dd('0x2c')](_0x4e1fb8[_0x138fb2][_0xe9dd('0x1d')](_0x551928[_0xe9dd('0x1b')],{'transaction':_0xf45158}));}return BPromise['all'](_0x502cb1);});})[_0xe9dd('0x10')](function(_0xfbe24c){logger[_0xe9dd('0x11')]('GetContactRecallMe',_0x551928);logger['debug'](_0xe9dd('0x3f'),_0x551928,JSON[_0xe9dd('0x14')](_0xfbe24c));_0x496eb5(_0xfbe24c);})[_0xe9dd('0x18')](function(_0x48c4a6){logger[_0xe9dd('0x15')](_0xe9dd('0x3f'),_0x48c4a6[_0xe9dd('0x16')],_0x551928);_0x636ca9(_0x3431e4[_0xe9dd('0x15')](0x1f4,_0x48c4a6['message']));});});});};exports[_0xe9dd('0x41')]=function(_0x1095f4){var _0x3eec5c=this;return new Promise(function(_0x3092c1,_0x175046){db[_0xe9dd('0x22')][_0xe9dd('0x23')]()[_0xe9dd('0x10')](function(_0x2d576a){return db[_0xe9dd('0x6')][_0xe9dd('0x7')]({'raw':_0x1095f4[_0xe9dd('0x8')]?_0x1095f4[_0xe9dd('0x8')][_0xe9dd('0x9')]===undefined?!![]:![]:!![],'where':_0x1095f4[_0xe9dd('0x8')]?_0x1095f4[_0xe9dd('0x8')][_0xe9dd('0xa')]||null:null,'attributes':_0x1095f4[_0xe9dd('0x8')]?_0x1095f4['options'][_0xe9dd('0xf')]||null:null,'limit':_0x1095f4[_0xe9dd('0x8')]?_0x1095f4[_0xe9dd('0x8')][_0xe9dd('0xb')]||null:null,'include':_0x1095f4[_0xe9dd('0x8')]?_0x1095f4[_0xe9dd('0x8')][_0xe9dd('0xc')]?_['map'](_0x1095f4[_0xe9dd('0x8')][_0xe9dd('0xc')],function(_0x3689d1){return{'model':db[_0x3689d1[_0xe9dd('0xe')]],'as':_0x3689d1['as'],'attributes':_0x3689d1['as']===_0xe9dd('0x27')?_[_0xe9dd('0x28')](_0x2d576a):_0x3689d1[_0xe9dd('0xf')],'include':_0x3689d1[_0xe9dd('0xc')]?_[_0xe9dd('0xd')](_0x3689d1['include'],function(_0x3260dc){return{'model':db[_0x3260dc[_0xe9dd('0xe')]],'as':_0x3260dc['as'],'attributes':_0x3260dc[_0xe9dd('0xf')],'include':_0x3260dc[_0xe9dd('0xc')]?_['map'](_0x3260dc[_0xe9dd('0xc')],function(_0x34e23a){return{'model':db[_0x34e23a['model']],'as':_0x34e23a['as'],'attributes':_0x34e23a[_0xe9dd('0xf')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3ab0b6){logger[_0xe9dd('0x11')](_0xe9dd('0x12'),_0x1095f4);logger[_0xe9dd('0x13')](_0xe9dd('0x12'),_0x1095f4,JSON[_0xe9dd('0x14')](_0x3ab0b6));_0x3092c1(_0x3ab0b6);})[_0xe9dd('0x18')](function(_0x10e7b1){logger[_0xe9dd('0x15')](_0xe9dd('0x12'),_0x10e7b1['message'],_0x1095f4);_0x175046(_0x3eec5c['error'](0x1f4,_0x10e7b1[_0xe9dd('0x16')]));});});});};exports[_0xe9dd('0x42')]=function(_0x3b3330){var _0x22b36e=this;return new Promise(function(_0x31cfb4,_0x3aaa11){return db['CmContact'][_0xe9dd('0x43')]({'raw':!![],'where':{'phone':_0x3b3330[_0xe9dd('0x8')][_0xe9dd('0xa')][_0xe9dd('0x44')]},'attributes':['id',_0xe9dd('0x45')],'order':[['id',_0xe9dd('0x46')]]})[_0xe9dd('0x10')](function(_0x2d9663){logger['info'](_0xe9dd('0x47'),_0x3b3330);logger[_0xe9dd('0x13')](_0xe9dd('0x47'),_0x3b3330,JSON[_0xe9dd('0x14')](_0x2d9663));_0x31cfb4(_0x2d9663);})[_0xe9dd('0x18')](function(_0x4601b8){logger['error'](_0xe9dd('0x47'),_0x4601b8[_0xe9dd('0x16')],_0x3b3330);_0x3aaa11(_0x22b36e[_0xe9dd('0x15')](0x1f4,_0x4601b8[_0xe9dd('0x16')]));});});};exports[_0xe9dd('0x48')]=function(_0x8dfd71){var _0x397a91=this;return new Promise(function(_0x575c48,_0x1061c1){return db['sequelize'][_0xe9dd('0x24')](function(_0x4ad0cb){var _0x183280=_0x8dfd71[_0xe9dd('0x8')]&&_0x8dfd71[_0xe9dd('0x8')][_0xe9dd('0xa')]?_0x8dfd71['options'][_0xe9dd('0xa')]:{};return db['CmHopper'][_0xe9dd('0x1d')](_0x8dfd71[_0xe9dd('0x1b')],{'where':_0x183280,'transaction':_0x4ad0cb})[_0xe9dd('0x10')](function(_0x3a4d01){logger[_0xe9dd('0x11')](_0xe9dd('0x48'),_0x8dfd71);logger[_0xe9dd('0x13')](_0xe9dd('0x48'),_0x8dfd71,JSON[_0xe9dd('0x14')](_0x3a4d01));_0x575c48(_0x3a4d01);})['catch'](function(_0x38cfbf){logger[_0xe9dd('0x15')](_0xe9dd('0x48'),_0x38cfbf[_0xe9dd('0x16')],_0x8dfd71);_0x1061c1(_0x397a91[_0xe9dd('0x15')](0x1f4,_0x38cfbf['message']));});});});};exports[_0xe9dd('0x49')]=function(_0x7a9f71){var _0x51415c=this;var _0x5cc548=_0x7a9f71[_0xe9dd('0x1b')][_0xe9dd('0xa')][_0xe9dd('0x4a')];var _0xf48dec=_0x7a9f71[_0xe9dd('0x1b')][_0xe9dd('0xa')][_0xe9dd('0x4b')];var _0x146bb6=_0x7a9f71['body'][_0xe9dd('0xa')][_0xe9dd('0x4c')];return new Promise(function(_0x3e80a5,_0x5a176b){return db['CmHopper'][_0xe9dd('0x7')]({'where':{'voiceQueueId':{'$in':_0x5cc548},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0xe9dd('0x34')]['literal'](_0xe9dd('0x4d')+_0xf48dec+_0xe9dd('0x4e')),'$gt':db[_0xe9dd('0x34')][_0xe9dd('0x38')](_0xe9dd('0x4f'))}},'UserId':{'$in':_0x146bb6}},'include':[{'model':db[_0xe9dd('0x22')],'as':_0xe9dd('0x27')},{'model':db[_0xe9dd('0x29')],'as':_0xe9dd('0x50'),'attributes':['id',_0xe9dd('0x2a'),_0xe9dd('0x2b')]},{'model':db[_0xe9dd('0x51')],'as':_0xe9dd('0x52')}]})[_0xe9dd('0x10')](function(_0x58cb8c){if(_0x58cb8c['length']>0x0){return db['sequelize'][_0xe9dd('0x24')](function(_0x4c1e82){return db[_0xe9dd('0x6')][_0xe9dd('0x1d')]({'recallmeNotifiedDate':db[_0xe9dd('0x34')][_0xe9dd('0x38')](_0xe9dd('0x4f'))},{'where':{'id':{'$in':_['map'](_0x58cb8c,'id')}},'transaction':_0x4c1e82})[_0xe9dd('0x10')](function(){_0x3e80a5(_0x58cb8c);})['catch'](function(_0x1f786d){logger[_0xe9dd('0x15')](_0xe9dd('0x49'),_0x1f786d[_0xe9dd('0x16')],_0x7a9f71);_0x5a176b(_0x51415c['error'](0x1f4,_0x1f786d[_0xe9dd('0x16')]));});})[_0xe9dd('0x18')](function(_0x47e5ce){logger[_0xe9dd('0x15')](_0xe9dd('0x49'),_0x47e5ce[_0xe9dd('0x16')],_0x7a9f71);_0x5a176b(_0x51415c[_0xe9dd('0x15')](0x1f4,_0x47e5ce[_0xe9dd('0x16')]));});}else{_0x3e80a5(_0x58cb8c);}});});}; \ No newline at end of file +var _0x3467=['GetContactDialer','dataValues','ContactId','MoveContactManagedDialer','sequelize','transaction','CmHopperFinal','CountReScheduled','literal','`scheduledat`\x20>=\x20','format','YYYY-MM-DD\x20HH:mm:ss','\x20,\x201,\x20null','GetContactRecallMe','describe','UPDATE','GetCmHopperPreview','Contact','GetContactByPhone','findOne','phone','dialTimezone','DESC','getContactByPhone','ResetActiveCalls','CmHopperHandlePreviewRecallNotifications','voiceQueueIds','interval','availableAgentsIds','\x20MINUTE','CmList','List','NOW()','lodash','util','../../mysqldb','../../config/logger','rpc','GetCmHopper','CmHopper','findAll','options','raw','where','attributes','limit','include','map','model','then','info','stringify','error','message','find','ShowCmHopper','debug','CreateCmHopper','create','body','catch','UpdateCmHopper','update','UpdateCmHopper\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]','active','DestroyCmHopper','destroy','order','LOCK','CmContact','keys','Agent','name','voicePause','length','UserId','push','includes','all'];(function(_0x26e0a4,_0x41c372){var _0x209666=function(_0x36b672){while(--_0x36b672){_0x26e0a4['push'](_0x26e0a4['shift']());}};_0x209666(++_0x41c372);}(_0x3467,0x15d));var _0x7346=function(_0x3f8718,_0x2e4126){_0x3f8718=_0x3f8718-0x0;var _0x340d05=_0x3467[_0x3f8718];return _0x340d05;};'use strict';var _=require(_0x7346('0x0'));var util=require(_0x7346('0x1'));var moment=require('moment');var BPromise=require('bluebird');var db=require(_0x7346('0x2'))['db'];var logger=require(_0x7346('0x3'))(_0x7346('0x4'));exports[_0x7346('0x5')]=function(_0x15e842){var _0x31dbf4=this;return new Promise(function(_0x2d3f13,_0x5aff8f){return db[_0x7346('0x6')][_0x7346('0x7')]({'raw':_0x15e842[_0x7346('0x8')]?_0x15e842[_0x7346('0x8')][_0x7346('0x9')]===undefined?!![]:![]:!![],'where':_0x15e842['options']?_0x15e842[_0x7346('0x8')][_0x7346('0xa')]||null:null,'attributes':_0x15e842[_0x7346('0x8')]?_0x15e842[_0x7346('0x8')][_0x7346('0xb')]||null:null,'limit':_0x15e842['options']?_0x15e842[_0x7346('0x8')][_0x7346('0xc')]||null:null,'include':_0x15e842[_0x7346('0x8')]?_0x15e842['options'][_0x7346('0xd')]?_[_0x7346('0xe')](_0x15e842[_0x7346('0x8')]['include'],function(_0x59cad0){return{'model':db[_0x59cad0[_0x7346('0xf')]],'as':_0x59cad0['as'],'attributes':_0x59cad0['attributes'],'include':_0x59cad0['include']?_[_0x7346('0xe')](_0x59cad0[_0x7346('0xd')],function(_0xde477d){return{'model':db[_0xde477d[_0x7346('0xf')]],'as':_0xde477d['as'],'attributes':_0xde477d[_0x7346('0xb')],'include':_0xde477d[_0x7346('0xd')]?_[_0x7346('0xe')](_0xde477d[_0x7346('0xd')],function(_0x399bfb){return{'model':db[_0x399bfb[_0x7346('0xf')]],'as':_0x399bfb['as'],'attributes':_0x399bfb[_0x7346('0xb')]};}):[]};}):[]};}):[]:[]})[_0x7346('0x10')](function(_0x44acf9){logger[_0x7346('0x11')]('GetCmHopper',_0x15e842);logger['debug'](_0x7346('0x5'),_0x15e842,JSON[_0x7346('0x12')](_0x44acf9));_0x2d3f13(_0x44acf9);})['catch'](function(_0x1b158a){logger['error'](_0x7346('0x5'),_0x1b158a['message'],_0x15e842);_0x5aff8f(_0x31dbf4[_0x7346('0x13')](0x1f4,_0x1b158a[_0x7346('0x14')]));});});};exports['ShowCmHopper']=function(_0xed95d2){var _0x3d0882=this;return new Promise(function(_0x5dace5,_0x9de910){return db['CmHopper'][_0x7346('0x15')]({'raw':_0xed95d2['options']?_0xed95d2['options']['raw']===undefined?!![]:![]:!![],'where':_0xed95d2[_0x7346('0x8')]?_0xed95d2[_0x7346('0x8')]['where']||null:null,'attributes':_0xed95d2[_0x7346('0x8')]?_0xed95d2['options'][_0x7346('0xb')]||null:null,'include':_0xed95d2[_0x7346('0x8')]?_0xed95d2[_0x7346('0x8')][_0x7346('0xd')]?_[_0x7346('0xe')](_0xed95d2[_0x7346('0x8')][_0x7346('0xd')],function(_0x12f573){return{'model':db[_0x12f573['model']],'as':_0x12f573['as'],'attributes':_0x12f573[_0x7346('0xb')],'include':_0x12f573[_0x7346('0xd')]?_[_0x7346('0xe')](_0x12f573['include'],function(_0x4506b1){return{'model':db[_0x4506b1[_0x7346('0xf')]],'as':_0x4506b1['as'],'attributes':_0x4506b1[_0x7346('0xb')],'include':_0x4506b1[_0x7346('0xd')]?_[_0x7346('0xe')](_0x4506b1[_0x7346('0xd')],function(_0x2458a6){return{'model':db[_0x2458a6['model']],'as':_0x2458a6['as'],'attributes':_0x2458a6[_0x7346('0xb')]};}):[]};}):[]};}):[]:[]})[_0x7346('0x10')](function(_0x425518){logger[_0x7346('0x11')](_0x7346('0x16'),_0xed95d2);logger[_0x7346('0x17')](_0x7346('0x16'),_0xed95d2,JSON[_0x7346('0x12')](_0x425518));_0x5dace5(_0x425518);})['catch'](function(_0x34984e){logger[_0x7346('0x13')](_0x7346('0x16'),_0x34984e['message'],_0xed95d2);_0x9de910(_0x3d0882[_0x7346('0x13')](0x1f4,_0x34984e['message']));});});};exports[_0x7346('0x18')]=function(_0xc6537e){var _0x6a6e22=this;return new Promise(function(_0x4e6bbf,_0x578e66){return db[_0x7346('0x6')][_0x7346('0x19')](_0xc6537e[_0x7346('0x1a')],{'raw':_0xc6537e['options']?_0xc6537e[_0x7346('0x8')][_0x7346('0x9')]===undefined?!![]:![]:!![]})[_0x7346('0x10')](function(_0x1d7a1e){logger[_0x7346('0x11')](_0x7346('0x18'),_0xc6537e);logger[_0x7346('0x17')](_0x7346('0x18'),_0xc6537e,JSON[_0x7346('0x12')](_0x1d7a1e));_0x4e6bbf(_0x1d7a1e);})[_0x7346('0x1b')](function(_0x5c69a0){logger['error']('CreateCmHopper',_0x5c69a0[_0x7346('0x14')],_0xc6537e);_0x578e66(_0x6a6e22[_0x7346('0x13')](0x1f4,_0x5c69a0[_0x7346('0x14')]));});});};exports[_0x7346('0x1c')]=function(_0x441f6d){var _0x4ba095=this;return new Promise(function(_0x51c45c,_0xd80ac2){return db[_0x7346('0x6')][_0x7346('0x1d')](_0x441f6d['body'],{'raw':_0x441f6d[_0x7346('0x8')]?_0x441f6d[_0x7346('0x8')][_0x7346('0x9')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x441f6d[_0x7346('0x8')]?_0x441f6d[_0x7346('0x8')][_0x7346('0xa')]||null:null,'attributes':_0x441f6d['options']?_0x441f6d[_0x7346('0x8')][_0x7346('0xb')]||null:null,'limit':_0x441f6d[_0x7346('0x8')]?_0x441f6d[_0x7346('0x8')]['limit']||null:null})[_0x7346('0x10')](function(_0x54e057){logger[_0x7346('0x11')](_0x7346('0x1c'),_0x441f6d);logger[_0x7346('0x11')](_0x7346('0x1e'),JSON[_0x7346('0x12')](_0x441f6d[_0x7346('0x8')][_0x7346('0xa')]),_0x441f6d[_0x7346('0x1a')][_0x7346('0x1f')]);logger[_0x7346('0x17')](_0x7346('0x1c'),_0x441f6d,JSON[_0x7346('0x12')](_0x54e057));_0x51c45c(_0x54e057);})[_0x7346('0x1b')](function(_0x3f9edb){logger[_0x7346('0x13')](_0x7346('0x1c'),_0x3f9edb['message'],_0x441f6d);_0xd80ac2(_0x4ba095[_0x7346('0x13')](0x1f4,_0x3f9edb['message']));});});};exports[_0x7346('0x20')]=function(_0x339983){var _0x80d289=this;return new Promise(function(_0x2753d8,_0x2d84c4){return db[_0x7346('0x6')][_0x7346('0x21')]({'where':_0x339983[_0x7346('0x8')]?_0x339983[_0x7346('0x8')][_0x7346('0xa')]||null:null})[_0x7346('0x10')](function(_0x590bc0){logger[_0x7346('0x11')](_0x7346('0x20'),_0x339983);logger[_0x7346('0x17')](_0x7346('0x20'),_0x339983,JSON[_0x7346('0x12')](_0x590bc0));_0x2753d8(_0x590bc0);})[_0x7346('0x1b')](function(_0x17ec9d){logger[_0x7346('0x13')](_0x7346('0x20'),_0x17ec9d[_0x7346('0x14')],_0x339983);_0x2d84c4(_0x80d289['error'](0x1f4,_0x17ec9d[_0x7346('0x14')]));});});};exports['GetContactDialer']=function(_0x739b23){var _0x29a5e7=this;return new Promise(function(_0x2c9858,_0x310a03){return db['CmContact']['describe']()[_0x7346('0x10')](function(_0x138144){return db['sequelize']['transaction'](function(_0x3b5145){return db[_0x7346('0x6')][_0x7346('0x7')]({'where':_0x739b23['options']?_0x739b23[_0x7346('0x8')][_0x7346('0xa')]||null:null,'attributes':_0x739b23[_0x7346('0x8')]?_0x739b23[_0x7346('0x8')]['attributes']||null:null,'limit':_0x739b23['options']?_0x739b23[_0x7346('0x8')][_0x7346('0xc')]||null:null,'order':_0x739b23['options']?_0x739b23['options'][_0x7346('0x22')]||null:null,'transaction':_0x3b5145,'lock':_0x3b5145[_0x7346('0x23')]['UPDATE'],'include':[{'model':db[_0x7346('0x24')],'as':'Contact','attributes':_[_0x7346('0x25')](_0x138144)},{'model':db['User'],'as':_0x7346('0x26'),'attributes':['id',_0x7346('0x27'),_0x7346('0x28')]}]})[_0x7346('0x10')](function(_0x742588){var _0x377f13=[];var _0xdefe0c=[];for(var _0x2a33fe=0x0;_0x2a33fe<_0x742588[_0x7346('0x29')];_0x2a33fe+=0x1){var _0x20f124=_0x742588[_0x2a33fe][_0x7346('0x2a')];if(_0x20f124===null){_0x377f13[_0x7346('0x2b')](_0x742588[_0x2a33fe][_0x7346('0x1d')](_0x739b23['body'],{'transaction':_0x3b5145}));}else if(!_0xdefe0c[_0x7346('0x2c')](_0x20f124)){_0xdefe0c[_0x7346('0x2b')](_0x20f124);_0x377f13[_0x7346('0x2b')](_0x742588[_0x2a33fe]['update'](_0x739b23[_0x7346('0x1a')],{'transaction':_0x3b5145}));}}return BPromise[_0x7346('0x2d')](_0x377f13);});})[_0x7346('0x10')](function(_0x3d619f){logger[_0x7346('0x11')](_0x7346('0x2e'),_0x739b23);if(_0x3d619f[_0x7346('0x29')]>0x0){logger[_0x7346('0x11')]('GetContactDialer\x20hopperId\x20[%s]\x20-\x20contactId\x20[%s]\x20-\x20active\x20status\x20[%s]',_0x3d619f[0x0]['dataValues']['id'],_0x3d619f[0x0][_0x7346('0x2f')][_0x7346('0x30')],_0x3d619f[0x0][_0x7346('0x2f')][_0x7346('0x1f')]);}logger['debug'](_0x7346('0x2e'),_0x739b23,JSON[_0x7346('0x12')](_0x3d619f));_0x2c9858(_0x3d619f);})['catch'](function(_0x25483a){logger[_0x7346('0x13')](_0x7346('0x2e'),_0x25483a[_0x7346('0x14')],_0x739b23);_0x310a03(_0x29a5e7[_0x7346('0x13')](0x1f4,_0x25483a['message']));});});});};exports[_0x7346('0x31')]=function(_0x2ac27a){var _0x1563e1=this;return new Promise(function(_0x3e4661,_0x15903a){return db[_0x7346('0x32')][_0x7346('0x33')](function(_0x5c219a){return db[_0x7346('0x34')]['create'](_0x2ac27a['body'],{'raw':_0x2ac27a[_0x7346('0x8')]?_0x2ac27a['options'][_0x7346('0x9')]===undefined?!![]:![]:!![],'transaction':_0x5c219a})['then'](function(){logger[_0x7346('0x11')]('MoveContactManagedDialer\x20hopper\x20options\x20[%s]\x20active\x20status\x20[%s]',JSON['stringify'](_0x2ac27a[_0x7346('0x8')][_0x7346('0xa')]),_0x2ac27a[_0x7346('0x8')][_0x7346('0xa')][_0x7346('0x1f')]);return db[_0x7346('0x6')][_0x7346('0x21')]({'where':_0x2ac27a[_0x7346('0x8')]?_0x2ac27a[_0x7346('0x8')][_0x7346('0xa')]||null:null,'transaction':_0x5c219a});});})[_0x7346('0x10')](function(_0x3c1e39){logger['info'](_0x7346('0x31'),_0x2ac27a);logger[_0x7346('0x17')](_0x7346('0x31'),_0x2ac27a,JSON['stringify'](_0x3c1e39));_0x3e4661(_0x3c1e39);})[_0x7346('0x1b')](function(_0x308e19){logger[_0x7346('0x13')](_0x7346('0x31'),_0x308e19['message'],_0x2ac27a);_0x15903a(_0x1563e1[_0x7346('0x13')](0x1f4,_0x308e19[_0x7346('0x14')]));});});};exports[_0x7346('0x35')]=function(_0x28b41d){var _0x1ee4e4=this;return new Promise(function(_0x255331,_0x496465){return db[_0x7346('0x6')][_0x7346('0x7')]({'raw':_0x28b41d[_0x7346('0x8')]?_0x28b41d['options'][_0x7346('0x9')]===undefined?!![]:![]:!![],'where':_0x28b41d['options']?_0x28b41d[_0x7346('0x8')][_0x7346('0xa')]||null:null,'attributes':[[db[_0x7346('0x32')]['fn']('COUNT',db[_0x7346('0x32')]['fn']('IF',db[_0x7346('0x32')][_0x7346('0x36')](_0x7346('0x37')+util[_0x7346('0x38')]('\x22%s\x22',moment()[_0x7346('0x38')](_0x7346('0x39')))+_0x7346('0x3a')))),'contactsRescheduled']]})['then'](function(_0x6cfeac){logger[_0x7346('0x11')](_0x7346('0x35'),_0x28b41d);logger[_0x7346('0x17')](_0x7346('0x35'),_0x28b41d,JSON[_0x7346('0x12')](_0x6cfeac));_0x255331(_0x6cfeac);})['catch'](function(_0x5b43e5){logger[_0x7346('0x13')](_0x7346('0x35'),_0x5b43e5[_0x7346('0x14')],_0x28b41d);_0x496465(_0x1ee4e4[_0x7346('0x13')](0x1f4,_0x5b43e5['message']));});});};exports[_0x7346('0x3b')]=function(_0x26e3b8){var _0x6166ee=this;return new Promise(function(_0x3707c7,_0x334f7b){return db[_0x7346('0x24')][_0x7346('0x3c')]()[_0x7346('0x10')](function(){return db['sequelize'][_0x7346('0x33')](function(_0x5102cc){return db['CmHopper'][_0x7346('0x7')]({'where':_0x26e3b8[_0x7346('0x8')]?_0x26e3b8[_0x7346('0x8')][_0x7346('0xa')]||null:null,'attributes':_0x26e3b8['options']?_0x26e3b8[_0x7346('0x8')][_0x7346('0xb')]||null:null,'limit':0x1,'order':_0x26e3b8[_0x7346('0x8')]?_0x26e3b8[_0x7346('0x8')][_0x7346('0x22')]||null:null,'group':db[_0x7346('0x6')][_0x7346('0x2a')],'transaction':_0x5102cc,'lock':_0x5102cc['LOCK'][_0x7346('0x3d')],'include':_0x26e3b8['options']?_0x26e3b8[_0x7346('0x8')][_0x7346('0xd')]?_[_0x7346('0xe')](_0x26e3b8['options'][_0x7346('0xd')],function(_0x51789b){return{'model':db[_0x51789b['model']],'as':_0x51789b['as'],'attributes':_0x51789b[_0x7346('0xb')],'include':_0x51789b[_0x7346('0xd')]?_['map'](_0x51789b[_0x7346('0xd')],function(_0x2eeb54){return{'model':db[_0x2eeb54['model']],'as':_0x2eeb54['as'],'attributes':_0x2eeb54[_0x7346('0xb')],'include':_0x2eeb54['include']?_['map'](_0x2eeb54[_0x7346('0xd')],function(_0x390c8b){return{'model':db[_0x390c8b[_0x7346('0xf')]],'as':_0x390c8b['as'],'attributes':_0x390c8b[_0x7346('0xb')]};}):[]};}):[]};}):[]:[]})[_0x7346('0x10')](function(_0x1c0498){var _0x2836ac=[];for(var _0x4b6135=0x0;_0x4b6135<_0x1c0498['length'];_0x4b6135+=0x1){_0x2836ac[_0x7346('0x2b')](_0x1c0498[_0x4b6135][_0x7346('0x1d')](_0x26e3b8[_0x7346('0x1a')],{'transaction':_0x5102cc}));}return BPromise[_0x7346('0x2d')](_0x2836ac);});})[_0x7346('0x10')](function(_0x4a3d11){logger['info'](_0x7346('0x3b'),_0x26e3b8);logger[_0x7346('0x17')]('GetContactRecallMe',_0x26e3b8,JSON[_0x7346('0x12')](_0x4a3d11));_0x3707c7(_0x4a3d11);})[_0x7346('0x1b')](function(_0x4400ca){logger[_0x7346('0x13')](_0x7346('0x3b'),_0x4400ca[_0x7346('0x14')],_0x26e3b8);_0x334f7b(_0x6166ee[_0x7346('0x13')](0x1f4,_0x4400ca[_0x7346('0x14')]));});});});};exports[_0x7346('0x3e')]=function(_0x18a519){var _0x4bbeda=this;return new Promise(function(_0x4ea046,_0x122f46){db['CmContact']['describe']()[_0x7346('0x10')](function(_0x11a117){return db[_0x7346('0x6')][_0x7346('0x7')]({'raw':_0x18a519[_0x7346('0x8')]?_0x18a519['options'][_0x7346('0x9')]===undefined?!![]:![]:!![],'where':_0x18a519[_0x7346('0x8')]?_0x18a519[_0x7346('0x8')][_0x7346('0xa')]||null:null,'attributes':_0x18a519['options']?_0x18a519['options'][_0x7346('0xb')]||null:null,'limit':_0x18a519[_0x7346('0x8')]?_0x18a519['options'][_0x7346('0xc')]||null:null,'include':_0x18a519[_0x7346('0x8')]?_0x18a519['options'][_0x7346('0xd')]?_['map'](_0x18a519[_0x7346('0x8')][_0x7346('0xd')],function(_0x35185e){return{'model':db[_0x35185e[_0x7346('0xf')]],'as':_0x35185e['as'],'attributes':_0x35185e['as']===_0x7346('0x3f')?_['keys'](_0x11a117):_0x35185e[_0x7346('0xb')],'include':_0x35185e['include']?_[_0x7346('0xe')](_0x35185e[_0x7346('0xd')],function(_0x2ae2ba){return{'model':db[_0x2ae2ba['model']],'as':_0x2ae2ba['as'],'attributes':_0x2ae2ba[_0x7346('0xb')],'include':_0x2ae2ba[_0x7346('0xd')]?_['map'](_0x2ae2ba['include'],function(_0x9ca3f6){return{'model':db[_0x9ca3f6[_0x7346('0xf')]],'as':_0x9ca3f6['as'],'attributes':_0x9ca3f6[_0x7346('0xb')]};}):[]};}):[]};}):[]:[]})[_0x7346('0x10')](function(_0x3746bc){logger['info']('GetCmHopper',_0x18a519);logger[_0x7346('0x17')](_0x7346('0x5'),_0x18a519,JSON[_0x7346('0x12')](_0x3746bc));_0x4ea046(_0x3746bc);})[_0x7346('0x1b')](function(_0x3a3ada){logger[_0x7346('0x13')](_0x7346('0x5'),_0x3a3ada[_0x7346('0x14')],_0x18a519);_0x122f46(_0x4bbeda[_0x7346('0x13')](0x1f4,_0x3a3ada[_0x7346('0x14')]));});});});};exports[_0x7346('0x40')]=function(_0x300fa5){var _0x318211=this;return new Promise(function(_0x5aa47d,_0x481d80){return db[_0x7346('0x24')][_0x7346('0x41')]({'raw':!![],'where':{'phone':_0x300fa5[_0x7346('0x8')][_0x7346('0xa')][_0x7346('0x42')]},'attributes':['id',_0x7346('0x43')],'order':[['id',_0x7346('0x44')]]})[_0x7346('0x10')](function(_0x208147){logger['info']('getContactByPhone',_0x300fa5);logger[_0x7346('0x17')](_0x7346('0x45'),_0x300fa5,JSON['stringify'](_0x208147));_0x5aa47d(_0x208147);})['catch'](function(_0x1c24cf){logger[_0x7346('0x13')](_0x7346('0x45'),_0x1c24cf['message'],_0x300fa5);_0x481d80(_0x318211[_0x7346('0x13')](0x1f4,_0x1c24cf[_0x7346('0x14')]));});});};exports[_0x7346('0x46')]=function(_0x2108d2){var _0x51cc24=this;return new Promise(function(_0x3f77f8,_0x4acf9b){return db['sequelize'][_0x7346('0x33')](function(_0x88917c){var _0x1545cf=_0x2108d2[_0x7346('0x8')]&&_0x2108d2['options'][_0x7346('0xa')]?_0x2108d2[_0x7346('0x8')][_0x7346('0xa')]:{};return db[_0x7346('0x6')][_0x7346('0x1d')](_0x2108d2[_0x7346('0x1a')],{'where':_0x1545cf,'transaction':_0x88917c})[_0x7346('0x10')](function(_0x5425a1){logger[_0x7346('0x11')](_0x7346('0x46'),_0x2108d2);logger[_0x7346('0x17')]('ResetActiveCalls',_0x2108d2,JSON['stringify'](_0x5425a1));_0x3f77f8(_0x5425a1);})['catch'](function(_0x3493a7){logger[_0x7346('0x13')]('ResetActiveCalls',_0x3493a7[_0x7346('0x14')],_0x2108d2);_0x4acf9b(_0x51cc24[_0x7346('0x13')](0x1f4,_0x3493a7[_0x7346('0x14')]));});});});};exports[_0x7346('0x47')]=function(_0x529a5d){var _0x2b520b=this;var _0x5e171c=_0x529a5d[_0x7346('0x1a')][_0x7346('0xa')][_0x7346('0x48')];var _0x19a5ea=_0x529a5d[_0x7346('0x1a')][_0x7346('0xa')][_0x7346('0x49')];var _0x4992f8=_0x529a5d[_0x7346('0x1a')][_0x7346('0xa')][_0x7346('0x4a')];return new Promise(function(_0x3860ed,_0xc018c0){return db['CmHopper'][_0x7346('0x7')]({'where':{'voiceQueueId':{'$in':_0x5e171c},'recallme':0x1,'active':0x0,'recallmeNotifiedDate':{'$eq':null},'scheduledat':{'$and':{'$lte':db[_0x7346('0x32')][_0x7346('0x36')]('NOW()\x20+\x20INTERVAL\x20'+_0x19a5ea+_0x7346('0x4b')),'$gt':db[_0x7346('0x32')]['literal']('NOW()')}},'UserId':{'$in':_0x4992f8}},'include':[{'model':db[_0x7346('0x24')],'as':_0x7346('0x3f')},{'model':db['User'],'as':_0x7346('0x26'),'attributes':['id',_0x7346('0x27'),'voicePause']},{'model':db[_0x7346('0x4c')],'as':_0x7346('0x4d')}]})['then'](function(_0x1dc528){if(_0x1dc528[_0x7346('0x29')]>0x0){return db[_0x7346('0x32')][_0x7346('0x33')](function(_0x2d96e1){return db[_0x7346('0x6')][_0x7346('0x1d')]({'recallmeNotifiedDate':db[_0x7346('0x32')][_0x7346('0x36')](_0x7346('0x4e'))},{'where':{'id':{'$in':_[_0x7346('0xe')](_0x1dc528,'id')}},'transaction':_0x2d96e1})[_0x7346('0x10')](function(){_0x3860ed(_0x1dc528);})[_0x7346('0x1b')](function(_0x11eb23){logger['error'](_0x7346('0x47'),_0x11eb23[_0x7346('0x14')],_0x529a5d);_0xc018c0(_0x2b520b['error'](0x1f4,_0x11eb23[_0x7346('0x14')]));});})[_0x7346('0x1b')](function(_0x13d135){logger[_0x7346('0x13')](_0x7346('0x47'),_0x13d135['message'],_0x529a5d);_0xc018c0(_0x2b520b[_0x7346('0x13')](0x1f4,_0x13d135[_0x7346('0x14')]));});}else{_0x3860ed(_0x1dc528);}});});}; \ No newline at end of file diff --git a/server/api/cmHopper/index.js b/server/api/cmHopper/index.js index 90d06b8..d791772 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 _0x8bf9=['express','Router','./cmHopper.controller','get','isAuthenticated','index','/describe','getOpenContacts','/timezones','getTimezones','show','getPreviewRecall','post','create','/preview','getPreview','/timezone','getTimezone','put','/:id','update','delete','exports'];(function(_0x149adf,_0x5d2be0){var _0x4c35e1=function(_0x406152){while(--_0x406152){_0x149adf['push'](_0x149adf['shift']());}};_0x4c35e1(++_0x5d2be0);}(_0x8bf9,0x73));var _0x98bf=function(_0x360e5c,_0x1d60de){_0x360e5c=_0x360e5c-0x0;var _0x3629ea=_0x8bf9[_0x360e5c];return _0x3629ea;};'use strict';var express=require(_0x98bf('0x0'));var router=express[_0x98bf('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0x98bf('0x2'));router[_0x98bf('0x3')]('/',auth[_0x98bf('0x4')](),controller[_0x98bf('0x5')]);router[_0x98bf('0x3')](_0x98bf('0x6'),auth['isAuthenticated'](),controller['describe']);router[_0x98bf('0x3')]('/opencontacts',auth[_0x98bf('0x4')](),controller[_0x98bf('0x7')]);router[_0x98bf('0x3')](_0x98bf('0x8'),auth[_0x98bf('0x4')](),controller[_0x98bf('0x9')]);router[_0x98bf('0x3')]('/:id',auth[_0x98bf('0x4')](),controller[_0x98bf('0xa')]);router[_0x98bf('0x3')]('/:id/previewrecall',auth['isAuthenticated'](),controller[_0x98bf('0xb')]);router[_0x98bf('0xc')]('/',auth[_0x98bf('0x4')](),controller[_0x98bf('0xd')]);router['post'](_0x98bf('0xe'),auth[_0x98bf('0x4')](),controller[_0x98bf('0xf')]);router[_0x98bf('0xc')](_0x98bf('0x10'),auth[_0x98bf('0x4')](),controller[_0x98bf('0x11')]);router[_0x98bf('0x12')](_0x98bf('0x13'),auth[_0x98bf('0x4')](),controller[_0x98bf('0x14')]);router[_0x98bf('0x15')](_0x98bf('0x13'),auth[_0x98bf('0x4')](),controller['destroy']);module[_0x98bf('0x16')]=router; \ No newline at end of file +var _0xbe3f=['/timezones','getTimezones','/:id','show','/:id/previewrecall','getPreviewRecall','create','post','getTimezone','update','destroy','express','../../components/auth/service','./cmHopper.controller','isAuthenticated','get','/describe','describe','/opencontacts','getOpenContacts'];(function(_0x261ea0,_0x3febf1){var _0x105572=function(_0x3b7acb){while(--_0x3b7acb){_0x261ea0['push'](_0x261ea0['shift']());}};_0x105572(++_0x3febf1);}(_0xbe3f,0x1c3));var _0xfbe3=function(_0x3b28f1,_0x42f39c){_0x3b28f1=_0x3b28f1-0x0;var _0x1548e1=_0xbe3f[_0x3b28f1];return _0x1548e1;};'use strict';var express=require(_0xfbe3('0x0'));var router=express['Router']();var auth=require(_0xfbe3('0x1'));var controller=require(_0xfbe3('0x2'));router['get']('/',auth[_0xfbe3('0x3')](),controller['index']);router[_0xfbe3('0x4')](_0xfbe3('0x5'),auth[_0xfbe3('0x3')](),controller[_0xfbe3('0x6')]);router['get'](_0xfbe3('0x7'),auth[_0xfbe3('0x3')](),controller[_0xfbe3('0x8')]);router['get'](_0xfbe3('0x9'),auth[_0xfbe3('0x3')](),controller[_0xfbe3('0xa')]);router['get'](_0xfbe3('0xb'),auth[_0xfbe3('0x3')](),controller[_0xfbe3('0xc')]);router[_0xfbe3('0x4')](_0xfbe3('0xd'),auth[_0xfbe3('0x3')](),controller[_0xfbe3('0xe')]);router['post']('/',auth[_0xfbe3('0x3')](),controller[_0xfbe3('0xf')]);router[_0xfbe3('0x10')]('/preview',auth[_0xfbe3('0x3')](),controller['getPreview']);router[_0xfbe3('0x10')]('/timezone',auth['isAuthenticated'](),controller[_0xfbe3('0x11')]);router['put'](_0xfbe3('0xb'),auth['isAuthenticated'](),controller[_0xfbe3('0x12')]);router['delete'](_0xfbe3('0xb'),auth[_0xfbe3('0x3')](),controller[_0xfbe3('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js index 2d5dd0c..afaecf4 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9ce1=['INTEGER','STRING','format','moment','exports'];(function(_0x93c7c9,_0x265215){var _0x491512=function(_0x484025){while(--_0x484025){_0x93c7c9['push'](_0x93c7c9['shift']());}};_0x491512(++_0x265215);}(_0x9ce1,0xd5));var _0x19ce=function(_0x28cd00,_0x368b5f){_0x28cd00=_0x28cd00-0x0;var _0x4aae6d=_0x9ce1[_0x28cd00];return _0x4aae6d;};'use strict';var moment=require(_0x19ce('0x0'));var Sequelize=require('sequelize');module[_0x19ce('0x1')]={'CmHopperId':{'type':Sequelize[_0x19ce('0x2')]},'phone':{'type':Sequelize[_0x19ce('0x3')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x19ce('0x2')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x19ce('0x4')]('YYYY-MM-DD\x20HH:mm:ss')},'countbusyretry':{'type':Sequelize[_0x19ce('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x19ce('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x19ce('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x19ce('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x19ce('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x19ce('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x19ce('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7aa1=['format','YYYY-MM-DD\x20HH:mm:ss','sequelize','INTEGER','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x7aa1,0xe3));var _0x17aa=function(_0x4acf9c,_0x3f48df){_0x4acf9c=_0x4acf9c-0x0;var _0x53a79b=_0x7aa1[_0x4acf9c];return _0x53a79b;};'use strict';var moment=require('moment');var Sequelize=require(_0x17aa('0x0'));module['exports']={'CmHopperId':{'type':Sequelize[_0x17aa('0x1')]},'phone':{'type':Sequelize[_0x17aa('0x2')],'allowNull':![]},'OrderBy':{'type':Sequelize[_0x17aa('0x1')],'defaultValue':0x0},'scheduledat':{'type':Sequelize['DATE'],'defaultValue':moment()[_0x17aa('0x3')](_0x17aa('0x4'))},'countbusyretry':{'type':Sequelize[_0x17aa('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0x17aa('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x17aa('0x1')],'defaultValue':0x0},'countnosuchnumberretry':{'type':Sequelize[_0x17aa('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x17aa('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x17aa('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x17aa('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x17aa('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js index d05ca6d..76d883e 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2bc7=['catch','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','limit','undefined','Content-Range','save','update','destroy','then','get','CmHopperAdditionalPhones','end','error','stack','name','send','index','map','CmHopperAdditionalPhone','rawAttributes','fieldName','query','keys','filters','intersection','model','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','count','includeAll','findAll','rows','params','include','merge','options','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','find','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0x2fc82c,_0x1445db){var _0xa8d489=function(_0x111d1a){while(--_0x111d1a){_0x2fc82c['push'](_0x2fc82c['shift']());}};_0xa8d489(++_0x1445db);}(_0x2bc7,0xf4));var _0x72bc=function(_0x27ede9,_0x11e440){_0x27ede9=_0x27ede9-0x0;var _0x299e57=_0x2bc7[_0x27ede9];return _0x299e57;};'use strict';var emlformat=require(_0x72bc('0x0'));var rimraf=require(_0x72bc('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x72bc('0x2'));var rp=require(_0x72bc('0x3'));var moment=require(_0x72bc('0x4'));var BPromise=require(_0x72bc('0x5'));var Mustache=require(_0x72bc('0x6'));var util=require(_0x72bc('0x7'));var path=require(_0x72bc('0x8'));var sox=require(_0x72bc('0x9'));var csv=require(_0x72bc('0xa'));var ejs=require(_0x72bc('0xb'));var fs=require('fs');var fs_extra=require(_0x72bc('0xc'));var _=require('lodash');var squel=require(_0x72bc('0xd'));var crypto=require(_0x72bc('0xe'));var jsforce=require(_0x72bc('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x72bc('0x10'));var Papa=require(_0x72bc('0x11'));var Redis=require(_0x72bc('0x12'));var authService=require(_0x72bc('0x13'));var qs=require(_0x72bc('0x14'));var as=require(_0x72bc('0x15'));var hardwareService=require(_0x72bc('0x16'));var logger=require('../../config/logger')(_0x72bc('0x17'));var utils=require(_0x72bc('0x18'));var config=require(_0x72bc('0x19'));var licenseUtil=require(_0x72bc('0x1a'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x87018c,_0x37d780){_0x37d780=_0x37d780||0xcc;return function(_0x497f08){if(_0x497f08){return _0x87018c[_0x72bc('0x1b')](_0x37d780);}return _0x87018c[_0x72bc('0x1c')](_0x37d780)['end']();};}function respondWithResult(_0x33fd7c,_0x47aad0){_0x47aad0=_0x47aad0||0xc8;return function(_0x4126bb){if(_0x4126bb){return _0x33fd7c[_0x72bc('0x1c')](_0x47aad0)['json'](_0x4126bb);}};}function respondWithFilteredResult(_0x1fdd5c,_0x4e077d){return function(_0x3597a2){if(_0x3597a2){var _0x355618=typeof _0x4e077d[_0x72bc('0x1d')]==='undefined'&&typeof _0x4e077d[_0x72bc('0x1e')]===_0x72bc('0x1f');var _0x436eb5=_0x3597a2['count'];var _0x2bd5aa=_0x355618?0x0:_0x4e077d[_0x72bc('0x1d')];var _0x2d1170=_0x355618?_0x3597a2['count']:_0x4e077d[_0x72bc('0x1d')]+_0x4e077d[_0x72bc('0x1e')];var _0x40d334;if(_0x2d1170>=_0x436eb5){_0x2d1170=_0x436eb5;_0x40d334=0xc8;}else{_0x40d334=0xce;}_0x1fdd5c['status'](_0x40d334);return _0x1fdd5c['set'](_0x72bc('0x20'),_0x2bd5aa+'-'+_0x2d1170+'/'+_0x436eb5)['json'](_0x3597a2);}return null;};}function patchUpdates(_0x28cf77){return function(_0x18dc99){try{jsonpatch['apply'](_0x18dc99,_0x28cf77,!![]);}catch(_0x48b1b4){return BPromise['reject'](_0x48b1b4);}return _0x18dc99[_0x72bc('0x21')]();};}function saveUpdates(_0x4d1a9f,_0x2702bd){return function(_0x5e0db5){if(_0x5e0db5){return _0x5e0db5[_0x72bc('0x22')](_0x4d1a9f)['then'](function(_0x5a70ef){return _0x5a70ef;});}return null;};}function removeEntity(_0x4178c3,_0x47896b){return function(_0x40b44a){if(_0x40b44a){return _0x40b44a[_0x72bc('0x23')]()[_0x72bc('0x24')](function(){var _0x3a328d=_0x40b44a[_0x72bc('0x25')]({'plain':!![]});var _0x37385f=_0x72bc('0x26');return db['UserProfileResource']['destroy']({'where':{'type':_0x37385f,'resourceId':_0x3a328d['id']}})[_0x72bc('0x24')](function(){return _0x40b44a;});})[_0x72bc('0x24')](function(){_0x4178c3[_0x72bc('0x1c')](0xcc)[_0x72bc('0x27')]();});}};}function handleEntityNotFound(_0x4f6a84,_0x16272c){return function(_0x4f16f7){if(!_0x4f16f7){_0x4f6a84['sendStatus'](0x194);}return _0x4f16f7;};}function handleError(_0x54fdbd,_0x39d9fe){_0x39d9fe=_0x39d9fe||0x1f4;return function(_0x23fc15){logger[_0x72bc('0x28')](_0x23fc15[_0x72bc('0x29')]);if(_0x23fc15[_0x72bc('0x2a')]){delete _0x23fc15[_0x72bc('0x2a')];}_0x54fdbd['status'](_0x39d9fe)[_0x72bc('0x2b')](_0x23fc15);};}exports[_0x72bc('0x2c')]=function(_0x2ea776,_0x2c97ac){var _0x116407={},_0x484779={},_0xd22fb9={'count':0x0,'rows':[]};var _0xf33edf=_[_0x72bc('0x2d')](db[_0x72bc('0x2e')][_0x72bc('0x2f')],function(_0x155321){return{'name':_0x155321[_0x72bc('0x30')],'type':_0x155321['type']['key']};});_0x484779['model']=_[_0x72bc('0x2d')](_0xf33edf,'name');_0x484779[_0x72bc('0x31')]=_[_0x72bc('0x32')](_0x2ea776['query']);_0x484779[_0x72bc('0x33')]=_[_0x72bc('0x34')](_0x484779[_0x72bc('0x35')],_0x484779[_0x72bc('0x31')]);_0x116407['attributes']=_[_0x72bc('0x34')](_0x484779[_0x72bc('0x35')],qs['fields'](_0x2ea776[_0x72bc('0x31')][_0x72bc('0x36')]));_0x116407[_0x72bc('0x37')]=_0x116407['attributes']['length']?_0x116407[_0x72bc('0x37')]:_0x484779[_0x72bc('0x35')];if(!_0x2ea776[_0x72bc('0x31')][_0x72bc('0x38')]('nolimit')){_0x116407[_0x72bc('0x1e')]=qs[_0x72bc('0x1e')](_0x2ea776[_0x72bc('0x31')][_0x72bc('0x1e')]);_0x116407[_0x72bc('0x1d')]=qs[_0x72bc('0x1d')](_0x2ea776['query'][_0x72bc('0x1d')]);}_0x116407[_0x72bc('0x39')]=qs['sort'](_0x2ea776[_0x72bc('0x31')][_0x72bc('0x3a')]);_0x116407[_0x72bc('0x3b')]=qs[_0x72bc('0x33')](_[_0x72bc('0x3c')](_0x2ea776[_0x72bc('0x31')],_0x484779['filters']),_0xf33edf);if(_0x2ea776[_0x72bc('0x31')][_0x72bc('0x3d')]){_0x116407['where']=_['merge'](_0x116407[_0x72bc('0x3b')],{'$or':_[_0x72bc('0x2d')](_0xf33edf,function(_0x6ac9cc){if(_0x6ac9cc['type']!==_0x72bc('0x3e')){var _0x57ada1={};_0x57ada1[_0x6ac9cc[_0x72bc('0x2a')]]={'$like':'%'+_0x2ea776['query'][_0x72bc('0x3d')]+'%'};return _0x57ada1;}})});}_0x116407=_['merge']({},_0x116407,_0x2ea776['options']);var _0x196d0b={'where':_0x116407[_0x72bc('0x3b')]};return db[_0x72bc('0x2e')][_0x72bc('0x3f')](_0x196d0b)[_0x72bc('0x24')](function(_0x34787e){_0xd22fb9[_0x72bc('0x3f')]=_0x34787e;if(_0x2ea776[_0x72bc('0x31')][_0x72bc('0x40')]){_0x116407['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x72bc('0x41')](_0x116407);})[_0x72bc('0x24')](function(_0x28883b){_0xd22fb9[_0x72bc('0x42')]=_0x28883b;return _0xd22fb9;})[_0x72bc('0x24')](respondWithFilteredResult(_0x2c97ac,_0x116407))['catch'](handleError(_0x2c97ac,null));};exports['show']=function(_0x2bb9d7,_0x47607c){var _0x6fe56d={'raw':!![],'where':{'id':_0x2bb9d7[_0x72bc('0x43')]['id']}},_0x432d8a={};_0x432d8a[_0x72bc('0x35')]=_[_0x72bc('0x32')](db[_0x72bc('0x2e')][_0x72bc('0x2f')]);_0x432d8a[_0x72bc('0x31')]=_[_0x72bc('0x32')](_0x2bb9d7[_0x72bc('0x31')]);_0x432d8a['filters']=_['intersection'](_0x432d8a[_0x72bc('0x35')],_0x432d8a[_0x72bc('0x31')]);_0x6fe56d['attributes']=_['intersection'](_0x432d8a[_0x72bc('0x35')],qs['fields'](_0x2bb9d7[_0x72bc('0x31')]['fields']));_0x6fe56d[_0x72bc('0x37')]=_0x6fe56d['attributes']['length']?_0x6fe56d[_0x72bc('0x37')]:_0x432d8a['model'];if(_0x2bb9d7['query'][_0x72bc('0x40')]){_0x6fe56d[_0x72bc('0x44')]=[{'all':!![]}];}_0x6fe56d=_[_0x72bc('0x45')]({},_0x6fe56d,_0x2bb9d7[_0x72bc('0x46')]);return db['CmHopperAdditionalPhone']['find'](_0x6fe56d)[_0x72bc('0x24')](handleEntityNotFound(_0x47607c,null))['then'](respondWithResult(_0x47607c,null))['catch'](handleError(_0x47607c,null));};exports[_0x72bc('0x47')]=function(_0x4970df,_0x47b5ce){return db['CmHopperAdditionalPhone'][_0x72bc('0x47')](_0x4970df[_0x72bc('0x48')],{})[_0x72bc('0x24')](function(_0x4b7351){var _0x403157=_0x4970df['user'][_0x72bc('0x25')]({'plain':!![]});if(!_0x403157)throw new Error(_0x72bc('0x49'));if(_0x403157[_0x72bc('0x4a')]===_0x72bc('0x4b')){var _0x1d992d=_0x4b7351[_0x72bc('0x25')]({'plain':!![]});var _0x23fa89=_0x72bc('0x26');return db['UserProfileSection'][_0x72bc('0x4c')]({'where':{'name':_0x23fa89,'userProfileId':_0x403157['userProfileId']},'raw':!![]})[_0x72bc('0x24')](function(_0x5e35af){if(_0x5e35af&&_0x5e35af[_0x72bc('0x4d')]===0x0){return db[_0x72bc('0x4e')][_0x72bc('0x47')]({'name':_0x1d992d['name'],'resourceId':_0x1d992d['id'],'type':_0x5e35af['name'],'sectionId':_0x5e35af['id']},{})['then'](function(){return _0x4b7351;});}else{return _0x4b7351;}})['catch'](function(_0x364628){logger[_0x72bc('0x28')](_0x72bc('0x4f'),_0x364628);throw _0x364628;});}return _0x4b7351;})[_0x72bc('0x24')](respondWithResult(_0x47b5ce,0xc9))[_0x72bc('0x50')](handleError(_0x47b5ce,null));};exports[_0x72bc('0x22')]=function(_0x5ec018,_0x6d3308){if(_0x5ec018['body']['id']){delete _0x5ec018['body']['id'];}return db[_0x72bc('0x2e')]['find']({'where':{'id':_0x5ec018[_0x72bc('0x43')]['id']}})['then'](handleEntityNotFound(_0x6d3308,null))[_0x72bc('0x24')](saveUpdates(_0x5ec018[_0x72bc('0x48')],null))[_0x72bc('0x24')](respondWithResult(_0x6d3308,null))[_0x72bc('0x50')](handleError(_0x6d3308,null));};exports[_0x72bc('0x23')]=function(_0x4d3bd5,_0x209900){return db[_0x72bc('0x2e')][_0x72bc('0x4c')]({'where':{'id':_0x4d3bd5['params']['id']}})[_0x72bc('0x24')](handleEntityNotFound(_0x209900,null))['then'](removeEntity(_0x209900,null))[_0x72bc('0x50')](handleError(_0x209900,null));}; \ No newline at end of file +var _0xf5f2=['include','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','count','limit','status','set','Content-Range','apply','save','update','destroy','get','CmHopperAdditionalPhones','UserProfileResource','then','name','send','index','map','CmHopperAdditionalPhone','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','keys','rawAttributes','length'];(function(_0x1a2918,_0x57d781){var _0x35b0de=function(_0x304c44){while(--_0x304c44){_0x1a2918['push'](_0x1a2918['shift']());}};_0x35b0de(++_0x57d781);}(_0xf5f2,0x1c4));var _0x2f5f=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0xf5f2[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x2f5f('0x0'));var jsonpatch=require(_0x2f5f('0x1'));var rp=require(_0x2f5f('0x2'));var moment=require(_0x2f5f('0x3'));var BPromise=require(_0x2f5f('0x4'));var Mustache=require(_0x2f5f('0x5'));var util=require(_0x2f5f('0x6'));var path=require(_0x2f5f('0x7'));var sox=require(_0x2f5f('0x8'));var csv=require(_0x2f5f('0x9'));var ejs=require(_0x2f5f('0xa'));var fs=require('fs');var fs_extra=require(_0x2f5f('0xb'));var _=require(_0x2f5f('0xc'));var squel=require(_0x2f5f('0xd'));var crypto=require(_0x2f5f('0xe'));var jsforce=require(_0x2f5f('0xf'));var deskjs=require(_0x2f5f('0x10'));var toCsv=require(_0x2f5f('0x9'));var querystring=require(_0x2f5f('0x11'));var Papa=require(_0x2f5f('0x12'));var Redis=require('ioredis');var authService=require(_0x2f5f('0x13'));var qs=require(_0x2f5f('0x14'));var as=require(_0x2f5f('0x15'));var hardwareService=require(_0x2f5f('0x16'));var logger=require(_0x2f5f('0x17'))(_0x2f5f('0x18'));var utils=require(_0x2f5f('0x19'));var config=require(_0x2f5f('0x1a'));var licenseUtil=require(_0x2f5f('0x1b'));var db=require(_0x2f5f('0x1c'))['db'];function respondWithStatusCode(_0x12ce82,_0x24e6d3){_0x24e6d3=_0x24e6d3||0xcc;return function(_0x2c6316){if(_0x2c6316){return _0x12ce82[_0x2f5f('0x1d')](_0x24e6d3);}return _0x12ce82['status'](_0x24e6d3)[_0x2f5f('0x1e')]();};}function respondWithResult(_0x5bf6f7,_0x22a299){_0x22a299=_0x22a299||0xc8;return function(_0x54128c){if(_0x54128c){return _0x5bf6f7['status'](_0x22a299)[_0x2f5f('0x1f')](_0x54128c);}};}function respondWithFilteredResult(_0x22922b,_0x262699){return function(_0x56bf5b){if(_0x56bf5b){var _0x3213c1=typeof _0x262699[_0x2f5f('0x20')]==='undefined'&&typeof _0x262699['limit']==='undefined';var _0x136fc0=_0x56bf5b['count'];var _0x4dd65e=_0x3213c1?0x0:_0x262699['offset'];var _0x1c17e0=_0x3213c1?_0x56bf5b[_0x2f5f('0x21')]:_0x262699['offset']+_0x262699[_0x2f5f('0x22')];var _0x191d40;if(_0x1c17e0>=_0x136fc0){_0x1c17e0=_0x136fc0;_0x191d40=0xc8;}else{_0x191d40=0xce;}_0x22922b[_0x2f5f('0x23')](_0x191d40);return _0x22922b[_0x2f5f('0x24')](_0x2f5f('0x25'),_0x4dd65e+'-'+_0x1c17e0+'/'+_0x136fc0)['json'](_0x56bf5b);}return null;};}function patchUpdates(_0x5a5a87){return function(_0x280b24){try{jsonpatch[_0x2f5f('0x26')](_0x280b24,_0x5a5a87,!![]);}catch(_0x57bef4){return BPromise['reject'](_0x57bef4);}return _0x280b24[_0x2f5f('0x27')]();};}function saveUpdates(_0x423e11,_0x2d1923){return function(_0x4c30c3){if(_0x4c30c3){return _0x4c30c3[_0x2f5f('0x28')](_0x423e11)['then'](function(_0x43411a){return _0x43411a;});}return null;};}function removeEntity(_0x2dd534,_0x2d8e40){return function(_0x3c21dc){if(_0x3c21dc){return _0x3c21dc[_0x2f5f('0x29')]()['then'](function(){var _0x1909e5=_0x3c21dc[_0x2f5f('0x2a')]({'plain':!![]});var _0x5758a1=_0x2f5f('0x2b');return db[_0x2f5f('0x2c')][_0x2f5f('0x29')]({'where':{'type':_0x5758a1,'resourceId':_0x1909e5['id']}})[_0x2f5f('0x2d')](function(){return _0x3c21dc;});})['then'](function(){_0x2dd534[_0x2f5f('0x23')](0xcc)[_0x2f5f('0x1e')]();});}};}function handleEntityNotFound(_0x591f90,_0x37ba1a){return function(_0x2bbd51){if(!_0x2bbd51){_0x591f90['sendStatus'](0x194);}return _0x2bbd51;};}function handleError(_0x2fb01d,_0x4c8390){_0x4c8390=_0x4c8390||0x1f4;return function(_0x31b73b){logger['error'](_0x31b73b['stack']);if(_0x31b73b[_0x2f5f('0x2e')]){delete _0x31b73b[_0x2f5f('0x2e')];}_0x2fb01d[_0x2f5f('0x23')](_0x4c8390)[_0x2f5f('0x2f')](_0x31b73b);};}exports[_0x2f5f('0x30')]=function(_0x33d6a7,_0x112bde){var _0x2a4d0c={},_0x457334={},_0x5a4037={'count':0x0,'rows':[]};var _0x26ce93=_[_0x2f5f('0x31')](db[_0x2f5f('0x32')]['rawAttributes'],function(_0x29c763){return{'name':_0x29c763['fieldName'],'type':_0x29c763[_0x2f5f('0x33')][_0x2f5f('0x34')]};});_0x457334[_0x2f5f('0x35')]=_['map'](_0x26ce93,_0x2f5f('0x2e'));_0x457334['query']=_['keys'](_0x33d6a7[_0x2f5f('0x36')]);_0x457334[_0x2f5f('0x37')]=_[_0x2f5f('0x38')](_0x457334[_0x2f5f('0x35')],_0x457334['query']);_0x2a4d0c[_0x2f5f('0x39')]=_[_0x2f5f('0x38')](_0x457334['model'],qs[_0x2f5f('0x3a')](_0x33d6a7['query'][_0x2f5f('0x3a')]));_0x2a4d0c['attributes']=_0x2a4d0c['attributes']['length']?_0x2a4d0c[_0x2f5f('0x39')]:_0x457334[_0x2f5f('0x35')];if(!_0x33d6a7[_0x2f5f('0x36')][_0x2f5f('0x3b')](_0x2f5f('0x3c'))){_0x2a4d0c['limit']=qs[_0x2f5f('0x22')](_0x33d6a7['query'][_0x2f5f('0x22')]);_0x2a4d0c['offset']=qs[_0x2f5f('0x20')](_0x33d6a7['query']['offset']);}_0x2a4d0c[_0x2f5f('0x3d')]=qs[_0x2f5f('0x3e')](_0x33d6a7['query']['sort']);_0x2a4d0c[_0x2f5f('0x3f')]=qs[_0x2f5f('0x37')](_[_0x2f5f('0x40')](_0x33d6a7[_0x2f5f('0x36')],_0x457334[_0x2f5f('0x37')]),_0x26ce93);if(_0x33d6a7['query'][_0x2f5f('0x41')]){_0x2a4d0c[_0x2f5f('0x3f')]=_[_0x2f5f('0x42')](_0x2a4d0c[_0x2f5f('0x3f')],{'$or':_[_0x2f5f('0x31')](_0x26ce93,function(_0x1f48d3){if(_0x1f48d3[_0x2f5f('0x33')]!==_0x2f5f('0x43')){var _0x1b9a36={};_0x1b9a36[_0x1f48d3[_0x2f5f('0x2e')]]={'$like':'%'+_0x33d6a7[_0x2f5f('0x36')][_0x2f5f('0x41')]+'%'};return _0x1b9a36;}})});}_0x2a4d0c=_['merge']({},_0x2a4d0c,_0x33d6a7[_0x2f5f('0x44')]);var _0x34c20a={'where':_0x2a4d0c[_0x2f5f('0x3f')]};return db[_0x2f5f('0x32')][_0x2f5f('0x21')](_0x34c20a)[_0x2f5f('0x2d')](function(_0x4f878a){_0x5a4037[_0x2f5f('0x21')]=_0x4f878a;if(_0x33d6a7[_0x2f5f('0x36')][_0x2f5f('0x45')]){_0x2a4d0c['include']=[{'all':!![]}];}return db['CmHopperAdditionalPhone'][_0x2f5f('0x46')](_0x2a4d0c);})['then'](function(_0x24e111){_0x5a4037[_0x2f5f('0x47')]=_0x24e111;return _0x5a4037;})[_0x2f5f('0x2d')](respondWithFilteredResult(_0x112bde,_0x2a4d0c))[_0x2f5f('0x48')](handleError(_0x112bde,null));};exports['show']=function(_0x325636,_0x4411e2){var _0x2a059a={'raw':!![],'where':{'id':_0x325636['params']['id']}},_0x4f3db0={};_0x4f3db0[_0x2f5f('0x35')]=_[_0x2f5f('0x49')](db[_0x2f5f('0x32')][_0x2f5f('0x4a')]);_0x4f3db0['query']=_[_0x2f5f('0x49')](_0x325636['query']);_0x4f3db0[_0x2f5f('0x37')]=_['intersection'](_0x4f3db0[_0x2f5f('0x35')],_0x4f3db0[_0x2f5f('0x36')]);_0x2a059a[_0x2f5f('0x39')]=_[_0x2f5f('0x38')](_0x4f3db0[_0x2f5f('0x35')],qs[_0x2f5f('0x3a')](_0x325636[_0x2f5f('0x36')][_0x2f5f('0x3a')]));_0x2a059a[_0x2f5f('0x39')]=_0x2a059a[_0x2f5f('0x39')][_0x2f5f('0x4b')]?_0x2a059a[_0x2f5f('0x39')]:_0x4f3db0['model'];if(_0x325636[_0x2f5f('0x36')]['includeAll']){_0x2a059a[_0x2f5f('0x4c')]=[{'all':!![]}];}_0x2a059a=_[_0x2f5f('0x42')]({},_0x2a059a,_0x325636[_0x2f5f('0x44')]);return db[_0x2f5f('0x32')]['find'](_0x2a059a)['then'](handleEntityNotFound(_0x4411e2,null))[_0x2f5f('0x2d')](respondWithResult(_0x4411e2,null))['catch'](handleError(_0x4411e2,null));};exports[_0x2f5f('0x4d')]=function(_0x1f5fd4,_0x45179e){return db[_0x2f5f('0x32')]['create'](_0x1f5fd4[_0x2f5f('0x4e')],{})['then'](function(_0x37f1f6){var _0x19dcea=_0x1f5fd4['user'][_0x2f5f('0x2a')]({'plain':!![]});if(!_0x19dcea)throw new Error(_0x2f5f('0x4f'));if(_0x19dcea[_0x2f5f('0x50')]===_0x2f5f('0x51')){var _0x5dd6bf=_0x37f1f6[_0x2f5f('0x2a')]({'plain':!![]});var _0x413243=_0x2f5f('0x2b');return db[_0x2f5f('0x52')][_0x2f5f('0x53')]({'where':{'name':_0x413243,'userProfileId':_0x19dcea[_0x2f5f('0x54')]},'raw':!![]})[_0x2f5f('0x2d')](function(_0x4d38a1){if(_0x4d38a1&&_0x4d38a1[_0x2f5f('0x55')]===0x0){return db[_0x2f5f('0x2c')][_0x2f5f('0x4d')]({'name':_0x5dd6bf[_0x2f5f('0x2e')],'resourceId':_0x5dd6bf['id'],'type':_0x4d38a1['name'],'sectionId':_0x4d38a1['id']},{})['then'](function(){return _0x37f1f6;});}else{return _0x37f1f6;}})['catch'](function(_0xe51c42){logger['error'](_0x2f5f('0x56'),_0xe51c42);throw _0xe51c42;});}return _0x37f1f6;})[_0x2f5f('0x2d')](respondWithResult(_0x45179e,0xc9))[_0x2f5f('0x48')](handleError(_0x45179e,null));};exports['update']=function(_0x5ee620,_0x5291df){if(_0x5ee620[_0x2f5f('0x4e')]['id']){delete _0x5ee620['body']['id'];}return db[_0x2f5f('0x32')][_0x2f5f('0x53')]({'where':{'id':_0x5ee620[_0x2f5f('0x57')]['id']}})[_0x2f5f('0x2d')](handleEntityNotFound(_0x5291df,null))['then'](saveUpdates(_0x5ee620[_0x2f5f('0x4e')],null))[_0x2f5f('0x2d')](respondWithResult(_0x5291df,null))[_0x2f5f('0x48')](handleError(_0x5291df,null));};exports[_0x2f5f('0x29')]=function(_0x43eac8,_0x43ae4b){return db[_0x2f5f('0x32')]['find']({'where':{'id':_0x43eac8['params']['id']}})[_0x2f5f('0x2d')](handleEntityNotFound(_0x43ae4b,null))['then'](removeEntity(_0x43ae4b,null))[_0x2f5f('0x48')](handleError(_0x43ae4b,null));}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js index a62c3d2..448a012 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7399=['path','rimraf','../../config/environment','./cmHopperAdditionalPhone.attributes','define','cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x482816,_0x35e716){var _0xb89169=function(_0x379c49){while(--_0x379c49){_0x482816['push'](_0x482816['shift']());}};_0xb89169(++_0x35e716);}(_0x7399,0x13e));var _0x9739=function(_0x5a89ea,_0x436388){_0x5a89ea=_0x5a89ea-0x0;var _0x21193d=_0x7399[_0x5a89ea];return _0x21193d;};'use strict';var _=require(_0x9739('0x0'));var util=require(_0x9739('0x1'));var logger=require(_0x9739('0x2'))(_0x9739('0x3'));var moment=require(_0x9739('0x4'));var BPromise=require(_0x9739('0x5'));var rp=require(_0x9739('0x6'));var fs=require('fs');var path=require(_0x9739('0x7'));var rimraf=require(_0x9739('0x8'));var config=require(_0x9739('0x9'));var attributes=require(_0x9739('0xa'));module['exports']=function(_0x5f4e38,_0x4eb9a2){return _0x5f4e38[_0x9739('0xb')]('CmHopperAdditionalPhone',attributes,{'tableName':_0x9739('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xd8b1=['cm_hopper_additional_phones','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','CmHopperAdditionalPhone'];(function(_0x20156c,_0x12e1ff){var _0x4cb19a=function(_0x1e6a2c){while(--_0x1e6a2c){_0x20156c['push'](_0x20156c['shift']());}};_0x4cb19a(++_0x12e1ff);}(_0xd8b1,0x105));var _0x1d8b=function(_0x219780,_0x2abeaa){_0x219780=_0x219780-0x0;var _0x3568b7=_0xd8b1[_0x219780];return _0x3568b7;};'use strict';var _=require(_0x1d8b('0x0'));var util=require(_0x1d8b('0x1'));var logger=require(_0x1d8b('0x2'))(_0x1d8b('0x3'));var moment=require(_0x1d8b('0x4'));var BPromise=require('bluebird');var rp=require(_0x1d8b('0x5'));var fs=require('fs');var path=require(_0x1d8b('0x6'));var rimraf=require('rimraf');var config=require(_0x1d8b('0x7'));var attributes=require('./cmHopperAdditionalPhone.attributes');module['exports']=function(_0x4d5ba0,_0x27534c){return _0x4d5ba0['define'](_0x1d8b('0x8'),attributes,{'tableName':_0x1d8b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js index 7103196..d6bf680 100644 --- a/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js +++ b/server/api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc23c=['countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','entity','dialGlobalMaxRetry','ASC','countcongestionretry','catch','ContactId','CampaignId','duration','waitTime','scheduledat','add','minutes','phone','isNil','countdropretry','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','message','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CmHopperAdditionalPhone','OrderBy','countbusyretry','countnoanswerretry'];(function(_0x117f4c,_0x36a9b1){var _0x2b24e9=function(_0x31761b){while(--_0x31761b){_0x117f4c['push'](_0x117f4c['shift']());}};_0x2b24e9(++_0x36a9b1);}(_0xc23c,0x8b));var _0xcc23=function(_0x51bfa7,_0x51c8e0){_0x51bfa7=_0x51bfa7-0x0;var _0x1cf7ae=_0xc23c[_0x51bfa7];return _0x1cf7ae;};'use strict';var _=require(_0xcc23('0x0'));var util=require('util');var moment=require(_0xcc23('0x1'));var BPromise=require('bluebird');var rs=require(_0xcc23('0x2'));var fs=require('fs');var Redis=require(_0xcc23('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcc23('0x4'));var logger=require(_0xcc23('0x5'))(_0xcc23('0x6'));var config=require(_0xcc23('0x7'));var jayson=require(_0xcc23('0x8'));var client=jayson[_0xcc23('0x9')][_0xcc23('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x447763,_0x29fcc6,_0x20f05d){return new BPromise(function(_0x19e9cd,_0x308e1e){return client['request'](_0x447763,_0x20f05d)[_0xcc23('0xb')](function(_0x90709b){logger[_0xcc23('0xc')](_0xcc23('0xd'),_0x29fcc6,_0xcc23('0xe'));logger[_0xcc23('0xf')](_0xcc23('0x10'),_0x29fcc6,_0xcc23('0xe'),JSON['stringify'](_0x90709b));if(_0x90709b[_0xcc23('0x11')]){if(_0x90709b[_0xcc23('0x11')]['code']===0x1f4){logger[_0xcc23('0x11')](_0xcc23('0xd'),_0x29fcc6,_0x90709b[_0xcc23('0x11')][_0xcc23('0x12')]);return _0x308e1e(_0x90709b[_0xcc23('0x11')][_0xcc23('0x12')]);}logger[_0xcc23('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x29fcc6,_0x90709b[_0xcc23('0x11')][_0xcc23('0x12')]);return _0x19e9cd(_0x90709b[_0xcc23('0x11')][_0xcc23('0x12')]);}else{logger[_0xcc23('0xc')](_0xcc23('0xd'),_0x29fcc6,_0xcc23('0xe'));_0x19e9cd(_0x90709b['result'][_0xcc23('0x12')]);}})['catch'](function(_0x1759d4){logger[_0xcc23('0x11')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x29fcc6,_0x1759d4);_0x308e1e(_0x1759d4);});});}exports[_0xcc23('0x13')]=function(_0x5c4fb3){var _0x58c254=this;return new Promise(function(_0x44048f,_0x2bcfa3){return db[_0xcc23('0x14')][_0xcc23('0x15')]({'raw':!![],'where':{'ContactId':_0x5c4fb3[_0xcc23('0x16')]['ContactId'],'ListId':_0x5c4fb3[_0xcc23('0x16')][_0xcc23('0x17')],'VoiceQueueId':_0x5c4fb3[_0xcc23('0x16')][_0xcc23('0x18')]===undefined?null:_0x5c4fb3['body'][_0xcc23('0x18')],'CampaignId':_0x5c4fb3['body']['CampaignId']===undefined?null:_0x5c4fb3['body']['CampaignId']}})['then'](function(_0x282361){if(_0x282361!=null){return db[_0xcc23('0x19')][_0xcc23('0x15')]({'raw':!![],'where':{'CmHopperId':_0x282361['id'],'OrderBy':{'$gt':_0x282361['OrderBy']}},'order':[[_0xcc23('0x1a'),'ASC']]})[_0xcc23('0xb')](function(_0x3b3d21){var _0x5562d=0x0;if(_0x3b3d21){if(_0x3b3d21[_0xcc23('0x1b')]+_0x3b3d21['countcongestionretry']+_0x3b3d21[_0xcc23('0x1c')]+_0x3b3d21[_0xcc23('0x1d')]+_0x3b3d21['countdropretry']+_0x3b3d21[_0xcc23('0x1e')]+_0x3b3d21[_0xcc23('0x1f')]+_0x3b3d21[_0xcc23('0x20')]<_0x5c4fb3[_0xcc23('0x21')][_0xcc23('0x22')])_0x5562d=0x1;_0x44048f({'additional':_0x5562d});}else{return db[_0xcc23('0x19')][_0xcc23('0x15')]({'raw':!![],'where':{'CmHopperId':_0x282361['id']},'order':[[_0xcc23('0x1a'),_0xcc23('0x23')]]})['then'](function(_0x2acce8){var _0x3dd2e2=0x0;if(_0x2acce8){if(_0x2acce8['countbusyretry']+_0x2acce8[_0xcc23('0x24')]+_0x2acce8[_0xcc23('0x1c')]+_0x2acce8['countnosuchnumberretry']+_0x2acce8['countdropretry']+_0x2acce8['countabandonedretry']+_0x2acce8[_0xcc23('0x1f')]+_0x2acce8['countagentrejectretry']<_0x5c4fb3[_0xcc23('0x21')]['dialGlobalMaxRetry'])_0x3dd2e2=0x1;_0x44048f({'additional':_0x3dd2e2});}else{_0x44048f({'additional':0x0});}})[_0xcc23('0x25')](function(_0x146249){logger[_0xcc23('0x11')](_0xcc23('0x13'),_0x146249['message']);_0x2bcfa3(_0x58c254[_0xcc23('0x11')](0x1f4,_0x146249[_0xcc23('0x12')]));});}})['catch'](function(_0x2b7ab3){logger[_0xcc23('0x11')](_0xcc23('0x13'),_0x2b7ab3[_0xcc23('0x12')]);_0x2bcfa3(_0x58c254[_0xcc23('0x11')](0x1f4,_0x2b7ab3['message']));});}else _0x44048f({'additional':0x0});});});};exports['SwapAdditionalPhones']=function(_0x2ebf3d){var _0x3f700c=this;return new Promise(function(_0xfb642d,_0xd556b6){return db[_0xcc23('0x14')][_0xcc23('0x15')]({'raw':!![],'where':{'ContactId':_0x2ebf3d[_0xcc23('0x16')][_0xcc23('0x26')],'ListId':_0x2ebf3d['body'][_0xcc23('0x17')],'VoiceQueueId':_0x2ebf3d[_0xcc23('0x16')][_0xcc23('0x18')]===undefined?null:_0x2ebf3d[_0xcc23('0x16')]['VoiceQueueId'],'CampaignId':_0x2ebf3d[_0xcc23('0x16')][_0xcc23('0x27')]===undefined?null:_0x2ebf3d['body']['CampaignId']}})[_0xcc23('0xb')](function(_0x432f27){if(_0x432f27!=null){return db['CmHopperAdditionalPhone'][_0xcc23('0x15')]({'raw':!![],'where':{'CmHopperId':_0x432f27['id'],'OrderBy':{'$gte':_0x432f27[_0xcc23('0x1a')]}},'order':[[_0xcc23('0x1a'),_0xcc23('0x23')]]})[_0xcc23('0xb')](function(_0x4cb07d){if(_0x4cb07d)return activateAdditionalPhone(_0x432f27,_0x2ebf3d[_0xcc23('0x16')],_0x4cb07d,_0x2ebf3d[_0xcc23('0x28')],_0x2ebf3d[_0xcc23('0x29')])['then'](function(_0x1509e0){_0xfb642d(_0x1509e0);});else{return db[_0xcc23('0x19')][_0xcc23('0x15')]({'raw':!![],'where':{'CmHopperId':_0x432f27['id']},'order':[[_0xcc23('0x1a'),_0xcc23('0x23')]]})[_0xcc23('0xb')](function(_0x48d89a){if(_0x48d89a)return activateAdditionalPhone(_0x432f27,_0x2ebf3d[_0xcc23('0x16')],_0x48d89a,_0x2ebf3d[_0xcc23('0x28')],_0x2ebf3d[_0xcc23('0x29')])['then'](function(_0xb84c87){_0xfb642d(_0xb84c87);});else{_0xfb642d({'id':_0x432f27['id'],'phone':''});}})[_0xcc23('0x25')](function(_0x4b03d6){logger[_0xcc23('0x11')]('VerifyAdditionalPhones',_0x4b03d6[_0xcc23('0x12')]);_0xd556b6(_0x3f700c[_0xcc23('0x11')](0x1f4,_0x4b03d6[_0xcc23('0x12')]));});}})['catch'](function(_0x4dd8b1){logger[_0xcc23('0x11')](_0xcc23('0x13'),_0x4dd8b1['message']);_0xd556b6(_0x3f700c[_0xcc23('0x11')](0x1f4,_0x4dd8b1[_0xcc23('0x12')]));});}else _0xfb642d(0x1);});});};function activateAdditionalPhone(_0x486d38,_0x5a8130,_0x1756f0,_0x2eea39,_0x364a00){return new Promise(function(_0x41bc6a,_0x2dead1){var _0x1c052e;if(_['isNil'](_0x1756f0['scheduledat'])){_0x1756f0['scheduledat']=moment();}if(moment()>moment(_0x1756f0[_0xcc23('0x2a')])){_0x1c052e=moment()[_0xcc23('0x2b')](_0x364a00||0x3,_0xcc23('0x2c'));}else{if(_0x1756f0[_0xcc23('0x1a')]==0x0){_0x1c052e=moment(_0x1756f0[_0xcc23('0x2a')]);}else{_0x1c052e=moment()[_0xcc23('0x2b')](_0x364a00||0x3,_0xcc23('0x2c'));}}if(_['isNil'](_0x1c052e)){_0x1c052e=moment()['add'](_0x364a00||0x3,_0xcc23('0x2c'));}var _0x48e436={'phone':_0x486d38[_0xcc23('0x2d')],'active':0x0,'OrderBy':_[_0xcc23('0x2e')](_0x486d38[_0xcc23('0x1a')])?0x0:_0x486d38['OrderBy'],'scheduledat':moment()[_0xcc23('0x2b')](_0x2eea39||0x1,_0xcc23('0x2c')),'countbusyretry':_0x5a8130['countbusyretry'],'countcongestionretry':_0x5a8130['countcongestionretry'],'countnoanswerretry':_0x5a8130['countnoanswerretry'],'countnosuchnumberretry':_0x5a8130['countnosuchnumberretry'],'countdropretry':_0x5a8130[_0xcc23('0x2f')],'countabandonedretry':_0x5a8130[_0xcc23('0x1e')],'countmachineretry':_0x5a8130['countmachineretry'],'countagentrejectretry':_0x5a8130[_0xcc23('0x20')],'createdAt':_0x5a8130[_0xcc23('0x30')],'updatedAt':_0x5a8130[_0xcc23('0x31')]};var _0x274922={'CmHopperId':_0x486d38['id'],'phone':_0x1756f0[_0xcc23('0x2d')],'active':0x0,'OrderBy':_[_0xcc23('0x2e')](_0x1756f0[_0xcc23('0x1a')])?0x0:_0x1756f0[_0xcc23('0x1a')],'scheduledat':_0x1c052e,'countbusyretry':_0x1756f0[_0xcc23('0x1b')],'countcongestionretry':_0x1756f0[_0xcc23('0x24')],'countnoanswerretry':_0x1756f0[_0xcc23('0x1c')],'countnosuchnumberretry':_0x1756f0['countnosuchnumberretry'],'countdropretry':_0x1756f0[_0xcc23('0x2f')],'countabandonedretry':_0x1756f0['countabandonedretry'],'countmachineretry':_0x1756f0['countmachineretry'],'countagentrejectretry':_0x1756f0['countagentrejectretry'],'createdAt':_0x1756f0['createdAt'],'updatedAt':_0x1756f0[_0xcc23('0x31')]};return db[_0xcc23('0x32')][_0xcc23('0x33')](function(_0x471571){return db[_0xcc23('0x19')][_0xcc23('0x34')](_0x48e436,{'where':{'id':_0x1756f0['id']}},{'transaction':_0x471571})[_0xcc23('0xb')](function(){return db['CmHopper'][_0xcc23('0x34')](_0x274922,{'where':{'id':_0x486d38['id']}},{'transaction':_0x471571});});})[_0xcc23('0xb')](function(_0x1506dc){_0x41bc6a({'id':_0x486d38['id'],'phone':_0x1756f0[_0xcc23('0x2d')]});})[_0xcc23('0x25')](function(_0x2a82dd){logger[_0xcc23('0x11')](_0xcc23('0x35'),_0x2a82dd[_0xcc23('0x12')]);_0x2dead1({'error':_0x2a82dd[_0xcc23('0x12')]});});});}exports[_0xcc23('0x36')]=function(_0x1eb6a0){var _0x40e512=this;return new Promise(function(_0x20b096,_0x3877a4){return db['CmHopper']['update'](_0x1eb6a0[_0xcc23('0x16')][_0xcc23('0x37')],{'where':{'id':_0x1eb6a0[_0xcc23('0x16')]['id']}})[_0xcc23('0xb')](function(_0x439d83){_0x20b096(_0x439d83);})[_0xcc23('0x25')](function(_0x312b24){logger[_0xcc23('0x11')](_0xcc23('0x36'),_0x312b24['message']);_0x3877a4(_0x40e512[_0xcc23('0x11')](0x1f4,_0x312b24[_0xcc23('0x12')]));});});}; \ No newline at end of file +var _0x2e77=['countagentrejectretry','SwapAdditionalPhones','ContactId','duration','waitTime','isNil','scheduledat','minutes','add','phone','createdAt','updatedAt','sequelize','transaction','update','activateAdditionalPhone','IncrementPreviewCounters','field','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','http','info','CmHopperAdditionalPhone,\x20%s,\x20%s','request\x20sent','debug','CmHopperAdditionalPhone,\x20%s,\x20%s,\x20%s','error','code','message','catch','VerifyAdditionalPhones','CmHopper','findOne','body','ListId','VoiceQueueId','CampaignId','then','CmHopperAdditionalPhone','OrderBy','ASC','countbusyretry','countcongestionretry','countnoanswerretry','countdropretry','countabandonedretry','entity','dialGlobalMaxRetry','countnosuchnumberretry','countmachineretry'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x2e77,0x12f));var _0x72e7=function(_0x12e798,_0x2eb501){_0x12e798=_0x12e798-0x0;var _0x746cd1=_0x2e77[_0x12e798];return _0x746cd1;};'use strict';var _=require(_0x72e7('0x0'));var util=require(_0x72e7('0x1'));var moment=require(_0x72e7('0x2'));var BPromise=require(_0x72e7('0x3'));var rs=require(_0x72e7('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x72e7('0x5'))['db'];var utils=require(_0x72e7('0x6'));var logger=require(_0x72e7('0x7'))('rpc');var config=require(_0x72e7('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x72e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3c37bf,_0x1f8590,_0x32888c){return new BPromise(function(_0x220d6b,_0x3ac791){return client['request'](_0x3c37bf,_0x32888c)['then'](function(_0x4bd60e){logger[_0x72e7('0xa')](_0x72e7('0xb'),_0x1f8590,_0x72e7('0xc'));logger[_0x72e7('0xd')](_0x72e7('0xe'),_0x1f8590,_0x72e7('0xc'),JSON['stringify'](_0x4bd60e));if(_0x4bd60e[_0x72e7('0xf')]){if(_0x4bd60e[_0x72e7('0xf')][_0x72e7('0x10')]===0x1f4){logger[_0x72e7('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1f8590,_0x4bd60e[_0x72e7('0xf')]['message']);return _0x3ac791(_0x4bd60e['error']['message']);}logger[_0x72e7('0xf')]('CmHopperAdditionalPhone,\x20%s,\x20%s',_0x1f8590,_0x4bd60e[_0x72e7('0xf')][_0x72e7('0x11')]);return _0x220d6b(_0x4bd60e[_0x72e7('0xf')]['message']);}else{logger[_0x72e7('0xa')](_0x72e7('0xb'),_0x1f8590,_0x72e7('0xc'));_0x220d6b(_0x4bd60e['result']['message']);}})[_0x72e7('0x12')](function(_0x5cda5e){logger['error'](_0x72e7('0xb'),_0x1f8590,_0x5cda5e);_0x3ac791(_0x5cda5e);});});}exports[_0x72e7('0x13')]=function(_0x5b7227){var _0x22c607=this;return new Promise(function(_0x564873,_0x542635){return db[_0x72e7('0x14')][_0x72e7('0x15')]({'raw':!![],'where':{'ContactId':_0x5b7227[_0x72e7('0x16')]['ContactId'],'ListId':_0x5b7227[_0x72e7('0x16')][_0x72e7('0x17')],'VoiceQueueId':_0x5b7227['body']['VoiceQueueId']===undefined?null:_0x5b7227[_0x72e7('0x16')][_0x72e7('0x18')],'CampaignId':_0x5b7227[_0x72e7('0x16')]['CampaignId']===undefined?null:_0x5b7227[_0x72e7('0x16')][_0x72e7('0x19')]}})[_0x72e7('0x1a')](function(_0x5bd2ae){if(_0x5bd2ae!=null){return db[_0x72e7('0x1b')][_0x72e7('0x15')]({'raw':!![],'where':{'CmHopperId':_0x5bd2ae['id'],'OrderBy':{'$gt':_0x5bd2ae[_0x72e7('0x1c')]}},'order':[[_0x72e7('0x1c'),_0x72e7('0x1d')]]})[_0x72e7('0x1a')](function(_0x26b933){var _0x357292=0x0;if(_0x26b933){if(_0x26b933[_0x72e7('0x1e')]+_0x26b933[_0x72e7('0x1f')]+_0x26b933[_0x72e7('0x20')]+_0x26b933['countnosuchnumberretry']+_0x26b933[_0x72e7('0x21')]+_0x26b933[_0x72e7('0x22')]+_0x26b933['countmachineretry']+_0x26b933['countagentrejectretry']<_0x5b7227[_0x72e7('0x23')][_0x72e7('0x24')])_0x357292=0x1;_0x564873({'additional':_0x357292});}else{return db[_0x72e7('0x1b')][_0x72e7('0x15')]({'raw':!![],'where':{'CmHopperId':_0x5bd2ae['id']},'order':[[_0x72e7('0x1c'),'ASC']]})[_0x72e7('0x1a')](function(_0x19a7fe){var _0x33a53c=0x0;if(_0x19a7fe){if(_0x19a7fe[_0x72e7('0x1e')]+_0x19a7fe[_0x72e7('0x1f')]+_0x19a7fe[_0x72e7('0x20')]+_0x19a7fe[_0x72e7('0x25')]+_0x19a7fe[_0x72e7('0x21')]+_0x19a7fe['countabandonedretry']+_0x19a7fe[_0x72e7('0x26')]+_0x19a7fe[_0x72e7('0x27')]<_0x5b7227[_0x72e7('0x23')][_0x72e7('0x24')])_0x33a53c=0x1;_0x564873({'additional':_0x33a53c});}else{_0x564873({'additional':0x0});}})[_0x72e7('0x12')](function(_0x4d5f6d){logger[_0x72e7('0xf')]('VerifyAdditionalPhones',_0x4d5f6d[_0x72e7('0x11')]);_0x542635(_0x22c607[_0x72e7('0xf')](0x1f4,_0x4d5f6d[_0x72e7('0x11')]));});}})['catch'](function(_0x3af1b6){logger[_0x72e7('0xf')]('VerifyAdditionalPhones',_0x3af1b6[_0x72e7('0x11')]);_0x542635(_0x22c607['error'](0x1f4,_0x3af1b6[_0x72e7('0x11')]));});}else _0x564873({'additional':0x0});});});};exports[_0x72e7('0x28')]=function(_0x45128b){var _0x51d0a4=this;return new Promise(function(_0x27f461,_0x22c1fc){return db[_0x72e7('0x14')][_0x72e7('0x15')]({'raw':!![],'where':{'ContactId':_0x45128b[_0x72e7('0x16')][_0x72e7('0x29')],'ListId':_0x45128b[_0x72e7('0x16')][_0x72e7('0x17')],'VoiceQueueId':_0x45128b[_0x72e7('0x16')][_0x72e7('0x18')]===undefined?null:_0x45128b[_0x72e7('0x16')][_0x72e7('0x18')],'CampaignId':_0x45128b[_0x72e7('0x16')][_0x72e7('0x19')]===undefined?null:_0x45128b[_0x72e7('0x16')][_0x72e7('0x19')]}})['then'](function(_0x53111c){if(_0x53111c!=null){return db[_0x72e7('0x1b')][_0x72e7('0x15')]({'raw':!![],'where':{'CmHopperId':_0x53111c['id'],'OrderBy':{'$gte':_0x53111c['OrderBy']}},'order':[[_0x72e7('0x1c'),_0x72e7('0x1d')]]})[_0x72e7('0x1a')](function(_0x12a2b1){if(_0x12a2b1)return activateAdditionalPhone(_0x53111c,_0x45128b[_0x72e7('0x16')],_0x12a2b1,_0x45128b[_0x72e7('0x2a')],_0x45128b[_0x72e7('0x2b')])[_0x72e7('0x1a')](function(_0x20debb){_0x27f461(_0x20debb);});else{return db[_0x72e7('0x1b')][_0x72e7('0x15')]({'raw':!![],'where':{'CmHopperId':_0x53111c['id']},'order':[[_0x72e7('0x1c'),_0x72e7('0x1d')]]})['then'](function(_0x15e1cf){if(_0x15e1cf)return activateAdditionalPhone(_0x53111c,_0x45128b[_0x72e7('0x16')],_0x15e1cf,_0x45128b['duration'],_0x45128b[_0x72e7('0x2b')])[_0x72e7('0x1a')](function(_0x291742){_0x27f461(_0x291742);});else{_0x27f461({'id':_0x53111c['id'],'phone':''});}})[_0x72e7('0x12')](function(_0x53272c){logger['error'](_0x72e7('0x13'),_0x53272c['message']);_0x22c1fc(_0x51d0a4[_0x72e7('0xf')](0x1f4,_0x53272c[_0x72e7('0x11')]));});}})[_0x72e7('0x12')](function(_0xb06ff){logger[_0x72e7('0xf')](_0x72e7('0x13'),_0xb06ff[_0x72e7('0x11')]);_0x22c1fc(_0x51d0a4[_0x72e7('0xf')](0x1f4,_0xb06ff[_0x72e7('0x11')]));});}else _0x27f461(0x1);});});};function activateAdditionalPhone(_0x5e309a,_0x1a4b73,_0x475b71,_0x298b51,_0x92c6f7){return new Promise(function(_0xc9cf1b,_0x816055){var _0x104b69;if(_[_0x72e7('0x2c')](_0x475b71[_0x72e7('0x2d')])){_0x475b71[_0x72e7('0x2d')]=moment();}if(moment()>moment(_0x475b71[_0x72e7('0x2d')])){_0x104b69=moment()['add'](_0x92c6f7||0x3,_0x72e7('0x2e'));}else{if(_0x475b71[_0x72e7('0x1c')]==0x0){_0x104b69=moment(_0x475b71[_0x72e7('0x2d')]);}else{_0x104b69=moment()['add'](_0x92c6f7||0x3,_0x72e7('0x2e'));}}if(_[_0x72e7('0x2c')](_0x104b69)){_0x104b69=moment()[_0x72e7('0x2f')](_0x92c6f7||0x3,'minutes');}var _0x456ba5={'phone':_0x5e309a[_0x72e7('0x30')],'active':0x0,'OrderBy':_[_0x72e7('0x2c')](_0x5e309a['OrderBy'])?0x0:_0x5e309a[_0x72e7('0x1c')],'scheduledat':moment()[_0x72e7('0x2f')](_0x298b51||0x1,_0x72e7('0x2e')),'countbusyretry':_0x1a4b73[_0x72e7('0x1e')],'countcongestionretry':_0x1a4b73[_0x72e7('0x1f')],'countnoanswerretry':_0x1a4b73[_0x72e7('0x20')],'countnosuchnumberretry':_0x1a4b73[_0x72e7('0x25')],'countdropretry':_0x1a4b73[_0x72e7('0x21')],'countabandonedretry':_0x1a4b73[_0x72e7('0x22')],'countmachineretry':_0x1a4b73[_0x72e7('0x26')],'countagentrejectretry':_0x1a4b73[_0x72e7('0x27')],'createdAt':_0x1a4b73[_0x72e7('0x31')],'updatedAt':_0x1a4b73[_0x72e7('0x32')]};var _0x2f8dcd={'CmHopperId':_0x5e309a['id'],'phone':_0x475b71['phone'],'active':0x0,'OrderBy':_[_0x72e7('0x2c')](_0x475b71[_0x72e7('0x1c')])?0x0:_0x475b71[_0x72e7('0x1c')],'scheduledat':_0x104b69,'countbusyretry':_0x475b71['countbusyretry'],'countcongestionretry':_0x475b71['countcongestionretry'],'countnoanswerretry':_0x475b71['countnoanswerretry'],'countnosuchnumberretry':_0x475b71[_0x72e7('0x25')],'countdropretry':_0x475b71[_0x72e7('0x21')],'countabandonedretry':_0x475b71[_0x72e7('0x22')],'countmachineretry':_0x475b71[_0x72e7('0x26')],'countagentrejectretry':_0x475b71[_0x72e7('0x27')],'createdAt':_0x475b71[_0x72e7('0x31')],'updatedAt':_0x475b71['updatedAt']};return db[_0x72e7('0x33')][_0x72e7('0x34')](function(_0x36ad7c){return db[_0x72e7('0x1b')][_0x72e7('0x35')](_0x456ba5,{'where':{'id':_0x475b71['id']}},{'transaction':_0x36ad7c})['then'](function(){return db[_0x72e7('0x14')][_0x72e7('0x35')](_0x2f8dcd,{'where':{'id':_0x5e309a['id']}},{'transaction':_0x36ad7c});});})[_0x72e7('0x1a')](function(_0x40083a){_0xc9cf1b({'id':_0x5e309a['id'],'phone':_0x475b71[_0x72e7('0x30')]});})[_0x72e7('0x12')](function(_0x51440e){logger[_0x72e7('0xf')](_0x72e7('0x36'),_0x51440e[_0x72e7('0x11')]);_0x816055({'error':_0x51440e[_0x72e7('0x11')]});});});}exports[_0x72e7('0x37')]=function(_0x29741d){var _0x6b0ab=this;return new Promise(function(_0x14c25c,_0x543451){return db[_0x72e7('0x14')][_0x72e7('0x35')](_0x29741d[_0x72e7('0x16')][_0x72e7('0x38')],{'where':{'id':_0x29741d['body']['id']}})['then'](function(_0x5dc106){_0x14c25c(_0x5dc106);})[_0x72e7('0x12')](function(_0x1f73c8){logger[_0x72e7('0xf')](_0x72e7('0x37'),_0x1f73c8[_0x72e7('0x11')]);_0x543451(_0x6b0ab[_0x72e7('0xf')](0x1f4,_0x1f73c8[_0x72e7('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperAdditionalPhone/index.js b/server/api/cmHopperAdditionalPhone/index.js index 6ec6ab0..b01194f 100644 --- a/server/api/cmHopperAdditionalPhone/index.js +++ b/server/api/cmHopperAdditionalPhone/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x52ae=['multer','util','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperAdditionalPhone.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports'];(function(_0x21a9d9,_0x4d5ac8){var _0x46adce=function(_0xfdd336){while(--_0xfdd336){_0x21a9d9['push'](_0x21a9d9['shift']());}};_0x46adce(++_0x4d5ac8);}(_0x52ae,0x18f));var _0xe52a=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0x52ae[_0x4fb1b8];return _0x146c71;};'use strict';var multer=require(_0xe52a('0x0'));var util=require(_0xe52a('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xe52a('0x2')]();var fs_extra=require(_0xe52a('0x3'));var auth=require(_0xe52a('0x4'));var interaction=require(_0xe52a('0x5'));var config=require(_0xe52a('0x6'));var controller=require(_0xe52a('0x7'));router[_0xe52a('0x8')]('/',auth[_0xe52a('0x9')](),controller[_0xe52a('0xa')]);router['get']('/:id',auth[_0xe52a('0x9')](),controller[_0xe52a('0xb')]);router[_0xe52a('0xc')]('/',auth['isAuthenticated'](),controller[_0xe52a('0xd')]);router[_0xe52a('0xe')](_0xe52a('0xf'),auth[_0xe52a('0x9')](),controller['update']);router[_0xe52a('0x10')](_0xe52a('0xf'),auth['isAuthenticated'](),controller[_0xe52a('0x11')]);module[_0xe52a('0x12')]=router; \ No newline at end of file +var _0xfcc8=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','../../components/interaction/service','./cmHopperAdditionalPhone.controller','isAuthenticated','index','get'];(function(_0x118724,_0x455f58){var _0x3f00f7=function(_0x203f06){while(--_0x203f06){_0x118724['push'](_0x118724['shift']());}};_0x3f00f7(++_0x455f58);}(_0xfcc8,0xb4));var _0x8fcc=function(_0x282b09,_0x4cdc6f){_0x282b09=_0x282b09-0x0;var _0x471ed0=_0xfcc8[_0x282b09];return _0x471ed0;};'use strict';var multer=require(_0x8fcc('0x0'));var util=require(_0x8fcc('0x1'));var path=require(_0x8fcc('0x2'));var timeout=require(_0x8fcc('0x3'));var express=require('express');var router=express[_0x8fcc('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x8fcc('0x5'));var config=require('../../config/environment');var controller=require(_0x8fcc('0x6'));router['get']('/',auth[_0x8fcc('0x7')](),controller[_0x8fcc('0x8')]);router[_0x8fcc('0x9')](_0x8fcc('0xa'),auth[_0x8fcc('0x7')](),controller[_0x8fcc('0xb')]);router[_0x8fcc('0xc')]('/',auth[_0x8fcc('0x7')](),controller[_0x8fcc('0xd')]);router[_0x8fcc('0xe')](_0x8fcc('0xa'),auth[_0x8fcc('0x7')](),controller[_0x8fcc('0xf')]);router[_0x8fcc('0x10')]('/:id',auth[_0x8fcc('0x7')](),controller[_0x8fcc('0x11')]);module[_0x8fcc('0x12')]=router; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.attributes.js b/server/api/cmHopperBlack/cmHopperBlack.attributes.js index 2612670..7c3fd5c 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 _0xef72=['exports','INTEGER','contactListQueue','moment','sequelize'];(function(_0xd8920a,_0x3248c1){var _0x50d00d=function(_0x5034a5){while(--_0x5034a5){_0xd8920a['push'](_0xd8920a['shift']());}};_0x50d00d(++_0x3248c1);}(_0xef72,0xf8));var _0x2ef7=function(_0x3cf192,_0x34c79b){_0x3cf192=_0x3cf192-0x0;var _0x3689dd=_0xef72[_0x3cf192];return _0x3689dd;};'use strict';var moment=require(_0x2ef7('0x0'));var Sequelize=require(_0x2ef7('0x1'));module[_0x2ef7('0x2')]={'phone':{'type':Sequelize['STRING'],'allowNull':![]},'ContactId':{'type':Sequelize['INTEGER'],'unique':'contactListQueue'},'ListId':{'type':Sequelize[_0x2ef7('0x3')],'unique':'contactListQueue'},'VoiceQueueId':{'type':Sequelize[_0x2ef7('0x3')],'unique':_0x2ef7('0x4')}}; \ No newline at end of file +var _0xadf0=['contactListQueue','sequelize','exports','STRING','INTEGER'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0xadf0,0x12d));var _0x0adf=function(_0x527ea0,_0x144883){_0x527ea0=_0x527ea0-0x0;var _0x1a6f90=_0xadf0[_0x527ea0];return _0x1a6f90;};'use strict';var moment=require('moment');var Sequelize=require(_0x0adf('0x0'));module[_0x0adf('0x1')]={'phone':{'type':Sequelize[_0x0adf('0x2')],'allowNull':![]},'ContactId':{'type':Sequelize[_0x0adf('0x3')],'unique':_0x0adf('0x4')},'ListId':{'type':Sequelize[_0x0adf('0x3')],'unique':_0x0adf('0x4')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'unique':_0x0adf('0x4')}}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.controller.js b/server/api/cmHopperBlack/cmHopperBlack.controller.js index c1671f6..622e548 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 _0xd906=['then','destroy','error','stack','name','send','index','map','CmHopperBlack','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','options','includeAll','show','params','include','find','body','catch','describe','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','sendStatus','status','end','json','offset','limit','count','update'];(function(_0x5cab28,_0x307622){var _0xa3554d=function(_0x330139){while(--_0x330139){_0x5cab28['push'](_0x5cab28['shift']());}};_0xa3554d(++_0x307622);}(_0xd906,0x6b));var _0x6d90=function(_0x13eebf,_0x5c12b4){_0x13eebf=_0x13eebf-0x0;var _0x5e05a8=_0xd906[_0x13eebf];return _0x5e05a8;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x6d90('0x0'));var jsonpatch=require(_0x6d90('0x1'));var rp=require(_0x6d90('0x2'));var moment=require(_0x6d90('0x3'));var BPromise=require(_0x6d90('0x4'));var Mustache=require('mustache');var util=require(_0x6d90('0x5'));var path=require(_0x6d90('0x6'));var sox=require(_0x6d90('0x7'));var csv=require(_0x6d90('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6d90('0x9'));var _=require(_0x6d90('0xa'));var squel=require(_0x6d90('0xb'));var crypto=require(_0x6d90('0xc'));var jsforce=require(_0x6d90('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x6d90('0xe'));var Redis=require(_0x6d90('0xf'));var authService=require(_0x6d90('0x10'));var qs=require(_0x6d90('0x11'));var as=require(_0x6d90('0x12'));var hardwareService=require(_0x6d90('0x13'));var logger=require(_0x6d90('0x14'))('api');var utils=require(_0x6d90('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x6d90('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2e791b,_0x3c5dc9){_0x3c5dc9=_0x3c5dc9||0xcc;return function(_0x1e4b32){if(_0x1e4b32){return _0x2e791b[_0x6d90('0x17')](_0x3c5dc9);}return _0x2e791b[_0x6d90('0x18')](_0x3c5dc9)[_0x6d90('0x19')]();};}function respondWithResult(_0x9c7ac9,_0x2c2475){_0x2c2475=_0x2c2475||0xc8;return function(_0x50b642){if(_0x50b642){return _0x9c7ac9[_0x6d90('0x18')](_0x2c2475)[_0x6d90('0x1a')](_0x50b642);}};}function respondWithFilteredResult(_0x2de602,_0x2c0b05){return function(_0x1f128f){if(_0x1f128f){var _0x4dc4e3=typeof _0x2c0b05[_0x6d90('0x1b')]==='undefined'&&typeof _0x2c0b05[_0x6d90('0x1c')]==='undefined';var _0x179703=_0x1f128f[_0x6d90('0x1d')];var _0x352736=_0x4dc4e3?0x0:_0x2c0b05[_0x6d90('0x1b')];var _0x4e6682=_0x4dc4e3?_0x1f128f['count']:_0x2c0b05[_0x6d90('0x1b')]+_0x2c0b05['limit'];var _0x3aaa84;if(_0x4e6682>=_0x179703){_0x4e6682=_0x179703;_0x3aaa84=0xc8;}else{_0x3aaa84=0xce;}_0x2de602[_0x6d90('0x18')](_0x3aaa84);return _0x2de602['set']('Content-Range',_0x352736+'-'+_0x4e6682+'/'+_0x179703)[_0x6d90('0x1a')](_0x1f128f);}return null;};}function patchUpdates(_0x2ca50e){return function(_0x43b6bf){try{jsonpatch['apply'](_0x43b6bf,_0x2ca50e,!![]);}catch(_0x5cf8dc){return BPromise['reject'](_0x5cf8dc);}return _0x43b6bf['save']();};}function saveUpdates(_0x2d07f9,_0x5703e6){return function(_0x19eb9d){if(_0x19eb9d){return _0x19eb9d[_0x6d90('0x1e')](_0x2d07f9)[_0x6d90('0x1f')](function(_0x470b5c){return _0x470b5c;});}return null;};}function removeEntity(_0x4378ca,_0x3dcccd){return function(_0x3aef5b){if(_0x3aef5b){return _0x3aef5b[_0x6d90('0x20')]()[_0x6d90('0x1f')](function(){_0x4378ca[_0x6d90('0x18')](0xcc)[_0x6d90('0x19')]();});}};}function handleEntityNotFound(_0x597386,_0x18f9aa){return function(_0x2036f1){if(!_0x2036f1){_0x597386[_0x6d90('0x17')](0x194);}return _0x2036f1;};}function handleError(_0x5c24c5,_0x4872b9){_0x4872b9=_0x4872b9||0x1f4;return function(_0x1fefae){logger[_0x6d90('0x21')](_0x1fefae[_0x6d90('0x22')]);if(_0x1fefae[_0x6d90('0x23')]){delete _0x1fefae[_0x6d90('0x23')];}_0x5c24c5[_0x6d90('0x18')](_0x4872b9)[_0x6d90('0x24')](_0x1fefae);};}exports[_0x6d90('0x25')]=function(_0x175d6d,_0x5eea54){var _0x5ec50d={},_0x5e1ab7={},_0xf4fb3={'count':0x0,'rows':[]};var _0x5619fd=_[_0x6d90('0x26')](db[_0x6d90('0x27')][_0x6d90('0x28')],function(_0x3802fb){return{'name':_0x3802fb[_0x6d90('0x29')],'type':_0x3802fb[_0x6d90('0x2a')][_0x6d90('0x2b')]};});_0x5e1ab7[_0x6d90('0x2c')]=_[_0x6d90('0x26')](_0x5619fd,_0x6d90('0x23'));_0x5e1ab7[_0x6d90('0x2d')]=_[_0x6d90('0x2e')](_0x175d6d[_0x6d90('0x2d')]);_0x5e1ab7['filters']=_[_0x6d90('0x2f')](_0x5e1ab7[_0x6d90('0x2c')],_0x5e1ab7['query']);_0x5ec50d[_0x6d90('0x30')]=_[_0x6d90('0x2f')](_0x5e1ab7['model'],qs[_0x6d90('0x31')](_0x175d6d[_0x6d90('0x2d')][_0x6d90('0x31')]));_0x5ec50d[_0x6d90('0x30')]=_0x5ec50d[_0x6d90('0x30')][_0x6d90('0x32')]?_0x5ec50d[_0x6d90('0x30')]:_0x5e1ab7[_0x6d90('0x2c')];if(!_0x175d6d[_0x6d90('0x2d')][_0x6d90('0x33')](_0x6d90('0x34'))){_0x5ec50d[_0x6d90('0x1c')]=qs[_0x6d90('0x1c')](_0x175d6d[_0x6d90('0x2d')][_0x6d90('0x1c')]);_0x5ec50d[_0x6d90('0x1b')]=qs[_0x6d90('0x1b')](_0x175d6d[_0x6d90('0x2d')]['offset']);}_0x5ec50d[_0x6d90('0x35')]=qs['sort'](_0x175d6d[_0x6d90('0x2d')][_0x6d90('0x36')]);_0x5ec50d['where']=qs[_0x6d90('0x37')](_[_0x6d90('0x38')](_0x175d6d['query'],_0x5e1ab7[_0x6d90('0x37')]),_0x5619fd);if(_0x175d6d[_0x6d90('0x2d')][_0x6d90('0x39')]){_0x5ec50d[_0x6d90('0x3a')]=_[_0x6d90('0x3b')](_0x5ec50d['where'],{'$or':_[_0x6d90('0x26')](_0x5619fd,function(_0x340cf9){if(_0x340cf9[_0x6d90('0x2a')]!=='VIRTUAL'){var _0xa1eb2d={};_0xa1eb2d[_0x340cf9['name']]={'$like':'%'+_0x175d6d[_0x6d90('0x2d')]['filter']+'%'};return _0xa1eb2d;}})});}_0x5ec50d=_['merge']({},_0x5ec50d,_0x175d6d[_0x6d90('0x3c')]);var _0x2ac762={'where':_0x5ec50d[_0x6d90('0x3a')]};return db[_0x6d90('0x27')][_0x6d90('0x1d')](_0x2ac762)[_0x6d90('0x1f')](function(_0x3d36c7){_0xf4fb3[_0x6d90('0x1d')]=_0x3d36c7;if(_0x175d6d[_0x6d90('0x2d')][_0x6d90('0x3d')]){_0x5ec50d['include']=[{'all':!![]}];}return db['CmHopperBlack']['findAll'](_0x5ec50d);})['then'](function(_0x4f424c){_0xf4fb3['rows']=_0x4f424c;return _0xf4fb3;})[_0x6d90('0x1f')](respondWithFilteredResult(_0x5eea54,_0x5ec50d))['catch'](handleError(_0x5eea54,null));};exports[_0x6d90('0x3e')]=function(_0x446bae,_0x3485dd){var _0x1d4af0={'raw':!![],'where':{'id':_0x446bae[_0x6d90('0x3f')]['id']}},_0x5ed325={};_0x5ed325['model']=_[_0x6d90('0x2e')](db[_0x6d90('0x27')][_0x6d90('0x28')]);_0x5ed325[_0x6d90('0x2d')]=_[_0x6d90('0x2e')](_0x446bae['query']);_0x5ed325[_0x6d90('0x37')]=_[_0x6d90('0x2f')](_0x5ed325[_0x6d90('0x2c')],_0x5ed325[_0x6d90('0x2d')]);_0x1d4af0[_0x6d90('0x30')]=_['intersection'](_0x5ed325[_0x6d90('0x2c')],qs[_0x6d90('0x31')](_0x446bae['query'][_0x6d90('0x31')]));_0x1d4af0[_0x6d90('0x30')]=_0x1d4af0['attributes']['length']?_0x1d4af0[_0x6d90('0x30')]:_0x5ed325[_0x6d90('0x2c')];if(_0x446bae[_0x6d90('0x2d')][_0x6d90('0x3d')]){_0x1d4af0[_0x6d90('0x40')]=[{'all':!![]}];}_0x1d4af0=_[_0x6d90('0x3b')]({},_0x1d4af0,_0x446bae[_0x6d90('0x3c')]);return db[_0x6d90('0x27')][_0x6d90('0x41')](_0x1d4af0)[_0x6d90('0x1f')](handleEntityNotFound(_0x3485dd,null))[_0x6d90('0x1f')](respondWithResult(_0x3485dd,null))['catch'](handleError(_0x3485dd,null));};exports[_0x6d90('0x1e')]=function(_0x4e241a,_0x5de697){if(_0x4e241a['body']['id']){delete _0x4e241a[_0x6d90('0x42')]['id'];}return db[_0x6d90('0x27')][_0x6d90('0x41')]({'where':{'id':_0x4e241a[_0x6d90('0x3f')]['id']}})[_0x6d90('0x1f')](handleEntityNotFound(_0x5de697,null))[_0x6d90('0x1f')](saveUpdates(_0x4e241a[_0x6d90('0x42')],null))[_0x6d90('0x1f')](respondWithResult(_0x5de697,null))['catch'](handleError(_0x5de697,null));};exports[_0x6d90('0x20')]=function(_0x1f3729,_0x5eba5e){return db[_0x6d90('0x27')][_0x6d90('0x41')]({'where':{'id':_0x1f3729[_0x6d90('0x3f')]['id']}})[_0x6d90('0x1f')](handleEntityNotFound(_0x5eba5e,null))[_0x6d90('0x1f')](removeEntity(_0x5eba5e,null))[_0x6d90('0x43')](handleError(_0x5eba5e,null));};exports['describe']=function(_0x464a23,_0x16e9cd){return db['CmHopperBlack'][_0x6d90('0x44')]()[_0x6d90('0x1f')](respondWithResult(_0x16e9cd,null))[_0x6d90('0x43')](handleError(_0x16e9cd,null));}; \ No newline at end of file +var _0xa161=['findAll','rows','catch','show','params','rawAttributes','find','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','limit','undefined','count','offset','apply','reject','save','update','then','sendStatus','error','name','send','map','CmHopperBlack','fieldName','type','key','model','keys','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','options','includeAll','include'];(function(_0x1c2269,_0x206ebb){var _0x2e80ef=function(_0x51cadd){while(--_0x51cadd){_0x1c2269['push'](_0x1c2269['shift']());}};_0x2e80ef(++_0x206ebb);}(_0xa161,0x1bf));var _0x1a16=function(_0x570f9f,_0x4de4e2){_0x570f9f=_0x570f9f-0x0;var _0x2d87aa=_0xa161[_0x570f9f];return _0x2d87aa;};'use strict';var emlformat=require(_0x1a16('0x0'));var rimraf=require(_0x1a16('0x1'));var zipdir=require(_0x1a16('0x2'));var jsonpatch=require(_0x1a16('0x3'));var rp=require('request-promise');var moment=require(_0x1a16('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1a16('0x5'));var util=require(_0x1a16('0x6'));var path=require(_0x1a16('0x7'));var sox=require(_0x1a16('0x8'));var csv=require(_0x1a16('0x9'));var ejs=require(_0x1a16('0xa'));var fs=require('fs');var fs_extra=require(_0x1a16('0xb'));var _=require(_0x1a16('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1a16('0xd'));var deskjs=require(_0x1a16('0xe'));var toCsv=require(_0x1a16('0x9'));var querystring=require('querystring');var Papa=require(_0x1a16('0xf'));var Redis=require('ioredis');var authService=require(_0x1a16('0x10'));var qs=require(_0x1a16('0x11'));var as=require(_0x1a16('0x12'));var hardwareService=require(_0x1a16('0x13'));var logger=require(_0x1a16('0x14'))(_0x1a16('0x15'));var utils=require(_0x1a16('0x16'));var config=require(_0x1a16('0x17'));var licenseUtil=require(_0x1a16('0x18'));var db=require(_0x1a16('0x19'))['db'];function respondWithStatusCode(_0x1a846d,_0x36a52a){_0x36a52a=_0x36a52a||0xcc;return function(_0x33ebed){if(_0x33ebed){return _0x1a846d['sendStatus'](_0x36a52a);}return _0x1a846d[_0x1a16('0x1a')](_0x36a52a)[_0x1a16('0x1b')]();};}function respondWithResult(_0x2d29b8,_0x5614aa){_0x5614aa=_0x5614aa||0xc8;return function(_0x2a445f){if(_0x2a445f){return _0x2d29b8[_0x1a16('0x1a')](_0x5614aa)['json'](_0x2a445f);}};}function respondWithFilteredResult(_0x1bedb3,_0x55f63a){return function(_0x6e004a){if(_0x6e004a){var _0x1e59a2=typeof _0x55f63a['offset']==='undefined'&&typeof _0x55f63a[_0x1a16('0x1c')]===_0x1a16('0x1d');var _0x33da16=_0x6e004a[_0x1a16('0x1e')];var _0x2afd75=_0x1e59a2?0x0:_0x55f63a[_0x1a16('0x1f')];var _0x369d2c=_0x1e59a2?_0x6e004a['count']:_0x55f63a[_0x1a16('0x1f')]+_0x55f63a['limit'];var _0x44f885;if(_0x369d2c>=_0x33da16){_0x369d2c=_0x33da16;_0x44f885=0xc8;}else{_0x44f885=0xce;}_0x1bedb3[_0x1a16('0x1a')](_0x44f885);return _0x1bedb3['set']('Content-Range',_0x2afd75+'-'+_0x369d2c+'/'+_0x33da16)['json'](_0x6e004a);}return null;};}function patchUpdates(_0x1dbee8){return function(_0xa394e9){try{jsonpatch[_0x1a16('0x20')](_0xa394e9,_0x1dbee8,!![]);}catch(_0x4e1c3a){return BPromise[_0x1a16('0x21')](_0x4e1c3a);}return _0xa394e9[_0x1a16('0x22')]();};}function saveUpdates(_0x6fe317,_0xd1ef26){return function(_0x19f8f2){if(_0x19f8f2){return _0x19f8f2[_0x1a16('0x23')](_0x6fe317)[_0x1a16('0x24')](function(_0x43d864){return _0x43d864;});}return null;};}function removeEntity(_0x4d2ebe,_0x55fdf9){return function(_0x4730ee){if(_0x4730ee){return _0x4730ee['destroy']()['then'](function(){_0x4d2ebe[_0x1a16('0x1a')](0xcc)[_0x1a16('0x1b')]();});}};}function handleEntityNotFound(_0x15e02d,_0x3a92a7){return function(_0x2718c0){if(!_0x2718c0){_0x15e02d[_0x1a16('0x25')](0x194);}return _0x2718c0;};}function handleError(_0x3991a6,_0x16ff23){_0x16ff23=_0x16ff23||0x1f4;return function(_0x563343){logger[_0x1a16('0x26')](_0x563343['stack']);if(_0x563343[_0x1a16('0x27')]){delete _0x563343[_0x1a16('0x27')];}_0x3991a6[_0x1a16('0x1a')](_0x16ff23)[_0x1a16('0x28')](_0x563343);};}exports['index']=function(_0x60b051,_0x2999a4){var _0x178139={},_0x24c014={},_0xade469={'count':0x0,'rows':[]};var _0x2ba7f8=_[_0x1a16('0x29')](db[_0x1a16('0x2a')]['rawAttributes'],function(_0x4447ba){return{'name':_0x4447ba[_0x1a16('0x2b')],'type':_0x4447ba[_0x1a16('0x2c')][_0x1a16('0x2d')]};});_0x24c014[_0x1a16('0x2e')]=_[_0x1a16('0x29')](_0x2ba7f8,_0x1a16('0x27'));_0x24c014['query']=_[_0x1a16('0x2f')](_0x60b051['query']);_0x24c014['filters']=_[_0x1a16('0x30')](_0x24c014[_0x1a16('0x2e')],_0x24c014[_0x1a16('0x31')]);_0x178139['attributes']=_[_0x1a16('0x30')](_0x24c014[_0x1a16('0x2e')],qs[_0x1a16('0x32')](_0x60b051[_0x1a16('0x31')][_0x1a16('0x32')]));_0x178139['attributes']=_0x178139[_0x1a16('0x33')][_0x1a16('0x34')]?_0x178139[_0x1a16('0x33')]:_0x24c014[_0x1a16('0x2e')];if(!_0x60b051['query'][_0x1a16('0x35')](_0x1a16('0x36'))){_0x178139[_0x1a16('0x1c')]=qs['limit'](_0x60b051[_0x1a16('0x31')][_0x1a16('0x1c')]);_0x178139[_0x1a16('0x1f')]=qs['offset'](_0x60b051['query'][_0x1a16('0x1f')]);}_0x178139['order']=qs['sort'](_0x60b051[_0x1a16('0x31')][_0x1a16('0x37')]);_0x178139['where']=qs[_0x1a16('0x38')](_[_0x1a16('0x39')](_0x60b051[_0x1a16('0x31')],_0x24c014[_0x1a16('0x38')]),_0x2ba7f8);if(_0x60b051['query'][_0x1a16('0x3a')]){_0x178139[_0x1a16('0x3b')]=_['merge'](_0x178139[_0x1a16('0x3b')],{'$or':_['map'](_0x2ba7f8,function(_0xca6efd){if(_0xca6efd[_0x1a16('0x2c')]!=='VIRTUAL'){var _0x10dccd={};_0x10dccd[_0xca6efd[_0x1a16('0x27')]]={'$like':'%'+_0x60b051[_0x1a16('0x31')][_0x1a16('0x3a')]+'%'};return _0x10dccd;}})});}_0x178139=_[_0x1a16('0x3c')]({},_0x178139,_0x60b051[_0x1a16('0x3d')]);var _0x5658b2={'where':_0x178139[_0x1a16('0x3b')]};return db[_0x1a16('0x2a')][_0x1a16('0x1e')](_0x5658b2)[_0x1a16('0x24')](function(_0x34c688){_0xade469[_0x1a16('0x1e')]=_0x34c688;if(_0x60b051[_0x1a16('0x31')][_0x1a16('0x3e')]){_0x178139[_0x1a16('0x3f')]=[{'all':!![]}];}return db['CmHopperBlack'][_0x1a16('0x40')](_0x178139);})[_0x1a16('0x24')](function(_0x5fa084){_0xade469[_0x1a16('0x41')]=_0x5fa084;return _0xade469;})[_0x1a16('0x24')](respondWithFilteredResult(_0x2999a4,_0x178139))[_0x1a16('0x42')](handleError(_0x2999a4,null));};exports[_0x1a16('0x43')]=function(_0x4afbcd,_0x40fcaa){var _0xf6f02={'raw':!![],'where':{'id':_0x4afbcd[_0x1a16('0x44')]['id']}},_0x39f37a={};_0x39f37a[_0x1a16('0x2e')]=_[_0x1a16('0x2f')](db[_0x1a16('0x2a')][_0x1a16('0x45')]);_0x39f37a[_0x1a16('0x31')]=_[_0x1a16('0x2f')](_0x4afbcd[_0x1a16('0x31')]);_0x39f37a[_0x1a16('0x38')]=_['intersection'](_0x39f37a['model'],_0x39f37a[_0x1a16('0x31')]);_0xf6f02[_0x1a16('0x33')]=_[_0x1a16('0x30')](_0x39f37a[_0x1a16('0x2e')],qs[_0x1a16('0x32')](_0x4afbcd[_0x1a16('0x31')][_0x1a16('0x32')]));_0xf6f02[_0x1a16('0x33')]=_0xf6f02['attributes'][_0x1a16('0x34')]?_0xf6f02[_0x1a16('0x33')]:_0x39f37a[_0x1a16('0x2e')];if(_0x4afbcd['query'][_0x1a16('0x3e')]){_0xf6f02[_0x1a16('0x3f')]=[{'all':!![]}];}_0xf6f02=_[_0x1a16('0x3c')]({},_0xf6f02,_0x4afbcd[_0x1a16('0x3d')]);return db[_0x1a16('0x2a')][_0x1a16('0x46')](_0xf6f02)[_0x1a16('0x24')](handleEntityNotFound(_0x40fcaa,null))['then'](respondWithResult(_0x40fcaa,null))[_0x1a16('0x42')](handleError(_0x40fcaa,null));};exports[_0x1a16('0x23')]=function(_0x163a58,_0x568579){if(_0x163a58['body']['id']){delete _0x163a58[_0x1a16('0x47')]['id'];}return db[_0x1a16('0x2a')][_0x1a16('0x46')]({'where':{'id':_0x163a58[_0x1a16('0x44')]['id']}})[_0x1a16('0x24')](handleEntityNotFound(_0x568579,null))['then'](saveUpdates(_0x163a58[_0x1a16('0x47')],null))[_0x1a16('0x24')](respondWithResult(_0x568579,null))[_0x1a16('0x42')](handleError(_0x568579,null));};exports['destroy']=function(_0x231172,_0xcf4c3b){return db['CmHopperBlack'][_0x1a16('0x46')]({'where':{'id':_0x231172[_0x1a16('0x44')]['id']}})['then'](handleEntityNotFound(_0xcf4c3b,null))[_0x1a16('0x24')](removeEntity(_0xcf4c3b,null))['catch'](handleError(_0xcf4c3b,null));};exports[_0x1a16('0x48')]=function(_0x4ad3bf,_0x553ce2){return db[_0x1a16('0x2a')][_0x1a16('0x48')]()[_0x1a16('0x24')](respondWithResult(_0x553ce2,null))[_0x1a16('0x42')](handleError(_0x553ce2,null));}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/cmHopperBlack.model.js b/server/api/cmHopperBlack/cmHopperBlack.model.js index a115bb0..9380ab2 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 _0x2bbc=['CmHopperBlack','cm_hopper_black','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./cmHopperBlack.attributes','define'];(function(_0x2ede83,_0x326c5b){var _0x3f1417=function(_0x22f319){while(--_0x22f319){_0x2ede83['push'](_0x2ede83['shift']());}};_0x3f1417(++_0x326c5b);}(_0x2bbc,0x65));var _0xc2bb=function(_0x3a89de,_0x19f1e7){_0x3a89de=_0x3a89de-0x0;var _0x4eb3d7=_0x2bbc[_0x3a89de];return _0x4eb3d7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xc2bb('0x0'))(_0xc2bb('0x1'));var moment=require(_0xc2bb('0x2'));var BPromise=require(_0xc2bb('0x3'));var rp=require(_0xc2bb('0x4'));var fs=require('fs');var path=require(_0xc2bb('0x5'));var rimraf=require(_0xc2bb('0x6'));var config=require('../../config/environment');var attributes=require(_0xc2bb('0x7'));module['exports']=function(_0x5219c5,_0x43767a){return _0x5219c5[_0xc2bb('0x8')](_0xc2bb('0x9'),attributes,{'tableName':_0xc2bb('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0103=['lodash','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperBlack.attributes','exports','define','CmHopperBlack','cm_hopper_black'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x0103,0x11e));var _0x3010=function(_0x135448,_0x4ca19f){_0x135448=_0x135448-0x0;var _0x28389e=_0x0103[_0x135448];return _0x28389e;};'use strict';var _=require(_0x3010('0x0'));var util=require('util');var logger=require(_0x3010('0x1'))(_0x3010('0x2'));var moment=require(_0x3010('0x3'));var BPromise=require('bluebird');var rp=require(_0x3010('0x4'));var fs=require('fs');var path=require(_0x3010('0x5'));var rimraf=require(_0x3010('0x6'));var config=require(_0x3010('0x7'));var attributes=require(_0x3010('0x8'));module[_0x3010('0x9')]=function(_0x1873a9,_0xd1e73a){return _0x1873a9[_0x3010('0xa')](_0x3010('0xb'),attributes,{'tableName':_0x3010('0xc'),'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 341cad2..0fec763 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 _0x4733=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','GetCmHopperBlack','findAll','options','raw','where','attributes','limit','include','map','model','catch','UpdateCmHopperBlack','update','DestroyCmHopperBlack','CmHopperBlack','destroy','util','randomstring','ioredis'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x4733,0x1d1));var _0x3473=function(_0x30b0d8,_0x57470c){_0x30b0d8=_0x30b0d8-0x0;var _0x459c09=_0x4733[_0x30b0d8];return _0x459c09;};'use strict';var _=require('lodash');var util=require(_0x3473('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x3473('0x1'));var fs=require('fs');var Redis=require(_0x3473('0x2'));var db=require(_0x3473('0x3'))['db'];var utils=require(_0x3473('0x4'));var logger=require(_0x3473('0x5'))(_0x3473('0x6'));var config=require(_0x3473('0x7'));var jayson=require(_0x3473('0x8'));var client=jayson['client'][_0x3473('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2eff94,_0x50d766,_0x1805a7){return new BPromise(function(_0x46a19d,_0x2e4e8a){return client[_0x3473('0xa')](_0x2eff94,_0x1805a7)[_0x3473('0xb')](function(_0x48d7ea){logger[_0x3473('0xc')](_0x3473('0xd'),_0x50d766,'request\x20sent');logger[_0x3473('0xe')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x50d766,_0x3473('0xf'),JSON[_0x3473('0x10')](_0x48d7ea));if(_0x48d7ea[_0x3473('0x11')]){if(_0x48d7ea[_0x3473('0x11')][_0x3473('0x12')]===0x1f4){logger[_0x3473('0x11')](_0x3473('0xd'),_0x50d766,_0x48d7ea[_0x3473('0x11')][_0x3473('0x13')]);return _0x2e4e8a(_0x48d7ea[_0x3473('0x11')][_0x3473('0x13')]);}logger[_0x3473('0x11')](_0x3473('0xd'),_0x50d766,_0x48d7ea[_0x3473('0x11')][_0x3473('0x13')]);return _0x46a19d(_0x48d7ea[_0x3473('0x11')][_0x3473('0x13')]);}else{logger['info'](_0x3473('0xd'),_0x50d766,_0x3473('0xf'));_0x46a19d(_0x48d7ea['result'][_0x3473('0x13')]);}})['catch'](function(_0x213d2a){logger['error'](_0x3473('0xd'),_0x50d766,_0x213d2a);_0x2e4e8a(_0x213d2a);});});}exports[_0x3473('0x14')]=function(_0x1d812a){var _0x2a031f=this;return new Promise(function(_0x20f943,_0x3e9e24){return db['CmHopperBlack'][_0x3473('0x15')]({'raw':_0x1d812a[_0x3473('0x16')]?_0x1d812a[_0x3473('0x16')][_0x3473('0x17')]===undefined?!![]:![]:!![],'where':_0x1d812a['options']?_0x1d812a['options'][_0x3473('0x18')]||null:null,'attributes':_0x1d812a[_0x3473('0x16')]?_0x1d812a[_0x3473('0x16')][_0x3473('0x19')]||null:null,'limit':_0x1d812a[_0x3473('0x16')]?_0x1d812a[_0x3473('0x16')][_0x3473('0x1a')]||null:null,'include':_0x1d812a[_0x3473('0x16')]?_0x1d812a[_0x3473('0x16')][_0x3473('0x1b')]?_[_0x3473('0x1c')](_0x1d812a[_0x3473('0x16')][_0x3473('0x1b')],function(_0x11cb82){return{'model':db[_0x11cb82[_0x3473('0x1d')]],'as':_0x11cb82['as'],'attributes':_0x11cb82[_0x3473('0x19')],'include':_0x11cb82[_0x3473('0x1b')]?_[_0x3473('0x1c')](_0x11cb82['include'],function(_0x3f88ed){return{'model':db[_0x3f88ed[_0x3473('0x1d')]],'as':_0x3f88ed['as'],'attributes':_0x3f88ed[_0x3473('0x19')],'include':_0x3f88ed[_0x3473('0x1b')]?_[_0x3473('0x1c')](_0x3f88ed['include'],function(_0x5b27c1){return{'model':db[_0x5b27c1['model']],'as':_0x5b27c1['as'],'attributes':_0x5b27c1['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x1ff2c8){logger[_0x3473('0xc')](_0x3473('0x14'),_0x1d812a);logger['debug']('GetCmHopperBlack',_0x1d812a,JSON['stringify'](_0x1ff2c8));_0x20f943(_0x1ff2c8);})[_0x3473('0x1e')](function(_0x2c0c9e){logger[_0x3473('0x11')](_0x3473('0x14'),_0x2c0c9e[_0x3473('0x13')],_0x1d812a);_0x3e9e24(_0x2a031f['error'](0x1f4,_0x2c0c9e[_0x3473('0x13')]));});});};exports[_0x3473('0x1f')]=function(_0xf4bc7d){var _0xfc4f9d=this;return new Promise(function(_0x2c3cf0,_0x3b2c25){return db['CmHopperBlack'][_0x3473('0x20')](_0xf4bc7d['body'],{'raw':_0xf4bc7d[_0x3473('0x16')]?_0xf4bc7d[_0x3473('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xf4bc7d[_0x3473('0x16')]?_0xf4bc7d[_0x3473('0x16')][_0x3473('0x18')]||null:null,'attributes':_0xf4bc7d[_0x3473('0x16')]?_0xf4bc7d['options']['attributes']||null:null,'limit':_0xf4bc7d['options']?_0xf4bc7d[_0x3473('0x16')][_0x3473('0x1a')]||null:null})[_0x3473('0xb')](function(_0x4fc616){logger['info'](_0x3473('0x1f'),_0xf4bc7d);logger[_0x3473('0xe')](_0x3473('0x1f'),_0xf4bc7d,JSON[_0x3473('0x10')](_0x4fc616));_0x2c3cf0(_0x4fc616);})[_0x3473('0x1e')](function(_0x4099b7){logger[_0x3473('0x11')]('UpdateCmHopperBlack',_0x4099b7['message'],_0xf4bc7d);_0x3b2c25(_0xfc4f9d[_0x3473('0x11')](0x1f4,_0x4099b7['message']));});});};exports[_0x3473('0x21')]=function(_0x45707d){var _0x22db64=this;return new Promise(function(_0x595094,_0x56f416){return db[_0x3473('0x22')][_0x3473('0x23')]({'where':_0x45707d[_0x3473('0x16')]?_0x45707d[_0x3473('0x16')][_0x3473('0x18')]||null:null})[_0x3473('0xb')](function(_0x43b0ac){logger['info'](_0x3473('0x21'),_0x45707d);logger[_0x3473('0xe')](_0x3473('0x21'),_0x45707d,JSON[_0x3473('0x10')](_0x43b0ac));_0x595094(_0x43b0ac);})[_0x3473('0x1e')](function(_0x226897){logger[_0x3473('0x11')]('DestroyCmHopperBlack',_0x226897[_0x3473('0x13')],_0x45707d);_0x56f416(_0x22db64['error'](0x1f4,_0x226897[_0x3473('0x13')]));});});}; \ No newline at end of file +var _0x30d3=['request\x20sent','stringify','error','code','message','result','catch','GetCmHopperBlack','CmHopperBlack','findAll','options','raw','where','attributes','limit','include','model','map','UpdateCmHopperBlack','update','body','DestroyCmHopperBlack','destroy','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperBlack,\x20%s,\x20%s','debug'];(function(_0x1c0089,_0x1e25d5){var _0x2958dc=function(_0x1107a3){while(--_0x1107a3){_0x1c0089['push'](_0x1c0089['shift']());}};_0x2958dc(++_0x1e25d5);}(_0x30d3,0x65));var _0x330d=function(_0x368a1f,_0x225e91){_0x368a1f=_0x368a1f-0x0;var _0x25e172=_0x30d3[_0x368a1f];return _0x25e172;};'use strict';var _=require(_0x330d('0x0'));var util=require('util');var moment=require(_0x330d('0x1'));var BPromise=require('bluebird');var rs=require(_0x330d('0x2'));var fs=require('fs');var Redis=require(_0x330d('0x3'));var db=require(_0x330d('0x4'))['db'];var utils=require(_0x330d('0x5'));var logger=require(_0x330d('0x6'))('rpc');var config=require(_0x330d('0x7'));var jayson=require(_0x330d('0x8'));var client=jayson[_0x330d('0x9')][_0x330d('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc6386c,_0x2073c8,_0x3c1f07){return new BPromise(function(_0x4c985b,_0x738a0b){return client[_0x330d('0xb')](_0xc6386c,_0x3c1f07)[_0x330d('0xc')](function(_0x4a9bfd){logger[_0x330d('0xd')](_0x330d('0xe'),_0x2073c8,'request\x20sent');logger[_0x330d('0xf')]('CmHopperBlack,\x20%s,\x20%s,\x20%s',_0x2073c8,_0x330d('0x10'),JSON[_0x330d('0x11')](_0x4a9bfd));if(_0x4a9bfd[_0x330d('0x12')]){if(_0x4a9bfd[_0x330d('0x12')][_0x330d('0x13')]===0x1f4){logger[_0x330d('0x12')](_0x330d('0xe'),_0x2073c8,_0x4a9bfd[_0x330d('0x12')][_0x330d('0x14')]);return _0x738a0b(_0x4a9bfd[_0x330d('0x12')][_0x330d('0x14')]);}logger[_0x330d('0x12')](_0x330d('0xe'),_0x2073c8,_0x4a9bfd['error'][_0x330d('0x14')]);return _0x4c985b(_0x4a9bfd[_0x330d('0x12')]['message']);}else{logger['info']('CmHopperBlack,\x20%s,\x20%s',_0x2073c8,_0x330d('0x10'));_0x4c985b(_0x4a9bfd[_0x330d('0x15')][_0x330d('0x14')]);}})[_0x330d('0x16')](function(_0x1a7662){logger[_0x330d('0x12')]('CmHopperBlack,\x20%s,\x20%s',_0x2073c8,_0x1a7662);_0x738a0b(_0x1a7662);});});}exports[_0x330d('0x17')]=function(_0x77d351){var _0x3d4e15=this;return new Promise(function(_0x5a38ab,_0x51a055){return db[_0x330d('0x18')][_0x330d('0x19')]({'raw':_0x77d351['options']?_0x77d351[_0x330d('0x1a')][_0x330d('0x1b')]===undefined?!![]:![]:!![],'where':_0x77d351['options']?_0x77d351[_0x330d('0x1a')][_0x330d('0x1c')]||null:null,'attributes':_0x77d351[_0x330d('0x1a')]?_0x77d351[_0x330d('0x1a')][_0x330d('0x1d')]||null:null,'limit':_0x77d351[_0x330d('0x1a')]?_0x77d351['options'][_0x330d('0x1e')]||null:null,'include':_0x77d351[_0x330d('0x1a')]?_0x77d351['options']['include']?_['map'](_0x77d351['options'][_0x330d('0x1f')],function(_0x4cec7f){return{'model':db[_0x4cec7f[_0x330d('0x20')]],'as':_0x4cec7f['as'],'attributes':_0x4cec7f['attributes'],'include':_0x4cec7f[_0x330d('0x1f')]?_[_0x330d('0x21')](_0x4cec7f['include'],function(_0x1fc029){return{'model':db[_0x1fc029[_0x330d('0x20')]],'as':_0x1fc029['as'],'attributes':_0x1fc029[_0x330d('0x1d')],'include':_0x1fc029[_0x330d('0x1f')]?_[_0x330d('0x21')](_0x1fc029['include'],function(_0x2468e8){return{'model':db[_0x2468e8[_0x330d('0x20')]],'as':_0x2468e8['as'],'attributes':_0x2468e8[_0x330d('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x330d('0xc')](function(_0x22ec50){logger[_0x330d('0xd')]('GetCmHopperBlack',_0x77d351);logger['debug'](_0x330d('0x17'),_0x77d351,JSON['stringify'](_0x22ec50));_0x5a38ab(_0x22ec50);})[_0x330d('0x16')](function(_0x196d6e){logger[_0x330d('0x12')](_0x330d('0x17'),_0x196d6e[_0x330d('0x14')],_0x77d351);_0x51a055(_0x3d4e15[_0x330d('0x12')](0x1f4,_0x196d6e[_0x330d('0x14')]));});});};exports[_0x330d('0x22')]=function(_0x4cfbf0){var _0x22c77d=this;return new Promise(function(_0x411b8b,_0x4cd57e){return db['CmHopperBlack'][_0x330d('0x23')](_0x4cfbf0[_0x330d('0x24')],{'raw':_0x4cfbf0[_0x330d('0x1a')]?_0x4cfbf0['options'][_0x330d('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4cfbf0['options']?_0x4cfbf0['options']['where']||null:null,'attributes':_0x4cfbf0[_0x330d('0x1a')]?_0x4cfbf0[_0x330d('0x1a')]['attributes']||null:null,'limit':_0x4cfbf0['options']?_0x4cfbf0[_0x330d('0x1a')]['limit']||null:null})[_0x330d('0xc')](function(_0x3ea3f5){logger['info'](_0x330d('0x22'),_0x4cfbf0);logger[_0x330d('0xf')](_0x330d('0x22'),_0x4cfbf0,JSON[_0x330d('0x11')](_0x3ea3f5));_0x411b8b(_0x3ea3f5);})['catch'](function(_0x32b5da){logger['error'](_0x330d('0x22'),_0x32b5da[_0x330d('0x14')],_0x4cfbf0);_0x4cd57e(_0x22c77d['error'](0x1f4,_0x32b5da[_0x330d('0x14')]));});});};exports[_0x330d('0x25')]=function(_0x5ee0b8){var _0x182490=this;return new Promise(function(_0x4e055b,_0x822eb8){return db[_0x330d('0x18')][_0x330d('0x26')]({'where':_0x5ee0b8[_0x330d('0x1a')]?_0x5ee0b8[_0x330d('0x1a')][_0x330d('0x1c')]||null:null})[_0x330d('0xc')](function(_0x3af882){logger[_0x330d('0xd')](_0x330d('0x25'),_0x5ee0b8);logger[_0x330d('0xf')]('DestroyCmHopperBlack',_0x5ee0b8,JSON[_0x330d('0x11')](_0x3af882));_0x4e055b(_0x3af882);})[_0x330d('0x16')](function(_0x5d60e2){logger[_0x330d('0x12')](_0x330d('0x25'),_0x5d60e2[_0x330d('0x14')],_0x5ee0b8);_0x822eb8(_0x182490[_0x330d('0x12')](0x1f4,_0x5d60e2[_0x330d('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperBlack/index.js b/server/api/cmHopperBlack/index.js index 55cae8c..fc325cd 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 _0x8f9d=['../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','isAuthenticated','index','get','/describe','/:id','show','update','delete','destroy','exports','multer','path','express','Router','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8f9d,0x93));var _0xd8f9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8f9d[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xd8f9('0x0'));var util=require('util');var path=require(_0xd8f9('0x1'));var timeout=require('connect-timeout');var express=require(_0xd8f9('0x2'));var router=express[_0xd8f9('0x3')]();var fs_extra=require(_0xd8f9('0x4'));var auth=require(_0xd8f9('0x5'));var interaction=require(_0xd8f9('0x6'));var config=require(_0xd8f9('0x7'));var controller=require(_0xd8f9('0x8'));router['get']('/',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xa')]);router[_0xd8f9('0xb')](_0xd8f9('0xc'),auth[_0xd8f9('0x9')](),controller['describe']);router[_0xd8f9('0xb')](_0xd8f9('0xd'),auth['isAuthenticated'](),controller[_0xd8f9('0xe')]);router['put']('/:id',auth[_0xd8f9('0x9')](),controller[_0xd8f9('0xf')]);router[_0xd8f9('0x10')](_0xd8f9('0xd'),auth[_0xd8f9('0x9')](),controller[_0xd8f9('0x11')]);module[_0xd8f9('0x12')]=router; \ No newline at end of file +var _0x814b=['path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperBlack.controller','get','isAuthenticated','/describe','describe','/:id','show','put','update','delete','destroy','multer','util'];(function(_0x39c6be,_0x10a5d8){var _0x3dbbcf=function(_0xf935f9){while(--_0xf935f9){_0x39c6be['push'](_0x39c6be['shift']());}};_0x3dbbcf(++_0x10a5d8);}(_0x814b,0x1a2));var _0xb814=function(_0x204eb7,_0x4974c3){_0x204eb7=_0x204eb7-0x0;var _0x37e444=_0x814b[_0x204eb7];return _0x37e444;};'use strict';var multer=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var path=require(_0xb814('0x2'));var timeout=require(_0xb814('0x3'));var express=require(_0xb814('0x4'));var router=express[_0xb814('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xb814('0x6'));var interaction=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var controller=require(_0xb814('0x9'));router[_0xb814('0xa')]('/',auth[_0xb814('0xb')](),controller['index']);router[_0xb814('0xa')](_0xb814('0xc'),auth['isAuthenticated'](),controller[_0xb814('0xd')]);router[_0xb814('0xa')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0xf')]);router[_0xb814('0x10')](_0xb814('0xe'),auth[_0xb814('0xb')](),controller[_0xb814('0x11')]);router[_0xb814('0x12')](_0xb814('0xe'),auth['isAuthenticated'](),controller[_0xb814('0x13')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.attributes.js b/server/api/cmHopperFinal/cmHopperFinal.attributes.js index 2491e2b..0df89b7 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 _0xae5a=['exports','INTEGER','STRING','DATE','getDataValue','endtime','setDataValue','followuptime','diff','BOOLEAN','sequelize','moment'];(function(_0x15a634,_0x4feb86){var _0xf4f7a0=function(_0x31d9fe){while(--_0x31d9fe){_0x15a634['push'](_0x15a634['shift']());}};_0xf4f7a0(++_0x4feb86);}(_0xae5a,0x76));var _0xaae5=function(_0x26ac56,_0x1d1c9c){_0x26ac56=_0x26ac56-0x0;var _0x4f3a79=_0xae5a[_0x26ac56];return _0x4f3a79;};'use strict';var Sequelize=require(_0xaae5('0x0'));var moment=require(_0xaae5('0x1'));module[_0xaae5('0x2')]={'state':{'type':Sequelize[_0xaae5('0x3')](0x2)},'statedesc':{'type':Sequelize[_0xaae5('0x4')]},'scheduledat':{'type':Sequelize[_0xaae5('0x5')]},'countbusyretry':{'type':Sequelize[_0xaae5('0x3')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xaae5('0x3')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xaae5('0x3')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0xaae5('0x4')]},'calleridnum':{'type':Sequelize[_0xaae5('0x4')]},'calleridname':{'type':Sequelize[_0xaae5('0x4')]},'starttime':{'type':Sequelize[_0xaae5('0x5')]},'responsetime':{'type':Sequelize[_0xaae5('0x5')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0xaae5('0x5')]},'endtime':{'type':Sequelize[_0xaae5('0x5')]},'ringtime':{'type':Sequelize[_0xaae5('0x3')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xaae5('0x3')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xaae5('0x3')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xaae5('0x3')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xaae5('0x4')]},'campaign':{'type':Sequelize[_0xaae5('0x4')]},'campaigntype':{'type':Sequelize[_0xaae5('0x4')]},'membername':{'type':Sequelize[_0xaae5('0x4')]},'reason':{'type':Sequelize[_0xaae5('0x4')]},'disposition':{'type':Sequelize[_0xaae5('0x4')]},'secondDisposition':{'type':Sequelize[_0xaae5('0x4')]},'thirdDisposition':{'type':Sequelize[_0xaae5('0x4')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x3fc836){var _0x5d55cc=this[_0xaae5('0x6')](_0xaae5('0x7'));if(_0x5d55cc&&_0x3fc836){this[_0xaae5('0x8')](_0xaae5('0x9'),moment(_0x3fc836)[_0xaae5('0xa')](moment(_0x5d55cc),'seconds'));}}},'amd':{'type':Sequelize[_0xaae5('0xb')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0xaae5('0xb')],'defaultValue':![]},'rescheduledat':{'type':Sequelize['DATE']},'callback':{'type':Sequelize[_0xaae5('0xb')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xaae5('0x4')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0xaae5('0x4')],'defaultValue':null},'deletedat':{'type':Sequelize['DATE']},'recallme':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0xaae5('0x5')]},'countnosuchnumberretry':{'type':Sequelize[_0xaae5('0x3')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xaae5('0x3')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xaae5('0x3')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xaae5('0x3')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xaae5('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd486=['exports','STRING','DATE','INTEGER','setDataValue','followuptime','seconds','BOOLEAN','sequelize'];(function(_0x2b11c0,_0x4c1e72){var _0x73ae6e=function(_0x305869){while(--_0x305869){_0x2b11c0['push'](_0x2b11c0['shift']());}};_0x73ae6e(++_0x4c1e72);}(_0xd486,0x14c));var _0x6d48=function(_0x3c4810,_0x58e37d){_0x3c4810=_0x3c4810-0x0;var _0x5cf2be=_0xd486[_0x3c4810];return _0x5cf2be;};'use strict';var Sequelize=require(_0x6d48('0x0'));var moment=require('moment');module[_0x6d48('0x1')]={'state':{'type':Sequelize['INTEGER'](0x2)},'statedesc':{'type':Sequelize[_0x6d48('0x2')]},'scheduledat':{'type':Sequelize[_0x6d48('0x3')]},'countbusyretry':{'type':Sequelize[_0x6d48('0x4')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0x6d48('0x4')],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0x6d48('0x2')]},'originatecalleridnum':{'type':Sequelize['STRING']},'originatecalleridname':{'type':Sequelize[_0x6d48('0x2')]},'calleridnum':{'type':Sequelize[_0x6d48('0x2')]},'calleridname':{'type':Sequelize[_0x6d48('0x2')]},'starttime':{'type':Sequelize[_0x6d48('0x3')]},'responsetime':{'type':Sequelize[_0x6d48('0x3')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize[_0x6d48('0x3')]},'endtime':{'type':Sequelize[_0x6d48('0x3')]},'ringtime':{'type':Sequelize[_0x6d48('0x4')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0x6d48('0x4')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0x6d48('0x4')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize['STRING']},'campaign':{'type':Sequelize[_0x6d48('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0x6d48('0x2')]},'reason':{'type':Sequelize['STRING']},'disposition':{'type':Sequelize[_0x6d48('0x2')]},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0x6d48('0x2')]},'dispositionat':{'type':Sequelize['DATE'],'set':function(_0x50d7b1){var _0x3fd01e=this['getDataValue']('endtime');if(_0x3fd01e&&_0x50d7b1){this[_0x6d48('0x5')](_0x6d48('0x6'),moment(_0x50d7b1)['diff'](moment(_0x3fd01e),_0x6d48('0x7')));}}},'amd':{'type':Sequelize[_0x6d48('0x8')],'defaultValue':![]},'fax':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'blacklist':{'type':Sequelize[_0x6d48('0x8')],'defaultValue':![]},'rescheduled':{'type':Sequelize[_0x6d48('0x8')],'defaultValue':![]},'rescheduledat':{'type':Sequelize[_0x6d48('0x3')]},'callback':{'type':Sequelize[_0x6d48('0x8')],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0x6d48('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize['DATE']},'deleted':{'type':Sequelize[_0x6d48('0x2')],'defaultValue':null},'deletedat':{'type':Sequelize[_0x6d48('0x3')]},'recallme':{'type':Sequelize[_0x6d48('0x8')],'defaultValue':![]},'agiafterat':{'type':Sequelize[_0x6d48('0x3')]},'countnosuchnumberretry':{'type':Sequelize[_0x6d48('0x4')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0x6d48('0x4')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0x6d48('0x4')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0x6d48('0x4')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0x6d48('0x4')],'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 c3157f2..3e8b622 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 _0xe3da=['COUNT','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','`state`\x20=\x2019,\x201,\x20null','noSuchContacts','congestionContacts','answeringMachine','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','into','phone','ContactId','select','field','NOW()','scheduledAt','ANY_VALUE(ContactId)','ListId','ANY_VALUE(VoiceQueueId)','VoiceQueueId','cm_hopper_final','toString','state','calleridnum\x20IS\x20NOT\x20NULL','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','VoiceQueueId\x20=\x20?','from','state\x20=\x204','group','moveContactsIvrCampaignHopperFinal','Campaign','fromQuery','CampaignId','createdAt','updatedAt','ANY_VALUE(calleridnum)','ANY_VALUE(ListId)','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','set','apply','reject','save','update','then','destroy','error','stack','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','order','sort','where','pick','map','VIRTUAL','filter','merge','options','count','include','findAll','rows','catch','show','params','length','includeAll','find','describe','body','uniqueid','countContactsQueueCampaignHopperFinal','sequelize','literal','`state`\x20=\x200,\x201,\x20null','`state`\x20=\x203,\x201,\x20null','noAnswerContacts'];(function(_0x337537,_0x4ea7b8){var _0x4fdd67=function(_0x59ad18){while(--_0x59ad18){_0x337537['push'](_0x337537['shift']());}};_0x4fdd67(++_0x4ea7b8);}(_0xe3da,0x1cd));var _0xae3d=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xe3da[_0xfae23b];return _0x200640;};'use strict';var emlformat=require(_0xae3d('0x0'));var rimraf=require(_0xae3d('0x1'));var zipdir=require(_0xae3d('0x2'));var jsonpatch=require(_0xae3d('0x3'));var rp=require(_0xae3d('0x4'));var moment=require(_0xae3d('0x5'));var BPromise=require(_0xae3d('0x6'));var Mustache=require(_0xae3d('0x7'));var util=require(_0xae3d('0x8'));var path=require(_0xae3d('0x9'));var sox=require(_0xae3d('0xa'));var csv=require(_0xae3d('0xb'));var ejs=require(_0xae3d('0xc'));var fs=require('fs');var fs_extra=require(_0xae3d('0xd'));var _=require(_0xae3d('0xe'));var squel=require(_0xae3d('0xf'));var crypto=require('crypto');var jsforce=require(_0xae3d('0x10'));var deskjs=require(_0xae3d('0x11'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xae3d('0x12'));var Redis=require(_0xae3d('0x13'));var authService=require(_0xae3d('0x14'));var qs=require(_0xae3d('0x15'));var as=require(_0xae3d('0x16'));var hardwareService=require(_0xae3d('0x17'));var logger=require('../../config/logger')(_0xae3d('0x18'));var utils=require('../../config/utils');var config=require(_0xae3d('0x19'));var licenseUtil=require(_0xae3d('0x1a'));var db=require(_0xae3d('0x1b'))['db'];function respondWithStatusCode(_0x172f7a,_0x48aa74){_0x48aa74=_0x48aa74||0xcc;return function(_0xfb7869){if(_0xfb7869){return _0x172f7a[_0xae3d('0x1c')](_0x48aa74);}return _0x172f7a[_0xae3d('0x1d')](_0x48aa74)[_0xae3d('0x1e')]();};}function respondWithResult(_0x2afdd3,_0x430659){_0x430659=_0x430659||0xc8;return function(_0x31498d){if(_0x31498d){return _0x2afdd3['status'](_0x430659)[_0xae3d('0x1f')](_0x31498d);}};}function respondWithFilteredResult(_0x42f4b4,_0x46295b){return function(_0x230afb){if(_0x230afb){var _0x192c13=typeof _0x46295b[_0xae3d('0x20')]==='undefined'&&typeof _0x46295b[_0xae3d('0x21')]===_0xae3d('0x22');var _0x2e31f1=_0x230afb['count'];var _0x3f8cf9=_0x192c13?0x0:_0x46295b[_0xae3d('0x20')];var _0x558e42=_0x192c13?_0x230afb['count']:_0x46295b[_0xae3d('0x20')]+_0x46295b[_0xae3d('0x21')];var _0x19c44d;if(_0x558e42>=_0x2e31f1){_0x558e42=_0x2e31f1;_0x19c44d=0xc8;}else{_0x19c44d=0xce;}_0x42f4b4[_0xae3d('0x1d')](_0x19c44d);return _0x42f4b4[_0xae3d('0x23')]('Content-Range',_0x3f8cf9+'-'+_0x558e42+'/'+_0x2e31f1)[_0xae3d('0x1f')](_0x230afb);}return null;};}function patchUpdates(_0x48f00e){return function(_0x4a09c2){try{jsonpatch[_0xae3d('0x24')](_0x4a09c2,_0x48f00e,!![]);}catch(_0x1415e8){return BPromise[_0xae3d('0x25')](_0x1415e8);}return _0x4a09c2[_0xae3d('0x26')]();};}function saveUpdates(_0x3e7afc,_0x26c419){return function(_0x155099){if(_0x155099){return _0x155099[_0xae3d('0x27')](_0x3e7afc)[_0xae3d('0x28')](function(_0x300be8){return _0x300be8;});}return null;};}function removeEntity(_0x9bf34a,_0x37f5ff){return function(_0x1b2acb){if(_0x1b2acb){return _0x1b2acb[_0xae3d('0x29')]()[_0xae3d('0x28')](function(){_0x9bf34a[_0xae3d('0x1d')](0xcc)[_0xae3d('0x1e')]();});}};}function handleEntityNotFound(_0x2131e9,_0x1b1217){return function(_0x5d45db){if(!_0x5d45db){_0x2131e9[_0xae3d('0x1c')](0x194);}return _0x5d45db;};}function handleError(_0x185e71,_0xb5940){_0xb5940=_0xb5940||0x1f4;return function(_0x52df0f){logger[_0xae3d('0x2a')](_0x52df0f[_0xae3d('0x2b')]);if(_0x52df0f[_0xae3d('0x2c')]){delete _0x52df0f['name'];}_0x185e71['status'](_0xb5940)[_0xae3d('0x2d')](_0x52df0f);};}exports[_0xae3d('0x2e')]=function(_0x3a5840,_0x3114f9){var _0xb69ec9={},_0x561371={},_0x1d1483={'count':0x0,'rows':[]};var _0x3a2434=_['map'](db[_0xae3d('0x2f')][_0xae3d('0x30')],function(_0x2cf750){return{'name':_0x2cf750[_0xae3d('0x31')],'type':_0x2cf750[_0xae3d('0x32')][_0xae3d('0x33')]};});_0x561371['model']=_['map'](_0x3a2434,'name');_0x561371[_0xae3d('0x34')]=_[_0xae3d('0x35')](_0x3a5840[_0xae3d('0x34')]);_0x561371[_0xae3d('0x36')]=_['intersection'](_0x561371[_0xae3d('0x37')],_0x561371[_0xae3d('0x34')]);_0xb69ec9[_0xae3d('0x38')]=_[_0xae3d('0x39')](_0x561371[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0x3a5840[_0xae3d('0x34')]['fields']));_0xb69ec9[_0xae3d('0x38')]=_0xb69ec9['attributes']['length']?_0xb69ec9[_0xae3d('0x38')]:_0x561371['model'];if(!_0x3a5840[_0xae3d('0x34')]['hasOwnProperty']('nolimit')){_0xb69ec9[_0xae3d('0x21')]=qs[_0xae3d('0x21')](_0x3a5840[_0xae3d('0x34')]['limit']);_0xb69ec9[_0xae3d('0x20')]=qs['offset'](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x20')]);}_0xb69ec9[_0xae3d('0x3b')]=qs[_0xae3d('0x3c')](_0x3a5840[_0xae3d('0x34')][_0xae3d('0x3c')]);_0xb69ec9[_0xae3d('0x3d')]=qs[_0xae3d('0x36')](_[_0xae3d('0x3e')](_0x3a5840[_0xae3d('0x34')],_0x561371[_0xae3d('0x36')]),_0x3a2434);if(_0x3a5840['query']['filter']){_0xb69ec9[_0xae3d('0x3d')]=_['merge'](_0xb69ec9[_0xae3d('0x3d')],{'$or':_[_0xae3d('0x3f')](_0x3a2434,function(_0x1db3c1){if(_0x1db3c1[_0xae3d('0x32')]!==_0xae3d('0x40')){var _0x35db44={};_0x35db44[_0x1db3c1[_0xae3d('0x2c')]]={'$like':'%'+_0x3a5840[_0xae3d('0x34')][_0xae3d('0x41')]+'%'};return _0x35db44;}})});}_0xb69ec9=_[_0xae3d('0x42')]({},_0xb69ec9,_0x3a5840[_0xae3d('0x43')]);var _0x549db8={'where':_0xb69ec9[_0xae3d('0x3d')]};return db[_0xae3d('0x2f')][_0xae3d('0x44')](_0x549db8)['then'](function(_0x4df102){_0x1d1483[_0xae3d('0x44')]=_0x4df102;if(_0x3a5840[_0xae3d('0x34')]['includeAll']){_0xb69ec9[_0xae3d('0x45')]=[{'all':!![]}];}return db[_0xae3d('0x2f')][_0xae3d('0x46')](_0xb69ec9);})[_0xae3d('0x28')](function(_0x436a04){_0x1d1483[_0xae3d('0x47')]=_0x436a04;return _0x1d1483;})['then'](respondWithFilteredResult(_0x3114f9,_0xb69ec9))[_0xae3d('0x48')](handleError(_0x3114f9,null));};exports[_0xae3d('0x49')]=function(_0xce7f34,_0x938811){var _0x1fef90={'raw':!![],'where':{'id':_0xce7f34[_0xae3d('0x4a')]['id']}},_0x515220={};_0x515220['model']=_[_0xae3d('0x35')](db[_0xae3d('0x2f')][_0xae3d('0x30')]);_0x515220[_0xae3d('0x34')]=_['keys'](_0xce7f34['query']);_0x515220['filters']=_[_0xae3d('0x39')](_0x515220[_0xae3d('0x37')],_0x515220['query']);_0x1fef90['attributes']=_['intersection'](_0x515220[_0xae3d('0x37')],qs[_0xae3d('0x3a')](_0xce7f34[_0xae3d('0x34')][_0xae3d('0x3a')]));_0x1fef90[_0xae3d('0x38')]=_0x1fef90[_0xae3d('0x38')][_0xae3d('0x4b')]?_0x1fef90['attributes']:_0x515220['model'];if(_0xce7f34['query'][_0xae3d('0x4c')]){_0x1fef90['include']=[{'all':!![]}];}_0x1fef90=_[_0xae3d('0x42')]({},_0x1fef90,_0xce7f34[_0xae3d('0x43')]);return db[_0xae3d('0x2f')][_0xae3d('0x4d')](_0x1fef90)[_0xae3d('0x28')](handleEntityNotFound(_0x938811,null))[_0xae3d('0x28')](respondWithResult(_0x938811,null))[_0xae3d('0x48')](handleError(_0x938811,null));};exports[_0xae3d('0x4e')]=function(_0x38f92d,_0x4ed0f9){return db[_0xae3d('0x2f')]['describe']()['then'](respondWithResult(_0x4ed0f9,null))['catch'](handleError(_0x4ed0f9,null));};exports[_0xae3d('0x27')]=function(_0xc8f551,_0x39f213){if(_0xc8f551[_0xae3d('0x4f')]['uniqueid']){delete _0xc8f551['body'][_0xae3d('0x50')];}return db[_0xae3d('0x2f')][_0xae3d('0x4d')]({'where':{'uniqueid':_0xc8f551[_0xae3d('0x4a')]['id']}})['then'](handleEntityNotFound(_0x39f213,null))[_0xae3d('0x28')](saveUpdates(_0xc8f551[_0xae3d('0x4f')],null))[_0xae3d('0x28')](respondWithResult(_0x39f213,null))[_0xae3d('0x48')](handleError(_0x39f213,null));};exports[_0xae3d('0x51')]=function(_0x38ccf1,_0x3e30ea,_0x291c7d){return db[_0xae3d('0x2f')][_0xae3d('0x46')]({'raw':![],'where':{'VoiceQueueId':_0x38ccf1[_0xae3d('0x4a')]['id']},'attributes':[[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x54')))),'noSuchContacts'],[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x55')))),_0xae3d('0x56')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x58')))),_0xae3d('0x59')],[db[_0xae3d('0x52')]['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x5a')))),'congestionContacts'],[db['sequelize']['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db['sequelize']['literal'](_0xae3d('0x5b')))),_0xae3d('0x5c')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x5d')))),_0xae3d('0x5e')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x5f')))),_0xae3d('0x60')],[db[_0xae3d('0x52')]['fn']('COUNT',db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x61')))),'answeringMachine']]})[_0xae3d('0x28')](handleEntityNotFound(_0x3e30ea,null))[_0xae3d('0x28')](respondWithResult(_0x3e30ea,null))[_0xae3d('0x48')](handleError(_0x3e30ea,null));};exports['countContactsIvrCampaignHopperFinal']=function(_0x3a39ed,_0x31b362,_0x253ee4){return db[_0xae3d('0x2f')][_0xae3d('0x46')]({'raw':![],'where':{'CampaignId':_0x3a39ed[_0xae3d('0x4a')]['id']},'attributes':[[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x54')))),_0xae3d('0x62')],[db['sequelize']['fn']('COUNT',db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x55')))),'noAnswerContacts'],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x58')))),_0xae3d('0x59')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x5a')))),_0xae3d('0x63')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')](_0xae3d('0x5b')))),_0xae3d('0x5c')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db[_0xae3d('0x52')][_0xae3d('0x53')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xae3d('0x5e')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db['sequelize']['fn']('IF',db['sequelize'][_0xae3d('0x53')](_0xae3d('0x5f')))),_0xae3d('0x60')],[db[_0xae3d('0x52')]['fn'](_0xae3d('0x57'),db[_0xae3d('0x52')]['fn']('IF',db[_0xae3d('0x52')]['literal'](_0xae3d('0x61')))),_0xae3d('0x64')]]})['then'](handleEntityNotFound(_0x31b362,null))[_0xae3d('0x28')](respondWithResult(_0x31b362,null))['catch'](handleError(_0x31b362,null));};exports[_0xae3d('0x65')]=function(_0x115e99,_0x26c409,_0x4709ea){return db[_0xae3d('0x66')]['find']({'where':{'id':_0x115e99[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0x26c409,null))[_0xae3d('0x28')](function(_0x5f1e9c){var _0x546991;if(_0x5f1e9c){_0x546991=squel[_0xae3d('0x67')]()[_0xae3d('0x68')]('cm_hopper')['fromQuery']([_0xae3d('0x69'),'scheduledAt',_0xae3d('0x6a'),'ListId','VoiceQueueId','createdAt','updatedAt'],squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')]('ANY_VALUE(calleridnum)','phone')[_0xae3d('0x6c')](_0xae3d('0x6d'),_0xae3d('0x6e'))[_0xae3d('0x6c')](_0xae3d('0x6f'),_0xae3d('0x6a'))[_0xae3d('0x6c')]('ANY_VALUE(ListId)',_0xae3d('0x70'))[_0xae3d('0x6c')](_0xae3d('0x71'),_0xae3d('0x72'))[_0xae3d('0x6c')](_0xae3d('0x6d'),'createdAt')[_0xae3d('0x6c')](_0xae3d('0x6d'),'updatedAt')['from'](_0xae3d('0x73'))[_0xae3d('0x3d')]('VoiceQueueId\x20=\x20?',_0x115e99[_0xae3d('0x4a')]['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x20?',_0x115e99[_0xae3d('0x4f')][_0xae3d('0x75')]['toString']())['where'](_0xae3d('0x76'))[_0xae3d('0x3d')](_0xae3d('0x77'),squel['select']()[_0xae3d('0x6c')](_0xae3d('0x69'))['from'](_0xae3d('0x78'))[_0xae3d('0x3d')](_0xae3d('0x79'),_0x115e99['params']['id'][_0xae3d('0x74')]()))[_0xae3d('0x3d')](_0xae3d('0x77'),squel['select']()[_0xae3d('0x6c')]('calleridnum')[_0xae3d('0x7a')]('cm_hopper_final')['where'](_0xae3d('0x79'),_0x115e99['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')](_0xae3d('0x7b')))[_0xae3d('0x7c')]('ContactId'))[_0xae3d('0x74')]();return db[_0xae3d('0x52')][_0xae3d('0x34')](_0x546991);}return[];})[_0xae3d('0x28')](respondWithResult(_0x26c409,null))[_0xae3d('0x48')](handleError(_0x26c409,null));};exports[_0xae3d('0x7d')]=function(_0x1c5f67,_0xa083d0,_0x26e422){return db[_0xae3d('0x7e')][_0xae3d('0x4d')]({'where':{'id':_0x1c5f67[_0xae3d('0x4a')]['id']}})[_0xae3d('0x28')](handleEntityNotFound(_0xa083d0,null))[_0xae3d('0x28')](function(_0xf281f5){var _0x3261e5;if(_0xf281f5){_0x3261e5=squel[_0xae3d('0x67')]()['into'](_0xae3d('0x78'))[_0xae3d('0x7f')]([_0xae3d('0x69'),_0xae3d('0x6e'),_0xae3d('0x6a'),'ListId',_0xae3d('0x80'),_0xae3d('0x81'),_0xae3d('0x82')],squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')](_0xae3d('0x83'),_0xae3d('0x69'))[_0xae3d('0x6c')]('NOW()',_0xae3d('0x6e'))[_0xae3d('0x6c')](_0xae3d('0x6f'),'ContactId')[_0xae3d('0x6c')](_0xae3d('0x84'),_0xae3d('0x70'))['field'](_0xae3d('0x85'),_0xae3d('0x80'))['field'](_0xae3d('0x6d'),'createdAt')[_0xae3d('0x6c')]('NOW()',_0xae3d('0x82'))[_0xae3d('0x7a')](_0xae3d('0x73'))[_0xae3d('0x3d')](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x20?',_0x1c5f67['body'][_0xae3d('0x75')][_0xae3d('0x74')]())[_0xae3d('0x3d')](_0xae3d('0x76'))['where'](_0xae3d('0x77'),squel[_0xae3d('0x6b')]()[_0xae3d('0x6c')]('phone')['from'](_0xae3d('0x78'))['where'](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]()))[_0xae3d('0x3d')](_0xae3d('0x77'),squel[_0xae3d('0x6b')]()['field'](_0xae3d('0x87'))[_0xae3d('0x7a')](_0xae3d('0x73'))['where'](_0xae3d('0x86'),_0x1c5f67['params']['id'][_0xae3d('0x74')]())[_0xae3d('0x3d')]('state\x20=\x204'))['group'](_0xae3d('0x6a')))['toString']();return db['sequelize'][_0xae3d('0x34')](_0x3261e5);}return[];})['then'](respondWithResult(_0xa083d0,null))[_0xae3d('0x48')](handleError(_0xa083d0,null));};exports['checkContactHopper']=function(_0x31f606,_0x47aa7a,_0x27c0ff){return db['CmHopper'][_0xae3d('0x88')]({'where':{'VoiceQueueId':_0x31f606['body'][_0xae3d('0x72')],'CampaignId':_0x31f606[_0xae3d('0x4f')][_0xae3d('0x80')],'ContactId':_0x31f606[_0xae3d('0x4f')][_0xae3d('0x6a')]}})[_0xae3d('0x28')](handleEntityNotFound(_0x47aa7a,null))[_0xae3d('0x28')](function(_0x95c4ce){if(_0x95c4ce){return _0x95c4ce;}return null;})[_0xae3d('0x28')](respondWithResult(_0x47aa7a,null))['catch'](handleError(_0x47aa7a,null));}; \ No newline at end of file +var _0x5d17=['ANY_VALUE(ContactId)','ANY_VALUE(ListId)','ANY_VALUE(VoiceQueueId)','VoiceQueueId','from','cm_hopper_final','VoiceQueueId\x20=\x20?','toString','state\x20=\x20?','state','calleridnum\x20NOT\x20IN\x20(?)','cm_hopper','state\x20=\x204','moveContactsIvrCampaignHopperFinal','into','CampaignId','ANY_VALUE(CampaignId)','CampaignId\x20=\x20?','calleridnum','group','checkContactHopper','findOne','eml-format','rimraf','request-promise','moment','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','name','send','index','CmHopperFinal','rawAttributes','fieldName','type','model','map','query','intersection','attributes','fields','length','nolimit','sort','where','filters','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','describe','update','body','uniqueid','find','countContactsQueueCampaignHopperFinal','COUNT','sequelize','`state`\x20=\x200,\x201,\x20null','noSuchContacts','`state`\x20=\x203,\x201,\x20null','noAnswerContacts','literal','`state`\x20=\x205,\x201,\x20null','busyContacts','`state`\x20=\x208,\x201,\x20null','`state`\x20=\x2010\x20,\x201,\x20null','dropContacts','`state`\x20=\x2011\x20,\x201,\x20null','abandonedContacts','`state`\x20=\x2022,\x201,\x20null','reCallContacts','answeringMachine','countContactsIvrCampaignHopperFinal','congestionContacts','moveContactsQueueCampaignHopperFinal','VoiceQueue','insert','fromQuery','scheduledAt','ContactId','ListId','createdAt','updatedAt','select','field','ANY_VALUE(calleridnum)','phone','NOW()'];(function(_0x7b173,_0x539d7f){var _0x1c598c=function(_0xe1e1e0){while(--_0xe1e1e0){_0x7b173['push'](_0x7b173['shift']());}};_0x1c598c(++_0x539d7f);}(_0x5d17,0x114));var _0x75d1=function(_0xfb0281,_0x3ff38b){_0xfb0281=_0xfb0281-0x0;var _0x408dd3=_0x5d17[_0xfb0281];return _0x408dd3;};'use strict';var emlformat=require(_0x75d1('0x0'));var rimraf=require(_0x75d1('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x75d1('0x2'));var moment=require(_0x75d1('0x3'));var BPromise=require(_0x75d1('0x4'));var Mustache=require('mustache');var util=require(_0x75d1('0x5'));var path=require(_0x75d1('0x6'));var sox=require(_0x75d1('0x7'));var csv=require(_0x75d1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x75d1('0x9'));var _=require(_0x75d1('0xa'));var squel=require(_0x75d1('0xb'));var crypto=require(_0x75d1('0xc'));var jsforce=require(_0x75d1('0xd'));var deskjs=require(_0x75d1('0xe'));var toCsv=require(_0x75d1('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x75d1('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x75d1('0x10'));var hardwareService=require(_0x75d1('0x11'));var logger=require('../../config/logger')(_0x75d1('0x12'));var utils=require(_0x75d1('0x13'));var config=require(_0x75d1('0x14'));var licenseUtil=require(_0x75d1('0x15'));var db=require(_0x75d1('0x16'))['db'];function respondWithStatusCode(_0xd089cf,_0x49667a){_0x49667a=_0x49667a||0xcc;return function(_0x19e825){if(_0x19e825){return _0xd089cf[_0x75d1('0x17')](_0x49667a);}return _0xd089cf[_0x75d1('0x18')](_0x49667a)[_0x75d1('0x19')]();};}function respondWithResult(_0x49d723,_0x553697){_0x553697=_0x553697||0xc8;return function(_0x55b8a0){if(_0x55b8a0){return _0x49d723[_0x75d1('0x18')](_0x553697)[_0x75d1('0x1a')](_0x55b8a0);}};}function respondWithFilteredResult(_0x2fd022,_0x52e649){return function(_0x1f9620){if(_0x1f9620){var _0x3fff9b=typeof _0x52e649[_0x75d1('0x1b')]===_0x75d1('0x1c')&&typeof _0x52e649[_0x75d1('0x1d')]===_0x75d1('0x1c');var _0x2845bc=_0x1f9620[_0x75d1('0x1e')];var _0x1bc5de=_0x3fff9b?0x0:_0x52e649[_0x75d1('0x1b')];var _0x2c2a6d=_0x3fff9b?_0x1f9620['count']:_0x52e649['offset']+_0x52e649[_0x75d1('0x1d')];var _0x42b7ac;if(_0x2c2a6d>=_0x2845bc){_0x2c2a6d=_0x2845bc;_0x42b7ac=0xc8;}else{_0x42b7ac=0xce;}_0x2fd022['status'](_0x42b7ac);return _0x2fd022[_0x75d1('0x1f')](_0x75d1('0x20'),_0x1bc5de+'-'+_0x2c2a6d+'/'+_0x2845bc)[_0x75d1('0x1a')](_0x1f9620);}return null;};}function patchUpdates(_0xf6cc70){return function(_0xa42dbe){try{jsonpatch[_0x75d1('0x21')](_0xa42dbe,_0xf6cc70,!![]);}catch(_0x51d3b0){return BPromise[_0x75d1('0x22')](_0x51d3b0);}return _0xa42dbe[_0x75d1('0x23')]();};}function saveUpdates(_0x501cc7,_0x1cb58c){return function(_0x641ea4){if(_0x641ea4){return _0x641ea4['update'](_0x501cc7)[_0x75d1('0x24')](function(_0x5e70ec){return _0x5e70ec;});}return null;};}function removeEntity(_0x3a85c0,_0xc256af){return function(_0x345cf5){if(_0x345cf5){return _0x345cf5['destroy']()['then'](function(){_0x3a85c0[_0x75d1('0x18')](0xcc)[_0x75d1('0x19')]();});}};}function handleEntityNotFound(_0x315ce5,_0x18184b){return function(_0x51d043){if(!_0x51d043){_0x315ce5[_0x75d1('0x17')](0x194);}return _0x51d043;};}function handleError(_0x2b5848,_0x367238){_0x367238=_0x367238||0x1f4;return function(_0x51138e){logger['error'](_0x51138e['stack']);if(_0x51138e[_0x75d1('0x25')]){delete _0x51138e[_0x75d1('0x25')];}_0x2b5848[_0x75d1('0x18')](_0x367238)[_0x75d1('0x26')](_0x51138e);};}exports[_0x75d1('0x27')]=function(_0x519ceb,_0x4d292e){var _0x410e16={},_0x197f52={},_0x4967b5={'count':0x0,'rows':[]};var _0x2408b6=_['map'](db[_0x75d1('0x28')][_0x75d1('0x29')],function(_0x91e7c9){return{'name':_0x91e7c9[_0x75d1('0x2a')],'type':_0x91e7c9[_0x75d1('0x2b')]['key']};});_0x197f52[_0x75d1('0x2c')]=_[_0x75d1('0x2d')](_0x2408b6,_0x75d1('0x25'));_0x197f52[_0x75d1('0x2e')]=_['keys'](_0x519ceb[_0x75d1('0x2e')]);_0x197f52['filters']=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],_0x197f52['query']);_0x410e16[_0x75d1('0x30')]=_[_0x75d1('0x2f')](_0x197f52[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x519ceb[_0x75d1('0x2e')]['fields']));_0x410e16[_0x75d1('0x30')]=_0x410e16[_0x75d1('0x30')][_0x75d1('0x32')]?_0x410e16[_0x75d1('0x30')]:_0x197f52['model'];if(!_0x519ceb['query']['hasOwnProperty'](_0x75d1('0x33'))){_0x410e16[_0x75d1('0x1d')]=qs[_0x75d1('0x1d')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1d')]);_0x410e16[_0x75d1('0x1b')]=qs[_0x75d1('0x1b')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x1b')]);}_0x410e16['order']=qs[_0x75d1('0x34')](_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x34')]);_0x410e16[_0x75d1('0x35')]=qs[_0x75d1('0x36')](_['pick'](_0x519ceb['query'],_0x197f52['filters']),_0x2408b6);if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x37')]){_0x410e16[_0x75d1('0x35')]=_[_0x75d1('0x38')](_0x410e16[_0x75d1('0x35')],{'$or':_[_0x75d1('0x2d')](_0x2408b6,function(_0x48f9f3){if(_0x48f9f3['type']!=='VIRTUAL'){var _0x3f2569={};_0x3f2569[_0x48f9f3['name']]={'$like':'%'+_0x519ceb['query'][_0x75d1('0x37')]+'%'};return _0x3f2569;}})});}_0x410e16=_[_0x75d1('0x38')]({},_0x410e16,_0x519ceb[_0x75d1('0x39')]);var _0x46854c={'where':_0x410e16['where']};return db[_0x75d1('0x28')][_0x75d1('0x1e')](_0x46854c)[_0x75d1('0x24')](function(_0x3d4137){_0x4967b5[_0x75d1('0x1e')]=_0x3d4137;if(_0x519ceb[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x410e16[_0x75d1('0x3b')]=[{'all':!![]}];}return db[_0x75d1('0x28')][_0x75d1('0x3c')](_0x410e16);})[_0x75d1('0x24')](function(_0x93922f){_0x4967b5[_0x75d1('0x3d')]=_0x93922f;return _0x4967b5;})[_0x75d1('0x24')](respondWithFilteredResult(_0x4d292e,_0x410e16))[_0x75d1('0x3e')](handleError(_0x4d292e,null));};exports[_0x75d1('0x3f')]=function(_0x25f689,_0x2ad3ef){var _0x42c18c={'raw':!![],'where':{'id':_0x25f689[_0x75d1('0x40')]['id']}},_0x2384aa={};_0x2384aa[_0x75d1('0x2c')]=_['keys'](db['CmHopperFinal'][_0x75d1('0x29')]);_0x2384aa[_0x75d1('0x2e')]=_[_0x75d1('0x41')](_0x25f689[_0x75d1('0x2e')]);_0x2384aa['filters']=_[_0x75d1('0x2f')](_0x2384aa[_0x75d1('0x2c')],_0x2384aa[_0x75d1('0x2e')]);_0x42c18c[_0x75d1('0x30')]=_['intersection'](_0x2384aa[_0x75d1('0x2c')],qs[_0x75d1('0x31')](_0x25f689[_0x75d1('0x2e')][_0x75d1('0x31')]));_0x42c18c['attributes']=_0x42c18c[_0x75d1('0x30')]['length']?_0x42c18c[_0x75d1('0x30')]:_0x2384aa[_0x75d1('0x2c')];if(_0x25f689[_0x75d1('0x2e')][_0x75d1('0x3a')]){_0x42c18c[_0x75d1('0x3b')]=[{'all':!![]}];}_0x42c18c=_[_0x75d1('0x38')]({},_0x42c18c,_0x25f689['options']);return db[_0x75d1('0x28')]['find'](_0x42c18c)['then'](handleEntityNotFound(_0x2ad3ef,null))[_0x75d1('0x24')](respondWithResult(_0x2ad3ef,null))[_0x75d1('0x3e')](handleError(_0x2ad3ef,null));};exports[_0x75d1('0x42')]=function(_0x12bd67,_0x16f744){return db[_0x75d1('0x28')][_0x75d1('0x42')]()['then'](respondWithResult(_0x16f744,null))['catch'](handleError(_0x16f744,null));};exports[_0x75d1('0x43')]=function(_0x8ce3d2,_0x50def3){if(_0x8ce3d2[_0x75d1('0x44')][_0x75d1('0x45')]){delete _0x8ce3d2[_0x75d1('0x44')]['uniqueid'];}return db[_0x75d1('0x28')][_0x75d1('0x46')]({'where':{'uniqueid':_0x8ce3d2[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x50def3,null))[_0x75d1('0x24')](saveUpdates(_0x8ce3d2[_0x75d1('0x44')],null))[_0x75d1('0x24')](respondWithResult(_0x50def3,null))['catch'](handleError(_0x50def3,null));};exports[_0x75d1('0x47')]=function(_0x382195,_0x16b3c0,_0x395e0b){return db[_0x75d1('0x28')][_0x75d1('0x3c')]({'raw':![],'where':{'VoiceQueueId':_0x382195[_0x75d1('0x40')]['id']},'attributes':[[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')]['literal'](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x51')))),'congestionContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),_0x75d1('0x55')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),_0x75d1('0x57')],[db['sequelize']['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})['then'](handleEntityNotFound(_0x16b3c0,null))[_0x75d1('0x24')](respondWithResult(_0x16b3c0,null))[_0x75d1('0x3e')](handleError(_0x16b3c0,null));};exports[_0x75d1('0x59')]=function(_0x16cc70,_0x5d2219,_0x22ce12){return db['CmHopperFinal']['findAll']({'raw':![],'where':{'CampaignId':_0x16cc70[_0x75d1('0x40')]['id']},'attributes':[[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize']['literal'](_0x75d1('0x4a')))),_0x75d1('0x4b')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x4c')))),_0x75d1('0x4d')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x4f')))),_0x75d1('0x50')],[db[_0x75d1('0x49')]['fn']('COUNT',db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x51')))),_0x75d1('0x5a')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x52')))),_0x75d1('0x53')],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db['sequelize']['fn']('IF',db['sequelize'][_0x75d1('0x4e')](_0x75d1('0x54')))),'abandonedContacts'],[db[_0x75d1('0x49')]['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db[_0x75d1('0x49')][_0x75d1('0x4e')](_0x75d1('0x56')))),'reCallContacts'],[db['sequelize']['fn'](_0x75d1('0x48'),db[_0x75d1('0x49')]['fn']('IF',db['sequelize'][_0x75d1('0x4e')]('`state`\x20=\x2019,\x201,\x20null'))),_0x75d1('0x58')]]})[_0x75d1('0x24')](handleEntityNotFound(_0x5d2219,null))[_0x75d1('0x24')](respondWithResult(_0x5d2219,null))['catch'](handleError(_0x5d2219,null));};exports[_0x75d1('0x5b')]=function(_0x1f9ac2,_0x290587,_0x1baaca){return db[_0x75d1('0x5c')]['find']({'where':{'id':_0x1f9ac2['params']['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x290587,null))['then'](function(_0x3f15f3){var _0xf29a9f;if(_0x3f15f3){_0xf29a9f=squel[_0x75d1('0x5d')]()['into']('cm_hopper')[_0x75d1('0x5e')](['phone',_0x75d1('0x5f'),_0x75d1('0x60'),_0x75d1('0x61'),'VoiceQueueId',_0x75d1('0x62'),_0x75d1('0x63')],squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x66'),_0x75d1('0x67'))[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')](_0x75d1('0x69'),_0x75d1('0x60'))[_0x75d1('0x65')](_0x75d1('0x6a'),'ListId')['field'](_0x75d1('0x6b'),_0x75d1('0x6c'))['field'](_0x75d1('0x68'),'createdAt')['field']('NOW()',_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2['params']['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x1f9ac2[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()['field']('phone')['from'](_0x75d1('0x74'))[_0x75d1('0x35')](_0x75d1('0x6f'),_0x1f9ac2[_0x75d1('0x40')]['id'][_0x75d1('0x70')]()))[_0x75d1('0x35')]('calleridnum\x20NOT\x20IN\x20(?)',squel[_0x75d1('0x64')]()[_0x75d1('0x65')]('calleridnum')[_0x75d1('0x6d')]('cm_hopper_final')['where']('VoiceQueueId\x20=\x20?',_0x1f9ac2[_0x75d1('0x40')]['id']['toString']())['where'](_0x75d1('0x75')))['group'](_0x75d1('0x60')))[_0x75d1('0x70')]();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0xf29a9f);}return[];})[_0x75d1('0x24')](respondWithResult(_0x290587,null))[_0x75d1('0x3e')](handleError(_0x290587,null));};exports[_0x75d1('0x76')]=function(_0x217347,_0x51b682,_0x195a0a){return db['Campaign'][_0x75d1('0x46')]({'where':{'id':_0x217347[_0x75d1('0x40')]['id']}})[_0x75d1('0x24')](handleEntityNotFound(_0x51b682,null))['then'](function(_0x10bc92){var _0x150735;if(_0x10bc92){_0x150735=squel[_0x75d1('0x5d')]()[_0x75d1('0x77')](_0x75d1('0x74'))[_0x75d1('0x5e')]([_0x75d1('0x67'),'scheduledAt',_0x75d1('0x60'),_0x75d1('0x61'),_0x75d1('0x78'),_0x75d1('0x62'),_0x75d1('0x63')],squel['select']()['field'](_0x75d1('0x66'),'phone')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x5f'))[_0x75d1('0x65')]('ANY_VALUE(ContactId)','ContactId')[_0x75d1('0x65')](_0x75d1('0x6a'),_0x75d1('0x61'))[_0x75d1('0x65')](_0x75d1('0x79'),'CampaignId')[_0x75d1('0x65')](_0x75d1('0x68'),'createdAt')[_0x75d1('0x65')](_0x75d1('0x68'),_0x75d1('0x63'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')]('CampaignId\x20=\x20?',_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')](_0x75d1('0x71'),_0x217347[_0x75d1('0x44')][_0x75d1('0x72')]['toString']())[_0x75d1('0x35')]('calleridnum\x20IS\x20NOT\x20NULL')[_0x75d1('0x35')](_0x75d1('0x73'),squel[_0x75d1('0x64')]()[_0x75d1('0x65')](_0x75d1('0x67'))[_0x75d1('0x6d')]('cm_hopper')[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id']['toString']()))[_0x75d1('0x35')](_0x75d1('0x73'),squel['select']()[_0x75d1('0x65')](_0x75d1('0x7b'))[_0x75d1('0x6d')](_0x75d1('0x6e'))[_0x75d1('0x35')](_0x75d1('0x7a'),_0x217347[_0x75d1('0x40')]['id'][_0x75d1('0x70')]())[_0x75d1('0x35')]('state\x20=\x204'))[_0x75d1('0x7c')](_0x75d1('0x60')))['toString']();return db[_0x75d1('0x49')][_0x75d1('0x2e')](_0x150735);}return[];})['then'](respondWithResult(_0x51b682,null))['catch'](handleError(_0x51b682,null));};exports[_0x75d1('0x7d')]=function(_0x44a017,_0x4d8e5d,_0x1f3a7e){return db['CmHopper'][_0x75d1('0x7e')]({'where':{'VoiceQueueId':_0x44a017['body'][_0x75d1('0x6c')],'CampaignId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x78')],'ContactId':_0x44a017[_0x75d1('0x44')][_0x75d1('0x60')]}})[_0x75d1('0x24')](handleEntityNotFound(_0x4d8e5d,null))[_0x75d1('0x24')](function(_0x205e82){if(_0x205e82){return _0x205e82;}return null;})[_0x75d1('0x24')](respondWithResult(_0x4d8e5d,null))[_0x75d1('0x3e')](handleError(_0x4d8e5d,null));}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.model.js b/server/api/cmHopperFinal/cmHopperFinal.model.js index 9435015..9a3c667 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 _0xbbbf=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum','uniqueid','lodash'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbbbf,0x18f));var _0xfbbb=function(_0x587d31,_0x1cf0c8){_0x587d31=_0x587d31-0x0;var _0x246025=_0xbbbf[_0x587d31];return _0x246025;};'use strict';var _=require(_0xfbbb('0x0'));var util=require(_0xfbbb('0x1'));var logger=require(_0xfbbb('0x2'))(_0xfbbb('0x3'));var moment=require(_0xfbbb('0x4'));var BPromise=require(_0xfbbb('0x5'));var rp=require(_0xfbbb('0x6'));var fs=require('fs');var path=require(_0xfbbb('0x7'));var rimraf=require('rimraf');var config=require(_0xfbbb('0x8'));var attributes=require(_0xfbbb('0x9'));module[_0xfbbb('0xa')]=function(_0x21eb83,_0xe10e90){return _0x21eb83[_0xfbbb('0xb')](_0xfbbb('0xc'),attributes,{'tableName':_0xfbbb('0xd'),'paranoid':![],'indexes':[{'name':_0xfbbb('0xe'),'fields':[_0xfbbb('0xe')]},{'name':_0xfbbb('0xf'),'fields':[_0xfbbb('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xdb1a=['uniqueid','lodash','util','../../config/logger','api','bluebird','request-promise','./cmHopperFinal.attributes','exports','define','CmHopperFinal','cm_hopper_final','calleridnum'];(function(_0x451663,_0x1d6bc0){var _0x18a34b=function(_0x4e46ae){while(--_0x4e46ae){_0x451663['push'](_0x451663['shift']());}};_0x18a34b(++_0x1d6bc0);}(_0xdb1a,0x1d5));var _0xadb1=function(_0x2537be,_0x2570d7){_0x2537be=_0x2537be-0x0;var _0x10a78c=_0xdb1a[_0x2537be];return _0x10a78c;};'use strict';var _=require(_0xadb1('0x0'));var util=require(_0xadb1('0x1'));var logger=require(_0xadb1('0x2'))(_0xadb1('0x3'));var moment=require('moment');var BPromise=require(_0xadb1('0x4'));var rp=require(_0xadb1('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xadb1('0x6'));module[_0xadb1('0x7')]=function(_0x4e4641,_0x3c4fac){return _0x4e4641[_0xadb1('0x8')](_0xadb1('0x9'),attributes,{'tableName':_0xadb1('0xa'),'paranoid':![],'indexes':[{'name':'calleridnum','fields':[_0xadb1('0xb')]},{'name':_0xadb1('0xc'),'fields':[_0xadb1('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/cmHopperFinal.rpc.js b/server/api/cmHopperFinal/cmHopperFinal.rpc.js index 5b3ef69..d6ae8ac 100644 --- a/server/api/cmHopperFinal/cmHopperFinal.rpc.js +++ b/server/api/cmHopperFinal/cmHopperFinal.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x24e80d,_0x48e60e){var _0x1e8ef4=function(_0x382acf){while(--_0x382acf){_0x24e80d['push'](_0x24e80d['shift']());}};_0x1e8ef4(++_0x48e60e);}(_0xb10b,0x12a));var _0xbb10=function(_0x5c72ee,_0x5a8bf8){_0x5c72ee=_0x5c72ee-0x0;var _0x231876=_0xb10b[_0x5c72ee];return _0x231876;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file +var _0xb10b=['debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','CmHopperFinal,\x20%s,\x20%s','CmHopperFinal,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','CreateCmHopperFinal','CmHopperFinal','create','options','raw'];(function(_0x46f6b8,_0x38d1b5){var _0x42ac20=function(_0x4ffb46){while(--_0x4ffb46){_0x46f6b8['push'](_0x46f6b8['shift']());}};_0x42ac20(++_0x38d1b5);}(_0xb10b,0x12a));var _0xbb10=function(_0x1e9c0c,_0x61b24f){_0x1e9c0c=_0x1e9c0c-0x0;var _0x4bceff=_0xb10b[_0x1e9c0c];return _0x4bceff;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')](_0x378da8['body'],{'raw':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![]})[_0xbb10('0xc')](function(_0xdf237d){logger[_0xbb10('0xd')]('CreateCmHopperFinal',_0x378da8);logger[_0xbb10('0x1a')](_0xbb10('0x15'),_0x378da8,JSON['stringify'](_0xdf237d));_0x575cca(_0xdf237d);})['catch'](function(_0x8e2b97){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x8e2b97[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x8e2b97[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/cmHopperFinal/index.js b/server/api/cmHopperFinal/index.js index a6be113..b56ae95 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 _0x1afc=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperFinal.controller','get','isAuthenticated','index','describe','/:id','show','/voice/queue/countAttributes/:id','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal','post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','path'];(function(_0x29558b,_0x5621aa){var _0x5e7a3d=function(_0x2e5416){while(--_0x2e5416){_0x29558b['push'](_0x29558b['shift']());}};_0x5e7a3d(++_0x5621aa);}(_0x1afc,0x167));var _0xc1af=function(_0x3e4d72,_0x69279){_0x3e4d72=_0x3e4d72-0x0;var _0x594622=_0x1afc[_0x3e4d72];return _0x594622;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xc1af('0x0'));var timeout=require(_0xc1af('0x1'));var express=require('express');var router=express[_0xc1af('0x2')]();var fs_extra=require(_0xc1af('0x3'));var auth=require(_0xc1af('0x4'));var interaction=require(_0xc1af('0x5'));var config=require(_0xc1af('0x6'));var controller=require(_0xc1af('0x7'));router[_0xc1af('0x8')]('/',auth[_0xc1af('0x9')](),controller[_0xc1af('0xa')]);router[_0xc1af('0x8')]('/describe',auth[_0xc1af('0x9')](),controller[_0xc1af('0xb')]);router[_0xc1af('0x8')](_0xc1af('0xc'),auth['isAuthenticated'](),controller[_0xc1af('0xd')]);router[_0xc1af('0x8')](_0xc1af('0xe'),auth[_0xc1af('0x9')](),controller['countContactsQueueCampaignHopperFinal']);router['get'](_0xc1af('0xf'),auth[_0xc1af('0x9')](),controller[_0xc1af('0x10')]);router[_0xc1af('0x11')](_0xc1af('0x12'),auth[_0xc1af('0x9')](),controller[_0xc1af('0x13')]);router[_0xc1af('0x11')]('/voice/campaign/moveContacts/:id',auth[_0xc1af('0x9')](),controller[_0xc1af('0x14')]);router['post'](_0xc1af('0x15'),auth[_0xc1af('0x9')](),controller['checkContactHopper']);router[_0xc1af('0x16')](_0xc1af('0xc'),auth[_0xc1af('0x9')](),controller[_0xc1af('0x17')]);module['exports']=router; \ No newline at end of file +var _0x4655=['post','/voice/queue/moveContacts/:id','moveContactsQueueCampaignHopperFinal','/voice/campaign/moveContacts/:id','moveContactsIvrCampaignHopperFinal','/checkContactHopper','put','update','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/describe','isAuthenticated','/:id','show','/voice/queue/countAttributes/:id','countContactsQueueCampaignHopperFinal','/campaign/countAttributes/:id','countContactsIvrCampaignHopperFinal'];(function(_0x3c9965,_0x1c5a1d){var _0x3a7087=function(_0x4bf638){while(--_0x4bf638){_0x3c9965['push'](_0x3c9965['shift']());}};_0x3a7087(++_0x1c5a1d);}(_0x4655,0x70));var _0x5465=function(_0x4472d0,_0x4d999e){_0x4472d0=_0x4472d0-0x0;var _0x3fcd89=_0x4655[_0x4472d0];return _0x3fcd89;};'use strict';var multer=require(_0x5465('0x0'));var util=require(_0x5465('0x1'));var path=require('path');var timeout=require(_0x5465('0x2'));var express=require(_0x5465('0x3'));var router=express[_0x5465('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x5465('0x5'));var interaction=require(_0x5465('0x6'));var config=require(_0x5465('0x7'));var controller=require('./cmHopperFinal.controller');router[_0x5465('0x8')]('/',auth['isAuthenticated'](),controller[_0x5465('0x9')]);router[_0x5465('0x8')](_0x5465('0xa'),auth[_0x5465('0xb')](),controller['describe']);router['get'](_0x5465('0xc'),auth[_0x5465('0xb')](),controller[_0x5465('0xd')]);router[_0x5465('0x8')](_0x5465('0xe'),auth[_0x5465('0xb')](),controller[_0x5465('0xf')]);router[_0x5465('0x8')](_0x5465('0x10'),auth['isAuthenticated'](),controller[_0x5465('0x11')]);router[_0x5465('0x12')](_0x5465('0x13'),auth[_0x5465('0xb')](),controller[_0x5465('0x14')]);router[_0x5465('0x12')](_0x5465('0x15'),auth[_0x5465('0xb')](),controller[_0x5465('0x16')]);router[_0x5465('0x12')](_0x5465('0x17'),auth[_0x5465('0xb')](),controller['checkContactHopper']);router[_0x5465('0x18')](_0x5465('0xc'),auth[_0x5465('0xb')](),controller[_0x5465('0x19')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.attributes.js b/server/api/cmHopperHistory/cmHopperHistory.attributes.js index a0621e5..eb88663 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 _0x2f1c=['DATE','BOOLEAN','sequelize','exports','INTEGER','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x2f1c,0x68));var _0xc2f1=function(_0x5f4cd7,_0x459c44){_0x5f4cd7=_0x5f4cd7-0x0;var _0x47c93f=_0x2f1c[_0x5f4cd7];return _0x47c93f;};'use strict';var Sequelize=require(_0xc2f1('0x0'));module[_0xc2f1('0x1')]={'state':{'type':Sequelize[_0xc2f1('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xc2f1('0x3')]},'scheduledat':{'type':Sequelize[_0xc2f1('0x4')]},'countbusyretry':{'type':Sequelize[_0xc2f1('0x2')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc2f1('0x2')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'countglobal':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'uniqueid':{'type':Sequelize[_0xc2f1('0x3')]},'originatecalleridnum':{'type':Sequelize[_0xc2f1('0x3')]},'originatecalleridname':{'type':Sequelize[_0xc2f1('0x3')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc2f1('0x3')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xc2f1('0x4')]},'answertime':{'type':Sequelize['DATE']},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize['DATE']},'ringtime':{'type':Sequelize[_0xc2f1('0x2')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc2f1('0x2')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc2f1('0x2')],'defaultValue':0x0},'followuptime':{'type':Sequelize[_0xc2f1('0x2')],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc2f1('0x3')]},'campaign':{'type':Sequelize[_0xc2f1('0x3')]},'campaigntype':{'type':Sequelize[_0xc2f1('0x3')]},'membername':{'type':Sequelize[_0xc2f1('0x3')]},'reason':{'type':Sequelize[_0xc2f1('0x3')]},'amd':{'type':Sequelize[_0xc2f1('0x5')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc2f1('0x5')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc2f1('0x3')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc2f1('0x4')]},'recallme':{'type':Sequelize[_0xc2f1('0x5')],'defaultValue':![]},'editedat':{'type':Sequelize['DATE']},'edited':{'type':Sequelize[_0xc2f1('0x5')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xc2f1('0x2')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc2f1('0x2')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc2f1('0x2')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc2f1('0x2')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize[_0xc2f1('0x2')],'defaultValue':0x0},'dialTimezone':{'type':Sequelize[_0xc2f1('0x3')]}}; \ No newline at end of file +var _0x737c=['BOOLEAN','sequelize','INTEGER','STRING','DATE'];(function(_0x1f7413,_0x3388c3){var _0x2d2775=function(_0x5e5b4){while(--_0x5e5b4){_0x1f7413['push'](_0x1f7413['shift']());}};_0x2d2775(++_0x3388c3);}(_0x737c,0x1d2));var _0xc737=function(_0x423c77,_0x468893){_0x423c77=_0x423c77-0x0;var _0x709302=_0x737c[_0x423c77];return _0x709302;};'use strict';var Sequelize=require(_0xc737('0x0'));module['exports']={'state':{'type':Sequelize[_0xc737('0x1')](0x2)},'statedesc':{'type':Sequelize[_0xc737('0x2')]},'scheduledat':{'type':Sequelize[_0xc737('0x3')]},'countbusyretry':{'type':Sequelize[_0xc737('0x1')],'defaultValue':0x0},'countcongestionretry':{'type':Sequelize[_0xc737('0x1')],'defaultValue':0x0},'countnoanswerretry':{'type':Sequelize[_0xc737('0x1')],'defaultValue':0x0},'countglobal':{'type':Sequelize[_0xc737('0x1')],'defaultValue':0x0},'uniqueid':{'type':Sequelize['STRING']},'originatecalleridnum':{'type':Sequelize[_0xc737('0x2')]},'originatecalleridname':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0xc737('0x2')]},'calleridname':{'type':Sequelize[_0xc737('0x2')]},'starttime':{'type':Sequelize['DATE']},'responsetime':{'type':Sequelize[_0xc737('0x3')]},'answertime':{'type':Sequelize[_0xc737('0x3')]},'droptime':{'type':Sequelize['DATE']},'endtime':{'type':Sequelize[_0xc737('0x3')]},'ringtime':{'type':Sequelize[_0xc737('0x1')],'defaultValue':0x0},'holdtime':{'type':Sequelize[_0xc737('0x1')],'defaultValue':0x0},'talktime':{'type':Sequelize[_0xc737('0x1')],'defaultValue':0x0},'followuptime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dropreason':{'type':Sequelize[_0xc737('0x2')]},'campaign':{'type':Sequelize[_0xc737('0x2')]},'campaigntype':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc737('0x2')]},'reason':{'type':Sequelize[_0xc737('0x2')]},'amd':{'type':Sequelize[_0xc737('0x4')],'defaultValue':![]},'fax':{'type':Sequelize[_0xc737('0x4')],'defaultValue':![]},'callback':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'callbackuniqueid':{'type':Sequelize[_0xc737('0x2')],'defaultValue':null},'callbackat':{'type':Sequelize[_0xc737('0x3')]},'recallme':{'type':Sequelize[_0xc737('0x4')],'defaultValue':![]},'editedat':{'type':Sequelize[_0xc737('0x3')]},'edited':{'type':Sequelize[_0xc737('0x4')],'defaultValue':![]},'countnosuchnumberretry':{'type':Sequelize[_0xc737('0x1')],'defaultValue':0x0},'countdropretry':{'type':Sequelize[_0xc737('0x1')],'defaultValue':0x0},'countabandonedretry':{'type':Sequelize[_0xc737('0x1')],'defaultValue':0x0},'countmachineretry':{'type':Sequelize[_0xc737('0x1')],'defaultValue':0x0},'countagentrejectretry':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'dialTimezone':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.controller.js b/server/api/cmHopperHistory/cmHopperHistory.controller.js index ffd72a7..0df78b6 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 _0x780c=['keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','find','body','describe','uniqueid','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','end','json','undefined','limit','count','offset','status','set','Content-Range','apply','update','then','error','stack','name','CmHopperHistory','rawAttributes','fieldName','type','key','model','map'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0x780c,0x1dc));var _0xc780=function(_0x1c34e7,_0x33f9a8){_0x1c34e7=_0x1c34e7-0x0;var _0x378cb1=_0x780c[_0x1c34e7];return _0x378cb1;};'use strict';var emlformat=require(_0xc780('0x0'));var rimraf=require(_0xc780('0x1'));var zipdir=require(_0xc780('0x2'));var jsonpatch=require(_0xc780('0x3'));var rp=require('request-promise');var moment=require(_0xc780('0x4'));var BPromise=require(_0xc780('0x5'));var Mustache=require('mustache');var util=require(_0xc780('0x6'));var path=require('path');var sox=require(_0xc780('0x7'));var csv=require(_0xc780('0x8'));var ejs=require(_0xc780('0x9'));var fs=require('fs');var fs_extra=require(_0xc780('0xa'));var _=require(_0xc780('0xb'));var squel=require(_0xc780('0xc'));var crypto=require('crypto');var jsforce=require(_0xc780('0xd'));var deskjs=require(_0xc780('0xe'));var toCsv=require(_0xc780('0x8'));var querystring=require(_0xc780('0xf'));var Papa=require(_0xc780('0x10'));var Redis=require(_0xc780('0x11'));var authService=require(_0xc780('0x12'));var qs=require(_0xc780('0x13'));var as=require(_0xc780('0x14'));var hardwareService=require(_0xc780('0x15'));var logger=require(_0xc780('0x16'))(_0xc780('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xc780('0x18'));var db=require(_0xc780('0x19'))['db'];function respondWithStatusCode(_0x3896f9,_0x22348f){_0x22348f=_0x22348f||0xcc;return function(_0x5cfe06){if(_0x5cfe06){return _0x3896f9[_0xc780('0x1a')](_0x22348f);}return _0x3896f9['status'](_0x22348f)[_0xc780('0x1b')]();};}function respondWithResult(_0x1cd0be,_0x20e69e){_0x20e69e=_0x20e69e||0xc8;return function(_0x5c0a64){if(_0x5c0a64){return _0x1cd0be['status'](_0x20e69e)[_0xc780('0x1c')](_0x5c0a64);}};}function respondWithFilteredResult(_0x4ace4e,_0x34189f){return function(_0x8bce50){if(_0x8bce50){var _0x21a0e0=typeof _0x34189f['offset']===_0xc780('0x1d')&&typeof _0x34189f[_0xc780('0x1e')]==='undefined';var _0x1e4a51=_0x8bce50[_0xc780('0x1f')];var _0x272da6=_0x21a0e0?0x0:_0x34189f[_0xc780('0x20')];var _0x4968e1=_0x21a0e0?_0x8bce50[_0xc780('0x1f')]:_0x34189f[_0xc780('0x20')]+_0x34189f['limit'];var _0x490111;if(_0x4968e1>=_0x1e4a51){_0x4968e1=_0x1e4a51;_0x490111=0xc8;}else{_0x490111=0xce;}_0x4ace4e[_0xc780('0x21')](_0x490111);return _0x4ace4e[_0xc780('0x22')](_0xc780('0x23'),_0x272da6+'-'+_0x4968e1+'/'+_0x1e4a51)['json'](_0x8bce50);}return null;};}function patchUpdates(_0x7fde1e){return function(_0x1ced90){try{jsonpatch[_0xc780('0x24')](_0x1ced90,_0x7fde1e,!![]);}catch(_0x182e02){return BPromise['reject'](_0x182e02);}return _0x1ced90['save']();};}function saveUpdates(_0x54303c,_0x50e7cb){return function(_0x2e236f){if(_0x2e236f){return _0x2e236f[_0xc780('0x25')](_0x54303c)[_0xc780('0x26')](function(_0x24b3b6){return _0x24b3b6;});}return null;};}function removeEntity(_0x29c882,_0x3ddabb){return function(_0x52583b){if(_0x52583b){return _0x52583b['destroy']()[_0xc780('0x26')](function(){_0x29c882[_0xc780('0x21')](0xcc)[_0xc780('0x1b')]();});}};}function handleEntityNotFound(_0x70aa3a,_0x1d4d99){return function(_0x3c5955){if(!_0x3c5955){_0x70aa3a['sendStatus'](0x194);}return _0x3c5955;};}function handleError(_0x3b7a93,_0x228d1a){_0x228d1a=_0x228d1a||0x1f4;return function(_0x168f51){logger[_0xc780('0x27')](_0x168f51[_0xc780('0x28')]);if(_0x168f51['name']){delete _0x168f51[_0xc780('0x29')];}_0x3b7a93[_0xc780('0x21')](_0x228d1a)['send'](_0x168f51);};}exports['index']=function(_0x33009b,_0x29fc38){var _0x2d4943={},_0x581115={},_0x4f9b6d={'count':0x0,'rows':[]};var _0x1c64dc=_['map'](db[_0xc780('0x2a')][_0xc780('0x2b')],function(_0x8dc9ab){return{'name':_0x8dc9ab[_0xc780('0x2c')],'type':_0x8dc9ab[_0xc780('0x2d')][_0xc780('0x2e')]};});_0x581115[_0xc780('0x2f')]=_[_0xc780('0x30')](_0x1c64dc,_0xc780('0x29'));_0x581115['query']=_[_0xc780('0x31')](_0x33009b[_0xc780('0x32')]);_0x581115[_0xc780('0x33')]=_[_0xc780('0x34')](_0x581115[_0xc780('0x2f')],_0x581115[_0xc780('0x32')]);_0x2d4943[_0xc780('0x35')]=_[_0xc780('0x34')](_0x581115[_0xc780('0x2f')],qs[_0xc780('0x36')](_0x33009b[_0xc780('0x32')][_0xc780('0x36')]));_0x2d4943['attributes']=_0x2d4943['attributes'][_0xc780('0x37')]?_0x2d4943[_0xc780('0x35')]:_0x581115[_0xc780('0x2f')];if(!_0x33009b['query'][_0xc780('0x38')]('nolimit')){_0x2d4943[_0xc780('0x1e')]=qs[_0xc780('0x1e')](_0x33009b[_0xc780('0x32')][_0xc780('0x1e')]);_0x2d4943['offset']=qs[_0xc780('0x20')](_0x33009b[_0xc780('0x32')][_0xc780('0x20')]);}_0x2d4943[_0xc780('0x39')]=qs[_0xc780('0x3a')](_0x33009b[_0xc780('0x32')][_0xc780('0x3a')]);_0x2d4943[_0xc780('0x3b')]=qs['filters'](_[_0xc780('0x3c')](_0x33009b['query'],_0x581115[_0xc780('0x33')]),_0x1c64dc);if(_0x33009b[_0xc780('0x32')][_0xc780('0x3d')]){_0x2d4943[_0xc780('0x3b')]=_[_0xc780('0x3e')](_0x2d4943[_0xc780('0x3b')],{'$or':_['map'](_0x1c64dc,function(_0xe36b2f){if(_0xe36b2f[_0xc780('0x2d')]!==_0xc780('0x3f')){var _0x195d87={};_0x195d87[_0xe36b2f[_0xc780('0x29')]]={'$like':'%'+_0x33009b['query'][_0xc780('0x3d')]+'%'};return _0x195d87;}})});}_0x2d4943=_[_0xc780('0x3e')]({},_0x2d4943,_0x33009b[_0xc780('0x40')]);var _0x5953e6={'where':_0x2d4943[_0xc780('0x3b')]};return db[_0xc780('0x2a')]['count'](_0x5953e6)['then'](function(_0x3f7748){_0x4f9b6d['count']=_0x3f7748;if(_0x33009b[_0xc780('0x32')][_0xc780('0x41')]){_0x2d4943[_0xc780('0x42')]=[{'all':!![]}];}return db['CmHopperHistory'][_0xc780('0x43')](_0x2d4943);})[_0xc780('0x26')](function(_0x4a5cde){_0x4f9b6d[_0xc780('0x44')]=_0x4a5cde;return _0x4f9b6d;})['then'](respondWithFilteredResult(_0x29fc38,_0x2d4943))[_0xc780('0x45')](handleError(_0x29fc38,null));};exports['show']=function(_0x2bf3f6,_0x373c58){var _0x581b48={'raw':!![],'where':{'id':_0x2bf3f6[_0xc780('0x46')]['id']}},_0xc03ae9={};_0xc03ae9[_0xc780('0x2f')]=_[_0xc780('0x31')](db[_0xc780('0x2a')][_0xc780('0x2b')]);_0xc03ae9['query']=_[_0xc780('0x31')](_0x2bf3f6['query']);_0xc03ae9[_0xc780('0x33')]=_['intersection'](_0xc03ae9['model'],_0xc03ae9[_0xc780('0x32')]);_0x581b48[_0xc780('0x35')]=_[_0xc780('0x34')](_0xc03ae9[_0xc780('0x2f')],qs['fields'](_0x2bf3f6['query'][_0xc780('0x36')]));_0x581b48[_0xc780('0x35')]=_0x581b48[_0xc780('0x35')]['length']?_0x581b48[_0xc780('0x35')]:_0xc03ae9[_0xc780('0x2f')];if(_0x2bf3f6['query'][_0xc780('0x41')]){_0x581b48['include']=[{'all':!![]}];}_0x581b48=_[_0xc780('0x3e')]({},_0x581b48,_0x2bf3f6['options']);return db[_0xc780('0x2a')][_0xc780('0x47')](_0x581b48)[_0xc780('0x26')](handleEntityNotFound(_0x373c58,null))[_0xc780('0x26')](respondWithResult(_0x373c58,null))['catch'](handleError(_0x373c58,null));};exports['create']=function(_0x37ed8e,_0x759f07){return db[_0xc780('0x2a')]['create'](_0x37ed8e[_0xc780('0x48')],{})['then'](respondWithResult(_0x759f07,0xc9))[_0xc780('0x45')](handleError(_0x759f07,null));};exports['describe']=function(_0x130881,_0x59aa73){return db[_0xc780('0x2a')][_0xc780('0x49')]()[_0xc780('0x26')](respondWithResult(_0x59aa73,null))[_0xc780('0x45')](handleError(_0x59aa73,null));};exports['update']=function(_0x5581a4,_0x1d8260){if(_0x5581a4['body'][_0xc780('0x4a')]){delete _0x5581a4[_0xc780('0x48')][_0xc780('0x4a')];}return db[_0xc780('0x2a')][_0xc780('0x47')]({'where':{'uniqueid':_0x5581a4[_0xc780('0x46')]['id']}})['then'](handleEntityNotFound(_0x1d8260,null))[_0xc780('0x26')](saveUpdates(_0x5581a4['body'],null))[_0xc780('0x26')](respondWithResult(_0x1d8260,null))['catch'](handleError(_0x1d8260,null));}; \ No newline at end of file +var _0x211d=['merge','type','VIRTUAL','filter','options','findAll','rows','catch','params','length','includeAll','include','create','body','describe','uniqueid','find','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','map','CmHopperHistory','rawAttributes','fieldName','key','model','keys','query','attributes','intersection','fields','hasOwnProperty','nolimit','order','sort','filters','pick','where'];(function(_0x4f8fa7,_0x1e6865){var _0x4e69b6=function(_0x19bec5){while(--_0x19bec5){_0x4f8fa7['push'](_0x4f8fa7['shift']());}};_0x4e69b6(++_0x1e6865);}(_0x211d,0xa9));var _0xd211=function(_0x2708f5,_0x4c33e7){_0x2708f5=_0x2708f5-0x0;var _0x44913a=_0x211d[_0x2708f5];return _0x44913a;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd211('0x0'));var zipdir=require(_0xd211('0x1'));var jsonpatch=require(_0xd211('0x2'));var rp=require(_0xd211('0x3'));var moment=require(_0xd211('0x4'));var BPromise=require(_0xd211('0x5'));var Mustache=require('mustache');var util=require(_0xd211('0x6'));var path=require(_0xd211('0x7'));var sox=require(_0xd211('0x8'));var csv=require(_0xd211('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xd211('0xa'));var squel=require(_0xd211('0xb'));var crypto=require(_0xd211('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xd211('0x9'));var querystring=require(_0xd211('0xd'));var Papa=require(_0xd211('0xe'));var Redis=require('ioredis');var authService=require(_0xd211('0xf'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd211('0x10'));var logger=require(_0xd211('0x11'))(_0xd211('0x12'));var utils=require(_0xd211('0x13'));var config=require(_0xd211('0x14'));var licenseUtil=require(_0xd211('0x15'));var db=require(_0xd211('0x16'))['db'];function respondWithStatusCode(_0x5b1163,_0x4356ad){_0x4356ad=_0x4356ad||0xcc;return function(_0x1daa77){if(_0x1daa77){return _0x5b1163[_0xd211('0x17')](_0x4356ad);}return _0x5b1163[_0xd211('0x18')](_0x4356ad)['end']();};}function respondWithResult(_0x34fc54,_0x1863a7){_0x1863a7=_0x1863a7||0xc8;return function(_0xa28652){if(_0xa28652){return _0x34fc54[_0xd211('0x18')](_0x1863a7)[_0xd211('0x19')](_0xa28652);}};}function respondWithFilteredResult(_0x47f26c,_0x16ac35){return function(_0x12cff6){if(_0x12cff6){var _0x58a9d4=typeof _0x16ac35[_0xd211('0x1a')]===_0xd211('0x1b')&&typeof _0x16ac35[_0xd211('0x1c')]===_0xd211('0x1b');var _0x5af9b6=_0x12cff6[_0xd211('0x1d')];var _0x4267a0=_0x58a9d4?0x0:_0x16ac35[_0xd211('0x1a')];var _0x141b0c=_0x58a9d4?_0x12cff6[_0xd211('0x1d')]:_0x16ac35[_0xd211('0x1a')]+_0x16ac35['limit'];var _0x4314dd;if(_0x141b0c>=_0x5af9b6){_0x141b0c=_0x5af9b6;_0x4314dd=0xc8;}else{_0x4314dd=0xce;}_0x47f26c[_0xd211('0x18')](_0x4314dd);return _0x47f26c['set'](_0xd211('0x1e'),_0x4267a0+'-'+_0x141b0c+'/'+_0x5af9b6)[_0xd211('0x19')](_0x12cff6);}return null;};}function patchUpdates(_0x29bc41){return function(_0x5c0851){try{jsonpatch['apply'](_0x5c0851,_0x29bc41,!![]);}catch(_0x443df1){return BPromise[_0xd211('0x1f')](_0x443df1);}return _0x5c0851[_0xd211('0x20')]();};}function saveUpdates(_0x356ed5,_0x24a2f1){return function(_0x54df0a){if(_0x54df0a){return _0x54df0a[_0xd211('0x21')](_0x356ed5)[_0xd211('0x22')](function(_0x50f611){return _0x50f611;});}return null;};}function removeEntity(_0x14e76c,_0x1d0814){return function(_0x32307d){if(_0x32307d){return _0x32307d[_0xd211('0x23')]()[_0xd211('0x22')](function(){_0x14e76c['status'](0xcc)[_0xd211('0x24')]();});}};}function handleEntityNotFound(_0x2fe6f0,_0x4150a7){return function(_0x16e9e7){if(!_0x16e9e7){_0x2fe6f0[_0xd211('0x17')](0x194);}return _0x16e9e7;};}function handleError(_0x121aeb,_0x155ce3){_0x155ce3=_0x155ce3||0x1f4;return function(_0x85453){logger[_0xd211('0x25')](_0x85453[_0xd211('0x26')]);if(_0x85453[_0xd211('0x27')]){delete _0x85453['name'];}_0x121aeb[_0xd211('0x18')](_0x155ce3)[_0xd211('0x28')](_0x85453);};}exports['index']=function(_0x1d8244,_0x225eb1){var _0x28a874={},_0x30f381={},_0x959cf8={'count':0x0,'rows':[]};var _0x1079c4=_[_0xd211('0x29')](db[_0xd211('0x2a')][_0xd211('0x2b')],function(_0x4199be){return{'name':_0x4199be[_0xd211('0x2c')],'type':_0x4199be['type'][_0xd211('0x2d')]};});_0x30f381[_0xd211('0x2e')]=_[_0xd211('0x29')](_0x1079c4,'name');_0x30f381['query']=_[_0xd211('0x2f')](_0x1d8244[_0xd211('0x30')]);_0x30f381['filters']=_['intersection'](_0x30f381[_0xd211('0x2e')],_0x30f381[_0xd211('0x30')]);_0x28a874[_0xd211('0x31')]=_[_0xd211('0x32')](_0x30f381[_0xd211('0x2e')],qs[_0xd211('0x33')](_0x1d8244['query'][_0xd211('0x33')]));_0x28a874['attributes']=_0x28a874[_0xd211('0x31')]['length']?_0x28a874['attributes']:_0x30f381[_0xd211('0x2e')];if(!_0x1d8244['query'][_0xd211('0x34')](_0xd211('0x35'))){_0x28a874[_0xd211('0x1c')]=qs['limit'](_0x1d8244['query']['limit']);_0x28a874['offset']=qs[_0xd211('0x1a')](_0x1d8244[_0xd211('0x30')]['offset']);}_0x28a874[_0xd211('0x36')]=qs[_0xd211('0x37')](_0x1d8244['query'][_0xd211('0x37')]);_0x28a874['where']=qs[_0xd211('0x38')](_[_0xd211('0x39')](_0x1d8244[_0xd211('0x30')],_0x30f381[_0xd211('0x38')]),_0x1079c4);if(_0x1d8244['query']['filter']){_0x28a874[_0xd211('0x3a')]=_[_0xd211('0x3b')](_0x28a874['where'],{'$or':_[_0xd211('0x29')](_0x1079c4,function(_0x94d1d){if(_0x94d1d[_0xd211('0x3c')]!==_0xd211('0x3d')){var _0x5badb6={};_0x5badb6[_0x94d1d[_0xd211('0x27')]]={'$like':'%'+_0x1d8244[_0xd211('0x30')][_0xd211('0x3e')]+'%'};return _0x5badb6;}})});}_0x28a874=_[_0xd211('0x3b')]({},_0x28a874,_0x1d8244[_0xd211('0x3f')]);var _0xb0f10d={'where':_0x28a874[_0xd211('0x3a')]};return db[_0xd211('0x2a')]['count'](_0xb0f10d)[_0xd211('0x22')](function(_0x3a2a6c){_0x959cf8[_0xd211('0x1d')]=_0x3a2a6c;if(_0x1d8244[_0xd211('0x30')]['includeAll']){_0x28a874['include']=[{'all':!![]}];}return db[_0xd211('0x2a')][_0xd211('0x40')](_0x28a874);})[_0xd211('0x22')](function(_0x18f5bd){_0x959cf8[_0xd211('0x41')]=_0x18f5bd;return _0x959cf8;})[_0xd211('0x22')](respondWithFilteredResult(_0x225eb1,_0x28a874))[_0xd211('0x42')](handleError(_0x225eb1,null));};exports['show']=function(_0x3cea2e,_0x12d86f){var _0x37cf9f={'raw':!![],'where':{'id':_0x3cea2e[_0xd211('0x43')]['id']}},_0x3f2332={};_0x3f2332['model']=_[_0xd211('0x2f')](db[_0xd211('0x2a')][_0xd211('0x2b')]);_0x3f2332[_0xd211('0x30')]=_['keys'](_0x3cea2e[_0xd211('0x30')]);_0x3f2332['filters']=_[_0xd211('0x32')](_0x3f2332[_0xd211('0x2e')],_0x3f2332[_0xd211('0x30')]);_0x37cf9f[_0xd211('0x31')]=_[_0xd211('0x32')](_0x3f2332['model'],qs[_0xd211('0x33')](_0x3cea2e[_0xd211('0x30')][_0xd211('0x33')]));_0x37cf9f[_0xd211('0x31')]=_0x37cf9f[_0xd211('0x31')][_0xd211('0x44')]?_0x37cf9f[_0xd211('0x31')]:_0x3f2332[_0xd211('0x2e')];if(_0x3cea2e[_0xd211('0x30')][_0xd211('0x45')]){_0x37cf9f[_0xd211('0x46')]=[{'all':!![]}];}_0x37cf9f=_['merge']({},_0x37cf9f,_0x3cea2e[_0xd211('0x3f')]);return db[_0xd211('0x2a')]['find'](_0x37cf9f)['then'](handleEntityNotFound(_0x12d86f,null))[_0xd211('0x22')](respondWithResult(_0x12d86f,null))[_0xd211('0x42')](handleError(_0x12d86f,null));};exports[_0xd211('0x47')]=function(_0x29e9d4,_0x62b3cc){return db['CmHopperHistory'][_0xd211('0x47')](_0x29e9d4[_0xd211('0x48')],{})['then'](respondWithResult(_0x62b3cc,0xc9))['catch'](handleError(_0x62b3cc,null));};exports[_0xd211('0x49')]=function(_0x4cb75d,_0x294910){return db[_0xd211('0x2a')][_0xd211('0x49')]()[_0xd211('0x22')](respondWithResult(_0x294910,null))[_0xd211('0x42')](handleError(_0x294910,null));};exports['update']=function(_0x50e7ee,_0x38d477){if(_0x50e7ee[_0xd211('0x48')][_0xd211('0x4a')]){delete _0x50e7ee[_0xd211('0x48')][_0xd211('0x4a')];}return db[_0xd211('0x2a')][_0xd211('0x4b')]({'where':{'uniqueid':_0x50e7ee['params']['id']}})['then'](handleEntityNotFound(_0x38d477,null))[_0xd211('0x22')](saveUpdates(_0x50e7ee[_0xd211('0x48')],null))[_0xd211('0x22')](respondWithResult(_0x38d477,null))[_0xd211('0x42')](handleError(_0x38d477,null));}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.model.js b/server/api/cmHopperHistory/cmHopperHistory.model.js index 8f56923..fc03987 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 _0xce14=['api','moment','request-promise','path','rimraf','../../config/environment','./cmHopperHistory.attributes','define','CmHopperHistory','endtime','uniqueid','util'];(function(_0x187309,_0x2cb520){var _0x1d3711=function(_0x5ab037){while(--_0x5ab037){_0x187309['push'](_0x187309['shift']());}};_0x1d3711(++_0x2cb520);}(_0xce14,0x17f));var _0x4ce1=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xce14[_0x5ddb1c];return _0x354adc;};'use strict';var _=require('lodash');var util=require(_0x4ce1('0x0'));var logger=require('../../config/logger')(_0x4ce1('0x1'));var moment=require(_0x4ce1('0x2'));var BPromise=require('bluebird');var rp=require(_0x4ce1('0x3'));var fs=require('fs');var path=require(_0x4ce1('0x4'));var rimraf=require(_0x4ce1('0x5'));var config=require(_0x4ce1('0x6'));var attributes=require(_0x4ce1('0x7'));module['exports']=function(_0x10aaa0,_0x3954d4){return _0x10aaa0[_0x4ce1('0x8')](_0x4ce1('0x9'),attributes,{'tableName':'cm_hopper_history','paranoid':![],'indexes':[{'name':_0x4ce1('0xa'),'fields':[_0x4ce1('0xa')]},{'name':_0x4ce1('0xb'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5ae0=['rimraf','exports','CmHopperHistory','cm_hopper_history','endtime','uniqueid','util','../../config/logger','moment','bluebird','path'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x5ae0,0xf8));var _0x05ae=function(_0x37d9c8,_0x20d966){_0x37d9c8=_0x37d9c8-0x0;var _0x42b872=_0x5ae0[_0x37d9c8];return _0x42b872;};'use strict';var _=require('lodash');var util=require(_0x05ae('0x0'));var logger=require(_0x05ae('0x1'))('api');var moment=require(_0x05ae('0x2'));var BPromise=require(_0x05ae('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x05ae('0x4'));var rimraf=require(_0x05ae('0x5'));var config=require('../../config/environment');var attributes=require('./cmHopperHistory.attributes');module[_0x05ae('0x6')]=function(_0x40b966,_0x2c4e6c){return _0x40b966['define'](_0x05ae('0x7'),attributes,{'tableName':_0x05ae('0x8'),'paranoid':![],'indexes':[{'name':_0x05ae('0x9'),'fields':[_0x05ae('0x9')]},{'name':_0x05ae('0xa'),'fields':[_0x05ae('0xa')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/cmHopperHistory.rpc.js b/server/api/cmHopperHistory/cmHopperHistory.rpc.js index 998176d..5de89b9 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 _0x15ec=['outboundBlacklistCallsDay','`state`\x20=\x2014,\x201,\x20null','`state`\x20=\x2018,\x201,\x20null','outboundRejectCallsDay','outboundAnswerAgiCallsDay','`state`\x20=\x2020,\x201,\x20null','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','GetCampaignHopperHistory','ivrAnswerCallsDay','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','debug','CmHopperHistory,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','CmHopperHistory,\x20%s,\x20%s','message','result','catch','CreateCmHopperHistory','CmHopperHistory','create','options','then','stringify','findAll','raw','where','COUNT','col','predictiveIntervalTotalCalls','sequelize','literal','`state`\x20=\x204,\x201,\x20null','predictiveIntervalDroppedCallsTimeout','`state`\x20=\x2011,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','AvgHandleTime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','outboundAnswerCallsDay','`state`\x20=\x205,\x201,\x20null','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','`state`\x20=\x2012,\x201,\x20null','outboundUnknownCallsDay','`state`\x20=\x2013,\x201,\x20null'];(function(_0x4fb33d,_0x467841){var _0x245160=function(_0x4e671a){while(--_0x4e671a){_0x4fb33d['push'](_0x4fb33d['shift']());}};_0x245160(++_0x467841);}(_0x15ec,0x16c));var _0xc15e=function(_0x55e08b,_0x421620){_0x55e08b=_0x55e08b-0x0;var _0xd1a7ff=_0x15ec[_0x55e08b];return _0xd1a7ff;};'use strict';var _=require('lodash');var util=require(_0xc15e('0x0'));var moment=require(_0xc15e('0x1'));var BPromise=require(_0xc15e('0x2'));var rs=require(_0xc15e('0x3'));var fs=require('fs');var Redis=require(_0xc15e('0x4'));var db=require(_0xc15e('0x5'))['db'];var utils=require(_0xc15e('0x6'));var logger=require(_0xc15e('0x7'))(_0xc15e('0x8'));var config=require(_0xc15e('0x9'));var jayson=require(_0xc15e('0xa'));var client=jayson['client'][_0xc15e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4b94f3,_0x10bc9a,_0xa2b267){return new BPromise(function(_0x390830,_0x34836f){return client[_0xc15e('0xc')](_0x4b94f3,_0xa2b267)['then'](function(_0x2b74b3){logger[_0xc15e('0xd')]('CmHopperHistory,\x20%s,\x20%s',_0x10bc9a,'request\x20sent');logger[_0xc15e('0xe')](_0xc15e('0xf'),_0x10bc9a,_0xc15e('0x10'),JSON['stringify'](_0x2b74b3));if(_0x2b74b3[_0xc15e('0x11')]){if(_0x2b74b3[_0xc15e('0x11')][_0xc15e('0x12')]===0x1f4){logger[_0xc15e('0x11')](_0xc15e('0x13'),_0x10bc9a,_0x2b74b3[_0xc15e('0x11')][_0xc15e('0x14')]);return _0x34836f(_0x2b74b3[_0xc15e('0x11')]['message']);}logger['error'](_0xc15e('0x13'),_0x10bc9a,_0x2b74b3['error'][_0xc15e('0x14')]);return _0x390830(_0x2b74b3[_0xc15e('0x11')][_0xc15e('0x14')]);}else{logger['info'](_0xc15e('0x13'),_0x10bc9a,_0xc15e('0x10'));_0x390830(_0x2b74b3[_0xc15e('0x15')][_0xc15e('0x14')]);}})[_0xc15e('0x16')](function(_0x4abf13){logger[_0xc15e('0x11')](_0xc15e('0x13'),_0x10bc9a,_0x4abf13);_0x34836f(_0x4abf13);});});}exports[_0xc15e('0x17')]=function(_0x57948f){var _0x368755=this;return new Promise(function(_0x31a4c9,_0x5a9950){return db[_0xc15e('0x18')][_0xc15e('0x19')](_0x57948f['body'],{'raw':_0x57948f[_0xc15e('0x1a')]?_0x57948f[_0xc15e('0x1a')]['raw']===undefined?!![]:![]:!![]})[_0xc15e('0x1b')](function(_0x76c281){logger[_0xc15e('0xd')](_0xc15e('0x17'),_0x57948f);logger['debug'](_0xc15e('0x17'),_0x57948f,JSON[_0xc15e('0x1c')](_0x76c281));_0x31a4c9(_0x76c281);})[_0xc15e('0x16')](function(_0xa2527){logger[_0xc15e('0x11')](_0xc15e('0x17'),_0xa2527[_0xc15e('0x14')],_0x57948f);_0x5a9950(_0x368755['error'](0x1f4,_0xa2527[_0xc15e('0x14')]));});});};exports['AvgHandleTime']=function(_0x4e03c8){var _0x43b009=this;return new Promise(function(_0x55a424,_0x427a41){return db[_0xc15e('0x18')][_0xc15e('0x1d')]({'raw':_0x4e03c8[_0xc15e('0x1a')]?_0x4e03c8[_0xc15e('0x1a')][_0xc15e('0x1e')]===undefined?!![]:![]:!![],'where':_0x4e03c8[_0xc15e('0x1a')]?_0x4e03c8[_0xc15e('0x1a')][_0xc15e('0x1f')]||null:null,'attributes':[[db['sequelize']['fn'](_0xc15e('0x20'),db['sequelize'][_0xc15e('0x21')]('id')),_0xc15e('0x22')],[db[_0xc15e('0x23')]['fn'](_0xc15e('0x20'),db[_0xc15e('0x23')]['fn']('IF',db[_0xc15e('0x23')][_0xc15e('0x24')](_0xc15e('0x25')))),'predictiveIntervalAnsweredCalls'],[db[_0xc15e('0x23')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0xc15e('0x23')][_0xc15e('0x24')]('`state`\x20=\x2010,\x201,\x20null'))),_0xc15e('0x26')],[db[_0xc15e('0x23')]['fn'](_0xc15e('0x20'),db[_0xc15e('0x23')]['fn']('IF',db[_0xc15e('0x23')]['literal'](_0xc15e('0x27')))),_0xc15e('0x28')],[db[_0xc15e('0x23')]['fn']('AVG',db[_0xc15e('0x23')]['fn']('IF',db[_0xc15e('0x23')][_0xc15e('0x24')](_0xc15e('0x29')))),_0xc15e('0x2a')],[db[_0xc15e('0x23')]['fn']('AVG',db[_0xc15e('0x23')]['fn']('IF',db['sequelize'][_0xc15e('0x24')]('`state`\x20=\x204,\x20`talktime`,\x20null'))),_0xc15e('0x2b')]]})['then'](function(_0xe386d2){logger[_0xc15e('0xd')]('AvgHandleTime',_0x4e03c8);logger[_0xc15e('0xe')](_0xc15e('0x2c'),_0x4e03c8,JSON['stringify'](_0xe386d2));_0x55a424(_0xe386d2);})[_0xc15e('0x16')](function(_0x174d3c){logger[_0xc15e('0x11')](_0xc15e('0x2c'),_0x174d3c[_0xc15e('0x14')],_0x4e03c8);_0x427a41(_0x43b009[_0xc15e('0x11')](0x1f4,_0x174d3c['message']));});});};exports[_0xc15e('0x2d')]=function(_0x524c4f){var _0x2a7599=this;return new Promise(function(_0x5cf7a8,_0x2b5145){return db[_0xc15e('0x18')][_0xc15e('0x1d')]({'raw':_0x524c4f[_0xc15e('0x1a')]?_0x524c4f[_0xc15e('0x1a')][_0xc15e('0x1e')]===undefined?!![]:![]:!![],'where':_0x524c4f[_0xc15e('0x1a')]?_0x524c4f[_0xc15e('0x1a')]['where']||null:null,'attributes':[[_0xc15e('0x2e'),_0xc15e('0x2f')],[db[_0xc15e('0x23')]['fn'](_0xc15e('0x20'),db[_0xc15e('0x23')]['fn']('IF',db[_0xc15e('0x23')][_0xc15e('0x24')](_0xc15e('0x30')))),_0xc15e('0x31')],[db[_0xc15e('0x23')]['fn'](_0xc15e('0x20'),db['sequelize']['fn']('IF',db[_0xc15e('0x23')]['literal'](_0xc15e('0x32')))),_0xc15e('0x33')],[db[_0xc15e('0x23')]['fn'](_0xc15e('0x20'),db[_0xc15e('0x23')]['fn']('IF',db[_0xc15e('0x23')][_0xc15e('0x24')]('`state`\x20=\x204,\x201,\x20null'))),_0xc15e('0x34')],[db[_0xc15e('0x23')]['fn'](_0xc15e('0x20'),db[_0xc15e('0x23')]['fn']('IF',db[_0xc15e('0x23')]['literal'](_0xc15e('0x35')))),_0xc15e('0x36')],[db['sequelize']['fn'](_0xc15e('0x20'),db['sequelize']['fn']('IF',db['sequelize'][_0xc15e('0x24')](_0xc15e('0x37')))),_0xc15e('0x38')],[db[_0xc15e('0x23')]['fn'](_0xc15e('0x20'),db[_0xc15e('0x23')]['fn']('IF',db[_0xc15e('0x23')][_0xc15e('0x24')]('`state`\x20=\x2010\x20,\x201,\x20null'))),_0xc15e('0x39')],[db[_0xc15e('0x23')]['fn']('COUNT',db[_0xc15e('0x23')]['fn']('IF',db[_0xc15e('0x23')][_0xc15e('0x24')]('`state`\x20=\x2011\x20,\x201,\x20null'))),_0xc15e('0x3a')],[db[_0xc15e('0x23')]['fn']('COUNT',db[_0xc15e('0x23')]['fn']('IF',db[_0xc15e('0x23')][_0xc15e('0x24')](_0xc15e('0x3b')))),_0xc15e('0x3c')],[db['sequelize']['fn'](_0xc15e('0x20'),db[_0xc15e('0x23')]['fn']('IF',db[_0xc15e('0x23')]['literal'](_0xc15e('0x3d')))),_0xc15e('0x3e')],[db['sequelize']['fn'](_0xc15e('0x20'),db[_0xc15e('0x23')]['fn']('IF',db[_0xc15e('0x23')][_0xc15e('0x24')](_0xc15e('0x3f')))),'outboundOriginateFailureCallsDay'],[db[_0xc15e('0x23')]['fn'](_0xc15e('0x20'),db[_0xc15e('0x23')]['fn']('IF',db[_0xc15e('0x23')][_0xc15e('0x24')](_0xc15e('0x40')))),_0xc15e('0x41')],[db[_0xc15e('0x23')]['fn']('COUNT',db[_0xc15e('0x23')]['fn']('IF',db[_0xc15e('0x23')][_0xc15e('0x24')]('`state`\x20=\x2016,\x201,\x20null'))),_0xc15e('0x42')],[db['sequelize']['fn']('COUNT',db[_0xc15e('0x23')]['fn']('IF',db[_0xc15e('0x23')][_0xc15e('0x24')](_0xc15e('0x43')))),'outboundRejectCallsDay'],[db[_0xc15e('0x23')]['fn'](_0xc15e('0x20'),db[_0xc15e('0x23')]['fn']('IF',db['sequelize'][_0xc15e('0x24')](_0xc15e('0x44')))),'outboundReCallsDay']],'group':[_0xc15e('0x2e')]})[_0xc15e('0x1b')](function(_0x1eca8b){logger[_0xc15e('0xd')]('GetVoiceQueueHopperHistory',_0x524c4f);logger[_0xc15e('0xe')](_0xc15e('0x2d'),_0x524c4f,JSON[_0xc15e('0x1c')](_0x1eca8b));_0x5cf7a8(_0x1eca8b);})[_0xc15e('0x16')](function(_0x340a51){logger[_0xc15e('0x11')](_0xc15e('0x2d'),_0x340a51['message'],_0x524c4f);_0x2b5145(_0x2a7599[_0xc15e('0x11')](0x1f4,_0x340a51[_0xc15e('0x14')]));});});};exports[_0xc15e('0x45')]=function(_0x43be44){var _0xc2810e=this;return new Promise(function(_0x4260ff,_0x4518d2){return db[_0xc15e('0x18')][_0xc15e('0x1d')]({'raw':_0x43be44['options']?_0x43be44[_0xc15e('0x1a')][_0xc15e('0x1e')]===undefined?!![]:![]:!![],'where':_0x43be44[_0xc15e('0x1a')]?_0x43be44[_0xc15e('0x1a')][_0xc15e('0x1f')]||null:null,'attributes':[['campaign',_0xc15e('0x2f')],[db[_0xc15e('0x23')]['fn'](_0xc15e('0x20'),db['sequelize'][_0xc15e('0x21')]('id')),'ivrTotalCallsDays'],[db[_0xc15e('0x23')]['fn']('COUNT',db[_0xc15e('0x23')]['fn']('IF',db['sequelize'][_0xc15e('0x24')](_0xc15e('0x25')))),_0xc15e('0x46')]],'group':[_0xc15e('0x2e')]})['then'](function(_0xba28e1){logger[_0xc15e('0xd')](_0xc15e('0x45'),_0x43be44);logger['debug'](_0xc15e('0x45'),_0x43be44,JSON[_0xc15e('0x1c')](_0xba28e1));_0x4260ff(_0xba28e1);})[_0xc15e('0x16')](function(_0x5069bc){logger[_0xc15e('0x11')](_0xc15e('0x45'),_0x5069bc[_0xc15e('0x14')],_0x43be44);_0x4518d2(_0xc2810e[_0xc15e('0x11')](0x1f4,_0x5069bc['message']));});});}; \ No newline at end of file +var _0xad53=['code','message','result','CmHopperHistory','body','options','raw','CreateCmHopperHistory','debug','AvgHandleTime','findAll','where','col','predictiveIntervalTotalCalls','sequelize','predictiveIntervalAnsweredCalls','COUNT','literal','`state`\x20=\x2010,\x201,\x20null','predictiveIntervalDroppedCallsCallersExit','AVG','`state`\x20=\x204,\x20`holdtime`,\x20null','predictiveIntervalAvgHoldtime','`state`\x20=\x204,\x20`talktime`,\x20null','predictiveIntervalAvgTalktime','GetVoiceQueueHopperHistory','campaign','name','`state`\x20=\x200,\x201,\x20null','outboundNoSuchCallsDay','`state`\x20=\x203,\x201,\x20null','outboundNoAnswerCallsDay','`state`\x20=\x204,\x201,\x20null','outboundAnswerCallsDay','outboundBusyCallsDay','`state`\x20=\x208,\x201,\x20null','outboundCongestionCallsDay','`state`\x20=\x2010\x20,\x201,\x20null','outboundDropCallsDayTimeout','`state`\x20=\x2011\x20,\x201,\x20null','`state`\x20=\x2012,\x201,\x20null','`state`\x20=\x2013,\x201,\x20null','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','`state`\x20=\x2016,\x201,\x20null','outboundAnswerAgiCallsDay','`state`\x20=\x2022\x20or\x20`state`\x20=\x2023,\x201,\x20null','outboundReCallsDay','catch','GetCampaignHopperHistory','ivrAnswerCallsDay','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','CmHopperHistory,\x20%s,\x20%s','request\x20sent','CmHopperHistory,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x95b743,_0x4c8148){var _0x207cce=function(_0x26fd4a){while(--_0x26fd4a){_0x95b743['push'](_0x95b743['shift']());}};_0x207cce(++_0x4c8148);}(_0xad53,0x1ea));var _0x3ad5=function(_0x4febb3,_0x318918){_0x4febb3=_0x4febb3-0x0;var _0x215aab=_0xad53[_0x4febb3];return _0x215aab;};'use strict';var _=require(_0x3ad5('0x0'));var util=require(_0x3ad5('0x1'));var moment=require(_0x3ad5('0x2'));var BPromise=require(_0x3ad5('0x3'));var rs=require(_0x3ad5('0x4'));var fs=require('fs');var Redis=require(_0x3ad5('0x5'));var db=require(_0x3ad5('0x6'))['db'];var utils=require(_0x3ad5('0x7'));var logger=require('../../config/logger')(_0x3ad5('0x8'));var config=require(_0x3ad5('0x9'));var jayson=require(_0x3ad5('0xa'));var client=jayson[_0x3ad5('0xb')][_0x3ad5('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5a7780,_0x5e8e41,_0x5c40d7){return new BPromise(function(_0x1ef667,_0x1262a4){return client[_0x3ad5('0xd')](_0x5a7780,_0x5c40d7)[_0x3ad5('0xe')](function(_0x17fd04){logger[_0x3ad5('0xf')](_0x3ad5('0x10'),_0x5e8e41,_0x3ad5('0x11'));logger['debug'](_0x3ad5('0x12'),_0x5e8e41,_0x3ad5('0x11'),JSON[_0x3ad5('0x13')](_0x17fd04));if(_0x17fd04[_0x3ad5('0x14')]){if(_0x17fd04['error'][_0x3ad5('0x15')]===0x1f4){logger[_0x3ad5('0x14')](_0x3ad5('0x10'),_0x5e8e41,_0x17fd04['error'][_0x3ad5('0x16')]);return _0x1262a4(_0x17fd04[_0x3ad5('0x14')][_0x3ad5('0x16')]);}logger[_0x3ad5('0x14')](_0x3ad5('0x10'),_0x5e8e41,_0x17fd04[_0x3ad5('0x14')]['message']);return _0x1ef667(_0x17fd04['error'][_0x3ad5('0x16')]);}else{logger[_0x3ad5('0xf')](_0x3ad5('0x10'),_0x5e8e41,_0x3ad5('0x11'));_0x1ef667(_0x17fd04[_0x3ad5('0x17')][_0x3ad5('0x16')]);}})['catch'](function(_0x56123a){logger[_0x3ad5('0x14')](_0x3ad5('0x10'),_0x5e8e41,_0x56123a);_0x1262a4(_0x56123a);});});}exports['CreateCmHopperHistory']=function(_0x5d557e){var _0x445741=this;return new Promise(function(_0xd8775,_0x179cda){return db[_0x3ad5('0x18')]['create'](_0x5d557e[_0x3ad5('0x19')],{'raw':_0x5d557e[_0x3ad5('0x1a')]?_0x5d557e[_0x3ad5('0x1a')][_0x3ad5('0x1b')]===undefined?!![]:![]:!![]})[_0x3ad5('0xe')](function(_0x1c37c7){logger[_0x3ad5('0xf')](_0x3ad5('0x1c'),_0x5d557e);logger[_0x3ad5('0x1d')]('CreateCmHopperHistory',_0x5d557e,JSON[_0x3ad5('0x13')](_0x1c37c7));_0xd8775(_0x1c37c7);})['catch'](function(_0x936a29){logger['error'](_0x3ad5('0x1c'),_0x936a29[_0x3ad5('0x16')],_0x5d557e);_0x179cda(_0x445741[_0x3ad5('0x14')](0x1f4,_0x936a29[_0x3ad5('0x16')]));});});};exports[_0x3ad5('0x1e')]=function(_0x26b402){var _0x4c59dc=this;return new Promise(function(_0x437b4c,_0x1aa2e9){return db['CmHopperHistory'][_0x3ad5('0x1f')]({'raw':_0x26b402[_0x3ad5('0x1a')]?_0x26b402[_0x3ad5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x26b402[_0x3ad5('0x1a')]?_0x26b402[_0x3ad5('0x1a')][_0x3ad5('0x20')]||null:null,'attributes':[[db['sequelize']['fn']('COUNT',db['sequelize'][_0x3ad5('0x21')]('id')),_0x3ad5('0x22')],[db[_0x3ad5('0x23')]['fn']('COUNT',db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')]['literal']('`state`\x20=\x204,\x201,\x20null'))),_0x3ad5('0x24')],[db['sequelize']['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x27')))),'predictiveIntervalDroppedCallsTimeout'],[db['sequelize']['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')]('`state`\x20=\x2011,\x201,\x20null'))),_0x3ad5('0x28')],[db[_0x3ad5('0x23')]['fn'](_0x3ad5('0x29'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x2a')))),_0x3ad5('0x2b')],[db[_0x3ad5('0x23')]['fn'](_0x3ad5('0x29'),db['sequelize']['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x2c')))),_0x3ad5('0x2d')]]})[_0x3ad5('0xe')](function(_0x41240f){logger[_0x3ad5('0xf')]('AvgHandleTime',_0x26b402);logger['debug'](_0x3ad5('0x1e'),_0x26b402,JSON[_0x3ad5('0x13')](_0x41240f));_0x437b4c(_0x41240f);})['catch'](function(_0x1005ac){logger[_0x3ad5('0x14')](_0x3ad5('0x1e'),_0x1005ac[_0x3ad5('0x16')],_0x26b402);_0x1aa2e9(_0x4c59dc[_0x3ad5('0x14')](0x1f4,_0x1005ac[_0x3ad5('0x16')]));});});};exports[_0x3ad5('0x2e')]=function(_0x2f8bea){var _0x247f0c=this;return new Promise(function(_0x256c59,_0x13de0d){return db[_0x3ad5('0x18')][_0x3ad5('0x1f')]({'raw':_0x2f8bea['options']?_0x2f8bea[_0x3ad5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x2f8bea[_0x3ad5('0x1a')]?_0x2f8bea[_0x3ad5('0x1a')][_0x3ad5('0x20')]||null:null,'attributes':[[_0x3ad5('0x2f'),_0x3ad5('0x30')],[db[_0x3ad5('0x23')]['fn'](_0x3ad5('0x25'),db['sequelize']['fn']('IF',db['sequelize'][_0x3ad5('0x26')](_0x3ad5('0x31')))),_0x3ad5('0x32')],[db[_0x3ad5('0x23')]['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x33')))),_0x3ad5('0x34')],[db[_0x3ad5('0x23')]['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x35')))),_0x3ad5('0x36')],[db[_0x3ad5('0x23')]['fn']('COUNT',db['sequelize']['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')]('`state`\x20=\x205,\x201,\x20null'))),_0x3ad5('0x37')],[db['sequelize']['fn']('COUNT',db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x38')))),_0x3ad5('0x39')],[db[_0x3ad5('0x23')]['fn'](_0x3ad5('0x25'),db['sequelize']['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x3a')))),_0x3ad5('0x3b')],[db[_0x3ad5('0x23')]['fn']('COUNT',db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x3c')))),'outboundDropCallsDayCallersExit'],[db['sequelize']['fn']('COUNT',db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x3d')))),'outboundUnknownCallsDay'],[db['sequelize']['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')]['literal'](_0x3ad5('0x3e')))),_0x3ad5('0x3f')],[db['sequelize']['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')]['literal']('`state`\x20=\x2014,\x201,\x20null'))),_0x3ad5('0x40')],[db['sequelize']['fn'](_0x3ad5('0x25'),db['sequelize']['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')]('`state`\x20=\x2018,\x201,\x20null'))),_0x3ad5('0x41')],[db[_0x3ad5('0x23')]['fn'](_0x3ad5('0x25'),db['sequelize']['fn']('IF',db['sequelize'][_0x3ad5('0x26')](_0x3ad5('0x42')))),_0x3ad5('0x43')],[db[_0x3ad5('0x23')]['fn'](_0x3ad5('0x25'),db['sequelize']['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')]('`state`\x20=\x2020,\x201,\x20null'))),_0x3ad5('0x41')],[db['sequelize']['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')](_0x3ad5('0x44')))),_0x3ad5('0x45')]],'group':[_0x3ad5('0x2f')]})[_0x3ad5('0xe')](function(_0x4506f6){logger[_0x3ad5('0xf')]('GetVoiceQueueHopperHistory',_0x2f8bea);logger[_0x3ad5('0x1d')](_0x3ad5('0x2e'),_0x2f8bea,JSON['stringify'](_0x4506f6));_0x256c59(_0x4506f6);})[_0x3ad5('0x46')](function(_0x543041){logger[_0x3ad5('0x14')]('GetVoiceQueueHopperHistory',_0x543041[_0x3ad5('0x16')],_0x2f8bea);_0x13de0d(_0x247f0c[_0x3ad5('0x14')](0x1f4,_0x543041['message']));});});};exports[_0x3ad5('0x47')]=function(_0x53e2e7){var _0x10e0a2=this;return new Promise(function(_0x164115,_0x35038a){return db['CmHopperHistory'][_0x3ad5('0x1f')]({'raw':_0x53e2e7['options']?_0x53e2e7[_0x3ad5('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x53e2e7[_0x3ad5('0x1a')]?_0x53e2e7[_0x3ad5('0x1a')][_0x3ad5('0x20')]||null:null,'attributes':[[_0x3ad5('0x2f'),'name'],[db['sequelize']['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')][_0x3ad5('0x21')]('id')),'ivrTotalCallsDays'],[db['sequelize']['fn'](_0x3ad5('0x25'),db[_0x3ad5('0x23')]['fn']('IF',db[_0x3ad5('0x23')][_0x3ad5('0x26')]('`state`\x20=\x204,\x201,\x20null'))),_0x3ad5('0x48')]],'group':[_0x3ad5('0x2f')]})[_0x3ad5('0xe')](function(_0x3ff478){logger[_0x3ad5('0xf')](_0x3ad5('0x47'),_0x53e2e7);logger['debug']('GetCampaignHopperHistory',_0x53e2e7,JSON[_0x3ad5('0x13')](_0x3ff478));_0x164115(_0x3ff478);})[_0x3ad5('0x46')](function(_0x2e109e){logger['error']('GetCampaignHopperHistory',_0x2e109e['message'],_0x53e2e7);_0x35038a(_0x10e0a2['error'](0x1f4,_0x2e109e['message']));});});}; \ No newline at end of file diff --git a/server/api/cmHopperHistory/index.js b/server/api/cmHopperHistory/index.js index dd7be62..b1a11eb 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 _0x972a=['create','multer','util','path','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','/:id','show'];(function(_0x31b588,_0x30b636){var _0xf4faae=function(_0x535ad7){while(--_0x535ad7){_0x31b588['push'](_0x31b588['shift']());}};_0xf4faae(++_0x30b636);}(_0x972a,0x15f));var _0xa972=function(_0x3e478c,_0x3afee8){_0x3e478c=_0x3e478c-0x0;var _0x3a0906=_0x972a[_0x3e478c];return _0x3a0906;};'use strict';var multer=require(_0xa972('0x0'));var util=require(_0xa972('0x1'));var path=require(_0xa972('0x2'));var timeout=require('connect-timeout');var express=require(_0xa972('0x3'));var router=express[_0xa972('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xa972('0x5'));var config=require(_0xa972('0x6'));var controller=require('./cmHopperHistory.controller');router[_0xa972('0x7')]('/',auth[_0xa972('0x8')](),controller[_0xa972('0x9')]);router[_0xa972('0x7')](_0xa972('0xa'),auth[_0xa972('0x8')](),controller['describe']);router[_0xa972('0x7')](_0xa972('0xb'),auth['isAuthenticated'](),controller[_0xa972('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0xa972('0xd')]);router['put'](_0xa972('0xb'),auth['isAuthenticated'](),controller['update']);module['exports']=router; \ No newline at end of file +var _0x290a=['/describe','describe','/:id','show','post','create','put','update','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmHopperHistory.controller','get','isAuthenticated','index'];(function(_0x20cc79,_0x50f705){var _0x538b4a=function(_0x1233a1){while(--_0x1233a1){_0x20cc79['push'](_0x20cc79['shift']());}};_0x538b4a(++_0x50f705);}(_0x290a,0xb1));var _0xa290=function(_0x131558,_0x316f2f){_0x131558=_0x131558-0x0;var _0x3dd22b=_0x290a[_0x131558];return _0x3dd22b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xa290('0x0'));var timeout=require(_0xa290('0x1'));var express=require(_0xa290('0x2'));var router=express[_0xa290('0x3')]();var fs_extra=require(_0xa290('0x4'));var auth=require(_0xa290('0x5'));var interaction=require(_0xa290('0x6'));var config=require(_0xa290('0x7'));var controller=require(_0xa290('0x8'));router[_0xa290('0x9')]('/',auth[_0xa290('0xa')](),controller[_0xa290('0xb')]);router[_0xa290('0x9')](_0xa290('0xc'),auth['isAuthenticated'](),controller[_0xa290('0xd')]);router[_0xa290('0x9')](_0xa290('0xe'),auth[_0xa290('0xa')](),controller[_0xa290('0xf')]);router[_0xa290('0x10')]('/',auth[_0xa290('0xa')](),controller[_0xa290('0x11')]);router[_0xa290('0x12')]('/:id',auth['isAuthenticated'](),controller[_0xa290('0x13')]);module[_0xa290('0x14')]=router; \ No newline at end of file diff --git a/server/api/cmList/cmList.attributes.js b/server/api/cmList/cmList.attributes.js index a134fee..5b32048 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 _0x4944=['name','sequelize','STRING'];(function(_0x134ba5,_0xbc52b7){var _0x4bfec9=function(_0x4e3cbd){while(--_0x4e3cbd){_0x134ba5['push'](_0x134ba5['shift']());}};_0x4bfec9(++_0xbc52b7);}(_0x4944,0x6d));var _0x4494=function(_0x567f86,_0x5d044a){_0x567f86=_0x567f86-0x0;var _0x292465=_0x4944[_0x567f86];return _0x292465;};'use strict';var Sequelize=require(_0x4494('0x0'));module['exports']={'name':{'type':Sequelize[_0x4494('0x1')],'unique':_0x4494('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0x4494('0x1')]},'dialPrefix':{'type':Sequelize[_0x4494('0x1')]}}; \ No newline at end of file +var _0xf961=['exports','STRING','name','sequelize'];(function(_0x2ff276,_0x4e31b5){var _0x394f24=function(_0x5c58c7){while(--_0x5c58c7){_0x2ff276['push'](_0x2ff276['shift']());}};_0x394f24(++_0x4e31b5);}(_0xf961,0x1cf));var _0x1f96=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xf961[_0x2faddb];return _0x273c05;};'use strict';var Sequelize=require(_0x1f96('0x0'));module[_0x1f96('0x1')]={'name':{'type':Sequelize[_0x1f96('0x2')],'unique':_0x1f96('0x3'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'dialPrefix':{'type':Sequelize[_0x1f96('0x2')]}}; \ No newline at end of file diff --git a/server/api/cmList/cmList.controller.js b/server/api/cmList/cmList.controller.js index c2259cd..063a756 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 _0x8173=['text','switch','defaultValue','addColumn','cm_contacts','cf_%s','getCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','User','getAgents','info','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','sox','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','defaults','redis','localhost','register','sendStatus','status','json','undefined','limit','offset','count','set','Content-Range','apply','update','then','get','Lists','destroy','end','error','stack','name','send','map','CmList','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','show','params','find','catch','create','body','user','role','UserProfileSection','autoAssociation','describe','addDisposition','ListId','Disposition','sort','removeDispositions','ids','CmContact','tags','isArray','join','push','each','omit','dataValues','errors','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','format','cf_%d','raw','getContactsCsv','alias','select','from','c.ListId\x20=\x20?','distinct','field','c.cf_','item','cm_contact_has_items','ItemTypeId\x20=\x20?','CmContactId\x20=\x20c.id','additionalPhone_','description','description_additionalPhone_','toString','isEmpty','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','attachment;\x20filename=','Content-type','text/csv','addCustomField','findOne','sequelize','transaction','addCustomFields','Sequelize','TEXT'];(function(_0x520b7d,_0x2e8af7){var _0x126417=function(_0x5dc428){while(--_0x5dc428){_0x520b7d['push'](_0x520b7d['shift']());}};_0x126417(++_0x2e8af7);}(_0x8173,0x1db));var _0x3817=function(_0x32d3df,_0x568cbf){_0x32d3df=_0x32d3df-0x0;var _0x44df15=_0x8173[_0x32d3df];return _0x44df15;};'use strict';var emlformat=require(_0x3817('0x0'));var rimraf=require(_0x3817('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3817('0x2'));var rp=require(_0x3817('0x3'));var moment=require(_0x3817('0x4'));var BPromise=require(_0x3817('0x5'));var Mustache=require('mustache');var util=require(_0x3817('0x6'));var path=require('path');var sox=require(_0x3817('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3817('0x8'));var _=require(_0x3817('0x9'));var squel=require(_0x3817('0xa'));var crypto=require('crypto');var jsforce=require(_0x3817('0xb'));var deskjs=require(_0x3817('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x3817('0xd'));var Redis=require(_0x3817('0xe'));var authService=require(_0x3817('0xf'));var qs=require(_0x3817('0x10'));var as=require(_0x3817('0x11'));var hardwareService=require(_0x3817('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x3817('0x13'));var config=require(_0x3817('0x14'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];var csv_results;config['redis']=_[_0x3817('0x15')](config[_0x3817('0x16')],{'host':_0x3817('0x17'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3817('0x16')]));require('./cmList.socket')[_0x3817('0x18')](socket);function respondWithStatusCode(_0x2c92ed,_0x55f24e){_0x55f24e=_0x55f24e||0xcc;return function(_0x52715b){if(_0x52715b){return _0x2c92ed[_0x3817('0x19')](_0x55f24e);}return _0x2c92ed[_0x3817('0x1a')](_0x55f24e)['end']();};}function respondWithResult(_0x155075,_0x32b14f){_0x32b14f=_0x32b14f||0xc8;return function(_0x313caf){if(_0x313caf){return _0x155075[_0x3817('0x1a')](_0x32b14f)[_0x3817('0x1b')](_0x313caf);}};}function respondWithFilteredResult(_0x347771,_0x5dbdc8){return function(_0x215d15){if(_0x215d15){var _0x5da442=typeof _0x5dbdc8['offset']===_0x3817('0x1c')&&typeof _0x5dbdc8[_0x3817('0x1d')]===_0x3817('0x1c');var _0x5bcb09=_0x215d15['count'];var _0x3534dc=_0x5da442?0x0:_0x5dbdc8[_0x3817('0x1e')];var _0x5999d9=_0x5da442?_0x215d15[_0x3817('0x1f')]:_0x5dbdc8[_0x3817('0x1e')]+_0x5dbdc8[_0x3817('0x1d')];var _0x33b216;if(_0x5999d9>=_0x5bcb09){_0x5999d9=_0x5bcb09;_0x33b216=0xc8;}else{_0x33b216=0xce;}_0x347771[_0x3817('0x1a')](_0x33b216);return _0x347771[_0x3817('0x20')](_0x3817('0x21'),_0x3534dc+'-'+_0x5999d9+'/'+_0x5bcb09)[_0x3817('0x1b')](_0x215d15);}return null;};}function patchUpdates(_0x21fa53){return function(_0x210767){try{jsonpatch[_0x3817('0x22')](_0x210767,_0x21fa53,!![]);}catch(_0x259b36){return BPromise['reject'](_0x259b36);}return _0x210767['save']();};}function saveUpdates(_0x43716d,_0x6b573f){return function(_0x1a6e1f){if(_0x1a6e1f){return _0x1a6e1f[_0x3817('0x23')](_0x43716d)[_0x3817('0x24')](function(_0x251cd7){return _0x251cd7;});}return null;};}function removeEntity(_0x39218b,_0x3cc099){return function(_0x1a40b5){if(_0x1a40b5){return _0x1a40b5['destroy']()[_0x3817('0x24')](function(){var _0x477d1c=_0x1a40b5[_0x3817('0x25')]({'plain':!![]});var _0x30bc7d=_0x3817('0x26');return db['UserProfileResource'][_0x3817('0x27')]({'where':{'type':_0x30bc7d,'resourceId':_0x477d1c['id']}})['then'](function(){return _0x1a40b5;});})[_0x3817('0x24')](function(){_0x39218b[_0x3817('0x1a')](0xcc)[_0x3817('0x28')]();});}};}function handleEntityNotFound(_0x1ea007,_0x4eab1b){return function(_0x5352eb){if(!_0x5352eb){_0x1ea007[_0x3817('0x19')](0x194);}return _0x5352eb;};}function handleError(_0x51157d,_0x449c05){_0x449c05=_0x449c05||0x1f4;return function(_0x237220){logger[_0x3817('0x29')](_0x237220[_0x3817('0x2a')]);if(_0x237220[_0x3817('0x2b')]){delete _0x237220[_0x3817('0x2b')];}_0x51157d[_0x3817('0x1a')](_0x449c05)[_0x3817('0x2c')](_0x237220);};}exports['index']=function(_0xad678c,_0x4ee0d1){var _0x142408={},_0x40f859={},_0x1a64f9={'count':0x0,'rows':[]};var _0x5d9a32=_[_0x3817('0x2d')](db[_0x3817('0x2e')][_0x3817('0x2f')],function(_0x25f6c3){return{'name':_0x25f6c3[_0x3817('0x30')],'type':_0x25f6c3['type']['key']};});_0x40f859[_0x3817('0x31')]=_[_0x3817('0x2d')](_0x5d9a32,_0x3817('0x2b'));_0x40f859[_0x3817('0x32')]=_[_0x3817('0x33')](_0xad678c['query']);_0x40f859[_0x3817('0x34')]=_[_0x3817('0x35')](_0x40f859[_0x3817('0x31')],_0x40f859['query']);_0x142408[_0x3817('0x36')]=_[_0x3817('0x35')](_0x40f859[_0x3817('0x31')],qs[_0x3817('0x37')](_0xad678c['query'][_0x3817('0x37')]));_0x142408[_0x3817('0x36')]=_0x142408[_0x3817('0x36')][_0x3817('0x38')]?_0x142408[_0x3817('0x36')]:_0x40f859[_0x3817('0x31')];if(!_0xad678c[_0x3817('0x32')][_0x3817('0x39')](_0x3817('0x3a'))){_0x142408[_0x3817('0x1d')]=qs[_0x3817('0x1d')](_0xad678c[_0x3817('0x32')][_0x3817('0x1d')]);_0x142408[_0x3817('0x1e')]=qs[_0x3817('0x1e')](_0xad678c[_0x3817('0x32')][_0x3817('0x1e')]);}_0x142408[_0x3817('0x3b')]=qs['sort'](_0xad678c[_0x3817('0x32')]['sort']);_0x142408[_0x3817('0x3c')]=qs[_0x3817('0x34')](_[_0x3817('0x3d')](_0xad678c['query'],_0x40f859[_0x3817('0x34')]),_0x5d9a32);if(_0xad678c['query'][_0x3817('0x3e')]){_0x142408[_0x3817('0x3c')]=_[_0x3817('0x3f')](_0x142408[_0x3817('0x3c')],{'$or':_[_0x3817('0x2d')](_0x5d9a32,function(_0xb4b578){if(_0xb4b578[_0x3817('0x40')]!==_0x3817('0x41')){var _0x1fc8fe={};_0x1fc8fe[_0xb4b578[_0x3817('0x2b')]]={'$like':'%'+_0xad678c['query'][_0x3817('0x3e')]+'%'};return _0x1fc8fe;}})});}_0x142408=_[_0x3817('0x3f')]({},_0x142408,_0xad678c[_0x3817('0x42')]);var _0xd4bbe3={'where':_0x142408['where']};return db[_0x3817('0x2e')][_0x3817('0x1f')](_0xd4bbe3)[_0x3817('0x24')](function(_0x1a4580){_0x1a64f9[_0x3817('0x1f')]=_0x1a4580;if(_0xad678c[_0x3817('0x32')][_0x3817('0x43')]){_0x142408[_0x3817('0x44')]=[{'all':!![]}];}return db[_0x3817('0x2e')][_0x3817('0x45')](_0x142408);})[_0x3817('0x24')](function(_0x5b9e73){_0x1a64f9[_0x3817('0x46')]=_0x5b9e73;return _0x1a64f9;})[_0x3817('0x24')](respondWithFilteredResult(_0x4ee0d1,_0x142408))['catch'](handleError(_0x4ee0d1,null));};exports[_0x3817('0x47')]=function(_0xb8e576,_0xa54361){var _0x532882={'raw':![],'where':{'id':_0xb8e576[_0x3817('0x48')]['id']}},_0x5eb9cc={};_0x5eb9cc[_0x3817('0x31')]=_[_0x3817('0x33')](db[_0x3817('0x2e')]['rawAttributes']);_0x5eb9cc['query']=_[_0x3817('0x33')](_0xb8e576[_0x3817('0x32')]);_0x5eb9cc['filters']=_[_0x3817('0x35')](_0x5eb9cc[_0x3817('0x31')],_0x5eb9cc['query']);_0x532882[_0x3817('0x36')]=_[_0x3817('0x35')](_0x5eb9cc[_0x3817('0x31')],qs[_0x3817('0x37')](_0xb8e576['query']['fields']));_0x532882[_0x3817('0x36')]=_0x532882['attributes'][_0x3817('0x38')]?_0x532882[_0x3817('0x36')]:_0x5eb9cc[_0x3817('0x31')];if(_0xb8e576[_0x3817('0x32')][_0x3817('0x43')]){_0x532882[_0x3817('0x44')]=[{'all':!![]}];}_0x532882=_[_0x3817('0x3f')]({},_0x532882,_0xb8e576[_0x3817('0x42')]);return db[_0x3817('0x2e')][_0x3817('0x49')](_0x532882)[_0x3817('0x24')](handleEntityNotFound(_0xa54361,null))[_0x3817('0x24')](respondWithResult(_0xa54361,null))[_0x3817('0x4a')](handleError(_0xa54361,null));};exports['create']=function(_0x10d6cd,_0x496c28){return db[_0x3817('0x2e')][_0x3817('0x4b')](_0x10d6cd[_0x3817('0x4c')],{})[_0x3817('0x24')](function(_0x2ca7b3){var _0x3ef384=_0x10d6cd[_0x3817('0x4d')]['get']({'plain':!![]});if(!_0x3ef384)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x3ef384[_0x3817('0x4e')]===_0x3817('0x4d')){var _0x426482=_0x2ca7b3['get']({'plain':!![]});var _0x9b64d6=_0x3817('0x26');return db[_0x3817('0x4f')][_0x3817('0x49')]({'where':{'name':_0x9b64d6,'userProfileId':_0x3ef384['userProfileId']},'raw':!![]})['then'](function(_0x22f651){if(_0x22f651&&_0x22f651[_0x3817('0x50')]===0x0){return db['UserProfileResource'][_0x3817('0x4b')]({'name':_0x426482['name'],'resourceId':_0x426482['id'],'type':_0x22f651[_0x3817('0x2b')],'sectionId':_0x22f651['id']},{})[_0x3817('0x24')](function(){return _0x2ca7b3;});}else{return _0x2ca7b3;}})['catch'](function(_0x2bdc7d){logger[_0x3817('0x29')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2bdc7d);throw _0x2bdc7d;});}return _0x2ca7b3;})[_0x3817('0x24')](respondWithResult(_0x496c28,0xc9))['catch'](handleError(_0x496c28,null));};exports[_0x3817('0x23')]=function(_0x9bec4e,_0x56f767){if(_0x9bec4e[_0x3817('0x4c')]['id']){delete _0x9bec4e[_0x3817('0x4c')]['id'];}return db[_0x3817('0x2e')][_0x3817('0x49')]({'where':{'id':_0x9bec4e[_0x3817('0x48')]['id']}})['then'](handleEntityNotFound(_0x56f767,null))[_0x3817('0x24')](saveUpdates(_0x9bec4e[_0x3817('0x4c')],null))[_0x3817('0x24')](respondWithResult(_0x56f767,null))[_0x3817('0x4a')](handleError(_0x56f767,null));};exports[_0x3817('0x27')]=function(_0x5c2104,_0x4157b0){return db[_0x3817('0x2e')][_0x3817('0x49')]({'where':{'id':_0x5c2104[_0x3817('0x48')]['id']}})[_0x3817('0x24')](handleEntityNotFound(_0x4157b0,null))[_0x3817('0x24')](removeEntity(_0x4157b0,null))[_0x3817('0x4a')](handleError(_0x4157b0,null));};exports[_0x3817('0x51')]=function(_0xbadc28,_0x10f8e9){return db['CmList'][_0x3817('0x51')]()[_0x3817('0x24')](respondWithResult(_0x10f8e9,null))[_0x3817('0x4a')](handleError(_0x10f8e9,null));};exports[_0x3817('0x52')]=function(_0x3f4251,_0x180d23,_0xad37fd){if(_0x3f4251[_0x3817('0x4c')]['id']){delete _0x3f4251[_0x3817('0x4c')]['id'];}return db[_0x3817('0x2e')]['find']({'where':{'id':_0x3f4251[_0x3817('0x48')]['id']}})['then'](handleEntityNotFound(_0x180d23,null))['then'](function(_0x4055d0){if(_0x4055d0){_0x3f4251['body'][_0x3817('0x53')]=_0x4055d0['id'];return db['Disposition'][_0x3817('0x4b')](_0x3f4251[_0x3817('0x4c')]);}})[_0x3817('0x24')](respondWithResult(_0x180d23,null))[_0x3817('0x4a')](handleError(_0x180d23,null));};exports['getDispositions']=function(_0x106185,_0x5175eb,_0x3f100f){var _0x5216f8={'raw':![],'where':{}};var _0x4137a0={};var _0x156984={'count':0x0,'rows':[]};return db[_0x3817('0x2e')]['findOne']({'where':{'id':_0x106185[_0x3817('0x48')]['id']}})['then'](handleEntityNotFound(_0x5175eb,null))[_0x3817('0x24')](function(_0x3fefc7){if(_0x3fefc7){_0x4137a0[_0x3817('0x31')]=_['keys'](db[_0x3817('0x54')][_0x3817('0x2f')]);_0x4137a0[_0x3817('0x32')]=_['keys'](_0x106185['query']);_0x4137a0[_0x3817('0x34')]=_[_0x3817('0x35')](_0x4137a0[_0x3817('0x31')],_0x4137a0['query']);_0x5216f8['attributes']=_['intersection'](_0x4137a0[_0x3817('0x31')],qs[_0x3817('0x37')](_0x106185['query'][_0x3817('0x37')]));_0x5216f8['attributes']=_0x5216f8['attributes'][_0x3817('0x38')]?_0x5216f8[_0x3817('0x36')]:_0x4137a0[_0x3817('0x31')];if(!_0x106185[_0x3817('0x32')]['hasOwnProperty']('nolimit')){_0x5216f8[_0x3817('0x1d')]=qs[_0x3817('0x1d')](_0x106185['query'][_0x3817('0x1d')]);_0x5216f8[_0x3817('0x1e')]=qs[_0x3817('0x1e')](_0x106185[_0x3817('0x32')][_0x3817('0x1e')]);}_0x5216f8[_0x3817('0x3b')]=qs['sort'](_0x106185[_0x3817('0x32')][_0x3817('0x55')]);_0x5216f8[_0x3817('0x3c')]=qs[_0x3817('0x34')](_[_0x3817('0x3d')](_0x106185['query'],_0x4137a0['filters']));_0x5216f8['where'][_0x3817('0x53')]=_0x3fefc7['id'];if(_0x106185[_0x3817('0x32')][_0x3817('0x3e')]){_0x5216f8['where']=_['merge'](_0x5216f8[_0x3817('0x3c')],{'$or':_[_0x3817('0x2d')](_0x5216f8[_0x3817('0x36')],function(_0x2cbe24){var _0x37c9de={};_0x37c9de[_0x2cbe24]={'$like':'%'+_0x106185[_0x3817('0x32')][_0x3817('0x3e')]+'%'};return _0x37c9de;})});}_0x5216f8=_[_0x3817('0x3f')]({},_0x5216f8,_0x106185[_0x3817('0x42')]);return db[_0x3817('0x54')][_0x3817('0x1f')]({'where':_0x5216f8[_0x3817('0x3c')]})[_0x3817('0x24')](function(_0x241b6a){_0x156984[_0x3817('0x1f')]=_0x241b6a;if(_0x106185[_0x3817('0x32')]['includeAll']){_0x5216f8[_0x3817('0x44')]=[{'all':!![]}];}return db[_0x3817('0x54')][_0x3817('0x45')](_0x5216f8);})[_0x3817('0x24')](function(_0x331ea7){_0x156984[_0x3817('0x46')]=_0x331ea7;return _0x156984;});}})[_0x3817('0x24')](respondWithFilteredResult(_0x5175eb,_0x5216f8))[_0x3817('0x4a')](handleError(_0x5175eb,null));};exports[_0x3817('0x56')]=function(_0x36c671,_0x2b72b9,_0x97bfb){return db[_0x3817('0x2e')]['find']({'where':{'id':_0x36c671[_0x3817('0x48')]['id']}})[_0x3817('0x24')](handleEntityNotFound(_0x2b72b9,null))['then'](function(_0x556098){if(_0x556098){return _0x556098[_0x3817('0x56')](_0x36c671['query'][_0x3817('0x57')]);}})[_0x3817('0x24')](respondWithStatusCode(_0x2b72b9,null))['catch'](handleError(_0x2b72b9,null));};exports['addContacts']=function(_0x471364,_0x32ec41,_0x26f9bc){return db[_0x3817('0x2e')][_0x3817('0x49')]({'where':{'id':_0x471364[_0x3817('0x48')]['id']}})[_0x3817('0x24')](handleEntityNotFound(_0x32ec41,null))[_0x3817('0x24')](function(_0x2e40e8){if(_0x2e40e8){var _0x96851b=[];var _0x5a47da={'success':[],'errors':[]};return db[_0x3817('0x58')][_0x3817('0x51')]()[_0x3817('0x24')](function(_0x1e97d5){if(_0x471364[_0x3817('0x4c')][_0x3817('0x59')]&&_[_0x3817('0x5a')](_0x471364[_0x3817('0x4c')][_0x3817('0x59')])){if(_0x471364[_0x3817('0x4c')][_0x3817('0x59')][_0x3817('0x38')]){_0x471364['body']['tags']=_0x471364[_0x3817('0x4c')]['tags'][_0x3817('0x5b')](';')+';';}else{_0x471364[_0x3817('0x4c')][_0x3817('0x59')]=null;}}else{_0x471364['body'][_0x3817('0x59')]=null;}if(_0x471364['body']&&_['isArray'](_0x471364[_0x3817('0x4c')])){for(var _0x35b885=0x0;_0x35b885<_0x471364['body'][_0x3817('0x38')];_0x35b885+=0x1){_0x471364[_0x3817('0x4c')][_0x35b885]['ListId']=_0x471364[_0x3817('0x48')]['id'];_0x96851b[_0x3817('0x5c')](_0x471364[_0x3817('0x4c')][_0x35b885]);}return BPromise[_0x3817('0x5d')](_0x96851b,function(_0x332134){return db[_0x3817('0x58')][_0x3817('0x4b')](_[_0x3817('0x5e')](_0x332134,['ids','id'])||{},{'fields':_[_0x3817('0x33')](_0x1e97d5),'raw':!![]})[_0x3817('0x24')](function(_0x5f56dd){_0x5a47da['success'][_0x3817('0x5c')](_0x5f56dd[_0x3817('0x5f')]);})['catch'](function(_0x4c9b0e){_0x5a47da[_0x3817('0x60')][_0x3817('0x5c')]({'data':_0x332134,'error':_0x4c9b0e[_0x3817('0x61')]});});})['then'](function(_0x42c98b){return _0x5a47da;})[_0x3817('0x4a')](function(_0x59407a){return _0x59407a;});}else{_0x32ec41[_0x3817('0x1a')](0x190)[_0x3817('0x1b')]({'message':_0x3817('0x62')});}});}})['then'](respondWithResult(_0x32ec41,null))[_0x3817('0x4a')](handleError(_0x32ec41,null));};exports[_0x3817('0x63')]=function(_0x2a04c0,_0x21c92c,_0x5ee543){var _0x5a6adb;return db['CmList'][_0x3817('0x49')]({'where':{'id':_0x2a04c0['params']['id']},'include':[{'model':db[_0x3817('0x64')],'as':_0x3817('0x65')}]})[_0x3817('0x24')](handleEntityNotFound(_0x21c92c,null))[_0x3817('0x24')](function(_0x584471){if(_0x584471){_0x5a6adb=_0x584471;return db[_0x3817('0x58')][_0x3817('0x2f')];}})[_0x3817('0x24')](function(_0x47964d){if(_0x47964d){var _0x141752={};var _0x22e086={};_0x22e086[_0x3817('0x31')]=_[_0x3817('0x66')](_[_0x3817('0x33')](_0x47964d),_[_0x3817('0x2d')](_0x5a6adb[_0x3817('0x65')],function(_0x34c0d1){return util[_0x3817('0x67')](_0x3817('0x68'),_0x34c0d1['id']);}));_0x22e086[_0x3817('0x32')]=_['keys'](_0x2a04c0['query']);_0x22e086[_0x3817('0x34')]=_[_0x3817('0x35')](_0x22e086[_0x3817('0x31')],_0x22e086[_0x3817('0x32')]);_0x141752['attributes']=_[_0x3817('0x35')](_0x22e086[_0x3817('0x31')],qs[_0x3817('0x37')](_0x2a04c0['query']['fields']));_0x141752[_0x3817('0x36')]=_0x141752[_0x3817('0x36')][_0x3817('0x38')]?_0x141752[_0x3817('0x36')]:_0x22e086['model'];if(!_0x2a04c0[_0x3817('0x32')][_0x3817('0x39')]('nolimit')){_0x141752[_0x3817('0x1d')]=qs['limit'](_0x2a04c0[_0x3817('0x32')][_0x3817('0x1d')]);_0x141752[_0x3817('0x1e')]=qs['offset'](_0x2a04c0[_0x3817('0x32')][_0x3817('0x1e')]);}_0x141752[_0x3817('0x3b')]=qs[_0x3817('0x55')](_0x2a04c0[_0x3817('0x32')][_0x3817('0x55')]);_0x141752[_0x3817('0x3c')]=qs[_0x3817('0x34')](_[_0x3817('0x3d')](_0x2a04c0[_0x3817('0x32')],_0x22e086[_0x3817('0x34')]));_0x141752[_0x3817('0x69')]=!![];if(_0x2a04c0[_0x3817('0x32')][_0x3817('0x3e')]){_0x141752['where']=_[_0x3817('0x3f')](_0x141752[_0x3817('0x3c')],{'$or':_[_0x3817('0x2d')](_0x141752[_0x3817('0x36')],function(_0x2b0324){var _0x329f25={};_0x329f25[_0x2b0324]={'$like':'%'+_0x2a04c0[_0x3817('0x32')][_0x3817('0x3e')]+'%'};return _0x329f25;})});}_0x141752=_['merge']({},_0x141752,_0x2a04c0[_0x3817('0x42')]);return _0x5a6adb[_0x3817('0x63')](_0x141752);}})[_0x3817('0x24')](respondWithResult(_0x21c92c,null))['catch'](handleError(_0x21c92c,null));};exports[_0x3817('0x6a')]=function(_0x52ec7d,_0x1978bc,_0x344db9){var _0xbb64dd;var _0x64db3e;var _0x2b6ada;var _0x481746=_0x52ec7d[_0x3817('0x48')]['id'];csv_results=[];return db['ContactItemType'][_0x3817('0x45')]({'attributes':['id',_0x3817('0x2b')],'raw':!![],'order':['OrderBy']})['then'](function(_0x5e4be0){_0xbb64dd=_0x5e4be0;var _0x5c8f09=_[_0x3817('0x33')](db[_0x3817('0x58')]['rawAttributes']);return db[_0x3817('0x64')]['findAll']({'raw':!![],'attributes':['id',_0x3817('0x6b')]})[_0x3817('0x24')](function(_0x362f7a){_0x64db3e=_0x362f7a;var _0x221c5a=squel[_0x3817('0x6c')]()[_0x3817('0x37')](_0x5c8f09)[_0x3817('0x6d')]('cm_contacts','c')[_0x3817('0x3c')](_0x3817('0x6e'),_0x481746)['where']('c.deletedAt\x20is\x20null')[_0x3817('0x6f')]();for(var _0x21f274=0x0;_0x21f274<_0x64db3e[_0x3817('0x38')];_0x21f274++){_0x221c5a[_0x3817('0x70')](_0x3817('0x71')+_0x64db3e[_0x21f274]['id'],'customField_'+_0x64db3e[_0x21f274]['alias']);}for(var _0x21f274=0x0;_0x21f274<_0xbb64dd[_0x3817('0x38')];_0x21f274++){_0x221c5a['field'](squel[_0x3817('0x6c')]()[_0x3817('0x70')](_0x3817('0x72'))[_0x3817('0x6d')](_0x3817('0x73'))[_0x3817('0x3c')](_0x3817('0x74'),_0xbb64dd[_0x21f274]['id'])[_0x3817('0x3c')](_0x3817('0x75')),_0x3817('0x76')+_0xbb64dd[_0x21f274][_0x3817('0x2b')]);_0x221c5a[_0x3817('0x70')](squel['select']()['field'](_0x3817('0x77'))[_0x3817('0x6d')](_0x3817('0x73'))[_0x3817('0x3c')]('ItemTypeId\x20=\x20?',_0xbb64dd[_0x21f274]['id'])[_0x3817('0x3c')](_0x3817('0x75')),_0x3817('0x78')+_0xbb64dd[_0x21f274][_0x3817('0x2b')]);}var _0x317253=[];_0x317253[_0x3817('0x5c')](_0x221c5a[_0x3817('0x79')]());BPromise[_0x3817('0x5d')](_0x317253,handleQuery)[_0x3817('0x24')](function(_0x18bee6){handleQuery(_0x221c5a['toString']());var _0x4509df=csv_results[0x0];if(!_[_0x3817('0x7a')](_0x4509df)){var _0x5c39d3=toCsv(_0x4509df);var _0x45d604=Date['now']();fs[_0x3817('0x7b')](util['format'](_0x3817('0x7c'),_0x481746,_0x45d604),_0x5c39d3);_0x1978bc[_0x3817('0x7d')](_0x3817('0x7e'),_0x3817('0x7f')+util[_0x3817('0x67')]('list_%d_%s.csv',_0x481746,_0x45d604));_0x1978bc['setHeader'](_0x3817('0x80'),_0x3817('0x81'));return _0x1978bc['download'](util[_0x3817('0x67')](_0x3817('0x7c'),_0x481746,_0x45d604));}else{return _0x1978bc[_0x3817('0x19')](0xcc);}});});});};exports[_0x3817('0x82')]=function(_0x2aa983,_0x4c745c,_0x4cf30b){var _0x14682b;delete _0x2aa983[_0x3817('0x4c')]['id'];return db['CmList'][_0x3817('0x83')]({'where':{'id':_0x2aa983[_0x3817('0x48')]['id']}})[_0x3817('0x24')](handleEntityNotFound(_0x4c745c,null))['then'](function(_0x516545){if(_0x516545){return db[_0x3817('0x84')][_0x3817('0x85')](function(_0x35fc57){return db[_0x3817('0x64')]['create'](_0x2aa983[_0x3817('0x4c')],{'transaction':_0x35fc57})[_0x3817('0x24')](function(_0x28b7aa){_0x14682b=_0x28b7aa;return _0x516545[_0x3817('0x86')](_0x28b7aa,{'transaction':_0x35fc57});})['then'](function(){var _0xee5608={'type':db[_0x3817('0x87')][_0x3817('0x88')],'transaction':_0x35fc57};switch(_0x2aa983[_0x3817('0x4c')][_0x3817('0x40')]){case _0x3817('0x89'):_0xee5608[_0x3817('0x40')]=db[_0x3817('0x87')]['TEXT'];break;case'number':_0xee5608[_0x3817('0x40')]=db[_0x3817('0x87')]['INTEGER'];break;case _0x3817('0x8a'):_0xee5608[_0x3817('0x40')]=db['Sequelize']['BOOLEAN'];_0xee5608[_0x3817('0x8b')]=![];break;default:}return db[_0x3817('0x84')]['queryInterface'][_0x3817('0x8c')](_0x3817('0x8d'),util['format'](_0x3817('0x8e'),_0x14682b['id']),_0xee5608);})[_0x3817('0x24')](function(){return _0x14682b;});});}})[_0x3817('0x24')](respondWithResult(_0x4c745c,null))[_0x3817('0x4a')](handleError(_0x4c745c,null));};exports[_0x3817('0x8f')]=function(_0x1ef8f9,_0x4510fc,_0x1f40f3){var _0x416a25={};var _0x263d56={};var _0x3e8489;var _0x3f5424;return db['CmList'][_0x3817('0x83')]({'where':{'id':_0x1ef8f9[_0x3817('0x48')]['id']}})[_0x3817('0x24')](handleEntityNotFound(_0x4510fc,null))[_0x3817('0x24')](function(_0xe321e4){if(_0xe321e4){_0x3e8489=_0xe321e4;_0x263d56[_0x3817('0x31')]=_['keys'](db[_0x3817('0x64')][_0x3817('0x2f')]);_0x263d56['query']=_[_0x3817('0x33')](_0x1ef8f9[_0x3817('0x32')]);_0x263d56[_0x3817('0x34')]=_['intersection'](_0x263d56[_0x3817('0x31')],_0x263d56[_0x3817('0x32')]);_0x416a25[_0x3817('0x36')]=_[_0x3817('0x35')](_0x263d56[_0x3817('0x31')],qs[_0x3817('0x37')](_0x1ef8f9[_0x3817('0x32')][_0x3817('0x37')]));_0x416a25[_0x3817('0x36')]=_0x416a25[_0x3817('0x36')][_0x3817('0x38')]?_0x416a25[_0x3817('0x36')]:_0x263d56[_0x3817('0x31')];_0x416a25['order']=qs['sort'](_0x1ef8f9[_0x3817('0x32')][_0x3817('0x55')]);_0x416a25[_0x3817('0x3c')]=qs[_0x3817('0x34')](_[_0x3817('0x3d')](_0x1ef8f9[_0x3817('0x32')],_0x263d56[_0x3817('0x34')]));_0x416a25[_0x3817('0x3c')]=_['merge'](_0x416a25['where'],{'$or':[{'ListId':_0xe321e4['id']},{'ListId':null}]});if(_0x1ef8f9[_0x3817('0x32')][_0x3817('0x3e')]){_0x416a25['where']=_['merge'](_0x416a25[_0x3817('0x3c')],{'$or':_[_0x3817('0x2d')](_0x416a25[_0x3817('0x36')],function(_0x14f4a4){var _0x104952={};_0x104952[_0x14f4a4]={'$like':'%'+_0x1ef8f9[_0x3817('0x32')][_0x3817('0x3e')]+'%'};return _0x104952;})});}_0x416a25=_[_0x3817('0x3f')]({},_0x416a25,_0x1ef8f9[_0x3817('0x42')]);return db[_0x3817('0x64')]['findAndCountAll'](_0x416a25);}})[_0x3817('0x24')](respondWithResult(_0x4510fc,null))[_0x3817('0x4a')](handleError(_0x4510fc,null));};exports['getGlobalCustomFields']=function(_0x2e30e8,_0x418945){return db[_0x3817('0x64')]['findAndCountAll']({'where':{'ListId':null}})[_0x3817('0x24')](handleEntityNotFound(_0x418945,null))[_0x3817('0x24')](function(_0x3f2f5b){return _0x3f2f5b;})[_0x3817('0x24')](respondWithResult(_0x418945,null))[_0x3817('0x4a')](handleError(_0x418945,null));};exports[_0x3817('0x90')]=function(_0x5e126b,_0x4f6cbc,_0x1ecbb3){return db[_0x3817('0x2e')][_0x3817('0x49')]({'where':{'id':_0x5e126b[_0x3817('0x48')]['id']}})[_0x3817('0x24')](handleEntityNotFound(_0x4f6cbc,null))[_0x3817('0x24')](function(_0x4515be){if(_0x4515be){return _0x4515be['addAgents'](_0x5e126b[_0x3817('0x4c')]['ids'],_[_0x3817('0x5e')](_0x5e126b[_0x3817('0x4c')],[_0x3817('0x57'),'id'])||{})[_0x3817('0x91')](function(_0x4960e3){for(var _0x32fc22=0x0;_0x32fc22<_0x5e126b[_0x3817('0x4c')][_0x3817('0x57')][_0x3817('0x38')];_0x32fc22+=0x1){socket[_0x3817('0x92')](_0x3817('0x93'),{'UserId':Number(_0x5e126b['body'][_0x3817('0x57')][_0x32fc22]),'CmListId':Number(_0x5e126b[_0x3817('0x48')]['id'])});}return _0x4960e3;});}})['then'](respondWithResult(_0x4f6cbc,null))[_0x3817('0x4a')](handleError(_0x4f6cbc,null));};exports[_0x3817('0x94')]=function(_0x2ba99f,_0x480d9d,_0x52f980){return db[_0x3817('0x2e')][_0x3817('0x49')]({'where':{'id':_0x2ba99f[_0x3817('0x48')]['id']}})[_0x3817('0x24')](handleEntityNotFound(_0x480d9d,null))[_0x3817('0x24')](function(_0x231e7e){if(_0x231e7e){return _0x231e7e['removeAgents'](_0x2ba99f['query']['ids'])[_0x3817('0x24')](function(){if(_['isArray'](_0x2ba99f[_0x3817('0x32')]['ids'])){for(var _0x4e07a0=0x0;_0x4e07a0<_0x2ba99f[_0x3817('0x32')]['ids'][_0x3817('0x38')];_0x4e07a0+=0x1){socket[_0x3817('0x92')](_0x3817('0x95'),{'UserId':Number(_0x2ba99f[_0x3817('0x32')][_0x3817('0x57')][_0x4e07a0]),'CmListId':Number(_0x2ba99f[_0x3817('0x48')]['id'])});}}else{socket[_0x3817('0x92')]('userCmList:remove',{'UserId':Number(_0x2ba99f['query'][_0x3817('0x57')]),'CmListId':Number(_0x2ba99f[_0x3817('0x48')]['id'])});}});}})[_0x3817('0x24')](respondWithStatusCode(_0x480d9d,null))[_0x3817('0x4a')](handleError(_0x480d9d,null));};exports['getAgents']=function(_0x149c20,_0x2924ab,_0x290d82){var _0x92e8ed={};var _0x51d86e={};var _0x356ce1;var _0x2db158;return db[_0x3817('0x2e')][_0x3817('0x83')]({'where':{'id':_0x149c20[_0x3817('0x48')]['id']}})[_0x3817('0x24')](handleEntityNotFound(_0x2924ab,null))[_0x3817('0x24')](function(_0x48b236){if(_0x48b236){_0x356ce1=_0x48b236;_0x51d86e['model']=_['keys'](db[_0x3817('0x96')][_0x3817('0x2f')]);_0x51d86e['query']=_[_0x3817('0x33')](_0x149c20['query']);_0x51d86e[_0x3817('0x34')]=_['intersection'](_0x51d86e[_0x3817('0x31')],_0x51d86e[_0x3817('0x32')]);_0x92e8ed['attributes']=_[_0x3817('0x35')](_0x51d86e[_0x3817('0x31')],qs[_0x3817('0x37')](_0x149c20[_0x3817('0x32')]['fields']));_0x92e8ed['attributes']=_0x92e8ed[_0x3817('0x36')][_0x3817('0x38')]?_0x92e8ed[_0x3817('0x36')]:_0x51d86e['model'];_0x92e8ed['order']=qs[_0x3817('0x55')](_0x149c20[_0x3817('0x32')][_0x3817('0x55')]);_0x92e8ed['where']=qs['filters'](_[_0x3817('0x3d')](_0x149c20['query'],_0x51d86e[_0x3817('0x34')]));if(_0x149c20[_0x3817('0x32')][_0x3817('0x3e')]){_0x92e8ed[_0x3817('0x3c')]=_['merge'](_0x92e8ed[_0x3817('0x3c')],{'$or':_[_0x3817('0x2d')](_0x92e8ed[_0x3817('0x36')],function(_0x4bf4db){var _0x56f409={};_0x56f409[_0x4bf4db]={'$like':'%'+_0x149c20[_0x3817('0x32')][_0x3817('0x3e')]+'%'};return _0x56f409;})});}_0x92e8ed=_[_0x3817('0x3f')]({},_0x92e8ed,_0x149c20[_0x3817('0x42')]);return _0x356ce1[_0x3817('0x97')](_0x92e8ed);}})[_0x3817('0x24')](function(_0x540a5a){if(_0x540a5a){_0x2db158=_0x540a5a[_0x3817('0x38')];if(!_0x149c20[_0x3817('0x32')][_0x3817('0x39')](_0x3817('0x3a'))){_0x92e8ed[_0x3817('0x1d')]=qs['limit'](_0x149c20[_0x3817('0x32')]['limit']);_0x92e8ed['offset']=qs[_0x3817('0x1e')](_0x149c20[_0x3817('0x32')][_0x3817('0x1e')]);}return _0x356ce1['getAgents'](_0x92e8ed);}})['then'](function(_0x510622){if(_0x510622){return _0x510622?{'count':_0x2db158,'rows':_0x510622}:null;}})['then'](respondWithResult(_0x2924ab,null))[_0x3817('0x4a')](handleError(_0x2924ab,null));};function handleQuery(_0x36477a){logger[_0x3817('0x98')](_0x36477a);return db['sequelize'][_0x3817('0x32')](_0x36477a)[_0x3817('0x91')](function(_0x233e2c){csv_results[_0x3817('0x5c')](_0x233e2c);})[_0x3817('0x4a')](function(_0x20e570){logger[_0x3817('0x29')](_0x20e570['message']);});} \ No newline at end of file +var _0xead9=['toString','isEmpty','now','writeFileSync','/tmp/list_%d_%s.csv','setHeader','Content-disposition','format','list_%d_%s.csv','Content-type','text/csv','download','sendStatus','addCustomField','sequelize','transaction','addCustomFields','Sequelize','TEXT','type','number','INTEGER','defaultValue','cf_%s','getCustomFields','getGlobalCustomFields','addAgents','spread','emit','userCmList:save','removeAgents','userCmList:remove','getAgents','User','info','eml-format','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','defaults','socket.io-emitter','redis','./cmList.socket','register','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','Lists','UserProfileResource','then','error','stack','name','send','index','map','CmList','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','includeAll','findAll','catch','params','keys','include','options','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','describe','addDisposition','ListId','Disposition','findOne','rows','removeDispositions','ids','CmContact','tags','isArray','join','each','omit','success','push','dataValues','message','Malformed\x20request\x20syntax','getContacts','CmCustomField','CustomFields','concat','cf_%d','getContactsCsv','alias','cm_contacts','c.ListId\x20=\x20?','c.deletedAt\x20is\x20null','distinct','field','c.cf_','select','item','from','cm_contact_has_items','ItemTypeId\x20=\x20?','additionalPhone_','description','CmContactId\x20=\x20c.id'];(function(_0x23b0de,_0x46e409){var _0x3ffd9a=function(_0x344bf9){while(--_0x344bf9){_0x23b0de['push'](_0x23b0de['shift']());}};_0x3ffd9a(++_0x46e409);}(_0xead9,0xc4));var _0x9ead=function(_0x382c3c,_0x24aaa5){_0x382c3c=_0x382c3c-0x0;var _0xca4a6=_0xead9[_0x382c3c];return _0xca4a6;};'use strict';var emlformat=require(_0x9ead('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9ead('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9ead('0x2'));var moment=require('moment');var BPromise=require(_0x9ead('0x3'));var Mustache=require('mustache');var util=require(_0x9ead('0x4'));var path=require(_0x9ead('0x5'));var sox=require(_0x9ead('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x9ead('0x7'));var _=require(_0x9ead('0x8'));var squel=require(_0x9ead('0x9'));var crypto=require(_0x9ead('0xa'));var jsforce=require(_0x9ead('0xb'));var deskjs=require(_0x9ead('0xc'));var toCsv=require(_0x9ead('0xd'));var querystring=require(_0x9ead('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9ead('0xf'));var as=require(_0x9ead('0x10'));var hardwareService=require(_0x9ead('0x11'));var logger=require(_0x9ead('0x12'))('api');var utils=require(_0x9ead('0x13'));var config=require(_0x9ead('0x14'));var licenseUtil=require(_0x9ead('0x15'));var db=require('../../mysqldb')['db'];var csv_results;config['redis']=_[_0x9ead('0x16')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x9ead('0x17'))(new Redis(config[_0x9ead('0x18')]));require(_0x9ead('0x19'))[_0x9ead('0x1a')](socket);function respondWithStatusCode(_0xa05ca9,_0x10b908){_0x10b908=_0x10b908||0xcc;return function(_0x5e6cd4){if(_0x5e6cd4){return _0xa05ca9['sendStatus'](_0x10b908);}return _0xa05ca9[_0x9ead('0x1b')](_0x10b908)[_0x9ead('0x1c')]();};}function respondWithResult(_0x511756,_0x3847a0){_0x3847a0=_0x3847a0||0xc8;return function(_0x4223d3){if(_0x4223d3){return _0x511756[_0x9ead('0x1b')](_0x3847a0)[_0x9ead('0x1d')](_0x4223d3);}};}function respondWithFilteredResult(_0x442622,_0x4f6c73){return function(_0x1121c0){if(_0x1121c0){var _0x165b5f=typeof _0x4f6c73[_0x9ead('0x1e')]===_0x9ead('0x1f')&&typeof _0x4f6c73['limit']===_0x9ead('0x1f');var _0xb76543=_0x1121c0[_0x9ead('0x20')];var _0x298c7b=_0x165b5f?0x0:_0x4f6c73[_0x9ead('0x1e')];var _0x17245c=_0x165b5f?_0x1121c0[_0x9ead('0x20')]:_0x4f6c73['offset']+_0x4f6c73[_0x9ead('0x21')];var _0x937f3a;if(_0x17245c>=_0xb76543){_0x17245c=_0xb76543;_0x937f3a=0xc8;}else{_0x937f3a=0xce;}_0x442622['status'](_0x937f3a);return _0x442622[_0x9ead('0x22')](_0x9ead('0x23'),_0x298c7b+'-'+_0x17245c+'/'+_0xb76543)[_0x9ead('0x1d')](_0x1121c0);}return null;};}function patchUpdates(_0x2dd223){return function(_0x24c939){try{jsonpatch[_0x9ead('0x24')](_0x24c939,_0x2dd223,!![]);}catch(_0x2acac3){return BPromise[_0x9ead('0x25')](_0x2acac3);}return _0x24c939[_0x9ead('0x26')]();};}function saveUpdates(_0x1ca32a,_0x119519){return function(_0x204655){if(_0x204655){return _0x204655['update'](_0x1ca32a)['then'](function(_0x37e364){return _0x37e364;});}return null;};}function removeEntity(_0x2cf734,_0x172d68){return function(_0x50c598){if(_0x50c598){return _0x50c598['destroy']()['then'](function(){var _0x111471=_0x50c598['get']({'plain':!![]});var _0x545a88=_0x9ead('0x27');return db[_0x9ead('0x28')]['destroy']({'where':{'type':_0x545a88,'resourceId':_0x111471['id']}})[_0x9ead('0x29')](function(){return _0x50c598;});})['then'](function(){_0x2cf734['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b322f,_0x3e569b){return function(_0x1f916c){if(!_0x1f916c){_0x5b322f['sendStatus'](0x194);}return _0x1f916c;};}function handleError(_0x406af6,_0x14f395){_0x14f395=_0x14f395||0x1f4;return function(_0x2bf360){logger[_0x9ead('0x2a')](_0x2bf360[_0x9ead('0x2b')]);if(_0x2bf360[_0x9ead('0x2c')]){delete _0x2bf360['name'];}_0x406af6[_0x9ead('0x1b')](_0x14f395)[_0x9ead('0x2d')](_0x2bf360);};}exports[_0x9ead('0x2e')]=function(_0xc109e9,_0x1ba82f){var _0x3900d8={},_0x8d30e0={},_0xa43b5b={'count':0x0,'rows':[]};var _0x13bbc5=_[_0x9ead('0x2f')](db[_0x9ead('0x30')][_0x9ead('0x31')],function(_0x20ce30){return{'name':_0x20ce30[_0x9ead('0x32')],'type':_0x20ce30['type'][_0x9ead('0x33')]};});_0x8d30e0[_0x9ead('0x34')]=_[_0x9ead('0x2f')](_0x13bbc5,_0x9ead('0x2c'));_0x8d30e0[_0x9ead('0x35')]=_['keys'](_0xc109e9[_0x9ead('0x35')]);_0x8d30e0[_0x9ead('0x36')]=_[_0x9ead('0x37')](_0x8d30e0['model'],_0x8d30e0[_0x9ead('0x35')]);_0x3900d8[_0x9ead('0x38')]=_[_0x9ead('0x37')](_0x8d30e0[_0x9ead('0x34')],qs[_0x9ead('0x39')](_0xc109e9['query']['fields']));_0x3900d8[_0x9ead('0x38')]=_0x3900d8[_0x9ead('0x38')][_0x9ead('0x3a')]?_0x3900d8[_0x9ead('0x38')]:_0x8d30e0['model'];if(!_0xc109e9['query'][_0x9ead('0x3b')](_0x9ead('0x3c'))){_0x3900d8[_0x9ead('0x21')]=qs[_0x9ead('0x21')](_0xc109e9[_0x9ead('0x35')]['limit']);_0x3900d8[_0x9ead('0x1e')]=qs[_0x9ead('0x1e')](_0xc109e9['query'][_0x9ead('0x1e')]);}_0x3900d8[_0x9ead('0x3d')]=qs[_0x9ead('0x3e')](_0xc109e9[_0x9ead('0x35')]['sort']);_0x3900d8[_0x9ead('0x3f')]=qs[_0x9ead('0x36')](_[_0x9ead('0x40')](_0xc109e9[_0x9ead('0x35')],_0x8d30e0[_0x9ead('0x36')]),_0x13bbc5);if(_0xc109e9[_0x9ead('0x35')][_0x9ead('0x41')]){_0x3900d8['where']=_[_0x9ead('0x42')](_0x3900d8[_0x9ead('0x3f')],{'$or':_[_0x9ead('0x2f')](_0x13bbc5,function(_0x6898fe){if(_0x6898fe['type']!=='VIRTUAL'){var _0xd90aca={};_0xd90aca[_0x6898fe['name']]={'$like':'%'+_0xc109e9[_0x9ead('0x35')][_0x9ead('0x41')]+'%'};return _0xd90aca;}})});}_0x3900d8=_[_0x9ead('0x42')]({},_0x3900d8,_0xc109e9['options']);var _0x1a32e7={'where':_0x3900d8[_0x9ead('0x3f')]};return db[_0x9ead('0x30')][_0x9ead('0x20')](_0x1a32e7)[_0x9ead('0x29')](function(_0x34f9b2){_0xa43b5b[_0x9ead('0x20')]=_0x34f9b2;if(_0xc109e9[_0x9ead('0x35')][_0x9ead('0x43')]){_0x3900d8['include']=[{'all':!![]}];}return db[_0x9ead('0x30')][_0x9ead('0x44')](_0x3900d8);})['then'](function(_0x348225){_0xa43b5b['rows']=_0x348225;return _0xa43b5b;})[_0x9ead('0x29')](respondWithFilteredResult(_0x1ba82f,_0x3900d8))[_0x9ead('0x45')](handleError(_0x1ba82f,null));};exports['show']=function(_0x487973,_0x44c986){var _0x15ec57={'raw':![],'where':{'id':_0x487973[_0x9ead('0x46')]['id']}},_0x2f27b0={};_0x2f27b0[_0x9ead('0x34')]=_[_0x9ead('0x47')](db[_0x9ead('0x30')]['rawAttributes']);_0x2f27b0[_0x9ead('0x35')]=_[_0x9ead('0x47')](_0x487973[_0x9ead('0x35')]);_0x2f27b0[_0x9ead('0x36')]=_[_0x9ead('0x37')](_0x2f27b0[_0x9ead('0x34')],_0x2f27b0[_0x9ead('0x35')]);_0x15ec57[_0x9ead('0x38')]=_[_0x9ead('0x37')](_0x2f27b0[_0x9ead('0x34')],qs[_0x9ead('0x39')](_0x487973['query'][_0x9ead('0x39')]));_0x15ec57[_0x9ead('0x38')]=_0x15ec57[_0x9ead('0x38')][_0x9ead('0x3a')]?_0x15ec57['attributes']:_0x2f27b0[_0x9ead('0x34')];if(_0x487973[_0x9ead('0x35')][_0x9ead('0x43')]){_0x15ec57[_0x9ead('0x48')]=[{'all':!![]}];}_0x15ec57=_[_0x9ead('0x42')]({},_0x15ec57,_0x487973[_0x9ead('0x49')]);return db[_0x9ead('0x30')]['find'](_0x15ec57)['then'](handleEntityNotFound(_0x44c986,null))[_0x9ead('0x29')](respondWithResult(_0x44c986,null))[_0x9ead('0x45')](handleError(_0x44c986,null));};exports[_0x9ead('0x4a')]=function(_0x1b1067,_0x41bba7){return db[_0x9ead('0x30')][_0x9ead('0x4a')](_0x1b1067[_0x9ead('0x4b')],{})[_0x9ead('0x29')](function(_0x42cc0d){var _0x56e028=_0x1b1067['user'][_0x9ead('0x4c')]({'plain':!![]});if(!_0x56e028)throw new Error(_0x9ead('0x4d'));if(_0x56e028[_0x9ead('0x4e')]===_0x9ead('0x4f')){var _0x22f839=_0x42cc0d['get']({'plain':!![]});var _0x6710da='Lists';return db[_0x9ead('0x50')]['find']({'where':{'name':_0x6710da,'userProfileId':_0x56e028[_0x9ead('0x51')]},'raw':!![]})[_0x9ead('0x29')](function(_0x50eb03){if(_0x50eb03&&_0x50eb03[_0x9ead('0x52')]===0x0){return db['UserProfileResource'][_0x9ead('0x4a')]({'name':_0x22f839[_0x9ead('0x2c')],'resourceId':_0x22f839['id'],'type':_0x50eb03[_0x9ead('0x2c')],'sectionId':_0x50eb03['id']},{})[_0x9ead('0x29')](function(){return _0x42cc0d;});}else{return _0x42cc0d;}})[_0x9ead('0x45')](function(_0x43b4fd){logger['error'](_0x9ead('0x53'),_0x43b4fd);throw _0x43b4fd;});}return _0x42cc0d;})[_0x9ead('0x29')](respondWithResult(_0x41bba7,0xc9))[_0x9ead('0x45')](handleError(_0x41bba7,null));};exports[_0x9ead('0x54')]=function(_0x938470,_0x52f5cf){if(_0x938470[_0x9ead('0x4b')]['id']){delete _0x938470['body']['id'];}return db[_0x9ead('0x30')][_0x9ead('0x55')]({'where':{'id':_0x938470[_0x9ead('0x46')]['id']}})[_0x9ead('0x29')](handleEntityNotFound(_0x52f5cf,null))[_0x9ead('0x29')](saveUpdates(_0x938470[_0x9ead('0x4b')],null))[_0x9ead('0x29')](respondWithResult(_0x52f5cf,null))[_0x9ead('0x45')](handleError(_0x52f5cf,null));};exports['destroy']=function(_0x2bc355,_0x71ca5f){return db[_0x9ead('0x30')]['find']({'where':{'id':_0x2bc355['params']['id']}})[_0x9ead('0x29')](handleEntityNotFound(_0x71ca5f,null))[_0x9ead('0x29')](removeEntity(_0x71ca5f,null))[_0x9ead('0x45')](handleError(_0x71ca5f,null));};exports[_0x9ead('0x56')]=function(_0x4fe85f,_0x171658){return db[_0x9ead('0x30')]['describe']()['then'](respondWithResult(_0x171658,null))['catch'](handleError(_0x171658,null));};exports[_0x9ead('0x57')]=function(_0x3f30a7,_0x4ac0ba,_0x4a3882){if(_0x3f30a7[_0x9ead('0x4b')]['id']){delete _0x3f30a7[_0x9ead('0x4b')]['id'];}return db[_0x9ead('0x30')][_0x9ead('0x55')]({'where':{'id':_0x3f30a7[_0x9ead('0x46')]['id']}})[_0x9ead('0x29')](handleEntityNotFound(_0x4ac0ba,null))[_0x9ead('0x29')](function(_0xa6a324){if(_0xa6a324){_0x3f30a7[_0x9ead('0x4b')][_0x9ead('0x58')]=_0xa6a324['id'];return db[_0x9ead('0x59')][_0x9ead('0x4a')](_0x3f30a7[_0x9ead('0x4b')]);}})[_0x9ead('0x29')](respondWithResult(_0x4ac0ba,null))[_0x9ead('0x45')](handleError(_0x4ac0ba,null));};exports['getDispositions']=function(_0x583862,_0x317df6,_0x3eb5e4){var _0xdfb5b2={'raw':![],'where':{}};var _0x56c980={};var _0x39e2db={'count':0x0,'rows':[]};return db[_0x9ead('0x30')][_0x9ead('0x5a')]({'where':{'id':_0x583862[_0x9ead('0x46')]['id']}})['then'](handleEntityNotFound(_0x317df6,null))[_0x9ead('0x29')](function(_0x28189e){if(_0x28189e){_0x56c980['model']=_['keys'](db[_0x9ead('0x59')]['rawAttributes']);_0x56c980['query']=_[_0x9ead('0x47')](_0x583862['query']);_0x56c980[_0x9ead('0x36')]=_[_0x9ead('0x37')](_0x56c980[_0x9ead('0x34')],_0x56c980[_0x9ead('0x35')]);_0xdfb5b2[_0x9ead('0x38')]=_[_0x9ead('0x37')](_0x56c980[_0x9ead('0x34')],qs[_0x9ead('0x39')](_0x583862[_0x9ead('0x35')][_0x9ead('0x39')]));_0xdfb5b2[_0x9ead('0x38')]=_0xdfb5b2[_0x9ead('0x38')][_0x9ead('0x3a')]?_0xdfb5b2[_0x9ead('0x38')]:_0x56c980[_0x9ead('0x34')];if(!_0x583862[_0x9ead('0x35')][_0x9ead('0x3b')](_0x9ead('0x3c'))){_0xdfb5b2[_0x9ead('0x21')]=qs['limit'](_0x583862[_0x9ead('0x35')][_0x9ead('0x21')]);_0xdfb5b2[_0x9ead('0x1e')]=qs[_0x9ead('0x1e')](_0x583862[_0x9ead('0x35')][_0x9ead('0x1e')]);}_0xdfb5b2[_0x9ead('0x3d')]=qs[_0x9ead('0x3e')](_0x583862['query'][_0x9ead('0x3e')]);_0xdfb5b2[_0x9ead('0x3f')]=qs[_0x9ead('0x36')](_[_0x9ead('0x40')](_0x583862[_0x9ead('0x35')],_0x56c980[_0x9ead('0x36')]));_0xdfb5b2['where'][_0x9ead('0x58')]=_0x28189e['id'];if(_0x583862[_0x9ead('0x35')][_0x9ead('0x41')]){_0xdfb5b2['where']=_['merge'](_0xdfb5b2['where'],{'$or':_[_0x9ead('0x2f')](_0xdfb5b2[_0x9ead('0x38')],function(_0x2111fe){var _0x2ce66d={};_0x2ce66d[_0x2111fe]={'$like':'%'+_0x583862[_0x9ead('0x35')]['filter']+'%'};return _0x2ce66d;})});}_0xdfb5b2=_[_0x9ead('0x42')]({},_0xdfb5b2,_0x583862['options']);return db[_0x9ead('0x59')][_0x9ead('0x20')]({'where':_0xdfb5b2[_0x9ead('0x3f')]})[_0x9ead('0x29')](function(_0x52f2e1){_0x39e2db['count']=_0x52f2e1;if(_0x583862[_0x9ead('0x35')][_0x9ead('0x43')]){_0xdfb5b2['include']=[{'all':!![]}];}return db[_0x9ead('0x59')][_0x9ead('0x44')](_0xdfb5b2);})['then'](function(_0x20fe81){_0x39e2db[_0x9ead('0x5b')]=_0x20fe81;return _0x39e2db;});}})[_0x9ead('0x29')](respondWithFilteredResult(_0x317df6,_0xdfb5b2))[_0x9ead('0x45')](handleError(_0x317df6,null));};exports[_0x9ead('0x5c')]=function(_0x3cf593,_0x377935,_0x417245){return db[_0x9ead('0x30')][_0x9ead('0x55')]({'where':{'id':_0x3cf593[_0x9ead('0x46')]['id']}})['then'](handleEntityNotFound(_0x377935,null))[_0x9ead('0x29')](function(_0x3c52c7){if(_0x3c52c7){return _0x3c52c7[_0x9ead('0x5c')](_0x3cf593['query'][_0x9ead('0x5d')]);}})['then'](respondWithStatusCode(_0x377935,null))[_0x9ead('0x45')](handleError(_0x377935,null));};exports['addContacts']=function(_0x591ef0,_0x45c071,_0x3596d5){return db['CmList'][_0x9ead('0x55')]({'where':{'id':_0x591ef0['params']['id']}})[_0x9ead('0x29')](handleEntityNotFound(_0x45c071,null))[_0x9ead('0x29')](function(_0x528f21){if(_0x528f21){var _0x99567e=[];var _0x2ca40b={'success':[],'errors':[]};return db[_0x9ead('0x5e')][_0x9ead('0x56')]()[_0x9ead('0x29')](function(_0x33de8f){if(_0x591ef0[_0x9ead('0x4b')][_0x9ead('0x5f')]&&_[_0x9ead('0x60')](_0x591ef0[_0x9ead('0x4b')][_0x9ead('0x5f')])){if(_0x591ef0['body'][_0x9ead('0x5f')][_0x9ead('0x3a')]){_0x591ef0['body']['tags']=_0x591ef0[_0x9ead('0x4b')][_0x9ead('0x5f')][_0x9ead('0x61')](';')+';';}else{_0x591ef0[_0x9ead('0x4b')][_0x9ead('0x5f')]=null;}}else{_0x591ef0['body'][_0x9ead('0x5f')]=null;}if(_0x591ef0[_0x9ead('0x4b')]&&_[_0x9ead('0x60')](_0x591ef0[_0x9ead('0x4b')])){for(var _0x5f4fbf=0x0;_0x5f4fbf<_0x591ef0[_0x9ead('0x4b')][_0x9ead('0x3a')];_0x5f4fbf+=0x1){_0x591ef0['body'][_0x5f4fbf][_0x9ead('0x58')]=_0x591ef0[_0x9ead('0x46')]['id'];_0x99567e['push'](_0x591ef0[_0x9ead('0x4b')][_0x5f4fbf]);}return BPromise[_0x9ead('0x62')](_0x99567e,function(_0x1832e9){return db[_0x9ead('0x5e')][_0x9ead('0x4a')](_[_0x9ead('0x63')](_0x1832e9,[_0x9ead('0x5d'),'id'])||{},{'fields':_[_0x9ead('0x47')](_0x33de8f),'raw':!![]})[_0x9ead('0x29')](function(_0x45be6d){_0x2ca40b[_0x9ead('0x64')][_0x9ead('0x65')](_0x45be6d[_0x9ead('0x66')]);})[_0x9ead('0x45')](function(_0x79c1c4){_0x2ca40b['errors'][_0x9ead('0x65')]({'data':_0x1832e9,'error':_0x79c1c4[_0x9ead('0x67')]});});})['then'](function(_0x2947ae){return _0x2ca40b;})[_0x9ead('0x45')](function(_0x416555){return _0x416555;});}else{_0x45c071[_0x9ead('0x1b')](0x190)[_0x9ead('0x1d')]({'message':_0x9ead('0x68')});}});}})['then'](respondWithResult(_0x45c071,null))['catch'](handleError(_0x45c071,null));};exports[_0x9ead('0x69')]=function(_0x43b882,_0x310398,_0x5c2b02){var _0x3de36c;return db[_0x9ead('0x30')][_0x9ead('0x55')]({'where':{'id':_0x43b882['params']['id']},'include':[{'model':db[_0x9ead('0x6a')],'as':_0x9ead('0x6b')}]})['then'](handleEntityNotFound(_0x310398,null))[_0x9ead('0x29')](function(_0x477857){if(_0x477857){_0x3de36c=_0x477857;return db['CmContact'][_0x9ead('0x31')];}})['then'](function(_0x1f5a4b){if(_0x1f5a4b){var _0x4387e4={};var _0x3b376d={};_0x3b376d[_0x9ead('0x34')]=_[_0x9ead('0x6c')](_[_0x9ead('0x47')](_0x1f5a4b),_[_0x9ead('0x2f')](_0x3de36c[_0x9ead('0x6b')],function(_0x3acace){return util['format'](_0x9ead('0x6d'),_0x3acace['id']);}));_0x3b376d[_0x9ead('0x35')]=_[_0x9ead('0x47')](_0x43b882[_0x9ead('0x35')]);_0x3b376d[_0x9ead('0x36')]=_[_0x9ead('0x37')](_0x3b376d[_0x9ead('0x34')],_0x3b376d[_0x9ead('0x35')]);_0x4387e4[_0x9ead('0x38')]=_[_0x9ead('0x37')](_0x3b376d[_0x9ead('0x34')],qs[_0x9ead('0x39')](_0x43b882['query'][_0x9ead('0x39')]));_0x4387e4[_0x9ead('0x38')]=_0x4387e4['attributes'][_0x9ead('0x3a')]?_0x4387e4[_0x9ead('0x38')]:_0x3b376d[_0x9ead('0x34')];if(!_0x43b882[_0x9ead('0x35')][_0x9ead('0x3b')](_0x9ead('0x3c'))){_0x4387e4[_0x9ead('0x21')]=qs['limit'](_0x43b882[_0x9ead('0x35')]['limit']);_0x4387e4[_0x9ead('0x1e')]=qs[_0x9ead('0x1e')](_0x43b882[_0x9ead('0x35')][_0x9ead('0x1e')]);}_0x4387e4[_0x9ead('0x3d')]=qs[_0x9ead('0x3e')](_0x43b882[_0x9ead('0x35')]['sort']);_0x4387e4[_0x9ead('0x3f')]=qs['filters'](_[_0x9ead('0x40')](_0x43b882[_0x9ead('0x35')],_0x3b376d[_0x9ead('0x36')]));_0x4387e4['raw']=!![];if(_0x43b882[_0x9ead('0x35')]['filter']){_0x4387e4['where']=_['merge'](_0x4387e4[_0x9ead('0x3f')],{'$or':_['map'](_0x4387e4[_0x9ead('0x38')],function(_0x2226af){var _0xdb68b4={};_0xdb68b4[_0x2226af]={'$like':'%'+_0x43b882[_0x9ead('0x35')]['filter']+'%'};return _0xdb68b4;})});}_0x4387e4=_[_0x9ead('0x42')]({},_0x4387e4,_0x43b882[_0x9ead('0x49')]);return _0x3de36c[_0x9ead('0x69')](_0x4387e4);}})[_0x9ead('0x29')](respondWithResult(_0x310398,null))[_0x9ead('0x45')](handleError(_0x310398,null));};exports[_0x9ead('0x6e')]=function(_0x46d80e,_0x4c6035,_0x33a55c){var _0x47bc46;var _0x39f782;var _0xa502ec;var _0x41695a=_0x46d80e[_0x9ead('0x46')]['id'];csv_results=[];return db['ContactItemType']['findAll']({'attributes':['id',_0x9ead('0x2c')],'raw':!![],'order':['OrderBy']})[_0x9ead('0x29')](function(_0x16d9e8){_0x47bc46=_0x16d9e8;var _0x59f2ec=_[_0x9ead('0x47')](db[_0x9ead('0x5e')]['rawAttributes']);return db[_0x9ead('0x6a')][_0x9ead('0x44')]({'raw':!![],'attributes':['id',_0x9ead('0x6f')]})[_0x9ead('0x29')](function(_0x2bda2d){_0x39f782=_0x2bda2d;var _0x325b9b=squel['select']()[_0x9ead('0x39')](_0x59f2ec)['from'](_0x9ead('0x70'),'c')[_0x9ead('0x3f')](_0x9ead('0x71'),_0x41695a)[_0x9ead('0x3f')](_0x9ead('0x72'))[_0x9ead('0x73')]();for(var _0x59fb05=0x0;_0x59fb05<_0x39f782[_0x9ead('0x3a')];_0x59fb05++){_0x325b9b[_0x9ead('0x74')](_0x9ead('0x75')+_0x39f782[_0x59fb05]['id'],'customField_'+_0x39f782[_0x59fb05][_0x9ead('0x6f')]);}for(var _0x59fb05=0x0;_0x59fb05<_0x47bc46[_0x9ead('0x3a')];_0x59fb05++){_0x325b9b[_0x9ead('0x74')](squel[_0x9ead('0x76')]()['field'](_0x9ead('0x77'))[_0x9ead('0x78')](_0x9ead('0x79'))[_0x9ead('0x3f')](_0x9ead('0x7a'),_0x47bc46[_0x59fb05]['id'])[_0x9ead('0x3f')]('CmContactId\x20=\x20c.id'),_0x9ead('0x7b')+_0x47bc46[_0x59fb05][_0x9ead('0x2c')]);_0x325b9b['field'](squel['select']()[_0x9ead('0x74')](_0x9ead('0x7c'))[_0x9ead('0x78')](_0x9ead('0x79'))[_0x9ead('0x3f')](_0x9ead('0x7a'),_0x47bc46[_0x59fb05]['id'])[_0x9ead('0x3f')](_0x9ead('0x7d')),'description_additionalPhone_'+_0x47bc46[_0x59fb05]['name']);}var _0xaa7754=[];_0xaa7754[_0x9ead('0x65')](_0x325b9b['toString']());BPromise[_0x9ead('0x62')](_0xaa7754,handleQuery)['then'](function(_0x432073){handleQuery(_0x325b9b[_0x9ead('0x7e')]());var _0x21de16=csv_results[0x0];if(!_[_0x9ead('0x7f')](_0x21de16)){var _0x25bf27=toCsv(_0x21de16);var _0x12f3ac=Date[_0x9ead('0x80')]();fs[_0x9ead('0x81')](util['format'](_0x9ead('0x82'),_0x41695a,_0x12f3ac),_0x25bf27);_0x4c6035[_0x9ead('0x83')](_0x9ead('0x84'),'attachment;\x20filename='+util[_0x9ead('0x85')](_0x9ead('0x86'),_0x41695a,_0x12f3ac));_0x4c6035[_0x9ead('0x83')](_0x9ead('0x87'),_0x9ead('0x88'));return _0x4c6035[_0x9ead('0x89')](util[_0x9ead('0x85')]('/tmp/list_%d_%s.csv',_0x41695a,_0x12f3ac));}else{return _0x4c6035[_0x9ead('0x8a')](0xcc);}});});});};exports[_0x9ead('0x8b')]=function(_0x21a871,_0x375825,_0xc5cb3b){var _0x30c52c;delete _0x21a871['body']['id'];return db[_0x9ead('0x30')][_0x9ead('0x5a')]({'where':{'id':_0x21a871[_0x9ead('0x46')]['id']}})[_0x9ead('0x29')](handleEntityNotFound(_0x375825,null))[_0x9ead('0x29')](function(_0x2e1515){if(_0x2e1515){return db[_0x9ead('0x8c')][_0x9ead('0x8d')](function(_0x4afaf5){return db['CmCustomField'][_0x9ead('0x4a')](_0x21a871[_0x9ead('0x4b')],{'transaction':_0x4afaf5})[_0x9ead('0x29')](function(_0x4c045d){_0x30c52c=_0x4c045d;return _0x2e1515[_0x9ead('0x8e')](_0x4c045d,{'transaction':_0x4afaf5});})[_0x9ead('0x29')](function(){var _0x1912b3={'type':db[_0x9ead('0x8f')][_0x9ead('0x90')],'transaction':_0x4afaf5};switch(_0x21a871[_0x9ead('0x4b')][_0x9ead('0x91')]){case'text':_0x1912b3[_0x9ead('0x91')]=db[_0x9ead('0x8f')][_0x9ead('0x90')];break;case _0x9ead('0x92'):_0x1912b3['type']=db['Sequelize'][_0x9ead('0x93')];break;case'switch':_0x1912b3[_0x9ead('0x91')]=db[_0x9ead('0x8f')]['BOOLEAN'];_0x1912b3[_0x9ead('0x94')]=![];break;default:}return db[_0x9ead('0x8c')]['queryInterface']['addColumn'](_0x9ead('0x70'),util['format'](_0x9ead('0x95'),_0x30c52c['id']),_0x1912b3);})[_0x9ead('0x29')](function(){return _0x30c52c;});});}})['then'](respondWithResult(_0x375825,null))['catch'](handleError(_0x375825,null));};exports[_0x9ead('0x96')]=function(_0x3d0e8c,_0x177578,_0x8e5602){var _0x49abe6={};var _0x174661={};var _0x183af3;var _0x37e112;return db[_0x9ead('0x30')][_0x9ead('0x5a')]({'where':{'id':_0x3d0e8c[_0x9ead('0x46')]['id']}})[_0x9ead('0x29')](handleEntityNotFound(_0x177578,null))['then'](function(_0x3d420b){if(_0x3d420b){_0x183af3=_0x3d420b;_0x174661[_0x9ead('0x34')]=_[_0x9ead('0x47')](db[_0x9ead('0x6a')][_0x9ead('0x31')]);_0x174661[_0x9ead('0x35')]=_[_0x9ead('0x47')](_0x3d0e8c[_0x9ead('0x35')]);_0x174661[_0x9ead('0x36')]=_[_0x9ead('0x37')](_0x174661['model'],_0x174661['query']);_0x49abe6[_0x9ead('0x38')]=_[_0x9ead('0x37')](_0x174661['model'],qs[_0x9ead('0x39')](_0x3d0e8c['query']['fields']));_0x49abe6[_0x9ead('0x38')]=_0x49abe6['attributes'][_0x9ead('0x3a')]?_0x49abe6[_0x9ead('0x38')]:_0x174661[_0x9ead('0x34')];_0x49abe6[_0x9ead('0x3d')]=qs['sort'](_0x3d0e8c[_0x9ead('0x35')][_0x9ead('0x3e')]);_0x49abe6[_0x9ead('0x3f')]=qs[_0x9ead('0x36')](_[_0x9ead('0x40')](_0x3d0e8c[_0x9ead('0x35')],_0x174661[_0x9ead('0x36')]));_0x49abe6[_0x9ead('0x3f')]=_[_0x9ead('0x42')](_0x49abe6['where'],{'$or':[{'ListId':_0x3d420b['id']},{'ListId':null}]});if(_0x3d0e8c[_0x9ead('0x35')][_0x9ead('0x41')]){_0x49abe6[_0x9ead('0x3f')]=_['merge'](_0x49abe6[_0x9ead('0x3f')],{'$or':_[_0x9ead('0x2f')](_0x49abe6[_0x9ead('0x38')],function(_0x56e1c4){var _0x34c6dd={};_0x34c6dd[_0x56e1c4]={'$like':'%'+_0x3d0e8c[_0x9ead('0x35')][_0x9ead('0x41')]+'%'};return _0x34c6dd;})});}_0x49abe6=_[_0x9ead('0x42')]({},_0x49abe6,_0x3d0e8c[_0x9ead('0x49')]);return db[_0x9ead('0x6a')]['findAndCountAll'](_0x49abe6);}})['then'](respondWithResult(_0x177578,null))[_0x9ead('0x45')](handleError(_0x177578,null));};exports[_0x9ead('0x97')]=function(_0x1e3d23,_0x2bc349){return db[_0x9ead('0x6a')]['findAndCountAll']({'where':{'ListId':null}})[_0x9ead('0x29')](handleEntityNotFound(_0x2bc349,null))['then'](function(_0x36f44a){return _0x36f44a;})[_0x9ead('0x29')](respondWithResult(_0x2bc349,null))[_0x9ead('0x45')](handleError(_0x2bc349,null));};exports[_0x9ead('0x98')]=function(_0x2c8e13,_0x4e4bc6,_0x5256dc){return db[_0x9ead('0x30')][_0x9ead('0x55')]({'where':{'id':_0x2c8e13[_0x9ead('0x46')]['id']}})['then'](handleEntityNotFound(_0x4e4bc6,null))[_0x9ead('0x29')](function(_0x4a6a7f){if(_0x4a6a7f){return _0x4a6a7f[_0x9ead('0x98')](_0x2c8e13['body'][_0x9ead('0x5d')],_[_0x9ead('0x63')](_0x2c8e13[_0x9ead('0x4b')],[_0x9ead('0x5d'),'id'])||{})[_0x9ead('0x99')](function(_0x139412){for(var _0x156ee7=0x0;_0x156ee7<_0x2c8e13[_0x9ead('0x4b')][_0x9ead('0x5d')][_0x9ead('0x3a')];_0x156ee7+=0x1){socket[_0x9ead('0x9a')](_0x9ead('0x9b'),{'UserId':Number(_0x2c8e13[_0x9ead('0x4b')][_0x9ead('0x5d')][_0x156ee7]),'CmListId':Number(_0x2c8e13[_0x9ead('0x46')]['id'])});}return _0x139412;});}})[_0x9ead('0x29')](respondWithResult(_0x4e4bc6,null))[_0x9ead('0x45')](handleError(_0x4e4bc6,null));};exports[_0x9ead('0x9c')]=function(_0x595632,_0x468863,_0x2a9ea6){return db[_0x9ead('0x30')][_0x9ead('0x55')]({'where':{'id':_0x595632['params']['id']}})['then'](handleEntityNotFound(_0x468863,null))[_0x9ead('0x29')](function(_0x3c112c){if(_0x3c112c){return _0x3c112c[_0x9ead('0x9c')](_0x595632[_0x9ead('0x35')][_0x9ead('0x5d')])['then'](function(){if(_[_0x9ead('0x60')](_0x595632['query'][_0x9ead('0x5d')])){for(var _0x5d8019=0x0;_0x5d8019<_0x595632[_0x9ead('0x35')][_0x9ead('0x5d')][_0x9ead('0x3a')];_0x5d8019+=0x1){socket[_0x9ead('0x9a')](_0x9ead('0x9d'),{'UserId':Number(_0x595632[_0x9ead('0x35')]['ids'][_0x5d8019]),'CmListId':Number(_0x595632[_0x9ead('0x46')]['id'])});}}else{socket['emit'](_0x9ead('0x9d'),{'UserId':Number(_0x595632[_0x9ead('0x35')][_0x9ead('0x5d')]),'CmListId':Number(_0x595632['params']['id'])});}});}})[_0x9ead('0x29')](respondWithStatusCode(_0x468863,null))['catch'](handleError(_0x468863,null));};exports[_0x9ead('0x9e')]=function(_0x96e3d1,_0x7edc0e,_0x264c16){var _0x2667f9={};var _0x376e73={};var _0x48a7bb;var _0x449879;return db[_0x9ead('0x30')][_0x9ead('0x5a')]({'where':{'id':_0x96e3d1['params']['id']}})['then'](handleEntityNotFound(_0x7edc0e,null))['then'](function(_0x4a5a26){if(_0x4a5a26){_0x48a7bb=_0x4a5a26;_0x376e73[_0x9ead('0x34')]=_[_0x9ead('0x47')](db[_0x9ead('0x9f')][_0x9ead('0x31')]);_0x376e73['query']=_['keys'](_0x96e3d1[_0x9ead('0x35')]);_0x376e73[_0x9ead('0x36')]=_['intersection'](_0x376e73[_0x9ead('0x34')],_0x376e73[_0x9ead('0x35')]);_0x2667f9[_0x9ead('0x38')]=_[_0x9ead('0x37')](_0x376e73[_0x9ead('0x34')],qs[_0x9ead('0x39')](_0x96e3d1[_0x9ead('0x35')][_0x9ead('0x39')]));_0x2667f9[_0x9ead('0x38')]=_0x2667f9['attributes'][_0x9ead('0x3a')]?_0x2667f9[_0x9ead('0x38')]:_0x376e73['model'];_0x2667f9[_0x9ead('0x3d')]=qs['sort'](_0x96e3d1[_0x9ead('0x35')][_0x9ead('0x3e')]);_0x2667f9['where']=qs[_0x9ead('0x36')](_[_0x9ead('0x40')](_0x96e3d1[_0x9ead('0x35')],_0x376e73['filters']));if(_0x96e3d1[_0x9ead('0x35')][_0x9ead('0x41')]){_0x2667f9[_0x9ead('0x3f')]=_['merge'](_0x2667f9[_0x9ead('0x3f')],{'$or':_['map'](_0x2667f9[_0x9ead('0x38')],function(_0x59f573){var _0xe83099={};_0xe83099[_0x59f573]={'$like':'%'+_0x96e3d1[_0x9ead('0x35')]['filter']+'%'};return _0xe83099;})});}_0x2667f9=_[_0x9ead('0x42')]({},_0x2667f9,_0x96e3d1[_0x9ead('0x49')]);return _0x48a7bb['getAgents'](_0x2667f9);}})[_0x9ead('0x29')](function(_0x2b34fd){if(_0x2b34fd){_0x449879=_0x2b34fd[_0x9ead('0x3a')];if(!_0x96e3d1[_0x9ead('0x35')][_0x9ead('0x3b')](_0x9ead('0x3c'))){_0x2667f9[_0x9ead('0x21')]=qs[_0x9ead('0x21')](_0x96e3d1[_0x9ead('0x35')][_0x9ead('0x21')]);_0x2667f9[_0x9ead('0x1e')]=qs[_0x9ead('0x1e')](_0x96e3d1[_0x9ead('0x35')][_0x9ead('0x1e')]);}return _0x48a7bb[_0x9ead('0x9e')](_0x2667f9);}})['then'](function(_0x14f9c5){if(_0x14f9c5){return _0x14f9c5?{'count':_0x449879,'rows':_0x14f9c5}:null;}})[_0x9ead('0x29')](respondWithResult(_0x7edc0e,null))[_0x9ead('0x45')](handleError(_0x7edc0e,null));};function handleQuery(_0x1d93f4){logger[_0x9ead('0xa0')](_0x1d93f4);return db['sequelize']['query'](_0x1d93f4)['spread'](function(_0x1f1fb9){csv_results[_0x9ead('0x65')](_0x1f1fb9);})['catch'](function(_0x4aa032){logger[_0x9ead('0x2a')](_0x4aa032[_0x9ead('0x67')]);});} \ No newline at end of file diff --git a/server/api/cmList/cmList.events.js b/server/api/cmList/cmList.events.js index 479fa92..ab32f66 100644 --- a/server/api/cmList/cmList.events.js +++ b/server/api/cmList/cmList.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['hasOwnProperty','exports','events','CmList','setMaxListeners','save','emit'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3e74,0x175));var _0x43e7=function(_0x3c32d7,_0x1d6641){_0x3c32d7=_0x3c32d7-0x0;var _0x21ae5b=_0x3e74[_0x3c32d7];return _0x21ae5b;};'use strict';var EventEmitter=require(_0x43e7('0x0'));var CmList=require('../../mysqldb')['db'][_0x43e7('0x1')];var CmListEvents=new EventEmitter();CmListEvents[_0x43e7('0x2')](0x0);var events={'afterCreate':_0x43e7('0x3'),'afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0xc58479){return function(_0x4f9bbe,_0x128b0f,_0xe838b4){CmListEvents[_0x43e7('0x4')](_0xc58479+':'+_0x4f9bbe['id'],_0x4f9bbe);CmListEvents[_0x43e7('0x4')](_0xc58479,_0x4f9bbe);_0xe838b4(null);};}for(var e in events){if(events[_0x43e7('0x5')](e)){var event=events[e];CmList['hook'](e,emitEvent(event));}}module[_0x43e7('0x6')]=CmListEvents; \ No newline at end of file +var _0xe14b=['hasOwnProperty','hook','exports','events','../../mysqldb','save','update','emit'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xe14b,0x93));var _0xbe14=function(_0x5c5081,_0x233f38){_0x5c5081=_0x5c5081-0x0;var _0x186dbe=_0xe14b[_0x5c5081];return _0x186dbe;};'use strict';var EventEmitter=require(_0xbe14('0x0'));var CmList=require(_0xbe14('0x1'))['db']['CmList'];var CmListEvents=new EventEmitter();CmListEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbe14('0x2'),'afterUpdate':_0xbe14('0x3'),'afterDestroy':'remove'};function emitEvent(_0x7d3665){return function(_0x5ce8fb,_0x496c04,_0x1833e3){CmListEvents[_0xbe14('0x4')](_0x7d3665+':'+_0x5ce8fb['id'],_0x5ce8fb);CmListEvents[_0xbe14('0x4')](_0x7d3665,_0x5ce8fb);_0x1833e3(null);};}for(var e in events){if(events[_0xbe14('0x5')](e)){var event=events[e];CmList[_0xbe14('0x6')](e,emitEvent(event));}}module[_0xbe14('0x7')]=CmListEvents; \ No newline at end of file diff --git a/server/api/cmList/cmList.model.js b/server/api/cmList/cmList.model.js index b011f88..9332ddf 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 _0x2dae=['lodash','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./cmList.attributes','exports','define','CmList','cm_lists'];(function(_0x2df055,_0x5ac00f){var _0x1f8e5a=function(_0x4d5352){while(--_0x4d5352){_0x2df055['push'](_0x2df055['shift']());}};_0x1f8e5a(++_0x5ac00f);}(_0x2dae,0xc3));var _0xe2da=function(_0x1655bb,_0x5a82ae){_0x1655bb=_0x1655bb-0x0;var _0x5e2020=_0x2dae[_0x1655bb];return _0x5e2020;};'use strict';var _=require(_0xe2da('0x0'));var util=require('util');var logger=require(_0xe2da('0x1'))(_0xe2da('0x2'));var moment=require(_0xe2da('0x3'));var BPromise=require(_0xe2da('0x4'));var rp=require(_0xe2da('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xe2da('0x6'));var config=require(_0xe2da('0x7'));var attributes=require(_0xe2da('0x8'));module[_0xe2da('0x9')]=function(_0x523c60,_0x3e3e25){return _0x523c60[_0xe2da('0xa')](_0xe2da('0xb'),attributes,{'tableName':_0xe2da('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6324=['define','cm_lists','lodash','util','../../config/logger','api','bluebird','path','../../config/environment','exports'];(function(_0x49a815,_0x5cb805){var _0x5e6a95=function(_0x1a9cfb){while(--_0x1a9cfb){_0x49a815['push'](_0x49a815['shift']());}};_0x5e6a95(++_0x5cb805);}(_0x6324,0x142));var _0x4632=function(_0x389af3,_0x30a76a){_0x389af3=_0x389af3-0x0;var _0x199d87=_0x6324[_0x389af3];return _0x199d87;};'use strict';var _=require(_0x4632('0x0'));var util=require(_0x4632('0x1'));var logger=require(_0x4632('0x2'))(_0x4632('0x3'));var moment=require('moment');var BPromise=require(_0x4632('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4632('0x5'));var rimraf=require('rimraf');var config=require(_0x4632('0x6'));var attributes=require('./cmList.attributes');module[_0x4632('0x7')]=function(_0x24aba6,_0x1f3077){return _0x24aba6[_0x4632('0x8')]('CmList',attributes,{'tableName':_0x4632('0x9'),'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 11250af..f926c5d 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 _0x9638=['jayson/promise','client','http','redis','defaults','socket.io-emitter','./cmList.socket','register','then','info','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CmList,\x20%s,\x20%s','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x58d426,_0x203785){var _0x4d43ae=function(_0x5400f0){while(--_0x5400f0){_0x58d426['push'](_0x58d426['shift']());}};_0x4d43ae(++_0x203785);}(_0x9638,0x12b));var _0x8963=function(_0x1a0967,_0x51bc82){_0x1a0967=_0x1a0967-0x0;var _0x5a169f=_0x9638[_0x1a0967];return _0x5a169f;};'use strict';var _=require(_0x8963('0x0'));var util=require(_0x8963('0x1'));var moment=require(_0x8963('0x2'));var BPromise=require('bluebird');var rs=require(_0x8963('0x3'));var fs=require('fs');var Redis=require(_0x8963('0x4'));var db=require(_0x8963('0x5'))['db'];var utils=require(_0x8963('0x6'));var logger=require(_0x8963('0x7'))(_0x8963('0x8'));var config=require('../../config/environment');var jayson=require(_0x8963('0x9'));var client=jayson[_0x8963('0xa')][_0x8963('0xb')]({'port':0x232a});config[_0x8963('0xc')]=_[_0x8963('0xd')](config[_0x8963('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x8963('0xe'))(new Redis(config[_0x8963('0xc')]));require(_0x8963('0xf'))[_0x8963('0x10')](socket);function respondWithRpcPromise(_0x2691ca,_0x3b4509,_0x36a44b){return new BPromise(function(_0x37d166,_0x1740dd){return client['request'](_0x2691ca,_0x36a44b)[_0x8963('0x11')](function(_0x4b74d0){logger[_0x8963('0x12')]('CmList,\x20%s,\x20%s',_0x3b4509,_0x8963('0x13'));logger[_0x8963('0x14')](_0x8963('0x15'),_0x3b4509,_0x8963('0x13'),JSON[_0x8963('0x16')](_0x4b74d0));if(_0x4b74d0[_0x8963('0x17')]){if(_0x4b74d0[_0x8963('0x17')][_0x8963('0x18')]===0x1f4){logger['error']('CmList,\x20%s,\x20%s',_0x3b4509,_0x4b74d0[_0x8963('0x17')]['message']);return _0x1740dd(_0x4b74d0['error'][_0x8963('0x19')]);}logger[_0x8963('0x17')]('CmList,\x20%s,\x20%s',_0x3b4509,_0x4b74d0[_0x8963('0x17')][_0x8963('0x19')]);return _0x37d166(_0x4b74d0['error'][_0x8963('0x19')]);}else{logger['info'](_0x8963('0x1a'),_0x3b4509,_0x8963('0x13'));_0x37d166(_0x4b74d0['result']['message']);}})[_0x8963('0x1b')](function(_0x1d3a13){logger['error'](_0x8963('0x1a'),_0x3b4509,_0x1d3a13);_0x1740dd(_0x1d3a13);});});} \ No newline at end of file +var _0x7869=['http','defaults','redis','localhost','socket.io-emitter','register','request','then','info','CmList,\x20%s,\x20%s','request\x20sent','debug','CmList,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x3b8221,_0x212658){var _0x32fa4b=function(_0x5dcd1a){while(--_0x5dcd1a){_0x3b8221['push'](_0x3b8221['shift']());}};_0x32fa4b(++_0x212658);}(_0x7869,0x16e));var _0x9786=function(_0x5a1192,_0x8970bf){_0x5a1192=_0x5a1192-0x0;var _0x113a2a=_0x7869[_0x5a1192];return _0x113a2a;};'use strict';var _=require(_0x9786('0x0'));var util=require(_0x9786('0x1'));var moment=require(_0x9786('0x2'));var BPromise=require(_0x9786('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x9786('0x4'));var db=require(_0x9786('0x5'))['db'];var utils=require(_0x9786('0x6'));var logger=require(_0x9786('0x7'))(_0x9786('0x8'));var config=require('../../config/environment');var jayson=require(_0x9786('0x9'));var client=jayson[_0x9786('0xa')][_0x9786('0xb')]({'port':0x232a});config['redis']=_[_0x9786('0xc')](config[_0x9786('0xd')],{'host':_0x9786('0xe'),'port':0x18eb});var socket=require(_0x9786('0xf'))(new Redis(config[_0x9786('0xd')]));require('./cmList.socket')[_0x9786('0x10')](socket);function respondWithRpcPromise(_0x6d8e1c,_0x32c45b,_0x1046a6){return new BPromise(function(_0x5a0881,_0x5a77bb){return client[_0x9786('0x11')](_0x6d8e1c,_0x1046a6)[_0x9786('0x12')](function(_0x2e0b0c){logger[_0x9786('0x13')](_0x9786('0x14'),_0x32c45b,_0x9786('0x15'));logger[_0x9786('0x16')](_0x9786('0x17'),_0x32c45b,_0x9786('0x15'),JSON[_0x9786('0x18')](_0x2e0b0c));if(_0x2e0b0c[_0x9786('0x19')]){if(_0x2e0b0c[_0x9786('0x19')][_0x9786('0x1a')]===0x1f4){logger['error'](_0x9786('0x14'),_0x32c45b,_0x2e0b0c[_0x9786('0x19')][_0x9786('0x1b')]);return _0x5a77bb(_0x2e0b0c['error'][_0x9786('0x1b')]);}logger[_0x9786('0x19')]('CmList,\x20%s,\x20%s',_0x32c45b,_0x2e0b0c[_0x9786('0x19')][_0x9786('0x1b')]);return _0x5a0881(_0x2e0b0c[_0x9786('0x19')]['message']);}else{logger[_0x9786('0x13')](_0x9786('0x14'),_0x32c45b,_0x9786('0x15'));_0x5a0881(_0x2e0b0c[_0x9786('0x1c')][_0x9786('0x1b')]);}})['catch'](function(_0x807335){logger[_0x9786('0x19')](_0x9786('0x14'),_0x32c45b,_0x807335);_0x5a77bb(_0x807335);});});} \ No newline at end of file diff --git a/server/api/cmList/cmList.socket.js b/server/api/cmList/cmList.socket.js index c9ea21f..7f3e033 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 _0x0b49=['emit','register','length','./cmList.events','save','remove'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0x0b49,0x69));var _0x90b4=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0x0b49[_0x387777];return _0x3f84c0;};'use strict';var CmListEvents=require(_0x90b4('0x0'));var events=[_0x90b4('0x1'),_0x90b4('0x2'),'update'];function createListener(_0x535acc,_0x5a8ffd){return function(_0x290de9){_0x5a8ffd[_0x90b4('0x3')](_0x535acc,_0x290de9);};}function removeListener(_0x382ac4,_0x169284){return function(){CmListEvents['removeListener'](_0x382ac4,_0x169284);};}exports[_0x90b4('0x4')]=function(_0x16d921){for(var _0x31a4b7=0x0,_0x165f22=events[_0x90b4('0x5')];_0x31a4b7<_0x165f22;_0x31a4b7++){var _0x3ad9d5=events[_0x31a4b7];var _0x1001fa=createListener('cmList:'+_0x3ad9d5,_0x16d921);CmListEvents['on'](_0x3ad9d5,_0x1001fa);}}; \ No newline at end of file +var _0xedce=['cmList:','./cmList.events','save','update','emit','removeListener','length'];(function(_0x4f60e4,_0x195371){var _0x5887f7=function(_0x193e6a){while(--_0x193e6a){_0x4f60e4['push'](_0x4f60e4['shift']());}};_0x5887f7(++_0x195371);}(_0xedce,0x197));var _0xeedc=function(_0x34d103,_0x362659){_0x34d103=_0x34d103-0x0;var _0x5a975d=_0xedce[_0x34d103];return _0x5a975d;};'use strict';var CmListEvents=require(_0xeedc('0x0'));var events=[_0xeedc('0x1'),'remove',_0xeedc('0x2')];function createListener(_0x371d65,_0x3a2273){return function(_0x9e6460){_0x3a2273[_0xeedc('0x3')](_0x371d65,_0x9e6460);};}function removeListener(_0x3e0732,_0x4c8bde){return function(){CmListEvents[_0xeedc('0x4')](_0x3e0732,_0x4c8bde);};}exports['register']=function(_0x24a677){for(var _0x4ad459=0x0,_0x34e645=events[_0xeedc('0x5')];_0x4ad459<_0x34e645;_0x4ad459++){var _0x12fc12=events[_0x4ad459];var _0x4a9b01=createListener(_0xeedc('0x6')+_0x12fc12,_0x24a677);CmListEvents['on'](_0x12fc12,_0x4a9b01);}}; \ No newline at end of file diff --git a/server/api/cmList/index.js b/server/api/cmList/index.js index e6bf32d..9234bf2 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 _0x7a8a=['../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/describe','/global_fields','getGlobalCustomFields','/:id','show','/:id/dispositions','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','getAgents','post','create','addDisposition','addContacts','addCustomField','/:id/users','addAgents','put','update','destroy','delete','removeAgents','multer','util','path','connect-timeout','express','Router'];(function(_0x6b3f9c,_0x433d66){var _0x4178e3=function(_0x13136f){while(--_0x13136f){_0x6b3f9c['push'](_0x6b3f9c['shift']());}};_0x4178e3(++_0x433d66);}(_0x7a8a,0xb3));var _0xa7a8=function(_0x21ecdf,_0x27b990){_0x21ecdf=_0x21ecdf-0x0;var _0x3f3a44=_0x7a8a[_0x21ecdf];return _0x3f3a44;};'use strict';var multer=require(_0xa7a8('0x0'));var util=require(_0xa7a8('0x1'));var path=require(_0xa7a8('0x2'));var timeout=require(_0xa7a8('0x3'));var express=require(_0xa7a8('0x4'));var router=express[_0xa7a8('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xa7a8('0x6'));var interaction=require(_0xa7a8('0x7'));var config=require('../../config/environment');var controller=require('./cmList.controller');router[_0xa7a8('0x8')]('/',auth[_0xa7a8('0x9')](),controller[_0xa7a8('0xa')]);router[_0xa7a8('0x8')](_0xa7a8('0xb'),auth[_0xa7a8('0x9')](),controller['describe']);router[_0xa7a8('0x8')](_0xa7a8('0xc'),auth[_0xa7a8('0x9')](),controller[_0xa7a8('0xd')]);router[_0xa7a8('0x8')](_0xa7a8('0xe'),auth[_0xa7a8('0x9')](),controller[_0xa7a8('0xf')]);router['get'](_0xa7a8('0x10'),auth[_0xa7a8('0x9')](),controller[_0xa7a8('0x11')]);router[_0xa7a8('0x8')](_0xa7a8('0x12'),auth[_0xa7a8('0x9')](),controller[_0xa7a8('0x13')]);router[_0xa7a8('0x8')](_0xa7a8('0x14'),auth['isAuthenticated'](),controller[_0xa7a8('0x15')]);router['get'](_0xa7a8('0x16'),auth[_0xa7a8('0x9')](),controller[_0xa7a8('0x17')]);router['get']('/:id/users',auth[_0xa7a8('0x9')](),controller[_0xa7a8('0x18')]);router[_0xa7a8('0x19')]('/',auth[_0xa7a8('0x9')](),controller[_0xa7a8('0x1a')]);router[_0xa7a8('0x19')](_0xa7a8('0x10'),auth[_0xa7a8('0x9')](),controller[_0xa7a8('0x1b')]);router[_0xa7a8('0x19')](_0xa7a8('0x12'),auth[_0xa7a8('0x9')](),controller[_0xa7a8('0x1c')]);router[_0xa7a8('0x19')]('/:id/fields',auth[_0xa7a8('0x9')](),controller[_0xa7a8('0x1d')]);router[_0xa7a8('0x19')](_0xa7a8('0x1e'),auth['isAuthenticated'](),controller[_0xa7a8('0x1f')]);router[_0xa7a8('0x20')](_0xa7a8('0xe'),auth[_0xa7a8('0x9')](),controller[_0xa7a8('0x21')]);router['delete']('/:id',auth[_0xa7a8('0x9')](),controller[_0xa7a8('0x22')]);router['delete'](_0xa7a8('0x10'),auth[_0xa7a8('0x9')](),controller['removeDispositions']);router[_0xa7a8('0x23')](_0xa7a8('0x1e'),auth[_0xa7a8('0x9')](),controller[_0xa7a8('0x24')]);module['exports']=router; \ No newline at end of file +var _0xdd86=['/describe','isAuthenticated','describe','/global_fields','/:id','show','getDispositions','/:id/contacts','getContacts','/:id/contacts/csv','getContactsCsv','/:id/fields','getCustomFields','/:id/users','post','addDisposition','addAgents','put','update','delete','destroy','/:id/dispositions','removeDispositions','removeAgents','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./cmList.controller','get','index'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xdd86,0x15d));var _0x6dd8=function(_0x42a09d,_0x372157){_0x42a09d=_0x42a09d-0x0;var _0x258d25=_0xdd86[_0x42a09d];return _0x258d25;};'use strict';var multer=require(_0x6dd8('0x0'));var util=require(_0x6dd8('0x1'));var path=require(_0x6dd8('0x2'));var timeout=require('connect-timeout');var express=require(_0x6dd8('0x3'));var router=express[_0x6dd8('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6dd8('0x5'));var interaction=require(_0x6dd8('0x6'));var config=require(_0x6dd8('0x7'));var controller=require(_0x6dd8('0x8'));router[_0x6dd8('0x9')]('/',auth['isAuthenticated'](),controller[_0x6dd8('0xa')]);router[_0x6dd8('0x9')](_0x6dd8('0xb'),auth[_0x6dd8('0xc')](),controller[_0x6dd8('0xd')]);router[_0x6dd8('0x9')](_0x6dd8('0xe'),auth[_0x6dd8('0xc')](),controller['getGlobalCustomFields']);router['get'](_0x6dd8('0xf'),auth[_0x6dd8('0xc')](),controller[_0x6dd8('0x10')]);router['get']('/:id/dispositions',auth[_0x6dd8('0xc')](),controller[_0x6dd8('0x11')]);router[_0x6dd8('0x9')](_0x6dd8('0x12'),auth[_0x6dd8('0xc')](),controller[_0x6dd8('0x13')]);router[_0x6dd8('0x9')](_0x6dd8('0x14'),auth['isAuthenticated'](),controller[_0x6dd8('0x15')]);router[_0x6dd8('0x9')](_0x6dd8('0x16'),auth[_0x6dd8('0xc')](),controller[_0x6dd8('0x17')]);router[_0x6dd8('0x9')](_0x6dd8('0x18'),auth[_0x6dd8('0xc')](),controller['getAgents']);router[_0x6dd8('0x19')]('/',auth[_0x6dd8('0xc')](),controller['create']);router[_0x6dd8('0x19')]('/:id/dispositions',auth[_0x6dd8('0xc')](),controller[_0x6dd8('0x1a')]);router[_0x6dd8('0x19')]('/:id/contacts',auth[_0x6dd8('0xc')](),controller['addContacts']);router[_0x6dd8('0x19')](_0x6dd8('0x16'),auth['isAuthenticated'](),controller['addCustomField']);router[_0x6dd8('0x19')]('/:id/users',auth[_0x6dd8('0xc')](),controller[_0x6dd8('0x1b')]);router[_0x6dd8('0x1c')](_0x6dd8('0xf'),auth[_0x6dd8('0xc')](),controller[_0x6dd8('0x1d')]);router[_0x6dd8('0x1e')](_0x6dd8('0xf'),auth[_0x6dd8('0xc')](),controller[_0x6dd8('0x1f')]);router['delete'](_0x6dd8('0x20'),auth[_0x6dd8('0xc')](),controller[_0x6dd8('0x21')]);router[_0x6dd8('0x1e')](_0x6dd8('0x18'),auth[_0x6dd8('0xc')](),controller[_0x6dd8('0x22')]);module[_0x6dd8('0x23')]=router; \ No newline at end of file diff --git a/server/api/condition/condition.attributes.js b/server/api/condition/condition.attributes.js index 6d4a3a8..2b49145 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 _0xe871=['VIRTUAL','getDataValue','field','STRING','sequelize','exports'];(function(_0x1da686,_0x3a128c){var _0x47d397=function(_0x55a413){while(--_0x55a413){_0x1da686['push'](_0x1da686['shift']());}};_0x47d397(++_0x3a128c);}(_0xe871,0x1e4));var _0x1e87=function(_0x1df851,_0x6f2901){_0x1df851=_0x1df851-0x0;var _0x3ca00d=_0xe871[_0x1df851];return _0x3ca00d;};'use strict';var Sequelize=require(_0x1e87('0x0'));module[_0x1e87('0x1')]={'name':{'type':Sequelize[_0x1e87('0x2')],'get':function(_0xf7d576){return this[_0x1e87('0x3')](_0x1e87('0x4'));}},'field':{'type':Sequelize[_0x1e87('0x5')],'allowNull':![]},'operator':{'type':Sequelize[_0x1e87('0x5')],'allowNull':![]},'value':{'type':Sequelize[_0x1e87('0x5')],'allowNull':![]}}; \ No newline at end of file +var _0xdff9=['exports','VIRTUAL','getDataValue','field','STRING'];(function(_0x54aae4,_0x11ed2b){var _0x3a78a6=function(_0x16c785){while(--_0x16c785){_0x54aae4['push'](_0x54aae4['shift']());}};_0x3a78a6(++_0x11ed2b);}(_0xdff9,0x1a4));var _0x9dff=function(_0x489354,_0x57c4c0){_0x489354=_0x489354-0x0;var _0x174f92=_0xdff9[_0x489354];return _0x174f92;};'use strict';var Sequelize=require('sequelize');module[_0x9dff('0x0')]={'name':{'type':Sequelize[_0x9dff('0x1')],'get':function(_0x2cbc84){return this[_0x9dff('0x2')](_0x9dff('0x3'));}},'field':{'type':Sequelize[_0x9dff('0x4')],'allowNull':![]},'operator':{'type':Sequelize['STRING'],'allowNull':![]},'value':{'type':Sequelize[_0x9dff('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 35fc169..894cd43 100644 --- a/server/api/condition/condition.controller.js +++ b/server/api/condition/condition.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','body','Condition','find','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path'];(function(_0x38a572,_0x4fc3be){var _0x501d79=function(_0x3e8195){while(--_0x3e8195){_0x38a572['push'](_0x38a572['shift']());}};_0x501d79(++_0x4fc3be);}(_0x7a54,0x106));var _0x47a5=function(_0x16996c,_0x3242a4){_0x16996c=_0x16996c-0x0;var _0x3e7c33=_0x7a54[_0x16996c];return _0x3e7c33;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x22')]=function(_0x136b14,_0x16631f){if(_0x136b14[_0x47a5('0x29')]['id']){delete _0x136b14[_0x47a5('0x29')]['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x136b14['params']['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x16631f,null))['then'](saveUpdates(_0x136b14[_0x47a5('0x29')],null))[_0x47a5('0x23')](respondWithResult(_0x16631f,null))[_0x47a5('0x2c')](handleError(_0x16631f,null));};exports['destroy']=function(_0x256650,_0x625952){return db[_0x47a5('0x2a')][_0x47a5('0x2b')]({'where':{'id':_0x256650['params']['id']}})['then'](handleEntityNotFound(_0x625952,null))[_0x47a5('0x23')](removeEntity(_0x625952,null))[_0x47a5('0x2c')](handleError(_0x625952,null));}; \ No newline at end of file +var _0x9957=['eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','reject','save','then','destroy','error','name','send','update','body','Condition','find','catch','params'];(function(_0x12a202,_0x421161){var _0x4811e4=function(_0x499751){while(--_0x499751){_0x12a202['push'](_0x12a202['shift']());}};_0x4811e4(++_0x421161);}(_0x9957,0x93));var _0x7995=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x9957[_0x6c993a];return _0x27f547;};'use strict';var emlformat=require(_0x7995('0x0'));var rimraf=require(_0x7995('0x1'));var zipdir=require(_0x7995('0x2'));var jsonpatch=require(_0x7995('0x3'));var rp=require('request-promise');var moment=require(_0x7995('0x4'));var BPromise=require(_0x7995('0x5'));var Mustache=require(_0x7995('0x6'));var util=require(_0x7995('0x7'));var path=require('path');var sox=require(_0x7995('0x8'));var csv=require(_0x7995('0x9'));var ejs=require(_0x7995('0xa'));var fs=require('fs');var fs_extra=require(_0x7995('0xb'));var _=require(_0x7995('0xc'));var squel=require(_0x7995('0xd'));var crypto=require('crypto');var jsforce=require(_0x7995('0xe'));var deskjs=require(_0x7995('0xf'));var toCsv=require('to-csv');var querystring=require(_0x7995('0x10'));var Papa=require(_0x7995('0x11'));var Redis=require(_0x7995('0x12'));var authService=require(_0x7995('0x13'));var qs=require(_0x7995('0x14'));var as=require(_0x7995('0x15'));var hardwareService=require(_0x7995('0x16'));var logger=require('../../config/logger')(_0x7995('0x17'));var utils=require(_0x7995('0x18'));var config=require('../../config/environment');var licenseUtil=require(_0x7995('0x19'));var db=require(_0x7995('0x1a'))['db'];function respondWithStatusCode(_0x19a27e,_0x385f00){_0x385f00=_0x385f00||0xcc;return function(_0x281576){if(_0x281576){return _0x19a27e[_0x7995('0x1b')](_0x385f00);}return _0x19a27e[_0x7995('0x1c')](_0x385f00)['end']();};}function respondWithResult(_0x58f5ad,_0x2b4e94){_0x2b4e94=_0x2b4e94||0xc8;return function(_0x2233dd){if(_0x2233dd){return _0x58f5ad[_0x7995('0x1c')](_0x2b4e94)[_0x7995('0x1d')](_0x2233dd);}};}function respondWithFilteredResult(_0x3f1d3e,_0x1a5310){return function(_0x2202ce){if(_0x2202ce){var _0x41cbf0=typeof _0x1a5310['offset']===_0x7995('0x1e')&&typeof _0x1a5310['limit']===_0x7995('0x1e');var _0x37f297=_0x2202ce[_0x7995('0x1f')];var _0x291317=_0x41cbf0?0x0:_0x1a5310[_0x7995('0x20')];var _0x37a7d4=_0x41cbf0?_0x2202ce['count']:_0x1a5310['offset']+_0x1a5310[_0x7995('0x21')];var _0x5e6f90;if(_0x37a7d4>=_0x37f297){_0x37a7d4=_0x37f297;_0x5e6f90=0xc8;}else{_0x5e6f90=0xce;}_0x3f1d3e['status'](_0x5e6f90);return _0x3f1d3e[_0x7995('0x22')](_0x7995('0x23'),_0x291317+'-'+_0x37a7d4+'/'+_0x37f297)['json'](_0x2202ce);}return null;};}function patchUpdates(_0x3a9b54){return function(_0x51f276){try{jsonpatch['apply'](_0x51f276,_0x3a9b54,!![]);}catch(_0x3e4c54){return BPromise[_0x7995('0x24')](_0x3e4c54);}return _0x51f276[_0x7995('0x25')]();};}function saveUpdates(_0x1a8568,_0x460924){return function(_0x1c278a){if(_0x1c278a){return _0x1c278a['update'](_0x1a8568)[_0x7995('0x26')](function(_0x46ee4b){return _0x46ee4b;});}return null;};}function removeEntity(_0x204507,_0x285437){return function(_0x563799){if(_0x563799){return _0x563799[_0x7995('0x27')]()[_0x7995('0x26')](function(){_0x204507[_0x7995('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x39df42,_0x34e70c){return function(_0x401dc3){if(!_0x401dc3){_0x39df42[_0x7995('0x1b')](0x194);}return _0x401dc3;};}function handleError(_0x3a3fcf,_0x2a307e){_0x2a307e=_0x2a307e||0x1f4;return function(_0x56691a){logger[_0x7995('0x28')](_0x56691a['stack']);if(_0x56691a[_0x7995('0x29')]){delete _0x56691a[_0x7995('0x29')];}_0x3a3fcf[_0x7995('0x1c')](_0x2a307e)[_0x7995('0x2a')](_0x56691a);};}exports[_0x7995('0x2b')]=function(_0x4b6f99,_0x9b2a15){if(_0x4b6f99['body']['id']){delete _0x4b6f99[_0x7995('0x2c')]['id'];}return db[_0x7995('0x2d')][_0x7995('0x2e')]({'where':{'id':_0x4b6f99['params']['id']}})['then'](handleEntityNotFound(_0x9b2a15,null))['then'](saveUpdates(_0x4b6f99[_0x7995('0x2c')],null))[_0x7995('0x26')](respondWithResult(_0x9b2a15,null))[_0x7995('0x2f')](handleError(_0x9b2a15,null));};exports[_0x7995('0x27')]=function(_0x2e3493,_0x1ca460){return db['Condition']['find']({'where':{'id':_0x2e3493[_0x7995('0x30')]['id']}})['then'](handleEntityNotFound(_0x1ca460,null))[_0x7995('0x26')](removeEntity(_0x1ca460,null))[_0x7995('0x2f')](handleError(_0x1ca460,null));}; \ No newline at end of file diff --git a/server/api/condition/condition.model.js b/server/api/condition/condition.model.js index 229ed4b..9e5cb5d 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 _0x17f8=['lodash','util','../../config/logger','api','bluebird','path','rimraf','../../config/environment','./condition.attributes','exports','define','Condition'];(function(_0x4a9b52,_0x4e01ea){var _0x243cfa=function(_0x3c6c2d){while(--_0x3c6c2d){_0x4a9b52['push'](_0x4a9b52['shift']());}};_0x243cfa(++_0x4e01ea);}(_0x17f8,0xa8));var _0x817f=function(_0x411d8c,_0x22d9ff){_0x411d8c=_0x411d8c-0x0;var _0x34f6e5=_0x17f8[_0x411d8c];return _0x34f6e5;};'use strict';var _=require(_0x817f('0x0'));var util=require(_0x817f('0x1'));var logger=require(_0x817f('0x2'))(_0x817f('0x3'));var moment=require('moment');var BPromise=require(_0x817f('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x817f('0x5'));var rimraf=require(_0x817f('0x6'));var config=require(_0x817f('0x7'));var attributes=require(_0x817f('0x8'));module[_0x817f('0x9')]=function(_0x5a9775,_0x5a41ba){return _0x5a9775[_0x817f('0xa')](_0x817f('0xb'),attributes,{'tableName':'tools_conditions','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x01bb=['tools_conditions','lodash','util','../../config/logger','api','request-promise','rimraf','../../config/environment','./condition.attributes','exports','define'];(function(_0x29dc35,_0x5d34ee){var _0x2b3b39=function(_0x1fcc07){while(--_0x1fcc07){_0x29dc35['push'](_0x29dc35['shift']());}};_0x2b3b39(++_0x5d34ee);}(_0x01bb,0x1a3));var _0xb01b=function(_0xbb2f72,_0x4568bb){_0xbb2f72=_0xbb2f72-0x0;var _0x3bbda4=_0x01bb[_0xbb2f72];return _0x3bbda4;};'use strict';var _=require(_0xb01b('0x0'));var util=require(_0xb01b('0x1'));var logger=require(_0xb01b('0x2'))(_0xb01b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xb01b('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb01b('0x5'));var config=require(_0xb01b('0x6'));var attributes=require(_0xb01b('0x7'));module[_0xb01b('0x8')]=function(_0x29f5c5,_0x3c750a){return _0x29f5c5[_0xb01b('0x9')]('Condition',attributes,{'tableName':_0xb01b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/condition/condition.rpc.js b/server/api/condition/condition.rpc.js index f125283..88d5713 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 _0xd43e=['Condition,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd43e,0x8b));var _0xed43=function(_0x563c6a,_0x42b20d){_0x563c6a=_0x563c6a-0x0;var _0x2eea4d=_0xd43e[_0x563c6a];return _0x2eea4d;};'use strict';var _=require(_0xed43('0x0'));var util=require(_0xed43('0x1'));var moment=require(_0xed43('0x2'));var BPromise=require(_0xed43('0x3'));var rs=require(_0xed43('0x4'));var fs=require('fs');var Redis=require(_0xed43('0x5'));var db=require(_0xed43('0x6'))['db'];var utils=require(_0xed43('0x7'));var logger=require(_0xed43('0x8'))(_0xed43('0x9'));var config=require(_0xed43('0xa'));var jayson=require(_0xed43('0xb'));var client=jayson['client'][_0xed43('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1cf308,_0x48a55d,_0x3595a5){return new BPromise(function(_0x33c70f,_0x533dfb){return client['request'](_0x1cf308,_0x3595a5)[_0xed43('0xd')](function(_0x43ba0e){logger[_0xed43('0xe')](_0xed43('0xf'),_0x48a55d,_0xed43('0x10'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x48a55d,'request\x20sent',JSON[_0xed43('0x11')](_0x43ba0e));if(_0x43ba0e[_0xed43('0x12')]){if(_0x43ba0e[_0xed43('0x12')]['code']===0x1f4){logger[_0xed43('0x12')](_0xed43('0xf'),_0x48a55d,_0x43ba0e[_0xed43('0x12')][_0xed43('0x13')]);return _0x533dfb(_0x43ba0e[_0xed43('0x12')][_0xed43('0x13')]);}logger[_0xed43('0x12')]('Condition,\x20%s,\x20%s',_0x48a55d,_0x43ba0e[_0xed43('0x12')]['message']);return _0x33c70f(_0x43ba0e[_0xed43('0x12')][_0xed43('0x13')]);}else{logger['info']('Condition,\x20%s,\x20%s',_0x48a55d,_0xed43('0x10'));_0x33c70f(_0x43ba0e[_0xed43('0x14')][_0xed43('0x13')]);}})[_0xed43('0x15')](function(_0x54d2d6){logger[_0xed43('0x12')](_0xed43('0xf'),_0x48a55d,_0x54d2d6);_0x533dfb(_0x54d2d6);});});} \ No newline at end of file +var _0xa0f7=['rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa0f7,0x1c1));var _0x7a0f=function(_0x5a37d5,_0x1473c3){_0x5a37d5=_0x5a37d5-0x0;var _0x58d45b=_0xa0f7[_0x5a37d5];return _0x58d45b;};'use strict';var _=require(_0x7a0f('0x0'));var util=require(_0x7a0f('0x1'));var moment=require(_0x7a0f('0x2'));var BPromise=require(_0x7a0f('0x3'));var rs=require(_0x7a0f('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7a0f('0x5'));var logger=require(_0x7a0f('0x6'))(_0x7a0f('0x7'));var config=require(_0x7a0f('0x8'));var jayson=require(_0x7a0f('0x9'));var client=jayson['client'][_0x7a0f('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25857f,_0x5b4ce7,_0x37ca15){return new BPromise(function(_0x1ab909,_0x19eea5){return client[_0x7a0f('0xb')](_0x25857f,_0x37ca15)[_0x7a0f('0xc')](function(_0x3340f9){logger[_0x7a0f('0xd')]('Condition,\x20%s,\x20%s',_0x5b4ce7,_0x7a0f('0xe'));logger[_0x7a0f('0xf')](_0x7a0f('0x10'),_0x5b4ce7,'request\x20sent',JSON[_0x7a0f('0x11')](_0x3340f9));if(_0x3340f9[_0x7a0f('0x12')]){if(_0x3340f9[_0x7a0f('0x12')][_0x7a0f('0x13')]===0x1f4){logger[_0x7a0f('0x12')](_0x7a0f('0x14'),_0x5b4ce7,_0x3340f9['error'][_0x7a0f('0x15')]);return _0x19eea5(_0x3340f9['error'][_0x7a0f('0x15')]);}logger[_0x7a0f('0x12')]('Condition,\x20%s,\x20%s',_0x5b4ce7,_0x3340f9[_0x7a0f('0x12')]['message']);return _0x1ab909(_0x3340f9[_0x7a0f('0x12')][_0x7a0f('0x15')]);}else{logger[_0x7a0f('0xd')](_0x7a0f('0x14'),_0x5b4ce7,_0x7a0f('0xe'));_0x1ab909(_0x3340f9[_0x7a0f('0x16')][_0x7a0f('0x15')]);}})[_0x7a0f('0x17')](function(_0x5c28c9){logger['error'](_0x7a0f('0x14'),_0x5b4ce7,_0x5c28c9);_0x19eea5(_0x5c28c9);});});} \ No newline at end of file diff --git a/server/api/condition/index.js b/server/api/condition/index.js index 6b70ff4..b897be4 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 _0x0ed0=['update','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','/:id','isAuthenticated'];(function(_0x29b865,_0x32679b){var _0x159d72=function(_0xa832){while(--_0xa832){_0x29b865['push'](_0x29b865['shift']());}};_0x159d72(++_0x32679b);}(_0x0ed0,0xe3));var _0x00ed=function(_0x49d19d,_0x38605a){_0x49d19d=_0x49d19d-0x0;var _0x3a5e21=_0x0ed0[_0x49d19d];return _0x3a5e21;};'use strict';var multer=require(_0x00ed('0x0'));var util=require(_0x00ed('0x1'));var path=require('path');var timeout=require(_0x00ed('0x2'));var express=require(_0x00ed('0x3'));var router=express[_0x00ed('0x4')]();var fs_extra=require(_0x00ed('0x5'));var auth=require(_0x00ed('0x6'));var interaction=require(_0x00ed('0x7'));var config=require(_0x00ed('0x8'));var controller=require('./condition.controller');router['put'](_0x00ed('0x9'),auth[_0x00ed('0xa')](),controller[_0x00ed('0xb')]);router[_0x00ed('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x00ed('0xd')]=router; \ No newline at end of file +var _0x01ce=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','put','isAuthenticated','update','delete','/:id','multer','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x01ce,0x108));var _0xe01c=function(_0x431e15,_0x88279e){_0x431e15=_0x431e15-0x0;var _0x4ad4b8=_0x01ce[_0x431e15];return _0x4ad4b8;};'use strict';var multer=require(_0xe01c('0x0'));var util=require('util');var path=require(_0xe01c('0x1'));var timeout=require(_0xe01c('0x2'));var express=require(_0xe01c('0x3'));var router=express[_0xe01c('0x4')]();var fs_extra=require(_0xe01c('0x5'));var auth=require(_0xe01c('0x6'));var interaction=require(_0xe01c('0x7'));var config=require(_0xe01c('0x8'));var controller=require('./condition.controller');router[_0xe01c('0x9')]('/:id',auth[_0xe01c('0xa')](),controller[_0xe01c('0xb')]);router[_0xe01c('0xc')](_0xe01c('0xd'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.attributes.js b/server/api/contactItemType/contactItemType.attributes.js index fc6d6b5..37f3bbf 100644 --- a/server/api/contactItemType/contactItemType.attributes.js +++ b/server/api/contactItemType/contactItemType.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf339=['name','INTEGER','sequelize','STRING'];(function(_0x55348f,_0x3f9678){var _0x5ea0b1=function(_0x20ce4d){while(--_0x20ce4d){_0x55348f['push'](_0x55348f['shift']());}};_0x5ea0b1(++_0x3f9678);}(_0xf339,0x92));var _0x9f33=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf339[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0x9f33('0x0'));module['exports']={'name':{'type':Sequelize[_0x9f33('0x1')],'allowNull':![],'unique':_0x9f33('0x2')},'OrderBy':{'type':Sequelize[_0x9f33('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x9f33('0x1')],'allowNull':!![]}}; \ No newline at end of file +var _0xffd4=['sequelize','STRING','name','INTEGER'];(function(_0x49bc45,_0x1adf15){var _0x27fcce=function(_0x3d34b9){while(--_0x3d34b9){_0x49bc45['push'](_0x49bc45['shift']());}};_0x27fcce(++_0x1adf15);}(_0xffd4,0x10c));var _0x4ffd=function(_0x144e54,_0x4ead7a){_0x144e54=_0x144e54-0x0;var _0xb4db2b=_0xffd4[_0x144e54];return _0xb4db2b;};'use strict';var Sequelize=require(_0x4ffd('0x0'));module['exports']={'name':{'type':Sequelize[_0x4ffd('0x1')],'allowNull':![],'unique':_0x4ffd('0x2')},'OrderBy':{'type':Sequelize[_0x4ffd('0x3')],'allowNull':!![]},'rgbBackgroundColor':{'type':Sequelize[_0x4ffd('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.controller.js b/server/api/contactItemType/contactItemType.controller.js index b14fae2..a113ce2 100644 --- a/server/api/contactItemType/contactItemType.controller.js +++ b/server/api/contactItemType/contactItemType.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaebd=['error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','apply','reject','save','update','then','get','ContactItemTypes','destroy','stack','name','send','map','ContactItemType','fieldName','type','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','rows','show','keys','rawAttributes','length','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation'];(function(_0x1cede9,_0x913a29){var _0x12a1f4=function(_0x4c857d){while(--_0x4c857d){_0x1cede9['push'](_0x1cede9['shift']());}};_0x12a1f4(++_0x913a29);}(_0xaebd,0x1e9));var _0xdaeb=function(_0x3f9a92,_0x5ed3e7){_0x3f9a92=_0x3f9a92-0x0;var _0x6b9c81=_0xaebd[_0x3f9a92];return _0x6b9c81;};'use strict';var emlformat=require(_0xdaeb('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdaeb('0x1'));var jsonpatch=require(_0xdaeb('0x2'));var rp=require(_0xdaeb('0x3'));var moment=require(_0xdaeb('0x4'));var BPromise=require(_0xdaeb('0x5'));var Mustache=require('mustache');var util=require(_0xdaeb('0x6'));var path=require(_0xdaeb('0x7'));var sox=require(_0xdaeb('0x8'));var csv=require(_0xdaeb('0x9'));var ejs=require(_0xdaeb('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdaeb('0xb'));var squel=require(_0xdaeb('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xdaeb('0xd'));var toCsv=require(_0xdaeb('0x9'));var querystring=require(_0xdaeb('0xe'));var Papa=require('papaparse');var Redis=require(_0xdaeb('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xdaeb('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdaeb('0x11'));var logger=require('../../config/logger')(_0xdaeb('0x12'));var utils=require(_0xdaeb('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xdaeb('0x14'))['db'];function respondWithStatusCode(_0x5aedaa,_0x4ee3cc){_0x4ee3cc=_0x4ee3cc||0xcc;return function(_0x2673db){if(_0x2673db){return _0x5aedaa[_0xdaeb('0x15')](_0x4ee3cc);}return _0x5aedaa[_0xdaeb('0x16')](_0x4ee3cc)[_0xdaeb('0x17')]();};}function respondWithResult(_0x1f31be,_0xc6c611){_0xc6c611=_0xc6c611||0xc8;return function(_0x49ba9a){if(_0x49ba9a){return _0x1f31be['status'](_0xc6c611)[_0xdaeb('0x18')](_0x49ba9a);}};}function respondWithFilteredResult(_0x306bdb,_0x34b2fe){return function(_0x18ec4e){if(_0x18ec4e){var _0x538a25=typeof _0x34b2fe['offset']===_0xdaeb('0x19')&&typeof _0x34b2fe['limit']==='undefined';var _0x42e509=_0x18ec4e[_0xdaeb('0x1a')];var _0x1b5243=_0x538a25?0x0:_0x34b2fe[_0xdaeb('0x1b')];var _0x2d8f11=_0x538a25?_0x18ec4e[_0xdaeb('0x1a')]:_0x34b2fe['offset']+_0x34b2fe[_0xdaeb('0x1c')];var _0x5ccf66;if(_0x2d8f11>=_0x42e509){_0x2d8f11=_0x42e509;_0x5ccf66=0xc8;}else{_0x5ccf66=0xce;}_0x306bdb[_0xdaeb('0x16')](_0x5ccf66);return _0x306bdb[_0xdaeb('0x1d')](_0xdaeb('0x1e'),_0x1b5243+'-'+_0x2d8f11+'/'+_0x42e509)['json'](_0x18ec4e);}return null;};}function patchUpdates(_0x4e97e0){return function(_0x13563c){try{jsonpatch[_0xdaeb('0x1f')](_0x13563c,_0x4e97e0,!![]);}catch(_0x23fccb){return BPromise[_0xdaeb('0x20')](_0x23fccb);}return _0x13563c[_0xdaeb('0x21')]();};}function saveUpdates(_0x536aae,_0x597bb7){return function(_0x2c969d){if(_0x2c969d){return _0x2c969d[_0xdaeb('0x22')](_0x536aae)[_0xdaeb('0x23')](function(_0x1d919a){return _0x1d919a;});}return null;};}function removeEntity(_0x39dfae,_0x55c825){return function(_0x254c3b){if(_0x254c3b){return _0x254c3b['destroy']()[_0xdaeb('0x23')](function(){var _0x398616=_0x254c3b[_0xdaeb('0x24')]({'plain':!![]});var _0x3b0770=_0xdaeb('0x25');return db['UserProfileResource'][_0xdaeb('0x26')]({'where':{'type':_0x3b0770,'resourceId':_0x398616['id']}})[_0xdaeb('0x23')](function(){return _0x254c3b;});})[_0xdaeb('0x23')](function(){_0x39dfae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x43095f,_0x4e7f44){return function(_0x5045f8){if(!_0x5045f8){_0x43095f[_0xdaeb('0x15')](0x194);}return _0x5045f8;};}function handleError(_0x1ff9af,_0x3e2b8c){_0x3e2b8c=_0x3e2b8c||0x1f4;return function(_0x5eb7b5){logger['error'](_0x5eb7b5[_0xdaeb('0x27')]);if(_0x5eb7b5[_0xdaeb('0x28')]){delete _0x5eb7b5[_0xdaeb('0x28')];}_0x1ff9af['status'](_0x3e2b8c)[_0xdaeb('0x29')](_0x5eb7b5);};}exports['index']=function(_0x4da82d,_0x28812c){var _0x21f6cf={},_0x2fb019={},_0x28c15c={'count':0x0,'rows':[]};var _0x3276c2=_[_0xdaeb('0x2a')](db[_0xdaeb('0x2b')]['rawAttributes'],function(_0x1c1c7c){return{'name':_0x1c1c7c[_0xdaeb('0x2c')],'type':_0x1c1c7c[_0xdaeb('0x2d')][_0xdaeb('0x2e')]};});_0x2fb019[_0xdaeb('0x2f')]=_['map'](_0x3276c2,_0xdaeb('0x28'));_0x2fb019[_0xdaeb('0x30')]=_['keys'](_0x4da82d[_0xdaeb('0x30')]);_0x2fb019[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x2fb019[_0xdaeb('0x2f')],_0x2fb019[_0xdaeb('0x30')]);_0x21f6cf[_0xdaeb('0x33')]=_[_0xdaeb('0x32')](_0x2fb019[_0xdaeb('0x2f')],qs[_0xdaeb('0x34')](_0x4da82d[_0xdaeb('0x30')]['fields']));_0x21f6cf['attributes']=_0x21f6cf[_0xdaeb('0x33')]['length']?_0x21f6cf[_0xdaeb('0x33')]:_0x2fb019[_0xdaeb('0x2f')];if(!_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x35')](_0xdaeb('0x36'))){_0x21f6cf[_0xdaeb('0x1c')]=qs['limit'](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x1c')]);_0x21f6cf[_0xdaeb('0x1b')]=qs['offset'](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x1b')]);}_0x21f6cf[_0xdaeb('0x37')]=qs[_0xdaeb('0x38')](_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x38')]);_0x21f6cf[_0xdaeb('0x39')]=qs['filters'](_[_0xdaeb('0x3a')](_0x4da82d[_0xdaeb('0x30')],_0x2fb019['filters']),_0x3276c2);if(_0x4da82d['query'][_0xdaeb('0x3b')]){_0x21f6cf[_0xdaeb('0x39')]=_['merge'](_0x21f6cf[_0xdaeb('0x39')],{'$or':_[_0xdaeb('0x2a')](_0x3276c2,function(_0x5a4de2){if(_0x5a4de2[_0xdaeb('0x2d')]!==_0xdaeb('0x3c')){var _0x4ecba7={};_0x4ecba7[_0x5a4de2['name']]={'$like':'%'+_0x4da82d[_0xdaeb('0x30')][_0xdaeb('0x3b')]+'%'};return _0x4ecba7;}})});}_0x21f6cf=_[_0xdaeb('0x3d')]({},_0x21f6cf,_0x4da82d[_0xdaeb('0x3e')]);var _0x2ea883={'where':_0x21f6cf[_0xdaeb('0x39')]};return db['ContactItemType'][_0xdaeb('0x1a')](_0x2ea883)['then'](function(_0x46aa44){_0x28c15c['count']=_0x46aa44;if(_0x4da82d['query'][_0xdaeb('0x3f')]){_0x21f6cf['include']=[{'all':!![]}];}return db[_0xdaeb('0x2b')]['findAll'](_0x21f6cf);})[_0xdaeb('0x23')](function(_0x244369){_0x28c15c[_0xdaeb('0x40')]=_0x244369;return _0x28c15c;})[_0xdaeb('0x23')](respondWithFilteredResult(_0x28812c,_0x21f6cf))['catch'](handleError(_0x28812c,null));};exports[_0xdaeb('0x41')]=function(_0x5a4b41,_0x3cc6a4){var _0xfb250e={'raw':!![],'where':{'id':_0x5a4b41['params']['id']}},_0x447ef0={};_0x447ef0[_0xdaeb('0x2f')]=_[_0xdaeb('0x42')](db[_0xdaeb('0x2b')][_0xdaeb('0x43')]);_0x447ef0[_0xdaeb('0x30')]=_[_0xdaeb('0x42')](_0x5a4b41[_0xdaeb('0x30')]);_0x447ef0[_0xdaeb('0x31')]=_[_0xdaeb('0x32')](_0x447ef0[_0xdaeb('0x2f')],_0x447ef0[_0xdaeb('0x30')]);_0xfb250e[_0xdaeb('0x33')]=_['intersection'](_0x447ef0[_0xdaeb('0x2f')],qs[_0xdaeb('0x34')](_0x5a4b41['query']['fields']));_0xfb250e[_0xdaeb('0x33')]=_0xfb250e[_0xdaeb('0x33')][_0xdaeb('0x44')]?_0xfb250e['attributes']:_0x447ef0[_0xdaeb('0x2f')];if(_0x5a4b41[_0xdaeb('0x30')][_0xdaeb('0x3f')]){_0xfb250e[_0xdaeb('0x45')]=[{'all':!![]}];}_0xfb250e=_[_0xdaeb('0x3d')]({},_0xfb250e,_0x5a4b41[_0xdaeb('0x3e')]);return db[_0xdaeb('0x2b')][_0xdaeb('0x46')](_0xfb250e)['then'](handleEntityNotFound(_0x3cc6a4,null))[_0xdaeb('0x23')](respondWithResult(_0x3cc6a4,null))[_0xdaeb('0x47')](handleError(_0x3cc6a4,null));};exports['create']=function(_0x38d2ee,_0x4dd70c){return db[_0xdaeb('0x2b')][_0xdaeb('0x48')](_0x38d2ee[_0xdaeb('0x49')],{})[_0xdaeb('0x23')](function(_0x5df403){var _0x449f64=_0x38d2ee[_0xdaeb('0x4a')][_0xdaeb('0x24')]({'plain':!![]});if(!_0x449f64)throw new Error(_0xdaeb('0x4b'));if(_0x449f64['role']==='user'){var _0x1403c8=_0x5df403[_0xdaeb('0x24')]({'plain':!![]});var _0x311219=_0xdaeb('0x25');return db[_0xdaeb('0x4c')][_0xdaeb('0x46')]({'where':{'name':_0x311219,'userProfileId':_0x449f64['userProfileId']},'raw':!![]})[_0xdaeb('0x23')](function(_0x42af1a){if(_0x42af1a&&_0x42af1a[_0xdaeb('0x4d')]===0x0){return db['UserProfileResource'][_0xdaeb('0x48')]({'name':_0x1403c8['name'],'resourceId':_0x1403c8['id'],'type':_0x42af1a[_0xdaeb('0x28')],'sectionId':_0x42af1a['id']},{})[_0xdaeb('0x23')](function(){return _0x5df403;});}else{return _0x5df403;}})[_0xdaeb('0x47')](function(_0x395e2c){logger[_0xdaeb('0x4e')](_0xdaeb('0x4f'),_0x395e2c);throw _0x395e2c;});}return _0x5df403;})['then'](respondWithResult(_0x4dd70c,0xc9))['catch'](handleError(_0x4dd70c,null));};exports['update']=function(_0x2260c5,_0x10287e){if(_0x2260c5['body']['id']){delete _0x2260c5['body']['id'];}return db['ContactItemType'][_0xdaeb('0x46')]({'where':{'id':_0x2260c5[_0xdaeb('0x50')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x10287e,null))[_0xdaeb('0x23')](saveUpdates(_0x2260c5[_0xdaeb('0x49')],null))['then'](respondWithResult(_0x10287e,null))[_0xdaeb('0x47')](handleError(_0x10287e,null));};exports['destroy']=function(_0x25e58f,_0x1b87b2){return db[_0xdaeb('0x2b')][_0xdaeb('0x46')]({'where':{'id':_0x25e58f[_0xdaeb('0x50')]['id']}})[_0xdaeb('0x23')](handleEntityNotFound(_0x1b87b2,null))['then'](db['CmContactHasItem'][_0xdaeb('0x22')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x25e58f['params']['id']}}))[_0xdaeb('0x23')](removeEntity(_0x1b87b2,null))[_0xdaeb('0x47')](handleError(_0x1b87b2,null));}; \ No newline at end of file +var _0x8e3f=['model','fields','hasOwnProperty','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','rawAttributes','length','find','catch','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','util','path','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','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','destroy','then','get','ContactItemTypes','UserProfileResource','error','name','send','map','ContactItemType','fieldName','query','keys','filters','attributes','intersection'];(function(_0x193e71,_0x393d94){var _0x17ae12=function(_0x59663f){while(--_0x59663f){_0x193e71['push'](_0x193e71['shift']());}};_0x17ae12(++_0x393d94);}(_0x8e3f,0xc1));var _0xf8e3=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x8e3f[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xf8e3('0x0'));var rimraf=require(_0xf8e3('0x1'));var zipdir=require(_0xf8e3('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xf8e3('0x3'));var moment=require(_0xf8e3('0x4'));var BPromise=require(_0xf8e3('0x5'));var Mustache=require('mustache');var util=require(_0xf8e3('0x6'));var path=require(_0xf8e3('0x7'));var sox=require('sox');var csv=require(_0xf8e3('0x8'));var ejs=require(_0xf8e3('0x9'));var fs=require('fs');var fs_extra=require(_0xf8e3('0xa'));var _=require(_0xf8e3('0xb'));var squel=require('squel');var crypto=require(_0xf8e3('0xc'));var jsforce=require(_0xf8e3('0xd'));var deskjs=require(_0xf8e3('0xe'));var toCsv=require(_0xf8e3('0x8'));var querystring=require(_0xf8e3('0xf'));var Papa=require(_0xf8e3('0x10'));var Redis=require(_0xf8e3('0x11'));var authService=require(_0xf8e3('0x12'));var qs=require(_0xf8e3('0x13'));var as=require(_0xf8e3('0x14'));var hardwareService=require(_0xf8e3('0x15'));var logger=require(_0xf8e3('0x16'))('api');var utils=require(_0xf8e3('0x17'));var config=require(_0xf8e3('0x18'));var licenseUtil=require(_0xf8e3('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x40ae02,_0x41f85e){_0x41f85e=_0x41f85e||0xcc;return function(_0x336790){if(_0x336790){return _0x40ae02[_0xf8e3('0x1a')](_0x41f85e);}return _0x40ae02['status'](_0x41f85e)[_0xf8e3('0x1b')]();};}function respondWithResult(_0xa856f5,_0x2fe631){_0x2fe631=_0x2fe631||0xc8;return function(_0x4af736){if(_0x4af736){return _0xa856f5[_0xf8e3('0x1c')](_0x2fe631)['json'](_0x4af736);}};}function respondWithFilteredResult(_0x1ec773,_0x40c196){return function(_0x460629){if(_0x460629){var _0x570ee3=typeof _0x40c196['offset']===_0xf8e3('0x1d')&&typeof _0x40c196[_0xf8e3('0x1e')]===_0xf8e3('0x1d');var _0x3b01ac=_0x460629[_0xf8e3('0x1f')];var _0x11d4cc=_0x570ee3?0x0:_0x40c196[_0xf8e3('0x20')];var _0x2e27e3=_0x570ee3?_0x460629[_0xf8e3('0x1f')]:_0x40c196[_0xf8e3('0x20')]+_0x40c196['limit'];var _0x20cc64;if(_0x2e27e3>=_0x3b01ac){_0x2e27e3=_0x3b01ac;_0x20cc64=0xc8;}else{_0x20cc64=0xce;}_0x1ec773[_0xf8e3('0x1c')](_0x20cc64);return _0x1ec773[_0xf8e3('0x21')](_0xf8e3('0x22'),_0x11d4cc+'-'+_0x2e27e3+'/'+_0x3b01ac)[_0xf8e3('0x23')](_0x460629);}return null;};}function patchUpdates(_0x11c58e){return function(_0x1cae53){try{jsonpatch[_0xf8e3('0x24')](_0x1cae53,_0x11c58e,!![]);}catch(_0x5b99b1){return BPromise[_0xf8e3('0x25')](_0x5b99b1);}return _0x1cae53[_0xf8e3('0x26')]();};}function saveUpdates(_0x3c636d,_0xccbcc0){return function(_0x4a1e5f){if(_0x4a1e5f){return _0x4a1e5f[_0xf8e3('0x27')](_0x3c636d)['then'](function(_0x286059){return _0x286059;});}return null;};}function removeEntity(_0x225a1b,_0x33d526){return function(_0x2dc856){if(_0x2dc856){return _0x2dc856[_0xf8e3('0x28')]()[_0xf8e3('0x29')](function(){var _0x512a83=_0x2dc856[_0xf8e3('0x2a')]({'plain':!![]});var _0x2fc674=_0xf8e3('0x2b');return db[_0xf8e3('0x2c')][_0xf8e3('0x28')]({'where':{'type':_0x2fc674,'resourceId':_0x512a83['id']}})[_0xf8e3('0x29')](function(){return _0x2dc856;});})[_0xf8e3('0x29')](function(){_0x225a1b[_0xf8e3('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x356e0a,_0x3d5a27){return function(_0x12ebd2){if(!_0x12ebd2){_0x356e0a[_0xf8e3('0x1a')](0x194);}return _0x12ebd2;};}function handleError(_0x15b28c,_0x14cb5a){_0x14cb5a=_0x14cb5a||0x1f4;return function(_0x16485e){logger[_0xf8e3('0x2d')](_0x16485e['stack']);if(_0x16485e[_0xf8e3('0x2e')]){delete _0x16485e[_0xf8e3('0x2e')];}_0x15b28c[_0xf8e3('0x1c')](_0x14cb5a)[_0xf8e3('0x2f')](_0x16485e);};}exports['index']=function(_0x2e507c,_0x10cf28){var _0x40f64d={},_0x45df49={},_0x33f208={'count':0x0,'rows':[]};var _0x46c85d=_[_0xf8e3('0x30')](db[_0xf8e3('0x31')]['rawAttributes'],function(_0x2c07bf){return{'name':_0x2c07bf[_0xf8e3('0x32')],'type':_0x2c07bf['type']['key']};});_0x45df49['model']=_[_0xf8e3('0x30')](_0x46c85d,'name');_0x45df49[_0xf8e3('0x33')]=_[_0xf8e3('0x34')](_0x2e507c[_0xf8e3('0x33')]);_0x45df49[_0xf8e3('0x35')]=_['intersection'](_0x45df49['model'],_0x45df49[_0xf8e3('0x33')]);_0x40f64d[_0xf8e3('0x36')]=_[_0xf8e3('0x37')](_0x45df49[_0xf8e3('0x38')],qs[_0xf8e3('0x39')](_0x2e507c[_0xf8e3('0x33')]['fields']));_0x40f64d[_0xf8e3('0x36')]=_0x40f64d['attributes']['length']?_0x40f64d[_0xf8e3('0x36')]:_0x45df49[_0xf8e3('0x38')];if(!_0x2e507c[_0xf8e3('0x33')][_0xf8e3('0x3a')]('nolimit')){_0x40f64d['limit']=qs[_0xf8e3('0x1e')](_0x2e507c[_0xf8e3('0x33')]['limit']);_0x40f64d[_0xf8e3('0x20')]=qs[_0xf8e3('0x20')](_0x2e507c[_0xf8e3('0x33')][_0xf8e3('0x20')]);}_0x40f64d['order']=qs['sort'](_0x2e507c['query'][_0xf8e3('0x3b')]);_0x40f64d[_0xf8e3('0x3c')]=qs[_0xf8e3('0x35')](_[_0xf8e3('0x3d')](_0x2e507c['query'],_0x45df49[_0xf8e3('0x35')]),_0x46c85d);if(_0x2e507c['query'][_0xf8e3('0x3e')]){_0x40f64d[_0xf8e3('0x3c')]=_[_0xf8e3('0x3f')](_0x40f64d[_0xf8e3('0x3c')],{'$or':_[_0xf8e3('0x30')](_0x46c85d,function(_0x34a6ba){if(_0x34a6ba[_0xf8e3('0x40')]!==_0xf8e3('0x41')){var _0x17c9b1={};_0x17c9b1[_0x34a6ba['name']]={'$like':'%'+_0x2e507c[_0xf8e3('0x33')]['filter']+'%'};return _0x17c9b1;}})});}_0x40f64d=_[_0xf8e3('0x3f')]({},_0x40f64d,_0x2e507c[_0xf8e3('0x42')]);var _0x322128={'where':_0x40f64d[_0xf8e3('0x3c')]};return db[_0xf8e3('0x31')][_0xf8e3('0x1f')](_0x322128)[_0xf8e3('0x29')](function(_0x2f05b7){_0x33f208['count']=_0x2f05b7;if(_0x2e507c[_0xf8e3('0x33')][_0xf8e3('0x43')]){_0x40f64d[_0xf8e3('0x44')]=[{'all':!![]}];}return db[_0xf8e3('0x31')][_0xf8e3('0x45')](_0x40f64d);})[_0xf8e3('0x29')](function(_0x792190){_0x33f208[_0xf8e3('0x46')]=_0x792190;return _0x33f208;})['then'](respondWithFilteredResult(_0x10cf28,_0x40f64d))['catch'](handleError(_0x10cf28,null));};exports['show']=function(_0x30fecf,_0x3d3ea5){var _0x5056bc={'raw':!![],'where':{'id':_0x30fecf['params']['id']}},_0x181908={};_0x181908[_0xf8e3('0x38')]=_[_0xf8e3('0x34')](db['ContactItemType'][_0xf8e3('0x47')]);_0x181908['query']=_[_0xf8e3('0x34')](_0x30fecf[_0xf8e3('0x33')]);_0x181908['filters']=_[_0xf8e3('0x37')](_0x181908[_0xf8e3('0x38')],_0x181908[_0xf8e3('0x33')]);_0x5056bc[_0xf8e3('0x36')]=_['intersection'](_0x181908['model'],qs['fields'](_0x30fecf[_0xf8e3('0x33')][_0xf8e3('0x39')]));_0x5056bc[_0xf8e3('0x36')]=_0x5056bc['attributes'][_0xf8e3('0x48')]?_0x5056bc['attributes']:_0x181908[_0xf8e3('0x38')];if(_0x30fecf[_0xf8e3('0x33')]['includeAll']){_0x5056bc['include']=[{'all':!![]}];}_0x5056bc=_[_0xf8e3('0x3f')]({},_0x5056bc,_0x30fecf[_0xf8e3('0x42')]);return db[_0xf8e3('0x31')][_0xf8e3('0x49')](_0x5056bc)[_0xf8e3('0x29')](handleEntityNotFound(_0x3d3ea5,null))[_0xf8e3('0x29')](respondWithResult(_0x3d3ea5,null))[_0xf8e3('0x4a')](handleError(_0x3d3ea5,null));};exports[_0xf8e3('0x4b')]=function(_0xdc2430,_0x81898e){return db[_0xf8e3('0x31')]['create'](_0xdc2430[_0xf8e3('0x4c')],{})[_0xf8e3('0x29')](function(_0x20195b){var _0x458188=_0xdc2430[_0xf8e3('0x4d')][_0xf8e3('0x2a')]({'plain':!![]});if(!_0x458188)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x458188[_0xf8e3('0x4e')]===_0xf8e3('0x4d')){var _0x39caae=_0x20195b[_0xf8e3('0x2a')]({'plain':!![]});var _0x2ee5fb=_0xf8e3('0x2b');return db['UserProfileSection'][_0xf8e3('0x49')]({'where':{'name':_0x2ee5fb,'userProfileId':_0x458188[_0xf8e3('0x4f')]},'raw':!![]})[_0xf8e3('0x29')](function(_0x252c4d){if(_0x252c4d&&_0x252c4d[_0xf8e3('0x50')]===0x0){return db[_0xf8e3('0x2c')]['create']({'name':_0x39caae[_0xf8e3('0x2e')],'resourceId':_0x39caae['id'],'type':_0x252c4d[_0xf8e3('0x2e')],'sectionId':_0x252c4d['id']},{})[_0xf8e3('0x29')](function(){return _0x20195b;});}else{return _0x20195b;}})[_0xf8e3('0x4a')](function(_0x452b00){logger['error'](_0xf8e3('0x51'),_0x452b00);throw _0x452b00;});}return _0x20195b;})[_0xf8e3('0x29')](respondWithResult(_0x81898e,0xc9))[_0xf8e3('0x4a')](handleError(_0x81898e,null));};exports['update']=function(_0x5b78e6,_0x371dfe){if(_0x5b78e6[_0xf8e3('0x4c')]['id']){delete _0x5b78e6[_0xf8e3('0x4c')]['id'];}return db[_0xf8e3('0x31')]['find']({'where':{'id':_0x5b78e6[_0xf8e3('0x52')]['id']}})[_0xf8e3('0x29')](handleEntityNotFound(_0x371dfe,null))['then'](saveUpdates(_0x5b78e6['body'],null))[_0xf8e3('0x29')](respondWithResult(_0x371dfe,null))[_0xf8e3('0x4a')](handleError(_0x371dfe,null));};exports[_0xf8e3('0x28')]=function(_0x505477,_0x5579cb){return db['ContactItemType'][_0xf8e3('0x49')]({'where':{'id':_0x505477[_0xf8e3('0x52')]['id']}})['then'](handleEntityNotFound(_0x5579cb,null))['then'](db['CmContactHasItem'][_0xf8e3('0x27')]({'ItemTypeId':null},{'where':{'ItemTypeId':_0x505477[_0xf8e3('0x52')]['id']}}))['then'](removeEntity(_0x5579cb,null))[_0xf8e3('0x4a')](handleError(_0x5579cb,null));}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.model.js b/server/api/contactItemType/contactItemType.model.js index 1504c8c..9aa85ad 100644 --- a/server/api/contactItemType/contactItemType.model.js +++ b/server/api/contactItemType/contactItemType.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x84c0=['api','moment','bluebird','path','rimraf','../../config/environment','./contactItemType.attributes','define','ContactItemType','lodash','util','../../config/logger'];(function(_0x45471b,_0x597cb1){var _0x36c607=function(_0x509915){while(--_0x509915){_0x45471b['push'](_0x45471b['shift']());}};_0x36c607(++_0x597cb1);}(_0x84c0,0xb1));var _0x084c=function(_0x38e0aa,_0x320295){_0x38e0aa=_0x38e0aa-0x0;var _0x239971=_0x84c0[_0x38e0aa];return _0x239971;};'use strict';var _=require(_0x084c('0x0'));var util=require(_0x084c('0x1'));var logger=require(_0x084c('0x2'))(_0x084c('0x3'));var moment=require(_0x084c('0x4'));var BPromise=require(_0x084c('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x084c('0x6'));var rimraf=require(_0x084c('0x7'));var config=require(_0x084c('0x8'));var attributes=require(_0x084c('0x9'));module['exports']=function(_0x3d73b1,_0x551da1){return _0x3d73b1[_0x084c('0xa')](_0x084c('0xb'),attributes,{'tableName':'tools_contact_item_types','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc0a2=['path','rimraf','../../config/environment','./contactItemType.attributes','ContactItemType','tools_contact_item_types','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x4bbfde,_0x18e9b6){var _0x4e561d=function(_0x11cc6f){while(--_0x11cc6f){_0x4bbfde['push'](_0x4bbfde['shift']());}};_0x4e561d(++_0x18e9b6);}(_0xc0a2,0x124));var _0x2c0a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc0a2[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x2c0a('0x0'));var logger=require(_0x2c0a('0x1'))('api');var moment=require(_0x2c0a('0x2'));var BPromise=require(_0x2c0a('0x3'));var rp=require(_0x2c0a('0x4'));var fs=require('fs');var path=require(_0x2c0a('0x5'));var rimraf=require(_0x2c0a('0x6'));var config=require(_0x2c0a('0x7'));var attributes=require(_0x2c0a('0x8'));module['exports']=function(_0x4af2cf,_0x2e382a){return _0x4af2cf['define'](_0x2c0a('0x9'),attributes,{'tableName':_0x2c0a('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/contactItemType/contactItemType.rpc.js b/server/api/contactItemType/contactItemType.rpc.js index fd9f763..c8ab147 100644 --- a/server/api/contactItemType/contactItemType.rpc.js +++ b/server/api/contactItemType/contactItemType.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8a83=['request','then','info','ContactItemType,\x20%s,\x20%s','request\x20sent','debug','ContactItemType,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x8a83,0x10a));var _0x38a8=function(_0x2c9b79,_0x7cf58b){_0x2c9b79=_0x2c9b79-0x0;var _0x265032=_0x8a83[_0x2c9b79];return _0x265032;};'use strict';var _=require('lodash');var util=require(_0x38a8('0x0'));var moment=require(_0x38a8('0x1'));var BPromise=require(_0x38a8('0x2'));var rs=require(_0x38a8('0x3'));var fs=require('fs');var Redis=require(_0x38a8('0x4'));var db=require(_0x38a8('0x5'))['db'];var utils=require(_0x38a8('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x38a8('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x38a8('0x8')][_0x38a8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xd1304b,_0x11deeb,_0x5cdec7){return new BPromise(function(_0x27c04b,_0x95a860){return client[_0x38a8('0xa')](_0xd1304b,_0x5cdec7)[_0x38a8('0xb')](function(_0x599f01){logger[_0x38a8('0xc')](_0x38a8('0xd'),_0x11deeb,_0x38a8('0xe'));logger[_0x38a8('0xf')](_0x38a8('0x10'),_0x11deeb,_0x38a8('0xe'),JSON[_0x38a8('0x11')](_0x599f01));if(_0x599f01['error']){if(_0x599f01[_0x38a8('0x12')][_0x38a8('0x13')]===0x1f4){logger[_0x38a8('0x12')](_0x38a8('0xd'),_0x11deeb,_0x599f01[_0x38a8('0x12')]['message']);return _0x95a860(_0x599f01[_0x38a8('0x12')][_0x38a8('0x14')]);}logger[_0x38a8('0x12')](_0x38a8('0xd'),_0x11deeb,_0x599f01[_0x38a8('0x12')][_0x38a8('0x14')]);return _0x27c04b(_0x599f01[_0x38a8('0x12')][_0x38a8('0x14')]);}else{logger[_0x38a8('0xc')]('ContactItemType,\x20%s,\x20%s',_0x11deeb,'request\x20sent');_0x27c04b(_0x599f01[_0x38a8('0x15')]['message']);}})[_0x38a8('0x16')](function(_0x1e53cb){logger[_0x38a8('0x12')](_0x38a8('0xd'),_0x11deeb,_0x1e53cb);_0x95a860(_0x1e53cb);});});} \ No newline at end of file +var _0x2064=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','ContactItemType,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x3164af,_0x2bb592){var _0x1f0f4b=function(_0x1d8391){while(--_0x1d8391){_0x3164af['push'](_0x3164af['shift']());}};_0x1f0f4b(++_0x2bb592);}(_0x2064,0x79));var _0x4206=function(_0x10fc8b,_0xb7fca){_0x10fc8b=_0x10fc8b-0x0;var _0x4b8c84=_0x2064[_0x10fc8b];return _0x4b8c84;};'use strict';var _=require(_0x4206('0x0'));var util=require(_0x4206('0x1'));var moment=require(_0x4206('0x2'));var BPromise=require(_0x4206('0x3'));var rs=require(_0x4206('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4206('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x4206('0x6'))(_0x4206('0x7'));var config=require(_0x4206('0x8'));var jayson=require(_0x4206('0x9'));var client=jayson['client'][_0x4206('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x476220,_0x4589bf,_0x48af9a){return new BPromise(function(_0x2c2ca3,_0x599891){return client[_0x4206('0xb')](_0x476220,_0x48af9a)['then'](function(_0x25b45a){logger[_0x4206('0xc')](_0x4206('0xd'),_0x4589bf,_0x4206('0xe'));logger['debug']('ContactItemType,\x20%s,\x20%s,\x20%s',_0x4589bf,'request\x20sent',JSON[_0x4206('0xf')](_0x25b45a));if(_0x25b45a['error']){if(_0x25b45a[_0x4206('0x10')][_0x4206('0x11')]===0x1f4){logger[_0x4206('0x10')](_0x4206('0xd'),_0x4589bf,_0x25b45a[_0x4206('0x10')][_0x4206('0x12')]);return _0x599891(_0x25b45a[_0x4206('0x10')][_0x4206('0x12')]);}logger[_0x4206('0x10')](_0x4206('0xd'),_0x4589bf,_0x25b45a[_0x4206('0x10')][_0x4206('0x12')]);return _0x2c2ca3(_0x25b45a[_0x4206('0x10')][_0x4206('0x12')]);}else{logger[_0x4206('0xc')](_0x4206('0xd'),_0x4589bf,'request\x20sent');_0x2c2ca3(_0x25b45a[_0x4206('0x13')][_0x4206('0x12')]);}})[_0x4206('0x14')](function(_0x4a6ab2){logger[_0x4206('0x10')](_0x4206('0xd'),_0x4589bf,_0x4a6ab2);_0x599891(_0x4a6ab2);});});} \ No newline at end of file diff --git a/server/api/contactItemType/index.js b/server/api/contactItemType/index.js index 891b081..5b89b21 100644 --- a/server/api/contactItemType/index.js +++ b/server/api/contactItemType/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4240=['post','create','put','destroy','exports','multer','util','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./contactItemType.controller','isAuthenticated','index','get','/:id'];(function(_0xe896bf,_0x4f8e5e){var _0x4c7a8a=function(_0x410ff2){while(--_0x410ff2){_0xe896bf['push'](_0xe896bf['shift']());}};_0x4c7a8a(++_0x4f8e5e);}(_0x4240,0x159));var _0x0424=function(_0x4e7cd2,_0x53fac0){_0x4e7cd2=_0x4e7cd2-0x0;var _0x52bb07=_0x4240[_0x4e7cd2];return _0x52bb07;};'use strict';var multer=require(_0x0424('0x0'));var util=require(_0x0424('0x1'));var path=require('path');var timeout=require(_0x0424('0x2'));var express=require('express');var router=express[_0x0424('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0424('0x4'));var interaction=require(_0x0424('0x5'));var config=require(_0x0424('0x6'));var controller=require(_0x0424('0x7'));router['get']('/',auth[_0x0424('0x8')](),controller[_0x0424('0x9')]);router[_0x0424('0xa')](_0x0424('0xb'),auth[_0x0424('0x8')](),controller['show']);router[_0x0424('0xc')]('/',auth[_0x0424('0x8')](),controller[_0x0424('0xd')]);router[_0x0424('0xe')]('/:id',auth[_0x0424('0x8')](),controller['update']);router['delete'](_0x0424('0xb'),auth[_0x0424('0x8')](),controller[_0x0424('0xf')]);module[_0x0424('0x10')]=router; \ No newline at end of file +var _0x2373=['exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','get','/:id','show','post','put','update','destroy'];(function(_0x466c86,_0x960bf6){var _0x55bdfc=function(_0x4408ef){while(--_0x4408ef){_0x466c86['push'](_0x466c86['shift']());}};_0x55bdfc(++_0x960bf6);}(_0x2373,0x199));var _0x3237=function(_0xc68ff0,_0x296c63){_0xc68ff0=_0xc68ff0-0x0;var _0x47fb82=_0x2373[_0xc68ff0];return _0x47fb82;};'use strict';var multer=require(_0x3237('0x0'));var util=require(_0x3237('0x1'));var path=require('path');var timeout=require(_0x3237('0x2'));var express=require(_0x3237('0x3'));var router=express[_0x3237('0x4')]();var fs_extra=require(_0x3237('0x5'));var auth=require(_0x3237('0x6'));var interaction=require(_0x3237('0x7'));var config=require('../../config/environment');var controller=require('./contactItemType.controller');router['get']('/',auth[_0x3237('0x8')](),controller['index']);router[_0x3237('0x9')](_0x3237('0xa'),auth[_0x3237('0x8')](),controller[_0x3237('0xb')]);router[_0x3237('0xc')]('/',auth[_0x3237('0x8')](),controller['create']);router[_0x3237('0xd')](_0x3237('0xa'),auth[_0x3237('0x8')](),controller[_0x3237('0xe')]);router['delete'](_0x3237('0xa'),auth[_0x3237('0x8')](),controller[_0x3237('0xf')]);module[_0x3237('0x10')]=router; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.attributes.js b/server/api/dashboard/dashboard.attributes.js index 43cb246..c06ac20 100644 --- a/server/api/dashboard/dashboard.attributes.js +++ b/server/api/dashboard/dashboard.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbaf0=['name','exports','STRING'];(function(_0x15ec4e,_0x40b7e0){var _0xb5e5dd=function(_0x42bdd7){while(--_0x42bdd7){_0x15ec4e['push'](_0x15ec4e['shift']());}};_0xb5e5dd(++_0x40b7e0);}(_0xbaf0,0x12a));var _0x0baf=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xbaf0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require('sequelize');module[_0x0baf('0x0')]={'name':{'type':Sequelize[_0x0baf('0x1')],'allowNull':![],'unique':_0x0baf('0x2')},'description':{'type':Sequelize[_0x0baf('0x1')]}}; \ No newline at end of file +var _0xe706=['STRING','sequelize','exports'];(function(_0x2d7f0e,_0x3e6fbd){var _0x110b07=function(_0x557b00){while(--_0x557b00){_0x2d7f0e['push'](_0x2d7f0e['shift']());}};_0x110b07(++_0x3e6fbd);}(_0xe706,0xa3));var _0x6e70=function(_0xa650d8,_0x6d01ef){_0xa650d8=_0xa650d8-0x0;var _0x79ce97=_0xe706[_0xa650d8];return _0x79ce97;};'use strict';var Sequelize=require(_0x6e70('0x0'));module[_0x6e70('0x1')]={'name':{'type':Sequelize[_0x6e70('0x2')],'allowNull':![],'unique':'name'},'description':{'type':Sequelize[_0x6e70('0x2')]}}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.controller.js b/server/api/dashboard/dashboard.controller.js index b6cd92c..e219d55 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 _0xddbc=['rows','catch','show','rawAttributes','length','merge','options','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','clone','omit','createdAt','updatedAt','body','update','params','iframe','attrUrl','attrs','value','attrPath','clock','attrHourFormat','0.00','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','attrSerie2','attrSerie3','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','DashboardId','DashboardItem','getItems','findOne','nolimit','rimraf','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./dashboard.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','then','CustomDashboards','UserProfileResource','destroy','end','sendStatus','error','name','send','map','Dashboard','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','includeAll','include','findAll'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xddbc,0xbd));var _0xcddb=function(_0x3ae143,_0x11838c){_0x3ae143=_0x3ae143-0x0;var _0x56891c=_0xddbc[_0x3ae143];return _0x56891c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xcddb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcddb('0x1'));var rp=require('request-promise');var moment=require(_0xcddb('0x2'));var BPromise=require(_0xcddb('0x3'));var Mustache=require('mustache');var util=require(_0xcddb('0x4'));var path=require(_0xcddb('0x5'));var sox=require(_0xcddb('0x6'));var csv=require(_0xcddb('0x7'));var ejs=require(_0xcddb('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcddb('0x9'));var squel=require(_0xcddb('0xa'));var crypto=require(_0xcddb('0xb'));var jsforce=require(_0xcddb('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xcddb('0x7'));var querystring=require(_0xcddb('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcddb('0xe'));var qs=require(_0xcddb('0xf'));var as=require(_0xcddb('0x10'));var hardwareService=require(_0xcddb('0x11'));var logger=require(_0xcddb('0x12'))(_0xcddb('0x13'));var utils=require(_0xcddb('0x14'));var config=require(_0xcddb('0x15'));var licenseUtil=require(_0xcddb('0x16'));var db=require(_0xcddb('0x17'))['db'];config['redis']=_['defaults'](config[_0xcddb('0x18')],{'host':_0xcddb('0x19'),'port':0x18eb});var socket=require(_0xcddb('0x1a'))(new Redis(config[_0xcddb('0x18')]));require(_0xcddb('0x1b'))[_0xcddb('0x1c')](socket);function respondWithStatusCode(_0x35cd60,_0xc2732c){_0xc2732c=_0xc2732c||0xcc;return function(_0x2ee9e2){if(_0x2ee9e2){return _0x35cd60['sendStatus'](_0xc2732c);}return _0x35cd60[_0xcddb('0x1d')](_0xc2732c)['end']();};}function respondWithResult(_0x3906b8,_0xa49ccf){_0xa49ccf=_0xa49ccf||0xc8;return function(_0x361edc){if(_0x361edc){return _0x3906b8[_0xcddb('0x1d')](_0xa49ccf)[_0xcddb('0x1e')](_0x361edc);}};}function respondWithFilteredResult(_0x40fe8b,_0x52963e){return function(_0x115beb){if(_0x115beb){var _0x3d5744=typeof _0x52963e[_0xcddb('0x1f')]===_0xcddb('0x20')&&typeof _0x52963e[_0xcddb('0x21')]===_0xcddb('0x20');var _0x41b86c=_0x115beb[_0xcddb('0x22')];var _0x354857=_0x3d5744?0x0:_0x52963e['offset'];var _0x109d2e=_0x3d5744?_0x115beb[_0xcddb('0x22')]:_0x52963e[_0xcddb('0x1f')]+_0x52963e[_0xcddb('0x21')];var _0x652713;if(_0x109d2e>=_0x41b86c){_0x109d2e=_0x41b86c;_0x652713=0xc8;}else{_0x652713=0xce;}_0x40fe8b[_0xcddb('0x1d')](_0x652713);return _0x40fe8b[_0xcddb('0x23')](_0xcddb('0x24'),_0x354857+'-'+_0x109d2e+'/'+_0x41b86c)[_0xcddb('0x1e')](_0x115beb);}return null;};}function patchUpdates(_0x1394ad){return function(_0x5d0bf0){try{jsonpatch[_0xcddb('0x25')](_0x5d0bf0,_0x1394ad,!![]);}catch(_0xe5d653){return BPromise[_0xcddb('0x26')](_0xe5d653);}return _0x5d0bf0['save']();};}function saveUpdates(_0xc23c97,_0x2f4eed){return function(_0x236d49){if(_0x236d49){return _0x236d49['update'](_0xc23c97)[_0xcddb('0x27')](function(_0x355372){return _0x355372;});}return null;};}function removeEntity(_0x3280b2,_0x245d0b){return function(_0x2eb34b){if(_0x2eb34b){return _0x2eb34b['destroy']()['then'](function(){var _0x5c7ed7=_0x2eb34b['get']({'plain':!![]});var _0x2c95f9=_0xcddb('0x28');return db[_0xcddb('0x29')][_0xcddb('0x2a')]({'where':{'type':_0x2c95f9,'resourceId':_0x5c7ed7['id']}})[_0xcddb('0x27')](function(){return _0x2eb34b;});})[_0xcddb('0x27')](function(){_0x3280b2['status'](0xcc)[_0xcddb('0x2b')]();});}};}function handleEntityNotFound(_0x4d3935,_0x47de69){return function(_0x306606){if(!_0x306606){_0x4d3935[_0xcddb('0x2c')](0x194);}return _0x306606;};}function handleError(_0x5c612c,_0x42af0c){_0x42af0c=_0x42af0c||0x1f4;return function(_0x3345fa){logger[_0xcddb('0x2d')](_0x3345fa['stack']);if(_0x3345fa[_0xcddb('0x2e')]){delete _0x3345fa[_0xcddb('0x2e')];}_0x5c612c['status'](_0x42af0c)[_0xcddb('0x2f')](_0x3345fa);};}exports['index']=function(_0x106564,_0x5ddb28){var _0x5c4552={},_0x59fe65={},_0x1ea624={'count':0x0,'rows':[]};var _0x49bfa7=_[_0xcddb('0x30')](db[_0xcddb('0x31')]['rawAttributes'],function(_0x4cb762){return{'name':_0x4cb762[_0xcddb('0x32')],'type':_0x4cb762[_0xcddb('0x33')][_0xcddb('0x34')]};});_0x59fe65[_0xcddb('0x35')]=_['map'](_0x49bfa7,_0xcddb('0x2e'));_0x59fe65[_0xcddb('0x36')]=_[_0xcddb('0x37')](_0x106564[_0xcddb('0x36')]);_0x59fe65[_0xcddb('0x38')]=_[_0xcddb('0x39')](_0x59fe65[_0xcddb('0x35')],_0x59fe65[_0xcddb('0x36')]);_0x5c4552[_0xcddb('0x3a')]=_[_0xcddb('0x39')](_0x59fe65[_0xcddb('0x35')],qs[_0xcddb('0x3b')](_0x106564[_0xcddb('0x36')][_0xcddb('0x3b')]));_0x5c4552[_0xcddb('0x3a')]=_0x5c4552[_0xcddb('0x3a')]['length']?_0x5c4552[_0xcddb('0x3a')]:_0x59fe65[_0xcddb('0x35')];if(!_0x106564[_0xcddb('0x36')][_0xcddb('0x3c')]('nolimit')){_0x5c4552['limit']=qs[_0xcddb('0x21')](_0x106564['query'][_0xcddb('0x21')]);_0x5c4552[_0xcddb('0x1f')]=qs[_0xcddb('0x1f')](_0x106564[_0xcddb('0x36')][_0xcddb('0x1f')]);}_0x5c4552[_0xcddb('0x3d')]=qs[_0xcddb('0x3e')](_0x106564[_0xcddb('0x36')]['sort']);_0x5c4552['where']=qs['filters'](_[_0xcddb('0x3f')](_0x106564['query'],_0x59fe65['filters']),_0x49bfa7);if(_0x106564['query'][_0xcddb('0x40')]){_0x5c4552[_0xcddb('0x41')]=_['merge'](_0x5c4552[_0xcddb('0x41')],{'$or':_[_0xcddb('0x30')](_0x49bfa7,function(_0x5e1ee9){if(_0x5e1ee9[_0xcddb('0x33')]!=='VIRTUAL'){var _0x17cdf5={};_0x17cdf5[_0x5e1ee9[_0xcddb('0x2e')]]={'$like':'%'+_0x106564[_0xcddb('0x36')][_0xcddb('0x40')]+'%'};return _0x17cdf5;}})});}_0x5c4552=_['merge']({},_0x5c4552,_0x106564['options']);var _0x1cf503={'where':_0x5c4552[_0xcddb('0x41')]};return db[_0xcddb('0x31')][_0xcddb('0x22')](_0x1cf503)[_0xcddb('0x27')](function(_0xa0691e){_0x1ea624['count']=_0xa0691e;if(_0x106564['query'][_0xcddb('0x42')]){_0x5c4552[_0xcddb('0x43')]=[{'all':!![]}];}return db[_0xcddb('0x31')][_0xcddb('0x44')](_0x5c4552);})[_0xcddb('0x27')](function(_0x31d006){_0x1ea624[_0xcddb('0x45')]=_0x31d006;return _0x1ea624;})[_0xcddb('0x27')](respondWithFilteredResult(_0x5ddb28,_0x5c4552))[_0xcddb('0x46')](handleError(_0x5ddb28,null));};exports[_0xcddb('0x47')]=function(_0x503c10,_0x24920f){var _0x3e4ebe={'raw':![],'where':{'id':_0x503c10['params']['id']}},_0x4d6e4d={};_0x4d6e4d[_0xcddb('0x35')]=_[_0xcddb('0x37')](db[_0xcddb('0x31')][_0xcddb('0x48')]);_0x4d6e4d[_0xcddb('0x36')]=_[_0xcddb('0x37')](_0x503c10[_0xcddb('0x36')]);_0x4d6e4d[_0xcddb('0x38')]=_['intersection'](_0x4d6e4d[_0xcddb('0x35')],_0x4d6e4d['query']);_0x3e4ebe[_0xcddb('0x3a')]=_[_0xcddb('0x39')](_0x4d6e4d[_0xcddb('0x35')],qs['fields'](_0x503c10[_0xcddb('0x36')]['fields']));_0x3e4ebe[_0xcddb('0x3a')]=_0x3e4ebe['attributes'][_0xcddb('0x49')]?_0x3e4ebe[_0xcddb('0x3a')]:_0x4d6e4d[_0xcddb('0x35')];if(_0x503c10[_0xcddb('0x36')][_0xcddb('0x42')]){_0x3e4ebe[_0xcddb('0x43')]=[{'all':!![]}];}_0x3e4ebe=_[_0xcddb('0x4a')]({},_0x3e4ebe,_0x503c10[_0xcddb('0x4b')]);return db['Dashboard']['find'](_0x3e4ebe)[_0xcddb('0x27')](handleEntityNotFound(_0x24920f,null))[_0xcddb('0x27')](respondWithResult(_0x24920f,null))[_0xcddb('0x46')](handleError(_0x24920f,null));};exports['create']=function(_0x52ce9c,_0x235748){return db['Dashboard'][_0xcddb('0x4c')](_0x52ce9c['body'],{})[_0xcddb('0x27')](function(_0x49a3c7){var _0x4d1e70=_0x52ce9c[_0xcddb('0x4d')][_0xcddb('0x4e')]({'plain':!![]});if(!_0x4d1e70)throw new Error(_0xcddb('0x4f'));if(_0x4d1e70[_0xcddb('0x50')]===_0xcddb('0x4d')){var _0x5d4673=_0x49a3c7[_0xcddb('0x4e')]({'plain':!![]});var _0x5409a9=_0xcddb('0x28');return db[_0xcddb('0x51')][_0xcddb('0x52')]({'where':{'name':_0x5409a9,'userProfileId':_0x4d1e70[_0xcddb('0x53')]},'raw':!![]})[_0xcddb('0x27')](function(_0x2c177d){if(_0x2c177d&&_0x2c177d[_0xcddb('0x54')]===0x0){return db[_0xcddb('0x29')][_0xcddb('0x4c')]({'name':_0x5d4673['name'],'resourceId':_0x5d4673['id'],'type':_0x2c177d['name'],'sectionId':_0x2c177d['id']},{})[_0xcddb('0x27')](function(){return _0x49a3c7;});}else{return _0x49a3c7;}})[_0xcddb('0x46')](function(_0x543a29){logger[_0xcddb('0x2d')](_0xcddb('0x55'),_0x543a29);throw _0x543a29;});}return _0x49a3c7;})[_0xcddb('0x27')](respondWithResult(_0x235748,0xc9))[_0xcddb('0x46')](handleError(_0x235748,null));};exports[_0xcddb('0x56')]=function(_0x2cd2e6,_0x550abe){var _0x22223e={'where':{'id':_0x2cd2e6['params']['id']}},_0x1663f5={};_0x1663f5[_0xcddb('0x35')]=_[_0xcddb('0x37')](db[_0xcddb('0x31')][_0xcddb('0x48')]);_0x22223e[_0xcddb('0x3a')]=_[_0xcddb('0x39')](_0x1663f5['model'],qs[_0xcddb('0x3b')](_0x2cd2e6[_0xcddb('0x36')][_0xcddb('0x3b')]));_0x22223e[_0xcddb('0x3a')]=_0x22223e[_0xcddb('0x3a')]['length']?_0x22223e[_0xcddb('0x3a')]:_0x1663f5[_0xcddb('0x35')];if(_0x2cd2e6['query'][_0xcddb('0x42')]){_0x22223e[_0xcddb('0x43')]=[{'all':!![]}];}_0x22223e=_[_0xcddb('0x4a')]({},_0x22223e,_0x2cd2e6[_0xcddb('0x4b')]);return db[_0xcddb('0x31')]['find'](_0x22223e)[_0xcddb('0x27')](handleEntityNotFound(_0x550abe,null))[_0xcddb('0x27')](function(_0x56a30d){if(_0x56a30d){var _0x27ae96=_0x56a30d[_0xcddb('0x4e')]({'plain':!![]});_0x27ae96=qs[_0xcddb('0x57')](_0x27ae96,['id',_0xcddb('0x58'),_0xcddb('0x59')]);_0x2cd2e6['body']=_[_0xcddb('0x57')](_0x2cd2e6[_0xcddb('0x5a')],['id',_0xcddb('0x58'),_0xcddb('0x59')]);return db['Dashboard']['create'](_[_0xcddb('0x4a')](_0x27ae96,_0x2cd2e6['body']),{'include':_0x2cd2e6[_0xcddb('0x36')]['includeAll']?[{'all':!![]}]:undefined})[_0xcddb('0x27')](function(_0x4b0dae){var _0x254bda=_0x2cd2e6[_0xcddb('0x4d')][_0xcddb('0x4e')]({'plain':!![]});if(!_0x254bda)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x254bda[_0xcddb('0x50')]===_0xcddb('0x4d')){var _0xc3ac99=_0x4b0dae[_0xcddb('0x4e')]({'plain':!![]});var _0x1c5a28=_0xcddb('0x28');return db[_0xcddb('0x51')][_0xcddb('0x52')]({'where':{'name':_0x1c5a28,'userProfileId':_0x254bda[_0xcddb('0x53')]},'raw':!![]})[_0xcddb('0x27')](function(_0x1a31d3){if(_0x1a31d3&&_0x1a31d3[_0xcddb('0x54')]===0x0){return db[_0xcddb('0x29')][_0xcddb('0x4c')]({'name':_0xc3ac99[_0xcddb('0x2e')],'resourceId':_0xc3ac99['id'],'type':_0x1a31d3[_0xcddb('0x2e')],'sectionId':_0x1a31d3['id']},{})[_0xcddb('0x27')](function(){return _0x4b0dae;});}else{return _0x4b0dae;}})[_0xcddb('0x46')](function(_0x4402af){logger[_0xcddb('0x2d')](_0xcddb('0x55'),_0x4402af);throw _0x4402af;});}return _0x4b0dae;});}})[_0xcddb('0x27')](respondWithResult(_0x550abe,0xc9))['catch'](handleError(_0x550abe,null));};exports[_0xcddb('0x5b')]=function(_0x2e649b,_0x276df1){if(_0x2e649b[_0xcddb('0x5a')]['id']){delete _0x2e649b[_0xcddb('0x5a')]['id'];}return db[_0xcddb('0x31')]['find']({'where':{'id':_0x2e649b['params']['id']}})['then'](handleEntityNotFound(_0x276df1,null))['then'](saveUpdates(_0x2e649b[_0xcddb('0x5a')],null))[_0xcddb('0x27')](respondWithResult(_0x276df1,null))[_0xcddb('0x46')](handleError(_0x276df1,null));};exports['destroy']=function(_0x5d2cc5,_0x4aa3ff){return db['Dashboard'][_0xcddb('0x52')]({'where':{'id':_0x5d2cc5[_0xcddb('0x5c')]['id']}})[_0xcddb('0x27')](handleEntityNotFound(_0x4aa3ff,null))['then'](removeEntity(_0x4aa3ff,null))[_0xcddb('0x46')](handleError(_0x4aa3ff,null));};function widgetAttributes(_0x9ac031){try{switch(_0x9ac031[_0xcddb('0x33')]){case _0xcddb('0x5d'):return[{'name':_0xcddb('0x5e'),'value':_0x9ac031[_0xcddb('0x5e')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0x0]?_0x9ac031[_0xcddb('0x5f')][0x0][_0xcddb('0x60')]:undefined)||'https://'}];case'custom':return[{'name':_0xcddb('0x61'),'value':_0x9ac031[_0xcddb('0x61')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0x0]?_0x9ac031[_0xcddb('0x5f')][0x0][_0xcddb('0x60')]:undefined)||''}];case _0xcddb('0x62'):return[{'name':_0xcddb('0x63'),'value':_0x9ac031[_0xcddb('0x63')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0x0]?_0x9ac031['attrs'][0x0][_0xcddb('0x60')]:undefined)||'HH:mm:ss'},{'name':'attrTimezone','value':_0x9ac031['attrTimezone']||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0x1]?_0x9ac031[_0xcddb('0x5f')][0x1][_0xcddb('0x60')]:undefined)||_0xcddb('0x64')},{'name':_0xcddb('0x65'),'value':_0x9ac031[_0xcddb('0x65')]||(_0x9ac031['attrs']&&_0x9ac031[_0xcddb('0x5f')][0x2]?_0x9ac031[_0xcddb('0x5f')][0x2]['value']:undefined)||0xc}];case _0xcddb('0x66'):return[{'name':'attrMetric','value':_0x9ac031[_0xcddb('0x67')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0x0]?_0x9ac031['attrs'][0x0][_0xcddb('0x60')]:undefined)||_0xcddb('0x68')},{'name':'attrVoiceQueues','value':_0x9ac031[_0xcddb('0x69')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031['attrs'][0x1]?_0x9ac031['attrs'][0x1][_0xcddb('0x60')]:undefined)||[]},{'name':_0xcddb('0x65'),'value':_0x9ac031[_0xcddb('0x65')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0x2]?_0x9ac031[_0xcddb('0x5f')][0x2][_0xcddb('0x60')]:undefined)||0x14},{'name':_0xcddb('0x6a'),'value':_0x9ac031[_0xcddb('0x6a')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0x3]?_0x9ac031[_0xcddb('0x5f')][0x3][_0xcddb('0x60')]:undefined)||_0xcddb('0x6b')},{'name':_0xcddb('0x6c'),'value':_0x9ac031[_0xcddb('0x6c')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0x4]?_0x9ac031['attrs'][0x4][_0xcddb('0x60')]:undefined)||''},{'name':_0xcddb('0x6d'),'value':_0x9ac031[_0xcddb('0x6d')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031['attrs'][0x5]?_0x9ac031[_0xcddb('0x5f')][0x5][_0xcddb('0x60')]:undefined)||''},{'name':_0xcddb('0x6e'),'value':_0x9ac031['attrSmsAccounts']||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0x6]?_0x9ac031[_0xcddb('0x5f')][0x6]['value']:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x9ac031[_0xcddb('0x6f')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0x7]?_0x9ac031['attrs'][0x7][_0xcddb('0x60')]:undefined)||''},{'name':_0xcddb('0x70'),'value':_0x9ac031[_0xcddb('0x70')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0x8]?_0x9ac031['attrs'][0x8][_0xcddb('0x60')]:undefined)||''},{'name':_0xcddb('0x71'),'value':_0x9ac031['attrChatWebsites']||(_0x9ac031['attrs']&&_0x9ac031[_0xcddb('0x5f')][0x9]?_0x9ac031[_0xcddb('0x5f')][0x9][_0xcddb('0x60')]:undefined)||''}];case _0xcddb('0x72'):case'pie-chart':return[{'name':_0xcddb('0x73'),'value':_0x9ac031['attrSerie1']||(_0x9ac031['attrs']&&_0x9ac031[_0xcddb('0x5f')][0x0]?_0x9ac031[_0xcddb('0x5f')][0x0][_0xcddb('0x60')]:undefined)||_0xcddb('0x68')},{'name':'attrSerie2','value':_0x9ac031[_0xcddb('0x74')]||(_0x9ac031['attrs']&&_0x9ac031['attrs'][0x1]?_0x9ac031[_0xcddb('0x5f')][0x1][_0xcddb('0x60')]:undefined)||null},{'name':_0xcddb('0x75'),'value':_0x9ac031[_0xcddb('0x75')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031['attrs'][0x2]?_0x9ac031[_0xcddb('0x5f')][0x2][_0xcddb('0x60')]:undefined)||null},{'name':_0xcddb('0x69'),'value':_0x9ac031[_0xcddb('0x69')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0x3]?_0x9ac031['attrs'][0x3]['value']:undefined)||[]},{'name':_0xcddb('0x6a'),'value':_0x9ac031[_0xcddb('0x6a')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0x4]?_0x9ac031['attrs'][0x4][_0xcddb('0x60')]:undefined)||'voice'},{'name':_0xcddb('0x6c'),'value':_0x9ac031[_0xcddb('0x6c')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0x5]?_0x9ac031['attrs'][0x5]['value']:undefined)||''},{'name':_0xcddb('0x6d'),'value':_0x9ac031[_0xcddb('0x6d')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031['attrs'][0x6]?_0x9ac031[_0xcddb('0x5f')][0x6][_0xcddb('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x9ac031['attrSmsAccounts']||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0x7]?_0x9ac031[_0xcddb('0x5f')][0x7][_0xcddb('0x60')]:undefined)||''},{'name':_0xcddb('0x6f'),'value':_0x9ac031[_0xcddb('0x6f')]||(_0x9ac031['attrs']&&_0x9ac031['attrs'][0x8]?_0x9ac031[_0xcddb('0x5f')][0x8]['value']:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x9ac031[_0xcddb('0x70')]||(_0x9ac031['attrs']&&_0x9ac031['attrs'][0x9]?_0x9ac031[_0xcddb('0x5f')][0x9][_0xcddb('0x60')]:undefined)||''},{'name':_0xcddb('0x71'),'value':_0x9ac031[_0xcddb('0x71')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0xa]?_0x9ac031[_0xcddb('0x5f')][0xa][_0xcddb('0x60')]:undefined)||''}];case _0xcddb('0x76'):return[{'name':_0xcddb('0x77'),'type':_0x9ac031[_0xcddb('0x78')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031['attrs'][0x0]?_0x9ac031['attrs'][0x0][_0xcddb('0x33')]:undefined)||null,'value':_0x9ac031['attrReport']||(_0x9ac031['attrs']&&_0x9ac031['attrs'][0x0]?_0x9ac031['attrs'][0x0][_0xcddb('0x60')]:undefined)||null},{'name':_0xcddb('0x79'),'value':_0x9ac031[_0xcddb('0x79')]||(_0x9ac031[_0xcddb('0x5f')]&&_0x9ac031[_0xcddb('0x5f')][0x1]?_0x9ac031['attrs'][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x4e6140){logger['error'](_0xcddb('0x7a'),JSON[_0xcddb('0x7b')](_0x4e6140));return[];}}exports['addItem']=function(_0x37f3fd,_0x58d60c,_0x8e96f){if(_0x37f3fd[_0xcddb('0x5a')]['id']){delete _0x37f3fd[_0xcddb('0x5a')]['id'];}return db[_0xcddb('0x31')]['find']({'where':{'id':_0x37f3fd[_0xcddb('0x5c')]['id']}})[_0xcddb('0x27')](handleEntityNotFound(_0x58d60c,null))[_0xcddb('0x27')](function(_0xbd7a90){if(_0xbd7a90){_0x37f3fd[_0xcddb('0x5a')][_0xcddb('0x7c')]=_0xbd7a90['id'];_0x37f3fd['body'][_0xcddb('0x5f')]=widgetAttributes(_0x37f3fd[_0xcddb('0x5a')]);return db[_0xcddb('0x7d')][_0xcddb('0x4c')](_0x37f3fd[_0xcddb('0x5a')]);}})[_0xcddb('0x27')](respondWithResult(_0x58d60c,null))[_0xcddb('0x46')](handleError(_0x58d60c,null));};exports[_0xcddb('0x7e')]=function(_0x8f70ca,_0x365cda,_0x4f2d32){var _0x2038fc={};var _0x3c0e6b={};var _0x690b9e;var _0x4d2130;return db['Dashboard'][_0xcddb('0x7f')]({'where':{'id':_0x8f70ca[_0xcddb('0x5c')]['id']}})[_0xcddb('0x27')](handleEntityNotFound(_0x365cda,null))[_0xcddb('0x27')](function(_0x31212b){if(_0x31212b){_0x690b9e=_0x31212b;_0x3c0e6b[_0xcddb('0x35')]=_['keys'](db[_0xcddb('0x7d')][_0xcddb('0x48')]);_0x3c0e6b[_0xcddb('0x36')]=_[_0xcddb('0x37')](_0x8f70ca['query']);_0x3c0e6b['filters']=_[_0xcddb('0x39')](_0x3c0e6b['model'],_0x3c0e6b[_0xcddb('0x36')]);_0x2038fc[_0xcddb('0x3a')]=_[_0xcddb('0x39')](_0x3c0e6b[_0xcddb('0x35')],qs[_0xcddb('0x3b')](_0x8f70ca[_0xcddb('0x36')][_0xcddb('0x3b')]));_0x2038fc[_0xcddb('0x3a')]=_0x2038fc[_0xcddb('0x3a')][_0xcddb('0x49')]?_0x2038fc[_0xcddb('0x3a')]:_0x3c0e6b[_0xcddb('0x35')];_0x2038fc['order']=qs[_0xcddb('0x3e')](_0x8f70ca['query'][_0xcddb('0x3e')]);_0x2038fc[_0xcddb('0x41')]=qs[_0xcddb('0x38')](_[_0xcddb('0x3f')](_0x8f70ca['query'],_0x3c0e6b[_0xcddb('0x38')]));if(_0x8f70ca['query'][_0xcddb('0x40')]){_0x2038fc['where']=_['merge'](_0x2038fc[_0xcddb('0x41')],{'$or':_[_0xcddb('0x30')](_0x2038fc['attributes'],function(_0x5bae21){var _0x5d09f5={};_0x5d09f5[_0x5bae21]={'$like':'%'+_0x8f70ca[_0xcddb('0x36')]['filter']+'%'};return _0x5d09f5;})});}_0x2038fc=_[_0xcddb('0x4a')]({},_0x2038fc,_0x8f70ca[_0xcddb('0x4b')]);return _0x690b9e[_0xcddb('0x7e')](_0x2038fc);}})['then'](function(_0x17559a){if(_0x17559a){_0x4d2130=_0x17559a[_0xcddb('0x49')];if(!_0x8f70ca[_0xcddb('0x36')][_0xcddb('0x3c')](_0xcddb('0x80'))){_0x2038fc['limit']=qs[_0xcddb('0x21')](_0x8f70ca[_0xcddb('0x36')]['limit']);_0x2038fc[_0xcddb('0x1f')]=qs[_0xcddb('0x1f')](_0x8f70ca[_0xcddb('0x36')][_0xcddb('0x1f')]);}return _0x690b9e[_0xcddb('0x7e')](_0x2038fc);}})['then'](function(_0xf83bb1){if(_0xf83bb1){return _0xf83bb1?{'count':_0x4d2130,'rows':_0xf83bb1}:null;}})['then'](respondWithResult(_0x365cda,null))[_0xcddb('0x46')](handleError(_0x365cda,null));}; \ No newline at end of file +var _0xf8c6=['../../config/license/util','redis','defaults','localhost','socket.io-emitter','./dashboard.socket','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','get','CustomDashboards','UserProfileResource','error','stack','name','send','index','map','Dashboard','rawAttributes','type','key','model','keys','query','filters','intersection','attributes','fields','length','order','sort','filter','merge','where','options','includeAll','include','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','createdAt','omit','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','attrFontSize','counter','attrMetric','total','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','pie-chart','attrSerie1','attrSerie2','attrSerie3','attrSmsAccounts','web-report','attrReport','reportType','attrRefresh','widgetAttributes:\x20%s','stringify','addItem','DashboardItem','getItems','findOne','pick','hasOwnProperty','nolimit','eml-format','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','api','../../config/utils','../../config/environment'];(function(_0x19d7e9,_0x359dd7){var _0x3b74db=function(_0x5bb01f){while(--_0x5bb01f){_0x19d7e9['push'](_0x19d7e9['shift']());}};_0x3b74db(++_0x359dd7);}(_0xf8c6,0xf0));var _0x6f8c=function(_0x277d4d,_0x2d74d4){_0x277d4d=_0x277d4d-0x0;var _0x67cac2=_0xf8c6[_0x277d4d];return _0x67cac2;};'use strict';var emlformat=require(_0x6f8c('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x6f8c('0x1'));var rp=require(_0x6f8c('0x2'));var moment=require(_0x6f8c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x6f8c('0x4'));var util=require(_0x6f8c('0x5'));var path=require(_0x6f8c('0x6'));var sox=require(_0x6f8c('0x7'));var csv=require(_0x6f8c('0x8'));var ejs=require(_0x6f8c('0x9'));var fs=require('fs');var fs_extra=require(_0x6f8c('0xa'));var _=require(_0x6f8c('0xb'));var squel=require(_0x6f8c('0xc'));var crypto=require('crypto');var jsforce=require(_0x6f8c('0xd'));var deskjs=require(_0x6f8c('0xe'));var toCsv=require(_0x6f8c('0x8'));var querystring=require(_0x6f8c('0xf'));var Papa=require(_0x6f8c('0x10'));var Redis=require(_0x6f8c('0x11'));var authService=require(_0x6f8c('0x12'));var qs=require(_0x6f8c('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x6f8c('0x14'));var logger=require('../../config/logger')(_0x6f8c('0x15'));var utils=require(_0x6f8c('0x16'));var config=require(_0x6f8c('0x17'));var licenseUtil=require(_0x6f8c('0x18'));var db=require('../../mysqldb')['db'];config[_0x6f8c('0x19')]=_[_0x6f8c('0x1a')](config[_0x6f8c('0x19')],{'host':_0x6f8c('0x1b'),'port':0x18eb});var socket=require(_0x6f8c('0x1c'))(new Redis(config[_0x6f8c('0x19')]));require(_0x6f8c('0x1d'))['register'](socket);function respondWithStatusCode(_0x41d0f7,_0x124364){_0x124364=_0x124364||0xcc;return function(_0x508256){if(_0x508256){return _0x41d0f7[_0x6f8c('0x1e')](_0x124364);}return _0x41d0f7[_0x6f8c('0x1f')](_0x124364)[_0x6f8c('0x20')]();};}function respondWithResult(_0x1f659f,_0x30a623){_0x30a623=_0x30a623||0xc8;return function(_0x224b86){if(_0x224b86){return _0x1f659f['status'](_0x30a623)[_0x6f8c('0x21')](_0x224b86);}};}function respondWithFilteredResult(_0x1a4f96,_0x10f77a){return function(_0x198b6e){if(_0x198b6e){var _0x57e295=typeof _0x10f77a[_0x6f8c('0x22')]===_0x6f8c('0x23')&&typeof _0x10f77a[_0x6f8c('0x24')]==='undefined';var _0x1cc40b=_0x198b6e[_0x6f8c('0x25')];var _0x59083a=_0x57e295?0x0:_0x10f77a[_0x6f8c('0x22')];var _0x4b7a47=_0x57e295?_0x198b6e[_0x6f8c('0x25')]:_0x10f77a[_0x6f8c('0x22')]+_0x10f77a[_0x6f8c('0x24')];var _0x3ec83d;if(_0x4b7a47>=_0x1cc40b){_0x4b7a47=_0x1cc40b;_0x3ec83d=0xc8;}else{_0x3ec83d=0xce;}_0x1a4f96[_0x6f8c('0x1f')](_0x3ec83d);return _0x1a4f96[_0x6f8c('0x26')](_0x6f8c('0x27'),_0x59083a+'-'+_0x4b7a47+'/'+_0x1cc40b)[_0x6f8c('0x21')](_0x198b6e);}return null;};}function patchUpdates(_0xbf80b0){return function(_0x55657b){try{jsonpatch[_0x6f8c('0x28')](_0x55657b,_0xbf80b0,!![]);}catch(_0x34c6d1){return BPromise[_0x6f8c('0x29')](_0x34c6d1);}return _0x55657b[_0x6f8c('0x2a')]();};}function saveUpdates(_0x3b555c,_0x22faba){return function(_0x41bb5e){if(_0x41bb5e){return _0x41bb5e[_0x6f8c('0x2b')](_0x3b555c)[_0x6f8c('0x2c')](function(_0x52015a){return _0x52015a;});}return null;};}function removeEntity(_0x2638fd,_0x5d7db3){return function(_0x2c9a58){if(_0x2c9a58){return _0x2c9a58[_0x6f8c('0x2d')]()[_0x6f8c('0x2c')](function(){var _0x4337db=_0x2c9a58[_0x6f8c('0x2e')]({'plain':!![]});var _0x8aa055=_0x6f8c('0x2f');return db[_0x6f8c('0x30')][_0x6f8c('0x2d')]({'where':{'type':_0x8aa055,'resourceId':_0x4337db['id']}})[_0x6f8c('0x2c')](function(){return _0x2c9a58;});})[_0x6f8c('0x2c')](function(){_0x2638fd[_0x6f8c('0x1f')](0xcc)[_0x6f8c('0x20')]();});}};}function handleEntityNotFound(_0x291fcc,_0x204aed){return function(_0x5faf2b){if(!_0x5faf2b){_0x291fcc[_0x6f8c('0x1e')](0x194);}return _0x5faf2b;};}function handleError(_0x2d6de9,_0x582d8f){_0x582d8f=_0x582d8f||0x1f4;return function(_0x45c24b){logger[_0x6f8c('0x31')](_0x45c24b[_0x6f8c('0x32')]);if(_0x45c24b[_0x6f8c('0x33')]){delete _0x45c24b['name'];}_0x2d6de9[_0x6f8c('0x1f')](_0x582d8f)[_0x6f8c('0x34')](_0x45c24b);};}exports[_0x6f8c('0x35')]=function(_0x4ed854,_0xaeb404){var _0x1269b5={},_0x3759d9={},_0x4f4494={'count':0x0,'rows':[]};var _0x38b896=_[_0x6f8c('0x36')](db[_0x6f8c('0x37')][_0x6f8c('0x38')],function(_0x461d81){return{'name':_0x461d81['fieldName'],'type':_0x461d81[_0x6f8c('0x39')][_0x6f8c('0x3a')]};});_0x3759d9[_0x6f8c('0x3b')]=_[_0x6f8c('0x36')](_0x38b896,_0x6f8c('0x33'));_0x3759d9['query']=_[_0x6f8c('0x3c')](_0x4ed854[_0x6f8c('0x3d')]);_0x3759d9[_0x6f8c('0x3e')]=_[_0x6f8c('0x3f')](_0x3759d9[_0x6f8c('0x3b')],_0x3759d9[_0x6f8c('0x3d')]);_0x1269b5[_0x6f8c('0x40')]=_[_0x6f8c('0x3f')](_0x3759d9[_0x6f8c('0x3b')],qs[_0x6f8c('0x41')](_0x4ed854[_0x6f8c('0x3d')][_0x6f8c('0x41')]));_0x1269b5['attributes']=_0x1269b5[_0x6f8c('0x40')][_0x6f8c('0x42')]?_0x1269b5[_0x6f8c('0x40')]:_0x3759d9[_0x6f8c('0x3b')];if(!_0x4ed854[_0x6f8c('0x3d')]['hasOwnProperty']('nolimit')){_0x1269b5['limit']=qs[_0x6f8c('0x24')](_0x4ed854[_0x6f8c('0x3d')][_0x6f8c('0x24')]);_0x1269b5[_0x6f8c('0x22')]=qs[_0x6f8c('0x22')](_0x4ed854[_0x6f8c('0x3d')][_0x6f8c('0x22')]);}_0x1269b5[_0x6f8c('0x43')]=qs[_0x6f8c('0x44')](_0x4ed854[_0x6f8c('0x3d')]['sort']);_0x1269b5['where']=qs[_0x6f8c('0x3e')](_['pick'](_0x4ed854[_0x6f8c('0x3d')],_0x3759d9[_0x6f8c('0x3e')]),_0x38b896);if(_0x4ed854[_0x6f8c('0x3d')][_0x6f8c('0x45')]){_0x1269b5['where']=_[_0x6f8c('0x46')](_0x1269b5[_0x6f8c('0x47')],{'$or':_['map'](_0x38b896,function(_0x96ce35){if(_0x96ce35[_0x6f8c('0x39')]!=='VIRTUAL'){var _0xea6d40={};_0xea6d40[_0x96ce35[_0x6f8c('0x33')]]={'$like':'%'+_0x4ed854[_0x6f8c('0x3d')][_0x6f8c('0x45')]+'%'};return _0xea6d40;}})});}_0x1269b5=_[_0x6f8c('0x46')]({},_0x1269b5,_0x4ed854[_0x6f8c('0x48')]);var _0x4a96e5={'where':_0x1269b5[_0x6f8c('0x47')]};return db[_0x6f8c('0x37')][_0x6f8c('0x25')](_0x4a96e5)['then'](function(_0x5eac81){_0x4f4494[_0x6f8c('0x25')]=_0x5eac81;if(_0x4ed854[_0x6f8c('0x3d')][_0x6f8c('0x49')]){_0x1269b5[_0x6f8c('0x4a')]=[{'all':!![]}];}return db[_0x6f8c('0x37')]['findAll'](_0x1269b5);})[_0x6f8c('0x2c')](function(_0x2c3881){_0x4f4494['rows']=_0x2c3881;return _0x4f4494;})[_0x6f8c('0x2c')](respondWithFilteredResult(_0xaeb404,_0x1269b5))['catch'](handleError(_0xaeb404,null));};exports[_0x6f8c('0x4b')]=function(_0x18ec76,_0x239cf1){var _0x25e0cb={'raw':![],'where':{'id':_0x18ec76[_0x6f8c('0x4c')]['id']}},_0xba4c3c={};_0xba4c3c[_0x6f8c('0x3b')]=_[_0x6f8c('0x3c')](db['Dashboard'][_0x6f8c('0x38')]);_0xba4c3c[_0x6f8c('0x3d')]=_[_0x6f8c('0x3c')](_0x18ec76[_0x6f8c('0x3d')]);_0xba4c3c[_0x6f8c('0x3e')]=_['intersection'](_0xba4c3c[_0x6f8c('0x3b')],_0xba4c3c[_0x6f8c('0x3d')]);_0x25e0cb[_0x6f8c('0x40')]=_['intersection'](_0xba4c3c[_0x6f8c('0x3b')],qs['fields'](_0x18ec76['query'][_0x6f8c('0x41')]));_0x25e0cb[_0x6f8c('0x40')]=_0x25e0cb[_0x6f8c('0x40')][_0x6f8c('0x42')]?_0x25e0cb[_0x6f8c('0x40')]:_0xba4c3c[_0x6f8c('0x3b')];if(_0x18ec76[_0x6f8c('0x3d')][_0x6f8c('0x49')]){_0x25e0cb['include']=[{'all':!![]}];}_0x25e0cb=_[_0x6f8c('0x46')]({},_0x25e0cb,_0x18ec76['options']);return db[_0x6f8c('0x37')][_0x6f8c('0x4d')](_0x25e0cb)[_0x6f8c('0x2c')](handleEntityNotFound(_0x239cf1,null))[_0x6f8c('0x2c')](respondWithResult(_0x239cf1,null))['catch'](handleError(_0x239cf1,null));};exports[_0x6f8c('0x4e')]=function(_0x3f0d8a,_0x11d26a){return db['Dashboard'][_0x6f8c('0x4e')](_0x3f0d8a[_0x6f8c('0x4f')],{})[_0x6f8c('0x2c')](function(_0x54a08b){var _0x3ed610=_0x3f0d8a[_0x6f8c('0x50')][_0x6f8c('0x2e')]({'plain':!![]});if(!_0x3ed610)throw new Error(_0x6f8c('0x51'));if(_0x3ed610[_0x6f8c('0x52')]===_0x6f8c('0x50')){var _0x83adf3=_0x54a08b[_0x6f8c('0x2e')]({'plain':!![]});var _0x3320f6=_0x6f8c('0x2f');return db[_0x6f8c('0x53')][_0x6f8c('0x4d')]({'where':{'name':_0x3320f6,'userProfileId':_0x3ed610[_0x6f8c('0x54')]},'raw':!![]})[_0x6f8c('0x2c')](function(_0x5bf31a){if(_0x5bf31a&&_0x5bf31a[_0x6f8c('0x55')]===0x0){return db[_0x6f8c('0x30')][_0x6f8c('0x4e')]({'name':_0x83adf3[_0x6f8c('0x33')],'resourceId':_0x83adf3['id'],'type':_0x5bf31a[_0x6f8c('0x33')],'sectionId':_0x5bf31a['id']},{})[_0x6f8c('0x2c')](function(){return _0x54a08b;});}else{return _0x54a08b;}})[_0x6f8c('0x56')](function(_0x43b739){logger[_0x6f8c('0x31')](_0x6f8c('0x57'),_0x43b739);throw _0x43b739;});}return _0x54a08b;})['then'](respondWithResult(_0x11d26a,0xc9))['catch'](handleError(_0x11d26a,null));};exports['clone']=function(_0x2c0886,_0x53481f){var _0x144252={'where':{'id':_0x2c0886[_0x6f8c('0x4c')]['id']}},_0x532841={};_0x532841[_0x6f8c('0x3b')]=_[_0x6f8c('0x3c')](db['Dashboard'][_0x6f8c('0x38')]);_0x144252[_0x6f8c('0x40')]=_[_0x6f8c('0x3f')](_0x532841[_0x6f8c('0x3b')],qs[_0x6f8c('0x41')](_0x2c0886[_0x6f8c('0x3d')][_0x6f8c('0x41')]));_0x144252[_0x6f8c('0x40')]=_0x144252[_0x6f8c('0x40')][_0x6f8c('0x42')]?_0x144252['attributes']:_0x532841[_0x6f8c('0x3b')];if(_0x2c0886[_0x6f8c('0x3d')][_0x6f8c('0x49')]){_0x144252[_0x6f8c('0x4a')]=[{'all':!![]}];}_0x144252=_[_0x6f8c('0x46')]({},_0x144252,_0x2c0886[_0x6f8c('0x48')]);return db['Dashboard'][_0x6f8c('0x4d')](_0x144252)[_0x6f8c('0x2c')](handleEntityNotFound(_0x53481f,null))[_0x6f8c('0x2c')](function(_0xa62c99){if(_0xa62c99){var _0x205fc5=_0xa62c99[_0x6f8c('0x2e')]({'plain':!![]});_0x205fc5=qs['omit'](_0x205fc5,['id',_0x6f8c('0x58'),'updatedAt']);_0x2c0886['body']=_[_0x6f8c('0x59')](_0x2c0886['body'],['id',_0x6f8c('0x58'),'updatedAt']);return db[_0x6f8c('0x37')][_0x6f8c('0x4e')](_[_0x6f8c('0x46')](_0x205fc5,_0x2c0886['body']),{'include':_0x2c0886['query'][_0x6f8c('0x49')]?[{'all':!![]}]:undefined})[_0x6f8c('0x2c')](function(_0x52f6b3){var _0x395d1a=_0x2c0886[_0x6f8c('0x50')][_0x6f8c('0x2e')]({'plain':!![]});if(!_0x395d1a)throw new Error(_0x6f8c('0x51'));if(_0x395d1a[_0x6f8c('0x52')]===_0x6f8c('0x50')){var _0xbb6af3=_0x52f6b3[_0x6f8c('0x2e')]({'plain':!![]});var _0x28e37c='CustomDashboards';return db[_0x6f8c('0x53')][_0x6f8c('0x4d')]({'where':{'name':_0x28e37c,'userProfileId':_0x395d1a['userProfileId']},'raw':!![]})[_0x6f8c('0x2c')](function(_0x27dcae){if(_0x27dcae&&_0x27dcae[_0x6f8c('0x55')]===0x0){return db[_0x6f8c('0x30')]['create']({'name':_0xbb6af3[_0x6f8c('0x33')],'resourceId':_0xbb6af3['id'],'type':_0x27dcae[_0x6f8c('0x33')],'sectionId':_0x27dcae['id']},{})[_0x6f8c('0x2c')](function(){return _0x52f6b3;});}else{return _0x52f6b3;}})[_0x6f8c('0x56')](function(_0x6485c5){logger[_0x6f8c('0x31')](_0x6f8c('0x57'),_0x6485c5);throw _0x6485c5;});}return _0x52f6b3;});}})[_0x6f8c('0x2c')](respondWithResult(_0x53481f,0xc9))[_0x6f8c('0x56')](handleError(_0x53481f,null));};exports[_0x6f8c('0x2b')]=function(_0x374513,_0xdc4b3a){if(_0x374513['body']['id']){delete _0x374513[_0x6f8c('0x4f')]['id'];}return db[_0x6f8c('0x37')][_0x6f8c('0x4d')]({'where':{'id':_0x374513[_0x6f8c('0x4c')]['id']}})[_0x6f8c('0x2c')](handleEntityNotFound(_0xdc4b3a,null))[_0x6f8c('0x2c')](saveUpdates(_0x374513[_0x6f8c('0x4f')],null))[_0x6f8c('0x2c')](respondWithResult(_0xdc4b3a,null))['catch'](handleError(_0xdc4b3a,null));};exports[_0x6f8c('0x2d')]=function(_0x530ac3,_0x4157a4){return db['Dashboard'][_0x6f8c('0x4d')]({'where':{'id':_0x530ac3[_0x6f8c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x4157a4,null))['then'](removeEntity(_0x4157a4,null))[_0x6f8c('0x56')](handleError(_0x4157a4,null));};function widgetAttributes(_0x5a24e8){try{switch(_0x5a24e8[_0x6f8c('0x39')]){case _0x6f8c('0x5a'):return[{'name':'attrUrl','value':_0x5a24e8[_0x6f8c('0x5b')]||(_0x5a24e8['attrs']&&_0x5a24e8[_0x6f8c('0x5c')][0x0]?_0x5a24e8[_0x6f8c('0x5c')][0x0]['value']:undefined)||_0x6f8c('0x5d')}];case _0x6f8c('0x5e'):return[{'name':'attrPath','value':_0x5a24e8[_0x6f8c('0x5f')]||(_0x5a24e8['attrs']&&_0x5a24e8[_0x6f8c('0x5c')][0x0]?_0x5a24e8['attrs'][0x0][_0x6f8c('0x60')]:undefined)||''}];case _0x6f8c('0x61'):return[{'name':'attrHourFormat','value':_0x5a24e8[_0x6f8c('0x62')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8[_0x6f8c('0x5c')][0x0]?_0x5a24e8[_0x6f8c('0x5c')][0x0][_0x6f8c('0x60')]:undefined)||_0x6f8c('0x63')},{'name':_0x6f8c('0x64'),'value':_0x5a24e8['attrTimezone']||(_0x5a24e8['attrs']&&_0x5a24e8[_0x6f8c('0x5c')][0x1]?_0x5a24e8[_0x6f8c('0x5c')][0x1]['value']:undefined)||'0.00'},{'name':_0x6f8c('0x65'),'value':_0x5a24e8[_0x6f8c('0x65')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8['attrs'][0x2]?_0x5a24e8[_0x6f8c('0x5c')][0x2][_0x6f8c('0x60')]:undefined)||0xc}];case _0x6f8c('0x66'):return[{'name':_0x6f8c('0x67'),'value':_0x5a24e8[_0x6f8c('0x67')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8[_0x6f8c('0x5c')][0x0]?_0x5a24e8[_0x6f8c('0x5c')][0x0][_0x6f8c('0x60')]:undefined)||_0x6f8c('0x68')},{'name':_0x6f8c('0x69'),'value':_0x5a24e8[_0x6f8c('0x69')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8[_0x6f8c('0x5c')][0x1]?_0x5a24e8[_0x6f8c('0x5c')][0x1]['value']:undefined)||[]},{'name':_0x6f8c('0x65'),'value':_0x5a24e8['attrFontSize']||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8['attrs'][0x2]?_0x5a24e8[_0x6f8c('0x5c')][0x2][_0x6f8c('0x60')]:undefined)||0x14},{'name':_0x6f8c('0x6a'),'value':_0x5a24e8[_0x6f8c('0x6a')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8['attrs'][0x3]?_0x5a24e8['attrs'][0x3][_0x6f8c('0x60')]:undefined)||_0x6f8c('0x6b')},{'name':_0x6f8c('0x6c'),'value':_0x5a24e8[_0x6f8c('0x6c')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8[_0x6f8c('0x5c')][0x4]?_0x5a24e8[_0x6f8c('0x5c')][0x4][_0x6f8c('0x60')]:undefined)||''},{'name':_0x6f8c('0x6d'),'value':_0x5a24e8[_0x6f8c('0x6d')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8['attrs'][0x5]?_0x5a24e8[_0x6f8c('0x5c')][0x5][_0x6f8c('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5a24e8['attrSmsAccounts']||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8[_0x6f8c('0x5c')][0x6]?_0x5a24e8[_0x6f8c('0x5c')][0x6][_0x6f8c('0x60')]:undefined)||''},{'name':_0x6f8c('0x6e'),'value':_0x5a24e8[_0x6f8c('0x6e')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8['attrs'][0x7]?_0x5a24e8[_0x6f8c('0x5c')][0x7]['value']:undefined)||''},{'name':_0x6f8c('0x6f'),'value':_0x5a24e8[_0x6f8c('0x6f')]||(_0x5a24e8['attrs']&&_0x5a24e8[_0x6f8c('0x5c')][0x8]?_0x5a24e8[_0x6f8c('0x5c')][0x8][_0x6f8c('0x60')]:undefined)||''},{'name':_0x6f8c('0x70'),'value':_0x5a24e8[_0x6f8c('0x70')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8[_0x6f8c('0x5c')][0x9]?_0x5a24e8['attrs'][0x9][_0x6f8c('0x60')]:undefined)||''}];case _0x6f8c('0x71'):case _0x6f8c('0x72'):return[{'name':_0x6f8c('0x73'),'value':_0x5a24e8[_0x6f8c('0x73')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8[_0x6f8c('0x5c')][0x0]?_0x5a24e8[_0x6f8c('0x5c')][0x0][_0x6f8c('0x60')]:undefined)||'total'},{'name':_0x6f8c('0x74'),'value':_0x5a24e8[_0x6f8c('0x74')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8[_0x6f8c('0x5c')][0x1]?_0x5a24e8[_0x6f8c('0x5c')][0x1][_0x6f8c('0x60')]:undefined)||null},{'name':_0x6f8c('0x75'),'value':_0x5a24e8[_0x6f8c('0x75')]||(_0x5a24e8['attrs']&&_0x5a24e8[_0x6f8c('0x5c')][0x2]?_0x5a24e8['attrs'][0x2][_0x6f8c('0x60')]:undefined)||null},{'name':_0x6f8c('0x69'),'value':_0x5a24e8[_0x6f8c('0x69')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8[_0x6f8c('0x5c')][0x3]?_0x5a24e8[_0x6f8c('0x5c')][0x3][_0x6f8c('0x60')]:undefined)||[]},{'name':_0x6f8c('0x6a'),'value':_0x5a24e8[_0x6f8c('0x6a')]||(_0x5a24e8['attrs']&&_0x5a24e8[_0x6f8c('0x5c')][0x4]?_0x5a24e8[_0x6f8c('0x5c')][0x4][_0x6f8c('0x60')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x5a24e8[_0x6f8c('0x6c')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8[_0x6f8c('0x5c')][0x5]?_0x5a24e8[_0x6f8c('0x5c')][0x5][_0x6f8c('0x60')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x5a24e8['attrFaxAccounts']||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8[_0x6f8c('0x5c')][0x6]?_0x5a24e8['attrs'][0x6][_0x6f8c('0x60')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x5a24e8[_0x6f8c('0x76')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8['attrs'][0x7]?_0x5a24e8[_0x6f8c('0x5c')][0x7][_0x6f8c('0x60')]:undefined)||''},{'name':'attrOpenchannelAccounts','value':_0x5a24e8['attrOpenchannelAccounts']||(_0x5a24e8['attrs']&&_0x5a24e8[_0x6f8c('0x5c')][0x8]?_0x5a24e8[_0x6f8c('0x5c')][0x8][_0x6f8c('0x60')]:undefined)||''},{'name':_0x6f8c('0x6f'),'value':_0x5a24e8['attrWhatsappAccounts']||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8[_0x6f8c('0x5c')][0x9]?_0x5a24e8[_0x6f8c('0x5c')][0x9]['value']:undefined)||''},{'name':_0x6f8c('0x70'),'value':_0x5a24e8[_0x6f8c('0x70')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8[_0x6f8c('0x5c')][0xa]?_0x5a24e8[_0x6f8c('0x5c')][0xa][_0x6f8c('0x60')]:undefined)||''}];case _0x6f8c('0x77'):return[{'name':_0x6f8c('0x78'),'type':_0x5a24e8[_0x6f8c('0x79')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8[_0x6f8c('0x5c')][0x0]?_0x5a24e8['attrs'][0x0][_0x6f8c('0x39')]:undefined)||null,'value':_0x5a24e8[_0x6f8c('0x78')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8['attrs'][0x0]?_0x5a24e8['attrs'][0x0][_0x6f8c('0x60')]:undefined)||null},{'name':_0x6f8c('0x7a'),'value':_0x5a24e8[_0x6f8c('0x7a')]||(_0x5a24e8[_0x6f8c('0x5c')]&&_0x5a24e8['attrs'][0x1]?_0x5a24e8[_0x6f8c('0x5c')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x58f9f8){logger['error'](_0x6f8c('0x7b'),JSON[_0x6f8c('0x7c')](_0x58f9f8));return[];}}exports[_0x6f8c('0x7d')]=function(_0x5e86cb,_0x5b92da,_0x4c63bb){if(_0x5e86cb[_0x6f8c('0x4f')]['id']){delete _0x5e86cb[_0x6f8c('0x4f')]['id'];}return db[_0x6f8c('0x37')][_0x6f8c('0x4d')]({'where':{'id':_0x5e86cb[_0x6f8c('0x4c')]['id']}})[_0x6f8c('0x2c')](handleEntityNotFound(_0x5b92da,null))[_0x6f8c('0x2c')](function(_0x9918a0){if(_0x9918a0){_0x5e86cb[_0x6f8c('0x4f')]['DashboardId']=_0x9918a0['id'];_0x5e86cb[_0x6f8c('0x4f')][_0x6f8c('0x5c')]=widgetAttributes(_0x5e86cb[_0x6f8c('0x4f')]);return db[_0x6f8c('0x7e')][_0x6f8c('0x4e')](_0x5e86cb[_0x6f8c('0x4f')]);}})[_0x6f8c('0x2c')](respondWithResult(_0x5b92da,null))[_0x6f8c('0x56')](handleError(_0x5b92da,null));};exports[_0x6f8c('0x7f')]=function(_0x517d56,_0x2f0e04,_0x41237a){var _0x42a127={};var _0x48b4bb={};var _0x1f6f4c;var _0x2ddeb7;return db[_0x6f8c('0x37')][_0x6f8c('0x80')]({'where':{'id':_0x517d56[_0x6f8c('0x4c')]['id']}})['then'](handleEntityNotFound(_0x2f0e04,null))[_0x6f8c('0x2c')](function(_0x1c7c56){if(_0x1c7c56){_0x1f6f4c=_0x1c7c56;_0x48b4bb[_0x6f8c('0x3b')]=_[_0x6f8c('0x3c')](db['DashboardItem']['rawAttributes']);_0x48b4bb[_0x6f8c('0x3d')]=_['keys'](_0x517d56[_0x6f8c('0x3d')]);_0x48b4bb[_0x6f8c('0x3e')]=_['intersection'](_0x48b4bb[_0x6f8c('0x3b')],_0x48b4bb[_0x6f8c('0x3d')]);_0x42a127[_0x6f8c('0x40')]=_[_0x6f8c('0x3f')](_0x48b4bb['model'],qs['fields'](_0x517d56['query'][_0x6f8c('0x41')]));_0x42a127[_0x6f8c('0x40')]=_0x42a127['attributes'][_0x6f8c('0x42')]?_0x42a127[_0x6f8c('0x40')]:_0x48b4bb[_0x6f8c('0x3b')];_0x42a127['order']=qs[_0x6f8c('0x44')](_0x517d56[_0x6f8c('0x3d')]['sort']);_0x42a127[_0x6f8c('0x47')]=qs[_0x6f8c('0x3e')](_[_0x6f8c('0x81')](_0x517d56[_0x6f8c('0x3d')],_0x48b4bb[_0x6f8c('0x3e')]));if(_0x517d56[_0x6f8c('0x3d')][_0x6f8c('0x45')]){_0x42a127[_0x6f8c('0x47')]=_[_0x6f8c('0x46')](_0x42a127[_0x6f8c('0x47')],{'$or':_[_0x6f8c('0x36')](_0x42a127['attributes'],function(_0x45cadd){var _0x1af39e={};_0x1af39e[_0x45cadd]={'$like':'%'+_0x517d56[_0x6f8c('0x3d')][_0x6f8c('0x45')]+'%'};return _0x1af39e;})});}_0x42a127=_[_0x6f8c('0x46')]({},_0x42a127,_0x517d56[_0x6f8c('0x48')]);return _0x1f6f4c['getItems'](_0x42a127);}})[_0x6f8c('0x2c')](function(_0xd08e26){if(_0xd08e26){_0x2ddeb7=_0xd08e26['length'];if(!_0x517d56[_0x6f8c('0x3d')][_0x6f8c('0x82')](_0x6f8c('0x83'))){_0x42a127[_0x6f8c('0x24')]=qs[_0x6f8c('0x24')](_0x517d56[_0x6f8c('0x3d')][_0x6f8c('0x24')]);_0x42a127['offset']=qs[_0x6f8c('0x22')](_0x517d56[_0x6f8c('0x3d')][_0x6f8c('0x22')]);}return _0x1f6f4c[_0x6f8c('0x7f')](_0x42a127);}})['then'](function(_0x38fe38){if(_0x38fe38){return _0x38fe38?{'count':_0x2ddeb7,'rows':_0x38fe38}:null;}})['then'](respondWithResult(_0x2f0e04,null))[_0x6f8c('0x56')](handleError(_0x2f0e04,null));}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.events.js b/server/api/dashboard/dashboard.events.js index 5e765d2..3b7aa6c 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 _0xbb36=['exports','events','../../mysqldb','Dashboard','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x3d3590,_0x23bd12){var _0x1348ff=function(_0x26a61a){while(--_0x26a61a){_0x3d3590['push'](_0x3d3590['shift']());}};_0x1348ff(++_0x23bd12);}(_0xbb36,0x105));var _0x6bb3=function(_0x1ba76a,_0x56fe36){_0x1ba76a=_0x1ba76a-0x0;var _0x34b474=_0xbb36[_0x1ba76a];return _0x34b474;};'use strict';var EventEmitter=require(_0x6bb3('0x0'));var Dashboard=require(_0x6bb3('0x1'))['db'][_0x6bb3('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x6bb3('0x3'),'afterUpdate':_0x6bb3('0x4'),'afterDestroy':_0x6bb3('0x5')};function emitEvent(_0x4806f0){return function(_0x1081fc,_0x1b753d,_0x10da1e){DashboardEvents[_0x6bb3('0x6')](_0x4806f0+':'+_0x1081fc['id'],_0x1081fc);DashboardEvents[_0x6bb3('0x6')](_0x4806f0,_0x1081fc);_0x10da1e(null);};}for(var e in events){if(events[_0x6bb3('0x7')](e)){var event=events[e];Dashboard[_0x6bb3('0x8')](e,emitEvent(event));}}module[_0x6bb3('0x9')]=DashboardEvents; \ No newline at end of file +var _0x0309=['hook','events','../../mysqldb','Dashboard','setMaxListeners','save','remove'];(function(_0x2735df,_0x37eef9){var _0x3d3c11=function(_0x3ed6e5){while(--_0x3ed6e5){_0x2735df['push'](_0x2735df['shift']());}};_0x3d3c11(++_0x37eef9);}(_0x0309,0x8d));var _0x9030=function(_0x9861e9,_0x9d2516){_0x9861e9=_0x9861e9-0x0;var _0x22689d=_0x0309[_0x9861e9];return _0x22689d;};'use strict';var EventEmitter=require(_0x9030('0x0'));var Dashboard=require(_0x9030('0x1'))['db'][_0x9030('0x2')];var DashboardEvents=new EventEmitter();DashboardEvents[_0x9030('0x3')](0x0);var events={'afterCreate':_0x9030('0x4'),'afterUpdate':'update','afterDestroy':_0x9030('0x5')};function emitEvent(_0x1131fd){return function(_0x4aa8c5,_0x52abf3,_0x300f73){DashboardEvents['emit'](_0x1131fd+':'+_0x4aa8c5['id'],_0x4aa8c5);DashboardEvents['emit'](_0x1131fd,_0x4aa8c5);_0x300f73(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Dashboard[_0x9030('0x6')](e,emitEvent(event));}}module['exports']=DashboardEvents; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.model.js b/server/api/dashboard/dashboard.model.js index 65e3f9b..467da24 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 _0xaae6=['exports','define','Dashboard','dashboards','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0xc58c37,_0x26c0c8){var _0x7dcf67=function(_0x27859f){while(--_0x27859f){_0xc58c37['push'](_0xc58c37['shift']());}};_0x7dcf67(++_0x26c0c8);}(_0xaae6,0x17a));var _0x6aae=function(_0x12f309,_0x28bf43){_0x12f309=_0x12f309-0x0;var _0x351b8a=_0xaae6[_0x12f309];return _0x351b8a;};'use strict';var _=require(_0x6aae('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x6aae('0x1'));var moment=require('moment');var BPromise=require(_0x6aae('0x2'));var rp=require(_0x6aae('0x3'));var fs=require('fs');var path=require(_0x6aae('0x4'));var rimraf=require(_0x6aae('0x5'));var config=require(_0x6aae('0x6'));var attributes=require('./dashboard.attributes');module[_0x6aae('0x7')]=function(_0x2c7ab7,_0x4875c1){return _0x2c7ab7[_0x6aae('0x8')](_0x6aae('0x9'),attributes,{'tableName':_0x6aae('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc271=['rimraf','../../config/environment','./dashboard.attributes','define','Dashboard','dashboards','lodash','util','../../config/logger','api','bluebird','path'];(function(_0x2b0e97,_0x3c3b9f){var _0x2623c5=function(_0x386e58){while(--_0x386e58){_0x2b0e97['push'](_0x2b0e97['shift']());}};_0x2623c5(++_0x3c3b9f);}(_0xc271,0xae));var _0x1c27=function(_0x1d89f0,_0x5acfa4){_0x1d89f0=_0x1d89f0-0x0;var _0x208010=_0xc271[_0x1d89f0];return _0x208010;};'use strict';var _=require(_0x1c27('0x0'));var util=require(_0x1c27('0x1'));var logger=require(_0x1c27('0x2'))(_0x1c27('0x3'));var moment=require('moment');var BPromise=require(_0x1c27('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1c27('0x5'));var rimraf=require(_0x1c27('0x6'));var config=require(_0x1c27('0x7'));var attributes=require(_0x1c27('0x8'));module['exports']=function(_0x48f34d,_0x46f53){return _0x48f34d[_0x1c27('0x9')](_0x1c27('0xa'),attributes,{'tableName':_0x1c27('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboard/dashboard.rpc.js b/server/api/dashboard/dashboard.rpc.js index 22d048d..cfa6317 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 _0x0a50=['result','catch','lodash','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','redis','./dashboard.socket','register','request','then','info','request\x20sent','debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','code','Dashboard,\x20%s,\x20%s','message'];(function(_0x4f432b,_0x1763ae){var _0x890eb4=function(_0x3125be){while(--_0x3125be){_0x4f432b['push'](_0x4f432b['shift']());}};_0x890eb4(++_0x1763ae);}(_0x0a50,0x154));var _0x00a5=function(_0x3a136b,_0x2080d7){_0x3a136b=_0x3a136b-0x0;var _0x4fdf25=_0x0a50[_0x3a136b];return _0x4fdf25;};'use strict';var _=require(_0x00a5('0x0'));var util=require(_0x00a5('0x1'));var moment=require('moment');var BPromise=require(_0x00a5('0x2'));var rs=require(_0x00a5('0x3'));var fs=require('fs');var Redis=require(_0x00a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x00a5('0x5'));var logger=require(_0x00a5('0x6'))(_0x00a5('0x7'));var config=require(_0x00a5('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x00a5('0x9')]({'port':0x232a});config[_0x00a5('0xa')]=_['defaults'](config[_0x00a5('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x00a5('0xa')]));require(_0x00a5('0xb'))[_0x00a5('0xc')](socket);function respondWithRpcPromise(_0xe9e80a,_0x4048ca,_0x16c509){return new BPromise(function(_0x226d48,_0x4a4ccf){return client[_0x00a5('0xd')](_0xe9e80a,_0x16c509)[_0x00a5('0xe')](function(_0x23f1ca){logger[_0x00a5('0xf')]('Dashboard,\x20%s,\x20%s',_0x4048ca,_0x00a5('0x10'));logger[_0x00a5('0x11')](_0x00a5('0x12'),_0x4048ca,'request\x20sent',JSON[_0x00a5('0x13')](_0x23f1ca));if(_0x23f1ca[_0x00a5('0x14')]){if(_0x23f1ca[_0x00a5('0x14')][_0x00a5('0x15')]===0x1f4){logger[_0x00a5('0x14')](_0x00a5('0x16'),_0x4048ca,_0x23f1ca[_0x00a5('0x14')][_0x00a5('0x17')]);return _0x4a4ccf(_0x23f1ca[_0x00a5('0x14')][_0x00a5('0x17')]);}logger[_0x00a5('0x14')](_0x00a5('0x16'),_0x4048ca,_0x23f1ca['error'][_0x00a5('0x17')]);return _0x226d48(_0x23f1ca['error'][_0x00a5('0x17')]);}else{logger['info'](_0x00a5('0x16'),_0x4048ca,_0x00a5('0x10'));_0x226d48(_0x23f1ca[_0x00a5('0x18')][_0x00a5('0x17')]);}})[_0x00a5('0x19')](function(_0x2f5d8f){logger[_0x00a5('0x14')](_0x00a5('0x16'),_0x4048ca,_0x2f5d8f);_0x4a4ccf(_0x2f5d8f);});});} \ No newline at end of file +var _0x00c2=['debug','Dashboard,\x20%s,\x20%s,\x20%s','stringify','error','message','result','bluebird','randomstring','../../mysqldb','jayson/promise','client','redis','defaults','socket.io-emitter','request','then','info','Dashboard,\x20%s,\x20%s','request\x20sent'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0x00c2,0x78));var _0x200c=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x00c2[_0x501510];return _0x1e6ee5;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x200c('0x0'));var rs=require(_0x200c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x200c('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x200c('0x3'));var client=jayson[_0x200c('0x4')]['http']({'port':0x232a});config[_0x200c('0x5')]=_[_0x200c('0x6')](config[_0x200c('0x5')],{'host':'localhost','port':0x18eb});var socket=require(_0x200c('0x7'))(new Redis(config[_0x200c('0x5')]));require('./dashboard.socket')['register'](socket);function respondWithRpcPromise(_0x320e6e,_0x59ba3a,_0x5a4504){return new BPromise(function(_0x10eb6a,_0x48d79b){return client[_0x200c('0x8')](_0x320e6e,_0x5a4504)[_0x200c('0x9')](function(_0x27946a){logger[_0x200c('0xa')](_0x200c('0xb'),_0x59ba3a,_0x200c('0xc'));logger[_0x200c('0xd')](_0x200c('0xe'),_0x59ba3a,_0x200c('0xc'),JSON[_0x200c('0xf')](_0x27946a));if(_0x27946a[_0x200c('0x10')]){if(_0x27946a[_0x200c('0x10')]['code']===0x1f4){logger[_0x200c('0x10')]('Dashboard,\x20%s,\x20%s',_0x59ba3a,_0x27946a[_0x200c('0x10')][_0x200c('0x11')]);return _0x48d79b(_0x27946a[_0x200c('0x10')][_0x200c('0x11')]);}logger[_0x200c('0x10')]('Dashboard,\x20%s,\x20%s',_0x59ba3a,_0x27946a[_0x200c('0x10')][_0x200c('0x11')]);return _0x10eb6a(_0x27946a[_0x200c('0x10')][_0x200c('0x11')]);}else{logger[_0x200c('0xa')]('Dashboard,\x20%s,\x20%s',_0x59ba3a,'request\x20sent');_0x10eb6a(_0x27946a[_0x200c('0x12')][_0x200c('0x11')]);}})['catch'](function(_0x20462a){logger[_0x200c('0x10')](_0x200c('0xb'),_0x59ba3a,_0x20462a);_0x48d79b(_0x20462a);});});} \ No newline at end of file diff --git a/server/api/dashboard/dashboard.socket.js b/server/api/dashboard/dashboard.socket.js index 6ff2a2a..c856f71 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 _0x6750=['length','dashboard:','save','remove','update','emit'];(function(_0x5f7cb2,_0x4d564d){var _0xa868d7=function(_0x57ff6f){while(--_0x57ff6f){_0x5f7cb2['push'](_0x5f7cb2['shift']());}};_0xa868d7(++_0x4d564d);}(_0x6750,0x10a));var _0x0675=function(_0x417bbf,_0xb55c9f){_0x417bbf=_0x417bbf-0x0;var _0x464378=_0x6750[_0x417bbf];return _0x464378;};'use strict';var DashboardEvents=require('./dashboard.events');var events=[_0x0675('0x0'),_0x0675('0x1'),_0x0675('0x2')];function createListener(_0x31f64e,_0x28736c){return function(_0x18d1ce){_0x28736c[_0x0675('0x3')](_0x31f64e,_0x18d1ce);};}function removeListener(_0x2632d1,_0xb219bb){return function(){DashboardEvents['removeListener'](_0x2632d1,_0xb219bb);};}exports['register']=function(_0x16fcf6){for(var _0x4fb3af=0x0,_0x3a870d=events[_0x0675('0x4')];_0x4fb3af<_0x3a870d;_0x4fb3af++){var _0x2c7433=events[_0x4fb3af];var _0x584a00=createListener(_0x0675('0x5')+_0x2c7433,_0x16fcf6);DashboardEvents['on'](_0x2c7433,_0x584a00);}}; \ No newline at end of file +var _0xcd5c=['update','removeListener','register','length','dashboard:','remove'];(function(_0x33adb7,_0x5b72a7){var _0x3fbc94=function(_0x316592){while(--_0x316592){_0x33adb7['push'](_0x33adb7['shift']());}};_0x3fbc94(++_0x5b72a7);}(_0xcd5c,0x11f));var _0xccd5=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xcd5c[_0x4a9fb1];return _0x348672;};'use strict';var DashboardEvents=require('./dashboard.events');var events=['save',_0xccd5('0x0'),_0xccd5('0x1')];function createListener(_0x24b25b,_0x127af3){return function(_0x323bb8){_0x127af3['emit'](_0x24b25b,_0x323bb8);};}function removeListener(_0x28242f,_0x5aa6f4){return function(){DashboardEvents[_0xccd5('0x2')](_0x28242f,_0x5aa6f4);};}exports[_0xccd5('0x3')]=function(_0x585382){for(var _0x144bba=0x0,_0x4f0e1e=events[_0xccd5('0x4')];_0x144bba<_0x4f0e1e;_0x144bba++){var _0x447ce5=events[_0x144bba];var _0x166caa=createListener(_0xccd5('0x5')+_0x447ce5,_0x585382);DashboardEvents['on'](_0x447ce5,_0x166caa);}}; \ No newline at end of file diff --git a/server/api/dashboard/index.js b/server/api/dashboard/index.js index 0e9f6e5..aef5863 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 _0xd035=['get','index','/:id','isAuthenticated','/:id/items','getItems','post','create','addItem','update','delete','destroy','exports','util','connect-timeout','fs-extra','../../components/interaction/service','./dashboard.controller'];(function(_0x490893,_0x30e994){var _0x32f3ac=function(_0x21076c){while(--_0x21076c){_0x490893['push'](_0x490893['shift']());}};_0x32f3ac(++_0x30e994);}(_0xd035,0x151));var _0x5d03=function(_0x41c381,_0x1176bd){_0x41c381=_0x41c381-0x0;var _0x427981=_0xd035[_0x41c381];return _0x427981;};'use strict';var multer=require('multer');var util=require(_0x5d03('0x0'));var path=require('path');var timeout=require(_0x5d03('0x1'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x5d03('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x5d03('0x3'));var config=require('../../config/environment');var controller=require(_0x5d03('0x4'));router[_0x5d03('0x5')]('/',auth['isAuthenticated'](),controller[_0x5d03('0x6')]);router[_0x5d03('0x5')](_0x5d03('0x7'),auth[_0x5d03('0x8')](),controller['show']);router[_0x5d03('0x5')](_0x5d03('0x9'),auth[_0x5d03('0x8')](),controller[_0x5d03('0xa')]);router[_0x5d03('0xb')]('/',auth[_0x5d03('0x8')](),controller[_0x5d03('0xc')]);router[_0x5d03('0xb')]('/:id/clone',auth[_0x5d03('0x8')](),controller['clone']);router[_0x5d03('0xb')](_0x5d03('0x9'),auth[_0x5d03('0x8')](),controller[_0x5d03('0xd')]);router['put'](_0x5d03('0x7'),auth[_0x5d03('0x8')](),controller[_0x5d03('0xe')]);router[_0x5d03('0xf')]('/:id',auth[_0x5d03('0x8')](),controller[_0x5d03('0x10')]);module[_0x5d03('0x11')]=router; \ No newline at end of file +var _0x9464=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboard.controller','get','isAuthenticated','index','/:id','show','getItems','create','post','/:id/clone','clone','/:id/items','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2b4411,_0x2625ed){var _0x8e41ef=function(_0x2aa8c1){while(--_0x2aa8c1){_0x2b4411['push'](_0x2b4411['shift']());}};_0x8e41ef(++_0x2625ed);}(_0x9464,0x104));var _0x4946=function(_0x108d5f,_0x33f82d){_0x108d5f=_0x108d5f-0x0;var _0x456ea3=_0x9464[_0x108d5f];return _0x456ea3;};'use strict';var multer=require(_0x4946('0x0'));var util=require(_0x4946('0x1'));var path=require(_0x4946('0x2'));var timeout=require(_0x4946('0x3'));var express=require(_0x4946('0x4'));var router=express[_0x4946('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x4946('0x6'));var interaction=require(_0x4946('0x7'));var config=require(_0x4946('0x8'));var controller=require(_0x4946('0x9'));router[_0x4946('0xa')]('/',auth[_0x4946('0xb')](),controller[_0x4946('0xc')]);router[_0x4946('0xa')](_0x4946('0xd'),auth['isAuthenticated'](),controller[_0x4946('0xe')]);router[_0x4946('0xa')]('/:id/items',auth[_0x4946('0xb')](),controller[_0x4946('0xf')]);router['post']('/',auth[_0x4946('0xb')](),controller[_0x4946('0x10')]);router[_0x4946('0x11')](_0x4946('0x12'),auth[_0x4946('0xb')](),controller[_0x4946('0x13')]);router['post'](_0x4946('0x14'),auth[_0x4946('0xb')](),controller['addItem']);router['put'](_0x4946('0xd'),auth[_0x4946('0xb')](),controller['update']);router[_0x4946('0x15')](_0x4946('0xd'),auth[_0x4946('0xb')](),controller[_0x4946('0x16')]);module[_0x4946('0x17')]=router; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.attributes.js b/server/api/dashboardItem/dashboardItem.attributes.js index 6185c94..ca6d0cd 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 _0xda19=['TEXT','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','squel','lodash','STRING'];(function(_0x3e2fcf,_0x579110){var _0x497db7=function(_0x2f713d){while(--_0x2f713d){_0x3e2fcf['push'](_0x3e2fcf['shift']());}};_0x497db7(++_0x579110);}(_0xda19,0xd5));var _0x9da1=function(_0x29ad48,_0x24f5bf){_0x29ad48=_0x29ad48-0x0;var _0x5256cf=_0xda19[_0x29ad48];return _0x5256cf;};'use strict';var Sequelize=require('sequelize');var squel=require(_0x9da1('0x0'));var _=require(_0x9da1('0x1'));module['exports']={'title':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x9da1('0x3')]('long'),'get':function(){try{return JSON[_0x9da1('0x4')](this[_0x9da1('0x5')](_0x9da1('0x6')));}catch(_0x470043){return[];}},'set':function(_0x156faf){try{this[_0x9da1('0x7')](_0x9da1('0x6'),JSON[_0x9da1('0x8')](_0x156faf));}catch(_0x1c24e6){this[_0x9da1('0x7')]('attrs',JSON['stringify']([]));}}},'sizeX':{'type':Sequelize['INTEGER'],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x9da1('0x9')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize['INTEGER']},'col':{'type':Sequelize[_0x9da1('0x9')]},'background':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![],'defaultValue':_0x9da1('0xa'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x9da1('0x2')],'allowNull':![],'defaultValue':_0x9da1('0xb'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x9da1('0x2')]},'titleFontSize':{'type':Sequelize[_0x9da1('0x9')],'defaultValue':0xc}}; \ No newline at end of file +var _0xb4c7=['TEXT','long','parse','getDataValue','attrs','setDataValue','stringify','INTEGER','#ffffff','#2196f3','sequelize','squel','lodash','exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xb4c7,0x1ea));var _0x7b4c=function(_0x1f8fec,_0x348c1a){_0x1f8fec=_0x1f8fec-0x0;var _0x5dbc4e=_0xb4c7[_0x1f8fec];return _0x5dbc4e;};'use strict';var Sequelize=require(_0x7b4c('0x0'));var squel=require(_0x7b4c('0x1'));var _=require(_0x7b4c('0x2'));module[_0x7b4c('0x3')]={'title':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![]},'type':{'type':Sequelize['STRING'](0x14),'allowNull':![],'validate':{'len':[0x1,0x14]}},'attrs':{'type':Sequelize[_0x7b4c('0x5')](_0x7b4c('0x6')),'get':function(){try{return JSON[_0x7b4c('0x7')](this[_0x7b4c('0x8')](_0x7b4c('0x9')));}catch(_0x5adec9){return[];}},'set':function(_0x1b0f57){try{this[_0x7b4c('0xa')](_0x7b4c('0x9'),JSON['stringify'](_0x1b0f57));}catch(_0x2d7b7e){this[_0x7b4c('0xa')]('attrs',JSON[_0x7b4c('0xb')]([]));}}},'sizeX':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'sizeY':{'type':Sequelize[_0x7b4c('0xc')],'allowNull':![],'defaultValue':0x1},'row':{'type':Sequelize[_0x7b4c('0xc')]},'col':{'type':Sequelize[_0x7b4c('0xc')]},'background':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xd'),'validate':{'notEmpty':!![]}},'foreground':{'type':Sequelize[_0x7b4c('0x4')],'allowNull':![],'defaultValue':_0x7b4c('0xe'),'validate':{'notEmpty':!![]}},'link':{'type':Sequelize[_0x7b4c('0x4')]},'titleFontSize':{'type':Sequelize['INTEGER'],'defaultValue':0xc}}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.controller.js b/server/api/dashboardItem/dashboardItem.controller.js index 33f6340..6f3ea8e 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 _0xb091=['localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','DashboardItem','query','filters','intersection','attributes','fields','length','includeAll','include','merge','options','find','catch','type','iframe','attrUrl','attrs','value','https://','custom','attrPath','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','attrVoiceQueues','attrChannel','voice','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','multibar-chart','attrSerie1','total','attrSerie2','web-report','attrReport','reportType','attrRefresh','stringify','create','body','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../mysqldb','redis','defaults'];(function(_0x5baa98,_0x9e5c5){var _0x5b8e22=function(_0x503958){while(--_0x503958){_0x5baa98['push'](_0x5baa98['shift']());}};_0x5b8e22(++_0x9e5c5);}(_0xb091,0x16e));var _0x1b09=function(_0x3cd767,_0x12f37e){_0x3cd767=_0x3cd767-0x0;var _0x359a40=_0xb091[_0x3cd767];return _0x359a40;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x1b09('0x0'));var zipdir=require(_0x1b09('0x1'));var jsonpatch=require(_0x1b09('0x2'));var rp=require(_0x1b09('0x3'));var moment=require('moment');var BPromise=require(_0x1b09('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x1b09('0x5'));var sox=require(_0x1b09('0x6'));var csv=require('to-csv');var ejs=require(_0x1b09('0x7'));var fs=require('fs');var fs_extra=require(_0x1b09('0x8'));var _=require(_0x1b09('0x9'));var squel=require('squel');var crypto=require(_0x1b09('0xa'));var jsforce=require(_0x1b09('0xb'));var deskjs=require(_0x1b09('0xc'));var toCsv=require(_0x1b09('0xd'));var querystring=require(_0x1b09('0xe'));var Papa=require(_0x1b09('0xf'));var Redis=require(_0x1b09('0x10'));var authService=require(_0x1b09('0x11'));var qs=require(_0x1b09('0x12'));var as=require(_0x1b09('0x13'));var hardwareService=require(_0x1b09('0x14'));var logger=require('../../config/logger')(_0x1b09('0x15'));var utils=require(_0x1b09('0x16'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x1b09('0x17'))['db'];config[_0x1b09('0x18')]=_[_0x1b09('0x19')](config[_0x1b09('0x18')],{'host':_0x1b09('0x1a'),'port':0x18eb});var socket=require(_0x1b09('0x1b'))(new Redis(config[_0x1b09('0x18')]));require('./dashboardItem.socket')[_0x1b09('0x1c')](socket);function respondWithStatusCode(_0x515ade,_0x455a8e){_0x455a8e=_0x455a8e||0xcc;return function(_0x27a731){if(_0x27a731){return _0x515ade[_0x1b09('0x1d')](_0x455a8e);}return _0x515ade[_0x1b09('0x1e')](_0x455a8e)[_0x1b09('0x1f')]();};}function respondWithResult(_0x1dc96b,_0x64689a){_0x64689a=_0x64689a||0xc8;return function(_0x33129b){if(_0x33129b){return _0x1dc96b[_0x1b09('0x1e')](_0x64689a)[_0x1b09('0x20')](_0x33129b);}};}function respondWithFilteredResult(_0x311158,_0x231ef6){return function(_0x646575){if(_0x646575){var _0x4c64e1=typeof _0x231ef6[_0x1b09('0x21')]===_0x1b09('0x22')&&typeof _0x231ef6['limit']==='undefined';var _0xe93ac4=_0x646575['count'];var _0x267b5e=_0x4c64e1?0x0:_0x231ef6['offset'];var _0x136697=_0x4c64e1?_0x646575[_0x1b09('0x23')]:_0x231ef6[_0x1b09('0x21')]+_0x231ef6[_0x1b09('0x24')];var _0x29dd70;if(_0x136697>=_0xe93ac4){_0x136697=_0xe93ac4;_0x29dd70=0xc8;}else{_0x29dd70=0xce;}_0x311158[_0x1b09('0x1e')](_0x29dd70);return _0x311158[_0x1b09('0x25')](_0x1b09('0x26'),_0x267b5e+'-'+_0x136697+'/'+_0xe93ac4)['json'](_0x646575);}return null;};}function patchUpdates(_0x5e2806){return function(_0x27f4f5){try{jsonpatch[_0x1b09('0x27')](_0x27f4f5,_0x5e2806,!![]);}catch(_0x4ce7dc){return BPromise[_0x1b09('0x28')](_0x4ce7dc);}return _0x27f4f5[_0x1b09('0x29')]();};}function saveUpdates(_0x6e132c,_0xb22064){return function(_0x5a9677){if(_0x5a9677){return _0x5a9677[_0x1b09('0x2a')](_0x6e132c)[_0x1b09('0x2b')](function(_0x4936d0){return _0x4936d0;});}return null;};}function removeEntity(_0x2d3b86,_0x472d30){return function(_0x4dd3e5){if(_0x4dd3e5){return _0x4dd3e5[_0x1b09('0x2c')]()[_0x1b09('0x2b')](function(){_0x2d3b86[_0x1b09('0x1e')](0xcc)[_0x1b09('0x1f')]();});}};}function handleEntityNotFound(_0x547fbb,_0xb3cf07){return function(_0x3cdbc5){if(!_0x3cdbc5){_0x547fbb['sendStatus'](0x194);}return _0x3cdbc5;};}function handleError(_0x2d1ec0,_0x406748){_0x406748=_0x406748||0x1f4;return function(_0x26befb){logger[_0x1b09('0x2d')](_0x26befb[_0x1b09('0x2e')]);if(_0x26befb[_0x1b09('0x2f')]){delete _0x26befb[_0x1b09('0x2f')];}_0x2d1ec0['status'](_0x406748)[_0x1b09('0x30')](_0x26befb);};}exports[_0x1b09('0x31')]=function(_0x4bf0ad,_0x34d912){var _0x1a6130={'raw':![],'where':{'id':_0x4bf0ad[_0x1b09('0x32')]['id']}},_0x1b98da={};_0x1b98da[_0x1b09('0x33')]=_['keys'](db[_0x1b09('0x34')]['rawAttributes']);_0x1b98da[_0x1b09('0x35')]=_['keys'](_0x4bf0ad[_0x1b09('0x35')]);_0x1b98da[_0x1b09('0x36')]=_[_0x1b09('0x37')](_0x1b98da[_0x1b09('0x33')],_0x1b98da[_0x1b09('0x35')]);_0x1a6130[_0x1b09('0x38')]=_[_0x1b09('0x37')](_0x1b98da[_0x1b09('0x33')],qs[_0x1b09('0x39')](_0x4bf0ad[_0x1b09('0x35')]['fields']));_0x1a6130[_0x1b09('0x38')]=_0x1a6130[_0x1b09('0x38')][_0x1b09('0x3a')]?_0x1a6130['attributes']:_0x1b98da[_0x1b09('0x33')];if(_0x4bf0ad[_0x1b09('0x35')][_0x1b09('0x3b')]){_0x1a6130[_0x1b09('0x3c')]=[{'all':!![]}];}_0x1a6130=_[_0x1b09('0x3d')]({},_0x1a6130,_0x4bf0ad[_0x1b09('0x3e')]);return db[_0x1b09('0x34')][_0x1b09('0x3f')](_0x1a6130)['then'](handleEntityNotFound(_0x34d912,null))[_0x1b09('0x2b')](respondWithResult(_0x34d912,null))['catch'](handleError(_0x34d912,null));};exports[_0x1b09('0x2c')]=function(_0x4e6c6b,_0x3243ee){return db[_0x1b09('0x34')][_0x1b09('0x3f')]({'where':{'id':_0x4e6c6b[_0x1b09('0x32')]['id']}})[_0x1b09('0x2b')](handleEntityNotFound(_0x3243ee,null))[_0x1b09('0x2b')](removeEntity(_0x3243ee,null))[_0x1b09('0x40')](handleError(_0x3243ee,null));};function widgetAttributes(_0x466502){try{switch(_0x466502[_0x1b09('0x41')]){case _0x1b09('0x42'):return[{'name':_0x1b09('0x43'),'value':_0x466502[_0x1b09('0x43')]||(_0x466502[_0x1b09('0x44')]&&_0x466502['attrs'][0x0]?_0x466502['attrs'][0x0][_0x1b09('0x45')]:undefined)||_0x1b09('0x46')}];case _0x1b09('0x47'):return[{'name':_0x1b09('0x48'),'value':_0x466502[_0x1b09('0x48')]||(_0x466502[_0x1b09('0x44')]&&_0x466502[_0x1b09('0x44')][0x0]?_0x466502[_0x1b09('0x44')][0x0]['value']:undefined)||''}];case'clock':return[{'name':_0x1b09('0x49'),'value':_0x466502['attrHourFormat']||(_0x466502[_0x1b09('0x44')]&&_0x466502[_0x1b09('0x44')][0x0]?_0x466502[_0x1b09('0x44')][0x0]['value']:undefined)||_0x1b09('0x4a')},{'name':_0x1b09('0x4b'),'value':_0x466502[_0x1b09('0x4b')]||(_0x466502['attrs']&&_0x466502[_0x1b09('0x44')][0x1]?_0x466502[_0x1b09('0x44')][0x1][_0x1b09('0x45')]:undefined)||_0x1b09('0x4c')},{'name':'attrFontSize','value':_0x466502[_0x1b09('0x4d')]||(_0x466502[_0x1b09('0x44')]&&_0x466502['attrs'][0x2]?_0x466502[_0x1b09('0x44')][0x2][_0x1b09('0x45')]:undefined)||0xc}];case'counter':return[{'name':'attrMetric','value':_0x466502['attrMetric']||(_0x466502['attrs']&&_0x466502[_0x1b09('0x44')][0x0]?_0x466502[_0x1b09('0x44')][0x0][_0x1b09('0x45')]:undefined)||'total'},{'name':_0x1b09('0x4e'),'value':_0x466502[_0x1b09('0x4e')]||(_0x466502['attrs']&&_0x466502[_0x1b09('0x44')][0x1]?_0x466502[_0x1b09('0x44')][0x1][_0x1b09('0x45')]:undefined)||[]},{'name':_0x1b09('0x4d'),'value':_0x466502[_0x1b09('0x4d')]||(_0x466502[_0x1b09('0x44')]&&_0x466502[_0x1b09('0x44')][0x2]?_0x466502[_0x1b09('0x44')][0x2][_0x1b09('0x45')]:undefined)||0x14},{'name':_0x1b09('0x4f'),'value':_0x466502['attrChannel']||(_0x466502[_0x1b09('0x44')]&&_0x466502[_0x1b09('0x44')][0x3]?_0x466502[_0x1b09('0x44')][0x3]['value']:undefined)||_0x1b09('0x50')},{'name':'attrEmailAccounts','value':_0x466502[_0x1b09('0x51')]||(_0x466502[_0x1b09('0x44')]&&_0x466502['attrs'][0x4]?_0x466502[_0x1b09('0x44')][0x4][_0x1b09('0x45')]:undefined)||''},{'name':_0x1b09('0x52'),'value':_0x466502[_0x1b09('0x52')]||(_0x466502[_0x1b09('0x44')]&&_0x466502[_0x1b09('0x44')][0x5]?_0x466502['attrs'][0x5][_0x1b09('0x45')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x466502[_0x1b09('0x53')]||(_0x466502['attrs']&&_0x466502['attrs'][0x6]?_0x466502[_0x1b09('0x44')][0x6][_0x1b09('0x45')]:undefined)||''},{'name':_0x1b09('0x54'),'value':_0x466502[_0x1b09('0x54')]||(_0x466502[_0x1b09('0x44')]&&_0x466502[_0x1b09('0x44')][0x7]?_0x466502[_0x1b09('0x44')][0x7][_0x1b09('0x45')]:undefined)||''},{'name':'attrWhatsappAccounts','value':_0x466502[_0x1b09('0x55')]||(_0x466502[_0x1b09('0x44')]&&_0x466502[_0x1b09('0x44')][0x8]?_0x466502['attrs'][0x8]['value']:undefined)||''},{'name':_0x1b09('0x56'),'value':_0x466502['attrChatWebsites']||(_0x466502[_0x1b09('0x44')]&&_0x466502[_0x1b09('0x44')][0x9]?_0x466502['attrs'][0x9][_0x1b09('0x45')]:undefined)||''}];case _0x1b09('0x57'):case'pie-chart':return[{'name':_0x1b09('0x58'),'value':_0x466502[_0x1b09('0x58')]||(_0x466502[_0x1b09('0x44')]&&_0x466502[_0x1b09('0x44')][0x0]?_0x466502[_0x1b09('0x44')][0x0]['value']:undefined)||_0x1b09('0x59')},{'name':_0x1b09('0x5a'),'value':_0x466502[_0x1b09('0x5a')]||(_0x466502[_0x1b09('0x44')]&&_0x466502[_0x1b09('0x44')][0x1]?_0x466502[_0x1b09('0x44')][0x1][_0x1b09('0x45')]:undefined)||null},{'name':'attrSerie3','value':_0x466502['attrSerie3']||(_0x466502[_0x1b09('0x44')]&&_0x466502[_0x1b09('0x44')][0x2]?_0x466502[_0x1b09('0x44')][0x2]['value']:undefined)||null},{'name':_0x1b09('0x4e'),'value':_0x466502[_0x1b09('0x4e')]||(_0x466502[_0x1b09('0x44')]&&_0x466502['attrs'][0x3]?_0x466502[_0x1b09('0x44')][0x3][_0x1b09('0x45')]:undefined)||[]},{'name':_0x1b09('0x4f'),'value':_0x466502[_0x1b09('0x4f')]||(_0x466502[_0x1b09('0x44')]&&_0x466502[_0x1b09('0x44')][0x4]?_0x466502[_0x1b09('0x44')][0x4][_0x1b09('0x45')]:undefined)||_0x1b09('0x50')},{'name':_0x1b09('0x51'),'value':_0x466502[_0x1b09('0x51')]||(_0x466502[_0x1b09('0x44')]&&_0x466502[_0x1b09('0x44')][0x5]?_0x466502[_0x1b09('0x44')][0x5][_0x1b09('0x45')]:undefined)||''},{'name':'attrFaxAccounts','value':_0x466502['attrFaxAccounts']||(_0x466502[_0x1b09('0x44')]&&_0x466502['attrs'][0x6]?_0x466502[_0x1b09('0x44')][0x6][_0x1b09('0x45')]:undefined)||''},{'name':_0x1b09('0x53'),'value':_0x466502['attrSmsAccounts']||(_0x466502['attrs']&&_0x466502[_0x1b09('0x44')][0x7]?_0x466502[_0x1b09('0x44')][0x7]['value']:undefined)||''},{'name':_0x1b09('0x54'),'value':_0x466502[_0x1b09('0x54')]||(_0x466502[_0x1b09('0x44')]&&_0x466502[_0x1b09('0x44')][0x8]?_0x466502[_0x1b09('0x44')][0x8][_0x1b09('0x45')]:undefined)||''},{'name':_0x1b09('0x55'),'value':_0x466502['attrWhatsappAccounts']||(_0x466502[_0x1b09('0x44')]&&_0x466502['attrs'][0x9]?_0x466502[_0x1b09('0x44')][0x9][_0x1b09('0x45')]:undefined)||''},{'name':_0x1b09('0x56'),'value':_0x466502[_0x1b09('0x56')]||(_0x466502[_0x1b09('0x44')]&&_0x466502[_0x1b09('0x44')][0xa]?_0x466502[_0x1b09('0x44')][0xa][_0x1b09('0x45')]:undefined)||''}];case _0x1b09('0x5b'):return[{'name':_0x1b09('0x5c'),'type':_0x466502[_0x1b09('0x5d')]||(_0x466502[_0x1b09('0x44')]&&_0x466502['attrs'][0x0]?_0x466502['attrs'][0x0][_0x1b09('0x41')]:undefined)||null,'value':_0x466502[_0x1b09('0x5c')]||(_0x466502[_0x1b09('0x44')]&&_0x466502['attrs'][0x0]?_0x466502[_0x1b09('0x44')][0x0][_0x1b09('0x45')]:undefined)||null},{'name':_0x1b09('0x5e'),'value':_0x466502['attrRefresh']||(_0x466502[_0x1b09('0x44')]&&_0x466502[_0x1b09('0x44')][0x1]?_0x466502[_0x1b09('0x44')][0x1]['value']:undefined)||0x0}];default:return[];}}catch(_0x1eac19){logger['error']('widgetAttributes:\x20%s',JSON[_0x1b09('0x5f')](_0x1eac19));return[];}}exports[_0x1b09('0x60')]=function(_0x10e809,_0x527f4e){if(_0x10e809[_0x1b09('0x61')]){_0x10e809['body'][_0x1b09('0x44')]=widgetAttributes(_0x10e809[_0x1b09('0x61')]);}return db['DashboardItem'][_0x1b09('0x60')](_0x10e809['body'],{})[_0x1b09('0x2b')](respondWithResult(_0x527f4e,0xc9))[_0x1b09('0x40')](handleError(_0x527f4e,null));};exports['update']=function(_0x1acf31,_0x597a68){if(_0x1acf31[_0x1b09('0x61')]['id']){delete _0x1acf31[_0x1b09('0x61')]['id'];}_0x1acf31[_0x1b09('0x61')][_0x1b09('0x44')]=widgetAttributes(_0x1acf31[_0x1b09('0x61')]);return db['DashboardItem'][_0x1b09('0x3f')]({'where':{'id':_0x1acf31[_0x1b09('0x32')]['id']}})[_0x1b09('0x2b')](handleEntityNotFound(_0x597a68,null))['then'](saveUpdates(_0x1acf31[_0x1b09('0x61')],null))[_0x1b09('0x2b')](respondWithResult(_0x597a68,null))[_0x1b09('0x40')](handleError(_0x597a68,null));}; \ No newline at end of file +var _0x8784=['apply','reject','save','update','then','destroy','error','stack','name','send','show','params','model','keys','DashboardItem','rawAttributes','query','filters','intersection','fields','attributes','merge','find','catch','iframe','attrUrl','attrs','https://','custom','attrPath','value','clock','attrHourFormat','HH:mm:ss','attrTimezone','0.00','attrFontSize','counter','attrMetric','attrVoiceQueues','attrChannel','attrEmailAccounts','attrFaxAccounts','attrSmsAccounts','attrOpenchannelAccounts','attrWhatsappAccounts','attrChatWebsites','pie-chart','attrSerie1','total','attrSerie2','attrSerie3','voice','web-report','attrReport','reportType','type','attrRefresh','widgetAttributes:\x20%s','create','body','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','register','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json'];(function(_0x5d5808,_0x2d76ee){var _0x24b490=function(_0x2a207d){while(--_0x2a207d){_0x5d5808['push'](_0x5d5808['shift']());}};_0x24b490(++_0x2d76ee);}(_0x8784,0x172));var _0x4878=function(_0x466af7,_0x2f7551){_0x466af7=_0x466af7-0x0;var _0x348c96=_0x8784[_0x466af7];return _0x348c96;};'use strict';var emlformat=require(_0x4878('0x0'));var rimraf=require(_0x4878('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x4878('0x2'));var rp=require(_0x4878('0x3'));var moment=require(_0x4878('0x4'));var BPromise=require(_0x4878('0x5'));var Mustache=require(_0x4878('0x6'));var util=require('util');var path=require('path');var sox=require(_0x4878('0x7'));var csv=require(_0x4878('0x8'));var ejs=require(_0x4878('0x9'));var fs=require('fs');var fs_extra=require(_0x4878('0xa'));var _=require(_0x4878('0xb'));var squel=require(_0x4878('0xc'));var crypto=require(_0x4878('0xd'));var jsforce=require(_0x4878('0xe'));var deskjs=require(_0x4878('0xf'));var toCsv=require('to-csv');var querystring=require(_0x4878('0x10'));var Papa=require(_0x4878('0x11'));var Redis=require(_0x4878('0x12'));var authService=require(_0x4878('0x13'));var qs=require(_0x4878('0x14'));var as=require(_0x4878('0x15'));var hardwareService=require(_0x4878('0x16'));var logger=require(_0x4878('0x17'))(_0x4878('0x18'));var utils=require(_0x4878('0x19'));var config=require(_0x4878('0x1a'));var licenseUtil=require(_0x4878('0x1b'));var db=require('../../mysqldb')['db'];config[_0x4878('0x1c')]=_[_0x4878('0x1d')](config[_0x4878('0x1c')],{'host':'localhost','port':0x18eb});var socket=require(_0x4878('0x1e'))(new Redis(config[_0x4878('0x1c')]));require('./dashboardItem.socket')[_0x4878('0x1f')](socket);function respondWithStatusCode(_0x5e67cc,_0x4ec9f8){_0x4ec9f8=_0x4ec9f8||0xcc;return function(_0x1b9209){if(_0x1b9209){return _0x5e67cc[_0x4878('0x20')](_0x4ec9f8);}return _0x5e67cc[_0x4878('0x21')](_0x4ec9f8)[_0x4878('0x22')]();};}function respondWithResult(_0x37a150,_0x4a6e5e){_0x4a6e5e=_0x4a6e5e||0xc8;return function(_0x27ed83){if(_0x27ed83){return _0x37a150[_0x4878('0x21')](_0x4a6e5e)['json'](_0x27ed83);}};}function respondWithFilteredResult(_0x4319a8,_0x4fb1c0){return function(_0x2c2529){if(_0x2c2529){var _0x4baa5e=typeof _0x4fb1c0['offset']===_0x4878('0x23')&&typeof _0x4fb1c0[_0x4878('0x24')]===_0x4878('0x23');var _0x3219f7=_0x2c2529[_0x4878('0x25')];var _0x4e8b24=_0x4baa5e?0x0:_0x4fb1c0[_0x4878('0x26')];var _0x79d6da=_0x4baa5e?_0x2c2529[_0x4878('0x25')]:_0x4fb1c0[_0x4878('0x26')]+_0x4fb1c0[_0x4878('0x24')];var _0x3ffa0c;if(_0x79d6da>=_0x3219f7){_0x79d6da=_0x3219f7;_0x3ffa0c=0xc8;}else{_0x3ffa0c=0xce;}_0x4319a8['status'](_0x3ffa0c);return _0x4319a8[_0x4878('0x27')](_0x4878('0x28'),_0x4e8b24+'-'+_0x79d6da+'/'+_0x3219f7)[_0x4878('0x29')](_0x2c2529);}return null;};}function patchUpdates(_0x5482f5){return function(_0x25bd81){try{jsonpatch[_0x4878('0x2a')](_0x25bd81,_0x5482f5,!![]);}catch(_0x57d9b3){return BPromise[_0x4878('0x2b')](_0x57d9b3);}return _0x25bd81[_0x4878('0x2c')]();};}function saveUpdates(_0x3b2d57,_0x542a7d){return function(_0x19adfc){if(_0x19adfc){return _0x19adfc[_0x4878('0x2d')](_0x3b2d57)[_0x4878('0x2e')](function(_0x476ec3){return _0x476ec3;});}return null;};}function removeEntity(_0x2938f9,_0x5b1222){return function(_0x1ff1c4){if(_0x1ff1c4){return _0x1ff1c4[_0x4878('0x2f')]()['then'](function(){_0x2938f9[_0x4878('0x21')](0xcc)[_0x4878('0x22')]();});}};}function handleEntityNotFound(_0x316b26,_0x2d7849){return function(_0x43b9a0){if(!_0x43b9a0){_0x316b26[_0x4878('0x20')](0x194);}return _0x43b9a0;};}function handleError(_0x3541bb,_0x1cef10){_0x1cef10=_0x1cef10||0x1f4;return function(_0xcff66b){logger[_0x4878('0x30')](_0xcff66b[_0x4878('0x31')]);if(_0xcff66b[_0x4878('0x32')]){delete _0xcff66b[_0x4878('0x32')];}_0x3541bb['status'](_0x1cef10)[_0x4878('0x33')](_0xcff66b);};}exports[_0x4878('0x34')]=function(_0x4f3622,_0x4c8f6b){var _0x41908f={'raw':![],'where':{'id':_0x4f3622[_0x4878('0x35')]['id']}},_0x2e06b6={};_0x2e06b6[_0x4878('0x36')]=_[_0x4878('0x37')](db[_0x4878('0x38')][_0x4878('0x39')]);_0x2e06b6['query']=_[_0x4878('0x37')](_0x4f3622[_0x4878('0x3a')]);_0x2e06b6[_0x4878('0x3b')]=_[_0x4878('0x3c')](_0x2e06b6[_0x4878('0x36')],_0x2e06b6['query']);_0x41908f['attributes']=_['intersection'](_0x2e06b6[_0x4878('0x36')],qs[_0x4878('0x3d')](_0x4f3622[_0x4878('0x3a')]['fields']));_0x41908f[_0x4878('0x3e')]=_0x41908f[_0x4878('0x3e')]['length']?_0x41908f[_0x4878('0x3e')]:_0x2e06b6['model'];if(_0x4f3622[_0x4878('0x3a')]['includeAll']){_0x41908f['include']=[{'all':!![]}];}_0x41908f=_[_0x4878('0x3f')]({},_0x41908f,_0x4f3622['options']);return db[_0x4878('0x38')][_0x4878('0x40')](_0x41908f)['then'](handleEntityNotFound(_0x4c8f6b,null))[_0x4878('0x2e')](respondWithResult(_0x4c8f6b,null))[_0x4878('0x41')](handleError(_0x4c8f6b,null));};exports['destroy']=function(_0x1bda87,_0x305f44){return db['DashboardItem'][_0x4878('0x40')]({'where':{'id':_0x1bda87['params']['id']}})[_0x4878('0x2e')](handleEntityNotFound(_0x305f44,null))[_0x4878('0x2e')](removeEntity(_0x305f44,null))[_0x4878('0x41')](handleError(_0x305f44,null));};function widgetAttributes(_0x232471){try{switch(_0x232471['type']){case _0x4878('0x42'):return[{'name':_0x4878('0x43'),'value':_0x232471[_0x4878('0x43')]||(_0x232471[_0x4878('0x44')]&&_0x232471['attrs'][0x0]?_0x232471[_0x4878('0x44')][0x0]['value']:undefined)||_0x4878('0x45')}];case _0x4878('0x46'):return[{'name':'attrPath','value':_0x232471[_0x4878('0x47')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x0]?_0x232471[_0x4878('0x44')][0x0][_0x4878('0x48')]:undefined)||''}];case _0x4878('0x49'):return[{'name':_0x4878('0x4a'),'value':_0x232471[_0x4878('0x4a')]||(_0x232471[_0x4878('0x44')]&&_0x232471['attrs'][0x0]?_0x232471[_0x4878('0x44')][0x0][_0x4878('0x48')]:undefined)||_0x4878('0x4b')},{'name':_0x4878('0x4c'),'value':_0x232471[_0x4878('0x4c')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x1]?_0x232471['attrs'][0x1][_0x4878('0x48')]:undefined)||_0x4878('0x4d')},{'name':_0x4878('0x4e'),'value':_0x232471[_0x4878('0x4e')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x2]?_0x232471[_0x4878('0x44')][0x2][_0x4878('0x48')]:undefined)||0xc}];case _0x4878('0x4f'):return[{'name':'attrMetric','value':_0x232471[_0x4878('0x50')]||(_0x232471[_0x4878('0x44')]&&_0x232471['attrs'][0x0]?_0x232471[_0x4878('0x44')][0x0][_0x4878('0x48')]:undefined)||'total'},{'name':'attrVoiceQueues','value':_0x232471[_0x4878('0x51')]||(_0x232471['attrs']&&_0x232471[_0x4878('0x44')][0x1]?_0x232471['attrs'][0x1][_0x4878('0x48')]:undefined)||[]},{'name':_0x4878('0x4e'),'value':_0x232471[_0x4878('0x4e')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x2]?_0x232471[_0x4878('0x44')][0x2]['value']:undefined)||0x14},{'name':'attrChannel','value':_0x232471[_0x4878('0x52')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x3]?_0x232471[_0x4878('0x44')][0x3][_0x4878('0x48')]:undefined)||'voice'},{'name':'attrEmailAccounts','value':_0x232471[_0x4878('0x53')]||(_0x232471[_0x4878('0x44')]&&_0x232471['attrs'][0x4]?_0x232471['attrs'][0x4][_0x4878('0x48')]:undefined)||''},{'name':_0x4878('0x54'),'value':_0x232471[_0x4878('0x54')]||(_0x232471[_0x4878('0x44')]&&_0x232471['attrs'][0x5]?_0x232471[_0x4878('0x44')][0x5][_0x4878('0x48')]:undefined)||''},{'name':_0x4878('0x55'),'value':_0x232471[_0x4878('0x55')]||(_0x232471['attrs']&&_0x232471[_0x4878('0x44')][0x6]?_0x232471[_0x4878('0x44')][0x6]['value']:undefined)||''},{'name':_0x4878('0x56'),'value':_0x232471[_0x4878('0x56')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x7]?_0x232471[_0x4878('0x44')][0x7][_0x4878('0x48')]:undefined)||''},{'name':_0x4878('0x57'),'value':_0x232471[_0x4878('0x57')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x8]?_0x232471[_0x4878('0x44')][0x8][_0x4878('0x48')]:undefined)||''},{'name':'attrChatWebsites','value':_0x232471[_0x4878('0x58')]||(_0x232471['attrs']&&_0x232471['attrs'][0x9]?_0x232471[_0x4878('0x44')][0x9][_0x4878('0x48')]:undefined)||''}];case'multibar-chart':case _0x4878('0x59'):return[{'name':_0x4878('0x5a'),'value':_0x232471[_0x4878('0x5a')]||(_0x232471[_0x4878('0x44')]&&_0x232471['attrs'][0x0]?_0x232471['attrs'][0x0][_0x4878('0x48')]:undefined)||_0x4878('0x5b')},{'name':_0x4878('0x5c'),'value':_0x232471[_0x4878('0x5c')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x1]?_0x232471['attrs'][0x1][_0x4878('0x48')]:undefined)||null},{'name':_0x4878('0x5d'),'value':_0x232471[_0x4878('0x5d')]||(_0x232471[_0x4878('0x44')]&&_0x232471['attrs'][0x2]?_0x232471[_0x4878('0x44')][0x2][_0x4878('0x48')]:undefined)||null},{'name':_0x4878('0x51'),'value':_0x232471[_0x4878('0x51')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x3]?_0x232471[_0x4878('0x44')][0x3][_0x4878('0x48')]:undefined)||[]},{'name':_0x4878('0x52'),'value':_0x232471[_0x4878('0x52')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x4]?_0x232471[_0x4878('0x44')][0x4][_0x4878('0x48')]:undefined)||_0x4878('0x5e')},{'name':_0x4878('0x53'),'value':_0x232471['attrEmailAccounts']||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x5]?_0x232471[_0x4878('0x44')][0x5][_0x4878('0x48')]:undefined)||''},{'name':_0x4878('0x54'),'value':_0x232471[_0x4878('0x54')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x6]?_0x232471['attrs'][0x6][_0x4878('0x48')]:undefined)||''},{'name':'attrSmsAccounts','value':_0x232471[_0x4878('0x55')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x7]?_0x232471[_0x4878('0x44')][0x7]['value']:undefined)||''},{'name':_0x4878('0x56'),'value':_0x232471[_0x4878('0x56')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x8]?_0x232471[_0x4878('0x44')][0x8][_0x4878('0x48')]:undefined)||''},{'name':_0x4878('0x57'),'value':_0x232471[_0x4878('0x57')]||(_0x232471['attrs']&&_0x232471[_0x4878('0x44')][0x9]?_0x232471[_0x4878('0x44')][0x9][_0x4878('0x48')]:undefined)||''},{'name':_0x4878('0x58'),'value':_0x232471[_0x4878('0x58')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0xa]?_0x232471[_0x4878('0x44')][0xa]['value']:undefined)||''}];case _0x4878('0x5f'):return[{'name':_0x4878('0x60'),'type':_0x232471[_0x4878('0x61')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x0]?_0x232471[_0x4878('0x44')][0x0][_0x4878('0x62')]:undefined)||null,'value':_0x232471[_0x4878('0x60')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x0]?_0x232471[_0x4878('0x44')][0x0][_0x4878('0x48')]:undefined)||null},{'name':_0x4878('0x63'),'value':_0x232471[_0x4878('0x63')]||(_0x232471[_0x4878('0x44')]&&_0x232471[_0x4878('0x44')][0x1]?_0x232471[_0x4878('0x44')][0x1][_0x4878('0x48')]:undefined)||0x0}];default:return[];}}catch(_0x31fd21){logger[_0x4878('0x30')](_0x4878('0x64'),JSON['stringify'](_0x31fd21));return[];}}exports[_0x4878('0x65')]=function(_0x32ef56,_0x34726a){if(_0x32ef56[_0x4878('0x66')]){_0x32ef56[_0x4878('0x66')][_0x4878('0x44')]=widgetAttributes(_0x32ef56[_0x4878('0x66')]);}return db['DashboardItem'][_0x4878('0x65')](_0x32ef56[_0x4878('0x66')],{})[_0x4878('0x2e')](respondWithResult(_0x34726a,0xc9))[_0x4878('0x41')](handleError(_0x34726a,null));};exports[_0x4878('0x2d')]=function(_0x112ec7,_0x4e65d5){if(_0x112ec7[_0x4878('0x66')]['id']){delete _0x112ec7[_0x4878('0x66')]['id'];}_0x112ec7[_0x4878('0x66')][_0x4878('0x44')]=widgetAttributes(_0x112ec7[_0x4878('0x66')]);return db[_0x4878('0x38')][_0x4878('0x40')]({'where':{'id':_0x112ec7[_0x4878('0x35')]['id']}})[_0x4878('0x2e')](handleEntityNotFound(_0x4e65d5,null))[_0x4878('0x2e')](saveUpdates(_0x112ec7['body'],null))[_0x4878('0x2e')](respondWithResult(_0x4e65d5,null))[_0x4878('0x41')](handleError(_0x4e65d5,null));}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.events.js b/server/api/dashboardItem/dashboardItem.events.js index b463562..5b85281 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 _0x55f6=['hook','exports','events','../../mysqldb','save','update','emit','hasOwnProperty'];(function(_0x2d6a7e,_0x5074b7){var _0x421e44=function(_0x3b709a){while(--_0x3b709a){_0x2d6a7e['push'](_0x2d6a7e['shift']());}};_0x421e44(++_0x5074b7);}(_0x55f6,0xc2));var _0x655f=function(_0xeea277,_0x56ce7b){_0xeea277=_0xeea277-0x0;var _0x4a84cb=_0x55f6[_0xeea277];return _0x4a84cb;};'use strict';var EventEmitter=require(_0x655f('0x0'));var DashboardItem=require(_0x655f('0x1'))['db']['DashboardItem'];var DashboardItemEvents=new EventEmitter();DashboardItemEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x655f('0x2'),'afterUpdate':_0x655f('0x3'),'afterDestroy':'remove'};function emitEvent(_0x1fa024){return function(_0x91a716,_0x4aee1b,_0x20ae78){DashboardItemEvents['emit'](_0x1fa024+':'+_0x91a716['id'],_0x91a716);DashboardItemEvents[_0x655f('0x4')](_0x1fa024,_0x91a716);_0x20ae78(null);};}for(var e in events){if(events[_0x655f('0x5')](e)){var event=events[e];DashboardItem[_0x655f('0x6')](e,emitEvent(event));}}module[_0x655f('0x7')]=DashboardItemEvents; \ No newline at end of file +var _0x6964=['remove','emit','exports','events','DashboardItem','setMaxListeners','update'];(function(_0x334841,_0x2bbc4c){var _0x5beb4b=function(_0x4bea72){while(--_0x4bea72){_0x334841['push'](_0x334841['shift']());}};_0x5beb4b(++_0x2bbc4c);}(_0x6964,0x114));var _0x4696=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x6964[_0x4dbaad];return _0x226c72;};'use strict';var EventEmitter=require(_0x4696('0x0'));var DashboardItem=require('../../mysqldb')['db'][_0x4696('0x1')];var DashboardItemEvents=new EventEmitter();DashboardItemEvents[_0x4696('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x4696('0x3'),'afterDestroy':_0x4696('0x4')};function emitEvent(_0x4844a3){return function(_0x311403,_0x1c3ff9,_0x2120fe){DashboardItemEvents['emit'](_0x4844a3+':'+_0x311403['id'],_0x311403);DashboardItemEvents[_0x4696('0x5')](_0x4844a3,_0x311403);_0x2120fe(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];DashboardItem['hook'](e,emitEvent(event));}}module[_0x4696('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 9be0aa0..a057097 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 _0x83d3=['define','DashboardItem','dashboard_items','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x2e3ce8,_0x364e80){var _0x3d6ab=function(_0x3f96ca){while(--_0x3f96ca){_0x2e3ce8['push'](_0x2e3ce8['shift']());}};_0x3d6ab(++_0x364e80);}(_0x83d3,0x17c));var _0x383d=function(_0x3a5648,_0x58054e){_0x3a5648=_0x3a5648-0x0;var _0x34126d=_0x83d3[_0x3a5648];return _0x34126d;};'use strict';var _=require(_0x383d('0x0'));var util=require(_0x383d('0x1'));var logger=require(_0x383d('0x2'))(_0x383d('0x3'));var moment=require(_0x383d('0x4'));var BPromise=require('bluebird');var rp=require(_0x383d('0x5'));var fs=require('fs');var path=require(_0x383d('0x6'));var rimraf=require(_0x383d('0x7'));var config=require(_0x383d('0x8'));var attributes=require('./dashboardItem.attributes');module[_0x383d('0x9')]=function(_0x4f3c10,_0x50eaff){return _0x4f3c10[_0x383d('0xa')](_0x383d('0xb'),attributes,{'tableName':_0x383d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf25f=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','./dashboardItem.attributes','define'];(function(_0x27736d,_0x19cb1b){var _0xa32ede=function(_0x1dcf3a){while(--_0x1dcf3a){_0x27736d['push'](_0x27736d['shift']());}};_0xa32ede(++_0x19cb1b);}(_0xf25f,0x6e));var _0xff25=function(_0x272cda,_0x22acf0){_0x272cda=_0x272cda-0x0;var _0x2214a3=_0xf25f[_0x272cda];return _0x2214a3;};'use strict';var _=require(_0xff25('0x0'));var util=require(_0xff25('0x1'));var logger=require(_0xff25('0x2'))(_0xff25('0x3'));var moment=require(_0xff25('0x4'));var BPromise=require(_0xff25('0x5'));var rp=require(_0xff25('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0xff25('0x7'));var config=require('../../config/environment');var attributes=require(_0xff25('0x8'));module['exports']=function(_0x5ff80d,_0x3db4cb){return _0x5ff80d[_0xff25('0x9')]('DashboardItem',attributes,{'tableName':'dashboard_items','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.rpc.js b/server/api/dashboardItem/dashboardItem.rpc.js index 61521b9..0ccfed3 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 _0x9b1c=['request\x20sent','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','redis','defaults','localhost','socket.io-emitter','./dashboardItem.socket','register','request','info','DashboardItem,\x20%s,\x20%s','debug','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x495127,_0x233d2d){var _0x306b48=function(_0x5b8b7b){while(--_0x5b8b7b){_0x495127['push'](_0x495127['shift']());}};_0x306b48(++_0x233d2d);}(_0x9b1c,0x1de));var _0xc9b1=function(_0xf4cc73,_0x2580f8){_0xf4cc73=_0xf4cc73-0x0;var _0x102e33=_0x9b1c[_0xf4cc73];return _0x102e33;};'use strict';var _=require(_0xc9b1('0x0'));var util=require(_0xc9b1('0x1'));var moment=require(_0xc9b1('0x2'));var BPromise=require(_0xc9b1('0x3'));var rs=require(_0xc9b1('0x4'));var fs=require('fs');var Redis=require(_0xc9b1('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc9b1('0x6'));var logger=require(_0xc9b1('0x7'))(_0xc9b1('0x8'));var config=require(_0xc9b1('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xc9b1('0xa')]['http']({'port':0x232a});config[_0xc9b1('0xb')]=_[_0xc9b1('0xc')](config[_0xc9b1('0xb')],{'host':_0xc9b1('0xd'),'port':0x18eb});var socket=require(_0xc9b1('0xe'))(new Redis(config[_0xc9b1('0xb')]));require(_0xc9b1('0xf'))[_0xc9b1('0x10')](socket);function respondWithRpcPromise(_0x3d528,_0x39a2da,_0xda0657){return new BPromise(function(_0x421371,_0xe3d014){return client[_0xc9b1('0x11')](_0x3d528,_0xda0657)['then'](function(_0x2a4492){logger[_0xc9b1('0x12')](_0xc9b1('0x13'),_0x39a2da,'request\x20sent');logger[_0xc9b1('0x14')](_0xc9b1('0x15'),_0x39a2da,'request\x20sent',JSON[_0xc9b1('0x16')](_0x2a4492));if(_0x2a4492['error']){if(_0x2a4492[_0xc9b1('0x17')][_0xc9b1('0x18')]===0x1f4){logger['error'](_0xc9b1('0x13'),_0x39a2da,_0x2a4492[_0xc9b1('0x17')][_0xc9b1('0x19')]);return _0xe3d014(_0x2a4492[_0xc9b1('0x17')][_0xc9b1('0x19')]);}logger[_0xc9b1('0x17')]('DashboardItem,\x20%s,\x20%s',_0x39a2da,_0x2a4492['error'][_0xc9b1('0x19')]);return _0x421371(_0x2a4492[_0xc9b1('0x17')][_0xc9b1('0x19')]);}else{logger[_0xc9b1('0x12')](_0xc9b1('0x13'),_0x39a2da,_0xc9b1('0x1a'));_0x421371(_0x2a4492['result'][_0xc9b1('0x19')]);}})[_0xc9b1('0x1b')](function(_0x11e9f2){logger['error'](_0xc9b1('0x13'),_0x39a2da,_0x11e9f2);_0xe3d014(_0x11e9f2);});});} \ No newline at end of file +var _0xcd5e=['localhost','redis','register','request','then','info','DashboardItem,\x20%s,\x20%s','request\x20sent','DashboardItem,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','defaults'];(function(_0xaa0309,_0x1c8008){var _0x5de7ce=function(_0x3aa6ae){while(--_0x3aa6ae){_0xaa0309['push'](_0xaa0309['shift']());}};_0x5de7ce(++_0x1c8008);}(_0xcd5e,0x15f));var _0xecd5=function(_0x310db7,_0x53e37f){_0x310db7=_0x310db7-0x0;var _0x206615=_0xcd5e[_0x310db7];return _0x206615;};'use strict';var _=require(_0xecd5('0x0'));var util=require(_0xecd5('0x1'));var moment=require('moment');var BPromise=require(_0xecd5('0x2'));var rs=require(_0xecd5('0x3'));var fs=require('fs');var Redis=require(_0xecd5('0x4'));var db=require(_0xecd5('0x5'))['db'];var utils=require(_0xecd5('0x6'));var logger=require(_0xecd5('0x7'))(_0xecd5('0x8'));var config=require(_0xecd5('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xecd5('0xa')][_0xecd5('0xb')]({'port':0x232a});config['redis']=_[_0xecd5('0xc')](config['redis'],{'host':_0xecd5('0xd'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xecd5('0xe')]));require('./dashboardItem.socket')[_0xecd5('0xf')](socket);function respondWithRpcPromise(_0x1769d6,_0x10b5ae,_0x1b54de){return new BPromise(function(_0x1bf456,_0x68721e){return client[_0xecd5('0x10')](_0x1769d6,_0x1b54de)[_0xecd5('0x11')](function(_0x563e81){logger[_0xecd5('0x12')](_0xecd5('0x13'),_0x10b5ae,_0xecd5('0x14'));logger['debug'](_0xecd5('0x15'),_0x10b5ae,_0xecd5('0x14'),JSON[_0xecd5('0x16')](_0x563e81));if(_0x563e81[_0xecd5('0x17')]){if(_0x563e81[_0xecd5('0x17')][_0xecd5('0x18')]===0x1f4){logger[_0xecd5('0x17')](_0xecd5('0x13'),_0x10b5ae,_0x563e81[_0xecd5('0x17')][_0xecd5('0x19')]);return _0x68721e(_0x563e81[_0xecd5('0x17')]['message']);}logger[_0xecd5('0x17')](_0xecd5('0x13'),_0x10b5ae,_0x563e81[_0xecd5('0x17')][_0xecd5('0x19')]);return _0x1bf456(_0x563e81[_0xecd5('0x17')]['message']);}else{logger['info'](_0xecd5('0x13'),_0x10b5ae,_0xecd5('0x14'));_0x1bf456(_0x563e81[_0xecd5('0x1a')][_0xecd5('0x19')]);}})[_0xecd5('0x1b')](function(_0x4887d5){logger[_0xecd5('0x17')]('DashboardItem,\x20%s,\x20%s',_0x10b5ae,_0x4887d5);_0x68721e(_0x4887d5);});});} \ No newline at end of file diff --git a/server/api/dashboardItem/dashboardItem.socket.js b/server/api/dashboardItem/dashboardItem.socket.js index 0df5705..6fe3a63 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 _0x7e35=['./dashboardItem.events','remove','update','emit','length'];(function(_0x2cec39,_0x1893aa){var _0x3a4ea6=function(_0x41b5ab){while(--_0x41b5ab){_0x2cec39['push'](_0x2cec39['shift']());}};_0x3a4ea6(++_0x1893aa);}(_0x7e35,0x1b3));var _0x57e3=function(_0x10d324,_0x436fee){_0x10d324=_0x10d324-0x0;var _0x322a4d=_0x7e35[_0x10d324];return _0x322a4d;};'use strict';var DashboardItemEvents=require(_0x57e3('0x0'));var events=['save',_0x57e3('0x1'),_0x57e3('0x2')];function createListener(_0x1cfe57,_0x232e05){return function(_0x18ffdc){_0x232e05[_0x57e3('0x3')](_0x1cfe57,_0x18ffdc);};}function removeListener(_0x471f4a,_0x53dc03){return function(){DashboardItemEvents['removeListener'](_0x471f4a,_0x53dc03);};}exports['register']=function(_0x1fd36c){for(var _0x2b9111=0x0,_0x55b680=events[_0x57e3('0x4')];_0x2b9111<_0x55b680;_0x2b9111++){var _0x4a12dc=events[_0x2b9111];var _0x1f4d44=createListener('dashboardItem:'+_0x4a12dc,_0x1fd36c);DashboardItemEvents['on'](_0x4a12dc,_0x1f4d44);}}; \ No newline at end of file +var _0x2bc6=['emit','register','length','dashboardItem:','./dashboardItem.events','save','update'];(function(_0x30fd2b,_0x37ab6a){var _0x1e2ebc=function(_0x279c26){while(--_0x279c26){_0x30fd2b['push'](_0x30fd2b['shift']());}};_0x1e2ebc(++_0x37ab6a);}(_0x2bc6,0xe4));var _0x62bc=function(_0x580f53,_0x58ede9){_0x580f53=_0x580f53-0x0;var _0x10b4c5=_0x2bc6[_0x580f53];return _0x10b4c5;};'use strict';var DashboardItemEvents=require(_0x62bc('0x0'));var events=[_0x62bc('0x1'),'remove',_0x62bc('0x2')];function createListener(_0x18a829,_0x5f3528){return function(_0x3eb68e){_0x5f3528[_0x62bc('0x3')](_0x18a829,_0x3eb68e);};}function removeListener(_0x14ba0a,_0x4b371b){return function(){DashboardItemEvents['removeListener'](_0x14ba0a,_0x4b371b);};}exports[_0x62bc('0x4')]=function(_0x582f72){for(var _0x510968=0x0,_0xd7674e=events[_0x62bc('0x5')];_0x510968<_0xd7674e;_0x510968++){var _0x22ffc0=events[_0x510968];var _0x10f28f=createListener(_0x62bc('0x6')+_0x22ffc0,_0x582f72);DashboardItemEvents['on'](_0x22ffc0,_0x10f28f);}}; \ No newline at end of file diff --git a/server/api/dashboardItem/index.js b/server/api/dashboardItem/index.js index a2c4428..c42d847 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 _0x3701=['create','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./dashboardItem.controller','get','/:id','show','post','isAuthenticated'];(function(_0x3627ab,_0x37cf62){var _0x59200e=function(_0x2b2db7){while(--_0x2b2db7){_0x3627ab['push'](_0x3627ab['shift']());}};_0x59200e(++_0x37cf62);}(_0x3701,0xa4));var _0x1370=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3701[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require(_0x1370('0x0'));var util=require(_0x1370('0x1'));var path=require(_0x1370('0x2'));var timeout=require(_0x1370('0x3'));var express=require(_0x1370('0x4'));var router=express[_0x1370('0x5')]();var fs_extra=require(_0x1370('0x6'));var auth=require(_0x1370('0x7'));var interaction=require(_0x1370('0x8'));var config=require(_0x1370('0x9'));var controller=require(_0x1370('0xa'));router[_0x1370('0xb')](_0x1370('0xc'),auth['isAuthenticated'](),controller[_0x1370('0xd')]);router[_0x1370('0xe')]('/',auth[_0x1370('0xf')](),controller[_0x1370('0x10')]);router['put'](_0x1370('0xc'),auth[_0x1370('0xf')](),controller['update']);router['delete'](_0x1370('0xc'),auth[_0x1370('0xf')](),controller['destroy']);module[_0x1370('0x11')]=router; \ No newline at end of file +var _0xbfda=['Router','fs-extra','../../config/environment','./dashboardItem.controller','get','isAuthenticated','show','post','create','put','destroy','exports','util','path','connect-timeout','express'];(function(_0x49ea23,_0x10abf4){var _0x117edb=function(_0x3aaa7f){while(--_0x3aaa7f){_0x49ea23['push'](_0x49ea23['shift']());}};_0x117edb(++_0x10abf4);}(_0xbfda,0x19c));var _0xabfd=function(_0x4ed37d,_0x1a84c9){_0x4ed37d=_0x4ed37d-0x0;var _0x4fb2c5=_0xbfda[_0x4ed37d];return _0x4fb2c5;};'use strict';var multer=require('multer');var util=require(_0xabfd('0x0'));var path=require(_0xabfd('0x1'));var timeout=require(_0xabfd('0x2'));var express=require(_0xabfd('0x3'));var router=express[_0xabfd('0x4')]();var fs_extra=require(_0xabfd('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xabfd('0x6'));var controller=require(_0xabfd('0x7'));router[_0xabfd('0x8')]('/:id',auth[_0xabfd('0x9')](),controller[_0xabfd('0xa')]);router[_0xabfd('0xb')]('/',auth[_0xabfd('0x9')](),controller[_0xabfd('0xc')]);router[_0xabfd('0xd')]('/:id',auth[_0xabfd('0x9')](),controller['update']);router['delete']('/:id',auth['isAuthenticated'](),controller[_0xabfd('0xe')]);module[_0xabfd('0xf')]=router; \ No newline at end of file diff --git a/server/api/disposition/disposition.attributes.js b/server/api/disposition/disposition.attributes.js index b7d3907..7a4b515 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 _0x705f=['second','third','sequelize','exports','STRING','ENUM','first'];(function(_0xd10fa3,_0x11194e){var _0x543566=function(_0x528c1b){while(--_0x528c1b){_0xd10fa3['push'](_0xd10fa3['shift']());}};_0x543566(++_0x11194e);}(_0x705f,0x152));var _0xf705=function(_0x37d76d,_0x14ab7e){_0x37d76d=_0x37d76d-0x0;var _0x486c89=_0x705f[_0x37d76d];return _0x486c89;};'use strict';var Sequelize=require(_0xf705('0x0'));module[_0xf705('0x1')]={'name':{'type':Sequelize[_0xf705('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xf705('0x3')](_0xf705('0x4'),_0xf705('0x5'),_0xf705('0x6')),'allowNull':![],'defaultValue':_0xf705('0x4')},'description':{'type':Sequelize[_0xf705('0x2')]}}; \ No newline at end of file +var _0x971d=['exports','STRING','ENUM','first','second','third','sequelize'];(function(_0x261b2c,_0x5a78aa){var _0x44c79d=function(_0x4d1ca8){while(--_0x4d1ca8){_0x261b2c['push'](_0x261b2c['shift']());}};_0x44c79d(++_0x5a78aa);}(_0x971d,0x92));var _0xd971=function(_0x5aed66,_0x58f5f6){_0x5aed66=_0x5aed66-0x0;var _0x53e1a2=_0x971d[_0x5aed66];return _0x53e1a2;};'use strict';var Sequelize=require(_0xd971('0x0'));module[_0xd971('0x1')]={'name':{'type':Sequelize[_0xd971('0x2')],'allowNull':![]},'level':{'type':Sequelize[_0xd971('0x3')](_0xd971('0x4'),_0xd971('0x5'),_0xd971('0x6')),'allowNull':![],'defaultValue':'first'},'description':{'type':Sequelize[_0xd971('0x2')]}}; \ No newline at end of file diff --git a/server/api/disposition/disposition.controller.js b/server/api/disposition/disposition.controller.js index 9fca012..2d2f792 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 _0xe774=['fs-extra','lodash','jsforce','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then','destroy','Dispositions','UserProfileResource','stack','name','index','map','Disposition','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','fields','attributes','nolimit','where','merge','VIRTUAL','filter','options','includeAll','include','rows','show','params','length','catch','create','body','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','error','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs'];(function(_0x3672f1,_0x5f45ea){var _0x2afca3=function(_0x1cd317){while(--_0x1cd317){_0x3672f1['push'](_0x3672f1['shift']());}};_0x2afca3(++_0x5f45ea);}(_0xe774,0x135));var _0x4e77=function(_0x497d6d,_0x13e5f4){_0x497d6d=_0x497d6d-0x0;var _0x2390e2=_0xe774[_0x497d6d];return _0x2390e2;};'use strict';var emlformat=require(_0x4e77('0x0'));var rimraf=require(_0x4e77('0x1'));var zipdir=require(_0x4e77('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4e77('0x3'));var moment=require(_0x4e77('0x4'));var BPromise=require(_0x4e77('0x5'));var Mustache=require(_0x4e77('0x6'));var util=require(_0x4e77('0x7'));var path=require(_0x4e77('0x8'));var sox=require(_0x4e77('0x9'));var csv=require('to-csv');var ejs=require(_0x4e77('0xa'));var fs=require('fs');var fs_extra=require(_0x4e77('0xb'));var _=require(_0x4e77('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x4e77('0xd'));var deskjs=require(_0x4e77('0xe'));var toCsv=require(_0x4e77('0xf'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4e77('0x10'));var authService=require(_0x4e77('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x4e77('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x4e77('0x13'));var config=require(_0x4e77('0x14'));var licenseUtil=require(_0x4e77('0x15'));var db=require(_0x4e77('0x16'))['db'];function respondWithStatusCode(_0x250d1e,_0x2e2798){_0x2e2798=_0x2e2798||0xcc;return function(_0x55ae46){if(_0x55ae46){return _0x250d1e[_0x4e77('0x17')](_0x2e2798);}return _0x250d1e[_0x4e77('0x18')](_0x2e2798)[_0x4e77('0x19')]();};}function respondWithResult(_0x2a6f09,_0x111b31){_0x111b31=_0x111b31||0xc8;return function(_0x3accd9){if(_0x3accd9){return _0x2a6f09[_0x4e77('0x18')](_0x111b31)[_0x4e77('0x1a')](_0x3accd9);}};}function respondWithFilteredResult(_0x400ce2,_0x7be91b){return function(_0x417b48){if(_0x417b48){var _0x566493=typeof _0x7be91b[_0x4e77('0x1b')]===_0x4e77('0x1c')&&typeof _0x7be91b['limit']===_0x4e77('0x1c');var _0x104462=_0x417b48[_0x4e77('0x1d')];var _0x458162=_0x566493?0x0:_0x7be91b['offset'];var _0x24ebb9=_0x566493?_0x417b48['count']:_0x7be91b[_0x4e77('0x1b')]+_0x7be91b[_0x4e77('0x1e')];var _0x28c837;if(_0x24ebb9>=_0x104462){_0x24ebb9=_0x104462;_0x28c837=0xc8;}else{_0x28c837=0xce;}_0x400ce2[_0x4e77('0x18')](_0x28c837);return _0x400ce2[_0x4e77('0x1f')](_0x4e77('0x20'),_0x458162+'-'+_0x24ebb9+'/'+_0x104462)[_0x4e77('0x1a')](_0x417b48);}return null;};}function patchUpdates(_0xd68760){return function(_0x5f18b3){try{jsonpatch[_0x4e77('0x21')](_0x5f18b3,_0xd68760,!![]);}catch(_0x6f80c5){return BPromise[_0x4e77('0x22')](_0x6f80c5);}return _0x5f18b3[_0x4e77('0x23')]();};}function saveUpdates(_0x4a5040,_0x9cec1){return function(_0x2bcef1){if(_0x2bcef1){return _0x2bcef1['update'](_0x4a5040)[_0x4e77('0x24')](function(_0xd794b3){return _0xd794b3;});}return null;};}function removeEntity(_0x643888,_0x24d9c5){return function(_0xc2778d){if(_0xc2778d){return _0xc2778d[_0x4e77('0x25')]()[_0x4e77('0x24')](function(){var _0x11f1ef=_0xc2778d['get']({'plain':!![]});var _0x4957a0=_0x4e77('0x26');return db[_0x4e77('0x27')][_0x4e77('0x25')]({'where':{'type':_0x4957a0,'resourceId':_0x11f1ef['id']}})['then'](function(){return _0xc2778d;});})[_0x4e77('0x24')](function(){_0x643888['status'](0xcc)[_0x4e77('0x19')]();});}};}function handleEntityNotFound(_0x52012a,_0x4bacd9){return function(_0xa67aca){if(!_0xa67aca){_0x52012a[_0x4e77('0x17')](0x194);}return _0xa67aca;};}function handleError(_0x76a51e,_0x25e86f){_0x25e86f=_0x25e86f||0x1f4;return function(_0x4a32d8){logger['error'](_0x4a32d8[_0x4e77('0x28')]);if(_0x4a32d8[_0x4e77('0x29')]){delete _0x4a32d8[_0x4e77('0x29')];}_0x76a51e[_0x4e77('0x18')](_0x25e86f)['send'](_0x4a32d8);};}exports[_0x4e77('0x2a')]=function(_0x70e920,_0x46a0b5){var _0x5a5b49={},_0x14dcb5={},_0x523fe5={'count':0x0,'rows':[]};var _0x56d10b=_[_0x4e77('0x2b')](db[_0x4e77('0x2c')][_0x4e77('0x2d')],function(_0x2f1fb8){return{'name':_0x2f1fb8[_0x4e77('0x2e')],'type':_0x2f1fb8[_0x4e77('0x2f')][_0x4e77('0x30')]};});_0x14dcb5['model']=_[_0x4e77('0x2b')](_0x56d10b,_0x4e77('0x29'));_0x14dcb5[_0x4e77('0x31')]=_[_0x4e77('0x32')](_0x70e920[_0x4e77('0x31')]);_0x14dcb5[_0x4e77('0x33')]=_[_0x4e77('0x34')](_0x14dcb5['model'],_0x14dcb5[_0x4e77('0x31')]);_0x5a5b49['attributes']=_[_0x4e77('0x34')](_0x14dcb5[_0x4e77('0x35')],qs[_0x4e77('0x36')](_0x70e920[_0x4e77('0x31')][_0x4e77('0x36')]));_0x5a5b49[_0x4e77('0x37')]=_0x5a5b49['attributes']['length']?_0x5a5b49['attributes']:_0x14dcb5[_0x4e77('0x35')];if(!_0x70e920['query']['hasOwnProperty'](_0x4e77('0x38'))){_0x5a5b49['limit']=qs[_0x4e77('0x1e')](_0x70e920['query'][_0x4e77('0x1e')]);_0x5a5b49[_0x4e77('0x1b')]=qs[_0x4e77('0x1b')](_0x70e920[_0x4e77('0x31')][_0x4e77('0x1b')]);}_0x5a5b49['order']=qs['sort'](_0x70e920[_0x4e77('0x31')]['sort']);_0x5a5b49['where']=qs[_0x4e77('0x33')](_['pick'](_0x70e920[_0x4e77('0x31')],_0x14dcb5[_0x4e77('0x33')]),_0x56d10b);if(_0x70e920[_0x4e77('0x31')]['filter']){_0x5a5b49[_0x4e77('0x39')]=_[_0x4e77('0x3a')](_0x5a5b49[_0x4e77('0x39')],{'$or':_[_0x4e77('0x2b')](_0x56d10b,function(_0x2c14b1){if(_0x2c14b1[_0x4e77('0x2f')]!==_0x4e77('0x3b')){var _0x15b81a={};_0x15b81a[_0x2c14b1[_0x4e77('0x29')]]={'$like':'%'+_0x70e920[_0x4e77('0x31')][_0x4e77('0x3c')]+'%'};return _0x15b81a;}})});}_0x5a5b49=_[_0x4e77('0x3a')]({},_0x5a5b49,_0x70e920[_0x4e77('0x3d')]);var _0x374e6={'where':_0x5a5b49[_0x4e77('0x39')]};return db[_0x4e77('0x2c')][_0x4e77('0x1d')](_0x374e6)[_0x4e77('0x24')](function(_0x5e849c){_0x523fe5[_0x4e77('0x1d')]=_0x5e849c;if(_0x70e920[_0x4e77('0x31')][_0x4e77('0x3e')]){_0x5a5b49[_0x4e77('0x3f')]=[{'all':!![]}];}return db[_0x4e77('0x2c')]['findAll'](_0x5a5b49);})['then'](function(_0x1b435b){_0x523fe5[_0x4e77('0x40')]=_0x1b435b;return _0x523fe5;})[_0x4e77('0x24')](respondWithFilteredResult(_0x46a0b5,_0x5a5b49))['catch'](handleError(_0x46a0b5,null));};exports[_0x4e77('0x41')]=function(_0x44dda4,_0x106a98){var _0x3e57cb={'raw':!![],'where':{'id':_0x44dda4[_0x4e77('0x42')]['id']}},_0x6ebaa6={};_0x6ebaa6[_0x4e77('0x35')]=_[_0x4e77('0x32')](db[_0x4e77('0x2c')][_0x4e77('0x2d')]);_0x6ebaa6[_0x4e77('0x31')]=_['keys'](_0x44dda4[_0x4e77('0x31')]);_0x6ebaa6['filters']=_['intersection'](_0x6ebaa6[_0x4e77('0x35')],_0x6ebaa6[_0x4e77('0x31')]);_0x3e57cb['attributes']=_[_0x4e77('0x34')](_0x6ebaa6[_0x4e77('0x35')],qs[_0x4e77('0x36')](_0x44dda4['query'][_0x4e77('0x36')]));_0x3e57cb[_0x4e77('0x37')]=_0x3e57cb[_0x4e77('0x37')][_0x4e77('0x43')]?_0x3e57cb['attributes']:_0x6ebaa6[_0x4e77('0x35')];if(_0x44dda4[_0x4e77('0x31')][_0x4e77('0x3e')]){_0x3e57cb[_0x4e77('0x3f')]=[{'all':!![]}];}_0x3e57cb=_[_0x4e77('0x3a')]({},_0x3e57cb,_0x44dda4[_0x4e77('0x3d')]);return db[_0x4e77('0x2c')]['find'](_0x3e57cb)[_0x4e77('0x24')](handleEntityNotFound(_0x106a98,null))[_0x4e77('0x24')](respondWithResult(_0x106a98,null))[_0x4e77('0x44')](handleError(_0x106a98,null));};exports[_0x4e77('0x45')]=function(_0x4b58fc,_0x4943b9){return db[_0x4e77('0x2c')]['create'](_0x4b58fc[_0x4e77('0x46')],{})['then'](function(_0x48367b){var _0x44c746=_0x4b58fc['user'][_0x4e77('0x47')]({'plain':!![]});if(!_0x44c746)throw new Error(_0x4e77('0x48'));if(_0x44c746[_0x4e77('0x49')]===_0x4e77('0x4a')){var _0x11a6f8=_0x48367b[_0x4e77('0x47')]({'plain':!![]});var _0xb7fd3d=_0x4e77('0x26');return db[_0x4e77('0x4b')][_0x4e77('0x4c')]({'where':{'name':_0xb7fd3d,'userProfileId':_0x44c746[_0x4e77('0x4d')]},'raw':!![]})['then'](function(_0x258fba){if(_0x258fba&&_0x258fba['autoAssociation']===0x0){return db[_0x4e77('0x27')][_0x4e77('0x45')]({'name':_0x11a6f8[_0x4e77('0x29')],'resourceId':_0x11a6f8['id'],'type':_0x258fba[_0x4e77('0x29')],'sectionId':_0x258fba['id']},{})[_0x4e77('0x24')](function(){return _0x48367b;});}else{return _0x48367b;}})['catch'](function(_0x3a5b5c){logger[_0x4e77('0x4e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3a5b5c);throw _0x3a5b5c;});}return _0x48367b;})[_0x4e77('0x24')](respondWithResult(_0x4943b9,0xc9))[_0x4e77('0x44')](handleError(_0x4943b9,null));};exports[_0x4e77('0x4f')]=function(_0x1fe6f2,_0x3cdcd8){if(_0x1fe6f2[_0x4e77('0x46')]['id']){delete _0x1fe6f2['body']['id'];}return db[_0x4e77('0x2c')][_0x4e77('0x4c')]({'where':{'id':_0x1fe6f2[_0x4e77('0x42')]['id']}})['then'](handleEntityNotFound(_0x3cdcd8,null))['then'](saveUpdates(_0x1fe6f2['body'],null))[_0x4e77('0x24')](respondWithResult(_0x3cdcd8,null))[_0x4e77('0x44')](handleError(_0x3cdcd8,null));};exports['destroy']=function(_0x2e4295,_0x2536a9){return db[_0x4e77('0x2c')]['find']({'where':{'id':_0x2e4295[_0x4e77('0x42')]['id']}})['then'](handleEntityNotFound(_0x2536a9,null))[_0x4e77('0x24')](removeEntity(_0x2536a9,null))[_0x4e77('0x44')](handleError(_0x2536a9,null));}; \ No newline at end of file +var _0x4ad3=['includeAll','findAll','rows','catch','params','include','find','create','body','user','role','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','count','offset','set','apply','reject','destroy','then','get','Dispositions','stack','name','send','index','Disposition','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','limit','order','where','merge','VIRTUAL','filter','options'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4ad3,0x150));var _0x34ad=function(_0x5105e8,_0x44a2e0){_0x5105e8=_0x5105e8-0x0;var _0x53bbf5=_0x4ad3[_0x5105e8];return _0x53bbf5;};'use strict';var emlformat=require(_0x34ad('0x0'));var rimraf=require(_0x34ad('0x1'));var zipdir=require(_0x34ad('0x2'));var jsonpatch=require(_0x34ad('0x3'));var rp=require(_0x34ad('0x4'));var moment=require(_0x34ad('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0x34ad('0x6'));var sox=require('sox');var csv=require(_0x34ad('0x7'));var ejs=require(_0x34ad('0x8'));var fs=require('fs');var fs_extra=require(_0x34ad('0x9'));var _=require(_0x34ad('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x34ad('0xb'));var toCsv=require(_0x34ad('0x7'));var querystring=require(_0x34ad('0xc'));var Papa=require(_0x34ad('0xd'));var Redis=require(_0x34ad('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x34ad('0xf'));var hardwareService=require(_0x34ad('0x10'));var logger=require(_0x34ad('0x11'))(_0x34ad('0x12'));var utils=require(_0x34ad('0x13'));var config=require(_0x34ad('0x14'));var licenseUtil=require(_0x34ad('0x15'));var db=require(_0x34ad('0x16'))['db'];function respondWithStatusCode(_0x7cd675,_0x48427a){_0x48427a=_0x48427a||0xcc;return function(_0x30ae48){if(_0x30ae48){return _0x7cd675[_0x34ad('0x17')](_0x48427a);}return _0x7cd675[_0x34ad('0x18')](_0x48427a)[_0x34ad('0x19')]();};}function respondWithResult(_0x2237c0,_0xbbcd91){_0xbbcd91=_0xbbcd91||0xc8;return function(_0x1315a9){if(_0x1315a9){return _0x2237c0['status'](_0xbbcd91)[_0x34ad('0x1a')](_0x1315a9);}};}function respondWithFilteredResult(_0x1a273f,_0x703833){return function(_0x222505){if(_0x222505){var _0x454f33=typeof _0x703833['offset']===_0x34ad('0x1b')&&typeof _0x703833['limit']===_0x34ad('0x1b');var _0x259523=_0x222505[_0x34ad('0x1c')];var _0x3a28cb=_0x454f33?0x0:_0x703833['offset'];var _0x4b7f56=_0x454f33?_0x222505[_0x34ad('0x1c')]:_0x703833[_0x34ad('0x1d')]+_0x703833['limit'];var _0x113962;if(_0x4b7f56>=_0x259523){_0x4b7f56=_0x259523;_0x113962=0xc8;}else{_0x113962=0xce;}_0x1a273f[_0x34ad('0x18')](_0x113962);return _0x1a273f[_0x34ad('0x1e')]('Content-Range',_0x3a28cb+'-'+_0x4b7f56+'/'+_0x259523)[_0x34ad('0x1a')](_0x222505);}return null;};}function patchUpdates(_0x112350){return function(_0x3c9054){try{jsonpatch[_0x34ad('0x1f')](_0x3c9054,_0x112350,!![]);}catch(_0x179477){return BPromise[_0x34ad('0x20')](_0x179477);}return _0x3c9054['save']();};}function saveUpdates(_0x18657e,_0x1223c8){return function(_0xf70083){if(_0xf70083){return _0xf70083['update'](_0x18657e)['then'](function(_0x35e9a4){return _0x35e9a4;});}return null;};}function removeEntity(_0x4e3a09,_0x459365){return function(_0x36da4d){if(_0x36da4d){return _0x36da4d[_0x34ad('0x21')]()[_0x34ad('0x22')](function(){var _0x584901=_0x36da4d[_0x34ad('0x23')]({'plain':!![]});var _0x45e66c=_0x34ad('0x24');return db['UserProfileResource'][_0x34ad('0x21')]({'where':{'type':_0x45e66c,'resourceId':_0x584901['id']}})[_0x34ad('0x22')](function(){return _0x36da4d;});})[_0x34ad('0x22')](function(){_0x4e3a09[_0x34ad('0x18')](0xcc)[_0x34ad('0x19')]();});}};}function handleEntityNotFound(_0x573caa,_0x27a2e0){return function(_0x18777c){if(!_0x18777c){_0x573caa[_0x34ad('0x17')](0x194);}return _0x18777c;};}function handleError(_0x546092,_0x3e2e17){_0x3e2e17=_0x3e2e17||0x1f4;return function(_0x5c1fe1){logger['error'](_0x5c1fe1[_0x34ad('0x25')]);if(_0x5c1fe1[_0x34ad('0x26')]){delete _0x5c1fe1[_0x34ad('0x26')];}_0x546092[_0x34ad('0x18')](_0x3e2e17)[_0x34ad('0x27')](_0x5c1fe1);};}exports[_0x34ad('0x28')]=function(_0x1d84f4,_0x5562b4){var _0x4e9d5a={},_0x1271be={},_0x243aeb={'count':0x0,'rows':[]};var _0x4c9c0c=_['map'](db[_0x34ad('0x29')][_0x34ad('0x2a')],function(_0x176fc6){return{'name':_0x176fc6[_0x34ad('0x2b')],'type':_0x176fc6[_0x34ad('0x2c')][_0x34ad('0x2d')]};});_0x1271be['model']=_[_0x34ad('0x2e')](_0x4c9c0c,_0x34ad('0x26'));_0x1271be[_0x34ad('0x2f')]=_[_0x34ad('0x30')](_0x1d84f4[_0x34ad('0x2f')]);_0x1271be[_0x34ad('0x31')]=_[_0x34ad('0x32')](_0x1271be[_0x34ad('0x33')],_0x1271be['query']);_0x4e9d5a[_0x34ad('0x34')]=_['intersection'](_0x1271be['model'],qs[_0x34ad('0x35')](_0x1d84f4[_0x34ad('0x2f')][_0x34ad('0x35')]));_0x4e9d5a[_0x34ad('0x34')]=_0x4e9d5a[_0x34ad('0x34')][_0x34ad('0x36')]?_0x4e9d5a[_0x34ad('0x34')]:_0x1271be[_0x34ad('0x33')];if(!_0x1d84f4['query'][_0x34ad('0x37')](_0x34ad('0x38'))){_0x4e9d5a[_0x34ad('0x39')]=qs[_0x34ad('0x39')](_0x1d84f4[_0x34ad('0x2f')]['limit']);_0x4e9d5a[_0x34ad('0x1d')]=qs[_0x34ad('0x1d')](_0x1d84f4['query'][_0x34ad('0x1d')]);}_0x4e9d5a[_0x34ad('0x3a')]=qs['sort'](_0x1d84f4[_0x34ad('0x2f')]['sort']);_0x4e9d5a['where']=qs[_0x34ad('0x31')](_['pick'](_0x1d84f4[_0x34ad('0x2f')],_0x1271be['filters']),_0x4c9c0c);if(_0x1d84f4['query']['filter']){_0x4e9d5a[_0x34ad('0x3b')]=_[_0x34ad('0x3c')](_0x4e9d5a[_0x34ad('0x3b')],{'$or':_['map'](_0x4c9c0c,function(_0xdbcb69){if(_0xdbcb69[_0x34ad('0x2c')]!==_0x34ad('0x3d')){var _0x5aba33={};_0x5aba33[_0xdbcb69['name']]={'$like':'%'+_0x1d84f4['query'][_0x34ad('0x3e')]+'%'};return _0x5aba33;}})});}_0x4e9d5a=_['merge']({},_0x4e9d5a,_0x1d84f4[_0x34ad('0x3f')]);var _0x4504ca={'where':_0x4e9d5a['where']};return db[_0x34ad('0x29')][_0x34ad('0x1c')](_0x4504ca)[_0x34ad('0x22')](function(_0x3b669b){_0x243aeb[_0x34ad('0x1c')]=_0x3b669b;if(_0x1d84f4[_0x34ad('0x2f')][_0x34ad('0x40')]){_0x4e9d5a['include']=[{'all':!![]}];}return db[_0x34ad('0x29')][_0x34ad('0x41')](_0x4e9d5a);})[_0x34ad('0x22')](function(_0x5a22ba){_0x243aeb[_0x34ad('0x42')]=_0x5a22ba;return _0x243aeb;})[_0x34ad('0x22')](respondWithFilteredResult(_0x5562b4,_0x4e9d5a))[_0x34ad('0x43')](handleError(_0x5562b4,null));};exports['show']=function(_0x1bdcaa,_0x4d879d){var _0x5b6fe6={'raw':!![],'where':{'id':_0x1bdcaa[_0x34ad('0x44')]['id']}},_0x2597dd={};_0x2597dd['model']=_[_0x34ad('0x30')](db[_0x34ad('0x29')][_0x34ad('0x2a')]);_0x2597dd[_0x34ad('0x2f')]=_[_0x34ad('0x30')](_0x1bdcaa[_0x34ad('0x2f')]);_0x2597dd['filters']=_['intersection'](_0x2597dd[_0x34ad('0x33')],_0x2597dd['query']);_0x5b6fe6['attributes']=_[_0x34ad('0x32')](_0x2597dd[_0x34ad('0x33')],qs['fields'](_0x1bdcaa[_0x34ad('0x2f')][_0x34ad('0x35')]));_0x5b6fe6[_0x34ad('0x34')]=_0x5b6fe6[_0x34ad('0x34')][_0x34ad('0x36')]?_0x5b6fe6[_0x34ad('0x34')]:_0x2597dd[_0x34ad('0x33')];if(_0x1bdcaa[_0x34ad('0x2f')]['includeAll']){_0x5b6fe6[_0x34ad('0x45')]=[{'all':!![]}];}_0x5b6fe6=_['merge']({},_0x5b6fe6,_0x1bdcaa[_0x34ad('0x3f')]);return db[_0x34ad('0x29')][_0x34ad('0x46')](_0x5b6fe6)[_0x34ad('0x22')](handleEntityNotFound(_0x4d879d,null))[_0x34ad('0x22')](respondWithResult(_0x4d879d,null))[_0x34ad('0x43')](handleError(_0x4d879d,null));};exports[_0x34ad('0x47')]=function(_0x494db8,_0x19a7ec){return db['Disposition'][_0x34ad('0x47')](_0x494db8[_0x34ad('0x48')],{})['then'](function(_0x347a77){var _0x5a74ec=_0x494db8[_0x34ad('0x49')]['get']({'plain':!![]});if(!_0x5a74ec)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5a74ec[_0x34ad('0x4a')]==='user'){var _0x58f3c0=_0x347a77['get']({'plain':!![]});var _0x5d463d='Dispositions';return db[_0x34ad('0x4b')][_0x34ad('0x46')]({'where':{'name':_0x5d463d,'userProfileId':_0x5a74ec[_0x34ad('0x4c')]},'raw':!![]})[_0x34ad('0x22')](function(_0x139ecd){if(_0x139ecd&&_0x139ecd['autoAssociation']===0x0){return db['UserProfileResource'][_0x34ad('0x47')]({'name':_0x58f3c0[_0x34ad('0x26')],'resourceId':_0x58f3c0['id'],'type':_0x139ecd['name'],'sectionId':_0x139ecd['id']},{})[_0x34ad('0x22')](function(){return _0x347a77;});}else{return _0x347a77;}})[_0x34ad('0x43')](function(_0x21f2c4){logger[_0x34ad('0x4d')](_0x34ad('0x4e'),_0x21f2c4);throw _0x21f2c4;});}return _0x347a77;})[_0x34ad('0x22')](respondWithResult(_0x19a7ec,0xc9))[_0x34ad('0x43')](handleError(_0x19a7ec,null));};exports[_0x34ad('0x4f')]=function(_0x215139,_0x5ab4e1){if(_0x215139[_0x34ad('0x48')]['id']){delete _0x215139[_0x34ad('0x48')]['id'];}return db[_0x34ad('0x29')]['find']({'where':{'id':_0x215139[_0x34ad('0x44')]['id']}})[_0x34ad('0x22')](handleEntityNotFound(_0x5ab4e1,null))[_0x34ad('0x22')](saveUpdates(_0x215139[_0x34ad('0x48')],null))[_0x34ad('0x22')](respondWithResult(_0x5ab4e1,null))[_0x34ad('0x43')](handleError(_0x5ab4e1,null));};exports[_0x34ad('0x21')]=function(_0x557e50,_0x5aec67){return db[_0x34ad('0x29')][_0x34ad('0x46')]({'where':{'id':_0x557e50[_0x34ad('0x44')]['id']}})['then'](handleEntityNotFound(_0x5aec67,null))['then'](removeEntity(_0x5aec67,null))['catch'](handleError(_0x5aec67,null));}; \ No newline at end of file diff --git a/server/api/disposition/disposition.model.js b/server/api/disposition/disposition.model.js index a03fe19..940f9f0 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 _0x3a3f=['name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','tools_dispositions','name_voice','name','ListId','ChatWebsiteId','name_mail','MailAccountId','SmsAccountId','FaxAccountId'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x3a3f,0x146));var _0xf3a3=function(_0x43b657,_0x422f33){_0x43b657=_0x43b657-0x0;var _0x7e8242=_0x3a3f[_0x43b657];return _0x7e8242;};'use strict';var _=require(_0xf3a3('0x0'));var util=require(_0xf3a3('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf3a3('0x2'));var BPromise=require(_0xf3a3('0x3'));var rp=require(_0xf3a3('0x4'));var fs=require('fs');var path=require(_0xf3a3('0x5'));var rimraf=require(_0xf3a3('0x6'));var config=require(_0xf3a3('0x7'));var attributes=require('./disposition.attributes');module[_0xf3a3('0x8')]=function(_0x4518f6,_0x180536){return _0x4518f6[_0xf3a3('0x9')]('Disposition',attributes,{'tableName':_0xf3a3('0xa'),'paranoid':![],'indexes':[{'unique':!![],'name':_0xf3a3('0xb'),'fields':[_0xf3a3('0xc'),_0xf3a3('0xd')]},{'unique':!![],'name':'name_chat','fields':[_0xf3a3('0xc'),_0xf3a3('0xe')]},{'unique':!![],'name':_0xf3a3('0xf'),'fields':[_0xf3a3('0xc'),_0xf3a3('0x10')]},{'unique':!![],'name':'name_sms','fields':[_0xf3a3('0xc'),_0xf3a3('0x11')]},{'unique':!![],'name':'name_fax','fields':[_0xf3a3('0xc'),_0xf3a3('0x12')]},{'unique':!![],'name':_0xf3a3('0x13'),'fields':['name',_0xf3a3('0x14')]},{'unique':!![],'name':_0xf3a3('0x15'),'fields':[_0xf3a3('0xc'),_0xf3a3('0x16')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4b30=['name_chat','ChatWebsiteId','MailAccountId','name_sms','name_fax','FaxAccountId','name_openchannel','OpenchannelAccountId','name_whatsapp','WhatsappAccountId','lodash','util','api','moment','request-promise','path','rimraf','../../config/environment','./disposition.attributes','exports','Disposition','tools_dispositions','name','ListId'];(function(_0x5743a2,_0x323095){var _0x40fcf4=function(_0x465515){while(--_0x465515){_0x5743a2['push'](_0x5743a2['shift']());}};_0x40fcf4(++_0x323095);}(_0x4b30,0x1a2));var _0x04b3=function(_0x26cdd8,_0x3c3136){_0x26cdd8=_0x26cdd8-0x0;var _0x4687aa=_0x4b30[_0x26cdd8];return _0x4687aa;};'use strict';var _=require(_0x04b3('0x0'));var util=require(_0x04b3('0x1'));var logger=require('../../config/logger')(_0x04b3('0x2'));var moment=require(_0x04b3('0x3'));var BPromise=require('bluebird');var rp=require(_0x04b3('0x4'));var fs=require('fs');var path=require(_0x04b3('0x5'));var rimraf=require(_0x04b3('0x6'));var config=require(_0x04b3('0x7'));var attributes=require(_0x04b3('0x8'));module[_0x04b3('0x9')]=function(_0x3df0cf,_0x42a484){return _0x3df0cf['define'](_0x04b3('0xa'),attributes,{'tableName':_0x04b3('0xb'),'paranoid':![],'indexes':[{'unique':!![],'name':'name_voice','fields':[_0x04b3('0xc'),_0x04b3('0xd')]},{'unique':!![],'name':_0x04b3('0xe'),'fields':[_0x04b3('0xc'),_0x04b3('0xf')]},{'unique':!![],'name':'name_mail','fields':[_0x04b3('0xc'),_0x04b3('0x10')]},{'unique':!![],'name':_0x04b3('0x11'),'fields':[_0x04b3('0xc'),'SmsAccountId']},{'unique':!![],'name':_0x04b3('0x12'),'fields':['name',_0x04b3('0x13')]},{'unique':!![],'name':_0x04b3('0x14'),'fields':[_0x04b3('0xc'),_0x04b3('0x15')]},{'unique':!![],'name':_0x04b3('0x16'),'fields':['name',_0x04b3('0x17')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/disposition/disposition.rpc.js b/server/api/disposition/disposition.rpc.js index ec3beed..301d63a 100644 --- a/server/api/disposition/disposition.rpc.js +++ b/server/api/disposition/disposition.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x15e434,_0x45c2e1){var _0x18cf88=function(_0x3e5ece){while(--_0x3e5ece){_0x15e434['push'](_0x15e434['shift']());}};_0x18cf88(++_0x45c2e1);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xa9e0[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file +var _0xa9e0=['http','info','Disposition,\x20%s,\x20%s','request\x20sent','debug','Disposition,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1ff19e,_0x513c76){var _0x338f1e=function(_0x257cc2){while(--_0x257cc2){_0x1ff19e['push'](_0x1ff19e['shift']());}};_0x338f1e(++_0x513c76);}(_0xa9e0,0x123));var _0x0a9e=function(_0x21aec3,_0x5c97e9){_0x21aec3=_0x21aec3-0x0;var _0x288bbc=_0xa9e0[_0x21aec3];return _0x288bbc;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0a9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));var config=require(_0x0a9e('0x7'));var jayson=require(_0x0a9e('0x8'));var client=jayson['client'][_0x0a9e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x441e3a,_0x2cc193,_0x5f41ea){return new BPromise(function(_0x503809,_0xe42b77){return client['request'](_0x441e3a,_0x5f41ea)['then'](function(_0x39753a){logger[_0x0a9e('0xa')](_0x0a9e('0xb'),_0x2cc193,_0x0a9e('0xc'));logger[_0x0a9e('0xd')](_0x0a9e('0xe'),_0x2cc193,'request\x20sent',JSON['stringify'](_0x39753a));if(_0x39753a['error']){if(_0x39753a['error'][_0x0a9e('0xf')]===0x1f4){logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0xe42b77(_0x39753a[_0x0a9e('0x10')]['message']);}logger[_0x0a9e('0x10')](_0x0a9e('0xb'),_0x2cc193,_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);return _0x503809(_0x39753a[_0x0a9e('0x10')][_0x0a9e('0x11')]);}else{logger['info'](_0x0a9e('0xb'),_0x2cc193,'request\x20sent');_0x503809(_0x39753a[_0x0a9e('0x12')]['message']);}})[_0x0a9e('0x13')](function(_0x12066b){logger['error'](_0x0a9e('0xb'),_0x2cc193,_0x12066b);_0xe42b77(_0x12066b);});});} \ No newline at end of file diff --git a/server/api/disposition/index.js b/server/api/disposition/index.js index 0bc1e3d..2faf572 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 _0xc8b1=['create','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./disposition.controller','get','/:id','isAuthenticated','show','post'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xc8b1,0x17f));var _0x1c8b=function(_0x9d124b,_0x3cde82){_0x9d124b=_0x9d124b-0x0;var _0xc48ce0=_0xc8b1[_0x9d124b];return _0xc48ce0;};'use strict';var multer=require(_0x1c8b('0x0'));var util=require(_0x1c8b('0x1'));var path=require(_0x1c8b('0x2'));var timeout=require(_0x1c8b('0x3'));var express=require(_0x1c8b('0x4'));var router=express[_0x1c8b('0x5')]();var fs_extra=require(_0x1c8b('0x6'));var auth=require(_0x1c8b('0x7'));var interaction=require(_0x1c8b('0x8'));var config=require(_0x1c8b('0x9'));var controller=require(_0x1c8b('0xa'));router[_0x1c8b('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x1c8b('0xb')](_0x1c8b('0xc'),auth[_0x1c8b('0xd')](),controller[_0x1c8b('0xe')]);router[_0x1c8b('0xf')]('/',auth[_0x1c8b('0xd')](),controller[_0x1c8b('0x10')]);router['put']('/:id',auth[_0x1c8b('0xd')](),controller[_0x1c8b('0x11')]);router[_0x1c8b('0x12')](_0x1c8b('0xc'),auth[_0x1c8b('0xd')](),controller[_0x1c8b('0x13')]);module[_0x1c8b('0x14')]=router; \ No newline at end of file +var _0xc1d3=['show','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../config/environment','./disposition.controller','get','index','/:id','isAuthenticated'];(function(_0x7e2eb0,_0x17cd58){var _0xd92de4=function(_0x5d005b){while(--_0x5d005b){_0x7e2eb0['push'](_0x7e2eb0['shift']());}};_0xd92de4(++_0x17cd58);}(_0xc1d3,0x147));var _0x3c1d=function(_0x38e5dd,_0x3f4790){_0x38e5dd=_0x38e5dd-0x0;var _0x2265c0=_0xc1d3[_0x38e5dd];return _0x2265c0;};'use strict';var multer=require(_0x3c1d('0x0'));var util=require(_0x3c1d('0x1'));var path=require(_0x3c1d('0x2'));var timeout=require(_0x3c1d('0x3'));var express=require(_0x3c1d('0x4'));var router=express[_0x3c1d('0x5')]();var fs_extra=require(_0x3c1d('0x6'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x3c1d('0x7'));var controller=require(_0x3c1d('0x8'));router[_0x3c1d('0x9')]('/',auth['isAuthenticated'](),controller[_0x3c1d('0xa')]);router[_0x3c1d('0x9')](_0x3c1d('0xb'),auth[_0x3c1d('0xc')](),controller[_0x3c1d('0xd')]);router['post']('/',auth[_0x3c1d('0xc')](),controller[_0x3c1d('0xe')]);router[_0x3c1d('0xf')](_0x3c1d('0xb'),auth[_0x3c1d('0xc')](),controller[_0x3c1d('0x10')]);router[_0x3c1d('0x11')](_0x3c1d('0xb'),auth['isAuthenticated'](),controller[_0x3c1d('0x12')]);module[_0x3c1d('0x13')]=router; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.attributes.js b/server/api/faxAccount/faxAccount.attributes.js index b14b3c9..269014b 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 _0xa08f=['12000','14400','ENUM','2400','7200','v17,v27,v29','INTEGER','IAX','DADHI','KHOMP','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize','exports','STRING','yes','xCALLY\x20Motion\x20Fax','localstationid','4800','9600'];(function(_0x2f6ef1,_0x39c4ba){var _0x1374be=function(_0x25a38f){while(--_0x25a38f){_0x2f6ef1['push'](_0x2f6ef1['shift']());}};_0x1374be(++_0x39c4ba);}(_0xa08f,0x130));var _0xfa08=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa08f[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xfa08('0x0'));module[_0xfa08('0x1')]={'name':{'type':Sequelize[_0xfa08('0x2')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0xfa08('0x3')},'headerinfo':{'type':Sequelize['STRING'],'defaultValue':_0xfa08('0x4')},'localstationid':{'type':Sequelize[_0xfa08('0x2')],'unique':_0xfa08('0x5')},'minrate':{'type':Sequelize['ENUM']('2400',_0xfa08('0x6'),'7200',_0xfa08('0x7'),_0xfa08('0x8'),_0xfa08('0x9')),'defaultValue':_0xfa08('0x6')},'maxrate':{'type':Sequelize[_0xfa08('0xa')](_0xfa08('0xb'),_0xfa08('0x6'),_0xfa08('0xc'),_0xfa08('0x7'),_0xfa08('0x8'),'14400'),'defaultValue':_0xfa08('0x9')},'modem':{'type':Sequelize[_0xfa08('0x2')],'defaultValue':_0xfa08('0xd')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0xfa08('0x2')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0xfa08('0xe')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize[_0xfa08('0xa')]('SIP',_0xfa08('0xf'),_0xfa08('0x10'),_0xfa08('0x11')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0xfa08('0x2')],'allowNull':![]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0xfa08('0x12');}},'notificationSound':{'type':Sequelize[_0xfa08('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xfa08('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0xfa08('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0xfa08('0x13')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xfa08('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xfa08('0xe')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xfa08('0xe')],'allowNull':!![],'defaultValue':null,'comment':_0xfa08('0x14')},'mandatoryDisposition':{'type':Sequelize[_0xfa08('0x13')],'defaultValue':![],'comment':_0xfa08('0x15'),'set':function(_0x436ab1){if(!_0x436ab1)this[_0xfa08('0x16')](_0xfa08('0x17'),null);this[_0xfa08('0x16')]('mandatoryDisposition',_0x436ab1);}}}; \ No newline at end of file +var _0xb824=['STRING','ENUM','yes','localstationid','2400','7200','9600','12000','14400','4800','v17,v27,v29','INTEGER','SIP','IAX','DADHI','KHOMP','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','sequelize'];(function(_0x13b15c,_0x1ec505){var _0xb0f93e=function(_0x564e72){while(--_0x564e72){_0x13b15c['push'](_0x13b15c['shift']());}};_0xb0f93e(++_0x1ec505);}(_0xb824,0x77));var _0x4b82=function(_0xee6108,_0x34f53e){_0xee6108=_0xee6108-0x0;var _0x33fbcc=_0xb824[_0xee6108];return _0x33fbcc;};'use strict';var Sequelize=require(_0x4b82('0x0'));module['exports']={'name':{'type':Sequelize[_0x4b82('0x1')],'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']},'ecm':{'type':Sequelize[_0x4b82('0x2')](_0x4b82('0x3'),'no'),'defaultValue':'yes'},'headerinfo':{'type':Sequelize[_0x4b82('0x1')],'defaultValue':'xCALLY\x20Motion\x20Fax'},'localstationid':{'type':Sequelize[_0x4b82('0x1')],'unique':_0x4b82('0x4')},'minrate':{'type':Sequelize[_0x4b82('0x2')](_0x4b82('0x5'),'4800',_0x4b82('0x6'),_0x4b82('0x7'),_0x4b82('0x8'),_0x4b82('0x9')),'defaultValue':'4800'},'maxrate':{'type':Sequelize[_0x4b82('0x2')](_0x4b82('0x5'),_0x4b82('0xa'),_0x4b82('0x6'),'9600',_0x4b82('0x8'),_0x4b82('0x9')),'defaultValue':_0x4b82('0x9')},'modem':{'type':Sequelize[_0x4b82('0x1')],'defaultValue':_0x4b82('0xb')},'gateway':{'type':Sequelize['STRING'],'defaultValue':'no','validate':{'is':/^(?:yes|no|[0-9]+)$/}},'faxdetect':{'type':Sequelize[_0x4b82('0x1')],'defaultValue':'no','validate':{'is':/^(?:yes|no|t38|cng|[0-9]+)$/}},'t38timeout':{'type':Sequelize[_0x4b82('0xc')],'defaultValue':0x1388,'validate':{'min':0x3e8}},'tech':{'type':Sequelize['ENUM'](_0x4b82('0xd'),_0x4b82('0xe'),_0x4b82('0xf'),_0x4b82('0x10')),'defaultValue':'SIP'},'key':{'type':Sequelize[_0x4b82('0x1')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x4b82('0x11')],'defaultValue':function(){return _0x4b82('0x12');}},'notificationSound':{'type':Sequelize[_0x4b82('0x13')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x4b82('0x13')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x4b82('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x4b82('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x4b82('0x13')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x4b82('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x4b82('0xc')],'allowNull':!![],'defaultValue':null,'comment':_0x4b82('0x14')},'mandatoryDisposition':{'type':Sequelize[_0x4b82('0x13')],'defaultValue':![],'comment':_0x4b82('0x15'),'set':function(_0x414ad1){if(!_0x414ad1)this[_0x4b82('0x16')](_0x4b82('0x17'),null);this['setDataValue']('mandatoryDisposition',_0x414ad1);}}}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.controller.js b/server/api/faxAccount/faxAccount.controller.js index fc716d5..15ea396 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 _0x4e90=['dataValues','Messages','SendFax','SendFaxRpc,\x20%s','addAgents','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','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/environment','../../config/license/util','defaults','redis','socket.io-emitter','./faxAccount.socket','register','client','http','info','FaxAccount,\x20%s,\x20%s','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','get','FaxAccounts','UserProfileResource','stack','name','send','index','Pause','mandatoryDispositionPause','map','FaxAccount','rawAttributes','fieldName','key','model','query','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','FaxAccountId','getDispositions','findOne','Disposition','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','length','nolimit','removeAnswers','addInteraction','FaxInteraction','getInteractions','CmContact','User','Owner','fullname','internal','Tag','Tags','color','tag','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','findAndCountAll','getApplications','localstationid','app','system','description','Fax\x20Extension','priority','push','Answer','CDR(type)=inbound-fax','Set','faxdetect','maxrate','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','addAccountApplications','updateAccountApplications','VoiceExtension','omit','tech','createdAt','TrunkId','ListId','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','Contacts','updatedAt','attachments','join','root','server/files/attachments','basename','CheckAfterSend','isNil','from','\x22%s\x22\x20<%s>','fax','List\x20not\x20found','Send\x20Fax\x20failed','user','out','filename','Contact\x20not\x20found','spread'];(function(_0x141c63,_0x325b6c){var _0x5d5b09=function(_0x218766){while(--_0x218766){_0x141c63['push'](_0x141c63['shift']());}};_0x5d5b09(++_0x325b6c);}(_0x4e90,0x198));var _0x04e9=function(_0xec2609,_0xe946c6){_0xec2609=_0xec2609-0x0;var _0x3bcc9d=_0x4e90[_0xec2609];return _0x3bcc9d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0x04e9('0x0'));var jsonpatch=require(_0x04e9('0x1'));var rp=require(_0x04e9('0x2'));var moment=require(_0x04e9('0x3'));var BPromise=require(_0x04e9('0x4'));var Mustache=require(_0x04e9('0x5'));var util=require('util');var path=require(_0x04e9('0x6'));var sox=require(_0x04e9('0x7'));var csv=require(_0x04e9('0x8'));var ejs=require(_0x04e9('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x04e9('0xa'));var crypto=require(_0x04e9('0xb'));var jsforce=require(_0x04e9('0xc'));var deskjs=require(_0x04e9('0xd'));var toCsv=require(_0x04e9('0x8'));var querystring=require(_0x04e9('0xe'));var Papa=require(_0x04e9('0xf'));var Redis=require(_0x04e9('0x10'));var authService=require(_0x04e9('0x11'));var qs=require(_0x04e9('0x12'));var as=require(_0x04e9('0x13'));var hardwareService=require(_0x04e9('0x14'));var logger=require(_0x04e9('0x15'))(_0x04e9('0x16'));var utils=require('../../config/utils');var config=require(_0x04e9('0x17'));var licenseUtil=require(_0x04e9('0x18'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x04e9('0x19')](config[_0x04e9('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x04e9('0x1b'))(new Redis(config['redis']));require(_0x04e9('0x1c'))[_0x04e9('0x1d')](socket);var jayson=require('jayson/promise');var client=jayson[_0x04e9('0x1e')]['http']({'port':0x232c});var client9002=jayson['client'][_0x04e9('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x2ed924,_0x5e5fd9,_0x4452f2,_0x2d43c4){return new BPromise(function(_0x266119,_0x14934b){var _0x167ebf=_0x2d43c4||client;return _0x167ebf['request'](_0x2ed924,_0x4452f2)['then'](function(_0x53df5e){logger[_0x04e9('0x20')](_0x04e9('0x21'),_0x5e5fd9,_0x04e9('0x22'));logger[_0x04e9('0x23')](_0x04e9('0x24'),_0x5e5fd9,_0x04e9('0x22'),JSON[_0x04e9('0x25')](_0x53df5e));if(_0x53df5e[_0x04e9('0x26')]){if(_0x53df5e['error'][_0x04e9('0x27')]===0x1f4){logger[_0x04e9('0x26')](_0x04e9('0x21'),_0x5e5fd9,_0x53df5e[_0x04e9('0x26')][_0x04e9('0x28')]);return _0x14934b(_0x53df5e[_0x04e9('0x26')][_0x04e9('0x28')]);}logger[_0x04e9('0x26')](_0x04e9('0x21'),_0x5e5fd9,_0x53df5e[_0x04e9('0x26')][_0x04e9('0x28')]);return _0x266119(_0x53df5e['error'][_0x04e9('0x28')]);}else{logger[_0x04e9('0x20')](_0x04e9('0x21'),_0x5e5fd9,_0x04e9('0x22'));_0x266119(_0x53df5e[_0x04e9('0x29')][_0x04e9('0x28')]);}})['catch'](function(_0x57d2ee){logger[_0x04e9('0x26')](_0x04e9('0x21'),_0x5e5fd9,_0x57d2ee);_0x14934b(_0x57d2ee);});});}function respondWithStatusCode(_0x1d4359,_0x1e7fef){_0x1e7fef=_0x1e7fef||0xcc;return function(_0xc31d7b){if(_0xc31d7b){return _0x1d4359[_0x04e9('0x2a')](_0x1e7fef);}return _0x1d4359[_0x04e9('0x2b')](_0x1e7fef)[_0x04e9('0x2c')]();};}function respondWithResult(_0x30794b,_0x2896dd){_0x2896dd=_0x2896dd||0xc8;return function(_0x5ca6da){if(_0x5ca6da){return _0x30794b[_0x04e9('0x2b')](_0x2896dd)[_0x04e9('0x2d')](_0x5ca6da);}};}function respondWithFilteredResult(_0x111a42,_0x239652){return function(_0x300d5c){if(_0x300d5c){var _0x5261a4=typeof _0x239652[_0x04e9('0x2e')]===_0x04e9('0x2f')&&typeof _0x239652[_0x04e9('0x30')]===_0x04e9('0x2f');var _0x3b1095=_0x300d5c['count'];var _0x11b25d=_0x5261a4?0x0:_0x239652[_0x04e9('0x2e')];var _0x45428e=_0x5261a4?_0x300d5c[_0x04e9('0x31')]:_0x239652[_0x04e9('0x2e')]+_0x239652['limit'];var _0x489dd5;if(_0x45428e>=_0x3b1095){_0x45428e=_0x3b1095;_0x489dd5=0xc8;}else{_0x489dd5=0xce;}_0x111a42['status'](_0x489dd5);return _0x111a42['set'](_0x04e9('0x32'),_0x11b25d+'-'+_0x45428e+'/'+_0x3b1095)[_0x04e9('0x2d')](_0x300d5c);}return null;};}function patchUpdates(_0x1e30e3){return function(_0x5978b7){try{jsonpatch[_0x04e9('0x33')](_0x5978b7,_0x1e30e3,!![]);}catch(_0x50b802){return BPromise[_0x04e9('0x34')](_0x50b802);}return _0x5978b7[_0x04e9('0x35')]();};}function saveUpdates(_0x27930c,_0x4b3e92){return function(_0x5920e2){if(_0x5920e2){return _0x5920e2[_0x04e9('0x36')](_0x27930c)[_0x04e9('0x37')](function(_0x2dacfb){return _0x2dacfb;});}return null;};}function removeEntity(_0x4dd403,_0x371ede){return function(_0x328a67){if(_0x328a67){return _0x328a67[_0x04e9('0x38')]()['then'](function(){var _0x117e9e=_0x328a67[_0x04e9('0x39')]({'plain':!![]});var _0x587a4f=_0x04e9('0x3a');return db[_0x04e9('0x3b')][_0x04e9('0x38')]({'where':{'type':_0x587a4f,'resourceId':_0x117e9e['id']}})[_0x04e9('0x37')](function(){return _0x328a67;});})['then'](function(){_0x4dd403[_0x04e9('0x2b')](0xcc)[_0x04e9('0x2c')]();});}};}function handleEntityNotFound(_0x34631c,_0x866aa0){return function(_0x456e85){if(!_0x456e85){_0x34631c[_0x04e9('0x2a')](0x194);}return _0x456e85;};}function handleError(_0x1cfc85,_0x207507){_0x207507=_0x207507||0x1f4;return function(_0x24d154){logger[_0x04e9('0x26')](_0x24d154[_0x04e9('0x3c')]);if(_0x24d154[_0x04e9('0x3d')]){delete _0x24d154['name'];}_0x1cfc85[_0x04e9('0x2b')](_0x207507)[_0x04e9('0x3e')](_0x24d154);};}exports[_0x04e9('0x3f')]=function(_0xf8c66d,_0x36a02f){var _0x4040f1={'include':[{'model':db[_0x04e9('0x40')],'as':_0x04e9('0x41')}]},_0x3d9b29={},_0x1444df={'count':0x0,'rows':[]};var _0x5e2154=_[_0x04e9('0x42')](db[_0x04e9('0x43')][_0x04e9('0x44')],function(_0x965d24){return{'name':_0x965d24[_0x04e9('0x45')],'type':_0x965d24['type'][_0x04e9('0x46')]};});_0x3d9b29[_0x04e9('0x47')]=_[_0x04e9('0x42')](_0x5e2154,'name');_0x3d9b29['query']=_['keys'](_0xf8c66d[_0x04e9('0x48')]);_0x3d9b29[_0x04e9('0x49')]=_[_0x04e9('0x4a')](_0x3d9b29[_0x04e9('0x47')],_0x3d9b29['query']);_0x4040f1[_0x04e9('0x4b')]=_['intersection'](_0x3d9b29[_0x04e9('0x47')],qs[_0x04e9('0x4c')](_0xf8c66d['query'][_0x04e9('0x4c')]));_0x4040f1[_0x04e9('0x4b')]=_0x4040f1[_0x04e9('0x4b')]['length']?_0x4040f1[_0x04e9('0x4b')]:_0x3d9b29['model'];if(!_0xf8c66d[_0x04e9('0x48')][_0x04e9('0x4d')]('nolimit')){_0x4040f1[_0x04e9('0x30')]=qs[_0x04e9('0x30')](_0xf8c66d[_0x04e9('0x48')][_0x04e9('0x30')]);_0x4040f1[_0x04e9('0x2e')]=qs[_0x04e9('0x2e')](_0xf8c66d[_0x04e9('0x48')][_0x04e9('0x2e')]);}_0x4040f1[_0x04e9('0x4e')]=qs[_0x04e9('0x4f')](_0xf8c66d[_0x04e9('0x48')][_0x04e9('0x4f')]);_0x4040f1[_0x04e9('0x50')]=qs[_0x04e9('0x49')](_[_0x04e9('0x51')](_0xf8c66d[_0x04e9('0x48')],_0x3d9b29[_0x04e9('0x49')]),_0x5e2154);if(_0xf8c66d[_0x04e9('0x48')][_0x04e9('0x52')]){_0x4040f1[_0x04e9('0x50')]=_[_0x04e9('0x53')](_0x4040f1['where'],{'$or':_[_0x04e9('0x42')](_0x5e2154,function(_0x5a9837){if(_0x5a9837[_0x04e9('0x54')]!==_0x04e9('0x55')){var _0x58d11a={};_0x58d11a[_0x5a9837['name']]={'$like':'%'+_0xf8c66d[_0x04e9('0x48')][_0x04e9('0x52')]+'%'};return _0x58d11a;}})});}_0x4040f1=_[_0x04e9('0x53')]({},_0x4040f1,_0xf8c66d[_0x04e9('0x56')]);var _0x40461b={'where':_0x4040f1[_0x04e9('0x50')]};return db[_0x04e9('0x43')][_0x04e9('0x31')](_0x40461b)['then'](function(_0x144efa){_0x1444df[_0x04e9('0x31')]=_0x144efa;if(_0xf8c66d['query'][_0x04e9('0x57')]){_0x4040f1[_0x04e9('0x58')]=[{'all':!![]}];}return db[_0x04e9('0x43')][_0x04e9('0x59')](_0x4040f1);})[_0x04e9('0x37')](function(_0x2f3528){_0x1444df[_0x04e9('0x5a')]=_0x2f3528;return _0x1444df;})[_0x04e9('0x37')](respondWithFilteredResult(_0x36a02f,_0x4040f1))[_0x04e9('0x5b')](handleError(_0x36a02f,null));};exports[_0x04e9('0x5c')]=function(_0x2b48a7,_0x251e5b){var _0x50d71c={'raw':![],'where':{'id':_0x2b48a7[_0x04e9('0x5d')]['id']},'include':[{'model':db['Pause'],'as':_0x04e9('0x41')}]},_0x4cb217={};_0x4cb217['model']=_[_0x04e9('0x5e')](db['FaxAccount'][_0x04e9('0x44')]);_0x4cb217[_0x04e9('0x48')]=_[_0x04e9('0x5e')](_0x2b48a7['query']);_0x4cb217[_0x04e9('0x49')]=_[_0x04e9('0x4a')](_0x4cb217[_0x04e9('0x47')],_0x4cb217[_0x04e9('0x48')]);_0x50d71c[_0x04e9('0x4b')]=_['intersection'](_0x4cb217[_0x04e9('0x47')],qs[_0x04e9('0x4c')](_0x2b48a7[_0x04e9('0x48')][_0x04e9('0x4c')]));_0x50d71c[_0x04e9('0x4b')]=_0x50d71c[_0x04e9('0x4b')]['length']?_0x50d71c[_0x04e9('0x4b')]:_0x4cb217[_0x04e9('0x47')];if(_0x2b48a7['query'][_0x04e9('0x57')]){_0x50d71c[_0x04e9('0x58')]=[{'all':!![]}];}_0x50d71c=_['merge']({},_0x50d71c,_0x2b48a7[_0x04e9('0x56')]);return db[_0x04e9('0x43')][_0x04e9('0x5f')](_0x50d71c)[_0x04e9('0x37')](handleEntityNotFound(_0x251e5b,null))[_0x04e9('0x37')](respondWithResult(_0x251e5b,null))[_0x04e9('0x5b')](handleError(_0x251e5b,null));};exports[_0x04e9('0x60')]=function(_0x224208,_0x22c003){return db[_0x04e9('0x43')]['create'](_0x224208['body'],{})['then'](function(_0xe37f55){var _0x314e64=_0x224208['user'][_0x04e9('0x39')]({'plain':!![]});if(!_0x314e64)throw new Error(_0x04e9('0x61'));if(_0x314e64[_0x04e9('0x62')]==='user'){var _0x16986b=_0xe37f55[_0x04e9('0x39')]({'plain':!![]});var _0x4c17b1=_0x04e9('0x3a');return db[_0x04e9('0x63')]['find']({'where':{'name':_0x4c17b1,'userProfileId':_0x314e64[_0x04e9('0x64')]},'raw':!![]})[_0x04e9('0x37')](function(_0x567bdc){if(_0x567bdc&&_0x567bdc[_0x04e9('0x65')]===0x0){return db[_0x04e9('0x3b')][_0x04e9('0x60')]({'name':_0x16986b[_0x04e9('0x3d')],'resourceId':_0x16986b['id'],'type':_0x567bdc[_0x04e9('0x3d')],'sectionId':_0x567bdc['id']},{})[_0x04e9('0x37')](function(){return _0xe37f55;});}else{return _0xe37f55;}})[_0x04e9('0x5b')](function(_0x1f67e4){logger['error'](_0x04e9('0x66'),_0x1f67e4);throw _0x1f67e4;});}return _0xe37f55;})['then'](respondWithResult(_0x22c003,0xc9))['catch'](handleError(_0x22c003,null));};exports[_0x04e9('0x36')]=function(_0x3b88d3,_0x392f24){if(_0x3b88d3[_0x04e9('0x67')]['id']){delete _0x3b88d3['body']['id'];}return db[_0x04e9('0x43')][_0x04e9('0x5f')]({'where':{'id':_0x3b88d3['params']['id']},'include':[{'model':db[_0x04e9('0x40')],'as':'mandatoryDispositionPause'}]})[_0x04e9('0x37')](handleEntityNotFound(_0x392f24,null))[_0x04e9('0x37')](saveUpdates(_0x3b88d3[_0x04e9('0x67')],null))[_0x04e9('0x37')](respondWithResult(_0x392f24,null))[_0x04e9('0x5b')](handleError(_0x392f24,null));};exports[_0x04e9('0x38')]=function(_0x16eb61,_0x19020d){return db['FaxAccount'][_0x04e9('0x5f')]({'where':{'id':_0x16eb61[_0x04e9('0x5d')]['id']}})['then'](handleEntityNotFound(_0x19020d,null))[_0x04e9('0x37')](removeEntity(_0x19020d,null))[_0x04e9('0x5b')](handleError(_0x19020d,null));};exports['describe']=function(_0x493ca7,_0x30438f){return db[_0x04e9('0x43')][_0x04e9('0x68')]()['then'](respondWithResult(_0x30438f,null))[_0x04e9('0x5b')](handleError(_0x30438f,null));};exports[_0x04e9('0x69')]=function(_0x1753ac,_0x394267,_0x337833){if(_0x1753ac['body']['id']){delete _0x1753ac[_0x04e9('0x67')]['id'];}return db['FaxAccount'][_0x04e9('0x5f')]({'where':{'id':_0x1753ac[_0x04e9('0x5d')]['id']}})['then'](handleEntityNotFound(_0x394267,null))[_0x04e9('0x37')](function(_0x2f97f5){if(_0x2f97f5){_0x1753ac[_0x04e9('0x67')][_0x04e9('0x6a')]=_0x2f97f5['id'];return db['Disposition'][_0x04e9('0x60')](_0x1753ac[_0x04e9('0x67')]);}})['then'](respondWithResult(_0x394267,null))['catch'](handleError(_0x394267,null));};exports[_0x04e9('0x6b')]=function(_0x339dc0,_0x445535,_0x943b34){var _0xe52ff5={'raw':![],'where':{}};var _0x4289f1={};var _0x33bcc6={'count':0x0,'rows':[]};return db[_0x04e9('0x43')][_0x04e9('0x6c')]({'where':{'id':_0x339dc0[_0x04e9('0x5d')]['id']}})['then'](handleEntityNotFound(_0x445535,null))[_0x04e9('0x37')](function(_0x54569c){if(_0x54569c){_0x4289f1[_0x04e9('0x47')]=_['keys'](db[_0x04e9('0x6d')][_0x04e9('0x44')]);_0x4289f1[_0x04e9('0x48')]=_['keys'](_0x339dc0['query']);_0x4289f1['filters']=_[_0x04e9('0x4a')](_0x4289f1[_0x04e9('0x47')],_0x4289f1[_0x04e9('0x48')]);_0xe52ff5['attributes']=_[_0x04e9('0x4a')](_0x4289f1[_0x04e9('0x47')],qs[_0x04e9('0x4c')](_0x339dc0[_0x04e9('0x48')][_0x04e9('0x4c')]));_0xe52ff5[_0x04e9('0x4b')]=_0xe52ff5[_0x04e9('0x4b')]['length']?_0xe52ff5[_0x04e9('0x4b')]:_0x4289f1[_0x04e9('0x47')];if(!_0x339dc0['query'][_0x04e9('0x4d')]('nolimit')){_0xe52ff5[_0x04e9('0x30')]=qs[_0x04e9('0x30')](_0x339dc0[_0x04e9('0x48')][_0x04e9('0x30')]);_0xe52ff5[_0x04e9('0x2e')]=qs[_0x04e9('0x2e')](_0x339dc0[_0x04e9('0x48')][_0x04e9('0x2e')]);}_0xe52ff5[_0x04e9('0x4e')]=qs[_0x04e9('0x4f')](_0x339dc0[_0x04e9('0x48')][_0x04e9('0x4f')]);_0xe52ff5[_0x04e9('0x50')]=qs[_0x04e9('0x49')](_[_0x04e9('0x51')](_0x339dc0['query'],_0x4289f1[_0x04e9('0x49')]));_0xe52ff5['where'][_0x04e9('0x6a')]=_0x54569c['id'];if(_0x339dc0[_0x04e9('0x48')][_0x04e9('0x52')]){_0xe52ff5[_0x04e9('0x50')]=_['merge'](_0xe52ff5['where'],{'$or':_[_0x04e9('0x42')](_0xe52ff5['attributes'],function(_0x2bbf41){var _0xb79f32={};_0xb79f32[_0x2bbf41]={'$like':'%'+_0x339dc0[_0x04e9('0x48')][_0x04e9('0x52')]+'%'};return _0xb79f32;})});}_0xe52ff5=_[_0x04e9('0x53')]({},_0xe52ff5,_0x339dc0['options']);return db[_0x04e9('0x6d')][_0x04e9('0x31')]({'where':_0xe52ff5[_0x04e9('0x50')]})['then'](function(_0x48b1d0){_0x33bcc6[_0x04e9('0x31')]=_0x48b1d0;if(_0x339dc0['query'][_0x04e9('0x57')]){_0xe52ff5[_0x04e9('0x58')]=[{'all':!![]}];}return db[_0x04e9('0x6d')][_0x04e9('0x59')](_0xe52ff5);})[_0x04e9('0x37')](function(_0x3a30af){_0x33bcc6[_0x04e9('0x5a')]=_0x3a30af;return _0x33bcc6;});}})['then'](respondWithFilteredResult(_0x445535,_0xe52ff5))['catch'](handleError(_0x445535,null));};exports[_0x04e9('0x6e')]=function(_0xb2b39d,_0x574f65,_0x1c86e8){return db['FaxAccount']['find']({'where':{'id':_0xb2b39d[_0x04e9('0x5d')]['id']}})[_0x04e9('0x37')](handleEntityNotFound(_0x574f65,null))[_0x04e9('0x37')](function(_0x4031da){if(_0x4031da){return _0x4031da[_0x04e9('0x6e')](_0xb2b39d[_0x04e9('0x48')][_0x04e9('0x6f')]);}})[_0x04e9('0x37')](respondWithStatusCode(_0x574f65,null))[_0x04e9('0x5b')](handleError(_0x574f65,null));};exports[_0x04e9('0x70')]=function(_0x48c2c6,_0x18f4df,_0x10ac30){if(_0x48c2c6[_0x04e9('0x67')]['id']){delete _0x48c2c6['body']['id'];}return db['FaxAccount'][_0x04e9('0x5f')]({'where':{'id':_0x48c2c6[_0x04e9('0x5d')]['id']}})[_0x04e9('0x37')](handleEntityNotFound(_0x18f4df,null))[_0x04e9('0x37')](function(_0x4776c2){if(_0x4776c2){_0x48c2c6[_0x04e9('0x67')][_0x04e9('0x6a')]=_0x4776c2['id'];return db[_0x04e9('0x71')][_0x04e9('0x60')](_0x48c2c6[_0x04e9('0x67')]);}})['then'](respondWithResult(_0x18f4df,null))[_0x04e9('0x5b')](handleError(_0x18f4df,null));};exports[_0x04e9('0x72')]=function(_0x2d14dc,_0x31610b,_0x475a80){var _0x494c6c={'raw':![],'where':{}};var _0x39e805={};var _0x546801={'count':0x0,'rows':[]};return db[_0x04e9('0x43')][_0x04e9('0x6c')]({'where':{'id':_0x2d14dc[_0x04e9('0x5d')]['id']}})[_0x04e9('0x37')](handleEntityNotFound(_0x31610b,null))[_0x04e9('0x37')](function(_0x1f0839){if(_0x1f0839){_0x39e805[_0x04e9('0x47')]=_[_0x04e9('0x5e')](db[_0x04e9('0x71')]['rawAttributes']);_0x39e805[_0x04e9('0x48')]=_[_0x04e9('0x5e')](_0x2d14dc[_0x04e9('0x48')]);_0x39e805['filters']=_[_0x04e9('0x4a')](_0x39e805['model'],_0x39e805[_0x04e9('0x48')]);_0x494c6c[_0x04e9('0x4b')]=_[_0x04e9('0x4a')](_0x39e805[_0x04e9('0x47')],qs['fields'](_0x2d14dc[_0x04e9('0x48')]['fields']));_0x494c6c[_0x04e9('0x4b')]=_0x494c6c[_0x04e9('0x4b')][_0x04e9('0x73')]?_0x494c6c['attributes']:_0x39e805[_0x04e9('0x47')];if(!_0x2d14dc[_0x04e9('0x48')]['hasOwnProperty'](_0x04e9('0x74'))){_0x494c6c[_0x04e9('0x30')]=qs['limit'](_0x2d14dc['query'][_0x04e9('0x30')]);_0x494c6c[_0x04e9('0x2e')]=qs['offset'](_0x2d14dc[_0x04e9('0x48')][_0x04e9('0x2e')]);}_0x494c6c[_0x04e9('0x4e')]=qs[_0x04e9('0x4f')](_0x2d14dc[_0x04e9('0x48')][_0x04e9('0x4f')]);_0x494c6c[_0x04e9('0x50')]=qs[_0x04e9('0x49')](_[_0x04e9('0x51')](_0x2d14dc[_0x04e9('0x48')],_0x39e805[_0x04e9('0x49')]));_0x494c6c[_0x04e9('0x50')][_0x04e9('0x6a')]=_0x1f0839['id'];if(_0x2d14dc[_0x04e9('0x48')][_0x04e9('0x52')]){_0x494c6c[_0x04e9('0x50')]=_[_0x04e9('0x53')](_0x494c6c['where'],{'$or':_['map'](_0x494c6c[_0x04e9('0x4b')],function(_0x1afc82){var _0x478661={};_0x478661[_0x1afc82]={'$like':'%'+_0x2d14dc[_0x04e9('0x48')][_0x04e9('0x52')]+'%'};return _0x478661;})});}_0x494c6c=_['merge']({},_0x494c6c,_0x2d14dc['options']);return db['CannedAnswer']['count']({'where':_0x494c6c['where']})[_0x04e9('0x37')](function(_0x66f940){_0x546801[_0x04e9('0x31')]=_0x66f940;if(_0x2d14dc[_0x04e9('0x48')][_0x04e9('0x57')]){_0x494c6c[_0x04e9('0x58')]=[{'all':!![]}];}return db[_0x04e9('0x71')][_0x04e9('0x59')](_0x494c6c);})[_0x04e9('0x37')](function(_0xd3e5c1){_0x546801[_0x04e9('0x5a')]=_0xd3e5c1;return _0x546801;});}})[_0x04e9('0x37')](respondWithFilteredResult(_0x31610b,_0x494c6c))['catch'](handleError(_0x31610b,null));};exports[_0x04e9('0x75')]=function(_0x5147c2,_0x5c4701,_0x113cbd){return db['FaxAccount'][_0x04e9('0x5f')]({'where':{'id':_0x5147c2['params']['id']}})[_0x04e9('0x37')](handleEntityNotFound(_0x5c4701,null))[_0x04e9('0x37')](function(_0x1392d5){if(_0x1392d5){return _0x1392d5['removeAnswers'](_0x5147c2['query'][_0x04e9('0x6f')]);}})[_0x04e9('0x37')](respondWithStatusCode(_0x5c4701,null))[_0x04e9('0x5b')](handleError(_0x5c4701,null));};exports[_0x04e9('0x76')]=function(_0x56f60b,_0x4b05dc,_0x4b745f){return db[_0x04e9('0x77')][_0x04e9('0x5f')]({'where':{'id':_0x56f60b[_0x04e9('0x5d')]['id']}})[_0x04e9('0x37')](handleEntityNotFound(_0x4b05dc,null))[_0x04e9('0x37')](function(_0x2a4d51){if(_0x2a4d51){return _0x2a4d51[_0x04e9('0x76')](_0x56f60b[_0x04e9('0x67')][_0x04e9('0x6f')],_['omit'](_0x56f60b['body'],['ids','id'])||{});}})[_0x04e9('0x37')](respondWithResult(_0x4b05dc,null))['catch'](handleError(_0x4b05dc,null));};exports[_0x04e9('0x78')]=function(_0x3dc24d,_0x53acd9,_0x4801bc){var _0x31b83d={'raw':![],'where':{}};var _0x2ca0b3={};var _0x1b62e9={'count':0x0,'rows':[]};return db['FaxAccount'][_0x04e9('0x6c')]({'where':{'id':_0x3dc24d[_0x04e9('0x5d')]['id']}})[_0x04e9('0x37')](handleEntityNotFound(_0x53acd9,null))[_0x04e9('0x37')](function(_0x10f5cd){if(_0x10f5cd){_0x2ca0b3[_0x04e9('0x47')]=_[_0x04e9('0x5e')](db[_0x04e9('0x77')][_0x04e9('0x44')]);_0x2ca0b3[_0x04e9('0x48')]=_[_0x04e9('0x5e')](_0x3dc24d[_0x04e9('0x48')]);_0x2ca0b3[_0x04e9('0x49')]=_[_0x04e9('0x4a')](_0x2ca0b3['model'],_0x2ca0b3[_0x04e9('0x48')]);_0x31b83d[_0x04e9('0x4b')]=_[_0x04e9('0x4a')](_0x2ca0b3[_0x04e9('0x47')],qs[_0x04e9('0x4c')](_0x3dc24d[_0x04e9('0x48')][_0x04e9('0x4c')]));_0x31b83d[_0x04e9('0x4b')]=_0x31b83d['attributes']['length']?_0x31b83d['attributes']:_0x2ca0b3[_0x04e9('0x47')];if(!_0x3dc24d[_0x04e9('0x48')][_0x04e9('0x4d')]('nolimit')){_0x31b83d[_0x04e9('0x30')]=qs['limit'](_0x3dc24d['query'][_0x04e9('0x30')]);_0x31b83d[_0x04e9('0x2e')]=qs['offset'](_0x3dc24d[_0x04e9('0x48')][_0x04e9('0x2e')]);}_0x31b83d[_0x04e9('0x4e')]=qs['sort'](_0x3dc24d[_0x04e9('0x48')][_0x04e9('0x4f')]);_0x31b83d[_0x04e9('0x50')]=qs['filters'](_[_0x04e9('0x51')](_0x3dc24d[_0x04e9('0x48')],_0x2ca0b3[_0x04e9('0x49')]));_0x31b83d[_0x04e9('0x50')][_0x04e9('0x6a')]=_0x10f5cd['id'];if(_0x3dc24d[_0x04e9('0x48')][_0x04e9('0x52')]){_0x31b83d[_0x04e9('0x50')]=_[_0x04e9('0x53')](_0x31b83d[_0x04e9('0x50')],{'$or':_[_0x04e9('0x42')](_0x31b83d[_0x04e9('0x4b')],function(_0x386e36){var _0x55789b={};_0x55789b[_0x386e36]={'$like':'%'+_0x3dc24d[_0x04e9('0x48')]['filter']+'%'};return _0x55789b;})});}_0x31b83d=_[_0x04e9('0x53')]({},_0x31b83d,_0x3dc24d[_0x04e9('0x56')]);return db[_0x04e9('0x77')][_0x04e9('0x31')]({'where':_0x31b83d[_0x04e9('0x50')]})[_0x04e9('0x37')](function(_0x300ae6){_0x1b62e9['count']=_0x300ae6;if(_0x3dc24d[_0x04e9('0x48')][_0x04e9('0x57')]){_0x31b83d[_0x04e9('0x58')]=[{'model':db[_0x04e9('0x79')],'as':'Contact','required':![]},{'model':db[_0x04e9('0x7a')],'as':_0x04e9('0x7b'),'attributes':[_0x04e9('0x3d'),_0x04e9('0x7c'),_0x04e9('0x7d')],'required':![]},{'model':db[_0x04e9('0x7e')],'as':_0x04e9('0x7f'),'attributes':['id','name',_0x04e9('0x80')],'where':_0x3dc24d[_0x04e9('0x48')]['tag']?{'id':_0x3dc24d[_0x04e9('0x48')]['tag']}:undefined,'required':_0x3dc24d[_0x04e9('0x48')][_0x04e9('0x81')]?!![]:![]}];}return db[_0x04e9('0x77')][_0x04e9('0x59')](_0x31b83d);})['then'](function(_0x2a7eed){_0x1b62e9[_0x04e9('0x5a')]=_0x2a7eed;return _0x1b62e9;});}})[_0x04e9('0x37')](respondWithFilteredResult(_0x53acd9,_0x31b83d))[_0x04e9('0x5b')](handleError(_0x53acd9,null));};exports['addApplications']=function(_0xa991f7,_0x88cb70){var _0x7b3327=_0xa991f7['params']['id'];var _0x540373=_0xa991f7[_0x04e9('0x67')];var _0x1ff2b0=0xc8;var _0xf3f1d6=null;return db[_0x04e9('0x82')][_0x04e9('0x83')]({'isolationLevel':db['sequelize']['Transaction'][_0x04e9('0x84')][_0x04e9('0x85')]},function(_0x4aa76a){return db[_0x04e9('0x43')][_0x04e9('0x6c')]({'where':{'id':_0x7b3327},'transaction':_0x4aa76a})[_0x04e9('0x37')](function(_0x199c58){if(_0x199c58){return db[_0x04e9('0x86')]['destroy']({'where':{'FaxAccountId':_0x7b3327},'transaction':_0x4aa76a})[_0x04e9('0x37')](function(){var _0x2dfed3=_['map'](_0x540373,function(_0x1e1e3c){_0x1e1e3c[_0x04e9('0x6a')]=_0x7b3327;return _0x1e1e3c;});return db[_0x04e9('0x86')][_0x04e9('0x87')](_0x2dfed3,{'transaction':_0x4aa76a});});}else{_0x1ff2b0=0x194;_0xf3f1d6=[];}});})[_0x04e9('0x37')](function(){if(_0x1ff2b0!==0x194){return db['FaxApplication'][_0x04e9('0x88')]({'where':{'FaxAccountId':_0x7b3327},'order':'priority'})[_0x04e9('0x37')](function(_0x41748b){_0xf3f1d6=_0x41748b;});}})[_0x04e9('0x5b')](function(_0xfe6a10){_0x1ff2b0=0x1f4;logger['error'](_0xfe6a10[_0x04e9('0x3c')]);if(_0xfe6a10['name']){delete _0xfe6a10[_0x04e9('0x3d')];}_0xf3f1d6=_0xfe6a10;})['finally'](function(){if(_0xf3f1d6===null){_0x88cb70['sendStatus'](_0x1ff2b0);}else{if(_0x1ff2b0===0x1f4){_0x88cb70[_0x04e9('0x2b')](_0x1ff2b0)[_0x04e9('0x3e')](_0xf3f1d6);}else{_0x88cb70[_0x04e9('0x2b')](_0x1ff2b0)['json'](_0xf3f1d6);}}});};exports[_0x04e9('0x89')]=function(_0xde11a3,_0x346eae,_0x21028a){var _0x1509a9={};var _0x2e973d={};var _0x5c8029;var _0x476a12;return db['FaxAccount'][_0x04e9('0x6c')]({'where':{'id':_0xde11a3[_0x04e9('0x5d')]['id']}})[_0x04e9('0x37')](handleEntityNotFound(_0x346eae,null))[_0x04e9('0x37')](function(_0x2fd500){if(_0x2fd500){_0x5c8029=_0x2fd500;_0x2e973d[_0x04e9('0x47')]=_[_0x04e9('0x5e')](db[_0x04e9('0x86')][_0x04e9('0x44')]);_0x2e973d[_0x04e9('0x48')]=_[_0x04e9('0x5e')](_0xde11a3[_0x04e9('0x48')]);_0x2e973d['filters']=_[_0x04e9('0x4a')](_0x2e973d[_0x04e9('0x47')],_0x2e973d[_0x04e9('0x48')]);_0x1509a9['attributes']=_['intersection'](_0x2e973d[_0x04e9('0x47')],qs['fields'](_0xde11a3[_0x04e9('0x48')][_0x04e9('0x4c')]));_0x1509a9[_0x04e9('0x4b')]=_0x1509a9['attributes']['length']?_0x1509a9[_0x04e9('0x4b')]:_0x2e973d[_0x04e9('0x47')];_0x1509a9['order']=qs[_0x04e9('0x4f')](_0xde11a3[_0x04e9('0x48')][_0x04e9('0x4f')]);_0x1509a9[_0x04e9('0x50')]=qs['filters'](_[_0x04e9('0x51')](_0xde11a3['query'],_0x2e973d[_0x04e9('0x49')]));if(_0xde11a3[_0x04e9('0x48')][_0x04e9('0x52')]){_0x1509a9[_0x04e9('0x50')]=_[_0x04e9('0x53')](_0x1509a9[_0x04e9('0x50')],{'$or':_[_0x04e9('0x42')](_0x1509a9[_0x04e9('0x4b')],function(_0x61e971){var _0x184ea6={};_0x184ea6[_0x61e971]={'$like':'%'+_0xde11a3['query']['filter']+'%'};return _0x184ea6;})});}_0x1509a9=_['merge']({},_0x1509a9,_0xde11a3[_0x04e9('0x56')]);return _0x5c8029[_0x04e9('0x89')](_0x1509a9);}})[_0x04e9('0x37')](function(_0x4e1d0b){if(_0x4e1d0b){_0x476a12=_0x4e1d0b[_0x04e9('0x73')];if(!_0xde11a3['query'][_0x04e9('0x4d')]('nolimit')){_0x1509a9[_0x04e9('0x30')]=qs[_0x04e9('0x30')](_0xde11a3[_0x04e9('0x48')][_0x04e9('0x30')]);_0x1509a9['offset']=qs['offset'](_0xde11a3[_0x04e9('0x48')][_0x04e9('0x2e')]);}return _0x5c8029[_0x04e9('0x89')](_0x1509a9);}})[_0x04e9('0x37')](function(_0x26a307){if(_0x26a307){return _0x26a307?{'count':_0x476a12,'rows':_0x26a307}:null;}})[_0x04e9('0x37')](respondWithResult(_0x346eae,null))[_0x04e9('0x5b')](handleError(_0x346eae,null));};function Extension(_0x5a313e,_0x21f752,_0x3fd58a,_0x5198d0){this['context']='from-voip-provider';this['exten']=_0x5a313e[_0x04e9('0x8a')];this[_0x04e9('0x8b')]=_0x5198d0;this[_0x04e9('0x54')]=_0x04e9('0x8c');this[_0x04e9('0x8d')]=_0x04e9('0x8e');this[_0x04e9('0x6a')]=_0x5a313e['id'];this[_0x04e9('0x8f')]=_0x21f752;this['appdata']=_0x3fd58a;}function createExtensionsReciveFax(_0x203f6a){var _0x8772ec=0x1;var _0x4b3cd1=[];_0x4b3cd1[_0x04e9('0x90')](new Extension(_0x203f6a,_0x8772ec,'',_0x04e9('0x91')));_0x8772ec+=0x1;_0x4b3cd1[_0x04e9('0x90')](new Extension(_0x203f6a,_0x8772ec,_0x04e9('0x92'),_0x04e9('0x93')));_0x8772ec+=0x1;for(var _0x374a6b in _0x203f6a){if(_0x203f6a[_0x04e9('0x4d')](_0x374a6b)&&(_0x374a6b==='ecm'||_0x374a6b==='localstationid'||_0x374a6b==='gateway'||_0x374a6b===_0x04e9('0x94')||_0x374a6b==='headerinfo'||_0x374a6b===_0x04e9('0x95')||_0x374a6b===_0x04e9('0x96')||_0x374a6b===_0x04e9('0x97')||_0x374a6b==='t38timeout')){_0x4b3cd1[_0x04e9('0x90')](new Extension(_0x203f6a,_0x8772ec,_0x04e9('0x98')+_0x374a6b+')='+_0x203f6a[_0x374a6b],_0x04e9('0x93')));_0x8772ec+=0x1;}}_0x4b3cd1[_0x04e9('0x90')](new Extension(_0x203f6a,_0x8772ec,'6',_0x04e9('0x99')));_0x8772ec+=0x1;_0x4b3cd1[_0x04e9('0x90')](new Extension(_0x203f6a,_0x8772ec,_0x04e9('0x9a'),'ReceiveFax'));_0x8772ec=0x0;return _0x4b3cd1;}exports[_0x04e9('0x9b')]=function(_0x27cefc,_0x1798cf,_0x25b60d){var _0x581c60;return db[_0x04e9('0x82')]['transaction'](function(_0x122990){return db[_0x04e9('0x43')]['create'](_0x27cefc[_0x04e9('0x67')],{'transaction':_0x122990})[_0x04e9('0x37')](function(_0x577cfb){_0x581c60=_0x577cfb[_0x04e9('0x39')]({'plain':!![]});return db['VoiceExtension'][_0x04e9('0x87')](createExtensionsReciveFax(_0x581c60),{'transaction':_0x122990});});})['then'](function(){return _0x581c60;})[_0x04e9('0x37')](respondWithResult(_0x1798cf,null))[_0x04e9('0x5b')](handleError(_0x1798cf,null));};exports[_0x04e9('0x9c')]=function(_0x5e36d2,_0x706f62,_0x11cb15){var _0x40eb3e;return db[_0x04e9('0x82')][_0x04e9('0x83')](function(_0x152e96){return db[_0x04e9('0x43')][_0x04e9('0x36')](_0x5e36d2[_0x04e9('0x67')],{'where':{'id':_0x5e36d2[_0x04e9('0x67')]['id']},'transaction':_0x152e96})['then'](function(_0x3a69d4){return db[_0x04e9('0x9d')][_0x04e9('0x38')]({'where':{'FaxAccountId':_0x5e36d2[_0x04e9('0x67')]['id']},'transaction':_0x152e96})[_0x04e9('0x37')](function(_0x256da4){return db[_0x04e9('0x9d')][_0x04e9('0x87')](createExtensionsReciveFax(_[_0x04e9('0x9e')](_0x5e36d2['body'],[_0x04e9('0x9f'),_0x04e9('0x46'),_0x04e9('0xa0'),'updatedAt',_0x04e9('0xa1'),_0x04e9('0xa2')])),{'transaction':_0x152e96});});});})[_0x04e9('0x37')](function(){return db[_0x04e9('0x43')]['findById'](_0x5e36d2[_0x04e9('0x67')]['id']);})[_0x04e9('0x37')](respondWithResult(_0x706f62,null))[_0x04e9('0x5b')](handleError(_0x706f62,null));};exports['getMessages']=function(_0x5840b2,_0x536edc,_0x238a30){var _0x368585={'raw':!![],'where':{}};var _0x458f91={};var _0x596272={'count':0x0,'rows':[]};return db[_0x04e9('0x43')][_0x04e9('0x6c')]({'where':{'id':_0x5840b2[_0x04e9('0x5d')]['id']}})[_0x04e9('0x37')](handleEntityNotFound(_0x536edc,null))['then'](function(_0x33d7f8){if(_0x33d7f8){_0x458f91[_0x04e9('0x47')]=_[_0x04e9('0x5e')](db[_0x04e9('0xa3')][_0x04e9('0x44')]);_0x458f91[_0x04e9('0x48')]=_[_0x04e9('0x5e')](_0x5840b2[_0x04e9('0x48')]);_0x458f91[_0x04e9('0x49')]=_['intersection'](_0x458f91['model'],_0x458f91['query']);_0x368585[_0x04e9('0x4b')]=_[_0x04e9('0x4a')](_0x458f91['model'],qs[_0x04e9('0x4c')](_0x5840b2['query'][_0x04e9('0x4c')]));_0x368585[_0x04e9('0x4b')]=_0x368585[_0x04e9('0x4b')][_0x04e9('0x73')]?_0x368585['attributes']:_0x458f91[_0x04e9('0x47')];if(!_0x5840b2[_0x04e9('0x48')][_0x04e9('0x4d')](_0x04e9('0x74'))){_0x368585[_0x04e9('0x30')]=qs[_0x04e9('0x30')](_0x5840b2[_0x04e9('0x48')][_0x04e9('0x30')]);_0x368585['offset']=qs['offset'](_0x5840b2[_0x04e9('0x48')][_0x04e9('0x2e')]);}_0x368585[_0x04e9('0x4e')]=qs[_0x04e9('0x4f')](_0x5840b2[_0x04e9('0x48')][_0x04e9('0x4f')]);_0x368585[_0x04e9('0x50')]=qs['filters'](_[_0x04e9('0x51')](_0x5840b2[_0x04e9('0x48')],_0x458f91[_0x04e9('0x49')]));_0x368585['where']['FaxAccountId']=_0x33d7f8['id'];if(_0x5840b2[_0x04e9('0x48')]['filter']){_0x368585[_0x04e9('0x50')]=_['merge'](_0x368585[_0x04e9('0x50')],{'$or':_['map'](_0x368585[_0x04e9('0x4b')],function(_0x401953){var _0x3f2b14={};_0x3f2b14[_0x401953]={'$like':'%'+_0x5840b2[_0x04e9('0x48')][_0x04e9('0x52')]+'%'};return _0x3f2b14;})});}if(_0x5840b2['query'][_0x04e9('0xa4')]){var _0xbdc757=_0x5840b2[_0x04e9('0x48')][_0x04e9('0xa4')][_0x04e9('0xa5')](',');var _0x2e9419={};_0x2e9419[_0xbdc757[0x0]]={'$gte':moment(_0xbdc757[0x1])[_0x04e9('0xa6')](_0x04e9('0xa7'))};_0x368585['where']=_['merge'](_0x368585['where'],_0x2e9419);}_0x368585=_['merge']({},_0x368585,_0x5840b2[_0x04e9('0x56')]);return db['FaxMessage']['count']({'where':_0x368585[_0x04e9('0x50')]})[_0x04e9('0x37')](function(_0xba2624){_0x596272[_0x04e9('0x31')]=_0xba2624;if(_0x5840b2['query'][_0x04e9('0x57')]){_0x368585[_0x04e9('0x58')]=[{'all':!![]}];}return db[_0x04e9('0xa3')][_0x04e9('0x59')](_0x368585);})[_0x04e9('0x37')](function(_0x379b8a){_0x596272['rows']=_0x379b8a;return _0x596272;});}})[_0x04e9('0x37')](respondWithFilteredResult(_0x536edc,_0x368585))[_0x04e9('0x5b')](handleError(_0x536edc,null));};exports[_0x04e9('0x3e')]=function(_0xf1a95d,_0x3b3bb,_0x3294f7){var _0x4b7635,_0x24aac6={},_0x48e9e0;if(_0xf1a95d[_0x04e9('0x67')]['to']){_0x48e9e0=_0xf1a95d[_0x04e9('0x67')]['to'][0x0];}return db[_0x04e9('0x43')]['find']({'where':{'id':_0xf1a95d[_0x04e9('0x5d')]['id']},'include':[{'model':db[_0x04e9('0xa8')],'as':_0x04e9('0xa9'),'include':[{'model':db[_0x04e9('0x79')],'as':_0x04e9('0xaa'),'where':{'fax':_0x48e9e0},'limit':0x1,'order':[[_0x04e9('0xab'),'DESC']]}]}]})[_0x04e9('0x37')](handleEntityNotFound(_0x3b3bb,null))[_0x04e9('0x37')](function(_0x4b1f85){_0x4b7635=_0x4b1f85;if(_0xf1a95d[_0x04e9('0x67')][_0x04e9('0xac')]&&_0xf1a95d[_0x04e9('0x67')][_0x04e9('0xac')]['length']){for(var _0x275735=0x0;_0x275735<_0xf1a95d['body']['attachments'][_0x04e9('0x73')];_0x275735+=0x1){_0xf1a95d['body'][_0x04e9('0xac')][_0x275735]={'filename':_0xf1a95d[_0x04e9('0x67')][_0x04e9('0xac')][_0x275735][_0x04e9('0x3d')],'id':_0xf1a95d[_0x04e9('0x67')][_0x04e9('0xac')][_0x275735]['id'],'path':path[_0x04e9('0xad')](config[_0x04e9('0xae')],_0x04e9('0xaf'),_0xf1a95d['body'][_0x04e9('0xac')][_0x275735][_0x04e9('0xb0')])};}}return respondWithRpcPromise(_0x04e9('0xb1'),_0x04e9('0xb1'),{'FaxAccountId':_['isNil'](_0xf1a95d[_0x04e9('0x5d')]['id'])?undefined:_0xf1a95d[_0x04e9('0x5d')]['id'],'path':_[_0x04e9('0xb2')](_0xf1a95d[_0x04e9('0x67')][_0x04e9('0xac')][0x0]['path'])?undefined:_0xf1a95d['body'][_0x04e9('0xac')][0x0][_0x04e9('0x6')],'fax':_[_0x04e9('0xb2')](_0xf1a95d[_0x04e9('0x67')]['to'][0x0])?undefined:_0xf1a95d['body']['to'][0x0]},client9002);})['then'](function(){if(_0x4b7635){if(_[_0x04e9('0xb2')](_0xf1a95d[_0x04e9('0x67')][_0x04e9('0xb3')])){_0xf1a95d['body']['from']=util[_0x04e9('0xa6')](_0x04e9('0xb4'),_0x4b7635[_0x04e9('0x3d')],_0x4b7635[_0x04e9('0xb5')]);}if(_0x4b7635[_0x04e9('0xa9')]){if(_0x4b7635[_0x04e9('0xa9')]['Contacts'][_0x04e9('0x73')]){return _0x4b7635[_0x04e9('0xa9')]['Contacts'][0x0];}else{return db[_0x04e9('0x79')]['create'](_[_0x04e9('0x19')](_0xf1a95d[_0x04e9('0x67')],{'firstName':_0xf1a95d['body']['to'][0x0],'phone':_0xf1a95d[_0x04e9('0x67')]['to'][0x0],'fax':_0xf1a95d['body']['to'][0x0],'ListId':_0x4b7635['ListId']}));}}else{throw new Error(_0x04e9('0xb6'));}}else{throw new Error(_0x04e9('0xb7'));}})['then'](function(_0x44c623){if(_0x44c623){return db[_0x04e9('0x77')][_0x04e9('0x5f')]({'where':{'ContactId':_0x44c623['id'],'closed':![],'FaxAccountId':_0x4b7635['id']}})[_0x04e9('0x37')](function(_0x3deca9){if(_0x3deca9){return[_0x3deca9,![]];}return db[_0x04e9('0x77')][_0x04e9('0x60')]({'UserId':_0xf1a95d[_0x04e9('0xb8')]['id'],'ContactId':_0x44c623['id'],'FaxAccountId':_0x4b7635['id'],'fax':_0xf1a95d[_0x04e9('0x67')]['to'][0x0],'firstMsgDirection':_0x04e9('0xb9'),'Messages':[_[_0x04e9('0x53')](_0xf1a95d[_0x04e9('0x67')],{'read':![],'body':_0xf1a95d['body']['attachments'][0x0][_0x04e9('0xba')],'FaxAccountId':_0x4b7635['id'],'UserId':_0xf1a95d['user']['id'],'ContactId':_0x44c623['id'],'AttachmentId':_0xf1a95d['body'][_0x04e9('0xac')][0x0]['id']})]},{'include':[{'model':db['FaxMessage'],'as':'Messages'}]})[_0x04e9('0x37')](function(_0x2a3505){return[_0x2a3505,!![]];});});}else{throw new Error(_0x04e9('0xbb'));}})[_0x04e9('0xbc')](function(_0x982726,_0x28d8b3){if(_0x28d8b3){return _0x982726;}return db[_0x04e9('0xa3')][_0x04e9('0x60')]({'direction':_0x04e9('0xb9'),'read':![],'body':_0xf1a95d[_0x04e9('0x67')][_0x04e9('0xac')][0x0][_0x04e9('0xba')],'FaxAccountId':_0x4b7635['id'],'FaxInteractionId':_0x982726['id'],'UserId':_0xf1a95d[_0x04e9('0xb8')]['id'],'ContactId':_0x982726['ContactId'],'AttachmentId':_0xf1a95d['body'][_0x04e9('0xac')][0x0]['id']})[_0x04e9('0x37')](function(_0x5c1474){_0x982726[_0x04e9('0xbd')][_0x04e9('0xbe')]=[];_0x982726[_0x04e9('0xbd')][_0x04e9('0xbe')][_0x04e9('0x90')](_0x5c1474['dataValues']);return _0x982726;});})['then'](function(_0x3e9637){respondWithRpcPromise(_0x04e9('0xbf'),'SendFax',{'FaxAccountId':_[_0x04e9('0xb2')](_0xf1a95d[_0x04e9('0x5d')]['id'])?undefined:_0xf1a95d[_0x04e9('0x5d')]['id'],'path':_[_0x04e9('0xb2')](_0xf1a95d[_0x04e9('0x67')][_0x04e9('0xac')][0x0]['path'])?undefined:_0xf1a95d[_0x04e9('0x67')][_0x04e9('0xac')][0x0][_0x04e9('0x6')],'fax':_[_0x04e9('0xb2')](_0xf1a95d[_0x04e9('0x67')]['to'][0x0])?undefined:_0xf1a95d[_0x04e9('0x67')]['to'][0x0],'AttachmentId':_0xf1a95d[_0x04e9('0x67')][_0x04e9('0xac')][0x0]['id']},client9002)[_0x04e9('0x37')](function(_0xffbfa0){logger[_0x04e9('0x20')](_0x04e9('0xc0'),_0xffbfa0);})['catch'](function(_0x442809){logger[_0x04e9('0x20')](_0x04e9('0xc0'),_0x442809);});return _0x3e9637;})[_0x04e9('0x37')](respondWithResult(_0x3b3bb,null))['catch'](handleError(_0x3b3bb,null));};exports[_0x04e9('0xc1')]=function(_0x38bc80,_0x441f35,_0x13f2ec){return db[_0x04e9('0x43')][_0x04e9('0x5f')]({'where':{'id':_0x38bc80[_0x04e9('0x5d')]['id']}})[_0x04e9('0x37')](handleEntityNotFound(_0x441f35,null))[_0x04e9('0x37')](function(_0x3f76d5){if(_0x3f76d5){return _0x3f76d5[_0x04e9('0xc1')](_0x38bc80['body'][_0x04e9('0x6f')],_[_0x04e9('0x9e')](_0x38bc80[_0x04e9('0x67')],['ids','id'])||{})[_0x04e9('0xbc')](function(_0x7a52b5){for(var _0x1b39f7=0x0;_0x1b39f7<_0x38bc80[_0x04e9('0x67')]['ids'][_0x04e9('0x73')];_0x1b39f7+=0x1){socket[_0x04e9('0xc2')]('userFaxAccount:save',{'UserId':Number(_0x38bc80[_0x04e9('0x67')]['ids'][_0x1b39f7]),'FaxAccountId':Number(_0x38bc80[_0x04e9('0x5d')]['id'])});}return _0x7a52b5;});}})[_0x04e9('0x37')](respondWithResult(_0x441f35,null))['catch'](handleError(_0x441f35,null));};exports['removeAgents']=function(_0x4cae9a,_0x16871c,_0x308490){return db[_0x04e9('0x43')][_0x04e9('0x5f')]({'where':{'id':_0x4cae9a[_0x04e9('0x5d')]['id']}})[_0x04e9('0x37')](handleEntityNotFound(_0x16871c,null))['then'](function(_0x1c4955){if(_0x1c4955){return _0x1c4955[_0x04e9('0xc3')](_0x4cae9a[_0x04e9('0x48')][_0x04e9('0x6f')])['then'](function(){if(_[_0x04e9('0xc4')](_0x4cae9a[_0x04e9('0x48')][_0x04e9('0x6f')])){for(var _0x3addb3=0x0;_0x3addb3<_0x4cae9a['query']['ids'][_0x04e9('0x73')];_0x3addb3+=0x1){socket[_0x04e9('0xc2')](_0x04e9('0xc5'),{'UserId':Number(_0x4cae9a[_0x04e9('0x48')][_0x04e9('0x6f')][_0x3addb3]),'FaxAccountId':Number(_0x4cae9a['params']['id'])});}}else{socket[_0x04e9('0xc2')](_0x04e9('0xc5'),{'UserId':Number(_0x4cae9a[_0x04e9('0x48')][_0x04e9('0x6f')]),'FaxAccountId':Number(_0x4cae9a[_0x04e9('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x16871c,null))[_0x04e9('0x5b')](handleError(_0x16871c,null));};exports['getAgents']=function(_0x2efe8d,_0x90d6ae,_0x3446ee){var _0x39ca3e={};var _0x1b8e01={};var _0x104c24;var _0x1d602d;return db[_0x04e9('0x43')][_0x04e9('0x6c')]({'where':{'id':_0x2efe8d[_0x04e9('0x5d')]['id']}})['then'](handleEntityNotFound(_0x90d6ae,null))['then'](function(_0x5f27c5){if(_0x5f27c5){_0x104c24=_0x5f27c5;_0x1b8e01[_0x04e9('0x47')]=_[_0x04e9('0x5e')](db[_0x04e9('0x7a')][_0x04e9('0x44')]);_0x1b8e01[_0x04e9('0x48')]=_['keys'](_0x2efe8d[_0x04e9('0x48')]);_0x1b8e01[_0x04e9('0x49')]=_[_0x04e9('0x4a')](_0x1b8e01[_0x04e9('0x47')],_0x1b8e01[_0x04e9('0x48')]);_0x39ca3e['attributes']=_[_0x04e9('0x4a')](_0x1b8e01['model'],qs[_0x04e9('0x4c')](_0x2efe8d[_0x04e9('0x48')][_0x04e9('0x4c')]));_0x39ca3e[_0x04e9('0x4b')]=_0x39ca3e[_0x04e9('0x4b')]['length']?_0x39ca3e[_0x04e9('0x4b')]:_0x1b8e01['model'];_0x39ca3e[_0x04e9('0x4e')]=qs[_0x04e9('0x4f')](_0x2efe8d['query'][_0x04e9('0x4f')]);_0x39ca3e['where']=qs['filters'](_[_0x04e9('0x51')](_0x2efe8d[_0x04e9('0x48')],_0x1b8e01['filters']));if(_0x2efe8d[_0x04e9('0x48')]['filter']){_0x39ca3e[_0x04e9('0x50')]=_['merge'](_0x39ca3e[_0x04e9('0x50')],{'$or':_[_0x04e9('0x42')](_0x39ca3e[_0x04e9('0x4b')],function(_0x55d1a0){var _0x4c0f4e={};_0x4c0f4e[_0x55d1a0]={'$like':'%'+_0x2efe8d[_0x04e9('0x48')][_0x04e9('0x52')]+'%'};return _0x4c0f4e;})});}_0x39ca3e=_['merge']({},_0x39ca3e,_0x2efe8d[_0x04e9('0x56')]);return _0x104c24['getAgents'](_0x39ca3e);}})[_0x04e9('0x37')](function(_0x30b2f1){if(_0x30b2f1){_0x1d602d=_0x30b2f1[_0x04e9('0x73')];if(!_0x2efe8d['query'][_0x04e9('0x4d')](_0x04e9('0x74'))){_0x39ca3e[_0x04e9('0x30')]=qs[_0x04e9('0x30')](_0x2efe8d[_0x04e9('0x48')][_0x04e9('0x30')]);_0x39ca3e[_0x04e9('0x2e')]=qs['offset'](_0x2efe8d['query'][_0x04e9('0x2e')]);}return _0x104c24[_0x04e9('0xc6')](_0x39ca3e);}})['then'](function(_0x2bc67f){if(_0x2bc67f){return _0x2bc67f?{'count':_0x1d602d,'rows':_0x2bc67f}:null;}})[_0x04e9('0x37')](respondWithResult(_0x90d6ae,null))[_0x04e9('0x5b')](handleError(_0x90d6ae,null));}; \ No newline at end of file +var _0xd8a4=['server/files/attachments','CheckAfterSend','isNil','from','fax','Contacts','defaults','List\x20not\x20found','Send\x20Fax\x20failed','out','filename','ContactId','dataValues','Messages','SendFax','SendFaxRpc,\x20%s','info','addAgents','spread','emit','removeAgents','isArray','userFaxAccount:remove','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','register','jayson/promise','request','then','request\x20sent','debug','FaxAccount,\x20%s,\x20%s,\x20%s','error','code','FaxAccount,\x20%s,\x20%s','message','result','catch','end','status','json','offset','undefined','limit','count','set','apply','save','update','destroy','get','FaxAccounts','UserProfileResource','sendStatus','stack','name','send','index','Pause','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','FaxAccount','includeAll','include','findAll','rows','show','params','options','find','create','body','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','FaxAccountId','Disposition','findOne','order','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','addInteraction','FaxInteraction','omit','getInteractions','CmContact','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addApplications','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','FaxApplication','bulkCreate','priority','finally','getApplications','context','exten','localstationid','app','Fax\x20Extension','appdata','push','Answer','CDR(type)=inbound-fax','Set','ecm','gateway','faxdetect','headerinfo','maxrate','minrate','modem','t38timeout','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','transaction','createdAt','ListId','getMessages','FaxMessage','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','CmList','List','updatedAt','attachments','join','root'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0xd8a4,0xde));var _0x4d8a=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xd8a4[_0x47b58b];return _0x46bebe;};'use strict';var emlformat=require(_0x4d8a('0x0'));var rimraf=require(_0x4d8a('0x1'));var zipdir=require(_0x4d8a('0x2'));var jsonpatch=require(_0x4d8a('0x3'));var rp=require(_0x4d8a('0x4'));var moment=require(_0x4d8a('0x5'));var BPromise=require(_0x4d8a('0x6'));var Mustache=require(_0x4d8a('0x7'));var util=require(_0x4d8a('0x8'));var path=require(_0x4d8a('0x9'));var sox=require(_0x4d8a('0xa'));var csv=require(_0x4d8a('0xb'));var ejs=require(_0x4d8a('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d8a('0xd'));var squel=require(_0x4d8a('0xe'));var crypto=require(_0x4d8a('0xf'));var jsforce=require(_0x4d8a('0x10'));var deskjs=require(_0x4d8a('0x11'));var toCsv=require(_0x4d8a('0xb'));var querystring=require(_0x4d8a('0x12'));var Papa=require(_0x4d8a('0x13'));var Redis=require(_0x4d8a('0x14'));var authService=require(_0x4d8a('0x15'));var qs=require(_0x4d8a('0x16'));var as=require(_0x4d8a('0x17'));var hardwareService=require(_0x4d8a('0x18'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x4d8a('0x19'));var licenseUtil=require(_0x4d8a('0x1a'));var db=require(_0x4d8a('0x1b'))['db'];config[_0x4d8a('0x1c')]=_['defaults'](config[_0x4d8a('0x1c')],{'host':_0x4d8a('0x1d'),'port':0x18eb});var socket=require(_0x4d8a('0x1e'))(new Redis(config[_0x4d8a('0x1c')]));require('./faxAccount.socket')[_0x4d8a('0x1f')](socket);var jayson=require(_0x4d8a('0x20'));var client=jayson['client']['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x5b44bb,_0x3bb25b,_0x26b4b1,_0x4c481f){return new BPromise(function(_0x35a92d,_0x583bda){var _0x1956ca=_0x4c481f||client;return _0x1956ca[_0x4d8a('0x21')](_0x5b44bb,_0x26b4b1)[_0x4d8a('0x22')](function(_0x220ef9){logger['info']('FaxAccount,\x20%s,\x20%s',_0x3bb25b,_0x4d8a('0x23'));logger[_0x4d8a('0x24')](_0x4d8a('0x25'),_0x3bb25b,_0x4d8a('0x23'),JSON['stringify'](_0x220ef9));if(_0x220ef9[_0x4d8a('0x26')]){if(_0x220ef9['error'][_0x4d8a('0x27')]===0x1f4){logger['error'](_0x4d8a('0x28'),_0x3bb25b,_0x220ef9[_0x4d8a('0x26')][_0x4d8a('0x29')]);return _0x583bda(_0x220ef9['error'][_0x4d8a('0x29')]);}logger[_0x4d8a('0x26')]('FaxAccount,\x20%s,\x20%s',_0x3bb25b,_0x220ef9[_0x4d8a('0x26')]['message']);return _0x35a92d(_0x220ef9[_0x4d8a('0x26')][_0x4d8a('0x29')]);}else{logger['info'](_0x4d8a('0x28'),_0x3bb25b,_0x4d8a('0x23'));_0x35a92d(_0x220ef9[_0x4d8a('0x2a')][_0x4d8a('0x29')]);}})[_0x4d8a('0x2b')](function(_0x590896){logger[_0x4d8a('0x26')](_0x4d8a('0x28'),_0x3bb25b,_0x590896);_0x583bda(_0x590896);});});}function respondWithStatusCode(_0x24d7b5,_0x5e0dc3){_0x5e0dc3=_0x5e0dc3||0xcc;return function(_0x1831a3){if(_0x1831a3){return _0x24d7b5['sendStatus'](_0x5e0dc3);}return _0x24d7b5['status'](_0x5e0dc3)[_0x4d8a('0x2c')]();};}function respondWithResult(_0x281b0a,_0x35c398){_0x35c398=_0x35c398||0xc8;return function(_0x40accd){if(_0x40accd){return _0x281b0a[_0x4d8a('0x2d')](_0x35c398)[_0x4d8a('0x2e')](_0x40accd);}};}function respondWithFilteredResult(_0x12d391,_0x128856){return function(_0x583d5c){if(_0x583d5c){var _0x3eb359=typeof _0x128856[_0x4d8a('0x2f')]===_0x4d8a('0x30')&&typeof _0x128856[_0x4d8a('0x31')]===_0x4d8a('0x30');var _0x57f3ba=_0x583d5c[_0x4d8a('0x32')];var _0x21a281=_0x3eb359?0x0:_0x128856[_0x4d8a('0x2f')];var _0x1bc3eb=_0x3eb359?_0x583d5c[_0x4d8a('0x32')]:_0x128856['offset']+_0x128856[_0x4d8a('0x31')];var _0x854c02;if(_0x1bc3eb>=_0x57f3ba){_0x1bc3eb=_0x57f3ba;_0x854c02=0xc8;}else{_0x854c02=0xce;}_0x12d391[_0x4d8a('0x2d')](_0x854c02);return _0x12d391[_0x4d8a('0x33')]('Content-Range',_0x21a281+'-'+_0x1bc3eb+'/'+_0x57f3ba)['json'](_0x583d5c);}return null;};}function patchUpdates(_0x40edcf){return function(_0x24bdf2){try{jsonpatch[_0x4d8a('0x34')](_0x24bdf2,_0x40edcf,!![]);}catch(_0x58bd6b){return BPromise['reject'](_0x58bd6b);}return _0x24bdf2[_0x4d8a('0x35')]();};}function saveUpdates(_0x2ca804,_0x524862){return function(_0x4b330a){if(_0x4b330a){return _0x4b330a[_0x4d8a('0x36')](_0x2ca804)['then'](function(_0x25365d){return _0x25365d;});}return null;};}function removeEntity(_0x142546,_0x52d875){return function(_0x290e87){if(_0x290e87){return _0x290e87[_0x4d8a('0x37')]()[_0x4d8a('0x22')](function(){var _0x3e4c0e=_0x290e87[_0x4d8a('0x38')]({'plain':!![]});var _0x5c2685=_0x4d8a('0x39');return db[_0x4d8a('0x3a')][_0x4d8a('0x37')]({'where':{'type':_0x5c2685,'resourceId':_0x3e4c0e['id']}})['then'](function(){return _0x290e87;});})[_0x4d8a('0x22')](function(){_0x142546['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b6327,_0x4d71fc){return function(_0x5763eb){if(!_0x5763eb){_0x2b6327[_0x4d8a('0x3b')](0x194);}return _0x5763eb;};}function handleError(_0x2663e2,_0x3c894f){_0x3c894f=_0x3c894f||0x1f4;return function(_0x46e708){logger[_0x4d8a('0x26')](_0x46e708[_0x4d8a('0x3c')]);if(_0x46e708[_0x4d8a('0x3d')]){delete _0x46e708[_0x4d8a('0x3d')];}_0x2663e2[_0x4d8a('0x2d')](_0x3c894f)[_0x4d8a('0x3e')](_0x46e708);};}exports[_0x4d8a('0x3f')]=function(_0x55a936,_0x1eb238){var _0x5a56c8={'include':[{'model':db[_0x4d8a('0x40')],'as':_0x4d8a('0x41')}]},_0x38e6f6={},_0x189cf0={'count':0x0,'rows':[]};var _0x2fb254=_[_0x4d8a('0x42')](db['FaxAccount'][_0x4d8a('0x43')],function(_0x541279){return{'name':_0x541279[_0x4d8a('0x44')],'type':_0x541279[_0x4d8a('0x45')]['key']};});_0x38e6f6[_0x4d8a('0x46')]=_[_0x4d8a('0x42')](_0x2fb254,_0x4d8a('0x3d'));_0x38e6f6[_0x4d8a('0x47')]=_[_0x4d8a('0x48')](_0x55a936[_0x4d8a('0x47')]);_0x38e6f6[_0x4d8a('0x49')]=_[_0x4d8a('0x4a')](_0x38e6f6['model'],_0x38e6f6[_0x4d8a('0x47')]);_0x5a56c8['attributes']=_['intersection'](_0x38e6f6[_0x4d8a('0x46')],qs[_0x4d8a('0x4b')](_0x55a936['query'][_0x4d8a('0x4b')]));_0x5a56c8[_0x4d8a('0x4c')]=_0x5a56c8[_0x4d8a('0x4c')][_0x4d8a('0x4d')]?_0x5a56c8[_0x4d8a('0x4c')]:_0x38e6f6[_0x4d8a('0x46')];if(!_0x55a936['query'][_0x4d8a('0x4e')](_0x4d8a('0x4f'))){_0x5a56c8[_0x4d8a('0x31')]=qs[_0x4d8a('0x31')](_0x55a936[_0x4d8a('0x47')]['limit']);_0x5a56c8[_0x4d8a('0x2f')]=qs[_0x4d8a('0x2f')](_0x55a936['query'][_0x4d8a('0x2f')]);}_0x5a56c8['order']=qs[_0x4d8a('0x50')](_0x55a936[_0x4d8a('0x47')][_0x4d8a('0x50')]);_0x5a56c8[_0x4d8a('0x51')]=qs[_0x4d8a('0x49')](_[_0x4d8a('0x52')](_0x55a936['query'],_0x38e6f6[_0x4d8a('0x49')]),_0x2fb254);if(_0x55a936[_0x4d8a('0x47')][_0x4d8a('0x53')]){_0x5a56c8[_0x4d8a('0x51')]=_[_0x4d8a('0x54')](_0x5a56c8[_0x4d8a('0x51')],{'$or':_[_0x4d8a('0x42')](_0x2fb254,function(_0x4a96c3){if(_0x4a96c3[_0x4d8a('0x45')]!=='VIRTUAL'){var _0x40dd66={};_0x40dd66[_0x4a96c3[_0x4d8a('0x3d')]]={'$like':'%'+_0x55a936['query'][_0x4d8a('0x53')]+'%'};return _0x40dd66;}})});}_0x5a56c8=_[_0x4d8a('0x54')]({},_0x5a56c8,_0x55a936['options']);var _0x4996db={'where':_0x5a56c8['where']};return db[_0x4d8a('0x55')][_0x4d8a('0x32')](_0x4996db)['then'](function(_0x562fa7){_0x189cf0[_0x4d8a('0x32')]=_0x562fa7;if(_0x55a936[_0x4d8a('0x47')][_0x4d8a('0x56')]){_0x5a56c8[_0x4d8a('0x57')]=[{'all':!![]}];}return db[_0x4d8a('0x55')][_0x4d8a('0x58')](_0x5a56c8);})[_0x4d8a('0x22')](function(_0x1fc0ae){_0x189cf0[_0x4d8a('0x59')]=_0x1fc0ae;return _0x189cf0;})[_0x4d8a('0x22')](respondWithFilteredResult(_0x1eb238,_0x5a56c8))[_0x4d8a('0x2b')](handleError(_0x1eb238,null));};exports[_0x4d8a('0x5a')]=function(_0x725187,_0x53ca23){var _0x3b7d84={'raw':![],'where':{'id':_0x725187[_0x4d8a('0x5b')]['id']},'include':[{'model':db['Pause'],'as':_0x4d8a('0x41')}]},_0x43b5ac={};_0x43b5ac[_0x4d8a('0x46')]=_['keys'](db['FaxAccount']['rawAttributes']);_0x43b5ac[_0x4d8a('0x47')]=_['keys'](_0x725187[_0x4d8a('0x47')]);_0x43b5ac[_0x4d8a('0x49')]=_['intersection'](_0x43b5ac[_0x4d8a('0x46')],_0x43b5ac['query']);_0x3b7d84[_0x4d8a('0x4c')]=_['intersection'](_0x43b5ac[_0x4d8a('0x46')],qs['fields'](_0x725187[_0x4d8a('0x47')][_0x4d8a('0x4b')]));_0x3b7d84[_0x4d8a('0x4c')]=_0x3b7d84[_0x4d8a('0x4c')][_0x4d8a('0x4d')]?_0x3b7d84[_0x4d8a('0x4c')]:_0x43b5ac['model'];if(_0x725187[_0x4d8a('0x47')][_0x4d8a('0x56')]){_0x3b7d84[_0x4d8a('0x57')]=[{'all':!![]}];}_0x3b7d84=_[_0x4d8a('0x54')]({},_0x3b7d84,_0x725187[_0x4d8a('0x5c')]);return db['FaxAccount'][_0x4d8a('0x5d')](_0x3b7d84)[_0x4d8a('0x22')](handleEntityNotFound(_0x53ca23,null))[_0x4d8a('0x22')](respondWithResult(_0x53ca23,null))[_0x4d8a('0x2b')](handleError(_0x53ca23,null));};exports['create']=function(_0x317d15,_0x311b16){return db[_0x4d8a('0x55')][_0x4d8a('0x5e')](_0x317d15[_0x4d8a('0x5f')],{})['then'](function(_0x7b1528){var _0x53175f=_0x317d15['user'][_0x4d8a('0x38')]({'plain':!![]});if(!_0x53175f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x53175f['role']===_0x4d8a('0x60')){var _0x59a58a=_0x7b1528['get']({'plain':!![]});var _0x4d8843=_0x4d8a('0x39');return db[_0x4d8a('0x61')][_0x4d8a('0x5d')]({'where':{'name':_0x4d8843,'userProfileId':_0x53175f['userProfileId']},'raw':!![]})['then'](function(_0x570c78){if(_0x570c78&&_0x570c78[_0x4d8a('0x62')]===0x0){return db[_0x4d8a('0x3a')][_0x4d8a('0x5e')]({'name':_0x59a58a[_0x4d8a('0x3d')],'resourceId':_0x59a58a['id'],'type':_0x570c78['name'],'sectionId':_0x570c78['id']},{})['then'](function(){return _0x7b1528;});}else{return _0x7b1528;}})[_0x4d8a('0x2b')](function(_0x33e6f3){logger[_0x4d8a('0x26')](_0x4d8a('0x63'),_0x33e6f3);throw _0x33e6f3;});}return _0x7b1528;})[_0x4d8a('0x22')](respondWithResult(_0x311b16,0xc9))[_0x4d8a('0x2b')](handleError(_0x311b16,null));};exports['update']=function(_0x5e9a99,_0x57c3ce){if(_0x5e9a99[_0x4d8a('0x5f')]['id']){delete _0x5e9a99[_0x4d8a('0x5f')]['id'];}return db[_0x4d8a('0x55')]['find']({'where':{'id':_0x5e9a99[_0x4d8a('0x5b')]['id']},'include':[{'model':db[_0x4d8a('0x40')],'as':_0x4d8a('0x41')}]})[_0x4d8a('0x22')](handleEntityNotFound(_0x57c3ce,null))[_0x4d8a('0x22')](saveUpdates(_0x5e9a99[_0x4d8a('0x5f')],null))['then'](respondWithResult(_0x57c3ce,null))[_0x4d8a('0x2b')](handleError(_0x57c3ce,null));};exports[_0x4d8a('0x37')]=function(_0xb18762,_0x57e83a){return db[_0x4d8a('0x55')][_0x4d8a('0x5d')]({'where':{'id':_0xb18762['params']['id']}})[_0x4d8a('0x22')](handleEntityNotFound(_0x57e83a,null))['then'](removeEntity(_0x57e83a,null))[_0x4d8a('0x2b')](handleError(_0x57e83a,null));};exports['describe']=function(_0x35cf6d,_0x239277){return db['FaxAccount'][_0x4d8a('0x64')]()[_0x4d8a('0x22')](respondWithResult(_0x239277,null))['catch'](handleError(_0x239277,null));};exports[_0x4d8a('0x65')]=function(_0xd2ce1d,_0x5d1403,_0x25715c){if(_0xd2ce1d[_0x4d8a('0x5f')]['id']){delete _0xd2ce1d[_0x4d8a('0x5f')]['id'];}return db[_0x4d8a('0x55')][_0x4d8a('0x5d')]({'where':{'id':_0xd2ce1d[_0x4d8a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x5d1403,null))[_0x4d8a('0x22')](function(_0x107277){if(_0x107277){_0xd2ce1d['body'][_0x4d8a('0x66')]=_0x107277['id'];return db[_0x4d8a('0x67')]['create'](_0xd2ce1d[_0x4d8a('0x5f')]);}})[_0x4d8a('0x22')](respondWithResult(_0x5d1403,null))[_0x4d8a('0x2b')](handleError(_0x5d1403,null));};exports['getDispositions']=function(_0x567b9f,_0x8ec716,_0x38b18b){var _0x3c3da1={'raw':![],'where':{}};var _0xd7413d={};var _0x10d3c7={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4d8a('0x68')]({'where':{'id':_0x567b9f[_0x4d8a('0x5b')]['id']}})[_0x4d8a('0x22')](handleEntityNotFound(_0x8ec716,null))[_0x4d8a('0x22')](function(_0x3d0a66){if(_0x3d0a66){_0xd7413d[_0x4d8a('0x46')]=_[_0x4d8a('0x48')](db[_0x4d8a('0x67')]['rawAttributes']);_0xd7413d['query']=_[_0x4d8a('0x48')](_0x567b9f[_0x4d8a('0x47')]);_0xd7413d[_0x4d8a('0x49')]=_[_0x4d8a('0x4a')](_0xd7413d['model'],_0xd7413d[_0x4d8a('0x47')]);_0x3c3da1['attributes']=_[_0x4d8a('0x4a')](_0xd7413d[_0x4d8a('0x46')],qs['fields'](_0x567b9f[_0x4d8a('0x47')]['fields']));_0x3c3da1[_0x4d8a('0x4c')]=_0x3c3da1[_0x4d8a('0x4c')]['length']?_0x3c3da1[_0x4d8a('0x4c')]:_0xd7413d[_0x4d8a('0x46')];if(!_0x567b9f[_0x4d8a('0x47')]['hasOwnProperty'](_0x4d8a('0x4f'))){_0x3c3da1['limit']=qs['limit'](_0x567b9f[_0x4d8a('0x47')][_0x4d8a('0x31')]);_0x3c3da1[_0x4d8a('0x2f')]=qs[_0x4d8a('0x2f')](_0x567b9f['query']['offset']);}_0x3c3da1[_0x4d8a('0x69')]=qs[_0x4d8a('0x50')](_0x567b9f['query'][_0x4d8a('0x50')]);_0x3c3da1[_0x4d8a('0x51')]=qs[_0x4d8a('0x49')](_['pick'](_0x567b9f[_0x4d8a('0x47')],_0xd7413d[_0x4d8a('0x49')]));_0x3c3da1['where']['FaxAccountId']=_0x3d0a66['id'];if(_0x567b9f[_0x4d8a('0x47')][_0x4d8a('0x53')]){_0x3c3da1[_0x4d8a('0x51')]=_[_0x4d8a('0x54')](_0x3c3da1[_0x4d8a('0x51')],{'$or':_[_0x4d8a('0x42')](_0x3c3da1[_0x4d8a('0x4c')],function(_0x975732){var _0x481cdd={};_0x481cdd[_0x975732]={'$like':'%'+_0x567b9f[_0x4d8a('0x47')][_0x4d8a('0x53')]+'%'};return _0x481cdd;})});}_0x3c3da1=_[_0x4d8a('0x54')]({},_0x3c3da1,_0x567b9f['options']);return db[_0x4d8a('0x67')][_0x4d8a('0x32')]({'where':_0x3c3da1[_0x4d8a('0x51')]})[_0x4d8a('0x22')](function(_0x52a3fe){_0x10d3c7[_0x4d8a('0x32')]=_0x52a3fe;if(_0x567b9f[_0x4d8a('0x47')]['includeAll']){_0x3c3da1['include']=[{'all':!![]}];}return db[_0x4d8a('0x67')][_0x4d8a('0x58')](_0x3c3da1);})['then'](function(_0x41187f){_0x10d3c7[_0x4d8a('0x59')]=_0x41187f;return _0x10d3c7;});}})['then'](respondWithFilteredResult(_0x8ec716,_0x3c3da1))[_0x4d8a('0x2b')](handleError(_0x8ec716,null));};exports[_0x4d8a('0x6a')]=function(_0xb50ba,_0x23d432,_0x104935){return db[_0x4d8a('0x55')][_0x4d8a('0x5d')]({'where':{'id':_0xb50ba[_0x4d8a('0x5b')]['id']}})[_0x4d8a('0x22')](handleEntityNotFound(_0x23d432,null))[_0x4d8a('0x22')](function(_0x576b8a){if(_0x576b8a){return _0x576b8a[_0x4d8a('0x6a')](_0xb50ba[_0x4d8a('0x47')][_0x4d8a('0x6b')]);}})[_0x4d8a('0x22')](respondWithStatusCode(_0x23d432,null))['catch'](handleError(_0x23d432,null));};exports[_0x4d8a('0x6c')]=function(_0x489417,_0x94a020,_0x5533b4){if(_0x489417['body']['id']){delete _0x489417['body']['id'];}return db[_0x4d8a('0x55')][_0x4d8a('0x5d')]({'where':{'id':_0x489417[_0x4d8a('0x5b')]['id']}})[_0x4d8a('0x22')](handleEntityNotFound(_0x94a020,null))[_0x4d8a('0x22')](function(_0x3ca82a){if(_0x3ca82a){_0x489417[_0x4d8a('0x5f')][_0x4d8a('0x66')]=_0x3ca82a['id'];return db[_0x4d8a('0x6d')][_0x4d8a('0x5e')](_0x489417[_0x4d8a('0x5f')]);}})[_0x4d8a('0x22')](respondWithResult(_0x94a020,null))['catch'](handleError(_0x94a020,null));};exports[_0x4d8a('0x6e')]=function(_0x14e89d,_0x3dbcb5,_0x24a858){var _0x349d04={'raw':![],'where':{}};var _0x24876d={};var _0xeca1c4={'count':0x0,'rows':[]};return db[_0x4d8a('0x55')][_0x4d8a('0x68')]({'where':{'id':_0x14e89d[_0x4d8a('0x5b')]['id']}})[_0x4d8a('0x22')](handleEntityNotFound(_0x3dbcb5,null))[_0x4d8a('0x22')](function(_0x484af8){if(_0x484af8){_0x24876d[_0x4d8a('0x46')]=_['keys'](db[_0x4d8a('0x6d')][_0x4d8a('0x43')]);_0x24876d[_0x4d8a('0x47')]=_[_0x4d8a('0x48')](_0x14e89d[_0x4d8a('0x47')]);_0x24876d['filters']=_[_0x4d8a('0x4a')](_0x24876d[_0x4d8a('0x46')],_0x24876d['query']);_0x349d04[_0x4d8a('0x4c')]=_[_0x4d8a('0x4a')](_0x24876d[_0x4d8a('0x46')],qs[_0x4d8a('0x4b')](_0x14e89d[_0x4d8a('0x47')][_0x4d8a('0x4b')]));_0x349d04[_0x4d8a('0x4c')]=_0x349d04[_0x4d8a('0x4c')][_0x4d8a('0x4d')]?_0x349d04[_0x4d8a('0x4c')]:_0x24876d['model'];if(!_0x14e89d[_0x4d8a('0x47')]['hasOwnProperty']('nolimit')){_0x349d04[_0x4d8a('0x31')]=qs[_0x4d8a('0x31')](_0x14e89d[_0x4d8a('0x47')][_0x4d8a('0x31')]);_0x349d04[_0x4d8a('0x2f')]=qs[_0x4d8a('0x2f')](_0x14e89d[_0x4d8a('0x47')][_0x4d8a('0x2f')]);}_0x349d04[_0x4d8a('0x69')]=qs[_0x4d8a('0x50')](_0x14e89d[_0x4d8a('0x47')][_0x4d8a('0x50')]);_0x349d04[_0x4d8a('0x51')]=qs[_0x4d8a('0x49')](_['pick'](_0x14e89d[_0x4d8a('0x47')],_0x24876d[_0x4d8a('0x49')]));_0x349d04[_0x4d8a('0x51')][_0x4d8a('0x66')]=_0x484af8['id'];if(_0x14e89d[_0x4d8a('0x47')][_0x4d8a('0x53')]){_0x349d04[_0x4d8a('0x51')]=_['merge'](_0x349d04['where'],{'$or':_[_0x4d8a('0x42')](_0x349d04['attributes'],function(_0x506939){var _0x2d60a4={};_0x2d60a4[_0x506939]={'$like':'%'+_0x14e89d[_0x4d8a('0x47')][_0x4d8a('0x53')]+'%'};return _0x2d60a4;})});}_0x349d04=_[_0x4d8a('0x54')]({},_0x349d04,_0x14e89d[_0x4d8a('0x5c')]);return db[_0x4d8a('0x6d')][_0x4d8a('0x32')]({'where':_0x349d04[_0x4d8a('0x51')]})[_0x4d8a('0x22')](function(_0x2d2d57){_0xeca1c4[_0x4d8a('0x32')]=_0x2d2d57;if(_0x14e89d[_0x4d8a('0x47')][_0x4d8a('0x56')]){_0x349d04[_0x4d8a('0x57')]=[{'all':!![]}];}return db['CannedAnswer'][_0x4d8a('0x58')](_0x349d04);})[_0x4d8a('0x22')](function(_0x1818e6){_0xeca1c4[_0x4d8a('0x59')]=_0x1818e6;return _0xeca1c4;});}})[_0x4d8a('0x22')](respondWithFilteredResult(_0x3dbcb5,_0x349d04))[_0x4d8a('0x2b')](handleError(_0x3dbcb5,null));};exports['removeAnswers']=function(_0x58120a,_0x446389,_0x186301){return db['FaxAccount'][_0x4d8a('0x5d')]({'where':{'id':_0x58120a['params']['id']}})[_0x4d8a('0x22')](handleEntityNotFound(_0x446389,null))['then'](function(_0x2f6db9){if(_0x2f6db9){return _0x2f6db9['removeAnswers'](_0x58120a[_0x4d8a('0x47')][_0x4d8a('0x6b')]);}})['then'](respondWithStatusCode(_0x446389,null))['catch'](handleError(_0x446389,null));};exports[_0x4d8a('0x6f')]=function(_0x443aad,_0x2487c8,_0x621787){return db[_0x4d8a('0x70')][_0x4d8a('0x5d')]({'where':{'id':_0x443aad['params']['id']}})[_0x4d8a('0x22')](handleEntityNotFound(_0x2487c8,null))['then'](function(_0x35da9a){if(_0x35da9a){return _0x35da9a['addInteraction'](_0x443aad[_0x4d8a('0x5f')][_0x4d8a('0x6b')],_[_0x4d8a('0x71')](_0x443aad[_0x4d8a('0x5f')],[_0x4d8a('0x6b'),'id'])||{});}})['then'](respondWithResult(_0x2487c8,null))[_0x4d8a('0x2b')](handleError(_0x2487c8,null));};exports[_0x4d8a('0x72')]=function(_0xed041b,_0x4edde8,_0x49abe3){var _0x54c5be={'raw':![],'where':{}};var _0x5e01b4={};var _0xc0440={'count':0x0,'rows':[]};return db[_0x4d8a('0x55')][_0x4d8a('0x68')]({'where':{'id':_0xed041b[_0x4d8a('0x5b')]['id']}})['then'](handleEntityNotFound(_0x4edde8,null))[_0x4d8a('0x22')](function(_0xc29a4e){if(_0xc29a4e){_0x5e01b4[_0x4d8a('0x46')]=_['keys'](db[_0x4d8a('0x70')]['rawAttributes']);_0x5e01b4[_0x4d8a('0x47')]=_['keys'](_0xed041b[_0x4d8a('0x47')]);_0x5e01b4[_0x4d8a('0x49')]=_[_0x4d8a('0x4a')](_0x5e01b4['model'],_0x5e01b4['query']);_0x54c5be['attributes']=_[_0x4d8a('0x4a')](_0x5e01b4[_0x4d8a('0x46')],qs[_0x4d8a('0x4b')](_0xed041b[_0x4d8a('0x47')][_0x4d8a('0x4b')]));_0x54c5be['attributes']=_0x54c5be[_0x4d8a('0x4c')]['length']?_0x54c5be['attributes']:_0x5e01b4[_0x4d8a('0x46')];if(!_0xed041b[_0x4d8a('0x47')][_0x4d8a('0x4e')]('nolimit')){_0x54c5be[_0x4d8a('0x31')]=qs[_0x4d8a('0x31')](_0xed041b[_0x4d8a('0x47')][_0x4d8a('0x31')]);_0x54c5be[_0x4d8a('0x2f')]=qs[_0x4d8a('0x2f')](_0xed041b[_0x4d8a('0x47')]['offset']);}_0x54c5be[_0x4d8a('0x69')]=qs[_0x4d8a('0x50')](_0xed041b[_0x4d8a('0x47')][_0x4d8a('0x50')]);_0x54c5be[_0x4d8a('0x51')]=qs[_0x4d8a('0x49')](_[_0x4d8a('0x52')](_0xed041b['query'],_0x5e01b4[_0x4d8a('0x49')]));_0x54c5be[_0x4d8a('0x51')][_0x4d8a('0x66')]=_0xc29a4e['id'];if(_0xed041b[_0x4d8a('0x47')][_0x4d8a('0x53')]){_0x54c5be[_0x4d8a('0x51')]=_[_0x4d8a('0x54')](_0x54c5be['where'],{'$or':_['map'](_0x54c5be[_0x4d8a('0x4c')],function(_0x286d35){var _0x2d9e17={};_0x2d9e17[_0x286d35]={'$like':'%'+_0xed041b[_0x4d8a('0x47')]['filter']+'%'};return _0x2d9e17;})});}_0x54c5be=_[_0x4d8a('0x54')]({},_0x54c5be,_0xed041b['options']);return db[_0x4d8a('0x70')][_0x4d8a('0x32')]({'where':_0x54c5be[_0x4d8a('0x51')]})[_0x4d8a('0x22')](function(_0x9fa02d){_0xc0440['count']=_0x9fa02d;if(_0xed041b['query'][_0x4d8a('0x56')]){_0x54c5be[_0x4d8a('0x57')]=[{'model':db[_0x4d8a('0x73')],'as':_0x4d8a('0x74'),'required':![]},{'model':db[_0x4d8a('0x75')],'as':_0x4d8a('0x76'),'attributes':[_0x4d8a('0x3d'),_0x4d8a('0x77'),_0x4d8a('0x78')],'required':![]},{'model':db[_0x4d8a('0x79')],'as':_0x4d8a('0x7a'),'attributes':['id',_0x4d8a('0x3d'),_0x4d8a('0x7b')],'where':_0xed041b[_0x4d8a('0x47')]['tag']?{'id':_0xed041b[_0x4d8a('0x47')][_0x4d8a('0x7c')]}:undefined,'required':_0xed041b[_0x4d8a('0x47')][_0x4d8a('0x7c')]?!![]:![]}];}return db[_0x4d8a('0x70')]['findAll'](_0x54c5be);})[_0x4d8a('0x22')](function(_0x491d07){_0xc0440[_0x4d8a('0x59')]=_0x491d07;return _0xc0440;});}})[_0x4d8a('0x22')](respondWithFilteredResult(_0x4edde8,_0x54c5be))['catch'](handleError(_0x4edde8,null));};exports[_0x4d8a('0x7d')]=function(_0x4a3953,_0x49c7d4){var _0x36b346=_0x4a3953[_0x4d8a('0x5b')]['id'];var _0x23555d=_0x4a3953[_0x4d8a('0x5f')];var _0xc78513=0xc8;var _0x56f13f=null;return db[_0x4d8a('0x7e')]['transaction']({'isolationLevel':db[_0x4d8a('0x7e')][_0x4d8a('0x7f')][_0x4d8a('0x80')][_0x4d8a('0x81')]},function(_0x13634b){return db[_0x4d8a('0x55')][_0x4d8a('0x68')]({'where':{'id':_0x36b346},'transaction':_0x13634b})[_0x4d8a('0x22')](function(_0x17b933){if(_0x17b933){return db[_0x4d8a('0x82')][_0x4d8a('0x37')]({'where':{'FaxAccountId':_0x36b346},'transaction':_0x13634b})[_0x4d8a('0x22')](function(){var _0x27d451=_[_0x4d8a('0x42')](_0x23555d,function(_0x3e6ff8){_0x3e6ff8[_0x4d8a('0x66')]=_0x36b346;return _0x3e6ff8;});return db[_0x4d8a('0x82')][_0x4d8a('0x83')](_0x27d451,{'transaction':_0x13634b});});}else{_0xc78513=0x194;_0x56f13f=[];}});})[_0x4d8a('0x22')](function(){if(_0xc78513!==0x194){return db[_0x4d8a('0x82')]['findAndCountAll']({'where':{'FaxAccountId':_0x36b346},'order':_0x4d8a('0x84')})[_0x4d8a('0x22')](function(_0xf54fa7){_0x56f13f=_0xf54fa7;});}})[_0x4d8a('0x2b')](function(_0x26fb38){_0xc78513=0x1f4;logger[_0x4d8a('0x26')](_0x26fb38['stack']);if(_0x26fb38[_0x4d8a('0x3d')]){delete _0x26fb38[_0x4d8a('0x3d')];}_0x56f13f=_0x26fb38;})[_0x4d8a('0x85')](function(){if(_0x56f13f===null){_0x49c7d4[_0x4d8a('0x3b')](_0xc78513);}else{if(_0xc78513===0x1f4){_0x49c7d4[_0x4d8a('0x2d')](_0xc78513)[_0x4d8a('0x3e')](_0x56f13f);}else{_0x49c7d4[_0x4d8a('0x2d')](_0xc78513)['json'](_0x56f13f);}}});};exports['getApplications']=function(_0x5c7de8,_0x29afea,_0x5d05dd){var _0x397149={};var _0x4ed2dd={};var _0x4a28cd;var _0x43020d;return db[_0x4d8a('0x55')][_0x4d8a('0x68')]({'where':{'id':_0x5c7de8['params']['id']}})[_0x4d8a('0x22')](handleEntityNotFound(_0x29afea,null))[_0x4d8a('0x22')](function(_0x269488){if(_0x269488){_0x4a28cd=_0x269488;_0x4ed2dd[_0x4d8a('0x46')]=_[_0x4d8a('0x48')](db['FaxApplication']['rawAttributes']);_0x4ed2dd['query']=_[_0x4d8a('0x48')](_0x5c7de8[_0x4d8a('0x47')]);_0x4ed2dd[_0x4d8a('0x49')]=_[_0x4d8a('0x4a')](_0x4ed2dd[_0x4d8a('0x46')],_0x4ed2dd[_0x4d8a('0x47')]);_0x397149['attributes']=_[_0x4d8a('0x4a')](_0x4ed2dd[_0x4d8a('0x46')],qs[_0x4d8a('0x4b')](_0x5c7de8[_0x4d8a('0x47')][_0x4d8a('0x4b')]));_0x397149[_0x4d8a('0x4c')]=_0x397149[_0x4d8a('0x4c')][_0x4d8a('0x4d')]?_0x397149['attributes']:_0x4ed2dd['model'];_0x397149[_0x4d8a('0x69')]=qs[_0x4d8a('0x50')](_0x5c7de8['query'][_0x4d8a('0x50')]);_0x397149[_0x4d8a('0x51')]=qs[_0x4d8a('0x49')](_[_0x4d8a('0x52')](_0x5c7de8[_0x4d8a('0x47')],_0x4ed2dd[_0x4d8a('0x49')]));if(_0x5c7de8['query'][_0x4d8a('0x53')]){_0x397149[_0x4d8a('0x51')]=_[_0x4d8a('0x54')](_0x397149['where'],{'$or':_[_0x4d8a('0x42')](_0x397149[_0x4d8a('0x4c')],function(_0x5d4091){var _0x2fd4f8={};_0x2fd4f8[_0x5d4091]={'$like':'%'+_0x5c7de8['query'][_0x4d8a('0x53')]+'%'};return _0x2fd4f8;})});}_0x397149=_[_0x4d8a('0x54')]({},_0x397149,_0x5c7de8[_0x4d8a('0x5c')]);return _0x4a28cd[_0x4d8a('0x86')](_0x397149);}})[_0x4d8a('0x22')](function(_0x22e79d){if(_0x22e79d){_0x43020d=_0x22e79d[_0x4d8a('0x4d')];if(!_0x5c7de8['query'][_0x4d8a('0x4e')](_0x4d8a('0x4f'))){_0x397149['limit']=qs['limit'](_0x5c7de8[_0x4d8a('0x47')]['limit']);_0x397149['offset']=qs[_0x4d8a('0x2f')](_0x5c7de8[_0x4d8a('0x47')][_0x4d8a('0x2f')]);}return _0x4a28cd['getApplications'](_0x397149);}})[_0x4d8a('0x22')](function(_0x4eb678){if(_0x4eb678){return _0x4eb678?{'count':_0x43020d,'rows':_0x4eb678}:null;}})['then'](respondWithResult(_0x29afea,null))[_0x4d8a('0x2b')](handleError(_0x29afea,null));};function Extension(_0x3cfc57,_0x5e34d4,_0x467a92,_0x53e4bd){this[_0x4d8a('0x87')]='from-voip-provider';this[_0x4d8a('0x88')]=_0x3cfc57[_0x4d8a('0x89')];this[_0x4d8a('0x8a')]=_0x53e4bd;this[_0x4d8a('0x45')]='system';this['description']=_0x4d8a('0x8b');this[_0x4d8a('0x66')]=_0x3cfc57['id'];this[_0x4d8a('0x84')]=_0x5e34d4;this[_0x4d8a('0x8c')]=_0x467a92;}function createExtensionsReciveFax(_0x5b79c6){var _0x349fdd=0x1;var _0x2fa67f=[];_0x2fa67f[_0x4d8a('0x8d')](new Extension(_0x5b79c6,_0x349fdd,'',_0x4d8a('0x8e')));_0x349fdd+=0x1;_0x2fa67f[_0x4d8a('0x8d')](new Extension(_0x5b79c6,_0x349fdd,_0x4d8a('0x8f'),_0x4d8a('0x90')));_0x349fdd+=0x1;for(var _0xd2341c in _0x5b79c6){if(_0x5b79c6['hasOwnProperty'](_0xd2341c)&&(_0xd2341c===_0x4d8a('0x91')||_0xd2341c===_0x4d8a('0x89')||_0xd2341c===_0x4d8a('0x92')||_0xd2341c===_0x4d8a('0x93')||_0xd2341c===_0x4d8a('0x94')||_0xd2341c===_0x4d8a('0x95')||_0xd2341c===_0x4d8a('0x96')||_0xd2341c===_0x4d8a('0x97')||_0xd2341c===_0x4d8a('0x98'))){_0x2fa67f['push'](new Extension(_0x5b79c6,_0x349fdd,'FAXOPT('+_0xd2341c+')='+_0x5b79c6[_0xd2341c],_0x4d8a('0x90')));_0x349fdd+=0x1;}}_0x2fa67f[_0x4d8a('0x8d')](new Extension(_0x5b79c6,_0x349fdd,'6',_0x4d8a('0x99')));_0x349fdd+=0x1;_0x2fa67f[_0x4d8a('0x8d')](new Extension(_0x5b79c6,_0x349fdd,_0x4d8a('0x9a'),_0x4d8a('0x9b')));_0x349fdd=0x0;return _0x2fa67f;}exports[_0x4d8a('0x9c')]=function(_0x15fd6e,_0x142519,_0x113258){var _0xbc329a;return db['sequelize']['transaction'](function(_0x1ac762){return db[_0x4d8a('0x55')][_0x4d8a('0x5e')](_0x15fd6e[_0x4d8a('0x5f')],{'transaction':_0x1ac762})[_0x4d8a('0x22')](function(_0xe4611f){_0xbc329a=_0xe4611f['get']({'plain':!![]});return db[_0x4d8a('0x9d')][_0x4d8a('0x83')](createExtensionsReciveFax(_0xbc329a),{'transaction':_0x1ac762});});})[_0x4d8a('0x22')](function(){return _0xbc329a;})[_0x4d8a('0x22')](respondWithResult(_0x142519,null))['catch'](handleError(_0x142519,null));};exports[_0x4d8a('0x9e')]=function(_0x524824,_0x3d069a,_0x2841e3){var _0x123db0;return db[_0x4d8a('0x7e')][_0x4d8a('0x9f')](function(_0x448840){return db['FaxAccount'][_0x4d8a('0x36')](_0x524824[_0x4d8a('0x5f')],{'where':{'id':_0x524824[_0x4d8a('0x5f')]['id']},'transaction':_0x448840})['then'](function(_0x4776de){return db['VoiceExtension'][_0x4d8a('0x37')]({'where':{'FaxAccountId':_0x524824['body']['id']},'transaction':_0x448840})[_0x4d8a('0x22')](function(_0x2f8d67){return db['VoiceExtension'][_0x4d8a('0x83')](createExtensionsReciveFax(_['omit'](_0x524824[_0x4d8a('0x5f')],['tech','key',_0x4d8a('0xa0'),'updatedAt','TrunkId',_0x4d8a('0xa1')])),{'transaction':_0x448840});});});})['then'](function(){return db[_0x4d8a('0x55')]['findById'](_0x524824['body']['id']);})[_0x4d8a('0x22')](respondWithResult(_0x3d069a,null))[_0x4d8a('0x2b')](handleError(_0x3d069a,null));};exports[_0x4d8a('0xa2')]=function(_0x3941d8,_0x19498e,_0x284cb1){var _0x16dabe={'raw':!![],'where':{}};var _0x2db80c={};var _0x23f9ed={'count':0x0,'rows':[]};return db['FaxAccount'][_0x4d8a('0x68')]({'where':{'id':_0x3941d8['params']['id']}})[_0x4d8a('0x22')](handleEntityNotFound(_0x19498e,null))[_0x4d8a('0x22')](function(_0x24c2ae){if(_0x24c2ae){_0x2db80c[_0x4d8a('0x46')]=_[_0x4d8a('0x48')](db[_0x4d8a('0xa3')][_0x4d8a('0x43')]);_0x2db80c[_0x4d8a('0x47')]=_[_0x4d8a('0x48')](_0x3941d8[_0x4d8a('0x47')]);_0x2db80c[_0x4d8a('0x49')]=_['intersection'](_0x2db80c['model'],_0x2db80c[_0x4d8a('0x47')]);_0x16dabe['attributes']=_[_0x4d8a('0x4a')](_0x2db80c[_0x4d8a('0x46')],qs[_0x4d8a('0x4b')](_0x3941d8[_0x4d8a('0x47')][_0x4d8a('0x4b')]));_0x16dabe['attributes']=_0x16dabe[_0x4d8a('0x4c')][_0x4d8a('0x4d')]?_0x16dabe[_0x4d8a('0x4c')]:_0x2db80c[_0x4d8a('0x46')];if(!_0x3941d8['query'][_0x4d8a('0x4e')](_0x4d8a('0x4f'))){_0x16dabe['limit']=qs['limit'](_0x3941d8[_0x4d8a('0x47')][_0x4d8a('0x31')]);_0x16dabe[_0x4d8a('0x2f')]=qs[_0x4d8a('0x2f')](_0x3941d8[_0x4d8a('0x47')][_0x4d8a('0x2f')]);}_0x16dabe[_0x4d8a('0x69')]=qs[_0x4d8a('0x50')](_0x3941d8[_0x4d8a('0x47')][_0x4d8a('0x50')]);_0x16dabe[_0x4d8a('0x51')]=qs[_0x4d8a('0x49')](_[_0x4d8a('0x52')](_0x3941d8['query'],_0x2db80c[_0x4d8a('0x49')]));_0x16dabe[_0x4d8a('0x51')][_0x4d8a('0x66')]=_0x24c2ae['id'];if(_0x3941d8[_0x4d8a('0x47')][_0x4d8a('0x53')]){_0x16dabe[_0x4d8a('0x51')]=_[_0x4d8a('0x54')](_0x16dabe[_0x4d8a('0x51')],{'$or':_[_0x4d8a('0x42')](_0x16dabe[_0x4d8a('0x4c')],function(_0x594e16){var _0x5268dd={};_0x5268dd[_0x594e16]={'$like':'%'+_0x3941d8['query']['filter']+'%'};return _0x5268dd;})});}if(_0x3941d8[_0x4d8a('0x47')][_0x4d8a('0xa4')]){var _0x5d2902=_0x3941d8[_0x4d8a('0x47')]['$gte'][_0x4d8a('0xa5')](',');var _0x2a0e67={};_0x2a0e67[_0x5d2902[0x0]]={'$gte':moment(_0x5d2902[0x1])[_0x4d8a('0xa6')](_0x4d8a('0xa7'))};_0x16dabe[_0x4d8a('0x51')]=_[_0x4d8a('0x54')](_0x16dabe['where'],_0x2a0e67);}_0x16dabe=_[_0x4d8a('0x54')]({},_0x16dabe,_0x3941d8['options']);return db[_0x4d8a('0xa3')][_0x4d8a('0x32')]({'where':_0x16dabe[_0x4d8a('0x51')]})[_0x4d8a('0x22')](function(_0x17b369){_0x23f9ed[_0x4d8a('0x32')]=_0x17b369;if(_0x3941d8['query']['includeAll']){_0x16dabe[_0x4d8a('0x57')]=[{'all':!![]}];}return db[_0x4d8a('0xa3')][_0x4d8a('0x58')](_0x16dabe);})[_0x4d8a('0x22')](function(_0x5a6cc7){_0x23f9ed['rows']=_0x5a6cc7;return _0x23f9ed;});}})['then'](respondWithFilteredResult(_0x19498e,_0x16dabe))[_0x4d8a('0x2b')](handleError(_0x19498e,null));};exports[_0x4d8a('0x3e')]=function(_0x4043c3,_0x2e0b7e,_0x345501){var _0x514dd7,_0x5481f3={},_0x2069f2;if(_0x4043c3[_0x4d8a('0x5f')]['to']){_0x2069f2=_0x4043c3[_0x4d8a('0x5f')]['to'][0x0];}return db[_0x4d8a('0x55')]['find']({'where':{'id':_0x4043c3[_0x4d8a('0x5b')]['id']},'include':[{'model':db[_0x4d8a('0xa8')],'as':_0x4d8a('0xa9'),'include':[{'model':db[_0x4d8a('0x73')],'as':'Contacts','where':{'fax':_0x2069f2},'limit':0x1,'order':[[_0x4d8a('0xaa'),'DESC']]}]}]})[_0x4d8a('0x22')](handleEntityNotFound(_0x2e0b7e,null))[_0x4d8a('0x22')](function(_0x46b42a){_0x514dd7=_0x46b42a;if(_0x4043c3[_0x4d8a('0x5f')][_0x4d8a('0xab')]&&_0x4043c3[_0x4d8a('0x5f')][_0x4d8a('0xab')][_0x4d8a('0x4d')]){for(var _0x302a07=0x0;_0x302a07<_0x4043c3[_0x4d8a('0x5f')][_0x4d8a('0xab')][_0x4d8a('0x4d')];_0x302a07+=0x1){_0x4043c3['body']['attachments'][_0x302a07]={'filename':_0x4043c3[_0x4d8a('0x5f')]['attachments'][_0x302a07][_0x4d8a('0x3d')],'id':_0x4043c3[_0x4d8a('0x5f')][_0x4d8a('0xab')][_0x302a07]['id'],'path':path[_0x4d8a('0xac')](config[_0x4d8a('0xad')],_0x4d8a('0xae'),_0x4043c3[_0x4d8a('0x5f')]['attachments'][_0x302a07]['basename'])};}}return respondWithRpcPromise(_0x4d8a('0xaf'),'CheckAfterSend',{'FaxAccountId':_[_0x4d8a('0xb0')](_0x4043c3[_0x4d8a('0x5b')]['id'])?undefined:_0x4043c3['params']['id'],'path':_[_0x4d8a('0xb0')](_0x4043c3[_0x4d8a('0x5f')][_0x4d8a('0xab')][0x0][_0x4d8a('0x9')])?undefined:_0x4043c3[_0x4d8a('0x5f')][_0x4d8a('0xab')][0x0][_0x4d8a('0x9')],'fax':_['isNil'](_0x4043c3[_0x4d8a('0x5f')]['to'][0x0])?undefined:_0x4043c3['body']['to'][0x0]},client9002);})[_0x4d8a('0x22')](function(){if(_0x514dd7){if(_[_0x4d8a('0xb0')](_0x4043c3[_0x4d8a('0x5f')][_0x4d8a('0xb1')])){_0x4043c3[_0x4d8a('0x5f')]['from']=util[_0x4d8a('0xa6')]('\x22%s\x22\x20<%s>',_0x514dd7['name'],_0x514dd7[_0x4d8a('0xb2')]);}if(_0x514dd7[_0x4d8a('0xa9')]){if(_0x514dd7[_0x4d8a('0xa9')][_0x4d8a('0xb3')][_0x4d8a('0x4d')]){return _0x514dd7[_0x4d8a('0xa9')][_0x4d8a('0xb3')][0x0];}else{return db[_0x4d8a('0x73')][_0x4d8a('0x5e')](_[_0x4d8a('0xb4')](_0x4043c3[_0x4d8a('0x5f')],{'firstName':_0x4043c3[_0x4d8a('0x5f')]['to'][0x0],'phone':_0x4043c3[_0x4d8a('0x5f')]['to'][0x0],'fax':_0x4043c3[_0x4d8a('0x5f')]['to'][0x0],'ListId':_0x514dd7[_0x4d8a('0xa1')]}));}}else{throw new Error(_0x4d8a('0xb5'));}}else{throw new Error(_0x4d8a('0xb6'));}})[_0x4d8a('0x22')](function(_0x3c033e){if(_0x3c033e){return db[_0x4d8a('0x70')][_0x4d8a('0x5d')]({'where':{'ContactId':_0x3c033e['id'],'closed':![],'FaxAccountId':_0x514dd7['id']}})['then'](function(_0x5b9153){if(_0x5b9153){return[_0x5b9153,![]];}return db['FaxInteraction'][_0x4d8a('0x5e')]({'UserId':_0x4043c3[_0x4d8a('0x60')]['id'],'ContactId':_0x3c033e['id'],'FaxAccountId':_0x514dd7['id'],'fax':_0x4043c3[_0x4d8a('0x5f')]['to'][0x0],'firstMsgDirection':_0x4d8a('0xb7'),'Messages':[_[_0x4d8a('0x54')](_0x4043c3[_0x4d8a('0x5f')],{'read':![],'body':_0x4043c3[_0x4d8a('0x5f')][_0x4d8a('0xab')][0x0]['filename'],'FaxAccountId':_0x514dd7['id'],'UserId':_0x4043c3['user']['id'],'ContactId':_0x3c033e['id'],'AttachmentId':_0x4043c3[_0x4d8a('0x5f')][_0x4d8a('0xab')][0x0]['id']})]},{'include':[{'model':db[_0x4d8a('0xa3')],'as':'Messages'}]})[_0x4d8a('0x22')](function(_0xd271e0){return[_0xd271e0,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x145cfe,_0xed27e2){if(_0xed27e2){return _0x145cfe;}return db[_0x4d8a('0xa3')][_0x4d8a('0x5e')]({'direction':_0x4d8a('0xb7'),'read':![],'body':_0x4043c3[_0x4d8a('0x5f')][_0x4d8a('0xab')][0x0][_0x4d8a('0xb8')],'FaxAccountId':_0x514dd7['id'],'FaxInteractionId':_0x145cfe['id'],'UserId':_0x4043c3[_0x4d8a('0x60')]['id'],'ContactId':_0x145cfe[_0x4d8a('0xb9')],'AttachmentId':_0x4043c3[_0x4d8a('0x5f')][_0x4d8a('0xab')][0x0]['id']})[_0x4d8a('0x22')](function(_0x50f834){_0x145cfe[_0x4d8a('0xba')][_0x4d8a('0xbb')]=[];_0x145cfe['dataValues']['Messages']['push'](_0x50f834[_0x4d8a('0xba')]);return _0x145cfe;});})['then'](function(_0x4c9fc9){respondWithRpcPromise(_0x4d8a('0xbc'),_0x4d8a('0xbc'),{'FaxAccountId':_[_0x4d8a('0xb0')](_0x4043c3[_0x4d8a('0x5b')]['id'])?undefined:_0x4043c3[_0x4d8a('0x5b')]['id'],'path':_[_0x4d8a('0xb0')](_0x4043c3['body'][_0x4d8a('0xab')][0x0][_0x4d8a('0x9')])?undefined:_0x4043c3['body']['attachments'][0x0]['path'],'fax':_['isNil'](_0x4043c3[_0x4d8a('0x5f')]['to'][0x0])?undefined:_0x4043c3[_0x4d8a('0x5f')]['to'][0x0],'AttachmentId':_0x4043c3['body'][_0x4d8a('0xab')][0x0]['id']},client9002)[_0x4d8a('0x22')](function(_0x4575d5){logger['info'](_0x4d8a('0xbd'),_0x4575d5);})['catch'](function(_0x219e03){logger[_0x4d8a('0xbe')]('SendFaxRpc,\x20%s',_0x219e03);});return _0x4c9fc9;})[_0x4d8a('0x22')](respondWithResult(_0x2e0b7e,null))[_0x4d8a('0x2b')](handleError(_0x2e0b7e,null));};exports[_0x4d8a('0xbf')]=function(_0x3085ba,_0x469762,_0xfc3c39){return db[_0x4d8a('0x55')][_0x4d8a('0x5d')]({'where':{'id':_0x3085ba[_0x4d8a('0x5b')]['id']}})[_0x4d8a('0x22')](handleEntityNotFound(_0x469762,null))[_0x4d8a('0x22')](function(_0x518a16){if(_0x518a16){return _0x518a16[_0x4d8a('0xbf')](_0x3085ba[_0x4d8a('0x5f')]['ids'],_[_0x4d8a('0x71')](_0x3085ba[_0x4d8a('0x5f')],[_0x4d8a('0x6b'),'id'])||{})[_0x4d8a('0xc0')](function(_0x3b9c17){for(var _0x36355a=0x0;_0x36355a<_0x3085ba[_0x4d8a('0x5f')]['ids']['length'];_0x36355a+=0x1){socket[_0x4d8a('0xc1')]('userFaxAccount:save',{'UserId':Number(_0x3085ba[_0x4d8a('0x5f')][_0x4d8a('0x6b')][_0x36355a]),'FaxAccountId':Number(_0x3085ba[_0x4d8a('0x5b')]['id'])});}return _0x3b9c17;});}})[_0x4d8a('0x22')](respondWithResult(_0x469762,null))['catch'](handleError(_0x469762,null));};exports[_0x4d8a('0xc2')]=function(_0x2326f0,_0x4735f8,_0x5b4a7e){return db['FaxAccount'][_0x4d8a('0x5d')]({'where':{'id':_0x2326f0[_0x4d8a('0x5b')]['id']}})[_0x4d8a('0x22')](handleEntityNotFound(_0x4735f8,null))[_0x4d8a('0x22')](function(_0x1ee052){if(_0x1ee052){return _0x1ee052[_0x4d8a('0xc2')](_0x2326f0[_0x4d8a('0x47')]['ids'])[_0x4d8a('0x22')](function(){if(_[_0x4d8a('0xc3')](_0x2326f0[_0x4d8a('0x47')]['ids'])){for(var _0x4500c8=0x0;_0x4500c8<_0x2326f0[_0x4d8a('0x47')][_0x4d8a('0x6b')]['length'];_0x4500c8+=0x1){socket[_0x4d8a('0xc1')](_0x4d8a('0xc4'),{'UserId':Number(_0x2326f0[_0x4d8a('0x47')][_0x4d8a('0x6b')][_0x4500c8]),'FaxAccountId':Number(_0x2326f0[_0x4d8a('0x5b')]['id'])});}}else{socket[_0x4d8a('0xc1')](_0x4d8a('0xc4'),{'UserId':Number(_0x2326f0['query']['ids']),'FaxAccountId':Number(_0x2326f0['params']['id'])});}});}})[_0x4d8a('0x22')](respondWithStatusCode(_0x4735f8,null))['catch'](handleError(_0x4735f8,null));};exports[_0x4d8a('0xc5')]=function(_0x30a43f,_0x198533,_0x582478){var _0x4582a8={};var _0x43cbbb={};var _0x5732a1;var _0x3b3893;return db[_0x4d8a('0x55')]['findOne']({'where':{'id':_0x30a43f['params']['id']}})[_0x4d8a('0x22')](handleEntityNotFound(_0x198533,null))['then'](function(_0xa3824f){if(_0xa3824f){_0x5732a1=_0xa3824f;_0x43cbbb['model']=_[_0x4d8a('0x48')](db[_0x4d8a('0x75')][_0x4d8a('0x43')]);_0x43cbbb[_0x4d8a('0x47')]=_[_0x4d8a('0x48')](_0x30a43f[_0x4d8a('0x47')]);_0x43cbbb['filters']=_[_0x4d8a('0x4a')](_0x43cbbb[_0x4d8a('0x46')],_0x43cbbb[_0x4d8a('0x47')]);_0x4582a8[_0x4d8a('0x4c')]=_[_0x4d8a('0x4a')](_0x43cbbb[_0x4d8a('0x46')],qs[_0x4d8a('0x4b')](_0x30a43f[_0x4d8a('0x47')][_0x4d8a('0x4b')]));_0x4582a8[_0x4d8a('0x4c')]=_0x4582a8['attributes'][_0x4d8a('0x4d')]?_0x4582a8[_0x4d8a('0x4c')]:_0x43cbbb[_0x4d8a('0x46')];_0x4582a8[_0x4d8a('0x69')]=qs[_0x4d8a('0x50')](_0x30a43f[_0x4d8a('0x47')][_0x4d8a('0x50')]);_0x4582a8[_0x4d8a('0x51')]=qs[_0x4d8a('0x49')](_['pick'](_0x30a43f['query'],_0x43cbbb['filters']));if(_0x30a43f['query']['filter']){_0x4582a8['where']=_[_0x4d8a('0x54')](_0x4582a8['where'],{'$or':_[_0x4d8a('0x42')](_0x4582a8[_0x4d8a('0x4c')],function(_0x272925){var _0x34c460={};_0x34c460[_0x272925]={'$like':'%'+_0x30a43f['query'][_0x4d8a('0x53')]+'%'};return _0x34c460;})});}_0x4582a8=_[_0x4d8a('0x54')]({},_0x4582a8,_0x30a43f[_0x4d8a('0x5c')]);return _0x5732a1[_0x4d8a('0xc5')](_0x4582a8);}})[_0x4d8a('0x22')](function(_0x2c2e69){if(_0x2c2e69){_0x3b3893=_0x2c2e69[_0x4d8a('0x4d')];if(!_0x30a43f['query'][_0x4d8a('0x4e')](_0x4d8a('0x4f'))){_0x4582a8[_0x4d8a('0x31')]=qs['limit'](_0x30a43f['query'][_0x4d8a('0x31')]);_0x4582a8['offset']=qs['offset'](_0x30a43f[_0x4d8a('0x47')][_0x4d8a('0x2f')]);}return _0x5732a1[_0x4d8a('0xc5')](_0x4582a8);}})['then'](function(_0x282276){if(_0x282276){return _0x282276?{'count':_0x3b3893,'rows':_0x282276}:null;}})['then'](respondWithResult(_0x198533,null))['catch'](handleError(_0x198533,null));}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.events.js b/server/api/faxAccount/faxAccount.events.js index 5c9d3c8..1558ee7 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 _0x749a=['update','remove','emit','hasOwnProperty','exports','events','../../mysqldb','FaxAccount','setMaxListeners','save'];(function(_0x5269db,_0x32abd4){var _0x5a425a=function(_0x3c019b){while(--_0x3c019b){_0x5269db['push'](_0x5269db['shift']());}};_0x5a425a(++_0x32abd4);}(_0x749a,0x73));var _0xa749=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x749a[_0x20a584];return _0x4b41a8;};'use strict';var EventEmitter=require(_0xa749('0x0'));var FaxAccount=require(_0xa749('0x1'))['db'][_0xa749('0x2')];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0xa749('0x3')](0x0);var events={'afterCreate':_0xa749('0x4'),'afterUpdate':_0xa749('0x5'),'afterDestroy':_0xa749('0x6')};function emitEvent(_0x42abf2){return function(_0x4af66b,_0x253241,_0x5a9e39){FaxAccountEvents[_0xa749('0x7')](_0x42abf2+':'+_0x4af66b['id'],_0x4af66b);FaxAccountEvents['emit'](_0x42abf2,_0x4af66b);_0x5a9e39(null);};}for(var e in events){if(events[_0xa749('0x8')](e)){var event=events[e];FaxAccount['hook'](e,emitEvent(event));}}module[_0xa749('0x9')]=FaxAccountEvents; \ No newline at end of file +var _0xac19=['remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save','update'];(function(_0xc77819,_0x139fdc){var _0x1c9434=function(_0x11d15d){while(--_0x11d15d){_0xc77819['push'](_0xc77819['shift']());}};_0x1c9434(++_0x139fdc);}(_0xac19,0x11d));var _0x9ac1=function(_0x407f78,_0x390898){_0x407f78=_0x407f78-0x0;var _0x2d9102=_0xac19[_0x407f78];return _0x2d9102;};'use strict';var EventEmitter=require(_0x9ac1('0x0'));var FaxAccount=require(_0x9ac1('0x1'))['db']['FaxAccount'];var FaxAccountEvents=new EventEmitter();FaxAccountEvents[_0x9ac1('0x2')](0x0);var events={'afterCreate':_0x9ac1('0x3'),'afterUpdate':_0x9ac1('0x4'),'afterDestroy':_0x9ac1('0x5')};function emitEvent(_0x44fdd7){return function(_0x4b9291,_0x2c4f7e,_0x1ae993){FaxAccountEvents[_0x9ac1('0x6')](_0x44fdd7+':'+_0x4b9291['id'],_0x4b9291);FaxAccountEvents['emit'](_0x44fdd7,_0x4b9291);_0x1ae993(null);};}for(var e in events){if(events[_0x9ac1('0x7')](e)){var event=events[e];FaxAccount[_0x9ac1('0x8')](e,emitEvent(event));}}module[_0x9ac1('0x9')]=FaxAccountEvents; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.model.js b/server/api/faxAccount/faxAccount.model.js index e289f35..28fb544 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 _0x9117=['define','FaxAccount','lodash','util','moment','bluebird','request-promise','./faxAccount.attributes','exports'];(function(_0x15146b,_0x2dac9c){var _0x42530c=function(_0x3ce1d7){while(--_0x3ce1d7){_0x15146b['push'](_0x15146b['shift']());}};_0x42530c(++_0x2dac9c);}(_0x9117,0x89));var _0x7911=function(_0x4c34d8,_0x383073){_0x4c34d8=_0x4c34d8-0x0;var _0x4c21df=_0x9117[_0x4c34d8];return _0x4c21df;};'use strict';var _=require(_0x7911('0x0'));var util=require(_0x7911('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7911('0x2'));var BPromise=require(_0x7911('0x3'));var rp=require(_0x7911('0x4'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x7911('0x5'));module[_0x7911('0x6')]=function(_0x22cbaf,_0x4e0676){return _0x22cbaf[_0x7911('0x7')](_0x7911('0x8'),attributes,{'tableName':'fax_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x156b=['../../config/environment','./faxAccount.attributes','exports','FaxAccount','fax_accounts','lodash','util','../../config/logger','api','moment','request-promise'];(function(_0xd6c010,_0x5355e6){var _0x15893b=function(_0x1b0a5a){while(--_0x1b0a5a){_0xd6c010['push'](_0xd6c010['shift']());}};_0x15893b(++_0x5355e6);}(_0x156b,0x118));var _0xb156=function(_0x4c0d2b,_0x2ff906){_0x4c0d2b=_0x4c0d2b-0x0;var _0x58c4fe=_0x156b[_0x4c0d2b];return _0x58c4fe;};'use strict';var _=require(_0xb156('0x0'));var util=require(_0xb156('0x1'));var logger=require(_0xb156('0x2'))(_0xb156('0x3'));var moment=require(_0xb156('0x4'));var BPromise=require('bluebird');var rp=require(_0xb156('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xb156('0x6'));var attributes=require(_0xb156('0x7'));module[_0xb156('0x8')]=function(_0x3e06bb,_0x458e65){return _0x3e06bb['define'](_0xb156('0x9'),attributes,{'tableName':_0xb156('0xa'),'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 e26ef42..01478fc 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 _0x2887=['Sequelize','ValidationError','no\x20available\x20attributes','difference','keys','updatedAt','createdAt','ListId','from','from\x20is\x20mandatory','isNil','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','find','account','List','DESC','FaxApplication','Applications','applications','list','priority','asc','Contacts','length','create','contact','fax','FaxInteraction','Contact\x20not\x20found','spread','get','autoclose','push','*,*,*,*','created','interaction','ContactId','AttachmentId','User','unshift','agent','name','Start','startRouting','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./faxAccount.socket','register','request','info','debug','FaxAccount,\x20%s,\x20%s,\x20%s','stringify','error','FaxAccount,\x20%s,\x20%s','message','request\x20sent','result','FaxAccount','options','where','limit','include','model','attributes','map','GetFaxAccount','NotifyFaxAccount','body','CmContact','describe','then'];(function(_0x8f4c15,_0x571506){var _0x3d8837=function(_0x2af517){while(--_0x2af517){_0x8f4c15['push'](_0x8f4c15['shift']());}};_0x3d8837(++_0x571506);}(_0x2887,0x87));var _0x7288=function(_0x4fd9b9,_0x4baad2){_0x4fd9b9=_0x4fd9b9-0x0;var _0x41907a=_0x2887[_0x4fd9b9];return _0x41907a;};'use strict';var _=require(_0x7288('0x0'));var util=require('util');var moment=require(_0x7288('0x1'));var BPromise=require(_0x7288('0x2'));var rs=require(_0x7288('0x3'));var fs=require('fs');var Redis=require(_0x7288('0x4'));var db=require(_0x7288('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7288('0x6'))('rpc');var config=require(_0x7288('0x7'));var jayson=require(_0x7288('0x8'));var client=jayson['client'][_0x7288('0x9')]({'port':0x232c});config[_0x7288('0xa')]=_[_0x7288('0xb')](config[_0x7288('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x7288('0xc'))(new Redis(config[_0x7288('0xa')]));require(_0x7288('0xd'))[_0x7288('0xe')](socket);function respondWithRpcPromise(_0x57312e,_0x31f131,_0x3595e3){return new BPromise(function(_0x4f3408,_0x2de89b){return client[_0x7288('0xf')](_0x57312e,_0x3595e3)['then'](function(_0x5176f6){logger[_0x7288('0x10')]('FaxAccount,\x20%s,\x20%s',_0x31f131,'request\x20sent');logger[_0x7288('0x11')](_0x7288('0x12'),_0x31f131,'request\x20sent',JSON[_0x7288('0x13')](_0x5176f6));if(_0x5176f6[_0x7288('0x14')]){if(_0x5176f6[_0x7288('0x14')]['code']===0x1f4){logger['error'](_0x7288('0x15'),_0x31f131,_0x5176f6[_0x7288('0x14')][_0x7288('0x16')]);return _0x2de89b(_0x5176f6[_0x7288('0x14')][_0x7288('0x16')]);}logger[_0x7288('0x14')](_0x7288('0x15'),_0x31f131,_0x5176f6[_0x7288('0x14')][_0x7288('0x16')]);return _0x4f3408(_0x5176f6[_0x7288('0x14')][_0x7288('0x16')]);}else{logger[_0x7288('0x10')](_0x7288('0x15'),_0x31f131,_0x7288('0x17'));_0x4f3408(_0x5176f6[_0x7288('0x18')][_0x7288('0x16')]);}})['catch'](function(_0x4e65cf){logger[_0x7288('0x14')]('FaxAccount,\x20%s,\x20%s',_0x31f131,_0x4e65cf);_0x2de89b(_0x4e65cf);});});}exports['GetFaxAccount']=function(_0x3a58d1){var _0x2d084f=this;return new Promise(function(_0x181f8d,_0x1487dd){return db[_0x7288('0x19')]['findAll']({'raw':_0x3a58d1['options']?_0x3a58d1['options']['raw']===undefined?!![]:![]:!![],'where':_0x3a58d1[_0x7288('0x1a')]?_0x3a58d1[_0x7288('0x1a')][_0x7288('0x1b')]||null:null,'attributes':_0x3a58d1['options']?_0x3a58d1[_0x7288('0x1a')]['attributes']||null:null,'limit':_0x3a58d1[_0x7288('0x1a')]?_0x3a58d1[_0x7288('0x1a')][_0x7288('0x1c')]||null:null,'include':_0x3a58d1['options']?_0x3a58d1[_0x7288('0x1a')][_0x7288('0x1d')]?_['map'](_0x3a58d1[_0x7288('0x1a')][_0x7288('0x1d')],function(_0x55e646){return{'model':db[_0x55e646[_0x7288('0x1e')]],'as':_0x55e646['as'],'attributes':_0x55e646[_0x7288('0x1f')],'include':_0x55e646['include']?_[_0x7288('0x20')](_0x55e646[_0x7288('0x1d')],function(_0xac289f){return{'model':db[_0xac289f['model']],'as':_0xac289f['as'],'attributes':_0xac289f[_0x7288('0x1f')],'include':_0xac289f[_0x7288('0x1d')]?_[_0x7288('0x20')](_0xac289f[_0x7288('0x1d')],function(_0x2f1687){return{'model':db[_0x2f1687[_0x7288('0x1e')]],'as':_0x2f1687['as'],'attributes':_0x2f1687['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x2d76f8){logger[_0x7288('0x10')](_0x7288('0x21'),_0x3a58d1);logger['debug'](_0x7288('0x21'),_0x3a58d1,JSON[_0x7288('0x13')](_0x2d76f8));_0x181f8d(_0x2d76f8);})['catch'](function(_0x553669){logger[_0x7288('0x14')](_0x7288('0x21'),_0x553669[_0x7288('0x16')],_0x3a58d1);_0x1487dd(_0x2d084f[_0x7288('0x14')](0x1f4,_0x553669[_0x7288('0x16')]));});});};exports[_0x7288('0x22')]=function(_0x5e9d37,_0x152fa8,_0x4227e2){var _0x2695ef=this;return new Promise(function(_0x3fcee1,_0x34ee7e){var _0xf4917a={'body':_0x5e9d37[_0x7288('0x23')],'channel':'fax'};var _0x138adb=[];var _0x5454da=[];var _0x47ad3c={};return db[_0x7288('0x24')][_0x7288('0x25')]()[_0x7288('0x26')](function(_0x57b578){if(!_0x57b578){throw new db[(_0x7288('0x27'))][(_0x7288('0x28'))](_0x7288('0x29'));}_0x138adb=_[_0x7288('0x2a')](_[_0x7288('0x2b')](_0x57b578),['createdAt',_0x7288('0x2c')]);_0x5454da=_[_0x7288('0x2a')](_[_0x7288('0x2b')](_0x57b578),[_0x7288('0x2d'),_0x7288('0x2c'),'CompanyId',_0x7288('0x2e')]);if(_0x5e9d37['body']['id']){delete _0x5e9d37[_0x7288('0x23')]['id'];}if(_['isNil'](_0x5e9d37[_0x7288('0x23')][_0x7288('0x2f')])){throw new db[(_0x7288('0x27'))][(_0x7288('0x28'))](_0x7288('0x30'));}if(_[_0x7288('0x31')](_0x5e9d37['body'][_0x7288('0x23')])||_0x5e9d37[_0x7288('0x23')][_0x7288('0x23')]===''){throw new db[(_0x7288('0x27'))][(_0x7288('0x28'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x7288('0x31')](_0x5e9d37[_0x7288('0x23')]['mapKey'])){throw new db[(_0x7288('0x27'))][(_0x7288('0x28'))](_0x7288('0x32')+_0x5454da);}if(!_[_0x7288('0x33')](_0x5454da,_0x5e9d37['body'][_0x7288('0x34')])){throw new db[(_0x7288('0x27'))][(_0x7288('0x28'))](_0x7288('0x35')+_0x5454da);}_0x47ad3c[_0x5e9d37['body'][_0x7288('0x34')]]=_0x5e9d37[_0x7288('0x23')][_0x7288('0x2f')];})[_0x7288('0x26')](function(){return db[_0x7288('0x19')][_0x7288('0x36')]({'where':{'id':_0x5e9d37[_0x7288('0x37')]['id']},'include':[{'model':db['CmList'],'as':_0x7288('0x38'),'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x47ad3c,'limit':0x1,'order':[[_0x7288('0x2c'),_0x7288('0x39')]]}]},{'model':db[_0x7288('0x3a')],'as':_0x7288('0x3b')}]});})[_0x7288('0x26')](function(_0x4b7fb6){if(_0x4b7fb6&&_0x4b7fb6[_0x7288('0x38')]){var _0x29db38=_0x4b7fb6['get']({'plain':!![]});_0xf4917a[_0x7288('0x37')]=_0x29db38;_0xf4917a[_0x7288('0x3c')]=_0x29db38[_0x7288('0x3b')];_0xf4917a[_0x7288('0x3d')]=_0x29db38['List'];_0xf4917a[_0x7288('0x3c')]=_['orderBy'](_0xf4917a[_0x7288('0x3c')],[_0x7288('0x3e')],[_0x7288('0x3f')]);if(_0xf4917a['account'][_0x7288('0x3b')]){delete _0xf4917a[_0x7288('0x37')][_0x7288('0x3b')];}if(_0xf4917a[_0x7288('0x37')][_0x7288('0x38')]&&_0xf4917a[_0x7288('0x37')][_0x7288('0x38')][_0x7288('0x40')][_0x7288('0x41')]){return _0xf4917a[_0x7288('0x37')][_0x7288('0x38')][_0x7288('0x40')][0x0];}var _0x122b0a=_[_0x7288('0xb')](_0x5e9d37['body'],{'firstName':_0x5e9d37[_0x7288('0x23')][_0x7288('0x2f')],'ListId':_0x29db38[_0x7288('0x2e')]});_0x122b0a[_0x5e9d37['body'][_0x7288('0x34')]]=_0x5e9d37[_0x7288('0x23')][_0x7288('0x2f')];return db['CmContact'][_0x7288('0x42')](_0x122b0a,{'fields':_0x138adb,'raw':!![]});}})['then'](function(_0x389689){_0xf4917a[_0x7288('0x43')]=_0x389689;if(_0x389689){var _0x5dd155={'ContactId':_0x389689['id'],'FaxAccountId':_0x5e9d37['account']['id'],'fax':_0x389689[_0x7288('0x44')]};return db[_0x7288('0x45')][_0x7288('0x36')]({'where':{'ContactId':_0x389689['id'],'closed':![],'FaxAccountId':_0x5e9d37[_0x7288('0x37')]['id']}})[_0x7288('0x26')](function(_0x11d6b9){if(_0x11d6b9){return[_0x11d6b9,![]];}return db[_0x7288('0x45')][_0x7288('0x42')](_0x5dd155)['then'](function(_0x22a3ca){return[_0x22a3ca,!![]];});});}else{throw new Error(_0x7288('0x46'));}})[_0x7288('0x47')](function(_0x28eb25,_0x52b3a8){var _0x619b1d=_0x28eb25[_0x7288('0x48')]({'plain':!![]});if(_0x52b3a8){if(_0xf4917a[_0x7288('0x37')][_0x7288('0x49')]){_0xf4917a['applications'][_0x7288('0x4a')]({'id':0x0,'priority':_0xf4917a[_0x7288('0x3c')]['length']+0x1,'app':'close','appdata':'unmanaged','interval':_0x7288('0x4b')});}_0x619b1d[_0x7288('0x4c')]=!![];}else{_0x619b1d[_0x7288('0x4c')]=![];}_0xf4917a[_0x7288('0x4d')]=_0x619b1d;return db['FaxMessage'][_0x7288('0x42')]({'body':_0x5e9d37[_0x7288('0x23')]['body'],'FaxAccountId':_0x5e9d37['account']['id'],'FaxInteractionId':_0x28eb25['id'],'direction':'in','ContactId':_0x28eb25[_0x7288('0x4e')],'AttachmentId':_0x5e9d37[_0x7288('0x23')][_0x7288('0x4f')]});})[_0x7288('0x26')](function(_0x58b3f7){_0xf4917a[_0x7288('0x16')]=_0x58b3f7;if(_0xf4917a[_0x7288('0x4d')]['UserId']){return db[_0x7288('0x50')]['find']({'attributes':['id','name'],'where':{'id':_0xf4917a[_0x7288('0x4d')]['UserId']}})[_0x7288('0x26')](function(_0x579860){if(_0x579860){_0xf4917a['applications'][_0x7288('0x51')]({'id':0x0,'priority':0x0,'app':_0x7288('0x52'),'appdata':_0x579860[_0x7288('0x53')]+','+(_0xf4917a[_0x7288('0x37')]['waitForTheAssignedAgent']||0xa),'interval':_0x7288('0x4b')});}return respondWithRpcPromise(_0x7288('0x54'),_0x7288('0x55'),_0xf4917a);});}return respondWithRpcPromise('Start',_0x7288('0x55'),_0xf4917a);})['then'](function(_0x1096d0){_0x3fcee1(_0x1096d0);})[_0x7288('0x56')](function(_0x35c5c9){_0x34ee7e(_0x2695ef['error'](0x1f4,_0x35c5c9[_0x7288('0x16')]));});});}; \ No newline at end of file +var _0x15de=['message','result','catch','GetFaxAccount','findAll','options','raw','where','limit','include','model','attributes','map','info','NotifyFaxAccount','body','fax','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','keys','updatedAt','difference','createdAt','ListId','isNil','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','from','FaxAccount','find','CmList','Contacts','FaxApplication','List','get','account','applications','list','orderBy','asc','Applications','length','create','FaxInteraction','Contact\x20not\x20found','spread','autoclose','push','close','*,*,*,*','created','interaction','ContactId','AttachmentId','UserId','User','name','unshift','agent','waitForTheAssignedAgent','Start','startRouting','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','register','request','then','FaxAccount,\x20%s,\x20%s','debug','FaxAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x2b63a0,_0x14fc48){var _0x4f0434=function(_0x8cba9e){while(--_0x8cba9e){_0x2b63a0['push'](_0x2b63a0['shift']());}};_0x4f0434(++_0x14fc48);}(_0x15de,0xf8));var _0xe15d=function(_0x5ff517,_0x3e4ee0){_0x5ff517=_0x5ff517-0x0;var _0x19a245=_0x15de[_0x5ff517];return _0x19a245;};'use strict';var _=require(_0xe15d('0x0'));var util=require(_0xe15d('0x1'));var moment=require(_0xe15d('0x2'));var BPromise=require(_0xe15d('0x3'));var rs=require(_0xe15d('0x4'));var fs=require('fs');var Redis=require(_0xe15d('0x5'));var db=require(_0xe15d('0x6'))['db'];var utils=require(_0xe15d('0x7'));var logger=require(_0xe15d('0x8'))(_0xe15d('0x9'));var config=require(_0xe15d('0xa'));var jayson=require(_0xe15d('0xb'));var client=jayson['client'][_0xe15d('0xc')]({'port':0x232c});config[_0xe15d('0xd')]=_[_0xe15d('0xe')](config[_0xe15d('0xd')],{'host':_0xe15d('0xf'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xe15d('0xd')]));require('./faxAccount.socket')[_0xe15d('0x10')](socket);function respondWithRpcPromise(_0x57996b,_0x1ca3d5,_0x518649){return new BPromise(function(_0x3b4a3a,_0x38d831){return client[_0xe15d('0x11')](_0x57996b,_0x518649)[_0xe15d('0x12')](function(_0x5f4bde){logger['info'](_0xe15d('0x13'),_0x1ca3d5,'request\x20sent');logger[_0xe15d('0x14')](_0xe15d('0x15'),_0x1ca3d5,_0xe15d('0x16'),JSON[_0xe15d('0x17')](_0x5f4bde));if(_0x5f4bde[_0xe15d('0x18')]){if(_0x5f4bde[_0xe15d('0x18')]['code']===0x1f4){logger[_0xe15d('0x18')](_0xe15d('0x13'),_0x1ca3d5,_0x5f4bde['error']['message']);return _0x38d831(_0x5f4bde['error'][_0xe15d('0x19')]);}logger['error'](_0xe15d('0x13'),_0x1ca3d5,_0x5f4bde[_0xe15d('0x18')][_0xe15d('0x19')]);return _0x3b4a3a(_0x5f4bde[_0xe15d('0x18')][_0xe15d('0x19')]);}else{logger['info']('FaxAccount,\x20%s,\x20%s',_0x1ca3d5,_0xe15d('0x16'));_0x3b4a3a(_0x5f4bde[_0xe15d('0x1a')][_0xe15d('0x19')]);}})[_0xe15d('0x1b')](function(_0x2e6bf1){logger[_0xe15d('0x18')](_0xe15d('0x13'),_0x1ca3d5,_0x2e6bf1);_0x38d831(_0x2e6bf1);});});}exports[_0xe15d('0x1c')]=function(_0x3c9146){var _0x2f04f6=this;return new Promise(function(_0x66d8b9,_0x2ff60e){return db['FaxAccount'][_0xe15d('0x1d')]({'raw':_0x3c9146[_0xe15d('0x1e')]?_0x3c9146[_0xe15d('0x1e')][_0xe15d('0x1f')]===undefined?!![]:![]:!![],'where':_0x3c9146[_0xe15d('0x1e')]?_0x3c9146[_0xe15d('0x1e')][_0xe15d('0x20')]||null:null,'attributes':_0x3c9146[_0xe15d('0x1e')]?_0x3c9146[_0xe15d('0x1e')]['attributes']||null:null,'limit':_0x3c9146[_0xe15d('0x1e')]?_0x3c9146[_0xe15d('0x1e')][_0xe15d('0x21')]||null:null,'include':_0x3c9146[_0xe15d('0x1e')]?_0x3c9146[_0xe15d('0x1e')][_0xe15d('0x22')]?_['map'](_0x3c9146[_0xe15d('0x1e')][_0xe15d('0x22')],function(_0x8cc27a){return{'model':db[_0x8cc27a[_0xe15d('0x23')]],'as':_0x8cc27a['as'],'attributes':_0x8cc27a[_0xe15d('0x24')],'include':_0x8cc27a[_0xe15d('0x22')]?_[_0xe15d('0x25')](_0x8cc27a['include'],function(_0x2f0add){return{'model':db[_0x2f0add[_0xe15d('0x23')]],'as':_0x2f0add['as'],'attributes':_0x2f0add['attributes'],'include':_0x2f0add[_0xe15d('0x22')]?_[_0xe15d('0x25')](_0x2f0add[_0xe15d('0x22')],function(_0x26be2c){return{'model':db[_0x26be2c['model']],'as':_0x26be2c['as'],'attributes':_0x26be2c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x351b9b){logger[_0xe15d('0x26')](_0xe15d('0x1c'),_0x3c9146);logger['debug'](_0xe15d('0x1c'),_0x3c9146,JSON[_0xe15d('0x17')](_0x351b9b));_0x66d8b9(_0x351b9b);})[_0xe15d('0x1b')](function(_0x133b92){logger[_0xe15d('0x18')](_0xe15d('0x1c'),_0x133b92[_0xe15d('0x19')],_0x3c9146);_0x2ff60e(_0x2f04f6[_0xe15d('0x18')](0x1f4,_0x133b92['message']));});});};exports[_0xe15d('0x27')]=function(_0x5f322a,_0x2ba7c8,_0x27e8d6){var _0x2afca0=this;return new Promise(function(_0x267d31,_0x430985){var _0x1e07da={'body':_0x5f322a[_0xe15d('0x28')],'channel':_0xe15d('0x29')};var _0x694de3=[];var _0xbda8ca=[];var _0x590c2c={};return db[_0xe15d('0x2a')]['describe']()[_0xe15d('0x12')](function(_0x5d49d1){if(!_0x5d49d1){throw new db[(_0xe15d('0x2b'))][(_0xe15d('0x2c'))](_0xe15d('0x2d'));}_0x694de3=_['difference'](_[_0xe15d('0x2e')](_0x5d49d1),['createdAt',_0xe15d('0x2f')]);_0xbda8ca=_[_0xe15d('0x30')](_[_0xe15d('0x2e')](_0x5d49d1),[_0xe15d('0x31'),_0xe15d('0x2f'),'CompanyId',_0xe15d('0x32')]);if(_0x5f322a[_0xe15d('0x28')]['id']){delete _0x5f322a[_0xe15d('0x28')]['id'];}if(_[_0xe15d('0x33')](_0x5f322a[_0xe15d('0x28')]['from'])){throw new db[(_0xe15d('0x2b'))][(_0xe15d('0x2c'))]('from\x20is\x20mandatory');}if(_[_0xe15d('0x33')](_0x5f322a[_0xe15d('0x28')][_0xe15d('0x28')])||_0x5f322a[_0xe15d('0x28')]['body']===''){throw new db['Sequelize'][(_0xe15d('0x2c'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xe15d('0x33')](_0x5f322a['body'][_0xe15d('0x34')])){throw new db[(_0xe15d('0x2b'))][(_0xe15d('0x2c'))](_0xe15d('0x35')+_0xbda8ca);}if(!_[_0xe15d('0x36')](_0xbda8ca,_0x5f322a[_0xe15d('0x28')]['mapKey'])){throw new db[(_0xe15d('0x2b'))][(_0xe15d('0x2c'))](_0xe15d('0x37')+_0xbda8ca);}_0x590c2c[_0x5f322a[_0xe15d('0x28')][_0xe15d('0x34')]]=_0x5f322a[_0xe15d('0x28')][_0xe15d('0x38')];})[_0xe15d('0x12')](function(){return db[_0xe15d('0x39')][_0xe15d('0x3a')]({'where':{'id':_0x5f322a['account']['id']},'include':[{'model':db[_0xe15d('0x3b')],'as':'List','include':[{'model':db[_0xe15d('0x2a')],'as':_0xe15d('0x3c'),'where':_0x590c2c,'limit':0x1,'order':[[_0xe15d('0x2f'),'DESC']]}]},{'model':db[_0xe15d('0x3d')],'as':'Applications'}]});})['then'](function(_0x6db00c){if(_0x6db00c&&_0x6db00c[_0xe15d('0x3e')]){var _0x129a77=_0x6db00c[_0xe15d('0x3f')]({'plain':!![]});_0x1e07da[_0xe15d('0x40')]=_0x129a77;_0x1e07da[_0xe15d('0x41')]=_0x129a77['Applications'];_0x1e07da[_0xe15d('0x42')]=_0x129a77[_0xe15d('0x3e')];_0x1e07da[_0xe15d('0x41')]=_[_0xe15d('0x43')](_0x1e07da[_0xe15d('0x41')],['priority'],[_0xe15d('0x44')]);if(_0x1e07da[_0xe15d('0x40')][_0xe15d('0x45')]){delete _0x1e07da[_0xe15d('0x40')][_0xe15d('0x45')];}if(_0x1e07da['account'][_0xe15d('0x3e')]&&_0x1e07da[_0xe15d('0x40')]['List'][_0xe15d('0x3c')][_0xe15d('0x46')]){return _0x1e07da[_0xe15d('0x40')][_0xe15d('0x3e')]['Contacts'][0x0];}var _0x345796=_[_0xe15d('0xe')](_0x5f322a[_0xe15d('0x28')],{'firstName':_0x5f322a[_0xe15d('0x28')]['from'],'ListId':_0x129a77[_0xe15d('0x32')]});_0x345796[_0x5f322a[_0xe15d('0x28')][_0xe15d('0x34')]]=_0x5f322a['body'][_0xe15d('0x38')];return db[_0xe15d('0x2a')][_0xe15d('0x47')](_0x345796,{'fields':_0x694de3,'raw':!![]});}})[_0xe15d('0x12')](function(_0x1459fc){_0x1e07da['contact']=_0x1459fc;if(_0x1459fc){var _0x3f333e={'ContactId':_0x1459fc['id'],'FaxAccountId':_0x5f322a['account']['id'],'fax':_0x1459fc['fax']};return db[_0xe15d('0x48')][_0xe15d('0x3a')]({'where':{'ContactId':_0x1459fc['id'],'closed':![],'FaxAccountId':_0x5f322a[_0xe15d('0x40')]['id']}})[_0xe15d('0x12')](function(_0x34eb97){if(_0x34eb97){return[_0x34eb97,![]];}return db[_0xe15d('0x48')]['create'](_0x3f333e)[_0xe15d('0x12')](function(_0x55808d){return[_0x55808d,!![]];});});}else{throw new Error(_0xe15d('0x49'));}})[_0xe15d('0x4a')](function(_0x1697fc,_0x315ea6){var _0x52fef2=_0x1697fc[_0xe15d('0x3f')]({'plain':!![]});if(_0x315ea6){if(_0x1e07da[_0xe15d('0x40')][_0xe15d('0x4b')]){_0x1e07da[_0xe15d('0x41')][_0xe15d('0x4c')]({'id':0x0,'priority':_0x1e07da[_0xe15d('0x41')][_0xe15d('0x46')]+0x1,'app':_0xe15d('0x4d'),'appdata':'unmanaged','interval':_0xe15d('0x4e')});}_0x52fef2['created']=!![];}else{_0x52fef2[_0xe15d('0x4f')]=![];}_0x1e07da[_0xe15d('0x50')]=_0x52fef2;return db['FaxMessage']['create']({'body':_0x5f322a[_0xe15d('0x28')][_0xe15d('0x28')],'FaxAccountId':_0x5f322a[_0xe15d('0x40')]['id'],'FaxInteractionId':_0x1697fc['id'],'direction':'in','ContactId':_0x1697fc[_0xe15d('0x51')],'AttachmentId':_0x5f322a[_0xe15d('0x28')][_0xe15d('0x52')]});})[_0xe15d('0x12')](function(_0x25d090){_0x1e07da[_0xe15d('0x19')]=_0x25d090;if(_0x1e07da[_0xe15d('0x50')][_0xe15d('0x53')]){return db[_0xe15d('0x54')]['find']({'attributes':['id',_0xe15d('0x55')],'where':{'id':_0x1e07da[_0xe15d('0x50')][_0xe15d('0x53')]}})[_0xe15d('0x12')](function(_0x224da9){if(_0x224da9){_0x1e07da[_0xe15d('0x41')][_0xe15d('0x56')]({'id':0x0,'priority':0x0,'app':_0xe15d('0x57'),'appdata':_0x224da9[_0xe15d('0x55')]+','+(_0x1e07da[_0xe15d('0x40')][_0xe15d('0x58')]||0xa),'interval':_0xe15d('0x4e')});}return respondWithRpcPromise(_0xe15d('0x59'),_0xe15d('0x5a'),_0x1e07da);});}return respondWithRpcPromise('Start',_0xe15d('0x5a'),_0x1e07da);})[_0xe15d('0x12')](function(_0x27a93e){_0x267d31(_0x27a93e);})[_0xe15d('0x1b')](function(_0x3250ad){_0x430985(_0x2afca0['error'](0x1f4,_0x3250ad['message']));});});}; \ No newline at end of file diff --git a/server/api/faxAccount/faxAccount.socket.js b/server/api/faxAccount/faxAccount.socket.js index f720866..659d749 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 _0x0bef=['./faxAccount.events','save','remove','update','emit','length','faxAccount:'];(function(_0x4af2c8,_0x48d75b){var _0x2d6872=function(_0x54ef43){while(--_0x54ef43){_0x4af2c8['push'](_0x4af2c8['shift']());}};_0x2d6872(++_0x48d75b);}(_0x0bef,0x157));var _0xf0be=function(_0x353c7f,_0x1d2111){_0x353c7f=_0x353c7f-0x0;var _0x5074c1=_0x0bef[_0x353c7f];return _0x5074c1;};'use strict';var FaxAccountEvents=require(_0xf0be('0x0'));var events=[_0xf0be('0x1'),_0xf0be('0x2'),_0xf0be('0x3')];function createListener(_0x299c71,_0x3237d6){return function(_0x43da97){_0x3237d6[_0xf0be('0x4')](_0x299c71,_0x43da97);};}function removeListener(_0x2bfb56,_0x4d593b){return function(){FaxAccountEvents['removeListener'](_0x2bfb56,_0x4d593b);};}exports['register']=function(_0x121d0a){for(var _0x1d30ae=0x0,_0x3e52d6=events[_0xf0be('0x5')];_0x1d30ae<_0x3e52d6;_0x1d30ae++){var _0x28da00=events[_0x1d30ae];var _0x16f7ae=createListener(_0xf0be('0x6')+_0x28da00,_0x121d0a);FaxAccountEvents['on'](_0x28da00,_0x16f7ae);}}; \ No newline at end of file +var _0x3437=['save','remove','update','register','length','faxAccount:','./faxAccount.events'];(function(_0xe8ffa1,_0x2bad01){var _0x3fee0d=function(_0x27dffb){while(--_0x27dffb){_0xe8ffa1['push'](_0xe8ffa1['shift']());}};_0x3fee0d(++_0x2bad01);}(_0x3437,0x1db));var _0x7343=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0x3437[_0x17d9e3];return _0x14192d;};'use strict';var FaxAccountEvents=require(_0x7343('0x0'));var events=[_0x7343('0x1'),_0x7343('0x2'),_0x7343('0x3')];function createListener(_0x2d821d,_0x1d4b02){return function(_0x20216a){_0x1d4b02['emit'](_0x2d821d,_0x20216a);};}function removeListener(_0xb0a437,_0x520a80){return function(){FaxAccountEvents['removeListener'](_0xb0a437,_0x520a80);};}exports[_0x7343('0x4')]=function(_0x2d2f60){for(var _0x75ee9c=0x0,_0x3ab455=events[_0x7343('0x5')];_0x75ee9c<_0x3ab455;_0x75ee9c++){var _0x6410a1=events[_0x75ee9c];var _0x38ce79=createListener(_0x7343('0x6')+_0x6410a1,_0x2d2f60);FaxAccountEvents['on'](_0x6410a1,_0x38ce79);}}; \ No newline at end of file diff --git a/server/api/faxAccount/index.js b/server/api/faxAccount/index.js index bd526a5..5f8ccd3 100644 --- a/server/api/faxAccount/index.js +++ b/server/api/faxAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x449b4e,_0x1ab937){var _0x32e387=function(_0x2b211e){while(--_0x2b211e){_0x449b4e['push'](_0x449b4e['shift']());}};_0x32e387(++_0x1ab937);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxAccount.controller','get','index','/describe','show','/:id/dispositions','isAuthenticated','getDispositions','/:id/interactions','getInteractions','/:id/applications','/:id/messages','getMessages','/:id/users','getAgents','post','addDisposition','/:id/canned_answers','addAnswer','addInteraction','addApplications','addAccountApplications','/updateaccountapplications','/:id/send','send','addAgents','put','/:id','update','destroy','delete','removeDispositions','removeAnswers','removeAgents','exports','multer','util','path'];(function(_0x5cf236,_0x5dcc97){var _0x3ef894=function(_0x18af95){while(--_0x18af95){_0x5cf236['push'](_0x5cf236['shift']());}};_0x3ef894(++_0x5dcc97);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['describe']);router[_0x0a9e('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/canned_answers',auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getApplications']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['post']('/',auth[_0x0a9e('0xd')](),controller['create']);router[_0x0a9e('0x16')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router['post'](_0x0a9e('0x18'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x16')](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1a')]);router[_0x0a9e('0x16')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x16')]('/addaccountapplications',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router['post'](_0x0a9e('0x1d'),auth['isAuthenticated'](),controller['updateAccountApplications']);router[_0x0a9e('0x16')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['post'](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0x22'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router['delete']('/:id',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x24')]);router[_0x0a9e('0x25')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x26')]);router['delete'](_0x0a9e('0x18'),auth['isAuthenticated'](),controller[_0x0a9e('0x27')]);router[_0x0a9e('0x25')](_0x0a9e('0x14'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x28')]);module[_0x0a9e('0x29')]=router; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.attributes.js b/server/api/faxApplication/faxApplication.attributes.js index 888b04c..155a879 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 _0x2121=['exports','INTEGER','noop','TEXT','STRING'];(function(_0x207e7e,_0x2711d8){var _0xb5d06=function(_0x2e6daf){while(--_0x2e6daf){_0x207e7e['push'](_0x207e7e['shift']());}};_0xb5d06(++_0x2711d8);}(_0x2121,0x10e));var _0x1212=function(_0xba9c91,_0x3c03c2){_0xba9c91=_0xba9c91-0x0;var _0x12620e=_0x2121[_0xba9c91];return _0x12620e;};'use strict';var Sequelize=require('sequelize');module[_0x1212('0x0')]={'priority':{'type':Sequelize[_0x1212('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x1212('0x2')},'appdata':{'type':Sequelize[_0x1212('0x3')]()},'description':{'type':Sequelize[_0x1212('0x4')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x4cb1=['STRING','noop','TEXT','INTEGER'];(function(_0x2c16d6,_0x528b2a){var _0x101fa7=function(_0x416672){while(--_0x416672){_0x2c16d6['push'](_0x2c16d6['shift']());}};_0x101fa7(++_0x528b2a);}(_0x4cb1,0x167));var _0x14cb=function(_0x8cdad8,_0x5a2b10){_0x8cdad8=_0x8cdad8-0x0;var _0x34adad=_0x4cb1[_0x8cdad8];return _0x34adad;};'use strict';var Sequelize=require('sequelize');module['exports']={'priority':{'type':Sequelize[_0x14cb('0x0')],'allowNull':![]},'app':{'type':Sequelize[_0x14cb('0x1')],'allowNull':![],'defaultValue':_0x14cb('0x2')},'appdata':{'type':Sequelize[_0x14cb('0x3')]()},'description':{'type':Sequelize[_0x14cb('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.controller.js b/server/api/faxApplication/faxApplication.controller.js index 395624b..f856054 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 _0x93aa=['name','send','index','map','FaxApplication','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','findAll','catch','show','includeAll','find','create','body','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack'];(function(_0x454c76,_0xd64c7e){var _0x257a2f=function(_0x2b1469){while(--_0x2b1469){_0x454c76['push'](_0x454c76['shift']());}};_0x257a2f(++_0xd64c7e);}(_0x93aa,0x71));var _0xa93a=function(_0x2a350d,_0x379c06){_0x2a350d=_0x2a350d-0x0;var _0x43772d=_0x93aa[_0x2a350d];return _0x43772d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa93a('0x0'));var zipdir=require(_0xa93a('0x1'));var jsonpatch=require(_0xa93a('0x2'));var rp=require(_0xa93a('0x3'));var moment=require(_0xa93a('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xa93a('0x5'));var path=require(_0xa93a('0x6'));var sox=require(_0xa93a('0x7'));var csv=require(_0xa93a('0x8'));var ejs=require(_0xa93a('0x9'));var fs=require('fs');var fs_extra=require(_0xa93a('0xa'));var _=require('lodash');var squel=require(_0xa93a('0xb'));var crypto=require(_0xa93a('0xc'));var jsforce=require(_0xa93a('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa93a('0xe'));var Papa=require(_0xa93a('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xa93a('0x10'));var as=require(_0xa93a('0x11'));var hardwareService=require(_0xa93a('0x12'));var logger=require(_0xa93a('0x13'))(_0xa93a('0x14'));var utils=require(_0xa93a('0x15'));var config=require(_0xa93a('0x16'));var licenseUtil=require(_0xa93a('0x17'));var db=require(_0xa93a('0x18'))['db'];function respondWithStatusCode(_0x327c6b,_0x171288){_0x171288=_0x171288||0xcc;return function(_0x6ed96){if(_0x6ed96){return _0x327c6b[_0xa93a('0x19')](_0x171288);}return _0x327c6b[_0xa93a('0x1a')](_0x171288)[_0xa93a('0x1b')]();};}function respondWithResult(_0x1e488d,_0x11ae4e){_0x11ae4e=_0x11ae4e||0xc8;return function(_0x5ea025){if(_0x5ea025){return _0x1e488d['status'](_0x11ae4e)[_0xa93a('0x1c')](_0x5ea025);}};}function respondWithFilteredResult(_0x2a0594,_0x5439a7){return function(_0x20cea3){if(_0x20cea3){var _0x3998b0=typeof _0x5439a7[_0xa93a('0x1d')]===_0xa93a('0x1e')&&typeof _0x5439a7[_0xa93a('0x1f')]===_0xa93a('0x1e');var _0x3b066c=_0x20cea3[_0xa93a('0x20')];var _0x58c360=_0x3998b0?0x0:_0x5439a7[_0xa93a('0x1d')];var _0x579791=_0x3998b0?_0x20cea3[_0xa93a('0x20')]:_0x5439a7[_0xa93a('0x1d')]+_0x5439a7['limit'];var _0x2da2a5;if(_0x579791>=_0x3b066c){_0x579791=_0x3b066c;_0x2da2a5=0xc8;}else{_0x2da2a5=0xce;}_0x2a0594[_0xa93a('0x1a')](_0x2da2a5);return _0x2a0594['set'](_0xa93a('0x21'),_0x58c360+'-'+_0x579791+'/'+_0x3b066c)['json'](_0x20cea3);}return null;};}function patchUpdates(_0x58249d){return function(_0x4767ea){try{jsonpatch[_0xa93a('0x22')](_0x4767ea,_0x58249d,!![]);}catch(_0x118b69){return BPromise[_0xa93a('0x23')](_0x118b69);}return _0x4767ea[_0xa93a('0x24')]();};}function saveUpdates(_0x24bd39,_0x4a7461){return function(_0x4beab2){if(_0x4beab2){return _0x4beab2[_0xa93a('0x25')](_0x24bd39)[_0xa93a('0x26')](function(_0x1a5512){return _0x1a5512;});}return null;};}function removeEntity(_0x5afc21,_0x1388a4){return function(_0x31b966){if(_0x31b966){return _0x31b966[_0xa93a('0x27')]()[_0xa93a('0x26')](function(){_0x5afc21[_0xa93a('0x1a')](0xcc)[_0xa93a('0x1b')]();});}};}function handleEntityNotFound(_0x4fbecf,_0x10f090){return function(_0x3838d5){if(!_0x3838d5){_0x4fbecf[_0xa93a('0x19')](0x194);}return _0x3838d5;};}function handleError(_0x12d77f,_0x15c00e){_0x15c00e=_0x15c00e||0x1f4;return function(_0x26a3d5){logger['error'](_0x26a3d5[_0xa93a('0x28')]);if(_0x26a3d5['name']){delete _0x26a3d5[_0xa93a('0x29')];}_0x12d77f['status'](_0x15c00e)[_0xa93a('0x2a')](_0x26a3d5);};}exports[_0xa93a('0x2b')]=function(_0x346c50,_0x42ccb0){var _0x3c5faa={},_0x1c2ec9={},_0x3ed3dd={'count':0x0,'rows':[]};var _0x3eda8d=_[_0xa93a('0x2c')](db[_0xa93a('0x2d')][_0xa93a('0x2e')],function(_0x144991){return{'name':_0x144991[_0xa93a('0x2f')],'type':_0x144991[_0xa93a('0x30')][_0xa93a('0x31')]};});_0x1c2ec9[_0xa93a('0x32')]=_[_0xa93a('0x2c')](_0x3eda8d,'name');_0x1c2ec9[_0xa93a('0x33')]=_[_0xa93a('0x34')](_0x346c50[_0xa93a('0x33')]);_0x1c2ec9[_0xa93a('0x35')]=_[_0xa93a('0x36')](_0x1c2ec9[_0xa93a('0x32')],_0x1c2ec9['query']);_0x3c5faa[_0xa93a('0x37')]=_[_0xa93a('0x36')](_0x1c2ec9[_0xa93a('0x32')],qs[_0xa93a('0x38')](_0x346c50[_0xa93a('0x33')]['fields']));_0x3c5faa[_0xa93a('0x37')]=_0x3c5faa[_0xa93a('0x37')][_0xa93a('0x39')]?_0x3c5faa[_0xa93a('0x37')]:_0x1c2ec9[_0xa93a('0x32')];if(!_0x346c50[_0xa93a('0x33')][_0xa93a('0x3a')](_0xa93a('0x3b'))){_0x3c5faa[_0xa93a('0x1f')]=qs[_0xa93a('0x1f')](_0x346c50[_0xa93a('0x33')][_0xa93a('0x1f')]);_0x3c5faa[_0xa93a('0x1d')]=qs[_0xa93a('0x1d')](_0x346c50[_0xa93a('0x33')][_0xa93a('0x1d')]);}_0x3c5faa[_0xa93a('0x3c')]=qs[_0xa93a('0x3d')](_0x346c50[_0xa93a('0x33')][_0xa93a('0x3d')]);_0x3c5faa[_0xa93a('0x3e')]=qs[_0xa93a('0x35')](_[_0xa93a('0x3f')](_0x346c50[_0xa93a('0x33')],_0x1c2ec9['filters']),_0x3eda8d);if(_0x346c50[_0xa93a('0x33')][_0xa93a('0x40')]){_0x3c5faa[_0xa93a('0x3e')]=_['merge'](_0x3c5faa['where'],{'$or':_['map'](_0x3eda8d,function(_0x2570d9){if(_0x2570d9['type']!==_0xa93a('0x41')){var _0x3fe7d0={};_0x3fe7d0[_0x2570d9['name']]={'$like':'%'+_0x346c50[_0xa93a('0x33')][_0xa93a('0x40')]+'%'};return _0x3fe7d0;}})});}_0x3c5faa=_[_0xa93a('0x42')]({},_0x3c5faa,_0x346c50[_0xa93a('0x43')]);var _0x85b600={'where':_0x3c5faa['where']};return db[_0xa93a('0x2d')][_0xa93a('0x20')](_0x85b600)[_0xa93a('0x26')](function(_0x5d054f){_0x3ed3dd[_0xa93a('0x20')]=_0x5d054f;if(_0x346c50[_0xa93a('0x33')]['includeAll']){_0x3c5faa[_0xa93a('0x44')]=[{'all':!![]}];}return db['FaxApplication'][_0xa93a('0x45')](_0x3c5faa);})[_0xa93a('0x26')](function(_0xe53e35){_0x3ed3dd['rows']=_0xe53e35;return _0x3ed3dd;})[_0xa93a('0x26')](respondWithFilteredResult(_0x42ccb0,_0x3c5faa))[_0xa93a('0x46')](handleError(_0x42ccb0,null));};exports[_0xa93a('0x47')]=function(_0x19ae2c,_0x15e7de){var _0x48f6d2={'raw':!![],'where':{'id':_0x19ae2c['params']['id']}},_0x15adf6={};_0x15adf6[_0xa93a('0x32')]=_[_0xa93a('0x34')](db['FaxApplication'][_0xa93a('0x2e')]);_0x15adf6[_0xa93a('0x33')]=_['keys'](_0x19ae2c['query']);_0x15adf6['filters']=_[_0xa93a('0x36')](_0x15adf6['model'],_0x15adf6[_0xa93a('0x33')]);_0x48f6d2[_0xa93a('0x37')]=_[_0xa93a('0x36')](_0x15adf6[_0xa93a('0x32')],qs[_0xa93a('0x38')](_0x19ae2c[_0xa93a('0x33')]['fields']));_0x48f6d2[_0xa93a('0x37')]=_0x48f6d2['attributes'][_0xa93a('0x39')]?_0x48f6d2['attributes']:_0x15adf6[_0xa93a('0x32')];if(_0x19ae2c[_0xa93a('0x33')][_0xa93a('0x48')]){_0x48f6d2[_0xa93a('0x44')]=[{'all':!![]}];}_0x48f6d2=_[_0xa93a('0x42')]({},_0x48f6d2,_0x19ae2c[_0xa93a('0x43')]);return db[_0xa93a('0x2d')][_0xa93a('0x49')](_0x48f6d2)[_0xa93a('0x26')](handleEntityNotFound(_0x15e7de,null))[_0xa93a('0x26')](respondWithResult(_0x15e7de,null))[_0xa93a('0x46')](handleError(_0x15e7de,null));};exports[_0xa93a('0x4a')]=function(_0x6979c5,_0x5e0f60){return db[_0xa93a('0x2d')][_0xa93a('0x4a')](_0x6979c5[_0xa93a('0x4b')],{})[_0xa93a('0x26')](respondWithResult(_0x5e0f60,0xc9))['catch'](handleError(_0x5e0f60,null));};exports[_0xa93a('0x25')]=function(_0x50ffe3,_0x4b3fa6){if(_0x50ffe3['body']['id']){delete _0x50ffe3[_0xa93a('0x4b')]['id'];}return db[_0xa93a('0x2d')][_0xa93a('0x49')]({'where':{'id':_0x50ffe3[_0xa93a('0x4c')]['id']}})[_0xa93a('0x26')](handleEntityNotFound(_0x4b3fa6,null))[_0xa93a('0x26')](saveUpdates(_0x50ffe3[_0xa93a('0x4b')],null))['then'](respondWithResult(_0x4b3fa6,null))[_0xa93a('0x46')](handleError(_0x4b3fa6,null));};exports[_0xa93a('0x27')]=function(_0x318fb9,_0x219916){return db[_0xa93a('0x2d')]['find']({'where':{'id':_0x318fb9[_0xa93a('0x4c')]['id']}})[_0xa93a('0x26')](handleEntityNotFound(_0x219916,null))[_0xa93a('0x26')](removeEntity(_0x219916,null))[_0xa93a('0x46')](handleError(_0x219916,null));}; \ No newline at end of file +var _0x173e=['body','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','FaxApplication','rawAttributes','fieldName','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','options','find','create'];(function(_0x3da737,_0x479af5){var _0x4d3f2d=function(_0x1bb93a){while(--_0x1bb93a){_0x3da737['push'](_0x3da737['shift']());}};_0x4d3f2d(++_0x479af5);}(_0x173e,0x9f));var _0xe173=function(_0x1dfd0a,_0x357cc2){_0x1dfd0a=_0x1dfd0a-0x0;var _0x3586e9=_0x173e[_0x1dfd0a];return _0x3586e9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe173('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe173('0x1'));var rp=require(_0xe173('0x2'));var moment=require(_0xe173('0x3'));var BPromise=require(_0xe173('0x4'));var Mustache=require(_0xe173('0x5'));var util=require(_0xe173('0x6'));var path=require(_0xe173('0x7'));var sox=require(_0xe173('0x8'));var csv=require(_0xe173('0x9'));var ejs=require(_0xe173('0xa'));var fs=require('fs');var fs_extra=require(_0xe173('0xb'));var _=require(_0xe173('0xc'));var squel=require(_0xe173('0xd'));var crypto=require('crypto');var jsforce=require(_0xe173('0xe'));var deskjs=require(_0xe173('0xf'));var toCsv=require(_0xe173('0x9'));var querystring=require(_0xe173('0x10'));var Papa=require(_0xe173('0x11'));var Redis=require(_0xe173('0x12'));var authService=require(_0xe173('0x13'));var qs=require(_0xe173('0x14'));var as=require(_0xe173('0x15'));var hardwareService=require(_0xe173('0x16'));var logger=require('../../config/logger')(_0xe173('0x17'));var utils=require(_0xe173('0x18'));var config=require(_0xe173('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0xe173('0x1a'))['db'];function respondWithStatusCode(_0x8998d4,_0x51f2c2){_0x51f2c2=_0x51f2c2||0xcc;return function(_0xd31aa3){if(_0xd31aa3){return _0x8998d4[_0xe173('0x1b')](_0x51f2c2);}return _0x8998d4[_0xe173('0x1c')](_0x51f2c2)[_0xe173('0x1d')]();};}function respondWithResult(_0x50ea27,_0x55510e){_0x55510e=_0x55510e||0xc8;return function(_0x4ea97e){if(_0x4ea97e){return _0x50ea27[_0xe173('0x1c')](_0x55510e)[_0xe173('0x1e')](_0x4ea97e);}};}function respondWithFilteredResult(_0x1cadd5,_0x55386e){return function(_0x45b1f2){if(_0x45b1f2){var _0x3c2fe0=typeof _0x55386e[_0xe173('0x1f')]===_0xe173('0x20')&&typeof _0x55386e[_0xe173('0x21')]===_0xe173('0x20');var _0x50f410=_0x45b1f2[_0xe173('0x22')];var _0x4d80cf=_0x3c2fe0?0x0:_0x55386e[_0xe173('0x1f')];var _0xffccef=_0x3c2fe0?_0x45b1f2[_0xe173('0x22')]:_0x55386e[_0xe173('0x1f')]+_0x55386e[_0xe173('0x21')];var _0x2805c0;if(_0xffccef>=_0x50f410){_0xffccef=_0x50f410;_0x2805c0=0xc8;}else{_0x2805c0=0xce;}_0x1cadd5[_0xe173('0x1c')](_0x2805c0);return _0x1cadd5[_0xe173('0x23')](_0xe173('0x24'),_0x4d80cf+'-'+_0xffccef+'/'+_0x50f410)[_0xe173('0x1e')](_0x45b1f2);}return null;};}function patchUpdates(_0x36917a){return function(_0x446818){try{jsonpatch[_0xe173('0x25')](_0x446818,_0x36917a,!![]);}catch(_0x514b9d){return BPromise[_0xe173('0x26')](_0x514b9d);}return _0x446818[_0xe173('0x27')]();};}function saveUpdates(_0x4a868c,_0x24f93f){return function(_0x5f5473){if(_0x5f5473){return _0x5f5473[_0xe173('0x28')](_0x4a868c)[_0xe173('0x29')](function(_0x559489){return _0x559489;});}return null;};}function removeEntity(_0x385d1d,_0x26a74f){return function(_0x4027f1){if(_0x4027f1){return _0x4027f1[_0xe173('0x2a')]()['then'](function(){_0x385d1d[_0xe173('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x573b70,_0x599684){return function(_0x55ecf7){if(!_0x55ecf7){_0x573b70[_0xe173('0x1b')](0x194);}return _0x55ecf7;};}function handleError(_0x1d51c7,_0x363dc4){_0x363dc4=_0x363dc4||0x1f4;return function(_0xfc55d2){logger[_0xe173('0x2b')](_0xfc55d2[_0xe173('0x2c')]);if(_0xfc55d2[_0xe173('0x2d')]){delete _0xfc55d2['name'];}_0x1d51c7[_0xe173('0x1c')](_0x363dc4)[_0xe173('0x2e')](_0xfc55d2);};}exports[_0xe173('0x2f')]=function(_0x2ecf7f,_0x4d5621){var _0x28dcec={},_0x40cea0={},_0x441252={'count':0x0,'rows':[]};var _0x30ad17=_[_0xe173('0x30')](db[_0xe173('0x31')][_0xe173('0x32')],function(_0x58bfa9){return{'name':_0x58bfa9[_0xe173('0x33')],'type':_0x58bfa9['type'][_0xe173('0x34')]};});_0x40cea0['model']=_['map'](_0x30ad17,_0xe173('0x2d'));_0x40cea0[_0xe173('0x35')]=_['keys'](_0x2ecf7f['query']);_0x40cea0['filters']=_['intersection'](_0x40cea0[_0xe173('0x36')],_0x40cea0['query']);_0x28dcec[_0xe173('0x37')]=_[_0xe173('0x38')](_0x40cea0[_0xe173('0x36')],qs['fields'](_0x2ecf7f[_0xe173('0x35')][_0xe173('0x39')]));_0x28dcec[_0xe173('0x37')]=_0x28dcec[_0xe173('0x37')][_0xe173('0x3a')]?_0x28dcec[_0xe173('0x37')]:_0x40cea0['model'];if(!_0x2ecf7f[_0xe173('0x35')][_0xe173('0x3b')](_0xe173('0x3c'))){_0x28dcec['limit']=qs[_0xe173('0x21')](_0x2ecf7f[_0xe173('0x35')][_0xe173('0x21')]);_0x28dcec[_0xe173('0x1f')]=qs[_0xe173('0x1f')](_0x2ecf7f[_0xe173('0x35')][_0xe173('0x1f')]);}_0x28dcec[_0xe173('0x3d')]=qs[_0xe173('0x3e')](_0x2ecf7f[_0xe173('0x35')][_0xe173('0x3e')]);_0x28dcec[_0xe173('0x3f')]=qs[_0xe173('0x40')](_['pick'](_0x2ecf7f[_0xe173('0x35')],_0x40cea0[_0xe173('0x40')]),_0x30ad17);if(_0x2ecf7f['query']['filter']){_0x28dcec['where']=_[_0xe173('0x41')](_0x28dcec[_0xe173('0x3f')],{'$or':_[_0xe173('0x30')](_0x30ad17,function(_0x1fcf0a){if(_0x1fcf0a['type']!==_0xe173('0x42')){var _0x2a3943={};_0x2a3943[_0x1fcf0a[_0xe173('0x2d')]]={'$like':'%'+_0x2ecf7f[_0xe173('0x35')]['filter']+'%'};return _0x2a3943;}})});}_0x28dcec=_['merge']({},_0x28dcec,_0x2ecf7f['options']);var _0x396e62={'where':_0x28dcec[_0xe173('0x3f')]};return db[_0xe173('0x31')][_0xe173('0x22')](_0x396e62)[_0xe173('0x29')](function(_0x6b94a2){_0x441252['count']=_0x6b94a2;if(_0x2ecf7f['query'][_0xe173('0x43')]){_0x28dcec[_0xe173('0x44')]=[{'all':!![]}];}return db['FaxApplication'][_0xe173('0x45')](_0x28dcec);})[_0xe173('0x29')](function(_0x291d28){_0x441252[_0xe173('0x46')]=_0x291d28;return _0x441252;})[_0xe173('0x29')](respondWithFilteredResult(_0x4d5621,_0x28dcec))[_0xe173('0x47')](handleError(_0x4d5621,null));};exports[_0xe173('0x48')]=function(_0x54c85a,_0x4db535){var _0x228b8d={'raw':!![],'where':{'id':_0x54c85a[_0xe173('0x49')]['id']}},_0x412faf={};_0x412faf[_0xe173('0x36')]=_[_0xe173('0x4a')](db[_0xe173('0x31')][_0xe173('0x32')]);_0x412faf[_0xe173('0x35')]=_[_0xe173('0x4a')](_0x54c85a[_0xe173('0x35')]);_0x412faf['filters']=_[_0xe173('0x38')](_0x412faf[_0xe173('0x36')],_0x412faf[_0xe173('0x35')]);_0x228b8d[_0xe173('0x37')]=_[_0xe173('0x38')](_0x412faf[_0xe173('0x36')],qs[_0xe173('0x39')](_0x54c85a[_0xe173('0x35')][_0xe173('0x39')]));_0x228b8d[_0xe173('0x37')]=_0x228b8d[_0xe173('0x37')][_0xe173('0x3a')]?_0x228b8d[_0xe173('0x37')]:_0x412faf['model'];if(_0x54c85a[_0xe173('0x35')][_0xe173('0x43')]){_0x228b8d[_0xe173('0x44')]=[{'all':!![]}];}_0x228b8d=_[_0xe173('0x41')]({},_0x228b8d,_0x54c85a[_0xe173('0x4b')]);return db[_0xe173('0x31')][_0xe173('0x4c')](_0x228b8d)[_0xe173('0x29')](handleEntityNotFound(_0x4db535,null))[_0xe173('0x29')](respondWithResult(_0x4db535,null))[_0xe173('0x47')](handleError(_0x4db535,null));};exports[_0xe173('0x4d')]=function(_0x3714bf,_0x36581c){return db[_0xe173('0x31')][_0xe173('0x4d')](_0x3714bf[_0xe173('0x4e')],{})[_0xe173('0x29')](respondWithResult(_0x36581c,0xc9))['catch'](handleError(_0x36581c,null));};exports[_0xe173('0x28')]=function(_0x2b14a6,_0x2c2390){if(_0x2b14a6['body']['id']){delete _0x2b14a6[_0xe173('0x4e')]['id'];}return db[_0xe173('0x31')][_0xe173('0x4c')]({'where':{'id':_0x2b14a6[_0xe173('0x49')]['id']}})[_0xe173('0x29')](handleEntityNotFound(_0x2c2390,null))[_0xe173('0x29')](saveUpdates(_0x2b14a6[_0xe173('0x4e')],null))[_0xe173('0x29')](respondWithResult(_0x2c2390,null))[_0xe173('0x47')](handleError(_0x2c2390,null));};exports[_0xe173('0x2a')]=function(_0xe96ce5,_0x816e15){return db[_0xe173('0x31')]['find']({'where':{'id':_0xe96ce5[_0xe173('0x49')]['id']}})['then'](handleEntityNotFound(_0x816e15,null))[_0xe173('0x29')](removeEntity(_0x816e15,null))['catch'](handleError(_0x816e15,null));}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.model.js b/server/api/faxApplication/faxApplication.model.js index b11c016..5cbc557 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 _0x10bd=['lodash','util','../../config/logger','moment','path','rimraf','../../config/environment','./faxApplication.attributes','define','FaxApplication','fax_applications','utf8mb4'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x10bd,0x174));var _0xd10b=function(_0x3720c4,_0xf87db6){_0x3720c4=_0x3720c4-0x0;var _0x3fa52e=_0x10bd[_0x3720c4];return _0x3fa52e;};'use strict';var _=require(_0xd10b('0x0'));var util=require(_0xd10b('0x1'));var logger=require(_0xd10b('0x2'))('api');var moment=require(_0xd10b('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd10b('0x4'));var rimraf=require(_0xd10b('0x5'));var config=require(_0xd10b('0x6'));var attributes=require(_0xd10b('0x7'));module['exports']=function(_0xa71a07,_0x5b7147){return _0xa71a07[_0xd10b('0x8')](_0xd10b('0x9'),attributes,{'tableName':_0xd10b('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xd10b('0xb'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0xb662=['../../config/logger','api','bluebird','request-promise','path','rimraf','./faxApplication.attributes','exports','define','FaxApplication','utf8mb4_unicode_ci'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0xb662,0x155));var _0x2b66=function(_0x390a19,_0x5dd137){_0x390a19=_0x390a19-0x0;var _0x5d8230=_0xb662[_0x390a19];return _0x5d8230;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2b66('0x0'))(_0x2b66('0x1'));var moment=require('moment');var BPromise=require(_0x2b66('0x2'));var rp=require(_0x2b66('0x3'));var fs=require('fs');var path=require(_0x2b66('0x4'));var rimraf=require(_0x2b66('0x5'));var config=require('../../config/environment');var attributes=require(_0x2b66('0x6'));module[_0x2b66('0x7')]=function(_0x404e9a,_0x304f25){return _0x404e9a[_0x2b66('0x8')](_0x2b66('0x9'),attributes,{'tableName':'fax_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x2b66('0xa')});}; \ No newline at end of file diff --git a/server/api/faxApplication/faxApplication.rpc.js b/server/api/faxApplication/faxApplication.rpc.js index 134a346..236f488 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 _0x31aa=['raw','limit','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','FaxApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','FaxApplication,\x20%s,\x20%s','message','result','catch','UpdateFaxApplication','FaxApplication','options'];(function(_0x3f889c,_0x1c16af){var _0x5edf2a=function(_0x5adbc1){while(--_0x5adbc1){_0x3f889c['push'](_0x3f889c['shift']());}};_0x5edf2a(++_0x1c16af);}(_0x31aa,0x198));var _0xa31a=function(_0x56f5fc,_0x1cf86a){_0x56f5fc=_0x56f5fc-0x0;var _0x1c9221=_0x31aa[_0x56f5fc];return _0x1c9221;};'use strict';var _=require('lodash');var util=require(_0xa31a('0x0'));var moment=require('moment');var BPromise=require(_0xa31a('0x1'));var rs=require(_0xa31a('0x2'));var fs=require('fs');var Redis=require(_0xa31a('0x3'));var db=require(_0xa31a('0x4'))['db'];var utils=require(_0xa31a('0x5'));var logger=require(_0xa31a('0x6'))(_0xa31a('0x7'));var config=require(_0xa31a('0x8'));var jayson=require(_0xa31a('0x9'));var client=jayson['client'][_0xa31a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x41abce,_0x51e242,_0x228e15){return new BPromise(function(_0x3775c7,_0x1393e6){return client[_0xa31a('0xb')](_0x41abce,_0x228e15)[_0xa31a('0xc')](function(_0x50affc){logger[_0xa31a('0xd')]('FaxApplication,\x20%s,\x20%s',_0x51e242,_0xa31a('0xe'));logger[_0xa31a('0xf')](_0xa31a('0x10'),_0x51e242,_0xa31a('0xe'),JSON[_0xa31a('0x11')](_0x50affc));if(_0x50affc[_0xa31a('0x12')]){if(_0x50affc['error'][_0xa31a('0x13')]===0x1f4){logger[_0xa31a('0x12')](_0xa31a('0x14'),_0x51e242,_0x50affc[_0xa31a('0x12')][_0xa31a('0x15')]);return _0x1393e6(_0x50affc[_0xa31a('0x12')][_0xa31a('0x15')]);}logger[_0xa31a('0x12')](_0xa31a('0x14'),_0x51e242,_0x50affc[_0xa31a('0x12')][_0xa31a('0x15')]);return _0x3775c7(_0x50affc[_0xa31a('0x12')][_0xa31a('0x15')]);}else{logger[_0xa31a('0xd')]('FaxApplication,\x20%s,\x20%s',_0x51e242,'request\x20sent');_0x3775c7(_0x50affc[_0xa31a('0x16')]['message']);}})[_0xa31a('0x17')](function(_0x2bf483){logger[_0xa31a('0x12')](_0xa31a('0x14'),_0x51e242,_0x2bf483);_0x1393e6(_0x2bf483);});});}exports[_0xa31a('0x18')]=function(_0x1f9fd2){var _0x237525=this;return new Promise(function(_0x31ab54,_0x52d30c){return db[_0xa31a('0x19')]['update'](_0x1f9fd2['body'],{'raw':_0x1f9fd2[_0xa31a('0x1a')]?_0x1f9fd2[_0xa31a('0x1a')][_0xa31a('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1f9fd2['options']?_0x1f9fd2[_0xa31a('0x1a')]['where']||null:null,'attributes':_0x1f9fd2['options']?_0x1f9fd2['options']['attributes']||null:null,'limit':_0x1f9fd2[_0xa31a('0x1a')]?_0x1f9fd2['options'][_0xa31a('0x1c')]||null:null})[_0xa31a('0xc')](function(_0x33019d){logger['info'](_0xa31a('0x18'),_0x1f9fd2);logger[_0xa31a('0xf')](_0xa31a('0x18'),_0x1f9fd2,JSON['stringify'](_0x33019d));_0x31ab54(_0x33019d);})[_0xa31a('0x17')](function(_0x2c569d){logger[_0xa31a('0x12')]('UpdateFaxApplication',_0x2c569d[_0xa31a('0x15')],_0x1f9fd2);_0x52d30c(_0x237525[_0xa31a('0x12')](0x1f4,_0x2c569d[_0xa31a('0x15')]));});});}; \ No newline at end of file +var _0xb00d=['info','FaxApplication,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','update','body','options','where','attributes','limit','UpdateFaxApplication','lodash','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then'];(function(_0x41690f,_0x184bea){var _0xbadafe=function(_0x472311){while(--_0x472311){_0x41690f['push'](_0x41690f['shift']());}};_0xbadafe(++_0x184bea);}(_0xb00d,0x97));var _0xdb00=function(_0x17730a,_0x362127){_0x17730a=_0x17730a-0x0;var _0x485db1=_0xb00d[_0x17730a];return _0x485db1;};'use strict';var _=require(_0xdb00('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xdb00('0x1'));var fs=require('fs');var Redis=require(_0xdb00('0x2'));var db=require(_0xdb00('0x3'))['db'];var utils=require(_0xdb00('0x4'));var logger=require(_0xdb00('0x5'))(_0xdb00('0x6'));var config=require(_0xdb00('0x7'));var jayson=require(_0xdb00('0x8'));var client=jayson['client'][_0xdb00('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a8f62,_0x493a23,_0x4eee34){return new BPromise(function(_0x299734,_0x2ce4f4){return client['request'](_0x4a8f62,_0x4eee34)[_0xdb00('0xa')](function(_0x48b8fb){logger[_0xdb00('0xb')](_0xdb00('0xc'),_0x493a23,'request\x20sent');logger['debug']('FaxApplication,\x20%s,\x20%s,\x20%s',_0x493a23,_0xdb00('0xd'),JSON[_0xdb00('0xe')](_0x48b8fb));if(_0x48b8fb[_0xdb00('0xf')]){if(_0x48b8fb['error'][_0xdb00('0x10')]===0x1f4){logger[_0xdb00('0xf')](_0xdb00('0xc'),_0x493a23,_0x48b8fb[_0xdb00('0xf')][_0xdb00('0x11')]);return _0x2ce4f4(_0x48b8fb[_0xdb00('0xf')][_0xdb00('0x11')]);}logger['error'](_0xdb00('0xc'),_0x493a23,_0x48b8fb[_0xdb00('0xf')]['message']);return _0x299734(_0x48b8fb[_0xdb00('0xf')][_0xdb00('0x11')]);}else{logger[_0xdb00('0xb')]('FaxApplication,\x20%s,\x20%s',_0x493a23,'request\x20sent');_0x299734(_0x48b8fb[_0xdb00('0x12')][_0xdb00('0x11')]);}})[_0xdb00('0x13')](function(_0xdb7aa6){logger[_0xdb00('0xf')](_0xdb00('0xc'),_0x493a23,_0xdb7aa6);_0x2ce4f4(_0xdb7aa6);});});}exports['UpdateFaxApplication']=function(_0x126e9c){var _0xbd0108=this;return new Promise(function(_0x433a0d,_0x20663e){return db['FaxApplication'][_0xdb00('0x14')](_0x126e9c[_0xdb00('0x15')],{'raw':_0x126e9c['options']?_0x126e9c[_0xdb00('0x16')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x126e9c[_0xdb00('0x16')]?_0x126e9c[_0xdb00('0x16')][_0xdb00('0x17')]||null:null,'attributes':_0x126e9c[_0xdb00('0x16')]?_0x126e9c[_0xdb00('0x16')][_0xdb00('0x18')]||null:null,'limit':_0x126e9c['options']?_0x126e9c['options'][_0xdb00('0x19')]||null:null})[_0xdb00('0xa')](function(_0x5cd6bc){logger[_0xdb00('0xb')](_0xdb00('0x1a'),_0x126e9c);logger['debug'](_0xdb00('0x1a'),_0x126e9c,JSON[_0xdb00('0xe')](_0x5cd6bc));_0x433a0d(_0x5cd6bc);})['catch'](function(_0x243455){logger[_0xdb00('0xf')](_0xdb00('0x1a'),_0x243455[_0xdb00('0x11')],_0x126e9c);_0x20663e(_0xbd0108[_0xdb00('0xf')](0x1f4,_0x243455[_0xdb00('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/faxApplication/index.js b/server/api/faxApplication/index.js index 8875417..a910447 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 _0x36ee=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxApplication.controller','get','isAuthenticated','index','/:id','show','create','put','delete','destroy','exports','path','express'];(function(_0x301075,_0x33b785){var _0x1a04c5=function(_0x8d5143){while(--_0x8d5143){_0x301075['push'](_0x301075['shift']());}};_0x1a04c5(++_0x33b785);}(_0x36ee,0xe8));var _0xe36e=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x36ee[_0x501510];return _0x1e6ee5;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe36e('0x0'));var timeout=require('connect-timeout');var express=require(_0xe36e('0x1'));var router=express[_0xe36e('0x2')]();var fs_extra=require(_0xe36e('0x3'));var auth=require(_0xe36e('0x4'));var interaction=require(_0xe36e('0x5'));var config=require(_0xe36e('0x6'));var controller=require(_0xe36e('0x7'));router[_0xe36e('0x8')]('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xa')]);router[_0xe36e('0x8')](_0xe36e('0xb'),auth['isAuthenticated'](),controller[_0xe36e('0xc')]);router['post']('/',auth[_0xe36e('0x9')](),controller[_0xe36e('0xd')]);router[_0xe36e('0xe')]('/:id',auth[_0xe36e('0x9')](),controller['update']);router[_0xe36e('0xf')](_0xe36e('0xb'),auth[_0xe36e('0x9')](),controller[_0xe36e('0x10')]);module[_0xe36e('0x11')]=router; \ No newline at end of file +var _0x0b0e=['./faxApplication.controller','get','isAuthenticated','index','show','post','create','/:id','delete','destroy','exports','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x261a4a,_0x389a4f){var _0xc8d5b4=function(_0x5084e9){while(--_0x5084e9){_0x261a4a['push'](_0x261a4a['shift']());}};_0xc8d5b4(++_0x389a4f);}(_0x0b0e,0x187));var _0xe0b0=function(_0x3e2c1e,_0x1e8d40){_0x3e2c1e=_0x3e2c1e-0x0;var _0x1c6666=_0x0b0e[_0x3e2c1e];return _0x1c6666;};'use strict';var multer=require(_0xe0b0('0x0'));var util=require('util');var path=require(_0xe0b0('0x1'));var timeout=require('connect-timeout');var express=require(_0xe0b0('0x2'));var router=express[_0xe0b0('0x3')]();var fs_extra=require(_0xe0b0('0x4'));var auth=require(_0xe0b0('0x5'));var interaction=require(_0xe0b0('0x6'));var config=require(_0xe0b0('0x7'));var controller=require(_0xe0b0('0x8'));router[_0xe0b0('0x9')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xb')]);router[_0xe0b0('0x9')]('/:id',auth['isAuthenticated'](),controller[_0xe0b0('0xc')]);router[_0xe0b0('0xd')]('/',auth[_0xe0b0('0xa')](),controller[_0xe0b0('0xe')]);router['put'](_0xe0b0('0xf'),auth[_0xe0b0('0xa')](),controller['update']);router[_0xe0b0('0x10')](_0xe0b0('0xf'),auth['isAuthenticated'](),controller[_0xe0b0('0x11')]);module[_0xe0b0('0x12')]=router; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.attributes.js b/server/api/faxInteraction/faxInteraction.attributes.js index 99758d9..92ee9b8 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 _0xa213=['ENUM','sequelize','exports','BOOLEAN','STRING','DATE','out'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0xa213,0x112));var _0x3a21=function(_0x19ec21,_0x45e0d4){_0x19ec21=_0x19ec21-0x0;var _0x423b07=_0xa213[_0x19ec21];return _0x423b07;};'use strict';var Sequelize=require(_0x3a21('0x0'));module[_0x3a21('0x1')]={'closed':{'type':Sequelize[_0x3a21('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize[_0x3a21('0x3')]},'secondDisposition':{'type':Sequelize[_0x3a21('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x3a21('0x3')]},'read1stAt':{'type':Sequelize[_0x3a21('0x4')]},'fax':{'type':Sequelize[_0x3a21('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x3a21('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x3a21('0x4')]},'lastMsgDirection':{'type':Sequelize[_0x3a21('0x6')]('in','out'),'defaultValue':'in','allowNull':![]}}; \ No newline at end of file +var _0x56a0=['BOOLEAN','DATE','STRING','ENUM','out','sequelize','exports'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0x56a0,0x101));var _0x056a=function(_0x4c0baa,_0x2e110f){_0x4c0baa=_0x4c0baa-0x0;var _0x4bf459=_0x56a0[_0x4c0baa];return _0x4bf459;};'use strict';var Sequelize=require(_0x056a('0x0'));module[_0x056a('0x1')]={'closed':{'type':Sequelize[_0x056a('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x056a('0x3')]},'disposition':{'type':Sequelize[_0x056a('0x4')]},'secondDisposition':{'type':Sequelize[_0x056a('0x4')]},'thirdDisposition':{'type':Sequelize[_0x056a('0x4')]},'note':{'type':Sequelize[_0x056a('0x4')]},'read1stAt':{'type':Sequelize[_0x056a('0x3')]},'fax':{'type':Sequelize[_0x056a('0x4')]},'firstMsgDirection':{'type':Sequelize[_0x056a('0x5')]('in',_0x056a('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x056a('0x3')]},'lastMsgDirection':{'type':Sequelize[_0x056a('0x5')]('in',_0x056a('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 7d6a0da..1ef016e 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 _0x3410=['type','key','findAll','fax','query','catch','show','params','filters','attributes','intersection','model','fields','includeAll','include','merge','options','find','create','update','body','describe','addMessage','ids','omit','findOne','rawAttributes','keys','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','$gte','split','YYYY-MM-DD\x20HH:mm:ss','FaxMessage','addTags','setTags','spread','color','faxInteractionTags:save','removeTags','download','root','server','files','tmp','join','attachments','format','transcript-%d-%s.zip','push','Attachment','Messages','createdAt','get','mkdirSync','createReadStream','pipe','basename','resolve','log','err','rimraf','zip-dir','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','../../config/environment','redis','socket.io-emitter','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','then','destroy','error','stack','name','send','index','FaxInteraction','fieldName'];(function(_0x1641c7,_0x1caa7d){var _0x331d91=function(_0x5308ad){while(--_0x5308ad){_0x1641c7['push'](_0x1641c7['shift']());}};_0x331d91(++_0x1caa7d);}(_0x3410,0x1d0));var _0x0341=function(_0x5968c3,_0x44c58a){_0x5968c3=_0x5968c3-0x0;var _0x584345=_0x3410[_0x5968c3];return _0x584345;};'use strict';var rimraf=require(_0x0341('0x0'));var zipdir=require(_0x0341('0x1'));var moment=require(_0x0341('0x2'));var BPromise=require(_0x0341('0x3'));var util=require(_0x0341('0x4'));var path=require(_0x0341('0x5'));var fs=require('fs');var _=require(_0x0341('0x6'));var Redis=require(_0x0341('0x7'));var interaction=require('../../components/interaction/service');var qs=require(_0x0341('0x8'));var logger=require(_0x0341('0x9'))('api');var config=require(_0x0341('0xa'));var db=require('../../mysqldb')['db'];config[_0x0341('0xb')]=_['defaults'](config[_0x0341('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0x0341('0xc'))(new Redis(config[_0x0341('0xb')]));require('./faxInteraction.socket')['register'](socket);function respondWithStatusCode(_0x45aef2,_0x155304){_0x155304=_0x155304||0xcc;return function(_0x18bab9){if(_0x18bab9){return _0x45aef2[_0x0341('0xd')](_0x155304);}return _0x45aef2[_0x0341('0xe')](_0x155304)[_0x0341('0xf')]();};}function respondWithResult(_0x1bec8b,_0x559b39){_0x559b39=_0x559b39||0xc8;return function(_0x2fc40e){if(_0x2fc40e){return _0x1bec8b[_0x0341('0xe')](_0x559b39)['json'](_0x2fc40e);}};}function respondWithFilteredResult(_0x4dec30,_0x543af1){return function(_0x4116de){if(_0x4116de){var _0x69d943=typeof _0x543af1[_0x0341('0x10')]==='undefined'&&typeof _0x543af1[_0x0341('0x11')]===_0x0341('0x12');var _0x341edc=_0x4116de['count'];var _0x33fc00=_0x69d943?0x0:_0x543af1[_0x0341('0x10')];var _0x146761=_0x69d943?_0x4116de[_0x0341('0x13')]:_0x543af1['offset']+_0x543af1[_0x0341('0x11')];var _0x3926fb;if(_0x146761>=_0x341edc){_0x146761=_0x341edc;_0x3926fb=0xc8;}else{_0x3926fb=0xce;}_0x4dec30['status'](_0x3926fb);return _0x4dec30[_0x0341('0x14')](_0x0341('0x15'),_0x33fc00+'-'+_0x146761+'/'+_0x341edc)['json'](_0x4116de);}return null;};}function saveUpdates(_0x1f41a0){return function(_0x1f8385){if(_0x1f8385){return _0x1f8385['update'](_0x1f41a0)[_0x0341('0x16')](function(_0x41b718){return _0x41b718;});}return null;};}function removeEntity(_0x22ec3a){return function(_0x36bab1){if(_0x36bab1){return _0x36bab1[_0x0341('0x17')]()[_0x0341('0x16')](function(){_0x22ec3a[_0x0341('0xe')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5dbda3){return function(_0x2cf4bd){if(!_0x2cf4bd){_0x5dbda3['sendStatus'](0x194);}return _0x2cf4bd;};}function handleError(_0x134cab,_0x4cdee6){_0x4cdee6=_0x4cdee6||0x1f4;return function(_0xd40284){logger[_0x0341('0x18')](_0xd40284[_0x0341('0x19')]);if(_0xd40284['name']){delete _0xd40284[_0x0341('0x1a')];}_0x134cab['status'](_0x4cdee6)[_0x0341('0x1b')](_0xd40284);};}exports[_0x0341('0x1c')]=function(_0x4a195e,_0x1d5329){var _0x3fda67={};var _0x511ce5=_['map'](db[_0x0341('0x1d')]['rawAttributes'],function(_0x2a800f){return{'name':_0x2a800f[_0x0341('0x1e')],'type':_0x2a800f[_0x0341('0x1f')][_0x0341('0x20')]};});_0x3fda67=qs['getOptions'](_0x511ce5,_0x4a195e);return interaction[_0x0341('0x21')](_0x0341('0x22'),_0x4a195e[_0x0341('0x23')],_0x4a195e['user'],_0x3fda67,_0x511ce5)[_0x0341('0x16')](respondWithFilteredResult(_0x1d5329,_0x3fda67))[_0x0341('0x24')](handleError(_0x1d5329,null));};exports[_0x0341('0x25')]=function(_0x4c8ac6,_0x5d5596){var _0x5df31d={'raw':![],'where':{'id':_0x4c8ac6[_0x0341('0x26')]['id']}},_0x3c225b={};_0x3c225b['model']=_['keys'](db[_0x0341('0x1d')]['rawAttributes']);_0x3c225b['query']=_['keys'](_0x4c8ac6['query']);_0x3c225b[_0x0341('0x27')]=_['intersection'](_0x3c225b['model'],_0x3c225b['query']);_0x5df31d[_0x0341('0x28')]=_[_0x0341('0x29')](_0x3c225b[_0x0341('0x2a')],qs[_0x0341('0x2b')](_0x4c8ac6[_0x0341('0x23')]['fields']));_0x5df31d[_0x0341('0x28')]=_0x5df31d[_0x0341('0x28')]['length']?_0x5df31d[_0x0341('0x28')]:_0x3c225b['model'];if(_0x4c8ac6[_0x0341('0x23')][_0x0341('0x2c')]){_0x5df31d[_0x0341('0x2d')]=[{'all':!![]}];}_0x5df31d=_[_0x0341('0x2e')]({},_0x5df31d,_0x4c8ac6[_0x0341('0x2f')]);return db[_0x0341('0x1d')][_0x0341('0x30')](_0x5df31d)[_0x0341('0x16')](handleEntityNotFound(_0x5d5596,null))[_0x0341('0x16')](respondWithResult(_0x5d5596,null))[_0x0341('0x24')](handleError(_0x5d5596,null));};exports[_0x0341('0x31')]=function(_0x4d207d,_0x579633){return db[_0x0341('0x1d')]['create'](_0x4d207d['body'],{})[_0x0341('0x16')](respondWithResult(_0x579633,0xc9))['catch'](handleError(_0x579633,null));};exports[_0x0341('0x32')]=function(_0x50c2ec,_0x32f544){if(_0x50c2ec['body']['id']){delete _0x50c2ec[_0x0341('0x33')]['id'];}return db['FaxInteraction']['find']({'where':{'id':_0x50c2ec[_0x0341('0x26')]['id']}})[_0x0341('0x16')](handleEntityNotFound(_0x32f544,null))[_0x0341('0x16')](saveUpdates(_0x50c2ec[_0x0341('0x33')],null))[_0x0341('0x16')](respondWithResult(_0x32f544,null))[_0x0341('0x24')](handleError(_0x32f544,null));};exports['destroy']=function(_0xaf69bf,_0x2dced0){return db[_0x0341('0x1d')]['find']({'where':{'id':_0xaf69bf[_0x0341('0x26')]['id']}})[_0x0341('0x16')](handleEntityNotFound(_0x2dced0,null))[_0x0341('0x16')](removeEntity(_0x2dced0,null))[_0x0341('0x24')](handleError(_0x2dced0,null));};exports['describe']=function(_0x5c37f8,_0x368bd1){return db[_0x0341('0x1d')][_0x0341('0x34')]()[_0x0341('0x16')](respondWithResult(_0x368bd1,null))[_0x0341('0x24')](handleError(_0x368bd1,null));};exports['addMessage']=function(_0x36c706,_0x592f04){return db['FaxMessage'][_0x0341('0x30')]({'where':{'id':_0x36c706['params']['id']}})[_0x0341('0x16')](handleEntityNotFound(_0x592f04,null))[_0x0341('0x16')](function(_0x41de76){if(_0x41de76){return _0x41de76[_0x0341('0x35')](_0x36c706['body'][_0x0341('0x36')],_[_0x0341('0x37')](_0x36c706[_0x0341('0x33')],[_0x0341('0x36'),'id'])||{});}})['then'](respondWithResult(_0x592f04,null))[_0x0341('0x24')](handleError(_0x592f04,null));};exports['getMessages']=function(_0x6cc9ca,_0x37b505){var _0x45e821={'raw':![],'where':{}};var _0x2af4f6={};var _0xebb82a={'count':0x0,'rows':[]};return db[_0x0341('0x1d')][_0x0341('0x38')]({'where':{'id':_0x6cc9ca[_0x0341('0x26')]['id']}})['then'](handleEntityNotFound(_0x37b505,null))[_0x0341('0x16')](function(_0x5c9a72){if(_0x5c9a72){_0x2af4f6[_0x0341('0x2a')]=_['keys'](db['FaxMessage'][_0x0341('0x39')]);_0x2af4f6[_0x0341('0x23')]=_[_0x0341('0x3a')](_0x6cc9ca[_0x0341('0x23')]);_0x2af4f6['filters']=_[_0x0341('0x29')](_0x2af4f6['model'],_0x2af4f6[_0x0341('0x23')]);_0x45e821['attributes']=_[_0x0341('0x29')](_0x2af4f6[_0x0341('0x2a')],qs[_0x0341('0x2b')](_0x6cc9ca['query'][_0x0341('0x2b')]));_0x45e821[_0x0341('0x28')]=_0x45e821[_0x0341('0x28')][_0x0341('0x3b')]?_0x45e821[_0x0341('0x28')]:_0x2af4f6[_0x0341('0x2a')];if(!_0x6cc9ca[_0x0341('0x23')][_0x0341('0x3c')](_0x0341('0x3d'))){_0x45e821[_0x0341('0x11')]=qs[_0x0341('0x11')](_0x6cc9ca[_0x0341('0x23')][_0x0341('0x11')]);_0x45e821[_0x0341('0x10')]=qs[_0x0341('0x10')](_0x6cc9ca['query'][_0x0341('0x10')]);}_0x45e821[_0x0341('0x3e')]=qs[_0x0341('0x3f')](_0x6cc9ca['query'][_0x0341('0x3f')]);_0x45e821[_0x0341('0x40')]=qs[_0x0341('0x27')](_[_0x0341('0x41')](_0x6cc9ca[_0x0341('0x23')],_0x2af4f6[_0x0341('0x27')]));_0x45e821[_0x0341('0x40')]['FaxInteractionId']=_0x5c9a72['id'];if(_0x6cc9ca[_0x0341('0x23')][_0x0341('0x42')]){_0x45e821[_0x0341('0x40')]=_[_0x0341('0x2e')](_0x45e821[_0x0341('0x40')],{'$or':_[_0x0341('0x43')](_0x45e821['attributes'],function(_0x38a14e){var _0x529a23={};_0x529a23[_0x38a14e]={'$like':'%'+_0x6cc9ca['query'][_0x0341('0x42')]+'%'};return _0x529a23;})});}if(_0x6cc9ca[_0x0341('0x23')][_0x0341('0x44')]){var _0x3cee45=_0x6cc9ca[_0x0341('0x23')][_0x0341('0x44')][_0x0341('0x45')](',');var _0x3f5e1b={};_0x3f5e1b[_0x3cee45[0x0]]={'$gte':moment(_0x3cee45[0x1])['format'](_0x0341('0x46'))};_0x45e821['where']=_[_0x0341('0x2e')](_0x45e821[_0x0341('0x40')],_0x3f5e1b);}_0x45e821=_[_0x0341('0x2e')]({},_0x45e821,_0x6cc9ca[_0x0341('0x2f')]);return db[_0x0341('0x47')][_0x0341('0x13')]({'where':_0x45e821[_0x0341('0x40')]})[_0x0341('0x16')](function(_0x4af387){_0xebb82a['count']=_0x4af387;if(_0x6cc9ca[_0x0341('0x23')][_0x0341('0x2c')]){_0x45e821['include']=[{'all':!![]}];}return db[_0x0341('0x47')][_0x0341('0x21')](_0x45e821);})['then'](function(_0x2dfc16){_0xebb82a['rows']=_0x2dfc16;return _0xebb82a;});}})[_0x0341('0x16')](respondWithFilteredResult(_0x37b505,_0x45e821))[_0x0341('0x24')](handleError(_0x37b505,null));};exports[_0x0341('0x48')]=function(_0xd3363f,_0x2a4ca3){return db[_0x0341('0x1d')]['find']({'where':{'id':_0xd3363f['params']['id']}})[_0x0341('0x16')](handleEntityNotFound(_0x2a4ca3,null))[_0x0341('0x16')](function(_0x4152dd){if(_0x4152dd){return _0x4152dd[_0x0341('0x49')](_0xd3363f[_0x0341('0x33')][_0x0341('0x36')],_[_0x0341('0x37')](_0xd3363f[_0x0341('0x33')],[_0x0341('0x36'),'id'])||{})[_0x0341('0x4a')](function(){return db['Tag'][_0x0341('0x21')]({'attributes':['id',_0x0341('0x1a'),_0x0341('0x4b')],'where':{'id':_0xd3363f[_0x0341('0x33')][_0x0341('0x36')]}});})[_0x0341('0x16')](function(_0x13cd5d){socket['emit'](_0x0341('0x4c'),{'id':Number(_0xd3363f[_0x0341('0x26')]['id']),'tags':_0x13cd5d||[]});return{'id':Number(_0xd3363f[_0x0341('0x26')]['id']),'tags':_0x13cd5d||[]};});}})[_0x0341('0x16')](respondWithResult(_0x2a4ca3,null))[_0x0341('0x24')](handleError(_0x2a4ca3,null));};exports[_0x0341('0x4d')]=function(_0x13a369,_0x45d49b){return db['FaxInteraction']['find']({'where':{'id':_0x13a369[_0x0341('0x26')]['id']}})[_0x0341('0x16')](handleEntityNotFound(_0x45d49b,null))[_0x0341('0x16')](function(_0x321ae2){if(_0x321ae2){return _0x321ae2[_0x0341('0x4d')](_0x13a369[_0x0341('0x23')]['ids']);}})[_0x0341('0x16')](respondWithStatusCode(_0x45d49b,null))['catch'](handleError(_0x45d49b,null));};exports[_0x0341('0x4e')]=function(_0x54cd6a,_0x25245b){var _0x368bb7=moment()['unix']()['toString']();var _0x33982f=path['join'](config[_0x0341('0x4f')],_0x0341('0x50'),_0x0341('0x51'),_0x0341('0x52'));var _0x3e1307=path[_0x0341('0x53')](config[_0x0341('0x4f')],_0x0341('0x50'),_0x0341('0x51'),_0x0341('0x54'));var _0x4a8079=path[_0x0341('0x53')](_0x33982f,_0x368bb7);var _0x2bd09b=util[_0x0341('0x55')](_0x0341('0x56'),_0x54cd6a[_0x0341('0x26')]['id'],_0x368bb7);var _0x38f658=path['join'](_0x33982f,_0x2bd09b);var _0x4d19de=[];_0x4d19de[_0x0341('0x57')]({'model':db[_0x0341('0x58')],'as':'Attachment','raw':!![]});var _0x232139=[{'model':db[_0x0341('0x47')],'as':_0x0341('0x59'),'attributes':['id',_0x0341('0x33'),_0x0341('0x5a')],'include':_0x4d19de}];return db['FaxInteraction'][_0x0341('0x30')]({'where':{'id':_0x54cd6a['params']['id']},'include':_0x232139})[_0x0341('0x16')](handleEntityNotFound(_0x25245b,null))[_0x0341('0x16')](function(_0x3c6cbe){if(_0x3c6cbe&&_0x3c6cbe[_0x0341('0x59')]){var _0x36ca01=_0x3c6cbe[_0x0341('0x5b')]({'plain':!![]});fs[_0x0341('0x5c')](_0x4a8079);for(var _0xdac6ac=0x0;_0xdac6ac<_0x36ca01[_0x0341('0x59')][_0x0341('0x3b')];_0xdac6ac++){var _0x47aacd=_0x36ca01[_0x0341('0x59')][_0xdac6ac][_0x0341('0x58')];if(_0x47aacd){var _0xe9c480=path[_0x0341('0x53')](_0x3e1307,_0x47aacd['basename']);if(fs['existsSync'](_0xe9c480)){fs[_0x0341('0x5d')](_0xe9c480)[_0x0341('0x5e')](fs['createWriteStream'](path[_0x0341('0x53')](_0x4a8079,_0x47aacd[_0x0341('0x5f')])));}}}return BPromise[_0x0341('0x60')]()['then'](function(){return new BPromise(function(_0x1ccfc8,_0x4d940d){zipdir(_0x4a8079,{'saveTo':_0x38f658},function(_0x5d0589,_0x5d87d0){if(_0x5d0589)return _0x4d940d(_0x5d0589);return _0x1ccfc8(_0x5d87d0);});})[_0x0341('0x16')](function(){return new BPromise(function(_0x415251,_0x3b877a){rimraf(_0x4a8079,function(_0x10526f){if(_0x10526f)_0x3b877a(_0x10526f);return _0x415251();});});})[_0x0341('0x16')](function(){return _0x25245b[_0x0341('0x4e')](_0x38f658,_0x2bd09b,function(_0x5c7c68){if(_0x5c7c68){console[_0x0341('0x61')](_0x0341('0x62'),_0x5c7c68);}else{fs['unlinkSync'](_0x38f658);}});});});}else{return _0x25245b[_0x0341('0xd')](0xc8);}})[_0x0341('0x24')](handleError(_0x25245b,null));}; \ No newline at end of file +var _0xa318=['rimraf','zip-dir','moment','bluebird','util','path','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxInteraction.socket','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','update','destroy','then','error','stack','name','send','index','map','FaxInteraction','rawAttributes','type','key','getOptions','findAll','fax','query','user','catch','show','params','keys','filters','model','attributes','intersection','fields','includeAll','include','options','create','body','find','describe','FaxMessage','addMessage','ids','omit','getMessages','findOne','hasOwnProperty','nolimit','order','sort','where','pick','FaxInteractionId','filter','merge','$gte','split','YYYY-MM-DD\x20HH:mm:ss','rows','setTags','spread','Tag','color','faxInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','tmp','attachments','format','transcript-%d-%s.zip','Attachment','createdAt','get','mkdirSync','Messages','existsSync','createReadStream','pipe','createWriteStream','basename','log','err','unlinkSync'];(function(_0x5012f,_0x1d2391){var _0x4ee5eb=function(_0x3c423d){while(--_0x3c423d){_0x5012f['push'](_0x5012f['shift']());}};_0x4ee5eb(++_0x1d2391);}(_0xa318,0x6e));var _0x8a31=function(_0x3aa2f9,_0x2e8e49){_0x3aa2f9=_0x3aa2f9-0x0;var _0x9a7f3d=_0xa318[_0x3aa2f9];return _0x9a7f3d;};'use strict';var rimraf=require(_0x8a31('0x0'));var zipdir=require(_0x8a31('0x1'));var moment=require(_0x8a31('0x2'));var BPromise=require(_0x8a31('0x3'));var util=require(_0x8a31('0x4'));var path=require(_0x8a31('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x8a31('0x6'));var interaction=require(_0x8a31('0x7'));var qs=require(_0x8a31('0x8'));var logger=require('../../config/logger')(_0x8a31('0x9'));var config=require('../../config/environment');var db=require(_0x8a31('0xa'))['db'];config[_0x8a31('0xb')]=_[_0x8a31('0xc')](config[_0x8a31('0xb')],{'host':_0x8a31('0xd'),'port':0x18eb});var socket=require(_0x8a31('0xe'))(new Redis(config[_0x8a31('0xb')]));require(_0x8a31('0xf'))[_0x8a31('0x10')](socket);function respondWithStatusCode(_0x2936f6,_0x1cd48f){_0x1cd48f=_0x1cd48f||0xcc;return function(_0x1d5793){if(_0x1d5793){return _0x2936f6[_0x8a31('0x11')](_0x1cd48f);}return _0x2936f6[_0x8a31('0x12')](_0x1cd48f)[_0x8a31('0x13')]();};}function respondWithResult(_0x49cff4,_0x3ddc48){_0x3ddc48=_0x3ddc48||0xc8;return function(_0xdddb52){if(_0xdddb52){return _0x49cff4[_0x8a31('0x12')](_0x3ddc48)[_0x8a31('0x14')](_0xdddb52);}};}function respondWithFilteredResult(_0x337f3b,_0x270155){return function(_0x134fd5){if(_0x134fd5){var _0x19924e=typeof _0x270155[_0x8a31('0x15')]===_0x8a31('0x16')&&typeof _0x270155['limit']==='undefined';var _0x235b44=_0x134fd5[_0x8a31('0x17')];var _0x232c23=_0x19924e?0x0:_0x270155[_0x8a31('0x15')];var _0x91e75b=_0x19924e?_0x134fd5['count']:_0x270155[_0x8a31('0x15')]+_0x270155[_0x8a31('0x18')];var _0x48eb8f;if(_0x91e75b>=_0x235b44){_0x91e75b=_0x235b44;_0x48eb8f=0xc8;}else{_0x48eb8f=0xce;}_0x337f3b[_0x8a31('0x12')](_0x48eb8f);return _0x337f3b[_0x8a31('0x19')](_0x8a31('0x1a'),_0x232c23+'-'+_0x91e75b+'/'+_0x235b44)[_0x8a31('0x14')](_0x134fd5);}return null;};}function saveUpdates(_0x5593bc){return function(_0x160f4e){if(_0x160f4e){return _0x160f4e[_0x8a31('0x1b')](_0x5593bc)['then'](function(_0x228eb3){return _0x228eb3;});}return null;};}function removeEntity(_0x59583a){return function(_0xd0143c){if(_0xd0143c){return _0xd0143c[_0x8a31('0x1c')]()[_0x8a31('0x1d')](function(){_0x59583a['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x105595){return function(_0x32b10b){if(!_0x32b10b){_0x105595[_0x8a31('0x11')](0x194);}return _0x32b10b;};}function handleError(_0x53100f,_0x5260c5){_0x5260c5=_0x5260c5||0x1f4;return function(_0x579b43){logger[_0x8a31('0x1e')](_0x579b43[_0x8a31('0x1f')]);if(_0x579b43['name']){delete _0x579b43[_0x8a31('0x20')];}_0x53100f[_0x8a31('0x12')](_0x5260c5)[_0x8a31('0x21')](_0x579b43);};}exports[_0x8a31('0x22')]=function(_0x887fbc,_0x27a51d){var _0x429f54={};var _0x6994e1=_[_0x8a31('0x23')](db[_0x8a31('0x24')][_0x8a31('0x25')],function(_0x453d77){return{'name':_0x453d77['fieldName'],'type':_0x453d77[_0x8a31('0x26')][_0x8a31('0x27')]};});_0x429f54=qs[_0x8a31('0x28')](_0x6994e1,_0x887fbc);return interaction[_0x8a31('0x29')](_0x8a31('0x2a'),_0x887fbc[_0x8a31('0x2b')],_0x887fbc[_0x8a31('0x2c')],_0x429f54,_0x6994e1)[_0x8a31('0x1d')](respondWithFilteredResult(_0x27a51d,_0x429f54))[_0x8a31('0x2d')](handleError(_0x27a51d,null));};exports[_0x8a31('0x2e')]=function(_0x22dba8,_0x3475e6){var _0x2d8e71={'raw':![],'where':{'id':_0x22dba8[_0x8a31('0x2f')]['id']}},_0x26be3c={};_0x26be3c['model']=_[_0x8a31('0x30')](db[_0x8a31('0x24')][_0x8a31('0x25')]);_0x26be3c[_0x8a31('0x2b')]=_['keys'](_0x22dba8[_0x8a31('0x2b')]);_0x26be3c[_0x8a31('0x31')]=_['intersection'](_0x26be3c[_0x8a31('0x32')],_0x26be3c[_0x8a31('0x2b')]);_0x2d8e71[_0x8a31('0x33')]=_[_0x8a31('0x34')](_0x26be3c[_0x8a31('0x32')],qs[_0x8a31('0x35')](_0x22dba8[_0x8a31('0x2b')][_0x8a31('0x35')]));_0x2d8e71[_0x8a31('0x33')]=_0x2d8e71[_0x8a31('0x33')]['length']?_0x2d8e71[_0x8a31('0x33')]:_0x26be3c[_0x8a31('0x32')];if(_0x22dba8[_0x8a31('0x2b')][_0x8a31('0x36')]){_0x2d8e71[_0x8a31('0x37')]=[{'all':!![]}];}_0x2d8e71=_['merge']({},_0x2d8e71,_0x22dba8[_0x8a31('0x38')]);return db['FaxInteraction']['find'](_0x2d8e71)[_0x8a31('0x1d')](handleEntityNotFound(_0x3475e6,null))[_0x8a31('0x1d')](respondWithResult(_0x3475e6,null))[_0x8a31('0x2d')](handleError(_0x3475e6,null));};exports[_0x8a31('0x39')]=function(_0x459f8c,_0x127625){return db[_0x8a31('0x24')][_0x8a31('0x39')](_0x459f8c[_0x8a31('0x3a')],{})[_0x8a31('0x1d')](respondWithResult(_0x127625,0xc9))['catch'](handleError(_0x127625,null));};exports[_0x8a31('0x1b')]=function(_0x33ac67,_0xa82c5a){if(_0x33ac67[_0x8a31('0x3a')]['id']){delete _0x33ac67[_0x8a31('0x3a')]['id'];}return db[_0x8a31('0x24')][_0x8a31('0x3b')]({'where':{'id':_0x33ac67[_0x8a31('0x2f')]['id']}})[_0x8a31('0x1d')](handleEntityNotFound(_0xa82c5a,null))[_0x8a31('0x1d')](saveUpdates(_0x33ac67['body'],null))['then'](respondWithResult(_0xa82c5a,null))['catch'](handleError(_0xa82c5a,null));};exports[_0x8a31('0x1c')]=function(_0x1e5f6e,_0x2e0e6d){return db['FaxInteraction']['find']({'where':{'id':_0x1e5f6e[_0x8a31('0x2f')]['id']}})[_0x8a31('0x1d')](handleEntityNotFound(_0x2e0e6d,null))[_0x8a31('0x1d')](removeEntity(_0x2e0e6d,null))[_0x8a31('0x2d')](handleError(_0x2e0e6d,null));};exports[_0x8a31('0x3c')]=function(_0x1f2953,_0x3536fb){return db[_0x8a31('0x24')]['describe']()[_0x8a31('0x1d')](respondWithResult(_0x3536fb,null))['catch'](handleError(_0x3536fb,null));};exports['addMessage']=function(_0x383c06,_0x332fb6){return db[_0x8a31('0x3d')]['find']({'where':{'id':_0x383c06[_0x8a31('0x2f')]['id']}})[_0x8a31('0x1d')](handleEntityNotFound(_0x332fb6,null))[_0x8a31('0x1d')](function(_0x3ef42a){if(_0x3ef42a){return _0x3ef42a[_0x8a31('0x3e')](_0x383c06[_0x8a31('0x3a')][_0x8a31('0x3f')],_[_0x8a31('0x40')](_0x383c06[_0x8a31('0x3a')],['ids','id'])||{});}})[_0x8a31('0x1d')](respondWithResult(_0x332fb6,null))[_0x8a31('0x2d')](handleError(_0x332fb6,null));};exports[_0x8a31('0x41')]=function(_0x3cb351,_0x1de6e7){var _0x2e1d50={'raw':![],'where':{}};var _0x315eb6={};var _0x1de52f={'count':0x0,'rows':[]};return db['FaxInteraction'][_0x8a31('0x42')]({'where':{'id':_0x3cb351[_0x8a31('0x2f')]['id']}})['then'](handleEntityNotFound(_0x1de6e7,null))[_0x8a31('0x1d')](function(_0x491fbd){if(_0x491fbd){_0x315eb6[_0x8a31('0x32')]=_[_0x8a31('0x30')](db['FaxMessage']['rawAttributes']);_0x315eb6[_0x8a31('0x2b')]=_[_0x8a31('0x30')](_0x3cb351[_0x8a31('0x2b')]);_0x315eb6[_0x8a31('0x31')]=_[_0x8a31('0x34')](_0x315eb6[_0x8a31('0x32')],_0x315eb6['query']);_0x2e1d50['attributes']=_[_0x8a31('0x34')](_0x315eb6[_0x8a31('0x32')],qs[_0x8a31('0x35')](_0x3cb351[_0x8a31('0x2b')][_0x8a31('0x35')]));_0x2e1d50[_0x8a31('0x33')]=_0x2e1d50['attributes']['length']?_0x2e1d50[_0x8a31('0x33')]:_0x315eb6[_0x8a31('0x32')];if(!_0x3cb351[_0x8a31('0x2b')][_0x8a31('0x43')](_0x8a31('0x44'))){_0x2e1d50[_0x8a31('0x18')]=qs[_0x8a31('0x18')](_0x3cb351[_0x8a31('0x2b')][_0x8a31('0x18')]);_0x2e1d50[_0x8a31('0x15')]=qs[_0x8a31('0x15')](_0x3cb351[_0x8a31('0x2b')]['offset']);}_0x2e1d50[_0x8a31('0x45')]=qs[_0x8a31('0x46')](_0x3cb351['query'][_0x8a31('0x46')]);_0x2e1d50[_0x8a31('0x47')]=qs[_0x8a31('0x31')](_[_0x8a31('0x48')](_0x3cb351[_0x8a31('0x2b')],_0x315eb6[_0x8a31('0x31')]));_0x2e1d50[_0x8a31('0x47')][_0x8a31('0x49')]=_0x491fbd['id'];if(_0x3cb351['query'][_0x8a31('0x4a')]){_0x2e1d50[_0x8a31('0x47')]=_[_0x8a31('0x4b')](_0x2e1d50[_0x8a31('0x47')],{'$or':_[_0x8a31('0x23')](_0x2e1d50['attributes'],function(_0x4e70e8){var _0x45f97d={};_0x45f97d[_0x4e70e8]={'$like':'%'+_0x3cb351[_0x8a31('0x2b')][_0x8a31('0x4a')]+'%'};return _0x45f97d;})});}if(_0x3cb351[_0x8a31('0x2b')][_0x8a31('0x4c')]){var _0xb5cbb9=_0x3cb351[_0x8a31('0x2b')]['$gte'][_0x8a31('0x4d')](',');var _0x10299a={};_0x10299a[_0xb5cbb9[0x0]]={'$gte':moment(_0xb5cbb9[0x1])['format'](_0x8a31('0x4e'))};_0x2e1d50['where']=_[_0x8a31('0x4b')](_0x2e1d50[_0x8a31('0x47')],_0x10299a);}_0x2e1d50=_[_0x8a31('0x4b')]({},_0x2e1d50,_0x3cb351['options']);return db[_0x8a31('0x3d')][_0x8a31('0x17')]({'where':_0x2e1d50[_0x8a31('0x47')]})[_0x8a31('0x1d')](function(_0x2084fe){_0x1de52f[_0x8a31('0x17')]=_0x2084fe;if(_0x3cb351[_0x8a31('0x2b')][_0x8a31('0x36')]){_0x2e1d50['include']=[{'all':!![]}];}return db[_0x8a31('0x3d')]['findAll'](_0x2e1d50);})[_0x8a31('0x1d')](function(_0x356482){_0x1de52f[_0x8a31('0x4f')]=_0x356482;return _0x1de52f;});}})[_0x8a31('0x1d')](respondWithFilteredResult(_0x1de6e7,_0x2e1d50))[_0x8a31('0x2d')](handleError(_0x1de6e7,null));};exports['addTags']=function(_0x20623c,_0x2f0243){return db[_0x8a31('0x24')]['find']({'where':{'id':_0x20623c[_0x8a31('0x2f')]['id']}})[_0x8a31('0x1d')](handleEntityNotFound(_0x2f0243,null))[_0x8a31('0x1d')](function(_0xf1c78b){if(_0xf1c78b){return _0xf1c78b[_0x8a31('0x50')](_0x20623c[_0x8a31('0x3a')][_0x8a31('0x3f')],_[_0x8a31('0x40')](_0x20623c[_0x8a31('0x3a')],[_0x8a31('0x3f'),'id'])||{})[_0x8a31('0x51')](function(){return db[_0x8a31('0x52')][_0x8a31('0x29')]({'attributes':['id',_0x8a31('0x20'),_0x8a31('0x53')],'where':{'id':_0x20623c['body'][_0x8a31('0x3f')]}});})['then'](function(_0x4700b3){socket['emit'](_0x8a31('0x54'),{'id':Number(_0x20623c[_0x8a31('0x2f')]['id']),'tags':_0x4700b3||[]});return{'id':Number(_0x20623c[_0x8a31('0x2f')]['id']),'tags':_0x4700b3||[]};});}})['then'](respondWithResult(_0x2f0243,null))[_0x8a31('0x2d')](handleError(_0x2f0243,null));};exports['removeTags']=function(_0x3708c7,_0x304a9b){return db[_0x8a31('0x24')][_0x8a31('0x3b')]({'where':{'id':_0x3708c7[_0x8a31('0x2f')]['id']}})[_0x8a31('0x1d')](handleEntityNotFound(_0x304a9b,null))[_0x8a31('0x1d')](function(_0x587dd4){if(_0x587dd4){return _0x587dd4[_0x8a31('0x55')](_0x3708c7[_0x8a31('0x2b')]['ids']);}})[_0x8a31('0x1d')](respondWithStatusCode(_0x304a9b,null))['catch'](handleError(_0x304a9b,null));};exports[_0x8a31('0x56')]=function(_0x32ac77,_0x402816){var _0x397414=moment()[_0x8a31('0x57')]()[_0x8a31('0x58')]();var _0x1a8b16=path[_0x8a31('0x59')](config[_0x8a31('0x5a')],_0x8a31('0x5b'),_0x8a31('0x5c'),_0x8a31('0x5d'));var _0x4188f0=path[_0x8a31('0x59')](config['root'],_0x8a31('0x5b'),'files',_0x8a31('0x5e'));var _0x4d2aab=path[_0x8a31('0x59')](_0x1a8b16,_0x397414);var _0x4bb0c1=util[_0x8a31('0x5f')](_0x8a31('0x60'),_0x32ac77[_0x8a31('0x2f')]['id'],_0x397414);var _0x4db247=path[_0x8a31('0x59')](_0x1a8b16,_0x4bb0c1);var _0x16ec11=[];_0x16ec11['push']({'model':db['Attachment'],'as':_0x8a31('0x61'),'raw':!![]});var _0x2a5e05=[{'model':db[_0x8a31('0x3d')],'as':'Messages','attributes':['id',_0x8a31('0x3a'),_0x8a31('0x62')],'include':_0x16ec11}];return db[_0x8a31('0x24')]['find']({'where':{'id':_0x32ac77[_0x8a31('0x2f')]['id']},'include':_0x2a5e05})['then'](handleEntityNotFound(_0x402816,null))['then'](function(_0x804107){if(_0x804107&&_0x804107['Messages']){var _0x40e512=_0x804107[_0x8a31('0x63')]({'plain':!![]});fs[_0x8a31('0x64')](_0x4d2aab);for(var _0x5d1045=0x0;_0x5d1045<_0x40e512['Messages']['length'];_0x5d1045++){var _0x223a83=_0x40e512[_0x8a31('0x65')][_0x5d1045][_0x8a31('0x61')];if(_0x223a83){var _0x310c34=path[_0x8a31('0x59')](_0x4188f0,_0x223a83['basename']);if(fs[_0x8a31('0x66')](_0x310c34)){fs[_0x8a31('0x67')](_0x310c34)[_0x8a31('0x68')](fs[_0x8a31('0x69')](path[_0x8a31('0x59')](_0x4d2aab,_0x223a83[_0x8a31('0x6a')])));}}}return BPromise['resolve']()['then'](function(){return new BPromise(function(_0x1c6406,_0x46358f){zipdir(_0x4d2aab,{'saveTo':_0x4db247},function(_0x1eaeb5,_0x40c06e){if(_0x1eaeb5)return _0x46358f(_0x1eaeb5);return _0x1c6406(_0x40c06e);});})[_0x8a31('0x1d')](function(){return new BPromise(function(_0x3dabae,_0x3a7556){rimraf(_0x4d2aab,function(_0x27a7e6){if(_0x27a7e6)_0x3a7556(_0x27a7e6);return _0x3dabae();});});})[_0x8a31('0x1d')](function(){return _0x402816['download'](_0x4db247,_0x4bb0c1,function(_0x3641a9){if(_0x3641a9){console[_0x8a31('0x6b')](_0x8a31('0x6c'),_0x3641a9);}else{fs[_0x8a31('0x6d')](_0x4db247);}});});});}else{return _0x402816[_0x8a31('0x11')](0xc8);}})['catch'](handleError(_0x402816,null));}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.events.js b/server/api/faxInteraction/faxInteraction.events.js index 8d37581..62fb127 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 _0x4de7=['remove','getUsers','setDataValue','Users','map','findAll','then','unreadMessages','length','emit','hasOwnProperty','hook','exports','events','../../mysqldb','FaxInteraction','FaxMessage','setMaxListeners','save','update'];(function(_0x32e044,_0x100961){var _0xecad41=function(_0x28d85b){while(--_0x28d85b){_0x32e044['push'](_0x32e044['shift']());}};_0xecad41(++_0x100961);}(_0x4de7,0x14d));var _0x74de=function(_0x53c303,_0x3144c6){_0x53c303=_0x53c303-0x0;var _0x3e0b97=_0x4de7[_0x53c303];return _0x3e0b97;};'use strict';var EventEmitter=require(_0x74de('0x0'));var FaxInteraction=require(_0x74de('0x1'))['db'][_0x74de('0x2')];var FaxMessage=require('../../mysqldb')['db'][_0x74de('0x3')];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x74de('0x4')](0x0);var events={'afterCreate':_0x74de('0x5'),'afterUpdate':_0x74de('0x6'),'afterDestroy':_0x74de('0x7')};function emitEvent(_0x285960){return function(_0x1c81bc,_0x33e129,_0x1ecd4f){_0x1c81bc[_0x74de('0x8')]({'attributes':['id'],'raw':!![]})['then'](function(_0x55d956){_0x1c81bc[_0x74de('0x9')](_0x74de('0xa'),_0x55d956[_0x74de('0xb')](function(_0x3886e9){return{'id':_0x3886e9['id']};}));return FaxMessage[_0x74de('0xc')]({'where':{'FaxInteractionId':_0x1c81bc['id'],'direction':'in','read':![]},'raw':!![]});})[_0x74de('0xd')](function(_0x36f89a){_0x1c81bc['setDataValue'](_0x74de('0xe'),_0x36f89a[_0x74de('0xf')]);FaxInteractionEvents[_0x74de('0x10')](_0x285960+':'+_0x1c81bc['id'],_0x1c81bc);FaxInteractionEvents[_0x74de('0x10')](_0x285960,_0x1c81bc);_0x1ecd4f(null);})['catch'](_0x1ecd4f(null));};}for(var e in events){if(events[_0x74de('0x11')](e)){var event=events[e];FaxInteraction[_0x74de('0x12')](e,emitEvent(event));}}module[_0x74de('0x13')]=FaxInteractionEvents; \ No newline at end of file +var _0x9b95=['then','setDataValue','map','length','emit','catch','hasOwnProperty','exports','events','../../mysqldb','setMaxListeners','save','update','getUsers'];(function(_0x525899,_0x4f05bd){var _0x4b72e0=function(_0xb9b36a){while(--_0xb9b36a){_0x525899['push'](_0x525899['shift']());}};_0x4b72e0(++_0x4f05bd);}(_0x9b95,0x174));var _0x59b9=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x9b95[_0x2641f9];return _0x585741;};'use strict';var EventEmitter=require(_0x59b9('0x0'));var FaxInteraction=require(_0x59b9('0x1'))['db']['FaxInteraction'];var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxInteractionEvents=new EventEmitter();FaxInteractionEvents[_0x59b9('0x2')](0x0);var events={'afterCreate':_0x59b9('0x3'),'afterUpdate':_0x59b9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x22e0b6){return function(_0x539ead,_0x4bc6a4,_0x1e80cc){_0x539ead[_0x59b9('0x5')]({'attributes':['id'],'raw':!![]})[_0x59b9('0x6')](function(_0x67410e){_0x539ead[_0x59b9('0x7')]('Users',_0x67410e[_0x59b9('0x8')](function(_0x476f61){return{'id':_0x476f61['id']};}));return FaxMessage['findAll']({'where':{'FaxInteractionId':_0x539ead['id'],'direction':'in','read':![]},'raw':!![]});})[_0x59b9('0x6')](function(_0x3de59f){_0x539ead[_0x59b9('0x7')]('unreadMessages',_0x3de59f[_0x59b9('0x9')]);FaxInteractionEvents[_0x59b9('0xa')](_0x22e0b6+':'+_0x539ead['id'],_0x539ead);FaxInteractionEvents[_0x59b9('0xa')](_0x22e0b6,_0x539ead);_0x1e80cc(null);})[_0x59b9('0xb')](_0x1e80cc(null));};}for(var e in events){if(events[_0x59b9('0xc')](e)){var event=events[e];FaxInteraction['hook'](e,emitEvent(event));}}module[_0x59b9('0xd')]=FaxInteractionEvents; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.model.js b/server/api/faxInteraction/faxInteraction.model.js index f63e1f1..d965c10 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 _0xe432=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','exports','define','FaxInteraction','fax_interactions','changed','closed','closedAt','format'];(function(_0x2c7141,_0x3e3497){var _0x107cf2=function(_0x3a9e3d){while(--_0x3a9e3d){_0x2c7141['push'](_0x2c7141['shift']());}};_0x107cf2(++_0x3e3497);}(_0xe432,0x91));var _0x2e43=function(_0x382d47,_0x46843e){_0x382d47=_0x382d47-0x0;var _0x3fa02c=_0xe432[_0x382d47];return _0x3fa02c;};'use strict';var _=require(_0x2e43('0x0'));var util=require(_0x2e43('0x1'));var logger=require(_0x2e43('0x2'))(_0x2e43('0x3'));var moment=require(_0x2e43('0x4'));var BPromise=require(_0x2e43('0x5'));var rp=require(_0x2e43('0x6'));var fs=require('fs');var path=require(_0x2e43('0x7'));var rimraf=require(_0x2e43('0x8'));var config=require('../../config/environment');var attributes=require('./faxInteraction.attributes');module[_0x2e43('0x9')]=function(_0x437d69,_0x3e5b17){return _0x437d69[_0x2e43('0xa')](_0x2e43('0xb'),attributes,{'tableName':_0x2e43('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x49757c,_0xd24e6a,_0x336cdd){if(_0x49757c[_0x2e43('0xd')](_0x2e43('0xe'))){_0x49757c[_0x2e43('0xf')]=moment()[_0x2e43('0x10')](_0x2e43('0x11'));}_0x336cdd(null,_0x49757c);}}});}; \ No newline at end of file +var _0x43da=['bluebird','request-promise','path','rimraf','../../config/environment','./faxInteraction.attributes','exports','define','FaxInteraction','fax_interactions','changed','closedAt','format','YYYY-MM-DD\x20HH:mm:ss','lodash','../../config/logger','api'];(function(_0x4a747d,_0x3b747f){var _0x3a5b5c=function(_0x4b3e81){while(--_0x4b3e81){_0x4a747d['push'](_0x4a747d['shift']());}};_0x3a5b5c(++_0x3b747f);}(_0x43da,0xb8));var _0xa43d=function(_0x2db12b,_0x30ab1d){_0x2db12b=_0x2db12b-0x0;var _0x20990b=_0x43da[_0x2db12b];return _0x20990b;};'use strict';var _=require(_0xa43d('0x0'));var util=require('util');var logger=require(_0xa43d('0x1'))(_0xa43d('0x2'));var moment=require('moment');var BPromise=require(_0xa43d('0x3'));var rp=require(_0xa43d('0x4'));var fs=require('fs');var path=require(_0xa43d('0x5'));var rimraf=require(_0xa43d('0x6'));var config=require(_0xa43d('0x7'));var attributes=require(_0xa43d('0x8'));module[_0xa43d('0x9')]=function(_0x2b2363,_0x3dec12){return _0x2b2363[_0xa43d('0xa')](_0xa43d('0xb'),attributes,{'tableName':_0xa43d('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0xe0ce2e,_0x39b717,_0x4b5ca3){if(_0xe0ce2e[_0xa43d('0xd')]('closed')){_0xe0ce2e[_0xa43d('0xe')]=moment()[_0xa43d('0xf')](_0xa43d('0x10'));}_0x4b5ca3(null,_0xe0ce2e);}}});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.rpc.js b/server/api/faxInteraction/faxInteraction.rpc.js index b31a43c..206073f 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 _0xc9e6=['stringify','error','code','message','result','catch','UpdateFaxInteraction','FaxInteraction','update','body','options','raw','AddTagsToFaxInteraction','where','ids','omit','spread','AddTags','lodash','util','moment','ioredis','../../config/logger','rpc','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','request','then','info','FaxInteraction,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x50e2a8,_0x20e6b0){var _0x144c76=function(_0x558eab){while(--_0x558eab){_0x50e2a8['push'](_0x50e2a8['shift']());}};_0x144c76(++_0x20e6b0);}(_0xc9e6,0x7e));var _0x6c9e=function(_0x513a90,_0x2f7107){_0x513a90=_0x513a90-0x0;var _0x2cf336=_0xc9e6[_0x513a90];return _0x2cf336;};'use strict';var _=require(_0x6c9e('0x0'));var util=require(_0x6c9e('0x1'));var moment=require(_0x6c9e('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c9e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6c9e('0x4'))(_0x6c9e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x6c9e('0x6')]({'port':0x232a});config['redis']=_[_0x6c9e('0x7')](config[_0x6c9e('0x8')],{'host':_0x6c9e('0x9'),'port':0x18eb});var socket=require(_0x6c9e('0xa'))(new Redis(config['redis']));require(_0x6c9e('0xb'))['register'](socket);function respondWithRpcPromise(_0x2fa855,_0x14a78e,_0x16de4c){return new BPromise(function(_0x1e70dd,_0x5eb419){return client[_0x6c9e('0xc')](_0x2fa855,_0x16de4c)[_0x6c9e('0xd')](function(_0x5b8349){logger[_0x6c9e('0xe')](_0x6c9e('0xf'),_0x14a78e,_0x6c9e('0x10'));logger[_0x6c9e('0x11')]('FaxInteraction,\x20%s,\x20%s,\x20%s',_0x14a78e,_0x6c9e('0x10'),JSON[_0x6c9e('0x12')](_0x5b8349));if(_0x5b8349['error']){if(_0x5b8349[_0x6c9e('0x13')][_0x6c9e('0x14')]===0x1f4){logger[_0x6c9e('0x13')](_0x6c9e('0xf'),_0x14a78e,_0x5b8349[_0x6c9e('0x13')]['message']);return _0x5eb419(_0x5b8349[_0x6c9e('0x13')][_0x6c9e('0x15')]);}logger[_0x6c9e('0x13')](_0x6c9e('0xf'),_0x14a78e,_0x5b8349[_0x6c9e('0x13')][_0x6c9e('0x15')]);return _0x1e70dd(_0x5b8349[_0x6c9e('0x13')][_0x6c9e('0x15')]);}else{logger['info'](_0x6c9e('0xf'),_0x14a78e,_0x6c9e('0x10'));_0x1e70dd(_0x5b8349[_0x6c9e('0x16')][_0x6c9e('0x15')]);}})[_0x6c9e('0x17')](function(_0x59c0ad){logger['error'](_0x6c9e('0xf'),_0x14a78e,_0x59c0ad);_0x5eb419(_0x59c0ad);});});}exports[_0x6c9e('0x18')]=function(_0x1d6439){var _0x188635=this;return new Promise(function(_0x521f92,_0x30cffe){return db[_0x6c9e('0x19')][_0x6c9e('0x1a')](_0x1d6439[_0x6c9e('0x1b')],{'raw':_0x1d6439[_0x6c9e('0x1c')]?_0x1d6439['options'][_0x6c9e('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1d6439[_0x6c9e('0x1c')]?_0x1d6439[_0x6c9e('0x1c')]['where']||null:null,'attributes':_0x1d6439[_0x6c9e('0x1c')]?_0x1d6439[_0x6c9e('0x1c')]['attributes']||null:null,'limit':_0x1d6439[_0x6c9e('0x1c')]?_0x1d6439[_0x6c9e('0x1c')]['limit']||null:null})[_0x6c9e('0xd')](function(_0x35e0ab){logger[_0x6c9e('0xe')]('UpdateFaxInteraction',_0x1d6439);logger[_0x6c9e('0x11')](_0x6c9e('0x18'),_0x1d6439,JSON['stringify'](_0x35e0ab));_0x521f92(_0x35e0ab);})['catch'](function(_0x3003dd){logger[_0x6c9e('0x13')](_0x6c9e('0x18'),_0x3003dd[_0x6c9e('0x15')],_0x1d6439);_0x30cffe(_0x188635[_0x6c9e('0x13')](0x1f4,_0x3003dd['message']));});});};exports[_0x6c9e('0x1e')]=function(_0x5c7e87){return new Promise(function(_0x515f30,_0x50c785){return db[_0x6c9e('0x19')]['find']({'where':_0x5c7e87[_0x6c9e('0x1c')]?_0x5c7e87[_0x6c9e('0x1c')][_0x6c9e('0x1f')]||null:null})[_0x6c9e('0xd')](function(_0x58e3a5){if(_0x58e3a5){return _0x58e3a5['addTags'](_0x5c7e87['body'][_0x6c9e('0x20')],_[_0x6c9e('0x21')](_0x5c7e87[_0x6c9e('0x1b')],[_0x6c9e('0x20'),'id'])||{});}})[_0x6c9e('0x22')](function(_0x3543e8){logger['info'](_0x6c9e('0x23'),_0x5c7e87);logger[_0x6c9e('0x11')]('AddTags',_0x5c7e87,JSON[_0x6c9e('0x12')](_0x3543e8));_0x515f30(_0x3543e8);})['catch'](function(_0x21e202){logger[_0x6c9e('0x13')](_0x6c9e('0x23'),_0x21e202[_0x6c9e('0x15')],_0x5c7e87);_0x50c785(_this[_0x6c9e('0x13')](0x1f4,_0x21e202['message']));});});}; \ No newline at end of file +var _0xabe6=['client','http','defaults','redis','localhost','socket.io-emitter','./faxInteraction.socket','register','request','then','info','FaxInteraction,\x20%s,\x20%s','FaxInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','UpdateFaxInteraction','FaxInteraction','body','options','raw','attributes','limit','AddTagsToFaxInteraction','find','where','ids','omit','spread','AddTags','debug','lodash','moment','bluebird','randomstring','ioredis','rpc','../../config/environment'];(function(_0xde20ab,_0x52fd61){var _0x570592=function(_0x5aa36c){while(--_0x5aa36c){_0xde20ab['push'](_0xde20ab['shift']());}};_0x570592(++_0x52fd61);}(_0xabe6,0x9d));var _0x6abe=function(_0x301942,_0x2bd316){_0x301942=_0x301942-0x0;var _0x20fa70=_0xabe6[_0x301942];return _0x20fa70;};'use strict';var _=require(_0x6abe('0x0'));var util=require('util');var moment=require(_0x6abe('0x1'));var BPromise=require(_0x6abe('0x2'));var rs=require(_0x6abe('0x3'));var fs=require('fs');var Redis=require(_0x6abe('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6abe('0x5'));var config=require(_0x6abe('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6abe('0x7')][_0x6abe('0x8')]({'port':0x232a});config['redis']=_[_0x6abe('0x9')](config[_0x6abe('0xa')],{'host':_0x6abe('0xb'),'port':0x18eb});var socket=require(_0x6abe('0xc'))(new Redis(config[_0x6abe('0xa')]));require(_0x6abe('0xd'))[_0x6abe('0xe')](socket);function respondWithRpcPromise(_0x2d2c1b,_0x2561d2,_0x18ea7b){return new BPromise(function(_0x520ffe,_0x5bda7b){return client[_0x6abe('0xf')](_0x2d2c1b,_0x18ea7b)[_0x6abe('0x10')](function(_0x5bb261){logger[_0x6abe('0x11')](_0x6abe('0x12'),_0x2561d2,'request\x20sent');logger['debug'](_0x6abe('0x13'),_0x2561d2,_0x6abe('0x14'),JSON[_0x6abe('0x15')](_0x5bb261));if(_0x5bb261[_0x6abe('0x16')]){if(_0x5bb261[_0x6abe('0x16')]['code']===0x1f4){logger[_0x6abe('0x16')](_0x6abe('0x12'),_0x2561d2,_0x5bb261[_0x6abe('0x16')][_0x6abe('0x17')]);return _0x5bda7b(_0x5bb261[_0x6abe('0x16')][_0x6abe('0x17')]);}logger[_0x6abe('0x16')](_0x6abe('0x12'),_0x2561d2,_0x5bb261[_0x6abe('0x16')][_0x6abe('0x17')]);return _0x520ffe(_0x5bb261[_0x6abe('0x16')][_0x6abe('0x17')]);}else{logger['info'](_0x6abe('0x12'),_0x2561d2,'request\x20sent');_0x520ffe(_0x5bb261[_0x6abe('0x18')]['message']);}})[_0x6abe('0x19')](function(_0x2970af){logger[_0x6abe('0x16')]('FaxInteraction,\x20%s,\x20%s',_0x2561d2,_0x2970af);_0x5bda7b(_0x2970af);});});}exports[_0x6abe('0x1a')]=function(_0x447d99){var _0x3dfa52=this;return new Promise(function(_0x153625,_0x469a3a){return db[_0x6abe('0x1b')]['update'](_0x447d99[_0x6abe('0x1c')],{'raw':_0x447d99[_0x6abe('0x1d')]?_0x447d99[_0x6abe('0x1d')][_0x6abe('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x447d99[_0x6abe('0x1d')]?_0x447d99[_0x6abe('0x1d')]['where']||null:null,'attributes':_0x447d99[_0x6abe('0x1d')]?_0x447d99['options'][_0x6abe('0x1f')]||null:null,'limit':_0x447d99[_0x6abe('0x1d')]?_0x447d99[_0x6abe('0x1d')][_0x6abe('0x20')]||null:null})['then'](function(_0x4b5264){logger['info'](_0x6abe('0x1a'),_0x447d99);logger['debug'](_0x6abe('0x1a'),_0x447d99,JSON[_0x6abe('0x15')](_0x4b5264));_0x153625(_0x4b5264);})[_0x6abe('0x19')](function(_0x39495c){logger[_0x6abe('0x16')](_0x6abe('0x1a'),_0x39495c['message'],_0x447d99);_0x469a3a(_0x3dfa52[_0x6abe('0x16')](0x1f4,_0x39495c[_0x6abe('0x17')]));});});};exports[_0x6abe('0x21')]=function(_0x12de89){return new Promise(function(_0x3233c3,_0x44c726){return db['FaxInteraction'][_0x6abe('0x22')]({'where':_0x12de89[_0x6abe('0x1d')]?_0x12de89['options'][_0x6abe('0x23')]||null:null})[_0x6abe('0x10')](function(_0x18dec9){if(_0x18dec9){return _0x18dec9['addTags'](_0x12de89['body'][_0x6abe('0x24')],_[_0x6abe('0x25')](_0x12de89[_0x6abe('0x1c')],['ids','id'])||{});}})[_0x6abe('0x26')](function(_0x1fee46){logger[_0x6abe('0x11')](_0x6abe('0x27'),_0x12de89);logger[_0x6abe('0x28')](_0x6abe('0x27'),_0x12de89,JSON[_0x6abe('0x15')](_0x1fee46));_0x3233c3(_0x1fee46);})[_0x6abe('0x19')](function(_0x2b64cf){logger['error'](_0x6abe('0x27'),_0x2b64cf[_0x6abe('0x17')],_0x12de89);_0x44c726(_this['error'](0x1f4,_0x2b64cf[_0x6abe('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/faxInteraction/faxInteraction.socket.js b/server/api/faxInteraction/faxInteraction.socket.js index 29a51f0..7397373 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 _0xe0f9=['emit','removeListener','length','faxInteraction:','./faxInteraction.events','save','remove','update'];(function(_0x1dac29,_0x135d74){var _0x3b8484=function(_0xe6bc8a){while(--_0xe6bc8a){_0x1dac29['push'](_0x1dac29['shift']());}};_0x3b8484(++_0x135d74);}(_0xe0f9,0x17c));var _0x9e0f=function(_0x120d11,_0x3d34c2){_0x120d11=_0x120d11-0x0;var _0x1d9928=_0xe0f9[_0x120d11];return _0x1d9928;};'use strict';var FaxInteractionEvents=require(_0x9e0f('0x0'));var events=[_0x9e0f('0x1'),_0x9e0f('0x2'),_0x9e0f('0x3')];function createListener(_0x28d312,_0x5a59db){return function(_0x579c3a){_0x5a59db[_0x9e0f('0x4')](_0x28d312,_0x579c3a);};}function removeListener(_0x39e8a2,_0x576f22){return function(){FaxInteractionEvents[_0x9e0f('0x5')](_0x39e8a2,_0x576f22);};}exports['register']=function(_0x2a0288){for(var _0x1cd48d=0x0,_0x1e9580=events[_0x9e0f('0x6')];_0x1cd48d<_0x1e9580;_0x1cd48d++){var _0x2f3bbb=events[_0x1cd48d];var _0x41c8b8=createListener(_0x9e0f('0x7')+_0x2f3bbb,_0x2a0288);FaxInteractionEvents['on'](_0x2f3bbb,_0x41c8b8);}}; \ No newline at end of file +var _0xe604=['register','length','save','remove','update','emit','removeListener'];(function(_0xa7e89a,_0x1f009e){var _0x23e057=function(_0x9e1b39){while(--_0x9e1b39){_0xa7e89a['push'](_0xa7e89a['shift']());}};_0x23e057(++_0x1f009e);}(_0xe604,0x1d0));var _0x4e60=function(_0x516799,_0x31ac2b){_0x516799=_0x516799-0x0;var _0x2f637c=_0xe604[_0x516799];return _0x2f637c;};'use strict';var FaxInteractionEvents=require('./faxInteraction.events');var events=[_0x4e60('0x0'),_0x4e60('0x1'),_0x4e60('0x2')];function createListener(_0x1ad83c,_0x1a7e1d){return function(_0x8ee8b8){_0x1a7e1d[_0x4e60('0x3')](_0x1ad83c,_0x8ee8b8);};}function removeListener(_0x2f9b2c,_0x4dd892){return function(){FaxInteractionEvents[_0x4e60('0x4')](_0x2f9b2c,_0x4dd892);};}exports[_0x4e60('0x5')]=function(_0xa30c08){for(var _0x2380aa=0x0,_0x2a2b91=events[_0x4e60('0x6')];_0x2380aa<_0x2a2b91;_0x2380aa++){var _0x3874c5=events[_0x2380aa];var _0x23a23a=createListener('faxInteraction:'+_0x3874c5,_0xa30c08);FaxInteractionEvents['on'](_0x3874c5,_0x23a23a);}}; \ No newline at end of file diff --git a/server/api/faxInteraction/index.js b/server/api/faxInteraction/index.js index 94b4fe0..4a2c3c8 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 _0xc212=['put','tracked','fax','faxinteraction:update','update','delete','faxinteraction:destroy','/:id/tags','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','index','/describe','/:id','isAuthenticated','show','getMessages','/:id/download','download','post','/:id/messages','addMessage','faxinteraction:addtags','addTags'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xc212,0x175));var _0x2c21=function(_0x1f09f8,_0x247a81){_0x1f09f8=_0x1f09f8-0x0;var _0x5138d1=_0xc212[_0x1f09f8];return _0x5138d1;};'use strict';var multer=require(_0x2c21('0x0'));var util=require('util');var path=require(_0x2c21('0x1'));var timeout=require(_0x2c21('0x2'));var express=require(_0x2c21('0x3'));var router=express[_0x2c21('0x4')]();var fs_extra=require(_0x2c21('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x2c21('0x6'));var config=require(_0x2c21('0x7'));var controller=require(_0x2c21('0x8'));router[_0x2c21('0x9')]('/',auth['isAuthenticated'](),controller[_0x2c21('0xa')]);router[_0x2c21('0x9')](_0x2c21('0xb'),auth['isAuthenticated'](),controller['describe']);router[_0x2c21('0x9')](_0x2c21('0xc'),auth[_0x2c21('0xd')](),controller[_0x2c21('0xe')]);router['get']('/:id/messages',auth[_0x2c21('0xd')](),controller[_0x2c21('0xf')]);router[_0x2c21('0x9')](_0x2c21('0x10'),auth[_0x2c21('0xd')](),controller[_0x2c21('0x11')]);router[_0x2c21('0x12')]('/',auth[_0x2c21('0xd')](),controller['create']);router[_0x2c21('0x12')](_0x2c21('0x13'),auth[_0x2c21('0xd')](),controller[_0x2c21('0x14')]);router[_0x2c21('0x12')]('/:id/tags',auth[_0x2c21('0xd')](),interaction['tracked']('fax',_0x2c21('0x15')),controller[_0x2c21('0x16')]);router[_0x2c21('0x17')](_0x2c21('0xc'),auth[_0x2c21('0xd')](),interaction[_0x2c21('0x18')](_0x2c21('0x19'),_0x2c21('0x1a')),controller[_0x2c21('0x1b')]);router[_0x2c21('0x1c')]('/:id',auth[_0x2c21('0xd')](),interaction[_0x2c21('0x18')](_0x2c21('0x19'),_0x2c21('0x1d')),controller['destroy']);router['delete'](_0x2c21('0x1e'),auth[_0x2c21('0xd')](),controller[_0x2c21('0x1f')]);module[_0x2c21('0x20')]=router; \ No newline at end of file +var _0xff7e=['/:id/messages','/:id/download','download','post','create','/:id/tags','fax','faxinteraction:addtags','addTags','put','/:id','tracked','update','delete','removeTags','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./faxInteraction.controller','get','/describe','isAuthenticated','describe'];(function(_0x33fd8d,_0x23cd47){var _0x36ae2b=function(_0x59ad92){while(--_0x59ad92){_0x33fd8d['push'](_0x33fd8d['shift']());}};_0x36ae2b(++_0x23cd47);}(_0xff7e,0x146));var _0xeff7=function(_0x4f56b8,_0xd96512){_0x4f56b8=_0x4f56b8-0x0;var _0x551fb1=_0xff7e[_0x4f56b8];return _0x551fb1;};'use strict';var multer=require(_0xeff7('0x0'));var util=require(_0xeff7('0x1'));var path=require(_0xeff7('0x2'));var timeout=require(_0xeff7('0x3'));var express=require(_0xeff7('0x4'));var router=express[_0xeff7('0x5')]();var fs_extra=require(_0xeff7('0x6'));var auth=require(_0xeff7('0x7'));var interaction=require(_0xeff7('0x8'));var config=require(_0xeff7('0x9'));var controller=require(_0xeff7('0xa'));router[_0xeff7('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0xeff7('0xb')](_0xeff7('0xc'),auth[_0xeff7('0xd')](),controller[_0xeff7('0xe')]);router[_0xeff7('0xb')]('/:id',auth[_0xeff7('0xd')](),controller['show']);router[_0xeff7('0xb')](_0xeff7('0xf'),auth[_0xeff7('0xd')](),controller['getMessages']);router[_0xeff7('0xb')](_0xeff7('0x10'),auth[_0xeff7('0xd')](),controller[_0xeff7('0x11')]);router[_0xeff7('0x12')]('/',auth[_0xeff7('0xd')](),controller[_0xeff7('0x13')]);router[_0xeff7('0x12')](_0xeff7('0xf'),auth[_0xeff7('0xd')](),controller['addMessage']);router[_0xeff7('0x12')](_0xeff7('0x14'),auth[_0xeff7('0xd')](),interaction['tracked'](_0xeff7('0x15'),_0xeff7('0x16')),controller[_0xeff7('0x17')]);router[_0xeff7('0x18')](_0xeff7('0x19'),auth['isAuthenticated'](),interaction[_0xeff7('0x1a')](_0xeff7('0x15'),'faxinteraction:update'),controller[_0xeff7('0x1b')]);router['delete'](_0xeff7('0x19'),auth['isAuthenticated'](),interaction['tracked']('fax','faxinteraction:destroy'),controller['destroy']);router[_0xeff7('0x1c')]('/:id/tags',auth[_0xeff7('0xd')](),controller[_0xeff7('0x1d')]);module[_0xeff7('0x1e')]=router; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.attributes.js b/server/api/faxMessage/faxMessage.attributes.js index 3c7dfc2..470d0b0 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 _0xedd9=['exports','TEXT','medium','BOOLEAN','ENUM','out'];(function(_0x16eb19,_0x58cea4){var _0x312a25=function(_0x343702){while(--_0x343702){_0x16eb19['push'](_0x16eb19['shift']());}};_0x312a25(++_0x58cea4);}(_0xedd9,0xfc));var _0x9edd=function(_0x62e5b7,_0x3aed52){_0x62e5b7=_0x62e5b7-0x0;var _0x2ce73a=_0xedd9[_0x62e5b7];return _0x2ce73a;};'use strict';var Sequelize=require('sequelize');module[_0x9edd('0x0')]={'body':{'type':Sequelize[_0x9edd('0x1')](_0x9edd('0x2')),'allowNull':![]},'read':{'type':Sequelize[_0x9edd('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0x9edd('0x4')]('in',_0x9edd('0x5')),'defaultValue':_0x9edd('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize[_0x9edd('0x1')],'defaultValue':null},'readAt':{'type':Sequelize['DATE']}}; \ No newline at end of file +var _0xc576=['sequelize','exports','TEXT','medium','BOOLEAN','out','DATE'];(function(_0x77da22,_0xfbdad4){var _0x3c3494=function(_0x1c0cb6){while(--_0x1c0cb6){_0x77da22['push'](_0x77da22['shift']());}};_0x3c3494(++_0xfbdad4);}(_0xc576,0x1ea));var _0x6c57=function(_0x32bce8,_0x54f965){_0x32bce8=_0x32bce8-0x0;var _0x38badc=_0xc576[_0x32bce8];return _0x38badc;};'use strict';var Sequelize=require(_0x6c57('0x0'));module[_0x6c57('0x1')]={'body':{'type':Sequelize[_0x6c57('0x2')](_0x6c57('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x6c57('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x6c57('0x5'),'allowNull':![]},'failMessage':{'type':Sequelize['TEXT'],'defaultValue':null},'readAt':{'type':Sequelize[_0x6c57('0x6')]}}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.controller.js b/server/api/faxMessage/faxMessage.controller.js index a4b8675..80d3359 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 _0xa3ef=['event','acceptmessage','reject','fax','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','contact','User','internal','EventManager','create','CmContact','Attachment','AttachmentId','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','download','join','root','server','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxMessage.socket','client','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','FaxMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','stack','name','send','index','map','FaxMessage','rawAttributes','fieldName','type','key','model','query','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','find','body','describe','fax-interactions','accept','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','get','FaxInteractionId','isNil','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','sequelize','Sequelize','QueryTypes','agent','email','manual','interface','SIP/%s','motionChannel','channel'];(function(_0x1fcaf1,_0x21c3c2){var _0x55f464=function(_0x348eb3){while(--_0x348eb3){_0x1fcaf1['push'](_0x1fcaf1['shift']());}};_0x55f464(++_0x21c3c2);}(_0xa3ef,0xa5));var _0xfa3e=function(_0x14dcd7,_0x18701c){_0x14dcd7=_0x14dcd7-0x0;var _0x2849bb=_0xa3ef[_0x14dcd7];return _0x2849bb;};'use strict';var emlformat=require(_0xfa3e('0x0'));var rimraf=require(_0xfa3e('0x1'));var zipdir=require(_0xfa3e('0x2'));var jsonpatch=require(_0xfa3e('0x3'));var rp=require(_0xfa3e('0x4'));var moment=require('moment');var BPromise=require(_0xfa3e('0x5'));var Mustache=require(_0xfa3e('0x6'));var util=require('util');var path=require(_0xfa3e('0x7'));var sox=require(_0xfa3e('0x8'));var csv=require('to-csv');var ejs=require(_0xfa3e('0x9'));var fs=require('fs');var fs_extra=require(_0xfa3e('0xa'));var _=require(_0xfa3e('0xb'));var squel=require(_0xfa3e('0xc'));var crypto=require(_0xfa3e('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xfa3e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xfa3e('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xfa3e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xfa3e('0x11'))('api');var utils=require(_0xfa3e('0x12'));var config=require(_0xfa3e('0x13'));var licenseUtil=require(_0xfa3e('0x14'));var db=require(_0xfa3e('0x15'))['db'];config[_0xfa3e('0x16')]=_[_0xfa3e('0x17')](config[_0xfa3e('0x16')],{'host':_0xfa3e('0x18'),'port':0x18eb});var socket=require(_0xfa3e('0x19'))(new Redis(config[_0xfa3e('0x16')]));require(_0xfa3e('0x1a'))['register'](socket);var jayson=require('jayson/promise');var client=jayson[_0xfa3e('0x1b')][_0xfa3e('0x1c')]({'port':0x232c});var client9002=jayson[_0xfa3e('0x1b')][_0xfa3e('0x1c')]({'port':0x232a});function respondWithRpcPromise(_0x524688,_0xe7c6fe,_0x54e714,_0x2254e7){return new BPromise(function(_0x8e3611,_0x41f92a){var _0x3235a8=_0x2254e7||client;return _0x3235a8[_0xfa3e('0x1d')](_0x524688,_0x54e714)[_0xfa3e('0x1e')](function(_0x3043d1){logger[_0xfa3e('0x1f')](_0xfa3e('0x20'),_0xe7c6fe,_0xfa3e('0x21'));logger['debug'](_0xfa3e('0x22'),_0xe7c6fe,'request\x20sent',JSON[_0xfa3e('0x23')](_0x3043d1));if(_0x3043d1[_0xfa3e('0x24')]){if(_0x3043d1['error']['code']===0x1f4){logger['error'](_0xfa3e('0x20'),_0xe7c6fe,_0x3043d1[_0xfa3e('0x24')][_0xfa3e('0x25')]);return _0x41f92a(_0x3043d1[_0xfa3e('0x24')][_0xfa3e('0x25')]);}logger[_0xfa3e('0x24')](_0xfa3e('0x20'),_0xe7c6fe,_0x3043d1['error'][_0xfa3e('0x25')]);return _0x8e3611(_0x3043d1[_0xfa3e('0x24')][_0xfa3e('0x25')]);}else{logger[_0xfa3e('0x1f')](_0xfa3e('0x20'),_0xe7c6fe,'request\x20sent');_0x8e3611(_0x3043d1[_0xfa3e('0x26')][_0xfa3e('0x25')]);}})['catch'](function(_0x2ec118){logger[_0xfa3e('0x24')](_0xfa3e('0x20'),_0xe7c6fe,_0x2ec118);_0x41f92a(_0x2ec118);});});}function respondWithStatusCode(_0x2184e5,_0xd7acd7){_0xd7acd7=_0xd7acd7||0xcc;return function(_0xb43b25){if(_0xb43b25){return _0x2184e5['sendStatus'](_0xd7acd7);}return _0x2184e5[_0xfa3e('0x27')](_0xd7acd7)[_0xfa3e('0x28')]();};}function respondWithResult(_0x2ac1ab,_0x2779da){_0x2779da=_0x2779da||0xc8;return function(_0x32be8d){if(_0x32be8d){return _0x2ac1ab[_0xfa3e('0x27')](_0x2779da)[_0xfa3e('0x29')](_0x32be8d);}};}function respondWithFilteredResult(_0x4f7a02,_0x5292ee){return function(_0x3eca7f){if(_0x3eca7f){var _0x16793d=typeof _0x5292ee[_0xfa3e('0x2a')]===_0xfa3e('0x2b')&&typeof _0x5292ee[_0xfa3e('0x2c')]==='undefined';var _0x41182c=_0x3eca7f[_0xfa3e('0x2d')];var _0x181d28=_0x16793d?0x0:_0x5292ee[_0xfa3e('0x2a')];var _0x207ec2=_0x16793d?_0x3eca7f[_0xfa3e('0x2d')]:_0x5292ee['offset']+_0x5292ee[_0xfa3e('0x2c')];var _0x21342e;if(_0x207ec2>=_0x41182c){_0x207ec2=_0x41182c;_0x21342e=0xc8;}else{_0x21342e=0xce;}_0x4f7a02[_0xfa3e('0x27')](_0x21342e);return _0x4f7a02['set'](_0xfa3e('0x2e'),_0x181d28+'-'+_0x207ec2+'/'+_0x41182c)[_0xfa3e('0x29')](_0x3eca7f);}return null;};}function patchUpdates(_0x23b2d0){return function(_0x5f0c34){try{jsonpatch[_0xfa3e('0x2f')](_0x5f0c34,_0x23b2d0,!![]);}catch(_0x43263f){return BPromise['reject'](_0x43263f);}return _0x5f0c34[_0xfa3e('0x30')]();};}function saveUpdates(_0x5cbb24,_0x2847b7){return function(_0x4ab867){if(_0x4ab867){return _0x4ab867[_0xfa3e('0x31')](_0x5cbb24)[_0xfa3e('0x1e')](function(_0x4ad9ab){return _0x4ad9ab;});}return null;};}function removeEntity(_0x553e30,_0x20084f){return function(_0x196880){if(_0x196880){return _0x196880[_0xfa3e('0x32')]()[_0xfa3e('0x1e')](function(){_0x553e30[_0xfa3e('0x27')](0xcc)[_0xfa3e('0x28')]();});}};}function handleEntityNotFound(_0x2eeea4,_0x573104){return function(_0x57a4d5){if(!_0x57a4d5){_0x2eeea4['sendStatus'](0x194);}return _0x57a4d5;};}function handleError(_0x133775,_0x4108af){_0x4108af=_0x4108af||0x1f4;return function(_0x41f24c){logger[_0xfa3e('0x24')](_0x41f24c[_0xfa3e('0x33')]);if(_0x41f24c['name']){delete _0x41f24c[_0xfa3e('0x34')];}_0x133775[_0xfa3e('0x27')](_0x4108af)[_0xfa3e('0x35')](_0x41f24c);};}exports[_0xfa3e('0x36')]=function(_0x1c7222,_0xc6a82e){var _0x1dbe21={},_0x246d28={},_0x3091c4={'count':0x0,'rows':[]};var _0x2bc7ae=_[_0xfa3e('0x37')](db[_0xfa3e('0x38')][_0xfa3e('0x39')],function(_0x31069f){return{'name':_0x31069f[_0xfa3e('0x3a')],'type':_0x31069f[_0xfa3e('0x3b')][_0xfa3e('0x3c')]};});_0x246d28[_0xfa3e('0x3d')]=_[_0xfa3e('0x37')](_0x2bc7ae,_0xfa3e('0x34'));_0x246d28['query']=_['keys'](_0x1c7222[_0xfa3e('0x3e')]);_0x246d28[_0xfa3e('0x3f')]=_[_0xfa3e('0x40')](_0x246d28[_0xfa3e('0x3d')],_0x246d28[_0xfa3e('0x3e')]);_0x1dbe21['attributes']=_[_0xfa3e('0x40')](_0x246d28[_0xfa3e('0x3d')],qs['fields'](_0x1c7222[_0xfa3e('0x3e')][_0xfa3e('0x41')]));_0x1dbe21['attributes']=_0x1dbe21[_0xfa3e('0x42')][_0xfa3e('0x43')]?_0x1dbe21[_0xfa3e('0x42')]:_0x246d28['model'];if(!_0x1c7222[_0xfa3e('0x3e')]['hasOwnProperty'](_0xfa3e('0x44'))){_0x1dbe21[_0xfa3e('0x2c')]=qs['limit'](_0x1c7222[_0xfa3e('0x3e')][_0xfa3e('0x2c')]);_0x1dbe21[_0xfa3e('0x2a')]=qs[_0xfa3e('0x2a')](_0x1c7222[_0xfa3e('0x3e')][_0xfa3e('0x2a')]);}_0x1dbe21[_0xfa3e('0x45')]=qs[_0xfa3e('0x46')](_0x1c7222['query']['sort']);_0x1dbe21[_0xfa3e('0x47')]=qs[_0xfa3e('0x3f')](_[_0xfa3e('0x48')](_0x1c7222[_0xfa3e('0x3e')],_0x246d28[_0xfa3e('0x3f')]),_0x2bc7ae);if(_0x1c7222[_0xfa3e('0x3e')][_0xfa3e('0x49')]){_0x1dbe21[_0xfa3e('0x47')]=_['merge'](_0x1dbe21['where'],{'$or':_[_0xfa3e('0x37')](_0x2bc7ae,function(_0x3a5769){if(_0x3a5769[_0xfa3e('0x3b')]!==_0xfa3e('0x4a')){var _0x22d7c3={};_0x22d7c3[_0x3a5769['name']]={'$like':'%'+_0x1c7222[_0xfa3e('0x3e')][_0xfa3e('0x49')]+'%'};return _0x22d7c3;}})});}_0x1dbe21=_[_0xfa3e('0x4b')]({},_0x1dbe21,_0x1c7222[_0xfa3e('0x4c')]);var _0x201958={'where':_0x1dbe21['where']};return db[_0xfa3e('0x38')][_0xfa3e('0x2d')](_0x201958)[_0xfa3e('0x1e')](function(_0x2af884){_0x3091c4[_0xfa3e('0x2d')]=_0x2af884;if(_0x1c7222[_0xfa3e('0x3e')][_0xfa3e('0x4d')]){_0x1dbe21[_0xfa3e('0x4e')]=[{'all':!![]}];}return db[_0xfa3e('0x38')][_0xfa3e('0x4f')](_0x1dbe21);})[_0xfa3e('0x1e')](function(_0x4f024a){_0x3091c4[_0xfa3e('0x50')]=_0x4f024a;return _0x3091c4;})[_0xfa3e('0x1e')](respondWithFilteredResult(_0xc6a82e,_0x1dbe21))[_0xfa3e('0x51')](handleError(_0xc6a82e,null));};exports[_0xfa3e('0x52')]=function(_0x5d31d9,_0x147f05){var _0x1f2973={'raw':!![],'where':{'id':_0x5d31d9[_0xfa3e('0x53')]['id']}},_0x235207={};_0x235207[_0xfa3e('0x3d')]=_['keys'](db['FaxMessage'][_0xfa3e('0x39')]);_0x235207[_0xfa3e('0x3e')]=_[_0xfa3e('0x54')](_0x5d31d9[_0xfa3e('0x3e')]);_0x235207[_0xfa3e('0x3f')]=_[_0xfa3e('0x40')](_0x235207[_0xfa3e('0x3d')],_0x235207[_0xfa3e('0x3e')]);_0x1f2973[_0xfa3e('0x42')]=_[_0xfa3e('0x40')](_0x235207['model'],qs[_0xfa3e('0x41')](_0x5d31d9[_0xfa3e('0x3e')]['fields']));_0x1f2973[_0xfa3e('0x42')]=_0x1f2973[_0xfa3e('0x42')][_0xfa3e('0x43')]?_0x1f2973[_0xfa3e('0x42')]:_0x235207[_0xfa3e('0x3d')];if(_0x5d31d9[_0xfa3e('0x3e')][_0xfa3e('0x4d')]){_0x1f2973[_0xfa3e('0x4e')]=[{'all':!![]}];}_0x1f2973=_[_0xfa3e('0x4b')]({},_0x1f2973,_0x5d31d9['options']);return db[_0xfa3e('0x38')][_0xfa3e('0x55')](_0x1f2973)[_0xfa3e('0x1e')](handleEntityNotFound(_0x147f05,null))[_0xfa3e('0x1e')](respondWithResult(_0x147f05,null))[_0xfa3e('0x51')](handleError(_0x147f05,null));};exports[_0xfa3e('0x31')]=function(_0xc164dc,_0x5f1f26){if(_0xc164dc[_0xfa3e('0x56')]['id']){delete _0xc164dc[_0xfa3e('0x56')]['id'];}return db[_0xfa3e('0x38')][_0xfa3e('0x55')]({'where':{'id':_0xc164dc[_0xfa3e('0x53')]['id']}})['then'](handleEntityNotFound(_0x5f1f26,null))[_0xfa3e('0x1e')](saveUpdates(_0xc164dc[_0xfa3e('0x56')],null))['then'](respondWithResult(_0x5f1f26,null))[_0xfa3e('0x51')](handleError(_0x5f1f26,null));};exports[_0xfa3e('0x32')]=function(_0x2aff09,_0x4e264b){return db[_0xfa3e('0x38')][_0xfa3e('0x55')]({'where':{'id':_0x2aff09['params']['id']}})[_0xfa3e('0x1e')](handleEntityNotFound(_0x4e264b,null))[_0xfa3e('0x1e')](removeEntity(_0x4e264b,null))[_0xfa3e('0x51')](handleError(_0x4e264b,null));};exports[_0xfa3e('0x57')]=function(_0x4cd60a,_0x6ceafc){return db[_0xfa3e('0x38')][_0xfa3e('0x57')]()[_0xfa3e('0x1e')](respondWithResult(_0x6ceafc,null))[_0xfa3e('0x51')](handleError(_0x6ceafc,null));};var interaction_log=require(_0xfa3e('0x11'))(_0xfa3e('0x58'));exports[_0xfa3e('0x59')]=function(_0x4406db,_0x3e6b41,_0x5c24ea){var _0x2ca35f={'agent':{},'channel':'fax'};if(_0x4406db['body']['id']){delete _0x4406db['body']['id'];}_0x4406db[_0xfa3e('0x56')][_0xfa3e('0x5a')]=!![];_0x4406db[_0xfa3e('0x56')]['readAt']=moment()[_0xfa3e('0x5b')](_0xfa3e('0x5c'));_0x4406db[_0xfa3e('0x56')]['UserId']=_0x4406db[_0xfa3e('0x56')][_0xfa3e('0x5d')]||_0x4406db[_0xfa3e('0x5e')]['id'];_0x2ca35f['agent']['id']=_0x4406db[_0xfa3e('0x56')][_0xfa3e('0x5d')];return db['FaxMessage'][_0xfa3e('0x55')]({'where':{'id':_0x4406db[_0xfa3e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x3e6b41,null))[_0xfa3e('0x1e')](saveUpdates(_0x4406db['body'],null))['then'](function(_0x17cf80){if(_0x17cf80){_0x2ca35f[_0xfa3e('0x25')]=_0x17cf80[_0xfa3e('0x5f')]({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x17cf80[_0xfa3e('0x60')]}});}return null;})[_0xfa3e('0x1e')](handleEntityNotFound(_0x3e6b41,null))[_0xfa3e('0x1e')](function(_0x4a71cf){if(_0x4a71cf){return _0x4a71cf['update']({'UserId':_0x4406db['body'][_0xfa3e('0x5d')],'read1stAt':_[_0xfa3e('0x61')](_0x4a71cf['read1stAt'])?moment()[_0xfa3e('0x5b')](_0xfa3e('0x5c')):undefined});}return null;})[_0xfa3e('0x1e')](function(_0x28e566){if(_0x28e566){_0x2ca35f[_0xfa3e('0x62')]=_0x28e566[_0xfa3e('0x5f')]({'plain':!![]});interaction_log[_0xfa3e('0x1f')](_0xfa3e('0x63'),_0x4406db[_0xfa3e('0x5e')]['id'],_0x4406db[_0xfa3e('0x5e')]['name'],_0x4406db[_0xfa3e('0x5e')][_0xfa3e('0x64')],_0x2ca35f[_0xfa3e('0x62')]['id'],_0x4406db[_0xfa3e('0x56')]?JSON['stringify'](_0x4406db[_0xfa3e('0x56')]):_0xfa3e('0x65'));return respondWithRpcPromise(_0xfa3e('0x66'),_0xfa3e('0x67'),_0x2ca35f);}return null;})[_0xfa3e('0x1e')](function(_0x11d213){var _0x30554d=_0xfa3e('0x68')+_0x11d213[_0xfa3e('0x25')]['ContactId'];return db[_0xfa3e('0x69')][_0xfa3e('0x3e')](_0x30554d,{'type':db[_0xfa3e('0x6a')][_0xfa3e('0x6b')]['SELECT'],'raw':!![]})[_0xfa3e('0x1e')](function(_0xf51db4){return _0xf51db4;});})[_0xfa3e('0x1e')](function(_0x2b8bd2){if(_0x2b8bd2){_0x2ca35f[_0xfa3e('0x25')]['contact']=_0x2b8bd2[0x0];if(!_0x4406db['body'][_0xfa3e('0x5d')])return;return db['User'][_0xfa3e('0x55')]({'where':{'id':_0x4406db[_0xfa3e('0x56')][_0xfa3e('0x5d')],'role':_0xfa3e('0x6c')},'attributes':['id',_0xfa3e('0x34'),'fullname',_0xfa3e('0x6d'),'internal'],'raw':!![]});}return null;})['then'](function(_0x2e5976){if(!_0x2e5976)return null;_0x2ca35f['message'][_0xfa3e('0x6c')]=_0x2e5976;return _0x2ca35f;})['then'](function(_0x4f5af0){if(_0x4f5af0){if(_0x4406db['body'][_0xfa3e('0x6e')]){_0x2ca35f['message'][_0xfa3e('0x6f')]=util[_0xfa3e('0x5b')](_0xfa3e('0x70'),_0x4406db[_0xfa3e('0x5e')][_0xfa3e('0x34')]);_0x2ca35f['message']['channel']=_0x2ca35f['channel'];_0x2ca35f[_0xfa3e('0x25')][_0xfa3e('0x71')]=_0x2ca35f[_0xfa3e('0x72')];_0x2ca35f['message'][_0xfa3e('0x73')]=_0xfa3e('0x59');return respondWithRpcPromise('EventManager','EventManager',{'event':_0xfa3e('0x74'),'message':_0x2ca35f[_0xfa3e('0x25')]},client9002)[_0xfa3e('0x1e')](function(){return _0x2ca35f;});}return _0x2ca35f;}return null;})[_0xfa3e('0x1e')](respondWithResult(_0x3e6b41,null))[_0xfa3e('0x51')](handleError(_0x3e6b41,null));};var interaction_log=require(_0xfa3e('0x11'))(_0xfa3e('0x58'));exports[_0xfa3e('0x75')]=function(_0x18e76b,_0x202d6a,_0x4e1a8b){var _0x4f7d81={'agent':{},'channel':_0xfa3e('0x76')};if(_0x18e76b[_0xfa3e('0x56')]['id']){delete _0x18e76b[_0xfa3e('0x56')]['id'];}_0x18e76b[_0xfa3e('0x56')]['UserId']=_0x18e76b[_0xfa3e('0x56')][_0xfa3e('0x5d')]||_0x18e76b[_0xfa3e('0x5e')]['id'];_0x4f7d81[_0xfa3e('0x6c')]['id']=_0x18e76b[_0xfa3e('0x56')][_0xfa3e('0x5d')];return db[_0xfa3e('0x38')][_0xfa3e('0x55')]({'where':{'id':_0x18e76b[_0xfa3e('0x53')]['id'],'UserId':null}})[_0xfa3e('0x1e')](handleEntityNotFound(_0x202d6a,null))[_0xfa3e('0x1e')](function(_0x3fb6ef){if(_0x3fb6ef){_0x4f7d81[_0xfa3e('0x25')]=_0x3fb6ef['get']({'plain':!![]});return db['FaxInteraction']['find']({'where':{'id':_0x3fb6ef[_0xfa3e('0x60')]}});}return null;})[_0xfa3e('0x1e')](handleEntityNotFound(_0x202d6a,null))[_0xfa3e('0x1e')](function(_0x18a17f){if(_0x18a17f){_0x4f7d81['interaction']=_0x18a17f[_0xfa3e('0x5f')]({'plain':!![]});interaction_log[_0xfa3e('0x1f')](_0xfa3e('0x77'),_0x18e76b['user']['id'],_0x18e76b[_0xfa3e('0x5e')]['name'],_0x18e76b[_0xfa3e('0x5e')][_0xfa3e('0x64')],_0x4f7d81['interaction']['id'],_0x18e76b[_0xfa3e('0x56')]?JSON[_0xfa3e('0x23')](_0x18e76b[_0xfa3e('0x56')]):'null');return respondWithRpcPromise(_0xfa3e('0x78'),_0xfa3e('0x79'),_0x4f7d81);}return null;})['then'](function(_0x36dce0){var _0x8b9c06=_0xfa3e('0x68')+_0x36dce0[_0xfa3e('0x25')][_0xfa3e('0x7a')];return db[_0xfa3e('0x69')]['query'](_0x8b9c06,{'type':db[_0xfa3e('0x6a')][_0xfa3e('0x6b')]['SELECT'],'raw':!![]})[_0xfa3e('0x1e')](function(_0x219771){return _0x219771;});})[_0xfa3e('0x1e')](function(_0xa45d5b){if(_0xa45d5b){_0x4f7d81['message'][_0xfa3e('0x7b')]=_0xa45d5b[0x0];if(!_0x18e76b[_0xfa3e('0x56')]['UserId'])return;return db[_0xfa3e('0x7c')][_0xfa3e('0x55')]({'where':{'id':_0x18e76b[_0xfa3e('0x56')]['UserId'],'role':_0xfa3e('0x6c')},'attributes':['id',_0xfa3e('0x34'),'fullname',_0xfa3e('0x6d'),_0xfa3e('0x7d')],'raw':!![]});}return null;})['then'](function(_0x5f059f){if(!_0x5f059f)return null;_0x4f7d81['message']['agent']=_0x5f059f;return _0x4f7d81;})['then'](function(_0x1ed274){if(_0x1ed274){_0x1ed274[_0xfa3e('0x25')][_0xfa3e('0x6f')]=util[_0xfa3e('0x5b')](_0xfa3e('0x70'),_0x18e76b[_0xfa3e('0x5e')][_0xfa3e('0x34')]);_0x1ed274['message'][_0xfa3e('0x72')]=_0x4f7d81[_0xfa3e('0x72')];_0x1ed274['message'][_0xfa3e('0x71')]=_0x4f7d81[_0xfa3e('0x72')];_0x1ed274['message'][_0xfa3e('0x73')]='reject';respondWithRpcPromise(_0xfa3e('0x7e'),'EventManager',{'event':'rejectmessage','message':_0x1ed274[_0xfa3e('0x25')]},client9002);return _0x4f7d81;}return null;})[_0xfa3e('0x1e')](respondWithResult(_0x202d6a,null))[_0xfa3e('0x51')](handleError(_0x202d6a,null));};exports[_0xfa3e('0x7f')]=function(_0x2b3f1d,_0x11252c){var _0x511991;return db['FaxMessage'][_0xfa3e('0x7f')](_0x2b3f1d['body'],{})[_0xfa3e('0x1e')](function(_0x4863c8){_0x511991=_0x4863c8;return db[_0xfa3e('0x80')]['findOne']({'where':{'id':_0x511991['ContactId']}});})[_0xfa3e('0x1e')](function(_0x45bc92){if(_[_0xfa3e('0x61')](_0x45bc92)){return;}else{_0x511991['fax']=_0x45bc92[_0xfa3e('0x76')];return db[_0xfa3e('0x81')]['findOne']({'where':{'id':_0x511991[_0xfa3e('0x82')]}});}})[_0xfa3e('0x1e')](function(_0x2b346f){return respondWithRpcPromise(_0xfa3e('0x83'),_0xfa3e('0x83'),{'FaxAccountId':_['isNil'](_0x2b3f1d[_0xfa3e('0x56')])?undefined:_0x2b3f1d['body'][_0xfa3e('0x84')],'path':_['isNil'](_0x2b346f)?undefined:util[_0xfa3e('0x5b')](_0xfa3e('0x85'),_0x2b346f[_0xfa3e('0x86')]),'fax':_[_0xfa3e('0x61')](_0x511991[_0xfa3e('0x76')])?undefined:_0x511991[_0xfa3e('0x76')],'AttachmentId':_0x511991[_0xfa3e('0x82')]},client9002);})[_0xfa3e('0x1e')](respondWithResult(_0x11252c,0xc9))[_0xfa3e('0x51')](handleError(_0x11252c,null));};exports[_0xfa3e('0x87')]=function(_0x28f0fb,_0x385418){var _0x32e4bd=path[_0xfa3e('0x88')](config[_0xfa3e('0x89')],_0xfa3e('0x8a'),'files',_0xfa3e('0x8b'));return db[_0xfa3e('0x38')]['find']({'where':{'id':_0x28f0fb[_0xfa3e('0x53')]['id']},'include':[{'model':db[_0xfa3e('0x81')],'as':_0xfa3e('0x81')}]})[_0xfa3e('0x1e')](handleEntityNotFound(_0x385418,null))['then'](function(_0x51fc92){if(_0x51fc92){return _0x385418[_0xfa3e('0x87')](path['join'](_0x32e4bd,_0x51fc92['Attachment'][_0xfa3e('0x86')]));}})[_0xfa3e('0x51')](handleError(_0x385418,null));}; \ No newline at end of file +var _0x83fc=['interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','[FAXMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','fullname','rejectmessage','create','findOne','isNil','Attachment','SendFax','FaxAccountId','/var/opt/motion2/server/files/attachments/%s','basename','AttachmentId','download','join','root','server','files','attachments','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','redis','defaults','./faxMessage.socket','register','jayson/promise','http','request','then','info','FaxMessage,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','sendStatus','status','end','offset','limit','count','set','Content-Range','apply','reject','update','destroy','stack','name','send','index','FaxMessage','fieldName','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','map','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','show','keys','find','body','params','describe','fax-interactions','accept','fax','read','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','FaxInteraction','FaxInteractionId','interaction','[FAXMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','internal'];(function(_0x34d915,_0x2fad06){var _0x3cde30=function(_0x1ff450){while(--_0x1ff450){_0x34d915['push'](_0x34d915['shift']());}};_0x3cde30(++_0x2fad06);}(_0x83fc,0x13a));var _0xc83f=function(_0x39e283,_0x247e6b){_0x39e283=_0x39e283-0x0;var _0x7de89f=_0x83fc[_0x39e283];return _0x7de89f;};'use strict';var emlformat=require(_0xc83f('0x0'));var rimraf=require(_0xc83f('0x1'));var zipdir=require(_0xc83f('0x2'));var jsonpatch=require(_0xc83f('0x3'));var rp=require(_0xc83f('0x4'));var moment=require(_0xc83f('0x5'));var BPromise=require(_0xc83f('0x6'));var Mustache=require('mustache');var util=require(_0xc83f('0x7'));var path=require(_0xc83f('0x8'));var sox=require('sox');var csv=require(_0xc83f('0x9'));var ejs=require(_0xc83f('0xa'));var fs=require('fs');var fs_extra=require(_0xc83f('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xc83f('0xc'));var deskjs=require(_0xc83f('0xd'));var toCsv=require(_0xc83f('0x9'));var querystring=require('querystring');var Papa=require(_0xc83f('0xe'));var Redis=require(_0xc83f('0xf'));var authService=require(_0xc83f('0x10'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xc83f('0x11'));var logger=require(_0xc83f('0x12'))(_0xc83f('0x13'));var utils=require(_0xc83f('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xc83f('0x15'))['db'];config[_0xc83f('0x16')]=_[_0xc83f('0x17')](config[_0xc83f('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xc83f('0x18'))[_0xc83f('0x19')](socket);var jayson=require(_0xc83f('0x1a'));var client=jayson['client'][_0xc83f('0x1b')]({'port':0x232c});var client9002=jayson['client'][_0xc83f('0x1b')]({'port':0x232a});function respondWithRpcPromise(_0x31feec,_0xd2a9d6,_0xf506cc,_0x4da418){return new BPromise(function(_0xa6c9e7,_0x22ce8f){var _0x244a4d=_0x4da418||client;return _0x244a4d[_0xc83f('0x1c')](_0x31feec,_0xf506cc)[_0xc83f('0x1d')](function(_0x4c5258){logger[_0xc83f('0x1e')](_0xc83f('0x1f'),_0xd2a9d6,_0xc83f('0x20'));logger['debug']('FaxMessage,\x20%s,\x20%s,\x20%s',_0xd2a9d6,_0xc83f('0x20'),JSON[_0xc83f('0x21')](_0x4c5258));if(_0x4c5258[_0xc83f('0x22')]){if(_0x4c5258[_0xc83f('0x22')][_0xc83f('0x23')]===0x1f4){logger['error'](_0xc83f('0x1f'),_0xd2a9d6,_0x4c5258[_0xc83f('0x22')][_0xc83f('0x24')]);return _0x22ce8f(_0x4c5258['error'][_0xc83f('0x24')]);}logger[_0xc83f('0x22')](_0xc83f('0x1f'),_0xd2a9d6,_0x4c5258['error'][_0xc83f('0x24')]);return _0xa6c9e7(_0x4c5258[_0xc83f('0x22')][_0xc83f('0x24')]);}else{logger[_0xc83f('0x1e')]('FaxMessage,\x20%s,\x20%s',_0xd2a9d6,'request\x20sent');_0xa6c9e7(_0x4c5258[_0xc83f('0x25')]['message']);}})[_0xc83f('0x26')](function(_0x390fa1){logger[_0xc83f('0x22')](_0xc83f('0x1f'),_0xd2a9d6,_0x390fa1);_0x22ce8f(_0x390fa1);});});}function respondWithStatusCode(_0x7da067,_0x1bb264){_0x1bb264=_0x1bb264||0xcc;return function(_0x3bd89a){if(_0x3bd89a){return _0x7da067[_0xc83f('0x27')](_0x1bb264);}return _0x7da067[_0xc83f('0x28')](_0x1bb264)[_0xc83f('0x29')]();};}function respondWithResult(_0x48853a,_0x54413e){_0x54413e=_0x54413e||0xc8;return function(_0x4a13d5){if(_0x4a13d5){return _0x48853a[_0xc83f('0x28')](_0x54413e)['json'](_0x4a13d5);}};}function respondWithFilteredResult(_0x8cfd96,_0xc6f106){return function(_0x17cb72){if(_0x17cb72){var _0x565a59=typeof _0xc6f106[_0xc83f('0x2a')]==='undefined'&&typeof _0xc6f106[_0xc83f('0x2b')]==='undefined';var _0x10e4c2=_0x17cb72['count'];var _0x4e0fb0=_0x565a59?0x0:_0xc6f106[_0xc83f('0x2a')];var _0x1547fd=_0x565a59?_0x17cb72[_0xc83f('0x2c')]:_0xc6f106[_0xc83f('0x2a')]+_0xc6f106[_0xc83f('0x2b')];var _0xc60aa7;if(_0x1547fd>=_0x10e4c2){_0x1547fd=_0x10e4c2;_0xc60aa7=0xc8;}else{_0xc60aa7=0xce;}_0x8cfd96[_0xc83f('0x28')](_0xc60aa7);return _0x8cfd96[_0xc83f('0x2d')](_0xc83f('0x2e'),_0x4e0fb0+'-'+_0x1547fd+'/'+_0x10e4c2)['json'](_0x17cb72);}return null;};}function patchUpdates(_0x2b64f4){return function(_0x3957ef){try{jsonpatch[_0xc83f('0x2f')](_0x3957ef,_0x2b64f4,!![]);}catch(_0x1e69e9){return BPromise[_0xc83f('0x30')](_0x1e69e9);}return _0x3957ef['save']();};}function saveUpdates(_0x53799d,_0x55a58f){return function(_0x355014){if(_0x355014){return _0x355014[_0xc83f('0x31')](_0x53799d)[_0xc83f('0x1d')](function(_0x946a43){return _0x946a43;});}return null;};}function removeEntity(_0x5a0f0a,_0x3d60c7){return function(_0x10e01e){if(_0x10e01e){return _0x10e01e[_0xc83f('0x32')]()[_0xc83f('0x1d')](function(){_0x5a0f0a[_0xc83f('0x28')](0xcc)['end']();});}};}function handleEntityNotFound(_0x578594,_0x271042){return function(_0x23d2c6){if(!_0x23d2c6){_0x578594[_0xc83f('0x27')](0x194);}return _0x23d2c6;};}function handleError(_0x58cb34,_0x263481){_0x263481=_0x263481||0x1f4;return function(_0x5ee868){logger['error'](_0x5ee868[_0xc83f('0x33')]);if(_0x5ee868[_0xc83f('0x34')]){delete _0x5ee868['name'];}_0x58cb34[_0xc83f('0x28')](_0x263481)[_0xc83f('0x35')](_0x5ee868);};}exports[_0xc83f('0x36')]=function(_0x21a81a,_0x3479a1){var _0x2aa0c0={},_0x3f6e37={},_0x34acc1={'count':0x0,'rows':[]};var _0x50a5d2=_['map'](db[_0xc83f('0x37')]['rawAttributes'],function(_0x12cc20){return{'name':_0x12cc20[_0xc83f('0x38')],'type':_0x12cc20['type'][_0xc83f('0x39')]};});_0x3f6e37[_0xc83f('0x3a')]=_['map'](_0x50a5d2,_0xc83f('0x34'));_0x3f6e37[_0xc83f('0x3b')]=_['keys'](_0x21a81a['query']);_0x3f6e37[_0xc83f('0x3c')]=_[_0xc83f('0x3d')](_0x3f6e37['model'],_0x3f6e37[_0xc83f('0x3b')]);_0x2aa0c0[_0xc83f('0x3e')]=_['intersection'](_0x3f6e37['model'],qs[_0xc83f('0x3f')](_0x21a81a[_0xc83f('0x3b')][_0xc83f('0x3f')]));_0x2aa0c0[_0xc83f('0x3e')]=_0x2aa0c0[_0xc83f('0x3e')][_0xc83f('0x40')]?_0x2aa0c0[_0xc83f('0x3e')]:_0x3f6e37[_0xc83f('0x3a')];if(!_0x21a81a['query'][_0xc83f('0x41')](_0xc83f('0x42'))){_0x2aa0c0[_0xc83f('0x2b')]=qs[_0xc83f('0x2b')](_0x21a81a[_0xc83f('0x3b')][_0xc83f('0x2b')]);_0x2aa0c0[_0xc83f('0x2a')]=qs['offset'](_0x21a81a['query'][_0xc83f('0x2a')]);}_0x2aa0c0[_0xc83f('0x43')]=qs[_0xc83f('0x44')](_0x21a81a['query'][_0xc83f('0x44')]);_0x2aa0c0[_0xc83f('0x45')]=qs['filters'](_[_0xc83f('0x46')](_0x21a81a[_0xc83f('0x3b')],_0x3f6e37['filters']),_0x50a5d2);if(_0x21a81a[_0xc83f('0x3b')]['filter']){_0x2aa0c0[_0xc83f('0x45')]=_[_0xc83f('0x47')](_0x2aa0c0[_0xc83f('0x45')],{'$or':_[_0xc83f('0x48')](_0x50a5d2,function(_0x5dbe36){if(_0x5dbe36[_0xc83f('0x49')]!==_0xc83f('0x4a')){var _0x5a5275={};_0x5a5275[_0x5dbe36[_0xc83f('0x34')]]={'$like':'%'+_0x21a81a['query'][_0xc83f('0x4b')]+'%'};return _0x5a5275;}})});}_0x2aa0c0=_[_0xc83f('0x47')]({},_0x2aa0c0,_0x21a81a[_0xc83f('0x4c')]);var _0xbf8b6d={'where':_0x2aa0c0[_0xc83f('0x45')]};return db[_0xc83f('0x37')][_0xc83f('0x2c')](_0xbf8b6d)[_0xc83f('0x1d')](function(_0x17feed){_0x34acc1[_0xc83f('0x2c')]=_0x17feed;if(_0x21a81a['query'][_0xc83f('0x4d')]){_0x2aa0c0[_0xc83f('0x4e')]=[{'all':!![]}];}return db[_0xc83f('0x37')][_0xc83f('0x4f')](_0x2aa0c0);})['then'](function(_0x14cd83){_0x34acc1[_0xc83f('0x50')]=_0x14cd83;return _0x34acc1;})[_0xc83f('0x1d')](respondWithFilteredResult(_0x3479a1,_0x2aa0c0))[_0xc83f('0x26')](handleError(_0x3479a1,null));};exports[_0xc83f('0x51')]=function(_0x535538,_0x343600){var _0x1a0612={'raw':!![],'where':{'id':_0x535538['params']['id']}},_0x1bb42f={};_0x1bb42f[_0xc83f('0x3a')]=_[_0xc83f('0x52')](db['FaxMessage']['rawAttributes']);_0x1bb42f['query']=_[_0xc83f('0x52')](_0x535538[_0xc83f('0x3b')]);_0x1bb42f[_0xc83f('0x3c')]=_['intersection'](_0x1bb42f[_0xc83f('0x3a')],_0x1bb42f['query']);_0x1a0612['attributes']=_[_0xc83f('0x3d')](_0x1bb42f[_0xc83f('0x3a')],qs[_0xc83f('0x3f')](_0x535538[_0xc83f('0x3b')][_0xc83f('0x3f')]));_0x1a0612['attributes']=_0x1a0612[_0xc83f('0x3e')][_0xc83f('0x40')]?_0x1a0612[_0xc83f('0x3e')]:_0x1bb42f['model'];if(_0x535538[_0xc83f('0x3b')][_0xc83f('0x4d')]){_0x1a0612['include']=[{'all':!![]}];}_0x1a0612=_[_0xc83f('0x47')]({},_0x1a0612,_0x535538[_0xc83f('0x4c')]);return db[_0xc83f('0x37')][_0xc83f('0x53')](_0x1a0612)[_0xc83f('0x1d')](handleEntityNotFound(_0x343600,null))[_0xc83f('0x1d')](respondWithResult(_0x343600,null))[_0xc83f('0x26')](handleError(_0x343600,null));};exports[_0xc83f('0x31')]=function(_0xc1a3be,_0x6c9186){if(_0xc1a3be['body']['id']){delete _0xc1a3be[_0xc83f('0x54')]['id'];}return db[_0xc83f('0x37')][_0xc83f('0x53')]({'where':{'id':_0xc1a3be[_0xc83f('0x55')]['id']}})['then'](handleEntityNotFound(_0x6c9186,null))[_0xc83f('0x1d')](saveUpdates(_0xc1a3be[_0xc83f('0x54')],null))['then'](respondWithResult(_0x6c9186,null))[_0xc83f('0x26')](handleError(_0x6c9186,null));};exports[_0xc83f('0x32')]=function(_0x2a0834,_0x2b121d){return db['FaxMessage'][_0xc83f('0x53')]({'where':{'id':_0x2a0834[_0xc83f('0x55')]['id']}})[_0xc83f('0x1d')](handleEntityNotFound(_0x2b121d,null))[_0xc83f('0x1d')](removeEntity(_0x2b121d,null))[_0xc83f('0x26')](handleError(_0x2b121d,null));};exports[_0xc83f('0x56')]=function(_0x19fba4,_0x3b67c7){return db[_0xc83f('0x37')][_0xc83f('0x56')]()[_0xc83f('0x1d')](respondWithResult(_0x3b67c7,null))[_0xc83f('0x26')](handleError(_0x3b67c7,null));};var interaction_log=require(_0xc83f('0x12'))(_0xc83f('0x57'));exports[_0xc83f('0x58')]=function(_0x2cd570,_0x3208e3,_0x1e79db){var _0x59f24c={'agent':{},'channel':_0xc83f('0x59')};if(_0x2cd570[_0xc83f('0x54')]['id']){delete _0x2cd570[_0xc83f('0x54')]['id'];}_0x2cd570[_0xc83f('0x54')][_0xc83f('0x5a')]=!![];_0x2cd570[_0xc83f('0x54')][_0xc83f('0x5b')]=moment()[_0xc83f('0x5c')](_0xc83f('0x5d'));_0x2cd570['body']['UserId']=_0x2cd570[_0xc83f('0x54')][_0xc83f('0x5e')]||_0x2cd570[_0xc83f('0x5f')]['id'];_0x59f24c[_0xc83f('0x60')]['id']=_0x2cd570[_0xc83f('0x54')][_0xc83f('0x5e')];return db[_0xc83f('0x37')][_0xc83f('0x53')]({'where':{'id':_0x2cd570[_0xc83f('0x55')]['id'],'UserId':null}})[_0xc83f('0x1d')](handleEntityNotFound(_0x3208e3,null))['then'](saveUpdates(_0x2cd570['body'],null))[_0xc83f('0x1d')](function(_0xcf184f){if(_0xcf184f){_0x59f24c[_0xc83f('0x24')]=_0xcf184f[_0xc83f('0x61')]({'plain':!![]});return db[_0xc83f('0x62')]['find']({'where':{'id':_0xcf184f[_0xc83f('0x63')]}});}return null;})[_0xc83f('0x1d')](handleEntityNotFound(_0x3208e3,null))[_0xc83f('0x1d')](function(_0x5875e9){if(_0x5875e9){return _0x5875e9[_0xc83f('0x31')]({'UserId':_0x2cd570['body']['UserId'],'read1stAt':_['isNil'](_0x5875e9['read1stAt'])?moment()['format'](_0xc83f('0x5d')):undefined});}return null;})[_0xc83f('0x1d')](function(_0x1ea956){if(_0x1ea956){_0x59f24c[_0xc83f('0x64')]=_0x1ea956[_0xc83f('0x61')]({'plain':!![]});interaction_log[_0xc83f('0x1e')](_0xc83f('0x65'),_0x2cd570[_0xc83f('0x5f')]['id'],_0x2cd570[_0xc83f('0x5f')]['name'],_0x2cd570[_0xc83f('0x5f')]['role'],_0x59f24c['interaction']['id'],_0x2cd570[_0xc83f('0x54')]?JSON[_0xc83f('0x21')](_0x2cd570[_0xc83f('0x54')]):_0xc83f('0x66'));return respondWithRpcPromise(_0xc83f('0x67'),_0xc83f('0x68'),_0x59f24c);}return null;})[_0xc83f('0x1d')](function(_0x5223a7){var _0x46f29b='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5223a7[_0xc83f('0x24')][_0xc83f('0x69')];return db[_0xc83f('0x6a')][_0xc83f('0x3b')](_0x46f29b,{'type':db['Sequelize'][_0xc83f('0x6b')][_0xc83f('0x6c')],'raw':!![]})[_0xc83f('0x1d')](function(_0x546a9d){return _0x546a9d;});})['then'](function(_0x4cd265){if(_0x4cd265){_0x59f24c[_0xc83f('0x24')][_0xc83f('0x6d')]=_0x4cd265[0x0];if(!_0x2cd570['body'][_0xc83f('0x5e')])return;return db[_0xc83f('0x6e')][_0xc83f('0x53')]({'where':{'id':_0x2cd570[_0xc83f('0x54')][_0xc83f('0x5e')],'role':_0xc83f('0x60')},'attributes':['id',_0xc83f('0x34'),'fullname','email',_0xc83f('0x6f')],'raw':!![]});}return null;})[_0xc83f('0x1d')](function(_0x9be2fc){if(!_0x9be2fc)return null;_0x59f24c['message'][_0xc83f('0x60')]=_0x9be2fc;return _0x59f24c;})[_0xc83f('0x1d')](function(_0x172cdc){if(_0x172cdc){if(_0x2cd570['body']['manual']){_0x59f24c[_0xc83f('0x24')][_0xc83f('0x70')]=util[_0xc83f('0x5c')](_0xc83f('0x71'),_0x2cd570['user'][_0xc83f('0x34')]);_0x59f24c[_0xc83f('0x24')]['channel']=_0x59f24c[_0xc83f('0x72')];_0x59f24c[_0xc83f('0x24')][_0xc83f('0x73')]=_0x59f24c[_0xc83f('0x72')];_0x59f24c['message'][_0xc83f('0x74')]=_0xc83f('0x58');return respondWithRpcPromise(_0xc83f('0x75'),'EventManager',{'event':_0xc83f('0x76'),'message':_0x59f24c[_0xc83f('0x24')]},client9002)[_0xc83f('0x1d')](function(){return _0x59f24c;});}return _0x59f24c;}return null;})[_0xc83f('0x1d')](respondWithResult(_0x3208e3,null))[_0xc83f('0x26')](handleError(_0x3208e3,null));};var interaction_log=require(_0xc83f('0x12'))(_0xc83f('0x57'));exports[_0xc83f('0x30')]=function(_0x2699c3,_0x4170b9,_0x2e03b5){var _0x1d5246={'agent':{},'channel':_0xc83f('0x59')};if(_0x2699c3['body']['id']){delete _0x2699c3[_0xc83f('0x54')]['id'];}_0x2699c3[_0xc83f('0x54')][_0xc83f('0x5e')]=_0x2699c3[_0xc83f('0x54')][_0xc83f('0x5e')]||_0x2699c3[_0xc83f('0x5f')]['id'];_0x1d5246['agent']['id']=_0x2699c3[_0xc83f('0x54')]['UserId'];return db[_0xc83f('0x37')]['find']({'where':{'id':_0x2699c3[_0xc83f('0x55')]['id'],'UserId':null}})[_0xc83f('0x1d')](handleEntityNotFound(_0x4170b9,null))[_0xc83f('0x1d')](function(_0x2aa5d9){if(_0x2aa5d9){_0x1d5246[_0xc83f('0x24')]=_0x2aa5d9[_0xc83f('0x61')]({'plain':!![]});return db['FaxInteraction'][_0xc83f('0x53')]({'where':{'id':_0x2aa5d9['FaxInteractionId']}});}return null;})[_0xc83f('0x1d')](handleEntityNotFound(_0x4170b9,null))[_0xc83f('0x1d')](function(_0x2e7a41){if(_0x2e7a41){_0x1d5246[_0xc83f('0x64')]=_0x2e7a41[_0xc83f('0x61')]({'plain':!![]});interaction_log['info'](_0xc83f('0x77'),_0x2699c3[_0xc83f('0x5f')]['id'],_0x2699c3[_0xc83f('0x5f')][_0xc83f('0x34')],_0x2699c3['user'][_0xc83f('0x78')],_0x1d5246['interaction']['id'],_0x2699c3[_0xc83f('0x54')]?JSON['stringify'](_0x2699c3[_0xc83f('0x54')]):_0xc83f('0x66'));return respondWithRpcPromise(_0xc83f('0x79'),_0xc83f('0x7a'),_0x1d5246);}return null;})['then'](function(_0x260e72){var _0x31ada8=_0xc83f('0x7b')+_0x260e72[_0xc83f('0x24')]['ContactId'];return db[_0xc83f('0x6a')]['query'](_0x31ada8,{'type':db[_0xc83f('0x7c')][_0xc83f('0x6b')][_0xc83f('0x6c')],'raw':!![]})[_0xc83f('0x1d')](function(_0x2327e2){return _0x2327e2;});})[_0xc83f('0x1d')](function(_0x1b28a1){if(_0x1b28a1){_0x1d5246['message'][_0xc83f('0x6d')]=_0x1b28a1[0x0];if(!_0x2699c3['body'][_0xc83f('0x5e')])return;return db[_0xc83f('0x6e')][_0xc83f('0x53')]({'where':{'id':_0x2699c3[_0xc83f('0x54')][_0xc83f('0x5e')],'role':_0xc83f('0x60')},'attributes':['id',_0xc83f('0x34'),_0xc83f('0x7d'),'email','internal'],'raw':!![]});}return null;})[_0xc83f('0x1d')](function(_0x176669){if(!_0x176669)return null;_0x1d5246[_0xc83f('0x24')][_0xc83f('0x60')]=_0x176669;return _0x1d5246;})['then'](function(_0x28fb26){if(_0x28fb26){_0x28fb26[_0xc83f('0x24')][_0xc83f('0x70')]=util['format'](_0xc83f('0x71'),_0x2699c3[_0xc83f('0x5f')]['name']);_0x28fb26[_0xc83f('0x24')][_0xc83f('0x72')]=_0x1d5246[_0xc83f('0x72')];_0x28fb26[_0xc83f('0x24')]['motionChannel']=_0x1d5246[_0xc83f('0x72')];_0x28fb26['message'][_0xc83f('0x74')]=_0xc83f('0x30');respondWithRpcPromise(_0xc83f('0x75'),_0xc83f('0x75'),{'event':_0xc83f('0x7e'),'message':_0x28fb26[_0xc83f('0x24')]},client9002);return _0x1d5246;}return null;})[_0xc83f('0x1d')](respondWithResult(_0x4170b9,null))['catch'](handleError(_0x4170b9,null));};exports[_0xc83f('0x7f')]=function(_0x495081,_0xe56f18){var _0x3432d2;return db[_0xc83f('0x37')][_0xc83f('0x7f')](_0x495081[_0xc83f('0x54')],{})['then'](function(_0xf332b1){_0x3432d2=_0xf332b1;return db['CmContact'][_0xc83f('0x80')]({'where':{'id':_0x3432d2['ContactId']}});})[_0xc83f('0x1d')](function(_0x1d306b){if(_[_0xc83f('0x81')](_0x1d306b)){return;}else{_0x3432d2['fax']=_0x1d306b[_0xc83f('0x59')];return db[_0xc83f('0x82')][_0xc83f('0x80')]({'where':{'id':_0x3432d2['AttachmentId']}});}})[_0xc83f('0x1d')](function(_0x25d610){return respondWithRpcPromise('SendFax',_0xc83f('0x83'),{'FaxAccountId':_[_0xc83f('0x81')](_0x495081[_0xc83f('0x54')])?undefined:_0x495081[_0xc83f('0x54')][_0xc83f('0x84')],'path':_['isNil'](_0x25d610)?undefined:util[_0xc83f('0x5c')](_0xc83f('0x85'),_0x25d610[_0xc83f('0x86')]),'fax':_[_0xc83f('0x81')](_0x3432d2[_0xc83f('0x59')])?undefined:_0x3432d2['fax'],'AttachmentId':_0x3432d2[_0xc83f('0x87')]},client9002);})['then'](respondWithResult(_0xe56f18,0xc9))[_0xc83f('0x26')](handleError(_0xe56f18,null));};exports[_0xc83f('0x88')]=function(_0x305304,_0x390b47){var _0x260577=path[_0xc83f('0x89')](config[_0xc83f('0x8a')],_0xc83f('0x8b'),_0xc83f('0x8c'),_0xc83f('0x8d'));return db['FaxMessage'][_0xc83f('0x53')]({'where':{'id':_0x305304[_0xc83f('0x55')]['id']},'include':[{'model':db[_0xc83f('0x82')],'as':'Attachment'}]})[_0xc83f('0x1d')](handleEntityNotFound(_0x390b47,null))[_0xc83f('0x1d')](function(_0x2567cc){if(_0x2567cc){return _0x390b47['download'](path['join'](_0x260577,_0x2567cc[_0xc83f('0x82')][_0xc83f('0x86')]));}})[_0xc83f('0x26')](handleError(_0x390b47,null));}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.events.js b/server/api/faxMessage/faxMessage.events.js index 3f651b0..cf792af 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 _0x6a0b=['save','remove','emit','hasOwnProperty','hook','exports','events','setMaxListeners'];(function(_0x4a5bb1,_0x46625f){var _0x505d38=function(_0x41deb8){while(--_0x41deb8){_0x4a5bb1['push'](_0x4a5bb1['shift']());}};_0x505d38(++_0x46625f);}(_0x6a0b,0xf6));var _0xb6a0=function(_0x4bfd39,_0x464fe2){_0x4bfd39=_0x4bfd39-0x0;var _0x16f633=_0x6a0b[_0x4bfd39];return _0x16f633;};'use strict';var EventEmitter=require(_0xb6a0('0x0'));var FaxMessage=require('../../mysqldb')['db']['FaxMessage'];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0xb6a0('0x1')](0x0);var events={'afterCreate':_0xb6a0('0x2'),'afterUpdate':'update','afterDestroy':_0xb6a0('0x3')};function emitEvent(_0x3e5b73){return function(_0x1505b1,_0x557a99,_0x4652da){FaxMessageEvents['emit'](_0x3e5b73+':'+_0x1505b1['id'],_0x1505b1);FaxMessageEvents[_0xb6a0('0x4')](_0x3e5b73,_0x1505b1);_0x4652da(null);};}for(var e in events){if(events[_0xb6a0('0x5')](e)){var event=events[e];FaxMessage[_0xb6a0('0x6')](e,emitEvent(event));}}module[_0xb6a0('0x7')]=FaxMessageEvents; \ No newline at end of file +var _0x8921=['exports','events','FaxMessage','setMaxListeners','save','update','remove','emit','hasOwnProperty'];(function(_0x4b6b90,_0x302518){var _0x43eb80=function(_0x57528e){while(--_0x57528e){_0x4b6b90['push'](_0x4b6b90['shift']());}};_0x43eb80(++_0x302518);}(_0x8921,0x9a));var _0x1892=function(_0x20a33c,_0x472737){_0x20a33c=_0x20a33c-0x0;var _0x4323b4=_0x8921[_0x20a33c];return _0x4323b4;};'use strict';var EventEmitter=require(_0x1892('0x0'));var FaxMessage=require('../../mysqldb')['db'][_0x1892('0x1')];var FaxMessageEvents=new EventEmitter();FaxMessageEvents[_0x1892('0x2')](0x0);var events={'afterCreate':_0x1892('0x3'),'afterUpdate':_0x1892('0x4'),'afterDestroy':_0x1892('0x5')};function emitEvent(_0x110b75){return function(_0x28a89b,_0x15aa1b,_0x2790a1){FaxMessageEvents[_0x1892('0x6')](_0x110b75+':'+_0x28a89b['id'],_0x28a89b);FaxMessageEvents[_0x1892('0x6')](_0x110b75,_0x28a89b);_0x2790a1(null);};}for(var e in events){if(events[_0x1892('0x7')](e)){var event=events[e];FaxMessage['hook'](e,emitEvent(event));}}module[_0x1892('0x8')]=FaxMessageEvents; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.model.js b/server/api/faxMessage/faxMessage.model.js index 9166c90..fc30c88 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 _0x4d83=['rimraf','../../config/environment','./faxMessage.attributes','exports','FaxMessage','fax_messages','fti_fax_messages','body','FULLTEXT','models','get','direction','toLowerCase','secret','isNil','UserId','findOne','FaxInteractionId','then','update','createdAt','error','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise','path'];(function(_0xdf6d05,_0x3a02e3){var _0x20cf48=function(_0x33152){while(--_0x33152){_0xdf6d05['push'](_0xdf6d05['shift']());}};_0x20cf48(++_0x3a02e3);}(_0x4d83,0x107));var _0x34d8=function(_0x4ba94c,_0x4b7e77){_0x4ba94c=_0x4ba94c-0x0;var _0x205a9d=_0x4d83[_0x4ba94c];return _0x205a9d;};'use strict';var _=require(_0x34d8('0x0'));var util=require(_0x34d8('0x1'));var logger=require(_0x34d8('0x2'))('api');var moment=require(_0x34d8('0x3'));var BPromise=require(_0x34d8('0x4'));var rp=require(_0x34d8('0x5'));var fs=require('fs');var path=require(_0x34d8('0x6'));var rimraf=require(_0x34d8('0x7'));var config=require(_0x34d8('0x8'));var attributes=require(_0x34d8('0x9'));module[_0x34d8('0xa')]=function(_0x38fa3a,_0x276f5e){return _0x38fa3a['define'](_0x34d8('0xb'),attributes,{'tableName':_0x34d8('0xc'),'paranoid':![],'indexes':[{'name':_0x34d8('0xd'),'fields':[_0x34d8('0xe')],'type':_0x34d8('0xf')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x53b7a7,_0x3283a9,_0x4a206f){var _0x3ec0db=_0x38fa3a[_0x34d8('0x10')];var _0x5d9819=_0x53b7a7[_0x34d8('0x11')]({'plain':!![]});if(_0x5d9819[_0x34d8('0x12')][_0x34d8('0x13')]()==='in'||_0x5d9819[_0x34d8('0x12')]['toLowerCase']()==='out'&&!_0x5d9819[_0x34d8('0x14')]&&!_[_0x34d8('0x15')](_0x5d9819[_0x34d8('0x16')])){_0x3ec0db['FaxInteraction'][_0x34d8('0x17')]({'where':{'id':_0x5d9819[_0x34d8('0x18')]}})[_0x34d8('0x19')](function(_0x4020f9){if(_0x4020f9){_0x4020f9[_0x34d8('0x1a')]({'lastMsgAt':_0x5d9819[_0x34d8('0x1b')],'lastMsgDirection':_0x5d9819[_0x34d8('0x12')][_0x34d8('0x13')]()});}})['catch'](function(_0x22cd17){console[_0x34d8('0x1c')](_0x22cd17);});}_0x4a206f();}},'charset':'utf8mb4','collate':_0x34d8('0x1d')});}; \ No newline at end of file +var _0x3829=['path','rimraf','../../config/environment','exports','define','fax_messages','FULLTEXT','get','direction','toLowerCase','out','secret','isNil','UserId','FaxInteraction','findOne','FaxInteractionId','then','update','catch','utf8mb4','lodash','util','api','bluebird','request-promise'];(function(_0x4bd672,_0x47d278){var _0x4a3c01=function(_0x2c509b){while(--_0x2c509b){_0x4bd672['push'](_0x4bd672['shift']());}};_0x4a3c01(++_0x47d278);}(_0x3829,0x133));var _0x9382=function(_0x1a1d1d,_0x47a254){_0x1a1d1d=_0x1a1d1d-0x0;var _0x49a802=_0x3829[_0x1a1d1d];return _0x49a802;};'use strict';var _=require(_0x9382('0x0'));var util=require(_0x9382('0x1'));var logger=require('../../config/logger')(_0x9382('0x2'));var moment=require('moment');var BPromise=require(_0x9382('0x3'));var rp=require(_0x9382('0x4'));var fs=require('fs');var path=require(_0x9382('0x5'));var rimraf=require(_0x9382('0x6'));var config=require(_0x9382('0x7'));var attributes=require('./faxMessage.attributes');module[_0x9382('0x8')]=function(_0x2c96cc,_0x234e79){return _0x2c96cc[_0x9382('0x9')]('FaxMessage',attributes,{'tableName':_0x9382('0xa'),'paranoid':![],'indexes':[{'name':'fti_fax_messages','fields':['body'],'type':_0x9382('0xb')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a8342,_0x4f4b2e,_0x2d9ad2){var _0x404f2c=_0x2c96cc['models'];var _0x3cdc22=_0x4a8342[_0x9382('0xc')]({'plain':!![]});if(_0x3cdc22[_0x9382('0xd')][_0x9382('0xe')]()==='in'||_0x3cdc22[_0x9382('0xd')][_0x9382('0xe')]()===_0x9382('0xf')&&!_0x3cdc22[_0x9382('0x10')]&&!_[_0x9382('0x11')](_0x3cdc22[_0x9382('0x12')])){_0x404f2c[_0x9382('0x13')][_0x9382('0x14')]({'where':{'id':_0x3cdc22[_0x9382('0x15')]}})[_0x9382('0x16')](function(_0x1b9328){if(_0x1b9328){_0x1b9328[_0x9382('0x17')]({'lastMsgAt':_0x3cdc22['createdAt'],'lastMsgDirection':_0x3cdc22[_0x9382('0xd')][_0x9382('0xe')]()});}})[_0x9382('0x18')](function(_0xcc23bf){console['error'](_0xcc23bf);});}_0x2d9ad2();}},'charset':_0x9382('0x19'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.rpc.js b/server/api/faxMessage/faxMessage.rpc.js index 6e3b38c..168f307 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 _0xbd50=['request','info','FaxMessage,\x20%s,\x20%s','debug','FaxMessage,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateFaxMessage','options','raw','then','UpdateFaxMessage','FaxMessage','update','body','where','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','redis','defaults','./faxMessage.socket','register'];(function(_0x307d86,_0x9264f2){var _0x361745=function(_0x1b64e1){while(--_0x1b64e1){_0x307d86['push'](_0x307d86['shift']());}};_0x361745(++_0x9264f2);}(_0xbd50,0x196));var _0x0bd5=function(_0x394de2,_0x42e580){_0x394de2=_0x394de2-0x0;var _0x38f3b7=_0xbd50[_0x394de2];return _0x38f3b7;};'use strict';var _=require(_0x0bd5('0x0'));var util=require(_0x0bd5('0x1'));var moment=require(_0x0bd5('0x2'));var BPromise=require('bluebird');var rs=require(_0x0bd5('0x3'));var fs=require('fs');var Redis=require(_0x0bd5('0x4'));var db=require(_0x0bd5('0x5'))['db'];var utils=require(_0x0bd5('0x6'));var logger=require(_0x0bd5('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x0bd5('0x8')][_0x0bd5('0x9')]({'port':0x232a});config[_0x0bd5('0xa')]=_[_0x0bd5('0xb')](config[_0x0bd5('0xa')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x0bd5('0xa')]));require(_0x0bd5('0xc'))[_0x0bd5('0xd')](socket);function respondWithRpcPromise(_0x5f5a0c,_0xa98f54,_0x2fa7d1){return new BPromise(function(_0x519bc6,_0x210f45){return client[_0x0bd5('0xe')](_0x5f5a0c,_0x2fa7d1)['then'](function(_0x1ce7dd){logger[_0x0bd5('0xf')](_0x0bd5('0x10'),_0xa98f54,'request\x20sent');logger[_0x0bd5('0x11')](_0x0bd5('0x12'),_0xa98f54,_0x0bd5('0x13'),JSON[_0x0bd5('0x14')](_0x1ce7dd));if(_0x1ce7dd[_0x0bd5('0x15')]){if(_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x16')]===0x1f4){logger[_0x0bd5('0x15')]('FaxMessage,\x20%s,\x20%s',_0xa98f54,_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x17')]);return _0x210f45(_0x1ce7dd['error'][_0x0bd5('0x17')]);}logger[_0x0bd5('0x15')](_0x0bd5('0x10'),_0xa98f54,_0x1ce7dd[_0x0bd5('0x15')]['message']);return _0x519bc6(_0x1ce7dd[_0x0bd5('0x15')][_0x0bd5('0x17')]);}else{logger[_0x0bd5('0xf')](_0x0bd5('0x10'),_0xa98f54,_0x0bd5('0x13'));_0x519bc6(_0x1ce7dd[_0x0bd5('0x18')][_0x0bd5('0x17')]);}})[_0x0bd5('0x19')](function(_0x29fa4c){logger[_0x0bd5('0x15')](_0x0bd5('0x10'),_0xa98f54,_0x29fa4c);_0x210f45(_0x29fa4c);});});}exports[_0x0bd5('0x1a')]=function(_0x4008bd){var _0x2dc1e5=this;return new Promise(function(_0x527c37,_0x5ba943){return db['FaxMessage']['create'](_0x4008bd['body'],{'raw':_0x4008bd[_0x0bd5('0x1b')]?_0x4008bd[_0x0bd5('0x1b')][_0x0bd5('0x1c')]===undefined?!![]:![]:!![]})[_0x0bd5('0x1d')](function(_0x6ee1a8){logger['info'](_0x0bd5('0x1a'),_0x4008bd);logger[_0x0bd5('0x11')](_0x0bd5('0x1a'),_0x4008bd,JSON['stringify'](_0x6ee1a8));_0x527c37(_0x6ee1a8);})[_0x0bd5('0x19')](function(_0x4a8787){logger['error'](_0x0bd5('0x1a'),_0x4a8787[_0x0bd5('0x17')],_0x4008bd);_0x5ba943(_0x2dc1e5[_0x0bd5('0x15')](0x1f4,_0x4a8787['message']));});});};exports[_0x0bd5('0x1e')]=function(_0x5eab3e){var _0x456e87=this;return new Promise(function(_0x3ffb08,_0x18cec3){return db[_0x0bd5('0x1f')][_0x0bd5('0x20')](_0x5eab3e[_0x0bd5('0x21')],{'raw':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')][_0x0bd5('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')][_0x0bd5('0x22')]||null:null,'attributes':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')]['attributes']||null:null,'limit':_0x5eab3e[_0x0bd5('0x1b')]?_0x5eab3e[_0x0bd5('0x1b')]['limit']||null:null})[_0x0bd5('0x1d')](function(_0x8eccc9){logger['info'](_0x0bd5('0x1e'),_0x5eab3e);logger[_0x0bd5('0x11')](_0x0bd5('0x1e'),_0x5eab3e,JSON[_0x0bd5('0x14')](_0x8eccc9));_0x3ffb08(_0x8eccc9);})['catch'](function(_0x440e69){logger[_0x0bd5('0x15')](_0x0bd5('0x1e'),_0x440e69[_0x0bd5('0x17')],_0x5eab3e);_0x18cec3(_0x456e87[_0x0bd5('0x15')](0x1f4,_0x440e69[_0x0bd5('0x17')]));});});}; \ No newline at end of file +var _0x4bc3=['CreateFaxMessage','FaxMessage','create','body','options','raw','then','stringify','catch','UpdateFaxMessage','update','where','attributes','limit','info','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','localhost','socket.io-emitter','./faxMessage.socket','register','request','FaxMessage,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x4bc3,0x16e));var _0x34bc=function(_0xd0b415,_0x149675){_0xd0b415=_0xd0b415-0x0;var _0x2bdf2c=_0x4bc3[_0xd0b415];return _0x2bdf2c;};'use strict';var _=require(_0x34bc('0x0'));var util=require(_0x34bc('0x1'));var moment=require('moment');var BPromise=require(_0x34bc('0x2'));var rs=require(_0x34bc('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x34bc('0x4'))['db'];var utils=require(_0x34bc('0x5'));var logger=require(_0x34bc('0x6'))(_0x34bc('0x7'));var config=require(_0x34bc('0x8'));var jayson=require(_0x34bc('0x9'));var client=jayson[_0x34bc('0xa')]['http']({'port':0x232a});config[_0x34bc('0xb')]=_['defaults'](config['redis'],{'host':_0x34bc('0xc'),'port':0x18eb});var socket=require(_0x34bc('0xd'))(new Redis(config[_0x34bc('0xb')]));require(_0x34bc('0xe'))[_0x34bc('0xf')](socket);function respondWithRpcPromise(_0x41b2ff,_0x5de8b5,_0x5a478d){return new BPromise(function(_0x2b8112,_0x33025c){return client[_0x34bc('0x10')](_0x41b2ff,_0x5a478d)['then'](function(_0x41960e){logger['info'](_0x34bc('0x11'),_0x5de8b5,_0x34bc('0x12'));logger[_0x34bc('0x13')]('FaxMessage,\x20%s,\x20%s,\x20%s',_0x5de8b5,_0x34bc('0x12'),JSON['stringify'](_0x41960e));if(_0x41960e[_0x34bc('0x14')]){if(_0x41960e[_0x34bc('0x14')][_0x34bc('0x15')]===0x1f4){logger['error']('FaxMessage,\x20%s,\x20%s',_0x5de8b5,_0x41960e[_0x34bc('0x14')]['message']);return _0x33025c(_0x41960e[_0x34bc('0x14')][_0x34bc('0x16')]);}logger[_0x34bc('0x14')](_0x34bc('0x11'),_0x5de8b5,_0x41960e[_0x34bc('0x14')][_0x34bc('0x16')]);return _0x2b8112(_0x41960e['error']['message']);}else{logger['info'](_0x34bc('0x11'),_0x5de8b5,_0x34bc('0x12'));_0x2b8112(_0x41960e[_0x34bc('0x17')][_0x34bc('0x16')]);}})['catch'](function(_0x46aa24){logger[_0x34bc('0x14')]('FaxMessage,\x20%s,\x20%s',_0x5de8b5,_0x46aa24);_0x33025c(_0x46aa24);});});}exports[_0x34bc('0x18')]=function(_0x9e9f14){var _0x4d2d5e=this;return new Promise(function(_0x14cec8,_0x26cdec){return db[_0x34bc('0x19')][_0x34bc('0x1a')](_0x9e9f14[_0x34bc('0x1b')],{'raw':_0x9e9f14[_0x34bc('0x1c')]?_0x9e9f14['options'][_0x34bc('0x1d')]===undefined?!![]:![]:!![]})[_0x34bc('0x1e')](function(_0x38882c){logger['info']('CreateFaxMessage',_0x9e9f14);logger[_0x34bc('0x13')](_0x34bc('0x18'),_0x9e9f14,JSON[_0x34bc('0x1f')](_0x38882c));_0x14cec8(_0x38882c);})[_0x34bc('0x20')](function(_0x13094a){logger[_0x34bc('0x14')](_0x34bc('0x18'),_0x13094a[_0x34bc('0x16')],_0x9e9f14);_0x26cdec(_0x4d2d5e[_0x34bc('0x14')](0x1f4,_0x13094a[_0x34bc('0x16')]));});});};exports[_0x34bc('0x21')]=function(_0x1edcb0){var _0x4fd589=this;return new Promise(function(_0x43e527,_0x48ec13){return db['FaxMessage'][_0x34bc('0x22')](_0x1edcb0['body'],{'raw':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1edcb0['options']?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x23')]||null:null,'attributes':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0[_0x34bc('0x1c')][_0x34bc('0x24')]||null:null,'limit':_0x1edcb0[_0x34bc('0x1c')]?_0x1edcb0['options'][_0x34bc('0x25')]||null:null})[_0x34bc('0x1e')](function(_0x22aacc){logger[_0x34bc('0x26')](_0x34bc('0x21'),_0x1edcb0);logger[_0x34bc('0x13')]('UpdateFaxMessage',_0x1edcb0,JSON[_0x34bc('0x1f')](_0x22aacc));_0x43e527(_0x22aacc);})['catch'](function(_0x530748){logger[_0x34bc('0x14')]('UpdateFaxMessage',_0x530748[_0x34bc('0x16')],_0x1edcb0);_0x48ec13(_0x4fd589[_0x34bc('0x14')](0x1f4,_0x530748[_0x34bc('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxMessage/faxMessage.socket.js b/server/api/faxMessage/faxMessage.socket.js index 58f731c..bb13312 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 _0x2244=['register','length','faxMessage:','./faxMessage.events','update','emit'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x2244,0x9f));var _0x4224=function(_0xb9eaf8,_0x351196){_0xb9eaf8=_0xb9eaf8-0x0;var _0x12e0ce=_0x2244[_0xb9eaf8];return _0x12e0ce;};'use strict';var FaxMessageEvents=require(_0x4224('0x0'));var events=['save','remove',_0x4224('0x1')];function createListener(_0x104f34,_0x43899d){return function(_0x239615){_0x43899d[_0x4224('0x2')](_0x104f34,_0x239615);};}function removeListener(_0x36e101,_0x658c40){return function(){FaxMessageEvents['removeListener'](_0x36e101,_0x658c40);};}exports[_0x4224('0x3')]=function(_0x3166fb){for(var _0x19bcc8=0x0,_0x5b6872=events[_0x4224('0x4')];_0x19bcc8<_0x5b6872;_0x19bcc8++){var _0xa9c368=events[_0x19bcc8];var _0x4b17bd=createListener(_0x4224('0x5')+_0xa9c368,_0x3166fb);FaxMessageEvents['on'](_0xa9c368,_0x4b17bd);}}; \ No newline at end of file +var _0x90bd=['save','remove','update','emit','removeListener','register','faxMessage:','./faxMessage.events'];(function(_0x5db285,_0x5ea05e){var _0x3472b7=function(_0x812df7){while(--_0x812df7){_0x5db285['push'](_0x5db285['shift']());}};_0x3472b7(++_0x5ea05e);}(_0x90bd,0x6f));var _0xd90b=function(_0xe2c95e,_0x3e6545){_0xe2c95e=_0xe2c95e-0x0;var _0x42ce6f=_0x90bd[_0xe2c95e];return _0x42ce6f;};'use strict';var FaxMessageEvents=require(_0xd90b('0x0'));var events=[_0xd90b('0x1'),_0xd90b('0x2'),_0xd90b('0x3')];function createListener(_0x30946b,_0x34ef82){return function(_0x5c1746){_0x34ef82[_0xd90b('0x4')](_0x30946b,_0x5c1746);};}function removeListener(_0x18a129,_0x32186d){return function(){FaxMessageEvents[_0xd90b('0x5')](_0x18a129,_0x32186d);};}exports[_0xd90b('0x6')]=function(_0x20ba16){for(var _0x35a552=0x0,_0x4c9e98=events['length'];_0x35a552<_0x4c9e98;_0x35a552++){var _0x31ff26=events[_0x35a552];var _0x45ea8f=createListener(_0xd90b('0x7')+_0x31ff26,_0x20ba16);FaxMessageEvents['on'](_0x31ff26,_0x45ea8f);}}; \ No newline at end of file diff --git a/server/api/faxMessage/index.js b/server/api/faxMessage/index.js index d1688ce..5695252 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 _0x3c81=['show','/:id/download','download','post','tracked','fax','faxmessage:create','create','put','update','/:id/accept','accept','reject','destroy','exports','multer','util','connect-timeout','express','../../config/environment','./faxMessage.controller','get','isAuthenticated','index','/describe','describe','/:id'];(function(_0x2f24e9,_0x3865bf){var _0x4330bf=function(_0x558955){while(--_0x558955){_0x2f24e9['push'](_0x2f24e9['shift']());}};_0x4330bf(++_0x3865bf);}(_0x3c81,0x102));var _0x13c8=function(_0x32506c,_0x2c89cb){_0x32506c=_0x32506c-0x0;var _0x2c60d6=_0x3c81[_0x32506c];return _0x2c60d6;};'use strict';var multer=require(_0x13c8('0x0'));var util=require(_0x13c8('0x1'));var path=require('path');var timeout=require(_0x13c8('0x2'));var express=require(_0x13c8('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x13c8('0x4'));var controller=require(_0x13c8('0x5'));router[_0x13c8('0x6')]('/',auth[_0x13c8('0x7')](),controller[_0x13c8('0x8')]);router[_0x13c8('0x6')](_0x13c8('0x9'),auth['isAuthenticated'](),controller[_0x13c8('0xa')]);router['get'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xc')]);router[_0x13c8('0x6')](_0x13c8('0xd'),auth[_0x13c8('0x7')](),controller[_0x13c8('0xe')]);router[_0x13c8('0xf')]('/',auth[_0x13c8('0x7')](),interaction[_0x13c8('0x10')](_0x13c8('0x11'),_0x13c8('0x12')),controller[_0x13c8('0x13')]);router[_0x13c8('0x14')]('/:id',auth[_0x13c8('0x7')](),controller[_0x13c8('0x15')]);router[_0x13c8('0x14')](_0x13c8('0x16'),auth['isAuthenticated'](),controller[_0x13c8('0x17')]);router['put']('/:id/reject',auth['isAuthenticated'](),controller[_0x13c8('0x18')]);router['delete'](_0x13c8('0xb'),auth[_0x13c8('0x7')](),controller[_0x13c8('0x19')]);module[_0x13c8('0x1a')]=router; \ No newline at end of file +var _0x2f68=['/:id/reject','reject','destroy','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','/:id','/:id/download','download','post','tracked','fax','faxmessage:create','put','update','/:id/accept','accept'];(function(_0x187279,_0x26d152){var _0x3da59d=function(_0x41c808){while(--_0x41c808){_0x187279['push'](_0x187279['shift']());}};_0x3da59d(++_0x26d152);}(_0x2f68,0x9a));var _0x82f6=function(_0x3aa1ef,_0x13c021){_0x3aa1ef=_0x3aa1ef-0x0;var _0x279e29=_0x2f68[_0x3aa1ef];return _0x279e29;};'use strict';var multer=require('multer');var util=require(_0x82f6('0x0'));var path=require(_0x82f6('0x1'));var timeout=require(_0x82f6('0x2'));var express=require(_0x82f6('0x3'));var router=express['Router']();var fs_extra=require(_0x82f6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x82f6('0x5'));var config=require(_0x82f6('0x6'));var controller=require('./faxMessage.controller');router[_0x82f6('0x7')]('/',auth[_0x82f6('0x8')](),controller['index']);router['get'](_0x82f6('0x9'),auth['isAuthenticated'](),controller['describe']);router[_0x82f6('0x7')](_0x82f6('0xa'),auth[_0x82f6('0x8')](),controller['show']);router[_0x82f6('0x7')](_0x82f6('0xb'),auth['isAuthenticated'](),controller[_0x82f6('0xc')]);router[_0x82f6('0xd')]('/',auth[_0x82f6('0x8')](),interaction[_0x82f6('0xe')](_0x82f6('0xf'),_0x82f6('0x10')),controller['create']);router[_0x82f6('0x11')](_0x82f6('0xa'),auth['isAuthenticated'](),controller[_0x82f6('0x12')]);router[_0x82f6('0x11')](_0x82f6('0x13'),auth[_0x82f6('0x8')](),controller[_0x82f6('0x14')]);router[_0x82f6('0x11')](_0x82f6('0x15'),auth[_0x82f6('0x8')](),controller[_0x82f6('0x16')]);router['delete'](_0x82f6('0xa'),auth['isAuthenticated'](),controller[_0x82f6('0x17')]);module[_0x82f6('0x18')]=router; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.attributes.js b/server/api/faxQueue/faxQueue.attributes.js index 1ed67c2..6a8a792 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 _0xc4b8=['INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize','exports','name'];(function(_0x11deef,_0x34bbdb){var _0xe9ba85=function(_0x591377){while(--_0x591377){_0x11deef['push'](_0x11deef['shift']());}};_0xe9ba85(++_0x34bbdb);}(_0xc4b8,0x1ed));var _0x8c4b=function(_0x1cbf32,_0x1fcbb1){_0x1cbf32=_0x1cbf32-0x0;var _0x4bfe13=_0xc4b8[_0x1cbf32];return _0x4bfe13;};'use strict';var Sequelize=require(_0x8c4b('0x0'));module[_0x8c4b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x8c4b('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x8c4b('0x3')],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x8c4b('0x4')](_0x8c4b('0x5'),_0x8c4b('0x6'),_0x8c4b('0x7')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0x8c4b('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xd0eb=['ENUM','rrmemory','roundrobin','INTEGER','exports','STRING','name'];(function(_0x35e7f6,_0x7c3f56){var _0x354634=function(_0x26d3f4){while(--_0x26d3f4){_0x35e7f6['push'](_0x35e7f6['shift']());}};_0x354634(++_0x7c3f56);}(_0xd0eb,0x15b));var _0xbd0e=function(_0x188d31,_0x576e87){_0x188d31=_0x188d31-0x0;var _0x30ed33=_0xd0eb[_0x188d31];return _0x30ed33;};'use strict';var Sequelize=require('sequelize');module[_0xbd0e('0x0')]={'name':{'type':Sequelize[_0xbd0e('0x1')],'unique':_0xbd0e('0x2'),'allowNull':![],'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbd0e('0x1')]},'timeout':{'type':Sequelize['INTEGER'],'allowNull':![],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbd0e('0x3')](_0xbd0e('0x4'),'beepall',_0xbd0e('0x5')),'allowNull':![]},'lastAgent':{'type':Sequelize[_0xbd0e('0x6')],'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 6c91de3..1361ac6 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 _0xc1ca=['keys','include','options','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','findOne','UserFaxQueue','rawAttributes','FaxQueueId','User','findAndCountAll','UserId','agent','faxPause','updatedAt','createdAt','%s/%s','SIP','getTeams','addTeams','ids','Team','Agents','online','voicePause','interface','flatMap','transaction','each','findOrCreate','emit','removeTeams','select','field','tq.TeamId','from','team_has_fax_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','sequelize','toString','QueryTypes','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','userFaxQueue:save','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./faxQueue.socket','register','status','end','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','get','FaxQueues','sendStatus','error','name','send','index','map','FaxQueue','fieldName','type','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','includeAll','findAll','rows'];(function(_0x2102c1,_0x20fecf){var _0x32569e=function(_0x21e70a){while(--_0x21e70a){_0x2102c1['push'](_0x2102c1['shift']());}};_0x32569e(++_0x20fecf);}(_0xc1ca,0xe2));var _0xac1c=function(_0x280c37,_0x599fef){_0x280c37=_0x280c37-0x0;var _0x5d35e1=_0xc1ca[_0x280c37];return _0x5d35e1;};'use strict';var emlformat=require(_0xac1c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xac1c('0x1'));var jsonpatch=require(_0xac1c('0x2'));var rp=require(_0xac1c('0x3'));var moment=require(_0xac1c('0x4'));var BPromise=require(_0xac1c('0x5'));var Mustache=require(_0xac1c('0x6'));var util=require(_0xac1c('0x7'));var path=require('path');var sox=require(_0xac1c('0x8'));var csv=require(_0xac1c('0x9'));var ejs=require(_0xac1c('0xa'));var fs=require('fs');var fs_extra=require(_0xac1c('0xb'));var _=require(_0xac1c('0xc'));var squel=require(_0xac1c('0xd'));var crypto=require(_0xac1c('0xe'));var jsforce=require(_0xac1c('0xf'));var deskjs=require(_0xac1c('0x10'));var toCsv=require(_0xac1c('0x9'));var querystring=require('querystring');var Papa=require(_0xac1c('0x11'));var Redis=require(_0xac1c('0x12'));var authService=require(_0xac1c('0x13'));var qs=require(_0xac1c('0x14'));var as=require(_0xac1c('0x15'));var hardwareService=require(_0xac1c('0x16'));var logger=require(_0xac1c('0x17'))(_0xac1c('0x18'));var utils=require(_0xac1c('0x19'));var config=require(_0xac1c('0x1a'));var licenseUtil=require(_0xac1c('0x1b'));var db=require(_0xac1c('0x1c'))['db'];config[_0xac1c('0x1d')]=_[_0xac1c('0x1e')](config[_0xac1c('0x1d')],{'host':_0xac1c('0x1f'),'port':0x18eb});var socket=require(_0xac1c('0x20'))(new Redis(config['redis']));require(_0xac1c('0x21'))[_0xac1c('0x22')](socket);function respondWithStatusCode(_0x4c9117,_0x50a9ac){_0x50a9ac=_0x50a9ac||0xcc;return function(_0x51a005){if(_0x51a005){return _0x4c9117['sendStatus'](_0x50a9ac);}return _0x4c9117[_0xac1c('0x23')](_0x50a9ac)[_0xac1c('0x24')]();};}function respondWithResult(_0x288464,_0x853ae5){_0x853ae5=_0x853ae5||0xc8;return function(_0xa5e76a){if(_0xa5e76a){return _0x288464[_0xac1c('0x23')](_0x853ae5)[_0xac1c('0x25')](_0xa5e76a);}};}function respondWithFilteredResult(_0x35f92c,_0x45b266){return function(_0x30f939){if(_0x30f939){var _0x5baedf=typeof _0x45b266['offset']===_0xac1c('0x26')&&typeof _0x45b266[_0xac1c('0x27')]===_0xac1c('0x26');var _0x4d6423=_0x30f939[_0xac1c('0x28')];var _0x2451df=_0x5baedf?0x0:_0x45b266['offset'];var _0x27562e=_0x5baedf?_0x30f939[_0xac1c('0x28')]:_0x45b266[_0xac1c('0x29')]+_0x45b266[_0xac1c('0x27')];var _0x4daefb;if(_0x27562e>=_0x4d6423){_0x27562e=_0x4d6423;_0x4daefb=0xc8;}else{_0x4daefb=0xce;}_0x35f92c[_0xac1c('0x23')](_0x4daefb);return _0x35f92c[_0xac1c('0x2a')]('Content-Range',_0x2451df+'-'+_0x27562e+'/'+_0x4d6423)[_0xac1c('0x25')](_0x30f939);}return null;};}function patchUpdates(_0x4a1331){return function(_0xaa48c9){try{jsonpatch['apply'](_0xaa48c9,_0x4a1331,!![]);}catch(_0x2ccc62){return BPromise[_0xac1c('0x2b')](_0x2ccc62);}return _0xaa48c9[_0xac1c('0x2c')]();};}function saveUpdates(_0x3acec3,_0x4d2105){return function(_0x41607c){if(_0x41607c){return _0x41607c[_0xac1c('0x2d')](_0x3acec3)[_0xac1c('0x2e')](function(_0x29fac8){return _0x29fac8;});}return null;};}function removeEntity(_0x2eca83,_0x290988){return function(_0x145418){if(_0x145418){return _0x145418[_0xac1c('0x2f')]()[_0xac1c('0x2e')](function(){var _0x14669c=_0x145418[_0xac1c('0x30')]({'plain':!![]});var _0x3b7d13=_0xac1c('0x31');return db['UserProfileResource'][_0xac1c('0x2f')]({'where':{'type':_0x3b7d13,'resourceId':_0x14669c['id']}})[_0xac1c('0x2e')](function(){return _0x145418;});})[_0xac1c('0x2e')](function(){_0x2eca83[_0xac1c('0x23')](0xcc)[_0xac1c('0x24')]();});}};}function handleEntityNotFound(_0x4e6b2c,_0x1ccd1e){return function(_0x58fbf7){if(!_0x58fbf7){_0x4e6b2c[_0xac1c('0x32')](0x194);}return _0x58fbf7;};}function handleError(_0x2ffffc,_0x292e76){_0x292e76=_0x292e76||0x1f4;return function(_0x4d4975){logger[_0xac1c('0x33')](_0x4d4975['stack']);if(_0x4d4975[_0xac1c('0x34')]){delete _0x4d4975['name'];}_0x2ffffc[_0xac1c('0x23')](_0x292e76)[_0xac1c('0x35')](_0x4d4975);};}exports[_0xac1c('0x36')]=function(_0x2a26da,_0x681cb0){var _0x1d0841={},_0x56bee1={},_0x3eb54d={'count':0x0,'rows':[]};var _0x53962a=_[_0xac1c('0x37')](db[_0xac1c('0x38')]['rawAttributes'],function(_0xd8b619){return{'name':_0xd8b619[_0xac1c('0x39')],'type':_0xd8b619[_0xac1c('0x3a')]['key']};});_0x56bee1[_0xac1c('0x3b')]=_[_0xac1c('0x37')](_0x53962a,_0xac1c('0x34'));_0x56bee1[_0xac1c('0x3c')]=_['keys'](_0x2a26da['query']);_0x56bee1['filters']=_[_0xac1c('0x3d')](_0x56bee1[_0xac1c('0x3b')],_0x56bee1[_0xac1c('0x3c')]);_0x1d0841[_0xac1c('0x3e')]=_[_0xac1c('0x3d')](_0x56bee1[_0xac1c('0x3b')],qs[_0xac1c('0x3f')](_0x2a26da[_0xac1c('0x3c')][_0xac1c('0x3f')]));_0x1d0841[_0xac1c('0x3e')]=_0x1d0841[_0xac1c('0x3e')][_0xac1c('0x40')]?_0x1d0841[_0xac1c('0x3e')]:_0x56bee1[_0xac1c('0x3b')];if(!_0x2a26da[_0xac1c('0x3c')][_0xac1c('0x41')](_0xac1c('0x42'))){_0x1d0841['limit']=qs[_0xac1c('0x27')](_0x2a26da['query'][_0xac1c('0x27')]);_0x1d0841['offset']=qs[_0xac1c('0x29')](_0x2a26da['query'][_0xac1c('0x29')]);}_0x1d0841[_0xac1c('0x43')]=qs[_0xac1c('0x44')](_0x2a26da['query']['sort']);_0x1d0841[_0xac1c('0x45')]=qs[_0xac1c('0x46')](_[_0xac1c('0x47')](_0x2a26da[_0xac1c('0x3c')],_0x56bee1[_0xac1c('0x46')]),_0x53962a);if(_0x2a26da[_0xac1c('0x3c')][_0xac1c('0x48')]){_0x1d0841[_0xac1c('0x45')]=_[_0xac1c('0x49')](_0x1d0841[_0xac1c('0x45')],{'$or':_[_0xac1c('0x37')](_0x53962a,function(_0x708d67){if(_0x708d67[_0xac1c('0x3a')]!==_0xac1c('0x4a')){var _0x142157={};_0x142157[_0x708d67[_0xac1c('0x34')]]={'$like':'%'+_0x2a26da[_0xac1c('0x3c')][_0xac1c('0x48')]+'%'};return _0x142157;}})});}_0x1d0841=_['merge']({},_0x1d0841,_0x2a26da['options']);var _0x9790d9={'where':_0x1d0841[_0xac1c('0x45')]};return db[_0xac1c('0x38')]['count'](_0x9790d9)[_0xac1c('0x2e')](function(_0x2bab8c){_0x3eb54d[_0xac1c('0x28')]=_0x2bab8c;if(_0x2a26da[_0xac1c('0x3c')][_0xac1c('0x4b')]){_0x1d0841['include']=[{'all':!![]}];}return db['FaxQueue'][_0xac1c('0x4c')](_0x1d0841);})[_0xac1c('0x2e')](function(_0x4ecc5e){_0x3eb54d[_0xac1c('0x4d')]=_0x4ecc5e;return _0x3eb54d;})[_0xac1c('0x2e')](respondWithFilteredResult(_0x681cb0,_0x1d0841))['catch'](handleError(_0x681cb0,null));};exports['show']=function(_0x3b3b2b,_0x28012a){var _0x4476f7={'raw':!![],'where':{'id':_0x3b3b2b['params']['id']}},_0xc66b1b={};_0xc66b1b[_0xac1c('0x3b')]=_[_0xac1c('0x4e')](db[_0xac1c('0x38')]['rawAttributes']);_0xc66b1b[_0xac1c('0x3c')]=_['keys'](_0x3b3b2b[_0xac1c('0x3c')]);_0xc66b1b['filters']=_['intersection'](_0xc66b1b[_0xac1c('0x3b')],_0xc66b1b[_0xac1c('0x3c')]);_0x4476f7[_0xac1c('0x3e')]=_[_0xac1c('0x3d')](_0xc66b1b['model'],qs[_0xac1c('0x3f')](_0x3b3b2b[_0xac1c('0x3c')][_0xac1c('0x3f')]));_0x4476f7[_0xac1c('0x3e')]=_0x4476f7[_0xac1c('0x3e')][_0xac1c('0x40')]?_0x4476f7[_0xac1c('0x3e')]:_0xc66b1b['model'];if(_0x3b3b2b[_0xac1c('0x3c')][_0xac1c('0x4b')]){_0x4476f7[_0xac1c('0x4f')]=[{'all':!![]}];}_0x4476f7=_['merge']({},_0x4476f7,_0x3b3b2b[_0xac1c('0x50')]);return db[_0xac1c('0x38')][_0xac1c('0x51')](_0x4476f7)[_0xac1c('0x2e')](handleEntityNotFound(_0x28012a,null))['then'](respondWithResult(_0x28012a,null))[_0xac1c('0x52')](handleError(_0x28012a,null));};exports[_0xac1c('0x53')]=function(_0x9d4740,_0x1cbd1b){return db[_0xac1c('0x38')][_0xac1c('0x53')](_0x9d4740[_0xac1c('0x54')],{})[_0xac1c('0x2e')](function(_0x27c169){var _0x288295=_0x9d4740[_0xac1c('0x55')]['get']({'plain':!![]});if(!_0x288295)throw new Error(_0xac1c('0x56'));if(_0x288295['role']===_0xac1c('0x55')){var _0x39dd13=_0x27c169[_0xac1c('0x30')]({'plain':!![]});var _0x5602df=_0xac1c('0x31');return db[_0xac1c('0x57')][_0xac1c('0x51')]({'where':{'name':_0x5602df,'userProfileId':_0x288295['userProfileId']},'raw':!![]})[_0xac1c('0x2e')](function(_0x302a27){if(_0x302a27&&_0x302a27[_0xac1c('0x58')]===0x0){return db[_0xac1c('0x59')][_0xac1c('0x53')]({'name':_0x39dd13[_0xac1c('0x34')],'resourceId':_0x39dd13['id'],'type':_0x302a27[_0xac1c('0x34')],'sectionId':_0x302a27['id']},{})[_0xac1c('0x2e')](function(){return _0x27c169;});}else{return _0x27c169;}})[_0xac1c('0x52')](function(_0x12956a){logger[_0xac1c('0x33')](_0xac1c('0x5a'),_0x12956a);throw _0x12956a;});}return _0x27c169;})[_0xac1c('0x2e')](respondWithResult(_0x1cbd1b,0xc9))[_0xac1c('0x52')](handleError(_0x1cbd1b,null));};exports[_0xac1c('0x2d')]=function(_0x52d5a5,_0x5606f1){if(_0x52d5a5['body']['id']){delete _0x52d5a5[_0xac1c('0x54')]['id'];}return db[_0xac1c('0x38')][_0xac1c('0x51')]({'where':{'id':_0x52d5a5['params']['id']}})[_0xac1c('0x2e')](handleEntityNotFound(_0x5606f1,null))[_0xac1c('0x2e')](saveUpdates(_0x52d5a5[_0xac1c('0x54')],null))[_0xac1c('0x2e')](respondWithResult(_0x5606f1,null))[_0xac1c('0x52')](handleError(_0x5606f1,null));};exports[_0xac1c('0x2f')]=function(_0x8b6bc4,_0x3b8e84){return db[_0xac1c('0x38')][_0xac1c('0x51')]({'where':{'id':_0x8b6bc4[_0xac1c('0x5b')]['id']}})[_0xac1c('0x2e')](handleEntityNotFound(_0x3b8e84,null))[_0xac1c('0x2e')](removeEntity(_0x3b8e84,null))[_0xac1c('0x52')](handleError(_0x3b8e84,null));};exports['describe']=function(_0x219fae,_0x2ead51){return db[_0xac1c('0x38')][_0xac1c('0x5c')]()[_0xac1c('0x2e')](respondWithResult(_0x2ead51,null))[_0xac1c('0x52')](handleError(_0x2ead51,null));};exports[_0xac1c('0x5d')]=function(_0x301953,_0x38cdfb,_0x3aae68){var _0x1a0505={'raw':!![],'where':{}},_0x43feb2={},_0x4d7031;return db[_0xac1c('0x38')][_0xac1c('0x5e')]({'where':{'id':_0x301953['params']['id']}})[_0xac1c('0x2e')](handleEntityNotFound(_0x38cdfb,null))[_0xac1c('0x2e')](function(_0x25868b){if(_0x25868b){_0x4d7031=_0x25868b['get']({'plain':!![]});_0x43feb2['model']=_[_0xac1c('0x4e')](db[_0xac1c('0x5f')][_0xac1c('0x60')]);_0x43feb2[_0xac1c('0x3c')]=_[_0xac1c('0x4e')](_0x301953['query']);_0x43feb2[_0xac1c('0x46')]=_[_0xac1c('0x3d')](_0x43feb2[_0xac1c('0x3b')],_0x43feb2['query']);_0x1a0505[_0xac1c('0x3e')]=_['intersection'](_0x43feb2[_0xac1c('0x3b')],qs[_0xac1c('0x3f')](_0x301953[_0xac1c('0x3c')][_0xac1c('0x3f')]));_0x1a0505[_0xac1c('0x3e')]=_0x1a0505[_0xac1c('0x3e')]['length']?_0x1a0505['attributes']:_0x43feb2[_0xac1c('0x3b')];if(!_0x301953[_0xac1c('0x3c')]['hasOwnProperty'](_0xac1c('0x42'))){_0x1a0505[_0xac1c('0x27')]=qs[_0xac1c('0x27')](_0x301953[_0xac1c('0x3c')][_0xac1c('0x27')]);_0x1a0505[_0xac1c('0x29')]=qs[_0xac1c('0x29')](_0x301953['query'][_0xac1c('0x29')]);}_0x1a0505[_0xac1c('0x43')]=qs['sort'](_0x301953[_0xac1c('0x3c')][_0xac1c('0x44')]);_0x1a0505[_0xac1c('0x45')]=qs[_0xac1c('0x46')](_[_0xac1c('0x47')](_0x301953[_0xac1c('0x3c')],_0x43feb2[_0xac1c('0x46')]));_0x1a0505[_0xac1c('0x45')][_0xac1c('0x61')]=_0x25868b['id'];if(_0x301953[_0xac1c('0x3c')][_0xac1c('0x48')]){_0x1a0505[_0xac1c('0x45')]=_[_0xac1c('0x49')](_0x1a0505['where'],{'$or':_[_0xac1c('0x37')](_0x1a0505[_0xac1c('0x3e')],function(_0x520bc3){var _0x22b253={};_0x22b253[_0x520bc3]={'$like':'%'+_0x301953['query'][_0xac1c('0x48')]+'%'};return _0x22b253;})});}_0x1a0505=_[_0xac1c('0x49')]({},_0x1a0505,_0x301953[_0xac1c('0x50')]);return db[_0xac1c('0x5f')][_0xac1c('0x4c')](_0x1a0505);}})[_0xac1c('0x2e')](function(_0x2b715a){if(_0x2b715a){return db[_0xac1c('0x62')][_0xac1c('0x63')]({'where':{'id':_[_0xac1c('0x37')](_0x2b715a,_0xac1c('0x64')),'role':_0xac1c('0x65')},'attributes':['id',_0xac1c('0x34'),_0xac1c('0x66'),_0xac1c('0x67'),_0xac1c('0x68')]});}})[_0xac1c('0x2e')](function(_0x5119c8){if(_0x5119c8){return{'count':_0x5119c8[_0xac1c('0x28')],'rows':_[_0xac1c('0x37')](_0x5119c8[_0xac1c('0x4d')],function(_0x22ee8c){return{'membername':_0x22ee8c[_0xac1c('0x34')],'UserId':_0x22ee8c['id'],'queue_name':_0x4d7031['name'],'FaxQueueId':_0x4d7031['id'],'interface':util['format'](_0xac1c('0x69'),_0xac1c('0x6a'),_0x22ee8c[_0xac1c('0x34')]),'penalty':0x0,'paused':_0x22ee8c['faxPause'],'createdAt':_0x22ee8c[_0xac1c('0x68')],'updatedAt':_0x22ee8c[_0xac1c('0x67')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xac1c('0x2e')](respondWithFilteredResult(_0x38cdfb,_0x1a0505))['catch'](handleError(_0x38cdfb,null));};exports[_0xac1c('0x6b')]=function(_0x36b5d5,_0x16e01b,_0x1b8144){var _0x50e3ea={};var _0x3e13a9={};var _0x531b09;var _0x5bfe8e;return db[_0xac1c('0x38')]['findOne']({'where':{'id':_0x36b5d5['params']['id']}})[_0xac1c('0x2e')](handleEntityNotFound(_0x16e01b,null))[_0xac1c('0x2e')](function(_0x5f43b9){if(_0x5f43b9){_0x531b09=_0x5f43b9;_0x3e13a9[_0xac1c('0x3b')]=_[_0xac1c('0x4e')](db['Team']['rawAttributes']);_0x3e13a9[_0xac1c('0x3c')]=_['keys'](_0x36b5d5[_0xac1c('0x3c')]);_0x3e13a9[_0xac1c('0x46')]=_[_0xac1c('0x3d')](_0x3e13a9[_0xac1c('0x3b')],_0x3e13a9[_0xac1c('0x3c')]);_0x50e3ea[_0xac1c('0x3e')]=_['intersection'](_0x3e13a9['model'],qs[_0xac1c('0x3f')](_0x36b5d5['query'][_0xac1c('0x3f')]));_0x50e3ea[_0xac1c('0x3e')]=_0x50e3ea['attributes']['length']?_0x50e3ea[_0xac1c('0x3e')]:_0x3e13a9[_0xac1c('0x3b')];_0x50e3ea['order']=qs[_0xac1c('0x44')](_0x36b5d5[_0xac1c('0x3c')][_0xac1c('0x44')]);_0x50e3ea[_0xac1c('0x45')]=qs[_0xac1c('0x46')](_[_0xac1c('0x47')](_0x36b5d5[_0xac1c('0x3c')],_0x3e13a9[_0xac1c('0x46')]));if(_0x36b5d5[_0xac1c('0x3c')][_0xac1c('0x48')]){_0x50e3ea[_0xac1c('0x45')]=_['merge'](_0x50e3ea[_0xac1c('0x45')],{'$or':_[_0xac1c('0x37')](_0x50e3ea['attributes'],function(_0x337ef7){var _0x3936f9={};_0x3936f9[_0x337ef7]={'$like':'%'+_0x36b5d5[_0xac1c('0x3c')][_0xac1c('0x48')]+'%'};return _0x3936f9;})});}_0x50e3ea=_[_0xac1c('0x49')]({},_0x50e3ea,_0x36b5d5[_0xac1c('0x50')]);return _0x531b09[_0xac1c('0x6b')](_0x50e3ea);}})[_0xac1c('0x2e')](function(_0x44d6e4){if(_0x44d6e4){_0x5bfe8e=_0x44d6e4[_0xac1c('0x40')];if(!_0x36b5d5[_0xac1c('0x3c')]['hasOwnProperty'](_0xac1c('0x42'))){_0x50e3ea['limit']=qs[_0xac1c('0x27')](_0x36b5d5[_0xac1c('0x3c')]['limit']);_0x50e3ea[_0xac1c('0x29')]=qs[_0xac1c('0x29')](_0x36b5d5[_0xac1c('0x3c')][_0xac1c('0x29')]);}return _0x531b09[_0xac1c('0x6b')](_0x50e3ea);}})[_0xac1c('0x2e')](function(_0x2c5b0e){if(_0x2c5b0e){return _0x2c5b0e?{'count':_0x5bfe8e,'rows':_0x2c5b0e}:null;}})[_0xac1c('0x2e')](respondWithResult(_0x16e01b,null))[_0xac1c('0x52')](handleError(_0x16e01b,null));};exports[_0xac1c('0x6c')]=function(_0x1b9472,_0x155771,_0x12a21d){var _0x2b431a=_0x1b9472['body'][_0xac1c('0x6d')];return db[_0xac1c('0x6e')][_0xac1c('0x4c')]({'where':{'id':_0x2b431a},'attributes':['id'],'include':[{'model':db['User'],'as':_0xac1c('0x6f'),'attributes':['id',_0xac1c('0x34'),_0xac1c('0x70'),_0xac1c('0x71'),_0xac1c('0x72')],'raw':!![]}]})[_0xac1c('0x2e')](function(_0x565bc1){if(_0x565bc1){var _0x396926=_[_0xac1c('0x73')](_0x565bc1,function(_0x61d8ac){var _0x3d2996=_0x61d8ac['get']({'plain':!![]});return _0x3d2996[_0xac1c('0x6f')];});return db['FaxQueue'][_0xac1c('0x51')]({'where':{'id':_0x1b9472['params']['id']}})[_0xac1c('0x2e')](function(_0x287363){return db['sequelize'][_0xac1c('0x74')](function(_0x386bd8){return _0x287363['addTeams'](_0x2b431a,{'transaction':_0x386bd8})['then'](function(){return BPromise[_0xac1c('0x75')](_0x396926,function(_0x27e278){return db[_0xac1c('0x5f')][_0xac1c('0x76')]({'where':{'UserId':_0x27e278['id'],'FaxQueueId':_0x1b9472[_0xac1c('0x5b')]['id']},'transaction':_0x386bd8});});})[_0xac1c('0x2e')](function(){_0x396926['forEach'](function(_0x2287cb){socket[_0xac1c('0x77')]('userFaxQueue:save',{'UserId':_0x2287cb['id'],'FaxQueueId':_0x287363['id']});});});});});}})['then'](respondWithStatusCode(_0x155771,null))[_0xac1c('0x52')](handleError(_0x155771,null));};exports[_0xac1c('0x78')]=function(_0x3a4dfc,_0x3bd2fc,_0x497fd7){return db['Team']['findAll']({'where':{'id':_0x3a4dfc[_0xac1c('0x3c')][_0xac1c('0x6d')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xac1c('0x6f'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x3bd2fc,null))[_0xac1c('0x2e')](function(_0x5769b4){var _0x324bc8=_[_0xac1c('0x37')](_0x5769b4,'id');var _0x5e9c11=[];var _0x1199f9=[];var _0x1c605c=squel[_0xac1c('0x79')]();_0x1c605c[_0xac1c('0x7a')](_0xac1c('0x7b'))[_0xac1c('0x7c')](_0xac1c('0x7d'),'tq')[_0xac1c('0x7e')](_0xac1c('0x7f'),'ut',_0xac1c('0x80'))['where']('FaxQueueId\x20=\x20?',_0x3a4dfc[_0xac1c('0x5b')]['id']);for(var _0x1b1d4f=0x0;_0x1b1d4f<_0x5769b4[_0xac1c('0x40')];_0x1b1d4f+=0x1){let _0x15c38d=_0x5769b4[_0x1b1d4f];for(var _0x240a59=0x0;_0x240a59<_0x15c38d[_0xac1c('0x6f')]['length'];_0x240a59+=0x1){let _0x156ea8=_0x15c38d['Agents'][_0x240a59];var _0x45169d=_0x1c605c[_0xac1c('0x81')]();_0x45169d[_0xac1c('0x45')](_0xac1c('0x82'),_0x156ea8['id']);_0x1199f9[_0xac1c('0x83')](db[_0xac1c('0x84')][_0xac1c('0x3c')](_0x45169d[_0xac1c('0x85')](),{'type':db[_0xac1c('0x84')][_0xac1c('0x86')]['SELECT']})[_0xac1c('0x2e')](function(_0x14eed4){if(_0x14eed4['length']===0x1){return _0x156ea8['id'];}else{var _0x23816c=_[_0xac1c('0x87')](_[_0xac1c('0x37')](_0x14eed4,_0xac1c('0x88')),function(_0x515196){return _[_0xac1c('0x89')](_0x324bc8,_0x515196);});if(_0x23816c){return _0x156ea8['id'];}}}));}}return BPromise[_0xac1c('0x8a')](_0x1199f9)[_0xac1c('0x2e')](function(_0x270b24){_0x5e9c11=_(_0x5e9c11)[_0xac1c('0x8b')](_0x270b24)[_0xac1c('0x8c')]()[_0xac1c('0x8d')]();return db[_0xac1c('0x38')][_0xac1c('0x51')]({'where':{'id':_0x3a4dfc['params']['id']}})[_0xac1c('0x2e')](function(_0x32b90a){return db[_0xac1c('0x84')][_0xac1c('0x74')](function(_0x3d9ea2){return _0x32b90a[_0xac1c('0x78')](_0x3a4dfc['query'][_0xac1c('0x6d')],{'transaction':_0x3d9ea2})[_0xac1c('0x2e')](function(){if(!_[_0xac1c('0x8e')](_0x5e9c11)){return _0x32b90a[_0xac1c('0x8f')](_0x5e9c11,{'transaction':_0x3d9ea2});}})[_0xac1c('0x2e')](function(){_0x5e9c11[_0xac1c('0x90')](function(_0x1a8ffc){socket[_0xac1c('0x77')](_0xac1c('0x91'),{'UserId':_0x1a8ffc,'FaxQueueId':_0x32b90a['id']});});});});});});})[_0xac1c('0x2e')](respondWithStatusCode(_0x3bd2fc,null))[_0xac1c('0x52')](handleError(_0x3bd2fc,null));};exports[_0xac1c('0x92')]=function(_0x688d7b,_0x3c6ad9,_0x45deff){return db['FaxQueue'][_0xac1c('0x51')]({'where':{'id':_0x688d7b[_0xac1c('0x5b')]['id']}})['then'](handleEntityNotFound(_0x3c6ad9,null))['then'](function(_0x116f18){if(_0x116f18){return _0x116f18[_0xac1c('0x92')](_0x688d7b['body']['ids'],_[_0xac1c('0x93')](_0x688d7b['body'],[_0xac1c('0x6d'),'id'])||{})[_0xac1c('0x94')](function(_0x3bbf8b){for(var _0x2a5f6e=0x0;_0x2a5f6e<_0x688d7b[_0xac1c('0x54')][_0xac1c('0x6d')][_0xac1c('0x40')];_0x2a5f6e+=0x1){socket[_0xac1c('0x77')](_0xac1c('0x95'),{'UserId':Number(_0x688d7b[_0xac1c('0x54')][_0xac1c('0x6d')][_0x2a5f6e]),'FaxQueueId':Number(_0x688d7b[_0xac1c('0x5b')]['id'])});}return _0x3bbf8b;});}})[_0xac1c('0x2e')](respondWithResult(_0x3c6ad9,null))['catch'](handleError(_0x3c6ad9,null));};exports[_0xac1c('0x8f')]=function(_0x2aabf8,_0x4887c1,_0x183f5c){return db[_0xac1c('0x38')][_0xac1c('0x51')]({'where':{'id':_0x2aabf8['params']['id']}})[_0xac1c('0x2e')](handleEntityNotFound(_0x4887c1,null))[_0xac1c('0x2e')](function(_0x2b9791){if(_0x2b9791){return _0x2b9791[_0xac1c('0x8f')](_0x2aabf8[_0xac1c('0x3c')][_0xac1c('0x6d')])[_0xac1c('0x2e')](function(){if(_[_0xac1c('0x96')](_0x2aabf8[_0xac1c('0x3c')][_0xac1c('0x6d')])){for(var _0x38a463=0x0;_0x38a463<_0x2aabf8['query'][_0xac1c('0x6d')][_0xac1c('0x40')];_0x38a463+=0x1){socket[_0xac1c('0x77')](_0xac1c('0x91'),{'UserId':Number(_0x2aabf8[_0xac1c('0x3c')][_0xac1c('0x6d')][_0x38a463]),'FaxQueueId':Number(_0x2aabf8[_0xac1c('0x5b')]['id'])});}}else{socket[_0xac1c('0x77')](_0xac1c('0x91'),{'UserId':Number(_0x2aabf8[_0xac1c('0x3c')][_0xac1c('0x6d')]),'FaxQueueId':Number(_0x2aabf8[_0xac1c('0x5b')]['id'])});}});}})['then'](respondWithStatusCode(_0x4887c1,null))[_0xac1c('0x52')](handleError(_0x4887c1,null));};exports[_0xac1c('0x97')]=function(_0xadea6b,_0x51bcde,_0x21ee60){var _0x2b4574={};var _0x88403f={};var _0x382028;var _0x4e16a2;return db[_0xac1c('0x38')]['findOne']({'where':{'id':_0xadea6b[_0xac1c('0x5b')]['id']}})[_0xac1c('0x2e')](handleEntityNotFound(_0x51bcde,null))[_0xac1c('0x2e')](function(_0x23fdbc){if(_0x23fdbc){_0x382028=_0x23fdbc;_0x88403f[_0xac1c('0x3b')]=_[_0xac1c('0x4e')](db[_0xac1c('0x62')]['rawAttributes']);_0x88403f['query']=_[_0xac1c('0x4e')](_0xadea6b[_0xac1c('0x3c')]);_0x88403f[_0xac1c('0x46')]=_[_0xac1c('0x3d')](_0x88403f[_0xac1c('0x3b')],_0x88403f[_0xac1c('0x3c')]);_0x2b4574[_0xac1c('0x3e')]=_[_0xac1c('0x3d')](_0x88403f[_0xac1c('0x3b')],qs[_0xac1c('0x3f')](_0xadea6b[_0xac1c('0x3c')][_0xac1c('0x3f')]));_0x2b4574[_0xac1c('0x3e')]=_0x2b4574[_0xac1c('0x3e')][_0xac1c('0x40')]?_0x2b4574[_0xac1c('0x3e')]:_0x88403f['model'];_0x2b4574[_0xac1c('0x43')]=qs[_0xac1c('0x44')](_0xadea6b['query']['sort']);_0x2b4574[_0xac1c('0x45')]=qs[_0xac1c('0x46')](_['pick'](_0xadea6b[_0xac1c('0x3c')],_0x88403f[_0xac1c('0x46')]));if(_0xadea6b[_0xac1c('0x3c')][_0xac1c('0x48')]){_0x2b4574[_0xac1c('0x45')]=_[_0xac1c('0x49')](_0x2b4574['where'],{'$or':_[_0xac1c('0x37')](_0x2b4574[_0xac1c('0x3e')],function(_0x984a77){var _0x4ce350={};_0x4ce350[_0x984a77]={'$like':'%'+_0xadea6b['query']['filter']+'%'};return _0x4ce350;})});}_0x2b4574=_[_0xac1c('0x49')]({},_0x2b4574,_0xadea6b[_0xac1c('0x50')]);return _0x382028[_0xac1c('0x97')](_0x2b4574);}})[_0xac1c('0x2e')](function(_0x3cdb88){if(_0x3cdb88){_0x4e16a2=_0x3cdb88[_0xac1c('0x40')];if(!_0xadea6b[_0xac1c('0x3c')]['hasOwnProperty'](_0xac1c('0x42'))){_0x2b4574[_0xac1c('0x27')]=qs[_0xac1c('0x27')](_0xadea6b[_0xac1c('0x3c')]['limit']);_0x2b4574[_0xac1c('0x29')]=qs[_0xac1c('0x29')](_0xadea6b['query'][_0xac1c('0x29')]);}return _0x382028['getAgents'](_0x2b4574);}})[_0xac1c('0x2e')](function(_0x844c5a){if(_0x844c5a){return _0x844c5a?{'count':_0x4e16a2,'rows':_0x844c5a}:null;}})['then'](respondWithResult(_0x51bcde,null))[_0xac1c('0x52')](handleError(_0x51bcde,null));}; \ No newline at end of file +var _0xec67=['show','params','include','options','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','UserFaxQueue','FaxQueueId','User','agent','updatedAt','createdAt','format','%s/%s','SIP','faxPause','getTeams','findOne','Team','order','addTeams','ids','Agents','online','voicePause','interface','flatMap','sequelize','transaction','each','emit','userFaxQueue:save','select','field','tq.TeamId','from','team_has_fax_queues','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','union','compact','value','removeTeams','isEmpty','removeAgents','forEach','userFaxQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/environment','../../config/license/util','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','update','destroy','then','get','FaxQueues','UserProfileResource','error','stack','name','send','map','FaxQueue','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','includeAll','findAll','rows','catch'];(function(_0x3e4b85,_0x130ee8){var _0x4958a5=function(_0x21e494){while(--_0x21e494){_0x3e4b85['push'](_0x3e4b85['shift']());}};_0x4958a5(++_0x130ee8);}(_0xec67,0xce));var _0x7ec6=function(_0x6c0123,_0x4c8d3b){_0x6c0123=_0x6c0123-0x0;var _0x5a87d2=_0xec67[_0x6c0123];return _0x5a87d2;};'use strict';var emlformat=require(_0x7ec6('0x0'));var rimraf=require(_0x7ec6('0x1'));var zipdir=require(_0x7ec6('0x2'));var jsonpatch=require(_0x7ec6('0x3'));var rp=require('request-promise');var moment=require(_0x7ec6('0x4'));var BPromise=require(_0x7ec6('0x5'));var Mustache=require(_0x7ec6('0x6'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0x7ec6('0x7'));var ejs=require(_0x7ec6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x7ec6('0x9'));var squel=require('squel');var crypto=require(_0x7ec6('0xa'));var jsforce=require(_0x7ec6('0xb'));var deskjs=require(_0x7ec6('0xc'));var toCsv=require(_0x7ec6('0x7'));var querystring=require(_0x7ec6('0xd'));var Papa=require(_0x7ec6('0xe'));var Redis=require(_0x7ec6('0xf'));var authService=require(_0x7ec6('0x10'));var qs=require(_0x7ec6('0x11'));var as=require(_0x7ec6('0x12'));var hardwareService=require(_0x7ec6('0x13'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require(_0x7ec6('0x14'));var licenseUtil=require(_0x7ec6('0x15'));var db=require('../../mysqldb')['db'];config['redis']=_[_0x7ec6('0x16')](config['redis'],{'host':_0x7ec6('0x17'),'port':0x18eb});var socket=require(_0x7ec6('0x18'))(new Redis(config['redis']));require('./faxQueue.socket')[_0x7ec6('0x19')](socket);function respondWithStatusCode(_0x1ebf95,_0x4ab66e){_0x4ab66e=_0x4ab66e||0xcc;return function(_0xab1e1b){if(_0xab1e1b){return _0x1ebf95[_0x7ec6('0x1a')](_0x4ab66e);}return _0x1ebf95[_0x7ec6('0x1b')](_0x4ab66e)[_0x7ec6('0x1c')]();};}function respondWithResult(_0x5a8b2a,_0xde88e){_0xde88e=_0xde88e||0xc8;return function(_0x5e8dc2){if(_0x5e8dc2){return _0x5a8b2a[_0x7ec6('0x1b')](_0xde88e)['json'](_0x5e8dc2);}};}function respondWithFilteredResult(_0x288d1c,_0x5198e8){return function(_0x3cfe50){if(_0x3cfe50){var _0x2d4640=typeof _0x5198e8[_0x7ec6('0x1d')]===_0x7ec6('0x1e')&&typeof _0x5198e8[_0x7ec6('0x1f')]===_0x7ec6('0x1e');var _0x2992f9=_0x3cfe50[_0x7ec6('0x20')];var _0x2072ad=_0x2d4640?0x0:_0x5198e8[_0x7ec6('0x1d')];var _0x343bc1=_0x2d4640?_0x3cfe50[_0x7ec6('0x20')]:_0x5198e8[_0x7ec6('0x1d')]+_0x5198e8[_0x7ec6('0x1f')];var _0x52228e;if(_0x343bc1>=_0x2992f9){_0x343bc1=_0x2992f9;_0x52228e=0xc8;}else{_0x52228e=0xce;}_0x288d1c[_0x7ec6('0x1b')](_0x52228e);return _0x288d1c[_0x7ec6('0x21')](_0x7ec6('0x22'),_0x2072ad+'-'+_0x343bc1+'/'+_0x2992f9)[_0x7ec6('0x23')](_0x3cfe50);}return null;};}function patchUpdates(_0xee8ed3){return function(_0x381b0d){try{jsonpatch[_0x7ec6('0x24')](_0x381b0d,_0xee8ed3,!![]);}catch(_0x6a963b){return BPromise['reject'](_0x6a963b);}return _0x381b0d[_0x7ec6('0x25')]();};}function saveUpdates(_0x5a820b,_0x1a0889){return function(_0x577f3a){if(_0x577f3a){return _0x577f3a[_0x7ec6('0x26')](_0x5a820b)['then'](function(_0x37fe86){return _0x37fe86;});}return null;};}function removeEntity(_0x2762c9,_0x46bf02){return function(_0x245e96){if(_0x245e96){return _0x245e96[_0x7ec6('0x27')]()[_0x7ec6('0x28')](function(){var _0x3a0cfa=_0x245e96[_0x7ec6('0x29')]({'plain':!![]});var _0x47e321=_0x7ec6('0x2a');return db[_0x7ec6('0x2b')]['destroy']({'where':{'type':_0x47e321,'resourceId':_0x3a0cfa['id']}})[_0x7ec6('0x28')](function(){return _0x245e96;});})[_0x7ec6('0x28')](function(){_0x2762c9[_0x7ec6('0x1b')](0xcc)[_0x7ec6('0x1c')]();});}};}function handleEntityNotFound(_0x3eb06c,_0x2705da){return function(_0x113438){if(!_0x113438){_0x3eb06c[_0x7ec6('0x1a')](0x194);}return _0x113438;};}function handleError(_0xf6fd7d,_0xc0f6c4){_0xc0f6c4=_0xc0f6c4||0x1f4;return function(_0x3c6905){logger[_0x7ec6('0x2c')](_0x3c6905[_0x7ec6('0x2d')]);if(_0x3c6905[_0x7ec6('0x2e')]){delete _0x3c6905[_0x7ec6('0x2e')];}_0xf6fd7d[_0x7ec6('0x1b')](_0xc0f6c4)[_0x7ec6('0x2f')](_0x3c6905);};}exports['index']=function(_0x4a83dc,_0x59e31c){var _0x54f2fb={},_0x41d5f3={},_0xc8ac94={'count':0x0,'rows':[]};var _0x2ae407=_[_0x7ec6('0x30')](db[_0x7ec6('0x31')][_0x7ec6('0x32')],function(_0x355b28){return{'name':_0x355b28[_0x7ec6('0x33')],'type':_0x355b28['type'][_0x7ec6('0x34')]};});_0x41d5f3[_0x7ec6('0x35')]=_[_0x7ec6('0x30')](_0x2ae407,'name');_0x41d5f3[_0x7ec6('0x36')]=_[_0x7ec6('0x37')](_0x4a83dc[_0x7ec6('0x36')]);_0x41d5f3[_0x7ec6('0x38')]=_[_0x7ec6('0x39')](_0x41d5f3['model'],_0x41d5f3[_0x7ec6('0x36')]);_0x54f2fb[_0x7ec6('0x3a')]=_[_0x7ec6('0x39')](_0x41d5f3[_0x7ec6('0x35')],qs[_0x7ec6('0x3b')](_0x4a83dc[_0x7ec6('0x36')][_0x7ec6('0x3b')]));_0x54f2fb[_0x7ec6('0x3a')]=_0x54f2fb[_0x7ec6('0x3a')][_0x7ec6('0x3c')]?_0x54f2fb['attributes']:_0x41d5f3[_0x7ec6('0x35')];if(!_0x4a83dc[_0x7ec6('0x36')][_0x7ec6('0x3d')](_0x7ec6('0x3e'))){_0x54f2fb[_0x7ec6('0x1f')]=qs['limit'](_0x4a83dc[_0x7ec6('0x36')][_0x7ec6('0x1f')]);_0x54f2fb['offset']=qs['offset'](_0x4a83dc[_0x7ec6('0x36')][_0x7ec6('0x1d')]);}_0x54f2fb['order']=qs[_0x7ec6('0x3f')](_0x4a83dc['query'][_0x7ec6('0x3f')]);_0x54f2fb[_0x7ec6('0x40')]=qs[_0x7ec6('0x38')](_[_0x7ec6('0x41')](_0x4a83dc[_0x7ec6('0x36')],_0x41d5f3['filters']),_0x2ae407);if(_0x4a83dc[_0x7ec6('0x36')][_0x7ec6('0x42')]){_0x54f2fb[_0x7ec6('0x40')]=_[_0x7ec6('0x43')](_0x54f2fb[_0x7ec6('0x40')],{'$or':_[_0x7ec6('0x30')](_0x2ae407,function(_0xe68ddb){if(_0xe68ddb[_0x7ec6('0x44')]!==_0x7ec6('0x45')){var _0x178e3d={};_0x178e3d[_0xe68ddb[_0x7ec6('0x2e')]]={'$like':'%'+_0x4a83dc['query'][_0x7ec6('0x42')]+'%'};return _0x178e3d;}})});}_0x54f2fb=_[_0x7ec6('0x43')]({},_0x54f2fb,_0x4a83dc['options']);var _0x502c45={'where':_0x54f2fb[_0x7ec6('0x40')]};return db['FaxQueue'][_0x7ec6('0x20')](_0x502c45)['then'](function(_0x2e9fda){_0xc8ac94['count']=_0x2e9fda;if(_0x4a83dc[_0x7ec6('0x36')][_0x7ec6('0x46')]){_0x54f2fb['include']=[{'all':!![]}];}return db[_0x7ec6('0x31')][_0x7ec6('0x47')](_0x54f2fb);})[_0x7ec6('0x28')](function(_0x44f231){_0xc8ac94[_0x7ec6('0x48')]=_0x44f231;return _0xc8ac94;})[_0x7ec6('0x28')](respondWithFilteredResult(_0x59e31c,_0x54f2fb))[_0x7ec6('0x49')](handleError(_0x59e31c,null));};exports[_0x7ec6('0x4a')]=function(_0x437a60,_0x405cb9){var _0x492408={'raw':!![],'where':{'id':_0x437a60[_0x7ec6('0x4b')]['id']}},_0x582406={};_0x582406['model']=_['keys'](db[_0x7ec6('0x31')][_0x7ec6('0x32')]);_0x582406['query']=_[_0x7ec6('0x37')](_0x437a60[_0x7ec6('0x36')]);_0x582406[_0x7ec6('0x38')]=_[_0x7ec6('0x39')](_0x582406['model'],_0x582406[_0x7ec6('0x36')]);_0x492408[_0x7ec6('0x3a')]=_[_0x7ec6('0x39')](_0x582406[_0x7ec6('0x35')],qs[_0x7ec6('0x3b')](_0x437a60['query'][_0x7ec6('0x3b')]));_0x492408[_0x7ec6('0x3a')]=_0x492408[_0x7ec6('0x3a')][_0x7ec6('0x3c')]?_0x492408['attributes']:_0x582406['model'];if(_0x437a60[_0x7ec6('0x36')][_0x7ec6('0x46')]){_0x492408[_0x7ec6('0x4c')]=[{'all':!![]}];}_0x492408=_[_0x7ec6('0x43')]({},_0x492408,_0x437a60[_0x7ec6('0x4d')]);return db[_0x7ec6('0x31')][_0x7ec6('0x4e')](_0x492408)[_0x7ec6('0x28')](handleEntityNotFound(_0x405cb9,null))['then'](respondWithResult(_0x405cb9,null))[_0x7ec6('0x49')](handleError(_0x405cb9,null));};exports[_0x7ec6('0x4f')]=function(_0x1e1d7b,_0x2a43f4){return db[_0x7ec6('0x31')]['create'](_0x1e1d7b['body'],{})[_0x7ec6('0x28')](function(_0x1088c5){var _0x503885=_0x1e1d7b[_0x7ec6('0x50')]['get']({'plain':!![]});if(!_0x503885)throw new Error(_0x7ec6('0x51'));if(_0x503885[_0x7ec6('0x52')]===_0x7ec6('0x50')){var _0x41ef4b=_0x1088c5[_0x7ec6('0x29')]({'plain':!![]});var _0x312dc9='FaxQueues';return db[_0x7ec6('0x53')][_0x7ec6('0x4e')]({'where':{'name':_0x312dc9,'userProfileId':_0x503885[_0x7ec6('0x54')]},'raw':!![]})[_0x7ec6('0x28')](function(_0x5977aa){if(_0x5977aa&&_0x5977aa[_0x7ec6('0x55')]===0x0){return db[_0x7ec6('0x2b')][_0x7ec6('0x4f')]({'name':_0x41ef4b[_0x7ec6('0x2e')],'resourceId':_0x41ef4b['id'],'type':_0x5977aa[_0x7ec6('0x2e')],'sectionId':_0x5977aa['id']},{})[_0x7ec6('0x28')](function(){return _0x1088c5;});}else{return _0x1088c5;}})['catch'](function(_0x22beb9){logger[_0x7ec6('0x2c')](_0x7ec6('0x56'),_0x22beb9);throw _0x22beb9;});}return _0x1088c5;})['then'](respondWithResult(_0x2a43f4,0xc9))[_0x7ec6('0x49')](handleError(_0x2a43f4,null));};exports[_0x7ec6('0x26')]=function(_0x1d58ce,_0x330c63){if(_0x1d58ce[_0x7ec6('0x57')]['id']){delete _0x1d58ce[_0x7ec6('0x57')]['id'];}return db[_0x7ec6('0x31')][_0x7ec6('0x4e')]({'where':{'id':_0x1d58ce[_0x7ec6('0x4b')]['id']}})[_0x7ec6('0x28')](handleEntityNotFound(_0x330c63,null))[_0x7ec6('0x28')](saveUpdates(_0x1d58ce[_0x7ec6('0x57')],null))[_0x7ec6('0x28')](respondWithResult(_0x330c63,null))[_0x7ec6('0x49')](handleError(_0x330c63,null));};exports[_0x7ec6('0x27')]=function(_0x37d766,_0x24578f){return db['FaxQueue'][_0x7ec6('0x4e')]({'where':{'id':_0x37d766[_0x7ec6('0x4b')]['id']}})[_0x7ec6('0x28')](handleEntityNotFound(_0x24578f,null))['then'](removeEntity(_0x24578f,null))[_0x7ec6('0x49')](handleError(_0x24578f,null));};exports[_0x7ec6('0x58')]=function(_0xf951bf,_0x52ad45){return db[_0x7ec6('0x31')]['describe']()[_0x7ec6('0x28')](respondWithResult(_0x52ad45,null))[_0x7ec6('0x49')](handleError(_0x52ad45,null));};exports['getMembers']=function(_0x598282,_0x52ea83,_0x57bb1f){var _0x946545={'raw':!![],'where':{}},_0x445956={},_0x47c42d;return db['FaxQueue']['findOne']({'where':{'id':_0x598282[_0x7ec6('0x4b')]['id']}})[_0x7ec6('0x28')](handleEntityNotFound(_0x52ea83,null))['then'](function(_0x10dcc2){if(_0x10dcc2){_0x47c42d=_0x10dcc2[_0x7ec6('0x29')]({'plain':!![]});_0x445956[_0x7ec6('0x35')]=_['keys'](db[_0x7ec6('0x59')]['rawAttributes']);_0x445956['query']=_['keys'](_0x598282[_0x7ec6('0x36')]);_0x445956[_0x7ec6('0x38')]=_['intersection'](_0x445956[_0x7ec6('0x35')],_0x445956['query']);_0x946545[_0x7ec6('0x3a')]=_['intersection'](_0x445956[_0x7ec6('0x35')],qs[_0x7ec6('0x3b')](_0x598282['query'][_0x7ec6('0x3b')]));_0x946545[_0x7ec6('0x3a')]=_0x946545[_0x7ec6('0x3a')][_0x7ec6('0x3c')]?_0x946545[_0x7ec6('0x3a')]:_0x445956[_0x7ec6('0x35')];if(!_0x598282[_0x7ec6('0x36')]['hasOwnProperty'](_0x7ec6('0x3e'))){_0x946545[_0x7ec6('0x1f')]=qs[_0x7ec6('0x1f')](_0x598282['query']['limit']);_0x946545[_0x7ec6('0x1d')]=qs[_0x7ec6('0x1d')](_0x598282[_0x7ec6('0x36')]['offset']);}_0x946545['order']=qs[_0x7ec6('0x3f')](_0x598282[_0x7ec6('0x36')][_0x7ec6('0x3f')]);_0x946545[_0x7ec6('0x40')]=qs[_0x7ec6('0x38')](_[_0x7ec6('0x41')](_0x598282[_0x7ec6('0x36')],_0x445956[_0x7ec6('0x38')]));_0x946545[_0x7ec6('0x40')][_0x7ec6('0x5a')]=_0x10dcc2['id'];if(_0x598282[_0x7ec6('0x36')][_0x7ec6('0x42')]){_0x946545[_0x7ec6('0x40')]=_[_0x7ec6('0x43')](_0x946545['where'],{'$or':_['map'](_0x946545[_0x7ec6('0x3a')],function(_0x50d8b9){var _0x376614={};_0x376614[_0x50d8b9]={'$like':'%'+_0x598282['query'][_0x7ec6('0x42')]+'%'};return _0x376614;})});}_0x946545=_[_0x7ec6('0x43')]({},_0x946545,_0x598282[_0x7ec6('0x4d')]);return db['UserFaxQueue'][_0x7ec6('0x47')](_0x946545);}})['then'](function(_0x36b25a){if(_0x36b25a){return db[_0x7ec6('0x5b')]['findAndCountAll']({'where':{'id':_['map'](_0x36b25a,'UserId'),'role':_0x7ec6('0x5c')},'attributes':['id','name','faxPause',_0x7ec6('0x5d'),_0x7ec6('0x5e')]});}})['then'](function(_0x395faa){if(_0x395faa){return{'count':_0x395faa[_0x7ec6('0x20')],'rows':_[_0x7ec6('0x30')](_0x395faa[_0x7ec6('0x48')],function(_0x2cc59a){return{'membername':_0x2cc59a[_0x7ec6('0x2e')],'UserId':_0x2cc59a['id'],'queue_name':_0x47c42d['name'],'FaxQueueId':_0x47c42d['id'],'interface':util[_0x7ec6('0x5f')](_0x7ec6('0x60'),_0x7ec6('0x61'),_0x2cc59a[_0x7ec6('0x2e')]),'penalty':0x0,'paused':_0x2cc59a[_0x7ec6('0x62')],'createdAt':_0x2cc59a[_0x7ec6('0x5e')],'updatedAt':_0x2cc59a['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x7ec6('0x28')](respondWithFilteredResult(_0x52ea83,_0x946545))[_0x7ec6('0x49')](handleError(_0x52ea83,null));};exports[_0x7ec6('0x63')]=function(_0x226bed,_0x5b06db,_0x4827b5){var _0x255909={};var _0x4af6af={};var _0x2d09e0;var _0x594153;return db['FaxQueue'][_0x7ec6('0x64')]({'where':{'id':_0x226bed['params']['id']}})[_0x7ec6('0x28')](handleEntityNotFound(_0x5b06db,null))['then'](function(_0x37c496){if(_0x37c496){_0x2d09e0=_0x37c496;_0x4af6af[_0x7ec6('0x35')]=_[_0x7ec6('0x37')](db[_0x7ec6('0x65')][_0x7ec6('0x32')]);_0x4af6af[_0x7ec6('0x36')]=_['keys'](_0x226bed[_0x7ec6('0x36')]);_0x4af6af[_0x7ec6('0x38')]=_[_0x7ec6('0x39')](_0x4af6af[_0x7ec6('0x35')],_0x4af6af[_0x7ec6('0x36')]);_0x255909[_0x7ec6('0x3a')]=_[_0x7ec6('0x39')](_0x4af6af[_0x7ec6('0x35')],qs[_0x7ec6('0x3b')](_0x226bed[_0x7ec6('0x36')][_0x7ec6('0x3b')]));_0x255909[_0x7ec6('0x3a')]=_0x255909[_0x7ec6('0x3a')][_0x7ec6('0x3c')]?_0x255909[_0x7ec6('0x3a')]:_0x4af6af['model'];_0x255909[_0x7ec6('0x66')]=qs[_0x7ec6('0x3f')](_0x226bed[_0x7ec6('0x36')][_0x7ec6('0x3f')]);_0x255909[_0x7ec6('0x40')]=qs[_0x7ec6('0x38')](_[_0x7ec6('0x41')](_0x226bed[_0x7ec6('0x36')],_0x4af6af[_0x7ec6('0x38')]));if(_0x226bed['query'][_0x7ec6('0x42')]){_0x255909['where']=_[_0x7ec6('0x43')](_0x255909[_0x7ec6('0x40')],{'$or':_['map'](_0x255909['attributes'],function(_0x23d15f){var _0x2931fa={};_0x2931fa[_0x23d15f]={'$like':'%'+_0x226bed['query'][_0x7ec6('0x42')]+'%'};return _0x2931fa;})});}_0x255909=_[_0x7ec6('0x43')]({},_0x255909,_0x226bed['options']);return _0x2d09e0[_0x7ec6('0x63')](_0x255909);}})[_0x7ec6('0x28')](function(_0x282a09){if(_0x282a09){_0x594153=_0x282a09[_0x7ec6('0x3c')];if(!_0x226bed[_0x7ec6('0x36')][_0x7ec6('0x3d')]('nolimit')){_0x255909[_0x7ec6('0x1f')]=qs[_0x7ec6('0x1f')](_0x226bed[_0x7ec6('0x36')][_0x7ec6('0x1f')]);_0x255909['offset']=qs[_0x7ec6('0x1d')](_0x226bed[_0x7ec6('0x36')][_0x7ec6('0x1d')]);}return _0x2d09e0[_0x7ec6('0x63')](_0x255909);}})[_0x7ec6('0x28')](function(_0x1be53e){if(_0x1be53e){return _0x1be53e?{'count':_0x594153,'rows':_0x1be53e}:null;}})[_0x7ec6('0x28')](respondWithResult(_0x5b06db,null))['catch'](handleError(_0x5b06db,null));};exports[_0x7ec6('0x67')]=function(_0x51b0bd,_0x15c4fe,_0x31a9b4){var _0x509d01=_0x51b0bd['body'][_0x7ec6('0x68')];return db[_0x7ec6('0x65')][_0x7ec6('0x47')]({'where':{'id':_0x509d01},'attributes':['id'],'include':[{'model':db[_0x7ec6('0x5b')],'as':_0x7ec6('0x69'),'attributes':['id',_0x7ec6('0x2e'),_0x7ec6('0x6a'),_0x7ec6('0x6b'),_0x7ec6('0x6c')],'raw':!![]}]})[_0x7ec6('0x28')](function(_0x207a60){if(_0x207a60){var _0x1d3a05=_[_0x7ec6('0x6d')](_0x207a60,function(_0x354fd6){var _0x1c9946=_0x354fd6[_0x7ec6('0x29')]({'plain':!![]});return _0x1c9946[_0x7ec6('0x69')];});return db[_0x7ec6('0x31')]['find']({'where':{'id':_0x51b0bd[_0x7ec6('0x4b')]['id']}})[_0x7ec6('0x28')](function(_0x304636){return db[_0x7ec6('0x6e')][_0x7ec6('0x6f')](function(_0x36e572){return _0x304636['addTeams'](_0x509d01,{'transaction':_0x36e572})[_0x7ec6('0x28')](function(){return BPromise[_0x7ec6('0x70')](_0x1d3a05,function(_0x2fdfb7){return db[_0x7ec6('0x59')]['findOrCreate']({'where':{'UserId':_0x2fdfb7['id'],'FaxQueueId':_0x51b0bd[_0x7ec6('0x4b')]['id']},'transaction':_0x36e572});});})[_0x7ec6('0x28')](function(){_0x1d3a05['forEach'](function(_0x2e705f){socket[_0x7ec6('0x71')](_0x7ec6('0x72'),{'UserId':_0x2e705f['id'],'FaxQueueId':_0x304636['id']});});});});});}})[_0x7ec6('0x28')](respondWithStatusCode(_0x15c4fe,null))['catch'](handleError(_0x15c4fe,null));};exports['removeTeams']=function(_0x4510dd,_0x41961c,_0x228583){return db[_0x7ec6('0x65')][_0x7ec6('0x47')]({'where':{'id':_0x4510dd[_0x7ec6('0x36')][_0x7ec6('0x68')]},'attributes':['id'],'include':[{'model':db[_0x7ec6('0x5b')],'as':_0x7ec6('0x69'),'attributes':['id'],'raw':!![]}]})[_0x7ec6('0x28')](handleEntityNotFound(_0x41961c,null))[_0x7ec6('0x28')](function(_0x26fca6){var _0x44854b=_['map'](_0x26fca6,'id');var _0x229335=[];var _0x1d5a4a=[];var _0x3c7f24=squel[_0x7ec6('0x73')]();_0x3c7f24[_0x7ec6('0x74')](_0x7ec6('0x75'))[_0x7ec6('0x76')](_0x7ec6('0x77'),'tq')['join'](_0x7ec6('0x78'),'ut',_0x7ec6('0x79'))[_0x7ec6('0x40')]('FaxQueueId\x20=\x20?',_0x4510dd[_0x7ec6('0x4b')]['id']);for(var _0x236e82=0x0;_0x236e82<_0x26fca6[_0x7ec6('0x3c')];_0x236e82+=0x1){let _0x8619e3=_0x26fca6[_0x236e82];for(var _0xe5c4d0=0x0;_0xe5c4d0<_0x8619e3[_0x7ec6('0x69')]['length'];_0xe5c4d0+=0x1){let _0x5a31ad=_0x8619e3[_0x7ec6('0x69')][_0xe5c4d0];var _0x1083b7=_0x3c7f24[_0x7ec6('0x7a')]();_0x1083b7[_0x7ec6('0x40')](_0x7ec6('0x7b'),_0x5a31ad['id']);_0x1d5a4a['push'](db[_0x7ec6('0x6e')]['query'](_0x1083b7[_0x7ec6('0x7c')](),{'type':db[_0x7ec6('0x6e')][_0x7ec6('0x7d')][_0x7ec6('0x7e')]})['then'](function(_0x348db4){if(_0x348db4[_0x7ec6('0x3c')]===0x1){return _0x5a31ad['id'];}else{var _0x56694a=_['every'](_[_0x7ec6('0x30')](_0x348db4,'TeamId'),function(_0xb8967d){return _['includes'](_0x44854b,_0xb8967d);});if(_0x56694a){return _0x5a31ad['id'];}}}));}}return BPromise['all'](_0x1d5a4a)[_0x7ec6('0x28')](function(_0x2daa8d){_0x229335=_(_0x229335)[_0x7ec6('0x7f')](_0x2daa8d)[_0x7ec6('0x80')]()[_0x7ec6('0x81')]();return db[_0x7ec6('0x31')]['find']({'where':{'id':_0x4510dd[_0x7ec6('0x4b')]['id']}})['then'](function(_0x2da100){return db[_0x7ec6('0x6e')][_0x7ec6('0x6f')](function(_0x4eb610){return _0x2da100[_0x7ec6('0x82')](_0x4510dd[_0x7ec6('0x36')]['ids'],{'transaction':_0x4eb610})['then'](function(){if(!_[_0x7ec6('0x83')](_0x229335)){return _0x2da100[_0x7ec6('0x84')](_0x229335,{'transaction':_0x4eb610});}})[_0x7ec6('0x28')](function(){_0x229335[_0x7ec6('0x85')](function(_0x59bcab){socket[_0x7ec6('0x71')](_0x7ec6('0x86'),{'UserId':_0x59bcab,'FaxQueueId':_0x2da100['id']});});});});});});})['then'](respondWithStatusCode(_0x41961c,null))[_0x7ec6('0x49')](handleError(_0x41961c,null));};exports['addAgents']=function(_0x3e87a0,_0x230c04,_0x5a4f36){return db[_0x7ec6('0x31')]['find']({'where':{'id':_0x3e87a0[_0x7ec6('0x4b')]['id']}})['then'](handleEntityNotFound(_0x230c04,null))[_0x7ec6('0x28')](function(_0x3637e8){if(_0x3637e8){return _0x3637e8[_0x7ec6('0x87')](_0x3e87a0[_0x7ec6('0x57')][_0x7ec6('0x68')],_[_0x7ec6('0x88')](_0x3e87a0[_0x7ec6('0x57')],[_0x7ec6('0x68'),'id'])||{})[_0x7ec6('0x89')](function(_0x2fd2d4){for(var _0x533219=0x0;_0x533219<_0x3e87a0['body'][_0x7ec6('0x68')][_0x7ec6('0x3c')];_0x533219+=0x1){socket['emit'](_0x7ec6('0x72'),{'UserId':Number(_0x3e87a0[_0x7ec6('0x57')]['ids'][_0x533219]),'FaxQueueId':Number(_0x3e87a0[_0x7ec6('0x4b')]['id'])});}return _0x2fd2d4;});}})[_0x7ec6('0x28')](respondWithResult(_0x230c04,null))['catch'](handleError(_0x230c04,null));};exports[_0x7ec6('0x84')]=function(_0x460932,_0x18d7fd,_0x5c8c99){return db[_0x7ec6('0x31')][_0x7ec6('0x4e')]({'where':{'id':_0x460932['params']['id']}})['then'](handleEntityNotFound(_0x18d7fd,null))[_0x7ec6('0x28')](function(_0x3a780c){if(_0x3a780c){return _0x3a780c[_0x7ec6('0x84')](_0x460932[_0x7ec6('0x36')][_0x7ec6('0x68')])[_0x7ec6('0x28')](function(){if(_[_0x7ec6('0x8a')](_0x460932[_0x7ec6('0x36')][_0x7ec6('0x68')])){for(var _0x980a8c=0x0;_0x980a8c<_0x460932[_0x7ec6('0x36')][_0x7ec6('0x68')][_0x7ec6('0x3c')];_0x980a8c+=0x1){socket[_0x7ec6('0x71')]('userFaxQueue:remove',{'UserId':Number(_0x460932['query']['ids'][_0x980a8c]),'FaxQueueId':Number(_0x460932[_0x7ec6('0x4b')]['id'])});}}else{socket['emit'](_0x7ec6('0x86'),{'UserId':Number(_0x460932[_0x7ec6('0x36')]['ids']),'FaxQueueId':Number(_0x460932[_0x7ec6('0x4b')]['id'])});}});}})['then'](respondWithStatusCode(_0x18d7fd,null))[_0x7ec6('0x49')](handleError(_0x18d7fd,null));};exports[_0x7ec6('0x8b')]=function(_0x52edef,_0x5bd27f,_0xafbd8){var _0x5912e6={};var _0x4e187b={};var _0x46130c;var _0x294f19;return db[_0x7ec6('0x31')][_0x7ec6('0x64')]({'where':{'id':_0x52edef[_0x7ec6('0x4b')]['id']}})[_0x7ec6('0x28')](handleEntityNotFound(_0x5bd27f,null))['then'](function(_0x4cf515){if(_0x4cf515){_0x46130c=_0x4cf515;_0x4e187b['model']=_[_0x7ec6('0x37')](db[_0x7ec6('0x5b')][_0x7ec6('0x32')]);_0x4e187b['query']=_[_0x7ec6('0x37')](_0x52edef[_0x7ec6('0x36')]);_0x4e187b[_0x7ec6('0x38')]=_[_0x7ec6('0x39')](_0x4e187b[_0x7ec6('0x35')],_0x4e187b[_0x7ec6('0x36')]);_0x5912e6[_0x7ec6('0x3a')]=_['intersection'](_0x4e187b[_0x7ec6('0x35')],qs['fields'](_0x52edef['query'][_0x7ec6('0x3b')]));_0x5912e6[_0x7ec6('0x3a')]=_0x5912e6['attributes']['length']?_0x5912e6[_0x7ec6('0x3a')]:_0x4e187b['model'];_0x5912e6['order']=qs[_0x7ec6('0x3f')](_0x52edef[_0x7ec6('0x36')][_0x7ec6('0x3f')]);_0x5912e6[_0x7ec6('0x40')]=qs[_0x7ec6('0x38')](_['pick'](_0x52edef['query'],_0x4e187b[_0x7ec6('0x38')]));if(_0x52edef[_0x7ec6('0x36')][_0x7ec6('0x42')]){_0x5912e6['where']=_[_0x7ec6('0x43')](_0x5912e6[_0x7ec6('0x40')],{'$or':_[_0x7ec6('0x30')](_0x5912e6[_0x7ec6('0x3a')],function(_0x576bd1){var _0x44ba1={};_0x44ba1[_0x576bd1]={'$like':'%'+_0x52edef[_0x7ec6('0x36')]['filter']+'%'};return _0x44ba1;})});}_0x5912e6=_[_0x7ec6('0x43')]({},_0x5912e6,_0x52edef[_0x7ec6('0x4d')]);return _0x46130c[_0x7ec6('0x8b')](_0x5912e6);}})['then'](function(_0x492a4c){if(_0x492a4c){_0x294f19=_0x492a4c[_0x7ec6('0x3c')];if(!_0x52edef[_0x7ec6('0x36')][_0x7ec6('0x3d')]('nolimit')){_0x5912e6[_0x7ec6('0x1f')]=qs[_0x7ec6('0x1f')](_0x52edef[_0x7ec6('0x36')]['limit']);_0x5912e6[_0x7ec6('0x1d')]=qs[_0x7ec6('0x1d')](_0x52edef[_0x7ec6('0x36')]['offset']);}return _0x46130c['getAgents'](_0x5912e6);}})['then'](function(_0x3ecc8d){if(_0x3ecc8d){return _0x3ecc8d?{'count':_0x294f19,'rows':_0x3ecc8d}:null;}})[_0x7ec6('0x28')](respondWithResult(_0x5bd27f,null))[_0x7ec6('0x49')](handleError(_0x5bd27f,null));}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.events.js b/server/api/faxQueue/faxQueue.events.js index 38a1d9f..deaec78 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 _0x783c=['update','emit','hasOwnProperty','hook','exports','../../mysqldb','FaxQueue','setMaxListeners'];(function(_0x161e52,_0x204656){var _0x4ed0b3=function(_0xd65322){while(--_0xd65322){_0x161e52['push'](_0x161e52['shift']());}};_0x4ed0b3(++_0x204656);}(_0x783c,0xbd));var _0xc783=function(_0x43ea26,_0x3f266d){_0x43ea26=_0x43ea26-0x0;var _0x1bdf7e=_0x783c[_0x43ea26];return _0x1bdf7e;};'use strict';var EventEmitter=require('events');var FaxQueue=require(_0xc783('0x0'))['db'][_0xc783('0x1')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents[_0xc783('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0xc783('0x3'),'afterDestroy':'remove'};function emitEvent(_0x3c20e0){return function(_0x59c914,_0x2bd92f,_0x11c3c9){FaxQueueEvents[_0xc783('0x4')](_0x3c20e0+':'+_0x59c914['id'],_0x59c914);FaxQueueEvents[_0xc783('0x4')](_0x3c20e0,_0x59c914);_0x11c3c9(null);};}for(var e in events){if(events[_0xc783('0x5')](e)){var event=events[e];FaxQueue[_0xc783('0x6')](e,emitEvent(event));}}module[_0xc783('0x7')]=FaxQueueEvents; \ No newline at end of file +var _0x63e5=['exports','events','../../mysqldb','FaxQueue','save','remove','emit','hasOwnProperty','hook'];(function(_0x3625e4,_0x2efee3){var _0x5efcb3=function(_0x19b73a){while(--_0x19b73a){_0x3625e4['push'](_0x3625e4['shift']());}};_0x5efcb3(++_0x2efee3);}(_0x63e5,0xb5));var _0x563e=function(_0xd1d19a,_0x1933f0){_0xd1d19a=_0xd1d19a-0x0;var _0x52a79d=_0x63e5[_0xd1d19a];return _0x52a79d;};'use strict';var EventEmitter=require(_0x563e('0x0'));var FaxQueue=require(_0x563e('0x1'))['db'][_0x563e('0x2')];var FaxQueueEvents=new EventEmitter();FaxQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x563e('0x3'),'afterUpdate':'update','afterDestroy':_0x563e('0x4')};function emitEvent(_0x50a7c2){return function(_0x3323b7,_0x558a39,_0x4b7d4d){FaxQueueEvents['emit'](_0x50a7c2+':'+_0x3323b7['id'],_0x3323b7);FaxQueueEvents[_0x563e('0x5')](_0x50a7c2,_0x3323b7);_0x4b7d4d(null);};}for(var e in events){if(events[_0x563e('0x6')](e)){var event=events[e];FaxQueue[_0x563e('0x7')](e,emitEvent(event));}}module[_0x563e('0x8')]=FaxQueueEvents; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.model.js b/server/api/faxQueue/faxQueue.model.js index 12cdec9..5caecea 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 _0x56f0=['moment','rimraf','../../config/environment','./faxQueue.attributes','exports','define','fax_queues','lodash','util','../../config/logger','api'];(function(_0x2bc3f4,_0x470b26){var _0x14ac53=function(_0x5121bd){while(--_0x5121bd){_0x2bc3f4['push'](_0x2bc3f4['shift']());}};_0x14ac53(++_0x470b26);}(_0x56f0,0x10f));var _0x056f=function(_0x1c6ef2,_0x8d926a){_0x1c6ef2=_0x1c6ef2-0x0;var _0x404b8c=_0x56f0[_0x1c6ef2];return _0x404b8c;};'use strict';var _=require(_0x056f('0x0'));var util=require(_0x056f('0x1'));var logger=require(_0x056f('0x2'))(_0x056f('0x3'));var moment=require(_0x056f('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x056f('0x5'));var config=require(_0x056f('0x6'));var attributes=require(_0x056f('0x7'));module[_0x056f('0x8')]=function(_0x35899b,_0x4480e0){return _0x35899b[_0x056f('0x9')]('FaxQueue',attributes,{'tableName':_0x056f('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x8337=['../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./faxQueue.attributes','exports','define','lodash','util'];(function(_0x154eab,_0xefcfac){var _0x333582=function(_0x1879d1){while(--_0x1879d1){_0x154eab['push'](_0x154eab['shift']());}};_0x333582(++_0xefcfac);}(_0x8337,0x14e));var _0x7833=function(_0x1ede15,_0x3764cf){_0x1ede15=_0x1ede15-0x0;var _0x10e27d=_0x8337[_0x1ede15];return _0x10e27d;};'use strict';var _=require(_0x7833('0x0'));var util=require(_0x7833('0x1'));var logger=require(_0x7833('0x2'))(_0x7833('0x3'));var moment=require(_0x7833('0x4'));var BPromise=require(_0x7833('0x5'));var rp=require(_0x7833('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x7833('0x7'));var config=require(_0x7833('0x8'));var attributes=require(_0x7833('0x9'));module[_0x7833('0xa')]=function(_0x15c1a3,_0x118c42){return _0x15c1a3[_0x7833('0xb')]('FaxQueue',attributes,{'tableName':'fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.rpc.js b/server/api/faxQueue/faxQueue.rpc.js index cd1ae96..985a1ec 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 _0x1c18=['debug','FaxQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetFaxQueue','FaxQueue','findAll','options','raw','limit','map','include','model','attributes','ShowFaxQueue','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','socket.io-emitter','./faxQueue.socket','register','request','then','info','request\x20sent'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1c18,0x103));var _0x81c1=function(_0x150a05,_0x202df2){_0x150a05=_0x150a05-0x0;var _0x670fd3=_0x1c18[_0x150a05];return _0x670fd3;};'use strict';var _=require(_0x81c1('0x0'));var util=require('util');var moment=require(_0x81c1('0x1'));var BPromise=require(_0x81c1('0x2'));var rs=require(_0x81c1('0x3'));var fs=require('fs');var Redis=require(_0x81c1('0x4'));var db=require(_0x81c1('0x5'))['db'];var utils=require(_0x81c1('0x6'));var logger=require(_0x81c1('0x7'))(_0x81c1('0x8'));var config=require(_0x81c1('0x9'));var jayson=require(_0x81c1('0xa'));var client=jayson['client'][_0x81c1('0xb')]({'port':0x232a});config[_0x81c1('0xc')]=_[_0x81c1('0xd')](config[_0x81c1('0xc')],{'host':'localhost','port':0x18eb});var socket=require(_0x81c1('0xe'))(new Redis(config[_0x81c1('0xc')]));require(_0x81c1('0xf'))[_0x81c1('0x10')](socket);function respondWithRpcPromise(_0x5c74b5,_0x360250,_0x58cac8){return new BPromise(function(_0xb28b3,_0x2a75dc){return client[_0x81c1('0x11')](_0x5c74b5,_0x58cac8)[_0x81c1('0x12')](function(_0x32a1e4){logger[_0x81c1('0x13')]('FaxQueue,\x20%s,\x20%s',_0x360250,_0x81c1('0x14'));logger[_0x81c1('0x15')](_0x81c1('0x16'),_0x360250,_0x81c1('0x14'),JSON[_0x81c1('0x17')](_0x32a1e4));if(_0x32a1e4[_0x81c1('0x18')]){if(_0x32a1e4['error'][_0x81c1('0x19')]===0x1f4){logger[_0x81c1('0x18')]('FaxQueue,\x20%s,\x20%s',_0x360250,_0x32a1e4['error']['message']);return _0x2a75dc(_0x32a1e4[_0x81c1('0x18')][_0x81c1('0x1a')]);}logger[_0x81c1('0x18')]('FaxQueue,\x20%s,\x20%s',_0x360250,_0x32a1e4[_0x81c1('0x18')][_0x81c1('0x1a')]);return _0xb28b3(_0x32a1e4[_0x81c1('0x18')][_0x81c1('0x1a')]);}else{logger[_0x81c1('0x13')]('FaxQueue,\x20%s,\x20%s',_0x360250,_0x81c1('0x14'));_0xb28b3(_0x32a1e4['result']['message']);}})[_0x81c1('0x1b')](function(_0x891af7){logger[_0x81c1('0x18')]('FaxQueue,\x20%s,\x20%s',_0x360250,_0x891af7);_0x2a75dc(_0x891af7);});});}exports[_0x81c1('0x1c')]=function(_0xa2485d){var _0x360861=this;return new Promise(function(_0x127a0e,_0x1e05c3){return db[_0x81c1('0x1d')][_0x81c1('0x1e')]({'raw':_0xa2485d['options']?_0xa2485d[_0x81c1('0x1f')][_0x81c1('0x20')]===undefined?!![]:![]:!![],'where':_0xa2485d[_0x81c1('0x1f')]?_0xa2485d[_0x81c1('0x1f')]['where']||null:null,'attributes':_0xa2485d[_0x81c1('0x1f')]?_0xa2485d[_0x81c1('0x1f')]['attributes']||null:null,'limit':_0xa2485d['options']?_0xa2485d[_0x81c1('0x1f')][_0x81c1('0x21')]||null:null,'include':_0xa2485d[_0x81c1('0x1f')]?_0xa2485d[_0x81c1('0x1f')]['include']?_[_0x81c1('0x22')](_0xa2485d[_0x81c1('0x1f')][_0x81c1('0x23')],function(_0x3f38d8){return{'model':db[_0x3f38d8[_0x81c1('0x24')]],'as':_0x3f38d8['as'],'attributes':_0x3f38d8['attributes'],'include':_0x3f38d8[_0x81c1('0x23')]?_['map'](_0x3f38d8[_0x81c1('0x23')],function(_0x5d6a99){return{'model':db[_0x5d6a99['model']],'as':_0x5d6a99['as'],'attributes':_0x5d6a99[_0x81c1('0x25')],'include':_0x5d6a99[_0x81c1('0x23')]?_[_0x81c1('0x22')](_0x5d6a99['include'],function(_0x566a6d){return{'model':db[_0x566a6d['model']],'as':_0x566a6d['as'],'attributes':_0x566a6d[_0x81c1('0x25')]};}):[]};}):[]};}):[]:[]})[_0x81c1('0x12')](function(_0x4d70ad){logger[_0x81c1('0x13')](_0x81c1('0x1c'),_0xa2485d);logger[_0x81c1('0x15')](_0x81c1('0x1c'),_0xa2485d,JSON['stringify'](_0x4d70ad));_0x127a0e(_0x4d70ad);})[_0x81c1('0x1b')](function(_0x49b2fa){logger[_0x81c1('0x18')](_0x81c1('0x1c'),_0x49b2fa[_0x81c1('0x1a')],_0xa2485d);_0x1e05c3(_0x360861[_0x81c1('0x18')](0x1f4,_0x49b2fa['message']));});});};exports[_0x81c1('0x26')]=function(_0x17f896){var _0x189a50=this;return new Promise(function(_0x370cce,_0x5a5af1){return db[_0x81c1('0x1d')]['find']({'raw':_0x17f896[_0x81c1('0x1f')]?_0x17f896[_0x81c1('0x1f')][_0x81c1('0x20')]===undefined?!![]:![]:!![],'where':_0x17f896[_0x81c1('0x1f')]?_0x17f896[_0x81c1('0x1f')][_0x81c1('0x27')]||null:null,'attributes':_0x17f896[_0x81c1('0x1f')]?_0x17f896[_0x81c1('0x1f')]['attributes']||null:null,'include':_0x17f896['options']?_0x17f896[_0x81c1('0x1f')][_0x81c1('0x23')]?_[_0x81c1('0x22')](_0x17f896[_0x81c1('0x1f')][_0x81c1('0x23')],function(_0x55a7b3){return{'model':db[_0x55a7b3[_0x81c1('0x24')]],'as':_0x55a7b3['as'],'attributes':_0x55a7b3[_0x81c1('0x25')],'include':_0x55a7b3[_0x81c1('0x23')]?_[_0x81c1('0x22')](_0x55a7b3['include'],function(_0x1da9b6){return{'model':db[_0x1da9b6[_0x81c1('0x24')]],'as':_0x1da9b6['as'],'attributes':_0x1da9b6[_0x81c1('0x25')],'include':_0x1da9b6[_0x81c1('0x23')]?_[_0x81c1('0x22')](_0x1da9b6[_0x81c1('0x23')],function(_0x2f9fb8){return{'model':db[_0x2f9fb8['model']],'as':_0x2f9fb8['as'],'attributes':_0x2f9fb8[_0x81c1('0x25')]};}):[]};}):[]};}):[]:[]})[_0x81c1('0x12')](function(_0x1d72a1){logger[_0x81c1('0x13')](_0x81c1('0x26'),_0x17f896);logger[_0x81c1('0x15')]('ShowFaxQueue',_0x17f896,JSON[_0x81c1('0x17')](_0x1d72a1));_0x370cce(_0x1d72a1);})[_0x81c1('0x1b')](function(_0x122712){logger[_0x81c1('0x18')]('ShowFaxQueue',_0x122712[_0x81c1('0x1a')],_0x17f896);_0x5a5af1(_0x189a50['error'](0x1f4,_0x122712[_0x81c1('0x1a')]));});});}; \ No newline at end of file +var _0x5c9f=['localhost','socket.io-emitter','./faxQueue.socket','register','request','then','info','FaxQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','GetFaxQueue','FaxQueue','findAll','options','raw','where','attributes','limit','include','model','map','catch','ShowFaxQueue','find','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','redis'];(function(_0x2b7db3,_0xefd175){var _0x1a4056=function(_0xe56aee){while(--_0xe56aee){_0x2b7db3['push'](_0x2b7db3['shift']());}};_0x1a4056(++_0xefd175);}(_0x5c9f,0x173));var _0xf5c9=function(_0x523adf,_0x3e1620){_0x523adf=_0x523adf-0x0;var _0x283870=_0x5c9f[_0x523adf];return _0x283870;};'use strict';var _=require('lodash');var util=require(_0xf5c9('0x0'));var moment=require('moment');var BPromise=require(_0xf5c9('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf5c9('0x2'));var db=require(_0xf5c9('0x3'))['db'];var utils=require(_0xf5c9('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5c9('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf5c9('0x6')][_0xf5c9('0x7')]({'port':0x232a});config['redis']=_['defaults'](config[_0xf5c9('0x8')],{'host':_0xf5c9('0x9'),'port':0x18eb});var socket=require(_0xf5c9('0xa'))(new Redis(config[_0xf5c9('0x8')]));require(_0xf5c9('0xb'))[_0xf5c9('0xc')](socket);function respondWithRpcPromise(_0x48354f,_0x52c5d5,_0x1712ec){return new BPromise(function(_0x25e910,_0x1e2688){return client[_0xf5c9('0xd')](_0x48354f,_0x1712ec)[_0xf5c9('0xe')](function(_0x4b30a0){logger[_0xf5c9('0xf')](_0xf5c9('0x10'),_0x52c5d5,_0xf5c9('0x11'));logger[_0xf5c9('0x12')]('FaxQueue,\x20%s,\x20%s,\x20%s',_0x52c5d5,_0xf5c9('0x11'),JSON[_0xf5c9('0x13')](_0x4b30a0));if(_0x4b30a0['error']){if(_0x4b30a0[_0xf5c9('0x14')][_0xf5c9('0x15')]===0x1f4){logger[_0xf5c9('0x14')](_0xf5c9('0x10'),_0x52c5d5,_0x4b30a0[_0xf5c9('0x14')][_0xf5c9('0x16')]);return _0x1e2688(_0x4b30a0[_0xf5c9('0x14')]['message']);}logger['error'](_0xf5c9('0x10'),_0x52c5d5,_0x4b30a0['error'][_0xf5c9('0x16')]);return _0x25e910(_0x4b30a0[_0xf5c9('0x14')][_0xf5c9('0x16')]);}else{logger[_0xf5c9('0xf')]('FaxQueue,\x20%s,\x20%s',_0x52c5d5,_0xf5c9('0x11'));_0x25e910(_0x4b30a0[_0xf5c9('0x17')][_0xf5c9('0x16')]);}})['catch'](function(_0x435c01){logger[_0xf5c9('0x14')]('FaxQueue,\x20%s,\x20%s',_0x52c5d5,_0x435c01);_0x1e2688(_0x435c01);});});}exports[_0xf5c9('0x18')]=function(_0x4329fb){var _0x2aec33=this;return new Promise(function(_0x508c89,_0x4c45c5){return db[_0xf5c9('0x19')][_0xf5c9('0x1a')]({'raw':_0x4329fb[_0xf5c9('0x1b')]?_0x4329fb[_0xf5c9('0x1b')][_0xf5c9('0x1c')]===undefined?!![]:![]:!![],'where':_0x4329fb[_0xf5c9('0x1b')]?_0x4329fb['options'][_0xf5c9('0x1d')]||null:null,'attributes':_0x4329fb[_0xf5c9('0x1b')]?_0x4329fb[_0xf5c9('0x1b')][_0xf5c9('0x1e')]||null:null,'limit':_0x4329fb[_0xf5c9('0x1b')]?_0x4329fb[_0xf5c9('0x1b')][_0xf5c9('0x1f')]||null:null,'include':_0x4329fb[_0xf5c9('0x1b')]?_0x4329fb['options'][_0xf5c9('0x20')]?_['map'](_0x4329fb[_0xf5c9('0x1b')]['include'],function(_0x53a440){return{'model':db[_0x53a440[_0xf5c9('0x21')]],'as':_0x53a440['as'],'attributes':_0x53a440['attributes'],'include':_0x53a440[_0xf5c9('0x20')]?_[_0xf5c9('0x22')](_0x53a440['include'],function(_0x21598e){return{'model':db[_0x21598e[_0xf5c9('0x21')]],'as':_0x21598e['as'],'attributes':_0x21598e[_0xf5c9('0x1e')],'include':_0x21598e['include']?_['map'](_0x21598e['include'],function(_0x314b7a){return{'model':db[_0x314b7a[_0xf5c9('0x21')]],'as':_0x314b7a['as'],'attributes':_0x314b7a[_0xf5c9('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x54dff6){logger[_0xf5c9('0xf')](_0xf5c9('0x18'),_0x4329fb);logger[_0xf5c9('0x12')]('GetFaxQueue',_0x4329fb,JSON[_0xf5c9('0x13')](_0x54dff6));_0x508c89(_0x54dff6);})[_0xf5c9('0x23')](function(_0x1d8e79){logger[_0xf5c9('0x14')]('GetFaxQueue',_0x1d8e79[_0xf5c9('0x16')],_0x4329fb);_0x4c45c5(_0x2aec33[_0xf5c9('0x14')](0x1f4,_0x1d8e79[_0xf5c9('0x16')]));});});};exports[_0xf5c9('0x24')]=function(_0x494017){var _0x5baa41=this;return new Promise(function(_0x1b072e,_0x499f6f){return db[_0xf5c9('0x19')][_0xf5c9('0x25')]({'raw':_0x494017['options']?_0x494017[_0xf5c9('0x1b')]['raw']===undefined?!![]:![]:!![],'where':_0x494017[_0xf5c9('0x1b')]?_0x494017[_0xf5c9('0x1b')][_0xf5c9('0x1d')]||null:null,'attributes':_0x494017['options']?_0x494017[_0xf5c9('0x1b')]['attributes']||null:null,'include':_0x494017[_0xf5c9('0x1b')]?_0x494017[_0xf5c9('0x1b')][_0xf5c9('0x20')]?_['map'](_0x494017[_0xf5c9('0x1b')]['include'],function(_0x1bb37c){return{'model':db[_0x1bb37c['model']],'as':_0x1bb37c['as'],'attributes':_0x1bb37c['attributes'],'include':_0x1bb37c[_0xf5c9('0x20')]?_[_0xf5c9('0x22')](_0x1bb37c['include'],function(_0x39f36c){return{'model':db[_0x39f36c[_0xf5c9('0x21')]],'as':_0x39f36c['as'],'attributes':_0x39f36c[_0xf5c9('0x1e')],'include':_0x39f36c['include']?_[_0xf5c9('0x22')](_0x39f36c['include'],function(_0x42cd1f){return{'model':db[_0x42cd1f[_0xf5c9('0x21')]],'as':_0x42cd1f['as'],'attributes':_0x42cd1f[_0xf5c9('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xf5c9('0xe')](function(_0x378977){logger[_0xf5c9('0xf')]('ShowFaxQueue',_0x494017);logger[_0xf5c9('0x12')](_0xf5c9('0x24'),_0x494017,JSON[_0xf5c9('0x13')](_0x378977));_0x1b072e(_0x378977);})[_0xf5c9('0x23')](function(_0x2eef98){logger['error'](_0xf5c9('0x24'),_0x2eef98[_0xf5c9('0x16')],_0x494017);_0x499f6f(_0x5baa41['error'](0x1f4,_0x2eef98[_0xf5c9('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueue/faxQueue.socket.js b/server/api/faxQueue/faxQueue.socket.js index f7ade06..6a2cab5 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 _0xcb2b=['remove','update','emit','removeListener','length','faxQueue:','./faxQueue.events','save'];(function(_0x577b05,_0x35ec50){var _0x56b309=function(_0x3b604d){while(--_0x3b604d){_0x577b05['push'](_0x577b05['shift']());}};_0x56b309(++_0x35ec50);}(_0xcb2b,0x156));var _0xbcb2=function(_0x1d00c7,_0x9b96b2){_0x1d00c7=_0x1d00c7-0x0;var _0x5b4f51=_0xcb2b[_0x1d00c7];return _0x5b4f51;};'use strict';var FaxQueueEvents=require(_0xbcb2('0x0'));var events=[_0xbcb2('0x1'),_0xbcb2('0x2'),_0xbcb2('0x3')];function createListener(_0xa73a54,_0x3d15d8){return function(_0x1682e1){_0x3d15d8[_0xbcb2('0x4')](_0xa73a54,_0x1682e1);};}function removeListener(_0x5f49b3,_0x54452d){return function(){FaxQueueEvents[_0xbcb2('0x5')](_0x5f49b3,_0x54452d);};}exports['register']=function(_0x15654f){for(var _0x413359=0x0,_0x21b271=events[_0xbcb2('0x6')];_0x413359<_0x21b271;_0x413359++){var _0x12a25c=events[_0x413359];var _0x40b729=createListener(_0xbcb2('0x7')+_0x12a25c,_0x15654f);FaxQueueEvents['on'](_0x12a25c,_0x40b729);}}; \ No newline at end of file +var _0xa5e4=['remove','update','emit','removeListener','register','faxQueue:','./faxQueue.events','save'];(function(_0x1ebed1,_0x24d4a3){var _0x1d591c=function(_0xb2a281){while(--_0xb2a281){_0x1ebed1['push'](_0x1ebed1['shift']());}};_0x1d591c(++_0x24d4a3);}(_0xa5e4,0xee));var _0x4a5e=function(_0x67a984,_0x1bb671){_0x67a984=_0x67a984-0x0;var _0x4d5865=_0xa5e4[_0x67a984];return _0x4d5865;};'use strict';var FaxQueueEvents=require(_0x4a5e('0x0'));var events=[_0x4a5e('0x1'),_0x4a5e('0x2'),_0x4a5e('0x3')];function createListener(_0x4de503,_0x53334d){return function(_0x4f85cc){_0x53334d[_0x4a5e('0x4')](_0x4de503,_0x4f85cc);};}function removeListener(_0x1fe34a,_0x268d28){return function(){FaxQueueEvents[_0x4a5e('0x5')](_0x1fe34a,_0x268d28);};}exports[_0x4a5e('0x6')]=function(_0x1f38d4){for(var _0x34f2c8=0x0,_0x578e6b=events['length'];_0x34f2c8<_0x578e6b;_0x34f2c8++){var _0x2230cc=events[_0x34f2c8];var _0x312d1a=createListener(_0x4a5e('0x7')+_0x2230cc,_0x1f38d4);FaxQueueEvents['on'](_0x2230cc,_0x312d1a);}}; \ No newline at end of file diff --git a/server/api/faxQueue/index.js b/server/api/faxQueue/index.js index 4033441..274c682 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 _0xf072=['util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','./faxQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/members','/:id/teams','getTeams','getAgents','create','post','addTeams','/:id/users','addAgents','update','delete','destroy','removeAgents','exports','multer'];(function(_0x3cc8cb,_0x31f8fe){var _0x427615=function(_0x4dda8e){while(--_0x4dda8e){_0x3cc8cb['push'](_0x3cc8cb['shift']());}};_0x427615(++_0x31f8fe);}(_0xf072,0x1cf));var _0x2f07=function(_0x16c5c6,_0x393e1b){_0x16c5c6=_0x16c5c6-0x0;var _0x5a2df2=_0xf072[_0x16c5c6];return _0x5a2df2;};'use strict';var multer=require(_0x2f07('0x0'));var util=require(_0x2f07('0x1'));var path=require(_0x2f07('0x2'));var timeout=require('connect-timeout');var express=require(_0x2f07('0x3'));var router=express['Router']();var fs_extra=require(_0x2f07('0x4'));var auth=require(_0x2f07('0x5'));var interaction=require(_0x2f07('0x6'));var config=require('../../config/environment');var controller=require(_0x2f07('0x7'));router[_0x2f07('0x8')]('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0xa')]);router[_0x2f07('0x8')](_0x2f07('0xb'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xc')]);router[_0x2f07('0x8')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller[_0x2f07('0xe')]);router[_0x2f07('0x8')](_0x2f07('0xf'),auth[_0x2f07('0x9')](),controller['getMembers']);router[_0x2f07('0x8')](_0x2f07('0x10'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x11')]);router['get']('/:id/users',auth[_0x2f07('0x9')](),controller[_0x2f07('0x12')]);router['post']('/',auth[_0x2f07('0x9')](),controller[_0x2f07('0x13')]);router[_0x2f07('0x14')]('/:id/teams',auth[_0x2f07('0x9')](),controller[_0x2f07('0x15')]);router[_0x2f07('0x14')](_0x2f07('0x16'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x17')]);router['put'](_0x2f07('0xd'),auth['isAuthenticated'](),controller[_0x2f07('0x18')]);router[_0x2f07('0x19')](_0x2f07('0xd'),auth[_0x2f07('0x9')](),controller[_0x2f07('0x1a')]);router[_0x2f07('0x19')](_0x2f07('0x10'),auth[_0x2f07('0x9')](),controller['removeTeams']);router[_0x2f07('0x19')]('/:id/users',auth[_0x2f07('0x9')](),controller[_0x2f07('0x1b')]);module[_0x2f07('0x1c')]=router; \ No newline at end of file +var _0xc1c6=['put','/:id','update','delete','destroy','removeTeams','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/describe','isAuthenticated','describe','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','addAgents'];(function(_0x6ea030,_0xd89423){var _0x1be2e8=function(_0x447290){while(--_0x447290){_0x6ea030['push'](_0x6ea030['shift']());}};_0x1be2e8(++_0xd89423);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x5cea77,_0x4ca951){_0x5cea77=_0x5cea77-0x0;var _0x35999a=_0xc1c6[_0x5cea77];return _0x35999a;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var fs_extra=require(_0x6c1c('0x4'));var auth=require(_0x6c1c('0x5'));var interaction=require(_0x6c1c('0x6'));var config=require('../../config/environment');var controller=require('./faxQueue.controller');router[_0x6c1c('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x8')]);router['get'](_0x6c1c('0x9'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x7')]('/:id',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xc')]);router['get'](_0x6c1c('0xd'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xe')]);router[_0x6c1c('0x7')]('/:id/teams',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xf')]);router[_0x6c1c('0x7')]('/:id/users',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x10')]);router[_0x6c1c('0x11')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x12')]);router['post'](_0x6c1c('0x13'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x14')]);router[_0x6c1c('0x11')](_0x6c1c('0x15'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x16')]);router[_0x6c1c('0x17')](_0x6c1c('0x18'),auth['isAuthenticated'](),controller[_0x6c1c('0x19')]);router[_0x6c1c('0x1a')]('/:id',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0x1b')]);router['delete'](_0x6c1c('0x13'),auth['isAuthenticated'](),controller[_0x6c1c('0x1c')]);router[_0x6c1c('0x1a')]('/:id/users',auth[_0x6c1c('0xa')](),controller['removeAgents']);module[_0x6c1c('0x1d')]=router; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.attributes.js b/server/api/faxQueueReport/faxQueueReport.attributes.js index f9b313a..4c3df90 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 _0x4371=['STRING','DATE','moment','sequelize'];(function(_0x50a51e,_0x56e813){var _0x8a736e=function(_0x2006a8){while(--_0x2006a8){_0x50a51e['push'](_0x50a51e['shift']());}};_0x8a736e(++_0x56e813);}(_0x4371,0x8a));var _0x1437=function(_0x393ebf,_0x449e5a){_0x393ebf=_0x393ebf-0x0;var _0x5808c2=_0x4371[_0x393ebf];return _0x5808c2;};'use strict';var moment=require(_0x1437('0x0'));var Sequelize=require(_0x1437('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0x1437('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x1437('0x2')]},'joinAt':{'type':Sequelize[_0x1437('0x3')]},'leaveAt':{'type':Sequelize[_0x1437('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xc6f8=['moment','sequelize','exports','STRING','DATE'];(function(_0x4b055c,_0x4b870b){var _0x4b62bb=function(_0x4884c2){while(--_0x4884c2){_0x4b055c['push'](_0x4b055c['shift']());}};_0x4b62bb(++_0x4b870b);}(_0xc6f8,0x87));var _0x8c6f=function(_0x568ed2,_0x5c104c){_0x568ed2=_0x568ed2-0x0;var _0x1a41c5=_0xc6f8[_0x568ed2];return _0x1a41c5;};'use strict';var moment=require(_0x8c6f('0x0'));var Sequelize=require(_0x8c6f('0x1'));module[_0x8c6f('0x2')]={'uniqueid':{'type':Sequelize[_0x8c6f('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0x8c6f('0x4')]},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8c6f('0x4')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x8c6f('0x3')]}}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.controller.js b/server/api/faxQueueReport/faxQueueReport.controller.js index 9361df0..cdf4dc0 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 _0xe205=['includeAll','findAll','rows','show','params','include','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','save','update','then','error','stack','name','send','index','FaxQueueReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0xe205,0xa7));var _0x5e20=function(_0x20c412,_0x767aa3){_0x20c412=_0x20c412-0x0;var _0x128aa0=_0xe205[_0x20c412];return _0x128aa0;};'use strict';var emlformat=require(_0x5e20('0x0'));var rimraf=require(_0x5e20('0x1'));var zipdir=require(_0x5e20('0x2'));var jsonpatch=require(_0x5e20('0x3'));var rp=require(_0x5e20('0x4'));var moment=require(_0x5e20('0x5'));var BPromise=require(_0x5e20('0x6'));var Mustache=require(_0x5e20('0x7'));var util=require(_0x5e20('0x8'));var path=require('path');var sox=require(_0x5e20('0x9'));var csv=require(_0x5e20('0xa'));var ejs=require(_0x5e20('0xb'));var fs=require('fs');var fs_extra=require(_0x5e20('0xc'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x5e20('0xd'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x5e20('0xa'));var querystring=require(_0x5e20('0xe'));var Papa=require('papaparse');var Redis=require(_0x5e20('0xf'));var authService=require(_0x5e20('0x10'));var qs=require(_0x5e20('0x11'));var as=require(_0x5e20('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x5e20('0x13'))(_0x5e20('0x14'));var utils=require(_0x5e20('0x15'));var config=require(_0x5e20('0x16'));var licenseUtil=require(_0x5e20('0x17'));var db=require(_0x5e20('0x18'))['db'];function respondWithStatusCode(_0x54deee,_0x19eacf){_0x19eacf=_0x19eacf||0xcc;return function(_0x29b7a2){if(_0x29b7a2){return _0x54deee[_0x5e20('0x19')](_0x19eacf);}return _0x54deee['status'](_0x19eacf)[_0x5e20('0x1a')]();};}function respondWithResult(_0x5d827e,_0x1f47f3){_0x1f47f3=_0x1f47f3||0xc8;return function(_0x5ba833){if(_0x5ba833){return _0x5d827e[_0x5e20('0x1b')](_0x1f47f3)[_0x5e20('0x1c')](_0x5ba833);}};}function respondWithFilteredResult(_0x275026,_0x148ada){return function(_0x294df8){if(_0x294df8){var _0x542b3c=typeof _0x148ada[_0x5e20('0x1d')]===_0x5e20('0x1e')&&typeof _0x148ada[_0x5e20('0x1f')]===_0x5e20('0x1e');var _0x2f194b=_0x294df8[_0x5e20('0x20')];var _0x1cc706=_0x542b3c?0x0:_0x148ada[_0x5e20('0x1d')];var _0x4d3e4a=_0x542b3c?_0x294df8[_0x5e20('0x20')]:_0x148ada[_0x5e20('0x1d')]+_0x148ada['limit'];var _0x295eb3;if(_0x4d3e4a>=_0x2f194b){_0x4d3e4a=_0x2f194b;_0x295eb3=0xc8;}else{_0x295eb3=0xce;}_0x275026[_0x5e20('0x1b')](_0x295eb3);return _0x275026[_0x5e20('0x21')](_0x5e20('0x22'),_0x1cc706+'-'+_0x4d3e4a+'/'+_0x2f194b)['json'](_0x294df8);}return null;};}function patchUpdates(_0x2954fc){return function(_0x50f222){try{jsonpatch['apply'](_0x50f222,_0x2954fc,!![]);}catch(_0x57c7c5){return BPromise['reject'](_0x57c7c5);}return _0x50f222[_0x5e20('0x23')]();};}function saveUpdates(_0x5cca90,_0x3d89e4){return function(_0x29b111){if(_0x29b111){return _0x29b111[_0x5e20('0x24')](_0x5cca90)[_0x5e20('0x25')](function(_0x3ef7fa){return _0x3ef7fa;});}return null;};}function removeEntity(_0x2d4614,_0x4c5732){return function(_0x15705f){if(_0x15705f){return _0x15705f['destroy']()['then'](function(){_0x2d4614[_0x5e20('0x1b')](0xcc)[_0x5e20('0x1a')]();});}};}function handleEntityNotFound(_0x2bae08,_0x1b01af){return function(_0xbf7a24){if(!_0xbf7a24){_0x2bae08[_0x5e20('0x19')](0x194);}return _0xbf7a24;};}function handleError(_0x2973b3,_0x5809fd){_0x5809fd=_0x5809fd||0x1f4;return function(_0x3bf4f4){logger[_0x5e20('0x26')](_0x3bf4f4[_0x5e20('0x27')]);if(_0x3bf4f4[_0x5e20('0x28')]){delete _0x3bf4f4['name'];}_0x2973b3[_0x5e20('0x1b')](_0x5809fd)[_0x5e20('0x29')](_0x3bf4f4);};}exports[_0x5e20('0x2a')]=function(_0x222e7a,_0xbed73a){var _0x19709b={},_0x5ec45b={},_0xbc2b0e={'count':0x0,'rows':[]};var _0x34a3d6=_['map'](db[_0x5e20('0x2b')][_0x5e20('0x2c')],function(_0x335f1e){return{'name':_0x335f1e[_0x5e20('0x2d')],'type':_0x335f1e[_0x5e20('0x2e')][_0x5e20('0x2f')]};});_0x5ec45b['model']=_[_0x5e20('0x30')](_0x34a3d6,_0x5e20('0x28'));_0x5ec45b[_0x5e20('0x31')]=_[_0x5e20('0x32')](_0x222e7a[_0x5e20('0x31')]);_0x5ec45b[_0x5e20('0x33')]=_[_0x5e20('0x34')](_0x5ec45b[_0x5e20('0x35')],_0x5ec45b[_0x5e20('0x31')]);_0x19709b[_0x5e20('0x36')]=_[_0x5e20('0x34')](_0x5ec45b['model'],qs[_0x5e20('0x37')](_0x222e7a[_0x5e20('0x31')][_0x5e20('0x37')]));_0x19709b['attributes']=_0x19709b[_0x5e20('0x36')][_0x5e20('0x38')]?_0x19709b[_0x5e20('0x36')]:_0x5ec45b[_0x5e20('0x35')];if(!_0x222e7a[_0x5e20('0x31')][_0x5e20('0x39')](_0x5e20('0x3a'))){_0x19709b[_0x5e20('0x1f')]=qs[_0x5e20('0x1f')](_0x222e7a[_0x5e20('0x31')][_0x5e20('0x1f')]);_0x19709b[_0x5e20('0x1d')]=qs[_0x5e20('0x1d')](_0x222e7a[_0x5e20('0x31')]['offset']);}_0x19709b[_0x5e20('0x3b')]=qs['sort'](_0x222e7a['query'][_0x5e20('0x3c')]);_0x19709b[_0x5e20('0x3d')]=qs['filters'](_[_0x5e20('0x3e')](_0x222e7a[_0x5e20('0x31')],_0x5ec45b['filters']),_0x34a3d6);if(_0x222e7a[_0x5e20('0x31')][_0x5e20('0x3f')]){_0x19709b[_0x5e20('0x3d')]=_[_0x5e20('0x40')](_0x19709b[_0x5e20('0x3d')],{'$or':_[_0x5e20('0x30')](_0x34a3d6,function(_0x94925e){if(_0x94925e[_0x5e20('0x2e')]!==_0x5e20('0x41')){var _0x20be56={};_0x20be56[_0x94925e[_0x5e20('0x28')]]={'$like':'%'+_0x222e7a[_0x5e20('0x31')][_0x5e20('0x3f')]+'%'};return _0x20be56;}})});}_0x19709b=_[_0x5e20('0x40')]({},_0x19709b,_0x222e7a[_0x5e20('0x42')]);var _0x3d618c={'where':_0x19709b[_0x5e20('0x3d')]};return db[_0x5e20('0x2b')]['count'](_0x3d618c)[_0x5e20('0x25')](function(_0x29215f){_0xbc2b0e[_0x5e20('0x20')]=_0x29215f;if(_0x222e7a[_0x5e20('0x31')][_0x5e20('0x43')]){_0x19709b['include']=[{'all':!![]}];}return db[_0x5e20('0x2b')][_0x5e20('0x44')](_0x19709b);})[_0x5e20('0x25')](function(_0x24c05f){_0xbc2b0e[_0x5e20('0x45')]=_0x24c05f;return _0xbc2b0e;})[_0x5e20('0x25')](respondWithFilteredResult(_0xbed73a,_0x19709b))['catch'](handleError(_0xbed73a,null));};exports[_0x5e20('0x46')]=function(_0xc24cce,_0xa52d83){var _0x5a21f0={'raw':!![],'where':{'id':_0xc24cce[_0x5e20('0x47')]['id']}},_0x2b031d={};_0x2b031d[_0x5e20('0x35')]=_[_0x5e20('0x32')](db[_0x5e20('0x2b')][_0x5e20('0x2c')]);_0x2b031d[_0x5e20('0x31')]=_[_0x5e20('0x32')](_0xc24cce['query']);_0x2b031d[_0x5e20('0x33')]=_[_0x5e20('0x34')](_0x2b031d[_0x5e20('0x35')],_0x2b031d['query']);_0x5a21f0[_0x5e20('0x36')]=_['intersection'](_0x2b031d[_0x5e20('0x35')],qs[_0x5e20('0x37')](_0xc24cce[_0x5e20('0x31')][_0x5e20('0x37')]));_0x5a21f0[_0x5e20('0x36')]=_0x5a21f0['attributes'][_0x5e20('0x38')]?_0x5a21f0['attributes']:_0x2b031d['model'];if(_0xc24cce[_0x5e20('0x31')][_0x5e20('0x43')]){_0x5a21f0[_0x5e20('0x48')]=[{'all':!![]}];}_0x5a21f0=_[_0x5e20('0x40')]({},_0x5a21f0,_0xc24cce[_0x5e20('0x42')]);return db[_0x5e20('0x2b')][_0x5e20('0x49')](_0x5a21f0)['then'](handleEntityNotFound(_0xa52d83,null))['then'](respondWithResult(_0xa52d83,null))[_0x5e20('0x4a')](handleError(_0xa52d83,null));};exports[_0x5e20('0x4b')]=function(_0x5e84bd,_0x22b84e){return db[_0x5e20('0x2b')][_0x5e20('0x4b')](_0x5e84bd[_0x5e20('0x4c')],{})[_0x5e20('0x25')](respondWithResult(_0x22b84e,0xc9))['catch'](handleError(_0x22b84e,null));};exports[_0x5e20('0x24')]=function(_0x245b52,_0x25491e){if(_0x245b52[_0x5e20('0x4c')]['id']){delete _0x245b52[_0x5e20('0x4c')]['id'];}return db[_0x5e20('0x2b')][_0x5e20('0x49')]({'where':{'id':_0x245b52[_0x5e20('0x47')]['id']}})['then'](handleEntityNotFound(_0x25491e,null))['then'](saveUpdates(_0x245b52['body'],null))[_0x5e20('0x25')](respondWithResult(_0x25491e,null))[_0x5e20('0x4a')](handleError(_0x25491e,null));};exports['destroy']=function(_0x4392ca,_0x4bfea7){return db[_0x5e20('0x2b')]['find']({'where':{'id':_0x4392ca[_0x5e20('0x47')]['id']}})['then'](handleEntityNotFound(_0x4bfea7,null))[_0x5e20('0x25')](removeEntity(_0x4bfea7,null))[_0x5e20('0x4a')](handleError(_0x4bfea7,null));};exports[_0x5e20('0x4d')]=function(_0x190e07,_0x2a64ba){return db[_0x5e20('0x2b')][_0x5e20('0x4d')]()[_0x5e20('0x25')](respondWithResult(_0x2a64ba,null))[_0x5e20('0x4a')](handleError(_0x2a64ba,null));}; \ No newline at end of file +var _0x8a9a=['model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','filters','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','end','sendStatus','stack','name','send','index','map','FaxQueueReport','rawAttributes','fieldName','type','key'];(function(_0xfec4f,_0x516119){var _0x4d8bad=function(_0x3d5eaa){while(--_0x3d5eaa){_0xfec4f['push'](_0xfec4f['shift']());}};_0x4d8bad(++_0x516119);}(_0x8a9a,0x193));var _0xa8a9=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x8a9a[_0x3511d3];return _0x5d6321;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xa8a9('0x0'));var jsonpatch=require(_0xa8a9('0x1'));var rp=require(_0xa8a9('0x2'));var moment=require('moment');var BPromise=require(_0xa8a9('0x3'));var Mustache=require(_0xa8a9('0x4'));var util=require('util');var path=require('path');var sox=require(_0xa8a9('0x5'));var csv=require(_0xa8a9('0x6'));var ejs=require(_0xa8a9('0x7'));var fs=require('fs');var fs_extra=require(_0xa8a9('0x8'));var _=require(_0xa8a9('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xa8a9('0xa'));var deskjs=require(_0xa8a9('0xb'));var toCsv=require(_0xa8a9('0x6'));var querystring=require(_0xa8a9('0xc'));var Papa=require(_0xa8a9('0xd'));var Redis=require(_0xa8a9('0xe'));var authService=require(_0xa8a9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0xa8a9('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa8a9('0x11'))('api');var utils=require(_0xa8a9('0x12'));var config=require(_0xa8a9('0x13'));var licenseUtil=require(_0xa8a9('0x14'));var db=require(_0xa8a9('0x15'))['db'];function respondWithStatusCode(_0x3e962a,_0x16d838){_0x16d838=_0x16d838||0xcc;return function(_0x53fbc5){if(_0x53fbc5){return _0x3e962a['sendStatus'](_0x16d838);}return _0x3e962a[_0xa8a9('0x16')](_0x16d838)['end']();};}function respondWithResult(_0x3bb559,_0x34bec9){_0x34bec9=_0x34bec9||0xc8;return function(_0x3a0e08){if(_0x3a0e08){return _0x3bb559[_0xa8a9('0x16')](_0x34bec9)[_0xa8a9('0x17')](_0x3a0e08);}};}function respondWithFilteredResult(_0x4c448c,_0x3593fa){return function(_0x5c2cde){if(_0x5c2cde){var _0x1c7d52=typeof _0x3593fa['offset']===_0xa8a9('0x18')&&typeof _0x3593fa[_0xa8a9('0x19')]==='undefined';var _0x25285c=_0x5c2cde['count'];var _0x2c4fe7=_0x1c7d52?0x0:_0x3593fa[_0xa8a9('0x1a')];var _0xce2084=_0x1c7d52?_0x5c2cde[_0xa8a9('0x1b')]:_0x3593fa['offset']+_0x3593fa['limit'];var _0x34b6d1;if(_0xce2084>=_0x25285c){_0xce2084=_0x25285c;_0x34b6d1=0xc8;}else{_0x34b6d1=0xce;}_0x4c448c['status'](_0x34b6d1);return _0x4c448c[_0xa8a9('0x1c')](_0xa8a9('0x1d'),_0x2c4fe7+'-'+_0xce2084+'/'+_0x25285c)[_0xa8a9('0x17')](_0x5c2cde);}return null;};}function patchUpdates(_0x39384c){return function(_0x126648){try{jsonpatch[_0xa8a9('0x1e')](_0x126648,_0x39384c,!![]);}catch(_0x20381c){return BPromise[_0xa8a9('0x1f')](_0x20381c);}return _0x126648[_0xa8a9('0x20')]();};}function saveUpdates(_0x390011,_0x1cc77a){return function(_0x2fd285){if(_0x2fd285){return _0x2fd285[_0xa8a9('0x21')](_0x390011)['then'](function(_0x481a29){return _0x481a29;});}return null;};}function removeEntity(_0x4343f4,_0xa4c41a){return function(_0x32e784){if(_0x32e784){return _0x32e784['destroy']()[_0xa8a9('0x22')](function(){_0x4343f4[_0xa8a9('0x16')](0xcc)[_0xa8a9('0x23')]();});}};}function handleEntityNotFound(_0x233fe1,_0x488791){return function(_0x20fb5a){if(!_0x20fb5a){_0x233fe1[_0xa8a9('0x24')](0x194);}return _0x20fb5a;};}function handleError(_0x2f7a56,_0x1aef34){_0x1aef34=_0x1aef34||0x1f4;return function(_0x5f0c62){logger['error'](_0x5f0c62[_0xa8a9('0x25')]);if(_0x5f0c62[_0xa8a9('0x26')]){delete _0x5f0c62[_0xa8a9('0x26')];}_0x2f7a56[_0xa8a9('0x16')](_0x1aef34)[_0xa8a9('0x27')](_0x5f0c62);};}exports[_0xa8a9('0x28')]=function(_0x2abeb7,_0x155527){var _0x4c87d4={},_0x45714a={},_0x444b7a={'count':0x0,'rows':[]};var _0x128727=_[_0xa8a9('0x29')](db[_0xa8a9('0x2a')][_0xa8a9('0x2b')],function(_0x405876){return{'name':_0x405876[_0xa8a9('0x2c')],'type':_0x405876[_0xa8a9('0x2d')][_0xa8a9('0x2e')]};});_0x45714a[_0xa8a9('0x2f')]=_[_0xa8a9('0x29')](_0x128727,_0xa8a9('0x26'));_0x45714a[_0xa8a9('0x30')]=_[_0xa8a9('0x31')](_0x2abeb7[_0xa8a9('0x30')]);_0x45714a['filters']=_[_0xa8a9('0x32')](_0x45714a[_0xa8a9('0x2f')],_0x45714a[_0xa8a9('0x30')]);_0x4c87d4[_0xa8a9('0x33')]=_['intersection'](_0x45714a[_0xa8a9('0x2f')],qs[_0xa8a9('0x34')](_0x2abeb7['query'][_0xa8a9('0x34')]));_0x4c87d4[_0xa8a9('0x33')]=_0x4c87d4[_0xa8a9('0x33')][_0xa8a9('0x35')]?_0x4c87d4[_0xa8a9('0x33')]:_0x45714a['model'];if(!_0x2abeb7[_0xa8a9('0x30')][_0xa8a9('0x36')](_0xa8a9('0x37'))){_0x4c87d4[_0xa8a9('0x19')]=qs[_0xa8a9('0x19')](_0x2abeb7[_0xa8a9('0x30')]['limit']);_0x4c87d4[_0xa8a9('0x1a')]=qs['offset'](_0x2abeb7['query']['offset']);}_0x4c87d4['order']=qs[_0xa8a9('0x38')](_0x2abeb7['query'][_0xa8a9('0x38')]);_0x4c87d4['where']=qs[_0xa8a9('0x39')](_[_0xa8a9('0x3a')](_0x2abeb7[_0xa8a9('0x30')],_0x45714a[_0xa8a9('0x39')]),_0x128727);if(_0x2abeb7[_0xa8a9('0x30')][_0xa8a9('0x3b')]){_0x4c87d4[_0xa8a9('0x3c')]=_[_0xa8a9('0x3d')](_0x4c87d4['where'],{'$or':_[_0xa8a9('0x29')](_0x128727,function(_0x6b69bc){if(_0x6b69bc[_0xa8a9('0x2d')]!==_0xa8a9('0x3e')){var _0x1a1aad={};_0x1a1aad[_0x6b69bc[_0xa8a9('0x26')]]={'$like':'%'+_0x2abeb7[_0xa8a9('0x30')][_0xa8a9('0x3b')]+'%'};return _0x1a1aad;}})});}_0x4c87d4=_[_0xa8a9('0x3d')]({},_0x4c87d4,_0x2abeb7[_0xa8a9('0x3f')]);var _0x3305ba={'where':_0x4c87d4[_0xa8a9('0x3c')]};return db[_0xa8a9('0x2a')][_0xa8a9('0x1b')](_0x3305ba)[_0xa8a9('0x22')](function(_0x4d1f6b){_0x444b7a[_0xa8a9('0x1b')]=_0x4d1f6b;if(_0x2abeb7['query'][_0xa8a9('0x40')]){_0x4c87d4[_0xa8a9('0x41')]=[{'all':!![]}];}return db[_0xa8a9('0x2a')][_0xa8a9('0x42')](_0x4c87d4);})[_0xa8a9('0x22')](function(_0x18eeea){_0x444b7a[_0xa8a9('0x43')]=_0x18eeea;return _0x444b7a;})[_0xa8a9('0x22')](respondWithFilteredResult(_0x155527,_0x4c87d4))[_0xa8a9('0x44')](handleError(_0x155527,null));};exports[_0xa8a9('0x45')]=function(_0x4b5513,_0xf1d7c6){var _0x12e535={'raw':!![],'where':{'id':_0x4b5513['params']['id']}},_0x49381e={};_0x49381e[_0xa8a9('0x2f')]=_['keys'](db[_0xa8a9('0x2a')][_0xa8a9('0x2b')]);_0x49381e[_0xa8a9('0x30')]=_['keys'](_0x4b5513[_0xa8a9('0x30')]);_0x49381e[_0xa8a9('0x39')]=_[_0xa8a9('0x32')](_0x49381e[_0xa8a9('0x2f')],_0x49381e[_0xa8a9('0x30')]);_0x12e535['attributes']=_[_0xa8a9('0x32')](_0x49381e[_0xa8a9('0x2f')],qs[_0xa8a9('0x34')](_0x4b5513[_0xa8a9('0x30')][_0xa8a9('0x34')]));_0x12e535[_0xa8a9('0x33')]=_0x12e535['attributes'][_0xa8a9('0x35')]?_0x12e535[_0xa8a9('0x33')]:_0x49381e['model'];if(_0x4b5513[_0xa8a9('0x30')][_0xa8a9('0x40')]){_0x12e535[_0xa8a9('0x41')]=[{'all':!![]}];}_0x12e535=_[_0xa8a9('0x3d')]({},_0x12e535,_0x4b5513[_0xa8a9('0x3f')]);return db[_0xa8a9('0x2a')][_0xa8a9('0x46')](_0x12e535)[_0xa8a9('0x22')](handleEntityNotFound(_0xf1d7c6,null))[_0xa8a9('0x22')](respondWithResult(_0xf1d7c6,null))[_0xa8a9('0x44')](handleError(_0xf1d7c6,null));};exports['create']=function(_0x3d079,_0x17e43c){return db[_0xa8a9('0x2a')][_0xa8a9('0x47')](_0x3d079[_0xa8a9('0x48')],{})[_0xa8a9('0x22')](respondWithResult(_0x17e43c,0xc9))[_0xa8a9('0x44')](handleError(_0x17e43c,null));};exports[_0xa8a9('0x21')]=function(_0x280fa0,_0x43e080){if(_0x280fa0['body']['id']){delete _0x280fa0['body']['id'];}return db[_0xa8a9('0x2a')][_0xa8a9('0x46')]({'where':{'id':_0x280fa0[_0xa8a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x43e080,null))[_0xa8a9('0x22')](saveUpdates(_0x280fa0['body'],null))[_0xa8a9('0x22')](respondWithResult(_0x43e080,null))[_0xa8a9('0x44')](handleError(_0x43e080,null));};exports['destroy']=function(_0x773790,_0x506e40){return db[_0xa8a9('0x2a')][_0xa8a9('0x46')]({'where':{'id':_0x773790[_0xa8a9('0x49')]['id']}})['then'](handleEntityNotFound(_0x506e40,null))['then'](removeEntity(_0x506e40,null))[_0xa8a9('0x44')](handleError(_0x506e40,null));};exports[_0xa8a9('0x4a')]=function(_0x12432d,_0xa2f468){return db[_0xa8a9('0x2a')][_0xa8a9('0x4a')]()[_0xa8a9('0x22')](respondWithResult(_0xa2f468,null))['catch'](handleError(_0xa2f468,null));}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.model.js b/server/api/faxQueueReport/faxQueueReport.model.js index 1088853..df17d00 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 _0x53ec=['path','../../config/environment','./faxQueueReport.attributes','define','FaxQueueReport','uniqueid','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x199a85,_0x3b0872){var _0x5c56e3=function(_0xb067ce){while(--_0xb067ce){_0x199a85['push'](_0x199a85['shift']());}};_0x5c56e3(++_0x3b0872);}(_0x53ec,0x192));var _0xc53e=function(_0x3e25ba,_0x4d5399){_0x3e25ba=_0x3e25ba-0x0;var _0x393fb8=_0x53ec[_0x3e25ba];return _0x393fb8;};'use strict';var _=require(_0xc53e('0x0'));var util=require(_0xc53e('0x1'));var logger=require(_0xc53e('0x2'))(_0xc53e('0x3'));var moment=require(_0xc53e('0x4'));var BPromise=require(_0xc53e('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc53e('0x6'));var rimraf=require('rimraf');var config=require(_0xc53e('0x7'));var attributes=require(_0xc53e('0x8'));module['exports']=function(_0x2f1414,_0x4f989b){return _0x2f1414[_0xc53e('0x9')](_0xc53e('0xa'),attributes,{'tableName':'report_fax_queue','paranoid':![],'indexes':[{'name':_0xc53e('0xb'),'fields':[_0xc53e('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4975=['path','rimraf','../../config/environment','./faxQueueReport.attributes','exports','FaxQueueReport','report_fax_queue','uniqueid','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x509b04,_0x242a80){var _0x292cd5=function(_0x91d7eb){while(--_0x91d7eb){_0x509b04['push'](_0x509b04['shift']());}};_0x292cd5(++_0x242a80);}(_0x4975,0x86));var _0x5497=function(_0x17bafd,_0x4c93ff){_0x17bafd=_0x17bafd-0x0;var _0x30c36c=_0x4975[_0x17bafd];return _0x30c36c;};'use strict';var _=require(_0x5497('0x0'));var util=require('util');var logger=require(_0x5497('0x1'))(_0x5497('0x2'));var moment=require(_0x5497('0x3'));var BPromise=require(_0x5497('0x4'));var rp=require(_0x5497('0x5'));var fs=require('fs');var path=require(_0x5497('0x6'));var rimraf=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var attributes=require(_0x5497('0x9'));module[_0x5497('0xa')]=function(_0x539a27,_0x37e48d){return _0x539a27['define'](_0x5497('0xb'),attributes,{'tableName':_0x5497('0xc'),'paranoid':![],'indexes':[{'name':_0x5497('0xd'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/faxQueueReport.rpc.js b/server/api/faxQueueReport/faxQueueReport.rpc.js index f90f971..e18cc75 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 _0x3184=['limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','CreateFaxQueueReport','create','body','options','raw','UpdateFaxQueueReport','update','where','attributes'];(function(_0x283432,_0x389be1){var _0x51bd72=function(_0x224364){while(--_0x224364){_0x283432['push'](_0x283432['shift']());}};_0x51bd72(++_0x389be1);}(_0x3184,0xcd));var _0x4318=function(_0x46aa6f,_0xf7b072){_0x46aa6f=_0x46aa6f-0x0;var _0x44759c=_0x3184[_0x46aa6f];return _0x44759c;};'use strict';var _=require(_0x4318('0x0'));var util=require(_0x4318('0x1'));var moment=require('moment');var BPromise=require(_0x4318('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4318('0x3'));var db=require(_0x4318('0x4'))['db'];var utils=require(_0x4318('0x5'));var logger=require(_0x4318('0x6'))(_0x4318('0x7'));var config=require(_0x4318('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4318('0x9')][_0x4318('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4fd766,_0x2479dd,_0x13f2c0){return new BPromise(function(_0x3188f5,_0x5dc7d8){return client[_0x4318('0xb')](_0x4fd766,_0x13f2c0)[_0x4318('0xc')](function(_0x559b81){logger[_0x4318('0xd')](_0x4318('0xe'),_0x2479dd,_0x4318('0xf'));logger[_0x4318('0x10')](_0x4318('0x11'),_0x2479dd,_0x4318('0xf'),JSON[_0x4318('0x12')](_0x559b81));if(_0x559b81[_0x4318('0x13')]){if(_0x559b81[_0x4318('0x13')][_0x4318('0x14')]===0x1f4){logger[_0x4318('0x13')](_0x4318('0xe'),_0x2479dd,_0x559b81[_0x4318('0x13')]['message']);return _0x5dc7d8(_0x559b81[_0x4318('0x13')][_0x4318('0x15')]);}logger[_0x4318('0x13')](_0x4318('0xe'),_0x2479dd,_0x559b81[_0x4318('0x13')][_0x4318('0x15')]);return _0x3188f5(_0x559b81[_0x4318('0x13')][_0x4318('0x15')]);}else{logger['info']('FaxQueueReport,\x20%s,\x20%s',_0x2479dd,_0x4318('0xf'));_0x3188f5(_0x559b81[_0x4318('0x16')][_0x4318('0x15')]);}})[_0x4318('0x17')](function(_0x5cab50){logger[_0x4318('0x13')](_0x4318('0xe'),_0x2479dd,_0x5cab50);_0x5dc7d8(_0x5cab50);});});}exports[_0x4318('0x18')]=function(_0x3079d1){var _0x369ea1=this;return new Promise(function(_0x1ebcee,_0x276565){return db['FaxQueueReport'][_0x4318('0x19')](_0x3079d1[_0x4318('0x1a')],{'raw':_0x3079d1[_0x4318('0x1b')]?_0x3079d1[_0x4318('0x1b')][_0x4318('0x1c')]===undefined?!![]:![]:!![]})[_0x4318('0xc')](function(_0x1795df){logger[_0x4318('0xd')](_0x4318('0x18'),_0x3079d1);logger[_0x4318('0x10')]('CreateFaxQueueReport',_0x3079d1,JSON[_0x4318('0x12')](_0x1795df));_0x1ebcee(_0x1795df);})['catch'](function(_0x53413c){logger[_0x4318('0x13')](_0x4318('0x18'),_0x53413c[_0x4318('0x15')],_0x3079d1);_0x276565(_0x369ea1['error'](0x1f4,_0x53413c['message']));});});};exports[_0x4318('0x1d')]=function(_0x1115bc){var _0x48c6a6=this;return new Promise(function(_0x226275,_0x5e070e){return db['FaxQueueReport'][_0x4318('0x1e')](_0x1115bc[_0x4318('0x1a')],{'raw':_0x1115bc[_0x4318('0x1b')]?_0x1115bc[_0x4318('0x1b')][_0x4318('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1115bc['options']?_0x1115bc['options'][_0x4318('0x1f')]||null:null,'attributes':_0x1115bc['options']?_0x1115bc['options'][_0x4318('0x20')]||null:null,'limit':_0x1115bc[_0x4318('0x1b')]?_0x1115bc[_0x4318('0x1b')][_0x4318('0x21')]||null:null})[_0x4318('0xc')](function(_0x4ed1d6){logger[_0x4318('0xd')](_0x4318('0x1d'),_0x1115bc);logger[_0x4318('0x10')]('UpdateFaxQueueReport',_0x1115bc,JSON[_0x4318('0x12')](_0x4ed1d6));_0x226275(_0x4ed1d6);})[_0x4318('0x17')](function(_0x649ecc){logger[_0x4318('0x13')]('UpdateFaxQueueReport',_0x649ecc['message'],_0x1115bc);_0x5e070e(_0x48c6a6[_0x4318('0x13')](0x1f4,_0x649ecc['message']));});});}; \ No newline at end of file +var _0x29e4=['raw','stringify','UpdateFaxQueueReport','body','where','attributes','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','FaxQueueReport,\x20%s,\x20%s','request\x20sent','debug','FaxQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','CreateFaxQueueReport','options'];(function(_0x47d402,_0x3fdff4){var _0x1f480f=function(_0x545e06){while(--_0x545e06){_0x47d402['push'](_0x47d402['shift']());}};_0x1f480f(++_0x3fdff4);}(_0x29e4,0x10e));var _0x429e=function(_0x3b5f12,_0x39e09c){_0x3b5f12=_0x3b5f12-0x0;var _0x2e5214=_0x29e4[_0x3b5f12];return _0x2e5214;};'use strict';var _=require(_0x429e('0x0'));var util=require(_0x429e('0x1'));var moment=require(_0x429e('0x2'));var BPromise=require(_0x429e('0x3'));var rs=require(_0x429e('0x4'));var fs=require('fs');var Redis=require(_0x429e('0x5'));var db=require(_0x429e('0x6'))['db'];var utils=require(_0x429e('0x7'));var logger=require(_0x429e('0x8'))('rpc');var config=require(_0x429e('0x9'));var jayson=require(_0x429e('0xa'));var client=jayson[_0x429e('0xb')][_0x429e('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x12d410,_0xf00aa4,_0x48aa74){return new BPromise(function(_0x3dd0a1,_0x421c8d){return client[_0x429e('0xd')](_0x12d410,_0x48aa74)[_0x429e('0xe')](function(_0x124896){logger[_0x429e('0xf')](_0x429e('0x10'),_0xf00aa4,_0x429e('0x11'));logger[_0x429e('0x12')](_0x429e('0x13'),_0xf00aa4,_0x429e('0x11'),JSON['stringify'](_0x124896));if(_0x124896['error']){if(_0x124896[_0x429e('0x14')][_0x429e('0x15')]===0x1f4){logger['error']('FaxQueueReport,\x20%s,\x20%s',_0xf00aa4,_0x124896[_0x429e('0x14')][_0x429e('0x16')]);return _0x421c8d(_0x124896[_0x429e('0x14')][_0x429e('0x16')]);}logger['error'](_0x429e('0x10'),_0xf00aa4,_0x124896['error'][_0x429e('0x16')]);return _0x3dd0a1(_0x124896[_0x429e('0x14')][_0x429e('0x16')]);}else{logger[_0x429e('0xf')](_0x429e('0x10'),_0xf00aa4,'request\x20sent');_0x3dd0a1(_0x124896[_0x429e('0x17')][_0x429e('0x16')]);}})[_0x429e('0x18')](function(_0x58e3b2){logger[_0x429e('0x14')](_0x429e('0x10'),_0xf00aa4,_0x58e3b2);_0x421c8d(_0x58e3b2);});});}exports[_0x429e('0x19')]=function(_0x4f65fa){var _0x830b92=this;return new Promise(function(_0x20b0f4,_0x5bf9fa){return db['FaxQueueReport']['create'](_0x4f65fa['body'],{'raw':_0x4f65fa[_0x429e('0x1a')]?_0x4f65fa[_0x429e('0x1a')][_0x429e('0x1b')]===undefined?!![]:![]:!![]})[_0x429e('0xe')](function(_0xa127d0){logger[_0x429e('0xf')]('CreateFaxQueueReport',_0x4f65fa);logger['debug'](_0x429e('0x19'),_0x4f65fa,JSON[_0x429e('0x1c')](_0xa127d0));_0x20b0f4(_0xa127d0);})[_0x429e('0x18')](function(_0x47a4a9){logger[_0x429e('0x14')](_0x429e('0x19'),_0x47a4a9['message'],_0x4f65fa);_0x5bf9fa(_0x830b92['error'](0x1f4,_0x47a4a9[_0x429e('0x16')]));});});};exports[_0x429e('0x1d')]=function(_0x58c7d6){var _0x10ebb8=this;return new Promise(function(_0x3a6c3c,_0x47de61){return db['FaxQueueReport']['update'](_0x58c7d6[_0x429e('0x1e')],{'raw':_0x58c7d6[_0x429e('0x1a')]?_0x58c7d6[_0x429e('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x58c7d6[_0x429e('0x1a')]?_0x58c7d6[_0x429e('0x1a')][_0x429e('0x1f')]||null:null,'attributes':_0x58c7d6[_0x429e('0x1a')]?_0x58c7d6[_0x429e('0x1a')][_0x429e('0x20')]||null:null,'limit':_0x58c7d6[_0x429e('0x1a')]?_0x58c7d6[_0x429e('0x1a')]['limit']||null:null})[_0x429e('0xe')](function(_0x11d004){logger[_0x429e('0xf')](_0x429e('0x1d'),_0x58c7d6);logger[_0x429e('0x12')](_0x429e('0x1d'),_0x58c7d6,JSON[_0x429e('0x1c')](_0x11d004));_0x3a6c3c(_0x11d004);})[_0x429e('0x18')](function(_0x1bd2db){logger[_0x429e('0x14')](_0x429e('0x1d'),_0x1bd2db[_0x429e('0x16')],_0x58c7d6);_0x47de61(_0x10ebb8[_0x429e('0x14')](0x1f4,_0x1bd2db[_0x429e('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/faxQueueReport/index.js b/server/api/faxQueueReport/index.js index 9e9d20e..7dbaa55 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 _0x96a1=['./faxQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x96a1,0x19d));var _0x196a=function(_0x55fa03,_0xcb96c2){_0x55fa03=_0x55fa03-0x0;var _0x2cd7cd=_0x96a1[_0x55fa03];return _0x2cd7cd;};'use strict';var multer=require(_0x196a('0x0'));var util=require(_0x196a('0x1'));var path=require(_0x196a('0x2'));var timeout=require(_0x196a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x196a('0x4'));var interaction=require(_0x196a('0x5'));var config=require(_0x196a('0x6'));var controller=require(_0x196a('0x7'));router['get']('/',auth[_0x196a('0x8')](),controller[_0x196a('0x9')]);router[_0x196a('0xa')](_0x196a('0xb'),auth['isAuthenticated'](),controller[_0x196a('0xc')]);router[_0x196a('0xa')](_0x196a('0xd'),auth['isAuthenticated'](),controller[_0x196a('0xe')]);router[_0x196a('0xf')]('/',auth[_0x196a('0x8')](),controller[_0x196a('0x10')]);router[_0x196a('0x11')]('/:id',auth[_0x196a('0x8')](),controller[_0x196a('0x12')]);router[_0x196a('0x13')](_0x196a('0xd'),auth[_0x196a('0x8')](),controller[_0x196a('0x14')]);module['exports']=router; \ No newline at end of file +var _0xe9af=['../../config/environment','./faxQueueReport.controller','get','/describe','describe','/:id','show','post','isAuthenticated','create','put','update','delete','destroy','exports','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x133a2e,_0x23b31a){var _0x2bd1ad=function(_0x15bde9){while(--_0x15bde9){_0x133a2e['push'](_0x133a2e['shift']());}};_0x2bd1ad(++_0x23b31a);}(_0xe9af,0x174));var _0xfe9a=function(_0x563a35,_0x11a0ab){_0x563a35=_0x563a35-0x0;var _0xe1d983=_0xe9af[_0x563a35];return _0xe1d983;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xfe9a('0x0'));var timeout=require('connect-timeout');var express=require(_0xfe9a('0x1'));var router=express[_0xfe9a('0x2')]();var fs_extra=require(_0xfe9a('0x3'));var auth=require(_0xfe9a('0x4'));var interaction=require(_0xfe9a('0x5'));var config=require(_0xfe9a('0x6'));var controller=require(_0xfe9a('0x7'));router[_0xfe9a('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0xfe9a('0x8')](_0xfe9a('0x9'),auth['isAuthenticated'](),controller[_0xfe9a('0xa')]);router[_0xfe9a('0x8')](_0xfe9a('0xb'),auth['isAuthenticated'](),controller[_0xfe9a('0xc')]);router[_0xfe9a('0xd')]('/',auth[_0xfe9a('0xe')](),controller[_0xfe9a('0xf')]);router[_0xfe9a('0x10')](_0xfe9a('0xb'),auth['isAuthenticated'](),controller[_0xfe9a('0x11')]);router[_0xfe9a('0x12')](_0xfe9a('0xb'),auth[_0xfe9a('0xe')](),controller[_0xfe9a('0x13')]);module[_0xfe9a('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 36f285c..7e99e3c 100644 --- a/server/api/faxTransferReport/faxTransferReport.attributes.js +++ b/server/api/faxTransferReport/faxTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x449a04,_0x12029a){var _0xf16c60=function(_0x339e28){while(--_0x339e28){_0x449a04['push'](_0x449a04['shift']());}};_0xf16c60(++_0x12029a);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x1e381c,_0x47b5b9){_0x1e381c=_0x1e381c-0x0;var _0x9b5ea9=_0xf3cd[_0x1e381c];return _0x9b5ea9;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file +var _0xf3cd=['exports','STRING','ENUM','account','queue','DATE','moment','sequelize'];(function(_0x4cd5a2,_0x265b2f){var _0x5702b2=function(_0x5a27e9){while(--_0x5a27e9){_0x4cd5a2['push'](_0x4cd5a2['shift']());}};_0x5702b2(++_0x265b2f);}(_0xf3cd,0xfe));var _0xdf3c=function(_0xadde88,_0x58ad47){_0xadde88=_0xadde88-0x0;var _0x3b8eb6=_0xf3cd[_0xadde88];return _0x3b8eb6;};'use strict';var moment=require(_0xdf3c('0x0'));var Sequelize=require(_0xdf3c('0x1'));module[_0xdf3c('0x2')]={'uniqueid':{'type':Sequelize[_0xdf3c('0x3')],'allowNull':![]},'type':{'type':Sequelize[_0xdf3c('0x4')](_0xdf3c('0x5'),'agent',_0xdf3c('0x6')),'allowNull':![],'defaultValue':_0xdf3c('0x6')},'transferredAt':{'type':Sequelize[_0xdf3c('0x7')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.controller.js b/server/api/faxTransferReport/faxTransferReport.controller.js index 661fb03..53d4972 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 _0x77c8=['apply','reject','save','update','then','destroy','stack','name','send','index','map','FaxTransferReport','fieldName','key','model','query','filters','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','intersection','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range'];(function(_0x51e564,_0x3918c7){var _0x11eaf2=function(_0x4a4d73){while(--_0x4a4d73){_0x51e564['push'](_0x51e564['shift']());}};_0x11eaf2(++_0x3918c7);}(_0x77c8,0x151));var _0x877c=function(_0xd578cb,_0x2167a3){_0xd578cb=_0xd578cb-0x0;var _0x775533=_0x77c8[_0xd578cb];return _0x775533;};'use strict';var emlformat=require(_0x877c('0x0'));var rimraf=require(_0x877c('0x1'));var zipdir=require(_0x877c('0x2'));var jsonpatch=require(_0x877c('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x877c('0x4'));var util=require('util');var path=require('path');var sox=require(_0x877c('0x5'));var csv=require(_0x877c('0x6'));var ejs=require(_0x877c('0x7'));var fs=require('fs');var fs_extra=require(_0x877c('0x8'));var _=require('lodash');var squel=require(_0x877c('0x9'));var crypto=require(_0x877c('0xa'));var jsforce=require(_0x877c('0xb'));var deskjs=require(_0x877c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x877c('0xd'));var Papa=require(_0x877c('0xe'));var Redis=require(_0x877c('0xf'));var authService=require(_0x877c('0x10'));var qs=require(_0x877c('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x877c('0x12'))(_0x877c('0x13'));var utils=require(_0x877c('0x14'));var config=require(_0x877c('0x15'));var licenseUtil=require(_0x877c('0x16'));var db=require(_0x877c('0x17'))['db'];function respondWithStatusCode(_0x500a1d,_0x50bb08){_0x50bb08=_0x50bb08||0xcc;return function(_0x16eb1e){if(_0x16eb1e){return _0x500a1d[_0x877c('0x18')](_0x50bb08);}return _0x500a1d[_0x877c('0x19')](_0x50bb08)['end']();};}function respondWithResult(_0x2ffbd9,_0x18f913){_0x18f913=_0x18f913||0xc8;return function(_0xaada0c){if(_0xaada0c){return _0x2ffbd9[_0x877c('0x19')](_0x18f913)[_0x877c('0x1a')](_0xaada0c);}};}function respondWithFilteredResult(_0x38a552,_0x3236d9){return function(_0x55415d){if(_0x55415d){var _0x286384=typeof _0x3236d9[_0x877c('0x1b')]==='undefined'&&typeof _0x3236d9[_0x877c('0x1c')]===_0x877c('0x1d');var _0x39ee28=_0x55415d[_0x877c('0x1e')];var _0x2fff23=_0x286384?0x0:_0x3236d9['offset'];var _0xa942c8=_0x286384?_0x55415d[_0x877c('0x1e')]:_0x3236d9['offset']+_0x3236d9[_0x877c('0x1c')];var _0x4d6bad;if(_0xa942c8>=_0x39ee28){_0xa942c8=_0x39ee28;_0x4d6bad=0xc8;}else{_0x4d6bad=0xce;}_0x38a552[_0x877c('0x19')](_0x4d6bad);return _0x38a552[_0x877c('0x1f')](_0x877c('0x20'),_0x2fff23+'-'+_0xa942c8+'/'+_0x39ee28)[_0x877c('0x1a')](_0x55415d);}return null;};}function patchUpdates(_0x4c23ab){return function(_0x535401){try{jsonpatch[_0x877c('0x21')](_0x535401,_0x4c23ab,!![]);}catch(_0x4c9ce6){return BPromise[_0x877c('0x22')](_0x4c9ce6);}return _0x535401[_0x877c('0x23')]();};}function saveUpdates(_0x1a673a,_0x206d28){return function(_0xee01fb){if(_0xee01fb){return _0xee01fb[_0x877c('0x24')](_0x1a673a)[_0x877c('0x25')](function(_0x52c14c){return _0x52c14c;});}return null;};}function removeEntity(_0xa202f,_0x387ed0){return function(_0x49c097){if(_0x49c097){return _0x49c097[_0x877c('0x26')]()['then'](function(){_0xa202f[_0x877c('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x54c916,_0x2ec97f){return function(_0x5e1a0c){if(!_0x5e1a0c){_0x54c916[_0x877c('0x18')](0x194);}return _0x5e1a0c;};}function handleError(_0x3c3c62,_0xf7458e){_0xf7458e=_0xf7458e||0x1f4;return function(_0xac3945){logger['error'](_0xac3945[_0x877c('0x27')]);if(_0xac3945[_0x877c('0x28')]){delete _0xac3945[_0x877c('0x28')];}_0x3c3c62[_0x877c('0x19')](_0xf7458e)[_0x877c('0x29')](_0xac3945);};}exports[_0x877c('0x2a')]=function(_0x3dfb82,_0x3749ce){var _0x13e1c2={},_0x5ac9e2={},_0x53819c={'count':0x0,'rows':[]};var _0x39b2e0=_[_0x877c('0x2b')](db[_0x877c('0x2c')]['rawAttributes'],function(_0x36f96c){return{'name':_0x36f96c[_0x877c('0x2d')],'type':_0x36f96c['type'][_0x877c('0x2e')]};});_0x5ac9e2[_0x877c('0x2f')]=_[_0x877c('0x2b')](_0x39b2e0,_0x877c('0x28'));_0x5ac9e2[_0x877c('0x30')]=_['keys'](_0x3dfb82['query']);_0x5ac9e2[_0x877c('0x31')]=_['intersection'](_0x5ac9e2['model'],_0x5ac9e2[_0x877c('0x30')]);_0x13e1c2[_0x877c('0x32')]=_['intersection'](_0x5ac9e2[_0x877c('0x2f')],qs[_0x877c('0x33')](_0x3dfb82[_0x877c('0x30')][_0x877c('0x33')]));_0x13e1c2[_0x877c('0x32')]=_0x13e1c2[_0x877c('0x32')][_0x877c('0x34')]?_0x13e1c2['attributes']:_0x5ac9e2['model'];if(!_0x3dfb82[_0x877c('0x30')][_0x877c('0x35')](_0x877c('0x36'))){_0x13e1c2[_0x877c('0x1c')]=qs[_0x877c('0x1c')](_0x3dfb82[_0x877c('0x30')][_0x877c('0x1c')]);_0x13e1c2[_0x877c('0x1b')]=qs[_0x877c('0x1b')](_0x3dfb82[_0x877c('0x30')][_0x877c('0x1b')]);}_0x13e1c2[_0x877c('0x37')]=qs[_0x877c('0x38')](_0x3dfb82['query'][_0x877c('0x38')]);_0x13e1c2[_0x877c('0x39')]=qs[_0x877c('0x31')](_['pick'](_0x3dfb82[_0x877c('0x30')],_0x5ac9e2['filters']),_0x39b2e0);if(_0x3dfb82[_0x877c('0x30')][_0x877c('0x3a')]){_0x13e1c2[_0x877c('0x39')]=_[_0x877c('0x3b')](_0x13e1c2['where'],{'$or':_[_0x877c('0x2b')](_0x39b2e0,function(_0x1fee1d){if(_0x1fee1d['type']!=='VIRTUAL'){var _0x4069cd={};_0x4069cd[_0x1fee1d[_0x877c('0x28')]]={'$like':'%'+_0x3dfb82[_0x877c('0x30')][_0x877c('0x3a')]+'%'};return _0x4069cd;}})});}_0x13e1c2=_['merge']({},_0x13e1c2,_0x3dfb82[_0x877c('0x3c')]);var _0x4d5d53={'where':_0x13e1c2['where']};return db[_0x877c('0x2c')][_0x877c('0x1e')](_0x4d5d53)[_0x877c('0x25')](function(_0x284c7f){_0x53819c[_0x877c('0x1e')]=_0x284c7f;if(_0x3dfb82[_0x877c('0x30')][_0x877c('0x3d')]){_0x13e1c2[_0x877c('0x3e')]=[{'all':!![]}];}return db[_0x877c('0x2c')]['findAll'](_0x13e1c2);})[_0x877c('0x25')](function(_0x2d27f3){_0x53819c[_0x877c('0x3f')]=_0x2d27f3;return _0x53819c;})['then'](respondWithFilteredResult(_0x3749ce,_0x13e1c2))[_0x877c('0x40')](handleError(_0x3749ce,null));};exports[_0x877c('0x41')]=function(_0x44dc94,_0x30c58a){var _0x480f29={'raw':!![],'where':{'id':_0x44dc94[_0x877c('0x42')]['id']}},_0x5221df={};_0x5221df[_0x877c('0x2f')]=_[_0x877c('0x43')](db[_0x877c('0x2c')][_0x877c('0x44')]);_0x5221df['query']=_[_0x877c('0x43')](_0x44dc94[_0x877c('0x30')]);_0x5221df[_0x877c('0x31')]=_[_0x877c('0x45')](_0x5221df[_0x877c('0x2f')],_0x5221df[_0x877c('0x30')]);_0x480f29[_0x877c('0x32')]=_[_0x877c('0x45')](_0x5221df[_0x877c('0x2f')],qs[_0x877c('0x33')](_0x44dc94[_0x877c('0x30')]['fields']));_0x480f29[_0x877c('0x32')]=_0x480f29[_0x877c('0x32')][_0x877c('0x34')]?_0x480f29['attributes']:_0x5221df[_0x877c('0x2f')];if(_0x44dc94[_0x877c('0x30')]['includeAll']){_0x480f29['include']=[{'all':!![]}];}_0x480f29=_[_0x877c('0x3b')]({},_0x480f29,_0x44dc94[_0x877c('0x3c')]);return db[_0x877c('0x2c')][_0x877c('0x46')](_0x480f29)[_0x877c('0x25')](handleEntityNotFound(_0x30c58a,null))[_0x877c('0x25')](respondWithResult(_0x30c58a,null))[_0x877c('0x40')](handleError(_0x30c58a,null));};exports['create']=function(_0x55d982,_0x3f5fb4){return db[_0x877c('0x2c')][_0x877c('0x47')](_0x55d982[_0x877c('0x48')],{})[_0x877c('0x25')](respondWithResult(_0x3f5fb4,0xc9))[_0x877c('0x40')](handleError(_0x3f5fb4,null));};exports[_0x877c('0x24')]=function(_0x5d646c,_0x55427e){if(_0x5d646c[_0x877c('0x48')]['id']){delete _0x5d646c[_0x877c('0x48')]['id'];}return db[_0x877c('0x2c')][_0x877c('0x46')]({'where':{'id':_0x5d646c['params']['id']}})['then'](handleEntityNotFound(_0x55427e,null))[_0x877c('0x25')](saveUpdates(_0x5d646c[_0x877c('0x48')],null))['then'](respondWithResult(_0x55427e,null))[_0x877c('0x40')](handleError(_0x55427e,null));};exports[_0x877c('0x26')]=function(_0x906d8e,_0x38e103){return db[_0x877c('0x2c')][_0x877c('0x46')]({'where':{'id':_0x906d8e[_0x877c('0x42')]['id']}})['then'](handleEntityNotFound(_0x38e103,null))['then'](removeEntity(_0x38e103,null))['catch'](handleError(_0x38e103,null));};exports[_0x877c('0x49')]=function(_0x548d23,_0x24f007){return db[_0x877c('0x2c')][_0x877c('0x49')]()[_0x877c('0x25')](respondWithResult(_0x24f007,null))[_0x877c('0x40')](handleError(_0x24f007,null));}; \ No newline at end of file +var _0x49f7=['Content-Range','apply','save','update','destroy','then','end','error','stack','name','FaxTransferReport','rawAttributes','fieldName','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','length','options','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','mustache','ejs','fs-extra','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','undefined','count','offset','set'];(function(_0x1eba2c,_0x31e5bf){var _0x531700=function(_0x434f03){while(--_0x434f03){_0x1eba2c['push'](_0x1eba2c['shift']());}};_0x531700(++_0x31e5bf);}(_0x49f7,0x1e3));var _0x749f=function(_0xfb9d53,_0xbb1e4c){_0xfb9d53=_0xfb9d53-0x0;var _0x239b56=_0x49f7[_0xfb9d53];return _0x239b56;};'use strict';var emlformat=require(_0x749f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x749f('0x1'));var jsonpatch=require(_0x749f('0x2'));var rp=require(_0x749f('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x749f('0x4'));var util=require('util');var path=require('path');var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x749f('0x5'));var fs=require('fs');var fs_extra=require(_0x749f('0x6'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x749f('0x7'));var jsforce=require(_0x749f('0x8'));var deskjs=require('desk.js');var toCsv=require(_0x749f('0x9'));var querystring=require(_0x749f('0xa'));var Papa=require(_0x749f('0xb'));var Redis=require(_0x749f('0xc'));var authService=require(_0x749f('0xd'));var qs=require(_0x749f('0xe'));var as=require(_0x749f('0xf'));var hardwareService=require(_0x749f('0x10'));var logger=require(_0x749f('0x11'))(_0x749f('0x12'));var utils=require(_0x749f('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0x749f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xd1b492,_0x5a57cd){_0x5a57cd=_0x5a57cd||0xcc;return function(_0x20e4e){if(_0x20e4e){return _0xd1b492[_0x749f('0x15')](_0x5a57cd);}return _0xd1b492[_0x749f('0x16')](_0x5a57cd)['end']();};}function respondWithResult(_0x4a30bf,_0x305742){_0x305742=_0x305742||0xc8;return function(_0x217a30){if(_0x217a30){return _0x4a30bf['status'](_0x305742)[_0x749f('0x17')](_0x217a30);}};}function respondWithFilteredResult(_0x78449b,_0xc7753b){return function(_0x1d2c7b){if(_0x1d2c7b){var _0x30cc5c=typeof _0xc7753b['offset']===_0x749f('0x18')&&typeof _0xc7753b['limit']==='undefined';var _0x174bfb=_0x1d2c7b[_0x749f('0x19')];var _0x349386=_0x30cc5c?0x0:_0xc7753b[_0x749f('0x1a')];var _0x1c0ba2=_0x30cc5c?_0x1d2c7b['count']:_0xc7753b['offset']+_0xc7753b['limit'];var _0x327941;if(_0x1c0ba2>=_0x174bfb){_0x1c0ba2=_0x174bfb;_0x327941=0xc8;}else{_0x327941=0xce;}_0x78449b[_0x749f('0x16')](_0x327941);return _0x78449b[_0x749f('0x1b')](_0x749f('0x1c'),_0x349386+'-'+_0x1c0ba2+'/'+_0x174bfb)[_0x749f('0x17')](_0x1d2c7b);}return null;};}function patchUpdates(_0x1f1dc9){return function(_0x1f11cc){try{jsonpatch[_0x749f('0x1d')](_0x1f11cc,_0x1f1dc9,!![]);}catch(_0x4b9699){return BPromise['reject'](_0x4b9699);}return _0x1f11cc[_0x749f('0x1e')]();};}function saveUpdates(_0x3799e5,_0x382963){return function(_0x166ba0){if(_0x166ba0){return _0x166ba0[_0x749f('0x1f')](_0x3799e5)['then'](function(_0x8ae963){return _0x8ae963;});}return null;};}function removeEntity(_0x593008,_0x49f467){return function(_0x8ee3f8){if(_0x8ee3f8){return _0x8ee3f8[_0x749f('0x20')]()[_0x749f('0x21')](function(){_0x593008['status'](0xcc)[_0x749f('0x22')]();});}};}function handleEntityNotFound(_0x2e0a95,_0x25111c){return function(_0x4ab81d){if(!_0x4ab81d){_0x2e0a95[_0x749f('0x15')](0x194);}return _0x4ab81d;};}function handleError(_0x22815c,_0x519299){_0x519299=_0x519299||0x1f4;return function(_0x3dde1a){logger[_0x749f('0x23')](_0x3dde1a[_0x749f('0x24')]);if(_0x3dde1a[_0x749f('0x25')]){delete _0x3dde1a[_0x749f('0x25')];}_0x22815c[_0x749f('0x16')](_0x519299)['send'](_0x3dde1a);};}exports['index']=function(_0x4baba8,_0x5edd82){var _0x59cd38={},_0x216810={},_0x218375={'count':0x0,'rows':[]};var _0x26d2ef=_['map'](db[_0x749f('0x26')][_0x749f('0x27')],function(_0x3c927c){return{'name':_0x3c927c[_0x749f('0x28')],'type':_0x3c927c[_0x749f('0x29')][_0x749f('0x2a')]};});_0x216810['model']=_[_0x749f('0x2b')](_0x26d2ef,_0x749f('0x25'));_0x216810[_0x749f('0x2c')]=_[_0x749f('0x2d')](_0x4baba8[_0x749f('0x2c')]);_0x216810[_0x749f('0x2e')]=_[_0x749f('0x2f')](_0x216810[_0x749f('0x30')],_0x216810[_0x749f('0x2c')]);_0x59cd38[_0x749f('0x31')]=_[_0x749f('0x2f')](_0x216810[_0x749f('0x30')],qs[_0x749f('0x32')](_0x4baba8[_0x749f('0x2c')][_0x749f('0x32')]));_0x59cd38[_0x749f('0x31')]=_0x59cd38[_0x749f('0x31')]['length']?_0x59cd38['attributes']:_0x216810[_0x749f('0x30')];if(!_0x4baba8[_0x749f('0x2c')][_0x749f('0x33')](_0x749f('0x34'))){_0x59cd38[_0x749f('0x35')]=qs[_0x749f('0x35')](_0x4baba8['query']['limit']);_0x59cd38[_0x749f('0x1a')]=qs['offset'](_0x4baba8[_0x749f('0x2c')][_0x749f('0x1a')]);}_0x59cd38[_0x749f('0x36')]=qs['sort'](_0x4baba8[_0x749f('0x2c')][_0x749f('0x37')]);_0x59cd38[_0x749f('0x38')]=qs[_0x749f('0x2e')](_[_0x749f('0x39')](_0x4baba8[_0x749f('0x2c')],_0x216810[_0x749f('0x2e')]),_0x26d2ef);if(_0x4baba8[_0x749f('0x2c')][_0x749f('0x3a')]){_0x59cd38[_0x749f('0x38')]=_[_0x749f('0x3b')](_0x59cd38[_0x749f('0x38')],{'$or':_[_0x749f('0x2b')](_0x26d2ef,function(_0xa4a4e1){if(_0xa4a4e1['type']!==_0x749f('0x3c')){var _0x26fec9={};_0x26fec9[_0xa4a4e1[_0x749f('0x25')]]={'$like':'%'+_0x4baba8[_0x749f('0x2c')][_0x749f('0x3a')]+'%'};return _0x26fec9;}})});}_0x59cd38=_['merge']({},_0x59cd38,_0x4baba8['options']);var _0x24817b={'where':_0x59cd38[_0x749f('0x38')]};return db[_0x749f('0x26')][_0x749f('0x19')](_0x24817b)[_0x749f('0x21')](function(_0x362e04){_0x218375['count']=_0x362e04;if(_0x4baba8[_0x749f('0x2c')][_0x749f('0x3d')]){_0x59cd38[_0x749f('0x3e')]=[{'all':!![]}];}return db[_0x749f('0x26')][_0x749f('0x3f')](_0x59cd38);})[_0x749f('0x21')](function(_0x30e8e1){_0x218375[_0x749f('0x40')]=_0x30e8e1;return _0x218375;})[_0x749f('0x21')](respondWithFilteredResult(_0x5edd82,_0x59cd38))[_0x749f('0x41')](handleError(_0x5edd82,null));};exports['show']=function(_0x40ee76,_0x194f0f){var _0x2e9c02={'raw':!![],'where':{'id':_0x40ee76['params']['id']}},_0x28e8ae={};_0x28e8ae[_0x749f('0x30')]=_['keys'](db[_0x749f('0x26')][_0x749f('0x27')]);_0x28e8ae[_0x749f('0x2c')]=_[_0x749f('0x2d')](_0x40ee76['query']);_0x28e8ae[_0x749f('0x2e')]=_[_0x749f('0x2f')](_0x28e8ae[_0x749f('0x30')],_0x28e8ae[_0x749f('0x2c')]);_0x2e9c02['attributes']=_['intersection'](_0x28e8ae[_0x749f('0x30')],qs[_0x749f('0x32')](_0x40ee76['query'][_0x749f('0x32')]));_0x2e9c02[_0x749f('0x31')]=_0x2e9c02[_0x749f('0x31')][_0x749f('0x42')]?_0x2e9c02['attributes']:_0x28e8ae[_0x749f('0x30')];if(_0x40ee76[_0x749f('0x2c')][_0x749f('0x3d')]){_0x2e9c02[_0x749f('0x3e')]=[{'all':!![]}];}_0x2e9c02=_[_0x749f('0x3b')]({},_0x2e9c02,_0x40ee76[_0x749f('0x43')]);return db['FaxTransferReport'][_0x749f('0x44')](_0x2e9c02)[_0x749f('0x21')](handleEntityNotFound(_0x194f0f,null))[_0x749f('0x21')](respondWithResult(_0x194f0f,null))[_0x749f('0x41')](handleError(_0x194f0f,null));};exports[_0x749f('0x45')]=function(_0x47cc80,_0x36add5){return db[_0x749f('0x26')][_0x749f('0x45')](_0x47cc80['body'],{})[_0x749f('0x21')](respondWithResult(_0x36add5,0xc9))['catch'](handleError(_0x36add5,null));};exports[_0x749f('0x1f')]=function(_0x382952,_0x3e2e1c){if(_0x382952[_0x749f('0x46')]['id']){delete _0x382952[_0x749f('0x46')]['id'];}return db[_0x749f('0x26')][_0x749f('0x44')]({'where':{'id':_0x382952[_0x749f('0x47')]['id']}})[_0x749f('0x21')](handleEntityNotFound(_0x3e2e1c,null))[_0x749f('0x21')](saveUpdates(_0x382952['body'],null))['then'](respondWithResult(_0x3e2e1c,null))['catch'](handleError(_0x3e2e1c,null));};exports[_0x749f('0x20')]=function(_0x42a8b3,_0x4f22e1){return db['FaxTransferReport'][_0x749f('0x44')]({'where':{'id':_0x42a8b3[_0x749f('0x47')]['id']}})[_0x749f('0x21')](handleEntityNotFound(_0x4f22e1,null))[_0x749f('0x21')](removeEntity(_0x4f22e1,null))[_0x749f('0x41')](handleError(_0x4f22e1,null));};exports[_0x749f('0x48')]=function(_0x5c3932,_0x130c7d){return db[_0x749f('0x26')][_0x749f('0x48')]()['then'](respondWithResult(_0x130c7d,null))['catch'](handleError(_0x130c7d,null));}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.model.js b/server/api/faxTransferReport/faxTransferReport.model.js index 94b769e..47cc9b7 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 _0x5464=['uniqueid','lodash','util','../../config/logger','moment','request-promise','rimraf','../../config/environment','./faxTransferReport.attributes','exports','FaxTransferReport','report_fax_transfer'];(function(_0x2f3ffc,_0x56925b){var _0x5a1863=function(_0x1c2a3b){while(--_0x1c2a3b){_0x2f3ffc['push'](_0x2f3ffc['shift']());}};_0x5a1863(++_0x56925b);}(_0x5464,0x15d));var _0x4546=function(_0x5391cf,_0xf64664){_0x5391cf=_0x5391cf-0x0;var _0x4ea076=_0x5464[_0x5391cf];return _0x4ea076;};'use strict';var _=require(_0x4546('0x0'));var util=require(_0x4546('0x1'));var logger=require(_0x4546('0x2'))('api');var moment=require(_0x4546('0x3'));var BPromise=require('bluebird');var rp=require(_0x4546('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4546('0x5'));var config=require(_0x4546('0x6'));var attributes=require(_0x4546('0x7'));module[_0x4546('0x8')]=function(_0x54228a,_0x57391f){return _0x54228a['define'](_0x4546('0x9'),attributes,{'tableName':_0x4546('0xa'),'paranoid':![],'indexes':[{'name':_0x4546('0xb'),'fields':[_0x4546('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9d57=['FaxTransferReport','uniqueid','util','../../config/logger','api','bluebird','path','./faxTransferReport.attributes','exports','define'];(function(_0x14a269,_0x476c8b){var _0x87dfad=function(_0x2a3c57){while(--_0x2a3c57){_0x14a269['push'](_0x14a269['shift']());}};_0x87dfad(++_0x476c8b);}(_0x9d57,0xd4));var _0x79d5=function(_0x4b5b9c,_0x210108){_0x4b5b9c=_0x4b5b9c-0x0;var _0x1fccb2=_0x9d57[_0x4b5b9c];return _0x1fccb2;};'use strict';var _=require('lodash');var util=require(_0x79d5('0x0'));var logger=require(_0x79d5('0x1'))(_0x79d5('0x2'));var moment=require('moment');var BPromise=require(_0x79d5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x79d5('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x79d5('0x5'));module[_0x79d5('0x6')]=function(_0x3a432c,_0x314139){return _0x3a432c[_0x79d5('0x7')](_0x79d5('0x8'),attributes,{'tableName':'report_fax_transfer','paranoid':![],'indexes':[{'name':_0x79d5('0x9'),'fields':[_0x79d5('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/faxTransferReport/faxTransferReport.rpc.js b/server/api/faxTransferReport/faxTransferReport.rpc.js index 36befba..77f9869 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 _0xed58=['stringify','error','message','request\x20sent','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','info','FaxTransferReport,\x20%s,\x20%s','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x657a6f,_0xc458b4){var _0x259338=function(_0x88180d){while(--_0x88180d){_0x657a6f['push'](_0x657a6f['shift']());}};_0x259338(++_0xc458b4);}(_0xed58,0x1e9));var _0x8ed5=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xed58[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x8ed5('0x0'));var util=require(_0x8ed5('0x1'));var moment=require(_0x8ed5('0x2'));var BPromise=require(_0x8ed5('0x3'));var rs=require(_0x8ed5('0x4'));var fs=require('fs');var Redis=require(_0x8ed5('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x8ed5('0x6'));var logger=require(_0x8ed5('0x7'))(_0x8ed5('0x8'));var config=require(_0x8ed5('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8ed5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x11db5e,_0x9b505e,_0x832b72){return new BPromise(function(_0x3341fa,_0x284f46){return client[_0x8ed5('0xb')](_0x11db5e,_0x832b72)[_0x8ed5('0xc')](function(_0x59a367){logger[_0x8ed5('0xd')](_0x8ed5('0xe'),_0x9b505e,'request\x20sent');logger[_0x8ed5('0xf')](_0x8ed5('0x10'),_0x9b505e,'request\x20sent',JSON[_0x8ed5('0x11')](_0x59a367));if(_0x59a367['error']){if(_0x59a367[_0x8ed5('0x12')]['code']===0x1f4){logger[_0x8ed5('0x12')](_0x8ed5('0xe'),_0x9b505e,_0x59a367['error'][_0x8ed5('0x13')]);return _0x284f46(_0x59a367['error'][_0x8ed5('0x13')]);}logger['error'](_0x8ed5('0xe'),_0x9b505e,_0x59a367[_0x8ed5('0x12')][_0x8ed5('0x13')]);return _0x3341fa(_0x59a367['error'][_0x8ed5('0x13')]);}else{logger[_0x8ed5('0xd')](_0x8ed5('0xe'),_0x9b505e,_0x8ed5('0x14'));_0x3341fa(_0x59a367[_0x8ed5('0x15')]['message']);}})[_0x8ed5('0x16')](function(_0x35533c){logger[_0x8ed5('0x12')]('FaxTransferReport,\x20%s,\x20%s',_0x9b505e,_0x35533c);_0x284f46(_0x35533c);});});} \ No newline at end of file +var _0x6b5e=['request\x20sent','debug','FaxTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','FaxTransferReport,\x20%s,\x20%s'];(function(_0x552276,_0x221c70){var _0x5df031=function(_0x58a252){while(--_0x58a252){_0x552276['push'](_0x552276['shift']());}};_0x5df031(++_0x221c70);}(_0x6b5e,0xd7));var _0xe6b5=function(_0x2e7e7e,_0x394c4e){_0x2e7e7e=_0x2e7e7e-0x0;var _0x1a43ee=_0x6b5e[_0x2e7e7e];return _0x1a43ee;};'use strict';var _=require(_0xe6b5('0x0'));var util=require(_0xe6b5('0x1'));var moment=require(_0xe6b5('0x2'));var BPromise=require('bluebird');var rs=require(_0xe6b5('0x3'));var fs=require('fs');var Redis=require(_0xe6b5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xe6b5('0x5'));var logger=require(_0xe6b5('0x6'))(_0xe6b5('0x7'));var config=require(_0xe6b5('0x8'));var jayson=require(_0xe6b5('0x9'));var client=jayson[_0xe6b5('0xa')][_0xe6b5('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xd59f91,_0x196b1b,_0x4b2ca0){return new BPromise(function(_0xf8d6a7,_0x5613c4){return client[_0xe6b5('0xc')](_0xd59f91,_0x4b2ca0)[_0xe6b5('0xd')](function(_0x1fa0e0){logger['info'](_0xe6b5('0xe'),_0x196b1b,_0xe6b5('0xf'));logger[_0xe6b5('0x10')](_0xe6b5('0x11'),_0x196b1b,_0xe6b5('0xf'),JSON[_0xe6b5('0x12')](_0x1fa0e0));if(_0x1fa0e0[_0xe6b5('0x13')]){if(_0x1fa0e0['error'][_0xe6b5('0x14')]===0x1f4){logger[_0xe6b5('0x13')](_0xe6b5('0xe'),_0x196b1b,_0x1fa0e0[_0xe6b5('0x13')]['message']);return _0x5613c4(_0x1fa0e0[_0xe6b5('0x13')][_0xe6b5('0x15')]);}logger[_0xe6b5('0x13')](_0xe6b5('0xe'),_0x196b1b,_0x1fa0e0[_0xe6b5('0x13')][_0xe6b5('0x15')]);return _0xf8d6a7(_0x1fa0e0[_0xe6b5('0x13')][_0xe6b5('0x15')]);}else{logger['info'](_0xe6b5('0xe'),_0x196b1b,'request\x20sent');_0xf8d6a7(_0x1fa0e0[_0xe6b5('0x16')][_0xe6b5('0x15')]);}})['catch'](function(_0x32c6fa){logger[_0xe6b5('0x13')](_0xe6b5('0xe'),_0x196b1b,_0x32c6fa);_0x5613c4(_0x32c6fa);});});} \ No newline at end of file diff --git a/server/api/faxTransferReport/index.js b/server/api/faxTransferReport/index.js index 61ba621..f5cfaf8 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 _0x8f6b=['/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','Router','../../components/auth/service','../../config/environment','./faxTransferReport.controller','index','/describe','isAuthenticated','describe','get'];(function(_0x1f0b29,_0x443d90){var _0x1ce5de=function(_0x28d26e){while(--_0x28d26e){_0x1f0b29['push'](_0x1f0b29['shift']());}};_0x1ce5de(++_0x443d90);}(_0x8f6b,0x1ad));var _0xb8f6=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x8f6b[_0xae7c2f];return _0x5d7001;};'use strict';var multer=require(_0xb8f6('0x0'));var util=require(_0xb8f6('0x1'));var path=require(_0xb8f6('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0xb8f6('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb8f6('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xb8f6('0x5'));var controller=require(_0xb8f6('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0xb8f6('0x7')]);router['get'](_0xb8f6('0x8'),auth[_0xb8f6('0x9')](),controller[_0xb8f6('0xa')]);router[_0xb8f6('0xb')](_0xb8f6('0xc'),auth['isAuthenticated'](),controller[_0xb8f6('0xd')]);router[_0xb8f6('0xe')]('/',auth[_0xb8f6('0x9')](),controller[_0xb8f6('0xf')]);router[_0xb8f6('0x10')](_0xb8f6('0xc'),auth['isAuthenticated'](),controller[_0xb8f6('0x11')]);router[_0xb8f6('0x12')](_0xb8f6('0xc'),auth['isAuthenticated'](),controller[_0xb8f6('0x13')]);module[_0xb8f6('0x14')]=router; \ No newline at end of file +var _0xa71d=['./faxTransferReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../config/environment'];(function(_0x4d5450,_0x5568c7){var _0x1640fe=function(_0x1fe835){while(--_0x1fe835){_0x4d5450['push'](_0x4d5450['shift']());}};_0x1640fe(++_0x5568c7);}(_0xa71d,0xb6));var _0xda71=function(_0x166d93,_0x301f09){_0x166d93=_0x166d93-0x0;var _0xba708=_0xa71d[_0x166d93];return _0xba708;};'use strict';var multer=require(_0xda71('0x0'));var util=require(_0xda71('0x1'));var path=require(_0xda71('0x2'));var timeout=require(_0xda71('0x3'));var express=require(_0xda71('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xda71('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xda71('0x6'));var controller=require(_0xda71('0x7'));router[_0xda71('0x8')]('/',auth[_0xda71('0x9')](),controller['index']);router[_0xda71('0x8')](_0xda71('0xa'),auth[_0xda71('0x9')](),controller[_0xda71('0xb')]);router[_0xda71('0x8')](_0xda71('0xc'),auth[_0xda71('0x9')](),controller[_0xda71('0xd')]);router[_0xda71('0xe')]('/',auth[_0xda71('0x9')](),controller[_0xda71('0xf')]);router[_0xda71('0x10')]('/:id',auth[_0xda71('0x9')](),controller[_0xda71('0x11')]);router[_0xda71('0x12')](_0xda71('0xc'),auth[_0xda71('0x9')](),controller[_0xda71('0x13')]);module[_0xda71('0x14')]=router; \ No newline at end of file diff --git a/server/api/intDeskAccount/index.js b/server/api/intDeskAccount/index.js index 7375e6d..aa5012d 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 _0xd893=['show','/:id/configurations','/:id/fields','isAuthenticated','post','create','addConfiguration','put','update','delete','destroy','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','index','/:id'];(function(_0x2e2681,_0x4089c1){var _0x368a64=function(_0x267262){while(--_0x267262){_0x2e2681['push'](_0x2e2681['shift']());}};_0x368a64(++_0x4089c1);}(_0xd893,0x90));var _0x3d89=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xd893[_0x1facfa];return _0x9ec701;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x3d89('0x0'));var express=require(_0x3d89('0x1'));var router=express[_0x3d89('0x2')]();var fs_extra=require(_0x3d89('0x3'));var auth=require(_0x3d89('0x4'));var interaction=require(_0x3d89('0x5'));var config=require(_0x3d89('0x6'));var controller=require('./intDeskAccount.controller');router[_0x3d89('0x7')]('/',auth['isAuthenticated'](),controller[_0x3d89('0x8')]);router[_0x3d89('0x7')](_0x3d89('0x9'),auth['isAuthenticated'](),controller[_0x3d89('0xa')]);router[_0x3d89('0x7')](_0x3d89('0xb'),auth['isAuthenticated'](),controller['getConfigurations']);router['get'](_0x3d89('0xc'),auth[_0x3d89('0xd')](),controller['getFields']);router[_0x3d89('0xe')]('/',auth[_0x3d89('0xd')](),controller[_0x3d89('0xf')]);router[_0x3d89('0xe')](_0x3d89('0xb'),auth['isAuthenticated'](),controller[_0x3d89('0x10')]);router[_0x3d89('0x11')](_0x3d89('0x9'),auth[_0x3d89('0xd')](),controller[_0x3d89('0x12')]);router[_0x3d89('0x13')](_0x3d89('0x9'),auth[_0x3d89('0xd')](),controller[_0x3d89('0x14')]);module[_0x3d89('0x15')]=router; \ No newline at end of file +var _0xbc9c=['multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','/:id/fields','post','create','put','delete','destroy'];(function(_0x124ba9,_0x54b22d){var _0x4b9cfd=function(_0x5aac11){while(--_0x5aac11){_0x124ba9['push'](_0x124ba9['shift']());}};_0x4b9cfd(++_0x54b22d);}(_0xbc9c,0x84));var _0xcbc9=function(_0xc29031,_0x3a870f){_0xc29031=_0xc29031-0x0;var _0x38589a=_0xbc9c[_0xc29031];return _0x38589a;};'use strict';var multer=require(_0xcbc9('0x0'));var util=require(_0xcbc9('0x1'));var path=require(_0xcbc9('0x2'));var timeout=require(_0xcbc9('0x3'));var express=require(_0xcbc9('0x4'));var router=express['Router']();var fs_extra=require(_0xcbc9('0x5'));var auth=require(_0xcbc9('0x6'));var interaction=require(_0xcbc9('0x7'));var config=require(_0xcbc9('0x8'));var controller=require('./intDeskAccount.controller');router['get']('/',auth[_0xcbc9('0x9')](),controller[_0xcbc9('0xa')]);router[_0xcbc9('0xb')](_0xcbc9('0xc'),auth[_0xcbc9('0x9')](),controller[_0xcbc9('0xd')]);router[_0xcbc9('0xb')](_0xcbc9('0xe'),auth[_0xcbc9('0x9')](),controller[_0xcbc9('0xf')]);router['get'](_0xcbc9('0x10'),auth[_0xcbc9('0x9')](),controller['getFields']);router[_0xcbc9('0x11')]('/',auth['isAuthenticated'](),controller[_0xcbc9('0x12')]);router[_0xcbc9('0x11')](_0xcbc9('0xe'),auth[_0xcbc9('0x9')](),controller['addConfiguration']);router[_0xcbc9('0x13')]('/:id',auth[_0xcbc9('0x9')](),controller['update']);router[_0xcbc9('0x14')]('/:id',auth[_0xcbc9('0x9')](),controller[_0xcbc9('0x15')]);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 49f943f..86535d4 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 _0xd3d0=['STRING','ENUM','basic','integrationTab','exports'];(function(_0x5948a7,_0x944950){var _0x4926e6=function(_0x42c767){while(--_0x42c767){_0x5948a7['push'](_0x5948a7['shift']());}};_0x4926e6(++_0x944950);}(_0xd3d0,0x90));var _0x0d3d=function(_0x34957b,_0xf64702){_0x34957b=_0x34957b-0x0;var _0x323101=_0xd3d0[_0x34957b];return _0x323101;};'use strict';var Sequelize=require('sequelize');module[_0x0d3d('0x0')]={'name':{'type':Sequelize[_0x0d3d('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0d3d('0x1')]},'authType':{'type':Sequelize[_0x0d3d('0x2')](_0x0d3d('0x3')),'defaultValue':_0x0d3d('0x3')},'password':{'type':Sequelize[_0x0d3d('0x1')]},'consumerKey':{'type':Sequelize[_0x0d3d('0x1')]},'consumerSecret':{'type':Sequelize[_0x0d3d('0x1')]},'token':{'type':Sequelize[_0x0d3d('0x1')]},'tokenSecret':{'type':Sequelize[_0x0d3d('0x1')]},'serverUrl':{'type':Sequelize[_0x0d3d('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x0d3d('0x2')](_0x0d3d('0x4'),'newTab'),'defaultValue':_0x0d3d('0x4')}}; \ No newline at end of file +var _0x12f7=['newTab','sequelize','STRING','ENUM','basic'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x12f7,0x150));var _0x712f=function(_0x22de61,_0x5dd105){_0x22de61=_0x22de61-0x0;var _0x143728=_0x12f7[_0x22de61];return _0x143728;};'use strict';var Sequelize=require(_0x712f('0x0'));module['exports']={'name':{'type':Sequelize[_0x712f('0x1')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x712f('0x1')]},'authType':{'type':Sequelize[_0x712f('0x2')](_0x712f('0x3')),'defaultValue':_0x712f('0x3')},'password':{'type':Sequelize[_0x712f('0x1')]},'consumerKey':{'type':Sequelize['STRING']},'consumerSecret':{'type':Sequelize[_0x712f('0x1')]},'token':{'type':Sequelize['STRING']},'tokenSecret':{'type':Sequelize[_0x712f('0x1')]},'serverUrl':{'type':Sequelize[_0x712f('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0x712f('0x2')]('integrationTab',_0x712f('0x4')),'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 d289f7d..94c244b 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 _0x7178=['%s/custom_fields','application/json','basic','headers','Authorization','username','toString','base64','concat','entries','active','test','statusCode','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','error','stack','name','send','map','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','DeskAccount','then','includeAll','include','findAll','rows','catch','show','params','create','body','find','DeskConfiguration','length','getConfigurations','findOne','AccountId','getSubjects','channel','getDescriptions','DeskField','Subjects','Descriptions','getFields','priority','remoteUri','password','consumerSecret','token','tokenSecret','GET','format'];(function(_0x43681e,_0x1caa7b){var _0xa2284b=function(_0x3a250e){while(--_0x3a250e){_0x43681e['push'](_0x43681e['shift']());}};_0xa2284b(++_0x1caa7b);}(_0x7178,0x1d6));var _0x8717=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x7178[_0x321bb2];return _0x9c12ed;};'use strict';var emlformat=require(_0x8717('0x0'));var rimraf=require(_0x8717('0x1'));var zipdir=require(_0x8717('0x2'));var jsonpatch=require(_0x8717('0x3'));var rp=require(_0x8717('0x4'));var moment=require(_0x8717('0x5'));var BPromise=require(_0x8717('0x6'));var Mustache=require('mustache');var util=require(_0x8717('0x7'));var path=require(_0x8717('0x8'));var sox=require(_0x8717('0x9'));var csv=require(_0x8717('0xa'));var ejs=require(_0x8717('0xb'));var fs=require('fs');var fs_extra=require(_0x8717('0xc'));var _=require('lodash');var squel=require(_0x8717('0xd'));var crypto=require(_0x8717('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x8717('0xf'));var toCsv=require('to-csv');var querystring=require(_0x8717('0x10'));var Papa=require('papaparse');var Redis=require(_0x8717('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x8717('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8717('0x13'));var logger=require(_0x8717('0x14'))(_0x8717('0x15'));var utils=require(_0x8717('0x16'));var config=require(_0x8717('0x17'));var licenseUtil=require(_0x8717('0x18'));var db=require(_0x8717('0x19'))['db'];var integrations=require(_0x8717('0x1a'));function respondWithStatusCode(_0x3b89c0,_0x146dff){_0x146dff=_0x146dff||0xcc;return function(_0x3f9052){if(_0x3f9052){return _0x3b89c0[_0x8717('0x1b')](_0x146dff);}return _0x3b89c0[_0x8717('0x1c')](_0x146dff)[_0x8717('0x1d')]();};}function respondWithResult(_0x3e2ae4,_0x1ce782){_0x1ce782=_0x1ce782||0xc8;return function(_0x461c5c){if(_0x461c5c){return _0x3e2ae4['status'](_0x1ce782)[_0x8717('0x1e')](_0x461c5c);}};}function respondWithFilteredResult(_0x5a06d0,_0x343de4){return function(_0x49bec3){if(_0x49bec3){var _0x2ce832=typeof _0x343de4[_0x8717('0x1f')]===_0x8717('0x20')&&typeof _0x343de4[_0x8717('0x21')]===_0x8717('0x20');var _0x4b2dc0=_0x49bec3[_0x8717('0x22')];var _0x356252=_0x2ce832?0x0:_0x343de4[_0x8717('0x1f')];var _0x134cfa=_0x2ce832?_0x49bec3[_0x8717('0x22')]:_0x343de4[_0x8717('0x1f')]+_0x343de4['limit'];var _0xf02e2d;if(_0x134cfa>=_0x4b2dc0){_0x134cfa=_0x4b2dc0;_0xf02e2d=0xc8;}else{_0xf02e2d=0xce;}_0x5a06d0['status'](_0xf02e2d);return _0x5a06d0[_0x8717('0x23')](_0x8717('0x24'),_0x356252+'-'+_0x134cfa+'/'+_0x4b2dc0)[_0x8717('0x1e')](_0x49bec3);}return null;};}function patchUpdates(_0x1835bb){return function(_0x4f161c){try{jsonpatch[_0x8717('0x25')](_0x4f161c,_0x1835bb,!![]);}catch(_0x143243){return BPromise[_0x8717('0x26')](_0x143243);}return _0x4f161c[_0x8717('0x27')]();};}function saveUpdates(_0x424d58,_0x3600b4){return function(_0x4538a2){if(_0x4538a2){return _0x4538a2[_0x8717('0x28')](_0x424d58)['then'](function(_0x2c1f74){return _0x2c1f74;});}return null;};}function removeEntity(_0x42ea29,_0x332df9){return function(_0x3d6aca){if(_0x3d6aca){return _0x3d6aca[_0x8717('0x29')]()['then'](function(){_0x42ea29[_0x8717('0x1c')](0xcc)[_0x8717('0x1d')]();});}};}function handleEntityNotFound(_0x4d2d1f,_0x926688){return function(_0x31ced6){if(!_0x31ced6){_0x4d2d1f[_0x8717('0x1b')](0x194);}return _0x31ced6;};}function handleError(_0x43c4ef,_0x33fe89){_0x33fe89=_0x33fe89||0x1f4;return function(_0x4efb39){logger[_0x8717('0x2a')](_0x4efb39[_0x8717('0x2b')]);if(_0x4efb39[_0x8717('0x2c')]){delete _0x4efb39[_0x8717('0x2c')];}_0x43c4ef[_0x8717('0x1c')](_0x33fe89)[_0x8717('0x2d')](_0x4efb39);};}exports['index']=function(_0x41c08c,_0x5be7e4){var _0x293472={},_0x1d26c9={},_0x13ffd1={'count':0x0,'rows':[]};var _0x32a3d1=_[_0x8717('0x2e')](db['DeskAccount'][_0x8717('0x2f')],function(_0xcecac6){return{'name':_0xcecac6[_0x8717('0x30')],'type':_0xcecac6[_0x8717('0x31')][_0x8717('0x32')]};});_0x1d26c9[_0x8717('0x33')]=_[_0x8717('0x2e')](_0x32a3d1,_0x8717('0x2c'));_0x1d26c9[_0x8717('0x34')]=_[_0x8717('0x35')](_0x41c08c[_0x8717('0x34')]);_0x1d26c9['filters']=_[_0x8717('0x36')](_0x1d26c9[_0x8717('0x33')],_0x1d26c9['query']);_0x293472[_0x8717('0x37')]=_['intersection'](_0x1d26c9[_0x8717('0x33')],qs[_0x8717('0x38')](_0x41c08c[_0x8717('0x34')][_0x8717('0x38')]));_0x293472[_0x8717('0x37')]=_0x293472[_0x8717('0x37')]['length']?_0x293472[_0x8717('0x37')]:_0x1d26c9[_0x8717('0x33')];if(!_0x41c08c['query'][_0x8717('0x39')](_0x8717('0x3a'))){_0x293472[_0x8717('0x21')]=qs[_0x8717('0x21')](_0x41c08c['query']['limit']);_0x293472[_0x8717('0x1f')]=qs[_0x8717('0x1f')](_0x41c08c[_0x8717('0x34')][_0x8717('0x1f')]);}_0x293472[_0x8717('0x3b')]=qs[_0x8717('0x3c')](_0x41c08c['query'][_0x8717('0x3c')]);_0x293472[_0x8717('0x3d')]=qs[_0x8717('0x3e')](_[_0x8717('0x3f')](_0x41c08c[_0x8717('0x34')],_0x1d26c9[_0x8717('0x3e')]),_0x32a3d1);if(_0x41c08c['query'][_0x8717('0x40')]){_0x293472[_0x8717('0x3d')]=_[_0x8717('0x41')](_0x293472['where'],{'$or':_[_0x8717('0x2e')](_0x32a3d1,function(_0x12ecce){if(_0x12ecce['type']!==_0x8717('0x42')){var _0x25703f={};_0x25703f[_0x12ecce['name']]={'$like':'%'+_0x41c08c[_0x8717('0x34')]['filter']+'%'};return _0x25703f;}})});}_0x293472=_[_0x8717('0x41')]({},_0x293472,_0x41c08c[_0x8717('0x43')]);var _0x4f7d82={'where':_0x293472[_0x8717('0x3d')]};return db[_0x8717('0x44')]['count'](_0x4f7d82)[_0x8717('0x45')](function(_0x29ae6f){_0x13ffd1[_0x8717('0x22')]=_0x29ae6f;if(_0x41c08c[_0x8717('0x34')][_0x8717('0x46')]){_0x293472[_0x8717('0x47')]=[{'all':!![]}];}return db['DeskAccount'][_0x8717('0x48')](_0x293472);})[_0x8717('0x45')](function(_0xe4f7d8){_0x13ffd1[_0x8717('0x49')]=_0xe4f7d8;return _0x13ffd1;})[_0x8717('0x45')](respondWithFilteredResult(_0x5be7e4,_0x293472))[_0x8717('0x4a')](handleError(_0x5be7e4,null));};exports[_0x8717('0x4b')]=function(_0x5f1d67,_0x433d00){var _0x2b1956={'raw':![],'where':{'id':_0x5f1d67[_0x8717('0x4c')]['id']}},_0x3f085b={};_0x3f085b[_0x8717('0x33')]=_[_0x8717('0x35')](db[_0x8717('0x44')]['rawAttributes']);_0x3f085b[_0x8717('0x34')]=_['keys'](_0x5f1d67[_0x8717('0x34')]);_0x3f085b[_0x8717('0x3e')]=_[_0x8717('0x36')](_0x3f085b[_0x8717('0x33')],_0x3f085b[_0x8717('0x34')]);_0x2b1956[_0x8717('0x37')]=_['intersection'](_0x3f085b[_0x8717('0x33')],qs['fields'](_0x5f1d67[_0x8717('0x34')][_0x8717('0x38')]));_0x2b1956[_0x8717('0x37')]=_0x2b1956[_0x8717('0x37')]['length']?_0x2b1956['attributes']:_0x3f085b[_0x8717('0x33')];if(_0x5f1d67[_0x8717('0x34')]['includeAll']){_0x2b1956[_0x8717('0x47')]=[{'all':!![]}];}_0x2b1956=_[_0x8717('0x41')]({},_0x2b1956,_0x5f1d67[_0x8717('0x43')]);return db[_0x8717('0x44')]['find'](_0x2b1956)[_0x8717('0x45')](handleEntityNotFound(_0x433d00,null))[_0x8717('0x45')](respondWithResult(_0x433d00,null))['catch'](handleError(_0x433d00,null));};exports[_0x8717('0x4d')]=function(_0x5526d1,_0x25be97){return db[_0x8717('0x44')][_0x8717('0x4d')](_0x5526d1[_0x8717('0x4e')],{})['then'](respondWithResult(_0x25be97,0xc9))[_0x8717('0x4a')](handleError(_0x25be97,null));};exports[_0x8717('0x28')]=function(_0x54078d,_0x4198bd){if(_0x54078d[_0x8717('0x4e')]['id']){delete _0x54078d['body']['id'];}return db[_0x8717('0x44')][_0x8717('0x4f')]({'where':{'id':_0x54078d[_0x8717('0x4c')]['id']}})[_0x8717('0x45')](handleEntityNotFound(_0x4198bd,null))['then'](saveUpdates(_0x54078d[_0x8717('0x4e')],null))[_0x8717('0x45')](respondWithResult(_0x4198bd,null))[_0x8717('0x4a')](handleError(_0x4198bd,null));};exports[_0x8717('0x29')]=function(_0x425387,_0x1510fa){return db[_0x8717('0x44')]['find']({'where':{'id':_0x425387[_0x8717('0x4c')]['id']}})[_0x8717('0x45')](handleEntityNotFound(_0x1510fa,null))['then'](removeEntity(_0x1510fa,null))[_0x8717('0x4a')](handleError(_0x1510fa,null));};exports['getConfigurations']=function(_0x50c197,_0x54949b,_0x6b851b){var _0x59836d={};var _0x1da222={};var _0x2761df;var _0x162666;return db[_0x8717('0x44')]['findOne']({'where':{'id':_0x50c197['params']['id']}})['then'](handleEntityNotFound(_0x54949b,null))[_0x8717('0x45')](function(_0x325e7b){if(_0x325e7b){_0x2761df=_0x325e7b;_0x1da222['model']=_[_0x8717('0x35')](db[_0x8717('0x50')][_0x8717('0x2f')]);_0x1da222[_0x8717('0x34')]=_[_0x8717('0x35')](_0x50c197['query']);_0x1da222['filters']=_['intersection'](_0x1da222[_0x8717('0x33')],_0x1da222[_0x8717('0x34')]);_0x59836d[_0x8717('0x37')]=_[_0x8717('0x36')](_0x1da222['model'],qs[_0x8717('0x38')](_0x50c197['query'][_0x8717('0x38')]));_0x59836d[_0x8717('0x37')]=_0x59836d[_0x8717('0x37')][_0x8717('0x51')]?_0x59836d[_0x8717('0x37')]:_0x1da222['model'];_0x59836d[_0x8717('0x3b')]=qs['sort'](_0x50c197[_0x8717('0x34')][_0x8717('0x3c')]);_0x59836d[_0x8717('0x3d')]=qs[_0x8717('0x3e')](_[_0x8717('0x3f')](_0x50c197[_0x8717('0x34')],_0x1da222[_0x8717('0x3e')]));if(_0x50c197[_0x8717('0x34')]['filter']){_0x59836d[_0x8717('0x3d')]=_['merge'](_0x59836d[_0x8717('0x3d')],{'$or':_[_0x8717('0x2e')](_0x59836d['attributes'],function(_0x2b937e){var _0x499afe={};_0x499afe[_0x2b937e]={'$like':'%'+_0x50c197[_0x8717('0x34')][_0x8717('0x40')]+'%'};return _0x499afe;})});}_0x59836d=_['merge']({},_0x59836d,_0x50c197[_0x8717('0x43')]);return _0x2761df[_0x8717('0x52')](_0x59836d);}})[_0x8717('0x45')](function(_0x56672b){if(_0x56672b){_0x162666=_0x56672b['length'];if(!_0x50c197['query'][_0x8717('0x39')](_0x8717('0x3a'))){_0x59836d[_0x8717('0x21')]=qs[_0x8717('0x21')](_0x50c197['query']['limit']);_0x59836d['offset']=qs[_0x8717('0x1f')](_0x50c197[_0x8717('0x34')][_0x8717('0x1f')]);}return _0x2761df['getConfigurations'](_0x59836d);}})['then'](function(_0x582319){if(_0x582319){return _0x582319?{'count':_0x162666,'rows':_0x582319}:null;}})[_0x8717('0x45')](respondWithResult(_0x54949b,null))[_0x8717('0x4a')](handleError(_0x54949b,null));};exports['addConfiguration']=function(_0x3aa2ff,_0xaca584,_0x7d3c8b){if(_0x3aa2ff[_0x8717('0x4e')]['id']){delete _0x3aa2ff[_0x8717('0x4e')]['id'];}return db['DeskAccount'][_0x8717('0x53')]({'where':{'id':_0x3aa2ff['params']['id']}})[_0x8717('0x45')](handleEntityNotFound(_0xaca584,null))[_0x8717('0x45')](function(_0x2a83ca){if(_0x2a83ca){_0x3aa2ff['body'][_0x8717('0x54')]=_0x2a83ca['id'];_0x3aa2ff[_0x8717('0x4e')]['Subjects']=integrations[_0x8717('0x55')](_0x3aa2ff[_0x8717('0x4e')][_0x8717('0x56')],_0x3aa2ff[_0x8717('0x4e')][_0x8717('0x31')]);_0x3aa2ff[_0x8717('0x4e')]['Descriptions']=integrations[_0x8717('0x57')](_0x3aa2ff[_0x8717('0x4e')][_0x8717('0x56')],_0x3aa2ff[_0x8717('0x4e')][_0x8717('0x31')]);return db[_0x8717('0x50')]['create'](_0x3aa2ff['body'],{'include':[{'model':db[_0x8717('0x58')],'as':_0x8717('0x59')},{'model':db['DeskField'],'as':_0x8717('0x5a')}]});}return null;})['then'](respondWithResult(_0xaca584,null))[_0x8717('0x4a')](handleError(_0xaca584,null));};exports[_0x8717('0x5b')]=function(_0x5b751a,_0x22e8ee,_0x50b77d){var _0x138883=[{'name':_0x8717('0x5c'),'label':_0x8717('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 _0x3c26aa='';return db['DeskAccount'][_0x8717('0x53')]({'where':{'id':_0x5b751a['params']['id']},'attributes':['id',_0x8717('0x5d'),'authType','username',_0x8717('0x5e'),'consumerKey',_0x8717('0x5f'),_0x8717('0x60'),_0x8717('0x61')]})[_0x8717('0x45')](handleEntityNotFound(_0x22e8ee,null))[_0x8717('0x45')](function(_0x38a71d){if(_0x38a71d){_0x3c26aa=_0x38a71d[_0x8717('0x5d')];var _0x4df58e=_0x3c26aa['slice'](-0x1);if(_0x4df58e==='/'){_0x3c26aa=_0x3c26aa['substring'](0x0,_0x3c26aa['lastIndexOf'](_0x4df58e));}var _0x563039={'method':_0x8717('0x62'),'uri':util[_0x8717('0x63')](_0x8717('0x64'),_0x3c26aa),'headers':{'Content-Type':'application/json','Accept':_0x8717('0x65')},'json':!![]};if(_0x38a71d['authType']===_0x8717('0x66')){_0x563039[_0x8717('0x67')][_0x8717('0x68')]=util[_0x8717('0x63')]('Basic\x20%s',new Buffer(util[_0x8717('0x63')]('%s:%s',_0x38a71d[_0x8717('0x69')],_0x38a71d[_0x8717('0x5e')]))[_0x8717('0x6a')](_0x8717('0x6b')));}return rp(_0x563039)[_0x8717('0x45')](function(_0x5c6473){return _0x138883[_0x8717('0x6c')](_['map'](_0x5c6473['_embedded'][_0x8717('0x6d')],function(_0x30bfb3){return{'id':_0x30bfb3[_0x8717('0x2c')],'name':_0x30bfb3[_0x8717('0x2c')],'type':_0x30bfb3[_0x8717('0x31')],'active':_0x30bfb3[_0x8717('0x6e')],'label':_0x30bfb3['label'],'custom':!![]};}));});}})['then'](function(_0xb307c){return{'count':_0xb307c[_0x8717('0x51')],'rows':_0xb307c};})['then'](respondWithResult(_0x22e8ee,null))[_0x8717('0x4a')](function(_0x436fed){var _0x175fec=_0x5b751a[_0x8717('0x34')][_0x8717('0x6f')]?0x1f4:_0x436fed[_0x8717('0x70')]||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s',_0x8717('0x5b'),_0x175fec,JSON['stringify'](_0x436fed));delete _0x436fed[_0x8717('0x2c')];if(_0x175fec===0x191){_0x175fec=0x190;}_0x22e8ee[_0x8717('0x1c')](_0x175fec)[_0x8717('0x2d')](_0x5b751a[_0x8717('0x34')][_0x8717('0x6f')]?{'message':_0x8717('0x71'),'statusCode':_0x436fed[_0x8717('0x70')]}:_0x436fed);});}; \ No newline at end of file +var _0x1ba9=['intersection','fields','hasOwnProperty','nolimit','limit','order','sort','pick','filter','where','type','VIRTUAL','includeAll','show','params','rawAttributes','length','include','find','create','catch','body','getConfigurations','DeskConfiguration','merge','options','addConfiguration','findOne','AccountId','Subjects','channel','getDescriptions','DeskField','Descriptions','priority','remoteUri','authType','username','password','consumerKey','consumerSecret','token','tokenSecret','slice','substring','lastIndexOf','GET','format','%s/custom_fields','application/json','basic','Authorization','Basic\x20%s','%s:%s','toString','base64','concat','entries','active','test','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','count','set','Content-Range','json','apply','reject','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskAccount','fieldName','key','query','keys','filters','model','attributes'];(function(_0x42bdad,_0x12836c){var _0x122626=function(_0x2eb29c){while(--_0x2eb29c){_0x42bdad['push'](_0x42bdad['shift']());}};_0x122626(++_0x12836c);}(_0x1ba9,0x1a9));var _0x91ba=function(_0xae2bfe,_0x2f45b9){_0xae2bfe=_0xae2bfe-0x0;var _0x167f73=_0x1ba9[_0xae2bfe];return _0x167f73;};'use strict';var emlformat=require(_0x91ba('0x0'));var rimraf=require(_0x91ba('0x1'));var zipdir=require(_0x91ba('0x2'));var jsonpatch=require(_0x91ba('0x3'));var rp=require(_0x91ba('0x4'));var moment=require('moment');var BPromise=require(_0x91ba('0x5'));var Mustache=require(_0x91ba('0x6'));var util=require('util');var path=require('path');var sox=require(_0x91ba('0x7'));var csv=require(_0x91ba('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x91ba('0x9'));var _=require(_0x91ba('0xa'));var squel=require(_0x91ba('0xb'));var crypto=require(_0x91ba('0xc'));var jsforce=require(_0x91ba('0xd'));var deskjs=require(_0x91ba('0xe'));var toCsv=require('to-csv');var querystring=require(_0x91ba('0xf'));var Papa=require(_0x91ba('0x10'));var Redis=require(_0x91ba('0x11'));var authService=require(_0x91ba('0x12'));var qs=require(_0x91ba('0x13'));var as=require(_0x91ba('0x14'));var hardwareService=require(_0x91ba('0x15'));var logger=require(_0x91ba('0x16'))('api');var utils=require(_0x91ba('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x91ba('0x18'));var db=require(_0x91ba('0x19'))['db'];var integrations=require(_0x91ba('0x1a'));function respondWithStatusCode(_0x16be0b,_0x3c98f1){_0x3c98f1=_0x3c98f1||0xcc;return function(_0x330768){if(_0x330768){return _0x16be0b['sendStatus'](_0x3c98f1);}return _0x16be0b[_0x91ba('0x1b')](_0x3c98f1)[_0x91ba('0x1c')]();};}function respondWithResult(_0x466cd0,_0x462637){_0x462637=_0x462637||0xc8;return function(_0x3b2ae1){if(_0x3b2ae1){return _0x466cd0['status'](_0x462637)['json'](_0x3b2ae1);}};}function respondWithFilteredResult(_0x3ed887,_0x387786){return function(_0x1d9f58){if(_0x1d9f58){var _0x2df8a1=typeof _0x387786[_0x91ba('0x1d')]==='undefined'&&typeof _0x387786['limit']===_0x91ba('0x1e');var _0x115715=_0x1d9f58[_0x91ba('0x1f')];var _0x4015f4=_0x2df8a1?0x0:_0x387786['offset'];var _0x29958c=_0x2df8a1?_0x1d9f58[_0x91ba('0x1f')]:_0x387786[_0x91ba('0x1d')]+_0x387786['limit'];var _0x160fac;if(_0x29958c>=_0x115715){_0x29958c=_0x115715;_0x160fac=0xc8;}else{_0x160fac=0xce;}_0x3ed887['status'](_0x160fac);return _0x3ed887[_0x91ba('0x20')](_0x91ba('0x21'),_0x4015f4+'-'+_0x29958c+'/'+_0x115715)[_0x91ba('0x22')](_0x1d9f58);}return null;};}function patchUpdates(_0x36571a){return function(_0x42dd79){try{jsonpatch[_0x91ba('0x23')](_0x42dd79,_0x36571a,!![]);}catch(_0x14adeb){return BPromise[_0x91ba('0x24')](_0x14adeb);}return _0x42dd79['save']();};}function saveUpdates(_0x27bc98,_0x68f3f0){return function(_0x299ade){if(_0x299ade){return _0x299ade[_0x91ba('0x25')](_0x27bc98)[_0x91ba('0x26')](function(_0x5e14a3){return _0x5e14a3;});}return null;};}function removeEntity(_0x24f5ff,_0x183589){return function(_0x151de0){if(_0x151de0){return _0x151de0[_0x91ba('0x27')]()[_0x91ba('0x26')](function(){_0x24f5ff[_0x91ba('0x1b')](0xcc)[_0x91ba('0x1c')]();});}};}function handleEntityNotFound(_0x927ecd,_0x284c3c){return function(_0x5562c7){if(!_0x5562c7){_0x927ecd[_0x91ba('0x28')](0x194);}return _0x5562c7;};}function handleError(_0x28665,_0x32c7c0){_0x32c7c0=_0x32c7c0||0x1f4;return function(_0x1f77f6){logger[_0x91ba('0x29')](_0x1f77f6[_0x91ba('0x2a')]);if(_0x1f77f6[_0x91ba('0x2b')]){delete _0x1f77f6[_0x91ba('0x2b')];}_0x28665[_0x91ba('0x1b')](_0x32c7c0)[_0x91ba('0x2c')](_0x1f77f6);};}exports[_0x91ba('0x2d')]=function(_0x2c388a,_0x414703){var _0x3ddf94={},_0x24890b={},_0xc65773={'count':0x0,'rows':[]};var _0x3e5f76=_[_0x91ba('0x2e')](db[_0x91ba('0x2f')]['rawAttributes'],function(_0x10a909){return{'name':_0x10a909[_0x91ba('0x30')],'type':_0x10a909['type'][_0x91ba('0x31')]};});_0x24890b['model']=_[_0x91ba('0x2e')](_0x3e5f76,'name');_0x24890b[_0x91ba('0x32')]=_[_0x91ba('0x33')](_0x2c388a[_0x91ba('0x32')]);_0x24890b[_0x91ba('0x34')]=_['intersection'](_0x24890b[_0x91ba('0x35')],_0x24890b[_0x91ba('0x32')]);_0x3ddf94[_0x91ba('0x36')]=_[_0x91ba('0x37')](_0x24890b['model'],qs['fields'](_0x2c388a[_0x91ba('0x32')][_0x91ba('0x38')]));_0x3ddf94[_0x91ba('0x36')]=_0x3ddf94[_0x91ba('0x36')]['length']?_0x3ddf94['attributes']:_0x24890b[_0x91ba('0x35')];if(!_0x2c388a[_0x91ba('0x32')][_0x91ba('0x39')](_0x91ba('0x3a'))){_0x3ddf94[_0x91ba('0x3b')]=qs['limit'](_0x2c388a[_0x91ba('0x32')][_0x91ba('0x3b')]);_0x3ddf94[_0x91ba('0x1d')]=qs[_0x91ba('0x1d')](_0x2c388a[_0x91ba('0x32')][_0x91ba('0x1d')]);}_0x3ddf94[_0x91ba('0x3c')]=qs[_0x91ba('0x3d')](_0x2c388a['query']['sort']);_0x3ddf94['where']=qs[_0x91ba('0x34')](_[_0x91ba('0x3e')](_0x2c388a[_0x91ba('0x32')],_0x24890b['filters']),_0x3e5f76);if(_0x2c388a['query'][_0x91ba('0x3f')]){_0x3ddf94['where']=_['merge'](_0x3ddf94[_0x91ba('0x40')],{'$or':_[_0x91ba('0x2e')](_0x3e5f76,function(_0x41f338){if(_0x41f338[_0x91ba('0x41')]!==_0x91ba('0x42')){var _0x22d5c4={};_0x22d5c4[_0x41f338[_0x91ba('0x2b')]]={'$like':'%'+_0x2c388a[_0x91ba('0x32')][_0x91ba('0x3f')]+'%'};return _0x22d5c4;}})});}_0x3ddf94=_['merge']({},_0x3ddf94,_0x2c388a['options']);var _0x5a1dac={'where':_0x3ddf94['where']};return db['DeskAccount'][_0x91ba('0x1f')](_0x5a1dac)[_0x91ba('0x26')](function(_0x24fb90){_0xc65773['count']=_0x24fb90;if(_0x2c388a[_0x91ba('0x32')][_0x91ba('0x43')]){_0x3ddf94['include']=[{'all':!![]}];}return db[_0x91ba('0x2f')]['findAll'](_0x3ddf94);})[_0x91ba('0x26')](function(_0xd5aed2){_0xc65773['rows']=_0xd5aed2;return _0xc65773;})[_0x91ba('0x26')](respondWithFilteredResult(_0x414703,_0x3ddf94))['catch'](handleError(_0x414703,null));};exports[_0x91ba('0x44')]=function(_0x4e5381,_0x3070f2){var _0x2a7eb7={'raw':![],'where':{'id':_0x4e5381[_0x91ba('0x45')]['id']}},_0x44307d={};_0x44307d[_0x91ba('0x35')]=_['keys'](db[_0x91ba('0x2f')][_0x91ba('0x46')]);_0x44307d['query']=_[_0x91ba('0x33')](_0x4e5381[_0x91ba('0x32')]);_0x44307d[_0x91ba('0x34')]=_['intersection'](_0x44307d[_0x91ba('0x35')],_0x44307d[_0x91ba('0x32')]);_0x2a7eb7[_0x91ba('0x36')]=_['intersection'](_0x44307d[_0x91ba('0x35')],qs[_0x91ba('0x38')](_0x4e5381[_0x91ba('0x32')][_0x91ba('0x38')]));_0x2a7eb7[_0x91ba('0x36')]=_0x2a7eb7[_0x91ba('0x36')][_0x91ba('0x47')]?_0x2a7eb7[_0x91ba('0x36')]:_0x44307d['model'];if(_0x4e5381[_0x91ba('0x32')][_0x91ba('0x43')]){_0x2a7eb7[_0x91ba('0x48')]=[{'all':!![]}];}_0x2a7eb7=_['merge']({},_0x2a7eb7,_0x4e5381['options']);return db['DeskAccount'][_0x91ba('0x49')](_0x2a7eb7)[_0x91ba('0x26')](handleEntityNotFound(_0x3070f2,null))[_0x91ba('0x26')](respondWithResult(_0x3070f2,null))['catch'](handleError(_0x3070f2,null));};exports['create']=function(_0x2e21a2,_0x2cfddb){return db[_0x91ba('0x2f')][_0x91ba('0x4a')](_0x2e21a2['body'],{})[_0x91ba('0x26')](respondWithResult(_0x2cfddb,0xc9))[_0x91ba('0x4b')](handleError(_0x2cfddb,null));};exports[_0x91ba('0x25')]=function(_0x5660fb,_0x53ab79){if(_0x5660fb[_0x91ba('0x4c')]['id']){delete _0x5660fb[_0x91ba('0x4c')]['id'];}return db[_0x91ba('0x2f')][_0x91ba('0x49')]({'where':{'id':_0x5660fb[_0x91ba('0x45')]['id']}})[_0x91ba('0x26')](handleEntityNotFound(_0x53ab79,null))[_0x91ba('0x26')](saveUpdates(_0x5660fb[_0x91ba('0x4c')],null))[_0x91ba('0x26')](respondWithResult(_0x53ab79,null))[_0x91ba('0x4b')](handleError(_0x53ab79,null));};exports[_0x91ba('0x27')]=function(_0x1d7e58,_0x92dee0){return db['DeskAccount']['find']({'where':{'id':_0x1d7e58[_0x91ba('0x45')]['id']}})[_0x91ba('0x26')](handleEntityNotFound(_0x92dee0,null))[_0x91ba('0x26')](removeEntity(_0x92dee0,null))[_0x91ba('0x4b')](handleError(_0x92dee0,null));};exports[_0x91ba('0x4d')]=function(_0x400a47,_0x33c7d4,_0x4c93ae){var _0x559b19={};var _0x1f9b02={};var _0x5c6851;var _0x2f6343;return db[_0x91ba('0x2f')]['findOne']({'where':{'id':_0x400a47[_0x91ba('0x45')]['id']}})[_0x91ba('0x26')](handleEntityNotFound(_0x33c7d4,null))[_0x91ba('0x26')](function(_0x440f61){if(_0x440f61){_0x5c6851=_0x440f61;_0x1f9b02[_0x91ba('0x35')]=_[_0x91ba('0x33')](db[_0x91ba('0x4e')][_0x91ba('0x46')]);_0x1f9b02[_0x91ba('0x32')]=_[_0x91ba('0x33')](_0x400a47[_0x91ba('0x32')]);_0x1f9b02['filters']=_[_0x91ba('0x37')](_0x1f9b02[_0x91ba('0x35')],_0x1f9b02['query']);_0x559b19[_0x91ba('0x36')]=_[_0x91ba('0x37')](_0x1f9b02[_0x91ba('0x35')],qs[_0x91ba('0x38')](_0x400a47[_0x91ba('0x32')][_0x91ba('0x38')]));_0x559b19[_0x91ba('0x36')]=_0x559b19['attributes'][_0x91ba('0x47')]?_0x559b19['attributes']:_0x1f9b02['model'];_0x559b19[_0x91ba('0x3c')]=qs['sort'](_0x400a47[_0x91ba('0x32')][_0x91ba('0x3d')]);_0x559b19['where']=qs[_0x91ba('0x34')](_[_0x91ba('0x3e')](_0x400a47[_0x91ba('0x32')],_0x1f9b02['filters']));if(_0x400a47[_0x91ba('0x32')][_0x91ba('0x3f')]){_0x559b19[_0x91ba('0x40')]=_[_0x91ba('0x4f')](_0x559b19[_0x91ba('0x40')],{'$or':_['map'](_0x559b19[_0x91ba('0x36')],function(_0xf3495){var _0x2eaeaf={};_0x2eaeaf[_0xf3495]={'$like':'%'+_0x400a47[_0x91ba('0x32')][_0x91ba('0x3f')]+'%'};return _0x2eaeaf;})});}_0x559b19=_[_0x91ba('0x4f')]({},_0x559b19,_0x400a47[_0x91ba('0x50')]);return _0x5c6851[_0x91ba('0x4d')](_0x559b19);}})[_0x91ba('0x26')](function(_0x251e30){if(_0x251e30){_0x2f6343=_0x251e30['length'];if(!_0x400a47[_0x91ba('0x32')][_0x91ba('0x39')](_0x91ba('0x3a'))){_0x559b19[_0x91ba('0x3b')]=qs[_0x91ba('0x3b')](_0x400a47['query'][_0x91ba('0x3b')]);_0x559b19['offset']=qs[_0x91ba('0x1d')](_0x400a47['query'][_0x91ba('0x1d')]);}return _0x5c6851[_0x91ba('0x4d')](_0x559b19);}})[_0x91ba('0x26')](function(_0x309a9d){if(_0x309a9d){return _0x309a9d?{'count':_0x2f6343,'rows':_0x309a9d}:null;}})[_0x91ba('0x26')](respondWithResult(_0x33c7d4,null))[_0x91ba('0x4b')](handleError(_0x33c7d4,null));};exports[_0x91ba('0x51')]=function(_0x1bed5b,_0x1fe917,_0x1b9766){if(_0x1bed5b[_0x91ba('0x4c')]['id']){delete _0x1bed5b[_0x91ba('0x4c')]['id'];}return db[_0x91ba('0x2f')][_0x91ba('0x52')]({'where':{'id':_0x1bed5b[_0x91ba('0x45')]['id']}})[_0x91ba('0x26')](handleEntityNotFound(_0x1fe917,null))['then'](function(_0x5bf5d2){if(_0x5bf5d2){_0x1bed5b[_0x91ba('0x4c')][_0x91ba('0x53')]=_0x5bf5d2['id'];_0x1bed5b[_0x91ba('0x4c')][_0x91ba('0x54')]=integrations['getSubjects'](_0x1bed5b[_0x91ba('0x4c')][_0x91ba('0x55')],_0x1bed5b[_0x91ba('0x4c')]['type']);_0x1bed5b[_0x91ba('0x4c')]['Descriptions']=integrations[_0x91ba('0x56')](_0x1bed5b[_0x91ba('0x4c')][_0x91ba('0x55')],_0x1bed5b[_0x91ba('0x4c')]['type']);return db[_0x91ba('0x4e')][_0x91ba('0x4a')](_0x1bed5b[_0x91ba('0x4c')],{'include':[{'model':db[_0x91ba('0x57')],'as':_0x91ba('0x54')},{'model':db[_0x91ba('0x57')],'as':_0x91ba('0x58')}]});}return null;})[_0x91ba('0x26')](respondWithResult(_0x1fe917,null))[_0x91ba('0x4b')](handleError(_0x1fe917,null));};exports['getFields']=function(_0x142577,_0x82456b,_0xf4cf26){var _0x385cff=[{'name':_0x91ba('0x59'),'label':_0x91ba('0x59'),'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 _0x539145='';return db['DeskAccount'][_0x91ba('0x52')]({'where':{'id':_0x142577[_0x91ba('0x45')]['id']},'attributes':['id',_0x91ba('0x5a'),_0x91ba('0x5b'),_0x91ba('0x5c'),_0x91ba('0x5d'),_0x91ba('0x5e'),_0x91ba('0x5f'),_0x91ba('0x60'),_0x91ba('0x61')]})['then'](handleEntityNotFound(_0x82456b,null))[_0x91ba('0x26')](function(_0x2ee767){if(_0x2ee767){_0x539145=_0x2ee767[_0x91ba('0x5a')];var _0x3deee8=_0x539145[_0x91ba('0x62')](-0x1);if(_0x3deee8==='/'){_0x539145=_0x539145[_0x91ba('0x63')](0x0,_0x539145[_0x91ba('0x64')](_0x3deee8));}var _0x2dce51={'method':_0x91ba('0x65'),'uri':util[_0x91ba('0x66')](_0x91ba('0x67'),_0x539145),'headers':{'Content-Type':_0x91ba('0x68'),'Accept':'application/json'},'json':!![]};if(_0x2ee767[_0x91ba('0x5b')]===_0x91ba('0x69')){_0x2dce51['headers'][_0x91ba('0x6a')]=util[_0x91ba('0x66')](_0x91ba('0x6b'),new Buffer(util[_0x91ba('0x66')](_0x91ba('0x6c'),_0x2ee767['username'],_0x2ee767['password']))[_0x91ba('0x6d')](_0x91ba('0x6e')));}return rp(_0x2dce51)[_0x91ba('0x26')](function(_0x5624e5){return _0x385cff[_0x91ba('0x6f')](_['map'](_0x5624e5['_embedded'][_0x91ba('0x70')],function(_0x4349aa){return{'id':_0x4349aa[_0x91ba('0x2b')],'name':_0x4349aa[_0x91ba('0x2b')],'type':_0x4349aa['type'],'active':_0x4349aa[_0x91ba('0x71')],'label':_0x4349aa['label'],'custom':!![]};}));});}})[_0x91ba('0x26')](function(_0x29d3bd){return{'count':_0x29d3bd['length'],'rows':_0x29d3bd};})[_0x91ba('0x26')](respondWithResult(_0x82456b,null))[_0x91ba('0x4b')](function(_0x43e204){var _0x158db3=_0x142577[_0x91ba('0x32')][_0x91ba('0x72')]?0x1f4:_0x43e204['statusCode']||0x1f4;logger['error'](_0x91ba('0x73'),_0x91ba('0x74'),_0x158db3,JSON[_0x91ba('0x75')](_0x43e204));delete _0x43e204[_0x91ba('0x2b')];if(_0x158db3===0x191){_0x158db3=0x190;}_0x82456b[_0x91ba('0x1b')](_0x158db3)[_0x91ba('0x2c')](_0x142577[_0x91ba('0x32')][_0x91ba('0x72')]?{'message':_0x91ba('0x76'),'statusCode':_0x43e204[_0x91ba('0x77')]}:_0x43e204);});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.model.js b/server/api/intDeskAccount/intDeskAccount.model.js index 6671581..bc7a733 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 _0x1284=['./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x397014,_0x17cc12){var _0x1163f7=function(_0x290ac1){while(--_0x290ac1){_0x397014['push'](_0x397014['shift']());}};_0x1163f7(++_0x17cc12);}(_0x1284,0x1aa));var _0x4128=function(_0x199572,_0x33e667){_0x199572=_0x199572-0x0;var _0x13cfa3=_0x1284[_0x199572];return _0x13cfa3;};'use strict';var _=require(_0x4128('0x0'));var util=require('util');var logger=require(_0x4128('0x1'))(_0x4128('0x2'));var moment=require(_0x4128('0x3'));var BPromise=require(_0x4128('0x4'));var rp=require(_0x4128('0x5'));var fs=require('fs');var path=require(_0x4128('0x6'));var rimraf=require(_0x4128('0x7'));var config=require(_0x4128('0x8'));var attributes=require(_0x4128('0x9'));var integrations=require(_0x4128('0xa'));module[_0x4128('0xb')]=function(_0x1f9e05,_0x46dadd){return _0x1f9e05[_0x4128('0xc')](_0x4128('0xd'),attributes,{'tableName':_0x4128('0xe'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3671=['lodash','util','../../config/logger','moment','bluebird','path','../../config/environment','./intDeskAccount.attributes','../../components/integrations/configuration','exports','define','DeskAccount','int_desk_accounts'];(function(_0x2c000b,_0x3fcff4){var _0x520ff1=function(_0x15c145){while(--_0x15c145){_0x2c000b['push'](_0x2c000b['shift']());}};_0x520ff1(++_0x3fcff4);}(_0x3671,0xc3));var _0x1367=function(_0x3a4203,_0xa6ff2e){_0x3a4203=_0x3a4203-0x0;var _0x1a5661=_0x3671[_0x3a4203];return _0x1a5661;};'use strict';var _=require(_0x1367('0x0'));var util=require(_0x1367('0x1'));var logger=require(_0x1367('0x2'))('api');var moment=require(_0x1367('0x3'));var BPromise=require(_0x1367('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1367('0x5'));var rimraf=require('rimraf');var config=require(_0x1367('0x6'));var attributes=require(_0x1367('0x7'));var integrations=require(_0x1367('0x8'));module[_0x1367('0x9')]=function(_0x2b89db,_0x729730){return _0x2b89db[_0x1367('0xa')](_0x1367('0xb'),attributes,{'tableName':_0x1367('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskAccount/intDeskAccount.rpc.js b/server/api/intDeskAccount/intDeskAccount.rpc.js index 72ca112..e8d15a1 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 _0xc6d8=['util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','info','DeskAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetDeskAccount','findAll','options','raw','attributes','limit','map','include','model','then','ShowDeskAccount','find','where'];(function(_0x222ca9,_0x203f9d){var _0x5cc79f=function(_0x3247bd){while(--_0x3247bd){_0x222ca9['push'](_0x222ca9['shift']());}};_0x5cc79f(++_0x203f9d);}(_0xc6d8,0x14a));var _0x8c6d=function(_0x397843,_0xa7173e){_0x397843=_0x397843-0x0;var _0x2ba028=_0xc6d8[_0x397843];return _0x2ba028;};'use strict';var _=require('lodash');var util=require(_0x8c6d('0x0'));var moment=require(_0x8c6d('0x1'));var BPromise=require('bluebird');var rs=require(_0x8c6d('0x2'));var fs=require('fs');var Redis=require(_0x8c6d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8c6d('0x4'));var logger=require(_0x8c6d('0x5'))(_0x8c6d('0x6'));var config=require(_0x8c6d('0x7'));var jayson=require(_0x8c6d('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xb1daf7,_0x78ebff,_0x11793c){return new BPromise(function(_0x30f41e,_0x5e3497){return client[_0x8c6d('0x9')](_0xb1daf7,_0x11793c)['then'](function(_0x49c161){logger[_0x8c6d('0xa')](_0x8c6d('0xb'),_0x78ebff,_0x8c6d('0xc'));logger[_0x8c6d('0xd')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x78ebff,_0x8c6d('0xc'),JSON[_0x8c6d('0xe')](_0x49c161));if(_0x49c161[_0x8c6d('0xf')]){if(_0x49c161[_0x8c6d('0xf')][_0x8c6d('0x10')]===0x1f4){logger['error'](_0x8c6d('0xb'),_0x78ebff,_0x49c161[_0x8c6d('0xf')][_0x8c6d('0x11')]);return _0x5e3497(_0x49c161['error'][_0x8c6d('0x11')]);}logger[_0x8c6d('0xf')](_0x8c6d('0xb'),_0x78ebff,_0x49c161[_0x8c6d('0xf')][_0x8c6d('0x11')]);return _0x30f41e(_0x49c161[_0x8c6d('0xf')][_0x8c6d('0x11')]);}else{logger['info'](_0x8c6d('0xb'),_0x78ebff,_0x8c6d('0xc'));_0x30f41e(_0x49c161[_0x8c6d('0x12')][_0x8c6d('0x11')]);}})[_0x8c6d('0x13')](function(_0x2de16b){logger['error'](_0x8c6d('0xb'),_0x78ebff,_0x2de16b);_0x5e3497(_0x2de16b);});});}exports[_0x8c6d('0x14')]=function(_0x470060){var _0x3e7638=this;return new Promise(function(_0x59845e,_0xdd12ee){return db['DeskAccount'][_0x8c6d('0x15')]({'raw':_0x470060[_0x8c6d('0x16')]?_0x470060[_0x8c6d('0x16')][_0x8c6d('0x17')]===undefined?!![]:![]:!![],'where':_0x470060[_0x8c6d('0x16')]?_0x470060['options']['where']||null:null,'attributes':_0x470060[_0x8c6d('0x16')]?_0x470060[_0x8c6d('0x16')][_0x8c6d('0x18')]||null:null,'limit':_0x470060['options']?_0x470060[_0x8c6d('0x16')][_0x8c6d('0x19')]||null:null,'include':_0x470060[_0x8c6d('0x16')]?_0x470060[_0x8c6d('0x16')]['include']?_[_0x8c6d('0x1a')](_0x470060['options'][_0x8c6d('0x1b')],function(_0x322261){return{'model':db[_0x322261[_0x8c6d('0x1c')]],'as':_0x322261['as'],'attributes':_0x322261['attributes'],'include':_0x322261['include']?_[_0x8c6d('0x1a')](_0x322261[_0x8c6d('0x1b')],function(_0x32fc39){return{'model':db[_0x32fc39[_0x8c6d('0x1c')]],'as':_0x32fc39['as'],'attributes':_0x32fc39[_0x8c6d('0x18')],'include':_0x32fc39[_0x8c6d('0x1b')]?_['map'](_0x32fc39[_0x8c6d('0x1b')],function(_0x5b3f55){return{'model':db[_0x5b3f55[_0x8c6d('0x1c')]],'as':_0x5b3f55['as'],'attributes':_0x5b3f55[_0x8c6d('0x18')]};}):[]};}):[]};}):[]:[]})[_0x8c6d('0x1d')](function(_0x49ef8b){logger[_0x8c6d('0xa')](_0x8c6d('0x14'),_0x470060);logger['debug'](_0x8c6d('0x14'),_0x470060,JSON[_0x8c6d('0xe')](_0x49ef8b));_0x59845e(_0x49ef8b);})[_0x8c6d('0x13')](function(_0x481252){logger[_0x8c6d('0xf')]('GetDeskAccount',_0x481252['message'],_0x470060);_0xdd12ee(_0x3e7638[_0x8c6d('0xf')](0x1f4,_0x481252[_0x8c6d('0x11')]));});});};exports[_0x8c6d('0x1e')]=function(_0x47ec5a){var _0x5c6c33=this;return new Promise(function(_0x5912d9,_0x1f7135){return db['DeskAccount'][_0x8c6d('0x1f')]({'raw':_0x47ec5a[_0x8c6d('0x16')]?_0x47ec5a[_0x8c6d('0x16')][_0x8c6d('0x17')]===undefined?!![]:![]:!![],'where':_0x47ec5a[_0x8c6d('0x16')]?_0x47ec5a['options'][_0x8c6d('0x20')]||null:null,'attributes':_0x47ec5a[_0x8c6d('0x16')]?_0x47ec5a[_0x8c6d('0x16')][_0x8c6d('0x18')]||null:null,'include':_0x47ec5a['options']?_0x47ec5a[_0x8c6d('0x16')][_0x8c6d('0x1b')]?_[_0x8c6d('0x1a')](_0x47ec5a['options']['include'],function(_0x550481){return{'model':db[_0x550481[_0x8c6d('0x1c')]],'as':_0x550481['as'],'attributes':_0x550481[_0x8c6d('0x18')],'include':_0x550481['include']?_[_0x8c6d('0x1a')](_0x550481[_0x8c6d('0x1b')],function(_0x2091eb){return{'model':db[_0x2091eb[_0x8c6d('0x1c')]],'as':_0x2091eb['as'],'attributes':_0x2091eb['attributes'],'include':_0x2091eb[_0x8c6d('0x1b')]?_[_0x8c6d('0x1a')](_0x2091eb[_0x8c6d('0x1b')],function(_0x510df5){return{'model':db[_0x510df5[_0x8c6d('0x1c')]],'as':_0x510df5['as'],'attributes':_0x510df5[_0x8c6d('0x18')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4dcdd8){logger['info'](_0x8c6d('0x1e'),_0x47ec5a);logger[_0x8c6d('0xd')](_0x8c6d('0x1e'),_0x47ec5a,JSON['stringify'](_0x4dcdd8));_0x5912d9(_0x4dcdd8);})[_0x8c6d('0x13')](function(_0x10c223){logger[_0x8c6d('0xf')](_0x8c6d('0x1e'),_0x10c223[_0x8c6d('0x11')],_0x47ec5a);_0x1f7135(_0x5c6c33[_0x8c6d('0xf')](0x1f4,_0x10c223['message']));});});}; \ No newline at end of file +var _0xb857=['request\x20sent','debug','stringify','error','message','info','catch','GetDeskAccount','DeskAccount','findAll','options','where','attributes','include','map','model','find','raw','ShowDeskAccount','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','request','then','DeskAccount,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb857,0x6d));var _0x7b85=function(_0x4e448b,_0x37e0f7){_0x4e448b=_0x4e448b-0x0;var _0x342c6c=_0xb857[_0x4e448b];return _0x342c6c;};'use strict';var _=require('lodash');var util=require(_0x7b85('0x0'));var moment=require('moment');var BPromise=require(_0x7b85('0x1'));var rs=require(_0x7b85('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b85('0x3'))['db'];var utils=require(_0x7b85('0x4'));var logger=require(_0x7b85('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x7b85('0x6'));var client=jayson['client'][_0x7b85('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x19b03d,_0x36f993,_0x36e7e3){return new BPromise(function(_0x17b8da,_0x3681dd){return client[_0x7b85('0x8')](_0x19b03d,_0x36e7e3)[_0x7b85('0x9')](function(_0x242f70){logger['info'](_0x7b85('0xa'),_0x36f993,_0x7b85('0xb'));logger[_0x7b85('0xc')]('DeskAccount,\x20%s,\x20%s,\x20%s',_0x36f993,'request\x20sent',JSON[_0x7b85('0xd')](_0x242f70));if(_0x242f70['error']){if(_0x242f70['error']['code']===0x1f4){logger['error'](_0x7b85('0xa'),_0x36f993,_0x242f70[_0x7b85('0xe')][_0x7b85('0xf')]);return _0x3681dd(_0x242f70[_0x7b85('0xe')][_0x7b85('0xf')]);}logger[_0x7b85('0xe')](_0x7b85('0xa'),_0x36f993,_0x242f70[_0x7b85('0xe')][_0x7b85('0xf')]);return _0x17b8da(_0x242f70['error'][_0x7b85('0xf')]);}else{logger[_0x7b85('0x10')](_0x7b85('0xa'),_0x36f993,'request\x20sent');_0x17b8da(_0x242f70['result']['message']);}})[_0x7b85('0x11')](function(_0x7675d2){logger['error']('DeskAccount,\x20%s,\x20%s',_0x36f993,_0x7675d2);_0x3681dd(_0x7675d2);});});}exports[_0x7b85('0x12')]=function(_0x3aad49){var _0x424a25=this;return new Promise(function(_0x489321,_0xa687d7){return db[_0x7b85('0x13')][_0x7b85('0x14')]({'raw':_0x3aad49[_0x7b85('0x15')]?_0x3aad49[_0x7b85('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x3aad49['options']?_0x3aad49[_0x7b85('0x15')][_0x7b85('0x16')]||null:null,'attributes':_0x3aad49['options']?_0x3aad49['options'][_0x7b85('0x17')]||null:null,'limit':_0x3aad49[_0x7b85('0x15')]?_0x3aad49[_0x7b85('0x15')]['limit']||null:null,'include':_0x3aad49[_0x7b85('0x15')]?_0x3aad49[_0x7b85('0x15')][_0x7b85('0x18')]?_[_0x7b85('0x19')](_0x3aad49['options'][_0x7b85('0x18')],function(_0x24aeb4){return{'model':db[_0x24aeb4[_0x7b85('0x1a')]],'as':_0x24aeb4['as'],'attributes':_0x24aeb4['attributes'],'include':_0x24aeb4[_0x7b85('0x18')]?_['map'](_0x24aeb4['include'],function(_0x575943){return{'model':db[_0x575943[_0x7b85('0x1a')]],'as':_0x575943['as'],'attributes':_0x575943[_0x7b85('0x17')],'include':_0x575943[_0x7b85('0x18')]?_[_0x7b85('0x19')](_0x575943[_0x7b85('0x18')],function(_0x2ff82e){return{'model':db[_0x2ff82e[_0x7b85('0x1a')]],'as':_0x2ff82e['as'],'attributes':_0x2ff82e['attributes']};}):[]};}):[]};}):[]:[]})[_0x7b85('0x9')](function(_0x3ecb43){logger[_0x7b85('0x10')](_0x7b85('0x12'),_0x3aad49);logger[_0x7b85('0xc')](_0x7b85('0x12'),_0x3aad49,JSON[_0x7b85('0xd')](_0x3ecb43));_0x489321(_0x3ecb43);})[_0x7b85('0x11')](function(_0x2b2c6a){logger[_0x7b85('0xe')](_0x7b85('0x12'),_0x2b2c6a[_0x7b85('0xf')],_0x3aad49);_0xa687d7(_0x424a25[_0x7b85('0xe')](0x1f4,_0x2b2c6a[_0x7b85('0xf')]));});});};exports['ShowDeskAccount']=function(_0x40ebb5){var _0x50b1cd=this;return new Promise(function(_0x538eac,_0x1a33f0){return db[_0x7b85('0x13')][_0x7b85('0x1b')]({'raw':_0x40ebb5[_0x7b85('0x15')]?_0x40ebb5[_0x7b85('0x15')][_0x7b85('0x1c')]===undefined?!![]:![]:!![],'where':_0x40ebb5['options']?_0x40ebb5['options']['where']||null:null,'attributes':_0x40ebb5[_0x7b85('0x15')]?_0x40ebb5[_0x7b85('0x15')][_0x7b85('0x17')]||null:null,'include':_0x40ebb5[_0x7b85('0x15')]?_0x40ebb5[_0x7b85('0x15')][_0x7b85('0x18')]?_[_0x7b85('0x19')](_0x40ebb5[_0x7b85('0x15')][_0x7b85('0x18')],function(_0x30533e){return{'model':db[_0x30533e[_0x7b85('0x1a')]],'as':_0x30533e['as'],'attributes':_0x30533e[_0x7b85('0x17')],'include':_0x30533e[_0x7b85('0x18')]?_['map'](_0x30533e['include'],function(_0x2b58e0){return{'model':db[_0x2b58e0[_0x7b85('0x1a')]],'as':_0x2b58e0['as'],'attributes':_0x2b58e0[_0x7b85('0x17')],'include':_0x2b58e0[_0x7b85('0x18')]?_['map'](_0x2b58e0['include'],function(_0x495f3c){return{'model':db[_0x495f3c[_0x7b85('0x1a')]],'as':_0x495f3c['as'],'attributes':_0x495f3c[_0x7b85('0x17')]};}):[]};}):[]};}):[]:[]})[_0x7b85('0x9')](function(_0x2a39a4){logger[_0x7b85('0x10')](_0x7b85('0x1d'),_0x40ebb5);logger['debug']('ShowDeskAccount',_0x40ebb5,JSON[_0x7b85('0xd')](_0x2a39a4));_0x538eac(_0x2a39a4);})[_0x7b85('0x11')](function(_0x270c64){logger[_0x7b85('0xe')](_0x7b85('0x1d'),_0x270c64[_0x7b85('0xf')],_0x40ebb5);_0x1a33f0(_0x50b1cd[_0x7b85('0xe')](0x1f4,_0x270c64[_0x7b85('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/index.js b/server/api/intDeskConfiguration/index.js index 066d792..b4a290a 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 _0x7217=['getDescriptions','/:id/tags','post','setTags','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./intDeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions'];(function(_0xa42766,_0xbc412f){var _0x512a37=function(_0x443255){while(--_0x443255){_0xa42766['push'](_0xa42766['shift']());}};_0x512a37(++_0xbc412f);}(_0x7217,0x19e));var _0x7721=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0x7217[_0x134c2e];return _0x2825db;};'use strict';var multer=require(_0x7721('0x0'));var util=require('util');var path=require(_0x7721('0x1'));var timeout=require(_0x7721('0x2'));var express=require(_0x7721('0x3'));var router=express[_0x7721('0x4')]();var fs_extra=require(_0x7721('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7721('0x6'));var controller=require(_0x7721('0x7'));router[_0x7721('0x8')]('/',auth[_0x7721('0x9')](),controller[_0x7721('0xa')]);router[_0x7721('0x8')](_0x7721('0xb'),auth[_0x7721('0x9')](),controller[_0x7721('0xc')]);router[_0x7721('0x8')](_0x7721('0xd'),auth[_0x7721('0x9')](),controller[_0x7721('0xe')]);router[_0x7721('0x8')](_0x7721('0xf'),auth['isAuthenticated'](),controller[_0x7721('0x10')]);router[_0x7721('0x8')](_0x7721('0x11'),auth[_0x7721('0x9')](),controller[_0x7721('0x12')]);router[_0x7721('0x8')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller['getTags']);router[_0x7721('0x14')]('/',auth[_0x7721('0x9')](),controller['create']);router[_0x7721('0x14')](_0x7721('0x13'),auth[_0x7721('0x9')](),controller[_0x7721('0x15')]);router['put'](_0x7721('0xb'),auth[_0x7721('0x9')](),controller['update']);router['delete']('/:id',auth[_0x7721('0x9')](),controller[_0x7721('0x16')]);module[_0x7721('0x17')]=router; \ No newline at end of file +var _0x9c44=['destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','./intDeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','getSubjects','/:id/descriptions','/:id/tags','post','setTags','put','update'];(function(_0x24a889,_0x3bd303){var _0x47589c=function(_0x599b43){while(--_0x599b43){_0x24a889['push'](_0x24a889['shift']());}};_0x47589c(++_0x3bd303);}(_0x9c44,0x178));var _0x49c4=function(_0xdea41a,_0x552987){_0xdea41a=_0xdea41a-0x0;var _0x15d0d8=_0x9c44[_0xdea41a];return _0x15d0d8;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x49c4('0x6'));router['get']('/',auth[_0x49c4('0x7')](),controller[_0x49c4('0x8')]);router[_0x49c4('0x9')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller['show']);router[_0x49c4('0x9')](_0x49c4('0xb'),auth[_0x49c4('0x7')](),controller[_0x49c4('0xc')]);router['get']('/:id/subjects',auth[_0x49c4('0x7')](),controller[_0x49c4('0xd')]);router['get'](_0x49c4('0xe'),auth[_0x49c4('0x7')](),controller['getDescriptions']);router['get'](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller['getTags']);router[_0x49c4('0x10')]('/',auth[_0x49c4('0x7')](),controller['create']);router[_0x49c4('0x10')](_0x49c4('0xf'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x11')]);router[_0x49c4('0x12')](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x13')]);router['delete'](_0x49c4('0xa'),auth[_0x49c4('0x7')](),controller[_0x49c4('0x14')]);module[_0x49c4('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js b/server/api/intDeskConfiguration/intDeskConfiguration.attributes.js index c61b312..370a991 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 _0x23bf=['STRING','sequelize'];(function(_0x476bf4,_0x2a3755){var _0x788ffe=function(_0x13fa11){while(--_0x13fa11){_0x476bf4['push'](_0x476bf4['shift']());}};_0x788ffe(++_0x2a3755);}(_0x23bf,0x199));var _0xf23b=function(_0x35c1a9,_0x130da5){_0x35c1a9=_0x35c1a9-0x0;var _0x467677=_0x23bf[_0x35c1a9];return _0x467677;};'use strict';var Sequelize=require(_0xf23b('0x0'));module['exports']={'name':{'type':Sequelize[_0xf23b('0x1')]},'description':{'type':Sequelize[_0xf23b('0x1')]}}; \ No newline at end of file +var _0x8d3a=['exports','STRING','sequelize'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x8d3a,0xfe));var _0xa8d3=function(_0x5b7fd3,_0xbea358){_0x5b7fd3=_0x5b7fd3-0x0;var _0x26add4=_0x8d3a[_0x5b7fd3];return _0x26add4;};'use strict';var Sequelize=require(_0xa8d3('0x0'));module[_0xa8d3('0x1')]={'name':{'type':Sequelize[_0xa8d3('0x2')]},'description':{'type':Sequelize[_0xa8d3('0x2')]}}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.controller.js b/server/api/intDeskConfiguration/intDeskConfiguration.controller.js index b720dcd..a040cca 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 _0xdd55=['update','then','destroy','end','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','filters','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','merge','VIRTUAL','filter','options','DeskConfiguration','include','findAll','rows','show','keys','includeAll','find','catch','create','body','params','getFields','pick','nolimit','getSubjects','findOne','DeskField','getDescriptions','Tag','getTags','setTags','eml-format','fast-json-patch','request-promise','moment','bluebird','util','path','sox','ejs','fs-extra','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','limit','Content-Range','reject','save'];(function(_0x18e24c,_0x5d46d8){var _0x3b2c25=function(_0x5afb2e){while(--_0x5afb2e){_0x18e24c['push'](_0x18e24c['shift']());}};_0x3b2c25(++_0x5d46d8);}(_0xdd55,0x1e1));var _0x5dd5=function(_0x5535e5,_0x234954){_0x5535e5=_0x5535e5-0x0;var _0x5e2d52=_0xdd55[_0x5535e5];return _0x5e2d52;};'use strict';var emlformat=require(_0x5dd5('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x5dd5('0x1'));var rp=require(_0x5dd5('0x2'));var moment=require(_0x5dd5('0x3'));var BPromise=require(_0x5dd5('0x4'));var Mustache=require('mustache');var util=require(_0x5dd5('0x5'));var path=require(_0x5dd5('0x6'));var sox=require(_0x5dd5('0x7'));var csv=require('to-csv');var ejs=require(_0x5dd5('0x8'));var fs=require('fs');var fs_extra=require(_0x5dd5('0x9'));var _=require('lodash');var squel=require(_0x5dd5('0xa'));var crypto=require(_0x5dd5('0xb'));var jsforce=require(_0x5dd5('0xc'));var deskjs=require(_0x5dd5('0xd'));var toCsv=require(_0x5dd5('0xe'));var querystring=require(_0x5dd5('0xf'));var Papa=require(_0x5dd5('0x10'));var Redis=require('ioredis');var authService=require(_0x5dd5('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x5dd5('0x12'));var hardwareService=require(_0x5dd5('0x13'));var logger=require(_0x5dd5('0x14'))(_0x5dd5('0x15'));var utils=require(_0x5dd5('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5dd5('0x17'));var db=require(_0x5dd5('0x18'))['db'];function respondWithStatusCode(_0x3dd8cb,_0x7a2783){_0x7a2783=_0x7a2783||0xcc;return function(_0x1579fd){if(_0x1579fd){return _0x3dd8cb[_0x5dd5('0x19')](_0x7a2783);}return _0x3dd8cb['status'](_0x7a2783)['end']();};}function respondWithResult(_0x56c45f,_0x48c3e0){_0x48c3e0=_0x48c3e0||0xc8;return function(_0x32a2ad){if(_0x32a2ad){return _0x56c45f[_0x5dd5('0x1a')](_0x48c3e0)[_0x5dd5('0x1b')](_0x32a2ad);}};}function respondWithFilteredResult(_0x39eff5,_0x38ca30){return function(_0x19c0f6){if(_0x19c0f6){var _0x4abee5=typeof _0x38ca30[_0x5dd5('0x1c')]===_0x5dd5('0x1d')&&typeof _0x38ca30['limit']===_0x5dd5('0x1d');var _0x285783=_0x19c0f6['count'];var _0x30d2f8=_0x4abee5?0x0:_0x38ca30[_0x5dd5('0x1c')];var _0x2555f4=_0x4abee5?_0x19c0f6[_0x5dd5('0x1e')]:_0x38ca30['offset']+_0x38ca30[_0x5dd5('0x1f')];var _0x28de3f;if(_0x2555f4>=_0x285783){_0x2555f4=_0x285783;_0x28de3f=0xc8;}else{_0x28de3f=0xce;}_0x39eff5['status'](_0x28de3f);return _0x39eff5['set'](_0x5dd5('0x20'),_0x30d2f8+'-'+_0x2555f4+'/'+_0x285783)[_0x5dd5('0x1b')](_0x19c0f6);}return null;};}function patchUpdates(_0x1b2b03){return function(_0x5792e5){try{jsonpatch['apply'](_0x5792e5,_0x1b2b03,!![]);}catch(_0x5476f2){return BPromise[_0x5dd5('0x21')](_0x5476f2);}return _0x5792e5[_0x5dd5('0x22')]();};}function saveUpdates(_0x5a697e,_0x291c88){return function(_0x42ea94){if(_0x42ea94){return _0x42ea94[_0x5dd5('0x23')](_0x5a697e)[_0x5dd5('0x24')](function(_0x3f7179){return _0x3f7179;});}return null;};}function removeEntity(_0x4cc98c,_0x2f3279){return function(_0x35163c){if(_0x35163c){return _0x35163c[_0x5dd5('0x25')]()['then'](function(){_0x4cc98c[_0x5dd5('0x1a')](0xcc)[_0x5dd5('0x26')]();});}};}function handleEntityNotFound(_0x9e0188,_0x34b37e){return function(_0x4eac69){if(!_0x4eac69){_0x9e0188[_0x5dd5('0x19')](0x194);}return _0x4eac69;};}function handleError(_0x322baf,_0x502d40){_0x502d40=_0x502d40||0x1f4;return function(_0xa6c1a4){logger[_0x5dd5('0x27')](_0xa6c1a4[_0x5dd5('0x28')]);if(_0xa6c1a4[_0x5dd5('0x29')]){delete _0xa6c1a4[_0x5dd5('0x29')];}_0x322baf[_0x5dd5('0x1a')](_0x502d40)[_0x5dd5('0x2a')](_0xa6c1a4);};}exports[_0x5dd5('0x2b')]=function(_0x23c01c,_0x12a7af){var _0x32b4e0={},_0x11a03c={},_0x5bad4a={'count':0x0,'rows':[]};var _0x606abd=_[_0x5dd5('0x2c')](db['DeskConfiguration'][_0x5dd5('0x2d')],function(_0x5978fe){return{'name':_0x5978fe[_0x5dd5('0x2e')],'type':_0x5978fe[_0x5dd5('0x2f')][_0x5dd5('0x30')]};});_0x11a03c[_0x5dd5('0x31')]=_[_0x5dd5('0x2c')](_0x606abd,'name');_0x11a03c[_0x5dd5('0x32')]=_['keys'](_0x23c01c[_0x5dd5('0x32')]);_0x11a03c[_0x5dd5('0x33')]=_['intersection'](_0x11a03c[_0x5dd5('0x31')],_0x11a03c['query']);_0x32b4e0[_0x5dd5('0x34')]=_[_0x5dd5('0x35')](_0x11a03c['model'],qs[_0x5dd5('0x36')](_0x23c01c[_0x5dd5('0x32')]['fields']));_0x32b4e0[_0x5dd5('0x34')]=_0x32b4e0['attributes'][_0x5dd5('0x37')]?_0x32b4e0[_0x5dd5('0x34')]:_0x11a03c[_0x5dd5('0x31')];if(!_0x23c01c['query'][_0x5dd5('0x38')]('nolimit')){_0x32b4e0[_0x5dd5('0x1f')]=qs[_0x5dd5('0x1f')](_0x23c01c[_0x5dd5('0x32')][_0x5dd5('0x1f')]);_0x32b4e0[_0x5dd5('0x1c')]=qs[_0x5dd5('0x1c')](_0x23c01c[_0x5dd5('0x32')][_0x5dd5('0x1c')]);}_0x32b4e0[_0x5dd5('0x39')]=qs[_0x5dd5('0x3a')](_0x23c01c[_0x5dd5('0x32')][_0x5dd5('0x3a')]);_0x32b4e0[_0x5dd5('0x3b')]=qs[_0x5dd5('0x33')](_['pick'](_0x23c01c[_0x5dd5('0x32')],_0x11a03c[_0x5dd5('0x33')]),_0x606abd);if(_0x23c01c[_0x5dd5('0x32')]['filter']){_0x32b4e0[_0x5dd5('0x3b')]=_[_0x5dd5('0x3c')](_0x32b4e0[_0x5dd5('0x3b')],{'$or':_['map'](_0x606abd,function(_0x5f0007){if(_0x5f0007[_0x5dd5('0x2f')]!==_0x5dd5('0x3d')){var _0x1bf9ce={};_0x1bf9ce[_0x5f0007[_0x5dd5('0x29')]]={'$like':'%'+_0x23c01c[_0x5dd5('0x32')][_0x5dd5('0x3e')]+'%'};return _0x1bf9ce;}})});}_0x32b4e0=_[_0x5dd5('0x3c')]({},_0x32b4e0,_0x23c01c[_0x5dd5('0x3f')]);var _0x474c6a={'where':_0x32b4e0[_0x5dd5('0x3b')]};return db[_0x5dd5('0x40')]['count'](_0x474c6a)['then'](function(_0x5f2472){_0x5bad4a['count']=_0x5f2472;if(_0x23c01c[_0x5dd5('0x32')]['includeAll']){_0x32b4e0[_0x5dd5('0x41')]=[{'all':!![]}];}return db['DeskConfiguration'][_0x5dd5('0x42')](_0x32b4e0);})[_0x5dd5('0x24')](function(_0x4954aa){_0x5bad4a[_0x5dd5('0x43')]=_0x4954aa;return _0x5bad4a;})[_0x5dd5('0x24')](respondWithFilteredResult(_0x12a7af,_0x32b4e0))['catch'](handleError(_0x12a7af,null));};exports[_0x5dd5('0x44')]=function(_0x3eced6,_0x429210){var _0x394d49={'raw':![],'where':{'id':_0x3eced6['params']['id']}},_0x445eb0={};_0x445eb0[_0x5dd5('0x31')]=_[_0x5dd5('0x45')](db[_0x5dd5('0x40')][_0x5dd5('0x2d')]);_0x445eb0[_0x5dd5('0x32')]=_[_0x5dd5('0x45')](_0x3eced6[_0x5dd5('0x32')]);_0x445eb0[_0x5dd5('0x33')]=_[_0x5dd5('0x35')](_0x445eb0[_0x5dd5('0x31')],_0x445eb0[_0x5dd5('0x32')]);_0x394d49[_0x5dd5('0x34')]=_[_0x5dd5('0x35')](_0x445eb0[_0x5dd5('0x31')],qs[_0x5dd5('0x36')](_0x3eced6['query'][_0x5dd5('0x36')]));_0x394d49[_0x5dd5('0x34')]=_0x394d49[_0x5dd5('0x34')][_0x5dd5('0x37')]?_0x394d49[_0x5dd5('0x34')]:_0x445eb0['model'];if(_0x3eced6[_0x5dd5('0x32')][_0x5dd5('0x46')]){_0x394d49[_0x5dd5('0x41')]=[{'all':!![]}];}_0x394d49=_[_0x5dd5('0x3c')]({},_0x394d49,_0x3eced6[_0x5dd5('0x3f')]);return db[_0x5dd5('0x40')][_0x5dd5('0x47')](_0x394d49)[_0x5dd5('0x24')](handleEntityNotFound(_0x429210,null))[_0x5dd5('0x24')](respondWithResult(_0x429210,null))[_0x5dd5('0x48')](handleError(_0x429210,null));};exports[_0x5dd5('0x49')]=function(_0x292c6d,_0x1557be){return db[_0x5dd5('0x40')][_0x5dd5('0x49')](_0x292c6d['body'],{})[_0x5dd5('0x24')](respondWithResult(_0x1557be,0xc9))[_0x5dd5('0x48')](handleError(_0x1557be,null));};exports[_0x5dd5('0x23')]=function(_0x1f943c,_0x3b2c8d){if(_0x1f943c[_0x5dd5('0x4a')]['id']){delete _0x1f943c['body']['id'];}return db['DeskConfiguration']['find']({'where':{'id':_0x1f943c[_0x5dd5('0x4b')]['id']}})[_0x5dd5('0x24')](handleEntityNotFound(_0x3b2c8d,null))[_0x5dd5('0x24')](saveUpdates(_0x1f943c['body'],null))[_0x5dd5('0x24')](respondWithResult(_0x3b2c8d,null))[_0x5dd5('0x48')](handleError(_0x3b2c8d,null));};exports[_0x5dd5('0x25')]=function(_0x9c12a4,_0x3dabb8){return db['DeskConfiguration'][_0x5dd5('0x47')]({'where':{'id':_0x9c12a4['params']['id']}})[_0x5dd5('0x24')](handleEntityNotFound(_0x3dabb8,null))['then'](removeEntity(_0x3dabb8,null))[_0x5dd5('0x48')](handleError(_0x3dabb8,null));};exports[_0x5dd5('0x4c')]=function(_0x4440b8,_0x4a298f,_0x209640){var _0x15a380={};var _0x157311={};var _0x340628;var _0x2269a6;return db['DeskConfiguration']['findOne']({'where':{'id':_0x4440b8[_0x5dd5('0x4b')]['id']}})[_0x5dd5('0x24')](handleEntityNotFound(_0x4a298f,null))[_0x5dd5('0x24')](function(_0x554682){if(_0x554682){_0x340628=_0x554682;_0x157311['model']=_[_0x5dd5('0x45')](db['DeskField'][_0x5dd5('0x2d')]);_0x157311[_0x5dd5('0x32')]=_[_0x5dd5('0x45')](_0x4440b8[_0x5dd5('0x32')]);_0x157311['filters']=_[_0x5dd5('0x35')](_0x157311[_0x5dd5('0x31')],_0x157311['query']);_0x15a380[_0x5dd5('0x34')]=_['intersection'](_0x157311[_0x5dd5('0x31')],qs[_0x5dd5('0x36')](_0x4440b8[_0x5dd5('0x32')][_0x5dd5('0x36')]));_0x15a380['attributes']=_0x15a380[_0x5dd5('0x34')]['length']?_0x15a380[_0x5dd5('0x34')]:_0x157311[_0x5dd5('0x31')];_0x15a380[_0x5dd5('0x39')]=qs[_0x5dd5('0x3a')](_0x4440b8[_0x5dd5('0x32')][_0x5dd5('0x3a')]);_0x15a380['where']=qs[_0x5dd5('0x33')](_[_0x5dd5('0x4d')](_0x4440b8[_0x5dd5('0x32')],_0x157311[_0x5dd5('0x33')]));if(_0x4440b8[_0x5dd5('0x32')][_0x5dd5('0x3e')]){_0x15a380[_0x5dd5('0x3b')]=_[_0x5dd5('0x3c')](_0x15a380[_0x5dd5('0x3b')],{'$or':_['map'](_0x15a380[_0x5dd5('0x34')],function(_0xb332e8){var _0x36d908={};_0x36d908[_0xb332e8]={'$like':'%'+_0x4440b8[_0x5dd5('0x32')][_0x5dd5('0x3e')]+'%'};return _0x36d908;})});}_0x15a380=_[_0x5dd5('0x3c')]({},_0x15a380,_0x4440b8['options']);return _0x340628[_0x5dd5('0x4c')](_0x15a380);}})['then'](function(_0x2270fa){if(_0x2270fa){_0x2269a6=_0x2270fa[_0x5dd5('0x37')];if(!_0x4440b8[_0x5dd5('0x32')][_0x5dd5('0x38')](_0x5dd5('0x4e'))){_0x15a380[_0x5dd5('0x1f')]=qs['limit'](_0x4440b8[_0x5dd5('0x32')]['limit']);_0x15a380[_0x5dd5('0x1c')]=qs[_0x5dd5('0x1c')](_0x4440b8[_0x5dd5('0x32')][_0x5dd5('0x1c')]);}return _0x340628[_0x5dd5('0x4c')](_0x15a380);}})[_0x5dd5('0x24')](function(_0xe6e3fd){if(_0xe6e3fd){return _0xe6e3fd?{'count':_0x2269a6,'rows':_0xe6e3fd}:null;}})[_0x5dd5('0x24')](respondWithResult(_0x4a298f,null))[_0x5dd5('0x48')](handleError(_0x4a298f,null));};exports[_0x5dd5('0x4f')]=function(_0x2ae720,_0x5e45f0,_0x22b3b8){var _0x47b98a={};var _0x35172c={};var _0x48a120;var _0x1bf840;return db[_0x5dd5('0x40')][_0x5dd5('0x50')]({'where':{'id':_0x2ae720[_0x5dd5('0x4b')]['id']}})[_0x5dd5('0x24')](handleEntityNotFound(_0x5e45f0,null))[_0x5dd5('0x24')](function(_0x1f8de8){if(_0x1f8de8){_0x48a120=_0x1f8de8;_0x35172c['model']=_[_0x5dd5('0x45')](db[_0x5dd5('0x51')][_0x5dd5('0x2d')]);_0x35172c[_0x5dd5('0x32')]=_[_0x5dd5('0x45')](_0x2ae720[_0x5dd5('0x32')]);_0x35172c[_0x5dd5('0x33')]=_['intersection'](_0x35172c[_0x5dd5('0x31')],_0x35172c[_0x5dd5('0x32')]);_0x47b98a[_0x5dd5('0x34')]=_['intersection'](_0x35172c[_0x5dd5('0x31')],qs[_0x5dd5('0x36')](_0x2ae720['query'][_0x5dd5('0x36')]));_0x47b98a['attributes']=_0x47b98a[_0x5dd5('0x34')][_0x5dd5('0x37')]?_0x47b98a[_0x5dd5('0x34')]:_0x35172c[_0x5dd5('0x31')];_0x47b98a[_0x5dd5('0x39')]=qs[_0x5dd5('0x3a')](_0x2ae720[_0x5dd5('0x32')][_0x5dd5('0x3a')]);_0x47b98a[_0x5dd5('0x3b')]=qs[_0x5dd5('0x33')](_['pick'](_0x2ae720['query'],_0x35172c['filters']));if(_0x2ae720[_0x5dd5('0x32')]['filter']){_0x47b98a[_0x5dd5('0x3b')]=_['merge'](_0x47b98a[_0x5dd5('0x3b')],{'$or':_[_0x5dd5('0x2c')](_0x47b98a[_0x5dd5('0x34')],function(_0x416583){var _0xd2e2b2={};_0xd2e2b2[_0x416583]={'$like':'%'+_0x2ae720[_0x5dd5('0x32')][_0x5dd5('0x3e')]+'%'};return _0xd2e2b2;})});}_0x47b98a=_[_0x5dd5('0x3c')]({},_0x47b98a,_0x2ae720[_0x5dd5('0x3f')]);return _0x48a120[_0x5dd5('0x4f')](_0x47b98a);}})[_0x5dd5('0x24')](function(_0xc3358d){if(_0xc3358d){_0x1bf840=_0xc3358d[_0x5dd5('0x37')];if(!_0x2ae720[_0x5dd5('0x32')][_0x5dd5('0x38')]('nolimit')){_0x47b98a['limit']=qs[_0x5dd5('0x1f')](_0x2ae720['query'][_0x5dd5('0x1f')]);_0x47b98a[_0x5dd5('0x1c')]=qs[_0x5dd5('0x1c')](_0x2ae720[_0x5dd5('0x32')][_0x5dd5('0x1c')]);}return _0x48a120[_0x5dd5('0x4f')](_0x47b98a);}})[_0x5dd5('0x24')](function(_0x5f1ceb){if(_0x5f1ceb){return _0x5f1ceb?{'count':_0x1bf840,'rows':_0x5f1ceb}:null;}})['then'](respondWithResult(_0x5e45f0,null))['catch'](handleError(_0x5e45f0,null));};exports['getDescriptions']=function(_0x2da8cf,_0x1cf55b,_0xdce482){var _0x38e2fb={};var _0x1e0754={};var _0x1684b5;var _0x24c12c;return db['DeskConfiguration'][_0x5dd5('0x50')]({'where':{'id':_0x2da8cf['params']['id']}})[_0x5dd5('0x24')](handleEntityNotFound(_0x1cf55b,null))[_0x5dd5('0x24')](function(_0x3651b1){if(_0x3651b1){_0x1684b5=_0x3651b1;_0x1e0754[_0x5dd5('0x31')]=_[_0x5dd5('0x45')](db[_0x5dd5('0x51')]['rawAttributes']);_0x1e0754[_0x5dd5('0x32')]=_[_0x5dd5('0x45')](_0x2da8cf[_0x5dd5('0x32')]);_0x1e0754[_0x5dd5('0x33')]=_['intersection'](_0x1e0754[_0x5dd5('0x31')],_0x1e0754['query']);_0x38e2fb[_0x5dd5('0x34')]=_['intersection'](_0x1e0754[_0x5dd5('0x31')],qs['fields'](_0x2da8cf[_0x5dd5('0x32')][_0x5dd5('0x36')]));_0x38e2fb[_0x5dd5('0x34')]=_0x38e2fb['attributes'][_0x5dd5('0x37')]?_0x38e2fb['attributes']:_0x1e0754[_0x5dd5('0x31')];_0x38e2fb[_0x5dd5('0x39')]=qs['sort'](_0x2da8cf[_0x5dd5('0x32')]['sort']);_0x38e2fb[_0x5dd5('0x3b')]=qs[_0x5dd5('0x33')](_[_0x5dd5('0x4d')](_0x2da8cf[_0x5dd5('0x32')],_0x1e0754[_0x5dd5('0x33')]));if(_0x2da8cf['query'][_0x5dd5('0x3e')]){_0x38e2fb[_0x5dd5('0x3b')]=_['merge'](_0x38e2fb[_0x5dd5('0x3b')],{'$or':_[_0x5dd5('0x2c')](_0x38e2fb[_0x5dd5('0x34')],function(_0x730d00){var _0xcdae3d={};_0xcdae3d[_0x730d00]={'$like':'%'+_0x2da8cf[_0x5dd5('0x32')][_0x5dd5('0x3e')]+'%'};return _0xcdae3d;})});}_0x38e2fb=_[_0x5dd5('0x3c')]({},_0x38e2fb,_0x2da8cf[_0x5dd5('0x3f')]);return _0x1684b5[_0x5dd5('0x52')](_0x38e2fb);}})[_0x5dd5('0x24')](function(_0x3cf3c8){if(_0x3cf3c8){_0x24c12c=_0x3cf3c8[_0x5dd5('0x37')];if(!_0x2da8cf['query'][_0x5dd5('0x38')](_0x5dd5('0x4e'))){_0x38e2fb[_0x5dd5('0x1f')]=qs[_0x5dd5('0x1f')](_0x2da8cf[_0x5dd5('0x32')][_0x5dd5('0x1f')]);_0x38e2fb[_0x5dd5('0x1c')]=qs[_0x5dd5('0x1c')](_0x2da8cf[_0x5dd5('0x32')][_0x5dd5('0x1c')]);}return _0x1684b5[_0x5dd5('0x52')](_0x38e2fb);}})[_0x5dd5('0x24')](function(_0xcc8ce6){if(_0xcc8ce6){return _0xcc8ce6?{'count':_0x24c12c,'rows':_0xcc8ce6}:null;}})['then'](respondWithResult(_0x1cf55b,null))[_0x5dd5('0x48')](handleError(_0x1cf55b,null));};exports['getTags']=function(_0x2c38ab,_0x42ea4f,_0x224d26){var _0x4a0539={};var _0xf862f2={};var _0x9a362d;var _0x44e743;return db[_0x5dd5('0x40')][_0x5dd5('0x50')]({'where':{'id':_0x2c38ab['params']['id']}})[_0x5dd5('0x24')](handleEntityNotFound(_0x42ea4f,null))[_0x5dd5('0x24')](function(_0x400d20){if(_0x400d20){_0x9a362d=_0x400d20;_0xf862f2['model']=_[_0x5dd5('0x45')](db[_0x5dd5('0x53')]['rawAttributes']);_0xf862f2[_0x5dd5('0x32')]=_['keys'](_0x2c38ab['query']);_0xf862f2['filters']=_['intersection'](_0xf862f2[_0x5dd5('0x31')],_0xf862f2[_0x5dd5('0x32')]);_0x4a0539['attributes']=_['intersection'](_0xf862f2[_0x5dd5('0x31')],qs[_0x5dd5('0x36')](_0x2c38ab[_0x5dd5('0x32')][_0x5dd5('0x36')]));_0x4a0539[_0x5dd5('0x34')]=_0x4a0539[_0x5dd5('0x34')][_0x5dd5('0x37')]?_0x4a0539[_0x5dd5('0x34')]:_0xf862f2[_0x5dd5('0x31')];_0x4a0539[_0x5dd5('0x39')]=qs['sort'](_0x2c38ab[_0x5dd5('0x32')][_0x5dd5('0x3a')]);_0x4a0539[_0x5dd5('0x3b')]=qs['filters'](_['pick'](_0x2c38ab[_0x5dd5('0x32')],_0xf862f2[_0x5dd5('0x33')]));if(_0x2c38ab[_0x5dd5('0x32')][_0x5dd5('0x3e')]){_0x4a0539['where']=_[_0x5dd5('0x3c')](_0x4a0539[_0x5dd5('0x3b')],{'$or':_['map'](_0x4a0539[_0x5dd5('0x34')],function(_0x47cb92){var _0xe9e47c={};_0xe9e47c[_0x47cb92]={'$like':'%'+_0x2c38ab['query']['filter']+'%'};return _0xe9e47c;})});}_0x4a0539=_['merge']({},_0x4a0539,_0x2c38ab[_0x5dd5('0x3f')]);return _0x9a362d[_0x5dd5('0x54')](_0x4a0539);}})['then'](function(_0x17e35d){if(_0x17e35d){_0x44e743=_0x17e35d[_0x5dd5('0x37')];if(!_0x2c38ab[_0x5dd5('0x32')][_0x5dd5('0x38')](_0x5dd5('0x4e'))){_0x4a0539['limit']=qs[_0x5dd5('0x1f')](_0x2c38ab[_0x5dd5('0x32')]['limit']);_0x4a0539[_0x5dd5('0x1c')]=qs[_0x5dd5('0x1c')](_0x2c38ab[_0x5dd5('0x32')][_0x5dd5('0x1c')]);}return _0x9a362d['getTags'](_0x4a0539);}})[_0x5dd5('0x24')](function(_0x3fe98a){if(_0x3fe98a){return _0x3fe98a?{'count':_0x44e743,'rows':_0x3fe98a}:null;}})[_0x5dd5('0x24')](respondWithResult(_0x42ea4f,null))[_0x5dd5('0x48')](handleError(_0x42ea4f,null));};exports['setTags']=function(_0xaa6332,_0x1d90bc,_0x4143be){if(_0xaa6332[_0x5dd5('0x4a')]['id']){delete _0xaa6332['body']['id'];}return db['DeskConfiguration'][_0x5dd5('0x50')]({'where':{'id':_0xaa6332[_0x5dd5('0x4b')]['id']}})[_0x5dd5('0x24')](handleEntityNotFound(_0x1d90bc,null))['then'](function(_0x462680){if(_0x462680){return _0x462680[_0x5dd5('0x55')](_0xaa6332[_0x5dd5('0x4a')]['ids']||[]);}return null;})[_0x5dd5('0x24')](respondWithResult(_0x1d90bc,null))[_0x5dd5('0x48')](handleError(_0x1d90bc,null));}; \ No newline at end of file +var _0x110f=['../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','DeskConfiguration','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','options','include','rows','catch','show','params','includeAll','find','create','body','getFields','findOne','DeskField','nolimit','getSubjects','getDescriptions','getTags','setTags','ids','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','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/logger','api','../../config/utils','../../config/environment'];(function(_0x5b644e,_0x2e5e07){var _0x49c6bf=function(_0x3032d9){while(--_0x3032d9){_0x5b644e['push'](_0x5b644e['shift']());}};_0x49c6bf(++_0x2e5e07);}(_0x110f,0x95));var _0xf110=function(_0x17272b,_0x35cc11){_0x17272b=_0x17272b-0x0;var _0x904559=_0x110f[_0x17272b];return _0x904559;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xf110('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf110('0x1'));var rp=require(_0xf110('0x2'));var moment=require(_0xf110('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xf110('0x4'));var util=require(_0xf110('0x5'));var path=require(_0xf110('0x6'));var sox=require(_0xf110('0x7'));var csv=require(_0xf110('0x8'));var ejs=require(_0xf110('0x9'));var fs=require('fs');var fs_extra=require(_0xf110('0xa'));var _=require('lodash');var squel=require(_0xf110('0xb'));var crypto=require(_0xf110('0xc'));var jsforce=require(_0xf110('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xf110('0x8'));var querystring=require(_0xf110('0xe'));var Papa=require(_0xf110('0xf'));var Redis=require(_0xf110('0x10'));var authService=require(_0xf110('0x11'));var qs=require(_0xf110('0x12'));var as=require(_0xf110('0x13'));var hardwareService=require(_0xf110('0x14'));var logger=require(_0xf110('0x15'))(_0xf110('0x16'));var utils=require(_0xf110('0x17'));var config=require(_0xf110('0x18'));var licenseUtil=require(_0xf110('0x19'));var db=require(_0xf110('0x1a'))['db'];function respondWithStatusCode(_0x2048d3,_0x57505a){_0x57505a=_0x57505a||0xcc;return function(_0x5e3096){if(_0x5e3096){return _0x2048d3['sendStatus'](_0x57505a);}return _0x2048d3[_0xf110('0x1b')](_0x57505a)['end']();};}function respondWithResult(_0x92bcf2,_0x6ba7b1){_0x6ba7b1=_0x6ba7b1||0xc8;return function(_0xfcbf61){if(_0xfcbf61){return _0x92bcf2[_0xf110('0x1b')](_0x6ba7b1)[_0xf110('0x1c')](_0xfcbf61);}};}function respondWithFilteredResult(_0x3d99cb,_0x202188){return function(_0x3c9a56){if(_0x3c9a56){var _0x1cdeb3=typeof _0x202188[_0xf110('0x1d')]===_0xf110('0x1e')&&typeof _0x202188[_0xf110('0x1f')]===_0xf110('0x1e');var _0x1d9a4c=_0x3c9a56[_0xf110('0x20')];var _0x4d37ff=_0x1cdeb3?0x0:_0x202188[_0xf110('0x1d')];var _0x1a2e49=_0x1cdeb3?_0x3c9a56[_0xf110('0x20')]:_0x202188[_0xf110('0x1d')]+_0x202188[_0xf110('0x1f')];var _0x472676;if(_0x1a2e49>=_0x1d9a4c){_0x1a2e49=_0x1d9a4c;_0x472676=0xc8;}else{_0x472676=0xce;}_0x3d99cb['status'](_0x472676);return _0x3d99cb[_0xf110('0x21')](_0xf110('0x22'),_0x4d37ff+'-'+_0x1a2e49+'/'+_0x1d9a4c)[_0xf110('0x1c')](_0x3c9a56);}return null;};}function patchUpdates(_0x145388){return function(_0x5b7287){try{jsonpatch[_0xf110('0x23')](_0x5b7287,_0x145388,!![]);}catch(_0x253cde){return BPromise['reject'](_0x253cde);}return _0x5b7287[_0xf110('0x24')]();};}function saveUpdates(_0x2ae677,_0x2be237){return function(_0x28b351){if(_0x28b351){return _0x28b351[_0xf110('0x25')](_0x2ae677)[_0xf110('0x26')](function(_0xd637d5){return _0xd637d5;});}return null;};}function removeEntity(_0x2cd5b1,_0x1b1971){return function(_0x4f0935){if(_0x4f0935){return _0x4f0935[_0xf110('0x27')]()['then'](function(){_0x2cd5b1[_0xf110('0x1b')](0xcc)[_0xf110('0x28')]();});}};}function handleEntityNotFound(_0x4d3cdf,_0x3d553d){return function(_0x3272a6){if(!_0x3272a6){_0x4d3cdf[_0xf110('0x29')](0x194);}return _0x3272a6;};}function handleError(_0x4e8c0f,_0x514cc9){_0x514cc9=_0x514cc9||0x1f4;return function(_0x28767e){logger[_0xf110('0x2a')](_0x28767e[_0xf110('0x2b')]);if(_0x28767e[_0xf110('0x2c')]){delete _0x28767e[_0xf110('0x2c')];}_0x4e8c0f[_0xf110('0x1b')](_0x514cc9)[_0xf110('0x2d')](_0x28767e);};}exports[_0xf110('0x2e')]=function(_0x494525,_0x29de57){var _0x19fe2f={},_0x378880={},_0x540f7f={'count':0x0,'rows':[]};var _0x4d6684=_[_0xf110('0x2f')](db[_0xf110('0x30')][_0xf110('0x31')],function(_0x4896c4){return{'name':_0x4896c4[_0xf110('0x32')],'type':_0x4896c4[_0xf110('0x33')]['key']};});_0x378880[_0xf110('0x34')]=_[_0xf110('0x2f')](_0x4d6684,_0xf110('0x2c'));_0x378880[_0xf110('0x35')]=_[_0xf110('0x36')](_0x494525['query']);_0x378880[_0xf110('0x37')]=_[_0xf110('0x38')](_0x378880['model'],_0x378880[_0xf110('0x35')]);_0x19fe2f[_0xf110('0x39')]=_[_0xf110('0x38')](_0x378880['model'],qs[_0xf110('0x3a')](_0x494525['query'][_0xf110('0x3a')]));_0x19fe2f['attributes']=_0x19fe2f[_0xf110('0x39')][_0xf110('0x3b')]?_0x19fe2f[_0xf110('0x39')]:_0x378880[_0xf110('0x34')];if(!_0x494525[_0xf110('0x35')][_0xf110('0x3c')]('nolimit')){_0x19fe2f[_0xf110('0x1f')]=qs['limit'](_0x494525['query'][_0xf110('0x1f')]);_0x19fe2f[_0xf110('0x1d')]=qs[_0xf110('0x1d')](_0x494525[_0xf110('0x35')][_0xf110('0x1d')]);}_0x19fe2f[_0xf110('0x3d')]=qs[_0xf110('0x3e')](_0x494525[_0xf110('0x35')][_0xf110('0x3e')]);_0x19fe2f[_0xf110('0x3f')]=qs[_0xf110('0x37')](_[_0xf110('0x40')](_0x494525['query'],_0x378880[_0xf110('0x37')]),_0x4d6684);if(_0x494525['query']['filter']){_0x19fe2f[_0xf110('0x3f')]=_[_0xf110('0x41')](_0x19fe2f[_0xf110('0x3f')],{'$or':_['map'](_0x4d6684,function(_0x2c971e){if(_0x2c971e[_0xf110('0x33')]!==_0xf110('0x42')){var _0x471c55={};_0x471c55[_0x2c971e[_0xf110('0x2c')]]={'$like':'%'+_0x494525[_0xf110('0x35')][_0xf110('0x43')]+'%'};return _0x471c55;}})});}_0x19fe2f=_['merge']({},_0x19fe2f,_0x494525[_0xf110('0x44')]);var _0x275bc1={'where':_0x19fe2f[_0xf110('0x3f')]};return db[_0xf110('0x30')][_0xf110('0x20')](_0x275bc1)['then'](function(_0x528802){_0x540f7f['count']=_0x528802;if(_0x494525[_0xf110('0x35')]['includeAll']){_0x19fe2f[_0xf110('0x45')]=[{'all':!![]}];}return db[_0xf110('0x30')]['findAll'](_0x19fe2f);})[_0xf110('0x26')](function(_0xa09746){_0x540f7f[_0xf110('0x46')]=_0xa09746;return _0x540f7f;})['then'](respondWithFilteredResult(_0x29de57,_0x19fe2f))[_0xf110('0x47')](handleError(_0x29de57,null));};exports[_0xf110('0x48')]=function(_0x1275ee,_0x4fe377){var _0x698026={'raw':![],'where':{'id':_0x1275ee[_0xf110('0x49')]['id']}},_0x306270={};_0x306270[_0xf110('0x34')]=_[_0xf110('0x36')](db[_0xf110('0x30')][_0xf110('0x31')]);_0x306270[_0xf110('0x35')]=_[_0xf110('0x36')](_0x1275ee['query']);_0x306270[_0xf110('0x37')]=_[_0xf110('0x38')](_0x306270[_0xf110('0x34')],_0x306270['query']);_0x698026[_0xf110('0x39')]=_[_0xf110('0x38')](_0x306270['model'],qs[_0xf110('0x3a')](_0x1275ee['query'][_0xf110('0x3a')]));_0x698026[_0xf110('0x39')]=_0x698026[_0xf110('0x39')][_0xf110('0x3b')]?_0x698026[_0xf110('0x39')]:_0x306270[_0xf110('0x34')];if(_0x1275ee[_0xf110('0x35')][_0xf110('0x4a')]){_0x698026['include']=[{'all':!![]}];}_0x698026=_[_0xf110('0x41')]({},_0x698026,_0x1275ee[_0xf110('0x44')]);return db[_0xf110('0x30')][_0xf110('0x4b')](_0x698026)[_0xf110('0x26')](handleEntityNotFound(_0x4fe377,null))['then'](respondWithResult(_0x4fe377,null))[_0xf110('0x47')](handleError(_0x4fe377,null));};exports[_0xf110('0x4c')]=function(_0x5a6b78,_0x11d28a){return db['DeskConfiguration'][_0xf110('0x4c')](_0x5a6b78[_0xf110('0x4d')],{})[_0xf110('0x26')](respondWithResult(_0x11d28a,0xc9))[_0xf110('0x47')](handleError(_0x11d28a,null));};exports[_0xf110('0x25')]=function(_0x1963a6,_0x11a3d0){if(_0x1963a6['body']['id']){delete _0x1963a6[_0xf110('0x4d')]['id'];}return db['DeskConfiguration'][_0xf110('0x4b')]({'where':{'id':_0x1963a6[_0xf110('0x49')]['id']}})[_0xf110('0x26')](handleEntityNotFound(_0x11a3d0,null))[_0xf110('0x26')](saveUpdates(_0x1963a6[_0xf110('0x4d')],null))['then'](respondWithResult(_0x11a3d0,null))[_0xf110('0x47')](handleError(_0x11a3d0,null));};exports[_0xf110('0x27')]=function(_0x28f5c6,_0x3dd25b){return db['DeskConfiguration'][_0xf110('0x4b')]({'where':{'id':_0x28f5c6['params']['id']}})['then'](handleEntityNotFound(_0x3dd25b,null))['then'](removeEntity(_0x3dd25b,null))[_0xf110('0x47')](handleError(_0x3dd25b,null));};exports[_0xf110('0x4e')]=function(_0x371f37,_0x12fdd5,_0x2cc96f){var _0x2fb183={};var _0x4a5c79={};var _0x16ac6a;var _0x4f3180;return db[_0xf110('0x30')][_0xf110('0x4f')]({'where':{'id':_0x371f37['params']['id']}})['then'](handleEntityNotFound(_0x12fdd5,null))[_0xf110('0x26')](function(_0x5bc0e2){if(_0x5bc0e2){_0x16ac6a=_0x5bc0e2;_0x4a5c79[_0xf110('0x34')]=_[_0xf110('0x36')](db[_0xf110('0x50')]['rawAttributes']);_0x4a5c79['query']=_[_0xf110('0x36')](_0x371f37[_0xf110('0x35')]);_0x4a5c79[_0xf110('0x37')]=_[_0xf110('0x38')](_0x4a5c79[_0xf110('0x34')],_0x4a5c79[_0xf110('0x35')]);_0x2fb183[_0xf110('0x39')]=_['intersection'](_0x4a5c79[_0xf110('0x34')],qs[_0xf110('0x3a')](_0x371f37[_0xf110('0x35')][_0xf110('0x3a')]));_0x2fb183[_0xf110('0x39')]=_0x2fb183[_0xf110('0x39')][_0xf110('0x3b')]?_0x2fb183[_0xf110('0x39')]:_0x4a5c79[_0xf110('0x34')];_0x2fb183[_0xf110('0x3d')]=qs['sort'](_0x371f37[_0xf110('0x35')]['sort']);_0x2fb183[_0xf110('0x3f')]=qs[_0xf110('0x37')](_[_0xf110('0x40')](_0x371f37['query'],_0x4a5c79['filters']));if(_0x371f37['query'][_0xf110('0x43')]){_0x2fb183[_0xf110('0x3f')]=_[_0xf110('0x41')](_0x2fb183[_0xf110('0x3f')],{'$or':_[_0xf110('0x2f')](_0x2fb183[_0xf110('0x39')],function(_0xc8c221){var _0x3af3fa={};_0x3af3fa[_0xc8c221]={'$like':'%'+_0x371f37[_0xf110('0x35')]['filter']+'%'};return _0x3af3fa;})});}_0x2fb183=_[_0xf110('0x41')]({},_0x2fb183,_0x371f37[_0xf110('0x44')]);return _0x16ac6a[_0xf110('0x4e')](_0x2fb183);}})[_0xf110('0x26')](function(_0x3f5ee2){if(_0x3f5ee2){_0x4f3180=_0x3f5ee2['length'];if(!_0x371f37['query'][_0xf110('0x3c')](_0xf110('0x51'))){_0x2fb183[_0xf110('0x1f')]=qs[_0xf110('0x1f')](_0x371f37[_0xf110('0x35')][_0xf110('0x1f')]);_0x2fb183['offset']=qs['offset'](_0x371f37[_0xf110('0x35')][_0xf110('0x1d')]);}return _0x16ac6a[_0xf110('0x4e')](_0x2fb183);}})['then'](function(_0x7c0b7a){if(_0x7c0b7a){return _0x7c0b7a?{'count':_0x4f3180,'rows':_0x7c0b7a}:null;}})['then'](respondWithResult(_0x12fdd5,null))[_0xf110('0x47')](handleError(_0x12fdd5,null));};exports[_0xf110('0x52')]=function(_0x1363ce,_0x335042,_0x3e33ca){var _0x502747={};var _0x233323={};var _0x477e33;var _0x1e762b;return db[_0xf110('0x30')]['findOne']({'where':{'id':_0x1363ce[_0xf110('0x49')]['id']}})[_0xf110('0x26')](handleEntityNotFound(_0x335042,null))['then'](function(_0x579598){if(_0x579598){_0x477e33=_0x579598;_0x233323[_0xf110('0x34')]=_[_0xf110('0x36')](db[_0xf110('0x50')][_0xf110('0x31')]);_0x233323[_0xf110('0x35')]=_['keys'](_0x1363ce[_0xf110('0x35')]);_0x233323[_0xf110('0x37')]=_[_0xf110('0x38')](_0x233323['model'],_0x233323['query']);_0x502747['attributes']=_[_0xf110('0x38')](_0x233323[_0xf110('0x34')],qs[_0xf110('0x3a')](_0x1363ce[_0xf110('0x35')][_0xf110('0x3a')]));_0x502747[_0xf110('0x39')]=_0x502747['attributes'][_0xf110('0x3b')]?_0x502747['attributes']:_0x233323[_0xf110('0x34')];_0x502747[_0xf110('0x3d')]=qs[_0xf110('0x3e')](_0x1363ce[_0xf110('0x35')]['sort']);_0x502747[_0xf110('0x3f')]=qs[_0xf110('0x37')](_[_0xf110('0x40')](_0x1363ce[_0xf110('0x35')],_0x233323[_0xf110('0x37')]));if(_0x1363ce['query'][_0xf110('0x43')]){_0x502747[_0xf110('0x3f')]=_['merge'](_0x502747['where'],{'$or':_[_0xf110('0x2f')](_0x502747[_0xf110('0x39')],function(_0x3c70ec){var _0x3bb129={};_0x3bb129[_0x3c70ec]={'$like':'%'+_0x1363ce[_0xf110('0x35')][_0xf110('0x43')]+'%'};return _0x3bb129;})});}_0x502747=_[_0xf110('0x41')]({},_0x502747,_0x1363ce['options']);return _0x477e33[_0xf110('0x52')](_0x502747);}})[_0xf110('0x26')](function(_0x13c992){if(_0x13c992){_0x1e762b=_0x13c992[_0xf110('0x3b')];if(!_0x1363ce[_0xf110('0x35')][_0xf110('0x3c')](_0xf110('0x51'))){_0x502747[_0xf110('0x1f')]=qs[_0xf110('0x1f')](_0x1363ce[_0xf110('0x35')]['limit']);_0x502747[_0xf110('0x1d')]=qs['offset'](_0x1363ce['query'][_0xf110('0x1d')]);}return _0x477e33[_0xf110('0x52')](_0x502747);}})[_0xf110('0x26')](function(_0x28b73f){if(_0x28b73f){return _0x28b73f?{'count':_0x1e762b,'rows':_0x28b73f}:null;}})[_0xf110('0x26')](respondWithResult(_0x335042,null))[_0xf110('0x47')](handleError(_0x335042,null));};exports['getDescriptions']=function(_0x122603,_0x2e4bc8,_0xee37b3){var _0x430ca9={};var _0x5bda84={};var _0x1b8ff5;var _0x553793;return db['DeskConfiguration'][_0xf110('0x4f')]({'where':{'id':_0x122603[_0xf110('0x49')]['id']}})['then'](handleEntityNotFound(_0x2e4bc8,null))[_0xf110('0x26')](function(_0x1f0d43){if(_0x1f0d43){_0x1b8ff5=_0x1f0d43;_0x5bda84['model']=_[_0xf110('0x36')](db[_0xf110('0x50')][_0xf110('0x31')]);_0x5bda84[_0xf110('0x35')]=_['keys'](_0x122603[_0xf110('0x35')]);_0x5bda84[_0xf110('0x37')]=_[_0xf110('0x38')](_0x5bda84['model'],_0x5bda84[_0xf110('0x35')]);_0x430ca9[_0xf110('0x39')]=_['intersection'](_0x5bda84[_0xf110('0x34')],qs['fields'](_0x122603[_0xf110('0x35')]['fields']));_0x430ca9[_0xf110('0x39')]=_0x430ca9['attributes'][_0xf110('0x3b')]?_0x430ca9[_0xf110('0x39')]:_0x5bda84[_0xf110('0x34')];_0x430ca9[_0xf110('0x3d')]=qs[_0xf110('0x3e')](_0x122603[_0xf110('0x35')][_0xf110('0x3e')]);_0x430ca9[_0xf110('0x3f')]=qs[_0xf110('0x37')](_[_0xf110('0x40')](_0x122603[_0xf110('0x35')],_0x5bda84[_0xf110('0x37')]));if(_0x122603['query']['filter']){_0x430ca9[_0xf110('0x3f')]=_[_0xf110('0x41')](_0x430ca9[_0xf110('0x3f')],{'$or':_['map'](_0x430ca9[_0xf110('0x39')],function(_0x3be34d){var _0xc20eec={};_0xc20eec[_0x3be34d]={'$like':'%'+_0x122603[_0xf110('0x35')][_0xf110('0x43')]+'%'};return _0xc20eec;})});}_0x430ca9=_[_0xf110('0x41')]({},_0x430ca9,_0x122603[_0xf110('0x44')]);return _0x1b8ff5[_0xf110('0x53')](_0x430ca9);}})[_0xf110('0x26')](function(_0x2f3267){if(_0x2f3267){_0x553793=_0x2f3267['length'];if(!_0x122603[_0xf110('0x35')][_0xf110('0x3c')]('nolimit')){_0x430ca9[_0xf110('0x1f')]=qs['limit'](_0x122603[_0xf110('0x35')][_0xf110('0x1f')]);_0x430ca9[_0xf110('0x1d')]=qs[_0xf110('0x1d')](_0x122603[_0xf110('0x35')]['offset']);}return _0x1b8ff5[_0xf110('0x53')](_0x430ca9);}})['then'](function(_0x576fd0){if(_0x576fd0){return _0x576fd0?{'count':_0x553793,'rows':_0x576fd0}:null;}})[_0xf110('0x26')](respondWithResult(_0x2e4bc8,null))['catch'](handleError(_0x2e4bc8,null));};exports[_0xf110('0x54')]=function(_0x3f5b7f,_0x1413eb,_0x26812e){var _0x4927c6={};var _0xb5cec3={};var _0x5af849;var _0x4774c6;return db['DeskConfiguration']['findOne']({'where':{'id':_0x3f5b7f['params']['id']}})['then'](handleEntityNotFound(_0x1413eb,null))[_0xf110('0x26')](function(_0x3e8dc7){if(_0x3e8dc7){_0x5af849=_0x3e8dc7;_0xb5cec3[_0xf110('0x34')]=_['keys'](db['Tag'][_0xf110('0x31')]);_0xb5cec3[_0xf110('0x35')]=_['keys'](_0x3f5b7f[_0xf110('0x35')]);_0xb5cec3[_0xf110('0x37')]=_[_0xf110('0x38')](_0xb5cec3[_0xf110('0x34')],_0xb5cec3['query']);_0x4927c6['attributes']=_[_0xf110('0x38')](_0xb5cec3['model'],qs[_0xf110('0x3a')](_0x3f5b7f[_0xf110('0x35')]['fields']));_0x4927c6['attributes']=_0x4927c6[_0xf110('0x39')]['length']?_0x4927c6[_0xf110('0x39')]:_0xb5cec3[_0xf110('0x34')];_0x4927c6['order']=qs['sort'](_0x3f5b7f[_0xf110('0x35')][_0xf110('0x3e')]);_0x4927c6[_0xf110('0x3f')]=qs[_0xf110('0x37')](_['pick'](_0x3f5b7f[_0xf110('0x35')],_0xb5cec3[_0xf110('0x37')]));if(_0x3f5b7f[_0xf110('0x35')][_0xf110('0x43')]){_0x4927c6[_0xf110('0x3f')]=_[_0xf110('0x41')](_0x4927c6[_0xf110('0x3f')],{'$or':_[_0xf110('0x2f')](_0x4927c6['attributes'],function(_0x186f21){var _0x104751={};_0x104751[_0x186f21]={'$like':'%'+_0x3f5b7f['query'][_0xf110('0x43')]+'%'};return _0x104751;})});}_0x4927c6=_[_0xf110('0x41')]({},_0x4927c6,_0x3f5b7f[_0xf110('0x44')]);return _0x5af849[_0xf110('0x54')](_0x4927c6);}})['then'](function(_0x4656b2){if(_0x4656b2){_0x4774c6=_0x4656b2['length'];if(!_0x3f5b7f['query'][_0xf110('0x3c')](_0xf110('0x51'))){_0x4927c6[_0xf110('0x1f')]=qs[_0xf110('0x1f')](_0x3f5b7f[_0xf110('0x35')][_0xf110('0x1f')]);_0x4927c6[_0xf110('0x1d')]=qs[_0xf110('0x1d')](_0x3f5b7f['query'][_0xf110('0x1d')]);}return _0x5af849[_0xf110('0x54')](_0x4927c6);}})['then'](function(_0x966f40){if(_0x966f40){return _0x966f40?{'count':_0x4774c6,'rows':_0x966f40}:null;}})[_0xf110('0x26')](respondWithResult(_0x1413eb,null))[_0xf110('0x47')](handleError(_0x1413eb,null));};exports[_0xf110('0x55')]=function(_0xe0e2ca,_0x20e395,_0x3ec872){if(_0xe0e2ca[_0xf110('0x4d')]['id']){delete _0xe0e2ca[_0xf110('0x4d')]['id'];}return db[_0xf110('0x30')]['findOne']({'where':{'id':_0xe0e2ca[_0xf110('0x49')]['id']}})['then'](handleEntityNotFound(_0x20e395,null))[_0xf110('0x26')](function(_0x1c3ee9){if(_0x1c3ee9){return _0x1c3ee9[_0xf110('0x55')](_0xe0e2ca[_0xf110('0x4d')][_0xf110('0x56')]||[]);}return null;})[_0xf110('0x26')](respondWithResult(_0x20e395,null))[_0xf110('0x47')](handleError(_0x20e395,null));}; \ No newline at end of file diff --git a/server/api/intDeskConfiguration/intDeskConfiguration.model.js b/server/api/intDeskConfiguration/intDeskConfiguration.model.js index 1b6bbdb..c59de88 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 _0x6d94=['path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash','util','../../config/logger','api','moment'];(function(_0x3ea685,_0xad71bd){var _0x485332=function(_0x388b13){while(--_0x388b13){_0x3ea685['push'](_0x3ea685['shift']());}};_0x485332(++_0xad71bd);}(_0x6d94,0x14b));var _0x46d9=function(_0x4e0886,_0x25844c){_0x4e0886=_0x4e0886-0x0;var _0x13de2=_0x6d94[_0x4e0886];return _0x13de2;};'use strict';var _=require(_0x46d9('0x0'));var util=require(_0x46d9('0x1'));var logger=require(_0x46d9('0x2'))(_0x46d9('0x3'));var moment=require(_0x46d9('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x46d9('0x5'));var rimraf=require(_0x46d9('0x6'));var config=require(_0x46d9('0x7'));var attributes=require(_0x46d9('0x8'));module['exports']=function(_0x13e730,_0x574d34){return _0x13e730[_0x46d9('0x9')](_0x46d9('0xa'),attributes,{'tableName':_0x46d9('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1b95=['path','rimraf','../../config/environment','./intDeskConfiguration.attributes','define','DeskConfiguration','int_desk_configurations','lodash','bluebird','request-promise'];(function(_0x177831,_0x30597b){var _0x4883c9=function(_0x1f8fd2){while(--_0x1f8fd2){_0x177831['push'](_0x177831['shift']());}};_0x4883c9(++_0x30597b);}(_0x1b95,0x115));var _0x51b9=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0x1b95[_0x256b72];return _0x2183e3;};'use strict';var _=require(_0x51b9('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x51b9('0x1'));var rp=require(_0x51b9('0x2'));var fs=require('fs');var path=require(_0x51b9('0x3'));var rimraf=require(_0x51b9('0x4'));var config=require(_0x51b9('0x5'));var attributes=require(_0x51b9('0x6'));module['exports']=function(_0x169e4b,_0x24744d){return _0x169e4b[_0x51b9('0x7')](_0x51b9('0x8'),attributes,{'tableName':_0x51b9('0x9'),'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 e198708..931fe80 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 _0x65c9=['then','info','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','DeskConfiguration,\x20%s,\x20%s','message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x6ca7f4,_0x51a5df){var _0x494fa6=function(_0x359532){while(--_0x359532){_0x6ca7f4['push'](_0x6ca7f4['shift']());}};_0x494fa6(++_0x51a5df);}(_0x65c9,0x182));var _0x965c=function(_0x4618ba,_0x5eab8b){_0x4618ba=_0x4618ba-0x0;var _0x15bf92=_0x65c9[_0x4618ba];return _0x15bf92;};'use strict';var _=require(_0x965c('0x0'));var util=require(_0x965c('0x1'));var moment=require('moment');var BPromise=require(_0x965c('0x2'));var rs=require(_0x965c('0x3'));var fs=require('fs');var Redis=require(_0x965c('0x4'));var db=require(_0x965c('0x5'))['db'];var utils=require(_0x965c('0x6'));var logger=require(_0x965c('0x7'))(_0x965c('0x8'));var config=require(_0x965c('0x9'));var jayson=require(_0x965c('0xa'));var client=jayson[_0x965c('0xb')][_0x965c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x849260,_0x5ec702,_0xd19e57){return new BPromise(function(_0x263652,_0x41d248){return client[_0x965c('0xd')](_0x849260,_0xd19e57)[_0x965c('0xe')](function(_0x26d859){logger[_0x965c('0xf')]('DeskConfiguration,\x20%s,\x20%s',_0x5ec702,_0x965c('0x10'));logger[_0x965c('0x11')](_0x965c('0x12'),_0x5ec702,_0x965c('0x10'),JSON[_0x965c('0x13')](_0x26d859));if(_0x26d859[_0x965c('0x14')]){if(_0x26d859[_0x965c('0x14')][_0x965c('0x15')]===0x1f4){logger[_0x965c('0x14')](_0x965c('0x16'),_0x5ec702,_0x26d859[_0x965c('0x14')][_0x965c('0x17')]);return _0x41d248(_0x26d859[_0x965c('0x14')][_0x965c('0x17')]);}logger['error'](_0x965c('0x16'),_0x5ec702,_0x26d859[_0x965c('0x14')][_0x965c('0x17')]);return _0x263652(_0x26d859['error'][_0x965c('0x17')]);}else{logger[_0x965c('0xf')](_0x965c('0x16'),_0x5ec702,'request\x20sent');_0x263652(_0x26d859[_0x965c('0x18')]['message']);}})['catch'](function(_0x542499){logger[_0x965c('0x14')](_0x965c('0x16'),_0x5ec702,_0x542499);_0x41d248(_0x542499);});});} \ No newline at end of file +var _0xa6ce=['error','code','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','DeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','DeskConfiguration,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x17616f,_0x1c2bcc){var _0x89967a=function(_0x2c9717){while(--_0x2c9717){_0x17616f['push'](_0x17616f['shift']());}};_0x89967a(++_0x1c2bcc);}(_0xa6ce,0x15e));var _0xea6c=function(_0x2ec461,_0x5f588a){_0x2ec461=_0x2ec461-0x0;var _0x28603d=_0xa6ce[_0x2ec461];return _0x28603d;};'use strict';var _=require(_0xea6c('0x0'));var util=require('util');var moment=require(_0xea6c('0x1'));var BPromise=require(_0xea6c('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xea6c('0x3'));var db=require(_0xea6c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xea6c('0x5'));var config=require(_0xea6c('0x6'));var jayson=require(_0xea6c('0x7'));var client=jayson[_0xea6c('0x8')][_0xea6c('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8a751f,_0x5c3ba1,_0x2af078){return new BPromise(function(_0x3f1ce4,_0x1be5e8){return client[_0xea6c('0xa')](_0x8a751f,_0x2af078)[_0xea6c('0xb')](function(_0x227f1c){logger[_0xea6c('0xc')](_0xea6c('0xd'),_0x5c3ba1,_0xea6c('0xe'));logger[_0xea6c('0xf')](_0xea6c('0x10'),_0x5c3ba1,_0xea6c('0xe'),JSON[_0xea6c('0x11')](_0x227f1c));if(_0x227f1c[_0xea6c('0x12')]){if(_0x227f1c['error'][_0xea6c('0x13')]===0x1f4){logger[_0xea6c('0x12')](_0xea6c('0xd'),_0x5c3ba1,_0x227f1c['error'][_0xea6c('0x14')]);return _0x1be5e8(_0x227f1c[_0xea6c('0x12')]['message']);}logger[_0xea6c('0x12')](_0xea6c('0xd'),_0x5c3ba1,_0x227f1c[_0xea6c('0x12')][_0xea6c('0x14')]);return _0x3f1ce4(_0x227f1c[_0xea6c('0x12')][_0xea6c('0x14')]);}else{logger['info'](_0xea6c('0xd'),_0x5c3ba1,'request\x20sent');_0x3f1ce4(_0x227f1c[_0xea6c('0x15')][_0xea6c('0x14')]);}})[_0xea6c('0x16')](function(_0x105b0b){logger[_0xea6c('0x12')]('DeskConfiguration,\x20%s,\x20%s',_0x5c3ba1,_0x105b0b);_0x1be5e8(_0x105b0b);});});} \ No newline at end of file diff --git a/server/api/intDeskField/index.js b/server/api/intDeskField/index.js index 63f338d..bc99d92 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 _0xb368=['get','isAuthenticated','/:id','show','create','put','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x2ac9c4,_0x3cfc5f){var _0x393883=function(_0x2e49de){while(--_0x2e49de){_0x2ac9c4['push'](_0x2ac9c4['shift']());}};_0x393883(++_0x3cfc5f);}(_0xb368,0x68));var _0x8b36=function(_0x2bb6ea,_0x3a1a2d){_0x2bb6ea=_0x2bb6ea-0x0;var _0x4966be=_0xb368[_0x2bb6ea];return _0x4966be;};'use strict';var multer=require(_0x8b36('0x0'));var util=require(_0x8b36('0x1'));var path=require(_0x8b36('0x2'));var timeout=require(_0x8b36('0x3'));var express=require(_0x8b36('0x4'));var router=express[_0x8b36('0x5')]();var fs_extra=require(_0x8b36('0x6'));var auth=require(_0x8b36('0x7'));var interaction=require(_0x8b36('0x8'));var config=require(_0x8b36('0x9'));var controller=require('./intDeskField.controller');router[_0x8b36('0xa')]('/',auth[_0x8b36('0xb')](),controller['index']);router['get'](_0x8b36('0xc'),auth['isAuthenticated'](),controller[_0x8b36('0xd')]);router['post']('/',auth[_0x8b36('0xb')](),controller[_0x8b36('0xe')]);router[_0x8b36('0xf')]('/:id',auth[_0x8b36('0xb')](),controller[_0x8b36('0x10')]);router['delete']('/:id',auth[_0x8b36('0xb')](),controller[_0x8b36('0x11')]);module[_0x8b36('0x12')]=router; \ No newline at end of file +var _0xb356=['post','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDeskField.controller','get','/:id','isAuthenticated','show'];(function(_0x72895a,_0x433607){var _0x5226d5=function(_0x5b7d21){while(--_0x5b7d21){_0x72895a['push'](_0x72895a['shift']());}};_0x5226d5(++_0x433607);}(_0xb356,0x135));var _0x6b35=function(_0x109e0c,_0x302b7e){_0x109e0c=_0x109e0c-0x0;var _0x1e4ffd=_0xb356[_0x109e0c];return _0x1e4ffd;};'use strict';var multer=require(_0x6b35('0x0'));var util=require(_0x6b35('0x1'));var path=require(_0x6b35('0x2'));var timeout=require(_0x6b35('0x3'));var express=require(_0x6b35('0x4'));var router=express[_0x6b35('0x5')]();var fs_extra=require(_0x6b35('0x6'));var auth=require(_0x6b35('0x7'));var interaction=require(_0x6b35('0x8'));var config=require(_0x6b35('0x9'));var controller=require(_0x6b35('0xa'));router[_0x6b35('0xb')]('/',auth['isAuthenticated'](),controller['index']);router[_0x6b35('0xb')](_0x6b35('0xc'),auth[_0x6b35('0xd')](),controller[_0x6b35('0xe')]);router[_0x6b35('0xf')]('/',auth[_0x6b35('0xd')](),controller['create']);router['put'](_0x6b35('0xc'),auth['isAuthenticated'](),controller[_0x6b35('0x10')]);router['delete'](_0x6b35('0xc'),auth[_0x6b35('0xd')](),controller['destroy']);module[_0x6b35('0x11')]=router; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.attributes.js b/server/api/intDeskField/intDeskField.attributes.js index 4d106f1..066a211 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 _0x4a00=['sequelize','ENUM','string','variable','customVariable','picklist','STRING','BOOLEAN'];(function(_0x593d89,_0x45145f){var _0x4aa403=function(_0x21f674){while(--_0x21f674){_0x593d89['push'](_0x593d89['shift']());}};_0x4aa403(++_0x45145f);}(_0x4a00,0xd8));var _0x04a0=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x4a00[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require(_0x04a0('0x0'));module['exports']={'type':{'type':Sequelize[_0x04a0('0x1')](_0x04a0('0x2'),_0x04a0('0x3'),_0x04a0('0x4'),'keyValue',_0x04a0('0x5')),'defaultValue':_0x04a0('0x2')},'content':{'type':Sequelize[_0x04a0('0x6')]},'key':{'type':Sequelize[_0x04a0('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0x04a0('0x2'),_0x04a0('0x3'),_0x04a0('0x4'))},'keyContent':{'type':Sequelize[_0x04a0('0x6')]},'idField':{'type':Sequelize[_0x04a0('0x6')]},'nameField':{'type':Sequelize[_0x04a0('0x6')]},'customField':{'type':Sequelize[_0x04a0('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x04a0('0x6')]}}; \ No newline at end of file +var _0x59b7=['ENUM','string','customVariable','keyValue','picklist','STRING','variable'];(function(_0x2be8c2,_0x14a4b5){var _0x97f531=function(_0xcee58d){while(--_0xcee58d){_0x2be8c2['push'](_0x2be8c2['shift']());}};_0x97f531(++_0x14a4b5);}(_0x59b7,0x111));var _0x759b=function(_0x64063c,_0x360f5e){_0x64063c=_0x64063c-0x0;var _0x185c9c=_0x59b7[_0x64063c];return _0x185c9c;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x759b('0x0')](_0x759b('0x1'),'variable',_0x759b('0x2'),_0x759b('0x3'),_0x759b('0x4')),'defaultValue':'string'},'content':{'type':Sequelize[_0x759b('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x759b('0x0')](_0x759b('0x1'),_0x759b('0x6'),_0x759b('0x2'))},'keyContent':{'type':Sequelize[_0x759b('0x5')]},'idField':{'type':Sequelize[_0x759b('0x5')]},'nameField':{'type':Sequelize[_0x759b('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x759b('0x5')]}}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.controller.js b/server/api/intDeskField/intDeskField.controller.js index 104782c..c180c13 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 _0x8838=['bluebird','mustache','util','path','sox','to-csv','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','name','send','DeskField','rawAttributes','fieldName','type','key','model','keys','query','filters','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','rows','catch','show','params','intersection','include','find','create','body','update','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x1cdf06,_0x2a1b06){var _0x4ac479=function(_0x5c70e0){while(--_0x5c70e0){_0x1cdf06['push'](_0x1cdf06['shift']());}};_0x4ac479(++_0x2a1b06);}(_0x8838,0x90));var _0x8883=function(_0x12664f,_0xce915a){_0x12664f=_0x12664f-0x0;var _0x202397=_0x8838[_0x12664f];return _0x202397;};'use strict';var emlformat=require(_0x8883('0x0'));var rimraf=require(_0x8883('0x1'));var zipdir=require(_0x8883('0x2'));var jsonpatch=require(_0x8883('0x3'));var rp=require(_0x8883('0x4'));var moment=require(_0x8883('0x5'));var BPromise=require(_0x8883('0x6'));var Mustache=require(_0x8883('0x7'));var util=require(_0x8883('0x8'));var path=require(_0x8883('0x9'));var sox=require(_0x8883('0xa'));var csv=require(_0x8883('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8883('0xc'));var squel=require('squel');var crypto=require(_0x8883('0xd'));var jsforce=require(_0x8883('0xe'));var deskjs=require(_0x8883('0xf'));var toCsv=require(_0x8883('0xb'));var querystring=require(_0x8883('0x10'));var Papa=require(_0x8883('0x11'));var Redis=require(_0x8883('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x8883('0x13'));var as=require(_0x8883('0x14'));var hardwareService=require(_0x8883('0x15'));var logger=require(_0x8883('0x16'))('api');var utils=require(_0x8883('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0x8883('0x18'));var db=require(_0x8883('0x19'))['db'];function respondWithStatusCode(_0x357db6,_0x42dd7f){_0x42dd7f=_0x42dd7f||0xcc;return function(_0x3ad46c){if(_0x3ad46c){return _0x357db6[_0x8883('0x1a')](_0x42dd7f);}return _0x357db6[_0x8883('0x1b')](_0x42dd7f)[_0x8883('0x1c')]();};}function respondWithResult(_0x4663ba,_0x5f5259){_0x5f5259=_0x5f5259||0xc8;return function(_0x37ed54){if(_0x37ed54){return _0x4663ba[_0x8883('0x1b')](_0x5f5259)[_0x8883('0x1d')](_0x37ed54);}};}function respondWithFilteredResult(_0x347575,_0x5b9cba){return function(_0x126280){if(_0x126280){var _0x55e8ab=typeof _0x5b9cba[_0x8883('0x1e')]==='undefined'&&typeof _0x5b9cba[_0x8883('0x1f')]==='undefined';var _0x2ff211=_0x126280[_0x8883('0x20')];var _0x127b5f=_0x55e8ab?0x0:_0x5b9cba[_0x8883('0x1e')];var _0x1ec1b5=_0x55e8ab?_0x126280['count']:_0x5b9cba['offset']+_0x5b9cba[_0x8883('0x1f')];var _0x118c33;if(_0x1ec1b5>=_0x2ff211){_0x1ec1b5=_0x2ff211;_0x118c33=0xc8;}else{_0x118c33=0xce;}_0x347575['status'](_0x118c33);return _0x347575[_0x8883('0x21')](_0x8883('0x22'),_0x127b5f+'-'+_0x1ec1b5+'/'+_0x2ff211)[_0x8883('0x1d')](_0x126280);}return null;};}function patchUpdates(_0x4a7185){return function(_0x1bb80d){try{jsonpatch[_0x8883('0x23')](_0x1bb80d,_0x4a7185,!![]);}catch(_0x10d674){return BPromise[_0x8883('0x24')](_0x10d674);}return _0x1bb80d[_0x8883('0x25')]();};}function saveUpdates(_0x4c2376,_0x2ee36c){return function(_0xbb362f){if(_0xbb362f){return _0xbb362f['update'](_0x4c2376)[_0x8883('0x26')](function(_0x154e5f){return _0x154e5f;});}return null;};}function removeEntity(_0x171d63,_0x51fdd9){return function(_0x3f90e8){if(_0x3f90e8){return _0x3f90e8[_0x8883('0x27')]()[_0x8883('0x26')](function(){_0x171d63[_0x8883('0x1b')](0xcc)[_0x8883('0x1c')]();});}};}function handleEntityNotFound(_0x223412,_0x2b53e5){return function(_0x5d7c59){if(!_0x5d7c59){_0x223412[_0x8883('0x1a')](0x194);}return _0x5d7c59;};}function handleError(_0x576019,_0x1b6c13){_0x1b6c13=_0x1b6c13||0x1f4;return function(_0x5c3a68){logger['error'](_0x5c3a68['stack']);if(_0x5c3a68['name']){delete _0x5c3a68[_0x8883('0x28')];}_0x576019[_0x8883('0x1b')](_0x1b6c13)[_0x8883('0x29')](_0x5c3a68);};}exports['index']=function(_0x21529a,_0x1147ed){var _0x26df5b={},_0x2e772e={},_0x576605={'count':0x0,'rows':[]};var _0x15fcdb=_['map'](db[_0x8883('0x2a')][_0x8883('0x2b')],function(_0x2bdd57){return{'name':_0x2bdd57[_0x8883('0x2c')],'type':_0x2bdd57[_0x8883('0x2d')][_0x8883('0x2e')]};});_0x2e772e[_0x8883('0x2f')]=_['map'](_0x15fcdb,'name');_0x2e772e['query']=_[_0x8883('0x30')](_0x21529a[_0x8883('0x31')]);_0x2e772e[_0x8883('0x32')]=_['intersection'](_0x2e772e[_0x8883('0x2f')],_0x2e772e[_0x8883('0x31')]);_0x26df5b['attributes']=_['intersection'](_0x2e772e[_0x8883('0x2f')],qs['fields'](_0x21529a['query'][_0x8883('0x33')]));_0x26df5b[_0x8883('0x34')]=_0x26df5b['attributes'][_0x8883('0x35')]?_0x26df5b[_0x8883('0x34')]:_0x2e772e[_0x8883('0x2f')];if(!_0x21529a['query'][_0x8883('0x36')](_0x8883('0x37'))){_0x26df5b[_0x8883('0x1f')]=qs[_0x8883('0x1f')](_0x21529a[_0x8883('0x31')][_0x8883('0x1f')]);_0x26df5b[_0x8883('0x1e')]=qs[_0x8883('0x1e')](_0x21529a[_0x8883('0x31')][_0x8883('0x1e')]);}_0x26df5b[_0x8883('0x38')]=qs[_0x8883('0x39')](_0x21529a[_0x8883('0x31')][_0x8883('0x39')]);_0x26df5b[_0x8883('0x3a')]=qs['filters'](_[_0x8883('0x3b')](_0x21529a['query'],_0x2e772e[_0x8883('0x32')]),_0x15fcdb);if(_0x21529a['query'][_0x8883('0x3c')]){_0x26df5b['where']=_[_0x8883('0x3d')](_0x26df5b[_0x8883('0x3a')],{'$or':_['map'](_0x15fcdb,function(_0x2c3965){if(_0x2c3965[_0x8883('0x2d')]!==_0x8883('0x3e')){var _0x480609={};_0x480609[_0x2c3965[_0x8883('0x28')]]={'$like':'%'+_0x21529a[_0x8883('0x31')][_0x8883('0x3c')]+'%'};return _0x480609;}})});}_0x26df5b=_[_0x8883('0x3d')]({},_0x26df5b,_0x21529a[_0x8883('0x3f')]);var _0x21e90c={'where':_0x26df5b[_0x8883('0x3a')]};return db[_0x8883('0x2a')][_0x8883('0x20')](_0x21e90c)[_0x8883('0x26')](function(_0x262ef7){_0x576605[_0x8883('0x20')]=_0x262ef7;if(_0x21529a[_0x8883('0x31')][_0x8883('0x40')]){_0x26df5b['include']=[{'all':!![]}];}return db[_0x8883('0x2a')]['findAll'](_0x26df5b);})[_0x8883('0x26')](function(_0x3626bf){_0x576605[_0x8883('0x41')]=_0x3626bf;return _0x576605;})[_0x8883('0x26')](respondWithFilteredResult(_0x1147ed,_0x26df5b))[_0x8883('0x42')](handleError(_0x1147ed,null));};exports[_0x8883('0x43')]=function(_0x12af4c,_0x27a11a){var _0x5a66de={'raw':!![],'where':{'id':_0x12af4c[_0x8883('0x44')]['id']}},_0x35b867={};_0x35b867[_0x8883('0x2f')]=_[_0x8883('0x30')](db[_0x8883('0x2a')][_0x8883('0x2b')]);_0x35b867[_0x8883('0x31')]=_['keys'](_0x12af4c[_0x8883('0x31')]);_0x35b867[_0x8883('0x32')]=_[_0x8883('0x45')](_0x35b867[_0x8883('0x2f')],_0x35b867['query']);_0x5a66de[_0x8883('0x34')]=_[_0x8883('0x45')](_0x35b867[_0x8883('0x2f')],qs['fields'](_0x12af4c[_0x8883('0x31')]['fields']));_0x5a66de[_0x8883('0x34')]=_0x5a66de['attributes'][_0x8883('0x35')]?_0x5a66de[_0x8883('0x34')]:_0x35b867['model'];if(_0x12af4c['query']['includeAll']){_0x5a66de[_0x8883('0x46')]=[{'all':!![]}];}_0x5a66de=_[_0x8883('0x3d')]({},_0x5a66de,_0x12af4c[_0x8883('0x3f')]);return db['DeskField'][_0x8883('0x47')](_0x5a66de)[_0x8883('0x26')](handleEntityNotFound(_0x27a11a,null))[_0x8883('0x26')](respondWithResult(_0x27a11a,null))[_0x8883('0x42')](handleError(_0x27a11a,null));};exports[_0x8883('0x48')]=function(_0x58fdd8,_0x43683f){return db[_0x8883('0x2a')][_0x8883('0x48')](_0x58fdd8[_0x8883('0x49')],{})[_0x8883('0x26')](respondWithResult(_0x43683f,0xc9))[_0x8883('0x42')](handleError(_0x43683f,null));};exports[_0x8883('0x4a')]=function(_0x21ee60,_0x598086){if(_0x21ee60['body']['id']){delete _0x21ee60[_0x8883('0x49')]['id'];}return db[_0x8883('0x2a')]['find']({'where':{'id':_0x21ee60[_0x8883('0x44')]['id']}})['then'](handleEntityNotFound(_0x598086,null))['then'](saveUpdates(_0x21ee60[_0x8883('0x49')],null))[_0x8883('0x26')](respondWithResult(_0x598086,null))['catch'](handleError(_0x598086,null));};exports[_0x8883('0x27')]=function(_0x153ba6,_0x23f464){return db[_0x8883('0x2a')][_0x8883('0x47')]({'where':{'id':_0x153ba6[_0x8883('0x44')]['id']}})[_0x8883('0x26')](handleEntityNotFound(_0x23f464,null))[_0x8883('0x26')](removeEntity(_0x23f464,null))[_0x8883('0x42')](handleError(_0x23f464,null));}; \ No newline at end of file +var _0x9d0c=['filters','intersection','attributes','model','fields','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','keys','length','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','update','then','destroy','sendStatus','error','stack','name','send','index','map','DeskField','rawAttributes','fieldName','type','key','query'];(function(_0x208aca,_0x21d391){var _0xf41b84=function(_0xaf2c5){while(--_0xaf2c5){_0x208aca['push'](_0x208aca['shift']());}};_0xf41b84(++_0x21d391);}(_0x9d0c,0xb9));var _0xc9d0=function(_0x387603,_0x5a2d1){_0x387603=_0x387603-0x0;var _0x55ea9e=_0x9d0c[_0x387603];return _0x55ea9e;};'use strict';var emlformat=require(_0xc9d0('0x0'));var rimraf=require(_0xc9d0('0x1'));var zipdir=require(_0xc9d0('0x2'));var jsonpatch=require(_0xc9d0('0x3'));var rp=require('request-promise');var moment=require(_0xc9d0('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xc9d0('0x5'));var util=require(_0xc9d0('0x6'));var path=require(_0xc9d0('0x7'));var sox=require(_0xc9d0('0x8'));var csv=require(_0xc9d0('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc9d0('0xa'));var _=require(_0xc9d0('0xb'));var squel=require(_0xc9d0('0xc'));var crypto=require(_0xc9d0('0xd'));var jsforce=require(_0xc9d0('0xe'));var deskjs=require(_0xc9d0('0xf'));var toCsv=require(_0xc9d0('0x9'));var querystring=require(_0xc9d0('0x10'));var Papa=require(_0xc9d0('0x11'));var Redis=require(_0xc9d0('0x12'));var authService=require(_0xc9d0('0x13'));var qs=require(_0xc9d0('0x14'));var as=require(_0xc9d0('0x15'));var hardwareService=require(_0xc9d0('0x16'));var logger=require(_0xc9d0('0x17'))(_0xc9d0('0x18'));var utils=require(_0xc9d0('0x19'));var config=require(_0xc9d0('0x1a'));var licenseUtil=require(_0xc9d0('0x1b'));var db=require(_0xc9d0('0x1c'))['db'];function respondWithStatusCode(_0x3df90d,_0x9a8a55){_0x9a8a55=_0x9a8a55||0xcc;return function(_0x1c147a){if(_0x1c147a){return _0x3df90d['sendStatus'](_0x9a8a55);}return _0x3df90d['status'](_0x9a8a55)[_0xc9d0('0x1d')]();};}function respondWithResult(_0x1ff817,_0x1d01c6){_0x1d01c6=_0x1d01c6||0xc8;return function(_0xf11e57){if(_0xf11e57){return _0x1ff817[_0xc9d0('0x1e')](_0x1d01c6)[_0xc9d0('0x1f')](_0xf11e57);}};}function respondWithFilteredResult(_0x3df995,_0x2ea05e){return function(_0x18eb1e){if(_0x18eb1e){var _0x31f48f=typeof _0x2ea05e[_0xc9d0('0x20')]===_0xc9d0('0x21')&&typeof _0x2ea05e[_0xc9d0('0x22')]===_0xc9d0('0x21');var _0x539744=_0x18eb1e[_0xc9d0('0x23')];var _0x5c1d84=_0x31f48f?0x0:_0x2ea05e['offset'];var _0x20aa19=_0x31f48f?_0x18eb1e[_0xc9d0('0x23')]:_0x2ea05e['offset']+_0x2ea05e[_0xc9d0('0x22')];var _0x247fb2;if(_0x20aa19>=_0x539744){_0x20aa19=_0x539744;_0x247fb2=0xc8;}else{_0x247fb2=0xce;}_0x3df995[_0xc9d0('0x1e')](_0x247fb2);return _0x3df995[_0xc9d0('0x24')](_0xc9d0('0x25'),_0x5c1d84+'-'+_0x20aa19+'/'+_0x539744)[_0xc9d0('0x1f')](_0x18eb1e);}return null;};}function patchUpdates(_0x526b62){return function(_0x380802){try{jsonpatch[_0xc9d0('0x26')](_0x380802,_0x526b62,!![]);}catch(_0x4fd61a){return BPromise['reject'](_0x4fd61a);}return _0x380802['save']();};}function saveUpdates(_0x5b489a,_0x48caa0){return function(_0x4112f3){if(_0x4112f3){return _0x4112f3[_0xc9d0('0x27')](_0x5b489a)[_0xc9d0('0x28')](function(_0x40bfdf){return _0x40bfdf;});}return null;};}function removeEntity(_0x4d0cd8,_0x73159f){return function(_0x5bb2fc){if(_0x5bb2fc){return _0x5bb2fc[_0xc9d0('0x29')]()[_0xc9d0('0x28')](function(){_0x4d0cd8['status'](0xcc)[_0xc9d0('0x1d')]();});}};}function handleEntityNotFound(_0xda2fd5,_0x5a69a9){return function(_0x339914){if(!_0x339914){_0xda2fd5[_0xc9d0('0x2a')](0x194);}return _0x339914;};}function handleError(_0x11d833,_0x1321a7){_0x1321a7=_0x1321a7||0x1f4;return function(_0x11bc03){logger[_0xc9d0('0x2b')](_0x11bc03[_0xc9d0('0x2c')]);if(_0x11bc03['name']){delete _0x11bc03[_0xc9d0('0x2d')];}_0x11d833[_0xc9d0('0x1e')](_0x1321a7)[_0xc9d0('0x2e')](_0x11bc03);};}exports[_0xc9d0('0x2f')]=function(_0x3fe4ad,_0x132d66){var _0x3d4b80={},_0x11f3ea={},_0x430329={'count':0x0,'rows':[]};var _0x4260cd=_[_0xc9d0('0x30')](db[_0xc9d0('0x31')][_0xc9d0('0x32')],function(_0x4bcc09){return{'name':_0x4bcc09[_0xc9d0('0x33')],'type':_0x4bcc09[_0xc9d0('0x34')][_0xc9d0('0x35')]};});_0x11f3ea['model']=_[_0xc9d0('0x30')](_0x4260cd,'name');_0x11f3ea['query']=_['keys'](_0x3fe4ad[_0xc9d0('0x36')]);_0x11f3ea[_0xc9d0('0x37')]=_[_0xc9d0('0x38')](_0x11f3ea['model'],_0x11f3ea[_0xc9d0('0x36')]);_0x3d4b80[_0xc9d0('0x39')]=_[_0xc9d0('0x38')](_0x11f3ea[_0xc9d0('0x3a')],qs[_0xc9d0('0x3b')](_0x3fe4ad[_0xc9d0('0x36')][_0xc9d0('0x3b')]));_0x3d4b80[_0xc9d0('0x39')]=_0x3d4b80[_0xc9d0('0x39')]['length']?_0x3d4b80['attributes']:_0x11f3ea['model'];if(!_0x3fe4ad['query'][_0xc9d0('0x3c')](_0xc9d0('0x3d'))){_0x3d4b80[_0xc9d0('0x22')]=qs['limit'](_0x3fe4ad[_0xc9d0('0x36')]['limit']);_0x3d4b80[_0xc9d0('0x20')]=qs['offset'](_0x3fe4ad['query'][_0xc9d0('0x20')]);}_0x3d4b80[_0xc9d0('0x3e')]=qs['sort'](_0x3fe4ad['query'][_0xc9d0('0x3f')]);_0x3d4b80[_0xc9d0('0x40')]=qs['filters'](_[_0xc9d0('0x41')](_0x3fe4ad['query'],_0x11f3ea[_0xc9d0('0x37')]),_0x4260cd);if(_0x3fe4ad[_0xc9d0('0x36')]['filter']){_0x3d4b80['where']=_[_0xc9d0('0x42')](_0x3d4b80[_0xc9d0('0x40')],{'$or':_[_0xc9d0('0x30')](_0x4260cd,function(_0x36c711){if(_0x36c711[_0xc9d0('0x34')]!==_0xc9d0('0x43')){var _0x344782={};_0x344782[_0x36c711[_0xc9d0('0x2d')]]={'$like':'%'+_0x3fe4ad['query']['filter']+'%'};return _0x344782;}})});}_0x3d4b80=_['merge']({},_0x3d4b80,_0x3fe4ad[_0xc9d0('0x44')]);var _0x57f3e2={'where':_0x3d4b80['where']};return db[_0xc9d0('0x31')][_0xc9d0('0x23')](_0x57f3e2)['then'](function(_0x43eadc){_0x430329[_0xc9d0('0x23')]=_0x43eadc;if(_0x3fe4ad[_0xc9d0('0x36')][_0xc9d0('0x45')]){_0x3d4b80[_0xc9d0('0x46')]=[{'all':!![]}];}return db[_0xc9d0('0x31')][_0xc9d0('0x47')](_0x3d4b80);})[_0xc9d0('0x28')](function(_0x24dfe7){_0x430329[_0xc9d0('0x48')]=_0x24dfe7;return _0x430329;})[_0xc9d0('0x28')](respondWithFilteredResult(_0x132d66,_0x3d4b80))['catch'](handleError(_0x132d66,null));};exports['show']=function(_0x442444,_0x5030ce){var _0x54cc08={'raw':!![],'where':{'id':_0x442444[_0xc9d0('0x49')]['id']}},_0x2cc699={};_0x2cc699['model']=_[_0xc9d0('0x4a')](db[_0xc9d0('0x31')][_0xc9d0('0x32')]);_0x2cc699[_0xc9d0('0x36')]=_[_0xc9d0('0x4a')](_0x442444[_0xc9d0('0x36')]);_0x2cc699[_0xc9d0('0x37')]=_['intersection'](_0x2cc699[_0xc9d0('0x3a')],_0x2cc699[_0xc9d0('0x36')]);_0x54cc08[_0xc9d0('0x39')]=_[_0xc9d0('0x38')](_0x2cc699[_0xc9d0('0x3a')],qs[_0xc9d0('0x3b')](_0x442444[_0xc9d0('0x36')][_0xc9d0('0x3b')]));_0x54cc08[_0xc9d0('0x39')]=_0x54cc08[_0xc9d0('0x39')][_0xc9d0('0x4b')]?_0x54cc08[_0xc9d0('0x39')]:_0x2cc699[_0xc9d0('0x3a')];if(_0x442444['query'][_0xc9d0('0x45')]){_0x54cc08['include']=[{'all':!![]}];}_0x54cc08=_['merge']({},_0x54cc08,_0x442444[_0xc9d0('0x44')]);return db[_0xc9d0('0x31')][_0xc9d0('0x4c')](_0x54cc08)[_0xc9d0('0x28')](handleEntityNotFound(_0x5030ce,null))[_0xc9d0('0x28')](respondWithResult(_0x5030ce,null))[_0xc9d0('0x4d')](handleError(_0x5030ce,null));};exports[_0xc9d0('0x4e')]=function(_0x5c2532,_0x216498){return db[_0xc9d0('0x31')][_0xc9d0('0x4e')](_0x5c2532[_0xc9d0('0x4f')],{})[_0xc9d0('0x28')](respondWithResult(_0x216498,0xc9))[_0xc9d0('0x4d')](handleError(_0x216498,null));};exports[_0xc9d0('0x27')]=function(_0x27b5e5,_0x3fa59f){if(_0x27b5e5['body']['id']){delete _0x27b5e5[_0xc9d0('0x4f')]['id'];}return db[_0xc9d0('0x31')][_0xc9d0('0x4c')]({'where':{'id':_0x27b5e5['params']['id']}})[_0xc9d0('0x28')](handleEntityNotFound(_0x3fa59f,null))[_0xc9d0('0x28')](saveUpdates(_0x27b5e5['body'],null))[_0xc9d0('0x28')](respondWithResult(_0x3fa59f,null))[_0xc9d0('0x4d')](handleError(_0x3fa59f,null));};exports[_0xc9d0('0x29')]=function(_0x2f532f,_0x1c03a8){return db[_0xc9d0('0x31')][_0xc9d0('0x4c')]({'where':{'id':_0x2f532f[_0xc9d0('0x49')]['id']}})['then'](handleEntityNotFound(_0x1c03a8,null))[_0xc9d0('0x28')](removeEntity(_0x1c03a8,null))[_0xc9d0('0x4d')](handleError(_0x1c03a8,null));}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.model.js b/server/api/intDeskField/intDeskField.model.js index 0633126..5691cab 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 _0x8a16=['path','rimraf','DeskField','int_desk_fields','desk_unique_index','idField','FieldId','../../config/logger','api','moment','request-promise'];(function(_0x1709e7,_0x2ced21){var _0x402819=function(_0x3637a0){while(--_0x3637a0){_0x1709e7['push'](_0x1709e7['shift']());}};_0x402819(++_0x2ced21);}(_0x8a16,0x10f));var _0x68a1=function(_0x240c6b,_0x2bb058){_0x240c6b=_0x240c6b-0x0;var _0x31baa7=_0x8a16[_0x240c6b];return _0x31baa7;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x68a1('0x0'))(_0x68a1('0x1'));var moment=require(_0x68a1('0x2'));var BPromise=require('bluebird');var rp=require(_0x68a1('0x3'));var fs=require('fs');var path=require(_0x68a1('0x4'));var rimraf=require(_0x68a1('0x5'));var config=require('../../config/environment');var attributes=require('./intDeskField.attributes');module['exports']=function(_0x38f331,_0x62c843){return _0x38f331['define'](_0x68a1('0x6'),attributes,{'tableName':_0x68a1('0x7'),'paranoid':![],'indexes':[{'name':_0x68a1('0x8'),'fields':[_0x68a1('0x9'),_0x68a1('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xeb1a=['request-promise','path','rimraf','../../config/environment','./intDeskField.attributes','exports','define','DeskField','int_desk_fields','idField','FieldId','lodash','../../config/logger','api','moment','bluebird'];(function(_0x2bfa06,_0x351e03){var _0x58811b=function(_0x624504){while(--_0x624504){_0x2bfa06['push'](_0x2bfa06['shift']());}};_0x58811b(++_0x351e03);}(_0xeb1a,0x10b));var _0xaeb1=function(_0x401ec9,_0x77c73f){_0x401ec9=_0x401ec9-0x0;var _0x8ef3a1=_0xeb1a[_0x401ec9];return _0x8ef3a1;};'use strict';var _=require(_0xaeb1('0x0'));var util=require('util');var logger=require(_0xaeb1('0x1'))(_0xaeb1('0x2'));var moment=require(_0xaeb1('0x3'));var BPromise=require(_0xaeb1('0x4'));var rp=require(_0xaeb1('0x5'));var fs=require('fs');var path=require(_0xaeb1('0x6'));var rimraf=require(_0xaeb1('0x7'));var config=require(_0xaeb1('0x8'));var attributes=require(_0xaeb1('0x9'));module[_0xaeb1('0xa')]=function(_0x3d9300,_0xbf1dc1){return _0x3d9300[_0xaeb1('0xb')](_0xaeb1('0xc'),attributes,{'tableName':_0xaeb1('0xd'),'paranoid':![],'indexes':[{'name':'desk_unique_index','fields':[_0xaeb1('0xe'),_0xaeb1('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDeskField/intDeskField.rpc.js b/server/api/intDeskField/intDeskField.rpc.js index 94f395b..79f7c64 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 _0xbd68=['client','http','request','then','DeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x17b6e3,_0x4522ed){var _0x3906f3=function(_0x430f87){while(--_0x430f87){_0x17b6e3['push'](_0x17b6e3['shift']());}};_0x3906f3(++_0x4522ed);}(_0xbd68,0x1ab));var _0x8bd6=function(_0x20f90d,_0x59d3dc){_0x20f90d=_0x20f90d-0x0;var _0x4fd688=_0xbd68[_0x20f90d];return _0x4fd688;};'use strict';var _=require(_0x8bd6('0x0'));var util=require(_0x8bd6('0x1'));var moment=require(_0x8bd6('0x2'));var BPromise=require('bluebird');var rs=require(_0x8bd6('0x3'));var fs=require('fs');var Redis=require(_0x8bd6('0x4'));var db=require(_0x8bd6('0x5'))['db'];var utils=require(_0x8bd6('0x6'));var logger=require(_0x8bd6('0x7'))('rpc');var config=require(_0x8bd6('0x8'));var jayson=require(_0x8bd6('0x9'));var client=jayson[_0x8bd6('0xa')][_0x8bd6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x50221d,_0x5ac381,_0x3f9833){return new BPromise(function(_0x426579,_0x277c79){return client[_0x8bd6('0xc')](_0x50221d,_0x3f9833)[_0x8bd6('0xd')](function(_0x107431){logger['info'](_0x8bd6('0xe'),_0x5ac381,_0x8bd6('0xf'));logger[_0x8bd6('0x10')]('DeskField,\x20%s,\x20%s,\x20%s',_0x5ac381,_0x8bd6('0xf'),JSON[_0x8bd6('0x11')](_0x107431));if(_0x107431[_0x8bd6('0x12')]){if(_0x107431[_0x8bd6('0x12')][_0x8bd6('0x13')]===0x1f4){logger['error']('DeskField,\x20%s,\x20%s',_0x5ac381,_0x107431[_0x8bd6('0x12')][_0x8bd6('0x14')]);return _0x277c79(_0x107431[_0x8bd6('0x12')][_0x8bd6('0x14')]);}logger[_0x8bd6('0x12')](_0x8bd6('0xe'),_0x5ac381,_0x107431[_0x8bd6('0x12')][_0x8bd6('0x14')]);return _0x426579(_0x107431[_0x8bd6('0x12')][_0x8bd6('0x14')]);}else{logger[_0x8bd6('0x15')](_0x8bd6('0xe'),_0x5ac381,_0x8bd6('0xf'));_0x426579(_0x107431['result'][_0x8bd6('0x14')]);}})[_0x8bd6('0x16')](function(_0x51caec){logger[_0x8bd6('0x12')]('DeskField,\x20%s,\x20%s',_0x5ac381,_0x51caec);_0x277c79(_0x51caec);});});} \ No newline at end of file +var _0xfa2d=['result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','DeskField,\x20%s,\x20%s','request\x20sent','DeskField,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x1cfe89,_0x10fe4a){var _0x295305=function(_0x56759c){while(--_0x56759c){_0x1cfe89['push'](_0x1cfe89['shift']());}};_0x295305(++_0x10fe4a);}(_0xfa2d,0x189));var _0xdfa2=function(_0x527d61,_0x2137fb){_0x527d61=_0x527d61-0x0;var _0xbfd129=_0xfa2d[_0x527d61];return _0xbfd129;};'use strict';var _=require(_0xdfa2('0x0'));var util=require('util');var moment=require(_0xdfa2('0x1'));var BPromise=require(_0xdfa2('0x2'));var rs=require(_0xdfa2('0x3'));var fs=require('fs');var Redis=require(_0xdfa2('0x4'));var db=require(_0xdfa2('0x5'))['db'];var utils=require(_0xdfa2('0x6'));var logger=require(_0xdfa2('0x7'))(_0xdfa2('0x8'));var config=require(_0xdfa2('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdfa2('0xa')][_0xdfa2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3f447b,_0x3cb6dd,_0x4b128e){return new BPromise(function(_0x19a19d,_0x2c0b5a){return client[_0xdfa2('0xc')](_0x3f447b,_0x4b128e)[_0xdfa2('0xd')](function(_0xf680d){logger[_0xdfa2('0xe')](_0xdfa2('0xf'),_0x3cb6dd,_0xdfa2('0x10'));logger['debug'](_0xdfa2('0x11'),_0x3cb6dd,'request\x20sent',JSON['stringify'](_0xf680d));if(_0xf680d[_0xdfa2('0x12')]){if(_0xf680d[_0xdfa2('0x12')][_0xdfa2('0x13')]===0x1f4){logger[_0xdfa2('0x12')](_0xdfa2('0xf'),_0x3cb6dd,_0xf680d[_0xdfa2('0x12')][_0xdfa2('0x14')]);return _0x2c0b5a(_0xf680d['error'][_0xdfa2('0x14')]);}logger[_0xdfa2('0x12')](_0xdfa2('0xf'),_0x3cb6dd,_0xf680d['error']['message']);return _0x19a19d(_0xf680d[_0xdfa2('0x12')][_0xdfa2('0x14')]);}else{logger[_0xdfa2('0xe')](_0xdfa2('0xf'),_0x3cb6dd,_0xdfa2('0x10'));_0x19a19d(_0xf680d[_0xdfa2('0x15')][_0xdfa2('0x14')]);}})[_0xdfa2('0x16')](function(_0x1d0296){logger['error'](_0xdfa2('0xf'),_0x3cb6dd,_0x1d0296);_0x2c0b5a(_0x1d0296);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/index.js b/server/api/intDynamics365Account/index.js index 0832064..fb3279b 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 _0x2f1b=['put','update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intDynamics365Account.controller','get','index','show','/:id/configurations','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0x2f1b,0xcd));var _0xb2f1=function(_0x24d630,_0x40eede){_0x24d630=_0x24d630-0x0;var _0x2de7cf=_0x2f1b[_0x24d630];return _0x2de7cf;};'use strict';var multer=require(_0xb2f1('0x0'));var util=require(_0xb2f1('0x1'));var path=require(_0xb2f1('0x2'));var timeout=require(_0xb2f1('0x3'));var express=require(_0xb2f1('0x4'));var router=express[_0xb2f1('0x5')]();var fs_extra=require(_0xb2f1('0x6'));var auth=require(_0xb2f1('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb2f1('0x8'));var controller=require(_0xb2f1('0x9'));router[_0xb2f1('0xa')]('/',auth['isAuthenticated'](),controller[_0xb2f1('0xb')]);router[_0xb2f1('0xa')]('/:id',auth['isAuthenticated'](),controller[_0xb2f1('0xc')]);router[_0xb2f1('0xa')](_0xb2f1('0xd'),auth['isAuthenticated'](),controller[_0xb2f1('0xe')]);router[_0xb2f1('0xa')](_0xb2f1('0xf'),auth[_0xb2f1('0x10')](),controller[_0xb2f1('0x11')]);router[_0xb2f1('0x12')]('/',auth[_0xb2f1('0x10')](),controller['create']);router[_0xb2f1('0x12')](_0xb2f1('0xd'),auth[_0xb2f1('0x10')](),controller[_0xb2f1('0x13')]);router[_0xb2f1('0x14')]('/:id',auth[_0xb2f1('0x10')](),controller[_0xb2f1('0x15')]);router[_0xb2f1('0x16')]('/:id',auth[_0xb2f1('0x10')](),controller[_0xb2f1('0x17')]);module[_0xb2f1('0x18')]=router; \ No newline at end of file +var _0x2aeb=['exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Account.controller','isAuthenticated','/:id','show','/:id/configurations','getConfigurations','get','/:id/fields','getFields','post','create','put','delete'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2aeb,0x85));var _0xb2ae=function(_0x12f810,_0xe29812){_0x12f810=_0x12f810-0x0;var _0x5dee98=_0x2aeb[_0x12f810];return _0x5dee98;};'use strict';var multer=require(_0xb2ae('0x0'));var util=require(_0xb2ae('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb2ae('0x2'));var router=express[_0xb2ae('0x3')]();var fs_extra=require(_0xb2ae('0x4'));var auth=require(_0xb2ae('0x5'));var interaction=require(_0xb2ae('0x6'));var config=require(_0xb2ae('0x7'));var controller=require(_0xb2ae('0x8'));router['get']('/',auth[_0xb2ae('0x9')](),controller['index']);router['get'](_0xb2ae('0xa'),auth[_0xb2ae('0x9')](),controller[_0xb2ae('0xb')]);router['get'](_0xb2ae('0xc'),auth[_0xb2ae('0x9')](),controller[_0xb2ae('0xd')]);router[_0xb2ae('0xe')](_0xb2ae('0xf'),auth[_0xb2ae('0x9')](),controller[_0xb2ae('0x10')]);router[_0xb2ae('0x11')]('/',auth['isAuthenticated'](),controller[_0xb2ae('0x12')]);router[_0xb2ae('0x11')](_0xb2ae('0xc'),auth[_0xb2ae('0x9')](),controller['addConfiguration']);router[_0xb2ae('0x13')]('/:id',auth[_0xb2ae('0x9')](),controller['update']);router[_0xb2ae('0x14')]('/:id',auth[_0xb2ae('0x9')](),controller['destroy']);module[_0xb2ae('0x15')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.attributes.js b/server/api/intDynamics365Account/intDynamics365Account.attributes.js index a6961d2..efdf0ef 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 _0xfcbd=['BOOLEAN','sequelize','STRING'];(function(_0x3167a8,_0x4d5006){var _0x20073f=function(_0x5b7216){while(--_0x5b7216){_0x3167a8['push'](_0x3167a8['shift']());}};_0x20073f(++_0x4d5006);}(_0xfcbd,0x160));var _0xdfcb=function(_0x183bd8,_0x53bd79){_0x183bd8=_0x183bd8-0x0;var _0x1388e3=_0xfcbd[_0x183bd8];return _0x1388e3;};'use strict';var Sequelize=require(_0xdfcb('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xdfcb('0x1')]},'password':{'type':Sequelize[_0xdfcb('0x1')]},'remoteUri':{'type':Sequelize[_0xdfcb('0x1')]},'tenantId':{'type':Sequelize[_0xdfcb('0x1')]},'clientId':{'type':Sequelize[_0xdfcb('0x1')]},'clientSecret':{'type':Sequelize[_0xdfcb('0x1')]},'serverUrl':{'type':Sequelize[_0xdfcb('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xdfcb('0x1')]},'modernAuthentication':{'type':Sequelize[_0xdfcb('0x2')],'defaultValue':!![]}}; \ No newline at end of file +var _0x8558=['BOOLEAN','exports','STRING'];(function(_0x1ebf81,_0x587afe){var _0x533e5f=function(_0x1e6458){while(--_0x1e6458){_0x1ebf81['push'](_0x1ebf81['shift']());}};_0x533e5f(++_0x587afe);}(_0x8558,0x103));var _0x8855=function(_0x255387,_0x47b6ba){_0x255387=_0x255387-0x0;var _0x40e299=_0x8558[_0x255387];return _0x40e299;};'use strict';var Sequelize=require('sequelize');module[_0x8855('0x0')]={'name':{'type':Sequelize[_0x8855('0x1')]},'username':{'type':Sequelize[_0x8855('0x1')]},'password':{'type':Sequelize[_0x8855('0x1')]},'remoteUri':{'type':Sequelize[_0x8855('0x1')]},'tenantId':{'type':Sequelize[_0x8855('0x1')]},'clientId':{'type':Sequelize[_0x8855('0x1')]},'clientSecret':{'type':Sequelize['STRING']},'serverUrl':{'type':Sequelize[_0x8855('0x1')],'allowNull':![]},'description':{'type':Sequelize['STRING']},'modernAuthentication':{'type':Sequelize[_0x8855('0x2')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.controller.js b/server/api/intDynamics365Account/intDynamics365Account.controller.js index ac2a029..e0bac4d 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 _0xe802=['fields','hasOwnProperty','nolimit','order','where','pick','filter','map','VIRTUAL','merge','options','Dynamics365Account','findAll','show','params','keys','includeAll','include','find','catch','create','body','destroy','getConfigurations','Dynamics365Configuration','length','sort','addConfiguration','findOne','Subjects','getSubjects','channel','Descriptions','getDescriptions','Dynamics365Field','slice','format','incident','Incident','PhoneCall','description','caseorigincode','subject','directioncode','accountidname','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyyominame','createdonbehalfbyname','createdonbehalfbyyominame','customeridname','customeridtype','customeridyominame','emailaddress','entitlementidname','escalatedon','firstresponsebykpiidname','followupby','influencescore','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedonbehalfbyname','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','owneridname','owneridtype','owneridyominame','parentcaseidname','primarycontactidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidname','sentimentvalue','slaname','socialprofileidname','statuscode','ticketnumber','timezoneruleversionnumber','transactioncurrencyidname','versionnumber','concat','username','password','clientSecret','modernAuthentication','CloudProvider','data5','data7','access_token','remoteUri','POST','tenantId','/oauth2/token','GET','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','Bearer\x20','4.0','value','MetadataId','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','remove','includes','@odata.type','substring','PicklistAttributeMetadata','push','forEach','isNil','lastIndexOf','BooleanAttributeMetadata','StringAttributeMetadata','DoubleAttributeMetadata','BigIntAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','StatusAttributeMetadata','EntityNameAttributeMetadata','StateAttributeMetadata','all','test','stack','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','OptionSet','Options','Label','UserLocalizedLabel','Value','LogicalName','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','TrueOption','true',')/Microsoft.Dynamics.CRM.','?$select=DisplayName,LogicalName','util','../../components/parsers/qs','../../config/logger','api','../../mysqldb','json','offset','undefined','limit','count','status','set','Content-Range','update','then','end','error','name','index','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes'];(function(_0x1fa16f,_0x14373c){var _0x5e15a1=function(_0x509320){while(--_0x509320){_0x1fa16f['push'](_0x1fa16f['shift']());}};_0x5e15a1(++_0x14373c);}(_0xe802,0x97));var _0x2e80=function(_0x32ef14,_0x1e6822){_0x32ef14=_0x32ef14-0x0;var _0x567f79=_0xe802[_0x32ef14];return _0x567f79;};'use strict';var rp=require('request-promise');var util=require(_0x2e80('0x0'));var _=require('lodash');var qs=require(_0x2e80('0x1'));var logger=require(_0x2e80('0x2'))(_0x2e80('0x3'));var db=require(_0x2e80('0x4'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithResult(_0xe5ea04,_0x2c7798){_0x2c7798=_0x2c7798||0xc8;return function(_0x1e3b68){if(_0x1e3b68){return _0xe5ea04['status'](_0x2c7798)[_0x2e80('0x5')](_0x1e3b68);}};}function respondWithFilteredResult(_0x79b44a,_0x1f6242){return function(_0x1c218e){if(_0x1c218e){var _0x228f1c=typeof _0x1f6242[_0x2e80('0x6')]===_0x2e80('0x7')&&typeof _0x1f6242[_0x2e80('0x8')]===_0x2e80('0x7');var _0x58a95f=_0x1c218e[_0x2e80('0x9')];var _0x2423bf=_0x228f1c?0x0:_0x1f6242['offset'];var _0x3d3181=_0x228f1c?_0x1c218e[_0x2e80('0x9')]:_0x1f6242[_0x2e80('0x6')]+_0x1f6242[_0x2e80('0x8')];var _0x9d3613;if(_0x3d3181>=_0x58a95f){_0x3d3181=_0x58a95f;_0x9d3613=0xc8;}else{_0x9d3613=0xce;}_0x79b44a[_0x2e80('0xa')](_0x9d3613);return _0x79b44a[_0x2e80('0xb')](_0x2e80('0xc'),_0x2423bf+'-'+_0x3d3181+'/'+_0x58a95f)[_0x2e80('0x5')](_0x1c218e);}return null;};}function saveUpdates(_0x95bdb8){return function(_0xc435fa){if(_0xc435fa){return _0xc435fa[_0x2e80('0xd')](_0x95bdb8)['then'](function(_0x3eaa53){return _0x3eaa53;});}return null;};}function removeEntity(_0x279f48){return function(_0x4801a0){if(_0x4801a0){return _0x4801a0['destroy']()[_0x2e80('0xe')](function(){_0x279f48[_0x2e80('0xa')](0xcc)[_0x2e80('0xf')]();});}};}function handleEntityNotFound(_0x14589d){return function(_0xe4ad41){if(!_0xe4ad41){_0x14589d['sendStatus'](0x194);}return _0xe4ad41;};}function handleError(_0x474cc6,_0x225b5e){_0x225b5e=_0x225b5e||0x1f4;return function(_0x13ad4d){logger[_0x2e80('0x10')](_0x13ad4d['stack']);if(_0x13ad4d[_0x2e80('0x11')]){delete _0x13ad4d[_0x2e80('0x11')];}_0x474cc6[_0x2e80('0xa')](_0x225b5e)['send'](_0x13ad4d);};}exports[_0x2e80('0x12')]=function(_0x53c6e6,_0x4590cf){var _0x2511ad={},_0x1401f2={},_0x1fe616={'count':0x0,'rows':[]};var _0x1c175a=_['map'](db['Dynamics365Account'][_0x2e80('0x13')],function(_0x5f1535){return{'name':_0x5f1535[_0x2e80('0x14')],'type':_0x5f1535[_0x2e80('0x15')][_0x2e80('0x16')]};});_0x1401f2[_0x2e80('0x17')]=_['map'](_0x1c175a,_0x2e80('0x11'));_0x1401f2[_0x2e80('0x18')]=_['keys'](_0x53c6e6[_0x2e80('0x18')]);_0x1401f2[_0x2e80('0x19')]=_[_0x2e80('0x1a')](_0x1401f2['model'],_0x1401f2[_0x2e80('0x18')]);_0x2511ad[_0x2e80('0x1b')]=_['intersection'](_0x1401f2['model'],qs[_0x2e80('0x1c')](_0x53c6e6[_0x2e80('0x18')]['fields']));_0x2511ad[_0x2e80('0x1b')]=_0x2511ad[_0x2e80('0x1b')]['length']?_0x2511ad[_0x2e80('0x1b')]:_0x1401f2[_0x2e80('0x17')];if(!_0x53c6e6['query'][_0x2e80('0x1d')](_0x2e80('0x1e'))){_0x2511ad[_0x2e80('0x8')]=qs[_0x2e80('0x8')](_0x53c6e6[_0x2e80('0x18')][_0x2e80('0x8')]);_0x2511ad['offset']=qs['offset'](_0x53c6e6[_0x2e80('0x18')][_0x2e80('0x6')]);}_0x2511ad[_0x2e80('0x1f')]=qs['sort'](_0x53c6e6[_0x2e80('0x18')]['sort']);_0x2511ad[_0x2e80('0x20')]=qs[_0x2e80('0x19')](_[_0x2e80('0x21')](_0x53c6e6['query'],_0x1401f2[_0x2e80('0x19')]),_0x1c175a);if(_0x53c6e6[_0x2e80('0x18')][_0x2e80('0x22')]){_0x2511ad['where']=_['merge'](_0x2511ad['where'],{'$or':_[_0x2e80('0x23')](_0x1c175a,function(_0x27e302){if(_0x27e302[_0x2e80('0x15')]!==_0x2e80('0x24')){var _0x21783c={};_0x21783c[_0x27e302[_0x2e80('0x11')]]={'$like':'%'+_0x53c6e6[_0x2e80('0x18')][_0x2e80('0x22')]+'%'};return _0x21783c;}})});}_0x2511ad=_[_0x2e80('0x25')]({},_0x2511ad,_0x53c6e6[_0x2e80('0x26')]);var _0x389b9a={'where':_0x2511ad[_0x2e80('0x20')]};return db[_0x2e80('0x27')][_0x2e80('0x9')](_0x389b9a)[_0x2e80('0xe')](function(_0x502a24){_0x1fe616[_0x2e80('0x9')]=_0x502a24;if(_0x53c6e6[_0x2e80('0x18')]['includeAll']){_0x2511ad['include']=[{'all':!![]}];}return db[_0x2e80('0x27')][_0x2e80('0x28')](_0x2511ad);})[_0x2e80('0xe')](function(_0x1608a9){_0x1fe616['rows']=_0x1608a9;return _0x1fe616;})[_0x2e80('0xe')](respondWithFilteredResult(_0x4590cf,_0x2511ad))['catch'](handleError(_0x4590cf,null));};exports[_0x2e80('0x29')]=function(_0x108183,_0xd6cd35){var _0x243f13={'raw':![],'where':{'id':_0x108183[_0x2e80('0x2a')]['id']}},_0x211031={};_0x211031[_0x2e80('0x17')]=_[_0x2e80('0x2b')](db[_0x2e80('0x27')]['rawAttributes']);_0x211031[_0x2e80('0x18')]=_['keys'](_0x108183['query']);_0x211031[_0x2e80('0x19')]=_['intersection'](_0x211031[_0x2e80('0x17')],_0x211031['query']);_0x243f13[_0x2e80('0x1b')]=_['intersection'](_0x211031['model'],qs['fields'](_0x108183[_0x2e80('0x18')][_0x2e80('0x1c')]));_0x243f13[_0x2e80('0x1b')]=_0x243f13[_0x2e80('0x1b')]['length']?_0x243f13[_0x2e80('0x1b')]:_0x211031[_0x2e80('0x17')];if(_0x108183[_0x2e80('0x18')][_0x2e80('0x2c')]){_0x243f13[_0x2e80('0x2d')]=[{'all':!![]}];}_0x243f13=_[_0x2e80('0x25')]({},_0x243f13,_0x108183[_0x2e80('0x26')]);return db[_0x2e80('0x27')][_0x2e80('0x2e')](_0x243f13)[_0x2e80('0xe')](handleEntityNotFound(_0xd6cd35,null))[_0x2e80('0xe')](respondWithResult(_0xd6cd35,null))[_0x2e80('0x2f')](handleError(_0xd6cd35,null));};exports[_0x2e80('0x30')]=function(_0x9d0132,_0x44efdf){return db[_0x2e80('0x27')]['create'](_0x9d0132[_0x2e80('0x31')],{})[_0x2e80('0xe')](respondWithResult(_0x44efdf,0xc9))[_0x2e80('0x2f')](handleError(_0x44efdf,null));};exports['update']=function(_0x504a56,_0x25128f){if(_0x504a56['body']['id']){delete _0x504a56[_0x2e80('0x31')]['id'];}return db['Dynamics365Account'][_0x2e80('0x2e')]({'where':{'id':_0x504a56[_0x2e80('0x2a')]['id']}})[_0x2e80('0xe')](handleEntityNotFound(_0x25128f,null))['then'](saveUpdates(_0x504a56['body'],null))['then'](respondWithResult(_0x25128f,null))[_0x2e80('0x2f')](handleError(_0x25128f,null));};exports[_0x2e80('0x32')]=function(_0x346e7a,_0x382b90){return db[_0x2e80('0x27')][_0x2e80('0x2e')]({'where':{'id':_0x346e7a[_0x2e80('0x2a')]['id']}})[_0x2e80('0xe')](handleEntityNotFound(_0x382b90,null))[_0x2e80('0xe')](removeEntity(_0x382b90,null))[_0x2e80('0x2f')](handleError(_0x382b90,null));};exports[_0x2e80('0x33')]=function(_0x2396d1,_0x35b680){var _0x21c179={};var _0x28613e={};var _0x290a2d;var _0x15f3b5;return db[_0x2e80('0x27')]['findOne']({'where':{'id':_0x2396d1[_0x2e80('0x2a')]['id']}})[_0x2e80('0xe')](handleEntityNotFound(_0x35b680,null))[_0x2e80('0xe')](function(_0x567d1b){if(_0x567d1b){_0x290a2d=_0x567d1b;_0x28613e[_0x2e80('0x17')]=_[_0x2e80('0x2b')](db[_0x2e80('0x34')]['rawAttributes']);_0x28613e[_0x2e80('0x18')]=_['keys'](_0x2396d1['query']);_0x28613e['filters']=_[_0x2e80('0x1a')](_0x28613e[_0x2e80('0x17')],_0x28613e[_0x2e80('0x18')]);_0x21c179[_0x2e80('0x1b')]=_[_0x2e80('0x1a')](_0x28613e['model'],qs[_0x2e80('0x1c')](_0x2396d1[_0x2e80('0x18')][_0x2e80('0x1c')]));_0x21c179['attributes']=_0x21c179['attributes'][_0x2e80('0x35')]?_0x21c179[_0x2e80('0x1b')]:_0x28613e[_0x2e80('0x17')];_0x21c179[_0x2e80('0x1f')]=qs[_0x2e80('0x36')](_0x2396d1['query'][_0x2e80('0x36')]);_0x21c179[_0x2e80('0x20')]=qs['filters'](_['pick'](_0x2396d1[_0x2e80('0x18')],_0x28613e[_0x2e80('0x19')]));if(_0x2396d1[_0x2e80('0x18')][_0x2e80('0x22')]){_0x21c179[_0x2e80('0x20')]=_[_0x2e80('0x25')](_0x21c179[_0x2e80('0x20')],{'$or':_['map'](_0x21c179[_0x2e80('0x1b')],function(_0x1e1231){var _0x45a420={};_0x45a420[_0x1e1231]={'$like':'%'+_0x2396d1[_0x2e80('0x18')]['filter']+'%'};return _0x45a420;})});}_0x21c179=_[_0x2e80('0x25')]({},_0x21c179,_0x2396d1[_0x2e80('0x26')]);return _0x290a2d[_0x2e80('0x33')](_0x21c179);}})[_0x2e80('0xe')](function(_0x45193e){if(_0x45193e){_0x15f3b5=_0x45193e['length'];if(!_0x2396d1['query']['hasOwnProperty']('nolimit')){_0x21c179['limit']=qs[_0x2e80('0x8')](_0x2396d1['query'][_0x2e80('0x8')]);_0x21c179[_0x2e80('0x6')]=qs[_0x2e80('0x6')](_0x2396d1[_0x2e80('0x18')]['offset']);}return _0x290a2d[_0x2e80('0x33')](_0x21c179);}})[_0x2e80('0xe')](function(_0xe6e18c){if(_0xe6e18c){return _0xe6e18c?{'count':_0x15f3b5,'rows':_0xe6e18c}:null;}})[_0x2e80('0xe')](respondWithResult(_0x35b680,null))[_0x2e80('0x2f')](handleError(_0x35b680,null));};exports[_0x2e80('0x37')]=function(_0x170a46,_0x141449){if(_0x170a46['body']['id']){delete _0x170a46['body']['id'];}return db[_0x2e80('0x27')][_0x2e80('0x38')]({'where':{'id':_0x170a46[_0x2e80('0x2a')]['id']}})[_0x2e80('0xe')](handleEntityNotFound(_0x141449,null))[_0x2e80('0xe')](function(_0x153032){if(_0x153032){_0x170a46[_0x2e80('0x31')]['AccountId']=_0x153032['id'];_0x170a46['body'][_0x2e80('0x39')]=integrations[_0x2e80('0x3a')](_0x170a46[_0x2e80('0x31')][_0x2e80('0x3b')],_0x170a46[_0x2e80('0x31')][_0x2e80('0x15')]);_0x170a46[_0x2e80('0x31')][_0x2e80('0x3c')]=integrations[_0x2e80('0x3d')](_0x170a46['body'][_0x2e80('0x3b')],_0x170a46[_0x2e80('0x31')][_0x2e80('0x15')]);return db[_0x2e80('0x34')][_0x2e80('0x30')](_0x170a46[_0x2e80('0x31')],{'include':[{'model':db[_0x2e80('0x3e')],'as':_0x2e80('0x39')},{'model':db['Dynamics365Field'],'as':_0x2e80('0x3c')}]});}return null;})['then'](respondWithResult(_0x141449,null))['catch'](handleError(_0x141449,null));};function sanitizeRemoteUri(_0x4c0594){var _0x1eb553=_0x4c0594[_0x2e80('0x3f')](-0x1);if(_0x1eb553==='/')return _0x4c0594['substring'](0x0,_0x4c0594['lastIndexOf'](_0x1eb553));return _0x4c0594;}function getWebApiUrl(_0x44a118){return util[_0x2e80('0x40')]('%s/api/data/v9.0/',_0x44a118);}exports['getFields']=function(_0x27f903,_0x5c7ed9){var _0x5bba79=_0x27f903[_0x2e80('0x18')]['ticketType'];var _0x5bcb66=_0x5bba79===_0x2e80('0x41')?_0x2e80('0x42'):_0x2e80('0x43');var _0x3faf1a='';var _0x566513='';var _0x2095dd='';var _0x2bdd3f='';var _0x2f3eb1='';var _0xc20a23='';var _0x1e1258='';var _0x689c93='';var _0x25dcd0=['title',_0x2e80('0x44'),'customerid','ownerid',_0x2e80('0x45'),_0x2e80('0x46'),'phonenumber','regardingobjectid',_0x2e80('0x47'),'phonecall_activity_parties'];var _0x5b5f9f=[_0x2e80('0x48'),_0x2e80('0x49'),_0x2e80('0x4a'),'billedserviceunits',_0x2e80('0x4b'),_0x2e80('0x4c'),_0x2e80('0x4d'),'contractidname',_0x2e80('0x4e'),_0x2e80('0x4f'),'createdbyname',_0x2e80('0x50'),'createdon',_0x2e80('0x51'),_0x2e80('0x52'),_0x2e80('0x53'),_0x2e80('0x54'),_0x2e80('0x55'),_0x2e80('0x56'),_0x2e80('0x57'),'entityimage_timestamp','entityimage_url',_0x2e80('0x58'),'exchangerate',_0x2e80('0x59'),_0x2e80('0x5a'),'importsequencenumber',_0x2e80('0x5b'),'kbarticleidname',_0x2e80('0x5c'),'masteridname',_0x2e80('0x5d'),_0x2e80('0x5e'),_0x2e80('0x5f'),'modifiedbyyominame','modifiedon',_0x2e80('0x60'),'modifiedonbehalfbyyominame',_0x2e80('0x61'),_0x2e80('0x62'),_0x2e80('0x63'),_0x2e80('0x64'),'overriddencreatedon',_0x2e80('0x65'),_0x2e80('0x66'),_0x2e80('0x67'),_0x2e80('0x68'),_0x2e80('0x69'),'primarycontactidyominame',_0x2e80('0x6a'),_0x2e80('0x6b'),_0x2e80('0x6c'),_0x2e80('0x6d'),_0x2e80('0x6e'),_0x2e80('0x6f'),_0x2e80('0x70'),'responsiblecontactidyominame',_0x2e80('0x71'),'slainvokedidname',_0x2e80('0x72'),_0x2e80('0x73'),'statecode',_0x2e80('0x74'),'subjectidname',_0x2e80('0x75'),_0x2e80('0x76'),_0x2e80('0x77'),'traversedpath','utcconversiontimezonecode',_0x2e80('0x78')];var _0x1efb99=_0x25dcd0[_0x2e80('0x79')](_0x5b5f9f);return db[_0x2e80('0x27')]['findOne']({'where':{'id':_0x27f903[_0x2e80('0x2a')]['id']},'attributes':['id',_0x2e80('0x7a'),_0x2e80('0x7b'),'remoteUri','tenantId','clientId',_0x2e80('0x7c'),_0x2e80('0x7d')],'include':[{'model':db[_0x2e80('0x7e')],'as':'CloudProvider','attributes':['id',_0x2e80('0x7f'),_0x2e80('0x80')]}]})[_0x2e80('0xe')](handleEntityNotFound(_0x5c7ed9,null))[_0x2e80('0xe')](function(_0x3ed92c){if(_0x3ed92c){if(_0x3ed92c[_0x2e80('0x7d')]){_0x3ed92c[_0x2e80('0x81')]=_0x3ed92c[_0x2e80('0x7e')][_0x2e80('0x7f')];_0x689c93=sanitizeRemoteUri(_0x3ed92c[_0x2e80('0x7e')][_0x2e80('0x80')]);_0x1e1258=getWebApiUrl(_0x689c93);return _0x3ed92c;}_0x689c93=sanitizeRemoteUri(_0x3ed92c[_0x2e80('0x82')]);_0x1e1258=getWebApiUrl(_0x689c93);var _0x2da9d5={'method':_0x2e80('0x83'),'uri':'https://login.microsoftonline.com/'+_0x3ed92c[_0x2e80('0x84')]+_0x2e80('0x85'),'form':{'client_id':_0x3ed92c['clientId'],'resource':_0x689c93,'username':_0x3ed92c[_0x2e80('0x7a')],'password':_0x3ed92c[_0x2e80('0x7b')],'grant_type':_0x2e80('0x7b'),'client_secret':_0x3ed92c[_0x2e80('0x7c')]},'json':!![]};return rp(_0x2da9d5);}})[_0x2e80('0xe')](function(_0x45211e){_0xc20a23=_0x45211e[_0x2e80('0x81')];var _0x4ebc1b={'method':_0x2e80('0x86'),'uri':encodeURI(_0x1e1258+_0x2e80('0x87')+_0x5bcb66+'\x27'),'headers':{'Authorization':_0x2e80('0x88')+_0xc20a23,'If-None-Match':null,'OData-Version':_0x2e80('0x89')},'json':!![]};return rp(_0x4ebc1b);})['then'](function(_0x7624f4){var _0x277f7f=_0x7624f4[_0x2e80('0x8a')][0x0];var _0x5683e6=_0x277f7f[_0x2e80('0x8b')];var _0x457b65={'method':_0x2e80('0x86'),'uri':_0x1e1258+_0x2e80('0x8c')+_0x5683e6+_0x2e80('0x8d'),'headers':{'Authorization':_0x2e80('0x88')+_0xc20a23,'If-None-Match':null,'OData-Version':_0x2e80('0x89')},'json':!![]};return rp(_0x457b65);})['then'](function(_0x10fa5c){_0x3faf1a=_0x10fa5c;_0x566513=_0x3faf1a['Attributes'];_0x566513=_[_0x2e80('0x8e')](_0x566513,function(_0xfae729){return!_0x1efb99[_0x2e80('0x8f')](_0xfae729['LogicalName']);});var _0x5d1547=[];var _0x57ed28=[];_0x566513['forEach'](function(_0xabe520){if(_0xabe520[_0x2e80('0x90')]){var _0x51cdce=_0xabe520[_0x2e80('0x90')][_0x2e80('0x91')](_0xabe520[_0x2e80('0x90')]['lastIndexOf']('.')+0x1);if(_0x51cdce===_0x2e80('0x92')){_0x5d1547[_0x2e80('0x93')](getSelectList(_0x1e1258,_0x5bba79,_0x57ed28,_0x3faf1a[_0x2e80('0x8b')],_0xabe520[_0x2e80('0x8b')],_0xc20a23));}}});return Promise['all'](_0x5d1547);})['then'](function(_0x23792f){_0x2095dd=_0x23792f[0x0];var _0x27541c=[];var _0x3c6218=[];_0x566513[_0x2e80('0x94')](function(_0x491815){if(!_[_0x2e80('0x95')](_0x491815[_0x2e80('0x90')])){var _0x3c0610=_0x491815[_0x2e80('0x90')][_0x2e80('0x91')](_0x491815['@odata.type'][_0x2e80('0x96')]('.')+0x1);if(_0x3c0610===_0x2e80('0x97')){_0x27541c[_0x2e80('0x93')](getBooleanList(_0x1e1258,_0x5bba79,_0x3c6218,_0x3faf1a[_0x2e80('0x8b')],_0x491815['MetadataId'],_0xc20a23));}}});return Promise['all'](_0x27541c);})[_0x2e80('0xe')](function(_0x166b88){_0x2bdd3f=_0x166b88[0x0];var _0x4045d2=[];var _0x16d1f2=[];_0x566513['forEach'](function(_0x577484){if(_0x577484[_0x2e80('0x90')]){var _0x2c43d1=_0x577484[_0x2e80('0x90')]['substring'](_0x577484['@odata.type'][_0x2e80('0x96')]('.')+0x1);if(_0x2c43d1===_0x2e80('0x98')||_0x2c43d1===_0x2e80('0x99')||_0x2c43d1===_0x2e80('0x9a')||_0x2c43d1===_0x2e80('0x9b')||_0x2c43d1===_0x2e80('0x9c')||_0x2c43d1===_0x2e80('0x9d')||_0x2c43d1===_0x2e80('0x9e')||_0x2c43d1===_0x2e80('0x9f')||_0x2c43d1===_0x2e80('0xa0')||_0x2c43d1==='DecimalAttributeMetadata'){_0x4045d2[_0x2e80('0x93')](getInputList(_0x1e1258,_0x5bba79,_0x2c43d1,_0x16d1f2,_0x3faf1a[_0x2e80('0x8b')],_0x577484[_0x2e80('0x8b')],_0xc20a23));}}});return Promise[_0x2e80('0xa1')](_0x4045d2);})[_0x2e80('0xe')](function(_0x348901){_0x2f3eb1=_0x348901[0x0];var _0x4fef52=_0x2095dd[_0x2e80('0x79')](_0x2bdd3f)['concat'](_0x2f3eb1);var _0xf6db11={'count':_0x4fef52['length'],'rows':_0x4fef52};return _0xf6db11;})[_0x2e80('0xe')](respondWithResult(_0x5c7ed9,null))['catch'](function(_0x54e6f6){var _0x2618bf=_0x27f903[_0x2e80('0x18')][_0x2e80('0xa2')]?0x1f4:_0x54e6f6['statusCode']||0x1f4;logger[_0x2e80('0x10')](_0x54e6f6[_0x2e80('0xa3')]);delete _0x54e6f6[_0x2e80('0x11')];if(_0x2618bf===0x191){_0x2618bf=0x190;}_0x5c7ed9[_0x2e80('0xa')](_0x2618bf)['send'](_0x27f903[_0x2e80('0x18')][_0x2e80('0xa2')]?{'message':'Wrong\x20credentials','statusCode':_0x54e6f6[_0x2e80('0xa4')]}:_0x54e6f6);});};function getSelectList(_0x5dc7a6,_0x4a4bf0,_0x4fc01d,_0x5bc029,_0x231cd6,_0x330427){var _0x500e63={'method':_0x2e80('0x86'),'uri':_0x5dc7a6+_0x2e80('0x8c')+_0x5bc029+_0x2e80('0xa5')+_0x231cd6+_0x2e80('0xa6')+'$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','headers':{'Authorization':_0x2e80('0x88')+_0x330427,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x500e63)[_0x2e80('0xe')](function(_0x490dce){var _0x1aa11b=[];var _0x52b1e8=_0x490dce[_0x2e80('0xa7')][_0x2e80('0xa8')];_0x52b1e8['forEach'](function(_0x120523){_0x1aa11b[_0x2e80('0x93')]({'name':_0x120523[_0x2e80('0xa9')][_0x2e80('0xaa')][_0x2e80('0xa9')],'value':String(_0x120523[_0x2e80('0xab')])});});var _0x553fbe={'id':_0x4a4bf0+'_'+_0x490dce[_0x2e80('0xac')],'name':_0x490dce[_0x2e80('0xad')][_0x2e80('0xaa')][_0x2e80('0xa9')],'custom':![],'options':_0x1aa11b};_0x4fc01d[_0x2e80('0x93')](_0x553fbe);return _0x4fc01d;});}function getBooleanList(_0x5c6d3e,_0x4e49e4,_0x11d676,_0x197d96,_0x9a0122,_0x5e24ab){var _0x4d36da={'method':_0x2e80('0x86'),'uri':_0x5c6d3e+'EntityDefinitions('+_0x197d96+_0x2e80('0xa5')+_0x9a0122+_0x2e80('0xae'),'headers':{'Authorization':_0x2e80('0x88')+_0x5e24ab,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x4d36da)[_0x2e80('0xe')](function(_0x11561c){var _0x184283=[];_0x184283[_0x2e80('0x93')]({'name':_0x11561c[_0x2e80('0xa7')][_0x2e80('0xaf')][_0x2e80('0xa9')][_0x2e80('0xaa')][_0x2e80('0xa9')],'value':_0x2e80('0xb0')},{'name':_0x11561c['OptionSet']['FalseOption'][_0x2e80('0xa9')][_0x2e80('0xaa')]['Label'],'value':'false'});var _0x539859={'id':_0x4e49e4+'_'+_0x11561c[_0x2e80('0xac')],'name':_0x11561c['DisplayName']['UserLocalizedLabel'][_0x2e80('0xa9')],'custom':![],'options':_0x184283};_0x11d676[_0x2e80('0x93')](_0x539859);return _0x11d676;});}function getInputList(_0x260872,_0x4a4fe1,_0x480e18,_0x3e6733,_0x2a006e,_0xc64bae,_0x7677ad){var _0x45af00={'method':_0x2e80('0x86'),'uri':_0x260872+_0x2e80('0x8c')+_0x2a006e+')/Attributes('+_0xc64bae+_0x2e80('0xb1')+_0x480e18+_0x2e80('0xb2'),'headers':{'Authorization':_0x2e80('0x88')+_0x7677ad,'If-None-Match':null,'OData-Version':_0x2e80('0x89')},'json':!![]};return rp(_0x45af00)[_0x2e80('0xe')](function(_0x403927){var _0x4ea738={'id':_0x4a4fe1+'_'+_0x403927[_0x2e80('0xac')],'name':_0x403927['DisplayName'][_0x2e80('0xaa')]?_0x403927[_0x2e80('0xad')][_0x2e80('0xaa')][_0x2e80('0xa9')]:_0x403927[_0x2e80('0xac')],'custom':![],'options':[]};_0x3e6733[_0x2e80('0x93')](_0x4ea738);return _0x3e6733;});} \ No newline at end of file +var _0xc098=['entityimage_url','escalatedon','exchangerate','firstresponsebykpiidname','importsequencenumber','kbarticleidname','lastonholdtime','modifiedbyexternalpartyname','modifiedbyexternalpartyyominame','modifiedbyname','modifiedbyyominame','modifiedon','modifiedonbehalfbyname','modifiedonbehalfbyyominame','msdyn_incidenttypename','msdyn_iotalertname','numberofchildincidents','onholdtime','overriddencreatedon','owneridname','owneridtype','parentcaseidname','prioritycodename','productidname','productserialnumber','resolveby','resolvebykpiidname','responseby','responsiblecontactidyominame','sentimentvalue','slainvokedidname','statecode','ticketnumber','transactioncurrencyidname','traversedpath','utcconversiontimezonecode','username','password','remoteUri','clientId','clientSecret','CloudProvider','data5','data7','modernAuthentication','access_token','https://login.microsoftonline.com/','tenantId','/oauth2/token','EntityDefinitions?$select=DisplayName,EntitySetName&$filter=SchemaName\x20eq\x20\x27','4.0','value','MetadataId','GET','EntityDefinitions(',')?$select=LogicalName&$expand=Attributes($select=LogicalName)','Bearer\x20','Attributes','remove','includes','LogicalName','forEach','@odata.type','lastIndexOf','PicklistAttributeMetadata','all','isNil','substring','BooleanAttributeMetadata','push','StringAttributeMetadata','IntegerAttributeMetadata','MemoAttributeMetadata','DateTimeAttributeMetadata','EntityNameAttributeMetadata','DecimalAttributeMetadata','concat','test','Wrong\x20credentials','statusCode',')/Attributes(',')/Microsoft.Dynamics.CRM.PicklistAttributeMetadata?','$select=DisplayName,LogicalName&$expand=OptionSet($select=Options)','OptionSet','Options','Label','UserLocalizedLabel','Value','DisplayName',')/Microsoft.Dynamics.CRM.BooleanAttributeMetadata?$select=DisplayName,LogicalName&$expand=OptionSet($select=FalseOption,\x20TrueOption)','true','FalseOption','false','request-promise','util','lodash','../../config/logger','api','../../mysqldb','../../components/integrations/configuration','status','undefined','limit','count','offset','set','Content-Range','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','Dynamics365Account','rawAttributes','fieldName','type','keys','filters','model','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','include','findAll','catch','show','params','intersection','find','create','body','getConfigurations','findOne','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','Dynamics365Configuration','slice','%s/api/data/v9.0/','ticketType','incident','PhoneCall','customerid','ownerid','caseorigincode','subject','phonenumber','regardingobjectid','accountidyominame','actualserviceunits','contactidname','contactidyominame','contractdetailidname','createdbyexternalpartyname','createdbyexternalpartyyominame','createdbyname','createdbyyominame','createdonbehalfbyyominame','customeridname','customeridtype','emailaddress','entitlementidname','entityimage_timestamp'];(function(_0x5311a1,_0x304912){var _0x2acb9f=function(_0x4803e7){while(--_0x4803e7){_0x5311a1['push'](_0x5311a1['shift']());}};_0x2acb9f(++_0x304912);}(_0xc098,0x114));var _0x8c09=function(_0x5593c7,_0x303844){_0x5593c7=_0x5593c7-0x0;var _0x48d66e=_0xc098[_0x5593c7];return _0x48d66e;};'use strict';var rp=require(_0x8c09('0x0'));var util=require(_0x8c09('0x1'));var _=require(_0x8c09('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x8c09('0x3'))(_0x8c09('0x4'));var db=require(_0x8c09('0x5'))['db'];var integrations=require(_0x8c09('0x6'));function respondWithResult(_0x179e7d,_0x207ff6){_0x207ff6=_0x207ff6||0xc8;return function(_0x49b5f1){if(_0x49b5f1){return _0x179e7d[_0x8c09('0x7')](_0x207ff6)['json'](_0x49b5f1);}};}function respondWithFilteredResult(_0x4ca3c1,_0x25dd85){return function(_0xc6a51c){if(_0xc6a51c){var _0x12a2f5=typeof _0x25dd85['offset']===_0x8c09('0x8')&&typeof _0x25dd85[_0x8c09('0x9')]===_0x8c09('0x8');var _0x1d2b89=_0xc6a51c[_0x8c09('0xa')];var _0x1430f3=_0x12a2f5?0x0:_0x25dd85[_0x8c09('0xb')];var _0x44245d=_0x12a2f5?_0xc6a51c[_0x8c09('0xa')]:_0x25dd85['offset']+_0x25dd85[_0x8c09('0x9')];var _0x249a5f;if(_0x44245d>=_0x1d2b89){_0x44245d=_0x1d2b89;_0x249a5f=0xc8;}else{_0x249a5f=0xce;}_0x4ca3c1[_0x8c09('0x7')](_0x249a5f);return _0x4ca3c1[_0x8c09('0xc')](_0x8c09('0xd'),_0x1430f3+'-'+_0x44245d+'/'+_0x1d2b89)['json'](_0xc6a51c);}return null;};}function saveUpdates(_0x54e38a){return function(_0x26efb9){if(_0x26efb9){return _0x26efb9[_0x8c09('0xe')](_0x54e38a)['then'](function(_0xf20073){return _0xf20073;});}return null;};}function removeEntity(_0x459eaf){return function(_0x97bb14){if(_0x97bb14){return _0x97bb14[_0x8c09('0xf')]()[_0x8c09('0x10')](function(){_0x459eaf[_0x8c09('0x7')](0xcc)[_0x8c09('0x11')]();});}};}function handleEntityNotFound(_0x2945dc){return function(_0xebc825){if(!_0xebc825){_0x2945dc[_0x8c09('0x12')](0x194);}return _0xebc825;};}function handleError(_0x39bafa,_0x1c1e81){_0x1c1e81=_0x1c1e81||0x1f4;return function(_0x2925aa){logger[_0x8c09('0x13')](_0x2925aa[_0x8c09('0x14')]);if(_0x2925aa[_0x8c09('0x15')]){delete _0x2925aa['name'];}_0x39bafa[_0x8c09('0x7')](_0x1c1e81)[_0x8c09('0x16')](_0x2925aa);};}exports[_0x8c09('0x17')]=function(_0x4f8545,_0x287109){var _0x334180={},_0x269ebe={},_0x2907ce={'count':0x0,'rows':[]};var _0x4483c6=_[_0x8c09('0x18')](db[_0x8c09('0x19')][_0x8c09('0x1a')],function(_0x1b3636){return{'name':_0x1b3636[_0x8c09('0x1b')],'type':_0x1b3636[_0x8c09('0x1c')]['key']};});_0x269ebe['model']=_[_0x8c09('0x18')](_0x4483c6,_0x8c09('0x15'));_0x269ebe['query']=_[_0x8c09('0x1d')](_0x4f8545['query']);_0x269ebe[_0x8c09('0x1e')]=_['intersection'](_0x269ebe[_0x8c09('0x1f')],_0x269ebe[_0x8c09('0x20')]);_0x334180[_0x8c09('0x21')]=_['intersection'](_0x269ebe[_0x8c09('0x1f')],qs[_0x8c09('0x22')](_0x4f8545[_0x8c09('0x20')][_0x8c09('0x22')]));_0x334180[_0x8c09('0x21')]=_0x334180['attributes'][_0x8c09('0x23')]?_0x334180[_0x8c09('0x21')]:_0x269ebe[_0x8c09('0x1f')];if(!_0x4f8545[_0x8c09('0x20')][_0x8c09('0x24')](_0x8c09('0x25'))){_0x334180['limit']=qs[_0x8c09('0x9')](_0x4f8545['query']['limit']);_0x334180[_0x8c09('0xb')]=qs[_0x8c09('0xb')](_0x4f8545[_0x8c09('0x20')][_0x8c09('0xb')]);}_0x334180[_0x8c09('0x26')]=qs[_0x8c09('0x27')](_0x4f8545['query'][_0x8c09('0x27')]);_0x334180['where']=qs[_0x8c09('0x1e')](_[_0x8c09('0x28')](_0x4f8545[_0x8c09('0x20')],_0x269ebe[_0x8c09('0x1e')]),_0x4483c6);if(_0x4f8545['query'][_0x8c09('0x29')]){_0x334180[_0x8c09('0x2a')]=_[_0x8c09('0x2b')](_0x334180['where'],{'$or':_['map'](_0x4483c6,function(_0x412afc){if(_0x412afc[_0x8c09('0x1c')]!==_0x8c09('0x2c')){var _0x518735={};_0x518735[_0x412afc[_0x8c09('0x15')]]={'$like':'%'+_0x4f8545[_0x8c09('0x20')][_0x8c09('0x29')]+'%'};return _0x518735;}})});}_0x334180=_['merge']({},_0x334180,_0x4f8545[_0x8c09('0x2d')]);var _0x4130fd={'where':_0x334180[_0x8c09('0x2a')]};return db[_0x8c09('0x19')][_0x8c09('0xa')](_0x4130fd)[_0x8c09('0x10')](function(_0x4269b1){_0x2907ce['count']=_0x4269b1;if(_0x4f8545[_0x8c09('0x20')]['includeAll']){_0x334180[_0x8c09('0x2e')]=[{'all':!![]}];}return db[_0x8c09('0x19')][_0x8c09('0x2f')](_0x334180);})['then'](function(_0xe322e8){_0x2907ce['rows']=_0xe322e8;return _0x2907ce;})[_0x8c09('0x10')](respondWithFilteredResult(_0x287109,_0x334180))[_0x8c09('0x30')](handleError(_0x287109,null));};exports[_0x8c09('0x31')]=function(_0x322c3d,_0xb5f932){var _0xcfd1e4={'raw':![],'where':{'id':_0x322c3d[_0x8c09('0x32')]['id']}},_0x36babf={};_0x36babf[_0x8c09('0x1f')]=_[_0x8c09('0x1d')](db[_0x8c09('0x19')][_0x8c09('0x1a')]);_0x36babf[_0x8c09('0x20')]=_['keys'](_0x322c3d[_0x8c09('0x20')]);_0x36babf[_0x8c09('0x1e')]=_[_0x8c09('0x33')](_0x36babf['model'],_0x36babf[_0x8c09('0x20')]);_0xcfd1e4[_0x8c09('0x21')]=_[_0x8c09('0x33')](_0x36babf[_0x8c09('0x1f')],qs[_0x8c09('0x22')](_0x322c3d['query'][_0x8c09('0x22')]));_0xcfd1e4[_0x8c09('0x21')]=_0xcfd1e4['attributes']['length']?_0xcfd1e4[_0x8c09('0x21')]:_0x36babf['model'];if(_0x322c3d[_0x8c09('0x20')]['includeAll']){_0xcfd1e4[_0x8c09('0x2e')]=[{'all':!![]}];}_0xcfd1e4=_[_0x8c09('0x2b')]({},_0xcfd1e4,_0x322c3d[_0x8c09('0x2d')]);return db[_0x8c09('0x19')][_0x8c09('0x34')](_0xcfd1e4)[_0x8c09('0x10')](handleEntityNotFound(_0xb5f932,null))[_0x8c09('0x10')](respondWithResult(_0xb5f932,null))['catch'](handleError(_0xb5f932,null));};exports[_0x8c09('0x35')]=function(_0x35be14,_0x36f1db){return db[_0x8c09('0x19')][_0x8c09('0x35')](_0x35be14['body'],{})[_0x8c09('0x10')](respondWithResult(_0x36f1db,0xc9))[_0x8c09('0x30')](handleError(_0x36f1db,null));};exports['update']=function(_0x4dfd83,_0x24d729){if(_0x4dfd83[_0x8c09('0x36')]['id']){delete _0x4dfd83['body']['id'];}return db[_0x8c09('0x19')]['find']({'where':{'id':_0x4dfd83[_0x8c09('0x32')]['id']}})['then'](handleEntityNotFound(_0x24d729,null))[_0x8c09('0x10')](saveUpdates(_0x4dfd83[_0x8c09('0x36')],null))[_0x8c09('0x10')](respondWithResult(_0x24d729,null))['catch'](handleError(_0x24d729,null));};exports['destroy']=function(_0x1f6ab7,_0x29ced0){return db[_0x8c09('0x19')][_0x8c09('0x34')]({'where':{'id':_0x1f6ab7[_0x8c09('0x32')]['id']}})[_0x8c09('0x10')](handleEntityNotFound(_0x29ced0,null))['then'](removeEntity(_0x29ced0,null))['catch'](handleError(_0x29ced0,null));};exports[_0x8c09('0x37')]=function(_0x1de39e,_0x29f5bf){var _0x157a2d={};var _0x537033={};var _0x3f3abc;var _0x391867;return db[_0x8c09('0x19')][_0x8c09('0x38')]({'where':{'id':_0x1de39e[_0x8c09('0x32')]['id']}})[_0x8c09('0x10')](handleEntityNotFound(_0x29f5bf,null))[_0x8c09('0x10')](function(_0x3e3488){if(_0x3e3488){_0x3f3abc=_0x3e3488;_0x537033[_0x8c09('0x1f')]=_[_0x8c09('0x1d')](db['Dynamics365Configuration'][_0x8c09('0x1a')]);_0x537033[_0x8c09('0x20')]=_['keys'](_0x1de39e[_0x8c09('0x20')]);_0x537033[_0x8c09('0x1e')]=_[_0x8c09('0x33')](_0x537033[_0x8c09('0x1f')],_0x537033[_0x8c09('0x20')]);_0x157a2d['attributes']=_['intersection'](_0x537033[_0x8c09('0x1f')],qs['fields'](_0x1de39e[_0x8c09('0x20')][_0x8c09('0x22')]));_0x157a2d[_0x8c09('0x21')]=_0x157a2d[_0x8c09('0x21')][_0x8c09('0x23')]?_0x157a2d[_0x8c09('0x21')]:_0x537033['model'];_0x157a2d[_0x8c09('0x26')]=qs[_0x8c09('0x27')](_0x1de39e[_0x8c09('0x20')][_0x8c09('0x27')]);_0x157a2d['where']=qs[_0x8c09('0x1e')](_[_0x8c09('0x28')](_0x1de39e['query'],_0x537033[_0x8c09('0x1e')]));if(_0x1de39e[_0x8c09('0x20')][_0x8c09('0x29')]){_0x157a2d[_0x8c09('0x2a')]=_[_0x8c09('0x2b')](_0x157a2d[_0x8c09('0x2a')],{'$or':_[_0x8c09('0x18')](_0x157a2d[_0x8c09('0x21')],function(_0x5d4a96){var _0x5e983a={};_0x5e983a[_0x5d4a96]={'$like':'%'+_0x1de39e[_0x8c09('0x20')]['filter']+'%'};return _0x5e983a;})});}_0x157a2d=_['merge']({},_0x157a2d,_0x1de39e[_0x8c09('0x2d')]);return _0x3f3abc[_0x8c09('0x37')](_0x157a2d);}})[_0x8c09('0x10')](function(_0x46742e){if(_0x46742e){_0x391867=_0x46742e[_0x8c09('0x23')];if(!_0x1de39e[_0x8c09('0x20')]['hasOwnProperty'](_0x8c09('0x25'))){_0x157a2d['limit']=qs['limit'](_0x1de39e[_0x8c09('0x20')][_0x8c09('0x9')]);_0x157a2d[_0x8c09('0xb')]=qs['offset'](_0x1de39e[_0x8c09('0x20')]['offset']);}return _0x3f3abc[_0x8c09('0x37')](_0x157a2d);}})['then'](function(_0x3f2b7a){if(_0x3f2b7a){return _0x3f2b7a?{'count':_0x391867,'rows':_0x3f2b7a}:null;}})[_0x8c09('0x10')](respondWithResult(_0x29f5bf,null))[_0x8c09('0x30')](handleError(_0x29f5bf,null));};exports[_0x8c09('0x39')]=function(_0x4abb87,_0x3458da){if(_0x4abb87[_0x8c09('0x36')]['id']){delete _0x4abb87[_0x8c09('0x36')]['id'];}return db[_0x8c09('0x19')][_0x8c09('0x38')]({'where':{'id':_0x4abb87[_0x8c09('0x32')]['id']}})['then'](handleEntityNotFound(_0x3458da,null))[_0x8c09('0x10')](function(_0x53691e){if(_0x53691e){_0x4abb87[_0x8c09('0x36')][_0x8c09('0x3a')]=_0x53691e['id'];_0x4abb87[_0x8c09('0x36')][_0x8c09('0x3b')]=integrations[_0x8c09('0x3c')](_0x4abb87['body'][_0x8c09('0x3d')],_0x4abb87[_0x8c09('0x36')][_0x8c09('0x1c')]);_0x4abb87['body'][_0x8c09('0x3e')]=integrations['getDescriptions'](_0x4abb87['body'][_0x8c09('0x3d')],_0x4abb87['body'][_0x8c09('0x1c')]);return db[_0x8c09('0x3f')]['create'](_0x4abb87[_0x8c09('0x36')],{'include':[{'model':db['Dynamics365Field'],'as':_0x8c09('0x3b')},{'model':db['Dynamics365Field'],'as':'Descriptions'}]});}return null;})['then'](respondWithResult(_0x3458da,null))[_0x8c09('0x30')](handleError(_0x3458da,null));};function sanitizeRemoteUri(_0x363019){var _0x2bb153=_0x363019[_0x8c09('0x40')](-0x1);if(_0x2bb153==='/')return _0x363019['substring'](0x0,_0x363019['lastIndexOf'](_0x2bb153));return _0x363019;}function getWebApiUrl(_0x5654b6){return util['format'](_0x8c09('0x41'),_0x5654b6);}exports['getFields']=function(_0x2c35e1,_0x40e739){var _0x58ff7b=_0x2c35e1[_0x8c09('0x20')][_0x8c09('0x42')];var _0x53fc4f=_0x58ff7b===_0x8c09('0x43')?'Incident':_0x8c09('0x44');var _0x2536b5='';var _0x26675e='';var _0x57d092='';var _0x137873='';var _0x1d66d8='';var _0x23f98e='';var _0x567989='';var _0x135de9='';var _0x1b1fb0=['title','description',_0x8c09('0x45'),_0x8c09('0x46'),_0x8c09('0x47'),_0x8c09('0x48'),_0x8c09('0x49'),_0x8c09('0x4a'),'directioncode','phonecall_activity_parties'];var _0x5aa6e4=['accountidname',_0x8c09('0x4b'),_0x8c09('0x4c'),'billedserviceunits',_0x8c09('0x4d'),_0x8c09('0x4e'),_0x8c09('0x4f'),'contractidname',_0x8c09('0x50'),_0x8c09('0x51'),_0x8c09('0x52'),_0x8c09('0x53'),'createdon','createdonbehalfbyname',_0x8c09('0x54'),_0x8c09('0x55'),_0x8c09('0x56'),'customeridyominame',_0x8c09('0x57'),_0x8c09('0x58'),_0x8c09('0x59'),_0x8c09('0x5a'),_0x8c09('0x5b'),_0x8c09('0x5c'),_0x8c09('0x5d'),'followupby',_0x8c09('0x5e'),'influencescore',_0x8c09('0x5f'),_0x8c09('0x60'),'masteridname',_0x8c09('0x61'),_0x8c09('0x62'),_0x8c09('0x63'),_0x8c09('0x64'),_0x8c09('0x65'),_0x8c09('0x66'),_0x8c09('0x67'),_0x8c09('0x68'),_0x8c09('0x69'),_0x8c09('0x6a'),_0x8c09('0x6b'),_0x8c09('0x6c'),_0x8c09('0x6d'),_0x8c09('0x6e'),'owneridyominame',_0x8c09('0x6f'),'primarycontactidname','primarycontactidyominame',_0x8c09('0x70'),_0x8c09('0x71'),_0x8c09('0x72'),_0x8c09('0x73'),_0x8c09('0x74'),_0x8c09('0x75'),'responsiblecontactidname',_0x8c09('0x76'),_0x8c09('0x77'),_0x8c09('0x78'),'slaname','socialprofileidname',_0x8c09('0x79'),'statuscode','subjectidname',_0x8c09('0x7a'),'timezoneruleversionnumber',_0x8c09('0x7b'),_0x8c09('0x7c'),_0x8c09('0x7d'),'versionnumber'];var _0x549a78=_0x1b1fb0['concat'](_0x5aa6e4);return db[_0x8c09('0x19')][_0x8c09('0x38')]({'where':{'id':_0x2c35e1[_0x8c09('0x32')]['id']},'attributes':['id',_0x8c09('0x7e'),_0x8c09('0x7f'),_0x8c09('0x80'),'tenantId',_0x8c09('0x81'),_0x8c09('0x82'),'modernAuthentication'],'include':[{'model':db[_0x8c09('0x83')],'as':'CloudProvider','attributes':['id',_0x8c09('0x84'),_0x8c09('0x85')]}]})[_0x8c09('0x10')](handleEntityNotFound(_0x40e739,null))[_0x8c09('0x10')](function(_0x416364){if(_0x416364){if(_0x416364[_0x8c09('0x86')]){_0x416364[_0x8c09('0x87')]=_0x416364[_0x8c09('0x83')][_0x8c09('0x84')];_0x135de9=sanitizeRemoteUri(_0x416364[_0x8c09('0x83')][_0x8c09('0x85')]);_0x567989=getWebApiUrl(_0x135de9);return _0x416364;}_0x135de9=sanitizeRemoteUri(_0x416364[_0x8c09('0x80')]);_0x567989=getWebApiUrl(_0x135de9);var _0x1dc61f={'method':'POST','uri':_0x8c09('0x88')+_0x416364[_0x8c09('0x89')]+_0x8c09('0x8a'),'form':{'client_id':_0x416364['clientId'],'resource':_0x135de9,'username':_0x416364[_0x8c09('0x7e')],'password':_0x416364['password'],'grant_type':'password','client_secret':_0x416364[_0x8c09('0x82')]},'json':!![]};return rp(_0x1dc61f);}})[_0x8c09('0x10')](function(_0x477602){_0x23f98e=_0x477602[_0x8c09('0x87')];var _0x348377={'method':'GET','uri':encodeURI(_0x567989+_0x8c09('0x8b')+_0x53fc4f+'\x27'),'headers':{'Authorization':'Bearer\x20'+_0x23f98e,'If-None-Match':null,'OData-Version':_0x8c09('0x8c')},'json':!![]};return rp(_0x348377);})['then'](function(_0x4fb00f){var _0x32fbac=_0x4fb00f[_0x8c09('0x8d')][0x0];var _0x841e85=_0x32fbac[_0x8c09('0x8e')];var _0x1384d0={'method':_0x8c09('0x8f'),'uri':_0x567989+_0x8c09('0x90')+_0x841e85+_0x8c09('0x91'),'headers':{'Authorization':_0x8c09('0x92')+_0x23f98e,'If-None-Match':null,'OData-Version':_0x8c09('0x8c')},'json':!![]};return rp(_0x1384d0);})['then'](function(_0x4cc347){_0x2536b5=_0x4cc347;_0x26675e=_0x2536b5[_0x8c09('0x93')];_0x26675e=_[_0x8c09('0x94')](_0x26675e,function(_0x5ccef0){return!_0x549a78[_0x8c09('0x95')](_0x5ccef0[_0x8c09('0x96')]);});var _0x59f290=[];var _0x31417b=[];_0x26675e[_0x8c09('0x97')](function(_0x49e62f){if(_0x49e62f[_0x8c09('0x98')]){var _0x351a81=_0x49e62f[_0x8c09('0x98')]['substring'](_0x49e62f[_0x8c09('0x98')][_0x8c09('0x99')]('.')+0x1);if(_0x351a81===_0x8c09('0x9a')){_0x59f290['push'](getSelectList(_0x567989,_0x58ff7b,_0x31417b,_0x2536b5['MetadataId'],_0x49e62f[_0x8c09('0x8e')],_0x23f98e));}}});return Promise[_0x8c09('0x9b')](_0x59f290);})[_0x8c09('0x10')](function(_0x1e694d){_0x57d092=_0x1e694d[0x0];var _0x203f47=[];var _0x2e2553=[];_0x26675e['forEach'](function(_0x422561){if(!_[_0x8c09('0x9c')](_0x422561[_0x8c09('0x98')])){var _0x1ad22d=_0x422561['@odata.type'][_0x8c09('0x9d')](_0x422561[_0x8c09('0x98')][_0x8c09('0x99')]('.')+0x1);if(_0x1ad22d===_0x8c09('0x9e')){_0x203f47[_0x8c09('0x9f')](getBooleanList(_0x567989,_0x58ff7b,_0x2e2553,_0x2536b5[_0x8c09('0x8e')],_0x422561[_0x8c09('0x8e')],_0x23f98e));}}});return Promise[_0x8c09('0x9b')](_0x203f47);})[_0x8c09('0x10')](function(_0x271b1f){_0x137873=_0x271b1f[0x0];var _0x27d92b=[];var _0x4d9d1b=[];_0x26675e[_0x8c09('0x97')](function(_0x3e729f){if(_0x3e729f[_0x8c09('0x98')]){var _0x1b84f8=_0x3e729f[_0x8c09('0x98')][_0x8c09('0x9d')](_0x3e729f[_0x8c09('0x98')][_0x8c09('0x99')]('.')+0x1);if(_0x1b84f8===_0x8c09('0xa0')||_0x1b84f8==='DoubleAttributeMetadata'||_0x1b84f8==='BigIntAttributeMetadata'||_0x1b84f8===_0x8c09('0xa1')||_0x1b84f8===_0x8c09('0xa2')||_0x1b84f8===_0x8c09('0xa3')||_0x1b84f8==='StatusAttributeMetadata'||_0x1b84f8===_0x8c09('0xa4')||_0x1b84f8==='StateAttributeMetadata'||_0x1b84f8===_0x8c09('0xa5')){_0x27d92b[_0x8c09('0x9f')](getInputList(_0x567989,_0x58ff7b,_0x1b84f8,_0x4d9d1b,_0x2536b5['MetadataId'],_0x3e729f['MetadataId'],_0x23f98e));}}});return Promise[_0x8c09('0x9b')](_0x27d92b);})[_0x8c09('0x10')](function(_0x293db3){_0x1d66d8=_0x293db3[0x0];var _0xf8d327=_0x57d092[_0x8c09('0xa6')](_0x137873)[_0x8c09('0xa6')](_0x1d66d8);var _0x29f7a5={'count':_0xf8d327[_0x8c09('0x23')],'rows':_0xf8d327};return _0x29f7a5;})[_0x8c09('0x10')](respondWithResult(_0x40e739,null))[_0x8c09('0x30')](function(_0x1be318){var _0x5d167e=_0x2c35e1['query'][_0x8c09('0xa7')]?0x1f4:_0x1be318['statusCode']||0x1f4;logger[_0x8c09('0x13')](_0x1be318['stack']);delete _0x1be318['name'];if(_0x5d167e===0x191){_0x5d167e=0x190;}_0x40e739[_0x8c09('0x7')](_0x5d167e)[_0x8c09('0x16')](_0x2c35e1[_0x8c09('0x20')][_0x8c09('0xa7')]?{'message':_0x8c09('0xa8'),'statusCode':_0x1be318[_0x8c09('0xa9')]}:_0x1be318);});};function getSelectList(_0x4fa611,_0x477730,_0x43d448,_0x598bfa,_0x56cf1d,_0x5c9c17){var _0x2c509d={'method':_0x8c09('0x8f'),'uri':_0x4fa611+_0x8c09('0x90')+_0x598bfa+_0x8c09('0xaa')+_0x56cf1d+_0x8c09('0xab')+_0x8c09('0xac'),'headers':{'Authorization':_0x8c09('0x92')+_0x5c9c17,'If-None-Match':null,'OData-Version':_0x8c09('0x8c')},'json':!![]};return rp(_0x2c509d)[_0x8c09('0x10')](function(_0xaa83fe){var _0x17afa8=[];var _0x120e21=_0xaa83fe[_0x8c09('0xad')][_0x8c09('0xae')];_0x120e21[_0x8c09('0x97')](function(_0x1f2df3){_0x17afa8['push']({'name':_0x1f2df3[_0x8c09('0xaf')][_0x8c09('0xb0')]['Label'],'value':String(_0x1f2df3[_0x8c09('0xb1')])});});var _0x1a381d={'id':_0x477730+'_'+_0xaa83fe[_0x8c09('0x96')],'name':_0xaa83fe[_0x8c09('0xb2')][_0x8c09('0xb0')][_0x8c09('0xaf')],'custom':![],'options':_0x17afa8};_0x43d448['push'](_0x1a381d);return _0x43d448;});}function getBooleanList(_0x4afd78,_0x444e6b,_0xcf36a3,_0x4df6f9,_0x3ea167,_0x195ffb){var _0xed5545={'method':_0x8c09('0x8f'),'uri':_0x4afd78+'EntityDefinitions('+_0x4df6f9+_0x8c09('0xaa')+_0x3ea167+_0x8c09('0xb3'),'headers':{'Authorization':_0x8c09('0x92')+_0x195ffb,'If-None-Match':null,'OData-Version':_0x8c09('0x8c')},'json':!![]};return rp(_0xed5545)[_0x8c09('0x10')](function(_0x514f5e){var _0x1d520f=[];_0x1d520f[_0x8c09('0x9f')]({'name':_0x514f5e[_0x8c09('0xad')]['TrueOption'][_0x8c09('0xaf')]['UserLocalizedLabel'][_0x8c09('0xaf')],'value':_0x8c09('0xb4')},{'name':_0x514f5e['OptionSet'][_0x8c09('0xb5')][_0x8c09('0xaf')][_0x8c09('0xb0')][_0x8c09('0xaf')],'value':_0x8c09('0xb6')});var _0x77f94e={'id':_0x444e6b+'_'+_0x514f5e['LogicalName'],'name':_0x514f5e[_0x8c09('0xb2')][_0x8c09('0xb0')][_0x8c09('0xaf')],'custom':![],'options':_0x1d520f};_0xcf36a3[_0x8c09('0x9f')](_0x77f94e);return _0xcf36a3;});}function getInputList(_0x1463b4,_0x2e1942,_0x235bd0,_0x26faa3,_0x110fb1,_0x4a0088,_0x200d16){var _0x559d91={'method':_0x8c09('0x8f'),'uri':_0x1463b4+_0x8c09('0x90')+_0x110fb1+_0x8c09('0xaa')+_0x4a0088+')/Microsoft.Dynamics.CRM.'+_0x235bd0+'?$select=DisplayName,LogicalName','headers':{'Authorization':'Bearer\x20'+_0x200d16,'If-None-Match':null,'OData-Version':'4.0'},'json':!![]};return rp(_0x559d91)['then'](function(_0xf2254b){var _0x56ad1e={'id':_0x2e1942+'_'+_0xf2254b[_0x8c09('0x96')],'name':_0xf2254b[_0x8c09('0xb2')]['UserLocalizedLabel']?_0xf2254b[_0x8c09('0xb2')][_0x8c09('0xb0')][_0x8c09('0xaf')]:_0xf2254b[_0x8c09('0x96')],'custom':![],'options':[]};_0x26faa3[_0x8c09('0x9f')](_0x56ad1e);return _0x26faa3;});} \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.model.js b/server/api/intDynamics365Account/intDynamics365Account.model.js index fa913dd..e30ad84 100644 --- a/server/api/intDynamics365Account/intDynamics365Account.model.js +++ b/server/api/intDynamics365Account/intDynamics365Account.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x757a=['Dynamics365Account','int_dynamics365_accounts','util','../../config/logger','request-promise','path','rimraf','../../config/environment','./intDynamics365Account.attributes','../../components/integrations/configuration'];(function(_0x17e7fd,_0x53bcab){var _0x514a1a=function(_0x3bb91c){while(--_0x3bb91c){_0x17e7fd['push'](_0x17e7fd['shift']());}};_0x514a1a(++_0x53bcab);}(_0x757a,0xde));var _0xa757=function(_0x38e2d8,_0x3e3614){_0x38e2d8=_0x38e2d8-0x0;var _0x25191c=_0x757a[_0x38e2d8];return _0x25191c;};'use strict';var _=require('lodash');var util=require(_0xa757('0x0'));var logger=require(_0xa757('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa757('0x2'));var fs=require('fs');var path=require(_0xa757('0x3'));var rimraf=require(_0xa757('0x4'));var config=require(_0xa757('0x5'));var attributes=require(_0xa757('0x6'));var integrations=require(_0xa757('0x7'));module['exports']=function(_0xae0e7c,_0x4343b6){return _0xae0e7c['define'](_0xa757('0x8'),attributes,{'tableName':_0xa757('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xcb91=['rimraf','./intDynamics365Account.attributes','../../components/integrations/configuration','Dynamics365Account','int_dynamics365_accounts','../../config/logger','api','moment','bluebird','path'];(function(_0x3b28a7,_0x58a70d){var _0x54dfce=function(_0x2e3d84){while(--_0x2e3d84){_0x3b28a7['push'](_0x3b28a7['shift']());}};_0x54dfce(++_0x58a70d);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x254d9f,_0x54ddb5){_0x254d9f=_0x254d9f-0x0;var _0x1eedb9=_0xcb91[_0x254d9f];return _0x1eedb9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1cb9('0x0'))(_0x1cb9('0x1'));var moment=require(_0x1cb9('0x2'));var BPromise=require(_0x1cb9('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1cb9('0x4'));var rimraf=require(_0x1cb9('0x5'));var config=require('../../config/environment');var attributes=require(_0x1cb9('0x6'));var integrations=require(_0x1cb9('0x7'));module['exports']=function(_0x226b69,_0x3f7deb){return _0x226b69['define'](_0x1cb9('0x8'),attributes,{'tableName':_0x1cb9('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Account/intDynamics365Account.rpc.js b/server/api/intDynamics365Account/intDynamics365Account.rpc.js index ff65f63..22d7863 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 _0x4485=['include','attributes','map','model','GetDynamics365Account','debug','ShowDynamics365Account','find','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Dynamics365Account,\x20%s,\x20%s','request\x20sent','Dynamics365Account,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','Dynamics365Account','findAll','options','raw','limit'];(function(_0x2879dc,_0x1e5b35){var _0x54864d=function(_0x46f929){while(--_0x46f929){_0x2879dc['push'](_0x2879dc['shift']());}};_0x54864d(++_0x1e5b35);}(_0x4485,0xbc));var _0x5448=function(_0x5807d4,_0x29306b){_0x5807d4=_0x5807d4-0x0;var _0x5ddf9b=_0x4485[_0x5807d4];return _0x5ddf9b;};'use strict';var _=require(_0x5448('0x0'));var util=require(_0x5448('0x1'));var moment=require('moment');var BPromise=require(_0x5448('0x2'));var rs=require(_0x5448('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5448('0x4'))['db'];var utils=require(_0x5448('0x5'));var logger=require(_0x5448('0x6'))(_0x5448('0x7'));var config=require(_0x5448('0x8'));var jayson=require(_0x5448('0x9'));var client=jayson[_0x5448('0xa')][_0x5448('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48383d,_0x326b09,_0x2519da){return new BPromise(function(_0x23cf53,_0x120483){return client['request'](_0x48383d,_0x2519da)[_0x5448('0xc')](function(_0x135567){logger[_0x5448('0xd')](_0x5448('0xe'),_0x326b09,_0x5448('0xf'));logger['debug'](_0x5448('0x10'),_0x326b09,_0x5448('0xf'),JSON[_0x5448('0x11')](_0x135567));if(_0x135567[_0x5448('0x12')]){if(_0x135567[_0x5448('0x12')][_0x5448('0x13')]===0x1f4){logger[_0x5448('0x12')]('Dynamics365Account,\x20%s,\x20%s',_0x326b09,_0x135567['error']['message']);return _0x120483(_0x135567[_0x5448('0x12')][_0x5448('0x14')]);}logger[_0x5448('0x12')](_0x5448('0xe'),_0x326b09,_0x135567[_0x5448('0x12')]['message']);return _0x23cf53(_0x135567['error'][_0x5448('0x14')]);}else{logger[_0x5448('0xd')]('Dynamics365Account,\x20%s,\x20%s',_0x326b09,_0x5448('0xf'));_0x23cf53(_0x135567[_0x5448('0x15')]['message']);}})[_0x5448('0x16')](function(_0x12f23f){logger[_0x5448('0x12')](_0x5448('0xe'),_0x326b09,_0x12f23f);_0x120483(_0x12f23f);});});}exports['GetDynamics365Account']=function(_0x584778){var _0x404d60=this;return new Promise(function(_0x16345f,_0x417b76){return db[_0x5448('0x17')][_0x5448('0x18')]({'raw':_0x584778[_0x5448('0x19')]?_0x584778['options'][_0x5448('0x1a')]===undefined?!![]:![]:!![],'where':_0x584778['options']?_0x584778[_0x5448('0x19')]['where']||null:null,'attributes':_0x584778[_0x5448('0x19')]?_0x584778[_0x5448('0x19')]['attributes']||null:null,'limit':_0x584778['options']?_0x584778['options'][_0x5448('0x1b')]||null:null,'include':_0x584778[_0x5448('0x19')]?_0x584778[_0x5448('0x19')][_0x5448('0x1c')]?_['map'](_0x584778[_0x5448('0x19')][_0x5448('0x1c')],function(_0x2b38d5){return{'model':db[_0x2b38d5['model']],'as':_0x2b38d5['as'],'attributes':_0x2b38d5[_0x5448('0x1d')],'include':_0x2b38d5[_0x5448('0x1c')]?_[_0x5448('0x1e')](_0x2b38d5[_0x5448('0x1c')],function(_0xdd0580){return{'model':db[_0xdd0580[_0x5448('0x1f')]],'as':_0xdd0580['as'],'attributes':_0xdd0580[_0x5448('0x1d')],'include':_0xdd0580[_0x5448('0x1c')]?_['map'](_0xdd0580[_0x5448('0x1c')],function(_0x886f4){return{'model':db[_0x886f4[_0x5448('0x1f')]],'as':_0x886f4['as'],'attributes':_0x886f4[_0x5448('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5448('0xc')](function(_0x4ad71a){logger['info'](_0x5448('0x20'),_0x584778);logger[_0x5448('0x21')](_0x5448('0x20'),_0x584778,JSON[_0x5448('0x11')](_0x4ad71a));_0x16345f(_0x4ad71a);})[_0x5448('0x16')](function(_0x528d37){logger[_0x5448('0x12')](_0x5448('0x20'),_0x528d37[_0x5448('0x14')],_0x584778);_0x417b76(_0x404d60[_0x5448('0x12')](0x1f4,_0x528d37['message']));});});};exports[_0x5448('0x22')]=function(_0x574ee8){var _0x1fb420=this;return new Promise(function(_0x3b5aa5,_0x4845ca){return db[_0x5448('0x17')][_0x5448('0x23')]({'raw':_0x574ee8['options']?_0x574ee8[_0x5448('0x19')]['raw']===undefined?!![]:![]:!![],'where':_0x574ee8[_0x5448('0x19')]?_0x574ee8[_0x5448('0x19')]['where']||null:null,'attributes':_0x574ee8[_0x5448('0x19')]?_0x574ee8[_0x5448('0x19')]['attributes']||null:null,'include':_0x574ee8[_0x5448('0x19')]?_0x574ee8[_0x5448('0x19')][_0x5448('0x1c')]?_[_0x5448('0x1e')](_0x574ee8[_0x5448('0x19')][_0x5448('0x1c')],function(_0x195c5b){return{'model':db[_0x195c5b[_0x5448('0x1f')]],'as':_0x195c5b['as'],'attributes':_0x195c5b[_0x5448('0x1d')],'include':_0x195c5b[_0x5448('0x1c')]?_['map'](_0x195c5b['include'],function(_0x890ff3){return{'model':db[_0x890ff3['model']],'as':_0x890ff3['as'],'attributes':_0x890ff3['attributes'],'include':_0x890ff3[_0x5448('0x1c')]?_[_0x5448('0x1e')](_0x890ff3['include'],function(_0x1f0997){return{'model':db[_0x1f0997['model']],'as':_0x1f0997['as'],'attributes':_0x1f0997[_0x5448('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5448('0xc')](function(_0x2f7acd){logger[_0x5448('0xd')]('ShowDynamics365Account',_0x574ee8);logger[_0x5448('0x21')](_0x5448('0x22'),_0x574ee8,JSON['stringify'](_0x2f7acd));_0x3b5aa5(_0x2f7acd);})[_0x5448('0x16')](function(_0x37e13b){logger[_0x5448('0x12')](_0x5448('0x22'),_0x37e13b[_0x5448('0x14')],_0x574ee8);_0x4845ca(_0x1fb420['error'](0x1f4,_0x37e13b[_0x5448('0x14')]));});});}; \ No newline at end of file +var _0xca82=['client','request','then','request\x20sent','debug','error','code','Dynamics365Account,\x20%s,\x20%s','message','result','catch','GetDynamics365Account','findAll','options','raw','attributes','limit','include','model','map','stringify','ShowDynamics365Account','Dynamics365Account','where','info','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x21de89,_0x367053){var _0x290b7e=function(_0x540704){while(--_0x540704){_0x21de89['push'](_0x21de89['shift']());}};_0x290b7e(++_0x367053);}(_0xca82,0x177));var _0x2ca8=function(_0x6306d2,_0x4ae91b){_0x6306d2=_0x6306d2-0x0;var _0x4d13aa=_0xca82[_0x6306d2];return _0x4d13aa;};'use strict';var _=require(_0x2ca8('0x0'));var util=require('util');var moment=require(_0x2ca8('0x1'));var BPromise=require(_0x2ca8('0x2'));var rs=require(_0x2ca8('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2ca8('0x4'))['db'];var utils=require(_0x2ca8('0x5'));var logger=require(_0x2ca8('0x6'))(_0x2ca8('0x7'));var config=require(_0x2ca8('0x8'));var jayson=require(_0x2ca8('0x9'));var client=jayson[_0x2ca8('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x425d70,_0x1f42f1,_0x56e304){return new BPromise(function(_0x60bb1b,_0x1d0af0){return client[_0x2ca8('0xb')](_0x425d70,_0x56e304)[_0x2ca8('0xc')](function(_0x2ba952){logger['info']('Dynamics365Account,\x20%s,\x20%s',_0x1f42f1,_0x2ca8('0xd'));logger[_0x2ca8('0xe')]('Dynamics365Account,\x20%s,\x20%s,\x20%s',_0x1f42f1,'request\x20sent',JSON['stringify'](_0x2ba952));if(_0x2ba952[_0x2ca8('0xf')]){if(_0x2ba952[_0x2ca8('0xf')][_0x2ca8('0x10')]===0x1f4){logger['error'](_0x2ca8('0x11'),_0x1f42f1,_0x2ba952['error']['message']);return _0x1d0af0(_0x2ba952[_0x2ca8('0xf')][_0x2ca8('0x12')]);}logger[_0x2ca8('0xf')](_0x2ca8('0x11'),_0x1f42f1,_0x2ba952['error'][_0x2ca8('0x12')]);return _0x60bb1b(_0x2ba952['error'][_0x2ca8('0x12')]);}else{logger['info'](_0x2ca8('0x11'),_0x1f42f1,'request\x20sent');_0x60bb1b(_0x2ba952[_0x2ca8('0x13')][_0x2ca8('0x12')]);}})[_0x2ca8('0x14')](function(_0x3f2b39){logger[_0x2ca8('0xf')](_0x2ca8('0x11'),_0x1f42f1,_0x3f2b39);_0x1d0af0(_0x3f2b39);});});}exports[_0x2ca8('0x15')]=function(_0x352656){var _0x5a979a=this;return new Promise(function(_0x3a99e9,_0x393c8b){return db['Dynamics365Account'][_0x2ca8('0x16')]({'raw':_0x352656[_0x2ca8('0x17')]?_0x352656[_0x2ca8('0x17')][_0x2ca8('0x18')]===undefined?!![]:![]:!![],'where':_0x352656[_0x2ca8('0x17')]?_0x352656[_0x2ca8('0x17')]['where']||null:null,'attributes':_0x352656[_0x2ca8('0x17')]?_0x352656[_0x2ca8('0x17')][_0x2ca8('0x19')]||null:null,'limit':_0x352656[_0x2ca8('0x17')]?_0x352656[_0x2ca8('0x17')][_0x2ca8('0x1a')]||null:null,'include':_0x352656[_0x2ca8('0x17')]?_0x352656[_0x2ca8('0x17')][_0x2ca8('0x1b')]?_['map'](_0x352656[_0x2ca8('0x17')][_0x2ca8('0x1b')],function(_0x3d9ecc){return{'model':db[_0x3d9ecc[_0x2ca8('0x1c')]],'as':_0x3d9ecc['as'],'attributes':_0x3d9ecc[_0x2ca8('0x19')],'include':_0x3d9ecc['include']?_[_0x2ca8('0x1d')](_0x3d9ecc[_0x2ca8('0x1b')],function(_0x1e65ea){return{'model':db[_0x1e65ea[_0x2ca8('0x1c')]],'as':_0x1e65ea['as'],'attributes':_0x1e65ea['attributes'],'include':_0x1e65ea['include']?_['map'](_0x1e65ea['include'],function(_0x5cd9e1){return{'model':db[_0x5cd9e1[_0x2ca8('0x1c')]],'as':_0x5cd9e1['as'],'attributes':_0x5cd9e1['attributes']};}):[]};}):[]};}):[]:[]})[_0x2ca8('0xc')](function(_0x31945e){logger['info'](_0x2ca8('0x15'),_0x352656);logger['debug']('GetDynamics365Account',_0x352656,JSON[_0x2ca8('0x1e')](_0x31945e));_0x3a99e9(_0x31945e);})[_0x2ca8('0x14')](function(_0xcc2156){logger[_0x2ca8('0xf')]('GetDynamics365Account',_0xcc2156['message'],_0x352656);_0x393c8b(_0x5a979a['error'](0x1f4,_0xcc2156['message']));});});};exports[_0x2ca8('0x1f')]=function(_0x45b836){var _0x2226e6=this;return new Promise(function(_0x14575e,_0x8dcbbb){return db[_0x2ca8('0x20')]['find']({'raw':_0x45b836['options']?_0x45b836[_0x2ca8('0x17')][_0x2ca8('0x18')]===undefined?!![]:![]:!![],'where':_0x45b836[_0x2ca8('0x17')]?_0x45b836[_0x2ca8('0x17')][_0x2ca8('0x21')]||null:null,'attributes':_0x45b836[_0x2ca8('0x17')]?_0x45b836['options'][_0x2ca8('0x19')]||null:null,'include':_0x45b836[_0x2ca8('0x17')]?_0x45b836[_0x2ca8('0x17')][_0x2ca8('0x1b')]?_[_0x2ca8('0x1d')](_0x45b836['options'][_0x2ca8('0x1b')],function(_0x47e51b){return{'model':db[_0x47e51b[_0x2ca8('0x1c')]],'as':_0x47e51b['as'],'attributes':_0x47e51b[_0x2ca8('0x19')],'include':_0x47e51b[_0x2ca8('0x1b')]?_[_0x2ca8('0x1d')](_0x47e51b['include'],function(_0x2ad040){return{'model':db[_0x2ad040[_0x2ca8('0x1c')]],'as':_0x2ad040['as'],'attributes':_0x2ad040[_0x2ca8('0x19')],'include':_0x2ad040[_0x2ca8('0x1b')]?_[_0x2ca8('0x1d')](_0x2ad040[_0x2ca8('0x1b')],function(_0x41bc87){return{'model':db[_0x41bc87[_0x2ca8('0x1c')]],'as':_0x41bc87['as'],'attributes':_0x41bc87[_0x2ca8('0x19')]};}):[]};}):[]};}):[]:[]})[_0x2ca8('0xc')](function(_0x2246e5){logger[_0x2ca8('0x22')](_0x2ca8('0x1f'),_0x45b836);logger[_0x2ca8('0xe')](_0x2ca8('0x1f'),_0x45b836,JSON[_0x2ca8('0x1e')](_0x2246e5));_0x14575e(_0x2246e5);})[_0x2ca8('0x14')](function(_0x1db64c){logger['error']('ShowDynamics365Account',_0x1db64c[_0x2ca8('0x12')],_0x45b836);_0x8dcbbb(_0x2226e6[_0x2ca8('0xf')](0x1f4,_0x1db64c[_0x2ca8('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/index.js b/server/api/intDynamics365Configuration/index.js index 84268ca..707f337 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 _0x7b1c=['/:id/fields','getFields','/:id/subjects','getSubjects','/:id/descriptions','post','create','/:id','update','delete','multer','util','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show'];(function(_0x5dc4c8,_0x5adb38){var _0x11777a=function(_0x290c85){while(--_0x290c85){_0x5dc4c8['push'](_0x5dc4c8['shift']());}};_0x11777a(++_0x5adb38);}(_0x7b1c,0x78));var _0xc7b1=function(_0x215f46,_0x3e625a){_0x215f46=_0x215f46-0x0;var _0x1f33f1=_0x7b1c[_0x215f46];return _0x1f33f1;};'use strict';var multer=require(_0xc7b1('0x0'));var util=require(_0xc7b1('0x1'));var path=require(_0xc7b1('0x2'));var timeout=require(_0xc7b1('0x3'));var express=require('express');var router=express[_0xc7b1('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xc7b1('0x5'));var interaction=require(_0xc7b1('0x6'));var config=require(_0xc7b1('0x7'));var controller=require('./intDynamics365Configuration.controller');router[_0xc7b1('0x8')]('/',auth[_0xc7b1('0x9')](),controller[_0xc7b1('0xa')]);router[_0xc7b1('0x8')]('/:id',auth[_0xc7b1('0x9')](),controller[_0xc7b1('0xb')]);router[_0xc7b1('0x8')](_0xc7b1('0xc'),auth[_0xc7b1('0x9')](),controller[_0xc7b1('0xd')]);router[_0xc7b1('0x8')](_0xc7b1('0xe'),auth[_0xc7b1('0x9')](),controller[_0xc7b1('0xf')]);router['get'](_0xc7b1('0x10'),auth[_0xc7b1('0x9')](),controller['getDescriptions']);router[_0xc7b1('0x11')]('/',auth[_0xc7b1('0x9')](),controller[_0xc7b1('0x12')]);router['put'](_0xc7b1('0x13'),auth[_0xc7b1('0x9')](),controller[_0xc7b1('0x14')]);router[_0xc7b1('0x15')](_0xc7b1('0x13'),auth[_0xc7b1('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x94c2=['./intDynamics365Configuration.controller','get','index','isAuthenticated','show','/:id/fields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment'];(function(_0x6f5375,_0x19b529){var _0x57e767=function(_0x2c01c2){while(--_0x2c01c2){_0x6f5375['push'](_0x6f5375['shift']());}};_0x57e767(++_0x19b529);}(_0x94c2,0x13d));var _0x294c=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x94c2[_0x167cc1];return _0x10bc4b;};'use strict';var multer=require('multer');var util=require(_0x294c('0x0'));var path=require('path');var timeout=require(_0x294c('0x1'));var express=require(_0x294c('0x2'));var router=express[_0x294c('0x3')]();var fs_extra=require(_0x294c('0x4'));var auth=require(_0x294c('0x5'));var interaction=require(_0x294c('0x6'));var config=require(_0x294c('0x7'));var controller=require(_0x294c('0x8'));router[_0x294c('0x9')]('/',auth['isAuthenticated'](),controller[_0x294c('0xa')]);router['get']('/:id',auth[_0x294c('0xb')](),controller[_0x294c('0xc')]);router[_0x294c('0x9')](_0x294c('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0x294c('0x9')](_0x294c('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x294c('0x9')](_0x294c('0xf'),auth[_0x294c('0xb')](),controller[_0x294c('0x10')]);router[_0x294c('0x11')]('/',auth[_0x294c('0xb')](),controller[_0x294c('0x12')]);router[_0x294c('0x13')](_0x294c('0x14'),auth[_0x294c('0xb')](),controller[_0x294c('0x15')]);router[_0x294c('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x294c('0x17')]);module[_0x294c('0x18')]=router; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.attributes.js index eb20595..a83638d 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 _0x92c1=['BOOLEAN','sequelize','STRING','ENUM','incident','contact','nothing'];(function(_0x59eefb,_0x2151ce){var _0x1a49e8=function(_0x5a758c){while(--_0x5a758c){_0x59eefb['push'](_0x59eefb['shift']());}};_0x1a49e8(++_0x2151ce);}(_0x92c1,0x197));var _0x192c=function(_0x3b9cbe,_0x14936e){_0x3b9cbe=_0x3b9cbe-0x0;var _0x4bc66a=_0x92c1[_0x3b9cbe];return _0x4bc66a;};'use strict';var Sequelize=require(_0x192c('0x0'));module['exports']={'name':{'type':Sequelize[_0x192c('0x1')]},'description':{'type':Sequelize[_0x192c('0x1')]},'ticketType':{'type':Sequelize[_0x192c('0x2')](_0x192c('0x3'),'phonecall'),'defaultValue':_0x192c('0x3')},'moduleCreate':{'type':Sequelize['ENUM'](_0x192c('0x4'),_0x192c('0x5')),'defaultValue':_0x192c('0x4'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x192c('0x1')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x192c('0x6')],'defaultValue':!![]}}; \ No newline at end of file +var _0x3c29=['exports','STRING','ENUM','phonecall','incident','nothing','contact','BOOLEAN','sequelize'];(function(_0x3d9f0e,_0x120e64){var _0x4243ba=function(_0x9504f4){while(--_0x9504f4){_0x3d9f0e['push'](_0x3d9f0e['shift']());}};_0x4243ba(++_0x120e64);}(_0x3c29,0xf2));var _0x93c2=function(_0x4c0583,_0x2be650){_0x4c0583=_0x4c0583-0x0;var _0x541628=_0x3c29[_0x4c0583];return _0x541628;};'use strict';var Sequelize=require(_0x93c2('0x0'));module[_0x93c2('0x1')]={'name':{'type':Sequelize[_0x93c2('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x93c2('0x3')]('incident',_0x93c2('0x4')),'defaultValue':_0x93c2('0x5')},'moduleCreate':{'type':Sequelize[_0x93c2('0x3')]('contact',_0x93c2('0x6')),'defaultValue':_0x93c2('0x7'),'allowNull':![]},'additionalSearchContact':{'type':Sequelize[_0x93c2('0x2')],'allowNull':!![]},'openNewTab':{'type':Sequelize[_0x93c2('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.controller.js index d932470..e98ca66 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 _0x84e5=['bluebird','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','apply','reject','update','then','error','stack','send','index','Dynamics365Configuration','rawAttributes','fieldName','type','key','name','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','map','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','params','create','body','find','getFields','Dynamics365Field','getSubjects','findOne','getDescriptions','fast-json-patch','request-promise','moment'];(function(_0x23c138,_0x52ffd6){var _0x29b4f2=function(_0x381c34){while(--_0x381c34){_0x23c138['push'](_0x23c138['shift']());}};_0x29b4f2(++_0x52ffd6);}(_0x84e5,0x12d));var _0x584e=function(_0x3c504b,_0x437693){_0x3c504b=_0x3c504b-0x0;var _0x2e5354=_0x84e5[_0x3c504b];return _0x2e5354;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x584e('0x0'));var rp=require(_0x584e('0x1'));var moment=require(_0x584e('0x2'));var BPromise=require(_0x584e('0x3'));var Mustache=require('mustache');var util=require('util');var path=require(_0x584e('0x4'));var sox=require(_0x584e('0x5'));var csv=require(_0x584e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x584e('0x7'));var _=require(_0x584e('0x8'));var squel=require('squel');var crypto=require(_0x584e('0x9'));var jsforce=require(_0x584e('0xa'));var deskjs=require(_0x584e('0xb'));var toCsv=require('to-csv');var querystring=require(_0x584e('0xc'));var Papa=require('papaparse');var Redis=require(_0x584e('0xd'));var authService=require(_0x584e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0x584e('0xf'));var hardwareService=require(_0x584e('0x10'));var logger=require('../../config/logger')(_0x584e('0x11'));var utils=require(_0x584e('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x584e('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x7d13a3,_0x24715b){_0x24715b=_0x24715b||0xcc;return function(_0xf5d72d){if(_0xf5d72d){return _0x7d13a3[_0x584e('0x14')](_0x24715b);}return _0x7d13a3[_0x584e('0x15')](_0x24715b)[_0x584e('0x16')]();};}function respondWithResult(_0x21553d,_0x141ac2){_0x141ac2=_0x141ac2||0xc8;return function(_0x2ce9d4){if(_0x2ce9d4){return _0x21553d[_0x584e('0x15')](_0x141ac2)[_0x584e('0x17')](_0x2ce9d4);}};}function respondWithFilteredResult(_0x425342,_0x860100){return function(_0x1aa386){if(_0x1aa386){var _0x31bc97=typeof _0x860100['offset']==='undefined'&&typeof _0x860100[_0x584e('0x18')]===_0x584e('0x19');var _0x102ac6=_0x1aa386[_0x584e('0x1a')];var _0x2662b9=_0x31bc97?0x0:_0x860100[_0x584e('0x1b')];var _0x3206f9=_0x31bc97?_0x1aa386[_0x584e('0x1a')]:_0x860100[_0x584e('0x1b')]+_0x860100[_0x584e('0x18')];var _0x347c7b;if(_0x3206f9>=_0x102ac6){_0x3206f9=_0x102ac6;_0x347c7b=0xc8;}else{_0x347c7b=0xce;}_0x425342['status'](_0x347c7b);return _0x425342['set'](_0x584e('0x1c'),_0x2662b9+'-'+_0x3206f9+'/'+_0x102ac6)['json'](_0x1aa386);}return null;};}function patchUpdates(_0x13d434){return function(_0x2d77e1){try{jsonpatch[_0x584e('0x1d')](_0x2d77e1,_0x13d434,!![]);}catch(_0x25d716){return BPromise[_0x584e('0x1e')](_0x25d716);}return _0x2d77e1['save']();};}function saveUpdates(_0x5ca861,_0x51a077){return function(_0x3b76fc){if(_0x3b76fc){return _0x3b76fc[_0x584e('0x1f')](_0x5ca861)[_0x584e('0x20')](function(_0x94636b){return _0x94636b;});}return null;};}function removeEntity(_0x295f46,_0x25c8fc){return function(_0x50a058){if(_0x50a058){return _0x50a058['destroy']()['then'](function(){_0x295f46[_0x584e('0x15')](0xcc)[_0x584e('0x16')]();});}};}function handleEntityNotFound(_0x3cc724,_0x562284){return function(_0x27e555){if(!_0x27e555){_0x3cc724[_0x584e('0x14')](0x194);}return _0x27e555;};}function handleError(_0x3601bd,_0x498831){_0x498831=_0x498831||0x1f4;return function(_0x5054c4){logger[_0x584e('0x21')](_0x5054c4[_0x584e('0x22')]);if(_0x5054c4['name']){delete _0x5054c4['name'];}_0x3601bd['status'](_0x498831)[_0x584e('0x23')](_0x5054c4);};}exports[_0x584e('0x24')]=function(_0x1e2d9e,_0x4862cc){var _0x4444e6={},_0x2fedd4={},_0x17c62f={'count':0x0,'rows':[]};var _0x4728cd=_['map'](db[_0x584e('0x25')][_0x584e('0x26')],function(_0x4bbebd){return{'name':_0x4bbebd[_0x584e('0x27')],'type':_0x4bbebd[_0x584e('0x28')][_0x584e('0x29')]};});_0x2fedd4['model']=_['map'](_0x4728cd,_0x584e('0x2a'));_0x2fedd4[_0x584e('0x2b')]=_[_0x584e('0x2c')](_0x1e2d9e[_0x584e('0x2b')]);_0x2fedd4[_0x584e('0x2d')]=_[_0x584e('0x2e')](_0x2fedd4[_0x584e('0x2f')],_0x2fedd4[_0x584e('0x2b')]);_0x4444e6[_0x584e('0x30')]=_['intersection'](_0x2fedd4[_0x584e('0x2f')],qs[_0x584e('0x31')](_0x1e2d9e[_0x584e('0x2b')][_0x584e('0x31')]));_0x4444e6[_0x584e('0x30')]=_0x4444e6[_0x584e('0x30')][_0x584e('0x32')]?_0x4444e6[_0x584e('0x30')]:_0x2fedd4['model'];if(!_0x1e2d9e[_0x584e('0x2b')][_0x584e('0x33')](_0x584e('0x34'))){_0x4444e6[_0x584e('0x18')]=qs[_0x584e('0x18')](_0x1e2d9e[_0x584e('0x2b')]['limit']);_0x4444e6[_0x584e('0x1b')]=qs['offset'](_0x1e2d9e[_0x584e('0x2b')][_0x584e('0x1b')]);}_0x4444e6[_0x584e('0x35')]=qs[_0x584e('0x36')](_0x1e2d9e[_0x584e('0x2b')]['sort']);_0x4444e6[_0x584e('0x37')]=qs[_0x584e('0x2d')](_[_0x584e('0x38')](_0x1e2d9e[_0x584e('0x2b')],_0x2fedd4[_0x584e('0x2d')]),_0x4728cd);if(_0x1e2d9e[_0x584e('0x2b')][_0x584e('0x39')]){_0x4444e6[_0x584e('0x37')]=_['merge'](_0x4444e6[_0x584e('0x37')],{'$or':_[_0x584e('0x3a')](_0x4728cd,function(_0x4934ce){if(_0x4934ce[_0x584e('0x28')]!==_0x584e('0x3b')){var _0xe02609={};_0xe02609[_0x4934ce['name']]={'$like':'%'+_0x1e2d9e[_0x584e('0x2b')]['filter']+'%'};return _0xe02609;}})});}_0x4444e6=_[_0x584e('0x3c')]({},_0x4444e6,_0x1e2d9e[_0x584e('0x3d')]);var _0x377c6b={'where':_0x4444e6[_0x584e('0x37')]};return db[_0x584e('0x25')]['count'](_0x377c6b)[_0x584e('0x20')](function(_0x1950bb){_0x17c62f[_0x584e('0x1a')]=_0x1950bb;if(_0x1e2d9e['query'][_0x584e('0x3e')]){_0x4444e6[_0x584e('0x3f')]=[{'all':!![]}];}return db['Dynamics365Configuration'][_0x584e('0x40')](_0x4444e6);})[_0x584e('0x20')](function(_0x4c705a){_0x17c62f[_0x584e('0x41')]=_0x4c705a;return _0x17c62f;})[_0x584e('0x20')](respondWithFilteredResult(_0x4862cc,_0x4444e6))[_0x584e('0x42')](handleError(_0x4862cc,null));};exports['show']=function(_0x4de3ee,_0xda3aed){var _0x504678={'raw':![],'where':{'id':_0x4de3ee[_0x584e('0x43')]['id']}},_0x1fb084={};_0x1fb084[_0x584e('0x2f')]=_[_0x584e('0x2c')](db['Dynamics365Configuration'][_0x584e('0x26')]);_0x1fb084['query']=_[_0x584e('0x2c')](_0x4de3ee[_0x584e('0x2b')]);_0x1fb084['filters']=_[_0x584e('0x2e')](_0x1fb084[_0x584e('0x2f')],_0x1fb084[_0x584e('0x2b')]);_0x504678[_0x584e('0x30')]=_['intersection'](_0x1fb084[_0x584e('0x2f')],qs[_0x584e('0x31')](_0x4de3ee[_0x584e('0x2b')][_0x584e('0x31')]));_0x504678['attributes']=_0x504678[_0x584e('0x30')][_0x584e('0x32')]?_0x504678[_0x584e('0x30')]:_0x1fb084['model'];if(_0x4de3ee[_0x584e('0x2b')][_0x584e('0x3e')]){_0x504678[_0x584e('0x3f')]=[{'all':!![]}];}_0x504678=_[_0x584e('0x3c')]({},_0x504678,_0x4de3ee[_0x584e('0x3d')]);return db['Dynamics365Configuration']['find'](_0x504678)[_0x584e('0x20')](handleEntityNotFound(_0xda3aed,null))[_0x584e('0x20')](respondWithResult(_0xda3aed,null))[_0x584e('0x42')](handleError(_0xda3aed,null));};exports[_0x584e('0x44')]=function(_0x595b6d,_0x5c854c){return db['Dynamics365Configuration']['create'](_0x595b6d[_0x584e('0x45')],{})[_0x584e('0x20')](respondWithResult(_0x5c854c,0xc9))[_0x584e('0x42')](handleError(_0x5c854c,null));};exports[_0x584e('0x1f')]=function(_0x669b2f,_0x5881dd){if(_0x669b2f['body']['id']){delete _0x669b2f[_0x584e('0x45')]['id'];}return db[_0x584e('0x25')][_0x584e('0x46')]({'where':{'id':_0x669b2f[_0x584e('0x43')]['id']}})['then'](handleEntityNotFound(_0x5881dd,null))[_0x584e('0x20')](saveUpdates(_0x669b2f[_0x584e('0x45')],null))['then'](respondWithResult(_0x5881dd,null))[_0x584e('0x42')](handleError(_0x5881dd,null));};exports['destroy']=function(_0x1f1e5f,_0x130f6c){return db[_0x584e('0x25')][_0x584e('0x46')]({'where':{'id':_0x1f1e5f['params']['id']}})['then'](handleEntityNotFound(_0x130f6c,null))['then'](removeEntity(_0x130f6c,null))[_0x584e('0x42')](handleError(_0x130f6c,null));};exports[_0x584e('0x47')]=function(_0x45a439,_0x5cce0b,_0x7e3ad9){var _0x22349d={};var _0x314c56={};var _0x2fe53a;var _0x332ad2;return db['Dynamics365Configuration']['findOne']({'where':{'id':_0x45a439[_0x584e('0x43')]['id']}})[_0x584e('0x20')](handleEntityNotFound(_0x5cce0b,null))['then'](function(_0x193f67){if(_0x193f67){_0x2fe53a=_0x193f67;_0x314c56['model']=_['keys'](db[_0x584e('0x48')][_0x584e('0x26')]);_0x314c56[_0x584e('0x2b')]=_[_0x584e('0x2c')](_0x45a439[_0x584e('0x2b')]);_0x314c56['filters']=_[_0x584e('0x2e')](_0x314c56[_0x584e('0x2f')],_0x314c56[_0x584e('0x2b')]);_0x22349d[_0x584e('0x30')]=_[_0x584e('0x2e')](_0x314c56[_0x584e('0x2f')],qs['fields'](_0x45a439[_0x584e('0x2b')][_0x584e('0x31')]));_0x22349d['attributes']=_0x22349d[_0x584e('0x30')]['length']?_0x22349d[_0x584e('0x30')]:_0x314c56[_0x584e('0x2f')];_0x22349d[_0x584e('0x35')]=qs[_0x584e('0x36')](_0x45a439[_0x584e('0x2b')][_0x584e('0x36')]);_0x22349d['where']=qs[_0x584e('0x2d')](_['pick'](_0x45a439['query'],_0x314c56[_0x584e('0x2d')]));if(_0x45a439[_0x584e('0x2b')][_0x584e('0x39')]){_0x22349d[_0x584e('0x37')]=_[_0x584e('0x3c')](_0x22349d[_0x584e('0x37')],{'$or':_['map'](_0x22349d['attributes'],function(_0x309bac){var _0x3dffcf={};_0x3dffcf[_0x309bac]={'$like':'%'+_0x45a439[_0x584e('0x2b')][_0x584e('0x39')]+'%'};return _0x3dffcf;})});}_0x22349d=_['merge']({},_0x22349d,_0x45a439['options']);return _0x2fe53a[_0x584e('0x47')](_0x22349d);}})[_0x584e('0x20')](function(_0x413779){if(_0x413779){_0x332ad2=_0x413779['length'];if(!_0x45a439[_0x584e('0x2b')]['hasOwnProperty'](_0x584e('0x34'))){_0x22349d[_0x584e('0x18')]=qs['limit'](_0x45a439[_0x584e('0x2b')]['limit']);_0x22349d[_0x584e('0x1b')]=qs[_0x584e('0x1b')](_0x45a439['query']['offset']);}return _0x2fe53a[_0x584e('0x47')](_0x22349d);}})['then'](function(_0x3453c2){if(_0x3453c2){return _0x3453c2?{'count':_0x332ad2,'rows':_0x3453c2}:null;}})[_0x584e('0x20')](respondWithResult(_0x5cce0b,null))[_0x584e('0x42')](handleError(_0x5cce0b,null));};exports[_0x584e('0x49')]=function(_0x4f5ae8,_0x44ddd3,_0x3b7247){var _0x2fe026={};var _0x30a338={};var _0x2fff24;var _0x309a91;return db['Dynamics365Configuration'][_0x584e('0x4a')]({'where':{'id':_0x4f5ae8[_0x584e('0x43')]['id']}})[_0x584e('0x20')](handleEntityNotFound(_0x44ddd3,null))[_0x584e('0x20')](function(_0x222145){if(_0x222145){_0x2fff24=_0x222145;_0x30a338['model']=_['keys'](db[_0x584e('0x48')][_0x584e('0x26')]);_0x30a338[_0x584e('0x2b')]=_[_0x584e('0x2c')](_0x4f5ae8['query']);_0x30a338[_0x584e('0x2d')]=_[_0x584e('0x2e')](_0x30a338[_0x584e('0x2f')],_0x30a338['query']);_0x2fe026[_0x584e('0x30')]=_[_0x584e('0x2e')](_0x30a338[_0x584e('0x2f')],qs['fields'](_0x4f5ae8[_0x584e('0x2b')]['fields']));_0x2fe026['attributes']=_0x2fe026[_0x584e('0x30')][_0x584e('0x32')]?_0x2fe026[_0x584e('0x30')]:_0x30a338[_0x584e('0x2f')];_0x2fe026['order']=qs[_0x584e('0x36')](_0x4f5ae8[_0x584e('0x2b')]['sort']);_0x2fe026['where']=qs[_0x584e('0x2d')](_['pick'](_0x4f5ae8['query'],_0x30a338[_0x584e('0x2d')]));if(_0x4f5ae8['query'][_0x584e('0x39')]){_0x2fe026[_0x584e('0x37')]=_[_0x584e('0x3c')](_0x2fe026['where'],{'$or':_[_0x584e('0x3a')](_0x2fe026[_0x584e('0x30')],function(_0x47e22a){var _0x373002={};_0x373002[_0x47e22a]={'$like':'%'+_0x4f5ae8[_0x584e('0x2b')][_0x584e('0x39')]+'%'};return _0x373002;})});}_0x2fe026=_['merge']({},_0x2fe026,_0x4f5ae8[_0x584e('0x3d')]);return _0x2fff24['getSubjects'](_0x2fe026);}})[_0x584e('0x20')](function(_0x46775d){if(_0x46775d){_0x309a91=_0x46775d[_0x584e('0x32')];if(!_0x4f5ae8[_0x584e('0x2b')][_0x584e('0x33')](_0x584e('0x34'))){_0x2fe026['limit']=qs[_0x584e('0x18')](_0x4f5ae8[_0x584e('0x2b')][_0x584e('0x18')]);_0x2fe026[_0x584e('0x1b')]=qs[_0x584e('0x1b')](_0x4f5ae8[_0x584e('0x2b')][_0x584e('0x1b')]);}return _0x2fff24['getSubjects'](_0x2fe026);}})[_0x584e('0x20')](function(_0x28bb4b){if(_0x28bb4b){return _0x28bb4b?{'count':_0x309a91,'rows':_0x28bb4b}:null;}})[_0x584e('0x20')](respondWithResult(_0x44ddd3,null))[_0x584e('0x42')](handleError(_0x44ddd3,null));};exports[_0x584e('0x4b')]=function(_0x5f43ee,_0x1c258f,_0x41c1cc){var _0x194cee={};var _0x2d118c={};var _0x40323b;var _0x33b01a;return db['Dynamics365Configuration'][_0x584e('0x4a')]({'where':{'id':_0x5f43ee[_0x584e('0x43')]['id']}})[_0x584e('0x20')](handleEntityNotFound(_0x1c258f,null))[_0x584e('0x20')](function(_0x20057b){if(_0x20057b){_0x40323b=_0x20057b;_0x2d118c[_0x584e('0x2f')]=_[_0x584e('0x2c')](db['Dynamics365Field']['rawAttributes']);_0x2d118c[_0x584e('0x2b')]=_['keys'](_0x5f43ee['query']);_0x2d118c[_0x584e('0x2d')]=_[_0x584e('0x2e')](_0x2d118c[_0x584e('0x2f')],_0x2d118c[_0x584e('0x2b')]);_0x194cee[_0x584e('0x30')]=_[_0x584e('0x2e')](_0x2d118c[_0x584e('0x2f')],qs[_0x584e('0x31')](_0x5f43ee[_0x584e('0x2b')]['fields']));_0x194cee[_0x584e('0x30')]=_0x194cee[_0x584e('0x30')]['length']?_0x194cee[_0x584e('0x30')]:_0x2d118c[_0x584e('0x2f')];_0x194cee[_0x584e('0x35')]=qs[_0x584e('0x36')](_0x5f43ee[_0x584e('0x2b')][_0x584e('0x36')]);_0x194cee['where']=qs['filters'](_[_0x584e('0x38')](_0x5f43ee[_0x584e('0x2b')],_0x2d118c[_0x584e('0x2d')]));if(_0x5f43ee[_0x584e('0x2b')]['filter']){_0x194cee[_0x584e('0x37')]=_[_0x584e('0x3c')](_0x194cee[_0x584e('0x37')],{'$or':_[_0x584e('0x3a')](_0x194cee[_0x584e('0x30')],function(_0x47e4f8){var _0x363fee={};_0x363fee[_0x47e4f8]={'$like':'%'+_0x5f43ee[_0x584e('0x2b')][_0x584e('0x39')]+'%'};return _0x363fee;})});}_0x194cee=_[_0x584e('0x3c')]({},_0x194cee,_0x5f43ee[_0x584e('0x3d')]);return _0x40323b[_0x584e('0x4b')](_0x194cee);}})[_0x584e('0x20')](function(_0xd89549){if(_0xd89549){_0x33b01a=_0xd89549[_0x584e('0x32')];if(!_0x5f43ee[_0x584e('0x2b')][_0x584e('0x33')](_0x584e('0x34'))){_0x194cee[_0x584e('0x18')]=qs[_0x584e('0x18')](_0x5f43ee[_0x584e('0x2b')]['limit']);_0x194cee[_0x584e('0x1b')]=qs[_0x584e('0x1b')](_0x5f43ee[_0x584e('0x2b')][_0x584e('0x1b')]);}return _0x40323b['getDescriptions'](_0x194cee);}})[_0x584e('0x20')](function(_0x6953b9){if(_0x6953b9){return _0x6953b9?{'count':_0x33b01a,'rows':_0x6953b9}:null;}})[_0x584e('0x20')](respondWithResult(_0x1c258f,null))['catch'](handleError(_0x1c258f,null));}; \ No newline at end of file +var _0xa618=['offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','sendStatus','stack','name','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','Dynamics365Configuration','findAll','rows','show','params','options','find','catch','create','body','destroy','getFields','findOne','Dynamics365Field','getSubjects','getDescriptions','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','status','end','json'];(function(_0x52542c,_0x4e71e8){var _0x16b808=function(_0x1f3a98){while(--_0x1f3a98){_0x52542c['push'](_0x52542c['shift']());}};_0x16b808(++_0x4e71e8);}(_0xa618,0x1db));var _0x8a61=function(_0xd75550,_0x45b26b){_0xd75550=_0xd75550-0x0;var _0x167664=_0xa618[_0xd75550];return _0x167664;};'use strict';var emlformat=require(_0x8a61('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8a61('0x1'));var jsonpatch=require(_0x8a61('0x2'));var rp=require(_0x8a61('0x3'));var moment=require(_0x8a61('0x4'));var BPromise=require(_0x8a61('0x5'));var Mustache=require(_0x8a61('0x6'));var util=require(_0x8a61('0x7'));var path=require(_0x8a61('0x8'));var sox=require(_0x8a61('0x9'));var csv=require(_0x8a61('0xa'));var ejs=require(_0x8a61('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8a61('0xc'));var squel=require(_0x8a61('0xd'));var crypto=require(_0x8a61('0xe'));var jsforce=require(_0x8a61('0xf'));var deskjs=require(_0x8a61('0x10'));var toCsv=require(_0x8a61('0xa'));var querystring=require(_0x8a61('0x11'));var Papa=require(_0x8a61('0x12'));var Redis=require(_0x8a61('0x13'));var authService=require(_0x8a61('0x14'));var qs=require(_0x8a61('0x15'));var as=require(_0x8a61('0x16'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x8a61('0x17'))(_0x8a61('0x18'));var utils=require(_0x8a61('0x19'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5ec7af,_0x126a9b){_0x126a9b=_0x126a9b||0xcc;return function(_0x37b897){if(_0x37b897){return _0x5ec7af['sendStatus'](_0x126a9b);}return _0x5ec7af[_0x8a61('0x1a')](_0x126a9b)[_0x8a61('0x1b')]();};}function respondWithResult(_0x22e97c,_0x2b288d){_0x2b288d=_0x2b288d||0xc8;return function(_0x47354e){if(_0x47354e){return _0x22e97c[_0x8a61('0x1a')](_0x2b288d)[_0x8a61('0x1c')](_0x47354e);}};}function respondWithFilteredResult(_0x389bb6,_0x4f0048){return function(_0x4c9880){if(_0x4c9880){var _0x2afa7b=typeof _0x4f0048[_0x8a61('0x1d')]==='undefined'&&typeof _0x4f0048[_0x8a61('0x1e')]===_0x8a61('0x1f');var _0x58d7d4=_0x4c9880[_0x8a61('0x20')];var _0x59c6bb=_0x2afa7b?0x0:_0x4f0048[_0x8a61('0x1d')];var _0x106d7f=_0x2afa7b?_0x4c9880['count']:_0x4f0048[_0x8a61('0x1d')]+_0x4f0048[_0x8a61('0x1e')];var _0x59dbb4;if(_0x106d7f>=_0x58d7d4){_0x106d7f=_0x58d7d4;_0x59dbb4=0xc8;}else{_0x59dbb4=0xce;}_0x389bb6[_0x8a61('0x1a')](_0x59dbb4);return _0x389bb6[_0x8a61('0x21')](_0x8a61('0x22'),_0x59c6bb+'-'+_0x106d7f+'/'+_0x58d7d4)[_0x8a61('0x1c')](_0x4c9880);}return null;};}function patchUpdates(_0x5801e9){return function(_0x2edf92){try{jsonpatch[_0x8a61('0x23')](_0x2edf92,_0x5801e9,!![]);}catch(_0x3d4689){return BPromise[_0x8a61('0x24')](_0x3d4689);}return _0x2edf92[_0x8a61('0x25')]();};}function saveUpdates(_0x49eec7,_0x2706e8){return function(_0x64882b){if(_0x64882b){return _0x64882b[_0x8a61('0x26')](_0x49eec7)['then'](function(_0x156dab){return _0x156dab;});}return null;};}function removeEntity(_0x3fcac0,_0x5356e0){return function(_0x26f6bf){if(_0x26f6bf){return _0x26f6bf['destroy']()[_0x8a61('0x27')](function(){_0x3fcac0[_0x8a61('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x565acd,_0x237bc7){return function(_0x3b938c){if(!_0x3b938c){_0x565acd[_0x8a61('0x28')](0x194);}return _0x3b938c;};}function handleError(_0xa0a827,_0x3b7906){_0x3b7906=_0x3b7906||0x1f4;return function(_0x3f8b55){logger['error'](_0x3f8b55[_0x8a61('0x29')]);if(_0x3f8b55[_0x8a61('0x2a')]){delete _0x3f8b55[_0x8a61('0x2a')];}_0xa0a827['status'](_0x3b7906)['send'](_0x3f8b55);};}exports[_0x8a61('0x2b')]=function(_0x317d4e,_0x535294){var _0x52ad76={},_0x354fe6={},_0xb9175b={'count':0x0,'rows':[]};var _0xfe7395=_[_0x8a61('0x2c')](db['Dynamics365Configuration'][_0x8a61('0x2d')],function(_0x147eca){return{'name':_0x147eca[_0x8a61('0x2e')],'type':_0x147eca[_0x8a61('0x2f')][_0x8a61('0x30')]};});_0x354fe6[_0x8a61('0x31')]=_[_0x8a61('0x2c')](_0xfe7395,'name');_0x354fe6[_0x8a61('0x32')]=_[_0x8a61('0x33')](_0x317d4e[_0x8a61('0x32')]);_0x354fe6[_0x8a61('0x34')]=_[_0x8a61('0x35')](_0x354fe6[_0x8a61('0x31')],_0x354fe6[_0x8a61('0x32')]);_0x52ad76[_0x8a61('0x36')]=_['intersection'](_0x354fe6[_0x8a61('0x31')],qs[_0x8a61('0x37')](_0x317d4e[_0x8a61('0x32')][_0x8a61('0x37')]));_0x52ad76[_0x8a61('0x36')]=_0x52ad76[_0x8a61('0x36')][_0x8a61('0x38')]?_0x52ad76['attributes']:_0x354fe6[_0x8a61('0x31')];if(!_0x317d4e['query'][_0x8a61('0x39')](_0x8a61('0x3a'))){_0x52ad76[_0x8a61('0x1e')]=qs[_0x8a61('0x1e')](_0x317d4e[_0x8a61('0x32')][_0x8a61('0x1e')]);_0x52ad76[_0x8a61('0x1d')]=qs[_0x8a61('0x1d')](_0x317d4e[_0x8a61('0x32')][_0x8a61('0x1d')]);}_0x52ad76[_0x8a61('0x3b')]=qs[_0x8a61('0x3c')](_0x317d4e[_0x8a61('0x32')][_0x8a61('0x3c')]);_0x52ad76[_0x8a61('0x3d')]=qs[_0x8a61('0x34')](_[_0x8a61('0x3e')](_0x317d4e['query'],_0x354fe6['filters']),_0xfe7395);if(_0x317d4e['query'][_0x8a61('0x3f')]){_0x52ad76['where']=_[_0x8a61('0x40')](_0x52ad76[_0x8a61('0x3d')],{'$or':_['map'](_0xfe7395,function(_0x13499e){if(_0x13499e[_0x8a61('0x2f')]!==_0x8a61('0x41')){var _0x4cc13c={};_0x4cc13c[_0x13499e['name']]={'$like':'%'+_0x317d4e[_0x8a61('0x32')][_0x8a61('0x3f')]+'%'};return _0x4cc13c;}})});}_0x52ad76=_[_0x8a61('0x40')]({},_0x52ad76,_0x317d4e['options']);var _0x57bb65={'where':_0x52ad76[_0x8a61('0x3d')]};return db['Dynamics365Configuration']['count'](_0x57bb65)[_0x8a61('0x27')](function(_0x4de995){_0xb9175b[_0x8a61('0x20')]=_0x4de995;if(_0x317d4e[_0x8a61('0x32')][_0x8a61('0x42')]){_0x52ad76[_0x8a61('0x43')]=[{'all':!![]}];}return db[_0x8a61('0x44')][_0x8a61('0x45')](_0x52ad76);})[_0x8a61('0x27')](function(_0x5d3e8d){_0xb9175b[_0x8a61('0x46')]=_0x5d3e8d;return _0xb9175b;})[_0x8a61('0x27')](respondWithFilteredResult(_0x535294,_0x52ad76))['catch'](handleError(_0x535294,null));};exports[_0x8a61('0x47')]=function(_0x5d02f9,_0x47a7cf){var _0x5a363e={'raw':![],'where':{'id':_0x5d02f9[_0x8a61('0x48')]['id']}},_0x559734={};_0x559734[_0x8a61('0x31')]=_[_0x8a61('0x33')](db[_0x8a61('0x44')][_0x8a61('0x2d')]);_0x559734[_0x8a61('0x32')]=_[_0x8a61('0x33')](_0x5d02f9[_0x8a61('0x32')]);_0x559734[_0x8a61('0x34')]=_['intersection'](_0x559734[_0x8a61('0x31')],_0x559734[_0x8a61('0x32')]);_0x5a363e['attributes']=_[_0x8a61('0x35')](_0x559734[_0x8a61('0x31')],qs[_0x8a61('0x37')](_0x5d02f9[_0x8a61('0x32')][_0x8a61('0x37')]));_0x5a363e[_0x8a61('0x36')]=_0x5a363e[_0x8a61('0x36')][_0x8a61('0x38')]?_0x5a363e[_0x8a61('0x36')]:_0x559734[_0x8a61('0x31')];if(_0x5d02f9[_0x8a61('0x32')][_0x8a61('0x42')]){_0x5a363e['include']=[{'all':!![]}];}_0x5a363e=_[_0x8a61('0x40')]({},_0x5a363e,_0x5d02f9[_0x8a61('0x49')]);return db[_0x8a61('0x44')][_0x8a61('0x4a')](_0x5a363e)['then'](handleEntityNotFound(_0x47a7cf,null))[_0x8a61('0x27')](respondWithResult(_0x47a7cf,null))[_0x8a61('0x4b')](handleError(_0x47a7cf,null));};exports[_0x8a61('0x4c')]=function(_0x3a402d,_0x245bb1){return db['Dynamics365Configuration'][_0x8a61('0x4c')](_0x3a402d['body'],{})[_0x8a61('0x27')](respondWithResult(_0x245bb1,0xc9))[_0x8a61('0x4b')](handleError(_0x245bb1,null));};exports[_0x8a61('0x26')]=function(_0x5697cc,_0x5b9202){if(_0x5697cc['body']['id']){delete _0x5697cc[_0x8a61('0x4d')]['id'];}return db[_0x8a61('0x44')][_0x8a61('0x4a')]({'where':{'id':_0x5697cc['params']['id']}})['then'](handleEntityNotFound(_0x5b9202,null))[_0x8a61('0x27')](saveUpdates(_0x5697cc[_0x8a61('0x4d')],null))[_0x8a61('0x27')](respondWithResult(_0x5b9202,null))[_0x8a61('0x4b')](handleError(_0x5b9202,null));};exports[_0x8a61('0x4e')]=function(_0x3814ab,_0x9b82e2){return db[_0x8a61('0x44')][_0x8a61('0x4a')]({'where':{'id':_0x3814ab[_0x8a61('0x48')]['id']}})[_0x8a61('0x27')](handleEntityNotFound(_0x9b82e2,null))[_0x8a61('0x27')](removeEntity(_0x9b82e2,null))[_0x8a61('0x4b')](handleError(_0x9b82e2,null));};exports[_0x8a61('0x4f')]=function(_0x336577,_0x2db1ed,_0x38027e){var _0xcd5c5e={};var _0x31c9fd={};var _0x158f9c;var _0x5f1f31;return db[_0x8a61('0x44')][_0x8a61('0x50')]({'where':{'id':_0x336577[_0x8a61('0x48')]['id']}})['then'](handleEntityNotFound(_0x2db1ed,null))[_0x8a61('0x27')](function(_0x3abd07){if(_0x3abd07){_0x158f9c=_0x3abd07;_0x31c9fd[_0x8a61('0x31')]=_['keys'](db[_0x8a61('0x51')][_0x8a61('0x2d')]);_0x31c9fd['query']=_['keys'](_0x336577['query']);_0x31c9fd[_0x8a61('0x34')]=_['intersection'](_0x31c9fd[_0x8a61('0x31')],_0x31c9fd[_0x8a61('0x32')]);_0xcd5c5e[_0x8a61('0x36')]=_[_0x8a61('0x35')](_0x31c9fd[_0x8a61('0x31')],qs[_0x8a61('0x37')](_0x336577[_0x8a61('0x32')]['fields']));_0xcd5c5e[_0x8a61('0x36')]=_0xcd5c5e[_0x8a61('0x36')][_0x8a61('0x38')]?_0xcd5c5e[_0x8a61('0x36')]:_0x31c9fd[_0x8a61('0x31')];_0xcd5c5e['order']=qs[_0x8a61('0x3c')](_0x336577[_0x8a61('0x32')]['sort']);_0xcd5c5e[_0x8a61('0x3d')]=qs[_0x8a61('0x34')](_[_0x8a61('0x3e')](_0x336577[_0x8a61('0x32')],_0x31c9fd[_0x8a61('0x34')]));if(_0x336577['query'][_0x8a61('0x3f')]){_0xcd5c5e[_0x8a61('0x3d')]=_[_0x8a61('0x40')](_0xcd5c5e[_0x8a61('0x3d')],{'$or':_[_0x8a61('0x2c')](_0xcd5c5e['attributes'],function(_0xbf6e69){var _0x22bf12={};_0x22bf12[_0xbf6e69]={'$like':'%'+_0x336577['query'][_0x8a61('0x3f')]+'%'};return _0x22bf12;})});}_0xcd5c5e=_[_0x8a61('0x40')]({},_0xcd5c5e,_0x336577['options']);return _0x158f9c[_0x8a61('0x4f')](_0xcd5c5e);}})[_0x8a61('0x27')](function(_0x5f17e8){if(_0x5f17e8){_0x5f1f31=_0x5f17e8['length'];if(!_0x336577['query'][_0x8a61('0x39')](_0x8a61('0x3a'))){_0xcd5c5e['limit']=qs['limit'](_0x336577[_0x8a61('0x32')][_0x8a61('0x1e')]);_0xcd5c5e[_0x8a61('0x1d')]=qs['offset'](_0x336577[_0x8a61('0x32')][_0x8a61('0x1d')]);}return _0x158f9c[_0x8a61('0x4f')](_0xcd5c5e);}})[_0x8a61('0x27')](function(_0x55afc3){if(_0x55afc3){return _0x55afc3?{'count':_0x5f1f31,'rows':_0x55afc3}:null;}})['then'](respondWithResult(_0x2db1ed,null))[_0x8a61('0x4b')](handleError(_0x2db1ed,null));};exports[_0x8a61('0x52')]=function(_0x17646c,_0x43db7b,_0x1d1a7d){var _0x2995b1={};var _0x5c80ee={};var _0xdb26d2;var _0x3e4b43;return db['Dynamics365Configuration'][_0x8a61('0x50')]({'where':{'id':_0x17646c['params']['id']}})[_0x8a61('0x27')](handleEntityNotFound(_0x43db7b,null))[_0x8a61('0x27')](function(_0x30e322){if(_0x30e322){_0xdb26d2=_0x30e322;_0x5c80ee[_0x8a61('0x31')]=_[_0x8a61('0x33')](db[_0x8a61('0x51')][_0x8a61('0x2d')]);_0x5c80ee[_0x8a61('0x32')]=_[_0x8a61('0x33')](_0x17646c[_0x8a61('0x32')]);_0x5c80ee[_0x8a61('0x34')]=_[_0x8a61('0x35')](_0x5c80ee[_0x8a61('0x31')],_0x5c80ee[_0x8a61('0x32')]);_0x2995b1[_0x8a61('0x36')]=_[_0x8a61('0x35')](_0x5c80ee[_0x8a61('0x31')],qs[_0x8a61('0x37')](_0x17646c[_0x8a61('0x32')][_0x8a61('0x37')]));_0x2995b1['attributes']=_0x2995b1['attributes']['length']?_0x2995b1[_0x8a61('0x36')]:_0x5c80ee[_0x8a61('0x31')];_0x2995b1[_0x8a61('0x3b')]=qs[_0x8a61('0x3c')](_0x17646c[_0x8a61('0x32')][_0x8a61('0x3c')]);_0x2995b1['where']=qs[_0x8a61('0x34')](_[_0x8a61('0x3e')](_0x17646c[_0x8a61('0x32')],_0x5c80ee[_0x8a61('0x34')]));if(_0x17646c[_0x8a61('0x32')]['filter']){_0x2995b1[_0x8a61('0x3d')]=_[_0x8a61('0x40')](_0x2995b1[_0x8a61('0x3d')],{'$or':_[_0x8a61('0x2c')](_0x2995b1['attributes'],function(_0x46df24){var _0x1098d3={};_0x1098d3[_0x46df24]={'$like':'%'+_0x17646c[_0x8a61('0x32')][_0x8a61('0x3f')]+'%'};return _0x1098d3;})});}_0x2995b1=_[_0x8a61('0x40')]({},_0x2995b1,_0x17646c[_0x8a61('0x49')]);return _0xdb26d2[_0x8a61('0x52')](_0x2995b1);}})[_0x8a61('0x27')](function(_0x2f6561){if(_0x2f6561){_0x3e4b43=_0x2f6561[_0x8a61('0x38')];if(!_0x17646c[_0x8a61('0x32')]['hasOwnProperty']('nolimit')){_0x2995b1[_0x8a61('0x1e')]=qs[_0x8a61('0x1e')](_0x17646c[_0x8a61('0x32')][_0x8a61('0x1e')]);_0x2995b1[_0x8a61('0x1d')]=qs[_0x8a61('0x1d')](_0x17646c[_0x8a61('0x32')]['offset']);}return _0xdb26d2[_0x8a61('0x52')](_0x2995b1);}})['then'](function(_0x9d6a12){if(_0x9d6a12){return _0x9d6a12?{'count':_0x3e4b43,'rows':_0x9d6a12}:null;}})[_0x8a61('0x27')](respondWithResult(_0x43db7b,null))[_0x8a61('0x4b')](handleError(_0x43db7b,null));};exports[_0x8a61('0x53')]=function(_0x35f82b,_0x5bdc7f,_0x4acf2c){var _0x716e0d={};var _0x422782={};var _0xd1ef6b;var _0x397007;return db['Dynamics365Configuration'][_0x8a61('0x50')]({'where':{'id':_0x35f82b[_0x8a61('0x48')]['id']}})[_0x8a61('0x27')](handleEntityNotFound(_0x5bdc7f,null))['then'](function(_0x54f5ea){if(_0x54f5ea){_0xd1ef6b=_0x54f5ea;_0x422782[_0x8a61('0x31')]=_[_0x8a61('0x33')](db[_0x8a61('0x51')][_0x8a61('0x2d')]);_0x422782[_0x8a61('0x32')]=_['keys'](_0x35f82b[_0x8a61('0x32')]);_0x422782['filters']=_[_0x8a61('0x35')](_0x422782['model'],_0x422782[_0x8a61('0x32')]);_0x716e0d['attributes']=_[_0x8a61('0x35')](_0x422782['model'],qs['fields'](_0x35f82b['query'][_0x8a61('0x37')]));_0x716e0d['attributes']=_0x716e0d[_0x8a61('0x36')][_0x8a61('0x38')]?_0x716e0d[_0x8a61('0x36')]:_0x422782[_0x8a61('0x31')];_0x716e0d[_0x8a61('0x3b')]=qs[_0x8a61('0x3c')](_0x35f82b['query'][_0x8a61('0x3c')]);_0x716e0d['where']=qs[_0x8a61('0x34')](_[_0x8a61('0x3e')](_0x35f82b[_0x8a61('0x32')],_0x422782[_0x8a61('0x34')]));if(_0x35f82b[_0x8a61('0x32')][_0x8a61('0x3f')]){_0x716e0d[_0x8a61('0x3d')]=_[_0x8a61('0x40')](_0x716e0d[_0x8a61('0x3d')],{'$or':_['map'](_0x716e0d[_0x8a61('0x36')],function(_0x1b49c1){var _0x15dade={};_0x15dade[_0x1b49c1]={'$like':'%'+_0x35f82b[_0x8a61('0x32')][_0x8a61('0x3f')]+'%'};return _0x15dade;})});}_0x716e0d=_[_0x8a61('0x40')]({},_0x716e0d,_0x35f82b[_0x8a61('0x49')]);return _0xd1ef6b[_0x8a61('0x53')](_0x716e0d);}})[_0x8a61('0x27')](function(_0xafbd57){if(_0xafbd57){_0x397007=_0xafbd57[_0x8a61('0x38')];if(!_0x35f82b[_0x8a61('0x32')]['hasOwnProperty']('nolimit')){_0x716e0d[_0x8a61('0x1e')]=qs[_0x8a61('0x1e')](_0x35f82b[_0x8a61('0x32')][_0x8a61('0x1e')]);_0x716e0d[_0x8a61('0x1d')]=qs[_0x8a61('0x1d')](_0x35f82b[_0x8a61('0x32')][_0x8a61('0x1d')]);}return _0xd1ef6b[_0x8a61('0x53')](_0x716e0d);}})[_0x8a61('0x27')](function(_0x1a2ade){if(_0x1a2ade){return _0x1a2ade?{'count':_0x397007,'rows':_0x1a2ade}:null;}})[_0x8a61('0x27')](respondWithResult(_0x5bdc7f,null))['catch'](handleError(_0x5bdc7f,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js index 92400be..119d27d 100644 --- a/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js +++ b/server/api/intDynamics365Configuration/intDynamics365Configuration.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0x23d278,_0x411ea7){var _0x12c538=function(_0x2078ab){while(--_0x2078ab){_0x23d278['push'](_0x23d278['shift']());}};_0x12c538(++_0x411ea7);}(_0x9f62,0x154));var _0x29f6=function(_0x2b8a29,_0x156924){_0x2b8a29=_0x2b8a29-0x0;var _0x25fd2c=_0x9f62[_0x2b8a29];return _0x25fd2c;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9f62=['api','moment','bluebird','rimraf','../../config/environment','./intDynamics365Configuration.attributes','exports','define','Dynamics365Configuration','int_dynamics365_configurations','util'];(function(_0x474dc6,_0x182ed){var _0x2cfe07=function(_0x241cdf){while(--_0x241cdf){_0x474dc6['push'](_0x474dc6['shift']());}};_0x2cfe07(++_0x182ed);}(_0x9f62,0x154));var _0x29f6=function(_0x1e9b78,_0x46f832){_0x1e9b78=_0x1e9b78-0x0;var _0x1edd1d=_0x9f62[_0x1e9b78];return _0x1edd1d;};'use strict';var _=require('lodash');var util=require(_0x29f6('0x0'));var logger=require('../../config/logger')(_0x29f6('0x1'));var moment=require(_0x29f6('0x2'));var BPromise=require(_0x29f6('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x29f6('0x4'));var config=require(_0x29f6('0x5'));var attributes=require(_0x29f6('0x6'));module[_0x29f6('0x7')]=function(_0x595034,_0xf66137){return _0x595034[_0x29f6('0x8')](_0x29f6('0x9'),attributes,{'tableName':_0x29f6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js b/server/api/intDynamics365Configuration/intDynamics365Configuration.rpc.js index 2c4e094..4c15e0b 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 _0x5628=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','Dynamics365Configuration,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','moment'];(function(_0x42bc91,_0x41f40a){var _0x3f5507=function(_0x20cfaf){while(--_0x20cfaf){_0x42bc91['push'](_0x42bc91['shift']());}};_0x3f5507(++_0x41f40a);}(_0x5628,0xf8));var _0x8562=function(_0x10e678,_0x4705a2){_0x10e678=_0x10e678-0x0;var _0x49f641=_0x5628[_0x10e678];return _0x49f641;};'use strict';var _=require('lodash');var util=require(_0x8562('0x0'));var moment=require(_0x8562('0x1'));var BPromise=require(_0x8562('0x2'));var rs=require(_0x8562('0x3'));var fs=require('fs');var Redis=require(_0x8562('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x8562('0x5'));var logger=require(_0x8562('0x6'))(_0x8562('0x7'));var config=require(_0x8562('0x8'));var jayson=require(_0x8562('0x9'));var client=jayson[_0x8562('0xa')][_0x8562('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x372408,_0x1dd678,_0x2fe8d2){return new BPromise(function(_0x840cbe,_0x2eb429){return client[_0x8562('0xc')](_0x372408,_0x2fe8d2)[_0x8562('0xd')](function(_0x20aa5a){logger['info'](_0x8562('0xe'),_0x1dd678,_0x8562('0xf'));logger[_0x8562('0x10')](_0x8562('0x11'),_0x1dd678,'request\x20sent',JSON[_0x8562('0x12')](_0x20aa5a));if(_0x20aa5a[_0x8562('0x13')]){if(_0x20aa5a['error'][_0x8562('0x14')]===0x1f4){logger['error'](_0x8562('0xe'),_0x1dd678,_0x20aa5a[_0x8562('0x13')][_0x8562('0x15')]);return _0x2eb429(_0x20aa5a[_0x8562('0x13')][_0x8562('0x15')]);}logger[_0x8562('0x13')](_0x8562('0xe'),_0x1dd678,_0x20aa5a[_0x8562('0x13')][_0x8562('0x15')]);return _0x840cbe(_0x20aa5a[_0x8562('0x13')][_0x8562('0x15')]);}else{logger[_0x8562('0x16')](_0x8562('0xe'),_0x1dd678,_0x8562('0xf'));_0x840cbe(_0x20aa5a[_0x8562('0x17')][_0x8562('0x15')]);}})[_0x8562('0x18')](function(_0x5474e1){logger[_0x8562('0x13')](_0x8562('0xe'),_0x1dd678,_0x5474e1);_0x2eb429(_0x5474e1);});});} \ No newline at end of file +var _0x6b57=['request','then','info','request\x20sent','debug','Dynamics365Configuration,\x20%s,\x20%s,\x20%s','error','code','Dynamics365Configuration,\x20%s,\x20%s','message','result','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client'];(function(_0x4913a8,_0x5a8cbd){var _0x50a4de=function(_0x31892e){while(--_0x31892e){_0x4913a8['push'](_0x4913a8['shift']());}};_0x50a4de(++_0x5a8cbd);}(_0x6b57,0xfb));var _0x76b5=function(_0x43ae9e,_0x5ddadc){_0x43ae9e=_0x43ae9e-0x0;var _0x3b43f9=_0x6b57[_0x43ae9e];return _0x3b43f9;};'use strict';var _=require(_0x76b5('0x0'));var util=require('util');var moment=require(_0x76b5('0x1'));var BPromise=require(_0x76b5('0x2'));var rs=require(_0x76b5('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x76b5('0x4'))['db'];var utils=require(_0x76b5('0x5'));var logger=require(_0x76b5('0x6'))(_0x76b5('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76b5('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x15dc72,_0x5dfef4,_0x26df6b){return new BPromise(function(_0xc92ed4,_0x44af84){return client[_0x76b5('0x9')](_0x15dc72,_0x26df6b)[_0x76b5('0xa')](function(_0x552223){logger[_0x76b5('0xb')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5dfef4,_0x76b5('0xc'));logger[_0x76b5('0xd')](_0x76b5('0xe'),_0x5dfef4,_0x76b5('0xc'),JSON['stringify'](_0x552223));if(_0x552223[_0x76b5('0xf')]){if(_0x552223[_0x76b5('0xf')][_0x76b5('0x10')]===0x1f4){logger[_0x76b5('0xf')](_0x76b5('0x11'),_0x5dfef4,_0x552223[_0x76b5('0xf')][_0x76b5('0x12')]);return _0x44af84(_0x552223['error']['message']);}logger[_0x76b5('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5dfef4,_0x552223['error'][_0x76b5('0x12')]);return _0xc92ed4(_0x552223[_0x76b5('0xf')][_0x76b5('0x12')]);}else{logger[_0x76b5('0xb')](_0x76b5('0x11'),_0x5dfef4,_0x76b5('0xc'));_0xc92ed4(_0x552223[_0x76b5('0x13')][_0x76b5('0x12')]);}})['catch'](function(_0x544b22){logger[_0x76b5('0xf')]('Dynamics365Configuration,\x20%s,\x20%s',_0x5dfef4,_0x544b22);_0x44af84(_0x544b22);});});} \ No newline at end of file diff --git a/server/api/intDynamics365Field/index.js b/server/api/intDynamics365Field/index.js index 1d160b1..9f67adf 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 _0x2bed=['create','put','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','index','/:id','isAuthenticated','show','post'];(function(_0x20eed6,_0x2efa9d){var _0x1dc085=function(_0x30b5d2){while(--_0x30b5d2){_0x20eed6['push'](_0x20eed6['shift']());}};_0x1dc085(++_0x2efa9d);}(_0x2bed,0x75));var _0xd2be=function(_0x35e4d3,_0x231ab8){_0x35e4d3=_0x35e4d3-0x0;var _0x42e509=_0x2bed[_0x35e4d3];return _0x42e509;};'use strict';var multer=require(_0xd2be('0x0'));var util=require(_0xd2be('0x1'));var path=require(_0xd2be('0x2'));var timeout=require('connect-timeout');var express=require(_0xd2be('0x3'));var router=express[_0xd2be('0x4')]();var fs_extra=require(_0xd2be('0x5'));var auth=require(_0xd2be('0x6'));var interaction=require(_0xd2be('0x7'));var config=require(_0xd2be('0x8'));var controller=require(_0xd2be('0x9'));router[_0xd2be('0xa')]('/',auth['isAuthenticated'](),controller[_0xd2be('0xb')]);router[_0xd2be('0xa')](_0xd2be('0xc'),auth[_0xd2be('0xd')](),controller[_0xd2be('0xe')]);router[_0xd2be('0xf')]('/',auth[_0xd2be('0xd')](),controller[_0xd2be('0x10')]);router[_0xd2be('0x11')](_0xd2be('0xc'),auth[_0xd2be('0xd')](),controller['update']);router['delete']('/:id',auth[_0xd2be('0xd')](),controller['destroy']);module[_0xd2be('0x12')]=router; \ No newline at end of file +var _0x7184=['Router','../../components/interaction/service','../../config/environment','./intDynamics365Field.controller','get','isAuthenticated','index','/:id','show','post','create','delete','destroy','multer','path','connect-timeout'];(function(_0x2afef3,_0x4f4a46){var _0x4fa425=function(_0x3f8675){while(--_0x3f8675){_0x2afef3['push'](_0x2afef3['shift']());}};_0x4fa425(++_0x4f4a46);}(_0x7184,0x14d));var _0x4718=function(_0x49b78f,_0x1ccdf7){_0x49b78f=_0x49b78f-0x0;var _0x544d2=_0x7184[_0x49b78f];return _0x544d2;};'use strict';var multer=require(_0x4718('0x0'));var util=require('util');var path=require(_0x4718('0x1'));var timeout=require(_0x4718('0x2'));var express=require('express');var router=express[_0x4718('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x4718('0x4'));var config=require(_0x4718('0x5'));var controller=require(_0x4718('0x6'));router[_0x4718('0x7')]('/',auth[_0x4718('0x8')](),controller[_0x4718('0x9')]);router[_0x4718('0x7')](_0x4718('0xa'),auth[_0x4718('0x8')](),controller[_0x4718('0xb')]);router[_0x4718('0xc')]('/',auth[_0x4718('0x8')](),controller[_0x4718('0xd')]);router['put'](_0x4718('0xa'),auth[_0x4718('0x8')](),controller['update']);router[_0x4718('0xe')]('/:id',auth[_0x4718('0x8')](),controller[_0x4718('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.attributes.js b/server/api/intDynamics365Field/intDynamics365Field.attributes.js index 08edf58..9b427a1 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 _0xd317=['customVariable','keyValue','picklist','string','STRING','BOOLEAN','sequelize','exports','ENUM','variable'];(function(_0x57e630,_0x42f4a8){var _0x391bf6=function(_0x2b5875){while(--_0x2b5875){_0x57e630['push'](_0x57e630['shift']());}};_0x391bf6(++_0x42f4a8);}(_0xd317,0x9c));var _0x7d31=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xd317[_0x160c73];return _0xd9302;};'use strict';var Sequelize=require(_0x7d31('0x0'));module[_0x7d31('0x1')]={'type':{'type':Sequelize[_0x7d31('0x2')]('string',_0x7d31('0x3'),_0x7d31('0x4'),_0x7d31('0x5'),_0x7d31('0x6')),'defaultValue':_0x7d31('0x7')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x7d31('0x8')]},'keyType':{'type':Sequelize['ENUM']('string','variable',_0x7d31('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0x7d31('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0x7d31('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x7d31('0x8')]}}; \ No newline at end of file +var _0xf6bb=['keyValue','picklist','STRING','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x598476,_0x3737e1){var _0x2c128e=function(_0x857627){while(--_0x857627){_0x598476['push'](_0x598476['shift']());}};_0x2c128e(++_0x3737e1);}(_0xf6bb,0x1d7));var _0xbf6b=function(_0x3b2369,_0x4c68b9){_0x3b2369=_0x3b2369-0x0;var _0x5a1367=_0xf6bb[_0x3b2369];return _0x5a1367;};'use strict';var Sequelize=require(_0xbf6b('0x0'));module[_0xbf6b('0x1')]={'type':{'type':Sequelize[_0xbf6b('0x2')](_0xbf6b('0x3'),_0xbf6b('0x4'),_0xbf6b('0x5'),_0xbf6b('0x6'),_0xbf6b('0x7')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xbf6b('0x2')](_0xbf6b('0x3'),_0xbf6b('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xbf6b('0x8')]},'idField':{'type':Sequelize[_0xbf6b('0x8')]},'nameField':{'type':Sequelize[_0xbf6b('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbf6b('0x8')]}}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.controller.js b/server/api/intDynamics365Field/intDynamics365Field.controller.js index c34e4f3..7237258 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 _0x9278=['count','set','Content-Range','save','update','then','destroy','end','error','stack','name','index','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','Dynamics365Field','findAll','catch','params','rawAttributes','length','find','create','body','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined'];(function(_0x3376e9,_0x537d51){var _0xa223cf=function(_0x315fcd){while(--_0x315fcd){_0x3376e9['push'](_0x3376e9['shift']());}};_0xa223cf(++_0x537d51);}(_0x9278,0x161));var _0x8927=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x9278[_0x59ee6f];return _0x4c0979;};'use strict';var emlformat=require(_0x8927('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8927('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8927('0x2'));var moment=require(_0x8927('0x3'));var BPromise=require(_0x8927('0x4'));var Mustache=require(_0x8927('0x5'));var util=require(_0x8927('0x6'));var path=require(_0x8927('0x7'));var sox=require(_0x8927('0x8'));var csv=require(_0x8927('0x9'));var ejs=require(_0x8927('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8927('0xb'));var squel=require(_0x8927('0xc'));var crypto=require(_0x8927('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8927('0xe'));var toCsv=require('to-csv');var querystring=require(_0x8927('0xf'));var Papa=require('papaparse');var Redis=require(_0x8927('0x10'));var authService=require(_0x8927('0x11'));var qs=require(_0x8927('0x12'));var as=require(_0x8927('0x13'));var hardwareService=require(_0x8927('0x14'));var logger=require(_0x8927('0x15'))(_0x8927('0x16'));var utils=require(_0x8927('0x17'));var config=require(_0x8927('0x18'));var licenseUtil=require(_0x8927('0x19'));var db=require(_0x8927('0x1a'))['db'];function respondWithStatusCode(_0x56958e,_0x335e59){_0x335e59=_0x335e59||0xcc;return function(_0x547beb){if(_0x547beb){return _0x56958e[_0x8927('0x1b')](_0x335e59);}return _0x56958e[_0x8927('0x1c')](_0x335e59)['end']();};}function respondWithResult(_0x4cb643,_0x344158){_0x344158=_0x344158||0xc8;return function(_0x276f65){if(_0x276f65){return _0x4cb643[_0x8927('0x1c')](_0x344158)[_0x8927('0x1d')](_0x276f65);}};}function respondWithFilteredResult(_0x22fd1c,_0x3bbc02){return function(_0x444697){if(_0x444697){var _0x4ed285=typeof _0x3bbc02[_0x8927('0x1e')]===_0x8927('0x1f')&&typeof _0x3bbc02['limit']==='undefined';var _0x3b2ad1=_0x444697[_0x8927('0x20')];var _0x2d9c97=_0x4ed285?0x0:_0x3bbc02[_0x8927('0x1e')];var _0x315cee=_0x4ed285?_0x444697[_0x8927('0x20')]:_0x3bbc02[_0x8927('0x1e')]+_0x3bbc02['limit'];var _0x2d1a7b;if(_0x315cee>=_0x3b2ad1){_0x315cee=_0x3b2ad1;_0x2d1a7b=0xc8;}else{_0x2d1a7b=0xce;}_0x22fd1c[_0x8927('0x1c')](_0x2d1a7b);return _0x22fd1c[_0x8927('0x21')](_0x8927('0x22'),_0x2d9c97+'-'+_0x315cee+'/'+_0x3b2ad1)['json'](_0x444697);}return null;};}function patchUpdates(_0x4f6c08){return function(_0x115944){try{jsonpatch['apply'](_0x115944,_0x4f6c08,!![]);}catch(_0x57d05e){return BPromise['reject'](_0x57d05e);}return _0x115944[_0x8927('0x23')]();};}function saveUpdates(_0x378ada,_0x6c88){return function(_0x25b64f){if(_0x25b64f){return _0x25b64f[_0x8927('0x24')](_0x378ada)[_0x8927('0x25')](function(_0x33e4e0){return _0x33e4e0;});}return null;};}function removeEntity(_0x5b0cec,_0x31e8a4){return function(_0x498ae1){if(_0x498ae1){return _0x498ae1[_0x8927('0x26')]()[_0x8927('0x25')](function(){_0x5b0cec['status'](0xcc)[_0x8927('0x27')]();});}};}function handleEntityNotFound(_0x1857e7,_0x20f01b){return function(_0x4a1b28){if(!_0x4a1b28){_0x1857e7['sendStatus'](0x194);}return _0x4a1b28;};}function handleError(_0x22bc02,_0x51d759){_0x51d759=_0x51d759||0x1f4;return function(_0x45f034){logger[_0x8927('0x28')](_0x45f034[_0x8927('0x29')]);if(_0x45f034[_0x8927('0x2a')]){delete _0x45f034[_0x8927('0x2a')];}_0x22bc02[_0x8927('0x1c')](_0x51d759)['send'](_0x45f034);};}exports[_0x8927('0x2b')]=function(_0x527395,_0xdc7123){var _0x54bf22={},_0x35a849={},_0x286743={'count':0x0,'rows':[]};var _0x48cb50=_[_0x8927('0x2c')](db['Dynamics365Field']['rawAttributes'],function(_0x53aa77){return{'name':_0x53aa77[_0x8927('0x2d')],'type':_0x53aa77[_0x8927('0x2e')][_0x8927('0x2f')]};});_0x35a849[_0x8927('0x30')]=_[_0x8927('0x2c')](_0x48cb50,_0x8927('0x2a'));_0x35a849[_0x8927('0x31')]=_[_0x8927('0x32')](_0x527395[_0x8927('0x31')]);_0x35a849[_0x8927('0x33')]=_[_0x8927('0x34')](_0x35a849[_0x8927('0x30')],_0x35a849[_0x8927('0x31')]);_0x54bf22[_0x8927('0x35')]=_[_0x8927('0x34')](_0x35a849['model'],qs[_0x8927('0x36')](_0x527395[_0x8927('0x31')][_0x8927('0x36')]));_0x54bf22[_0x8927('0x35')]=_0x54bf22[_0x8927('0x35')]['length']?_0x54bf22['attributes']:_0x35a849[_0x8927('0x30')];if(!_0x527395[_0x8927('0x31')][_0x8927('0x37')](_0x8927('0x38'))){_0x54bf22[_0x8927('0x39')]=qs[_0x8927('0x39')](_0x527395[_0x8927('0x31')][_0x8927('0x39')]);_0x54bf22['offset']=qs[_0x8927('0x1e')](_0x527395[_0x8927('0x31')][_0x8927('0x1e')]);}_0x54bf22[_0x8927('0x3a')]=qs[_0x8927('0x3b')](_0x527395[_0x8927('0x31')][_0x8927('0x3b')]);_0x54bf22[_0x8927('0x3c')]=qs[_0x8927('0x33')](_[_0x8927('0x3d')](_0x527395[_0x8927('0x31')],_0x35a849[_0x8927('0x33')]),_0x48cb50);if(_0x527395[_0x8927('0x31')]['filter']){_0x54bf22['where']=_[_0x8927('0x3e')](_0x54bf22[_0x8927('0x3c')],{'$or':_[_0x8927('0x2c')](_0x48cb50,function(_0x125779){if(_0x125779['type']!==_0x8927('0x3f')){var _0x2f8c1f={};_0x2f8c1f[_0x125779[_0x8927('0x2a')]]={'$like':'%'+_0x527395['query'][_0x8927('0x40')]+'%'};return _0x2f8c1f;}})});}_0x54bf22=_[_0x8927('0x3e')]({},_0x54bf22,_0x527395[_0x8927('0x41')]);var _0x5ae402={'where':_0x54bf22[_0x8927('0x3c')]};return db['Dynamics365Field']['count'](_0x5ae402)[_0x8927('0x25')](function(_0x32a645){_0x286743[_0x8927('0x20')]=_0x32a645;if(_0x527395['query'][_0x8927('0x42')]){_0x54bf22[_0x8927('0x43')]=[{'all':!![]}];}return db[_0x8927('0x44')][_0x8927('0x45')](_0x54bf22);})[_0x8927('0x25')](function(_0xf4bef0){_0x286743['rows']=_0xf4bef0;return _0x286743;})[_0x8927('0x25')](respondWithFilteredResult(_0xdc7123,_0x54bf22))[_0x8927('0x46')](handleError(_0xdc7123,null));};exports['show']=function(_0xdfd78d,_0x27fbfb){var _0x25a97e={'raw':!![],'where':{'id':_0xdfd78d[_0x8927('0x47')]['id']}},_0x44c0de={};_0x44c0de[_0x8927('0x30')]=_[_0x8927('0x32')](db[_0x8927('0x44')][_0x8927('0x48')]);_0x44c0de[_0x8927('0x31')]=_[_0x8927('0x32')](_0xdfd78d['query']);_0x44c0de[_0x8927('0x33')]=_[_0x8927('0x34')](_0x44c0de['model'],_0x44c0de[_0x8927('0x31')]);_0x25a97e[_0x8927('0x35')]=_[_0x8927('0x34')](_0x44c0de['model'],qs[_0x8927('0x36')](_0xdfd78d[_0x8927('0x31')][_0x8927('0x36')]));_0x25a97e[_0x8927('0x35')]=_0x25a97e[_0x8927('0x35')][_0x8927('0x49')]?_0x25a97e['attributes']:_0x44c0de[_0x8927('0x30')];if(_0xdfd78d[_0x8927('0x31')][_0x8927('0x42')]){_0x25a97e[_0x8927('0x43')]=[{'all':!![]}];}_0x25a97e=_['merge']({},_0x25a97e,_0xdfd78d[_0x8927('0x41')]);return db[_0x8927('0x44')][_0x8927('0x4a')](_0x25a97e)[_0x8927('0x25')](handleEntityNotFound(_0x27fbfb,null))[_0x8927('0x25')](respondWithResult(_0x27fbfb,null))['catch'](handleError(_0x27fbfb,null));};exports[_0x8927('0x4b')]=function(_0x1ae11e,_0x3acf95){return db[_0x8927('0x44')]['create'](_0x1ae11e[_0x8927('0x4c')],{})[_0x8927('0x25')](respondWithResult(_0x3acf95,0xc9))['catch'](handleError(_0x3acf95,null));};exports[_0x8927('0x24')]=function(_0x15899c,_0xdbf1b){if(_0x15899c[_0x8927('0x4c')]['id']){delete _0x15899c[_0x8927('0x4c')]['id'];}return db['Dynamics365Field'][_0x8927('0x4a')]({'where':{'id':_0x15899c[_0x8927('0x47')]['id']}})[_0x8927('0x25')](handleEntityNotFound(_0xdbf1b,null))[_0x8927('0x25')](saveUpdates(_0x15899c[_0x8927('0x4c')],null))['then'](respondWithResult(_0xdbf1b,null))[_0x8927('0x46')](handleError(_0xdbf1b,null));};exports[_0x8927('0x26')]=function(_0x18598e,_0x55970f){return db['Dynamics365Field'][_0x8927('0x4a')]({'where':{'id':_0x18598e['params']['id']}})[_0x8927('0x25')](handleEntityNotFound(_0x55970f,null))[_0x8927('0x25')](removeEntity(_0x55970f,null))[_0x8927('0x46')](handleError(_0x55970f,null));}; \ No newline at end of file +var _0x7a03=['bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','end','error','stack','name','index','map','Dynamics365Field','rawAttributes','fieldName','key','model','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','merge','type','options','then','findAll','rows','catch','show','include','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise'];(function(_0x1bf809,_0x536f55){var _0x1caa4e=function(_0x9f9636){while(--_0x9f9636){_0x1bf809['push'](_0x1bf809['shift']());}};_0x1caa4e(++_0x536f55);}(_0x7a03,0x95));var _0x37a0=function(_0x8ae28e,_0x56d57f){_0x8ae28e=_0x8ae28e-0x0;var _0x50752b=_0x7a03[_0x8ae28e];return _0x50752b;};'use strict';var emlformat=require(_0x37a0('0x0'));var rimraf=require(_0x37a0('0x1'));var zipdir=require(_0x37a0('0x2'));var jsonpatch=require(_0x37a0('0x3'));var rp=require(_0x37a0('0x4'));var moment=require('moment');var BPromise=require(_0x37a0('0x5'));var Mustache=require(_0x37a0('0x6'));var util=require(_0x37a0('0x7'));var path=require(_0x37a0('0x8'));var sox=require(_0x37a0('0x9'));var csv=require('to-csv');var ejs=require(_0x37a0('0xa'));var fs=require('fs');var fs_extra=require(_0x37a0('0xb'));var _=require(_0x37a0('0xc'));var squel=require(_0x37a0('0xd'));var crypto=require('crypto');var jsforce=require(_0x37a0('0xe'));var deskjs=require(_0x37a0('0xf'));var toCsv=require('to-csv');var querystring=require(_0x37a0('0x10'));var Papa=require(_0x37a0('0x11'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x37a0('0x12'));var hardwareService=require(_0x37a0('0x13'));var logger=require(_0x37a0('0x14'))(_0x37a0('0x15'));var utils=require(_0x37a0('0x16'));var config=require(_0x37a0('0x17'));var licenseUtil=require(_0x37a0('0x18'));var db=require(_0x37a0('0x19'))['db'];function respondWithStatusCode(_0x302c88,_0x59752a){_0x59752a=_0x59752a||0xcc;return function(_0x5f2f2f){if(_0x5f2f2f){return _0x302c88[_0x37a0('0x1a')](_0x59752a);}return _0x302c88['status'](_0x59752a)['end']();};}function respondWithResult(_0x23a452,_0x98fa86){_0x98fa86=_0x98fa86||0xc8;return function(_0x370cce){if(_0x370cce){return _0x23a452[_0x37a0('0x1b')](_0x98fa86)['json'](_0x370cce);}};}function respondWithFilteredResult(_0x321981,_0x19a68c){return function(_0x494f6a){if(_0x494f6a){var _0x42826d=typeof _0x19a68c[_0x37a0('0x1c')]===_0x37a0('0x1d')&&typeof _0x19a68c[_0x37a0('0x1e')]==='undefined';var _0x5133ad=_0x494f6a[_0x37a0('0x1f')];var _0x325701=_0x42826d?0x0:_0x19a68c['offset'];var _0x34685c=_0x42826d?_0x494f6a['count']:_0x19a68c[_0x37a0('0x1c')]+_0x19a68c[_0x37a0('0x1e')];var _0x209125;if(_0x34685c>=_0x5133ad){_0x34685c=_0x5133ad;_0x209125=0xc8;}else{_0x209125=0xce;}_0x321981[_0x37a0('0x1b')](_0x209125);return _0x321981[_0x37a0('0x20')](_0x37a0('0x21'),_0x325701+'-'+_0x34685c+'/'+_0x5133ad)['json'](_0x494f6a);}return null;};}function patchUpdates(_0x520a3a){return function(_0x4ef804){try{jsonpatch[_0x37a0('0x22')](_0x4ef804,_0x520a3a,!![]);}catch(_0x13ff21){return BPromise[_0x37a0('0x23')](_0x13ff21);}return _0x4ef804[_0x37a0('0x24')]();};}function saveUpdates(_0x45cbdf,_0x586e16){return function(_0x1bc9bf){if(_0x1bc9bf){return _0x1bc9bf[_0x37a0('0x25')](_0x45cbdf)['then'](function(_0xb82c68){return _0xb82c68;});}return null;};}function removeEntity(_0x36baa9,_0x5476bd){return function(_0x3b977f){if(_0x3b977f){return _0x3b977f[_0x37a0('0x26')]()['then'](function(){_0x36baa9[_0x37a0('0x1b')](0xcc)[_0x37a0('0x27')]();});}};}function handleEntityNotFound(_0x29c6c5,_0x39f597){return function(_0x106832){if(!_0x106832){_0x29c6c5[_0x37a0('0x1a')](0x194);}return _0x106832;};}function handleError(_0xd10463,_0xe5f05f){_0xe5f05f=_0xe5f05f||0x1f4;return function(_0x21500c){logger[_0x37a0('0x28')](_0x21500c[_0x37a0('0x29')]);if(_0x21500c['name']){delete _0x21500c[_0x37a0('0x2a')];}_0xd10463[_0x37a0('0x1b')](_0xe5f05f)['send'](_0x21500c);};}exports[_0x37a0('0x2b')]=function(_0x6ac16a,_0x109bc5){var _0x57da13={},_0x3e9357={},_0x415f9f={'count':0x0,'rows':[]};var _0x3fa640=_[_0x37a0('0x2c')](db[_0x37a0('0x2d')][_0x37a0('0x2e')],function(_0x23ac3f){return{'name':_0x23ac3f[_0x37a0('0x2f')],'type':_0x23ac3f['type'][_0x37a0('0x30')]};});_0x3e9357[_0x37a0('0x31')]=_[_0x37a0('0x2c')](_0x3fa640,_0x37a0('0x2a'));_0x3e9357[_0x37a0('0x32')]=_[_0x37a0('0x33')](_0x6ac16a[_0x37a0('0x32')]);_0x3e9357['filters']=_['intersection'](_0x3e9357[_0x37a0('0x31')],_0x3e9357[_0x37a0('0x32')]);_0x57da13[_0x37a0('0x34')]=_[_0x37a0('0x35')](_0x3e9357[_0x37a0('0x31')],qs[_0x37a0('0x36')](_0x6ac16a['query'][_0x37a0('0x36')]));_0x57da13[_0x37a0('0x34')]=_0x57da13['attributes'][_0x37a0('0x37')]?_0x57da13[_0x37a0('0x34')]:_0x3e9357[_0x37a0('0x31')];if(!_0x6ac16a['query'][_0x37a0('0x38')](_0x37a0('0x39'))){_0x57da13[_0x37a0('0x1e')]=qs[_0x37a0('0x1e')](_0x6ac16a[_0x37a0('0x32')][_0x37a0('0x1e')]);_0x57da13[_0x37a0('0x1c')]=qs[_0x37a0('0x1c')](_0x6ac16a[_0x37a0('0x32')][_0x37a0('0x1c')]);}_0x57da13[_0x37a0('0x3a')]=qs['sort'](_0x6ac16a[_0x37a0('0x32')][_0x37a0('0x3b')]);_0x57da13[_0x37a0('0x3c')]=qs['filters'](_[_0x37a0('0x3d')](_0x6ac16a[_0x37a0('0x32')],_0x3e9357[_0x37a0('0x3e')]),_0x3fa640);if(_0x6ac16a['query'][_0x37a0('0x3f')]){_0x57da13[_0x37a0('0x3c')]=_[_0x37a0('0x40')](_0x57da13[_0x37a0('0x3c')],{'$or':_[_0x37a0('0x2c')](_0x3fa640,function(_0xbeaac7){if(_0xbeaac7[_0x37a0('0x41')]!=='VIRTUAL'){var _0x3f06b3={};_0x3f06b3[_0xbeaac7[_0x37a0('0x2a')]]={'$like':'%'+_0x6ac16a['query']['filter']+'%'};return _0x3f06b3;}})});}_0x57da13=_[_0x37a0('0x40')]({},_0x57da13,_0x6ac16a[_0x37a0('0x42')]);var _0x1b4d0b={'where':_0x57da13['where']};return db['Dynamics365Field'][_0x37a0('0x1f')](_0x1b4d0b)[_0x37a0('0x43')](function(_0xd6d1ea){_0x415f9f[_0x37a0('0x1f')]=_0xd6d1ea;if(_0x6ac16a[_0x37a0('0x32')]['includeAll']){_0x57da13['include']=[{'all':!![]}];}return db[_0x37a0('0x2d')][_0x37a0('0x44')](_0x57da13);})[_0x37a0('0x43')](function(_0x3048d0){_0x415f9f[_0x37a0('0x45')]=_0x3048d0;return _0x415f9f;})[_0x37a0('0x43')](respondWithFilteredResult(_0x109bc5,_0x57da13))[_0x37a0('0x46')](handleError(_0x109bc5,null));};exports[_0x37a0('0x47')]=function(_0x1f4ad1,_0x68f5c0){var _0x285dd9={'raw':!![],'where':{'id':_0x1f4ad1['params']['id']}},_0x3de84c={};_0x3de84c['model']=_['keys'](db[_0x37a0('0x2d')][_0x37a0('0x2e')]);_0x3de84c[_0x37a0('0x32')]=_[_0x37a0('0x33')](_0x1f4ad1['query']);_0x3de84c[_0x37a0('0x3e')]=_[_0x37a0('0x35')](_0x3de84c['model'],_0x3de84c[_0x37a0('0x32')]);_0x285dd9[_0x37a0('0x34')]=_[_0x37a0('0x35')](_0x3de84c[_0x37a0('0x31')],qs[_0x37a0('0x36')](_0x1f4ad1[_0x37a0('0x32')][_0x37a0('0x36')]));_0x285dd9['attributes']=_0x285dd9[_0x37a0('0x34')][_0x37a0('0x37')]?_0x285dd9[_0x37a0('0x34')]:_0x3de84c[_0x37a0('0x31')];if(_0x1f4ad1[_0x37a0('0x32')]['includeAll']){_0x285dd9[_0x37a0('0x48')]=[{'all':!![]}];}_0x285dd9=_[_0x37a0('0x40')]({},_0x285dd9,_0x1f4ad1['options']);return db[_0x37a0('0x2d')][_0x37a0('0x49')](_0x285dd9)[_0x37a0('0x43')](handleEntityNotFound(_0x68f5c0,null))['then'](respondWithResult(_0x68f5c0,null))[_0x37a0('0x46')](handleError(_0x68f5c0,null));};exports[_0x37a0('0x4a')]=function(_0x298637,_0x3d7acb){return db[_0x37a0('0x2d')][_0x37a0('0x4a')](_0x298637[_0x37a0('0x4b')],{})['then'](respondWithResult(_0x3d7acb,0xc9))[_0x37a0('0x46')](handleError(_0x3d7acb,null));};exports[_0x37a0('0x25')]=function(_0x5c14d5,_0x10fd4a){if(_0x5c14d5[_0x37a0('0x4b')]['id']){delete _0x5c14d5[_0x37a0('0x4b')]['id'];}return db[_0x37a0('0x2d')]['find']({'where':{'id':_0x5c14d5[_0x37a0('0x4c')]['id']}})[_0x37a0('0x43')](handleEntityNotFound(_0x10fd4a,null))[_0x37a0('0x43')](saveUpdates(_0x5c14d5[_0x37a0('0x4b')],null))['then'](respondWithResult(_0x10fd4a,null))['catch'](handleError(_0x10fd4a,null));};exports[_0x37a0('0x26')]=function(_0x9c96fb,_0x232eb8){return db[_0x37a0('0x2d')][_0x37a0('0x49')]({'where':{'id':_0x9c96fb[_0x37a0('0x4c')]['id']}})[_0x37a0('0x43')](handleEntityNotFound(_0x232eb8,null))[_0x37a0('0x43')](removeEntity(_0x232eb8,null))[_0x37a0('0x46')](handleError(_0x232eb8,null));}; \ No newline at end of file diff --git a/server/api/intDynamics365Field/intDynamics365Field.model.js b/server/api/intDynamics365Field/intDynamics365Field.model.js index a6ccdb9..1bd6a51 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 _0xf228=['path','rimraf','../../config/environment','exports','int_dynamics365_fields','idField','FieldId','lodash','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4678f6,_0x19e88c){var _0x3271e2=function(_0x1ad6a1){while(--_0x1ad6a1){_0x4678f6['push'](_0x4678f6['shift']());}};_0x3271e2(++_0x19e88c);}(_0xf228,0x1c7));var _0x8f22=function(_0x89402e,_0x2781f9){_0x89402e=_0x89402e-0x0;var _0x5b7955=_0xf228[_0x89402e];return _0x5b7955;};'use strict';var _=require(_0x8f22('0x0'));var util=require(_0x8f22('0x1'));var logger=require(_0x8f22('0x2'))(_0x8f22('0x3'));var moment=require(_0x8f22('0x4'));var BPromise=require(_0x8f22('0x5'));var rp=require(_0x8f22('0x6'));var fs=require('fs');var path=require(_0x8f22('0x7'));var rimraf=require(_0x8f22('0x8'));var config=require(_0x8f22('0x9'));var attributes=require('./intDynamics365Field.attributes');module[_0x8f22('0xa')]=function(_0x7314f9,_0x317555){return _0x7314f9['define']('Dynamics365Field',attributes,{'tableName':_0x8f22('0xb'),'paranoid':![],'indexes':[{'name':'dynamics365_unique_index','fields':[_0x8f22('0xc'),_0x8f22('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x5f7b=['int_dynamics365_fields','dynamics365_unique_index','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intDynamics365Field.attributes','exports','Dynamics365Field'];(function(_0x837c0d,_0x2631da){var _0x2f025b=function(_0x10fa93){while(--_0x10fa93){_0x837c0d['push'](_0x837c0d['shift']());}};_0x2f025b(++_0x2631da);}(_0x5f7b,0xe2));var _0xb5f7=function(_0x26462c,_0xd20a35){_0x26462c=_0x26462c-0x0;var _0x509a42=_0x5f7b[_0x26462c];return _0x509a42;};'use strict';var _=require(_0xb5f7('0x0'));var util=require(_0xb5f7('0x1'));var logger=require(_0xb5f7('0x2'))(_0xb5f7('0x3'));var moment=require(_0xb5f7('0x4'));var BPromise=require(_0xb5f7('0x5'));var rp=require(_0xb5f7('0x6'));var fs=require('fs');var path=require(_0xb5f7('0x7'));var rimraf=require(_0xb5f7('0x8'));var config=require('../../config/environment');var attributes=require(_0xb5f7('0x9'));module[_0xb5f7('0xa')]=function(_0x579bb7,_0x3fa2f4){return _0x579bb7['define'](_0xb5f7('0xb'),attributes,{'tableName':_0xb5f7('0xc'),'paranoid':![],'indexes':[{'name':_0xb5f7('0xd'),'fields':['idField','FieldId'],'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 7dd0d3f..69db616 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 _0x4451=['jayson/promise','client','http','then','request\x20sent','debug','stringify','error','Dynamics365Field,\x20%s,\x20%s','message','info','result','catch','lodash','moment','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x52a903,_0x3bab0f){var _0x14a58e=function(_0x325805){while(--_0x325805){_0x52a903['push'](_0x52a903['shift']());}};_0x14a58e(++_0x3bab0f);}(_0x4451,0x1ed));var _0x1445=function(_0x2630dd,_0x35e6b0){_0x2630dd=_0x2630dd-0x0;var _0x3a08ec=_0x4451[_0x2630dd];return _0x3a08ec;};'use strict';var _=require(_0x1445('0x0'));var util=require('util');var moment=require(_0x1445('0x1'));var BPromise=require(_0x1445('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1445('0x3'));var logger=require(_0x1445('0x4'))(_0x1445('0x5'));var config=require(_0x1445('0x6'));var jayson=require(_0x1445('0x7'));var client=jayson[_0x1445('0x8')][_0x1445('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x57fd23,_0xf7a015,_0x41dd94){return new BPromise(function(_0x18fdb8,_0x19df19){return client['request'](_0x57fd23,_0x41dd94)[_0x1445('0xa')](function(_0xadc1ac){logger['info']('Dynamics365Field,\x20%s,\x20%s',_0xf7a015,_0x1445('0xb'));logger[_0x1445('0xc')]('Dynamics365Field,\x20%s,\x20%s,\x20%s',_0xf7a015,_0x1445('0xb'),JSON[_0x1445('0xd')](_0xadc1ac));if(_0xadc1ac['error']){if(_0xadc1ac[_0x1445('0xe')]['code']===0x1f4){logger[_0x1445('0xe')](_0x1445('0xf'),_0xf7a015,_0xadc1ac[_0x1445('0xe')]['message']);return _0x19df19(_0xadc1ac['error'][_0x1445('0x10')]);}logger['error'](_0x1445('0xf'),_0xf7a015,_0xadc1ac[_0x1445('0xe')][_0x1445('0x10')]);return _0x18fdb8(_0xadc1ac[_0x1445('0xe')][_0x1445('0x10')]);}else{logger[_0x1445('0x11')](_0x1445('0xf'),_0xf7a015,_0x1445('0xb'));_0x18fdb8(_0xadc1ac[_0x1445('0x12')][_0x1445('0x10')]);}})[_0x1445('0x13')](function(_0x59533d){logger[_0x1445('0xe')]('Dynamics365Field,\x20%s,\x20%s',_0xf7a015,_0x59533d);_0x19df19(_0x59533d);});});} \ No newline at end of file +var _0x2d4d=['../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','request','then','info','Dynamics365Field,\x20%s,\x20%s','request\x20sent','debug','Dynamics365Field,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','util','moment','randomstring','ioredis'];(function(_0x23ff18,_0x24a203){var _0x37f748=function(_0x5b25e5){while(--_0x5b25e5){_0x23ff18['push'](_0x23ff18['shift']());}};_0x37f748(++_0x24a203);}(_0x2d4d,0xce));var _0xd2d4=function(_0x221ca1,_0x9ab59b){_0x221ca1=_0x221ca1-0x0;var _0x5ddd74=_0x2d4d[_0x221ca1];return _0x5ddd74;};'use strict';var _=require('lodash');var util=require(_0xd2d4('0x0'));var moment=require(_0xd2d4('0x1'));var BPromise=require('bluebird');var rs=require(_0xd2d4('0x2'));var fs=require('fs');var Redis=require(_0xd2d4('0x3'));var db=require(_0xd2d4('0x4'))['db'];var utils=require(_0xd2d4('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xd2d4('0x6'));var jayson=require(_0xd2d4('0x7'));var client=jayson[_0xd2d4('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x30a1dc,_0x57554b,_0x4809a5){return new BPromise(function(_0x2f2bc3,_0x431cda){return client[_0xd2d4('0x9')](_0x30a1dc,_0x4809a5)[_0xd2d4('0xa')](function(_0x1f82c4){logger[_0xd2d4('0xb')](_0xd2d4('0xc'),_0x57554b,_0xd2d4('0xd'));logger[_0xd2d4('0xe')](_0xd2d4('0xf'),_0x57554b,'request\x20sent',JSON[_0xd2d4('0x10')](_0x1f82c4));if(_0x1f82c4[_0xd2d4('0x11')]){if(_0x1f82c4[_0xd2d4('0x11')][_0xd2d4('0x12')]===0x1f4){logger[_0xd2d4('0x11')](_0xd2d4('0xc'),_0x57554b,_0x1f82c4[_0xd2d4('0x11')][_0xd2d4('0x13')]);return _0x431cda(_0x1f82c4['error'][_0xd2d4('0x13')]);}logger[_0xd2d4('0x11')](_0xd2d4('0xc'),_0x57554b,_0x1f82c4[_0xd2d4('0x11')][_0xd2d4('0x13')]);return _0x2f2bc3(_0x1f82c4[_0xd2d4('0x11')][_0xd2d4('0x13')]);}else{logger[_0xd2d4('0xb')](_0xd2d4('0xc'),_0x57554b,_0xd2d4('0xd'));_0x2f2bc3(_0x1f82c4['result'][_0xd2d4('0x13')]);}})[_0xd2d4('0x14')](function(_0x1d402e){logger['error'](_0xd2d4('0xc'),_0x57554b,_0x1d402e);_0x431cda(_0x1d402e);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/index.js b/server/api/intFreshdeskAccount/index.js index 79d7e5a..eb14da8 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 _0xd4c6=['/:id/configurations','/:id/fields','getFields','create','addConfiguration','put','update','delete','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskAccount.controller','get','isAuthenticated','/:id'];(function(_0x3cb6dc,_0x120dd3){var _0x47ec89=function(_0x55150a){while(--_0x55150a){_0x3cb6dc['push'](_0x3cb6dc['shift']());}};_0x47ec89(++_0x120dd3);}(_0xd4c6,0x144));var _0x6d4c=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd4c6[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x6d4c('0x0'));var util=require('util');var path=require(_0x6d4c('0x1'));var timeout=require(_0x6d4c('0x2'));var express=require(_0x6d4c('0x3'));var router=express[_0x6d4c('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6d4c('0x5'));var interaction=require(_0x6d4c('0x6'));var config=require(_0x6d4c('0x7'));var controller=require(_0x6d4c('0x8'));router[_0x6d4c('0x9')]('/',auth[_0x6d4c('0xa')](),controller['index']);router[_0x6d4c('0x9')](_0x6d4c('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0x6d4c('0xc'),auth[_0x6d4c('0xa')](),controller['getConfigurations']);router[_0x6d4c('0x9')](_0x6d4c('0xd'),auth[_0x6d4c('0xa')](),controller[_0x6d4c('0xe')]);router['post']('/',auth[_0x6d4c('0xa')](),controller[_0x6d4c('0xf')]);router['post'](_0x6d4c('0xc'),auth[_0x6d4c('0xa')](),controller[_0x6d4c('0x10')]);router[_0x6d4c('0x11')](_0x6d4c('0xb'),auth[_0x6d4c('0xa')](),controller[_0x6d4c('0x12')]);router[_0x6d4c('0x13')](_0x6d4c('0xb'),auth[_0x6d4c('0xa')](),controller['destroy']);module[_0x6d4c('0x14')]=router; \ No newline at end of file +var _0x2459=['/:id/fields','getFields','post','create','addConfiguration','put','/:id','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','get','index','isAuthenticated','show','/:id/configurations','getConfigurations'];(function(_0x2c8cb8,_0x1dcedf){var _0x4eefc4=function(_0x2d4aad){while(--_0x2d4aad){_0x2c8cb8['push'](_0x2c8cb8['shift']());}};_0x4eefc4(++_0x1dcedf);}(_0x2459,0xfb));var _0x9245=function(_0x249e96,_0x3ea39d){_0x249e96=_0x249e96-0x0;var _0x17444c=_0x2459[_0x249e96];return _0x17444c;};'use strict';var multer=require('multer');var util=require(_0x9245('0x0'));var path=require(_0x9245('0x1'));var timeout=require(_0x9245('0x2'));var express=require(_0x9245('0x3'));var router=express[_0x9245('0x4')]();var fs_extra=require(_0x9245('0x5'));var auth=require(_0x9245('0x6'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intFreshdeskAccount.controller');router[_0x9245('0x7')]('/',auth['isAuthenticated'](),controller[_0x9245('0x8')]);router['get']('/:id',auth[_0x9245('0x9')](),controller[_0x9245('0xa')]);router['get'](_0x9245('0xb'),auth[_0x9245('0x9')](),controller[_0x9245('0xc')]);router[_0x9245('0x7')](_0x9245('0xd'),auth[_0x9245('0x9')](),controller[_0x9245('0xe')]);router[_0x9245('0xf')]('/',auth[_0x9245('0x9')](),controller[_0x9245('0x10')]);router['post'](_0x9245('0xb'),auth[_0x9245('0x9')](),controller[_0x9245('0x11')]);router[_0x9245('0x12')](_0x9245('0x13'),auth[_0x9245('0x9')](),controller[_0x9245('0x14')]);router[_0x9245('0x15')](_0x9245('0x13'),auth['isAuthenticated'](),controller[_0x9245('0x16')]);module[_0x9245('0x17')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.attributes.js index d11e843..9d7649f 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 _0xeb3b=['sequelize','exports','STRING'];(function(_0x53b53e,_0x498437){var _0xbb6179=function(_0x3975eb){while(--_0x3975eb){_0x53b53e['push'](_0x53b53e['shift']());}};_0xbb6179(++_0x498437);}(_0xeb3b,0x19e));var _0xbeb3=function(_0x4ea6af,_0x4aa32e){_0x4ea6af=_0x4ea6af-0x0;var _0x4cb1e6=_0xeb3b[_0x4ea6af];return _0x4cb1e6;};'use strict';var Sequelize=require(_0xbeb3('0x0'));module[_0xbeb3('0x1')]={'name':{'type':Sequelize[_0xbeb3('0x2')]},'description':{'type':Sequelize[_0xbeb3('0x2')]},'username':{'type':Sequelize[_0xbeb3('0x2')],'unique':'username'},'apiKey':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0xbeb3('0x2')],'unique':'remoteUri'},'serverUrl':{'type':Sequelize[_0xbeb3('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x0adf=['remoteUri','sequelize','exports','STRING','username'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x0adf,0x1d2));var _0xf0ad=function(_0x36cc56,_0x7b6fa){_0x36cc56=_0x36cc56-0x0;var _0x3271bd=_0x0adf[_0x36cc56];return _0x3271bd;};'use strict';var Sequelize=require(_0xf0ad('0x0'));module[_0xf0ad('0x1')]={'name':{'type':Sequelize[_0xf0ad('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0xf0ad('0x2')],'unique':_0xf0ad('0x3')},'apiKey':{'type':Sequelize[_0xf0ad('0x2')]},'remoteUri':{'type':Sequelize[_0xf0ad('0x2')],'unique':_0xf0ad('0x4')},'serverUrl':{'type':Sequelize[_0xf0ad('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 b86d2a2..f6ba4bf 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 _0x17d1=['set','json','apply','save','update','then','destroy','end','sendStatus','error','stack','name','send','index','map','FreshdeskAccount','rawAttributes','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','find','create','body','params','getConfigurations','findOne','FreshdeskConfiguration','addConfiguration','AccountId','Subjects','getSubjects','channel','getDescriptions','FreshdeskField','Descriptions','getFields','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s/%s','api/v2/ticket_fields','Basic\x20%s','%s:X','base64','requester','subject','agent','description','priority','group','source','company','includes','default','custom_text','choices','test','stringify','statusCode','eml-format','rimraf','request-promise','moment','util','path','sox','fs-extra','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','undefined','limit','offset'];(function(_0x340fc7,_0x12a901){var _0x586c93=function(_0xc3a679){while(--_0xc3a679){_0x340fc7['push'](_0x340fc7['shift']());}};_0x586c93(++_0x12a901);}(_0x17d1,0xc9));var _0x117d=function(_0x5d18e1,_0x5b54ae){_0x5d18e1=_0x5d18e1-0x0;var _0x3427d6=_0x17d1[_0x5d18e1];return _0x3427d6;};'use strict';var emlformat=require(_0x117d('0x0'));var rimraf=require(_0x117d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x117d('0x2'));var moment=require(_0x117d('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x117d('0x4'));var path=require(_0x117d('0x5'));var sox=require(_0x117d('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x117d('0x7'));var _=require('lodash');var squel=require(_0x117d('0x8'));var crypto=require(_0x117d('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x117d('0xa'));var toCsv=require(_0x117d('0xb'));var querystring=require(_0x117d('0xc'));var Papa=require(_0x117d('0xd'));var Redis=require(_0x117d('0xe'));var authService=require(_0x117d('0xf'));var qs=require(_0x117d('0x10'));var as=require(_0x117d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x117d('0x12'))(_0x117d('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x117d('0x14'));var db=require(_0x117d('0x15'))['db'];var integrations=require(_0x117d('0x16'));function respondWithStatusCode(_0x46ba04,_0x4e486d){_0x4e486d=_0x4e486d||0xcc;return function(_0x29b874){if(_0x29b874){return _0x46ba04['sendStatus'](_0x4e486d);}return _0x46ba04[_0x117d('0x17')](_0x4e486d)['end']();};}function respondWithResult(_0x322bd6,_0x2f8e6a){_0x2f8e6a=_0x2f8e6a||0xc8;return function(_0x363d13){if(_0x363d13){return _0x322bd6[_0x117d('0x17')](_0x2f8e6a)['json'](_0x363d13);}};}function respondWithFilteredResult(_0x3d7151,_0x47055e){return function(_0x24de6b){if(_0x24de6b){var _0x1be81c=typeof _0x47055e['offset']===_0x117d('0x18')&&typeof _0x47055e[_0x117d('0x19')]===_0x117d('0x18');var _0x1b487d=_0x24de6b['count'];var _0xaac8a4=_0x1be81c?0x0:_0x47055e['offset'];var _0x341dbe=_0x1be81c?_0x24de6b['count']:_0x47055e[_0x117d('0x1a')]+_0x47055e[_0x117d('0x19')];var _0x2adca2;if(_0x341dbe>=_0x1b487d){_0x341dbe=_0x1b487d;_0x2adca2=0xc8;}else{_0x2adca2=0xce;}_0x3d7151[_0x117d('0x17')](_0x2adca2);return _0x3d7151[_0x117d('0x1b')]('Content-Range',_0xaac8a4+'-'+_0x341dbe+'/'+_0x1b487d)[_0x117d('0x1c')](_0x24de6b);}return null;};}function patchUpdates(_0x1a816f){return function(_0x3e047e){try{jsonpatch[_0x117d('0x1d')](_0x3e047e,_0x1a816f,!![]);}catch(_0x385af8){return BPromise['reject'](_0x385af8);}return _0x3e047e[_0x117d('0x1e')]();};}function saveUpdates(_0x1def09,_0x512740){return function(_0x4f47ce){if(_0x4f47ce){return _0x4f47ce[_0x117d('0x1f')](_0x1def09)[_0x117d('0x20')](function(_0x4085d0){return _0x4085d0;});}return null;};}function removeEntity(_0x150cdf,_0x1fb841){return function(_0x460c06){if(_0x460c06){return _0x460c06[_0x117d('0x21')]()[_0x117d('0x20')](function(){_0x150cdf['status'](0xcc)[_0x117d('0x22')]();});}};}function handleEntityNotFound(_0x4cd194,_0x1cfc01){return function(_0x20915c){if(!_0x20915c){_0x4cd194[_0x117d('0x23')](0x194);}return _0x20915c;};}function handleError(_0x3d1722,_0x7aa4e3){_0x7aa4e3=_0x7aa4e3||0x1f4;return function(_0x5b95c6){logger[_0x117d('0x24')](_0x5b95c6[_0x117d('0x25')]);if(_0x5b95c6[_0x117d('0x26')]){delete _0x5b95c6[_0x117d('0x26')];}_0x3d1722[_0x117d('0x17')](_0x7aa4e3)[_0x117d('0x27')](_0x5b95c6);};}exports[_0x117d('0x28')]=function(_0x50f6b4,_0x27a526){var _0x2edd00={},_0x9bb65d={},_0x2f90fa={'count':0x0,'rows':[]};var _0x1cf52b=_[_0x117d('0x29')](db[_0x117d('0x2a')][_0x117d('0x2b')],function(_0x125055){return{'name':_0x125055['fieldName'],'type':_0x125055['type'][_0x117d('0x2c')]};});_0x9bb65d[_0x117d('0x2d')]=_[_0x117d('0x29')](_0x1cf52b,_0x117d('0x26'));_0x9bb65d[_0x117d('0x2e')]=_[_0x117d('0x2f')](_0x50f6b4['query']);_0x9bb65d[_0x117d('0x30')]=_[_0x117d('0x31')](_0x9bb65d[_0x117d('0x2d')],_0x9bb65d['query']);_0x2edd00[_0x117d('0x32')]=_[_0x117d('0x31')](_0x9bb65d[_0x117d('0x2d')],qs[_0x117d('0x33')](_0x50f6b4[_0x117d('0x2e')]['fields']));_0x2edd00[_0x117d('0x32')]=_0x2edd00[_0x117d('0x32')][_0x117d('0x34')]?_0x2edd00[_0x117d('0x32')]:_0x9bb65d[_0x117d('0x2d')];if(!_0x50f6b4[_0x117d('0x2e')][_0x117d('0x35')](_0x117d('0x36'))){_0x2edd00[_0x117d('0x19')]=qs[_0x117d('0x19')](_0x50f6b4[_0x117d('0x2e')][_0x117d('0x19')]);_0x2edd00['offset']=qs[_0x117d('0x1a')](_0x50f6b4[_0x117d('0x2e')][_0x117d('0x1a')]);}_0x2edd00[_0x117d('0x37')]=qs['sort'](_0x50f6b4[_0x117d('0x2e')][_0x117d('0x38')]);_0x2edd00[_0x117d('0x39')]=qs[_0x117d('0x30')](_[_0x117d('0x3a')](_0x50f6b4['query'],_0x9bb65d[_0x117d('0x30')]),_0x1cf52b);if(_0x50f6b4[_0x117d('0x2e')][_0x117d('0x3b')]){_0x2edd00['where']=_['merge'](_0x2edd00[_0x117d('0x39')],{'$or':_[_0x117d('0x29')](_0x1cf52b,function(_0x787407){if(_0x787407[_0x117d('0x3c')]!==_0x117d('0x3d')){var _0x794d8d={};_0x794d8d[_0x787407['name']]={'$like':'%'+_0x50f6b4[_0x117d('0x2e')]['filter']+'%'};return _0x794d8d;}})});}_0x2edd00=_[_0x117d('0x3e')]({},_0x2edd00,_0x50f6b4[_0x117d('0x3f')]);var _0x38a986={'where':_0x2edd00[_0x117d('0x39')]};return db[_0x117d('0x2a')][_0x117d('0x40')](_0x38a986)[_0x117d('0x20')](function(_0x4179fc){_0x2f90fa[_0x117d('0x40')]=_0x4179fc;if(_0x50f6b4[_0x117d('0x2e')][_0x117d('0x41')]){_0x2edd00[_0x117d('0x42')]=[{'all':!![]}];}return db[_0x117d('0x2a')][_0x117d('0x43')](_0x2edd00);})[_0x117d('0x20')](function(_0x59cf25){_0x2f90fa[_0x117d('0x44')]=_0x59cf25;return _0x2f90fa;})[_0x117d('0x20')](respondWithFilteredResult(_0x27a526,_0x2edd00))[_0x117d('0x45')](handleError(_0x27a526,null));};exports[_0x117d('0x46')]=function(_0x2e9f7b,_0x232abb){var _0x405901={'raw':![],'where':{'id':_0x2e9f7b['params']['id']}},_0x145d41={};_0x145d41[_0x117d('0x2d')]=_[_0x117d('0x2f')](db['FreshdeskAccount'][_0x117d('0x2b')]);_0x145d41[_0x117d('0x2e')]=_[_0x117d('0x2f')](_0x2e9f7b[_0x117d('0x2e')]);_0x145d41[_0x117d('0x30')]=_[_0x117d('0x31')](_0x145d41[_0x117d('0x2d')],_0x145d41[_0x117d('0x2e')]);_0x405901[_0x117d('0x32')]=_['intersection'](_0x145d41[_0x117d('0x2d')],qs[_0x117d('0x33')](_0x2e9f7b['query']['fields']));_0x405901[_0x117d('0x32')]=_0x405901[_0x117d('0x32')][_0x117d('0x34')]?_0x405901[_0x117d('0x32')]:_0x145d41[_0x117d('0x2d')];if(_0x2e9f7b[_0x117d('0x2e')][_0x117d('0x41')]){_0x405901[_0x117d('0x42')]=[{'all':!![]}];}_0x405901=_[_0x117d('0x3e')]({},_0x405901,_0x2e9f7b[_0x117d('0x3f')]);return db[_0x117d('0x2a')][_0x117d('0x47')](_0x405901)[_0x117d('0x20')](handleEntityNotFound(_0x232abb,null))[_0x117d('0x20')](respondWithResult(_0x232abb,null))['catch'](handleError(_0x232abb,null));};exports['create']=function(_0xc7c49f,_0xf926e2){return db[_0x117d('0x2a')][_0x117d('0x48')](_0xc7c49f[_0x117d('0x49')],{})[_0x117d('0x20')](respondWithResult(_0xf926e2,0xc9))[_0x117d('0x45')](handleError(_0xf926e2,null));};exports[_0x117d('0x1f')]=function(_0x678640,_0x48e879){if(_0x678640[_0x117d('0x49')]['id']){delete _0x678640[_0x117d('0x49')]['id'];}return db[_0x117d('0x2a')][_0x117d('0x47')]({'where':{'id':_0x678640['params']['id']}})['then'](handleEntityNotFound(_0x48e879,null))[_0x117d('0x20')](saveUpdates(_0x678640[_0x117d('0x49')],null))['then'](respondWithResult(_0x48e879,null))[_0x117d('0x45')](handleError(_0x48e879,null));};exports[_0x117d('0x21')]=function(_0x1d127e,_0x2cdbe2){return db[_0x117d('0x2a')][_0x117d('0x47')]({'where':{'id':_0x1d127e[_0x117d('0x4a')]['id']}})[_0x117d('0x20')](handleEntityNotFound(_0x2cdbe2,null))['then'](removeEntity(_0x2cdbe2,null))['catch'](handleError(_0x2cdbe2,null));};exports[_0x117d('0x4b')]=function(_0x2d96dd,_0x5d541e,_0x7d0cf8){var _0xb936e={};var _0x4919d9={};var _0x15ca3f;var _0x44330c;return db['FreshdeskAccount'][_0x117d('0x4c')]({'where':{'id':_0x2d96dd[_0x117d('0x4a')]['id']}})[_0x117d('0x20')](handleEntityNotFound(_0x5d541e,null))[_0x117d('0x20')](function(_0xc92cd){if(_0xc92cd){_0x15ca3f=_0xc92cd;_0x4919d9[_0x117d('0x2d')]=_[_0x117d('0x2f')](db[_0x117d('0x4d')][_0x117d('0x2b')]);_0x4919d9[_0x117d('0x2e')]=_[_0x117d('0x2f')](_0x2d96dd[_0x117d('0x2e')]);_0x4919d9[_0x117d('0x30')]=_[_0x117d('0x31')](_0x4919d9['model'],_0x4919d9['query']);_0xb936e['attributes']=_[_0x117d('0x31')](_0x4919d9[_0x117d('0x2d')],qs[_0x117d('0x33')](_0x2d96dd[_0x117d('0x2e')][_0x117d('0x33')]));_0xb936e[_0x117d('0x32')]=_0xb936e[_0x117d('0x32')][_0x117d('0x34')]?_0xb936e[_0x117d('0x32')]:_0x4919d9[_0x117d('0x2d')];_0xb936e['order']=qs[_0x117d('0x38')](_0x2d96dd[_0x117d('0x2e')]['sort']);_0xb936e[_0x117d('0x39')]=qs['filters'](_[_0x117d('0x3a')](_0x2d96dd[_0x117d('0x2e')],_0x4919d9[_0x117d('0x30')]));if(_0x2d96dd[_0x117d('0x2e')]['filter']){_0xb936e['where']=_[_0x117d('0x3e')](_0xb936e[_0x117d('0x39')],{'$or':_[_0x117d('0x29')](_0xb936e[_0x117d('0x32')],function(_0x439c78){var _0x4223f5={};_0x4223f5[_0x439c78]={'$like':'%'+_0x2d96dd[_0x117d('0x2e')][_0x117d('0x3b')]+'%'};return _0x4223f5;})});}_0xb936e=_[_0x117d('0x3e')]({},_0xb936e,_0x2d96dd['options']);return _0x15ca3f[_0x117d('0x4b')](_0xb936e);}})['then'](function(_0x5d2aaa){if(_0x5d2aaa){_0x44330c=_0x5d2aaa[_0x117d('0x34')];if(!_0x2d96dd[_0x117d('0x2e')][_0x117d('0x35')]('nolimit')){_0xb936e[_0x117d('0x19')]=qs[_0x117d('0x19')](_0x2d96dd[_0x117d('0x2e')]['limit']);_0xb936e[_0x117d('0x1a')]=qs['offset'](_0x2d96dd[_0x117d('0x2e')]['offset']);}return _0x15ca3f['getConfigurations'](_0xb936e);}})['then'](function(_0x1eaef0){if(_0x1eaef0){return _0x1eaef0?{'count':_0x44330c,'rows':_0x1eaef0}:null;}})[_0x117d('0x20')](respondWithResult(_0x5d541e,null))[_0x117d('0x45')](handleError(_0x5d541e,null));};exports[_0x117d('0x4e')]=function(_0x474ee3,_0x50b903,_0x1a0c04){if(_0x474ee3[_0x117d('0x49')]['id']){delete _0x474ee3[_0x117d('0x49')]['id'];}return db[_0x117d('0x2a')][_0x117d('0x4c')]({'where':{'id':_0x474ee3['params']['id']}})[_0x117d('0x20')](handleEntityNotFound(_0x50b903,null))[_0x117d('0x20')](function(_0xe1e45){if(_0xe1e45){_0x474ee3[_0x117d('0x49')][_0x117d('0x4f')]=_0xe1e45['id'];_0x474ee3['body'][_0x117d('0x50')]=integrations[_0x117d('0x51')](_0x474ee3[_0x117d('0x49')][_0x117d('0x52')],_0x474ee3[_0x117d('0x49')][_0x117d('0x3c')]);_0x474ee3[_0x117d('0x49')]['Descriptions']=integrations[_0x117d('0x53')](_0x474ee3[_0x117d('0x49')][_0x117d('0x52')],_0x474ee3['body']['type']);return db[_0x117d('0x4d')]['create'](_0x474ee3[_0x117d('0x49')],{'include':[{'model':db[_0x117d('0x54')],'as':_0x117d('0x50')},{'model':db[_0x117d('0x54')],'as':_0x117d('0x55')}]});}return null;})['then'](respondWithResult(_0x50b903,null))[_0x117d('0x45')](handleError(_0x50b903,null));};exports[_0x117d('0x56')]=function(_0xd9cd9,_0x223c4e,_0x387a5e){var _0x4cd6d4='';return db['FreshdeskAccount']['findOne']({'where':{'id':_0xd9cd9[_0x117d('0x4a')]['id']},'attributes':['id',_0x117d('0x57'),_0x117d('0x58')]})['then'](handleEntityNotFound(_0x223c4e,null))['then'](function(_0x5c34a0){if(_0x5c34a0){_0x4cd6d4=_0x5c34a0['remoteUri'];var _0xdfdcff=_0x4cd6d4[_0x117d('0x59')](-0x1);if(_0xdfdcff==='/'){_0x4cd6d4=_0x4cd6d4[_0x117d('0x5a')](0x0,_0x4cd6d4[_0x117d('0x5b')](_0xdfdcff));}return rp({'method':_0x117d('0x5c'),'uri':util[_0x117d('0x5d')](_0x117d('0x5e'),_0x4cd6d4,_0x117d('0x5f')),'headers':{'Authorization':util[_0x117d('0x5d')](_0x117d('0x60'),new Buffer(util[_0x117d('0x5d')](_0x117d('0x61'),_0x5c34a0['apiKey']))['toString'](_0x117d('0x62')))},'json':!![]});}})['then'](function(_0x38d024){if(_0x38d024){var _0x3e9387=[_0x117d('0x63'),_0x117d('0x64'),_0x117d('0x65'),_0x117d('0x66'),_0x117d('0x17'),_0x117d('0x67'),_0x117d('0x68'),_0x117d('0x69'),'ticket_type',_0x117d('0x68'),_0x117d('0x6a')];_['remove'](_0x38d024,function(_0x566094){return _0x3e9387[_0x117d('0x6b')](_0x566094[_0x117d('0x26')])||!_0x566094[_0x117d('0x6c')]&&_0x566094[_0x117d('0x3c')]!==_0x117d('0x6d')&&_0x566094[_0x117d('0x3c')]!=='custom_dropdown';});return{'count':_0x38d024['length'],'rows':_['map'](_0x38d024,function(_0x27592d){return{'id':_0x27592d['name'],'name':_0x27592d['label'],'custom':!_0x27592d['default'],'options':_0x27592d['choices']?_[_0x117d('0x29')](_0x27592d[_0x117d('0x6e')],function(_0x211ed7){return{'name':_['capitalize'](_0x211ed7),'value':_0x211ed7};}):[]};})};}})['then'](respondWithResult(_0x223c4e,null))[_0x117d('0x45')](function(_0x113c0b){var _0x440fe4=_0xd9cd9[_0x117d('0x2e')][_0x117d('0x6f')]?0x1f4:_0x113c0b['statusCode']||0x1f4;logger['error']('getFields,\x20%s,\x20%s,\x20%s','getFields',_0x440fe4,JSON[_0x117d('0x70')](_0x113c0b));delete _0x113c0b['name'];if(_0x440fe4===0x191){_0x440fe4=0x190;}_0x223c4e['status'](_0x440fe4)[_0x117d('0x27')](_0xd9cd9['query'][_0x117d('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x113c0b[_0x117d('0x71')]}:_0x113c0b);});}; \ No newline at end of file +var _0x39cb=['json','offset','undefined','limit','count','set','Content-Range','apply','save','update','then','destroy','error','name','send','index','FreshdeskAccount','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','merge','map','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','findOne','FreshdeskConfiguration','order','getConfigurations','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshdeskField','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','api/v2/ticket_fields','Basic\x20%s','toString','base64','subject','agent','description','priority','group','source','ticket_type','remove','includes','default','custom_text','custom_dropdown','label','choices','capitalize','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','status'];(function(_0x8a93eb,_0x226507){var _0x213e0d=function(_0x38a0e0){while(--_0x38a0e0){_0x8a93eb['push'](_0x8a93eb['shift']());}};_0x213e0d(++_0x226507);}(_0x39cb,0x1bd));var _0xb39c=function(_0x42cae2,_0x284ef8){_0x42cae2=_0x42cae2-0x0;var _0x5f256f=_0x39cb[_0x42cae2];return _0x5f256f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb39c('0x0'));var zipdir=require(_0xb39c('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xb39c('0x2'));var moment=require(_0xb39c('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb39c('0x4'));var util=require(_0xb39c('0x5'));var path=require(_0xb39c('0x6'));var sox=require(_0xb39c('0x7'));var csv=require(_0xb39c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb39c('0x9'));var _=require(_0xb39c('0xa'));var squel=require(_0xb39c('0xb'));var crypto=require(_0xb39c('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xb39c('0x8'));var querystring=require(_0xb39c('0xd'));var Papa=require(_0xb39c('0xe'));var Redis=require(_0xb39c('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb39c('0x10'));var logger=require(_0xb39c('0x11'))(_0xb39c('0x12'));var utils=require(_0xb39c('0x13'));var config=require(_0xb39c('0x14'));var licenseUtil=require(_0xb39c('0x15'));var db=require(_0xb39c('0x16'))['db'];var integrations=require(_0xb39c('0x17'));function respondWithStatusCode(_0x51ff24,_0x31e07e){_0x31e07e=_0x31e07e||0xcc;return function(_0x468995){if(_0x468995){return _0x51ff24[_0xb39c('0x18')](_0x31e07e);}return _0x51ff24['status'](_0x31e07e)[_0xb39c('0x19')]();};}function respondWithResult(_0x40a6d3,_0x42a203){_0x42a203=_0x42a203||0xc8;return function(_0x386c80){if(_0x386c80){return _0x40a6d3[_0xb39c('0x1a')](_0x42a203)[_0xb39c('0x1b')](_0x386c80);}};}function respondWithFilteredResult(_0x8e9181,_0x5277ce){return function(_0x316c9b){if(_0x316c9b){var _0x3223f6=typeof _0x5277ce[_0xb39c('0x1c')]===_0xb39c('0x1d')&&typeof _0x5277ce[_0xb39c('0x1e')]===_0xb39c('0x1d');var _0x1a2f48=_0x316c9b[_0xb39c('0x1f')];var _0x35dade=_0x3223f6?0x0:_0x5277ce[_0xb39c('0x1c')];var _0x559ad6=_0x3223f6?_0x316c9b[_0xb39c('0x1f')]:_0x5277ce[_0xb39c('0x1c')]+_0x5277ce[_0xb39c('0x1e')];var _0x447352;if(_0x559ad6>=_0x1a2f48){_0x559ad6=_0x1a2f48;_0x447352=0xc8;}else{_0x447352=0xce;}_0x8e9181['status'](_0x447352);return _0x8e9181[_0xb39c('0x20')](_0xb39c('0x21'),_0x35dade+'-'+_0x559ad6+'/'+_0x1a2f48)['json'](_0x316c9b);}return null;};}function patchUpdates(_0x2d8e93){return function(_0x363e52){try{jsonpatch[_0xb39c('0x22')](_0x363e52,_0x2d8e93,!![]);}catch(_0x4ebfca){return BPromise['reject'](_0x4ebfca);}return _0x363e52[_0xb39c('0x23')]();};}function saveUpdates(_0x1a5b9d,_0x3c8dfd){return function(_0x5719e2){if(_0x5719e2){return _0x5719e2[_0xb39c('0x24')](_0x1a5b9d)[_0xb39c('0x25')](function(_0x1bb895){return _0x1bb895;});}return null;};}function removeEntity(_0x16f3b0,_0x3b03ed){return function(_0x4a32f6){if(_0x4a32f6){return _0x4a32f6[_0xb39c('0x26')]()[_0xb39c('0x25')](function(){_0x16f3b0['status'](0xcc)[_0xb39c('0x19')]();});}};}function handleEntityNotFound(_0x4492a4,_0x39116b){return function(_0x12be70){if(!_0x12be70){_0x4492a4[_0xb39c('0x18')](0x194);}return _0x12be70;};}function handleError(_0x5453a6,_0x23a2f1){_0x23a2f1=_0x23a2f1||0x1f4;return function(_0x299c27){logger[_0xb39c('0x27')](_0x299c27['stack']);if(_0x299c27[_0xb39c('0x28')]){delete _0x299c27[_0xb39c('0x28')];}_0x5453a6['status'](_0x23a2f1)[_0xb39c('0x29')](_0x299c27);};}exports[_0xb39c('0x2a')]=function(_0x328db1,_0x4e9672){var _0x714d20={},_0x45fed4={},_0x59172f={'count':0x0,'rows':[]};var _0x2bc742=_['map'](db[_0xb39c('0x2b')][_0xb39c('0x2c')],function(_0x309697){return{'name':_0x309697[_0xb39c('0x2d')],'type':_0x309697[_0xb39c('0x2e')]['key']};});_0x45fed4[_0xb39c('0x2f')]=_['map'](_0x2bc742,_0xb39c('0x28'));_0x45fed4['query']=_[_0xb39c('0x30')](_0x328db1[_0xb39c('0x31')]);_0x45fed4[_0xb39c('0x32')]=_[_0xb39c('0x33')](_0x45fed4['model'],_0x45fed4['query']);_0x714d20[_0xb39c('0x34')]=_[_0xb39c('0x33')](_0x45fed4['model'],qs[_0xb39c('0x35')](_0x328db1[_0xb39c('0x31')][_0xb39c('0x35')]));_0x714d20[_0xb39c('0x34')]=_0x714d20[_0xb39c('0x34')][_0xb39c('0x36')]?_0x714d20[_0xb39c('0x34')]:_0x45fed4[_0xb39c('0x2f')];if(!_0x328db1[_0xb39c('0x31')][_0xb39c('0x37')](_0xb39c('0x38'))){_0x714d20[_0xb39c('0x1e')]=qs[_0xb39c('0x1e')](_0x328db1[_0xb39c('0x31')][_0xb39c('0x1e')]);_0x714d20[_0xb39c('0x1c')]=qs[_0xb39c('0x1c')](_0x328db1[_0xb39c('0x31')][_0xb39c('0x1c')]);}_0x714d20['order']=qs[_0xb39c('0x39')](_0x328db1[_0xb39c('0x31')]['sort']);_0x714d20['where']=qs['filters'](_[_0xb39c('0x3a')](_0x328db1[_0xb39c('0x31')],_0x45fed4[_0xb39c('0x32')]),_0x2bc742);if(_0x328db1['query'][_0xb39c('0x3b')]){_0x714d20[_0xb39c('0x3c')]=_[_0xb39c('0x3d')](_0x714d20[_0xb39c('0x3c')],{'$or':_[_0xb39c('0x3e')](_0x2bc742,function(_0x4b51ac){if(_0x4b51ac[_0xb39c('0x2e')]!==_0xb39c('0x3f')){var _0x51b489={};_0x51b489[_0x4b51ac[_0xb39c('0x28')]]={'$like':'%'+_0x328db1['query'][_0xb39c('0x3b')]+'%'};return _0x51b489;}})});}_0x714d20=_[_0xb39c('0x3d')]({},_0x714d20,_0x328db1[_0xb39c('0x40')]);var _0x4c043a={'where':_0x714d20[_0xb39c('0x3c')]};return db[_0xb39c('0x2b')][_0xb39c('0x1f')](_0x4c043a)[_0xb39c('0x25')](function(_0x10b87b){_0x59172f[_0xb39c('0x1f')]=_0x10b87b;if(_0x328db1[_0xb39c('0x31')][_0xb39c('0x41')]){_0x714d20[_0xb39c('0x42')]=[{'all':!![]}];}return db[_0xb39c('0x2b')][_0xb39c('0x43')](_0x714d20);})[_0xb39c('0x25')](function(_0x53347e){_0x59172f[_0xb39c('0x44')]=_0x53347e;return _0x59172f;})[_0xb39c('0x25')](respondWithFilteredResult(_0x4e9672,_0x714d20))[_0xb39c('0x45')](handleError(_0x4e9672,null));};exports[_0xb39c('0x46')]=function(_0x3d301e,_0x390cd7){var _0x1db549={'raw':![],'where':{'id':_0x3d301e[_0xb39c('0x47')]['id']}},_0x8cb33a={};_0x8cb33a['model']=_['keys'](db[_0xb39c('0x2b')][_0xb39c('0x2c')]);_0x8cb33a['query']=_['keys'](_0x3d301e[_0xb39c('0x31')]);_0x8cb33a['filters']=_[_0xb39c('0x33')](_0x8cb33a[_0xb39c('0x2f')],_0x8cb33a[_0xb39c('0x31')]);_0x1db549[_0xb39c('0x34')]=_[_0xb39c('0x33')](_0x8cb33a['model'],qs[_0xb39c('0x35')](_0x3d301e[_0xb39c('0x31')]['fields']));_0x1db549['attributes']=_0x1db549[_0xb39c('0x34')]['length']?_0x1db549['attributes']:_0x8cb33a[_0xb39c('0x2f')];if(_0x3d301e[_0xb39c('0x31')][_0xb39c('0x41')]){_0x1db549[_0xb39c('0x42')]=[{'all':!![]}];}_0x1db549=_[_0xb39c('0x3d')]({},_0x1db549,_0x3d301e[_0xb39c('0x40')]);return db[_0xb39c('0x2b')][_0xb39c('0x48')](_0x1db549)[_0xb39c('0x25')](handleEntityNotFound(_0x390cd7,null))[_0xb39c('0x25')](respondWithResult(_0x390cd7,null))['catch'](handleError(_0x390cd7,null));};exports[_0xb39c('0x49')]=function(_0x7e9750,_0xe329bf){return db[_0xb39c('0x2b')][_0xb39c('0x49')](_0x7e9750[_0xb39c('0x4a')],{})[_0xb39c('0x25')](respondWithResult(_0xe329bf,0xc9))[_0xb39c('0x45')](handleError(_0xe329bf,null));};exports[_0xb39c('0x24')]=function(_0x1ae2cb,_0x2150aa){if(_0x1ae2cb[_0xb39c('0x4a')]['id']){delete _0x1ae2cb[_0xb39c('0x4a')]['id'];}return db[_0xb39c('0x2b')][_0xb39c('0x48')]({'where':{'id':_0x1ae2cb[_0xb39c('0x47')]['id']}})['then'](handleEntityNotFound(_0x2150aa,null))[_0xb39c('0x25')](saveUpdates(_0x1ae2cb[_0xb39c('0x4a')],null))[_0xb39c('0x25')](respondWithResult(_0x2150aa,null))[_0xb39c('0x45')](handleError(_0x2150aa,null));};exports[_0xb39c('0x26')]=function(_0x18db8f,_0xd4f368){return db[_0xb39c('0x2b')]['find']({'where':{'id':_0x18db8f['params']['id']}})[_0xb39c('0x25')](handleEntityNotFound(_0xd4f368,null))[_0xb39c('0x25')](removeEntity(_0xd4f368,null))['catch'](handleError(_0xd4f368,null));};exports['getConfigurations']=function(_0x226f60,_0x1d1abf,_0x538258){var _0x2a55db={};var _0x55b6b1={};var _0x5e367e;var _0x2d88dd;return db['FreshdeskAccount'][_0xb39c('0x4b')]({'where':{'id':_0x226f60[_0xb39c('0x47')]['id']}})[_0xb39c('0x25')](handleEntityNotFound(_0x1d1abf,null))[_0xb39c('0x25')](function(_0x2f2944){if(_0x2f2944){_0x5e367e=_0x2f2944;_0x55b6b1[_0xb39c('0x2f')]=_['keys'](db[_0xb39c('0x4c')][_0xb39c('0x2c')]);_0x55b6b1[_0xb39c('0x31')]=_[_0xb39c('0x30')](_0x226f60[_0xb39c('0x31')]);_0x55b6b1['filters']=_[_0xb39c('0x33')](_0x55b6b1['model'],_0x55b6b1[_0xb39c('0x31')]);_0x2a55db[_0xb39c('0x34')]=_[_0xb39c('0x33')](_0x55b6b1[_0xb39c('0x2f')],qs[_0xb39c('0x35')](_0x226f60[_0xb39c('0x31')][_0xb39c('0x35')]));_0x2a55db[_0xb39c('0x34')]=_0x2a55db[_0xb39c('0x34')][_0xb39c('0x36')]?_0x2a55db[_0xb39c('0x34')]:_0x55b6b1[_0xb39c('0x2f')];_0x2a55db[_0xb39c('0x4d')]=qs[_0xb39c('0x39')](_0x226f60[_0xb39c('0x31')][_0xb39c('0x39')]);_0x2a55db[_0xb39c('0x3c')]=qs[_0xb39c('0x32')](_[_0xb39c('0x3a')](_0x226f60['query'],_0x55b6b1['filters']));if(_0x226f60[_0xb39c('0x31')][_0xb39c('0x3b')]){_0x2a55db['where']=_[_0xb39c('0x3d')](_0x2a55db[_0xb39c('0x3c')],{'$or':_['map'](_0x2a55db[_0xb39c('0x34')],function(_0x121545){var _0x129d1f={};_0x129d1f[_0x121545]={'$like':'%'+_0x226f60[_0xb39c('0x31')][_0xb39c('0x3b')]+'%'};return _0x129d1f;})});}_0x2a55db=_[_0xb39c('0x3d')]({},_0x2a55db,_0x226f60['options']);return _0x5e367e[_0xb39c('0x4e')](_0x2a55db);}})[_0xb39c('0x25')](function(_0x1c16c5){if(_0x1c16c5){_0x2d88dd=_0x1c16c5[_0xb39c('0x36')];if(!_0x226f60[_0xb39c('0x31')][_0xb39c('0x37')](_0xb39c('0x38'))){_0x2a55db['limit']=qs[_0xb39c('0x1e')](_0x226f60[_0xb39c('0x31')][_0xb39c('0x1e')]);_0x2a55db[_0xb39c('0x1c')]=qs[_0xb39c('0x1c')](_0x226f60['query']['offset']);}return _0x5e367e[_0xb39c('0x4e')](_0x2a55db);}})[_0xb39c('0x25')](function(_0x26b55f){if(_0x26b55f){return _0x26b55f?{'count':_0x2d88dd,'rows':_0x26b55f}:null;}})['then'](respondWithResult(_0x1d1abf,null))[_0xb39c('0x45')](handleError(_0x1d1abf,null));};exports['addConfiguration']=function(_0x2f3c24,_0x5ce5fb,_0x1abe57){if(_0x2f3c24[_0xb39c('0x4a')]['id']){delete _0x2f3c24[_0xb39c('0x4a')]['id'];}return db['FreshdeskAccount'][_0xb39c('0x4b')]({'where':{'id':_0x2f3c24[_0xb39c('0x47')]['id']}})[_0xb39c('0x25')](handleEntityNotFound(_0x5ce5fb,null))[_0xb39c('0x25')](function(_0x3e8783){if(_0x3e8783){_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x4f')]=_0x3e8783['id'];_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x50')]=integrations[_0xb39c('0x51')](_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x52')],_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x2e')]);_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x53')]=integrations[_0xb39c('0x54')](_0x2f3c24['body'][_0xb39c('0x52')],_0x2f3c24[_0xb39c('0x4a')][_0xb39c('0x2e')]);return db['FreshdeskConfiguration'][_0xb39c('0x49')](_0x2f3c24['body'],{'include':[{'model':db['FreshdeskField'],'as':_0xb39c('0x50')},{'model':db[_0xb39c('0x55')],'as':_0xb39c('0x53')}]});}return null;})[_0xb39c('0x25')](respondWithResult(_0x5ce5fb,null))[_0xb39c('0x45')](handleError(_0x5ce5fb,null));};exports['getFields']=function(_0x5de073,_0x26d08c,_0x27723c){var _0x5cfd2a='';return db[_0xb39c('0x2b')][_0xb39c('0x4b')]({'where':{'id':_0x5de073[_0xb39c('0x47')]['id']},'attributes':['id',_0xb39c('0x56'),_0xb39c('0x57')]})[_0xb39c('0x25')](handleEntityNotFound(_0x26d08c,null))[_0xb39c('0x25')](function(_0xfe586){if(_0xfe586){_0x5cfd2a=_0xfe586[_0xb39c('0x56')];var _0x2f7fc1=_0x5cfd2a[_0xb39c('0x58')](-0x1);if(_0x2f7fc1==='/'){_0x5cfd2a=_0x5cfd2a[_0xb39c('0x59')](0x0,_0x5cfd2a[_0xb39c('0x5a')](_0x2f7fc1));}return rp({'method':_0xb39c('0x5b'),'uri':util[_0xb39c('0x5c')]('%s/%s',_0x5cfd2a,_0xb39c('0x5d')),'headers':{'Authorization':util['format'](_0xb39c('0x5e'),new Buffer(util[_0xb39c('0x5c')]('%s:X',_0xfe586[_0xb39c('0x57')]))[_0xb39c('0x5f')](_0xb39c('0x60')))},'json':!![]});}})[_0xb39c('0x25')](function(_0x2021f0){if(_0x2021f0){var _0x382640=['requester',_0xb39c('0x61'),_0xb39c('0x62'),_0xb39c('0x63'),_0xb39c('0x1a'),_0xb39c('0x64'),_0xb39c('0x65'),_0xb39c('0x66'),_0xb39c('0x67'),_0xb39c('0x65'),'company'];_[_0xb39c('0x68')](_0x2021f0,function(_0x20610f){return _0x382640[_0xb39c('0x69')](_0x20610f[_0xb39c('0x28')])||!_0x20610f[_0xb39c('0x6a')]&&_0x20610f[_0xb39c('0x2e')]!==_0xb39c('0x6b')&&_0x20610f['type']!==_0xb39c('0x6c');});return{'count':_0x2021f0[_0xb39c('0x36')],'rows':_[_0xb39c('0x3e')](_0x2021f0,function(_0x205329){return{'id':_0x205329[_0xb39c('0x28')],'name':_0x205329[_0xb39c('0x6d')],'custom':!_0x205329[_0xb39c('0x6a')],'options':_0x205329[_0xb39c('0x6e')]?_['map'](_0x205329[_0xb39c('0x6e')],function(_0x52cb9d){return{'name':_[_0xb39c('0x6f')](_0x52cb9d),'value':_0x52cb9d};}):[]};})};}})[_0xb39c('0x25')](respondWithResult(_0x26d08c,null))[_0xb39c('0x45')](function(_0xeab93a){var _0x37f395=_0x5de073[_0xb39c('0x31')][_0xb39c('0x70')]?0x1f4:_0xeab93a[_0xb39c('0x71')]||0x1f4;logger['error'](_0xb39c('0x72'),_0xb39c('0x73'),_0x37f395,JSON[_0xb39c('0x74')](_0xeab93a));delete _0xeab93a[_0xb39c('0x28')];if(_0x37f395===0x191){_0x37f395=0x190;}_0x26d08c[_0xb39c('0x1a')](_0x37f395)[_0xb39c('0x29')](_0x5de073[_0xb39c('0x31')][_0xb39c('0x70')]?{'message':_0xb39c('0x75'),'statusCode':_0xeab93a[_0xb39c('0x71')]}:_0xeab93a);});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.model.js index ac02386..b19a7a4 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 _0x7b1f=['exports','lodash','../../config/logger','request-promise','path','rimraf','../../config/environment','../../components/integrations/configuration'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x7b1f,0xc1));var _0xf7b1=function(_0x32aa9f,_0x917afb){_0x32aa9f=_0x32aa9f-0x0;var _0x3514df=_0x7b1f[_0x32aa9f];return _0x3514df;};'use strict';var _=require(_0xf7b1('0x0'));var util=require('util');var logger=require(_0xf7b1('0x1'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xf7b1('0x2'));var fs=require('fs');var path=require(_0xf7b1('0x3'));var rimraf=require(_0xf7b1('0x4'));var config=require(_0xf7b1('0x5'));var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xf7b1('0x6'));module[_0xf7b1('0x7')]=function(_0x455796,_0x1c4628){return _0x455796['define']('FreshdeskAccount',attributes,{'tableName':'int_freshdesk_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x591d=['path','rimraf','../../components/integrations/configuration','exports','define','int_freshdesk_accounts','lodash','../../config/logger','moment','request-promise'];(function(_0x391681,_0x393892){var _0x3d86b0=function(_0x3af3e5){while(--_0x3af3e5){_0x391681['push'](_0x391681['shift']());}};_0x3d86b0(++_0x393892);}(_0x591d,0x13c));var _0xd591=function(_0x1a0016,_0x3d80e1){_0x1a0016=_0x1a0016-0x0;var _0x2945df=_0x591d[_0x1a0016];return _0x2945df;};'use strict';var _=require(_0xd591('0x0'));var util=require('util');var logger=require(_0xd591('0x1'))('api');var moment=require(_0xd591('0x2'));var BPromise=require('bluebird');var rp=require(_0xd591('0x3'));var fs=require('fs');var path=require(_0xd591('0x4'));var rimraf=require(_0xd591('0x5'));var config=require('../../config/environment');var attributes=require('./intFreshdeskAccount.attributes');var integrations=require(_0xd591('0x6'));module[_0xd591('0x7')]=function(_0x2eea4c,_0x2dfdd2){return _0x2eea4c[_0xd591('0x8')]('FreshdeskAccount',attributes,{'tableName':_0xd591('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js b/server/api/intFreshdeskAccount/intFreshdeskAccount.rpc.js index 1956d81..3e8aced 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 _0x3383=['error','code','message','info','result','catch','GetFreshdeskAccount','FreshdeskAccount','findAll','options','raw','where','limit','include','map','model','attributes','ShowFreshdeskAccount','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','FreshdeskAccount,\x20%s,\x20%s','request\x20sent','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x1f4a19,_0x35236f){var _0xb062e3=function(_0x5b16d0){while(--_0x5b16d0){_0x1f4a19['push'](_0x1f4a19['shift']());}};_0xb062e3(++_0x35236f);}(_0x3383,0x1b5));var _0x3338=function(_0x185567,_0x17db12){_0x185567=_0x185567-0x0;var _0x1e98e7=_0x3383[_0x185567];return _0x1e98e7;};'use strict';var _=require(_0x3338('0x0'));var util=require('util');var moment=require(_0x3338('0x1'));var BPromise=require(_0x3338('0x2'));var rs=require(_0x3338('0x3'));var fs=require('fs');var Redis=require(_0x3338('0x4'));var db=require(_0x3338('0x5'))['db'];var utils=require(_0x3338('0x6'));var logger=require(_0x3338('0x7'))(_0x3338('0x8'));var config=require(_0x3338('0x9'));var jayson=require(_0x3338('0xa'));var client=jayson['client'][_0x3338('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x238700,_0x8961c7,_0x34c0ef){return new BPromise(function(_0x1c6ead,_0x5b3b2b){return client[_0x3338('0xc')](_0x238700,_0x34c0ef)[_0x3338('0xd')](function(_0x577048){logger['info'](_0x3338('0xe'),_0x8961c7,_0x3338('0xf'));logger[_0x3338('0x10')](_0x3338('0x11'),_0x8961c7,_0x3338('0xf'),JSON[_0x3338('0x12')](_0x577048));if(_0x577048[_0x3338('0x13')]){if(_0x577048[_0x3338('0x13')][_0x3338('0x14')]===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x8961c7,_0x577048[_0x3338('0x13')]['message']);return _0x5b3b2b(_0x577048[_0x3338('0x13')][_0x3338('0x15')]);}logger['error'](_0x3338('0xe'),_0x8961c7,_0x577048['error'][_0x3338('0x15')]);return _0x1c6ead(_0x577048['error'][_0x3338('0x15')]);}else{logger[_0x3338('0x16')](_0x3338('0xe'),_0x8961c7,_0x3338('0xf'));_0x1c6ead(_0x577048[_0x3338('0x17')]['message']);}})[_0x3338('0x18')](function(_0xa729eb){logger[_0x3338('0x13')]('FreshdeskAccount,\x20%s,\x20%s',_0x8961c7,_0xa729eb);_0x5b3b2b(_0xa729eb);});});}exports[_0x3338('0x19')]=function(_0xc0b450){var _0xdbf352=this;return new Promise(function(_0x26b2ce,_0x2488a8){return db[_0x3338('0x1a')][_0x3338('0x1b')]({'raw':_0xc0b450[_0x3338('0x1c')]?_0xc0b450[_0x3338('0x1c')][_0x3338('0x1d')]===undefined?!![]:![]:!![],'where':_0xc0b450['options']?_0xc0b450[_0x3338('0x1c')][_0x3338('0x1e')]||null:null,'attributes':_0xc0b450['options']?_0xc0b450[_0x3338('0x1c')]['attributes']||null:null,'limit':_0xc0b450['options']?_0xc0b450[_0x3338('0x1c')][_0x3338('0x1f')]||null:null,'include':_0xc0b450[_0x3338('0x1c')]?_0xc0b450[_0x3338('0x1c')][_0x3338('0x20')]?_[_0x3338('0x21')](_0xc0b450[_0x3338('0x1c')][_0x3338('0x20')],function(_0x3a4ac3){return{'model':db[_0x3a4ac3[_0x3338('0x22')]],'as':_0x3a4ac3['as'],'attributes':_0x3a4ac3['attributes'],'include':_0x3a4ac3[_0x3338('0x20')]?_[_0x3338('0x21')](_0x3a4ac3['include'],function(_0x51026f){return{'model':db[_0x51026f[_0x3338('0x22')]],'as':_0x51026f['as'],'attributes':_0x51026f[_0x3338('0x23')],'include':_0x51026f[_0x3338('0x20')]?_['map'](_0x51026f[_0x3338('0x20')],function(_0x298aaa){return{'model':db[_0x298aaa[_0x3338('0x22')]],'as':_0x298aaa['as'],'attributes':_0x298aaa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x264102){logger['info']('GetFreshdeskAccount',_0xc0b450);logger[_0x3338('0x10')]('GetFreshdeskAccount',_0xc0b450,JSON[_0x3338('0x12')](_0x264102));_0x26b2ce(_0x264102);})['catch'](function(_0x141699){logger[_0x3338('0x13')]('GetFreshdeskAccount',_0x141699['message'],_0xc0b450);_0x2488a8(_0xdbf352['error'](0x1f4,_0x141699['message']));});});};exports[_0x3338('0x24')]=function(_0x2c1451){var _0x550341=this;return new Promise(function(_0x4dc143,_0x89054e){return db['FreshdeskAccount'][_0x3338('0x25')]({'raw':_0x2c1451['options']?_0x2c1451[_0x3338('0x1c')][_0x3338('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c1451['options']?_0x2c1451[_0x3338('0x1c')][_0x3338('0x1e')]||null:null,'attributes':_0x2c1451['options']?_0x2c1451[_0x3338('0x1c')][_0x3338('0x23')]||null:null,'include':_0x2c1451[_0x3338('0x1c')]?_0x2c1451[_0x3338('0x1c')][_0x3338('0x20')]?_['map'](_0x2c1451['options']['include'],function(_0x3a511a){return{'model':db[_0x3a511a[_0x3338('0x22')]],'as':_0x3a511a['as'],'attributes':_0x3a511a[_0x3338('0x23')],'include':_0x3a511a[_0x3338('0x20')]?_[_0x3338('0x21')](_0x3a511a[_0x3338('0x20')],function(_0x1939b6){return{'model':db[_0x1939b6[_0x3338('0x22')]],'as':_0x1939b6['as'],'attributes':_0x1939b6[_0x3338('0x23')],'include':_0x1939b6['include']?_[_0x3338('0x21')](_0x1939b6[_0x3338('0x20')],function(_0x29f089){return{'model':db[_0x29f089[_0x3338('0x22')]],'as':_0x29f089['as'],'attributes':_0x29f089['attributes']};}):[]};}):[]};}):[]:[]})[_0x3338('0xd')](function(_0x43dc8c){logger[_0x3338('0x16')](_0x3338('0x24'),_0x2c1451);logger['debug']('ShowFreshdeskAccount',_0x2c1451,JSON[_0x3338('0x12')](_0x43dc8c));_0x4dc143(_0x43dc8c);})[_0x3338('0x18')](function(_0x269c4a){logger['error'](_0x3338('0x24'),_0x269c4a['message'],_0x2c1451);_0x89054e(_0x550341['error'](0x1f4,_0x269c4a[_0x3338('0x15')]));});});}; \ No newline at end of file +var _0xef2d=['jayson/promise','client','http','request','info','FreshdeskAccount,\x20%s,\x20%s','debug','FreshdeskAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetFreshdeskAccount','findAll','options','where','attributes','include','map','model','ShowFreshdeskAccount','find','raw','then','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x2fd20e,_0x1ea545){var _0x1a0bb6=function(_0xc430e3){while(--_0xc430e3){_0x2fd20e['push'](_0x2fd20e['shift']());}};_0x1a0bb6(++_0x1ea545);}(_0xef2d,0xc3));var _0xdef2=function(_0x2879f2,_0x1c8292){_0x2879f2=_0x2879f2-0x0;var _0x2cd116=_0xef2d[_0x2879f2];return _0x2cd116;};'use strict';var _=require(_0xdef2('0x0'));var util=require(_0xdef2('0x1'));var moment=require(_0xdef2('0x2'));var BPromise=require(_0xdef2('0x3'));var rs=require(_0xdef2('0x4'));var fs=require('fs');var Redis=require(_0xdef2('0x5'));var db=require(_0xdef2('0x6'))['db'];var utils=require(_0xdef2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xdef2('0x8'));var jayson=require(_0xdef2('0x9'));var client=jayson[_0xdef2('0xa')][_0xdef2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x337924,_0x111fff,_0x4e7240){return new BPromise(function(_0x25dbb9,_0x5b3061){return client[_0xdef2('0xc')](_0x337924,_0x4e7240)['then'](function(_0x3818d3){logger[_0xdef2('0xd')](_0xdef2('0xe'),_0x111fff,'request\x20sent');logger[_0xdef2('0xf')](_0xdef2('0x10'),_0x111fff,'request\x20sent',JSON[_0xdef2('0x11')](_0x3818d3));if(_0x3818d3[_0xdef2('0x12')]){if(_0x3818d3[_0xdef2('0x12')]['code']===0x1f4){logger['error']('FreshdeskAccount,\x20%s,\x20%s',_0x111fff,_0x3818d3[_0xdef2('0x12')][_0xdef2('0x13')]);return _0x5b3061(_0x3818d3[_0xdef2('0x12')]['message']);}logger['error'](_0xdef2('0xe'),_0x111fff,_0x3818d3['error']['message']);return _0x25dbb9(_0x3818d3[_0xdef2('0x12')][_0xdef2('0x13')]);}else{logger[_0xdef2('0xd')](_0xdef2('0xe'),_0x111fff,'request\x20sent');_0x25dbb9(_0x3818d3[_0xdef2('0x14')][_0xdef2('0x13')]);}})[_0xdef2('0x15')](function(_0x4dd6d5){logger[_0xdef2('0x12')]('FreshdeskAccount,\x20%s,\x20%s',_0x111fff,_0x4dd6d5);_0x5b3061(_0x4dd6d5);});});}exports[_0xdef2('0x16')]=function(_0x208a38){var _0x3ddfed=this;return new Promise(function(_0x40f012,_0x505296){return db['FreshdeskAccount'][_0xdef2('0x17')]({'raw':_0x208a38[_0xdef2('0x18')]?_0x208a38[_0xdef2('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x208a38[_0xdef2('0x18')]?_0x208a38[_0xdef2('0x18')][_0xdef2('0x19')]||null:null,'attributes':_0x208a38[_0xdef2('0x18')]?_0x208a38['options'][_0xdef2('0x1a')]||null:null,'limit':_0x208a38[_0xdef2('0x18')]?_0x208a38[_0xdef2('0x18')]['limit']||null:null,'include':_0x208a38[_0xdef2('0x18')]?_0x208a38['options'][_0xdef2('0x1b')]?_[_0xdef2('0x1c')](_0x208a38['options']['include'],function(_0x4fc1fd){return{'model':db[_0x4fc1fd[_0xdef2('0x1d')]],'as':_0x4fc1fd['as'],'attributes':_0x4fc1fd[_0xdef2('0x1a')],'include':_0x4fc1fd['include']?_['map'](_0x4fc1fd[_0xdef2('0x1b')],function(_0x50499d){return{'model':db[_0x50499d[_0xdef2('0x1d')]],'as':_0x50499d['as'],'attributes':_0x50499d[_0xdef2('0x1a')],'include':_0x50499d[_0xdef2('0x1b')]?_[_0xdef2('0x1c')](_0x50499d['include'],function(_0x5cfba1){return{'model':db[_0x5cfba1[_0xdef2('0x1d')]],'as':_0x5cfba1['as'],'attributes':_0x5cfba1[_0xdef2('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3a63ad){logger[_0xdef2('0xd')](_0xdef2('0x16'),_0x208a38);logger['debug']('GetFreshdeskAccount',_0x208a38,JSON[_0xdef2('0x11')](_0x3a63ad));_0x40f012(_0x3a63ad);})['catch'](function(_0x11d0c7){logger[_0xdef2('0x12')](_0xdef2('0x16'),_0x11d0c7['message'],_0x208a38);_0x505296(_0x3ddfed['error'](0x1f4,_0x11d0c7[_0xdef2('0x13')]));});});};exports[_0xdef2('0x1e')]=function(_0x449507){var _0xf4bb31=this;return new Promise(function(_0x4dc37e,_0x43c8c7){return db['FreshdeskAccount'][_0xdef2('0x1f')]({'raw':_0x449507[_0xdef2('0x18')]?_0x449507[_0xdef2('0x18')][_0xdef2('0x20')]===undefined?!![]:![]:!![],'where':_0x449507[_0xdef2('0x18')]?_0x449507['options'][_0xdef2('0x19')]||null:null,'attributes':_0x449507[_0xdef2('0x18')]?_0x449507[_0xdef2('0x18')][_0xdef2('0x1a')]||null:null,'include':_0x449507[_0xdef2('0x18')]?_0x449507[_0xdef2('0x18')][_0xdef2('0x1b')]?_[_0xdef2('0x1c')](_0x449507['options'][_0xdef2('0x1b')],function(_0x437215){return{'model':db[_0x437215[_0xdef2('0x1d')]],'as':_0x437215['as'],'attributes':_0x437215['attributes'],'include':_0x437215[_0xdef2('0x1b')]?_[_0xdef2('0x1c')](_0x437215['include'],function(_0x510b77){return{'model':db[_0x510b77[_0xdef2('0x1d')]],'as':_0x510b77['as'],'attributes':_0x510b77[_0xdef2('0x1a')],'include':_0x510b77[_0xdef2('0x1b')]?_['map'](_0x510b77['include'],function(_0x5c8226){return{'model':db[_0x5c8226['model']],'as':_0x5c8226['as'],'attributes':_0x5c8226[_0xdef2('0x1a')]};}):[]};}):[]};}):[]:[]})[_0xdef2('0x21')](function(_0x4cec3b){logger[_0xdef2('0xd')](_0xdef2('0x1e'),_0x449507);logger[_0xdef2('0xf')](_0xdef2('0x1e'),_0x449507,JSON[_0xdef2('0x11')](_0x4cec3b));_0x4dc37e(_0x4cec3b);})[_0xdef2('0x15')](function(_0x532918){logger[_0xdef2('0x12')](_0xdef2('0x1e'),_0x532918['message'],_0x449507);_0x43c8c7(_0xf4bb31[_0xdef2('0x12')](0x1f4,_0x532918['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/index.js b/server/api/intFreshdeskConfiguration/index.js index 0f9e323..301595e 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 _0x3c09=['setTags','put','update','destroy','exports','multer','util','path','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','/:id/tags','getTags','post','create'];(function(_0x56482c,_0x16118d){var _0x5aae7a=function(_0x52512f){while(--_0x52512f){_0x56482c['push'](_0x56482c['shift']());}};_0x5aae7a(++_0x16118d);}(_0x3c09,0x82));var _0x93c0=function(_0x5b1795,_0x31cf65){_0x5b1795=_0x5b1795-0x0;var _0x45d8de=_0x3c09[_0x5b1795];return _0x45d8de;};'use strict';var multer=require(_0x93c0('0x0'));var util=require(_0x93c0('0x1'));var path=require(_0x93c0('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x93c0('0x3'));var auth=require(_0x93c0('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x93c0('0x5'));var controller=require(_0x93c0('0x6'));router['get']('/',auth[_0x93c0('0x7')](),controller[_0x93c0('0x8')]);router[_0x93c0('0x9')](_0x93c0('0xa'),auth[_0x93c0('0x7')](),controller['show']);router[_0x93c0('0x9')](_0x93c0('0xb'),auth[_0x93c0('0x7')](),controller[_0x93c0('0xc')]);router[_0x93c0('0x9')](_0x93c0('0xd'),auth[_0x93c0('0x7')](),controller['getSubjects']);router[_0x93c0('0x9')](_0x93c0('0xe'),auth[_0x93c0('0x7')](),controller[_0x93c0('0xf')]);router['get'](_0x93c0('0x10'),auth[_0x93c0('0x7')](),controller[_0x93c0('0x11')]);router[_0x93c0('0x12')]('/',auth[_0x93c0('0x7')](),controller[_0x93c0('0x13')]);router['post'](_0x93c0('0x10'),auth[_0x93c0('0x7')](),controller[_0x93c0('0x14')]);router[_0x93c0('0x15')](_0x93c0('0xa'),auth[_0x93c0('0x7')](),controller[_0x93c0('0x16')]);router['delete'](_0x93c0('0xa'),auth['isAuthenticated'](),controller[_0x93c0('0x17')]);module[_0x93c0('0x18')]=router; \ No newline at end of file +var _0x88a5=['update','exports','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intFreshdeskConfiguration.controller','isAuthenticated','index','get','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x88a5,0x7f));var _0x588a=function(_0x243b2f,_0x30aa15){_0x243b2f=_0x243b2f-0x0;var _0xcb3c2d=_0x88a5[_0x243b2f];return _0xcb3c2d;};'use strict';var multer=require(_0x588a('0x0'));var util=require(_0x588a('0x1'));var path=require(_0x588a('0x2'));var timeout=require(_0x588a('0x3'));var express=require(_0x588a('0x4'));var router=express['Router']();var fs_extra=require(_0x588a('0x5'));var auth=require(_0x588a('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x588a('0x7'));var controller=require(_0x588a('0x8'));router['get']('/',auth[_0x588a('0x9')](),controller[_0x588a('0xa')]);router[_0x588a('0xb')](_0x588a('0xc'),auth[_0x588a('0x9')](),controller[_0x588a('0xd')]);router[_0x588a('0xb')](_0x588a('0xe'),auth['isAuthenticated'](),controller['getFields']);router[_0x588a('0xb')](_0x588a('0xf'),auth['isAuthenticated'](),controller[_0x588a('0x10')]);router[_0x588a('0xb')](_0x588a('0x11'),auth[_0x588a('0x9')](),controller[_0x588a('0x12')]);router[_0x588a('0xb')]('/:id/tags',auth[_0x588a('0x9')](),controller[_0x588a('0x13')]);router[_0x588a('0x14')]('/',auth[_0x588a('0x9')](),controller[_0x588a('0x15')]);router[_0x588a('0x14')](_0x588a('0x16'),auth[_0x588a('0x9')](),controller['setTags']);router['put'](_0x588a('0xc'),auth[_0x588a('0x9')](),controller[_0x588a('0x17')]);router['delete']('/:id',auth[_0x588a('0x9')](),controller['destroy']);module[_0x588a('0x18')]=router; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.attributes.js index a08707a..2096405 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 _0xe7ce=['sequelize','STRING'];(function(_0x4da7e4,_0x23f4b1){var _0x3d78c9=function(_0x2c3015){while(--_0x2c3015){_0x4da7e4['push'](_0x4da7e4['shift']());}};_0x3d78c9(++_0x23f4b1);}(_0xe7ce,0x116));var _0xee7c=function(_0x3e6adf,_0x2e2232){_0x3e6adf=_0x3e6adf-0x0;var _0x28ad5f=_0xe7ce[_0x3e6adf];return _0x28ad5f;};'use strict';var Sequelize=require(_0xee7c('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xee7c('0x1')]}}; \ No newline at end of file +var _0x349a=['sequelize','exports','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x349a,0x1a1));var _0xa349=function(_0x20efe6,_0x2d6285){_0x20efe6=_0x20efe6-0x0;var _0x2680c2=_0x349a[_0x20efe6];return _0x2680c2;};'use strict';var Sequelize=require(_0xa349('0x0'));module[_0xa349('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xa349('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.controller.js index ae1d160..cf6e6f5 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 _0x398b=['query','keys','filters','intersection','attributes','fields','length','order','sort','where','merge','type','VIRTUAL','filter','options','FreshdeskConfiguration','includeAll','include','findAll','catch','show','params','create','body','find','destroy','getFields','findOne','FreshdeskField','hasOwnProperty','nolimit','getSubjects','pick','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','offset','count','limit','set','Content-Range','json','reject','save','update','then','stack','name','send','index','map','rawAttributes','fieldName','model'];(function(_0x6e1239,_0x3562ac){var _0x418150=function(_0x279f06){while(--_0x279f06){_0x6e1239['push'](_0x6e1239['shift']());}};_0x418150(++_0x3562ac);}(_0x398b,0x1b6));var _0xb398=function(_0x2d48fa,_0x103065){_0x2d48fa=_0x2d48fa-0x0;var _0x4645b7=_0x398b[_0x2d48fa];return _0x4645b7;};'use strict';var emlformat=require(_0xb398('0x0'));var rimraf=require(_0xb398('0x1'));var zipdir=require(_0xb398('0x2'));var jsonpatch=require(_0xb398('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xb398('0x4'));var Mustache=require(_0xb398('0x5'));var util=require('util');var path=require(_0xb398('0x6'));var sox=require(_0xb398('0x7'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb398('0x8'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xb398('0x9'));var jsforce=require(_0xb398('0xa'));var deskjs=require(_0xb398('0xb'));var toCsv=require(_0xb398('0xc'));var querystring=require('querystring');var Papa=require(_0xb398('0xd'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb398('0xe'));var as=require(_0xb398('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xb398('0x10'));var utils=require(_0xb398('0x11'));var config=require(_0xb398('0x12'));var licenseUtil=require(_0xb398('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x79e2ad,_0x3fcbd1){_0x3fcbd1=_0x3fcbd1||0xcc;return function(_0x4d01e9){if(_0x4d01e9){return _0x79e2ad[_0xb398('0x14')](_0x3fcbd1);}return _0x79e2ad[_0xb398('0x15')](_0x3fcbd1)[_0xb398('0x16')]();};}function respondWithResult(_0x22c72f,_0x5d53ff){_0x5d53ff=_0x5d53ff||0xc8;return function(_0x347305){if(_0x347305){return _0x22c72f['status'](_0x5d53ff)['json'](_0x347305);}};}function respondWithFilteredResult(_0x1abe86,_0x4e2a41){return function(_0x3d3413){if(_0x3d3413){var _0x570fbb=typeof _0x4e2a41['offset']===_0xb398('0x17')&&typeof _0x4e2a41['limit']===_0xb398('0x17');var _0x2f3517=_0x3d3413['count'];var _0x1ac750=_0x570fbb?0x0:_0x4e2a41[_0xb398('0x18')];var _0xbf5005=_0x570fbb?_0x3d3413[_0xb398('0x19')]:_0x4e2a41[_0xb398('0x18')]+_0x4e2a41[_0xb398('0x1a')];var _0x5913a0;if(_0xbf5005>=_0x2f3517){_0xbf5005=_0x2f3517;_0x5913a0=0xc8;}else{_0x5913a0=0xce;}_0x1abe86['status'](_0x5913a0);return _0x1abe86[_0xb398('0x1b')](_0xb398('0x1c'),_0x1ac750+'-'+_0xbf5005+'/'+_0x2f3517)[_0xb398('0x1d')](_0x3d3413);}return null;};}function patchUpdates(_0x3aad2b){return function(_0x368d97){try{jsonpatch['apply'](_0x368d97,_0x3aad2b,!![]);}catch(_0x515b71){return BPromise[_0xb398('0x1e')](_0x515b71);}return _0x368d97[_0xb398('0x1f')]();};}function saveUpdates(_0x52cfcc,_0x3541e4){return function(_0x44af5e){if(_0x44af5e){return _0x44af5e[_0xb398('0x20')](_0x52cfcc)[_0xb398('0x21')](function(_0x492dbb){return _0x492dbb;});}return null;};}function removeEntity(_0x2bbfe9,_0x4a930c){return function(_0x48b6e0){if(_0x48b6e0){return _0x48b6e0['destroy']()[_0xb398('0x21')](function(){_0x2bbfe9['status'](0xcc)[_0xb398('0x16')]();});}};}function handleEntityNotFound(_0x36d5f3,_0x361d10){return function(_0x3765a5){if(!_0x3765a5){_0x36d5f3[_0xb398('0x14')](0x194);}return _0x3765a5;};}function handleError(_0x452bd1,_0x38628b){_0x38628b=_0x38628b||0x1f4;return function(_0xf59af8){logger['error'](_0xf59af8[_0xb398('0x22')]);if(_0xf59af8[_0xb398('0x23')]){delete _0xf59af8[_0xb398('0x23')];}_0x452bd1['status'](_0x38628b)[_0xb398('0x24')](_0xf59af8);};}exports[_0xb398('0x25')]=function(_0xea819,_0x23221f){var _0x425cac={},_0x3cbc14={},_0x25a31e={'count':0x0,'rows':[]};var _0x4df9a8=_[_0xb398('0x26')](db['FreshdeskConfiguration'][_0xb398('0x27')],function(_0x3912e6){return{'name':_0x3912e6[_0xb398('0x28')],'type':_0x3912e6['type']['key']};});_0x3cbc14[_0xb398('0x29')]=_[_0xb398('0x26')](_0x4df9a8,_0xb398('0x23'));_0x3cbc14[_0xb398('0x2a')]=_[_0xb398('0x2b')](_0xea819[_0xb398('0x2a')]);_0x3cbc14[_0xb398('0x2c')]=_[_0xb398('0x2d')](_0x3cbc14['model'],_0x3cbc14[_0xb398('0x2a')]);_0x425cac[_0xb398('0x2e')]=_['intersection'](_0x3cbc14[_0xb398('0x29')],qs[_0xb398('0x2f')](_0xea819[_0xb398('0x2a')][_0xb398('0x2f')]));_0x425cac['attributes']=_0x425cac[_0xb398('0x2e')][_0xb398('0x30')]?_0x425cac[_0xb398('0x2e')]:_0x3cbc14[_0xb398('0x29')];if(!_0xea819[_0xb398('0x2a')]['hasOwnProperty']('nolimit')){_0x425cac[_0xb398('0x1a')]=qs['limit'](_0xea819[_0xb398('0x2a')]['limit']);_0x425cac[_0xb398('0x18')]=qs[_0xb398('0x18')](_0xea819[_0xb398('0x2a')]['offset']);}_0x425cac[_0xb398('0x31')]=qs[_0xb398('0x32')](_0xea819[_0xb398('0x2a')][_0xb398('0x32')]);_0x425cac[_0xb398('0x33')]=qs[_0xb398('0x2c')](_['pick'](_0xea819[_0xb398('0x2a')],_0x3cbc14[_0xb398('0x2c')]),_0x4df9a8);if(_0xea819[_0xb398('0x2a')]['filter']){_0x425cac[_0xb398('0x33')]=_[_0xb398('0x34')](_0x425cac['where'],{'$or':_[_0xb398('0x26')](_0x4df9a8,function(_0x167cd3){if(_0x167cd3[_0xb398('0x35')]!==_0xb398('0x36')){var _0x1dae69={};_0x1dae69[_0x167cd3[_0xb398('0x23')]]={'$like':'%'+_0xea819[_0xb398('0x2a')][_0xb398('0x37')]+'%'};return _0x1dae69;}})});}_0x425cac=_['merge']({},_0x425cac,_0xea819[_0xb398('0x38')]);var _0x2cf98f={'where':_0x425cac[_0xb398('0x33')]};return db[_0xb398('0x39')][_0xb398('0x19')](_0x2cf98f)['then'](function(_0x4663d1){_0x25a31e[_0xb398('0x19')]=_0x4663d1;if(_0xea819[_0xb398('0x2a')][_0xb398('0x3a')]){_0x425cac[_0xb398('0x3b')]=[{'all':!![]}];}return db[_0xb398('0x39')][_0xb398('0x3c')](_0x425cac);})['then'](function(_0x4d4ef7){_0x25a31e['rows']=_0x4d4ef7;return _0x25a31e;})[_0xb398('0x21')](respondWithFilteredResult(_0x23221f,_0x425cac))[_0xb398('0x3d')](handleError(_0x23221f,null));};exports[_0xb398('0x3e')]=function(_0x248676,_0x3c58dc){var _0x3f2c52={'raw':![],'where':{'id':_0x248676[_0xb398('0x3f')]['id']}},_0x49d5d9={};_0x49d5d9[_0xb398('0x29')]=_[_0xb398('0x2b')](db['FreshdeskConfiguration']['rawAttributes']);_0x49d5d9[_0xb398('0x2a')]=_[_0xb398('0x2b')](_0x248676[_0xb398('0x2a')]);_0x49d5d9[_0xb398('0x2c')]=_['intersection'](_0x49d5d9[_0xb398('0x29')],_0x49d5d9[_0xb398('0x2a')]);_0x3f2c52[_0xb398('0x2e')]=_[_0xb398('0x2d')](_0x49d5d9['model'],qs['fields'](_0x248676[_0xb398('0x2a')][_0xb398('0x2f')]));_0x3f2c52[_0xb398('0x2e')]=_0x3f2c52[_0xb398('0x2e')]['length']?_0x3f2c52[_0xb398('0x2e')]:_0x49d5d9['model'];if(_0x248676[_0xb398('0x2a')][_0xb398('0x3a')]){_0x3f2c52[_0xb398('0x3b')]=[{'all':!![]}];}_0x3f2c52=_[_0xb398('0x34')]({},_0x3f2c52,_0x248676[_0xb398('0x38')]);return db[_0xb398('0x39')]['find'](_0x3f2c52)[_0xb398('0x21')](handleEntityNotFound(_0x3c58dc,null))[_0xb398('0x21')](respondWithResult(_0x3c58dc,null))[_0xb398('0x3d')](handleError(_0x3c58dc,null));};exports['create']=function(_0x5e8001,_0x392606){return db[_0xb398('0x39')][_0xb398('0x40')](_0x5e8001[_0xb398('0x41')],{})[_0xb398('0x21')](respondWithResult(_0x392606,0xc9))[_0xb398('0x3d')](handleError(_0x392606,null));};exports[_0xb398('0x20')]=function(_0x409b81,_0x31f76e){if(_0x409b81[_0xb398('0x41')]['id']){delete _0x409b81[_0xb398('0x41')]['id'];}return db['FreshdeskConfiguration'][_0xb398('0x42')]({'where':{'id':_0x409b81[_0xb398('0x3f')]['id']}})[_0xb398('0x21')](handleEntityNotFound(_0x31f76e,null))[_0xb398('0x21')](saveUpdates(_0x409b81[_0xb398('0x41')],null))[_0xb398('0x21')](respondWithResult(_0x31f76e,null))[_0xb398('0x3d')](handleError(_0x31f76e,null));};exports[_0xb398('0x43')]=function(_0x3adf1f,_0x59ee37){return db[_0xb398('0x39')][_0xb398('0x42')]({'where':{'id':_0x3adf1f[_0xb398('0x3f')]['id']}})[_0xb398('0x21')](handleEntityNotFound(_0x59ee37,null))[_0xb398('0x21')](removeEntity(_0x59ee37,null))[_0xb398('0x3d')](handleError(_0x59ee37,null));};exports[_0xb398('0x44')]=function(_0x406bd0,_0x341ede,_0x5203c2){var _0x5dee42={};var _0x29b20c={};var _0x6960af;var _0x5ad750;return db['FreshdeskConfiguration'][_0xb398('0x45')]({'where':{'id':_0x406bd0[_0xb398('0x3f')]['id']}})[_0xb398('0x21')](handleEntityNotFound(_0x341ede,null))['then'](function(_0x71c774){if(_0x71c774){_0x6960af=_0x71c774;_0x29b20c[_0xb398('0x29')]=_[_0xb398('0x2b')](db[_0xb398('0x46')]['rawAttributes']);_0x29b20c[_0xb398('0x2a')]=_[_0xb398('0x2b')](_0x406bd0[_0xb398('0x2a')]);_0x29b20c[_0xb398('0x2c')]=_['intersection'](_0x29b20c[_0xb398('0x29')],_0x29b20c[_0xb398('0x2a')]);_0x5dee42[_0xb398('0x2e')]=_[_0xb398('0x2d')](_0x29b20c[_0xb398('0x29')],qs[_0xb398('0x2f')](_0x406bd0[_0xb398('0x2a')][_0xb398('0x2f')]));_0x5dee42[_0xb398('0x2e')]=_0x5dee42[_0xb398('0x2e')][_0xb398('0x30')]?_0x5dee42[_0xb398('0x2e')]:_0x29b20c[_0xb398('0x29')];_0x5dee42[_0xb398('0x31')]=qs[_0xb398('0x32')](_0x406bd0[_0xb398('0x2a')]['sort']);_0x5dee42['where']=qs[_0xb398('0x2c')](_['pick'](_0x406bd0[_0xb398('0x2a')],_0x29b20c[_0xb398('0x2c')]));if(_0x406bd0[_0xb398('0x2a')]['filter']){_0x5dee42['where']=_['merge'](_0x5dee42[_0xb398('0x33')],{'$or':_['map'](_0x5dee42[_0xb398('0x2e')],function(_0x3618c4){var _0x128286={};_0x128286[_0x3618c4]={'$like':'%'+_0x406bd0[_0xb398('0x2a')][_0xb398('0x37')]+'%'};return _0x128286;})});}_0x5dee42=_['merge']({},_0x5dee42,_0x406bd0[_0xb398('0x38')]);return _0x6960af[_0xb398('0x44')](_0x5dee42);}})[_0xb398('0x21')](function(_0x54d469){if(_0x54d469){_0x5ad750=_0x54d469[_0xb398('0x30')];if(!_0x406bd0[_0xb398('0x2a')][_0xb398('0x47')](_0xb398('0x48'))){_0x5dee42[_0xb398('0x1a')]=qs[_0xb398('0x1a')](_0x406bd0['query'][_0xb398('0x1a')]);_0x5dee42[_0xb398('0x18')]=qs[_0xb398('0x18')](_0x406bd0[_0xb398('0x2a')]['offset']);}return _0x6960af[_0xb398('0x44')](_0x5dee42);}})[_0xb398('0x21')](function(_0x358f3d){if(_0x358f3d){return _0x358f3d?{'count':_0x5ad750,'rows':_0x358f3d}:null;}})[_0xb398('0x21')](respondWithResult(_0x341ede,null))['catch'](handleError(_0x341ede,null));};exports[_0xb398('0x49')]=function(_0x51599b,_0x311b17,_0x4fda46){var _0x4c2472={};var _0x2f6f26={};var _0x503c1e;var _0x2477cd;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x51599b[_0xb398('0x3f')]['id']}})[_0xb398('0x21')](handleEntityNotFound(_0x311b17,null))[_0xb398('0x21')](function(_0x67e9ae){if(_0x67e9ae){_0x503c1e=_0x67e9ae;_0x2f6f26['model']=_[_0xb398('0x2b')](db[_0xb398('0x46')][_0xb398('0x27')]);_0x2f6f26[_0xb398('0x2a')]=_['keys'](_0x51599b[_0xb398('0x2a')]);_0x2f6f26[_0xb398('0x2c')]=_[_0xb398('0x2d')](_0x2f6f26[_0xb398('0x29')],_0x2f6f26[_0xb398('0x2a')]);_0x4c2472['attributes']=_['intersection'](_0x2f6f26['model'],qs[_0xb398('0x2f')](_0x51599b[_0xb398('0x2a')][_0xb398('0x2f')]));_0x4c2472[_0xb398('0x2e')]=_0x4c2472[_0xb398('0x2e')]['length']?_0x4c2472['attributes']:_0x2f6f26[_0xb398('0x29')];_0x4c2472['order']=qs[_0xb398('0x32')](_0x51599b[_0xb398('0x2a')][_0xb398('0x32')]);_0x4c2472['where']=qs[_0xb398('0x2c')](_[_0xb398('0x4a')](_0x51599b[_0xb398('0x2a')],_0x2f6f26['filters']));if(_0x51599b['query'][_0xb398('0x37')]){_0x4c2472[_0xb398('0x33')]=_['merge'](_0x4c2472[_0xb398('0x33')],{'$or':_[_0xb398('0x26')](_0x4c2472[_0xb398('0x2e')],function(_0x836e40){var _0x1a9c06={};_0x1a9c06[_0x836e40]={'$like':'%'+_0x51599b[_0xb398('0x2a')]['filter']+'%'};return _0x1a9c06;})});}_0x4c2472=_[_0xb398('0x34')]({},_0x4c2472,_0x51599b[_0xb398('0x38')]);return _0x503c1e[_0xb398('0x49')](_0x4c2472);}})['then'](function(_0x5e253d){if(_0x5e253d){_0x2477cd=_0x5e253d[_0xb398('0x30')];if(!_0x51599b[_0xb398('0x2a')][_0xb398('0x47')](_0xb398('0x48'))){_0x4c2472[_0xb398('0x1a')]=qs[_0xb398('0x1a')](_0x51599b['query'][_0xb398('0x1a')]);_0x4c2472['offset']=qs[_0xb398('0x18')](_0x51599b['query']['offset']);}return _0x503c1e[_0xb398('0x49')](_0x4c2472);}})[_0xb398('0x21')](function(_0x4ac0f5){if(_0x4ac0f5){return _0x4ac0f5?{'count':_0x2477cd,'rows':_0x4ac0f5}:null;}})[_0xb398('0x21')](respondWithResult(_0x311b17,null))[_0xb398('0x3d')](handleError(_0x311b17,null));};exports[_0xb398('0x4b')]=function(_0x861b44,_0x4e1204,_0x159221){var _0x49683d={};var _0x2b0b3e={};var _0x167ad8;var _0xb709f9;return db[_0xb398('0x39')][_0xb398('0x45')]({'where':{'id':_0x861b44[_0xb398('0x3f')]['id']}})['then'](handleEntityNotFound(_0x4e1204,null))[_0xb398('0x21')](function(_0x4bd810){if(_0x4bd810){_0x167ad8=_0x4bd810;_0x2b0b3e[_0xb398('0x29')]=_['keys'](db[_0xb398('0x46')][_0xb398('0x27')]);_0x2b0b3e['query']=_['keys'](_0x861b44[_0xb398('0x2a')]);_0x2b0b3e[_0xb398('0x2c')]=_['intersection'](_0x2b0b3e['model'],_0x2b0b3e['query']);_0x49683d[_0xb398('0x2e')]=_[_0xb398('0x2d')](_0x2b0b3e[_0xb398('0x29')],qs[_0xb398('0x2f')](_0x861b44['query']['fields']));_0x49683d[_0xb398('0x2e')]=_0x49683d[_0xb398('0x2e')]['length']?_0x49683d[_0xb398('0x2e')]:_0x2b0b3e[_0xb398('0x29')];_0x49683d['order']=qs[_0xb398('0x32')](_0x861b44['query']['sort']);_0x49683d['where']=qs[_0xb398('0x2c')](_[_0xb398('0x4a')](_0x861b44[_0xb398('0x2a')],_0x2b0b3e['filters']));if(_0x861b44[_0xb398('0x2a')][_0xb398('0x37')]){_0x49683d[_0xb398('0x33')]=_[_0xb398('0x34')](_0x49683d[_0xb398('0x33')],{'$or':_[_0xb398('0x26')](_0x49683d[_0xb398('0x2e')],function(_0x2c9175){var _0x467c29={};_0x467c29[_0x2c9175]={'$like':'%'+_0x861b44[_0xb398('0x2a')][_0xb398('0x37')]+'%'};return _0x467c29;})});}_0x49683d=_['merge']({},_0x49683d,_0x861b44['options']);return _0x167ad8[_0xb398('0x4b')](_0x49683d);}})[_0xb398('0x21')](function(_0x1793d7){if(_0x1793d7){_0xb709f9=_0x1793d7[_0xb398('0x30')];if(!_0x861b44[_0xb398('0x2a')][_0xb398('0x47')](_0xb398('0x48'))){_0x49683d[_0xb398('0x1a')]=qs[_0xb398('0x1a')](_0x861b44[_0xb398('0x2a')][_0xb398('0x1a')]);_0x49683d['offset']=qs['offset'](_0x861b44[_0xb398('0x2a')][_0xb398('0x18')]);}return _0x167ad8[_0xb398('0x4b')](_0x49683d);}})[_0xb398('0x21')](function(_0x1f5b9d){if(_0x1f5b9d){return _0x1f5b9d?{'count':_0xb709f9,'rows':_0x1f5b9d}:null;}})['then'](respondWithResult(_0x4e1204,null))[_0xb398('0x3d')](handleError(_0x4e1204,null));};exports[_0xb398('0x4c')]=function(_0x2f5a5a,_0x122814,_0x5305cc){var _0x24feda={};var _0x3acd96={};var _0x3efa1e;var _0x5cd292;return db[_0xb398('0x39')][_0xb398('0x45')]({'where':{'id':_0x2f5a5a[_0xb398('0x3f')]['id']}})['then'](handleEntityNotFound(_0x122814,null))['then'](function(_0x828d99){if(_0x828d99){_0x3efa1e=_0x828d99;_0x3acd96[_0xb398('0x29')]=_[_0xb398('0x2b')](db[_0xb398('0x4d')]['rawAttributes']);_0x3acd96[_0xb398('0x2a')]=_['keys'](_0x2f5a5a[_0xb398('0x2a')]);_0x3acd96['filters']=_[_0xb398('0x2d')](_0x3acd96[_0xb398('0x29')],_0x3acd96['query']);_0x24feda[_0xb398('0x2e')]=_['intersection'](_0x3acd96[_0xb398('0x29')],qs['fields'](_0x2f5a5a[_0xb398('0x2a')][_0xb398('0x2f')]));_0x24feda['attributes']=_0x24feda[_0xb398('0x2e')][_0xb398('0x30')]?_0x24feda[_0xb398('0x2e')]:_0x3acd96[_0xb398('0x29')];_0x24feda[_0xb398('0x31')]=qs['sort'](_0x2f5a5a[_0xb398('0x2a')][_0xb398('0x32')]);_0x24feda[_0xb398('0x33')]=qs[_0xb398('0x2c')](_['pick'](_0x2f5a5a[_0xb398('0x2a')],_0x3acd96[_0xb398('0x2c')]));if(_0x2f5a5a[_0xb398('0x2a')][_0xb398('0x37')]){_0x24feda['where']=_[_0xb398('0x34')](_0x24feda[_0xb398('0x33')],{'$or':_['map'](_0x24feda[_0xb398('0x2e')],function(_0x39a039){var _0x3381dc={};_0x3381dc[_0x39a039]={'$like':'%'+_0x2f5a5a[_0xb398('0x2a')][_0xb398('0x37')]+'%'};return _0x3381dc;})});}_0x24feda=_[_0xb398('0x34')]({},_0x24feda,_0x2f5a5a[_0xb398('0x38')]);return _0x3efa1e['getTags'](_0x24feda);}})[_0xb398('0x21')](function(_0x43b486){if(_0x43b486){_0x5cd292=_0x43b486[_0xb398('0x30')];if(!_0x2f5a5a[_0xb398('0x2a')][_0xb398('0x47')](_0xb398('0x48'))){_0x24feda['limit']=qs[_0xb398('0x1a')](_0x2f5a5a[_0xb398('0x2a')][_0xb398('0x1a')]);_0x24feda[_0xb398('0x18')]=qs['offset'](_0x2f5a5a[_0xb398('0x2a')]['offset']);}return _0x3efa1e[_0xb398('0x4c')](_0x24feda);}})[_0xb398('0x21')](function(_0x914b01){if(_0x914b01){return _0x914b01?{'count':_0x5cd292,'rows':_0x914b01}:null;}})[_0xb398('0x21')](respondWithResult(_0x122814,null))['catch'](handleError(_0x122814,null));};exports[_0xb398('0x4e')]=function(_0x3960e5,_0x1b4aba,_0x176e2b){if(_0x3960e5[_0xb398('0x41')]['id']){delete _0x3960e5[_0xb398('0x41')]['id'];}return db[_0xb398('0x39')][_0xb398('0x45')]({'where':{'id':_0x3960e5[_0xb398('0x3f')]['id']}})['then'](handleEntityNotFound(_0x1b4aba,null))[_0xb398('0x21')](function(_0xc673b3){if(_0xc673b3){return _0xc673b3['setTags'](_0x3960e5[_0xb398('0x41')][_0xb398('0x4f')]||[]);}return null;})[_0xb398('0x21')](respondWithResult(_0x1b4aba,null))['catch'](handleError(_0x1b4aba,null));}; \ No newline at end of file +var _0x53f6=['type','key','model','query','intersection','attributes','fields','length','order','sort','where','filters','pick','merge','filter','options','then','findAll','rows','catch','show','params','keys','includeAll','include','find','create','body','FreshdeskField','getFields','hasOwnProperty','nolimit','getSubjects','findOne','getDescriptions','getTags','setTags','ids','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','destroy','stack','name','send','index','map','FreshdeskConfiguration','rawAttributes','fieldName'];(function(_0x3b7fb0,_0x553e21){var _0x3b7fc5=function(_0x286bdc){while(--_0x286bdc){_0x3b7fb0['push'](_0x3b7fb0['shift']());}};_0x3b7fc5(++_0x553e21);}(_0x53f6,0x11c));var _0x653f=function(_0x3f8759,_0x3fe6fb){_0x3f8759=_0x3f8759-0x0;var _0x2d33ca=_0x53f6[_0x3f8759];return _0x2d33ca;};'use strict';var emlformat=require(_0x653f('0x0'));var rimraf=require(_0x653f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x653f('0x2'));var rp=require('request-promise');var moment=require(_0x653f('0x3'));var BPromise=require(_0x653f('0x4'));var Mustache=require(_0x653f('0x5'));var util=require('util');var path=require('path');var sox=require(_0x653f('0x6'));var csv=require(_0x653f('0x7'));var ejs=require(_0x653f('0x8'));var fs=require('fs');var fs_extra=require(_0x653f('0x9'));var _=require('lodash');var squel=require(_0x653f('0xa'));var crypto=require(_0x653f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x653f('0xc'));var toCsv=require(_0x653f('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x653f('0xd'));var authService=require('../../components/auth/service');var qs=require(_0x653f('0xe'));var as=require(_0x653f('0xf'));var hardwareService=require(_0x653f('0x10'));var logger=require('../../config/logger')(_0x653f('0x11'));var utils=require(_0x653f('0x12'));var config=require(_0x653f('0x13'));var licenseUtil=require(_0x653f('0x14'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x267d13,_0x17d38e){_0x17d38e=_0x17d38e||0xcc;return function(_0x59e0e2){if(_0x59e0e2){return _0x267d13[_0x653f('0x15')](_0x17d38e);}return _0x267d13[_0x653f('0x16')](_0x17d38e)[_0x653f('0x17')]();};}function respondWithResult(_0x309ec0,_0x4fc7fd){_0x4fc7fd=_0x4fc7fd||0xc8;return function(_0x13024b){if(_0x13024b){return _0x309ec0['status'](_0x4fc7fd)[_0x653f('0x18')](_0x13024b);}};}function respondWithFilteredResult(_0x4f9201,_0x73a8b9){return function(_0x3e844b){if(_0x3e844b){var _0x2050f5=typeof _0x73a8b9[_0x653f('0x19')]===_0x653f('0x1a')&&typeof _0x73a8b9['limit']==='undefined';var _0x375e12=_0x3e844b[_0x653f('0x1b')];var _0x3e2467=_0x2050f5?0x0:_0x73a8b9[_0x653f('0x19')];var _0x4ad114=_0x2050f5?_0x3e844b[_0x653f('0x1b')]:_0x73a8b9[_0x653f('0x19')]+_0x73a8b9[_0x653f('0x1c')];var _0xe1dac2;if(_0x4ad114>=_0x375e12){_0x4ad114=_0x375e12;_0xe1dac2=0xc8;}else{_0xe1dac2=0xce;}_0x4f9201[_0x653f('0x16')](_0xe1dac2);return _0x4f9201[_0x653f('0x1d')](_0x653f('0x1e'),_0x3e2467+'-'+_0x4ad114+'/'+_0x375e12)['json'](_0x3e844b);}return null;};}function patchUpdates(_0x3d2f15){return function(_0x41690d){try{jsonpatch[_0x653f('0x1f')](_0x41690d,_0x3d2f15,!![]);}catch(_0x3c5303){return BPromise[_0x653f('0x20')](_0x3c5303);}return _0x41690d[_0x653f('0x21')]();};}function saveUpdates(_0xc5af2e,_0x3ddac6){return function(_0x29d4dc){if(_0x29d4dc){return _0x29d4dc[_0x653f('0x22')](_0xc5af2e)['then'](function(_0x1a255d){return _0x1a255d;});}return null;};}function removeEntity(_0x5f072c,_0x3e8d43){return function(_0x8434ea){if(_0x8434ea){return _0x8434ea[_0x653f('0x23')]()['then'](function(){_0x5f072c[_0x653f('0x16')](0xcc)[_0x653f('0x17')]();});}};}function handleEntityNotFound(_0x23540c,_0x2d4a09){return function(_0x1b26e5){if(!_0x1b26e5){_0x23540c[_0x653f('0x15')](0x194);}return _0x1b26e5;};}function handleError(_0x456f63,_0x5c90cd){_0x5c90cd=_0x5c90cd||0x1f4;return function(_0x37e5a2){logger['error'](_0x37e5a2[_0x653f('0x24')]);if(_0x37e5a2['name']){delete _0x37e5a2[_0x653f('0x25')];}_0x456f63[_0x653f('0x16')](_0x5c90cd)[_0x653f('0x26')](_0x37e5a2);};}exports[_0x653f('0x27')]=function(_0x4f8d1f,_0x5da828){var _0x28e72d={},_0x446207={},_0x543f83={'count':0x0,'rows':[]};var _0x1dc0c8=_[_0x653f('0x28')](db[_0x653f('0x29')][_0x653f('0x2a')],function(_0x129eff){return{'name':_0x129eff[_0x653f('0x2b')],'type':_0x129eff[_0x653f('0x2c')][_0x653f('0x2d')]};});_0x446207[_0x653f('0x2e')]=_[_0x653f('0x28')](_0x1dc0c8,_0x653f('0x25'));_0x446207['query']=_['keys'](_0x4f8d1f[_0x653f('0x2f')]);_0x446207['filters']=_[_0x653f('0x30')](_0x446207[_0x653f('0x2e')],_0x446207[_0x653f('0x2f')]);_0x28e72d[_0x653f('0x31')]=_['intersection'](_0x446207['model'],qs[_0x653f('0x32')](_0x4f8d1f[_0x653f('0x2f')][_0x653f('0x32')]));_0x28e72d[_0x653f('0x31')]=_0x28e72d[_0x653f('0x31')][_0x653f('0x33')]?_0x28e72d['attributes']:_0x446207[_0x653f('0x2e')];if(!_0x4f8d1f[_0x653f('0x2f')]['hasOwnProperty']('nolimit')){_0x28e72d['limit']=qs[_0x653f('0x1c')](_0x4f8d1f['query'][_0x653f('0x1c')]);_0x28e72d[_0x653f('0x19')]=qs['offset'](_0x4f8d1f[_0x653f('0x2f')]['offset']);}_0x28e72d[_0x653f('0x34')]=qs['sort'](_0x4f8d1f['query'][_0x653f('0x35')]);_0x28e72d[_0x653f('0x36')]=qs[_0x653f('0x37')](_[_0x653f('0x38')](_0x4f8d1f['query'],_0x446207[_0x653f('0x37')]),_0x1dc0c8);if(_0x4f8d1f[_0x653f('0x2f')]['filter']){_0x28e72d[_0x653f('0x36')]=_[_0x653f('0x39')](_0x28e72d['where'],{'$or':_['map'](_0x1dc0c8,function(_0x427c80){if(_0x427c80[_0x653f('0x2c')]!=='VIRTUAL'){var _0xfc9b6e={};_0xfc9b6e[_0x427c80['name']]={'$like':'%'+_0x4f8d1f[_0x653f('0x2f')][_0x653f('0x3a')]+'%'};return _0xfc9b6e;}})});}_0x28e72d=_[_0x653f('0x39')]({},_0x28e72d,_0x4f8d1f[_0x653f('0x3b')]);var _0xe89432={'where':_0x28e72d[_0x653f('0x36')]};return db[_0x653f('0x29')]['count'](_0xe89432)[_0x653f('0x3c')](function(_0x124a9f){_0x543f83[_0x653f('0x1b')]=_0x124a9f;if(_0x4f8d1f[_0x653f('0x2f')]['includeAll']){_0x28e72d['include']=[{'all':!![]}];}return db[_0x653f('0x29')][_0x653f('0x3d')](_0x28e72d);})[_0x653f('0x3c')](function(_0x246297){_0x543f83[_0x653f('0x3e')]=_0x246297;return _0x543f83;})[_0x653f('0x3c')](respondWithFilteredResult(_0x5da828,_0x28e72d))[_0x653f('0x3f')](handleError(_0x5da828,null));};exports[_0x653f('0x40')]=function(_0x58eb92,_0x397cee){var _0x46f4f2={'raw':![],'where':{'id':_0x58eb92[_0x653f('0x41')]['id']}},_0x46c92f={};_0x46c92f[_0x653f('0x2e')]=_['keys'](db['FreshdeskConfiguration'][_0x653f('0x2a')]);_0x46c92f[_0x653f('0x2f')]=_[_0x653f('0x42')](_0x58eb92[_0x653f('0x2f')]);_0x46c92f[_0x653f('0x37')]=_[_0x653f('0x30')](_0x46c92f[_0x653f('0x2e')],_0x46c92f[_0x653f('0x2f')]);_0x46f4f2[_0x653f('0x31')]=_[_0x653f('0x30')](_0x46c92f[_0x653f('0x2e')],qs[_0x653f('0x32')](_0x58eb92[_0x653f('0x2f')][_0x653f('0x32')]));_0x46f4f2[_0x653f('0x31')]=_0x46f4f2[_0x653f('0x31')]['length']?_0x46f4f2[_0x653f('0x31')]:_0x46c92f[_0x653f('0x2e')];if(_0x58eb92['query'][_0x653f('0x43')]){_0x46f4f2[_0x653f('0x44')]=[{'all':!![]}];}_0x46f4f2=_[_0x653f('0x39')]({},_0x46f4f2,_0x58eb92[_0x653f('0x3b')]);return db[_0x653f('0x29')][_0x653f('0x45')](_0x46f4f2)[_0x653f('0x3c')](handleEntityNotFound(_0x397cee,null))[_0x653f('0x3c')](respondWithResult(_0x397cee,null))[_0x653f('0x3f')](handleError(_0x397cee,null));};exports['create']=function(_0xb8ac6b,_0x3f184b){return db['FreshdeskConfiguration'][_0x653f('0x46')](_0xb8ac6b[_0x653f('0x47')],{})['then'](respondWithResult(_0x3f184b,0xc9))[_0x653f('0x3f')](handleError(_0x3f184b,null));};exports['update']=function(_0x244da0,_0x132bbe){if(_0x244da0[_0x653f('0x47')]['id']){delete _0x244da0['body']['id'];}return db['FreshdeskConfiguration'][_0x653f('0x45')]({'where':{'id':_0x244da0[_0x653f('0x41')]['id']}})['then'](handleEntityNotFound(_0x132bbe,null))[_0x653f('0x3c')](saveUpdates(_0x244da0['body'],null))['then'](respondWithResult(_0x132bbe,null))[_0x653f('0x3f')](handleError(_0x132bbe,null));};exports[_0x653f('0x23')]=function(_0x1e9016,_0x47d1f5){return db[_0x653f('0x29')]['find']({'where':{'id':_0x1e9016[_0x653f('0x41')]['id']}})[_0x653f('0x3c')](handleEntityNotFound(_0x47d1f5,null))['then'](removeEntity(_0x47d1f5,null))[_0x653f('0x3f')](handleError(_0x47d1f5,null));};exports['getFields']=function(_0x17cf48,_0x44a232,_0x343ed8){var _0x1af451={};var _0x554cfd={};var _0x4139e3;var _0x481561;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x17cf48[_0x653f('0x41')]['id']}})[_0x653f('0x3c')](handleEntityNotFound(_0x44a232,null))['then'](function(_0x59e4e8){if(_0x59e4e8){_0x4139e3=_0x59e4e8;_0x554cfd[_0x653f('0x2e')]=_[_0x653f('0x42')](db[_0x653f('0x48')][_0x653f('0x2a')]);_0x554cfd[_0x653f('0x2f')]=_[_0x653f('0x42')](_0x17cf48[_0x653f('0x2f')]);_0x554cfd[_0x653f('0x37')]=_['intersection'](_0x554cfd[_0x653f('0x2e')],_0x554cfd[_0x653f('0x2f')]);_0x1af451['attributes']=_[_0x653f('0x30')](_0x554cfd['model'],qs[_0x653f('0x32')](_0x17cf48['query'][_0x653f('0x32')]));_0x1af451[_0x653f('0x31')]=_0x1af451[_0x653f('0x31')]['length']?_0x1af451[_0x653f('0x31')]:_0x554cfd[_0x653f('0x2e')];_0x1af451[_0x653f('0x34')]=qs[_0x653f('0x35')](_0x17cf48['query'][_0x653f('0x35')]);_0x1af451[_0x653f('0x36')]=qs[_0x653f('0x37')](_['pick'](_0x17cf48[_0x653f('0x2f')],_0x554cfd['filters']));if(_0x17cf48[_0x653f('0x2f')]['filter']){_0x1af451[_0x653f('0x36')]=_[_0x653f('0x39')](_0x1af451[_0x653f('0x36')],{'$or':_[_0x653f('0x28')](_0x1af451[_0x653f('0x31')],function(_0x246441){var _0x30e418={};_0x30e418[_0x246441]={'$like':'%'+_0x17cf48[_0x653f('0x2f')][_0x653f('0x3a')]+'%'};return _0x30e418;})});}_0x1af451=_[_0x653f('0x39')]({},_0x1af451,_0x17cf48[_0x653f('0x3b')]);return _0x4139e3[_0x653f('0x49')](_0x1af451);}})['then'](function(_0x5eafca){if(_0x5eafca){_0x481561=_0x5eafca['length'];if(!_0x17cf48['query'][_0x653f('0x4a')](_0x653f('0x4b'))){_0x1af451[_0x653f('0x1c')]=qs[_0x653f('0x1c')](_0x17cf48[_0x653f('0x2f')][_0x653f('0x1c')]);_0x1af451[_0x653f('0x19')]=qs[_0x653f('0x19')](_0x17cf48['query']['offset']);}return _0x4139e3[_0x653f('0x49')](_0x1af451);}})[_0x653f('0x3c')](function(_0x442dd3){if(_0x442dd3){return _0x442dd3?{'count':_0x481561,'rows':_0x442dd3}:null;}})[_0x653f('0x3c')](respondWithResult(_0x44a232,null))['catch'](handleError(_0x44a232,null));};exports[_0x653f('0x4c')]=function(_0x3f114a,_0x574732,_0x333694){var _0x472ae8={};var _0x1dd68c={};var _0x46cf05;var _0x15ce55;return db[_0x653f('0x29')][_0x653f('0x4d')]({'where':{'id':_0x3f114a[_0x653f('0x41')]['id']}})[_0x653f('0x3c')](handleEntityNotFound(_0x574732,null))['then'](function(_0x1e4d64){if(_0x1e4d64){_0x46cf05=_0x1e4d64;_0x1dd68c['model']=_[_0x653f('0x42')](db[_0x653f('0x48')][_0x653f('0x2a')]);_0x1dd68c[_0x653f('0x2f')]=_['keys'](_0x3f114a[_0x653f('0x2f')]);_0x1dd68c[_0x653f('0x37')]=_['intersection'](_0x1dd68c['model'],_0x1dd68c[_0x653f('0x2f')]);_0x472ae8['attributes']=_[_0x653f('0x30')](_0x1dd68c[_0x653f('0x2e')],qs['fields'](_0x3f114a[_0x653f('0x2f')][_0x653f('0x32')]));_0x472ae8['attributes']=_0x472ae8['attributes'][_0x653f('0x33')]?_0x472ae8['attributes']:_0x1dd68c[_0x653f('0x2e')];_0x472ae8['order']=qs['sort'](_0x3f114a['query'][_0x653f('0x35')]);_0x472ae8[_0x653f('0x36')]=qs[_0x653f('0x37')](_[_0x653f('0x38')](_0x3f114a[_0x653f('0x2f')],_0x1dd68c[_0x653f('0x37')]));if(_0x3f114a['query'][_0x653f('0x3a')]){_0x472ae8['where']=_[_0x653f('0x39')](_0x472ae8['where'],{'$or':_[_0x653f('0x28')](_0x472ae8[_0x653f('0x31')],function(_0x56c21d){var _0xb212e0={};_0xb212e0[_0x56c21d]={'$like':'%'+_0x3f114a['query'][_0x653f('0x3a')]+'%'};return _0xb212e0;})});}_0x472ae8=_[_0x653f('0x39')]({},_0x472ae8,_0x3f114a[_0x653f('0x3b')]);return _0x46cf05['getSubjects'](_0x472ae8);}})[_0x653f('0x3c')](function(_0x24611b){if(_0x24611b){_0x15ce55=_0x24611b[_0x653f('0x33')];if(!_0x3f114a[_0x653f('0x2f')]['hasOwnProperty'](_0x653f('0x4b'))){_0x472ae8[_0x653f('0x1c')]=qs[_0x653f('0x1c')](_0x3f114a['query']['limit']);_0x472ae8[_0x653f('0x19')]=qs[_0x653f('0x19')](_0x3f114a[_0x653f('0x2f')][_0x653f('0x19')]);}return _0x46cf05[_0x653f('0x4c')](_0x472ae8);}})[_0x653f('0x3c')](function(_0x24c26b){if(_0x24c26b){return _0x24c26b?{'count':_0x15ce55,'rows':_0x24c26b}:null;}})[_0x653f('0x3c')](respondWithResult(_0x574732,null))['catch'](handleError(_0x574732,null));};exports[_0x653f('0x4e')]=function(_0x121d36,_0x2af349,_0x5aa64b){var _0x2f2482={};var _0x20fbc0={};var _0x5c4d78;var _0x582621;return db['FreshdeskConfiguration']['findOne']({'where':{'id':_0x121d36[_0x653f('0x41')]['id']}})[_0x653f('0x3c')](handleEntityNotFound(_0x2af349,null))[_0x653f('0x3c')](function(_0x489a4a){if(_0x489a4a){_0x5c4d78=_0x489a4a;_0x20fbc0['model']=_[_0x653f('0x42')](db[_0x653f('0x48')][_0x653f('0x2a')]);_0x20fbc0['query']=_[_0x653f('0x42')](_0x121d36[_0x653f('0x2f')]);_0x20fbc0['filters']=_[_0x653f('0x30')](_0x20fbc0[_0x653f('0x2e')],_0x20fbc0[_0x653f('0x2f')]);_0x2f2482[_0x653f('0x31')]=_['intersection'](_0x20fbc0['model'],qs[_0x653f('0x32')](_0x121d36[_0x653f('0x2f')][_0x653f('0x32')]));_0x2f2482[_0x653f('0x31')]=_0x2f2482[_0x653f('0x31')][_0x653f('0x33')]?_0x2f2482[_0x653f('0x31')]:_0x20fbc0[_0x653f('0x2e')];_0x2f2482[_0x653f('0x34')]=qs[_0x653f('0x35')](_0x121d36['query']['sort']);_0x2f2482['where']=qs['filters'](_[_0x653f('0x38')](_0x121d36[_0x653f('0x2f')],_0x20fbc0[_0x653f('0x37')]));if(_0x121d36[_0x653f('0x2f')][_0x653f('0x3a')]){_0x2f2482['where']=_[_0x653f('0x39')](_0x2f2482[_0x653f('0x36')],{'$or':_[_0x653f('0x28')](_0x2f2482[_0x653f('0x31')],function(_0x3f8386){var _0x5404b0={};_0x5404b0[_0x3f8386]={'$like':'%'+_0x121d36[_0x653f('0x2f')]['filter']+'%'};return _0x5404b0;})});}_0x2f2482=_['merge']({},_0x2f2482,_0x121d36[_0x653f('0x3b')]);return _0x5c4d78[_0x653f('0x4e')](_0x2f2482);}})[_0x653f('0x3c')](function(_0xd693f9){if(_0xd693f9){_0x582621=_0xd693f9[_0x653f('0x33')];if(!_0x121d36[_0x653f('0x2f')][_0x653f('0x4a')](_0x653f('0x4b'))){_0x2f2482[_0x653f('0x1c')]=qs[_0x653f('0x1c')](_0x121d36[_0x653f('0x2f')]['limit']);_0x2f2482[_0x653f('0x19')]=qs[_0x653f('0x19')](_0x121d36[_0x653f('0x2f')][_0x653f('0x19')]);}return _0x5c4d78[_0x653f('0x4e')](_0x2f2482);}})[_0x653f('0x3c')](function(_0x338986){if(_0x338986){return _0x338986?{'count':_0x582621,'rows':_0x338986}:null;}})[_0x653f('0x3c')](respondWithResult(_0x2af349,null))[_0x653f('0x3f')](handleError(_0x2af349,null));};exports[_0x653f('0x4f')]=function(_0x261bbe,_0x2cbe94,_0x386745){var _0x174e99={};var _0x2588da={};var _0x33b155;var _0x2365e7;return db[_0x653f('0x29')][_0x653f('0x4d')]({'where':{'id':_0x261bbe['params']['id']}})[_0x653f('0x3c')](handleEntityNotFound(_0x2cbe94,null))[_0x653f('0x3c')](function(_0x5dcb39){if(_0x5dcb39){_0x33b155=_0x5dcb39;_0x2588da[_0x653f('0x2e')]=_[_0x653f('0x42')](db['Tag'][_0x653f('0x2a')]);_0x2588da[_0x653f('0x2f')]=_[_0x653f('0x42')](_0x261bbe['query']);_0x2588da['filters']=_[_0x653f('0x30')](_0x2588da[_0x653f('0x2e')],_0x2588da[_0x653f('0x2f')]);_0x174e99[_0x653f('0x31')]=_['intersection'](_0x2588da[_0x653f('0x2e')],qs[_0x653f('0x32')](_0x261bbe[_0x653f('0x2f')]['fields']));_0x174e99['attributes']=_0x174e99[_0x653f('0x31')][_0x653f('0x33')]?_0x174e99[_0x653f('0x31')]:_0x2588da[_0x653f('0x2e')];_0x174e99[_0x653f('0x34')]=qs[_0x653f('0x35')](_0x261bbe[_0x653f('0x2f')][_0x653f('0x35')]);_0x174e99['where']=qs[_0x653f('0x37')](_[_0x653f('0x38')](_0x261bbe['query'],_0x2588da['filters']));if(_0x261bbe[_0x653f('0x2f')][_0x653f('0x3a')]){_0x174e99[_0x653f('0x36')]=_[_0x653f('0x39')](_0x174e99['where'],{'$or':_[_0x653f('0x28')](_0x174e99['attributes'],function(_0x25c479){var _0x3616a5={};_0x3616a5[_0x25c479]={'$like':'%'+_0x261bbe['query'][_0x653f('0x3a')]+'%'};return _0x3616a5;})});}_0x174e99=_['merge']({},_0x174e99,_0x261bbe[_0x653f('0x3b')]);return _0x33b155['getTags'](_0x174e99);}})['then'](function(_0x16f477){if(_0x16f477){_0x2365e7=_0x16f477[_0x653f('0x33')];if(!_0x261bbe[_0x653f('0x2f')]['hasOwnProperty']('nolimit')){_0x174e99[_0x653f('0x1c')]=qs[_0x653f('0x1c')](_0x261bbe[_0x653f('0x2f')][_0x653f('0x1c')]);_0x174e99[_0x653f('0x19')]=qs[_0x653f('0x19')](_0x261bbe[_0x653f('0x2f')][_0x653f('0x19')]);}return _0x33b155['getTags'](_0x174e99);}})[_0x653f('0x3c')](function(_0x1e09b0){if(_0x1e09b0){return _0x1e09b0?{'count':_0x2365e7,'rows':_0x1e09b0}:null;}})['then'](respondWithResult(_0x2cbe94,null))[_0x653f('0x3f')](handleError(_0x2cbe94,null));};exports[_0x653f('0x50')]=function(_0x22f1bb,_0x529629,_0x5b6a2c){if(_0x22f1bb['body']['id']){delete _0x22f1bb[_0x653f('0x47')]['id'];}return db[_0x653f('0x29')][_0x653f('0x4d')]({'where':{'id':_0x22f1bb[_0x653f('0x41')]['id']}})[_0x653f('0x3c')](handleEntityNotFound(_0x529629,null))[_0x653f('0x3c')](function(_0x21832d){if(_0x21832d){return _0x21832d[_0x653f('0x50')](_0x22f1bb[_0x653f('0x47')][_0x653f('0x51')]||[]);}return null;})[_0x653f('0x3c')](respondWithResult(_0x529629,null))[_0x653f('0x3f')](handleError(_0x529629,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js b/server/api/intFreshdeskConfiguration/intFreshdeskConfiguration.model.js index d009e44..fed75a8 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 _0xbb10=['rimraf','../../config/environment','./intFreshdeskConfiguration.attributes','exports','define','FreshdeskConfiguration','lodash','../../config/logger','api','moment','request-promise','path'];(function(_0x5a55e6,_0x11b472){var _0xcefd7c=function(_0x1ede7a){while(--_0x1ede7a){_0x5a55e6['push'](_0x5a55e6['shift']());}};_0xcefd7c(++_0x11b472);}(_0xbb10,0x186));var _0x0bb1=function(_0x421b37,_0x444068){_0x421b37=_0x421b37-0x0;var _0x43369c=_0xbb10[_0x421b37];return _0x43369c;};'use strict';var _=require(_0x0bb1('0x0'));var util=require('util');var logger=require(_0x0bb1('0x1'))(_0x0bb1('0x2'));var moment=require(_0x0bb1('0x3'));var BPromise=require('bluebird');var rp=require(_0x0bb1('0x4'));var fs=require('fs');var path=require(_0x0bb1('0x5'));var rimraf=require(_0x0bb1('0x6'));var config=require(_0x0bb1('0x7'));var attributes=require(_0x0bb1('0x8'));module[_0x0bb1('0x9')]=function(_0x17bc46,_0x22e862){return _0x17bc46[_0x0bb1('0xa')](_0x0bb1('0xb'),attributes,{'tableName':'int_freshdesk_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1967=['moment','bluebird','path','exports','FreshdeskConfiguration','int_freshdesk_configurations','../../config/logger'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x1967,0xca));var _0x7196=function(_0x1c668f,_0x294095){_0x1c668f=_0x1c668f-0x0;var _0x11d726=_0x1967[_0x1c668f];return _0x11d726;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7196('0x0'))('api');var moment=require(_0x7196('0x1'));var BPromise=require(_0x7196('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7196('0x3'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshdeskConfiguration.attributes');module[_0x7196('0x4')]=function(_0x5e63b9,_0x1ec74d){return _0x5e63b9['define'](_0x7196('0x5'),attributes,{'tableName':_0x7196('0x6'),'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 65ca36b..6e8c7ff 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 _0xfdf9=['debug','FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent'];(function(_0x2fcdcf,_0x345cef){var _0x56aa71=function(_0x500482){while(--_0x500482){_0x2fcdcf['push'](_0x2fcdcf['shift']());}};_0x56aa71(++_0x345cef);}(_0xfdf9,0xa9));var _0x9fdf=function(_0x53ce90,_0x160161){_0x53ce90=_0x53ce90-0x0;var _0x2d3947=_0xfdf9[_0x53ce90];return _0x2d3947;};'use strict';var _=require(_0x9fdf('0x0'));var util=require(_0x9fdf('0x1'));var moment=require(_0x9fdf('0x2'));var BPromise=require('bluebird');var rs=require(_0x9fdf('0x3'));var fs=require('fs');var Redis=require(_0x9fdf('0x4'));var db=require(_0x9fdf('0x5'))['db'];var utils=require(_0x9fdf('0x6'));var logger=require(_0x9fdf('0x7'))('rpc');var config=require(_0x9fdf('0x8'));var jayson=require(_0x9fdf('0x9'));var client=jayson[_0x9fdf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x517b03,_0x47c18d,_0x3e2b83){return new BPromise(function(_0x1e43a,_0x493c31){return client[_0x9fdf('0xb')](_0x517b03,_0x3e2b83)['then'](function(_0x4d12c2){logger[_0x9fdf('0xc')](_0x9fdf('0xd'),_0x47c18d,_0x9fdf('0xe'));logger[_0x9fdf('0xf')](_0x9fdf('0x10'),_0x47c18d,'request\x20sent',JSON[_0x9fdf('0x11')](_0x4d12c2));if(_0x4d12c2[_0x9fdf('0x12')]){if(_0x4d12c2['error'][_0x9fdf('0x13')]===0x1f4){logger[_0x9fdf('0x12')](_0x9fdf('0xd'),_0x47c18d,_0x4d12c2[_0x9fdf('0x12')][_0x9fdf('0x14')]);return _0x493c31(_0x4d12c2[_0x9fdf('0x12')]['message']);}logger[_0x9fdf('0x12')]('FreshdeskConfiguration,\x20%s,\x20%s',_0x47c18d,_0x4d12c2[_0x9fdf('0x12')][_0x9fdf('0x14')]);return _0x1e43a(_0x4d12c2[_0x9fdf('0x12')][_0x9fdf('0x14')]);}else{logger[_0x9fdf('0xc')](_0x9fdf('0xd'),_0x47c18d,_0x9fdf('0xe'));_0x1e43a(_0x4d12c2[_0x9fdf('0x15')][_0x9fdf('0x14')]);}})[_0x9fdf('0x16')](function(_0x4416c2){logger['error'](_0x9fdf('0xd'),_0x47c18d,_0x4416c2);_0x493c31(_0x4416c2);});});} \ No newline at end of file +var _0x2d29=['FreshdeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','FreshdeskConfiguration,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x29e61b,_0x32acb6){var _0x5eebc0=function(_0x24809c){while(--_0x24809c){_0x29e61b['push'](_0x29e61b['shift']());}};_0x5eebc0(++_0x32acb6);}(_0x2d29,0xf7));var _0x92d2=function(_0xb0ec7e,_0x1f464f){_0xb0ec7e=_0xb0ec7e-0x0;var _0x5d7524=_0x2d29[_0xb0ec7e];return _0x5d7524;};'use strict';var _=require(_0x92d2('0x0'));var util=require(_0x92d2('0x1'));var moment=require('moment');var BPromise=require(_0x92d2('0x2'));var rs=require(_0x92d2('0x3'));var fs=require('fs');var Redis=require(_0x92d2('0x4'));var db=require(_0x92d2('0x5'))['db'];var utils=require(_0x92d2('0x6'));var logger=require(_0x92d2('0x7'))(_0x92d2('0x8'));var config=require(_0x92d2('0x9'));var jayson=require(_0x92d2('0xa'));var client=jayson[_0x92d2('0xb')][_0x92d2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x5e6199,_0x4dfad1,_0x5efaea){return new BPromise(function(_0x29ad11,_0x2a31d2){return client['request'](_0x5e6199,_0x5efaea)['then'](function(_0x3b156b){logger[_0x92d2('0xd')](_0x92d2('0xe'),_0x4dfad1,_0x92d2('0xf'));logger[_0x92d2('0x10')](_0x92d2('0x11'),_0x4dfad1,_0x92d2('0xf'),JSON[_0x92d2('0x12')](_0x3b156b));if(_0x3b156b[_0x92d2('0x13')]){if(_0x3b156b[_0x92d2('0x13')][_0x92d2('0x14')]===0x1f4){logger[_0x92d2('0x13')](_0x92d2('0xe'),_0x4dfad1,_0x3b156b[_0x92d2('0x13')][_0x92d2('0x15')]);return _0x2a31d2(_0x3b156b[_0x92d2('0x13')][_0x92d2('0x15')]);}logger[_0x92d2('0x13')](_0x92d2('0xe'),_0x4dfad1,_0x3b156b[_0x92d2('0x13')][_0x92d2('0x15')]);return _0x29ad11(_0x3b156b[_0x92d2('0x13')]['message']);}else{logger[_0x92d2('0xd')](_0x92d2('0xe'),_0x4dfad1,_0x92d2('0xf'));_0x29ad11(_0x3b156b[_0x92d2('0x16')]['message']);}})[_0x92d2('0x17')](function(_0x1f7ea9){logger['error'](_0x92d2('0xe'),_0x4dfad1,_0x1f7ea9);_0x2a31d2(_0x1f7ea9);});});} \ No newline at end of file diff --git a/server/api/intFreshdeskField/index.js b/server/api/intFreshdeskField/index.js index 2fffbf5..3edb54d 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 _0xd429=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshdeskField.controller','get','isAuthenticated','index','/:id','post','create','put','update','delete','exports','multer','util','path','express','Router'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xd429,0x19f));var _0x9d42=function(_0x1b0113,_0x6270cd){_0x1b0113=_0x1b0113-0x0;var _0x258d38=_0xd429[_0x1b0113];return _0x258d38;};'use strict';var multer=require(_0x9d42('0x0'));var util=require(_0x9d42('0x1'));var path=require(_0x9d42('0x2'));var timeout=require('connect-timeout');var express=require(_0x9d42('0x3'));var router=express[_0x9d42('0x4')]();var fs_extra=require(_0x9d42('0x5'));var auth=require(_0x9d42('0x6'));var interaction=require(_0x9d42('0x7'));var config=require(_0x9d42('0x8'));var controller=require(_0x9d42('0x9'));router[_0x9d42('0xa')]('/',auth[_0x9d42('0xb')](),controller[_0x9d42('0xc')]);router[_0x9d42('0xa')](_0x9d42('0xd'),auth[_0x9d42('0xb')](),controller['show']);router[_0x9d42('0xe')]('/',auth[_0x9d42('0xb')](),controller[_0x9d42('0xf')]);router[_0x9d42('0x10')](_0x9d42('0xd'),auth[_0x9d42('0xb')](),controller[_0x9d42('0x11')]);router[_0x9d42('0x12')](_0x9d42('0xd'),auth[_0x9d42('0xb')](),controller['destroy']);module[_0x9d42('0x13')]=router; \ No newline at end of file +var _0x5bfb=['./intFreshdeskField.controller','get','isAuthenticated','/:id','post','delete','destroy','multer','path','express','Router','../../components/auth/service','../../components/interaction/service'];(function(_0x296809,_0x1c9665){var _0x18c0d3=function(_0x249156){while(--_0x249156){_0x296809['push'](_0x296809['shift']());}};_0x18c0d3(++_0x1c9665);}(_0x5bfb,0xfe));var _0xb5bf=function(_0x1b9cb7,_0x12102a){_0x1b9cb7=_0x1b9cb7-0x0;var _0x4ecad9=_0x5bfb[_0x1b9cb7];return _0x4ecad9;};'use strict';var multer=require(_0xb5bf('0x0'));var util=require('util');var path=require(_0xb5bf('0x1'));var timeout=require('connect-timeout');var express=require(_0xb5bf('0x2'));var router=express[_0xb5bf('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xb5bf('0x4'));var interaction=require(_0xb5bf('0x5'));var config=require('../../config/environment');var controller=require(_0xb5bf('0x6'));router[_0xb5bf('0x7')]('/',auth[_0xb5bf('0x8')](),controller['index']);router[_0xb5bf('0x7')](_0xb5bf('0x9'),auth[_0xb5bf('0x8')](),controller['show']);router[_0xb5bf('0xa')]('/',auth[_0xb5bf('0x8')](),controller['create']);router['put']('/:id',auth[_0xb5bf('0x8')](),controller['update']);router[_0xb5bf('0xb')]('/:id',auth[_0xb5bf('0x8')](),controller[_0xb5bf('0xc')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.attributes.js b/server/api/intFreshdeskField/intFreshdeskField.attributes.js index 93b1ab2..72b572b 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 _0x7598=['string','STRING','ENUM','variable','customVariable','keyValue','picklist'];(function(_0x476e57,_0x4a44d9){var _0x17a8dc=function(_0xee58b){while(--_0xee58b){_0x476e57['push'](_0x476e57['shift']());}};_0x17a8dc(++_0x4a44d9);}(_0x7598,0xc6));var _0x8759=function(_0x2fb0e7,_0x228cc7){_0x2fb0e7=_0x2fb0e7-0x0;var _0x2f0a46=_0x7598[_0x2fb0e7];return _0x2f0a46;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0x8759('0x0')]('string',_0x8759('0x1'),_0x8759('0x2'),_0x8759('0x3'),_0x8759('0x4')),'defaultValue':_0x8759('0x5')},'content':{'type':Sequelize[_0x8759('0x6')]},'key':{'type':Sequelize[_0x8759('0x6')]},'keyType':{'type':Sequelize[_0x8759('0x0')]('string',_0x8759('0x1'),_0x8759('0x2'))},'keyContent':{'type':Sequelize[_0x8759('0x6')]},'idField':{'type':Sequelize[_0x8759('0x6')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x8759('0x6')]}}; \ No newline at end of file +var _0x1993=['exports','ENUM','picklist','string','STRING','BOOLEAN','sequelize'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0x1993,0xb5));var _0x3199=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x1993[_0x2f5ac5];return _0x37c9a8;};'use strict';var Sequelize=require(_0x3199('0x0'));module[_0x3199('0x1')]={'type':{'type':Sequelize[_0x3199('0x2')]('string','variable','customVariable','keyValue',_0x3199('0x3')),'defaultValue':_0x3199('0x4')},'content':{'type':Sequelize[_0x3199('0x5')]},'key':{'type':Sequelize[_0x3199('0x5')]},'keyType':{'type':Sequelize[_0x3199('0x2')](_0x3199('0x4'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0x3199('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x3199('0x5')]},'customField':{'type':Sequelize[_0x3199('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x3199('0x5')]}}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.controller.js b/server/api/intFreshdeskField/intFreshdeskField.controller.js index 61051a8..e89e844 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 _0xda3f=['keys','filters','intersection','attributes','fields','nolimit','sort','filter','where','merge','type','VIRTUAL','options','FreshdeskField','includeAll','include','findAll','rows','catch','params','rawAttributes','length','find','create','body','destroy','rimraf','zip-dir','bluebird','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','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','end','stack','name','send','map','key','model','query'];(function(_0x53f740,_0x1c689c){var _0x50636a=function(_0x304fbc){while(--_0x304fbc){_0x53f740['push'](_0x53f740['shift']());}};_0x50636a(++_0x1c689c);}(_0xda3f,0xec));var _0xfda3=function(_0x5e9119,_0x3afa7a){_0x5e9119=_0x5e9119-0x0;var _0x494c11=_0xda3f[_0x5e9119];return _0x494c11;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfda3('0x0'));var zipdir=require(_0xfda3('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xfda3('0x2'));var Mustache=require('mustache');var util=require(_0xfda3('0x3'));var path=require(_0xfda3('0x4'));var sox=require('sox');var csv=require(_0xfda3('0x5'));var ejs=require(_0xfda3('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xfda3('0x7'));var crypto=require(_0xfda3('0x8'));var jsforce=require(_0xfda3('0x9'));var deskjs=require(_0xfda3('0xa'));var toCsv=require(_0xfda3('0x5'));var querystring=require(_0xfda3('0xb'));var Papa=require(_0xfda3('0xc'));var Redis=require(_0xfda3('0xd'));var authService=require(_0xfda3('0xe'));var qs=require(_0xfda3('0xf'));var as=require(_0xfda3('0x10'));var hardwareService=require(_0xfda3('0x11'));var logger=require('../../config/logger')(_0xfda3('0x12'));var utils=require(_0xfda3('0x13'));var config=require(_0xfda3('0x14'));var licenseUtil=require(_0xfda3('0x15'));var db=require(_0xfda3('0x16'))['db'];function respondWithStatusCode(_0x4b77ea,_0x583125){_0x583125=_0x583125||0xcc;return function(_0x5d7d5b){if(_0x5d7d5b){return _0x4b77ea[_0xfda3('0x17')](_0x583125);}return _0x4b77ea[_0xfda3('0x18')](_0x583125)['end']();};}function respondWithResult(_0x501588,_0x587e9b){_0x587e9b=_0x587e9b||0xc8;return function(_0x227d72){if(_0x227d72){return _0x501588[_0xfda3('0x18')](_0x587e9b)['json'](_0x227d72);}};}function respondWithFilteredResult(_0x57a229,_0x533365){return function(_0x80ea80){if(_0x80ea80){var _0x474707=typeof _0x533365[_0xfda3('0x19')]===_0xfda3('0x1a')&&typeof _0x533365[_0xfda3('0x1b')]===_0xfda3('0x1a');var _0x2aadcb=_0x80ea80[_0xfda3('0x1c')];var _0x4680bf=_0x474707?0x0:_0x533365[_0xfda3('0x19')];var _0x54a7c6=_0x474707?_0x80ea80[_0xfda3('0x1c')]:_0x533365[_0xfda3('0x19')]+_0x533365[_0xfda3('0x1b')];var _0x32855a;if(_0x54a7c6>=_0x2aadcb){_0x54a7c6=_0x2aadcb;_0x32855a=0xc8;}else{_0x32855a=0xce;}_0x57a229['status'](_0x32855a);return _0x57a229[_0xfda3('0x1d')](_0xfda3('0x1e'),_0x4680bf+'-'+_0x54a7c6+'/'+_0x2aadcb)[_0xfda3('0x1f')](_0x80ea80);}return null;};}function patchUpdates(_0x51e731){return function(_0x5ad52a){try{jsonpatch[_0xfda3('0x20')](_0x5ad52a,_0x51e731,!![]);}catch(_0x38d428){return BPromise[_0xfda3('0x21')](_0x38d428);}return _0x5ad52a['save']();};}function saveUpdates(_0x3cf5a9,_0xef2535){return function(_0x1e15a8){if(_0x1e15a8){return _0x1e15a8[_0xfda3('0x22')](_0x3cf5a9)[_0xfda3('0x23')](function(_0x2b84b7){return _0x2b84b7;});}return null;};}function removeEntity(_0x2677f6,_0xc6fb9a){return function(_0x16eaa6){if(_0x16eaa6){return _0x16eaa6['destroy']()[_0xfda3('0x23')](function(){_0x2677f6[_0xfda3('0x18')](0xcc)[_0xfda3('0x24')]();});}};}function handleEntityNotFound(_0x4ae9b9,_0x45a977){return function(_0x39e246){if(!_0x39e246){_0x4ae9b9[_0xfda3('0x17')](0x194);}return _0x39e246;};}function handleError(_0x38946d,_0x1cb831){_0x1cb831=_0x1cb831||0x1f4;return function(_0xad9f7b){logger['error'](_0xad9f7b[_0xfda3('0x25')]);if(_0xad9f7b[_0xfda3('0x26')]){delete _0xad9f7b[_0xfda3('0x26')];}_0x38946d[_0xfda3('0x18')](_0x1cb831)[_0xfda3('0x27')](_0xad9f7b);};}exports['index']=function(_0x3c1549,_0x4101b1){var _0x301509={},_0x474992={},_0xe21ec6={'count':0x0,'rows':[]};var _0x3cfeb2=_[_0xfda3('0x28')](db['FreshdeskField']['rawAttributes'],function(_0x3aef3c){return{'name':_0x3aef3c['fieldName'],'type':_0x3aef3c['type'][_0xfda3('0x29')]};});_0x474992[_0xfda3('0x2a')]=_[_0xfda3('0x28')](_0x3cfeb2,_0xfda3('0x26'));_0x474992[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x3c1549[_0xfda3('0x2b')]);_0x474992[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x474992['model'],_0x474992[_0xfda3('0x2b')]);_0x301509[_0xfda3('0x2f')]=_[_0xfda3('0x2e')](_0x474992[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x301509[_0xfda3('0x2f')]=_0x301509[_0xfda3('0x2f')]['length']?_0x301509['attributes']:_0x474992[_0xfda3('0x2a')];if(!_0x3c1549[_0xfda3('0x2b')]['hasOwnProperty'](_0xfda3('0x31'))){_0x301509[_0xfda3('0x1b')]=qs[_0xfda3('0x1b')](_0x3c1549['query'][_0xfda3('0x1b')]);_0x301509[_0xfda3('0x19')]=qs[_0xfda3('0x19')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x19')]);}_0x301509['order']=qs[_0xfda3('0x32')](_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x32')]);_0x301509['where']=qs[_0xfda3('0x2d')](_['pick'](_0x3c1549[_0xfda3('0x2b')],_0x474992[_0xfda3('0x2d')]),_0x3cfeb2);if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x33')]){_0x301509[_0xfda3('0x34')]=_[_0xfda3('0x35')](_0x301509[_0xfda3('0x34')],{'$or':_[_0xfda3('0x28')](_0x3cfeb2,function(_0x577be8){if(_0x577be8[_0xfda3('0x36')]!==_0xfda3('0x37')){var _0xd2dde0={};_0xd2dde0[_0x577be8[_0xfda3('0x26')]]={'$like':'%'+_0x3c1549['query'][_0xfda3('0x33')]+'%'};return _0xd2dde0;}})});}_0x301509=_[_0xfda3('0x35')]({},_0x301509,_0x3c1549[_0xfda3('0x38')]);var _0x5bad90={'where':_0x301509['where']};return db[_0xfda3('0x39')][_0xfda3('0x1c')](_0x5bad90)[_0xfda3('0x23')](function(_0x1aaa6c){_0xe21ec6[_0xfda3('0x1c')]=_0x1aaa6c;if(_0x3c1549[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x301509[_0xfda3('0x3b')]=[{'all':!![]}];}return db[_0xfda3('0x39')][_0xfda3('0x3c')](_0x301509);})['then'](function(_0x27200f){_0xe21ec6[_0xfda3('0x3d')]=_0x27200f;return _0xe21ec6;})['then'](respondWithFilteredResult(_0x4101b1,_0x301509))[_0xfda3('0x3e')](handleError(_0x4101b1,null));};exports['show']=function(_0x51a314,_0x4e6886){var _0x2208bc={'raw':!![],'where':{'id':_0x51a314[_0xfda3('0x3f')]['id']}},_0x107fb1={};_0x107fb1[_0xfda3('0x2a')]=_['keys'](db[_0xfda3('0x39')][_0xfda3('0x40')]);_0x107fb1[_0xfda3('0x2b')]=_[_0xfda3('0x2c')](_0x51a314['query']);_0x107fb1[_0xfda3('0x2d')]=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],_0x107fb1['query']);_0x2208bc['attributes']=_[_0xfda3('0x2e')](_0x107fb1[_0xfda3('0x2a')],qs[_0xfda3('0x30')](_0x51a314[_0xfda3('0x2b')][_0xfda3('0x30')]));_0x2208bc[_0xfda3('0x2f')]=_0x2208bc[_0xfda3('0x2f')][_0xfda3('0x41')]?_0x2208bc[_0xfda3('0x2f')]:_0x107fb1[_0xfda3('0x2a')];if(_0x51a314[_0xfda3('0x2b')][_0xfda3('0x3a')]){_0x2208bc[_0xfda3('0x3b')]=[{'all':!![]}];}_0x2208bc=_[_0xfda3('0x35')]({},_0x2208bc,_0x51a314['options']);return db['FreshdeskField'][_0xfda3('0x42')](_0x2208bc)[_0xfda3('0x23')](handleEntityNotFound(_0x4e6886,null))[_0xfda3('0x23')](respondWithResult(_0x4e6886,null))[_0xfda3('0x3e')](handleError(_0x4e6886,null));};exports[_0xfda3('0x43')]=function(_0x60a89d,_0x192133){return db[_0xfda3('0x39')][_0xfda3('0x43')](_0x60a89d[_0xfda3('0x44')],{})['then'](respondWithResult(_0x192133,0xc9))[_0xfda3('0x3e')](handleError(_0x192133,null));};exports[_0xfda3('0x22')]=function(_0x481356,_0x36aa3a){if(_0x481356[_0xfda3('0x44')]['id']){delete _0x481356['body']['id'];}return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x481356[_0xfda3('0x3f')]['id']}})['then'](handleEntityNotFound(_0x36aa3a,null))[_0xfda3('0x23')](saveUpdates(_0x481356[_0xfda3('0x44')],null))[_0xfda3('0x23')](respondWithResult(_0x36aa3a,null))['catch'](handleError(_0x36aa3a,null));};exports[_0xfda3('0x45')]=function(_0x33565d,_0x2f54eb){return db[_0xfda3('0x39')][_0xfda3('0x42')]({'where':{'id':_0x33565d['params']['id']}})[_0xfda3('0x23')](handleEntityNotFound(_0x2f54eb,null))['then'](removeEntity(_0x2f54eb,null))[_0xfda3('0x3e')](handleError(_0x2f54eb,null));}; \ No newline at end of file +var _0x6324=['merge','where','type','VIRTUAL','filter','options','FreshdeskField','includeAll','rows','show','keys','intersection','include','find','catch','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','index','map','rawAttributes','fieldName','model','name','query','filters','attributes','fields','length','hasOwnProperty','order','sort','pick'];(function(_0x177ba9,_0xf429a0){var _0x3a7dbf=function(_0x39c8fa){while(--_0x39c8fa){_0x177ba9['push'](_0x177ba9['shift']());}};_0x3a7dbf(++_0xf429a0);}(_0x6324,0x142));var _0x4632=function(_0x1c0f41,_0x26d95d){_0x1c0f41=_0x1c0f41-0x0;var _0x369a9f=_0x6324[_0x1c0f41];return _0x369a9f;};'use strict';var emlformat=require(_0x4632('0x0'));var rimraf=require(_0x4632('0x1'));var zipdir=require(_0x4632('0x2'));var jsonpatch=require(_0x4632('0x3'));var rp=require('request-promise');var moment=require(_0x4632('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4632('0x5'));var util=require('util');var path=require(_0x4632('0x6'));var sox=require('sox');var csv=require(_0x4632('0x7'));var ejs=require(_0x4632('0x8'));var fs=require('fs');var fs_extra=require(_0x4632('0x9'));var _=require(_0x4632('0xa'));var squel=require('squel');var crypto=require(_0x4632('0xb'));var jsforce=require(_0x4632('0xc'));var deskjs=require(_0x4632('0xd'));var toCsv=require('to-csv');var querystring=require(_0x4632('0xe'));var Papa=require(_0x4632('0xf'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x4632('0x10'));var as=require(_0x4632('0x11'));var hardwareService=require(_0x4632('0x12'));var logger=require(_0x4632('0x13'))(_0x4632('0x14'));var utils=require(_0x4632('0x15'));var config=require(_0x4632('0x16'));var licenseUtil=require(_0x4632('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2b3f0f,_0x499d88){_0x499d88=_0x499d88||0xcc;return function(_0x4719f7){if(_0x4719f7){return _0x2b3f0f[_0x4632('0x18')](_0x499d88);}return _0x2b3f0f[_0x4632('0x19')](_0x499d88)[_0x4632('0x1a')]();};}function respondWithResult(_0x51ee37,_0x3ba361){_0x3ba361=_0x3ba361||0xc8;return function(_0x255882){if(_0x255882){return _0x51ee37[_0x4632('0x19')](_0x3ba361)[_0x4632('0x1b')](_0x255882);}};}function respondWithFilteredResult(_0x1c1be0,_0x5438ab){return function(_0x47b349){if(_0x47b349){var _0x2fd7ae=typeof _0x5438ab[_0x4632('0x1c')]===_0x4632('0x1d')&&typeof _0x5438ab[_0x4632('0x1e')]==='undefined';var _0x158831=_0x47b349[_0x4632('0x1f')];var _0x1a94c0=_0x2fd7ae?0x0:_0x5438ab['offset'];var _0x3cddfa=_0x2fd7ae?_0x47b349[_0x4632('0x1f')]:_0x5438ab['offset']+_0x5438ab['limit'];var _0x1c0523;if(_0x3cddfa>=_0x158831){_0x3cddfa=_0x158831;_0x1c0523=0xc8;}else{_0x1c0523=0xce;}_0x1c1be0[_0x4632('0x19')](_0x1c0523);return _0x1c1be0[_0x4632('0x20')](_0x4632('0x21'),_0x1a94c0+'-'+_0x3cddfa+'/'+_0x158831)[_0x4632('0x1b')](_0x47b349);}return null;};}function patchUpdates(_0x3d2d23){return function(_0x9ab826){try{jsonpatch[_0x4632('0x22')](_0x9ab826,_0x3d2d23,!![]);}catch(_0x29f875){return BPromise[_0x4632('0x23')](_0x29f875);}return _0x9ab826[_0x4632('0x24')]();};}function saveUpdates(_0x2d656a,_0x2ca6a5){return function(_0x263907){if(_0x263907){return _0x263907[_0x4632('0x25')](_0x2d656a)[_0x4632('0x26')](function(_0x4264d5){return _0x4264d5;});}return null;};}function removeEntity(_0x3537ed,_0x380a9f){return function(_0x1e1b86){if(_0x1e1b86){return _0x1e1b86[_0x4632('0x27')]()[_0x4632('0x26')](function(){_0x3537ed[_0x4632('0x19')](0xcc)[_0x4632('0x1a')]();});}};}function handleEntityNotFound(_0xb074d,_0x1b8de0){return function(_0x4af026){if(!_0x4af026){_0xb074d[_0x4632('0x18')](0x194);}return _0x4af026;};}function handleError(_0x21118c,_0x372679){_0x372679=_0x372679||0x1f4;return function(_0x22d0f5){logger[_0x4632('0x28')](_0x22d0f5[_0x4632('0x29')]);if(_0x22d0f5['name']){delete _0x22d0f5['name'];}_0x21118c[_0x4632('0x19')](_0x372679)[_0x4632('0x2a')](_0x22d0f5);};}exports[_0x4632('0x2b')]=function(_0x35a533,_0x34079f){var _0x119d1b={},_0x3570b2={},_0x5e2ee4={'count':0x0,'rows':[]};var _0x42d505=_[_0x4632('0x2c')](db['FreshdeskField'][_0x4632('0x2d')],function(_0x5316f7){return{'name':_0x5316f7[_0x4632('0x2e')],'type':_0x5316f7['type']['key']};});_0x3570b2[_0x4632('0x2f')]=_[_0x4632('0x2c')](_0x42d505,_0x4632('0x30'));_0x3570b2['query']=_['keys'](_0x35a533[_0x4632('0x31')]);_0x3570b2[_0x4632('0x32')]=_['intersection'](_0x3570b2['model'],_0x3570b2[_0x4632('0x31')]);_0x119d1b[_0x4632('0x33')]=_['intersection'](_0x3570b2[_0x4632('0x2f')],qs[_0x4632('0x34')](_0x35a533[_0x4632('0x31')][_0x4632('0x34')]));_0x119d1b[_0x4632('0x33')]=_0x119d1b['attributes'][_0x4632('0x35')]?_0x119d1b[_0x4632('0x33')]:_0x3570b2['model'];if(!_0x35a533['query'][_0x4632('0x36')]('nolimit')){_0x119d1b['limit']=qs[_0x4632('0x1e')](_0x35a533['query'][_0x4632('0x1e')]);_0x119d1b[_0x4632('0x1c')]=qs[_0x4632('0x1c')](_0x35a533['query'][_0x4632('0x1c')]);}_0x119d1b[_0x4632('0x37')]=qs[_0x4632('0x38')](_0x35a533[_0x4632('0x31')][_0x4632('0x38')]);_0x119d1b['where']=qs['filters'](_[_0x4632('0x39')](_0x35a533[_0x4632('0x31')],_0x3570b2[_0x4632('0x32')]),_0x42d505);if(_0x35a533['query']['filter']){_0x119d1b['where']=_[_0x4632('0x3a')](_0x119d1b[_0x4632('0x3b')],{'$or':_['map'](_0x42d505,function(_0x3809aa){if(_0x3809aa[_0x4632('0x3c')]!==_0x4632('0x3d')){var _0x3adf41={};_0x3adf41[_0x3809aa[_0x4632('0x30')]]={'$like':'%'+_0x35a533[_0x4632('0x31')][_0x4632('0x3e')]+'%'};return _0x3adf41;}})});}_0x119d1b=_[_0x4632('0x3a')]({},_0x119d1b,_0x35a533[_0x4632('0x3f')]);var _0x2c04a8={'where':_0x119d1b[_0x4632('0x3b')]};return db[_0x4632('0x40')]['count'](_0x2c04a8)[_0x4632('0x26')](function(_0x45bff6){_0x5e2ee4['count']=_0x45bff6;if(_0x35a533[_0x4632('0x31')][_0x4632('0x41')]){_0x119d1b['include']=[{'all':!![]}];}return db[_0x4632('0x40')]['findAll'](_0x119d1b);})[_0x4632('0x26')](function(_0x28df3b){_0x5e2ee4[_0x4632('0x42')]=_0x28df3b;return _0x5e2ee4;})[_0x4632('0x26')](respondWithFilteredResult(_0x34079f,_0x119d1b))['catch'](handleError(_0x34079f,null));};exports[_0x4632('0x43')]=function(_0x29381a,_0x23ef38){var _0x279298={'raw':!![],'where':{'id':_0x29381a['params']['id']}},_0x5cc716={};_0x5cc716[_0x4632('0x2f')]=_[_0x4632('0x44')](db[_0x4632('0x40')]['rawAttributes']);_0x5cc716[_0x4632('0x31')]=_[_0x4632('0x44')](_0x29381a[_0x4632('0x31')]);_0x5cc716[_0x4632('0x32')]=_[_0x4632('0x45')](_0x5cc716[_0x4632('0x2f')],_0x5cc716[_0x4632('0x31')]);_0x279298['attributes']=_[_0x4632('0x45')](_0x5cc716[_0x4632('0x2f')],qs[_0x4632('0x34')](_0x29381a[_0x4632('0x31')][_0x4632('0x34')]));_0x279298['attributes']=_0x279298['attributes'][_0x4632('0x35')]?_0x279298[_0x4632('0x33')]:_0x5cc716[_0x4632('0x2f')];if(_0x29381a[_0x4632('0x31')]['includeAll']){_0x279298[_0x4632('0x46')]=[{'all':!![]}];}_0x279298=_[_0x4632('0x3a')]({},_0x279298,_0x29381a[_0x4632('0x3f')]);return db[_0x4632('0x40')][_0x4632('0x47')](_0x279298)['then'](handleEntityNotFound(_0x23ef38,null))[_0x4632('0x26')](respondWithResult(_0x23ef38,null))[_0x4632('0x48')](handleError(_0x23ef38,null));};exports[_0x4632('0x49')]=function(_0xcce5db,_0x3676fa){return db[_0x4632('0x40')][_0x4632('0x49')](_0xcce5db[_0x4632('0x4a')],{})[_0x4632('0x26')](respondWithResult(_0x3676fa,0xc9))[_0x4632('0x48')](handleError(_0x3676fa,null));};exports[_0x4632('0x25')]=function(_0x517584,_0xc3ffd0){if(_0x517584[_0x4632('0x4a')]['id']){delete _0x517584[_0x4632('0x4a')]['id'];}return db['FreshdeskField'][_0x4632('0x47')]({'where':{'id':_0x517584[_0x4632('0x4b')]['id']}})[_0x4632('0x26')](handleEntityNotFound(_0xc3ffd0,null))[_0x4632('0x26')](saveUpdates(_0x517584[_0x4632('0x4a')],null))[_0x4632('0x26')](respondWithResult(_0xc3ffd0,null))[_0x4632('0x48')](handleError(_0xc3ffd0,null));};exports[_0x4632('0x27')]=function(_0x1f43b6,_0x1aa831){return db['FreshdeskField'][_0x4632('0x47')]({'where':{'id':_0x1f43b6[_0x4632('0x4b')]['id']}})['then'](handleEntityNotFound(_0x1aa831,null))[_0x4632('0x26')](removeEntity(_0x1aa831,null))[_0x4632('0x48')](handleError(_0x1aa831,null));}; \ No newline at end of file diff --git a/server/api/intFreshdeskField/intFreshdeskField.model.js b/server/api/intFreshdeskField/intFreshdeskField.model.js index 5a3276a..128b48a 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 _0x59e0=['FreshdeskField','int_freshdesk_fields','idField','FieldId','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intFreshdeskField.attributes','exports','define'];(function(_0x3e06dd,_0x55694f){var _0x4bbb8b=function(_0x3586fa){while(--_0x3586fa){_0x3e06dd['push'](_0x3e06dd['shift']());}};_0x4bbb8b(++_0x55694f);}(_0x59e0,0x1f4));var _0x059e=function(_0x29e358,_0x5b4d6a){_0x29e358=_0x29e358-0x0;var _0x274f62=_0x59e0[_0x29e358];return _0x274f62;};'use strict';var _=require('lodash');var util=require(_0x059e('0x0'));var logger=require(_0x059e('0x1'))(_0x059e('0x2'));var moment=require(_0x059e('0x3'));var BPromise=require(_0x059e('0x4'));var rp=require(_0x059e('0x5'));var fs=require('fs');var path=require(_0x059e('0x6'));var rimraf=require(_0x059e('0x7'));var config=require(_0x059e('0x8'));var attributes=require(_0x059e('0x9'));module[_0x059e('0xa')]=function(_0x1ce502,_0x4a4a89){return _0x1ce502[_0x059e('0xb')](_0x059e('0xc'),attributes,{'tableName':_0x059e('0xd'),'paranoid':![],'indexes':[{'name':'freshdesk_unique_index','fields':[_0x059e('0xe'),_0x059e('0xf')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x34d2=['request-promise','path','rimraf','./intFreshdeskField.attributes','exports','define','FreshdeskField','int_freshdesk_fields','freshdesk_unique_index','idField','FieldId','util','../../config/logger','api','moment','bluebird'];(function(_0x4d1ba5,_0x1e2f55){var _0x7a210e=function(_0x24ac2f){while(--_0x24ac2f){_0x4d1ba5['push'](_0x4d1ba5['shift']());}};_0x7a210e(++_0x1e2f55);}(_0x34d2,0x7b));var _0x234d=function(_0x3538f6,_0x4feca4){_0x3538f6=_0x3538f6-0x0;var _0x308633=_0x34d2[_0x3538f6];return _0x308633;};'use strict';var _=require('lodash');var util=require(_0x234d('0x0'));var logger=require(_0x234d('0x1'))(_0x234d('0x2'));var moment=require(_0x234d('0x3'));var BPromise=require(_0x234d('0x4'));var rp=require(_0x234d('0x5'));var fs=require('fs');var path=require(_0x234d('0x6'));var rimraf=require(_0x234d('0x7'));var config=require('../../config/environment');var attributes=require(_0x234d('0x8'));module[_0x234d('0x9')]=function(_0x5dfaf4,_0x244090){return _0x5dfaf4[_0x234d('0xa')](_0x234d('0xb'),attributes,{'tableName':_0x234d('0xc'),'paranoid':![],'indexes':[{'name':_0x234d('0xd'),'fields':[_0x234d('0xe'),_0x234d('0xf')],'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 ae2c772..3b4d6a0 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 _0x21c1=['result','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','request','then','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message'];(function(_0xefd519,_0xc62635){var _0x4bb882=function(_0x37e0a1){while(--_0x37e0a1){_0xefd519['push'](_0xefd519['shift']());}};_0x4bb882(++_0xc62635);}(_0x21c1,0x1c3));var _0x121c=function(_0xd2dfa,_0x335a68){_0xd2dfa=_0xd2dfa-0x0;var _0x363e44=_0x21c1[_0xd2dfa];return _0x363e44;};'use strict';var _=require('lodash');var util=require(_0x121c('0x0'));var moment=require('moment');var BPromise=require(_0x121c('0x1'));var rs=require(_0x121c('0x2'));var fs=require('fs');var Redis=require(_0x121c('0x3'));var db=require(_0x121c('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x121c('0x5'));var jayson=require(_0x121c('0x6'));var client=jayson[_0x121c('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x6c2fcf,_0x115f76,_0x2989b7){return new BPromise(function(_0x3e90c9,_0x5ea9b1){return client[_0x121c('0x8')](_0x6c2fcf,_0x2989b7)[_0x121c('0x9')](function(_0x5e0331){logger['info'](_0x121c('0xa'),_0x115f76,'request\x20sent');logger['debug'](_0x121c('0xb'),_0x115f76,_0x121c('0xc'),JSON[_0x121c('0xd')](_0x5e0331));if(_0x5e0331[_0x121c('0xe')]){if(_0x5e0331[_0x121c('0xe')][_0x121c('0xf')]===0x1f4){logger[_0x121c('0xe')](_0x121c('0xa'),_0x115f76,_0x5e0331[_0x121c('0xe')][_0x121c('0x10')]);return _0x5ea9b1(_0x5e0331[_0x121c('0xe')][_0x121c('0x10')]);}logger['error']('FreshdeskField,\x20%s,\x20%s',_0x115f76,_0x5e0331[_0x121c('0xe')][_0x121c('0x10')]);return _0x3e90c9(_0x5e0331[_0x121c('0xe')]['message']);}else{logger['info'](_0x121c('0xa'),_0x115f76,'request\x20sent');_0x3e90c9(_0x5e0331[_0x121c('0x11')][_0x121c('0x10')]);}})['catch'](function(_0x582aa5){logger[_0x121c('0xe')](_0x121c('0xa'),_0x115f76,_0x582aa5);_0x5ea9b1(_0x582aa5);});});} \ No newline at end of file +var _0x178b=['rpc','../../config/environment','jayson/promise','client','request','then','info','FreshdeskField,\x20%s,\x20%s','FreshdeskField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x3ea35a,_0x43e217){var _0x5ac8aa=function(_0x19e98e){while(--_0x19e98e){_0x3ea35a['push'](_0x3ea35a['shift']());}};_0x5ac8aa(++_0x43e217);}(_0x178b,0x143));var _0xb178=function(_0xbba421,_0x81d172){_0xbba421=_0xbba421-0x0;var _0x420880=_0x178b[_0xbba421];return _0x420880;};'use strict';var _=require(_0xb178('0x0'));var util=require(_0xb178('0x1'));var moment=require(_0xb178('0x2'));var BPromise=require('bluebird');var rs=require(_0xb178('0x3'));var fs=require('fs');var Redis=require(_0xb178('0x4'));var db=require(_0xb178('0x5'))['db'];var utils=require(_0xb178('0x6'));var logger=require('../../config/logger')(_0xb178('0x7'));var config=require(_0xb178('0x8'));var jayson=require(_0xb178('0x9'));var client=jayson[_0xb178('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x52d226,_0x59cd97,_0x53d07e){return new BPromise(function(_0x5207f0,_0x1e10fc){return client[_0xb178('0xb')](_0x52d226,_0x53d07e)[_0xb178('0xc')](function(_0x421f4f){logger[_0xb178('0xd')](_0xb178('0xe'),_0x59cd97,'request\x20sent');logger['debug'](_0xb178('0xf'),_0x59cd97,_0xb178('0x10'),JSON[_0xb178('0x11')](_0x421f4f));if(_0x421f4f[_0xb178('0x12')]){if(_0x421f4f[_0xb178('0x12')]['code']===0x1f4){logger[_0xb178('0x12')](_0xb178('0xe'),_0x59cd97,_0x421f4f[_0xb178('0x12')][_0xb178('0x13')]);return _0x1e10fc(_0x421f4f[_0xb178('0x12')]['message']);}logger['error'](_0xb178('0xe'),_0x59cd97,_0x421f4f[_0xb178('0x12')][_0xb178('0x13')]);return _0x5207f0(_0x421f4f[_0xb178('0x12')]['message']);}else{logger['info'](_0xb178('0xe'),_0x59cd97,_0xb178('0x10'));_0x5207f0(_0x421f4f[_0xb178('0x14')][_0xb178('0x13')]);}})[_0xb178('0x15')](function(_0x24a43a){logger['error'](_0xb178('0xe'),_0x59cd97,_0x24a43a);_0x1e10fc(_0x24a43a);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/index.js b/server/api/intFreshsalesAccount/index.js index 4b9ed9a..b8e8fd9 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 _0x282b=['../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','show','getConfigurations','/:id/fields','post','create','/:id/configurations','put','/:id','update','delete','exports','multer','util','path','connect-timeout','express','../../components/auth/service'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x282b,0xec));var _0xb282=function(_0x899969,_0x4c0bd3){_0x899969=_0x899969-0x0;var _0x4474b3=_0x282b[_0x899969];return _0x4474b3;};'use strict';var multer=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var path=require(_0xb282('0x2'));var timeout=require(_0xb282('0x3'));var express=require(_0xb282('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xb282('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xb282('0x6'));var controller=require(_0xb282('0x7'));router[_0xb282('0x8')]('/',auth[_0xb282('0x9')](),controller[_0xb282('0xa')]);router[_0xb282('0x8')]('/:id',auth['isAuthenticated'](),controller[_0xb282('0xb')]);router[_0xb282('0x8')]('/:id/configurations',auth[_0xb282('0x9')](),controller[_0xb282('0xc')]);router[_0xb282('0x8')](_0xb282('0xd'),auth['isAuthenticated'](),controller['getFields']);router[_0xb282('0xe')]('/',auth[_0xb282('0x9')](),controller[_0xb282('0xf')]);router[_0xb282('0xe')](_0xb282('0x10'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0xb282('0x11')](_0xb282('0x12'),auth[_0xb282('0x9')](),controller[_0xb282('0x13')]);router[_0xb282('0x14')]('/:id',auth[_0xb282('0x9')](),controller['destroy']);module[_0xb282('0x15')]=router; \ No newline at end of file +var _0xbaf0=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intFreshsalesAccount.controller','get','isAuthenticated','index','/:id','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','put','update','destroy','exports','util'];(function(_0x4ed520,_0x21be63){var _0x4415a6=function(_0x14b151){while(--_0x14b151){_0x4ed520['push'](_0x4ed520['shift']());}};_0x4415a6(++_0x21be63);}(_0xbaf0,0x12a));var _0x0baf=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xbaf0[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require(_0x0baf('0x0'));var path=require(_0x0baf('0x1'));var timeout=require(_0x0baf('0x2'));var express=require(_0x0baf('0x3'));var router=express[_0x0baf('0x4')]();var fs_extra=require(_0x0baf('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x0baf('0x6'));var config=require(_0x0baf('0x7'));var controller=require(_0x0baf('0x8'));router[_0x0baf('0x9')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0xb')]);router[_0x0baf('0x9')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller['show']);router[_0x0baf('0x9')]('/:id/configurations',auth[_0x0baf('0xa')](),controller[_0x0baf('0xd')]);router[_0x0baf('0x9')](_0x0baf('0xe'),auth[_0x0baf('0xa')](),controller[_0x0baf('0xf')]);router[_0x0baf('0x10')]('/',auth[_0x0baf('0xa')](),controller[_0x0baf('0x11')]);router[_0x0baf('0x10')](_0x0baf('0x12'),auth['isAuthenticated'](),controller['addConfiguration']);router[_0x0baf('0x13')](_0x0baf('0xc'),auth[_0x0baf('0xa')](),controller[_0x0baf('0x14')]);router['delete'](_0x0baf('0xc'),auth['isAuthenticated'](),controller[_0x0baf('0x15')]);module[_0x0baf('0x16')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.attributes.js index 3aec43a..2da47dd 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 _0xdf55=['exports','STRING','remoteUri','sequelize'];(function(_0x40e150,_0xd92c7c){var _0x3ff52e=function(_0x277505){while(--_0x277505){_0x40e150['push'](_0x40e150['shift']());}};_0x3ff52e(++_0xd92c7c);}(_0xdf55,0x83));var _0x5df5=function(_0x260073,_0xbe6af9){_0x260073=_0x260073-0x0;var _0x4ff033=_0xdf55[_0x260073];return _0x4ff033;};'use strict';var Sequelize=require(_0x5df5('0x0'));module[_0x5df5('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x5df5('0x2')]},'username':{'type':Sequelize[_0x5df5('0x2')],'unique':'username'},'apiKey':{'type':Sequelize[_0x5df5('0x2')]},'remoteUri':{'type':Sequelize[_0x5df5('0x2')],'unique':_0x5df5('0x3')},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file +var _0x1775=['STRING','username','remoteUri','exports'];(function(_0x164e27,_0x3182fc){var _0x5cb821=function(_0x301091){while(--_0x301091){_0x164e27['push'](_0x164e27['shift']());}};_0x5cb821(++_0x3182fc);}(_0x1775,0x1db));var _0x5177=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x1775[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x5177('0x0')]={'name':{'type':Sequelize[_0x5177('0x1')]},'description':{'type':Sequelize[_0x5177('0x1')]},'username':{'type':Sequelize[_0x5177('0x1')],'unique':_0x5177('0x2')},'apiKey':{'type':Sequelize[_0x5177('0x1')]},'remoteUri':{'type':Sequelize[_0x5177('0x1')],'unique':_0x5177('0x3')},'serverUrl':{'type':Sequelize[_0x5177('0x1')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.controller.js index d613380..c79943e 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 _0xe0b9=['rows','catch','params','fields','options','find','create','body','destroy','getConfigurations','findOne','FreshsalesConfiguration','pick','hasOwnProperty','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','FreshsalesField','getFields','username','remoteUri','apiKey','substring','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','email','Requested\x20Resource\x20not\x20Found','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','update','then','end','stack','name','send','map','FreshsalesAccount','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','merge','VIRTUAL','filter','count','includeAll','include','findAll'];(function(_0x225809,_0x2866c8){var _0x1862c2=function(_0xe83fd){while(--_0xe83fd){_0x225809['push'](_0x225809['shift']());}};_0x1862c2(++_0x2866c8);}(_0xe0b9,0x1be));var _0x9e0b=function(_0x48e1ec,_0x35f468){_0x48e1ec=_0x48e1ec-0x0;var _0x3b33eb=_0xe0b9[_0x48e1ec];return _0x3b33eb;};'use strict';var emlformat=require(_0x9e0b('0x0'));var rimraf=require(_0x9e0b('0x1'));var zipdir=require(_0x9e0b('0x2'));var jsonpatch=require(_0x9e0b('0x3'));var rp=require(_0x9e0b('0x4'));var moment=require(_0x9e0b('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x9e0b('0x6'));var util=require(_0x9e0b('0x7'));var path=require(_0x9e0b('0x8'));var sox=require(_0x9e0b('0x9'));var csv=require(_0x9e0b('0xa'));var ejs=require(_0x9e0b('0xb'));var fs=require('fs');var fs_extra=require(_0x9e0b('0xc'));var _=require(_0x9e0b('0xd'));var squel=require('squel');var crypto=require(_0x9e0b('0xe'));var jsforce=require(_0x9e0b('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x9e0b('0xa'));var querystring=require('querystring');var Papa=require(_0x9e0b('0x10'));var Redis=require('ioredis');var authService=require(_0x9e0b('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x9e0b('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x9e0b('0x13'))(_0x9e0b('0x14'));var utils=require(_0x9e0b('0x15'));var config=require(_0x9e0b('0x16'));var licenseUtil=require(_0x9e0b('0x17'));var db=require(_0x9e0b('0x18'))['db'];var integrations=require(_0x9e0b('0x19'));function respondWithStatusCode(_0x3ef8c4,_0x5349a0){_0x5349a0=_0x5349a0||0xcc;return function(_0x12e7db){if(_0x12e7db){return _0x3ef8c4[_0x9e0b('0x1a')](_0x5349a0);}return _0x3ef8c4[_0x9e0b('0x1b')](_0x5349a0)['end']();};}function respondWithResult(_0x10822f,_0x1b08c8){_0x1b08c8=_0x1b08c8||0xc8;return function(_0x4d36ac){if(_0x4d36ac){return _0x10822f[_0x9e0b('0x1b')](_0x1b08c8)[_0x9e0b('0x1c')](_0x4d36ac);}};}function respondWithFilteredResult(_0x3cd06c,_0x45e3ca){return function(_0x2cb501){if(_0x2cb501){var _0x1aa76b=typeof _0x45e3ca[_0x9e0b('0x1d')]===_0x9e0b('0x1e')&&typeof _0x45e3ca[_0x9e0b('0x1f')]===_0x9e0b('0x1e');var _0x2768ae=_0x2cb501['count'];var _0x49a3f6=_0x1aa76b?0x0:_0x45e3ca[_0x9e0b('0x1d')];var _0x998a27=_0x1aa76b?_0x2cb501['count']:_0x45e3ca[_0x9e0b('0x1d')]+_0x45e3ca[_0x9e0b('0x1f')];var _0x53e337;if(_0x998a27>=_0x2768ae){_0x998a27=_0x2768ae;_0x53e337=0xc8;}else{_0x53e337=0xce;}_0x3cd06c[_0x9e0b('0x1b')](_0x53e337);return _0x3cd06c[_0x9e0b('0x20')](_0x9e0b('0x21'),_0x49a3f6+'-'+_0x998a27+'/'+_0x2768ae)[_0x9e0b('0x1c')](_0x2cb501);}return null;};}function patchUpdates(_0xd20ee4){return function(_0x432e21){try{jsonpatch[_0x9e0b('0x22')](_0x432e21,_0xd20ee4,!![]);}catch(_0x18a8c6){return BPromise['reject'](_0x18a8c6);}return _0x432e21['save']();};}function saveUpdates(_0x3911c6,_0x4a3249){return function(_0x85ed04){if(_0x85ed04){return _0x85ed04[_0x9e0b('0x23')](_0x3911c6)[_0x9e0b('0x24')](function(_0x39e9e4){return _0x39e9e4;});}return null;};}function removeEntity(_0xdfdd51,_0x1bf0b1){return function(_0x4e837f){if(_0x4e837f){return _0x4e837f['destroy']()[_0x9e0b('0x24')](function(){_0xdfdd51['status'](0xcc)[_0x9e0b('0x25')]();});}};}function handleEntityNotFound(_0x4f3692,_0x3e476){return function(_0x1681fe){if(!_0x1681fe){_0x4f3692[_0x9e0b('0x1a')](0x194);}return _0x1681fe;};}function handleError(_0x47daee,_0x16a228){_0x16a228=_0x16a228||0x1f4;return function(_0x2c68a0){logger['error'](_0x2c68a0[_0x9e0b('0x26')]);if(_0x2c68a0[_0x9e0b('0x27')]){delete _0x2c68a0[_0x9e0b('0x27')];}_0x47daee[_0x9e0b('0x1b')](_0x16a228)[_0x9e0b('0x28')](_0x2c68a0);};}exports['index']=function(_0x51e8db,_0x200c56){var _0x59b491={},_0x2b2d18={},_0x5a238d={'count':0x0,'rows':[]};var _0x3679c8=_[_0x9e0b('0x29')](db[_0x9e0b('0x2a')][_0x9e0b('0x2b')],function(_0x224960){return{'name':_0x224960[_0x9e0b('0x2c')],'type':_0x224960[_0x9e0b('0x2d')]['key']};});_0x2b2d18[_0x9e0b('0x2e')]=_['map'](_0x3679c8,_0x9e0b('0x27'));_0x2b2d18[_0x9e0b('0x2f')]=_[_0x9e0b('0x30')](_0x51e8db[_0x9e0b('0x2f')]);_0x2b2d18[_0x9e0b('0x31')]=_[_0x9e0b('0x32')](_0x2b2d18[_0x9e0b('0x2e')],_0x2b2d18['query']);_0x59b491[_0x9e0b('0x33')]=_[_0x9e0b('0x32')](_0x2b2d18[_0x9e0b('0x2e')],qs['fields'](_0x51e8db[_0x9e0b('0x2f')]['fields']));_0x59b491['attributes']=_0x59b491[_0x9e0b('0x33')][_0x9e0b('0x34')]?_0x59b491[_0x9e0b('0x33')]:_0x2b2d18[_0x9e0b('0x2e')];if(!_0x51e8db[_0x9e0b('0x2f')]['hasOwnProperty'](_0x9e0b('0x35'))){_0x59b491['limit']=qs[_0x9e0b('0x1f')](_0x51e8db[_0x9e0b('0x2f')]['limit']);_0x59b491['offset']=qs[_0x9e0b('0x1d')](_0x51e8db[_0x9e0b('0x2f')]['offset']);}_0x59b491[_0x9e0b('0x36')]=qs[_0x9e0b('0x37')](_0x51e8db[_0x9e0b('0x2f')][_0x9e0b('0x37')]);_0x59b491[_0x9e0b('0x38')]=qs[_0x9e0b('0x31')](_['pick'](_0x51e8db[_0x9e0b('0x2f')],_0x2b2d18[_0x9e0b('0x31')]),_0x3679c8);if(_0x51e8db['query']['filter']){_0x59b491['where']=_[_0x9e0b('0x39')](_0x59b491['where'],{'$or':_['map'](_0x3679c8,function(_0x4a9418){if(_0x4a9418['type']!==_0x9e0b('0x3a')){var _0x482e44={};_0x482e44[_0x4a9418[_0x9e0b('0x27')]]={'$like':'%'+_0x51e8db[_0x9e0b('0x2f')][_0x9e0b('0x3b')]+'%'};return _0x482e44;}})});}_0x59b491=_[_0x9e0b('0x39')]({},_0x59b491,_0x51e8db['options']);var _0x24fca5={'where':_0x59b491[_0x9e0b('0x38')]};return db[_0x9e0b('0x2a')]['count'](_0x24fca5)['then'](function(_0x51101e){_0x5a238d[_0x9e0b('0x3c')]=_0x51101e;if(_0x51e8db[_0x9e0b('0x2f')][_0x9e0b('0x3d')]){_0x59b491[_0x9e0b('0x3e')]=[{'all':!![]}];}return db[_0x9e0b('0x2a')][_0x9e0b('0x3f')](_0x59b491);})['then'](function(_0x22e774){_0x5a238d[_0x9e0b('0x40')]=_0x22e774;return _0x5a238d;})[_0x9e0b('0x24')](respondWithFilteredResult(_0x200c56,_0x59b491))[_0x9e0b('0x41')](handleError(_0x200c56,null));};exports['show']=function(_0xae3eae,_0x36ed29){var _0x1eabb0={'raw':![],'where':{'id':_0xae3eae[_0x9e0b('0x42')]['id']}},_0x27b7c7={};_0x27b7c7['model']=_[_0x9e0b('0x30')](db['FreshsalesAccount'][_0x9e0b('0x2b')]);_0x27b7c7[_0x9e0b('0x2f')]=_[_0x9e0b('0x30')](_0xae3eae['query']);_0x27b7c7['filters']=_[_0x9e0b('0x32')](_0x27b7c7['model'],_0x27b7c7[_0x9e0b('0x2f')]);_0x1eabb0[_0x9e0b('0x33')]=_['intersection'](_0x27b7c7[_0x9e0b('0x2e')],qs[_0x9e0b('0x43')](_0xae3eae[_0x9e0b('0x2f')][_0x9e0b('0x43')]));_0x1eabb0[_0x9e0b('0x33')]=_0x1eabb0['attributes']['length']?_0x1eabb0[_0x9e0b('0x33')]:_0x27b7c7[_0x9e0b('0x2e')];if(_0xae3eae[_0x9e0b('0x2f')][_0x9e0b('0x3d')]){_0x1eabb0[_0x9e0b('0x3e')]=[{'all':!![]}];}_0x1eabb0=_[_0x9e0b('0x39')]({},_0x1eabb0,_0xae3eae[_0x9e0b('0x44')]);return db[_0x9e0b('0x2a')][_0x9e0b('0x45')](_0x1eabb0)[_0x9e0b('0x24')](handleEntityNotFound(_0x36ed29,null))['then'](respondWithResult(_0x36ed29,null))[_0x9e0b('0x41')](handleError(_0x36ed29,null));};exports[_0x9e0b('0x46')]=function(_0x25e10d,_0x2c2adf){return db[_0x9e0b('0x2a')]['create'](_0x25e10d[_0x9e0b('0x47')],{})['then'](respondWithResult(_0x2c2adf,0xc9))[_0x9e0b('0x41')](handleError(_0x2c2adf,null));};exports[_0x9e0b('0x23')]=function(_0x1eb98a,_0x18497e){if(_0x1eb98a[_0x9e0b('0x47')]['id']){delete _0x1eb98a[_0x9e0b('0x47')]['id'];}return db['FreshsalesAccount'][_0x9e0b('0x45')]({'where':{'id':_0x1eb98a[_0x9e0b('0x42')]['id']}})[_0x9e0b('0x24')](handleEntityNotFound(_0x18497e,null))[_0x9e0b('0x24')](saveUpdates(_0x1eb98a['body'],null))['then'](respondWithResult(_0x18497e,null))['catch'](handleError(_0x18497e,null));};exports[_0x9e0b('0x48')]=function(_0x30ba02,_0x39fa8d){return db[_0x9e0b('0x2a')][_0x9e0b('0x45')]({'where':{'id':_0x30ba02[_0x9e0b('0x42')]['id']}})[_0x9e0b('0x24')](handleEntityNotFound(_0x39fa8d,null))[_0x9e0b('0x24')](removeEntity(_0x39fa8d,null))['catch'](handleError(_0x39fa8d,null));};exports[_0x9e0b('0x49')]=function(_0x5f5bf1,_0x1cfe7d,_0x343c3a){var _0x372b42={};var _0x2b3547={};var _0x387b1d;var _0x2a7e72;return db['FreshsalesAccount'][_0x9e0b('0x4a')]({'where':{'id':_0x5f5bf1[_0x9e0b('0x42')]['id']}})[_0x9e0b('0x24')](handleEntityNotFound(_0x1cfe7d,null))[_0x9e0b('0x24')](function(_0x266ad5){if(_0x266ad5){_0x387b1d=_0x266ad5;_0x2b3547[_0x9e0b('0x2e')]=_['keys'](db[_0x9e0b('0x4b')][_0x9e0b('0x2b')]);_0x2b3547[_0x9e0b('0x2f')]=_['keys'](_0x5f5bf1[_0x9e0b('0x2f')]);_0x2b3547[_0x9e0b('0x31')]=_[_0x9e0b('0x32')](_0x2b3547[_0x9e0b('0x2e')],_0x2b3547[_0x9e0b('0x2f')]);_0x372b42[_0x9e0b('0x33')]=_['intersection'](_0x2b3547['model'],qs[_0x9e0b('0x43')](_0x5f5bf1[_0x9e0b('0x2f')][_0x9e0b('0x43')]));_0x372b42[_0x9e0b('0x33')]=_0x372b42['attributes'][_0x9e0b('0x34')]?_0x372b42[_0x9e0b('0x33')]:_0x2b3547[_0x9e0b('0x2e')];_0x372b42[_0x9e0b('0x36')]=qs[_0x9e0b('0x37')](_0x5f5bf1[_0x9e0b('0x2f')]['sort']);_0x372b42[_0x9e0b('0x38')]=qs[_0x9e0b('0x31')](_[_0x9e0b('0x4c')](_0x5f5bf1[_0x9e0b('0x2f')],_0x2b3547[_0x9e0b('0x31')]));if(_0x5f5bf1['query'][_0x9e0b('0x3b')]){_0x372b42[_0x9e0b('0x38')]=_[_0x9e0b('0x39')](_0x372b42['where'],{'$or':_[_0x9e0b('0x29')](_0x372b42['attributes'],function(_0x3323b9){var _0x42c116={};_0x42c116[_0x3323b9]={'$like':'%'+_0x5f5bf1[_0x9e0b('0x2f')][_0x9e0b('0x3b')]+'%'};return _0x42c116;})});}_0x372b42=_[_0x9e0b('0x39')]({},_0x372b42,_0x5f5bf1[_0x9e0b('0x44')]);return _0x387b1d['getConfigurations'](_0x372b42);}})[_0x9e0b('0x24')](function(_0x3a4a4e){if(_0x3a4a4e){_0x2a7e72=_0x3a4a4e[_0x9e0b('0x34')];if(!_0x5f5bf1['query'][_0x9e0b('0x4d')]('nolimit')){_0x372b42['limit']=qs[_0x9e0b('0x1f')](_0x5f5bf1[_0x9e0b('0x2f')]['limit']);_0x372b42[_0x9e0b('0x1d')]=qs['offset'](_0x5f5bf1[_0x9e0b('0x2f')]['offset']);}return _0x387b1d[_0x9e0b('0x49')](_0x372b42);}})['then'](function(_0x117393){if(_0x117393){return _0x117393?{'count':_0x2a7e72,'rows':_0x117393}:null;}})['then'](respondWithResult(_0x1cfe7d,null))[_0x9e0b('0x41')](handleError(_0x1cfe7d,null));};exports[_0x9e0b('0x4e')]=function(_0x4c7ded,_0x3a3e90,_0x142425){if(_0x4c7ded[_0x9e0b('0x47')]['id']){delete _0x4c7ded['body']['id'];}return db['FreshsalesAccount'][_0x9e0b('0x4a')]({'where':{'id':_0x4c7ded['params']['id']}})[_0x9e0b('0x24')](handleEntityNotFound(_0x3a3e90,null))['then'](function(_0x46eab2){if(_0x46eab2){_0x4c7ded[_0x9e0b('0x47')][_0x9e0b('0x4f')]=_0x46eab2['id'];_0x4c7ded[_0x9e0b('0x47')][_0x9e0b('0x50')]=integrations[_0x9e0b('0x51')](_0x4c7ded[_0x9e0b('0x47')][_0x9e0b('0x52')],_0x4c7ded[_0x9e0b('0x47')][_0x9e0b('0x2d')]);_0x4c7ded[_0x9e0b('0x47')][_0x9e0b('0x53')]=integrations['getDescriptions'](_0x4c7ded[_0x9e0b('0x47')][_0x9e0b('0x52')],_0x4c7ded[_0x9e0b('0x47')][_0x9e0b('0x2d')]);return db[_0x9e0b('0x4b')][_0x9e0b('0x46')](_0x4c7ded[_0x9e0b('0x47')],{'include':[{'model':db[_0x9e0b('0x54')],'as':_0x9e0b('0x50')},{'model':db[_0x9e0b('0x54')],'as':_0x9e0b('0x53')}]});}return null;})[_0x9e0b('0x24')](respondWithResult(_0x3a3e90,null))[_0x9e0b('0x41')](handleError(_0x3a3e90,null));};exports[_0x9e0b('0x55')]=function(_0x457353,_0x1843a5,_0x383174){var _0x1f4f17='';var _0x4f57a1='';return db['FreshsalesAccount'][_0x9e0b('0x4a')]({'where':{'id':_0x457353[_0x9e0b('0x42')]['id']},'attributes':['id',_0x9e0b('0x56'),_0x9e0b('0x57'),_0x9e0b('0x58')]})[_0x9e0b('0x24')](handleEntityNotFound(_0x1843a5,null))[_0x9e0b('0x24')](function(_0x189b18){if(_0x189b18){_0x4f57a1=_0x189b18[_0x9e0b('0x56')];_0x1f4f17=_0x189b18['remoteUri'];var _0x4c5b87=_0x189b18[_0x9e0b('0x57')]['slice'](-0x1);if(_0x4c5b87==='/'){_0x1f4f17=_0x1f4f17[_0x9e0b('0x59')](0x0,_0x1f4f17['lastIndexOf'](_0x4c5b87));}return rp({'method':_0x9e0b('0x5a'),'uri':util[_0x9e0b('0x5b')](_0x9e0b('0x5c'),_0x1f4f17,_0x9e0b('0x5d')),'headers':{'Authorization':_0x9e0b('0x5e')+_0x189b18['apiKey']},'json':!![]});}})['then'](function(_0x3ac604){if(_0x3ac604){var _0x2b183c=_0x3ac604[_0x9e0b('0x5f')];var _0x2fa70f=![];var _0x315173=null;for(_0x315173=0x0;_0x315173<_0x2b183c[_0x9e0b('0x34')];_0x315173++){if(_0x2b183c[_0x315173][_0x9e0b('0x60')]===_0x4f57a1){_0x2fa70f=!![];}}if(_0x2fa70f){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x9e0b('0x61')});}}})[_0x9e0b('0x24')](respondWithResult(_0x1843a5,null))['catch'](function(_0x2b6c2c){var _0x4d884c=_0x457353[_0x9e0b('0x2f')][_0x9e0b('0x62')]?0x1f4:_0x2b6c2c['statusCode']||0x1f4;logger['error'](_0x9e0b('0x63'),_0x9e0b('0x55'),_0x4d884c,JSON[_0x9e0b('0x64')](_0x2b6c2c));delete _0x2b6c2c[_0x9e0b('0x27')];if(_0x4d884c===0x191){_0x4d884c=0x190;}_0x1843a5[_0x9e0b('0x1b')](_0x4d884c)[_0x9e0b('0x28')](_0x457353[_0x9e0b('0x2f')][_0x9e0b('0x62')]?{'message':_0x9e0b('0x65'),'statusCode':_0x2b6c2c['statusCode']}:_0x2b6c2c);});}; \ No newline at end of file +var _0x5140=['api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','error','name','status','send','index','map','FreshsalesAccount','rawAttributes','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','type','VIRTUAL','filter','merge','options','include','findAll','rows','catch','show','params','keys','find','create','body','update','destroy','getConfigurations','findOne','FreshsalesConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','FreshsalesField','remoteUri','apiKey','slice','substring','lastIndexOf','GET','format','%s%s','/api/selector/owners','Token\x20token=','users','Requested\x20Resource\x20not\x20Found','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x3efe87,_0x35ad48){var _0x56a4cc=function(_0x47869e){while(--_0x47869e){_0x3efe87['push'](_0x3efe87['shift']());}};_0x56a4cc(++_0x35ad48);}(_0x5140,0x199));var _0x0514=function(_0x27cf80,_0x33451b){_0x27cf80=_0x27cf80-0x0;var _0x346ef5=_0x5140[_0x27cf80];return _0x346ef5;};'use strict';var emlformat=require(_0x0514('0x0'));var rimraf=require(_0x0514('0x1'));var zipdir=require(_0x0514('0x2'));var jsonpatch=require(_0x0514('0x3'));var rp=require(_0x0514('0x4'));var moment=require(_0x0514('0x5'));var BPromise=require(_0x0514('0x6'));var Mustache=require(_0x0514('0x7'));var util=require('util');var path=require(_0x0514('0x8'));var sox=require(_0x0514('0x9'));var csv=require(_0x0514('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0514('0xb'));var _=require(_0x0514('0xc'));var squel=require('squel');var crypto=require(_0x0514('0xd'));var jsforce=require(_0x0514('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x0514('0xa'));var querystring=require(_0x0514('0xf'));var Papa=require(_0x0514('0x10'));var Redis=require(_0x0514('0x11'));var authService=require(_0x0514('0x12'));var qs=require(_0x0514('0x13'));var as=require(_0x0514('0x14'));var hardwareService=require(_0x0514('0x15'));var logger=require(_0x0514('0x16'))(_0x0514('0x17'));var utils=require(_0x0514('0x18'));var config=require(_0x0514('0x19'));var licenseUtil=require(_0x0514('0x1a'));var db=require(_0x0514('0x1b'))['db'];var integrations=require(_0x0514('0x1c'));function respondWithStatusCode(_0x4a1825,_0x12bb99){_0x12bb99=_0x12bb99||0xcc;return function(_0xfe20ad){if(_0xfe20ad){return _0x4a1825[_0x0514('0x1d')](_0x12bb99);}return _0x4a1825['status'](_0x12bb99)[_0x0514('0x1e')]();};}function respondWithResult(_0x204f03,_0x22576d){_0x22576d=_0x22576d||0xc8;return function(_0x381063){if(_0x381063){return _0x204f03['status'](_0x22576d)[_0x0514('0x1f')](_0x381063);}};}function respondWithFilteredResult(_0x4331e0,_0x1a56a7){return function(_0x76a39e){if(_0x76a39e){var _0x32adbc=typeof _0x1a56a7[_0x0514('0x20')]==='undefined'&&typeof _0x1a56a7[_0x0514('0x21')]==='undefined';var _0x466b4f=_0x76a39e['count'];var _0x91b9d5=_0x32adbc?0x0:_0x1a56a7[_0x0514('0x20')];var _0x259bae=_0x32adbc?_0x76a39e[_0x0514('0x22')]:_0x1a56a7[_0x0514('0x20')]+_0x1a56a7[_0x0514('0x21')];var _0x6ffd39;if(_0x259bae>=_0x466b4f){_0x259bae=_0x466b4f;_0x6ffd39=0xc8;}else{_0x6ffd39=0xce;}_0x4331e0['status'](_0x6ffd39);return _0x4331e0[_0x0514('0x23')](_0x0514('0x24'),_0x91b9d5+'-'+_0x259bae+'/'+_0x466b4f)[_0x0514('0x1f')](_0x76a39e);}return null;};}function patchUpdates(_0x468c16){return function(_0x22125f){try{jsonpatch[_0x0514('0x25')](_0x22125f,_0x468c16,!![]);}catch(_0x1a4d19){return BPromise[_0x0514('0x26')](_0x1a4d19);}return _0x22125f[_0x0514('0x27')]();};}function saveUpdates(_0xd515e9,_0x31b2d1){return function(_0x3519f6){if(_0x3519f6){return _0x3519f6['update'](_0xd515e9)[_0x0514('0x28')](function(_0x5290cb){return _0x5290cb;});}return null;};}function removeEntity(_0x4f1e94,_0x25652b){return function(_0x5ce3bd){if(_0x5ce3bd){return _0x5ce3bd['destroy']()['then'](function(){_0x4f1e94['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1f917e,_0x544194){return function(_0x50b371){if(!_0x50b371){_0x1f917e[_0x0514('0x1d')](0x194);}return _0x50b371;};}function handleError(_0x52639b,_0x27e318){_0x27e318=_0x27e318||0x1f4;return function(_0x538b38){logger[_0x0514('0x29')](_0x538b38['stack']);if(_0x538b38[_0x0514('0x2a')]){delete _0x538b38['name'];}_0x52639b[_0x0514('0x2b')](_0x27e318)[_0x0514('0x2c')](_0x538b38);};}exports[_0x0514('0x2d')]=function(_0x40ed6c,_0x15f2d8){var _0x5778ae={},_0x368787={},_0x359d90={'count':0x0,'rows':[]};var _0x348503=_[_0x0514('0x2e')](db[_0x0514('0x2f')][_0x0514('0x30')],function(_0x2d0127){return{'name':_0x2d0127['fieldName'],'type':_0x2d0127['type'][_0x0514('0x31')]};});_0x368787[_0x0514('0x32')]=_[_0x0514('0x2e')](_0x348503,_0x0514('0x2a'));_0x368787[_0x0514('0x33')]=_['keys'](_0x40ed6c[_0x0514('0x33')]);_0x368787[_0x0514('0x34')]=_[_0x0514('0x35')](_0x368787[_0x0514('0x32')],_0x368787[_0x0514('0x33')]);_0x5778ae[_0x0514('0x36')]=_[_0x0514('0x35')](_0x368787[_0x0514('0x32')],qs['fields'](_0x40ed6c[_0x0514('0x33')][_0x0514('0x37')]));_0x5778ae[_0x0514('0x36')]=_0x5778ae[_0x0514('0x36')][_0x0514('0x38')]?_0x5778ae[_0x0514('0x36')]:_0x368787[_0x0514('0x32')];if(!_0x40ed6c['query'][_0x0514('0x39')](_0x0514('0x3a'))){_0x5778ae[_0x0514('0x21')]=qs[_0x0514('0x21')](_0x40ed6c[_0x0514('0x33')][_0x0514('0x21')]);_0x5778ae['offset']=qs[_0x0514('0x20')](_0x40ed6c[_0x0514('0x33')]['offset']);}_0x5778ae[_0x0514('0x3b')]=qs[_0x0514('0x3c')](_0x40ed6c[_0x0514('0x33')]['sort']);_0x5778ae['where']=qs[_0x0514('0x34')](_[_0x0514('0x3d')](_0x40ed6c[_0x0514('0x33')],_0x368787[_0x0514('0x34')]),_0x348503);if(_0x40ed6c['query']['filter']){_0x5778ae['where']=_['merge'](_0x5778ae[_0x0514('0x3e')],{'$or':_[_0x0514('0x2e')](_0x348503,function(_0x208b4a){if(_0x208b4a[_0x0514('0x3f')]!==_0x0514('0x40')){var _0x590f5f={};_0x590f5f[_0x208b4a[_0x0514('0x2a')]]={'$like':'%'+_0x40ed6c['query'][_0x0514('0x41')]+'%'};return _0x590f5f;}})});}_0x5778ae=_[_0x0514('0x42')]({},_0x5778ae,_0x40ed6c[_0x0514('0x43')]);var _0x305418={'where':_0x5778ae[_0x0514('0x3e')]};return db[_0x0514('0x2f')][_0x0514('0x22')](_0x305418)['then'](function(_0x15823b){_0x359d90['count']=_0x15823b;if(_0x40ed6c['query']['includeAll']){_0x5778ae[_0x0514('0x44')]=[{'all':!![]}];}return db[_0x0514('0x2f')][_0x0514('0x45')](_0x5778ae);})['then'](function(_0x4fe099){_0x359d90[_0x0514('0x46')]=_0x4fe099;return _0x359d90;})['then'](respondWithFilteredResult(_0x15f2d8,_0x5778ae))[_0x0514('0x47')](handleError(_0x15f2d8,null));};exports[_0x0514('0x48')]=function(_0x216c91,_0x19a7e8){var _0x44cac9={'raw':![],'where':{'id':_0x216c91[_0x0514('0x49')]['id']}},_0x1abcfc={};_0x1abcfc['model']=_[_0x0514('0x4a')](db[_0x0514('0x2f')][_0x0514('0x30')]);_0x1abcfc[_0x0514('0x33')]=_[_0x0514('0x4a')](_0x216c91[_0x0514('0x33')]);_0x1abcfc['filters']=_[_0x0514('0x35')](_0x1abcfc[_0x0514('0x32')],_0x1abcfc[_0x0514('0x33')]);_0x44cac9['attributes']=_['intersection'](_0x1abcfc[_0x0514('0x32')],qs[_0x0514('0x37')](_0x216c91[_0x0514('0x33')][_0x0514('0x37')]));_0x44cac9[_0x0514('0x36')]=_0x44cac9[_0x0514('0x36')]['length']?_0x44cac9[_0x0514('0x36')]:_0x1abcfc[_0x0514('0x32')];if(_0x216c91['query']['includeAll']){_0x44cac9['include']=[{'all':!![]}];}_0x44cac9=_[_0x0514('0x42')]({},_0x44cac9,_0x216c91[_0x0514('0x43')]);return db[_0x0514('0x2f')][_0x0514('0x4b')](_0x44cac9)[_0x0514('0x28')](handleEntityNotFound(_0x19a7e8,null))[_0x0514('0x28')](respondWithResult(_0x19a7e8,null))[_0x0514('0x47')](handleError(_0x19a7e8,null));};exports[_0x0514('0x4c')]=function(_0x3b8290,_0x55325e){return db['FreshsalesAccount'][_0x0514('0x4c')](_0x3b8290[_0x0514('0x4d')],{})[_0x0514('0x28')](respondWithResult(_0x55325e,0xc9))[_0x0514('0x47')](handleError(_0x55325e,null));};exports[_0x0514('0x4e')]=function(_0x55724f,_0x49d8bb){if(_0x55724f[_0x0514('0x4d')]['id']){delete _0x55724f['body']['id'];}return db[_0x0514('0x2f')][_0x0514('0x4b')]({'where':{'id':_0x55724f[_0x0514('0x49')]['id']}})['then'](handleEntityNotFound(_0x49d8bb,null))[_0x0514('0x28')](saveUpdates(_0x55724f[_0x0514('0x4d')],null))['then'](respondWithResult(_0x49d8bb,null))[_0x0514('0x47')](handleError(_0x49d8bb,null));};exports[_0x0514('0x4f')]=function(_0x33c25e,_0x907be){return db['FreshsalesAccount']['find']({'where':{'id':_0x33c25e[_0x0514('0x49')]['id']}})[_0x0514('0x28')](handleEntityNotFound(_0x907be,null))[_0x0514('0x28')](removeEntity(_0x907be,null))[_0x0514('0x47')](handleError(_0x907be,null));};exports[_0x0514('0x50')]=function(_0x72c032,_0x1962c0,_0x289f61){var _0x461324={};var _0x89c869={};var _0x8c41ac;var _0x28d54d;return db[_0x0514('0x2f')][_0x0514('0x51')]({'where':{'id':_0x72c032[_0x0514('0x49')]['id']}})[_0x0514('0x28')](handleEntityNotFound(_0x1962c0,null))[_0x0514('0x28')](function(_0x1df0b6){if(_0x1df0b6){_0x8c41ac=_0x1df0b6;_0x89c869[_0x0514('0x32')]=_[_0x0514('0x4a')](db[_0x0514('0x52')][_0x0514('0x30')]);_0x89c869['query']=_[_0x0514('0x4a')](_0x72c032['query']);_0x89c869[_0x0514('0x34')]=_['intersection'](_0x89c869[_0x0514('0x32')],_0x89c869['query']);_0x461324[_0x0514('0x36')]=_[_0x0514('0x35')](_0x89c869[_0x0514('0x32')],qs[_0x0514('0x37')](_0x72c032['query']['fields']));_0x461324[_0x0514('0x36')]=_0x461324[_0x0514('0x36')][_0x0514('0x38')]?_0x461324[_0x0514('0x36')]:_0x89c869[_0x0514('0x32')];_0x461324[_0x0514('0x3b')]=qs[_0x0514('0x3c')](_0x72c032[_0x0514('0x33')][_0x0514('0x3c')]);_0x461324['where']=qs['filters'](_[_0x0514('0x3d')](_0x72c032[_0x0514('0x33')],_0x89c869['filters']));if(_0x72c032[_0x0514('0x33')][_0x0514('0x41')]){_0x461324[_0x0514('0x3e')]=_[_0x0514('0x42')](_0x461324[_0x0514('0x3e')],{'$or':_[_0x0514('0x2e')](_0x461324[_0x0514('0x36')],function(_0x225774){var _0x1463a4={};_0x1463a4[_0x225774]={'$like':'%'+_0x72c032[_0x0514('0x33')][_0x0514('0x41')]+'%'};return _0x1463a4;})});}_0x461324=_[_0x0514('0x42')]({},_0x461324,_0x72c032[_0x0514('0x43')]);return _0x8c41ac['getConfigurations'](_0x461324);}})['then'](function(_0x4d8318){if(_0x4d8318){_0x28d54d=_0x4d8318[_0x0514('0x38')];if(!_0x72c032['query']['hasOwnProperty'](_0x0514('0x3a'))){_0x461324[_0x0514('0x21')]=qs[_0x0514('0x21')](_0x72c032[_0x0514('0x33')][_0x0514('0x21')]);_0x461324[_0x0514('0x20')]=qs['offset'](_0x72c032['query'][_0x0514('0x20')]);}return _0x8c41ac[_0x0514('0x50')](_0x461324);}})[_0x0514('0x28')](function(_0x34659c){if(_0x34659c){return _0x34659c?{'count':_0x28d54d,'rows':_0x34659c}:null;}})[_0x0514('0x28')](respondWithResult(_0x1962c0,null))[_0x0514('0x47')](handleError(_0x1962c0,null));};exports['addConfiguration']=function(_0x2bbca1,_0x26bc29,_0x4d325c){if(_0x2bbca1[_0x0514('0x4d')]['id']){delete _0x2bbca1[_0x0514('0x4d')]['id'];}return db[_0x0514('0x2f')][_0x0514('0x51')]({'where':{'id':_0x2bbca1['params']['id']}})[_0x0514('0x28')](handleEntityNotFound(_0x26bc29,null))[_0x0514('0x28')](function(_0x3227d9){if(_0x3227d9){_0x2bbca1[_0x0514('0x4d')][_0x0514('0x53')]=_0x3227d9['id'];_0x2bbca1[_0x0514('0x4d')][_0x0514('0x54')]=integrations[_0x0514('0x55')](_0x2bbca1[_0x0514('0x4d')][_0x0514('0x56')],_0x2bbca1[_0x0514('0x4d')][_0x0514('0x3f')]);_0x2bbca1['body'][_0x0514('0x57')]=integrations[_0x0514('0x58')](_0x2bbca1[_0x0514('0x4d')]['channel'],_0x2bbca1[_0x0514('0x4d')][_0x0514('0x3f')]);return db['FreshsalesConfiguration'][_0x0514('0x4c')](_0x2bbca1['body'],{'include':[{'model':db[_0x0514('0x59')],'as':'Subjects'},{'model':db[_0x0514('0x59')],'as':_0x0514('0x57')}]});}return null;})[_0x0514('0x28')](respondWithResult(_0x26bc29,null))['catch'](handleError(_0x26bc29,null));};exports['getFields']=function(_0x53ed84,_0x592bef,_0x20be4c){var _0x7f9ee2='';var _0x3ffc60='';return db[_0x0514('0x2f')]['findOne']({'where':{'id':_0x53ed84[_0x0514('0x49')]['id']},'attributes':['id','username',_0x0514('0x5a'),_0x0514('0x5b')]})[_0x0514('0x28')](handleEntityNotFound(_0x592bef,null))[_0x0514('0x28')](function(_0x6ebfc){if(_0x6ebfc){_0x3ffc60=_0x6ebfc['username'];_0x7f9ee2=_0x6ebfc['remoteUri'];var _0x5e7c72=_0x6ebfc[_0x0514('0x5a')][_0x0514('0x5c')](-0x1);if(_0x5e7c72==='/'){_0x7f9ee2=_0x7f9ee2[_0x0514('0x5d')](0x0,_0x7f9ee2[_0x0514('0x5e')](_0x5e7c72));}return rp({'method':_0x0514('0x5f'),'uri':util[_0x0514('0x60')](_0x0514('0x61'),_0x7f9ee2,_0x0514('0x62')),'headers':{'Authorization':_0x0514('0x63')+_0x6ebfc['apiKey']},'json':!![]});}})[_0x0514('0x28')](function(_0xb50d67){if(_0xb50d67){var _0xfd44f8=_0xb50d67[_0x0514('0x64')];var _0x1c1861=![];var _0x3f877b=null;for(_0x3f877b=0x0;_0x3f877b<_0xfd44f8[_0x0514('0x38')];_0x3f877b++){if(_0xfd44f8[_0x3f877b]['email']===_0x3ffc60){_0x1c1861=!![];}}if(_0x1c1861){return!![];}else{throw new Error({'statusCode':0x194,'message':_0x0514('0x65')});}}})[_0x0514('0x28')](respondWithResult(_0x592bef,null))[_0x0514('0x47')](function(_0x1e4646){var _0xc244d8=_0x53ed84[_0x0514('0x33')][_0x0514('0x66')]?0x1f4:_0x1e4646[_0x0514('0x67')]||0x1f4;logger[_0x0514('0x29')](_0x0514('0x68'),_0x0514('0x69'),_0xc244d8,JSON[_0x0514('0x6a')](_0x1e4646));delete _0x1e4646[_0x0514('0x2a')];if(_0xc244d8===0x191){_0xc244d8=0x190;}_0x592bef[_0x0514('0x2b')](_0xc244d8)[_0x0514('0x2c')](_0x53ed84['query']['test']?{'message':_0x0514('0x6b'),'statusCode':_0x1e4646[_0x0514('0x67')]}:_0x1e4646);});}; \ No newline at end of file diff --git a/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js b/server/api/intFreshsalesAccount/intFreshsalesAccount.model.js index ba9f8ea..f3b685d 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 _0x57ca=['exports','define','FreshsalesAccount','int_freshsales_accounts','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x57ca,0x108));var _0xa57c=function(_0x4d5c75,_0x10460a){_0x4d5c75=_0x4d5c75-0x0;var _0x939022=_0x57ca[_0x4d5c75];return _0x939022;};'use strict';var _=require('lodash');var util=require(_0xa57c('0x0'));var logger=require(_0xa57c('0x1'))('api');var moment=require(_0xa57c('0x2'));var BPromise=require(_0xa57c('0x3'));var rp=require(_0xa57c('0x4'));var fs=require('fs');var path=require(_0xa57c('0x5'));var rimraf=require(_0xa57c('0x6'));var config=require('../../config/environment');var attributes=require(_0xa57c('0x7'));var integrations=require(_0xa57c('0x8'));module[_0xa57c('0x9')]=function(_0x19473f,_0xbdfffb){return _0x19473f[_0xa57c('0xa')](_0xa57c('0xb'),attributes,{'tableName':_0xa57c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xacf4=['define','FreshsalesAccount','int_freshsales_accounts','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./intFreshsalesAccount.attributes','../../components/integrations/configuration'];(function(_0x35a452,_0x468728){var _0x4efd5b=function(_0x3ce6b5){while(--_0x3ce6b5){_0x35a452['push'](_0x35a452['shift']());}};_0x4efd5b(++_0x468728);}(_0xacf4,0xe7));var _0x4acf=function(_0x4ebb35,_0x343261){_0x4ebb35=_0x4ebb35-0x0;var _0x3b3d66=_0xacf4[_0x4ebb35];return _0x3b3d66;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x4acf('0x0'))(_0x4acf('0x1'));var moment=require(_0x4acf('0x2'));var BPromise=require(_0x4acf('0x3'));var rp=require(_0x4acf('0x4'));var fs=require('fs');var path=require(_0x4acf('0x5'));var rimraf=require(_0x4acf('0x6'));var config=require('../../config/environment');var attributes=require(_0x4acf('0x7'));var integrations=require(_0x4acf('0x8'));module['exports']=function(_0x24bf24,_0x2ba08a){return _0x24bf24[_0x4acf('0x9')](_0x4acf('0xa'),attributes,{'tableName':_0x4acf('0xb'),'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 1a48193..0130534 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 _0xfcf0=['request','info','FreshsalesAccount,\x20%s,\x20%s','debug','request\x20sent','stringify','error','message','result','GetFreshsalesAccount','findAll','options','raw','where','attributes','limit','include','map','model','then','FreshsalesAccount','find','ShowFreshsalesAccount','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x2819dd,_0x5f0b77){var _0x3ac379=function(_0x3d7a85){while(--_0x3d7a85){_0x2819dd['push'](_0x2819dd['shift']());}};_0x3ac379(++_0x5f0b77);}(_0xfcf0,0x138));var _0x0fcf=function(_0x53a7a8,_0xed2bff){_0x53a7a8=_0x53a7a8-0x0;var _0x555f71=_0xfcf0[_0x53a7a8];return _0x555f71;};'use strict';var _=require(_0x0fcf('0x0'));var util=require(_0x0fcf('0x1'));var moment=require('moment');var BPromise=require(_0x0fcf('0x2'));var rs=require(_0x0fcf('0x3'));var fs=require('fs');var Redis=require(_0x0fcf('0x4'));var db=require(_0x0fcf('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x0fcf('0x6'))(_0x0fcf('0x7'));var config=require(_0x0fcf('0x8'));var jayson=require(_0x0fcf('0x9'));var client=jayson[_0x0fcf('0xa')][_0x0fcf('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x61bbb9,_0x2dfdf8,_0x50c575){return new BPromise(function(_0x1388d1,_0x6ced94){return client[_0x0fcf('0xc')](_0x61bbb9,_0x50c575)['then'](function(_0x69a840){logger[_0x0fcf('0xd')](_0x0fcf('0xe'),_0x2dfdf8,'request\x20sent');logger[_0x0fcf('0xf')]('FreshsalesAccount,\x20%s,\x20%s,\x20%s',_0x2dfdf8,_0x0fcf('0x10'),JSON[_0x0fcf('0x11')](_0x69a840));if(_0x69a840[_0x0fcf('0x12')]){if(_0x69a840['error']['code']===0x1f4){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x6ced94(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x69a840['error'][_0x0fcf('0x13')]);return _0x1388d1(_0x69a840[_0x0fcf('0x12')][_0x0fcf('0x13')]);}else{logger['info'](_0x0fcf('0xe'),_0x2dfdf8,_0x0fcf('0x10'));_0x1388d1(_0x69a840[_0x0fcf('0x14')][_0x0fcf('0x13')]);}})['catch'](function(_0x3e78d0){logger[_0x0fcf('0x12')](_0x0fcf('0xe'),_0x2dfdf8,_0x3e78d0);_0x6ced94(_0x3e78d0);});});}exports[_0x0fcf('0x15')]=function(_0x19cfbd){var _0x567320=this;return new Promise(function(_0x18ea32,_0x1a8f58){return db['FreshsalesAccount'][_0x0fcf('0x16')]({'raw':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd['options'][_0x0fcf('0x18')]===undefined?!![]:![]:!![],'where':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x19')]||null:null,'attributes':_0x19cfbd['options']?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x1a')]||null:null,'limit':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd['options'][_0x0fcf('0x1b')]||null:null,'include':_0x19cfbd[_0x0fcf('0x17')]?_0x19cfbd[_0x0fcf('0x17')][_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x19cfbd[_0x0fcf('0x17')]['include'],function(_0x2eef74){return{'model':db[_0x2eef74[_0x0fcf('0x1e')]],'as':_0x2eef74['as'],'attributes':_0x2eef74[_0x0fcf('0x1a')],'include':_0x2eef74[_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x2eef74[_0x0fcf('0x1c')],function(_0x2ce990){return{'model':db[_0x2ce990[_0x0fcf('0x1e')]],'as':_0x2ce990['as'],'attributes':_0x2ce990[_0x0fcf('0x1a')],'include':_0x2ce990['include']?_[_0x0fcf('0x1d')](_0x2ce990[_0x0fcf('0x1c')],function(_0x41b7a2){return{'model':db[_0x41b7a2[_0x0fcf('0x1e')]],'as':_0x41b7a2['as'],'attributes':_0x41b7a2[_0x0fcf('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x0fcf('0x1f')](function(_0x2730b0){logger['info'](_0x0fcf('0x15'),_0x19cfbd);logger[_0x0fcf('0xf')](_0x0fcf('0x15'),_0x19cfbd,JSON[_0x0fcf('0x11')](_0x2730b0));_0x18ea32(_0x2730b0);})['catch'](function(_0x5d9bcd){logger['error'](_0x0fcf('0x15'),_0x5d9bcd['message'],_0x19cfbd);_0x1a8f58(_0x567320[_0x0fcf('0x12')](0x1f4,_0x5d9bcd[_0x0fcf('0x13')]));});});};exports['ShowFreshsalesAccount']=function(_0xdfd3ec){var _0x117041=this;return new Promise(function(_0xa52f52,_0x161496){return db[_0x0fcf('0x20')][_0x0fcf('0x21')]({'raw':_0xdfd3ec['options']?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x18')]===undefined?!![]:![]:!![],'where':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x19')]||null:null,'attributes':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec['options'][_0x0fcf('0x1a')]||null:null,'include':_0xdfd3ec[_0x0fcf('0x17')]?_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0xdfd3ec[_0x0fcf('0x17')][_0x0fcf('0x1c')],function(_0x344957){return{'model':db[_0x344957[_0x0fcf('0x1e')]],'as':_0x344957['as'],'attributes':_0x344957[_0x0fcf('0x1a')],'include':_0x344957[_0x0fcf('0x1c')]?_[_0x0fcf('0x1d')](_0x344957[_0x0fcf('0x1c')],function(_0x17346e){return{'model':db[_0x17346e['model']],'as':_0x17346e['as'],'attributes':_0x17346e['attributes'],'include':_0x17346e[_0x0fcf('0x1c')]?_['map'](_0x17346e['include'],function(_0x1a1e07){return{'model':db[_0x1a1e07[_0x0fcf('0x1e')]],'as':_0x1a1e07['as'],'attributes':_0x1a1e07[_0x0fcf('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x57e635){logger[_0x0fcf('0xd')](_0x0fcf('0x22'),_0xdfd3ec);logger[_0x0fcf('0xf')]('ShowFreshsalesAccount',_0xdfd3ec,JSON[_0x0fcf('0x11')](_0x57e635));_0xa52f52(_0x57e635);})[_0x0fcf('0x23')](function(_0x29067e){logger['error']('ShowFreshsalesAccount',_0x29067e['message'],_0xdfd3ec);_0x161496(_0x117041[_0x0fcf('0x12')](0x1f4,_0x29067e[_0x0fcf('0x13')]));});});}; \ No newline at end of file +var _0x4325=['stringify','code','error','message','info','result','catch','GetFreshsalesAccount','FreshsalesAccount','findAll','options','raw','where','attributes','include','map','model','ShowFreshsalesAccount','find','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','client','http','request','then','FreshsalesAccount,\x20%s,\x20%s','debug','FreshsalesAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x5da0e0,_0x120067){var _0x10bacb=function(_0x260801){while(--_0x260801){_0x5da0e0['push'](_0x5da0e0['shift']());}};_0x10bacb(++_0x120067);}(_0x4325,0x1da));var _0x5432=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x4325[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x5432('0x0'));var util=require(_0x5432('0x1'));var moment=require('moment');var BPromise=require(_0x5432('0x2'));var rs=require(_0x5432('0x3'));var fs=require('fs');var Redis=require(_0x5432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x5432('0x5'))(_0x5432('0x6'));var config=require(_0x5432('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x5432('0x8')][_0x5432('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4a6e76,_0x106ec9,_0x50394d){return new BPromise(function(_0xc8252e,_0x1c9762){return client[_0x5432('0xa')](_0x4a6e76,_0x50394d)[_0x5432('0xb')](function(_0x263a0c){logger['info'](_0x5432('0xc'),_0x106ec9,'request\x20sent');logger[_0x5432('0xd')](_0x5432('0xe'),_0x106ec9,_0x5432('0xf'),JSON[_0x5432('0x10')](_0x263a0c));if(_0x263a0c['error']){if(_0x263a0c['error'][_0x5432('0x11')]===0x1f4){logger[_0x5432('0x12')]('FreshsalesAccount,\x20%s,\x20%s',_0x106ec9,_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);return _0x1c9762(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x263a0c['error']['message']);return _0xc8252e(_0x263a0c[_0x5432('0x12')][_0x5432('0x13')]);}else{logger[_0x5432('0x14')](_0x5432('0xc'),_0x106ec9,_0x5432('0xf'));_0xc8252e(_0x263a0c[_0x5432('0x15')]['message']);}})[_0x5432('0x16')](function(_0x49e8fd){logger[_0x5432('0x12')](_0x5432('0xc'),_0x106ec9,_0x49e8fd);_0x1c9762(_0x49e8fd);});});}exports[_0x5432('0x17')]=function(_0x32fe60){var _0x4221a8=this;return new Promise(function(_0x5f011f,_0x3f3873){return db[_0x5432('0x18')][_0x5432('0x19')]({'raw':_0x32fe60[_0x5432('0x1a')]?_0x32fe60[_0x5432('0x1a')][_0x5432('0x1b')]===undefined?!![]:![]:!![],'where':_0x32fe60[_0x5432('0x1a')]?_0x32fe60['options'][_0x5432('0x1c')]||null:null,'attributes':_0x32fe60[_0x5432('0x1a')]?_0x32fe60[_0x5432('0x1a')][_0x5432('0x1d')]||null:null,'limit':_0x32fe60[_0x5432('0x1a')]?_0x32fe60['options']['limit']||null:null,'include':_0x32fe60['options']?_0x32fe60[_0x5432('0x1a')][_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x32fe60[_0x5432('0x1a')]['include'],function(_0x4af5f4){return{'model':db[_0x4af5f4[_0x5432('0x20')]],'as':_0x4af5f4['as'],'attributes':_0x4af5f4[_0x5432('0x1d')],'include':_0x4af5f4['include']?_[_0x5432('0x1f')](_0x4af5f4[_0x5432('0x1e')],function(_0x637582){return{'model':db[_0x637582['model']],'as':_0x637582['as'],'attributes':_0x637582[_0x5432('0x1d')],'include':_0x637582[_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x637582['include'],function(_0x4ab09d){return{'model':db[_0x4ab09d[_0x5432('0x20')]],'as':_0x4ab09d['as'],'attributes':_0x4ab09d[_0x5432('0x1d')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1abe73){logger[_0x5432('0x14')](_0x5432('0x17'),_0x32fe60);logger['debug'](_0x5432('0x17'),_0x32fe60,JSON['stringify'](_0x1abe73));_0x5f011f(_0x1abe73);})['catch'](function(_0x6fc7f5){logger['error'](_0x5432('0x17'),_0x6fc7f5['message'],_0x32fe60);_0x3f3873(_0x4221a8['error'](0x1f4,_0x6fc7f5[_0x5432('0x13')]));});});};exports[_0x5432('0x21')]=function(_0x345b51){var _0x4e92d5=this;return new Promise(function(_0x31490c,_0x1d436c){return db[_0x5432('0x18')][_0x5432('0x22')]({'raw':_0x345b51[_0x5432('0x1a')]?_0x345b51[_0x5432('0x1a')][_0x5432('0x1b')]===undefined?!![]:![]:!![],'where':_0x345b51[_0x5432('0x1a')]?_0x345b51[_0x5432('0x1a')]['where']||null:null,'attributes':_0x345b51['options']?_0x345b51[_0x5432('0x1a')][_0x5432('0x1d')]||null:null,'include':_0x345b51[_0x5432('0x1a')]?_0x345b51[_0x5432('0x1a')][_0x5432('0x1e')]?_['map'](_0x345b51[_0x5432('0x1a')]['include'],function(_0x2955e0){return{'model':db[_0x2955e0[_0x5432('0x20')]],'as':_0x2955e0['as'],'attributes':_0x2955e0[_0x5432('0x1d')],'include':_0x2955e0[_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x2955e0[_0x5432('0x1e')],function(_0x5c3c77){return{'model':db[_0x5c3c77[_0x5432('0x20')]],'as':_0x5c3c77['as'],'attributes':_0x5c3c77[_0x5432('0x1d')],'include':_0x5c3c77[_0x5432('0x1e')]?_[_0x5432('0x1f')](_0x5c3c77['include'],function(_0xe01f4b){return{'model':db[_0xe01f4b[_0x5432('0x20')]],'as':_0xe01f4b['as'],'attributes':_0xe01f4b[_0x5432('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x5432('0xb')](function(_0x3fb586){logger[_0x5432('0x14')](_0x5432('0x21'),_0x345b51);logger[_0x5432('0xd')](_0x5432('0x21'),_0x345b51,JSON[_0x5432('0x10')](_0x3fb586));_0x31490c(_0x3fb586);})[_0x5432('0x16')](function(_0x1f4679){logger[_0x5432('0x12')](_0x5432('0x21'),_0x1f4679['message'],_0x345b51);_0x1d436c(_0x4e92d5[_0x5432('0x12')](0x1f4,_0x1f4679['message']));});});}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/index.js b/server/api/intFreshsalesConfiguration/index.js index 0958a8d..6d256a7 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 _0x3273=['isAuthenticated','/:id','show','get','/:id/subjects','getSubjects','getDescriptions','post','create','put','update','delete','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intFreshsalesConfiguration.controller'];(function(_0xf5d35b,_0x3d061f){var _0x11434e=function(_0x3a048a){while(--_0x3a048a){_0xf5d35b['push'](_0xf5d35b['shift']());}};_0x11434e(++_0x3d061f);}(_0x3273,0x139));var _0x3327=function(_0x512980,_0x401e50){_0x512980=_0x512980-0x0;var _0x571f0a=_0x3273[_0x512980];return _0x571f0a;};'use strict';var multer=require('multer');var util=require(_0x3327('0x0'));var path=require(_0x3327('0x1'));var timeout=require('connect-timeout');var express=require(_0x3327('0x2'));var router=express[_0x3327('0x3')]();var fs_extra=require(_0x3327('0x4'));var auth=require(_0x3327('0x5'));var interaction=require(_0x3327('0x6'));var config=require(_0x3327('0x7'));var controller=require(_0x3327('0x8'));router['get']('/',auth[_0x3327('0x9')](),controller['index']);router['get'](_0x3327('0xa'),auth[_0x3327('0x9')](),controller[_0x3327('0xb')]);router[_0x3327('0xc')](_0x3327('0xd'),auth[_0x3327('0x9')](),controller[_0x3327('0xe')]);router[_0x3327('0xc')]('/:id/descriptions',auth[_0x3327('0x9')](),controller[_0x3327('0xf')]);router[_0x3327('0xc')]('/:id/fields',auth[_0x3327('0x9')](),controller['getFields']);router[_0x3327('0x10')]('/',auth['isAuthenticated'](),controller[_0x3327('0x11')]);router[_0x3327('0x12')](_0x3327('0xa'),auth[_0x3327('0x9')](),controller[_0x3327('0x13')]);router[_0x3327('0x14')](_0x3327('0xa'),auth['isAuthenticated'](),controller[_0x3327('0x15')]);module[_0x3327('0x16')]=router; \ No newline at end of file +var _0xc7cb=['getDescriptions','/:id/fields','getFields','delete','destroy','exports','multer','express','Router','fs-extra','../../config/environment','./intFreshsalesConfiguration.controller','get','isAuthenticated','index','/:id','/:id/subjects','/:id/descriptions'];(function(_0x43a6e0,_0x1ab68f){var _0x509255=function(_0x3b83df){while(--_0x3b83df){_0x43a6e0['push'](_0x43a6e0['shift']());}};_0x509255(++_0x1ab68f);}(_0xc7cb,0x96));var _0xbc7c=function(_0x52f4cf,_0x514533){_0x52f4cf=_0x52f4cf-0x0;var _0x2db42e=_0xc7cb[_0x52f4cf];return _0x2db42e;};'use strict';var multer=require(_0xbc7c('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbc7c('0x1'));var router=express[_0xbc7c('0x2')]();var fs_extra=require(_0xbc7c('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbc7c('0x4'));var controller=require(_0xbc7c('0x5'));router[_0xbc7c('0x6')]('/',auth[_0xbc7c('0x7')](),controller[_0xbc7c('0x8')]);router[_0xbc7c('0x6')](_0xbc7c('0x9'),auth[_0xbc7c('0x7')](),controller['show']);router['get'](_0xbc7c('0xa'),auth[_0xbc7c('0x7')](),controller['getSubjects']);router[_0xbc7c('0x6')](_0xbc7c('0xb'),auth[_0xbc7c('0x7')](),controller[_0xbc7c('0xc')]);router[_0xbc7c('0x6')](_0xbc7c('0xd'),auth[_0xbc7c('0x7')](),controller[_0xbc7c('0xe')]);router['post']('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xbc7c('0x9'),auth[_0xbc7c('0x7')](),controller['update']);router[_0xbc7c('0xf')]('/:id',auth[_0xbc7c('0x7')](),controller[_0xbc7c('0x10')]);module[_0xbc7c('0x11')]=router; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.attributes.js index 74b948c..14c1429 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 _0x215c=['exports','STRING'];(function(_0x1333bc,_0x5ac8af){var _0x572021=function(_0x3cc36b){while(--_0x3cc36b){_0x1333bc['push'](_0x1333bc['shift']());}};_0x572021(++_0x5ac8af);}(_0x215c,0xc0));var _0xc215=function(_0x3de4b2,_0x2b1cb8){_0x3de4b2=_0x3de4b2-0x0;var _0x57ca15=_0x215c[_0x3de4b2];return _0x57ca15;};'use strict';var Sequelize=require('sequelize');module[_0xc215('0x0')]={'name':{'type':Sequelize[_0xc215('0x1')]},'description':{'type':Sequelize[_0xc215('0x1')]}}; \ No newline at end of file +var _0xed00=['exports','STRING','sequelize'];(function(_0x3f2a90,_0x50baf1){var _0xb46279=function(_0x5e47b5){while(--_0x5e47b5){_0x3f2a90['push'](_0x3f2a90['shift']());}};_0xb46279(++_0x50baf1);}(_0xed00,0x80));var _0x0ed0=function(_0x3050ca,_0x3e36b0){_0x3050ca=_0x3050ca-0x0;var _0x1eed1d=_0xed00[_0x3050ca];return _0x1eed1d;};'use strict';var Sequelize=require(_0x0ed0('0x0'));module[_0x0ed0('0x1')]={'name':{'type':Sequelize[_0x0ed0('0x2')]},'description':{'type':Sequelize[_0x0ed0('0x2')]}}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.controller.js index 42bbb5a..53bf55f 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 _0xd8ca=['model','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','rows','catch','fields','create','body','find','params','getSubjects','FreshsalesField','nolimit','getDescriptions','filter','getFields','findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','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/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','FreshsalesConfiguration','rawAttributes','fieldName','type','key','keys','query','filters','intersection','attributes','length'];(function(_0x13effd,_0x250245){var _0x497661=function(_0x11b921){while(--_0x11b921){_0x13effd['push'](_0x13effd['shift']());}};_0x497661(++_0x250245);}(_0xd8ca,0xc3));var _0xad8c=function(_0xe51920,_0x4a1092){_0xe51920=_0xe51920-0x0;var _0x4e4c70=_0xd8ca[_0xe51920];return _0x4e4c70;};'use strict';var emlformat=require(_0xad8c('0x0'));var rimraf=require(_0xad8c('0x1'));var zipdir=require(_0xad8c('0x2'));var jsonpatch=require(_0xad8c('0x3'));var rp=require(_0xad8c('0x4'));var moment=require(_0xad8c('0x5'));var BPromise=require(_0xad8c('0x6'));var Mustache=require('mustache');var util=require(_0xad8c('0x7'));var path=require(_0xad8c('0x8'));var sox=require(_0xad8c('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xad8c('0xa'));var _=require(_0xad8c('0xb'));var squel=require(_0xad8c('0xc'));var crypto=require(_0xad8c('0xd'));var jsforce=require(_0xad8c('0xe'));var deskjs=require(_0xad8c('0xf'));var toCsv=require(_0xad8c('0x10'));var querystring=require(_0xad8c('0x11'));var Papa=require(_0xad8c('0x12'));var Redis=require(_0xad8c('0x13'));var authService=require(_0xad8c('0x14'));var qs=require(_0xad8c('0x15'));var as=require(_0xad8c('0x16'));var hardwareService=require(_0xad8c('0x17'));var logger=require('../../config/logger')('api');var utils=require(_0xad8c('0x18'));var config=require(_0xad8c('0x19'));var licenseUtil=require(_0xad8c('0x1a'));var db=require(_0xad8c('0x1b'))['db'];function respondWithStatusCode(_0x152b21,_0xa3e1fe){_0xa3e1fe=_0xa3e1fe||0xcc;return function(_0x39e7fb){if(_0x39e7fb){return _0x152b21[_0xad8c('0x1c')](_0xa3e1fe);}return _0x152b21['status'](_0xa3e1fe)[_0xad8c('0x1d')]();};}function respondWithResult(_0x29b765,_0x1f597f){_0x1f597f=_0x1f597f||0xc8;return function(_0x2e5020){if(_0x2e5020){return _0x29b765[_0xad8c('0x1e')](_0x1f597f)[_0xad8c('0x1f')](_0x2e5020);}};}function respondWithFilteredResult(_0x24344c,_0x255954){return function(_0x4db4af){if(_0x4db4af){var _0x383fa6=typeof _0x255954[_0xad8c('0x20')]===_0xad8c('0x21')&&typeof _0x255954['limit']===_0xad8c('0x21');var _0x3da9b3=_0x4db4af[_0xad8c('0x22')];var _0x448bb9=_0x383fa6?0x0:_0x255954[_0xad8c('0x20')];var _0x224868=_0x383fa6?_0x4db4af[_0xad8c('0x22')]:_0x255954[_0xad8c('0x20')]+_0x255954[_0xad8c('0x23')];var _0x36086d;if(_0x224868>=_0x3da9b3){_0x224868=_0x3da9b3;_0x36086d=0xc8;}else{_0x36086d=0xce;}_0x24344c['status'](_0x36086d);return _0x24344c[_0xad8c('0x24')]('Content-Range',_0x448bb9+'-'+_0x224868+'/'+_0x3da9b3)[_0xad8c('0x1f')](_0x4db4af);}return null;};}function patchUpdates(_0x388751){return function(_0x4fbbec){try{jsonpatch[_0xad8c('0x25')](_0x4fbbec,_0x388751,!![]);}catch(_0x24a2f1){return BPromise[_0xad8c('0x26')](_0x24a2f1);}return _0x4fbbec[_0xad8c('0x27')]();};}function saveUpdates(_0x58b732,_0x36fe30){return function(_0x1f3104){if(_0x1f3104){return _0x1f3104[_0xad8c('0x28')](_0x58b732)['then'](function(_0x463429){return _0x463429;});}return null;};}function removeEntity(_0x4b0a6b,_0x254c4f){return function(_0x5ac9cc){if(_0x5ac9cc){return _0x5ac9cc[_0xad8c('0x29')]()[_0xad8c('0x2a')](function(){_0x4b0a6b[_0xad8c('0x1e')](0xcc)[_0xad8c('0x1d')]();});}};}function handleEntityNotFound(_0x3e1313,_0x57110f){return function(_0x471fb1){if(!_0x471fb1){_0x3e1313[_0xad8c('0x1c')](0x194);}return _0x471fb1;};}function handleError(_0x3dbefc,_0x3befda){_0x3befda=_0x3befda||0x1f4;return function(_0x4548c1){logger[_0xad8c('0x2b')](_0x4548c1[_0xad8c('0x2c')]);if(_0x4548c1['name']){delete _0x4548c1[_0xad8c('0x2d')];}_0x3dbefc['status'](_0x3befda)[_0xad8c('0x2e')](_0x4548c1);};}exports[_0xad8c('0x2f')]=function(_0x222f83,_0x1f4bc8){var _0xd6df59={},_0x20cb61={},_0x24b8c7={'count':0x0,'rows':[]};var _0x1fc887=_[_0xad8c('0x30')](db[_0xad8c('0x31')][_0xad8c('0x32')],function(_0x2391a6){return{'name':_0x2391a6[_0xad8c('0x33')],'type':_0x2391a6[_0xad8c('0x34')][_0xad8c('0x35')]};});_0x20cb61['model']=_[_0xad8c('0x30')](_0x1fc887,_0xad8c('0x2d'));_0x20cb61['query']=_[_0xad8c('0x36')](_0x222f83[_0xad8c('0x37')]);_0x20cb61[_0xad8c('0x38')]=_[_0xad8c('0x39')](_0x20cb61['model'],_0x20cb61['query']);_0xd6df59[_0xad8c('0x3a')]=_[_0xad8c('0x39')](_0x20cb61['model'],qs['fields'](_0x222f83['query']['fields']));_0xd6df59[_0xad8c('0x3a')]=_0xd6df59['attributes'][_0xad8c('0x3b')]?_0xd6df59['attributes']:_0x20cb61[_0xad8c('0x3c')];if(!_0x222f83[_0xad8c('0x37')][_0xad8c('0x3d')]('nolimit')){_0xd6df59['limit']=qs['limit'](_0x222f83[_0xad8c('0x37')][_0xad8c('0x23')]);_0xd6df59[_0xad8c('0x20')]=qs[_0xad8c('0x20')](_0x222f83[_0xad8c('0x37')][_0xad8c('0x20')]);}_0xd6df59[_0xad8c('0x3e')]=qs[_0xad8c('0x3f')](_0x222f83[_0xad8c('0x37')][_0xad8c('0x3f')]);_0xd6df59[_0xad8c('0x40')]=qs[_0xad8c('0x38')](_[_0xad8c('0x41')](_0x222f83[_0xad8c('0x37')],_0x20cb61[_0xad8c('0x38')]),_0x1fc887);if(_0x222f83['query']['filter']){_0xd6df59[_0xad8c('0x40')]=_[_0xad8c('0x42')](_0xd6df59[_0xad8c('0x40')],{'$or':_[_0xad8c('0x30')](_0x1fc887,function(_0x387c75){if(_0x387c75[_0xad8c('0x34')]!==_0xad8c('0x43')){var _0x1410f3={};_0x1410f3[_0x387c75['name']]={'$like':'%'+_0x222f83['query']['filter']+'%'};return _0x1410f3;}})});}_0xd6df59=_[_0xad8c('0x42')]({},_0xd6df59,_0x222f83[_0xad8c('0x44')]);var _0x4b271a={'where':_0xd6df59['where']};return db[_0xad8c('0x31')][_0xad8c('0x22')](_0x4b271a)[_0xad8c('0x2a')](function(_0x5a5537){_0x24b8c7['count']=_0x5a5537;if(_0x222f83[_0xad8c('0x37')][_0xad8c('0x45')]){_0xd6df59[_0xad8c('0x46')]=[{'all':!![]}];}return db[_0xad8c('0x31')]['findAll'](_0xd6df59);})[_0xad8c('0x2a')](function(_0x21826f){_0x24b8c7[_0xad8c('0x47')]=_0x21826f;return _0x24b8c7;})[_0xad8c('0x2a')](respondWithFilteredResult(_0x1f4bc8,_0xd6df59))[_0xad8c('0x48')](handleError(_0x1f4bc8,null));};exports['show']=function(_0x374cd8,_0x5316a7){var _0x11c978={'raw':![],'where':{'id':_0x374cd8['params']['id']}},_0x460527={};_0x460527[_0xad8c('0x3c')]=_['keys'](db['FreshsalesConfiguration']['rawAttributes']);_0x460527[_0xad8c('0x37')]=_[_0xad8c('0x36')](_0x374cd8['query']);_0x460527[_0xad8c('0x38')]=_[_0xad8c('0x39')](_0x460527['model'],_0x460527['query']);_0x11c978[_0xad8c('0x3a')]=_['intersection'](_0x460527['model'],qs[_0xad8c('0x49')](_0x374cd8[_0xad8c('0x37')][_0xad8c('0x49')]));_0x11c978['attributes']=_0x11c978['attributes'][_0xad8c('0x3b')]?_0x11c978[_0xad8c('0x3a')]:_0x460527[_0xad8c('0x3c')];if(_0x374cd8[_0xad8c('0x37')][_0xad8c('0x45')]){_0x11c978[_0xad8c('0x46')]=[{'all':!![]}];}_0x11c978=_[_0xad8c('0x42')]({},_0x11c978,_0x374cd8[_0xad8c('0x44')]);return db[_0xad8c('0x31')]['find'](_0x11c978)[_0xad8c('0x2a')](handleEntityNotFound(_0x5316a7,null))[_0xad8c('0x2a')](respondWithResult(_0x5316a7,null))[_0xad8c('0x48')](handleError(_0x5316a7,null));};exports[_0xad8c('0x4a')]=function(_0x3470da,_0xe65279){return db[_0xad8c('0x31')]['create'](_0x3470da['body'],{})[_0xad8c('0x2a')](respondWithResult(_0xe65279,0xc9))[_0xad8c('0x48')](handleError(_0xe65279,null));};exports['update']=function(_0x4c4b65,_0x20cf16){if(_0x4c4b65['body']['id']){delete _0x4c4b65[_0xad8c('0x4b')]['id'];}return db['FreshsalesConfiguration'][_0xad8c('0x4c')]({'where':{'id':_0x4c4b65['params']['id']}})[_0xad8c('0x2a')](handleEntityNotFound(_0x20cf16,null))[_0xad8c('0x2a')](saveUpdates(_0x4c4b65[_0xad8c('0x4b')],null))[_0xad8c('0x2a')](respondWithResult(_0x20cf16,null))['catch'](handleError(_0x20cf16,null));};exports['destroy']=function(_0x40f239,_0x441338){return db['FreshsalesConfiguration'][_0xad8c('0x4c')]({'where':{'id':_0x40f239[_0xad8c('0x4d')]['id']}})[_0xad8c('0x2a')](handleEntityNotFound(_0x441338,null))[_0xad8c('0x2a')](removeEntity(_0x441338,null))['catch'](handleError(_0x441338,null));};exports[_0xad8c('0x4e')]=function(_0x5aed31,_0x120dc2,_0x111915){var _0x1c57ef={};var _0x5f56fd={};var _0x331dae;var _0x36d14e;return db['FreshsalesConfiguration']['findOne']({'where':{'id':_0x5aed31['params']['id']}})[_0xad8c('0x2a')](handleEntityNotFound(_0x120dc2,null))['then'](function(_0xc798dc){if(_0xc798dc){_0x331dae=_0xc798dc;_0x5f56fd[_0xad8c('0x3c')]=_[_0xad8c('0x36')](db[_0xad8c('0x4f')][_0xad8c('0x32')]);_0x5f56fd['query']=_['keys'](_0x5aed31[_0xad8c('0x37')]);_0x5f56fd['filters']=_[_0xad8c('0x39')](_0x5f56fd['model'],_0x5f56fd[_0xad8c('0x37')]);_0x1c57ef[_0xad8c('0x3a')]=_[_0xad8c('0x39')](_0x5f56fd[_0xad8c('0x3c')],qs['fields'](_0x5aed31['query'][_0xad8c('0x49')]));_0x1c57ef[_0xad8c('0x3a')]=_0x1c57ef[_0xad8c('0x3a')][_0xad8c('0x3b')]?_0x1c57ef[_0xad8c('0x3a')]:_0x5f56fd[_0xad8c('0x3c')];_0x1c57ef[_0xad8c('0x3e')]=qs['sort'](_0x5aed31[_0xad8c('0x37')][_0xad8c('0x3f')]);_0x1c57ef['where']=qs[_0xad8c('0x38')](_['pick'](_0x5aed31[_0xad8c('0x37')],_0x5f56fd[_0xad8c('0x38')]));if(_0x5aed31[_0xad8c('0x37')]['filter']){_0x1c57ef[_0xad8c('0x40')]=_['merge'](_0x1c57ef[_0xad8c('0x40')],{'$or':_[_0xad8c('0x30')](_0x1c57ef['attributes'],function(_0x15840a){var _0xab4eac={};_0xab4eac[_0x15840a]={'$like':'%'+_0x5aed31[_0xad8c('0x37')]['filter']+'%'};return _0xab4eac;})});}_0x1c57ef=_[_0xad8c('0x42')]({},_0x1c57ef,_0x5aed31[_0xad8c('0x44')]);return _0x331dae[_0xad8c('0x4e')](_0x1c57ef);}})['then'](function(_0x30375e){if(_0x30375e){_0x36d14e=_0x30375e[_0xad8c('0x3b')];if(!_0x5aed31['query'][_0xad8c('0x3d')](_0xad8c('0x50'))){_0x1c57ef['limit']=qs[_0xad8c('0x23')](_0x5aed31[_0xad8c('0x37')][_0xad8c('0x23')]);_0x1c57ef[_0xad8c('0x20')]=qs[_0xad8c('0x20')](_0x5aed31[_0xad8c('0x37')][_0xad8c('0x20')]);}return _0x331dae[_0xad8c('0x4e')](_0x1c57ef);}})[_0xad8c('0x2a')](function(_0x4cb586){if(_0x4cb586){return _0x4cb586?{'count':_0x36d14e,'rows':_0x4cb586}:null;}})['then'](respondWithResult(_0x120dc2,null))[_0xad8c('0x48')](handleError(_0x120dc2,null));};exports[_0xad8c('0x51')]=function(_0x253ed1,_0x1a5758,_0x378e11){var _0xf63cbd={};var _0x218156={};var _0x35f3aa;var _0x53c744;return db[_0xad8c('0x31')]['findOne']({'where':{'id':_0x253ed1['params']['id']}})['then'](handleEntityNotFound(_0x1a5758,null))[_0xad8c('0x2a')](function(_0x28aa97){if(_0x28aa97){_0x35f3aa=_0x28aa97;_0x218156[_0xad8c('0x3c')]=_['keys'](db[_0xad8c('0x4f')]['rawAttributes']);_0x218156[_0xad8c('0x37')]=_[_0xad8c('0x36')](_0x253ed1[_0xad8c('0x37')]);_0x218156['filters']=_[_0xad8c('0x39')](_0x218156[_0xad8c('0x3c')],_0x218156[_0xad8c('0x37')]);_0xf63cbd[_0xad8c('0x3a')]=_['intersection'](_0x218156['model'],qs[_0xad8c('0x49')](_0x253ed1[_0xad8c('0x37')]['fields']));_0xf63cbd[_0xad8c('0x3a')]=_0xf63cbd[_0xad8c('0x3a')][_0xad8c('0x3b')]?_0xf63cbd[_0xad8c('0x3a')]:_0x218156[_0xad8c('0x3c')];_0xf63cbd[_0xad8c('0x3e')]=qs['sort'](_0x253ed1[_0xad8c('0x37')][_0xad8c('0x3f')]);_0xf63cbd[_0xad8c('0x40')]=qs['filters'](_[_0xad8c('0x41')](_0x253ed1[_0xad8c('0x37')],_0x218156['filters']));if(_0x253ed1[_0xad8c('0x37')]['filter']){_0xf63cbd[_0xad8c('0x40')]=_[_0xad8c('0x42')](_0xf63cbd['where'],{'$or':_['map'](_0xf63cbd[_0xad8c('0x3a')],function(_0x28e75f){var _0x10c755={};_0x10c755[_0x28e75f]={'$like':'%'+_0x253ed1[_0xad8c('0x37')][_0xad8c('0x52')]+'%'};return _0x10c755;})});}_0xf63cbd=_[_0xad8c('0x42')]({},_0xf63cbd,_0x253ed1[_0xad8c('0x44')]);return _0x35f3aa[_0xad8c('0x51')](_0xf63cbd);}})['then'](function(_0x8b4be7){if(_0x8b4be7){_0x53c744=_0x8b4be7[_0xad8c('0x3b')];if(!_0x253ed1[_0xad8c('0x37')][_0xad8c('0x3d')]('nolimit')){_0xf63cbd[_0xad8c('0x23')]=qs[_0xad8c('0x23')](_0x253ed1[_0xad8c('0x37')]['limit']);_0xf63cbd[_0xad8c('0x20')]=qs[_0xad8c('0x20')](_0x253ed1[_0xad8c('0x37')][_0xad8c('0x20')]);}return _0x35f3aa['getDescriptions'](_0xf63cbd);}})['then'](function(_0x51947a){if(_0x51947a){return _0x51947a?{'count':_0x53c744,'rows':_0x51947a}:null;}})[_0xad8c('0x2a')](respondWithResult(_0x1a5758,null))[_0xad8c('0x48')](handleError(_0x1a5758,null));};exports[_0xad8c('0x53')]=function(_0x514890,_0x45428c,_0x15ab6d){var _0x5116a1={};var _0x2b1635={};var _0x581b49;var _0x1c7ee2;return db[_0xad8c('0x31')][_0xad8c('0x54')]({'where':{'id':_0x514890[_0xad8c('0x4d')]['id']}})['then'](handleEntityNotFound(_0x45428c,null))[_0xad8c('0x2a')](function(_0xd57ce3){if(_0xd57ce3){_0x581b49=_0xd57ce3;_0x2b1635[_0xad8c('0x3c')]=_['keys'](db[_0xad8c('0x4f')][_0xad8c('0x32')]);_0x2b1635[_0xad8c('0x37')]=_[_0xad8c('0x36')](_0x514890['query']);_0x2b1635[_0xad8c('0x38')]=_[_0xad8c('0x39')](_0x2b1635['model'],_0x2b1635[_0xad8c('0x37')]);_0x5116a1['attributes']=_[_0xad8c('0x39')](_0x2b1635[_0xad8c('0x3c')],qs[_0xad8c('0x49')](_0x514890[_0xad8c('0x37')][_0xad8c('0x49')]));_0x5116a1[_0xad8c('0x3a')]=_0x5116a1[_0xad8c('0x3a')][_0xad8c('0x3b')]?_0x5116a1[_0xad8c('0x3a')]:_0x2b1635[_0xad8c('0x3c')];_0x5116a1[_0xad8c('0x3e')]=qs[_0xad8c('0x3f')](_0x514890[_0xad8c('0x37')][_0xad8c('0x3f')]);_0x5116a1[_0xad8c('0x40')]=qs['filters'](_[_0xad8c('0x41')](_0x514890['query'],_0x2b1635[_0xad8c('0x38')]));if(_0x514890[_0xad8c('0x37')][_0xad8c('0x52')]){_0x5116a1[_0xad8c('0x40')]=_[_0xad8c('0x42')](_0x5116a1[_0xad8c('0x40')],{'$or':_[_0xad8c('0x30')](_0x5116a1[_0xad8c('0x3a')],function(_0x38be66){var _0x1e0a89={};_0x1e0a89[_0x38be66]={'$like':'%'+_0x514890[_0xad8c('0x37')][_0xad8c('0x52')]+'%'};return _0x1e0a89;})});}_0x5116a1=_['merge']({},_0x5116a1,_0x514890['options']);return _0x581b49[_0xad8c('0x53')](_0x5116a1);}})[_0xad8c('0x2a')](function(_0x2e39a4){if(_0x2e39a4){_0x1c7ee2=_0x2e39a4[_0xad8c('0x3b')];if(!_0x514890[_0xad8c('0x37')]['hasOwnProperty']('nolimit')){_0x5116a1[_0xad8c('0x23')]=qs[_0xad8c('0x23')](_0x514890[_0xad8c('0x37')][_0xad8c('0x23')]);_0x5116a1[_0xad8c('0x20')]=qs['offset'](_0x514890[_0xad8c('0x37')][_0xad8c('0x20')]);}return _0x581b49['getFields'](_0x5116a1);}})[_0xad8c('0x2a')](function(_0x22717b){if(_0x22717b){return _0x22717b?{'count':_0x1c7ee2,'rows':_0x22717b}:null;}})[_0xad8c('0x2a')](respondWithResult(_0x45428c,null))[_0xad8c('0x48')](handleError(_0x45428c,null));}; \ No newline at end of file +var _0x044a=['path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','then','destroy','error','stack','name','send','index','FreshsalesConfiguration','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','length','nolimit','sort','pick','where','merge','map','VIRTUAL','options','include','findAll','catch','show','params','find','create','update','body','getSubjects','findOne','keys','FreshsalesField','order','filter','hasOwnProperty','getFields','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util'];(function(_0x368424,_0x523d10){var _0x3551e3=function(_0x53dd1e){while(--_0x53dd1e){_0x368424['push'](_0x368424['shift']());}};_0x3551e3(++_0x523d10);}(_0x044a,0xe6));var _0xa044=function(_0xa25988,_0x363bb7){_0xa25988=_0xa25988-0x0;var _0x4c4a4a=_0x044a[_0xa25988];return _0x4c4a4a;};'use strict';var emlformat=require(_0xa044('0x0'));var rimraf=require(_0xa044('0x1'));var zipdir=require(_0xa044('0x2'));var jsonpatch=require(_0xa044('0x3'));var rp=require(_0xa044('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xa044('0x5'));var util=require(_0xa044('0x6'));var path=require(_0xa044('0x7'));var sox=require(_0xa044('0x8'));var csv=require(_0xa044('0x9'));var ejs=require(_0xa044('0xa'));var fs=require('fs');var fs_extra=require(_0xa044('0xb'));var _=require(_0xa044('0xc'));var squel=require('squel');var crypto=require(_0xa044('0xd'));var jsforce=require(_0xa044('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xa044('0xf'));var Papa=require(_0xa044('0x10'));var Redis=require(_0xa044('0x11'));var authService=require(_0xa044('0x12'));var qs=require(_0xa044('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa044('0x14'))('api');var utils=require('../../config/utils');var config=require(_0xa044('0x15'));var licenseUtil=require(_0xa044('0x16'));var db=require(_0xa044('0x17'))['db'];function respondWithStatusCode(_0x16221e,_0x2e2a1b){_0x2e2a1b=_0x2e2a1b||0xcc;return function(_0x5ad7a1){if(_0x5ad7a1){return _0x16221e[_0xa044('0x18')](_0x2e2a1b);}return _0x16221e[_0xa044('0x19')](_0x2e2a1b)[_0xa044('0x1a')]();};}function respondWithResult(_0x404607,_0x243c7a){_0x243c7a=_0x243c7a||0xc8;return function(_0x5c08c9){if(_0x5c08c9){return _0x404607['status'](_0x243c7a)[_0xa044('0x1b')](_0x5c08c9);}};}function respondWithFilteredResult(_0x3a36ff,_0x319842){return function(_0x1661f5){if(_0x1661f5){var _0x5ab6b9=typeof _0x319842['offset']===_0xa044('0x1c')&&typeof _0x319842[_0xa044('0x1d')]===_0xa044('0x1c');var _0x56cd60=_0x1661f5[_0xa044('0x1e')];var _0x1062b0=_0x5ab6b9?0x0:_0x319842['offset'];var _0x1d3eab=_0x5ab6b9?_0x1661f5['count']:_0x319842[_0xa044('0x1f')]+_0x319842[_0xa044('0x1d')];var _0x5cf60f;if(_0x1d3eab>=_0x56cd60){_0x1d3eab=_0x56cd60;_0x5cf60f=0xc8;}else{_0x5cf60f=0xce;}_0x3a36ff[_0xa044('0x19')](_0x5cf60f);return _0x3a36ff['set'](_0xa044('0x20'),_0x1062b0+'-'+_0x1d3eab+'/'+_0x56cd60)['json'](_0x1661f5);}return null;};}function patchUpdates(_0x520242){return function(_0x5715ac){try{jsonpatch[_0xa044('0x21')](_0x5715ac,_0x520242,!![]);}catch(_0x464fd6){return BPromise[_0xa044('0x22')](_0x464fd6);}return _0x5715ac[_0xa044('0x23')]();};}function saveUpdates(_0x916d61,_0x493d99){return function(_0x11b1be){if(_0x11b1be){return _0x11b1be['update'](_0x916d61)[_0xa044('0x24')](function(_0x305529){return _0x305529;});}return null;};}function removeEntity(_0x428de3,_0x5c315c){return function(_0x1efa64){if(_0x1efa64){return _0x1efa64[_0xa044('0x25')]()[_0xa044('0x24')](function(){_0x428de3[_0xa044('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4d943d,_0x19bcd8){return function(_0x4c5ff0){if(!_0x4c5ff0){_0x4d943d[_0xa044('0x18')](0x194);}return _0x4c5ff0;};}function handleError(_0x2c79b7,_0x139d47){_0x139d47=_0x139d47||0x1f4;return function(_0x25262e){logger[_0xa044('0x26')](_0x25262e[_0xa044('0x27')]);if(_0x25262e['name']){delete _0x25262e[_0xa044('0x28')];}_0x2c79b7[_0xa044('0x19')](_0x139d47)[_0xa044('0x29')](_0x25262e);};}exports[_0xa044('0x2a')]=function(_0x2d8bbe,_0x3fabf7){var _0x5a6a07={},_0x3f0a57={},_0x18197b={'count':0x0,'rows':[]};var _0x20bf6b=_['map'](db[_0xa044('0x2b')][_0xa044('0x2c')],function(_0x119292){return{'name':_0x119292[_0xa044('0x2d')],'type':_0x119292[_0xa044('0x2e')]['key']};});_0x3f0a57[_0xa044('0x2f')]=_['map'](_0x20bf6b,_0xa044('0x28'));_0x3f0a57[_0xa044('0x30')]=_['keys'](_0x2d8bbe[_0xa044('0x30')]);_0x3f0a57[_0xa044('0x31')]=_['intersection'](_0x3f0a57[_0xa044('0x2f')],_0x3f0a57['query']);_0x5a6a07[_0xa044('0x32')]=_[_0xa044('0x33')](_0x3f0a57[_0xa044('0x2f')],qs[_0xa044('0x34')](_0x2d8bbe['query'][_0xa044('0x34')]));_0x5a6a07[_0xa044('0x32')]=_0x5a6a07[_0xa044('0x32')][_0xa044('0x35')]?_0x5a6a07[_0xa044('0x32')]:_0x3f0a57[_0xa044('0x2f')];if(!_0x2d8bbe[_0xa044('0x30')]['hasOwnProperty'](_0xa044('0x36'))){_0x5a6a07[_0xa044('0x1d')]=qs[_0xa044('0x1d')](_0x2d8bbe[_0xa044('0x30')]['limit']);_0x5a6a07[_0xa044('0x1f')]=qs['offset'](_0x2d8bbe[_0xa044('0x30')][_0xa044('0x1f')]);}_0x5a6a07['order']=qs[_0xa044('0x37')](_0x2d8bbe[_0xa044('0x30')][_0xa044('0x37')]);_0x5a6a07['where']=qs[_0xa044('0x31')](_[_0xa044('0x38')](_0x2d8bbe[_0xa044('0x30')],_0x3f0a57[_0xa044('0x31')]),_0x20bf6b);if(_0x2d8bbe[_0xa044('0x30')]['filter']){_0x5a6a07[_0xa044('0x39')]=_[_0xa044('0x3a')](_0x5a6a07['where'],{'$or':_[_0xa044('0x3b')](_0x20bf6b,function(_0x31784d){if(_0x31784d[_0xa044('0x2e')]!==_0xa044('0x3c')){var _0x4b4c47={};_0x4b4c47[_0x31784d[_0xa044('0x28')]]={'$like':'%'+_0x2d8bbe['query']['filter']+'%'};return _0x4b4c47;}})});}_0x5a6a07=_[_0xa044('0x3a')]({},_0x5a6a07,_0x2d8bbe[_0xa044('0x3d')]);var _0x14df61={'where':_0x5a6a07[_0xa044('0x39')]};return db[_0xa044('0x2b')]['count'](_0x14df61)[_0xa044('0x24')](function(_0x475165){_0x18197b[_0xa044('0x1e')]=_0x475165;if(_0x2d8bbe[_0xa044('0x30')]['includeAll']){_0x5a6a07[_0xa044('0x3e')]=[{'all':!![]}];}return db['FreshsalesConfiguration'][_0xa044('0x3f')](_0x5a6a07);})[_0xa044('0x24')](function(_0xfdd6ee){_0x18197b['rows']=_0xfdd6ee;return _0x18197b;})[_0xa044('0x24')](respondWithFilteredResult(_0x3fabf7,_0x5a6a07))[_0xa044('0x40')](handleError(_0x3fabf7,null));};exports[_0xa044('0x41')]=function(_0x1f8515,_0x162ee2){var _0x12409e={'raw':![],'where':{'id':_0x1f8515[_0xa044('0x42')]['id']}},_0x859cb2={};_0x859cb2['model']=_['keys'](db[_0xa044('0x2b')][_0xa044('0x2c')]);_0x859cb2[_0xa044('0x30')]=_['keys'](_0x1f8515[_0xa044('0x30')]);_0x859cb2[_0xa044('0x31')]=_[_0xa044('0x33')](_0x859cb2[_0xa044('0x2f')],_0x859cb2[_0xa044('0x30')]);_0x12409e[_0xa044('0x32')]=_['intersection'](_0x859cb2[_0xa044('0x2f')],qs['fields'](_0x1f8515['query'][_0xa044('0x34')]));_0x12409e[_0xa044('0x32')]=_0x12409e[_0xa044('0x32')][_0xa044('0x35')]?_0x12409e[_0xa044('0x32')]:_0x859cb2[_0xa044('0x2f')];if(_0x1f8515[_0xa044('0x30')]['includeAll']){_0x12409e[_0xa044('0x3e')]=[{'all':!![]}];}_0x12409e=_[_0xa044('0x3a')]({},_0x12409e,_0x1f8515[_0xa044('0x3d')]);return db['FreshsalesConfiguration'][_0xa044('0x43')](_0x12409e)['then'](handleEntityNotFound(_0x162ee2,null))[_0xa044('0x24')](respondWithResult(_0x162ee2,null))['catch'](handleError(_0x162ee2,null));};exports[_0xa044('0x44')]=function(_0x56e326,_0x2427e7){return db[_0xa044('0x2b')]['create'](_0x56e326['body'],{})['then'](respondWithResult(_0x2427e7,0xc9))[_0xa044('0x40')](handleError(_0x2427e7,null));};exports[_0xa044('0x45')]=function(_0x42e92c,_0x131b22){if(_0x42e92c[_0xa044('0x46')]['id']){delete _0x42e92c[_0xa044('0x46')]['id'];}return db[_0xa044('0x2b')]['find']({'where':{'id':_0x42e92c[_0xa044('0x42')]['id']}})[_0xa044('0x24')](handleEntityNotFound(_0x131b22,null))[_0xa044('0x24')](saveUpdates(_0x42e92c[_0xa044('0x46')],null))['then'](respondWithResult(_0x131b22,null))[_0xa044('0x40')](handleError(_0x131b22,null));};exports[_0xa044('0x25')]=function(_0x3c8bad,_0x16705c){return db[_0xa044('0x2b')][_0xa044('0x43')]({'where':{'id':_0x3c8bad[_0xa044('0x42')]['id']}})[_0xa044('0x24')](handleEntityNotFound(_0x16705c,null))[_0xa044('0x24')](removeEntity(_0x16705c,null))[_0xa044('0x40')](handleError(_0x16705c,null));};exports[_0xa044('0x47')]=function(_0x51d4c8,_0x48c641,_0x4a6e61){var _0x27bab6={};var _0x47e36d={};var _0x41250a;var _0x20ece5;return db[_0xa044('0x2b')][_0xa044('0x48')]({'where':{'id':_0x51d4c8['params']['id']}})[_0xa044('0x24')](handleEntityNotFound(_0x48c641,null))[_0xa044('0x24')](function(_0x1167c3){if(_0x1167c3){_0x41250a=_0x1167c3;_0x47e36d[_0xa044('0x2f')]=_[_0xa044('0x49')](db[_0xa044('0x4a')]['rawAttributes']);_0x47e36d[_0xa044('0x30')]=_[_0xa044('0x49')](_0x51d4c8[_0xa044('0x30')]);_0x47e36d[_0xa044('0x31')]=_[_0xa044('0x33')](_0x47e36d[_0xa044('0x2f')],_0x47e36d[_0xa044('0x30')]);_0x27bab6['attributes']=_[_0xa044('0x33')](_0x47e36d[_0xa044('0x2f')],qs[_0xa044('0x34')](_0x51d4c8[_0xa044('0x30')][_0xa044('0x34')]));_0x27bab6[_0xa044('0x32')]=_0x27bab6[_0xa044('0x32')][_0xa044('0x35')]?_0x27bab6[_0xa044('0x32')]:_0x47e36d[_0xa044('0x2f')];_0x27bab6[_0xa044('0x4b')]=qs[_0xa044('0x37')](_0x51d4c8[_0xa044('0x30')][_0xa044('0x37')]);_0x27bab6[_0xa044('0x39')]=qs[_0xa044('0x31')](_[_0xa044('0x38')](_0x51d4c8[_0xa044('0x30')],_0x47e36d['filters']));if(_0x51d4c8[_0xa044('0x30')][_0xa044('0x4c')]){_0x27bab6['where']=_[_0xa044('0x3a')](_0x27bab6[_0xa044('0x39')],{'$or':_[_0xa044('0x3b')](_0x27bab6[_0xa044('0x32')],function(_0x380306){var _0x204609={};_0x204609[_0x380306]={'$like':'%'+_0x51d4c8['query']['filter']+'%'};return _0x204609;})});}_0x27bab6=_[_0xa044('0x3a')]({},_0x27bab6,_0x51d4c8[_0xa044('0x3d')]);return _0x41250a[_0xa044('0x47')](_0x27bab6);}})['then'](function(_0x1b06b2){if(_0x1b06b2){_0x20ece5=_0x1b06b2[_0xa044('0x35')];if(!_0x51d4c8[_0xa044('0x30')][_0xa044('0x4d')](_0xa044('0x36'))){_0x27bab6['limit']=qs[_0xa044('0x1d')](_0x51d4c8[_0xa044('0x30')][_0xa044('0x1d')]);_0x27bab6[_0xa044('0x1f')]=qs['offset'](_0x51d4c8[_0xa044('0x30')][_0xa044('0x1f')]);}return _0x41250a[_0xa044('0x47')](_0x27bab6);}})[_0xa044('0x24')](function(_0x55139b){if(_0x55139b){return _0x55139b?{'count':_0x20ece5,'rows':_0x55139b}:null;}})[_0xa044('0x24')](respondWithResult(_0x48c641,null))['catch'](handleError(_0x48c641,null));};exports['getDescriptions']=function(_0x5bd6f6,_0x503f05,_0x537ca7){var _0x22ba11={};var _0xc7c029={};var _0x37aa4d;var _0x2f93bc;return db[_0xa044('0x2b')][_0xa044('0x48')]({'where':{'id':_0x5bd6f6[_0xa044('0x42')]['id']}})['then'](handleEntityNotFound(_0x503f05,null))[_0xa044('0x24')](function(_0x2e9962){if(_0x2e9962){_0x37aa4d=_0x2e9962;_0xc7c029[_0xa044('0x2f')]=_[_0xa044('0x49')](db[_0xa044('0x4a')][_0xa044('0x2c')]);_0xc7c029[_0xa044('0x30')]=_[_0xa044('0x49')](_0x5bd6f6[_0xa044('0x30')]);_0xc7c029[_0xa044('0x31')]=_[_0xa044('0x33')](_0xc7c029[_0xa044('0x2f')],_0xc7c029[_0xa044('0x30')]);_0x22ba11['attributes']=_['intersection'](_0xc7c029[_0xa044('0x2f')],qs[_0xa044('0x34')](_0x5bd6f6[_0xa044('0x30')][_0xa044('0x34')]));_0x22ba11[_0xa044('0x32')]=_0x22ba11[_0xa044('0x32')][_0xa044('0x35')]?_0x22ba11[_0xa044('0x32')]:_0xc7c029[_0xa044('0x2f')];_0x22ba11[_0xa044('0x4b')]=qs[_0xa044('0x37')](_0x5bd6f6[_0xa044('0x30')][_0xa044('0x37')]);_0x22ba11[_0xa044('0x39')]=qs[_0xa044('0x31')](_[_0xa044('0x38')](_0x5bd6f6[_0xa044('0x30')],_0xc7c029[_0xa044('0x31')]));if(_0x5bd6f6['query'][_0xa044('0x4c')]){_0x22ba11[_0xa044('0x39')]=_[_0xa044('0x3a')](_0x22ba11[_0xa044('0x39')],{'$or':_[_0xa044('0x3b')](_0x22ba11[_0xa044('0x32')],function(_0x387cab){var _0xf6fa60={};_0xf6fa60[_0x387cab]={'$like':'%'+_0x5bd6f6['query']['filter']+'%'};return _0xf6fa60;})});}_0x22ba11=_[_0xa044('0x3a')]({},_0x22ba11,_0x5bd6f6[_0xa044('0x3d')]);return _0x37aa4d['getDescriptions'](_0x22ba11);}})['then'](function(_0x91d741){if(_0x91d741){_0x2f93bc=_0x91d741[_0xa044('0x35')];if(!_0x5bd6f6[_0xa044('0x30')][_0xa044('0x4d')](_0xa044('0x36'))){_0x22ba11['limit']=qs['limit'](_0x5bd6f6[_0xa044('0x30')][_0xa044('0x1d')]);_0x22ba11[_0xa044('0x1f')]=qs[_0xa044('0x1f')](_0x5bd6f6[_0xa044('0x30')][_0xa044('0x1f')]);}return _0x37aa4d['getDescriptions'](_0x22ba11);}})[_0xa044('0x24')](function(_0xdcd8bc){if(_0xdcd8bc){return _0xdcd8bc?{'count':_0x2f93bc,'rows':_0xdcd8bc}:null;}})[_0xa044('0x24')](respondWithResult(_0x503f05,null))['catch'](handleError(_0x503f05,null));};exports[_0xa044('0x4e')]=function(_0x42ec88,_0x51b3b8,_0x1ba0c6){var _0x393c60={};var _0x4e3ae7={};var _0x37df70;var _0x5aaba8;return db[_0xa044('0x2b')][_0xa044('0x48')]({'where':{'id':_0x42ec88[_0xa044('0x42')]['id']}})[_0xa044('0x24')](handleEntityNotFound(_0x51b3b8,null))['then'](function(_0x57b97e){if(_0x57b97e){_0x37df70=_0x57b97e;_0x4e3ae7[_0xa044('0x2f')]=_[_0xa044('0x49')](db[_0xa044('0x4a')][_0xa044('0x2c')]);_0x4e3ae7[_0xa044('0x30')]=_[_0xa044('0x49')](_0x42ec88['query']);_0x4e3ae7[_0xa044('0x31')]=_['intersection'](_0x4e3ae7[_0xa044('0x2f')],_0x4e3ae7[_0xa044('0x30')]);_0x393c60[_0xa044('0x32')]=_[_0xa044('0x33')](_0x4e3ae7[_0xa044('0x2f')],qs[_0xa044('0x34')](_0x42ec88[_0xa044('0x30')]['fields']));_0x393c60[_0xa044('0x32')]=_0x393c60[_0xa044('0x32')]['length']?_0x393c60[_0xa044('0x32')]:_0x4e3ae7[_0xa044('0x2f')];_0x393c60[_0xa044('0x4b')]=qs[_0xa044('0x37')](_0x42ec88[_0xa044('0x30')]['sort']);_0x393c60[_0xa044('0x39')]=qs[_0xa044('0x31')](_[_0xa044('0x38')](_0x42ec88[_0xa044('0x30')],_0x4e3ae7[_0xa044('0x31')]));if(_0x42ec88[_0xa044('0x30')][_0xa044('0x4c')]){_0x393c60[_0xa044('0x39')]=_[_0xa044('0x3a')](_0x393c60[_0xa044('0x39')],{'$or':_[_0xa044('0x3b')](_0x393c60[_0xa044('0x32')],function(_0x4037bb){var _0x232373={};_0x232373[_0x4037bb]={'$like':'%'+_0x42ec88[_0xa044('0x30')][_0xa044('0x4c')]+'%'};return _0x232373;})});}_0x393c60=_[_0xa044('0x3a')]({},_0x393c60,_0x42ec88[_0xa044('0x3d')]);return _0x37df70[_0xa044('0x4e')](_0x393c60);}})['then'](function(_0x38eb45){if(_0x38eb45){_0x5aaba8=_0x38eb45[_0xa044('0x35')];if(!_0x42ec88[_0xa044('0x30')][_0xa044('0x4d')](_0xa044('0x36'))){_0x393c60[_0xa044('0x1d')]=qs[_0xa044('0x1d')](_0x42ec88[_0xa044('0x30')][_0xa044('0x1d')]);_0x393c60['offset']=qs[_0xa044('0x1f')](_0x42ec88[_0xa044('0x30')][_0xa044('0x1f')]);}return _0x37df70[_0xa044('0x4e')](_0x393c60);}})[_0xa044('0x24')](function(_0x3ecc9f){if(_0x3ecc9f){return _0x3ecc9f?{'count':_0x5aaba8,'rows':_0x3ecc9f}:null;}})['then'](respondWithResult(_0x51b3b8,null))[_0xa044('0x40')](handleError(_0x51b3b8,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js b/server/api/intFreshsalesConfiguration/intFreshsalesConfiguration.model.js index 4671d93..0d6d33e 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 _0xb027=['path','rimraf','../../config/environment','exports','define','FreshsalesConfiguration','lodash','../../config/logger','bluebird','request-promise'];(function(_0x2b5b14,_0x9c967b){var _0x5c883c=function(_0x1188e5){while(--_0x1188e5){_0x2b5b14['push'](_0x2b5b14['shift']());}};_0x5c883c(++_0x9c967b);}(_0xb027,0x6a));var _0x7b02=function(_0x3bf7df,_0x42d714){_0x3bf7df=_0x3bf7df-0x0;var _0x2a00cd=_0xb027[_0x3bf7df];return _0x2a00cd;};'use strict';var _=require(_0x7b02('0x0'));var util=require('util');var logger=require(_0x7b02('0x1'))('api');var moment=require('moment');var BPromise=require(_0x7b02('0x2'));var rp=require(_0x7b02('0x3'));var fs=require('fs');var path=require(_0x7b02('0x4'));var rimraf=require(_0x7b02('0x5'));var config=require(_0x7b02('0x6'));var attributes=require('./intFreshsalesConfiguration.attributes');module[_0x7b02('0x7')]=function(_0x57830e,_0x1fe42f){return _0x57830e[_0x7b02('0x8')](_0x7b02('0x9'),attributes,{'tableName':'int_freshsales_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x398c=['api','moment','path','./intFreshsalesConfiguration.attributes','exports','define','FreshsalesConfiguration','int_freshsales_configurations','lodash','../../config/logger'];(function(_0x1dd532,_0x36e81c){var _0x3732aa=function(_0x19d50a){while(--_0x19d50a){_0x1dd532['push'](_0x1dd532['shift']());}};_0x3732aa(++_0x36e81c);}(_0x398c,0xe4));var _0xc398=function(_0xc997,_0x2eb1d5){_0xc997=_0xc997-0x0;var _0x3d06ec=_0x398c[_0xc997];return _0x3d06ec;};'use strict';var _=require(_0xc398('0x0'));var util=require('util');var logger=require(_0xc398('0x1'))(_0xc398('0x2'));var moment=require(_0xc398('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xc398('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc398('0x5'));module[_0xc398('0x6')]=function(_0x35d014,_0x50253f){return _0x35d014[_0xc398('0x7')](_0xc398('0x8'),attributes,{'tableName':_0xc398('0x9'),'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 3374de9..db1d0c1 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 _0x2944=['request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','FreshsalesConfiguration,\x20%s,\x20%s'];(function(_0x4cbf20,_0x1bfa66){var _0x582ae4=function(_0x5eca38){while(--_0x5eca38){_0x4cbf20['push'](_0x4cbf20['shift']());}};_0x582ae4(++_0x1bfa66);}(_0x2944,0x1d1));var _0x4294=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0x2944[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x4294('0x0'));var util=require(_0x4294('0x1'));var moment=require(_0x4294('0x2'));var BPromise=require(_0x4294('0x3'));var rs=require(_0x4294('0x4'));var fs=require('fs');var Redis=require(_0x4294('0x5'));var db=require(_0x4294('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x4294('0x7'))(_0x4294('0x8'));var config=require(_0x4294('0x9'));var jayson=require(_0x4294('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2f777e,_0x4d92cb,_0x399758){return new BPromise(function(_0x5e9d54,_0x335164){return client[_0x4294('0xb')](_0x2f777e,_0x399758)[_0x4294('0xc')](function(_0x47e513){logger[_0x4294('0xd')](_0x4294('0xe'),_0x4d92cb,_0x4294('0xf'));logger[_0x4294('0x10')](_0x4294('0x11'),_0x4d92cb,'request\x20sent',JSON[_0x4294('0x12')](_0x47e513));if(_0x47e513[_0x4294('0x13')]){if(_0x47e513['error'][_0x4294('0x14')]===0x1f4){logger[_0x4294('0x13')](_0x4294('0xe'),_0x4d92cb,_0x47e513[_0x4294('0x13')][_0x4294('0x15')]);return _0x335164(_0x47e513[_0x4294('0x13')][_0x4294('0x15')]);}logger[_0x4294('0x13')](_0x4294('0xe'),_0x4d92cb,_0x47e513['error'][_0x4294('0x15')]);return _0x5e9d54(_0x47e513[_0x4294('0x13')][_0x4294('0x15')]);}else{logger[_0x4294('0xd')](_0x4294('0xe'),_0x4d92cb,_0x4294('0xf'));_0x5e9d54(_0x47e513[_0x4294('0x16')][_0x4294('0x15')]);}})[_0x4294('0x17')](function(_0x24c4ea){logger['error'](_0x4294('0xe'),_0x4d92cb,_0x24c4ea);_0x335164(_0x24c4ea);});});} \ No newline at end of file +var _0xa2b4=['FreshsalesConfiguration,\x20%s,\x20%s','request\x20sent','debug','FreshsalesConfiguration,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','request','then','info'];(function(_0x4d02ff,_0x39d974){var _0x194a94=function(_0x70f90a){while(--_0x70f90a){_0x4d02ff['push'](_0x4d02ff['shift']());}};_0x194a94(++_0x39d974);}(_0xa2b4,0x86));var _0x4a2b=function(_0x545e7c,_0x7cee70){_0x545e7c=_0x545e7c-0x0;var _0x5c9897=_0xa2b4[_0x545e7c];return _0x5c9897;};'use strict';var _=require(_0x4a2b('0x0'));var util=require(_0x4a2b('0x1'));var moment=require(_0x4a2b('0x2'));var BPromise=require(_0x4a2b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4a2b('0x4'));var db=require(_0x4a2b('0x5'))['db'];var utils=require(_0x4a2b('0x6'));var logger=require(_0x4a2b('0x7'))(_0x4a2b('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4a2b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x59c203,_0x13d8e2,_0x5485db){return new BPromise(function(_0x209648,_0x44622f){return client[_0x4a2b('0xa')](_0x59c203,_0x5485db)[_0x4a2b('0xb')](function(_0x11c59d){logger[_0x4a2b('0xc')](_0x4a2b('0xd'),_0x13d8e2,_0x4a2b('0xe'));logger[_0x4a2b('0xf')](_0x4a2b('0x10'),_0x13d8e2,_0x4a2b('0xe'),JSON['stringify'](_0x11c59d));if(_0x11c59d[_0x4a2b('0x11')]){if(_0x11c59d['error']['code']===0x1f4){logger[_0x4a2b('0x11')](_0x4a2b('0xd'),_0x13d8e2,_0x11c59d[_0x4a2b('0x11')][_0x4a2b('0x12')]);return _0x44622f(_0x11c59d[_0x4a2b('0x11')][_0x4a2b('0x12')]);}logger[_0x4a2b('0x11')](_0x4a2b('0xd'),_0x13d8e2,_0x11c59d[_0x4a2b('0x11')][_0x4a2b('0x12')]);return _0x209648(_0x11c59d['error']['message']);}else{logger[_0x4a2b('0xc')]('FreshsalesConfiguration,\x20%s,\x20%s',_0x13d8e2,'request\x20sent');_0x209648(_0x11c59d[_0x4a2b('0x13')][_0x4a2b('0x12')]);}})[_0x4a2b('0x14')](function(_0x1df140){logger['error'](_0x4a2b('0xd'),_0x13d8e2,_0x1df140);_0x44622f(_0x1df140);});});} \ No newline at end of file diff --git a/server/api/intFreshsalesField/index.js b/server/api/intFreshsalesField/index.js index 614ef51..3781680 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 _0xed8a=['show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/:id'];(function(_0x57ee81,_0x6863e7){var _0x2c2c66=function(_0x3f1195){while(--_0x3f1195){_0x57ee81['push'](_0x57ee81['shift']());}};_0x2c2c66(++_0x6863e7);}(_0xed8a,0xc5));var _0xaed8=function(_0x40d3f3,_0x35d87d){_0x40d3f3=_0x40d3f3-0x0;var _0x491ab2=_0xed8a[_0x40d3f3];return _0x491ab2;};'use strict';var multer=require(_0xaed8('0x0'));var util=require(_0xaed8('0x1'));var path=require(_0xaed8('0x2'));var timeout=require(_0xaed8('0x3'));var express=require('express');var router=express[_0xaed8('0x4')]();var fs_extra=require(_0xaed8('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xaed8('0x6'));var config=require(_0xaed8('0x7'));var controller=require('./intFreshsalesField.controller');router['get']('/',auth[_0xaed8('0x8')](),controller[_0xaed8('0x9')]);router[_0xaed8('0xa')](_0xaed8('0xb'),auth[_0xaed8('0x8')](),controller[_0xaed8('0xc')]);router[_0xaed8('0xd')]('/',auth['isAuthenticated'](),controller[_0xaed8('0xe')]);router[_0xaed8('0xf')](_0xaed8('0xb'),auth['isAuthenticated'](),controller[_0xaed8('0x10')]);router[_0xaed8('0x11')](_0xaed8('0xb'),auth[_0xaed8('0x8')](),controller[_0xaed8('0x12')]);module['exports']=router; \ No newline at end of file +var _0xb332=['../../components/auth/service','../../config/environment','get','isAuthenticated','index','show','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','Router'];(function(_0x717217,_0x418f47){var _0x5450f0=function(_0x3332e0){while(--_0x3332e0){_0x717217['push'](_0x717217['shift']());}};_0x5450f0(++_0x418f47);}(_0xb332,0xd9));var _0x2b33=function(_0x575b72,_0x1a7eb1){_0x575b72=_0x575b72-0x0;var _0x561c57=_0xb332[_0x575b72];return _0x561c57;};'use strict';var multer=require(_0x2b33('0x0'));var util=require('util');var path=require(_0x2b33('0x1'));var timeout=require(_0x2b33('0x2'));var express=require('express');var router=express[_0x2b33('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x2b33('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x2b33('0x5'));var controller=require('./intFreshsalesField.controller');router[_0x2b33('0x6')]('/',auth[_0x2b33('0x7')](),controller[_0x2b33('0x8')]);router[_0x2b33('0x6')]('/:id',auth['isAuthenticated'](),controller[_0x2b33('0x9')]);router['post']('/',auth[_0x2b33('0x7')](),controller[_0x2b33('0xa')]);router[_0x2b33('0xb')](_0x2b33('0xc'),auth['isAuthenticated'](),controller[_0x2b33('0xd')]);router[_0x2b33('0xe')](_0x2b33('0xc'),auth[_0x2b33('0x7')](),controller[_0x2b33('0xf')]);module[_0x2b33('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 d2a12f8..ae0f601 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 _0xb39d=['keyValue','picklist','STRING','BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable'];(function(_0x49c5af,_0x2dd320){var _0x322710=function(_0x34d4a4){while(--_0x34d4a4){_0x49c5af['push'](_0x49c5af['shift']());}};_0x322710(++_0x2dd320);}(_0xb39d,0x72));var _0xdb39=function(_0x26a10d,_0xe5c001){_0x26a10d=_0x26a10d-0x0;var _0xf90201=_0xb39d[_0x26a10d];return _0xf90201;};'use strict';var Sequelize=require(_0xdb39('0x0'));module[_0xdb39('0x1')]={'type':{'type':Sequelize[_0xdb39('0x2')](_0xdb39('0x3'),_0xdb39('0x4'),_0xdb39('0x5'),_0xdb39('0x6'),_0xdb39('0x7')),'defaultValue':_0xdb39('0x3')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xdb39('0x8')]},'keyType':{'type':Sequelize[_0xdb39('0x2')](_0xdb39('0x3'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xdb39('0x8')]},'idField':{'type':Sequelize[_0xdb39('0x8')]},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xdb39('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xdb39('0x8')]}}; \ No newline at end of file +var _0x7540=['picklist','STRING','BOOLEAN','exports','ENUM','string','customVariable','keyValue'];(function(_0x22d729,_0x4361d9){var _0x25f4ba=function(_0x2faf8c){while(--_0x2faf8c){_0x22d729['push'](_0x22d729['shift']());}};_0x25f4ba(++_0x4361d9);}(_0x7540,0x83));var _0x0754=function(_0x4e13b0,_0x1ca561){_0x4e13b0=_0x4e13b0-0x0;var _0x5c2a63=_0x7540[_0x4e13b0];return _0x5c2a63;};'use strict';var Sequelize=require('sequelize');module[_0x0754('0x0')]={'type':{'type':Sequelize[_0x0754('0x1')](_0x0754('0x2'),'variable',_0x0754('0x3'),_0x0754('0x4'),_0x0754('0x5')),'defaultValue':'string'},'content':{'type':Sequelize[_0x0754('0x6')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0x0754('0x1')]('string','variable',_0x0754('0x3'))},'keyContent':{'type':Sequelize[_0x0754('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0754('0x6')]},'customField':{'type':Sequelize[_0x0754('0x7')],'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 9e77cb3..5189f0c 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 _0xe7c2=['stack','name','send','map','FreshsalesField','rawAttributes','type','key','query','keys','model','attributes','fields','length','hasOwnProperty','limit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','catch','intersection','find','create','body','update','params','eml-format','zip-dir','fast-json-patch','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/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','offset','count','Content-Range','json','apply','reject','save','destroy','then'];(function(_0x18360a,_0x534fae){var _0x2f91f2=function(_0x59f7b0){while(--_0x59f7b0){_0x18360a['push'](_0x18360a['shift']());}};_0x2f91f2(++_0x534fae);}(_0xe7c2,0xfe));var _0x2e7c=function(_0x2c8227,_0x2cb39e){_0x2c8227=_0x2c8227-0x0;var _0x277e69=_0xe7c2[_0x2c8227];return _0x277e69;};'use strict';var emlformat=require(_0x2e7c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2e7c('0x1'));var jsonpatch=require(_0x2e7c('0x2'));var rp=require(_0x2e7c('0x3'));var moment=require(_0x2e7c('0x4'));var BPromise=require(_0x2e7c('0x5'));var Mustache=require(_0x2e7c('0x6'));var util=require(_0x2e7c('0x7'));var path=require('path');var sox=require(_0x2e7c('0x8'));var csv=require(_0x2e7c('0x9'));var ejs=require(_0x2e7c('0xa'));var fs=require('fs');var fs_extra=require(_0x2e7c('0xb'));var _=require(_0x2e7c('0xc'));var squel=require('squel');var crypto=require(_0x2e7c('0xd'));var jsforce=require(_0x2e7c('0xe'));var deskjs=require(_0x2e7c('0xf'));var toCsv=require(_0x2e7c('0x9'));var querystring=require(_0x2e7c('0x10'));var Papa=require(_0x2e7c('0x11'));var Redis=require(_0x2e7c('0x12'));var authService=require(_0x2e7c('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x2e7c('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2e7c('0x15'))('api');var utils=require(_0x2e7c('0x16'));var config=require(_0x2e7c('0x17'));var licenseUtil=require(_0x2e7c('0x18'));var db=require(_0x2e7c('0x19'))['db'];function respondWithStatusCode(_0x4bfb4f,_0x3ca902){_0x3ca902=_0x3ca902||0xcc;return function(_0x190c8e){if(_0x190c8e){return _0x4bfb4f[_0x2e7c('0x1a')](_0x3ca902);}return _0x4bfb4f['status'](_0x3ca902)[_0x2e7c('0x1b')]();};}function respondWithResult(_0x3779a0,_0x9272a9){_0x9272a9=_0x9272a9||0xc8;return function(_0x5286e4){if(_0x5286e4){return _0x3779a0[_0x2e7c('0x1c')](_0x9272a9)['json'](_0x5286e4);}};}function respondWithFilteredResult(_0xb5ef5d,_0x5b854f){return function(_0x46f0b6){if(_0x46f0b6){var _0x4e7064=typeof _0x5b854f[_0x2e7c('0x1d')]==='undefined'&&typeof _0x5b854f['limit']==='undefined';var _0x5e0f9b=_0x46f0b6[_0x2e7c('0x1e')];var _0x4c34df=_0x4e7064?0x0:_0x5b854f[_0x2e7c('0x1d')];var _0xc3c269=_0x4e7064?_0x46f0b6[_0x2e7c('0x1e')]:_0x5b854f['offset']+_0x5b854f['limit'];var _0x30574b;if(_0xc3c269>=_0x5e0f9b){_0xc3c269=_0x5e0f9b;_0x30574b=0xc8;}else{_0x30574b=0xce;}_0xb5ef5d[_0x2e7c('0x1c')](_0x30574b);return _0xb5ef5d['set'](_0x2e7c('0x1f'),_0x4c34df+'-'+_0xc3c269+'/'+_0x5e0f9b)[_0x2e7c('0x20')](_0x46f0b6);}return null;};}function patchUpdates(_0x2a3d4b){return function(_0x4d7b77){try{jsonpatch[_0x2e7c('0x21')](_0x4d7b77,_0x2a3d4b,!![]);}catch(_0x4fdb91){return BPromise[_0x2e7c('0x22')](_0x4fdb91);}return _0x4d7b77[_0x2e7c('0x23')]();};}function saveUpdates(_0x1d6b4b,_0x3c3488){return function(_0x34cbdd){if(_0x34cbdd){return _0x34cbdd['update'](_0x1d6b4b)['then'](function(_0xd258f9){return _0xd258f9;});}return null;};}function removeEntity(_0xa09f51,_0x16d322){return function(_0x868467){if(_0x868467){return _0x868467[_0x2e7c('0x24')]()[_0x2e7c('0x25')](function(){_0xa09f51['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x38171f,_0x6ac6a0){return function(_0x15d222){if(!_0x15d222){_0x38171f[_0x2e7c('0x1a')](0x194);}return _0x15d222;};}function handleError(_0x3e8250,_0x408580){_0x408580=_0x408580||0x1f4;return function(_0x3c142f){logger['error'](_0x3c142f[_0x2e7c('0x26')]);if(_0x3c142f[_0x2e7c('0x27')]){delete _0x3c142f['name'];}_0x3e8250[_0x2e7c('0x1c')](_0x408580)[_0x2e7c('0x28')](_0x3c142f);};}exports['index']=function(_0xd4f3a5,_0x76a460){var _0x1aa914={},_0x2c2515={},_0x34d41e={'count':0x0,'rows':[]};var _0x4e7927=_[_0x2e7c('0x29')](db[_0x2e7c('0x2a')][_0x2e7c('0x2b')],function(_0x5e991f){return{'name':_0x5e991f['fieldName'],'type':_0x5e991f[_0x2e7c('0x2c')][_0x2e7c('0x2d')]};});_0x2c2515['model']=_['map'](_0x4e7927,_0x2e7c('0x27'));_0x2c2515[_0x2e7c('0x2e')]=_[_0x2e7c('0x2f')](_0xd4f3a5[_0x2e7c('0x2e')]);_0x2c2515['filters']=_['intersection'](_0x2c2515[_0x2e7c('0x30')],_0x2c2515[_0x2e7c('0x2e')]);_0x1aa914[_0x2e7c('0x31')]=_['intersection'](_0x2c2515[_0x2e7c('0x30')],qs[_0x2e7c('0x32')](_0xd4f3a5['query'][_0x2e7c('0x32')]));_0x1aa914['attributes']=_0x1aa914[_0x2e7c('0x31')][_0x2e7c('0x33')]?_0x1aa914[_0x2e7c('0x31')]:_0x2c2515[_0x2e7c('0x30')];if(!_0xd4f3a5[_0x2e7c('0x2e')][_0x2e7c('0x34')]('nolimit')){_0x1aa914[_0x2e7c('0x35')]=qs[_0x2e7c('0x35')](_0xd4f3a5[_0x2e7c('0x2e')][_0x2e7c('0x35')]);_0x1aa914[_0x2e7c('0x1d')]=qs[_0x2e7c('0x1d')](_0xd4f3a5[_0x2e7c('0x2e')][_0x2e7c('0x1d')]);}_0x1aa914[_0x2e7c('0x36')]=qs[_0x2e7c('0x37')](_0xd4f3a5[_0x2e7c('0x2e')][_0x2e7c('0x37')]);_0x1aa914[_0x2e7c('0x38')]=qs['filters'](_[_0x2e7c('0x39')](_0xd4f3a5[_0x2e7c('0x2e')],_0x2c2515[_0x2e7c('0x3a')]),_0x4e7927);if(_0xd4f3a5[_0x2e7c('0x2e')][_0x2e7c('0x3b')]){_0x1aa914[_0x2e7c('0x38')]=_['merge'](_0x1aa914['where'],{'$or':_[_0x2e7c('0x29')](_0x4e7927,function(_0x4a5b79){if(_0x4a5b79[_0x2e7c('0x2c')]!==_0x2e7c('0x3c')){var _0x34598b={};_0x34598b[_0x4a5b79[_0x2e7c('0x27')]]={'$like':'%'+_0xd4f3a5[_0x2e7c('0x2e')][_0x2e7c('0x3b')]+'%'};return _0x34598b;}})});}_0x1aa914=_[_0x2e7c('0x3d')]({},_0x1aa914,_0xd4f3a5[_0x2e7c('0x3e')]);var _0x39e42a={'where':_0x1aa914['where']};return db[_0x2e7c('0x2a')][_0x2e7c('0x1e')](_0x39e42a)[_0x2e7c('0x25')](function(_0x4c5c75){_0x34d41e[_0x2e7c('0x1e')]=_0x4c5c75;if(_0xd4f3a5[_0x2e7c('0x2e')][_0x2e7c('0x3f')]){_0x1aa914[_0x2e7c('0x40')]=[{'all':!![]}];}return db['FreshsalesField'][_0x2e7c('0x41')](_0x1aa914);})['then'](function(_0x56539b){_0x34d41e['rows']=_0x56539b;return _0x34d41e;})[_0x2e7c('0x25')](respondWithFilteredResult(_0x76a460,_0x1aa914))[_0x2e7c('0x42')](handleError(_0x76a460,null));};exports['show']=function(_0x5984ee,_0x1dc996){var _0x13d761={'raw':!![],'where':{'id':_0x5984ee['params']['id']}},_0x7cfc3f={};_0x7cfc3f[_0x2e7c('0x30')]=_[_0x2e7c('0x2f')](db[_0x2e7c('0x2a')][_0x2e7c('0x2b')]);_0x7cfc3f['query']=_['keys'](_0x5984ee[_0x2e7c('0x2e')]);_0x7cfc3f[_0x2e7c('0x3a')]=_['intersection'](_0x7cfc3f['model'],_0x7cfc3f[_0x2e7c('0x2e')]);_0x13d761[_0x2e7c('0x31')]=_[_0x2e7c('0x43')](_0x7cfc3f['model'],qs[_0x2e7c('0x32')](_0x5984ee[_0x2e7c('0x2e')][_0x2e7c('0x32')]));_0x13d761[_0x2e7c('0x31')]=_0x13d761[_0x2e7c('0x31')]['length']?_0x13d761[_0x2e7c('0x31')]:_0x7cfc3f[_0x2e7c('0x30')];if(_0x5984ee[_0x2e7c('0x2e')][_0x2e7c('0x3f')]){_0x13d761[_0x2e7c('0x40')]=[{'all':!![]}];}_0x13d761=_[_0x2e7c('0x3d')]({},_0x13d761,_0x5984ee['options']);return db[_0x2e7c('0x2a')][_0x2e7c('0x44')](_0x13d761)[_0x2e7c('0x25')](handleEntityNotFound(_0x1dc996,null))['then'](respondWithResult(_0x1dc996,null))[_0x2e7c('0x42')](handleError(_0x1dc996,null));};exports[_0x2e7c('0x45')]=function(_0x1f88df,_0x12666e){return db[_0x2e7c('0x2a')][_0x2e7c('0x45')](_0x1f88df[_0x2e7c('0x46')],{})['then'](respondWithResult(_0x12666e,0xc9))[_0x2e7c('0x42')](handleError(_0x12666e,null));};exports[_0x2e7c('0x47')]=function(_0xd20b9b,_0x5e3569){if(_0xd20b9b['body']['id']){delete _0xd20b9b[_0x2e7c('0x46')]['id'];}return db[_0x2e7c('0x2a')][_0x2e7c('0x44')]({'where':{'id':_0xd20b9b[_0x2e7c('0x48')]['id']}})[_0x2e7c('0x25')](handleEntityNotFound(_0x5e3569,null))[_0x2e7c('0x25')](saveUpdates(_0xd20b9b[_0x2e7c('0x46')],null))['then'](respondWithResult(_0x5e3569,null))['catch'](handleError(_0x5e3569,null));};exports[_0x2e7c('0x24')]=function(_0x34d486,_0x27fd64){return db[_0x2e7c('0x2a')][_0x2e7c('0x44')]({'where':{'id':_0x34d486[_0x2e7c('0x48')]['id']}})[_0x2e7c('0x25')](handleEntityNotFound(_0x27fd64,null))[_0x2e7c('0x25')](removeEntity(_0x27fd64,null))['catch'](handleError(_0x27fd64,null));}; \ No newline at end of file +var _0x3eff=['api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','stack','name','send','index','map','FreshsalesField','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','findAll','rows','catch','show','params','fields','length','include','create','body','find','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x405582,_0x2b2df6){var _0x1fb0bd=function(_0x1a5d31){while(--_0x1a5d31){_0x405582['push'](_0x405582['shift']());}};_0x1fb0bd(++_0x2b2df6);}(_0x3eff,0xdd));var _0xf3ef=function(_0x1ce834,_0x48dac9){_0x1ce834=_0x1ce834-0x0;var _0x248554=_0x3eff[_0x1ce834];return _0x248554;};'use strict';var emlformat=require(_0xf3ef('0x0'));var rimraf=require(_0xf3ef('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xf3ef('0x2'));var rp=require(_0xf3ef('0x3'));var moment=require(_0xf3ef('0x4'));var BPromise=require(_0xf3ef('0x5'));var Mustache=require(_0xf3ef('0x6'));var util=require(_0xf3ef('0x7'));var path=require(_0xf3ef('0x8'));var sox=require(_0xf3ef('0x9'));var csv=require(_0xf3ef('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf3ef('0xb'));var _=require(_0xf3ef('0xc'));var squel=require(_0xf3ef('0xd'));var crypto=require(_0xf3ef('0xe'));var jsforce=require(_0xf3ef('0xf'));var deskjs=require(_0xf3ef('0x10'));var toCsv=require(_0xf3ef('0xa'));var querystring=require(_0xf3ef('0x11'));var Papa=require(_0xf3ef('0x12'));var Redis=require(_0xf3ef('0x13'));var authService=require(_0xf3ef('0x14'));var qs=require(_0xf3ef('0x15'));var as=require(_0xf3ef('0x16'));var hardwareService=require(_0xf3ef('0x17'));var logger=require(_0xf3ef('0x18'))(_0xf3ef('0x19'));var utils=require('../../config/utils');var config=require(_0xf3ef('0x1a'));var licenseUtil=require(_0xf3ef('0x1b'));var db=require(_0xf3ef('0x1c'))['db'];function respondWithStatusCode(_0x195b70,_0x2845a5){_0x2845a5=_0x2845a5||0xcc;return function(_0x2cd646){if(_0x2cd646){return _0x195b70[_0xf3ef('0x1d')](_0x2845a5);}return _0x195b70[_0xf3ef('0x1e')](_0x2845a5)[_0xf3ef('0x1f')]();};}function respondWithResult(_0x416545,_0x444e4f){_0x444e4f=_0x444e4f||0xc8;return function(_0x59fafc){if(_0x59fafc){return _0x416545[_0xf3ef('0x1e')](_0x444e4f)[_0xf3ef('0x20')](_0x59fafc);}};}function respondWithFilteredResult(_0x3d1b77,_0x419e21){return function(_0x4c24b4){if(_0x4c24b4){var _0x12f74e=typeof _0x419e21[_0xf3ef('0x21')]===_0xf3ef('0x22')&&typeof _0x419e21[_0xf3ef('0x23')]===_0xf3ef('0x22');var _0x53bba1=_0x4c24b4[_0xf3ef('0x24')];var _0x4a49da=_0x12f74e?0x0:_0x419e21[_0xf3ef('0x21')];var _0x1da686=_0x12f74e?_0x4c24b4[_0xf3ef('0x24')]:_0x419e21[_0xf3ef('0x21')]+_0x419e21['limit'];var _0x2eb6cd;if(_0x1da686>=_0x53bba1){_0x1da686=_0x53bba1;_0x2eb6cd=0xc8;}else{_0x2eb6cd=0xce;}_0x3d1b77['status'](_0x2eb6cd);return _0x3d1b77['set'](_0xf3ef('0x25'),_0x4a49da+'-'+_0x1da686+'/'+_0x53bba1)[_0xf3ef('0x20')](_0x4c24b4);}return null;};}function patchUpdates(_0x33a9d3){return function(_0x44b2cb){try{jsonpatch[_0xf3ef('0x26')](_0x44b2cb,_0x33a9d3,!![]);}catch(_0x20cc2a){return BPromise[_0xf3ef('0x27')](_0x20cc2a);}return _0x44b2cb[_0xf3ef('0x28')]();};}function saveUpdates(_0xe48bad,_0x139432){return function(_0x413faa){if(_0x413faa){return _0x413faa[_0xf3ef('0x29')](_0xe48bad)[_0xf3ef('0x2a')](function(_0x36f395){return _0x36f395;});}return null;};}function removeEntity(_0x487b5c,_0x58cd52){return function(_0x4c274e){if(_0x4c274e){return _0x4c274e[_0xf3ef('0x2b')]()['then'](function(){_0x487b5c['status'](0xcc)[_0xf3ef('0x1f')]();});}};}function handleEntityNotFound(_0x1dac3c,_0x484c44){return function(_0x25c98a){if(!_0x25c98a){_0x1dac3c[_0xf3ef('0x1d')](0x194);}return _0x25c98a;};}function handleError(_0x203b18,_0x26d475){_0x26d475=_0x26d475||0x1f4;return function(_0x189570){logger['error'](_0x189570[_0xf3ef('0x2c')]);if(_0x189570[_0xf3ef('0x2d')]){delete _0x189570[_0xf3ef('0x2d')];}_0x203b18[_0xf3ef('0x1e')](_0x26d475)[_0xf3ef('0x2e')](_0x189570);};}exports[_0xf3ef('0x2f')]=function(_0x1c5e92,_0x48a7e5){var _0x11ec3e={},_0x23d35c={},_0x52ddf1={'count':0x0,'rows':[]};var _0x11fae1=_[_0xf3ef('0x30')](db[_0xf3ef('0x31')][_0xf3ef('0x32')],function(_0x5a6458){return{'name':_0x5a6458[_0xf3ef('0x33')],'type':_0x5a6458[_0xf3ef('0x34')][_0xf3ef('0x35')]};});_0x23d35c[_0xf3ef('0x36')]=_[_0xf3ef('0x30')](_0x11fae1,'name');_0x23d35c[_0xf3ef('0x37')]=_[_0xf3ef('0x38')](_0x1c5e92[_0xf3ef('0x37')]);_0x23d35c[_0xf3ef('0x39')]=_[_0xf3ef('0x3a')](_0x23d35c[_0xf3ef('0x36')],_0x23d35c['query']);_0x11ec3e[_0xf3ef('0x3b')]=_[_0xf3ef('0x3a')](_0x23d35c['model'],qs['fields'](_0x1c5e92[_0xf3ef('0x37')]['fields']));_0x11ec3e[_0xf3ef('0x3b')]=_0x11ec3e[_0xf3ef('0x3b')]['length']?_0x11ec3e[_0xf3ef('0x3b')]:_0x23d35c['model'];if(!_0x1c5e92[_0xf3ef('0x37')][_0xf3ef('0x3c')](_0xf3ef('0x3d'))){_0x11ec3e['limit']=qs[_0xf3ef('0x23')](_0x1c5e92[_0xf3ef('0x37')][_0xf3ef('0x23')]);_0x11ec3e[_0xf3ef('0x21')]=qs[_0xf3ef('0x21')](_0x1c5e92['query']['offset']);}_0x11ec3e[_0xf3ef('0x3e')]=qs['sort'](_0x1c5e92[_0xf3ef('0x37')][_0xf3ef('0x3f')]);_0x11ec3e[_0xf3ef('0x40')]=qs[_0xf3ef('0x39')](_[_0xf3ef('0x41')](_0x1c5e92['query'],_0x23d35c[_0xf3ef('0x39')]),_0x11fae1);if(_0x1c5e92[_0xf3ef('0x37')][_0xf3ef('0x42')]){_0x11ec3e[_0xf3ef('0x40')]=_['merge'](_0x11ec3e[_0xf3ef('0x40')],{'$or':_['map'](_0x11fae1,function(_0x3f0078){if(_0x3f0078['type']!==_0xf3ef('0x43')){var _0x1db202={};_0x1db202[_0x3f0078[_0xf3ef('0x2d')]]={'$like':'%'+_0x1c5e92[_0xf3ef('0x37')][_0xf3ef('0x42')]+'%'};return _0x1db202;}})});}_0x11ec3e=_[_0xf3ef('0x44')]({},_0x11ec3e,_0x1c5e92[_0xf3ef('0x45')]);var _0x21397f={'where':_0x11ec3e[_0xf3ef('0x40')]};return db['FreshsalesField'][_0xf3ef('0x24')](_0x21397f)[_0xf3ef('0x2a')](function(_0x46ed70){_0x52ddf1['count']=_0x46ed70;if(_0x1c5e92[_0xf3ef('0x37')][_0xf3ef('0x46')]){_0x11ec3e['include']=[{'all':!![]}];}return db[_0xf3ef('0x31')][_0xf3ef('0x47')](_0x11ec3e);})['then'](function(_0x282fb5){_0x52ddf1[_0xf3ef('0x48')]=_0x282fb5;return _0x52ddf1;})[_0xf3ef('0x2a')](respondWithFilteredResult(_0x48a7e5,_0x11ec3e))[_0xf3ef('0x49')](handleError(_0x48a7e5,null));};exports[_0xf3ef('0x4a')]=function(_0x247a51,_0x46b0c1){var _0x47bf79={'raw':!![],'where':{'id':_0x247a51[_0xf3ef('0x4b')]['id']}},_0x502700={};_0x502700['model']=_['keys'](db['FreshsalesField'][_0xf3ef('0x32')]);_0x502700[_0xf3ef('0x37')]=_[_0xf3ef('0x38')](_0x247a51[_0xf3ef('0x37')]);_0x502700['filters']=_[_0xf3ef('0x3a')](_0x502700[_0xf3ef('0x36')],_0x502700[_0xf3ef('0x37')]);_0x47bf79[_0xf3ef('0x3b')]=_[_0xf3ef('0x3a')](_0x502700[_0xf3ef('0x36')],qs['fields'](_0x247a51[_0xf3ef('0x37')][_0xf3ef('0x4c')]));_0x47bf79[_0xf3ef('0x3b')]=_0x47bf79['attributes'][_0xf3ef('0x4d')]?_0x47bf79[_0xf3ef('0x3b')]:_0x502700[_0xf3ef('0x36')];if(_0x247a51['query'][_0xf3ef('0x46')]){_0x47bf79[_0xf3ef('0x4e')]=[{'all':!![]}];}_0x47bf79=_[_0xf3ef('0x44')]({},_0x47bf79,_0x247a51[_0xf3ef('0x45')]);return db['FreshsalesField']['find'](_0x47bf79)[_0xf3ef('0x2a')](handleEntityNotFound(_0x46b0c1,null))[_0xf3ef('0x2a')](respondWithResult(_0x46b0c1,null))['catch'](handleError(_0x46b0c1,null));};exports[_0xf3ef('0x4f')]=function(_0x5e39e3,_0x15b9b1){return db[_0xf3ef('0x31')]['create'](_0x5e39e3[_0xf3ef('0x50')],{})[_0xf3ef('0x2a')](respondWithResult(_0x15b9b1,0xc9))[_0xf3ef('0x49')](handleError(_0x15b9b1,null));};exports['update']=function(_0x30543e,_0x4d0bb1){if(_0x30543e[_0xf3ef('0x50')]['id']){delete _0x30543e[_0xf3ef('0x50')]['id'];}return db['FreshsalesField'][_0xf3ef('0x51')]({'where':{'id':_0x30543e['params']['id']}})[_0xf3ef('0x2a')](handleEntityNotFound(_0x4d0bb1,null))[_0xf3ef('0x2a')](saveUpdates(_0x30543e[_0xf3ef('0x50')],null))['then'](respondWithResult(_0x4d0bb1,null))[_0xf3ef('0x49')](handleError(_0x4d0bb1,null));};exports['destroy']=function(_0x2f6322,_0x2a9a91){return db[_0xf3ef('0x31')][_0xf3ef('0x51')]({'where':{'id':_0x2f6322[_0xf3ef('0x4b')]['id']}})[_0xf3ef('0x2a')](handleEntityNotFound(_0x2a9a91,null))[_0xf3ef('0x2a')](removeEntity(_0x2a9a91,null))[_0xf3ef('0x49')](handleError(_0x2a9a91,null));}; \ No newline at end of file diff --git a/server/api/intFreshsalesField/intFreshsalesField.model.js b/server/api/intFreshsalesField/intFreshsalesField.model.js index 6c50bde..c6e042b 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 _0x9a1b=['bluebird','request-promise','path','../../config/environment','./intFreshsalesField.attributes','define','int_freshsales_fields','freshsales_unique_index','idField','FieldId','lodash','moment'];(function(_0x1e28e6,_0x11b9b7){var _0x478351=function(_0x4b62c7){while(--_0x4b62c7){_0x1e28e6['push'](_0x1e28e6['shift']());}};_0x478351(++_0x11b9b7);}(_0x9a1b,0x1ba));var _0xb9a1=function(_0x323b82,_0x415ac3){_0x323b82=_0x323b82-0x0;var _0x1dcca1=_0x9a1b[_0x323b82];return _0x1dcca1;};'use strict';var _=require(_0xb9a1('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0xb9a1('0x1'));var BPromise=require(_0xb9a1('0x2'));var rp=require(_0xb9a1('0x3'));var fs=require('fs');var path=require(_0xb9a1('0x4'));var rimraf=require('rimraf');var config=require(_0xb9a1('0x5'));var attributes=require(_0xb9a1('0x6'));module['exports']=function(_0x69b74e,_0x455fac){return _0x69b74e[_0xb9a1('0x7')]('FreshsalesField',attributes,{'tableName':_0xb9a1('0x8'),'paranoid':![],'indexes':[{'name':_0xb9a1('0x9'),'fields':[_0xb9a1('0xa'),_0xb9a1('0xb')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x30c7=['int_freshsales_fields','freshsales_unique_index','FieldId','lodash','../../config/logger','api','moment','request-promise','path','FreshsalesField'];(function(_0x17df1b,_0x4cf1d7){var _0x297263=function(_0x46c3a5){while(--_0x46c3a5){_0x17df1b['push'](_0x17df1b['shift']());}};_0x297263(++_0x4cf1d7);}(_0x30c7,0x111));var _0x730c=function(_0x379985,_0x420d52){_0x379985=_0x379985-0x0;var _0x50b857=_0x30c7[_0x379985];return _0x50b857;};'use strict';var _=require(_0x730c('0x0'));var util=require('util');var logger=require(_0x730c('0x1'))(_0x730c('0x2'));var moment=require(_0x730c('0x3'));var BPromise=require('bluebird');var rp=require(_0x730c('0x4'));var fs=require('fs');var path=require(_0x730c('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intFreshsalesField.attributes');module['exports']=function(_0x3516be,_0x229682){return _0x3516be['define'](_0x730c('0x6'),attributes,{'tableName':_0x730c('0x7'),'paranoid':![],'indexes':[{'name':_0x730c('0x8'),'fields':['idField',_0x730c('0x9')],'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 4cc7536..2022cb3 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 _0x326f=['info','FreshsalesField,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x5ef6cb,_0x242d4c){var _0x48d687=function(_0x4a4d83){while(--_0x4a4d83){_0x5ef6cb['push'](_0x5ef6cb['shift']());}};_0x48d687(++_0x242d4c);}(_0x326f,0xd1));var _0xf326=function(_0x4b3e48,_0x48d15e){_0x4b3e48=_0x4b3e48-0x0;var _0x1571f1=_0x326f[_0x4b3e48];return _0x1571f1;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xf326('0x1'));var rs=require(_0xf326('0x2'));var fs=require('fs');var Redis=require(_0xf326('0x3'));var db=require(_0xf326('0x4'))['db'];var utils=require(_0xf326('0x5'));var logger=require(_0xf326('0x6'))(_0xf326('0x7'));var config=require(_0xf326('0x8'));var jayson=require(_0xf326('0x9'));var client=jayson[_0xf326('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3c254d,_0x3851eb,_0x165f95){return new BPromise(function(_0x1e7b8a,_0x515bfa){return client['request'](_0x3c254d,_0x165f95)['then'](function(_0x3bacf2){logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));logger[_0xf326('0xe')]('FreshsalesField,\x20%s,\x20%s,\x20%s',_0x3851eb,_0xf326('0xd'),JSON['stringify'](_0x3bacf2));if(_0x3bacf2[_0xf326('0xf')]){if(_0x3bacf2['error'][_0xf326('0x10')]===0x1f4){logger['error'](_0xf326('0xc'),_0x3851eb,_0x3bacf2[_0xf326('0xf')]['message']);return _0x515bfa(_0x3bacf2[_0xf326('0xf')][_0xf326('0x11')]);}logger[_0xf326('0xf')](_0xf326('0xc'),_0x3851eb,_0x3bacf2['error'][_0xf326('0x11')]);return _0x1e7b8a(_0x3bacf2['error']['message']);}else{logger[_0xf326('0xb')](_0xf326('0xc'),_0x3851eb,_0xf326('0xd'));_0x1e7b8a(_0x3bacf2[_0xf326('0x12')][_0xf326('0x11')]);}})[_0xf326('0x13')](function(_0x34128e){logger[_0xf326('0xf')]('FreshsalesField,\x20%s,\x20%s',_0x3851eb,_0x34128e);_0x515bfa(_0x34128e);});});} \ No newline at end of file +var _0x5fc3=['../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','stringify','error','code','message','FreshsalesField,\x20%s,\x20%s','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc'];(function(_0x22f92b,_0x5b7618){var _0x2c483e=function(_0x41765f){while(--_0x41765f){_0x22f92b['push'](_0x22f92b['shift']());}};_0x2c483e(++_0x5b7618);}(_0x5fc3,0xa8));var _0x35fc=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0x5fc3[_0x3511d3];return _0x5d6321;};'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')]('FreshsalesField,\x20%s,\x20%s',_0x508b32,_0x35fc('0xd'));logger[_0x35fc('0xe')]('FreshsalesField,\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']('FreshsalesField,\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);});});} \ No newline at end of file diff --git a/server/api/intSalesforceAccount/index.js b/server/api/intSalesforceAccount/index.js index a2a844d..b2e4212 100644 --- a/server/api/intSalesforceAccount/index.js +++ b/server/api/intSalesforceAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSalesforceAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x54db87,_0x2c9fb5){var _0xf5a3f7=function(_0x1b1a7c){while(--_0x1b1a7c){_0x54db87['push'](_0x54db87['shift']());}};_0xf5a3f7(++_0x2c9fb5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0xa9e0[_0x19e35c];return _0x3e1fe8;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0x9957=['connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intSalesforceAccount.controller','get','isAuthenticated','index','/:id','show','getConfigurations','/:id/fields','getFields','post','create','addConfiguration','put','update','delete','destroy','exports','multer','util','path'];(function(_0x50abf3,_0x54a287){var _0x33b348=function(_0x173922){while(--_0x173922){_0x50abf3['push'](_0x50abf3['shift']());}};_0x33b348(++_0x54a287);}(_0x9957,0x93));var _0x7995=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x9957[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0x9')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0xe')]);router[_0x7995('0x9')](_0x7995('0xf'),auth[_0x7995('0xa')](),controller[_0x7995('0x10')]);router[_0x7995('0x11')]('/',auth['isAuthenticated'](),controller[_0x7995('0x12')]);router[_0x7995('0x11')]('/:id/configurations',auth[_0x7995('0xa')](),controller[_0x7995('0x13')]);router[_0x7995('0x14')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x15')]);router[_0x7995('0x16')]('/:id',auth['isAuthenticated'](),controller[_0x7995('0x17')]);module[_0x7995('0x18')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js b/server/api/intSalesforceAccount/intSalesforceAccount.attributes.js index 35613ca..41ac983 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 _0x5943=['newTab','sequelize','exports','STRING','username','ENUM','integrationTab'];(function(_0x2a077d,_0x84e86b){var _0x1d3027=function(_0x2e2aa6){while(--_0x2e2aa6){_0x2a077d['push'](_0x2a077d['shift']());}};_0x1d3027(++_0x84e86b);}(_0x5943,0x1f2));var _0x3594=function(_0x25f9a4,_0x260641){_0x25f9a4=_0x25f9a4-0x0;var _0x138f3c=_0x5943[_0x25f9a4];return _0x138f3c;};'use strict';var Sequelize=require(_0x3594('0x0'));module[_0x3594('0x1')]={'name':{'type':Sequelize[_0x3594('0x2')]},'description':{'type':Sequelize[_0x3594('0x2')]},'username':{'type':Sequelize[_0x3594('0x2')],'unique':_0x3594('0x3')},'remoteUri':{'type':Sequelize[_0x3594('0x2')]},'password':{'type':Sequelize[_0x3594('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize['STRING']},'securityToken':{'type':Sequelize[_0x3594('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x3594('0x4')](_0x3594('0x5'),_0x3594('0x6')),'defaultValue':_0x3594('0x5')}}; \ No newline at end of file +var _0xa282=['username','ENUM','integrationTab','sequelize','exports','STRING'];(function(_0x1498e0,_0x53c808){var _0x53e988=function(_0x412980){while(--_0x412980){_0x1498e0['push'](_0x1498e0['shift']());}};_0x53e988(++_0x53c808);}(_0xa282,0x189));var _0x2a28=function(_0x16b9ed,_0x56517a){_0x16b9ed=_0x16b9ed-0x0;var _0x66b1f8=_0xa282[_0x16b9ed];return _0x66b1f8;};'use strict';var Sequelize=require(_0x2a28('0x0'));module[_0x2a28('0x1')]={'name':{'type':Sequelize[_0x2a28('0x2')]},'description':{'type':Sequelize[_0x2a28('0x2')]},'username':{'type':Sequelize[_0x2a28('0x2')],'unique':_0x2a28('0x3')},'remoteUri':{'type':Sequelize[_0x2a28('0x2')]},'password':{'type':Sequelize[_0x2a28('0x2')]},'clientId':{'type':Sequelize[_0x2a28('0x2')]},'clientSecret':{'type':Sequelize[_0x2a28('0x2')]},'securityToken':{'type':Sequelize[_0x2a28('0x2')]},'serverUrl':{'type':Sequelize[_0x2a28('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x2a28('0x4')]('integrationTab','newTab'),'defaultValue':_0x2a28('0x5')}}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.controller.js b/server/api/intSalesforceAccount/intSalesforceAccount.controller.js index b910d27..f1da58b 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 _0xad38=['destroy','stack','name','send','fieldName','type','key','model','map','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','sort','pick','filter','where','merge','VIRTUAL','SalesforceAccount','includeAll','include','catch','show','params','rawAttributes','length','options','find','create','body','getConfigurations','order','addConfiguration','findOne','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','SalesforceConfiguration','SalesforceField','Task','remoteUri','clientId','username','password','securityToken','substring','lastIndexOf','Connection','clientSecret','login','concat','isNil','ticketType','sobject','ActivityDate','IsReminderSet','IsRecurrence','Subject','Description','int','boolean','email','phone','remove','label','custom','picklistValues','value','True','true','false','test','error','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','../../components/integrations/configuration','end','status','json','limit','undefined','count','offset','Content-Range','reject','save','update','then'];(function(_0x51ab83,_0x2721b9){var _0x14b6de=function(_0x243483){while(--_0x243483){_0x51ab83['push'](_0x51ab83['shift']());}};_0x14b6de(++_0x2721b9);}(_0xad38,0x149));var _0x8ad3=function(_0xe58887,_0x51ae5e){_0xe58887=_0xe58887-0x0;var _0x263605=_0xad38[_0xe58887];return _0x263605;};'use strict';var emlformat=require(_0x8ad3('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8ad3('0x1'));var jsonpatch=require(_0x8ad3('0x2'));var rp=require(_0x8ad3('0x3'));var moment=require(_0x8ad3('0x4'));var BPromise=require(_0x8ad3('0x5'));var Mustache=require(_0x8ad3('0x6'));var util=require(_0x8ad3('0x7'));var path=require(_0x8ad3('0x8'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x8ad3('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8ad3('0xa'));var squel=require(_0x8ad3('0xb'));var crypto=require('crypto');var jsforce=require(_0x8ad3('0xc'));var deskjs=require(_0x8ad3('0xd'));var toCsv=require(_0x8ad3('0xe'));var querystring=require(_0x8ad3('0xf'));var Papa=require(_0x8ad3('0x10'));var Redis=require('ioredis');var authService=require(_0x8ad3('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x8ad3('0x12'));var hardwareService=require(_0x8ad3('0x13'));var logger=require(_0x8ad3('0x14'))(_0x8ad3('0x15'));var utils=require('../../config/utils');var config=require(_0x8ad3('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8ad3('0x17'))['db'];var integrations=require(_0x8ad3('0x18'));function respondWithStatusCode(_0x4c9fa3,_0xc85320){_0xc85320=_0xc85320||0xcc;return function(_0x2ec63c){if(_0x2ec63c){return _0x4c9fa3['sendStatus'](_0xc85320);}return _0x4c9fa3['status'](_0xc85320)[_0x8ad3('0x19')]();};}function respondWithResult(_0x3dcc85,_0x65cec8){_0x65cec8=_0x65cec8||0xc8;return function(_0x153041){if(_0x153041){return _0x3dcc85[_0x8ad3('0x1a')](_0x65cec8)[_0x8ad3('0x1b')](_0x153041);}};}function respondWithFilteredResult(_0x45f724,_0x33b92d){return function(_0x5f3fae){if(_0x5f3fae){var _0x582a97=typeof _0x33b92d['offset']==='undefined'&&typeof _0x33b92d[_0x8ad3('0x1c')]===_0x8ad3('0x1d');var _0x13c469=_0x5f3fae[_0x8ad3('0x1e')];var _0x19c721=_0x582a97?0x0:_0x33b92d[_0x8ad3('0x1f')];var _0x120af3=_0x582a97?_0x5f3fae[_0x8ad3('0x1e')]:_0x33b92d[_0x8ad3('0x1f')]+_0x33b92d[_0x8ad3('0x1c')];var _0x21e648;if(_0x120af3>=_0x13c469){_0x120af3=_0x13c469;_0x21e648=0xc8;}else{_0x21e648=0xce;}_0x45f724[_0x8ad3('0x1a')](_0x21e648);return _0x45f724['set'](_0x8ad3('0x20'),_0x19c721+'-'+_0x120af3+'/'+_0x13c469)[_0x8ad3('0x1b')](_0x5f3fae);}return null;};}function patchUpdates(_0x2371e2){return function(_0x4d4bf4){try{jsonpatch['apply'](_0x4d4bf4,_0x2371e2,!![]);}catch(_0x24e8f0){return BPromise[_0x8ad3('0x21')](_0x24e8f0);}return _0x4d4bf4[_0x8ad3('0x22')]();};}function saveUpdates(_0x3f5b35,_0x2ad9d9){return function(_0x65dfac){if(_0x65dfac){return _0x65dfac[_0x8ad3('0x23')](_0x3f5b35)[_0x8ad3('0x24')](function(_0xda7777){return _0xda7777;});}return null;};}function removeEntity(_0x26d9e2,_0x353409){return function(_0x534881){if(_0x534881){return _0x534881[_0x8ad3('0x25')]()['then'](function(){_0x26d9e2['status'](0xcc)[_0x8ad3('0x19')]();});}};}function handleEntityNotFound(_0x5a9f34,_0x40da69){return function(_0x3db264){if(!_0x3db264){_0x5a9f34['sendStatus'](0x194);}return _0x3db264;};}function handleError(_0x48c836,_0x557f69){_0x557f69=_0x557f69||0x1f4;return function(_0x38daf7){logger['error'](_0x38daf7[_0x8ad3('0x26')]);if(_0x38daf7['name']){delete _0x38daf7[_0x8ad3('0x27')];}_0x48c836[_0x8ad3('0x1a')](_0x557f69)[_0x8ad3('0x28')](_0x38daf7);};}exports['index']=function(_0x134eff,_0x52ebf5){var _0x106cbb={},_0xa8d8e2={},_0x362a1d={'count':0x0,'rows':[]};var _0x173520=_['map'](db['SalesforceAccount']['rawAttributes'],function(_0x3e8ad3){return{'name':_0x3e8ad3[_0x8ad3('0x29')],'type':_0x3e8ad3[_0x8ad3('0x2a')][_0x8ad3('0x2b')]};});_0xa8d8e2[_0x8ad3('0x2c')]=_[_0x8ad3('0x2d')](_0x173520,_0x8ad3('0x27'));_0xa8d8e2[_0x8ad3('0x2e')]=_[_0x8ad3('0x2f')](_0x134eff[_0x8ad3('0x2e')]);_0xa8d8e2[_0x8ad3('0x30')]=_[_0x8ad3('0x31')](_0xa8d8e2[_0x8ad3('0x2c')],_0xa8d8e2['query']);_0x106cbb[_0x8ad3('0x32')]=_[_0x8ad3('0x31')](_0xa8d8e2[_0x8ad3('0x2c')],qs['fields'](_0x134eff['query'][_0x8ad3('0x33')]));_0x106cbb['attributes']=_0x106cbb[_0x8ad3('0x32')]['length']?_0x106cbb[_0x8ad3('0x32')]:_0xa8d8e2[_0x8ad3('0x2c')];if(!_0x134eff[_0x8ad3('0x2e')][_0x8ad3('0x34')](_0x8ad3('0x35'))){_0x106cbb[_0x8ad3('0x1c')]=qs[_0x8ad3('0x1c')](_0x134eff[_0x8ad3('0x2e')]['limit']);_0x106cbb['offset']=qs['offset'](_0x134eff[_0x8ad3('0x2e')]['offset']);}_0x106cbb['order']=qs[_0x8ad3('0x36')](_0x134eff['query'][_0x8ad3('0x36')]);_0x106cbb['where']=qs[_0x8ad3('0x30')](_[_0x8ad3('0x37')](_0x134eff[_0x8ad3('0x2e')],_0xa8d8e2['filters']),_0x173520);if(_0x134eff[_0x8ad3('0x2e')][_0x8ad3('0x38')]){_0x106cbb[_0x8ad3('0x39')]=_[_0x8ad3('0x3a')](_0x106cbb['where'],{'$or':_[_0x8ad3('0x2d')](_0x173520,function(_0x3eebc6){if(_0x3eebc6[_0x8ad3('0x2a')]!==_0x8ad3('0x3b')){var _0x17eddd={};_0x17eddd[_0x3eebc6['name']]={'$like':'%'+_0x134eff[_0x8ad3('0x2e')][_0x8ad3('0x38')]+'%'};return _0x17eddd;}})});}_0x106cbb=_[_0x8ad3('0x3a')]({},_0x106cbb,_0x134eff['options']);var _0x5aa786={'where':_0x106cbb[_0x8ad3('0x39')]};return db[_0x8ad3('0x3c')]['count'](_0x5aa786)[_0x8ad3('0x24')](function(_0x3d9be8){_0x362a1d[_0x8ad3('0x1e')]=_0x3d9be8;if(_0x134eff['query'][_0x8ad3('0x3d')]){_0x106cbb[_0x8ad3('0x3e')]=[{'all':!![]}];}return db[_0x8ad3('0x3c')]['findAll'](_0x106cbb);})['then'](function(_0x11e09e){_0x362a1d['rows']=_0x11e09e;return _0x362a1d;})['then'](respondWithFilteredResult(_0x52ebf5,_0x106cbb))[_0x8ad3('0x3f')](handleError(_0x52ebf5,null));};exports[_0x8ad3('0x40')]=function(_0x34e416,_0x3eba26){var _0x2c7906={'raw':![],'where':{'id':_0x34e416[_0x8ad3('0x41')]['id']}},_0x1935ca={};_0x1935ca[_0x8ad3('0x2c')]=_['keys'](db[_0x8ad3('0x3c')][_0x8ad3('0x42')]);_0x1935ca[_0x8ad3('0x2e')]=_[_0x8ad3('0x2f')](_0x34e416[_0x8ad3('0x2e')]);_0x1935ca['filters']=_['intersection'](_0x1935ca[_0x8ad3('0x2c')],_0x1935ca[_0x8ad3('0x2e')]);_0x2c7906['attributes']=_[_0x8ad3('0x31')](_0x1935ca[_0x8ad3('0x2c')],qs[_0x8ad3('0x33')](_0x34e416['query'][_0x8ad3('0x33')]));_0x2c7906[_0x8ad3('0x32')]=_0x2c7906[_0x8ad3('0x32')][_0x8ad3('0x43')]?_0x2c7906['attributes']:_0x1935ca['model'];if(_0x34e416[_0x8ad3('0x2e')][_0x8ad3('0x3d')]){_0x2c7906[_0x8ad3('0x3e')]=[{'all':!![]}];}_0x2c7906=_[_0x8ad3('0x3a')]({},_0x2c7906,_0x34e416[_0x8ad3('0x44')]);return db[_0x8ad3('0x3c')][_0x8ad3('0x45')](_0x2c7906)[_0x8ad3('0x24')](handleEntityNotFound(_0x3eba26,null))['then'](respondWithResult(_0x3eba26,null))[_0x8ad3('0x3f')](handleError(_0x3eba26,null));};exports[_0x8ad3('0x46')]=function(_0x5678c8,_0x4e23f4){return db[_0x8ad3('0x3c')]['create'](_0x5678c8['body'],{})[_0x8ad3('0x24')](respondWithResult(_0x4e23f4,0xc9))[_0x8ad3('0x3f')](handleError(_0x4e23f4,null));};exports[_0x8ad3('0x23')]=function(_0x15f583,_0xf0134c){if(_0x15f583[_0x8ad3('0x47')]['id']){delete _0x15f583[_0x8ad3('0x47')]['id'];}return db[_0x8ad3('0x3c')]['find']({'where':{'id':_0x15f583[_0x8ad3('0x41')]['id']}})['then'](handleEntityNotFound(_0xf0134c,null))[_0x8ad3('0x24')](saveUpdates(_0x15f583['body'],null))[_0x8ad3('0x24')](respondWithResult(_0xf0134c,null))['catch'](handleError(_0xf0134c,null));};exports[_0x8ad3('0x25')]=function(_0x108cf0,_0x300311){return db[_0x8ad3('0x3c')][_0x8ad3('0x45')]({'where':{'id':_0x108cf0[_0x8ad3('0x41')]['id']}})[_0x8ad3('0x24')](handleEntityNotFound(_0x300311,null))['then'](removeEntity(_0x300311,null))[_0x8ad3('0x3f')](handleError(_0x300311,null));};exports[_0x8ad3('0x48')]=function(_0x554498,_0x1d7c84,_0xad2f54){var _0x15a4e0={};var _0x4a6064={};var _0x30bddf;var _0x31fec8;return db['SalesforceAccount']['findOne']({'where':{'id':_0x554498[_0x8ad3('0x41')]['id']}})[_0x8ad3('0x24')](handleEntityNotFound(_0x1d7c84,null))[_0x8ad3('0x24')](function(_0x90a175){if(_0x90a175){_0x30bddf=_0x90a175;_0x4a6064[_0x8ad3('0x2c')]=_[_0x8ad3('0x2f')](db['SalesforceConfiguration'][_0x8ad3('0x42')]);_0x4a6064[_0x8ad3('0x2e')]=_['keys'](_0x554498[_0x8ad3('0x2e')]);_0x4a6064[_0x8ad3('0x30')]=_[_0x8ad3('0x31')](_0x4a6064[_0x8ad3('0x2c')],_0x4a6064[_0x8ad3('0x2e')]);_0x15a4e0[_0x8ad3('0x32')]=_[_0x8ad3('0x31')](_0x4a6064[_0x8ad3('0x2c')],qs[_0x8ad3('0x33')](_0x554498[_0x8ad3('0x2e')][_0x8ad3('0x33')]));_0x15a4e0[_0x8ad3('0x32')]=_0x15a4e0[_0x8ad3('0x32')][_0x8ad3('0x43')]?_0x15a4e0['attributes']:_0x4a6064[_0x8ad3('0x2c')];_0x15a4e0[_0x8ad3('0x49')]=qs[_0x8ad3('0x36')](_0x554498[_0x8ad3('0x2e')][_0x8ad3('0x36')]);_0x15a4e0['where']=qs['filters'](_[_0x8ad3('0x37')](_0x554498[_0x8ad3('0x2e')],_0x4a6064[_0x8ad3('0x30')]));if(_0x554498[_0x8ad3('0x2e')]['filter']){_0x15a4e0['where']=_[_0x8ad3('0x3a')](_0x15a4e0[_0x8ad3('0x39')],{'$or':_['map'](_0x15a4e0['attributes'],function(_0x438431){var _0x26f810={};_0x26f810[_0x438431]={'$like':'%'+_0x554498[_0x8ad3('0x2e')]['filter']+'%'};return _0x26f810;})});}_0x15a4e0=_[_0x8ad3('0x3a')]({},_0x15a4e0,_0x554498[_0x8ad3('0x44')]);return _0x30bddf[_0x8ad3('0x48')](_0x15a4e0);}})[_0x8ad3('0x24')](function(_0x1600aa){if(_0x1600aa){_0x31fec8=_0x1600aa[_0x8ad3('0x43')];if(!_0x554498['query'][_0x8ad3('0x34')](_0x8ad3('0x35'))){_0x15a4e0[_0x8ad3('0x1c')]=qs[_0x8ad3('0x1c')](_0x554498['query'][_0x8ad3('0x1c')]);_0x15a4e0['offset']=qs[_0x8ad3('0x1f')](_0x554498[_0x8ad3('0x2e')][_0x8ad3('0x1f')]);}return _0x30bddf['getConfigurations'](_0x15a4e0);}})[_0x8ad3('0x24')](function(_0x4ab593){if(_0x4ab593){return _0x4ab593?{'count':_0x31fec8,'rows':_0x4ab593}:null;}})['then'](respondWithResult(_0x1d7c84,null))[_0x8ad3('0x3f')](handleError(_0x1d7c84,null));};exports[_0x8ad3('0x4a')]=function(_0x27cec8,_0x5ac8a7,_0x2248d0){if(_0x27cec8[_0x8ad3('0x47')]['id']){delete _0x27cec8[_0x8ad3('0x47')]['id'];}return db[_0x8ad3('0x3c')][_0x8ad3('0x4b')]({'where':{'id':_0x27cec8[_0x8ad3('0x41')]['id']}})[_0x8ad3('0x24')](handleEntityNotFound(_0x5ac8a7,null))[_0x8ad3('0x24')](function(_0x232058){if(_0x232058){_0x27cec8[_0x8ad3('0x47')][_0x8ad3('0x4c')]=_0x232058['id'];_0x27cec8[_0x8ad3('0x47')][_0x8ad3('0x4d')]=integrations[_0x8ad3('0x4e')](_0x27cec8[_0x8ad3('0x47')][_0x8ad3('0x4f')],_0x27cec8[_0x8ad3('0x47')][_0x8ad3('0x2a')]);_0x27cec8[_0x8ad3('0x47')][_0x8ad3('0x50')]=integrations[_0x8ad3('0x51')](_0x27cec8['body']['channel'],_0x27cec8[_0x8ad3('0x47')][_0x8ad3('0x2a')]);return db[_0x8ad3('0x52')][_0x8ad3('0x46')](_0x27cec8[_0x8ad3('0x47')],{'include':[{'model':db[_0x8ad3('0x53')],'as':_0x8ad3('0x4d')},{'model':db[_0x8ad3('0x53')],'as':_0x8ad3('0x50')}]});}return null;})[_0x8ad3('0x24')](respondWithResult(_0x5ac8a7,null))[_0x8ad3('0x3f')](handleError(_0x5ac8a7,null));};exports['getFields']=function(_0x5efece,_0x4e06ff,_0x33b84d){var _0x2826c7;var _0x5a0453='';var _0x280407=_0x8ad3('0x54');return db['SalesforceAccount'][_0x8ad3('0x4b')]({'where':{'id':_0x5efece[_0x8ad3('0x41')]['id']},'attributes':['id',_0x8ad3('0x55'),_0x8ad3('0x56'),'clientSecret',_0x8ad3('0x57'),_0x8ad3('0x58'),_0x8ad3('0x59')]})[_0x8ad3('0x24')](handleEntityNotFound(_0x4e06ff,null))[_0x8ad3('0x24')](function(_0x31af9c){if(_0x31af9c){_0x5a0453=_0x31af9c[_0x8ad3('0x55')];var _0x4a19b2=_0x5a0453['slice'](-0x1);if(_0x4a19b2==='/'){_0x5a0453=_0x5a0453[_0x8ad3('0x5a')](0x0,_0x5a0453[_0x8ad3('0x5b')](_0x4a19b2));}_0x2826c7=new jsforce[(_0x8ad3('0x5c'))]({'oauth2':{'loginUrl':_0x5a0453,'clientId':_0x31af9c[_0x8ad3('0x56')],'clientSecret':_0x31af9c[_0x8ad3('0x5d')]}});return _0x2826c7[_0x8ad3('0x5e')](_0x31af9c['username'],_0x31af9c[_0x8ad3('0x58')][_0x8ad3('0x5f')](_0x31af9c[_0x8ad3('0x59')]));}})['then'](function(_0x49110c){if(_0x49110c){if(!_[_0x8ad3('0x60')](_0x5efece[_0x8ad3('0x2e')][_0x8ad3('0x61')])){_0x280407=_0x5efece['query'][_0x8ad3('0x61')];}return _0x2826c7[_0x8ad3('0x62')](_0x280407)['describe']();}})[_0x8ad3('0x24')](function(_0x5b933c){var _0x57bc1e=['OwnerId',_0x8ad3('0x63'),_0x8ad3('0x64'),_0x8ad3('0x65'),_0x8ad3('0x66'),_0x8ad3('0x67')];var _0x4f0deb=['string',_0x8ad3('0x68'),'picklist',_0x8ad3('0x69'),_0x8ad3('0x6a'),'textarea',_0x8ad3('0x6b')];if(_0x5b933c){_[_0x8ad3('0x6c')](_0x5b933c[_0x8ad3('0x33')],function(_0x387fdf){return _0x57bc1e['includes'](_0x387fdf['name'])||!_0x4f0deb['includes'](_0x387fdf['type']);});return{'count':_0x5b933c['fields']['length'],'rows':_[_0x8ad3('0x2d')](_0x5b933c[_0x8ad3('0x33')],function(_0x42ab05){return{'id':_0x42ab05[_0x8ad3('0x27')],'name':_0x42ab05[_0x8ad3('0x6d')],'custom':_0x42ab05[_0x8ad3('0x6e')],'options':_0x42ab05[_0x8ad3('0x6f')][_0x8ad3('0x43')]>0x0?_[_0x8ad3('0x2d')](_0x42ab05[_0x8ad3('0x6f')],function(_0x3433b0){return{'name':_0x3433b0['label'],'value':_0x3433b0[_0x8ad3('0x70')]};}):_0x42ab05['type']=='boolean'?[{'name':_0x8ad3('0x71'),'value':_0x8ad3('0x72')},{'name':'False','value':_0x8ad3('0x73')}]:[]};})};}})[_0x8ad3('0x24')](respondWithResult(_0x4e06ff,null))[_0x8ad3('0x3f')](function(_0x357fd9){var _0x283b87=_0x5efece[_0x8ad3('0x2e')][_0x8ad3('0x74')]?0x1f4:_0x357fd9['statusCode']||0x1f4;logger[_0x8ad3('0x75')](_0x8ad3('0x76'),_0x8ad3('0x77'),_0x283b87,JSON[_0x8ad3('0x78')](_0x357fd9));delete _0x357fd9['name'];if(_0x283b87===0x191){_0x283b87=0x190;}_0x4e06ff['status'](_0x283b87)[_0x8ad3('0x28')](_0x5efece[_0x8ad3('0x2e')][_0x8ad3('0x74')]?{'message':'Wrong\x20credentials','statusCode':_0x357fd9[_0x8ad3('0x79')]}:_0x357fd9);});}; \ No newline at end of file +var _0x5a08=['boolean','email','textarea','phone','remove','includes','label','custom','picklistValues','value','True','true','false','statusCode','stringify','Wrong\x20credentials','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','where','merge','VIRTUAL','filter','options','SalesforceAccount','includeAll','include','findAll','show','catch','create','update','body','find','params','getConfigurations','findOne','addConfiguration','Subjects','getSubjects','Descriptions','getDescriptions','channel','SalesforceConfiguration','getFields','remoteUri','clientId','clientSecret','username','password','securityToken','slice','substring','lastIndexOf','login','concat','isNil','ticketType','sobject','describe','OwnerId','ActivityDate','IsReminderSet','Subject','int','picklist'];(function(_0x4636c9,_0x2227f0){var _0x5ab860=function(_0x1622d4){while(--_0x1622d4){_0x4636c9['push'](_0x4636c9['shift']());}};_0x5ab860(++_0x2227f0);}(_0x5a08,0x187));var _0x85a0=function(_0x5dd57b,_0x1d6257){_0x5dd57b=_0x5dd57b-0x0;var _0x4cad9f=_0x5a08[_0x5dd57b];return _0x4cad9f;};'use strict';var emlformat=require(_0x85a0('0x0'));var rimraf=require(_0x85a0('0x1'));var zipdir=require(_0x85a0('0x2'));var jsonpatch=require(_0x85a0('0x3'));var rp=require(_0x85a0('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x85a0('0x5'));var util=require('util');var path=require(_0x85a0('0x6'));var sox=require(_0x85a0('0x7'));var csv=require(_0x85a0('0x8'));var ejs=require(_0x85a0('0x9'));var fs=require('fs');var fs_extra=require(_0x85a0('0xa'));var _=require(_0x85a0('0xb'));var squel=require(_0x85a0('0xc'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x85a0('0xd'));var toCsv=require(_0x85a0('0x8'));var querystring=require(_0x85a0('0xe'));var Papa=require('papaparse');var Redis=require(_0x85a0('0xf'));var authService=require(_0x85a0('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x85a0('0x11'));var hardwareService=require(_0x85a0('0x12'));var logger=require(_0x85a0('0x13'))(_0x85a0('0x14'));var utils=require('../../config/utils');var config=require(_0x85a0('0x15'));var licenseUtil=require(_0x85a0('0x16'));var db=require(_0x85a0('0x17'))['db'];var integrations=require(_0x85a0('0x18'));function respondWithStatusCode(_0x58d500,_0x398b1f){_0x398b1f=_0x398b1f||0xcc;return function(_0x382f69){if(_0x382f69){return _0x58d500['sendStatus'](_0x398b1f);}return _0x58d500[_0x85a0('0x19')](_0x398b1f)[_0x85a0('0x1a')]();};}function respondWithResult(_0x3f6dc2,_0x2cd035){_0x2cd035=_0x2cd035||0xc8;return function(_0x20ee53){if(_0x20ee53){return _0x3f6dc2[_0x85a0('0x19')](_0x2cd035)['json'](_0x20ee53);}};}function respondWithFilteredResult(_0x3e37f8,_0x35f05a){return function(_0x5bfc00){if(_0x5bfc00){var _0xd9fffd=typeof _0x35f05a[_0x85a0('0x1b')]===_0x85a0('0x1c')&&typeof _0x35f05a[_0x85a0('0x1d')]===_0x85a0('0x1c');var _0x4576e4=_0x5bfc00[_0x85a0('0x1e')];var _0x4704ad=_0xd9fffd?0x0:_0x35f05a[_0x85a0('0x1b')];var _0x26d8ae=_0xd9fffd?_0x5bfc00['count']:_0x35f05a[_0x85a0('0x1b')]+_0x35f05a[_0x85a0('0x1d')];var _0x57e65f;if(_0x26d8ae>=_0x4576e4){_0x26d8ae=_0x4576e4;_0x57e65f=0xc8;}else{_0x57e65f=0xce;}_0x3e37f8['status'](_0x57e65f);return _0x3e37f8[_0x85a0('0x1f')](_0x85a0('0x20'),_0x4704ad+'-'+_0x26d8ae+'/'+_0x4576e4)[_0x85a0('0x21')](_0x5bfc00);}return null;};}function patchUpdates(_0x4fba14){return function(_0x5d35a7){try{jsonpatch[_0x85a0('0x22')](_0x5d35a7,_0x4fba14,!![]);}catch(_0x284e43){return BPromise['reject'](_0x284e43);}return _0x5d35a7[_0x85a0('0x23')]();};}function saveUpdates(_0x5c9416,_0x56bcd5){return function(_0x4cc259){if(_0x4cc259){return _0x4cc259['update'](_0x5c9416)[_0x85a0('0x24')](function(_0xed71f0){return _0xed71f0;});}return null;};}function removeEntity(_0x5eddf6,_0x3ff7ec){return function(_0x17b977){if(_0x17b977){return _0x17b977[_0x85a0('0x25')]()[_0x85a0('0x24')](function(){_0x5eddf6['status'](0xcc)[_0x85a0('0x1a')]();});}};}function handleEntityNotFound(_0x2bd072,_0x1494ea){return function(_0x4572d7){if(!_0x4572d7){_0x2bd072[_0x85a0('0x26')](0x194);}return _0x4572d7;};}function handleError(_0x25604c,_0x3414b1){_0x3414b1=_0x3414b1||0x1f4;return function(_0x441d11){logger[_0x85a0('0x27')](_0x441d11[_0x85a0('0x28')]);if(_0x441d11[_0x85a0('0x29')]){delete _0x441d11[_0x85a0('0x29')];}_0x25604c[_0x85a0('0x19')](_0x3414b1)[_0x85a0('0x2a')](_0x441d11);};}exports[_0x85a0('0x2b')]=function(_0x4c16e8,_0x1e6e31){var _0x38b02b={},_0x3933c7={},_0x412da6={'count':0x0,'rows':[]};var _0x2e4abc=_[_0x85a0('0x2c')](db['SalesforceAccount'][_0x85a0('0x2d')],function(_0x2df878){return{'name':_0x2df878[_0x85a0('0x2e')],'type':_0x2df878[_0x85a0('0x2f')][_0x85a0('0x30')]};});_0x3933c7[_0x85a0('0x31')]=_[_0x85a0('0x2c')](_0x2e4abc,_0x85a0('0x29'));_0x3933c7[_0x85a0('0x32')]=_[_0x85a0('0x33')](_0x4c16e8[_0x85a0('0x32')]);_0x3933c7[_0x85a0('0x34')]=_[_0x85a0('0x35')](_0x3933c7[_0x85a0('0x31')],_0x3933c7[_0x85a0('0x32')]);_0x38b02b[_0x85a0('0x36')]=_[_0x85a0('0x35')](_0x3933c7[_0x85a0('0x31')],qs['fields'](_0x4c16e8['query'][_0x85a0('0x37')]));_0x38b02b[_0x85a0('0x36')]=_0x38b02b[_0x85a0('0x36')][_0x85a0('0x38')]?_0x38b02b[_0x85a0('0x36')]:_0x3933c7[_0x85a0('0x31')];if(!_0x4c16e8['query'][_0x85a0('0x39')](_0x85a0('0x3a'))){_0x38b02b[_0x85a0('0x1d')]=qs['limit'](_0x4c16e8[_0x85a0('0x32')][_0x85a0('0x1d')]);_0x38b02b[_0x85a0('0x1b')]=qs[_0x85a0('0x1b')](_0x4c16e8[_0x85a0('0x32')][_0x85a0('0x1b')]);}_0x38b02b[_0x85a0('0x3b')]=qs[_0x85a0('0x3c')](_0x4c16e8['query']['sort']);_0x38b02b['where']=qs[_0x85a0('0x34')](_[_0x85a0('0x3d')](_0x4c16e8[_0x85a0('0x32')],_0x3933c7[_0x85a0('0x34')]),_0x2e4abc);if(_0x4c16e8[_0x85a0('0x32')]['filter']){_0x38b02b[_0x85a0('0x3e')]=_[_0x85a0('0x3f')](_0x38b02b[_0x85a0('0x3e')],{'$or':_[_0x85a0('0x2c')](_0x2e4abc,function(_0x14e307){if(_0x14e307[_0x85a0('0x2f')]!==_0x85a0('0x40')){var _0x3bb212={};_0x3bb212[_0x14e307[_0x85a0('0x29')]]={'$like':'%'+_0x4c16e8[_0x85a0('0x32')][_0x85a0('0x41')]+'%'};return _0x3bb212;}})});}_0x38b02b=_[_0x85a0('0x3f')]({},_0x38b02b,_0x4c16e8[_0x85a0('0x42')]);var _0x5d0b5b={'where':_0x38b02b[_0x85a0('0x3e')]};return db[_0x85a0('0x43')]['count'](_0x5d0b5b)['then'](function(_0x422e65){_0x412da6[_0x85a0('0x1e')]=_0x422e65;if(_0x4c16e8[_0x85a0('0x32')][_0x85a0('0x44')]){_0x38b02b[_0x85a0('0x45')]=[{'all':!![]}];}return db[_0x85a0('0x43')][_0x85a0('0x46')](_0x38b02b);})['then'](function(_0x1c0310){_0x412da6['rows']=_0x1c0310;return _0x412da6;})[_0x85a0('0x24')](respondWithFilteredResult(_0x1e6e31,_0x38b02b))['catch'](handleError(_0x1e6e31,null));};exports[_0x85a0('0x47')]=function(_0x5ebf55,_0x132ea4){var _0xf0dc54={'raw':![],'where':{'id':_0x5ebf55['params']['id']}},_0x1d9f79={};_0x1d9f79[_0x85a0('0x31')]=_[_0x85a0('0x33')](db[_0x85a0('0x43')][_0x85a0('0x2d')]);_0x1d9f79[_0x85a0('0x32')]=_[_0x85a0('0x33')](_0x5ebf55['query']);_0x1d9f79['filters']=_[_0x85a0('0x35')](_0x1d9f79[_0x85a0('0x31')],_0x1d9f79[_0x85a0('0x32')]);_0xf0dc54[_0x85a0('0x36')]=_['intersection'](_0x1d9f79['model'],qs[_0x85a0('0x37')](_0x5ebf55[_0x85a0('0x32')][_0x85a0('0x37')]));_0xf0dc54[_0x85a0('0x36')]=_0xf0dc54[_0x85a0('0x36')][_0x85a0('0x38')]?_0xf0dc54['attributes']:_0x1d9f79[_0x85a0('0x31')];if(_0x5ebf55[_0x85a0('0x32')][_0x85a0('0x44')]){_0xf0dc54[_0x85a0('0x45')]=[{'all':!![]}];}_0xf0dc54=_[_0x85a0('0x3f')]({},_0xf0dc54,_0x5ebf55[_0x85a0('0x42')]);return db['SalesforceAccount']['find'](_0xf0dc54)['then'](handleEntityNotFound(_0x132ea4,null))[_0x85a0('0x24')](respondWithResult(_0x132ea4,null))[_0x85a0('0x48')](handleError(_0x132ea4,null));};exports['create']=function(_0x24a6e0,_0x379d48){return db[_0x85a0('0x43')][_0x85a0('0x49')](_0x24a6e0['body'],{})[_0x85a0('0x24')](respondWithResult(_0x379d48,0xc9))[_0x85a0('0x48')](handleError(_0x379d48,null));};exports[_0x85a0('0x4a')]=function(_0x1afb16,_0x4bc8b8){if(_0x1afb16[_0x85a0('0x4b')]['id']){delete _0x1afb16[_0x85a0('0x4b')]['id'];}return db[_0x85a0('0x43')][_0x85a0('0x4c')]({'where':{'id':_0x1afb16[_0x85a0('0x4d')]['id']}})[_0x85a0('0x24')](handleEntityNotFound(_0x4bc8b8,null))[_0x85a0('0x24')](saveUpdates(_0x1afb16[_0x85a0('0x4b')],null))[_0x85a0('0x24')](respondWithResult(_0x4bc8b8,null))[_0x85a0('0x48')](handleError(_0x4bc8b8,null));};exports['destroy']=function(_0x44097e,_0x171b4a){return db[_0x85a0('0x43')][_0x85a0('0x4c')]({'where':{'id':_0x44097e[_0x85a0('0x4d')]['id']}})[_0x85a0('0x24')](handleEntityNotFound(_0x171b4a,null))[_0x85a0('0x24')](removeEntity(_0x171b4a,null))[_0x85a0('0x48')](handleError(_0x171b4a,null));};exports[_0x85a0('0x4e')]=function(_0x5324f3,_0x4fc209,_0x493f1c){var _0x4f20a5={};var _0x5375bb={};var _0x1f87e0;var _0x233622;return db['SalesforceAccount'][_0x85a0('0x4f')]({'where':{'id':_0x5324f3['params']['id']}})[_0x85a0('0x24')](handleEntityNotFound(_0x4fc209,null))[_0x85a0('0x24')](function(_0x574225){if(_0x574225){_0x1f87e0=_0x574225;_0x5375bb[_0x85a0('0x31')]=_[_0x85a0('0x33')](db['SalesforceConfiguration']['rawAttributes']);_0x5375bb[_0x85a0('0x32')]=_[_0x85a0('0x33')](_0x5324f3[_0x85a0('0x32')]);_0x5375bb[_0x85a0('0x34')]=_[_0x85a0('0x35')](_0x5375bb[_0x85a0('0x31')],_0x5375bb[_0x85a0('0x32')]);_0x4f20a5[_0x85a0('0x36')]=_['intersection'](_0x5375bb[_0x85a0('0x31')],qs[_0x85a0('0x37')](_0x5324f3['query'][_0x85a0('0x37')]));_0x4f20a5[_0x85a0('0x36')]=_0x4f20a5['attributes'][_0x85a0('0x38')]?_0x4f20a5[_0x85a0('0x36')]:_0x5375bb['model'];_0x4f20a5[_0x85a0('0x3b')]=qs['sort'](_0x5324f3[_0x85a0('0x32')][_0x85a0('0x3c')]);_0x4f20a5['where']=qs[_0x85a0('0x34')](_[_0x85a0('0x3d')](_0x5324f3[_0x85a0('0x32')],_0x5375bb['filters']));if(_0x5324f3[_0x85a0('0x32')]['filter']){_0x4f20a5[_0x85a0('0x3e')]=_['merge'](_0x4f20a5['where'],{'$or':_['map'](_0x4f20a5[_0x85a0('0x36')],function(_0x9423e2){var _0x41c581={};_0x41c581[_0x9423e2]={'$like':'%'+_0x5324f3[_0x85a0('0x32')]['filter']+'%'};return _0x41c581;})});}_0x4f20a5=_[_0x85a0('0x3f')]({},_0x4f20a5,_0x5324f3[_0x85a0('0x42')]);return _0x1f87e0['getConfigurations'](_0x4f20a5);}})['then'](function(_0x57e196){if(_0x57e196){_0x233622=_0x57e196[_0x85a0('0x38')];if(!_0x5324f3[_0x85a0('0x32')]['hasOwnProperty'](_0x85a0('0x3a'))){_0x4f20a5['limit']=qs[_0x85a0('0x1d')](_0x5324f3[_0x85a0('0x32')][_0x85a0('0x1d')]);_0x4f20a5['offset']=qs['offset'](_0x5324f3[_0x85a0('0x32')][_0x85a0('0x1b')]);}return _0x1f87e0[_0x85a0('0x4e')](_0x4f20a5);}})[_0x85a0('0x24')](function(_0x2db728){if(_0x2db728){return _0x2db728?{'count':_0x233622,'rows':_0x2db728}:null;}})[_0x85a0('0x24')](respondWithResult(_0x4fc209,null))[_0x85a0('0x48')](handleError(_0x4fc209,null));};exports[_0x85a0('0x50')]=function(_0x42d5f9,_0x7f3826,_0x2bbd3e){if(_0x42d5f9[_0x85a0('0x4b')]['id']){delete _0x42d5f9[_0x85a0('0x4b')]['id'];}return db[_0x85a0('0x43')][_0x85a0('0x4f')]({'where':{'id':_0x42d5f9[_0x85a0('0x4d')]['id']}})[_0x85a0('0x24')](handleEntityNotFound(_0x7f3826,null))[_0x85a0('0x24')](function(_0x954dfe){if(_0x954dfe){_0x42d5f9[_0x85a0('0x4b')]['AccountId']=_0x954dfe['id'];_0x42d5f9[_0x85a0('0x4b')][_0x85a0('0x51')]=integrations[_0x85a0('0x52')](_0x42d5f9['body']['channel'],_0x42d5f9[_0x85a0('0x4b')][_0x85a0('0x2f')]);_0x42d5f9[_0x85a0('0x4b')][_0x85a0('0x53')]=integrations[_0x85a0('0x54')](_0x42d5f9[_0x85a0('0x4b')][_0x85a0('0x55')],_0x42d5f9[_0x85a0('0x4b')]['type']);return db[_0x85a0('0x56')][_0x85a0('0x49')](_0x42d5f9[_0x85a0('0x4b')],{'include':[{'model':db['SalesforceField'],'as':_0x85a0('0x51')},{'model':db['SalesforceField'],'as':_0x85a0('0x53')}]});}return null;})['then'](respondWithResult(_0x7f3826,null))[_0x85a0('0x48')](handleError(_0x7f3826,null));};exports[_0x85a0('0x57')]=function(_0xa563ab,_0x257fc1,_0x2f16b7){var _0x1af4d9;var _0x529516='';var _0x5c621c='Task';return db[_0x85a0('0x43')][_0x85a0('0x4f')]({'where':{'id':_0xa563ab['params']['id']},'attributes':['id',_0x85a0('0x58'),_0x85a0('0x59'),_0x85a0('0x5a'),_0x85a0('0x5b'),_0x85a0('0x5c'),_0x85a0('0x5d')]})[_0x85a0('0x24')](handleEntityNotFound(_0x257fc1,null))['then'](function(_0x517ba2){if(_0x517ba2){_0x529516=_0x517ba2[_0x85a0('0x58')];var _0x56a23b=_0x529516[_0x85a0('0x5e')](-0x1);if(_0x56a23b==='/'){_0x529516=_0x529516[_0x85a0('0x5f')](0x0,_0x529516[_0x85a0('0x60')](_0x56a23b));}_0x1af4d9=new jsforce['Connection']({'oauth2':{'loginUrl':_0x529516,'clientId':_0x517ba2[_0x85a0('0x59')],'clientSecret':_0x517ba2[_0x85a0('0x5a')]}});return _0x1af4d9[_0x85a0('0x61')](_0x517ba2[_0x85a0('0x5b')],_0x517ba2['password'][_0x85a0('0x62')](_0x517ba2['securityToken']));}})[_0x85a0('0x24')](function(_0x2ef989){if(_0x2ef989){if(!_[_0x85a0('0x63')](_0xa563ab['query'][_0x85a0('0x64')])){_0x5c621c=_0xa563ab[_0x85a0('0x32')][_0x85a0('0x64')];}return _0x1af4d9[_0x85a0('0x65')](_0x5c621c)[_0x85a0('0x66')]();}})['then'](function(_0x4aaa2d){var _0x100d39=[_0x85a0('0x67'),_0x85a0('0x68'),_0x85a0('0x69'),'IsRecurrence',_0x85a0('0x6a'),'Description'];var _0x4fa7bd=['string',_0x85a0('0x6b'),_0x85a0('0x6c'),_0x85a0('0x6d'),_0x85a0('0x6e'),_0x85a0('0x6f'),_0x85a0('0x70')];if(_0x4aaa2d){_[_0x85a0('0x71')](_0x4aaa2d['fields'],function(_0x2c389b){return _0x100d39[_0x85a0('0x72')](_0x2c389b[_0x85a0('0x29')])||!_0x4fa7bd['includes'](_0x2c389b[_0x85a0('0x2f')]);});return{'count':_0x4aaa2d[_0x85a0('0x37')][_0x85a0('0x38')],'rows':_[_0x85a0('0x2c')](_0x4aaa2d['fields'],function(_0x3c879e){return{'id':_0x3c879e[_0x85a0('0x29')],'name':_0x3c879e[_0x85a0('0x73')],'custom':_0x3c879e[_0x85a0('0x74')],'options':_0x3c879e[_0x85a0('0x75')][_0x85a0('0x38')]>0x0?_[_0x85a0('0x2c')](_0x3c879e[_0x85a0('0x75')],function(_0x1b3453){return{'name':_0x1b3453['label'],'value':_0x1b3453[_0x85a0('0x76')]};}):_0x3c879e[_0x85a0('0x2f')]==_0x85a0('0x6d')?[{'name':_0x85a0('0x77'),'value':_0x85a0('0x78')},{'name':'False','value':_0x85a0('0x79')}]:[]};})};}})[_0x85a0('0x24')](respondWithResult(_0x257fc1,null))[_0x85a0('0x48')](function(_0x20657e){var _0x2c3473=_0xa563ab['query']['test']?0x1f4:_0x20657e[_0x85a0('0x7a')]||0x1f4;logger[_0x85a0('0x27')]('getFields,\x20%s,\x20%s,\x20%s',_0x85a0('0x57'),_0x2c3473,JSON[_0x85a0('0x7b')](_0x20657e));delete _0x20657e[_0x85a0('0x29')];if(_0x2c3473===0x191){_0x2c3473=0x190;}_0x257fc1['status'](_0x2c3473)['send'](_0xa563ab['query']['test']?{'message':_0x85a0('0x7c'),'statusCode':_0x20657e[_0x85a0('0x7a')]}:_0x20657e);});}; \ No newline at end of file diff --git a/server/api/intSalesforceAccount/intSalesforceAccount.model.js b/server/api/intSalesforceAccount/intSalesforceAccount.model.js index 90a4a5d..f1a74c1 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 _0xb620=['request-promise','path','rimraf','../../config/environment','./intSalesforceAccount.attributes','exports','SalesforceAccount','int_salesforce_accounts','lodash','../../config/logger','api','bluebird'];(function(_0x2bdfe3,_0x1d0469){var _0x3423b2=function(_0x506bd9){while(--_0x506bd9){_0x2bdfe3['push'](_0x2bdfe3['shift']());}};_0x3423b2(++_0x1d0469);}(_0xb620,0x1a0));var _0x0b62=function(_0x336bca,_0x18ab6c){_0x336bca=_0x336bca-0x0;var _0x1a760c=_0xb620[_0x336bca];return _0x1a760c;};'use strict';var _=require(_0x0b62('0x0'));var util=require('util');var logger=require(_0x0b62('0x1'))(_0x0b62('0x2'));var moment=require('moment');var BPromise=require(_0x0b62('0x3'));var rp=require(_0x0b62('0x4'));var fs=require('fs');var path=require(_0x0b62('0x5'));var rimraf=require(_0x0b62('0x6'));var config=require(_0x0b62('0x7'));var attributes=require(_0x0b62('0x8'));var integrations=require('../../components/integrations/configuration');module[_0x0b62('0x9')]=function(_0xee4338,_0x481fef){return _0xee4338['define'](_0x0b62('0xa'),attributes,{'tableName':_0x0b62('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0a9d=['util','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./intSalesforceAccount.attributes','../../components/integrations/configuration','exports','define','SalesforceAccount','int_salesforce_accounts'];(function(_0x33f083,_0x1dcb04){var _0x3dd1a3=function(_0x2f90ae){while(--_0x2f90ae){_0x33f083['push'](_0x33f083['shift']());}};_0x3dd1a3(++_0x1dcb04);}(_0x0a9d,0x12b));var _0xd0a9=function(_0x1ba4e9,_0x12fd38){_0x1ba4e9=_0x1ba4e9-0x0;var _0x1cfef1=_0x0a9d[_0x1ba4e9];return _0x1cfef1;};'use strict';var _=require('lodash');var util=require(_0xd0a9('0x0'));var logger=require(_0xd0a9('0x1'))(_0xd0a9('0x2'));var moment=require(_0xd0a9('0x3'));var BPromise=require(_0xd0a9('0x4'));var rp=require(_0xd0a9('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xd0a9('0x6'));var attributes=require(_0xd0a9('0x7'));var integrations=require(_0xd0a9('0x8'));module[_0xd0a9('0x9')]=function(_0xd3c39b,_0x303a8c){return _0xd3c39b[_0xd0a9('0xa')](_0xd0a9('0xb'),attributes,{'tableName':_0xd0a9('0xc'),'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 b1dedd8..11de7c5 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 _0x2085=['then','info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','GetSalesforceAccount','SalesforceAccount','findAll','options','raw','where','attributes','limit','include','map','model','find','ShowSalesforceAccount','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x2085,0x13f));var _0x5208=function(_0x4f25f9,_0x255051){_0x4f25f9=_0x4f25f9-0x0;var _0x92083c=_0x2085[_0x4f25f9];return _0x92083c;};'use strict';var _=require(_0x5208('0x0'));var util=require(_0x5208('0x1'));var moment=require(_0x5208('0x2'));var BPromise=require(_0x5208('0x3'));var rs=require(_0x5208('0x4'));var fs=require('fs');var Redis=require(_0x5208('0x5'));var db=require(_0x5208('0x6'))['db'];var utils=require(_0x5208('0x7'));var logger=require('../../config/logger')(_0x5208('0x8'));var config=require(_0x5208('0x9'));var jayson=require(_0x5208('0xa'));var client=jayson[_0x5208('0xb')][_0x5208('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2030f4,_0x198cbd,_0x234b0b){return new BPromise(function(_0x31dbb8,_0x54a8ce){return client[_0x5208('0xd')](_0x2030f4,_0x234b0b)[_0x5208('0xe')](function(_0xf2dcaa){logger[_0x5208('0xf')](_0x5208('0x10'),_0x198cbd,_0x5208('0x11'));logger[_0x5208('0x12')](_0x5208('0x13'),_0x198cbd,_0x5208('0x11'),JSON[_0x5208('0x14')](_0xf2dcaa));if(_0xf2dcaa[_0x5208('0x15')]){if(_0xf2dcaa[_0x5208('0x15')]['code']===0x1f4){logger['error'](_0x5208('0x10'),_0x198cbd,_0xf2dcaa[_0x5208('0x15')][_0x5208('0x16')]);return _0x54a8ce(_0xf2dcaa[_0x5208('0x15')][_0x5208('0x16')]);}logger[_0x5208('0x15')]('SalesforceAccount,\x20%s,\x20%s',_0x198cbd,_0xf2dcaa[_0x5208('0x15')][_0x5208('0x16')]);return _0x31dbb8(_0xf2dcaa['error'][_0x5208('0x16')]);}else{logger[_0x5208('0xf')](_0x5208('0x10'),_0x198cbd,_0x5208('0x11'));_0x31dbb8(_0xf2dcaa['result']['message']);}})[_0x5208('0x17')](function(_0x20d29c){logger[_0x5208('0x15')](_0x5208('0x10'),_0x198cbd,_0x20d29c);_0x54a8ce(_0x20d29c);});});}exports[_0x5208('0x18')]=function(_0x3957e5){var _0xf3a34d=this;return new Promise(function(_0x100363,_0x141da2){return db[_0x5208('0x19')][_0x5208('0x1a')]({'raw':_0x3957e5[_0x5208('0x1b')]?_0x3957e5[_0x5208('0x1b')][_0x5208('0x1c')]===undefined?!![]:![]:!![],'where':_0x3957e5['options']?_0x3957e5['options'][_0x5208('0x1d')]||null:null,'attributes':_0x3957e5[_0x5208('0x1b')]?_0x3957e5[_0x5208('0x1b')][_0x5208('0x1e')]||null:null,'limit':_0x3957e5[_0x5208('0x1b')]?_0x3957e5[_0x5208('0x1b')][_0x5208('0x1f')]||null:null,'include':_0x3957e5[_0x5208('0x1b')]?_0x3957e5[_0x5208('0x1b')][_0x5208('0x20')]?_[_0x5208('0x21')](_0x3957e5[_0x5208('0x1b')][_0x5208('0x20')],function(_0x4742ea){return{'model':db[_0x4742ea[_0x5208('0x22')]],'as':_0x4742ea['as'],'attributes':_0x4742ea[_0x5208('0x1e')],'include':_0x4742ea[_0x5208('0x20')]?_[_0x5208('0x21')](_0x4742ea['include'],function(_0x1ac0d3){return{'model':db[_0x1ac0d3['model']],'as':_0x1ac0d3['as'],'attributes':_0x1ac0d3[_0x5208('0x1e')],'include':_0x1ac0d3[_0x5208('0x20')]?_[_0x5208('0x21')](_0x1ac0d3['include'],function(_0x5b1abf){return{'model':db[_0x5b1abf[_0x5208('0x22')]],'as':_0x5b1abf['as'],'attributes':_0x5b1abf[_0x5208('0x1e')]};}):[]};}):[]};}):[]:[]})[_0x5208('0xe')](function(_0x4c3714){logger[_0x5208('0xf')](_0x5208('0x18'),_0x3957e5);logger[_0x5208('0x12')]('GetSalesforceAccount',_0x3957e5,JSON[_0x5208('0x14')](_0x4c3714));_0x100363(_0x4c3714);})['catch'](function(_0x54c4fe){logger[_0x5208('0x15')]('GetSalesforceAccount',_0x54c4fe[_0x5208('0x16')],_0x3957e5);_0x141da2(_0xf3a34d[_0x5208('0x15')](0x1f4,_0x54c4fe['message']));});});};exports['ShowSalesforceAccount']=function(_0x4a0b3f){var _0x513c3c=this;return new Promise(function(_0x341406,_0x5f0d63){return db['SalesforceAccount'][_0x5208('0x23')]({'raw':_0x4a0b3f[_0x5208('0x1b')]?_0x4a0b3f[_0x5208('0x1b')][_0x5208('0x1c')]===undefined?!![]:![]:!![],'where':_0x4a0b3f[_0x5208('0x1b')]?_0x4a0b3f[_0x5208('0x1b')][_0x5208('0x1d')]||null:null,'attributes':_0x4a0b3f['options']?_0x4a0b3f[_0x5208('0x1b')][_0x5208('0x1e')]||null:null,'include':_0x4a0b3f['options']?_0x4a0b3f['options'][_0x5208('0x20')]?_[_0x5208('0x21')](_0x4a0b3f['options']['include'],function(_0x30c782){return{'model':db[_0x30c782[_0x5208('0x22')]],'as':_0x30c782['as'],'attributes':_0x30c782['attributes'],'include':_0x30c782['include']?_[_0x5208('0x21')](_0x30c782[_0x5208('0x20')],function(_0x4e4575){return{'model':db[_0x4e4575[_0x5208('0x22')]],'as':_0x4e4575['as'],'attributes':_0x4e4575[_0x5208('0x1e')],'include':_0x4e4575[_0x5208('0x20')]?_[_0x5208('0x21')](_0x4e4575[_0x5208('0x20')],function(_0x28c7fb){return{'model':db[_0x28c7fb['model']],'as':_0x28c7fb['as'],'attributes':_0x28c7fb[_0x5208('0x1e')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x425757){logger[_0x5208('0xf')](_0x5208('0x24'),_0x4a0b3f);logger[_0x5208('0x12')](_0x5208('0x24'),_0x4a0b3f,JSON[_0x5208('0x14')](_0x425757));_0x341406(_0x425757);})[_0x5208('0x17')](function(_0x25d6ed){logger[_0x5208('0x15')](_0x5208('0x24'),_0x25d6ed[_0x5208('0x16')],_0x4a0b3f);_0x5f0d63(_0x513c3c['error'](0x1f4,_0x25d6ed['message']));});});}; \ No newline at end of file +var _0x6afd=['info','SalesforceAccount,\x20%s,\x20%s','request\x20sent','debug','SalesforceAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSalesforceAccount','SalesforceAccount','options','where','limit','include','map','attributes','model','ShowSalesforceAccount','find','raw','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x543c70,_0x38d863){var _0x551156=function(_0x263018){while(--_0x263018){_0x543c70['push'](_0x543c70['shift']());}};_0x551156(++_0x38d863);}(_0x6afd,0xe3));var _0xd6af=function(_0x2d8fc2,_0x1c461d){_0x2d8fc2=_0x2d8fc2-0x0;var _0x3a9e53=_0x6afd[_0x2d8fc2];return _0x3a9e53;};'use strict';var _=require('lodash');var util=require(_0xd6af('0x0'));var moment=require(_0xd6af('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd6af('0x2'));var db=require(_0xd6af('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd6af('0x4'));var config=require(_0xd6af('0x5'));var jayson=require(_0xd6af('0x6'));var client=jayson[_0xd6af('0x7')][_0xd6af('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2a6ed3,_0x54e8b3,_0x224637){return new BPromise(function(_0xa71030,_0x3e71cf){return client[_0xd6af('0x9')](_0x2a6ed3,_0x224637)[_0xd6af('0xa')](function(_0x14960f){logger[_0xd6af('0xb')](_0xd6af('0xc'),_0x54e8b3,_0xd6af('0xd'));logger[_0xd6af('0xe')](_0xd6af('0xf'),_0x54e8b3,_0xd6af('0xd'),JSON[_0xd6af('0x10')](_0x14960f));if(_0x14960f[_0xd6af('0x11')]){if(_0x14960f[_0xd6af('0x11')][_0xd6af('0x12')]===0x1f4){logger['error'](_0xd6af('0xc'),_0x54e8b3,_0x14960f['error'][_0xd6af('0x13')]);return _0x3e71cf(_0x14960f['error']['message']);}logger[_0xd6af('0x11')](_0xd6af('0xc'),_0x54e8b3,_0x14960f['error'][_0xd6af('0x13')]);return _0xa71030(_0x14960f['error']['message']);}else{logger[_0xd6af('0xb')](_0xd6af('0xc'),_0x54e8b3,_0xd6af('0xd'));_0xa71030(_0x14960f[_0xd6af('0x14')]['message']);}})[_0xd6af('0x15')](function(_0xdc5188){logger['error'](_0xd6af('0xc'),_0x54e8b3,_0xdc5188);_0x3e71cf(_0xdc5188);});});}exports[_0xd6af('0x16')]=function(_0x545b22){var _0x5a7749=this;return new Promise(function(_0x4537ca,_0x541292){return db[_0xd6af('0x17')]['findAll']({'raw':_0x545b22[_0xd6af('0x18')]?_0x545b22[_0xd6af('0x18')]['raw']===undefined?!![]:![]:!![],'where':_0x545b22['options']?_0x545b22[_0xd6af('0x18')][_0xd6af('0x19')]||null:null,'attributes':_0x545b22[_0xd6af('0x18')]?_0x545b22[_0xd6af('0x18')]['attributes']||null:null,'limit':_0x545b22[_0xd6af('0x18')]?_0x545b22[_0xd6af('0x18')][_0xd6af('0x1a')]||null:null,'include':_0x545b22[_0xd6af('0x18')]?_0x545b22[_0xd6af('0x18')][_0xd6af('0x1b')]?_[_0xd6af('0x1c')](_0x545b22[_0xd6af('0x18')][_0xd6af('0x1b')],function(_0x537216){return{'model':db[_0x537216['model']],'as':_0x537216['as'],'attributes':_0x537216['attributes'],'include':_0x537216[_0xd6af('0x1b')]?_[_0xd6af('0x1c')](_0x537216[_0xd6af('0x1b')],function(_0x255584){return{'model':db[_0x255584['model']],'as':_0x255584['as'],'attributes':_0x255584[_0xd6af('0x1d')],'include':_0x255584[_0xd6af('0x1b')]?_['map'](_0x255584[_0xd6af('0x1b')],function(_0x131d62){return{'model':db[_0x131d62[_0xd6af('0x1e')]],'as':_0x131d62['as'],'attributes':_0x131d62[_0xd6af('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xd6af('0xa')](function(_0x55fec1){logger['info']('GetSalesforceAccount',_0x545b22);logger[_0xd6af('0xe')]('GetSalesforceAccount',_0x545b22,JSON[_0xd6af('0x10')](_0x55fec1));_0x4537ca(_0x55fec1);})[_0xd6af('0x15')](function(_0x4568f5){logger[_0xd6af('0x11')](_0xd6af('0x16'),_0x4568f5[_0xd6af('0x13')],_0x545b22);_0x541292(_0x5a7749[_0xd6af('0x11')](0x1f4,_0x4568f5[_0xd6af('0x13')]));});});};exports[_0xd6af('0x1f')]=function(_0x39f0ab){var _0xb7f314=this;return new Promise(function(_0x36889d,_0x504d21){return db[_0xd6af('0x17')][_0xd6af('0x20')]({'raw':_0x39f0ab[_0xd6af('0x18')]?_0x39f0ab[_0xd6af('0x18')][_0xd6af('0x21')]===undefined?!![]:![]:!![],'where':_0x39f0ab['options']?_0x39f0ab[_0xd6af('0x18')]['where']||null:null,'attributes':_0x39f0ab[_0xd6af('0x18')]?_0x39f0ab[_0xd6af('0x18')][_0xd6af('0x1d')]||null:null,'include':_0x39f0ab[_0xd6af('0x18')]?_0x39f0ab[_0xd6af('0x18')][_0xd6af('0x1b')]?_['map'](_0x39f0ab[_0xd6af('0x18')][_0xd6af('0x1b')],function(_0xb4d0db){return{'model':db[_0xb4d0db['model']],'as':_0xb4d0db['as'],'attributes':_0xb4d0db[_0xd6af('0x1d')],'include':_0xb4d0db[_0xd6af('0x1b')]?_[_0xd6af('0x1c')](_0xb4d0db[_0xd6af('0x1b')],function(_0x276b1d){return{'model':db[_0x276b1d[_0xd6af('0x1e')]],'as':_0x276b1d['as'],'attributes':_0x276b1d['attributes'],'include':_0x276b1d['include']?_[_0xd6af('0x1c')](_0x276b1d[_0xd6af('0x1b')],function(_0x27ed0a){return{'model':db[_0x27ed0a['model']],'as':_0x27ed0a['as'],'attributes':_0x27ed0a['attributes']};}):[]};}):[]};}):[]:[]})[_0xd6af('0xa')](function(_0x310a42){logger[_0xd6af('0xb')](_0xd6af('0x1f'),_0x39f0ab);logger[_0xd6af('0xe')]('ShowSalesforceAccount',_0x39f0ab,JSON['stringify'](_0x310a42));_0x36889d(_0x310a42);})[_0xd6af('0x15')](function(_0x15f876){logger[_0xd6af('0x11')]('ShowSalesforceAccount',_0x15f876[_0xd6af('0x13')],_0x39f0ab);_0x504d21(_0xb7f314['error'](0x1f4,_0x15f876[_0xd6af('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/index.js b/server/api/intSalesforceConfiguration/index.js index bf9dfab..dedea2c 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 _0x5f2f=['Router','fs-extra','../../components/auth/service','./intSalesforceConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','put','update','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x3c92c3,_0x24809c){var _0x33c1d4=function(_0x2749fa){while(--_0x2749fa){_0x3c92c3['push'](_0x3c92c3['shift']());}};_0x33c1d4(++_0x24809c);}(_0x5f2f,0x73));var _0xf5f2=function(_0x1f50ae,_0x247e94){_0x1f50ae=_0x1f50ae-0x0;var _0x59b4bb=_0x5f2f[_0x1f50ae];return _0x59b4bb;};'use strict';var multer=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var path=require(_0xf5f2('0x2'));var timeout=require(_0xf5f2('0x3'));var express=require(_0xf5f2('0x4'));var router=express[_0xf5f2('0x5')]();var fs_extra=require(_0xf5f2('0x6'));var auth=require(_0xf5f2('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xf5f2('0x8'));router[_0xf5f2('0x9')]('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0xb')]);router[_0xf5f2('0x9')](_0xf5f2('0xc'),auth['isAuthenticated'](),controller[_0xf5f2('0xd')]);router[_0xf5f2('0x9')](_0xf5f2('0xe'),auth['isAuthenticated'](),controller[_0xf5f2('0xf')]);router[_0xf5f2('0x9')](_0xf5f2('0x10'),auth['isAuthenticated'](),controller[_0xf5f2('0x11')]);router['get']('/:id/descriptions',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x12')]);router['post']('/',auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x13')]);router[_0xf5f2('0x14')](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x15')]);router['delete'](_0xf5f2('0xc'),auth[_0xf5f2('0xa')](),controller[_0xf5f2('0x16')]);module[_0xf5f2('0x17')]=router; \ No newline at end of file +var _0x2ef3=['connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./intSalesforceConfiguration.controller','get','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','put','update','exports','multer','util','path'];(function(_0x2ae6b1,_0x2d020d){var _0x220fa4=function(_0x150005){while(--_0x150005){_0x2ae6b1['push'](_0x2ae6b1['shift']());}};_0x220fa4(++_0x2d020d);}(_0x2ef3,0xba));var _0x32ef=function(_0x42a491,_0x4fe042){_0x42a491=_0x42a491-0x0;var _0x16388d=_0x2ef3[_0x42a491];return _0x16388d;};'use strict';var multer=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var path=require(_0x32ef('0x2'));var timeout=require(_0x32ef('0x3'));var express=require(_0x32ef('0x4'));var router=express[_0x32ef('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x32ef('0x6'));var interaction=require(_0x32ef('0x7'));var config=require('../../config/environment');var controller=require(_0x32ef('0x8'));router[_0x32ef('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x32ef('0x9')](_0x32ef('0xa'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xc')]);router[_0x32ef('0x9')](_0x32ef('0xd'),auth[_0x32ef('0xb')](),controller[_0x32ef('0xe')]);router[_0x32ef('0x9')](_0x32ef('0xf'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x32ef('0x9')](_0x32ef('0x10'),auth[_0x32ef('0xb')](),controller[_0x32ef('0x11')]);router['post']('/',auth[_0x32ef('0xb')](),controller['create']);router[_0x32ef('0x12')]('/:id',auth[_0x32ef('0xb')](),controller[_0x32ef('0x13')]);router['delete']('/:id',auth[_0x32ef('0xb')](),controller['destroy']);module[_0x32ef('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.attributes.js index 00cb407..bc58133 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 _0x8cb8=['ENUM','Task','Case','contact_lead','contact','lead','account','sequelize','exports','STRING'];(function(_0x2eb5d7,_0x406c2c){var _0xca8fd6=function(_0x2d73ec){while(--_0x2d73ec){_0x2eb5d7['push'](_0x2eb5d7['shift']());}};_0xca8fd6(++_0x406c2c);}(_0x8cb8,0x147));var _0x88cb=function(_0xd511d,_0x3546b9){_0xd511d=_0xd511d-0x0;var _0x3f148e=_0x8cb8[_0xd511d];return _0x3f148e;};'use strict';var Sequelize=require(_0x88cb('0x0'));module[_0x88cb('0x1')]={'name':{'type':Sequelize[_0x88cb('0x2')]},'description':{'type':Sequelize['STRING']},'ticketType':{'type':Sequelize[_0x88cb('0x3')](_0x88cb('0x4'),_0x88cb('0x5')),'defaultValue':_0x88cb('0x4')},'moduleSearch':{'type':Sequelize[_0x88cb('0x3')](_0x88cb('0x6'),_0x88cb('0x7'),_0x88cb('0x8'),'account_contact_lead',_0x88cb('0x9')),'defaultValue':_0x88cb('0x6')},'moduleCreate':{'type':Sequelize[_0x88cb('0x3')]('nothing',_0x88cb('0x7'),'lead',_0x88cb('0x9')),'defaultValue':_0x88cb('0x8')},'leadId':{'type':Sequelize[_0x88cb('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0x88cb('0x2')]},'additionalSearchContact':{'type':Sequelize[_0x88cb('0x2')]},'additionalSearchLead':{'type':Sequelize[_0x88cb('0x2')]}}; \ No newline at end of file +var _0xca3a=['exports','STRING','ENUM','Task','contact_lead','contact','lead','account_contact_lead','nothing','account','sequelize'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0xca3a,0x78));var _0xaca3=function(_0x4ef51f,_0x1c42a7){_0x4ef51f=_0x4ef51f-0x0;var _0x1ae7c8=_0xca3a[_0x4ef51f];return _0x1ae7c8;};'use strict';var Sequelize=require(_0xaca3('0x0'));module[_0xaca3('0x1')]={'name':{'type':Sequelize[_0xaca3('0x2')]},'description':{'type':Sequelize[_0xaca3('0x2')]},'ticketType':{'type':Sequelize[_0xaca3('0x3')](_0xaca3('0x4'),'Case'),'defaultValue':_0xaca3('0x4')},'moduleSearch':{'type':Sequelize[_0xaca3('0x3')](_0xaca3('0x5'),_0xaca3('0x6'),_0xaca3('0x7'),_0xaca3('0x8'),'account'),'defaultValue':_0xaca3('0x5')},'moduleCreate':{'type':Sequelize[_0xaca3('0x3')](_0xaca3('0x9'),'contact',_0xaca3('0x7'),_0xaca3('0xa')),'defaultValue':'lead'},'leadId':{'type':Sequelize[_0xaca3('0x2')]},'additionalSearchAccount':{'type':Sequelize[_0xaca3('0x2')]},'additionalSearchContact':{'type':Sequelize[_0xaca3('0x2')]},'additionalSearchLead':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.controller.js index 9a0615b..f4590d0 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 _0x6dac=['catch','show','intersection','find','create','body','params','getFields','SalesforceField','order','pick','getSubjects','findOne','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','send','index','rawAttributes','fieldName','type','key','map','name','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','where','VIRTUAL','merge','options','SalesforceConfiguration','includeAll','include','findAll'];(function(_0x8fe368,_0x424407){var _0x3f3c8a=function(_0x5b6237){while(--_0x5b6237){_0x8fe368['push'](_0x8fe368['shift']());}};_0x3f3c8a(++_0x424407);}(_0x6dac,0x16e));var _0xc6da=function(_0x4b090f,_0x17df3b){_0x4b090f=_0x4b090f-0x0;var _0x16f828=_0x6dac[_0x4b090f];return _0x16f828;};'use strict';var emlformat=require(_0xc6da('0x0'));var rimraf=require(_0xc6da('0x1'));var zipdir=require(_0xc6da('0x2'));var jsonpatch=require(_0xc6da('0x3'));var rp=require(_0xc6da('0x4'));var moment=require(_0xc6da('0x5'));var BPromise=require(_0xc6da('0x6'));var Mustache=require(_0xc6da('0x7'));var util=require(_0xc6da('0x8'));var path=require(_0xc6da('0x9'));var sox=require(_0xc6da('0xa'));var csv=require(_0xc6da('0xb'));var ejs=require(_0xc6da('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc6da('0xd'));var squel=require(_0xc6da('0xe'));var crypto=require(_0xc6da('0xf'));var jsforce=require(_0xc6da('0x10'));var deskjs=require(_0xc6da('0x11'));var toCsv=require(_0xc6da('0xb'));var querystring=require(_0xc6da('0x12'));var Papa=require(_0xc6da('0x13'));var Redis=require(_0xc6da('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xc6da('0x15'));var as=require(_0xc6da('0x16'));var hardwareService=require(_0xc6da('0x17'));var logger=require(_0xc6da('0x18'))(_0xc6da('0x19'));var utils=require(_0xc6da('0x1a'));var config=require(_0xc6da('0x1b'));var licenseUtil=require(_0xc6da('0x1c'));var db=require(_0xc6da('0x1d'))['db'];function respondWithStatusCode(_0x22d0e3,_0x3b8656){_0x3b8656=_0x3b8656||0xcc;return function(_0x3a3b39){if(_0x3a3b39){return _0x22d0e3[_0xc6da('0x1e')](_0x3b8656);}return _0x22d0e3['status'](_0x3b8656)[_0xc6da('0x1f')]();};}function respondWithResult(_0x18e521,_0x13d9df){_0x13d9df=_0x13d9df||0xc8;return function(_0x344b09){if(_0x344b09){return _0x18e521[_0xc6da('0x20')](_0x13d9df)[_0xc6da('0x21')](_0x344b09);}};}function respondWithFilteredResult(_0x4fa18b,_0x43e6b3){return function(_0x37767a){if(_0x37767a){var _0x287468=typeof _0x43e6b3[_0xc6da('0x22')]===_0xc6da('0x23')&&typeof _0x43e6b3['limit']===_0xc6da('0x23');var _0x4cf6c4=_0x37767a[_0xc6da('0x24')];var _0x2a63cc=_0x287468?0x0:_0x43e6b3[_0xc6da('0x22')];var _0x25737d=_0x287468?_0x37767a['count']:_0x43e6b3[_0xc6da('0x22')]+_0x43e6b3[_0xc6da('0x25')];var _0x40c346;if(_0x25737d>=_0x4cf6c4){_0x25737d=_0x4cf6c4;_0x40c346=0xc8;}else{_0x40c346=0xce;}_0x4fa18b[_0xc6da('0x20')](_0x40c346);return _0x4fa18b[_0xc6da('0x26')](_0xc6da('0x27'),_0x2a63cc+'-'+_0x25737d+'/'+_0x4cf6c4)[_0xc6da('0x21')](_0x37767a);}return null;};}function patchUpdates(_0x36ac99){return function(_0xe00c70){try{jsonpatch[_0xc6da('0x28')](_0xe00c70,_0x36ac99,!![]);}catch(_0x4deb23){return BPromise[_0xc6da('0x29')](_0x4deb23);}return _0xe00c70[_0xc6da('0x2a')]();};}function saveUpdates(_0x3c7483,_0x94bee1){return function(_0x5f070b){if(_0x5f070b){return _0x5f070b[_0xc6da('0x2b')](_0x3c7483)[_0xc6da('0x2c')](function(_0x5ddab9){return _0x5ddab9;});}return null;};}function removeEntity(_0x2a2ef9,_0x3b180c){return function(_0x1003a3){if(_0x1003a3){return _0x1003a3[_0xc6da('0x2d')]()['then'](function(){_0x2a2ef9[_0xc6da('0x20')](0xcc)[_0xc6da('0x1f')]();});}};}function handleEntityNotFound(_0x55c059,_0x67ebf9){return function(_0x89b637){if(!_0x89b637){_0x55c059[_0xc6da('0x1e')](0x194);}return _0x89b637;};}function handleError(_0x57c198,_0x4d232d){_0x4d232d=_0x4d232d||0x1f4;return function(_0x1ded21){logger[_0xc6da('0x2e')](_0x1ded21['stack']);if(_0x1ded21['name']){delete _0x1ded21['name'];}_0x57c198['status'](_0x4d232d)[_0xc6da('0x2f')](_0x1ded21);};}exports[_0xc6da('0x30')]=function(_0x33eba0,_0x579dab){var _0x32b83={},_0xda1aef={},_0x13cb9e={'count':0x0,'rows':[]};var _0x890254=_['map'](db['SalesforceConfiguration'][_0xc6da('0x31')],function(_0x572204){return{'name':_0x572204[_0xc6da('0x32')],'type':_0x572204[_0xc6da('0x33')][_0xc6da('0x34')]};});_0xda1aef['model']=_[_0xc6da('0x35')](_0x890254,_0xc6da('0x36'));_0xda1aef[_0xc6da('0x37')]=_[_0xc6da('0x38')](_0x33eba0[_0xc6da('0x37')]);_0xda1aef[_0xc6da('0x39')]=_['intersection'](_0xda1aef[_0xc6da('0x3a')],_0xda1aef[_0xc6da('0x37')]);_0x32b83[_0xc6da('0x3b')]=_['intersection'](_0xda1aef['model'],qs[_0xc6da('0x3c')](_0x33eba0[_0xc6da('0x37')][_0xc6da('0x3c')]));_0x32b83[_0xc6da('0x3b')]=_0x32b83[_0xc6da('0x3b')][_0xc6da('0x3d')]?_0x32b83[_0xc6da('0x3b')]:_0xda1aef[_0xc6da('0x3a')];if(!_0x33eba0[_0xc6da('0x37')][_0xc6da('0x3e')](_0xc6da('0x3f'))){_0x32b83[_0xc6da('0x25')]=qs[_0xc6da('0x25')](_0x33eba0['query'][_0xc6da('0x25')]);_0x32b83['offset']=qs[_0xc6da('0x22')](_0x33eba0[_0xc6da('0x37')][_0xc6da('0x22')]);}_0x32b83['order']=qs[_0xc6da('0x40')](_0x33eba0[_0xc6da('0x37')][_0xc6da('0x40')]);_0x32b83['where']=qs[_0xc6da('0x39')](_['pick'](_0x33eba0[_0xc6da('0x37')],_0xda1aef['filters']),_0x890254);if(_0x33eba0[_0xc6da('0x37')][_0xc6da('0x41')]){_0x32b83[_0xc6da('0x42')]=_['merge'](_0x32b83['where'],{'$or':_[_0xc6da('0x35')](_0x890254,function(_0x56b071){if(_0x56b071['type']!==_0xc6da('0x43')){var _0x16b440={};_0x16b440[_0x56b071[_0xc6da('0x36')]]={'$like':'%'+_0x33eba0[_0xc6da('0x37')][_0xc6da('0x41')]+'%'};return _0x16b440;}})});}_0x32b83=_[_0xc6da('0x44')]({},_0x32b83,_0x33eba0[_0xc6da('0x45')]);var _0x3368c9={'where':_0x32b83['where']};return db[_0xc6da('0x46')][_0xc6da('0x24')](_0x3368c9)[_0xc6da('0x2c')](function(_0x4fd663){_0x13cb9e[_0xc6da('0x24')]=_0x4fd663;if(_0x33eba0[_0xc6da('0x37')][_0xc6da('0x47')]){_0x32b83[_0xc6da('0x48')]=[{'all':!![]}];}return db[_0xc6da('0x46')][_0xc6da('0x49')](_0x32b83);})[_0xc6da('0x2c')](function(_0xb5e11e){_0x13cb9e['rows']=_0xb5e11e;return _0x13cb9e;})[_0xc6da('0x2c')](respondWithFilteredResult(_0x579dab,_0x32b83))[_0xc6da('0x4a')](handleError(_0x579dab,null));};exports[_0xc6da('0x4b')]=function(_0x34e19a,_0x4f3374){var _0x4e00fc={'raw':![],'where':{'id':_0x34e19a['params']['id']}},_0xd20888={};_0xd20888['model']=_[_0xc6da('0x38')](db[_0xc6da('0x46')][_0xc6da('0x31')]);_0xd20888[_0xc6da('0x37')]=_[_0xc6da('0x38')](_0x34e19a[_0xc6da('0x37')]);_0xd20888['filters']=_[_0xc6da('0x4c')](_0xd20888['model'],_0xd20888[_0xc6da('0x37')]);_0x4e00fc['attributes']=_[_0xc6da('0x4c')](_0xd20888[_0xc6da('0x3a')],qs[_0xc6da('0x3c')](_0x34e19a[_0xc6da('0x37')][_0xc6da('0x3c')]));_0x4e00fc[_0xc6da('0x3b')]=_0x4e00fc[_0xc6da('0x3b')][_0xc6da('0x3d')]?_0x4e00fc['attributes']:_0xd20888[_0xc6da('0x3a')];if(_0x34e19a[_0xc6da('0x37')]['includeAll']){_0x4e00fc[_0xc6da('0x48')]=[{'all':!![]}];}_0x4e00fc=_['merge']({},_0x4e00fc,_0x34e19a[_0xc6da('0x45')]);return db[_0xc6da('0x46')][_0xc6da('0x4d')](_0x4e00fc)[_0xc6da('0x2c')](handleEntityNotFound(_0x4f3374,null))['then'](respondWithResult(_0x4f3374,null))['catch'](handleError(_0x4f3374,null));};exports[_0xc6da('0x4e')]=function(_0x3b2f06,_0x4fd983){return db[_0xc6da('0x46')][_0xc6da('0x4e')](_0x3b2f06[_0xc6da('0x4f')],{})[_0xc6da('0x2c')](respondWithResult(_0x4fd983,0xc9))['catch'](handleError(_0x4fd983,null));};exports['update']=function(_0x3d7016,_0x1cd932){if(_0x3d7016[_0xc6da('0x4f')]['id']){delete _0x3d7016[_0xc6da('0x4f')]['id'];}return db['SalesforceConfiguration'][_0xc6da('0x4d')]({'where':{'id':_0x3d7016['params']['id']}})[_0xc6da('0x2c')](handleEntityNotFound(_0x1cd932,null))[_0xc6da('0x2c')](saveUpdates(_0x3d7016[_0xc6da('0x4f')],null))[_0xc6da('0x2c')](respondWithResult(_0x1cd932,null))['catch'](handleError(_0x1cd932,null));};exports[_0xc6da('0x2d')]=function(_0x12f27b,_0x225d74){return db[_0xc6da('0x46')][_0xc6da('0x4d')]({'where':{'id':_0x12f27b[_0xc6da('0x50')]['id']}})[_0xc6da('0x2c')](handleEntityNotFound(_0x225d74,null))[_0xc6da('0x2c')](removeEntity(_0x225d74,null))[_0xc6da('0x4a')](handleError(_0x225d74,null));};exports[_0xc6da('0x51')]=function(_0x579a46,_0x5d2213,_0x5e350c){var _0x2b3c9a={};var _0x59ecd8={};var _0x2f1863;var _0x2977c4;return db[_0xc6da('0x46')]['findOne']({'where':{'id':_0x579a46[_0xc6da('0x50')]['id']}})[_0xc6da('0x2c')](handleEntityNotFound(_0x5d2213,null))['then'](function(_0x6a74b0){if(_0x6a74b0){_0x2f1863=_0x6a74b0;_0x59ecd8[_0xc6da('0x3a')]=_[_0xc6da('0x38')](db[_0xc6da('0x52')][_0xc6da('0x31')]);_0x59ecd8[_0xc6da('0x37')]=_[_0xc6da('0x38')](_0x579a46[_0xc6da('0x37')]);_0x59ecd8[_0xc6da('0x39')]=_[_0xc6da('0x4c')](_0x59ecd8[_0xc6da('0x3a')],_0x59ecd8[_0xc6da('0x37')]);_0x2b3c9a[_0xc6da('0x3b')]=_[_0xc6da('0x4c')](_0x59ecd8[_0xc6da('0x3a')],qs[_0xc6da('0x3c')](_0x579a46['query'][_0xc6da('0x3c')]));_0x2b3c9a['attributes']=_0x2b3c9a[_0xc6da('0x3b')][_0xc6da('0x3d')]?_0x2b3c9a[_0xc6da('0x3b')]:_0x59ecd8[_0xc6da('0x3a')];_0x2b3c9a[_0xc6da('0x53')]=qs[_0xc6da('0x40')](_0x579a46['query']['sort']);_0x2b3c9a['where']=qs[_0xc6da('0x39')](_[_0xc6da('0x54')](_0x579a46['query'],_0x59ecd8['filters']));if(_0x579a46[_0xc6da('0x37')][_0xc6da('0x41')]){_0x2b3c9a[_0xc6da('0x42')]=_[_0xc6da('0x44')](_0x2b3c9a[_0xc6da('0x42')],{'$or':_[_0xc6da('0x35')](_0x2b3c9a[_0xc6da('0x3b')],function(_0x29e541){var _0x5f4f13={};_0x5f4f13[_0x29e541]={'$like':'%'+_0x579a46['query']['filter']+'%'};return _0x5f4f13;})});}_0x2b3c9a=_[_0xc6da('0x44')]({},_0x2b3c9a,_0x579a46[_0xc6da('0x45')]);return _0x2f1863[_0xc6da('0x51')](_0x2b3c9a);}})[_0xc6da('0x2c')](function(_0x4b0699){if(_0x4b0699){_0x2977c4=_0x4b0699[_0xc6da('0x3d')];if(!_0x579a46[_0xc6da('0x37')][_0xc6da('0x3e')](_0xc6da('0x3f'))){_0x2b3c9a['limit']=qs[_0xc6da('0x25')](_0x579a46[_0xc6da('0x37')][_0xc6da('0x25')]);_0x2b3c9a[_0xc6da('0x22')]=qs[_0xc6da('0x22')](_0x579a46[_0xc6da('0x37')][_0xc6da('0x22')]);}return _0x2f1863['getFields'](_0x2b3c9a);}})[_0xc6da('0x2c')](function(_0x295ceb){if(_0x295ceb){return _0x295ceb?{'count':_0x2977c4,'rows':_0x295ceb}:null;}})[_0xc6da('0x2c')](respondWithResult(_0x5d2213,null))['catch'](handleError(_0x5d2213,null));};exports[_0xc6da('0x55')]=function(_0x54dd05,_0x2224ad,_0x1fece3){var _0xa4599f={};var _0x4732ea={};var _0x5dabd0;var _0x54d389;return db['SalesforceConfiguration'][_0xc6da('0x56')]({'where':{'id':_0x54dd05[_0xc6da('0x50')]['id']}})[_0xc6da('0x2c')](handleEntityNotFound(_0x2224ad,null))[_0xc6da('0x2c')](function(_0xc71538){if(_0xc71538){_0x5dabd0=_0xc71538;_0x4732ea[_0xc6da('0x3a')]=_['keys'](db[_0xc6da('0x52')]['rawAttributes']);_0x4732ea[_0xc6da('0x37')]=_['keys'](_0x54dd05[_0xc6da('0x37')]);_0x4732ea[_0xc6da('0x39')]=_[_0xc6da('0x4c')](_0x4732ea[_0xc6da('0x3a')],_0x4732ea[_0xc6da('0x37')]);_0xa4599f[_0xc6da('0x3b')]=_[_0xc6da('0x4c')](_0x4732ea[_0xc6da('0x3a')],qs[_0xc6da('0x3c')](_0x54dd05[_0xc6da('0x37')][_0xc6da('0x3c')]));_0xa4599f[_0xc6da('0x3b')]=_0xa4599f['attributes'][_0xc6da('0x3d')]?_0xa4599f[_0xc6da('0x3b')]:_0x4732ea[_0xc6da('0x3a')];_0xa4599f['order']=qs[_0xc6da('0x40')](_0x54dd05[_0xc6da('0x37')][_0xc6da('0x40')]);_0xa4599f['where']=qs[_0xc6da('0x39')](_[_0xc6da('0x54')](_0x54dd05['query'],_0x4732ea[_0xc6da('0x39')]));if(_0x54dd05['query'][_0xc6da('0x41')]){_0xa4599f['where']=_[_0xc6da('0x44')](_0xa4599f[_0xc6da('0x42')],{'$or':_[_0xc6da('0x35')](_0xa4599f['attributes'],function(_0x34cd30){var _0x2d684f={};_0x2d684f[_0x34cd30]={'$like':'%'+_0x54dd05[_0xc6da('0x37')][_0xc6da('0x41')]+'%'};return _0x2d684f;})});}_0xa4599f=_[_0xc6da('0x44')]({},_0xa4599f,_0x54dd05['options']);return _0x5dabd0['getSubjects'](_0xa4599f);}})['then'](function(_0x4eb439){if(_0x4eb439){_0x54d389=_0x4eb439[_0xc6da('0x3d')];if(!_0x54dd05[_0xc6da('0x37')][_0xc6da('0x3e')]('nolimit')){_0xa4599f[_0xc6da('0x25')]=qs[_0xc6da('0x25')](_0x54dd05[_0xc6da('0x37')][_0xc6da('0x25')]);_0xa4599f['offset']=qs[_0xc6da('0x22')](_0x54dd05['query'][_0xc6da('0x22')]);}return _0x5dabd0[_0xc6da('0x55')](_0xa4599f);}})[_0xc6da('0x2c')](function(_0x55f274){if(_0x55f274){return _0x55f274?{'count':_0x54d389,'rows':_0x55f274}:null;}})[_0xc6da('0x2c')](respondWithResult(_0x2224ad,null))['catch'](handleError(_0x2224ad,null));};exports['getDescriptions']=function(_0x3f679b,_0x1bf4e2,_0x5c8c94){var _0x70f6e4={};var _0x547d5c={};var _0x3d5c61;var _0x3a178e;return db['SalesforceConfiguration'][_0xc6da('0x56')]({'where':{'id':_0x3f679b[_0xc6da('0x50')]['id']}})[_0xc6da('0x2c')](handleEntityNotFound(_0x1bf4e2,null))[_0xc6da('0x2c')](function(_0x1ab014){if(_0x1ab014){_0x3d5c61=_0x1ab014;_0x547d5c['model']=_[_0xc6da('0x38')](db[_0xc6da('0x52')][_0xc6da('0x31')]);_0x547d5c[_0xc6da('0x37')]=_[_0xc6da('0x38')](_0x3f679b['query']);_0x547d5c[_0xc6da('0x39')]=_[_0xc6da('0x4c')](_0x547d5c[_0xc6da('0x3a')],_0x547d5c[_0xc6da('0x37')]);_0x70f6e4['attributes']=_[_0xc6da('0x4c')](_0x547d5c[_0xc6da('0x3a')],qs[_0xc6da('0x3c')](_0x3f679b[_0xc6da('0x37')][_0xc6da('0x3c')]));_0x70f6e4[_0xc6da('0x3b')]=_0x70f6e4[_0xc6da('0x3b')][_0xc6da('0x3d')]?_0x70f6e4['attributes']:_0x547d5c[_0xc6da('0x3a')];_0x70f6e4[_0xc6da('0x53')]=qs['sort'](_0x3f679b[_0xc6da('0x37')]['sort']);_0x70f6e4[_0xc6da('0x42')]=qs[_0xc6da('0x39')](_[_0xc6da('0x54')](_0x3f679b[_0xc6da('0x37')],_0x547d5c['filters']));if(_0x3f679b[_0xc6da('0x37')][_0xc6da('0x41')]){_0x70f6e4['where']=_[_0xc6da('0x44')](_0x70f6e4['where'],{'$or':_[_0xc6da('0x35')](_0x70f6e4['attributes'],function(_0x13a276){var _0x1b2fe9={};_0x1b2fe9[_0x13a276]={'$like':'%'+_0x3f679b[_0xc6da('0x37')]['filter']+'%'};return _0x1b2fe9;})});}_0x70f6e4=_['merge']({},_0x70f6e4,_0x3f679b['options']);return _0x3d5c61[_0xc6da('0x57')](_0x70f6e4);}})[_0xc6da('0x2c')](function(_0x2b207f){if(_0x2b207f){_0x3a178e=_0x2b207f[_0xc6da('0x3d')];if(!_0x3f679b[_0xc6da('0x37')]['hasOwnProperty']('nolimit')){_0x70f6e4[_0xc6da('0x25')]=qs[_0xc6da('0x25')](_0x3f679b[_0xc6da('0x37')][_0xc6da('0x25')]);_0x70f6e4['offset']=qs['offset'](_0x3f679b[_0xc6da('0x37')][_0xc6da('0x22')]);}return _0x3d5c61[_0xc6da('0x57')](_0x70f6e4);}})[_0xc6da('0x2c')](function(_0x575154){if(_0x575154){return _0x575154?{'count':_0x3a178e,'rows':_0x575154}:null;}})[_0xc6da('0x2c')](respondWithResult(_0x1bf4e2,null))[_0xc6da('0x4a')](handleError(_0x1bf4e2,null));}; \ No newline at end of file +var _0x4874=['limit','set','apply','reject','save','update','then','sendStatus','error','name','send','index','map','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','SalesforceConfiguration','includeAll','include','rows','show','find','catch','create','body','params','destroy','getFields','findOne','SalesforceField','getSubjects','getDescriptions','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','sox','ejs','fs-extra','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','../../mysqldb','status','end','json','offset','undefined','count'];(function(_0x3503b5,_0x14e48a){var _0x3c2499=function(_0x5cfe1d){while(--_0x5cfe1d){_0x3503b5['push'](_0x3503b5['shift']());}};_0x3c2499(++_0x14e48a);}(_0x4874,0x17b));var _0x4487=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x4874[_0x2d34d6];return _0x1d3d12;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4487('0x0'));var zipdir=require(_0x4487('0x1'));var jsonpatch=require(_0x4487('0x2'));var rp=require(_0x4487('0x3'));var moment=require(_0x4487('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x4487('0x5'));var util=require(_0x4487('0x6'));var path=require('path');var sox=require(_0x4487('0x7'));var csv=require('to-csv');var ejs=require(_0x4487('0x8'));var fs=require('fs');var fs_extra=require(_0x4487('0x9'));var _=require('lodash');var squel=require(_0x4487('0xa'));var crypto=require('crypto');var jsforce=require(_0x4487('0xb'));var deskjs=require(_0x4487('0xc'));var toCsv=require(_0x4487('0xd'));var querystring=require(_0x4487('0xe'));var Papa=require(_0x4487('0xf'));var Redis=require(_0x4487('0x10'));var authService=require(_0x4487('0x11'));var qs=require(_0x4487('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4487('0x13'));var logger=require(_0x4487('0x14'))(_0x4487('0x15'));var utils=require('../../config/utils');var config=require(_0x4487('0x16'));var licenseUtil=require(_0x4487('0x17'));var db=require(_0x4487('0x18'))['db'];function respondWithStatusCode(_0x11a4e2,_0x4560fc){_0x4560fc=_0x4560fc||0xcc;return function(_0x217c58){if(_0x217c58){return _0x11a4e2['sendStatus'](_0x4560fc);}return _0x11a4e2[_0x4487('0x19')](_0x4560fc)[_0x4487('0x1a')]();};}function respondWithResult(_0x24b61b,_0x33dcea){_0x33dcea=_0x33dcea||0xc8;return function(_0x2a5245){if(_0x2a5245){return _0x24b61b[_0x4487('0x19')](_0x33dcea)[_0x4487('0x1b')](_0x2a5245);}};}function respondWithFilteredResult(_0x12aa0b,_0x4adac4){return function(_0x69e30f){if(_0x69e30f){var _0x1fbfd3=typeof _0x4adac4[_0x4487('0x1c')]===_0x4487('0x1d')&&typeof _0x4adac4['limit']===_0x4487('0x1d');var _0x4081e2=_0x69e30f[_0x4487('0x1e')];var _0x309c2f=_0x1fbfd3?0x0:_0x4adac4[_0x4487('0x1c')];var _0x372b9f=_0x1fbfd3?_0x69e30f['count']:_0x4adac4[_0x4487('0x1c')]+_0x4adac4[_0x4487('0x1f')];var _0x247911;if(_0x372b9f>=_0x4081e2){_0x372b9f=_0x4081e2;_0x247911=0xc8;}else{_0x247911=0xce;}_0x12aa0b[_0x4487('0x19')](_0x247911);return _0x12aa0b[_0x4487('0x20')]('Content-Range',_0x309c2f+'-'+_0x372b9f+'/'+_0x4081e2)[_0x4487('0x1b')](_0x69e30f);}return null;};}function patchUpdates(_0x19fbd7){return function(_0x4e8f47){try{jsonpatch[_0x4487('0x21')](_0x4e8f47,_0x19fbd7,!![]);}catch(_0x428212){return BPromise[_0x4487('0x22')](_0x428212);}return _0x4e8f47[_0x4487('0x23')]();};}function saveUpdates(_0x4dadac,_0x80c820){return function(_0x417a86){if(_0x417a86){return _0x417a86[_0x4487('0x24')](_0x4dadac)[_0x4487('0x25')](function(_0x9dc61b){return _0x9dc61b;});}return null;};}function removeEntity(_0x249608,_0x3b6956){return function(_0x170781){if(_0x170781){return _0x170781['destroy']()[_0x4487('0x25')](function(){_0x249608['status'](0xcc)[_0x4487('0x1a')]();});}};}function handleEntityNotFound(_0x130afc,_0x8efd89){return function(_0x344bec){if(!_0x344bec){_0x130afc[_0x4487('0x26')](0x194);}return _0x344bec;};}function handleError(_0x1c9d3a,_0x45f0b2){_0x45f0b2=_0x45f0b2||0x1f4;return function(_0x36c500){logger[_0x4487('0x27')](_0x36c500['stack']);if(_0x36c500[_0x4487('0x28')]){delete _0x36c500[_0x4487('0x28')];}_0x1c9d3a[_0x4487('0x19')](_0x45f0b2)[_0x4487('0x29')](_0x36c500);};}exports[_0x4487('0x2a')]=function(_0x3b2ba6,_0x5f37c7){var _0x33aeb9={},_0x5b34bc={},_0x188c80={'count':0x0,'rows':[]};var _0x25eab0=_[_0x4487('0x2b')](db['SalesforceConfiguration'][_0x4487('0x2c')],function(_0x4e9c5a){return{'name':_0x4e9c5a[_0x4487('0x2d')],'type':_0x4e9c5a[_0x4487('0x2e')][_0x4487('0x2f')]};});_0x5b34bc[_0x4487('0x30')]=_[_0x4487('0x2b')](_0x25eab0,_0x4487('0x28'));_0x5b34bc[_0x4487('0x31')]=_[_0x4487('0x32')](_0x3b2ba6[_0x4487('0x31')]);_0x5b34bc[_0x4487('0x33')]=_[_0x4487('0x34')](_0x5b34bc['model'],_0x5b34bc['query']);_0x33aeb9['attributes']=_[_0x4487('0x34')](_0x5b34bc[_0x4487('0x30')],qs[_0x4487('0x35')](_0x3b2ba6[_0x4487('0x31')][_0x4487('0x35')]));_0x33aeb9[_0x4487('0x36')]=_0x33aeb9[_0x4487('0x36')][_0x4487('0x37')]?_0x33aeb9[_0x4487('0x36')]:_0x5b34bc['model'];if(!_0x3b2ba6[_0x4487('0x31')][_0x4487('0x38')](_0x4487('0x39'))){_0x33aeb9[_0x4487('0x1f')]=qs[_0x4487('0x1f')](_0x3b2ba6[_0x4487('0x31')][_0x4487('0x1f')]);_0x33aeb9['offset']=qs[_0x4487('0x1c')](_0x3b2ba6[_0x4487('0x31')][_0x4487('0x1c')]);}_0x33aeb9[_0x4487('0x3a')]=qs['sort'](_0x3b2ba6['query'][_0x4487('0x3b')]);_0x33aeb9['where']=qs[_0x4487('0x33')](_[_0x4487('0x3c')](_0x3b2ba6[_0x4487('0x31')],_0x5b34bc[_0x4487('0x33')]),_0x25eab0);if(_0x3b2ba6[_0x4487('0x31')][_0x4487('0x3d')]){_0x33aeb9['where']=_[_0x4487('0x3e')](_0x33aeb9[_0x4487('0x3f')],{'$or':_[_0x4487('0x2b')](_0x25eab0,function(_0x5bb695){if(_0x5bb695['type']!==_0x4487('0x40')){var _0x42eaa5={};_0x42eaa5[_0x5bb695['name']]={'$like':'%'+_0x3b2ba6['query'][_0x4487('0x3d')]+'%'};return _0x42eaa5;}})});}_0x33aeb9=_[_0x4487('0x3e')]({},_0x33aeb9,_0x3b2ba6[_0x4487('0x41')]);var _0x5ac6eb={'where':_0x33aeb9['where']};return db[_0x4487('0x42')][_0x4487('0x1e')](_0x5ac6eb)[_0x4487('0x25')](function(_0x59ecf2){_0x188c80[_0x4487('0x1e')]=_0x59ecf2;if(_0x3b2ba6[_0x4487('0x31')][_0x4487('0x43')]){_0x33aeb9[_0x4487('0x44')]=[{'all':!![]}];}return db[_0x4487('0x42')]['findAll'](_0x33aeb9);})['then'](function(_0x754771){_0x188c80[_0x4487('0x45')]=_0x754771;return _0x188c80;})[_0x4487('0x25')](respondWithFilteredResult(_0x5f37c7,_0x33aeb9))['catch'](handleError(_0x5f37c7,null));};exports[_0x4487('0x46')]=function(_0x3eac7f,_0x791b97){var _0x3ff116={'raw':![],'where':{'id':_0x3eac7f['params']['id']}},_0x3db01e={};_0x3db01e[_0x4487('0x30')]=_['keys'](db[_0x4487('0x42')]['rawAttributes']);_0x3db01e['query']=_[_0x4487('0x32')](_0x3eac7f['query']);_0x3db01e[_0x4487('0x33')]=_[_0x4487('0x34')](_0x3db01e[_0x4487('0x30')],_0x3db01e[_0x4487('0x31')]);_0x3ff116[_0x4487('0x36')]=_[_0x4487('0x34')](_0x3db01e[_0x4487('0x30')],qs[_0x4487('0x35')](_0x3eac7f[_0x4487('0x31')]['fields']));_0x3ff116[_0x4487('0x36')]=_0x3ff116[_0x4487('0x36')][_0x4487('0x37')]?_0x3ff116['attributes']:_0x3db01e['model'];if(_0x3eac7f[_0x4487('0x31')][_0x4487('0x43')]){_0x3ff116[_0x4487('0x44')]=[{'all':!![]}];}_0x3ff116=_['merge']({},_0x3ff116,_0x3eac7f[_0x4487('0x41')]);return db[_0x4487('0x42')][_0x4487('0x47')](_0x3ff116)[_0x4487('0x25')](handleEntityNotFound(_0x791b97,null))[_0x4487('0x25')](respondWithResult(_0x791b97,null))[_0x4487('0x48')](handleError(_0x791b97,null));};exports[_0x4487('0x49')]=function(_0x124d7b,_0x44de85){return db[_0x4487('0x42')]['create'](_0x124d7b[_0x4487('0x4a')],{})[_0x4487('0x25')](respondWithResult(_0x44de85,0xc9))[_0x4487('0x48')](handleError(_0x44de85,null));};exports['update']=function(_0x4c7bb8,_0x36f89e){if(_0x4c7bb8[_0x4487('0x4a')]['id']){delete _0x4c7bb8['body']['id'];}return db[_0x4487('0x42')]['find']({'where':{'id':_0x4c7bb8[_0x4487('0x4b')]['id']}})[_0x4487('0x25')](handleEntityNotFound(_0x36f89e,null))[_0x4487('0x25')](saveUpdates(_0x4c7bb8['body'],null))[_0x4487('0x25')](respondWithResult(_0x36f89e,null))[_0x4487('0x48')](handleError(_0x36f89e,null));};exports[_0x4487('0x4c')]=function(_0x53c6ee,_0x23df73){return db[_0x4487('0x42')][_0x4487('0x47')]({'where':{'id':_0x53c6ee[_0x4487('0x4b')]['id']}})[_0x4487('0x25')](handleEntityNotFound(_0x23df73,null))[_0x4487('0x25')](removeEntity(_0x23df73,null))['catch'](handleError(_0x23df73,null));};exports[_0x4487('0x4d')]=function(_0x37bf73,_0xd93868,_0x21b10b){var _0x5df746={};var _0x92bdda={};var _0x50fcec;var _0x8fbdf0;return db[_0x4487('0x42')][_0x4487('0x4e')]({'where':{'id':_0x37bf73['params']['id']}})[_0x4487('0x25')](handleEntityNotFound(_0xd93868,null))[_0x4487('0x25')](function(_0x5b5dfe){if(_0x5b5dfe){_0x50fcec=_0x5b5dfe;_0x92bdda[_0x4487('0x30')]=_[_0x4487('0x32')](db[_0x4487('0x4f')][_0x4487('0x2c')]);_0x92bdda[_0x4487('0x31')]=_[_0x4487('0x32')](_0x37bf73[_0x4487('0x31')]);_0x92bdda[_0x4487('0x33')]=_['intersection'](_0x92bdda[_0x4487('0x30')],_0x92bdda[_0x4487('0x31')]);_0x5df746[_0x4487('0x36')]=_[_0x4487('0x34')](_0x92bdda['model'],qs[_0x4487('0x35')](_0x37bf73[_0x4487('0x31')][_0x4487('0x35')]));_0x5df746[_0x4487('0x36')]=_0x5df746[_0x4487('0x36')][_0x4487('0x37')]?_0x5df746[_0x4487('0x36')]:_0x92bdda[_0x4487('0x30')];_0x5df746[_0x4487('0x3a')]=qs[_0x4487('0x3b')](_0x37bf73['query']['sort']);_0x5df746[_0x4487('0x3f')]=qs[_0x4487('0x33')](_['pick'](_0x37bf73[_0x4487('0x31')],_0x92bdda[_0x4487('0x33')]));if(_0x37bf73[_0x4487('0x31')][_0x4487('0x3d')]){_0x5df746['where']=_['merge'](_0x5df746[_0x4487('0x3f')],{'$or':_['map'](_0x5df746['attributes'],function(_0x1d7bb7){var _0x3864f8={};_0x3864f8[_0x1d7bb7]={'$like':'%'+_0x37bf73[_0x4487('0x31')][_0x4487('0x3d')]+'%'};return _0x3864f8;})});}_0x5df746=_[_0x4487('0x3e')]({},_0x5df746,_0x37bf73['options']);return _0x50fcec['getFields'](_0x5df746);}})['then'](function(_0x72b77){if(_0x72b77){_0x8fbdf0=_0x72b77[_0x4487('0x37')];if(!_0x37bf73['query']['hasOwnProperty'](_0x4487('0x39'))){_0x5df746[_0x4487('0x1f')]=qs[_0x4487('0x1f')](_0x37bf73[_0x4487('0x31')][_0x4487('0x1f')]);_0x5df746['offset']=qs[_0x4487('0x1c')](_0x37bf73[_0x4487('0x31')][_0x4487('0x1c')]);}return _0x50fcec[_0x4487('0x4d')](_0x5df746);}})[_0x4487('0x25')](function(_0x5a5af3){if(_0x5a5af3){return _0x5a5af3?{'count':_0x8fbdf0,'rows':_0x5a5af3}:null;}})[_0x4487('0x25')](respondWithResult(_0xd93868,null))[_0x4487('0x48')](handleError(_0xd93868,null));};exports[_0x4487('0x50')]=function(_0x513cfe,_0x2eeae5,_0x4bcba2){var _0x240d3d={};var _0x3e7491={};var _0x478b48;var _0x259a62;return db['SalesforceConfiguration']['findOne']({'where':{'id':_0x513cfe[_0x4487('0x4b')]['id']}})[_0x4487('0x25')](handleEntityNotFound(_0x2eeae5,null))[_0x4487('0x25')](function(_0x525c3b){if(_0x525c3b){_0x478b48=_0x525c3b;_0x3e7491[_0x4487('0x30')]=_['keys'](db['SalesforceField'][_0x4487('0x2c')]);_0x3e7491['query']=_['keys'](_0x513cfe[_0x4487('0x31')]);_0x3e7491[_0x4487('0x33')]=_['intersection'](_0x3e7491[_0x4487('0x30')],_0x3e7491['query']);_0x240d3d[_0x4487('0x36')]=_[_0x4487('0x34')](_0x3e7491['model'],qs[_0x4487('0x35')](_0x513cfe[_0x4487('0x31')][_0x4487('0x35')]));_0x240d3d['attributes']=_0x240d3d[_0x4487('0x36')]['length']?_0x240d3d['attributes']:_0x3e7491[_0x4487('0x30')];_0x240d3d[_0x4487('0x3a')]=qs[_0x4487('0x3b')](_0x513cfe[_0x4487('0x31')][_0x4487('0x3b')]);_0x240d3d[_0x4487('0x3f')]=qs[_0x4487('0x33')](_['pick'](_0x513cfe[_0x4487('0x31')],_0x3e7491['filters']));if(_0x513cfe['query'][_0x4487('0x3d')]){_0x240d3d[_0x4487('0x3f')]=_[_0x4487('0x3e')](_0x240d3d['where'],{'$or':_[_0x4487('0x2b')](_0x240d3d[_0x4487('0x36')],function(_0x36398b){var _0x152dcf={};_0x152dcf[_0x36398b]={'$like':'%'+_0x513cfe[_0x4487('0x31')][_0x4487('0x3d')]+'%'};return _0x152dcf;})});}_0x240d3d=_[_0x4487('0x3e')]({},_0x240d3d,_0x513cfe[_0x4487('0x41')]);return _0x478b48[_0x4487('0x50')](_0x240d3d);}})[_0x4487('0x25')](function(_0x21852d){if(_0x21852d){_0x259a62=_0x21852d[_0x4487('0x37')];if(!_0x513cfe[_0x4487('0x31')][_0x4487('0x38')](_0x4487('0x39'))){_0x240d3d['limit']=qs[_0x4487('0x1f')](_0x513cfe[_0x4487('0x31')][_0x4487('0x1f')]);_0x240d3d[_0x4487('0x1c')]=qs[_0x4487('0x1c')](_0x513cfe[_0x4487('0x31')][_0x4487('0x1c')]);}return _0x478b48[_0x4487('0x50')](_0x240d3d);}})[_0x4487('0x25')](function(_0x1044f7){if(_0x1044f7){return _0x1044f7?{'count':_0x259a62,'rows':_0x1044f7}:null;}})[_0x4487('0x25')](respondWithResult(_0x2eeae5,null))['catch'](handleError(_0x2eeae5,null));};exports[_0x4487('0x51')]=function(_0x241436,_0x2d5dda,_0x2cbdbe){var _0x382299={};var _0x3d4239={};var _0x42709e;var _0x42c5d1;return db[_0x4487('0x42')][_0x4487('0x4e')]({'where':{'id':_0x241436[_0x4487('0x4b')]['id']}})[_0x4487('0x25')](handleEntityNotFound(_0x2d5dda,null))['then'](function(_0x1ac7c4){if(_0x1ac7c4){_0x42709e=_0x1ac7c4;_0x3d4239[_0x4487('0x30')]=_[_0x4487('0x32')](db[_0x4487('0x4f')]['rawAttributes']);_0x3d4239[_0x4487('0x31')]=_[_0x4487('0x32')](_0x241436[_0x4487('0x31')]);_0x3d4239[_0x4487('0x33')]=_[_0x4487('0x34')](_0x3d4239[_0x4487('0x30')],_0x3d4239[_0x4487('0x31')]);_0x382299[_0x4487('0x36')]=_[_0x4487('0x34')](_0x3d4239[_0x4487('0x30')],qs[_0x4487('0x35')](_0x241436[_0x4487('0x31')][_0x4487('0x35')]));_0x382299[_0x4487('0x36')]=_0x382299[_0x4487('0x36')][_0x4487('0x37')]?_0x382299[_0x4487('0x36')]:_0x3d4239[_0x4487('0x30')];_0x382299[_0x4487('0x3a')]=qs[_0x4487('0x3b')](_0x241436[_0x4487('0x31')]['sort']);_0x382299[_0x4487('0x3f')]=qs['filters'](_[_0x4487('0x3c')](_0x241436[_0x4487('0x31')],_0x3d4239[_0x4487('0x33')]));if(_0x241436[_0x4487('0x31')][_0x4487('0x3d')]){_0x382299[_0x4487('0x3f')]=_[_0x4487('0x3e')](_0x382299['where'],{'$or':_[_0x4487('0x2b')](_0x382299[_0x4487('0x36')],function(_0x990ae1){var _0xa0a5b9={};_0xa0a5b9[_0x990ae1]={'$like':'%'+_0x241436[_0x4487('0x31')]['filter']+'%'};return _0xa0a5b9;})});}_0x382299=_['merge']({},_0x382299,_0x241436[_0x4487('0x41')]);return _0x42709e[_0x4487('0x51')](_0x382299);}})[_0x4487('0x25')](function(_0x578d46){if(_0x578d46){_0x42c5d1=_0x578d46[_0x4487('0x37')];if(!_0x241436['query'][_0x4487('0x38')]('nolimit')){_0x382299[_0x4487('0x1f')]=qs['limit'](_0x241436['query'][_0x4487('0x1f')]);_0x382299['offset']=qs['offset'](_0x241436[_0x4487('0x31')][_0x4487('0x1c')]);}return _0x42709e[_0x4487('0x51')](_0x382299);}})[_0x4487('0x25')](function(_0x32b592){if(_0x32b592){return _0x32b592?{'count':_0x42c5d1,'rows':_0x32b592}:null;}})[_0x4487('0x25')](respondWithResult(_0x2d5dda,null))['catch'](handleError(_0x2d5dda,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.model.js index a2531ea..fbd183a 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 _0x8a54=['int_salesforce_configurations','util','moment','bluebird','path','rimraf','../../config/environment','./intSalesforceConfiguration.attributes','define'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x8a54,0x1de));var _0x48a5=function(_0x182b36,_0x20aa6d){_0x182b36=_0x182b36-0x0;var _0x53cede=_0x8a54[_0x182b36];return _0x53cede;};'use strict';var _=require('lodash');var util=require(_0x48a5('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0x48a5('0x1'));var BPromise=require(_0x48a5('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x48a5('0x3'));var rimraf=require(_0x48a5('0x4'));var config=require(_0x48a5('0x5'));var attributes=require(_0x48a5('0x6'));module['exports']=function(_0x127553,_0x5f4bab){return _0x127553[_0x48a5('0x7')]('SalesforceConfiguration',attributes,{'tableName':_0x48a5('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa334=['request-promise','rimraf','../../config/environment','exports','define','int_salesforce_configurations','lodash','util','../../config/logger','api','bluebird'];(function(_0x3c1b54,_0x966758){var _0x4b732e=function(_0x42a40a){while(--_0x42a40a){_0x3c1b54['push'](_0x3c1b54['shift']());}};_0x4b732e(++_0x966758);}(_0xa334,0x8a));var _0x4a33=function(_0x533593,_0x575c89){_0x533593=_0x533593-0x0;var _0x21311c=_0xa334[_0x533593];return _0x21311c;};'use strict';var _=require(_0x4a33('0x0'));var util=require(_0x4a33('0x1'));var logger=require(_0x4a33('0x2'))(_0x4a33('0x3'));var moment=require('moment');var BPromise=require(_0x4a33('0x4'));var rp=require(_0x4a33('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4a33('0x6'));var config=require(_0x4a33('0x7'));var attributes=require('./intSalesforceConfiguration.attributes');module[_0x4a33('0x8')]=function(_0x4fc8ec,_0xb27577){return _0x4fc8ec[_0x4a33('0x9')]('SalesforceConfiguration',attributes,{'tableName':_0x4a33('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js b/server/api/intSalesforceConfiguration/intSalesforceConfiguration.rpc.js index 30fbd9d..b0f44d5 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 _0xc655=['code','message','catch','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x62dde7,_0x4f852b){var _0x4cf33e=function(_0x1f2a67){while(--_0x1f2a67){_0x62dde7['push'](_0x62dde7['shift']());}};_0x4cf33e(++_0x4f852b);}(_0xc655,0x168));var _0x5c65=function(_0x1f23db,_0x4e4a7d){_0x1f23db=_0x1f23db-0x0;var _0x3a55a6=_0xc655[_0x1f23db];return _0x3a55a6;};'use strict';var _=require('lodash');var util=require(_0x5c65('0x0'));var moment=require(_0x5c65('0x1'));var BPromise=require(_0x5c65('0x2'));var rs=require(_0x5c65('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x5c65('0x4'));var logger=require(_0x5c65('0x5'))(_0x5c65('0x6'));var config=require('../../config/environment');var jayson=require(_0x5c65('0x7'));var client=jayson[_0x5c65('0x8')][_0x5c65('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x8cfa9,_0x4b2789,_0x2a30a1){return new BPromise(function(_0xd35ff5,_0x546399){return client['request'](_0x8cfa9,_0x2a30a1)[_0x5c65('0xa')](function(_0x38622f){logger[_0x5c65('0xb')](_0x5c65('0xc'),_0x4b2789,_0x5c65('0xd'));logger[_0x5c65('0xe')](_0x5c65('0xf'),_0x4b2789,_0x5c65('0xd'),JSON[_0x5c65('0x10')](_0x38622f));if(_0x38622f['error']){if(_0x38622f[_0x5c65('0x11')][_0x5c65('0x12')]===0x1f4){logger[_0x5c65('0x11')](_0x5c65('0xc'),_0x4b2789,_0x38622f[_0x5c65('0x11')][_0x5c65('0x13')]);return _0x546399(_0x38622f['error'][_0x5c65('0x13')]);}logger['error'](_0x5c65('0xc'),_0x4b2789,_0x38622f[_0x5c65('0x11')][_0x5c65('0x13')]);return _0xd35ff5(_0x38622f[_0x5c65('0x11')][_0x5c65('0x13')]);}else{logger[_0x5c65('0xb')]('SalesforceConfiguration,\x20%s,\x20%s',_0x4b2789,_0x5c65('0xd'));_0xd35ff5(_0x38622f['result'][_0x5c65('0x13')]);}})[_0x5c65('0x14')](function(_0x10b2aa){logger[_0x5c65('0x11')](_0x5c65('0xc'),_0x4b2789,_0x10b2aa);_0x546399(_0x10b2aa);});});} \ No newline at end of file +var _0x24e1=['lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','SalesforceConfiguration,\x20%s,\x20%s','request\x20sent','debug','SalesforceConfiguration,\x20%s,\x20%s,\x20%s','stringify','code','error','message','info','result','catch'];(function(_0x315b39,_0x5cf8cd){var _0x223808=function(_0x5cd732){while(--_0x5cd732){_0x315b39['push'](_0x315b39['shift']());}};_0x223808(++_0x5cf8cd);}(_0x24e1,0xd8));var _0x124e=function(_0x1a129e,_0xbd8a16){_0x1a129e=_0x1a129e-0x0;var _0x1f47e9=_0x24e1[_0x1a129e];return _0x1f47e9;};'use strict';var _=require(_0x124e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x124e('0x1'));var rs=require(_0x124e('0x2'));var fs=require('fs');var Redis=require(_0x124e('0x3'));var db=require(_0x124e('0x4'))['db'];var utils=require(_0x124e('0x5'));var logger=require(_0x124e('0x6'))(_0x124e('0x7'));var config=require(_0x124e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x124e('0x9')][_0x124e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x581e6c,_0x3c8f0a,_0x5c09d8){return new BPromise(function(_0x13e44d,_0x5bcacf){return client[_0x124e('0xb')](_0x581e6c,_0x5c09d8)[_0x124e('0xc')](function(_0x31c1b4){logger['info'](_0x124e('0xd'),_0x3c8f0a,_0x124e('0xe'));logger[_0x124e('0xf')](_0x124e('0x10'),_0x3c8f0a,_0x124e('0xe'),JSON[_0x124e('0x11')](_0x31c1b4));if(_0x31c1b4['error']){if(_0x31c1b4['error'][_0x124e('0x12')]===0x1f4){logger[_0x124e('0x13')](_0x124e('0xd'),_0x3c8f0a,_0x31c1b4[_0x124e('0x13')][_0x124e('0x14')]);return _0x5bcacf(_0x31c1b4[_0x124e('0x13')][_0x124e('0x14')]);}logger['error']('SalesforceConfiguration,\x20%s,\x20%s',_0x3c8f0a,_0x31c1b4[_0x124e('0x13')][_0x124e('0x14')]);return _0x13e44d(_0x31c1b4[_0x124e('0x13')]['message']);}else{logger[_0x124e('0x15')](_0x124e('0xd'),_0x3c8f0a,_0x124e('0xe'));_0x13e44d(_0x31c1b4[_0x124e('0x16')][_0x124e('0x14')]);}})[_0x124e('0x17')](function(_0x4a7cac){logger[_0x124e('0x13')](_0x124e('0xd'),_0x3c8f0a,_0x4a7cac);_0x5bcacf(_0x4a7cac);});});} \ No newline at end of file diff --git a/server/api/intSalesforceField/index.js b/server/api/intSalesforceField/index.js index 3b51fd6..ad8da65 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 _0x1c4d=['show','post','create','put','delete','destroy','exports','multer','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id'];(function(_0x1034bb,_0x4e20b3){var _0x453fdb=function(_0x455356){while(--_0x455356){_0x1034bb['push'](_0x1034bb['shift']());}};_0x453fdb(++_0x4e20b3);}(_0x1c4d,0x1e3));var _0xd1c4=function(_0x1ab030,_0x2b13be){_0x1ab030=_0x1ab030-0x0;var _0x41afb0=_0x1c4d[_0x1ab030];return _0x41afb0;};'use strict';var multer=require(_0xd1c4('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xd1c4('0x1'));var express=require('express');var router=express[_0xd1c4('0x2')]();var fs_extra=require(_0xd1c4('0x3'));var auth=require(_0xd1c4('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xd1c4('0x5'));var controller=require('./intSalesforceField.controller');router[_0xd1c4('0x6')]('/',auth[_0xd1c4('0x7')](),controller[_0xd1c4('0x8')]);router[_0xd1c4('0x6')](_0xd1c4('0x9'),auth[_0xd1c4('0x7')](),controller[_0xd1c4('0xa')]);router[_0xd1c4('0xb')]('/',auth['isAuthenticated'](),controller[_0xd1c4('0xc')]);router[_0xd1c4('0xd')](_0xd1c4('0x9'),auth[_0xd1c4('0x7')](),controller['update']);router[_0xd1c4('0xe')](_0xd1c4('0x9'),auth[_0xd1c4('0x7')](),controller[_0xd1c4('0xf')]);module[_0xd1c4('0x10')]=router; \ No newline at end of file +var _0x5b0f=['./intSalesforceField.controller','get','isAuthenticated','/:id','show','create','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment'];(function(_0x2f05c5,_0x5407f7){var _0x2c8062=function(_0x2724ba){while(--_0x2724ba){_0x2f05c5['push'](_0x2f05c5['shift']());}};_0x2c8062(++_0x5407f7);}(_0x5b0f,0xb2));var _0xf5b0=function(_0x158cfc,_0x3ff9e0){_0x158cfc=_0x158cfc-0x0;var _0x38baee=_0x5b0f[_0x158cfc];return _0x38baee;};'use strict';var multer=require(_0xf5b0('0x0'));var util=require(_0xf5b0('0x1'));var path=require(_0xf5b0('0x2'));var timeout=require(_0xf5b0('0x3'));var express=require(_0xf5b0('0x4'));var router=express[_0xf5b0('0x5')]();var fs_extra=require(_0xf5b0('0x6'));var auth=require(_0xf5b0('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xf5b0('0x8'));var controller=require(_0xf5b0('0x9'));router[_0xf5b0('0xa')]('/',auth[_0xf5b0('0xb')](),controller['index']);router['get'](_0xf5b0('0xc'),auth[_0xf5b0('0xb')](),controller[_0xf5b0('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xf5b0('0xe')]);router['put'](_0xf5b0('0xc'),auth[_0xf5b0('0xb')](),controller['update']);router[_0xf5b0('0xf')](_0xf5b0('0xc'),auth[_0xf5b0('0xb')](),controller[_0xf5b0('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.attributes.js b/server/api/intSalesforceField/intSalesforceField.attributes.js index fdff0c0..9f3d48b 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 _0xb186=['sequelize','ENUM','string','variable','customVariable','keyValue','picklist','STRING'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xb186,0xe8));var _0x6b18=function(_0x2dd615,_0x18099c){_0x2dd615=_0x2dd615-0x0;var _0x5255a4=_0xb186[_0x2dd615];return _0x5255a4;};'use strict';var Sequelize=require(_0x6b18('0x0'));module['exports']={'type':{'type':Sequelize[_0x6b18('0x1')](_0x6b18('0x2'),_0x6b18('0x3'),_0x6b18('0x4'),_0x6b18('0x5'),_0x6b18('0x6')),'defaultValue':_0x6b18('0x2')},'content':{'type':Sequelize[_0x6b18('0x7')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x6b18('0x2'),_0x6b18('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0x6b18('0x7')]},'idField':{'type':Sequelize['STRING']},'variableName':{'type':Sequelize[_0x6b18('0x7')]}}; \ No newline at end of file +var _0xfb7c=['exports','ENUM','variable','customVariable','picklist','string','STRING','sequelize'];(function(_0x2b9e8a,_0x7b21d4){var _0x520e67=function(_0x22bce8){while(--_0x22bce8){_0x2b9e8a['push'](_0x2b9e8a['shift']());}};_0x520e67(++_0x7b21d4);}(_0xfb7c,0x15f));var _0xcfb7=function(_0xb3fb38,_0x4b501d){_0xb3fb38=_0xb3fb38-0x0;var _0x229cfa=_0xfb7c[_0xb3fb38];return _0x229cfa;};'use strict';var Sequelize=require(_0xcfb7('0x0'));module[_0xcfb7('0x1')]={'type':{'type':Sequelize[_0xcfb7('0x2')]('string',_0xcfb7('0x3'),_0xcfb7('0x4'),'keyValue',_0xcfb7('0x5')),'defaultValue':_0xcfb7('0x6')},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0xcfb7('0x7')]},'keyType':{'type':Sequelize['ENUM'](_0xcfb7('0x6'),_0xcfb7('0x3'),'customVariable')},'keyContent':{'type':Sequelize[_0xcfb7('0x7')]},'idField':{'type':Sequelize[_0xcfb7('0x7')]},'variableName':{'type':Sequelize[_0xcfb7('0x7')]}}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.controller.js b/server/api/intSalesforceField/intSalesforceField.controller.js index a3ac5c9..1f33e94 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 _0x25d6=['key','keys','query','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','find','create','update','body','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','then','destroy','error','name','send','index','map','SalesforceField','rawAttributes','type'];(function(_0x42c587,_0x224d2a){var _0x3410cc=function(_0x4c8815){while(--_0x4c8815){_0x42c587['push'](_0x42c587['shift']());}};_0x3410cc(++_0x224d2a);}(_0x25d6,0x66));var _0x625d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x25d6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x625d('0x0'));var rimraf=require(_0x625d('0x1'));var zipdir=require(_0x625d('0x2'));var jsonpatch=require(_0x625d('0x3'));var rp=require('request-promise');var moment=require(_0x625d('0x4'));var BPromise=require(_0x625d('0x5'));var Mustache=require(_0x625d('0x6'));var util=require('util');var path=require(_0x625d('0x7'));var sox=require(_0x625d('0x8'));var csv=require(_0x625d('0x9'));var ejs=require(_0x625d('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x625d('0xb'));var crypto=require(_0x625d('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x625d('0xd'));var toCsv=require('to-csv');var querystring=require(_0x625d('0xe'));var Papa=require(_0x625d('0xf'));var Redis=require(_0x625d('0x10'));var authService=require(_0x625d('0x11'));var qs=require(_0x625d('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x625d('0x13'));var config=require(_0x625d('0x14'));var licenseUtil=require('../../config/license/util');var db=require(_0x625d('0x15'))['db'];function respondWithStatusCode(_0x5a85fd,_0x504b69){_0x504b69=_0x504b69||0xcc;return function(_0x1ab1fa){if(_0x1ab1fa){return _0x5a85fd[_0x625d('0x16')](_0x504b69);}return _0x5a85fd[_0x625d('0x17')](_0x504b69)['end']();};}function respondWithResult(_0x255c4e,_0x3a8a0b){_0x3a8a0b=_0x3a8a0b||0xc8;return function(_0x35c3b1){if(_0x35c3b1){return _0x255c4e[_0x625d('0x17')](_0x3a8a0b)[_0x625d('0x18')](_0x35c3b1);}};}function respondWithFilteredResult(_0x3b3465,_0x1a4af5){return function(_0x62128f){if(_0x62128f){var _0x1594a6=typeof _0x1a4af5[_0x625d('0x19')]===_0x625d('0x1a')&&typeof _0x1a4af5[_0x625d('0x1b')]===_0x625d('0x1a');var _0x48d5f7=_0x62128f[_0x625d('0x1c')];var _0x3de5d0=_0x1594a6?0x0:_0x1a4af5[_0x625d('0x19')];var _0x581a86=_0x1594a6?_0x62128f[_0x625d('0x1c')]:_0x1a4af5[_0x625d('0x19')]+_0x1a4af5[_0x625d('0x1b')];var _0x2b92dd;if(_0x581a86>=_0x48d5f7){_0x581a86=_0x48d5f7;_0x2b92dd=0xc8;}else{_0x2b92dd=0xce;}_0x3b3465[_0x625d('0x17')](_0x2b92dd);return _0x3b3465['set'](_0x625d('0x1d'),_0x3de5d0+'-'+_0x581a86+'/'+_0x48d5f7)[_0x625d('0x18')](_0x62128f);}return null;};}function patchUpdates(_0x1f4646){return function(_0x2cc873){try{jsonpatch[_0x625d('0x1e')](_0x2cc873,_0x1f4646,!![]);}catch(_0x40189e){return BPromise[_0x625d('0x1f')](_0x40189e);}return _0x2cc873['save']();};}function saveUpdates(_0x6c1903,_0x164715){return function(_0x977b60){if(_0x977b60){return _0x977b60['update'](_0x6c1903)[_0x625d('0x20')](function(_0x33f264){return _0x33f264;});}return null;};}function removeEntity(_0x13aa47,_0x2af887){return function(_0x4a780a){if(_0x4a780a){return _0x4a780a[_0x625d('0x21')]()[_0x625d('0x20')](function(){_0x13aa47['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x1075a3,_0x113d02){return function(_0x9a87cc){if(!_0x9a87cc){_0x1075a3['sendStatus'](0x194);}return _0x9a87cc;};}function handleError(_0x717a28,_0x437c37){_0x437c37=_0x437c37||0x1f4;return function(_0x5d5027){logger[_0x625d('0x22')](_0x5d5027['stack']);if(_0x5d5027[_0x625d('0x23')]){delete _0x5d5027['name'];}_0x717a28[_0x625d('0x17')](_0x437c37)[_0x625d('0x24')](_0x5d5027);};}exports[_0x625d('0x25')]=function(_0x1b48e1,_0x22f519){var _0x5aecc4={},_0x2e4105={},_0x4810ab={'count':0x0,'rows':[]};var _0x16fca9=_[_0x625d('0x26')](db[_0x625d('0x27')][_0x625d('0x28')],function(_0x3362ba){return{'name':_0x3362ba['fieldName'],'type':_0x3362ba[_0x625d('0x29')][_0x625d('0x2a')]};});_0x2e4105['model']=_[_0x625d('0x26')](_0x16fca9,'name');_0x2e4105['query']=_[_0x625d('0x2b')](_0x1b48e1[_0x625d('0x2c')]);_0x2e4105[_0x625d('0x2d')]=_['intersection'](_0x2e4105['model'],_0x2e4105[_0x625d('0x2c')]);_0x5aecc4[_0x625d('0x2e')]=_[_0x625d('0x2f')](_0x2e4105['model'],qs[_0x625d('0x30')](_0x1b48e1[_0x625d('0x2c')][_0x625d('0x30')]));_0x5aecc4[_0x625d('0x2e')]=_0x5aecc4[_0x625d('0x2e')][_0x625d('0x31')]?_0x5aecc4[_0x625d('0x2e')]:_0x2e4105[_0x625d('0x32')];if(!_0x1b48e1['query'][_0x625d('0x33')](_0x625d('0x34'))){_0x5aecc4[_0x625d('0x1b')]=qs[_0x625d('0x1b')](_0x1b48e1[_0x625d('0x2c')][_0x625d('0x1b')]);_0x5aecc4['offset']=qs[_0x625d('0x19')](_0x1b48e1[_0x625d('0x2c')]['offset']);}_0x5aecc4[_0x625d('0x35')]=qs['sort'](_0x1b48e1[_0x625d('0x2c')][_0x625d('0x36')]);_0x5aecc4[_0x625d('0x37')]=qs[_0x625d('0x2d')](_[_0x625d('0x38')](_0x1b48e1[_0x625d('0x2c')],_0x2e4105[_0x625d('0x2d')]),_0x16fca9);if(_0x1b48e1[_0x625d('0x2c')][_0x625d('0x39')]){_0x5aecc4[_0x625d('0x37')]=_[_0x625d('0x3a')](_0x5aecc4[_0x625d('0x37')],{'$or':_[_0x625d('0x26')](_0x16fca9,function(_0x1be5b3){if(_0x1be5b3[_0x625d('0x29')]!==_0x625d('0x3b')){var _0x5b494d={};_0x5b494d[_0x1be5b3['name']]={'$like':'%'+_0x1b48e1[_0x625d('0x2c')]['filter']+'%'};return _0x5b494d;}})});}_0x5aecc4=_['merge']({},_0x5aecc4,_0x1b48e1[_0x625d('0x3c')]);var _0x426ca8={'where':_0x5aecc4[_0x625d('0x37')]};return db[_0x625d('0x27')]['count'](_0x426ca8)[_0x625d('0x20')](function(_0x56db04){_0x4810ab[_0x625d('0x1c')]=_0x56db04;if(_0x1b48e1['query']['includeAll']){_0x5aecc4[_0x625d('0x3d')]=[{'all':!![]}];}return db[_0x625d('0x27')][_0x625d('0x3e')](_0x5aecc4);})[_0x625d('0x20')](function(_0x2439c8){_0x4810ab[_0x625d('0x3f')]=_0x2439c8;return _0x4810ab;})['then'](respondWithFilteredResult(_0x22f519,_0x5aecc4))[_0x625d('0x40')](handleError(_0x22f519,null));};exports[_0x625d('0x41')]=function(_0x36adf6,_0x442a0b){var _0x1731c4={'raw':!![],'where':{'id':_0x36adf6[_0x625d('0x42')]['id']}},_0x48a995={};_0x48a995[_0x625d('0x32')]=_[_0x625d('0x2b')](db[_0x625d('0x27')][_0x625d('0x28')]);_0x48a995[_0x625d('0x2c')]=_['keys'](_0x36adf6[_0x625d('0x2c')]);_0x48a995[_0x625d('0x2d')]=_['intersection'](_0x48a995['model'],_0x48a995[_0x625d('0x2c')]);_0x1731c4[_0x625d('0x2e')]=_[_0x625d('0x2f')](_0x48a995[_0x625d('0x32')],qs[_0x625d('0x30')](_0x36adf6[_0x625d('0x2c')][_0x625d('0x30')]));_0x1731c4[_0x625d('0x2e')]=_0x1731c4[_0x625d('0x2e')]['length']?_0x1731c4[_0x625d('0x2e')]:_0x48a995[_0x625d('0x32')];if(_0x36adf6['query'][_0x625d('0x43')]){_0x1731c4[_0x625d('0x3d')]=[{'all':!![]}];}_0x1731c4=_['merge']({},_0x1731c4,_0x36adf6[_0x625d('0x3c')]);return db[_0x625d('0x27')][_0x625d('0x44')](_0x1731c4)[_0x625d('0x20')](handleEntityNotFound(_0x442a0b,null))[_0x625d('0x20')](respondWithResult(_0x442a0b,null))[_0x625d('0x40')](handleError(_0x442a0b,null));};exports[_0x625d('0x45')]=function(_0x38f1e2,_0x113db6){return db['SalesforceField'][_0x625d('0x45')](_0x38f1e2['body'],{})[_0x625d('0x20')](respondWithResult(_0x113db6,0xc9))[_0x625d('0x40')](handleError(_0x113db6,null));};exports[_0x625d('0x46')]=function(_0x3b4ad8,_0x123fa1){if(_0x3b4ad8[_0x625d('0x47')]['id']){delete _0x3b4ad8['body']['id'];}return db[_0x625d('0x27')][_0x625d('0x44')]({'where':{'id':_0x3b4ad8[_0x625d('0x42')]['id']}})[_0x625d('0x20')](handleEntityNotFound(_0x123fa1,null))[_0x625d('0x20')](saveUpdates(_0x3b4ad8['body'],null))[_0x625d('0x20')](respondWithResult(_0x123fa1,null))[_0x625d('0x40')](handleError(_0x123fa1,null));};exports[_0x625d('0x21')]=function(_0x427979,_0x2edfd1){return db[_0x625d('0x27')][_0x625d('0x44')]({'where':{'id':_0x427979[_0x625d('0x42')]['id']}})[_0x625d('0x20')](handleEntityNotFound(_0x2edfd1,null))[_0x625d('0x20')](removeEntity(_0x2edfd1,null))[_0x625d('0x40')](handleError(_0x2edfd1,null));}; \ No newline at end of file +var _0x90c2=['keys','SalesforceField','rawAttributes','find','create','body','catch','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','set','Content-Range','reject','update','destroy','then','sendStatus','error','stack','name','send','map','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','show'];(function(_0x5dd20f,_0xd08ee0){var _0x32f413=function(_0x6b5ba6){while(--_0x6b5ba6){_0x5dd20f['push'](_0x5dd20f['shift']());}};_0x32f413(++_0xd08ee0);}(_0x90c2,0x18e));var _0x290c=function(_0x17ee34,_0x32dae1){_0x17ee34=_0x17ee34-0x0;var _0x53271b=_0x90c2[_0x17ee34];return _0x53271b;};'use strict';var emlformat=require(_0x290c('0x0'));var rimraf=require(_0x290c('0x1'));var zipdir=require(_0x290c('0x2'));var jsonpatch=require(_0x290c('0x3'));var rp=require('request-promise');var moment=require(_0x290c('0x4'));var BPromise=require(_0x290c('0x5'));var Mustache=require(_0x290c('0x6'));var util=require(_0x290c('0x7'));var path=require(_0x290c('0x8'));var sox=require(_0x290c('0x9'));var csv=require(_0x290c('0xa'));var ejs=require(_0x290c('0xb'));var fs=require('fs');var fs_extra=require(_0x290c('0xc'));var _=require(_0x290c('0xd'));var squel=require(_0x290c('0xe'));var crypto=require(_0x290c('0xf'));var jsforce=require(_0x290c('0x10'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x290c('0x11'));var Papa=require(_0x290c('0x12'));var Redis=require(_0x290c('0x13'));var authService=require(_0x290c('0x14'));var qs=require('../../components/parsers/qs');var as=require(_0x290c('0x15'));var hardwareService=require(_0x290c('0x16'));var logger=require(_0x290c('0x17'))('api');var utils=require(_0x290c('0x18'));var config=require(_0x290c('0x19'));var licenseUtil=require(_0x290c('0x1a'));var db=require(_0x290c('0x1b'))['db'];function respondWithStatusCode(_0xe75dd4,_0x3650a3){_0x3650a3=_0x3650a3||0xcc;return function(_0x3a2811){if(_0x3a2811){return _0xe75dd4['sendStatus'](_0x3650a3);}return _0xe75dd4[_0x290c('0x1c')](_0x3650a3)[_0x290c('0x1d')]();};}function respondWithResult(_0x419a47,_0x2c7840){_0x2c7840=_0x2c7840||0xc8;return function(_0x3d6b8a){if(_0x3d6b8a){return _0x419a47[_0x290c('0x1c')](_0x2c7840)[_0x290c('0x1e')](_0x3d6b8a);}};}function respondWithFilteredResult(_0x485ee5,_0xe9b521){return function(_0x598f22){if(_0x598f22){var _0x1a318d=typeof _0xe9b521[_0x290c('0x1f')]==='undefined'&&typeof _0xe9b521['limit']===_0x290c('0x20');var _0x40fc20=_0x598f22['count'];var _0x1d0480=_0x1a318d?0x0:_0xe9b521[_0x290c('0x1f')];var _0x4485f1=_0x1a318d?_0x598f22['count']:_0xe9b521[_0x290c('0x1f')]+_0xe9b521[_0x290c('0x21')];var _0xe36364;if(_0x4485f1>=_0x40fc20){_0x4485f1=_0x40fc20;_0xe36364=0xc8;}else{_0xe36364=0xce;}_0x485ee5[_0x290c('0x1c')](_0xe36364);return _0x485ee5[_0x290c('0x22')](_0x290c('0x23'),_0x1d0480+'-'+_0x4485f1+'/'+_0x40fc20)[_0x290c('0x1e')](_0x598f22);}return null;};}function patchUpdates(_0x4ac747){return function(_0x534d40){try{jsonpatch['apply'](_0x534d40,_0x4ac747,!![]);}catch(_0xae650f){return BPromise[_0x290c('0x24')](_0xae650f);}return _0x534d40['save']();};}function saveUpdates(_0x4d7557,_0x4ce721){return function(_0xc5e67c){if(_0xc5e67c){return _0xc5e67c[_0x290c('0x25')](_0x4d7557)['then'](function(_0x3290b5){return _0x3290b5;});}return null;};}function removeEntity(_0x266af0,_0x2c9961){return function(_0x411de6){if(_0x411de6){return _0x411de6[_0x290c('0x26')]()[_0x290c('0x27')](function(){_0x266af0['status'](0xcc)[_0x290c('0x1d')]();});}};}function handleEntityNotFound(_0x478b4a,_0x47b61a){return function(_0x260577){if(!_0x260577){_0x478b4a[_0x290c('0x28')](0x194);}return _0x260577;};}function handleError(_0x36099f,_0x39cb58){_0x39cb58=_0x39cb58||0x1f4;return function(_0x2a1ff5){logger[_0x290c('0x29')](_0x2a1ff5[_0x290c('0x2a')]);if(_0x2a1ff5['name']){delete _0x2a1ff5[_0x290c('0x2b')];}_0x36099f[_0x290c('0x1c')](_0x39cb58)[_0x290c('0x2c')](_0x2a1ff5);};}exports['index']=function(_0x4cda36,_0x4177a5){var _0x53a40a={},_0x415574={},_0x28da87={'count':0x0,'rows':[]};var _0x4aa929=_[_0x290c('0x2d')](db['SalesforceField']['rawAttributes'],function(_0x453dde){return{'name':_0x453dde['fieldName'],'type':_0x453dde[_0x290c('0x2e')][_0x290c('0x2f')]};});_0x415574[_0x290c('0x30')]=_[_0x290c('0x2d')](_0x4aa929,_0x290c('0x2b'));_0x415574[_0x290c('0x31')]=_['keys'](_0x4cda36[_0x290c('0x31')]);_0x415574[_0x290c('0x32')]=_[_0x290c('0x33')](_0x415574['model'],_0x415574[_0x290c('0x31')]);_0x53a40a[_0x290c('0x34')]=_[_0x290c('0x33')](_0x415574['model'],qs['fields'](_0x4cda36[_0x290c('0x31')][_0x290c('0x35')]));_0x53a40a[_0x290c('0x34')]=_0x53a40a[_0x290c('0x34')][_0x290c('0x36')]?_0x53a40a['attributes']:_0x415574[_0x290c('0x30')];if(!_0x4cda36['query'][_0x290c('0x37')]('nolimit')){_0x53a40a[_0x290c('0x21')]=qs[_0x290c('0x21')](_0x4cda36[_0x290c('0x31')][_0x290c('0x21')]);_0x53a40a[_0x290c('0x1f')]=qs[_0x290c('0x1f')](_0x4cda36[_0x290c('0x31')][_0x290c('0x1f')]);}_0x53a40a[_0x290c('0x38')]=qs[_0x290c('0x39')](_0x4cda36[_0x290c('0x31')][_0x290c('0x39')]);_0x53a40a[_0x290c('0x3a')]=qs[_0x290c('0x32')](_[_0x290c('0x3b')](_0x4cda36[_0x290c('0x31')],_0x415574[_0x290c('0x32')]),_0x4aa929);if(_0x4cda36['query'][_0x290c('0x3c')]){_0x53a40a[_0x290c('0x3a')]=_[_0x290c('0x3d')](_0x53a40a['where'],{'$or':_[_0x290c('0x2d')](_0x4aa929,function(_0x1e7a11){if(_0x1e7a11[_0x290c('0x2e')]!==_0x290c('0x3e')){var _0x598431={};_0x598431[_0x1e7a11['name']]={'$like':'%'+_0x4cda36['query'][_0x290c('0x3c')]+'%'};return _0x598431;}})});}_0x53a40a=_[_0x290c('0x3d')]({},_0x53a40a,_0x4cda36[_0x290c('0x3f')]);var _0x52673b={'where':_0x53a40a[_0x290c('0x3a')]};return db['SalesforceField'][_0x290c('0x40')](_0x52673b)[_0x290c('0x27')](function(_0x1203b2){_0x28da87['count']=_0x1203b2;if(_0x4cda36[_0x290c('0x31')][_0x290c('0x41')]){_0x53a40a[_0x290c('0x42')]=[{'all':!![]}];}return db['SalesforceField'][_0x290c('0x43')](_0x53a40a);})['then'](function(_0x163e7e){_0x28da87[_0x290c('0x44')]=_0x163e7e;return _0x28da87;})[_0x290c('0x27')](respondWithFilteredResult(_0x4177a5,_0x53a40a))['catch'](handleError(_0x4177a5,null));};exports[_0x290c('0x45')]=function(_0x3c1db9,_0x5cdcbe){var _0x3ecb02={'raw':!![],'where':{'id':_0x3c1db9['params']['id']}},_0x1d5eb9={};_0x1d5eb9[_0x290c('0x30')]=_[_0x290c('0x46')](db[_0x290c('0x47')][_0x290c('0x48')]);_0x1d5eb9['query']=_['keys'](_0x3c1db9[_0x290c('0x31')]);_0x1d5eb9[_0x290c('0x32')]=_[_0x290c('0x33')](_0x1d5eb9['model'],_0x1d5eb9['query']);_0x3ecb02['attributes']=_['intersection'](_0x1d5eb9[_0x290c('0x30')],qs[_0x290c('0x35')](_0x3c1db9[_0x290c('0x31')]['fields']));_0x3ecb02[_0x290c('0x34')]=_0x3ecb02[_0x290c('0x34')][_0x290c('0x36')]?_0x3ecb02[_0x290c('0x34')]:_0x1d5eb9['model'];if(_0x3c1db9[_0x290c('0x31')][_0x290c('0x41')]){_0x3ecb02[_0x290c('0x42')]=[{'all':!![]}];}_0x3ecb02=_[_0x290c('0x3d')]({},_0x3ecb02,_0x3c1db9[_0x290c('0x3f')]);return db['SalesforceField'][_0x290c('0x49')](_0x3ecb02)[_0x290c('0x27')](handleEntityNotFound(_0x5cdcbe,null))[_0x290c('0x27')](respondWithResult(_0x5cdcbe,null))['catch'](handleError(_0x5cdcbe,null));};exports[_0x290c('0x4a')]=function(_0x543eb3,_0x3ba294){return db[_0x290c('0x47')]['create'](_0x543eb3[_0x290c('0x4b')],{})[_0x290c('0x27')](respondWithResult(_0x3ba294,0xc9))[_0x290c('0x4c')](handleError(_0x3ba294,null));};exports[_0x290c('0x25')]=function(_0x7f91e3,_0x1a2bde){if(_0x7f91e3[_0x290c('0x4b')]['id']){delete _0x7f91e3['body']['id'];}return db[_0x290c('0x47')]['find']({'where':{'id':_0x7f91e3[_0x290c('0x4d')]['id']}})[_0x290c('0x27')](handleEntityNotFound(_0x1a2bde,null))[_0x290c('0x27')](saveUpdates(_0x7f91e3[_0x290c('0x4b')],null))[_0x290c('0x27')](respondWithResult(_0x1a2bde,null))[_0x290c('0x4c')](handleError(_0x1a2bde,null));};exports[_0x290c('0x26')]=function(_0x568d02,_0xff2ea8){return db[_0x290c('0x47')][_0x290c('0x49')]({'where':{'id':_0x568d02['params']['id']}})[_0x290c('0x27')](handleEntityNotFound(_0xff2ea8,null))[_0x290c('0x27')](removeEntity(_0xff2ea8,null))['catch'](handleError(_0xff2ea8,null));}; \ No newline at end of file diff --git a/server/api/intSalesforceField/intSalesforceField.model.js b/server/api/intSalesforceField/intSalesforceField.model.js index 15bb393..6b49744 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 _0x9293=['moment','bluebird','path','rimraf','../../config/environment','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields','salesforce_unique_index','FieldId','util','api'];(function(_0x315e85,_0x51ea47){var _0x4b666c=function(_0x4662c5){while(--_0x4662c5){_0x315e85['push'](_0x315e85['shift']());}};_0x4b666c(++_0x51ea47);}(_0x9293,0x11c));var _0x3929=function(_0x456b57,_0x58691a){_0x456b57=_0x456b57-0x0;var _0x18f49f=_0x9293[_0x456b57];return _0x18f49f;};'use strict';var _=require('lodash');var util=require(_0x3929('0x0'));var logger=require('../../config/logger')(_0x3929('0x1'));var moment=require(_0x3929('0x2'));var BPromise=require(_0x3929('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3929('0x4'));var rimraf=require(_0x3929('0x5'));var config=require(_0x3929('0x6'));var attributes=require(_0x3929('0x7'));module['exports']=function(_0x1ee32f,_0x4da876){return _0x1ee32f[_0x3929('0x8')](_0x3929('0x9'),attributes,{'tableName':_0x3929('0xa'),'paranoid':![],'indexes':[{'name':_0x3929('0xb'),'fields':['idField',_0x3929('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9cc7=['idField','FieldId','lodash','util','../../config/logger','moment','request-promise','path','rimraf','./intSalesforceField.attributes','define','SalesforceField','int_salesforce_fields'];(function(_0x3b26c3,_0x403d3b){var _0x4034b7=function(_0x95433){while(--_0x95433){_0x3b26c3['push'](_0x3b26c3['shift']());}};_0x4034b7(++_0x403d3b);}(_0x9cc7,0x154));var _0x79cc=function(_0x9d1180,_0x2f71fb){_0x9d1180=_0x9d1180-0x0;var _0x155274=_0x9cc7[_0x9d1180];return _0x155274;};'use strict';var _=require(_0x79cc('0x0'));var util=require(_0x79cc('0x1'));var logger=require(_0x79cc('0x2'))('api');var moment=require(_0x79cc('0x3'));var BPromise=require('bluebird');var rp=require(_0x79cc('0x4'));var fs=require('fs');var path=require(_0x79cc('0x5'));var rimraf=require(_0x79cc('0x6'));var config=require('../../config/environment');var attributes=require(_0x79cc('0x7'));module['exports']=function(_0x20378f,_0x4075df){return _0x20378f[_0x79cc('0x8')](_0x79cc('0x9'),attributes,{'tableName':_0x79cc('0xa'),'paranoid':![],'indexes':[{'name':'salesforce_unique_index','fields':[_0x79cc('0xb'),_0x79cc('0xc')],'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 2dd17fa..f876624 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 _0x9529=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','request\x20sent','debug','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','SalesforceField,\x20%s,\x20%s','message','info','result','lodash'];(function(_0x16484a,_0x173578){var _0x4dfcbb=function(_0x304f15){while(--_0x304f15){_0x16484a['push'](_0x16484a['shift']());}};_0x4dfcbb(++_0x173578);}(_0x9529,0x1a1));var _0x9952=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9529[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x9952('0x0'));var util=require(_0x9952('0x1'));var moment=require('moment');var BPromise=require(_0x9952('0x2'));var rs=require(_0x9952('0x3'));var fs=require('fs');var Redis=require(_0x9952('0x4'));var db=require(_0x9952('0x5'))['db'];var utils=require(_0x9952('0x6'));var logger=require('../../config/logger')(_0x9952('0x7'));var config=require(_0x9952('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9952('0x9')][_0x9952('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4a8df2,_0x21683c,_0x579769){return new BPromise(function(_0x23e3bf,_0x2de58a){return client[_0x9952('0xb')](_0x4a8df2,_0x579769)[_0x9952('0xc')](function(_0x54f3b1){logger['info']('SalesforceField,\x20%s,\x20%s',_0x21683c,_0x9952('0xd'));logger[_0x9952('0xe')](_0x9952('0xf'),_0x21683c,_0x9952('0xd'),JSON[_0x9952('0x10')](_0x54f3b1));if(_0x54f3b1[_0x9952('0x11')]){if(_0x54f3b1['error']['code']===0x1f4){logger[_0x9952('0x11')](_0x9952('0x12'),_0x21683c,_0x54f3b1[_0x9952('0x11')][_0x9952('0x13')]);return _0x2de58a(_0x54f3b1[_0x9952('0x11')]['message']);}logger[_0x9952('0x11')]('SalesforceField,\x20%s,\x20%s',_0x21683c,_0x54f3b1[_0x9952('0x11')][_0x9952('0x13')]);return _0x23e3bf(_0x54f3b1[_0x9952('0x11')][_0x9952('0x13')]);}else{logger[_0x9952('0x14')](_0x9952('0x12'),_0x21683c,'request\x20sent');_0x23e3bf(_0x54f3b1[_0x9952('0x15')][_0x9952('0x13')]);}})['catch'](function(_0x30ae1e){logger[_0x9952('0x11')](_0x9952('0x12'),_0x21683c,_0x30ae1e);_0x2de58a(_0x30ae1e);});});} \ No newline at end of file +var _0x318a=['message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SalesforceField,\x20%s,\x20%s','request\x20sent','SalesforceField,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x318a,0x172));var _0xa318=function(_0x2e6c65,_0x503e58){_0x2e6c65=_0x2e6c65-0x0;var _0xb93089=_0x318a[_0x2e6c65];return _0xb93089;};'use strict';var _=require(_0xa318('0x0'));var util=require(_0xa318('0x1'));var moment=require(_0xa318('0x2'));var BPromise=require('bluebird');var rs=require(_0xa318('0x3'));var fs=require('fs');var Redis=require(_0xa318('0x4'));var db=require(_0xa318('0x5'))['db'];var utils=require(_0xa318('0x6'));var logger=require('../../config/logger')(_0xa318('0x7'));var config=require(_0xa318('0x8'));var jayson=require(_0xa318('0x9'));var client=jayson[_0xa318('0xa')][_0xa318('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8a22ea,_0x1964b1,_0x158705){return new BPromise(function(_0x26adf1,_0x51fb43){return client[_0xa318('0xc')](_0x8a22ea,_0x158705)[_0xa318('0xd')](function(_0x10db07){logger[_0xa318('0xe')](_0xa318('0xf'),_0x1964b1,_0xa318('0x10'));logger['debug'](_0xa318('0x11'),_0x1964b1,'request\x20sent',JSON[_0xa318('0x12')](_0x10db07));if(_0x10db07[_0xa318('0x13')]){if(_0x10db07['error'][_0xa318('0x14')]===0x1f4){logger[_0xa318('0x13')]('SalesforceField,\x20%s,\x20%s',_0x1964b1,_0x10db07['error']['message']);return _0x51fb43(_0x10db07[_0xa318('0x13')][_0xa318('0x15')]);}logger[_0xa318('0x13')]('SalesforceField,\x20%s,\x20%s',_0x1964b1,_0x10db07[_0xa318('0x13')]['message']);return _0x26adf1(_0x10db07[_0xa318('0x13')]['message']);}else{logger[_0xa318('0xe')](_0xa318('0xf'),_0x1964b1,_0xa318('0x10'));_0x26adf1(_0x10db07['result'][_0xa318('0x15')]);}})[_0xa318('0x16')](function(_0x13405c){logger[_0xa318('0x13')](_0xa318('0xf'),_0x1964b1,_0x13405c);_0x51fb43(_0x13405c);});});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/index.js b/server/api/intServicenowAccount/index.js index b19a060..64bc9bc 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 _0x11cd=['/:id/fields','getFields','post','create','put','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./intServicenowAccount.controller','get','index','/:id','isAuthenticated','show','/:id/configurations'];(function(_0x3630ec,_0xa6a3e8){var _0xb99e98=function(_0x36c7a4){while(--_0x36c7a4){_0x3630ec['push'](_0x3630ec['shift']());}};_0xb99e98(++_0xa6a3e8);}(_0x11cd,0x194));var _0xd11c=function(_0x327ac3,_0x68db51){_0x327ac3=_0x327ac3-0x0;var _0x598cd1=_0x11cd[_0x327ac3];return _0x598cd1;};'use strict';var multer=require('multer');var util=require(_0xd11c('0x0'));var path=require('path');var timeout=require(_0xd11c('0x1'));var express=require(_0xd11c('0x2'));var router=express[_0xd11c('0x3')]();var fs_extra=require(_0xd11c('0x4'));var auth=require(_0xd11c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xd11c('0x6'));var controller=require(_0xd11c('0x7'));router[_0xd11c('0x8')]('/',auth['isAuthenticated'](),controller[_0xd11c('0x9')]);router['get'](_0xd11c('0xa'),auth[_0xd11c('0xb')](),controller[_0xd11c('0xc')]);router[_0xd11c('0x8')](_0xd11c('0xd'),auth[_0xd11c('0xb')](),controller['getConfigurations']);router[_0xd11c('0x8')](_0xd11c('0xe'),auth[_0xd11c('0xb')](),controller[_0xd11c('0xf')]);router[_0xd11c('0x10')]('/',auth['isAuthenticated'](),controller[_0xd11c('0x11')]);router[_0xd11c('0x10')](_0xd11c('0xd'),auth[_0xd11c('0xb')](),controller['addConfiguration']);router[_0xd11c('0x12')](_0xd11c('0xa'),auth[_0xd11c('0xb')](),controller['update']);router[_0xd11c('0x13')](_0xd11c('0xa'),auth['isAuthenticated'](),controller[_0xd11c('0x14')]);module[_0xd11c('0x15')]=router; \ No newline at end of file +var _0x9265=['destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intServicenowAccount.controller','isAuthenticated','index','get','show','/:id/configurations','getConfigurations','/:id/fields','getFields','post','create','put','/:id','update','delete'];(function(_0x6090f2,_0x90b872){var _0x2618d2=function(_0x3c4aa3){while(--_0x3c4aa3){_0x6090f2['push'](_0x6090f2['shift']());}};_0x2618d2(++_0x90b872);}(_0x9265,0x1dd));var _0x5926=function(_0x13550c,_0x10d2a0){_0x13550c=_0x13550c-0x0;var _0x515e9a=_0x9265[_0x13550c];return _0x515e9a;};'use strict';var multer=require(_0x5926('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x5926('0x1'));var express=require(_0x5926('0x2'));var router=express[_0x5926('0x3')]();var fs_extra=require(_0x5926('0x4'));var auth=require(_0x5926('0x5'));var interaction=require(_0x5926('0x6'));var config=require(_0x5926('0x7'));var controller=require(_0x5926('0x8'));router['get']('/',auth[_0x5926('0x9')](),controller[_0x5926('0xa')]);router[_0x5926('0xb')]('/:id',auth[_0x5926('0x9')](),controller[_0x5926('0xc')]);router[_0x5926('0xb')](_0x5926('0xd'),auth[_0x5926('0x9')](),controller[_0x5926('0xe')]);router[_0x5926('0xb')](_0x5926('0xf'),auth[_0x5926('0x9')](),controller[_0x5926('0x10')]);router[_0x5926('0x11')]('/',auth['isAuthenticated'](),controller[_0x5926('0x12')]);router['post'](_0x5926('0xd'),auth[_0x5926('0x9')](),controller['addConfiguration']);router[_0x5926('0x13')](_0x5926('0x14'),auth[_0x5926('0x9')](),controller[_0x5926('0x15')]);router[_0x5926('0x16')](_0x5926('0x14'),auth[_0x5926('0x9')](),controller[_0x5926('0x17')]);module[_0x5926('0x18')]=router; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.attributes.js b/server/api/intServicenowAccount/intServicenowAccount.attributes.js index a4f581d..3954437 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 _0x77c2=['STRING','username','remoteUri','sequelize','exports'];(function(_0x514f2f,_0x1d8186){var _0x23db30=function(_0x2eef91){while(--_0x2eef91){_0x514f2f['push'](_0x514f2f['shift']());}};_0x23db30(++_0x1d8186);}(_0x77c2,0x134));var _0x277c=function(_0x5f0f7a,_0x244c53){_0x5f0f7a=_0x5f0f7a-0x0;var _0x8742e7=_0x77c2[_0x5f0f7a];return _0x8742e7;};'use strict';var Sequelize=require(_0x277c('0x0'));module[_0x277c('0x1')]={'name':{'type':Sequelize[_0x277c('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize[_0x277c('0x2')],'unique':_0x277c('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize[_0x277c('0x2')]},'remoteUri':{'type':Sequelize[_0x277c('0x2')],'unique':_0x277c('0x4')},'serverUrl':{'type':Sequelize[_0x277c('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x2c64=['username','remoteUri','sequelize','exports','STRING'];(function(_0x9c8b4a,_0x2387ff){var _0x198bef=function(_0x2eb4e8){while(--_0x2eb4e8){_0x9c8b4a['push'](_0x9c8b4a['shift']());}};_0x198bef(++_0x2387ff);}(_0x2c64,0x18d));var _0x42c6=function(_0xbeb808,_0x881ddf){_0xbeb808=_0xbeb808-0x0;var _0x5d6909=_0x2c64[_0xbeb808];return _0x5d6909;};'use strict';var Sequelize=require(_0x42c6('0x0'));module[_0x42c6('0x1')]={'name':{'type':Sequelize[_0x42c6('0x2')]},'description':{'type':Sequelize[_0x42c6('0x2')]},'username':{'type':Sequelize[_0x42c6('0x2')],'unique':_0x42c6('0x3')},'password':{'type':Sequelize['STRING']},'email':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x42c6('0x2')],'unique':_0x42c6('0x4')},'serverUrl':{'type':Sequelize[_0x42c6('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 60a299e..cf44f02 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 _0x4f26=['zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','end','json','offset','undefined','count','status','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','send','index','map','ServicenowAccount','type','key','query','keys','filters','attributes','intersection','model','fields','length','hasOwnProperty','limit','sort','where','pick','merge','VIRTUAL','includeAll','include','rows','catch','params','rawAttributes','options','find','create','body','getConfigurations','findOne','ServicenowConfiguration','filter','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','ServicenowField','made_sla','hold_reason','close_code','notify','incident_state','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','approval_history','number','resolved_by','sys_updated_by','opened_by','user_input','sys_created_on','sys_domain','state','sys_created_by','knowledge','calendar_stc','closed_at','cmdb_ci','work_notes_list','business_service','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','group_list','work_end','reopened_time','caller_id','approval_set','subcategory','short_description','correlation_display','delivery_task','assignment_group','business_stc','additional_assignee_list','description','calendar_duration','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','problem_id','company','reassignment_count','assigned_to','severity','sla_due','approval','due_date','reopen_count','escalation','upon_approval','location','category','username','password','email','remoteUri','slice','substring','lastIndexOf','%s/api/now/doc/table/schema/','format','%s/api/now/table/','GET','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','all','TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom','push','concat','test','statusCode','Wrong\x20credentials','True','False','forEach','inactive','false','value','eml-format','rimraf'];(function(_0x32f06b,_0x4d607d){var _0x2a6586=function(_0x294465){while(--_0x294465){_0x32f06b['push'](_0x32f06b['shift']());}};_0x2a6586(++_0x4d607d);}(_0x4f26,0x174));var _0x64f2=function(_0x4c6c02,_0x41af70){_0x4c6c02=_0x4c6c02-0x0;var _0x345d47=_0x4f26[_0x4c6c02];return _0x345d47;};'use strict';var emlformat=require(_0x64f2('0x0'));var rimraf=require(_0x64f2('0x1'));var zipdir=require(_0x64f2('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x64f2('0x3'));var BPromise=require(_0x64f2('0x4'));var Mustache=require(_0x64f2('0x5'));var util=require(_0x64f2('0x6'));var path=require(_0x64f2('0x7'));var sox=require(_0x64f2('0x8'));var csv=require(_0x64f2('0x9'));var ejs=require(_0x64f2('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x64f2('0xb'));var squel=require(_0x64f2('0xc'));var crypto=require(_0x64f2('0xd'));var jsforce=require(_0x64f2('0xe'));var deskjs=require(_0x64f2('0xf'));var toCsv=require(_0x64f2('0x9'));var querystring=require(_0x64f2('0x10'));var Papa=require('papaparse');var Redis=require(_0x64f2('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x64f2('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x64f2('0x13'));var logger=require(_0x64f2('0x14'))(_0x64f2('0x15'));var utils=require('../../config/utils');var config=require(_0x64f2('0x16'));var licenseUtil=require(_0x64f2('0x17'));var db=require(_0x64f2('0x18'))['db'];var integrations=require(_0x64f2('0x19'));function respondWithStatusCode(_0x51bb38,_0xe7964a){_0xe7964a=_0xe7964a||0xcc;return function(_0x3332cf){if(_0x3332cf){return _0x51bb38['sendStatus'](_0xe7964a);}return _0x51bb38['status'](_0xe7964a)[_0x64f2('0x1a')]();};}function respondWithResult(_0x11c08f,_0x187fc2){_0x187fc2=_0x187fc2||0xc8;return function(_0x4ce9dc){if(_0x4ce9dc){return _0x11c08f['status'](_0x187fc2)[_0x64f2('0x1b')](_0x4ce9dc);}};}function respondWithFilteredResult(_0x48face,_0x1c202a){return function(_0x514531){if(_0x514531){var _0x104867=typeof _0x1c202a[_0x64f2('0x1c')]==='undefined'&&typeof _0x1c202a['limit']===_0x64f2('0x1d');var _0x43dbe6=_0x514531[_0x64f2('0x1e')];var _0x15eb1a=_0x104867?0x0:_0x1c202a[_0x64f2('0x1c')];var _0x10613e=_0x104867?_0x514531['count']:_0x1c202a[_0x64f2('0x1c')]+_0x1c202a['limit'];var _0xbde0f2;if(_0x10613e>=_0x43dbe6){_0x10613e=_0x43dbe6;_0xbde0f2=0xc8;}else{_0xbde0f2=0xce;}_0x48face[_0x64f2('0x1f')](_0xbde0f2);return _0x48face[_0x64f2('0x20')](_0x64f2('0x21'),_0x15eb1a+'-'+_0x10613e+'/'+_0x43dbe6)[_0x64f2('0x1b')](_0x514531);}return null;};}function patchUpdates(_0x401bce){return function(_0x2cbd46){try{jsonpatch['apply'](_0x2cbd46,_0x401bce,!![]);}catch(_0x4dc483){return BPromise[_0x64f2('0x22')](_0x4dc483);}return _0x2cbd46[_0x64f2('0x23')]();};}function saveUpdates(_0x332287,_0x4e01da){return function(_0x1472f1){if(_0x1472f1){return _0x1472f1[_0x64f2('0x24')](_0x332287)[_0x64f2('0x25')](function(_0x31ac41){return _0x31ac41;});}return null;};}function removeEntity(_0x181101,_0x237c4f){return function(_0x3a4c46){if(_0x3a4c46){return _0x3a4c46[_0x64f2('0x26')]()[_0x64f2('0x25')](function(){_0x181101[_0x64f2('0x1f')](0xcc)[_0x64f2('0x1a')]();});}};}function handleEntityNotFound(_0x29f5cf,_0x19ee75){return function(_0x5d7be6){if(!_0x5d7be6){_0x29f5cf[_0x64f2('0x27')](0x194);}return _0x5d7be6;};}function handleError(_0x404e96,_0x44636e){_0x44636e=_0x44636e||0x1f4;return function(_0x2b5b50){logger[_0x64f2('0x28')](_0x2b5b50[_0x64f2('0x29')]);if(_0x2b5b50[_0x64f2('0x2a')]){delete _0x2b5b50['name'];}_0x404e96[_0x64f2('0x1f')](_0x44636e)[_0x64f2('0x2b')](_0x2b5b50);};}exports[_0x64f2('0x2c')]=function(_0x3773b5,_0x5b63fc){var _0x135379={},_0x193b44={},_0x1cca59={'count':0x0,'rows':[]};var _0x9336f8=_[_0x64f2('0x2d')](db[_0x64f2('0x2e')]['rawAttributes'],function(_0x29c20b){return{'name':_0x29c20b['fieldName'],'type':_0x29c20b[_0x64f2('0x2f')][_0x64f2('0x30')]};});_0x193b44['model']=_[_0x64f2('0x2d')](_0x9336f8,'name');_0x193b44[_0x64f2('0x31')]=_[_0x64f2('0x32')](_0x3773b5['query']);_0x193b44[_0x64f2('0x33')]=_['intersection'](_0x193b44['model'],_0x193b44[_0x64f2('0x31')]);_0x135379[_0x64f2('0x34')]=_[_0x64f2('0x35')](_0x193b44[_0x64f2('0x36')],qs[_0x64f2('0x37')](_0x3773b5[_0x64f2('0x31')][_0x64f2('0x37')]));_0x135379['attributes']=_0x135379['attributes'][_0x64f2('0x38')]?_0x135379[_0x64f2('0x34')]:_0x193b44['model'];if(!_0x3773b5[_0x64f2('0x31')][_0x64f2('0x39')]('nolimit')){_0x135379[_0x64f2('0x3a')]=qs[_0x64f2('0x3a')](_0x3773b5[_0x64f2('0x31')][_0x64f2('0x3a')]);_0x135379[_0x64f2('0x1c')]=qs[_0x64f2('0x1c')](_0x3773b5[_0x64f2('0x31')][_0x64f2('0x1c')]);}_0x135379['order']=qs[_0x64f2('0x3b')](_0x3773b5['query'][_0x64f2('0x3b')]);_0x135379[_0x64f2('0x3c')]=qs[_0x64f2('0x33')](_[_0x64f2('0x3d')](_0x3773b5[_0x64f2('0x31')],_0x193b44[_0x64f2('0x33')]),_0x9336f8);if(_0x3773b5[_0x64f2('0x31')]['filter']){_0x135379[_0x64f2('0x3c')]=_[_0x64f2('0x3e')](_0x135379[_0x64f2('0x3c')],{'$or':_[_0x64f2('0x2d')](_0x9336f8,function(_0x289bcb){if(_0x289bcb[_0x64f2('0x2f')]!==_0x64f2('0x3f')){var _0x2124a7={};_0x2124a7[_0x289bcb[_0x64f2('0x2a')]]={'$like':'%'+_0x3773b5[_0x64f2('0x31')]['filter']+'%'};return _0x2124a7;}})});}_0x135379=_['merge']({},_0x135379,_0x3773b5['options']);var _0x2cafd5={'where':_0x135379['where']};return db[_0x64f2('0x2e')][_0x64f2('0x1e')](_0x2cafd5)[_0x64f2('0x25')](function(_0x17ff2d){_0x1cca59[_0x64f2('0x1e')]=_0x17ff2d;if(_0x3773b5['query'][_0x64f2('0x40')]){_0x135379[_0x64f2('0x41')]=[{'all':!![]}];}return db['ServicenowAccount']['findAll'](_0x135379);})['then'](function(_0x58225e){_0x1cca59[_0x64f2('0x42')]=_0x58225e;return _0x1cca59;})[_0x64f2('0x25')](respondWithFilteredResult(_0x5b63fc,_0x135379))[_0x64f2('0x43')](handleError(_0x5b63fc,null));};exports['show']=function(_0x370099,_0x53f0cb){var _0x4eaea2={'raw':![],'where':{'id':_0x370099[_0x64f2('0x44')]['id']}},_0x44798f={};_0x44798f['model']=_[_0x64f2('0x32')](db[_0x64f2('0x2e')][_0x64f2('0x45')]);_0x44798f[_0x64f2('0x31')]=_['keys'](_0x370099[_0x64f2('0x31')]);_0x44798f[_0x64f2('0x33')]=_[_0x64f2('0x35')](_0x44798f[_0x64f2('0x36')],_0x44798f[_0x64f2('0x31')]);_0x4eaea2[_0x64f2('0x34')]=_[_0x64f2('0x35')](_0x44798f[_0x64f2('0x36')],qs[_0x64f2('0x37')](_0x370099[_0x64f2('0x31')][_0x64f2('0x37')]));_0x4eaea2[_0x64f2('0x34')]=_0x4eaea2[_0x64f2('0x34')][_0x64f2('0x38')]?_0x4eaea2[_0x64f2('0x34')]:_0x44798f['model'];if(_0x370099[_0x64f2('0x31')][_0x64f2('0x40')]){_0x4eaea2[_0x64f2('0x41')]=[{'all':!![]}];}_0x4eaea2=_[_0x64f2('0x3e')]({},_0x4eaea2,_0x370099[_0x64f2('0x46')]);return db['ServicenowAccount'][_0x64f2('0x47')](_0x4eaea2)[_0x64f2('0x25')](handleEntityNotFound(_0x53f0cb,null))['then'](respondWithResult(_0x53f0cb,null))[_0x64f2('0x43')](handleError(_0x53f0cb,null));};exports['create']=function(_0x1d7369,_0x2379bf){return db['ServicenowAccount'][_0x64f2('0x48')](_0x1d7369[_0x64f2('0x49')],{})[_0x64f2('0x25')](respondWithResult(_0x2379bf,0xc9))[_0x64f2('0x43')](handleError(_0x2379bf,null));};exports[_0x64f2('0x24')]=function(_0x5967ac,_0xda0e5f){if(_0x5967ac[_0x64f2('0x49')]['id']){delete _0x5967ac[_0x64f2('0x49')]['id'];}return db['ServicenowAccount'][_0x64f2('0x47')]({'where':{'id':_0x5967ac[_0x64f2('0x44')]['id']}})[_0x64f2('0x25')](handleEntityNotFound(_0xda0e5f,null))['then'](saveUpdates(_0x5967ac[_0x64f2('0x49')],null))['then'](respondWithResult(_0xda0e5f,null))['catch'](handleError(_0xda0e5f,null));};exports[_0x64f2('0x26')]=function(_0x1e849f,_0x5ef987){return db[_0x64f2('0x2e')][_0x64f2('0x47')]({'where':{'id':_0x1e849f['params']['id']}})['then'](handleEntityNotFound(_0x5ef987,null))[_0x64f2('0x25')](removeEntity(_0x5ef987,null))[_0x64f2('0x43')](handleError(_0x5ef987,null));};exports[_0x64f2('0x4a')]=function(_0x7354b5,_0x1d35bf,_0x53475b){var _0x266897={};var _0x40ee={};var _0x33df3f;var _0x3d6634;return db['ServicenowAccount'][_0x64f2('0x4b')]({'where':{'id':_0x7354b5['params']['id']}})[_0x64f2('0x25')](handleEntityNotFound(_0x1d35bf,null))[_0x64f2('0x25')](function(_0xcdbefa){if(_0xcdbefa){_0x33df3f=_0xcdbefa;_0x40ee[_0x64f2('0x36')]=_[_0x64f2('0x32')](db[_0x64f2('0x4c')][_0x64f2('0x45')]);_0x40ee[_0x64f2('0x31')]=_[_0x64f2('0x32')](_0x7354b5[_0x64f2('0x31')]);_0x40ee['filters']=_[_0x64f2('0x35')](_0x40ee[_0x64f2('0x36')],_0x40ee[_0x64f2('0x31')]);_0x266897[_0x64f2('0x34')]=_['intersection'](_0x40ee[_0x64f2('0x36')],qs['fields'](_0x7354b5[_0x64f2('0x31')][_0x64f2('0x37')]));_0x266897['attributes']=_0x266897[_0x64f2('0x34')][_0x64f2('0x38')]?_0x266897[_0x64f2('0x34')]:_0x40ee[_0x64f2('0x36')];_0x266897['order']=qs[_0x64f2('0x3b')](_0x7354b5['query'][_0x64f2('0x3b')]);_0x266897[_0x64f2('0x3c')]=qs['filters'](_[_0x64f2('0x3d')](_0x7354b5[_0x64f2('0x31')],_0x40ee[_0x64f2('0x33')]));if(_0x7354b5['query']['filter']){_0x266897[_0x64f2('0x3c')]=_[_0x64f2('0x3e')](_0x266897[_0x64f2('0x3c')],{'$or':_['map'](_0x266897[_0x64f2('0x34')],function(_0x173a00){var _0x3eb290={};_0x3eb290[_0x173a00]={'$like':'%'+_0x7354b5['query'][_0x64f2('0x4d')]+'%'};return _0x3eb290;})});}_0x266897=_[_0x64f2('0x3e')]({},_0x266897,_0x7354b5[_0x64f2('0x46')]);return _0x33df3f['getConfigurations'](_0x266897);}})['then'](function(_0x1e37ee){if(_0x1e37ee){_0x3d6634=_0x1e37ee[_0x64f2('0x38')];if(!_0x7354b5[_0x64f2('0x31')][_0x64f2('0x39')](_0x64f2('0x4e'))){_0x266897[_0x64f2('0x3a')]=qs[_0x64f2('0x3a')](_0x7354b5[_0x64f2('0x31')]['limit']);_0x266897[_0x64f2('0x1c')]=qs[_0x64f2('0x1c')](_0x7354b5[_0x64f2('0x31')][_0x64f2('0x1c')]);}return _0x33df3f[_0x64f2('0x4a')](_0x266897);}})[_0x64f2('0x25')](function(_0xa1eb39){if(_0xa1eb39){return _0xa1eb39?{'count':_0x3d6634,'rows':_0xa1eb39}:null;}})['then'](respondWithResult(_0x1d35bf,null))[_0x64f2('0x43')](handleError(_0x1d35bf,null));};exports[_0x64f2('0x4f')]=function(_0x38ae6f,_0x3fd164,_0x3ca742){if(_0x38ae6f[_0x64f2('0x49')]['id']){delete _0x38ae6f[_0x64f2('0x49')]['id'];}return db[_0x64f2('0x2e')][_0x64f2('0x4b')]({'where':{'id':_0x38ae6f[_0x64f2('0x44')]['id']}})[_0x64f2('0x25')](handleEntityNotFound(_0x3fd164,null))[_0x64f2('0x25')](function(_0x5b3f54){if(_0x5b3f54){_0x38ae6f[_0x64f2('0x49')][_0x64f2('0x50')]=_0x5b3f54['id'];_0x38ae6f[_0x64f2('0x49')][_0x64f2('0x51')]=integrations[_0x64f2('0x52')](_0x38ae6f[_0x64f2('0x49')][_0x64f2('0x53')],_0x38ae6f[_0x64f2('0x49')][_0x64f2('0x2f')]);_0x38ae6f['body'][_0x64f2('0x54')]=integrations[_0x64f2('0x55')](_0x38ae6f[_0x64f2('0x49')][_0x64f2('0x53')],_0x38ae6f[_0x64f2('0x49')][_0x64f2('0x2f')]);return db[_0x64f2('0x4c')][_0x64f2('0x48')](_0x38ae6f[_0x64f2('0x49')],{'include':[{'model':db[_0x64f2('0x56')],'as':_0x64f2('0x51')},{'model':db[_0x64f2('0x56')],'as':_0x64f2('0x54')}]});}return null;})[_0x64f2('0x25')](respondWithResult(_0x3fd164,null))[_0x64f2('0x43')](handleError(_0x3fd164,null));};exports['getFields']=function(_0x192093,_0x542e98,_0x4ca171){var _0x39eed5=[_0x64f2('0x57'),_0x64f2('0x58'),'knowledge','subcategory',_0x64f2('0x59'),_0x64f2('0x5a'),_0x64f2('0x5b'),'severity','category'];var _0x5a027f=[_0x64f2('0x5c'),_0x64f2('0x57'),_0x64f2('0x5d'),_0x64f2('0x5e'),_0x64f2('0x5f'),_0x64f2('0x60'),_0x64f2('0x61'),'hold_reason',_0x64f2('0x62'),_0x64f2('0x63'),_0x64f2('0x64'),_0x64f2('0x65'),_0x64f2('0x66'),_0x64f2('0x67'),_0x64f2('0x68'),_0x64f2('0x69'),_0x64f2('0x6a'),_0x64f2('0x6b'),_0x64f2('0x6c'),'order',_0x64f2('0x6d'),_0x64f2('0x6e'),_0x64f2('0x6f'),'delivery_plan','impact','active',_0x64f2('0x70'),_0x64f2('0x71'),_0x64f2('0x72'),_0x64f2('0x73'),_0x64f2('0x74'),_0x64f2('0x75'),_0x64f2('0x76'),_0x64f2('0x77'),_0x64f2('0x78'),_0x64f2('0x79'),_0x64f2('0x7a'),_0x64f2('0x7b'),'resolved_at',_0x64f2('0x7c'),_0x64f2('0x7d'),_0x64f2('0x7e'),'work_notes',_0x64f2('0x7f'),'close_code',_0x64f2('0x80'),_0x64f2('0x81'),'work_start',_0x64f2('0x82'),_0x64f2('0x83'),_0x64f2('0x84'),_0x64f2('0x85'),_0x64f2('0x86'),_0x64f2('0x5a'),_0x64f2('0x87'),_0x64f2('0x88'),_0x64f2('0x89'),_0x64f2('0x8a'),_0x64f2('0x8b'),_0x64f2('0x8c'),_0x64f2('0x8d'),'reopened_by',_0x64f2('0x5b'),'urgency',_0x64f2('0x8e'),_0x64f2('0x8f'),_0x64f2('0x90'),'activity_due',_0x64f2('0x91'),_0x64f2('0x92'),'comments',_0x64f2('0x93'),_0x64f2('0x94'),'comments_and_work_notes',_0x64f2('0x95'),'sys_mod_count',_0x64f2('0x96'),'sys_tags',_0x64f2('0x97'),_0x64f2('0x98'),'correlation_id',_0x64f2('0x99'),_0x64f2('0x9a')];var _0x32ddc8='';var _0x450d18='';var _0xa7f5b1=[];var _0xd94d4a='';var _0x168ab2='';var _0x58712e=[];var _0x6c5dd5='';var _0x5da51c='';var _0x44b57f={};var _0x27d03f='';return db['ServicenowAccount'][_0x64f2('0x4b')]({'where':{'id':_0x192093[_0x64f2('0x44')]['id']},'attributes':['id',_0x64f2('0x9b'),_0x64f2('0x9c'),_0x64f2('0x9d'),'remoteUri','serverUrl']})[_0x64f2('0x25')](handleEntityNotFound(_0x542e98,null))['then'](function(_0x2ec5d5){if(_0x2ec5d5){_0x27d03f=_0x2ec5d5[_0x64f2('0x9e')];var _0x457399=_0x27d03f[_0x64f2('0x9f')](-0x1);if(_0x457399==='/'){_0x27d03f=_0x27d03f[_0x64f2('0xa0')](0x0,_0x27d03f[_0x64f2('0xa1')](_0x457399));}_0x5da51c=util['format'](_0x64f2('0xa2'),_0x27d03f);_0x6c5dd5=util[_0x64f2('0xa3')](_0x64f2('0xa4'),_0x27d03f);_0x44b57f={'user':_0x2ec5d5[_0x64f2('0x9b')],'pass':_0x2ec5d5[_0x64f2('0x9c')]};var _0x3f0075={'method':_0x64f2('0xa5'),'uri':_0x5da51c+'incident?sysparm_display_value=all','auth':_0x44b57f,'json':!![]};return rp(_0x3f0075);}})['then'](function(_0x371478){if(_0x371478[_0x64f2('0xa6')][_0x64f2('0x38')]>0x0){_0x32ddc8=_0x371478['result'];}console[_0x64f2('0xa7')](_0x64f2('0xa8'),_0x32ddc8);_0x58712e=[];_0x450d18=Object[_0x64f2('0xa9')]([],_0x32ddc8);_[_0x64f2('0xaa')](_0x450d18,function(_0x3b7733){return!_0x39eed5[_0x64f2('0xab')](_0x3b7733[_0x64f2('0x2a')]);});_0x450d18['forEach'](function(_0x45479e){var _0x39f473=createFieldObject(_0x6c5dd5,_0x44b57f,_0x45479e[_0x64f2('0xac')],_0x45479e['name'],_0x45479e[_0x64f2('0xad')],![]);_0x58712e['push'](_0x39f473);});return Promise[_0x64f2('0xae')](_0x58712e);})[_0x64f2('0x25')](function(_0x6c5af4){_0xa7f5b1=_0x6c5af4;_0xd94d4a=Object[_0x64f2('0xa9')]([],_0x32ddc8);console[_0x64f2('0xa7')]('TCL:\x20_object',_0x32ddc8);_['remove'](_0xd94d4a,function(_0x5ad150){return _0x5a027f[_0x64f2('0xab')](_0x5ad150[_0x64f2('0x2a')]);});console[_0x64f2('0xa7')](_0x64f2('0xaf'),_0xd94d4a);_0x58712e=[];_0xd94d4a['forEach'](function(_0x58e18c){var _0x536e92=createFieldObject(_0x6c5dd5,_0x44b57f,_0x58e18c[_0x64f2('0xac')],_0x58e18c[_0x64f2('0x2a')],_0x58e18c['label'],!![]);_0x58712e[_0x64f2('0xb0')](_0x536e92);});return Promise[_0x64f2('0xae')](_0x58712e);})[_0x64f2('0x25')](function(_0x1356a1){_0x168ab2=_0x1356a1;var _0x10bb57=_0xa7f5b1[_0x64f2('0xb1')](_0x168ab2);return{'count':_0x10bb57['length'],'rows':_0x10bb57};})[_0x64f2('0x25')](respondWithResult(_0x542e98,null))[_0x64f2('0x43')](function(_0x583871){console['log']('ServiceNow\x20error:\x20'+_0x583871);var _0x1aa543=_0x192093[_0x64f2('0x31')][_0x64f2('0xb2')]?0x1f4:_0x583871[_0x64f2('0xb3')]||0x1f4;logger[_0x64f2('0x28')](_0x583871['stack']);delete _0x583871[_0x64f2('0x2a')];if(_0x1aa543===0x191){_0x1aa543=0x190;}_0x542e98[_0x64f2('0x1f')](_0x1aa543)[_0x64f2('0x2b')](_0x192093['query'][_0x64f2('0xb2')]?{'message':_0x64f2('0xb4'),'statusCode':_0x583871[_0x64f2('0xb3')]}:_0x583871);});};function createFieldObject(_0x387db3,_0x3405a4,_0x2d443c,_0x2b59a3,_0x11fa05,_0x3cb685){return new Promise(function(_0x502a50,_0x4adaf9){var _0x5f508c={'id':_0x2b59a3,'name':_0x11fa05,'custom':_0x3cb685};if(_0x2d443c==='boolean'){_0x5f508c[_0x64f2('0x46')]=[{'name':_0x64f2('0xb5'),'value':'true'},{'name':_0x64f2('0xb6'),'value':'false'}];_0x502a50(_0x5f508c);}else{var _0xc11a2b={'method':_0x64f2('0xa5'),'uri':_0x387db3+'sys_choice?sysparm_query=name=incident^element='+_0x2b59a3,'auth':_0x3405a4,'json':!![]};return rp(_0xc11a2b)[_0x64f2('0x25')](function(_0x32aea6){var _0x230cfe=[];if(_0x32aea6[_0x64f2('0xa6')][_0x64f2('0x38')]>0x0){_0x32aea6[_0x64f2('0xa6')][_0x64f2('0xb7')](function(_0x1faf1d){if(_0x1faf1d[_0x64f2('0xb8')]===_0x64f2('0xb9')){var _0x395e1f={'name':_0x1faf1d[_0x64f2('0xad')],'value':_0x1faf1d[_0x64f2('0xba')]};_0x230cfe[_0x64f2('0xb0')](_0x395e1f);}});}_0x5f508c[_0x64f2('0x46')]=_0x230cfe;if(_0x5f508c['options']['length']>0x0){_0x502a50(_0x5f508c);}else{if(_0x3cb685==![]){_0x502a50();}else{_0x502a50(_0x5f508c);}}});}});} \ No newline at end of file +var _0x9f40=['sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','catch','show','params','keys','fields','create','body','find','findOne','ServicenowConfiguration','pick','getConfigurations','addConfiguration','AccountId','Descriptions','getDescriptions','channel','ServicenowField','Subjects','getFields','made_sla','hold_reason','knowledge','subcategory','close_code','notify','incident_state','severity','category','parent','caused_by','watch_list','upon_reject','sys_updated_on','child_incidents','resolved_by','sys_updated_by','sys_created_on','state','closed_at','cmdb_ci','delivery_plan','impact','active','work_notes_list','priority','sys_domain_path','rfc','time_worked','expected_start','opened_at','business_duration','reopened_time','resolved_at','caller_id','approval_set','short_description','delivery_task','assignment_group','additional_assignee_list','description','sys_class_name','close_notes','closed_by','follow_up','parent_incident','sys_id','contact_type','urgency','problem_id','company','reassignment_count','activity_due','comments','sla_due','approval','comments_and_work_notes','due_date','sys_mod_count','reopen_count','escalation','correlation_id','location','username','password','serverUrl','slice','substring','lastIndexOf','format','%s/api/now/doc/table/schema/','%s/api/now/table/','GET','incident?sysparm_display_value=all','result','log','incident\x20table\x20objects','assign','remove','includes','internalType','label','TCL:\x20_object','push','all','concat','ServiceNow\x20error:\x20','test','statusCode','true','False','false','inactive','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','count','limit','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','map','ServicenowAccount','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','length','hasOwnProperty','nolimit','order'];(function(_0x206bd1,_0x45237e){var _0x27df15=function(_0x35b1d2){while(--_0x35b1d2){_0x206bd1['push'](_0x206bd1['shift']());}};_0x27df15(++_0x45237e);}(_0x9f40,0x1e2));var _0x09f4=function(_0x58030d,_0x28ba40){_0x58030d=_0x58030d-0x0;var _0x3c9cf=_0x9f40[_0x58030d];return _0x3c9cf;};'use strict';var emlformat=require(_0x09f4('0x0'));var rimraf=require(_0x09f4('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x09f4('0x2'));var rp=require(_0x09f4('0x3'));var moment=require(_0x09f4('0x4'));var BPromise=require(_0x09f4('0x5'));var Mustache=require('mustache');var util=require(_0x09f4('0x6'));var path=require(_0x09f4('0x7'));var sox=require(_0x09f4('0x8'));var csv=require(_0x09f4('0x9'));var ejs=require(_0x09f4('0xa'));var fs=require('fs');var fs_extra=require(_0x09f4('0xb'));var _=require(_0x09f4('0xc'));var squel=require('squel');var crypto=require(_0x09f4('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x09f4('0xe'));var toCsv=require(_0x09f4('0x9'));var querystring=require('querystring');var Papa=require(_0x09f4('0xf'));var Redis=require(_0x09f4('0x10'));var authService=require(_0x09f4('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x09f4('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x09f4('0x13'))('api');var utils=require(_0x09f4('0x14'));var config=require(_0x09f4('0x15'));var licenseUtil=require(_0x09f4('0x16'));var db=require(_0x09f4('0x17'))['db'];var integrations=require(_0x09f4('0x18'));function respondWithStatusCode(_0x43eaf0,_0x77e658){_0x77e658=_0x77e658||0xcc;return function(_0x44bf71){if(_0x44bf71){return _0x43eaf0[_0x09f4('0x19')](_0x77e658);}return _0x43eaf0[_0x09f4('0x1a')](_0x77e658)[_0x09f4('0x1b')]();};}function respondWithResult(_0x21129c,_0x2e0dc1){_0x2e0dc1=_0x2e0dc1||0xc8;return function(_0x41c72e){if(_0x41c72e){return _0x21129c[_0x09f4('0x1a')](_0x2e0dc1)['json'](_0x41c72e);}};}function respondWithFilteredResult(_0x176a94,_0x537489){return function(_0xa55b90){if(_0xa55b90){var _0x44daea=typeof _0x537489[_0x09f4('0x1c')]==='undefined'&&typeof _0x537489['limit']===_0x09f4('0x1d');var _0x4990b2=_0xa55b90[_0x09f4('0x1e')];var _0x303dbc=_0x44daea?0x0:_0x537489['offset'];var _0xde3717=_0x44daea?_0xa55b90[_0x09f4('0x1e')]:_0x537489[_0x09f4('0x1c')]+_0x537489[_0x09f4('0x1f')];var _0x577bed;if(_0xde3717>=_0x4990b2){_0xde3717=_0x4990b2;_0x577bed=0xc8;}else{_0x577bed=0xce;}_0x176a94['status'](_0x577bed);return _0x176a94[_0x09f4('0x20')](_0x09f4('0x21'),_0x303dbc+'-'+_0xde3717+'/'+_0x4990b2)[_0x09f4('0x22')](_0xa55b90);}return null;};}function patchUpdates(_0x268c4b){return function(_0x20f503){try{jsonpatch[_0x09f4('0x23')](_0x20f503,_0x268c4b,!![]);}catch(_0x151126){return BPromise['reject'](_0x151126);}return _0x20f503['save']();};}function saveUpdates(_0x21b3b7,_0x3bdba1){return function(_0x4161ca){if(_0x4161ca){return _0x4161ca[_0x09f4('0x24')](_0x21b3b7)[_0x09f4('0x25')](function(_0x51eaf5){return _0x51eaf5;});}return null;};}function removeEntity(_0x495419,_0xca3ef9){return function(_0x565a6d){if(_0x565a6d){return _0x565a6d[_0x09f4('0x26')]()['then'](function(){_0x495419[_0x09f4('0x1a')](0xcc)[_0x09f4('0x1b')]();});}};}function handleEntityNotFound(_0x136af9,_0xbbe2d){return function(_0x4d4b03){if(!_0x4d4b03){_0x136af9[_0x09f4('0x19')](0x194);}return _0x4d4b03;};}function handleError(_0x53c3b2,_0x27f98e){_0x27f98e=_0x27f98e||0x1f4;return function(_0x1e1a7c){logger[_0x09f4('0x27')](_0x1e1a7c[_0x09f4('0x28')]);if(_0x1e1a7c[_0x09f4('0x29')]){delete _0x1e1a7c['name'];}_0x53c3b2[_0x09f4('0x1a')](_0x27f98e)[_0x09f4('0x2a')](_0x1e1a7c);};}exports['index']=function(_0x623a97,_0x2453a9){var _0xbcbdb4={},_0x5a1d97={},_0xc47926={'count':0x0,'rows':[]};var _0x3bdf76=_[_0x09f4('0x2b')](db[_0x09f4('0x2c')][_0x09f4('0x2d')],function(_0x115947){return{'name':_0x115947[_0x09f4('0x2e')],'type':_0x115947[_0x09f4('0x2f')][_0x09f4('0x30')]};});_0x5a1d97['model']=_['map'](_0x3bdf76,_0x09f4('0x29'));_0x5a1d97[_0x09f4('0x31')]=_['keys'](_0x623a97[_0x09f4('0x31')]);_0x5a1d97[_0x09f4('0x32')]=_[_0x09f4('0x33')](_0x5a1d97[_0x09f4('0x34')],_0x5a1d97[_0x09f4('0x31')]);_0xbcbdb4[_0x09f4('0x35')]=_[_0x09f4('0x33')](_0x5a1d97[_0x09f4('0x34')],qs['fields'](_0x623a97['query']['fields']));_0xbcbdb4[_0x09f4('0x35')]=_0xbcbdb4[_0x09f4('0x35')][_0x09f4('0x36')]?_0xbcbdb4[_0x09f4('0x35')]:_0x5a1d97[_0x09f4('0x34')];if(!_0x623a97['query'][_0x09f4('0x37')](_0x09f4('0x38'))){_0xbcbdb4[_0x09f4('0x1f')]=qs[_0x09f4('0x1f')](_0x623a97[_0x09f4('0x31')][_0x09f4('0x1f')]);_0xbcbdb4[_0x09f4('0x1c')]=qs[_0x09f4('0x1c')](_0x623a97[_0x09f4('0x31')][_0x09f4('0x1c')]);}_0xbcbdb4[_0x09f4('0x39')]=qs['sort'](_0x623a97[_0x09f4('0x31')][_0x09f4('0x3a')]);_0xbcbdb4[_0x09f4('0x3b')]=qs[_0x09f4('0x32')](_['pick'](_0x623a97[_0x09f4('0x31')],_0x5a1d97['filters']),_0x3bdf76);if(_0x623a97[_0x09f4('0x31')]['filter']){_0xbcbdb4[_0x09f4('0x3b')]=_[_0x09f4('0x3c')](_0xbcbdb4[_0x09f4('0x3b')],{'$or':_[_0x09f4('0x2b')](_0x3bdf76,function(_0x1314e8){if(_0x1314e8[_0x09f4('0x2f')]!==_0x09f4('0x3d')){var _0x4a260a={};_0x4a260a[_0x1314e8[_0x09f4('0x29')]]={'$like':'%'+_0x623a97[_0x09f4('0x31')][_0x09f4('0x3e')]+'%'};return _0x4a260a;}})});}_0xbcbdb4=_[_0x09f4('0x3c')]({},_0xbcbdb4,_0x623a97[_0x09f4('0x3f')]);var _0x51416e={'where':_0xbcbdb4[_0x09f4('0x3b')]};return db[_0x09f4('0x2c')][_0x09f4('0x1e')](_0x51416e)[_0x09f4('0x25')](function(_0x495888){_0xc47926[_0x09f4('0x1e')]=_0x495888;if(_0x623a97['query'][_0x09f4('0x40')]){_0xbcbdb4[_0x09f4('0x41')]=[{'all':!![]}];}return db['ServicenowAccount'][_0x09f4('0x42')](_0xbcbdb4);})[_0x09f4('0x25')](function(_0x2f4887){_0xc47926['rows']=_0x2f4887;return _0xc47926;})['then'](respondWithFilteredResult(_0x2453a9,_0xbcbdb4))[_0x09f4('0x43')](handleError(_0x2453a9,null));};exports[_0x09f4('0x44')]=function(_0xfc08db,_0x3a171d){var _0x721462={'raw':![],'where':{'id':_0xfc08db[_0x09f4('0x45')]['id']}},_0x53c445={};_0x53c445[_0x09f4('0x34')]=_[_0x09f4('0x46')](db[_0x09f4('0x2c')]['rawAttributes']);_0x53c445[_0x09f4('0x31')]=_[_0x09f4('0x46')](_0xfc08db[_0x09f4('0x31')]);_0x53c445[_0x09f4('0x32')]=_[_0x09f4('0x33')](_0x53c445[_0x09f4('0x34')],_0x53c445[_0x09f4('0x31')]);_0x721462['attributes']=_[_0x09f4('0x33')](_0x53c445[_0x09f4('0x34')],qs[_0x09f4('0x47')](_0xfc08db['query'][_0x09f4('0x47')]));_0x721462[_0x09f4('0x35')]=_0x721462['attributes'][_0x09f4('0x36')]?_0x721462['attributes']:_0x53c445[_0x09f4('0x34')];if(_0xfc08db[_0x09f4('0x31')]['includeAll']){_0x721462['include']=[{'all':!![]}];}_0x721462=_[_0x09f4('0x3c')]({},_0x721462,_0xfc08db[_0x09f4('0x3f')]);return db[_0x09f4('0x2c')]['find'](_0x721462)[_0x09f4('0x25')](handleEntityNotFound(_0x3a171d,null))[_0x09f4('0x25')](respondWithResult(_0x3a171d,null))[_0x09f4('0x43')](handleError(_0x3a171d,null));};exports['create']=function(_0x5ef650,_0x5d33cc){return db['ServicenowAccount'][_0x09f4('0x48')](_0x5ef650[_0x09f4('0x49')],{})[_0x09f4('0x25')](respondWithResult(_0x5d33cc,0xc9))['catch'](handleError(_0x5d33cc,null));};exports[_0x09f4('0x24')]=function(_0x1e47f0,_0x45959a){if(_0x1e47f0[_0x09f4('0x49')]['id']){delete _0x1e47f0[_0x09f4('0x49')]['id'];}return db[_0x09f4('0x2c')][_0x09f4('0x4a')]({'where':{'id':_0x1e47f0['params']['id']}})[_0x09f4('0x25')](handleEntityNotFound(_0x45959a,null))['then'](saveUpdates(_0x1e47f0['body'],null))[_0x09f4('0x25')](respondWithResult(_0x45959a,null))[_0x09f4('0x43')](handleError(_0x45959a,null));};exports['destroy']=function(_0x3d86dc,_0x117a84){return db['ServicenowAccount'][_0x09f4('0x4a')]({'where':{'id':_0x3d86dc[_0x09f4('0x45')]['id']}})['then'](handleEntityNotFound(_0x117a84,null))['then'](removeEntity(_0x117a84,null))[_0x09f4('0x43')](handleError(_0x117a84,null));};exports['getConfigurations']=function(_0x3ba51c,_0x2b7319,_0x3f4d24){var _0x3d6e39={};var _0x554592={};var _0x4763bf;var _0x4b277f;return db[_0x09f4('0x2c')][_0x09f4('0x4b')]({'where':{'id':_0x3ba51c[_0x09f4('0x45')]['id']}})[_0x09f4('0x25')](handleEntityNotFound(_0x2b7319,null))[_0x09f4('0x25')](function(_0x57eb75){if(_0x57eb75){_0x4763bf=_0x57eb75;_0x554592['model']=_['keys'](db[_0x09f4('0x4c')][_0x09f4('0x2d')]);_0x554592[_0x09f4('0x31')]=_['keys'](_0x3ba51c[_0x09f4('0x31')]);_0x554592[_0x09f4('0x32')]=_['intersection'](_0x554592[_0x09f4('0x34')],_0x554592[_0x09f4('0x31')]);_0x3d6e39['attributes']=_[_0x09f4('0x33')](_0x554592['model'],qs[_0x09f4('0x47')](_0x3ba51c[_0x09f4('0x31')][_0x09f4('0x47')]));_0x3d6e39[_0x09f4('0x35')]=_0x3d6e39[_0x09f4('0x35')]['length']?_0x3d6e39['attributes']:_0x554592[_0x09f4('0x34')];_0x3d6e39['order']=qs[_0x09f4('0x3a')](_0x3ba51c[_0x09f4('0x31')][_0x09f4('0x3a')]);_0x3d6e39[_0x09f4('0x3b')]=qs[_0x09f4('0x32')](_[_0x09f4('0x4d')](_0x3ba51c[_0x09f4('0x31')],_0x554592[_0x09f4('0x32')]));if(_0x3ba51c[_0x09f4('0x31')][_0x09f4('0x3e')]){_0x3d6e39[_0x09f4('0x3b')]=_[_0x09f4('0x3c')](_0x3d6e39[_0x09f4('0x3b')],{'$or':_[_0x09f4('0x2b')](_0x3d6e39['attributes'],function(_0x52da97){var _0x338d35={};_0x338d35[_0x52da97]={'$like':'%'+_0x3ba51c[_0x09f4('0x31')][_0x09f4('0x3e')]+'%'};return _0x338d35;})});}_0x3d6e39=_[_0x09f4('0x3c')]({},_0x3d6e39,_0x3ba51c['options']);return _0x4763bf[_0x09f4('0x4e')](_0x3d6e39);}})['then'](function(_0x211d80){if(_0x211d80){_0x4b277f=_0x211d80['length'];if(!_0x3ba51c[_0x09f4('0x31')]['hasOwnProperty'](_0x09f4('0x38'))){_0x3d6e39[_0x09f4('0x1f')]=qs['limit'](_0x3ba51c['query'][_0x09f4('0x1f')]);_0x3d6e39[_0x09f4('0x1c')]=qs[_0x09f4('0x1c')](_0x3ba51c[_0x09f4('0x31')][_0x09f4('0x1c')]);}return _0x4763bf['getConfigurations'](_0x3d6e39);}})[_0x09f4('0x25')](function(_0x5b10e5){if(_0x5b10e5){return _0x5b10e5?{'count':_0x4b277f,'rows':_0x5b10e5}:null;}})[_0x09f4('0x25')](respondWithResult(_0x2b7319,null))['catch'](handleError(_0x2b7319,null));};exports[_0x09f4('0x4f')]=function(_0x2ed251,_0x2b77a7,_0x16343a){if(_0x2ed251['body']['id']){delete _0x2ed251[_0x09f4('0x49')]['id'];}return db['ServicenowAccount'][_0x09f4('0x4b')]({'where':{'id':_0x2ed251[_0x09f4('0x45')]['id']}})[_0x09f4('0x25')](handleEntityNotFound(_0x2b77a7,null))[_0x09f4('0x25')](function(_0x4e1628){if(_0x4e1628){_0x2ed251[_0x09f4('0x49')][_0x09f4('0x50')]=_0x4e1628['id'];_0x2ed251[_0x09f4('0x49')]['Subjects']=integrations['getSubjects'](_0x2ed251[_0x09f4('0x49')]['channel'],_0x2ed251['body'][_0x09f4('0x2f')]);_0x2ed251[_0x09f4('0x49')][_0x09f4('0x51')]=integrations[_0x09f4('0x52')](_0x2ed251[_0x09f4('0x49')][_0x09f4('0x53')],_0x2ed251[_0x09f4('0x49')]['type']);return db[_0x09f4('0x4c')][_0x09f4('0x48')](_0x2ed251[_0x09f4('0x49')],{'include':[{'model':db[_0x09f4('0x54')],'as':_0x09f4('0x55')},{'model':db[_0x09f4('0x54')],'as':_0x09f4('0x51')}]});}return null;})[_0x09f4('0x25')](respondWithResult(_0x2b77a7,null))[_0x09f4('0x43')](handleError(_0x2b77a7,null));};exports[_0x09f4('0x56')]=function(_0x5bd02f,_0x31d71a,_0x2b9c54){var _0x211c35=[_0x09f4('0x57'),_0x09f4('0x58'),_0x09f4('0x59'),_0x09f4('0x5a'),_0x09f4('0x5b'),_0x09f4('0x5c'),_0x09f4('0x5d'),_0x09f4('0x5e'),_0x09f4('0x5f')];var _0x402e6b=[_0x09f4('0x60'),_0x09f4('0x57'),_0x09f4('0x61'),_0x09f4('0x62'),_0x09f4('0x63'),_0x09f4('0x64'),_0x09f4('0x65'),_0x09f4('0x58'),'approval_history','number',_0x09f4('0x66'),_0x09f4('0x67'),'opened_by','user_input',_0x09f4('0x68'),'sys_domain',_0x09f4('0x69'),'sys_created_by',_0x09f4('0x59'),_0x09f4('0x39'),'calendar_stc',_0x09f4('0x6a'),_0x09f4('0x6b'),_0x09f4('0x6c'),_0x09f4('0x6d'),_0x09f4('0x6e'),_0x09f4('0x6f'),'business_service',_0x09f4('0x70'),_0x09f4('0x71'),_0x09f4('0x72'),_0x09f4('0x73'),_0x09f4('0x74'),_0x09f4('0x75'),_0x09f4('0x76'),'group_list','work_end',_0x09f4('0x77'),_0x09f4('0x78'),_0x09f4('0x79'),_0x09f4('0x7a'),'subcategory','work_notes',_0x09f4('0x7b'),_0x09f4('0x5b'),'correlation_display',_0x09f4('0x7c'),'work_start',_0x09f4('0x7d'),'business_stc',_0x09f4('0x7e'),_0x09f4('0x7f'),'calendar_duration','notify',_0x09f4('0x80'),_0x09f4('0x81'),_0x09f4('0x82'),_0x09f4('0x83'),_0x09f4('0x84'),_0x09f4('0x85'),_0x09f4('0x86'),'reopened_by',_0x09f4('0x5d'),_0x09f4('0x87'),_0x09f4('0x88'),_0x09f4('0x89'),_0x09f4('0x8a'),_0x09f4('0x8b'),'assigned_to',_0x09f4('0x5e'),_0x09f4('0x8c'),_0x09f4('0x8d'),_0x09f4('0x8e'),_0x09f4('0x8f'),_0x09f4('0x90'),_0x09f4('0x91'),_0x09f4('0x92'),'sys_tags',_0x09f4('0x93'),'upon_approval',_0x09f4('0x94'),_0x09f4('0x95'),_0x09f4('0x5f')];var _0x2f74d2='';var _0x3b47cd='';var _0x575016=[];var _0x4184ca='';var _0x21c60f='';var _0x187836=[];var _0x354b08='';var _0x400550='';var _0x15d6c6={};var _0x310a17='';return db['ServicenowAccount'][_0x09f4('0x4b')]({'where':{'id':_0x5bd02f[_0x09f4('0x45')]['id']},'attributes':['id',_0x09f4('0x96'),_0x09f4('0x97'),'email','remoteUri',_0x09f4('0x98')]})[_0x09f4('0x25')](handleEntityNotFound(_0x31d71a,null))[_0x09f4('0x25')](function(_0x578443){if(_0x578443){_0x310a17=_0x578443['remoteUri'];var _0x88eb3f=_0x310a17[_0x09f4('0x99')](-0x1);if(_0x88eb3f==='/'){_0x310a17=_0x310a17[_0x09f4('0x9a')](0x0,_0x310a17[_0x09f4('0x9b')](_0x88eb3f));}_0x400550=util[_0x09f4('0x9c')](_0x09f4('0x9d'),_0x310a17);_0x354b08=util['format'](_0x09f4('0x9e'),_0x310a17);_0x15d6c6={'user':_0x578443[_0x09f4('0x96')],'pass':_0x578443[_0x09f4('0x97')]};var _0x3a3b47={'method':_0x09f4('0x9f'),'uri':_0x400550+_0x09f4('0xa0'),'auth':_0x15d6c6,'json':!![]};return rp(_0x3a3b47);}})['then'](function(_0x271dfd){if(_0x271dfd[_0x09f4('0xa1')][_0x09f4('0x36')]>0x0){_0x2f74d2=_0x271dfd[_0x09f4('0xa1')];}console[_0x09f4('0xa2')](_0x09f4('0xa3'),_0x2f74d2);_0x187836=[];_0x3b47cd=Object[_0x09f4('0xa4')]([],_0x2f74d2);_[_0x09f4('0xa5')](_0x3b47cd,function(_0x5ce61b){return!_0x211c35[_0x09f4('0xa6')](_0x5ce61b['name']);});_0x3b47cd['forEach'](function(_0xeb0fdd){var _0x56914e=createFieldObject(_0x354b08,_0x15d6c6,_0xeb0fdd[_0x09f4('0xa7')],_0xeb0fdd[_0x09f4('0x29')],_0xeb0fdd[_0x09f4('0xa8')],![]);_0x187836['push'](_0x56914e);});return Promise['all'](_0x187836);})[_0x09f4('0x25')](function(_0x24ec47){_0x575016=_0x24ec47;_0x4184ca=Object['assign']([],_0x2f74d2);console['log'](_0x09f4('0xa9'),_0x2f74d2);_[_0x09f4('0xa5')](_0x4184ca,function(_0x456538){return _0x402e6b['includes'](_0x456538[_0x09f4('0x29')]);});console[_0x09f4('0xa2')]('TCL:\x20exports.getEntityFields\x20->\x20_objectsCustom',_0x4184ca);_0x187836=[];_0x4184ca['forEach'](function(_0x46929a){var _0x371d18=createFieldObject(_0x354b08,_0x15d6c6,_0x46929a[_0x09f4('0xa7')],_0x46929a['name'],_0x46929a[_0x09f4('0xa8')],!![]);_0x187836[_0x09f4('0xaa')](_0x371d18);});return Promise[_0x09f4('0xab')](_0x187836);})[_0x09f4('0x25')](function(_0x398b44){_0x21c60f=_0x398b44;var _0x4f722e=_0x575016[_0x09f4('0xac')](_0x21c60f);return{'count':_0x4f722e[_0x09f4('0x36')],'rows':_0x4f722e};})[_0x09f4('0x25')](respondWithResult(_0x31d71a,null))[_0x09f4('0x43')](function(_0x354162){console['log'](_0x09f4('0xad')+_0x354162);var _0x11f778=_0x5bd02f['query'][_0x09f4('0xae')]?0x1f4:_0x354162[_0x09f4('0xaf')]||0x1f4;logger[_0x09f4('0x27')](_0x354162[_0x09f4('0x28')]);delete _0x354162[_0x09f4('0x29')];if(_0x11f778===0x191){_0x11f778=0x190;}_0x31d71a[_0x09f4('0x1a')](_0x11f778)[_0x09f4('0x2a')](_0x5bd02f['query'][_0x09f4('0xae')]?{'message':'Wrong\x20credentials','statusCode':_0x354162[_0x09f4('0xaf')]}:_0x354162);});};function createFieldObject(_0xa2e02c,_0x390743,_0x4b2c82,_0x161f3b,_0x316082,_0x5a2e8d){return new Promise(function(_0x26d51e,_0x1038d0){var _0x109cb2={'id':_0x161f3b,'name':_0x316082,'custom':_0x5a2e8d};if(_0x4b2c82==='boolean'){_0x109cb2[_0x09f4('0x3f')]=[{'name':'True','value':_0x09f4('0xb0')},{'name':_0x09f4('0xb1'),'value':_0x09f4('0xb2')}];_0x26d51e(_0x109cb2);}else{var _0xfeaabc={'method':_0x09f4('0x9f'),'uri':_0xa2e02c+'sys_choice?sysparm_query=name=incident^element='+_0x161f3b,'auth':_0x390743,'json':!![]};return rp(_0xfeaabc)[_0x09f4('0x25')](function(_0x2cdc42){var _0x38a2cc=[];if(_0x2cdc42[_0x09f4('0xa1')][_0x09f4('0x36')]>0x0){_0x2cdc42[_0x09f4('0xa1')]['forEach'](function(_0x23e614){if(_0x23e614[_0x09f4('0xb3')]===_0x09f4('0xb2')){var _0x32b136={'name':_0x23e614[_0x09f4('0xa8')],'value':_0x23e614['value']};_0x38a2cc[_0x09f4('0xaa')](_0x32b136);}});}_0x109cb2[_0x09f4('0x3f')]=_0x38a2cc;if(_0x109cb2['options'][_0x09f4('0x36')]>0x0){_0x26d51e(_0x109cb2);}else{if(_0x5a2e8d==![]){_0x26d51e();}else{_0x26d51e(_0x109cb2);}}});}});} \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.model.js b/server/api/intServicenowAccount/intServicenowAccount.model.js index ccbe39e..3b27ade 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 _0xeda8=['path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','ServicenowAccount','int_servicenow_accounts','lodash','util','api','moment','bluebird','request-promise'];(function(_0x30d782,_0x9a6d45){var _0x5753f5=function(_0x597a3c){while(--_0x597a3c){_0x30d782['push'](_0x30d782['shift']());}};_0x5753f5(++_0x9a6d45);}(_0xeda8,0x104));var _0x8eda=function(_0x319e2e,_0x4c227c){_0x319e2e=_0x319e2e-0x0;var _0x16d169=_0xeda8[_0x319e2e];return _0x16d169;};'use strict';var _=require(_0x8eda('0x0'));var util=require(_0x8eda('0x1'));var logger=require('../../config/logger')(_0x8eda('0x2'));var moment=require(_0x8eda('0x3'));var BPromise=require(_0x8eda('0x4'));var rp=require(_0x8eda('0x5'));var fs=require('fs');var path=require(_0x8eda('0x6'));var rimraf=require(_0x8eda('0x7'));var config=require(_0x8eda('0x8'));var attributes=require(_0x8eda('0x9'));var integrations=require(_0x8eda('0xa'));module[_0x8eda('0xb')]=function(_0x349361,_0x32abe8){return _0x349361['define'](_0x8eda('0xc'),attributes,{'tableName':_0x8eda('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7fbe=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowAccount.attributes','../../components/integrations/configuration','exports','define','int_servicenow_accounts','../../config/logger','api'];(function(_0x1e1020,_0xd64a27){var _0x464719=function(_0x376ffa){while(--_0x376ffa){_0x1e1020['push'](_0x1e1020['shift']());}};_0x464719(++_0xd64a27);}(_0x7fbe,0x1ec));var _0xe7fb=function(_0x25806f,_0x16dbdd){_0x25806f=_0x25806f-0x0;var _0x163f12=_0x7fbe[_0x25806f];return _0x163f12;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xe7fb('0x0'))(_0xe7fb('0x1'));var moment=require(_0xe7fb('0x2'));var BPromise=require(_0xe7fb('0x3'));var rp=require(_0xe7fb('0x4'));var fs=require('fs');var path=require(_0xe7fb('0x5'));var rimraf=require(_0xe7fb('0x6'));var config=require(_0xe7fb('0x7'));var attributes=require(_0xe7fb('0x8'));var integrations=require(_0xe7fb('0x9'));module[_0xe7fb('0xa')]=function(_0x12d1b0,_0x24cd67){return _0x12d1b0[_0xe7fb('0xb')]('ServicenowAccount',attributes,{'tableName':_0xe7fb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intServicenowAccount/intServicenowAccount.rpc.js b/server/api/intServicenowAccount/intServicenowAccount.rpc.js index f58be19..b1a64ff 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 _0x25fa=['raw','where','include','map','attributes','model','stringify','ServicenowAccount','find','ShowServicenowAccount','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','error','code','ServicenowAccount,\x20%s,\x20%s','message','catch','GetServicenowAccount','findAll','options'];(function(_0x10d08b,_0x264fcd){var _0x3c64b3=function(_0xa320c1){while(--_0xa320c1){_0x10d08b['push'](_0x10d08b['shift']());}};_0x3c64b3(++_0x264fcd);}(_0x25fa,0x180));var _0xa25f=function(_0x389bc0,_0x2da36f){_0x389bc0=_0x389bc0-0x0;var _0x38b214=_0x25fa[_0x389bc0];return _0x38b214;};'use strict';var _=require('lodash');var util=require(_0xa25f('0x0'));var moment=require(_0xa25f('0x1'));var BPromise=require(_0xa25f('0x2'));var rs=require(_0xa25f('0x3'));var fs=require('fs');var Redis=require(_0xa25f('0x4'));var db=require(_0xa25f('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa25f('0x6'));var config=require(_0xa25f('0x7'));var jayson=require(_0xa25f('0x8'));var client=jayson[_0xa25f('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x39d5b3,_0x4e6730,_0x2c25a1){return new BPromise(function(_0x4e5390,_0x1470ef){return client[_0xa25f('0xa')](_0x39d5b3,_0x2c25a1)[_0xa25f('0xb')](function(_0x1b04d3){logger[_0xa25f('0xc')]('ServicenowAccount,\x20%s,\x20%s',_0x4e6730,_0xa25f('0xd'));logger[_0xa25f('0xe')](_0xa25f('0xf'),_0x4e6730,_0xa25f('0xd'),JSON['stringify'](_0x1b04d3));if(_0x1b04d3['error']){if(_0x1b04d3[_0xa25f('0x10')][_0xa25f('0x11')]===0x1f4){logger[_0xa25f('0x10')](_0xa25f('0x12'),_0x4e6730,_0x1b04d3[_0xa25f('0x10')][_0xa25f('0x13')]);return _0x1470ef(_0x1b04d3[_0xa25f('0x10')][_0xa25f('0x13')]);}logger[_0xa25f('0x10')](_0xa25f('0x12'),_0x4e6730,_0x1b04d3[_0xa25f('0x10')][_0xa25f('0x13')]);return _0x4e5390(_0x1b04d3['error'][_0xa25f('0x13')]);}else{logger['info'](_0xa25f('0x12'),_0x4e6730,_0xa25f('0xd'));_0x4e5390(_0x1b04d3['result'][_0xa25f('0x13')]);}})[_0xa25f('0x14')](function(_0x4919be){logger[_0xa25f('0x10')](_0xa25f('0x12'),_0x4e6730,_0x4919be);_0x1470ef(_0x4919be);});});}exports[_0xa25f('0x15')]=function(_0x3b8c83){var _0x10e77f=this;return new Promise(function(_0x307036,_0xb3e104){return db['ServicenowAccount'][_0xa25f('0x16')]({'raw':_0x3b8c83[_0xa25f('0x17')]?_0x3b8c83[_0xa25f('0x17')][_0xa25f('0x18')]===undefined?!![]:![]:!![],'where':_0x3b8c83[_0xa25f('0x17')]?_0x3b8c83[_0xa25f('0x17')][_0xa25f('0x19')]||null:null,'attributes':_0x3b8c83['options']?_0x3b8c83[_0xa25f('0x17')]['attributes']||null:null,'limit':_0x3b8c83[_0xa25f('0x17')]?_0x3b8c83['options']['limit']||null:null,'include':_0x3b8c83[_0xa25f('0x17')]?_0x3b8c83[_0xa25f('0x17')][_0xa25f('0x1a')]?_[_0xa25f('0x1b')](_0x3b8c83['options'][_0xa25f('0x1a')],function(_0x5410a8){return{'model':db[_0x5410a8['model']],'as':_0x5410a8['as'],'attributes':_0x5410a8[_0xa25f('0x1c')],'include':_0x5410a8[_0xa25f('0x1a')]?_['map'](_0x5410a8['include'],function(_0x33d8a9){return{'model':db[_0x33d8a9[_0xa25f('0x1d')]],'as':_0x33d8a9['as'],'attributes':_0x33d8a9[_0xa25f('0x1c')],'include':_0x33d8a9[_0xa25f('0x1a')]?_[_0xa25f('0x1b')](_0x33d8a9[_0xa25f('0x1a')],function(_0x4a57e8){return{'model':db[_0x4a57e8[_0xa25f('0x1d')]],'as':_0x4a57e8['as'],'attributes':_0x4a57e8[_0xa25f('0x1c')]};}):[]};}):[]};}):[]:[]})[_0xa25f('0xb')](function(_0x1b343e){logger[_0xa25f('0xc')](_0xa25f('0x15'),_0x3b8c83);logger[_0xa25f('0xe')](_0xa25f('0x15'),_0x3b8c83,JSON[_0xa25f('0x1e')](_0x1b343e));_0x307036(_0x1b343e);})['catch'](function(_0x5554a8){logger['error'](_0xa25f('0x15'),_0x5554a8[_0xa25f('0x13')],_0x3b8c83);_0xb3e104(_0x10e77f[_0xa25f('0x10')](0x1f4,_0x5554a8[_0xa25f('0x13')]));});});};exports['ShowServicenowAccount']=function(_0x94b48b){var _0x3d2a32=this;return new Promise(function(_0x86d4e2,_0x19f62a){return db[_0xa25f('0x1f')][_0xa25f('0x20')]({'raw':_0x94b48b[_0xa25f('0x17')]?_0x94b48b['options'][_0xa25f('0x18')]===undefined?!![]:![]:!![],'where':_0x94b48b[_0xa25f('0x17')]?_0x94b48b[_0xa25f('0x17')][_0xa25f('0x19')]||null:null,'attributes':_0x94b48b[_0xa25f('0x17')]?_0x94b48b['options']['attributes']||null:null,'include':_0x94b48b[_0xa25f('0x17')]?_0x94b48b[_0xa25f('0x17')][_0xa25f('0x1a')]?_[_0xa25f('0x1b')](_0x94b48b[_0xa25f('0x17')][_0xa25f('0x1a')],function(_0x484ddf){return{'model':db[_0x484ddf[_0xa25f('0x1d')]],'as':_0x484ddf['as'],'attributes':_0x484ddf[_0xa25f('0x1c')],'include':_0x484ddf[_0xa25f('0x1a')]?_[_0xa25f('0x1b')](_0x484ddf[_0xa25f('0x1a')],function(_0x4f817b){return{'model':db[_0x4f817b[_0xa25f('0x1d')]],'as':_0x4f817b['as'],'attributes':_0x4f817b[_0xa25f('0x1c')],'include':_0x4f817b[_0xa25f('0x1a')]?_[_0xa25f('0x1b')](_0x4f817b['include'],function(_0x1eb74c){return{'model':db[_0x1eb74c[_0xa25f('0x1d')]],'as':_0x1eb74c['as'],'attributes':_0x1eb74c[_0xa25f('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x5029e8){logger[_0xa25f('0xc')]('ShowServicenowAccount',_0x94b48b);logger[_0xa25f('0xe')]('ShowServicenowAccount',_0x94b48b,JSON['stringify'](_0x5029e8));_0x86d4e2(_0x5029e8);})['catch'](function(_0x75808c){logger[_0xa25f('0x10')](_0xa25f('0x21'),_0x75808c['message'],_0x94b48b);_0x19f62a(_0x3d2a32[_0xa25f('0x10')](0x1f4,_0x75808c[_0xa25f('0x13')]));});});}; \ No newline at end of file +var _0x7208=['request\x20sent','debug','ServicenowAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetServicenowAccount','ServicenowAccount','findAll','options','raw','attributes','limit','map','include','model','ShowServicenowAccount','where','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','ServicenowAccount,\x20%s,\x20%s'];(function(_0x695dec,_0x4dc661){var _0x6b1ac2=function(_0x4a6193){while(--_0x4a6193){_0x695dec['push'](_0x695dec['shift']());}};_0x6b1ac2(++_0x4dc661);}(_0x7208,0x1f0));var _0x8720=function(_0x3003f8,_0x2710c8){_0x3003f8=_0x3003f8-0x0;var _0x1d9bba=_0x7208[_0x3003f8];return _0x1d9bba;};'use strict';var _=require(_0x8720('0x0'));var util=require('util');var moment=require(_0x8720('0x1'));var BPromise=require(_0x8720('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8720('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8720('0x4'));var logger=require(_0x8720('0x5'))(_0x8720('0x6'));var config=require(_0x8720('0x7'));var jayson=require(_0x8720('0x8'));var client=jayson[_0x8720('0x9')][_0x8720('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5a4551,_0x32dcbc,_0x13d7a8){return new BPromise(function(_0x53355e,_0x23ce4a){return client['request'](_0x5a4551,_0x13d7a8)[_0x8720('0xb')](function(_0x3aacb2){logger[_0x8720('0xc')](_0x8720('0xd'),_0x32dcbc,_0x8720('0xe'));logger[_0x8720('0xf')](_0x8720('0x10'),_0x32dcbc,'request\x20sent',JSON[_0x8720('0x11')](_0x3aacb2));if(_0x3aacb2[_0x8720('0x12')]){if(_0x3aacb2[_0x8720('0x12')][_0x8720('0x13')]===0x1f4){logger[_0x8720('0x12')](_0x8720('0xd'),_0x32dcbc,_0x3aacb2[_0x8720('0x12')][_0x8720('0x14')]);return _0x23ce4a(_0x3aacb2[_0x8720('0x12')][_0x8720('0x14')]);}logger[_0x8720('0x12')](_0x8720('0xd'),_0x32dcbc,_0x3aacb2[_0x8720('0x12')][_0x8720('0x14')]);return _0x53355e(_0x3aacb2[_0x8720('0x12')]['message']);}else{logger[_0x8720('0xc')](_0x8720('0xd'),_0x32dcbc,'request\x20sent');_0x53355e(_0x3aacb2['result'][_0x8720('0x14')]);}})[_0x8720('0x15')](function(_0x2a04ac){logger[_0x8720('0x12')](_0x8720('0xd'),_0x32dcbc,_0x2a04ac);_0x23ce4a(_0x2a04ac);});});}exports[_0x8720('0x16')]=function(_0x4ad3b8){var _0x5c3867=this;return new Promise(function(_0x49c592,_0xa94281){return db[_0x8720('0x17')][_0x8720('0x18')]({'raw':_0x4ad3b8['options']?_0x4ad3b8[_0x8720('0x19')][_0x8720('0x1a')]===undefined?!![]:![]:!![],'where':_0x4ad3b8[_0x8720('0x19')]?_0x4ad3b8['options']['where']||null:null,'attributes':_0x4ad3b8[_0x8720('0x19')]?_0x4ad3b8['options'][_0x8720('0x1b')]||null:null,'limit':_0x4ad3b8[_0x8720('0x19')]?_0x4ad3b8[_0x8720('0x19')][_0x8720('0x1c')]||null:null,'include':_0x4ad3b8[_0x8720('0x19')]?_0x4ad3b8[_0x8720('0x19')]['include']?_[_0x8720('0x1d')](_0x4ad3b8['options'][_0x8720('0x1e')],function(_0x3651ce){return{'model':db[_0x3651ce[_0x8720('0x1f')]],'as':_0x3651ce['as'],'attributes':_0x3651ce['attributes'],'include':_0x3651ce[_0x8720('0x1e')]?_['map'](_0x3651ce['include'],function(_0x49a765){return{'model':db[_0x49a765[_0x8720('0x1f')]],'as':_0x49a765['as'],'attributes':_0x49a765[_0x8720('0x1b')],'include':_0x49a765[_0x8720('0x1e')]?_[_0x8720('0x1d')](_0x49a765[_0x8720('0x1e')],function(_0x5a6c54){return{'model':db[_0x5a6c54[_0x8720('0x1f')]],'as':_0x5a6c54['as'],'attributes':_0x5a6c54[_0x8720('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8720('0xb')](function(_0x387977){logger[_0x8720('0xc')](_0x8720('0x16'),_0x4ad3b8);logger[_0x8720('0xf')](_0x8720('0x16'),_0x4ad3b8,JSON[_0x8720('0x11')](_0x387977));_0x49c592(_0x387977);})[_0x8720('0x15')](function(_0x281e51){logger['error']('GetServicenowAccount',_0x281e51[_0x8720('0x14')],_0x4ad3b8);_0xa94281(_0x5c3867[_0x8720('0x12')](0x1f4,_0x281e51[_0x8720('0x14')]));});});};exports[_0x8720('0x20')]=function(_0x383b21){var _0x108072=this;return new Promise(function(_0x166c11,_0x157bf4){return db[_0x8720('0x17')]['find']({'raw':_0x383b21['options']?_0x383b21['options']['raw']===undefined?!![]:![]:!![],'where':_0x383b21[_0x8720('0x19')]?_0x383b21['options'][_0x8720('0x21')]||null:null,'attributes':_0x383b21[_0x8720('0x19')]?_0x383b21[_0x8720('0x19')][_0x8720('0x1b')]||null:null,'include':_0x383b21[_0x8720('0x19')]?_0x383b21[_0x8720('0x19')][_0x8720('0x1e')]?_[_0x8720('0x1d')](_0x383b21['options'][_0x8720('0x1e')],function(_0xaa708){return{'model':db[_0xaa708[_0x8720('0x1f')]],'as':_0xaa708['as'],'attributes':_0xaa708['attributes'],'include':_0xaa708[_0x8720('0x1e')]?_[_0x8720('0x1d')](_0xaa708[_0x8720('0x1e')],function(_0x2a3bc0){return{'model':db[_0x2a3bc0[_0x8720('0x1f')]],'as':_0x2a3bc0['as'],'attributes':_0x2a3bc0[_0x8720('0x1b')],'include':_0x2a3bc0[_0x8720('0x1e')]?_[_0x8720('0x1d')](_0x2a3bc0[_0x8720('0x1e')],function(_0x3437ec){return{'model':db[_0x3437ec[_0x8720('0x1f')]],'as':_0x3437ec['as'],'attributes':_0x3437ec[_0x8720('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b1a23){logger[_0x8720('0xc')](_0x8720('0x20'),_0x383b21);logger[_0x8720('0xf')](_0x8720('0x20'),_0x383b21,JSON[_0x8720('0x11')](_0x4b1a23));_0x166c11(_0x4b1a23);})[_0x8720('0x15')](function(_0x2788b4){logger[_0x8720('0x12')](_0x8720('0x20'),_0x2788b4[_0x8720('0x14')],_0x383b21);_0x157bf4(_0x108072['error'](0x1f4,_0x2788b4[_0x8720('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/index.js b/server/api/intServicenowConfiguration/index.js index d90216f..185fbd3 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 _0x3ce5=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowConfiguration.controller','index','get','isAuthenticated','show','/:id/fields','getFields','getDescriptions','post','create','put','/:id','update','delete','destroy','connect-timeout'];(function(_0x5ad794,_0x330eb1){var _0x58d45e=function(_0x28c899){while(--_0x28c899){_0x5ad794['push'](_0x5ad794['shift']());}};_0x58d45e(++_0x330eb1);}(_0x3ce5,0xa7));var _0x53ce=function(_0x568c2e,_0x2d3680){_0x568c2e=_0x568c2e-0x0;var _0x58dc9c=_0x3ce5[_0x568c2e];return _0x58dc9c;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x53ce('0x0'));var express=require(_0x53ce('0x1'));var router=express[_0x53ce('0x2')]();var fs_extra=require(_0x53ce('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x53ce('0x4'));var config=require(_0x53ce('0x5'));var controller=require(_0x53ce('0x6'));router['get']('/',auth['isAuthenticated'](),controller[_0x53ce('0x7')]);router[_0x53ce('0x8')]('/:id',auth[_0x53ce('0x9')](),controller[_0x53ce('0xa')]);router[_0x53ce('0x8')](_0x53ce('0xb'),auth[_0x53ce('0x9')](),controller[_0x53ce('0xc')]);router[_0x53ce('0x8')]('/:id/subjects',auth[_0x53ce('0x9')](),controller['getSubjects']);router[_0x53ce('0x8')]('/:id/descriptions',auth[_0x53ce('0x9')](),controller[_0x53ce('0xd')]);router[_0x53ce('0xe')]('/',auth[_0x53ce('0x9')](),controller[_0x53ce('0xf')]);router[_0x53ce('0x10')](_0x53ce('0x11'),auth[_0x53ce('0x9')](),controller[_0x53ce('0x12')]);router[_0x53ce('0x13')](_0x53ce('0x11'),auth[_0x53ce('0x9')](),controller[_0x53ce('0x14')]);module['exports']=router; \ No newline at end of file +var _0x49b1=['../../components/interaction/service','../../config/environment','get','index','/:id','isAuthenticated','show','/:id/fields','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','update','delete','exports','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x209511,_0x231622){var _0x39b937=function(_0x4005a3){while(--_0x4005a3){_0x209511['push'](_0x209511['shift']());}};_0x39b937(++_0x231622);}(_0x49b1,0x69));var _0x149b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x49b1[_0x14add3];return _0x4a174f;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x149b('0x0'));var timeout=require('connect-timeout');var express=require(_0x149b('0x1'));var router=express[_0x149b('0x2')]();var fs_extra=require(_0x149b('0x3'));var auth=require(_0x149b('0x4'));var interaction=require(_0x149b('0x5'));var config=require(_0x149b('0x6'));var controller=require('./intServicenowConfiguration.controller');router[_0x149b('0x7')]('/',auth['isAuthenticated'](),controller[_0x149b('0x8')]);router[_0x149b('0x7')](_0x149b('0x9'),auth[_0x149b('0xa')](),controller[_0x149b('0xb')]);router[_0x149b('0x7')](_0x149b('0xc'),auth['isAuthenticated'](),controller[_0x149b('0xd')]);router['get'](_0x149b('0xe'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x149b('0x7')](_0x149b('0xf'),auth[_0x149b('0xa')](),controller[_0x149b('0x10')]);router[_0x149b('0x11')]('/',auth[_0x149b('0xa')](),controller[_0x149b('0x12')]);router['put'](_0x149b('0x9'),auth[_0x149b('0xa')](),controller[_0x149b('0x13')]);router[_0x149b('0x14')]('/:id',auth[_0x149b('0xa')](),controller['destroy']);module[_0x149b('0x15')]=router; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.attributes.js index e3a2526..e07e716 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 _0x5885=['sequelize','exports','STRING'];(function(_0x24dad8,_0x16c64a){var _0x22a536=function(_0x41e96b){while(--_0x41e96b){_0x24dad8['push'](_0x24dad8['shift']());}};_0x22a536(++_0x16c64a);}(_0x5885,0x111));var _0x5588=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x5885[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x5588('0x0'));module[_0x5588('0x1')]={'name':{'type':Sequelize[_0x5588('0x2')]},'description':{'type':Sequelize[_0x5588('0x2')]}}; \ No newline at end of file +var _0xcb41=['sequelize','exports','STRING'];(function(_0x31bc72,_0x2aef23){var _0x20cb43=function(_0x4666e8){while(--_0x4666e8){_0x31bc72['push'](_0x31bc72['shift']());}};_0x20cb43(++_0x2aef23);}(_0xcb41,0xcf));var _0x1cb4=function(_0x223668,_0x2153d4){_0x223668=_0x223668-0x0;var _0x1eee6f=_0xcb41[_0x223668];return _0x1eee6f;};'use strict';var Sequelize=require(_0x1cb4('0x0'));module[_0x1cb4('0x1')]={'name':{'type':Sequelize[_0x1cb4('0x2')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.controller.js index a2eadcc..9f0a8e1 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 _0xa81b=['create','body','params','findOne','ServicenowField','rawAttributes','filter','getFields','nolimit','getSubjects','getDescriptions','zip-dir','mustache','path','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','update','then','error','stack','name','send','index','ServicenowConfiguration','type','map','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','find'];(function(_0x1c0dfc,_0x14b41d){var _0x306bd=function(_0x2a5a98){while(--_0x2a5a98){_0x1c0dfc['push'](_0x1c0dfc['shift']());}};_0x306bd(++_0x14b41d);}(_0xa81b,0x9b));var _0xba81=function(_0xfe2c60,_0x1866fd){_0xfe2c60=_0xfe2c60-0x0;var _0x1da88e=_0xa81b[_0xfe2c60];return _0x1da88e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xba81('0x0'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xba81('0x1'));var util=require('util');var path=require(_0xba81('0x2'));var sox=require(_0xba81('0x3'));var csv=require(_0xba81('0x4'));var ejs=require(_0xba81('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xba81('0x6'));var squel=require('squel');var crypto=require(_0xba81('0x7'));var jsforce=require(_0xba81('0x8'));var deskjs=require(_0xba81('0x9'));var toCsv=require('to-csv');var querystring=require(_0xba81('0xa'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xba81('0xb'));var as=require(_0xba81('0xc'));var hardwareService=require(_0xba81('0xd'));var logger=require('../../config/logger')(_0xba81('0xe'));var utils=require(_0xba81('0xf'));var config=require(_0xba81('0x10'));var licenseUtil=require(_0xba81('0x11'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43d8ae,_0x27286c){_0x27286c=_0x27286c||0xcc;return function(_0x429a2f){if(_0x429a2f){return _0x43d8ae[_0xba81('0x12')](_0x27286c);}return _0x43d8ae[_0xba81('0x13')](_0x27286c)[_0xba81('0x14')]();};}function respondWithResult(_0x4ec0ca,_0x1ab2da){_0x1ab2da=_0x1ab2da||0xc8;return function(_0x5abf99){if(_0x5abf99){return _0x4ec0ca[_0xba81('0x13')](_0x1ab2da)[_0xba81('0x15')](_0x5abf99);}};}function respondWithFilteredResult(_0x4a2676,_0x3d3e43){return function(_0x129459){if(_0x129459){var _0x4f7060=typeof _0x3d3e43[_0xba81('0x16')]===_0xba81('0x17')&&typeof _0x3d3e43[_0xba81('0x18')]===_0xba81('0x17');var _0x58cd43=_0x129459['count'];var _0x390ed4=_0x4f7060?0x0:_0x3d3e43['offset'];var _0x534e24=_0x4f7060?_0x129459[_0xba81('0x19')]:_0x3d3e43[_0xba81('0x16')]+_0x3d3e43[_0xba81('0x18')];var _0x5731b5;if(_0x534e24>=_0x58cd43){_0x534e24=_0x58cd43;_0x5731b5=0xc8;}else{_0x5731b5=0xce;}_0x4a2676[_0xba81('0x13')](_0x5731b5);return _0x4a2676[_0xba81('0x1a')]('Content-Range',_0x390ed4+'-'+_0x534e24+'/'+_0x58cd43)['json'](_0x129459);}return null;};}function patchUpdates(_0x568479){return function(_0x1ad6f1){try{jsonpatch['apply'](_0x1ad6f1,_0x568479,!![]);}catch(_0x5cb9c8){return BPromise[_0xba81('0x1b')](_0x5cb9c8);}return _0x1ad6f1['save']();};}function saveUpdates(_0x4f9234,_0x33fdf0){return function(_0x2f5216){if(_0x2f5216){return _0x2f5216[_0xba81('0x1c')](_0x4f9234)[_0xba81('0x1d')](function(_0x504fb0){return _0x504fb0;});}return null;};}function removeEntity(_0x2f3f2e,_0x44181c){return function(_0x2e601e){if(_0x2e601e){return _0x2e601e['destroy']()[_0xba81('0x1d')](function(){_0x2f3f2e[_0xba81('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c01af,_0x143ddb){return function(_0x4cca94){if(!_0x4cca94){_0x5c01af[_0xba81('0x12')](0x194);}return _0x4cca94;};}function handleError(_0x4211fa,_0x2375fa){_0x2375fa=_0x2375fa||0x1f4;return function(_0x11238f){logger[_0xba81('0x1e')](_0x11238f[_0xba81('0x1f')]);if(_0x11238f[_0xba81('0x20')]){delete _0x11238f['name'];}_0x4211fa[_0xba81('0x13')](_0x2375fa)[_0xba81('0x21')](_0x11238f);};}exports[_0xba81('0x22')]=function(_0x292de2,_0x12cb17){var _0xaeffb5={},_0x4a7814={},_0x4b5c01={'count':0x0,'rows':[]};var _0x31f7d0=_['map'](db[_0xba81('0x23')]['rawAttributes'],function(_0x593243){return{'name':_0x593243['fieldName'],'type':_0x593243[_0xba81('0x24')]['key']};});_0x4a7814['model']=_[_0xba81('0x25')](_0x31f7d0,'name');_0x4a7814[_0xba81('0x26')]=_[_0xba81('0x27')](_0x292de2[_0xba81('0x26')]);_0x4a7814[_0xba81('0x28')]=_[_0xba81('0x29')](_0x4a7814[_0xba81('0x2a')],_0x4a7814[_0xba81('0x26')]);_0xaeffb5[_0xba81('0x2b')]=_[_0xba81('0x29')](_0x4a7814[_0xba81('0x2a')],qs[_0xba81('0x2c')](_0x292de2[_0xba81('0x26')]['fields']));_0xaeffb5[_0xba81('0x2b')]=_0xaeffb5['attributes'][_0xba81('0x2d')]?_0xaeffb5[_0xba81('0x2b')]:_0x4a7814['model'];if(!_0x292de2['query'][_0xba81('0x2e')]('nolimit')){_0xaeffb5['limit']=qs[_0xba81('0x18')](_0x292de2[_0xba81('0x26')]['limit']);_0xaeffb5[_0xba81('0x16')]=qs[_0xba81('0x16')](_0x292de2[_0xba81('0x26')][_0xba81('0x16')]);}_0xaeffb5[_0xba81('0x2f')]=qs[_0xba81('0x30')](_0x292de2['query'][_0xba81('0x30')]);_0xaeffb5[_0xba81('0x31')]=qs[_0xba81('0x28')](_[_0xba81('0x32')](_0x292de2[_0xba81('0x26')],_0x4a7814[_0xba81('0x28')]),_0x31f7d0);if(_0x292de2[_0xba81('0x26')]['filter']){_0xaeffb5[_0xba81('0x31')]=_[_0xba81('0x33')](_0xaeffb5[_0xba81('0x31')],{'$or':_[_0xba81('0x25')](_0x31f7d0,function(_0x353c5b){if(_0x353c5b[_0xba81('0x24')]!==_0xba81('0x34')){var _0x28a506={};_0x28a506[_0x353c5b[_0xba81('0x20')]]={'$like':'%'+_0x292de2[_0xba81('0x26')]['filter']+'%'};return _0x28a506;}})});}_0xaeffb5=_[_0xba81('0x33')]({},_0xaeffb5,_0x292de2[_0xba81('0x35')]);var _0x10fc9d={'where':_0xaeffb5[_0xba81('0x31')]};return db[_0xba81('0x23')][_0xba81('0x19')](_0x10fc9d)[_0xba81('0x1d')](function(_0x2de885){_0x4b5c01[_0xba81('0x19')]=_0x2de885;if(_0x292de2['query'][_0xba81('0x36')]){_0xaeffb5[_0xba81('0x37')]=[{'all':!![]}];}return db[_0xba81('0x23')][_0xba81('0x38')](_0xaeffb5);})[_0xba81('0x1d')](function(_0x51f9f6){_0x4b5c01[_0xba81('0x39')]=_0x51f9f6;return _0x4b5c01;})['then'](respondWithFilteredResult(_0x12cb17,_0xaeffb5))[_0xba81('0x3a')](handleError(_0x12cb17,null));};exports[_0xba81('0x3b')]=function(_0x2f8943,_0x89f96e){var _0x4938a3={'raw':![],'where':{'id':_0x2f8943['params']['id']}},_0x21b6fe={};_0x21b6fe['model']=_[_0xba81('0x27')](db[_0xba81('0x23')]['rawAttributes']);_0x21b6fe['query']=_[_0xba81('0x27')](_0x2f8943[_0xba81('0x26')]);_0x21b6fe[_0xba81('0x28')]=_[_0xba81('0x29')](_0x21b6fe[_0xba81('0x2a')],_0x21b6fe['query']);_0x4938a3[_0xba81('0x2b')]=_[_0xba81('0x29')](_0x21b6fe['model'],qs[_0xba81('0x2c')](_0x2f8943[_0xba81('0x26')][_0xba81('0x2c')]));_0x4938a3[_0xba81('0x2b')]=_0x4938a3[_0xba81('0x2b')][_0xba81('0x2d')]?_0x4938a3[_0xba81('0x2b')]:_0x21b6fe['model'];if(_0x2f8943[_0xba81('0x26')][_0xba81('0x36')]){_0x4938a3['include']=[{'all':!![]}];}_0x4938a3=_[_0xba81('0x33')]({},_0x4938a3,_0x2f8943['options']);return db[_0xba81('0x23')][_0xba81('0x3c')](_0x4938a3)['then'](handleEntityNotFound(_0x89f96e,null))[_0xba81('0x1d')](respondWithResult(_0x89f96e,null))['catch'](handleError(_0x89f96e,null));};exports[_0xba81('0x3d')]=function(_0x5a146d,_0x82a353){return db['ServicenowConfiguration']['create'](_0x5a146d[_0xba81('0x3e')],{})[_0xba81('0x1d')](respondWithResult(_0x82a353,0xc9))[_0xba81('0x3a')](handleError(_0x82a353,null));};exports[_0xba81('0x1c')]=function(_0x131b44,_0x30adf7){if(_0x131b44[_0xba81('0x3e')]['id']){delete _0x131b44[_0xba81('0x3e')]['id'];}return db[_0xba81('0x23')][_0xba81('0x3c')]({'where':{'id':_0x131b44[_0xba81('0x3f')]['id']}})[_0xba81('0x1d')](handleEntityNotFound(_0x30adf7,null))[_0xba81('0x1d')](saveUpdates(_0x131b44[_0xba81('0x3e')],null))[_0xba81('0x1d')](respondWithResult(_0x30adf7,null))[_0xba81('0x3a')](handleError(_0x30adf7,null));};exports['destroy']=function(_0x4a9e3d,_0x3a8557){return db[_0xba81('0x23')]['find']({'where':{'id':_0x4a9e3d['params']['id']}})[_0xba81('0x1d')](handleEntityNotFound(_0x3a8557,null))[_0xba81('0x1d')](removeEntity(_0x3a8557,null))[_0xba81('0x3a')](handleError(_0x3a8557,null));};exports['getFields']=function(_0x2ff642,_0x4e62e3,_0x120483){var _0x221f0e={};var _0x480dea={};var _0x40f8b1;var _0x2b4d68;return db['ServicenowConfiguration'][_0xba81('0x40')]({'where':{'id':_0x2ff642[_0xba81('0x3f')]['id']}})[_0xba81('0x1d')](handleEntityNotFound(_0x4e62e3,null))[_0xba81('0x1d')](function(_0x483171){if(_0x483171){_0x40f8b1=_0x483171;_0x480dea['model']=_[_0xba81('0x27')](db[_0xba81('0x41')][_0xba81('0x42')]);_0x480dea[_0xba81('0x26')]=_[_0xba81('0x27')](_0x2ff642[_0xba81('0x26')]);_0x480dea['filters']=_[_0xba81('0x29')](_0x480dea['model'],_0x480dea[_0xba81('0x26')]);_0x221f0e['attributes']=_[_0xba81('0x29')](_0x480dea['model'],qs['fields'](_0x2ff642[_0xba81('0x26')][_0xba81('0x2c')]));_0x221f0e[_0xba81('0x2b')]=_0x221f0e['attributes']['length']?_0x221f0e[_0xba81('0x2b')]:_0x480dea[_0xba81('0x2a')];_0x221f0e[_0xba81('0x2f')]=qs[_0xba81('0x30')](_0x2ff642[_0xba81('0x26')]['sort']);_0x221f0e[_0xba81('0x31')]=qs[_0xba81('0x28')](_['pick'](_0x2ff642['query'],_0x480dea[_0xba81('0x28')]));if(_0x2ff642[_0xba81('0x26')][_0xba81('0x43')]){_0x221f0e[_0xba81('0x31')]=_['merge'](_0x221f0e[_0xba81('0x31')],{'$or':_['map'](_0x221f0e['attributes'],function(_0x1475f8){var _0x4a7d73={};_0x4a7d73[_0x1475f8]={'$like':'%'+_0x2ff642[_0xba81('0x26')][_0xba81('0x43')]+'%'};return _0x4a7d73;})});}_0x221f0e=_['merge']({},_0x221f0e,_0x2ff642['options']);return _0x40f8b1[_0xba81('0x44')](_0x221f0e);}})[_0xba81('0x1d')](function(_0x4a487d){if(_0x4a487d){_0x2b4d68=_0x4a487d[_0xba81('0x2d')];if(!_0x2ff642[_0xba81('0x26')]['hasOwnProperty'](_0xba81('0x45'))){_0x221f0e['limit']=qs['limit'](_0x2ff642[_0xba81('0x26')][_0xba81('0x18')]);_0x221f0e[_0xba81('0x16')]=qs[_0xba81('0x16')](_0x2ff642[_0xba81('0x26')][_0xba81('0x16')]);}return _0x40f8b1[_0xba81('0x44')](_0x221f0e);}})[_0xba81('0x1d')](function(_0x33c1d2){if(_0x33c1d2){return _0x33c1d2?{'count':_0x2b4d68,'rows':_0x33c1d2}:null;}})[_0xba81('0x1d')](respondWithResult(_0x4e62e3,null))[_0xba81('0x3a')](handleError(_0x4e62e3,null));};exports[_0xba81('0x46')]=function(_0x5b8866,_0x2256de,_0xa2ba4){var _0x291678={};var _0x5243f0={};var _0x4e94ec;var _0x1f5e1f;return db[_0xba81('0x23')][_0xba81('0x40')]({'where':{'id':_0x5b8866[_0xba81('0x3f')]['id']}})[_0xba81('0x1d')](handleEntityNotFound(_0x2256de,null))[_0xba81('0x1d')](function(_0x162924){if(_0x162924){_0x4e94ec=_0x162924;_0x5243f0[_0xba81('0x2a')]=_[_0xba81('0x27')](db[_0xba81('0x41')][_0xba81('0x42')]);_0x5243f0[_0xba81('0x26')]=_[_0xba81('0x27')](_0x5b8866['query']);_0x5243f0[_0xba81('0x28')]=_[_0xba81('0x29')](_0x5243f0[_0xba81('0x2a')],_0x5243f0['query']);_0x291678['attributes']=_['intersection'](_0x5243f0[_0xba81('0x2a')],qs[_0xba81('0x2c')](_0x5b8866[_0xba81('0x26')][_0xba81('0x2c')]));_0x291678[_0xba81('0x2b')]=_0x291678[_0xba81('0x2b')]['length']?_0x291678[_0xba81('0x2b')]:_0x5243f0[_0xba81('0x2a')];_0x291678[_0xba81('0x2f')]=qs['sort'](_0x5b8866['query'][_0xba81('0x30')]);_0x291678['where']=qs[_0xba81('0x28')](_[_0xba81('0x32')](_0x5b8866['query'],_0x5243f0[_0xba81('0x28')]));if(_0x5b8866[_0xba81('0x26')][_0xba81('0x43')]){_0x291678[_0xba81('0x31')]=_[_0xba81('0x33')](_0x291678['where'],{'$or':_[_0xba81('0x25')](_0x291678['attributes'],function(_0x3f77ed){var _0x2e46b6={};_0x2e46b6[_0x3f77ed]={'$like':'%'+_0x5b8866[_0xba81('0x26')][_0xba81('0x43')]+'%'};return _0x2e46b6;})});}_0x291678=_[_0xba81('0x33')]({},_0x291678,_0x5b8866[_0xba81('0x35')]);return _0x4e94ec[_0xba81('0x46')](_0x291678);}})[_0xba81('0x1d')](function(_0x185904){if(_0x185904){_0x1f5e1f=_0x185904[_0xba81('0x2d')];if(!_0x5b8866[_0xba81('0x26')][_0xba81('0x2e')](_0xba81('0x45'))){_0x291678['limit']=qs[_0xba81('0x18')](_0x5b8866[_0xba81('0x26')][_0xba81('0x18')]);_0x291678[_0xba81('0x16')]=qs[_0xba81('0x16')](_0x5b8866['query'][_0xba81('0x16')]);}return _0x4e94ec[_0xba81('0x46')](_0x291678);}})[_0xba81('0x1d')](function(_0x2f7a41){if(_0x2f7a41){return _0x2f7a41?{'count':_0x1f5e1f,'rows':_0x2f7a41}:null;}})['then'](respondWithResult(_0x2256de,null))[_0xba81('0x3a')](handleError(_0x2256de,null));};exports[_0xba81('0x47')]=function(_0xe8b023,_0x5a823a,_0x398c47){var _0x50bc53={};var _0x1fe108={};var _0x337a69;var _0x5dbd8a;return db[_0xba81('0x23')][_0xba81('0x40')]({'where':{'id':_0xe8b023['params']['id']}})['then'](handleEntityNotFound(_0x5a823a,null))[_0xba81('0x1d')](function(_0x36818a){if(_0x36818a){_0x337a69=_0x36818a;_0x1fe108[_0xba81('0x2a')]=_[_0xba81('0x27')](db['ServicenowField'][_0xba81('0x42')]);_0x1fe108[_0xba81('0x26')]=_['keys'](_0xe8b023[_0xba81('0x26')]);_0x1fe108['filters']=_['intersection'](_0x1fe108[_0xba81('0x2a')],_0x1fe108[_0xba81('0x26')]);_0x50bc53['attributes']=_[_0xba81('0x29')](_0x1fe108['model'],qs[_0xba81('0x2c')](_0xe8b023[_0xba81('0x26')]['fields']));_0x50bc53[_0xba81('0x2b')]=_0x50bc53['attributes'][_0xba81('0x2d')]?_0x50bc53[_0xba81('0x2b')]:_0x1fe108[_0xba81('0x2a')];_0x50bc53['order']=qs[_0xba81('0x30')](_0xe8b023[_0xba81('0x26')][_0xba81('0x30')]);_0x50bc53[_0xba81('0x31')]=qs[_0xba81('0x28')](_[_0xba81('0x32')](_0xe8b023['query'],_0x1fe108['filters']));if(_0xe8b023[_0xba81('0x26')][_0xba81('0x43')]){_0x50bc53[_0xba81('0x31')]=_[_0xba81('0x33')](_0x50bc53[_0xba81('0x31')],{'$or':_[_0xba81('0x25')](_0x50bc53[_0xba81('0x2b')],function(_0x3307d4){var _0x10f42f={};_0x10f42f[_0x3307d4]={'$like':'%'+_0xe8b023[_0xba81('0x26')][_0xba81('0x43')]+'%'};return _0x10f42f;})});}_0x50bc53=_[_0xba81('0x33')]({},_0x50bc53,_0xe8b023[_0xba81('0x35')]);return _0x337a69[_0xba81('0x47')](_0x50bc53);}})[_0xba81('0x1d')](function(_0x190e64){if(_0x190e64){_0x5dbd8a=_0x190e64[_0xba81('0x2d')];if(!_0xe8b023[_0xba81('0x26')][_0xba81('0x2e')]('nolimit')){_0x50bc53[_0xba81('0x18')]=qs[_0xba81('0x18')](_0xe8b023[_0xba81('0x26')][_0xba81('0x18')]);_0x50bc53['offset']=qs[_0xba81('0x16')](_0xe8b023[_0xba81('0x26')][_0xba81('0x16')]);}return _0x337a69[_0xba81('0x47')](_0x50bc53);}})['then'](function(_0x3dd469){if(_0x3dd469){return _0x3dd469?{'count':_0x5dbd8a,'rows':_0x3dd469}:null;}})[_0xba81('0x1d')](respondWithResult(_0x5a823a,null))['catch'](handleError(_0x5a823a,null));}; \ No newline at end of file +var _0x4239=['includeAll','findAll','rows','catch','show','params','intersection','fields','include','create','body','find','getFields','findOne','ServicenowField','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index','map','ServicenowConfiguration','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options'];(function(_0x5dcd8b,_0x3300db){var _0x557ca8=function(_0x594429){while(--_0x594429){_0x5dcd8b['push'](_0x5dcd8b['shift']());}};_0x557ca8(++_0x3300db);}(_0x4239,0x1a6));var _0x9423=function(_0x2bcb75,_0x5789a7){_0x2bcb75=_0x2bcb75-0x0;var _0x175345=_0x4239[_0x2bcb75];return _0x175345;};'use strict';var emlformat=require(_0x9423('0x0'));var rimraf=require(_0x9423('0x1'));var zipdir=require(_0x9423('0x2'));var jsonpatch=require(_0x9423('0x3'));var rp=require(_0x9423('0x4'));var moment=require(_0x9423('0x5'));var BPromise=require(_0x9423('0x6'));var Mustache=require(_0x9423('0x7'));var util=require('util');var path=require('path');var sox=require(_0x9423('0x8'));var csv=require(_0x9423('0x9'));var ejs=require(_0x9423('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9423('0xb'));var squel=require('squel');var crypto=require(_0x9423('0xc'));var jsforce=require(_0x9423('0xd'));var deskjs=require(_0x9423('0xe'));var toCsv=require(_0x9423('0x9'));var querystring=require('querystring');var Papa=require(_0x9423('0xf'));var Redis=require(_0x9423('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x9423('0x11'));var hardwareService=require(_0x9423('0x12'));var logger=require(_0x9423('0x13'))(_0x9423('0x14'));var utils=require(_0x9423('0x15'));var config=require(_0x9423('0x16'));var licenseUtil=require(_0x9423('0x17'));var db=require(_0x9423('0x18'))['db'];function respondWithStatusCode(_0x4427d3,_0x1fbe6c){_0x1fbe6c=_0x1fbe6c||0xcc;return function(_0x184580){if(_0x184580){return _0x4427d3[_0x9423('0x19')](_0x1fbe6c);}return _0x4427d3[_0x9423('0x1a')](_0x1fbe6c)['end']();};}function respondWithResult(_0x50616a,_0x525c87){_0x525c87=_0x525c87||0xc8;return function(_0x224865){if(_0x224865){return _0x50616a['status'](_0x525c87)[_0x9423('0x1b')](_0x224865);}};}function respondWithFilteredResult(_0x1eb960,_0x33a26c){return function(_0x247bea){if(_0x247bea){var _0xbcce75=typeof _0x33a26c[_0x9423('0x1c')]==='undefined'&&typeof _0x33a26c[_0x9423('0x1d')]==='undefined';var _0x4a3ae5=_0x247bea[_0x9423('0x1e')];var _0x14c5ed=_0xbcce75?0x0:_0x33a26c[_0x9423('0x1c')];var _0x25bf5e=_0xbcce75?_0x247bea[_0x9423('0x1e')]:_0x33a26c[_0x9423('0x1c')]+_0x33a26c['limit'];var _0x58a807;if(_0x25bf5e>=_0x4a3ae5){_0x25bf5e=_0x4a3ae5;_0x58a807=0xc8;}else{_0x58a807=0xce;}_0x1eb960[_0x9423('0x1a')](_0x58a807);return _0x1eb960[_0x9423('0x1f')]('Content-Range',_0x14c5ed+'-'+_0x25bf5e+'/'+_0x4a3ae5)[_0x9423('0x1b')](_0x247bea);}return null;};}function patchUpdates(_0x1b68ad){return function(_0x102094){try{jsonpatch[_0x9423('0x20')](_0x102094,_0x1b68ad,!![]);}catch(_0x1ab570){return BPromise[_0x9423('0x21')](_0x1ab570);}return _0x102094[_0x9423('0x22')]();};}function saveUpdates(_0x11364a,_0x220f8f){return function(_0x1cfbef){if(_0x1cfbef){return _0x1cfbef[_0x9423('0x23')](_0x11364a)[_0x9423('0x24')](function(_0x3e8255){return _0x3e8255;});}return null;};}function removeEntity(_0x232ab6,_0x13df65){return function(_0x4427fc){if(_0x4427fc){return _0x4427fc['destroy']()[_0x9423('0x24')](function(){_0x232ab6[_0x9423('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x559cb0,_0x249f91){return function(_0x2584ea){if(!_0x2584ea){_0x559cb0[_0x9423('0x19')](0x194);}return _0x2584ea;};}function handleError(_0x565779,_0x2ae874){_0x2ae874=_0x2ae874||0x1f4;return function(_0x2dd96d){logger[_0x9423('0x25')](_0x2dd96d[_0x9423('0x26')]);if(_0x2dd96d[_0x9423('0x27')]){delete _0x2dd96d['name'];}_0x565779[_0x9423('0x1a')](_0x2ae874)[_0x9423('0x28')](_0x2dd96d);};}exports[_0x9423('0x29')]=function(_0x24f891,_0x53e8af){var _0x153b88={},_0x470e82={},_0xf95049={'count':0x0,'rows':[]};var _0x35dd51=_[_0x9423('0x2a')](db[_0x9423('0x2b')][_0x9423('0x2c')],function(_0xfb99aa){return{'name':_0xfb99aa[_0x9423('0x2d')],'type':_0xfb99aa[_0x9423('0x2e')][_0x9423('0x2f')]};});_0x470e82['model']=_[_0x9423('0x2a')](_0x35dd51,_0x9423('0x27'));_0x470e82[_0x9423('0x30')]=_[_0x9423('0x31')](_0x24f891[_0x9423('0x30')]);_0x470e82[_0x9423('0x32')]=_['intersection'](_0x470e82[_0x9423('0x33')],_0x470e82[_0x9423('0x30')]);_0x153b88[_0x9423('0x34')]=_['intersection'](_0x470e82[_0x9423('0x33')],qs['fields'](_0x24f891[_0x9423('0x30')]['fields']));_0x153b88[_0x9423('0x34')]=_0x153b88[_0x9423('0x34')][_0x9423('0x35')]?_0x153b88[_0x9423('0x34')]:_0x470e82[_0x9423('0x33')];if(!_0x24f891[_0x9423('0x30')][_0x9423('0x36')](_0x9423('0x37'))){_0x153b88[_0x9423('0x1d')]=qs[_0x9423('0x1d')](_0x24f891[_0x9423('0x30')][_0x9423('0x1d')]);_0x153b88[_0x9423('0x1c')]=qs['offset'](_0x24f891[_0x9423('0x30')][_0x9423('0x1c')]);}_0x153b88[_0x9423('0x38')]=qs[_0x9423('0x39')](_0x24f891[_0x9423('0x30')][_0x9423('0x39')]);_0x153b88[_0x9423('0x3a')]=qs[_0x9423('0x32')](_[_0x9423('0x3b')](_0x24f891[_0x9423('0x30')],_0x470e82[_0x9423('0x32')]),_0x35dd51);if(_0x24f891['query'][_0x9423('0x3c')]){_0x153b88[_0x9423('0x3a')]=_[_0x9423('0x3d')](_0x153b88[_0x9423('0x3a')],{'$or':_['map'](_0x35dd51,function(_0x13f2c3){if(_0x13f2c3[_0x9423('0x2e')]!==_0x9423('0x3e')){var _0xd30710={};_0xd30710[_0x13f2c3[_0x9423('0x27')]]={'$like':'%'+_0x24f891[_0x9423('0x30')][_0x9423('0x3c')]+'%'};return _0xd30710;}})});}_0x153b88=_[_0x9423('0x3d')]({},_0x153b88,_0x24f891[_0x9423('0x3f')]);var _0x3c1782={'where':_0x153b88[_0x9423('0x3a')]};return db['ServicenowConfiguration'][_0x9423('0x1e')](_0x3c1782)[_0x9423('0x24')](function(_0x271a28){_0xf95049[_0x9423('0x1e')]=_0x271a28;if(_0x24f891[_0x9423('0x30')][_0x9423('0x40')]){_0x153b88['include']=[{'all':!![]}];}return db[_0x9423('0x2b')][_0x9423('0x41')](_0x153b88);})['then'](function(_0x2b1200){_0xf95049[_0x9423('0x42')]=_0x2b1200;return _0xf95049;})[_0x9423('0x24')](respondWithFilteredResult(_0x53e8af,_0x153b88))[_0x9423('0x43')](handleError(_0x53e8af,null));};exports[_0x9423('0x44')]=function(_0x118a30,_0xf6f947){var _0x5a84c0={'raw':![],'where':{'id':_0x118a30[_0x9423('0x45')]['id']}},_0x331388={};_0x331388[_0x9423('0x33')]=_[_0x9423('0x31')](db[_0x9423('0x2b')][_0x9423('0x2c')]);_0x331388[_0x9423('0x30')]=_[_0x9423('0x31')](_0x118a30[_0x9423('0x30')]);_0x331388[_0x9423('0x32')]=_[_0x9423('0x46')](_0x331388['model'],_0x331388[_0x9423('0x30')]);_0x5a84c0['attributes']=_[_0x9423('0x46')](_0x331388[_0x9423('0x33')],qs[_0x9423('0x47')](_0x118a30['query'][_0x9423('0x47')]));_0x5a84c0['attributes']=_0x5a84c0[_0x9423('0x34')][_0x9423('0x35')]?_0x5a84c0[_0x9423('0x34')]:_0x331388[_0x9423('0x33')];if(_0x118a30[_0x9423('0x30')][_0x9423('0x40')]){_0x5a84c0[_0x9423('0x48')]=[{'all':!![]}];}_0x5a84c0=_[_0x9423('0x3d')]({},_0x5a84c0,_0x118a30[_0x9423('0x3f')]);return db['ServicenowConfiguration']['find'](_0x5a84c0)[_0x9423('0x24')](handleEntityNotFound(_0xf6f947,null))['then'](respondWithResult(_0xf6f947,null))[_0x9423('0x43')](handleError(_0xf6f947,null));};exports[_0x9423('0x49')]=function(_0x19fd8e,_0x4cdf78){return db[_0x9423('0x2b')][_0x9423('0x49')](_0x19fd8e['body'],{})['then'](respondWithResult(_0x4cdf78,0xc9))[_0x9423('0x43')](handleError(_0x4cdf78,null));};exports[_0x9423('0x23')]=function(_0x8c61b1,_0x4168ca){if(_0x8c61b1[_0x9423('0x4a')]['id']){delete _0x8c61b1[_0x9423('0x4a')]['id'];}return db[_0x9423('0x2b')]['find']({'where':{'id':_0x8c61b1[_0x9423('0x45')]['id']}})[_0x9423('0x24')](handleEntityNotFound(_0x4168ca,null))['then'](saveUpdates(_0x8c61b1[_0x9423('0x4a')],null))[_0x9423('0x24')](respondWithResult(_0x4168ca,null))['catch'](handleError(_0x4168ca,null));};exports['destroy']=function(_0x2ce9d0,_0x263ec9){return db[_0x9423('0x2b')][_0x9423('0x4b')]({'where':{'id':_0x2ce9d0['params']['id']}})[_0x9423('0x24')](handleEntityNotFound(_0x263ec9,null))[_0x9423('0x24')](removeEntity(_0x263ec9,null))[_0x9423('0x43')](handleError(_0x263ec9,null));};exports[_0x9423('0x4c')]=function(_0xd09973,_0x7e293d,_0x26f9d5){var _0x5b94da={};var _0x644437={};var _0x1c88a4;var _0x48c59a;return db[_0x9423('0x2b')][_0x9423('0x4d')]({'where':{'id':_0xd09973[_0x9423('0x45')]['id']}})[_0x9423('0x24')](handleEntityNotFound(_0x7e293d,null))[_0x9423('0x24')](function(_0x550a2e){if(_0x550a2e){_0x1c88a4=_0x550a2e;_0x644437[_0x9423('0x33')]=_['keys'](db[_0x9423('0x4e')]['rawAttributes']);_0x644437[_0x9423('0x30')]=_[_0x9423('0x31')](_0xd09973['query']);_0x644437[_0x9423('0x32')]=_[_0x9423('0x46')](_0x644437['model'],_0x644437[_0x9423('0x30')]);_0x5b94da[_0x9423('0x34')]=_[_0x9423('0x46')](_0x644437['model'],qs['fields'](_0xd09973[_0x9423('0x30')][_0x9423('0x47')]));_0x5b94da[_0x9423('0x34')]=_0x5b94da[_0x9423('0x34')][_0x9423('0x35')]?_0x5b94da[_0x9423('0x34')]:_0x644437[_0x9423('0x33')];_0x5b94da[_0x9423('0x38')]=qs['sort'](_0xd09973[_0x9423('0x30')]['sort']);_0x5b94da[_0x9423('0x3a')]=qs[_0x9423('0x32')](_[_0x9423('0x3b')](_0xd09973[_0x9423('0x30')],_0x644437[_0x9423('0x32')]));if(_0xd09973['query'][_0x9423('0x3c')]){_0x5b94da[_0x9423('0x3a')]=_[_0x9423('0x3d')](_0x5b94da[_0x9423('0x3a')],{'$or':_[_0x9423('0x2a')](_0x5b94da['attributes'],function(_0x2aba4f){var _0x34429a={};_0x34429a[_0x2aba4f]={'$like':'%'+_0xd09973[_0x9423('0x30')][_0x9423('0x3c')]+'%'};return _0x34429a;})});}_0x5b94da=_[_0x9423('0x3d')]({},_0x5b94da,_0xd09973['options']);return _0x1c88a4[_0x9423('0x4c')](_0x5b94da);}})[_0x9423('0x24')](function(_0x1bfc0e){if(_0x1bfc0e){_0x48c59a=_0x1bfc0e['length'];if(!_0xd09973[_0x9423('0x30')][_0x9423('0x36')](_0x9423('0x37'))){_0x5b94da[_0x9423('0x1d')]=qs[_0x9423('0x1d')](_0xd09973[_0x9423('0x30')][_0x9423('0x1d')]);_0x5b94da['offset']=qs[_0x9423('0x1c')](_0xd09973[_0x9423('0x30')][_0x9423('0x1c')]);}return _0x1c88a4[_0x9423('0x4c')](_0x5b94da);}})[_0x9423('0x24')](function(_0x4948d1){if(_0x4948d1){return _0x4948d1?{'count':_0x48c59a,'rows':_0x4948d1}:null;}})[_0x9423('0x24')](respondWithResult(_0x7e293d,null))[_0x9423('0x43')](handleError(_0x7e293d,null));};exports['getSubjects']=function(_0x28764c,_0x58dc76,_0x5e1a22){var _0xda2deb={};var _0x45cd6f={};var _0x8d378b;var _0x164ee5;return db[_0x9423('0x2b')][_0x9423('0x4d')]({'where':{'id':_0x28764c['params']['id']}})[_0x9423('0x24')](handleEntityNotFound(_0x58dc76,null))['then'](function(_0xf124b3){if(_0xf124b3){_0x8d378b=_0xf124b3;_0x45cd6f[_0x9423('0x33')]=_[_0x9423('0x31')](db['ServicenowField']['rawAttributes']);_0x45cd6f[_0x9423('0x30')]=_[_0x9423('0x31')](_0x28764c['query']);_0x45cd6f[_0x9423('0x32')]=_['intersection'](_0x45cd6f[_0x9423('0x33')],_0x45cd6f[_0x9423('0x30')]);_0xda2deb['attributes']=_[_0x9423('0x46')](_0x45cd6f[_0x9423('0x33')],qs['fields'](_0x28764c[_0x9423('0x30')][_0x9423('0x47')]));_0xda2deb[_0x9423('0x34')]=_0xda2deb[_0x9423('0x34')][_0x9423('0x35')]?_0xda2deb[_0x9423('0x34')]:_0x45cd6f[_0x9423('0x33')];_0xda2deb['order']=qs[_0x9423('0x39')](_0x28764c[_0x9423('0x30')][_0x9423('0x39')]);_0xda2deb[_0x9423('0x3a')]=qs[_0x9423('0x32')](_[_0x9423('0x3b')](_0x28764c[_0x9423('0x30')],_0x45cd6f[_0x9423('0x32')]));if(_0x28764c[_0x9423('0x30')]['filter']){_0xda2deb[_0x9423('0x3a')]=_[_0x9423('0x3d')](_0xda2deb[_0x9423('0x3a')],{'$or':_[_0x9423('0x2a')](_0xda2deb[_0x9423('0x34')],function(_0x27688c){var _0x50634c={};_0x50634c[_0x27688c]={'$like':'%'+_0x28764c[_0x9423('0x30')][_0x9423('0x3c')]+'%'};return _0x50634c;})});}_0xda2deb=_[_0x9423('0x3d')]({},_0xda2deb,_0x28764c[_0x9423('0x3f')]);return _0x8d378b[_0x9423('0x4f')](_0xda2deb);}})[_0x9423('0x24')](function(_0x4b8905){if(_0x4b8905){_0x164ee5=_0x4b8905[_0x9423('0x35')];if(!_0x28764c[_0x9423('0x30')][_0x9423('0x36')]('nolimit')){_0xda2deb[_0x9423('0x1d')]=qs[_0x9423('0x1d')](_0x28764c[_0x9423('0x30')]['limit']);_0xda2deb['offset']=qs[_0x9423('0x1c')](_0x28764c['query']['offset']);}return _0x8d378b['getSubjects'](_0xda2deb);}})[_0x9423('0x24')](function(_0x217f3d){if(_0x217f3d){return _0x217f3d?{'count':_0x164ee5,'rows':_0x217f3d}:null;}})[_0x9423('0x24')](respondWithResult(_0x58dc76,null))['catch'](handleError(_0x58dc76,null));};exports[_0x9423('0x50')]=function(_0x19d7d2,_0x589420,_0x15d1e9){var _0x26e6e3={};var _0x331fe6={};var _0x3a6d18;var _0x3ff7c8;return db[_0x9423('0x2b')]['findOne']({'where':{'id':_0x19d7d2[_0x9423('0x45')]['id']}})[_0x9423('0x24')](handleEntityNotFound(_0x589420,null))[_0x9423('0x24')](function(_0x3949d2){if(_0x3949d2){_0x3a6d18=_0x3949d2;_0x331fe6['model']=_[_0x9423('0x31')](db['ServicenowField'][_0x9423('0x2c')]);_0x331fe6['query']=_[_0x9423('0x31')](_0x19d7d2[_0x9423('0x30')]);_0x331fe6[_0x9423('0x32')]=_[_0x9423('0x46')](_0x331fe6[_0x9423('0x33')],_0x331fe6[_0x9423('0x30')]);_0x26e6e3[_0x9423('0x34')]=_[_0x9423('0x46')](_0x331fe6[_0x9423('0x33')],qs['fields'](_0x19d7d2[_0x9423('0x30')][_0x9423('0x47')]));_0x26e6e3['attributes']=_0x26e6e3[_0x9423('0x34')][_0x9423('0x35')]?_0x26e6e3[_0x9423('0x34')]:_0x331fe6['model'];_0x26e6e3[_0x9423('0x38')]=qs['sort'](_0x19d7d2[_0x9423('0x30')]['sort']);_0x26e6e3[_0x9423('0x3a')]=qs[_0x9423('0x32')](_[_0x9423('0x3b')](_0x19d7d2[_0x9423('0x30')],_0x331fe6[_0x9423('0x32')]));if(_0x19d7d2[_0x9423('0x30')][_0x9423('0x3c')]){_0x26e6e3['where']=_[_0x9423('0x3d')](_0x26e6e3['where'],{'$or':_[_0x9423('0x2a')](_0x26e6e3[_0x9423('0x34')],function(_0x353945){var _0x498d39={};_0x498d39[_0x353945]={'$like':'%'+_0x19d7d2[_0x9423('0x30')][_0x9423('0x3c')]+'%'};return _0x498d39;})});}_0x26e6e3=_['merge']({},_0x26e6e3,_0x19d7d2[_0x9423('0x3f')]);return _0x3a6d18['getDescriptions'](_0x26e6e3);}})['then'](function(_0x5778d2){if(_0x5778d2){_0x3ff7c8=_0x5778d2[_0x9423('0x35')];if(!_0x19d7d2[_0x9423('0x30')][_0x9423('0x36')](_0x9423('0x37'))){_0x26e6e3['limit']=qs[_0x9423('0x1d')](_0x19d7d2[_0x9423('0x30')][_0x9423('0x1d')]);_0x26e6e3[_0x9423('0x1c')]=qs[_0x9423('0x1c')](_0x19d7d2['query'][_0x9423('0x1c')]);}return _0x3a6d18[_0x9423('0x50')](_0x26e6e3);}})[_0x9423('0x24')](function(_0x212c16){if(_0x212c16){return _0x212c16?{'count':_0x3ff7c8,'rows':_0x212c16}:null;}})[_0x9423('0x24')](respondWithResult(_0x589420,null))['catch'](handleError(_0x589420,null));}; \ No newline at end of file diff --git a/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js b/server/api/intServicenowConfiguration/intServicenowConfiguration.model.js index f77c61f..27504df 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 _0xbecf=['../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intServicenowConfiguration.attributes','exports','define','ServicenowConfiguration','int_servicenow_configurations'];(function(_0x569a32,_0xb6e572){var _0x87b2c3=function(_0x1c5073){while(--_0x1c5073){_0x569a32['push'](_0x569a32['shift']());}};_0x87b2c3(++_0xb6e572);}(_0xbecf,0x15c));var _0xfbec=function(_0x191983,_0x592d0e){_0x191983=_0x191983-0x0;var _0x1db328=_0xbecf[_0x191983];return _0x1db328;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfbec('0x0'))(_0xfbec('0x1'));var moment=require(_0xfbec('0x2'));var BPromise=require(_0xfbec('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xfbec('0x4'));var rimraf=require(_0xfbec('0x5'));var config=require(_0xfbec('0x6'));var attributes=require(_0xfbec('0x7'));module[_0xfbec('0x8')]=function(_0x5bd6f1,_0x297f85){return _0x5bd6f1[_0xfbec('0x9')](_0xfbec('0xa'),attributes,{'tableName':_0xfbec('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3306=['define','ServicenowConfiguration','int_servicenow_configurations','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','exports'];(function(_0x4cd981,_0x3db22b){var _0x1b6e66=function(_0x5797da){while(--_0x5797da){_0x4cd981['push'](_0x4cd981['shift']());}};_0x1b6e66(++_0x3db22b);}(_0x3306,0x107));var _0x6330=function(_0x57f981,_0x175912){_0x57f981=_0x57f981-0x0;var _0x37c46d=_0x3306[_0x57f981];return _0x37c46d;};'use strict';var _=require(_0x6330('0x0'));var util=require(_0x6330('0x1'));var logger=require(_0x6330('0x2'))(_0x6330('0x3'));var moment=require('moment');var BPromise=require(_0x6330('0x4'));var rp=require(_0x6330('0x5'));var fs=require('fs');var path=require(_0x6330('0x6'));var rimraf=require(_0x6330('0x7'));var config=require(_0x6330('0x8'));var attributes=require('./intServicenowConfiguration.attributes');module[_0x6330('0x9')]=function(_0x457797,_0x2942ec){return _0x457797[_0x6330('0xa')](_0x6330('0xb'),attributes,{'tableName':_0x6330('0xc'),'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 7b0db6c..62aa9db 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 _0x1f38=['then','info','ServicenowConfiguration,\x20%s,\x20%s','request\x20sent','debug','ServicenowConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','../../mysqldb','jayson/promise','client','http'];(function(_0x1c98bc,_0x5e4d18){var _0x4bead2=function(_0x4d7fca){while(--_0x4d7fca){_0x1c98bc['push'](_0x1c98bc['shift']());}};_0x4bead2(++_0x5e4d18);}(_0x1f38,0x116));var _0x81f3=function(_0xb98d8d,_0x481423){_0xb98d8d=_0xb98d8d-0x0;var _0x489b15=_0x1f38[_0xb98d8d];return _0x489b15;};'use strict';var _=require(_0x81f3('0x0'));var util=require(_0x81f3('0x1'));var moment=require(_0x81f3('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x81f3('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x81f3('0x4'));var client=jayson[_0x81f3('0x5')][_0x81f3('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x542c32,_0x47c0d2,_0x35be55){return new BPromise(function(_0x591f67,_0x446652){return client['request'](_0x542c32,_0x35be55)[_0x81f3('0x7')](function(_0x1f907e){logger[_0x81f3('0x8')](_0x81f3('0x9'),_0x47c0d2,_0x81f3('0xa'));logger[_0x81f3('0xb')](_0x81f3('0xc'),_0x47c0d2,'request\x20sent',JSON[_0x81f3('0xd')](_0x1f907e));if(_0x1f907e[_0x81f3('0xe')]){if(_0x1f907e[_0x81f3('0xe')][_0x81f3('0xf')]===0x1f4){logger[_0x81f3('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x47c0d2,_0x1f907e[_0x81f3('0xe')][_0x81f3('0x10')]);return _0x446652(_0x1f907e['error']['message']);}logger[_0x81f3('0xe')]('ServicenowConfiguration,\x20%s,\x20%s',_0x47c0d2,_0x1f907e[_0x81f3('0xe')][_0x81f3('0x10')]);return _0x591f67(_0x1f907e['error']['message']);}else{logger['info']('ServicenowConfiguration,\x20%s,\x20%s',_0x47c0d2,'request\x20sent');_0x591f67(_0x1f907e[_0x81f3('0x11')][_0x81f3('0x10')]);}})[_0x81f3('0x12')](function(_0x161c03){logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x47c0d2,_0x161c03);_0x446652(_0x161c03);});});} \ No newline at end of file +var _0xeadc=['error','code','ServicenowConfiguration,\x20%s,\x20%s','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','ServicenowConfiguration,\x20%s,\x20%s,\x20%s'];(function(_0x4c2c7f,_0x23bcf3){var _0x22f61a=function(_0x575546){while(--_0x575546){_0x4c2c7f['push'](_0x4c2c7f['shift']());}};_0x22f61a(++_0x23bcf3);}(_0xeadc,0x1d4));var _0xcead=function(_0x20325d,_0xb662cf){_0x20325d=_0x20325d-0x0;var _0x249be9=_0xeadc[_0x20325d];return _0x249be9;};'use strict';var _=require(_0xcead('0x0'));var util=require(_0xcead('0x1'));var moment=require(_0xcead('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcead('0x3'));var db=require(_0xcead('0x4'))['db'];var utils=require(_0xcead('0x5'));var logger=require(_0xcead('0x6'))(_0xcead('0x7'));var config=require(_0xcead('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xcead('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x239d28,_0x35bf8d,_0x3cade8){return new BPromise(function(_0x34d3c6,_0x57bf2d){return client[_0xcead('0xa')](_0x239d28,_0x3cade8)[_0xcead('0xb')](function(_0x2722bf){logger[_0xcead('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x35bf8d,_0xcead('0xd'));logger['debug'](_0xcead('0xe'),_0x35bf8d,_0xcead('0xd'),JSON['stringify'](_0x2722bf));if(_0x2722bf[_0xcead('0xf')]){if(_0x2722bf[_0xcead('0xf')][_0xcead('0x10')]===0x1f4){logger[_0xcead('0xf')](_0xcead('0x11'),_0x35bf8d,_0x2722bf['error'][_0xcead('0x12')]);return _0x57bf2d(_0x2722bf[_0xcead('0xf')]['message']);}logger['error']('ServicenowConfiguration,\x20%s,\x20%s',_0x35bf8d,_0x2722bf[_0xcead('0xf')][_0xcead('0x12')]);return _0x34d3c6(_0x2722bf[_0xcead('0xf')][_0xcead('0x12')]);}else{logger[_0xcead('0xc')]('ServicenowConfiguration,\x20%s,\x20%s',_0x35bf8d,_0xcead('0xd'));_0x34d3c6(_0x2722bf[_0xcead('0x13')][_0xcead('0x12')]);}})[_0xcead('0x14')](function(_0x3f70d9){logger[_0xcead('0xf')]('ServicenowConfiguration,\x20%s,\x20%s',_0x35bf8d,_0x3f70d9);_0x57bf2d(_0x3f70d9);});});} \ No newline at end of file diff --git a/server/api/intServicenowField/index.js b/server/api/intServicenowField/index.js index 655b75b..00abaf1 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 _0x7154=['/:id','post','put','update','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','index'];(function(_0x5ee627,_0x151c4f){var _0x3a3f7a=function(_0x151df7){while(--_0x151df7){_0x5ee627['push'](_0x5ee627['shift']());}};_0x3a3f7a(++_0x151c4f);}(_0x7154,0x114));var _0x4715=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x7154[_0x5e3b04];return _0x1fc44d;};'use strict';var multer=require('multer');var util=require(_0x4715('0x0'));var path=require(_0x4715('0x1'));var timeout=require(_0x4715('0x2'));var express=require(_0x4715('0x3'));var router=express[_0x4715('0x4')]();var fs_extra=require(_0x4715('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x4715('0x6'));var config=require(_0x4715('0x7'));var controller=require(_0x4715('0x8'));router[_0x4715('0x9')]('/',auth[_0x4715('0xa')](),controller[_0x4715('0xb')]);router[_0x4715('0x9')](_0x4715('0xc'),auth[_0x4715('0xa')](),controller['show']);router[_0x4715('0xd')]('/',auth[_0x4715('0xa')](),controller['create']);router[_0x4715('0xe')]('/:id',auth[_0x4715('0xa')](),controller[_0x4715('0xf')]);router['delete'](_0x4715('0xc'),auth[_0x4715('0xa')](),controller[_0x4715('0x10')]);module[_0x4715('0x11')]=router; \ No newline at end of file +var _0x43e7=['post','update','exports','multer','util','path','Router','../../components/interaction/service','../../config/environment','./intServicenowField.controller','get','isAuthenticated','/:id','show'];(function(_0x444f36,_0x2cabec){var _0x161b43=function(_0x1a50e0){while(--_0x1a50e0){_0x444f36['push'](_0x444f36['shift']());}};_0x161b43(++_0x2cabec);}(_0x43e7,0xf1));var _0x743e=function(_0x19babd,_0x1d4ef7){_0x19babd=_0x19babd-0x0;var _0x314eaf=_0x43e7[_0x19babd];return _0x314eaf;};'use strict';var multer=require(_0x743e('0x0'));var util=require(_0x743e('0x1'));var path=require(_0x743e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x743e('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x743e('0x4'));var config=require(_0x743e('0x5'));var controller=require(_0x743e('0x6'));router[_0x743e('0x7')]('/',auth[_0x743e('0x8')](),controller['index']);router[_0x743e('0x7')](_0x743e('0x9'),auth['isAuthenticated'](),controller[_0x743e('0xa')]);router[_0x743e('0xb')]('/',auth['isAuthenticated'](),controller['create']);router['put']('/:id',auth[_0x743e('0x8')](),controller[_0x743e('0xc')]);router['delete'](_0x743e('0x9'),auth[_0x743e('0x8')](),controller['destroy']);module[_0x743e('0xd')]=router; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.attributes.js b/server/api/intServicenowField/intServicenowField.attributes.js index 9d2bc66..1f1eee9 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 _0xea86=['customVariable','sequelize','string','variable','STRING','ENUM'];(function(_0x1ddbba,_0x3501e2){var _0x3a347d=function(_0xbc1080){while(--_0xbc1080){_0x1ddbba['push'](_0x1ddbba['shift']());}};_0x3a347d(++_0x3501e2);}(_0xea86,0x85));var _0x6ea8=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xea86[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x6ea8('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x6ea8('0x1'),_0x6ea8('0x2'),'customVariable','keyValue','picklist'),'defaultValue':_0x6ea8('0x1')},'content':{'type':Sequelize[_0x6ea8('0x3')]},'key':{'type':Sequelize[_0x6ea8('0x3')]},'keyType':{'type':Sequelize[_0x6ea8('0x4')]('string',_0x6ea8('0x2'),_0x6ea8('0x5'))},'keyContent':{'type':Sequelize[_0x6ea8('0x3')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x6ea8('0x3')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x6ea8('0x3')]}}; \ No newline at end of file +var _0xb85b=['string','variable','STRING','BOOLEAN','sequelize','exports','ENUM'];(function(_0x52373f,_0x34ebc6){var _0x3d941d=function(_0x585fd3){while(--_0x585fd3){_0x52373f['push'](_0x52373f['shift']());}};_0x3d941d(++_0x34ebc6);}(_0xb85b,0x7b));var _0xbb85=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xb85b[_0x2c91e9];return _0x13f0ff;};'use strict';var Sequelize=require(_0xbb85('0x0'));module[_0xbb85('0x1')]={'type':{'type':Sequelize[_0xbb85('0x2')](_0xbb85('0x3'),_0xbb85('0x4'),'customVariable','keyValue','picklist'),'defaultValue':_0xbb85('0x3')},'content':{'type':Sequelize[_0xbb85('0x5')]},'key':{'type':Sequelize[_0xbb85('0x5')]},'keyType':{'type':Sequelize[_0xbb85('0x2')](_0xbb85('0x3'),_0xbb85('0x4'),'customVariable')},'keyContent':{'type':Sequelize[_0xbb85('0x5')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize[_0xbb85('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xbb85('0x5')]}}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.controller.js b/server/api/intServicenowField/intServicenowField.controller.js index be84183..1f5c383 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 _0xf278=['querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','update','then','destroy','stack','name','index','map','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','ServicenowField','includeAll','include','findAll','rows','show','keys','find','catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto'];(function(_0x159f91,_0xe8a30f){var _0x26bd65=function(_0x5680d1){while(--_0x5680d1){_0x159f91['push'](_0x159f91['shift']());}};_0x26bd65(++_0xe8a30f);}(_0xf278,0xcb));var _0x8f27=function(_0x5c110f,_0x3c4bd8){_0x5c110f=_0x5c110f-0x0;var _0x5ebfc5=_0xf278[_0x5c110f];return _0x5ebfc5;};'use strict';var emlformat=require(_0x8f27('0x0'));var rimraf=require(_0x8f27('0x1'));var zipdir=require(_0x8f27('0x2'));var jsonpatch=require(_0x8f27('0x3'));var rp=require(_0x8f27('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8f27('0x5'));var util=require('util');var path=require(_0x8f27('0x6'));var sox=require(_0x8f27('0x7'));var csv=require(_0x8f27('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f27('0x9'));var _=require(_0x8f27('0xa'));var squel=require(_0x8f27('0xb'));var crypto=require(_0x8f27('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x8f27('0x8'));var querystring=require(_0x8f27('0xd'));var Papa=require(_0x8f27('0xe'));var Redis=require(_0x8f27('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8f27('0x10'));var hardwareService=require(_0x8f27('0x11'));var logger=require(_0x8f27('0x12'))('api');var utils=require(_0x8f27('0x13'));var config=require(_0x8f27('0x14'));var licenseUtil=require(_0x8f27('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3cc401,_0x403f36){_0x403f36=_0x403f36||0xcc;return function(_0x1ed011){if(_0x1ed011){return _0x3cc401[_0x8f27('0x16')](_0x403f36);}return _0x3cc401[_0x8f27('0x17')](_0x403f36)[_0x8f27('0x18')]();};}function respondWithResult(_0x412d92,_0x170d91){_0x170d91=_0x170d91||0xc8;return function(_0x367f10){if(_0x367f10){return _0x412d92[_0x8f27('0x17')](_0x170d91)[_0x8f27('0x19')](_0x367f10);}};}function respondWithFilteredResult(_0x2ba9db,_0x3175cd){return function(_0x3c2d33){if(_0x3c2d33){var _0x3740d2=typeof _0x3175cd['offset']===_0x8f27('0x1a')&&typeof _0x3175cd[_0x8f27('0x1b')]===_0x8f27('0x1a');var _0x36ae26=_0x3c2d33['count'];var _0x2bccf0=_0x3740d2?0x0:_0x3175cd[_0x8f27('0x1c')];var _0x32689a=_0x3740d2?_0x3c2d33[_0x8f27('0x1d')]:_0x3175cd['offset']+_0x3175cd[_0x8f27('0x1b')];var _0x1d7e06;if(_0x32689a>=_0x36ae26){_0x32689a=_0x36ae26;_0x1d7e06=0xc8;}else{_0x1d7e06=0xce;}_0x2ba9db[_0x8f27('0x17')](_0x1d7e06);return _0x2ba9db[_0x8f27('0x1e')](_0x8f27('0x1f'),_0x2bccf0+'-'+_0x32689a+'/'+_0x36ae26)[_0x8f27('0x19')](_0x3c2d33);}return null;};}function patchUpdates(_0x2d49e2){return function(_0x261757){try{jsonpatch[_0x8f27('0x20')](_0x261757,_0x2d49e2,!![]);}catch(_0x5a4649){return BPromise[_0x8f27('0x21')](_0x5a4649);}return _0x261757['save']();};}function saveUpdates(_0x3a954c,_0x570ab5){return function(_0x135be1){if(_0x135be1){return _0x135be1[_0x8f27('0x22')](_0x3a954c)[_0x8f27('0x23')](function(_0x357c5e){return _0x357c5e;});}return null;};}function removeEntity(_0x252e6c,_0x8d46d2){return function(_0x443e27){if(_0x443e27){return _0x443e27[_0x8f27('0x24')]()[_0x8f27('0x23')](function(){_0x252e6c[_0x8f27('0x17')](0xcc)[_0x8f27('0x18')]();});}};}function handleEntityNotFound(_0x5ec642,_0x4c6de1){return function(_0x4ef385){if(!_0x4ef385){_0x5ec642['sendStatus'](0x194);}return _0x4ef385;};}function handleError(_0xc9053f,_0x48e02e){_0x48e02e=_0x48e02e||0x1f4;return function(_0x46f8c7){logger['error'](_0x46f8c7[_0x8f27('0x25')]);if(_0x46f8c7['name']){delete _0x46f8c7[_0x8f27('0x26')];}_0xc9053f['status'](_0x48e02e)['send'](_0x46f8c7);};}exports[_0x8f27('0x27')]=function(_0x5c271c,_0x35c34f){var _0x1f6ca8={},_0x2cb007={},_0x1def07={'count':0x0,'rows':[]};var _0x25c034=_[_0x8f27('0x28')](db['ServicenowField'][_0x8f27('0x29')],function(_0x312031){return{'name':_0x312031[_0x8f27('0x2a')],'type':_0x312031[_0x8f27('0x2b')][_0x8f27('0x2c')]};});_0x2cb007['model']=_[_0x8f27('0x28')](_0x25c034,_0x8f27('0x26'));_0x2cb007[_0x8f27('0x2d')]=_['keys'](_0x5c271c[_0x8f27('0x2d')]);_0x2cb007[_0x8f27('0x2e')]=_[_0x8f27('0x2f')](_0x2cb007[_0x8f27('0x30')],_0x2cb007[_0x8f27('0x2d')]);_0x1f6ca8[_0x8f27('0x31')]=_[_0x8f27('0x2f')](_0x2cb007[_0x8f27('0x30')],qs[_0x8f27('0x32')](_0x5c271c['query'][_0x8f27('0x32')]));_0x1f6ca8[_0x8f27('0x31')]=_0x1f6ca8[_0x8f27('0x31')][_0x8f27('0x33')]?_0x1f6ca8[_0x8f27('0x31')]:_0x2cb007[_0x8f27('0x30')];if(!_0x5c271c[_0x8f27('0x2d')][_0x8f27('0x34')](_0x8f27('0x35'))){_0x1f6ca8[_0x8f27('0x1b')]=qs[_0x8f27('0x1b')](_0x5c271c[_0x8f27('0x2d')]['limit']);_0x1f6ca8[_0x8f27('0x1c')]=qs[_0x8f27('0x1c')](_0x5c271c[_0x8f27('0x2d')][_0x8f27('0x1c')]);}_0x1f6ca8[_0x8f27('0x36')]=qs[_0x8f27('0x37')](_0x5c271c[_0x8f27('0x2d')][_0x8f27('0x37')]);_0x1f6ca8[_0x8f27('0x38')]=qs[_0x8f27('0x2e')](_[_0x8f27('0x39')](_0x5c271c[_0x8f27('0x2d')],_0x2cb007[_0x8f27('0x2e')]),_0x25c034);if(_0x5c271c['query'][_0x8f27('0x3a')]){_0x1f6ca8[_0x8f27('0x38')]=_['merge'](_0x1f6ca8[_0x8f27('0x38')],{'$or':_[_0x8f27('0x28')](_0x25c034,function(_0x419416){if(_0x419416[_0x8f27('0x2b')]!=='VIRTUAL'){var _0x2d7220={};_0x2d7220[_0x419416['name']]={'$like':'%'+_0x5c271c['query'][_0x8f27('0x3a')]+'%'};return _0x2d7220;}})});}_0x1f6ca8=_[_0x8f27('0x3b')]({},_0x1f6ca8,_0x5c271c[_0x8f27('0x3c')]);var _0x37a582={'where':_0x1f6ca8[_0x8f27('0x38')]};return db[_0x8f27('0x3d')][_0x8f27('0x1d')](_0x37a582)[_0x8f27('0x23')](function(_0x2c7398){_0x1def07[_0x8f27('0x1d')]=_0x2c7398;if(_0x5c271c[_0x8f27('0x2d')][_0x8f27('0x3e')]){_0x1f6ca8[_0x8f27('0x3f')]=[{'all':!![]}];}return db[_0x8f27('0x3d')][_0x8f27('0x40')](_0x1f6ca8);})[_0x8f27('0x23')](function(_0x3cc57f){_0x1def07[_0x8f27('0x41')]=_0x3cc57f;return _0x1def07;})['then'](respondWithFilteredResult(_0x35c34f,_0x1f6ca8))['catch'](handleError(_0x35c34f,null));};exports[_0x8f27('0x42')]=function(_0x5e5e59,_0x39c9b9){var _0x122131={'raw':!![],'where':{'id':_0x5e5e59['params']['id']}},_0x26b792={};_0x26b792[_0x8f27('0x30')]=_[_0x8f27('0x43')](db[_0x8f27('0x3d')]['rawAttributes']);_0x26b792[_0x8f27('0x2d')]=_['keys'](_0x5e5e59[_0x8f27('0x2d')]);_0x26b792[_0x8f27('0x2e')]=_['intersection'](_0x26b792[_0x8f27('0x30')],_0x26b792[_0x8f27('0x2d')]);_0x122131[_0x8f27('0x31')]=_[_0x8f27('0x2f')](_0x26b792[_0x8f27('0x30')],qs['fields'](_0x5e5e59[_0x8f27('0x2d')]['fields']));_0x122131[_0x8f27('0x31')]=_0x122131['attributes'][_0x8f27('0x33')]?_0x122131['attributes']:_0x26b792[_0x8f27('0x30')];if(_0x5e5e59[_0x8f27('0x2d')][_0x8f27('0x3e')]){_0x122131[_0x8f27('0x3f')]=[{'all':!![]}];}_0x122131=_['merge']({},_0x122131,_0x5e5e59['options']);return db['ServicenowField'][_0x8f27('0x44')](_0x122131)[_0x8f27('0x23')](handleEntityNotFound(_0x39c9b9,null))[_0x8f27('0x23')](respondWithResult(_0x39c9b9,null))[_0x8f27('0x45')](handleError(_0x39c9b9,null));};exports[_0x8f27('0x46')]=function(_0x168474,_0x5635c1){return db[_0x8f27('0x3d')][_0x8f27('0x46')](_0x168474[_0x8f27('0x47')],{})[_0x8f27('0x23')](respondWithResult(_0x5635c1,0xc9))[_0x8f27('0x45')](handleError(_0x5635c1,null));};exports['update']=function(_0x52477d,_0xc3cf37){if(_0x52477d[_0x8f27('0x47')]['id']){delete _0x52477d[_0x8f27('0x47')]['id'];}return db[_0x8f27('0x3d')][_0x8f27('0x44')]({'where':{'id':_0x52477d['params']['id']}})[_0x8f27('0x23')](handleEntityNotFound(_0xc3cf37,null))['then'](saveUpdates(_0x52477d[_0x8f27('0x47')],null))[_0x8f27('0x23')](respondWithResult(_0xc3cf37,null))[_0x8f27('0x45')](handleError(_0xc3cf37,null));};exports[_0x8f27('0x24')]=function(_0x426cf5,_0x2d298f){return db[_0x8f27('0x3d')][_0x8f27('0x44')]({'where':{'id':_0x426cf5['params']['id']}})[_0x8f27('0x23')](handleEntityNotFound(_0x2d298f,null))['then'](removeEntity(_0x2d298f,null))['catch'](handleError(_0x2d298f,null));}; \ No newline at end of file +var _0x351c=['papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','name','send','map','ServicenowField','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','catch','params','length','find','create','body','eml-format','zip-dir','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','querystring'];(function(_0x39da88,_0x3c5e59){var _0x5bd87f=function(_0x23ab4a){while(--_0x23ab4a){_0x39da88['push'](_0x39da88['shift']());}};_0x5bd87f(++_0x3c5e59);}(_0x351c,0xcd));var _0xc351=function(_0x22f34b,_0x20e5e6){_0x22f34b=_0x22f34b-0x0;var _0x5663bf=_0x351c[_0x22f34b];return _0x5663bf;};'use strict';var emlformat=require(_0xc351('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc351('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc351('0x2'));var BPromise=require(_0xc351('0x3'));var Mustache=require(_0xc351('0x4'));var util=require(_0xc351('0x5'));var path=require(_0xc351('0x6'));var sox=require('sox');var csv=require(_0xc351('0x7'));var ejs=require(_0xc351('0x8'));var fs=require('fs');var fs_extra=require(_0xc351('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xc351('0xa'));var jsforce=require(_0xc351('0xb'));var deskjs=require(_0xc351('0xc'));var toCsv=require(_0xc351('0x7'));var querystring=require(_0xc351('0xd'));var Papa=require(_0xc351('0xe'));var Redis=require(_0xc351('0xf'));var authService=require(_0xc351('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0xc351('0x11'));var hardwareService=require(_0xc351('0x12'));var logger=require(_0xc351('0x13'))(_0xc351('0x14'));var utils=require(_0xc351('0x15'));var config=require(_0xc351('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xc351('0x17'))['db'];function respondWithStatusCode(_0x202ab5,_0x35f08e){_0x35f08e=_0x35f08e||0xcc;return function(_0x585d83){if(_0x585d83){return _0x202ab5[_0xc351('0x18')](_0x35f08e);}return _0x202ab5[_0xc351('0x19')](_0x35f08e)[_0xc351('0x1a')]();};}function respondWithResult(_0x5e2b98,_0x2bcf18){_0x2bcf18=_0x2bcf18||0xc8;return function(_0x73d52b){if(_0x73d52b){return _0x5e2b98['status'](_0x2bcf18)['json'](_0x73d52b);}};}function respondWithFilteredResult(_0x22de13,_0x5208b6){return function(_0x6c2101){if(_0x6c2101){var _0x55608c=typeof _0x5208b6[_0xc351('0x1b')]===_0xc351('0x1c')&&typeof _0x5208b6[_0xc351('0x1d')]===_0xc351('0x1c');var _0x36d8dd=_0x6c2101[_0xc351('0x1e')];var _0x2ad176=_0x55608c?0x0:_0x5208b6[_0xc351('0x1b')];var _0x5970c6=_0x55608c?_0x6c2101['count']:_0x5208b6['offset']+_0x5208b6['limit'];var _0x47c5ae;if(_0x5970c6>=_0x36d8dd){_0x5970c6=_0x36d8dd;_0x47c5ae=0xc8;}else{_0x47c5ae=0xce;}_0x22de13[_0xc351('0x19')](_0x47c5ae);return _0x22de13[_0xc351('0x1f')](_0xc351('0x20'),_0x2ad176+'-'+_0x5970c6+'/'+_0x36d8dd)[_0xc351('0x21')](_0x6c2101);}return null;};}function patchUpdates(_0x48499d){return function(_0x529486){try{jsonpatch[_0xc351('0x22')](_0x529486,_0x48499d,!![]);}catch(_0x5cae71){return BPromise[_0xc351('0x23')](_0x5cae71);}return _0x529486[_0xc351('0x24')]();};}function saveUpdates(_0x282f7e,_0x2197aa){return function(_0x494ddb){if(_0x494ddb){return _0x494ddb[_0xc351('0x25')](_0x282f7e)[_0xc351('0x26')](function(_0x4fb038){return _0x4fb038;});}return null;};}function removeEntity(_0x3822e5,_0x231899){return function(_0x9f56e0){if(_0x9f56e0){return _0x9f56e0[_0xc351('0x27')]()[_0xc351('0x26')](function(){_0x3822e5[_0xc351('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x42621c,_0x348f5f){return function(_0x1c0e45){if(!_0x1c0e45){_0x42621c[_0xc351('0x18')](0x194);}return _0x1c0e45;};}function handleError(_0x141741,_0x5ca55c){_0x5ca55c=_0x5ca55c||0x1f4;return function(_0x164f38){logger['error'](_0x164f38['stack']);if(_0x164f38[_0xc351('0x28')]){delete _0x164f38['name'];}_0x141741[_0xc351('0x19')](_0x5ca55c)[_0xc351('0x29')](_0x164f38);};}exports['index']=function(_0x3522b6,_0x580fad){var _0x933590={},_0x1296be={},_0x85ed9={'count':0x0,'rows':[]};var _0x2b0d05=_[_0xc351('0x2a')](db[_0xc351('0x2b')][_0xc351('0x2c')],function(_0x4ca451){return{'name':_0x4ca451[_0xc351('0x2d')],'type':_0x4ca451['type'][_0xc351('0x2e')]};});_0x1296be[_0xc351('0x2f')]=_[_0xc351('0x2a')](_0x2b0d05,_0xc351('0x28'));_0x1296be[_0xc351('0x30')]=_[_0xc351('0x31')](_0x3522b6[_0xc351('0x30')]);_0x1296be[_0xc351('0x32')]=_[_0xc351('0x33')](_0x1296be[_0xc351('0x2f')],_0x1296be[_0xc351('0x30')]);_0x933590[_0xc351('0x34')]=_[_0xc351('0x33')](_0x1296be[_0xc351('0x2f')],qs[_0xc351('0x35')](_0x3522b6[_0xc351('0x30')][_0xc351('0x35')]));_0x933590['attributes']=_0x933590[_0xc351('0x34')]['length']?_0x933590['attributes']:_0x1296be[_0xc351('0x2f')];if(!_0x3522b6[_0xc351('0x30')][_0xc351('0x36')](_0xc351('0x37'))){_0x933590[_0xc351('0x1d')]=qs[_0xc351('0x1d')](_0x3522b6[_0xc351('0x30')][_0xc351('0x1d')]);_0x933590['offset']=qs[_0xc351('0x1b')](_0x3522b6[_0xc351('0x30')]['offset']);}_0x933590[_0xc351('0x38')]=qs[_0xc351('0x39')](_0x3522b6[_0xc351('0x30')][_0xc351('0x39')]);_0x933590[_0xc351('0x3a')]=qs[_0xc351('0x32')](_[_0xc351('0x3b')](_0x3522b6['query'],_0x1296be[_0xc351('0x32')]),_0x2b0d05);if(_0x3522b6[_0xc351('0x30')][_0xc351('0x3c')]){_0x933590['where']=_[_0xc351('0x3d')](_0x933590[_0xc351('0x3a')],{'$or':_[_0xc351('0x2a')](_0x2b0d05,function(_0x48e901){if(_0x48e901['type']!==_0xc351('0x3e')){var _0x493e61={};_0x493e61[_0x48e901['name']]={'$like':'%'+_0x3522b6[_0xc351('0x30')]['filter']+'%'};return _0x493e61;}})});}_0x933590=_[_0xc351('0x3d')]({},_0x933590,_0x3522b6[_0xc351('0x3f')]);var _0xfad48b={'where':_0x933590['where']};return db[_0xc351('0x2b')][_0xc351('0x1e')](_0xfad48b)['then'](function(_0x4a2940){_0x85ed9[_0xc351('0x1e')]=_0x4a2940;if(_0x3522b6['query'][_0xc351('0x40')]){_0x933590[_0xc351('0x41')]=[{'all':!![]}];}return db[_0xc351('0x2b')][_0xc351('0x42')](_0x933590);})['then'](function(_0x3961f7){_0x85ed9['rows']=_0x3961f7;return _0x85ed9;})[_0xc351('0x26')](respondWithFilteredResult(_0x580fad,_0x933590))[_0xc351('0x43')](handleError(_0x580fad,null));};exports['show']=function(_0x2fdd72,_0x2a91a9){var _0x253e57={'raw':!![],'where':{'id':_0x2fdd72[_0xc351('0x44')]['id']}},_0x212958={};_0x212958['model']=_['keys'](db[_0xc351('0x2b')][_0xc351('0x2c')]);_0x212958[_0xc351('0x30')]=_[_0xc351('0x31')](_0x2fdd72['query']);_0x212958['filters']=_['intersection'](_0x212958[_0xc351('0x2f')],_0x212958[_0xc351('0x30')]);_0x253e57['attributes']=_[_0xc351('0x33')](_0x212958['model'],qs[_0xc351('0x35')](_0x2fdd72[_0xc351('0x30')][_0xc351('0x35')]));_0x253e57[_0xc351('0x34')]=_0x253e57['attributes'][_0xc351('0x45')]?_0x253e57[_0xc351('0x34')]:_0x212958['model'];if(_0x2fdd72['query']['includeAll']){_0x253e57[_0xc351('0x41')]=[{'all':!![]}];}_0x253e57=_[_0xc351('0x3d')]({},_0x253e57,_0x2fdd72[_0xc351('0x3f')]);return db[_0xc351('0x2b')][_0xc351('0x46')](_0x253e57)['then'](handleEntityNotFound(_0x2a91a9,null))[_0xc351('0x26')](respondWithResult(_0x2a91a9,null))[_0xc351('0x43')](handleError(_0x2a91a9,null));};exports['create']=function(_0xe23883,_0x5b9997){return db[_0xc351('0x2b')][_0xc351('0x47')](_0xe23883[_0xc351('0x48')],{})[_0xc351('0x26')](respondWithResult(_0x5b9997,0xc9))['catch'](handleError(_0x5b9997,null));};exports[_0xc351('0x25')]=function(_0x17d3f8,_0x219de3){if(_0x17d3f8[_0xc351('0x48')]['id']){delete _0x17d3f8['body']['id'];}return db[_0xc351('0x2b')][_0xc351('0x46')]({'where':{'id':_0x17d3f8[_0xc351('0x44')]['id']}})['then'](handleEntityNotFound(_0x219de3,null))['then'](saveUpdates(_0x17d3f8[_0xc351('0x48')],null))[_0xc351('0x26')](respondWithResult(_0x219de3,null))[_0xc351('0x43')](handleError(_0x219de3,null));};exports[_0xc351('0x27')]=function(_0x1d91e3,_0x451a62){return db[_0xc351('0x2b')][_0xc351('0x46')]({'where':{'id':_0x1d91e3[_0xc351('0x44')]['id']}})[_0xc351('0x26')](handleEntityNotFound(_0x451a62,null))[_0xc351('0x26')](removeEntity(_0x451a62,null))[_0xc351('0x43')](handleError(_0x451a62,null));}; \ No newline at end of file diff --git a/server/api/intServicenowField/intServicenowField.model.js b/server/api/intServicenowField/intServicenowField.model.js index c531ab5..2ad2583 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 _0x1aae=['exports','define','servicenow_unique_index','idField','FieldId','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','./intServicenowField.attributes'];(function(_0x4904f3,_0x88328c){var _0x5674cc=function(_0x2b89a1){while(--_0x2b89a1){_0x4904f3['push'](_0x4904f3['shift']());}};_0x5674cc(++_0x88328c);}(_0x1aae,0x11d));var _0xe1aa=function(_0x3a2d4,_0x2c5b45){_0x3a2d4=_0x3a2d4-0x0;var _0x29b9fb=_0x1aae[_0x3a2d4];return _0x29b9fb;};'use strict';var _=require(_0xe1aa('0x0'));var util=require(_0xe1aa('0x1'));var logger=require(_0xe1aa('0x2'))(_0xe1aa('0x3'));var moment=require('moment');var BPromise=require(_0xe1aa('0x4'));var rp=require(_0xe1aa('0x5'));var fs=require('fs');var path=require(_0xe1aa('0x6'));var rimraf=require(_0xe1aa('0x7'));var config=require('../../config/environment');var attributes=require(_0xe1aa('0x8'));module[_0xe1aa('0x9')]=function(_0x28eb72,_0x2ba7b8){return _0x28eb72[_0xe1aa('0xa')]('ServicenowField',attributes,{'tableName':'int_servicenow_fields','paranoid':![],'indexes':[{'name':_0xe1aa('0xb'),'fields':[_0xe1aa('0xc'),_0xe1aa('0xd')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x57f7=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./intServicenowField.attributes','define','ServicenowField','int_servicenow_fields','idField','FieldId','lodash','../../config/logger','api'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0x57f7,0x1b0));var _0x757f=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x57f7[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0x757f('0x0'));var util=require('util');var logger=require(_0x757f('0x1'))(_0x757f('0x2'));var moment=require(_0x757f('0x3'));var BPromise=require(_0x757f('0x4'));var rp=require(_0x757f('0x5'));var fs=require('fs');var path=require(_0x757f('0x6'));var rimraf=require(_0x757f('0x7'));var config=require(_0x757f('0x8'));var attributes=require(_0x757f('0x9'));module['exports']=function(_0x10a557,_0x3de484){return _0x10a557[_0x757f('0xa')](_0x757f('0xb'),attributes,{'tableName':_0x757f('0xc'),'paranoid':![],'indexes':[{'name':'servicenow_unique_index','fields':[_0x757f('0xd'),_0x757f('0xe')],'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 e3217ab..ab0feb3 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 _0xcb91=['stringify','error','code','message','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','request','info','ServicenowField,\x20%s,\x20%s','request\x20sent','debug','ServicenowField,\x20%s,\x20%s,\x20%s'];(function(_0x3a9623,_0x1ca157){var _0xf7c401=function(_0x8b55ae){while(--_0x8b55ae){_0x3a9623['push'](_0x3a9623['shift']());}};_0xf7c401(++_0x1ca157);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0xcb91[_0x40ebff];return _0x40122a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1cb9('0x0'));var BPromise=require(_0x1cb9('0x1'));var rs=require(_0x1cb9('0x2'));var fs=require('fs');var Redis=require(_0x1cb9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x1cb9('0x4'));var logger=require(_0x1cb9('0x5'))('rpc');var config=require(_0x1cb9('0x6'));var jayson=require(_0x1cb9('0x7'));var client=jayson['client'][_0x1cb9('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3f7deb,_0x4ffe20,_0x38737d){return new BPromise(function(_0x12567c,_0x59d1be){return client[_0x1cb9('0x9')](_0x3f7deb,_0x38737d)['then'](function(_0x567139){logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,_0x1cb9('0xc'));logger[_0x1cb9('0xd')](_0x1cb9('0xe'),_0x4ffe20,'request\x20sent',JSON[_0x1cb9('0xf')](_0x567139));if(_0x567139[_0x1cb9('0x10')]){if(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x11')]===0x1f4){logger[_0x1cb9('0x10')]('ServicenowField,\x20%s,\x20%s',_0x4ffe20,_0x567139['error']['message']);return _0x59d1be(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x567139['error'][_0x1cb9('0x12')]);return _0x12567c(_0x567139[_0x1cb9('0x10')][_0x1cb9('0x12')]);}else{logger[_0x1cb9('0xa')](_0x1cb9('0xb'),_0x4ffe20,'request\x20sent');_0x12567c(_0x567139['result'][_0x1cb9('0x12')]);}})[_0x1cb9('0x13')](function(_0x3904b7){logger[_0x1cb9('0x10')](_0x1cb9('0xb'),_0x4ffe20,_0x3904b7);_0x59d1be(_0x3904b7);});});} \ No newline at end of file +var _0xb7e7=['ServicenowField,\x20%s,\x20%s','debug','ServicenowField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','http','request','then','info'];(function(_0x56a1c4,_0x4792ed){var _0x15fb12=function(_0x20390f){while(--_0x20390f){_0x56a1c4['push'](_0x56a1c4['shift']());}};_0x15fb12(++_0x4792ed);}(_0xb7e7,0x121));var _0x7b7e=function(_0xf50820,_0x56f041){_0xf50820=_0xf50820-0x0;var _0x2a9b10=_0xb7e7[_0xf50820];return _0x2a9b10;};'use strict';var _=require(_0x7b7e('0x0'));var util=require('util');var moment=require(_0x7b7e('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b7e('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7b7e('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b7e('0x4'))(_0x7b7e('0x5'));var config=require(_0x7b7e('0x6'));var jayson=require('jayson/promise');var client=jayson['client'][_0x7b7e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x372bde,_0x7f87e0,_0x55ce81){return new BPromise(function(_0x42b871,_0x223587){return client[_0x7b7e('0x8')](_0x372bde,_0x55ce81)[_0x7b7e('0x9')](function(_0x148964){logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');logger[_0x7b7e('0xc')](_0x7b7e('0xd'),_0x7f87e0,_0x7b7e('0xe'),JSON[_0x7b7e('0xf')](_0x148964));if(_0x148964[_0x7b7e('0x10')]){if(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x11')]===0x1f4){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x223587(_0x148964[_0x7b7e('0x10')]['message']);}logger[_0x7b7e('0x10')]('ServicenowField,\x20%s,\x20%s',_0x7f87e0,_0x148964['error'][_0x7b7e('0x12')]);return _0x42b871(_0x148964[_0x7b7e('0x10')][_0x7b7e('0x12')]);}else{logger[_0x7b7e('0xa')](_0x7b7e('0xb'),_0x7f87e0,'request\x20sent');_0x42b871(_0x148964['result'][_0x7b7e('0x12')]);}})[_0x7b7e('0x13')](function(_0x27f999){logger[_0x7b7e('0x10')](_0x7b7e('0xb'),_0x7f87e0,_0x27f999);_0x223587(_0x27f999);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/index.js b/server/api/intSugarcrmAccount/index.js index f1f45ba..19357e2 100644 --- a/server/api/intSugarcrmAccount/index.js +++ b/server/api/intSugarcrmAccount/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x3adb39,_0x426ab4){var _0x3e5a43=function(_0x8bd8bc){while(--_0x8bd8bc){_0x3adb39['push'](_0x3adb39['shift']());}};_0x3e5a43(++_0x426ab4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ac595,_0x5d2081){_0x1ac595=_0x1ac595-0x0;var _0x455fff=_0xa9e0[_0x1ac595];return _0x455fff;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./intSugarcrmAccount.controller','get','index','/:id','getConfigurations','/:id/fields','isAuthenticated','getFields','post','addConfiguration','put','update','destroy','exports','multer','util','path'];(function(_0x593e98,_0x5f506a){var _0x4201e0=function(_0x3efd5a){while(--_0x3efd5a){_0x593e98['push'](_0x593e98['shift']());}};_0x4201e0(++_0x5f506a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0xa9e0[_0x24237f];return _0x48298e;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/configurations',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/configurations',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x11')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router['delete'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);module[_0x0a9e('0x14')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js index 84b9c8c..6560aba 100644 --- a/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js +++ b/server/api/intSugarcrmAccount/intSugarcrmAccount.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0x22c6e4,_0x25e27f){var _0x14e051=function(_0x2b42d2){while(--_0x2b42d2){_0x22c6e4['push'](_0x22c6e4['shift']());}};_0x14e051(++_0x25e27f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3635ce,_0x33a6f9){_0x3635ce=_0x3635ce-0x0;var _0x97ecd0=_0xa9e0[_0x3635ce];return _0x97ecd0;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0xa9e0=['remoteUri','sequelize','exports','STRING','username'];(function(_0xa2a8dc,_0x583ef7){var _0x1c278e=function(_0x3044a9){while(--_0x3044a9){_0xa2a8dc['push'](_0xa2a8dc['shift']());}};_0x1c278e(++_0x583ef7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'name':{'type':Sequelize[_0x0a9e('0x2')]},'description':{'type':Sequelize['STRING']},'username':{'type':Sequelize['STRING'],'unique':_0x0a9e('0x3')},'password':{'type':Sequelize['STRING']},'remoteUri':{'type':Sequelize[_0x0a9e('0x2')],'unique':_0x0a9e('0x4')},'serverUrl':{'type':Sequelize[_0x0a9e('0x2')],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.controller.js index b5f09be..04fc9de 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 _0xe9ae=['lastIndexOf','POST','format','%s%s','/service/v4_1/rest.php','login','JSON','stringify','password','xCALLY\x20Motion\x20Integration','Invalid\x20Login','get_module_fields','Calls','values','module_fields','label','value','test','statusCode','error','getFields,\x20%s,\x20%s,\x20%s','getFields','Wrong\x20credentials','send','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','ejs','fs-extra','crypto','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','map','SugarcrmAccount','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','show','params','rawAttributes','find','create','body','getConfigurations','findOne','SugarcrmConfiguration','length','nolimit','AccountId','Subjects','getSubjects','channel','Descriptions','SugarcrmField','description','date_start','duration_hours','duration_minutes','parent_id','parent_type','direction','username','remoteUri','substring'];(function(_0x3af730,_0x37e8a6){var _0x2fc7b1=function(_0x582aa7){while(--_0x582aa7){_0x3af730['push'](_0x3af730['shift']());}};_0x2fc7b1(++_0x37e8a6);}(_0xe9ae,0x1e8));var _0xee9a=function(_0x4c34d7,_0x1983a9){_0x4c34d7=_0x4c34d7-0x0;var _0xe01f72=_0xe9ae[_0x4c34d7];return _0xe01f72;};'use strict';var emlformat=require(_0xee9a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xee9a('0x1'));var jsonpatch=require(_0xee9a('0x2'));var rp=require('request-promise');var moment=require(_0xee9a('0x3'));var BPromise=require(_0xee9a('0x4'));var Mustache=require(_0xee9a('0x5'));var util=require(_0xee9a('0x6'));var path=require('path');var sox=require(_0xee9a('0x7'));var csv=require('to-csv');var ejs=require(_0xee9a('0x8'));var fs=require('fs');var fs_extra=require(_0xee9a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xee9a('0xa'));var jsforce=require(_0xee9a('0xb'));var deskjs=require(_0xee9a('0xc'));var toCsv=require(_0xee9a('0xd'));var querystring=require('querystring');var Papa=require(_0xee9a('0xe'));var Redis=require('ioredis');var authService=require(_0xee9a('0xf'));var qs=require(_0xee9a('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xee9a('0x11'));var logger=require(_0xee9a('0x12'))(_0xee9a('0x13'));var utils=require(_0xee9a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xee9a('0x15'));var db=require(_0xee9a('0x16'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x56a6b7,_0x190b48){_0x190b48=_0x190b48||0xcc;return function(_0x231a8b){if(_0x231a8b){return _0x56a6b7[_0xee9a('0x17')](_0x190b48);}return _0x56a6b7[_0xee9a('0x18')](_0x190b48)['end']();};}function respondWithResult(_0x3bd611,_0x3b77f8){_0x3b77f8=_0x3b77f8||0xc8;return function(_0x488ae6){if(_0x488ae6){return _0x3bd611['status'](_0x3b77f8)[_0xee9a('0x19')](_0x488ae6);}};}function respondWithFilteredResult(_0x1ce1f2,_0x53752e){return function(_0x2edf32){if(_0x2edf32){var _0x57eae5=typeof _0x53752e['offset']===_0xee9a('0x1a')&&typeof _0x53752e[_0xee9a('0x1b')]==='undefined';var _0x2ca71b=_0x2edf32[_0xee9a('0x1c')];var _0x45ad74=_0x57eae5?0x0:_0x53752e['offset'];var _0x467559=_0x57eae5?_0x2edf32[_0xee9a('0x1c')]:_0x53752e[_0xee9a('0x1d')]+_0x53752e['limit'];var _0x585243;if(_0x467559>=_0x2ca71b){_0x467559=_0x2ca71b;_0x585243=0xc8;}else{_0x585243=0xce;}_0x1ce1f2[_0xee9a('0x18')](_0x585243);return _0x1ce1f2[_0xee9a('0x1e')](_0xee9a('0x1f'),_0x45ad74+'-'+_0x467559+'/'+_0x2ca71b)['json'](_0x2edf32);}return null;};}function patchUpdates(_0x3abd90){return function(_0x3d493e){try{jsonpatch[_0xee9a('0x20')](_0x3d493e,_0x3abd90,!![]);}catch(_0x470cc6){return BPromise[_0xee9a('0x21')](_0x470cc6);}return _0x3d493e[_0xee9a('0x22')]();};}function saveUpdates(_0x451185,_0xa4560d){return function(_0x8e2c2e){if(_0x8e2c2e){return _0x8e2c2e[_0xee9a('0x23')](_0x451185)[_0xee9a('0x24')](function(_0x54181b){return _0x54181b;});}return null;};}function removeEntity(_0x4750cf,_0x586d5f){return function(_0x5ebfb9){if(_0x5ebfb9){return _0x5ebfb9[_0xee9a('0x25')]()[_0xee9a('0x24')](function(){_0x4750cf[_0xee9a('0x18')](0xcc)[_0xee9a('0x26')]();});}};}function handleEntityNotFound(_0x3980dc,_0x4fc561){return function(_0x1a619b){if(!_0x1a619b){_0x3980dc[_0xee9a('0x17')](0x194);}return _0x1a619b;};}function handleError(_0x4212c2,_0x23e0ea){_0x23e0ea=_0x23e0ea||0x1f4;return function(_0x3e78b4){logger['error'](_0x3e78b4[_0xee9a('0x27')]);if(_0x3e78b4[_0xee9a('0x28')]){delete _0x3e78b4[_0xee9a('0x28')];}_0x4212c2[_0xee9a('0x18')](_0x23e0ea)['send'](_0x3e78b4);};}exports[_0xee9a('0x29')]=function(_0x269d19,_0x55f438){var _0x1ac7fa={},_0x456ff8={},_0x2b6a54={'count':0x0,'rows':[]};var _0x9fb67b=_[_0xee9a('0x2a')](db[_0xee9a('0x2b')]['rawAttributes'],function(_0x137946){return{'name':_0x137946[_0xee9a('0x2c')],'type':_0x137946[_0xee9a('0x2d')]['key']};});_0x456ff8[_0xee9a('0x2e')]=_['map'](_0x9fb67b,_0xee9a('0x28'));_0x456ff8[_0xee9a('0x2f')]=_[_0xee9a('0x30')](_0x269d19['query']);_0x456ff8[_0xee9a('0x31')]=_[_0xee9a('0x32')](_0x456ff8['model'],_0x456ff8[_0xee9a('0x2f')]);_0x1ac7fa['attributes']=_[_0xee9a('0x32')](_0x456ff8[_0xee9a('0x2e')],qs[_0xee9a('0x33')](_0x269d19[_0xee9a('0x2f')][_0xee9a('0x33')]));_0x1ac7fa['attributes']=_0x1ac7fa[_0xee9a('0x34')]['length']?_0x1ac7fa['attributes']:_0x456ff8['model'];if(!_0x269d19[_0xee9a('0x2f')][_0xee9a('0x35')]('nolimit')){_0x1ac7fa[_0xee9a('0x1b')]=qs[_0xee9a('0x1b')](_0x269d19['query'][_0xee9a('0x1b')]);_0x1ac7fa[_0xee9a('0x1d')]=qs[_0xee9a('0x1d')](_0x269d19[_0xee9a('0x2f')]['offset']);}_0x1ac7fa['order']=qs[_0xee9a('0x36')](_0x269d19[_0xee9a('0x2f')][_0xee9a('0x36')]);_0x1ac7fa[_0xee9a('0x37')]=qs['filters'](_[_0xee9a('0x38')](_0x269d19['query'],_0x456ff8['filters']),_0x9fb67b);if(_0x269d19[_0xee9a('0x2f')]['filter']){_0x1ac7fa[_0xee9a('0x37')]=_[_0xee9a('0x39')](_0x1ac7fa[_0xee9a('0x37')],{'$or':_[_0xee9a('0x2a')](_0x9fb67b,function(_0x20c58f){if(_0x20c58f[_0xee9a('0x2d')]!==_0xee9a('0x3a')){var _0xb8a1ef={};_0xb8a1ef[_0x20c58f[_0xee9a('0x28')]]={'$like':'%'+_0x269d19[_0xee9a('0x2f')][_0xee9a('0x3b')]+'%'};return _0xb8a1ef;}})});}_0x1ac7fa=_[_0xee9a('0x39')]({},_0x1ac7fa,_0x269d19[_0xee9a('0x3c')]);var _0x26c09f={'where':_0x1ac7fa[_0xee9a('0x37')]};return db[_0xee9a('0x2b')][_0xee9a('0x1c')](_0x26c09f)[_0xee9a('0x24')](function(_0x36f282){_0x2b6a54[_0xee9a('0x1c')]=_0x36f282;if(_0x269d19[_0xee9a('0x2f')][_0xee9a('0x3d')]){_0x1ac7fa['include']=[{'all':!![]}];}return db[_0xee9a('0x2b')][_0xee9a('0x3e')](_0x1ac7fa);})[_0xee9a('0x24')](function(_0x4db771){_0x2b6a54[_0xee9a('0x3f')]=_0x4db771;return _0x2b6a54;})[_0xee9a('0x24')](respondWithFilteredResult(_0x55f438,_0x1ac7fa))[_0xee9a('0x40')](handleError(_0x55f438,null));};exports[_0xee9a('0x41')]=function(_0xf40c73,_0x29d7a2){var _0x12c516={'raw':![],'where':{'id':_0xf40c73[_0xee9a('0x42')]['id']}},_0x3693b5={};_0x3693b5[_0xee9a('0x2e')]=_[_0xee9a('0x30')](db[_0xee9a('0x2b')][_0xee9a('0x43')]);_0x3693b5[_0xee9a('0x2f')]=_[_0xee9a('0x30')](_0xf40c73[_0xee9a('0x2f')]);_0x3693b5[_0xee9a('0x31')]=_[_0xee9a('0x32')](_0x3693b5[_0xee9a('0x2e')],_0x3693b5[_0xee9a('0x2f')]);_0x12c516[_0xee9a('0x34')]=_[_0xee9a('0x32')](_0x3693b5['model'],qs['fields'](_0xf40c73['query'][_0xee9a('0x33')]));_0x12c516[_0xee9a('0x34')]=_0x12c516[_0xee9a('0x34')]['length']?_0x12c516[_0xee9a('0x34')]:_0x3693b5[_0xee9a('0x2e')];if(_0xf40c73[_0xee9a('0x2f')][_0xee9a('0x3d')]){_0x12c516['include']=[{'all':!![]}];}_0x12c516=_[_0xee9a('0x39')]({},_0x12c516,_0xf40c73['options']);return db[_0xee9a('0x2b')][_0xee9a('0x44')](_0x12c516)[_0xee9a('0x24')](handleEntityNotFound(_0x29d7a2,null))[_0xee9a('0x24')](respondWithResult(_0x29d7a2,null))[_0xee9a('0x40')](handleError(_0x29d7a2,null));};exports['create']=function(_0x514a62,_0x375c7e){return db['SugarcrmAccount'][_0xee9a('0x45')](_0x514a62[_0xee9a('0x46')],{})[_0xee9a('0x24')](respondWithResult(_0x375c7e,0xc9))['catch'](handleError(_0x375c7e,null));};exports['update']=function(_0x5066d0,_0x490b25){if(_0x5066d0[_0xee9a('0x46')]['id']){delete _0x5066d0[_0xee9a('0x46')]['id'];}return db[_0xee9a('0x2b')]['find']({'where':{'id':_0x5066d0['params']['id']}})[_0xee9a('0x24')](handleEntityNotFound(_0x490b25,null))[_0xee9a('0x24')](saveUpdates(_0x5066d0[_0xee9a('0x46')],null))[_0xee9a('0x24')](respondWithResult(_0x490b25,null))[_0xee9a('0x40')](handleError(_0x490b25,null));};exports[_0xee9a('0x25')]=function(_0x3a640d,_0x124336){return db[_0xee9a('0x2b')][_0xee9a('0x44')]({'where':{'id':_0x3a640d['params']['id']}})['then'](handleEntityNotFound(_0x124336,null))[_0xee9a('0x24')](removeEntity(_0x124336,null))['catch'](handleError(_0x124336,null));};exports[_0xee9a('0x47')]=function(_0x5bfac7,_0x16ee98,_0x267999){var _0x3cdc5e={};var _0x2d1304={};var _0x5c2b1f;var _0x457473;return db[_0xee9a('0x2b')][_0xee9a('0x48')]({'where':{'id':_0x5bfac7['params']['id']}})[_0xee9a('0x24')](handleEntityNotFound(_0x16ee98,null))[_0xee9a('0x24')](function(_0x276fb3){if(_0x276fb3){_0x5c2b1f=_0x276fb3;_0x2d1304[_0xee9a('0x2e')]=_[_0xee9a('0x30')](db[_0xee9a('0x49')]['rawAttributes']);_0x2d1304[_0xee9a('0x2f')]=_[_0xee9a('0x30')](_0x5bfac7[_0xee9a('0x2f')]);_0x2d1304[_0xee9a('0x31')]=_[_0xee9a('0x32')](_0x2d1304[_0xee9a('0x2e')],_0x2d1304[_0xee9a('0x2f')]);_0x3cdc5e['attributes']=_[_0xee9a('0x32')](_0x2d1304[_0xee9a('0x2e')],qs[_0xee9a('0x33')](_0x5bfac7[_0xee9a('0x2f')][_0xee9a('0x33')]));_0x3cdc5e[_0xee9a('0x34')]=_0x3cdc5e[_0xee9a('0x34')][_0xee9a('0x4a')]?_0x3cdc5e[_0xee9a('0x34')]:_0x2d1304[_0xee9a('0x2e')];_0x3cdc5e['order']=qs[_0xee9a('0x36')](_0x5bfac7[_0xee9a('0x2f')][_0xee9a('0x36')]);_0x3cdc5e['where']=qs[_0xee9a('0x31')](_[_0xee9a('0x38')](_0x5bfac7[_0xee9a('0x2f')],_0x2d1304[_0xee9a('0x31')]));if(_0x5bfac7['query'][_0xee9a('0x3b')]){_0x3cdc5e[_0xee9a('0x37')]=_[_0xee9a('0x39')](_0x3cdc5e[_0xee9a('0x37')],{'$or':_[_0xee9a('0x2a')](_0x3cdc5e['attributes'],function(_0x5b38b4){var _0x43ff7a={};_0x43ff7a[_0x5b38b4]={'$like':'%'+_0x5bfac7[_0xee9a('0x2f')][_0xee9a('0x3b')]+'%'};return _0x43ff7a;})});}_0x3cdc5e=_[_0xee9a('0x39')]({},_0x3cdc5e,_0x5bfac7[_0xee9a('0x3c')]);return _0x5c2b1f[_0xee9a('0x47')](_0x3cdc5e);}})[_0xee9a('0x24')](function(_0x29a38c){if(_0x29a38c){_0x457473=_0x29a38c[_0xee9a('0x4a')];if(!_0x5bfac7[_0xee9a('0x2f')][_0xee9a('0x35')](_0xee9a('0x4b'))){_0x3cdc5e['limit']=qs[_0xee9a('0x1b')](_0x5bfac7[_0xee9a('0x2f')][_0xee9a('0x1b')]);_0x3cdc5e[_0xee9a('0x1d')]=qs['offset'](_0x5bfac7[_0xee9a('0x2f')][_0xee9a('0x1d')]);}return _0x5c2b1f[_0xee9a('0x47')](_0x3cdc5e);}})[_0xee9a('0x24')](function(_0x3465d4){if(_0x3465d4){return _0x3465d4?{'count':_0x457473,'rows':_0x3465d4}:null;}})['then'](respondWithResult(_0x16ee98,null))[_0xee9a('0x40')](handleError(_0x16ee98,null));};exports['addConfiguration']=function(_0x37f0a2,_0x4eea85,_0x36dd80){if(_0x37f0a2[_0xee9a('0x46')]['id']){delete _0x37f0a2[_0xee9a('0x46')]['id'];}return db[_0xee9a('0x2b')]['findOne']({'where':{'id':_0x37f0a2['params']['id']}})['then'](handleEntityNotFound(_0x4eea85,null))[_0xee9a('0x24')](function(_0x440d44){if(_0x440d44){_0x37f0a2[_0xee9a('0x46')][_0xee9a('0x4c')]=_0x440d44['id'];_0x37f0a2[_0xee9a('0x46')][_0xee9a('0x4d')]=integrations[_0xee9a('0x4e')](_0x37f0a2[_0xee9a('0x46')][_0xee9a('0x4f')],_0x37f0a2[_0xee9a('0x46')][_0xee9a('0x2d')]);_0x37f0a2[_0xee9a('0x46')][_0xee9a('0x50')]=integrations['getDescriptions'](_0x37f0a2[_0xee9a('0x46')][_0xee9a('0x4f')],_0x37f0a2[_0xee9a('0x46')][_0xee9a('0x2d')]);return db[_0xee9a('0x49')][_0xee9a('0x45')](_0x37f0a2[_0xee9a('0x46')],{'include':[{'model':db[_0xee9a('0x51')],'as':_0xee9a('0x4d')},{'model':db['SugarcrmField'],'as':_0xee9a('0x50')}]});}return null;})['then'](respondWithResult(_0x4eea85,null))[_0xee9a('0x40')](handleError(_0x4eea85,null));};exports['getFields']=function(_0x52f35,_0x39fac3,_0x4d8b60){var _0x4498d='';var _0x67ff5a=['id','name','assigned_user_id','created_by',_0xee9a('0x52'),_0xee9a('0x53'),_0xee9a('0x54'),_0xee9a('0x55'),_0xee9a('0x56'),_0xee9a('0x57'),'parent_name',_0xee9a('0x58')];return db[_0xee9a('0x2b')][_0xee9a('0x48')]({'where':{'id':_0x52f35[_0xee9a('0x42')]['id']},'attributes':['id',_0xee9a('0x59'),'password',_0xee9a('0x5a')]})[_0xee9a('0x24')](handleEntityNotFound(_0x39fac3,null))[_0xee9a('0x24')](function(_0x2369a7){if(_0x2369a7){_0x4498d=_0x2369a7[_0xee9a('0x5a')];var _0x48f26d=_0x4498d['slice'](-0x1);if(_0x48f26d==='/'){_0x4498d=_0x4498d[_0xee9a('0x5b')](0x0,_0x4498d[_0xee9a('0x5c')](_0x48f26d));}return rp({'method':_0xee9a('0x5d'),'uri':util[_0xee9a('0x5e')](_0xee9a('0x5f'),_0x4498d,_0xee9a('0x60')),'json':!![],'form':{'method':_0xee9a('0x61'),'input_type':_0xee9a('0x62'),'response_type':_0xee9a('0x62'),'rest_data':JSON[_0xee9a('0x63')]({'user_auth':{'user_name':_0x2369a7[_0xee9a('0x59')],'password':_0x2369a7[_0xee9a('0x64')],'encryption':'PLAIN'},'application':_0xee9a('0x65')})}});}})['then'](function(_0x5b279c){if(_0x5b279c&&_0x5b279c['name']!==_0xee9a('0x66')&&_0x5b279c[_0xee9a('0x28')]!=='Password\x20Expired'){return rp({'method':_0xee9a('0x5d'),'uri':util[_0xee9a('0x5e')]('%s%s',_0x4498d,_0xee9a('0x60')),'json':!![],'form':{'method':_0xee9a('0x67'),'input_type':_0xee9a('0x62'),'response_type':_0xee9a('0x62'),'rest_data':JSON[_0xee9a('0x63')]({'session':_0x5b279c['id'],'module_name':_0xee9a('0x68')})}})[_0xee9a('0x24')](function(_0x154ee1){if(_0x154ee1){var _0x4be02b=_[_0xee9a('0x69')](_0x154ee1[_0xee9a('0x6a')]);_['remove'](_0x4be02b,function(_0x3d1902){return _0x67ff5a['includes'](_0x3d1902[_0xee9a('0x28')]);});return{'count':_0x4be02b['length'],'rows':_[_0xee9a('0x2a')](_0x4be02b,function(_0x78e11c){return{'id':_0x78e11c[_0xee9a('0x28')],'name':_0x78e11c[_0xee9a('0x6b')],'custom':_['endsWith'](_0x78e11c[_0xee9a('0x28')],'_c')?!![]:![],'options':_0x78e11c[_0xee9a('0x3c')]?_[_0xee9a('0x2a')](_['values'](_0x78e11c[_0xee9a('0x3c')]),function(_0x3ae4c6){return{'name':_0x3ae4c6[_0xee9a('0x6c')],'value':_0x3ae4c6[_0xee9a('0x28')]};}):[]};})};}})[_0xee9a('0x24')](respondWithResult(_0x39fac3,null))[_0xee9a('0x40')](function(_0x801fb3){var _0x5b231c=_0x52f35[_0xee9a('0x2f')][_0xee9a('0x6d')]?0x1f4:_0x801fb3[_0xee9a('0x6e')]||0x1f4;logger[_0xee9a('0x6f')](_0xee9a('0x70'),_0xee9a('0x71'),_0x5b231c,JSON['stringify'](_0x801fb3));delete _0x801fb3[_0xee9a('0x28')];if(_0x5b231c===0x191){_0x5b231c=0x190;}_0x39fac3['status'](_0x5b231c)['send'](_0x52f35[_0xee9a('0x2f')][_0xee9a('0x6d')]?{'message':_0xee9a('0x72'),'statusCode':_0x801fb3[_0xee9a('0x6e')]}:_0x801fb3);});}else{var _0x265a9a=0x1f4;_0x39fac3['status'](_0x265a9a)[_0xee9a('0x73')]({'message':_0xee9a('0x72'),'statusCode':0x190});}});}; \ No newline at end of file +var _0x2199=['request-promise','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','api','../../config/utils','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','set','Content-Range','reject','save','update','then','error','stack','index','map','SugarcrmAccount','fieldName','key','model','name','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','find','catch','create','body','destroy','getConfigurations','findOne','SugarcrmConfiguration','addConfiguration','Subjects','channel','getDescriptions','SugarcrmField','Descriptions','getFields','assigned_user_id','date_start','duration_hours','parent_id','parent_name','direction','username','password','remoteUri','slice','lastIndexOf','POST','format','%s%s','login','JSON','PLAIN','xCALLY\x20Motion\x20Integration','Invalid\x20Login','/service/v4_1/rest.php','get_module_fields','Calls','values','module_fields','remove','includes','label','value','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','send','rimraf','zip-dir'];(function(_0xd41f6c,_0x2ee0b2){var _0x4db302=function(_0x1446d9){while(--_0x1446d9){_0xd41f6c['push'](_0xd41f6c['shift']());}};_0x4db302(++_0x2ee0b2);}(_0x2199,0x1ce));var _0x9219=function(_0xd4d193,_0x1b7e89){_0xd4d193=_0xd4d193-0x0;var _0x3de8d1=_0x2199[_0xd4d193];return _0x3de8d1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x9219('0x0'));var zipdir=require(_0x9219('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x9219('0x2'));var moment=require('moment');var BPromise=require(_0x9219('0x3'));var Mustache=require(_0x9219('0x4'));var util=require(_0x9219('0x5'));var path=require(_0x9219('0x6'));var sox=require('sox');var csv=require(_0x9219('0x7'));var ejs=require(_0x9219('0x8'));var fs=require('fs');var fs_extra=require(_0x9219('0x9'));var _=require(_0x9219('0xa'));var squel=require(_0x9219('0xb'));var crypto=require(_0x9219('0xc'));var jsforce=require(_0x9219('0xd'));var deskjs=require(_0x9219('0xe'));var toCsv=require(_0x9219('0x7'));var querystring=require(_0x9219('0xf'));var Papa=require(_0x9219('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9219('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9219('0x12'));var utils=require(_0x9219('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x9219('0x14'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x15fa46,_0x1914c5){_0x1914c5=_0x1914c5||0xcc;return function(_0x396bdd){if(_0x396bdd){return _0x15fa46[_0x9219('0x15')](_0x1914c5);}return _0x15fa46['status'](_0x1914c5)[_0x9219('0x16')]();};}function respondWithResult(_0x235944,_0xd6e630){_0xd6e630=_0xd6e630||0xc8;return function(_0x5dfc6a){if(_0x5dfc6a){return _0x235944[_0x9219('0x17')](_0xd6e630)[_0x9219('0x18')](_0x5dfc6a);}};}function respondWithFilteredResult(_0x39e963,_0x50a1be){return function(_0x556967){if(_0x556967){var _0xd13f6=typeof _0x50a1be[_0x9219('0x19')]===_0x9219('0x1a')&&typeof _0x50a1be[_0x9219('0x1b')]==='undefined';var _0x5aeb79=_0x556967[_0x9219('0x1c')];var _0x4b013b=_0xd13f6?0x0:_0x50a1be['offset'];var _0x107084=_0xd13f6?_0x556967['count']:_0x50a1be['offset']+_0x50a1be[_0x9219('0x1b')];var _0x5e3983;if(_0x107084>=_0x5aeb79){_0x107084=_0x5aeb79;_0x5e3983=0xc8;}else{_0x5e3983=0xce;}_0x39e963[_0x9219('0x17')](_0x5e3983);return _0x39e963[_0x9219('0x1d')](_0x9219('0x1e'),_0x4b013b+'-'+_0x107084+'/'+_0x5aeb79)[_0x9219('0x18')](_0x556967);}return null;};}function patchUpdates(_0x27790b){return function(_0x4a1b39){try{jsonpatch['apply'](_0x4a1b39,_0x27790b,!![]);}catch(_0x2ff310){return BPromise[_0x9219('0x1f')](_0x2ff310);}return _0x4a1b39[_0x9219('0x20')]();};}function saveUpdates(_0x258497,_0x1cec2d){return function(_0x12e6a5){if(_0x12e6a5){return _0x12e6a5[_0x9219('0x21')](_0x258497)['then'](function(_0x37d2f8){return _0x37d2f8;});}return null;};}function removeEntity(_0x2fe27f,_0x21d3c2){return function(_0x4f57af){if(_0x4f57af){return _0x4f57af['destroy']()[_0x9219('0x22')](function(){_0x2fe27f[_0x9219('0x17')](0xcc)[_0x9219('0x16')]();});}};}function handleEntityNotFound(_0x1bceb3,_0x2a6669){return function(_0x30d3c5){if(!_0x30d3c5){_0x1bceb3[_0x9219('0x15')](0x194);}return _0x30d3c5;};}function handleError(_0x3f3bab,_0x524189){_0x524189=_0x524189||0x1f4;return function(_0x5ce95a){logger[_0x9219('0x23')](_0x5ce95a[_0x9219('0x24')]);if(_0x5ce95a['name']){delete _0x5ce95a['name'];}_0x3f3bab['status'](_0x524189)['send'](_0x5ce95a);};}exports[_0x9219('0x25')]=function(_0x17fa10,_0x5376c6){var _0x2b891b={},_0x2f9ba1={},_0x7128b0={'count':0x0,'rows':[]};var _0xd3099e=_[_0x9219('0x26')](db[_0x9219('0x27')]['rawAttributes'],function(_0x3d572c){return{'name':_0x3d572c[_0x9219('0x28')],'type':_0x3d572c['type'][_0x9219('0x29')]};});_0x2f9ba1[_0x9219('0x2a')]=_[_0x9219('0x26')](_0xd3099e,_0x9219('0x2b'));_0x2f9ba1['query']=_['keys'](_0x17fa10[_0x9219('0x2c')]);_0x2f9ba1[_0x9219('0x2d')]=_[_0x9219('0x2e')](_0x2f9ba1[_0x9219('0x2a')],_0x2f9ba1['query']);_0x2b891b[_0x9219('0x2f')]=_[_0x9219('0x2e')](_0x2f9ba1[_0x9219('0x2a')],qs[_0x9219('0x30')](_0x17fa10[_0x9219('0x2c')][_0x9219('0x30')]));_0x2b891b['attributes']=_0x2b891b[_0x9219('0x2f')][_0x9219('0x31')]?_0x2b891b[_0x9219('0x2f')]:_0x2f9ba1['model'];if(!_0x17fa10[_0x9219('0x2c')][_0x9219('0x32')](_0x9219('0x33'))){_0x2b891b[_0x9219('0x1b')]=qs[_0x9219('0x1b')](_0x17fa10[_0x9219('0x2c')][_0x9219('0x1b')]);_0x2b891b[_0x9219('0x19')]=qs['offset'](_0x17fa10[_0x9219('0x2c')][_0x9219('0x19')]);}_0x2b891b[_0x9219('0x34')]=qs['sort'](_0x17fa10[_0x9219('0x2c')][_0x9219('0x35')]);_0x2b891b['where']=qs['filters'](_[_0x9219('0x36')](_0x17fa10['query'],_0x2f9ba1[_0x9219('0x2d')]),_0xd3099e);if(_0x17fa10[_0x9219('0x2c')][_0x9219('0x37')]){_0x2b891b[_0x9219('0x38')]=_['merge'](_0x2b891b[_0x9219('0x38')],{'$or':_[_0x9219('0x26')](_0xd3099e,function(_0x2d4c6f){if(_0x2d4c6f[_0x9219('0x39')]!==_0x9219('0x3a')){var _0x4534c2={};_0x4534c2[_0x2d4c6f[_0x9219('0x2b')]]={'$like':'%'+_0x17fa10[_0x9219('0x2c')][_0x9219('0x37')]+'%'};return _0x4534c2;}})});}_0x2b891b=_[_0x9219('0x3b')]({},_0x2b891b,_0x17fa10[_0x9219('0x3c')]);var _0x1f7cdb={'where':_0x2b891b['where']};return db[_0x9219('0x27')]['count'](_0x1f7cdb)[_0x9219('0x22')](function(_0x15809b){_0x7128b0[_0x9219('0x1c')]=_0x15809b;if(_0x17fa10[_0x9219('0x2c')][_0x9219('0x3d')]){_0x2b891b[_0x9219('0x3e')]=[{'all':!![]}];}return db[_0x9219('0x27')][_0x9219('0x3f')](_0x2b891b);})[_0x9219('0x22')](function(_0x2b2d23){_0x7128b0[_0x9219('0x40')]=_0x2b2d23;return _0x7128b0;})['then'](respondWithFilteredResult(_0x5376c6,_0x2b891b))['catch'](handleError(_0x5376c6,null));};exports[_0x9219('0x41')]=function(_0xe0ea44,_0x203c60){var _0xd1b20e={'raw':![],'where':{'id':_0xe0ea44[_0x9219('0x42')]['id']}},_0x5de5b0={};_0x5de5b0[_0x9219('0x2a')]=_[_0x9219('0x43')](db[_0x9219('0x27')][_0x9219('0x44')]);_0x5de5b0[_0x9219('0x2c')]=_[_0x9219('0x43')](_0xe0ea44[_0x9219('0x2c')]);_0x5de5b0['filters']=_[_0x9219('0x2e')](_0x5de5b0[_0x9219('0x2a')],_0x5de5b0[_0x9219('0x2c')]);_0xd1b20e['attributes']=_[_0x9219('0x2e')](_0x5de5b0[_0x9219('0x2a')],qs[_0x9219('0x30')](_0xe0ea44['query'][_0x9219('0x30')]));_0xd1b20e[_0x9219('0x2f')]=_0xd1b20e[_0x9219('0x2f')][_0x9219('0x31')]?_0xd1b20e[_0x9219('0x2f')]:_0x5de5b0[_0x9219('0x2a')];if(_0xe0ea44[_0x9219('0x2c')][_0x9219('0x3d')]){_0xd1b20e[_0x9219('0x3e')]=[{'all':!![]}];}_0xd1b20e=_[_0x9219('0x3b')]({},_0xd1b20e,_0xe0ea44[_0x9219('0x3c')]);return db['SugarcrmAccount'][_0x9219('0x45')](_0xd1b20e)[_0x9219('0x22')](handleEntityNotFound(_0x203c60,null))['then'](respondWithResult(_0x203c60,null))[_0x9219('0x46')](handleError(_0x203c60,null));};exports[_0x9219('0x47')]=function(_0x24fb4e,_0x4889d4){return db['SugarcrmAccount'][_0x9219('0x47')](_0x24fb4e[_0x9219('0x48')],{})[_0x9219('0x22')](respondWithResult(_0x4889d4,0xc9))[_0x9219('0x46')](handleError(_0x4889d4,null));};exports['update']=function(_0x1cfae8,_0x238bed){if(_0x1cfae8[_0x9219('0x48')]['id']){delete _0x1cfae8[_0x9219('0x48')]['id'];}return db[_0x9219('0x27')][_0x9219('0x45')]({'where':{'id':_0x1cfae8[_0x9219('0x42')]['id']}})['then'](handleEntityNotFound(_0x238bed,null))[_0x9219('0x22')](saveUpdates(_0x1cfae8[_0x9219('0x48')],null))[_0x9219('0x22')](respondWithResult(_0x238bed,null))[_0x9219('0x46')](handleError(_0x238bed,null));};exports[_0x9219('0x49')]=function(_0x52d9f4,_0x4f304a){return db[_0x9219('0x27')][_0x9219('0x45')]({'where':{'id':_0x52d9f4[_0x9219('0x42')]['id']}})[_0x9219('0x22')](handleEntityNotFound(_0x4f304a,null))[_0x9219('0x22')](removeEntity(_0x4f304a,null))[_0x9219('0x46')](handleError(_0x4f304a,null));};exports[_0x9219('0x4a')]=function(_0x332a20,_0x40cc79,_0x20e797){var _0x599c1f={};var _0x479e5e={};var _0x2a9378;var _0x102963;return db['SugarcrmAccount'][_0x9219('0x4b')]({'where':{'id':_0x332a20[_0x9219('0x42')]['id']}})[_0x9219('0x22')](handleEntityNotFound(_0x40cc79,null))['then'](function(_0x59544a){if(_0x59544a){_0x2a9378=_0x59544a;_0x479e5e[_0x9219('0x2a')]=_['keys'](db[_0x9219('0x4c')]['rawAttributes']);_0x479e5e['query']=_['keys'](_0x332a20['query']);_0x479e5e[_0x9219('0x2d')]=_['intersection'](_0x479e5e[_0x9219('0x2a')],_0x479e5e[_0x9219('0x2c')]);_0x599c1f[_0x9219('0x2f')]=_[_0x9219('0x2e')](_0x479e5e['model'],qs[_0x9219('0x30')](_0x332a20[_0x9219('0x2c')][_0x9219('0x30')]));_0x599c1f[_0x9219('0x2f')]=_0x599c1f['attributes']['length']?_0x599c1f['attributes']:_0x479e5e[_0x9219('0x2a')];_0x599c1f[_0x9219('0x34')]=qs[_0x9219('0x35')](_0x332a20[_0x9219('0x2c')]['sort']);_0x599c1f['where']=qs[_0x9219('0x2d')](_[_0x9219('0x36')](_0x332a20['query'],_0x479e5e[_0x9219('0x2d')]));if(_0x332a20[_0x9219('0x2c')][_0x9219('0x37')]){_0x599c1f[_0x9219('0x38')]=_[_0x9219('0x3b')](_0x599c1f[_0x9219('0x38')],{'$or':_[_0x9219('0x26')](_0x599c1f[_0x9219('0x2f')],function(_0x3a6382){var _0x19c3ce={};_0x19c3ce[_0x3a6382]={'$like':'%'+_0x332a20[_0x9219('0x2c')][_0x9219('0x37')]+'%'};return _0x19c3ce;})});}_0x599c1f=_['merge']({},_0x599c1f,_0x332a20[_0x9219('0x3c')]);return _0x2a9378[_0x9219('0x4a')](_0x599c1f);}})[_0x9219('0x22')](function(_0x21dbdc){if(_0x21dbdc){_0x102963=_0x21dbdc[_0x9219('0x31')];if(!_0x332a20[_0x9219('0x2c')][_0x9219('0x32')](_0x9219('0x33'))){_0x599c1f[_0x9219('0x1b')]=qs[_0x9219('0x1b')](_0x332a20[_0x9219('0x2c')][_0x9219('0x1b')]);_0x599c1f[_0x9219('0x19')]=qs[_0x9219('0x19')](_0x332a20[_0x9219('0x2c')][_0x9219('0x19')]);}return _0x2a9378[_0x9219('0x4a')](_0x599c1f);}})[_0x9219('0x22')](function(_0x287cb4){if(_0x287cb4){return _0x287cb4?{'count':_0x102963,'rows':_0x287cb4}:null;}})[_0x9219('0x22')](respondWithResult(_0x40cc79,null))[_0x9219('0x46')](handleError(_0x40cc79,null));};exports[_0x9219('0x4d')]=function(_0x5ed619,_0x4564f7,_0x1cbef3){if(_0x5ed619[_0x9219('0x48')]['id']){delete _0x5ed619[_0x9219('0x48')]['id'];}return db['SugarcrmAccount'][_0x9219('0x4b')]({'where':{'id':_0x5ed619[_0x9219('0x42')]['id']}})['then'](handleEntityNotFound(_0x4564f7,null))[_0x9219('0x22')](function(_0x4ef52a){if(_0x4ef52a){_0x5ed619[_0x9219('0x48')]['AccountId']=_0x4ef52a['id'];_0x5ed619[_0x9219('0x48')][_0x9219('0x4e')]=integrations['getSubjects'](_0x5ed619[_0x9219('0x48')][_0x9219('0x4f')],_0x5ed619[_0x9219('0x48')][_0x9219('0x39')]);_0x5ed619[_0x9219('0x48')]['Descriptions']=integrations[_0x9219('0x50')](_0x5ed619[_0x9219('0x48')][_0x9219('0x4f')],_0x5ed619['body'][_0x9219('0x39')]);return db[_0x9219('0x4c')][_0x9219('0x47')](_0x5ed619[_0x9219('0x48')],{'include':[{'model':db['SugarcrmField'],'as':_0x9219('0x4e')},{'model':db[_0x9219('0x51')],'as':_0x9219('0x52')}]});}return null;})[_0x9219('0x22')](respondWithResult(_0x4564f7,null))[_0x9219('0x46')](handleError(_0x4564f7,null));};exports[_0x9219('0x53')]=function(_0x5cda75,_0x479c1c,_0x880da9){var _0x1daa23='';var _0x464764=['id',_0x9219('0x2b'),_0x9219('0x54'),'created_by','description',_0x9219('0x55'),_0x9219('0x56'),'duration_minutes',_0x9219('0x57'),'parent_type',_0x9219('0x58'),_0x9219('0x59')];return db['SugarcrmAccount'][_0x9219('0x4b')]({'where':{'id':_0x5cda75[_0x9219('0x42')]['id']},'attributes':['id',_0x9219('0x5a'),_0x9219('0x5b'),'remoteUri']})['then'](handleEntityNotFound(_0x479c1c,null))[_0x9219('0x22')](function(_0x20f42d){if(_0x20f42d){_0x1daa23=_0x20f42d[_0x9219('0x5c')];var _0x316f45=_0x1daa23[_0x9219('0x5d')](-0x1);if(_0x316f45==='/'){_0x1daa23=_0x1daa23['substring'](0x0,_0x1daa23[_0x9219('0x5e')](_0x316f45));}return rp({'method':_0x9219('0x5f'),'uri':util[_0x9219('0x60')](_0x9219('0x61'),_0x1daa23,'/service/v4_1/rest.php'),'json':!![],'form':{'method':_0x9219('0x62'),'input_type':_0x9219('0x63'),'response_type':_0x9219('0x63'),'rest_data':JSON['stringify']({'user_auth':{'user_name':_0x20f42d[_0x9219('0x5a')],'password':_0x20f42d[_0x9219('0x5b')],'encryption':_0x9219('0x64')},'application':_0x9219('0x65')})}});}})[_0x9219('0x22')](function(_0x3f01f7){if(_0x3f01f7&&_0x3f01f7[_0x9219('0x2b')]!==_0x9219('0x66')&&_0x3f01f7[_0x9219('0x2b')]!=='Password\x20Expired'){return rp({'method':'POST','uri':util[_0x9219('0x60')](_0x9219('0x61'),_0x1daa23,_0x9219('0x67')),'json':!![],'form':{'method':_0x9219('0x68'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x3f01f7['id'],'module_name':_0x9219('0x69')})}})[_0x9219('0x22')](function(_0x4e16b9){if(_0x4e16b9){var _0x2e9740=_[_0x9219('0x6a')](_0x4e16b9[_0x9219('0x6b')]);_[_0x9219('0x6c')](_0x2e9740,function(_0x229e30){return _0x464764[_0x9219('0x6d')](_0x229e30[_0x9219('0x2b')]);});return{'count':_0x2e9740[_0x9219('0x31')],'rows':_[_0x9219('0x26')](_0x2e9740,function(_0x3dd106){return{'id':_0x3dd106[_0x9219('0x2b')],'name':_0x3dd106[_0x9219('0x6e')],'custom':_['endsWith'](_0x3dd106[_0x9219('0x2b')],'_c')?!![]:![],'options':_0x3dd106[_0x9219('0x3c')]?_[_0x9219('0x26')](_['values'](_0x3dd106['options']),function(_0x4190c5){return{'name':_0x4190c5[_0x9219('0x6f')],'value':_0x4190c5['name']};}):[]};})};}})[_0x9219('0x22')](respondWithResult(_0x479c1c,null))[_0x9219('0x46')](function(_0x20b04b){var _0x263346=_0x5cda75[_0x9219('0x2c')][_0x9219('0x70')]?0x1f4:_0x20b04b[_0x9219('0x71')]||0x1f4;logger[_0x9219('0x23')](_0x9219('0x72'),_0x9219('0x53'),_0x263346,JSON['stringify'](_0x20b04b));delete _0x20b04b[_0x9219('0x2b')];if(_0x263346===0x191){_0x263346=0x190;}_0x479c1c[_0x9219('0x17')](_0x263346)[_0x9219('0x73')](_0x5cda75[_0x9219('0x2c')][_0x9219('0x70')]?{'message':'Wrong\x20credentials','statusCode':_0x20b04b[_0x9219('0x71')]}:_0x20b04b);});}else{var _0x5dca36=0x1f4;_0x479c1c[_0x9219('0x17')](_0x5dca36)['send']({'message':'Wrong\x20credentials','statusCode':0x190});}});}; \ No newline at end of file diff --git a/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js b/server/api/intSugarcrmAccount/intSugarcrmAccount.model.js index 4049728..f41115d 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 _0xc584=['path','rimraf','../../config/environment','../../components/integrations/configuration','exports','define','util','../../config/logger','bluebird'];(function(_0x562faf,_0x102bcc){var _0x22c1f6=function(_0x2cd3b8){while(--_0x2cd3b8){_0x562faf['push'](_0x562faf['shift']());}};_0x22c1f6(++_0x102bcc);}(_0xc584,0xa8));var _0x4c58=function(_0x55c979,_0x36c5f0){_0x55c979=_0x55c979-0x0;var _0x690107=_0xc584[_0x55c979];return _0x690107;};'use strict';var _=require('lodash');var util=require(_0x4c58('0x0'));var logger=require(_0x4c58('0x1'))('api');var moment=require('moment');var BPromise=require(_0x4c58('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4c58('0x3'));var rimraf=require(_0x4c58('0x4'));var config=require(_0x4c58('0x5'));var attributes=require('./intSugarcrmAccount.attributes');var integrations=require(_0x4c58('0x6'));module[_0x4c58('0x7')]=function(_0x3e94f0,_0x2fbd47){return _0x3e94f0[_0x4c58('0x8')]('SugarcrmAccount',attributes,{'tableName':'int_sugarcrm_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x18a6=['define','int_sugarcrm_accounts','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmAccount.attributes','../../components/integrations/configuration','exports'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x18a6,0x1c9));var _0x618a=function(_0x3a1e29,_0x2910de){_0x3a1e29=_0x3a1e29-0x0;var _0x8c1fd8=_0x18a6[_0x3a1e29];return _0x8c1fd8;};'use strict';var _=require('lodash');var util=require(_0x618a('0x0'));var logger=require(_0x618a('0x1'))(_0x618a('0x2'));var moment=require(_0x618a('0x3'));var BPromise=require(_0x618a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x618a('0x5'));var rimraf=require(_0x618a('0x6'));var config=require(_0x618a('0x7'));var attributes=require(_0x618a('0x8'));var integrations=require(_0x618a('0x9'));module[_0x618a('0xa')]=function(_0x208bcf,_0x32558e){return _0x208bcf[_0x618a('0xb')]('SugarcrmAccount',attributes,{'tableName':_0x618a('0xc'),'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 789b9fc..1b91af8 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 _0x92aa=['find','util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','then','info','SugarcrmAccount,\x20%s,\x20%s','SugarcrmAccount,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','GetSugarcrmAccount','options','raw','where','attributes','limit','include','map','model','debug','stringify','catch','ShowSugarcrmAccount'];(function(_0x55550f,_0x4311c0){var _0x306237=function(_0x17a01c){while(--_0x17a01c){_0x55550f['push'](_0x55550f['shift']());}};_0x306237(++_0x4311c0);}(_0x92aa,0x1e1));var _0xa92a=function(_0x46f057,_0x218882){_0x46f057=_0x46f057-0x0;var _0x326cbf=_0x92aa[_0x46f057];return _0x326cbf;};'use strict';var _=require('lodash');var util=require(_0xa92a('0x0'));var moment=require(_0xa92a('0x1'));var BPromise=require(_0xa92a('0x2'));var rs=require(_0xa92a('0x3'));var fs=require('fs');var Redis=require(_0xa92a('0x4'));var db=require(_0xa92a('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xa92a('0x6'));var config=require(_0xa92a('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa92a('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5b3d42,_0x5b10fa,_0xf2d992){return new BPromise(function(_0x11e068,_0x1d481f){return client['request'](_0x5b3d42,_0xf2d992)[_0xa92a('0x9')](function(_0x417410){logger[_0xa92a('0xa')](_0xa92a('0xb'),_0x5b10fa,'request\x20sent');logger['debug'](_0xa92a('0xc'),_0x5b10fa,_0xa92a('0xd'),JSON['stringify'](_0x417410));if(_0x417410[_0xa92a('0xe')]){if(_0x417410[_0xa92a('0xe')][_0xa92a('0xf')]===0x1f4){logger[_0xa92a('0xe')](_0xa92a('0xb'),_0x5b10fa,_0x417410[_0xa92a('0xe')][_0xa92a('0x10')]);return _0x1d481f(_0x417410[_0xa92a('0xe')]['message']);}logger[_0xa92a('0xe')](_0xa92a('0xb'),_0x5b10fa,_0x417410[_0xa92a('0xe')][_0xa92a('0x10')]);return _0x11e068(_0x417410[_0xa92a('0xe')][_0xa92a('0x10')]);}else{logger[_0xa92a('0xa')](_0xa92a('0xb'),_0x5b10fa,_0xa92a('0xd'));_0x11e068(_0x417410[_0xa92a('0x11')][_0xa92a('0x10')]);}})['catch'](function(_0x5c8f45){logger[_0xa92a('0xe')](_0xa92a('0xb'),_0x5b10fa,_0x5c8f45);_0x1d481f(_0x5c8f45);});});}exports[_0xa92a('0x12')]=function(_0x11d7a7){var _0xd6f8d9=this;return new Promise(function(_0xbd4c35,_0x15abba){return db['SugarcrmAccount']['findAll']({'raw':_0x11d7a7[_0xa92a('0x13')]?_0x11d7a7[_0xa92a('0x13')][_0xa92a('0x14')]===undefined?!![]:![]:!![],'where':_0x11d7a7['options']?_0x11d7a7[_0xa92a('0x13')][_0xa92a('0x15')]||null:null,'attributes':_0x11d7a7[_0xa92a('0x13')]?_0x11d7a7[_0xa92a('0x13')][_0xa92a('0x16')]||null:null,'limit':_0x11d7a7['options']?_0x11d7a7['options'][_0xa92a('0x17')]||null:null,'include':_0x11d7a7[_0xa92a('0x13')]?_0x11d7a7[_0xa92a('0x13')][_0xa92a('0x18')]?_[_0xa92a('0x19')](_0x11d7a7[_0xa92a('0x13')]['include'],function(_0x5b1c89){return{'model':db[_0x5b1c89['model']],'as':_0x5b1c89['as'],'attributes':_0x5b1c89[_0xa92a('0x16')],'include':_0x5b1c89[_0xa92a('0x18')]?_['map'](_0x5b1c89[_0xa92a('0x18')],function(_0x506acc){return{'model':db[_0x506acc[_0xa92a('0x1a')]],'as':_0x506acc['as'],'attributes':_0x506acc[_0xa92a('0x16')],'include':_0x506acc['include']?_['map'](_0x506acc[_0xa92a('0x18')],function(_0x254c42){return{'model':db[_0x254c42[_0xa92a('0x1a')]],'as':_0x254c42['as'],'attributes':_0x254c42[_0xa92a('0x16')]};}):[]};}):[]};}):[]:[]})[_0xa92a('0x9')](function(_0x50ce14){logger[_0xa92a('0xa')](_0xa92a('0x12'),_0x11d7a7);logger[_0xa92a('0x1b')](_0xa92a('0x12'),_0x11d7a7,JSON[_0xa92a('0x1c')](_0x50ce14));_0xbd4c35(_0x50ce14);})[_0xa92a('0x1d')](function(_0x511a27){logger[_0xa92a('0xe')](_0xa92a('0x12'),_0x511a27[_0xa92a('0x10')],_0x11d7a7);_0x15abba(_0xd6f8d9[_0xa92a('0xe')](0x1f4,_0x511a27[_0xa92a('0x10')]));});});};exports[_0xa92a('0x1e')]=function(_0x3802ed){var _0x1ae97c=this;return new Promise(function(_0xaf3709,_0xbc691c){return db['SugarcrmAccount'][_0xa92a('0x1f')]({'raw':_0x3802ed[_0xa92a('0x13')]?_0x3802ed['options'][_0xa92a('0x14')]===undefined?!![]:![]:!![],'where':_0x3802ed[_0xa92a('0x13')]?_0x3802ed['options']['where']||null:null,'attributes':_0x3802ed[_0xa92a('0x13')]?_0x3802ed[_0xa92a('0x13')]['attributes']||null:null,'include':_0x3802ed[_0xa92a('0x13')]?_0x3802ed[_0xa92a('0x13')][_0xa92a('0x18')]?_[_0xa92a('0x19')](_0x3802ed[_0xa92a('0x13')][_0xa92a('0x18')],function(_0x436657){return{'model':db[_0x436657[_0xa92a('0x1a')]],'as':_0x436657['as'],'attributes':_0x436657[_0xa92a('0x16')],'include':_0x436657[_0xa92a('0x18')]?_[_0xa92a('0x19')](_0x436657['include'],function(_0x2192c8){return{'model':db[_0x2192c8['model']],'as':_0x2192c8['as'],'attributes':_0x2192c8[_0xa92a('0x16')],'include':_0x2192c8['include']?_['map'](_0x2192c8['include'],function(_0xb3d92){return{'model':db[_0xb3d92[_0xa92a('0x1a')]],'as':_0xb3d92['as'],'attributes':_0xb3d92[_0xa92a('0x16')]};}):[]};}):[]};}):[]:[]})[_0xa92a('0x9')](function(_0x49f8e7){logger[_0xa92a('0xa')](_0xa92a('0x1e'),_0x3802ed);logger[_0xa92a('0x1b')]('ShowSugarcrmAccount',_0x3802ed,JSON[_0xa92a('0x1c')](_0x49f8e7));_0xaf3709(_0x49f8e7);})[_0xa92a('0x1d')](function(_0x180c1d){logger['error']('ShowSugarcrmAccount',_0x180c1d[_0xa92a('0x10')],_0x3802ed);_0xbc691c(_0x1ae97c[_0xa92a('0xe')](0x1f4,_0x180c1d[_0xa92a('0x10')]));});});}; \ No newline at end of file +var _0xe357=['request','then','info','SugarcrmAccount,\x20%s,\x20%s','request\x20sent','debug','SugarcrmAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSugarcrmAccount','options','raw','limit','include','map','model','attributes','ShowSugarcrmAccount','SugarcrmAccount','where','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x36eaaa,_0x326732){var _0x461349=function(_0x4e4180){while(--_0x4e4180){_0x36eaaa['push'](_0x36eaaa['shift']());}};_0x461349(++_0x326732);}(_0xe357,0x1e6));var _0x7e35=function(_0xa8dc6d,_0x3bdfc2){_0xa8dc6d=_0xa8dc6d-0x0;var _0x141e04=_0xe357[_0xa8dc6d];return _0x141e04;};'use strict';var _=require(_0x7e35('0x0'));var util=require(_0x7e35('0x1'));var moment=require(_0x7e35('0x2'));var BPromise=require(_0x7e35('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7e35('0x4'));var db=require(_0x7e35('0x5'))['db'];var utils=require(_0x7e35('0x6'));var logger=require('../../config/logger')(_0x7e35('0x7'));var config=require(_0x7e35('0x8'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a962e,_0x6dad72,_0x91ef22){return new BPromise(function(_0x6b2aad,_0x1ab40a){return client[_0x7e35('0x9')](_0x4a962e,_0x91ef22)[_0x7e35('0xa')](function(_0x4b8426){logger[_0x7e35('0xb')](_0x7e35('0xc'),_0x6dad72,_0x7e35('0xd'));logger[_0x7e35('0xe')](_0x7e35('0xf'),_0x6dad72,_0x7e35('0xd'),JSON[_0x7e35('0x10')](_0x4b8426));if(_0x4b8426[_0x7e35('0x11')]){if(_0x4b8426['error'][_0x7e35('0x12')]===0x1f4){logger[_0x7e35('0x11')](_0x7e35('0xc'),_0x6dad72,_0x4b8426[_0x7e35('0x11')]['message']);return _0x1ab40a(_0x4b8426[_0x7e35('0x11')][_0x7e35('0x13')]);}logger[_0x7e35('0x11')](_0x7e35('0xc'),_0x6dad72,_0x4b8426['error'][_0x7e35('0x13')]);return _0x6b2aad(_0x4b8426['error']['message']);}else{logger[_0x7e35('0xb')](_0x7e35('0xc'),_0x6dad72,_0x7e35('0xd'));_0x6b2aad(_0x4b8426[_0x7e35('0x14')][_0x7e35('0x13')]);}})[_0x7e35('0x15')](function(_0x4b4e00){logger['error'](_0x7e35('0xc'),_0x6dad72,_0x4b4e00);_0x1ab40a(_0x4b4e00);});});}exports[_0x7e35('0x16')]=function(_0x2643bc){var _0x549b8b=this;return new Promise(function(_0x2a7423,_0x2863bd){return db['SugarcrmAccount']['findAll']({'raw':_0x2643bc[_0x7e35('0x17')]?_0x2643bc[_0x7e35('0x17')][_0x7e35('0x18')]===undefined?!![]:![]:!![],'where':_0x2643bc[_0x7e35('0x17')]?_0x2643bc[_0x7e35('0x17')]['where']||null:null,'attributes':_0x2643bc[_0x7e35('0x17')]?_0x2643bc[_0x7e35('0x17')]['attributes']||null:null,'limit':_0x2643bc[_0x7e35('0x17')]?_0x2643bc[_0x7e35('0x17')][_0x7e35('0x19')]||null:null,'include':_0x2643bc[_0x7e35('0x17')]?_0x2643bc[_0x7e35('0x17')][_0x7e35('0x1a')]?_[_0x7e35('0x1b')](_0x2643bc[_0x7e35('0x17')][_0x7e35('0x1a')],function(_0x2704cd){return{'model':db[_0x2704cd[_0x7e35('0x1c')]],'as':_0x2704cd['as'],'attributes':_0x2704cd['attributes'],'include':_0x2704cd[_0x7e35('0x1a')]?_[_0x7e35('0x1b')](_0x2704cd[_0x7e35('0x1a')],function(_0x2e7616){return{'model':db[_0x2e7616[_0x7e35('0x1c')]],'as':_0x2e7616['as'],'attributes':_0x2e7616[_0x7e35('0x1d')],'include':_0x2e7616[_0x7e35('0x1a')]?_['map'](_0x2e7616[_0x7e35('0x1a')],function(_0x3877fd){return{'model':db[_0x3877fd['model']],'as':_0x3877fd['as'],'attributes':_0x3877fd[_0x7e35('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7e35('0xa')](function(_0x3b34b3){logger['info'](_0x7e35('0x16'),_0x2643bc);logger['debug'](_0x7e35('0x16'),_0x2643bc,JSON[_0x7e35('0x10')](_0x3b34b3));_0x2a7423(_0x3b34b3);})[_0x7e35('0x15')](function(_0x5a4edd){logger[_0x7e35('0x11')](_0x7e35('0x16'),_0x5a4edd['message'],_0x2643bc);_0x2863bd(_0x549b8b[_0x7e35('0x11')](0x1f4,_0x5a4edd[_0x7e35('0x13')]));});});};exports[_0x7e35('0x1e')]=function(_0x2da4c4){var _0x18a9a2=this;return new Promise(function(_0x37527b,_0x2e7ed7){return db[_0x7e35('0x1f')]['find']({'raw':_0x2da4c4[_0x7e35('0x17')]?_0x2da4c4['options'][_0x7e35('0x18')]===undefined?!![]:![]:!![],'where':_0x2da4c4[_0x7e35('0x17')]?_0x2da4c4[_0x7e35('0x17')][_0x7e35('0x20')]||null:null,'attributes':_0x2da4c4[_0x7e35('0x17')]?_0x2da4c4[_0x7e35('0x17')][_0x7e35('0x1d')]||null:null,'include':_0x2da4c4[_0x7e35('0x17')]?_0x2da4c4['options']['include']?_['map'](_0x2da4c4[_0x7e35('0x17')][_0x7e35('0x1a')],function(_0x194ba1){return{'model':db[_0x194ba1['model']],'as':_0x194ba1['as'],'attributes':_0x194ba1[_0x7e35('0x1d')],'include':_0x194ba1[_0x7e35('0x1a')]?_['map'](_0x194ba1[_0x7e35('0x1a')],function(_0x5828ed){return{'model':db[_0x5828ed[_0x7e35('0x1c')]],'as':_0x5828ed['as'],'attributes':_0x5828ed[_0x7e35('0x1d')],'include':_0x5828ed[_0x7e35('0x1a')]?_['map'](_0x5828ed[_0x7e35('0x1a')],function(_0x3fe3a6){return{'model':db[_0x3fe3a6[_0x7e35('0x1c')]],'as':_0x3fe3a6['as'],'attributes':_0x3fe3a6[_0x7e35('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x7e35('0xa')](function(_0x400f3d){logger[_0x7e35('0xb')](_0x7e35('0x1e'),_0x2da4c4);logger[_0x7e35('0xe')](_0x7e35('0x1e'),_0x2da4c4,JSON[_0x7e35('0x10')](_0x400f3d));_0x37527b(_0x400f3d);})['catch'](function(_0x2e78e2){logger[_0x7e35('0x11')](_0x7e35('0x1e'),_0x2e78e2[_0x7e35('0x13')],_0x2da4c4);_0x2e7ed7(_0x18a9a2[_0x7e35('0x11')](0x1f4,_0x2e78e2[_0x7e35('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/index.js b/server/api/intSugarcrmConfiguration/index.js index 6c5bdf8..c66c617 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 _0x7f62=['multer','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./intSugarcrmConfiguration.controller','get','isAuthenticated','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','update','destroy'];(function(_0x45d3f0,_0x4be53f){var _0x314b79=function(_0x563d32){while(--_0x563d32){_0x45d3f0['push'](_0x45d3f0['shift']());}};_0x314b79(++_0x4be53f);}(_0x7f62,0x118));var _0x27f6=function(_0x3cae69,_0x233c38){_0x3cae69=_0x3cae69-0x0;var _0x3128eb=_0x7f62[_0x3cae69];return _0x3128eb;};'use strict';var multer=require(_0x27f6('0x0'));var util=require('util');var path=require(_0x27f6('0x1'));var timeout=require(_0x27f6('0x2'));var express=require(_0x27f6('0x3'));var router=express['Router']();var fs_extra=require(_0x27f6('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x27f6('0x5'));var config=require(_0x27f6('0x6'));var controller=require(_0x27f6('0x7'));router[_0x27f6('0x8')]('/',auth[_0x27f6('0x9')](),controller['index']);router[_0x27f6('0x8')](_0x27f6('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x27f6('0x8')](_0x27f6('0xb'),auth[_0x27f6('0x9')](),controller['getFields']);router[_0x27f6('0x8')](_0x27f6('0xc'),auth[_0x27f6('0x9')](),controller[_0x27f6('0xd')]);router[_0x27f6('0x8')](_0x27f6('0xe'),auth[_0x27f6('0x9')](),controller[_0x27f6('0xf')]);router[_0x27f6('0x10')]('/',auth['isAuthenticated'](),controller[_0x27f6('0x11')]);router['put'](_0x27f6('0xa'),auth[_0x27f6('0x9')](),controller[_0x27f6('0x12')]);router['delete'](_0x27f6('0xa'),auth[_0x27f6('0x9')](),controller[_0x27f6('0x13')]);module['exports']=router; \ No newline at end of file +var _0x78f2=['update','delete','destroy','exports','util','path','connect-timeout','../../components/auth/service','../../config/environment','./intSugarcrmConfiguration.controller','get','index','/:id','isAuthenticated','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','post','create','put'];(function(_0x2a5768,_0x38197b){var _0x23ccc4=function(_0xede1aa){while(--_0xede1aa){_0x2a5768['push'](_0x2a5768['shift']());}};_0x23ccc4(++_0x38197b);}(_0x78f2,0x1b9));var _0x278f=function(_0x481d67,_0x2e9841){_0x481d67=_0x481d67-0x0;var _0x3aab96=_0x78f2[_0x481d67];return _0x3aab96;};'use strict';var multer=require('multer');var util=require(_0x278f('0x0'));var path=require(_0x278f('0x1'));var timeout=require(_0x278f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x278f('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0x278f('0x4'));var controller=require(_0x278f('0x5'));router[_0x278f('0x6')]('/',auth['isAuthenticated'](),controller[_0x278f('0x7')]);router['get'](_0x278f('0x8'),auth[_0x278f('0x9')](),controller[_0x278f('0xa')]);router['get'](_0x278f('0xb'),auth[_0x278f('0x9')](),controller['getFields']);router[_0x278f('0x6')](_0x278f('0xc'),auth[_0x278f('0x9')](),controller[_0x278f('0xd')]);router['get'](_0x278f('0xe'),auth[_0x278f('0x9')](),controller[_0x278f('0xf')]);router[_0x278f('0x10')]('/',auth[_0x278f('0x9')](),controller[_0x278f('0x11')]);router[_0x278f('0x12')](_0x278f('0x8'),auth[_0x278f('0x9')](),controller[_0x278f('0x13')]);router[_0x278f('0x14')](_0x278f('0x8'),auth[_0x278f('0x9')](),controller[_0x278f('0x15')]);module[_0x278f('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 674eb4f..3d41a9d 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 _0x761f=['STRING','exports'];(function(_0x154940,_0x4a448a){var _0x401409=function(_0x45cdcf){while(--_0x45cdcf){_0x154940['push'](_0x154940['shift']());}};_0x401409(++_0x4a448a);}(_0x761f,0x157));var _0xf761=function(_0x5a2285,_0x3212d1){_0x5a2285=_0x5a2285-0x0;var _0x48f6ed=_0x761f[_0x5a2285];return _0x48f6ed;};'use strict';var Sequelize=require('sequelize');module[_0xf761('0x0')]={'name':{'type':Sequelize[_0xf761('0x1')]},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x731c=['STRING','sequelize','exports'];(function(_0x4fae94,_0x470377){var _0x246b5f=function(_0x40dc84){while(--_0x40dc84){_0x4fae94['push'](_0x4fae94['shift']());}};_0x246b5f(++_0x470377);}(_0x731c,0x178));var _0xc731=function(_0x1ca93b,_0x212417){_0x1ca93b=_0x1ca93b-0x0;var _0x39c8e3=_0x731c[_0x1ca93b];return _0x39c8e3;};'use strict';var Sequelize=require(_0xc731('0x0'));module[_0xc731('0x1')]={'name':{'type':Sequelize[_0xc731('0x2')]},'description':{'type':Sequelize[_0xc731('0x2')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.controller.js index f5e88fc..3e52dfd 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 _0xcfad=['name','query','keys','filters','intersection','model','fields','attributes','length','nolimit','order','sort','where','pick','filter','VIRTUAL','options','includeAll','include','rows','catch','merge','find','body','params','getFields','findOne','SugarcrmField','hasOwnProperty','getSubjects','getDescriptions','eml-format','rimraf','zip-dir','request-promise','mustache','util','sox','to-csv','ejs','lodash','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','status','end','json','offset','limit','undefined','count','set','Content-Range','save','update','then','destroy','error','stack','index','map','SugarcrmConfiguration','rawAttributes','fieldName','type','key'];(function(_0x614ef4,_0x28a060){var _0x35e8e2=function(_0x55e81b){while(--_0x55e81b){_0x614ef4['push'](_0x614ef4['shift']());}};_0x35e8e2(++_0x28a060);}(_0xcfad,0x103));var _0xdcfa=function(_0x416ac2,_0x9ec619){_0x416ac2=_0x416ac2-0x0;var _0x9272cf=_0xcfad[_0x416ac2];return _0x9272cf;};'use strict';var emlformat=require(_0xdcfa('0x0'));var rimraf=require(_0xdcfa('0x1'));var zipdir=require(_0xdcfa('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xdcfa('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0xdcfa('0x4'));var util=require(_0xdcfa('0x5'));var path=require('path');var sox=require(_0xdcfa('0x6'));var csv=require(_0xdcfa('0x7'));var ejs=require(_0xdcfa('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdcfa('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xdcfa('0xa'));var deskjs=require('desk.js');var toCsv=require(_0xdcfa('0x7'));var querystring=require(_0xdcfa('0xb'));var Papa=require(_0xdcfa('0xc'));var Redis=require(_0xdcfa('0xd'));var authService=require(_0xdcfa('0xe'));var qs=require(_0xdcfa('0xf'));var as=require(_0xdcfa('0x10'));var hardwareService=require(_0xdcfa('0x11'));var logger=require(_0xdcfa('0x12'))(_0xdcfa('0x13'));var utils=require(_0xdcfa('0x14'));var config=require(_0xdcfa('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xdcfa('0x16'))['db'];function respondWithStatusCode(_0x6a3171,_0x5573b1){_0x5573b1=_0x5573b1||0xcc;return function(_0x11b8c5){if(_0x11b8c5){return _0x6a3171['sendStatus'](_0x5573b1);}return _0x6a3171[_0xdcfa('0x17')](_0x5573b1)[_0xdcfa('0x18')]();};}function respondWithResult(_0x359d65,_0x2c76c0){_0x2c76c0=_0x2c76c0||0xc8;return function(_0x34179b){if(_0x34179b){return _0x359d65['status'](_0x2c76c0)[_0xdcfa('0x19')](_0x34179b);}};}function respondWithFilteredResult(_0x55bb14,_0x18f71e){return function(_0x5455ef){if(_0x5455ef){var _0xe6677f=typeof _0x18f71e[_0xdcfa('0x1a')]==='undefined'&&typeof _0x18f71e[_0xdcfa('0x1b')]===_0xdcfa('0x1c');var _0x265ba5=_0x5455ef[_0xdcfa('0x1d')];var _0x21f152=_0xe6677f?0x0:_0x18f71e[_0xdcfa('0x1a')];var _0x10580f=_0xe6677f?_0x5455ef[_0xdcfa('0x1d')]:_0x18f71e[_0xdcfa('0x1a')]+_0x18f71e[_0xdcfa('0x1b')];var _0x4604b9;if(_0x10580f>=_0x265ba5){_0x10580f=_0x265ba5;_0x4604b9=0xc8;}else{_0x4604b9=0xce;}_0x55bb14[_0xdcfa('0x17')](_0x4604b9);return _0x55bb14[_0xdcfa('0x1e')](_0xdcfa('0x1f'),_0x21f152+'-'+_0x10580f+'/'+_0x265ba5)['json'](_0x5455ef);}return null;};}function patchUpdates(_0x24209b){return function(_0x258ae6){try{jsonpatch['apply'](_0x258ae6,_0x24209b,!![]);}catch(_0x2f5627){return BPromise['reject'](_0x2f5627);}return _0x258ae6[_0xdcfa('0x20')]();};}function saveUpdates(_0x36390c,_0xda5602){return function(_0x3f05ae){if(_0x3f05ae){return _0x3f05ae[_0xdcfa('0x21')](_0x36390c)[_0xdcfa('0x22')](function(_0x42624b){return _0x42624b;});}return null;};}function removeEntity(_0x4caa2d,_0x2cd2cd){return function(_0x2b7bf2){if(_0x2b7bf2){return _0x2b7bf2[_0xdcfa('0x23')]()[_0xdcfa('0x22')](function(){_0x4caa2d[_0xdcfa('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x53cc2b,_0x2394ad){return function(_0xf4674d){if(!_0xf4674d){_0x53cc2b['sendStatus'](0x194);}return _0xf4674d;};}function handleError(_0x2ffcc9,_0x12202c){_0x12202c=_0x12202c||0x1f4;return function(_0x2334b2){logger[_0xdcfa('0x24')](_0x2334b2[_0xdcfa('0x25')]);if(_0x2334b2['name']){delete _0x2334b2['name'];}_0x2ffcc9[_0xdcfa('0x17')](_0x12202c)['send'](_0x2334b2);};}exports[_0xdcfa('0x26')]=function(_0x4f56be,_0x31ba42){var _0x2a6f1d={},_0x42528e={},_0x26c66b={'count':0x0,'rows':[]};var _0x590554=_[_0xdcfa('0x27')](db[_0xdcfa('0x28')][_0xdcfa('0x29')],function(_0x1ecd54){return{'name':_0x1ecd54[_0xdcfa('0x2a')],'type':_0x1ecd54[_0xdcfa('0x2b')][_0xdcfa('0x2c')]};});_0x42528e['model']=_[_0xdcfa('0x27')](_0x590554,_0xdcfa('0x2d'));_0x42528e[_0xdcfa('0x2e')]=_[_0xdcfa('0x2f')](_0x4f56be['query']);_0x42528e[_0xdcfa('0x30')]=_[_0xdcfa('0x31')](_0x42528e[_0xdcfa('0x32')],_0x42528e['query']);_0x2a6f1d['attributes']=_[_0xdcfa('0x31')](_0x42528e[_0xdcfa('0x32')],qs[_0xdcfa('0x33')](_0x4f56be[_0xdcfa('0x2e')][_0xdcfa('0x33')]));_0x2a6f1d[_0xdcfa('0x34')]=_0x2a6f1d[_0xdcfa('0x34')][_0xdcfa('0x35')]?_0x2a6f1d[_0xdcfa('0x34')]:_0x42528e[_0xdcfa('0x32')];if(!_0x4f56be[_0xdcfa('0x2e')]['hasOwnProperty'](_0xdcfa('0x36'))){_0x2a6f1d[_0xdcfa('0x1b')]=qs[_0xdcfa('0x1b')](_0x4f56be[_0xdcfa('0x2e')][_0xdcfa('0x1b')]);_0x2a6f1d['offset']=qs[_0xdcfa('0x1a')](_0x4f56be[_0xdcfa('0x2e')][_0xdcfa('0x1a')]);}_0x2a6f1d[_0xdcfa('0x37')]=qs[_0xdcfa('0x38')](_0x4f56be[_0xdcfa('0x2e')][_0xdcfa('0x38')]);_0x2a6f1d[_0xdcfa('0x39')]=qs[_0xdcfa('0x30')](_[_0xdcfa('0x3a')](_0x4f56be[_0xdcfa('0x2e')],_0x42528e[_0xdcfa('0x30')]),_0x590554);if(_0x4f56be['query'][_0xdcfa('0x3b')]){_0x2a6f1d[_0xdcfa('0x39')]=_['merge'](_0x2a6f1d[_0xdcfa('0x39')],{'$or':_['map'](_0x590554,function(_0x4bdf9f){if(_0x4bdf9f['type']!==_0xdcfa('0x3c')){var _0x2ca5d2={};_0x2ca5d2[_0x4bdf9f['name']]={'$like':'%'+_0x4f56be[_0xdcfa('0x2e')][_0xdcfa('0x3b')]+'%'};return _0x2ca5d2;}})});}_0x2a6f1d=_['merge']({},_0x2a6f1d,_0x4f56be[_0xdcfa('0x3d')]);var _0x134a2d={'where':_0x2a6f1d[_0xdcfa('0x39')]};return db['SugarcrmConfiguration'][_0xdcfa('0x1d')](_0x134a2d)[_0xdcfa('0x22')](function(_0x729b4f){_0x26c66b[_0xdcfa('0x1d')]=_0x729b4f;if(_0x4f56be['query'][_0xdcfa('0x3e')]){_0x2a6f1d[_0xdcfa('0x3f')]=[{'all':!![]}];}return db['SugarcrmConfiguration']['findAll'](_0x2a6f1d);})[_0xdcfa('0x22')](function(_0x3c9ac7){_0x26c66b[_0xdcfa('0x40')]=_0x3c9ac7;return _0x26c66b;})['then'](respondWithFilteredResult(_0x31ba42,_0x2a6f1d))[_0xdcfa('0x41')](handleError(_0x31ba42,null));};exports['show']=function(_0x17b66a,_0x1ad7d3){var _0x48fe79={'raw':![],'where':{'id':_0x17b66a['params']['id']}},_0x434594={};_0x434594[_0xdcfa('0x32')]=_[_0xdcfa('0x2f')](db[_0xdcfa('0x28')][_0xdcfa('0x29')]);_0x434594[_0xdcfa('0x2e')]=_[_0xdcfa('0x2f')](_0x17b66a[_0xdcfa('0x2e')]);_0x434594[_0xdcfa('0x30')]=_[_0xdcfa('0x31')](_0x434594['model'],_0x434594['query']);_0x48fe79['attributes']=_[_0xdcfa('0x31')](_0x434594[_0xdcfa('0x32')],qs[_0xdcfa('0x33')](_0x17b66a[_0xdcfa('0x2e')]['fields']));_0x48fe79[_0xdcfa('0x34')]=_0x48fe79[_0xdcfa('0x34')][_0xdcfa('0x35')]?_0x48fe79[_0xdcfa('0x34')]:_0x434594[_0xdcfa('0x32')];if(_0x17b66a[_0xdcfa('0x2e')][_0xdcfa('0x3e')]){_0x48fe79[_0xdcfa('0x3f')]=[{'all':!![]}];}_0x48fe79=_[_0xdcfa('0x42')]({},_0x48fe79,_0x17b66a[_0xdcfa('0x3d')]);return db[_0xdcfa('0x28')][_0xdcfa('0x43')](_0x48fe79)[_0xdcfa('0x22')](handleEntityNotFound(_0x1ad7d3,null))['then'](respondWithResult(_0x1ad7d3,null))[_0xdcfa('0x41')](handleError(_0x1ad7d3,null));};exports['create']=function(_0x1f8615,_0x5ebdc3){return db[_0xdcfa('0x28')]['create'](_0x1f8615[_0xdcfa('0x44')],{})[_0xdcfa('0x22')](respondWithResult(_0x5ebdc3,0xc9))[_0xdcfa('0x41')](handleError(_0x5ebdc3,null));};exports['update']=function(_0xc3f624,_0x3a5f3b){if(_0xc3f624['body']['id']){delete _0xc3f624['body']['id'];}return db[_0xdcfa('0x28')][_0xdcfa('0x43')]({'where':{'id':_0xc3f624[_0xdcfa('0x45')]['id']}})[_0xdcfa('0x22')](handleEntityNotFound(_0x3a5f3b,null))[_0xdcfa('0x22')](saveUpdates(_0xc3f624[_0xdcfa('0x44')],null))[_0xdcfa('0x22')](respondWithResult(_0x3a5f3b,null))[_0xdcfa('0x41')](handleError(_0x3a5f3b,null));};exports[_0xdcfa('0x23')]=function(_0x141dd7,_0x50da13){return db[_0xdcfa('0x28')][_0xdcfa('0x43')]({'where':{'id':_0x141dd7[_0xdcfa('0x45')]['id']}})[_0xdcfa('0x22')](handleEntityNotFound(_0x50da13,null))[_0xdcfa('0x22')](removeEntity(_0x50da13,null))[_0xdcfa('0x41')](handleError(_0x50da13,null));};exports[_0xdcfa('0x46')]=function(_0x538bfb,_0x38e256,_0x11925f){var _0x345e5a={};var _0x4ec46d={};var _0x58691b;var _0x4ccf1e;return db[_0xdcfa('0x28')][_0xdcfa('0x47')]({'where':{'id':_0x538bfb[_0xdcfa('0x45')]['id']}})[_0xdcfa('0x22')](handleEntityNotFound(_0x38e256,null))[_0xdcfa('0x22')](function(_0x56b4f5){if(_0x56b4f5){_0x58691b=_0x56b4f5;_0x4ec46d[_0xdcfa('0x32')]=_[_0xdcfa('0x2f')](db[_0xdcfa('0x48')][_0xdcfa('0x29')]);_0x4ec46d['query']=_['keys'](_0x538bfb[_0xdcfa('0x2e')]);_0x4ec46d[_0xdcfa('0x30')]=_[_0xdcfa('0x31')](_0x4ec46d['model'],_0x4ec46d[_0xdcfa('0x2e')]);_0x345e5a[_0xdcfa('0x34')]=_[_0xdcfa('0x31')](_0x4ec46d[_0xdcfa('0x32')],qs[_0xdcfa('0x33')](_0x538bfb[_0xdcfa('0x2e')][_0xdcfa('0x33')]));_0x345e5a[_0xdcfa('0x34')]=_0x345e5a[_0xdcfa('0x34')][_0xdcfa('0x35')]?_0x345e5a[_0xdcfa('0x34')]:_0x4ec46d[_0xdcfa('0x32')];_0x345e5a['order']=qs[_0xdcfa('0x38')](_0x538bfb[_0xdcfa('0x2e')][_0xdcfa('0x38')]);_0x345e5a['where']=qs[_0xdcfa('0x30')](_['pick'](_0x538bfb[_0xdcfa('0x2e')],_0x4ec46d[_0xdcfa('0x30')]));if(_0x538bfb['query']['filter']){_0x345e5a[_0xdcfa('0x39')]=_[_0xdcfa('0x42')](_0x345e5a[_0xdcfa('0x39')],{'$or':_[_0xdcfa('0x27')](_0x345e5a[_0xdcfa('0x34')],function(_0x128719){var _0x5e40f5={};_0x5e40f5[_0x128719]={'$like':'%'+_0x538bfb[_0xdcfa('0x2e')][_0xdcfa('0x3b')]+'%'};return _0x5e40f5;})});}_0x345e5a=_[_0xdcfa('0x42')]({},_0x345e5a,_0x538bfb[_0xdcfa('0x3d')]);return _0x58691b[_0xdcfa('0x46')](_0x345e5a);}})['then'](function(_0x44b3b4){if(_0x44b3b4){_0x4ccf1e=_0x44b3b4[_0xdcfa('0x35')];if(!_0x538bfb[_0xdcfa('0x2e')][_0xdcfa('0x49')](_0xdcfa('0x36'))){_0x345e5a['limit']=qs[_0xdcfa('0x1b')](_0x538bfb[_0xdcfa('0x2e')][_0xdcfa('0x1b')]);_0x345e5a['offset']=qs[_0xdcfa('0x1a')](_0x538bfb['query'][_0xdcfa('0x1a')]);}return _0x58691b['getFields'](_0x345e5a);}})[_0xdcfa('0x22')](function(_0x1f25f0){if(_0x1f25f0){return _0x1f25f0?{'count':_0x4ccf1e,'rows':_0x1f25f0}:null;}})[_0xdcfa('0x22')](respondWithResult(_0x38e256,null))[_0xdcfa('0x41')](handleError(_0x38e256,null));};exports[_0xdcfa('0x4a')]=function(_0x56d598,_0x369b67,_0x3b7843){var _0x30523d={};var _0x4567b1={};var _0xc18ae5;var _0x55a9dd;return db[_0xdcfa('0x28')][_0xdcfa('0x47')]({'where':{'id':_0x56d598[_0xdcfa('0x45')]['id']}})[_0xdcfa('0x22')](handleEntityNotFound(_0x369b67,null))['then'](function(_0x14db35){if(_0x14db35){_0xc18ae5=_0x14db35;_0x4567b1[_0xdcfa('0x32')]=_[_0xdcfa('0x2f')](db[_0xdcfa('0x48')][_0xdcfa('0x29')]);_0x4567b1[_0xdcfa('0x2e')]=_[_0xdcfa('0x2f')](_0x56d598[_0xdcfa('0x2e')]);_0x4567b1['filters']=_['intersection'](_0x4567b1[_0xdcfa('0x32')],_0x4567b1['query']);_0x30523d[_0xdcfa('0x34')]=_[_0xdcfa('0x31')](_0x4567b1['model'],qs[_0xdcfa('0x33')](_0x56d598[_0xdcfa('0x2e')][_0xdcfa('0x33')]));_0x30523d[_0xdcfa('0x34')]=_0x30523d[_0xdcfa('0x34')][_0xdcfa('0x35')]?_0x30523d['attributes']:_0x4567b1[_0xdcfa('0x32')];_0x30523d[_0xdcfa('0x37')]=qs[_0xdcfa('0x38')](_0x56d598['query']['sort']);_0x30523d[_0xdcfa('0x39')]=qs[_0xdcfa('0x30')](_[_0xdcfa('0x3a')](_0x56d598[_0xdcfa('0x2e')],_0x4567b1[_0xdcfa('0x30')]));if(_0x56d598['query'][_0xdcfa('0x3b')]){_0x30523d[_0xdcfa('0x39')]=_[_0xdcfa('0x42')](_0x30523d[_0xdcfa('0x39')],{'$or':_[_0xdcfa('0x27')](_0x30523d[_0xdcfa('0x34')],function(_0x3c34c4){var _0x5d1cef={};_0x5d1cef[_0x3c34c4]={'$like':'%'+_0x56d598[_0xdcfa('0x2e')]['filter']+'%'};return _0x5d1cef;})});}_0x30523d=_['merge']({},_0x30523d,_0x56d598['options']);return _0xc18ae5['getSubjects'](_0x30523d);}})[_0xdcfa('0x22')](function(_0x5c0fb4){if(_0x5c0fb4){_0x55a9dd=_0x5c0fb4[_0xdcfa('0x35')];if(!_0x56d598[_0xdcfa('0x2e')][_0xdcfa('0x49')]('nolimit')){_0x30523d[_0xdcfa('0x1b')]=qs[_0xdcfa('0x1b')](_0x56d598[_0xdcfa('0x2e')][_0xdcfa('0x1b')]);_0x30523d[_0xdcfa('0x1a')]=qs[_0xdcfa('0x1a')](_0x56d598[_0xdcfa('0x2e')][_0xdcfa('0x1a')]);}return _0xc18ae5[_0xdcfa('0x4a')](_0x30523d);}})[_0xdcfa('0x22')](function(_0x684379){if(_0x684379){return _0x684379?{'count':_0x55a9dd,'rows':_0x684379}:null;}})[_0xdcfa('0x22')](respondWithResult(_0x369b67,null))[_0xdcfa('0x41')](handleError(_0x369b67,null));};exports[_0xdcfa('0x4b')]=function(_0x3b653d,_0x2dd96d,_0x1d488f){var _0x376ee8={};var _0x2b89ba={};var _0x4a8c34;var _0x5b9875;return db[_0xdcfa('0x28')][_0xdcfa('0x47')]({'where':{'id':_0x3b653d[_0xdcfa('0x45')]['id']}})['then'](handleEntityNotFound(_0x2dd96d,null))['then'](function(_0x5d3874){if(_0x5d3874){_0x4a8c34=_0x5d3874;_0x2b89ba[_0xdcfa('0x32')]=_[_0xdcfa('0x2f')](db[_0xdcfa('0x48')][_0xdcfa('0x29')]);_0x2b89ba[_0xdcfa('0x2e')]=_['keys'](_0x3b653d[_0xdcfa('0x2e')]);_0x2b89ba[_0xdcfa('0x30')]=_[_0xdcfa('0x31')](_0x2b89ba['model'],_0x2b89ba[_0xdcfa('0x2e')]);_0x376ee8[_0xdcfa('0x34')]=_[_0xdcfa('0x31')](_0x2b89ba[_0xdcfa('0x32')],qs[_0xdcfa('0x33')](_0x3b653d['query']['fields']));_0x376ee8[_0xdcfa('0x34')]=_0x376ee8[_0xdcfa('0x34')][_0xdcfa('0x35')]?_0x376ee8[_0xdcfa('0x34')]:_0x2b89ba[_0xdcfa('0x32')];_0x376ee8[_0xdcfa('0x37')]=qs[_0xdcfa('0x38')](_0x3b653d['query']['sort']);_0x376ee8[_0xdcfa('0x39')]=qs[_0xdcfa('0x30')](_[_0xdcfa('0x3a')](_0x3b653d['query'],_0x2b89ba[_0xdcfa('0x30')]));if(_0x3b653d['query'][_0xdcfa('0x3b')]){_0x376ee8[_0xdcfa('0x39')]=_['merge'](_0x376ee8[_0xdcfa('0x39')],{'$or':_[_0xdcfa('0x27')](_0x376ee8[_0xdcfa('0x34')],function(_0x4229e3){var _0x22caa3={};_0x22caa3[_0x4229e3]={'$like':'%'+_0x3b653d[_0xdcfa('0x2e')]['filter']+'%'};return _0x22caa3;})});}_0x376ee8=_[_0xdcfa('0x42')]({},_0x376ee8,_0x3b653d[_0xdcfa('0x3d')]);return _0x4a8c34['getDescriptions'](_0x376ee8);}})[_0xdcfa('0x22')](function(_0x51b105){if(_0x51b105){_0x5b9875=_0x51b105[_0xdcfa('0x35')];if(!_0x3b653d[_0xdcfa('0x2e')]['hasOwnProperty'](_0xdcfa('0x36'))){_0x376ee8[_0xdcfa('0x1b')]=qs[_0xdcfa('0x1b')](_0x3b653d[_0xdcfa('0x2e')][_0xdcfa('0x1b')]);_0x376ee8['offset']=qs['offset'](_0x3b653d['query']['offset']);}return _0x4a8c34[_0xdcfa('0x4b')](_0x376ee8);}})[_0xdcfa('0x22')](function(_0x3cd952){if(_0x3cd952){return _0x3cd952?{'count':_0x5b9875,'rows':_0x3cd952}:null;}})[_0xdcfa('0x22')](respondWithResult(_0x2dd96d,null))[_0xdcfa('0x41')](handleError(_0x2dd96d,null));}; \ No newline at end of file +var _0xc902=['includeAll','include','findAll','rows','catch','params','rawAttributes','find','create','body','getFields','findOne','SugarcrmField','getSubjects','hasOwnProperty','getDescriptions','eml-format','zip-dir','request-promise','moment','mustache','path','to-csv','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','index','map','SugarcrmConfiguration','type','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options'];(function(_0x2b6837,_0x3b09f6){var _0x1bfb9f=function(_0x503cdc){while(--_0x503cdc){_0x2b6837['push'](_0x2b6837['shift']());}};_0x1bfb9f(++_0x3b09f6);}(_0xc902,0x19b));var _0x2c90=function(_0x5bd396,_0x59b0ad){_0x5bd396=_0x5bd396-0x0;var _0x304f8c=_0xc902[_0x5bd396];return _0x304f8c;};'use strict';var emlformat=require(_0x2c90('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x2c90('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x2c90('0x2'));var moment=require(_0x2c90('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x2c90('0x4'));var util=require('util');var path=require(_0x2c90('0x5'));var sox=require('sox');var csv=require(_0x2c90('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c90('0x7'));var squel=require('squel');var crypto=require(_0x2c90('0x8'));var jsforce=require(_0x2c90('0x9'));var deskjs=require(_0x2c90('0xa'));var toCsv=require(_0x2c90('0x6'));var querystring=require(_0x2c90('0xb'));var Papa=require('papaparse');var Redis=require(_0x2c90('0xc'));var authService=require('../../components/auth/service');var qs=require(_0x2c90('0xd'));var as=require(_0x2c90('0xe'));var hardwareService=require(_0x2c90('0xf'));var logger=require(_0x2c90('0x10'))(_0x2c90('0x11'));var utils=require(_0x2c90('0x12'));var config=require(_0x2c90('0x13'));var licenseUtil=require(_0x2c90('0x14'));var db=require(_0x2c90('0x15'))['db'];function respondWithStatusCode(_0x30ef9b,_0x1c133d){_0x1c133d=_0x1c133d||0xcc;return function(_0x4a0e06){if(_0x4a0e06){return _0x30ef9b[_0x2c90('0x16')](_0x1c133d);}return _0x30ef9b[_0x2c90('0x17')](_0x1c133d)[_0x2c90('0x18')]();};}function respondWithResult(_0x2157b3,_0x316fc4){_0x316fc4=_0x316fc4||0xc8;return function(_0x274f1a){if(_0x274f1a){return _0x2157b3[_0x2c90('0x17')](_0x316fc4)['json'](_0x274f1a);}};}function respondWithFilteredResult(_0x4315ec,_0x4a46b5){return function(_0x51853c){if(_0x51853c){var _0x3124dc=typeof _0x4a46b5[_0x2c90('0x19')]==='undefined'&&typeof _0x4a46b5[_0x2c90('0x1a')]===_0x2c90('0x1b');var _0x10e835=_0x51853c['count'];var _0x4a11fa=_0x3124dc?0x0:_0x4a46b5[_0x2c90('0x19')];var _0x31af21=_0x3124dc?_0x51853c[_0x2c90('0x1c')]:_0x4a46b5['offset']+_0x4a46b5[_0x2c90('0x1a')];var _0x48cf74;if(_0x31af21>=_0x10e835){_0x31af21=_0x10e835;_0x48cf74=0xc8;}else{_0x48cf74=0xce;}_0x4315ec[_0x2c90('0x17')](_0x48cf74);return _0x4315ec[_0x2c90('0x1d')](_0x2c90('0x1e'),_0x4a11fa+'-'+_0x31af21+'/'+_0x10e835)['json'](_0x51853c);}return null;};}function patchUpdates(_0x4cdd9d){return function(_0x153bd9){try{jsonpatch[_0x2c90('0x1f')](_0x153bd9,_0x4cdd9d,!![]);}catch(_0x2ce501){return BPromise[_0x2c90('0x20')](_0x2ce501);}return _0x153bd9[_0x2c90('0x21')]();};}function saveUpdates(_0x392b4d,_0x4a0590){return function(_0x502108){if(_0x502108){return _0x502108[_0x2c90('0x22')](_0x392b4d)['then'](function(_0x12730e){return _0x12730e;});}return null;};}function removeEntity(_0x42ac28,_0x2ba726){return function(_0x23ef13){if(_0x23ef13){return _0x23ef13[_0x2c90('0x23')]()[_0x2c90('0x24')](function(){_0x42ac28[_0x2c90('0x17')](0xcc)[_0x2c90('0x18')]();});}};}function handleEntityNotFound(_0x17032a,_0x336460){return function(_0x18c235){if(!_0x18c235){_0x17032a[_0x2c90('0x16')](0x194);}return _0x18c235;};}function handleError(_0x41ea87,_0x3e14be){_0x3e14be=_0x3e14be||0x1f4;return function(_0x151b2b){logger[_0x2c90('0x25')](_0x151b2b[_0x2c90('0x26')]);if(_0x151b2b[_0x2c90('0x27')]){delete _0x151b2b[_0x2c90('0x27')];}_0x41ea87[_0x2c90('0x17')](_0x3e14be)[_0x2c90('0x28')](_0x151b2b);};}exports[_0x2c90('0x29')]=function(_0x502e61,_0xe43378){var _0x39d35d={},_0x386174={},_0x5d885d={'count':0x0,'rows':[]};var _0x4950db=_[_0x2c90('0x2a')](db[_0x2c90('0x2b')]['rawAttributes'],function(_0x4e3b0d){return{'name':_0x4e3b0d['fieldName'],'type':_0x4e3b0d[_0x2c90('0x2c')][_0x2c90('0x2d')]};});_0x386174[_0x2c90('0x2e')]=_[_0x2c90('0x2a')](_0x4950db,_0x2c90('0x27'));_0x386174[_0x2c90('0x2f')]=_[_0x2c90('0x30')](_0x502e61[_0x2c90('0x2f')]);_0x386174[_0x2c90('0x31')]=_[_0x2c90('0x32')](_0x386174['model'],_0x386174['query']);_0x39d35d['attributes']=_[_0x2c90('0x32')](_0x386174[_0x2c90('0x2e')],qs[_0x2c90('0x33')](_0x502e61[_0x2c90('0x2f')][_0x2c90('0x33')]));_0x39d35d[_0x2c90('0x34')]=_0x39d35d['attributes'][_0x2c90('0x35')]?_0x39d35d[_0x2c90('0x34')]:_0x386174['model'];if(!_0x502e61['query']['hasOwnProperty'](_0x2c90('0x36'))){_0x39d35d['limit']=qs[_0x2c90('0x1a')](_0x502e61[_0x2c90('0x2f')][_0x2c90('0x1a')]);_0x39d35d[_0x2c90('0x19')]=qs[_0x2c90('0x19')](_0x502e61[_0x2c90('0x2f')]['offset']);}_0x39d35d[_0x2c90('0x37')]=qs['sort'](_0x502e61[_0x2c90('0x2f')][_0x2c90('0x38')]);_0x39d35d[_0x2c90('0x39')]=qs[_0x2c90('0x31')](_[_0x2c90('0x3a')](_0x502e61[_0x2c90('0x2f')],_0x386174[_0x2c90('0x31')]),_0x4950db);if(_0x502e61[_0x2c90('0x2f')]['filter']){_0x39d35d['where']=_[_0x2c90('0x3b')](_0x39d35d[_0x2c90('0x39')],{'$or':_[_0x2c90('0x2a')](_0x4950db,function(_0x455136){if(_0x455136[_0x2c90('0x2c')]!==_0x2c90('0x3c')){var _0x3aa917={};_0x3aa917[_0x455136[_0x2c90('0x27')]]={'$like':'%'+_0x502e61[_0x2c90('0x2f')][_0x2c90('0x3d')]+'%'};return _0x3aa917;}})});}_0x39d35d=_[_0x2c90('0x3b')]({},_0x39d35d,_0x502e61[_0x2c90('0x3e')]);var _0x318dc5={'where':_0x39d35d[_0x2c90('0x39')]};return db['SugarcrmConfiguration'][_0x2c90('0x1c')](_0x318dc5)[_0x2c90('0x24')](function(_0x5705f4){_0x5d885d['count']=_0x5705f4;if(_0x502e61[_0x2c90('0x2f')][_0x2c90('0x3f')]){_0x39d35d[_0x2c90('0x40')]=[{'all':!![]}];}return db[_0x2c90('0x2b')][_0x2c90('0x41')](_0x39d35d);})[_0x2c90('0x24')](function(_0x2ae7c5){_0x5d885d[_0x2c90('0x42')]=_0x2ae7c5;return _0x5d885d;})[_0x2c90('0x24')](respondWithFilteredResult(_0xe43378,_0x39d35d))[_0x2c90('0x43')](handleError(_0xe43378,null));};exports['show']=function(_0x2506d2,_0x2f6d55){var _0x169cd5={'raw':![],'where':{'id':_0x2506d2[_0x2c90('0x44')]['id']}},_0x3423ea={};_0x3423ea[_0x2c90('0x2e')]=_[_0x2c90('0x30')](db[_0x2c90('0x2b')][_0x2c90('0x45')]);_0x3423ea[_0x2c90('0x2f')]=_[_0x2c90('0x30')](_0x2506d2[_0x2c90('0x2f')]);_0x3423ea[_0x2c90('0x31')]=_[_0x2c90('0x32')](_0x3423ea[_0x2c90('0x2e')],_0x3423ea[_0x2c90('0x2f')]);_0x169cd5[_0x2c90('0x34')]=_[_0x2c90('0x32')](_0x3423ea[_0x2c90('0x2e')],qs[_0x2c90('0x33')](_0x2506d2[_0x2c90('0x2f')][_0x2c90('0x33')]));_0x169cd5[_0x2c90('0x34')]=_0x169cd5['attributes']['length']?_0x169cd5[_0x2c90('0x34')]:_0x3423ea[_0x2c90('0x2e')];if(_0x2506d2[_0x2c90('0x2f')][_0x2c90('0x3f')]){_0x169cd5[_0x2c90('0x40')]=[{'all':!![]}];}_0x169cd5=_[_0x2c90('0x3b')]({},_0x169cd5,_0x2506d2[_0x2c90('0x3e')]);return db[_0x2c90('0x2b')][_0x2c90('0x46')](_0x169cd5)['then'](handleEntityNotFound(_0x2f6d55,null))[_0x2c90('0x24')](respondWithResult(_0x2f6d55,null))[_0x2c90('0x43')](handleError(_0x2f6d55,null));};exports[_0x2c90('0x47')]=function(_0xd27dc2,_0x2af70b){return db[_0x2c90('0x2b')]['create'](_0xd27dc2[_0x2c90('0x48')],{})[_0x2c90('0x24')](respondWithResult(_0x2af70b,0xc9))['catch'](handleError(_0x2af70b,null));};exports[_0x2c90('0x22')]=function(_0x89291f,_0x35c31e){if(_0x89291f[_0x2c90('0x48')]['id']){delete _0x89291f['body']['id'];}return db[_0x2c90('0x2b')][_0x2c90('0x46')]({'where':{'id':_0x89291f[_0x2c90('0x44')]['id']}})['then'](handleEntityNotFound(_0x35c31e,null))[_0x2c90('0x24')](saveUpdates(_0x89291f['body'],null))['then'](respondWithResult(_0x35c31e,null))[_0x2c90('0x43')](handleError(_0x35c31e,null));};exports[_0x2c90('0x23')]=function(_0xd4a070,_0xfc1654){return db['SugarcrmConfiguration'][_0x2c90('0x46')]({'where':{'id':_0xd4a070[_0x2c90('0x44')]['id']}})['then'](handleEntityNotFound(_0xfc1654,null))[_0x2c90('0x24')](removeEntity(_0xfc1654,null))['catch'](handleError(_0xfc1654,null));};exports[_0x2c90('0x49')]=function(_0x5a65c2,_0x13edc,_0x22d223){var _0x546cc5={};var _0x354249={};var _0x3faf9f;var _0x1f5b86;return db[_0x2c90('0x2b')][_0x2c90('0x4a')]({'where':{'id':_0x5a65c2['params']['id']}})[_0x2c90('0x24')](handleEntityNotFound(_0x13edc,null))[_0x2c90('0x24')](function(_0x37c0a2){if(_0x37c0a2){_0x3faf9f=_0x37c0a2;_0x354249[_0x2c90('0x2e')]=_[_0x2c90('0x30')](db['SugarcrmField'][_0x2c90('0x45')]);_0x354249[_0x2c90('0x2f')]=_[_0x2c90('0x30')](_0x5a65c2[_0x2c90('0x2f')]);_0x354249[_0x2c90('0x31')]=_[_0x2c90('0x32')](_0x354249[_0x2c90('0x2e')],_0x354249[_0x2c90('0x2f')]);_0x546cc5[_0x2c90('0x34')]=_['intersection'](_0x354249['model'],qs[_0x2c90('0x33')](_0x5a65c2[_0x2c90('0x2f')]['fields']));_0x546cc5[_0x2c90('0x34')]=_0x546cc5['attributes']['length']?_0x546cc5['attributes']:_0x354249['model'];_0x546cc5[_0x2c90('0x37')]=qs['sort'](_0x5a65c2[_0x2c90('0x2f')]['sort']);_0x546cc5[_0x2c90('0x39')]=qs[_0x2c90('0x31')](_[_0x2c90('0x3a')](_0x5a65c2[_0x2c90('0x2f')],_0x354249['filters']));if(_0x5a65c2[_0x2c90('0x2f')][_0x2c90('0x3d')]){_0x546cc5[_0x2c90('0x39')]=_['merge'](_0x546cc5[_0x2c90('0x39')],{'$or':_[_0x2c90('0x2a')](_0x546cc5[_0x2c90('0x34')],function(_0x456987){var _0x3562c5={};_0x3562c5[_0x456987]={'$like':'%'+_0x5a65c2[_0x2c90('0x2f')]['filter']+'%'};return _0x3562c5;})});}_0x546cc5=_['merge']({},_0x546cc5,_0x5a65c2[_0x2c90('0x3e')]);return _0x3faf9f[_0x2c90('0x49')](_0x546cc5);}})[_0x2c90('0x24')](function(_0x564fa0){if(_0x564fa0){_0x1f5b86=_0x564fa0['length'];if(!_0x5a65c2['query']['hasOwnProperty'](_0x2c90('0x36'))){_0x546cc5['limit']=qs[_0x2c90('0x1a')](_0x5a65c2[_0x2c90('0x2f')][_0x2c90('0x1a')]);_0x546cc5['offset']=qs['offset'](_0x5a65c2['query'][_0x2c90('0x19')]);}return _0x3faf9f[_0x2c90('0x49')](_0x546cc5);}})[_0x2c90('0x24')](function(_0x1e7b93){if(_0x1e7b93){return _0x1e7b93?{'count':_0x1f5b86,'rows':_0x1e7b93}:null;}})[_0x2c90('0x24')](respondWithResult(_0x13edc,null))[_0x2c90('0x43')](handleError(_0x13edc,null));};exports['getSubjects']=function(_0x3a902d,_0x16b95a,_0x474539){var _0x54b4b1={};var _0x10031b={};var _0x384b7b;var _0xb81aa8;return db[_0x2c90('0x2b')][_0x2c90('0x4a')]({'where':{'id':_0x3a902d[_0x2c90('0x44')]['id']}})['then'](handleEntityNotFound(_0x16b95a,null))[_0x2c90('0x24')](function(_0x34f85c){if(_0x34f85c){_0x384b7b=_0x34f85c;_0x10031b['model']=_[_0x2c90('0x30')](db[_0x2c90('0x4b')]['rawAttributes']);_0x10031b[_0x2c90('0x2f')]=_['keys'](_0x3a902d[_0x2c90('0x2f')]);_0x10031b['filters']=_[_0x2c90('0x32')](_0x10031b['model'],_0x10031b[_0x2c90('0x2f')]);_0x54b4b1[_0x2c90('0x34')]=_[_0x2c90('0x32')](_0x10031b[_0x2c90('0x2e')],qs[_0x2c90('0x33')](_0x3a902d[_0x2c90('0x2f')][_0x2c90('0x33')]));_0x54b4b1[_0x2c90('0x34')]=_0x54b4b1[_0x2c90('0x34')]['length']?_0x54b4b1[_0x2c90('0x34')]:_0x10031b[_0x2c90('0x2e')];_0x54b4b1[_0x2c90('0x37')]=qs['sort'](_0x3a902d[_0x2c90('0x2f')][_0x2c90('0x38')]);_0x54b4b1[_0x2c90('0x39')]=qs['filters'](_[_0x2c90('0x3a')](_0x3a902d[_0x2c90('0x2f')],_0x10031b[_0x2c90('0x31')]));if(_0x3a902d[_0x2c90('0x2f')][_0x2c90('0x3d')]){_0x54b4b1['where']=_[_0x2c90('0x3b')](_0x54b4b1[_0x2c90('0x39')],{'$or':_[_0x2c90('0x2a')](_0x54b4b1['attributes'],function(_0x53a672){var _0x44b857={};_0x44b857[_0x53a672]={'$like':'%'+_0x3a902d[_0x2c90('0x2f')][_0x2c90('0x3d')]+'%'};return _0x44b857;})});}_0x54b4b1=_[_0x2c90('0x3b')]({},_0x54b4b1,_0x3a902d[_0x2c90('0x3e')]);return _0x384b7b[_0x2c90('0x4c')](_0x54b4b1);}})[_0x2c90('0x24')](function(_0x289f07){if(_0x289f07){_0xb81aa8=_0x289f07[_0x2c90('0x35')];if(!_0x3a902d[_0x2c90('0x2f')][_0x2c90('0x4d')](_0x2c90('0x36'))){_0x54b4b1[_0x2c90('0x1a')]=qs[_0x2c90('0x1a')](_0x3a902d[_0x2c90('0x2f')][_0x2c90('0x1a')]);_0x54b4b1['offset']=qs['offset'](_0x3a902d[_0x2c90('0x2f')][_0x2c90('0x19')]);}return _0x384b7b[_0x2c90('0x4c')](_0x54b4b1);}})['then'](function(_0x1ee8ad){if(_0x1ee8ad){return _0x1ee8ad?{'count':_0xb81aa8,'rows':_0x1ee8ad}:null;}})['then'](respondWithResult(_0x16b95a,null))[_0x2c90('0x43')](handleError(_0x16b95a,null));};exports['getDescriptions']=function(_0x955df1,_0x1b51ef,_0x3a2e72){var _0x6e5727={};var _0xc8e81b={};var _0x2c96a8;var _0x295390;return db[_0x2c90('0x2b')][_0x2c90('0x4a')]({'where':{'id':_0x955df1[_0x2c90('0x44')]['id']}})[_0x2c90('0x24')](handleEntityNotFound(_0x1b51ef,null))[_0x2c90('0x24')](function(_0x265ba7){if(_0x265ba7){_0x2c96a8=_0x265ba7;_0xc8e81b[_0x2c90('0x2e')]=_['keys'](db[_0x2c90('0x4b')]['rawAttributes']);_0xc8e81b[_0x2c90('0x2f')]=_[_0x2c90('0x30')](_0x955df1[_0x2c90('0x2f')]);_0xc8e81b[_0x2c90('0x31')]=_['intersection'](_0xc8e81b[_0x2c90('0x2e')],_0xc8e81b['query']);_0x6e5727[_0x2c90('0x34')]=_[_0x2c90('0x32')](_0xc8e81b[_0x2c90('0x2e')],qs[_0x2c90('0x33')](_0x955df1[_0x2c90('0x2f')]['fields']));_0x6e5727[_0x2c90('0x34')]=_0x6e5727[_0x2c90('0x34')][_0x2c90('0x35')]?_0x6e5727[_0x2c90('0x34')]:_0xc8e81b[_0x2c90('0x2e')];_0x6e5727['order']=qs[_0x2c90('0x38')](_0x955df1[_0x2c90('0x2f')]['sort']);_0x6e5727[_0x2c90('0x39')]=qs['filters'](_[_0x2c90('0x3a')](_0x955df1[_0x2c90('0x2f')],_0xc8e81b['filters']));if(_0x955df1[_0x2c90('0x2f')][_0x2c90('0x3d')]){_0x6e5727[_0x2c90('0x39')]=_['merge'](_0x6e5727[_0x2c90('0x39')],{'$or':_[_0x2c90('0x2a')](_0x6e5727[_0x2c90('0x34')],function(_0x32f0ef){var _0x595a76={};_0x595a76[_0x32f0ef]={'$like':'%'+_0x955df1[_0x2c90('0x2f')][_0x2c90('0x3d')]+'%'};return _0x595a76;})});}_0x6e5727=_[_0x2c90('0x3b')]({},_0x6e5727,_0x955df1[_0x2c90('0x3e')]);return _0x2c96a8[_0x2c90('0x4e')](_0x6e5727);}})[_0x2c90('0x24')](function(_0x529e15){if(_0x529e15){_0x295390=_0x529e15[_0x2c90('0x35')];if(!_0x955df1[_0x2c90('0x2f')][_0x2c90('0x4d')](_0x2c90('0x36'))){_0x6e5727[_0x2c90('0x1a')]=qs['limit'](_0x955df1[_0x2c90('0x2f')]['limit']);_0x6e5727[_0x2c90('0x19')]=qs[_0x2c90('0x19')](_0x955df1['query'][_0x2c90('0x19')]);}return _0x2c96a8[_0x2c90('0x4e')](_0x6e5727);}})[_0x2c90('0x24')](function(_0x330f01){if(_0x330f01){return _0x330f01?{'count':_0x295390,'rows':_0x330f01}:null;}})[_0x2c90('0x24')](respondWithResult(_0x1b51ef,null))[_0x2c90('0x43')](handleError(_0x1b51ef,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.model.js index 76584cd..90a086e 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 _0xa036=['request-promise','path','rimraf','./intSugarcrmConfiguration.attributes','exports','SugarcrmConfiguration','util','api','moment'];(function(_0x44b913,_0x567c84){var _0x1678c0=function(_0x3e49ff){while(--_0x3e49ff){_0x44b913['push'](_0x44b913['shift']());}};_0x1678c0(++_0x567c84);}(_0xa036,0x10b));var _0x6a03=function(_0x154dbd,_0x8fd445){_0x154dbd=_0x154dbd-0x0;var _0x5eac3f=_0xa036[_0x154dbd];return _0x5eac3f;};'use strict';var _=require('lodash');var util=require(_0x6a03('0x0'));var logger=require('../../config/logger')(_0x6a03('0x1'));var moment=require(_0x6a03('0x2'));var BPromise=require('bluebird');var rp=require(_0x6a03('0x3'));var fs=require('fs');var path=require(_0x6a03('0x4'));var rimraf=require(_0x6a03('0x5'));var config=require('../../config/environment');var attributes=require(_0x6a03('0x6'));module[_0x6a03('0x7')]=function(_0x2444a8,_0x458f8e){return _0x2444a8['define'](_0x6a03('0x8'),attributes,{'tableName':'int_sugarcrm_configurations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9297=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmConfiguration.attributes','exports','define','int_sugarcrm_configurations','lodash','util'];(function(_0x2a7bc6,_0x3b31bf){var _0x5b6705=function(_0x12076d){while(--_0x12076d){_0x2a7bc6['push'](_0x2a7bc6['shift']());}};_0x5b6705(++_0x3b31bf);}(_0x9297,0xfa));var _0x7929=function(_0x45b6ee,_0x5e4d97){_0x45b6ee=_0x45b6ee-0x0;var _0x463dea=_0x9297[_0x45b6ee];return _0x463dea;};'use strict';var _=require(_0x7929('0x0'));var util=require(_0x7929('0x1'));var logger=require(_0x7929('0x2'))(_0x7929('0x3'));var moment=require(_0x7929('0x4'));var BPromise=require(_0x7929('0x5'));var rp=require(_0x7929('0x6'));var fs=require('fs');var path=require(_0x7929('0x7'));var rimraf=require(_0x7929('0x8'));var config=require(_0x7929('0x9'));var attributes=require(_0x7929('0xa'));module[_0x7929('0xb')]=function(_0xd11ee6,_0x3e4f1e){return _0xd11ee6[_0x7929('0xc')]('SugarcrmConfiguration',attributes,{'tableName':_0x7929('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js b/server/api/intSugarcrmConfiguration/intSugarcrmConfiguration.rpc.js index f6bc78f..85244b1 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 _0xffb9=['rpc','../../config/environment','client','request','then','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','debug','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x503050,_0x2ec99a){var _0x2099c8=function(_0x4517f0){while(--_0x4517f0){_0x503050['push'](_0x503050['shift']());}};_0x2099c8(++_0x2ec99a);}(_0xffb9,0x10a));var _0x9ffb=function(_0x2ea53c,_0x1a4fc4){_0x2ea53c=_0x2ea53c-0x0;var _0x104c71=_0xffb9[_0x2ea53c];return _0x104c71;};'use strict';var _=require('lodash');var util=require(_0x9ffb('0x0'));var moment=require(_0x9ffb('0x1'));var BPromise=require(_0x9ffb('0x2'));var rs=require(_0x9ffb('0x3'));var fs=require('fs');var Redis=require(_0x9ffb('0x4'));var db=require(_0x9ffb('0x5'))['db'];var utils=require(_0x9ffb('0x6'));var logger=require('../../config/logger')(_0x9ffb('0x7'));var config=require(_0x9ffb('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x9ffb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x27c0a6,_0x2d8e23,_0x440442){return new BPromise(function(_0x3c4b3d,_0x2effad){return client[_0x9ffb('0xa')](_0x27c0a6,_0x440442)[_0x9ffb('0xb')](function(_0x44fe9e){logger[_0x9ffb('0xc')](_0x9ffb('0xd'),_0x2d8e23,_0x9ffb('0xe'));logger[_0x9ffb('0xf')](_0x9ffb('0x10'),_0x2d8e23,'request\x20sent',JSON['stringify'](_0x44fe9e));if(_0x44fe9e[_0x9ffb('0x11')]){if(_0x44fe9e['error'][_0x9ffb('0x12')]===0x1f4){logger[_0x9ffb('0x11')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2d8e23,_0x44fe9e[_0x9ffb('0x11')]['message']);return _0x2effad(_0x44fe9e[_0x9ffb('0x11')][_0x9ffb('0x13')]);}logger[_0x9ffb('0x11')](_0x9ffb('0xd'),_0x2d8e23,_0x44fe9e[_0x9ffb('0x11')][_0x9ffb('0x13')]);return _0x3c4b3d(_0x44fe9e[_0x9ffb('0x11')]['message']);}else{logger[_0x9ffb('0xc')]('SugarcrmConfiguration,\x20%s,\x20%s',_0x2d8e23,_0x9ffb('0xe'));_0x3c4b3d(_0x44fe9e['result'][_0x9ffb('0x13')]);}})[_0x9ffb('0x14')](function(_0x428fb4){logger['error'](_0x9ffb('0xd'),_0x2d8e23,_0x428fb4);_0x2effad(_0x428fb4);});});} \ No newline at end of file +var _0x76a5=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','SugarcrmConfiguration,\x20%s,\x20%s','request\x20sent','SugarcrmConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x76a5,0x87));var _0x576a=function(_0x4858cf,_0x45cc07){_0x4858cf=_0x4858cf-0x0;var _0x461702=_0x76a5[_0x4858cf];return _0x461702;};'use strict';var _=require(_0x576a('0x0'));var util=require('util');var moment=require(_0x576a('0x1'));var BPromise=require(_0x576a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x576a('0x3'));var db=require(_0x576a('0x4'))['db'];var utils=require(_0x576a('0x5'));var logger=require(_0x576a('0x6'))(_0x576a('0x7'));var config=require(_0x576a('0x8'));var jayson=require(_0x576a('0x9'));var client=jayson['client'][_0x576a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x46fcd4,_0x38561f,_0x5758af){return new BPromise(function(_0x18ec51,_0x15b035){return client['request'](_0x46fcd4,_0x5758af)['then'](function(_0x563004){logger[_0x576a('0xb')](_0x576a('0xc'),_0x38561f,_0x576a('0xd'));logger['debug'](_0x576a('0xe'),_0x38561f,_0x576a('0xd'),JSON[_0x576a('0xf')](_0x563004));if(_0x563004['error']){if(_0x563004['error']['code']===0x1f4){logger[_0x576a('0x10')](_0x576a('0xc'),_0x38561f,_0x563004[_0x576a('0x10')][_0x576a('0x11')]);return _0x15b035(_0x563004[_0x576a('0x10')][_0x576a('0x11')]);}logger['error'](_0x576a('0xc'),_0x38561f,_0x563004[_0x576a('0x10')][_0x576a('0x11')]);return _0x18ec51(_0x563004[_0x576a('0x10')]['message']);}else{logger['info'](_0x576a('0xc'),_0x38561f,_0x576a('0xd'));_0x18ec51(_0x563004[_0x576a('0x12')][_0x576a('0x11')]);}})[_0x576a('0x13')](function(_0x1001d7){logger[_0x576a('0x10')](_0x576a('0xc'),_0x38561f,_0x1001d7);_0x15b035(_0x1001d7);});});} \ No newline at end of file diff --git a/server/api/intSugarcrmField/index.js b/server/api/intSugarcrmField/index.js index 4fd138f..80f6e0c 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 _0x61c5=['isAuthenticated','create','put','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index','/:id','show'];(function(_0x54b062,_0x264bb5){var _0x255e41=function(_0x3c7e6f){while(--_0x3c7e6f){_0x54b062['push'](_0x54b062['shift']());}};_0x255e41(++_0x264bb5);}(_0x61c5,0x19e));var _0x561c=function(_0x1e3fa7,_0x4ca156){_0x1e3fa7=_0x1e3fa7-0x0;var _0x559ef8=_0x61c5[_0x1e3fa7];return _0x559ef8;};'use strict';var multer=require(_0x561c('0x0'));var util=require(_0x561c('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x561c('0x2'));var router=express[_0x561c('0x3')]();var fs_extra=require(_0x561c('0x4'));var auth=require(_0x561c('0x5'));var interaction=require(_0x561c('0x6'));var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0x561c('0x7')]('/',auth['isAuthenticated'](),controller[_0x561c('0x8')]);router[_0x561c('0x7')](_0x561c('0x9'),auth['isAuthenticated'](),controller[_0x561c('0xa')]);router['post']('/',auth[_0x561c('0xb')](),controller[_0x561c('0xc')]);router[_0x561c('0xd')](_0x561c('0x9'),auth[_0x561c('0xb')](),controller[_0x561c('0xe')]);router[_0x561c('0xf')](_0x561c('0x9'),auth[_0x561c('0xb')](),controller['destroy']);module[_0x561c('0x10')]=router; \ No newline at end of file +var _0xf99f=['isAuthenticated','post','create','put','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x2330a1,_0x4bb8d3){var _0x32c0a6=function(_0xba8ada){while(--_0xba8ada){_0x2330a1['push'](_0x2330a1['shift']());}};_0x32c0a6(++_0x4bb8d3);}(_0xf99f,0xb3));var _0xff99=function(_0x47b15f,_0x103e93){_0x47b15f=_0x47b15f-0x0;var _0x55bf25=_0xf99f[_0x47b15f];return _0x55bf25;};'use strict';var multer=require(_0xff99('0x0'));var util=require(_0xff99('0x1'));var path=require(_0xff99('0x2'));var timeout=require(_0xff99('0x3'));var express=require(_0xff99('0x4'));var router=express[_0xff99('0x5')]();var fs_extra=require(_0xff99('0x6'));var auth=require(_0xff99('0x7'));var interaction=require(_0xff99('0x8'));var config=require('../../config/environment');var controller=require('./intSugarcrmField.controller');router[_0xff99('0x9')]('/',auth['isAuthenticated'](),controller[_0xff99('0xa')]);router[_0xff99('0x9')]('/:id',auth[_0xff99('0xb')](),controller['show']);router[_0xff99('0xc')]('/',auth['isAuthenticated'](),controller[_0xff99('0xd')]);router[_0xff99('0xe')](_0xff99('0xf'),auth['isAuthenticated'](),controller[_0xff99('0x10')]);router['delete']('/:id',auth[_0xff99('0xb')](),controller[_0xff99('0x11')]);module[_0xff99('0x12')]=router; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.attributes.js b/server/api/intSugarcrmField/intSugarcrmField.attributes.js index 06c5749..1e54892 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 _0x5ecc=['picklist','STRING','ENUM','BOOLEAN','exports','string','customVariable','keyValue'];(function(_0x1a6fa1,_0x9a95ee){var _0x2b469e=function(_0x29825f){while(--_0x29825f){_0x1a6fa1['push'](_0x1a6fa1['shift']());}};_0x2b469e(++_0x9a95ee);}(_0x5ecc,0x134));var _0xc5ec=function(_0x143183,_0x1a251f){_0x143183=_0x143183-0x0;var _0x35cfaf=_0x5ecc[_0x143183];return _0x35cfaf;};'use strict';var Sequelize=require('sequelize');module[_0xc5ec('0x0')]={'type':{'type':Sequelize['ENUM'](_0xc5ec('0x1'),'variable',_0xc5ec('0x2'),_0xc5ec('0x3'),_0xc5ec('0x4')),'defaultValue':_0xc5ec('0x1')},'content':{'type':Sequelize[_0xc5ec('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize[_0xc5ec('0x6')](_0xc5ec('0x1'),'variable','customVariable')},'keyContent':{'type':Sequelize[_0xc5ec('0x5')]},'idField':{'type':Sequelize[_0xc5ec('0x5')]},'nameField':{'type':Sequelize[_0xc5ec('0x5')]},'customField':{'type':Sequelize[_0xc5ec('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xc5ec('0x5')]}}; \ No newline at end of file +var _0xddf9=['variable','customVariable','keyValue','STRING','sequelize','string'];(function(_0x223c3b,_0x25ff1a){var _0xe95b8d=function(_0x13be32){while(--_0x13be32){_0x223c3b['push'](_0x223c3b['shift']());}};_0xe95b8d(++_0x25ff1a);}(_0xddf9,0x196));var _0x9ddf=function(_0x8f551b,_0x2d76eb){_0x8f551b=_0x8f551b-0x0;var _0x285bfb=_0xddf9[_0x8f551b];return _0x285bfb;};'use strict';var Sequelize=require(_0x9ddf('0x0'));module['exports']={'type':{'type':Sequelize['ENUM'](_0x9ddf('0x1'),_0x9ddf('0x2'),_0x9ddf('0x3'),_0x9ddf('0x4'),'picklist'),'defaultValue':_0x9ddf('0x1')},'content':{'type':Sequelize[_0x9ddf('0x5')]},'key':{'type':Sequelize['STRING']},'keyType':{'type':Sequelize['ENUM'](_0x9ddf('0x1'),'variable',_0x9ddf('0x3'))},'keyContent':{'type':Sequelize[_0x9ddf('0x5')]},'idField':{'type':Sequelize[_0x9ddf('0x5')]},'nameField':{'type':Sequelize[_0x9ddf('0x5')]},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x9ddf('0x5')]}}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.controller.js b/server/api/intSugarcrmField/intSugarcrmField.controller.js index feeb06e..56a542a 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 _0x88b9=['include','findAll','rows','catch','show','params','keys','find','create','body','update','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','path','fs-extra','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','destroy','name','send','map','SugarcrmField','rawAttributes','fieldName','type','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','merge','VIRTUAL','filter','options','then'];(function(_0x3520b8,_0x2d2034){var _0x262768=function(_0xd3aab){while(--_0xd3aab){_0x3520b8['push'](_0x3520b8['shift']());}};_0x262768(++_0x2d2034);}(_0x88b9,0x1bb));var _0x988b=function(_0x164594,_0x5f196d){_0x164594=_0x164594-0x0;var _0x3e652c=_0x88b9[_0x164594];return _0x3e652c;};'use strict';var emlformat=require(_0x988b('0x0'));var rimraf=require(_0x988b('0x1'));var zipdir=require(_0x988b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x988b('0x3'));var moment=require(_0x988b('0x4'));var BPromise=require(_0x988b('0x5'));var Mustache=require(_0x988b('0x6'));var util=require('util');var path=require(_0x988b('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x988b('0x8'));var _=require('lodash');var squel=require(_0x988b('0x9'));var crypto=require(_0x988b('0xa'));var jsforce=require(_0x988b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x988b('0xc'));var querystring=require(_0x988b('0xd'));var Papa=require(_0x988b('0xe'));var Redis=require(_0x988b('0xf'));var authService=require(_0x988b('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x988b('0x11'));var hardwareService=require(_0x988b('0x12'));var logger=require(_0x988b('0x13'))(_0x988b('0x14'));var utils=require(_0x988b('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x988b('0x16'));var db=require(_0x988b('0x17'))['db'];function respondWithStatusCode(_0x22e3de,_0x11eaaa){_0x11eaaa=_0x11eaaa||0xcc;return function(_0x9a08ec){if(_0x9a08ec){return _0x22e3de['sendStatus'](_0x11eaaa);}return _0x22e3de[_0x988b('0x18')](_0x11eaaa)[_0x988b('0x19')]();};}function respondWithResult(_0x4ef475,_0x4d543c){_0x4d543c=_0x4d543c||0xc8;return function(_0x27f7c7){if(_0x27f7c7){return _0x4ef475['status'](_0x4d543c)[_0x988b('0x1a')](_0x27f7c7);}};}function respondWithFilteredResult(_0x4ccab5,_0xc16a7e){return function(_0x5572d1){if(_0x5572d1){var _0x14dff9=typeof _0xc16a7e[_0x988b('0x1b')]==='undefined'&&typeof _0xc16a7e[_0x988b('0x1c')]===_0x988b('0x1d');var _0x3452dd=_0x5572d1['count'];var _0x49dff5=_0x14dff9?0x0:_0xc16a7e[_0x988b('0x1b')];var _0x4eadf0=_0x14dff9?_0x5572d1[_0x988b('0x1e')]:_0xc16a7e[_0x988b('0x1b')]+_0xc16a7e[_0x988b('0x1c')];var _0x58363c;if(_0x4eadf0>=_0x3452dd){_0x4eadf0=_0x3452dd;_0x58363c=0xc8;}else{_0x58363c=0xce;}_0x4ccab5[_0x988b('0x18')](_0x58363c);return _0x4ccab5['set'](_0x988b('0x1f'),_0x49dff5+'-'+_0x4eadf0+'/'+_0x3452dd)[_0x988b('0x1a')](_0x5572d1);}return null;};}function patchUpdates(_0x23f55d){return function(_0x2165e1){try{jsonpatch[_0x988b('0x20')](_0x2165e1,_0x23f55d,!![]);}catch(_0x3e3bd0){return BPromise[_0x988b('0x21')](_0x3e3bd0);}return _0x2165e1[_0x988b('0x22')]();};}function saveUpdates(_0x230126,_0x3a43d5){return function(_0x5446ab){if(_0x5446ab){return _0x5446ab['update'](_0x230126)['then'](function(_0x4f65b7){return _0x4f65b7;});}return null;};}function removeEntity(_0x211459,_0x3e1ba1){return function(_0x1d8ee2){if(_0x1d8ee2){return _0x1d8ee2[_0x988b('0x23')]()['then'](function(){_0x211459[_0x988b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x35c058,_0xf99815){return function(_0x2f306e){if(!_0x2f306e){_0x35c058['sendStatus'](0x194);}return _0x2f306e;};}function handleError(_0x3f60ff,_0xfe0040){_0xfe0040=_0xfe0040||0x1f4;return function(_0xeda536){logger['error'](_0xeda536['stack']);if(_0xeda536[_0x988b('0x24')]){delete _0xeda536[_0x988b('0x24')];}_0x3f60ff[_0x988b('0x18')](_0xfe0040)[_0x988b('0x25')](_0xeda536);};}exports['index']=function(_0x5db427,_0x27af51){var _0x54cb44={},_0x456b1e={},_0x1c5a07={'count':0x0,'rows':[]};var _0x3836df=_[_0x988b('0x26')](db[_0x988b('0x27')][_0x988b('0x28')],function(_0x4c2d1f){return{'name':_0x4c2d1f[_0x988b('0x29')],'type':_0x4c2d1f[_0x988b('0x2a')][_0x988b('0x2b')]};});_0x456b1e['model']=_[_0x988b('0x26')](_0x3836df,_0x988b('0x24'));_0x456b1e[_0x988b('0x2c')]=_['keys'](_0x5db427['query']);_0x456b1e[_0x988b('0x2d')]=_[_0x988b('0x2e')](_0x456b1e[_0x988b('0x2f')],_0x456b1e[_0x988b('0x2c')]);_0x54cb44[_0x988b('0x30')]=_[_0x988b('0x2e')](_0x456b1e['model'],qs['fields'](_0x5db427[_0x988b('0x2c')][_0x988b('0x31')]));_0x54cb44['attributes']=_0x54cb44[_0x988b('0x30')][_0x988b('0x32')]?_0x54cb44[_0x988b('0x30')]:_0x456b1e[_0x988b('0x2f')];if(!_0x5db427[_0x988b('0x2c')][_0x988b('0x33')](_0x988b('0x34'))){_0x54cb44['limit']=qs[_0x988b('0x1c')](_0x5db427[_0x988b('0x2c')][_0x988b('0x1c')]);_0x54cb44['offset']=qs[_0x988b('0x1b')](_0x5db427['query'][_0x988b('0x1b')]);}_0x54cb44['order']=qs['sort'](_0x5db427[_0x988b('0x2c')][_0x988b('0x35')]);_0x54cb44[_0x988b('0x36')]=qs['filters'](_[_0x988b('0x37')](_0x5db427[_0x988b('0x2c')],_0x456b1e[_0x988b('0x2d')]),_0x3836df);if(_0x5db427[_0x988b('0x2c')]['filter']){_0x54cb44[_0x988b('0x36')]=_[_0x988b('0x38')](_0x54cb44[_0x988b('0x36')],{'$or':_['map'](_0x3836df,function(_0x6467e7){if(_0x6467e7[_0x988b('0x2a')]!==_0x988b('0x39')){var _0x3fb063={};_0x3fb063[_0x6467e7[_0x988b('0x24')]]={'$like':'%'+_0x5db427[_0x988b('0x2c')][_0x988b('0x3a')]+'%'};return _0x3fb063;}})});}_0x54cb44=_[_0x988b('0x38')]({},_0x54cb44,_0x5db427[_0x988b('0x3b')]);var _0x5946b4={'where':_0x54cb44[_0x988b('0x36')]};return db['SugarcrmField'][_0x988b('0x1e')](_0x5946b4)[_0x988b('0x3c')](function(_0x5bd439){_0x1c5a07[_0x988b('0x1e')]=_0x5bd439;if(_0x5db427[_0x988b('0x2c')]['includeAll']){_0x54cb44[_0x988b('0x3d')]=[{'all':!![]}];}return db[_0x988b('0x27')][_0x988b('0x3e')](_0x54cb44);})[_0x988b('0x3c')](function(_0x162cd8){_0x1c5a07[_0x988b('0x3f')]=_0x162cd8;return _0x1c5a07;})[_0x988b('0x3c')](respondWithFilteredResult(_0x27af51,_0x54cb44))[_0x988b('0x40')](handleError(_0x27af51,null));};exports[_0x988b('0x41')]=function(_0x3ee0da,_0xdd4e0b){var _0x1cbe9c={'raw':!![],'where':{'id':_0x3ee0da[_0x988b('0x42')]['id']}},_0x2f29f8={};_0x2f29f8['model']=_[_0x988b('0x43')](db[_0x988b('0x27')][_0x988b('0x28')]);_0x2f29f8[_0x988b('0x2c')]=_[_0x988b('0x43')](_0x3ee0da['query']);_0x2f29f8['filters']=_[_0x988b('0x2e')](_0x2f29f8[_0x988b('0x2f')],_0x2f29f8[_0x988b('0x2c')]);_0x1cbe9c[_0x988b('0x30')]=_[_0x988b('0x2e')](_0x2f29f8['model'],qs[_0x988b('0x31')](_0x3ee0da['query'][_0x988b('0x31')]));_0x1cbe9c[_0x988b('0x30')]=_0x1cbe9c[_0x988b('0x30')][_0x988b('0x32')]?_0x1cbe9c[_0x988b('0x30')]:_0x2f29f8[_0x988b('0x2f')];if(_0x3ee0da[_0x988b('0x2c')]['includeAll']){_0x1cbe9c['include']=[{'all':!![]}];}_0x1cbe9c=_[_0x988b('0x38')]({},_0x1cbe9c,_0x3ee0da[_0x988b('0x3b')]);return db['SugarcrmField'][_0x988b('0x44')](_0x1cbe9c)[_0x988b('0x3c')](handleEntityNotFound(_0xdd4e0b,null))['then'](respondWithResult(_0xdd4e0b,null))[_0x988b('0x40')](handleError(_0xdd4e0b,null));};exports[_0x988b('0x45')]=function(_0x126425,_0x396d5c){return db[_0x988b('0x27')]['create'](_0x126425[_0x988b('0x46')],{})[_0x988b('0x3c')](respondWithResult(_0x396d5c,0xc9))[_0x988b('0x40')](handleError(_0x396d5c,null));};exports[_0x988b('0x47')]=function(_0x33141a,_0x5d689c){if(_0x33141a[_0x988b('0x46')]['id']){delete _0x33141a[_0x988b('0x46')]['id'];}return db[_0x988b('0x27')][_0x988b('0x44')]({'where':{'id':_0x33141a[_0x988b('0x42')]['id']}})[_0x988b('0x3c')](handleEntityNotFound(_0x5d689c,null))[_0x988b('0x3c')](saveUpdates(_0x33141a['body'],null))[_0x988b('0x3c')](respondWithResult(_0x5d689c,null))['catch'](handleError(_0x5d689c,null));};exports[_0x988b('0x23')]=function(_0x754d85,_0x1960f2){return db[_0x988b('0x27')][_0x988b('0x44')]({'where':{'id':_0x754d85[_0x988b('0x42')]['id']}})[_0x988b('0x3c')](handleEntityNotFound(_0x1960f2,null))[_0x988b('0x3c')](removeEntity(_0x1960f2,null))[_0x988b('0x40')](handleError(_0x1960f2,null));}; \ No newline at end of file +var _0x6827=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','sendStatus','name','send','map','SugarcrmField','rawAttributes','fieldName','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','then','catch','show','params','keys','find','create','body','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x164eca,_0x555e28){var _0x2ce562=function(_0x148ca6){while(--_0x148ca6){_0x164eca['push'](_0x164eca['shift']());}};_0x2ce562(++_0x555e28);}(_0x6827,0x1aa));var _0x7682=function(_0x32ab6b,_0xe4cc67){_0x32ab6b=_0x32ab6b-0x0;var _0x1bf654=_0x6827[_0x32ab6b];return _0x1bf654;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x7682('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x7682('0x1'));var BPromise=require(_0x7682('0x2'));var Mustache=require(_0x7682('0x3'));var util=require(_0x7682('0x4'));var path=require(_0x7682('0x5'));var sox=require(_0x7682('0x6'));var csv=require(_0x7682('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7682('0x8'));var _=require(_0x7682('0x9'));var squel=require(_0x7682('0xa'));var crypto=require('crypto');var jsforce=require(_0x7682('0xb'));var deskjs=require(_0x7682('0xc'));var toCsv=require(_0x7682('0x7'));var querystring=require(_0x7682('0xd'));var Papa=require(_0x7682('0xe'));var Redis=require(_0x7682('0xf'));var authService=require(_0x7682('0x10'));var qs=require(_0x7682('0x11'));var as=require(_0x7682('0x12'));var hardwareService=require(_0x7682('0x13'));var logger=require('../../config/logger')('api');var utils=require(_0x7682('0x14'));var config=require(_0x7682('0x15'));var licenseUtil=require(_0x7682('0x16'));var db=require(_0x7682('0x17'))['db'];function respondWithStatusCode(_0x5d4bb0,_0x40701a){_0x40701a=_0x40701a||0xcc;return function(_0x2cab37){if(_0x2cab37){return _0x5d4bb0['sendStatus'](_0x40701a);}return _0x5d4bb0['status'](_0x40701a)['end']();};}function respondWithResult(_0x3826b4,_0x5d8b80){_0x5d8b80=_0x5d8b80||0xc8;return function(_0x2074cc){if(_0x2074cc){return _0x3826b4[_0x7682('0x18')](_0x5d8b80)[_0x7682('0x19')](_0x2074cc);}};}function respondWithFilteredResult(_0x322087,_0x465228){return function(_0x4e4fa5){if(_0x4e4fa5){var _0x127cb8=typeof _0x465228[_0x7682('0x1a')]===_0x7682('0x1b')&&typeof _0x465228[_0x7682('0x1c')]===_0x7682('0x1b');var _0x11c8c1=_0x4e4fa5[_0x7682('0x1d')];var _0x29cc01=_0x127cb8?0x0:_0x465228['offset'];var _0x85c195=_0x127cb8?_0x4e4fa5[_0x7682('0x1d')]:_0x465228[_0x7682('0x1a')]+_0x465228[_0x7682('0x1c')];var _0x241b8a;if(_0x85c195>=_0x11c8c1){_0x85c195=_0x11c8c1;_0x241b8a=0xc8;}else{_0x241b8a=0xce;}_0x322087[_0x7682('0x18')](_0x241b8a);return _0x322087[_0x7682('0x1e')](_0x7682('0x1f'),_0x29cc01+'-'+_0x85c195+'/'+_0x11c8c1)[_0x7682('0x19')](_0x4e4fa5);}return null;};}function patchUpdates(_0x34ca12){return function(_0x47ce86){try{jsonpatch[_0x7682('0x20')](_0x47ce86,_0x34ca12,!![]);}catch(_0x4f9309){return BPromise[_0x7682('0x21')](_0x4f9309);}return _0x47ce86[_0x7682('0x22')]();};}function saveUpdates(_0xe2653d,_0x497829){return function(_0x8a8aeb){if(_0x8a8aeb){return _0x8a8aeb[_0x7682('0x23')](_0xe2653d)['then'](function(_0x3e6fc9){return _0x3e6fc9;});}return null;};}function removeEntity(_0x557a8b,_0xa3c2bb){return function(_0x32c50b){if(_0x32c50b){return _0x32c50b[_0x7682('0x24')]()['then'](function(){_0x557a8b[_0x7682('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x412734,_0x25dd2e){return function(_0x70d1e0){if(!_0x70d1e0){_0x412734[_0x7682('0x25')](0x194);}return _0x70d1e0;};}function handleError(_0x4844e8,_0x55fac8){_0x55fac8=_0x55fac8||0x1f4;return function(_0x493242){logger['error'](_0x493242['stack']);if(_0x493242['name']){delete _0x493242[_0x7682('0x26')];}_0x4844e8['status'](_0x55fac8)[_0x7682('0x27')](_0x493242);};}exports['index']=function(_0x13b948,_0x5b24cc){var _0x1e764a={},_0x107957={},_0x563792={'count':0x0,'rows':[]};var _0xda96e4=_[_0x7682('0x28')](db[_0x7682('0x29')][_0x7682('0x2a')],function(_0x224765){return{'name':_0x224765[_0x7682('0x2b')],'type':_0x224765['type']['key']};});_0x107957[_0x7682('0x2c')]=_['map'](_0xda96e4,'name');_0x107957['query']=_['keys'](_0x13b948[_0x7682('0x2d')]);_0x107957['filters']=_[_0x7682('0x2e')](_0x107957['model'],_0x107957[_0x7682('0x2d')]);_0x1e764a[_0x7682('0x2f')]=_[_0x7682('0x2e')](_0x107957[_0x7682('0x2c')],qs[_0x7682('0x30')](_0x13b948[_0x7682('0x2d')][_0x7682('0x30')]));_0x1e764a['attributes']=_0x1e764a[_0x7682('0x2f')][_0x7682('0x31')]?_0x1e764a[_0x7682('0x2f')]:_0x107957[_0x7682('0x2c')];if(!_0x13b948[_0x7682('0x2d')][_0x7682('0x32')](_0x7682('0x33'))){_0x1e764a[_0x7682('0x1c')]=qs[_0x7682('0x1c')](_0x13b948[_0x7682('0x2d')][_0x7682('0x1c')]);_0x1e764a[_0x7682('0x1a')]=qs[_0x7682('0x1a')](_0x13b948[_0x7682('0x2d')][_0x7682('0x1a')]);}_0x1e764a[_0x7682('0x34')]=qs[_0x7682('0x35')](_0x13b948['query'][_0x7682('0x35')]);_0x1e764a['where']=qs['filters'](_[_0x7682('0x36')](_0x13b948['query'],_0x107957[_0x7682('0x37')]),_0xda96e4);if(_0x13b948[_0x7682('0x2d')][_0x7682('0x38')]){_0x1e764a[_0x7682('0x39')]=_[_0x7682('0x3a')](_0x1e764a[_0x7682('0x39')],{'$or':_[_0x7682('0x28')](_0xda96e4,function(_0x460b90){if(_0x460b90[_0x7682('0x3b')]!==_0x7682('0x3c')){var _0x4b3864={};_0x4b3864[_0x460b90['name']]={'$like':'%'+_0x13b948['query'][_0x7682('0x38')]+'%'};return _0x4b3864;}})});}_0x1e764a=_[_0x7682('0x3a')]({},_0x1e764a,_0x13b948[_0x7682('0x3d')]);var _0x380176={'where':_0x1e764a[_0x7682('0x39')]};return db[_0x7682('0x29')][_0x7682('0x1d')](_0x380176)['then'](function(_0x3b17b3){_0x563792['count']=_0x3b17b3;if(_0x13b948[_0x7682('0x2d')][_0x7682('0x3e')]){_0x1e764a[_0x7682('0x3f')]=[{'all':!![]}];}return db[_0x7682('0x29')][_0x7682('0x40')](_0x1e764a);})['then'](function(_0x5296dc){_0x563792[_0x7682('0x41')]=_0x5296dc;return _0x563792;})[_0x7682('0x42')](respondWithFilteredResult(_0x5b24cc,_0x1e764a))[_0x7682('0x43')](handleError(_0x5b24cc,null));};exports[_0x7682('0x44')]=function(_0x558300,_0x3999f3){var _0x590712={'raw':!![],'where':{'id':_0x558300[_0x7682('0x45')]['id']}},_0x1b1ac1={};_0x1b1ac1['model']=_[_0x7682('0x46')](db['SugarcrmField'][_0x7682('0x2a')]);_0x1b1ac1[_0x7682('0x2d')]=_[_0x7682('0x46')](_0x558300[_0x7682('0x2d')]);_0x1b1ac1[_0x7682('0x37')]=_[_0x7682('0x2e')](_0x1b1ac1[_0x7682('0x2c')],_0x1b1ac1[_0x7682('0x2d')]);_0x590712['attributes']=_[_0x7682('0x2e')](_0x1b1ac1[_0x7682('0x2c')],qs[_0x7682('0x30')](_0x558300[_0x7682('0x2d')]['fields']));_0x590712[_0x7682('0x2f')]=_0x590712[_0x7682('0x2f')]['length']?_0x590712[_0x7682('0x2f')]:_0x1b1ac1['model'];if(_0x558300[_0x7682('0x2d')][_0x7682('0x3e')]){_0x590712['include']=[{'all':!![]}];}_0x590712=_['merge']({},_0x590712,_0x558300['options']);return db[_0x7682('0x29')][_0x7682('0x47')](_0x590712)[_0x7682('0x42')](handleEntityNotFound(_0x3999f3,null))[_0x7682('0x42')](respondWithResult(_0x3999f3,null))[_0x7682('0x43')](handleError(_0x3999f3,null));};exports['create']=function(_0x1d0d54,_0x2dc9d3){return db[_0x7682('0x29')][_0x7682('0x48')](_0x1d0d54[_0x7682('0x49')],{})[_0x7682('0x42')](respondWithResult(_0x2dc9d3,0xc9))[_0x7682('0x43')](handleError(_0x2dc9d3,null));};exports[_0x7682('0x23')]=function(_0x6e7045,_0x2814b6){if(_0x6e7045[_0x7682('0x49')]['id']){delete _0x6e7045[_0x7682('0x49')]['id'];}return db[_0x7682('0x29')][_0x7682('0x47')]({'where':{'id':_0x6e7045[_0x7682('0x45')]['id']}})['then'](handleEntityNotFound(_0x2814b6,null))['then'](saveUpdates(_0x6e7045[_0x7682('0x49')],null))[_0x7682('0x42')](respondWithResult(_0x2814b6,null))[_0x7682('0x43')](handleError(_0x2814b6,null));};exports[_0x7682('0x24')]=function(_0x2b4c3f,_0x41adab){return db[_0x7682('0x29')][_0x7682('0x47')]({'where':{'id':_0x2b4c3f['params']['id']}})[_0x7682('0x42')](handleEntityNotFound(_0x41adab,null))[_0x7682('0x42')](removeEntity(_0x41adab,null))[_0x7682('0x43')](handleError(_0x41adab,null));}; \ No newline at end of file diff --git a/server/api/intSugarcrmField/intSugarcrmField.model.js b/server/api/intSugarcrmField/intSugarcrmField.model.js index 8b97c36..eb8e395 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 _0x097c=['bluebird','request-promise','path','rimraf','../../config/environment','./intSugarcrmField.attributes','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','lodash','util','../../config/logger','api','moment'];(function(_0x38ae4f,_0x1d3180){var _0x1e92db=function(_0x1a1cb9){while(--_0x1a1cb9){_0x38ae4f['push'](_0x38ae4f['shift']());}};_0x1e92db(++_0x1d3180);}(_0x097c,0x136));var _0xc097=function(_0x35d19e,_0x5c2fcd){_0x35d19e=_0x35d19e-0x0;var _0x27a927=_0x097c[_0x35d19e];return _0x27a927;};'use strict';var _=require(_0xc097('0x0'));var util=require(_0xc097('0x1'));var logger=require(_0xc097('0x2'))(_0xc097('0x3'));var moment=require(_0xc097('0x4'));var BPromise=require(_0xc097('0x5'));var rp=require(_0xc097('0x6'));var fs=require('fs');var path=require(_0xc097('0x7'));var rimraf=require(_0xc097('0x8'));var config=require(_0xc097('0x9'));var attributes=require(_0xc097('0xa'));module['exports']=function(_0x4fcfc4,_0x41400a){return _0x4fcfc4[_0xc097('0xb')](_0xc097('0xc'),attributes,{'tableName':_0xc097('0xd'),'paranoid':![],'indexes':[{'name':_0xc097('0xe'),'fields':['idField','FieldId'],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x9e34=['lodash','util','api','moment','bluebird','path','rimraf','../../config/environment','./intSugarcrmField.attributes','exports','define','SugarcrmField','int_sugarcrm_fields','sugarcrm_unique_index','idField','FieldId'];(function(_0x292027,_0x5ee694){var _0xf839fd=function(_0x1a230f){while(--_0x1a230f){_0x292027['push'](_0x292027['shift']());}};_0xf839fd(++_0x5ee694);}(_0x9e34,0x1a0));var _0x49e3=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x9e34[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x49e3('0x0'));var util=require(_0x49e3('0x1'));var logger=require('../../config/logger')(_0x49e3('0x2'));var moment=require(_0x49e3('0x3'));var BPromise=require(_0x49e3('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x49e3('0x5'));var rimraf=require(_0x49e3('0x6'));var config=require(_0x49e3('0x7'));var attributes=require(_0x49e3('0x8'));module[_0x49e3('0x9')]=function(_0x54bd34,_0x2d9e24){return _0x54bd34[_0x49e3('0xa')](_0x49e3('0xb'),attributes,{'tableName':_0x49e3('0xc'),'paranoid':![],'indexes':[{'name':_0x49e3('0xd'),'fields':[_0x49e3('0xe'),_0x49e3('0xf')],'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 d3d7c9f..dbd2fd6 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 _0x3549=['util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','http','then','info','SugarcrmField,\x20%s,\x20%s','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','code','error','message','result','catch'];(function(_0x4f6d08,_0x1b3dd0){var _0x53a9c6=function(_0x2e0e0f){while(--_0x2e0e0f){_0x4f6d08['push'](_0x4f6d08['shift']());}};_0x53a9c6(++_0x1b3dd0);}(_0x3549,0x154));var _0x9354=function(_0x15ac45,_0x475ca0){_0x15ac45=_0x15ac45-0x0;var _0x11dbf4=_0x3549[_0x15ac45];return _0x11dbf4;};'use strict';var _=require('lodash');var util=require(_0x9354('0x0'));var moment=require('moment');var BPromise=require(_0x9354('0x1'));var rs=require(_0x9354('0x2'));var fs=require('fs');var Redis=require(_0x9354('0x3'));var db=require(_0x9354('0x4'))['db'];var utils=require(_0x9354('0x5'));var logger=require(_0x9354('0x6'))('rpc');var config=require('../../config/environment');var jayson=require(_0x9354('0x7'));var client=jayson['client'][_0x9354('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xf5e351,_0x5f0c1d,_0xf9ec1f){return new BPromise(function(_0x2b882d,_0x2182ab){return client['request'](_0xf5e351,_0xf9ec1f)[_0x9354('0x9')](function(_0x236b21){logger[_0x9354('0xa')](_0x9354('0xb'),_0x5f0c1d,'request\x20sent');logger['debug'](_0x9354('0xc'),_0x5f0c1d,_0x9354('0xd'),JSON[_0x9354('0xe')](_0x236b21));if(_0x236b21['error']){if(_0x236b21['error'][_0x9354('0xf')]===0x1f4){logger[_0x9354('0x10')](_0x9354('0xb'),_0x5f0c1d,_0x236b21[_0x9354('0x10')][_0x9354('0x11')]);return _0x2182ab(_0x236b21[_0x9354('0x10')][_0x9354('0x11')]);}logger['error']('SugarcrmField,\x20%s,\x20%s',_0x5f0c1d,_0x236b21['error'][_0x9354('0x11')]);return _0x2b882d(_0x236b21[_0x9354('0x10')][_0x9354('0x11')]);}else{logger[_0x9354('0xa')](_0x9354('0xb'),_0x5f0c1d,_0x9354('0xd'));_0x2b882d(_0x236b21[_0x9354('0x12')][_0x9354('0x11')]);}})[_0x9354('0x13')](function(_0x1d5ecd){logger[_0x9354('0x10')](_0x9354('0xb'),_0x5f0c1d,_0x1d5ecd);_0x2182ab(_0x1d5ecd);});});} \ No newline at end of file +var _0x62d1=['randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SugarcrmField,\x20%s,\x20%s','debug','SugarcrmField,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird'];(function(_0x5a1308,_0x34c232){var _0x4efb3f=function(_0x2a3a40){while(--_0x2a3a40){_0x5a1308['push'](_0x5a1308['shift']());}};_0x4efb3f(++_0x34c232);}(_0x62d1,0x195));var _0x162d=function(_0x46ce21,_0x254327){_0x46ce21=_0x46ce21-0x0;var _0x4901ba=_0x62d1[_0x46ce21];return _0x4901ba;};'use strict';var _=require(_0x162d('0x0'));var util=require('util');var moment=require(_0x162d('0x1'));var BPromise=require(_0x162d('0x2'));var rs=require(_0x162d('0x3'));var fs=require('fs');var Redis=require(_0x162d('0x4'));var db=require(_0x162d('0x5'))['db'];var utils=require(_0x162d('0x6'));var logger=require(_0x162d('0x7'))(_0x162d('0x8'));var config=require(_0x162d('0x9'));var jayson=require(_0x162d('0xa'));var client=jayson[_0x162d('0xb')][_0x162d('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xb2af59,_0x2a31fe,_0xa53e11){return new BPromise(function(_0x503297,_0x36ae86){return client[_0x162d('0xd')](_0xb2af59,_0xa53e11)['then'](function(_0x5a3a14){logger[_0x162d('0xe')](_0x162d('0xf'),_0x2a31fe,'request\x20sent');logger[_0x162d('0x10')](_0x162d('0x11'),_0x2a31fe,_0x162d('0x12'),JSON[_0x162d('0x13')](_0x5a3a14));if(_0x5a3a14['error']){if(_0x5a3a14[_0x162d('0x14')][_0x162d('0x15')]===0x1f4){logger[_0x162d('0x14')](_0x162d('0xf'),_0x2a31fe,_0x5a3a14['error'][_0x162d('0x16')]);return _0x36ae86(_0x5a3a14['error'][_0x162d('0x16')]);}logger[_0x162d('0x14')]('SugarcrmField,\x20%s,\x20%s',_0x2a31fe,_0x5a3a14[_0x162d('0x14')][_0x162d('0x16')]);return _0x503297(_0x5a3a14[_0x162d('0x14')][_0x162d('0x16')]);}else{logger['info']('SugarcrmField,\x20%s,\x20%s',_0x2a31fe,_0x162d('0x12'));_0x503297(_0x5a3a14[_0x162d('0x17')]['message']);}})['catch'](function(_0x3df2b1){logger['error'](_0x162d('0xf'),_0x2a31fe,_0x3df2b1);_0x36ae86(_0x3df2b1);});});} \ No newline at end of file diff --git a/server/api/intVtigerAccount/index.js b/server/api/intVtigerAccount/index.js index ce9ec66..bb31d91 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 _0xdeb3=['addConfiguration','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/:id','/:id/configurations','getConfigurations','/:id/fields','getFields','post'];(function(_0xcc3fae,_0x122871){var _0x45c2cd=function(_0x27ee40){while(--_0x27ee40){_0xcc3fae['push'](_0xcc3fae['shift']());}};_0x45c2cd(++_0x122871);}(_0xdeb3,0xeb));var _0x3deb=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0xdeb3[_0x2641f9];return _0x585741;};'use strict';var multer=require(_0x3deb('0x0'));var util=require(_0x3deb('0x1'));var path=require(_0x3deb('0x2'));var timeout=require(_0x3deb('0x3'));var express=require(_0x3deb('0x4'));var router=express[_0x3deb('0x5')]();var fs_extra=require(_0x3deb('0x6'));var auth=require(_0x3deb('0x7'));var interaction=require(_0x3deb('0x8'));var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0x3deb('0x9')](),controller[_0x3deb('0xa')]);router[_0x3deb('0xb')](_0x3deb('0xc'),auth[_0x3deb('0x9')](),controller['show']);router['get'](_0x3deb('0xd'),auth[_0x3deb('0x9')](),controller[_0x3deb('0xe')]);router[_0x3deb('0xb')](_0x3deb('0xf'),auth[_0x3deb('0x9')](),controller[_0x3deb('0x10')]);router[_0x3deb('0x11')]('/',auth['isAuthenticated'](),controller['create']);router['post'](_0x3deb('0xd'),auth['isAuthenticated'](),controller[_0x3deb('0x12')]);router[_0x3deb('0x13')](_0x3deb('0xc'),auth[_0x3deb('0x9')](),controller['update']);router[_0x3deb('0x14')](_0x3deb('0xc'),auth[_0x3deb('0x9')](),controller[_0x3deb('0x15')]);module[_0x3deb('0x16')]=router; \ No newline at end of file +var _0xe64a=['express','Router','fs-extra','../../components/auth/service','isAuthenticated','index','get','/:id','show','/:id/configurations','getConfigurations','create','post','addConfiguration','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2a9366,_0x11e6fe){var _0x236e63=function(_0x505cda){while(--_0x505cda){_0x2a9366['push'](_0x2a9366['shift']());}};_0x236e63(++_0x11e6fe);}(_0xe64a,0x1e0));var _0xae64=function(_0x40a045,_0x516f0e){_0x40a045=_0x40a045-0x0;var _0x1a687c=_0xe64a[_0x40a045];return _0x1a687c;};'use strict';var multer=require(_0xae64('0x0'));var util=require(_0xae64('0x1'));var path=require(_0xae64('0x2'));var timeout=require(_0xae64('0x3'));var express=require(_0xae64('0x4'));var router=express[_0xae64('0x5')]();var fs_extra=require(_0xae64('0x6'));var auth=require(_0xae64('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./intVtigerAccount.controller');router['get']('/',auth[_0xae64('0x8')](),controller[_0xae64('0x9')]);router[_0xae64('0xa')](_0xae64('0xb'),auth[_0xae64('0x8')](),controller[_0xae64('0xc')]);router[_0xae64('0xa')](_0xae64('0xd'),auth[_0xae64('0x8')](),controller[_0xae64('0xe')]);router[_0xae64('0xa')]('/:id/fields',auth[_0xae64('0x8')](),controller['getFields']);router['post']('/',auth[_0xae64('0x8')](),controller[_0xae64('0xf')]);router[_0xae64('0x10')](_0xae64('0xd'),auth['isAuthenticated'](),controller[_0xae64('0x11')]);router['put']('/:id',auth[_0xae64('0x8')](),controller[_0xae64('0x12')]);router[_0xae64('0x13')]('/:id',auth[_0xae64('0x8')](),controller[_0xae64('0x14')]);module[_0xae64('0x15')]=router; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.attributes.js b/server/api/intVtigerAccount/intVtigerAccount.attributes.js index 5d49162..6003d64 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 _0x4179=['exports','STRING','HelpDesk'];(function(_0x15af0f,_0x5454ce){var _0x2bd1cb=function(_0x593818){while(--_0x593818){_0x15af0f['push'](_0x15af0f['shift']());}};_0x2bd1cb(++_0x5454ce);}(_0x4179,0x75));var _0x9417=function(_0x1e4150,_0x55b02a){_0x1e4150=_0x1e4150-0x0;var _0x1ce3ee=_0x4179[_0x1e4150];return _0x1ce3ee;};'use strict';var Sequelize=require('sequelize');module[_0x9417('0x0')]={'name':{'type':Sequelize[_0x9417('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0x9417('0x1')]},'username':{'type':Sequelize[_0x9417('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x9417('0x2')},'remoteUri':{'type':Sequelize[_0x9417('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0x9417('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0x9417('0x1')],'allowNull':![]}}; \ No newline at end of file +var _0xb03a=['sequelize','STRING','HelpDesk'];(function(_0x53bf3e,_0x31d2c1){var _0x381da=function(_0x25a776){while(--_0x25a776){_0x53bf3e['push'](_0x53bf3e['shift']());}};_0x381da(++_0x31d2c1);}(_0xb03a,0x1b3));var _0xab03=function(_0x1fd393,_0x583188){_0x1fd393=_0x1fd393-0x0;var _0x46a309=_0xb03a[_0x1fd393];return _0x46a309;};'use strict';var Sequelize=require(_0xab03('0x0'));module['exports']={'name':{'type':Sequelize[_0xab03('0x1')],'allowNull':![]},'description':{'type':Sequelize[_0xab03('0x1')]},'username':{'type':Sequelize[_0xab03('0x1')],'allowNull':![]},'moduleName':{'type':Sequelize[_0xab03('0x1')],'allowNull':![],'defaultValue':_0xab03('0x2')},'remoteUri':{'type':Sequelize[_0xab03('0x1')],'allowNull':![]},'serverUrl':{'type':Sequelize[_0xab03('0x1')],'allowNull':![]},'accessKey':{'type':Sequelize[_0xab03('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 e06e849..2a1b8d8 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 _0x4f43=['fs-extra','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','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','apply','reject','save','then','destroy','error','stack','name','send','index','map','VtigerAccount','rawAttributes','type','key','model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','includeAll','include','rows','catch','params','keys','options','find','create','body','update','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','VtigerField','md5','getFields','description','moduleName','remoteUri','serverUrl','accessKey','username','slice','substring','%s/webservice.php','GET','POST','login','result','token','success','describe','autogenerated','reference','owner','includes','remove','editable','false','label','startsWith','cf_','picklist','picklistValues','value','log','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs'];(function(_0x318a06,_0x32c5ac){var _0x552d7b=function(_0x2c9e6d){while(--_0x2c9e6d){_0x318a06['push'](_0x318a06['shift']());}};_0x552d7b(++_0x32c5ac);}(_0x4f43,0x169));var _0x34f4=function(_0x30933a,_0x204cfe){_0x30933a=_0x30933a-0x0;var _0x57fab1=_0x4f43[_0x30933a];return _0x57fab1;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x34f4('0x0'));var zipdir=require(_0x34f4('0x1'));var jsonpatch=require(_0x34f4('0x2'));var rp=require(_0x34f4('0x3'));var moment=require(_0x34f4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x34f4('0x5'));var util=require(_0x34f4('0x6'));var path=require(_0x34f4('0x7'));var sox=require(_0x34f4('0x8'));var csv=require(_0x34f4('0x9'));var ejs=require(_0x34f4('0xa'));var fs=require('fs');var fs_extra=require(_0x34f4('0xb'));var _=require(_0x34f4('0xc'));var squel=require(_0x34f4('0xd'));var crypto=require('crypto');var jsforce=require(_0x34f4('0xe'));var deskjs=require(_0x34f4('0xf'));var toCsv=require(_0x34f4('0x9'));var querystring=require(_0x34f4('0x10'));var Papa=require(_0x34f4('0x11'));var Redis=require(_0x34f4('0x12'));var authService=require(_0x34f4('0x13'));var qs=require(_0x34f4('0x14'));var as=require(_0x34f4('0x15'));var hardwareService=require(_0x34f4('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0x34f4('0x17'));var config=require(_0x34f4('0x18'));var licenseUtil=require(_0x34f4('0x19'));var db=require(_0x34f4('0x1a'))['db'];var integrations=require(_0x34f4('0x1b'));function respondWithStatusCode(_0x2ef703,_0x1413dd){_0x1413dd=_0x1413dd||0xcc;return function(_0x33bb78){if(_0x33bb78){return _0x2ef703[_0x34f4('0x1c')](_0x1413dd);}return _0x2ef703[_0x34f4('0x1d')](_0x1413dd)[_0x34f4('0x1e')]();};}function respondWithResult(_0x2d22bb,_0x43bac1){_0x43bac1=_0x43bac1||0xc8;return function(_0x2eb836){if(_0x2eb836){return _0x2d22bb[_0x34f4('0x1d')](_0x43bac1)[_0x34f4('0x1f')](_0x2eb836);}};}function respondWithFilteredResult(_0x3695a2,_0x191a38){return function(_0x2e6e9d){if(_0x2e6e9d){var _0x26584a=typeof _0x191a38['offset']===_0x34f4('0x20')&&typeof _0x191a38[_0x34f4('0x21')]===_0x34f4('0x20');var _0x37f783=_0x2e6e9d[_0x34f4('0x22')];var _0x5d4fcb=_0x26584a?0x0:_0x191a38[_0x34f4('0x23')];var _0x305473=_0x26584a?_0x2e6e9d[_0x34f4('0x22')]:_0x191a38[_0x34f4('0x23')]+_0x191a38['limit'];var _0x1b0bf5;if(_0x305473>=_0x37f783){_0x305473=_0x37f783;_0x1b0bf5=0xc8;}else{_0x1b0bf5=0xce;}_0x3695a2[_0x34f4('0x1d')](_0x1b0bf5);return _0x3695a2[_0x34f4('0x24')]('Content-Range',_0x5d4fcb+'-'+_0x305473+'/'+_0x37f783)[_0x34f4('0x1f')](_0x2e6e9d);}return null;};}function patchUpdates(_0x420804){return function(_0x23d6f2){try{jsonpatch[_0x34f4('0x25')](_0x23d6f2,_0x420804,!![]);}catch(_0x55e2fa){return BPromise[_0x34f4('0x26')](_0x55e2fa);}return _0x23d6f2[_0x34f4('0x27')]();};}function saveUpdates(_0x15f4b7,_0xb95e92){return function(_0x1548c7){if(_0x1548c7){return _0x1548c7['update'](_0x15f4b7)[_0x34f4('0x28')](function(_0x26fc9b){return _0x26fc9b;});}return null;};}function removeEntity(_0x495fa7,_0x537547){return function(_0x1684c6){if(_0x1684c6){return _0x1684c6[_0x34f4('0x29')]()[_0x34f4('0x28')](function(){_0x495fa7['status'](0xcc)[_0x34f4('0x1e')]();});}};}function handleEntityNotFound(_0x1486de,_0x3b50d9){return function(_0x14cc7f){if(!_0x14cc7f){_0x1486de['sendStatus'](0x194);}return _0x14cc7f;};}function handleError(_0x2bdb2b,_0x25de2f){_0x25de2f=_0x25de2f||0x1f4;return function(_0x444431){logger[_0x34f4('0x2a')](_0x444431[_0x34f4('0x2b')]);if(_0x444431['name']){delete _0x444431[_0x34f4('0x2c')];}_0x2bdb2b[_0x34f4('0x1d')](_0x25de2f)[_0x34f4('0x2d')](_0x444431);};}exports[_0x34f4('0x2e')]=function(_0x567959,_0xd66127){var _0x498bf0={},_0x237bc1={},_0x3e2796={'count':0x0,'rows':[]};var _0x4d3270=_[_0x34f4('0x2f')](db[_0x34f4('0x30')][_0x34f4('0x31')],function(_0x14ca1c){return{'name':_0x14ca1c['fieldName'],'type':_0x14ca1c[_0x34f4('0x32')][_0x34f4('0x33')]};});_0x237bc1[_0x34f4('0x34')]=_[_0x34f4('0x2f')](_0x4d3270,_0x34f4('0x2c'));_0x237bc1[_0x34f4('0x35')]=_['keys'](_0x567959['query']);_0x237bc1['filters']=_[_0x34f4('0x36')](_0x237bc1['model'],_0x237bc1[_0x34f4('0x35')]);_0x498bf0[_0x34f4('0x37')]=_[_0x34f4('0x36')](_0x237bc1['model'],qs[_0x34f4('0x38')](_0x567959['query'][_0x34f4('0x38')]));_0x498bf0['attributes']=_0x498bf0[_0x34f4('0x37')][_0x34f4('0x39')]?_0x498bf0['attributes']:_0x237bc1[_0x34f4('0x34')];if(!_0x567959[_0x34f4('0x35')][_0x34f4('0x3a')](_0x34f4('0x3b'))){_0x498bf0['limit']=qs['limit'](_0x567959[_0x34f4('0x35')][_0x34f4('0x21')]);_0x498bf0['offset']=qs[_0x34f4('0x23')](_0x567959['query'][_0x34f4('0x23')]);}_0x498bf0[_0x34f4('0x3c')]=qs[_0x34f4('0x3d')](_0x567959[_0x34f4('0x35')][_0x34f4('0x3d')]);_0x498bf0[_0x34f4('0x3e')]=qs[_0x34f4('0x3f')](_[_0x34f4('0x40')](_0x567959['query'],_0x237bc1['filters']),_0x4d3270);if(_0x567959[_0x34f4('0x35')][_0x34f4('0x41')]){_0x498bf0['where']=_['merge'](_0x498bf0[_0x34f4('0x3e')],{'$or':_[_0x34f4('0x2f')](_0x4d3270,function(_0x42873a){if(_0x42873a[_0x34f4('0x32')]!=='VIRTUAL'){var _0x1ce798={};_0x1ce798[_0x42873a['name']]={'$like':'%'+_0x567959[_0x34f4('0x35')]['filter']+'%'};return _0x1ce798;}})});}_0x498bf0=_[_0x34f4('0x42')]({},_0x498bf0,_0x567959['options']);var _0x246a3f={'where':_0x498bf0[_0x34f4('0x3e')]};return db[_0x34f4('0x30')][_0x34f4('0x22')](_0x246a3f)[_0x34f4('0x28')](function(_0x4ef1e8){_0x3e2796[_0x34f4('0x22')]=_0x4ef1e8;if(_0x567959[_0x34f4('0x35')][_0x34f4('0x43')]){_0x498bf0[_0x34f4('0x44')]=[{'all':!![]}];}return db[_0x34f4('0x30')]['findAll'](_0x498bf0);})[_0x34f4('0x28')](function(_0x2b1b02){_0x3e2796[_0x34f4('0x45')]=_0x2b1b02;return _0x3e2796;})[_0x34f4('0x28')](respondWithFilteredResult(_0xd66127,_0x498bf0))[_0x34f4('0x46')](handleError(_0xd66127,null));};exports['show']=function(_0x4feade,_0x584748){var _0x32cf33={'raw':![],'where':{'id':_0x4feade[_0x34f4('0x47')]['id']}},_0x163cb3={};_0x163cb3['model']=_['keys'](db[_0x34f4('0x30')][_0x34f4('0x31')]);_0x163cb3[_0x34f4('0x35')]=_[_0x34f4('0x48')](_0x4feade['query']);_0x163cb3['filters']=_[_0x34f4('0x36')](_0x163cb3[_0x34f4('0x34')],_0x163cb3[_0x34f4('0x35')]);_0x32cf33['attributes']=_[_0x34f4('0x36')](_0x163cb3['model'],qs[_0x34f4('0x38')](_0x4feade[_0x34f4('0x35')][_0x34f4('0x38')]));_0x32cf33[_0x34f4('0x37')]=_0x32cf33[_0x34f4('0x37')]['length']?_0x32cf33[_0x34f4('0x37')]:_0x163cb3[_0x34f4('0x34')];if(_0x4feade[_0x34f4('0x35')][_0x34f4('0x43')]){_0x32cf33[_0x34f4('0x44')]=[{'all':!![]}];}_0x32cf33=_[_0x34f4('0x42')]({},_0x32cf33,_0x4feade[_0x34f4('0x49')]);return db['VtigerAccount'][_0x34f4('0x4a')](_0x32cf33)[_0x34f4('0x28')](handleEntityNotFound(_0x584748,null))[_0x34f4('0x28')](respondWithResult(_0x584748,null))[_0x34f4('0x46')](handleError(_0x584748,null));};exports[_0x34f4('0x4b')]=function(_0x55c561,_0x3bbdc9){return db[_0x34f4('0x30')][_0x34f4('0x4b')](_0x55c561[_0x34f4('0x4c')],{})[_0x34f4('0x28')](respondWithResult(_0x3bbdc9,0xc9))['catch'](handleError(_0x3bbdc9,null));};exports[_0x34f4('0x4d')]=function(_0x578a0e,_0x5e1df7){if(_0x578a0e['body']['id']){delete _0x578a0e[_0x34f4('0x4c')]['id'];}return db['VtigerAccount'][_0x34f4('0x4a')]({'where':{'id':_0x578a0e[_0x34f4('0x47')]['id']}})[_0x34f4('0x28')](handleEntityNotFound(_0x5e1df7,null))['then'](saveUpdates(_0x578a0e[_0x34f4('0x4c')],null))[_0x34f4('0x28')](respondWithResult(_0x5e1df7,null))[_0x34f4('0x46')](handleError(_0x5e1df7,null));};exports['destroy']=function(_0x2bbdd9,_0x194f00){return db['VtigerAccount'][_0x34f4('0x4a')]({'where':{'id':_0x2bbdd9[_0x34f4('0x47')]['id']}})['then'](handleEntityNotFound(_0x194f00,null))[_0x34f4('0x28')](removeEntity(_0x194f00,null))[_0x34f4('0x46')](handleError(_0x194f00,null));};exports[_0x34f4('0x4e')]=function(_0x36f4e2,_0x3dd394,_0x27975f){var _0x594dcc={};var _0x4b4af0={};var _0x2f7054;var _0x405bd6;return db['VtigerAccount'][_0x34f4('0x4f')]({'where':{'id':_0x36f4e2[_0x34f4('0x47')]['id']}})[_0x34f4('0x28')](handleEntityNotFound(_0x3dd394,null))[_0x34f4('0x28')](function(_0x4e6974){if(_0x4e6974){_0x2f7054=_0x4e6974;_0x4b4af0[_0x34f4('0x34')]=_[_0x34f4('0x48')](db[_0x34f4('0x50')][_0x34f4('0x31')]);_0x4b4af0[_0x34f4('0x35')]=_['keys'](_0x36f4e2['query']);_0x4b4af0[_0x34f4('0x3f')]=_[_0x34f4('0x36')](_0x4b4af0['model'],_0x4b4af0[_0x34f4('0x35')]);_0x594dcc[_0x34f4('0x37')]=_[_0x34f4('0x36')](_0x4b4af0[_0x34f4('0x34')],qs['fields'](_0x36f4e2[_0x34f4('0x35')][_0x34f4('0x38')]));_0x594dcc[_0x34f4('0x37')]=_0x594dcc[_0x34f4('0x37')][_0x34f4('0x39')]?_0x594dcc[_0x34f4('0x37')]:_0x4b4af0[_0x34f4('0x34')];_0x594dcc[_0x34f4('0x3c')]=qs[_0x34f4('0x3d')](_0x36f4e2[_0x34f4('0x35')][_0x34f4('0x3d')]);_0x594dcc[_0x34f4('0x3e')]=qs[_0x34f4('0x3f')](_[_0x34f4('0x40')](_0x36f4e2['query'],_0x4b4af0[_0x34f4('0x3f')]));if(_0x36f4e2[_0x34f4('0x35')][_0x34f4('0x41')]){_0x594dcc[_0x34f4('0x3e')]=_[_0x34f4('0x42')](_0x594dcc['where'],{'$or':_[_0x34f4('0x2f')](_0x594dcc[_0x34f4('0x37')],function(_0x2a6eba){var _0x4ef8df={};_0x4ef8df[_0x2a6eba]={'$like':'%'+_0x36f4e2[_0x34f4('0x35')]['filter']+'%'};return _0x4ef8df;})});}_0x594dcc=_[_0x34f4('0x42')]({},_0x594dcc,_0x36f4e2[_0x34f4('0x49')]);return _0x2f7054['getConfigurations'](_0x594dcc);}})[_0x34f4('0x28')](function(_0x4d3d86){if(_0x4d3d86){_0x405bd6=_0x4d3d86[_0x34f4('0x39')];if(!_0x36f4e2[_0x34f4('0x35')][_0x34f4('0x3a')](_0x34f4('0x3b'))){_0x594dcc['limit']=qs[_0x34f4('0x21')](_0x36f4e2[_0x34f4('0x35')][_0x34f4('0x21')]);_0x594dcc[_0x34f4('0x23')]=qs[_0x34f4('0x23')](_0x36f4e2[_0x34f4('0x35')][_0x34f4('0x23')]);}return _0x2f7054[_0x34f4('0x4e')](_0x594dcc);}})[_0x34f4('0x28')](function(_0x4ed274){if(_0x4ed274){return _0x4ed274?{'count':_0x405bd6,'rows':_0x4ed274}:null;}})[_0x34f4('0x28')](respondWithResult(_0x3dd394,null))[_0x34f4('0x46')](handleError(_0x3dd394,null));};exports['addConfiguration']=function(_0x40e7a1,_0xc5ba26,_0x42f12b){if(_0x40e7a1['body']['id']){delete _0x40e7a1[_0x34f4('0x4c')]['id'];}return db['VtigerAccount']['findOne']({'where':{'id':_0x40e7a1[_0x34f4('0x47')]['id']}})[_0x34f4('0x28')](handleEntityNotFound(_0xc5ba26,null))[_0x34f4('0x28')](function(_0x30f028){if(_0x30f028){_0x40e7a1[_0x34f4('0x4c')][_0x34f4('0x51')]=_0x30f028['id'];_0x40e7a1['body'][_0x34f4('0x52')]=integrations[_0x34f4('0x53')](_0x40e7a1[_0x34f4('0x4c')][_0x34f4('0x54')],_0x40e7a1[_0x34f4('0x4c')][_0x34f4('0x32')]);_0x40e7a1[_0x34f4('0x4c')][_0x34f4('0x55')]=integrations[_0x34f4('0x56')](_0x40e7a1[_0x34f4('0x4c')][_0x34f4('0x54')],_0x40e7a1[_0x34f4('0x4c')][_0x34f4('0x32')]);return db['VtigerConfiguration'][_0x34f4('0x4b')](_0x40e7a1['body'],{'include':[{'model':db[_0x34f4('0x57')],'as':_0x34f4('0x52')},{'model':db[_0x34f4('0x57')],'as':_0x34f4('0x55')}]});}return null;})['then'](respondWithResult(_0xc5ba26,null))[_0x34f4('0x46')](handleError(_0xc5ba26,null));};var md5=require(_0x34f4('0x58'));exports[_0x34f4('0x59')]=function(_0x17e983,_0x289129,_0x251d76){var _0x5a8f09=null;var _0x3c5a5a=null;var _0x359f5c=null;var _0x486063=null;var _0x308802='';return db['VtigerAccount']['findOne']({'where':{'id':_0x17e983['params']['id']},'attributes':['id',_0x34f4('0x2c'),'username',_0x34f4('0x5a'),_0x34f4('0x5b'),_0x34f4('0x5c'),_0x34f4('0x5d'),_0x34f4('0x5e')]})[_0x34f4('0x28')](handleEntityNotFound(_0x289129,null))[_0x34f4('0x28')](function(_0x34b471){if(_0x34b471){_0x5a8f09=_0x34b471[_0x34f4('0x5f')];_0x3c5a5a=_0x34b471['accessKey'];_0x359f5c=_0x34b471['moduleName'];_0x308802=_0x34b471[_0x34f4('0x5c')];var _0x322034=_0x308802[_0x34f4('0x60')](-0x1);if(_0x322034==='/'){_0x308802=_0x308802[_0x34f4('0x61')](0x0,_0x308802['lastIndexOf'](_0x322034));}_0x486063=util['format'](_0x34f4('0x62'),_0x308802);var _0x351561={'method':_0x34f4('0x63'),'uri':_0x486063,'qs':{'operation':'getchallenge','username':_0x34b471[_0x34f4('0x5f')]},'json':!![]};return rp(_0x351561);}})[_0x34f4('0x28')](function(_0x43c577){if(_0x43c577['success']){var _0x5323a8={'method':_0x34f4('0x64'),'uri':_0x486063,'form':{'operation':_0x34f4('0x65'),'username':_0x5a8f09,'accessKey':md5(_0x43c577[_0x34f4('0x66')][_0x34f4('0x67')]+_0x3c5a5a)},'json':!![]};return rp(_0x5323a8);}})[_0x34f4('0x28')](function(_0x5c1067){if(_0x5c1067[_0x34f4('0x68')]){var _0x57d5c7={'method':'GET','uri':_0x486063,'qs':{'operation':_0x34f4('0x69'),'username':_0x5a8f09,'sessionName':_0x5c1067[_0x34f4('0x66')]['sessionName'],'elementType':_0x359f5c},'json':!![]};return rp(_0x57d5c7);}})[_0x34f4('0x28')](function(_0x5730b6){if(_0x5730b6[_0x34f4('0x68')]){var _0xa38e7c=[_0x34f4('0x6a'),_0x34f4('0x6b'),_0x34f4('0x6c')];_['remove'](_0x5730b6[_0x34f4('0x66')]['fields'],function(_0xd71486){return _0xa38e7c[_0x34f4('0x6d')](_0xd71486[_0x34f4('0x32')][_0x34f4('0x2c')]);});_[_0x34f4('0x6e')](_0x5730b6[_0x34f4('0x66')]['fields'],function(_0x3877c8){return _0x3877c8[_0x34f4('0x6f')]===_0x34f4('0x70');});return{'count':_0x5730b6[_0x34f4('0x66')][_0x34f4('0x38')]['length'],'rows':_[_0x34f4('0x2f')](_0x5730b6[_0x34f4('0x66')][_0x34f4('0x38')],function(_0x456af5){return{'id':_0x456af5['name'],'name':_0x456af5[_0x34f4('0x71')],'custom':_[_0x34f4('0x72')](_0x456af5[_0x34f4('0x2c')],_0x34f4('0x73'))?!![]:![],'options':_0x456af5[_0x34f4('0x32')]['name']===_0x34f4('0x74')&&_0x456af5[_0x34f4('0x32')][_0x34f4('0x75')][_0x34f4('0x39')]>0x0?_[_0x34f4('0x2f')](_0x456af5[_0x34f4('0x32')][_0x34f4('0x75')],function(_0x1acaf8){return{'name':_0x1acaf8[_0x34f4('0x71')],'value':_0x1acaf8[_0x34f4('0x76')]};}):[]};})};}})[_0x34f4('0x28')](respondWithResult(_0x289129,null))[_0x34f4('0x46')](function(_0x44ae88){console[_0x34f4('0x77')]('vTiger\x20error:\x20'+_0x44ae88);var _0x3887b1=_0x17e983[_0x34f4('0x35')]['test']?0x1f4:_0x44ae88[_0x34f4('0x78')]||0x1f4;logger[_0x34f4('0x2a')](_0x34f4('0x79'),_0x34f4('0x59'),_0x3887b1,JSON[_0x34f4('0x7a')](_0x44ae88));delete _0x44ae88['name'];if(_0x3887b1===0x191){_0x3887b1=0x190;}_0x289129[_0x34f4('0x1d')](_0x3887b1)[_0x34f4('0x2d')](_0x17e983['query'][_0x34f4('0x7b')]?{'message':'Wrong\x20credentials','statusCode':_0x44ae88[_0x34f4('0x78')]}:_0x44ae88);});}; \ No newline at end of file +var _0x2278=['index','map','VtigerAccount','rawAttributes','fieldName','type','key','keys','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','params','find','create','body','destroy','getConfigurations','findOne','VtigerConfiguration','AccountId','Subjects','getSubjects','channel','Descriptions','getDescriptions','md5','getFields','username','remoteUri','serverUrl','moduleName','substring','format','GET','getchallenge','success','login','result','token','describe','sessionName','autogenerated','reference','includes','editable','false','startsWith','picklist','picklistValues','value','log','vTiger\x20error:\x20','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../components/integrations/configuration','sendStatus','end','status','json','offset','limit','undefined','count','set','apply','reject','update','then','error','name','send'];(function(_0x341d22,_0x3f6bba){var _0x2ed407=function(_0x562b75){while(--_0x562b75){_0x341d22['push'](_0x341d22['shift']());}};_0x2ed407(++_0x3f6bba);}(_0x2278,0x1a3));var _0x8227=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2278[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x8227('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8227('0x1'));var jsonpatch=require(_0x8227('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x8227('0x3'));var Mustache=require(_0x8227('0x4'));var util=require(_0x8227('0x5'));var path=require(_0x8227('0x6'));var sox=require(_0x8227('0x7'));var csv=require('to-csv');var ejs=require(_0x8227('0x8'));var fs=require('fs');var fs_extra=require(_0x8227('0x9'));var _=require(_0x8227('0xa'));var squel=require(_0x8227('0xb'));var crypto=require(_0x8227('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x8227('0xd'));var toCsv=require(_0x8227('0xe'));var querystring=require(_0x8227('0xf'));var Papa=require(_0x8227('0x10'));var Redis=require(_0x8227('0x11'));var authService=require(_0x8227('0x12'));var qs=require(_0x8227('0x13'));var as=require(_0x8227('0x14'));var hardwareService=require(_0x8227('0x15'));var logger=require(_0x8227('0x16'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8227('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0x8227('0x18'));function respondWithStatusCode(_0x14885c,_0xb8a1d0){_0xb8a1d0=_0xb8a1d0||0xcc;return function(_0x5f1a08){if(_0x5f1a08){return _0x14885c[_0x8227('0x19')](_0xb8a1d0);}return _0x14885c['status'](_0xb8a1d0)[_0x8227('0x1a')]();};}function respondWithResult(_0x54dbaf,_0x320b99){_0x320b99=_0x320b99||0xc8;return function(_0x261a60){if(_0x261a60){return _0x54dbaf[_0x8227('0x1b')](_0x320b99)[_0x8227('0x1c')](_0x261a60);}};}function respondWithFilteredResult(_0x110cd0,_0x176e5a){return function(_0x2bb7b9){if(_0x2bb7b9){var _0x5f45f5=typeof _0x176e5a[_0x8227('0x1d')]==='undefined'&&typeof _0x176e5a[_0x8227('0x1e')]===_0x8227('0x1f');var _0x5644ef=_0x2bb7b9[_0x8227('0x20')];var _0x53b5b0=_0x5f45f5?0x0:_0x176e5a[_0x8227('0x1d')];var _0x122516=_0x5f45f5?_0x2bb7b9['count']:_0x176e5a[_0x8227('0x1d')]+_0x176e5a[_0x8227('0x1e')];var _0x13ae69;if(_0x122516>=_0x5644ef){_0x122516=_0x5644ef;_0x13ae69=0xc8;}else{_0x13ae69=0xce;}_0x110cd0[_0x8227('0x1b')](_0x13ae69);return _0x110cd0[_0x8227('0x21')]('Content-Range',_0x53b5b0+'-'+_0x122516+'/'+_0x5644ef)['json'](_0x2bb7b9);}return null;};}function patchUpdates(_0x4d6059){return function(_0x60b5d2){try{jsonpatch[_0x8227('0x22')](_0x60b5d2,_0x4d6059,!![]);}catch(_0x228f6d){return BPromise[_0x8227('0x23')](_0x228f6d);}return _0x60b5d2['save']();};}function saveUpdates(_0x196b68,_0x358b96){return function(_0xa30086){if(_0xa30086){return _0xa30086[_0x8227('0x24')](_0x196b68)['then'](function(_0x5b6751){return _0x5b6751;});}return null;};}function removeEntity(_0x25df77,_0x933210){return function(_0x1732f3){if(_0x1732f3){return _0x1732f3['destroy']()[_0x8227('0x25')](function(){_0x25df77[_0x8227('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2c4125,_0x82607){return function(_0x4dd5f5){if(!_0x4dd5f5){_0x2c4125['sendStatus'](0x194);}return _0x4dd5f5;};}function handleError(_0x5c1100,_0x5926eb){_0x5926eb=_0x5926eb||0x1f4;return function(_0x71a30a){logger[_0x8227('0x26')](_0x71a30a['stack']);if(_0x71a30a['name']){delete _0x71a30a[_0x8227('0x27')];}_0x5c1100[_0x8227('0x1b')](_0x5926eb)[_0x8227('0x28')](_0x71a30a);};}exports[_0x8227('0x29')]=function(_0x1a5e33,_0x4f6c6d){var _0x1cfcf6={},_0x21d827={},_0x47280e={'count':0x0,'rows':[]};var _0x20401e=_[_0x8227('0x2a')](db[_0x8227('0x2b')][_0x8227('0x2c')],function(_0x1d88f4){return{'name':_0x1d88f4[_0x8227('0x2d')],'type':_0x1d88f4[_0x8227('0x2e')][_0x8227('0x2f')]};});_0x21d827['model']=_[_0x8227('0x2a')](_0x20401e,_0x8227('0x27'));_0x21d827['query']=_[_0x8227('0x30')](_0x1a5e33[_0x8227('0x31')]);_0x21d827[_0x8227('0x32')]=_['intersection'](_0x21d827[_0x8227('0x33')],_0x21d827[_0x8227('0x31')]);_0x1cfcf6[_0x8227('0x34')]=_[_0x8227('0x35')](_0x21d827[_0x8227('0x33')],qs[_0x8227('0x36')](_0x1a5e33[_0x8227('0x31')][_0x8227('0x36')]));_0x1cfcf6[_0x8227('0x34')]=_0x1cfcf6[_0x8227('0x34')][_0x8227('0x37')]?_0x1cfcf6['attributes']:_0x21d827[_0x8227('0x33')];if(!_0x1a5e33[_0x8227('0x31')][_0x8227('0x38')](_0x8227('0x39'))){_0x1cfcf6[_0x8227('0x1e')]=qs[_0x8227('0x1e')](_0x1a5e33['query'][_0x8227('0x1e')]);_0x1cfcf6[_0x8227('0x1d')]=qs['offset'](_0x1a5e33[_0x8227('0x31')][_0x8227('0x1d')]);}_0x1cfcf6[_0x8227('0x3a')]=qs[_0x8227('0x3b')](_0x1a5e33[_0x8227('0x31')]['sort']);_0x1cfcf6[_0x8227('0x3c')]=qs[_0x8227('0x32')](_[_0x8227('0x3d')](_0x1a5e33['query'],_0x21d827[_0x8227('0x32')]),_0x20401e);if(_0x1a5e33['query'][_0x8227('0x3e')]){_0x1cfcf6['where']=_[_0x8227('0x3f')](_0x1cfcf6[_0x8227('0x3c')],{'$or':_[_0x8227('0x2a')](_0x20401e,function(_0x55b961){if(_0x55b961[_0x8227('0x2e')]!==_0x8227('0x40')){var _0x314f48={};_0x314f48[_0x55b961['name']]={'$like':'%'+_0x1a5e33['query'][_0x8227('0x3e')]+'%'};return _0x314f48;}})});}_0x1cfcf6=_['merge']({},_0x1cfcf6,_0x1a5e33[_0x8227('0x41')]);var _0x39639b={'where':_0x1cfcf6[_0x8227('0x3c')]};return db[_0x8227('0x2b')][_0x8227('0x20')](_0x39639b)[_0x8227('0x25')](function(_0x5d1f92){_0x47280e[_0x8227('0x20')]=_0x5d1f92;if(_0x1a5e33['query'][_0x8227('0x42')]){_0x1cfcf6[_0x8227('0x43')]=[{'all':!![]}];}return db[_0x8227('0x2b')]['findAll'](_0x1cfcf6);})[_0x8227('0x25')](function(_0x424759){_0x47280e[_0x8227('0x44')]=_0x424759;return _0x47280e;})['then'](respondWithFilteredResult(_0x4f6c6d,_0x1cfcf6))[_0x8227('0x45')](handleError(_0x4f6c6d,null));};exports['show']=function(_0x3f1662,_0x2c2788){var _0x1dc9bd={'raw':![],'where':{'id':_0x3f1662[_0x8227('0x46')]['id']}},_0x241345={};_0x241345[_0x8227('0x33')]=_[_0x8227('0x30')](db[_0x8227('0x2b')][_0x8227('0x2c')]);_0x241345[_0x8227('0x31')]=_['keys'](_0x3f1662['query']);_0x241345[_0x8227('0x32')]=_['intersection'](_0x241345[_0x8227('0x33')],_0x241345[_0x8227('0x31')]);_0x1dc9bd[_0x8227('0x34')]=_['intersection'](_0x241345[_0x8227('0x33')],qs[_0x8227('0x36')](_0x3f1662[_0x8227('0x31')][_0x8227('0x36')]));_0x1dc9bd[_0x8227('0x34')]=_0x1dc9bd['attributes'][_0x8227('0x37')]?_0x1dc9bd[_0x8227('0x34')]:_0x241345[_0x8227('0x33')];if(_0x3f1662['query']['includeAll']){_0x1dc9bd[_0x8227('0x43')]=[{'all':!![]}];}_0x1dc9bd=_[_0x8227('0x3f')]({},_0x1dc9bd,_0x3f1662[_0x8227('0x41')]);return db[_0x8227('0x2b')][_0x8227('0x47')](_0x1dc9bd)['then'](handleEntityNotFound(_0x2c2788,null))['then'](respondWithResult(_0x2c2788,null))[_0x8227('0x45')](handleError(_0x2c2788,null));};exports[_0x8227('0x48')]=function(_0x3a0287,_0x5f0f2c){return db[_0x8227('0x2b')][_0x8227('0x48')](_0x3a0287[_0x8227('0x49')],{})[_0x8227('0x25')](respondWithResult(_0x5f0f2c,0xc9))['catch'](handleError(_0x5f0f2c,null));};exports[_0x8227('0x24')]=function(_0x2f696a,_0x45584f){if(_0x2f696a[_0x8227('0x49')]['id']){delete _0x2f696a[_0x8227('0x49')]['id'];}return db[_0x8227('0x2b')][_0x8227('0x47')]({'where':{'id':_0x2f696a[_0x8227('0x46')]['id']}})[_0x8227('0x25')](handleEntityNotFound(_0x45584f,null))[_0x8227('0x25')](saveUpdates(_0x2f696a[_0x8227('0x49')],null))[_0x8227('0x25')](respondWithResult(_0x45584f,null))[_0x8227('0x45')](handleError(_0x45584f,null));};exports[_0x8227('0x4a')]=function(_0x5ab062,_0x332617){return db['VtigerAccount'][_0x8227('0x47')]({'where':{'id':_0x5ab062[_0x8227('0x46')]['id']}})['then'](handleEntityNotFound(_0x332617,null))[_0x8227('0x25')](removeEntity(_0x332617,null))[_0x8227('0x45')](handleError(_0x332617,null));};exports[_0x8227('0x4b')]=function(_0x277c68,_0x3ccd2a,_0x4d8a31){var _0x589963={};var _0x8b1c5e={};var _0x1975b1;var _0x464e3f;return db[_0x8227('0x2b')][_0x8227('0x4c')]({'where':{'id':_0x277c68[_0x8227('0x46')]['id']}})[_0x8227('0x25')](handleEntityNotFound(_0x3ccd2a,null))[_0x8227('0x25')](function(_0x410324){if(_0x410324){_0x1975b1=_0x410324;_0x8b1c5e[_0x8227('0x33')]=_[_0x8227('0x30')](db[_0x8227('0x4d')][_0x8227('0x2c')]);_0x8b1c5e[_0x8227('0x31')]=_[_0x8227('0x30')](_0x277c68[_0x8227('0x31')]);_0x8b1c5e[_0x8227('0x32')]=_[_0x8227('0x35')](_0x8b1c5e['model'],_0x8b1c5e[_0x8227('0x31')]);_0x589963['attributes']=_['intersection'](_0x8b1c5e[_0x8227('0x33')],qs[_0x8227('0x36')](_0x277c68[_0x8227('0x31')][_0x8227('0x36')]));_0x589963[_0x8227('0x34')]=_0x589963[_0x8227('0x34')][_0x8227('0x37')]?_0x589963['attributes']:_0x8b1c5e[_0x8227('0x33')];_0x589963[_0x8227('0x3a')]=qs[_0x8227('0x3b')](_0x277c68[_0x8227('0x31')][_0x8227('0x3b')]);_0x589963['where']=qs[_0x8227('0x32')](_['pick'](_0x277c68[_0x8227('0x31')],_0x8b1c5e[_0x8227('0x32')]));if(_0x277c68[_0x8227('0x31')][_0x8227('0x3e')]){_0x589963[_0x8227('0x3c')]=_['merge'](_0x589963[_0x8227('0x3c')],{'$or':_[_0x8227('0x2a')](_0x589963[_0x8227('0x34')],function(_0x1e17ff){var _0x5a32ab={};_0x5a32ab[_0x1e17ff]={'$like':'%'+_0x277c68['query'][_0x8227('0x3e')]+'%'};return _0x5a32ab;})});}_0x589963=_[_0x8227('0x3f')]({},_0x589963,_0x277c68[_0x8227('0x41')]);return _0x1975b1[_0x8227('0x4b')](_0x589963);}})[_0x8227('0x25')](function(_0x2304fa){if(_0x2304fa){_0x464e3f=_0x2304fa[_0x8227('0x37')];if(!_0x277c68['query']['hasOwnProperty'](_0x8227('0x39'))){_0x589963[_0x8227('0x1e')]=qs[_0x8227('0x1e')](_0x277c68[_0x8227('0x31')][_0x8227('0x1e')]);_0x589963[_0x8227('0x1d')]=qs[_0x8227('0x1d')](_0x277c68[_0x8227('0x31')][_0x8227('0x1d')]);}return _0x1975b1[_0x8227('0x4b')](_0x589963);}})[_0x8227('0x25')](function(_0x108e90){if(_0x108e90){return _0x108e90?{'count':_0x464e3f,'rows':_0x108e90}:null;}})[_0x8227('0x25')](respondWithResult(_0x3ccd2a,null))[_0x8227('0x45')](handleError(_0x3ccd2a,null));};exports['addConfiguration']=function(_0x3282c5,_0x1babc5,_0x2b1cb3){if(_0x3282c5[_0x8227('0x49')]['id']){delete _0x3282c5[_0x8227('0x49')]['id'];}return db[_0x8227('0x2b')][_0x8227('0x4c')]({'where':{'id':_0x3282c5[_0x8227('0x46')]['id']}})[_0x8227('0x25')](handleEntityNotFound(_0x1babc5,null))[_0x8227('0x25')](function(_0x3d5214){if(_0x3d5214){_0x3282c5[_0x8227('0x49')][_0x8227('0x4e')]=_0x3d5214['id'];_0x3282c5['body'][_0x8227('0x4f')]=integrations[_0x8227('0x50')](_0x3282c5[_0x8227('0x49')][_0x8227('0x51')],_0x3282c5['body'][_0x8227('0x2e')]);_0x3282c5[_0x8227('0x49')][_0x8227('0x52')]=integrations[_0x8227('0x53')](_0x3282c5[_0x8227('0x49')][_0x8227('0x51')],_0x3282c5[_0x8227('0x49')][_0x8227('0x2e')]);return db[_0x8227('0x4d')][_0x8227('0x48')](_0x3282c5[_0x8227('0x49')],{'include':[{'model':db['VtigerField'],'as':_0x8227('0x4f')},{'model':db['VtigerField'],'as':_0x8227('0x52')}]});}return null;})['then'](respondWithResult(_0x1babc5,null))[_0x8227('0x45')](handleError(_0x1babc5,null));};var md5=require(_0x8227('0x54'));exports[_0x8227('0x55')]=function(_0x349115,_0x2bab32,_0x401a21){var _0x42a20a=null;var _0x1019a9=null;var _0x18a849=null;var _0x5d758f=null;var _0xbdd124='';return db['VtigerAccount'][_0x8227('0x4c')]({'where':{'id':_0x349115[_0x8227('0x46')]['id']},'attributes':['id',_0x8227('0x27'),_0x8227('0x56'),'description','moduleName',_0x8227('0x57'),_0x8227('0x58'),'accessKey']})[_0x8227('0x25')](handleEntityNotFound(_0x2bab32,null))[_0x8227('0x25')](function(_0x591d4f){if(_0x591d4f){_0x42a20a=_0x591d4f[_0x8227('0x56')];_0x1019a9=_0x591d4f['accessKey'];_0x18a849=_0x591d4f[_0x8227('0x59')];_0xbdd124=_0x591d4f[_0x8227('0x57')];var _0x5962d1=_0xbdd124['slice'](-0x1);if(_0x5962d1==='/'){_0xbdd124=_0xbdd124[_0x8227('0x5a')](0x0,_0xbdd124['lastIndexOf'](_0x5962d1));}_0x5d758f=util[_0x8227('0x5b')]('%s/webservice.php',_0xbdd124);var _0x4804d4={'method':_0x8227('0x5c'),'uri':_0x5d758f,'qs':{'operation':_0x8227('0x5d'),'username':_0x591d4f[_0x8227('0x56')]},'json':!![]};return rp(_0x4804d4);}})['then'](function(_0x56c19a){if(_0x56c19a[_0x8227('0x5e')]){var _0x4e0daa={'method':'POST','uri':_0x5d758f,'form':{'operation':_0x8227('0x5f'),'username':_0x42a20a,'accessKey':md5(_0x56c19a[_0x8227('0x60')][_0x8227('0x61')]+_0x1019a9)},'json':!![]};return rp(_0x4e0daa);}})[_0x8227('0x25')](function(_0x12cba1){if(_0x12cba1[_0x8227('0x5e')]){var _0x140615={'method':_0x8227('0x5c'),'uri':_0x5d758f,'qs':{'operation':_0x8227('0x62'),'username':_0x42a20a,'sessionName':_0x12cba1[_0x8227('0x60')][_0x8227('0x63')],'elementType':_0x18a849},'json':!![]};return rp(_0x140615);}})[_0x8227('0x25')](function(_0x2ba815){if(_0x2ba815[_0x8227('0x5e')]){var _0xe5edee=[_0x8227('0x64'),_0x8227('0x65'),'owner'];_['remove'](_0x2ba815[_0x8227('0x60')][_0x8227('0x36')],function(_0x2dc118){return _0xe5edee[_0x8227('0x66')](_0x2dc118[_0x8227('0x2e')]['name']);});_['remove'](_0x2ba815[_0x8227('0x60')][_0x8227('0x36')],function(_0x9638fd){return _0x9638fd[_0x8227('0x67')]===_0x8227('0x68');});return{'count':_0x2ba815[_0x8227('0x60')][_0x8227('0x36')][_0x8227('0x37')],'rows':_[_0x8227('0x2a')](_0x2ba815[_0x8227('0x60')]['fields'],function(_0x1c4052){return{'id':_0x1c4052[_0x8227('0x27')],'name':_0x1c4052['label'],'custom':_[_0x8227('0x69')](_0x1c4052[_0x8227('0x27')],'cf_')?!![]:![],'options':_0x1c4052['type']['name']===_0x8227('0x6a')&&_0x1c4052[_0x8227('0x2e')][_0x8227('0x6b')][_0x8227('0x37')]>0x0?_['map'](_0x1c4052['type'][_0x8227('0x6b')],function(_0x4f771c){return{'name':_0x4f771c['label'],'value':_0x4f771c[_0x8227('0x6c')]};}):[]};})};}})[_0x8227('0x25')](respondWithResult(_0x2bab32,null))[_0x8227('0x45')](function(_0x45fa9b){console[_0x8227('0x6d')](_0x8227('0x6e')+_0x45fa9b);var _0x95865a=_0x349115['query'][_0x8227('0x6f')]?0x1f4:_0x45fa9b[_0x8227('0x70')]||0x1f4;logger['error'](_0x8227('0x71'),_0x8227('0x55'),_0x95865a,JSON[_0x8227('0x72')](_0x45fa9b));delete _0x45fa9b[_0x8227('0x27')];if(_0x95865a===0x191){_0x95865a=0x190;}_0x2bab32[_0x8227('0x1b')](_0x95865a)[_0x8227('0x28')](_0x349115[_0x8227('0x31')][_0x8227('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x45fa9b[_0x8227('0x70')]}:_0x45fa9b);});}; \ No newline at end of file diff --git a/server/api/intVtigerAccount/intVtigerAccount.model.js b/server/api/intVtigerAccount/intVtigerAccount.model.js index d3b94d1..da612b7 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 _0xd5d8=['path','rimraf','./intVtigerAccount.attributes','../../components/integrations/configuration','exports','define','VtigerAccount','int_vtiger_accounts','../../config/logger','api','bluebird','request-promise'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xd5d8,0x98));var _0x8d5d=function(_0x7e23cb,_0x424bbc){_0x7e23cb=_0x7e23cb-0x0;var _0x4aded9=_0xd5d8[_0x7e23cb];return _0x4aded9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x8d5d('0x0'))(_0x8d5d('0x1'));var moment=require('moment');var BPromise=require(_0x8d5d('0x2'));var rp=require(_0x8d5d('0x3'));var fs=require('fs');var path=require(_0x8d5d('0x4'));var rimraf=require(_0x8d5d('0x5'));var config=require('../../config/environment');var attributes=require(_0x8d5d('0x6'));var integrations=require(_0x8d5d('0x7'));module[_0x8d5d('0x8')]=function(_0x5ed6bf,_0x186e9a){return _0x5ed6bf[_0x8d5d('0x9')](_0x8d5d('0xa'),attributes,{'tableName':_0x8d5d('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x482b=['rimraf','../../config/environment','exports','define','VtigerAccount','int_vtiger_accounts','../../config/logger','bluebird'];(function(_0x7b24fc,_0x22a106){var _0x33c138=function(_0x541d66){while(--_0x541d66){_0x7b24fc['push'](_0x7b24fc['shift']());}};_0x33c138(++_0x22a106);}(_0x482b,0xfe));var _0xb482=function(_0x1d4fd9,_0x40ba7c){_0x1d4fd9=_0x1d4fd9-0x0;var _0x330e80=_0x482b[_0x1d4fd9];return _0x330e80;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xb482('0x0'))('api');var moment=require('moment');var BPromise=require(_0xb482('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xb482('0x2'));var config=require(_0xb482('0x3'));var attributes=require('./intVtigerAccount.attributes');var integrations=require('../../components/integrations/configuration');module[_0xb482('0x4')]=function(_0x51348b,_0x5bf7df){return _0x51348b[_0xb482('0x5')](_0xb482('0x6'),attributes,{'tableName':_0xb482('0x7'),'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 ed79b8b..3b5e4f3 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 _0x5ec6=['util','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','VtigerAccount,\x20%s,\x20%s','debug','VtigerAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','GetVtigerAccount','VtigerAccount','findAll','options','raw','where','attributes','include','map','model','ShowVtigerAccount','find','lodash'];(function(_0xb32732,_0x14994a){var _0x2a6eb6=function(_0x426f26){while(--_0x426f26){_0xb32732['push'](_0xb32732['shift']());}};_0x2a6eb6(++_0x14994a);}(_0x5ec6,0x7f));var _0x65ec=function(_0x2d769f,_0x34e4b8){_0x2d769f=_0x2d769f-0x0;var _0x3675b6=_0x5ec6[_0x2d769f];return _0x3675b6;};'use strict';var _=require(_0x65ec('0x0'));var util=require(_0x65ec('0x1'));var moment=require(_0x65ec('0x2'));var BPromise=require('bluebird');var rs=require(_0x65ec('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x65ec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x65ec('0x5'))('rpc');var config=require(_0x65ec('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x65ec('0x7')][_0x65ec('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5d6254,_0xb3600b,_0x266254){return new BPromise(function(_0x4f8653,_0x28aa8f){return client[_0x65ec('0x9')](_0x5d6254,_0x266254)[_0x65ec('0xa')](function(_0x50e5c4){logger['info'](_0x65ec('0xb'),_0xb3600b,'request\x20sent');logger[_0x65ec('0xc')](_0x65ec('0xd'),_0xb3600b,'request\x20sent',JSON[_0x65ec('0xe')](_0x50e5c4));if(_0x50e5c4[_0x65ec('0xf')]){if(_0x50e5c4['error'][_0x65ec('0x10')]===0x1f4){logger[_0x65ec('0xf')]('VtigerAccount,\x20%s,\x20%s',_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x28aa8f(_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);}logger[_0x65ec('0xf')](_0x65ec('0xb'),_0xb3600b,_0x50e5c4[_0x65ec('0xf')][_0x65ec('0x11')]);return _0x4f8653(_0x50e5c4['error'][_0x65ec('0x11')]);}else{logger[_0x65ec('0x12')](_0x65ec('0xb'),_0xb3600b,'request\x20sent');_0x4f8653(_0x50e5c4['result'][_0x65ec('0x11')]);}})[_0x65ec('0x13')](function(_0xa597d4){logger['error'](_0x65ec('0xb'),_0xb3600b,_0xa597d4);_0x28aa8f(_0xa597d4);});});}exports[_0x65ec('0x14')]=function(_0x1254f8){var _0xb4ed90=this;return new Promise(function(_0x29ebc4,_0xd81ed3){return db[_0x65ec('0x15')][_0x65ec('0x16')]({'raw':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x18')]===undefined?!![]:![]:!![],'where':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x19')]||null:null,'attributes':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1a')]||null:null,'limit':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')]['limit']||null:null,'include':_0x1254f8[_0x65ec('0x17')]?_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x1254f8[_0x65ec('0x17')][_0x65ec('0x1b')],function(_0x47288d){return{'model':db[_0x47288d['model']],'as':_0x47288d['as'],'attributes':_0x47288d[_0x65ec('0x1a')],'include':_0x47288d[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x47288d[_0x65ec('0x1b')],function(_0x288e66){return{'model':db[_0x288e66[_0x65ec('0x1d')]],'as':_0x288e66['as'],'attributes':_0x288e66[_0x65ec('0x1a')],'include':_0x288e66[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x288e66['include'],function(_0x10baef){return{'model':db[_0x10baef[_0x65ec('0x1d')]],'as':_0x10baef['as'],'attributes':_0x10baef[_0x65ec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x65ec('0xa')](function(_0x4de451){logger[_0x65ec('0x12')]('GetVtigerAccount',_0x1254f8);logger[_0x65ec('0xc')](_0x65ec('0x14'),_0x1254f8,JSON[_0x65ec('0xe')](_0x4de451));_0x29ebc4(_0x4de451);})[_0x65ec('0x13')](function(_0x14431d){logger[_0x65ec('0xf')](_0x65ec('0x14'),_0x14431d[_0x65ec('0x11')],_0x1254f8);_0xd81ed3(_0xb4ed90[_0x65ec('0xf')](0x1f4,_0x14431d[_0x65ec('0x11')]));});});};exports[_0x65ec('0x1e')]=function(_0x4b435c){var _0x50d81f=this;return new Promise(function(_0x1d2e24,_0x5084af){return db[_0x65ec('0x15')][_0x65ec('0x1f')]({'raw':_0x4b435c['options']?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x18')]===undefined?!![]:![]:!![],'where':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')]['where']||null:null,'attributes':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1a')]||null:null,'include':_0x4b435c[_0x65ec('0x17')]?_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x4b435c[_0x65ec('0x17')][_0x65ec('0x1b')],function(_0xff3f3c){return{'model':db[_0xff3f3c['model']],'as':_0xff3f3c['as'],'attributes':_0xff3f3c[_0x65ec('0x1a')],'include':_0xff3f3c[_0x65ec('0x1b')]?_['map'](_0xff3f3c[_0x65ec('0x1b')],function(_0x24a242){return{'model':db[_0x24a242[_0x65ec('0x1d')]],'as':_0x24a242['as'],'attributes':_0x24a242[_0x65ec('0x1a')],'include':_0x24a242[_0x65ec('0x1b')]?_[_0x65ec('0x1c')](_0x24a242[_0x65ec('0x1b')],function(_0x5afcfc){return{'model':db[_0x5afcfc[_0x65ec('0x1d')]],'as':_0x5afcfc['as'],'attributes':_0x5afcfc[_0x65ec('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x65ec('0xa')](function(_0x185447){logger['info'](_0x65ec('0x1e'),_0x4b435c);logger[_0x65ec('0xc')](_0x65ec('0x1e'),_0x4b435c,JSON[_0x65ec('0xe')](_0x185447));_0x1d2e24(_0x185447);})['catch'](function(_0x59a1c2){logger[_0x65ec('0xf')]('ShowVtigerAccount',_0x59a1c2[_0x65ec('0x11')],_0x4b435c);_0x5084af(_0x50d81f[_0x65ec('0xf')](0x1f4,_0x59a1c2['message']));});});}; \ No newline at end of file +var _0x4cf8=['info','VtigerAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','code','error','message','result','catch','GetVtigerAccount','options','raw','attributes','include','map','model','ShowVtigerAccount','where','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0x4cf8,0x1e1));var _0x84cf=function(_0x91d019,_0x5223c4){_0x91d019=_0x91d019-0x0;var _0x19de1f=_0x4cf8[_0x91d019];return _0x19de1f;};'use strict';var _=require(_0x84cf('0x0'));var util=require(_0x84cf('0x1'));var moment=require(_0x84cf('0x2'));var BPromise=require(_0x84cf('0x3'));var rs=require(_0x84cf('0x4'));var fs=require('fs');var Redis=require(_0x84cf('0x5'));var db=require(_0x84cf('0x6'))['db'];var utils=require(_0x84cf('0x7'));var logger=require(_0x84cf('0x8'))(_0x84cf('0x9'));var config=require(_0x84cf('0xa'));var jayson=require(_0x84cf('0xb'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x455345,_0x56c5cc,_0x15ba85){return new BPromise(function(_0x2c11b0,_0x51b84c){return client[_0x84cf('0xc')](_0x455345,_0x15ba85)[_0x84cf('0xd')](function(_0x489063){logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));logger[_0x84cf('0x11')]('VtigerAccount,\x20%s,\x20%s,\x20%s',_0x56c5cc,_0x84cf('0x10'),JSON[_0x84cf('0x12')](_0x489063));if(_0x489063['error']){if(_0x489063['error'][_0x84cf('0x13')]===0x1f4){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x51b84c(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);return _0x2c11b0(_0x489063[_0x84cf('0x14')][_0x84cf('0x15')]);}else{logger[_0x84cf('0xe')](_0x84cf('0xf'),_0x56c5cc,_0x84cf('0x10'));_0x2c11b0(_0x489063[_0x84cf('0x16')][_0x84cf('0x15')]);}})[_0x84cf('0x17')](function(_0x5b8ac8){logger[_0x84cf('0x14')](_0x84cf('0xf'),_0x56c5cc,_0x5b8ac8);_0x51b84c(_0x5b8ac8);});});}exports[_0x84cf('0x18')]=function(_0x1abe2d){var _0x1dad1a=this;return new Promise(function(_0x13ba16,_0xe6b5b6){return db['VtigerAccount']['findAll']({'raw':_0x1abe2d[_0x84cf('0x19')]?_0x1abe2d[_0x84cf('0x19')][_0x84cf('0x1a')]===undefined?!![]:![]:!![],'where':_0x1abe2d[_0x84cf('0x19')]?_0x1abe2d[_0x84cf('0x19')]['where']||null:null,'attributes':_0x1abe2d[_0x84cf('0x19')]?_0x1abe2d[_0x84cf('0x19')][_0x84cf('0x1b')]||null:null,'limit':_0x1abe2d[_0x84cf('0x19')]?_0x1abe2d[_0x84cf('0x19')]['limit']||null:null,'include':_0x1abe2d[_0x84cf('0x19')]?_0x1abe2d[_0x84cf('0x19')][_0x84cf('0x1c')]?_[_0x84cf('0x1d')](_0x1abe2d[_0x84cf('0x19')][_0x84cf('0x1c')],function(_0x7feb4){return{'model':db[_0x7feb4['model']],'as':_0x7feb4['as'],'attributes':_0x7feb4[_0x84cf('0x1b')],'include':_0x7feb4[_0x84cf('0x1c')]?_[_0x84cf('0x1d')](_0x7feb4[_0x84cf('0x1c')],function(_0x1d220a){return{'model':db[_0x1d220a[_0x84cf('0x1e')]],'as':_0x1d220a['as'],'attributes':_0x1d220a[_0x84cf('0x1b')],'include':_0x1d220a[_0x84cf('0x1c')]?_[_0x84cf('0x1d')](_0x1d220a[_0x84cf('0x1c')],function(_0x5179c1){return{'model':db[_0x5179c1[_0x84cf('0x1e')]],'as':_0x5179c1['as'],'attributes':_0x5179c1[_0x84cf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x84cf('0xd')](function(_0x41a5db){logger['info'](_0x84cf('0x18'),_0x1abe2d);logger['debug'](_0x84cf('0x18'),_0x1abe2d,JSON[_0x84cf('0x12')](_0x41a5db));_0x13ba16(_0x41a5db);})[_0x84cf('0x17')](function(_0xc15298){logger[_0x84cf('0x14')](_0x84cf('0x18'),_0xc15298[_0x84cf('0x15')],_0x1abe2d);_0xe6b5b6(_0x1dad1a[_0x84cf('0x14')](0x1f4,_0xc15298[_0x84cf('0x15')]));});});};exports[_0x84cf('0x1f')]=function(_0x31dbf5){var _0x308f8f=this;return new Promise(function(_0x18243d,_0x44f16e){return db['VtigerAccount']['find']({'raw':_0x31dbf5[_0x84cf('0x19')]?_0x31dbf5[_0x84cf('0x19')][_0x84cf('0x1a')]===undefined?!![]:![]:!![],'where':_0x31dbf5[_0x84cf('0x19')]?_0x31dbf5[_0x84cf('0x19')][_0x84cf('0x20')]||null:null,'attributes':_0x31dbf5[_0x84cf('0x19')]?_0x31dbf5[_0x84cf('0x19')]['attributes']||null:null,'include':_0x31dbf5[_0x84cf('0x19')]?_0x31dbf5[_0x84cf('0x19')]['include']?_[_0x84cf('0x1d')](_0x31dbf5['options'][_0x84cf('0x1c')],function(_0x3ea5b9){return{'model':db[_0x3ea5b9[_0x84cf('0x1e')]],'as':_0x3ea5b9['as'],'attributes':_0x3ea5b9[_0x84cf('0x1b')],'include':_0x3ea5b9[_0x84cf('0x1c')]?_['map'](_0x3ea5b9[_0x84cf('0x1c')],function(_0x48309d){return{'model':db[_0x48309d['model']],'as':_0x48309d['as'],'attributes':_0x48309d[_0x84cf('0x1b')],'include':_0x48309d[_0x84cf('0x1c')]?_['map'](_0x48309d[_0x84cf('0x1c')],function(_0x263372){return{'model':db[_0x263372[_0x84cf('0x1e')]],'as':_0x263372['as'],'attributes':_0x263372[_0x84cf('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x84cf('0xd')](function(_0x300f94){logger['info'](_0x84cf('0x1f'),_0x31dbf5);logger[_0x84cf('0x11')](_0x84cf('0x1f'),_0x31dbf5,JSON[_0x84cf('0x12')](_0x300f94));_0x18243d(_0x300f94);})[_0x84cf('0x17')](function(_0x2a8992){logger['error'](_0x84cf('0x1f'),_0x2a8992['message'],_0x31dbf5);_0x44f16e(_0x308f8f[_0x84cf('0x14')](0x1f4,_0x2a8992[_0x84cf('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/index.js b/server/api/intVtigerConfiguration/index.js index a1298cf..64d22c1 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 _0x2d3d=['destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','/:id/fields','getFields','/:id/subjects','getSubjects','getDescriptions','create','/:id','update','delete'];(function(_0x4583d0,_0x24551f){var _0x7b3c5a=function(_0x14946a){while(--_0x14946a){_0x4583d0['push'](_0x4583d0['shift']());}};_0x7b3c5a(++_0x24551f);}(_0x2d3d,0x1e5));var _0xd2d3=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2d3d[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xd2d3('0x0'));var util=require(_0xd2d3('0x1'));var path=require(_0xd2d3('0x2'));var timeout=require(_0xd2d3('0x3'));var express=require(_0xd2d3('0x4'));var router=express[_0xd2d3('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xd2d3('0x6'));var config=require(_0xd2d3('0x7'));var controller=require('./intVtigerConfiguration.controller');router[_0xd2d3('0x8')]('/',auth[_0xd2d3('0x9')](),controller[_0xd2d3('0xa')]);router[_0xd2d3('0x8')]('/:id',auth[_0xd2d3('0x9')](),controller[_0xd2d3('0xb')]);router[_0xd2d3('0x8')](_0xd2d3('0xc'),auth[_0xd2d3('0x9')](),controller[_0xd2d3('0xd')]);router[_0xd2d3('0x8')](_0xd2d3('0xe'),auth[_0xd2d3('0x9')](),controller[_0xd2d3('0xf')]);router[_0xd2d3('0x8')]('/:id/descriptions',auth[_0xd2d3('0x9')](),controller[_0xd2d3('0x10')]);router['post']('/',auth[_0xd2d3('0x9')](),controller[_0xd2d3('0x11')]);router['put'](_0xd2d3('0x12'),auth['isAuthenticated'](),controller[_0xd2d3('0x13')]);router[_0xd2d3('0x14')](_0xd2d3('0x12'),auth[_0xd2d3('0x9')](),controller[_0xd2d3('0x15')]);module[_0xd2d3('0x16')]=router; \ No newline at end of file +var _0x7923=['show','/:id/fields','/:id/subjects','getSubjects','post','update','delete','destroy','exports','util','connect-timeout','Router','../../components/interaction/service','./intVtigerConfiguration.controller','get','isAuthenticated','/:id'];(function(_0x6275c8,_0x525d0a){var _0x5017ae=function(_0x55a897){while(--_0x55a897){_0x6275c8['push'](_0x6275c8['shift']());}};_0x5017ae(++_0x525d0a);}(_0x7923,0xb3));var _0x3792=function(_0x1ac1b7,_0x4c7f77){_0x1ac1b7=_0x1ac1b7-0x0;var _0x39d51f=_0x7923[_0x1ac1b7];return _0x39d51f;};'use strict';var multer=require('multer');var util=require(_0x3792('0x0'));var path=require('path');var timeout=require(_0x3792('0x1'));var express=require('express');var router=express[_0x3792('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x3792('0x3'));var config=require('../../config/environment');var controller=require(_0x3792('0x4'));router[_0x3792('0x5')]('/',auth[_0x3792('0x6')](),controller['index']);router['get'](_0x3792('0x7'),auth[_0x3792('0x6')](),controller[_0x3792('0x8')]);router[_0x3792('0x5')](_0x3792('0x9'),auth['isAuthenticated'](),controller['getFields']);router['get'](_0x3792('0xa'),auth['isAuthenticated'](),controller[_0x3792('0xb')]);router[_0x3792('0x5')]('/:id/descriptions',auth['isAuthenticated'](),controller['getDescriptions']);router[_0x3792('0xc')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x3792('0x7'),auth[_0x3792('0x6')](),controller[_0x3792('0xd')]);router[_0x3792('0xe')](_0x3792('0x7'),auth[_0x3792('0x6')](),controller[_0x3792('0xf')]);module[_0x3792('0x10')]=router; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.attributes.js index 5df89a3..52aa277 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 _0xda3a=['STRING','sequelize','exports'];(function(_0x53d430,_0xd8e660){var _0x5dca28=function(_0x61c94f){while(--_0x61c94f){_0x53d430['push'](_0x53d430['shift']());}};_0x5dca28(++_0xd8e660);}(_0xda3a,0x1c0));var _0xada3=function(_0x2039ae,_0x5b09e5){_0x2039ae=_0x2039ae-0x0;var _0x286156=_0xda3a[_0x2039ae];return _0x286156;};'use strict';var Sequelize=require(_0xada3('0x0'));module[_0xada3('0x1')]={'name':{'type':Sequelize[_0xada3('0x2')]},'description':{'type':Sequelize[_0xada3('0x2')]}}; \ No newline at end of file +var _0xd546=['exports','STRING'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xd546,0xaa));var _0x6d54=function(_0x11677b,_0x26eed0){_0x11677b=_0x11677b-0x0;var _0x614b34=_0xd546[_0x11677b];return _0x614b34;};'use strict';var Sequelize=require('sequelize');module[_0x6d54('0x0')]={'name':{'type':Sequelize[_0x6d54('0x1')]},'description':{'type':Sequelize[_0x6d54('0x1')]}}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.controller.js index 2dd5c22..b70e541 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 _0xc2e1=['papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','count','limit','json','apply','reject','update','destroy','then','end','error','name','index','VtigerConfiguration','rawAttributes','type','key','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','show','params','create','body','find','getFields','VtigerField','getSubjects','getDescriptions','findOne','eml-format','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js'];(function(_0x47a8c0,_0x4d5931){var _0x551fa1=function(_0x45ac5a){while(--_0x45ac5a){_0x47a8c0['push'](_0x47a8c0['shift']());}};_0x551fa1(++_0x4d5931);}(_0xc2e1,0x1b3));var _0x1c2e=function(_0x38bc94,_0x49f0b7){_0x38bc94=_0x38bc94-0x0;var _0x15564c=_0xc2e1[_0x38bc94];return _0x15564c;};'use strict';var emlformat=require(_0x1c2e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1c2e('0x1'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x1c2e('0x2'));var BPromise=require(_0x1c2e('0x3'));var Mustache=require(_0x1c2e('0x4'));var util=require(_0x1c2e('0x5'));var path=require(_0x1c2e('0x6'));var sox=require(_0x1c2e('0x7'));var csv=require(_0x1c2e('0x8'));var ejs=require(_0x1c2e('0x9'));var fs=require('fs');var fs_extra=require(_0x1c2e('0xa'));var _=require(_0x1c2e('0xb'));var squel=require('squel');var crypto=require(_0x1c2e('0xc'));var jsforce=require(_0x1c2e('0xd'));var deskjs=require(_0x1c2e('0xe'));var toCsv=require(_0x1c2e('0x8'));var querystring=require('querystring');var Papa=require(_0x1c2e('0xf'));var Redis=require(_0x1c2e('0x10'));var authService=require(_0x1c2e('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x1c2e('0x12'));var logger=require(_0x1c2e('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x1c2e('0x14'));var licenseUtil=require(_0x1c2e('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x175773,_0x28e33c){_0x28e33c=_0x28e33c||0xcc;return function(_0x291734){if(_0x291734){return _0x175773[_0x1c2e('0x16')](_0x28e33c);}return _0x175773[_0x1c2e('0x17')](_0x28e33c)['end']();};}function respondWithResult(_0x85eff5,_0x32a6c0){_0x32a6c0=_0x32a6c0||0xc8;return function(_0x2e9709){if(_0x2e9709){return _0x85eff5[_0x1c2e('0x17')](_0x32a6c0)['json'](_0x2e9709);}};}function respondWithFilteredResult(_0xdcd657,_0x44ea76){return function(_0x2878b0){if(_0x2878b0){var _0x50c5f6=typeof _0x44ea76[_0x1c2e('0x18')]==='undefined'&&typeof _0x44ea76['limit']===_0x1c2e('0x19');var _0xb02ae=_0x2878b0['count'];var _0x3f10f3=_0x50c5f6?0x0:_0x44ea76[_0x1c2e('0x18')];var _0x351ba4=_0x50c5f6?_0x2878b0[_0x1c2e('0x1a')]:_0x44ea76[_0x1c2e('0x18')]+_0x44ea76[_0x1c2e('0x1b')];var _0x26d7b6;if(_0x351ba4>=_0xb02ae){_0x351ba4=_0xb02ae;_0x26d7b6=0xc8;}else{_0x26d7b6=0xce;}_0xdcd657['status'](_0x26d7b6);return _0xdcd657['set']('Content-Range',_0x3f10f3+'-'+_0x351ba4+'/'+_0xb02ae)[_0x1c2e('0x1c')](_0x2878b0);}return null;};}function patchUpdates(_0x431a6a){return function(_0x49c1a3){try{jsonpatch[_0x1c2e('0x1d')](_0x49c1a3,_0x431a6a,!![]);}catch(_0x2f0b02){return BPromise[_0x1c2e('0x1e')](_0x2f0b02);}return _0x49c1a3['save']();};}function saveUpdates(_0x3a14b2,_0x35de4c){return function(_0x51a151){if(_0x51a151){return _0x51a151[_0x1c2e('0x1f')](_0x3a14b2)['then'](function(_0x340e7b){return _0x340e7b;});}return null;};}function removeEntity(_0x553bbf,_0x542ae1){return function(_0xa79800){if(_0xa79800){return _0xa79800[_0x1c2e('0x20')]()[_0x1c2e('0x21')](function(){_0x553bbf[_0x1c2e('0x17')](0xcc)[_0x1c2e('0x22')]();});}};}function handleEntityNotFound(_0x2c7d15,_0x3992c6){return function(_0x348077){if(!_0x348077){_0x2c7d15['sendStatus'](0x194);}return _0x348077;};}function handleError(_0x4d7e76,_0x4877a3){_0x4877a3=_0x4877a3||0x1f4;return function(_0x227e56){logger[_0x1c2e('0x23')](_0x227e56['stack']);if(_0x227e56[_0x1c2e('0x24')]){delete _0x227e56[_0x1c2e('0x24')];}_0x4d7e76[_0x1c2e('0x17')](_0x4877a3)['send'](_0x227e56);};}exports[_0x1c2e('0x25')]=function(_0x3b0f83,_0x11a611){var _0x130f55={},_0x53f3f9={},_0x2a66da={'count':0x0,'rows':[]};var _0x53d345=_['map'](db[_0x1c2e('0x26')][_0x1c2e('0x27')],function(_0x4dad71){return{'name':_0x4dad71['fieldName'],'type':_0x4dad71[_0x1c2e('0x28')][_0x1c2e('0x29')]};});_0x53f3f9[_0x1c2e('0x2a')]=_[_0x1c2e('0x2b')](_0x53d345,'name');_0x53f3f9[_0x1c2e('0x2c')]=_[_0x1c2e('0x2d')](_0x3b0f83['query']);_0x53f3f9[_0x1c2e('0x2e')]=_[_0x1c2e('0x2f')](_0x53f3f9[_0x1c2e('0x2a')],_0x53f3f9['query']);_0x130f55[_0x1c2e('0x30')]=_[_0x1c2e('0x2f')](_0x53f3f9[_0x1c2e('0x2a')],qs[_0x1c2e('0x31')](_0x3b0f83[_0x1c2e('0x2c')][_0x1c2e('0x31')]));_0x130f55[_0x1c2e('0x30')]=_0x130f55[_0x1c2e('0x30')][_0x1c2e('0x32')]?_0x130f55['attributes']:_0x53f3f9[_0x1c2e('0x2a')];if(!_0x3b0f83[_0x1c2e('0x2c')][_0x1c2e('0x33')](_0x1c2e('0x34'))){_0x130f55[_0x1c2e('0x1b')]=qs[_0x1c2e('0x1b')](_0x3b0f83[_0x1c2e('0x2c')][_0x1c2e('0x1b')]);_0x130f55[_0x1c2e('0x18')]=qs['offset'](_0x3b0f83[_0x1c2e('0x2c')][_0x1c2e('0x18')]);}_0x130f55[_0x1c2e('0x35')]=qs[_0x1c2e('0x36')](_0x3b0f83['query'][_0x1c2e('0x36')]);_0x130f55[_0x1c2e('0x37')]=qs[_0x1c2e('0x2e')](_[_0x1c2e('0x38')](_0x3b0f83[_0x1c2e('0x2c')],_0x53f3f9[_0x1c2e('0x2e')]),_0x53d345);if(_0x3b0f83[_0x1c2e('0x2c')][_0x1c2e('0x39')]){_0x130f55[_0x1c2e('0x37')]=_['merge'](_0x130f55[_0x1c2e('0x37')],{'$or':_[_0x1c2e('0x2b')](_0x53d345,function(_0x432998){if(_0x432998[_0x1c2e('0x28')]!==_0x1c2e('0x3a')){var _0x46deb1={};_0x46deb1[_0x432998['name']]={'$like':'%'+_0x3b0f83[_0x1c2e('0x2c')][_0x1c2e('0x39')]+'%'};return _0x46deb1;}})});}_0x130f55=_[_0x1c2e('0x3b')]({},_0x130f55,_0x3b0f83['options']);var _0x145520={'where':_0x130f55['where']};return db[_0x1c2e('0x26')][_0x1c2e('0x1a')](_0x145520)['then'](function(_0x5bf4de){_0x2a66da['count']=_0x5bf4de;if(_0x3b0f83[_0x1c2e('0x2c')][_0x1c2e('0x3c')]){_0x130f55[_0x1c2e('0x3d')]=[{'all':!![]}];}return db[_0x1c2e('0x26')][_0x1c2e('0x3e')](_0x130f55);})[_0x1c2e('0x21')](function(_0x1a2bce){_0x2a66da[_0x1c2e('0x3f')]=_0x1a2bce;return _0x2a66da;})['then'](respondWithFilteredResult(_0x11a611,_0x130f55))[_0x1c2e('0x40')](handleError(_0x11a611,null));};exports[_0x1c2e('0x41')]=function(_0x35d451,_0x3c5b2b){var _0x27a13d={'raw':![],'where':{'id':_0x35d451[_0x1c2e('0x42')]['id']}},_0x3c6bed={};_0x3c6bed[_0x1c2e('0x2a')]=_[_0x1c2e('0x2d')](db['VtigerConfiguration'][_0x1c2e('0x27')]);_0x3c6bed[_0x1c2e('0x2c')]=_[_0x1c2e('0x2d')](_0x35d451[_0x1c2e('0x2c')]);_0x3c6bed[_0x1c2e('0x2e')]=_['intersection'](_0x3c6bed[_0x1c2e('0x2a')],_0x3c6bed[_0x1c2e('0x2c')]);_0x27a13d[_0x1c2e('0x30')]=_[_0x1c2e('0x2f')](_0x3c6bed[_0x1c2e('0x2a')],qs[_0x1c2e('0x31')](_0x35d451[_0x1c2e('0x2c')][_0x1c2e('0x31')]));_0x27a13d[_0x1c2e('0x30')]=_0x27a13d[_0x1c2e('0x30')][_0x1c2e('0x32')]?_0x27a13d['attributes']:_0x3c6bed[_0x1c2e('0x2a')];if(_0x35d451[_0x1c2e('0x2c')][_0x1c2e('0x3c')]){_0x27a13d['include']=[{'all':!![]}];}_0x27a13d=_['merge']({},_0x27a13d,_0x35d451['options']);return db[_0x1c2e('0x26')]['find'](_0x27a13d)[_0x1c2e('0x21')](handleEntityNotFound(_0x3c5b2b,null))[_0x1c2e('0x21')](respondWithResult(_0x3c5b2b,null))[_0x1c2e('0x40')](handleError(_0x3c5b2b,null));};exports[_0x1c2e('0x43')]=function(_0x11ce42,_0x15e988){return db['VtigerConfiguration'][_0x1c2e('0x43')](_0x11ce42['body'],{})[_0x1c2e('0x21')](respondWithResult(_0x15e988,0xc9))[_0x1c2e('0x40')](handleError(_0x15e988,null));};exports['update']=function(_0x431639,_0x43a2bb){if(_0x431639[_0x1c2e('0x44')]['id']){delete _0x431639['body']['id'];}return db['VtigerConfiguration'][_0x1c2e('0x45')]({'where':{'id':_0x431639[_0x1c2e('0x42')]['id']}})[_0x1c2e('0x21')](handleEntityNotFound(_0x43a2bb,null))['then'](saveUpdates(_0x431639[_0x1c2e('0x44')],null))[_0x1c2e('0x21')](respondWithResult(_0x43a2bb,null))['catch'](handleError(_0x43a2bb,null));};exports[_0x1c2e('0x20')]=function(_0x3ff9e5,_0x232368){return db[_0x1c2e('0x26')][_0x1c2e('0x45')]({'where':{'id':_0x3ff9e5['params']['id']}})[_0x1c2e('0x21')](handleEntityNotFound(_0x232368,null))[_0x1c2e('0x21')](removeEntity(_0x232368,null))[_0x1c2e('0x40')](handleError(_0x232368,null));};exports[_0x1c2e('0x46')]=function(_0x3bd9f8,_0x45a0a9,_0x2e95bb){var _0x196c06={};var _0x27b405={};var _0x332029;var _0x1d172f;return db[_0x1c2e('0x26')]['findOne']({'where':{'id':_0x3bd9f8[_0x1c2e('0x42')]['id']}})[_0x1c2e('0x21')](handleEntityNotFound(_0x45a0a9,null))[_0x1c2e('0x21')](function(_0x538d5f){if(_0x538d5f){_0x332029=_0x538d5f;_0x27b405['model']=_['keys'](db[_0x1c2e('0x47')][_0x1c2e('0x27')]);_0x27b405[_0x1c2e('0x2c')]=_['keys'](_0x3bd9f8['query']);_0x27b405['filters']=_[_0x1c2e('0x2f')](_0x27b405[_0x1c2e('0x2a')],_0x27b405[_0x1c2e('0x2c')]);_0x196c06[_0x1c2e('0x30')]=_['intersection'](_0x27b405['model'],qs[_0x1c2e('0x31')](_0x3bd9f8[_0x1c2e('0x2c')][_0x1c2e('0x31')]));_0x196c06[_0x1c2e('0x30')]=_0x196c06[_0x1c2e('0x30')][_0x1c2e('0x32')]?_0x196c06[_0x1c2e('0x30')]:_0x27b405['model'];_0x196c06[_0x1c2e('0x35')]=qs[_0x1c2e('0x36')](_0x3bd9f8[_0x1c2e('0x2c')]['sort']);_0x196c06[_0x1c2e('0x37')]=qs[_0x1c2e('0x2e')](_[_0x1c2e('0x38')](_0x3bd9f8[_0x1c2e('0x2c')],_0x27b405['filters']));if(_0x3bd9f8[_0x1c2e('0x2c')][_0x1c2e('0x39')]){_0x196c06['where']=_['merge'](_0x196c06[_0x1c2e('0x37')],{'$or':_['map'](_0x196c06[_0x1c2e('0x30')],function(_0x496aea){var _0x2f089d={};_0x2f089d[_0x496aea]={'$like':'%'+_0x3bd9f8['query']['filter']+'%'};return _0x2f089d;})});}_0x196c06=_[_0x1c2e('0x3b')]({},_0x196c06,_0x3bd9f8['options']);return _0x332029[_0x1c2e('0x46')](_0x196c06);}})[_0x1c2e('0x21')](function(_0x16c6d9){if(_0x16c6d9){_0x1d172f=_0x16c6d9[_0x1c2e('0x32')];if(!_0x3bd9f8[_0x1c2e('0x2c')]['hasOwnProperty']('nolimit')){_0x196c06[_0x1c2e('0x1b')]=qs['limit'](_0x3bd9f8['query'][_0x1c2e('0x1b')]);_0x196c06['offset']=qs[_0x1c2e('0x18')](_0x3bd9f8[_0x1c2e('0x2c')][_0x1c2e('0x18')]);}return _0x332029[_0x1c2e('0x46')](_0x196c06);}})[_0x1c2e('0x21')](function(_0xd36e4d){if(_0xd36e4d){return _0xd36e4d?{'count':_0x1d172f,'rows':_0xd36e4d}:null;}})[_0x1c2e('0x21')](respondWithResult(_0x45a0a9,null))[_0x1c2e('0x40')](handleError(_0x45a0a9,null));};exports[_0x1c2e('0x48')]=function(_0x425a21,_0x1dc64a,_0x20e36c){var _0x395bac={};var _0x4f01ce={};var _0x1bd905;var _0xfe5198;return db[_0x1c2e('0x26')]['findOne']({'where':{'id':_0x425a21[_0x1c2e('0x42')]['id']}})[_0x1c2e('0x21')](handleEntityNotFound(_0x1dc64a,null))[_0x1c2e('0x21')](function(_0x4a9811){if(_0x4a9811){_0x1bd905=_0x4a9811;_0x4f01ce[_0x1c2e('0x2a')]=_['keys'](db[_0x1c2e('0x47')][_0x1c2e('0x27')]);_0x4f01ce[_0x1c2e('0x2c')]=_[_0x1c2e('0x2d')](_0x425a21['query']);_0x4f01ce[_0x1c2e('0x2e')]=_[_0x1c2e('0x2f')](_0x4f01ce[_0x1c2e('0x2a')],_0x4f01ce[_0x1c2e('0x2c')]);_0x395bac[_0x1c2e('0x30')]=_[_0x1c2e('0x2f')](_0x4f01ce[_0x1c2e('0x2a')],qs[_0x1c2e('0x31')](_0x425a21[_0x1c2e('0x2c')][_0x1c2e('0x31')]));_0x395bac[_0x1c2e('0x30')]=_0x395bac[_0x1c2e('0x30')][_0x1c2e('0x32')]?_0x395bac[_0x1c2e('0x30')]:_0x4f01ce[_0x1c2e('0x2a')];_0x395bac[_0x1c2e('0x35')]=qs[_0x1c2e('0x36')](_0x425a21[_0x1c2e('0x2c')]['sort']);_0x395bac[_0x1c2e('0x37')]=qs[_0x1c2e('0x2e')](_[_0x1c2e('0x38')](_0x425a21[_0x1c2e('0x2c')],_0x4f01ce[_0x1c2e('0x2e')]));if(_0x425a21[_0x1c2e('0x2c')][_0x1c2e('0x39')]){_0x395bac[_0x1c2e('0x37')]=_[_0x1c2e('0x3b')](_0x395bac[_0x1c2e('0x37')],{'$or':_[_0x1c2e('0x2b')](_0x395bac[_0x1c2e('0x30')],function(_0xed143a){var _0x2a1057={};_0x2a1057[_0xed143a]={'$like':'%'+_0x425a21['query'][_0x1c2e('0x39')]+'%'};return _0x2a1057;})});}_0x395bac=_[_0x1c2e('0x3b')]({},_0x395bac,_0x425a21['options']);return _0x1bd905[_0x1c2e('0x48')](_0x395bac);}})[_0x1c2e('0x21')](function(_0x3d74f9){if(_0x3d74f9){_0xfe5198=_0x3d74f9[_0x1c2e('0x32')];if(!_0x425a21['query']['hasOwnProperty'](_0x1c2e('0x34'))){_0x395bac[_0x1c2e('0x1b')]=qs['limit'](_0x425a21[_0x1c2e('0x2c')][_0x1c2e('0x1b')]);_0x395bac['offset']=qs[_0x1c2e('0x18')](_0x425a21[_0x1c2e('0x2c')][_0x1c2e('0x18')]);}return _0x1bd905[_0x1c2e('0x48')](_0x395bac);}})[_0x1c2e('0x21')](function(_0xde29d3){if(_0xde29d3){return _0xde29d3?{'count':_0xfe5198,'rows':_0xde29d3}:null;}})[_0x1c2e('0x21')](respondWithResult(_0x1dc64a,null))['catch'](handleError(_0x1dc64a,null));};exports[_0x1c2e('0x49')]=function(_0x54f7b9,_0x2dad27,_0x3ed1ba){var _0x3edb8a={};var _0x5d065d={};var _0x1263f2;var _0x1871d7;return db[_0x1c2e('0x26')][_0x1c2e('0x4a')]({'where':{'id':_0x54f7b9[_0x1c2e('0x42')]['id']}})[_0x1c2e('0x21')](handleEntityNotFound(_0x2dad27,null))[_0x1c2e('0x21')](function(_0x4e5d35){if(_0x4e5d35){_0x1263f2=_0x4e5d35;_0x5d065d[_0x1c2e('0x2a')]=_[_0x1c2e('0x2d')](db['VtigerField'][_0x1c2e('0x27')]);_0x5d065d['query']=_[_0x1c2e('0x2d')](_0x54f7b9[_0x1c2e('0x2c')]);_0x5d065d[_0x1c2e('0x2e')]=_[_0x1c2e('0x2f')](_0x5d065d[_0x1c2e('0x2a')],_0x5d065d[_0x1c2e('0x2c')]);_0x3edb8a['attributes']=_[_0x1c2e('0x2f')](_0x5d065d[_0x1c2e('0x2a')],qs['fields'](_0x54f7b9[_0x1c2e('0x2c')][_0x1c2e('0x31')]));_0x3edb8a[_0x1c2e('0x30')]=_0x3edb8a['attributes'][_0x1c2e('0x32')]?_0x3edb8a[_0x1c2e('0x30')]:_0x5d065d[_0x1c2e('0x2a')];_0x3edb8a[_0x1c2e('0x35')]=qs[_0x1c2e('0x36')](_0x54f7b9[_0x1c2e('0x2c')]['sort']);_0x3edb8a[_0x1c2e('0x37')]=qs[_0x1c2e('0x2e')](_[_0x1c2e('0x38')](_0x54f7b9['query'],_0x5d065d[_0x1c2e('0x2e')]));if(_0x54f7b9[_0x1c2e('0x2c')][_0x1c2e('0x39')]){_0x3edb8a[_0x1c2e('0x37')]=_['merge'](_0x3edb8a[_0x1c2e('0x37')],{'$or':_[_0x1c2e('0x2b')](_0x3edb8a[_0x1c2e('0x30')],function(_0x4077ca){var _0x441c3d={};_0x441c3d[_0x4077ca]={'$like':'%'+_0x54f7b9[_0x1c2e('0x2c')]['filter']+'%'};return _0x441c3d;})});}_0x3edb8a=_['merge']({},_0x3edb8a,_0x54f7b9['options']);return _0x1263f2[_0x1c2e('0x49')](_0x3edb8a);}})['then'](function(_0x46a296){if(_0x46a296){_0x1871d7=_0x46a296[_0x1c2e('0x32')];if(!_0x54f7b9[_0x1c2e('0x2c')][_0x1c2e('0x33')](_0x1c2e('0x34'))){_0x3edb8a[_0x1c2e('0x1b')]=qs['limit'](_0x54f7b9[_0x1c2e('0x2c')][_0x1c2e('0x1b')]);_0x3edb8a[_0x1c2e('0x18')]=qs[_0x1c2e('0x18')](_0x54f7b9[_0x1c2e('0x2c')]['offset']);}return _0x1263f2[_0x1c2e('0x49')](_0x3edb8a);}})[_0x1c2e('0x21')](function(_0x2be73a){if(_0x2be73a){return _0x2be73a?{'count':_0x1871d7,'rows':_0x2be73a}:null;}})[_0x1c2e('0x21')](respondWithResult(_0x2dad27,null))['catch'](handleError(_0x2dad27,null));}; \ No newline at end of file +var _0x8bc8=['index','map','VtigerConfiguration','rawAttributes','fieldName','key','model','keys','filters','intersection','query','attributes','fields','length','sort','where','pick','filter','type','VIRTUAL','options','includeAll','include','findAll','catch','show','params','merge','create','body','find','destroy','getFields','findOne','VtigerField','order','hasOwnProperty','getSubjects','nolimit','getDescriptions','eml-format','rimraf','zip-dir','fast-json-patch','moment','sox','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','offset','undefined','limit','count','status','set','Content-Range','apply','reject','update','then','error','name','send'];(function(_0x15d474,_0x2e4439){var _0x11f788=function(_0x2d4cb7){while(--_0x2d4cb7){_0x15d474['push'](_0x15d474['shift']());}};_0x11f788(++_0x2e4439);}(_0x8bc8,0xc4));var _0x88bc=function(_0x20beae,_0x5eac6d){_0x20beae=_0x20beae-0x0;var _0xf5725=_0x8bc8[_0x20beae];return _0xf5725;};'use strict';var emlformat=require(_0x88bc('0x0'));var rimraf=require(_0x88bc('0x1'));var zipdir=require(_0x88bc('0x2'));var jsonpatch=require(_0x88bc('0x3'));var rp=require('request-promise');var moment=require(_0x88bc('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x88bc('0x5'));var csv=require('to-csv');var ejs=require(_0x88bc('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x88bc('0x7'));var squel=require(_0x88bc('0x8'));var crypto=require(_0x88bc('0x9'));var jsforce=require(_0x88bc('0xa'));var deskjs=require(_0x88bc('0xb'));var toCsv=require('to-csv');var querystring=require(_0x88bc('0xc'));var Papa=require(_0x88bc('0xd'));var Redis=require('ioredis');var authService=require(_0x88bc('0xe'));var qs=require(_0x88bc('0xf'));var as=require(_0x88bc('0x10'));var hardwareService=require(_0x88bc('0x11'));var logger=require(_0x88bc('0x12'))(_0x88bc('0x13'));var utils=require(_0x88bc('0x14'));var config=require(_0x88bc('0x15'));var licenseUtil=require(_0x88bc('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x27379b,_0x285007){_0x285007=_0x285007||0xcc;return function(_0x21a4c1){if(_0x21a4c1){return _0x27379b[_0x88bc('0x17')](_0x285007);}return _0x27379b['status'](_0x285007)['end']();};}function respondWithResult(_0x56b38b,_0x39da05){_0x39da05=_0x39da05||0xc8;return function(_0xd9defa){if(_0xd9defa){return _0x56b38b['status'](_0x39da05)['json'](_0xd9defa);}};}function respondWithFilteredResult(_0x19cc1d,_0x56e171){return function(_0x472de8){if(_0x472de8){var _0x18aebf=typeof _0x56e171[_0x88bc('0x18')]===_0x88bc('0x19')&&typeof _0x56e171[_0x88bc('0x1a')]===_0x88bc('0x19');var _0x2a76c3=_0x472de8['count'];var _0x1c555f=_0x18aebf?0x0:_0x56e171[_0x88bc('0x18')];var _0xf1d1cb=_0x18aebf?_0x472de8[_0x88bc('0x1b')]:_0x56e171[_0x88bc('0x18')]+_0x56e171[_0x88bc('0x1a')];var _0x20070f;if(_0xf1d1cb>=_0x2a76c3){_0xf1d1cb=_0x2a76c3;_0x20070f=0xc8;}else{_0x20070f=0xce;}_0x19cc1d[_0x88bc('0x1c')](_0x20070f);return _0x19cc1d[_0x88bc('0x1d')](_0x88bc('0x1e'),_0x1c555f+'-'+_0xf1d1cb+'/'+_0x2a76c3)['json'](_0x472de8);}return null;};}function patchUpdates(_0x3e94e5){return function(_0x1bc863){try{jsonpatch[_0x88bc('0x1f')](_0x1bc863,_0x3e94e5,!![]);}catch(_0x4d4aa6){return BPromise[_0x88bc('0x20')](_0x4d4aa6);}return _0x1bc863['save']();};}function saveUpdates(_0x2264a6,_0x1998d1){return function(_0x5695ac){if(_0x5695ac){return _0x5695ac[_0x88bc('0x21')](_0x2264a6)[_0x88bc('0x22')](function(_0x5dc229){return _0x5dc229;});}return null;};}function removeEntity(_0x1be9f3,_0x5fc8d7){return function(_0x538450){if(_0x538450){return _0x538450['destroy']()['then'](function(){_0x1be9f3[_0x88bc('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b2c70,_0x2b944b){return function(_0x3f680b){if(!_0x3f680b){_0x2b2c70['sendStatus'](0x194);}return _0x3f680b;};}function handleError(_0x56fedd,_0x155d43){_0x155d43=_0x155d43||0x1f4;return function(_0x2b2f81){logger[_0x88bc('0x23')](_0x2b2f81['stack']);if(_0x2b2f81[_0x88bc('0x24')]){delete _0x2b2f81[_0x88bc('0x24')];}_0x56fedd['status'](_0x155d43)[_0x88bc('0x25')](_0x2b2f81);};}exports[_0x88bc('0x26')]=function(_0x1e4b63,_0x5b95ed){var _0xd51103={},_0x13cf1c={},_0x192515={'count':0x0,'rows':[]};var _0x4c3e8a=_[_0x88bc('0x27')](db[_0x88bc('0x28')][_0x88bc('0x29')],function(_0x4fd631){return{'name':_0x4fd631[_0x88bc('0x2a')],'type':_0x4fd631['type'][_0x88bc('0x2b')]};});_0x13cf1c[_0x88bc('0x2c')]=_['map'](_0x4c3e8a,'name');_0x13cf1c['query']=_[_0x88bc('0x2d')](_0x1e4b63['query']);_0x13cf1c[_0x88bc('0x2e')]=_[_0x88bc('0x2f')](_0x13cf1c[_0x88bc('0x2c')],_0x13cf1c[_0x88bc('0x30')]);_0xd51103[_0x88bc('0x31')]=_[_0x88bc('0x2f')](_0x13cf1c['model'],qs[_0x88bc('0x32')](_0x1e4b63[_0x88bc('0x30')][_0x88bc('0x32')]));_0xd51103['attributes']=_0xd51103[_0x88bc('0x31')][_0x88bc('0x33')]?_0xd51103['attributes']:_0x13cf1c[_0x88bc('0x2c')];if(!_0x1e4b63['query']['hasOwnProperty']('nolimit')){_0xd51103[_0x88bc('0x1a')]=qs[_0x88bc('0x1a')](_0x1e4b63['query'][_0x88bc('0x1a')]);_0xd51103[_0x88bc('0x18')]=qs[_0x88bc('0x18')](_0x1e4b63['query'][_0x88bc('0x18')]);}_0xd51103['order']=qs[_0x88bc('0x34')](_0x1e4b63[_0x88bc('0x30')][_0x88bc('0x34')]);_0xd51103[_0x88bc('0x35')]=qs[_0x88bc('0x2e')](_[_0x88bc('0x36')](_0x1e4b63[_0x88bc('0x30')],_0x13cf1c['filters']),_0x4c3e8a);if(_0x1e4b63['query'][_0x88bc('0x37')]){_0xd51103[_0x88bc('0x35')]=_['merge'](_0xd51103[_0x88bc('0x35')],{'$or':_['map'](_0x4c3e8a,function(_0x141d96){if(_0x141d96[_0x88bc('0x38')]!==_0x88bc('0x39')){var _0x42695a={};_0x42695a[_0x141d96['name']]={'$like':'%'+_0x1e4b63['query']['filter']+'%'};return _0x42695a;}})});}_0xd51103=_['merge']({},_0xd51103,_0x1e4b63[_0x88bc('0x3a')]);var _0x2083c9={'where':_0xd51103['where']};return db['VtigerConfiguration']['count'](_0x2083c9)[_0x88bc('0x22')](function(_0x17c12d){_0x192515[_0x88bc('0x1b')]=_0x17c12d;if(_0x1e4b63[_0x88bc('0x30')][_0x88bc('0x3b')]){_0xd51103[_0x88bc('0x3c')]=[{'all':!![]}];}return db['VtigerConfiguration'][_0x88bc('0x3d')](_0xd51103);})['then'](function(_0x3e131e){_0x192515['rows']=_0x3e131e;return _0x192515;})[_0x88bc('0x22')](respondWithFilteredResult(_0x5b95ed,_0xd51103))[_0x88bc('0x3e')](handleError(_0x5b95ed,null));};exports[_0x88bc('0x3f')]=function(_0x1d8890,_0x4ce909){var _0x3ca676={'raw':![],'where':{'id':_0x1d8890[_0x88bc('0x40')]['id']}},_0x4daa9b={};_0x4daa9b[_0x88bc('0x2c')]=_[_0x88bc('0x2d')](db['VtigerConfiguration'][_0x88bc('0x29')]);_0x4daa9b['query']=_[_0x88bc('0x2d')](_0x1d8890['query']);_0x4daa9b[_0x88bc('0x2e')]=_[_0x88bc('0x2f')](_0x4daa9b[_0x88bc('0x2c')],_0x4daa9b['query']);_0x3ca676[_0x88bc('0x31')]=_['intersection'](_0x4daa9b['model'],qs[_0x88bc('0x32')](_0x1d8890[_0x88bc('0x30')][_0x88bc('0x32')]));_0x3ca676[_0x88bc('0x31')]=_0x3ca676[_0x88bc('0x31')][_0x88bc('0x33')]?_0x3ca676[_0x88bc('0x31')]:_0x4daa9b[_0x88bc('0x2c')];if(_0x1d8890[_0x88bc('0x30')][_0x88bc('0x3b')]){_0x3ca676[_0x88bc('0x3c')]=[{'all':!![]}];}_0x3ca676=_[_0x88bc('0x41')]({},_0x3ca676,_0x1d8890[_0x88bc('0x3a')]);return db['VtigerConfiguration']['find'](_0x3ca676)['then'](handleEntityNotFound(_0x4ce909,null))[_0x88bc('0x22')](respondWithResult(_0x4ce909,null))[_0x88bc('0x3e')](handleError(_0x4ce909,null));};exports[_0x88bc('0x42')]=function(_0x66efa0,_0x249dfa){return db[_0x88bc('0x28')][_0x88bc('0x42')](_0x66efa0[_0x88bc('0x43')],{})[_0x88bc('0x22')](respondWithResult(_0x249dfa,0xc9))['catch'](handleError(_0x249dfa,null));};exports[_0x88bc('0x21')]=function(_0x278c54,_0x4fb353){if(_0x278c54[_0x88bc('0x43')]['id']){delete _0x278c54[_0x88bc('0x43')]['id'];}return db['VtigerConfiguration'][_0x88bc('0x44')]({'where':{'id':_0x278c54[_0x88bc('0x40')]['id']}})['then'](handleEntityNotFound(_0x4fb353,null))[_0x88bc('0x22')](saveUpdates(_0x278c54[_0x88bc('0x43')],null))[_0x88bc('0x22')](respondWithResult(_0x4fb353,null))[_0x88bc('0x3e')](handleError(_0x4fb353,null));};exports[_0x88bc('0x45')]=function(_0x5dafff,_0x18a6d8){return db[_0x88bc('0x28')][_0x88bc('0x44')]({'where':{'id':_0x5dafff[_0x88bc('0x40')]['id']}})[_0x88bc('0x22')](handleEntityNotFound(_0x18a6d8,null))[_0x88bc('0x22')](removeEntity(_0x18a6d8,null))[_0x88bc('0x3e')](handleError(_0x18a6d8,null));};exports[_0x88bc('0x46')]=function(_0x502173,_0x4ddd13,_0x4be8d5){var _0x599f2e={};var _0x21c83d={};var _0x12fc7e;var _0x4920ca;return db[_0x88bc('0x28')][_0x88bc('0x47')]({'where':{'id':_0x502173['params']['id']}})['then'](handleEntityNotFound(_0x4ddd13,null))[_0x88bc('0x22')](function(_0x29257c){if(_0x29257c){_0x12fc7e=_0x29257c;_0x21c83d[_0x88bc('0x2c')]=_[_0x88bc('0x2d')](db[_0x88bc('0x48')][_0x88bc('0x29')]);_0x21c83d[_0x88bc('0x30')]=_['keys'](_0x502173[_0x88bc('0x30')]);_0x21c83d[_0x88bc('0x2e')]=_['intersection'](_0x21c83d[_0x88bc('0x2c')],_0x21c83d['query']);_0x599f2e[_0x88bc('0x31')]=_[_0x88bc('0x2f')](_0x21c83d[_0x88bc('0x2c')],qs[_0x88bc('0x32')](_0x502173[_0x88bc('0x30')][_0x88bc('0x32')]));_0x599f2e['attributes']=_0x599f2e['attributes'][_0x88bc('0x33')]?_0x599f2e[_0x88bc('0x31')]:_0x21c83d[_0x88bc('0x2c')];_0x599f2e[_0x88bc('0x49')]=qs[_0x88bc('0x34')](_0x502173[_0x88bc('0x30')][_0x88bc('0x34')]);_0x599f2e[_0x88bc('0x35')]=qs[_0x88bc('0x2e')](_[_0x88bc('0x36')](_0x502173[_0x88bc('0x30')],_0x21c83d[_0x88bc('0x2e')]));if(_0x502173[_0x88bc('0x30')][_0x88bc('0x37')]){_0x599f2e[_0x88bc('0x35')]=_[_0x88bc('0x41')](_0x599f2e[_0x88bc('0x35')],{'$or':_['map'](_0x599f2e[_0x88bc('0x31')],function(_0x3477b5){var _0x1c3cdf={};_0x1c3cdf[_0x3477b5]={'$like':'%'+_0x502173[_0x88bc('0x30')][_0x88bc('0x37')]+'%'};return _0x1c3cdf;})});}_0x599f2e=_[_0x88bc('0x41')]({},_0x599f2e,_0x502173[_0x88bc('0x3a')]);return _0x12fc7e[_0x88bc('0x46')](_0x599f2e);}})[_0x88bc('0x22')](function(_0x2ab432){if(_0x2ab432){_0x4920ca=_0x2ab432[_0x88bc('0x33')];if(!_0x502173[_0x88bc('0x30')][_0x88bc('0x4a')]('nolimit')){_0x599f2e[_0x88bc('0x1a')]=qs[_0x88bc('0x1a')](_0x502173[_0x88bc('0x30')][_0x88bc('0x1a')]);_0x599f2e[_0x88bc('0x18')]=qs[_0x88bc('0x18')](_0x502173[_0x88bc('0x30')]['offset']);}return _0x12fc7e[_0x88bc('0x46')](_0x599f2e);}})[_0x88bc('0x22')](function(_0x107c23){if(_0x107c23){return _0x107c23?{'count':_0x4920ca,'rows':_0x107c23}:null;}})[_0x88bc('0x22')](respondWithResult(_0x4ddd13,null))[_0x88bc('0x3e')](handleError(_0x4ddd13,null));};exports[_0x88bc('0x4b')]=function(_0x1a035b,_0x516bb1,_0x5243af){var _0x44dc8e={};var _0x3ba71={};var _0x2a1fe9;var _0x41a5fb;return db[_0x88bc('0x28')][_0x88bc('0x47')]({'where':{'id':_0x1a035b['params']['id']}})['then'](handleEntityNotFound(_0x516bb1,null))[_0x88bc('0x22')](function(_0x17c314){if(_0x17c314){_0x2a1fe9=_0x17c314;_0x3ba71[_0x88bc('0x2c')]=_[_0x88bc('0x2d')](db[_0x88bc('0x48')]['rawAttributes']);_0x3ba71[_0x88bc('0x30')]=_[_0x88bc('0x2d')](_0x1a035b[_0x88bc('0x30')]);_0x3ba71[_0x88bc('0x2e')]=_[_0x88bc('0x2f')](_0x3ba71[_0x88bc('0x2c')],_0x3ba71['query']);_0x44dc8e[_0x88bc('0x31')]=_[_0x88bc('0x2f')](_0x3ba71['model'],qs[_0x88bc('0x32')](_0x1a035b['query'][_0x88bc('0x32')]));_0x44dc8e[_0x88bc('0x31')]=_0x44dc8e[_0x88bc('0x31')][_0x88bc('0x33')]?_0x44dc8e[_0x88bc('0x31')]:_0x3ba71[_0x88bc('0x2c')];_0x44dc8e[_0x88bc('0x49')]=qs[_0x88bc('0x34')](_0x1a035b[_0x88bc('0x30')][_0x88bc('0x34')]);_0x44dc8e[_0x88bc('0x35')]=qs[_0x88bc('0x2e')](_[_0x88bc('0x36')](_0x1a035b[_0x88bc('0x30')],_0x3ba71[_0x88bc('0x2e')]));if(_0x1a035b[_0x88bc('0x30')][_0x88bc('0x37')]){_0x44dc8e[_0x88bc('0x35')]=_['merge'](_0x44dc8e[_0x88bc('0x35')],{'$or':_['map'](_0x44dc8e[_0x88bc('0x31')],function(_0x59f0c4){var _0x32b597={};_0x32b597[_0x59f0c4]={'$like':'%'+_0x1a035b[_0x88bc('0x30')][_0x88bc('0x37')]+'%'};return _0x32b597;})});}_0x44dc8e=_[_0x88bc('0x41')]({},_0x44dc8e,_0x1a035b[_0x88bc('0x3a')]);return _0x2a1fe9['getSubjects'](_0x44dc8e);}})[_0x88bc('0x22')](function(_0x29ab33){if(_0x29ab33){_0x41a5fb=_0x29ab33[_0x88bc('0x33')];if(!_0x1a035b[_0x88bc('0x30')]['hasOwnProperty'](_0x88bc('0x4c'))){_0x44dc8e[_0x88bc('0x1a')]=qs[_0x88bc('0x1a')](_0x1a035b[_0x88bc('0x30')][_0x88bc('0x1a')]);_0x44dc8e[_0x88bc('0x18')]=qs[_0x88bc('0x18')](_0x1a035b['query'][_0x88bc('0x18')]);}return _0x2a1fe9[_0x88bc('0x4b')](_0x44dc8e);}})[_0x88bc('0x22')](function(_0x40b560){if(_0x40b560){return _0x40b560?{'count':_0x41a5fb,'rows':_0x40b560}:null;}})[_0x88bc('0x22')](respondWithResult(_0x516bb1,null))['catch'](handleError(_0x516bb1,null));};exports[_0x88bc('0x4d')]=function(_0x20fa7,_0xd93687,_0x284563){var _0x33c9d6={};var _0x374a71={};var _0x49ccfd;var _0x5c4460;return db['VtigerConfiguration']['findOne']({'where':{'id':_0x20fa7[_0x88bc('0x40')]['id']}})[_0x88bc('0x22')](handleEntityNotFound(_0xd93687,null))[_0x88bc('0x22')](function(_0x372e7f){if(_0x372e7f){_0x49ccfd=_0x372e7f;_0x374a71[_0x88bc('0x2c')]=_[_0x88bc('0x2d')](db[_0x88bc('0x48')]['rawAttributes']);_0x374a71[_0x88bc('0x30')]=_[_0x88bc('0x2d')](_0x20fa7[_0x88bc('0x30')]);_0x374a71[_0x88bc('0x2e')]=_[_0x88bc('0x2f')](_0x374a71[_0x88bc('0x2c')],_0x374a71[_0x88bc('0x30')]);_0x33c9d6[_0x88bc('0x31')]=_[_0x88bc('0x2f')](_0x374a71['model'],qs['fields'](_0x20fa7[_0x88bc('0x30')][_0x88bc('0x32')]));_0x33c9d6[_0x88bc('0x31')]=_0x33c9d6['attributes'][_0x88bc('0x33')]?_0x33c9d6[_0x88bc('0x31')]:_0x374a71[_0x88bc('0x2c')];_0x33c9d6[_0x88bc('0x49')]=qs[_0x88bc('0x34')](_0x20fa7['query'][_0x88bc('0x34')]);_0x33c9d6[_0x88bc('0x35')]=qs[_0x88bc('0x2e')](_[_0x88bc('0x36')](_0x20fa7[_0x88bc('0x30')],_0x374a71[_0x88bc('0x2e')]));if(_0x20fa7['query'][_0x88bc('0x37')]){_0x33c9d6[_0x88bc('0x35')]=_[_0x88bc('0x41')](_0x33c9d6[_0x88bc('0x35')],{'$or':_[_0x88bc('0x27')](_0x33c9d6[_0x88bc('0x31')],function(_0xad6cbb){var _0x3364f7={};_0x3364f7[_0xad6cbb]={'$like':'%'+_0x20fa7[_0x88bc('0x30')]['filter']+'%'};return _0x3364f7;})});}_0x33c9d6=_[_0x88bc('0x41')]({},_0x33c9d6,_0x20fa7[_0x88bc('0x3a')]);return _0x49ccfd[_0x88bc('0x4d')](_0x33c9d6);}})[_0x88bc('0x22')](function(_0x4b0412){if(_0x4b0412){_0x5c4460=_0x4b0412['length'];if(!_0x20fa7[_0x88bc('0x30')][_0x88bc('0x4a')](_0x88bc('0x4c'))){_0x33c9d6[_0x88bc('0x1a')]=qs[_0x88bc('0x1a')](_0x20fa7['query'][_0x88bc('0x1a')]);_0x33c9d6[_0x88bc('0x18')]=qs['offset'](_0x20fa7[_0x88bc('0x30')][_0x88bc('0x18')]);}return _0x49ccfd[_0x88bc('0x4d')](_0x33c9d6);}})['then'](function(_0x318abf){if(_0x318abf){return _0x318abf?{'count':_0x5c4460,'rows':_0x318abf}:null;}})['then'](respondWithResult(_0xd93687,null))['catch'](handleError(_0xd93687,null));}; \ No newline at end of file diff --git a/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js b/server/api/intVtigerConfiguration/intVtigerConfiguration.model.js index 0f53ea9..0b950c7 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 _0xbb26=['api','bluebird','request-promise','path','./intVtigerConfiguration.attributes','define','VtigerConfiguration','int_vtiger_configurations','util','../../config/logger'];(function(_0x18afca,_0x4219d9){var _0x11603f=function(_0x21d5d1){while(--_0x21d5d1){_0x18afca['push'](_0x18afca['shift']());}};_0x11603f(++_0x4219d9);}(_0xbb26,0x76));var _0x6bb2=function(_0x31194,_0x2184c7){_0x31194=_0x31194-0x0;var _0x4ed3d3=_0xbb26[_0x31194];return _0x4ed3d3;};'use strict';var _=require('lodash');var util=require(_0x6bb2('0x0'));var logger=require(_0x6bb2('0x1'))(_0x6bb2('0x2'));var moment=require('moment');var BPromise=require(_0x6bb2('0x3'));var rp=require(_0x6bb2('0x4'));var fs=require('fs');var path=require(_0x6bb2('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x6bb2('0x6'));module['exports']=function(_0x2e520f,_0x98b5d0){return _0x2e520f[_0x6bb2('0x7')](_0x6bb2('0x8'),attributes,{'tableName':_0x6bb2('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xdd6f=['exports','VtigerConfiguration','lodash','../../config/logger','bluebird','request-promise','path','rimraf','../../config/environment','./intVtigerConfiguration.attributes'];(function(_0x301ec2,_0x10fb4a){var _0x59aeec=function(_0x3f4bb7){while(--_0x3f4bb7){_0x301ec2['push'](_0x301ec2['shift']());}};_0x59aeec(++_0x10fb4a);}(_0xdd6f,0xa2));var _0xfdd6=function(_0x1ec3e8,_0x2e99b8){_0x1ec3e8=_0x1ec3e8-0x0;var _0x15651f=_0xdd6f[_0x1ec3e8];return _0x15651f;};'use strict';var _=require(_0xfdd6('0x0'));var util=require('util');var logger=require(_0xfdd6('0x1'))('api');var moment=require('moment');var BPromise=require(_0xfdd6('0x2'));var rp=require(_0xfdd6('0x3'));var fs=require('fs');var path=require(_0xfdd6('0x4'));var rimraf=require(_0xfdd6('0x5'));var config=require(_0xfdd6('0x6'));var attributes=require(_0xfdd6('0x7'));module[_0xfdd6('0x8')]=function(_0x213ef6,_0x5c5467){return _0x213ef6['define'](_0xfdd6('0x9'),attributes,{'tableName':'int_vtiger_configurations','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 fa2e097..763a6df 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 _0xbd9d=['VtigerConfiguration,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info'];(function(_0x1304c6,_0x6bb485){var _0x2e6654=function(_0x2b623c){while(--_0x2b623c){_0x1304c6['push'](_0x1304c6['shift']());}};_0x2e6654(++_0x6bb485);}(_0xbd9d,0x17d));var _0xdbd9=function(_0xe582ec,_0x4aa227){_0xe582ec=_0xe582ec-0x0;var _0x3164fc=_0xbd9d[_0xe582ec];return _0x3164fc;};'use strict';var _=require(_0xdbd9('0x0'));var util=require(_0xdbd9('0x1'));var moment=require(_0xdbd9('0x2'));var BPromise=require(_0xdbd9('0x3'));var rs=require(_0xdbd9('0x4'));var fs=require('fs');var Redis=require(_0xdbd9('0x5'));var db=require(_0xdbd9('0x6'))['db'];var utils=require(_0xdbd9('0x7'));var logger=require(_0xdbd9('0x8'))('rpc');var config=require(_0xdbd9('0x9'));var jayson=require(_0xdbd9('0xa'));var client=jayson[_0xdbd9('0xb')][_0xdbd9('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x39f823,_0x8d72eb,_0x7316ec){return new BPromise(function(_0x492c4e,_0x551d3b){return client['request'](_0x39f823,_0x7316ec)[_0xdbd9('0xd')](function(_0x177207){logger[_0xdbd9('0xe')](_0xdbd9('0xf'),_0x8d72eb,_0xdbd9('0x10'));logger[_0xdbd9('0x11')]('VtigerConfiguration,\x20%s,\x20%s,\x20%s',_0x8d72eb,_0xdbd9('0x10'),JSON['stringify'](_0x177207));if(_0x177207[_0xdbd9('0x12')]){if(_0x177207[_0xdbd9('0x12')][_0xdbd9('0x13')]===0x1f4){logger[_0xdbd9('0x12')](_0xdbd9('0xf'),_0x8d72eb,_0x177207[_0xdbd9('0x12')]['message']);return _0x551d3b(_0x177207[_0xdbd9('0x12')]['message']);}logger[_0xdbd9('0x12')]('VtigerConfiguration,\x20%s,\x20%s',_0x8d72eb,_0x177207[_0xdbd9('0x12')][_0xdbd9('0x14')]);return _0x492c4e(_0x177207['error']['message']);}else{logger[_0xdbd9('0xe')](_0xdbd9('0xf'),_0x8d72eb,_0xdbd9('0x10'));_0x492c4e(_0x177207[_0xdbd9('0x15')][_0xdbd9('0x14')]);}})['catch'](function(_0x5daa9d){logger['error'](_0xdbd9('0xf'),_0x8d72eb,_0x5daa9d);_0x551d3b(_0x5daa9d);});});} \ No newline at end of file +var _0x66f2=['moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','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'];(function(_0x5a95a6,_0x1a78a0){var _0x409a07=function(_0x1eea2b){while(--_0x1eea2b){_0x5a95a6['push'](_0x5a95a6['shift']());}};_0x409a07(++_0x1a78a0);}(_0x66f2,0xf8));var _0x266f=function(_0x1bfc4c,_0x13383e){_0x1bfc4c=_0x1bfc4c-0x0;var _0x141d23=_0x66f2[_0x1bfc4c];return _0x141d23;};'use strict';var _=require(_0x266f('0x0'));var util=require(_0x266f('0x1'));var moment=require(_0x266f('0x2'));var BPromise=require(_0x266f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x266f('0x4'));var db=require(_0x266f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x266f('0x6'))(_0x266f('0x7'));var config=require(_0x266f('0x8'));var jayson=require(_0x266f('0x9'));var client=jayson[_0x266f('0xa')][_0x266f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ee534,_0x1df758,_0x514475){return new BPromise(function(_0x5be734,_0x3910f1){return client[_0x266f('0xc')](_0x4ee534,_0x514475)[_0x266f('0xd')](function(_0x3ddccb){logger[_0x266f('0xe')](_0x266f('0xf'),_0x1df758,_0x266f('0x10'));logger[_0x266f('0x11')](_0x266f('0x12'),_0x1df758,_0x266f('0x10'),JSON[_0x266f('0x13')](_0x3ddccb));if(_0x3ddccb[_0x266f('0x14')]){if(_0x3ddccb[_0x266f('0x14')][_0x266f('0x15')]===0x1f4){logger[_0x266f('0x14')]('VtigerConfiguration,\x20%s,\x20%s',_0x1df758,_0x3ddccb['error']['message']);return _0x3910f1(_0x3ddccb['error']['message']);}logger[_0x266f('0x14')](_0x266f('0xf'),_0x1df758,_0x3ddccb[_0x266f('0x14')]['message']);return _0x5be734(_0x3ddccb['error'][_0x266f('0x16')]);}else{logger['info'](_0x266f('0xf'),_0x1df758,_0x266f('0x10'));_0x5be734(_0x3ddccb[_0x266f('0x17')][_0x266f('0x16')]);}})[_0x266f('0x18')](function(_0x27f3c8){logger[_0x266f('0x14')](_0x266f('0xf'),_0x1df758,_0x27f3c8);_0x3910f1(_0x27f3c8);});});} \ No newline at end of file diff --git a/server/api/intVtigerField/index.js b/server/api/intVtigerField/index.js index e8154e9..5dc6bf3 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 _0x8080=['/:id','post','isAuthenticated','create','put','delete','destroy','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intVtigerField.controller','index','get'];(function(_0x2938ef,_0x26a7c1){var _0x40766b=function(_0x11d1b5){while(--_0x11d1b5){_0x2938ef['push'](_0x2938ef['shift']());}};_0x40766b(++_0x26a7c1);}(_0x8080,0x1db));var _0x0808=function(_0x2dcdce,_0x2a64ef){_0x2dcdce=_0x2dcdce-0x0;var _0x3cba3e=_0x8080[_0x2dcdce];return _0x3cba3e;};'use strict';var multer=require(_0x0808('0x0'));var util=require('util');var path=require(_0x0808('0x1'));var timeout=require('connect-timeout');var express=require(_0x0808('0x2'));var router=express[_0x0808('0x3')]();var fs_extra=require(_0x0808('0x4'));var auth=require(_0x0808('0x5'));var interaction=require(_0x0808('0x6'));var config=require(_0x0808('0x7'));var controller=require(_0x0808('0x8'));router['get']('/',auth['isAuthenticated'](),controller[_0x0808('0x9')]);router[_0x0808('0xa')](_0x0808('0xb'),auth['isAuthenticated'](),controller['show']);router[_0x0808('0xc')]('/',auth[_0x0808('0xd')](),controller[_0x0808('0xe')]);router[_0x0808('0xf')]('/:id',auth[_0x0808('0xd')](),controller['update']);router[_0x0808('0x10')](_0x0808('0xb'),auth[_0x0808('0xd')](),controller[_0x0808('0x11')]);module['exports']=router; \ No newline at end of file +var _0x5dfb=['index','/:id','post','update','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x1c79b1,_0x2224af){var _0x438868=function(_0x5a89cc){while(--_0x5a89cc){_0x1c79b1['push'](_0x1c79b1['shift']());}};_0x438868(++_0x2224af);}(_0x5dfb,0x125));var _0xb5df=function(_0x285b48,_0x41b4c6){_0x285b48=_0x285b48-0x0;var _0x5020e9=_0x5dfb[_0x285b48];return _0x5020e9;};'use strict';var multer=require(_0xb5df('0x0'));var util=require(_0xb5df('0x1'));var path=require(_0xb5df('0x2'));var timeout=require(_0xb5df('0x3'));var express=require(_0xb5df('0x4'));var router=express[_0xb5df('0x5')]();var fs_extra=require(_0xb5df('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xb5df('0x7'));var config=require(_0xb5df('0x8'));var controller=require('./intVtigerField.controller');router[_0xb5df('0x9')]('/',auth[_0xb5df('0xa')](),controller[_0xb5df('0xb')]);router[_0xb5df('0x9')](_0xb5df('0xc'),auth[_0xb5df('0xa')](),controller['show']);router[_0xb5df('0xd')]('/',auth[_0xb5df('0xa')](),controller['create']);router['put']('/:id',auth[_0xb5df('0xa')](),controller[_0xb5df('0xe')]);router['delete']('/:id',auth[_0xb5df('0xa')](),controller['destroy']);module[_0xb5df('0xf')]=router; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.attributes.js b/server/api/intVtigerField/intVtigerField.attributes.js index f845bcb..23b71fe 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 _0xe2ef=['BOOLEAN','ENUM','variable','customVariable','picklist','STRING','string'];(function(_0x599f41,_0x4db732){var _0x2e4d58=function(_0x14c882){while(--_0x14c882){_0x599f41['push'](_0x599f41['shift']());}};_0x2e4d58(++_0x4db732);}(_0xe2ef,0xfd));var _0xfe2e=function(_0x50f77a,_0x469295){_0x50f77a=_0x50f77a-0x0;var _0x4cd957=_0xe2ef[_0x50f77a];return _0x4cd957;};'use strict';var Sequelize=require('sequelize');module['exports']={'type':{'type':Sequelize[_0xfe2e('0x0')]('string',_0xfe2e('0x1'),_0xfe2e('0x2'),'keyValue',_0xfe2e('0x3')),'defaultValue':'string'},'content':{'type':Sequelize[_0xfe2e('0x4')]},'key':{'type':Sequelize[_0xfe2e('0x4')]},'keyType':{'type':Sequelize[_0xfe2e('0x0')](_0xfe2e('0x5'),_0xfe2e('0x1'),'customVariable')},'keyContent':{'type':Sequelize[_0xfe2e('0x4')]},'idField':{'type':Sequelize[_0xfe2e('0x4')]},'nameField':{'type':Sequelize[_0xfe2e('0x4')]},'customField':{'type':Sequelize[_0xfe2e('0x6')],'defaultValue':!![]},'variableName':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x5730=['STRING','BOOLEAN','exports','ENUM','string','variable','customVariable','picklist'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5730,0x112));var _0x0573=function(_0x25fc48,_0x3515e8){_0x25fc48=_0x25fc48-0x0;var _0x47d994=_0x5730[_0x25fc48];return _0x47d994;};'use strict';var Sequelize=require('sequelize');module[_0x0573('0x0')]={'type':{'type':Sequelize[_0x0573('0x1')](_0x0573('0x2'),_0x0573('0x3'),_0x0573('0x4'),'keyValue',_0x0573('0x5')),'defaultValue':'string'},'content':{'type':Sequelize['STRING']},'key':{'type':Sequelize[_0x0573('0x6')]},'keyType':{'type':Sequelize[_0x0573('0x1')]('string',_0x0573('0x3'),_0x0573('0x4'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize[_0x0573('0x6')]},'customField':{'type':Sequelize[_0x0573('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x0573('0x6')]}}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.controller.js b/server/api/intVtigerField/intVtigerField.controller.js index 5c71785..5def4ee 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 _0xe9e1=['destroy','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','VtigerField','findAll','rows','catch','show','params','length','include','find','create','body','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','count','offset','limit','apply','reject','update'];(function(_0x443fed,_0x4df6cf){var _0x551fd6=function(_0x47bc17){while(--_0x47bc17){_0x443fed['push'](_0x443fed['shift']());}};_0x551fd6(++_0x4df6cf);}(_0xe9e1,0x74));var _0x1e9e=function(_0x15ddab,_0x199e86){_0x15ddab=_0x15ddab-0x0;var _0x13979d=_0xe9e1[_0x15ddab];return _0x13979d;};'use strict';var emlformat=require(_0x1e9e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1e9e('0x1'));var jsonpatch=require(_0x1e9e('0x2'));var rp=require(_0x1e9e('0x3'));var moment=require(_0x1e9e('0x4'));var BPromise=require(_0x1e9e('0x5'));var Mustache=require(_0x1e9e('0x6'));var util=require(_0x1e9e('0x7'));var path=require(_0x1e9e('0x8'));var sox=require(_0x1e9e('0x9'));var csv=require(_0x1e9e('0xa'));var ejs=require(_0x1e9e('0xb'));var fs=require('fs');var fs_extra=require(_0x1e9e('0xc'));var _=require(_0x1e9e('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1e9e('0xe'));var deskjs=require(_0x1e9e('0xf'));var toCsv=require(_0x1e9e('0xa'));var querystring=require(_0x1e9e('0x10'));var Papa=require(_0x1e9e('0x11'));var Redis=require(_0x1e9e('0x12'));var authService=require(_0x1e9e('0x13'));var qs=require(_0x1e9e('0x14'));var as=require(_0x1e9e('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x1e9e('0x16'));var config=require(_0x1e9e('0x17'));var licenseUtil=require(_0x1e9e('0x18'));var db=require(_0x1e9e('0x19'))['db'];function respondWithStatusCode(_0x7c0152,_0x318760){_0x318760=_0x318760||0xcc;return function(_0x25ac40){if(_0x25ac40){return _0x7c0152[_0x1e9e('0x1a')](_0x318760);}return _0x7c0152[_0x1e9e('0x1b')](_0x318760)['end']();};}function respondWithResult(_0x28c345,_0x406a42){_0x406a42=_0x406a42||0xc8;return function(_0x3e34d4){if(_0x3e34d4){return _0x28c345[_0x1e9e('0x1b')](_0x406a42)[_0x1e9e('0x1c')](_0x3e34d4);}};}function respondWithFilteredResult(_0x1c9884,_0x26c8e4){return function(_0x2bd5b3){if(_0x2bd5b3){var _0x2b8186=typeof _0x26c8e4['offset']===_0x1e9e('0x1d')&&typeof _0x26c8e4['limit']==='undefined';var _0x19e422=_0x2bd5b3[_0x1e9e('0x1e')];var _0x232b98=_0x2b8186?0x0:_0x26c8e4[_0x1e9e('0x1f')];var _0x52d138=_0x2b8186?_0x2bd5b3['count']:_0x26c8e4[_0x1e9e('0x1f')]+_0x26c8e4[_0x1e9e('0x20')];var _0x4a88b6;if(_0x52d138>=_0x19e422){_0x52d138=_0x19e422;_0x4a88b6=0xc8;}else{_0x4a88b6=0xce;}_0x1c9884['status'](_0x4a88b6);return _0x1c9884['set']('Content-Range',_0x232b98+'-'+_0x52d138+'/'+_0x19e422)[_0x1e9e('0x1c')](_0x2bd5b3);}return null;};}function patchUpdates(_0x1619e1){return function(_0x5c2fda){try{jsonpatch[_0x1e9e('0x21')](_0x5c2fda,_0x1619e1,!![]);}catch(_0x13c453){return BPromise[_0x1e9e('0x22')](_0x13c453);}return _0x5c2fda['save']();};}function saveUpdates(_0x17fdb6,_0x2f7d93){return function(_0x5a3485){if(_0x5a3485){return _0x5a3485[_0x1e9e('0x23')](_0x17fdb6)['then'](function(_0x3d87c1){return _0x3d87c1;});}return null;};}function removeEntity(_0x2b5463,_0xcdc881){return function(_0x5873b0){if(_0x5873b0){return _0x5873b0[_0x1e9e('0x24')]()[_0x1e9e('0x25')](function(){_0x2b5463[_0x1e9e('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5ee799,_0x3a0eb2){return function(_0x41194e){if(!_0x41194e){_0x5ee799['sendStatus'](0x194);}return _0x41194e;};}function handleError(_0x429c16,_0x1f2514){_0x1f2514=_0x1f2514||0x1f4;return function(_0x51ed0a){logger[_0x1e9e('0x26')](_0x51ed0a[_0x1e9e('0x27')]);if(_0x51ed0a[_0x1e9e('0x28')]){delete _0x51ed0a[_0x1e9e('0x28')];}_0x429c16[_0x1e9e('0x1b')](_0x1f2514)[_0x1e9e('0x29')](_0x51ed0a);};}exports[_0x1e9e('0x2a')]=function(_0x2a627b,_0x1205cf){var _0x32961e={},_0x59ed20={},_0x34f6f1={'count':0x0,'rows':[]};var _0x229323=_[_0x1e9e('0x2b')](db['VtigerField'][_0x1e9e('0x2c')],function(_0x260b20){return{'name':_0x260b20[_0x1e9e('0x2d')],'type':_0x260b20[_0x1e9e('0x2e')][_0x1e9e('0x2f')]};});_0x59ed20[_0x1e9e('0x30')]=_['map'](_0x229323,'name');_0x59ed20['query']=_[_0x1e9e('0x31')](_0x2a627b[_0x1e9e('0x32')]);_0x59ed20[_0x1e9e('0x33')]=_[_0x1e9e('0x34')](_0x59ed20[_0x1e9e('0x30')],_0x59ed20['query']);_0x32961e[_0x1e9e('0x35')]=_['intersection'](_0x59ed20['model'],qs['fields'](_0x2a627b[_0x1e9e('0x32')][_0x1e9e('0x36')]));_0x32961e[_0x1e9e('0x35')]=_0x32961e[_0x1e9e('0x35')]['length']?_0x32961e[_0x1e9e('0x35')]:_0x59ed20[_0x1e9e('0x30')];if(!_0x2a627b[_0x1e9e('0x32')]['hasOwnProperty'](_0x1e9e('0x37'))){_0x32961e[_0x1e9e('0x20')]=qs['limit'](_0x2a627b['query']['limit']);_0x32961e[_0x1e9e('0x1f')]=qs[_0x1e9e('0x1f')](_0x2a627b[_0x1e9e('0x32')][_0x1e9e('0x1f')]);}_0x32961e[_0x1e9e('0x38')]=qs['sort'](_0x2a627b['query'][_0x1e9e('0x39')]);_0x32961e[_0x1e9e('0x3a')]=qs[_0x1e9e('0x33')](_[_0x1e9e('0x3b')](_0x2a627b[_0x1e9e('0x32')],_0x59ed20['filters']),_0x229323);if(_0x2a627b[_0x1e9e('0x32')][_0x1e9e('0x3c')]){_0x32961e[_0x1e9e('0x3a')]=_['merge'](_0x32961e[_0x1e9e('0x3a')],{'$or':_['map'](_0x229323,function(_0x8968bf){if(_0x8968bf[_0x1e9e('0x2e')]!==_0x1e9e('0x3d')){var _0x2dcd34={};_0x2dcd34[_0x8968bf['name']]={'$like':'%'+_0x2a627b[_0x1e9e('0x32')][_0x1e9e('0x3c')]+'%'};return _0x2dcd34;}})});}_0x32961e=_[_0x1e9e('0x3e')]({},_0x32961e,_0x2a627b[_0x1e9e('0x3f')]);var _0x3c11e9={'where':_0x32961e['where']};return db['VtigerField'][_0x1e9e('0x1e')](_0x3c11e9)[_0x1e9e('0x25')](function(_0x22918a){_0x34f6f1[_0x1e9e('0x1e')]=_0x22918a;if(_0x2a627b[_0x1e9e('0x32')][_0x1e9e('0x40')]){_0x32961e['include']=[{'all':!![]}];}return db[_0x1e9e('0x41')][_0x1e9e('0x42')](_0x32961e);})[_0x1e9e('0x25')](function(_0x1972fe){_0x34f6f1[_0x1e9e('0x43')]=_0x1972fe;return _0x34f6f1;})['then'](respondWithFilteredResult(_0x1205cf,_0x32961e))[_0x1e9e('0x44')](handleError(_0x1205cf,null));};exports[_0x1e9e('0x45')]=function(_0x3c214e,_0x5d20b1){var _0x5ee812={'raw':!![],'where':{'id':_0x3c214e[_0x1e9e('0x46')]['id']}},_0x1a9d14={};_0x1a9d14[_0x1e9e('0x30')]=_['keys'](db[_0x1e9e('0x41')][_0x1e9e('0x2c')]);_0x1a9d14['query']=_[_0x1e9e('0x31')](_0x3c214e[_0x1e9e('0x32')]);_0x1a9d14[_0x1e9e('0x33')]=_[_0x1e9e('0x34')](_0x1a9d14['model'],_0x1a9d14[_0x1e9e('0x32')]);_0x5ee812[_0x1e9e('0x35')]=_['intersection'](_0x1a9d14[_0x1e9e('0x30')],qs[_0x1e9e('0x36')](_0x3c214e['query']['fields']));_0x5ee812[_0x1e9e('0x35')]=_0x5ee812[_0x1e9e('0x35')][_0x1e9e('0x47')]?_0x5ee812[_0x1e9e('0x35')]:_0x1a9d14[_0x1e9e('0x30')];if(_0x3c214e[_0x1e9e('0x32')]['includeAll']){_0x5ee812[_0x1e9e('0x48')]=[{'all':!![]}];}_0x5ee812=_['merge']({},_0x5ee812,_0x3c214e[_0x1e9e('0x3f')]);return db[_0x1e9e('0x41')][_0x1e9e('0x49')](_0x5ee812)[_0x1e9e('0x25')](handleEntityNotFound(_0x5d20b1,null))['then'](respondWithResult(_0x5d20b1,null))['catch'](handleError(_0x5d20b1,null));};exports[_0x1e9e('0x4a')]=function(_0x4119f9,_0x117dca){return db['VtigerField'][_0x1e9e('0x4a')](_0x4119f9[_0x1e9e('0x4b')],{})[_0x1e9e('0x25')](respondWithResult(_0x117dca,0xc9))[_0x1e9e('0x44')](handleError(_0x117dca,null));};exports[_0x1e9e('0x23')]=function(_0x121be7,_0x102ef8){if(_0x121be7[_0x1e9e('0x4b')]['id']){delete _0x121be7[_0x1e9e('0x4b')]['id'];}return db[_0x1e9e('0x41')][_0x1e9e('0x49')]({'where':{'id':_0x121be7['params']['id']}})[_0x1e9e('0x25')](handleEntityNotFound(_0x102ef8,null))['then'](saveUpdates(_0x121be7['body'],null))[_0x1e9e('0x25')](respondWithResult(_0x102ef8,null))[_0x1e9e('0x44')](handleError(_0x102ef8,null));};exports[_0x1e9e('0x24')]=function(_0x27189b,_0x6ff3db){return db[_0x1e9e('0x41')][_0x1e9e('0x49')]({'where':{'id':_0x27189b[_0x1e9e('0x46')]['id']}})[_0x1e9e('0x25')](handleEntityNotFound(_0x6ff3db,null))[_0x1e9e('0x25')](removeEntity(_0x6ff3db,null))[_0x1e9e('0x44')](handleError(_0x6ff3db,null));}; \ No newline at end of file +var _0xf581=['order','sort','where','pick','filter','merge','VIRTUAL','options','VtigerField','include','findAll','catch','params','intersection','includeAll','create','body','find','eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update','then','destroy','error','stack','name','send','map','rawAttributes','type','key','model','query','keys','filters','attributes','fields','length','hasOwnProperty'];(function(_0xe37a28,_0x64a2d5){var _0x4d3a23=function(_0x10ad4c){while(--_0x10ad4c){_0xe37a28['push'](_0xe37a28['shift']());}};_0x4d3a23(++_0x64a2d5);}(_0xf581,0xf0));var _0x1f58=function(_0x344082,_0x1fa481){_0x344082=_0x344082-0x0;var _0x49d122=_0xf581[_0x344082];return _0x49d122;};'use strict';var emlformat=require(_0x1f58('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f58('0x1'));var jsonpatch=require(_0x1f58('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x1f58('0x3'));var Mustache=require(_0x1f58('0x4'));var util=require(_0x1f58('0x5'));var path=require(_0x1f58('0x6'));var sox=require(_0x1f58('0x7'));var csv=require(_0x1f58('0x8'));var ejs=require(_0x1f58('0x9'));var fs=require('fs');var fs_extra=require(_0x1f58('0xa'));var _=require('lodash');var squel=require(_0x1f58('0xb'));var crypto=require(_0x1f58('0xc'));var jsforce=require(_0x1f58('0xd'));var deskjs=require(_0x1f58('0xe'));var toCsv=require(_0x1f58('0x8'));var querystring=require(_0x1f58('0xf'));var Papa=require(_0x1f58('0x10'));var Redis=require('ioredis');var authService=require(_0x1f58('0x11'));var qs=require(_0x1f58('0x12'));var as=require(_0x1f58('0x13'));var hardwareService=require(_0x1f58('0x14'));var logger=require(_0x1f58('0x15'))('api');var utils=require(_0x1f58('0x16'));var config=require(_0x1f58('0x17'));var licenseUtil=require(_0x1f58('0x18'));var db=require(_0x1f58('0x19'))['db'];function respondWithStatusCode(_0x44323b,_0x147a20){_0x147a20=_0x147a20||0xcc;return function(_0x59d5a8){if(_0x59d5a8){return _0x44323b[_0x1f58('0x1a')](_0x147a20);}return _0x44323b[_0x1f58('0x1b')](_0x147a20)[_0x1f58('0x1c')]();};}function respondWithResult(_0x46e51c,_0x441237){_0x441237=_0x441237||0xc8;return function(_0xa9c5cd){if(_0xa9c5cd){return _0x46e51c[_0x1f58('0x1b')](_0x441237)['json'](_0xa9c5cd);}};}function respondWithFilteredResult(_0x2fd8b3,_0x5d90d9){return function(_0x27fdba){if(_0x27fdba){var _0x5a7b47=typeof _0x5d90d9[_0x1f58('0x1d')]===_0x1f58('0x1e')&&typeof _0x5d90d9[_0x1f58('0x1f')]===_0x1f58('0x1e');var _0x56df5c=_0x27fdba[_0x1f58('0x20')];var _0x59a886=_0x5a7b47?0x0:_0x5d90d9['offset'];var _0x5621f2=_0x5a7b47?_0x27fdba[_0x1f58('0x20')]:_0x5d90d9['offset']+_0x5d90d9[_0x1f58('0x1f')];var _0x12d42c;if(_0x5621f2>=_0x56df5c){_0x5621f2=_0x56df5c;_0x12d42c=0xc8;}else{_0x12d42c=0xce;}_0x2fd8b3[_0x1f58('0x1b')](_0x12d42c);return _0x2fd8b3[_0x1f58('0x21')]('Content-Range',_0x59a886+'-'+_0x5621f2+'/'+_0x56df5c)[_0x1f58('0x22')](_0x27fdba);}return null;};}function patchUpdates(_0x2a4bb4){return function(_0x57be44){try{jsonpatch['apply'](_0x57be44,_0x2a4bb4,!![]);}catch(_0x5a1326){return BPromise[_0x1f58('0x23')](_0x5a1326);}return _0x57be44[_0x1f58('0x24')]();};}function saveUpdates(_0x3efd48,_0x3627f3){return function(_0x369913){if(_0x369913){return _0x369913[_0x1f58('0x25')](_0x3efd48)[_0x1f58('0x26')](function(_0x4ffa22){return _0x4ffa22;});}return null;};}function removeEntity(_0x16491b,_0x21621e){return function(_0x31740f){if(_0x31740f){return _0x31740f[_0x1f58('0x27')]()[_0x1f58('0x26')](function(){_0x16491b[_0x1f58('0x1b')](0xcc)[_0x1f58('0x1c')]();});}};}function handleEntityNotFound(_0x445a4c,_0x2d87ef){return function(_0x4206a5){if(!_0x4206a5){_0x445a4c[_0x1f58('0x1a')](0x194);}return _0x4206a5;};}function handleError(_0x3fecb6,_0x3e0d93){_0x3e0d93=_0x3e0d93||0x1f4;return function(_0x2a99e9){logger[_0x1f58('0x28')](_0x2a99e9[_0x1f58('0x29')]);if(_0x2a99e9['name']){delete _0x2a99e9[_0x1f58('0x2a')];}_0x3fecb6[_0x1f58('0x1b')](_0x3e0d93)[_0x1f58('0x2b')](_0x2a99e9);};}exports['index']=function(_0xafd496,_0x1603e3){var _0x4695cf={},_0xde3d5b={},_0x277d63={'count':0x0,'rows':[]};var _0x3c3bc3=_[_0x1f58('0x2c')](db['VtigerField'][_0x1f58('0x2d')],function(_0x4c76a8){return{'name':_0x4c76a8['fieldName'],'type':_0x4c76a8[_0x1f58('0x2e')][_0x1f58('0x2f')]};});_0xde3d5b[_0x1f58('0x30')]=_[_0x1f58('0x2c')](_0x3c3bc3,_0x1f58('0x2a'));_0xde3d5b[_0x1f58('0x31')]=_[_0x1f58('0x32')](_0xafd496[_0x1f58('0x31')]);_0xde3d5b[_0x1f58('0x33')]=_['intersection'](_0xde3d5b[_0x1f58('0x30')],_0xde3d5b[_0x1f58('0x31')]);_0x4695cf[_0x1f58('0x34')]=_['intersection'](_0xde3d5b['model'],qs[_0x1f58('0x35')](_0xafd496['query'][_0x1f58('0x35')]));_0x4695cf[_0x1f58('0x34')]=_0x4695cf[_0x1f58('0x34')][_0x1f58('0x36')]?_0x4695cf[_0x1f58('0x34')]:_0xde3d5b[_0x1f58('0x30')];if(!_0xafd496[_0x1f58('0x31')][_0x1f58('0x37')]('nolimit')){_0x4695cf[_0x1f58('0x1f')]=qs[_0x1f58('0x1f')](_0xafd496[_0x1f58('0x31')][_0x1f58('0x1f')]);_0x4695cf['offset']=qs[_0x1f58('0x1d')](_0xafd496[_0x1f58('0x31')][_0x1f58('0x1d')]);}_0x4695cf[_0x1f58('0x38')]=qs[_0x1f58('0x39')](_0xafd496[_0x1f58('0x31')]['sort']);_0x4695cf[_0x1f58('0x3a')]=qs['filters'](_[_0x1f58('0x3b')](_0xafd496['query'],_0xde3d5b[_0x1f58('0x33')]),_0x3c3bc3);if(_0xafd496[_0x1f58('0x31')][_0x1f58('0x3c')]){_0x4695cf[_0x1f58('0x3a')]=_[_0x1f58('0x3d')](_0x4695cf[_0x1f58('0x3a')],{'$or':_[_0x1f58('0x2c')](_0x3c3bc3,function(_0x32eba2){if(_0x32eba2[_0x1f58('0x2e')]!==_0x1f58('0x3e')){var _0x22a513={};_0x22a513[_0x32eba2[_0x1f58('0x2a')]]={'$like':'%'+_0xafd496[_0x1f58('0x31')][_0x1f58('0x3c')]+'%'};return _0x22a513;}})});}_0x4695cf=_['merge']({},_0x4695cf,_0xafd496[_0x1f58('0x3f')]);var _0x817d81={'where':_0x4695cf[_0x1f58('0x3a')]};return db[_0x1f58('0x40')]['count'](_0x817d81)['then'](function(_0x40e58d){_0x277d63['count']=_0x40e58d;if(_0xafd496[_0x1f58('0x31')]['includeAll']){_0x4695cf[_0x1f58('0x41')]=[{'all':!![]}];}return db[_0x1f58('0x40')][_0x1f58('0x42')](_0x4695cf);})[_0x1f58('0x26')](function(_0x2c03a5){_0x277d63['rows']=_0x2c03a5;return _0x277d63;})['then'](respondWithFilteredResult(_0x1603e3,_0x4695cf))[_0x1f58('0x43')](handleError(_0x1603e3,null));};exports['show']=function(_0x50be50,_0x584463){var _0x584a4d={'raw':!![],'where':{'id':_0x50be50[_0x1f58('0x44')]['id']}},_0x402276={};_0x402276['model']=_[_0x1f58('0x32')](db[_0x1f58('0x40')]['rawAttributes']);_0x402276[_0x1f58('0x31')]=_[_0x1f58('0x32')](_0x50be50[_0x1f58('0x31')]);_0x402276[_0x1f58('0x33')]=_[_0x1f58('0x45')](_0x402276[_0x1f58('0x30')],_0x402276[_0x1f58('0x31')]);_0x584a4d[_0x1f58('0x34')]=_[_0x1f58('0x45')](_0x402276[_0x1f58('0x30')],qs[_0x1f58('0x35')](_0x50be50[_0x1f58('0x31')][_0x1f58('0x35')]));_0x584a4d[_0x1f58('0x34')]=_0x584a4d[_0x1f58('0x34')][_0x1f58('0x36')]?_0x584a4d['attributes']:_0x402276['model'];if(_0x50be50[_0x1f58('0x31')][_0x1f58('0x46')]){_0x584a4d[_0x1f58('0x41')]=[{'all':!![]}];}_0x584a4d=_[_0x1f58('0x3d')]({},_0x584a4d,_0x50be50[_0x1f58('0x3f')]);return db['VtigerField']['find'](_0x584a4d)[_0x1f58('0x26')](handleEntityNotFound(_0x584463,null))[_0x1f58('0x26')](respondWithResult(_0x584463,null))[_0x1f58('0x43')](handleError(_0x584463,null));};exports[_0x1f58('0x47')]=function(_0x4903b4,_0x5c9fc7){return db[_0x1f58('0x40')][_0x1f58('0x47')](_0x4903b4['body'],{})['then'](respondWithResult(_0x5c9fc7,0xc9))['catch'](handleError(_0x5c9fc7,null));};exports[_0x1f58('0x25')]=function(_0x273c54,_0x5df04c){if(_0x273c54[_0x1f58('0x48')]['id']){delete _0x273c54[_0x1f58('0x48')]['id'];}return db[_0x1f58('0x40')][_0x1f58('0x49')]({'where':{'id':_0x273c54['params']['id']}})[_0x1f58('0x26')](handleEntityNotFound(_0x5df04c,null))[_0x1f58('0x26')](saveUpdates(_0x273c54['body'],null))[_0x1f58('0x26')](respondWithResult(_0x5df04c,null))['catch'](handleError(_0x5df04c,null));};exports[_0x1f58('0x27')]=function(_0x1f2497,_0x688b4b){return db[_0x1f58('0x40')][_0x1f58('0x49')]({'where':{'id':_0x1f2497[_0x1f58('0x44')]['id']}})['then'](handleEntityNotFound(_0x688b4b,null))['then'](removeEntity(_0x688b4b,null))[_0x1f58('0x43')](handleError(_0x688b4b,null));}; \ No newline at end of file diff --git a/server/api/intVtigerField/intVtigerField.model.js b/server/api/intVtigerField/intVtigerField.model.js index 972594d..30980ea 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 _0x67b6=['idField','FieldId','lodash','util','../../config/logger','api','request-promise','path','../../config/environment','./intVtigerField.attributes','exports','VtigerField','int_vtiger_fields'];(function(_0x43c34f,_0x50c335){var _0x3553a4=function(_0xa1e920){while(--_0xa1e920){_0x43c34f['push'](_0x43c34f['shift']());}};_0x3553a4(++_0x50c335);}(_0x67b6,0xdf));var _0x667b=function(_0x25bb67,_0x1c885f){_0x25bb67=_0x25bb67-0x0;var _0x30d77d=_0x67b6[_0x25bb67];return _0x30d77d;};'use strict';var _=require(_0x667b('0x0'));var util=require(_0x667b('0x1'));var logger=require(_0x667b('0x2'))(_0x667b('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x667b('0x4'));var fs=require('fs');var path=require(_0x667b('0x5'));var rimraf=require('rimraf');var config=require(_0x667b('0x6'));var attributes=require(_0x667b('0x7'));module[_0x667b('0x8')]=function(_0x467164,_0x13a81b){return _0x467164['define'](_0x667b('0x9'),attributes,{'tableName':_0x667b('0xa'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':[_0x667b('0xb'),_0x667b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0xae1a=['exports','define','int_vtiger_fields','FieldId','../../config/logger','api','moment','rimraf','../../config/environment','./intVtigerField.attributes'];(function(_0x5e9876,_0x16052d){var _0x576c48=function(_0x338c97){while(--_0x338c97){_0x5e9876['push'](_0x5e9876['shift']());}};_0x576c48(++_0x16052d);}(_0xae1a,0xfe));var _0xaae1=function(_0x53cf8e,_0x3d290f){_0x53cf8e=_0x53cf8e-0x0;var _0x459197=_0xae1a[_0x53cf8e];return _0x459197;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xaae1('0x0'))(_0xaae1('0x1'));var moment=require(_0xaae1('0x2'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xaae1('0x3'));var config=require(_0xaae1('0x4'));var attributes=require(_0xaae1('0x5'));module[_0xaae1('0x6')]=function(_0x9aa9b0,_0x3d6153){return _0x9aa9b0[_0xaae1('0x7')]('VtigerField',attributes,{'tableName':_0xaae1('0x8'),'paranoid':![],'indexes':[{'name':'vtiger_unique_index','fields':['idField',_0xaae1('0x9')],'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 4fde6a6..00f7336 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 _0x96c9=['info','request\x20sent','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','debug','VtigerField,\x20%s,\x20%s,\x20%s','stringify','code','error','VtigerField,\x20%s,\x20%s','message'];(function(_0x32b65a,_0xe2b10b){var _0x3b4335=function(_0x436a48){while(--_0x436a48){_0x32b65a['push'](_0x32b65a['shift']());}};_0x3b4335(++_0xe2b10b);}(_0x96c9,0xc9));var _0x996c=function(_0x4fb472,_0x140440){_0x4fb472=_0x4fb472-0x0;var _0x436005=_0x96c9[_0x4fb472];return _0x436005;};'use strict';var _=require(_0x996c('0x0'));var util=require('util');var moment=require(_0x996c('0x1'));var BPromise=require('bluebird');var rs=require(_0x996c('0x2'));var fs=require('fs');var Redis=require(_0x996c('0x3'));var db=require(_0x996c('0x4'))['db'];var utils=require(_0x996c('0x5'));var logger=require(_0x996c('0x6'))(_0x996c('0x7'));var config=require(_0x996c('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x996c('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x306646,_0x39796b,_0x5926a3){return new BPromise(function(_0x18c2fd,_0x4139b5){return client[_0x996c('0xa')](_0x306646,_0x5926a3)[_0x996c('0xb')](function(_0x3f83ec){logger['info']('VtigerField,\x20%s,\x20%s',_0x39796b,'request\x20sent');logger[_0x996c('0xc')](_0x996c('0xd'),_0x39796b,'request\x20sent',JSON[_0x996c('0xe')](_0x3f83ec));if(_0x3f83ec['error']){if(_0x3f83ec['error'][_0x996c('0xf')]===0x1f4){logger[_0x996c('0x10')](_0x996c('0x11'),_0x39796b,_0x3f83ec[_0x996c('0x10')][_0x996c('0x12')]);return _0x4139b5(_0x3f83ec[_0x996c('0x10')]['message']);}logger['error']('VtigerField,\x20%s,\x20%s',_0x39796b,_0x3f83ec['error']['message']);return _0x18c2fd(_0x3f83ec['error'][_0x996c('0x12')]);}else{logger[_0x996c('0x13')](_0x996c('0x11'),_0x39796b,_0x996c('0x14'));_0x18c2fd(_0x3f83ec[_0x996c('0x15')][_0x996c('0x12')]);}})['catch'](function(_0x2eb3b8){logger[_0x996c('0x10')](_0x996c('0x11'),_0x39796b,_0x2eb3b8);_0x4139b5(_0x2eb3b8);});});} \ No newline at end of file +var _0x3721=['../../config/logger','rpc','client','request','then','info','VtigerField,\x20%s,\x20%s','request\x20sent','VtigerField,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0xb6d00c,_0x1eb395){var _0x374a6f=function(_0x4a050b){while(--_0x4a050b){_0xb6d00c['push'](_0xb6d00c['shift']());}};_0x374a6f(++_0x1eb395);}(_0x3721,0xcb));var _0x1372=function(_0x46d5ee,_0x598cd4){_0x46d5ee=_0x46d5ee-0x0;var _0x1c597c=_0x3721[_0x46d5ee];return _0x1c597c;};'use strict';var _=require(_0x1372('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x1372('0x1'));var rs=require(_0x1372('0x2'));var fs=require('fs');var Redis=require(_0x1372('0x3'));var db=require(_0x1372('0x4'))['db'];var utils=require(_0x1372('0x5'));var logger=require(_0x1372('0x6'))(_0x1372('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x1372('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x64b950,_0x561406,_0x1926bb){return new BPromise(function(_0x453765,_0x9eb7f6){return client[_0x1372('0x9')](_0x64b950,_0x1926bb)[_0x1372('0xa')](function(_0x100535){logger[_0x1372('0xb')](_0x1372('0xc'),_0x561406,_0x1372('0xd'));logger['debug'](_0x1372('0xe'),_0x561406,'request\x20sent',JSON[_0x1372('0xf')](_0x100535));if(_0x100535[_0x1372('0x10')]){if(_0x100535['error']['code']===0x1f4){logger[_0x1372('0x10')](_0x1372('0xc'),_0x561406,_0x100535[_0x1372('0x10')][_0x1372('0x11')]);return _0x9eb7f6(_0x100535[_0x1372('0x10')][_0x1372('0x11')]);}logger['error'](_0x1372('0xc'),_0x561406,_0x100535['error'][_0x1372('0x11')]);return _0x453765(_0x100535['error'][_0x1372('0x11')]);}else{logger['info'](_0x1372('0xc'),_0x561406,_0x1372('0xd'));_0x453765(_0x100535[_0x1372('0x12')]['message']);}})['catch'](function(_0x216d41){logger[_0x1372('0x10')](_0x1372('0xc'),_0x561406,_0x216d41);_0x9eb7f6(_0x216d41);});});} \ No newline at end of file diff --git a/server/api/intZendeskAccount/index.js b/server/api/intZendeskAccount/index.js index e77bd6b..c6c2f61 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 _0x9407=['getFields','create','post','update','delete','exports','multer','util','express','fs-extra','../../config/environment','./intZendeskAccount.controller','get','isAuthenticated','/:id','/:id/configurations','getConfigurations','/:id/fields'];(function(_0xe73080,_0x24c56d){var _0x12cbc4=function(_0x1377e2){while(--_0x1377e2){_0xe73080['push'](_0xe73080['shift']());}};_0x12cbc4(++_0x24c56d);}(_0x9407,0x1ec));var _0x7940=function(_0x2fe1c3,_0x4db089){_0x2fe1c3=_0x2fe1c3-0x0;var _0x2bd97d=_0x9407[_0x2fe1c3];return _0x2bd97d;};'use strict';var multer=require(_0x7940('0x0'));var util=require(_0x7940('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x7940('0x2'));var router=express['Router']();var fs_extra=require(_0x7940('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x7940('0x4'));var controller=require(_0x7940('0x5'));router[_0x7940('0x6')]('/',auth[_0x7940('0x7')](),controller['index']);router[_0x7940('0x6')](_0x7940('0x8'),auth[_0x7940('0x7')](),controller['show']);router[_0x7940('0x6')](_0x7940('0x9'),auth[_0x7940('0x7')](),controller[_0x7940('0xa')]);router[_0x7940('0x6')](_0x7940('0xb'),auth[_0x7940('0x7')](),controller[_0x7940('0xc')]);router['post']('/',auth['isAuthenticated'](),controller[_0x7940('0xd')]);router[_0x7940('0xe')](_0x7940('0x9'),auth[_0x7940('0x7')](),controller['addConfiguration']);router['put'](_0x7940('0x8'),auth[_0x7940('0x7')](),controller[_0x7940('0xf')]);router[_0x7940('0x10')]('/:id',auth[_0x7940('0x7')](),controller['destroy']);module[_0x7940('0x11')]=router; \ No newline at end of file +var _0x1b31=['post','create','addConfiguration','update','delete','destroy','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./intZendeskAccount.controller','get','isAuthenticated','index','/:id','show','/:id/configurations','/:id/fields','getFields'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x1b31,0x7e));var _0x11b3=function(_0x121ebf,_0x2b264f){_0x121ebf=_0x121ebf-0x0;var _0x25c3bd=_0x1b31[_0x121ebf];return _0x25c3bd;};'use strict';var multer=require(_0x11b3('0x0'));var util=require(_0x11b3('0x1'));var path=require(_0x11b3('0x2'));var timeout=require(_0x11b3('0x3'));var express=require(_0x11b3('0x4'));var router=express[_0x11b3('0x5')]();var fs_extra=require(_0x11b3('0x6'));var auth=require(_0x11b3('0x7'));var interaction=require(_0x11b3('0x8'));var config=require('../../config/environment');var controller=require(_0x11b3('0x9'));router[_0x11b3('0xa')]('/',auth[_0x11b3('0xb')](),controller[_0x11b3('0xc')]);router[_0x11b3('0xa')](_0x11b3('0xd'),auth['isAuthenticated'](),controller[_0x11b3('0xe')]);router['get'](_0x11b3('0xf'),auth[_0x11b3('0xb')](),controller['getConfigurations']);router[_0x11b3('0xa')](_0x11b3('0x10'),auth[_0x11b3('0xb')](),controller[_0x11b3('0x11')]);router[_0x11b3('0x12')]('/',auth[_0x11b3('0xb')](),controller[_0x11b3('0x13')]);router[_0x11b3('0x12')](_0x11b3('0xf'),auth['isAuthenticated'](),controller[_0x11b3('0x14')]);router['put'](_0x11b3('0xd'),auth[_0x11b3('0xb')](),controller[_0x11b3('0x15')]);router[_0x11b3('0x16')](_0x11b3('0xd'),auth['isAuthenticated'](),controller[_0x11b3('0x17')]);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 eb40fbd..808f2ec 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 _0x06ae=['username','remoteUri','password','ENUM','integrationTab','newTab','exports','STRING'];(function(_0x4d6ac0,_0x201628){var _0x5296c4=function(_0x3d0b3d){while(--_0x3d0b3d){_0x4d6ac0['push'](_0x4d6ac0['shift']());}};_0x5296c4(++_0x201628);}(_0x06ae,0x16e));var _0xe06a=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x06ae[_0x2dafbe];return _0x58a45a;};'use strict';var Sequelize=require('sequelize');module[_0xe06a('0x0')]={'name':{'type':Sequelize[_0xe06a('0x1')]},'description':{'type':Sequelize[_0xe06a('0x1')]},'username':{'type':Sequelize[_0xe06a('0x1')],'unique':_0xe06a('0x2')},'password':{'type':Sequelize[_0xe06a('0x1')]},'token':{'type':Sequelize[_0xe06a('0x1')]},'remoteUri':{'type':Sequelize[_0xe06a('0x1')],'unique':_0xe06a('0x3')},'authType':{'type':Sequelize['ENUM']('password','token'),'defaultValue':_0xe06a('0x4')},'serverUrl':{'type':Sequelize[_0xe06a('0x1')],'allowNull':![]},'type':{'type':Sequelize[_0xe06a('0x5')](_0xe06a('0x6'),_0xe06a('0x7')),'defaultValue':'integrationTab'}}; \ No newline at end of file +var _0x6691=['username','remoteUri','password','token','integrationTab','sequelize','exports','STRING'];(function(_0x2c0ded,_0x3de22c){var _0x4473e5=function(_0x3705bc){while(--_0x3705bc){_0x2c0ded['push'](_0x2c0ded['shift']());}};_0x4473e5(++_0x3de22c);}(_0x6691,0x12d));var _0x1669=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x6691[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x1669('0x0'));module[_0x1669('0x1')]={'name':{'type':Sequelize[_0x1669('0x2')]},'description':{'type':Sequelize[_0x1669('0x2')]},'username':{'type':Sequelize[_0x1669('0x2')],'unique':_0x1669('0x3')},'password':{'type':Sequelize[_0x1669('0x2')]},'token':{'type':Sequelize[_0x1669('0x2')]},'remoteUri':{'type':Sequelize[_0x1669('0x2')],'unique':_0x1669('0x4')},'authType':{'type':Sequelize['ENUM'](_0x1669('0x5'),_0x1669('0x6')),'defaultValue':_0x1669('0x5')},'serverUrl':{'type':Sequelize[_0x1669('0x2')],'allowNull':![]},'type':{'type':Sequelize['ENUM']('integrationTab','newTab'),'defaultValue':_0x1669('0x7')}}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.controller.js b/server/api/intZendeskAccount/intZendeskAccount.controller.js index 6a6527e..fffd11f 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 _0xee5b=['model','keys','filters','intersection','query','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','filter','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','destroy','getConfigurations','findOne','ZendeskConfiguration','getSubjects','Descriptions','getDescriptions','ZendeskField','Subjects','getFields','username','password','token','authType','remoteUri','slice','lastIndexOf','GET','format','ticket_fields','%s:%s','toString','base64','headers','Basic\x20%s','%s/token:%s','Unknown\x20authentication\x20type','subject','description','group','includes','position','custom_field_options','statusCode','getFields,\x20%s,\x20%s,\x20%s','stringify','test','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/integrations/configuration','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','reject','update','then','error','name','send','index','map','ZendeskAccount','rawAttributes','type'];(function(_0x22d82b,_0xe798c4){var _0x37fea1=function(_0x2049ef){while(--_0x2049ef){_0x22d82b['push'](_0x22d82b['shift']());}};_0x37fea1(++_0xe798c4);}(_0xee5b,0x1f4));var _0xbee5=function(_0x13b32b,_0xe4079c){_0x13b32b=_0x13b32b-0x0;var _0x1e7407=_0xee5b[_0x13b32b];return _0x1e7407;};'use strict';var emlformat=require(_0xbee5('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xbee5('0x1'));var jsonpatch=require(_0xbee5('0x2'));var rp=require('request-promise');var moment=require(_0xbee5('0x3'));var BPromise=require(_0xbee5('0x4'));var Mustache=require(_0xbee5('0x5'));var util=require(_0xbee5('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xbee5('0x7'));var ejs=require(_0xbee5('0x8'));var fs=require('fs');var fs_extra=require(_0xbee5('0x9'));var _=require(_0xbee5('0xa'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xbee5('0xb'));var Papa=require(_0xbee5('0xc'));var Redis=require(_0xbee5('0xd'));var authService=require(_0xbee5('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xbee5('0xf'));var hardwareService=require(_0xbee5('0x10'));var logger=require(_0xbee5('0x11'))(_0xbee5('0x12'));var utils=require(_0xbee5('0x13'));var config=require(_0xbee5('0x14'));var licenseUtil=require(_0xbee5('0x15'));var db=require(_0xbee5('0x16'))['db'];var integrations=require(_0xbee5('0x17'));function respondWithStatusCode(_0x48f771,_0x14e032){_0x14e032=_0x14e032||0xcc;return function(_0x532a78){if(_0x532a78){return _0x48f771[_0xbee5('0x18')](_0x14e032);}return _0x48f771[_0xbee5('0x19')](_0x14e032)[_0xbee5('0x1a')]();};}function respondWithResult(_0x593ecb,_0x5092f2){_0x5092f2=_0x5092f2||0xc8;return function(_0x3c6e56){if(_0x3c6e56){return _0x593ecb['status'](_0x5092f2)[_0xbee5('0x1b')](_0x3c6e56);}};}function respondWithFilteredResult(_0x5426c9,_0x1a24bd){return function(_0x141878){if(_0x141878){var _0xf676b1=typeof _0x1a24bd['offset']===_0xbee5('0x1c')&&typeof _0x1a24bd[_0xbee5('0x1d')]==='undefined';var _0x254dd3=_0x141878[_0xbee5('0x1e')];var _0x11b4a3=_0xf676b1?0x0:_0x1a24bd[_0xbee5('0x1f')];var _0x35eb5c=_0xf676b1?_0x141878[_0xbee5('0x1e')]:_0x1a24bd[_0xbee5('0x1f')]+_0x1a24bd[_0xbee5('0x1d')];var _0x20cf52;if(_0x35eb5c>=_0x254dd3){_0x35eb5c=_0x254dd3;_0x20cf52=0xc8;}else{_0x20cf52=0xce;}_0x5426c9[_0xbee5('0x19')](_0x20cf52);return _0x5426c9[_0xbee5('0x20')](_0xbee5('0x21'),_0x11b4a3+'-'+_0x35eb5c+'/'+_0x254dd3)[_0xbee5('0x1b')](_0x141878);}return null;};}function patchUpdates(_0x40a06){return function(_0x450824){try{jsonpatch['apply'](_0x450824,_0x40a06,!![]);}catch(_0x550325){return BPromise[_0xbee5('0x22')](_0x550325);}return _0x450824['save']();};}function saveUpdates(_0x205491,_0x117cb3){return function(_0x3cee7f){if(_0x3cee7f){return _0x3cee7f[_0xbee5('0x23')](_0x205491)[_0xbee5('0x24')](function(_0xb665df){return _0xb665df;});}return null;};}function removeEntity(_0x359ccf,_0x3cfa8d){return function(_0xc79035){if(_0xc79035){return _0xc79035['destroy']()['then'](function(){_0x359ccf['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x50d774,_0x1af3de){return function(_0x18d7f4){if(!_0x18d7f4){_0x50d774[_0xbee5('0x18')](0x194);}return _0x18d7f4;};}function handleError(_0x28c74d,_0x169042){_0x169042=_0x169042||0x1f4;return function(_0x20e7e8){logger[_0xbee5('0x25')](_0x20e7e8['stack']);if(_0x20e7e8[_0xbee5('0x26')]){delete _0x20e7e8[_0xbee5('0x26')];}_0x28c74d[_0xbee5('0x19')](_0x169042)[_0xbee5('0x27')](_0x20e7e8);};}exports[_0xbee5('0x28')]=function(_0x5f0419,_0x21b993){var _0x15ffb1={},_0xb7a077={},_0x136a00={'count':0x0,'rows':[]};var _0xa57f85=_[_0xbee5('0x29')](db[_0xbee5('0x2a')][_0xbee5('0x2b')],function(_0x2ccb91){return{'name':_0x2ccb91['fieldName'],'type':_0x2ccb91[_0xbee5('0x2c')]['key']};});_0xb7a077[_0xbee5('0x2d')]=_['map'](_0xa57f85,_0xbee5('0x26'));_0xb7a077['query']=_[_0xbee5('0x2e')](_0x5f0419['query']);_0xb7a077[_0xbee5('0x2f')]=_[_0xbee5('0x30')](_0xb7a077[_0xbee5('0x2d')],_0xb7a077[_0xbee5('0x31')]);_0x15ffb1['attributes']=_[_0xbee5('0x30')](_0xb7a077[_0xbee5('0x2d')],qs[_0xbee5('0x32')](_0x5f0419[_0xbee5('0x31')]['fields']));_0x15ffb1[_0xbee5('0x33')]=_0x15ffb1[_0xbee5('0x33')][_0xbee5('0x34')]?_0x15ffb1[_0xbee5('0x33')]:_0xb7a077['model'];if(!_0x5f0419[_0xbee5('0x31')][_0xbee5('0x35')](_0xbee5('0x36'))){_0x15ffb1[_0xbee5('0x1d')]=qs['limit'](_0x5f0419[_0xbee5('0x31')]['limit']);_0x15ffb1[_0xbee5('0x1f')]=qs['offset'](_0x5f0419['query']['offset']);}_0x15ffb1[_0xbee5('0x37')]=qs[_0xbee5('0x38')](_0x5f0419[_0xbee5('0x31')][_0xbee5('0x38')]);_0x15ffb1[_0xbee5('0x39')]=qs[_0xbee5('0x2f')](_[_0xbee5('0x3a')](_0x5f0419[_0xbee5('0x31')],_0xb7a077['filters']),_0xa57f85);if(_0x5f0419[_0xbee5('0x31')]['filter']){_0x15ffb1[_0xbee5('0x39')]=_[_0xbee5('0x3b')](_0x15ffb1[_0xbee5('0x39')],{'$or':_[_0xbee5('0x29')](_0xa57f85,function(_0x4a89ac){if(_0x4a89ac[_0xbee5('0x2c')]!=='VIRTUAL'){var _0x565e9f={};_0x565e9f[_0x4a89ac[_0xbee5('0x26')]]={'$like':'%'+_0x5f0419[_0xbee5('0x31')][_0xbee5('0x3c')]+'%'};return _0x565e9f;}})});}_0x15ffb1=_[_0xbee5('0x3b')]({},_0x15ffb1,_0x5f0419['options']);var _0xf3dd5={'where':_0x15ffb1[_0xbee5('0x39')]};return db[_0xbee5('0x2a')][_0xbee5('0x1e')](_0xf3dd5)[_0xbee5('0x24')](function(_0x25cf17){_0x136a00[_0xbee5('0x1e')]=_0x25cf17;if(_0x5f0419[_0xbee5('0x31')][_0xbee5('0x3d')]){_0x15ffb1[_0xbee5('0x3e')]=[{'all':!![]}];}return db['ZendeskAccount'][_0xbee5('0x3f')](_0x15ffb1);})[_0xbee5('0x24')](function(_0x5637e0){_0x136a00[_0xbee5('0x40')]=_0x5637e0;return _0x136a00;})[_0xbee5('0x24')](respondWithFilteredResult(_0x21b993,_0x15ffb1))[_0xbee5('0x41')](handleError(_0x21b993,null));};exports[_0xbee5('0x42')]=function(_0x4dad75,_0x4cfe54){var _0x4b4641={'raw':![],'where':{'id':_0x4dad75[_0xbee5('0x43')]['id']}},_0x138a40={};_0x138a40[_0xbee5('0x2d')]=_[_0xbee5('0x2e')](db[_0xbee5('0x2a')][_0xbee5('0x2b')]);_0x138a40[_0xbee5('0x31')]=_[_0xbee5('0x2e')](_0x4dad75[_0xbee5('0x31')]);_0x138a40['filters']=_['intersection'](_0x138a40[_0xbee5('0x2d')],_0x138a40['query']);_0x4b4641[_0xbee5('0x33')]=_[_0xbee5('0x30')](_0x138a40['model'],qs[_0xbee5('0x32')](_0x4dad75[_0xbee5('0x31')]['fields']));_0x4b4641['attributes']=_0x4b4641[_0xbee5('0x33')][_0xbee5('0x34')]?_0x4b4641['attributes']:_0x138a40[_0xbee5('0x2d')];if(_0x4dad75[_0xbee5('0x31')]['includeAll']){_0x4b4641[_0xbee5('0x3e')]=[{'all':!![]}];}_0x4b4641=_[_0xbee5('0x3b')]({},_0x4b4641,_0x4dad75[_0xbee5('0x44')]);return db[_0xbee5('0x2a')][_0xbee5('0x45')](_0x4b4641)[_0xbee5('0x24')](handleEntityNotFound(_0x4cfe54,null))[_0xbee5('0x24')](respondWithResult(_0x4cfe54,null))['catch'](handleError(_0x4cfe54,null));};exports[_0xbee5('0x46')]=function(_0x34f01d,_0x27ea7b){return db[_0xbee5('0x2a')]['create'](_0x34f01d[_0xbee5('0x47')],{})[_0xbee5('0x24')](respondWithResult(_0x27ea7b,0xc9))[_0xbee5('0x41')](handleError(_0x27ea7b,null));};exports['update']=function(_0x44d4b1,_0xf637bf){if(_0x44d4b1['body']['id']){delete _0x44d4b1['body']['id'];}return db['ZendeskAccount'][_0xbee5('0x45')]({'where':{'id':_0x44d4b1['params']['id']}})[_0xbee5('0x24')](handleEntityNotFound(_0xf637bf,null))[_0xbee5('0x24')](saveUpdates(_0x44d4b1[_0xbee5('0x47')],null))[_0xbee5('0x24')](respondWithResult(_0xf637bf,null))[_0xbee5('0x41')](handleError(_0xf637bf,null));};exports[_0xbee5('0x48')]=function(_0x55e654,_0x24274d){return db[_0xbee5('0x2a')][_0xbee5('0x45')]({'where':{'id':_0x55e654[_0xbee5('0x43')]['id']}})['then'](handleEntityNotFound(_0x24274d,null))[_0xbee5('0x24')](removeEntity(_0x24274d,null))['catch'](handleError(_0x24274d,null));};exports[_0xbee5('0x49')]=function(_0x45d114,_0xf48059,_0x22c51){var _0x2484c7={};var _0x1b02eb={};var _0xe8902;var _0x35f1d1;return db[_0xbee5('0x2a')][_0xbee5('0x4a')]({'where':{'id':_0x45d114[_0xbee5('0x43')]['id']}})[_0xbee5('0x24')](handleEntityNotFound(_0xf48059,null))[_0xbee5('0x24')](function(_0x359738){if(_0x359738){_0xe8902=_0x359738;_0x1b02eb[_0xbee5('0x2d')]=_['keys'](db[_0xbee5('0x4b')][_0xbee5('0x2b')]);_0x1b02eb[_0xbee5('0x31')]=_['keys'](_0x45d114[_0xbee5('0x31')]);_0x1b02eb[_0xbee5('0x2f')]=_[_0xbee5('0x30')](_0x1b02eb['model'],_0x1b02eb[_0xbee5('0x31')]);_0x2484c7['attributes']=_[_0xbee5('0x30')](_0x1b02eb['model'],qs[_0xbee5('0x32')](_0x45d114[_0xbee5('0x31')][_0xbee5('0x32')]));_0x2484c7['attributes']=_0x2484c7['attributes']['length']?_0x2484c7[_0xbee5('0x33')]:_0x1b02eb[_0xbee5('0x2d')];_0x2484c7[_0xbee5('0x37')]=qs['sort'](_0x45d114[_0xbee5('0x31')]['sort']);_0x2484c7[_0xbee5('0x39')]=qs[_0xbee5('0x2f')](_[_0xbee5('0x3a')](_0x45d114['query'],_0x1b02eb[_0xbee5('0x2f')]));if(_0x45d114[_0xbee5('0x31')][_0xbee5('0x3c')]){_0x2484c7[_0xbee5('0x39')]=_[_0xbee5('0x3b')](_0x2484c7[_0xbee5('0x39')],{'$or':_[_0xbee5('0x29')](_0x2484c7[_0xbee5('0x33')],function(_0x22fc1a){var _0x111027={};_0x111027[_0x22fc1a]={'$like':'%'+_0x45d114[_0xbee5('0x31')][_0xbee5('0x3c')]+'%'};return _0x111027;})});}_0x2484c7=_[_0xbee5('0x3b')]({},_0x2484c7,_0x45d114[_0xbee5('0x44')]);return _0xe8902[_0xbee5('0x49')](_0x2484c7);}})[_0xbee5('0x24')](function(_0x32a8d2){if(_0x32a8d2){_0x35f1d1=_0x32a8d2['length'];if(!_0x45d114[_0xbee5('0x31')]['hasOwnProperty']('nolimit')){_0x2484c7[_0xbee5('0x1d')]=qs[_0xbee5('0x1d')](_0x45d114['query']['limit']);_0x2484c7[_0xbee5('0x1f')]=qs['offset'](_0x45d114[_0xbee5('0x31')][_0xbee5('0x1f')]);}return _0xe8902['getConfigurations'](_0x2484c7);}})[_0xbee5('0x24')](function(_0x1a98c9){if(_0x1a98c9){return _0x1a98c9?{'count':_0x35f1d1,'rows':_0x1a98c9}:null;}})[_0xbee5('0x24')](respondWithResult(_0xf48059,null))[_0xbee5('0x41')](handleError(_0xf48059,null));};exports['addConfiguration']=function(_0x205784,_0x4ad4b5,_0x3294f1){if(_0x205784[_0xbee5('0x47')]['id']){delete _0x205784['body']['id'];}return db[_0xbee5('0x2a')][_0xbee5('0x4a')]({'where':{'id':_0x205784['params']['id']}})[_0xbee5('0x24')](handleEntityNotFound(_0x4ad4b5,null))[_0xbee5('0x24')](function(_0x4f431e){if(_0x4f431e){_0x205784[_0xbee5('0x47')]['AccountId']=_0x4f431e['id'];_0x205784[_0xbee5('0x47')]['Subjects']=integrations[_0xbee5('0x4c')](_0x205784['body']['channel'],_0x205784[_0xbee5('0x47')][_0xbee5('0x2c')]);_0x205784[_0xbee5('0x47')][_0xbee5('0x4d')]=integrations[_0xbee5('0x4e')](_0x205784[_0xbee5('0x47')]['channel'],_0x205784[_0xbee5('0x47')][_0xbee5('0x2c')]);return db[_0xbee5('0x4b')][_0xbee5('0x46')](_0x205784[_0xbee5('0x47')],{'include':[{'model':db[_0xbee5('0x4f')],'as':_0xbee5('0x50')},{'model':db[_0xbee5('0x4f')],'as':_0xbee5('0x4d')}]});}return null;})['then'](respondWithResult(_0x4ad4b5,null))[_0xbee5('0x41')](handleError(_0x4ad4b5,null));};exports[_0xbee5('0x51')]=function(_0x43452f,_0x274a2c,_0x59fe10){var _0x13e84a='';return db[_0xbee5('0x2a')][_0xbee5('0x4a')]({'where':{'id':_0x43452f[_0xbee5('0x43')]['id']},'attributes':['id',_0xbee5('0x52'),_0xbee5('0x53'),_0xbee5('0x54'),_0xbee5('0x55'),_0xbee5('0x56')]})[_0xbee5('0x24')](handleEntityNotFound(_0x274a2c,null))[_0xbee5('0x24')](function(_0x24cd85){if(_0x24cd85){_0x13e84a=_0x24cd85['remoteUri'];var _0x20a9d2=_0x13e84a[_0xbee5('0x57')](-0x1);if(_0x20a9d2==='/'){_0x13e84a=_0x13e84a['substring'](0x0,_0x13e84a[_0xbee5('0x58')](_0x20a9d2));}var _0x56ceeb={'method':_0xbee5('0x59'),'uri':util[_0xbee5('0x5a')]('%s/%s',_0x13e84a,_0xbee5('0x5b')),'json':!![]};switch(_0x24cd85['authType']){case'password':_0x56ceeb['headers']={'Authorization':util['format']('Basic\x20%s',new Buffer(util['format'](_0xbee5('0x5c'),_0x24cd85[_0xbee5('0x52')],_0x24cd85[_0xbee5('0x53')]))[_0xbee5('0x5d')](_0xbee5('0x5e')))};break;case _0xbee5('0x54'):_0x56ceeb[_0xbee5('0x5f')]={'Authorization':util[_0xbee5('0x5a')](_0xbee5('0x60'),new Buffer(util[_0xbee5('0x5a')](_0xbee5('0x61'),_0x24cd85[_0xbee5('0x52')],_0x24cd85['token']))[_0xbee5('0x5d')](_0xbee5('0x5e')))};break;default:throw new db['Sequelize']['ValidationError'](_0xbee5('0x62'));}return rp(_0x56ceeb);}})[_0xbee5('0x24')](function(_0x39cc65){if(_0x39cc65){var _0x5e5cba=[_0xbee5('0x63'),_0xbee5('0x64'),_0xbee5('0x65'),'assignee'];_['remove'](_0x39cc65['ticket_fields'],function(_0x3b0d82){return _0x5e5cba[_0xbee5('0x66')](_0x3b0d82[_0xbee5('0x2c')]);});return{'count':_0x39cc65[_0xbee5('0x5b')][_0xbee5('0x34')],'rows':_[_0xbee5('0x29')](_0x39cc65[_0xbee5('0x5b')],function(_0x435b75){return{'id':_0x435b75['id'],'name':_0x435b75['position']>0x7?_0x435b75['title']:_0x435b75[_0xbee5('0x2c')],'custom':_0x435b75[_0xbee5('0x67')]>0x7?!![]:![],'options':_0x435b75['system_field_options']?_0x435b75['system_field_options']:_0x435b75[_0xbee5('0x68')]?_0x435b75['custom_field_options']:[]};})};}})['then'](respondWithResult(_0x274a2c,null))[_0xbee5('0x41')](function(_0x525472){var _0x2b4ac9=_0x43452f[_0xbee5('0x31')]['test']?0x1f4:_0x525472[_0xbee5('0x69')]||0x1f4;logger[_0xbee5('0x25')](_0xbee5('0x6a'),_0xbee5('0x51'),_0x2b4ac9,JSON[_0xbee5('0x6b')](_0x525472));delete _0x525472['name'];if(_0x2b4ac9===0x191){_0x2b4ac9=0x190;}_0x274a2c['status'](_0x2b4ac9)[_0xbee5('0x27')](_0x43452f['query'][_0xbee5('0x6c')]?{'message':'Wrong\x20credentials','statusCode':_0x525472[_0xbee5('0x69')]}:_0x525472);});}; \ No newline at end of file +var _0x57f8=['fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','catch','show','params','find','create','body','update','getConfigurations','findOne','ZendeskConfiguration','hasOwnProperty','addConfiguration','AccountId','channel','Descriptions','ZendeskField','Subjects','username','password','token','authType','remoteUri','slice','substring','GET','format','%s/%s','ticket_fields','Basic\x20%s','headers','toString','base64','Sequelize','ValidationError','Unknown\x20authentication\x20type','subject','description','includes','title','system_field_options','custom_field_options','test','statusCode','getFields,\x20%s,\x20%s,\x20%s','getFields','stringify','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','then','destroy','end','error','name','send','map','ZendeskAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes'];(function(_0x18b5e8,_0x51e875){var _0x25baed=function(_0x3fcdf9){while(--_0x3fcdf9){_0x18b5e8['push'](_0x18b5e8['shift']());}};_0x25baed(++_0x51e875);}(_0x57f8,0x198));var _0x857f=function(_0x26a515,_0x286339){_0x26a515=_0x26a515-0x0;var _0x314682=_0x57f8[_0x26a515];return _0x314682;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x857f('0x0'));var zipdir=require(_0x857f('0x1'));var jsonpatch=require(_0x857f('0x2'));var rp=require(_0x857f('0x3'));var moment=require(_0x857f('0x4'));var BPromise=require(_0x857f('0x5'));var Mustache=require(_0x857f('0x6'));var util=require(_0x857f('0x7'));var path=require(_0x857f('0x8'));var sox=require(_0x857f('0x9'));var csv=require(_0x857f('0xa'));var ejs=require(_0x857f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x857f('0xc'));var squel=require(_0x857f('0xd'));var crypto=require(_0x857f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x857f('0xf'));var toCsv=require(_0x857f('0xa'));var querystring=require(_0x857f('0x10'));var Papa=require('papaparse');var Redis=require(_0x857f('0x11'));var authService=require(_0x857f('0x12'));var qs=require(_0x857f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x857f('0x14'));var logger=require(_0x857f('0x15'))(_0x857f('0x16'));var utils=require(_0x857f('0x17'));var config=require(_0x857f('0x18'));var licenseUtil=require(_0x857f('0x19'));var db=require(_0x857f('0x1a'))['db'];var integrations=require('../../components/integrations/configuration');function respondWithStatusCode(_0x2e1eda,_0x2d5e26){_0x2d5e26=_0x2d5e26||0xcc;return function(_0x373333){if(_0x373333){return _0x2e1eda[_0x857f('0x1b')](_0x2d5e26);}return _0x2e1eda[_0x857f('0x1c')](_0x2d5e26)['end']();};}function respondWithResult(_0x4bc590,_0x3b09d9){_0x3b09d9=_0x3b09d9||0xc8;return function(_0x5f27b2){if(_0x5f27b2){return _0x4bc590[_0x857f('0x1c')](_0x3b09d9)['json'](_0x5f27b2);}};}function respondWithFilteredResult(_0x1d47bf,_0x134a4f){return function(_0x5c3a69){if(_0x5c3a69){var _0x27e8f1=typeof _0x134a4f[_0x857f('0x1d')]===_0x857f('0x1e')&&typeof _0x134a4f[_0x857f('0x1f')]===_0x857f('0x1e');var _0x38a3c2=_0x5c3a69[_0x857f('0x20')];var _0x429e23=_0x27e8f1?0x0:_0x134a4f[_0x857f('0x1d')];var _0x38a242=_0x27e8f1?_0x5c3a69[_0x857f('0x20')]:_0x134a4f['offset']+_0x134a4f[_0x857f('0x1f')];var _0x1e8fd4;if(_0x38a242>=_0x38a3c2){_0x38a242=_0x38a3c2;_0x1e8fd4=0xc8;}else{_0x1e8fd4=0xce;}_0x1d47bf['status'](_0x1e8fd4);return _0x1d47bf[_0x857f('0x21')](_0x857f('0x22'),_0x429e23+'-'+_0x38a242+'/'+_0x38a3c2)[_0x857f('0x23')](_0x5c3a69);}return null;};}function patchUpdates(_0x484035){return function(_0x57fa8b){try{jsonpatch[_0x857f('0x24')](_0x57fa8b,_0x484035,!![]);}catch(_0x8f278){return BPromise[_0x857f('0x25')](_0x8f278);}return _0x57fa8b['save']();};}function saveUpdates(_0x118237,_0x17a98e){return function(_0xdf8ac3){if(_0xdf8ac3){return _0xdf8ac3['update'](_0x118237)[_0x857f('0x26')](function(_0x14a8ce){return _0x14a8ce;});}return null;};}function removeEntity(_0x50bfb7,_0x3bc543){return function(_0x1a651f){if(_0x1a651f){return _0x1a651f[_0x857f('0x27')]()[_0x857f('0x26')](function(){_0x50bfb7[_0x857f('0x1c')](0xcc)[_0x857f('0x28')]();});}};}function handleEntityNotFound(_0x233a68,_0x2a89ba){return function(_0x181a9e){if(!_0x181a9e){_0x233a68[_0x857f('0x1b')](0x194);}return _0x181a9e;};}function handleError(_0x72f0aa,_0x4782ab){_0x4782ab=_0x4782ab||0x1f4;return function(_0x250731){logger[_0x857f('0x29')](_0x250731['stack']);if(_0x250731[_0x857f('0x2a')]){delete _0x250731[_0x857f('0x2a')];}_0x72f0aa[_0x857f('0x1c')](_0x4782ab)[_0x857f('0x2b')](_0x250731);};}exports['index']=function(_0x40c306,_0x57ceaa){var _0x1b405a={},_0x234048={},_0x45a37f={'count':0x0,'rows':[]};var _0x2ab814=_[_0x857f('0x2c')](db[_0x857f('0x2d')][_0x857f('0x2e')],function(_0xe79241){return{'name':_0xe79241[_0x857f('0x2f')],'type':_0xe79241[_0x857f('0x30')][_0x857f('0x31')]};});_0x234048[_0x857f('0x32')]=_[_0x857f('0x2c')](_0x2ab814,'name');_0x234048[_0x857f('0x33')]=_[_0x857f('0x34')](_0x40c306['query']);_0x234048[_0x857f('0x35')]=_[_0x857f('0x36')](_0x234048['model'],_0x234048[_0x857f('0x33')]);_0x1b405a[_0x857f('0x37')]=_['intersection'](_0x234048[_0x857f('0x32')],qs[_0x857f('0x38')](_0x40c306[_0x857f('0x33')][_0x857f('0x38')]));_0x1b405a['attributes']=_0x1b405a['attributes'][_0x857f('0x39')]?_0x1b405a[_0x857f('0x37')]:_0x234048['model'];if(!_0x40c306[_0x857f('0x33')]['hasOwnProperty'](_0x857f('0x3a'))){_0x1b405a[_0x857f('0x1f')]=qs[_0x857f('0x1f')](_0x40c306[_0x857f('0x33')][_0x857f('0x1f')]);_0x1b405a['offset']=qs['offset'](_0x40c306[_0x857f('0x33')]['offset']);}_0x1b405a[_0x857f('0x3b')]=qs[_0x857f('0x3c')](_0x40c306[_0x857f('0x33')]['sort']);_0x1b405a[_0x857f('0x3d')]=qs[_0x857f('0x35')](_[_0x857f('0x3e')](_0x40c306[_0x857f('0x33')],_0x234048[_0x857f('0x35')]),_0x2ab814);if(_0x40c306[_0x857f('0x33')][_0x857f('0x3f')]){_0x1b405a['where']=_[_0x857f('0x40')](_0x1b405a[_0x857f('0x3d')],{'$or':_[_0x857f('0x2c')](_0x2ab814,function(_0x28ffe4){if(_0x28ffe4[_0x857f('0x30')]!==_0x857f('0x41')){var _0x447f28={};_0x447f28[_0x28ffe4['name']]={'$like':'%'+_0x40c306[_0x857f('0x33')][_0x857f('0x3f')]+'%'};return _0x447f28;}})});}_0x1b405a=_[_0x857f('0x40')]({},_0x1b405a,_0x40c306[_0x857f('0x42')]);var _0x196c95={'where':_0x1b405a[_0x857f('0x3d')]};return db['ZendeskAccount'][_0x857f('0x20')](_0x196c95)[_0x857f('0x26')](function(_0x167e9d){_0x45a37f[_0x857f('0x20')]=_0x167e9d;if(_0x40c306[_0x857f('0x33')][_0x857f('0x43')]){_0x1b405a[_0x857f('0x44')]=[{'all':!![]}];}return db[_0x857f('0x2d')]['findAll'](_0x1b405a);})[_0x857f('0x26')](function(_0x223095){_0x45a37f[_0x857f('0x45')]=_0x223095;return _0x45a37f;})[_0x857f('0x26')](respondWithFilteredResult(_0x57ceaa,_0x1b405a))[_0x857f('0x46')](handleError(_0x57ceaa,null));};exports[_0x857f('0x47')]=function(_0x374b9f,_0x42d922){var _0xb4d7c2={'raw':![],'where':{'id':_0x374b9f[_0x857f('0x48')]['id']}},_0x3e2079={};_0x3e2079[_0x857f('0x32')]=_[_0x857f('0x34')](db[_0x857f('0x2d')]['rawAttributes']);_0x3e2079[_0x857f('0x33')]=_['keys'](_0x374b9f[_0x857f('0x33')]);_0x3e2079[_0x857f('0x35')]=_[_0x857f('0x36')](_0x3e2079[_0x857f('0x32')],_0x3e2079[_0x857f('0x33')]);_0xb4d7c2[_0x857f('0x37')]=_[_0x857f('0x36')](_0x3e2079[_0x857f('0x32')],qs[_0x857f('0x38')](_0x374b9f[_0x857f('0x33')][_0x857f('0x38')]));_0xb4d7c2['attributes']=_0xb4d7c2['attributes'][_0x857f('0x39')]?_0xb4d7c2['attributes']:_0x3e2079[_0x857f('0x32')];if(_0x374b9f['query'][_0x857f('0x43')]){_0xb4d7c2[_0x857f('0x44')]=[{'all':!![]}];}_0xb4d7c2=_[_0x857f('0x40')]({},_0xb4d7c2,_0x374b9f[_0x857f('0x42')]);return db[_0x857f('0x2d')][_0x857f('0x49')](_0xb4d7c2)[_0x857f('0x26')](handleEntityNotFound(_0x42d922,null))[_0x857f('0x26')](respondWithResult(_0x42d922,null))['catch'](handleError(_0x42d922,null));};exports[_0x857f('0x4a')]=function(_0x3b431d,_0x3806d4){return db[_0x857f('0x2d')]['create'](_0x3b431d[_0x857f('0x4b')],{})[_0x857f('0x26')](respondWithResult(_0x3806d4,0xc9))[_0x857f('0x46')](handleError(_0x3806d4,null));};exports[_0x857f('0x4c')]=function(_0x67563,_0x53baae){if(_0x67563[_0x857f('0x4b')]['id']){delete _0x67563[_0x857f('0x4b')]['id'];}return db['ZendeskAccount'][_0x857f('0x49')]({'where':{'id':_0x67563[_0x857f('0x48')]['id']}})['then'](handleEntityNotFound(_0x53baae,null))[_0x857f('0x26')](saveUpdates(_0x67563['body'],null))[_0x857f('0x26')](respondWithResult(_0x53baae,null))[_0x857f('0x46')](handleError(_0x53baae,null));};exports[_0x857f('0x27')]=function(_0x2008d5,_0x58bf27){return db[_0x857f('0x2d')][_0x857f('0x49')]({'where':{'id':_0x2008d5[_0x857f('0x48')]['id']}})[_0x857f('0x26')](handleEntityNotFound(_0x58bf27,null))[_0x857f('0x26')](removeEntity(_0x58bf27,null))['catch'](handleError(_0x58bf27,null));};exports[_0x857f('0x4d')]=function(_0x13ef75,_0x9d8273,_0x2670e6){var _0x3e24a5={};var _0x9edee5={};var _0x12712a;var _0x59164a;return db[_0x857f('0x2d')][_0x857f('0x4e')]({'where':{'id':_0x13ef75[_0x857f('0x48')]['id']}})[_0x857f('0x26')](handleEntityNotFound(_0x9d8273,null))[_0x857f('0x26')](function(_0x153e4e){if(_0x153e4e){_0x12712a=_0x153e4e;_0x9edee5['model']=_[_0x857f('0x34')](db[_0x857f('0x4f')][_0x857f('0x2e')]);_0x9edee5[_0x857f('0x33')]=_[_0x857f('0x34')](_0x13ef75[_0x857f('0x33')]);_0x9edee5[_0x857f('0x35')]=_[_0x857f('0x36')](_0x9edee5['model'],_0x9edee5['query']);_0x3e24a5[_0x857f('0x37')]=_[_0x857f('0x36')](_0x9edee5[_0x857f('0x32')],qs[_0x857f('0x38')](_0x13ef75[_0x857f('0x33')][_0x857f('0x38')]));_0x3e24a5['attributes']=_0x3e24a5[_0x857f('0x37')][_0x857f('0x39')]?_0x3e24a5['attributes']:_0x9edee5[_0x857f('0x32')];_0x3e24a5['order']=qs[_0x857f('0x3c')](_0x13ef75[_0x857f('0x33')]['sort']);_0x3e24a5[_0x857f('0x3d')]=qs[_0x857f('0x35')](_[_0x857f('0x3e')](_0x13ef75[_0x857f('0x33')],_0x9edee5[_0x857f('0x35')]));if(_0x13ef75[_0x857f('0x33')][_0x857f('0x3f')]){_0x3e24a5[_0x857f('0x3d')]=_['merge'](_0x3e24a5[_0x857f('0x3d')],{'$or':_[_0x857f('0x2c')](_0x3e24a5[_0x857f('0x37')],function(_0x7cc7f7){var _0x3c612f={};_0x3c612f[_0x7cc7f7]={'$like':'%'+_0x13ef75[_0x857f('0x33')][_0x857f('0x3f')]+'%'};return _0x3c612f;})});}_0x3e24a5=_[_0x857f('0x40')]({},_0x3e24a5,_0x13ef75[_0x857f('0x42')]);return _0x12712a[_0x857f('0x4d')](_0x3e24a5);}})[_0x857f('0x26')](function(_0x5631fb){if(_0x5631fb){_0x59164a=_0x5631fb[_0x857f('0x39')];if(!_0x13ef75[_0x857f('0x33')][_0x857f('0x50')](_0x857f('0x3a'))){_0x3e24a5['limit']=qs[_0x857f('0x1f')](_0x13ef75['query'][_0x857f('0x1f')]);_0x3e24a5[_0x857f('0x1d')]=qs[_0x857f('0x1d')](_0x13ef75[_0x857f('0x33')]['offset']);}return _0x12712a['getConfigurations'](_0x3e24a5);}})[_0x857f('0x26')](function(_0x3ee981){if(_0x3ee981){return _0x3ee981?{'count':_0x59164a,'rows':_0x3ee981}:null;}})[_0x857f('0x26')](respondWithResult(_0x9d8273,null))['catch'](handleError(_0x9d8273,null));};exports[_0x857f('0x51')]=function(_0x5e42bc,_0x5b505,_0x1d6c1c){if(_0x5e42bc[_0x857f('0x4b')]['id']){delete _0x5e42bc['body']['id'];}return db['ZendeskAccount'][_0x857f('0x4e')]({'where':{'id':_0x5e42bc[_0x857f('0x48')]['id']}})[_0x857f('0x26')](handleEntityNotFound(_0x5b505,null))[_0x857f('0x26')](function(_0x41f9d8){if(_0x41f9d8){_0x5e42bc[_0x857f('0x4b')][_0x857f('0x52')]=_0x41f9d8['id'];_0x5e42bc[_0x857f('0x4b')]['Subjects']=integrations['getSubjects'](_0x5e42bc[_0x857f('0x4b')][_0x857f('0x53')],_0x5e42bc[_0x857f('0x4b')][_0x857f('0x30')]);_0x5e42bc[_0x857f('0x4b')][_0x857f('0x54')]=integrations['getDescriptions'](_0x5e42bc[_0x857f('0x4b')][_0x857f('0x53')],_0x5e42bc[_0x857f('0x4b')][_0x857f('0x30')]);return db[_0x857f('0x4f')][_0x857f('0x4a')](_0x5e42bc[_0x857f('0x4b')],{'include':[{'model':db[_0x857f('0x55')],'as':_0x857f('0x56')},{'model':db[_0x857f('0x55')],'as':'Descriptions'}]});}return null;})[_0x857f('0x26')](respondWithResult(_0x5b505,null))['catch'](handleError(_0x5b505,null));};exports['getFields']=function(_0x35cd3e,_0x48e588,_0x5e5fd9){var _0x2e2cf3='';return db['ZendeskAccount'][_0x857f('0x4e')]({'where':{'id':_0x35cd3e['params']['id']},'attributes':['id',_0x857f('0x57'),_0x857f('0x58'),_0x857f('0x59'),_0x857f('0x5a'),'remoteUri']})[_0x857f('0x26')](handleEntityNotFound(_0x48e588,null))[_0x857f('0x26')](function(_0x3100aa){if(_0x3100aa){_0x2e2cf3=_0x3100aa[_0x857f('0x5b')];var _0x387aaa=_0x2e2cf3[_0x857f('0x5c')](-0x1);if(_0x387aaa==='/'){_0x2e2cf3=_0x2e2cf3[_0x857f('0x5d')](0x0,_0x2e2cf3['lastIndexOf'](_0x387aaa));}var _0x54e75d={'method':_0x857f('0x5e'),'uri':util[_0x857f('0x5f')](_0x857f('0x60'),_0x2e2cf3,_0x857f('0x61')),'json':!![]};switch(_0x3100aa[_0x857f('0x5a')]){case _0x857f('0x58'):_0x54e75d['headers']={'Authorization':util[_0x857f('0x5f')](_0x857f('0x62'),new Buffer(util[_0x857f('0x5f')]('%s:%s',_0x3100aa['username'],_0x3100aa[_0x857f('0x58')]))['toString']('base64'))};break;case _0x857f('0x59'):_0x54e75d[_0x857f('0x63')]={'Authorization':util['format'](_0x857f('0x62'),new Buffer(util[_0x857f('0x5f')]('%s/token:%s',_0x3100aa[_0x857f('0x57')],_0x3100aa[_0x857f('0x59')]))[_0x857f('0x64')](_0x857f('0x65')))};break;default:throw new db[(_0x857f('0x66'))][(_0x857f('0x67'))](_0x857f('0x68'));}return rp(_0x54e75d);}})[_0x857f('0x26')](function(_0x415fd3){if(_0x415fd3){var _0x465857=[_0x857f('0x69'),_0x857f('0x6a'),'group','assignee'];_['remove'](_0x415fd3[_0x857f('0x61')],function(_0x310b18){return _0x465857[_0x857f('0x6b')](_0x310b18[_0x857f('0x30')]);});return{'count':_0x415fd3[_0x857f('0x61')][_0x857f('0x39')],'rows':_[_0x857f('0x2c')](_0x415fd3['ticket_fields'],function(_0x40077e){return{'id':_0x40077e['id'],'name':_0x40077e['position']>0x7?_0x40077e[_0x857f('0x6c')]:_0x40077e['type'],'custom':_0x40077e['position']>0x7?!![]:![],'options':_0x40077e[_0x857f('0x6d')]?_0x40077e['system_field_options']:_0x40077e[_0x857f('0x6e')]?_0x40077e[_0x857f('0x6e')]:[]};})};}})[_0x857f('0x26')](respondWithResult(_0x48e588,null))['catch'](function(_0x45be3d){var _0x19456f=_0x35cd3e[_0x857f('0x33')][_0x857f('0x6f')]?0x1f4:_0x45be3d[_0x857f('0x70')]||0x1f4;logger[_0x857f('0x29')](_0x857f('0x71'),_0x857f('0x72'),_0x19456f,JSON[_0x857f('0x73')](_0x45be3d));delete _0x45be3d['name'];if(_0x19456f===0x191){_0x19456f=0x190;}_0x48e588[_0x857f('0x1c')](_0x19456f)[_0x857f('0x2b')](_0x35cd3e[_0x857f('0x33')][_0x857f('0x6f')]?{'message':'Wrong\x20credentials','statusCode':_0x45be3d[_0x857f('0x70')]}:_0x45be3d);});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.model.js b/server/api/intZendeskAccount/intZendeskAccount.model.js index 183cfdf..32c40cb 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 _0xadbe=['util','../../config/logger','api','bluebird','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','exports','define','ZendeskAccount','int_zendesk_accounts','lodash'];(function(_0x3825a8,_0x2ce1a2){var _0xabc9bc=function(_0x101073){while(--_0x101073){_0x3825a8['push'](_0x3825a8['shift']());}};_0xabc9bc(++_0x2ce1a2);}(_0xadbe,0xcf));var _0xeadb=function(_0xb41148,_0x120d1a){_0xb41148=_0xb41148-0x0;var _0x4e97cd=_0xadbe[_0xb41148];return _0x4e97cd;};'use strict';var _=require(_0xeadb('0x0'));var util=require(_0xeadb('0x1'));var logger=require(_0xeadb('0x2'))(_0xeadb('0x3'));var moment=require('moment');var BPromise=require(_0xeadb('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeadb('0x5'));var rimraf=require('rimraf');var config=require(_0xeadb('0x6'));var attributes=require(_0xeadb('0x7'));var integrations=require(_0xeadb('0x8'));module[_0xeadb('0x9')]=function(_0x454c94,_0x191b3b){return _0x454c94[_0xeadb('0xa')](_0xeadb('0xb'),attributes,{'tableName':_0xeadb('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x456d=['api','moment','path','../../config/environment','./intZendeskAccount.attributes','../../components/integrations/configuration','define','ZendeskAccount','int_zendesk_accounts'];(function(_0x3b231a,_0x53a00d){var _0x18d67a=function(_0x5e14c6){while(--_0x5e14c6){_0x3b231a['push'](_0x3b231a['shift']());}};_0x18d67a(++_0x53a00d);}(_0x456d,0x132));var _0xd456=function(_0x5d3e4e,_0x46ecaf){_0x5d3e4e=_0x5d3e4e-0x0;var _0x538054=_0x456d[_0x5d3e4e];return _0x538054;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xd456('0x0'));var moment=require(_0xd456('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xd456('0x2'));var rimraf=require('rimraf');var config=require(_0xd456('0x3'));var attributes=require(_0xd456('0x4'));var integrations=require(_0xd456('0x5'));module['exports']=function(_0xfa4ca3,_0x4f1f38){return _0xfa4ca3[_0xd456('0x6')](_0xd456('0x7'),attributes,{'tableName':_0xd456('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZendeskAccount/intZendeskAccount.rpc.js b/server/api/intZendeskAccount/intZendeskAccount.rpc.js index 94e3df0..8662dd0 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 _0x0984=['rpc','../../config/environment','jayson/promise','client','request','ZendeskAccount,\x20%s,\x20%s','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','request\x20sent','code','error','message','catch','ZendeskAccount','options','raw','where','attributes','include','model','map','then','info','GetZendeskAccount','ShowZendeskAccount','find','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x0984,0x9f));var _0x4098=function(_0x2b5e15,_0x44227d){_0x2b5e15=_0x2b5e15-0x0;var _0x2f3426=_0x0984[_0x2b5e15];return _0x2f3426;};'use strict';var _=require(_0x4098('0x0'));var util=require(_0x4098('0x1'));var moment=require('moment');var BPromise=require(_0x4098('0x2'));var rs=require(_0x4098('0x3'));var fs=require('fs');var Redis=require(_0x4098('0x4'));var db=require(_0x4098('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4098('0x6'));var config=require(_0x4098('0x7'));var jayson=require(_0x4098('0x8'));var client=jayson[_0x4098('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x43e1a2,_0x12997e,_0x136ab5){return new BPromise(function(_0x549a5e,_0x1258ea){return client[_0x4098('0xa')](_0x43e1a2,_0x136ab5)['then'](function(_0x18fb97){logger['info'](_0x4098('0xb'),_0x12997e,'request\x20sent');logger[_0x4098('0xc')](_0x4098('0xd'),_0x12997e,_0x4098('0xe'),JSON['stringify'](_0x18fb97));if(_0x18fb97['error']){if(_0x18fb97['error'][_0x4098('0xf')]===0x1f4){logger[_0x4098('0x10')](_0x4098('0xb'),_0x12997e,_0x18fb97[_0x4098('0x10')][_0x4098('0x11')]);return _0x1258ea(_0x18fb97[_0x4098('0x10')]['message']);}logger['error'](_0x4098('0xb'),_0x12997e,_0x18fb97['error']['message']);return _0x549a5e(_0x18fb97['error']['message']);}else{logger['info']('ZendeskAccount,\x20%s,\x20%s',_0x12997e,_0x4098('0xe'));_0x549a5e(_0x18fb97['result']['message']);}})[_0x4098('0x12')](function(_0x814b1f){logger[_0x4098('0x10')](_0x4098('0xb'),_0x12997e,_0x814b1f);_0x1258ea(_0x814b1f);});});}exports['GetZendeskAccount']=function(_0x21d9f3){var _0x1e0c09=this;return new Promise(function(_0x480724,_0x533374){return db[_0x4098('0x13')]['findAll']({'raw':_0x21d9f3[_0x4098('0x14')]?_0x21d9f3[_0x4098('0x14')][_0x4098('0x15')]===undefined?!![]:![]:!![],'where':_0x21d9f3['options']?_0x21d9f3['options'][_0x4098('0x16')]||null:null,'attributes':_0x21d9f3[_0x4098('0x14')]?_0x21d9f3[_0x4098('0x14')][_0x4098('0x17')]||null:null,'limit':_0x21d9f3[_0x4098('0x14')]?_0x21d9f3['options']['limit']||null:null,'include':_0x21d9f3['options']?_0x21d9f3[_0x4098('0x14')][_0x4098('0x18')]?_['map'](_0x21d9f3[_0x4098('0x14')][_0x4098('0x18')],function(_0x2706f6){return{'model':db[_0x2706f6[_0x4098('0x19')]],'as':_0x2706f6['as'],'attributes':_0x2706f6[_0x4098('0x17')],'include':_0x2706f6[_0x4098('0x18')]?_['map'](_0x2706f6[_0x4098('0x18')],function(_0x40928a){return{'model':db[_0x40928a[_0x4098('0x19')]],'as':_0x40928a['as'],'attributes':_0x40928a[_0x4098('0x17')],'include':_0x40928a[_0x4098('0x18')]?_[_0x4098('0x1a')](_0x40928a['include'],function(_0x2c5d1b){return{'model':db[_0x2c5d1b[_0x4098('0x19')]],'as':_0x2c5d1b['as'],'attributes':_0x2c5d1b[_0x4098('0x17')]};}):[]};}):[]};}):[]:[]})[_0x4098('0x1b')](function(_0x2402f3){logger[_0x4098('0x1c')](_0x4098('0x1d'),_0x21d9f3);logger['debug'](_0x4098('0x1d'),_0x21d9f3,JSON['stringify'](_0x2402f3));_0x480724(_0x2402f3);})[_0x4098('0x12')](function(_0x5ce419){logger['error'](_0x4098('0x1d'),_0x5ce419[_0x4098('0x11')],_0x21d9f3);_0x533374(_0x1e0c09[_0x4098('0x10')](0x1f4,_0x5ce419[_0x4098('0x11')]));});});};exports[_0x4098('0x1e')]=function(_0x33b241){var _0x209253=this;return new Promise(function(_0xd7760f,_0x176042){return db['ZendeskAccount'][_0x4098('0x1f')]({'raw':_0x33b241[_0x4098('0x14')]?_0x33b241['options'][_0x4098('0x15')]===undefined?!![]:![]:!![],'where':_0x33b241[_0x4098('0x14')]?_0x33b241[_0x4098('0x14')]['where']||null:null,'attributes':_0x33b241[_0x4098('0x14')]?_0x33b241[_0x4098('0x14')][_0x4098('0x17')]||null:null,'include':_0x33b241[_0x4098('0x14')]?_0x33b241[_0x4098('0x14')]['include']?_[_0x4098('0x1a')](_0x33b241[_0x4098('0x14')]['include'],function(_0x73d0a3){return{'model':db[_0x73d0a3[_0x4098('0x19')]],'as':_0x73d0a3['as'],'attributes':_0x73d0a3[_0x4098('0x17')],'include':_0x73d0a3[_0x4098('0x18')]?_[_0x4098('0x1a')](_0x73d0a3['include'],function(_0xa7f4f0){return{'model':db[_0xa7f4f0[_0x4098('0x19')]],'as':_0xa7f4f0['as'],'attributes':_0xa7f4f0[_0x4098('0x17')],'include':_0xa7f4f0[_0x4098('0x18')]?_[_0x4098('0x1a')](_0xa7f4f0[_0x4098('0x18')],function(_0x1668e4){return{'model':db[_0x1668e4['model']],'as':_0x1668e4['as'],'attributes':_0x1668e4[_0x4098('0x17')]};}):[]};}):[]};}):[]:[]})['then'](function(_0xc4228a){logger[_0x4098('0x1c')](_0x4098('0x1e'),_0x33b241);logger[_0x4098('0xc')](_0x4098('0x1e'),_0x33b241,JSON[_0x4098('0x20')](_0xc4228a));_0xd7760f(_0xc4228a);})['catch'](function(_0xcb7432){logger[_0x4098('0x10')](_0x4098('0x1e'),_0xcb7432['message'],_0x33b241);_0x176042(_0x209253[_0x4098('0x10')](0x1f4,_0xcb7432[_0x4098('0x11')]));});});}; \ No newline at end of file +var _0xc114=['raw','where','attributes','include','map','GetZendeskAccount','ShowZendeskAccount','find','model','stringify','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','then','info','ZendeskAccount,\x20%s,\x20%s','request\x20sent','debug','ZendeskAccount,\x20%s,\x20%s,\x20%s','error','message','result','findAll','options'];(function(_0x428dca,_0x4223cb){var _0x372276=function(_0x1f27d1){while(--_0x1f27d1){_0x428dca['push'](_0x428dca['shift']());}};_0x372276(++_0x4223cb);}(_0xc114,0x1e7));var _0x4c11=function(_0x5591ef,_0x4d278f){_0x5591ef=_0x5591ef-0x0;var _0x3ab414=_0xc114[_0x5591ef];return _0x3ab414;};'use strict';var _=require('lodash');var util=require(_0x4c11('0x0'));var moment=require(_0x4c11('0x1'));var BPromise=require(_0x4c11('0x2'));var rs=require(_0x4c11('0x3'));var fs=require('fs');var Redis=require(_0x4c11('0x4'));var db=require(_0x4c11('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4e5d2a,_0x195acb,_0x34ca25){return new BPromise(function(_0x38fe27,_0x574c16){return client['request'](_0x4e5d2a,_0x34ca25)[_0x4c11('0x6')](function(_0x37a733){logger[_0x4c11('0x7')](_0x4c11('0x8'),_0x195acb,_0x4c11('0x9'));logger[_0x4c11('0xa')](_0x4c11('0xb'),_0x195acb,_0x4c11('0x9'),JSON['stringify'](_0x37a733));if(_0x37a733[_0x4c11('0xc')]){if(_0x37a733['error']['code']===0x1f4){logger[_0x4c11('0xc')](_0x4c11('0x8'),_0x195acb,_0x37a733['error']['message']);return _0x574c16(_0x37a733[_0x4c11('0xc')][_0x4c11('0xd')]);}logger[_0x4c11('0xc')]('ZendeskAccount,\x20%s,\x20%s',_0x195acb,_0x37a733[_0x4c11('0xc')][_0x4c11('0xd')]);return _0x38fe27(_0x37a733[_0x4c11('0xc')][_0x4c11('0xd')]);}else{logger[_0x4c11('0x7')](_0x4c11('0x8'),_0x195acb,'request\x20sent');_0x38fe27(_0x37a733[_0x4c11('0xe')][_0x4c11('0xd')]);}})['catch'](function(_0x399e58){logger['error'](_0x4c11('0x8'),_0x195acb,_0x399e58);_0x574c16(_0x399e58);});});}exports['GetZendeskAccount']=function(_0x3e85a0){var _0x575f0d=this;return new Promise(function(_0x335e86,_0x232032){return db['ZendeskAccount'][_0x4c11('0xf')]({'raw':_0x3e85a0[_0x4c11('0x10')]?_0x3e85a0[_0x4c11('0x10')][_0x4c11('0x11')]===undefined?!![]:![]:!![],'where':_0x3e85a0[_0x4c11('0x10')]?_0x3e85a0['options'][_0x4c11('0x12')]||null:null,'attributes':_0x3e85a0[_0x4c11('0x10')]?_0x3e85a0[_0x4c11('0x10')][_0x4c11('0x13')]||null:null,'limit':_0x3e85a0[_0x4c11('0x10')]?_0x3e85a0['options']['limit']||null:null,'include':_0x3e85a0[_0x4c11('0x10')]?_0x3e85a0['options'][_0x4c11('0x14')]?_[_0x4c11('0x15')](_0x3e85a0[_0x4c11('0x10')][_0x4c11('0x14')],function(_0x21a06d){return{'model':db[_0x21a06d['model']],'as':_0x21a06d['as'],'attributes':_0x21a06d[_0x4c11('0x13')],'include':_0x21a06d[_0x4c11('0x14')]?_[_0x4c11('0x15')](_0x21a06d[_0x4c11('0x14')],function(_0x1e819f){return{'model':db[_0x1e819f['model']],'as':_0x1e819f['as'],'attributes':_0x1e819f[_0x4c11('0x13')],'include':_0x1e819f[_0x4c11('0x14')]?_['map'](_0x1e819f[_0x4c11('0x14')],function(_0x440279){return{'model':db[_0x440279['model']],'as':_0x440279['as'],'attributes':_0x440279['attributes']};}):[]};}):[]};}):[]:[]})[_0x4c11('0x6')](function(_0x22f2a9){logger['info'](_0x4c11('0x16'),_0x3e85a0);logger[_0x4c11('0xa')](_0x4c11('0x16'),_0x3e85a0,JSON['stringify'](_0x22f2a9));_0x335e86(_0x22f2a9);})['catch'](function(_0x345a82){logger['error'](_0x4c11('0x16'),_0x345a82[_0x4c11('0xd')],_0x3e85a0);_0x232032(_0x575f0d[_0x4c11('0xc')](0x1f4,_0x345a82[_0x4c11('0xd')]));});});};exports[_0x4c11('0x17')]=function(_0xdb5bb3){var _0x475e99=this;return new Promise(function(_0x2f5ee3,_0x4a50c0){return db['ZendeskAccount'][_0x4c11('0x18')]({'raw':_0xdb5bb3['options']?_0xdb5bb3[_0x4c11('0x10')][_0x4c11('0x11')]===undefined?!![]:![]:!![],'where':_0xdb5bb3[_0x4c11('0x10')]?_0xdb5bb3[_0x4c11('0x10')][_0x4c11('0x12')]||null:null,'attributes':_0xdb5bb3['options']?_0xdb5bb3['options']['attributes']||null:null,'include':_0xdb5bb3['options']?_0xdb5bb3['options']['include']?_[_0x4c11('0x15')](_0xdb5bb3[_0x4c11('0x10')]['include'],function(_0x1c0c28){return{'model':db[_0x1c0c28[_0x4c11('0x19')]],'as':_0x1c0c28['as'],'attributes':_0x1c0c28['attributes'],'include':_0x1c0c28[_0x4c11('0x14')]?_['map'](_0x1c0c28[_0x4c11('0x14')],function(_0x4f3a3a){return{'model':db[_0x4f3a3a[_0x4c11('0x19')]],'as':_0x4f3a3a['as'],'attributes':_0x4f3a3a[_0x4c11('0x13')],'include':_0x4f3a3a['include']?_[_0x4c11('0x15')](_0x4f3a3a[_0x4c11('0x14')],function(_0x3c65da){return{'model':db[_0x3c65da[_0x4c11('0x19')]],'as':_0x3c65da['as'],'attributes':_0x3c65da[_0x4c11('0x13')]};}):[]};}):[]};}):[]:[]})[_0x4c11('0x6')](function(_0x549782){logger['info'](_0x4c11('0x17'),_0xdb5bb3);logger[_0x4c11('0xa')](_0x4c11('0x17'),_0xdb5bb3,JSON[_0x4c11('0x1a')](_0x549782));_0x2f5ee3(_0x549782);})[_0x4c11('0x1b')](function(_0x2501cc){logger[_0x4c11('0xc')]('ShowZendeskAccount',_0x2501cc[_0x4c11('0xd')],_0xdb5bb3);_0x4a50c0(_0x475e99[_0x4c11('0xc')](0x1f4,_0x2501cc[_0x4c11('0xd')]));});});}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/index.js b/server/api/intZendeskConfiguration/index.js index 6a6a0c1..3291c39 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 _0x087b=['getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','/:id/tags','setTags','put','update','delete','destroy','multer','util','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZendeskConfiguration.controller','get','isAuthenticated','index','/:id','show','/:id/fields','getFields'];(function(_0x4b757a,_0x37191f){var _0x5a504e=function(_0xc9cb4d){while(--_0xc9cb4d){_0x4b757a['push'](_0x4b757a['shift']());}};_0x5a504e(++_0x37191f);}(_0x087b,0x11a));var _0xb087=function(_0x45d3f0,_0x4be53f){_0x45d3f0=_0x45d3f0-0x0;var _0x314b79=_0x087b[_0x45d3f0];return _0x314b79;};'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'));var controller=require(_0xb087('0x7'));router[_0xb087('0x8')]('/',auth[_0xb087('0x9')](),controller[_0xb087('0xa')]);router[_0xb087('0x8')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0xc')]);router[_0xb087('0x8')](_0xb087('0xd'),auth[_0xb087('0x9')](),controller[_0xb087('0xe')]);router[_0xb087('0x8')]('/:id/subjects',auth[_0xb087('0x9')](),controller[_0xb087('0xf')]);router[_0xb087('0x8')](_0xb087('0x10'),auth[_0xb087('0x9')](),controller[_0xb087('0x11')]);router[_0xb087('0x8')]('/:id/tags',auth[_0xb087('0x9')](),controller[_0xb087('0x12')]);router[_0xb087('0x13')]('/',auth['isAuthenticated'](),controller[_0xb087('0x14')]);router[_0xb087('0x13')](_0xb087('0x15'),auth[_0xb087('0x9')](),controller[_0xb087('0x16')]);router[_0xb087('0x17')](_0xb087('0xb'),auth[_0xb087('0x9')](),controller[_0xb087('0x18')]);router[_0xb087('0x19')]('/:id',auth[_0xb087('0x9')](),controller[_0xb087('0x1a')]);module['exports']=router; \ No newline at end of file +var _0xa571=['util','path','connect-timeout','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','getDescriptions','getTags','post','create','put','update','exports','multer'];(function(_0x17c5a8,_0x169880){var _0x4036f0=function(_0x1a0573){while(--_0x1a0573){_0x17c5a8['push'](_0x17c5a8['shift']());}};_0x4036f0(++_0x169880);}(_0xa571,0x107));var _0x1a57=function(_0x546bbf,_0x26f2a2){_0x546bbf=_0x546bbf-0x0;var _0x40e3ca=_0xa571[_0x546bbf];return _0x40e3ca;};'use strict';var multer=require(_0x1a57('0x0'));var util=require(_0x1a57('0x1'));var path=require(_0x1a57('0x2'));var timeout=require(_0x1a57('0x3'));var express=require('express');var router=express[_0x1a57('0x4')]();var fs_extra=require(_0x1a57('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1a57('0x6'));var controller=require('./intZendeskConfiguration.controller');router[_0x1a57('0x7')]('/',auth[_0x1a57('0x8')](),controller[_0x1a57('0x9')]);router[_0x1a57('0x7')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller['show']);router[_0x1a57('0x7')](_0x1a57('0xb'),auth[_0x1a57('0x8')](),controller['getFields']);router[_0x1a57('0x7')](_0x1a57('0xc'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xd')]);router[_0x1a57('0x7')](_0x1a57('0xe'),auth[_0x1a57('0x8')](),controller[_0x1a57('0xf')]);router['get']('/:id/tags',auth[_0x1a57('0x8')](),controller[_0x1a57('0x10')]);router[_0x1a57('0x11')]('/',auth['isAuthenticated'](),controller[_0x1a57('0x12')]);router[_0x1a57('0x11')]('/:id/tags',auth[_0x1a57('0x8')](),controller['setTags']);router[_0x1a57('0x13')](_0x1a57('0xa'),auth[_0x1a57('0x8')](),controller[_0x1a57('0x14')]);router['delete'](_0x1a57('0xa'),auth['isAuthenticated'](),controller['destroy']);module[_0x1a57('0x15')]=router; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.attributes.js index 4b83af0..eb00eaa 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 _0x31c5=['sequelize','STRING'];(function(_0x7c5ec6,_0x592184){var _0x27467d=function(_0x26d8f3){while(--_0x26d8f3){_0x7c5ec6['push'](_0x7c5ec6['shift']());}};_0x27467d(++_0x592184);}(_0x31c5,0xb2));var _0x531c=function(_0x3396d8,_0x51145f){_0x3396d8=_0x3396d8-0x0;var _0x5c14f7=_0x31c5[_0x3396d8];return _0x5c14f7;};'use strict';var Sequelize=require(_0x531c('0x0'));module['exports']={'name':{'type':Sequelize[_0x531c('0x1')]},'description':{'type':Sequelize[_0x531c('0x1')]}}; \ No newline at end of file +var _0x8f25=['exports','STRING','sequelize'];(function(_0x25bc13,_0x577081){var _0x146e0f=function(_0x54c2cc){while(--_0x54c2cc){_0x25bc13['push'](_0x25bc13['shift']());}};_0x146e0f(++_0x577081);}(_0x8f25,0x14f));var _0x58f2=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x8f25[_0x5b561d];return _0x431060;};'use strict';var Sequelize=require(_0x58f2('0x0'));module[_0x58f2('0x1')]={'name':{'type':Sequelize[_0x58f2('0x2')]},'description':{'type':Sequelize[_0x58f2('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.controller.js index 7623161..5a9fe35 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 _0xfaef=['request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','update','destroy','then','name','send','map','ZendeskConfiguration','rawAttributes','type','key','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','rows','catch','show','create','body','find','params','getFields','ZendeskField','length','getSubjects','findOne','getDescriptions','Tag','setTags','ids','eml-format','rimraf','zip-dir'];(function(_0x25df80,_0xa2aec5){var _0x17b6d0=function(_0x446155){while(--_0x446155){_0x25df80['push'](_0x25df80['shift']());}};_0x17b6d0(++_0xa2aec5);}(_0xfaef,0xe4));var _0xffae=function(_0x314329,_0x1f7d08){_0x314329=_0x314329-0x0;var _0x370e08=_0xfaef[_0x314329];return _0x370e08;};'use strict';var emlformat=require(_0xffae('0x0'));var rimraf=require(_0xffae('0x1'));var zipdir=require(_0xffae('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xffae('0x3'));var moment=require('moment');var BPromise=require(_0xffae('0x4'));var Mustache=require(_0xffae('0x5'));var util=require(_0xffae('0x6'));var path=require(_0xffae('0x7'));var sox=require(_0xffae('0x8'));var csv=require(_0xffae('0x9'));var ejs=require(_0xffae('0xa'));var fs=require('fs');var fs_extra=require(_0xffae('0xb'));var _=require(_0xffae('0xc'));var squel=require('squel');var crypto=require(_0xffae('0xd'));var jsforce=require(_0xffae('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xffae('0x9'));var querystring=require(_0xffae('0xf'));var Papa=require('papaparse');var Redis=require(_0xffae('0x10'));var authService=require(_0xffae('0x11'));var qs=require(_0xffae('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xffae('0x13'));var logger=require(_0xffae('0x14'))(_0xffae('0x15'));var utils=require('../../config/utils');var config=require(_0xffae('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x142024,_0x5470e3){_0x5470e3=_0x5470e3||0xcc;return function(_0x12cb31){if(_0x12cb31){return _0x142024[_0xffae('0x17')](_0x5470e3);}return _0x142024[_0xffae('0x18')](_0x5470e3)[_0xffae('0x19')]();};}function respondWithResult(_0x593225,_0x5616f1){_0x5616f1=_0x5616f1||0xc8;return function(_0x3fc6f4){if(_0x3fc6f4){return _0x593225['status'](_0x5616f1)[_0xffae('0x1a')](_0x3fc6f4);}};}function respondWithFilteredResult(_0x20432d,_0x402733){return function(_0x448863){if(_0x448863){var _0xa333db=typeof _0x402733[_0xffae('0x1b')]===_0xffae('0x1c')&&typeof _0x402733[_0xffae('0x1d')]==='undefined';var _0x35c7db=_0x448863[_0xffae('0x1e')];var _0x368da7=_0xa333db?0x0:_0x402733[_0xffae('0x1b')];var _0x45f336=_0xa333db?_0x448863[_0xffae('0x1e')]:_0x402733['offset']+_0x402733[_0xffae('0x1d')];var _0x565ce2;if(_0x45f336>=_0x35c7db){_0x45f336=_0x35c7db;_0x565ce2=0xc8;}else{_0x565ce2=0xce;}_0x20432d[_0xffae('0x18')](_0x565ce2);return _0x20432d[_0xffae('0x1f')]('Content-Range',_0x368da7+'-'+_0x45f336+'/'+_0x35c7db)['json'](_0x448863);}return null;};}function patchUpdates(_0x292080){return function(_0x3ae187){try{jsonpatch['apply'](_0x3ae187,_0x292080,!![]);}catch(_0x50a999){return BPromise['reject'](_0x50a999);}return _0x3ae187['save']();};}function saveUpdates(_0x11a65c,_0x2efebf){return function(_0x499945){if(_0x499945){return _0x499945[_0xffae('0x20')](_0x11a65c)['then'](function(_0x2f8ca9){return _0x2f8ca9;});}return null;};}function removeEntity(_0x80d71d,_0x2f8b35){return function(_0x3c6d55){if(_0x3c6d55){return _0x3c6d55[_0xffae('0x21')]()[_0xffae('0x22')](function(){_0x80d71d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xb0962d,_0xe8cdf7){return function(_0x54f1fa){if(!_0x54f1fa){_0xb0962d[_0xffae('0x17')](0x194);}return _0x54f1fa;};}function handleError(_0xf99ca5,_0x5f03c1){_0x5f03c1=_0x5f03c1||0x1f4;return function(_0x3371f8){logger['error'](_0x3371f8['stack']);if(_0x3371f8[_0xffae('0x23')]){delete _0x3371f8[_0xffae('0x23')];}_0xf99ca5['status'](_0x5f03c1)[_0xffae('0x24')](_0x3371f8);};}exports['index']=function(_0x2cd2c8,_0x4b036d){var _0xb7bfff={},_0x349bc4={},_0x1c8a2a={'count':0x0,'rows':[]};var _0x482136=_[_0xffae('0x25')](db[_0xffae('0x26')][_0xffae('0x27')],function(_0xb2b6){return{'name':_0xb2b6['fieldName'],'type':_0xb2b6[_0xffae('0x28')][_0xffae('0x29')]};});_0x349bc4[_0xffae('0x2a')]=_[_0xffae('0x25')](_0x482136,_0xffae('0x23'));_0x349bc4[_0xffae('0x2b')]=_[_0xffae('0x2c')](_0x2cd2c8[_0xffae('0x2b')]);_0x349bc4[_0xffae('0x2d')]=_[_0xffae('0x2e')](_0x349bc4[_0xffae('0x2a')],_0x349bc4[_0xffae('0x2b')]);_0xb7bfff['attributes']=_['intersection'](_0x349bc4[_0xffae('0x2a')],qs[_0xffae('0x2f')](_0x2cd2c8[_0xffae('0x2b')][_0xffae('0x2f')]));_0xb7bfff[_0xffae('0x30')]=_0xb7bfff['attributes']['length']?_0xb7bfff['attributes']:_0x349bc4[_0xffae('0x2a')];if(!_0x2cd2c8[_0xffae('0x2b')][_0xffae('0x31')](_0xffae('0x32'))){_0xb7bfff[_0xffae('0x1d')]=qs[_0xffae('0x1d')](_0x2cd2c8[_0xffae('0x2b')][_0xffae('0x1d')]);_0xb7bfff[_0xffae('0x1b')]=qs[_0xffae('0x1b')](_0x2cd2c8['query'][_0xffae('0x1b')]);}_0xb7bfff[_0xffae('0x33')]=qs[_0xffae('0x34')](_0x2cd2c8[_0xffae('0x2b')][_0xffae('0x34')]);_0xb7bfff[_0xffae('0x35')]=qs[_0xffae('0x2d')](_[_0xffae('0x36')](_0x2cd2c8[_0xffae('0x2b')],_0x349bc4[_0xffae('0x2d')]),_0x482136);if(_0x2cd2c8[_0xffae('0x2b')][_0xffae('0x37')]){_0xb7bfff[_0xffae('0x35')]=_['merge'](_0xb7bfff[_0xffae('0x35')],{'$or':_[_0xffae('0x25')](_0x482136,function(_0x26d80d){if(_0x26d80d[_0xffae('0x28')]!=='VIRTUAL'){var _0x24544e={};_0x24544e[_0x26d80d['name']]={'$like':'%'+_0x2cd2c8['query'][_0xffae('0x37')]+'%'};return _0x24544e;}})});}_0xb7bfff=_[_0xffae('0x38')]({},_0xb7bfff,_0x2cd2c8[_0xffae('0x39')]);var _0x1f6283={'where':_0xb7bfff['where']};return db[_0xffae('0x26')][_0xffae('0x1e')](_0x1f6283)['then'](function(_0x26a93b){_0x1c8a2a['count']=_0x26a93b;if(_0x2cd2c8[_0xffae('0x2b')][_0xffae('0x3a')]){_0xb7bfff[_0xffae('0x3b')]=[{'all':!![]}];}return db['ZendeskConfiguration'][_0xffae('0x3c')](_0xb7bfff);})[_0xffae('0x22')](function(_0x122ce8){_0x1c8a2a[_0xffae('0x3d')]=_0x122ce8;return _0x1c8a2a;})['then'](respondWithFilteredResult(_0x4b036d,_0xb7bfff))[_0xffae('0x3e')](handleError(_0x4b036d,null));};exports[_0xffae('0x3f')]=function(_0x1a764f,_0x2a2d9b){var _0x4f7df4={'raw':![],'where':{'id':_0x1a764f['params']['id']}},_0xbcf97={};_0xbcf97[_0xffae('0x2a')]=_[_0xffae('0x2c')](db[_0xffae('0x26')][_0xffae('0x27')]);_0xbcf97['query']=_[_0xffae('0x2c')](_0x1a764f['query']);_0xbcf97['filters']=_['intersection'](_0xbcf97[_0xffae('0x2a')],_0xbcf97[_0xffae('0x2b')]);_0x4f7df4[_0xffae('0x30')]=_[_0xffae('0x2e')](_0xbcf97[_0xffae('0x2a')],qs[_0xffae('0x2f')](_0x1a764f['query'][_0xffae('0x2f')]));_0x4f7df4[_0xffae('0x30')]=_0x4f7df4['attributes']['length']?_0x4f7df4[_0xffae('0x30')]:_0xbcf97['model'];if(_0x1a764f[_0xffae('0x2b')]['includeAll']){_0x4f7df4[_0xffae('0x3b')]=[{'all':!![]}];}_0x4f7df4=_[_0xffae('0x38')]({},_0x4f7df4,_0x1a764f[_0xffae('0x39')]);return db['ZendeskConfiguration']['find'](_0x4f7df4)[_0xffae('0x22')](handleEntityNotFound(_0x2a2d9b,null))[_0xffae('0x22')](respondWithResult(_0x2a2d9b,null))[_0xffae('0x3e')](handleError(_0x2a2d9b,null));};exports[_0xffae('0x40')]=function(_0x26d5f0,_0x11dd24){return db[_0xffae('0x26')][_0xffae('0x40')](_0x26d5f0[_0xffae('0x41')],{})['then'](respondWithResult(_0x11dd24,0xc9))[_0xffae('0x3e')](handleError(_0x11dd24,null));};exports[_0xffae('0x20')]=function(_0x4df783,_0x211d06){if(_0x4df783[_0xffae('0x41')]['id']){delete _0x4df783['body']['id'];}return db[_0xffae('0x26')][_0xffae('0x42')]({'where':{'id':_0x4df783[_0xffae('0x43')]['id']}})[_0xffae('0x22')](handleEntityNotFound(_0x211d06,null))[_0xffae('0x22')](saveUpdates(_0x4df783['body'],null))['then'](respondWithResult(_0x211d06,null))[_0xffae('0x3e')](handleError(_0x211d06,null));};exports[_0xffae('0x21')]=function(_0xec10cf,_0x928169){return db[_0xffae('0x26')][_0xffae('0x42')]({'where':{'id':_0xec10cf[_0xffae('0x43')]['id']}})[_0xffae('0x22')](handleEntityNotFound(_0x928169,null))[_0xffae('0x22')](removeEntity(_0x928169,null))['catch'](handleError(_0x928169,null));};exports[_0xffae('0x44')]=function(_0x3d529b,_0x131f16,_0x3bb387){var _0x59f6d5={};var _0x4e90f3={};var _0x2b680c;var _0xc05ef7;return db[_0xffae('0x26')]['findOne']({'where':{'id':_0x3d529b[_0xffae('0x43')]['id']}})[_0xffae('0x22')](handleEntityNotFound(_0x131f16,null))[_0xffae('0x22')](function(_0x53908f){if(_0x53908f){_0x2b680c=_0x53908f;_0x4e90f3[_0xffae('0x2a')]=_[_0xffae('0x2c')](db[_0xffae('0x45')][_0xffae('0x27')]);_0x4e90f3['query']=_[_0xffae('0x2c')](_0x3d529b['query']);_0x4e90f3[_0xffae('0x2d')]=_[_0xffae('0x2e')](_0x4e90f3[_0xffae('0x2a')],_0x4e90f3['query']);_0x59f6d5[_0xffae('0x30')]=_[_0xffae('0x2e')](_0x4e90f3[_0xffae('0x2a')],qs[_0xffae('0x2f')](_0x3d529b[_0xffae('0x2b')][_0xffae('0x2f')]));_0x59f6d5[_0xffae('0x30')]=_0x59f6d5['attributes'][_0xffae('0x46')]?_0x59f6d5[_0xffae('0x30')]:_0x4e90f3[_0xffae('0x2a')];_0x59f6d5[_0xffae('0x33')]=qs[_0xffae('0x34')](_0x3d529b[_0xffae('0x2b')][_0xffae('0x34')]);_0x59f6d5[_0xffae('0x35')]=qs['filters'](_[_0xffae('0x36')](_0x3d529b['query'],_0x4e90f3[_0xffae('0x2d')]));if(_0x3d529b[_0xffae('0x2b')]['filter']){_0x59f6d5[_0xffae('0x35')]=_['merge'](_0x59f6d5[_0xffae('0x35')],{'$or':_['map'](_0x59f6d5[_0xffae('0x30')],function(_0x17ae31){var _0x1d9c45={};_0x1d9c45[_0x17ae31]={'$like':'%'+_0x3d529b[_0xffae('0x2b')][_0xffae('0x37')]+'%'};return _0x1d9c45;})});}_0x59f6d5=_[_0xffae('0x38')]({},_0x59f6d5,_0x3d529b[_0xffae('0x39')]);return _0x2b680c[_0xffae('0x44')](_0x59f6d5);}})[_0xffae('0x22')](function(_0x5bc3ff){if(_0x5bc3ff){_0xc05ef7=_0x5bc3ff[_0xffae('0x46')];if(!_0x3d529b['query']['hasOwnProperty'](_0xffae('0x32'))){_0x59f6d5[_0xffae('0x1d')]=qs['limit'](_0x3d529b[_0xffae('0x2b')][_0xffae('0x1d')]);_0x59f6d5[_0xffae('0x1b')]=qs[_0xffae('0x1b')](_0x3d529b['query']['offset']);}return _0x2b680c[_0xffae('0x44')](_0x59f6d5);}})['then'](function(_0x2c0fcc){if(_0x2c0fcc){return _0x2c0fcc?{'count':_0xc05ef7,'rows':_0x2c0fcc}:null;}})[_0xffae('0x22')](respondWithResult(_0x131f16,null))[_0xffae('0x3e')](handleError(_0x131f16,null));};exports[_0xffae('0x47')]=function(_0x3aa803,_0x133d57,_0x3197ad){var _0x5de0a1={};var _0x1320a1={};var _0x126137;var _0x5c520a;return db[_0xffae('0x26')][_0xffae('0x48')]({'where':{'id':_0x3aa803[_0xffae('0x43')]['id']}})[_0xffae('0x22')](handleEntityNotFound(_0x133d57,null))['then'](function(_0x219c8c){if(_0x219c8c){_0x126137=_0x219c8c;_0x1320a1[_0xffae('0x2a')]=_['keys'](db[_0xffae('0x45')][_0xffae('0x27')]);_0x1320a1[_0xffae('0x2b')]=_[_0xffae('0x2c')](_0x3aa803['query']);_0x1320a1[_0xffae('0x2d')]=_[_0xffae('0x2e')](_0x1320a1['model'],_0x1320a1[_0xffae('0x2b')]);_0x5de0a1['attributes']=_['intersection'](_0x1320a1[_0xffae('0x2a')],qs['fields'](_0x3aa803[_0xffae('0x2b')][_0xffae('0x2f')]));_0x5de0a1[_0xffae('0x30')]=_0x5de0a1[_0xffae('0x30')][_0xffae('0x46')]?_0x5de0a1[_0xffae('0x30')]:_0x1320a1[_0xffae('0x2a')];_0x5de0a1[_0xffae('0x33')]=qs[_0xffae('0x34')](_0x3aa803[_0xffae('0x2b')][_0xffae('0x34')]);_0x5de0a1['where']=qs[_0xffae('0x2d')](_[_0xffae('0x36')](_0x3aa803[_0xffae('0x2b')],_0x1320a1[_0xffae('0x2d')]));if(_0x3aa803[_0xffae('0x2b')][_0xffae('0x37')]){_0x5de0a1['where']=_[_0xffae('0x38')](_0x5de0a1['where'],{'$or':_[_0xffae('0x25')](_0x5de0a1['attributes'],function(_0x6656cd){var _0x31a8dd={};_0x31a8dd[_0x6656cd]={'$like':'%'+_0x3aa803[_0xffae('0x2b')]['filter']+'%'};return _0x31a8dd;})});}_0x5de0a1=_[_0xffae('0x38')]({},_0x5de0a1,_0x3aa803[_0xffae('0x39')]);return _0x126137[_0xffae('0x47')](_0x5de0a1);}})[_0xffae('0x22')](function(_0x41f12f){if(_0x41f12f){_0x5c520a=_0x41f12f[_0xffae('0x46')];if(!_0x3aa803[_0xffae('0x2b')][_0xffae('0x31')]('nolimit')){_0x5de0a1[_0xffae('0x1d')]=qs['limit'](_0x3aa803[_0xffae('0x2b')]['limit']);_0x5de0a1[_0xffae('0x1b')]=qs[_0xffae('0x1b')](_0x3aa803['query'][_0xffae('0x1b')]);}return _0x126137[_0xffae('0x47')](_0x5de0a1);}})[_0xffae('0x22')](function(_0x3f5ee6){if(_0x3f5ee6){return _0x3f5ee6?{'count':_0x5c520a,'rows':_0x3f5ee6}:null;}})[_0xffae('0x22')](respondWithResult(_0x133d57,null))[_0xffae('0x3e')](handleError(_0x133d57,null));};exports[_0xffae('0x49')]=function(_0x3102d2,_0x525bf6,_0x195d20){var _0x4b0862={};var _0x45cbb1={};var _0x53f546;var _0x1f0a1c;return db[_0xffae('0x26')][_0xffae('0x48')]({'where':{'id':_0x3102d2[_0xffae('0x43')]['id']}})[_0xffae('0x22')](handleEntityNotFound(_0x525bf6,null))['then'](function(_0xffe52b){if(_0xffe52b){_0x53f546=_0xffe52b;_0x45cbb1['model']=_[_0xffae('0x2c')](db[_0xffae('0x45')][_0xffae('0x27')]);_0x45cbb1[_0xffae('0x2b')]=_['keys'](_0x3102d2[_0xffae('0x2b')]);_0x45cbb1[_0xffae('0x2d')]=_[_0xffae('0x2e')](_0x45cbb1['model'],_0x45cbb1[_0xffae('0x2b')]);_0x4b0862[_0xffae('0x30')]=_['intersection'](_0x45cbb1[_0xffae('0x2a')],qs[_0xffae('0x2f')](_0x3102d2[_0xffae('0x2b')][_0xffae('0x2f')]));_0x4b0862['attributes']=_0x4b0862[_0xffae('0x30')][_0xffae('0x46')]?_0x4b0862[_0xffae('0x30')]:_0x45cbb1[_0xffae('0x2a')];_0x4b0862[_0xffae('0x33')]=qs[_0xffae('0x34')](_0x3102d2['query'][_0xffae('0x34')]);_0x4b0862[_0xffae('0x35')]=qs['filters'](_[_0xffae('0x36')](_0x3102d2[_0xffae('0x2b')],_0x45cbb1['filters']));if(_0x3102d2[_0xffae('0x2b')][_0xffae('0x37')]){_0x4b0862[_0xffae('0x35')]=_[_0xffae('0x38')](_0x4b0862[_0xffae('0x35')],{'$or':_[_0xffae('0x25')](_0x4b0862['attributes'],function(_0x2ee15f){var _0x5ebf5e={};_0x5ebf5e[_0x2ee15f]={'$like':'%'+_0x3102d2[_0xffae('0x2b')][_0xffae('0x37')]+'%'};return _0x5ebf5e;})});}_0x4b0862=_[_0xffae('0x38')]({},_0x4b0862,_0x3102d2[_0xffae('0x39')]);return _0x53f546[_0xffae('0x49')](_0x4b0862);}})[_0xffae('0x22')](function(_0x2ac0f4){if(_0x2ac0f4){_0x1f0a1c=_0x2ac0f4['length'];if(!_0x3102d2[_0xffae('0x2b')][_0xffae('0x31')](_0xffae('0x32'))){_0x4b0862[_0xffae('0x1d')]=qs[_0xffae('0x1d')](_0x3102d2['query'][_0xffae('0x1d')]);_0x4b0862[_0xffae('0x1b')]=qs[_0xffae('0x1b')](_0x3102d2[_0xffae('0x2b')][_0xffae('0x1b')]);}return _0x53f546[_0xffae('0x49')](_0x4b0862);}})[_0xffae('0x22')](function(_0x9ae5df){if(_0x9ae5df){return _0x9ae5df?{'count':_0x1f0a1c,'rows':_0x9ae5df}:null;}})[_0xffae('0x22')](respondWithResult(_0x525bf6,null))[_0xffae('0x3e')](handleError(_0x525bf6,null));};exports['getTags']=function(_0x20f039,_0x4c7efa,_0xa80b7c){var _0x441e1f={};var _0x5e8e6c={};var _0x3722f4;var _0x5194e9;return db[_0xffae('0x26')][_0xffae('0x48')]({'where':{'id':_0x20f039[_0xffae('0x43')]['id']}})[_0xffae('0x22')](handleEntityNotFound(_0x4c7efa,null))[_0xffae('0x22')](function(_0x3a11f8){if(_0x3a11f8){_0x3722f4=_0x3a11f8;_0x5e8e6c[_0xffae('0x2a')]=_[_0xffae('0x2c')](db[_0xffae('0x4a')]['rawAttributes']);_0x5e8e6c['query']=_[_0xffae('0x2c')](_0x20f039[_0xffae('0x2b')]);_0x5e8e6c[_0xffae('0x2d')]=_[_0xffae('0x2e')](_0x5e8e6c['model'],_0x5e8e6c[_0xffae('0x2b')]);_0x441e1f['attributes']=_[_0xffae('0x2e')](_0x5e8e6c[_0xffae('0x2a')],qs[_0xffae('0x2f')](_0x20f039[_0xffae('0x2b')]['fields']));_0x441e1f[_0xffae('0x30')]=_0x441e1f['attributes'][_0xffae('0x46')]?_0x441e1f['attributes']:_0x5e8e6c[_0xffae('0x2a')];_0x441e1f[_0xffae('0x33')]=qs[_0xffae('0x34')](_0x20f039[_0xffae('0x2b')]['sort']);_0x441e1f[_0xffae('0x35')]=qs[_0xffae('0x2d')](_[_0xffae('0x36')](_0x20f039[_0xffae('0x2b')],_0x5e8e6c['filters']));if(_0x20f039[_0xffae('0x2b')]['filter']){_0x441e1f[_0xffae('0x35')]=_['merge'](_0x441e1f[_0xffae('0x35')],{'$or':_['map'](_0x441e1f[_0xffae('0x30')],function(_0x25c3c1){var _0x26a12f={};_0x26a12f[_0x25c3c1]={'$like':'%'+_0x20f039[_0xffae('0x2b')][_0xffae('0x37')]+'%'};return _0x26a12f;})});}_0x441e1f=_[_0xffae('0x38')]({},_0x441e1f,_0x20f039[_0xffae('0x39')]);return _0x3722f4['getTags'](_0x441e1f);}})[_0xffae('0x22')](function(_0x1b0928){if(_0x1b0928){_0x5194e9=_0x1b0928[_0xffae('0x46')];if(!_0x20f039['query'][_0xffae('0x31')](_0xffae('0x32'))){_0x441e1f[_0xffae('0x1d')]=qs[_0xffae('0x1d')](_0x20f039[_0xffae('0x2b')][_0xffae('0x1d')]);_0x441e1f[_0xffae('0x1b')]=qs[_0xffae('0x1b')](_0x20f039['query']['offset']);}return _0x3722f4['getTags'](_0x441e1f);}})[_0xffae('0x22')](function(_0x41e63c){if(_0x41e63c){return _0x41e63c?{'count':_0x5194e9,'rows':_0x41e63c}:null;}})[_0xffae('0x22')](respondWithResult(_0x4c7efa,null))[_0xffae('0x3e')](handleError(_0x4c7efa,null));};exports[_0xffae('0x4b')]=function(_0x453b4c,_0x4af949,_0x4f2a7a){if(_0x453b4c[_0xffae('0x41')]['id']){delete _0x453b4c[_0xffae('0x41')]['id'];}return db[_0xffae('0x26')]['findOne']({'where':{'id':_0x453b4c[_0xffae('0x43')]['id']}})[_0xffae('0x22')](handleEntityNotFound(_0x4af949,null))['then'](function(_0xd37d8d){if(_0xd37d8d){return _0xd37d8d[_0xffae('0x4b')](_0x453b4c[_0xffae('0x41')][_0xffae('0x4c')]||[]);}return null;})['then'](respondWithResult(_0x4af949,null))[_0xffae('0x3e')](handleError(_0x4af949,null));}; \ No newline at end of file +var _0x065d=['index','map','ZendeskConfiguration','rawAttributes','fieldName','type','key','model','query','filters','attributes','fields','length','nolimit','order','sort','where','filter','VIRTUAL','merge','options','include','rows','catch','show','params','keys','intersection','includeAll','find','create','body','getFields','findOne','pick','hasOwnProperty','getSubjects','ZendeskField','getDescriptions','getTags','Tag','setTags','ids','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','offset','undefined','count','limit','set','Content-Range','apply','reject','update','then','destroy','end','sendStatus','error','stack','name'];(function(_0x5e9b8f,_0x31aa85){var _0xfbda62=function(_0xc9e587){while(--_0xc9e587){_0x5e9b8f['push'](_0x5e9b8f['shift']());}};_0xfbda62(++_0x31aa85);}(_0x065d,0x17f));var _0xd065=function(_0x3a035a,_0x56ca9b){_0x3a035a=_0x3a035a-0x0;var _0x16d42d=_0x065d[_0x3a035a];return _0x16d42d;};'use strict';var emlformat=require(_0xd065('0x0'));var rimraf=require(_0xd065('0x1'));var zipdir=require(_0xd065('0x2'));var jsonpatch=require(_0xd065('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd065('0x4'));var Mustache=require(_0xd065('0x5'));var util=require(_0xd065('0x6'));var path=require(_0xd065('0x7'));var sox=require(_0xd065('0x8'));var csv=require(_0xd065('0x9'));var ejs=require(_0xd065('0xa'));var fs=require('fs');var fs_extra=require(_0xd065('0xb'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xd065('0xc'));var jsforce=require(_0xd065('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xd065('0x9'));var querystring=require(_0xd065('0xe'));var Papa=require('papaparse');var Redis=require(_0xd065('0xf'));var authService=require(_0xd065('0x10'));var qs=require(_0xd065('0x11'));var as=require(_0xd065('0x12'));var hardwareService=require(_0xd065('0x13'));var logger=require(_0xd065('0x14'))('api');var utils=require(_0xd065('0x15'));var config=require(_0xd065('0x16'));var licenseUtil=require(_0xd065('0x17'));var db=require(_0xd065('0x18'))['db'];function respondWithStatusCode(_0xa637dc,_0x4f62a9){_0x4f62a9=_0x4f62a9||0xcc;return function(_0x134dfe){if(_0x134dfe){return _0xa637dc['sendStatus'](_0x4f62a9);}return _0xa637dc[_0xd065('0x19')](_0x4f62a9)['end']();};}function respondWithResult(_0x4bcf48,_0x264dfe){_0x264dfe=_0x264dfe||0xc8;return function(_0x36ff7a){if(_0x36ff7a){return _0x4bcf48[_0xd065('0x19')](_0x264dfe)['json'](_0x36ff7a);}};}function respondWithFilteredResult(_0x32201d,_0x211406){return function(_0x1e6e20){if(_0x1e6e20){var _0x23ccde=typeof _0x211406[_0xd065('0x1a')]===_0xd065('0x1b')&&typeof _0x211406['limit']===_0xd065('0x1b');var _0x187baa=_0x1e6e20[_0xd065('0x1c')];var _0x2c5715=_0x23ccde?0x0:_0x211406[_0xd065('0x1a')];var _0x5abfc1=_0x23ccde?_0x1e6e20[_0xd065('0x1c')]:_0x211406[_0xd065('0x1a')]+_0x211406[_0xd065('0x1d')];var _0x2b8daf;if(_0x5abfc1>=_0x187baa){_0x5abfc1=_0x187baa;_0x2b8daf=0xc8;}else{_0x2b8daf=0xce;}_0x32201d[_0xd065('0x19')](_0x2b8daf);return _0x32201d[_0xd065('0x1e')](_0xd065('0x1f'),_0x2c5715+'-'+_0x5abfc1+'/'+_0x187baa)['json'](_0x1e6e20);}return null;};}function patchUpdates(_0x585960){return function(_0x16684){try{jsonpatch[_0xd065('0x20')](_0x16684,_0x585960,!![]);}catch(_0x3ccf06){return BPromise[_0xd065('0x21')](_0x3ccf06);}return _0x16684['save']();};}function saveUpdates(_0x4cc528,_0x299025){return function(_0x5d0e5c){if(_0x5d0e5c){return _0x5d0e5c[_0xd065('0x22')](_0x4cc528)[_0xd065('0x23')](function(_0x4dc52e){return _0x4dc52e;});}return null;};}function removeEntity(_0x175950,_0x3ee8d6){return function(_0x4932b6){if(_0x4932b6){return _0x4932b6[_0xd065('0x24')]()['then'](function(){_0x175950[_0xd065('0x19')](0xcc)[_0xd065('0x25')]();});}};}function handleEntityNotFound(_0x3c69f1,_0x1395bd){return function(_0x3d9129){if(!_0x3d9129){_0x3c69f1[_0xd065('0x26')](0x194);}return _0x3d9129;};}function handleError(_0x501e87,_0x15289a){_0x15289a=_0x15289a||0x1f4;return function(_0x3bd721){logger[_0xd065('0x27')](_0x3bd721[_0xd065('0x28')]);if(_0x3bd721[_0xd065('0x29')]){delete _0x3bd721[_0xd065('0x29')];}_0x501e87[_0xd065('0x19')](_0x15289a)['send'](_0x3bd721);};}exports[_0xd065('0x2a')]=function(_0x3f24b5,_0x4a297d){var _0x187b46={},_0x362a79={},_0xf47350={'count':0x0,'rows':[]};var _0x264693=_[_0xd065('0x2b')](db[_0xd065('0x2c')][_0xd065('0x2d')],function(_0x159f41){return{'name':_0x159f41[_0xd065('0x2e')],'type':_0x159f41[_0xd065('0x2f')][_0xd065('0x30')]};});_0x362a79[_0xd065('0x31')]=_[_0xd065('0x2b')](_0x264693,_0xd065('0x29'));_0x362a79[_0xd065('0x32')]=_['keys'](_0x3f24b5[_0xd065('0x32')]);_0x362a79[_0xd065('0x33')]=_['intersection'](_0x362a79[_0xd065('0x31')],_0x362a79[_0xd065('0x32')]);_0x187b46[_0xd065('0x34')]=_['intersection'](_0x362a79[_0xd065('0x31')],qs[_0xd065('0x35')](_0x3f24b5[_0xd065('0x32')]['fields']));_0x187b46['attributes']=_0x187b46[_0xd065('0x34')][_0xd065('0x36')]?_0x187b46[_0xd065('0x34')]:_0x362a79[_0xd065('0x31')];if(!_0x3f24b5[_0xd065('0x32')]['hasOwnProperty'](_0xd065('0x37'))){_0x187b46[_0xd065('0x1d')]=qs[_0xd065('0x1d')](_0x3f24b5[_0xd065('0x32')]['limit']);_0x187b46['offset']=qs[_0xd065('0x1a')](_0x3f24b5[_0xd065('0x32')][_0xd065('0x1a')]);}_0x187b46[_0xd065('0x38')]=qs[_0xd065('0x39')](_0x3f24b5['query']['sort']);_0x187b46[_0xd065('0x3a')]=qs[_0xd065('0x33')](_['pick'](_0x3f24b5[_0xd065('0x32')],_0x362a79[_0xd065('0x33')]),_0x264693);if(_0x3f24b5[_0xd065('0x32')][_0xd065('0x3b')]){_0x187b46[_0xd065('0x3a')]=_['merge'](_0x187b46[_0xd065('0x3a')],{'$or':_[_0xd065('0x2b')](_0x264693,function(_0x1817d8){if(_0x1817d8[_0xd065('0x2f')]!==_0xd065('0x3c')){var _0x174a39={};_0x174a39[_0x1817d8[_0xd065('0x29')]]={'$like':'%'+_0x3f24b5['query']['filter']+'%'};return _0x174a39;}})});}_0x187b46=_[_0xd065('0x3d')]({},_0x187b46,_0x3f24b5[_0xd065('0x3e')]);var _0x226f3c={'where':_0x187b46['where']};return db[_0xd065('0x2c')][_0xd065('0x1c')](_0x226f3c)['then'](function(_0x489183){_0xf47350[_0xd065('0x1c')]=_0x489183;if(_0x3f24b5[_0xd065('0x32')]['includeAll']){_0x187b46[_0xd065('0x3f')]=[{'all':!![]}];}return db[_0xd065('0x2c')]['findAll'](_0x187b46);})['then'](function(_0x5c9a62){_0xf47350[_0xd065('0x40')]=_0x5c9a62;return _0xf47350;})['then'](respondWithFilteredResult(_0x4a297d,_0x187b46))[_0xd065('0x41')](handleError(_0x4a297d,null));};exports[_0xd065('0x42')]=function(_0x37b96c,_0x3dd917){var _0x3a9fd7={'raw':![],'where':{'id':_0x37b96c[_0xd065('0x43')]['id']}},_0x3c4967={};_0x3c4967[_0xd065('0x31')]=_[_0xd065('0x44')](db[_0xd065('0x2c')][_0xd065('0x2d')]);_0x3c4967['query']=_[_0xd065('0x44')](_0x37b96c[_0xd065('0x32')]);_0x3c4967[_0xd065('0x33')]=_['intersection'](_0x3c4967[_0xd065('0x31')],_0x3c4967[_0xd065('0x32')]);_0x3a9fd7['attributes']=_[_0xd065('0x45')](_0x3c4967[_0xd065('0x31')],qs['fields'](_0x37b96c[_0xd065('0x32')][_0xd065('0x35')]));_0x3a9fd7[_0xd065('0x34')]=_0x3a9fd7[_0xd065('0x34')][_0xd065('0x36')]?_0x3a9fd7[_0xd065('0x34')]:_0x3c4967[_0xd065('0x31')];if(_0x37b96c[_0xd065('0x32')][_0xd065('0x46')]){_0x3a9fd7[_0xd065('0x3f')]=[{'all':!![]}];}_0x3a9fd7=_['merge']({},_0x3a9fd7,_0x37b96c['options']);return db[_0xd065('0x2c')][_0xd065('0x47')](_0x3a9fd7)[_0xd065('0x23')](handleEntityNotFound(_0x3dd917,null))[_0xd065('0x23')](respondWithResult(_0x3dd917,null))[_0xd065('0x41')](handleError(_0x3dd917,null));};exports[_0xd065('0x48')]=function(_0x3f8554,_0xb6f5a0){return db[_0xd065('0x2c')][_0xd065('0x48')](_0x3f8554[_0xd065('0x49')],{})['then'](respondWithResult(_0xb6f5a0,0xc9))[_0xd065('0x41')](handleError(_0xb6f5a0,null));};exports[_0xd065('0x22')]=function(_0x37afe3,_0x233495){if(_0x37afe3[_0xd065('0x49')]['id']){delete _0x37afe3['body']['id'];}return db[_0xd065('0x2c')][_0xd065('0x47')]({'where':{'id':_0x37afe3[_0xd065('0x43')]['id']}})[_0xd065('0x23')](handleEntityNotFound(_0x233495,null))['then'](saveUpdates(_0x37afe3[_0xd065('0x49')],null))[_0xd065('0x23')](respondWithResult(_0x233495,null))[_0xd065('0x41')](handleError(_0x233495,null));};exports[_0xd065('0x24')]=function(_0x2625fb,_0x5999e0){return db[_0xd065('0x2c')][_0xd065('0x47')]({'where':{'id':_0x2625fb[_0xd065('0x43')]['id']}})[_0xd065('0x23')](handleEntityNotFound(_0x5999e0,null))[_0xd065('0x23')](removeEntity(_0x5999e0,null))['catch'](handleError(_0x5999e0,null));};exports[_0xd065('0x4a')]=function(_0x44f62a,_0xe3bc30,_0x491624){var _0x17e3af={};var _0xc6ccea={};var _0x29e629;var _0x3e5545;return db[_0xd065('0x2c')][_0xd065('0x4b')]({'where':{'id':_0x44f62a['params']['id']}})[_0xd065('0x23')](handleEntityNotFound(_0xe3bc30,null))[_0xd065('0x23')](function(_0x36f2c3){if(_0x36f2c3){_0x29e629=_0x36f2c3;_0xc6ccea[_0xd065('0x31')]=_[_0xd065('0x44')](db['ZendeskField'][_0xd065('0x2d')]);_0xc6ccea[_0xd065('0x32')]=_[_0xd065('0x44')](_0x44f62a[_0xd065('0x32')]);_0xc6ccea[_0xd065('0x33')]=_[_0xd065('0x45')](_0xc6ccea[_0xd065('0x31')],_0xc6ccea[_0xd065('0x32')]);_0x17e3af[_0xd065('0x34')]=_[_0xd065('0x45')](_0xc6ccea['model'],qs['fields'](_0x44f62a['query'][_0xd065('0x35')]));_0x17e3af['attributes']=_0x17e3af['attributes']['length']?_0x17e3af['attributes']:_0xc6ccea['model'];_0x17e3af[_0xd065('0x38')]=qs['sort'](_0x44f62a[_0xd065('0x32')][_0xd065('0x39')]);_0x17e3af['where']=qs[_0xd065('0x33')](_[_0xd065('0x4c')](_0x44f62a['query'],_0xc6ccea[_0xd065('0x33')]));if(_0x44f62a[_0xd065('0x32')][_0xd065('0x3b')]){_0x17e3af[_0xd065('0x3a')]=_[_0xd065('0x3d')](_0x17e3af[_0xd065('0x3a')],{'$or':_[_0xd065('0x2b')](_0x17e3af[_0xd065('0x34')],function(_0x34673b){var _0x124f43={};_0x124f43[_0x34673b]={'$like':'%'+_0x44f62a[_0xd065('0x32')][_0xd065('0x3b')]+'%'};return _0x124f43;})});}_0x17e3af=_[_0xd065('0x3d')]({},_0x17e3af,_0x44f62a['options']);return _0x29e629[_0xd065('0x4a')](_0x17e3af);}})[_0xd065('0x23')](function(_0x30de05){if(_0x30de05){_0x3e5545=_0x30de05['length'];if(!_0x44f62a[_0xd065('0x32')][_0xd065('0x4d')](_0xd065('0x37'))){_0x17e3af[_0xd065('0x1d')]=qs[_0xd065('0x1d')](_0x44f62a[_0xd065('0x32')][_0xd065('0x1d')]);_0x17e3af[_0xd065('0x1a')]=qs[_0xd065('0x1a')](_0x44f62a['query']['offset']);}return _0x29e629[_0xd065('0x4a')](_0x17e3af);}})['then'](function(_0x3ca8b1){if(_0x3ca8b1){return _0x3ca8b1?{'count':_0x3e5545,'rows':_0x3ca8b1}:null;}})['then'](respondWithResult(_0xe3bc30,null))[_0xd065('0x41')](handleError(_0xe3bc30,null));};exports[_0xd065('0x4e')]=function(_0x430fa6,_0x18edd2,_0x1d8fc9){var _0x121b1c={};var _0x225a05={};var _0x361100;var _0x5616b4;return db[_0xd065('0x2c')][_0xd065('0x4b')]({'where':{'id':_0x430fa6['params']['id']}})['then'](handleEntityNotFound(_0x18edd2,null))[_0xd065('0x23')](function(_0x38191a){if(_0x38191a){_0x361100=_0x38191a;_0x225a05['model']=_[_0xd065('0x44')](db[_0xd065('0x4f')]['rawAttributes']);_0x225a05['query']=_['keys'](_0x430fa6[_0xd065('0x32')]);_0x225a05['filters']=_[_0xd065('0x45')](_0x225a05[_0xd065('0x31')],_0x225a05[_0xd065('0x32')]);_0x121b1c[_0xd065('0x34')]=_['intersection'](_0x225a05[_0xd065('0x31')],qs['fields'](_0x430fa6[_0xd065('0x32')][_0xd065('0x35')]));_0x121b1c[_0xd065('0x34')]=_0x121b1c[_0xd065('0x34')][_0xd065('0x36')]?_0x121b1c[_0xd065('0x34')]:_0x225a05[_0xd065('0x31')];_0x121b1c[_0xd065('0x38')]=qs[_0xd065('0x39')](_0x430fa6[_0xd065('0x32')][_0xd065('0x39')]);_0x121b1c['where']=qs['filters'](_[_0xd065('0x4c')](_0x430fa6['query'],_0x225a05[_0xd065('0x33')]));if(_0x430fa6[_0xd065('0x32')][_0xd065('0x3b')]){_0x121b1c[_0xd065('0x3a')]=_[_0xd065('0x3d')](_0x121b1c[_0xd065('0x3a')],{'$or':_[_0xd065('0x2b')](_0x121b1c[_0xd065('0x34')],function(_0x15f0a3){var _0x7db702={};_0x7db702[_0x15f0a3]={'$like':'%'+_0x430fa6[_0xd065('0x32')]['filter']+'%'};return _0x7db702;})});}_0x121b1c=_[_0xd065('0x3d')]({},_0x121b1c,_0x430fa6[_0xd065('0x3e')]);return _0x361100[_0xd065('0x4e')](_0x121b1c);}})[_0xd065('0x23')](function(_0x41713c){if(_0x41713c){_0x5616b4=_0x41713c[_0xd065('0x36')];if(!_0x430fa6[_0xd065('0x32')]['hasOwnProperty'](_0xd065('0x37'))){_0x121b1c[_0xd065('0x1d')]=qs[_0xd065('0x1d')](_0x430fa6[_0xd065('0x32')][_0xd065('0x1d')]);_0x121b1c[_0xd065('0x1a')]=qs[_0xd065('0x1a')](_0x430fa6['query'][_0xd065('0x1a')]);}return _0x361100[_0xd065('0x4e')](_0x121b1c);}})[_0xd065('0x23')](function(_0xf092d2){if(_0xf092d2){return _0xf092d2?{'count':_0x5616b4,'rows':_0xf092d2}:null;}})[_0xd065('0x23')](respondWithResult(_0x18edd2,null))[_0xd065('0x41')](handleError(_0x18edd2,null));};exports[_0xd065('0x50')]=function(_0x4dece7,_0x3b0af8,_0x2a0d61){var _0x1773c5={};var _0x1fabfe={};var _0x236fbd;var _0x2b84e4;return db['ZendeskConfiguration'][_0xd065('0x4b')]({'where':{'id':_0x4dece7[_0xd065('0x43')]['id']}})[_0xd065('0x23')](handleEntityNotFound(_0x3b0af8,null))['then'](function(_0x4acc00){if(_0x4acc00){_0x236fbd=_0x4acc00;_0x1fabfe[_0xd065('0x31')]=_[_0xd065('0x44')](db[_0xd065('0x4f')][_0xd065('0x2d')]);_0x1fabfe[_0xd065('0x32')]=_[_0xd065('0x44')](_0x4dece7[_0xd065('0x32')]);_0x1fabfe['filters']=_[_0xd065('0x45')](_0x1fabfe['model'],_0x1fabfe[_0xd065('0x32')]);_0x1773c5['attributes']=_[_0xd065('0x45')](_0x1fabfe[_0xd065('0x31')],qs[_0xd065('0x35')](_0x4dece7[_0xd065('0x32')][_0xd065('0x35')]));_0x1773c5[_0xd065('0x34')]=_0x1773c5[_0xd065('0x34')][_0xd065('0x36')]?_0x1773c5[_0xd065('0x34')]:_0x1fabfe[_0xd065('0x31')];_0x1773c5[_0xd065('0x38')]=qs['sort'](_0x4dece7[_0xd065('0x32')][_0xd065('0x39')]);_0x1773c5[_0xd065('0x3a')]=qs['filters'](_[_0xd065('0x4c')](_0x4dece7[_0xd065('0x32')],_0x1fabfe[_0xd065('0x33')]));if(_0x4dece7[_0xd065('0x32')][_0xd065('0x3b')]){_0x1773c5[_0xd065('0x3a')]=_[_0xd065('0x3d')](_0x1773c5[_0xd065('0x3a')],{'$or':_[_0xd065('0x2b')](_0x1773c5[_0xd065('0x34')],function(_0x3b02b6){var _0x4082f0={};_0x4082f0[_0x3b02b6]={'$like':'%'+_0x4dece7[_0xd065('0x32')][_0xd065('0x3b')]+'%'};return _0x4082f0;})});}_0x1773c5=_[_0xd065('0x3d')]({},_0x1773c5,_0x4dece7['options']);return _0x236fbd[_0xd065('0x50')](_0x1773c5);}})[_0xd065('0x23')](function(_0x31130b){if(_0x31130b){_0x2b84e4=_0x31130b['length'];if(!_0x4dece7[_0xd065('0x32')]['hasOwnProperty'](_0xd065('0x37'))){_0x1773c5[_0xd065('0x1d')]=qs[_0xd065('0x1d')](_0x4dece7[_0xd065('0x32')][_0xd065('0x1d')]);_0x1773c5[_0xd065('0x1a')]=qs[_0xd065('0x1a')](_0x4dece7[_0xd065('0x32')][_0xd065('0x1a')]);}return _0x236fbd[_0xd065('0x50')](_0x1773c5);}})[_0xd065('0x23')](function(_0x4f5661){if(_0x4f5661){return _0x4f5661?{'count':_0x2b84e4,'rows':_0x4f5661}:null;}})[_0xd065('0x23')](respondWithResult(_0x3b0af8,null))[_0xd065('0x41')](handleError(_0x3b0af8,null));};exports[_0xd065('0x51')]=function(_0x2f1482,_0x440234,_0x2359f7){var _0x569725={};var _0x249029={};var _0x285666;var _0x40f202;return db[_0xd065('0x2c')][_0xd065('0x4b')]({'where':{'id':_0x2f1482['params']['id']}})[_0xd065('0x23')](handleEntityNotFound(_0x440234,null))['then'](function(_0x577a17){if(_0x577a17){_0x285666=_0x577a17;_0x249029[_0xd065('0x31')]=_['keys'](db[_0xd065('0x52')][_0xd065('0x2d')]);_0x249029[_0xd065('0x32')]=_[_0xd065('0x44')](_0x2f1482[_0xd065('0x32')]);_0x249029[_0xd065('0x33')]=_['intersection'](_0x249029[_0xd065('0x31')],_0x249029[_0xd065('0x32')]);_0x569725[_0xd065('0x34')]=_[_0xd065('0x45')](_0x249029[_0xd065('0x31')],qs[_0xd065('0x35')](_0x2f1482[_0xd065('0x32')][_0xd065('0x35')]));_0x569725[_0xd065('0x34')]=_0x569725[_0xd065('0x34')]['length']?_0x569725[_0xd065('0x34')]:_0x249029[_0xd065('0x31')];_0x569725[_0xd065('0x38')]=qs['sort'](_0x2f1482['query'][_0xd065('0x39')]);_0x569725[_0xd065('0x3a')]=qs[_0xd065('0x33')](_[_0xd065('0x4c')](_0x2f1482['query'],_0x249029[_0xd065('0x33')]));if(_0x2f1482[_0xd065('0x32')][_0xd065('0x3b')]){_0x569725[_0xd065('0x3a')]=_['merge'](_0x569725['where'],{'$or':_[_0xd065('0x2b')](_0x569725['attributes'],function(_0x19ad52){var _0x2340f2={};_0x2340f2[_0x19ad52]={'$like':'%'+_0x2f1482[_0xd065('0x32')][_0xd065('0x3b')]+'%'};return _0x2340f2;})});}_0x569725=_['merge']({},_0x569725,_0x2f1482[_0xd065('0x3e')]);return _0x285666[_0xd065('0x51')](_0x569725);}})[_0xd065('0x23')](function(_0x7bb0c4){if(_0x7bb0c4){_0x40f202=_0x7bb0c4['length'];if(!_0x2f1482[_0xd065('0x32')][_0xd065('0x4d')](_0xd065('0x37'))){_0x569725[_0xd065('0x1d')]=qs['limit'](_0x2f1482[_0xd065('0x32')][_0xd065('0x1d')]);_0x569725['offset']=qs[_0xd065('0x1a')](_0x2f1482[_0xd065('0x32')][_0xd065('0x1a')]);}return _0x285666[_0xd065('0x51')](_0x569725);}})[_0xd065('0x23')](function(_0x2df715){if(_0x2df715){return _0x2df715?{'count':_0x40f202,'rows':_0x2df715}:null;}})[_0xd065('0x23')](respondWithResult(_0x440234,null))[_0xd065('0x41')](handleError(_0x440234,null));};exports[_0xd065('0x53')]=function(_0x107c3c,_0xaec7e3,_0x45e09){if(_0x107c3c[_0xd065('0x49')]['id']){delete _0x107c3c[_0xd065('0x49')]['id'];}return db[_0xd065('0x2c')]['findOne']({'where':{'id':_0x107c3c['params']['id']}})[_0xd065('0x23')](handleEntityNotFound(_0xaec7e3,null))[_0xd065('0x23')](function(_0x11d549){if(_0x11d549){return _0x11d549[_0xd065('0x53')](_0x107c3c[_0xd065('0x49')][_0xd065('0x54')]||[]);}return null;})[_0xd065('0x23')](respondWithResult(_0xaec7e3,null))['catch'](handleError(_0xaec7e3,null));}; \ No newline at end of file diff --git a/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js b/server/api/intZendeskConfiguration/intZendeskConfiguration.model.js index 4e44972..a711693 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 _0x5eb8=['request-promise','path','rimraf','../../config/environment','./intZendeskConfiguration.attributes','exports','ZendeskConfiguration','int_zendesk_configurations','../../config/logger','api','moment','bluebird'];(function(_0x40c116,_0x355d09){var _0x52e0b0=function(_0x4ea50c){while(--_0x4ea50c){_0x40c116['push'](_0x40c116['shift']());}};_0x52e0b0(++_0x355d09);}(_0x5eb8,0xb0));var _0x85eb=function(_0x11deef,_0x34bbdb){_0x11deef=_0x11deef-0x0;var _0xe9ba85=_0x5eb8[_0x11deef];return _0xe9ba85;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x85eb('0x0'))(_0x85eb('0x1'));var moment=require(_0x85eb('0x2'));var BPromise=require(_0x85eb('0x3'));var rp=require(_0x85eb('0x4'));var fs=require('fs');var path=require(_0x85eb('0x5'));var rimraf=require(_0x85eb('0x6'));var config=require(_0x85eb('0x7'));var attributes=require(_0x85eb('0x8'));module[_0x85eb('0x9')]=function(_0x2bf83c,_0x1ba1d8){return _0x2bf83c['define'](_0x85eb('0xa'),attributes,{'tableName':_0x85eb('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d25=['api','moment','bluebird','request-promise','path','define','ZendeskConfiguration','int_zendesk_configurations','util','../../config/logger'];(function(_0x1f91f1,_0xdbc1a1){var _0x1df196=function(_0x470b0d){while(--_0x470b0d){_0x1f91f1['push'](_0x1f91f1['shift']());}};_0x1df196(++_0xdbc1a1);}(_0x7d25,0x8a));var _0x57d2=function(_0x3070dc,_0x40cf11){_0x3070dc=_0x3070dc-0x0;var _0x431489=_0x7d25[_0x3070dc];return _0x431489;};'use strict';var _=require('lodash');var util=require(_0x57d2('0x0'));var logger=require(_0x57d2('0x1'))(_0x57d2('0x2'));var moment=require(_0x57d2('0x3'));var BPromise=require(_0x57d2('0x4'));var rp=require(_0x57d2('0x5'));var fs=require('fs');var path=require(_0x57d2('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require('./intZendeskConfiguration.attributes');module['exports']=function(_0x3c5511,_0x49cc5f){return _0x3c5511[_0x57d2('0x7')](_0x57d2('0x8'),attributes,{'tableName':_0x57d2('0x9'),'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 50ce8a9..c22b435 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 _0x9bbb=['ZendeskConfiguration,\x20%s,\x20%s','request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info'];(function(_0x44875d,_0x2c98b6){var _0x3942bb=function(_0x2fd2c8){while(--_0x2fd2c8){_0x44875d['push'](_0x44875d['shift']());}};_0x3942bb(++_0x2c98b6);}(_0x9bbb,0x1cc));var _0xb9bb=function(_0xc2bc89,_0x32362b){_0xc2bc89=_0xc2bc89-0x0;var _0x45480a=_0x9bbb[_0xc2bc89];return _0x45480a;};'use strict';var _=require(_0xb9bb('0x0'));var util=require(_0xb9bb('0x1'));var moment=require(_0xb9bb('0x2'));var BPromise=require(_0xb9bb('0x3'));var rs=require(_0xb9bb('0x4'));var fs=require('fs');var Redis=require(_0xb9bb('0x5'));var db=require(_0xb9bb('0x6'))['db'];var utils=require(_0xb9bb('0x7'));var logger=require(_0xb9bb('0x8'))(_0xb9bb('0x9'));var config=require(_0xb9bb('0xa'));var jayson=require(_0xb9bb('0xb'));var client=jayson[_0xb9bb('0xc')][_0xb9bb('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x2b5401,_0x33c17d,_0x3bc3c9){return new BPromise(function(_0xb51c93,_0x240b4e){return client['request'](_0x2b5401,_0x3bc3c9)['then'](function(_0x7a109c){logger[_0xb9bb('0xe')](_0xb9bb('0xf'),_0x33c17d,_0xb9bb('0x10'));logger[_0xb9bb('0x11')](_0xb9bb('0x12'),_0x33c17d,_0xb9bb('0x10'),JSON[_0xb9bb('0x13')](_0x7a109c));if(_0x7a109c[_0xb9bb('0x14')]){if(_0x7a109c[_0xb9bb('0x14')][_0xb9bb('0x15')]===0x1f4){logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x33c17d,_0x7a109c[_0xb9bb('0x14')]['message']);return _0x240b4e(_0x7a109c[_0xb9bb('0x14')][_0xb9bb('0x16')]);}logger['error']('ZendeskConfiguration,\x20%s,\x20%s',_0x33c17d,_0x7a109c['error']['message']);return _0xb51c93(_0x7a109c[_0xb9bb('0x14')][_0xb9bb('0x16')]);}else{logger[_0xb9bb('0xe')](_0xb9bb('0xf'),_0x33c17d,_0xb9bb('0x10'));_0xb51c93(_0x7a109c[_0xb9bb('0x17')][_0xb9bb('0x16')]);}})[_0xb9bb('0x18')](function(_0x3d6bbd){logger[_0xb9bb('0x14')](_0xb9bb('0xf'),_0x33c17d,_0x3d6bbd);_0x240b4e(_0x3d6bbd);});});} \ No newline at end of file +var _0x9ad0=['request\x20sent','debug','ZendeskConfiguration,\x20%s,\x20%s,\x20%s','error','code','message','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','ZendeskConfiguration,\x20%s,\x20%s'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x9ad0,0xbf));var _0x09ad=function(_0x562942,_0x5e94e4){_0x562942=_0x562942-0x0;var _0x783b1b=_0x9ad0[_0x562942];return _0x783b1b;};'use strict';var _=require(_0x09ad('0x0'));var util=require(_0x09ad('0x1'));var moment=require(_0x09ad('0x2'));var BPromise=require(_0x09ad('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x09ad('0x4'));var db=require(_0x09ad('0x5'))['db'];var utils=require(_0x09ad('0x6'));var logger=require(_0x09ad('0x7'))(_0x09ad('0x8'));var config=require(_0x09ad('0x9'));var jayson=require(_0x09ad('0xa'));var client=jayson[_0x09ad('0xb')][_0x09ad('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x6882ae,_0x2f2836,_0x5e0974){return new BPromise(function(_0xe4a92,_0x511b5f){return client[_0x09ad('0xd')](_0x6882ae,_0x5e0974)['then'](function(_0x28f713){logger[_0x09ad('0xe')](_0x09ad('0xf'),_0x2f2836,_0x09ad('0x10'));logger[_0x09ad('0x11')](_0x09ad('0x12'),_0x2f2836,_0x09ad('0x10'),JSON['stringify'](_0x28f713));if(_0x28f713[_0x09ad('0x13')]){if(_0x28f713['error'][_0x09ad('0x14')]===0x1f4){logger[_0x09ad('0x13')](_0x09ad('0xf'),_0x2f2836,_0x28f713[_0x09ad('0x13')][_0x09ad('0x15')]);return _0x511b5f(_0x28f713[_0x09ad('0x13')][_0x09ad('0x15')]);}logger[_0x09ad('0x13')]('ZendeskConfiguration,\x20%s,\x20%s',_0x2f2836,_0x28f713[_0x09ad('0x13')][_0x09ad('0x15')]);return _0xe4a92(_0x28f713[_0x09ad('0x13')][_0x09ad('0x15')]);}else{logger[_0x09ad('0xe')](_0x09ad('0xf'),_0x2f2836,'request\x20sent');_0xe4a92(_0x28f713[_0x09ad('0x16')][_0x09ad('0x15')]);}})['catch'](function(_0x3c7150){logger[_0x09ad('0x13')](_0x09ad('0xf'),_0x2f2836,_0x3c7150);_0x511b5f(_0x3c7150);});});} \ No newline at end of file diff --git a/server/api/intZendeskField/index.js b/server/api/intZendeskField/index.js index 75ba7c4..56bdaf6 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 _0xa7e7=['../../components/interaction/service','../../config/environment','./intZendeskField.controller','index','get','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x1d9aa0,_0x272488){var _0x226868=function(_0x17127c){while(--_0x17127c){_0x1d9aa0['push'](_0x1d9aa0['shift']());}};_0x226868(++_0x272488);}(_0xa7e7,0x117));var _0x7a7e=function(_0x1c58ef,_0xcba064){_0x1c58ef=_0x1c58ef-0x0;var _0x1a1714=_0xa7e7[_0x1c58ef];return _0x1a1714;};'use strict';var multer=require('multer');var util=require(_0x7a7e('0x0'));var path=require(_0x7a7e('0x1'));var timeout=require(_0x7a7e('0x2'));var express=require(_0x7a7e('0x3'));var router=express[_0x7a7e('0x4')]();var fs_extra=require(_0x7a7e('0x5'));var auth=require(_0x7a7e('0x6'));var interaction=require(_0x7a7e('0x7'));var config=require(_0x7a7e('0x8'));var controller=require(_0x7a7e('0x9'));router['get']('/',auth['isAuthenticated'](),controller[_0x7a7e('0xa')]);router[_0x7a7e('0xb')](_0x7a7e('0xc'),auth[_0x7a7e('0xd')](),controller[_0x7a7e('0xe')]);router[_0x7a7e('0xf')]('/',auth['isAuthenticated'](),controller[_0x7a7e('0x10')]);router[_0x7a7e('0x11')](_0x7a7e('0xc'),auth['isAuthenticated'](),controller[_0x7a7e('0x12')]);router[_0x7a7e('0x13')]('/:id',auth[_0x7a7e('0xd')](),controller[_0x7a7e('0x14')]);module[_0x7a7e('0x15')]=router; \ No newline at end of file +var _0xd92e=['/:id','update','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./intZendeskField.controller','get','isAuthenticated','index','show','create','put'];(function(_0x55046c,_0x28a9d7){var _0x3fb7c3=function(_0x32975e){while(--_0x32975e){_0x55046c['push'](_0x55046c['shift']());}};_0x3fb7c3(++_0x28a9d7);}(_0xd92e,0xaf));var _0xed92=function(_0x2ad7f7,_0x16e6c1){_0x2ad7f7=_0x2ad7f7-0x0;var _0x5b8349=_0xd92e[_0x2ad7f7];return _0x5b8349;};'use strict';var multer=require(_0xed92('0x0'));var util=require(_0xed92('0x1'));var path=require('path');var timeout=require(_0xed92('0x2'));var express=require(_0xed92('0x3'));var router=express[_0xed92('0x4')]();var fs_extra=require(_0xed92('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xed92('0x6'));var config=require(_0xed92('0x7'));var controller=require(_0xed92('0x8'));router[_0xed92('0x9')]('/',auth[_0xed92('0xa')](),controller[_0xed92('0xb')]);router['get']('/:id',auth[_0xed92('0xa')](),controller[_0xed92('0xc')]);router['post']('/',auth[_0xed92('0xa')](),controller[_0xed92('0xd')]);router[_0xed92('0xe')](_0xed92('0xf'),auth[_0xed92('0xa')](),controller[_0xed92('0x10')]);router[_0xed92('0x11')](_0xed92('0xf'),auth[_0xed92('0xa')](),controller[_0xed92('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.attributes.js b/server/api/intZendeskField/intZendeskField.attributes.js index 2062149..d6b5c23 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 _0x64ed=['BOOLEAN','sequelize','exports','ENUM','string','variable','customVariable','STRING'];(function(_0x103817,_0x401c31){var _0x7ef8b7=function(_0x276c08){while(--_0x276c08){_0x103817['push'](_0x103817['shift']());}};_0x7ef8b7(++_0x401c31);}(_0x64ed,0x101));var _0xd64e=function(_0x99189b,_0x1d5f56){_0x99189b=_0x99189b-0x0;var _0x2ce25c=_0x64ed[_0x99189b];return _0x2ce25c;};'use strict';var Sequelize=require(_0xd64e('0x0'));module[_0xd64e('0x1')]={'type':{'type':Sequelize[_0xd64e('0x2')](_0xd64e('0x3'),_0xd64e('0x4'),_0xd64e('0x5'),'keyValue','picklist'),'defaultValue':'string'},'content':{'type':Sequelize[_0xd64e('0x6')]},'key':{'type':Sequelize[_0xd64e('0x6')]},'keyType':{'type':Sequelize['ENUM'](_0xd64e('0x3'),'variable',_0xd64e('0x5'))},'keyContent':{'type':Sequelize['STRING']},'idField':{'type':Sequelize[_0xd64e('0x6')]},'nameField':{'type':Sequelize[_0xd64e('0x6')]},'customField':{'type':Sequelize[_0xd64e('0x7')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xd64e('0x6')]}}; \ No newline at end of file +var _0xf584=['exports','ENUM','string','variable','customVariable','keyValue','picklist','STRING','BOOLEAN','sequelize'];(function(_0x45ed8b,_0x29a320){var _0x541c39=function(_0x2fa28d){while(--_0x2fa28d){_0x45ed8b['push'](_0x45ed8b['shift']());}};_0x541c39(++_0x29a320);}(_0xf584,0x12b));var _0x4f58=function(_0x5224b2,_0x2baba8){_0x5224b2=_0x5224b2-0x0;var _0x4ed38a=_0xf584[_0x5224b2];return _0x4ed38a;};'use strict';var Sequelize=require(_0x4f58('0x0'));module[_0x4f58('0x1')]={'type':{'type':Sequelize[_0x4f58('0x2')](_0x4f58('0x3'),_0x4f58('0x4'),_0x4f58('0x5'),_0x4f58('0x6'),_0x4f58('0x7')),'defaultValue':_0x4f58('0x3')},'content':{'type':Sequelize[_0x4f58('0x8')]},'key':{'type':Sequelize[_0x4f58('0x8')]},'keyType':{'type':Sequelize['ENUM'](_0x4f58('0x3'),_0x4f58('0x4'),_0x4f58('0x5'))},'keyContent':{'type':Sequelize[_0x4f58('0x8')]},'idField':{'type':Sequelize[_0x4f58('0x8')]},'nameField':{'type':Sequelize[_0x4f58('0x8')]},'customField':{'type':Sequelize[_0x4f58('0x9')],'defaultValue':!![]},'variableName':{'type':Sequelize[_0x4f58('0x8')]}}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.controller.js b/server/api/intZendeskField/intZendeskField.controller.js index a86fd7d..302289b 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 _0x4bf2=['where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','rawAttributes','find','create','body','update','params','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/utils','../../config/license/util','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','destroy','then','sendStatus','error','name','index','map','ZendeskField','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','length','nolimit','sort'];(function(_0x438778,_0x81b5d){var _0x2de8b7=function(_0x3c668f){while(--_0x3c668f){_0x438778['push'](_0x438778['shift']());}};_0x2de8b7(++_0x81b5d);}(_0x4bf2,0xa3));var _0x24bf=function(_0x3c3528,_0x2bbe98){_0x3c3528=_0x3c3528-0x0;var _0x3a0e95=_0x4bf2[_0x3c3528];return _0x3a0e95;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x24bf('0x0'));var zipdir=require(_0x24bf('0x1'));var jsonpatch=require(_0x24bf('0x2'));var rp=require(_0x24bf('0x3'));var moment=require(_0x24bf('0x4'));var BPromise=require(_0x24bf('0x5'));var Mustache=require(_0x24bf('0x6'));var util=require(_0x24bf('0x7'));var path=require(_0x24bf('0x8'));var sox=require(_0x24bf('0x9'));var csv=require('to-csv');var ejs=require(_0x24bf('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x24bf('0xb'));var crypto=require(_0x24bf('0xc'));var jsforce=require(_0x24bf('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x24bf('0xe'));var querystring=require(_0x24bf('0xf'));var Papa=require(_0x24bf('0x10'));var Redis=require(_0x24bf('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x24bf('0x12'));var as=require(_0x24bf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')('api');var utils=require(_0x24bf('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x24bf('0x15'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x592119,_0x1d561a){_0x1d561a=_0x1d561a||0xcc;return function(_0x14085f){if(_0x14085f){return _0x592119['sendStatus'](_0x1d561a);}return _0x592119[_0x24bf('0x16')](_0x1d561a)[_0x24bf('0x17')]();};}function respondWithResult(_0x480f73,_0x281dbd){_0x281dbd=_0x281dbd||0xc8;return function(_0x27d3c4){if(_0x27d3c4){return _0x480f73['status'](_0x281dbd)[_0x24bf('0x18')](_0x27d3c4);}};}function respondWithFilteredResult(_0x59fdd2,_0x5681da){return function(_0x14a274){if(_0x14a274){var _0x401523=typeof _0x5681da[_0x24bf('0x19')]===_0x24bf('0x1a')&&typeof _0x5681da[_0x24bf('0x1b')]===_0x24bf('0x1a');var _0x2a2cd6=_0x14a274['count'];var _0x43eef0=_0x401523?0x0:_0x5681da[_0x24bf('0x19')];var _0x3ae6ae=_0x401523?_0x14a274['count']:_0x5681da[_0x24bf('0x19')]+_0x5681da[_0x24bf('0x1b')];var _0x49bc50;if(_0x3ae6ae>=_0x2a2cd6){_0x3ae6ae=_0x2a2cd6;_0x49bc50=0xc8;}else{_0x49bc50=0xce;}_0x59fdd2[_0x24bf('0x16')](_0x49bc50);return _0x59fdd2[_0x24bf('0x1c')](_0x24bf('0x1d'),_0x43eef0+'-'+_0x3ae6ae+'/'+_0x2a2cd6)[_0x24bf('0x18')](_0x14a274);}return null;};}function patchUpdates(_0x534799){return function(_0x1ec416){try{jsonpatch[_0x24bf('0x1e')](_0x1ec416,_0x534799,!![]);}catch(_0x4a76b3){return BPromise[_0x24bf('0x1f')](_0x4a76b3);}return _0x1ec416['save']();};}function saveUpdates(_0x2061c6,_0x58debd){return function(_0x48c54a){if(_0x48c54a){return _0x48c54a['update'](_0x2061c6)['then'](function(_0x301a9e){return _0x301a9e;});}return null;};}function removeEntity(_0x3e8394,_0x197d92){return function(_0xa8eb11){if(_0xa8eb11){return _0xa8eb11[_0x24bf('0x20')]()[_0x24bf('0x21')](function(){_0x3e8394[_0x24bf('0x16')](0xcc)[_0x24bf('0x17')]();});}};}function handleEntityNotFound(_0x5a10cb,_0x262b25){return function(_0x17d027){if(!_0x17d027){_0x5a10cb[_0x24bf('0x22')](0x194);}return _0x17d027;};}function handleError(_0x2e793d,_0x5567f6){_0x5567f6=_0x5567f6||0x1f4;return function(_0x261802){logger[_0x24bf('0x23')](_0x261802['stack']);if(_0x261802[_0x24bf('0x24')]){delete _0x261802[_0x24bf('0x24')];}_0x2e793d[_0x24bf('0x16')](_0x5567f6)['send'](_0x261802);};}exports[_0x24bf('0x25')]=function(_0x259c5a,_0x1ecc64){var _0x199f2d={},_0x1e3736={},_0x56e313={'count':0x0,'rows':[]};var _0x10d6fa=_[_0x24bf('0x26')](db[_0x24bf('0x27')]['rawAttributes'],function(_0x5b61f4){return{'name':_0x5b61f4[_0x24bf('0x28')],'type':_0x5b61f4[_0x24bf('0x29')][_0x24bf('0x2a')]};});_0x1e3736['model']=_[_0x24bf('0x26')](_0x10d6fa,_0x24bf('0x24'));_0x1e3736['query']=_[_0x24bf('0x2b')](_0x259c5a[_0x24bf('0x2c')]);_0x1e3736[_0x24bf('0x2d')]=_[_0x24bf('0x2e')](_0x1e3736[_0x24bf('0x2f')],_0x1e3736['query']);_0x199f2d[_0x24bf('0x30')]=_['intersection'](_0x1e3736[_0x24bf('0x2f')],qs[_0x24bf('0x31')](_0x259c5a[_0x24bf('0x2c')][_0x24bf('0x31')]));_0x199f2d[_0x24bf('0x30')]=_0x199f2d['attributes'][_0x24bf('0x32')]?_0x199f2d['attributes']:_0x1e3736['model'];if(!_0x259c5a['query']['hasOwnProperty'](_0x24bf('0x33'))){_0x199f2d[_0x24bf('0x1b')]=qs[_0x24bf('0x1b')](_0x259c5a[_0x24bf('0x2c')][_0x24bf('0x1b')]);_0x199f2d['offset']=qs[_0x24bf('0x19')](_0x259c5a[_0x24bf('0x2c')]['offset']);}_0x199f2d['order']=qs['sort'](_0x259c5a[_0x24bf('0x2c')][_0x24bf('0x34')]);_0x199f2d[_0x24bf('0x35')]=qs[_0x24bf('0x2d')](_[_0x24bf('0x36')](_0x259c5a['query'],_0x1e3736[_0x24bf('0x2d')]),_0x10d6fa);if(_0x259c5a['query'][_0x24bf('0x37')]){_0x199f2d['where']=_[_0x24bf('0x38')](_0x199f2d['where'],{'$or':_[_0x24bf('0x26')](_0x10d6fa,function(_0x210cde){if(_0x210cde[_0x24bf('0x29')]!==_0x24bf('0x39')){var _0x32161e={};_0x32161e[_0x210cde[_0x24bf('0x24')]]={'$like':'%'+_0x259c5a[_0x24bf('0x2c')][_0x24bf('0x37')]+'%'};return _0x32161e;}})});}_0x199f2d=_[_0x24bf('0x38')]({},_0x199f2d,_0x259c5a[_0x24bf('0x3a')]);var _0x23a44b={'where':_0x199f2d[_0x24bf('0x35')]};return db[_0x24bf('0x27')][_0x24bf('0x3b')](_0x23a44b)[_0x24bf('0x21')](function(_0xdae915){_0x56e313[_0x24bf('0x3b')]=_0xdae915;if(_0x259c5a['query'][_0x24bf('0x3c')]){_0x199f2d[_0x24bf('0x3d')]=[{'all':!![]}];}return db[_0x24bf('0x27')][_0x24bf('0x3e')](_0x199f2d);})[_0x24bf('0x21')](function(_0x30af6c){_0x56e313[_0x24bf('0x3f')]=_0x30af6c;return _0x56e313;})['then'](respondWithFilteredResult(_0x1ecc64,_0x199f2d))[_0x24bf('0x40')](handleError(_0x1ecc64,null));};exports[_0x24bf('0x41')]=function(_0x246514,_0x3cc53f){var _0x2b76f7={'raw':!![],'where':{'id':_0x246514['params']['id']}},_0x125ee1={};_0x125ee1[_0x24bf('0x2f')]=_[_0x24bf('0x2b')](db['ZendeskField'][_0x24bf('0x42')]);_0x125ee1['query']=_[_0x24bf('0x2b')](_0x246514[_0x24bf('0x2c')]);_0x125ee1[_0x24bf('0x2d')]=_[_0x24bf('0x2e')](_0x125ee1['model'],_0x125ee1[_0x24bf('0x2c')]);_0x2b76f7['attributes']=_[_0x24bf('0x2e')](_0x125ee1[_0x24bf('0x2f')],qs['fields'](_0x246514[_0x24bf('0x2c')]['fields']));_0x2b76f7[_0x24bf('0x30')]=_0x2b76f7[_0x24bf('0x30')]['length']?_0x2b76f7[_0x24bf('0x30')]:_0x125ee1[_0x24bf('0x2f')];if(_0x246514['query'][_0x24bf('0x3c')]){_0x2b76f7[_0x24bf('0x3d')]=[{'all':!![]}];}_0x2b76f7=_[_0x24bf('0x38')]({},_0x2b76f7,_0x246514[_0x24bf('0x3a')]);return db['ZendeskField'][_0x24bf('0x43')](_0x2b76f7)[_0x24bf('0x21')](handleEntityNotFound(_0x3cc53f,null))['then'](respondWithResult(_0x3cc53f,null))[_0x24bf('0x40')](handleError(_0x3cc53f,null));};exports[_0x24bf('0x44')]=function(_0x5338dd,_0x15488e){return db[_0x24bf('0x27')][_0x24bf('0x44')](_0x5338dd[_0x24bf('0x45')],{})[_0x24bf('0x21')](respondWithResult(_0x15488e,0xc9))[_0x24bf('0x40')](handleError(_0x15488e,null));};exports[_0x24bf('0x46')]=function(_0x33951b,_0x552d7f){if(_0x33951b[_0x24bf('0x45')]['id']){delete _0x33951b[_0x24bf('0x45')]['id'];}return db[_0x24bf('0x27')]['find']({'where':{'id':_0x33951b[_0x24bf('0x47')]['id']}})[_0x24bf('0x21')](handleEntityNotFound(_0x552d7f,null))[_0x24bf('0x21')](saveUpdates(_0x33951b['body'],null))[_0x24bf('0x21')](respondWithResult(_0x552d7f,null))[_0x24bf('0x40')](handleError(_0x552d7f,null));};exports['destroy']=function(_0x115e72,_0x418780){return db[_0x24bf('0x27')][_0x24bf('0x43')]({'where':{'id':_0x115e72[_0x24bf('0x47')]['id']}})[_0x24bf('0x21')](handleEntityNotFound(_0x418780,null))['then'](removeEntity(_0x418780,null))[_0x24bf('0x40')](handleError(_0x418780,null));}; \ No newline at end of file +var _0x76d8=['desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','json','undefined','limit','count','status','set','Content-Range','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','hasOwnProperty','nolimit','offset','order','sort','where','pick','merge','filter','options','includeAll','include','ZendeskField','findAll','rows','show','params','length','catch','create','body','find','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x76d8,0x168));var _0x876d=function(_0x233754,_0x293839){_0x233754=_0x233754-0x0;var _0x382b0d=_0x76d8[_0x233754];return _0x382b0d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x876d('0x0'));var zipdir=require(_0x876d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x876d('0x2'));var moment=require(_0x876d('0x3'));var BPromise=require(_0x876d('0x4'));var Mustache=require(_0x876d('0x5'));var util=require(_0x876d('0x6'));var path=require(_0x876d('0x7'));var sox=require(_0x876d('0x8'));var csv=require(_0x876d('0x9'));var ejs=require(_0x876d('0xa'));var fs=require('fs');var fs_extra=require(_0x876d('0xb'));var _=require(_0x876d('0xc'));var squel=require('squel');var crypto=require(_0x876d('0xd'));var jsforce=require(_0x876d('0xe'));var deskjs=require(_0x876d('0xf'));var toCsv=require(_0x876d('0x9'));var querystring=require('querystring');var Papa=require(_0x876d('0x10'));var Redis=require(_0x876d('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x876d('0x12'));var as=require(_0x876d('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x876d('0x14'));var utils=require(_0x876d('0x15'));var config=require(_0x876d('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x876d('0x17'))['db'];function respondWithStatusCode(_0x5229e9,_0x21f2f4){_0x21f2f4=_0x21f2f4||0xcc;return function(_0x46de9d){if(_0x46de9d){return _0x5229e9[_0x876d('0x18')](_0x21f2f4);}return _0x5229e9['status'](_0x21f2f4)[_0x876d('0x19')]();};}function respondWithResult(_0x143df8,_0x547a6b){_0x547a6b=_0x547a6b||0xc8;return function(_0x2887cb){if(_0x2887cb){return _0x143df8['status'](_0x547a6b)[_0x876d('0x1a')](_0x2887cb);}};}function respondWithFilteredResult(_0x2b1f5a,_0x3929e2){return function(_0x26be54){if(_0x26be54){var _0x9da73d=typeof _0x3929e2['offset']===_0x876d('0x1b')&&typeof _0x3929e2[_0x876d('0x1c')]===_0x876d('0x1b');var _0xe85478=_0x26be54[_0x876d('0x1d')];var _0x5c4fea=_0x9da73d?0x0:_0x3929e2['offset'];var _0x418ccf=_0x9da73d?_0x26be54['count']:_0x3929e2['offset']+_0x3929e2[_0x876d('0x1c')];var _0xb3a302;if(_0x418ccf>=_0xe85478){_0x418ccf=_0xe85478;_0xb3a302=0xc8;}else{_0xb3a302=0xce;}_0x2b1f5a[_0x876d('0x1e')](_0xb3a302);return _0x2b1f5a[_0x876d('0x1f')](_0x876d('0x20'),_0x5c4fea+'-'+_0x418ccf+'/'+_0xe85478)[_0x876d('0x1a')](_0x26be54);}return null;};}function patchUpdates(_0x3f37d0){return function(_0x22e3e7){try{jsonpatch['apply'](_0x22e3e7,_0x3f37d0,!![]);}catch(_0x14c5ea){return BPromise[_0x876d('0x21')](_0x14c5ea);}return _0x22e3e7[_0x876d('0x22')]();};}function saveUpdates(_0x506a0e,_0x358712){return function(_0x2de362){if(_0x2de362){return _0x2de362[_0x876d('0x23')](_0x506a0e)[_0x876d('0x24')](function(_0x37253d){return _0x37253d;});}return null;};}function removeEntity(_0x5200b6,_0x573f1a){return function(_0x1828fa){if(_0x1828fa){return _0x1828fa['destroy']()[_0x876d('0x24')](function(){_0x5200b6[_0x876d('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0x231043,_0x179e36){return function(_0xae777b){if(!_0xae777b){_0x231043[_0x876d('0x18')](0x194);}return _0xae777b;};}function handleError(_0x6706e6,_0xa0ae12){_0xa0ae12=_0xa0ae12||0x1f4;return function(_0x467a73){logger[_0x876d('0x25')](_0x467a73[_0x876d('0x26')]);if(_0x467a73['name']){delete _0x467a73[_0x876d('0x27')];}_0x6706e6[_0x876d('0x1e')](_0xa0ae12)[_0x876d('0x28')](_0x467a73);};}exports[_0x876d('0x29')]=function(_0x42f661,_0x1f8016){var _0x256075={},_0x1b6002={},_0x547956={'count':0x0,'rows':[]};var _0x455975=_[_0x876d('0x2a')](db['ZendeskField'][_0x876d('0x2b')],function(_0x44f94f){return{'name':_0x44f94f[_0x876d('0x2c')],'type':_0x44f94f[_0x876d('0x2d')][_0x876d('0x2e')]};});_0x1b6002['model']=_['map'](_0x455975,_0x876d('0x27'));_0x1b6002[_0x876d('0x2f')]=_[_0x876d('0x30')](_0x42f661[_0x876d('0x2f')]);_0x1b6002[_0x876d('0x31')]=_[_0x876d('0x32')](_0x1b6002[_0x876d('0x33')],_0x1b6002[_0x876d('0x2f')]);_0x256075[_0x876d('0x34')]=_['intersection'](_0x1b6002[_0x876d('0x33')],qs['fields'](_0x42f661[_0x876d('0x2f')]['fields']));_0x256075[_0x876d('0x34')]=_0x256075[_0x876d('0x34')]['length']?_0x256075['attributes']:_0x1b6002['model'];if(!_0x42f661[_0x876d('0x2f')][_0x876d('0x35')](_0x876d('0x36'))){_0x256075['limit']=qs[_0x876d('0x1c')](_0x42f661[_0x876d('0x2f')][_0x876d('0x1c')]);_0x256075['offset']=qs[_0x876d('0x37')](_0x42f661[_0x876d('0x2f')][_0x876d('0x37')]);}_0x256075[_0x876d('0x38')]=qs[_0x876d('0x39')](_0x42f661[_0x876d('0x2f')]['sort']);_0x256075[_0x876d('0x3a')]=qs[_0x876d('0x31')](_[_0x876d('0x3b')](_0x42f661[_0x876d('0x2f')],_0x1b6002[_0x876d('0x31')]),_0x455975);if(_0x42f661['query']['filter']){_0x256075['where']=_[_0x876d('0x3c')](_0x256075[_0x876d('0x3a')],{'$or':_['map'](_0x455975,function(_0x2150b1){if(_0x2150b1['type']!=='VIRTUAL'){var _0x28e90c={};_0x28e90c[_0x2150b1[_0x876d('0x27')]]={'$like':'%'+_0x42f661[_0x876d('0x2f')][_0x876d('0x3d')]+'%'};return _0x28e90c;}})});}_0x256075=_[_0x876d('0x3c')]({},_0x256075,_0x42f661[_0x876d('0x3e')]);var _0x40459d={'where':_0x256075[_0x876d('0x3a')]};return db['ZendeskField']['count'](_0x40459d)[_0x876d('0x24')](function(_0x3078a2){_0x547956[_0x876d('0x1d')]=_0x3078a2;if(_0x42f661['query'][_0x876d('0x3f')]){_0x256075[_0x876d('0x40')]=[{'all':!![]}];}return db[_0x876d('0x41')][_0x876d('0x42')](_0x256075);})[_0x876d('0x24')](function(_0x5a0940){_0x547956[_0x876d('0x43')]=_0x5a0940;return _0x547956;})[_0x876d('0x24')](respondWithFilteredResult(_0x1f8016,_0x256075))['catch'](handleError(_0x1f8016,null));};exports[_0x876d('0x44')]=function(_0xf6cd12,_0x2e11a5){var _0x74cc1={'raw':!![],'where':{'id':_0xf6cd12[_0x876d('0x45')]['id']}},_0x3c4a34={};_0x3c4a34['model']=_[_0x876d('0x30')](db[_0x876d('0x41')][_0x876d('0x2b')]);_0x3c4a34[_0x876d('0x2f')]=_['keys'](_0xf6cd12[_0x876d('0x2f')]);_0x3c4a34[_0x876d('0x31')]=_[_0x876d('0x32')](_0x3c4a34[_0x876d('0x33')],_0x3c4a34[_0x876d('0x2f')]);_0x74cc1[_0x876d('0x34')]=_[_0x876d('0x32')](_0x3c4a34[_0x876d('0x33')],qs['fields'](_0xf6cd12[_0x876d('0x2f')]['fields']));_0x74cc1[_0x876d('0x34')]=_0x74cc1['attributes'][_0x876d('0x46')]?_0x74cc1[_0x876d('0x34')]:_0x3c4a34[_0x876d('0x33')];if(_0xf6cd12[_0x876d('0x2f')][_0x876d('0x3f')]){_0x74cc1[_0x876d('0x40')]=[{'all':!![]}];}_0x74cc1=_[_0x876d('0x3c')]({},_0x74cc1,_0xf6cd12['options']);return db[_0x876d('0x41')]['find'](_0x74cc1)['then'](handleEntityNotFound(_0x2e11a5,null))[_0x876d('0x24')](respondWithResult(_0x2e11a5,null))[_0x876d('0x47')](handleError(_0x2e11a5,null));};exports[_0x876d('0x48')]=function(_0x2c06cc,_0x5b62c3){return db[_0x876d('0x41')]['create'](_0x2c06cc[_0x876d('0x49')],{})['then'](respondWithResult(_0x5b62c3,0xc9))[_0x876d('0x47')](handleError(_0x5b62c3,null));};exports[_0x876d('0x23')]=function(_0x3ee0e8,_0x3b05f3){if(_0x3ee0e8[_0x876d('0x49')]['id']){delete _0x3ee0e8[_0x876d('0x49')]['id'];}return db[_0x876d('0x41')][_0x876d('0x4a')]({'where':{'id':_0x3ee0e8[_0x876d('0x45')]['id']}})[_0x876d('0x24')](handleEntityNotFound(_0x3b05f3,null))[_0x876d('0x24')](saveUpdates(_0x3ee0e8[_0x876d('0x49')],null))[_0x876d('0x24')](respondWithResult(_0x3b05f3,null))[_0x876d('0x47')](handleError(_0x3b05f3,null));};exports['destroy']=function(_0x1d9fcd,_0x7f9a83){return db[_0x876d('0x41')]['find']({'where':{'id':_0x1d9fcd[_0x876d('0x45')]['id']}})[_0x876d('0x24')](handleEntityNotFound(_0x7f9a83,null))[_0x876d('0x24')](removeEntity(_0x7f9a83,null))['catch'](handleError(_0x7f9a83,null));}; \ No newline at end of file diff --git a/server/api/intZendeskField/intZendeskField.model.js b/server/api/intZendeskField/intZendeskField.model.js index 967ecc2..93dbf24 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 _0x69cb=['../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','define','ZendeskField','int_zendesk_fields','zendesk_unique_index','FieldId','lodash','util'];(function(_0x117f87,_0x4a1be5){var _0x3b46ad=function(_0x36e7e0){while(--_0x36e7e0){_0x117f87['push'](_0x117f87['shift']());}};_0x3b46ad(++_0x4a1be5);}(_0x69cb,0x148));var _0xb69c=function(_0x4574b0,_0x3bd754){_0x4574b0=_0x4574b0-0x0;var _0x3d720c=_0x69cb[_0x4574b0];return _0x3d720c;};'use strict';var _=require(_0xb69c('0x0'));var util=require(_0xb69c('0x1'));var logger=require(_0xb69c('0x2'))(_0xb69c('0x3'));var moment=require('moment');var BPromise=require(_0xb69c('0x4'));var rp=require(_0xb69c('0x5'));var fs=require('fs');var path=require(_0xb69c('0x6'));var rimraf=require(_0xb69c('0x7'));var config=require(_0xb69c('0x8'));var attributes=require(_0xb69c('0x9'));module['exports']=function(_0x47fd2b,_0x1c9269){return _0x47fd2b[_0xb69c('0xa')](_0xb69c('0xb'),attributes,{'tableName':_0xb69c('0xc'),'paranoid':![],'indexes':[{'name':_0xb69c('0xd'),'fields':['idField',_0xb69c('0xe')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x2c35=['bluebird','request-promise','path','rimraf','../../config/environment','./intZendeskField.attributes','ZendeskField','int_zendesk_fields','zendesk_unique_index','idField','lodash','util','../../config/logger','api','moment'];(function(_0x273f3a,_0x3c3708){var _0x3272ab=function(_0xe3fe58){while(--_0xe3fe58){_0x273f3a['push'](_0x273f3a['shift']());}};_0x3272ab(++_0x3c3708);}(_0x2c35,0x154));var _0x52c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c35[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x52c3('0x0'));var util=require(_0x52c3('0x1'));var logger=require(_0x52c3('0x2'))(_0x52c3('0x3'));var moment=require(_0x52c3('0x4'));var BPromise=require(_0x52c3('0x5'));var rp=require(_0x52c3('0x6'));var fs=require('fs');var path=require(_0x52c3('0x7'));var rimraf=require(_0x52c3('0x8'));var config=require(_0x52c3('0x9'));var attributes=require(_0x52c3('0xa'));module['exports']=function(_0x1a60db,_0x1a7c6e){return _0x1a60db['define'](_0x52c3('0xb'),attributes,{'tableName':_0x52c3('0xc'),'paranoid':![],'indexes':[{'name':_0x52c3('0xd'),'fields':[_0x52c3('0xe'),'FieldId'],'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 dab47fd..ab7d621 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 _0xcefe=['rpc','../../config/environment','jayson/promise','client','request','then','info','ZendeskField,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5e447e,_0x333926){var _0x3d6e9b=function(_0x2bbe22){while(--_0x2bbe22){_0x5e447e['push'](_0x5e447e['shift']());}};_0x3d6e9b(++_0x333926);}(_0xcefe,0x1dd));var _0xecef=function(_0x1bbce7,_0x581b65){_0x1bbce7=_0x1bbce7-0x0;var _0xe3a3ef=_0xcefe[_0x1bbce7];return _0xe3a3ef;};'use strict';var _=require(_0xecef('0x0'));var util=require(_0xecef('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xecef('0x2'));var fs=require('fs');var Redis=require(_0xecef('0x3'));var db=require(_0xecef('0x4'))['db'];var utils=require(_0xecef('0x5'));var logger=require(_0xecef('0x6'))(_0xecef('0x7'));var config=require(_0xecef('0x8'));var jayson=require(_0xecef('0x9'));var client=jayson[_0xecef('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x41f4f0,_0x46395a,_0x4bb5ad){return new BPromise(function(_0x37a802,_0x45e953){return client[_0xecef('0xb')](_0x41f4f0,_0x4bb5ad)[_0xecef('0xc')](function(_0x2bdc23){logger[_0xecef('0xd')](_0xecef('0xe'),_0x46395a,_0xecef('0xf'));logger[_0xecef('0x10')]('ZendeskField,\x20%s,\x20%s,\x20%s',_0x46395a,_0xecef('0xf'),JSON[_0xecef('0x11')](_0x2bdc23));if(_0x2bdc23[_0xecef('0x12')]){if(_0x2bdc23['error'][_0xecef('0x13')]===0x1f4){logger[_0xecef('0x12')]('ZendeskField,\x20%s,\x20%s',_0x46395a,_0x2bdc23[_0xecef('0x12')]['message']);return _0x45e953(_0x2bdc23[_0xecef('0x12')][_0xecef('0x14')]);}logger['error'](_0xecef('0xe'),_0x46395a,_0x2bdc23[_0xecef('0x12')]['message']);return _0x37a802(_0x2bdc23[_0xecef('0x12')][_0xecef('0x14')]);}else{logger['info'](_0xecef('0xe'),_0x46395a,_0xecef('0xf'));_0x37a802(_0x2bdc23[_0xecef('0x15')][_0xecef('0x14')]);}})['catch'](function(_0x49646f){logger[_0xecef('0x12')]('ZendeskField,\x20%s,\x20%s',_0x46395a,_0x49646f);_0x45e953(_0x49646f);});});} \ No newline at end of file +var _0x4d96=['client','http','then','ZendeskField,\x20%s,\x20%s','request\x20sent','ZendeskField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util','moment','randomstring','ioredis','../../config/utils','rpc','../../config/environment','jayson/promise'];(function(_0x7b68cc,_0x3f522e){var _0x36470e=function(_0x3b80ad){while(--_0x3b80ad){_0x7b68cc['push'](_0x7b68cc['shift']());}};_0x36470e(++_0x3f522e);}(_0x4d96,0x15f));var _0x64d9=function(_0x24a5bf,_0x1cc260){_0x24a5bf=_0x24a5bf-0x0;var _0x2f826f=_0x4d96[_0x24a5bf];return _0x2f826f;};'use strict';var _=require(_0x64d9('0x0'));var util=require(_0x64d9('0x1'));var moment=require(_0x64d9('0x2'));var BPromise=require('bluebird');var rs=require(_0x64d9('0x3'));var fs=require('fs');var Redis=require(_0x64d9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x64d9('0x5'));var logger=require('../../config/logger')(_0x64d9('0x6'));var config=require(_0x64d9('0x7'));var jayson=require(_0x64d9('0x8'));var client=jayson[_0x64d9('0x9')][_0x64d9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x292245,_0x31aa26,_0x58808d){return new BPromise(function(_0x24cab2,_0x1544f6){return client['request'](_0x292245,_0x58808d)[_0x64d9('0xb')](function(_0x5c482c){logger['info'](_0x64d9('0xc'),_0x31aa26,_0x64d9('0xd'));logger['debug'](_0x64d9('0xe'),_0x31aa26,_0x64d9('0xd'),JSON[_0x64d9('0xf')](_0x5c482c));if(_0x5c482c[_0x64d9('0x10')]){if(_0x5c482c[_0x64d9('0x10')][_0x64d9('0x11')]===0x1f4){logger[_0x64d9('0x10')](_0x64d9('0xc'),_0x31aa26,_0x5c482c[_0x64d9('0x10')]['message']);return _0x1544f6(_0x5c482c['error'][_0x64d9('0x12')]);}logger[_0x64d9('0x10')](_0x64d9('0xc'),_0x31aa26,_0x5c482c['error'][_0x64d9('0x12')]);return _0x24cab2(_0x5c482c[_0x64d9('0x10')][_0x64d9('0x12')]);}else{logger['info']('ZendeskField,\x20%s,\x20%s',_0x31aa26,_0x64d9('0xd'));_0x24cab2(_0x5c482c[_0x64d9('0x13')][_0x64d9('0x12')]);}})['catch'](function(_0x57ad91){logger[_0x64d9('0x10')]('ZendeskField,\x20%s,\x20%s',_0x31aa26,_0x57ad91);_0x1544f6(_0x57ad91);});});} \ No newline at end of file diff --git a/server/api/intZohoAccount/index.js b/server/api/intZohoAccount/index.js index 2894fc4..7d64c36 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 _0x3a14=['isAuthenticated','/:id','/:id/fields','post','create','/:id/configurations','addConfiguration','put','update','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get'];(function(_0xad13a,_0x1e98d6){var _0x5405ad=function(_0x24a505){while(--_0x24a505){_0xad13a['push'](_0xad13a['shift']());}};_0x5405ad(++_0x1e98d6);}(_0x3a14,0x69));var _0x43a1=function(_0x40e313,_0x5d101d){_0x40e313=_0x40e313-0x0;var _0x2eea5e=_0x3a14[_0x40e313];return _0x2eea5e;};'use strict';var multer=require(_0x43a1('0x0'));var util=require(_0x43a1('0x1'));var path=require(_0x43a1('0x2'));var timeout=require(_0x43a1('0x3'));var express=require('express');var router=express[_0x43a1('0x4')]();var fs_extra=require(_0x43a1('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x43a1('0x6'));var config=require(_0x43a1('0x7'));var controller=require('./intZohoAccount.controller');router[_0x43a1('0x8')]('/',auth[_0x43a1('0x9')](),controller['index']);router[_0x43a1('0x8')](_0x43a1('0xa'),auth['isAuthenticated'](),controller['show']);router['get']('/:id/configurations',auth[_0x43a1('0x9')](),controller['getConfigurations']);router[_0x43a1('0x8')](_0x43a1('0xb'),auth[_0x43a1('0x9')](),controller['getFields']);router[_0x43a1('0xc')]('/',auth[_0x43a1('0x9')](),controller[_0x43a1('0xd')]);router['post'](_0x43a1('0xe'),auth['isAuthenticated'](),controller[_0x43a1('0xf')]);router[_0x43a1('0x10')]('/:id',auth[_0x43a1('0x9')](),controller[_0x43a1('0x11')]);router['delete'](_0x43a1('0xa'),auth['isAuthenticated'](),controller[_0x43a1('0x12')]);module['exports']=router; \ No newline at end of file +var _0x2e32=['./intZohoAccount.controller','get','isAuthenticated','show','getConfigurations','/:id/fields','getFields','post','create','/:id/configurations','/:id','update','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x2154d1,_0x11a33e){var _0xef320=function(_0x19b339){while(--_0x19b339){_0x2154d1['push'](_0x2154d1['shift']());}};_0xef320(++_0x11a33e);}(_0x2e32,0xc6));var _0x22e3=function(_0x2e4e19,_0x493b50){_0x2e4e19=_0x2e4e19-0x0;var _0x9ba20b=_0x2e32[_0x2e4e19];return _0x9ba20b;};'use strict';var multer=require(_0x22e3('0x0'));var util=require(_0x22e3('0x1'));var path=require(_0x22e3('0x2'));var timeout=require(_0x22e3('0x3'));var express=require(_0x22e3('0x4'));var router=express[_0x22e3('0x5')]();var fs_extra=require(_0x22e3('0x6'));var auth=require(_0x22e3('0x7'));var interaction=require(_0x22e3('0x8'));var config=require('../../config/environment');var controller=require(_0x22e3('0x9'));router[_0x22e3('0xa')]('/',auth[_0x22e3('0xb')](),controller['index']);router[_0x22e3('0xa')]('/:id',auth[_0x22e3('0xb')](),controller[_0x22e3('0xc')]);router[_0x22e3('0xa')]('/:id/configurations',auth[_0x22e3('0xb')](),controller[_0x22e3('0xd')]);router[_0x22e3('0xa')](_0x22e3('0xe'),auth[_0x22e3('0xb')](),controller[_0x22e3('0xf')]);router[_0x22e3('0x10')]('/',auth['isAuthenticated'](),controller[_0x22e3('0x11')]);router[_0x22e3('0x10')](_0x22e3('0x12'),auth['isAuthenticated'](),controller['addConfiguration']);router['put'](_0x22e3('0x13'),auth[_0x22e3('0xb')](),controller[_0x22e3('0x14')]);router['delete'](_0x22e3('0x13'),auth[_0x22e3('0xb')](),controller[_0x22e3('0x15')]);module[_0x22e3('0x16')]=router; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.attributes.js b/server/api/intZohoAccount/intZohoAccount.attributes.js index 93bb7e1..eed1a28 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 _0x00bb=['STRING','sequelize','exports'];(function(_0x5489ef,_0x44910e){var _0x312c74=function(_0x2d8e68){while(--_0x2d8e68){_0x5489ef['push'](_0x5489ef['shift']());}};_0x312c74(++_0x44910e);}(_0x00bb,0x1d8));var _0xb00b=function(_0x46aff0,_0x122890){_0x46aff0=_0x46aff0-0x0;var _0x9d78cf=_0x00bb[_0x46aff0];return _0x9d78cf;};'use strict';var Sequelize=require(_0xb00b('0x0'));module[_0xb00b('0x1')]={'name':{'type':Sequelize[_0xb00b('0x2')]},'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0xb00b('0x2')]},'zone':{'type':Sequelize['STRING']},'clientId':{'type':Sequelize[_0xb00b('0x2')]},'clientSecret':{'type':Sequelize[_0xb00b('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize[_0xb00b('0x2')]},'refreshToken':{'type':Sequelize[_0xb00b('0x2')]}}; \ No newline at end of file +var _0x4ea3=['STRING','sequelize','exports'];(function(_0x582ccd,_0xa9ab43){var _0x11545d=function(_0x4010fa){while(--_0x4010fa){_0x582ccd['push'](_0x582ccd['shift']());}};_0x11545d(++_0xa9ab43);}(_0x4ea3,0x70));var _0x34ea=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x4ea3[_0x1facfa];return _0x9ec701;};'use strict';var Sequelize=require(_0x34ea('0x0'));module[_0x34ea('0x1')]={'name':{'type':Sequelize[_0x34ea('0x2')]},'description':{'type':Sequelize[_0x34ea('0x2')]},'host':{'type':Sequelize['STRING']},'zone':{'type':Sequelize[_0x34ea('0x2')]},'clientId':{'type':Sequelize['STRING']},'clientSecret':{'type':Sequelize[_0x34ea('0x2')]},'serverUrl':{'type':Sequelize['STRING'],'allowNull':![]},'code':{'type':Sequelize['STRING']},'refreshToken':{'type':Sequelize[_0x34ea('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.controller.js b/server/api/intZohoAccount/intZohoAccount.controller.js index 9141c0f..fb885ac 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 _0x23cb=['Calls','Zoho-oauthtoken\x20','response','error','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','remove','includes','system_mandatory','push','custom_field','data_type','picklist','pick_list_values','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','sox','ejs','fs-extra','squel','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../components/integrations/configuration','sendStatus','status','end','offset','undefined','limit','count','set','json','reject','save','update','destroy','then','name','send','map','ZohoAccount','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','sort','where','pick','merge','VIRTUAL','filter','includeAll','include','findAll','rows','catch','params','rawAttributes','fields','options','find','create','body','getConfigurations','findOne','order','nolimit','addConfiguration','AccountId','Subjects','getSubjects','channel','type','Descriptions','getDescriptions','ZohoConfiguration','ZohoField','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientId','refresh_token','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','host','zone','clientSecret','serverUrl','code','zoho.eu','com','slice','substring','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account'];(function(_0x318410,_0x451962){var _0x2898a3=function(_0x58e572){while(--_0x58e572){_0x318410['push'](_0x318410['shift']());}};_0x2898a3(++_0x451962);}(_0x23cb,0x19d));var _0xb23c=function(_0x5cd70a,_0x51f70a){_0x5cd70a=_0x5cd70a-0x0;var _0x28d47e=_0x23cb[_0x5cd70a];return _0x28d47e;};'use strict';var emlformat=require(_0xb23c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xb23c('0x1'));var jsonpatch=require(_0xb23c('0x2'));var rp=require(_0xb23c('0x3'));var moment=require('moment');var BPromise=require(_0xb23c('0x4'));var Mustache=require(_0xb23c('0x5'));var util=require(_0xb23c('0x6'));var path=require('path');var sox=require(_0xb23c('0x7'));var csv=require('to-csv');var ejs=require(_0xb23c('0x8'));var fs=require('fs');var fs_extra=require(_0xb23c('0x9'));var _=require('lodash');var squel=require(_0xb23c('0xa'));var crypto=require('crypto');var jsforce=require(_0xb23c('0xb'));var deskjs=require(_0xb23c('0xc'));var toCsv=require(_0xb23c('0xd'));var querystring=require(_0xb23c('0xe'));var Papa=require(_0xb23c('0xf'));var Redis=require(_0xb23c('0x10'));var authService=require(_0xb23c('0x11'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb23c('0x12'));var logger=require(_0xb23c('0x13'))(_0xb23c('0x14'));var utils=require(_0xb23c('0x15'));var config=require(_0xb23c('0x16'));var licenseUtil=require(_0xb23c('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xb23c('0x18'));function respondWithStatusCode(_0x5a2e89,_0x120d4d){_0x120d4d=_0x120d4d||0xcc;return function(_0x51085f){if(_0x51085f){return _0x5a2e89[_0xb23c('0x19')](_0x120d4d);}return _0x5a2e89[_0xb23c('0x1a')](_0x120d4d)[_0xb23c('0x1b')]();};}function respondWithResult(_0x3ba50f,_0x14df4c){_0x14df4c=_0x14df4c||0xc8;return function(_0x1d84c1){if(_0x1d84c1){return _0x3ba50f[_0xb23c('0x1a')](_0x14df4c)['json'](_0x1d84c1);}};}function respondWithFilteredResult(_0x32d57c,_0x274511){return function(_0x523070){if(_0x523070){var _0x58a3e2=typeof _0x274511[_0xb23c('0x1c')]===_0xb23c('0x1d')&&typeof _0x274511[_0xb23c('0x1e')]==='undefined';var _0x1e8631=_0x523070['count'];var _0x36fc4a=_0x58a3e2?0x0:_0x274511[_0xb23c('0x1c')];var _0x194f13=_0x58a3e2?_0x523070[_0xb23c('0x1f')]:_0x274511[_0xb23c('0x1c')]+_0x274511[_0xb23c('0x1e')];var _0x2be8bf;if(_0x194f13>=_0x1e8631){_0x194f13=_0x1e8631;_0x2be8bf=0xc8;}else{_0x2be8bf=0xce;}_0x32d57c[_0xb23c('0x1a')](_0x2be8bf);return _0x32d57c[_0xb23c('0x20')]('Content-Range',_0x36fc4a+'-'+_0x194f13+'/'+_0x1e8631)[_0xb23c('0x21')](_0x523070);}return null;};}function patchUpdates(_0x4ca412){return function(_0x3ecf81){try{jsonpatch['apply'](_0x3ecf81,_0x4ca412,!![]);}catch(_0x44a750){return BPromise[_0xb23c('0x22')](_0x44a750);}return _0x3ecf81[_0xb23c('0x23')]();};}function saveUpdates(_0x57ed18,_0x5c88f0){return function(_0x4e2f81){if(_0x4e2f81){return _0x4e2f81[_0xb23c('0x24')](_0x57ed18)['then'](function(_0x2a585b){return _0x2a585b;});}return null;};}function removeEntity(_0x3fec09,_0x15fee7){return function(_0x1eb834){if(_0x1eb834){return _0x1eb834[_0xb23c('0x25')]()[_0xb23c('0x26')](function(){_0x3fec09['status'](0xcc)[_0xb23c('0x1b')]();});}};}function handleEntityNotFound(_0x10ddca,_0x5be8bf){return function(_0x34ed59){if(!_0x34ed59){_0x10ddca[_0xb23c('0x19')](0x194);}return _0x34ed59;};}function handleError(_0x818138,_0x4681c0){_0x4681c0=_0x4681c0||0x1f4;return function(_0x5480c4){logger['error'](_0x5480c4['stack']);if(_0x5480c4[_0xb23c('0x27')]){delete _0x5480c4[_0xb23c('0x27')];}_0x818138[_0xb23c('0x1a')](_0x4681c0)[_0xb23c('0x28')](_0x5480c4);};}exports['index']=function(_0x4e0520,_0x142b1c){var _0x3c1d8c={},_0x37f2ec={},_0x3b5883={'count':0x0,'rows':[]};var _0x45136b=_[_0xb23c('0x29')](db[_0xb23c('0x2a')]['rawAttributes'],function(_0x150f43){return{'name':_0x150f43[_0xb23c('0x2b')],'type':_0x150f43['type'][_0xb23c('0x2c')]};});_0x37f2ec[_0xb23c('0x2d')]=_[_0xb23c('0x29')](_0x45136b,_0xb23c('0x27'));_0x37f2ec[_0xb23c('0x2e')]=_[_0xb23c('0x2f')](_0x4e0520['query']);_0x37f2ec[_0xb23c('0x30')]=_[_0xb23c('0x31')](_0x37f2ec[_0xb23c('0x2d')],_0x37f2ec['query']);_0x3c1d8c[_0xb23c('0x32')]=_[_0xb23c('0x31')](_0x37f2ec[_0xb23c('0x2d')],qs['fields'](_0x4e0520['query']['fields']));_0x3c1d8c[_0xb23c('0x32')]=_0x3c1d8c[_0xb23c('0x32')][_0xb23c('0x33')]?_0x3c1d8c[_0xb23c('0x32')]:_0x37f2ec[_0xb23c('0x2d')];if(!_0x4e0520[_0xb23c('0x2e')][_0xb23c('0x34')]('nolimit')){_0x3c1d8c['limit']=qs[_0xb23c('0x1e')](_0x4e0520['query'][_0xb23c('0x1e')]);_0x3c1d8c[_0xb23c('0x1c')]=qs['offset'](_0x4e0520[_0xb23c('0x2e')][_0xb23c('0x1c')]);}_0x3c1d8c['order']=qs['sort'](_0x4e0520[_0xb23c('0x2e')][_0xb23c('0x35')]);_0x3c1d8c[_0xb23c('0x36')]=qs[_0xb23c('0x30')](_[_0xb23c('0x37')](_0x4e0520[_0xb23c('0x2e')],_0x37f2ec[_0xb23c('0x30')]),_0x45136b);if(_0x4e0520['query']['filter']){_0x3c1d8c[_0xb23c('0x36')]=_[_0xb23c('0x38')](_0x3c1d8c[_0xb23c('0x36')],{'$or':_[_0xb23c('0x29')](_0x45136b,function(_0x25ea8d){if(_0x25ea8d['type']!==_0xb23c('0x39')){var _0x309f16={};_0x309f16[_0x25ea8d[_0xb23c('0x27')]]={'$like':'%'+_0x4e0520[_0xb23c('0x2e')][_0xb23c('0x3a')]+'%'};return _0x309f16;}})});}_0x3c1d8c=_[_0xb23c('0x38')]({},_0x3c1d8c,_0x4e0520['options']);var _0x106201={'where':_0x3c1d8c[_0xb23c('0x36')]};return db['ZohoAccount'][_0xb23c('0x1f')](_0x106201)[_0xb23c('0x26')](function(_0x422ec1){_0x3b5883[_0xb23c('0x1f')]=_0x422ec1;if(_0x4e0520['query'][_0xb23c('0x3b')]){_0x3c1d8c[_0xb23c('0x3c')]=[{'all':!![]}];}return db[_0xb23c('0x2a')][_0xb23c('0x3d')](_0x3c1d8c);})[_0xb23c('0x26')](function(_0x3f3374){_0x3b5883[_0xb23c('0x3e')]=_0x3f3374;return _0x3b5883;})['then'](respondWithFilteredResult(_0x142b1c,_0x3c1d8c))[_0xb23c('0x3f')](handleError(_0x142b1c,null));};exports['show']=function(_0x35b0cd,_0x49aad6){var _0x2cf50f={'raw':![],'where':{'id':_0x35b0cd[_0xb23c('0x40')]['id']}},_0x3c6d95={};_0x3c6d95[_0xb23c('0x2d')]=_[_0xb23c('0x2f')](db[_0xb23c('0x2a')][_0xb23c('0x41')]);_0x3c6d95[_0xb23c('0x2e')]=_[_0xb23c('0x2f')](_0x35b0cd[_0xb23c('0x2e')]);_0x3c6d95[_0xb23c('0x30')]=_[_0xb23c('0x31')](_0x3c6d95['model'],_0x3c6d95[_0xb23c('0x2e')]);_0x2cf50f[_0xb23c('0x32')]=_[_0xb23c('0x31')](_0x3c6d95[_0xb23c('0x2d')],qs[_0xb23c('0x42')](_0x35b0cd[_0xb23c('0x2e')][_0xb23c('0x42')]));_0x2cf50f[_0xb23c('0x32')]=_0x2cf50f[_0xb23c('0x32')][_0xb23c('0x33')]?_0x2cf50f['attributes']:_0x3c6d95[_0xb23c('0x2d')];if(_0x35b0cd[_0xb23c('0x2e')][_0xb23c('0x3b')]){_0x2cf50f[_0xb23c('0x3c')]=[{'all':!![]}];}_0x2cf50f=_[_0xb23c('0x38')]({},_0x2cf50f,_0x35b0cd[_0xb23c('0x43')]);return db['ZohoAccount'][_0xb23c('0x44')](_0x2cf50f)[_0xb23c('0x26')](handleEntityNotFound(_0x49aad6,null))[_0xb23c('0x26')](respondWithResult(_0x49aad6,null))[_0xb23c('0x3f')](handleError(_0x49aad6,null));};exports[_0xb23c('0x45')]=function(_0x4ac97b,_0x497a29){return db[_0xb23c('0x2a')][_0xb23c('0x45')](_0x4ac97b[_0xb23c('0x46')],{})[_0xb23c('0x26')](respondWithResult(_0x497a29,0xc9))[_0xb23c('0x3f')](handleError(_0x497a29,null));};exports[_0xb23c('0x24')]=function(_0x2afadd,_0x4c12cf){if(_0x2afadd[_0xb23c('0x46')]['id']){delete _0x2afadd[_0xb23c('0x46')]['id'];}return db[_0xb23c('0x2a')][_0xb23c('0x44')]({'where':{'id':_0x2afadd[_0xb23c('0x40')]['id']}})['then'](handleEntityNotFound(_0x4c12cf,null))[_0xb23c('0x26')](saveUpdates(_0x2afadd[_0xb23c('0x46')],null))[_0xb23c('0x26')](respondWithResult(_0x4c12cf,null))['catch'](handleError(_0x4c12cf,null));};exports[_0xb23c('0x25')]=function(_0x28dfed,_0x1bef1b){return db[_0xb23c('0x2a')][_0xb23c('0x44')]({'where':{'id':_0x28dfed[_0xb23c('0x40')]['id']}})[_0xb23c('0x26')](handleEntityNotFound(_0x1bef1b,null))['then'](removeEntity(_0x1bef1b,null))[_0xb23c('0x3f')](handleError(_0x1bef1b,null));};exports[_0xb23c('0x47')]=function(_0x32c803,_0x15655a,_0x48a63a){var _0x5be3d2={};var _0x5100cc={};var _0x273b9f;var _0x39b862;return db['ZohoAccount'][_0xb23c('0x48')]({'where':{'id':_0x32c803[_0xb23c('0x40')]['id']}})[_0xb23c('0x26')](handleEntityNotFound(_0x15655a,null))[_0xb23c('0x26')](function(_0x1b4b49){if(_0x1b4b49){_0x273b9f=_0x1b4b49;_0x5100cc[_0xb23c('0x2d')]=_[_0xb23c('0x2f')](db['ZohoConfiguration'][_0xb23c('0x41')]);_0x5100cc[_0xb23c('0x2e')]=_[_0xb23c('0x2f')](_0x32c803[_0xb23c('0x2e')]);_0x5100cc[_0xb23c('0x30')]=_['intersection'](_0x5100cc[_0xb23c('0x2d')],_0x5100cc['query']);_0x5be3d2[_0xb23c('0x32')]=_['intersection'](_0x5100cc[_0xb23c('0x2d')],qs['fields'](_0x32c803['query']['fields']));_0x5be3d2[_0xb23c('0x32')]=_0x5be3d2[_0xb23c('0x32')]['length']?_0x5be3d2[_0xb23c('0x32')]:_0x5100cc[_0xb23c('0x2d')];_0x5be3d2[_0xb23c('0x49')]=qs[_0xb23c('0x35')](_0x32c803[_0xb23c('0x2e')][_0xb23c('0x35')]);_0x5be3d2[_0xb23c('0x36')]=qs['filters'](_['pick'](_0x32c803[_0xb23c('0x2e')],_0x5100cc[_0xb23c('0x30')]));if(_0x32c803[_0xb23c('0x2e')]['filter']){_0x5be3d2['where']=_[_0xb23c('0x38')](_0x5be3d2[_0xb23c('0x36')],{'$or':_[_0xb23c('0x29')](_0x5be3d2['attributes'],function(_0x49592a){var _0x273755={};_0x273755[_0x49592a]={'$like':'%'+_0x32c803['query']['filter']+'%'};return _0x273755;})});}_0x5be3d2=_['merge']({},_0x5be3d2,_0x32c803[_0xb23c('0x43')]);return _0x273b9f[_0xb23c('0x47')](_0x5be3d2);}})[_0xb23c('0x26')](function(_0x1b7c2d){if(_0x1b7c2d){_0x39b862=_0x1b7c2d[_0xb23c('0x33')];if(!_0x32c803['query'][_0xb23c('0x34')](_0xb23c('0x4a'))){_0x5be3d2['limit']=qs[_0xb23c('0x1e')](_0x32c803[_0xb23c('0x2e')]['limit']);_0x5be3d2['offset']=qs['offset'](_0x32c803[_0xb23c('0x2e')]['offset']);}return _0x273b9f[_0xb23c('0x47')](_0x5be3d2);}})[_0xb23c('0x26')](function(_0x2188a5){if(_0x2188a5){return _0x2188a5?{'count':_0x39b862,'rows':_0x2188a5}:null;}})[_0xb23c('0x26')](respondWithResult(_0x15655a,null))['catch'](handleError(_0x15655a,null));};exports[_0xb23c('0x4b')]=function(_0x49cbdd,_0x15c611,_0x14c805){if(_0x49cbdd['body']['id']){delete _0x49cbdd['body']['id'];}return db[_0xb23c('0x2a')][_0xb23c('0x48')]({'where':{'id':_0x49cbdd[_0xb23c('0x40')]['id']}})[_0xb23c('0x26')](handleEntityNotFound(_0x15c611,null))[_0xb23c('0x26')](function(_0x213c4c){if(_0x213c4c){_0x49cbdd['body'][_0xb23c('0x4c')]=_0x213c4c['id'];_0x49cbdd[_0xb23c('0x46')][_0xb23c('0x4d')]=integrations[_0xb23c('0x4e')](_0x49cbdd['body'][_0xb23c('0x4f')],_0x49cbdd[_0xb23c('0x46')][_0xb23c('0x50')]);_0x49cbdd['body'][_0xb23c('0x51')]=integrations[_0xb23c('0x52')](_0x49cbdd['body'][_0xb23c('0x4f')],_0x49cbdd[_0xb23c('0x46')]['type']);return db[_0xb23c('0x53')]['create'](_0x49cbdd[_0xb23c('0x46')],{'include':[{'model':db[_0xb23c('0x54')],'as':_0xb23c('0x4d')},{'model':db[_0xb23c('0x54')],'as':'Descriptions'}]});}return null;})[_0xb23c('0x26')](respondWithResult(_0x15c611,null))[_0xb23c('0x3f')](handleError(_0x15c611,null));};function getAccessToken(_0x5bf718){return new Promise(function(_0x384012,_0x5e24da){var _0x1ab2f1;switch(_0x5bf718['zone']){case'US':_0x1ab2f1=_0xb23c('0x55');break;case'AU':_0x1ab2f1=_0xb23c('0x56');break;case'EU':_0x1ab2f1=_0xb23c('0x57');break;case'IN':_0x1ab2f1=_0xb23c('0x58');break;case'CN':_0x1ab2f1=_0xb23c('0x59');break;default:_0x1ab2f1='https://accounts.zoho.eu';break;}var _0x49203d={'method':'POST','uri':_0x1ab2f1+_0xb23c('0x5a'),'qs':{'refresh_token':_0x5bf718[_0xb23c('0x5b')],'client_id':_0x5bf718[_0xb23c('0x5c')],'client_secret':_0x5bf718['clientSecret'],'grant_type':_0xb23c('0x5d')},'json':!![]};return rp(_0x49203d)[_0xb23c('0x26')](function(_0x4907e8){if(_0x4907e8[_0xb23c('0x5e')]){_0x384012(_0x4907e8[_0xb23c('0x5e')]);}else{_0x5e24da(_0xb23c('0x5f'));}})[_0xb23c('0x3f')](function(_0x49e8c6){_0x5e24da(_0x49e8c6);});});}exports[_0xb23c('0x60')]=function(_0xf88d3c,_0x4dd417,_0x33befe){var _0x1adb71,_0x42a872,_0x4fffa0,_0x4633a1,_0x348637;return db['ZohoAccount'][_0xb23c('0x48')]({'where':{'id':_0xf88d3c[_0xb23c('0x40')]['id']},'attributes':['id',_0xb23c('0x61'),_0xb23c('0x62'),_0xb23c('0x5c'),_0xb23c('0x63'),_0xb23c('0x64'),_0xb23c('0x65'),_0xb23c('0x5b')]})[_0xb23c('0x26')](handleEntityNotFound(_0x4dd417,null))[_0xb23c('0x26')](function(_0x3d1ea9){_0x348637=_0x3d1ea9;_0x1adb71=_0x348637[_0xb23c('0x61')];_0x42a872=_0x1adb71===_0xb23c('0x66')?'eu':_0xb23c('0x67');_0x4fffa0=_0x348637['serverUrl'];var _0x366931=_0x4fffa0[_0xb23c('0x68')](-0x1);if(_0x366931==='/'||_0x366931==='\x5c'||_0x366931===':'){_0x4fffa0=_0x4fffa0[_0xb23c('0x69')](0x0,_0x4fffa0['lastIndexOf'](_0x366931));}if(!_0x348637['refreshToken']){throw new Error(_0xb23c('0x6a'));}return getAccessToken(_0x348637);})['then'](function(_0x33cb36){if(_0x33cb36){return rp({'method':'GET','uri':util['format']('https://www.zohoapis.%s/crm/v2/settings/fields',_0x42a872),'qs':{'module':_0xb23c('0x6b')},'headers':{'Authorization':_0xb23c('0x6c')+_0x33cb36},'json':!![]});}})[_0xb23c('0x26')](function(_0x408f0f){if(_0x408f0f){if(_0x408f0f[_0xb23c('0x6d')]&&_0x408f0f[_0xb23c('0x6d')]['error']){throw new Error(_0x408f0f[_0xb23c('0x6d')][_0xb23c('0x6e')][_0xb23c('0x6f')]);}var _0x102e46=[];var _0xb116f0=[];var _0x32b5ea=[_0xb23c('0x70'),_0xb23c('0x71'),_0xb23c('0x72'),_0xb23c('0x73'),_0xb23c('0x74'),_0xb23c('0x75'),'Call_Start_Time','Call_Type'];_0xb116f0=_[_0xb23c('0x76')](_0x408f0f['fields'],function(_0x5f4f60){return _0x32b5ea[_0xb23c('0x77')](_0x5f4f60['api_name']);});for(var _0x334fa5=0x0;_0x334fa5<_0xb116f0[_0xb23c('0x33')];_0x334fa5++){if(_0xb116f0[_0x334fa5][_0xb23c('0x78')]===![]){_0x102e46[_0xb23c('0x79')]({'id':_0xb116f0[_0x334fa5]['id'],'name':_0xb116f0[_0x334fa5]['display_label'],'custom':_0xb116f0[_0x334fa5][_0xb23c('0x7a')],'options':_0xb116f0[_0x334fa5][_0xb23c('0x7b')]===_0xb23c('0x7c')&&_0xb116f0[_0x334fa5][_0xb23c('0x7d')]['length']>-0x1?_['map'](_0xb116f0[_0x334fa5]['pick_list_values'],function(_0x41e46a){return{'name':_0x41e46a,'value':_0x41e46a};}):[]});}}return{'count':_0x102e46[_0xb23c('0x33')],'rows':_0x102e46};}else{return{'count':0x0,'rows':[]};}})[_0xb23c('0x26')](respondWithResult(_0x4dd417,null))[_0xb23c('0x3f')](function(_0xe74cf1){var _0x3958a5=_0xf88d3c['query']['test']?0x1f4:_0xe74cf1['statusCode']||0x1f4;logger[_0xb23c('0x6e')](_0xb23c('0x7e'),_0xb23c('0x60'),_0x3958a5,JSON[_0xb23c('0x7f')](_0xe74cf1));delete _0xe74cf1[_0xb23c('0x27')];if(_0x3958a5===0x191){_0x3958a5=0x190;}_0x4dd417[_0xb23c('0x1a')](_0x3958a5)[_0xb23c('0x28')](_0xf88d3c[_0xb23c('0x2e')]['test']?{'message':_0xb23c('0x80'),'statusCode':_0xe74cf1[_0xb23c('0x81')]}:_0xe74cf1);});}; \ No newline at end of file +var _0x441f=['filter','options','ZohoAccount','includeAll','include','findAll','rows','show','params','find','catch','create','body','getConfigurations','ZohoConfiguration','hasOwnProperty','nolimit','addConfiguration','findOne','getDescriptions','channel','ZohoField','Subjects','Descriptions','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','access_token','Unable\x20to\x20retrieve\x20the\x20access\x20token','getFields','clientSecret','code','host','com','serverUrl','slice','substring','lastIndexOf','Refresh\x20Token\x20not\x20available\x20for\x20the\x20account','format','Zoho-oauthtoken\x20','response','message','Owner','Subject','Description','WhoId','Call_Duration','Call_Result','Call_Start_Time','Call_Type','remove','api_name','push','display_label','custom_field','picklist','pick_list_values','test','getFields,\x20%s,\x20%s,\x20%s','stringify','Wrong\x20credentials','statusCode','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../components/integrations/configuration','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','error','name','send','map','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','order','sort','pick','filters','merge','where','type'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0x441f,0xc8));var _0xf441=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0x441f[_0x28b0a1];return _0x21470c;};'use strict';var emlformat=require(_0xf441('0x0'));var rimraf=require(_0xf441('0x1'));var zipdir=require(_0xf441('0x2'));var jsonpatch=require(_0xf441('0x3'));var rp=require(_0xf441('0x4'));var moment=require(_0xf441('0x5'));var BPromise=require(_0xf441('0x6'));var Mustache=require(_0xf441('0x7'));var util=require('util');var path=require(_0xf441('0x8'));var sox=require(_0xf441('0x9'));var csv=require(_0xf441('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf441('0xb'));var squel=require(_0xf441('0xc'));var crypto=require(_0xf441('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xf441('0xe'));var toCsv=require(_0xf441('0xa'));var querystring=require(_0xf441('0xf'));var Papa=require(_0xf441('0x10'));var Redis=require(_0xf441('0x11'));var authService=require(_0xf441('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf441('0x13'));var hardwareService=require(_0xf441('0x14'));var logger=require(_0xf441('0x15'))('api');var utils=require('../../config/utils');var config=require(_0xf441('0x16'));var licenseUtil=require(_0xf441('0x17'));var db=require('../../mysqldb')['db'];var integrations=require(_0xf441('0x18'));function respondWithStatusCode(_0x19f239,_0x154787){_0x154787=_0x154787||0xcc;return function(_0x3f7fdc){if(_0x3f7fdc){return _0x19f239['sendStatus'](_0x154787);}return _0x19f239[_0xf441('0x19')](_0x154787)['end']();};}function respondWithResult(_0x2881f8,_0x8a74cb){_0x8a74cb=_0x8a74cb||0xc8;return function(_0x40f131){if(_0x40f131){return _0x2881f8['status'](_0x8a74cb)[_0xf441('0x1a')](_0x40f131);}};}function respondWithFilteredResult(_0x4b55d2,_0x26244a){return function(_0x4aafef){if(_0x4aafef){var _0x2bddbe=typeof _0x26244a[_0xf441('0x1b')]==='undefined'&&typeof _0x26244a[_0xf441('0x1c')]===_0xf441('0x1d');var _0x47a5e6=_0x4aafef[_0xf441('0x1e')];var _0x4f0310=_0x2bddbe?0x0:_0x26244a['offset'];var _0x57c741=_0x2bddbe?_0x4aafef[_0xf441('0x1e')]:_0x26244a[_0xf441('0x1b')]+_0x26244a[_0xf441('0x1c')];var _0x356842;if(_0x57c741>=_0x47a5e6){_0x57c741=_0x47a5e6;_0x356842=0xc8;}else{_0x356842=0xce;}_0x4b55d2[_0xf441('0x19')](_0x356842);return _0x4b55d2[_0xf441('0x1f')](_0xf441('0x20'),_0x4f0310+'-'+_0x57c741+'/'+_0x47a5e6)[_0xf441('0x1a')](_0x4aafef);}return null;};}function patchUpdates(_0x29ac71){return function(_0x41175d){try{jsonpatch[_0xf441('0x21')](_0x41175d,_0x29ac71,!![]);}catch(_0x2e00b4){return BPromise[_0xf441('0x22')](_0x2e00b4);}return _0x41175d[_0xf441('0x23')]();};}function saveUpdates(_0x4e35df,_0x1a98e3){return function(_0x57f9f6){if(_0x57f9f6){return _0x57f9f6[_0xf441('0x24')](_0x4e35df)[_0xf441('0x25')](function(_0x2ed3ca){return _0x2ed3ca;});}return null;};}function removeEntity(_0x24a077,_0x28abf1){return function(_0x4a8560){if(_0x4a8560){return _0x4a8560[_0xf441('0x26')]()[_0xf441('0x25')](function(){_0x24a077['status'](0xcc)[_0xf441('0x27')]();});}};}function handleEntityNotFound(_0x261358,_0x44f8e2){return function(_0x539821){if(!_0x539821){_0x261358[_0xf441('0x28')](0x194);}return _0x539821;};}function handleError(_0x293596,_0xd5ebd){_0xd5ebd=_0xd5ebd||0x1f4;return function(_0x4c8728){logger[_0xf441('0x29')](_0x4c8728['stack']);if(_0x4c8728['name']){delete _0x4c8728[_0xf441('0x2a')];}_0x293596[_0xf441('0x19')](_0xd5ebd)[_0xf441('0x2b')](_0x4c8728);};}exports['index']=function(_0x261020,_0x892044){var _0x1ffec7={},_0x5e0f60={},_0x1b6803={'count':0x0,'rows':[]};var _0x388c0e=_[_0xf441('0x2c')](db['ZohoAccount'][_0xf441('0x2d')],function(_0x2b6ba7){return{'name':_0x2b6ba7[_0xf441('0x2e')],'type':_0x2b6ba7['type'][_0xf441('0x2f')]};});_0x5e0f60[_0xf441('0x30')]=_[_0xf441('0x2c')](_0x388c0e,_0xf441('0x2a'));_0x5e0f60[_0xf441('0x31')]=_[_0xf441('0x32')](_0x261020['query']);_0x5e0f60['filters']=_[_0xf441('0x33')](_0x5e0f60[_0xf441('0x30')],_0x5e0f60[_0xf441('0x31')]);_0x1ffec7[_0xf441('0x34')]=_[_0xf441('0x33')](_0x5e0f60[_0xf441('0x30')],qs[_0xf441('0x35')](_0x261020[_0xf441('0x31')][_0xf441('0x35')]));_0x1ffec7[_0xf441('0x34')]=_0x1ffec7['attributes'][_0xf441('0x36')]?_0x1ffec7[_0xf441('0x34')]:_0x5e0f60[_0xf441('0x30')];if(!_0x261020[_0xf441('0x31')]['hasOwnProperty']('nolimit')){_0x1ffec7[_0xf441('0x1c')]=qs[_0xf441('0x1c')](_0x261020[_0xf441('0x31')][_0xf441('0x1c')]);_0x1ffec7[_0xf441('0x1b')]=qs[_0xf441('0x1b')](_0x261020['query'][_0xf441('0x1b')]);}_0x1ffec7[_0xf441('0x37')]=qs[_0xf441('0x38')](_0x261020['query']['sort']);_0x1ffec7['where']=qs['filters'](_[_0xf441('0x39')](_0x261020[_0xf441('0x31')],_0x5e0f60[_0xf441('0x3a')]),_0x388c0e);if(_0x261020['query']['filter']){_0x1ffec7['where']=_[_0xf441('0x3b')](_0x1ffec7[_0xf441('0x3c')],{'$or':_['map'](_0x388c0e,function(_0x5390c1){if(_0x5390c1[_0xf441('0x3d')]!=='VIRTUAL'){var _0x3f9587={};_0x3f9587[_0x5390c1[_0xf441('0x2a')]]={'$like':'%'+_0x261020[_0xf441('0x31')][_0xf441('0x3e')]+'%'};return _0x3f9587;}})});}_0x1ffec7=_[_0xf441('0x3b')]({},_0x1ffec7,_0x261020[_0xf441('0x3f')]);var _0xd6895d={'where':_0x1ffec7[_0xf441('0x3c')]};return db[_0xf441('0x40')][_0xf441('0x1e')](_0xd6895d)[_0xf441('0x25')](function(_0x132681){_0x1b6803[_0xf441('0x1e')]=_0x132681;if(_0x261020[_0xf441('0x31')][_0xf441('0x41')]){_0x1ffec7[_0xf441('0x42')]=[{'all':!![]}];}return db[_0xf441('0x40')][_0xf441('0x43')](_0x1ffec7);})['then'](function(_0x4dda03){_0x1b6803[_0xf441('0x44')]=_0x4dda03;return _0x1b6803;})[_0xf441('0x25')](respondWithFilteredResult(_0x892044,_0x1ffec7))['catch'](handleError(_0x892044,null));};exports[_0xf441('0x45')]=function(_0x1a4525,_0x357f31){var _0x1b8545={'raw':![],'where':{'id':_0x1a4525[_0xf441('0x46')]['id']}},_0x4b27a3={};_0x4b27a3[_0xf441('0x30')]=_['keys'](db['ZohoAccount'][_0xf441('0x2d')]);_0x4b27a3[_0xf441('0x31')]=_[_0xf441('0x32')](_0x1a4525[_0xf441('0x31')]);_0x4b27a3[_0xf441('0x3a')]=_['intersection'](_0x4b27a3['model'],_0x4b27a3[_0xf441('0x31')]);_0x1b8545[_0xf441('0x34')]=_['intersection'](_0x4b27a3['model'],qs[_0xf441('0x35')](_0x1a4525[_0xf441('0x31')][_0xf441('0x35')]));_0x1b8545[_0xf441('0x34')]=_0x1b8545[_0xf441('0x34')][_0xf441('0x36')]?_0x1b8545['attributes']:_0x4b27a3['model'];if(_0x1a4525[_0xf441('0x31')][_0xf441('0x41')]){_0x1b8545[_0xf441('0x42')]=[{'all':!![]}];}_0x1b8545=_['merge']({},_0x1b8545,_0x1a4525['options']);return db[_0xf441('0x40')][_0xf441('0x47')](_0x1b8545)[_0xf441('0x25')](handleEntityNotFound(_0x357f31,null))[_0xf441('0x25')](respondWithResult(_0x357f31,null))[_0xf441('0x48')](handleError(_0x357f31,null));};exports['create']=function(_0x29ebfd,_0x4c554f){return db[_0xf441('0x40')][_0xf441('0x49')](_0x29ebfd[_0xf441('0x4a')],{})[_0xf441('0x25')](respondWithResult(_0x4c554f,0xc9))[_0xf441('0x48')](handleError(_0x4c554f,null));};exports[_0xf441('0x24')]=function(_0x1624d0,_0xcad73){if(_0x1624d0[_0xf441('0x4a')]['id']){delete _0x1624d0[_0xf441('0x4a')]['id'];}return db['ZohoAccount'][_0xf441('0x47')]({'where':{'id':_0x1624d0[_0xf441('0x46')]['id']}})[_0xf441('0x25')](handleEntityNotFound(_0xcad73,null))[_0xf441('0x25')](saveUpdates(_0x1624d0['body'],null))[_0xf441('0x25')](respondWithResult(_0xcad73,null))[_0xf441('0x48')](handleError(_0xcad73,null));};exports['destroy']=function(_0x14c800,_0x3219cc){return db[_0xf441('0x40')][_0xf441('0x47')]({'where':{'id':_0x14c800[_0xf441('0x46')]['id']}})['then'](handleEntityNotFound(_0x3219cc,null))[_0xf441('0x25')](removeEntity(_0x3219cc,null))[_0xf441('0x48')](handleError(_0x3219cc,null));};exports[_0xf441('0x4b')]=function(_0x256ae9,_0x44d15f,_0x4e2108){var _0x24fa14={};var _0x1a0274={};var _0x2e9619;var _0x4d3de5;return db[_0xf441('0x40')]['findOne']({'where':{'id':_0x256ae9[_0xf441('0x46')]['id']}})[_0xf441('0x25')](handleEntityNotFound(_0x44d15f,null))[_0xf441('0x25')](function(_0x2cde3e){if(_0x2cde3e){_0x2e9619=_0x2cde3e;_0x1a0274[_0xf441('0x30')]=_[_0xf441('0x32')](db[_0xf441('0x4c')][_0xf441('0x2d')]);_0x1a0274[_0xf441('0x31')]=_['keys'](_0x256ae9[_0xf441('0x31')]);_0x1a0274[_0xf441('0x3a')]=_['intersection'](_0x1a0274['model'],_0x1a0274[_0xf441('0x31')]);_0x24fa14[_0xf441('0x34')]=_['intersection'](_0x1a0274[_0xf441('0x30')],qs[_0xf441('0x35')](_0x256ae9[_0xf441('0x31')][_0xf441('0x35')]));_0x24fa14['attributes']=_0x24fa14[_0xf441('0x34')][_0xf441('0x36')]?_0x24fa14[_0xf441('0x34')]:_0x1a0274['model'];_0x24fa14[_0xf441('0x37')]=qs['sort'](_0x256ae9['query']['sort']);_0x24fa14[_0xf441('0x3c')]=qs['filters'](_[_0xf441('0x39')](_0x256ae9[_0xf441('0x31')],_0x1a0274[_0xf441('0x3a')]));if(_0x256ae9[_0xf441('0x31')][_0xf441('0x3e')]){_0x24fa14[_0xf441('0x3c')]=_[_0xf441('0x3b')](_0x24fa14[_0xf441('0x3c')],{'$or':_[_0xf441('0x2c')](_0x24fa14['attributes'],function(_0x229d13){var _0xce4540={};_0xce4540[_0x229d13]={'$like':'%'+_0x256ae9['query'][_0xf441('0x3e')]+'%'};return _0xce4540;})});}_0x24fa14=_[_0xf441('0x3b')]({},_0x24fa14,_0x256ae9['options']);return _0x2e9619[_0xf441('0x4b')](_0x24fa14);}})[_0xf441('0x25')](function(_0x3f886e){if(_0x3f886e){_0x4d3de5=_0x3f886e[_0xf441('0x36')];if(!_0x256ae9['query'][_0xf441('0x4d')](_0xf441('0x4e'))){_0x24fa14[_0xf441('0x1c')]=qs['limit'](_0x256ae9['query'][_0xf441('0x1c')]);_0x24fa14['offset']=qs['offset'](_0x256ae9['query'][_0xf441('0x1b')]);}return _0x2e9619[_0xf441('0x4b')](_0x24fa14);}})[_0xf441('0x25')](function(_0x4c4b20){if(_0x4c4b20){return _0x4c4b20?{'count':_0x4d3de5,'rows':_0x4c4b20}:null;}})[_0xf441('0x25')](respondWithResult(_0x44d15f,null))[_0xf441('0x48')](handleError(_0x44d15f,null));};exports[_0xf441('0x4f')]=function(_0x194db8,_0x4db8d0,_0x283ac1){if(_0x194db8[_0xf441('0x4a')]['id']){delete _0x194db8[_0xf441('0x4a')]['id'];}return db[_0xf441('0x40')][_0xf441('0x50')]({'where':{'id':_0x194db8['params']['id']}})[_0xf441('0x25')](handleEntityNotFound(_0x4db8d0,null))[_0xf441('0x25')](function(_0x5a8af0){if(_0x5a8af0){_0x194db8['body']['AccountId']=_0x5a8af0['id'];_0x194db8[_0xf441('0x4a')]['Subjects']=integrations['getSubjects'](_0x194db8[_0xf441('0x4a')]['channel'],_0x194db8['body'][_0xf441('0x3d')]);_0x194db8['body']['Descriptions']=integrations[_0xf441('0x51')](_0x194db8[_0xf441('0x4a')][_0xf441('0x52')],_0x194db8['body'][_0xf441('0x3d')]);return db[_0xf441('0x4c')]['create'](_0x194db8[_0xf441('0x4a')],{'include':[{'model':db[_0xf441('0x53')],'as':_0xf441('0x54')},{'model':db['ZohoField'],'as':_0xf441('0x55')}]});}return null;})['then'](respondWithResult(_0x4db8d0,null))[_0xf441('0x48')](handleError(_0x4db8d0,null));};function getAccessToken(_0x5cb54b){return new Promise(function(_0x4ff9e4,_0x3c5963){var _0x451c56;switch(_0x5cb54b[_0xf441('0x56')]){case'US':_0x451c56=_0xf441('0x57');break;case'AU':_0x451c56=_0xf441('0x58');break;case'EU':_0x451c56='https://accounts.zoho.eu';break;case'IN':_0x451c56=_0xf441('0x59');break;case'CN':_0x451c56=_0xf441('0x5a');break;default:_0x451c56='https://accounts.zoho.eu';break;}var _0x5aedca={'method':_0xf441('0x5b'),'uri':_0x451c56+_0xf441('0x5c'),'qs':{'refresh_token':_0x5cb54b[_0xf441('0x5d')],'client_id':_0x5cb54b[_0xf441('0x5e')],'client_secret':_0x5cb54b['clientSecret'],'grant_type':'refresh_token'},'json':!![]};return rp(_0x5aedca)['then'](function(_0x4a2a54){if(_0x4a2a54[_0xf441('0x5f')]){_0x4ff9e4(_0x4a2a54[_0xf441('0x5f')]);}else{_0x3c5963(_0xf441('0x60'));}})[_0xf441('0x48')](function(_0x261fc0){_0x3c5963(_0x261fc0);});});}exports[_0xf441('0x61')]=function(_0x2d632c,_0x4916cc,_0x44399e){var _0x47af67,_0x5cd07a,_0x5b1642,_0x206133,_0x4fb1ec;return db[_0xf441('0x40')][_0xf441('0x50')]({'where':{'id':_0x2d632c['params']['id']},'attributes':['id','host','zone','clientId',_0xf441('0x62'),'serverUrl',_0xf441('0x63'),_0xf441('0x5d')]})['then'](handleEntityNotFound(_0x4916cc,null))[_0xf441('0x25')](function(_0x3590fc){_0x4fb1ec=_0x3590fc;_0x47af67=_0x4fb1ec[_0xf441('0x64')];_0x5cd07a=_0x47af67==='zoho.eu'?'eu':_0xf441('0x65');_0x5b1642=_0x4fb1ec[_0xf441('0x66')];var _0x2a92f6=_0x5b1642[_0xf441('0x67')](-0x1);if(_0x2a92f6==='/'||_0x2a92f6==='\x5c'||_0x2a92f6===':'){_0x5b1642=_0x5b1642[_0xf441('0x68')](0x0,_0x5b1642[_0xf441('0x69')](_0x2a92f6));}if(!_0x4fb1ec['refreshToken']){throw new Error(_0xf441('0x6a'));}return getAccessToken(_0x4fb1ec);})[_0xf441('0x25')](function(_0x22be73){if(_0x22be73){return rp({'method':'GET','uri':util[_0xf441('0x6b')]('https://www.zohoapis.%s/crm/v2/settings/fields',_0x5cd07a),'qs':{'module':'Calls'},'headers':{'Authorization':_0xf441('0x6c')+_0x22be73},'json':!![]});}})[_0xf441('0x25')](function(_0x2bd749){if(_0x2bd749){if(_0x2bd749[_0xf441('0x6d')]&&_0x2bd749[_0xf441('0x6d')][_0xf441('0x29')]){throw new Error(_0x2bd749[_0xf441('0x6d')][_0xf441('0x29')][_0xf441('0x6e')]);}var _0x13892d=[];var _0x5db11d=[];var _0x1913b7=[_0xf441('0x6f'),_0xf441('0x70'),_0xf441('0x71'),_0xf441('0x72'),_0xf441('0x73'),_0xf441('0x74'),_0xf441('0x75'),_0xf441('0x76')];_0x5db11d=_[_0xf441('0x77')](_0x2bd749[_0xf441('0x35')],function(_0x3b2793){return _0x1913b7['includes'](_0x3b2793[_0xf441('0x78')]);});for(var _0x3ad1e8=0x0;_0x3ad1e8<_0x5db11d[_0xf441('0x36')];_0x3ad1e8++){if(_0x5db11d[_0x3ad1e8]['system_mandatory']===![]){_0x13892d[_0xf441('0x79')]({'id':_0x5db11d[_0x3ad1e8]['id'],'name':_0x5db11d[_0x3ad1e8][_0xf441('0x7a')],'custom':_0x5db11d[_0x3ad1e8][_0xf441('0x7b')],'options':_0x5db11d[_0x3ad1e8]['data_type']===_0xf441('0x7c')&&_0x5db11d[_0x3ad1e8][_0xf441('0x7d')][_0xf441('0x36')]>-0x1?_[_0xf441('0x2c')](_0x5db11d[_0x3ad1e8][_0xf441('0x7d')],function(_0x3859dc){return{'name':_0x3859dc,'value':_0x3859dc};}):[]});}}return{'count':_0x13892d[_0xf441('0x36')],'rows':_0x13892d};}else{return{'count':0x0,'rows':[]};}})[_0xf441('0x25')](respondWithResult(_0x4916cc,null))[_0xf441('0x48')](function(_0x20f0d6){var _0x1690fb=_0x2d632c[_0xf441('0x31')][_0xf441('0x7e')]?0x1f4:_0x20f0d6['statusCode']||0x1f4;logger[_0xf441('0x29')](_0xf441('0x7f'),'getFields',_0x1690fb,JSON[_0xf441('0x80')](_0x20f0d6));delete _0x20f0d6[_0xf441('0x2a')];if(_0x1690fb===0x191){_0x1690fb=0x190;}_0x4916cc[_0xf441('0x19')](_0x1690fb)[_0xf441('0x2b')](_0x2d632c[_0xf441('0x31')][_0xf441('0x7e')]?{'message':_0xf441('0x81'),'statusCode':_0x20f0d6[_0xf441('0x82')]}:_0x20f0d6);});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.model.js b/server/api/intZohoAccount/intZohoAccount.model.js index 2935688..6c50a82 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 _0x9e69=['../../config/environment','./intZohoAccount.attributes','../../components/integrations/configuration','define','int_zoho_accounts','changed','serverUrl','clientSecret','code','host','substring','lastIndexOf','zone','https://accounts.zoho.com.cn','https://accounts.zoho.eu','/oauth/v2/token','authorization_code','clientId','application/x-www-form-urlencoded','refresh_token','refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','name','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','inspect','catch','https://accounts.zoho.com.au','https://accounts.zoho.in','parse','util','../../config/logger','api','moment','request-promise','path'];(function(_0x4ce47b,_0x4241c5){var _0x2661a3=function(_0x5adf9a){while(--_0x5adf9a){_0x4ce47b['push'](_0x4ce47b['shift']());}};_0x2661a3(++_0x4241c5);}(_0x9e69,0x150));var _0x99e6=function(_0x593097,_0x2318b5){_0x593097=_0x593097-0x0;var _0x284ba2=_0x9e69[_0x593097];return _0x284ba2;};'use strict';var _=require('lodash');var util=require(_0x99e6('0x0'));var logger=require(_0x99e6('0x1'))(_0x99e6('0x2'));var moment=require(_0x99e6('0x3'));var BPromise=require('bluebird');var rp=require(_0x99e6('0x4'));var fs=require('fs');var path=require(_0x99e6('0x5'));var rimraf=require('rimraf');var config=require(_0x99e6('0x6'));var attributes=require(_0x99e6('0x7'));var integrations=require(_0x99e6('0x8'));module['exports']=function(_0x857e0c,_0x3cf241){return _0x857e0c[_0x99e6('0x9')]('ZohoAccount',attributes,{'tableName':_0x99e6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x305140,_0x4a657d,_0x1a3e1e){if(_0x305140[_0x99e6('0xb')]('zone')||_0x305140[_0x99e6('0xb')](_0x99e6('0xc'))||_0x305140['changed']('clientId')||_0x305140[_0x99e6('0xb')](_0x99e6('0xd'))||_0x305140[_0x99e6('0xb')](_0x99e6('0xe'))||_0x305140[_0x99e6('0xb')](_0x99e6('0xf'))){var _0x51de85,_0x13a62b;_0x51de85=_0x305140[_0x99e6('0xc')];var _0x2b40de=_0x51de85['slice'](-0x1);if(_0x2b40de==='/'||_0x2b40de==='\x5c'||_0x2b40de===':'){_0x51de85=_0x51de85[_0x99e6('0x10')](0x0,_0x51de85[_0x99e6('0x11')](_0x2b40de));}switch(_0x305140[_0x99e6('0x12')]){case'US':_0x13a62b='https://accounts.zoho.com';break;case'AU':_0x13a62b='https://accounts.zoho.com.au';break;case'IN':_0x13a62b='https://accounts.zoho.in';break;case'CN':_0x13a62b=_0x99e6('0x13');break;default:_0x13a62b=_0x99e6('0x14');break;}var _0x1d910a={'method':'POST','uri':_0x13a62b+_0x99e6('0x15'),'form':{'grant_type':_0x99e6('0x16'),'client_id':_0x305140[_0x99e6('0x17')],'client_secret':_0x305140[_0x99e6('0xd')],'redirect_uri':_0x305140[_0x99e6('0xc')],'code':_0x305140['code']},'headers':{'Content-Type':_0x99e6('0x18')}};return rp(_0x1d910a)['then'](function(_0x2749bf){var _0x359358=JSON['parse'](_0x2749bf);if(_0x359358[_0x99e6('0x19')]){_0x305140[_0x99e6('0x1a')]=_0x359358[_0x99e6('0x19')];logger[_0x99e6('0x1b')](util[_0x99e6('0x1c')](_0x99e6('0x1d'),_0x305140[_0x99e6('0x1e')],_0x305140['id']));}else{logger[_0x99e6('0x1f')](util[_0x99e6('0x1c')](_0x99e6('0x20'),_0x305140['name'],_0x305140['id']),util[_0x99e6('0x21')](_0x359358,{'showHidden':![],'depth':null}));}return _0x1a3e1e(null,_0x4a657d);})[_0x99e6('0x22')](function(_0x16f05d){logger[_0x99e6('0x1f')](util[_0x99e6('0x1c')](_0x99e6('0x20'),_0x305140[_0x99e6('0x1e')],_0x305140['id']),util[_0x99e6('0x21')](parsedResult,{'showHidden':![],'depth':null}));return _0x1a3e1e(_0x16f05d);});}else{return _0x1a3e1e(null,_0x4a657d);}},'beforeUpdate':function(_0x2033af,_0x1b4339,_0x38d174){if(_0x2033af[_0x99e6('0xb')](_0x99e6('0x12'))||_0x2033af[_0x99e6('0xb')](_0x99e6('0xc'))||_0x2033af[_0x99e6('0xb')](_0x99e6('0x17'))||_0x2033af['changed'](_0x99e6('0xd'))||_0x2033af['changed'](_0x99e6('0xe'))||_0x2033af[_0x99e6('0xb')](_0x99e6('0xf'))){var _0x52c7da,_0x3a1325;_0x52c7da=_0x2033af['serverUrl'];var _0x378c17=_0x52c7da['slice'](-0x1);if(_0x378c17==='/'||_0x378c17==='\x5c'||_0x378c17===':'){_0x52c7da=_0x52c7da[_0x99e6('0x10')](0x0,_0x52c7da[_0x99e6('0x11')](_0x378c17));}switch(_0x2033af['zone']){case'US':_0x3a1325='https://accounts.zoho.com';break;case'AU':_0x3a1325=_0x99e6('0x23');break;case'IN':_0x3a1325=_0x99e6('0x24');break;case'CN':_0x3a1325=_0x99e6('0x13');break;default:_0x3a1325=_0x99e6('0x14');break;}var _0x3f821a={'method':'POST','uri':_0x3a1325+_0x99e6('0x15'),'form':{'grant_type':_0x99e6('0x16'),'client_id':_0x2033af[_0x99e6('0x17')],'client_secret':_0x2033af['clientSecret'],'redirect_uri':_0x2033af['serverUrl'],'code':_0x2033af[_0x99e6('0xe')]},'headers':{'Content-Type':'application/x-www-form-urlencoded'}};return rp(_0x3f821a)['then'](function(_0x213a6f){var _0x4f77a0=JSON[_0x99e6('0x25')](_0x213a6f);if(_0x4f77a0[_0x99e6('0x19')]){_0x2033af[_0x99e6('0x1a')]=_0x4f77a0['refresh_token'];logger[_0x99e6('0x1b')](util[_0x99e6('0x1c')](_0x99e6('0x1d'),_0x2033af[_0x99e6('0x1e')],_0x2033af['id']));}else{logger['error'](util[_0x99e6('0x1c')](_0x99e6('0x20'),_0x2033af[_0x99e6('0x1e')],_0x2033af['id']),util[_0x99e6('0x21')](_0x4f77a0,{'showHidden':![],'depth':null}));}return _0x38d174(null,_0x1b4339);})[_0x99e6('0x22')](function(_0x40e298){logger['error'](util[_0x99e6('0x1c')]('ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d',_0x2033af['name'],_0x2033af['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x38d174(_0x40e298);});}else{return _0x38d174(null,_0x1b4339);}}}});}; \ No newline at end of file +var _0x06cd=['refreshToken','info','format','ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d','error','ZohoAccount,\x20Unable\x20to\x20generate\x20the\x20refresh\x20token\x20for\x20account\x20\x22%s\x22\x20#%d','name','inspect','host','/oauth/v2/token','catch','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','./intZohoAccount.attributes','../../components/integrations/configuration','define','ZohoAccount','int_zoho_accounts','changed','zone','serverUrl','clientId','clientSecret','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','authorization_code','code','application/x-www-form-urlencoded','then','parse','refresh_token'];(function(_0x5888d4,_0x12ca9f){var _0x177bd5=function(_0x98e0c1){while(--_0x98e0c1){_0x5888d4['push'](_0x5888d4['shift']());}};_0x177bd5(++_0x12ca9f);}(_0x06cd,0x8c));var _0xd06c=function(_0x56fa4e,_0x2c7636){_0x56fa4e=_0x56fa4e-0x0;var _0x5bf93a=_0x06cd[_0x56fa4e];return _0x5bf93a;};'use strict';var _=require(_0xd06c('0x0'));var util=require(_0xd06c('0x1'));var logger=require(_0xd06c('0x2'))('api');var moment=require(_0xd06c('0x3'));var BPromise=require(_0xd06c('0x4'));var rp=require(_0xd06c('0x5'));var fs=require('fs');var path=require(_0xd06c('0x6'));var rimraf=require(_0xd06c('0x7'));var config=require('../../config/environment');var attributes=require(_0xd06c('0x8'));var integrations=require(_0xd06c('0x9'));module['exports']=function(_0x1ccad6,_0x2e88c6){return _0x1ccad6[_0xd06c('0xa')](_0xd06c('0xb'),attributes,{'tableName':_0xd06c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeCreate':function(_0x71dd23,_0x3ca3ed,_0xff163c){if(_0x71dd23[_0xd06c('0xd')](_0xd06c('0xe'))||_0x71dd23[_0xd06c('0xd')](_0xd06c('0xf'))||_0x71dd23[_0xd06c('0xd')](_0xd06c('0x10'))||_0x71dd23[_0xd06c('0xd')](_0xd06c('0x11'))||_0x71dd23[_0xd06c('0xd')]('code')||_0x71dd23[_0xd06c('0xd')]('host')){var _0x71e884,_0x33d787;_0x71e884=_0x71dd23['serverUrl'];var _0x19fd04=_0x71e884[_0xd06c('0x12')](-0x1);if(_0x19fd04==='/'||_0x19fd04==='\x5c'||_0x19fd04===':'){_0x71e884=_0x71e884[_0xd06c('0x13')](0x0,_0x71e884[_0xd06c('0x14')](_0x19fd04));}switch(_0x71dd23[_0xd06c('0xe')]){case'US':_0x33d787=_0xd06c('0x15');break;case'AU':_0x33d787=_0xd06c('0x16');break;case'IN':_0x33d787=_0xd06c('0x17');break;case'CN':_0x33d787=_0xd06c('0x18');break;default:_0x33d787=_0xd06c('0x19');break;}var _0x1d43f7={'method':'POST','uri':_0x33d787+'/oauth/v2/token','form':{'grant_type':_0xd06c('0x1a'),'client_id':_0x71dd23[_0xd06c('0x10')],'client_secret':_0x71dd23[_0xd06c('0x11')],'redirect_uri':_0x71dd23[_0xd06c('0xf')],'code':_0x71dd23[_0xd06c('0x1b')]},'headers':{'Content-Type':_0xd06c('0x1c')}};return rp(_0x1d43f7)[_0xd06c('0x1d')](function(_0x3e1b01){var _0x19a003=JSON[_0xd06c('0x1e')](_0x3e1b01);if(_0x19a003[_0xd06c('0x1f')]){_0x71dd23[_0xd06c('0x20')]=_0x19a003[_0xd06c('0x1f')];logger[_0xd06c('0x21')](util[_0xd06c('0x22')](_0xd06c('0x23'),_0x71dd23['name'],_0x71dd23['id']));}else{logger[_0xd06c('0x24')](util[_0xd06c('0x22')](_0xd06c('0x25'),_0x71dd23[_0xd06c('0x26')],_0x71dd23['id']),util[_0xd06c('0x27')](_0x19a003,{'showHidden':![],'depth':null}));}return _0xff163c(null,_0x3ca3ed);})['catch'](function(_0x1bc7d4){logger[_0xd06c('0x24')](util[_0xd06c('0x22')](_0xd06c('0x25'),_0x71dd23['name'],_0x71dd23['id']),util[_0xd06c('0x27')](parsedResult,{'showHidden':![],'depth':null}));return _0xff163c(_0x1bc7d4);});}else{return _0xff163c(null,_0x3ca3ed);}},'beforeUpdate':function(_0x4aae3e,_0x1aad6e,_0x5dea0a){if(_0x4aae3e['changed'](_0xd06c('0xe'))||_0x4aae3e['changed'](_0xd06c('0xf'))||_0x4aae3e[_0xd06c('0xd')]('clientId')||_0x4aae3e[_0xd06c('0xd')](_0xd06c('0x11'))||_0x4aae3e['changed'](_0xd06c('0x1b'))||_0x4aae3e[_0xd06c('0xd')](_0xd06c('0x28'))){var _0x4bf557,_0x3c8891;_0x4bf557=_0x4aae3e['serverUrl'];var _0x2e16b2=_0x4bf557[_0xd06c('0x12')](-0x1);if(_0x2e16b2==='/'||_0x2e16b2==='\x5c'||_0x2e16b2===':'){_0x4bf557=_0x4bf557[_0xd06c('0x13')](0x0,_0x4bf557[_0xd06c('0x14')](_0x2e16b2));}switch(_0x4aae3e['zone']){case'US':_0x3c8891=_0xd06c('0x15');break;case'AU':_0x3c8891=_0xd06c('0x16');break;case'IN':_0x3c8891=_0xd06c('0x17');break;case'CN':_0x3c8891=_0xd06c('0x18');break;default:_0x3c8891=_0xd06c('0x19');break;}var _0x231154={'method':'POST','uri':_0x3c8891+_0xd06c('0x29'),'form':{'grant_type':_0xd06c('0x1a'),'client_id':_0x4aae3e['clientId'],'client_secret':_0x4aae3e[_0xd06c('0x11')],'redirect_uri':_0x4aae3e[_0xd06c('0xf')],'code':_0x4aae3e[_0xd06c('0x1b')]},'headers':{'Content-Type':_0xd06c('0x1c')}};return rp(_0x231154)[_0xd06c('0x1d')](function(_0x338681){var _0x1a5762=JSON[_0xd06c('0x1e')](_0x338681);if(_0x1a5762[_0xd06c('0x1f')]){_0x4aae3e[_0xd06c('0x20')]=_0x1a5762[_0xd06c('0x1f')];logger['info'](util['format']('ZohoAccount,\x20Refresh\x20token\x20successfully\x20generated\x20for\x20account\x20\x22%s\x22\x20#%d',_0x4aae3e['name'],_0x4aae3e['id']));}else{logger[_0xd06c('0x24')](util[_0xd06c('0x22')](_0xd06c('0x25'),_0x4aae3e[_0xd06c('0x26')],_0x4aae3e['id']),util[_0xd06c('0x27')](_0x1a5762,{'showHidden':![],'depth':null}));}return _0x5dea0a(null,_0x1aad6e);})[_0xd06c('0x2a')](function(_0x5c38c0){logger[_0xd06c('0x24')](util[_0xd06c('0x22')](_0xd06c('0x25'),_0x4aae3e[_0xd06c('0x26')],_0x4aae3e['id']),util['inspect'](parsedResult,{'showHidden':![],'depth':null}));return _0x5dea0a(_0x5c38c0);});}else{return _0x5dea0a(null,_0x1aad6e);}}}});}; \ No newline at end of file diff --git a/server/api/intZohoAccount/intZohoAccount.rpc.js b/server/api/intZohoAccount/intZohoAccount.rpc.js index 3e6b6b4..8726cf4 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 _0x20de=['ZohoAccount','findAll','options','raw','include','model','attributes','map','ShowZohoAccount','find','where','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','ZohoAccount,\x20%s,\x20%s','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','GetZohoAccount'];(function(_0x47841b,_0x35633c){var _0x122652=function(_0xf30147){while(--_0xf30147){_0x47841b['push'](_0x47841b['shift']());}};_0x122652(++_0x35633c);}(_0x20de,0x134));var _0xe20d=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x20de[_0x9c2427];return _0x51984f;};'use strict';var _=require(_0xe20d('0x0'));var util=require('util');var moment=require(_0xe20d('0x1'));var BPromise=require(_0xe20d('0x2'));var rs=require(_0xe20d('0x3'));var fs=require('fs');var Redis=require(_0xe20d('0x4'));var db=require(_0xe20d('0x5'))['db'];var utils=require(_0xe20d('0x6'));var logger=require(_0xe20d('0x7'))(_0xe20d('0x8'));var config=require(_0xe20d('0x9'));var jayson=require(_0xe20d('0xa'));var client=jayson[_0xe20d('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x374faa,_0x5a5ac2,_0x4e1fb9){return new BPromise(function(_0x4909c9,_0x110ff5){return client[_0xe20d('0xc')](_0x374faa,_0x4e1fb9)[_0xe20d('0xd')](function(_0x50f487){logger[_0xe20d('0xe')](_0xe20d('0xf'),_0x5a5ac2,'request\x20sent');logger[_0xe20d('0x10')](_0xe20d('0x11'),_0x5a5ac2,'request\x20sent',JSON[_0xe20d('0x12')](_0x50f487));if(_0x50f487[_0xe20d('0x13')]){if(_0x50f487[_0xe20d('0x13')][_0xe20d('0x14')]===0x1f4){logger['error']('ZohoAccount,\x20%s,\x20%s',_0x5a5ac2,_0x50f487[_0xe20d('0x13')][_0xe20d('0x15')]);return _0x110ff5(_0x50f487[_0xe20d('0x13')][_0xe20d('0x15')]);}logger[_0xe20d('0x13')](_0xe20d('0xf'),_0x5a5ac2,_0x50f487[_0xe20d('0x13')][_0xe20d('0x15')]);return _0x4909c9(_0x50f487[_0xe20d('0x13')]['message']);}else{logger[_0xe20d('0xe')]('ZohoAccount,\x20%s,\x20%s',_0x5a5ac2,_0xe20d('0x16'));_0x4909c9(_0x50f487[_0xe20d('0x17')][_0xe20d('0x15')]);}})['catch'](function(_0x1d6179){logger['error'](_0xe20d('0xf'),_0x5a5ac2,_0x1d6179);_0x110ff5(_0x1d6179);});});}exports[_0xe20d('0x18')]=function(_0x285916){var _0x4e8dd6=this;return new Promise(function(_0x4353cb,_0x17a2f1){return db[_0xe20d('0x19')][_0xe20d('0x1a')]({'raw':_0x285916['options']?_0x285916[_0xe20d('0x1b')][_0xe20d('0x1c')]===undefined?!![]:![]:!![],'where':_0x285916[_0xe20d('0x1b')]?_0x285916[_0xe20d('0x1b')]['where']||null:null,'attributes':_0x285916[_0xe20d('0x1b')]?_0x285916['options']['attributes']||null:null,'limit':_0x285916[_0xe20d('0x1b')]?_0x285916[_0xe20d('0x1b')]['limit']||null:null,'include':_0x285916['options']?_0x285916[_0xe20d('0x1b')][_0xe20d('0x1d')]?_['map'](_0x285916[_0xe20d('0x1b')][_0xe20d('0x1d')],function(_0x3f0227){return{'model':db[_0x3f0227[_0xe20d('0x1e')]],'as':_0x3f0227['as'],'attributes':_0x3f0227[_0xe20d('0x1f')],'include':_0x3f0227['include']?_[_0xe20d('0x20')](_0x3f0227[_0xe20d('0x1d')],function(_0x1a76bc){return{'model':db[_0x1a76bc[_0xe20d('0x1e')]],'as':_0x1a76bc['as'],'attributes':_0x1a76bc[_0xe20d('0x1f')],'include':_0x1a76bc['include']?_['map'](_0x1a76bc[_0xe20d('0x1d')],function(_0x497726){return{'model':db[_0x497726[_0xe20d('0x1e')]],'as':_0x497726['as'],'attributes':_0x497726[_0xe20d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe20d('0xd')](function(_0x46fc0e){logger[_0xe20d('0xe')](_0xe20d('0x18'),_0x285916);logger[_0xe20d('0x10')]('GetZohoAccount',_0x285916,JSON[_0xe20d('0x12')](_0x46fc0e));_0x4353cb(_0x46fc0e);})['catch'](function(_0x555eb5){logger['error']('GetZohoAccount',_0x555eb5['message'],_0x285916);_0x17a2f1(_0x4e8dd6[_0xe20d('0x13')](0x1f4,_0x555eb5[_0xe20d('0x15')]));});});};exports[_0xe20d('0x21')]=function(_0x4f2d27){var _0x4f4369=this;return new Promise(function(_0x243311,_0x3b9866){return db[_0xe20d('0x19')][_0xe20d('0x22')]({'raw':_0x4f2d27[_0xe20d('0x1b')]?_0x4f2d27[_0xe20d('0x1b')][_0xe20d('0x1c')]===undefined?!![]:![]:!![],'where':_0x4f2d27[_0xe20d('0x1b')]?_0x4f2d27['options'][_0xe20d('0x23')]||null:null,'attributes':_0x4f2d27['options']?_0x4f2d27['options'][_0xe20d('0x1f')]||null:null,'include':_0x4f2d27['options']?_0x4f2d27[_0xe20d('0x1b')][_0xe20d('0x1d')]?_['map'](_0x4f2d27['options']['include'],function(_0x2b1867){return{'model':db[_0x2b1867[_0xe20d('0x1e')]],'as':_0x2b1867['as'],'attributes':_0x2b1867[_0xe20d('0x1f')],'include':_0x2b1867[_0xe20d('0x1d')]?_[_0xe20d('0x20')](_0x2b1867[_0xe20d('0x1d')],function(_0x4b5a10){return{'model':db[_0x4b5a10[_0xe20d('0x1e')]],'as':_0x4b5a10['as'],'attributes':_0x4b5a10[_0xe20d('0x1f')],'include':_0x4b5a10[_0xe20d('0x1d')]?_[_0xe20d('0x20')](_0x4b5a10['include'],function(_0x1da5bf){return{'model':db[_0x1da5bf[_0xe20d('0x1e')]],'as':_0x1da5bf['as'],'attributes':_0x1da5bf[_0xe20d('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xe20d('0xd')](function(_0x5bf0f4){logger['info'](_0xe20d('0x21'),_0x4f2d27);logger[_0xe20d('0x10')]('ShowZohoAccount',_0x4f2d27,JSON[_0xe20d('0x12')](_0x5bf0f4));_0x243311(_0x5bf0f4);})[_0xe20d('0x24')](function(_0x223666){logger[_0xe20d('0x13')](_0xe20d('0x21'),_0x223666[_0xe20d('0x15')],_0x4f2d27);_0x3b9866(_0x4f4369[_0xe20d('0x13')](0x1f4,_0x223666[_0xe20d('0x15')]));});});}; \ No newline at end of file +var _0x4744=['../../config/environment','http','request','info','ZohoAccount,\x20%s,\x20%s','request\x20sent','debug','ZohoAccount,\x20%s,\x20%s,\x20%s','error','message','result','GetZohoAccount','ZohoAccount','options','raw','where','attributes','limit','include','map','model','stringify','catch','ShowZohoAccount','then','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x4744,0x107));var _0x4474=function(_0x544c9d,_0x315d52){_0x544c9d=_0x544c9d-0x0;var _0x1c71cd=_0x4744[_0x544c9d];return _0x1c71cd;};'use strict';var _=require(_0x4474('0x0'));var util=require(_0x4474('0x1'));var moment=require('moment');var BPromise=require(_0x4474('0x2'));var rs=require(_0x4474('0x3'));var fs=require('fs');var Redis=require(_0x4474('0x4'));var db=require(_0x4474('0x5'))['db'];var utils=require(_0x4474('0x6'));var logger=require(_0x4474('0x7'))(_0x4474('0x8'));var config=require(_0x4474('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4474('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xc08a4c,_0x3024cd,_0x1dcdf0){return new BPromise(function(_0x387297,_0x247b66){return client[_0x4474('0xb')](_0xc08a4c,_0x1dcdf0)['then'](function(_0x17c4f7){logger[_0x4474('0xc')](_0x4474('0xd'),_0x3024cd,_0x4474('0xe'));logger[_0x4474('0xf')](_0x4474('0x10'),_0x3024cd,_0x4474('0xe'),JSON['stringify'](_0x17c4f7));if(_0x17c4f7['error']){if(_0x17c4f7['error']['code']===0x1f4){logger[_0x4474('0x11')](_0x4474('0xd'),_0x3024cd,_0x17c4f7['error'][_0x4474('0x12')]);return _0x247b66(_0x17c4f7['error'][_0x4474('0x12')]);}logger[_0x4474('0x11')](_0x4474('0xd'),_0x3024cd,_0x17c4f7[_0x4474('0x11')][_0x4474('0x12')]);return _0x387297(_0x17c4f7[_0x4474('0x11')][_0x4474('0x12')]);}else{logger[_0x4474('0xc')](_0x4474('0xd'),_0x3024cd,'request\x20sent');_0x387297(_0x17c4f7[_0x4474('0x13')]['message']);}})['catch'](function(_0x46b79d){logger[_0x4474('0x11')]('ZohoAccount,\x20%s,\x20%s',_0x3024cd,_0x46b79d);_0x247b66(_0x46b79d);});});}exports[_0x4474('0x14')]=function(_0x356a37){var _0x1dc845=this;return new Promise(function(_0x22ed33,_0x21debd){return db[_0x4474('0x15')]['findAll']({'raw':_0x356a37[_0x4474('0x16')]?_0x356a37['options'][_0x4474('0x17')]===undefined?!![]:![]:!![],'where':_0x356a37[_0x4474('0x16')]?_0x356a37[_0x4474('0x16')][_0x4474('0x18')]||null:null,'attributes':_0x356a37['options']?_0x356a37['options'][_0x4474('0x19')]||null:null,'limit':_0x356a37[_0x4474('0x16')]?_0x356a37['options'][_0x4474('0x1a')]||null:null,'include':_0x356a37[_0x4474('0x16')]?_0x356a37[_0x4474('0x16')][_0x4474('0x1b')]?_[_0x4474('0x1c')](_0x356a37[_0x4474('0x16')][_0x4474('0x1b')],function(_0x3009d8){return{'model':db[_0x3009d8[_0x4474('0x1d')]],'as':_0x3009d8['as'],'attributes':_0x3009d8[_0x4474('0x19')],'include':_0x3009d8[_0x4474('0x1b')]?_['map'](_0x3009d8[_0x4474('0x1b')],function(_0xd34139){return{'model':db[_0xd34139[_0x4474('0x1d')]],'as':_0xd34139['as'],'attributes':_0xd34139['attributes'],'include':_0xd34139['include']?_['map'](_0xd34139['include'],function(_0x5870aa){return{'model':db[_0x5870aa[_0x4474('0x1d')]],'as':_0x5870aa['as'],'attributes':_0x5870aa[_0x4474('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x37e58d){logger[_0x4474('0xc')](_0x4474('0x14'),_0x356a37);logger[_0x4474('0xf')](_0x4474('0x14'),_0x356a37,JSON[_0x4474('0x1e')](_0x37e58d));_0x22ed33(_0x37e58d);})[_0x4474('0x1f')](function(_0x3be419){logger[_0x4474('0x11')](_0x4474('0x14'),_0x3be419[_0x4474('0x12')],_0x356a37);_0x21debd(_0x1dc845[_0x4474('0x11')](0x1f4,_0x3be419['message']));});});};exports[_0x4474('0x20')]=function(_0x19f048){var _0x283963=this;return new Promise(function(_0x49b381,_0xc1b736){return db[_0x4474('0x15')]['find']({'raw':_0x19f048[_0x4474('0x16')]?_0x19f048[_0x4474('0x16')][_0x4474('0x17')]===undefined?!![]:![]:!![],'where':_0x19f048[_0x4474('0x16')]?_0x19f048['options'][_0x4474('0x18')]||null:null,'attributes':_0x19f048['options']?_0x19f048[_0x4474('0x16')][_0x4474('0x19')]||null:null,'include':_0x19f048['options']?_0x19f048['options']['include']?_[_0x4474('0x1c')](_0x19f048[_0x4474('0x16')][_0x4474('0x1b')],function(_0x15a96d){return{'model':db[_0x15a96d[_0x4474('0x1d')]],'as':_0x15a96d['as'],'attributes':_0x15a96d[_0x4474('0x19')],'include':_0x15a96d[_0x4474('0x1b')]?_[_0x4474('0x1c')](_0x15a96d[_0x4474('0x1b')],function(_0x5e650e){return{'model':db[_0x5e650e['model']],'as':_0x5e650e['as'],'attributes':_0x5e650e['attributes'],'include':_0x5e650e[_0x4474('0x1b')]?_[_0x4474('0x1c')](_0x5e650e[_0x4474('0x1b')],function(_0xbe64b3){return{'model':db[_0xbe64b3[_0x4474('0x1d')]],'as':_0xbe64b3['as'],'attributes':_0xbe64b3[_0x4474('0x19')]};}):[]};}):[]};}):[]:[]})[_0x4474('0x21')](function(_0x2d7fbd){logger['info']('ShowZohoAccount',_0x19f048);logger[_0x4474('0xf')](_0x4474('0x20'),_0x19f048,JSON['stringify'](_0x2d7fbd));_0x49b381(_0x2d7fbd);})[_0x4474('0x1f')](function(_0x48c1e0){logger[_0x4474('0x11')]('ShowZohoAccount',_0x48c1e0[_0x4474('0x12')],_0x19f048);_0xc1b736(_0x283963[_0x4474('0x11')](0x1f4,_0x48c1e0[_0x4474('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/index.js b/server/api/intZohoConfiguration/index.js index 814500c..8a76fc0 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 _0xf9c9=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','show','getFields','/:id/subjects','/:id/descriptions','getDescriptions','post','create','put','/:id','delete','destroy','exports','multer','util','path','Router'];(function(_0x3ad176,_0x571fcb){var _0x4c329f=function(_0x56b462){while(--_0x56b462){_0x3ad176['push'](_0x3ad176['shift']());}};_0x4c329f(++_0x571fcb);}(_0xf9c9,0xe2));var _0x9f9c=function(_0x293fa4,_0x3ee6cc){_0x293fa4=_0x293fa4-0x0;var _0x58d190=_0xf9c9[_0x293fa4];return _0x58d190;};'use strict';var multer=require(_0x9f9c('0x0'));var util=require(_0x9f9c('0x1'));var path=require(_0x9f9c('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x9f9c('0x3')]();var fs_extra=require(_0x9f9c('0x4'));var auth=require(_0x9f9c('0x5'));var interaction=require(_0x9f9c('0x6'));var config=require(_0x9f9c('0x7'));var controller=require(_0x9f9c('0x8'));router[_0x9f9c('0x9')]('/',auth[_0x9f9c('0xa')](),controller['index']);router[_0x9f9c('0x9')]('/:id',auth[_0x9f9c('0xa')](),controller[_0x9f9c('0xb')]);router[_0x9f9c('0x9')]('/:id/fields',auth['isAuthenticated'](),controller[_0x9f9c('0xc')]);router[_0x9f9c('0x9')](_0x9f9c('0xd'),auth['isAuthenticated'](),controller['getSubjects']);router[_0x9f9c('0x9')](_0x9f9c('0xe'),auth[_0x9f9c('0xa')](),controller[_0x9f9c('0xf')]);router[_0x9f9c('0x10')]('/',auth[_0x9f9c('0xa')](),controller[_0x9f9c('0x11')]);router[_0x9f9c('0x12')](_0x9f9c('0x13'),auth[_0x9f9c('0xa')](),controller['update']);router[_0x9f9c('0x14')](_0x9f9c('0x13'),auth[_0x9f9c('0xa')](),controller[_0x9f9c('0x15')]);module[_0x9f9c('0x16')]=router; \ No newline at end of file +var _0x73ef=['../../components/auth/service','../../config/environment','./intZohoConfiguration.controller','get','isAuthenticated','/:id','show','/:id/fields','/:id/subjects','getSubjects','/:id/descriptions','post','create','update','exports','multer','path','connect-timeout','express','fs-extra'];(function(_0x2b5552,_0x8a85ac){var _0x593968=function(_0x31833d){while(--_0x31833d){_0x2b5552['push'](_0x2b5552['shift']());}};_0x593968(++_0x8a85ac);}(_0x73ef,0x87));var _0xf73e=function(_0x2b714a,_0x11482f){_0x2b714a=_0x2b714a-0x0;var _0x8ffd51=_0x73ef[_0x2b714a];return _0x8ffd51;};'use strict';var multer=require(_0xf73e('0x0'));var util=require('util');var path=require(_0xf73e('0x1'));var timeout=require(_0xf73e('0x2'));var express=require(_0xf73e('0x3'));var router=express['Router']();var fs_extra=require(_0xf73e('0x4'));var auth=require(_0xf73e('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0xf73e('0x6'));var controller=require(_0xf73e('0x7'));router[_0xf73e('0x8')]('/',auth[_0xf73e('0x9')](),controller['index']);router[_0xf73e('0x8')](_0xf73e('0xa'),auth[_0xf73e('0x9')](),controller[_0xf73e('0xb')]);router[_0xf73e('0x8')](_0xf73e('0xc'),auth[_0xf73e('0x9')](),controller['getFields']);router[_0xf73e('0x8')](_0xf73e('0xd'),auth[_0xf73e('0x9')](),controller[_0xf73e('0xe')]);router['get'](_0xf73e('0xf'),auth[_0xf73e('0x9')](),controller['getDescriptions']);router[_0xf73e('0x10')]('/',auth['isAuthenticated'](),controller[_0xf73e('0x11')]);router['put']('/:id',auth['isAuthenticated'](),controller[_0xf73e('0x12')]);router['delete'](_0xf73e('0xa'),auth[_0xf73e('0x9')](),controller['destroy']);module[_0xf73e('0x13')]=router; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js b/server/api/intZohoConfiguration/intZohoConfiguration.attributes.js index d12ccd2..831012f 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 _0x4edd=['nothing','lead','contact_lead','STRING','sequelize','ENUM','contact'];(function(_0x3c9c3f,_0x544a8e){var _0x91e734=function(_0xa0a558){while(--_0xa0a558){_0x3c9c3f['push'](_0x3c9c3f['shift']());}};_0x91e734(++_0x544a8e);}(_0x4edd,0x146));var _0xd4ed=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4edd[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0xd4ed('0x0'));module['exports']={'name':{'type':Sequelize['STRING']},'moduleCreate':{'type':Sequelize[_0xd4ed('0x1')]('lead',_0xd4ed('0x2'),_0xd4ed('0x3')),'defaultValue':_0xd4ed('0x4')},'moduleSearch':{'type':Sequelize[_0xd4ed('0x1')](_0xd4ed('0x5'),'contact',_0xd4ed('0x4')),'defaultValue':_0xd4ed('0x5')},'description':{'type':Sequelize[_0xd4ed('0x6')]}}; \ No newline at end of file +var _0x80bd=['contact_lead','sequelize','exports','STRING','lead','contact','nothing'];(function(_0x1a21ff,_0x4a7550){var _0x25afc1=function(_0x4a66ec){while(--_0x4a66ec){_0x1a21ff['push'](_0x1a21ff['shift']());}};_0x25afc1(++_0x4a7550);}(_0x80bd,0x78));var _0xd80b=function(_0x4ca679,_0x4d148a){_0x4ca679=_0x4ca679-0x0;var _0x5bb6aa=_0x80bd[_0x4ca679];return _0x5bb6aa;};'use strict';var Sequelize=require(_0xd80b('0x0'));module[_0xd80b('0x1')]={'name':{'type':Sequelize[_0xd80b('0x2')]},'moduleCreate':{'type':Sequelize['ENUM'](_0xd80b('0x3'),_0xd80b('0x4'),_0xd80b('0x5')),'defaultValue':_0xd80b('0x3')},'moduleSearch':{'type':Sequelize['ENUM'](_0xd80b('0x6'),'contact',_0xd80b('0x3')),'defaultValue':'contact_lead'},'description':{'type':Sequelize[_0xd80b('0x2')]}}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.controller.js b/server/api/intZohoConfiguration/intZohoConfiguration.controller.js index 298abf2..08295c7 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 _0x0d5d=['eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','destroy','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','keys','query','filters','intersection','attributes','fields','length','nolimit','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','show','params','ZohoConfiguration','options','find','catch','create','body','getFields','findOne','ZohoField','order','hasOwnProperty','getSubjects','getDescriptions'];(function(_0x54c933,_0x2df4f0){var _0x2a0f72=function(_0x423473){while(--_0x423473){_0x54c933['push'](_0x54c933['shift']());}};_0x2a0f72(++_0x2df4f0);}(_0x0d5d,0x19f));var _0xd0d5=function(_0x4ecae0,_0x2cb517){_0x4ecae0=_0x4ecae0-0x0;var _0x3cc777=_0x0d5d[_0x4ecae0];return _0x3cc777;};'use strict';var emlformat=require(_0xd0d5('0x0'));var rimraf=require(_0xd0d5('0x1'));var zipdir=require(_0xd0d5('0x2'));var jsonpatch=require(_0xd0d5('0x3'));var rp=require(_0xd0d5('0x4'));var moment=require(_0xd0d5('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xd0d5('0x6'));var path=require(_0xd0d5('0x7'));var sox=require(_0xd0d5('0x8'));var csv=require(_0xd0d5('0x9'));var ejs=require(_0xd0d5('0xa'));var fs=require('fs');var fs_extra=require(_0xd0d5('0xb'));var _=require(_0xd0d5('0xc'));var squel=require('squel');var crypto=require(_0xd0d5('0xd'));var jsforce=require('jsforce');var deskjs=require(_0xd0d5('0xe'));var toCsv=require(_0xd0d5('0x9'));var querystring=require(_0xd0d5('0xf'));var Papa=require(_0xd0d5('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xd0d5('0x11'));var as=require(_0xd0d5('0x12'));var hardwareService=require(_0xd0d5('0x13'));var logger=require('../../config/logger')(_0xd0d5('0x14'));var utils=require(_0xd0d5('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xd0d5('0x16'));var db=require(_0xd0d5('0x17'))['db'];function respondWithStatusCode(_0x1f1168,_0x1beeab){_0x1beeab=_0x1beeab||0xcc;return function(_0x42c0f8){if(_0x42c0f8){return _0x1f1168[_0xd0d5('0x18')](_0x1beeab);}return _0x1f1168[_0xd0d5('0x19')](_0x1beeab)['end']();};}function respondWithResult(_0x4e0926,_0x4b032d){_0x4b032d=_0x4b032d||0xc8;return function(_0x4c6845){if(_0x4c6845){return _0x4e0926['status'](_0x4b032d)[_0xd0d5('0x1a')](_0x4c6845);}};}function respondWithFilteredResult(_0x2d6a3c,_0x83d332){return function(_0x1be161){if(_0x1be161){var _0x1920d2=typeof _0x83d332[_0xd0d5('0x1b')]===_0xd0d5('0x1c')&&typeof _0x83d332[_0xd0d5('0x1d')]===_0xd0d5('0x1c');var _0x412530=_0x1be161[_0xd0d5('0x1e')];var _0x66b995=_0x1920d2?0x0:_0x83d332['offset'];var _0x2a4906=_0x1920d2?_0x1be161[_0xd0d5('0x1e')]:_0x83d332[_0xd0d5('0x1b')]+_0x83d332[_0xd0d5('0x1d')];var _0x1a221e;if(_0x2a4906>=_0x412530){_0x2a4906=_0x412530;_0x1a221e=0xc8;}else{_0x1a221e=0xce;}_0x2d6a3c[_0xd0d5('0x19')](_0x1a221e);return _0x2d6a3c['set'](_0xd0d5('0x1f'),_0x66b995+'-'+_0x2a4906+'/'+_0x412530)['json'](_0x1be161);}return null;};}function patchUpdates(_0x1c19bc){return function(_0x69cf6){try{jsonpatch[_0xd0d5('0x20')](_0x69cf6,_0x1c19bc,!![]);}catch(_0x1544be){return BPromise[_0xd0d5('0x21')](_0x1544be);}return _0x69cf6[_0xd0d5('0x22')]();};}function saveUpdates(_0x2a3d19,_0x2889bc){return function(_0x20284b){if(_0x20284b){return _0x20284b[_0xd0d5('0x23')](_0x2a3d19)['then'](function(_0x17b0ff){return _0x17b0ff;});}return null;};}function removeEntity(_0x121bda,_0x56f2d2){return function(_0x4fd416){if(_0x4fd416){return _0x4fd416[_0xd0d5('0x24')]()[_0xd0d5('0x25')](function(){_0x121bda[_0xd0d5('0x19')](0xcc)[_0xd0d5('0x26')]();});}};}function handleEntityNotFound(_0x203489,_0x3bbe7d){return function(_0x457b9e){if(!_0x457b9e){_0x203489[_0xd0d5('0x18')](0x194);}return _0x457b9e;};}function handleError(_0x4dfe7f,_0x5cd01a){_0x5cd01a=_0x5cd01a||0x1f4;return function(_0x2af1bc){logger[_0xd0d5('0x27')](_0x2af1bc[_0xd0d5('0x28')]);if(_0x2af1bc['name']){delete _0x2af1bc[_0xd0d5('0x29')];}_0x4dfe7f['status'](_0x5cd01a)[_0xd0d5('0x2a')](_0x2af1bc);};}exports[_0xd0d5('0x2b')]=function(_0x51eb6f,_0x214660){var _0x1a0278={},_0x4d3c7f={},_0x1d3081={'count':0x0,'rows':[]};var _0x3aa9e8=_['map'](db['ZohoConfiguration'][_0xd0d5('0x2c')],function(_0x555ac5){return{'name':_0x555ac5[_0xd0d5('0x2d')],'type':_0x555ac5[_0xd0d5('0x2e')][_0xd0d5('0x2f')]};});_0x4d3c7f[_0xd0d5('0x30')]=_[_0xd0d5('0x31')](_0x3aa9e8,_0xd0d5('0x29'));_0x4d3c7f['query']=_[_0xd0d5('0x32')](_0x51eb6f[_0xd0d5('0x33')]);_0x4d3c7f[_0xd0d5('0x34')]=_[_0xd0d5('0x35')](_0x4d3c7f[_0xd0d5('0x30')],_0x4d3c7f['query']);_0x1a0278[_0xd0d5('0x36')]=_[_0xd0d5('0x35')](_0x4d3c7f[_0xd0d5('0x30')],qs[_0xd0d5('0x37')](_0x51eb6f[_0xd0d5('0x33')][_0xd0d5('0x37')]));_0x1a0278['attributes']=_0x1a0278[_0xd0d5('0x36')][_0xd0d5('0x38')]?_0x1a0278[_0xd0d5('0x36')]:_0x4d3c7f[_0xd0d5('0x30')];if(!_0x51eb6f[_0xd0d5('0x33')]['hasOwnProperty'](_0xd0d5('0x39'))){_0x1a0278[_0xd0d5('0x1d')]=qs[_0xd0d5('0x1d')](_0x51eb6f[_0xd0d5('0x33')][_0xd0d5('0x1d')]);_0x1a0278['offset']=qs[_0xd0d5('0x1b')](_0x51eb6f[_0xd0d5('0x33')][_0xd0d5('0x1b')]);}_0x1a0278['order']=qs['sort'](_0x51eb6f['query'][_0xd0d5('0x3a')]);_0x1a0278[_0xd0d5('0x3b')]=qs[_0xd0d5('0x34')](_[_0xd0d5('0x3c')](_0x51eb6f[_0xd0d5('0x33')],_0x4d3c7f[_0xd0d5('0x34')]),_0x3aa9e8);if(_0x51eb6f[_0xd0d5('0x33')][_0xd0d5('0x3d')]){_0x1a0278[_0xd0d5('0x3b')]=_['merge'](_0x1a0278[_0xd0d5('0x3b')],{'$or':_[_0xd0d5('0x31')](_0x3aa9e8,function(_0x51d7b8){if(_0x51d7b8[_0xd0d5('0x2e')]!==_0xd0d5('0x3e')){var _0x2527fd={};_0x2527fd[_0x51d7b8['name']]={'$like':'%'+_0x51eb6f[_0xd0d5('0x33')]['filter']+'%'};return _0x2527fd;}})});}_0x1a0278=_[_0xd0d5('0x3f')]({},_0x1a0278,_0x51eb6f['options']);var _0x2331f6={'where':_0x1a0278['where']};return db['ZohoConfiguration'][_0xd0d5('0x1e')](_0x2331f6)[_0xd0d5('0x25')](function(_0x538ce9){_0x1d3081['count']=_0x538ce9;if(_0x51eb6f[_0xd0d5('0x33')][_0xd0d5('0x40')]){_0x1a0278[_0xd0d5('0x41')]=[{'all':!![]}];}return db['ZohoConfiguration'][_0xd0d5('0x42')](_0x1a0278);})[_0xd0d5('0x25')](function(_0x2b7fd7){_0x1d3081[_0xd0d5('0x43')]=_0x2b7fd7;return _0x1d3081;})['then'](respondWithFilteredResult(_0x214660,_0x1a0278))['catch'](handleError(_0x214660,null));};exports[_0xd0d5('0x44')]=function(_0xa9f589,_0x588cee){var _0x43d27b={'raw':![],'where':{'id':_0xa9f589[_0xd0d5('0x45')]['id']}},_0x4e012b={};_0x4e012b[_0xd0d5('0x30')]=_[_0xd0d5('0x32')](db[_0xd0d5('0x46')][_0xd0d5('0x2c')]);_0x4e012b['query']=_[_0xd0d5('0x32')](_0xa9f589['query']);_0x4e012b['filters']=_['intersection'](_0x4e012b['model'],_0x4e012b['query']);_0x43d27b[_0xd0d5('0x36')]=_[_0xd0d5('0x35')](_0x4e012b[_0xd0d5('0x30')],qs[_0xd0d5('0x37')](_0xa9f589[_0xd0d5('0x33')][_0xd0d5('0x37')]));_0x43d27b['attributes']=_0x43d27b[_0xd0d5('0x36')]['length']?_0x43d27b['attributes']:_0x4e012b[_0xd0d5('0x30')];if(_0xa9f589['query'][_0xd0d5('0x40')]){_0x43d27b[_0xd0d5('0x41')]=[{'all':!![]}];}_0x43d27b=_[_0xd0d5('0x3f')]({},_0x43d27b,_0xa9f589[_0xd0d5('0x47')]);return db[_0xd0d5('0x46')][_0xd0d5('0x48')](_0x43d27b)['then'](handleEntityNotFound(_0x588cee,null))[_0xd0d5('0x25')](respondWithResult(_0x588cee,null))[_0xd0d5('0x49')](handleError(_0x588cee,null));};exports[_0xd0d5('0x4a')]=function(_0x1e93de,_0x352baa){return db[_0xd0d5('0x46')][_0xd0d5('0x4a')](_0x1e93de[_0xd0d5('0x4b')],{})[_0xd0d5('0x25')](respondWithResult(_0x352baa,0xc9))[_0xd0d5('0x49')](handleError(_0x352baa,null));};exports['update']=function(_0x228b3a,_0x5192a2){if(_0x228b3a[_0xd0d5('0x4b')]['id']){delete _0x228b3a['body']['id'];}return db[_0xd0d5('0x46')][_0xd0d5('0x48')]({'where':{'id':_0x228b3a['params']['id']}})[_0xd0d5('0x25')](handleEntityNotFound(_0x5192a2,null))[_0xd0d5('0x25')](saveUpdates(_0x228b3a[_0xd0d5('0x4b')],null))['then'](respondWithResult(_0x5192a2,null))[_0xd0d5('0x49')](handleError(_0x5192a2,null));};exports[_0xd0d5('0x24')]=function(_0x146d7e,_0x3695dd){return db[_0xd0d5('0x46')][_0xd0d5('0x48')]({'where':{'id':_0x146d7e[_0xd0d5('0x45')]['id']}})['then'](handleEntityNotFound(_0x3695dd,null))[_0xd0d5('0x25')](removeEntity(_0x3695dd,null))['catch'](handleError(_0x3695dd,null));};exports[_0xd0d5('0x4c')]=function(_0x4b67c9,_0x3645c0,_0x57fd24){var _0x1e57b2={};var _0x2236ca={};var _0x5e7878;var _0x29ba04;return db[_0xd0d5('0x46')][_0xd0d5('0x4d')]({'where':{'id':_0x4b67c9[_0xd0d5('0x45')]['id']}})[_0xd0d5('0x25')](handleEntityNotFound(_0x3645c0,null))[_0xd0d5('0x25')](function(_0x84b4ef){if(_0x84b4ef){_0x5e7878=_0x84b4ef;_0x2236ca['model']=_[_0xd0d5('0x32')](db[_0xd0d5('0x4e')][_0xd0d5('0x2c')]);_0x2236ca['query']=_['keys'](_0x4b67c9['query']);_0x2236ca[_0xd0d5('0x34')]=_[_0xd0d5('0x35')](_0x2236ca[_0xd0d5('0x30')],_0x2236ca[_0xd0d5('0x33')]);_0x1e57b2[_0xd0d5('0x36')]=_['intersection'](_0x2236ca[_0xd0d5('0x30')],qs['fields'](_0x4b67c9[_0xd0d5('0x33')]['fields']));_0x1e57b2[_0xd0d5('0x36')]=_0x1e57b2[_0xd0d5('0x36')][_0xd0d5('0x38')]?_0x1e57b2[_0xd0d5('0x36')]:_0x2236ca[_0xd0d5('0x30')];_0x1e57b2[_0xd0d5('0x4f')]=qs[_0xd0d5('0x3a')](_0x4b67c9['query'][_0xd0d5('0x3a')]);_0x1e57b2[_0xd0d5('0x3b')]=qs[_0xd0d5('0x34')](_[_0xd0d5('0x3c')](_0x4b67c9['query'],_0x2236ca[_0xd0d5('0x34')]));if(_0x4b67c9[_0xd0d5('0x33')][_0xd0d5('0x3d')]){_0x1e57b2[_0xd0d5('0x3b')]=_[_0xd0d5('0x3f')](_0x1e57b2[_0xd0d5('0x3b')],{'$or':_[_0xd0d5('0x31')](_0x1e57b2[_0xd0d5('0x36')],function(_0x10d479){var _0x4fde17={};_0x4fde17[_0x10d479]={'$like':'%'+_0x4b67c9[_0xd0d5('0x33')]['filter']+'%'};return _0x4fde17;})});}_0x1e57b2=_['merge']({},_0x1e57b2,_0x4b67c9[_0xd0d5('0x47')]);return _0x5e7878[_0xd0d5('0x4c')](_0x1e57b2);}})[_0xd0d5('0x25')](function(_0x1a93f3){if(_0x1a93f3){_0x29ba04=_0x1a93f3[_0xd0d5('0x38')];if(!_0x4b67c9[_0xd0d5('0x33')][_0xd0d5('0x50')](_0xd0d5('0x39'))){_0x1e57b2[_0xd0d5('0x1d')]=qs['limit'](_0x4b67c9[_0xd0d5('0x33')][_0xd0d5('0x1d')]);_0x1e57b2[_0xd0d5('0x1b')]=qs['offset'](_0x4b67c9[_0xd0d5('0x33')][_0xd0d5('0x1b')]);}return _0x5e7878['getFields'](_0x1e57b2);}})[_0xd0d5('0x25')](function(_0x253f85){if(_0x253f85){return _0x253f85?{'count':_0x29ba04,'rows':_0x253f85}:null;}})['then'](respondWithResult(_0x3645c0,null))[_0xd0d5('0x49')](handleError(_0x3645c0,null));};exports[_0xd0d5('0x51')]=function(_0x3fdc01,_0x1bcea3,_0x381a3a){var _0x33a55f={};var _0x5ab42f={};var _0x1a2436;var _0x1a5f11;return db[_0xd0d5('0x46')][_0xd0d5('0x4d')]({'where':{'id':_0x3fdc01[_0xd0d5('0x45')]['id']}})[_0xd0d5('0x25')](handleEntityNotFound(_0x1bcea3,null))[_0xd0d5('0x25')](function(_0x2c07d5){if(_0x2c07d5){_0x1a2436=_0x2c07d5;_0x5ab42f[_0xd0d5('0x30')]=_[_0xd0d5('0x32')](db[_0xd0d5('0x4e')][_0xd0d5('0x2c')]);_0x5ab42f['query']=_[_0xd0d5('0x32')](_0x3fdc01[_0xd0d5('0x33')]);_0x5ab42f['filters']=_[_0xd0d5('0x35')](_0x5ab42f[_0xd0d5('0x30')],_0x5ab42f['query']);_0x33a55f[_0xd0d5('0x36')]=_[_0xd0d5('0x35')](_0x5ab42f[_0xd0d5('0x30')],qs[_0xd0d5('0x37')](_0x3fdc01[_0xd0d5('0x33')][_0xd0d5('0x37')]));_0x33a55f[_0xd0d5('0x36')]=_0x33a55f[_0xd0d5('0x36')][_0xd0d5('0x38')]?_0x33a55f['attributes']:_0x5ab42f[_0xd0d5('0x30')];_0x33a55f['order']=qs[_0xd0d5('0x3a')](_0x3fdc01[_0xd0d5('0x33')][_0xd0d5('0x3a')]);_0x33a55f['where']=qs[_0xd0d5('0x34')](_['pick'](_0x3fdc01[_0xd0d5('0x33')],_0x5ab42f[_0xd0d5('0x34')]));if(_0x3fdc01[_0xd0d5('0x33')][_0xd0d5('0x3d')]){_0x33a55f[_0xd0d5('0x3b')]=_[_0xd0d5('0x3f')](_0x33a55f['where'],{'$or':_[_0xd0d5('0x31')](_0x33a55f[_0xd0d5('0x36')],function(_0x42d735){var _0x53166c={};_0x53166c[_0x42d735]={'$like':'%'+_0x3fdc01[_0xd0d5('0x33')][_0xd0d5('0x3d')]+'%'};return _0x53166c;})});}_0x33a55f=_[_0xd0d5('0x3f')]({},_0x33a55f,_0x3fdc01['options']);return _0x1a2436['getSubjects'](_0x33a55f);}})[_0xd0d5('0x25')](function(_0x5e027e){if(_0x5e027e){_0x1a5f11=_0x5e027e[_0xd0d5('0x38')];if(!_0x3fdc01[_0xd0d5('0x33')][_0xd0d5('0x50')](_0xd0d5('0x39'))){_0x33a55f[_0xd0d5('0x1d')]=qs[_0xd0d5('0x1d')](_0x3fdc01[_0xd0d5('0x33')][_0xd0d5('0x1d')]);_0x33a55f[_0xd0d5('0x1b')]=qs[_0xd0d5('0x1b')](_0x3fdc01[_0xd0d5('0x33')][_0xd0d5('0x1b')]);}return _0x1a2436[_0xd0d5('0x51')](_0x33a55f);}})[_0xd0d5('0x25')](function(_0x11cce3){if(_0x11cce3){return _0x11cce3?{'count':_0x1a5f11,'rows':_0x11cce3}:null;}})['then'](respondWithResult(_0x1bcea3,null))[_0xd0d5('0x49')](handleError(_0x1bcea3,null));};exports[_0xd0d5('0x52')]=function(_0x1fdb5d,_0x5da628,_0x259578){var _0xa1e0dc={};var _0x154aa1={};var _0x567969;var _0x3ee34c;return db[_0xd0d5('0x46')][_0xd0d5('0x4d')]({'where':{'id':_0x1fdb5d[_0xd0d5('0x45')]['id']}})['then'](handleEntityNotFound(_0x5da628,null))['then'](function(_0x52694c){if(_0x52694c){_0x567969=_0x52694c;_0x154aa1[_0xd0d5('0x30')]=_[_0xd0d5('0x32')](db[_0xd0d5('0x4e')][_0xd0d5('0x2c')]);_0x154aa1[_0xd0d5('0x33')]=_[_0xd0d5('0x32')](_0x1fdb5d[_0xd0d5('0x33')]);_0x154aa1[_0xd0d5('0x34')]=_[_0xd0d5('0x35')](_0x154aa1[_0xd0d5('0x30')],_0x154aa1[_0xd0d5('0x33')]);_0xa1e0dc[_0xd0d5('0x36')]=_[_0xd0d5('0x35')](_0x154aa1[_0xd0d5('0x30')],qs['fields'](_0x1fdb5d[_0xd0d5('0x33')]['fields']));_0xa1e0dc['attributes']=_0xa1e0dc[_0xd0d5('0x36')][_0xd0d5('0x38')]?_0xa1e0dc['attributes']:_0x154aa1[_0xd0d5('0x30')];_0xa1e0dc['order']=qs[_0xd0d5('0x3a')](_0x1fdb5d[_0xd0d5('0x33')][_0xd0d5('0x3a')]);_0xa1e0dc[_0xd0d5('0x3b')]=qs[_0xd0d5('0x34')](_['pick'](_0x1fdb5d[_0xd0d5('0x33')],_0x154aa1[_0xd0d5('0x34')]));if(_0x1fdb5d['query'][_0xd0d5('0x3d')]){_0xa1e0dc[_0xd0d5('0x3b')]=_[_0xd0d5('0x3f')](_0xa1e0dc[_0xd0d5('0x3b')],{'$or':_[_0xd0d5('0x31')](_0xa1e0dc[_0xd0d5('0x36')],function(_0x2d1b1a){var _0x31068c={};_0x31068c[_0x2d1b1a]={'$like':'%'+_0x1fdb5d['query']['filter']+'%'};return _0x31068c;})});}_0xa1e0dc=_[_0xd0d5('0x3f')]({},_0xa1e0dc,_0x1fdb5d[_0xd0d5('0x47')]);return _0x567969[_0xd0d5('0x52')](_0xa1e0dc);}})[_0xd0d5('0x25')](function(_0x2aab45){if(_0x2aab45){_0x3ee34c=_0x2aab45[_0xd0d5('0x38')];if(!_0x1fdb5d[_0xd0d5('0x33')]['hasOwnProperty'](_0xd0d5('0x39'))){_0xa1e0dc[_0xd0d5('0x1d')]=qs[_0xd0d5('0x1d')](_0x1fdb5d['query']['limit']);_0xa1e0dc[_0xd0d5('0x1b')]=qs[_0xd0d5('0x1b')](_0x1fdb5d[_0xd0d5('0x33')][_0xd0d5('0x1b')]);}return _0x567969[_0xd0d5('0x52')](_0xa1e0dc);}})[_0xd0d5('0x25')](function(_0x4ac321){if(_0x4ac321){return _0x4ac321?{'count':_0x3ee34c,'rows':_0x4ac321}:null;}})[_0xd0d5('0x25')](respondWithResult(_0x5da628,null))[_0xd0d5('0x49')](handleError(_0x5da628,null));}; \ No newline at end of file +var _0x51de=['apply','save','update','then','destroy','stack','name','send','map','ZohoConfiguration','rawAttributes','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','filters','pick','filter','merge','where','includeAll','include','findAll','rows','catch','show','params','options','find','create','body','getFields','ZohoField','findOne','getSubjects','getDescriptions','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','count','limit','status','set','Content-Range'];(function(_0x1f7421,_0x40b1c2){var _0x5a8ae6=function(_0x406b66){while(--_0x406b66){_0x1f7421['push'](_0x1f7421['shift']());}};_0x5a8ae6(++_0x40b1c2);}(_0x51de,0x123));var _0xe51d=function(_0x5aece9,_0x2bbb9a){_0x5aece9=_0x5aece9-0x0;var _0x1c46d6=_0x51de[_0x5aece9];return _0x1c46d6;};'use strict';var emlformat=require(_0xe51d('0x0'));var rimraf=require(_0xe51d('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe51d('0x2'));var rp=require(_0xe51d('0x3'));var moment=require(_0xe51d('0x4'));var BPromise=require(_0xe51d('0x5'));var Mustache=require(_0xe51d('0x6'));var util=require(_0xe51d('0x7'));var path=require(_0xe51d('0x8'));var sox=require(_0xe51d('0x9'));var csv=require(_0xe51d('0xa'));var ejs=require(_0xe51d('0xb'));var fs=require('fs');var fs_extra=require(_0xe51d('0xc'));var _=require(_0xe51d('0xd'));var squel=require('squel');var crypto=require(_0xe51d('0xe'));var jsforce=require(_0xe51d('0xf'));var deskjs=require(_0xe51d('0x10'));var toCsv=require(_0xe51d('0xa'));var querystring=require(_0xe51d('0x11'));var Papa=require(_0xe51d('0x12'));var Redis=require(_0xe51d('0x13'));var authService=require(_0xe51d('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe51d('0x15'));var logger=require(_0xe51d('0x16'))(_0xe51d('0x17'));var utils=require('../../config/utils');var config=require(_0xe51d('0x18'));var licenseUtil=require(_0xe51d('0x19'));var db=require(_0xe51d('0x1a'))['db'];function respondWithStatusCode(_0x100d1b,_0x1ef1fc){_0x1ef1fc=_0x1ef1fc||0xcc;return function(_0x60514e){if(_0x60514e){return _0x100d1b[_0xe51d('0x1b')](_0x1ef1fc);}return _0x100d1b['status'](_0x1ef1fc)[_0xe51d('0x1c')]();};}function respondWithResult(_0x1e2aab,_0x35c058){_0x35c058=_0x35c058||0xc8;return function(_0x567a7a){if(_0x567a7a){return _0x1e2aab['status'](_0x35c058)[_0xe51d('0x1d')](_0x567a7a);}};}function respondWithFilteredResult(_0x271d91,_0x2cedd9){return function(_0x1c447c){if(_0x1c447c){var _0x2428d5=typeof _0x2cedd9[_0xe51d('0x1e')]===_0xe51d('0x1f')&&typeof _0x2cedd9['limit']===_0xe51d('0x1f');var _0x5bcfdf=_0x1c447c[_0xe51d('0x20')];var _0x534ad6=_0x2428d5?0x0:_0x2cedd9[_0xe51d('0x1e')];var _0x1a7bf8=_0x2428d5?_0x1c447c['count']:_0x2cedd9[_0xe51d('0x1e')]+_0x2cedd9[_0xe51d('0x21')];var _0x5633b4;if(_0x1a7bf8>=_0x5bcfdf){_0x1a7bf8=_0x5bcfdf;_0x5633b4=0xc8;}else{_0x5633b4=0xce;}_0x271d91[_0xe51d('0x22')](_0x5633b4);return _0x271d91[_0xe51d('0x23')](_0xe51d('0x24'),_0x534ad6+'-'+_0x1a7bf8+'/'+_0x5bcfdf)[_0xe51d('0x1d')](_0x1c447c);}return null;};}function patchUpdates(_0x1c94bc){return function(_0x5e4a58){try{jsonpatch[_0xe51d('0x25')](_0x5e4a58,_0x1c94bc,!![]);}catch(_0x2da93b){return BPromise['reject'](_0x2da93b);}return _0x5e4a58[_0xe51d('0x26')]();};}function saveUpdates(_0x4dc829,_0x2b977f){return function(_0x5f3806){if(_0x5f3806){return _0x5f3806[_0xe51d('0x27')](_0x4dc829)[_0xe51d('0x28')](function(_0x57e2a){return _0x57e2a;});}return null;};}function removeEntity(_0x2c6209,_0x4f89f7){return function(_0x2b7f1f){if(_0x2b7f1f){return _0x2b7f1f[_0xe51d('0x29')]()['then'](function(){_0x2c6209['status'](0xcc)[_0xe51d('0x1c')]();});}};}function handleEntityNotFound(_0x4a2135,_0x30d33e){return function(_0xad9f2f){if(!_0xad9f2f){_0x4a2135['sendStatus'](0x194);}return _0xad9f2f;};}function handleError(_0x3ed670,_0x5bf84a){_0x5bf84a=_0x5bf84a||0x1f4;return function(_0x212731){logger['error'](_0x212731[_0xe51d('0x2a')]);if(_0x212731[_0xe51d('0x2b')]){delete _0x212731[_0xe51d('0x2b')];}_0x3ed670[_0xe51d('0x22')](_0x5bf84a)[_0xe51d('0x2c')](_0x212731);};}exports['index']=function(_0x508f79,_0xe70a05){var _0x4356d2={},_0x543678={},_0x51d2b5={'count':0x0,'rows':[]};var _0x2fb982=_[_0xe51d('0x2d')](db[_0xe51d('0x2e')][_0xe51d('0x2f')],function(_0x3eceb9){return{'name':_0x3eceb9[_0xe51d('0x30')],'type':_0x3eceb9[_0xe51d('0x31')]['key']};});_0x543678[_0xe51d('0x32')]=_[_0xe51d('0x2d')](_0x2fb982,_0xe51d('0x2b'));_0x543678[_0xe51d('0x33')]=_[_0xe51d('0x34')](_0x508f79['query']);_0x543678['filters']=_[_0xe51d('0x35')](_0x543678[_0xe51d('0x32')],_0x543678['query']);_0x4356d2[_0xe51d('0x36')]=_['intersection'](_0x543678[_0xe51d('0x32')],qs['fields'](_0x508f79[_0xe51d('0x33')][_0xe51d('0x37')]));_0x4356d2[_0xe51d('0x36')]=_0x4356d2['attributes'][_0xe51d('0x38')]?_0x4356d2[_0xe51d('0x36')]:_0x543678[_0xe51d('0x32')];if(!_0x508f79[_0xe51d('0x33')][_0xe51d('0x39')](_0xe51d('0x3a'))){_0x4356d2[_0xe51d('0x21')]=qs[_0xe51d('0x21')](_0x508f79[_0xe51d('0x33')][_0xe51d('0x21')]);_0x4356d2[_0xe51d('0x1e')]=qs[_0xe51d('0x1e')](_0x508f79[_0xe51d('0x33')]['offset']);}_0x4356d2[_0xe51d('0x3b')]=qs['sort'](_0x508f79[_0xe51d('0x33')][_0xe51d('0x3c')]);_0x4356d2['where']=qs[_0xe51d('0x3d')](_[_0xe51d('0x3e')](_0x508f79['query'],_0x543678[_0xe51d('0x3d')]),_0x2fb982);if(_0x508f79['query'][_0xe51d('0x3f')]){_0x4356d2['where']=_[_0xe51d('0x40')](_0x4356d2['where'],{'$or':_[_0xe51d('0x2d')](_0x2fb982,function(_0x4c0dc9){if(_0x4c0dc9['type']!=='VIRTUAL'){var _0x2d6659={};_0x2d6659[_0x4c0dc9[_0xe51d('0x2b')]]={'$like':'%'+_0x508f79['query']['filter']+'%'};return _0x2d6659;}})});}_0x4356d2=_[_0xe51d('0x40')]({},_0x4356d2,_0x508f79['options']);var _0xe5b636={'where':_0x4356d2[_0xe51d('0x41')]};return db[_0xe51d('0x2e')][_0xe51d('0x20')](_0xe5b636)[_0xe51d('0x28')](function(_0x42accd){_0x51d2b5[_0xe51d('0x20')]=_0x42accd;if(_0x508f79['query'][_0xe51d('0x42')]){_0x4356d2[_0xe51d('0x43')]=[{'all':!![]}];}return db[_0xe51d('0x2e')][_0xe51d('0x44')](_0x4356d2);})[_0xe51d('0x28')](function(_0x32d85c){_0x51d2b5[_0xe51d('0x45')]=_0x32d85c;return _0x51d2b5;})[_0xe51d('0x28')](respondWithFilteredResult(_0xe70a05,_0x4356d2))[_0xe51d('0x46')](handleError(_0xe70a05,null));};exports[_0xe51d('0x47')]=function(_0x271ac1,_0xd9b75e){var _0x14095b={'raw':![],'where':{'id':_0x271ac1[_0xe51d('0x48')]['id']}},_0x440c28={};_0x440c28[_0xe51d('0x32')]=_['keys'](db[_0xe51d('0x2e')][_0xe51d('0x2f')]);_0x440c28[_0xe51d('0x33')]=_[_0xe51d('0x34')](_0x271ac1['query']);_0x440c28['filters']=_[_0xe51d('0x35')](_0x440c28[_0xe51d('0x32')],_0x440c28[_0xe51d('0x33')]);_0x14095b[_0xe51d('0x36')]=_[_0xe51d('0x35')](_0x440c28['model'],qs[_0xe51d('0x37')](_0x271ac1[_0xe51d('0x33')]['fields']));_0x14095b[_0xe51d('0x36')]=_0x14095b[_0xe51d('0x36')][_0xe51d('0x38')]?_0x14095b[_0xe51d('0x36')]:_0x440c28[_0xe51d('0x32')];if(_0x271ac1[_0xe51d('0x33')][_0xe51d('0x42')]){_0x14095b[_0xe51d('0x43')]=[{'all':!![]}];}_0x14095b=_[_0xe51d('0x40')]({},_0x14095b,_0x271ac1[_0xe51d('0x49')]);return db[_0xe51d('0x2e')][_0xe51d('0x4a')](_0x14095b)[_0xe51d('0x28')](handleEntityNotFound(_0xd9b75e,null))[_0xe51d('0x28')](respondWithResult(_0xd9b75e,null))[_0xe51d('0x46')](handleError(_0xd9b75e,null));};exports[_0xe51d('0x4b')]=function(_0x385239,_0x3b89f6){return db['ZohoConfiguration'][_0xe51d('0x4b')](_0x385239['body'],{})[_0xe51d('0x28')](respondWithResult(_0x3b89f6,0xc9))['catch'](handleError(_0x3b89f6,null));};exports[_0xe51d('0x27')]=function(_0x19808f,_0xa7089d){if(_0x19808f[_0xe51d('0x4c')]['id']){delete _0x19808f[_0xe51d('0x4c')]['id'];}return db[_0xe51d('0x2e')][_0xe51d('0x4a')]({'where':{'id':_0x19808f['params']['id']}})[_0xe51d('0x28')](handleEntityNotFound(_0xa7089d,null))[_0xe51d('0x28')](saveUpdates(_0x19808f[_0xe51d('0x4c')],null))['then'](respondWithResult(_0xa7089d,null))[_0xe51d('0x46')](handleError(_0xa7089d,null));};exports['destroy']=function(_0x508fac,_0x257e41){return db['ZohoConfiguration'][_0xe51d('0x4a')]({'where':{'id':_0x508fac['params']['id']}})[_0xe51d('0x28')](handleEntityNotFound(_0x257e41,null))[_0xe51d('0x28')](removeEntity(_0x257e41,null))[_0xe51d('0x46')](handleError(_0x257e41,null));};exports[_0xe51d('0x4d')]=function(_0x196dcc,_0x13d935,_0x12dcb2){var _0x4b1f7a={};var _0x503088={};var _0x1ac3c5;var _0x5b2ac0;return db['ZohoConfiguration']['findOne']({'where':{'id':_0x196dcc[_0xe51d('0x48')]['id']}})[_0xe51d('0x28')](handleEntityNotFound(_0x13d935,null))['then'](function(_0x3fdba2){if(_0x3fdba2){_0x1ac3c5=_0x3fdba2;_0x503088['model']=_[_0xe51d('0x34')](db[_0xe51d('0x4e')][_0xe51d('0x2f')]);_0x503088[_0xe51d('0x33')]=_[_0xe51d('0x34')](_0x196dcc['query']);_0x503088[_0xe51d('0x3d')]=_['intersection'](_0x503088[_0xe51d('0x32')],_0x503088[_0xe51d('0x33')]);_0x4b1f7a[_0xe51d('0x36')]=_[_0xe51d('0x35')](_0x503088[_0xe51d('0x32')],qs[_0xe51d('0x37')](_0x196dcc['query'][_0xe51d('0x37')]));_0x4b1f7a[_0xe51d('0x36')]=_0x4b1f7a[_0xe51d('0x36')][_0xe51d('0x38')]?_0x4b1f7a['attributes']:_0x503088[_0xe51d('0x32')];_0x4b1f7a[_0xe51d('0x3b')]=qs[_0xe51d('0x3c')](_0x196dcc[_0xe51d('0x33')]['sort']);_0x4b1f7a[_0xe51d('0x41')]=qs['filters'](_[_0xe51d('0x3e')](_0x196dcc[_0xe51d('0x33')],_0x503088[_0xe51d('0x3d')]));if(_0x196dcc[_0xe51d('0x33')][_0xe51d('0x3f')]){_0x4b1f7a[_0xe51d('0x41')]=_[_0xe51d('0x40')](_0x4b1f7a[_0xe51d('0x41')],{'$or':_['map'](_0x4b1f7a[_0xe51d('0x36')],function(_0x577f58){var _0x226ccb={};_0x226ccb[_0x577f58]={'$like':'%'+_0x196dcc[_0xe51d('0x33')][_0xe51d('0x3f')]+'%'};return _0x226ccb;})});}_0x4b1f7a=_['merge']({},_0x4b1f7a,_0x196dcc['options']);return _0x1ac3c5['getFields'](_0x4b1f7a);}})['then'](function(_0x42063c){if(_0x42063c){_0x5b2ac0=_0x42063c[_0xe51d('0x38')];if(!_0x196dcc[_0xe51d('0x33')][_0xe51d('0x39')](_0xe51d('0x3a'))){_0x4b1f7a['limit']=qs[_0xe51d('0x21')](_0x196dcc['query']['limit']);_0x4b1f7a['offset']=qs[_0xe51d('0x1e')](_0x196dcc[_0xe51d('0x33')][_0xe51d('0x1e')]);}return _0x1ac3c5[_0xe51d('0x4d')](_0x4b1f7a);}})[_0xe51d('0x28')](function(_0x49a8b1){if(_0x49a8b1){return _0x49a8b1?{'count':_0x5b2ac0,'rows':_0x49a8b1}:null;}})[_0xe51d('0x28')](respondWithResult(_0x13d935,null))['catch'](handleError(_0x13d935,null));};exports['getSubjects']=function(_0x256c13,_0x59e708,_0x564835){var _0x42d92a={};var _0x5886dd={};var _0x17d226;var _0x2c6219;return db[_0xe51d('0x2e')][_0xe51d('0x4f')]({'where':{'id':_0x256c13[_0xe51d('0x48')]['id']}})[_0xe51d('0x28')](handleEntityNotFound(_0x59e708,null))['then'](function(_0x4d1a9d){if(_0x4d1a9d){_0x17d226=_0x4d1a9d;_0x5886dd[_0xe51d('0x32')]=_[_0xe51d('0x34')](db[_0xe51d('0x4e')][_0xe51d('0x2f')]);_0x5886dd[_0xe51d('0x33')]=_[_0xe51d('0x34')](_0x256c13[_0xe51d('0x33')]);_0x5886dd[_0xe51d('0x3d')]=_['intersection'](_0x5886dd[_0xe51d('0x32')],_0x5886dd[_0xe51d('0x33')]);_0x42d92a[_0xe51d('0x36')]=_[_0xe51d('0x35')](_0x5886dd[_0xe51d('0x32')],qs[_0xe51d('0x37')](_0x256c13[_0xe51d('0x33')][_0xe51d('0x37')]));_0x42d92a[_0xe51d('0x36')]=_0x42d92a[_0xe51d('0x36')][_0xe51d('0x38')]?_0x42d92a[_0xe51d('0x36')]:_0x5886dd[_0xe51d('0x32')];_0x42d92a['order']=qs[_0xe51d('0x3c')](_0x256c13[_0xe51d('0x33')][_0xe51d('0x3c')]);_0x42d92a[_0xe51d('0x41')]=qs[_0xe51d('0x3d')](_[_0xe51d('0x3e')](_0x256c13[_0xe51d('0x33')],_0x5886dd[_0xe51d('0x3d')]));if(_0x256c13[_0xe51d('0x33')]['filter']){_0x42d92a[_0xe51d('0x41')]=_[_0xe51d('0x40')](_0x42d92a[_0xe51d('0x41')],{'$or':_['map'](_0x42d92a[_0xe51d('0x36')],function(_0x18712f){var _0x45da6e={};_0x45da6e[_0x18712f]={'$like':'%'+_0x256c13[_0xe51d('0x33')]['filter']+'%'};return _0x45da6e;})});}_0x42d92a=_[_0xe51d('0x40')]({},_0x42d92a,_0x256c13[_0xe51d('0x49')]);return _0x17d226[_0xe51d('0x50')](_0x42d92a);}})[_0xe51d('0x28')](function(_0x25c40e){if(_0x25c40e){_0x2c6219=_0x25c40e[_0xe51d('0x38')];if(!_0x256c13['query'][_0xe51d('0x39')](_0xe51d('0x3a'))){_0x42d92a[_0xe51d('0x21')]=qs[_0xe51d('0x21')](_0x256c13['query'][_0xe51d('0x21')]);_0x42d92a[_0xe51d('0x1e')]=qs['offset'](_0x256c13[_0xe51d('0x33')][_0xe51d('0x1e')]);}return _0x17d226[_0xe51d('0x50')](_0x42d92a);}})[_0xe51d('0x28')](function(_0x54ae78){if(_0x54ae78){return _0x54ae78?{'count':_0x2c6219,'rows':_0x54ae78}:null;}})['then'](respondWithResult(_0x59e708,null))[_0xe51d('0x46')](handleError(_0x59e708,null));};exports['getDescriptions']=function(_0x52ead6,_0xe86aa3,_0x51ece5){var _0x3e36f9={};var _0xe77ccd={};var _0x246046;var _0xab0826;return db[_0xe51d('0x2e')]['findOne']({'where':{'id':_0x52ead6[_0xe51d('0x48')]['id']}})['then'](handleEntityNotFound(_0xe86aa3,null))['then'](function(_0x496e40){if(_0x496e40){_0x246046=_0x496e40;_0xe77ccd['model']=_[_0xe51d('0x34')](db['ZohoField'][_0xe51d('0x2f')]);_0xe77ccd[_0xe51d('0x33')]=_['keys'](_0x52ead6[_0xe51d('0x33')]);_0xe77ccd['filters']=_[_0xe51d('0x35')](_0xe77ccd['model'],_0xe77ccd[_0xe51d('0x33')]);_0x3e36f9[_0xe51d('0x36')]=_[_0xe51d('0x35')](_0xe77ccd[_0xe51d('0x32')],qs['fields'](_0x52ead6[_0xe51d('0x33')]['fields']));_0x3e36f9[_0xe51d('0x36')]=_0x3e36f9['attributes'][_0xe51d('0x38')]?_0x3e36f9[_0xe51d('0x36')]:_0xe77ccd['model'];_0x3e36f9[_0xe51d('0x3b')]=qs['sort'](_0x52ead6[_0xe51d('0x33')][_0xe51d('0x3c')]);_0x3e36f9[_0xe51d('0x41')]=qs[_0xe51d('0x3d')](_['pick'](_0x52ead6['query'],_0xe77ccd['filters']));if(_0x52ead6['query'][_0xe51d('0x3f')]){_0x3e36f9[_0xe51d('0x41')]=_[_0xe51d('0x40')](_0x3e36f9[_0xe51d('0x41')],{'$or':_['map'](_0x3e36f9[_0xe51d('0x36')],function(_0x59b9c4){var _0x40308d={};_0x40308d[_0x59b9c4]={'$like':'%'+_0x52ead6[_0xe51d('0x33')]['filter']+'%'};return _0x40308d;})});}_0x3e36f9=_['merge']({},_0x3e36f9,_0x52ead6[_0xe51d('0x49')]);return _0x246046[_0xe51d('0x51')](_0x3e36f9);}})[_0xe51d('0x28')](function(_0x3d841b){if(_0x3d841b){_0xab0826=_0x3d841b[_0xe51d('0x38')];if(!_0x52ead6['query'][_0xe51d('0x39')](_0xe51d('0x3a'))){_0x3e36f9[_0xe51d('0x21')]=qs[_0xe51d('0x21')](_0x52ead6[_0xe51d('0x33')][_0xe51d('0x21')]);_0x3e36f9[_0xe51d('0x1e')]=qs[_0xe51d('0x1e')](_0x52ead6['query'][_0xe51d('0x1e')]);}return _0x246046['getDescriptions'](_0x3e36f9);}})[_0xe51d('0x28')](function(_0x1b9ad2){if(_0x1b9ad2){return _0x1b9ad2?{'count':_0xab0826,'rows':_0x1b9ad2}:null;}})[_0xe51d('0x28')](respondWithResult(_0xe86aa3,null))[_0xe51d('0x46')](handleError(_0xe86aa3,null));}; \ No newline at end of file diff --git a/server/api/intZohoConfiguration/intZohoConfiguration.model.js b/server/api/intZohoConfiguration/intZohoConfiguration.model.js index 9e32c66..508b419 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 _0xcd67=['lodash','util','moment','request-promise','path','rimraf','../../config/environment','exports','define','ZohoConfiguration','int_zoho_configurations'];(function(_0x422ea7,_0x2621c2){var _0x3ad7e4=function(_0x48067d){while(--_0x48067d){_0x422ea7['push'](_0x422ea7['shift']());}};_0x3ad7e4(++_0x2621c2);}(_0xcd67,0x79));var _0x7cd6=function(_0x12e450,_0x5e84f9){_0x12e450=_0x12e450-0x0;var _0x34ec20=_0xcd67[_0x12e450];return _0x34ec20;};'use strict';var _=require(_0x7cd6('0x0'));var util=require(_0x7cd6('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x7cd6('0x2'));var BPromise=require('bluebird');var rp=require(_0x7cd6('0x3'));var fs=require('fs');var path=require(_0x7cd6('0x4'));var rimraf=require(_0x7cd6('0x5'));var config=require(_0x7cd6('0x6'));var attributes=require('./intZohoConfiguration.attributes');module[_0x7cd6('0x7')]=function(_0x2836d7,_0x58f743){return _0x2836d7[_0x7cd6('0x8')](_0x7cd6('0x9'),attributes,{'tableName':_0x7cd6('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52a7=['path','rimraf','../../config/environment','./intZohoConfiguration.attributes','exports','define','ZohoConfiguration','int_zoho_configurations','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x3355,_0x9b2e0f){var _0x3fcab2=function(_0x2523bf){while(--_0x2523bf){_0x3355['push'](_0x3355['shift']());}};_0x3fcab2(++_0x9b2e0f);}(_0x52a7,0x174));var _0x752a=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x52a7[_0x59ee6f];return _0x4c0979;};'use strict';var _=require(_0x752a('0x0'));var util=require(_0x752a('0x1'));var logger=require(_0x752a('0x2'))('api');var moment=require(_0x752a('0x3'));var BPromise=require(_0x752a('0x4'));var rp=require(_0x752a('0x5'));var fs=require('fs');var path=require(_0x752a('0x6'));var rimraf=require(_0x752a('0x7'));var config=require(_0x752a('0x8'));var attributes=require(_0x752a('0x9'));module[_0x752a('0xa')]=function(_0x591c78,_0x372971){return _0x591c78[_0x752a('0xb')](_0x752a('0xc'),attributes,{'tableName':_0x752a('0xd'),'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 d97a8fb..73fa040 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 _0xf281=['lodash','util','bluebird','randomstring','../../config/utils','rpc','jayson/promise','http','then','info','request\x20sent','debug','ZohoConfiguration,\x20%s,\x20%s,\x20%s','stringify','error','code','ZohoConfiguration,\x20%s,\x20%s','message','result','catch'];(function(_0xee3b34,_0x283f44){var _0x44c11e=function(_0x1423b6){while(--_0x1423b6){_0xee3b34['push'](_0xee3b34['shift']());}};_0x44c11e(++_0x283f44);}(_0xf281,0x17c));var _0x1f28=function(_0x2a9422,_0x115cd4){_0x2a9422=_0x2a9422-0x0;var _0x36232f=_0xf281[_0x2a9422];return _0x36232f;};'use strict';var _=require(_0x1f28('0x0'));var util=require(_0x1f28('0x1'));var moment=require('moment');var BPromise=require(_0x1f28('0x2'));var rs=require(_0x1f28('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1f28('0x4'));var logger=require('../../config/logger')(_0x1f28('0x5'));var config=require('../../config/environment');var jayson=require(_0x1f28('0x6'));var client=jayson['client'][_0x1f28('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x37488b,_0x211089,_0x161007){return new BPromise(function(_0x3d55d2,_0x1c23b8){return client['request'](_0x37488b,_0x161007)[_0x1f28('0x8')](function(_0x5e6560){logger[_0x1f28('0x9')]('ZohoConfiguration,\x20%s,\x20%s',_0x211089,_0x1f28('0xa'));logger[_0x1f28('0xb')](_0x1f28('0xc'),_0x211089,_0x1f28('0xa'),JSON[_0x1f28('0xd')](_0x5e6560));if(_0x5e6560[_0x1f28('0xe')]){if(_0x5e6560[_0x1f28('0xe')][_0x1f28('0xf')]===0x1f4){logger[_0x1f28('0xe')](_0x1f28('0x10'),_0x211089,_0x5e6560[_0x1f28('0xe')][_0x1f28('0x11')]);return _0x1c23b8(_0x5e6560[_0x1f28('0xe')]['message']);}logger[_0x1f28('0xe')](_0x1f28('0x10'),_0x211089,_0x5e6560[_0x1f28('0xe')][_0x1f28('0x11')]);return _0x3d55d2(_0x5e6560['error'][_0x1f28('0x11')]);}else{logger['info'](_0x1f28('0x10'),_0x211089,_0x1f28('0xa'));_0x3d55d2(_0x5e6560[_0x1f28('0x12')][_0x1f28('0x11')]);}})[_0x1f28('0x13')](function(_0x3c8881){logger[_0x1f28('0xe')](_0x1f28('0x10'),_0x211089,_0x3c8881);_0x1c23b8(_0x3c8881);});});} \ No newline at end of file +var _0xb7fd=['ZohoConfiguration,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','ZohoConfiguration,\x20%s,\x20%s','debug'];(function(_0x3b0c9d,_0x3ddeb5){var _0xcfc8d7=function(_0x320dc6){while(--_0x320dc6){_0x3b0c9d['push'](_0x3b0c9d['shift']());}};_0xcfc8d7(++_0x3ddeb5);}(_0xb7fd,0x11b));var _0xdb7f=function(_0x112a4a,_0x5e72f0){_0x112a4a=_0x112a4a-0x0;var _0x218f08=_0xb7fd[_0x112a4a];return _0x218f08;};'use strict';var _=require('lodash');var util=require(_0xdb7f('0x0'));var moment=require(_0xdb7f('0x1'));var BPromise=require(_0xdb7f('0x2'));var rs=require(_0xdb7f('0x3'));var fs=require('fs');var Redis=require(_0xdb7f('0x4'));var db=require(_0xdb7f('0x5'))['db'];var utils=require(_0xdb7f('0x6'));var logger=require(_0xdb7f('0x7'))(_0xdb7f('0x8'));var config=require(_0xdb7f('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdb7f('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d3446,_0x3e4b9d,_0x60f599){return new BPromise(function(_0x5aea20,_0x18a9e7){return client[_0xdb7f('0xb')](_0x1d3446,_0x60f599)[_0xdb7f('0xc')](function(_0x53bbc6){logger[_0xdb7f('0xd')](_0xdb7f('0xe'),_0x3e4b9d,'request\x20sent');logger[_0xdb7f('0xf')](_0xdb7f('0x10'),_0x3e4b9d,_0xdb7f('0x11'),JSON['stringify'](_0x53bbc6));if(_0x53bbc6[_0xdb7f('0x12')]){if(_0x53bbc6[_0xdb7f('0x12')][_0xdb7f('0x13')]===0x1f4){logger['error']('ZohoConfiguration,\x20%s,\x20%s',_0x3e4b9d,_0x53bbc6[_0xdb7f('0x12')][_0xdb7f('0x14')]);return _0x18a9e7(_0x53bbc6['error'][_0xdb7f('0x14')]);}logger['error'](_0xdb7f('0xe'),_0x3e4b9d,_0x53bbc6[_0xdb7f('0x12')][_0xdb7f('0x14')]);return _0x5aea20(_0x53bbc6[_0xdb7f('0x12')]['message']);}else{logger['info']('ZohoConfiguration,\x20%s,\x20%s',_0x3e4b9d,_0xdb7f('0x11'));_0x5aea20(_0x53bbc6[_0xdb7f('0x15')][_0xdb7f('0x14')]);}})[_0xdb7f('0x16')](function(_0x48dbb5){logger[_0xdb7f('0x12')](_0xdb7f('0xe'),_0x3e4b9d,_0x48dbb5);_0x18a9e7(_0x48dbb5);});});} \ No newline at end of file diff --git a/server/api/intZohoField/index.js b/server/api/intZohoField/index.js index 5f96005..82f105e 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 _0x1618=['destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','post','create','update'];(function(_0x1b6cc4,_0x3d83fa){var _0x4b394d=function(_0x56ba1a){while(--_0x56ba1a){_0x1b6cc4['push'](_0x1b6cc4['shift']());}};_0x4b394d(++_0x3d83fa);}(_0x1618,0x87));var _0x8161=function(_0x1e4305,_0x5b1de6){_0x1e4305=_0x1e4305-0x0;var _0x27b4ec=_0x1618[_0x1e4305];return _0x27b4ec;};'use strict';var multer=require(_0x8161('0x0'));var util=require(_0x8161('0x1'));var path=require('path');var timeout=require(_0x8161('0x2'));var express=require(_0x8161('0x3'));var router=express[_0x8161('0x4')]();var fs_extra=require(_0x8161('0x5'));var auth=require(_0x8161('0x6'));var interaction=require(_0x8161('0x7'));var config=require(_0x8161('0x8'));var controller=require('./intZohoField.controller');router[_0x8161('0x9')]('/',auth[_0x8161('0xa')](),controller[_0x8161('0xb')]);router[_0x8161('0x9')](_0x8161('0xc'),auth['isAuthenticated'](),controller[_0x8161('0xd')]);router[_0x8161('0xe')]('/',auth[_0x8161('0xa')](),controller[_0x8161('0xf')]);router['put'](_0x8161('0xc'),auth[_0x8161('0xa')](),controller[_0x8161('0x10')]);router['delete']('/:id',auth[_0x8161('0xa')](),controller[_0x8161('0x11')]);module[_0x8161('0x12')]=router; \ No newline at end of file +var _0xf322=['connect-timeout','express','fs-extra','../../components/auth/service','../../config/environment','./intZohoField.controller','get','isAuthenticated','/:id','post','create','put','update','delete','destroy','multer','util'];(function(_0x2c9ee8,_0x567414){var _0x5db9bc=function(_0x3073e4){while(--_0x3073e4){_0x2c9ee8['push'](_0x2c9ee8['shift']());}};_0x5db9bc(++_0x567414);}(_0xf322,0x141));var _0x2f32=function(_0x89813e,_0x68f66){_0x89813e=_0x89813e-0x0;var _0x3e18ee=_0xf322[_0x89813e];return _0x3e18ee;};'use strict';var multer=require(_0x2f32('0x0'));var util=require(_0x2f32('0x1'));var path=require('path');var timeout=require(_0x2f32('0x2'));var express=require(_0x2f32('0x3'));var router=express['Router']();var fs_extra=require(_0x2f32('0x4'));var auth=require(_0x2f32('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2f32('0x6'));var controller=require(_0x2f32('0x7'));router[_0x2f32('0x8')]('/',auth[_0x2f32('0x9')](),controller['index']);router[_0x2f32('0x8')](_0x2f32('0xa'),auth[_0x2f32('0x9')](),controller['show']);router[_0x2f32('0xb')]('/',auth['isAuthenticated'](),controller[_0x2f32('0xc')]);router[_0x2f32('0xd')](_0x2f32('0xa'),auth[_0x2f32('0x9')](),controller[_0x2f32('0xe')]);router[_0x2f32('0xf')](_0x2f32('0xa'),auth['isAuthenticated'](),controller[_0x2f32('0x10')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.attributes.js b/server/api/intZohoField/intZohoField.attributes.js index 6350b00..be9e070 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 _0x215f=['variable','picklist','STRING','customVariable','sequelize','exports','ENUM','string'];(function(_0x3bec0a,_0x31a063){var _0x49b5fb=function(_0x227538){while(--_0x227538){_0x3bec0a['push'](_0x3bec0a['shift']());}};_0x49b5fb(++_0x31a063);}(_0x215f,0x14c));var _0xf215=function(_0x276c0b,_0x93d21){_0x276c0b=_0x276c0b-0x0;var _0x16e749=_0x215f[_0x276c0b];return _0x16e749;};'use strict';var Sequelize=require(_0xf215('0x0'));module[_0xf215('0x1')]={'type':{'type':Sequelize[_0xf215('0x2')](_0xf215('0x3'),_0xf215('0x4'),'customVariable','keyValue',_0xf215('0x5')),'defaultValue':_0xf215('0x3')},'content':{'type':Sequelize[_0xf215('0x6')]},'key':{'type':Sequelize[_0xf215('0x6')]},'keyType':{'type':Sequelize[_0xf215('0x2')](_0xf215('0x3'),_0xf215('0x4'),_0xf215('0x7'))},'keyContent':{'type':Sequelize[_0xf215('0x6')]},'idField':{'type':Sequelize['STRING']},'nameField':{'type':Sequelize['STRING']},'customField':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'variableName':{'type':Sequelize[_0xf215('0x6')]}}; \ No newline at end of file +var _0xa578=['STRING','sequelize','exports','ENUM','string','variable','customVariable','keyValue','picklist'];(function(_0x152fe3,_0x12b0c8){var _0xc5bb39=function(_0x1fde42){while(--_0x1fde42){_0x152fe3['push'](_0x152fe3['shift']());}};_0xc5bb39(++_0x12b0c8);}(_0xa578,0x10f));var _0x8a57=function(_0x46479c,_0x18ea62){_0x46479c=_0x46479c-0x0;var _0x19f3db=_0xa578[_0x46479c];return _0x19f3db;};'use strict';var Sequelize=require(_0x8a57('0x0'));module[_0x8a57('0x1')]={'type':{'type':Sequelize[_0x8a57('0x2')](_0x8a57('0x3'),_0x8a57('0x4'),_0x8a57('0x5'),_0x8a57('0x6'),_0x8a57('0x7')),'defaultValue':_0x8a57('0x3')},'content':{'type':Sequelize[_0x8a57('0x8')]},'key':{'type':Sequelize[_0x8a57('0x8')]},'keyType':{'type':Sequelize[_0x8a57('0x2')]('string',_0x8a57('0x4'),_0x8a57('0x5'))},'keyContent':{'type':Sequelize[_0x8a57('0x8')]},'idField':{'type':Sequelize[_0x8a57('0x8')]},'nameField':{'type':Sequelize[_0x8a57('0x8')]},'customField':{'type':Sequelize['BOOLEAN'],'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 b43c187..fe3be38 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 _0x7611=['model','query','keys','filters','intersection','fields','length','attributes','hasOwnProperty','limit','order','sort','pick','filter','where','VIRTUAL','merge','options','ZohoField','includeAll','include','findAll','rows','show','params','find','create','body','catch','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','count','set','Content-Range','reject','save','destroy','then','end','error','stack','name','index','rawAttributes','fieldName','type','key'];(function(_0x3f576a,_0x592ba2){var _0x4872fb=function(_0x3d850b){while(--_0x3d850b){_0x3f576a['push'](_0x3f576a['shift']());}};_0x4872fb(++_0x592ba2);}(_0x7611,0xb1));var _0x1761=function(_0x1602a5,_0xd2cbbd){_0x1602a5=_0x1602a5-0x0;var _0x5776cc=_0x7611[_0x1602a5];return _0x5776cc;};'use strict';var emlformat=require(_0x1761('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1761('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x1761('0x2'));var moment=require(_0x1761('0x3'));var BPromise=require(_0x1761('0x4'));var Mustache=require(_0x1761('0x5'));var util=require(_0x1761('0x6'));var path=require('path');var sox=require(_0x1761('0x7'));var csv=require(_0x1761('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1761('0x9'));var _=require(_0x1761('0xa'));var squel=require(_0x1761('0xb'));var crypto=require(_0x1761('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1761('0xd'));var toCsv=require(_0x1761('0x8'));var querystring=require('querystring');var Papa=require(_0x1761('0xe'));var Redis=require(_0x1761('0xf'));var authService=require(_0x1761('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x1761('0x11'));var hardwareService=require(_0x1761('0x12'));var logger=require(_0x1761('0x13'))(_0x1761('0x14'));var utils=require(_0x1761('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x1761('0x16'));var db=require(_0x1761('0x17'))['db'];function respondWithStatusCode(_0x4082db,_0x32df82){_0x32df82=_0x32df82||0xcc;return function(_0x3a92b1){if(_0x3a92b1){return _0x4082db[_0x1761('0x18')](_0x32df82);}return _0x4082db[_0x1761('0x19')](_0x32df82)['end']();};}function respondWithResult(_0x6c11b6,_0x32f2c9){_0x32f2c9=_0x32f2c9||0xc8;return function(_0x2e78ba){if(_0x2e78ba){return _0x6c11b6['status'](_0x32f2c9)[_0x1761('0x1a')](_0x2e78ba);}};}function respondWithFilteredResult(_0x518bea,_0x5428d6){return function(_0x28f132){if(_0x28f132){var _0x1144b3=typeof _0x5428d6[_0x1761('0x1b')]===_0x1761('0x1c')&&typeof _0x5428d6['limit']==='undefined';var _0x4a5140=_0x28f132[_0x1761('0x1d')];var _0x51ffcd=_0x1144b3?0x0:_0x5428d6[_0x1761('0x1b')];var _0x197280=_0x1144b3?_0x28f132['count']:_0x5428d6['offset']+_0x5428d6['limit'];var _0x5522b3;if(_0x197280>=_0x4a5140){_0x197280=_0x4a5140;_0x5522b3=0xc8;}else{_0x5522b3=0xce;}_0x518bea['status'](_0x5522b3);return _0x518bea[_0x1761('0x1e')](_0x1761('0x1f'),_0x51ffcd+'-'+_0x197280+'/'+_0x4a5140)[_0x1761('0x1a')](_0x28f132);}return null;};}function patchUpdates(_0x47e8b1){return function(_0x52ab60){try{jsonpatch['apply'](_0x52ab60,_0x47e8b1,!![]);}catch(_0x47e5bd){return BPromise[_0x1761('0x20')](_0x47e5bd);}return _0x52ab60[_0x1761('0x21')]();};}function saveUpdates(_0x4294c5,_0x4e8f4e){return function(_0x5292a9){if(_0x5292a9){return _0x5292a9['update'](_0x4294c5)['then'](function(_0x2c9f5f){return _0x2c9f5f;});}return null;};}function removeEntity(_0x107509,_0x5449ac){return function(_0x4a8702){if(_0x4a8702){return _0x4a8702[_0x1761('0x22')]()[_0x1761('0x23')](function(){_0x107509['status'](0xcc)[_0x1761('0x24')]();});}};}function handleEntityNotFound(_0x5d51b6,_0x24e6c6){return function(_0x23e186){if(!_0x23e186){_0x5d51b6[_0x1761('0x18')](0x194);}return _0x23e186;};}function handleError(_0x239a53,_0x1cf184){_0x1cf184=_0x1cf184||0x1f4;return function(_0x29f307){logger[_0x1761('0x25')](_0x29f307[_0x1761('0x26')]);if(_0x29f307[_0x1761('0x27')]){delete _0x29f307[_0x1761('0x27')];}_0x239a53[_0x1761('0x19')](_0x1cf184)['send'](_0x29f307);};}exports[_0x1761('0x28')]=function(_0x298eee,_0x432ee9){var _0x4d02dc={},_0xe33f0f={},_0x5cb574={'count':0x0,'rows':[]};var _0x548522=_['map'](db['ZohoField'][_0x1761('0x29')],function(_0x7e44cb){return{'name':_0x7e44cb[_0x1761('0x2a')],'type':_0x7e44cb[_0x1761('0x2b')][_0x1761('0x2c')]};});_0xe33f0f[_0x1761('0x2d')]=_['map'](_0x548522,_0x1761('0x27'));_0xe33f0f[_0x1761('0x2e')]=_[_0x1761('0x2f')](_0x298eee[_0x1761('0x2e')]);_0xe33f0f[_0x1761('0x30')]=_[_0x1761('0x31')](_0xe33f0f[_0x1761('0x2d')],_0xe33f0f['query']);_0x4d02dc['attributes']=_[_0x1761('0x31')](_0xe33f0f[_0x1761('0x2d')],qs['fields'](_0x298eee[_0x1761('0x2e')][_0x1761('0x32')]));_0x4d02dc['attributes']=_0x4d02dc['attributes'][_0x1761('0x33')]?_0x4d02dc[_0x1761('0x34')]:_0xe33f0f[_0x1761('0x2d')];if(!_0x298eee['query'][_0x1761('0x35')]('nolimit')){_0x4d02dc[_0x1761('0x36')]=qs['limit'](_0x298eee[_0x1761('0x2e')][_0x1761('0x36')]);_0x4d02dc[_0x1761('0x1b')]=qs[_0x1761('0x1b')](_0x298eee[_0x1761('0x2e')][_0x1761('0x1b')]);}_0x4d02dc[_0x1761('0x37')]=qs[_0x1761('0x38')](_0x298eee[_0x1761('0x2e')][_0x1761('0x38')]);_0x4d02dc['where']=qs[_0x1761('0x30')](_[_0x1761('0x39')](_0x298eee[_0x1761('0x2e')],_0xe33f0f['filters']),_0x548522);if(_0x298eee['query'][_0x1761('0x3a')]){_0x4d02dc[_0x1761('0x3b')]=_['merge'](_0x4d02dc['where'],{'$or':_['map'](_0x548522,function(_0x1f2e07){if(_0x1f2e07[_0x1761('0x2b')]!==_0x1761('0x3c')){var _0x25a34b={};_0x25a34b[_0x1f2e07['name']]={'$like':'%'+_0x298eee['query'][_0x1761('0x3a')]+'%'};return _0x25a34b;}})});}_0x4d02dc=_[_0x1761('0x3d')]({},_0x4d02dc,_0x298eee[_0x1761('0x3e')]);var _0x478950={'where':_0x4d02dc['where']};return db[_0x1761('0x3f')][_0x1761('0x1d')](_0x478950)[_0x1761('0x23')](function(_0x2b72ca){_0x5cb574[_0x1761('0x1d')]=_0x2b72ca;if(_0x298eee[_0x1761('0x2e')][_0x1761('0x40')]){_0x4d02dc[_0x1761('0x41')]=[{'all':!![]}];}return db[_0x1761('0x3f')][_0x1761('0x42')](_0x4d02dc);})[_0x1761('0x23')](function(_0x5b7a99){_0x5cb574[_0x1761('0x43')]=_0x5b7a99;return _0x5cb574;})['then'](respondWithFilteredResult(_0x432ee9,_0x4d02dc))['catch'](handleError(_0x432ee9,null));};exports[_0x1761('0x44')]=function(_0x50e0e8,_0xca0caf){var _0x21fa17={'raw':!![],'where':{'id':_0x50e0e8[_0x1761('0x45')]['id']}},_0x2b8689={};_0x2b8689[_0x1761('0x2d')]=_[_0x1761('0x2f')](db[_0x1761('0x3f')][_0x1761('0x29')]);_0x2b8689[_0x1761('0x2e')]=_['keys'](_0x50e0e8[_0x1761('0x2e')]);_0x2b8689[_0x1761('0x30')]=_['intersection'](_0x2b8689[_0x1761('0x2d')],_0x2b8689[_0x1761('0x2e')]);_0x21fa17[_0x1761('0x34')]=_[_0x1761('0x31')](_0x2b8689['model'],qs['fields'](_0x50e0e8[_0x1761('0x2e')][_0x1761('0x32')]));_0x21fa17[_0x1761('0x34')]=_0x21fa17[_0x1761('0x34')][_0x1761('0x33')]?_0x21fa17[_0x1761('0x34')]:_0x2b8689[_0x1761('0x2d')];if(_0x50e0e8[_0x1761('0x2e')][_0x1761('0x40')]){_0x21fa17[_0x1761('0x41')]=[{'all':!![]}];}_0x21fa17=_[_0x1761('0x3d')]({},_0x21fa17,_0x50e0e8[_0x1761('0x3e')]);return db['ZohoField'][_0x1761('0x46')](_0x21fa17)[_0x1761('0x23')](handleEntityNotFound(_0xca0caf,null))[_0x1761('0x23')](respondWithResult(_0xca0caf,null))['catch'](handleError(_0xca0caf,null));};exports[_0x1761('0x47')]=function(_0x1725b9,_0x919744){return db[_0x1761('0x3f')][_0x1761('0x47')](_0x1725b9[_0x1761('0x48')],{})['then'](respondWithResult(_0x919744,0xc9))['catch'](handleError(_0x919744,null));};exports['update']=function(_0x147950,_0x112e28){if(_0x147950[_0x1761('0x48')]['id']){delete _0x147950[_0x1761('0x48')]['id'];}return db[_0x1761('0x3f')]['find']({'where':{'id':_0x147950[_0x1761('0x45')]['id']}})[_0x1761('0x23')](handleEntityNotFound(_0x112e28,null))[_0x1761('0x23')](saveUpdates(_0x147950['body'],null))[_0x1761('0x23')](respondWithResult(_0x112e28,null))[_0x1761('0x49')](handleError(_0x112e28,null));};exports['destroy']=function(_0x11752d,_0x43ff87){return db['ZohoField']['find']({'where':{'id':_0x11752d[_0x1761('0x45')]['id']}})[_0x1761('0x23')](handleEntityNotFound(_0x43ff87,null))['then'](removeEntity(_0x43ff87,null))[_0x1761('0x49')](handleError(_0x43ff87,null));}; \ No newline at end of file +var _0x4f8c=['eml-format','zip-dir','fast-json-patch','bluebird','mustache','util','path','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','offset','undefined','limit','count','Content-Range','apply','reject','save','then','destroy','name','send','index','map','ZohoField','rawAttributes','fieldName','type','query','keys','filters','intersection','model','attributes','length','hasOwnProperty','order','sort','where','filter','merge','include','findAll','rows','catch','show','params','fields','includeAll','find','create','body'];(function(_0xd78008,_0x1463f5){var _0x5ca6b9=function(_0xa41c3c){while(--_0xa41c3c){_0xd78008['push'](_0xd78008['shift']());}};_0x5ca6b9(++_0x1463f5);}(_0x4f8c,0x1b6));var _0xc4f8=function(_0x458305,_0x441f04){_0x458305=_0x458305-0x0;var _0x5b2b44=_0x4f8c[_0x458305];return _0x5b2b44;};'use strict';var emlformat=require(_0xc4f8('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc4f8('0x1'));var jsonpatch=require(_0xc4f8('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xc4f8('0x3'));var Mustache=require(_0xc4f8('0x4'));var util=require(_0xc4f8('0x5'));var path=require(_0xc4f8('0x6'));var sox=require('sox');var csv=require(_0xc4f8('0x7'));var ejs=require(_0xc4f8('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xc4f8('0x9'));var squel=require(_0xc4f8('0xa'));var crypto=require(_0xc4f8('0xb'));var jsforce=require(_0xc4f8('0xc'));var deskjs=require(_0xc4f8('0xd'));var toCsv=require('to-csv');var querystring=require(_0xc4f8('0xe'));var Papa=require(_0xc4f8('0xf'));var Redis=require(_0xc4f8('0x10'));var authService=require(_0xc4f8('0x11'));var qs=require(_0xc4f8('0x12'));var as=require(_0xc4f8('0x13'));var hardwareService=require(_0xc4f8('0x14'));var logger=require(_0xc4f8('0x15'))(_0xc4f8('0x16'));var utils=require(_0xc4f8('0x17'));var config=require(_0xc4f8('0x18'));var licenseUtil=require(_0xc4f8('0x19'));var db=require(_0xc4f8('0x1a'))['db'];function respondWithStatusCode(_0x445484,_0x35e263){_0x35e263=_0x35e263||0xcc;return function(_0x7e26c0){if(_0x7e26c0){return _0x445484[_0xc4f8('0x1b')](_0x35e263);}return _0x445484[_0xc4f8('0x1c')](_0x35e263)[_0xc4f8('0x1d')]();};}function respondWithResult(_0x29d107,_0x196a93){_0x196a93=_0x196a93||0xc8;return function(_0x56a13d){if(_0x56a13d){return _0x29d107[_0xc4f8('0x1c')](_0x196a93)[_0xc4f8('0x1e')](_0x56a13d);}};}function respondWithFilteredResult(_0x521c2f,_0x43e4f4){return function(_0x35254e){if(_0x35254e){var _0x847aa=typeof _0x43e4f4[_0xc4f8('0x1f')]===_0xc4f8('0x20')&&typeof _0x43e4f4[_0xc4f8('0x21')]===_0xc4f8('0x20');var _0x5438d2=_0x35254e[_0xc4f8('0x22')];var _0x358bd3=_0x847aa?0x0:_0x43e4f4[_0xc4f8('0x1f')];var _0x2b605b=_0x847aa?_0x35254e['count']:_0x43e4f4[_0xc4f8('0x1f')]+_0x43e4f4[_0xc4f8('0x21')];var _0x1f8729;if(_0x2b605b>=_0x5438d2){_0x2b605b=_0x5438d2;_0x1f8729=0xc8;}else{_0x1f8729=0xce;}_0x521c2f[_0xc4f8('0x1c')](_0x1f8729);return _0x521c2f['set'](_0xc4f8('0x23'),_0x358bd3+'-'+_0x2b605b+'/'+_0x5438d2)['json'](_0x35254e);}return null;};}function patchUpdates(_0x852dbd){return function(_0x5971fb){try{jsonpatch[_0xc4f8('0x24')](_0x5971fb,_0x852dbd,!![]);}catch(_0x3898d6){return BPromise[_0xc4f8('0x25')](_0x3898d6);}return _0x5971fb[_0xc4f8('0x26')]();};}function saveUpdates(_0x15af3a,_0x58ff2e){return function(_0x4a8c8){if(_0x4a8c8){return _0x4a8c8['update'](_0x15af3a)[_0xc4f8('0x27')](function(_0x7cf379){return _0x7cf379;});}return null;};}function removeEntity(_0x5e515d,_0xfebd0b){return function(_0x3dcb73){if(_0x3dcb73){return _0x3dcb73[_0xc4f8('0x28')]()[_0xc4f8('0x27')](function(){_0x5e515d[_0xc4f8('0x1c')](0xcc)[_0xc4f8('0x1d')]();});}};}function handleEntityNotFound(_0x3eb416,_0x4c5d5b){return function(_0x3b8df9){if(!_0x3b8df9){_0x3eb416['sendStatus'](0x194);}return _0x3b8df9;};}function handleError(_0x52b614,_0x58a756){_0x58a756=_0x58a756||0x1f4;return function(_0x1f8307){logger['error'](_0x1f8307['stack']);if(_0x1f8307[_0xc4f8('0x29')]){delete _0x1f8307['name'];}_0x52b614[_0xc4f8('0x1c')](_0x58a756)[_0xc4f8('0x2a')](_0x1f8307);};}exports[_0xc4f8('0x2b')]=function(_0x1e620e,_0x50ea8e){var _0x1e9539={},_0x3ba6c7={},_0x18d869={'count':0x0,'rows':[]};var _0x2ab491=_[_0xc4f8('0x2c')](db[_0xc4f8('0x2d')][_0xc4f8('0x2e')],function(_0x5bea46){return{'name':_0x5bea46[_0xc4f8('0x2f')],'type':_0x5bea46[_0xc4f8('0x30')]['key']};});_0x3ba6c7['model']=_[_0xc4f8('0x2c')](_0x2ab491,_0xc4f8('0x29'));_0x3ba6c7[_0xc4f8('0x31')]=_[_0xc4f8('0x32')](_0x1e620e['query']);_0x3ba6c7[_0xc4f8('0x33')]=_[_0xc4f8('0x34')](_0x3ba6c7[_0xc4f8('0x35')],_0x3ba6c7[_0xc4f8('0x31')]);_0x1e9539[_0xc4f8('0x36')]=_[_0xc4f8('0x34')](_0x3ba6c7[_0xc4f8('0x35')],qs['fields'](_0x1e620e[_0xc4f8('0x31')]['fields']));_0x1e9539[_0xc4f8('0x36')]=_0x1e9539['attributes'][_0xc4f8('0x37')]?_0x1e9539[_0xc4f8('0x36')]:_0x3ba6c7[_0xc4f8('0x35')];if(!_0x1e620e[_0xc4f8('0x31')][_0xc4f8('0x38')]('nolimit')){_0x1e9539[_0xc4f8('0x21')]=qs[_0xc4f8('0x21')](_0x1e620e[_0xc4f8('0x31')][_0xc4f8('0x21')]);_0x1e9539[_0xc4f8('0x1f')]=qs['offset'](_0x1e620e[_0xc4f8('0x31')]['offset']);}_0x1e9539[_0xc4f8('0x39')]=qs[_0xc4f8('0x3a')](_0x1e620e[_0xc4f8('0x31')][_0xc4f8('0x3a')]);_0x1e9539[_0xc4f8('0x3b')]=qs[_0xc4f8('0x33')](_['pick'](_0x1e620e[_0xc4f8('0x31')],_0x3ba6c7['filters']),_0x2ab491);if(_0x1e620e[_0xc4f8('0x31')][_0xc4f8('0x3c')]){_0x1e9539[_0xc4f8('0x3b')]=_[_0xc4f8('0x3d')](_0x1e9539[_0xc4f8('0x3b')],{'$or':_[_0xc4f8('0x2c')](_0x2ab491,function(_0x205e0c){if(_0x205e0c['type']!=='VIRTUAL'){var _0x1a8104={};_0x1a8104[_0x205e0c[_0xc4f8('0x29')]]={'$like':'%'+_0x1e620e[_0xc4f8('0x31')]['filter']+'%'};return _0x1a8104;}})});}_0x1e9539=_[_0xc4f8('0x3d')]({},_0x1e9539,_0x1e620e['options']);var _0x1a22c9={'where':_0x1e9539[_0xc4f8('0x3b')]};return db[_0xc4f8('0x2d')][_0xc4f8('0x22')](_0x1a22c9)[_0xc4f8('0x27')](function(_0x293ca4){_0x18d869[_0xc4f8('0x22')]=_0x293ca4;if(_0x1e620e[_0xc4f8('0x31')]['includeAll']){_0x1e9539[_0xc4f8('0x3e')]=[{'all':!![]}];}return db[_0xc4f8('0x2d')][_0xc4f8('0x3f')](_0x1e9539);})[_0xc4f8('0x27')](function(_0xf347e3){_0x18d869[_0xc4f8('0x40')]=_0xf347e3;return _0x18d869;})[_0xc4f8('0x27')](respondWithFilteredResult(_0x50ea8e,_0x1e9539))[_0xc4f8('0x41')](handleError(_0x50ea8e,null));};exports[_0xc4f8('0x42')]=function(_0x4854fc,_0x4b177d){var _0x156fa7={'raw':!![],'where':{'id':_0x4854fc[_0xc4f8('0x43')]['id']}},_0x1e5017={};_0x1e5017[_0xc4f8('0x35')]=_[_0xc4f8('0x32')](db[_0xc4f8('0x2d')][_0xc4f8('0x2e')]);_0x1e5017[_0xc4f8('0x31')]=_[_0xc4f8('0x32')](_0x4854fc[_0xc4f8('0x31')]);_0x1e5017[_0xc4f8('0x33')]=_['intersection'](_0x1e5017['model'],_0x1e5017[_0xc4f8('0x31')]);_0x156fa7['attributes']=_[_0xc4f8('0x34')](_0x1e5017[_0xc4f8('0x35')],qs[_0xc4f8('0x44')](_0x4854fc['query'][_0xc4f8('0x44')]));_0x156fa7[_0xc4f8('0x36')]=_0x156fa7[_0xc4f8('0x36')][_0xc4f8('0x37')]?_0x156fa7[_0xc4f8('0x36')]:_0x1e5017[_0xc4f8('0x35')];if(_0x4854fc['query'][_0xc4f8('0x45')]){_0x156fa7[_0xc4f8('0x3e')]=[{'all':!![]}];}_0x156fa7=_[_0xc4f8('0x3d')]({},_0x156fa7,_0x4854fc['options']);return db[_0xc4f8('0x2d')][_0xc4f8('0x46')](_0x156fa7)[_0xc4f8('0x27')](handleEntityNotFound(_0x4b177d,null))[_0xc4f8('0x27')](respondWithResult(_0x4b177d,null))[_0xc4f8('0x41')](handleError(_0x4b177d,null));};exports[_0xc4f8('0x47')]=function(_0x231286,_0x7176ba){return db[_0xc4f8('0x2d')][_0xc4f8('0x47')](_0x231286[_0xc4f8('0x48')],{})[_0xc4f8('0x27')](respondWithResult(_0x7176ba,0xc9))[_0xc4f8('0x41')](handleError(_0x7176ba,null));};exports['update']=function(_0x3d68a7,_0x394c44){if(_0x3d68a7[_0xc4f8('0x48')]['id']){delete _0x3d68a7[_0xc4f8('0x48')]['id'];}return db[_0xc4f8('0x2d')]['find']({'where':{'id':_0x3d68a7['params']['id']}})[_0xc4f8('0x27')](handleEntityNotFound(_0x394c44,null))[_0xc4f8('0x27')](saveUpdates(_0x3d68a7[_0xc4f8('0x48')],null))[_0xc4f8('0x27')](respondWithResult(_0x394c44,null))[_0xc4f8('0x41')](handleError(_0x394c44,null));};exports[_0xc4f8('0x28')]=function(_0x136315,_0x4eeca5){return db[_0xc4f8('0x2d')][_0xc4f8('0x46')]({'where':{'id':_0x136315[_0xc4f8('0x43')]['id']}})[_0xc4f8('0x27')](handleEntityNotFound(_0x4eeca5,null))[_0xc4f8('0x27')](removeEntity(_0x4eeca5,null))['catch'](handleError(_0x4eeca5,null));}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.model.js b/server/api/intZohoField/intZohoField.model.js index 4131785..b4e88ce 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 _0x90b1=['FieldId','lodash','util','../../config/logger','bluebird','request-promise','path','rimraf','define','ZohoField','int_zoho_fields','zoho_unique_index','idField'];(function(_0x4b0b07,_0xea7423){var _0xb289c4=function(_0x13be6d){while(--_0x13be6d){_0x4b0b07['push'](_0x4b0b07['shift']());}};_0xb289c4(++_0xea7423);}(_0x90b1,0x1bb));var _0x190b=function(_0x205328,_0x12c15a){_0x205328=_0x205328-0x0;var _0x4a30eb=_0x90b1[_0x205328];return _0x4a30eb;};'use strict';var _=require(_0x190b('0x0'));var util=require(_0x190b('0x1'));var logger=require(_0x190b('0x2'))('api');var moment=require('moment');var BPromise=require(_0x190b('0x3'));var rp=require(_0x190b('0x4'));var fs=require('fs');var path=require(_0x190b('0x5'));var rimraf=require(_0x190b('0x6'));var config=require('../../config/environment');var attributes=require('./intZohoField.attributes');module['exports']=function(_0x5da9c1,_0x27ff8c){return _0x5da9c1[_0x190b('0x7')](_0x190b('0x8'),attributes,{'tableName':_0x190b('0x9'),'paranoid':![],'indexes':[{'name':_0x190b('0xa'),'fields':[_0x190b('0xb'),_0x190b('0xc')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file +var _0x81c6=['../../config/environment','./intZohoField.attributes','exports','define','ZohoField','idField','FieldId','util','bluebird','request-promise','path'];(function(_0x52b60b,_0x2587c7){var _0x5d63ae=function(_0xf44495){while(--_0xf44495){_0x52b60b['push'](_0x52b60b['shift']());}};_0x5d63ae(++_0x2587c7);}(_0x81c6,0x1d5));var _0x681c=function(_0x4e85c4,_0x447081){_0x4e85c4=_0x4e85c4-0x0;var _0x48b799=_0x81c6[_0x4e85c4];return _0x48b799;};'use strict';var _=require('lodash');var util=require(_0x681c('0x0'));var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x681c('0x1'));var rp=require(_0x681c('0x2'));var fs=require('fs');var path=require(_0x681c('0x3'));var rimraf=require('rimraf');var config=require(_0x681c('0x4'));var attributes=require(_0x681c('0x5'));module[_0x681c('0x6')]=function(_0x1d31c8,_0x4ea522){return _0x1d31c8[_0x681c('0x7')](_0x681c('0x8'),attributes,{'tableName':'int_zoho_fields','paranoid':![],'indexes':[{'name':'zoho_unique_index','fields':[_0x681c('0x9'),_0x681c('0xa')],'unique':!![]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/intZohoField/intZohoField.rpc.js b/server/api/intZohoField/intZohoField.rpc.js index b3daa43..1b06fa0 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 _0xc6ee=['request\x20sent','ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','ZohoField,\x20%s,\x20%s'];(function(_0x1d5a32,_0x31695a){var _0x30d289=function(_0x51f0c3){while(--_0x51f0c3){_0x1d5a32['push'](_0x1d5a32['shift']());}};_0x30d289(++_0x31695a);}(_0xc6ee,0x16d));var _0xec6e=function(_0x3fa37f,_0x397f16){_0x3fa37f=_0x3fa37f-0x0;var _0x5a01d5=_0xc6ee[_0x3fa37f];return _0x5a01d5;};'use strict';var _=require('lodash');var util=require(_0xec6e('0x0'));var moment=require(_0xec6e('0x1'));var BPromise=require(_0xec6e('0x2'));var rs=require(_0xec6e('0x3'));var fs=require('fs');var Redis=require(_0xec6e('0x4'));var db=require(_0xec6e('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xec6e('0x6'))(_0xec6e('0x7'));var config=require(_0xec6e('0x8'));var jayson=require(_0xec6e('0x9'));var client=jayson['client'][_0xec6e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5e1ba1,_0x5ce4d1,_0x27f9ca){return new BPromise(function(_0x301b94,_0x585c77){return client['request'](_0x5e1ba1,_0x27f9ca)[_0xec6e('0xb')](function(_0x57c9f7){logger['info'](_0xec6e('0xc'),_0x5ce4d1,_0xec6e('0xd'));logger['debug'](_0xec6e('0xe'),_0x5ce4d1,'request\x20sent',JSON[_0xec6e('0xf')](_0x57c9f7));if(_0x57c9f7[_0xec6e('0x10')]){if(_0x57c9f7[_0xec6e('0x10')][_0xec6e('0x11')]===0x1f4){logger[_0xec6e('0x10')](_0xec6e('0xc'),_0x5ce4d1,_0x57c9f7[_0xec6e('0x10')][_0xec6e('0x12')]);return _0x585c77(_0x57c9f7[_0xec6e('0x10')][_0xec6e('0x12')]);}logger[_0xec6e('0x10')](_0xec6e('0xc'),_0x5ce4d1,_0x57c9f7['error']['message']);return _0x301b94(_0x57c9f7['error'][_0xec6e('0x12')]);}else{logger['info']('ZohoField,\x20%s,\x20%s',_0x5ce4d1,_0xec6e('0xd'));_0x301b94(_0x57c9f7[_0xec6e('0x13')]['message']);}})[_0xec6e('0x14')](function(_0x6e012){logger[_0xec6e('0x10')](_0xec6e('0xc'),_0x5ce4d1,_0x6e012);_0x585c77(_0x6e012);});});} \ No newline at end of file +var _0xca6b=['ZohoField,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','ZohoField,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x592713,_0x1ea78d){var _0x3fe5d6=function(_0x24f435){while(--_0x24f435){_0x592713['push'](_0x592713['shift']());}};_0x3fe5d6(++_0x1ea78d);}(_0xca6b,0x1a4));var _0xbca6=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0xca6b[_0x4baae2];return _0x1a2285;};'use strict';var _=require(_0xbca6('0x0'));var util=require(_0xbca6('0x1'));var moment=require(_0xbca6('0x2'));var BPromise=require(_0xbca6('0x3'));var rs=require(_0xbca6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbca6('0x5'))['db'];var utils=require(_0xbca6('0x6'));var logger=require(_0xbca6('0x7'))(_0xbca6('0x8'));var config=require('../../config/environment');var jayson=require(_0xbca6('0x9'));var client=jayson[_0xbca6('0xa')][_0xbca6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5037c8,_0x4bc515,_0x219c7a){return new BPromise(function(_0x300b70,_0x33b5d7){return client[_0xbca6('0xc')](_0x5037c8,_0x219c7a)[_0xbca6('0xd')](function(_0x50bbf5){logger['info'](_0xbca6('0xe'),_0x4bc515,_0xbca6('0xf'));logger[_0xbca6('0x10')](_0xbca6('0x11'),_0x4bc515,_0xbca6('0xf'),JSON[_0xbca6('0x12')](_0x50bbf5));if(_0x50bbf5[_0xbca6('0x13')]){if(_0x50bbf5[_0xbca6('0x13')]['code']===0x1f4){logger[_0xbca6('0x13')](_0xbca6('0xe'),_0x4bc515,_0x50bbf5['error'][_0xbca6('0x14')]);return _0x33b5d7(_0x50bbf5['error'][_0xbca6('0x14')]);}logger[_0xbca6('0x13')](_0xbca6('0xe'),_0x4bc515,_0x50bbf5[_0xbca6('0x13')][_0xbca6('0x14')]);return _0x300b70(_0x50bbf5['error'][_0xbca6('0x14')]);}else{logger[_0xbca6('0x15')]('ZohoField,\x20%s,\x20%s',_0x4bc515,_0xbca6('0xf'));_0x300b70(_0x50bbf5[_0xbca6('0x16')][_0xbca6('0x14')]);}})['catch'](function(_0x57d1fa){logger[_0xbca6('0x13')](_0xbca6('0xe'),_0x4bc515,_0x57d1fa);_0x33b5d7(_0x57d1fa);});});} \ No newline at end of file diff --git a/server/api/integration/index.js b/server/api/integration/index.js index efe8baa..8391e65 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0xe49862,_0x2bfd27){var _0x55eed0=function(_0x5ad9ce){while(--_0x5ad9ce){_0xe49862['push'](_0xe49862['shift']());}};_0x55eed0(++_0x2bfd27);}(_0xe706,0xa3));var _0x6e70=function(_0x2c1114,_0x2a5c50){_0x2c1114=_0x2c1114-0x0;var _0x2b877c=_0xe706[_0x2c1114];return _0x2b877c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x2eca35,_0xec16eb){var _0x27df00=function(_0x2ebc30){while(--_0x2ebc30){_0x2eca35['push'](_0x2eca35['shift']());}};_0x27df00(++_0xec16eb);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/integration/integration.attributes.js b/server/api/integration/integration.attributes.js index cbef089..333dee4 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 _0xcd54=['sequelize','exports','STRING','BOOLEAN','state'];(function(_0x118fe6,_0x361848){var _0x41aaa7=function(_0x2ec4a8){while(--_0x2ec4a8){_0x118fe6['push'](_0x118fe6['shift']());}};_0x41aaa7(++_0x361848);}(_0xcd54,0xaf));var _0x4cd5=function(_0x455e89,_0x4a26c8){_0x455e89=_0x455e89-0x0;var _0x38d8a9=_0xcd54[_0x455e89];return _0x38d8a9;};'use strict';var Sequelize=require(_0x4cd5('0x0'));module[_0x4cd5('0x1')]={'name':{'type':Sequelize[_0x4cd5('0x2')],'allowNull':![],'unique':'unique_name_and_version'},'version':{'type':Sequelize['STRING'],'allowNull':![],'unique':'unique_name_and_version'},'main':{'type':Sequelize[_0x4cd5('0x2')],'defaultValue':'app.js'},'filename':{'type':Sequelize[_0x4cd5('0x2')]},'path':{'type':Sequelize[_0x4cd5('0x2')]},'type':{'type':Sequelize[_0x4cd5('0x2')]},'size':{'type':Sequelize['INTEGER']},'active':{'type':Sequelize[_0x4cd5('0x3')],'defaultValue':![]},'author':{'type':Sequelize[_0x4cd5('0x2')]},'logo':{'type':Sequelize[_0x4cd5('0x2')]},'state':{'type':Sequelize[_0x4cd5('0x2')],'unique':_0x4cd5('0x4')},'description':{'type':Sequelize['STRING']},'title':{'type':Sequelize[_0x4cd5('0x2')]},'remoteUri':{'type':Sequelize[_0x4cd5('0x2')]},'link':{'type':Sequelize[_0x4cd5('0x2')],'defaultValue':'#'}}; \ No newline at end of file +var _0xc23c=['sequelize','exports','STRING','unique_name_and_version','app.js','INTEGER','BOOLEAN','state'];(function(_0x47d522,_0x412dc1){var _0x3dc4b7=function(_0x4377bd){while(--_0x4377bd){_0x47d522['push'](_0x47d522['shift']());}};_0x3dc4b7(++_0x412dc1);}(_0xc23c,0x120));var _0xcc23=function(_0x52aa3f,_0x4e8337){_0x52aa3f=_0x52aa3f-0x0;var _0x4b555a=_0xc23c[_0x52aa3f];return _0x4b555a;};'use strict';var Sequelize=require(_0xcc23('0x0'));module[_0xcc23('0x1')]={'name':{'type':Sequelize[_0xcc23('0x2')],'allowNull':![],'unique':_0xcc23('0x3')},'version':{'type':Sequelize[_0xcc23('0x2')],'allowNull':![],'unique':_0xcc23('0x3')},'main':{'type':Sequelize[_0xcc23('0x2')],'defaultValue':_0xcc23('0x4')},'filename':{'type':Sequelize[_0xcc23('0x2')]},'path':{'type':Sequelize[_0xcc23('0x2')]},'type':{'type':Sequelize[_0xcc23('0x2')]},'size':{'type':Sequelize[_0xcc23('0x5')]},'active':{'type':Sequelize[_0xcc23('0x6')],'defaultValue':![]},'author':{'type':Sequelize[_0xcc23('0x2')]},'logo':{'type':Sequelize[_0xcc23('0x2')]},'state':{'type':Sequelize[_0xcc23('0x2')],'unique':_0xcc23('0x7')},'description':{'type':Sequelize[_0xcc23('0x2')]},'title':{'type':Sequelize[_0xcc23('0x2')]},'remoteUri':{'type':Sequelize['STRING']},'link':{'type':Sequelize['STRING'],'defaultValue':'#'}}; \ No newline at end of file diff --git a/server/api/integration/integration.controller.js b/server/api/integration/integration.controller.js index 602add5..fc2ec7b 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 _0x7a54=['offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','index','Integration','fieldName','type','model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','includeAll','include','findAll','rows','show','params','length','merge','options','find','catch','body','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json'];(function(_0x4f9e20,_0x1d52fa){var _0x4b613d=function(_0x173784){while(--_0x173784){_0x4f9e20['push'](_0x4f9e20['shift']());}};_0x4b613d(++_0x1d52fa);}(_0x7a54,0x106));var _0x47a5=function(_0x524ffb,_0x3de2bc){_0x524ffb=_0x524ffb-0x0;var _0x537d49=_0x7a54[_0x524ffb];return _0x537d49;};'use strict';var emlformat=require(_0x47a5('0x0'));var rimraf=require(_0x47a5('0x1'));var zipdir=require(_0x47a5('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x47a5('0x3'));var moment=require(_0x47a5('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x47a5('0x5'));var util=require(_0x47a5('0x6'));var path=require(_0x47a5('0x7'));var sox=require(_0x47a5('0x8'));var csv=require(_0x47a5('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x47a5('0xa'));var _=require('lodash');var squel=require(_0x47a5('0xb'));var crypto=require(_0x47a5('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x47a5('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x47a5('0xe'));var authService=require(_0x47a5('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x47a5('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x47a5('0x11'));var utils=require(_0x47a5('0x12'));var config=require(_0x47a5('0x13'));var licenseUtil=require(_0x47a5('0x14'));var db=require(_0x47a5('0x15'))['db'];function respondWithStatusCode(_0xd308b8,_0x1eae59){_0x1eae59=_0x1eae59||0xcc;return function(_0x5beb89){if(_0x5beb89){return _0xd308b8[_0x47a5('0x16')](_0x1eae59);}return _0xd308b8[_0x47a5('0x17')](_0x1eae59)[_0x47a5('0x18')]();};}function respondWithResult(_0x711793,_0x139f25){_0x139f25=_0x139f25||0xc8;return function(_0x620ee9){if(_0x620ee9){return _0x711793[_0x47a5('0x17')](_0x139f25)[_0x47a5('0x19')](_0x620ee9);}};}function respondWithFilteredResult(_0x4e99a8,_0x362359){return function(_0x11faf5){if(_0x11faf5){var _0x3b001e=typeof _0x362359[_0x47a5('0x1a')]===_0x47a5('0x1b')&&typeof _0x362359['limit']==='undefined';var _0x138bc0=_0x11faf5['count'];var _0x5247fd=_0x3b001e?0x0:_0x362359[_0x47a5('0x1a')];var _0xaf70a6=_0x3b001e?_0x11faf5[_0x47a5('0x1c')]:_0x362359[_0x47a5('0x1a')]+_0x362359[_0x47a5('0x1d')];var _0x12b98e;if(_0xaf70a6>=_0x138bc0){_0xaf70a6=_0x138bc0;_0x12b98e=0xc8;}else{_0x12b98e=0xce;}_0x4e99a8[_0x47a5('0x17')](_0x12b98e);return _0x4e99a8[_0x47a5('0x1e')](_0x47a5('0x1f'),_0x5247fd+'-'+_0xaf70a6+'/'+_0x138bc0)['json'](_0x11faf5);}return null;};}function patchUpdates(_0x1570bc){return function(_0xf160ba){try{jsonpatch['apply'](_0xf160ba,_0x1570bc,!![]);}catch(_0x2b0360){return BPromise[_0x47a5('0x20')](_0x2b0360);}return _0xf160ba[_0x47a5('0x21')]();};}function saveUpdates(_0x4c5910,_0xb8ae6c){return function(_0x2f142b){if(_0x2f142b){return _0x2f142b[_0x47a5('0x22')](_0x4c5910)[_0x47a5('0x23')](function(_0x5ef1b1){return _0x5ef1b1;});}return null;};}function removeEntity(_0xe2dea9,_0x385687){return function(_0x513981){if(_0x513981){return _0x513981[_0x47a5('0x24')]()[_0x47a5('0x23')](function(){_0xe2dea9[_0x47a5('0x17')](0xcc)[_0x47a5('0x18')]();});}};}function handleEntityNotFound(_0x3abd6a,_0x50bf17){return function(_0x53078a){if(!_0x53078a){_0x3abd6a[_0x47a5('0x16')](0x194);}return _0x53078a;};}function handleError(_0x5686db,_0x1ea9c8){_0x1ea9c8=_0x1ea9c8||0x1f4;return function(_0x5b6c4e){logger[_0x47a5('0x25')](_0x5b6c4e[_0x47a5('0x26')]);if(_0x5b6c4e[_0x47a5('0x27')]){delete _0x5b6c4e[_0x47a5('0x27')];}_0x5686db[_0x47a5('0x17')](_0x1ea9c8)[_0x47a5('0x28')](_0x5b6c4e);};}exports[_0x47a5('0x29')]=function(_0x136b14,_0x16631f){var _0x361bfa={},_0x1127f8={},_0x11a4fa={'count':0x0,'rows':[]};var _0x3ad507=_['map'](db[_0x47a5('0x2a')]['rawAttributes'],function(_0x2ef875){return{'name':_0x2ef875[_0x47a5('0x2b')],'type':_0x2ef875[_0x47a5('0x2c')]['key']};});_0x1127f8[_0x47a5('0x2d')]=_[_0x47a5('0x2e')](_0x3ad507,_0x47a5('0x27'));_0x1127f8[_0x47a5('0x2f')]=_['keys'](_0x136b14['query']);_0x1127f8[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x1127f8['model'],_0x1127f8['query']);_0x361bfa[_0x47a5('0x32')]=_[_0x47a5('0x31')](_0x1127f8['model'],qs[_0x47a5('0x33')](_0x136b14['query'][_0x47a5('0x33')]));_0x361bfa[_0x47a5('0x32')]=_0x361bfa['attributes']['length']?_0x361bfa[_0x47a5('0x32')]:_0x1127f8['model'];if(!_0x136b14[_0x47a5('0x2f')][_0x47a5('0x34')](_0x47a5('0x35'))){_0x361bfa['limit']=qs[_0x47a5('0x1d')](_0x136b14['query']['limit']);_0x361bfa[_0x47a5('0x1a')]=qs['offset'](_0x136b14[_0x47a5('0x2f')]['offset']);}_0x361bfa[_0x47a5('0x36')]=qs[_0x47a5('0x37')](_0x136b14[_0x47a5('0x2f')][_0x47a5('0x37')]);_0x361bfa[_0x47a5('0x38')]=qs[_0x47a5('0x30')](_[_0x47a5('0x39')](_0x136b14[_0x47a5('0x2f')],_0x1127f8[_0x47a5('0x30')]),_0x3ad507);if(_0x136b14['query'][_0x47a5('0x3a')]){_0x361bfa[_0x47a5('0x38')]=_['merge'](_0x361bfa[_0x47a5('0x38')],{'$or':_[_0x47a5('0x2e')](_0x3ad507,function(_0x1d4348){if(_0x1d4348['type']!==_0x47a5('0x3b')){var _0x10f660={};_0x10f660[_0x1d4348['name']]={'$like':'%'+_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3a')]+'%'};return _0x10f660;}})});}_0x361bfa=_['merge']({},_0x361bfa,_0x136b14['options']);var _0x5ebd8c={'where':_0x361bfa[_0x47a5('0x38')]};return db['Integration'][_0x47a5('0x1c')](_0x5ebd8c)[_0x47a5('0x23')](function(_0x301a85){_0x11a4fa[_0x47a5('0x1c')]=_0x301a85;if(_0x136b14[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x361bfa[_0x47a5('0x3d')]=[{'all':!![]}];}return db[_0x47a5('0x2a')][_0x47a5('0x3e')](_0x361bfa);})[_0x47a5('0x23')](function(_0x280500){_0x11a4fa[_0x47a5('0x3f')]=_0x280500;return _0x11a4fa;})[_0x47a5('0x23')](respondWithFilteredResult(_0x16631f,_0x361bfa))['catch'](handleError(_0x16631f,null));};exports[_0x47a5('0x40')]=function(_0x1c36fa,_0x331474){var _0x23bd8d={'raw':![],'where':{'id':_0x1c36fa[_0x47a5('0x41')]['id']}},_0x586f4f={};_0x586f4f['model']=_['keys'](db['Integration']['rawAttributes']);_0x586f4f[_0x47a5('0x2f')]=_['keys'](_0x1c36fa[_0x47a5('0x2f')]);_0x586f4f[_0x47a5('0x30')]=_[_0x47a5('0x31')](_0x586f4f['model'],_0x586f4f[_0x47a5('0x2f')]);_0x23bd8d[_0x47a5('0x32')]=_['intersection'](_0x586f4f['model'],qs[_0x47a5('0x33')](_0x1c36fa['query'][_0x47a5('0x33')]));_0x23bd8d[_0x47a5('0x32')]=_0x23bd8d[_0x47a5('0x32')][_0x47a5('0x42')]?_0x23bd8d[_0x47a5('0x32')]:_0x586f4f[_0x47a5('0x2d')];if(_0x1c36fa[_0x47a5('0x2f')][_0x47a5('0x3c')]){_0x23bd8d[_0x47a5('0x3d')]=[{'all':!![]}];}_0x23bd8d=_[_0x47a5('0x43')]({},_0x23bd8d,_0x1c36fa[_0x47a5('0x44')]);return db[_0x47a5('0x2a')][_0x47a5('0x45')](_0x23bd8d)[_0x47a5('0x23')](handleEntityNotFound(_0x331474,null))[_0x47a5('0x23')](respondWithResult(_0x331474,null))[_0x47a5('0x46')](handleError(_0x331474,null));};exports['create']=function(_0x2d38de,_0x23bb04){return db['Integration']['create'](_0x2d38de[_0x47a5('0x47')],{})['then'](respondWithResult(_0x23bb04,0xc9))[_0x47a5('0x46')](handleError(_0x23bb04,null));};exports[_0x47a5('0x22')]=function(_0x54c35f,_0x4f62d3){if(_0x54c35f[_0x47a5('0x47')]['id']){delete _0x54c35f['body']['id'];}return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x54c35f[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x4f62d3,null))[_0x47a5('0x23')](saveUpdates(_0x54c35f[_0x47a5('0x47')],null))[_0x47a5('0x23')](respondWithResult(_0x4f62d3,null))['catch'](handleError(_0x4f62d3,null));};exports['destroy']=function(_0x2dd1db,_0x411230){return db[_0x47a5('0x2a')][_0x47a5('0x45')]({'where':{'id':_0x2dd1db[_0x47a5('0x41')]['id']}})[_0x47a5('0x23')](handleEntityNotFound(_0x411230,null))[_0x47a5('0x23')](removeEntity(_0x411230,null))['catch'](handleError(_0x411230,null));}; \ No newline at end of file +var _0x896e=['model','map','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where','merge','filter','Integration','includeAll','include','findAll','rows','catch','keys','length','options','find','create','body','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','count','limit','set','Content-Range','json','reject','save','update','destroy','then','end','error','stack','name','send','index','rawAttributes','fieldName','type','key'];(function(_0x2fa64e,_0x40d833){var _0x16367f=function(_0x10da0e){while(--_0x10da0e){_0x2fa64e['push'](_0x2fa64e['shift']());}};_0x16367f(++_0x40d833);}(_0x896e,0x1e9));var _0xe896=function(_0x58dc11,_0x28c629){_0x58dc11=_0x58dc11-0x0;var _0x46b0ca=_0x896e[_0x58dc11];return _0x46b0ca;};'use strict';var emlformat=require(_0xe896('0x0'));var rimraf=require(_0xe896('0x1'));var zipdir=require(_0xe896('0x2'));var jsonpatch=require(_0xe896('0x3'));var rp=require(_0xe896('0x4'));var moment=require(_0xe896('0x5'));var BPromise=require(_0xe896('0x6'));var Mustache=require(_0xe896('0x7'));var util=require(_0xe896('0x8'));var path=require(_0xe896('0x9'));var sox=require(_0xe896('0xa'));var csv=require(_0xe896('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe896('0xc'));var _=require(_0xe896('0xd'));var squel=require(_0xe896('0xe'));var crypto=require(_0xe896('0xf'));var jsforce=require(_0xe896('0x10'));var deskjs=require('desk.js');var toCsv=require(_0xe896('0xb'));var querystring=require(_0xe896('0x11'));var Papa=require(_0xe896('0x12'));var Redis=require('ioredis');var authService=require(_0xe896('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0xe896('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe896('0x15'))(_0xe896('0x16'));var utils=require(_0xe896('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xe896('0x18'));var db=require(_0xe896('0x19'))['db'];function respondWithStatusCode(_0x3e8ac9,_0x580aac){_0x580aac=_0x580aac||0xcc;return function(_0x2aa522){if(_0x2aa522){return _0x3e8ac9[_0xe896('0x1a')](_0x580aac);}return _0x3e8ac9[_0xe896('0x1b')](_0x580aac)['end']();};}function respondWithResult(_0x2d0e46,_0x7dcf8a){_0x7dcf8a=_0x7dcf8a||0xc8;return function(_0x1e7ef8){if(_0x1e7ef8){return _0x2d0e46['status'](_0x7dcf8a)['json'](_0x1e7ef8);}};}function respondWithFilteredResult(_0x446ce2,_0x25606b){return function(_0x51e7b7){if(_0x51e7b7){var _0x5e78d6=typeof _0x25606b[_0xe896('0x1c')]===_0xe896('0x1d')&&typeof _0x25606b['limit']===_0xe896('0x1d');var _0x4e062a=_0x51e7b7[_0xe896('0x1e')];var _0x32f86d=_0x5e78d6?0x0:_0x25606b[_0xe896('0x1c')];var _0x5dc89d=_0x5e78d6?_0x51e7b7[_0xe896('0x1e')]:_0x25606b[_0xe896('0x1c')]+_0x25606b[_0xe896('0x1f')];var _0xbebbe1;if(_0x5dc89d>=_0x4e062a){_0x5dc89d=_0x4e062a;_0xbebbe1=0xc8;}else{_0xbebbe1=0xce;}_0x446ce2[_0xe896('0x1b')](_0xbebbe1);return _0x446ce2[_0xe896('0x20')](_0xe896('0x21'),_0x32f86d+'-'+_0x5dc89d+'/'+_0x4e062a)[_0xe896('0x22')](_0x51e7b7);}return null;};}function patchUpdates(_0x49547b){return function(_0x180d46){try{jsonpatch['apply'](_0x180d46,_0x49547b,!![]);}catch(_0x5d2c8d){return BPromise[_0xe896('0x23')](_0x5d2c8d);}return _0x180d46[_0xe896('0x24')]();};}function saveUpdates(_0x40502b,_0xeeec7c){return function(_0x498469){if(_0x498469){return _0x498469[_0xe896('0x25')](_0x40502b)['then'](function(_0x5001f7){return _0x5001f7;});}return null;};}function removeEntity(_0x45dd49,_0x41e689){return function(_0x1e952a){if(_0x1e952a){return _0x1e952a[_0xe896('0x26')]()[_0xe896('0x27')](function(){_0x45dd49[_0xe896('0x1b')](0xcc)[_0xe896('0x28')]();});}};}function handleEntityNotFound(_0x4b71cc,_0x390128){return function(_0x163a75){if(!_0x163a75){_0x4b71cc[_0xe896('0x1a')](0x194);}return _0x163a75;};}function handleError(_0x569d5f,_0x26635e){_0x26635e=_0x26635e||0x1f4;return function(_0xd50fe2){logger[_0xe896('0x29')](_0xd50fe2[_0xe896('0x2a')]);if(_0xd50fe2[_0xe896('0x2b')]){delete _0xd50fe2[_0xe896('0x2b')];}_0x569d5f['status'](_0x26635e)[_0xe896('0x2c')](_0xd50fe2);};}exports[_0xe896('0x2d')]=function(_0x201653,_0xbfb15b){var _0xace03f={},_0x5e0d9b={},_0x47c268={'count':0x0,'rows':[]};var _0x5c7dae=_['map'](db['Integration'][_0xe896('0x2e')],function(_0x29a18e){return{'name':_0x29a18e[_0xe896('0x2f')],'type':_0x29a18e[_0xe896('0x30')][_0xe896('0x31')]};});_0x5e0d9b[_0xe896('0x32')]=_[_0xe896('0x33')](_0x5c7dae,_0xe896('0x2b'));_0x5e0d9b['query']=_['keys'](_0x201653[_0xe896('0x34')]);_0x5e0d9b[_0xe896('0x35')]=_[_0xe896('0x36')](_0x5e0d9b[_0xe896('0x32')],_0x5e0d9b['query']);_0xace03f[_0xe896('0x37')]=_['intersection'](_0x5e0d9b['model'],qs[_0xe896('0x38')](_0x201653[_0xe896('0x34')][_0xe896('0x38')]));_0xace03f['attributes']=_0xace03f['attributes']['length']?_0xace03f[_0xe896('0x37')]:_0x5e0d9b[_0xe896('0x32')];if(!_0x201653[_0xe896('0x34')][_0xe896('0x39')](_0xe896('0x3a'))){_0xace03f['limit']=qs[_0xe896('0x1f')](_0x201653[_0xe896('0x34')][_0xe896('0x1f')]);_0xace03f[_0xe896('0x1c')]=qs[_0xe896('0x1c')](_0x201653[_0xe896('0x34')][_0xe896('0x1c')]);}_0xace03f[_0xe896('0x3b')]=qs['sort'](_0x201653[_0xe896('0x34')][_0xe896('0x3c')]);_0xace03f['where']=qs[_0xe896('0x35')](_['pick'](_0x201653[_0xe896('0x34')],_0x5e0d9b['filters']),_0x5c7dae);if(_0x201653[_0xe896('0x34')]['filter']){_0xace03f[_0xe896('0x3d')]=_[_0xe896('0x3e')](_0xace03f[_0xe896('0x3d')],{'$or':_[_0xe896('0x33')](_0x5c7dae,function(_0xeb9bbf){if(_0xeb9bbf['type']!=='VIRTUAL'){var _0x203aea={};_0x203aea[_0xeb9bbf[_0xe896('0x2b')]]={'$like':'%'+_0x201653[_0xe896('0x34')][_0xe896('0x3f')]+'%'};return _0x203aea;}})});}_0xace03f=_[_0xe896('0x3e')]({},_0xace03f,_0x201653['options']);var _0x5b8131={'where':_0xace03f[_0xe896('0x3d')]};return db[_0xe896('0x40')]['count'](_0x5b8131)['then'](function(_0x19d2fd){_0x47c268[_0xe896('0x1e')]=_0x19d2fd;if(_0x201653[_0xe896('0x34')][_0xe896('0x41')]){_0xace03f[_0xe896('0x42')]=[{'all':!![]}];}return db[_0xe896('0x40')][_0xe896('0x43')](_0xace03f);})[_0xe896('0x27')](function(_0x372c71){_0x47c268[_0xe896('0x44')]=_0x372c71;return _0x47c268;})[_0xe896('0x27')](respondWithFilteredResult(_0xbfb15b,_0xace03f))[_0xe896('0x45')](handleError(_0xbfb15b,null));};exports['show']=function(_0x1e5434,_0x143ad4){var _0x59b97f={'raw':![],'where':{'id':_0x1e5434['params']['id']}},_0x57366b={};_0x57366b[_0xe896('0x32')]=_[_0xe896('0x46')](db[_0xe896('0x40')]['rawAttributes']);_0x57366b[_0xe896('0x34')]=_[_0xe896('0x46')](_0x1e5434['query']);_0x57366b['filters']=_['intersection'](_0x57366b[_0xe896('0x32')],_0x57366b[_0xe896('0x34')]);_0x59b97f[_0xe896('0x37')]=_[_0xe896('0x36')](_0x57366b[_0xe896('0x32')],qs[_0xe896('0x38')](_0x1e5434['query'][_0xe896('0x38')]));_0x59b97f[_0xe896('0x37')]=_0x59b97f['attributes'][_0xe896('0x47')]?_0x59b97f[_0xe896('0x37')]:_0x57366b[_0xe896('0x32')];if(_0x1e5434[_0xe896('0x34')]['includeAll']){_0x59b97f[_0xe896('0x42')]=[{'all':!![]}];}_0x59b97f=_[_0xe896('0x3e')]({},_0x59b97f,_0x1e5434[_0xe896('0x48')]);return db[_0xe896('0x40')][_0xe896('0x49')](_0x59b97f)[_0xe896('0x27')](handleEntityNotFound(_0x143ad4,null))['then'](respondWithResult(_0x143ad4,null))[_0xe896('0x45')](handleError(_0x143ad4,null));};exports['create']=function(_0x234a22,_0x1c6ae1){return db[_0xe896('0x40')][_0xe896('0x4a')](_0x234a22[_0xe896('0x4b')],{})[_0xe896('0x27')](respondWithResult(_0x1c6ae1,0xc9))['catch'](handleError(_0x1c6ae1,null));};exports[_0xe896('0x25')]=function(_0x206ad3,_0x4818cd){if(_0x206ad3[_0xe896('0x4b')]['id']){delete _0x206ad3[_0xe896('0x4b')]['id'];}return db['Integration'][_0xe896('0x49')]({'where':{'id':_0x206ad3['params']['id']}})[_0xe896('0x27')](handleEntityNotFound(_0x4818cd,null))[_0xe896('0x27')](saveUpdates(_0x206ad3[_0xe896('0x4b')],null))[_0xe896('0x27')](respondWithResult(_0x4818cd,null))[_0xe896('0x45')](handleError(_0x4818cd,null));};exports['destroy']=function(_0x1fa3fd,_0x819c8a){return db[_0xe896('0x40')]['find']({'where':{'id':_0x1fa3fd[_0xe896('0x4c')]['id']}})['then'](handleEntityNotFound(_0x819c8a,null))['then'](removeEntity(_0x819c8a,null))[_0xe896('0x45')](handleError(_0x819c8a,null));}; \ No newline at end of file diff --git a/server/api/integration/integration.model.js b/server/api/integration/integration.model.js index c1a0786..183af5d 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 _0x0943=['../../config/logger','api','moment','bluebird','request-promise','path','./integration.attributes','exports','Integration','lodash'];(function(_0x4c4278,_0xde7e2e){var _0x5ec748=function(_0x4f535c){while(--_0x4f535c){_0x4c4278['push'](_0x4c4278['shift']());}};_0x5ec748(++_0xde7e2e);}(_0x0943,0x77));var _0x3094=function(_0x4fbee5,_0x1b6278){_0x4fbee5=_0x4fbee5-0x0;var _0x4be70b=_0x0943[_0x4fbee5];return _0x4be70b;};'use strict';var _=require(_0x3094('0x0'));var util=require('util');var logger=require(_0x3094('0x1'))(_0x3094('0x2'));var moment=require(_0x3094('0x3'));var BPromise=require(_0x3094('0x4'));var rp=require(_0x3094('0x5'));var fs=require('fs');var path=require(_0x3094('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3094('0x7'));module[_0x3094('0x8')]=function(_0x362f40,_0x1b58cb){return _0x362f40['define'](_0x3094('0x9'),attributes,{'tableName':'integrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5069=['util','api','moment','bluebird','request-promise','path','../../config/environment','./integration.attributes','integrations','lodash'];(function(_0x345251,_0x338c8a){var _0x1aef6d=function(_0x2d7a8a){while(--_0x2d7a8a){_0x345251['push'](_0x345251['shift']());}};_0x1aef6d(++_0x338c8a);}(_0x5069,0x6d));var _0x9506=function(_0x3ca70b,_0x3aeb4c){_0x3ca70b=_0x3ca70b-0x0;var _0x5d72c4=_0x5069[_0x3ca70b];return _0x5d72c4;};'use strict';var _=require(_0x9506('0x0'));var util=require(_0x9506('0x1'));var logger=require('../../config/logger')(_0x9506('0x2'));var moment=require(_0x9506('0x3'));var BPromise=require(_0x9506('0x4'));var rp=require(_0x9506('0x5'));var fs=require('fs');var path=require(_0x9506('0x6'));var rimraf=require('rimraf');var config=require(_0x9506('0x7'));var attributes=require(_0x9506('0x8'));module['exports']=function(_0x435220,_0x4374d8){return _0x435220['define']('Integration',attributes,{'tableName':_0x9506('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/integration/integration.rpc.js b/server/api/integration/integration.rpc.js index 21af561..6ba398e 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 _0x0295=['client','http','then','info','request\x20sent','debug','Integration,\x20%s,\x20%s,\x20%s','stringify','error','Integration,\x20%s,\x20%s','message','result','catch','lodash','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x11975f,_0x41f438){var _0x1ecee8=function(_0x377330){while(--_0x377330){_0x11975f['push'](_0x11975f['shift']());}};_0x1ecee8(++_0x41f438);}(_0x0295,0x1f0));var _0x5029=function(_0x32bb12,_0x1baa09){_0x32bb12=_0x32bb12-0x0;var _0x1af866=_0x0295[_0x32bb12];return _0x1af866;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x5029('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5029('0x2'))['db'];var utils=require(_0x5029('0x3'));var logger=require(_0x5029('0x4'))(_0x5029('0x5'));var config=require(_0x5029('0x6'));var jayson=require(_0x5029('0x7'));var client=jayson[_0x5029('0x8')][_0x5029('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5b3cd,_0x502a62,_0x54978f){return new BPromise(function(_0x4ee867,_0xf4459b){return client['request'](_0x5b3cd,_0x54978f)[_0x5029('0xa')](function(_0x5bccfc){logger[_0x5029('0xb')]('Integration,\x20%s,\x20%s',_0x502a62,_0x5029('0xc'));logger[_0x5029('0xd')](_0x5029('0xe'),_0x502a62,'request\x20sent',JSON[_0x5029('0xf')](_0x5bccfc));if(_0x5bccfc[_0x5029('0x10')]){if(_0x5bccfc[_0x5029('0x10')]['code']===0x1f4){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc['error']['message']);return _0xf4459b(_0x5bccfc['error']['message']);}logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);return _0x4ee867(_0x5bccfc[_0x5029('0x10')][_0x5029('0x12')]);}else{logger[_0x5029('0xb')](_0x5029('0x11'),_0x502a62,_0x5029('0xc'));_0x4ee867(_0x5bccfc[_0x5029('0x13')][_0x5029('0x12')]);}})[_0x5029('0x14')](function(_0x3786b5){logger[_0x5029('0x10')](_0x5029('0x11'),_0x502a62,_0x3786b5);_0xf4459b(_0x3786b5);});});} \ No newline at end of file +var _0xe2fe=['then','info','Integration,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','lodash','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request'];(function(_0x2ff88c,_0x444be2){var _0x5e3c4d=function(_0x4967d7){while(--_0x4967d7){_0x2ff88c['push'](_0x2ff88c['shift']());}};_0x5e3c4d(++_0x444be2);}(_0xe2fe,0x86));var _0xee2f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe2fe[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xee2f('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xee2f('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee2f('0x2'));var db=require(_0xee2f('0x3'))['db'];var utils=require(_0xee2f('0x4'));var logger=require(_0xee2f('0x5'))(_0xee2f('0x6'));var config=require('../../config/environment');var jayson=require(_0xee2f('0x7'));var client=jayson[_0xee2f('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1533a0,_0x2e1c8c,_0x5a7975){return new BPromise(function(_0x3c4095,_0x5ea796){return client[_0xee2f('0x9')](_0x1533a0,_0x5a7975)[_0xee2f('0xa')](function(_0x53f7dd){logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,'request\x20sent');logger['debug']('Integration,\x20%s,\x20%s,\x20%s',_0x2e1c8c,'request\x20sent',JSON[_0xee2f('0xd')](_0x53f7dd));if(_0x53f7dd['error']){if(_0x53f7dd['error']['code']===0x1f4){logger[_0xee2f('0xe')](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);return _0x5ea796(_0x53f7dd[_0xee2f('0xe')][_0xee2f('0xf')]);}logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x53f7dd['error'][_0xee2f('0xf')]);return _0x3c4095(_0x53f7dd[_0xee2f('0xe')]['message']);}else{logger[_0xee2f('0xb')](_0xee2f('0xc'),_0x2e1c8c,_0xee2f('0x10'));_0x3c4095(_0x53f7dd[_0xee2f('0x11')][_0xee2f('0xf')]);}})['catch'](function(_0x3f6372){logger['error'](_0xee2f('0xc'),_0x2e1c8c,_0x3f6372);_0x5ea796(_0x3f6372);});});} \ No newline at end of file diff --git a/server/api/integrationReport/index.js b/server/api/integrationReport/index.js index 945bf63..3e9a9ef 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 _0x524e=['express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./integrationReport.controller','get','index','/describe','describe','/:id','isAuthenticated','show','post','create','put','update','delete','destroy','path','connect-timeout'];(function(_0x30e0da,_0xf22354){var _0x35f3ca=function(_0x5bafc2){while(--_0x5bafc2){_0x30e0da['push'](_0x30e0da['shift']());}};_0x35f3ca(++_0xf22354);}(_0x524e,0x15e));var _0xe524=function(_0x4a4324,_0x4c327c){_0x4a4324=_0x4a4324-0x0;var _0x576665=_0x524e[_0x4a4324];return _0x576665;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe524('0x0'));var timeout=require(_0xe524('0x1'));var express=require(_0xe524('0x2'));var router=express[_0xe524('0x3')]();var fs_extra=require(_0xe524('0x4'));var auth=require(_0xe524('0x5'));var interaction=require(_0xe524('0x6'));var config=require(_0xe524('0x7'));var controller=require(_0xe524('0x8'));router[_0xe524('0x9')]('/',auth['isAuthenticated'](),controller[_0xe524('0xa')]);router[_0xe524('0x9')](_0xe524('0xb'),auth['isAuthenticated'](),controller[_0xe524('0xc')]);router[_0xe524('0x9')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0xf')]);router[_0xe524('0x10')]('/',auth[_0xe524('0xe')](),controller[_0xe524('0x11')]);router[_0xe524('0x12')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x13')]);router[_0xe524('0x14')](_0xe524('0xd'),auth[_0xe524('0xe')](),controller[_0xe524('0x15')]);module['exports']=router; \ No newline at end of file +var _0x66fa=['index','get','/describe','post','/:id','delete','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated'];(function(_0x2a2385,_0x483814){var _0x2c75=function(_0x1991da){while(--_0x1991da){_0x2a2385['push'](_0x2a2385['shift']());}};_0x2c75(++_0x483814);}(_0x66fa,0x117));var _0xa66f=function(_0x2f678d,_0xbc405a){_0x2f678d=_0x2f678d-0x0;var _0x4799f8=_0x66fa[_0x2f678d];return _0x4799f8;};'use strict';var multer=require(_0xa66f('0x0'));var util=require(_0xa66f('0x1'));var path=require('path');var timeout=require(_0xa66f('0x2'));var express=require(_0xa66f('0x3'));var router=express[_0xa66f('0x4')]();var fs_extra=require(_0xa66f('0x5'));var auth=require(_0xa66f('0x6'));var interaction=require(_0xa66f('0x7'));var config=require(_0xa66f('0x8'));var controller=require('./integrationReport.controller');router['get']('/',auth[_0xa66f('0x9')](),controller[_0xa66f('0xa')]);router[_0xa66f('0xb')](_0xa66f('0xc'),auth[_0xa66f('0x9')](),controller['describe']);router[_0xa66f('0xb')]('/:id',auth[_0xa66f('0x9')](),controller['show']);router[_0xa66f('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0xa66f('0xe'),auth[_0xa66f('0x9')](),controller['update']);router[_0xa66f('0xf')]('/:id',auth[_0xa66f('0x9')](),controller['destroy']);module[_0xa66f('0x10')]=router; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.attributes.js b/server/api/integrationReport/integrationReport.attributes.js index 1721031..60e4a68 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 _0x987c=['INTEGER','BOOLEAN','TEXT','ENUM','SENT','SENDING','RECEIVED','FAILED','sequelize','exports','STRING','DATE'];(function(_0x421214,_0x585bc4){var _0x2f1248=function(_0xb69ad7){while(--_0xb69ad7){_0x421214['push'](_0x421214['shift']());}};_0x2f1248(++_0x585bc4);}(_0x987c,0x134));var _0xc987=function(_0x15e218,_0x38cfd4){_0x15e218=_0x15e218-0x0;var _0xada465=_0x987c[_0x15e218];return _0xada465;};'use strict';var Sequelize=require(_0xc987('0x0'));module[_0xc987('0x1')]={'integration':{'type':Sequelize[_0xc987('0x2')]},'eventChannel':{'type':Sequelize['STRING']},'exitStatus':{'type':Sequelize[_0xc987('0x2')]},'ticketId':{'type':Sequelize[_0xc987('0x2')]},'integrationId':{'type':Sequelize['INTEGER']},'contacts':{'type':Sequelize[_0xc987('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0xc987('0x2')]},'queue':{'type':Sequelize[_0xc987('0x2')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc987('0x2')]},'agentcalledAt':{'type':Sequelize[_0xc987('0x3')]},'agentconnectAt':{'type':Sequelize[_0xc987('0x3')]},'holdtime':{'type':Sequelize[_0xc987('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize[_0xc987('0x3')]},'talktime':{'type':Sequelize[_0xc987('0x4')]},'agentacw':{'type':Sequelize[_0xc987('0x5')],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0xc987('0x2')]},'agentringnoanswer':{'type':Sequelize[_0xc987('0x5')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize['DATE']},'agentdump':{'type':Sequelize[_0xc987('0x5')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xc987('0x3')]},'lastevent':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize[_0xc987('0x4')]},'channelstatedesc':{'type':Sequelize[_0xc987('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc987('0x2')]},'connectedlinename':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xc987('0x2')]},'accountcode':{'type':Sequelize[_0xc987('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize['STRING']},'priority':{'type':Sequelize['STRING']},'destchannel':{'type':Sequelize[_0xc987('0x2')]},'destchannelstate':{'type':Sequelize[_0xc987('0x4')]},'destchannelstatedesc':{'type':Sequelize[_0xc987('0x2')]},'destcalleridnum':{'type':Sequelize[_0xc987('0x2')]},'destcalleridname':{'type':Sequelize[_0xc987('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0xc987('0x2')]},'destconnectedlinename':{'type':Sequelize[_0xc987('0x2')]},'destlanguage':{'type':Sequelize[_0xc987('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0xc987('0x2')]},'destexten':{'type':Sequelize[_0xc987('0x2')]},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xc987('0x2')]},'inReplyTo':{'type':Sequelize['STRING']},'subject':{'type':Sequelize['STRING']},'from':{'type':Sequelize['STRING']},'to':{'type':Sequelize[_0xc987('0x2')]},'cc':{'type':Sequelize[_0xc987('0x2')]},'attachment':{'type':Sequelize['TEXT']},'html':{'type':Sequelize[_0xc987('0x6')]},'text':{'type':Sequelize[_0xc987('0x6')]},'status':{'type':Sequelize[_0xc987('0x7')](_0xc987('0x8'),_0xc987('0x9'),_0xc987('0xa'),_0xc987('0xb'))},'url':{'type':Sequelize[_0xc987('0x2')]},'app':{'type':Sequelize[_0xc987('0x2')]},'appdata':{'type':Sequelize[_0xc987('0x2')]},'projectId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe88c=['BOOLEAN','TEXT','RECEIVED','FAILED','exports','STRING','INTEGER','DATE'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xe88c,0x124));var _0xce88=function(_0x576e2b,_0x328953){_0x576e2b=_0x576e2b-0x0;var _0x46461a=_0xe88c[_0x576e2b];return _0x46461a;};'use strict';var Sequelize=require('sequelize');module[_0xce88('0x0')]={'integration':{'type':Sequelize['STRING']},'eventChannel':{'type':Sequelize[_0xce88('0x1')]},'exitStatus':{'type':Sequelize[_0xce88('0x1')]},'ticketId':{'type':Sequelize[_0xce88('0x1')]},'integrationId':{'type':Sequelize[_0xce88('0x2')]},'contacts':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xce88('0x1')]},'calleridnum':{'type':Sequelize[_0xce88('0x1')]},'calleridname':{'type':Sequelize[_0xce88('0x1')]},'queue':{'type':Sequelize[_0xce88('0x1')]},'interface':{'type':Sequelize['STRING']},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize[_0xce88('0x3')]},'agentconnectAt':{'type':Sequelize[_0xce88('0x3')]},'holdtime':{'type':Sequelize['INTEGER']},'agentcomplete':{'type':Sequelize[_0xce88('0x4')],'defaultValue':![]},'agentcompleteAt':{'type':Sequelize['DATE']},'talktime':{'type':Sequelize[_0xce88('0x2')]},'agentacw':{'type':Sequelize[_0xce88('0x4')],'defaultValue':![]},'acwtime':{'type':Sequelize[_0xce88('0x2')]},'reason':{'type':Sequelize['STRING']},'agentringnoanswer':{'type':Sequelize[_0xce88('0x4')],'defaultValue':![]},'agentringnoanswerAt':{'type':Sequelize[_0xce88('0x3')]},'agentdump':{'type':Sequelize[_0xce88('0x4')],'defaultValue':![]},'agentdumpAt':{'type':Sequelize[_0xce88('0x3')]},'lastevent':{'type':Sequelize[_0xce88('0x1')]},'channel':{'type':Sequelize[_0xce88('0x1')]},'channelstate':{'type':Sequelize[_0xce88('0x2')]},'channelstatedesc':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0xce88('0x1')]},'language':{'type':Sequelize[_0xce88('0x1')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0xce88('0x1')]},'exten':{'type':Sequelize[_0xce88('0x1')]},'priority':{'type':Sequelize[_0xce88('0x1')]},'destchannel':{'type':Sequelize[_0xce88('0x1')]},'destchannelstate':{'type':Sequelize[_0xce88('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0xce88('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0xce88('0x1')]},'destconnectedlinename':{'type':Sequelize[_0xce88('0x1')]},'destlanguage':{'type':Sequelize['STRING']},'destaccountcode':{'type':Sequelize[_0xce88('0x1')]},'destcontext':{'type':Sequelize[_0xce88('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize['STRING']},'destuniqueid':{'type':Sequelize['STRING']},'messageId':{'type':Sequelize[_0xce88('0x1')]},'inReplyTo':{'type':Sequelize[_0xce88('0x1')]},'subject':{'type':Sequelize[_0xce88('0x1')]},'from':{'type':Sequelize[_0xce88('0x1')]},'to':{'type':Sequelize[_0xce88('0x1')]},'cc':{'type':Sequelize[_0xce88('0x1')]},'attachment':{'type':Sequelize[_0xce88('0x5')]},'html':{'type':Sequelize[_0xce88('0x5')]},'text':{'type':Sequelize[_0xce88('0x5')]},'status':{'type':Sequelize['ENUM']('SENT','SENDING',_0xce88('0x6'),_0xce88('0x7'))},'url':{'type':Sequelize[_0xce88('0x1')]},'app':{'type':Sequelize[_0xce88('0x1')]},'appdata':{'type':Sequelize[_0xce88('0x1')]},'projectId':{'type':Sequelize[_0xce88('0x2')]}}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.controller.js b/server/api/integrationReport/integrationReport.controller.js index 6632b81..6f8751e 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 _0x4b75=['fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','reject','save','then','destroy','end','name','index','map','IntegrationReport','rawAttributes','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','include','findAll','rows','catch','params','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','mustache','util','path','sox','to-csv','ejs'];(function(_0x3f8a03,_0x319b9c){var _0x147fb2=function(_0x523c1c){while(--_0x523c1c){_0x3f8a03['push'](_0x3f8a03['shift']());}};_0x147fb2(++_0x319b9c);}(_0x4b75,0x19a));var _0x54b7=function(_0x575613,_0x1a2cad){_0x575613=_0x575613-0x0;var _0x5cb89c=_0x4b75[_0x575613];return _0x5cb89c;};'use strict';var emlformat=require(_0x54b7('0x0'));var rimraf=require(_0x54b7('0x1'));var zipdir=require(_0x54b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x54b7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x54b7('0x4'));var util=require(_0x54b7('0x5'));var path=require(_0x54b7('0x6'));var sox=require(_0x54b7('0x7'));var csv=require(_0x54b7('0x8'));var ejs=require(_0x54b7('0x9'));var fs=require('fs');var fs_extra=require(_0x54b7('0xa'));var _=require(_0x54b7('0xb'));var squel=require(_0x54b7('0xc'));var crypto=require(_0x54b7('0xd'));var jsforce=require(_0x54b7('0xe'));var deskjs=require(_0x54b7('0xf'));var toCsv=require(_0x54b7('0x8'));var querystring=require(_0x54b7('0x10'));var Papa=require('papaparse');var Redis=require(_0x54b7('0x11'));var authService=require(_0x54b7('0x12'));var qs=require(_0x54b7('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x54b7('0x14'));var logger=require(_0x54b7('0x15'))('api');var utils=require(_0x54b7('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x54b7('0x17'));var db=require(_0x54b7('0x18'))['db'];function respondWithStatusCode(_0x9bd0,_0x135b82){_0x135b82=_0x135b82||0xcc;return function(_0x52b52b){if(_0x52b52b){return _0x9bd0[_0x54b7('0x19')](_0x135b82);}return _0x9bd0['status'](_0x135b82)['end']();};}function respondWithResult(_0x4dcf39,_0x47dd53){_0x47dd53=_0x47dd53||0xc8;return function(_0x23c44b){if(_0x23c44b){return _0x4dcf39[_0x54b7('0x1a')](_0x47dd53)['json'](_0x23c44b);}};}function respondWithFilteredResult(_0x2e9128,_0x612d35){return function(_0x12a12f){if(_0x12a12f){var _0x5157b0=typeof _0x612d35[_0x54b7('0x1b')]===_0x54b7('0x1c')&&typeof _0x612d35[_0x54b7('0x1d')]===_0x54b7('0x1c');var _0x42ea91=_0x12a12f[_0x54b7('0x1e')];var _0x4a3e25=_0x5157b0?0x0:_0x612d35['offset'];var _0x48d592=_0x5157b0?_0x12a12f['count']:_0x612d35[_0x54b7('0x1b')]+_0x612d35['limit'];var _0x1cfde1;if(_0x48d592>=_0x42ea91){_0x48d592=_0x42ea91;_0x1cfde1=0xc8;}else{_0x1cfde1=0xce;}_0x2e9128['status'](_0x1cfde1);return _0x2e9128[_0x54b7('0x1f')]('Content-Range',_0x4a3e25+'-'+_0x48d592+'/'+_0x42ea91)['json'](_0x12a12f);}return null;};}function patchUpdates(_0x10ba65){return function(_0x20d7bd){try{jsonpatch['apply'](_0x20d7bd,_0x10ba65,!![]);}catch(_0x16ff81){return BPromise[_0x54b7('0x20')](_0x16ff81);}return _0x20d7bd[_0x54b7('0x21')]();};}function saveUpdates(_0x5a352d,_0x2b2d45){return function(_0x352933){if(_0x352933){return _0x352933['update'](_0x5a352d)[_0x54b7('0x22')](function(_0x1444e6){return _0x1444e6;});}return null;};}function removeEntity(_0x52c787,_0x1cc3d4){return function(_0x36dd83){if(_0x36dd83){return _0x36dd83[_0x54b7('0x23')]()['then'](function(){_0x52c787[_0x54b7('0x1a')](0xcc)[_0x54b7('0x24')]();});}};}function handleEntityNotFound(_0x13628a,_0x16ab99){return function(_0x45c643){if(!_0x45c643){_0x13628a[_0x54b7('0x19')](0x194);}return _0x45c643;};}function handleError(_0x348a9b,_0x551811){_0x551811=_0x551811||0x1f4;return function(_0x31ee2b){logger['error'](_0x31ee2b['stack']);if(_0x31ee2b[_0x54b7('0x25')]){delete _0x31ee2b['name'];}_0x348a9b[_0x54b7('0x1a')](_0x551811)['send'](_0x31ee2b);};}exports[_0x54b7('0x26')]=function(_0x25c3d7,_0x4694f2){var _0x118c7e={},_0x57be41={},_0x2e0f5e={'count':0x0,'rows':[]};var _0x13af9a=_[_0x54b7('0x27')](db[_0x54b7('0x28')][_0x54b7('0x29')],function(_0x2bc266){return{'name':_0x2bc266['fieldName'],'type':_0x2bc266[_0x54b7('0x2a')]['key']};});_0x57be41[_0x54b7('0x2b')]=_[_0x54b7('0x27')](_0x13af9a,_0x54b7('0x25'));_0x57be41[_0x54b7('0x2c')]=_[_0x54b7('0x2d')](_0x25c3d7[_0x54b7('0x2c')]);_0x57be41[_0x54b7('0x2e')]=_[_0x54b7('0x2f')](_0x57be41[_0x54b7('0x2b')],_0x57be41['query']);_0x118c7e[_0x54b7('0x30')]=_[_0x54b7('0x2f')](_0x57be41[_0x54b7('0x2b')],qs[_0x54b7('0x31')](_0x25c3d7[_0x54b7('0x2c')][_0x54b7('0x31')]));_0x118c7e['attributes']=_0x118c7e['attributes'][_0x54b7('0x32')]?_0x118c7e['attributes']:_0x57be41[_0x54b7('0x2b')];if(!_0x25c3d7[_0x54b7('0x2c')][_0x54b7('0x33')](_0x54b7('0x34'))){_0x118c7e[_0x54b7('0x1d')]=qs[_0x54b7('0x1d')](_0x25c3d7['query'][_0x54b7('0x1d')]);_0x118c7e[_0x54b7('0x1b')]=qs[_0x54b7('0x1b')](_0x25c3d7['query']['offset']);}_0x118c7e[_0x54b7('0x35')]=qs[_0x54b7('0x36')](_0x25c3d7[_0x54b7('0x2c')][_0x54b7('0x36')]);_0x118c7e['where']=qs[_0x54b7('0x2e')](_[_0x54b7('0x37')](_0x25c3d7['query'],_0x57be41[_0x54b7('0x2e')]),_0x13af9a);if(_0x25c3d7['query'][_0x54b7('0x38')]){_0x118c7e['where']=_[_0x54b7('0x39')](_0x118c7e[_0x54b7('0x3a')],{'$or':_[_0x54b7('0x27')](_0x13af9a,function(_0x6ed71d){if(_0x6ed71d['type']!==_0x54b7('0x3b')){var _0x16947d={};_0x16947d[_0x6ed71d[_0x54b7('0x25')]]={'$like':'%'+_0x25c3d7['query']['filter']+'%'};return _0x16947d;}})});}_0x118c7e=_['merge']({},_0x118c7e,_0x25c3d7[_0x54b7('0x3c')]);var _0x1ad52c={'where':_0x118c7e[_0x54b7('0x3a')]};return db[_0x54b7('0x28')][_0x54b7('0x1e')](_0x1ad52c)[_0x54b7('0x22')](function(_0x3bf5c2){_0x2e0f5e['count']=_0x3bf5c2;if(_0x25c3d7[_0x54b7('0x2c')]['includeAll']){_0x118c7e[_0x54b7('0x3d')]=[{'all':!![]}];}return db['IntegrationReport'][_0x54b7('0x3e')](_0x118c7e);})[_0x54b7('0x22')](function(_0x22d84a){_0x2e0f5e[_0x54b7('0x3f')]=_0x22d84a;return _0x2e0f5e;})[_0x54b7('0x22')](respondWithFilteredResult(_0x4694f2,_0x118c7e))[_0x54b7('0x40')](handleError(_0x4694f2,null));};exports['show']=function(_0xfa00f2,_0x4b8444){var _0x1488ab={'raw':![],'where':{'id':_0xfa00f2[_0x54b7('0x41')]['id']}},_0x4c5852={};_0x4c5852[_0x54b7('0x2b')]=_[_0x54b7('0x2d')](db[_0x54b7('0x28')][_0x54b7('0x29')]);_0x4c5852[_0x54b7('0x2c')]=_[_0x54b7('0x2d')](_0xfa00f2[_0x54b7('0x2c')]);_0x4c5852[_0x54b7('0x2e')]=_[_0x54b7('0x2f')](_0x4c5852[_0x54b7('0x2b')],_0x4c5852[_0x54b7('0x2c')]);_0x1488ab[_0x54b7('0x30')]=_[_0x54b7('0x2f')](_0x4c5852[_0x54b7('0x2b')],qs[_0x54b7('0x31')](_0xfa00f2['query'][_0x54b7('0x31')]));_0x1488ab[_0x54b7('0x30')]=_0x1488ab['attributes'][_0x54b7('0x32')]?_0x1488ab[_0x54b7('0x30')]:_0x4c5852[_0x54b7('0x2b')];if(_0xfa00f2[_0x54b7('0x2c')]['includeAll']){_0x1488ab[_0x54b7('0x3d')]=[{'all':!![]}];}_0x1488ab=_[_0x54b7('0x39')]({},_0x1488ab,_0xfa00f2[_0x54b7('0x3c')]);return db[_0x54b7('0x28')][_0x54b7('0x42')](_0x1488ab)['then'](handleEntityNotFound(_0x4b8444,null))[_0x54b7('0x22')](respondWithResult(_0x4b8444,null))[_0x54b7('0x40')](handleError(_0x4b8444,null));};exports[_0x54b7('0x43')]=function(_0x2e2738,_0x268891){return db[_0x54b7('0x28')][_0x54b7('0x43')](_0x2e2738[_0x54b7('0x44')],{})[_0x54b7('0x22')](respondWithResult(_0x268891,0xc9))[_0x54b7('0x40')](handleError(_0x268891,null));};exports['update']=function(_0x554195,_0x4d371e){if(_0x554195[_0x54b7('0x44')]['id']){delete _0x554195[_0x54b7('0x44')]['id'];}return db[_0x54b7('0x28')]['find']({'where':{'id':_0x554195['params']['id']}})[_0x54b7('0x22')](handleEntityNotFound(_0x4d371e,null))['then'](saveUpdates(_0x554195['body'],null))[_0x54b7('0x22')](respondWithResult(_0x4d371e,null))[_0x54b7('0x40')](handleError(_0x4d371e,null));};exports[_0x54b7('0x23')]=function(_0x5cd342,_0x66b0d6){return db['IntegrationReport'][_0x54b7('0x42')]({'where':{'id':_0x5cd342[_0x54b7('0x41')]['id']}})[_0x54b7('0x22')](handleEntityNotFound(_0x66b0d6,null))[_0x54b7('0x22')](removeEntity(_0x66b0d6,null))['catch'](handleError(_0x66b0d6,null));};exports[_0x54b7('0x45')]=function(_0x340171,_0x3b4aeb){return db[_0x54b7('0x28')]['describe']()[_0x54b7('0x22')](respondWithResult(_0x3b4aeb,null))[_0x54b7('0x40')](handleError(_0x3b4aeb,null));}; \ No newline at end of file +var _0xc98c=['querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','error','stack','send','map','IntegrationReport','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','type','VIRTUAL','merge','include','findAll','rows','show','includeAll','find','create','body','catch','params','describe','eml-format','rimraf','zip-dir','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','jsforce','desk.js','to-csv'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0xc98c,0xd4));var _0xcc98=function(_0x1b412f,_0x2ace8f){_0x1b412f=_0x1b412f-0x0;var _0x56f6ea=_0xc98c[_0x1b412f];return _0x56f6ea;};'use strict';var emlformat=require(_0xcc98('0x0'));var rimraf=require(_0xcc98('0x1'));var zipdir=require(_0xcc98('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcc98('0x3'));var moment=require(_0xcc98('0x4'));var BPromise=require(_0xcc98('0x5'));var Mustache=require(_0xcc98('0x6'));var util=require(_0xcc98('0x7'));var path=require(_0xcc98('0x8'));var sox=require(_0xcc98('0x9'));var csv=require('to-csv');var ejs=require(_0xcc98('0xa'));var fs=require('fs');var fs_extra=require(_0xcc98('0xb'));var _=require(_0xcc98('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xcc98('0xd'));var deskjs=require(_0xcc98('0xe'));var toCsv=require(_0xcc98('0xf'));var querystring=require(_0xcc98('0x10'));var Papa=require('papaparse');var Redis=require(_0xcc98('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xcc98('0x12'));var as=require(_0xcc98('0x13'));var hardwareService=require(_0xcc98('0x14'));var logger=require('../../config/logger')(_0xcc98('0x15'));var utils=require(_0xcc98('0x16'));var config=require(_0xcc98('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x57e108,_0x55bc28){_0x55bc28=_0x55bc28||0xcc;return function(_0x3c39b8){if(_0x3c39b8){return _0x57e108[_0xcc98('0x18')](_0x55bc28);}return _0x57e108[_0xcc98('0x19')](_0x55bc28)[_0xcc98('0x1a')]();};}function respondWithResult(_0x2cbf2c,_0x5aed21){_0x5aed21=_0x5aed21||0xc8;return function(_0x25b4b2){if(_0x25b4b2){return _0x2cbf2c[_0xcc98('0x19')](_0x5aed21)[_0xcc98('0x1b')](_0x25b4b2);}};}function respondWithFilteredResult(_0x2a68d5,_0x3b9538){return function(_0x550fdb){if(_0x550fdb){var _0x417dcc=typeof _0x3b9538[_0xcc98('0x1c')]===_0xcc98('0x1d')&&typeof _0x3b9538[_0xcc98('0x1e')]==='undefined';var _0x26e8a9=_0x550fdb[_0xcc98('0x1f')];var _0x5821d7=_0x417dcc?0x0:_0x3b9538[_0xcc98('0x1c')];var _0x484d5f=_0x417dcc?_0x550fdb[_0xcc98('0x1f')]:_0x3b9538[_0xcc98('0x1c')]+_0x3b9538[_0xcc98('0x1e')];var _0xe06245;if(_0x484d5f>=_0x26e8a9){_0x484d5f=_0x26e8a9;_0xe06245=0xc8;}else{_0xe06245=0xce;}_0x2a68d5[_0xcc98('0x19')](_0xe06245);return _0x2a68d5['set'](_0xcc98('0x20'),_0x5821d7+'-'+_0x484d5f+'/'+_0x26e8a9)[_0xcc98('0x1b')](_0x550fdb);}return null;};}function patchUpdates(_0x1ff1da){return function(_0x3b8729){try{jsonpatch[_0xcc98('0x21')](_0x3b8729,_0x1ff1da,!![]);}catch(_0x437367){return BPromise[_0xcc98('0x22')](_0x437367);}return _0x3b8729[_0xcc98('0x23')]();};}function saveUpdates(_0x234fad,_0x4336ff){return function(_0x3e475d){if(_0x3e475d){return _0x3e475d[_0xcc98('0x24')](_0x234fad)[_0xcc98('0x25')](function(_0x9b2dc9){return _0x9b2dc9;});}return null;};}function removeEntity(_0x197dc8,_0x42d26c){return function(_0x1d1ed1){if(_0x1d1ed1){return _0x1d1ed1[_0xcc98('0x26')]()[_0xcc98('0x25')](function(){_0x197dc8[_0xcc98('0x19')](0xcc)[_0xcc98('0x1a')]();});}};}function handleEntityNotFound(_0x225428,_0xf8bf11){return function(_0x3aa19f){if(!_0x3aa19f){_0x225428['sendStatus'](0x194);}return _0x3aa19f;};}function handleError(_0x2a3199,_0x107c1c){_0x107c1c=_0x107c1c||0x1f4;return function(_0x2c4f84){logger[_0xcc98('0x27')](_0x2c4f84[_0xcc98('0x28')]);if(_0x2c4f84['name']){delete _0x2c4f84['name'];}_0x2a3199['status'](_0x107c1c)[_0xcc98('0x29')](_0x2c4f84);};}exports['index']=function(_0x57f4b6,_0x2fe03d){var _0x4e7a2f={},_0x23e4f3={},_0x47f471={'count':0x0,'rows':[]};var _0x452de9=_[_0xcc98('0x2a')](db[_0xcc98('0x2b')][_0xcc98('0x2c')],function(_0x353358){return{'name':_0x353358[_0xcc98('0x2d')],'type':_0x353358['type'][_0xcc98('0x2e')]};});_0x23e4f3[_0xcc98('0x2f')]=_['map'](_0x452de9,'name');_0x23e4f3[_0xcc98('0x30')]=_[_0xcc98('0x31')](_0x57f4b6[_0xcc98('0x30')]);_0x23e4f3[_0xcc98('0x32')]=_[_0xcc98('0x33')](_0x23e4f3[_0xcc98('0x2f')],_0x23e4f3['query']);_0x4e7a2f[_0xcc98('0x34')]=_['intersection'](_0x23e4f3[_0xcc98('0x2f')],qs[_0xcc98('0x35')](_0x57f4b6['query'][_0xcc98('0x35')]));_0x4e7a2f[_0xcc98('0x34')]=_0x4e7a2f[_0xcc98('0x34')][_0xcc98('0x36')]?_0x4e7a2f['attributes']:_0x23e4f3[_0xcc98('0x2f')];if(!_0x57f4b6[_0xcc98('0x30')][_0xcc98('0x37')](_0xcc98('0x38'))){_0x4e7a2f[_0xcc98('0x1e')]=qs[_0xcc98('0x1e')](_0x57f4b6['query'][_0xcc98('0x1e')]);_0x4e7a2f[_0xcc98('0x1c')]=qs[_0xcc98('0x1c')](_0x57f4b6[_0xcc98('0x30')]['offset']);}_0x4e7a2f[_0xcc98('0x39')]=qs[_0xcc98('0x3a')](_0x57f4b6[_0xcc98('0x30')]['sort']);_0x4e7a2f[_0xcc98('0x3b')]=qs[_0xcc98('0x32')](_[_0xcc98('0x3c')](_0x57f4b6['query'],_0x23e4f3[_0xcc98('0x32')]),_0x452de9);if(_0x57f4b6[_0xcc98('0x30')][_0xcc98('0x3d')]){_0x4e7a2f[_0xcc98('0x3b')]=_['merge'](_0x4e7a2f[_0xcc98('0x3b')],{'$or':_[_0xcc98('0x2a')](_0x452de9,function(_0xeb7df3){if(_0xeb7df3[_0xcc98('0x3e')]!==_0xcc98('0x3f')){var _0x1fd93c={};_0x1fd93c[_0xeb7df3['name']]={'$like':'%'+_0x57f4b6['query'][_0xcc98('0x3d')]+'%'};return _0x1fd93c;}})});}_0x4e7a2f=_[_0xcc98('0x40')]({},_0x4e7a2f,_0x57f4b6['options']);var _0x181016={'where':_0x4e7a2f[_0xcc98('0x3b')]};return db['IntegrationReport'][_0xcc98('0x1f')](_0x181016)['then'](function(_0x34a0d6){_0x47f471['count']=_0x34a0d6;if(_0x57f4b6[_0xcc98('0x30')]['includeAll']){_0x4e7a2f[_0xcc98('0x41')]=[{'all':!![]}];}return db[_0xcc98('0x2b')][_0xcc98('0x42')](_0x4e7a2f);})[_0xcc98('0x25')](function(_0x21f9d6){_0x47f471[_0xcc98('0x43')]=_0x21f9d6;return _0x47f471;})['then'](respondWithFilteredResult(_0x2fe03d,_0x4e7a2f))['catch'](handleError(_0x2fe03d,null));};exports[_0xcc98('0x44')]=function(_0x42fa3f,_0x12b66c){var _0x4f7e7d={'raw':![],'where':{'id':_0x42fa3f['params']['id']}},_0x485dd6={};_0x485dd6[_0xcc98('0x2f')]=_['keys'](db[_0xcc98('0x2b')]['rawAttributes']);_0x485dd6['query']=_['keys'](_0x42fa3f[_0xcc98('0x30')]);_0x485dd6[_0xcc98('0x32')]=_[_0xcc98('0x33')](_0x485dd6['model'],_0x485dd6[_0xcc98('0x30')]);_0x4f7e7d[_0xcc98('0x34')]=_[_0xcc98('0x33')](_0x485dd6[_0xcc98('0x2f')],qs[_0xcc98('0x35')](_0x42fa3f['query'][_0xcc98('0x35')]));_0x4f7e7d[_0xcc98('0x34')]=_0x4f7e7d[_0xcc98('0x34')]['length']?_0x4f7e7d[_0xcc98('0x34')]:_0x485dd6[_0xcc98('0x2f')];if(_0x42fa3f['query'][_0xcc98('0x45')]){_0x4f7e7d[_0xcc98('0x41')]=[{'all':!![]}];}_0x4f7e7d=_[_0xcc98('0x40')]({},_0x4f7e7d,_0x42fa3f['options']);return db['IntegrationReport'][_0xcc98('0x46')](_0x4f7e7d)['then'](handleEntityNotFound(_0x12b66c,null))[_0xcc98('0x25')](respondWithResult(_0x12b66c,null))['catch'](handleError(_0x12b66c,null));};exports[_0xcc98('0x47')]=function(_0x49e225,_0x2eb74c){return db[_0xcc98('0x2b')][_0xcc98('0x47')](_0x49e225[_0xcc98('0x48')],{})['then'](respondWithResult(_0x2eb74c,0xc9))[_0xcc98('0x49')](handleError(_0x2eb74c,null));};exports[_0xcc98('0x24')]=function(_0x305318,_0x4061ab){if(_0x305318[_0xcc98('0x48')]['id']){delete _0x305318[_0xcc98('0x48')]['id'];}return db[_0xcc98('0x2b')][_0xcc98('0x46')]({'where':{'id':_0x305318[_0xcc98('0x4a')]['id']}})['then'](handleEntityNotFound(_0x4061ab,null))[_0xcc98('0x25')](saveUpdates(_0x305318[_0xcc98('0x48')],null))[_0xcc98('0x25')](respondWithResult(_0x4061ab,null))[_0xcc98('0x49')](handleError(_0x4061ab,null));};exports[_0xcc98('0x26')]=function(_0x1c427e,_0xac275d){return db[_0xcc98('0x2b')][_0xcc98('0x46')]({'where':{'id':_0x1c427e[_0xcc98('0x4a')]['id']}})[_0xcc98('0x25')](handleEntityNotFound(_0xac275d,null))[_0xcc98('0x25')](removeEntity(_0xac275d,null))[_0xcc98('0x49')](handleError(_0xac275d,null));};exports[_0xcc98('0x4b')]=function(_0x15ef7f,_0x154806){return db['IntegrationReport'][_0xcc98('0x4b')]()[_0xcc98('0x25')](respondWithResult(_0x154806,null))['catch'](handleError(_0x154806,null));}; \ No newline at end of file diff --git a/server/api/integrationReport/integrationReport.model.js b/server/api/integrationReport/integrationReport.model.js index 2b2d2b7..fbc84bf 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 _0x0f0c=['report_integration','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./integrationReport.attributes','exports','define','IntegrationReport'];(function(_0x2765b3,_0x3201d7){var _0x2aeff1=function(_0x3e4821){while(--_0x3e4821){_0x2765b3['push'](_0x2765b3['shift']());}};_0x2aeff1(++_0x3201d7);}(_0x0f0c,0xfd));var _0xc0f0=function(_0x40800c,_0x3a3f45){_0x40800c=_0x40800c-0x0;var _0x3761f7=_0x0f0c[_0x40800c];return _0x3761f7;};'use strict';var _=require('lodash');var util=require(_0xc0f0('0x0'));var logger=require(_0xc0f0('0x1'))(_0xc0f0('0x2'));var moment=require('moment');var BPromise=require(_0xc0f0('0x3'));var rp=require(_0xc0f0('0x4'));var fs=require('fs');var path=require(_0xc0f0('0x5'));var rimraf=require('rimraf');var config=require(_0xc0f0('0x6'));var attributes=require(_0xc0f0('0x7'));module[_0xc0f0('0x8')]=function(_0x4e3312,_0x1688f2){return _0x4e3312[_0xc0f0('0x9')](_0xc0f0('0xa'),attributes,{'tableName':_0xc0f0('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7528=['moment','path','../../config/environment','./integrationReport.attributes','define','IntegrationReport','lodash','util','api'];(function(_0x29bcaa,_0x56cfd0){var _0xe47a26=function(_0xe3f71){while(--_0xe3f71){_0x29bcaa['push'](_0x29bcaa['shift']());}};_0xe47a26(++_0x56cfd0);}(_0x7528,0x1da));var _0x8752=function(_0x1e34bd,_0xb92883){_0x1e34bd=_0x1e34bd-0x0;var _0x525561=_0x7528[_0x1e34bd];return _0x525561;};'use strict';var _=require(_0x8752('0x0'));var util=require(_0x8752('0x1'));var logger=require('../../config/logger')(_0x8752('0x2'));var moment=require(_0x8752('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x8752('0x4'));var rimraf=require('rimraf');var config=require(_0x8752('0x5'));var attributes=require(_0x8752('0x6'));module['exports']=function(_0x360d00,_0x207595){return _0x360d00[_0x8752('0x7')](_0x8752('0x8'),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 edd51b3..c01520a 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 _0x7a54=['info','IntegrationReport,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x7a54,0x106));var _0x47a5=function(_0x293a4f,_0x33d161){_0x293a4f=_0x293a4f-0x0;var _0x3cd177=_0x7a54[_0x293a4f];return _0x3cd177;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('IntegrationReport,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file +var _0xadb5=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','IntegrationReport,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x431ae1,_0x385f06){var _0x27fcbd=function(_0x16e71f){while(--_0x16e71f){_0x431ae1['push'](_0x431ae1['shift']());}};_0x27fcbd(++_0x385f06);}(_0xadb5,0xad));var _0x5adb=function(_0x532483,_0x527289){_0x532483=_0x532483-0x0;var _0x2f0d89=_0xadb5[_0x532483];return _0x2f0d89;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3213e8,_0xdf3776,_0x353885){return new BPromise(function(_0x47228a,_0x6d1b45){return client[_0x5adb('0xa')](_0x3213e8,_0x353885)[_0x5adb('0xb')](function(_0x34f59d){logger[_0x5adb('0xc')](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));logger['debug']('IntegrationReport,\x20%s,\x20%s,\x20%s',_0xdf3776,_0x5adb('0xe'),JSON[_0x5adb('0xf')](_0x34f59d));if(_0x34f59d[_0x5adb('0x10')]){if(_0x34f59d['error'][_0x5adb('0x11')]===0x1f4){logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d['error'][_0x5adb('0x12')]);return _0x6d1b45(_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);}logger['error'](_0x5adb('0xd'),_0xdf3776,_0x34f59d[_0x5adb('0x10')][_0x5adb('0x12')]);return _0x47228a(_0x34f59d['error'][_0x5adb('0x12')]);}else{logger['info'](_0x5adb('0xd'),_0xdf3776,_0x5adb('0xe'));_0x47228a(_0x34f59d[_0x5adb('0x13')][_0x5adb('0x12')]);}})[_0x5adb('0x14')](function(_0x39d24d){logger[_0x5adb('0x10')](_0x5adb('0xd'),_0xdf3776,_0x39d24d);_0x6d1b45(_0x39d24d);});});} \ No newline at end of file diff --git a/server/api/interval/index.js b/server/api/interval/index.js index 674841e..765dac0 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 _0x15ff=['isAuthenticated','get','/:id','show','/:id/sub_intervals','getIntervals','create','addInterval','post','/:id/sub_intervals/create_many','addIntervals','put','update','delete','destroy','exports','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./interval.controller'];(function(_0x16b9ed,_0x56517a){var _0x66b1f8=function(_0x1c883){while(--_0x1c883){_0x16b9ed['push'](_0x16b9ed['shift']());}};_0x66b1f8(++_0x56517a);}(_0x15ff,0x74));var _0xf15f=function(_0x4ba4c1,_0x59f6a9){_0x4ba4c1=_0x4ba4c1-0x0;var _0x5845c3=_0x15ff[_0x4ba4c1];return _0x5845c3;};'use strict';var multer=require(_0xf15f('0x0'));var util=require(_0xf15f('0x1'));var path=require('path');var timeout=require(_0xf15f('0x2'));var express=require('express');var router=express[_0xf15f('0x3')]();var fs_extra=require(_0xf15f('0x4'));var auth=require(_0xf15f('0x5'));var interaction=require(_0xf15f('0x6'));var config=require(_0xf15f('0x7'));var controller=require(_0xf15f('0x8'));router['get']('/',auth[_0xf15f('0x9')](),controller['index']);router[_0xf15f('0xa')](_0xf15f('0xb'),auth[_0xf15f('0x9')](),controller[_0xf15f('0xc')]);router['get'](_0xf15f('0xd'),auth[_0xf15f('0x9')](),controller[_0xf15f('0xe')]);router['post']('/',auth[_0xf15f('0x9')](),controller[_0xf15f('0xf')]);router['post'](_0xf15f('0xd'),auth[_0xf15f('0x9')](),controller[_0xf15f('0x10')]);router[_0xf15f('0x11')](_0xf15f('0x12'),auth[_0xf15f('0x9')](),controller[_0xf15f('0x13')]);router[_0xf15f('0x14')](_0xf15f('0xb'),auth[_0xf15f('0x9')](),controller[_0xf15f('0x15')]);router[_0xf15f('0x16')](_0xf15f('0xb'),auth[_0xf15f('0x9')](),controller[_0xf15f('0x17')]);module[_0xf15f('0x18')]=router; \ No newline at end of file +var _0x0967=['delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/:id','show','getIntervals','post','/:id/sub_intervals','addInterval','addIntervals','update'];(function(_0x2609e5,_0x481e1e){var _0x12ad6d=function(_0x5b65c2){while(--_0x5b65c2){_0x2609e5['push'](_0x2609e5['shift']());}};_0x12ad6d(++_0x481e1e);}(_0x0967,0x100));var _0x7096=function(_0x505a36,_0x305902){_0x505a36=_0x505a36-0x0;var _0x4caefc=_0x0967[_0x505a36];return _0x4caefc;};'use strict';var multer=require(_0x7096('0x0'));var util=require('util');var path=require(_0x7096('0x1'));var timeout=require(_0x7096('0x2'));var express=require(_0x7096('0x3'));var router=express[_0x7096('0x4')]();var fs_extra=require(_0x7096('0x5'));var auth=require(_0x7096('0x6'));var interaction=require(_0x7096('0x7'));var config=require(_0x7096('0x8'));var controller=require('./interval.controller');router[_0x7096('0x9')]('/',auth[_0x7096('0xa')](),controller[_0x7096('0xb')]);router[_0x7096('0x9')](_0x7096('0xc'),auth[_0x7096('0xa')](),controller[_0x7096('0xd')]);router[_0x7096('0x9')]('/:id/sub_intervals',auth['isAuthenticated'](),controller[_0x7096('0xe')]);router[_0x7096('0xf')]('/',auth[_0x7096('0xa')](),controller['create']);router['post'](_0x7096('0x10'),auth[_0x7096('0xa')](),controller[_0x7096('0x11')]);router['post']('/:id/sub_intervals/create_many',auth[_0x7096('0xa')](),controller[_0x7096('0x12')]);router['put'](_0x7096('0xc'),auth['isAuthenticated'](),controller[_0x7096('0x13')]);router[_0x7096('0x14')]('/:id',auth[_0x7096('0xa')](),controller[_0x7096('0x15')]);module[_0x7096('0x16')]=router; \ No newline at end of file diff --git a/server/api/interval/interval.attributes.js b/server/api/interval/interval.attributes.js index d391dec..9310333 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 _0xae8c=['sequelize','exports','STRING'];(function(_0x1844f1,_0x14d2bd){var _0x59f3c3=function(_0x4ef922){while(--_0x4ef922){_0x1844f1['push'](_0x1844f1['shift']());}};_0x59f3c3(++_0x14d2bd);}(_0xae8c,0x8d));var _0xcae8=function(_0x3f0a0d,_0x2ed710){_0x3f0a0d=_0x3f0a0d-0x0;var _0x2fd911=_0xae8c[_0x3f0a0d];return _0x2fd911;};'use strict';var Sequelize=require(_0xcae8('0x0'));module[_0xcae8('0x1')]={'name':{'type':Sequelize[_0xcae8('0x2')]},'description':{'type':Sequelize[_0xcae8('0x2')]},'interval':{'type':Sequelize[_0xcae8('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x0536=['STRING','exports'];(function(_0x2668e1,_0x8d2cc0){var _0x45ceb0=function(_0x3f3659){while(--_0x3f3659){_0x2668e1['push'](_0x2668e1['shift']());}};_0x45ceb0(++_0x8d2cc0);}(_0x0536,0x6b));var _0x6053=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x0536[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require('sequelize');module[_0x6053('0x0')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x6053('0x1')]},'interval':{'type':Sequelize[_0x6053('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/interval/interval.controller.js b/server/api/interval/interval.controller.js index d77a953..7e27a3a 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 _0x6b77=['reject','save','update','then','destroy','get','Intervals','UserProfileResource','stack','name','send','index','map','Interval','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','include','rows','catch','params','includeAll','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','addInterval','getIntervals','addIntervals','findOne','sequelize','transaction','bulkCreate','findAll','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply'];(function(_0x543b96,_0x54b356){var _0x144eb6=function(_0x3a2e80){while(--_0x3a2e80){_0x543b96['push'](_0x543b96['shift']());}};_0x144eb6(++_0x54b356);}(_0x6b77,0x152));var _0x76b7=function(_0x5f1c4b,_0x57c084){_0x5f1c4b=_0x5f1c4b-0x0;var _0x19ddda=_0x6b77[_0x5f1c4b];return _0x19ddda;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76b7('0x0'));var zipdir=require(_0x76b7('0x1'));var jsonpatch=require(_0x76b7('0x2'));var rp=require(_0x76b7('0x3'));var moment=require(_0x76b7('0x4'));var BPromise=require(_0x76b7('0x5'));var Mustache=require(_0x76b7('0x6'));var util=require(_0x76b7('0x7'));var path=require('path');var sox=require(_0x76b7('0x8'));var csv=require('to-csv');var ejs=require(_0x76b7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x76b7('0xa'));var squel=require(_0x76b7('0xb'));var crypto=require(_0x76b7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x76b7('0xd'));var toCsv=require(_0x76b7('0xe'));var querystring=require('querystring');var Papa=require(_0x76b7('0xf'));var Redis=require(_0x76b7('0x10'));var authService=require(_0x76b7('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0x76b7('0x12'));var hardwareService=require(_0x76b7('0x13'));var logger=require(_0x76b7('0x14'))(_0x76b7('0x15'));var utils=require(_0x76b7('0x16'));var config=require(_0x76b7('0x17'));var licenseUtil=require(_0x76b7('0x18'));var db=require(_0x76b7('0x19'))['db'];var extensions=require(_0x76b7('0x1a'));function respondWithStatusCode(_0x1e55f7,_0x6a57ac){_0x6a57ac=_0x6a57ac||0xcc;return function(_0x5a1e71){if(_0x5a1e71){return _0x1e55f7[_0x76b7('0x1b')](_0x6a57ac);}return _0x1e55f7[_0x76b7('0x1c')](_0x6a57ac)[_0x76b7('0x1d')]();};}function respondWithResult(_0x5350e3,_0x5ceaf6){_0x5ceaf6=_0x5ceaf6||0xc8;return function(_0x29350d){if(_0x29350d){return _0x5350e3[_0x76b7('0x1c')](_0x5ceaf6)['json'](_0x29350d);}};}function respondWithFilteredResult(_0x325bed,_0x150f83){return function(_0x5614e2){if(_0x5614e2){var _0x289e8a=typeof _0x150f83[_0x76b7('0x1e')]===_0x76b7('0x1f')&&typeof _0x150f83[_0x76b7('0x20')]===_0x76b7('0x1f');var _0x4e9ec2=_0x5614e2[_0x76b7('0x21')];var _0x5ecfd1=_0x289e8a?0x0:_0x150f83['offset'];var _0x134076=_0x289e8a?_0x5614e2[_0x76b7('0x21')]:_0x150f83[_0x76b7('0x1e')]+_0x150f83[_0x76b7('0x20')];var _0x371836;if(_0x134076>=_0x4e9ec2){_0x134076=_0x4e9ec2;_0x371836=0xc8;}else{_0x371836=0xce;}_0x325bed[_0x76b7('0x1c')](_0x371836);return _0x325bed[_0x76b7('0x22')](_0x76b7('0x23'),_0x5ecfd1+'-'+_0x134076+'/'+_0x4e9ec2)[_0x76b7('0x24')](_0x5614e2);}return null;};}function patchUpdates(_0x470107){return function(_0x5ebc9c){try{jsonpatch[_0x76b7('0x25')](_0x5ebc9c,_0x470107,!![]);}catch(_0x174ab2){return BPromise[_0x76b7('0x26')](_0x174ab2);}return _0x5ebc9c[_0x76b7('0x27')]();};}function saveUpdates(_0x567f58,_0x19beb7){return function(_0x557491){if(_0x557491){return _0x557491[_0x76b7('0x28')](_0x567f58)[_0x76b7('0x29')](function(_0x495e46){return _0x495e46;});}return null;};}function removeEntity(_0x5b7cb7,_0x24b5fd){return function(_0x586f9c){if(_0x586f9c){return _0x586f9c[_0x76b7('0x2a')]()[_0x76b7('0x29')](function(){var _0x34dbd5=_0x586f9c[_0x76b7('0x2b')]({'plain':!![]});var _0x21a303=_0x76b7('0x2c');return db[_0x76b7('0x2d')][_0x76b7('0x2a')]({'where':{'type':_0x21a303,'resourceId':_0x34dbd5['id']}})[_0x76b7('0x29')](function(){return _0x586f9c;});})[_0x76b7('0x29')](function(){_0x5b7cb7[_0x76b7('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x293f73,_0x4dbd47){return function(_0x579f9a){if(!_0x579f9a){_0x293f73[_0x76b7('0x1b')](0x194);}return _0x579f9a;};}function handleError(_0x2124d3,_0x138475){_0x138475=_0x138475||0x1f4;return function(_0x5dcf3d){logger['error'](_0x5dcf3d[_0x76b7('0x2e')]);if(_0x5dcf3d[_0x76b7('0x2f')]){delete _0x5dcf3d[_0x76b7('0x2f')];}_0x2124d3[_0x76b7('0x1c')](_0x138475)[_0x76b7('0x30')](_0x5dcf3d);};}exports[_0x76b7('0x31')]=function(_0x3386ab,_0x19a6a4){var _0x2650fc={},_0x1a195c={},_0x2975b4={'count':0x0,'rows':[]};var _0x145b32=_[_0x76b7('0x32')](db[_0x76b7('0x33')][_0x76b7('0x34')],function(_0x3c3dfc){return{'name':_0x3c3dfc[_0x76b7('0x35')],'type':_0x3c3dfc[_0x76b7('0x36')]['key']};});_0x1a195c[_0x76b7('0x37')]=_[_0x76b7('0x32')](_0x145b32,_0x76b7('0x2f'));_0x1a195c[_0x76b7('0x38')]=_[_0x76b7('0x39')](_0x3386ab['query']);_0x1a195c[_0x76b7('0x3a')]=_[_0x76b7('0x3b')](_0x1a195c[_0x76b7('0x37')],_0x1a195c[_0x76b7('0x38')]);_0x2650fc[_0x76b7('0x3c')]=_[_0x76b7('0x3b')](_0x1a195c[_0x76b7('0x37')],qs[_0x76b7('0x3d')](_0x3386ab['query'][_0x76b7('0x3d')]));_0x2650fc[_0x76b7('0x3c')]=_0x2650fc[_0x76b7('0x3c')][_0x76b7('0x3e')]?_0x2650fc[_0x76b7('0x3c')]:_0x1a195c[_0x76b7('0x37')];if(!_0x3386ab['query'][_0x76b7('0x3f')](_0x76b7('0x40'))){_0x2650fc[_0x76b7('0x20')]=qs['limit'](_0x3386ab[_0x76b7('0x38')][_0x76b7('0x20')]);_0x2650fc[_0x76b7('0x1e')]=qs['offset'](_0x3386ab['query'][_0x76b7('0x1e')]);}_0x2650fc[_0x76b7('0x41')]=qs['sort'](_0x3386ab[_0x76b7('0x38')][_0x76b7('0x42')]);_0x2650fc[_0x76b7('0x43')]=qs['filters'](_[_0x76b7('0x44')](_0x3386ab['query'],_0x1a195c[_0x76b7('0x3a')]),_0x145b32);if(_0x3386ab[_0x76b7('0x38')][_0x76b7('0x45')]){_0x2650fc[_0x76b7('0x43')]=_['merge'](_0x2650fc[_0x76b7('0x43')],{'$or':_[_0x76b7('0x32')](_0x145b32,function(_0x2d8c92){if(_0x2d8c92[_0x76b7('0x36')]!==_0x76b7('0x46')){var _0x5d9e5d={};_0x5d9e5d[_0x2d8c92[_0x76b7('0x2f')]]={'$like':'%'+_0x3386ab[_0x76b7('0x38')]['filter']+'%'};return _0x5d9e5d;}})});}_0x2650fc=_[_0x76b7('0x47')]({},_0x2650fc,_0x3386ab[_0x76b7('0x48')]);var _0x217255={'where':_0x2650fc['where']};return db[_0x76b7('0x33')][_0x76b7('0x21')](_0x217255)[_0x76b7('0x29')](function(_0x9db0a9){_0x2975b4[_0x76b7('0x21')]=_0x9db0a9;if(_0x3386ab[_0x76b7('0x38')]['includeAll']){_0x2650fc[_0x76b7('0x49')]=[{'all':!![]}];}return db[_0x76b7('0x33')]['findAll'](_0x2650fc);})[_0x76b7('0x29')](function(_0x2482bb){_0x2975b4[_0x76b7('0x4a')]=_0x2482bb;return _0x2975b4;})['then'](respondWithFilteredResult(_0x19a6a4,_0x2650fc))[_0x76b7('0x4b')](handleError(_0x19a6a4,null));};exports['show']=function(_0x1b75b5,_0x4fc6f0){var _0x5dc966={'raw':!![],'where':{'id':_0x1b75b5[_0x76b7('0x4c')]['id']}},_0x29ac10={};_0x29ac10[_0x76b7('0x37')]=_[_0x76b7('0x39')](db[_0x76b7('0x33')][_0x76b7('0x34')]);_0x29ac10[_0x76b7('0x38')]=_[_0x76b7('0x39')](_0x1b75b5[_0x76b7('0x38')]);_0x29ac10['filters']=_[_0x76b7('0x3b')](_0x29ac10[_0x76b7('0x37')],_0x29ac10[_0x76b7('0x38')]);_0x5dc966[_0x76b7('0x3c')]=_[_0x76b7('0x3b')](_0x29ac10[_0x76b7('0x37')],qs[_0x76b7('0x3d')](_0x1b75b5['query'][_0x76b7('0x3d')]));_0x5dc966[_0x76b7('0x3c')]=_0x5dc966['attributes']['length']?_0x5dc966[_0x76b7('0x3c')]:_0x29ac10[_0x76b7('0x37')];if(_0x1b75b5[_0x76b7('0x38')][_0x76b7('0x4d')]){_0x5dc966[_0x76b7('0x49')]=[{'all':!![]}];}_0x5dc966=_[_0x76b7('0x47')]({},_0x5dc966,_0x1b75b5['options']);return db['Interval'][_0x76b7('0x4e')](_0x5dc966)[_0x76b7('0x29')](handleEntityNotFound(_0x4fc6f0,null))['then'](respondWithResult(_0x4fc6f0,null))[_0x76b7('0x4b')](handleError(_0x4fc6f0,null));};exports[_0x76b7('0x4f')]=function(_0x9e0fbe,_0x1f0d14){return db[_0x76b7('0x33')][_0x76b7('0x4f')](_0x9e0fbe[_0x76b7('0x50')],{})[_0x76b7('0x29')](function(_0x2aa76d){var _0x480854=_0x9e0fbe['user'][_0x76b7('0x2b')]({'plain':!![]});if(!_0x480854)throw new Error(_0x76b7('0x51'));if(_0x480854[_0x76b7('0x52')]==='user'){var _0x5188f8=_0x2aa76d['get']({'plain':!![]});var _0x4ad59d='Intervals';return db['UserProfileSection']['find']({'where':{'name':_0x4ad59d,'userProfileId':_0x480854['userProfileId']},'raw':!![]})[_0x76b7('0x29')](function(_0x19f66b){if(_0x19f66b&&_0x19f66b[_0x76b7('0x53')]===0x0){return db[_0x76b7('0x2d')][_0x76b7('0x4f')]({'name':_0x5188f8[_0x76b7('0x2f')],'resourceId':_0x5188f8['id'],'type':_0x19f66b[_0x76b7('0x2f')],'sectionId':_0x19f66b['id']},{})[_0x76b7('0x29')](function(){return _0x2aa76d;});}else{return _0x2aa76d;}})[_0x76b7('0x4b')](function(_0x12eb51){logger[_0x76b7('0x54')](_0x76b7('0x55'),_0x12eb51);throw _0x12eb51;});}return _0x2aa76d;})['then'](respondWithResult(_0x1f0d14,0xc9))[_0x76b7('0x4b')](handleError(_0x1f0d14,null));};exports[_0x76b7('0x28')]=function(_0x425e21,_0x231099){if(_0x425e21[_0x76b7('0x50')]['id']){delete _0x425e21[_0x76b7('0x50')]['id'];}return db[_0x76b7('0x33')][_0x76b7('0x4e')]({'where':{'id':_0x425e21[_0x76b7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x231099,null))[_0x76b7('0x29')](saveUpdates(_0x425e21['body'],null))['then'](respondWithResult(_0x231099,null))[_0x76b7('0x4b')](handleError(_0x231099,null));};exports[_0x76b7('0x2a')]=function(_0x91c6c,_0x53922b){return db[_0x76b7('0x33')][_0x76b7('0x4e')]({'where':{'id':_0x91c6c[_0x76b7('0x4c')]['id']}})[_0x76b7('0x29')](handleEntityNotFound(_0x53922b,null))[_0x76b7('0x29')](removeEntity(_0x53922b,null))[_0x76b7('0x4b')](handleError(_0x53922b,null));};exports[_0x76b7('0x56')]=function(_0x210edd,_0x5d23df,_0x2f1491){if(_0x210edd[_0x76b7('0x50')]['id']){delete _0x210edd[_0x76b7('0x50')]['id'];}return db[_0x76b7('0x33')][_0x76b7('0x4e')]({'where':{'id':_0x210edd[_0x76b7('0x4c')]['id']}})['then'](handleEntityNotFound(_0x5d23df,null))[_0x76b7('0x29')](function(_0x30fa26){if(_0x30fa26){_0x210edd[_0x76b7('0x50')]['IntervalId']=_0x30fa26['id'];return db['Interval'][_0x76b7('0x4f')](_0x210edd[_0x76b7('0x50')]);}})[_0x76b7('0x29')](respondWithResult(_0x5d23df,null))['catch'](handleError(_0x5d23df,null));};exports[_0x76b7('0x57')]=function(_0x368443,_0x1c4d5e,_0x23c1a1){var _0x159349={};var _0x239228={};var _0x59dfd3;var _0xf09e28;return db[_0x76b7('0x33')]['findOne']({'where':{'id':_0x368443[_0x76b7('0x4c')]['id']}})[_0x76b7('0x29')](handleEntityNotFound(_0x1c4d5e,null))[_0x76b7('0x29')](function(_0x1d96b7){if(_0x1d96b7){_0x59dfd3=_0x1d96b7;_0x239228[_0x76b7('0x37')]=_[_0x76b7('0x39')](db[_0x76b7('0x33')][_0x76b7('0x34')]);_0x239228[_0x76b7('0x38')]=_[_0x76b7('0x39')](_0x368443['query']);_0x239228[_0x76b7('0x3a')]=_[_0x76b7('0x3b')](_0x239228['model'],_0x239228[_0x76b7('0x38')]);_0x159349[_0x76b7('0x3c')]=_['intersection'](_0x239228['model'],qs[_0x76b7('0x3d')](_0x368443['query'][_0x76b7('0x3d')]));_0x159349['attributes']=_0x159349[_0x76b7('0x3c')][_0x76b7('0x3e')]?_0x159349['attributes']:_0x239228[_0x76b7('0x37')];_0x159349[_0x76b7('0x41')]=qs[_0x76b7('0x42')](_0x368443[_0x76b7('0x38')][_0x76b7('0x42')]);_0x159349['where']=qs[_0x76b7('0x3a')](_[_0x76b7('0x44')](_0x368443[_0x76b7('0x38')],_0x239228['filters']));if(_0x368443[_0x76b7('0x38')][_0x76b7('0x45')]){_0x159349['where']=_[_0x76b7('0x47')](_0x159349[_0x76b7('0x43')],{'$or':_[_0x76b7('0x32')](_0x159349[_0x76b7('0x3c')],function(_0x5e60fe){var _0xf94420={};_0xf94420[_0x5e60fe]={'$like':'%'+_0x368443[_0x76b7('0x38')][_0x76b7('0x45')]+'%'};return _0xf94420;})});}_0x159349=_['merge']({},_0x159349,_0x368443['options']);return _0x59dfd3['getIntervals'](_0x159349);}})[_0x76b7('0x29')](function(_0x1b67fa){if(_0x1b67fa){_0xf09e28=_0x1b67fa['length'];if(!_0x368443[_0x76b7('0x38')][_0x76b7('0x3f')](_0x76b7('0x40'))){_0x159349[_0x76b7('0x20')]=qs[_0x76b7('0x20')](_0x368443['query'][_0x76b7('0x20')]);_0x159349[_0x76b7('0x1e')]=qs[_0x76b7('0x1e')](_0x368443[_0x76b7('0x38')][_0x76b7('0x1e')]);}return _0x59dfd3[_0x76b7('0x57')](_0x159349);}})[_0x76b7('0x29')](function(_0x36e860){if(_0x36e860){return _0x36e860?{'count':_0xf09e28,'rows':_0x36e860}:null;}})[_0x76b7('0x29')](respondWithResult(_0x1c4d5e,null))[_0x76b7('0x4b')](handleError(_0x1c4d5e,null));};exports[_0x76b7('0x58')]=function(_0x188ef6,_0x5578a4,_0x25cd48){return db[_0x76b7('0x33')][_0x76b7('0x59')]({'where':{'id':_0x188ef6['params']['id']}})[_0x76b7('0x29')](handleEntityNotFound(_0x5578a4,null))[_0x76b7('0x29')](function(_0x1dd8e8){if(_0x1dd8e8){return db[_0x76b7('0x5a')][_0x76b7('0x5b')](function(_0x22f187){return db['Interval'][_0x76b7('0x2a')]({'where':{'IntervalId':_0x188ef6[_0x76b7('0x4c')]['id']},'transaction':_0x22f187})[_0x76b7('0x29')](function(_0x2c9b49){var _0x40a042=_[_0x76b7('0x32')](_0x188ef6['body'],function(_0x51c364){delete _0x51c364['id'];_0x51c364['IntervalId']=_0x188ef6[_0x76b7('0x4c')]['id'];return _0x51c364;});return db['Interval'][_0x76b7('0x5c')](_0x40a042,{'transaction':_0x22f187});});})['then'](function(){return db[_0x76b7('0x33')][_0x76b7('0x5d')]({'where':{'IntervalId':_0x188ef6[_0x76b7('0x4c')]['id']}});});}})[_0x76b7('0x29')](respondWithResult(_0x5578a4,null))[_0x76b7('0x4b')](handleError(_0x5578a4,null));}; \ No newline at end of file +var _0xd73a=['update','IntervalId','options','hasOwnProperty','getIntervals','addIntervals','findOne','sequelize','transaction','bulkCreate','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','../../components/extensions/rewrite','status','undefined','count','offset','limit','set','Content-Range','json','reject','save','destroy','then','get','Intervals','UserProfileResource','end','sendStatus','error','name','send','index','map','Interval','rawAttributes','fieldName','type','model','query','keys','filters','attributes','intersection','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','rows','catch','params','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xd73a,0xc4));var _0xad73=function(_0x16e824,_0x23ab90){_0x16e824=_0x16e824-0x0;var _0x1745ea=_0xd73a[_0x16e824];return _0x1745ea;};'use strict';var emlformat=require(_0xad73('0x0'));var rimraf=require(_0xad73('0x1'));var zipdir=require(_0xad73('0x2'));var jsonpatch=require(_0xad73('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xad73('0x4'));var Mustache=require(_0xad73('0x5'));var util=require(_0xad73('0x6'));var path=require(_0xad73('0x7'));var sox=require(_0xad73('0x8'));var csv=require(_0xad73('0x9'));var ejs=require(_0xad73('0xa'));var fs=require('fs');var fs_extra=require(_0xad73('0xb'));var _=require(_0xad73('0xc'));var squel=require(_0xad73('0xd'));var crypto=require(_0xad73('0xe'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xad73('0x9'));var querystring=require(_0xad73('0xf'));var Papa=require(_0xad73('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xad73('0x11'));var as=require(_0xad73('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xad73('0x13'))(_0xad73('0x14'));var utils=require(_0xad73('0x15'));var config=require(_0xad73('0x16'));var licenseUtil=require(_0xad73('0x17'));var db=require(_0xad73('0x18'))['db'];var extensions=require(_0xad73('0x19'));function respondWithStatusCode(_0x1a05e9,_0x2b0e6b){_0x2b0e6b=_0x2b0e6b||0xcc;return function(_0x23062a){if(_0x23062a){return _0x1a05e9['sendStatus'](_0x2b0e6b);}return _0x1a05e9['status'](_0x2b0e6b)['end']();};}function respondWithResult(_0x319cce,_0x3956d8){_0x3956d8=_0x3956d8||0xc8;return function(_0x1e2190){if(_0x1e2190){return _0x319cce[_0xad73('0x1a')](_0x3956d8)['json'](_0x1e2190);}};}function respondWithFilteredResult(_0x51a82f,_0x3ce578){return function(_0x27cbe3){if(_0x27cbe3){var _0x58deda=typeof _0x3ce578['offset']===_0xad73('0x1b')&&typeof _0x3ce578['limit']===_0xad73('0x1b');var _0x3db60f=_0x27cbe3[_0xad73('0x1c')];var _0xd23bc3=_0x58deda?0x0:_0x3ce578[_0xad73('0x1d')];var _0x2692cc=_0x58deda?_0x27cbe3[_0xad73('0x1c')]:_0x3ce578[_0xad73('0x1d')]+_0x3ce578[_0xad73('0x1e')];var _0x11dbe5;if(_0x2692cc>=_0x3db60f){_0x2692cc=_0x3db60f;_0x11dbe5=0xc8;}else{_0x11dbe5=0xce;}_0x51a82f['status'](_0x11dbe5);return _0x51a82f[_0xad73('0x1f')](_0xad73('0x20'),_0xd23bc3+'-'+_0x2692cc+'/'+_0x3db60f)[_0xad73('0x21')](_0x27cbe3);}return null;};}function patchUpdates(_0x2cdf32){return function(_0x19f8f2){try{jsonpatch['apply'](_0x19f8f2,_0x2cdf32,!![]);}catch(_0x223daa){return BPromise[_0xad73('0x22')](_0x223daa);}return _0x19f8f2[_0xad73('0x23')]();};}function saveUpdates(_0x2da6af,_0x2e9213){return function(_0x5ed98d){if(_0x5ed98d){return _0x5ed98d['update'](_0x2da6af)['then'](function(_0x520e55){return _0x520e55;});}return null;};}function removeEntity(_0x38959b,_0x520d9e){return function(_0x1500ff){if(_0x1500ff){return _0x1500ff[_0xad73('0x24')]()[_0xad73('0x25')](function(){var _0x1e6015=_0x1500ff[_0xad73('0x26')]({'plain':!![]});var _0x1d2136=_0xad73('0x27');return db[_0xad73('0x28')]['destroy']({'where':{'type':_0x1d2136,'resourceId':_0x1e6015['id']}})[_0xad73('0x25')](function(){return _0x1500ff;});})['then'](function(){_0x38959b[_0xad73('0x1a')](0xcc)[_0xad73('0x29')]();});}};}function handleEntityNotFound(_0x85186f,_0x18558c){return function(_0x2165b5){if(!_0x2165b5){_0x85186f[_0xad73('0x2a')](0x194);}return _0x2165b5;};}function handleError(_0x5ed07c,_0xbc466c){_0xbc466c=_0xbc466c||0x1f4;return function(_0x287bd8){logger[_0xad73('0x2b')](_0x287bd8['stack']);if(_0x287bd8[_0xad73('0x2c')]){delete _0x287bd8[_0xad73('0x2c')];}_0x5ed07c[_0xad73('0x1a')](_0xbc466c)[_0xad73('0x2d')](_0x287bd8);};}exports[_0xad73('0x2e')]=function(_0x4deaa6,_0x4605af){var _0x961700={},_0x4a93c2={},_0x277771={'count':0x0,'rows':[]};var _0xc49bcc=_[_0xad73('0x2f')](db[_0xad73('0x30')][_0xad73('0x31')],function(_0x17d2e8){return{'name':_0x17d2e8[_0xad73('0x32')],'type':_0x17d2e8[_0xad73('0x33')]['key']};});_0x4a93c2[_0xad73('0x34')]=_['map'](_0xc49bcc,_0xad73('0x2c'));_0x4a93c2[_0xad73('0x35')]=_[_0xad73('0x36')](_0x4deaa6[_0xad73('0x35')]);_0x4a93c2[_0xad73('0x37')]=_['intersection'](_0x4a93c2[_0xad73('0x34')],_0x4a93c2[_0xad73('0x35')]);_0x961700[_0xad73('0x38')]=_[_0xad73('0x39')](_0x4a93c2[_0xad73('0x34')],qs[_0xad73('0x3a')](_0x4deaa6['query'][_0xad73('0x3a')]));_0x961700[_0xad73('0x38')]=_0x961700[_0xad73('0x38')][_0xad73('0x3b')]?_0x961700['attributes']:_0x4a93c2[_0xad73('0x34')];if(!_0x4deaa6[_0xad73('0x35')]['hasOwnProperty'](_0xad73('0x3c'))){_0x961700[_0xad73('0x1e')]=qs[_0xad73('0x1e')](_0x4deaa6[_0xad73('0x35')][_0xad73('0x1e')]);_0x961700[_0xad73('0x1d')]=qs[_0xad73('0x1d')](_0x4deaa6[_0xad73('0x35')][_0xad73('0x1d')]);}_0x961700[_0xad73('0x3d')]=qs['sort'](_0x4deaa6[_0xad73('0x35')][_0xad73('0x3e')]);_0x961700[_0xad73('0x3f')]=qs[_0xad73('0x37')](_[_0xad73('0x40')](_0x4deaa6['query'],_0x4a93c2[_0xad73('0x37')]),_0xc49bcc);if(_0x4deaa6[_0xad73('0x35')][_0xad73('0x41')]){_0x961700['where']=_['merge'](_0x961700[_0xad73('0x3f')],{'$or':_[_0xad73('0x2f')](_0xc49bcc,function(_0x2e58b9){if(_0x2e58b9['type']!==_0xad73('0x42')){var _0x4571e2={};_0x4571e2[_0x2e58b9[_0xad73('0x2c')]]={'$like':'%'+_0x4deaa6[_0xad73('0x35')][_0xad73('0x41')]+'%'};return _0x4571e2;}})});}_0x961700=_[_0xad73('0x43')]({},_0x961700,_0x4deaa6['options']);var _0x396e4e={'where':_0x961700[_0xad73('0x3f')]};return db['Interval'][_0xad73('0x1c')](_0x396e4e)[_0xad73('0x25')](function(_0x637a95){_0x277771[_0xad73('0x1c')]=_0x637a95;if(_0x4deaa6[_0xad73('0x35')][_0xad73('0x44')]){_0x961700[_0xad73('0x45')]=[{'all':!![]}];}return db[_0xad73('0x30')][_0xad73('0x46')](_0x961700);})['then'](function(_0x127893){_0x277771[_0xad73('0x47')]=_0x127893;return _0x277771;})[_0xad73('0x25')](respondWithFilteredResult(_0x4605af,_0x961700))[_0xad73('0x48')](handleError(_0x4605af,null));};exports['show']=function(_0xf8d5b2,_0x4a5275){var _0x3ef59d={'raw':!![],'where':{'id':_0xf8d5b2[_0xad73('0x49')]['id']}},_0x4a1f53={};_0x4a1f53[_0xad73('0x34')]=_[_0xad73('0x36')](db[_0xad73('0x30')][_0xad73('0x31')]);_0x4a1f53[_0xad73('0x35')]=_['keys'](_0xf8d5b2[_0xad73('0x35')]);_0x4a1f53['filters']=_[_0xad73('0x39')](_0x4a1f53[_0xad73('0x34')],_0x4a1f53['query']);_0x3ef59d[_0xad73('0x38')]=_['intersection'](_0x4a1f53['model'],qs['fields'](_0xf8d5b2['query'][_0xad73('0x3a')]));_0x3ef59d[_0xad73('0x38')]=_0x3ef59d[_0xad73('0x38')]['length']?_0x3ef59d['attributes']:_0x4a1f53[_0xad73('0x34')];if(_0xf8d5b2[_0xad73('0x35')]['includeAll']){_0x3ef59d[_0xad73('0x45')]=[{'all':!![]}];}_0x3ef59d=_[_0xad73('0x43')]({},_0x3ef59d,_0xf8d5b2['options']);return db[_0xad73('0x30')]['find'](_0x3ef59d)[_0xad73('0x25')](handleEntityNotFound(_0x4a5275,null))[_0xad73('0x25')](respondWithResult(_0x4a5275,null))[_0xad73('0x48')](handleError(_0x4a5275,null));};exports[_0xad73('0x4a')]=function(_0x3d3c69,_0x150b87){return db[_0xad73('0x30')][_0xad73('0x4a')](_0x3d3c69[_0xad73('0x4b')],{})[_0xad73('0x25')](function(_0x567a7d){var _0x58a365=_0x3d3c69[_0xad73('0x4c')]['get']({'plain':!![]});if(!_0x58a365)throw new Error(_0xad73('0x4d'));if(_0x58a365[_0xad73('0x4e')]===_0xad73('0x4c')){var _0x3ba330=_0x567a7d[_0xad73('0x26')]({'plain':!![]});var _0x1f7f49='Intervals';return db[_0xad73('0x4f')][_0xad73('0x50')]({'where':{'name':_0x1f7f49,'userProfileId':_0x58a365[_0xad73('0x51')]},'raw':!![]})[_0xad73('0x25')](function(_0x493a80){if(_0x493a80&&_0x493a80['autoAssociation']===0x0){return db[_0xad73('0x28')][_0xad73('0x4a')]({'name':_0x3ba330[_0xad73('0x2c')],'resourceId':_0x3ba330['id'],'type':_0x493a80[_0xad73('0x2c')],'sectionId':_0x493a80['id']},{})['then'](function(){return _0x567a7d;});}else{return _0x567a7d;}})[_0xad73('0x48')](function(_0x35815c){logger['error'](_0xad73('0x52'),_0x35815c);throw _0x35815c;});}return _0x567a7d;})['then'](respondWithResult(_0x150b87,0xc9))['catch'](handleError(_0x150b87,null));};exports[_0xad73('0x53')]=function(_0x121afc,_0x3ee86e){if(_0x121afc['body']['id']){delete _0x121afc[_0xad73('0x4b')]['id'];}return db[_0xad73('0x30')][_0xad73('0x50')]({'where':{'id':_0x121afc[_0xad73('0x49')]['id']}})[_0xad73('0x25')](handleEntityNotFound(_0x3ee86e,null))['then'](saveUpdates(_0x121afc['body'],null))[_0xad73('0x25')](respondWithResult(_0x3ee86e,null))[_0xad73('0x48')](handleError(_0x3ee86e,null));};exports[_0xad73('0x24')]=function(_0x3fdcb8,_0x58bd6e){return db[_0xad73('0x30')][_0xad73('0x50')]({'where':{'id':_0x3fdcb8[_0xad73('0x49')]['id']}})['then'](handleEntityNotFound(_0x58bd6e,null))['then'](removeEntity(_0x58bd6e,null))[_0xad73('0x48')](handleError(_0x58bd6e,null));};exports['addInterval']=function(_0x5af9fa,_0x1290b2,_0x22f76b){if(_0x5af9fa[_0xad73('0x4b')]['id']){delete _0x5af9fa[_0xad73('0x4b')]['id'];}return db[_0xad73('0x30')]['find']({'where':{'id':_0x5af9fa[_0xad73('0x49')]['id']}})['then'](handleEntityNotFound(_0x1290b2,null))[_0xad73('0x25')](function(_0x3f3194){if(_0x3f3194){_0x5af9fa['body'][_0xad73('0x54')]=_0x3f3194['id'];return db[_0xad73('0x30')][_0xad73('0x4a')](_0x5af9fa[_0xad73('0x4b')]);}})[_0xad73('0x25')](respondWithResult(_0x1290b2,null))[_0xad73('0x48')](handleError(_0x1290b2,null));};exports['getIntervals']=function(_0x337736,_0x25ec83,_0x2de4d2){var _0x55937f={};var _0x415f90={};var _0x24e672;var _0x3d6e9e;return db['Interval']['findOne']({'where':{'id':_0x337736[_0xad73('0x49')]['id']}})[_0xad73('0x25')](handleEntityNotFound(_0x25ec83,null))[_0xad73('0x25')](function(_0x20e499){if(_0x20e499){_0x24e672=_0x20e499;_0x415f90[_0xad73('0x34')]=_[_0xad73('0x36')](db[_0xad73('0x30')][_0xad73('0x31')]);_0x415f90[_0xad73('0x35')]=_[_0xad73('0x36')](_0x337736['query']);_0x415f90['filters']=_[_0xad73('0x39')](_0x415f90[_0xad73('0x34')],_0x415f90[_0xad73('0x35')]);_0x55937f[_0xad73('0x38')]=_[_0xad73('0x39')](_0x415f90[_0xad73('0x34')],qs['fields'](_0x337736['query'][_0xad73('0x3a')]));_0x55937f[_0xad73('0x38')]=_0x55937f[_0xad73('0x38')][_0xad73('0x3b')]?_0x55937f[_0xad73('0x38')]:_0x415f90['model'];_0x55937f['order']=qs[_0xad73('0x3e')](_0x337736[_0xad73('0x35')][_0xad73('0x3e')]);_0x55937f[_0xad73('0x3f')]=qs[_0xad73('0x37')](_['pick'](_0x337736[_0xad73('0x35')],_0x415f90[_0xad73('0x37')]));if(_0x337736['query'][_0xad73('0x41')]){_0x55937f[_0xad73('0x3f')]=_[_0xad73('0x43')](_0x55937f[_0xad73('0x3f')],{'$or':_['map'](_0x55937f[_0xad73('0x38')],function(_0x20adbc){var _0x183c77={};_0x183c77[_0x20adbc]={'$like':'%'+_0x337736[_0xad73('0x35')]['filter']+'%'};return _0x183c77;})});}_0x55937f=_['merge']({},_0x55937f,_0x337736[_0xad73('0x55')]);return _0x24e672['getIntervals'](_0x55937f);}})['then'](function(_0x24437e){if(_0x24437e){_0x3d6e9e=_0x24437e[_0xad73('0x3b')];if(!_0x337736[_0xad73('0x35')][_0xad73('0x56')](_0xad73('0x3c'))){_0x55937f['limit']=qs[_0xad73('0x1e')](_0x337736[_0xad73('0x35')][_0xad73('0x1e')]);_0x55937f['offset']=qs[_0xad73('0x1d')](_0x337736['query'][_0xad73('0x1d')]);}return _0x24e672[_0xad73('0x57')](_0x55937f);}})[_0xad73('0x25')](function(_0x3e7b2a){if(_0x3e7b2a){return _0x3e7b2a?{'count':_0x3d6e9e,'rows':_0x3e7b2a}:null;}})[_0xad73('0x25')](respondWithResult(_0x25ec83,null))[_0xad73('0x48')](handleError(_0x25ec83,null));};exports[_0xad73('0x58')]=function(_0x2e2857,_0x1886ff,_0x1baa74){return db[_0xad73('0x30')][_0xad73('0x59')]({'where':{'id':_0x2e2857[_0xad73('0x49')]['id']}})[_0xad73('0x25')](handleEntityNotFound(_0x1886ff,null))[_0xad73('0x25')](function(_0x202d77){if(_0x202d77){return db[_0xad73('0x5a')][_0xad73('0x5b')](function(_0x129eec){return db[_0xad73('0x30')][_0xad73('0x24')]({'where':{'IntervalId':_0x2e2857[_0xad73('0x49')]['id']},'transaction':_0x129eec})['then'](function(_0x506f7f){var _0x37bbde=_[_0xad73('0x2f')](_0x2e2857[_0xad73('0x4b')],function(_0x1de38d){delete _0x1de38d['id'];_0x1de38d['IntervalId']=_0x2e2857[_0xad73('0x49')]['id'];return _0x1de38d;});return db[_0xad73('0x30')][_0xad73('0x5c')](_0x37bbde,{'transaction':_0x129eec});});})[_0xad73('0x25')](function(){return db['Interval'][_0xad73('0x46')]({'where':{'IntervalId':_0x2e2857[_0xad73('0x49')]['id']}});});}})[_0xad73('0x25')](respondWithResult(_0x1886ff,null))[_0xad73('0x48')](handleError(_0x1886ff,null));}; \ No newline at end of file diff --git a/server/api/interval/interval.model.js b/server/api/interval/interval.model.js index 6cc6684..225242e 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 _0xfd6e=['./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','exports','define','Interval','tools_intervals','rewrite','string','interval','getIntervals','then','all','map','ifTime','reduce'];(function(_0x245503,_0x239a16){var _0x3e35f0=function(_0x53fff0){while(--_0x53fff0){_0x245503['push'](_0x245503['shift']());}};_0x3e35f0(++_0x239a16);}(_0xfd6e,0x90));var _0xefd6=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xfd6e[_0x3ab51d];return _0x29a04e;};'use strict';var attributes=require(_0xefd6('0x0'));var extensions=require(_0xefd6('0x1'));var iftime=require(_0xefd6('0x2'))['iftime'];module[_0xefd6('0x3')]=function(_0x524f05){return _0x524f05[_0xefd6('0x4')](_0xefd6('0x5'),attributes,{'tableName':_0xefd6('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x4dc0f1){extensions[_0xefd6('0x7')](_0x524f05,_0x4dc0f1);},'afterBulkCreate':function(_0x2a126e,_0x2f57b0,_0x3a7b72){_0x3a7b72();extensions['rewrite'](_0x524f05,_0x2a126e[0x0]);},'afterUpdate':function(_0x127076){extensions[_0xefd6('0x7')](_0x524f05,_0x127076);},'afterDestroy':function(_0x18a06d){extensions[_0xefd6('0x7')](_0x524f05,_0x18a06d);}},'instanceMethods':{'ifTime':function(_0x54b486=undefined,_0x1c054c=new Date()){if(typeof this['interval']===_0xefd6('0x8')){return iftime(this[_0xefd6('0x9')],_0x54b486,_0x1c054c);}else{return this[_0xefd6('0xa')]()[_0xefd6('0xb')](function(_0x231223){return Promise[_0xefd6('0xc')](_0x231223[_0xefd6('0xd')](function(_0x1ac718){return _0x1ac718[_0xefd6('0xe')](_0x54b486,_0x1c054c);}));})[_0xefd6('0xb')](function(_0x2d20e2){return _0x2d20e2[_0xefd6('0xf')](function(_0x341f67,_0x24b10b){return _0x341f67||_0x24b10b;},![]);});}}}});}; \ No newline at end of file +var _0xa046=['getIntervals','map','ifTime','then','reduce','./interval.attributes','../../components/extensions/rewrite','../../utils/iftime','iftime','exports','define','Interval','tools_intervals','rewrite','interval'];(function(_0x13a750,_0x16a1ba){var _0x5b064e=function(_0x5770a7){while(--_0x5770a7){_0x13a750['push'](_0x13a750['shift']());}};_0x5b064e(++_0x16a1ba);}(_0xa046,0x14f));var _0x6a04=function(_0x2145d1,_0x1d5965){_0x2145d1=_0x2145d1-0x0;var _0x13a3e3=_0xa046[_0x2145d1];return _0x13a3e3;};'use strict';var attributes=require(_0x6a04('0x0'));var extensions=require(_0x6a04('0x1'));var iftime=require(_0x6a04('0x2'))[_0x6a04('0x3')];module[_0x6a04('0x4')]=function(_0x40053a){return _0x40053a[_0x6a04('0x5')](_0x6a04('0x6'),attributes,{'tableName':_0x6a04('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x5cc8cd){extensions[_0x6a04('0x8')](_0x40053a,_0x5cc8cd);},'afterBulkCreate':function(_0x423707,_0x44409b,_0x2243ba){_0x2243ba();extensions[_0x6a04('0x8')](_0x40053a,_0x423707[0x0]);},'afterUpdate':function(_0x3247c8){extensions[_0x6a04('0x8')](_0x40053a,_0x3247c8);},'afterDestroy':function(_0x4852c1){extensions['rewrite'](_0x40053a,_0x4852c1);}},'instanceMethods':{'ifTime':function(_0x2d98ff=undefined,_0x19ad54=new Date()){if(typeof this['interval']==='string'){return iftime(this[_0x6a04('0x9')],_0x2d98ff,_0x19ad54);}else{return this[_0x6a04('0xa')]()['then'](function(_0xe5c2a1){return Promise['all'](_0xe5c2a1[_0x6a04('0xb')](function(_0xe401ab){return _0xe401ab[_0x6a04('0xc')](_0x2d98ff,_0x19ad54);}));})[_0x6a04('0xd')](function(_0x4417fe){return _0x4417fe[_0x6a04('0xe')](function(_0x1205b5,_0x1f185a){return _0x1205b5||_0x1f185a;},![]);});}}}});}; \ No newline at end of file diff --git a/server/api/interval/interval.rpc.js b/server/api/interval/interval.rpc.js index e90611c..6f93975 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 _0xab3c=['name','IntervalIftime','intervalIds','isArray','intervals','string','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','resolve','lodash','util','../../mysqldb','../../utils/iftime','iftime','../../config/logger','rpc','GetInterval','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','catch','message','error','Interval','find','info','ShowInterval','all','ifTime','reduce','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)','join','findById','format','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)'];(function(_0x16ae1b,_0x3261c0){var _0x4cc3f9=function(_0x673a9a){while(--_0x673a9a){_0x16ae1b['push'](_0x16ae1b['shift']());}};_0x4cc3f9(++_0x3261c0);}(_0xab3c,0x95));var _0xcab3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xab3c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xcab3('0x0'));var util=require(_0xcab3('0x1'));var db=require(_0xcab3('0x2'))['db'];var iftime=require(_0xcab3('0x3'))[_0xcab3('0x4')];var logger=require(_0xcab3('0x5'))(_0xcab3('0x6'));exports[_0xcab3('0x7')]=function(_0x26bbe9){var _0x3af0f1=this;return new Promise(function(_0x218a7b,_0x170b95){return db['Interval'][_0xcab3('0x8')]({'raw':_0x26bbe9[_0xcab3('0x9')]?_0x26bbe9[_0xcab3('0x9')][_0xcab3('0xa')]===undefined?!![]:![]:!![],'where':_0x26bbe9[_0xcab3('0x9')]?_0x26bbe9['options'][_0xcab3('0xb')]||null:null,'attributes':_0x26bbe9[_0xcab3('0x9')]?_0x26bbe9['options'][_0xcab3('0xc')]||null:null,'limit':_0x26bbe9['options']?_0x26bbe9[_0xcab3('0x9')][_0xcab3('0xd')]||null:null,'include':_0x26bbe9[_0xcab3('0x9')]?_0x26bbe9[_0xcab3('0x9')][_0xcab3('0xe')]?_[_0xcab3('0xf')](_0x26bbe9['options'][_0xcab3('0xe')],function(_0x62ef61){return{'model':db[_0x62ef61[_0xcab3('0x10')]],'as':_0x62ef61['as'],'attributes':_0x62ef61['attributes'],'include':_0x62ef61[_0xcab3('0xe')]?_['map'](_0x62ef61[_0xcab3('0xe')],function(_0x5a63e3){return{'model':db[_0x5a63e3['model']],'as':_0x5a63e3['as'],'attributes':_0x5a63e3[_0xcab3('0xc')],'include':_0x5a63e3['include']?_[_0xcab3('0xf')](_0x5a63e3[_0xcab3('0xe')],function(_0x3d604d){return{'model':db[_0x3d604d['model']],'as':_0x3d604d['as'],'attributes':_0x3d604d[_0xcab3('0xc')]};}):[]};}):[]};}):[]:[]})[_0xcab3('0x11')](function(_0x1f3049){logger['info']('GetInterval',_0x26bbe9);logger[_0xcab3('0x12')]('GetInterval',_0x26bbe9,JSON[_0xcab3('0x13')](_0x1f3049));_0x218a7b(_0x1f3049);})[_0xcab3('0x14')](function(_0x38c3d9){logger['error'](_0xcab3('0x7'),_0x38c3d9[_0xcab3('0x15')],_0x26bbe9);_0x170b95(_0x3af0f1[_0xcab3('0x16')](0x1f4,_0x38c3d9[_0xcab3('0x15')]));});});};exports['ShowInterval']=function(_0x36af37){var _0xfb9782=this;return new Promise(function(_0x4479ce,_0x2f0d89){return db[_0xcab3('0x17')][_0xcab3('0x18')]({'raw':_0x36af37['options']?_0x36af37[_0xcab3('0x9')]['raw']===undefined?!![]:![]:!![],'where':_0x36af37[_0xcab3('0x9')]?_0x36af37['options'][_0xcab3('0xb')]||null:null,'attributes':_0x36af37[_0xcab3('0x9')]?_0x36af37[_0xcab3('0x9')][_0xcab3('0xc')]||null:null,'include':_0x36af37[_0xcab3('0x9')]?_0x36af37[_0xcab3('0x9')][_0xcab3('0xe')]?_[_0xcab3('0xf')](_0x36af37[_0xcab3('0x9')][_0xcab3('0xe')],function(_0xbf21d4){return{'model':db[_0xbf21d4[_0xcab3('0x10')]],'as':_0xbf21d4['as'],'attributes':_0xbf21d4['attributes'],'include':_0xbf21d4[_0xcab3('0xe')]?_['map'](_0xbf21d4[_0xcab3('0xe')],function(_0xceb2df){return{'model':db[_0xceb2df['model']],'as':_0xceb2df['as'],'attributes':_0xceb2df[_0xcab3('0xc')],'include':_0xceb2df[_0xcab3('0xe')]?_[_0xcab3('0xf')](_0xceb2df[_0xcab3('0xe')],function(_0x18ac0c){return{'model':db[_0x18ac0c[_0xcab3('0x10')]],'as':_0x18ac0c['as'],'attributes':_0x18ac0c[_0xcab3('0xc')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x41c10d){logger[_0xcab3('0x19')](_0xcab3('0x1a'),_0x36af37);logger[_0xcab3('0x12')](_0xcab3('0x1a'),_0x36af37,JSON[_0xcab3('0x13')](_0x41c10d));_0x4479ce(_0x41c10d);})[_0xcab3('0x14')](function(_0x2c045b){logger[_0xcab3('0x16')](_0xcab3('0x1a'),_0x2c045b[_0xcab3('0x15')],_0x36af37);_0x2f0d89(_0xfb9782[_0xcab3('0x16')](0x1f4,_0x2c045b['message']));});});};function checkArrayOfIntervals(_0x3308ea,_0x240b0c){var _0x4cd7de=[];return db['Interval']['findAll']({'where':{'id':_0x3308ea}})[_0xcab3('0x11')](function(_0x291299){_0x4cd7de=_0x291299;return Promise[_0xcab3('0x1b')](_0x4cd7de[_0xcab3('0xf')](function(_0x5bcf4e){return _0x5bcf4e[_0xcab3('0x1c')](_0x240b0c);}));})['then'](function(_0x3946d6){var _0x5cf406=_0x3946d6[_0xcab3('0x1d')](function(_0x20a3fc,_0x53e9af){return _0x20a3fc||_0x53e9af;},![]);logger[_0xcab3('0x19')](util['format'](_0xcab3('0x1e'),_0x4cd7de[_0xcab3('0xf')](function(_0x5056f3){return _0x5056f3['name'];})[_0xcab3('0x1f')](',\x20'),_0x4cd7de['map'](function(_0x2b00c3){return _0x2b00c3['id'];})[_0xcab3('0x1f')](',\x20')));return _0x5cf406;});}function checkSingleInterval(_0x2bb0f6,_0x29d6ee){return db['Interval'][_0xcab3('0x20')](_0x2bb0f6)[_0xcab3('0x11')](function(_0x2af6fb){if(_0x2af6fb){logger[_0xcab3('0x19')](util[_0xcab3('0x21')](_0xcab3('0x22'),_0x2af6fb[_0xcab3('0x23')],_0x2af6fb['id']));return _0x2af6fb[_0xcab3('0x1c')](_0x29d6ee);}});}exports[_0xcab3('0x24')]=function(_0x542ef1){var _0x2c949c=_0x542ef1[_0xcab3('0x25')];var _0xe687aa=Array[_0xcab3('0x26')](_0x542ef1['intervals'])?_0x542ef1[_0xcab3('0x27')]:typeof _0x542ef1[_0xcab3('0x27')]===_0xcab3('0x28')?[_0x542ef1[_0xcab3('0x27')]]:[];var _0x394f1d=_0x542ef1['timezone']||undefined;var _0x1c1535=![];if(_0xe687aa[_0xcab3('0x29')]){logger[_0xcab3('0x19')](util[_0xcab3('0x21')](_0xcab3('0x2a'),_0xe687aa[_0xcab3('0x1f')](';\x20')));}if(_0x394f1d){logger[_0xcab3('0x19')](util[_0xcab3('0x21')](_0xcab3('0x2b'),_0x394f1d));}logger['debug']('Iftime',_0x1c1535);logger[_0xcab3('0x2c')](_0xcab3('0x24'),_0x542ef1);return Promise[_0xcab3('0x2d')]()['then'](function(){if(Array[_0xcab3('0x26')](_0x2c949c)){return checkArrayOfIntervals(_0x2c949c,_0x394f1d);}else if(_0x2c949c){return checkSingleInterval(_0x2c949c,_0x394f1d);}})[_0xcab3('0x11')](function(_0x24730a){var _0x7b78ab=_0xe687aa[_0xcab3('0x1d')](function(_0x3e0503,_0x1c7b4a){return _0x3e0503||iftime(_0x1c7b4a,_0x394f1d);},![]);_0x1c1535=_0x24730a||_0x7b78ab;return _0x1c1535;})[_0xcab3('0x14')](function(_0x56e47c){logger['error'](_0xcab3('0x24'),_0x542ef1,_0x56e47c);throw this['error'](0x1f4,_0x56e47c[_0xcab3('0x15')]);});}; \ No newline at end of file +var _0xa8ae=['join','IntervalIftime:\x20interval\x20=\x20%s\x20(id\x20=\x20%s)','name','IntervalIftime','intervalIds','isArray','intervals','timezone','length','IntervalIftime:\x20interval\x20strings\x20=\x20%s','IntervalIftime:\x20timezone\x20=\x20%s','silly','resolve','reduce','lodash','util','../../mysqldb','../../utils/iftime','../../config/logger','rpc','GetInterval','Interval','findAll','options','raw','where','limit','include','attributes','map','model','then','info','debug','stringify','catch','error','message','ShowInterval','find','all','ifTime','format','IntervalIftime:\x20intervals\x20=\x20%s\x20(ids\x20=\x20%s)'];(function(_0x549979,_0x3ae5a5){var _0x3a38fe=function(_0x24b3ad){while(--_0x24b3ad){_0x549979['push'](_0x549979['shift']());}};_0x3a38fe(++_0x3ae5a5);}(_0xa8ae,0x92));var _0xea8a=function(_0x360a4c,_0x2713ec){_0x360a4c=_0x360a4c-0x0;var _0x459e67=_0xa8ae[_0x360a4c];return _0x459e67;};'use strict';var _=require(_0xea8a('0x0'));var util=require(_0xea8a('0x1'));var db=require(_0xea8a('0x2'))['db'];var iftime=require(_0xea8a('0x3'))['iftime'];var logger=require(_0xea8a('0x4'))(_0xea8a('0x5'));exports[_0xea8a('0x6')]=function(_0x5445da){var _0x5fb675=this;return new Promise(function(_0x3765eb,_0x48967e){return db[_0xea8a('0x7')][_0xea8a('0x8')]({'raw':_0x5445da[_0xea8a('0x9')]?_0x5445da[_0xea8a('0x9')][_0xea8a('0xa')]===undefined?!![]:![]:!![],'where':_0x5445da[_0xea8a('0x9')]?_0x5445da[_0xea8a('0x9')][_0xea8a('0xb')]||null:null,'attributes':_0x5445da[_0xea8a('0x9')]?_0x5445da[_0xea8a('0x9')]['attributes']||null:null,'limit':_0x5445da['options']?_0x5445da['options'][_0xea8a('0xc')]||null:null,'include':_0x5445da[_0xea8a('0x9')]?_0x5445da[_0xea8a('0x9')][_0xea8a('0xd')]?_['map'](_0x5445da['options'][_0xea8a('0xd')],function(_0x1921de){return{'model':db[_0x1921de['model']],'as':_0x1921de['as'],'attributes':_0x1921de[_0xea8a('0xe')],'include':_0x1921de[_0xea8a('0xd')]?_[_0xea8a('0xf')](_0x1921de[_0xea8a('0xd')],function(_0x39d17c){return{'model':db[_0x39d17c[_0xea8a('0x10')]],'as':_0x39d17c['as'],'attributes':_0x39d17c[_0xea8a('0xe')],'include':_0x39d17c[_0xea8a('0xd')]?_[_0xea8a('0xf')](_0x39d17c[_0xea8a('0xd')],function(_0x28b79e){return{'model':db[_0x28b79e['model']],'as':_0x28b79e['as'],'attributes':_0x28b79e['attributes']};}):[]};}):[]};}):[]:[]})[_0xea8a('0x11')](function(_0x4c8a3e){logger[_0xea8a('0x12')](_0xea8a('0x6'),_0x5445da);logger[_0xea8a('0x13')]('GetInterval',_0x5445da,JSON[_0xea8a('0x14')](_0x4c8a3e));_0x3765eb(_0x4c8a3e);})[_0xea8a('0x15')](function(_0xdd616f){logger[_0xea8a('0x16')](_0xea8a('0x6'),_0xdd616f['message'],_0x5445da);_0x48967e(_0x5fb675[_0xea8a('0x16')](0x1f4,_0xdd616f[_0xea8a('0x17')]));});});};exports[_0xea8a('0x18')]=function(_0x46bb96){var _0xa7d28c=this;return new Promise(function(_0x4b9f3c,_0x31b24f){return db[_0xea8a('0x7')][_0xea8a('0x19')]({'raw':_0x46bb96[_0xea8a('0x9')]?_0x46bb96[_0xea8a('0x9')][_0xea8a('0xa')]===undefined?!![]:![]:!![],'where':_0x46bb96['options']?_0x46bb96[_0xea8a('0x9')][_0xea8a('0xb')]||null:null,'attributes':_0x46bb96[_0xea8a('0x9')]?_0x46bb96['options'][_0xea8a('0xe')]||null:null,'include':_0x46bb96[_0xea8a('0x9')]?_0x46bb96[_0xea8a('0x9')]['include']?_['map'](_0x46bb96[_0xea8a('0x9')][_0xea8a('0xd')],function(_0x2bf25b){return{'model':db[_0x2bf25b['model']],'as':_0x2bf25b['as'],'attributes':_0x2bf25b[_0xea8a('0xe')],'include':_0x2bf25b['include']?_[_0xea8a('0xf')](_0x2bf25b[_0xea8a('0xd')],function(_0x4c1a03){return{'model':db[_0x4c1a03[_0xea8a('0x10')]],'as':_0x4c1a03['as'],'attributes':_0x4c1a03[_0xea8a('0xe')],'include':_0x4c1a03[_0xea8a('0xd')]?_[_0xea8a('0xf')](_0x4c1a03[_0xea8a('0xd')],function(_0x47acc6){return{'model':db[_0x47acc6[_0xea8a('0x10')]],'as':_0x47acc6['as'],'attributes':_0x47acc6['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0xebc275){logger['info']('ShowInterval',_0x46bb96);logger[_0xea8a('0x13')](_0xea8a('0x18'),_0x46bb96,JSON[_0xea8a('0x14')](_0xebc275));_0x4b9f3c(_0xebc275);})['catch'](function(_0x2c3c65){logger[_0xea8a('0x16')](_0xea8a('0x18'),_0x2c3c65[_0xea8a('0x17')],_0x46bb96);_0x31b24f(_0xa7d28c['error'](0x1f4,_0x2c3c65[_0xea8a('0x17')]));});});};function checkArrayOfIntervals(_0x3f4602,_0x3e9d42){var _0x5e490a=[];return db['Interval'][_0xea8a('0x8')]({'where':{'id':_0x3f4602}})[_0xea8a('0x11')](function(_0x23d946){_0x5e490a=_0x23d946;return Promise[_0xea8a('0x1a')](_0x5e490a[_0xea8a('0xf')](function(_0x7036b7){return _0x7036b7[_0xea8a('0x1b')](_0x3e9d42);}));})[_0xea8a('0x11')](function(_0x1705f8){var _0x487a4a=_0x1705f8['reduce'](function(_0x4245b8,_0x395423){return _0x4245b8||_0x395423;},![]);logger[_0xea8a('0x12')](util[_0xea8a('0x1c')](_0xea8a('0x1d'),_0x5e490a[_0xea8a('0xf')](function(_0x38d91c){return _0x38d91c['name'];})[_0xea8a('0x1e')](',\x20'),_0x5e490a[_0xea8a('0xf')](function(_0x29b5f0){return _0x29b5f0['id'];})[_0xea8a('0x1e')](',\x20')));return _0x487a4a;});}function checkSingleInterval(_0x2b8da0,_0x15ad13){return db[_0xea8a('0x7')]['findById'](_0x2b8da0)[_0xea8a('0x11')](function(_0xef17b6){if(_0xef17b6){logger[_0xea8a('0x12')](util['format'](_0xea8a('0x1f'),_0xef17b6[_0xea8a('0x20')],_0xef17b6['id']));return _0xef17b6[_0xea8a('0x1b')](_0x15ad13);}});}exports[_0xea8a('0x21')]=function(_0x419a83){var _0x56ec0c=_0x419a83[_0xea8a('0x22')];var _0x1c3c7b=Array[_0xea8a('0x23')](_0x419a83['intervals'])?_0x419a83['intervals']:typeof _0x419a83[_0xea8a('0x24')]==='string'?[_0x419a83[_0xea8a('0x24')]]:[];var _0x5383b4=_0x419a83[_0xea8a('0x25')]||undefined;var _0x27b99d=![];if(_0x1c3c7b[_0xea8a('0x26')]){logger['info'](util[_0xea8a('0x1c')](_0xea8a('0x27'),_0x1c3c7b[_0xea8a('0x1e')](';\x20')));}if(_0x5383b4){logger['info'](util[_0xea8a('0x1c')](_0xea8a('0x28'),_0x5383b4));}logger[_0xea8a('0x13')]('Iftime',_0x27b99d);logger[_0xea8a('0x29')](_0xea8a('0x21'),_0x419a83);return Promise[_0xea8a('0x2a')]()[_0xea8a('0x11')](function(){if(Array['isArray'](_0x56ec0c)){return checkArrayOfIntervals(_0x56ec0c,_0x5383b4);}else if(_0x56ec0c){return checkSingleInterval(_0x56ec0c,_0x5383b4);}})[_0xea8a('0x11')](function(_0x122e61){var _0x3206b0=_0x1c3c7b[_0xea8a('0x2b')](function(_0x4b169f,_0x43de86){return _0x4b169f||iftime(_0x43de86,_0x5383b4);},![]);_0x27b99d=_0x122e61||_0x3206b0;return _0x27b99d;})[_0xea8a('0x15')](function(_0x145e48){logger[_0xea8a('0x16')]('IntervalIftime',_0x419a83,_0x145e48);throw this[_0xea8a('0x16')](0x1f4,_0x145e48['message']);});}; \ No newline at end of file diff --git a/server/api/jira/index.js b/server/api/jira/index.js index e5cc9a9..7b7c2b5 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 _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x5a6c3f,_0x358342){var _0x2bd67e=function(_0x373365){while(--_0x373365){_0x5a6c3f['push'](_0x5a6c3f['shift']());}};_0x2bd67e(++_0x358342);}(_0x2ef3,0xba));var _0x32ef=function(_0x3fb447,_0x324b02){_0x3fb447=_0x3fb447-0x0;var _0x360396=_0x2ef3[_0x3fb447];return _0x360396;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file +var _0x2ef3=['./jira.controller','post','isAuthenticated','exports','express','Router','../../components/auth/service'];(function(_0x56008e,_0x1f3e07){var _0x352296=function(_0x14836b){while(--_0x14836b){_0x56008e['push'](_0x56008e['shift']());}};_0x352296(++_0x1f3e07);}(_0x2ef3,0xba));var _0x32ef=function(_0x5c63bf,_0x410bf2){_0x5c63bf=_0x5c63bf-0x0;var _0x4ade8a=_0x2ef3[_0x5c63bf];return _0x4ade8a;};'use strict';var express=require(_0x32ef('0x0'));var router=express[_0x32ef('0x1')]();var auth=require(_0x32ef('0x2'));var controller=require(_0x32ef('0x3'));router[_0x32ef('0x4')]('/',auth[_0x32ef('0x5')](),controller['send']);module[_0x32ef('0x6')]=router; \ No newline at end of file diff --git a/server/api/jira/jira.controller.js b/server/api/jira/jira.controller.js index 49f0f71..d0bb9ea 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 _0xdb7c=['summary','Report','\x20from\x20','description','stringify','fields','customfield_11500','customfield_11501','oldToken','customfield_11502','newToken','customfield_11503','customfield_11504','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','application/json','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','json','parse','error','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','write','send','body','headers','connection','remoteAddress','socket','bluebird','https','../../config/logger','api','support','key','MOTGUI'];(function(_0x362f5f,_0x48b55c){var _0xd5b7c4=function(_0x2d7749){while(--_0x2d7749){_0x362f5f['push'](_0x362f5f['shift']());}};_0xd5b7c4(++_0x48b55c);}(_0xdb7c,0x1bb));var _0xcdb7=function(_0x5cbd7b,_0x207439){_0x5cbd7b=_0x5cbd7b-0x0;var _0x3fdfb8=_0xdb7c[_0x5cbd7b];return _0x3fdfb8;};'use strict';var BPromise=require(_0xcdb7('0x0'));var https=require(_0xcdb7('0x1'));var logger=require(_0xcdb7('0x2'))(_0xcdb7('0x3'));var USERNAME=_0xcdb7('0x4');var PASSWORD='3eAmWpBVP0';function openIssue(_0x4094e8,_0x51ed47){var _0x23b71c={'fields':{'project':{'key':_0x4094e8[_0xcdb7('0x5')]||_0xcdb7('0x6')},'summary':(_0x4094e8[_0xcdb7('0x7')]||_0xcdb7('0x8'))+_0xcdb7('0x9')+_0x4094e8['ip'],'description':_0x4094e8[_0xcdb7('0xa')]||JSON[_0xcdb7('0xb')](_0x4094e8),'issuetype':{'name':_0x4094e8['issuetype']||'Bug'}}};_0x23b71c[_0xcdb7('0xc')][_0xcdb7('0xd')]=_0x4094e8['email'];_0x23b71c['fields'][_0xcdb7('0xe')]=_0x4094e8[_0xcdb7('0xf')];_0x23b71c[_0xcdb7('0xc')][_0xcdb7('0x10')]=_0x4094e8[_0xcdb7('0x11')];_0x23b71c['fields'][_0xcdb7('0x12')]=_0x4094e8['name'];_0x23b71c[_0xcdb7('0xc')][_0xcdb7('0x13')]=_0x4094e8['reason'];_0x23b71c[_0xcdb7('0xc')][_0xcdb7('0x14')]=_0x4094e8['ip'];var _0x746133={'host':_0xcdb7('0x15'),'port':0x1bb,'path':_0xcdb7('0x16'),'method':_0xcdb7('0x17'),'timeout':0x4e20,'headers':{'Content-Type':_0xcdb7('0x18'),'Authorization':_0xcdb7('0x19')+new Buffer(USERNAME+':'+PASSWORD)[_0xcdb7('0x1a')](_0xcdb7('0x1b'))}};var _0x359c0e=JSON[_0xcdb7('0xb')](_0x23b71c);var _0x35020d=https[_0xcdb7('0x1c')](_0x746133,function(_0xfa973b){_0xfa973b[_0xcdb7('0x1d')](_0xcdb7('0x1e'));var _0x119c64='';_0xfa973b['on'](_0xcdb7('0x1f'),function(_0x79220c){_0x119c64+=_0x79220c;});_0xfa973b['on'](_0xcdb7('0x20'),function(){if(_0x51ed47){return _0x51ed47[_0xcdb7('0x21')](_0xfa973b['statusCode'])[_0xcdb7('0x22')](JSON[_0xcdb7('0x23')](_0x119c64));}});});_0x35020d['on'](_0xcdb7('0x24'),function(_0x12c97e){if(_0x51ed47){return _0x51ed47['status'](0x1f4)['json']({'errors':[{'message':_0xcdb7('0x25'),'type':'api.jira'}]});}});_0x35020d[_0xcdb7('0x26')](_0x359c0e);_0x35020d[_0xcdb7('0x20')]();}exports['openIssue']=openIssue;exports[_0xcdb7('0x27')]=function(_0x4ccb5d,_0x7d3cb6){_0x4ccb5d[_0xcdb7('0x28')]['ip']=_0x4ccb5d[_0xcdb7('0x29')]['x-forwarded-for']||_0x4ccb5d[_0xcdb7('0x2a')][_0xcdb7('0x2b')]||_0x4ccb5d[_0xcdb7('0x2c')][_0xcdb7('0x2b')]||_0x4ccb5d[_0xcdb7('0x2a')][_0xcdb7('0x2c')][_0xcdb7('0x2b')];return openIssue(_0x4ccb5d[_0xcdb7('0x28')],_0x7d3cb6);}; \ No newline at end of file +var _0x2e00=['remoteAddress','socket','connection','bluebird','https','3eAmWpBVP0','key','MOTGUI','summary','Report','description','stringify','issuetype','Bug','fields','customfield_11500','customfield_11501','customfield_11502','newToken','customfield_11503','name','customfield_11504','reason','customfield_10102','track.xcallymotion.com','/rest/api/2/issue','POST','Basic\x20','toString','base64','request','setEncoding','utf8','data','end','status','statusCode','json','parse','Error\x20during\x20license\x20request.\x20Please\x20contact\x20our\x20license\x20team\x20at\x20license@xcally.com\x20with\x20your\x20request','api.jira','write','send','body','headers','x-forwarded-for'];(function(_0x1f9685,_0x65f29b){var _0x1fd25e=function(_0x1d46c6){while(--_0x1d46c6){_0x1f9685['push'](_0x1f9685['shift']());}};_0x1fd25e(++_0x65f29b);}(_0x2e00,0xbb));var _0x02e0=function(_0x36884e,_0x48008f){_0x36884e=_0x36884e-0x0;var _0x1cc367=_0x2e00[_0x36884e];return _0x1cc367;};'use strict';var BPromise=require(_0x02e0('0x0'));var https=require(_0x02e0('0x1'));var logger=require('../../config/logger')('api');var USERNAME='support';var PASSWORD=_0x02e0('0x2');function openIssue(_0x53ea70,_0x4940b1){var _0x389d00={'fields':{'project':{'key':_0x53ea70[_0x02e0('0x3')]||_0x02e0('0x4')},'summary':(_0x53ea70[_0x02e0('0x5')]||_0x02e0('0x6'))+'\x20from\x20'+_0x53ea70['ip'],'description':_0x53ea70[_0x02e0('0x7')]||JSON[_0x02e0('0x8')](_0x53ea70),'issuetype':{'name':_0x53ea70[_0x02e0('0x9')]||_0x02e0('0xa')}}};_0x389d00[_0x02e0('0xb')][_0x02e0('0xc')]=_0x53ea70['email'];_0x389d00['fields'][_0x02e0('0xd')]=_0x53ea70['oldToken'];_0x389d00['fields'][_0x02e0('0xe')]=_0x53ea70[_0x02e0('0xf')];_0x389d00[_0x02e0('0xb')][_0x02e0('0x10')]=_0x53ea70[_0x02e0('0x11')];_0x389d00[_0x02e0('0xb')][_0x02e0('0x12')]=_0x53ea70[_0x02e0('0x13')];_0x389d00[_0x02e0('0xb')][_0x02e0('0x14')]=_0x53ea70['ip'];var _0x39c5b8={'host':_0x02e0('0x15'),'port':0x1bb,'path':_0x02e0('0x16'),'method':_0x02e0('0x17'),'timeout':0x4e20,'headers':{'Content-Type':'application/json','Authorization':_0x02e0('0x18')+new Buffer(USERNAME+':'+PASSWORD)[_0x02e0('0x19')](_0x02e0('0x1a'))}};var _0x431c06=JSON['stringify'](_0x389d00);var _0x1bdaf7=https[_0x02e0('0x1b')](_0x39c5b8,function(_0x40b722){_0x40b722[_0x02e0('0x1c')](_0x02e0('0x1d'));var _0x425df7='';_0x40b722['on'](_0x02e0('0x1e'),function(_0x12675e){_0x425df7+=_0x12675e;});_0x40b722['on'](_0x02e0('0x1f'),function(){if(_0x4940b1){return _0x4940b1[_0x02e0('0x20')](_0x40b722[_0x02e0('0x21')])[_0x02e0('0x22')](JSON[_0x02e0('0x23')](_0x425df7));}});});_0x1bdaf7['on']('error',function(_0x43eb2e){if(_0x4940b1){return _0x4940b1[_0x02e0('0x20')](0x1f4)[_0x02e0('0x22')]({'errors':[{'message':_0x02e0('0x24'),'type':_0x02e0('0x25')}]});}});_0x1bdaf7[_0x02e0('0x26')](_0x431c06);_0x1bdaf7[_0x02e0('0x1f')]();}exports['openIssue']=openIssue;exports[_0x02e0('0x27')]=function(_0x4d84df,_0x2804a5){_0x4d84df[_0x02e0('0x28')]['ip']=_0x4d84df[_0x02e0('0x29')][_0x02e0('0x2a')]||_0x4d84df['connection'][_0x02e0('0x2b')]||_0x4d84df[_0x02e0('0x2c')][_0x02e0('0x2b')]||_0x4d84df[_0x02e0('0x2d')][_0x02e0('0x2c')][_0x02e0('0x2b')];return openIssue(_0x4d84df[_0x02e0('0x28')],_0x2804a5);}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/index.js b/server/api/jscriptyAnswerReport/index.js index c822889..a8c9afb 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 _0x17ba=['/describe','describe','/:id','show','create','put','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','isAuthenticated','index'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x17ba,0xab));var _0xa17b=function(_0xfa7a1a,_0xd2f9d8){_0xfa7a1a=_0xfa7a1a-0x0;var _0x2c73f7=_0x17ba[_0xfa7a1a];return _0x2c73f7;};'use strict';var multer=require(_0xa17b('0x0'));var util=require(_0xa17b('0x1'));var path=require('path');var timeout=require(_0xa17b('0x2'));var express=require(_0xa17b('0x3'));var router=express[_0xa17b('0x4')]();var fs_extra=require(_0xa17b('0x5'));var auth=require(_0xa17b('0x6'));var interaction=require(_0xa17b('0x7'));var config=require(_0xa17b('0x8'));var controller=require(_0xa17b('0x9'));router[_0xa17b('0xa')]('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0xc')]);router[_0xa17b('0xa')](_0xa17b('0xd'),auth[_0xa17b('0xb')](),controller[_0xa17b('0xe')]);router[_0xa17b('0xa')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x10')]);router['post']('/',auth[_0xa17b('0xb')](),controller[_0xa17b('0x11')]);router[_0xa17b('0x12')](_0xa17b('0xf'),auth[_0xa17b('0xb')](),controller[_0xa17b('0x13')]);router[_0xa17b('0x14')]('/:id',auth[_0xa17b('0xb')](),controller[_0xa17b('0x15')]);module[_0xa17b('0x16')]=router; \ No newline at end of file +var _0x0bb5=['describe','show','post','put','/:id','update','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyAnswerReport.controller','get','/describe','isAuthenticated'];(function(_0x13b393,_0x5e8710){var _0x4760a7=function(_0x321d42){while(--_0x321d42){_0x13b393['push'](_0x13b393['shift']());}};_0x4760a7(++_0x5e8710);}(_0x0bb5,0x148));var _0x50bb=function(_0x376499,_0x1deb75){_0x376499=_0x376499-0x0;var _0x3bd17f=_0x0bb5[_0x376499];return _0x3bd17f;};'use strict';var multer=require(_0x50bb('0x0'));var util=require(_0x50bb('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x50bb('0x2'));var router=express[_0x50bb('0x3')]();var fs_extra=require(_0x50bb('0x4'));var auth=require(_0x50bb('0x5'));var interaction=require(_0x50bb('0x6'));var config=require(_0x50bb('0x7'));var controller=require(_0x50bb('0x8'));router[_0x50bb('0x9')]('/',auth['isAuthenticated'](),controller['index']);router[_0x50bb('0x9')](_0x50bb('0xa'),auth[_0x50bb('0xb')](),controller[_0x50bb('0xc')]);router['get']('/:id',auth[_0x50bb('0xb')](),controller[_0x50bb('0xd')]);router[_0x50bb('0xe')]('/',auth[_0x50bb('0xb')](),controller['create']);router[_0x50bb('0xf')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller[_0x50bb('0x11')]);router[_0x50bb('0x12')](_0x50bb('0x10'),auth[_0x50bb('0xb')](),controller['destroy']);module[_0x50bb('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js index 6a52dc8..a1aca11 100644 --- a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js +++ b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x4d613c,_0x55f220){var _0x301fe3=function(_0x5eec0b){while(--_0x5eec0b){_0x4d613c['push'](_0x4d613c['shift']());}};_0x301fe3(++_0x55f220);}(_0x7a54,0x106));var _0x47a5=function(_0x5d30b4,_0x23d057){_0x5d30b4=_0x5d30b4-0x0;var _0x58273d=_0x7a54[_0x5d30b4];return _0x58273d;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x259bfc,_0x35b2b7){_0x259bfc=_0x259bfc-0x0;var _0x1a4624=_0x7a54[_0x259bfc];return _0x1a4624;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.controller.js index 33cd84e..a2540c4 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 _0x8375=['rawAttributes','include','create','body','find','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','json','offset','count','set','Content-Range','apply','reject','update','then','end','error','stack','name','send','index','map','JscriptyAnswerReport','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','limit','order','sort','filter','where','merge','options','includeAll','findAll','rows','catch','show','params'];(function(_0x175e97,_0x57a798){var _0x3b8785=function(_0xdac906){while(--_0xdac906){_0x175e97['push'](_0x175e97['shift']());}};_0x3b8785(++_0x57a798);}(_0x8375,0x132));var _0x5837=function(_0x3fff2b,_0x13f12d){_0x3fff2b=_0x3fff2b-0x0;var _0x1aa9ad=_0x8375[_0x3fff2b];return _0x1aa9ad;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5837('0x0'));var zipdir=require(_0x5837('0x1'));var jsonpatch=require(_0x5837('0x2'));var rp=require(_0x5837('0x3'));var moment=require(_0x5837('0x4'));var BPromise=require(_0x5837('0x5'));var Mustache=require('mustache');var util=require(_0x5837('0x6'));var path=require(_0x5837('0x7'));var sox=require('sox');var csv=require(_0x5837('0x8'));var ejs=require(_0x5837('0x9'));var fs=require('fs');var fs_extra=require(_0x5837('0xa'));var _=require(_0x5837('0xb'));var squel=require('squel');var crypto=require(_0x5837('0xc'));var jsforce=require(_0x5837('0xd'));var deskjs=require(_0x5837('0xe'));var toCsv=require(_0x5837('0x8'));var querystring=require(_0x5837('0xf'));var Papa=require(_0x5837('0x10'));var Redis=require(_0x5837('0x11'));var authService=require(_0x5837('0x12'));var qs=require(_0x5837('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5837('0x14'));var logger=require(_0x5837('0x15'))('api');var utils=require(_0x5837('0x16'));var config=require(_0x5837('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x5837('0x18'))['db'];function respondWithStatusCode(_0x5abd5e,_0x2b0b43){_0x2b0b43=_0x2b0b43||0xcc;return function(_0x3ad5b3){if(_0x3ad5b3){return _0x5abd5e[_0x5837('0x19')](_0x2b0b43);}return _0x5abd5e[_0x5837('0x1a')](_0x2b0b43)['end']();};}function respondWithResult(_0x2b82a9,_0x103b9c){_0x103b9c=_0x103b9c||0xc8;return function(_0x2bc6f6){if(_0x2bc6f6){return _0x2b82a9['status'](_0x103b9c)[_0x5837('0x1b')](_0x2bc6f6);}};}function respondWithFilteredResult(_0x11f16c,_0x2f8af0){return function(_0x23c3af){if(_0x23c3af){var _0x304fe7=typeof _0x2f8af0[_0x5837('0x1c')]==='undefined'&&typeof _0x2f8af0['limit']==='undefined';var _0x37824b=_0x23c3af[_0x5837('0x1d')];var _0x1a5725=_0x304fe7?0x0:_0x2f8af0[_0x5837('0x1c')];var _0x128b4a=_0x304fe7?_0x23c3af[_0x5837('0x1d')]:_0x2f8af0[_0x5837('0x1c')]+_0x2f8af0['limit'];var _0x3c5ec9;if(_0x128b4a>=_0x37824b){_0x128b4a=_0x37824b;_0x3c5ec9=0xc8;}else{_0x3c5ec9=0xce;}_0x11f16c[_0x5837('0x1a')](_0x3c5ec9);return _0x11f16c[_0x5837('0x1e')](_0x5837('0x1f'),_0x1a5725+'-'+_0x128b4a+'/'+_0x37824b)[_0x5837('0x1b')](_0x23c3af);}return null;};}function patchUpdates(_0x50c42c){return function(_0x4bd76c){try{jsonpatch[_0x5837('0x20')](_0x4bd76c,_0x50c42c,!![]);}catch(_0x21c0bf){return BPromise[_0x5837('0x21')](_0x21c0bf);}return _0x4bd76c['save']();};}function saveUpdates(_0x31010b,_0x46786c){return function(_0x4b59b1){if(_0x4b59b1){return _0x4b59b1[_0x5837('0x22')](_0x31010b)[_0x5837('0x23')](function(_0x5e9c2e){return _0x5e9c2e;});}return null;};}function removeEntity(_0x332a90,_0x2709cf){return function(_0x1366c1){if(_0x1366c1){return _0x1366c1['destroy']()[_0x5837('0x23')](function(){_0x332a90['status'](0xcc)[_0x5837('0x24')]();});}};}function handleEntityNotFound(_0x8e5a48,_0x31d25b){return function(_0x3f96b1){if(!_0x3f96b1){_0x8e5a48[_0x5837('0x19')](0x194);}return _0x3f96b1;};}function handleError(_0x1f7f97,_0x22564a){_0x22564a=_0x22564a||0x1f4;return function(_0x1d7285){logger[_0x5837('0x25')](_0x1d7285[_0x5837('0x26')]);if(_0x1d7285[_0x5837('0x27')]){delete _0x1d7285[_0x5837('0x27')];}_0x1f7f97[_0x5837('0x1a')](_0x22564a)[_0x5837('0x28')](_0x1d7285);};}exports[_0x5837('0x29')]=function(_0x5c17dd,_0x321c49){var _0x2818c0={},_0x170cb2={},_0x430bd1={'count':0x0,'rows':[]};var _0x80cfc6=_[_0x5837('0x2a')](db[_0x5837('0x2b')]['rawAttributes'],function(_0x89e7e5){return{'name':_0x89e7e5[_0x5837('0x2c')],'type':_0x89e7e5[_0x5837('0x2d')][_0x5837('0x2e')]};});_0x170cb2['model']=_['map'](_0x80cfc6,_0x5837('0x27'));_0x170cb2[_0x5837('0x2f')]=_[_0x5837('0x30')](_0x5c17dd['query']);_0x170cb2[_0x5837('0x31')]=_[_0x5837('0x32')](_0x170cb2[_0x5837('0x33')],_0x170cb2[_0x5837('0x2f')]);_0x2818c0[_0x5837('0x34')]=_[_0x5837('0x32')](_0x170cb2['model'],qs[_0x5837('0x35')](_0x5c17dd[_0x5837('0x2f')]['fields']));_0x2818c0[_0x5837('0x34')]=_0x2818c0[_0x5837('0x34')][_0x5837('0x36')]?_0x2818c0['attributes']:_0x170cb2['model'];if(!_0x5c17dd['query']['hasOwnProperty'](_0x5837('0x37'))){_0x2818c0['limit']=qs['limit'](_0x5c17dd[_0x5837('0x2f')][_0x5837('0x38')]);_0x2818c0['offset']=qs[_0x5837('0x1c')](_0x5c17dd['query'][_0x5837('0x1c')]);}_0x2818c0[_0x5837('0x39')]=qs['sort'](_0x5c17dd[_0x5837('0x2f')][_0x5837('0x3a')]);_0x2818c0['where']=qs[_0x5837('0x31')](_['pick'](_0x5c17dd[_0x5837('0x2f')],_0x170cb2['filters']),_0x80cfc6);if(_0x5c17dd['query'][_0x5837('0x3b')]){_0x2818c0[_0x5837('0x3c')]=_[_0x5837('0x3d')](_0x2818c0[_0x5837('0x3c')],{'$or':_[_0x5837('0x2a')](_0x80cfc6,function(_0x5ca1ea){if(_0x5ca1ea[_0x5837('0x2d')]!=='VIRTUAL'){var _0x5d29ed={};_0x5d29ed[_0x5ca1ea[_0x5837('0x27')]]={'$like':'%'+_0x5c17dd[_0x5837('0x2f')]['filter']+'%'};return _0x5d29ed;}})});}_0x2818c0=_[_0x5837('0x3d')]({},_0x2818c0,_0x5c17dd[_0x5837('0x3e')]);var _0x414254={'where':_0x2818c0[_0x5837('0x3c')]};return db[_0x5837('0x2b')][_0x5837('0x1d')](_0x414254)[_0x5837('0x23')](function(_0x7b3c75){_0x430bd1[_0x5837('0x1d')]=_0x7b3c75;if(_0x5c17dd['query'][_0x5837('0x3f')]){_0x2818c0['include']=[{'all':!![]}];}return db['JscriptyAnswerReport'][_0x5837('0x40')](_0x2818c0);})[_0x5837('0x23')](function(_0x5e6916){_0x430bd1[_0x5837('0x41')]=_0x5e6916;return _0x430bd1;})[_0x5837('0x23')](respondWithFilteredResult(_0x321c49,_0x2818c0))[_0x5837('0x42')](handleError(_0x321c49,null));};exports[_0x5837('0x43')]=function(_0x561f0a,_0x26fd6d){var _0x25237a={'raw':!![],'where':{'id':_0x561f0a[_0x5837('0x44')]['id']}},_0x84eff={};_0x84eff[_0x5837('0x33')]=_['keys'](db[_0x5837('0x2b')][_0x5837('0x45')]);_0x84eff[_0x5837('0x2f')]=_['keys'](_0x561f0a[_0x5837('0x2f')]);_0x84eff[_0x5837('0x31')]=_[_0x5837('0x32')](_0x84eff[_0x5837('0x33')],_0x84eff[_0x5837('0x2f')]);_0x25237a[_0x5837('0x34')]=_[_0x5837('0x32')](_0x84eff[_0x5837('0x33')],qs[_0x5837('0x35')](_0x561f0a[_0x5837('0x2f')][_0x5837('0x35')]));_0x25237a['attributes']=_0x25237a[_0x5837('0x34')][_0x5837('0x36')]?_0x25237a['attributes']:_0x84eff['model'];if(_0x561f0a[_0x5837('0x2f')]['includeAll']){_0x25237a[_0x5837('0x46')]=[{'all':!![]}];}_0x25237a=_[_0x5837('0x3d')]({},_0x25237a,_0x561f0a[_0x5837('0x3e')]);return db[_0x5837('0x2b')]['find'](_0x25237a)[_0x5837('0x23')](handleEntityNotFound(_0x26fd6d,null))[_0x5837('0x23')](respondWithResult(_0x26fd6d,null))[_0x5837('0x42')](handleError(_0x26fd6d,null));};exports[_0x5837('0x47')]=function(_0x3fc3c8,_0x3b1293){return db[_0x5837('0x2b')][_0x5837('0x47')](_0x3fc3c8[_0x5837('0x48')],{})['then'](respondWithResult(_0x3b1293,0xc9))[_0x5837('0x42')](handleError(_0x3b1293,null));};exports[_0x5837('0x22')]=function(_0xd49ba7,_0x16f12f){if(_0xd49ba7[_0x5837('0x48')]['id']){delete _0xd49ba7[_0x5837('0x48')]['id'];}return db['JscriptyAnswerReport'][_0x5837('0x49')]({'where':{'id':_0xd49ba7[_0x5837('0x44')]['id']}})[_0x5837('0x23')](handleEntityNotFound(_0x16f12f,null))[_0x5837('0x23')](saveUpdates(_0xd49ba7[_0x5837('0x48')],null))['then'](respondWithResult(_0x16f12f,null))[_0x5837('0x42')](handleError(_0x16f12f,null));};exports['destroy']=function(_0x105315,_0x345547){return db[_0x5837('0x2b')]['find']({'where':{'id':_0x105315[_0x5837('0x44')]['id']}})[_0x5837('0x23')](handleEntityNotFound(_0x345547,null))[_0x5837('0x23')](removeEntity(_0x345547,null))[_0x5837('0x42')](handleError(_0x345547,null));};exports[_0x5837('0x4a')]=function(_0x424d59,_0x41604b){return db[_0x5837('0x2b')][_0x5837('0x4a')]()['then'](respondWithResult(_0x41604b,null))['catch'](handleError(_0x41604b,null));}; \ No newline at end of file +var _0x2caf=['type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','rows','catch','show','params','include','find','create','body','describe','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','sendStatus','error','name','send','index','map','JscriptyAnswerReport','rawAttributes','fieldName'];(function(_0x573344,_0x5874e9){var _0x4ab1e0=function(_0x4af32f){while(--_0x4af32f){_0x573344['push'](_0x573344['shift']());}};_0x4ab1e0(++_0x5874e9);}(_0x2caf,0x6a));var _0xf2ca=function(_0x2972a5,_0x294531){_0x2972a5=_0x2972a5-0x0;var _0x11a2ad=_0x2caf[_0x2972a5];return _0x11a2ad;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xf2ca('0x0'));var rp=require('request-promise');var moment=require(_0xf2ca('0x1'));var BPromise=require(_0xf2ca('0x2'));var Mustache=require(_0xf2ca('0x3'));var util=require(_0xf2ca('0x4'));var path=require(_0xf2ca('0x5'));var sox=require(_0xf2ca('0x6'));var csv=require(_0xf2ca('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf2ca('0x8'));var _=require(_0xf2ca('0x9'));var squel=require(_0xf2ca('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xf2ca('0xb'));var toCsv=require(_0xf2ca('0x7'));var querystring=require(_0xf2ca('0xc'));var Papa=require(_0xf2ca('0xd'));var Redis=require(_0xf2ca('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xf2ca('0xf'));var as=require(_0xf2ca('0x10'));var hardwareService=require(_0xf2ca('0x11'));var logger=require(_0xf2ca('0x12'))(_0xf2ca('0x13'));var utils=require(_0xf2ca('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xf2ca('0x15'));var db=require(_0xf2ca('0x16'))['db'];function respondWithStatusCode(_0x54a3cb,_0x88529f){_0x88529f=_0x88529f||0xcc;return function(_0x383112){if(_0x383112){return _0x54a3cb['sendStatus'](_0x88529f);}return _0x54a3cb['status'](_0x88529f)[_0xf2ca('0x17')]();};}function respondWithResult(_0x52a278,_0x284484){_0x284484=_0x284484||0xc8;return function(_0x3123fe){if(_0x3123fe){return _0x52a278[_0xf2ca('0x18')](_0x284484)[_0xf2ca('0x19')](_0x3123fe);}};}function respondWithFilteredResult(_0x410997,_0x2057a2){return function(_0x2ddfac){if(_0x2ddfac){var _0x5aec64=typeof _0x2057a2[_0xf2ca('0x1a')]==='undefined'&&typeof _0x2057a2[_0xf2ca('0x1b')]==='undefined';var _0x235e79=_0x2ddfac[_0xf2ca('0x1c')];var _0x59ea3c=_0x5aec64?0x0:_0x2057a2[_0xf2ca('0x1a')];var _0x160230=_0x5aec64?_0x2ddfac[_0xf2ca('0x1c')]:_0x2057a2[_0xf2ca('0x1a')]+_0x2057a2[_0xf2ca('0x1b')];var _0x1ca233;if(_0x160230>=_0x235e79){_0x160230=_0x235e79;_0x1ca233=0xc8;}else{_0x1ca233=0xce;}_0x410997[_0xf2ca('0x18')](_0x1ca233);return _0x410997[_0xf2ca('0x1d')](_0xf2ca('0x1e'),_0x59ea3c+'-'+_0x160230+'/'+_0x235e79)[_0xf2ca('0x19')](_0x2ddfac);}return null;};}function patchUpdates(_0xea662){return function(_0x55dc6a){try{jsonpatch[_0xf2ca('0x1f')](_0x55dc6a,_0xea662,!![]);}catch(_0x45a028){return BPromise[_0xf2ca('0x20')](_0x45a028);}return _0x55dc6a[_0xf2ca('0x21')]();};}function saveUpdates(_0x41cb71,_0x386c58){return function(_0x1bbd60){if(_0x1bbd60){return _0x1bbd60[_0xf2ca('0x22')](_0x41cb71)['then'](function(_0x14791b){return _0x14791b;});}return null;};}function removeEntity(_0x1767f7,_0x56ebed){return function(_0x1c032c){if(_0x1c032c){return _0x1c032c[_0xf2ca('0x23')]()[_0xf2ca('0x24')](function(){_0x1767f7['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0xbfcb0b,_0x1b3c01){return function(_0x214fa9){if(!_0x214fa9){_0xbfcb0b[_0xf2ca('0x25')](0x194);}return _0x214fa9;};}function handleError(_0x1255ba,_0x427a17){_0x427a17=_0x427a17||0x1f4;return function(_0x339e10){logger[_0xf2ca('0x26')](_0x339e10['stack']);if(_0x339e10[_0xf2ca('0x27')]){delete _0x339e10[_0xf2ca('0x27')];}_0x1255ba[_0xf2ca('0x18')](_0x427a17)[_0xf2ca('0x28')](_0x339e10);};}exports[_0xf2ca('0x29')]=function(_0x41fc04,_0x17707e){var _0xb0ae21={},_0x1b44fb={},_0x20a523={'count':0x0,'rows':[]};var _0xf92250=_[_0xf2ca('0x2a')](db[_0xf2ca('0x2b')][_0xf2ca('0x2c')],function(_0x2b0649){return{'name':_0x2b0649[_0xf2ca('0x2d')],'type':_0x2b0649[_0xf2ca('0x2e')][_0xf2ca('0x2f')]};});_0x1b44fb[_0xf2ca('0x30')]=_['map'](_0xf92250,_0xf2ca('0x27'));_0x1b44fb[_0xf2ca('0x31')]=_[_0xf2ca('0x32')](_0x41fc04[_0xf2ca('0x31')]);_0x1b44fb[_0xf2ca('0x33')]=_[_0xf2ca('0x34')](_0x1b44fb[_0xf2ca('0x30')],_0x1b44fb[_0xf2ca('0x31')]);_0xb0ae21[_0xf2ca('0x35')]=_['intersection'](_0x1b44fb[_0xf2ca('0x30')],qs[_0xf2ca('0x36')](_0x41fc04[_0xf2ca('0x31')]['fields']));_0xb0ae21[_0xf2ca('0x35')]=_0xb0ae21['attributes'][_0xf2ca('0x37')]?_0xb0ae21[_0xf2ca('0x35')]:_0x1b44fb[_0xf2ca('0x30')];if(!_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x38')]('nolimit')){_0xb0ae21['limit']=qs[_0xf2ca('0x1b')](_0x41fc04['query'][_0xf2ca('0x1b')]);_0xb0ae21[_0xf2ca('0x1a')]=qs[_0xf2ca('0x1a')](_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x1a')]);}_0xb0ae21[_0xf2ca('0x39')]=qs[_0xf2ca('0x3a')](_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x3a')]);_0xb0ae21[_0xf2ca('0x3b')]=qs[_0xf2ca('0x33')](_[_0xf2ca('0x3c')](_0x41fc04[_0xf2ca('0x31')],_0x1b44fb[_0xf2ca('0x33')]),_0xf92250);if(_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x3d')]){_0xb0ae21['where']=_[_0xf2ca('0x3e')](_0xb0ae21[_0xf2ca('0x3b')],{'$or':_[_0xf2ca('0x2a')](_0xf92250,function(_0x148570){if(_0x148570['type']!==_0xf2ca('0x3f')){var _0x4b0e0e={};_0x4b0e0e[_0x148570[_0xf2ca('0x27')]]={'$like':'%'+_0x41fc04[_0xf2ca('0x31')][_0xf2ca('0x3d')]+'%'};return _0x4b0e0e;}})});}_0xb0ae21=_[_0xf2ca('0x3e')]({},_0xb0ae21,_0x41fc04[_0xf2ca('0x40')]);var _0x4fbaec={'where':_0xb0ae21[_0xf2ca('0x3b')]};return db[_0xf2ca('0x2b')]['count'](_0x4fbaec)[_0xf2ca('0x24')](function(_0x29ebce){_0x20a523[_0xf2ca('0x1c')]=_0x29ebce;if(_0x41fc04['query'][_0xf2ca('0x41')]){_0xb0ae21['include']=[{'all':!![]}];}return db[_0xf2ca('0x2b')][_0xf2ca('0x42')](_0xb0ae21);})[_0xf2ca('0x24')](function(_0x43b2c2){_0x20a523[_0xf2ca('0x43')]=_0x43b2c2;return _0x20a523;})[_0xf2ca('0x24')](respondWithFilteredResult(_0x17707e,_0xb0ae21))[_0xf2ca('0x44')](handleError(_0x17707e,null));};exports[_0xf2ca('0x45')]=function(_0x43b3c7,_0x128535){var _0x17de81={'raw':!![],'where':{'id':_0x43b3c7[_0xf2ca('0x46')]['id']}},_0x3360d9={};_0x3360d9[_0xf2ca('0x30')]=_[_0xf2ca('0x32')](db['JscriptyAnswerReport'][_0xf2ca('0x2c')]);_0x3360d9[_0xf2ca('0x31')]=_[_0xf2ca('0x32')](_0x43b3c7[_0xf2ca('0x31')]);_0x3360d9[_0xf2ca('0x33')]=_[_0xf2ca('0x34')](_0x3360d9[_0xf2ca('0x30')],_0x3360d9[_0xf2ca('0x31')]);_0x17de81[_0xf2ca('0x35')]=_[_0xf2ca('0x34')](_0x3360d9[_0xf2ca('0x30')],qs[_0xf2ca('0x36')](_0x43b3c7[_0xf2ca('0x31')]['fields']));_0x17de81['attributes']=_0x17de81[_0xf2ca('0x35')][_0xf2ca('0x37')]?_0x17de81['attributes']:_0x3360d9[_0xf2ca('0x30')];if(_0x43b3c7['query'][_0xf2ca('0x41')]){_0x17de81[_0xf2ca('0x47')]=[{'all':!![]}];}_0x17de81=_[_0xf2ca('0x3e')]({},_0x17de81,_0x43b3c7['options']);return db[_0xf2ca('0x2b')][_0xf2ca('0x48')](_0x17de81)['then'](handleEntityNotFound(_0x128535,null))[_0xf2ca('0x24')](respondWithResult(_0x128535,null))[_0xf2ca('0x44')](handleError(_0x128535,null));};exports[_0xf2ca('0x49')]=function(_0x3e92cf,_0x4a6439){return db[_0xf2ca('0x2b')][_0xf2ca('0x49')](_0x3e92cf[_0xf2ca('0x4a')],{})['then'](respondWithResult(_0x4a6439,0xc9))['catch'](handleError(_0x4a6439,null));};exports[_0xf2ca('0x22')]=function(_0x2f7596,_0x1a65c6){if(_0x2f7596[_0xf2ca('0x4a')]['id']){delete _0x2f7596[_0xf2ca('0x4a')]['id'];}return db[_0xf2ca('0x2b')]['find']({'where':{'id':_0x2f7596['params']['id']}})[_0xf2ca('0x24')](handleEntityNotFound(_0x1a65c6,null))[_0xf2ca('0x24')](saveUpdates(_0x2f7596['body'],null))[_0xf2ca('0x24')](respondWithResult(_0x1a65c6,null))['catch'](handleError(_0x1a65c6,null));};exports[_0xf2ca('0x23')]=function(_0x59bbb8,_0x26a483){return db['JscriptyAnswerReport']['find']({'where':{'id':_0x59bbb8[_0xf2ca('0x46')]['id']}})[_0xf2ca('0x24')](handleEntityNotFound(_0x26a483,null))['then'](removeEntity(_0x26a483,null))[_0xf2ca('0x44')](handleError(_0x26a483,null));};exports[_0xf2ca('0x4b')]=function(_0x2eb8d5,_0x14850c){return db[_0xf2ca('0x2b')][_0xf2ca('0x4b')]()['then'](respondWithResult(_0x14850c,null))[_0xf2ca('0x44')](handleError(_0x14850c,null));}; \ No newline at end of file diff --git a/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js b/server/api/jscriptyAnswerReport/jscriptyAnswerReport.model.js index 3f48983..6f1cdd0 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 _0x798f=['util','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','define','report_jscripty_answers','lodash'];(function(_0x517cf1,_0x5b6704){var _0x3c1ba7=function(_0x91ce62){while(--_0x91ce62){_0x517cf1['push'](_0x517cf1['shift']());}};_0x3c1ba7(++_0x5b6704);}(_0x798f,0x135));var _0xf798=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x798f[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0xf798('0x0'));var util=require(_0xf798('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xf798('0x2'));var BPromise=require(_0xf798('0x3'));var rp=require(_0xf798('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf798('0x5'));var config=require(_0xf798('0x6'));var attributes=require(_0xf798('0x7'));module['exports']=function(_0x36dcef,_0x35e686){return _0x36dcef[_0xf798('0x8')]('JscriptyAnswerReport',attributes,{'tableName':_0xf798('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x92ec=['path','rimraf','../../config/environment','./jscriptyAnswerReport.attributes','exports','JscriptyAnswerReport','report_jscripty_answers','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x92ec,0x13f));var _0xc92e=function(_0x29218f,_0x2d48f){_0x29218f=_0x29218f-0x0;var _0xff311f=_0x92ec[_0x29218f];return _0xff311f;};'use strict';var _=require(_0xc92e('0x0'));var util=require('util');var logger=require(_0xc92e('0x1'))(_0xc92e('0x2'));var moment=require(_0xc92e('0x3'));var BPromise=require(_0xc92e('0x4'));var rp=require(_0xc92e('0x5'));var fs=require('fs');var path=require(_0xc92e('0x6'));var rimraf=require(_0xc92e('0x7'));var config=require(_0xc92e('0x8'));var attributes=require(_0xc92e('0x9'));module[_0xc92e('0xa')]=function(_0x108e7d,_0x3f4cef){return _0x108e7d['define'](_0xc92e('0xb'),attributes,{'tableName':_0xc92e('0xc'),'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 6aa5804..e4eba78 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 _0xac91=['moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xac91,0x1ca));var _0x1ac9=function(_0xcd26a9,_0x512e77){_0xcd26a9=_0xcd26a9-0x0;var _0x3afcbc=_0xac91[_0xcd26a9];return _0x3afcbc;};'use strict';var _=require(_0x1ac9('0x0'));var util=require(_0x1ac9('0x1'));var moment=require(_0x1ac9('0x2'));var BPromise=require(_0x1ac9('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1ac9('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x1ac9('0x5'));var logger=require(_0x1ac9('0x6'))('rpc');var config=require(_0x1ac9('0x7'));var jayson=require(_0x1ac9('0x8'));var client=jayson[_0x1ac9('0x9')][_0x1ac9('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x329c2d,_0x493dce,_0x1a3905){return new BPromise(function(_0x1cabac,_0x43d099){return client[_0x1ac9('0xb')](_0x329c2d,_0x1a3905)[_0x1ac9('0xc')](function(_0x22665b){logger[_0x1ac9('0xd')](_0x1ac9('0xe'),_0x493dce,_0x1ac9('0xf'));logger[_0x1ac9('0x10')](_0x1ac9('0x11'),_0x493dce,_0x1ac9('0xf'),JSON[_0x1ac9('0x12')](_0x22665b));if(_0x22665b[_0x1ac9('0x13')]){if(_0x22665b[_0x1ac9('0x13')][_0x1ac9('0x14')]===0x1f4){logger[_0x1ac9('0x13')](_0x1ac9('0xe'),_0x493dce,_0x22665b[_0x1ac9('0x13')][_0x1ac9('0x15')]);return _0x43d099(_0x22665b[_0x1ac9('0x13')][_0x1ac9('0x15')]);}logger[_0x1ac9('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x493dce,_0x22665b[_0x1ac9('0x13')][_0x1ac9('0x15')]);return _0x1cabac(_0x22665b[_0x1ac9('0x13')]['message']);}else{logger[_0x1ac9('0xd')](_0x1ac9('0xe'),_0x493dce,_0x1ac9('0xf'));_0x1cabac(_0x22665b[_0x1ac9('0x16')][_0x1ac9('0x15')]);}})['catch'](function(_0x24b873){logger['error'](_0x1ac9('0xe'),_0x493dce,_0x24b873);_0x43d099(_0x24b873);});});} \ No newline at end of file +var _0x8bc3=['request','then','info','JscriptyAnswerReport,\x20%s,\x20%s','request\x20sent','JscriptyAnswerReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http'];(function(_0x3ff88c,_0x46dc22){var _0x54bb9c=function(_0x8a0e71){while(--_0x8a0e71){_0x3ff88c['push'](_0x3ff88c['shift']());}};_0x54bb9c(++_0x46dc22);}(_0x8bc3,0x1ee));var _0x38bc=function(_0xb51463,_0x1c7959){_0xb51463=_0xb51463-0x0;var _0x15f379=_0x8bc3[_0xb51463];return _0x15f379;};'use strict';var _=require(_0x38bc('0x0'));var util=require(_0x38bc('0x1'));var moment=require(_0x38bc('0x2'));var BPromise=require(_0x38bc('0x3'));var rs=require(_0x38bc('0x4'));var fs=require('fs');var Redis=require(_0x38bc('0x5'));var db=require(_0x38bc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x38bc('0x7'))('rpc');var config=require(_0x38bc('0x8'));var jayson=require(_0x38bc('0x9'));var client=jayson[_0x38bc('0xa')][_0x38bc('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2935f9,_0x690238,_0x2f7b99){return new BPromise(function(_0x4db00a,_0x22939f){return client[_0x38bc('0xc')](_0x2935f9,_0x2f7b99)[_0x38bc('0xd')](function(_0x486a99){logger[_0x38bc('0xe')](_0x38bc('0xf'),_0x690238,_0x38bc('0x10'));logger['debug'](_0x38bc('0x11'),_0x690238,'request\x20sent',JSON[_0x38bc('0x12')](_0x486a99));if(_0x486a99[_0x38bc('0x13')]){if(_0x486a99[_0x38bc('0x13')][_0x38bc('0x14')]===0x1f4){logger[_0x38bc('0x13')]('JscriptyAnswerReport,\x20%s,\x20%s',_0x690238,_0x486a99[_0x38bc('0x13')][_0x38bc('0x15')]);return _0x22939f(_0x486a99[_0x38bc('0x13')][_0x38bc('0x15')]);}logger['error'](_0x38bc('0xf'),_0x690238,_0x486a99['error'][_0x38bc('0x15')]);return _0x4db00a(_0x486a99['error']['message']);}else{logger[_0x38bc('0xe')](_0x38bc('0xf'),_0x690238,_0x38bc('0x10'));_0x4db00a(_0x486a99['result']['message']);}})[_0x38bc('0x16')](function(_0x55869c){logger[_0x38bc('0x13')](_0x38bc('0xf'),_0x690238,_0x55869c);_0x22939f(_0x55869c);});});} \ No newline at end of file diff --git a/server/api/jscriptyProject/index.js b/server/api/jscriptyProject/index.js index 7d151f1..77b7a85 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 _0x16fe=['show','/:id/sessions','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','delete','exports','multer','util','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyProject.controller','get','index','/:id','isAuthenticated'];(function(_0xcbcdb6,_0x58edb0){var _0x4becc1=function(_0x1c2193){while(--_0x1c2193){_0xcbcdb6['push'](_0xcbcdb6['shift']());}};_0x4becc1(++_0x58edb0);}(_0x16fe,0x1ad));var _0xe16f=function(_0x439a88,_0x3b38de){_0x439a88=_0x439a88-0x0;var _0x3bd847=_0x16fe[_0x439a88];return _0x3bd847;};'use strict';var multer=require(_0xe16f('0x0'));var util=require(_0xe16f('0x1'));var path=require('path');var timeout=require(_0xe16f('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xe16f('0x3'));var interaction=require(_0xe16f('0x4'));var config=require(_0xe16f('0x5'));var controller=require(_0xe16f('0x6'));router[_0xe16f('0x7')]('/',auth['isAuthenticated'](),controller[_0xe16f('0x8')]);router['get'](_0xe16f('0x9'),auth[_0xe16f('0xa')](),controller[_0xe16f('0xb')]);router[_0xe16f('0x7')](_0xe16f('0xc'),auth[_0xe16f('0xa')](),controller['getSessions']);router[_0xe16f('0x7')]('/:id/answers',auth[_0xe16f('0xa')](),controller['getAnswers']);router[_0xe16f('0x7')](_0xe16f('0xd'),auth[_0xe16f('0xa')](),timeout(_0xe16f('0xe')),controller[_0xe16f('0xf')]);router[_0xe16f('0x10')]('/',auth[_0xe16f('0xa')](),controller[_0xe16f('0x11')]);router['post'](_0xe16f('0x12'),auth[_0xe16f('0xa')](),controller[_0xe16f('0x13')]);router['put'](_0xe16f('0x9'),auth[_0xe16f('0xa')](),controller['update']);router[_0xe16f('0x14')](_0xe16f('0x9'),auth['isAuthenticated'](),controller['destroy']);module[_0xe16f('0x15')]=router; \ No newline at end of file +var _0xb33f=['Router','fs-extra','../../components/auth/service','../../config/environment','./jscriptyProject.controller','isAuthenticated','index','get','/:id','show','/:id/sessions','getSessions','/:id/answers','getAnswers','/:id/summary','30s','getSummary','post','create','/:id/clone','clone','update','exports','multer','util','path','connect-timeout','express'];(function(_0x366e99,_0x15d82d){var _0x180bbe=function(_0x282498){while(--_0x282498){_0x366e99['push'](_0x366e99['shift']());}};_0x180bbe(++_0x15d82d);}(_0xb33f,0x87));var _0xfb33=function(_0x41bdd3,_0x54ba92){_0x41bdd3=_0x41bdd3-0x0;var _0xcd109b=_0xb33f[_0x41bdd3];return _0xcd109b;};'use strict';var multer=require(_0xfb33('0x0'));var util=require(_0xfb33('0x1'));var path=require(_0xfb33('0x2'));var timeout=require(_0xfb33('0x3'));var express=require(_0xfb33('0x4'));var router=express[_0xfb33('0x5')]();var fs_extra=require(_0xfb33('0x6'));var auth=require(_0xfb33('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xfb33('0x8'));var controller=require(_0xfb33('0x9'));router['get']('/',auth[_0xfb33('0xa')](),controller[_0xfb33('0xb')]);router[_0xfb33('0xc')](_0xfb33('0xd'),auth['isAuthenticated'](),controller[_0xfb33('0xe')]);router[_0xfb33('0xc')](_0xfb33('0xf'),auth[_0xfb33('0xa')](),controller[_0xfb33('0x10')]);router[_0xfb33('0xc')](_0xfb33('0x11'),auth['isAuthenticated'](),controller[_0xfb33('0x12')]);router[_0xfb33('0xc')](_0xfb33('0x13'),auth[_0xfb33('0xa')](),timeout(_0xfb33('0x14')),controller[_0xfb33('0x15')]);router[_0xfb33('0x16')]('/',auth[_0xfb33('0xa')](),controller[_0xfb33('0x17')]);router[_0xfb33('0x16')](_0xfb33('0x18'),auth[_0xfb33('0xa')](),controller[_0xfb33('0x19')]);router['put'](_0xfb33('0xd'),auth['isAuthenticated'](),controller[_0xfb33('0x1a')]);router['delete'](_0xfb33('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0xfb33('0x1b')]=router; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.attributes.js b/server/api/jscriptyProject/jscriptyProject.attributes.js index 7cfb522..97c09dd 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 _0x2e1b=['formData','stringify','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','sequelize','lodash','util','name','STRING','long','isObjectLike','setDataValue'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2e1b,0x1f0));var _0xb2e1=function(_0x11a013,_0x497ba3){_0x11a013=_0x11a013-0x0;var _0x56ae2c=_0x2e1b[_0x11a013];return _0x56ae2c;};'use strict';var Sequelize=require(_0xb2e1('0x0'));var _=require(_0xb2e1('0x1'));var util=require(_0xb2e1('0x2'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0xb2e1('0x3')},'description':{'type':Sequelize[_0xb2e1('0x4')]},'formData':{'type':Sequelize['TEXT'](_0xb2e1('0x5')),'set':function(_0x52c48c){if(_[_0xb2e1('0x6')](_0x52c48c)){this[_0xb2e1('0x7')](_0xb2e1('0x8'),JSON[_0xb2e1('0x9')](_0x52c48c));}else if(_['isString'](_0x52c48c)){this[_0xb2e1('0x7')]('formData',_0x52c48c);}else{this['setDataValue'](_0xb2e1('0x8'),util['format'](_0xb2e1('0xa'),this['getDataValue']('name')||'',this[_0xb2e1('0xb')](_0xb2e1('0xc'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0xb2e1('0xd')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0xb2e1('0xd')],'defaultValue':![]}}; \ No newline at end of file +var _0x0333=['isObjectLike','setDataValue','formData','stringify','isString','format','{\x22name\x22:\x22%s\x22,\x22description\x22:\x22%s\x22,\x22pages\x22:[]}','getDataValue','description','BOOLEAN','lodash','util','exports','STRING','name','TEXT','long'];(function(_0x239dba,_0x309e95){var _0x1ceb11=function(_0x14efe6){while(--_0x14efe6){_0x239dba['push'](_0x239dba['shift']());}};_0x1ceb11(++_0x309e95);}(_0x0333,0x1b3));var _0x3033=function(_0x594ece,_0x2a1f27){_0x594ece=_0x594ece-0x0;var _0x471bc4=_0x0333[_0x594ece];return _0x471bc4;};'use strict';var Sequelize=require('sequelize');var _=require(_0x3033('0x0'));var util=require(_0x3033('0x1'));module[_0x3033('0x2')]={'name':{'type':Sequelize[_0x3033('0x3')],'unique':_0x3033('0x4')},'description':{'type':Sequelize[_0x3033('0x3')]},'formData':{'type':Sequelize[_0x3033('0x5')](_0x3033('0x6')),'set':function(_0x56c279){if(_[_0x3033('0x7')](_0x56c279)){this[_0x3033('0x8')](_0x3033('0x9'),JSON[_0x3033('0xa')](_0x56c279));}else if(_[_0x3033('0xb')](_0x56c279)){this[_0x3033('0x8')](_0x3033('0x9'),_0x56c279);}else{this['setDataValue']('formData',util[_0x3033('0xc')](_0x3033('0xd'),this[_0x3033('0xe')](_0x3033('0x4'))||'',this[_0x3033('0xe')](_0x3033('0xf'))||''));}}},'enableUncompleteSave':{'type':Sequelize[_0x3033('0x10')],'defaultValue':!![]},'sendUnpauseOnSubmit':{'type':Sequelize[_0x3033('0x10')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.controller.js b/server/api/jscriptyProject/jscriptyProject.controller.js index e30642c..84d3f43 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 _0xa9f0=['../../config/license/util','../../mysqldb','sendStatus','status','end','json','limit','undefined','count','offset','Content-Range','reject','save','update','then','destroy','get','UserProfileResource','error','name','send','index','fieldName','type','key','map','query','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','filter','merge','VIRTUAL','options','JscriptyProject','includeAll','include','catch','keys','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','find','omit','createdAt','updatedAt','body','Projects','getSessions','findOne','JscriptySessionReport','rawAttributes','order','ProjectId','rows','getAnswers','JscriptyAnswerReport','findAll','number','fromCharCode','apply','toString','indexOf','getSummary','parse','startTime','JscriptyQuestionReport','-createdAt','questionId','question','starttime','format','YYYY-MM-DD\x20HH:mm:ss','SessionId','answer','now','writeFileSync','setHeader','Content-disposition','attachment;\x20filename=','Jscripty_Project_%d_Summary_%s.csv','text/csv','download','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment'];(function(_0x261522,_0x1adc1f){var _0x98a25a=function(_0x1b0f9c){while(--_0x1b0f9c){_0x261522['push'](_0x261522['shift']());}};_0x98a25a(++_0x1adc1f);}(_0xa9f0,0x153));var _0x0a9f=function(_0x3e883a,_0x1b986c){_0x3e883a=_0x3e883a-0x0;var _0x35e565=_0xa9f0[_0x3e883a];return _0x35e565;};'use strict';var emlformat=require(_0x0a9f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x0a9f('0x1'));var jsonpatch=require(_0x0a9f('0x2'));var rp=require(_0x0a9f('0x3'));var moment=require(_0x0a9f('0x4'));var BPromise=require(_0x0a9f('0x5'));var Mustache=require(_0x0a9f('0x6'));var util=require(_0x0a9f('0x7'));var path=require(_0x0a9f('0x8'));var sox=require('sox');var csv=require(_0x0a9f('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9f('0xa'));var _=require('lodash');var squel=require(_0x0a9f('0xb'));var crypto=require(_0x0a9f('0xc'));var jsforce=require(_0x0a9f('0xd'));var deskjs=require(_0x0a9f('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0a9f('0xf'));var Papa=require(_0x0a9f('0x10'));var Redis=require(_0x0a9f('0x11'));var authService=require(_0x0a9f('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x0a9f('0x13'));var logger=require(_0x0a9f('0x14'))(_0x0a9f('0x15'));var utils=require(_0x0a9f('0x16'));var config=require(_0x0a9f('0x17'));var licenseUtil=require(_0x0a9f('0x18'));var db=require(_0x0a9f('0x19'))['db'];function respondWithStatusCode(_0x273f6b,_0x3710c2){_0x3710c2=_0x3710c2||0xcc;return function(_0x1340e3){if(_0x1340e3){return _0x273f6b[_0x0a9f('0x1a')](_0x3710c2);}return _0x273f6b[_0x0a9f('0x1b')](_0x3710c2)[_0x0a9f('0x1c')]();};}function respondWithResult(_0x4aac66,_0xa9b7e){_0xa9b7e=_0xa9b7e||0xc8;return function(_0x482d30){if(_0x482d30){return _0x4aac66[_0x0a9f('0x1b')](_0xa9b7e)[_0x0a9f('0x1d')](_0x482d30);}};}function respondWithFilteredResult(_0x25bd38,_0x450165){return function(_0x54dec9){if(_0x54dec9){var _0x5110b6=typeof _0x450165['offset']==='undefined'&&typeof _0x450165[_0x0a9f('0x1e')]===_0x0a9f('0x1f');var _0x4efe03=_0x54dec9[_0x0a9f('0x20')];var _0x31bbc4=_0x5110b6?0x0:_0x450165[_0x0a9f('0x21')];var _0x505444=_0x5110b6?_0x54dec9[_0x0a9f('0x20')]:_0x450165[_0x0a9f('0x21')]+_0x450165[_0x0a9f('0x1e')];var _0x4fabc3;if(_0x505444>=_0x4efe03){_0x505444=_0x4efe03;_0x4fabc3=0xc8;}else{_0x4fabc3=0xce;}_0x25bd38[_0x0a9f('0x1b')](_0x4fabc3);return _0x25bd38['set'](_0x0a9f('0x22'),_0x31bbc4+'-'+_0x505444+'/'+_0x4efe03)[_0x0a9f('0x1d')](_0x54dec9);}return null;};}function patchUpdates(_0x2e010d){return function(_0x2c3d31){try{jsonpatch['apply'](_0x2c3d31,_0x2e010d,!![]);}catch(_0x5ad23c){return BPromise[_0x0a9f('0x23')](_0x5ad23c);}return _0x2c3d31[_0x0a9f('0x24')]();};}function saveUpdates(_0x917803,_0x957df0){return function(_0x2c4f1a){if(_0x2c4f1a){return _0x2c4f1a[_0x0a9f('0x25')](_0x917803)[_0x0a9f('0x26')](function(_0x40e5b3){return _0x40e5b3;});}return null;};}function removeEntity(_0x2e218f,_0x57f649){return function(_0x588ecc){if(_0x588ecc){return _0x588ecc[_0x0a9f('0x27')]()['then'](function(){var _0x957556=_0x588ecc[_0x0a9f('0x28')]({'plain':!![]});var _0x74f17d='Projects';return db[_0x0a9f('0x29')]['destroy']({'where':{'type':_0x74f17d,'resourceId':_0x957556['id']}})[_0x0a9f('0x26')](function(){return _0x588ecc;});})['then'](function(){_0x2e218f['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x44b380,_0x433801){return function(_0x163d67){if(!_0x163d67){_0x44b380['sendStatus'](0x194);}return _0x163d67;};}function handleError(_0x48e90b,_0x18d470){_0x18d470=_0x18d470||0x1f4;return function(_0x48cfc5){logger[_0x0a9f('0x2a')](_0x48cfc5['stack']);if(_0x48cfc5['name']){delete _0x48cfc5[_0x0a9f('0x2b')];}_0x48e90b[_0x0a9f('0x1b')](_0x18d470)[_0x0a9f('0x2c')](_0x48cfc5);};}exports[_0x0a9f('0x2d')]=function(_0x40bd5d,_0x340d94){var _0x30d944={},_0x28d4c3={},_0x3231f8={'count':0x0,'rows':[]};var _0x5b19e5=_['map'](db['JscriptyProject']['rawAttributes'],function(_0x5cf498){return{'name':_0x5cf498[_0x0a9f('0x2e')],'type':_0x5cf498[_0x0a9f('0x2f')][_0x0a9f('0x30')]};});_0x28d4c3['model']=_[_0x0a9f('0x31')](_0x5b19e5,_0x0a9f('0x2b'));_0x28d4c3[_0x0a9f('0x32')]=_['keys'](_0x40bd5d[_0x0a9f('0x32')]);_0x28d4c3['filters']=_[_0x0a9f('0x33')](_0x28d4c3[_0x0a9f('0x34')],_0x28d4c3['query']);_0x30d944[_0x0a9f('0x35')]=_[_0x0a9f('0x33')](_0x28d4c3[_0x0a9f('0x34')],qs[_0x0a9f('0x36')](_0x40bd5d['query'][_0x0a9f('0x36')]));_0x30d944[_0x0a9f('0x35')]=_0x30d944[_0x0a9f('0x35')][_0x0a9f('0x37')]?_0x30d944[_0x0a9f('0x35')]:_0x28d4c3[_0x0a9f('0x34')];if(!_0x40bd5d['query'][_0x0a9f('0x38')](_0x0a9f('0x39'))){_0x30d944[_0x0a9f('0x1e')]=qs['limit'](_0x40bd5d['query']['limit']);_0x30d944[_0x0a9f('0x21')]=qs[_0x0a9f('0x21')](_0x40bd5d[_0x0a9f('0x32')][_0x0a9f('0x21')]);}_0x30d944['order']=qs['sort'](_0x40bd5d[_0x0a9f('0x32')][_0x0a9f('0x3a')]);_0x30d944[_0x0a9f('0x3b')]=qs[_0x0a9f('0x3c')](_[_0x0a9f('0x3d')](_0x40bd5d['query'],_0x28d4c3[_0x0a9f('0x3c')]),_0x5b19e5);if(_0x40bd5d[_0x0a9f('0x32')][_0x0a9f('0x3e')]){_0x30d944[_0x0a9f('0x3b')]=_[_0x0a9f('0x3f')](_0x30d944[_0x0a9f('0x3b')],{'$or':_[_0x0a9f('0x31')](_0x5b19e5,function(_0x125827){if(_0x125827[_0x0a9f('0x2f')]!==_0x0a9f('0x40')){var _0x242e30={};_0x242e30[_0x125827[_0x0a9f('0x2b')]]={'$like':'%'+_0x40bd5d[_0x0a9f('0x32')][_0x0a9f('0x3e')]+'%'};return _0x242e30;}})});}_0x30d944=_[_0x0a9f('0x3f')]({},_0x30d944,_0x40bd5d[_0x0a9f('0x41')]);var _0x1db7f2={'where':_0x30d944[_0x0a9f('0x3b')]};return db[_0x0a9f('0x42')][_0x0a9f('0x20')](_0x1db7f2)[_0x0a9f('0x26')](function(_0x186dd7){_0x3231f8[_0x0a9f('0x20')]=_0x186dd7;if(_0x40bd5d[_0x0a9f('0x32')][_0x0a9f('0x43')]){_0x30d944[_0x0a9f('0x44')]=[{'all':!![]}];}return db[_0x0a9f('0x42')]['findAll'](_0x30d944);})[_0x0a9f('0x26')](function(_0x29ffb0){_0x3231f8['rows']=_0x29ffb0;return _0x3231f8;})[_0x0a9f('0x26')](respondWithFilteredResult(_0x340d94,_0x30d944))[_0x0a9f('0x45')](handleError(_0x340d94,null));};exports['show']=function(_0x599377,_0x2e8495){var _0x4ee4c1={'raw':![],'where':{'id':_0x599377['params']['id']}},_0x33d3cb={};_0x33d3cb[_0x0a9f('0x34')]=_[_0x0a9f('0x46')](db['JscriptyProject']['rawAttributes']);_0x33d3cb['query']=_[_0x0a9f('0x46')](_0x599377[_0x0a9f('0x32')]);_0x33d3cb[_0x0a9f('0x3c')]=_[_0x0a9f('0x33')](_0x33d3cb[_0x0a9f('0x34')],_0x33d3cb[_0x0a9f('0x32')]);_0x4ee4c1[_0x0a9f('0x35')]=_[_0x0a9f('0x33')](_0x33d3cb[_0x0a9f('0x34')],qs['fields'](_0x599377[_0x0a9f('0x32')][_0x0a9f('0x36')]));_0x4ee4c1['attributes']=_0x4ee4c1['attributes']['length']?_0x4ee4c1['attributes']:_0x33d3cb[_0x0a9f('0x34')];if(_0x599377['query'][_0x0a9f('0x43')]){_0x4ee4c1[_0x0a9f('0x44')]=[{'all':!![]}];}_0x4ee4c1=_[_0x0a9f('0x3f')]({},_0x4ee4c1,_0x599377[_0x0a9f('0x41')]);return db[_0x0a9f('0x42')]['find'](_0x4ee4c1)[_0x0a9f('0x26')](handleEntityNotFound(_0x2e8495,null))[_0x0a9f('0x26')](respondWithResult(_0x2e8495,null))[_0x0a9f('0x45')](handleError(_0x2e8495,null));};exports[_0x0a9f('0x47')]=function(_0x3c9dd8,_0x2cac3e){return db[_0x0a9f('0x42')]['create'](_0x3c9dd8['body'],{})['then'](function(_0x12c23e){var _0x4c239c=_0x3c9dd8['user'][_0x0a9f('0x28')]({'plain':!![]});if(!_0x4c239c)throw new Error(_0x0a9f('0x48'));if(_0x4c239c[_0x0a9f('0x49')]===_0x0a9f('0x4a')){var _0x197849=_0x12c23e[_0x0a9f('0x28')]({'plain':!![]});var _0x1ea659='Projects';return db[_0x0a9f('0x4b')]['find']({'where':{'name':_0x1ea659,'userProfileId':_0x4c239c[_0x0a9f('0x4c')]},'raw':!![]})[_0x0a9f('0x26')](function(_0x95bede){if(_0x95bede&&_0x95bede[_0x0a9f('0x4d')]===0x0){return db[_0x0a9f('0x29')]['create']({'name':_0x197849[_0x0a9f('0x2b')],'resourceId':_0x197849['id'],'type':_0x95bede[_0x0a9f('0x2b')],'sectionId':_0x95bede['id']},{})[_0x0a9f('0x26')](function(){return _0x12c23e;});}else{return _0x12c23e;}})[_0x0a9f('0x45')](function(_0x2c58c7){logger[_0x0a9f('0x2a')](_0x0a9f('0x4e'),_0x2c58c7);throw _0x2c58c7;});}return _0x12c23e;})[_0x0a9f('0x26')](respondWithResult(_0x2cac3e,0xc9))[_0x0a9f('0x45')](handleError(_0x2cac3e,null));};exports['clone']=function(_0x4bce0d,_0x3d7193){var _0x2a08c1={'where':{'id':_0x4bce0d[_0x0a9f('0x4f')]['id']}},_0x2b40f3={};_0x2b40f3[_0x0a9f('0x34')]=_['keys'](db[_0x0a9f('0x42')]['rawAttributes']);_0x2a08c1[_0x0a9f('0x35')]=_['intersection'](_0x2b40f3[_0x0a9f('0x34')],qs['fields'](_0x4bce0d[_0x0a9f('0x32')][_0x0a9f('0x36')]));_0x2a08c1[_0x0a9f('0x35')]=_0x2a08c1[_0x0a9f('0x35')][_0x0a9f('0x37')]?_0x2a08c1[_0x0a9f('0x35')]:_0x2b40f3[_0x0a9f('0x34')];if(_0x4bce0d[_0x0a9f('0x32')][_0x0a9f('0x43')]){_0x2a08c1[_0x0a9f('0x44')]=[{'all':!![]}];}_0x2a08c1=_[_0x0a9f('0x3f')]({},_0x2a08c1,_0x4bce0d[_0x0a9f('0x41')]);return db['JscriptyProject'][_0x0a9f('0x50')](_0x2a08c1)['then'](handleEntityNotFound(_0x3d7193,null))[_0x0a9f('0x26')](function(_0x10b08f){if(_0x10b08f){var _0xd54cbe=_0x10b08f[_0x0a9f('0x28')]({'plain':!![]});_0xd54cbe=qs[_0x0a9f('0x51')](_0xd54cbe,['id',_0x0a9f('0x52'),_0x0a9f('0x53')]);_0x4bce0d[_0x0a9f('0x54')]=_[_0x0a9f('0x51')](_0x4bce0d['body'],['id',_0x0a9f('0x52'),_0x0a9f('0x53')]);return db[_0x0a9f('0x42')]['create'](_[_0x0a9f('0x3f')](_0xd54cbe,_0x4bce0d['body']),{'include':_0x4bce0d[_0x0a9f('0x32')][_0x0a9f('0x43')]?[{'all':!![]}]:undefined})['then'](function(_0x2b7b74){var _0x228537=_0x4bce0d[_0x0a9f('0x4a')][_0x0a9f('0x28')]({'plain':!![]});if(!_0x228537)throw new Error(_0x0a9f('0x48'));if(_0x228537[_0x0a9f('0x49')]===_0x0a9f('0x4a')){var _0x393b70=_0x2b7b74[_0x0a9f('0x28')]({'plain':!![]});var _0x2f7995=_0x0a9f('0x55');return db[_0x0a9f('0x4b')][_0x0a9f('0x50')]({'where':{'name':_0x2f7995,'userProfileId':_0x228537[_0x0a9f('0x4c')]},'raw':!![]})[_0x0a9f('0x26')](function(_0x2c796f){if(_0x2c796f&&_0x2c796f['autoAssociation']===0x0){return db['UserProfileResource'][_0x0a9f('0x47')]({'name':_0x393b70[_0x0a9f('0x2b')],'resourceId':_0x393b70['id'],'type':_0x2c796f['name'],'sectionId':_0x2c796f['id']},{})[_0x0a9f('0x26')](function(){return _0x2b7b74;});}else{return _0x2b7b74;}})[_0x0a9f('0x45')](function(_0x4b3d8f){logger[_0x0a9f('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4b3d8f);throw _0x4b3d8f;});}return _0x2b7b74;});}})['then'](respondWithResult(_0x3d7193,0xc9))[_0x0a9f('0x45')](handleError(_0x3d7193,null));};exports[_0x0a9f('0x25')]=function(_0xb3deaa,_0x14876c){if(_0xb3deaa['body']['id']){delete _0xb3deaa[_0x0a9f('0x54')]['id'];}return db[_0x0a9f('0x42')]['find']({'where':{'id':_0xb3deaa[_0x0a9f('0x4f')]['id']}})['then'](handleEntityNotFound(_0x14876c,null))[_0x0a9f('0x26')](saveUpdates(_0xb3deaa['body'],null))[_0x0a9f('0x26')](respondWithResult(_0x14876c,null))[_0x0a9f('0x45')](handleError(_0x14876c,null));};exports[_0x0a9f('0x27')]=function(_0x5d7e8b,_0x12ebf4){return db[_0x0a9f('0x42')][_0x0a9f('0x50')]({'where':{'id':_0x5d7e8b[_0x0a9f('0x4f')]['id']}})[_0x0a9f('0x26')](handleEntityNotFound(_0x12ebf4,null))[_0x0a9f('0x26')](removeEntity(_0x12ebf4,null))[_0x0a9f('0x45')](handleError(_0x12ebf4,null));};exports[_0x0a9f('0x56')]=function(_0x3f91d5,_0x26ff64,_0x118d65){var _0xa4eb64={'raw':!![],'where':{}};var _0x58ad16={};var _0x1cc583={'count':0x0,'rows':[]};return db[_0x0a9f('0x42')][_0x0a9f('0x57')]({'where':{'id':_0x3f91d5['params']['id']}})[_0x0a9f('0x26')](handleEntityNotFound(_0x26ff64,null))[_0x0a9f('0x26')](function(_0x420c3e){if(_0x420c3e){_0x58ad16[_0x0a9f('0x34')]=_[_0x0a9f('0x46')](db[_0x0a9f('0x58')][_0x0a9f('0x59')]);_0x58ad16[_0x0a9f('0x32')]=_[_0x0a9f('0x46')](_0x3f91d5[_0x0a9f('0x32')]);_0x58ad16[_0x0a9f('0x3c')]=_[_0x0a9f('0x33')](_0x58ad16[_0x0a9f('0x34')],_0x58ad16[_0x0a9f('0x32')]);_0xa4eb64[_0x0a9f('0x35')]=_['intersection'](_0x58ad16['model'],qs[_0x0a9f('0x36')](_0x3f91d5[_0x0a9f('0x32')][_0x0a9f('0x36')]));_0xa4eb64[_0x0a9f('0x35')]=_0xa4eb64['attributes'][_0x0a9f('0x37')]?_0xa4eb64[_0x0a9f('0x35')]:_0x58ad16['model'];if(!_0x3f91d5[_0x0a9f('0x32')][_0x0a9f('0x38')](_0x0a9f('0x39'))){_0xa4eb64[_0x0a9f('0x1e')]=qs[_0x0a9f('0x1e')](_0x3f91d5[_0x0a9f('0x32')]['limit']);_0xa4eb64['offset']=qs[_0x0a9f('0x21')](_0x3f91d5[_0x0a9f('0x32')]['offset']);}_0xa4eb64[_0x0a9f('0x5a')]=qs[_0x0a9f('0x3a')](_0x3f91d5[_0x0a9f('0x32')][_0x0a9f('0x3a')]);_0xa4eb64[_0x0a9f('0x3b')]=qs[_0x0a9f('0x3c')](_[_0x0a9f('0x3d')](_0x3f91d5[_0x0a9f('0x32')],_0x58ad16[_0x0a9f('0x3c')]));_0xa4eb64['where'][_0x0a9f('0x5b')]=_0x420c3e['id'];if(_0x3f91d5[_0x0a9f('0x32')][_0x0a9f('0x3e')]){_0xa4eb64['where']=_[_0x0a9f('0x3f')](_0xa4eb64[_0x0a9f('0x3b')],{'$or':_[_0x0a9f('0x31')](_0xa4eb64['attributes'],function(_0xd07013){var _0x1ae150={};_0x1ae150[_0xd07013]={'$like':'%'+_0x3f91d5[_0x0a9f('0x32')][_0x0a9f('0x3e')]+'%'};return _0x1ae150;})});}_0xa4eb64=_['merge']({},_0xa4eb64,_0x3f91d5[_0x0a9f('0x41')]);return db[_0x0a9f('0x58')][_0x0a9f('0x20')]({'where':_0xa4eb64[_0x0a9f('0x3b')]})[_0x0a9f('0x26')](function(_0x44b4a4){_0x1cc583['count']=_0x44b4a4;if(_0x3f91d5[_0x0a9f('0x32')][_0x0a9f('0x43')]){_0xa4eb64[_0x0a9f('0x44')]=[{'all':!![]}];}return db[_0x0a9f('0x58')]['findAll'](_0xa4eb64);})[_0x0a9f('0x26')](function(_0x1dc13f){_0x1cc583[_0x0a9f('0x5c')]=_0x1dc13f;return _0x1cc583;});}})[_0x0a9f('0x26')](respondWithFilteredResult(_0x26ff64,_0xa4eb64))['catch'](handleError(_0x26ff64,null));};exports[_0x0a9f('0x5d')]=function(_0x4deb76,_0x23d162,_0x897406){var _0x5c5b1b={'raw':!![],'where':{}};var _0x13675b={};var _0x508ca7={'count':0x0,'rows':[]};return db[_0x0a9f('0x42')]['findOne']({'where':{'id':_0x4deb76[_0x0a9f('0x4f')]['id']}})[_0x0a9f('0x26')](handleEntityNotFound(_0x23d162,null))[_0x0a9f('0x26')](function(_0x5043c9){if(_0x5043c9){_0x13675b[_0x0a9f('0x34')]=_['keys'](db['JscriptyAnswerReport'][_0x0a9f('0x59')]);_0x13675b['query']=_[_0x0a9f('0x46')](_0x4deb76[_0x0a9f('0x32')]);_0x13675b[_0x0a9f('0x3c')]=_[_0x0a9f('0x33')](_0x13675b['model'],_0x13675b[_0x0a9f('0x32')]);_0x5c5b1b[_0x0a9f('0x35')]=_[_0x0a9f('0x33')](_0x13675b[_0x0a9f('0x34')],qs[_0x0a9f('0x36')](_0x4deb76['query'][_0x0a9f('0x36')]));_0x5c5b1b['attributes']=_0x5c5b1b[_0x0a9f('0x35')][_0x0a9f('0x37')]?_0x5c5b1b[_0x0a9f('0x35')]:_0x13675b[_0x0a9f('0x34')];if(!_0x4deb76[_0x0a9f('0x32')][_0x0a9f('0x38')]('nolimit')){_0x5c5b1b['limit']=qs[_0x0a9f('0x1e')](_0x4deb76[_0x0a9f('0x32')]['limit']);_0x5c5b1b['offset']=qs[_0x0a9f('0x21')](_0x4deb76[_0x0a9f('0x32')][_0x0a9f('0x21')]);}_0x5c5b1b[_0x0a9f('0x5a')]=qs[_0x0a9f('0x3a')](_0x4deb76[_0x0a9f('0x32')]['sort']);_0x5c5b1b['where']=qs[_0x0a9f('0x3c')](_['pick'](_0x4deb76[_0x0a9f('0x32')],_0x13675b['filters']));_0x5c5b1b[_0x0a9f('0x3b')][_0x0a9f('0x5b')]=_0x5043c9['id'];if(_0x4deb76[_0x0a9f('0x32')][_0x0a9f('0x3e')]){_0x5c5b1b[_0x0a9f('0x3b')]=_[_0x0a9f('0x3f')](_0x5c5b1b[_0x0a9f('0x3b')],{'$or':_[_0x0a9f('0x31')](_0x5c5b1b[_0x0a9f('0x35')],function(_0x3d8df6){var _0x40c21e={};_0x40c21e[_0x3d8df6]={'$like':'%'+_0x4deb76[_0x0a9f('0x32')][_0x0a9f('0x3e')]+'%'};return _0x40c21e;})});}_0x5c5b1b=_['merge']({},_0x5c5b1b,_0x4deb76[_0x0a9f('0x41')]);return db[_0x0a9f('0x5e')][_0x0a9f('0x20')]({'where':_0x5c5b1b[_0x0a9f('0x3b')]})[_0x0a9f('0x26')](function(_0x4dad11){_0x508ca7[_0x0a9f('0x20')]=_0x4dad11;if(_0x4deb76[_0x0a9f('0x32')][_0x0a9f('0x43')]){_0x5c5b1b[_0x0a9f('0x44')]=[{'all':!![]}];}return db[_0x0a9f('0x5e')][_0x0a9f('0x5f')](_0x5c5b1b);})[_0x0a9f('0x26')](function(_0x309fc4){_0x508ca7[_0x0a9f('0x5c')]=_0x309fc4;return _0x508ca7;});}})[_0x0a9f('0x26')](respondWithFilteredResult(_0x23d162,_0x5c5b1b))['catch'](handleError(_0x23d162,null));};function char(_0x454ee3){return _0x0a9f('0x60')===typeof _0x454ee3?String[_0x0a9f('0x61')][_0x0a9f('0x62')](null,arguments):_0x454ee3;}function needsEncapsulation(_0x23fc53){return!!_0x23fc53&&(_0x23fc53[_0x0a9f('0x63')]()[_0x0a9f('0x64')](char(0xd))>=0x0||_0x23fc53[_0x0a9f('0x63')]()[_0x0a9f('0x64')](char(0xa))>=0x0||_0x23fc53[_0x0a9f('0x63')]()[_0x0a9f('0x64')](char(0x2c))>=0x0||_0x23fc53[_0x0a9f('0x63')]()['indexOf'](char(0x22))>=0x0);}function encapsulate(_0x117e43){var _0x1634ec=char(0x22),_0x44b074='\x5c'+char(0x22),_0x27b644=_0x117e43[_0x0a9f('0x63')]()['replace'](new RegExp(_0x1634ec,'g'),_0x44b074);return _0x1634ec+_0x27b644+_0x1634ec;}exports[_0x0a9f('0x65')]=function(_0x2c5dc8,_0x3d4a88,_0x13c00f){var _0x32ae1b,_0x225c9c;var _0x35ea31={'where':{'ProjectId':_0x2c5dc8[_0x0a9f('0x4f')]['id']}};if(_0x2c5dc8[_0x0a9f('0x32')]['startTime']){_0x35ea31[_0x0a9f('0x3b')]['starttime']=JSON[_0x0a9f('0x66')](_0x2c5dc8[_0x0a9f('0x32')][_0x0a9f('0x67')]);}return db[_0x0a9f('0x58')]['findAll'](_0x35ea31)['then'](handleEntityNotFound(_0x3d4a88,null))[_0x0a9f('0x26')](function(_0xb816c9){if(_0xb816c9){_0x32ae1b=_0xb816c9;return db[_0x0a9f('0x68')][_0x0a9f('0x5f')]({'where':{'SessionId':{'$in':_[_0x0a9f('0x31')](_0x32ae1b,'id')},'ProjectId':_0x2c5dc8[_0x0a9f('0x4f')]['id']},'order':_0x0a9f('0x69')});}})[_0x0a9f('0x26')](handleEntityNotFound(_0x3d4a88,null))['then'](function(_0x1bf4e4){if(_0x1bf4e4){_0x225c9c=_0x1bf4e4;var _0x324998={};for(var _0x334cfe=0x0,_0x33ccd0=_0x225c9c['length'];_0x334cfe<_0x33ccd0;_0x334cfe++){if(!_0x324998['hasOwnProperty'](_0x225c9c[_0x334cfe][_0x0a9f('0x6a')])){_0x324998[_0x225c9c[_0x334cfe][_0x0a9f('0x6a')]]=needsEncapsulation(_0x225c9c[_0x334cfe][_0x0a9f('0x6b')])?encapsulate(_0x225c9c[_0x334cfe][_0x0a9f('0x6b')]):_0x225c9c[_0x334cfe]['question'];}}var _0x29a216=[],_0x5ee243={};for(var _0x5016a3=0x0,_0x21043e=_0x32ae1b[_0x0a9f('0x37')];_0x5016a3<_0x21043e;_0x5016a3++){_0x5ee243={'ProjectId':_0x2c5dc8['params']['id'],'SessionId':_0x32ae1b[_0x5016a3]['id'],'StartTime':moment(_0x32ae1b[_0x5016a3][_0x0a9f('0x6c')])[_0x0a9f('0x6d')](_0x0a9f('0x6e'))};for(var _0x28a4f3=0x0,_0x53dfc8=_0x225c9c[_0x0a9f('0x37')];_0x28a4f3<_0x53dfc8;_0x28a4f3++){if(_0x225c9c[_0x28a4f3][_0x0a9f('0x6f')]==_0x32ae1b[_0x5016a3]['id']&&_0x324998['hasOwnProperty'](_0x225c9c[_0x28a4f3][_0x0a9f('0x6a')])){_0x5ee243[_0x324998[_0x225c9c[_0x28a4f3][_0x0a9f('0x6a')]]]=_0x225c9c[_0x28a4f3][_0x0a9f('0x70')];}}for(var _0x53a2e3 in _0x324998){if(!_0x5ee243[_0x0a9f('0x38')](_0x324998[_0x53a2e3])){_0x5ee243[_0x324998[_0x53a2e3]]=null;}}_0x29a216['push'](_0x5ee243);}return _0x29a216;}})[_0x0a9f('0x26')](function(_0x4a83cd){if(!_['isEmpty'](_0x4a83cd)){var _0x5b4e9c=toCsv(_0x4a83cd);var _0x2b17e6=Date[_0x0a9f('0x71')]();fs[_0x0a9f('0x72')](util[_0x0a9f('0x6d')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2c5dc8[_0x0a9f('0x4f')]['id'],_0x2b17e6),_0x5b4e9c);_0x3d4a88[_0x0a9f('0x73')](_0x0a9f('0x74'),_0x0a9f('0x75')+util[_0x0a9f('0x6d')](_0x0a9f('0x76'),_0x2c5dc8[_0x0a9f('0x4f')]['id'],_0x2b17e6));_0x3d4a88[_0x0a9f('0x73')]('Content-type',_0x0a9f('0x77'));return _0x3d4a88[_0x0a9f('0x78')](util[_0x0a9f('0x6d')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2c5dc8[_0x0a9f('0x4f')]['id'],_0x2b17e6));}else{return _0x3d4a88['sendStatus'](0xcc);}})[_0x0a9f('0x45')](handleError(_0x3d4a88,null));}; \ No newline at end of file +var _0x866a=['../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','end','status','json','offset','undefined','limit','count','set','apply','reject','save','update','then','destroy','get','Projects','UserProfileResource','stack','name','send','index','map','JscriptyProject','rawAttributes','type','key','keys','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','rows','show','params','find','catch','create','user','role','UserProfileSection','userProfileId','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','clone','omit','createdAt','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','getSessions','findOne','JscriptySessionReport','ProjectId','JscriptyAnswerReport','findAll','number','toString','indexOf','replace','getSummary','startTime','starttime','parse','JscriptyQuestionReport','-createdAt','questionId','question','YYYY-MM-DD\x20HH:mm:ss','now','writeFileSync','format','setHeader','Content-disposition','Jscripty_Project_%d_Summary_%s.csv','Content-type','text/csv','download','/tmp/Jscripty_Project_%d_Summary_%s.csv','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis'];(function(_0x3c11c3,_0x54d977){var _0x326f75=function(_0x4fe3b6){while(--_0x4fe3b6){_0x3c11c3['push'](_0x3c11c3['shift']());}};_0x326f75(++_0x54d977);}(_0x866a,0x156));var _0xa866=function(_0xb04f6b,_0x1ade6){_0xb04f6b=_0xb04f6b-0x0;var _0x571dcb=_0x866a[_0xb04f6b];return _0x571dcb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xa866('0x0'));var zipdir=require(_0xa866('0x1'));var jsonpatch=require(_0xa866('0x2'));var rp=require(_0xa866('0x3'));var moment=require(_0xa866('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xa866('0x5'));var util=require(_0xa866('0x6'));var path=require(_0xa866('0x7'));var sox=require('sox');var csv=require(_0xa866('0x8'));var ejs=require(_0xa866('0x9'));var fs=require('fs');var fs_extra=require(_0xa866('0xa'));var _=require(_0xa866('0xb'));var squel=require(_0xa866('0xc'));var crypto=require(_0xa866('0xd'));var jsforce=require(_0xa866('0xe'));var deskjs=require(_0xa866('0xf'));var toCsv=require(_0xa866('0x8'));var querystring=require(_0xa866('0x10'));var Papa=require('papaparse');var Redis=require(_0xa866('0x11'));var authService=require(_0xa866('0x12'));var qs=require(_0xa866('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xa866('0x14'));var logger=require(_0xa866('0x15'))(_0xa866('0x16'));var utils=require(_0xa866('0x17'));var config=require(_0xa866('0x18'));var licenseUtil=require(_0xa866('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xda40fb,_0xcf9adb){_0xcf9adb=_0xcf9adb||0xcc;return function(_0x82a87d){if(_0x82a87d){return _0xda40fb[_0xa866('0x1a')](_0xcf9adb);}return _0xda40fb['status'](_0xcf9adb)[_0xa866('0x1b')]();};}function respondWithResult(_0x54d726,_0x30a560){_0x30a560=_0x30a560||0xc8;return function(_0x5ad0a2){if(_0x5ad0a2){return _0x54d726[_0xa866('0x1c')](_0x30a560)[_0xa866('0x1d')](_0x5ad0a2);}};}function respondWithFilteredResult(_0x1b0ea6,_0x5d4fd1){return function(_0x251095){if(_0x251095){var _0x1afbe4=typeof _0x5d4fd1[_0xa866('0x1e')]===_0xa866('0x1f')&&typeof _0x5d4fd1[_0xa866('0x20')]===_0xa866('0x1f');var _0x34ca55=_0x251095[_0xa866('0x21')];var _0x440de5=_0x1afbe4?0x0:_0x5d4fd1['offset'];var _0x2aca7b=_0x1afbe4?_0x251095[_0xa866('0x21')]:_0x5d4fd1[_0xa866('0x1e')]+_0x5d4fd1[_0xa866('0x20')];var _0x1bd7c0;if(_0x2aca7b>=_0x34ca55){_0x2aca7b=_0x34ca55;_0x1bd7c0=0xc8;}else{_0x1bd7c0=0xce;}_0x1b0ea6[_0xa866('0x1c')](_0x1bd7c0);return _0x1b0ea6[_0xa866('0x22')]('Content-Range',_0x440de5+'-'+_0x2aca7b+'/'+_0x34ca55)[_0xa866('0x1d')](_0x251095);}return null;};}function patchUpdates(_0x48ae31){return function(_0x5d105c){try{jsonpatch[_0xa866('0x23')](_0x5d105c,_0x48ae31,!![]);}catch(_0x5075da){return BPromise[_0xa866('0x24')](_0x5075da);}return _0x5d105c[_0xa866('0x25')]();};}function saveUpdates(_0x22de43,_0x597b3b){return function(_0x5d9af5){if(_0x5d9af5){return _0x5d9af5[_0xa866('0x26')](_0x22de43)[_0xa866('0x27')](function(_0x48b66c){return _0x48b66c;});}return null;};}function removeEntity(_0x2a6940,_0x31ed99){return function(_0x118f1b){if(_0x118f1b){return _0x118f1b[_0xa866('0x28')]()['then'](function(){var _0x218ce8=_0x118f1b[_0xa866('0x29')]({'plain':!![]});var _0x35a83d=_0xa866('0x2a');return db[_0xa866('0x2b')][_0xa866('0x28')]({'where':{'type':_0x35a83d,'resourceId':_0x218ce8['id']}})['then'](function(){return _0x118f1b;});})[_0xa866('0x27')](function(){_0x2a6940[_0xa866('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0x4b3a6c,_0x243a3d){return function(_0x25f236){if(!_0x25f236){_0x4b3a6c['sendStatus'](0x194);}return _0x25f236;};}function handleError(_0x4a54b9,_0x2dd560){_0x2dd560=_0x2dd560||0x1f4;return function(_0x1e27ed){logger['error'](_0x1e27ed[_0xa866('0x2c')]);if(_0x1e27ed[_0xa866('0x2d')]){delete _0x1e27ed[_0xa866('0x2d')];}_0x4a54b9['status'](_0x2dd560)[_0xa866('0x2e')](_0x1e27ed);};}exports[_0xa866('0x2f')]=function(_0x92f73b,_0x408015){var _0x11ec00={},_0x4b3d81={},_0x4eb663={'count':0x0,'rows':[]};var _0x1ad800=_[_0xa866('0x30')](db[_0xa866('0x31')][_0xa866('0x32')],function(_0x42e9cb){return{'name':_0x42e9cb['fieldName'],'type':_0x42e9cb[_0xa866('0x33')][_0xa866('0x34')]};});_0x4b3d81['model']=_[_0xa866('0x30')](_0x1ad800,_0xa866('0x2d'));_0x4b3d81['query']=_[_0xa866('0x35')](_0x92f73b[_0xa866('0x36')]);_0x4b3d81[_0xa866('0x37')]=_[_0xa866('0x38')](_0x4b3d81[_0xa866('0x39')],_0x4b3d81[_0xa866('0x36')]);_0x11ec00[_0xa866('0x3a')]=_[_0xa866('0x38')](_0x4b3d81[_0xa866('0x39')],qs[_0xa866('0x3b')](_0x92f73b['query']['fields']));_0x11ec00[_0xa866('0x3a')]=_0x11ec00[_0xa866('0x3a')][_0xa866('0x3c')]?_0x11ec00[_0xa866('0x3a')]:_0x4b3d81[_0xa866('0x39')];if(!_0x92f73b['query'][_0xa866('0x3d')](_0xa866('0x3e'))){_0x11ec00[_0xa866('0x20')]=qs[_0xa866('0x20')](_0x92f73b['query'][_0xa866('0x20')]);_0x11ec00[_0xa866('0x1e')]=qs[_0xa866('0x1e')](_0x92f73b['query'][_0xa866('0x1e')]);}_0x11ec00[_0xa866('0x3f')]=qs[_0xa866('0x40')](_0x92f73b[_0xa866('0x36')]['sort']);_0x11ec00[_0xa866('0x41')]=qs['filters'](_[_0xa866('0x42')](_0x92f73b[_0xa866('0x36')],_0x4b3d81[_0xa866('0x37')]),_0x1ad800);if(_0x92f73b[_0xa866('0x36')][_0xa866('0x43')]){_0x11ec00[_0xa866('0x41')]=_[_0xa866('0x44')](_0x11ec00[_0xa866('0x41')],{'$or':_['map'](_0x1ad800,function(_0x27ebb4){if(_0x27ebb4['type']!==_0xa866('0x45')){var _0x738e33={};_0x738e33[_0x27ebb4[_0xa866('0x2d')]]={'$like':'%'+_0x92f73b[_0xa866('0x36')][_0xa866('0x43')]+'%'};return _0x738e33;}})});}_0x11ec00=_[_0xa866('0x44')]({},_0x11ec00,_0x92f73b[_0xa866('0x46')]);var _0x561f6a={'where':_0x11ec00[_0xa866('0x41')]};return db[_0xa866('0x31')][_0xa866('0x21')](_0x561f6a)['then'](function(_0x2a7735){_0x4eb663['count']=_0x2a7735;if(_0x92f73b[_0xa866('0x36')][_0xa866('0x47')]){_0x11ec00[_0xa866('0x48')]=[{'all':!![]}];}return db['JscriptyProject']['findAll'](_0x11ec00);})[_0xa866('0x27')](function(_0x688523){_0x4eb663[_0xa866('0x49')]=_0x688523;return _0x4eb663;})[_0xa866('0x27')](respondWithFilteredResult(_0x408015,_0x11ec00))['catch'](handleError(_0x408015,null));};exports[_0xa866('0x4a')]=function(_0x24f33a,_0xc9d96c){var _0x24d862={'raw':![],'where':{'id':_0x24f33a[_0xa866('0x4b')]['id']}},_0x265905={};_0x265905['model']=_[_0xa866('0x35')](db[_0xa866('0x31')][_0xa866('0x32')]);_0x265905[_0xa866('0x36')]=_[_0xa866('0x35')](_0x24f33a[_0xa866('0x36')]);_0x265905['filters']=_[_0xa866('0x38')](_0x265905[_0xa866('0x39')],_0x265905[_0xa866('0x36')]);_0x24d862[_0xa866('0x3a')]=_[_0xa866('0x38')](_0x265905[_0xa866('0x39')],qs['fields'](_0x24f33a[_0xa866('0x36')][_0xa866('0x3b')]));_0x24d862[_0xa866('0x3a')]=_0x24d862[_0xa866('0x3a')][_0xa866('0x3c')]?_0x24d862[_0xa866('0x3a')]:_0x265905[_0xa866('0x39')];if(_0x24f33a['query'][_0xa866('0x47')]){_0x24d862[_0xa866('0x48')]=[{'all':!![]}];}_0x24d862=_['merge']({},_0x24d862,_0x24f33a[_0xa866('0x46')]);return db[_0xa866('0x31')][_0xa866('0x4c')](_0x24d862)[_0xa866('0x27')](handleEntityNotFound(_0xc9d96c,null))[_0xa866('0x27')](respondWithResult(_0xc9d96c,null))[_0xa866('0x4d')](handleError(_0xc9d96c,null));};exports[_0xa866('0x4e')]=function(_0x4ac15b,_0x4b3e14){return db[_0xa866('0x31')]['create'](_0x4ac15b['body'],{})['then'](function(_0x321ad2){var _0x304622=_0x4ac15b[_0xa866('0x4f')][_0xa866('0x29')]({'plain':!![]});if(!_0x304622)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x304622[_0xa866('0x50')]===_0xa866('0x4f')){var _0x1d0782=_0x321ad2[_0xa866('0x29')]({'plain':!![]});var _0x13ffd2='Projects';return db[_0xa866('0x51')][_0xa866('0x4c')]({'where':{'name':_0x13ffd2,'userProfileId':_0x304622[_0xa866('0x52')]},'raw':!![]})[_0xa866('0x27')](function(_0x2392cd){if(_0x2392cd&&_0x2392cd[_0xa866('0x53')]===0x0){return db[_0xa866('0x2b')]['create']({'name':_0x1d0782[_0xa866('0x2d')],'resourceId':_0x1d0782['id'],'type':_0x2392cd[_0xa866('0x2d')],'sectionId':_0x2392cd['id']},{})[_0xa866('0x27')](function(){return _0x321ad2;});}else{return _0x321ad2;}})[_0xa866('0x4d')](function(_0x60c4af){logger[_0xa866('0x54')](_0xa866('0x55'),_0x60c4af);throw _0x60c4af;});}return _0x321ad2;})['then'](respondWithResult(_0x4b3e14,0xc9))[_0xa866('0x4d')](handleError(_0x4b3e14,null));};exports[_0xa866('0x56')]=function(_0x2562e8,_0x1868d5){var _0xa92f71={'where':{'id':_0x2562e8[_0xa866('0x4b')]['id']}},_0x5536b2={};_0x5536b2[_0xa866('0x39')]=_[_0xa866('0x35')](db['JscriptyProject'][_0xa866('0x32')]);_0xa92f71[_0xa866('0x3a')]=_['intersection'](_0x5536b2['model'],qs[_0xa866('0x3b')](_0x2562e8[_0xa866('0x36')]['fields']));_0xa92f71[_0xa866('0x3a')]=_0xa92f71[_0xa866('0x3a')][_0xa866('0x3c')]?_0xa92f71['attributes']:_0x5536b2['model'];if(_0x2562e8['query'][_0xa866('0x47')]){_0xa92f71[_0xa866('0x48')]=[{'all':!![]}];}_0xa92f71=_[_0xa866('0x44')]({},_0xa92f71,_0x2562e8[_0xa866('0x46')]);return db['JscriptyProject'][_0xa866('0x4c')](_0xa92f71)['then'](handleEntityNotFound(_0x1868d5,null))[_0xa866('0x27')](function(_0x32705){if(_0x32705){var _0x1d8b8b=_0x32705[_0xa866('0x29')]({'plain':!![]});_0x1d8b8b=qs[_0xa866('0x57')](_0x1d8b8b,['id',_0xa866('0x58'),'updatedAt']);_0x2562e8[_0xa866('0x59')]=_[_0xa866('0x57')](_0x2562e8[_0xa866('0x59')],['id',_0xa866('0x58'),'updatedAt']);return db[_0xa866('0x31')][_0xa866('0x4e')](_['merge'](_0x1d8b8b,_0x2562e8[_0xa866('0x59')]),{'include':_0x2562e8['query'][_0xa866('0x47')]?[{'all':!![]}]:undefined})[_0xa866('0x27')](function(_0x46ee5c){var _0x490e99=_0x2562e8['user'][_0xa866('0x29')]({'plain':!![]});if(!_0x490e99)throw new Error(_0xa866('0x5a'));if(_0x490e99[_0xa866('0x50')]==='user'){var _0x9a40c=_0x46ee5c[_0xa866('0x29')]({'plain':!![]});var _0x4b6e7f=_0xa866('0x2a');return db[_0xa866('0x51')][_0xa866('0x4c')]({'where':{'name':_0x4b6e7f,'userProfileId':_0x490e99['userProfileId']},'raw':!![]})[_0xa866('0x27')](function(_0x1343c0){if(_0x1343c0&&_0x1343c0[_0xa866('0x53')]===0x0){return db[_0xa866('0x2b')][_0xa866('0x4e')]({'name':_0x9a40c[_0xa866('0x2d')],'resourceId':_0x9a40c['id'],'type':_0x1343c0['name'],'sectionId':_0x1343c0['id']},{})['then'](function(){return _0x46ee5c;});}else{return _0x46ee5c;}})[_0xa866('0x4d')](function(_0xd61be6){logger[_0xa866('0x54')](_0xa866('0x55'),_0xd61be6);throw _0xd61be6;});}return _0x46ee5c;});}})[_0xa866('0x27')](respondWithResult(_0x1868d5,0xc9))[_0xa866('0x4d')](handleError(_0x1868d5,null));};exports[_0xa866('0x26')]=function(_0x5ea510,_0x25d143){if(_0x5ea510[_0xa866('0x59')]['id']){delete _0x5ea510[_0xa866('0x59')]['id'];}return db[_0xa866('0x31')][_0xa866('0x4c')]({'where':{'id':_0x5ea510[_0xa866('0x4b')]['id']}})[_0xa866('0x27')](handleEntityNotFound(_0x25d143,null))['then'](saveUpdates(_0x5ea510['body'],null))['then'](respondWithResult(_0x25d143,null))[_0xa866('0x4d')](handleError(_0x25d143,null));};exports['destroy']=function(_0x24de2a,_0x13a2a4){return db[_0xa866('0x31')][_0xa866('0x4c')]({'where':{'id':_0x24de2a[_0xa866('0x4b')]['id']}})[_0xa866('0x27')](handleEntityNotFound(_0x13a2a4,null))[_0xa866('0x27')](removeEntity(_0x13a2a4,null))[_0xa866('0x4d')](handleError(_0x13a2a4,null));};exports[_0xa866('0x5b')]=function(_0x3fcaeb,_0x482c33,_0x2bed8c){var _0x249181={'raw':!![],'where':{}};var _0x58fda0={};var _0x321e45={'count':0x0,'rows':[]};return db[_0xa866('0x31')][_0xa866('0x5c')]({'where':{'id':_0x3fcaeb['params']['id']}})[_0xa866('0x27')](handleEntityNotFound(_0x482c33,null))[_0xa866('0x27')](function(_0x5520eb){if(_0x5520eb){_0x58fda0[_0xa866('0x39')]=_['keys'](db[_0xa866('0x5d')][_0xa866('0x32')]);_0x58fda0[_0xa866('0x36')]=_['keys'](_0x3fcaeb[_0xa866('0x36')]);_0x58fda0[_0xa866('0x37')]=_[_0xa866('0x38')](_0x58fda0[_0xa866('0x39')],_0x58fda0[_0xa866('0x36')]);_0x249181[_0xa866('0x3a')]=_[_0xa866('0x38')](_0x58fda0[_0xa866('0x39')],qs[_0xa866('0x3b')](_0x3fcaeb[_0xa866('0x36')]['fields']));_0x249181[_0xa866('0x3a')]=_0x249181[_0xa866('0x3a')][_0xa866('0x3c')]?_0x249181[_0xa866('0x3a')]:_0x58fda0['model'];if(!_0x3fcaeb[_0xa866('0x36')]['hasOwnProperty'](_0xa866('0x3e'))){_0x249181[_0xa866('0x20')]=qs[_0xa866('0x20')](_0x3fcaeb['query'][_0xa866('0x20')]);_0x249181[_0xa866('0x1e')]=qs[_0xa866('0x1e')](_0x3fcaeb[_0xa866('0x36')]['offset']);}_0x249181[_0xa866('0x3f')]=qs[_0xa866('0x40')](_0x3fcaeb[_0xa866('0x36')][_0xa866('0x40')]);_0x249181['where']=qs[_0xa866('0x37')](_['pick'](_0x3fcaeb[_0xa866('0x36')],_0x58fda0[_0xa866('0x37')]));_0x249181[_0xa866('0x41')][_0xa866('0x5e')]=_0x5520eb['id'];if(_0x3fcaeb[_0xa866('0x36')][_0xa866('0x43')]){_0x249181[_0xa866('0x41')]=_[_0xa866('0x44')](_0x249181[_0xa866('0x41')],{'$or':_[_0xa866('0x30')](_0x249181['attributes'],function(_0x170259){var _0x1e959b={};_0x1e959b[_0x170259]={'$like':'%'+_0x3fcaeb['query'][_0xa866('0x43')]+'%'};return _0x1e959b;})});}_0x249181=_[_0xa866('0x44')]({},_0x249181,_0x3fcaeb['options']);return db[_0xa866('0x5d')]['count']({'where':_0x249181[_0xa866('0x41')]})['then'](function(_0x2fc5f2){_0x321e45[_0xa866('0x21')]=_0x2fc5f2;if(_0x3fcaeb[_0xa866('0x36')][_0xa866('0x47')]){_0x249181[_0xa866('0x48')]=[{'all':!![]}];}return db[_0xa866('0x5d')]['findAll'](_0x249181);})[_0xa866('0x27')](function(_0x18c213){_0x321e45['rows']=_0x18c213;return _0x321e45;});}})[_0xa866('0x27')](respondWithFilteredResult(_0x482c33,_0x249181))[_0xa866('0x4d')](handleError(_0x482c33,null));};exports['getAnswers']=function(_0xaf190f,_0x2219f4,_0x51e6dc){var _0x3fca14={'raw':!![],'where':{}};var _0x3e7559={};var _0x45232e={'count':0x0,'rows':[]};return db[_0xa866('0x31')][_0xa866('0x5c')]({'where':{'id':_0xaf190f[_0xa866('0x4b')]['id']}})['then'](handleEntityNotFound(_0x2219f4,null))['then'](function(_0x1cb317){if(_0x1cb317){_0x3e7559[_0xa866('0x39')]=_[_0xa866('0x35')](db[_0xa866('0x5f')][_0xa866('0x32')]);_0x3e7559['query']=_['keys'](_0xaf190f[_0xa866('0x36')]);_0x3e7559['filters']=_[_0xa866('0x38')](_0x3e7559['model'],_0x3e7559[_0xa866('0x36')]);_0x3fca14[_0xa866('0x3a')]=_[_0xa866('0x38')](_0x3e7559[_0xa866('0x39')],qs[_0xa866('0x3b')](_0xaf190f[_0xa866('0x36')][_0xa866('0x3b')]));_0x3fca14[_0xa866('0x3a')]=_0x3fca14['attributes']['length']?_0x3fca14[_0xa866('0x3a')]:_0x3e7559[_0xa866('0x39')];if(!_0xaf190f[_0xa866('0x36')]['hasOwnProperty']('nolimit')){_0x3fca14['limit']=qs['limit'](_0xaf190f['query'][_0xa866('0x20')]);_0x3fca14[_0xa866('0x1e')]=qs[_0xa866('0x1e')](_0xaf190f[_0xa866('0x36')][_0xa866('0x1e')]);}_0x3fca14[_0xa866('0x3f')]=qs['sort'](_0xaf190f[_0xa866('0x36')]['sort']);_0x3fca14[_0xa866('0x41')]=qs[_0xa866('0x37')](_[_0xa866('0x42')](_0xaf190f['query'],_0x3e7559[_0xa866('0x37')]));_0x3fca14[_0xa866('0x41')][_0xa866('0x5e')]=_0x1cb317['id'];if(_0xaf190f['query'][_0xa866('0x43')]){_0x3fca14[_0xa866('0x41')]=_[_0xa866('0x44')](_0x3fca14[_0xa866('0x41')],{'$or':_[_0xa866('0x30')](_0x3fca14[_0xa866('0x3a')],function(_0x5237e2){var _0x218cb3={};_0x218cb3[_0x5237e2]={'$like':'%'+_0xaf190f[_0xa866('0x36')]['filter']+'%'};return _0x218cb3;})});}_0x3fca14=_[_0xa866('0x44')]({},_0x3fca14,_0xaf190f[_0xa866('0x46')]);return db['JscriptyAnswerReport'][_0xa866('0x21')]({'where':_0x3fca14[_0xa866('0x41')]})['then'](function(_0x332c5f){_0x45232e['count']=_0x332c5f;if(_0xaf190f[_0xa866('0x36')][_0xa866('0x47')]){_0x3fca14['include']=[{'all':!![]}];}return db[_0xa866('0x5f')][_0xa866('0x60')](_0x3fca14);})[_0xa866('0x27')](function(_0x14742a){_0x45232e[_0xa866('0x49')]=_0x14742a;return _0x45232e;});}})['then'](respondWithFilteredResult(_0x2219f4,_0x3fca14))[_0xa866('0x4d')](handleError(_0x2219f4,null));};function char(_0x28352c){return _0xa866('0x61')===typeof _0x28352c?String['fromCharCode'][_0xa866('0x23')](null,arguments):_0x28352c;}function needsEncapsulation(_0x326e3b){return!!_0x326e3b&&(_0x326e3b[_0xa866('0x62')]()['indexOf'](char(0xd))>=0x0||_0x326e3b[_0xa866('0x62')]()[_0xa866('0x63')](char(0xa))>=0x0||_0x326e3b[_0xa866('0x62')]()['indexOf'](char(0x2c))>=0x0||_0x326e3b[_0xa866('0x62')]()[_0xa866('0x63')](char(0x22))>=0x0);}function encapsulate(_0x2678a3){var _0x27b360=char(0x22),_0x472f73='\x5c'+char(0x22),_0x9bc8a3=_0x2678a3['toString']()[_0xa866('0x64')](new RegExp(_0x27b360,'g'),_0x472f73);return _0x27b360+_0x9bc8a3+_0x27b360;}exports[_0xa866('0x65')]=function(_0x2ce4cf,_0x32380e,_0x21aeba){var _0x1f5c14,_0x50c7f0;var _0x22188b={'where':{'ProjectId':_0x2ce4cf[_0xa866('0x4b')]['id']}};if(_0x2ce4cf[_0xa866('0x36')][_0xa866('0x66')]){_0x22188b[_0xa866('0x41')][_0xa866('0x67')]=JSON[_0xa866('0x68')](_0x2ce4cf[_0xa866('0x36')]['startTime']);}return db[_0xa866('0x5d')][_0xa866('0x60')](_0x22188b)[_0xa866('0x27')](handleEntityNotFound(_0x32380e,null))['then'](function(_0x51931c){if(_0x51931c){_0x1f5c14=_0x51931c;return db[_0xa866('0x69')][_0xa866('0x60')]({'where':{'SessionId':{'$in':_[_0xa866('0x30')](_0x1f5c14,'id')},'ProjectId':_0x2ce4cf[_0xa866('0x4b')]['id']},'order':_0xa866('0x6a')});}})['then'](handleEntityNotFound(_0x32380e,null))[_0xa866('0x27')](function(_0x169358){if(_0x169358){_0x50c7f0=_0x169358;var _0x4ee6d8={};for(var _0x4e2c44=0x0,_0x26876d=_0x50c7f0[_0xa866('0x3c')];_0x4e2c44<_0x26876d;_0x4e2c44++){if(!_0x4ee6d8['hasOwnProperty'](_0x50c7f0[_0x4e2c44][_0xa866('0x6b')])){_0x4ee6d8[_0x50c7f0[_0x4e2c44][_0xa866('0x6b')]]=needsEncapsulation(_0x50c7f0[_0x4e2c44]['question'])?encapsulate(_0x50c7f0[_0x4e2c44]['question']):_0x50c7f0[_0x4e2c44][_0xa866('0x6c')];}}var _0x2a24d0=[],_0x133d37={};for(var _0x5ac28c=0x0,_0x835077=_0x1f5c14[_0xa866('0x3c')];_0x5ac28c<_0x835077;_0x5ac28c++){_0x133d37={'ProjectId':_0x2ce4cf[_0xa866('0x4b')]['id'],'SessionId':_0x1f5c14[_0x5ac28c]['id'],'StartTime':moment(_0x1f5c14[_0x5ac28c][_0xa866('0x67')])['format'](_0xa866('0x6d'))};for(var _0x56e528=0x0,_0x15ecb7=_0x50c7f0['length'];_0x56e528<_0x15ecb7;_0x56e528++){if(_0x50c7f0[_0x56e528]['SessionId']==_0x1f5c14[_0x5ac28c]['id']&&_0x4ee6d8[_0xa866('0x3d')](_0x50c7f0[_0x56e528][_0xa866('0x6b')])){_0x133d37[_0x4ee6d8[_0x50c7f0[_0x56e528][_0xa866('0x6b')]]]=_0x50c7f0[_0x56e528]['answer'];}}for(var _0x57a6f7 in _0x4ee6d8){if(!_0x133d37[_0xa866('0x3d')](_0x4ee6d8[_0x57a6f7])){_0x133d37[_0x4ee6d8[_0x57a6f7]]=null;}}_0x2a24d0['push'](_0x133d37);}return _0x2a24d0;}})[_0xa866('0x27')](function(_0xb47da0){if(!_['isEmpty'](_0xb47da0)){var _0x5e47da=toCsv(_0xb47da0);var _0x571fc2=Date[_0xa866('0x6e')]();fs[_0xa866('0x6f')](util[_0xa866('0x70')]('/tmp/Jscripty_Project_%d_Summary_%s.csv',_0x2ce4cf[_0xa866('0x4b')]['id'],_0x571fc2),_0x5e47da);_0x32380e[_0xa866('0x71')](_0xa866('0x72'),'attachment;\x20filename='+util[_0xa866('0x70')](_0xa866('0x73'),_0x2ce4cf[_0xa866('0x4b')]['id'],_0x571fc2));_0x32380e[_0xa866('0x71')](_0xa866('0x74'),_0xa866('0x75'));return _0x32380e[_0xa866('0x76')](util[_0xa866('0x70')](_0xa866('0x77'),_0x2ce4cf[_0xa866('0x4b')]['id'],_0x571fc2));}else{return _0x32380e[_0xa866('0x1a')](0xcc);}})['catch'](handleError(_0x32380e,null));}; \ No newline at end of file diff --git a/server/api/jscriptyProject/jscriptyProject.model.js b/server/api/jscriptyProject/jscriptyProject.model.js index 4e4d490..444cf53 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 _0xd0bb=['JscriptyProject','lodash','util','../../config/logger','moment','request-promise','path','../../config/environment','exports','define'];(function(_0x1f46de,_0x188483){var _0x5bbb3d=function(_0x43e3fd){while(--_0x43e3fd){_0x1f46de['push'](_0x1f46de['shift']());}};_0x5bbb3d(++_0x188483);}(_0xd0bb,0x1eb));var _0xbd0b=function(_0x573773,_0x36caa2){_0x573773=_0x573773-0x0;var _0x2b56af=_0xd0bb[_0x573773];return _0x2b56af;};'use strict';var _=require(_0xbd0b('0x0'));var util=require(_0xbd0b('0x1'));var logger=require(_0xbd0b('0x2'))('api');var moment=require(_0xbd0b('0x3'));var BPromise=require('bluebird');var rp=require(_0xbd0b('0x4'));var fs=require('fs');var path=require(_0xbd0b('0x5'));var rimraf=require('rimraf');var config=require(_0xbd0b('0x6'));var attributes=require('./jscriptyProject.attributes');module[_0xbd0b('0x7')]=function(_0x1b2499,_0x158b5c){return _0x1b2499[_0xbd0b('0x8')](_0xbd0b('0x9'),attributes,{'tableName':'jscripty_projects','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4074=['lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./jscriptyProject.attributes','exports','JscriptyProject'];(function(_0x346f68,_0xb45d9d){var _0x2d1803=function(_0x3e5b6a){while(--_0x3e5b6a){_0x346f68['push'](_0x346f68['shift']());}};_0x2d1803(++_0xb45d9d);}(_0x4074,0xf0));var _0x4407=function(_0x364b4b,_0x4fda8a){_0x364b4b=_0x364b4b-0x0;var _0x22b96e=_0x4074[_0x364b4b];return _0x22b96e;};'use strict';var _=require(_0x4407('0x0'));var util=require(_0x4407('0x1'));var logger=require(_0x4407('0x2'))('api');var moment=require(_0x4407('0x3'));var BPromise=require(_0x4407('0x4'));var rp=require(_0x4407('0x5'));var fs=require('fs');var path=require(_0x4407('0x6'));var rimraf=require(_0x4407('0x7'));var config=require(_0x4407('0x8'));var attributes=require(_0x4407('0x9'));module[_0x4407('0xa')]=function(_0x3f085d,_0x35899d){return _0x3f085d['define'](_0x4407('0xb'),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 7d73979..2513bd6 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 _0xf4eb=['JscriptyProject,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x21b077,_0x3d75bb){var _0x417e98=function(_0x2e3b92){while(--_0x2e3b92){_0x21b077['push'](_0x21b077['shift']());}};_0x417e98(++_0x3d75bb);}(_0xf4eb,0xec));var _0xbf4e=function(_0xb7858b,_0x16a4e8){_0xb7858b=_0xb7858b-0x0;var _0x4bf366=_0xf4eb[_0xb7858b];return _0x4bf366;};'use strict';var _=require(_0xbf4e('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xbf4e('0x1'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xbf4e('0x2'))(_0xbf4e('0x3'));var config=require(_0xbf4e('0x4'));var jayson=require(_0xbf4e('0x5'));var client=jayson[_0xbf4e('0x6')][_0xbf4e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x15b99f,_0x540736,_0x449d55){return new BPromise(function(_0x5013c2,_0x5e23d4){return client[_0xbf4e('0x8')](_0x15b99f,_0x449d55)[_0xbf4e('0x9')](function(_0xcc4097){logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));logger[_0xbf4e('0xd')]('JscriptyProject,\x20%s,\x20%s,\x20%s',_0x540736,'request\x20sent',JSON[_0xbf4e('0xe')](_0xcc4097));if(_0xcc4097['error']){if(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x10')]===0x1f4){logger['error'](_0xbf4e('0xb'),_0x540736,_0xcc4097['error']['message']);return _0x5e23d4(_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);}logger[_0xbf4e('0xf')](_0xbf4e('0xb'),_0x540736,_0xcc4097[_0xbf4e('0xf')][_0xbf4e('0x11')]);return _0x5013c2(_0xcc4097['error']['message']);}else{logger[_0xbf4e('0xa')](_0xbf4e('0xb'),_0x540736,_0xbf4e('0xc'));_0x5013c2(_0xcc4097['result'][_0xbf4e('0x11')]);}})[_0xbf4e('0x12')](function(_0x912fc0){logger[_0xbf4e('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x540736,_0x912fc0);_0x5e23d4(_0x912fc0);});});} \ No newline at end of file +var _0xaa88=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','then','info','request\x20sent','debug','JscriptyProject,\x20%s,\x20%s,\x20%s','error','JscriptyProject,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird'];(function(_0x1aa0e7,_0x498fbd){var _0x55f771=function(_0x595895){while(--_0x595895){_0x1aa0e7['push'](_0x1aa0e7['shift']());}};_0x55f771(++_0x498fbd);}(_0xaa88,0x137));var _0x8aa8=function(_0x489b87,_0xd51c93){_0x489b87=_0x489b87-0x0;var _0x1823b6=_0xaa88[_0x489b87];return _0x1823b6;};'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')]('JscriptyProject,\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')]('JscriptyProject,\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')]('JscriptyProject,\x20%s,\x20%s',_0x449d2d,_0xd59fb8);_0x40826f(_0xd59fb8);});});} \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/index.js b/server/api/jscriptyQuestionReport/index.js index dfd3e74..f3a07a6 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 _0xe836=['create','put','update','delete','destroy','multer','util','path','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptyQuestionReport.controller','get','isAuthenticated','index','/describe','/:id','show','post'];(function(_0x3cf3fe,_0x386edb){var _0xb78b28=function(_0x13acde){while(--_0x13acde){_0x3cf3fe['push'](_0x3cf3fe['shift']());}};_0xb78b28(++_0x386edb);}(_0xe836,0xf5));var _0x6e83=function(_0x2b58ba,_0x1c5695){_0x2b58ba=_0x2b58ba-0x0;var _0x5dc914=_0xe836[_0x2b58ba];return _0x5dc914;};'use strict';var multer=require(_0x6e83('0x0'));var util=require(_0x6e83('0x1'));var path=require(_0x6e83('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e83('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x6e83('0x4'));var interaction=require(_0x6e83('0x5'));var config=require(_0x6e83('0x6'));var controller=require(_0x6e83('0x7'));router[_0x6e83('0x8')]('/',auth[_0x6e83('0x9')](),controller[_0x6e83('0xa')]);router[_0x6e83('0x8')](_0x6e83('0xb'),auth[_0x6e83('0x9')](),controller['describe']);router['get'](_0x6e83('0xc'),auth[_0x6e83('0x9')](),controller[_0x6e83('0xd')]);router[_0x6e83('0xe')]('/',auth[_0x6e83('0x9')](),controller[_0x6e83('0xf')]);router[_0x6e83('0x10')](_0x6e83('0xc'),auth['isAuthenticated'](),controller[_0x6e83('0x11')]);router[_0x6e83('0x12')](_0x6e83('0xc'),auth[_0x6e83('0x9')](),controller[_0x6e83('0x13')]);module['exports']=router; \ No newline at end of file +var _0x7617=['create','put','update','destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show'];(function(_0x46313f,_0x11349c){var _0x12eccb=function(_0x50a3df){while(--_0x50a3df){_0x46313f['push'](_0x46313f['shift']());}};_0x12eccb(++_0x11349c);}(_0x7617,0x145));var _0x7761=function(_0x496cb8,_0x388c04){_0x496cb8=_0x496cb8-0x0;var _0x2cedf7=_0x7617[_0x496cb8];return _0x2cedf7;};'use strict';var multer=require(_0x7761('0x0'));var util=require('util');var path=require(_0x7761('0x1'));var timeout=require(_0x7761('0x2'));var express=require('express');var router=express[_0x7761('0x3')]();var fs_extra=require(_0x7761('0x4'));var auth=require(_0x7761('0x5'));var interaction=require(_0x7761('0x6'));var config=require(_0x7761('0x7'));var controller=require('./jscriptyQuestionReport.controller');router[_0x7761('0x8')]('/',auth[_0x7761('0x9')](),controller[_0x7761('0xa')]);router[_0x7761('0x8')](_0x7761('0xb'),auth[_0x7761('0x9')](),controller[_0x7761('0xc')]);router[_0x7761('0x8')](_0x7761('0xd'),auth[_0x7761('0x9')](),controller[_0x7761('0xe')]);router['post']('/',auth[_0x7761('0x9')](),controller[_0x7761('0xf')]);router[_0x7761('0x10')]('/:id',auth[_0x7761('0x9')](),controller[_0x7761('0x11')]);router['delete'](_0x7761('0xd'),auth[_0x7761('0x9')](),controller[_0x7761('0x12')]);module[_0x7761('0x13')]=router; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js index 8293aaa..a10239b 100644 --- a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js +++ b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x2d2c16,_0x4e88b6){var _0x53f2fb=function(_0x6b6dac){while(--_0x6b6dac){_0x2d2c16['push'](_0x2d2c16['shift']());}};_0x53f2fb(++_0x4e88b6);}(_0x7a54,0x106));var _0x47a5=function(_0x4e530e,_0x52dc6e){_0x4e530e=_0x4e530e-0x0;var _0x324827=_0x7a54[_0x4e530e];return _0x324827;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file +var _0x7a54=['long','STRING','sequelize','exports','TEXT'];(function(_0x5c2e3e,_0x26ecd3){var _0x53f64a=function(_0x2b5df8){while(--_0x2b5df8){_0x5c2e3e['push'](_0x5c2e3e['shift']());}};_0x53f64a(++_0x26ecd3);}(_0x7a54,0x106));var _0x47a5=function(_0x27f8f6,_0x5ae956){_0x27f8f6=_0x27f8f6-0x0;var _0x26a2eb=_0x7a54[_0x27f8f6];return _0x26a2eb;};'use strict';var Sequelize=require(_0x47a5('0x0'));module[_0x47a5('0x1')]={'question':{'type':Sequelize[_0x47a5('0x2')]},'answer':{'type':Sequelize['TEXT'](_0x47a5('0x3'))},'membername':{'type':Sequelize[_0x47a5('0x4')]},'projectname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0x47a5('0x4')]},'uniqueid':{'type':Sequelize[_0x47a5('0x4')]},'calleridname':{'type':Sequelize[_0x47a5('0x4')]},'calleridnum':{'type':Sequelize[_0x47a5('0x4')]},'questionId':{'type':Sequelize[_0x47a5('0x4')]}}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.controller.js index b38c31a..8761dbc 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 _0xdfa0=['moment','mustache','util','path','sox','ejs','fs-extra','squel','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','../../mysqldb','sendStatus','status','end','json','offset','limit','count','set','apply','reject','save','update','then','destroy','error','name','send','map','JscriptyQuestionReport','rawAttributes','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','include','show','params','length','find','catch','create','body','describe','rimraf','fast-json-patch','request-promise'];(function(_0x3d42d8,_0x4cffaa){var _0x27fc41=function(_0x3a363b){while(--_0x3a363b){_0x3d42d8['push'](_0x3d42d8['shift']());}};_0x27fc41(++_0x4cffaa);}(_0xdfa0,0x119));var _0x0dfa=function(_0x137cd0,_0x19449b){_0x137cd0=_0x137cd0-0x0;var _0x2c8d56=_0xdfa0[_0x137cd0];return _0x2c8d56;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0dfa('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x0dfa('0x1'));var rp=require(_0x0dfa('0x2'));var moment=require(_0x0dfa('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0dfa('0x4'));var util=require(_0x0dfa('0x5'));var path=require(_0x0dfa('0x6'));var sox=require(_0x0dfa('0x7'));var csv=require('to-csv');var ejs=require(_0x0dfa('0x8'));var fs=require('fs');var fs_extra=require(_0x0dfa('0x9'));var _=require('lodash');var squel=require(_0x0dfa('0xa'));var crypto=require(_0x0dfa('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x0dfa('0xc'));var toCsv=require(_0x0dfa('0xd'));var querystring=require(_0x0dfa('0xe'));var Papa=require(_0x0dfa('0xf'));var Redis=require(_0x0dfa('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x0dfa('0x11'));var as=require(_0x0dfa('0x12'));var hardwareService=require(_0x0dfa('0x13'));var logger=require(_0x0dfa('0x14'))(_0x0dfa('0x15'));var utils=require(_0x0dfa('0x16'));var config=require(_0x0dfa('0x17'));var licenseUtil=require(_0x0dfa('0x18'));var db=require(_0x0dfa('0x19'))['db'];function respondWithStatusCode(_0x153658,_0x64c2e7){_0x64c2e7=_0x64c2e7||0xcc;return function(_0x289bd8){if(_0x289bd8){return _0x153658[_0x0dfa('0x1a')](_0x64c2e7);}return _0x153658[_0x0dfa('0x1b')](_0x64c2e7)[_0x0dfa('0x1c')]();};}function respondWithResult(_0x33a297,_0x1edf57){_0x1edf57=_0x1edf57||0xc8;return function(_0x2ba033){if(_0x2ba033){return _0x33a297[_0x0dfa('0x1b')](_0x1edf57)[_0x0dfa('0x1d')](_0x2ba033);}};}function respondWithFilteredResult(_0x26d000,_0x163e9f){return function(_0x2b2d7d){if(_0x2b2d7d){var _0x2dbd88=typeof _0x163e9f[_0x0dfa('0x1e')]==='undefined'&&typeof _0x163e9f[_0x0dfa('0x1f')]==='undefined';var _0x1dc356=_0x2b2d7d[_0x0dfa('0x20')];var _0x2271e0=_0x2dbd88?0x0:_0x163e9f[_0x0dfa('0x1e')];var _0x32a055=_0x2dbd88?_0x2b2d7d[_0x0dfa('0x20')]:_0x163e9f[_0x0dfa('0x1e')]+_0x163e9f['limit'];var _0x10a385;if(_0x32a055>=_0x1dc356){_0x32a055=_0x1dc356;_0x10a385=0xc8;}else{_0x10a385=0xce;}_0x26d000['status'](_0x10a385);return _0x26d000[_0x0dfa('0x21')]('Content-Range',_0x2271e0+'-'+_0x32a055+'/'+_0x1dc356)['json'](_0x2b2d7d);}return null;};}function patchUpdates(_0x7217f8){return function(_0x2cdae8){try{jsonpatch[_0x0dfa('0x22')](_0x2cdae8,_0x7217f8,!![]);}catch(_0x1960a4){return BPromise[_0x0dfa('0x23')](_0x1960a4);}return _0x2cdae8[_0x0dfa('0x24')]();};}function saveUpdates(_0x4d211e,_0x4813c6){return function(_0x580384){if(_0x580384){return _0x580384[_0x0dfa('0x25')](_0x4d211e)[_0x0dfa('0x26')](function(_0xd36a4a){return _0xd36a4a;});}return null;};}function removeEntity(_0x14d8bd,_0x32790d){return function(_0x3118ec){if(_0x3118ec){return _0x3118ec[_0x0dfa('0x27')]()[_0x0dfa('0x26')](function(){_0x14d8bd['status'](0xcc)[_0x0dfa('0x1c')]();});}};}function handleEntityNotFound(_0xb0d8d4,_0x1a946d){return function(_0x4953eb){if(!_0x4953eb){_0xb0d8d4[_0x0dfa('0x1a')](0x194);}return _0x4953eb;};}function handleError(_0x3739f4,_0x47f27e){_0x47f27e=_0x47f27e||0x1f4;return function(_0x41cf67){logger[_0x0dfa('0x28')](_0x41cf67['stack']);if(_0x41cf67[_0x0dfa('0x29')]){delete _0x41cf67[_0x0dfa('0x29')];}_0x3739f4[_0x0dfa('0x1b')](_0x47f27e)[_0x0dfa('0x2a')](_0x41cf67);};}exports['index']=function(_0x3e08fb,_0x45ac57){var _0x38facb={},_0x257a0e={},_0x26b291={'count':0x0,'rows':[]};var _0x2b88d2=_[_0x0dfa('0x2b')](db[_0x0dfa('0x2c')][_0x0dfa('0x2d')],function(_0x2aecde){return{'name':_0x2aecde['fieldName'],'type':_0x2aecde['type']['key']};});_0x257a0e[_0x0dfa('0x2e')]=_[_0x0dfa('0x2b')](_0x2b88d2,_0x0dfa('0x29'));_0x257a0e[_0x0dfa('0x2f')]=_[_0x0dfa('0x30')](_0x3e08fb[_0x0dfa('0x2f')]);_0x257a0e[_0x0dfa('0x31')]=_[_0x0dfa('0x32')](_0x257a0e['model'],_0x257a0e[_0x0dfa('0x2f')]);_0x38facb[_0x0dfa('0x33')]=_['intersection'](_0x257a0e[_0x0dfa('0x2e')],qs[_0x0dfa('0x34')](_0x3e08fb[_0x0dfa('0x2f')][_0x0dfa('0x34')]));_0x38facb[_0x0dfa('0x33')]=_0x38facb[_0x0dfa('0x33')]['length']?_0x38facb[_0x0dfa('0x33')]:_0x257a0e[_0x0dfa('0x2e')];if(!_0x3e08fb[_0x0dfa('0x2f')][_0x0dfa('0x35')](_0x0dfa('0x36'))){_0x38facb[_0x0dfa('0x1f')]=qs[_0x0dfa('0x1f')](_0x3e08fb[_0x0dfa('0x2f')][_0x0dfa('0x1f')]);_0x38facb['offset']=qs[_0x0dfa('0x1e')](_0x3e08fb['query']['offset']);}_0x38facb[_0x0dfa('0x37')]=qs[_0x0dfa('0x38')](_0x3e08fb['query']['sort']);_0x38facb['where']=qs[_0x0dfa('0x31')](_['pick'](_0x3e08fb[_0x0dfa('0x2f')],_0x257a0e['filters']),_0x2b88d2);if(_0x3e08fb[_0x0dfa('0x2f')][_0x0dfa('0x39')]){_0x38facb[_0x0dfa('0x3a')]=_[_0x0dfa('0x3b')](_0x38facb['where'],{'$or':_[_0x0dfa('0x2b')](_0x2b88d2,function(_0xcaeee9){if(_0xcaeee9['type']!==_0x0dfa('0x3c')){var _0x5dba0c={};_0x5dba0c[_0xcaeee9[_0x0dfa('0x29')]]={'$like':'%'+_0x3e08fb[_0x0dfa('0x2f')]['filter']+'%'};return _0x5dba0c;}})});}_0x38facb=_[_0x0dfa('0x3b')]({},_0x38facb,_0x3e08fb[_0x0dfa('0x3d')]);var _0x4d378f={'where':_0x38facb['where']};return db[_0x0dfa('0x2c')]['count'](_0x4d378f)['then'](function(_0x25ea86){_0x26b291[_0x0dfa('0x20')]=_0x25ea86;if(_0x3e08fb[_0x0dfa('0x2f')]['includeAll']){_0x38facb[_0x0dfa('0x3e')]=[{'all':!![]}];}return db['JscriptyQuestionReport']['findAll'](_0x38facb);})[_0x0dfa('0x26')](function(_0x1f5c7a){_0x26b291['rows']=_0x1f5c7a;return _0x26b291;})[_0x0dfa('0x26')](respondWithFilteredResult(_0x45ac57,_0x38facb))['catch'](handleError(_0x45ac57,null));};exports[_0x0dfa('0x3f')]=function(_0x410dc0,_0x538cbb){var _0x14eb53={'raw':!![],'where':{'id':_0x410dc0[_0x0dfa('0x40')]['id']}},_0x5e4258={};_0x5e4258['model']=_['keys'](db[_0x0dfa('0x2c')]['rawAttributes']);_0x5e4258[_0x0dfa('0x2f')]=_[_0x0dfa('0x30')](_0x410dc0[_0x0dfa('0x2f')]);_0x5e4258['filters']=_['intersection'](_0x5e4258[_0x0dfa('0x2e')],_0x5e4258[_0x0dfa('0x2f')]);_0x14eb53['attributes']=_[_0x0dfa('0x32')](_0x5e4258[_0x0dfa('0x2e')],qs[_0x0dfa('0x34')](_0x410dc0['query'][_0x0dfa('0x34')]));_0x14eb53[_0x0dfa('0x33')]=_0x14eb53[_0x0dfa('0x33')][_0x0dfa('0x41')]?_0x14eb53['attributes']:_0x5e4258[_0x0dfa('0x2e')];if(_0x410dc0[_0x0dfa('0x2f')]['includeAll']){_0x14eb53[_0x0dfa('0x3e')]=[{'all':!![]}];}_0x14eb53=_[_0x0dfa('0x3b')]({},_0x14eb53,_0x410dc0[_0x0dfa('0x3d')]);return db['JscriptyQuestionReport'][_0x0dfa('0x42')](_0x14eb53)[_0x0dfa('0x26')](handleEntityNotFound(_0x538cbb,null))[_0x0dfa('0x26')](respondWithResult(_0x538cbb,null))[_0x0dfa('0x43')](handleError(_0x538cbb,null));};exports[_0x0dfa('0x44')]=function(_0x156053,_0x23b892){return db[_0x0dfa('0x2c')]['create'](_0x156053[_0x0dfa('0x45')],{})[_0x0dfa('0x26')](respondWithResult(_0x23b892,0xc9))['catch'](handleError(_0x23b892,null));};exports[_0x0dfa('0x25')]=function(_0x34906b,_0x1b9e09){if(_0x34906b[_0x0dfa('0x45')]['id']){delete _0x34906b[_0x0dfa('0x45')]['id'];}return db[_0x0dfa('0x2c')][_0x0dfa('0x42')]({'where':{'id':_0x34906b[_0x0dfa('0x40')]['id']}})['then'](handleEntityNotFound(_0x1b9e09,null))[_0x0dfa('0x26')](saveUpdates(_0x34906b[_0x0dfa('0x45')],null))[_0x0dfa('0x26')](respondWithResult(_0x1b9e09,null))[_0x0dfa('0x43')](handleError(_0x1b9e09,null));};exports[_0x0dfa('0x27')]=function(_0x41f9a7,_0x299d36){return db[_0x0dfa('0x2c')][_0x0dfa('0x42')]({'where':{'id':_0x41f9a7[_0x0dfa('0x40')]['id']}})['then'](handleEntityNotFound(_0x299d36,null))['then'](removeEntity(_0x299d36,null))[_0x0dfa('0x43')](handleError(_0x299d36,null));};exports['describe']=function(_0x366606,_0x1b5339){return db[_0x0dfa('0x2c')][_0x0dfa('0x46')]()[_0x0dfa('0x26')](respondWithResult(_0x1b5339,null))[_0x0dfa('0x43')](handleError(_0x1b5339,null));}; \ No newline at end of file +var _0x89db=['undefined','count','set','Content-Range','save','update','then','destroy','error','name','send','map','fieldName','type','key','model','query','intersection','fields','attributes','length','hasOwnProperty','sort','where','pick','filters','filter','merge','VIRTUAL','JscriptyQuestionReport','includeAll','findAll','rows','catch','params','keys','rawAttributes','include','options','create','body','find','describe','eml-format','rimraf','zip-dir','moment','mustache','path','sox','ejs','fs-extra','lodash','squel','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','offset','limit'];(function(_0x5137bb,_0x389485){var _0x131e0e=function(_0x3b9547){while(--_0x3b9547){_0x5137bb['push'](_0x5137bb['shift']());}};_0x131e0e(++_0x389485);}(_0x89db,0x147));var _0xb89d=function(_0x2f42cb,_0x2cac6b){_0x2f42cb=_0x2f42cb-0x0;var _0x872954=_0x89db[_0x2f42cb];return _0x872954;};'use strict';var emlformat=require(_0xb89d('0x0'));var rimraf=require(_0xb89d('0x1'));var zipdir=require(_0xb89d('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xb89d('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xb89d('0x4'));var util=require('util');var path=require(_0xb89d('0x5'));var sox=require(_0xb89d('0x6'));var csv=require('to-csv');var ejs=require(_0xb89d('0x7'));var fs=require('fs');var fs_extra=require(_0xb89d('0x8'));var _=require(_0xb89d('0x9'));var squel=require(_0xb89d('0xa'));var crypto=require('crypto');var jsforce=require(_0xb89d('0xb'));var deskjs=require(_0xb89d('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xb89d('0xd'));var Redis=require(_0xb89d('0xe'));var authService=require(_0xb89d('0xf'));var qs=require(_0xb89d('0x10'));var as=require(_0xb89d('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xb89d('0x12'))('api');var utils=require(_0xb89d('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xb89d('0x14'));var db=require(_0xb89d('0x15'))['db'];function respondWithStatusCode(_0x1e1c6a,_0x617d57){_0x617d57=_0x617d57||0xcc;return function(_0x14e872){if(_0x14e872){return _0x1e1c6a[_0xb89d('0x16')](_0x617d57);}return _0x1e1c6a[_0xb89d('0x17')](_0x617d57)[_0xb89d('0x18')]();};}function respondWithResult(_0x464fad,_0x45f3f9){_0x45f3f9=_0x45f3f9||0xc8;return function(_0x280048){if(_0x280048){return _0x464fad[_0xb89d('0x17')](_0x45f3f9)[_0xb89d('0x19')](_0x280048);}};}function respondWithFilteredResult(_0x47d9aa,_0x2054a7){return function(_0x1c6a89){if(_0x1c6a89){var _0x45592b=typeof _0x2054a7[_0xb89d('0x1a')]==='undefined'&&typeof _0x2054a7[_0xb89d('0x1b')]===_0xb89d('0x1c');var _0x3d3183=_0x1c6a89[_0xb89d('0x1d')];var _0x5b5537=_0x45592b?0x0:_0x2054a7[_0xb89d('0x1a')];var _0x1afcfb=_0x45592b?_0x1c6a89[_0xb89d('0x1d')]:_0x2054a7[_0xb89d('0x1a')]+_0x2054a7[_0xb89d('0x1b')];var _0x466148;if(_0x1afcfb>=_0x3d3183){_0x1afcfb=_0x3d3183;_0x466148=0xc8;}else{_0x466148=0xce;}_0x47d9aa[_0xb89d('0x17')](_0x466148);return _0x47d9aa[_0xb89d('0x1e')](_0xb89d('0x1f'),_0x5b5537+'-'+_0x1afcfb+'/'+_0x3d3183)[_0xb89d('0x19')](_0x1c6a89);}return null;};}function patchUpdates(_0x314e89){return function(_0x4ca218){try{jsonpatch['apply'](_0x4ca218,_0x314e89,!![]);}catch(_0x3c7cfc){return BPromise['reject'](_0x3c7cfc);}return _0x4ca218[_0xb89d('0x20')]();};}function saveUpdates(_0x3ae3f4,_0x47c57f){return function(_0x21b76b){if(_0x21b76b){return _0x21b76b[_0xb89d('0x21')](_0x3ae3f4)[_0xb89d('0x22')](function(_0x46d152){return _0x46d152;});}return null;};}function removeEntity(_0x309d32,_0x1475d4){return function(_0x3ca7fb){if(_0x3ca7fb){return _0x3ca7fb[_0xb89d('0x23')]()[_0xb89d('0x22')](function(){_0x309d32['status'](0xcc)[_0xb89d('0x18')]();});}};}function handleEntityNotFound(_0x134e83,_0x521a93){return function(_0x90bc23){if(!_0x90bc23){_0x134e83['sendStatus'](0x194);}return _0x90bc23;};}function handleError(_0x5cec8b,_0x4f11ae){_0x4f11ae=_0x4f11ae||0x1f4;return function(_0x15467e){logger[_0xb89d('0x24')](_0x15467e['stack']);if(_0x15467e[_0xb89d('0x25')]){delete _0x15467e[_0xb89d('0x25')];}_0x5cec8b[_0xb89d('0x17')](_0x4f11ae)[_0xb89d('0x26')](_0x15467e);};}exports['index']=function(_0x46c0cf,_0x12ae31){var _0x579b2a={},_0x5f5193={},_0xf3526a={'count':0x0,'rows':[]};var _0x2fdd18=_[_0xb89d('0x27')](db['JscriptyQuestionReport']['rawAttributes'],function(_0x2934e0){return{'name':_0x2934e0[_0xb89d('0x28')],'type':_0x2934e0[_0xb89d('0x29')][_0xb89d('0x2a')]};});_0x5f5193[_0xb89d('0x2b')]=_[_0xb89d('0x27')](_0x2fdd18,_0xb89d('0x25'));_0x5f5193[_0xb89d('0x2c')]=_['keys'](_0x46c0cf[_0xb89d('0x2c')]);_0x5f5193['filters']=_[_0xb89d('0x2d')](_0x5f5193['model'],_0x5f5193['query']);_0x579b2a['attributes']=_[_0xb89d('0x2d')](_0x5f5193[_0xb89d('0x2b')],qs[_0xb89d('0x2e')](_0x46c0cf['query']['fields']));_0x579b2a['attributes']=_0x579b2a[_0xb89d('0x2f')][_0xb89d('0x30')]?_0x579b2a[_0xb89d('0x2f')]:_0x5f5193[_0xb89d('0x2b')];if(!_0x46c0cf[_0xb89d('0x2c')][_0xb89d('0x31')]('nolimit')){_0x579b2a['limit']=qs['limit'](_0x46c0cf[_0xb89d('0x2c')][_0xb89d('0x1b')]);_0x579b2a['offset']=qs[_0xb89d('0x1a')](_0x46c0cf[_0xb89d('0x2c')][_0xb89d('0x1a')]);}_0x579b2a['order']=qs['sort'](_0x46c0cf['query'][_0xb89d('0x32')]);_0x579b2a[_0xb89d('0x33')]=qs['filters'](_[_0xb89d('0x34')](_0x46c0cf[_0xb89d('0x2c')],_0x5f5193[_0xb89d('0x35')]),_0x2fdd18);if(_0x46c0cf[_0xb89d('0x2c')][_0xb89d('0x36')]){_0x579b2a[_0xb89d('0x33')]=_[_0xb89d('0x37')](_0x579b2a[_0xb89d('0x33')],{'$or':_['map'](_0x2fdd18,function(_0x65a6ee){if(_0x65a6ee[_0xb89d('0x29')]!==_0xb89d('0x38')){var _0x2aff32={};_0x2aff32[_0x65a6ee[_0xb89d('0x25')]]={'$like':'%'+_0x46c0cf['query']['filter']+'%'};return _0x2aff32;}})});}_0x579b2a=_['merge']({},_0x579b2a,_0x46c0cf['options']);var _0x1cdaca={'where':_0x579b2a[_0xb89d('0x33')]};return db[_0xb89d('0x39')][_0xb89d('0x1d')](_0x1cdaca)['then'](function(_0x405cfb){_0xf3526a[_0xb89d('0x1d')]=_0x405cfb;if(_0x46c0cf[_0xb89d('0x2c')][_0xb89d('0x3a')]){_0x579b2a['include']=[{'all':!![]}];}return db[_0xb89d('0x39')][_0xb89d('0x3b')](_0x579b2a);})['then'](function(_0x887644){_0xf3526a[_0xb89d('0x3c')]=_0x887644;return _0xf3526a;})['then'](respondWithFilteredResult(_0x12ae31,_0x579b2a))[_0xb89d('0x3d')](handleError(_0x12ae31,null));};exports['show']=function(_0x5e8d53,_0x3b46b3){var _0x5d52bf={'raw':!![],'where':{'id':_0x5e8d53[_0xb89d('0x3e')]['id']}},_0x4d2715={};_0x4d2715[_0xb89d('0x2b')]=_[_0xb89d('0x3f')](db[_0xb89d('0x39')][_0xb89d('0x40')]);_0x4d2715[_0xb89d('0x2c')]=_[_0xb89d('0x3f')](_0x5e8d53[_0xb89d('0x2c')]);_0x4d2715['filters']=_[_0xb89d('0x2d')](_0x4d2715[_0xb89d('0x2b')],_0x4d2715[_0xb89d('0x2c')]);_0x5d52bf[_0xb89d('0x2f')]=_['intersection'](_0x4d2715[_0xb89d('0x2b')],qs[_0xb89d('0x2e')](_0x5e8d53[_0xb89d('0x2c')][_0xb89d('0x2e')]));_0x5d52bf[_0xb89d('0x2f')]=_0x5d52bf[_0xb89d('0x2f')][_0xb89d('0x30')]?_0x5d52bf[_0xb89d('0x2f')]:_0x4d2715[_0xb89d('0x2b')];if(_0x5e8d53[_0xb89d('0x2c')][_0xb89d('0x3a')]){_0x5d52bf[_0xb89d('0x41')]=[{'all':!![]}];}_0x5d52bf=_[_0xb89d('0x37')]({},_0x5d52bf,_0x5e8d53[_0xb89d('0x42')]);return db[_0xb89d('0x39')]['find'](_0x5d52bf)['then'](handleEntityNotFound(_0x3b46b3,null))['then'](respondWithResult(_0x3b46b3,null))[_0xb89d('0x3d')](handleError(_0x3b46b3,null));};exports['create']=function(_0x4b74a1,_0xbd424f){return db['JscriptyQuestionReport'][_0xb89d('0x43')](_0x4b74a1['body'],{})[_0xb89d('0x22')](respondWithResult(_0xbd424f,0xc9))[_0xb89d('0x3d')](handleError(_0xbd424f,null));};exports[_0xb89d('0x21')]=function(_0x2cfc11,_0x4bdffe){if(_0x2cfc11[_0xb89d('0x44')]['id']){delete _0x2cfc11[_0xb89d('0x44')]['id'];}return db[_0xb89d('0x39')][_0xb89d('0x45')]({'where':{'id':_0x2cfc11[_0xb89d('0x3e')]['id']}})['then'](handleEntityNotFound(_0x4bdffe,null))['then'](saveUpdates(_0x2cfc11[_0xb89d('0x44')],null))['then'](respondWithResult(_0x4bdffe,null))[_0xb89d('0x3d')](handleError(_0x4bdffe,null));};exports[_0xb89d('0x23')]=function(_0x362f17,_0x4828b0){return db[_0xb89d('0x39')][_0xb89d('0x45')]({'where':{'id':_0x362f17['params']['id']}})['then'](handleEntityNotFound(_0x4828b0,null))[_0xb89d('0x22')](removeEntity(_0x4828b0,null))['catch'](handleError(_0x4828b0,null));};exports[_0xb89d('0x46')]=function(_0x3056cf,_0x214a90){return db[_0xb89d('0x39')][_0xb89d('0x46')]()[_0xb89d('0x22')](respondWithResult(_0x214a90,null))[_0xb89d('0x3d')](handleError(_0x214a90,null));}; \ No newline at end of file diff --git a/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js b/server/api/jscriptyQuestionReport/jscriptyQuestionReport.model.js index a4b067e..0a362eb 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 _0xb167=['./jscriptyQuestionReport.attributes','exports','define','JscriptyQuestionReport','report_jscripty_questions','bluebird','../../config/environment'];(function(_0x493ef4,_0x17a576){var _0x299eff=function(_0x2898af){while(--_0x2898af){_0x493ef4['push'](_0x493ef4['shift']());}};_0x299eff(++_0x17a576);}(_0xb167,0xbb));var _0x7b16=function(_0x1ebf4c,_0x4c3bc9){_0x1ebf4c=_0x1ebf4c-0x0;var _0xf4ee5b=_0xb167[_0x1ebf4c];return _0xf4ee5b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0x7b16('0x0'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7b16('0x1'));var attributes=require(_0x7b16('0x2'));module[_0x7b16('0x3')]=function(_0x55c0bf,_0x59f564){return _0x55c0bf[_0x7b16('0x4')](_0x7b16('0x5'),attributes,{'tableName':_0x7b16('0x6'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf02a=['rimraf','../../config/environment','./jscriptyQuestionReport.attributes','exports','JscriptyQuestionReport','report_jscripty_questions','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x201efd,_0x561cd2){var _0x328cdb=function(_0x539b7c){while(--_0x539b7c){_0x201efd['push'](_0x201efd['shift']());}};_0x328cdb(++_0x561cd2);}(_0xf02a,0x1f4));var _0xaf02=function(_0x3e0191,_0x1d4b20){_0x3e0191=_0x3e0191-0x0;var _0xf2ae83=_0xf02a[_0x3e0191];return _0xf2ae83;};'use strict';var _=require('lodash');var util=require(_0xaf02('0x0'));var logger=require(_0xaf02('0x1'))(_0xaf02('0x2'));var moment=require(_0xaf02('0x3'));var BPromise=require(_0xaf02('0x4'));var rp=require(_0xaf02('0x5'));var fs=require('fs');var path=require(_0xaf02('0x6'));var rimraf=require(_0xaf02('0x7'));var config=require(_0xaf02('0x8'));var attributes=require(_0xaf02('0x9'));module[_0xaf02('0xa')]=function(_0x182f77,_0x13c926){return _0x182f77['define'](_0xaf02('0xb'),attributes,{'tableName':_0xaf02('0xc'),'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 8df3797..cf37559 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 _0xe8b4=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x4354dc,_0x44fc9d){var _0x3bc8ae=function(_0x2c58e8){while(--_0x2c58e8){_0x4354dc['push'](_0x4354dc['shift']());}};_0x3bc8ae(++_0x44fc9d);}(_0xe8b4,0x101));var _0x4e8b=function(_0x2d425f,_0x4534e5){_0x2d425f=_0x2d425f-0x0;var _0x1e8b97=_0xe8b4[_0x2d425f];return _0x1e8b97;};'use strict';var _=require(_0x4e8b('0x0'));var util=require(_0x4e8b('0x1'));var moment=require(_0x4e8b('0x2'));var BPromise=require(_0x4e8b('0x3'));var rs=require(_0x4e8b('0x4'));var fs=require('fs');var Redis=require(_0x4e8b('0x5'));var db=require(_0x4e8b('0x6'))['db'];var utils=require(_0x4e8b('0x7'));var logger=require('../../config/logger')(_0x4e8b('0x8'));var config=require(_0x4e8b('0x9'));var jayson=require(_0x4e8b('0xa'));var client=jayson[_0x4e8b('0xb')][_0x4e8b('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1c37b2,_0x47dcac,_0x4878ea){return new BPromise(function(_0x2fefc2,_0x5059f0){return client[_0x4e8b('0xd')](_0x1c37b2,_0x4878ea)['then'](function(_0x2cc0dd){logger[_0x4e8b('0xe')](_0x4e8b('0xf'),_0x47dcac,_0x4e8b('0x10'));logger[_0x4e8b('0x11')](_0x4e8b('0x12'),_0x47dcac,_0x4e8b('0x10'),JSON[_0x4e8b('0x13')](_0x2cc0dd));if(_0x2cc0dd[_0x4e8b('0x14')]){if(_0x2cc0dd[_0x4e8b('0x14')][_0x4e8b('0x15')]===0x1f4){logger['error'](_0x4e8b('0xf'),_0x47dcac,_0x2cc0dd[_0x4e8b('0x14')][_0x4e8b('0x16')]);return _0x5059f0(_0x2cc0dd[_0x4e8b('0x14')]['message']);}logger[_0x4e8b('0x14')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x47dcac,_0x2cc0dd['error'][_0x4e8b('0x16')]);return _0x2fefc2(_0x2cc0dd['error'][_0x4e8b('0x16')]);}else{logger[_0x4e8b('0xe')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x47dcac,_0x4e8b('0x10'));_0x2fefc2(_0x2cc0dd['result'][_0x4e8b('0x16')]);}})[_0x4e8b('0x17')](function(_0x3d0ece){logger['error'](_0x4e8b('0xf'),_0x47dcac,_0x3d0ece);_0x5059f0(_0x3d0ece);});});} \ No newline at end of file +var _0x250f=['../../config/environment','client','http','request','info','JscriptyQuestionReport,\x20%s,\x20%s','request\x20sent','debug','JscriptyQuestionReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x5a9c0c,_0x4ec485){var _0x53c77d=function(_0x1cf384){while(--_0x1cf384){_0x5a9c0c['push'](_0x5a9c0c['shift']());}};_0x53c77d(++_0x4ec485);}(_0x250f,0x1da));var _0xf250=function(_0x13a680,_0x5d11a6){_0x13a680=_0x13a680-0x0;var _0x312ebd=_0x250f[_0x13a680];return _0x312ebd;};'use strict';var _=require(_0xf250('0x0'));var util=require(_0xf250('0x1'));var moment=require(_0xf250('0x2'));var BPromise=require(_0xf250('0x3'));var rs=require(_0xf250('0x4'));var fs=require('fs');var Redis=require(_0xf250('0x5'));var db=require(_0xf250('0x6'))['db'];var utils=require(_0xf250('0x7'));var logger=require(_0xf250('0x8'))('rpc');var config=require(_0xf250('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf250('0xa')][_0xf250('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x11b351,_0x13afe4,_0xf33fa8){return new BPromise(function(_0x31bf82,_0x334b75){return client[_0xf250('0xc')](_0x11b351,_0xf33fa8)['then'](function(_0x30775e){logger[_0xf250('0xd')](_0xf250('0xe'),_0x13afe4,_0xf250('0xf'));logger[_0xf250('0x10')](_0xf250('0x11'),_0x13afe4,_0xf250('0xf'),JSON[_0xf250('0x12')](_0x30775e));if(_0x30775e[_0xf250('0x13')]){if(_0x30775e[_0xf250('0x13')]['code']===0x1f4){logger[_0xf250('0x13')](_0xf250('0xe'),_0x13afe4,_0x30775e['error'][_0xf250('0x14')]);return _0x334b75(_0x30775e[_0xf250('0x13')][_0xf250('0x14')]);}logger[_0xf250('0x13')]('JscriptyQuestionReport,\x20%s,\x20%s',_0x13afe4,_0x30775e['error']['message']);return _0x31bf82(_0x30775e[_0xf250('0x13')][_0xf250('0x14')]);}else{logger[_0xf250('0xd')](_0xf250('0xe'),_0x13afe4,'request\x20sent');_0x31bf82(_0x30775e[_0xf250('0x15')][_0xf250('0x14')]);}})[_0xf250('0x16')](function(_0x294950){logger['error']('JscriptyQuestionReport,\x20%s,\x20%s',_0x13afe4,_0x294950);_0x334b75(_0x294950);});});} \ No newline at end of file diff --git a/server/api/jscriptySessionReport/index.js b/server/api/jscriptySessionReport/index.js index d0dc03b..7e90e4a 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 _0xec26=['../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','isAuthenticated','index','get','/describe','describe','/:id/questions','getQuestions','post','create','put','/:id','update','multer','util','path','connect-timeout','Router','../../components/auth/service'];(function(_0x4e4afa,_0x9ee0e6){var _0x41219c=function(_0x15b7ac){while(--_0x15b7ac){_0x4e4afa['push'](_0x4e4afa['shift']());}};_0x41219c(++_0x9ee0e6);}(_0xec26,0x78));var _0x6ec2=function(_0x57bb76,_0x423d85){_0x57bb76=_0x57bb76-0x0;var _0x4f7c04=_0xec26[_0x57bb76];return _0x4f7c04;};'use strict';var multer=require(_0x6ec2('0x0'));var util=require(_0x6ec2('0x1'));var path=require(_0x6ec2('0x2'));var timeout=require(_0x6ec2('0x3'));var express=require('express');var router=express[_0x6ec2('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x6ec2('0x5'));var interaction=require(_0x6ec2('0x6'));var config=require(_0x6ec2('0x7'));var controller=require(_0x6ec2('0x8'));router['get']('/',auth[_0x6ec2('0x9')](),controller[_0x6ec2('0xa')]);router[_0x6ec2('0xb')](_0x6ec2('0xc'),auth['isAuthenticated'](),controller[_0x6ec2('0xd')]);router[_0x6ec2('0xb')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x6ec2('0xb')](_0x6ec2('0xe'),auth[_0x6ec2('0x9')](),controller[_0x6ec2('0xf')]);router[_0x6ec2('0x10')]('/',auth[_0x6ec2('0x9')](),controller[_0x6ec2('0x11')]);router[_0x6ec2('0x12')](_0x6ec2('0x13'),auth['isAuthenticated'](),controller[_0x6ec2('0x14')]);router['delete'](_0x6ec2('0x13'),auth[_0x6ec2('0x9')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xf433=['util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./jscriptySessionReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','getQuestions','create','update'];(function(_0x86ff41,_0x22a877){var _0x6c706d=function(_0x2703ad){while(--_0x2703ad){_0x86ff41['push'](_0x86ff41['shift']());}};_0x6c706d(++_0x22a877);}(_0xf433,0x169));var _0x3f43=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf433[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require('multer');var util=require(_0x3f43('0x0'));var path=require(_0x3f43('0x1'));var timeout=require(_0x3f43('0x2'));var express=require(_0x3f43('0x3'));var router=express[_0x3f43('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x3f43('0x5'));var interaction=require(_0x3f43('0x6'));var config=require(_0x3f43('0x7'));var controller=require(_0x3f43('0x8'));router[_0x3f43('0x9')]('/',auth[_0x3f43('0xa')](),controller[_0x3f43('0xb')]);router['get'](_0x3f43('0xc'),auth[_0x3f43('0xa')](),controller[_0x3f43('0xd')]);router[_0x3f43('0x9')](_0x3f43('0xe'),auth[_0x3f43('0xa')](),controller[_0x3f43('0xf')]);router[_0x3f43('0x9')]('/:id/questions',auth[_0x3f43('0xa')](),controller[_0x3f43('0x10')]);router['post']('/',auth['isAuthenticated'](),controller[_0x3f43('0x11')]);router['put']('/:id',auth[_0x3f43('0xa')](),controller[_0x3f43('0x12')]);router['delete'](_0x3f43('0xe'),auth['isAuthenticated'](),controller['destroy']);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 b0dc66d..fc8f6ba 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 _0x2ee5=['format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE','setDataValue'];(function(_0xc88493,_0x1b0b27){var _0x9279b0=function(_0x3cf213){while(--_0x3cf213){_0xc88493['push'](_0xc88493['shift']());}};_0x9279b0(++_0x1b0b27);}(_0x2ee5,0x1ab));var _0x52ee=function(_0x212856,_0x1a505a){_0x212856=_0x212856-0x0;var _0x26f0c1=_0x2ee5[_0x212856];return _0x26f0c1;};'use strict';var moment=require(_0x52ee('0x0'));var Sequelize=require(_0x52ee('0x1'));module[_0x52ee('0x2')]={'starttime':{'type':Sequelize[_0x52ee('0x3')],'set':function(_0x28d66e){this[_0x52ee('0x4')]('starttime',_0x28d66e);this[_0x52ee('0x4')]('endtime',moment()[_0x52ee('0x5')](_0x52ee('0x6')));}},'endtime':{'type':Sequelize[_0x52ee('0x3')]},'membername':{'type':Sequelize[_0x52ee('0x7')]},'projectname':{'type':Sequelize[_0x52ee('0x7')]},'queue':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x52ee('0x7')]},'calleridname':{'type':Sequelize[_0x52ee('0x7')]},'calleridnum':{'type':Sequelize[_0x52ee('0x7')]},'completed':{'type':Sequelize[_0x52ee('0x8')],'defaultValue':![]}}; \ No newline at end of file +var _0x675b=['setDataValue','starttime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','STRING','BOOLEAN','moment','sequelize','exports','DATE'];(function(_0x134c2e,_0x3573c4){var _0x2825db=function(_0x2a574d){while(--_0x2a574d){_0x134c2e['push'](_0x134c2e['shift']());}};_0x2825db(++_0x3573c4);}(_0x675b,0x13b));var _0xb675=function(_0x2d5f74,_0x39b2bb){_0x2d5f74=_0x2d5f74-0x0;var _0x52e0af=_0x675b[_0x2d5f74];return _0x52e0af;};'use strict';var moment=require(_0xb675('0x0'));var Sequelize=require(_0xb675('0x1'));module[_0xb675('0x2')]={'starttime':{'type':Sequelize[_0xb675('0x3')],'set':function(_0x39097c){this[_0xb675('0x4')](_0xb675('0x5'),_0x39097c);this[_0xb675('0x4')](_0xb675('0x6'),moment()[_0xb675('0x7')](_0xb675('0x8')));}},'endtime':{'type':Sequelize[_0xb675('0x3')]},'membername':{'type':Sequelize[_0xb675('0x9')]},'projectname':{'type':Sequelize[_0xb675('0x9')]},'queue':{'type':Sequelize[_0xb675('0x9')]},'uniqueid':{'type':Sequelize[_0xb675('0x9')]},'calleridname':{'type':Sequelize[_0xb675('0x9')]},'calleridnum':{'type':Sequelize[_0xb675('0x9')]},'completed':{'type':Sequelize[_0xb675('0xa')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.controller.js b/server/api/jscriptySessionReport/jscriptySessionReport.controller.js index 02e790e..9d962c0 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 _0xccc8=['send','index','map','JscriptySessionReport','rawAttributes','type','model','keys','query','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','then','includeAll','include','rows','catch','params','find','create','body','destroy','describe','findOne','JscriptyQuestionReport','nolimit','findAll','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','sendStatus','status','end','undefined','limit','offset','set','Content-Range','json','reject','save','update','name'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0xccc8,0xff));var _0x8ccc=function(_0x533e4e,_0x4eba54){_0x533e4e=_0x533e4e-0x0;var _0x1f14bb=_0xccc8[_0x533e4e];return _0x1f14bb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x8ccc('0x0'));var zipdir=require(_0x8ccc('0x1'));var jsonpatch=require(_0x8ccc('0x2'));var rp=require('request-promise');var moment=require(_0x8ccc('0x3'));var BPromise=require(_0x8ccc('0x4'));var Mustache=require(_0x8ccc('0x5'));var util=require('util');var path=require(_0x8ccc('0x6'));var sox=require('sox');var csv=require(_0x8ccc('0x7'));var ejs=require(_0x8ccc('0x8'));var fs=require('fs');var fs_extra=require(_0x8ccc('0x9'));var _=require(_0x8ccc('0xa'));var squel=require(_0x8ccc('0xb'));var crypto=require('crypto');var jsforce=require(_0x8ccc('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8ccc('0xd'));var Papa=require('papaparse');var Redis=require(_0x8ccc('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x8ccc('0xf'));var hardwareService=require(_0x8ccc('0x10'));var logger=require('../../config/logger')(_0x8ccc('0x11'));var utils=require(_0x8ccc('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0x8ccc('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x23097a,_0x4fbd2f){_0x4fbd2f=_0x4fbd2f||0xcc;return function(_0x27a591){if(_0x27a591){return _0x23097a[_0x8ccc('0x14')](_0x4fbd2f);}return _0x23097a[_0x8ccc('0x15')](_0x4fbd2f)[_0x8ccc('0x16')]();};}function respondWithResult(_0x23a47b,_0x527a1d){_0x527a1d=_0x527a1d||0xc8;return function(_0x28530c){if(_0x28530c){return _0x23a47b['status'](_0x527a1d)['json'](_0x28530c);}};}function respondWithFilteredResult(_0x5936a1,_0x1d3daf){return function(_0x4a9b6c){if(_0x4a9b6c){var _0x1b82ac=typeof _0x1d3daf['offset']===_0x8ccc('0x17')&&typeof _0x1d3daf[_0x8ccc('0x18')]===_0x8ccc('0x17');var _0x492fbf=_0x4a9b6c['count'];var _0x19edfe=_0x1b82ac?0x0:_0x1d3daf[_0x8ccc('0x19')];var _0x363d60=_0x1b82ac?_0x4a9b6c['count']:_0x1d3daf['offset']+_0x1d3daf[_0x8ccc('0x18')];var _0x131e90;if(_0x363d60>=_0x492fbf){_0x363d60=_0x492fbf;_0x131e90=0xc8;}else{_0x131e90=0xce;}_0x5936a1[_0x8ccc('0x15')](_0x131e90);return _0x5936a1[_0x8ccc('0x1a')](_0x8ccc('0x1b'),_0x19edfe+'-'+_0x363d60+'/'+_0x492fbf)[_0x8ccc('0x1c')](_0x4a9b6c);}return null;};}function patchUpdates(_0x5a49b3){return function(_0xfdc9cb){try{jsonpatch['apply'](_0xfdc9cb,_0x5a49b3,!![]);}catch(_0x4ab502){return BPromise[_0x8ccc('0x1d')](_0x4ab502);}return _0xfdc9cb[_0x8ccc('0x1e')]();};}function saveUpdates(_0x4e9305,_0x337e46){return function(_0x21d0bf){if(_0x21d0bf){return _0x21d0bf[_0x8ccc('0x1f')](_0x4e9305)['then'](function(_0x182248){return _0x182248;});}return null;};}function removeEntity(_0xde5f42,_0x51911e){return function(_0x4f2654){if(_0x4f2654){return _0x4f2654['destroy']()['then'](function(){_0xde5f42[_0x8ccc('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x51db6a,_0x365513){return function(_0x5eda72){if(!_0x5eda72){_0x51db6a[_0x8ccc('0x14')](0x194);}return _0x5eda72;};}function handleError(_0x17df46,_0x5ce8fe){_0x5ce8fe=_0x5ce8fe||0x1f4;return function(_0x2b969b){logger['error'](_0x2b969b['stack']);if(_0x2b969b[_0x8ccc('0x20')]){delete _0x2b969b['name'];}_0x17df46[_0x8ccc('0x15')](_0x5ce8fe)[_0x8ccc('0x21')](_0x2b969b);};}exports[_0x8ccc('0x22')]=function(_0xb652ba,_0x4680e0){var _0x14c0b0={},_0x2ae305={},_0x95de67={'count':0x0,'rows':[]};var _0x590fd4=_[_0x8ccc('0x23')](db[_0x8ccc('0x24')][_0x8ccc('0x25')],function(_0x406efb){return{'name':_0x406efb['fieldName'],'type':_0x406efb[_0x8ccc('0x26')]['key']};});_0x2ae305[_0x8ccc('0x27')]=_[_0x8ccc('0x23')](_0x590fd4,_0x8ccc('0x20'));_0x2ae305['query']=_[_0x8ccc('0x28')](_0xb652ba[_0x8ccc('0x29')]);_0x2ae305['filters']=_['intersection'](_0x2ae305[_0x8ccc('0x27')],_0x2ae305['query']);_0x14c0b0[_0x8ccc('0x2a')]=_[_0x8ccc('0x2b')](_0x2ae305[_0x8ccc('0x27')],qs[_0x8ccc('0x2c')](_0xb652ba['query'][_0x8ccc('0x2c')]));_0x14c0b0['attributes']=_0x14c0b0[_0x8ccc('0x2a')][_0x8ccc('0x2d')]?_0x14c0b0[_0x8ccc('0x2a')]:_0x2ae305[_0x8ccc('0x27')];if(!_0xb652ba[_0x8ccc('0x29')][_0x8ccc('0x2e')]('nolimit')){_0x14c0b0[_0x8ccc('0x18')]=qs[_0x8ccc('0x18')](_0xb652ba[_0x8ccc('0x29')][_0x8ccc('0x18')]);_0x14c0b0[_0x8ccc('0x19')]=qs[_0x8ccc('0x19')](_0xb652ba['query'][_0x8ccc('0x19')]);}_0x14c0b0[_0x8ccc('0x2f')]=qs[_0x8ccc('0x30')](_0xb652ba[_0x8ccc('0x29')][_0x8ccc('0x30')]);_0x14c0b0[_0x8ccc('0x31')]=qs[_0x8ccc('0x32')](_[_0x8ccc('0x33')](_0xb652ba['query'],_0x2ae305[_0x8ccc('0x32')]),_0x590fd4);if(_0xb652ba[_0x8ccc('0x29')]['filter']){_0x14c0b0[_0x8ccc('0x31')]=_[_0x8ccc('0x34')](_0x14c0b0['where'],{'$or':_[_0x8ccc('0x23')](_0x590fd4,function(_0xec3d97){if(_0xec3d97['type']!==_0x8ccc('0x35')){var _0x114dfb={};_0x114dfb[_0xec3d97[_0x8ccc('0x20')]]={'$like':'%'+_0xb652ba[_0x8ccc('0x29')][_0x8ccc('0x36')]+'%'};return _0x114dfb;}})});}_0x14c0b0=_['merge']({},_0x14c0b0,_0xb652ba[_0x8ccc('0x37')]);var _0x3a98dd={'where':_0x14c0b0[_0x8ccc('0x31')]};return db[_0x8ccc('0x24')][_0x8ccc('0x38')](_0x3a98dd)[_0x8ccc('0x39')](function(_0x143a5d){_0x95de67['count']=_0x143a5d;if(_0xb652ba['query'][_0x8ccc('0x3a')]){_0x14c0b0[_0x8ccc('0x3b')]=[{'all':!![]}];}return db['JscriptySessionReport']['findAll'](_0x14c0b0);})[_0x8ccc('0x39')](function(_0xe91709){_0x95de67[_0x8ccc('0x3c')]=_0xe91709;return _0x95de67;})['then'](respondWithFilteredResult(_0x4680e0,_0x14c0b0))[_0x8ccc('0x3d')](handleError(_0x4680e0,null));};exports['show']=function(_0x256818,_0x4692ce){var _0x371b5e={'raw':!![],'where':{'id':_0x256818[_0x8ccc('0x3e')]['id']}},_0x216224={};_0x216224[_0x8ccc('0x27')]=_['keys'](db['JscriptySessionReport'][_0x8ccc('0x25')]);_0x216224['query']=_['keys'](_0x256818[_0x8ccc('0x29')]);_0x216224[_0x8ccc('0x32')]=_[_0x8ccc('0x2b')](_0x216224[_0x8ccc('0x27')],_0x216224['query']);_0x371b5e['attributes']=_[_0x8ccc('0x2b')](_0x216224[_0x8ccc('0x27')],qs['fields'](_0x256818[_0x8ccc('0x29')]['fields']));_0x371b5e[_0x8ccc('0x2a')]=_0x371b5e['attributes'][_0x8ccc('0x2d')]?_0x371b5e['attributes']:_0x216224['model'];if(_0x256818[_0x8ccc('0x29')][_0x8ccc('0x3a')]){_0x371b5e[_0x8ccc('0x3b')]=[{'all':!![]}];}_0x371b5e=_[_0x8ccc('0x34')]({},_0x371b5e,_0x256818[_0x8ccc('0x37')]);return db['JscriptySessionReport'][_0x8ccc('0x3f')](_0x371b5e)[_0x8ccc('0x39')](handleEntityNotFound(_0x4692ce,null))['then'](respondWithResult(_0x4692ce,null))[_0x8ccc('0x3d')](handleError(_0x4692ce,null));};exports['create']=function(_0x58bb4c,_0x4d41b9){return db[_0x8ccc('0x24')][_0x8ccc('0x40')](_0x58bb4c[_0x8ccc('0x41')],{})[_0x8ccc('0x39')](respondWithResult(_0x4d41b9,0xc9))['catch'](handleError(_0x4d41b9,null));};exports['update']=function(_0x54bb72,_0x50840d){if(_0x54bb72[_0x8ccc('0x41')]['id']){delete _0x54bb72[_0x8ccc('0x41')]['id'];}return db[_0x8ccc('0x24')]['find']({'where':{'id':_0x54bb72[_0x8ccc('0x3e')]['id']}})[_0x8ccc('0x39')](handleEntityNotFound(_0x50840d,null))[_0x8ccc('0x39')](saveUpdates(_0x54bb72[_0x8ccc('0x41')],null))['then'](respondWithResult(_0x50840d,null))[_0x8ccc('0x3d')](handleError(_0x50840d,null));};exports[_0x8ccc('0x42')]=function(_0x121690,_0xa081e6){return db['JscriptySessionReport'][_0x8ccc('0x3f')]({'where':{'id':_0x121690[_0x8ccc('0x3e')]['id']}})[_0x8ccc('0x39')](handleEntityNotFound(_0xa081e6,null))[_0x8ccc('0x39')](removeEntity(_0xa081e6,null))[_0x8ccc('0x3d')](handleError(_0xa081e6,null));};exports['describe']=function(_0x2493b5,_0x5541fb){return db[_0x8ccc('0x24')][_0x8ccc('0x43')]()[_0x8ccc('0x39')](respondWithResult(_0x5541fb,null))['catch'](handleError(_0x5541fb,null));};exports['getQuestions']=function(_0x2be7ce,_0x51b220,_0x3c8efe){var _0x8b0d51={'raw':!![],'where':{}};var _0x193881={};var _0x18e298={'count':0x0,'rows':[]};return db['JscriptySessionReport'][_0x8ccc('0x44')]({'where':{'id':_0x2be7ce['params']['id']}})[_0x8ccc('0x39')](handleEntityNotFound(_0x51b220,null))[_0x8ccc('0x39')](function(_0x450cf3){if(_0x450cf3){_0x193881[_0x8ccc('0x27')]=_[_0x8ccc('0x28')](db[_0x8ccc('0x45')][_0x8ccc('0x25')]);_0x193881[_0x8ccc('0x29')]=_[_0x8ccc('0x28')](_0x2be7ce[_0x8ccc('0x29')]);_0x193881['filters']=_[_0x8ccc('0x2b')](_0x193881[_0x8ccc('0x27')],_0x193881[_0x8ccc('0x29')]);_0x8b0d51[_0x8ccc('0x2a')]=_['intersection'](_0x193881['model'],qs[_0x8ccc('0x2c')](_0x2be7ce[_0x8ccc('0x29')][_0x8ccc('0x2c')]));_0x8b0d51['attributes']=_0x8b0d51[_0x8ccc('0x2a')]['length']?_0x8b0d51['attributes']:_0x193881['model'];if(!_0x2be7ce['query']['hasOwnProperty'](_0x8ccc('0x46'))){_0x8b0d51[_0x8ccc('0x18')]=qs[_0x8ccc('0x18')](_0x2be7ce[_0x8ccc('0x29')][_0x8ccc('0x18')]);_0x8b0d51[_0x8ccc('0x19')]=qs[_0x8ccc('0x19')](_0x2be7ce['query'][_0x8ccc('0x19')]);}_0x8b0d51[_0x8ccc('0x2f')]=qs[_0x8ccc('0x30')](_0x2be7ce[_0x8ccc('0x29')][_0x8ccc('0x30')]);_0x8b0d51[_0x8ccc('0x31')]=qs['filters'](_[_0x8ccc('0x33')](_0x2be7ce[_0x8ccc('0x29')],_0x193881['filters']));_0x8b0d51[_0x8ccc('0x31')]['SessionId']=_0x450cf3['id'];if(_0x2be7ce[_0x8ccc('0x29')][_0x8ccc('0x36')]){_0x8b0d51[_0x8ccc('0x31')]=_[_0x8ccc('0x34')](_0x8b0d51[_0x8ccc('0x31')],{'$or':_['map'](_0x8b0d51[_0x8ccc('0x2a')],function(_0x5558cf){var _0x5ed236={};_0x5ed236[_0x5558cf]={'$like':'%'+_0x2be7ce[_0x8ccc('0x29')]['filter']+'%'};return _0x5ed236;})});}_0x8b0d51=_[_0x8ccc('0x34')]({},_0x8b0d51,_0x2be7ce[_0x8ccc('0x37')]);return db['JscriptyQuestionReport'][_0x8ccc('0x38')]({'where':_0x8b0d51[_0x8ccc('0x31')]})['then'](function(_0x11f0c0){_0x18e298[_0x8ccc('0x38')]=_0x11f0c0;if(_0x2be7ce[_0x8ccc('0x29')][_0x8ccc('0x3a')]){_0x8b0d51[_0x8ccc('0x3b')]=[{'all':!![]}];}return db[_0x8ccc('0x45')][_0x8ccc('0x47')](_0x8b0d51);})[_0x8ccc('0x39')](function(_0x4be6c8){_0x18e298[_0x8ccc('0x3c')]=_0x4be6c8;return _0x18e298;});}})['then'](respondWithFilteredResult(_0x51b220,_0x8b0d51))[_0x8ccc('0x3d')](handleError(_0x51b220,null));}; \ No newline at end of file +var _0xd6fc=['type','key','map','intersection','model','attributes','fields','query','hasOwnProperty','order','sort','where','filters','pick','filter','VIRTUAL','includeAll','include','findAll','rows','catch','params','JscriptySessionReport','keys','length','merge','options','find','create','body','describe','getQuestions','nolimit','SessionId','JscriptyQuestionReport','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','crypto','jsforce','desk.js','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','undefined','limit','count','offset','set','json','apply','reject','save','then','sendStatus','error','name','send','index','rawAttributes','fieldName'];(function(_0x96be88,_0x2c01a4){var _0x1c14c0=function(_0x20aeff){while(--_0x20aeff){_0x96be88['push'](_0x96be88['shift']());}};_0x1c14c0(++_0x2c01a4);}(_0xd6fc,0x104));var _0xcd6f=function(_0x3f9030,_0x4880a1){_0x3f9030=_0x3f9030-0x0;var _0x381c55=_0xd6fc[_0x3f9030];return _0x381c55;};'use strict';var emlformat=require(_0xcd6f('0x0'));var rimraf=require(_0xcd6f('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xcd6f('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xcd6f('0x3'));var Mustache=require(_0xcd6f('0x4'));var util=require(_0xcd6f('0x5'));var path=require(_0xcd6f('0x6'));var sox=require(_0xcd6f('0x7'));var csv=require(_0xcd6f('0x8'));var ejs=require(_0xcd6f('0x9'));var fs=require('fs');var fs_extra=require(_0xcd6f('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xcd6f('0xb'));var jsforce=require(_0xcd6f('0xc'));var deskjs=require(_0xcd6f('0xd'));var toCsv=require(_0xcd6f('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xcd6f('0xe'));var as=require(_0xcd6f('0xf'));var hardwareService=require(_0xcd6f('0x10'));var logger=require('../../config/logger')('api');var utils=require(_0xcd6f('0x11'));var config=require(_0xcd6f('0x12'));var licenseUtil=require(_0xcd6f('0x13'));var db=require(_0xcd6f('0x14'))['db'];function respondWithStatusCode(_0x59a18d,_0xf0b62a){_0xf0b62a=_0xf0b62a||0xcc;return function(_0x25842d){if(_0x25842d){return _0x59a18d['sendStatus'](_0xf0b62a);}return _0x59a18d[_0xcd6f('0x15')](_0xf0b62a)[_0xcd6f('0x16')]();};}function respondWithResult(_0x2591c9,_0x604f49){_0x604f49=_0x604f49||0xc8;return function(_0x4246ab){if(_0x4246ab){return _0x2591c9[_0xcd6f('0x15')](_0x604f49)['json'](_0x4246ab);}};}function respondWithFilteredResult(_0x2779ba,_0x38424d){return function(_0x17634a){if(_0x17634a){var _0x3524c8=typeof _0x38424d['offset']===_0xcd6f('0x17')&&typeof _0x38424d[_0xcd6f('0x18')]==='undefined';var _0x2c8fb9=_0x17634a[_0xcd6f('0x19')];var _0x3d141e=_0x3524c8?0x0:_0x38424d[_0xcd6f('0x1a')];var _0x3cb505=_0x3524c8?_0x17634a[_0xcd6f('0x19')]:_0x38424d[_0xcd6f('0x1a')]+_0x38424d[_0xcd6f('0x18')];var _0x3e3b79;if(_0x3cb505>=_0x2c8fb9){_0x3cb505=_0x2c8fb9;_0x3e3b79=0xc8;}else{_0x3e3b79=0xce;}_0x2779ba[_0xcd6f('0x15')](_0x3e3b79);return _0x2779ba[_0xcd6f('0x1b')]('Content-Range',_0x3d141e+'-'+_0x3cb505+'/'+_0x2c8fb9)[_0xcd6f('0x1c')](_0x17634a);}return null;};}function patchUpdates(_0x2f9680){return function(_0x3d87d8){try{jsonpatch[_0xcd6f('0x1d')](_0x3d87d8,_0x2f9680,!![]);}catch(_0x581761){return BPromise[_0xcd6f('0x1e')](_0x581761);}return _0x3d87d8[_0xcd6f('0x1f')]();};}function saveUpdates(_0x180596,_0x2747a4){return function(_0x5e1d85){if(_0x5e1d85){return _0x5e1d85['update'](_0x180596)[_0xcd6f('0x20')](function(_0x442962){return _0x442962;});}return null;};}function removeEntity(_0x2e4f32,_0x3b7f8d){return function(_0x25d2e1){if(_0x25d2e1){return _0x25d2e1['destroy']()[_0xcd6f('0x20')](function(){_0x2e4f32[_0xcd6f('0x15')](0xcc)[_0xcd6f('0x16')]();});}};}function handleEntityNotFound(_0x5c47a2,_0x1d9c54){return function(_0x25411e){if(!_0x25411e){_0x5c47a2[_0xcd6f('0x21')](0x194);}return _0x25411e;};}function handleError(_0x34cd6d,_0x3f10ae){_0x3f10ae=_0x3f10ae||0x1f4;return function(_0x218d19){logger[_0xcd6f('0x22')](_0x218d19['stack']);if(_0x218d19['name']){delete _0x218d19[_0xcd6f('0x23')];}_0x34cd6d[_0xcd6f('0x15')](_0x3f10ae)[_0xcd6f('0x24')](_0x218d19);};}exports[_0xcd6f('0x25')]=function(_0x3f366d,_0x1a9ffd){var _0x2fb8b3={},_0x329641={},_0x12869f={'count':0x0,'rows':[]};var _0x30c84e=_['map'](db['JscriptySessionReport'][_0xcd6f('0x26')],function(_0x2cd5dc){return{'name':_0x2cd5dc[_0xcd6f('0x27')],'type':_0x2cd5dc[_0xcd6f('0x28')][_0xcd6f('0x29')]};});_0x329641['model']=_[_0xcd6f('0x2a')](_0x30c84e,_0xcd6f('0x23'));_0x329641['query']=_['keys'](_0x3f366d['query']);_0x329641['filters']=_[_0xcd6f('0x2b')](_0x329641[_0xcd6f('0x2c')],_0x329641['query']);_0x2fb8b3[_0xcd6f('0x2d')]=_[_0xcd6f('0x2b')](_0x329641[_0xcd6f('0x2c')],qs[_0xcd6f('0x2e')](_0x3f366d[_0xcd6f('0x2f')][_0xcd6f('0x2e')]));_0x2fb8b3[_0xcd6f('0x2d')]=_0x2fb8b3['attributes']['length']?_0x2fb8b3['attributes']:_0x329641[_0xcd6f('0x2c')];if(!_0x3f366d['query'][_0xcd6f('0x30')]('nolimit')){_0x2fb8b3[_0xcd6f('0x18')]=qs[_0xcd6f('0x18')](_0x3f366d[_0xcd6f('0x2f')]['limit']);_0x2fb8b3['offset']=qs[_0xcd6f('0x1a')](_0x3f366d[_0xcd6f('0x2f')]['offset']);}_0x2fb8b3[_0xcd6f('0x31')]=qs[_0xcd6f('0x32')](_0x3f366d[_0xcd6f('0x2f')][_0xcd6f('0x32')]);_0x2fb8b3[_0xcd6f('0x33')]=qs[_0xcd6f('0x34')](_[_0xcd6f('0x35')](_0x3f366d[_0xcd6f('0x2f')],_0x329641[_0xcd6f('0x34')]),_0x30c84e);if(_0x3f366d[_0xcd6f('0x2f')][_0xcd6f('0x36')]){_0x2fb8b3['where']=_['merge'](_0x2fb8b3['where'],{'$or':_[_0xcd6f('0x2a')](_0x30c84e,function(_0x471017){if(_0x471017[_0xcd6f('0x28')]!==_0xcd6f('0x37')){var _0x20e465={};_0x20e465[_0x471017[_0xcd6f('0x23')]]={'$like':'%'+_0x3f366d[_0xcd6f('0x2f')]['filter']+'%'};return _0x20e465;}})});}_0x2fb8b3=_['merge']({},_0x2fb8b3,_0x3f366d['options']);var _0x4dcc39={'where':_0x2fb8b3[_0xcd6f('0x33')]};return db['JscriptySessionReport'][_0xcd6f('0x19')](_0x4dcc39)['then'](function(_0x406035){_0x12869f[_0xcd6f('0x19')]=_0x406035;if(_0x3f366d['query'][_0xcd6f('0x38')]){_0x2fb8b3[_0xcd6f('0x39')]=[{'all':!![]}];}return db['JscriptySessionReport'][_0xcd6f('0x3a')](_0x2fb8b3);})[_0xcd6f('0x20')](function(_0x25c5fa){_0x12869f[_0xcd6f('0x3b')]=_0x25c5fa;return _0x12869f;})['then'](respondWithFilteredResult(_0x1a9ffd,_0x2fb8b3))[_0xcd6f('0x3c')](handleError(_0x1a9ffd,null));};exports['show']=function(_0x2e158b,_0x3b88a6){var _0x3f57b9={'raw':!![],'where':{'id':_0x2e158b[_0xcd6f('0x3d')]['id']}},_0x2cbf7d={};_0x2cbf7d[_0xcd6f('0x2c')]=_['keys'](db[_0xcd6f('0x3e')][_0xcd6f('0x26')]);_0x2cbf7d['query']=_[_0xcd6f('0x3f')](_0x2e158b[_0xcd6f('0x2f')]);_0x2cbf7d['filters']=_[_0xcd6f('0x2b')](_0x2cbf7d[_0xcd6f('0x2c')],_0x2cbf7d[_0xcd6f('0x2f')]);_0x3f57b9['attributes']=_[_0xcd6f('0x2b')](_0x2cbf7d['model'],qs[_0xcd6f('0x2e')](_0x2e158b['query'][_0xcd6f('0x2e')]));_0x3f57b9[_0xcd6f('0x2d')]=_0x3f57b9['attributes'][_0xcd6f('0x40')]?_0x3f57b9[_0xcd6f('0x2d')]:_0x2cbf7d['model'];if(_0x2e158b[_0xcd6f('0x2f')][_0xcd6f('0x38')]){_0x3f57b9[_0xcd6f('0x39')]=[{'all':!![]}];}_0x3f57b9=_[_0xcd6f('0x41')]({},_0x3f57b9,_0x2e158b[_0xcd6f('0x42')]);return db[_0xcd6f('0x3e')][_0xcd6f('0x43')](_0x3f57b9)['then'](handleEntityNotFound(_0x3b88a6,null))['then'](respondWithResult(_0x3b88a6,null))['catch'](handleError(_0x3b88a6,null));};exports[_0xcd6f('0x44')]=function(_0x350cc9,_0x1e044c){return db[_0xcd6f('0x3e')][_0xcd6f('0x44')](_0x350cc9['body'],{})[_0xcd6f('0x20')](respondWithResult(_0x1e044c,0xc9))[_0xcd6f('0x3c')](handleError(_0x1e044c,null));};exports['update']=function(_0x3b3b97,_0x3c0865){if(_0x3b3b97[_0xcd6f('0x45')]['id']){delete _0x3b3b97['body']['id'];}return db[_0xcd6f('0x3e')][_0xcd6f('0x43')]({'where':{'id':_0x3b3b97[_0xcd6f('0x3d')]['id']}})['then'](handleEntityNotFound(_0x3c0865,null))[_0xcd6f('0x20')](saveUpdates(_0x3b3b97[_0xcd6f('0x45')],null))[_0xcd6f('0x20')](respondWithResult(_0x3c0865,null))['catch'](handleError(_0x3c0865,null));};exports['destroy']=function(_0x2353e1,_0x450b06){return db[_0xcd6f('0x3e')]['find']({'where':{'id':_0x2353e1[_0xcd6f('0x3d')]['id']}})[_0xcd6f('0x20')](handleEntityNotFound(_0x450b06,null))['then'](removeEntity(_0x450b06,null))[_0xcd6f('0x3c')](handleError(_0x450b06,null));};exports[_0xcd6f('0x46')]=function(_0x3361d7,_0x3e4129){return db[_0xcd6f('0x3e')][_0xcd6f('0x46')]()[_0xcd6f('0x20')](respondWithResult(_0x3e4129,null))[_0xcd6f('0x3c')](handleError(_0x3e4129,null));};exports[_0xcd6f('0x47')]=function(_0x456258,_0x59f6dc,_0x39f948){var _0x443bfb={'raw':!![],'where':{}};var _0x4cb75c={};var _0x2a884d={'count':0x0,'rows':[]};return db['JscriptySessionReport']['findOne']({'where':{'id':_0x456258[_0xcd6f('0x3d')]['id']}})['then'](handleEntityNotFound(_0x59f6dc,null))[_0xcd6f('0x20')](function(_0x19aec1){if(_0x19aec1){_0x4cb75c[_0xcd6f('0x2c')]=_[_0xcd6f('0x3f')](db['JscriptyQuestionReport']['rawAttributes']);_0x4cb75c[_0xcd6f('0x2f')]=_[_0xcd6f('0x3f')](_0x456258['query']);_0x4cb75c[_0xcd6f('0x34')]=_[_0xcd6f('0x2b')](_0x4cb75c['model'],_0x4cb75c[_0xcd6f('0x2f')]);_0x443bfb['attributes']=_['intersection'](_0x4cb75c[_0xcd6f('0x2c')],qs[_0xcd6f('0x2e')](_0x456258[_0xcd6f('0x2f')][_0xcd6f('0x2e')]));_0x443bfb[_0xcd6f('0x2d')]=_0x443bfb[_0xcd6f('0x2d')][_0xcd6f('0x40')]?_0x443bfb[_0xcd6f('0x2d')]:_0x4cb75c['model'];if(!_0x456258['query'][_0xcd6f('0x30')](_0xcd6f('0x48'))){_0x443bfb[_0xcd6f('0x18')]=qs[_0xcd6f('0x18')](_0x456258[_0xcd6f('0x2f')][_0xcd6f('0x18')]);_0x443bfb['offset']=qs[_0xcd6f('0x1a')](_0x456258[_0xcd6f('0x2f')]['offset']);}_0x443bfb['order']=qs['sort'](_0x456258[_0xcd6f('0x2f')][_0xcd6f('0x32')]);_0x443bfb[_0xcd6f('0x33')]=qs[_0xcd6f('0x34')](_[_0xcd6f('0x35')](_0x456258[_0xcd6f('0x2f')],_0x4cb75c['filters']));_0x443bfb[_0xcd6f('0x33')][_0xcd6f('0x49')]=_0x19aec1['id'];if(_0x456258[_0xcd6f('0x2f')]['filter']){_0x443bfb[_0xcd6f('0x33')]=_['merge'](_0x443bfb[_0xcd6f('0x33')],{'$or':_[_0xcd6f('0x2a')](_0x443bfb[_0xcd6f('0x2d')],function(_0x108a4e){var _0x568a6a={};_0x568a6a[_0x108a4e]={'$like':'%'+_0x456258['query'][_0xcd6f('0x36')]+'%'};return _0x568a6a;})});}_0x443bfb=_[_0xcd6f('0x41')]({},_0x443bfb,_0x456258[_0xcd6f('0x42')]);return db[_0xcd6f('0x4a')][_0xcd6f('0x19')]({'where':_0x443bfb[_0xcd6f('0x33')]})[_0xcd6f('0x20')](function(_0x2c0c35){_0x2a884d['count']=_0x2c0c35;if(_0x456258[_0xcd6f('0x2f')]['includeAll']){_0x443bfb['include']=[{'all':!![]}];}return db[_0xcd6f('0x4a')][_0xcd6f('0x3a')](_0x443bfb);})[_0xcd6f('0x20')](function(_0x5b231c){_0x2a884d['rows']=_0x5b231c;return _0x2a884d;});}})[_0xcd6f('0x20')](respondWithFilteredResult(_0x59f6dc,_0x443bfb))[_0xcd6f('0x3c')](handleError(_0x59f6dc,null));}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.model.js b/server/api/jscriptySessionReport/jscriptySessionReport.model.js index c253321..d889300 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 _0x5d17=['lodash','util','moment','bluebird','request-promise','rimraf','../../config/environment','./jscriptySessionReport.attributes','exports','define','JscriptySessionReport','report_jscripty_sessions'];(function(_0xf9946c,_0x48fd6f){var _0xd78074=function(_0x5e86b6){while(--_0x5e86b6){_0xf9946c['push'](_0xf9946c['shift']());}};_0xd78074(++_0x48fd6f);}(_0x5d17,0x114));var _0x75d1=function(_0x27d958,_0x29ef87){_0x27d958=_0x27d958-0x0;var _0x53e63e=_0x5d17[_0x27d958];return _0x53e63e;};'use strict';var _=require(_0x75d1('0x0'));var util=require(_0x75d1('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x75d1('0x2'));var BPromise=require(_0x75d1('0x3'));var rp=require(_0x75d1('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x75d1('0x5'));var config=require(_0x75d1('0x6'));var attributes=require(_0x75d1('0x7'));module[_0x75d1('0x8')]=function(_0x56ac0a,_0x458681){return _0x56ac0a[_0x75d1('0x9')](_0x75d1('0xa'),attributes,{'tableName':_0x75d1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9fd4=['rimraf','exports','define','report_jscripty_sessions','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9fd4,0x16c));var _0x49fd=function(_0x31ce32,_0x3870a8){_0x31ce32=_0x31ce32-0x0;var _0x40958b=_0x9fd4[_0x31ce32];return _0x40958b;};'use strict';var _=require(_0x49fd('0x0'));var util=require(_0x49fd('0x1'));var logger=require(_0x49fd('0x2'))(_0x49fd('0x3'));var moment=require(_0x49fd('0x4'));var BPromise=require(_0x49fd('0x5'));var rp=require(_0x49fd('0x6'));var fs=require('fs');var path=require(_0x49fd('0x7'));var rimraf=require(_0x49fd('0x8'));var config=require('../../config/environment');var attributes=require('./jscriptySessionReport.attributes');module[_0x49fd('0x9')]=function(_0x42fdc7,_0x1bc16e){return _0x42fdc7[_0x49fd('0xa')]('JscriptySessionReport',attributes,{'tableName':_0x49fd('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js b/server/api/jscriptySessionReport/jscriptySessionReport.rpc.js index f7d7231..4e15724 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 _0x33af=['error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info','JscriptySessionReport,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x5155b1,_0x447c2e){var _0x2b50b1=function(_0x492ee5){while(--_0x492ee5){_0x5155b1['push'](_0x5155b1['shift']());}};_0x2b50b1(++_0x447c2e);}(_0x33af,0xec));var _0xf33a=function(_0x2d69e1,_0x43f881){_0x2d69e1=_0x2d69e1-0x0;var _0x9b5140=_0x33af[_0x2d69e1];return _0x9b5140;};'use strict';var _=require('lodash');var util=require(_0xf33a('0x0'));var moment=require('moment');var BPromise=require(_0xf33a('0x1'));var rs=require(_0xf33a('0x2'));var fs=require('fs');var Redis=require(_0xf33a('0x3'));var db=require(_0xf33a('0x4'))['db'];var utils=require(_0xf33a('0x5'));var logger=require(_0xf33a('0x6'))('rpc');var config=require(_0xf33a('0x7'));var jayson=require(_0xf33a('0x8'));var client=jayson['client'][_0xf33a('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x384b14,_0x1b2b01,_0x2f3730){return new BPromise(function(_0x2baabb,_0x2cb169){return client['request'](_0x384b14,_0x2f3730)[_0xf33a('0xa')](function(_0x14eb0e){logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,_0xf33a('0xd'));logger[_0xf33a('0xe')]('JscriptySessionReport,\x20%s,\x20%s,\x20%s',_0x1b2b01,'request\x20sent',JSON[_0xf33a('0xf')](_0x14eb0e));if(_0x14eb0e[_0xf33a('0x10')]){if(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x11')]===0x1f4){logger[_0xf33a('0x10')]('JscriptySessionReport,\x20%s,\x20%s',_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2cb169(_0x14eb0e['error']['message']);}logger[_0xf33a('0x10')](_0xf33a('0xc'),_0x1b2b01,_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);return _0x2baabb(_0x14eb0e[_0xf33a('0x10')][_0xf33a('0x12')]);}else{logger[_0xf33a('0xb')](_0xf33a('0xc'),_0x1b2b01,'request\x20sent');_0x2baabb(_0x14eb0e[_0xf33a('0x13')]['message']);}})[_0xf33a('0x14')](function(_0x229389){logger['error'](_0xf33a('0xc'),_0x1b2b01,_0x229389);_0x2cb169(_0x229389);});});} \ No newline at end of file +var _0xed1c=['request\x20sent','JscriptySessionReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptySessionReport,\x20%s,\x20%s','catch','lodash','util','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xed1c,0xe4));var _0xced1=function(_0x2c0769,_0x36c941){_0x2c0769=_0x2c0769-0x0;var _0x58887e=_0xed1c[_0x2c0769];return _0x58887e;};'use strict';var _=require(_0xced1('0x0'));var util=require(_0xced1('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xced1('0x2'))['db'];var utils=require(_0xced1('0x3'));var logger=require(_0xced1('0x4'))('rpc');var config=require(_0xced1('0x5'));var jayson=require(_0xced1('0x6'));var client=jayson[_0xced1('0x7')][_0xced1('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x59399e,_0x2bcf42,_0x38bca8){return new BPromise(function(_0x39d5df,_0x1fb40b){return client[_0xced1('0x9')](_0x59399e,_0x38bca8)[_0xced1('0xa')](function(_0x325dd2){logger[_0xced1('0xb')]('JscriptySessionReport,\x20%s,\x20%s',_0x2bcf42,_0xced1('0xc'));logger['debug'](_0xced1('0xd'),_0x2bcf42,_0xced1('0xc'),JSON[_0xced1('0xe')](_0x325dd2));if(_0x325dd2[_0xced1('0xf')]){if(_0x325dd2[_0xced1('0xf')][_0xced1('0x10')]===0x1f4){logger[_0xced1('0xf')]('JscriptySessionReport,\x20%s,\x20%s',_0x2bcf42,_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);return _0x1fb40b(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}logger['error'](_0xced1('0x12'),_0x2bcf42,_0x325dd2[_0xced1('0xf')]['message']);return _0x39d5df(_0x325dd2[_0xced1('0xf')][_0xced1('0x11')]);}else{logger[_0xced1('0xb')](_0xced1('0x12'),_0x2bcf42,'request\x20sent');_0x39d5df(_0x325dd2['result'][_0xced1('0x11')]);}})[_0xced1('0x13')](function(_0x236473){logger[_0xced1('0xf')](_0xced1('0x12'),_0x2bcf42,_0x236473);_0x1fb40b(_0x236473);});});} \ No newline at end of file diff --git a/server/api/license/index.js b/server/api/license/index.js index 9a70daf..5662f55 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 _0x5284=['/download_log_file','isAuthenticated','downloadLogFile','exports','path','connect-timeout','express','Router','../../config/environment','./license.controller','get','index','put','/:id','update'];(function(_0x41ccbb,_0x3771e8){var _0x519c61=function(_0x4724a6){while(--_0x4724a6){_0x41ccbb['push'](_0x41ccbb['shift']());}};_0x519c61(++_0x3771e8);}(_0x5284,0xc7));var _0x4528=function(_0xefd519,_0xc62635){_0xefd519=_0xefd519-0x0;var _0x4bb882=_0x5284[_0xefd519];return _0x4bb882;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x4528('0x0'));var timeout=require(_0x4528('0x1'));var express=require(_0x4528('0x2'));var router=express[_0x4528('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x4528('0x4'));var controller=require(_0x4528('0x5'));router[_0x4528('0x6')]('/',controller[_0x4528('0x7')]);router[_0x4528('0x8')](_0x4528('0x9'),auth['isAuthenticated'](),controller[_0x4528('0xa')]);router[_0x4528('0x6')](_0x4528('0xb'),auth[_0x4528('0xc')](),controller[_0x4528('0xd')]);module[_0x4528('0xe')]=router; \ No newline at end of file +var _0x4da5=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./license.controller','index','put','/:id','isAuthenticated','update','get','/download_log_file','downloadLogFile','exports','util','path','connect-timeout'];(function(_0x402703,_0x5d0c62){var _0x3cbab8=function(_0x417ee3){while(--_0x417ee3){_0x402703['push'](_0x402703['shift']());}};_0x3cbab8(++_0x5d0c62);}(_0x4da5,0x1b7));var _0x54da=function(_0x4717a1,_0x23912a){_0x4717a1=_0x4717a1-0x0;var _0x28935f=_0x4da5[_0x4717a1];return _0x28935f;};'use strict';var multer=require('multer');var util=require(_0x54da('0x0'));var path=require(_0x54da('0x1'));var timeout=require(_0x54da('0x2'));var express=require('express');var router=express[_0x54da('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x54da('0x4'));var interaction=require(_0x54da('0x5'));var config=require(_0x54da('0x6'));var controller=require(_0x54da('0x7'));router['get']('/',controller[_0x54da('0x8')]);router[_0x54da('0x9')](_0x54da('0xa'),auth[_0x54da('0xb')](),controller[_0x54da('0xc')]);router[_0x54da('0xd')](_0x54da('0xe'),auth['isAuthenticated'](),controller[_0x54da('0xf')]);module[_0x54da('0x10')]=router; \ No newline at end of file diff --git a/server/api/license/license.attributes.js b/server/api/license/license.attributes.js index 2f01705..85c871a 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 _0xaa59=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x3691de,_0x10eed0){var _0x3d9117=function(_0x59f888){while(--_0x59f888){_0x3691de['push'](_0x3691de['shift']());}};_0x3d9117(++_0x10eed0);}(_0xaa59,0xbb));var _0x9aa5=function(_0x12957b,_0x11e8ef){_0x12957b=_0x12957b-0x0;var _0x4b4fb3=_0xaa59[_0x12957b];return _0x4b4fb3;};'use strict';var Sequelize=require(_0x9aa5('0x0'));module[_0x9aa5('0x1')]={'license':{'type':Sequelize[_0x9aa5('0x2')]},'data1':{'type':Sequelize[_0x9aa5('0x3')]},'data2':{'type':Sequelize[_0x9aa5('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x9aa5('0x4')],'defaultValue':0x0}}; \ No newline at end of file +var _0x8329=['STRING','INTEGER','sequelize','exports','TEXT'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x8329,0x1d3));var _0x9832=function(_0x3998fc,_0x27ea0d){_0x3998fc=_0x3998fc-0x0;var _0x18c50d=_0x8329[_0x3998fc];return _0x18c50d;};'use strict';var Sequelize=require(_0x9832('0x0'));module[_0x9832('0x1')]={'license':{'type':Sequelize[_0x9832('0x2')]},'data1':{'type':Sequelize['STRING']},'data2':{'type':Sequelize[_0x9832('0x3')]},'chatLicenseExceeded':{'type':Sequelize[_0x9832('0x4')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/license/license.controller.js b/server/api/license/license.controller.js index b209732..edab8f2 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 _0x78be=['../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','end','send','index','keys','rawAttributes','query','model','attributes','intersection','fields','length','options','getLicense','catch','body','License','find','get','checkLicense','key','downloadLogFile','license-info.log','join','/var','log','xcally','setHeader','attachment;\x20filename=','Content-Type','text/plain','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','ioredis'];(function(_0x2ceff1,_0x2e2f7b){var _0x4c1648=function(_0x5ae9af){while(--_0x5ae9af){_0x2ceff1['push'](_0x2ceff1['shift']());}};_0x4c1648(++_0x2e2f7b);}(_0x78be,0x13d));var _0xe78b=function(_0x522e54,_0x2ed415){_0x522e54=_0x522e54-0x0;var _0x5434c3=_0x78be[_0x522e54];return _0x5434c3;};'use strict';var emlformat=require(_0xe78b('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xe78b('0x1'));var jsonpatch=require(_0xe78b('0x2'));var rp=require(_0xe78b('0x3'));var moment=require(_0xe78b('0x4'));var BPromise=require(_0xe78b('0x5'));var Mustache=require(_0xe78b('0x6'));var util=require(_0xe78b('0x7'));var path=require('path');var sox=require(_0xe78b('0x8'));var csv=require(_0xe78b('0x9'));var ejs=require(_0xe78b('0xa'));var fs=require('fs');var fs_extra=require(_0xe78b('0xb'));var _=require(_0xe78b('0xc'));var squel=require(_0xe78b('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xe78b('0xe'));var toCsv=require(_0xe78b('0x9'));var querystring=require(_0xe78b('0xf'));var Papa=require(_0xe78b('0x10'));var Redis=require(_0xe78b('0x11'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xe78b('0x12'));var logger=require(_0xe78b('0x13'))(_0xe78b('0x14'));var utils=require(_0xe78b('0x15'));var config=require(_0xe78b('0x16'));var licenseUtil=require(_0xe78b('0x17'));var db=require(_0xe78b('0x18'))['db'];function respondWithStatusCode(_0x2bb12d,_0x18bf60){_0x18bf60=_0x18bf60||0xcc;return function(_0x19ef4d){if(_0x19ef4d){return _0x2bb12d[_0xe78b('0x19')](_0x18bf60);}return _0x2bb12d[_0xe78b('0x1a')](_0x18bf60)['end']();};}function respondWithResult(_0x357901,_0x4da47f){_0x4da47f=_0x4da47f||0xc8;return function(_0x495f65){if(_0x495f65){return _0x357901['status'](_0x4da47f)[_0xe78b('0x1b')](_0x495f65);}};}function respondWithFilteredResult(_0x54ac05,_0x199e21){return function(_0x2354ad){if(_0x2354ad){var _0x1c7e92=typeof _0x199e21[_0xe78b('0x1c')]===_0xe78b('0x1d')&&typeof _0x199e21[_0xe78b('0x1e')]===_0xe78b('0x1d');var _0x3d44e2=_0x2354ad['count'];var _0xeb9796=_0x1c7e92?0x0:_0x199e21[_0xe78b('0x1c')];var _0x2a1e4b=_0x1c7e92?_0x2354ad['count']:_0x199e21['offset']+_0x199e21[_0xe78b('0x1e')];var _0x198f99;if(_0x2a1e4b>=_0x3d44e2){_0x2a1e4b=_0x3d44e2;_0x198f99=0xc8;}else{_0x198f99=0xce;}_0x54ac05['status'](_0x198f99);return _0x54ac05[_0xe78b('0x1f')](_0xe78b('0x20'),_0xeb9796+'-'+_0x2a1e4b+'/'+_0x3d44e2)['json'](_0x2354ad);}return null;};}function patchUpdates(_0x380a97){return function(_0x1da950){try{jsonpatch[_0xe78b('0x21')](_0x1da950,_0x380a97,!![]);}catch(_0x224fe0){return BPromise[_0xe78b('0x22')](_0x224fe0);}return _0x1da950['save']();};}function saveUpdates(_0x4b9cfc,_0x1a3bac){return function(_0x3670cb){if(_0x3670cb){return _0x3670cb[_0xe78b('0x23')](_0x4b9cfc)[_0xe78b('0x24')](function(_0x170f91){return _0x170f91;});}return null;};}function removeEntity(_0x443828,_0x34b005){return function(_0x20457a){if(_0x20457a){return _0x20457a['destroy']()[_0xe78b('0x24')](function(){_0x443828[_0xe78b('0x1a')](0xcc)[_0xe78b('0x25')]();});}};}function handleEntityNotFound(_0x68b41b,_0x2e1630){return function(_0x2635e8){if(!_0x2635e8){_0x68b41b['sendStatus'](0x194);}return _0x2635e8;};}function handleError(_0x473e4e,_0x37d6dd){_0x37d6dd=_0x37d6dd||0x1f4;return function(_0x690264){logger['error'](_0x690264['stack']);if(_0x690264['name']){delete _0x690264['name'];}_0x473e4e[_0xe78b('0x1a')](_0x37d6dd)[_0xe78b('0x26')](_0x690264);};}var utilLicense=require(_0xe78b('0x17'));exports[_0xe78b('0x27')]=function(_0x391604,_0xba97ab){var _0x123bd8={'raw':!![],'where':{'id':0x1}},_0x20ae46={};_0x20ae46['model']=_[_0xe78b('0x28')](db['License'][_0xe78b('0x29')]);_0x20ae46['query']=_[_0xe78b('0x28')](_0x391604[_0xe78b('0x2a')]);_0x20ae46['filters']=_['intersection'](_0x20ae46[_0xe78b('0x2b')],_0x20ae46[_0xe78b('0x2a')]);_0x123bd8[_0xe78b('0x2c')]=_[_0xe78b('0x2d')](_0x20ae46[_0xe78b('0x2b')],qs[_0xe78b('0x2e')](_0x391604[_0xe78b('0x2a')][_0xe78b('0x2e')]));_0x123bd8[_0xe78b('0x2c')]=_0x123bd8[_0xe78b('0x2c')][_0xe78b('0x2f')]?_0x123bd8['attributes']:_0x20ae46[_0xe78b('0x2b')];_0x123bd8=_['merge']({},_0x123bd8,_0x391604[_0xe78b('0x30')]);return utilLicense[_0xe78b('0x31')](_0x123bd8)[_0xe78b('0x24')](respondWithResult(_0xba97ab,null))[_0xe78b('0x32')](handleError(_0xba97ab,null));};exports[_0xe78b('0x23')]=function(_0x15cc68,_0xd904ed){if(_0x15cc68[_0xe78b('0x33')]['id']){delete _0x15cc68[_0xe78b('0x33')]['id'];}return db[_0xe78b('0x34')][_0xe78b('0x35')]({'where':{'id':_0x15cc68['params']['id']}})[_0xe78b('0x24')](handleEntityNotFound(_0xd904ed,null))[_0xe78b('0x24')](function(_0x2a8bfe){var _0x2ff012=_0x2a8bfe[_0xe78b('0x36')]({'plain':!![]});return utilLicense[_0xe78b('0x37')](_0x2ff012,_0x15cc68['body'][_0xe78b('0x38')]);})[_0xe78b('0x24')](function(_0x48b6e1){if(!_0x48b6e1['demo']){return saveUpdates(_0x15cc68[_0xe78b('0x33')],null);}return _0x48b6e1;})[_0xe78b('0x24')](respondWithResult(_0xd904ed,null))[_0xe78b('0x32')](handleError(_0xd904ed,null));};exports[_0xe78b('0x39')]=function(_0x4a59c6,_0x30a13f){var _0x4ab17d=_0xe78b('0x3a');var _0x25fa70=path[_0xe78b('0x3b')](_0xe78b('0x3c'),_0xe78b('0x3d'),_0xe78b('0x3e'),_0x4ab17d);_0x30a13f[_0xe78b('0x3f')]('Content-disposition',_0xe78b('0x40')+_0x4ab17d);_0x30a13f[_0xe78b('0x1f')](_0xe78b('0x41'),_0xe78b('0x42'));_0x30a13f['download'](_0x25fa70);}; \ No newline at end of file +var _0x4e41=['model','keys','License','rawAttributes','query','filters','intersection','attributes','fields','length','merge','options','getLicense','catch','body','find','get','checkLicense','key','license-info.log','join','log','xcally','Content-disposition','attachment;\x20filename=','Content-Type','text/plain','eml-format','rimraf','mustache','path','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','../../config/license/util','index'];(function(_0xcbd101,_0x2bd159){var _0x151767=function(_0xbfaf26){while(--_0xbfaf26){_0xcbd101['push'](_0xcbd101['shift']());}};_0x151767(++_0x2bd159);}(_0x4e41,0x12b));var _0x14e4=function(_0x46472e,_0x1cc71b){_0x46472e=_0x46472e-0x0;var _0x482bab=_0x4e41[_0x46472e];return _0x482bab;};'use strict';var emlformat=require(_0x14e4('0x0'));var rimraf=require(_0x14e4('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(_0x14e4('0x2'));var util=require('util');var path=require(_0x14e4('0x3'));var sox=require('sox');var csv=require(_0x14e4('0x4'));var ejs=require(_0x14e4('0x5'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x14e4('0x6'));var squel=require(_0x14e4('0x7'));var crypto=require(_0x14e4('0x8'));var jsforce=require(_0x14e4('0x9'));var deskjs=require(_0x14e4('0xa'));var toCsv=require(_0x14e4('0x4'));var querystring=require(_0x14e4('0xb'));var Papa=require(_0x14e4('0xc'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x14e4('0xd'));var as=require(_0x14e4('0xe'));var hardwareService=require(_0x14e4('0xf'));var logger=require(_0x14e4('0x10'))(_0x14e4('0x11'));var utils=require(_0x14e4('0x12'));var config=require(_0x14e4('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x14e4('0x14'))['db'];function respondWithStatusCode(_0x42508a,_0xb56a41){_0xb56a41=_0xb56a41||0xcc;return function(_0x3acd7d){if(_0x3acd7d){return _0x42508a['sendStatus'](_0xb56a41);}return _0x42508a['status'](_0xb56a41)[_0x14e4('0x15')]();};}function respondWithResult(_0x439428,_0x158a53){_0x158a53=_0x158a53||0xc8;return function(_0x3e12e9){if(_0x3e12e9){return _0x439428['status'](_0x158a53)[_0x14e4('0x16')](_0x3e12e9);}};}function respondWithFilteredResult(_0x2daf78,_0x1f18a3){return function(_0x18c768){if(_0x18c768){var _0x107a2a=typeof _0x1f18a3[_0x14e4('0x17')]===_0x14e4('0x18')&&typeof _0x1f18a3[_0x14e4('0x19')]===_0x14e4('0x18');var _0x2cdeb1=_0x18c768[_0x14e4('0x1a')];var _0x555f61=_0x107a2a?0x0:_0x1f18a3[_0x14e4('0x17')];var _0x124a58=_0x107a2a?_0x18c768[_0x14e4('0x1a')]:_0x1f18a3[_0x14e4('0x17')]+_0x1f18a3[_0x14e4('0x19')];var _0x15e211;if(_0x124a58>=_0x2cdeb1){_0x124a58=_0x2cdeb1;_0x15e211=0xc8;}else{_0x15e211=0xce;}_0x2daf78[_0x14e4('0x1b')](_0x15e211);return _0x2daf78[_0x14e4('0x1c')](_0x14e4('0x1d'),_0x555f61+'-'+_0x124a58+'/'+_0x2cdeb1)['json'](_0x18c768);}return null;};}function patchUpdates(_0x3121f1){return function(_0x191b72){try{jsonpatch[_0x14e4('0x1e')](_0x191b72,_0x3121f1,!![]);}catch(_0x525579){return BPromise[_0x14e4('0x1f')](_0x525579);}return _0x191b72[_0x14e4('0x20')]();};}function saveUpdates(_0x27d0e6,_0x111e2d){return function(_0x5a0c5e){if(_0x5a0c5e){return _0x5a0c5e[_0x14e4('0x21')](_0x27d0e6)['then'](function(_0x575a09){return _0x575a09;});}return null;};}function removeEntity(_0x4aed0d,_0xbacac2){return function(_0x4570a3){if(_0x4570a3){return _0x4570a3[_0x14e4('0x22')]()[_0x14e4('0x23')](function(){_0x4aed0d[_0x14e4('0x1b')](0xcc)[_0x14e4('0x15')]();});}};}function handleEntityNotFound(_0x33d9d6,_0x4f2654){return function(_0x307bda){if(!_0x307bda){_0x33d9d6['sendStatus'](0x194);}return _0x307bda;};}function handleError(_0x5c39cd,_0x2d2b5d){_0x2d2b5d=_0x2d2b5d||0x1f4;return function(_0x534cc3){logger[_0x14e4('0x24')](_0x534cc3['stack']);if(_0x534cc3[_0x14e4('0x25')]){delete _0x534cc3[_0x14e4('0x25')];}_0x5c39cd['status'](_0x2d2b5d)[_0x14e4('0x26')](_0x534cc3);};}var utilLicense=require(_0x14e4('0x27'));exports[_0x14e4('0x28')]=function(_0x59a81f,_0x22cbba){var _0x1b0909={'raw':!![],'where':{'id':0x1}},_0x40333d={};_0x40333d[_0x14e4('0x29')]=_[_0x14e4('0x2a')](db[_0x14e4('0x2b')][_0x14e4('0x2c')]);_0x40333d['query']=_[_0x14e4('0x2a')](_0x59a81f[_0x14e4('0x2d')]);_0x40333d[_0x14e4('0x2e')]=_[_0x14e4('0x2f')](_0x40333d['model'],_0x40333d[_0x14e4('0x2d')]);_0x1b0909[_0x14e4('0x30')]=_[_0x14e4('0x2f')](_0x40333d[_0x14e4('0x29')],qs['fields'](_0x59a81f[_0x14e4('0x2d')][_0x14e4('0x31')]));_0x1b0909[_0x14e4('0x30')]=_0x1b0909[_0x14e4('0x30')][_0x14e4('0x32')]?_0x1b0909['attributes']:_0x40333d['model'];_0x1b0909=_[_0x14e4('0x33')]({},_0x1b0909,_0x59a81f[_0x14e4('0x34')]);return utilLicense[_0x14e4('0x35')](_0x1b0909)['then'](respondWithResult(_0x22cbba,null))[_0x14e4('0x36')](handleError(_0x22cbba,null));};exports[_0x14e4('0x21')]=function(_0xc7df1a,_0x687121){if(_0xc7df1a[_0x14e4('0x37')]['id']){delete _0xc7df1a[_0x14e4('0x37')]['id'];}return db[_0x14e4('0x2b')][_0x14e4('0x38')]({'where':{'id':_0xc7df1a['params']['id']}})[_0x14e4('0x23')](handleEntityNotFound(_0x687121,null))[_0x14e4('0x23')](function(_0x57ab1b){var _0x3aec82=_0x57ab1b[_0x14e4('0x39')]({'plain':!![]});return utilLicense[_0x14e4('0x3a')](_0x3aec82,_0xc7df1a[_0x14e4('0x37')][_0x14e4('0x3b')]);})[_0x14e4('0x23')](function(_0x46ea71){if(!_0x46ea71['demo']){return saveUpdates(_0xc7df1a[_0x14e4('0x37')],null);}return _0x46ea71;})['then'](respondWithResult(_0x687121,null))['catch'](handleError(_0x687121,null));};exports['downloadLogFile']=function(_0x35f6a6,_0x2b9751){var _0x2ecb7b=_0x14e4('0x3c');var _0x30b708=path[_0x14e4('0x3d')]('/var',_0x14e4('0x3e'),_0x14e4('0x3f'),_0x2ecb7b);_0x2b9751['setHeader'](_0x14e4('0x40'),_0x14e4('0x41')+_0x2ecb7b);_0x2b9751['set'](_0x14e4('0x42'),_0x14e4('0x43'));_0x2b9751['download'](_0x30b708);}; \ No newline at end of file diff --git a/server/api/license/license.model.js b/server/api/license/license.model.js index 381e03b..cc633f6 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 _0x1f7e=['request-promise','path','rimraf','../../config/environment','define','license','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x20bf56,_0x19dd3a){var _0x21fcef=function(_0x896abd){while(--_0x896abd){_0x20bf56['push'](_0x20bf56['shift']());}};_0x21fcef(++_0x19dd3a);}(_0x1f7e,0xc6));var _0xe1f7=function(_0x3cc5b0,_0x44b6c3){_0x3cc5b0=_0x3cc5b0-0x0;var _0xfccc42=_0x1f7e[_0x3cc5b0];return _0xfccc42;};'use strict';var _=require(_0xe1f7('0x0'));var util=require(_0xe1f7('0x1'));var logger=require(_0xe1f7('0x2'))(_0xe1f7('0x3'));var moment=require(_0xe1f7('0x4'));var BPromise=require(_0xe1f7('0x5'));var rp=require(_0xe1f7('0x6'));var fs=require('fs');var path=require(_0xe1f7('0x7'));var rimraf=require(_0xe1f7('0x8'));var config=require(_0xe1f7('0x9'));var attributes=require('./license.attributes');module['exports']=function(_0x900b31,_0x2067ce){return _0x900b31[_0xe1f7('0xa')]('License',attributes,{'tableName':_0xe1f7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x10f9=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./license.attributes','exports','define','License','license'];(function(_0x4fde08,_0x463a36){var _0x12e725=function(_0x2670c5){while(--_0x2670c5){_0x4fde08['push'](_0x4fde08['shift']());}};_0x12e725(++_0x463a36);}(_0x10f9,0x1a0));var _0x910f=function(_0x39be2b,_0x2ae970){_0x39be2b=_0x39be2b-0x0;var _0x51f66e=_0x10f9[_0x39be2b];return _0x51f66e;};'use strict';var _=require(_0x910f('0x0'));var util=require(_0x910f('0x1'));var logger=require('../../config/logger')(_0x910f('0x2'));var moment=require(_0x910f('0x3'));var BPromise=require(_0x910f('0x4'));var rp=require(_0x910f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x910f('0x6'));var config=require(_0x910f('0x7'));var attributes=require(_0x910f('0x8'));module[_0x910f('0x9')]=function(_0x124b22,_0x2e0660){return _0x124b22[_0x910f('0xa')](_0x910f('0xb'),attributes,{'tableName':_0x910f('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/license/license.rpc.js b/server/api/license/license.rpc.js index f974e27..df43468 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 _0x1364=['client','http','request','then','info','License,\x20%s,\x20%s','request\x20sent','debug','License,\x20%s,\x20%s,\x20%s','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment'];(function(_0x40ef47,_0x2629c9){var _0x41793f=function(_0x41c798){while(--_0x41c798){_0x40ef47['push'](_0x40ef47['shift']());}};_0x41793f(++_0x2629c9);}(_0x1364,0xd3));var _0x4136=function(_0x252a41,_0x4751e9){_0x252a41=_0x252a41-0x0;var _0x15f608=_0x1364[_0x252a41];return _0x15f608;};'use strict';var _=require(_0x4136('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x4136('0x1'));var rs=require(_0x4136('0x2'));var fs=require('fs');var Redis=require(_0x4136('0x3'));var db=require(_0x4136('0x4'))['db'];var utils=require(_0x4136('0x5'));var logger=require(_0x4136('0x6'))(_0x4136('0x7'));var config=require(_0x4136('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4136('0x9')][_0x4136('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x121539,_0xfdb11d,_0xc3afc4){return new BPromise(function(_0x9d099c,_0x3d4552){return client[_0x4136('0xb')](_0x121539,_0xc3afc4)[_0x4136('0xc')](function(_0x5d5819){logger[_0x4136('0xd')](_0x4136('0xe'),_0xfdb11d,_0x4136('0xf'));logger[_0x4136('0x10')](_0x4136('0x11'),_0xfdb11d,'request\x20sent',JSON['stringify'](_0x5d5819));if(_0x5d5819[_0x4136('0x12')]){if(_0x5d5819['error'][_0x4136('0x13')]===0x1f4){logger[_0x4136('0x12')](_0x4136('0xe'),_0xfdb11d,_0x5d5819[_0x4136('0x12')][_0x4136('0x14')]);return _0x3d4552(_0x5d5819[_0x4136('0x12')][_0x4136('0x14')]);}logger['error'](_0x4136('0xe'),_0xfdb11d,_0x5d5819['error']['message']);return _0x9d099c(_0x5d5819[_0x4136('0x12')][_0x4136('0x14')]);}else{logger[_0x4136('0xd')](_0x4136('0xe'),_0xfdb11d,_0x4136('0xf'));_0x9d099c(_0x5d5819['result'][_0x4136('0x14')]);}})[_0x4136('0x15')](function(_0x44f436){logger[_0x4136('0x12')]('License,\x20%s,\x20%s',_0xfdb11d,_0x44f436);_0x3d4552(_0x44f436);});});} \ No newline at end of file +var _0x8a75=['../../config/logger','../../config/environment','jayson/promise','client','request','debug','License,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','License,\x20%s,\x20%s','message','info','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x2abcef,_0x3dbeaf){var _0x1a6aea=function(_0x43941b){while(--_0x43941b){_0x2abcef['push'](_0x2abcef['shift']());}};_0x1a6aea(++_0x3dbeaf);}(_0x8a75,0x126));var _0x58a7=function(_0xd80724,_0x285f61){_0xd80724=_0xd80724-0x0;var _0x33a31c=_0x8a75[_0xd80724];return _0x33a31c;};'use strict';var _=require(_0x58a7('0x0'));var util=require('util');var moment=require(_0x58a7('0x1'));var BPromise=require(_0x58a7('0x2'));var rs=require(_0x58a7('0x3'));var fs=require('fs');var Redis=require(_0x58a7('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x58a7('0x5'));var logger=require(_0x58a7('0x6'))('rpc');var config=require(_0x58a7('0x7'));var jayson=require(_0x58a7('0x8'));var client=jayson[_0x58a7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2a684d,_0x3bc5a4,_0x10a2cf){return new BPromise(function(_0x9524e2,_0x43dca0){return client[_0x58a7('0xa')](_0x2a684d,_0x10a2cf)['then'](function(_0x3d5661){logger['info']('License,\x20%s,\x20%s',_0x3bc5a4,'request\x20sent');logger[_0x58a7('0xb')](_0x58a7('0xc'),_0x3bc5a4,_0x58a7('0xd'),JSON[_0x58a7('0xe')](_0x3d5661));if(_0x3d5661['error']){if(_0x3d5661[_0x58a7('0xf')]['code']===0x1f4){logger[_0x58a7('0xf')](_0x58a7('0x10'),_0x3bc5a4,_0x3d5661[_0x58a7('0xf')][_0x58a7('0x11')]);return _0x43dca0(_0x3d5661[_0x58a7('0xf')][_0x58a7('0x11')]);}logger[_0x58a7('0xf')](_0x58a7('0x10'),_0x3bc5a4,_0x3d5661[_0x58a7('0xf')][_0x58a7('0x11')]);return _0x9524e2(_0x3d5661['error'][_0x58a7('0x11')]);}else{logger[_0x58a7('0x12')](_0x58a7('0x10'),_0x3bc5a4,'request\x20sent');_0x9524e2(_0x3d5661['result'][_0x58a7('0x11')]);}})[_0x58a7('0x13')](function(_0x4b1b68){logger['error']('License,\x20%s,\x20%s',_0x3bc5a4,_0x4b1b68);_0x43dca0(_0x4b1b68);});});} \ No newline at end of file diff --git a/server/api/mailAccount/index.js b/server/api/mailAccount/index.js index e32759f..c9038e2 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 _0xbb73=['removeImap','/:id','destroy','removeAgents','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailAccount.controller','get','isAuthenticated','index','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','/:id/interactions','/:id/applications','getApplications','/:id/messages','getMessages','/:id/verify','getAgents','post','addDisposition','addAnswer','addImap','addSmtp','addInteraction','/:id/users','addAgents','delete','removeAnswers'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xbb73,0x1de));var _0x3bb7=function(_0x5dce9a,_0x442821){_0x5dce9a=_0x5dce9a-0x0;var _0x3f59b5=_0xbb73[_0x5dce9a];return _0x3f59b5;};'use strict';var multer=require(_0x3bb7('0x0'));var util=require(_0x3bb7('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3bb7('0x2'));var router=express[_0x3bb7('0x3')]();var fs_extra=require(_0x3bb7('0x4'));var auth=require(_0x3bb7('0x5'));var interaction=require(_0x3bb7('0x6'));var config=require(_0x3bb7('0x7'));var controller=require(_0x3bb7('0x8'));router[_0x3bb7('0x9')]('/',auth[_0x3bb7('0xa')](),controller[_0x3bb7('0xb')]);router[_0x3bb7('0x9')]('/describe',auth['isAuthenticated'](),controller[_0x3bb7('0xc')]);router[_0x3bb7('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x3bb7('0xd')]);router[_0x3bb7('0x9')](_0x3bb7('0xe'),auth[_0x3bb7('0xa')](),controller[_0x3bb7('0xf')]);router['get'](_0x3bb7('0x10'),auth[_0x3bb7('0xa')](),controller[_0x3bb7('0x11')]);router[_0x3bb7('0x9')](_0x3bb7('0x12'),auth[_0x3bb7('0xa')](),controller['getImap']);router[_0x3bb7('0x9')](_0x3bb7('0x13'),auth[_0x3bb7('0xa')](),controller[_0x3bb7('0x14')]);router[_0x3bb7('0x9')](_0x3bb7('0x15'),auth[_0x3bb7('0xa')](),controller['getInteractions']);router['get'](_0x3bb7('0x16'),auth[_0x3bb7('0xa')](),controller[_0x3bb7('0x17')]);router['get'](_0x3bb7('0x18'),auth['isAuthenticated'](),controller[_0x3bb7('0x19')]);router[_0x3bb7('0x9')](_0x3bb7('0x1a'),auth[_0x3bb7('0xa')](),controller['verifySmtp']);router[_0x3bb7('0x9')]('/:id/users',auth[_0x3bb7('0xa')](),controller[_0x3bb7('0x1b')]);router[_0x3bb7('0x1c')](_0x3bb7('0xe'),auth[_0x3bb7('0xa')](),controller[_0x3bb7('0x1d')]);router[_0x3bb7('0x1c')](_0x3bb7('0x10'),auth[_0x3bb7('0xa')](),controller[_0x3bb7('0x1e')]);router[_0x3bb7('0x1c')]('/',auth[_0x3bb7('0xa')](),controller['create']);router['post'](_0x3bb7('0x12'),auth['isAuthenticated'](),controller[_0x3bb7('0x1f')]);router[_0x3bb7('0x1c')](_0x3bb7('0x13'),auth['isAuthenticated'](),controller[_0x3bb7('0x20')]);router[_0x3bb7('0x1c')]('/:id/interactions',auth['isAuthenticated'](),controller[_0x3bb7('0x21')]);router[_0x3bb7('0x1c')](_0x3bb7('0x16'),auth[_0x3bb7('0xa')](),controller['addApplications']);router[_0x3bb7('0x1c')]('/:id/send',auth[_0x3bb7('0xa')](),controller['send']);router[_0x3bb7('0x1c')](_0x3bb7('0x22'),auth[_0x3bb7('0xa')](),controller[_0x3bb7('0x23')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x3bb7('0x24')](_0x3bb7('0xe'),auth['isAuthenticated'](),controller['removeDispositions']);router[_0x3bb7('0x24')]('/:id/canned_answers',auth[_0x3bb7('0xa')](),controller[_0x3bb7('0x25')]);router[_0x3bb7('0x24')](_0x3bb7('0x12'),auth[_0x3bb7('0xa')](),controller[_0x3bb7('0x26')]);router['delete']('/:id/out_servers',auth[_0x3bb7('0xa')](),controller['removeSmtp']);router[_0x3bb7('0x24')](_0x3bb7('0x27'),auth[_0x3bb7('0xa')](),controller[_0x3bb7('0x28')]);router[_0x3bb7('0x24')](_0x3bb7('0x22'),auth[_0x3bb7('0xa')](),controller[_0x3bb7('0x29')]);module[_0x3bb7('0x2a')]=router; \ No newline at end of file +var _0x7f8a=['/:id/messages','getMessages','/:id/verify','verifySmtp','/:id/users','post','/:id/dispositions','addAnswer','create','addImap','addSmtp','addApplications','/:id/send','send','put','/:id','delete','removeAnswers','removeImap','removeSmtp','destroy','removeAgents','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailAccount.controller','get','isAuthenticated','index','/describe','describe','getDispositions','/:id/canned_answers','getAnswers','/:id/in_servers','/:id/out_servers','getSmtp','getInteractions'];(function(_0x123d3d,_0x114ea5){var _0x5707bf=function(_0x9e1a39){while(--_0x9e1a39){_0x123d3d['push'](_0x123d3d['shift']());}};_0x5707bf(++_0x114ea5);}(_0x7f8a,0x1ac));var _0xa7f8=function(_0x1a8665,_0x3fac6f){_0x1a8665=_0x1a8665-0x0;var _0x58ab89=_0x7f8a[_0x1a8665];return _0x58ab89;};'use strict';var multer=require(_0xa7f8('0x0'));var util=require(_0xa7f8('0x1'));var path=require(_0xa7f8('0x2'));var timeout=require(_0xa7f8('0x3'));var express=require(_0xa7f8('0x4'));var router=express[_0xa7f8('0x5')]();var fs_extra=require(_0xa7f8('0x6'));var auth=require(_0xa7f8('0x7'));var interaction=require(_0xa7f8('0x8'));var config=require('../../config/environment');var controller=require(_0xa7f8('0x9'));router[_0xa7f8('0xa')]('/',auth[_0xa7f8('0xb')](),controller[_0xa7f8('0xc')]);router['get'](_0xa7f8('0xd'),auth[_0xa7f8('0xb')](),controller[_0xa7f8('0xe')]);router['get']('/:id',auth[_0xa7f8('0xb')](),controller['show']);router[_0xa7f8('0xa')]('/:id/dispositions',auth[_0xa7f8('0xb')](),controller[_0xa7f8('0xf')]);router['get'](_0xa7f8('0x10'),auth[_0xa7f8('0xb')](),controller[_0xa7f8('0x11')]);router[_0xa7f8('0xa')](_0xa7f8('0x12'),auth['isAuthenticated'](),controller['getImap']);router[_0xa7f8('0xa')](_0xa7f8('0x13'),auth[_0xa7f8('0xb')](),controller[_0xa7f8('0x14')]);router[_0xa7f8('0xa')]('/:id/interactions',auth['isAuthenticated'](),controller[_0xa7f8('0x15')]);router[_0xa7f8('0xa')]('/:id/applications',auth['isAuthenticated'](),controller['getApplications']);router[_0xa7f8('0xa')](_0xa7f8('0x16'),auth['isAuthenticated'](),controller[_0xa7f8('0x17')]);router[_0xa7f8('0xa')](_0xa7f8('0x18'),auth[_0xa7f8('0xb')](),controller[_0xa7f8('0x19')]);router['get'](_0xa7f8('0x1a'),auth['isAuthenticated'](),controller['getAgents']);router[_0xa7f8('0x1b')](_0xa7f8('0x1c'),auth[_0xa7f8('0xb')](),controller['addDisposition']);router['post']('/:id/canned_answers',auth[_0xa7f8('0xb')](),controller[_0xa7f8('0x1d')]);router[_0xa7f8('0x1b')]('/',auth[_0xa7f8('0xb')](),controller[_0xa7f8('0x1e')]);router['post']('/:id/in_servers',auth[_0xa7f8('0xb')](),controller[_0xa7f8('0x1f')]);router['post'](_0xa7f8('0x13'),auth[_0xa7f8('0xb')](),controller[_0xa7f8('0x20')]);router[_0xa7f8('0x1b')]('/:id/interactions',auth[_0xa7f8('0xb')](),controller['addInteraction']);router[_0xa7f8('0x1b')]('/:id/applications',auth[_0xa7f8('0xb')](),controller[_0xa7f8('0x21')]);router[_0xa7f8('0x1b')](_0xa7f8('0x22'),auth[_0xa7f8('0xb')](),controller[_0xa7f8('0x23')]);router[_0xa7f8('0x1b')](_0xa7f8('0x1a'),auth['isAuthenticated'](),controller['addAgents']);router[_0xa7f8('0x24')](_0xa7f8('0x25'),auth['isAuthenticated'](),controller['update']);router[_0xa7f8('0x26')](_0xa7f8('0x1c'),auth[_0xa7f8('0xb')](),controller['removeDispositions']);router[_0xa7f8('0x26')]('/:id/canned_answers',auth[_0xa7f8('0xb')](),controller[_0xa7f8('0x27')]);router[_0xa7f8('0x26')]('/:id/in_servers',auth[_0xa7f8('0xb')](),controller[_0xa7f8('0x28')]);router['delete'](_0xa7f8('0x13'),auth[_0xa7f8('0xb')](),controller[_0xa7f8('0x29')]);router[_0xa7f8('0x26')](_0xa7f8('0x25'),auth[_0xa7f8('0xb')](),controller[_0xa7f8('0x2a')]);router[_0xa7f8('0x26')](_0xa7f8('0x1a'),auth['isAuthenticated'](),controller[_0xa7f8('0x2b')]);module[_0xa7f8('0x2c')]=router; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.attributes.js b/server/api/mailAccount/mailAccount.attributes.js index d5f1cd6..9c5b367 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 _0xc460=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','yahoo','outlook365','provider','custom','getDataValue','sequelize','exports','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'];(function(_0x13b8f3,_0x442821){var _0x1a6d06=function(_0x5126f2){while(--_0x5126f2){_0x13b8f3['push'](_0x13b8f3['shift']());}};_0x1a6d06(++_0x442821);}(_0xc460,0xb2));var _0x0c46=function(_0x33dbba,_0x27b255){_0x33dbba=_0x33dbba-0x0;var _0x23c142=_0xc460[_0x33dbba];return _0x23c142;};'use strict';var Sequelize=require(_0x0c46('0x0'));module[_0x0c46('0x1')]={'description':{'type':Sequelize[_0x0c46('0x2')]},'name':{'type':Sequelize['STRING'],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize[_0x0c46('0x2')],'validate':{'isEmail':!![]}},'active':{'type':Sequelize[_0x0c46('0x3')],'defaultValue':!![]},'key':{'type':Sequelize[_0x0c46('0x2')],'allowNull':![]},'template':{'type':Sequelize[_0x0c46('0x4')]},'markAsUnread':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x0c46('0x2')],'allowNull':![],'defaultValue':'Arial,Helvetica,sans-serif'},'fontSize':{'type':Sequelize[_0x0c46('0x5')](0x2)[_0x0c46('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x0c46('0x4')],'defaultValue':function(){return _0x0c46('0x7');}},'notificationSound':{'type':Sequelize[_0x0c46('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x0c46('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x0c46('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x0c46('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x0c46('0x3')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x0c46('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'defaultValue':null,'comment':_0x0c46('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x0c46('0x3')],'defaultValue':![],'comment':_0x0c46('0x9'),'set':function(_0x34006e){if(!_0x34006e)this[_0x0c46('0xa')](_0x0c46('0xb'),null);this['setDataValue']('mandatoryDisposition',_0x34006e);}},'provider':{'type':Sequelize['ENUM']('gmail','hotmail',_0x0c46('0xc'),_0x0c46('0xd')),'defaultValue':null,'get':function(){if(!this['getDataValue'](_0x0c46('0xe')))return _0x0c46('0xf');return this[_0x0c46('0x10')](_0x0c46('0xe'));},'set':function(_0x46cfa7){if(_0x46cfa7==='custom')_0x46cfa7=null;return this[_0x0c46('0xa')](_0x0c46('0xe'),_0x46cfa7);}}}; \ No newline at end of file +var _0xf882=['Arial,Helvetica,sans-serif','INTEGER','UNSIGNED','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}
Subject\x20:\x20{{message.subject}}','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','ENUM','gmail','yahoo','outlook365','getDataValue','provider','custom','exports','STRING','TEXT','BOOLEAN'];(function(_0x15f2aa,_0xcb1c0e){var _0x2998b4=function(_0x190b7a){while(--_0x190b7a){_0x15f2aa['push'](_0x15f2aa['shift']());}};_0x2998b4(++_0xcb1c0e);}(_0xf882,0x1ea));var _0x2f88=function(_0x550ccd,_0x4bcb45){_0x550ccd=_0x550ccd-0x0;var _0x342616=_0xf882[_0x550ccd];return _0x342616;};'use strict';var Sequelize=require('sequelize');module[_0x2f88('0x0')]={'description':{'type':Sequelize[_0x2f88('0x1')]},'name':{'type':Sequelize[_0x2f88('0x1')],'allowNull':![]},'service':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]}},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'template':{'type':Sequelize[_0x2f88('0x2')]},'markAsUnread':{'type':Sequelize[_0x2f88('0x3')],'defaultValue':![]},'fontFamily':{'type':Sequelize[_0x2f88('0x1')],'allowNull':![],'defaultValue':_0x2f88('0x4')},'fontSize':{'type':Sequelize[_0x2f88('0x5')](0x2)[_0x2f88('0x6')],'defaultValue':0xd,'validate':{'min':0x8,'max':0x48}},'notificationTemplate':{'type':Sequelize[_0x2f88('0x2')],'defaultValue':function(){return _0x2f88('0x7');}},'notificationSound':{'type':Sequelize[_0x2f88('0x3')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x2f88('0x3')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x2f88('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x2f88('0x3')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x2f88('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x2f88('0x5')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x2f88('0x5')],'allowNull':!![],'defaultValue':null,'comment':_0x2f88('0x8')},'mandatoryDisposition':{'type':Sequelize[_0x2f88('0x3')],'defaultValue':![],'comment':_0x2f88('0x9'),'set':function(_0x1d824e){if(!_0x1d824e)this[_0x2f88('0xa')](_0x2f88('0xb'),null);this['setDataValue']('mandatoryDisposition',_0x1d824e);}},'provider':{'type':Sequelize[_0x2f88('0xc')](_0x2f88('0xd'),'hotmail',_0x2f88('0xe'),_0x2f88('0xf')),'defaultValue':null,'get':function(){if(!this[_0x2f88('0x10')](_0x2f88('0x11')))return _0x2f88('0x12');return this[_0x2f88('0x10')](_0x2f88('0x11'));},'set':function(_0x16d789){if(_0x16d789==='custom')_0x16d789=null;return this[_0x2f88('0xa')]('provider',_0x16d789);}}}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.controller.js b/server/api/mailAccount/mailAccount.controller.js index 91ae3a9..9f0d3d9 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 _0xbdf9=['include','findAll','rows','show','params','Pause','find','body','provider','custom','Mail\x20Account\x20not\x20found','describe','addDisposition','MailAccountId','create','getDispositions','findOne','Disposition','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','key','email','ListId','isNil','active','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','MailAccounts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getImap','addImap','removeImap','setImap','getSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','Contact','User','Owner','fullname','internal','Tag','tag','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','json','getApplications','getMessages','MailMessage','$gte','split','format','inlineCss','true','CmList','List','CmContact','Contacts','updatedAt','DESC','CloudProvider','from','%s\x20<%s>','attachments','root','server/files/attachments','getSmtpOptions','SendMail','List\x20not\x20found','defaults','attach','out','YYYY-MM-DD\x20HH:mm:ss','messageId','Interaction','verifySmtp','Sequelize','ValidationError','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','removeAgents','isArray','userMailAccount:remove','getAgents','moment','util','path','ioredis','../../config/logger','api','../../config/environment','../../mysqldb','redis','./mailAccount.socket','register','jayson/promise','client','http','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','update','destroy','get','UserProfileResource','stack','name','send','gmail','imap.gmail.com','yahoo','imap.mail.yahoo.com','hotmail','outlook365','outlook.office365.com','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','smtp.office365.com','username','password','pass','modernAuthentication','CloudProviderId','port','host','secure','service','authentication','user','Imap','Smtp','index','MailServerIn','MailServerOut','mandatoryDispositionPause','MailAccount','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll'];(function(_0x4dbf23,_0x2fbc5c){var _0x48ceb2=function(_0x28d0db){while(--_0x28d0db){_0x4dbf23['push'](_0x4dbf23['shift']());}};_0x48ceb2(++_0x2fbc5c);}(_0xbdf9,0x129));var _0x9bdf=function(_0x40f991,_0x576819){_0x40f991=_0x40f991-0x0;var _0x38eca2=_0xbdf9[_0x40f991];return _0x38eca2;};'use strict';var moment=require(_0x9bdf('0x0'));var BPromise=require('bluebird');var util=require(_0x9bdf('0x1'));var path=require(_0x9bdf('0x2'));var _=require('lodash');var juice=require('juice');var Redis=require(_0x9bdf('0x3'));var qs=require('../../components/parsers/qs');var logger=require(_0x9bdf('0x4'))(_0x9bdf('0x5'));var config=require(_0x9bdf('0x6'));var db=require(_0x9bdf('0x7'))['db'];config[_0x9bdf('0x8')]=_['defaults'](config[_0x9bdf('0x8')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x9bdf('0x8')]));require(_0x9bdf('0x9'))[_0x9bdf('0xa')](socket);var jayson=require(_0x9bdf('0xb'));var client=jayson[_0x9bdf('0xc')][_0x9bdf('0xd')]({'port':0x232b});function respondWithRpcPromise(_0x3f90cf,_0x54ef19,_0x14a4da,_0x289b9f){return new BPromise(function(_0x38d382,_0x14fbd0){var _0x1b0948=_0x289b9f||client;return _0x1b0948[_0x9bdf('0xe')](_0x3f90cf,_0x14a4da)[_0x9bdf('0xf')](function(_0x30c755){logger[_0x9bdf('0x10')](_0x9bdf('0x11'),_0x54ef19,_0x9bdf('0x12'));logger[_0x9bdf('0x13')](_0x9bdf('0x14'),_0x54ef19,_0x9bdf('0x12'),JSON[_0x9bdf('0x15')](_0x30c755));if(_0x30c755[_0x9bdf('0x16')]){if(_0x30c755[_0x9bdf('0x16')]['code']===0x1f4){logger[_0x9bdf('0x16')](_0x9bdf('0x11'),_0x54ef19,_0x30c755['error'][_0x9bdf('0x17')]);return _0x14fbd0(_0x30c755[_0x9bdf('0x16')][_0x9bdf('0x17')]);}logger[_0x9bdf('0x16')]('MailAccount,\x20%s,\x20%s',_0x54ef19,_0x30c755['error']['message']);return _0x38d382(_0x30c755['error'][_0x9bdf('0x17')]);}else{logger[_0x9bdf('0x10')]('MailAccount,\x20%s,\x20%s',_0x54ef19,'request\x20sent');_0x38d382(_0x30c755[_0x9bdf('0x18')][_0x9bdf('0x17')]);}})[_0x9bdf('0x19')](function(_0x11018d){logger[_0x9bdf('0x16')](_0x9bdf('0x11'),_0x54ef19,_0x11018d);_0x14fbd0(_0x11018d);});});}function respondWithStatusCode(_0x429af8,_0x2fea7f){_0x2fea7f=_0x2fea7f||0xcc;return function(_0x42a1fc){if(_0x42a1fc){return _0x429af8[_0x9bdf('0x1a')](_0x2fea7f);}return _0x429af8[_0x9bdf('0x1b')](_0x2fea7f)[_0x9bdf('0x1c')]();};}function respondWithResult(_0x50564b,_0x5b3e1d){_0x5b3e1d=_0x5b3e1d||0xc8;return function(_0x320ad1){if(_0x320ad1){return _0x50564b['status'](_0x5b3e1d)['json'](_0x320ad1);}};}function respondWithFilteredResult(_0x38280e,_0x426a56){return function(_0x43143a){if(_0x43143a){var _0x529660=typeof _0x426a56['offset']===_0x9bdf('0x1d')&&typeof _0x426a56[_0x9bdf('0x1e')]===_0x9bdf('0x1d');var _0x3eb900=_0x43143a['count'];var _0x12479e=_0x529660?0x0:_0x426a56['offset'];var _0x40aa01=_0x529660?_0x43143a[_0x9bdf('0x1f')]:_0x426a56[_0x9bdf('0x20')]+_0x426a56[_0x9bdf('0x1e')];var _0x2c7a7b;if(_0x40aa01>=_0x3eb900){_0x40aa01=_0x3eb900;_0x2c7a7b=0xc8;}else{_0x2c7a7b=0xce;}_0x38280e['status'](_0x2c7a7b);return _0x38280e[_0x9bdf('0x21')](_0x9bdf('0x22'),_0x12479e+'-'+_0x40aa01+'/'+_0x3eb900)['json'](_0x43143a);}return null;};}function saveUpdates(_0x24917b){return function(_0x182e2d){if(_0x182e2d){return _0x182e2d[_0x9bdf('0x23')](_0x24917b)[_0x9bdf('0xf')](function(_0x525e0f){return _0x525e0f;});}return null;};}function removeEntity(_0x5f3d55){return function(_0x1f296d){if(_0x1f296d){return _0x1f296d[_0x9bdf('0x24')]()[_0x9bdf('0xf')](function(){var _0x16e10e=_0x1f296d[_0x9bdf('0x25')]({'plain':!![]});var _0x5d7046='MailAccounts';return db[_0x9bdf('0x26')][_0x9bdf('0x24')]({'where':{'type':_0x5d7046,'resourceId':_0x16e10e['id']}})[_0x9bdf('0xf')](function(){return _0x1f296d;});})['then'](function(){_0x5f3d55[_0x9bdf('0x1b')](0xcc)[_0x9bdf('0x1c')]();});}};}function handleEntityNotFound(_0x6a739e){return function(_0x307409){if(!_0x307409){_0x6a739e[_0x9bdf('0x1a')](0x194);}return _0x307409;};}function handleError(_0x3df77d,_0x478aaa){_0x478aaa=_0x478aaa||0x1f4;return function(_0x5450dd){logger[_0x9bdf('0x16')](_0x5450dd[_0x9bdf('0x27')]);if(_0x5450dd[_0x9bdf('0x28')]){delete _0x5450dd['name'];}_0x3df77d[_0x9bdf('0x1b')](_0x478aaa)[_0x9bdf('0x29')](_0x5450dd);};}function getImapHost(_0x2f246c){switch(_0x2f246c){case _0x9bdf('0x2a'):return _0x9bdf('0x2b');case _0x9bdf('0x2c'):return _0x9bdf('0x2d');case _0x9bdf('0x2e'):return'imap-mail.outlook.com';case _0x9bdf('0x2f'):return _0x9bdf('0x30');}throw new Error('Unknown\x20email\x20service\x20provider',_0x2f246c);}function getSmtpHost(_0x36b441){switch(_0x36b441){case _0x9bdf('0x2a'):return _0x9bdf('0x31');case'yahoo':return _0x9bdf('0x32');case _0x9bdf('0x2e'):return _0x9bdf('0x33');case'outlook365':return _0x9bdf('0x34');}throw new Error('Unknown\x20email\x20service\x20provider',_0x36b441);}function getAuthenticationOptions(_0x4ea1d8,_0x135bae){var _0x1a328b={};var _0x9cb235={};if(_0x4ea1d8){_0x1a328b['user']=_0x9cb235['user']=_0x135bae[_0x9bdf('0x35')];_0x1a328b[_0x9bdf('0x36')]=_0x9cb235[_0x9bdf('0x37')]=_0x135bae[_0x9bdf('0x36')];if(_0x135bae[_0x9bdf('0x38')]){_0x1a328b[_0x9bdf('0x38')]=_0x9cb235['modernAuthentication']=!![];_0x1a328b[_0x9bdf('0x39')]=_0x9cb235[_0x9bdf('0x39')]=_0x135bae[_0x9bdf('0x39')];_0x1a328b[_0x9bdf('0x36')]=_0x9cb235[_0x9bdf('0x37')]=null;}else{_0x1a328b[_0x9bdf('0x39')]=_0x9cb235['CloudProviderId']=null;}_0x1a328b['host']=getImapHost(_0x4ea1d8);_0x1a328b[_0x9bdf('0x3a')]=0x3e1;_0x9cb235[_0x9bdf('0x3b')]=getSmtpHost(_0x4ea1d8);_0x9cb235[_0x9bdf('0x3a')]=0x24b;_0x9cb235[_0x9bdf('0x3c')]=![];_0x1a328b['service']=_0x9cb235[_0x9bdf('0x3d')]=null;}else{if(_0x135bae[_0x9bdf('0x3e')]){_0x1a328b[_0x9bdf('0x3f')]=_0x9cb235[_0x9bdf('0x3f')]=_0x135bae['username'];_0x1a328b[_0x9bdf('0x36')]=_0x9cb235[_0x9bdf('0x37')]=_0x135bae[_0x9bdf('0x36')];}else{_0x1a328b[_0x9bdf('0x3e')]=_0x9cb235[_0x9bdf('0x3e')]=![];_0x1a328b[_0x9bdf('0x3f')]=_0x9cb235[_0x9bdf('0x3f')]=null;_0x1a328b[_0x9bdf('0x36')]=_0x9cb235[_0x9bdf('0x37')]=null;}_0x1a328b[_0x9bdf('0x3b')]=_0x135bae['Imap']['host'];_0x1a328b['port']=_0x135bae[_0x9bdf('0x40')][_0x9bdf('0x3a')];_0x9cb235[_0x9bdf('0x3b')]=_0x135bae[_0x9bdf('0x41')][_0x9bdf('0x3b')];_0x9cb235[_0x9bdf('0x3a')]=_0x135bae[_0x9bdf('0x41')][_0x9bdf('0x3a')];}return{'Imap':_0x1a328b,'Smtp':_0x9cb235};}exports[_0x9bdf('0x42')]=function(_0x365714,_0x9c41f6){var _0x387101={'include':[{'model':db[_0x9bdf('0x43')],'as':_0x9bdf('0x40')},{'model':db[_0x9bdf('0x44')],'as':'Smtp'},{'model':db['Pause'],'as':_0x9bdf('0x45')}]},_0x258297={},_0x3bc84e={'count':0x0,'rows':[]};var _0x40c9ee=_['map'](db[_0x9bdf('0x46')][_0x9bdf('0x47')],function(_0x21c842){return{'name':_0x21c842[_0x9bdf('0x48')],'type':_0x21c842[_0x9bdf('0x49')]['key']};});_0x258297[_0x9bdf('0x4a')]=_[_0x9bdf('0x4b')](_0x40c9ee,_0x9bdf('0x28'));_0x258297[_0x9bdf('0x4c')]=_[_0x9bdf('0x4d')](_0x365714[_0x9bdf('0x4c')]);_0x258297[_0x9bdf('0x4e')]=_[_0x9bdf('0x4f')](_0x258297[_0x9bdf('0x4a')],_0x258297[_0x9bdf('0x4c')]);_0x387101[_0x9bdf('0x50')]=_[_0x9bdf('0x4f')](_0x258297[_0x9bdf('0x4a')],qs['fields'](_0x365714['query'][_0x9bdf('0x51')]));_0x387101[_0x9bdf('0x50')]=_0x387101[_0x9bdf('0x50')][_0x9bdf('0x52')]?_0x387101['attributes']:_0x258297[_0x9bdf('0x4a')];if(!_0x365714['query'][_0x9bdf('0x53')](_0x9bdf('0x54'))){_0x387101[_0x9bdf('0x1e')]=qs['limit'](_0x365714[_0x9bdf('0x4c')]['limit']);_0x387101[_0x9bdf('0x20')]=qs[_0x9bdf('0x20')](_0x365714[_0x9bdf('0x4c')][_0x9bdf('0x20')]);}_0x387101[_0x9bdf('0x55')]=qs[_0x9bdf('0x56')](_0x365714['query'][_0x9bdf('0x56')]);_0x387101[_0x9bdf('0x57')]=qs[_0x9bdf('0x4e')](_[_0x9bdf('0x58')](_0x365714['query'],_0x258297[_0x9bdf('0x4e')]),_0x40c9ee);if(_0x365714['query']['filter']){_0x387101[_0x9bdf('0x57')]=_['merge'](_0x387101['where'],{'$or':_['map'](_0x40c9ee,function(_0xc36c31){if(_0xc36c31['type']!=='VIRTUAL'){var _0x493ff5={};_0x493ff5[_0xc36c31['name']]={'$like':'%'+_0x365714['query'][_0x9bdf('0x59')]+'%'};return _0x493ff5;}})});}_0x387101=_[_0x9bdf('0x5a')]({},_0x387101,_0x365714[_0x9bdf('0x5b')]);var _0x21f5b5={'where':_0x387101['where']};return db[_0x9bdf('0x46')][_0x9bdf('0x1f')](_0x21f5b5)[_0x9bdf('0xf')](function(_0x1e2d2a){_0x3bc84e['count']=_0x1e2d2a;if(_0x365714['query'][_0x9bdf('0x5c')]){_0x387101[_0x9bdf('0x5d')]=[{'all':!![]}];}return db['MailAccount'][_0x9bdf('0x5e')](_0x387101);})[_0x9bdf('0xf')](function(_0x15c2ee){_0x3bc84e[_0x9bdf('0x5f')]=_0x15c2ee;return _0x3bc84e;})[_0x9bdf('0xf')](respondWithFilteredResult(_0x9c41f6,_0x387101))[_0x9bdf('0x19')](handleError(_0x9c41f6,null));};exports[_0x9bdf('0x60')]=function(_0xf4945a,_0x19117d){var _0x232e0b={'raw':![],'where':{'id':_0xf4945a[_0x9bdf('0x61')]['id']},'include':[{'model':db[_0x9bdf('0x43')],'as':_0x9bdf('0x40')},{'model':db[_0x9bdf('0x44')],'as':'Smtp'},{'model':db[_0x9bdf('0x62')],'as':'mandatoryDispositionPause'}]},_0x1f003c={};_0x1f003c[_0x9bdf('0x4a')]=_[_0x9bdf('0x4d')](db[_0x9bdf('0x46')][_0x9bdf('0x47')]);_0x1f003c[_0x9bdf('0x4c')]=_[_0x9bdf('0x4d')](_0xf4945a[_0x9bdf('0x4c')]);_0x1f003c['filters']=_[_0x9bdf('0x4f')](_0x1f003c[_0x9bdf('0x4a')],_0x1f003c['query']);_0x232e0b[_0x9bdf('0x50')]=_[_0x9bdf('0x4f')](_0x1f003c[_0x9bdf('0x4a')],qs[_0x9bdf('0x51')](_0xf4945a['query'][_0x9bdf('0x51')]));_0x232e0b[_0x9bdf('0x50')]=_0x232e0b['attributes'][_0x9bdf('0x52')]?_0x232e0b['attributes']:_0x1f003c[_0x9bdf('0x4a')];if(_0xf4945a['query']['includeAll']){_0x232e0b[_0x9bdf('0x5d')]=[{'all':!![]}];}_0x232e0b=_[_0x9bdf('0x5a')]({},_0x232e0b,_0xf4945a['options']);return db[_0x9bdf('0x46')][_0x9bdf('0x63')](_0x232e0b)['then'](handleEntityNotFound(_0x19117d,null))[_0x9bdf('0xf')](respondWithResult(_0x19117d,null))[_0x9bdf('0x19')](handleError(_0x19117d,null));};exports[_0x9bdf('0x23')]=function(_0x199a40,_0x12ed56){if(_0x199a40[_0x9bdf('0x64')]['id']){delete _0x199a40[_0x9bdf('0x64')]['id'];}var _0x2b4d70=_0x199a40[_0x9bdf('0x64')][_0x9bdf('0x65')]===_0x9bdf('0x66')?null:_0x199a40['body'][_0x9bdf('0x65')];var _0x44a977=_0x199a40[_0x9bdf('0x64')][_0x9bdf('0x40')]||{};var _0x4022e6=_0x199a40['body'][_0x9bdf('0x41')]||{};if(_0x2b4d70){_0x44a977['host']=getImapHost(_0x2b4d70);_0x44a977[_0x9bdf('0x3a')]=0x3e1;_0x4022e6[_0x9bdf('0x3b')]=getSmtpHost(_0x2b4d70);_0x4022e6['port']=0x24b;_0x4022e6[_0x9bdf('0x3c')]=![];}if(_0x4022e6[_0x9bdf('0x38')]){_0x4022e6[_0x9bdf('0x3c')]=![];}else{_0x4022e6[_0x9bdf('0x39')]=null;}if(!_0x44a977[_0x9bdf('0x38')])_0x44a977[_0x9bdf('0x39')]=null;_0x199a40[_0x9bdf('0x64')]['Imap']=_0x44a977;_0x199a40[_0x9bdf('0x64')]['Smtp']=_0x4022e6;return db[_0x9bdf('0x46')][_0x9bdf('0x63')]({'where':{'id':_0x199a40[_0x9bdf('0x61')]['id']},'include':[{'model':db[_0x9bdf('0x43')],'as':'Imap'},{'model':db[_0x9bdf('0x44')],'as':_0x9bdf('0x41')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0x9bdf('0xf')](handleEntityNotFound(_0x12ed56,null))[_0x9bdf('0xf')](function(_0x4038b8){if(!_0x4038b8)throw new Error(_0x9bdf('0x67'));if(_0x4038b8[_0x9bdf('0x3d')])delete _0x199a40['body'][_0x9bdf('0x40')];return _0x4038b8;})[_0x9bdf('0xf')](saveUpdates(_0x199a40[_0x9bdf('0x64')],null))[_0x9bdf('0xf')](function(_0x345393){if(!_0x199a40[_0x9bdf('0x64')]['Imap'])return _0x345393;return db['MailServerIn'][_0x9bdf('0x23')](_0x199a40[_0x9bdf('0x64')][_0x9bdf('0x40')],{'where':{'MailAccountId':_0x345393['id']}})['then'](function(){return _0x345393;});})[_0x9bdf('0xf')](function(_0x3047da){if(!_0x199a40['body'][_0x9bdf('0x41')])return _0x3047da;return db[_0x9bdf('0x44')]['update'](_0x199a40[_0x9bdf('0x64')][_0x9bdf('0x41')],{'where':{'MailAccountId':_0x3047da['id']}})[_0x9bdf('0xf')](function(){return _0x3047da;});})[_0x9bdf('0xf')](respondWithResult(_0x12ed56,null))[_0x9bdf('0x19')](handleError(_0x12ed56,null));};exports[_0x9bdf('0x68')]=function(_0x1cc3f5,_0x1256d5){return db[_0x9bdf('0x46')][_0x9bdf('0x68')]()[_0x9bdf('0xf')](respondWithResult(_0x1256d5,null))[_0x9bdf('0x19')](handleError(_0x1256d5,null));};exports[_0x9bdf('0x69')]=function(_0x446bcb,_0x1d2655){if(_0x446bcb[_0x9bdf('0x64')]['id']){delete _0x446bcb[_0x9bdf('0x64')]['id'];}return db[_0x9bdf('0x46')][_0x9bdf('0x63')]({'where':{'id':_0x446bcb[_0x9bdf('0x61')]['id']}})[_0x9bdf('0xf')](handleEntityNotFound(_0x1d2655,null))[_0x9bdf('0xf')](function(_0x133cfa){if(_0x133cfa){_0x446bcb['body'][_0x9bdf('0x6a')]=_0x133cfa['id'];return db['Disposition'][_0x9bdf('0x6b')](_0x446bcb[_0x9bdf('0x64')]);}})[_0x9bdf('0xf')](respondWithResult(_0x1d2655,null))[_0x9bdf('0x19')](handleError(_0x1d2655,null));};exports[_0x9bdf('0x6c')]=function(_0x2c674c,_0x2e7337){var _0x31bbfd={'raw':![],'where':{}};var _0x14fa4e={};var _0x57944b={'count':0x0,'rows':[]};return db['MailAccount'][_0x9bdf('0x6d')]({'where':{'id':_0x2c674c[_0x9bdf('0x61')]['id']}})['then'](handleEntityNotFound(_0x2e7337,null))[_0x9bdf('0xf')](function(_0x1e26d2){if(_0x1e26d2){_0x14fa4e[_0x9bdf('0x4a')]=_[_0x9bdf('0x4d')](db[_0x9bdf('0x6e')][_0x9bdf('0x47')]);_0x14fa4e[_0x9bdf('0x4c')]=_[_0x9bdf('0x4d')](_0x2c674c[_0x9bdf('0x4c')]);_0x14fa4e['filters']=_['intersection'](_0x14fa4e[_0x9bdf('0x4a')],_0x14fa4e[_0x9bdf('0x4c')]);_0x31bbfd[_0x9bdf('0x50')]=_['intersection'](_0x14fa4e['model'],qs['fields'](_0x2c674c[_0x9bdf('0x4c')][_0x9bdf('0x51')]));_0x31bbfd[_0x9bdf('0x50')]=_0x31bbfd['attributes'][_0x9bdf('0x52')]?_0x31bbfd[_0x9bdf('0x50')]:_0x14fa4e[_0x9bdf('0x4a')];if(!_0x2c674c[_0x9bdf('0x4c')]['hasOwnProperty'](_0x9bdf('0x54'))){_0x31bbfd['limit']=qs[_0x9bdf('0x1e')](_0x2c674c[_0x9bdf('0x4c')][_0x9bdf('0x1e')]);_0x31bbfd[_0x9bdf('0x20')]=qs[_0x9bdf('0x20')](_0x2c674c[_0x9bdf('0x4c')][_0x9bdf('0x20')]);}_0x31bbfd['order']=qs['sort'](_0x2c674c[_0x9bdf('0x4c')][_0x9bdf('0x56')]);_0x31bbfd[_0x9bdf('0x57')]=qs[_0x9bdf('0x4e')](_[_0x9bdf('0x58')](_0x2c674c[_0x9bdf('0x4c')],_0x14fa4e[_0x9bdf('0x4e')]));_0x31bbfd['where']['MailAccountId']=_0x1e26d2['id'];if(_0x2c674c[_0x9bdf('0x4c')][_0x9bdf('0x59')]){_0x31bbfd[_0x9bdf('0x57')]=_['merge'](_0x31bbfd[_0x9bdf('0x57')],{'$or':_[_0x9bdf('0x4b')](_0x31bbfd['attributes'],function(_0x447a2a){var _0x87adc5={};_0x87adc5[_0x447a2a]={'$like':'%'+_0x2c674c['query'][_0x9bdf('0x59')]+'%'};return _0x87adc5;})});}_0x31bbfd=_[_0x9bdf('0x5a')]({},_0x31bbfd,_0x2c674c[_0x9bdf('0x5b')]);return db[_0x9bdf('0x6e')][_0x9bdf('0x1f')]({'where':_0x31bbfd[_0x9bdf('0x57')]})['then'](function(_0x57c416){_0x57944b[_0x9bdf('0x1f')]=_0x57c416;if(_0x2c674c[_0x9bdf('0x4c')][_0x9bdf('0x5c')]){_0x31bbfd[_0x9bdf('0x5d')]=[{'all':!![]}];}return db[_0x9bdf('0x6e')][_0x9bdf('0x5e')](_0x31bbfd);})[_0x9bdf('0xf')](function(_0x25cf3f){_0x57944b['rows']=_0x25cf3f;return _0x57944b;});}})[_0x9bdf('0xf')](respondWithFilteredResult(_0x2e7337,_0x31bbfd))['catch'](handleError(_0x2e7337,null));};exports['removeDispositions']=function(_0x2015e7,_0x2f4b9d){return db[_0x9bdf('0x46')]['find']({'where':{'id':_0x2015e7[_0x9bdf('0x61')]['id']}})[_0x9bdf('0xf')](handleEntityNotFound(_0x2f4b9d,null))['then'](function(_0x3226c7){if(_0x3226c7){return _0x3226c7[_0x9bdf('0x6f')](_0x2015e7[_0x9bdf('0x4c')][_0x9bdf('0x70')]);}})[_0x9bdf('0xf')](respondWithStatusCode(_0x2f4b9d,null))['catch'](handleError(_0x2f4b9d,null));};exports['addAnswer']=function(_0x3a216c,_0x3d6ac9){if(_0x3a216c[_0x9bdf('0x64')]['id']){delete _0x3a216c['body']['id'];}return db[_0x9bdf('0x46')][_0x9bdf('0x63')]({'where':{'id':_0x3a216c[_0x9bdf('0x61')]['id']}})[_0x9bdf('0xf')](handleEntityNotFound(_0x3d6ac9,null))['then'](function(_0x1cb492){if(_0x1cb492){_0x3a216c[_0x9bdf('0x64')][_0x9bdf('0x6a')]=_0x1cb492['id'];return db[_0x9bdf('0x71')][_0x9bdf('0x6b')](_0x3a216c['body']);}})[_0x9bdf('0xf')](respondWithResult(_0x3d6ac9,null))[_0x9bdf('0x19')](handleError(_0x3d6ac9,null));};exports[_0x9bdf('0x72')]=function(_0x34ba08,_0xfd7296){var _0x5a0445={'raw':![],'where':{}};var _0x659b20={};var _0x31b52d={'count':0x0,'rows':[]};return db[_0x9bdf('0x46')]['findOne']({'where':{'id':_0x34ba08[_0x9bdf('0x61')]['id']}})[_0x9bdf('0xf')](handleEntityNotFound(_0xfd7296,null))[_0x9bdf('0xf')](function(_0x2b71c7){if(_0x2b71c7){_0x659b20['model']=_['keys'](db[_0x9bdf('0x71')]['rawAttributes']);_0x659b20[_0x9bdf('0x4c')]=_[_0x9bdf('0x4d')](_0x34ba08[_0x9bdf('0x4c')]);_0x659b20[_0x9bdf('0x4e')]=_[_0x9bdf('0x4f')](_0x659b20[_0x9bdf('0x4a')],_0x659b20[_0x9bdf('0x4c')]);_0x5a0445[_0x9bdf('0x50')]=_[_0x9bdf('0x4f')](_0x659b20[_0x9bdf('0x4a')],qs['fields'](_0x34ba08[_0x9bdf('0x4c')][_0x9bdf('0x51')]));_0x5a0445[_0x9bdf('0x50')]=_0x5a0445[_0x9bdf('0x50')][_0x9bdf('0x52')]?_0x5a0445[_0x9bdf('0x50')]:_0x659b20['model'];if(!_0x34ba08[_0x9bdf('0x4c')][_0x9bdf('0x53')](_0x9bdf('0x54'))){_0x5a0445[_0x9bdf('0x1e')]=qs[_0x9bdf('0x1e')](_0x34ba08[_0x9bdf('0x4c')]['limit']);_0x5a0445['offset']=qs[_0x9bdf('0x20')](_0x34ba08[_0x9bdf('0x4c')][_0x9bdf('0x20')]);}_0x5a0445['order']=qs['sort'](_0x34ba08['query']['sort']);_0x5a0445[_0x9bdf('0x57')]=qs[_0x9bdf('0x4e')](_[_0x9bdf('0x58')](_0x34ba08[_0x9bdf('0x4c')],_0x659b20[_0x9bdf('0x4e')]));_0x5a0445[_0x9bdf('0x57')][_0x9bdf('0x6a')]=_0x2b71c7['id'];if(_0x34ba08['query'][_0x9bdf('0x59')]){_0x5a0445[_0x9bdf('0x57')]=_[_0x9bdf('0x5a')](_0x5a0445[_0x9bdf('0x57')],{'$or':_[_0x9bdf('0x4b')](_0x5a0445['attributes'],function(_0x188e6c){var _0x502402={};_0x502402[_0x188e6c]={'$like':'%'+_0x34ba08[_0x9bdf('0x4c')]['filter']+'%'};return _0x502402;})});}_0x5a0445=_[_0x9bdf('0x5a')]({},_0x5a0445,_0x34ba08[_0x9bdf('0x5b')]);return db[_0x9bdf('0x71')]['count']({'where':_0x5a0445[_0x9bdf('0x57')]})[_0x9bdf('0xf')](function(_0x116cad){_0x31b52d[_0x9bdf('0x1f')]=_0x116cad;if(_0x34ba08[_0x9bdf('0x4c')][_0x9bdf('0x5c')]){_0x5a0445[_0x9bdf('0x5d')]=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x5a0445);})[_0x9bdf('0xf')](function(_0x43dd11){_0x31b52d['rows']=_0x43dd11;return _0x31b52d;});}})[_0x9bdf('0xf')](respondWithFilteredResult(_0xfd7296,_0x5a0445))['catch'](handleError(_0xfd7296,null));};exports[_0x9bdf('0x73')]=function(_0x24d0e3,_0x26802a){return db['MailAccount'][_0x9bdf('0x63')]({'where':{'id':_0x24d0e3[_0x9bdf('0x61')]['id']}})[_0x9bdf('0xf')](handleEntityNotFound(_0x26802a,null))[_0x9bdf('0xf')](function(_0x18a8db){if(_0x18a8db){return _0x18a8db[_0x9bdf('0x73')](_0x24d0e3[_0x9bdf('0x4c')][_0x9bdf('0x70')]);}})['then'](respondWithStatusCode(_0x26802a,null))[_0x9bdf('0x19')](handleError(_0x26802a,null));};exports[_0x9bdf('0x6b')]=function(_0x4d47ea,_0x32a7e2){var _0x4a13bd={'name':_0x4d47ea[_0x9bdf('0x64')][_0x9bdf('0x28')],'key':_0x4d47ea[_0x9bdf('0x64')][_0x9bdf('0x74')],'provider':_0x4d47ea[_0x9bdf('0x64')][_0x9bdf('0x65')]===_0x9bdf('0x66')?null:_0x4d47ea[_0x9bdf('0x64')][_0x9bdf('0x65')],'email':_0x4d47ea[_0x9bdf('0x64')][_0x9bdf('0x75')],'ListId':_0x4d47ea[_0x9bdf('0x64')][_0x9bdf('0x76')],'active':!_[_0x9bdf('0x77')](_0x4d47ea[_0x9bdf('0x64')][_0x9bdf('0x78')])?_0x4d47ea[_0x9bdf('0x64')][_0x9bdf('0x78')]:!![],'description':_0x4d47ea['body']['description']||null};var _0x4fe2d2=getAuthenticationOptions(_0x4a13bd[_0x9bdf('0x65')],_0x4d47ea[_0x9bdf('0x64')]);_0x4a13bd[_0x9bdf('0x40')]=_0x4fe2d2[_0x9bdf('0x40')];_0x4a13bd['Smtp']=_0x4fe2d2[_0x9bdf('0x41')];return db['MailAccount']['create'](_0x4a13bd,{'include':[{'model':db[_0x9bdf('0x44')],'as':_0x9bdf('0x41')},{'model':db[_0x9bdf('0x43')],'as':_0x9bdf('0x40')}]})[_0x9bdf('0xf')](function(_0x3d588e){var _0x902dd8=_0x4d47ea['user'][_0x9bdf('0x25')]({'plain':!![]});if(!_0x902dd8)throw new Error(_0x9bdf('0x79'));if(_0x902dd8[_0x9bdf('0x7a')]===_0x9bdf('0x3f')){var _0x33ec12=_0x3d588e[_0x9bdf('0x25')]({'plain':!![]});return db[_0x9bdf('0x7b')][_0x9bdf('0x63')]({'where':{'name':_0x9bdf('0x7c'),'userProfileId':_0x902dd8[_0x9bdf('0x7d')]},'raw':!![]})[_0x9bdf('0xf')](function(_0x239bc1){if(_0x239bc1&&_0x239bc1[_0x9bdf('0x7e')]===0x0){return db[_0x9bdf('0x26')]['create']({'name':_0x33ec12[_0x9bdf('0x28')],'resourceId':_0x33ec12['id'],'type':_0x239bc1['name'],'sectionId':_0x239bc1['id']},{})[_0x9bdf('0xf')](function(){return _0x3d588e;});}else{return _0x3d588e;}})[_0x9bdf('0x19')](function(_0x16977a){logger[_0x9bdf('0x16')](_0x9bdf('0x7f'),_0x16977a);throw _0x16977a;});}return _0x3d588e;})['then'](respondWithResult(_0x32a7e2,0xc9))[_0x9bdf('0x19')](handleError(_0x32a7e2,null));};exports[_0x9bdf('0x80')]=function(_0x46cec0,_0x7a22d1){return db['MailAccount']['findOne']({'where':{'id':_0x46cec0[_0x9bdf('0x61')]['id']}})[_0x9bdf('0xf')](handleEntityNotFound(_0x7a22d1,null))[_0x9bdf('0xf')](function(_0xc2b73f){if(_0xc2b73f){return _0xc2b73f['getImap']();}return null;})[_0x9bdf('0xf')](respondWithResult(_0x7a22d1,null))[_0x9bdf('0x19')](handleError(_0x7a22d1,null));};exports[_0x9bdf('0x81')]=function(_0x201d14,_0x3b5332){if(_0x201d14[_0x9bdf('0x64')]['id']){delete _0x201d14['body']['id'];}return db[_0x9bdf('0x46')][_0x9bdf('0x63')]({'where':{'id':_0x201d14['params']['id']}})[_0x9bdf('0xf')](handleEntityNotFound(_0x3b5332,null))[_0x9bdf('0xf')](function(_0x1ca4fa){if(_0x1ca4fa){_0x201d14['body'][_0x9bdf('0x6a')]=_0x1ca4fa['id'];return db['MailServerIn'][_0x9bdf('0x6b')](_0x201d14['body']);}})[_0x9bdf('0xf')](respondWithResult(_0x3b5332,null))[_0x9bdf('0x19')](handleError(_0x3b5332,null));};exports[_0x9bdf('0x82')]=function(_0x2c8964,_0xcbb124){return db['MailAccount']['findOne']({'where':{'id':_0x2c8964['params']['id']}})['then'](handleEntityNotFound(_0xcbb124,null))['then'](function(_0x4feee3){if(_0x4feee3){return _0x4feee3[_0x9bdf('0x83')](null);}return null;})[_0x9bdf('0xf')](respondWithStatusCode(_0xcbb124,null))[_0x9bdf('0x19')](handleError(_0xcbb124,null));};exports[_0x9bdf('0x84')]=function(_0x16e2dd,_0x3b02e3){return db[_0x9bdf('0x46')]['findOne']({'where':{'id':_0x16e2dd[_0x9bdf('0x61')]['id']}})[_0x9bdf('0xf')](handleEntityNotFound(_0x3b02e3,null))[_0x9bdf('0xf')](function(_0x4e065c){if(_0x4e065c){return _0x4e065c[_0x9bdf('0x84')]();}return null;})[_0x9bdf('0xf')](respondWithResult(_0x3b02e3,null))[_0x9bdf('0x19')](handleError(_0x3b02e3,null));};exports['addSmtp']=function(_0x58a6c5,_0x6949b9){if(_0x58a6c5['body']['id']){delete _0x58a6c5['body']['id'];}return db[_0x9bdf('0x46')][_0x9bdf('0x63')]({'where':{'id':_0x58a6c5[_0x9bdf('0x61')]['id']}})[_0x9bdf('0xf')](handleEntityNotFound(_0x6949b9,null))[_0x9bdf('0xf')](function(_0x2216bb){if(_0x2216bb){_0x58a6c5[_0x9bdf('0x64')][_0x9bdf('0x6a')]=_0x2216bb['id'];return db[_0x9bdf('0x44')][_0x9bdf('0x6b')](_0x58a6c5[_0x9bdf('0x64')]);}})['then'](respondWithResult(_0x6949b9,null))[_0x9bdf('0x19')](handleError(_0x6949b9,null));};exports[_0x9bdf('0x85')]=function(_0x42640a,_0x2a60f8){return db[_0x9bdf('0x46')][_0x9bdf('0x6d')]({'where':{'id':_0x42640a[_0x9bdf('0x61')]['id']}})[_0x9bdf('0xf')](handleEntityNotFound(_0x2a60f8,null))[_0x9bdf('0xf')](function(_0x52da67){if(_0x52da67){return _0x52da67[_0x9bdf('0x86')](null);}return null;})['then'](respondWithStatusCode(_0x2a60f8,null))[_0x9bdf('0x19')](handleError(_0x2a60f8,null));};exports[_0x9bdf('0x87')]=function(_0x4d760f,_0x34c827){return db[_0x9bdf('0x88')][_0x9bdf('0x63')]({'where':{'id':_0x4d760f['params']['id']}})[_0x9bdf('0xf')](handleEntityNotFound(_0x34c827,null))[_0x9bdf('0xf')](function(_0x30a1b1){if(_0x30a1b1){return _0x30a1b1[_0x9bdf('0x87')](_0x4d760f[_0x9bdf('0x64')][_0x9bdf('0x70')],_[_0x9bdf('0x89')](_0x4d760f[_0x9bdf('0x64')],[_0x9bdf('0x70'),'id'])||{});}})[_0x9bdf('0xf')](respondWithResult(_0x34c827,null))[_0x9bdf('0x19')](handleError(_0x34c827,null));};exports[_0x9bdf('0x8a')]=function(_0x3a7bac,_0x5aded2){var _0x2883ae={'raw':![],'where':{}};var _0x42683e={};var _0xbec54c={'count':0x0,'rows':[]};return db[_0x9bdf('0x46')]['findOne']({'where':{'id':_0x3a7bac[_0x9bdf('0x61')]['id']}})[_0x9bdf('0xf')](handleEntityNotFound(_0x5aded2,null))['then'](function(_0x2be21d){if(_0x2be21d){_0x42683e[_0x9bdf('0x4a')]=_[_0x9bdf('0x4d')](db['MailInteraction']['rawAttributes']);_0x42683e[_0x9bdf('0x4c')]=_['keys'](_0x3a7bac[_0x9bdf('0x4c')]);_0x42683e[_0x9bdf('0x4e')]=_['intersection'](_0x42683e['model'],_0x42683e['query']);_0x2883ae['attributes']=_[_0x9bdf('0x4f')](_0x42683e[_0x9bdf('0x4a')],qs['fields'](_0x3a7bac[_0x9bdf('0x4c')][_0x9bdf('0x51')]));_0x2883ae['attributes']=_0x2883ae[_0x9bdf('0x50')][_0x9bdf('0x52')]?_0x2883ae[_0x9bdf('0x50')]:_0x42683e['model'];if(!_0x3a7bac[_0x9bdf('0x4c')]['hasOwnProperty'](_0x9bdf('0x54'))){_0x2883ae[_0x9bdf('0x1e')]=qs[_0x9bdf('0x1e')](_0x3a7bac[_0x9bdf('0x4c')]['limit']);_0x2883ae[_0x9bdf('0x20')]=qs[_0x9bdf('0x20')](_0x3a7bac[_0x9bdf('0x4c')][_0x9bdf('0x20')]);}_0x2883ae[_0x9bdf('0x55')]=qs['sort'](_0x3a7bac[_0x9bdf('0x4c')]['sort']);_0x2883ae[_0x9bdf('0x57')]=qs[_0x9bdf('0x4e')](_[_0x9bdf('0x58')](_0x3a7bac['query'],_0x42683e[_0x9bdf('0x4e')]));_0x2883ae[_0x9bdf('0x57')][_0x9bdf('0x6a')]=_0x2be21d['id'];if(_0x3a7bac[_0x9bdf('0x4c')][_0x9bdf('0x59')]){_0x2883ae[_0x9bdf('0x57')]=_[_0x9bdf('0x5a')](_0x2883ae[_0x9bdf('0x57')],{'$or':_[_0x9bdf('0x4b')](_0x2883ae[_0x9bdf('0x50')],function(_0x5a1fb4){var _0x562394={};_0x562394[_0x5a1fb4]={'$like':'%'+_0x3a7bac[_0x9bdf('0x4c')][_0x9bdf('0x59')]+'%'};return _0x562394;})});}_0x2883ae=_[_0x9bdf('0x5a')]({},_0x2883ae,_0x3a7bac[_0x9bdf('0x5b')]);return db['MailInteraction']['count']({'where':_0x2883ae[_0x9bdf('0x57')]})[_0x9bdf('0xf')](function(_0x2d3806){_0xbec54c['count']=_0x2d3806;if(_0x3a7bac[_0x9bdf('0x4c')][_0x9bdf('0x5c')]){_0x2883ae['include']=[{'model':db['CmContact'],'as':_0x9bdf('0x8b'),'required':![]},{'model':db[_0x9bdf('0x8c')],'as':_0x9bdf('0x8d'),'attributes':[_0x9bdf('0x28'),_0x9bdf('0x8e'),_0x9bdf('0x8f')],'required':![]},{'model':db[_0x9bdf('0x90')],'as':'Tags','attributes':['id',_0x9bdf('0x28'),'color'],'where':_0x3a7bac[_0x9bdf('0x4c')][_0x9bdf('0x91')]?{'id':_0x3a7bac[_0x9bdf('0x4c')]['tag']}:undefined,'required':_0x3a7bac[_0x9bdf('0x4c')]['tag']?!![]:![]}];}return db[_0x9bdf('0x88')][_0x9bdf('0x5e')](_0x2883ae);})[_0x9bdf('0xf')](function(_0x364d06){_0xbec54c['rows']=_0x364d06;return _0xbec54c;});}})[_0x9bdf('0xf')](respondWithFilteredResult(_0x5aded2,_0x2883ae))[_0x9bdf('0x19')](handleError(_0x5aded2,null));};exports['addApplications']=function addApplications(_0x2552a2,_0x273e92){var _0x3665d4=_0x2552a2['params']['id'];var _0x2c9623=_0x2552a2[_0x9bdf('0x64')];var _0x1ae59e=0xc8;var _0x27a294=null;return db[_0x9bdf('0x92')]['transaction']({'isolationLevel':db['sequelize'][_0x9bdf('0x93')][_0x9bdf('0x94')][_0x9bdf('0x95')]},function(_0x151ab8){return db[_0x9bdf('0x46')][_0x9bdf('0x6d')]({'where':{'id':_0x3665d4},'transaction':_0x151ab8})[_0x9bdf('0xf')](function(_0x468166){if(_0x468166){return db[_0x9bdf('0x96')][_0x9bdf('0x24')]({'where':{'MailAccountId':_0x3665d4},'transaction':_0x151ab8})[_0x9bdf('0xf')](function(){var _0x4c8ea3=_['map'](_0x2c9623,function(_0x4993c0){_0x4993c0[_0x9bdf('0x6a')]=_0x3665d4;return _0x4993c0;});return db[_0x9bdf('0x96')][_0x9bdf('0x97')](_0x4c8ea3,{'transaction':_0x151ab8});});}else{_0x1ae59e=0x194;_0x27a294=[];}});})['then'](function(){if(_0x1ae59e!==0x194){return db[_0x9bdf('0x96')][_0x9bdf('0x98')]({'where':{'MailAccountId':_0x3665d4},'order':_0x9bdf('0x99')})[_0x9bdf('0xf')](function(_0x71ef62){_0x27a294=_0x71ef62;});}})[_0x9bdf('0x19')](function(_0x3ea574){_0x1ae59e=0x1f4;logger[_0x9bdf('0x16')](_0x3ea574['stack']);if(_0x3ea574[_0x9bdf('0x28')]){delete _0x3ea574['name'];}_0x27a294=_0x3ea574;})[_0x9bdf('0x9a')](function(){if(_0x27a294===null){_0x273e92[_0x9bdf('0x1a')](_0x1ae59e);}else{if(_0x1ae59e===0x1f4){_0x273e92[_0x9bdf('0x1b')](_0x1ae59e)[_0x9bdf('0x29')](_0x27a294);}else{_0x273e92[_0x9bdf('0x1b')](_0x1ae59e)[_0x9bdf('0x9b')](_0x27a294);}}});};exports[_0x9bdf('0x9c')]=function(_0x4d77a3,_0x3fcd0e){var _0x57efa5={};var _0x8ab071={};var _0x1b2c09;var _0x57342a;return db['MailAccount'][_0x9bdf('0x6d')]({'where':{'id':_0x4d77a3[_0x9bdf('0x61')]['id']}})['then'](handleEntityNotFound(_0x3fcd0e,null))[_0x9bdf('0xf')](function(_0xc183ef){if(_0xc183ef){_0x1b2c09=_0xc183ef;_0x8ab071[_0x9bdf('0x4a')]=_[_0x9bdf('0x4d')](db[_0x9bdf('0x96')][_0x9bdf('0x47')]);_0x8ab071[_0x9bdf('0x4c')]=_[_0x9bdf('0x4d')](_0x4d77a3[_0x9bdf('0x4c')]);_0x8ab071[_0x9bdf('0x4e')]=_[_0x9bdf('0x4f')](_0x8ab071[_0x9bdf('0x4a')],_0x8ab071['query']);_0x57efa5[_0x9bdf('0x50')]=_[_0x9bdf('0x4f')](_0x8ab071['model'],qs['fields'](_0x4d77a3['query'][_0x9bdf('0x51')]));_0x57efa5[_0x9bdf('0x50')]=_0x57efa5['attributes'][_0x9bdf('0x52')]?_0x57efa5[_0x9bdf('0x50')]:_0x8ab071[_0x9bdf('0x4a')];_0x57efa5[_0x9bdf('0x55')]=qs[_0x9bdf('0x56')](_0x4d77a3[_0x9bdf('0x4c')]['sort']);_0x57efa5[_0x9bdf('0x57')]=qs[_0x9bdf('0x4e')](_[_0x9bdf('0x58')](_0x4d77a3[_0x9bdf('0x4c')],_0x8ab071[_0x9bdf('0x4e')]));if(_0x4d77a3['query'][_0x9bdf('0x59')]){_0x57efa5[_0x9bdf('0x57')]=_[_0x9bdf('0x5a')](_0x57efa5['where'],{'$or':_['map'](_0x57efa5[_0x9bdf('0x50')],function(_0x2b74e8){var _0x5e07a8={};_0x5e07a8[_0x2b74e8]={'$like':'%'+_0x4d77a3[_0x9bdf('0x4c')][_0x9bdf('0x59')]+'%'};return _0x5e07a8;})});}_0x57efa5=_['merge']({},_0x57efa5,_0x4d77a3[_0x9bdf('0x5b')]);return _0x1b2c09['getApplications'](_0x57efa5);}})[_0x9bdf('0xf')](function(_0x53691b){if(_0x53691b){_0x57342a=_0x53691b['length'];if(!_0x4d77a3['query'][_0x9bdf('0x53')](_0x9bdf('0x54'))){_0x57efa5[_0x9bdf('0x1e')]=qs['limit'](_0x4d77a3[_0x9bdf('0x4c')]['limit']);_0x57efa5[_0x9bdf('0x20')]=qs['offset'](_0x4d77a3[_0x9bdf('0x4c')]['offset']);}return _0x1b2c09[_0x9bdf('0x9c')](_0x57efa5);}})[_0x9bdf('0xf')](function(_0x2dca8f){if(_0x2dca8f){return _0x2dca8f?{'count':_0x57342a,'rows':_0x2dca8f}:null;}})[_0x9bdf('0xf')](respondWithResult(_0x3fcd0e,null))[_0x9bdf('0x19')](handleError(_0x3fcd0e,null));};exports[_0x9bdf('0x9d')]=function(_0x3849c1,_0x10278f){var _0x329e8e={'raw':!![],'where':{}};var _0x5557f2={};var _0x22913a={'count':0x0,'rows':[]};return db[_0x9bdf('0x46')]['findOne']({'where':{'id':_0x3849c1[_0x9bdf('0x61')]['id']}})['then'](handleEntityNotFound(_0x10278f,null))[_0x9bdf('0xf')](function(_0x2fa697){if(_0x2fa697){_0x5557f2[_0x9bdf('0x4a')]=_[_0x9bdf('0x4d')](db[_0x9bdf('0x9e')][_0x9bdf('0x47')]);_0x5557f2['query']=_[_0x9bdf('0x4d')](_0x3849c1[_0x9bdf('0x4c')]);_0x5557f2[_0x9bdf('0x4e')]=_[_0x9bdf('0x4f')](_0x5557f2[_0x9bdf('0x4a')],_0x5557f2[_0x9bdf('0x4c')]);_0x329e8e[_0x9bdf('0x50')]=_[_0x9bdf('0x4f')](_0x5557f2['model'],qs[_0x9bdf('0x51')](_0x3849c1[_0x9bdf('0x4c')][_0x9bdf('0x51')]));_0x329e8e[_0x9bdf('0x50')]=_0x329e8e[_0x9bdf('0x50')][_0x9bdf('0x52')]?_0x329e8e[_0x9bdf('0x50')]:_0x5557f2['model'];if(!_0x3849c1[_0x9bdf('0x4c')]['hasOwnProperty']('nolimit')){_0x329e8e[_0x9bdf('0x1e')]=qs[_0x9bdf('0x1e')](_0x3849c1[_0x9bdf('0x4c')]['limit']);_0x329e8e[_0x9bdf('0x20')]=qs[_0x9bdf('0x20')](_0x3849c1[_0x9bdf('0x4c')]['offset']);}_0x329e8e[_0x9bdf('0x55')]=qs[_0x9bdf('0x56')](_0x3849c1[_0x9bdf('0x4c')]['sort']);_0x329e8e[_0x9bdf('0x57')]=qs[_0x9bdf('0x4e')](_[_0x9bdf('0x58')](_0x3849c1[_0x9bdf('0x4c')],_0x5557f2[_0x9bdf('0x4e')]));_0x329e8e[_0x9bdf('0x57')][_0x9bdf('0x6a')]=_0x2fa697['id'];if(_0x3849c1['query']['filter']){_0x329e8e[_0x9bdf('0x57')]=_[_0x9bdf('0x5a')](_0x329e8e[_0x9bdf('0x57')],{'$or':_[_0x9bdf('0x4b')](_0x329e8e[_0x9bdf('0x50')],function(_0x3e00ed){var _0x3a265c={};_0x3a265c[_0x3e00ed]={'$like':'%'+_0x3849c1[_0x9bdf('0x4c')]['filter']+'%'};return _0x3a265c;})});}if(_0x3849c1[_0x9bdf('0x4c')][_0x9bdf('0x9f')]){var _0x1c929e=_0x3849c1[_0x9bdf('0x4c')][_0x9bdf('0x9f')][_0x9bdf('0xa0')](',');var _0x20b94b={};_0x20b94b[_0x1c929e[0x0]]={'$gte':moment(_0x1c929e[0x1])[_0x9bdf('0xa1')]('YYYY-MM-DD\x20HH:mm:ss')};_0x329e8e['where']=_[_0x9bdf('0x5a')](_0x329e8e['where'],_0x20b94b);}_0x329e8e=_[_0x9bdf('0x5a')]({},_0x329e8e,_0x3849c1['options']);return db[_0x9bdf('0x9e')][_0x9bdf('0x1f')]({'where':_0x329e8e['where']})[_0x9bdf('0xf')](function(_0x2d9abb){_0x22913a[_0x9bdf('0x1f')]=_0x2d9abb;if(_0x3849c1['query'][_0x9bdf('0x5c')]){_0x329e8e[_0x9bdf('0x5d')]=[{'all':!![]}];}return db[_0x9bdf('0x9e')]['findAll'](_0x329e8e);})['then'](function(_0x3faffb){if(_0x3849c1[_0x9bdf('0x4c')][_0x9bdf('0xa2')]===_0x9bdf('0xa3')){for(var _0x468dd0=0x0;_0x468dd0<_0x3faffb[_0x9bdf('0x52')];_0x468dd0++){_0x3faffb[_0x468dd0][_0x9bdf('0x64')]=juice(_0x3faffb[_0x468dd0]['body']);}}_0x22913a[_0x9bdf('0x5f')]=_0x3faffb;return _0x22913a;});}})[_0x9bdf('0xf')](respondWithFilteredResult(_0x10278f,_0x329e8e))['catch'](handleError(_0x10278f,null));};exports[_0x9bdf('0x29')]=function(_0x4d75dd,_0x3bf007){var _0x2c646,_0x271b15={},_0x113079;if(_0x4d75dd['body']['to']){_0x113079=_0x4d75dd['body']['to'][_0x9bdf('0xa0')](',')[0x0];}return db[_0x9bdf('0x46')][_0x9bdf('0x63')]({'where':{'id':_0x4d75dd[_0x9bdf('0x61')]['id']},'include':[{'model':db[_0x9bdf('0xa4')],'as':_0x9bdf('0xa5'),'include':[{'model':db[_0x9bdf('0xa6')],'as':_0x9bdf('0xa7'),'where':{'email':_0x113079},'limit':0x1,'order':[[_0x9bdf('0xa8'),_0x9bdf('0xa9')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0x9bdf('0xaa')],'as':_0x9bdf('0xaa'),'raw':!![]}]}]})[_0x9bdf('0xf')](handleEntityNotFound(_0x3bf007,null))[_0x9bdf('0xf')](function(_0x3434df){if(!_0x3434df)return;_0x2c646=_0x3434df;if(!_0x3434df[_0x9bdf('0x41')])throw new Error('Smtp\x20configuration\x20not\x20found');if(_[_0x9bdf('0x77')](_0x4d75dd['body'][_0x9bdf('0xab')])){_0x4d75dd['body']['from']=util[_0x9bdf('0xa1')](_0x9bdf('0xac'),_0x3434df[_0x9bdf('0x28')],_0x3434df['email']||_0x3434df['Smtp'][_0x9bdf('0x3f')]);}if(_0x4d75dd[_0x9bdf('0x64')]['attachments']&&_0x4d75dd[_0x9bdf('0x64')][_0x9bdf('0xad')][_0x9bdf('0x52')]){for(var _0x24a210=0x0;_0x24a210<_0x4d75dd['body'][_0x9bdf('0xad')]['length'];_0x24a210+=0x1){_0x4d75dd['body'][_0x9bdf('0xad')][_0x24a210]={'filename':_0x4d75dd[_0x9bdf('0x64')]['attachments'][_0x24a210]['name'],'path':path['join'](config[_0x9bdf('0xae')],_0x9bdf('0xaf'),_0x4d75dd[_0x9bdf('0x64')]['attachments'][_0x24a210]['basename'])};}}var _0x474ee1=_0x3434df[_0x9bdf('0xb0')]();return respondWithRpcPromise(_0x9bdf('0xb1'),'sendMail',{'account':_0x474ee1,'message':_0x4d75dd[_0x9bdf('0x64')]});})[_0x9bdf('0xf')](function(_0x5d7359){if(!_0x5d7359)return;_0x271b15=_0x5d7359;if(!_0x2c646[_0x9bdf('0xa5')])throw new Error(_0x9bdf('0xb2'));if(_0x2c646[_0x9bdf('0xa5')][_0x9bdf('0xa7')][_0x9bdf('0x52')])return _0x2c646[_0x9bdf('0xa5')]['Contacts'][0x0];return db[_0x9bdf('0xa6')][_0x9bdf('0x6b')](_[_0x9bdf('0xb3')](_0x4d75dd['body'],{'firstName':_0x4d75dd[_0x9bdf('0x64')]['to'],'email':_0x4d75dd[_0x9bdf('0x64')]['to'],'phone':_0x4d75dd[_0x9bdf('0x64')]['to'],'ListId':_0x2c646[_0x9bdf('0x76')]}));})['then'](function(_0x157864){if(!_0x157864)return;var _0x5a51f7={'UserId':_0x4d75dd[_0x9bdf('0x3f')]['id'],'ContactId':_0x157864['id'],'MailAccountId':_0x2c646['id'],'inReplyTo':_0x271b15['messageId'],'to':_0x4d75dd['body'][_0x9bdf('0xab')],'cc':_0x4d75dd['body']['cc'],'subject':_0x4d75dd[_0x9bdf('0x64')]['subject'],'attach':_0x4d75dd[_0x9bdf('0x64')][_0x9bdf('0xb4')],'firstMsgDirection':_0x9bdf('0xb5'),'lastMsgAt':moment()['format'](_0x9bdf('0xb6')),'lastMsgDirection':'out','Messages':[_['merge'](_0x4d75dd[_0x9bdf('0x64')],{'messageId':_0x271b15[_0x9bdf('0xb7')],'sentAt':moment()['format'](_0x9bdf('0xb6')),'read':!![],'MailAccountId':_0x2c646['id'],'UserId':_0x4d75dd[_0x9bdf('0x3f')]['id'],'ContactId':_0x157864['id']})]};if(_0x4d75dd[_0x9bdf('0x64')][_0x9bdf('0xb8')]){_0x5a51f7=_['merge'](_0x5a51f7,_0x4d75dd['body'][_0x9bdf('0xb8')]);}return db[_0x9bdf('0x88')][_0x9bdf('0x6b')](_0x5a51f7,{'include':[{'model':db[_0x9bdf('0x9e')],'as':'Messages'}]});})['then'](respondWithResult(_0x3bf007,null))[_0x9bdf('0x19')](handleError(_0x3bf007,null));};exports[_0x9bdf('0xb9')]=function(_0xf25602,_0x5ca48b){return db[_0x9bdf('0x46')][_0x9bdf('0x63')]({'where':{'id':_0xf25602['params']['id']},'include':[{'model':db[_0x9bdf('0x44')],'as':_0x9bdf('0x41'),'raw':!![],'include':[{'model':db[_0x9bdf('0xaa')],'as':_0x9bdf('0xaa'),'raw':!![]}]}]})[_0x9bdf('0xf')](handleEntityNotFound(_0x5ca48b,null))[_0x9bdf('0xf')](function(_0x3820c9){if(!_0x3820c9[_0x9bdf('0x41')])return;var _0x23b140=_0x3820c9[_0x9bdf('0xb0')]();return respondWithRpcPromise('VerifySmtp',_0x9bdf('0xb9'),{'account':_0x23b140});})[_0x9bdf('0xf')](respondWithResult(_0x5ca48b,null))[_0x9bdf('0x19')](handleError(_0x5ca48b,null));};exports[_0x9bdf('0x24')]=function(_0x4a0bd5,_0x1a3678){return db[_0x9bdf('0x46')][_0x9bdf('0x63')]({'where':{'id':_0x4a0bd5[_0x9bdf('0x61')]['id']}})[_0x9bdf('0xf')](handleEntityNotFound(_0x1a3678,null))[_0x9bdf('0xf')](function(_0x12fd13){if(_0x12fd13&&_0x12fd13[_0x9bdf('0x3d')]){throw new db[(_0x9bdf('0xba'))][(_0x9bdf('0xbb'))](_0x9bdf('0xbc'));}return _0x12fd13;})[_0x9bdf('0xf')](removeEntity(_0x1a3678,null))[_0x9bdf('0x19')](handleError(_0x1a3678,null));};exports[_0x9bdf('0xbd')]=function(_0x3dae31,_0x2312af){return db[_0x9bdf('0x46')][_0x9bdf('0x63')]({'where':{'id':_0x3dae31['params']['id']}})[_0x9bdf('0xf')](handleEntityNotFound(_0x2312af,null))[_0x9bdf('0xf')](function(_0x5942ad){if(_0x5942ad){return _0x5942ad['addAgents'](_0x3dae31[_0x9bdf('0x64')][_0x9bdf('0x70')],_[_0x9bdf('0x89')](_0x3dae31[_0x9bdf('0x64')],[_0x9bdf('0x70'),'id'])||{})['spread'](function(_0x27709a){for(var _0x42748c=0x0;_0x42748c<_0x3dae31[_0x9bdf('0x64')][_0x9bdf('0x70')][_0x9bdf('0x52')];_0x42748c+=0x1){socket[_0x9bdf('0xbe')]('userMailAccount:save',{'UserId':Number(_0x3dae31['body'][_0x9bdf('0x70')][_0x42748c]),'MailAccountId':Number(_0x3dae31[_0x9bdf('0x61')]['id'])});}return _0x27709a;});}})['then'](respondWithResult(_0x2312af,null))[_0x9bdf('0x19')](handleError(_0x2312af,null));};exports[_0x9bdf('0xbf')]=function(_0xf1bac9,_0x2d2ce2){return db['MailAccount'][_0x9bdf('0x63')]({'where':{'id':_0xf1bac9['params']['id']}})[_0x9bdf('0xf')](handleEntityNotFound(_0x2d2ce2,null))[_0x9bdf('0xf')](function(_0x1bd20c){if(_0x1bd20c){return _0x1bd20c[_0x9bdf('0xbf')](_0xf1bac9[_0x9bdf('0x4c')]['ids'])[_0x9bdf('0xf')](function(){if(_[_0x9bdf('0xc0')](_0xf1bac9[_0x9bdf('0x4c')][_0x9bdf('0x70')])){for(var _0x509987=0x0;_0x509987<_0xf1bac9[_0x9bdf('0x4c')][_0x9bdf('0x70')][_0x9bdf('0x52')];_0x509987+=0x1){socket[_0x9bdf('0xbe')](_0x9bdf('0xc1'),{'UserId':Number(_0xf1bac9[_0x9bdf('0x4c')][_0x9bdf('0x70')][_0x509987]),'MailAccountId':Number(_0xf1bac9[_0x9bdf('0x61')]['id'])});}}else{socket['emit'](_0x9bdf('0xc1'),{'UserId':Number(_0xf1bac9[_0x9bdf('0x4c')]['ids']),'MailAccountId':Number(_0xf1bac9[_0x9bdf('0x61')]['id'])});}});}})[_0x9bdf('0xf')](respondWithStatusCode(_0x2d2ce2,null))[_0x9bdf('0x19')](handleError(_0x2d2ce2,null));};exports[_0x9bdf('0xc2')]=function(_0x166a97,_0x21ff23){var _0x569199={};var _0x5cf86d={};var _0x1bacef;var _0x35f853;return db['MailAccount'][_0x9bdf('0x6d')]({'where':{'id':_0x166a97[_0x9bdf('0x61')]['id']}})['then'](handleEntityNotFound(_0x21ff23,null))[_0x9bdf('0xf')](function(_0x2441a9){if(_0x2441a9){_0x1bacef=_0x2441a9;_0x5cf86d[_0x9bdf('0x4a')]=_[_0x9bdf('0x4d')](db[_0x9bdf('0x8c')][_0x9bdf('0x47')]);_0x5cf86d[_0x9bdf('0x4c')]=_['keys'](_0x166a97[_0x9bdf('0x4c')]);_0x5cf86d['filters']=_[_0x9bdf('0x4f')](_0x5cf86d['model'],_0x5cf86d['query']);_0x569199[_0x9bdf('0x50')]=_['intersection'](_0x5cf86d[_0x9bdf('0x4a')],qs[_0x9bdf('0x51')](_0x166a97[_0x9bdf('0x4c')][_0x9bdf('0x51')]));_0x569199[_0x9bdf('0x50')]=_0x569199[_0x9bdf('0x50')][_0x9bdf('0x52')]?_0x569199[_0x9bdf('0x50')]:_0x5cf86d['model'];_0x569199[_0x9bdf('0x55')]=qs[_0x9bdf('0x56')](_0x166a97[_0x9bdf('0x4c')]['sort']);_0x569199[_0x9bdf('0x57')]=qs[_0x9bdf('0x4e')](_['pick'](_0x166a97[_0x9bdf('0x4c')],_0x5cf86d[_0x9bdf('0x4e')]));if(_0x166a97[_0x9bdf('0x4c')]['filter']){_0x569199['where']=_[_0x9bdf('0x5a')](_0x569199[_0x9bdf('0x57')],{'$or':_['map'](_0x569199[_0x9bdf('0x50')],function(_0x308933){var _0x43bd2c={};_0x43bd2c[_0x308933]={'$like':'%'+_0x166a97[_0x9bdf('0x4c')]['filter']+'%'};return _0x43bd2c;})});}_0x569199=_[_0x9bdf('0x5a')]({},_0x569199,_0x166a97['options']);return _0x1bacef[_0x9bdf('0xc2')](_0x569199);}})['then'](function(_0x284a3b){if(_0x284a3b){_0x35f853=_0x284a3b[_0x9bdf('0x52')];if(!_0x166a97[_0x9bdf('0x4c')][_0x9bdf('0x53')](_0x9bdf('0x54'))){_0x569199[_0x9bdf('0x1e')]=qs[_0x9bdf('0x1e')](_0x166a97['query']['limit']);_0x569199[_0x9bdf('0x20')]=qs['offset'](_0x166a97[_0x9bdf('0x4c')]['offset']);}return _0x1bacef['getAgents'](_0x569199);}})['then'](function(_0x51d90e){if(_0x51d90e){return _0x51d90e?{'count':_0x35f853,'rows':_0x51d90e}:null;}})['then'](respondWithResult(_0x21ff23,null))['catch'](handleError(_0x21ff23,null));}; \ No newline at end of file +var _0xaf5c=['READ_COMMITTED','MailApplication','bulkCreate','findAndCountAll','priority','finally','send','getApplications','getMessages','MailMessage','$gte','format','YYYY-MM-DD\x20HH:mm:ss','inlineCss','true','CmList','List','updatedAt','DESC','CloudProvider','Smtp\x20configuration\x20not\x20found','from','%s\x20<%s>','email','attachments','join','server/files/attachments','basename','getSmtpOptions','SendMail','sendMail','List\x20not\x20found','Contacts','ListId','subject','attach','out','messageId','Messages','verifySmtp','VerifySmtp','Sequelize','You\x20can\x27t\x20remove\x20the\x20mail\x20service\x20account','addAgents','emit','removeAgents','isArray','getAgents','moment','bluebird','util','path','juice','../../components/parsers/qs','../../config/logger','api','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','client','http','request','then','info','MailAccount,\x20%s,\x20%s','debug','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','message','request\x20sent','result','sendStatus','status','json','offset','limit','undefined','count','set','get','MailAccounts','UserProfileResource','destroy','end','stack','name','gmail','imap.gmail.com','yahoo','imap-mail.outlook.com','outlook365','outlook.office365.com','Unknown\x20email\x20service\x20provider','smtp.gmail.com','smtp.mail.yahoo.com','smtp-mail.outlook.com','user','username','password','pass','modernAuthentication','CloudProviderId','host','port','service','authentication','Imap','Smtp','index','MailServerOut','mandatoryDispositionPause','map','MailAccount','rawAttributes','fieldName','key','model','query','keys','filters','intersection','fields','attributes','length','nolimit','order','sort','where','merge','type','options','includeAll','include','findAll','rows','catch','show','params','MailServerIn','find','body','provider','custom','secure','Pause','Mail\x20Account\x20not\x20found','update','describe','addDisposition','MailAccountId','Disposition','create','findOne','hasOwnProperty','filter','ids','CannedAnswer','getAnswers','pick','removeAnswers','isNil','active','description','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','getImap','addImap','removeImap','getSmtp','addSmtp','removeSmtp','setSmtp','addInteraction','MailInteraction','omit','getInteractions','CmContact','Contact','User','Owner','internal','Tags','color','tag','transaction','sequelize','ISOLATION_LEVELS'];(function(_0x25fd75,_0x249eca){var _0x30c67d=function(_0x3474c3){while(--_0x3474c3){_0x25fd75['push'](_0x25fd75['shift']());}};_0x30c67d(++_0x249eca);}(_0xaf5c,0xf2));var _0xcaf5=function(_0x457654,_0x31efe2){_0x457654=_0x457654-0x0;var _0x2e726d=_0xaf5c[_0x457654];return _0x2e726d;};'use strict';var moment=require(_0xcaf5('0x0'));var BPromise=require(_0xcaf5('0x1'));var util=require(_0xcaf5('0x2'));var path=require(_0xcaf5('0x3'));var _=require('lodash');var juice=require(_0xcaf5('0x4'));var Redis=require('ioredis');var qs=require(_0xcaf5('0x5'));var logger=require(_0xcaf5('0x6'))(_0xcaf5('0x7'));var config=require('../../config/environment');var db=require(_0xcaf5('0x8'))['db'];config[_0xcaf5('0x9')]=_[_0xcaf5('0xa')](config[_0xcaf5('0x9')],{'host':_0xcaf5('0xb'),'port':0x18eb});var socket=require(_0xcaf5('0xc'))(new Redis(config[_0xcaf5('0x9')]));require(_0xcaf5('0xd'))[_0xcaf5('0xe')](socket);var jayson=require('jayson/promise');var client=jayson[_0xcaf5('0xf')][_0xcaf5('0x10')]({'port':0x232b});function respondWithRpcPromise(_0x1c91f3,_0x59c678,_0x2eb672,_0x14ace1){return new BPromise(function(_0x113ff3,_0x5a4062){var _0x2145d7=_0x14ace1||client;return _0x2145d7[_0xcaf5('0x11')](_0x1c91f3,_0x2eb672)[_0xcaf5('0x12')](function(_0x379c73){logger[_0xcaf5('0x13')](_0xcaf5('0x14'),_0x59c678,'request\x20sent');logger[_0xcaf5('0x15')](_0xcaf5('0x16'),_0x59c678,'request\x20sent',JSON[_0xcaf5('0x17')](_0x379c73));if(_0x379c73['error']){if(_0x379c73['error']['code']===0x1f4){logger[_0xcaf5('0x18')](_0xcaf5('0x14'),_0x59c678,_0x379c73[_0xcaf5('0x18')][_0xcaf5('0x19')]);return _0x5a4062(_0x379c73[_0xcaf5('0x18')][_0xcaf5('0x19')]);}logger['error'](_0xcaf5('0x14'),_0x59c678,_0x379c73[_0xcaf5('0x18')][_0xcaf5('0x19')]);return _0x113ff3(_0x379c73['error'][_0xcaf5('0x19')]);}else{logger[_0xcaf5('0x13')](_0xcaf5('0x14'),_0x59c678,_0xcaf5('0x1a'));_0x113ff3(_0x379c73[_0xcaf5('0x1b')][_0xcaf5('0x19')]);}})['catch'](function(_0x209405){logger[_0xcaf5('0x18')]('MailAccount,\x20%s,\x20%s',_0x59c678,_0x209405);_0x5a4062(_0x209405);});});}function respondWithStatusCode(_0x344e38,_0x1cd2c6){_0x1cd2c6=_0x1cd2c6||0xcc;return function(_0x27e8f1){if(_0x27e8f1){return _0x344e38[_0xcaf5('0x1c')](_0x1cd2c6);}return _0x344e38['status'](_0x1cd2c6)['end']();};}function respondWithResult(_0x1782e2,_0x28b5b1){_0x28b5b1=_0x28b5b1||0xc8;return function(_0x1eb7ae){if(_0x1eb7ae){return _0x1782e2[_0xcaf5('0x1d')](_0x28b5b1)[_0xcaf5('0x1e')](_0x1eb7ae);}};}function respondWithFilteredResult(_0x45f295,_0x3af468){return function(_0x2238ce){if(_0x2238ce){var _0x44e4cf=typeof _0x3af468[_0xcaf5('0x1f')]==='undefined'&&typeof _0x3af468[_0xcaf5('0x20')]===_0xcaf5('0x21');var _0x33652a=_0x2238ce[_0xcaf5('0x22')];var _0x44bc77=_0x44e4cf?0x0:_0x3af468[_0xcaf5('0x1f')];var _0x3b9b4d=_0x44e4cf?_0x2238ce['count']:_0x3af468[_0xcaf5('0x1f')]+_0x3af468[_0xcaf5('0x20')];var _0x43b718;if(_0x3b9b4d>=_0x33652a){_0x3b9b4d=_0x33652a;_0x43b718=0xc8;}else{_0x43b718=0xce;}_0x45f295[_0xcaf5('0x1d')](_0x43b718);return _0x45f295[_0xcaf5('0x23')]('Content-Range',_0x44bc77+'-'+_0x3b9b4d+'/'+_0x33652a)[_0xcaf5('0x1e')](_0x2238ce);}return null;};}function saveUpdates(_0x4789d7){return function(_0xbe6ce2){if(_0xbe6ce2){return _0xbe6ce2['update'](_0x4789d7)[_0xcaf5('0x12')](function(_0x35140e){return _0x35140e;});}return null;};}function removeEntity(_0xc66c38){return function(_0x15823a){if(_0x15823a){return _0x15823a['destroy']()[_0xcaf5('0x12')](function(){var _0x4494e6=_0x15823a[_0xcaf5('0x24')]({'plain':!![]});var _0x2fee88=_0xcaf5('0x25');return db[_0xcaf5('0x26')][_0xcaf5('0x27')]({'where':{'type':_0x2fee88,'resourceId':_0x4494e6['id']}})['then'](function(){return _0x15823a;});})[_0xcaf5('0x12')](function(){_0xc66c38[_0xcaf5('0x1d')](0xcc)[_0xcaf5('0x28')]();});}};}function handleEntityNotFound(_0x2f1f13){return function(_0x269cc8){if(!_0x269cc8){_0x2f1f13[_0xcaf5('0x1c')](0x194);}return _0x269cc8;};}function handleError(_0xe0c090,_0x111120){_0x111120=_0x111120||0x1f4;return function(_0x2e271c){logger[_0xcaf5('0x18')](_0x2e271c[_0xcaf5('0x29')]);if(_0x2e271c['name']){delete _0x2e271c[_0xcaf5('0x2a')];}_0xe0c090[_0xcaf5('0x1d')](_0x111120)['send'](_0x2e271c);};}function getImapHost(_0x5d2c3e){switch(_0x5d2c3e){case _0xcaf5('0x2b'):return _0xcaf5('0x2c');case _0xcaf5('0x2d'):return'imap.mail.yahoo.com';case'hotmail':return _0xcaf5('0x2e');case _0xcaf5('0x2f'):return _0xcaf5('0x30');}throw new Error(_0xcaf5('0x31'),_0x5d2c3e);}function getSmtpHost(_0x278f62){switch(_0x278f62){case _0xcaf5('0x2b'):return _0xcaf5('0x32');case _0xcaf5('0x2d'):return _0xcaf5('0x33');case'hotmail':return _0xcaf5('0x34');case _0xcaf5('0x2f'):return'smtp.office365.com';}throw new Error(_0xcaf5('0x31'),_0x278f62);}function getAuthenticationOptions(_0x7c2654,_0x2c7177){var _0x5140e2={};var _0x1d5fdd={};if(_0x7c2654){_0x5140e2['user']=_0x1d5fdd[_0xcaf5('0x35')]=_0x2c7177[_0xcaf5('0x36')];_0x5140e2[_0xcaf5('0x37')]=_0x1d5fdd[_0xcaf5('0x38')]=_0x2c7177[_0xcaf5('0x37')];if(_0x2c7177[_0xcaf5('0x39')]){_0x5140e2['modernAuthentication']=_0x1d5fdd['modernAuthentication']=!![];_0x5140e2['CloudProviderId']=_0x1d5fdd[_0xcaf5('0x3a')]=_0x2c7177[_0xcaf5('0x3a')];_0x5140e2['password']=_0x1d5fdd[_0xcaf5('0x38')]=null;}else{_0x5140e2['CloudProviderId']=_0x1d5fdd[_0xcaf5('0x3a')]=null;}_0x5140e2[_0xcaf5('0x3b')]=getImapHost(_0x7c2654);_0x5140e2[_0xcaf5('0x3c')]=0x3e1;_0x1d5fdd[_0xcaf5('0x3b')]=getSmtpHost(_0x7c2654);_0x1d5fdd[_0xcaf5('0x3c')]=0x24b;_0x1d5fdd['secure']=![];_0x5140e2[_0xcaf5('0x3d')]=_0x1d5fdd[_0xcaf5('0x3d')]=null;}else{if(_0x2c7177['authentication']){_0x5140e2[_0xcaf5('0x35')]=_0x1d5fdd[_0xcaf5('0x35')]=_0x2c7177[_0xcaf5('0x36')];_0x5140e2[_0xcaf5('0x37')]=_0x1d5fdd['pass']=_0x2c7177[_0xcaf5('0x37')];}else{_0x5140e2[_0xcaf5('0x3e')]=_0x1d5fdd[_0xcaf5('0x3e')]=![];_0x5140e2[_0xcaf5('0x35')]=_0x1d5fdd[_0xcaf5('0x35')]=null;_0x5140e2[_0xcaf5('0x37')]=_0x1d5fdd[_0xcaf5('0x38')]=null;}_0x5140e2['host']=_0x2c7177['Imap'][_0xcaf5('0x3b')];_0x5140e2[_0xcaf5('0x3c')]=_0x2c7177[_0xcaf5('0x3f')][_0xcaf5('0x3c')];_0x1d5fdd[_0xcaf5('0x3b')]=_0x2c7177[_0xcaf5('0x40')]['host'];_0x1d5fdd['port']=_0x2c7177[_0xcaf5('0x40')][_0xcaf5('0x3c')];}return{'Imap':_0x5140e2,'Smtp':_0x1d5fdd};}exports[_0xcaf5('0x41')]=function(_0x190203,_0x551ef7){var _0x36910b={'include':[{'model':db['MailServerIn'],'as':'Imap'},{'model':db[_0xcaf5('0x42')],'as':'Smtp'},{'model':db['Pause'],'as':_0xcaf5('0x43')}]},_0x5086ec={},_0x234099={'count':0x0,'rows':[]};var _0x23fda3=_[_0xcaf5('0x44')](db[_0xcaf5('0x45')][_0xcaf5('0x46')],function(_0x37c460){return{'name':_0x37c460[_0xcaf5('0x47')],'type':_0x37c460['type'][_0xcaf5('0x48')]};});_0x5086ec[_0xcaf5('0x49')]=_[_0xcaf5('0x44')](_0x23fda3,_0xcaf5('0x2a'));_0x5086ec[_0xcaf5('0x4a')]=_[_0xcaf5('0x4b')](_0x190203[_0xcaf5('0x4a')]);_0x5086ec[_0xcaf5('0x4c')]=_[_0xcaf5('0x4d')](_0x5086ec[_0xcaf5('0x49')],_0x5086ec['query']);_0x36910b['attributes']=_[_0xcaf5('0x4d')](_0x5086ec['model'],qs[_0xcaf5('0x4e')](_0x190203['query'][_0xcaf5('0x4e')]));_0x36910b[_0xcaf5('0x4f')]=_0x36910b[_0xcaf5('0x4f')][_0xcaf5('0x50')]?_0x36910b[_0xcaf5('0x4f')]:_0x5086ec[_0xcaf5('0x49')];if(!_0x190203[_0xcaf5('0x4a')]['hasOwnProperty'](_0xcaf5('0x51'))){_0x36910b['limit']=qs[_0xcaf5('0x20')](_0x190203[_0xcaf5('0x4a')]['limit']);_0x36910b[_0xcaf5('0x1f')]=qs[_0xcaf5('0x1f')](_0x190203[_0xcaf5('0x4a')][_0xcaf5('0x1f')]);}_0x36910b[_0xcaf5('0x52')]=qs[_0xcaf5('0x53')](_0x190203[_0xcaf5('0x4a')][_0xcaf5('0x53')]);_0x36910b[_0xcaf5('0x54')]=qs['filters'](_['pick'](_0x190203[_0xcaf5('0x4a')],_0x5086ec[_0xcaf5('0x4c')]),_0x23fda3);if(_0x190203['query']['filter']){_0x36910b[_0xcaf5('0x54')]=_[_0xcaf5('0x55')](_0x36910b[_0xcaf5('0x54')],{'$or':_[_0xcaf5('0x44')](_0x23fda3,function(_0x31d39d){if(_0x31d39d[_0xcaf5('0x56')]!=='VIRTUAL'){var _0x281065={};_0x281065[_0x31d39d[_0xcaf5('0x2a')]]={'$like':'%'+_0x190203[_0xcaf5('0x4a')]['filter']+'%'};return _0x281065;}})});}_0x36910b=_[_0xcaf5('0x55')]({},_0x36910b,_0x190203[_0xcaf5('0x57')]);var _0x6e1b19={'where':_0x36910b[_0xcaf5('0x54')]};return db[_0xcaf5('0x45')][_0xcaf5('0x22')](_0x6e1b19)[_0xcaf5('0x12')](function(_0x53fbad){_0x234099[_0xcaf5('0x22')]=_0x53fbad;if(_0x190203[_0xcaf5('0x4a')][_0xcaf5('0x58')]){_0x36910b[_0xcaf5('0x59')]=[{'all':!![]}];}return db[_0xcaf5('0x45')][_0xcaf5('0x5a')](_0x36910b);})[_0xcaf5('0x12')](function(_0x176ebf){_0x234099[_0xcaf5('0x5b')]=_0x176ebf;return _0x234099;})[_0xcaf5('0x12')](respondWithFilteredResult(_0x551ef7,_0x36910b))[_0xcaf5('0x5c')](handleError(_0x551ef7,null));};exports[_0xcaf5('0x5d')]=function(_0x4e845f,_0x3d9b58){var _0x2c6fb8={'raw':![],'where':{'id':_0x4e845f[_0xcaf5('0x5e')]['id']},'include':[{'model':db[_0xcaf5('0x5f')],'as':_0xcaf5('0x3f')},{'model':db[_0xcaf5('0x42')],'as':_0xcaf5('0x40')},{'model':db['Pause'],'as':'mandatoryDispositionPause'}]},_0x170828={};_0x170828[_0xcaf5('0x49')]=_[_0xcaf5('0x4b')](db['MailAccount']['rawAttributes']);_0x170828[_0xcaf5('0x4a')]=_[_0xcaf5('0x4b')](_0x4e845f[_0xcaf5('0x4a')]);_0x170828[_0xcaf5('0x4c')]=_[_0xcaf5('0x4d')](_0x170828[_0xcaf5('0x49')],_0x170828[_0xcaf5('0x4a')]);_0x2c6fb8[_0xcaf5('0x4f')]=_[_0xcaf5('0x4d')](_0x170828[_0xcaf5('0x49')],qs[_0xcaf5('0x4e')](_0x4e845f[_0xcaf5('0x4a')][_0xcaf5('0x4e')]));_0x2c6fb8[_0xcaf5('0x4f')]=_0x2c6fb8[_0xcaf5('0x4f')]['length']?_0x2c6fb8[_0xcaf5('0x4f')]:_0x170828[_0xcaf5('0x49')];if(_0x4e845f[_0xcaf5('0x4a')][_0xcaf5('0x58')]){_0x2c6fb8[_0xcaf5('0x59')]=[{'all':!![]}];}_0x2c6fb8=_['merge']({},_0x2c6fb8,_0x4e845f[_0xcaf5('0x57')]);return db['MailAccount'][_0xcaf5('0x60')](_0x2c6fb8)[_0xcaf5('0x12')](handleEntityNotFound(_0x3d9b58,null))[_0xcaf5('0x12')](respondWithResult(_0x3d9b58,null))[_0xcaf5('0x5c')](handleError(_0x3d9b58,null));};exports['update']=function(_0xd08de3,_0x7aa237){if(_0xd08de3[_0xcaf5('0x61')]['id']){delete _0xd08de3[_0xcaf5('0x61')]['id'];}var _0x29b39f=_0xd08de3[_0xcaf5('0x61')][_0xcaf5('0x62')]===_0xcaf5('0x63')?null:_0xd08de3[_0xcaf5('0x61')][_0xcaf5('0x62')];var _0x57fad7=_0xd08de3[_0xcaf5('0x61')][_0xcaf5('0x3f')]||{};var _0xe1dc87=_0xd08de3[_0xcaf5('0x61')][_0xcaf5('0x40')]||{};if(_0x29b39f){_0x57fad7[_0xcaf5('0x3b')]=getImapHost(_0x29b39f);_0x57fad7[_0xcaf5('0x3c')]=0x3e1;_0xe1dc87['host']=getSmtpHost(_0x29b39f);_0xe1dc87[_0xcaf5('0x3c')]=0x24b;_0xe1dc87[_0xcaf5('0x64')]=![];}if(_0xe1dc87['modernAuthentication']){_0xe1dc87[_0xcaf5('0x64')]=![];}else{_0xe1dc87['CloudProviderId']=null;}if(!_0x57fad7[_0xcaf5('0x39')])_0x57fad7['CloudProviderId']=null;_0xd08de3[_0xcaf5('0x61')][_0xcaf5('0x3f')]=_0x57fad7;_0xd08de3[_0xcaf5('0x61')][_0xcaf5('0x40')]=_0xe1dc87;return db['MailAccount'][_0xcaf5('0x60')]({'where':{'id':_0xd08de3['params']['id']},'include':[{'model':db['MailServerIn'],'as':_0xcaf5('0x3f')},{'model':db[_0xcaf5('0x42')],'as':_0xcaf5('0x40')},{'model':db[_0xcaf5('0x65')],'as':_0xcaf5('0x43')}]})[_0xcaf5('0x12')](handleEntityNotFound(_0x7aa237,null))[_0xcaf5('0x12')](function(_0x3094e1){if(!_0x3094e1)throw new Error(_0xcaf5('0x66'));if(_0x3094e1[_0xcaf5('0x3d')])delete _0xd08de3[_0xcaf5('0x61')][_0xcaf5('0x3f')];return _0x3094e1;})[_0xcaf5('0x12')](saveUpdates(_0xd08de3[_0xcaf5('0x61')],null))[_0xcaf5('0x12')](function(_0x55607b){if(!_0xd08de3[_0xcaf5('0x61')]['Imap'])return _0x55607b;return db[_0xcaf5('0x5f')][_0xcaf5('0x67')](_0xd08de3[_0xcaf5('0x61')][_0xcaf5('0x3f')],{'where':{'MailAccountId':_0x55607b['id']}})['then'](function(){return _0x55607b;});})[_0xcaf5('0x12')](function(_0x3a8179){if(!_0xd08de3[_0xcaf5('0x61')][_0xcaf5('0x40')])return _0x3a8179;return db['MailServerOut'][_0xcaf5('0x67')](_0xd08de3['body'][_0xcaf5('0x40')],{'where':{'MailAccountId':_0x3a8179['id']}})[_0xcaf5('0x12')](function(){return _0x3a8179;});})[_0xcaf5('0x12')](respondWithResult(_0x7aa237,null))[_0xcaf5('0x5c')](handleError(_0x7aa237,null));};exports[_0xcaf5('0x68')]=function(_0x2f4c21,_0x54febe){return db[_0xcaf5('0x45')][_0xcaf5('0x68')]()[_0xcaf5('0x12')](respondWithResult(_0x54febe,null))[_0xcaf5('0x5c')](handleError(_0x54febe,null));};exports[_0xcaf5('0x69')]=function(_0xe7673c,_0x23e9ec){if(_0xe7673c['body']['id']){delete _0xe7673c[_0xcaf5('0x61')]['id'];}return db['MailAccount'][_0xcaf5('0x60')]({'where':{'id':_0xe7673c['params']['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x23e9ec,null))[_0xcaf5('0x12')](function(_0x31b46f){if(_0x31b46f){_0xe7673c['body'][_0xcaf5('0x6a')]=_0x31b46f['id'];return db[_0xcaf5('0x6b')][_0xcaf5('0x6c')](_0xe7673c[_0xcaf5('0x61')]);}})[_0xcaf5('0x12')](respondWithResult(_0x23e9ec,null))['catch'](handleError(_0x23e9ec,null));};exports['getDispositions']=function(_0xfedbbe,_0x2983b2){var _0x5c086d={'raw':![],'where':{}};var _0x1f3287={};var _0x543d45={'count':0x0,'rows':[]};return db['MailAccount'][_0xcaf5('0x6d')]({'where':{'id':_0xfedbbe[_0xcaf5('0x5e')]['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x2983b2,null))['then'](function(_0x23a2ca){if(_0x23a2ca){_0x1f3287[_0xcaf5('0x49')]=_[_0xcaf5('0x4b')](db[_0xcaf5('0x6b')][_0xcaf5('0x46')]);_0x1f3287[_0xcaf5('0x4a')]=_[_0xcaf5('0x4b')](_0xfedbbe[_0xcaf5('0x4a')]);_0x1f3287[_0xcaf5('0x4c')]=_['intersection'](_0x1f3287['model'],_0x1f3287[_0xcaf5('0x4a')]);_0x5c086d[_0xcaf5('0x4f')]=_[_0xcaf5('0x4d')](_0x1f3287['model'],qs[_0xcaf5('0x4e')](_0xfedbbe['query'][_0xcaf5('0x4e')]));_0x5c086d[_0xcaf5('0x4f')]=_0x5c086d[_0xcaf5('0x4f')]['length']?_0x5c086d[_0xcaf5('0x4f')]:_0x1f3287[_0xcaf5('0x49')];if(!_0xfedbbe[_0xcaf5('0x4a')][_0xcaf5('0x6e')]('nolimit')){_0x5c086d['limit']=qs['limit'](_0xfedbbe['query'][_0xcaf5('0x20')]);_0x5c086d[_0xcaf5('0x1f')]=qs['offset'](_0xfedbbe['query']['offset']);}_0x5c086d[_0xcaf5('0x52')]=qs['sort'](_0xfedbbe[_0xcaf5('0x4a')]['sort']);_0x5c086d[_0xcaf5('0x54')]=qs[_0xcaf5('0x4c')](_['pick'](_0xfedbbe['query'],_0x1f3287[_0xcaf5('0x4c')]));_0x5c086d[_0xcaf5('0x54')]['MailAccountId']=_0x23a2ca['id'];if(_0xfedbbe[_0xcaf5('0x4a')]['filter']){_0x5c086d[_0xcaf5('0x54')]=_[_0xcaf5('0x55')](_0x5c086d[_0xcaf5('0x54')],{'$or':_[_0xcaf5('0x44')](_0x5c086d[_0xcaf5('0x4f')],function(_0x405885){var _0xe8923={};_0xe8923[_0x405885]={'$like':'%'+_0xfedbbe[_0xcaf5('0x4a')][_0xcaf5('0x6f')]+'%'};return _0xe8923;})});}_0x5c086d=_['merge']({},_0x5c086d,_0xfedbbe[_0xcaf5('0x57')]);return db[_0xcaf5('0x6b')][_0xcaf5('0x22')]({'where':_0x5c086d[_0xcaf5('0x54')]})[_0xcaf5('0x12')](function(_0x3b7a47){_0x543d45['count']=_0x3b7a47;if(_0xfedbbe[_0xcaf5('0x4a')][_0xcaf5('0x58')]){_0x5c086d[_0xcaf5('0x59')]=[{'all':!![]}];}return db[_0xcaf5('0x6b')]['findAll'](_0x5c086d);})[_0xcaf5('0x12')](function(_0x19be21){_0x543d45['rows']=_0x19be21;return _0x543d45;});}})[_0xcaf5('0x12')](respondWithFilteredResult(_0x2983b2,_0x5c086d))[_0xcaf5('0x5c')](handleError(_0x2983b2,null));};exports['removeDispositions']=function(_0x5aefdb,_0x4195ae){return db[_0xcaf5('0x45')][_0xcaf5('0x60')]({'where':{'id':_0x5aefdb['params']['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x4195ae,null))[_0xcaf5('0x12')](function(_0xf4dc74){if(_0xf4dc74){return _0xf4dc74['removeDispositions'](_0x5aefdb[_0xcaf5('0x4a')][_0xcaf5('0x70')]);}})[_0xcaf5('0x12')](respondWithStatusCode(_0x4195ae,null))[_0xcaf5('0x5c')](handleError(_0x4195ae,null));};exports['addAnswer']=function(_0x256f91,_0x7653cd){if(_0x256f91[_0xcaf5('0x61')]['id']){delete _0x256f91[_0xcaf5('0x61')]['id'];}return db[_0xcaf5('0x45')][_0xcaf5('0x60')]({'where':{'id':_0x256f91[_0xcaf5('0x5e')]['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x7653cd,null))[_0xcaf5('0x12')](function(_0x1374ab){if(_0x1374ab){_0x256f91[_0xcaf5('0x61')][_0xcaf5('0x6a')]=_0x1374ab['id'];return db[_0xcaf5('0x71')][_0xcaf5('0x6c')](_0x256f91[_0xcaf5('0x61')]);}})[_0xcaf5('0x12')](respondWithResult(_0x7653cd,null))[_0xcaf5('0x5c')](handleError(_0x7653cd,null));};exports[_0xcaf5('0x72')]=function(_0x2d5598,_0x694e5b){var _0x310d8e={'raw':![],'where':{}};var _0x3e6a30={};var _0x2881d4={'count':0x0,'rows':[]};return db['MailAccount']['findOne']({'where':{'id':_0x2d5598[_0xcaf5('0x5e')]['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x694e5b,null))[_0xcaf5('0x12')](function(_0x1d76b2){if(_0x1d76b2){_0x3e6a30[_0xcaf5('0x49')]=_['keys'](db[_0xcaf5('0x71')][_0xcaf5('0x46')]);_0x3e6a30[_0xcaf5('0x4a')]=_['keys'](_0x2d5598[_0xcaf5('0x4a')]);_0x3e6a30[_0xcaf5('0x4c')]=_['intersection'](_0x3e6a30[_0xcaf5('0x49')],_0x3e6a30[_0xcaf5('0x4a')]);_0x310d8e[_0xcaf5('0x4f')]=_[_0xcaf5('0x4d')](_0x3e6a30[_0xcaf5('0x49')],qs[_0xcaf5('0x4e')](_0x2d5598[_0xcaf5('0x4a')][_0xcaf5('0x4e')]));_0x310d8e['attributes']=_0x310d8e[_0xcaf5('0x4f')][_0xcaf5('0x50')]?_0x310d8e[_0xcaf5('0x4f')]:_0x3e6a30[_0xcaf5('0x49')];if(!_0x2d5598[_0xcaf5('0x4a')][_0xcaf5('0x6e')]('nolimit')){_0x310d8e[_0xcaf5('0x20')]=qs[_0xcaf5('0x20')](_0x2d5598[_0xcaf5('0x4a')][_0xcaf5('0x20')]);_0x310d8e[_0xcaf5('0x1f')]=qs[_0xcaf5('0x1f')](_0x2d5598[_0xcaf5('0x4a')][_0xcaf5('0x1f')]);}_0x310d8e[_0xcaf5('0x52')]=qs[_0xcaf5('0x53')](_0x2d5598[_0xcaf5('0x4a')][_0xcaf5('0x53')]);_0x310d8e[_0xcaf5('0x54')]=qs['filters'](_[_0xcaf5('0x73')](_0x2d5598[_0xcaf5('0x4a')],_0x3e6a30['filters']));_0x310d8e['where'][_0xcaf5('0x6a')]=_0x1d76b2['id'];if(_0x2d5598[_0xcaf5('0x4a')][_0xcaf5('0x6f')]){_0x310d8e[_0xcaf5('0x54')]=_[_0xcaf5('0x55')](_0x310d8e['where'],{'$or':_['map'](_0x310d8e[_0xcaf5('0x4f')],function(_0x13011c){var _0x350304={};_0x350304[_0x13011c]={'$like':'%'+_0x2d5598[_0xcaf5('0x4a')][_0xcaf5('0x6f')]+'%'};return _0x350304;})});}_0x310d8e=_[_0xcaf5('0x55')]({},_0x310d8e,_0x2d5598[_0xcaf5('0x57')]);return db[_0xcaf5('0x71')][_0xcaf5('0x22')]({'where':_0x310d8e['where']})[_0xcaf5('0x12')](function(_0xb3e801){_0x2881d4[_0xcaf5('0x22')]=_0xb3e801;if(_0x2d5598['query']['includeAll']){_0x310d8e['include']=[{'all':!![]}];}return db['CannedAnswer']['findAll'](_0x310d8e);})[_0xcaf5('0x12')](function(_0x4ec69a){_0x2881d4[_0xcaf5('0x5b')]=_0x4ec69a;return _0x2881d4;});}})[_0xcaf5('0x12')](respondWithFilteredResult(_0x694e5b,_0x310d8e))[_0xcaf5('0x5c')](handleError(_0x694e5b,null));};exports[_0xcaf5('0x74')]=function(_0x180e8a,_0x46708f){return db[_0xcaf5('0x45')][_0xcaf5('0x60')]({'where':{'id':_0x180e8a[_0xcaf5('0x5e')]['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x46708f,null))[_0xcaf5('0x12')](function(_0x550c7e){if(_0x550c7e){return _0x550c7e[_0xcaf5('0x74')](_0x180e8a['query'][_0xcaf5('0x70')]);}})[_0xcaf5('0x12')](respondWithStatusCode(_0x46708f,null))[_0xcaf5('0x5c')](handleError(_0x46708f,null));};exports[_0xcaf5('0x6c')]=function(_0x54df9d,_0x5b9d63){var _0x119efe={'name':_0x54df9d[_0xcaf5('0x61')][_0xcaf5('0x2a')],'key':_0x54df9d[_0xcaf5('0x61')]['key'],'provider':_0x54df9d[_0xcaf5('0x61')]['provider']==='custom'?null:_0x54df9d['body']['provider'],'email':_0x54df9d[_0xcaf5('0x61')]['email'],'ListId':_0x54df9d[_0xcaf5('0x61')]['ListId'],'active':!_[_0xcaf5('0x75')](_0x54df9d[_0xcaf5('0x61')][_0xcaf5('0x76')])?_0x54df9d[_0xcaf5('0x61')][_0xcaf5('0x76')]:!![],'description':_0x54df9d[_0xcaf5('0x61')][_0xcaf5('0x77')]||null};var _0x5bf077=getAuthenticationOptions(_0x119efe[_0xcaf5('0x62')],_0x54df9d[_0xcaf5('0x61')]);_0x119efe[_0xcaf5('0x3f')]=_0x5bf077[_0xcaf5('0x3f')];_0x119efe['Smtp']=_0x5bf077['Smtp'];return db[_0xcaf5('0x45')][_0xcaf5('0x6c')](_0x119efe,{'include':[{'model':db[_0xcaf5('0x42')],'as':'Smtp'},{'model':db['MailServerIn'],'as':'Imap'}]})[_0xcaf5('0x12')](function(_0x540d33){var _0x22b8dd=_0x54df9d['user']['get']({'plain':!![]});if(!_0x22b8dd)throw new Error(_0xcaf5('0x78'));if(_0x22b8dd[_0xcaf5('0x79')]===_0xcaf5('0x35')){var _0x32caac=_0x540d33[_0xcaf5('0x24')]({'plain':!![]});return db[_0xcaf5('0x7a')][_0xcaf5('0x60')]({'where':{'name':'MailAccounts','userProfileId':_0x22b8dd[_0xcaf5('0x7b')]},'raw':!![]})[_0xcaf5('0x12')](function(_0x3b74c8){if(_0x3b74c8&&_0x3b74c8['autoAssociation']===0x0){return db['UserProfileResource'][_0xcaf5('0x6c')]({'name':_0x32caac[_0xcaf5('0x2a')],'resourceId':_0x32caac['id'],'type':_0x3b74c8[_0xcaf5('0x2a')],'sectionId':_0x3b74c8['id']},{})[_0xcaf5('0x12')](function(){return _0x540d33;});}else{return _0x540d33;}})[_0xcaf5('0x5c')](function(_0x47858c){logger[_0xcaf5('0x18')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x47858c);throw _0x47858c;});}return _0x540d33;})[_0xcaf5('0x12')](respondWithResult(_0x5b9d63,0xc9))['catch'](handleError(_0x5b9d63,null));};exports[_0xcaf5('0x7c')]=function(_0x29c198,_0x25cd48){return db['MailAccount'][_0xcaf5('0x6d')]({'where':{'id':_0x29c198[_0xcaf5('0x5e')]['id']}})['then'](handleEntityNotFound(_0x25cd48,null))[_0xcaf5('0x12')](function(_0x304830){if(_0x304830){return _0x304830[_0xcaf5('0x7c')]();}return null;})[_0xcaf5('0x12')](respondWithResult(_0x25cd48,null))[_0xcaf5('0x5c')](handleError(_0x25cd48,null));};exports[_0xcaf5('0x7d')]=function(_0x1f7ab1,_0x557fad){if(_0x1f7ab1[_0xcaf5('0x61')]['id']){delete _0x1f7ab1[_0xcaf5('0x61')]['id'];}return db[_0xcaf5('0x45')][_0xcaf5('0x60')]({'where':{'id':_0x1f7ab1[_0xcaf5('0x5e')]['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x557fad,null))[_0xcaf5('0x12')](function(_0x35eb8a){if(_0x35eb8a){_0x1f7ab1[_0xcaf5('0x61')][_0xcaf5('0x6a')]=_0x35eb8a['id'];return db['MailServerIn'][_0xcaf5('0x6c')](_0x1f7ab1['body']);}})[_0xcaf5('0x12')](respondWithResult(_0x557fad,null))['catch'](handleError(_0x557fad,null));};exports[_0xcaf5('0x7e')]=function(_0x34e63f,_0x45baa1){return db[_0xcaf5('0x45')][_0xcaf5('0x6d')]({'where':{'id':_0x34e63f[_0xcaf5('0x5e')]['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x45baa1,null))[_0xcaf5('0x12')](function(_0x5e8b42){if(_0x5e8b42){return _0x5e8b42['setImap'](null);}return null;})[_0xcaf5('0x12')](respondWithStatusCode(_0x45baa1,null))['catch'](handleError(_0x45baa1,null));};exports[_0xcaf5('0x7f')]=function(_0x4591c8,_0x542b12){return db['MailAccount']['findOne']({'where':{'id':_0x4591c8[_0xcaf5('0x5e')]['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x542b12,null))[_0xcaf5('0x12')](function(_0x258bd1){if(_0x258bd1){return _0x258bd1[_0xcaf5('0x7f')]();}return null;})[_0xcaf5('0x12')](respondWithResult(_0x542b12,null))['catch'](handleError(_0x542b12,null));};exports[_0xcaf5('0x80')]=function(_0xfe16ac,_0x57ba24){if(_0xfe16ac['body']['id']){delete _0xfe16ac[_0xcaf5('0x61')]['id'];}return db['MailAccount']['find']({'where':{'id':_0xfe16ac['params']['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x57ba24,null))[_0xcaf5('0x12')](function(_0x5b9d0b){if(_0x5b9d0b){_0xfe16ac[_0xcaf5('0x61')][_0xcaf5('0x6a')]=_0x5b9d0b['id'];return db['MailServerOut'][_0xcaf5('0x6c')](_0xfe16ac[_0xcaf5('0x61')]);}})[_0xcaf5('0x12')](respondWithResult(_0x57ba24,null))[_0xcaf5('0x5c')](handleError(_0x57ba24,null));};exports[_0xcaf5('0x81')]=function(_0x242813,_0x3c4da2){return db[_0xcaf5('0x45')][_0xcaf5('0x6d')]({'where':{'id':_0x242813[_0xcaf5('0x5e')]['id']}})['then'](handleEntityNotFound(_0x3c4da2,null))[_0xcaf5('0x12')](function(_0x15fff8){if(_0x15fff8){return _0x15fff8[_0xcaf5('0x82')](null);}return null;})[_0xcaf5('0x12')](respondWithStatusCode(_0x3c4da2,null))[_0xcaf5('0x5c')](handleError(_0x3c4da2,null));};exports[_0xcaf5('0x83')]=function(_0x5afa40,_0x465dcd){return db[_0xcaf5('0x84')]['find']({'where':{'id':_0x5afa40['params']['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x465dcd,null))['then'](function(_0x336258){if(_0x336258){return _0x336258[_0xcaf5('0x83')](_0x5afa40['body'][_0xcaf5('0x70')],_[_0xcaf5('0x85')](_0x5afa40[_0xcaf5('0x61')],[_0xcaf5('0x70'),'id'])||{});}})[_0xcaf5('0x12')](respondWithResult(_0x465dcd,null))[_0xcaf5('0x5c')](handleError(_0x465dcd,null));};exports[_0xcaf5('0x86')]=function(_0x1c71cc,_0x38f9c0){var _0x1a89ad={'raw':![],'where':{}};var _0x31b2fb={};var _0xba5d07={'count':0x0,'rows':[]};return db[_0xcaf5('0x45')][_0xcaf5('0x6d')]({'where':{'id':_0x1c71cc[_0xcaf5('0x5e')]['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x38f9c0,null))[_0xcaf5('0x12')](function(_0x65e2ef){if(_0x65e2ef){_0x31b2fb[_0xcaf5('0x49')]=_[_0xcaf5('0x4b')](db[_0xcaf5('0x84')][_0xcaf5('0x46')]);_0x31b2fb[_0xcaf5('0x4a')]=_[_0xcaf5('0x4b')](_0x1c71cc[_0xcaf5('0x4a')]);_0x31b2fb[_0xcaf5('0x4c')]=_['intersection'](_0x31b2fb[_0xcaf5('0x49')],_0x31b2fb[_0xcaf5('0x4a')]);_0x1a89ad[_0xcaf5('0x4f')]=_[_0xcaf5('0x4d')](_0x31b2fb['model'],qs[_0xcaf5('0x4e')](_0x1c71cc[_0xcaf5('0x4a')][_0xcaf5('0x4e')]));_0x1a89ad['attributes']=_0x1a89ad['attributes'][_0xcaf5('0x50')]?_0x1a89ad['attributes']:_0x31b2fb[_0xcaf5('0x49')];if(!_0x1c71cc[_0xcaf5('0x4a')][_0xcaf5('0x6e')]('nolimit')){_0x1a89ad[_0xcaf5('0x20')]=qs[_0xcaf5('0x20')](_0x1c71cc[_0xcaf5('0x4a')]['limit']);_0x1a89ad[_0xcaf5('0x1f')]=qs[_0xcaf5('0x1f')](_0x1c71cc['query'][_0xcaf5('0x1f')]);}_0x1a89ad[_0xcaf5('0x52')]=qs[_0xcaf5('0x53')](_0x1c71cc[_0xcaf5('0x4a')][_0xcaf5('0x53')]);_0x1a89ad['where']=qs[_0xcaf5('0x4c')](_['pick'](_0x1c71cc[_0xcaf5('0x4a')],_0x31b2fb[_0xcaf5('0x4c')]));_0x1a89ad['where'][_0xcaf5('0x6a')]=_0x65e2ef['id'];if(_0x1c71cc[_0xcaf5('0x4a')][_0xcaf5('0x6f')]){_0x1a89ad[_0xcaf5('0x54')]=_[_0xcaf5('0x55')](_0x1a89ad[_0xcaf5('0x54')],{'$or':_[_0xcaf5('0x44')](_0x1a89ad['attributes'],function(_0x3abd16){var _0xa4c58c={};_0xa4c58c[_0x3abd16]={'$like':'%'+_0x1c71cc[_0xcaf5('0x4a')][_0xcaf5('0x6f')]+'%'};return _0xa4c58c;})});}_0x1a89ad=_['merge']({},_0x1a89ad,_0x1c71cc[_0xcaf5('0x57')]);return db[_0xcaf5('0x84')][_0xcaf5('0x22')]({'where':_0x1a89ad[_0xcaf5('0x54')]})['then'](function(_0x362c15){_0xba5d07[_0xcaf5('0x22')]=_0x362c15;if(_0x1c71cc[_0xcaf5('0x4a')][_0xcaf5('0x58')]){_0x1a89ad[_0xcaf5('0x59')]=[{'model':db[_0xcaf5('0x87')],'as':_0xcaf5('0x88'),'required':![]},{'model':db[_0xcaf5('0x89')],'as':_0xcaf5('0x8a'),'attributes':[_0xcaf5('0x2a'),'fullname',_0xcaf5('0x8b')],'required':![]},{'model':db['Tag'],'as':_0xcaf5('0x8c'),'attributes':['id','name',_0xcaf5('0x8d')],'where':_0x1c71cc[_0xcaf5('0x4a')][_0xcaf5('0x8e')]?{'id':_0x1c71cc['query']['tag']}:undefined,'required':_0x1c71cc[_0xcaf5('0x4a')][_0xcaf5('0x8e')]?!![]:![]}];}return db[_0xcaf5('0x84')][_0xcaf5('0x5a')](_0x1a89ad);})[_0xcaf5('0x12')](function(_0x320561){_0xba5d07[_0xcaf5('0x5b')]=_0x320561;return _0xba5d07;});}})[_0xcaf5('0x12')](respondWithFilteredResult(_0x38f9c0,_0x1a89ad))['catch'](handleError(_0x38f9c0,null));};exports['addApplications']=function addApplications(_0x4a8768,_0x3e9afa){var _0x4d8d14=_0x4a8768[_0xcaf5('0x5e')]['id'];var _0xbc3521=_0x4a8768['body'];var _0x1f5a40=0xc8;var _0x35920c=null;return db['sequelize'][_0xcaf5('0x8f')]({'isolationLevel':db[_0xcaf5('0x90')]['Transaction'][_0xcaf5('0x91')][_0xcaf5('0x92')]},function(_0xc7ee62){return db[_0xcaf5('0x45')][_0xcaf5('0x6d')]({'where':{'id':_0x4d8d14},'transaction':_0xc7ee62})[_0xcaf5('0x12')](function(_0x579f34){if(_0x579f34){return db[_0xcaf5('0x93')]['destroy']({'where':{'MailAccountId':_0x4d8d14},'transaction':_0xc7ee62})[_0xcaf5('0x12')](function(){var _0x1ae7d0=_[_0xcaf5('0x44')](_0xbc3521,function(_0x17abaf){_0x17abaf[_0xcaf5('0x6a')]=_0x4d8d14;return _0x17abaf;});return db[_0xcaf5('0x93')][_0xcaf5('0x94')](_0x1ae7d0,{'transaction':_0xc7ee62});});}else{_0x1f5a40=0x194;_0x35920c=[];}});})[_0xcaf5('0x12')](function(){if(_0x1f5a40!==0x194){return db['MailApplication'][_0xcaf5('0x95')]({'where':{'MailAccountId':_0x4d8d14},'order':_0xcaf5('0x96')})['then'](function(_0x1d64a3){_0x35920c=_0x1d64a3;});}})[_0xcaf5('0x5c')](function(_0x1174b6){_0x1f5a40=0x1f4;logger[_0xcaf5('0x18')](_0x1174b6[_0xcaf5('0x29')]);if(_0x1174b6[_0xcaf5('0x2a')]){delete _0x1174b6[_0xcaf5('0x2a')];}_0x35920c=_0x1174b6;})[_0xcaf5('0x97')](function(){if(_0x35920c===null){_0x3e9afa['sendStatus'](_0x1f5a40);}else{if(_0x1f5a40===0x1f4){_0x3e9afa[_0xcaf5('0x1d')](_0x1f5a40)[_0xcaf5('0x98')](_0x35920c);}else{_0x3e9afa[_0xcaf5('0x1d')](_0x1f5a40)['json'](_0x35920c);}}});};exports[_0xcaf5('0x99')]=function(_0x43c1a3,_0x12dd3c){var _0x482ab9={};var _0x402a3e={};var _0x6cb512;var _0x2cc9a9;return db[_0xcaf5('0x45')]['findOne']({'where':{'id':_0x43c1a3[_0xcaf5('0x5e')]['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x12dd3c,null))[_0xcaf5('0x12')](function(_0x18fba7){if(_0x18fba7){_0x6cb512=_0x18fba7;_0x402a3e['model']=_[_0xcaf5('0x4b')](db[_0xcaf5('0x93')][_0xcaf5('0x46')]);_0x402a3e[_0xcaf5('0x4a')]=_[_0xcaf5('0x4b')](_0x43c1a3['query']);_0x402a3e[_0xcaf5('0x4c')]=_[_0xcaf5('0x4d')](_0x402a3e['model'],_0x402a3e[_0xcaf5('0x4a')]);_0x482ab9[_0xcaf5('0x4f')]=_['intersection'](_0x402a3e[_0xcaf5('0x49')],qs[_0xcaf5('0x4e')](_0x43c1a3[_0xcaf5('0x4a')][_0xcaf5('0x4e')]));_0x482ab9[_0xcaf5('0x4f')]=_0x482ab9['attributes']['length']?_0x482ab9['attributes']:_0x402a3e[_0xcaf5('0x49')];_0x482ab9[_0xcaf5('0x52')]=qs[_0xcaf5('0x53')](_0x43c1a3[_0xcaf5('0x4a')][_0xcaf5('0x53')]);_0x482ab9[_0xcaf5('0x54')]=qs[_0xcaf5('0x4c')](_[_0xcaf5('0x73')](_0x43c1a3[_0xcaf5('0x4a')],_0x402a3e[_0xcaf5('0x4c')]));if(_0x43c1a3[_0xcaf5('0x4a')][_0xcaf5('0x6f')]){_0x482ab9[_0xcaf5('0x54')]=_[_0xcaf5('0x55')](_0x482ab9[_0xcaf5('0x54')],{'$or':_['map'](_0x482ab9[_0xcaf5('0x4f')],function(_0x43028d){var _0x7b04ee={};_0x7b04ee[_0x43028d]={'$like':'%'+_0x43c1a3[_0xcaf5('0x4a')][_0xcaf5('0x6f')]+'%'};return _0x7b04ee;})});}_0x482ab9=_[_0xcaf5('0x55')]({},_0x482ab9,_0x43c1a3[_0xcaf5('0x57')]);return _0x6cb512['getApplications'](_0x482ab9);}})['then'](function(_0xbf3a13){if(_0xbf3a13){_0x2cc9a9=_0xbf3a13[_0xcaf5('0x50')];if(!_0x43c1a3['query'][_0xcaf5('0x6e')](_0xcaf5('0x51'))){_0x482ab9['limit']=qs[_0xcaf5('0x20')](_0x43c1a3['query'][_0xcaf5('0x20')]);_0x482ab9['offset']=qs[_0xcaf5('0x1f')](_0x43c1a3['query']['offset']);}return _0x6cb512[_0xcaf5('0x99')](_0x482ab9);}})['then'](function(_0x3b3b2c){if(_0x3b3b2c){return _0x3b3b2c?{'count':_0x2cc9a9,'rows':_0x3b3b2c}:null;}})[_0xcaf5('0x12')](respondWithResult(_0x12dd3c,null))['catch'](handleError(_0x12dd3c,null));};exports[_0xcaf5('0x9a')]=function(_0x2d32f7,_0x3ef794){var _0x871757={'raw':!![],'where':{}};var _0x456f72={};var _0xad120f={'count':0x0,'rows':[]};return db[_0xcaf5('0x45')][_0xcaf5('0x6d')]({'where':{'id':_0x2d32f7[_0xcaf5('0x5e')]['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x3ef794,null))[_0xcaf5('0x12')](function(_0x40048c){if(_0x40048c){_0x456f72['model']=_[_0xcaf5('0x4b')](db[_0xcaf5('0x9b')][_0xcaf5('0x46')]);_0x456f72[_0xcaf5('0x4a')]=_[_0xcaf5('0x4b')](_0x2d32f7['query']);_0x456f72[_0xcaf5('0x4c')]=_[_0xcaf5('0x4d')](_0x456f72[_0xcaf5('0x49')],_0x456f72[_0xcaf5('0x4a')]);_0x871757[_0xcaf5('0x4f')]=_['intersection'](_0x456f72[_0xcaf5('0x49')],qs[_0xcaf5('0x4e')](_0x2d32f7[_0xcaf5('0x4a')][_0xcaf5('0x4e')]));_0x871757['attributes']=_0x871757[_0xcaf5('0x4f')]['length']?_0x871757[_0xcaf5('0x4f')]:_0x456f72[_0xcaf5('0x49')];if(!_0x2d32f7[_0xcaf5('0x4a')][_0xcaf5('0x6e')]('nolimit')){_0x871757[_0xcaf5('0x20')]=qs['limit'](_0x2d32f7['query'][_0xcaf5('0x20')]);_0x871757[_0xcaf5('0x1f')]=qs['offset'](_0x2d32f7[_0xcaf5('0x4a')][_0xcaf5('0x1f')]);}_0x871757[_0xcaf5('0x52')]=qs[_0xcaf5('0x53')](_0x2d32f7[_0xcaf5('0x4a')]['sort']);_0x871757[_0xcaf5('0x54')]=qs[_0xcaf5('0x4c')](_['pick'](_0x2d32f7[_0xcaf5('0x4a')],_0x456f72[_0xcaf5('0x4c')]));_0x871757[_0xcaf5('0x54')][_0xcaf5('0x6a')]=_0x40048c['id'];if(_0x2d32f7[_0xcaf5('0x4a')]['filter']){_0x871757[_0xcaf5('0x54')]=_[_0xcaf5('0x55')](_0x871757[_0xcaf5('0x54')],{'$or':_[_0xcaf5('0x44')](_0x871757['attributes'],function(_0x484949){var _0x51d63e={};_0x51d63e[_0x484949]={'$like':'%'+_0x2d32f7[_0xcaf5('0x4a')][_0xcaf5('0x6f')]+'%'};return _0x51d63e;})});}if(_0x2d32f7[_0xcaf5('0x4a')][_0xcaf5('0x9c')]){var _0x25c1d6=_0x2d32f7['query'][_0xcaf5('0x9c')]['split'](',');var _0x91e6af={};_0x91e6af[_0x25c1d6[0x0]]={'$gte':moment(_0x25c1d6[0x1])[_0xcaf5('0x9d')](_0xcaf5('0x9e'))};_0x871757[_0xcaf5('0x54')]=_[_0xcaf5('0x55')](_0x871757[_0xcaf5('0x54')],_0x91e6af);}_0x871757=_[_0xcaf5('0x55')]({},_0x871757,_0x2d32f7[_0xcaf5('0x57')]);return db[_0xcaf5('0x9b')][_0xcaf5('0x22')]({'where':_0x871757['where']})['then'](function(_0x23bc86){_0xad120f['count']=_0x23bc86;if(_0x2d32f7[_0xcaf5('0x4a')][_0xcaf5('0x58')]){_0x871757[_0xcaf5('0x59')]=[{'all':!![]}];}return db[_0xcaf5('0x9b')]['findAll'](_0x871757);})[_0xcaf5('0x12')](function(_0x246ebe){if(_0x2d32f7['query'][_0xcaf5('0x9f')]===_0xcaf5('0xa0')){for(var _0x4cfa45=0x0;_0x4cfa45<_0x246ebe[_0xcaf5('0x50')];_0x4cfa45++){_0x246ebe[_0x4cfa45][_0xcaf5('0x61')]=juice(_0x246ebe[_0x4cfa45]['body']);}}_0xad120f[_0xcaf5('0x5b')]=_0x246ebe;return _0xad120f;});}})[_0xcaf5('0x12')](respondWithFilteredResult(_0x3ef794,_0x871757))[_0xcaf5('0x5c')](handleError(_0x3ef794,null));};exports[_0xcaf5('0x98')]=function(_0x14e1c9,_0x3ee77b){var _0x56ee06,_0x34dcbc={},_0xb8ee59;if(_0x14e1c9[_0xcaf5('0x61')]['to']){_0xb8ee59=_0x14e1c9['body']['to']['split'](',')[0x0];}return db[_0xcaf5('0x45')][_0xcaf5('0x60')]({'where':{'id':_0x14e1c9[_0xcaf5('0x5e')]['id']},'include':[{'model':db[_0xcaf5('0xa1')],'as':_0xcaf5('0xa2'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'email':_0xb8ee59},'limit':0x1,'order':[[_0xcaf5('0xa3'),_0xcaf5('0xa4')]]}]},{'model':db['MailServerOut'],'as':'Smtp','raw':!![],'include':[{'model':db[_0xcaf5('0xa5')],'as':_0xcaf5('0xa5'),'raw':!![]}]}]})[_0xcaf5('0x12')](handleEntityNotFound(_0x3ee77b,null))[_0xcaf5('0x12')](function(_0x28d2ad){if(!_0x28d2ad)return;_0x56ee06=_0x28d2ad;if(!_0x28d2ad['Smtp'])throw new Error(_0xcaf5('0xa6'));if(_['isNil'](_0x14e1c9['body'][_0xcaf5('0xa7')])){_0x14e1c9['body'][_0xcaf5('0xa7')]=util[_0xcaf5('0x9d')](_0xcaf5('0xa8'),_0x28d2ad[_0xcaf5('0x2a')],_0x28d2ad[_0xcaf5('0xa9')]||_0x28d2ad[_0xcaf5('0x40')][_0xcaf5('0x35')]);}if(_0x14e1c9[_0xcaf5('0x61')][_0xcaf5('0xaa')]&&_0x14e1c9['body'][_0xcaf5('0xaa')][_0xcaf5('0x50')]){for(var _0x6e1f95=0x0;_0x6e1f95<_0x14e1c9[_0xcaf5('0x61')][_0xcaf5('0xaa')][_0xcaf5('0x50')];_0x6e1f95+=0x1){_0x14e1c9['body'][_0xcaf5('0xaa')][_0x6e1f95]={'filename':_0x14e1c9[_0xcaf5('0x61')][_0xcaf5('0xaa')][_0x6e1f95][_0xcaf5('0x2a')],'path':path[_0xcaf5('0xab')](config['root'],_0xcaf5('0xac'),_0x14e1c9[_0xcaf5('0x61')]['attachments'][_0x6e1f95][_0xcaf5('0xad')])};}}var _0x3a0dea=_0x28d2ad[_0xcaf5('0xae')]();return respondWithRpcPromise(_0xcaf5('0xaf'),_0xcaf5('0xb0'),{'account':_0x3a0dea,'message':_0x14e1c9[_0xcaf5('0x61')]});})[_0xcaf5('0x12')](function(_0x4a36d3){if(!_0x4a36d3)return;_0x34dcbc=_0x4a36d3;if(!_0x56ee06[_0xcaf5('0xa2')])throw new Error(_0xcaf5('0xb1'));if(_0x56ee06[_0xcaf5('0xa2')][_0xcaf5('0xb2')][_0xcaf5('0x50')])return _0x56ee06[_0xcaf5('0xa2')][_0xcaf5('0xb2')][0x0];return db[_0xcaf5('0x87')]['create'](_['defaults'](_0x14e1c9[_0xcaf5('0x61')],{'firstName':_0x14e1c9[_0xcaf5('0x61')]['to'],'email':_0x14e1c9[_0xcaf5('0x61')]['to'],'phone':_0x14e1c9[_0xcaf5('0x61')]['to'],'ListId':_0x56ee06[_0xcaf5('0xb3')]}));})[_0xcaf5('0x12')](function(_0x3afbf0){if(!_0x3afbf0)return;var _0x4fb4c7={'UserId':_0x14e1c9[_0xcaf5('0x35')]['id'],'ContactId':_0x3afbf0['id'],'MailAccountId':_0x56ee06['id'],'inReplyTo':_0x34dcbc['messageId'],'to':_0x14e1c9['body'][_0xcaf5('0xa7')],'cc':_0x14e1c9[_0xcaf5('0x61')]['cc'],'subject':_0x14e1c9[_0xcaf5('0x61')][_0xcaf5('0xb4')],'attach':_0x14e1c9[_0xcaf5('0x61')][_0xcaf5('0xb5')],'firstMsgDirection':_0xcaf5('0xb6'),'lastMsgAt':moment()[_0xcaf5('0x9d')](_0xcaf5('0x9e')),'lastMsgDirection':'out','Messages':[_['merge'](_0x14e1c9[_0xcaf5('0x61')],{'messageId':_0x34dcbc[_0xcaf5('0xb7')],'sentAt':moment()[_0xcaf5('0x9d')](_0xcaf5('0x9e')),'read':!![],'MailAccountId':_0x56ee06['id'],'UserId':_0x14e1c9[_0xcaf5('0x35')]['id'],'ContactId':_0x3afbf0['id']})]};if(_0x14e1c9[_0xcaf5('0x61')]['Interaction']){_0x4fb4c7=_[_0xcaf5('0x55')](_0x4fb4c7,_0x14e1c9[_0xcaf5('0x61')]['Interaction']);}return db[_0xcaf5('0x84')]['create'](_0x4fb4c7,{'include':[{'model':db[_0xcaf5('0x9b')],'as':_0xcaf5('0xb8')}]});})[_0xcaf5('0x12')](respondWithResult(_0x3ee77b,null))[_0xcaf5('0x5c')](handleError(_0x3ee77b,null));};exports[_0xcaf5('0xb9')]=function(_0x13a4b1,_0x531a26){return db[_0xcaf5('0x45')][_0xcaf5('0x60')]({'where':{'id':_0x13a4b1['params']['id']},'include':[{'model':db[_0xcaf5('0x42')],'as':_0xcaf5('0x40'),'raw':!![],'include':[{'model':db[_0xcaf5('0xa5')],'as':_0xcaf5('0xa5'),'raw':!![]}]}]})[_0xcaf5('0x12')](handleEntityNotFound(_0x531a26,null))[_0xcaf5('0x12')](function(_0x4f86ec){if(!_0x4f86ec[_0xcaf5('0x40')])return;var _0x2d196a=_0x4f86ec[_0xcaf5('0xae')]();return respondWithRpcPromise(_0xcaf5('0xba'),_0xcaf5('0xb9'),{'account':_0x2d196a});})[_0xcaf5('0x12')](respondWithResult(_0x531a26,null))[_0xcaf5('0x5c')](handleError(_0x531a26,null));};exports[_0xcaf5('0x27')]=function(_0x4c6aaf,_0x1e8c7c){return db[_0xcaf5('0x45')][_0xcaf5('0x60')]({'where':{'id':_0x4c6aaf[_0xcaf5('0x5e')]['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x1e8c7c,null))[_0xcaf5('0x12')](function(_0x41658a){if(_0x41658a&&_0x41658a[_0xcaf5('0x3d')]){throw new db[(_0xcaf5('0xbb'))]['ValidationError'](_0xcaf5('0xbc'));}return _0x41658a;})['then'](removeEntity(_0x1e8c7c,null))[_0xcaf5('0x5c')](handleError(_0x1e8c7c,null));};exports[_0xcaf5('0xbd')]=function(_0xb8962f,_0x142fa9){return db[_0xcaf5('0x45')][_0xcaf5('0x60')]({'where':{'id':_0xb8962f[_0xcaf5('0x5e')]['id']}})['then'](handleEntityNotFound(_0x142fa9,null))['then'](function(_0x1205dd){if(_0x1205dd){return _0x1205dd['addAgents'](_0xb8962f[_0xcaf5('0x61')][_0xcaf5('0x70')],_[_0xcaf5('0x85')](_0xb8962f[_0xcaf5('0x61')],[_0xcaf5('0x70'),'id'])||{})['spread'](function(_0x53aca4){for(var _0x10349a=0x0;_0x10349a<_0xb8962f[_0xcaf5('0x61')][_0xcaf5('0x70')]['length'];_0x10349a+=0x1){socket[_0xcaf5('0xbe')]('userMailAccount:save',{'UserId':Number(_0xb8962f['body'][_0xcaf5('0x70')][_0x10349a]),'MailAccountId':Number(_0xb8962f[_0xcaf5('0x5e')]['id'])});}return _0x53aca4;});}})['then'](respondWithResult(_0x142fa9,null))[_0xcaf5('0x5c')](handleError(_0x142fa9,null));};exports[_0xcaf5('0xbf')]=function(_0x4ffbc2,_0x4b137c){return db[_0xcaf5('0x45')][_0xcaf5('0x60')]({'where':{'id':_0x4ffbc2[_0xcaf5('0x5e')]['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x4b137c,null))['then'](function(_0x4e48d2){if(_0x4e48d2){return _0x4e48d2[_0xcaf5('0xbf')](_0x4ffbc2[_0xcaf5('0x4a')][_0xcaf5('0x70')])[_0xcaf5('0x12')](function(){if(_[_0xcaf5('0xc0')](_0x4ffbc2['query'][_0xcaf5('0x70')])){for(var _0x5c906a=0x0;_0x5c906a<_0x4ffbc2[_0xcaf5('0x4a')][_0xcaf5('0x70')][_0xcaf5('0x50')];_0x5c906a+=0x1){socket[_0xcaf5('0xbe')]('userMailAccount:remove',{'UserId':Number(_0x4ffbc2[_0xcaf5('0x4a')][_0xcaf5('0x70')][_0x5c906a]),'MailAccountId':Number(_0x4ffbc2[_0xcaf5('0x5e')]['id'])});}}else{socket[_0xcaf5('0xbe')]('userMailAccount:remove',{'UserId':Number(_0x4ffbc2['query'][_0xcaf5('0x70')]),'MailAccountId':Number(_0x4ffbc2['params']['id'])});}});}})[_0xcaf5('0x12')](respondWithStatusCode(_0x4b137c,null))[_0xcaf5('0x5c')](handleError(_0x4b137c,null));};exports[_0xcaf5('0xc1')]=function(_0x2b1921,_0x2c03a5){var _0x2d3a3b={};var _0x3a7d17={};var _0x194ef5;var _0x3483e3;return db[_0xcaf5('0x45')][_0xcaf5('0x6d')]({'where':{'id':_0x2b1921[_0xcaf5('0x5e')]['id']}})[_0xcaf5('0x12')](handleEntityNotFound(_0x2c03a5,null))[_0xcaf5('0x12')](function(_0x35435b){if(_0x35435b){_0x194ef5=_0x35435b;_0x3a7d17[_0xcaf5('0x49')]=_[_0xcaf5('0x4b')](db[_0xcaf5('0x89')][_0xcaf5('0x46')]);_0x3a7d17[_0xcaf5('0x4a')]=_[_0xcaf5('0x4b')](_0x2b1921[_0xcaf5('0x4a')]);_0x3a7d17['filters']=_[_0xcaf5('0x4d')](_0x3a7d17['model'],_0x3a7d17['query']);_0x2d3a3b['attributes']=_[_0xcaf5('0x4d')](_0x3a7d17['model'],qs[_0xcaf5('0x4e')](_0x2b1921[_0xcaf5('0x4a')][_0xcaf5('0x4e')]));_0x2d3a3b[_0xcaf5('0x4f')]=_0x2d3a3b[_0xcaf5('0x4f')][_0xcaf5('0x50')]?_0x2d3a3b[_0xcaf5('0x4f')]:_0x3a7d17['model'];_0x2d3a3b[_0xcaf5('0x52')]=qs[_0xcaf5('0x53')](_0x2b1921['query'][_0xcaf5('0x53')]);_0x2d3a3b[_0xcaf5('0x54')]=qs[_0xcaf5('0x4c')](_[_0xcaf5('0x73')](_0x2b1921[_0xcaf5('0x4a')],_0x3a7d17[_0xcaf5('0x4c')]));if(_0x2b1921[_0xcaf5('0x4a')][_0xcaf5('0x6f')]){_0x2d3a3b['where']=_['merge'](_0x2d3a3b[_0xcaf5('0x54')],{'$or':_['map'](_0x2d3a3b['attributes'],function(_0x539171){var _0x5c6ed3={};_0x5c6ed3[_0x539171]={'$like':'%'+_0x2b1921[_0xcaf5('0x4a')][_0xcaf5('0x6f')]+'%'};return _0x5c6ed3;})});}_0x2d3a3b=_[_0xcaf5('0x55')]({},_0x2d3a3b,_0x2b1921['options']);return _0x194ef5[_0xcaf5('0xc1')](_0x2d3a3b);}})[_0xcaf5('0x12')](function(_0x4dea48){if(_0x4dea48){_0x3483e3=_0x4dea48[_0xcaf5('0x50')];if(!_0x2b1921[_0xcaf5('0x4a')][_0xcaf5('0x6e')](_0xcaf5('0x51'))){_0x2d3a3b[_0xcaf5('0x20')]=qs[_0xcaf5('0x20')](_0x2b1921[_0xcaf5('0x4a')][_0xcaf5('0x20')]);_0x2d3a3b[_0xcaf5('0x1f')]=qs[_0xcaf5('0x1f')](_0x2b1921[_0xcaf5('0x4a')][_0xcaf5('0x1f')]);}return _0x194ef5[_0xcaf5('0xc1')](_0x2d3a3b);}})[_0xcaf5('0x12')](function(_0x30339b){if(_0x30339b){return _0x30339b?{'count':_0x3483e3,'rows':_0x30339b}:null;}})[_0xcaf5('0x12')](respondWithResult(_0x2c03a5,null))[_0xcaf5('0x5c')](handleError(_0x2c03a5,null));}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.events.js b/server/api/mailAccount/mailAccount.events.js index 5b3c7d2..4e076fa 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 _0xc051=['exports','events','../../mysqldb','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x1a5fe9,_0x23479b){var _0x200223=function(_0x6237b){while(--_0x6237b){_0x1a5fe9['push'](_0x1a5fe9['shift']());}};_0x200223(++_0x23479b);}(_0xc051,0xb5));var _0x1c05=function(_0x353a14,_0x2fd1ee){_0x353a14=_0x353a14-0x0;var _0x4b9a6b=_0xc051[_0x353a14];return _0x4b9a6b;};'use strict';var EventEmitter=require(_0x1c05('0x0'));var MailAccount=require(_0x1c05('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x1c05('0x2'),'afterUpdate':_0x1c05('0x3'),'afterDestroy':_0x1c05('0x4')};function emitEvent(_0xd5f638){return function(_0x5d181d,_0x352877,_0x1493c6){MailAccountEvents[_0x1c05('0x5')](_0xd5f638+':'+_0x5d181d['id'],_0x5d181d);MailAccountEvents[_0x1c05('0x5')](_0xd5f638,_0x5d181d);_0x1493c6(null);};}for(var e in events){if(events[_0x1c05('0x6')](e)){var event=events[e];MailAccount[_0x1c05('0x7')](e,emitEvent(event));}}module[_0x1c05('0x8')]=MailAccountEvents; \ No newline at end of file +var _0x25a5=['exports','events','../../mysqldb','setMaxListeners','remove','hook'];(function(_0x500a04,_0x645161){var _0x444f62=function(_0x30d1b0){while(--_0x30d1b0){_0x500a04['push'](_0x500a04['shift']());}};_0x444f62(++_0x645161);}(_0x25a5,0x1e1));var _0x525a=function(_0x3574b8,_0x9c75db){_0x3574b8=_0x3574b8-0x0;var _0x5891b2=_0x25a5[_0x3574b8];return _0x5891b2;};'use strict';var EventEmitter=require(_0x525a('0x0'));var MailAccount=require(_0x525a('0x1'))['db']['MailAccount'];var MailAccountEvents=new EventEmitter();MailAccountEvents[_0x525a('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x525a('0x3')};function emitEvent(_0x5d59f6){return function(_0x2f3c90,_0x57588d,_0xd030c4){MailAccountEvents['emit'](_0x5d59f6+':'+_0x2f3c90['id'],_0x2f3c90);MailAccountEvents['emit'](_0x5d59f6,_0x2f3c90);_0xd030c4(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailAccount[_0x525a('0x4')](e,emitEvent(event));}}module[_0x525a('0x5')]=MailAccountEvents; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.model.js b/server/api/mailAccount/mailAccount.model.js index 59de138..c810dd5 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 _0x8739=['service','host','port','Smtp','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth','OAuth2','user','data5','pass','exports','define','MailAccount','mail_accounts','provider','custom'];(function(_0x3c04fd,_0x477d16){var _0x50e19b=function(_0x1faaff){while(--_0x1faaff){_0x3c04fd['push'](_0x3c04fd['shift']());}};_0x50e19b(++_0x477d16);}(_0x8739,0x13d));var _0x9873=function(_0x15cfef,_0x1d3503){_0x15cfef=_0x15cfef-0x0;var _0x271a5b=_0x8739[_0x15cfef];return _0x271a5b;};'use strict';var attributes=require('./mailAccount.attributes');module[_0x9873('0x0')]=function(_0x19f28f){return _0x19f28f[_0x9873('0x1')](_0x9873('0x2'),attributes,{'tableName':_0x9873('0x3'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x17b651=this;var _0x57232f={'id':_0x17b651['id'],'tls':{'rejectUnauthorized':![]}};if(_0x17b651[_0x9873('0x4')]!==_0x9873('0x5')){_0x57232f[_0x9873('0x6')]=_0x17b651['provider'];}else{_0x57232f['host']=_0x17b651['Smtp'][_0x9873('0x7')];_0x57232f[_0x9873('0x8')]=_0x17b651[_0x9873('0x9')][_0x9873('0x8')];_0x57232f[_0x9873('0xa')]=_0x17b651[_0x9873('0x9')][_0x9873('0xa')];}if(_0x17b651[_0x9873('0x9')]['authentication']){if(_0x17b651[_0x9873('0x9')][_0x9873('0xb')]){if(!_0x17b651[_0x9873('0x9')][_0x9873('0xc')])throw new Error(_0x9873('0xd'));_0x57232f[_0x9873('0xe')]={'type':_0x9873('0xf'),'user':_0x17b651[_0x9873('0x9')][_0x9873('0x10')],'accessToken':_0x17b651[_0x9873('0x9')]['CloudProvider'][_0x9873('0x11')]};}else{_0x57232f[_0x9873('0xe')]={'user':_0x17b651[_0x9873('0x9')][_0x9873('0x10')],'pass':_0x17b651[_0x9873('0x9')][_0x9873('0x12')]};}}return _0x57232f;}}});}; \ No newline at end of file +var _0xcf7b=['OAuth2','user','data5','pass','./mailAccount.attributes','define','mail_accounts','provider','custom','host','port','Smtp','secure','modernAuthentication','CloudProvider','Cloud\x20Provider\x20configuration\x20not\x20found','auth'];(function(_0x437246,_0x111296){var _0x1b5227=function(_0x13aa7e){while(--_0x13aa7e){_0x437246['push'](_0x437246['shift']());}};_0x1b5227(++_0x111296);}(_0xcf7b,0x114));var _0xbcf7=function(_0x5d2803,_0xf375bd){_0x5d2803=_0x5d2803-0x0;var _0xdcad2c=_0xcf7b[_0x5d2803];return _0xdcad2c;};'use strict';var attributes=require(_0xbcf7('0x0'));module['exports']=function(_0x1291a7){return _0x1291a7[_0xbcf7('0x1')]('MailAccount',attributes,{'tableName':_0xbcf7('0x2'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getSmtpOptions':function(){var _0x143e58=this;var _0x42fa7c={'id':_0x143e58['id'],'tls':{'rejectUnauthorized':![]}};if(_0x143e58[_0xbcf7('0x3')]!==_0xbcf7('0x4')){_0x42fa7c['service']=_0x143e58['provider'];}else{_0x42fa7c[_0xbcf7('0x5')]=_0x143e58['Smtp'][_0xbcf7('0x5')];_0x42fa7c[_0xbcf7('0x6')]=_0x143e58[_0xbcf7('0x7')]['port'];_0x42fa7c[_0xbcf7('0x8')]=_0x143e58[_0xbcf7('0x7')][_0xbcf7('0x8')];}if(_0x143e58[_0xbcf7('0x7')]['authentication']){if(_0x143e58[_0xbcf7('0x7')][_0xbcf7('0x9')]){if(!_0x143e58[_0xbcf7('0x7')][_0xbcf7('0xa')])throw new Error(_0xbcf7('0xb'));_0x42fa7c[_0xbcf7('0xc')]={'type':_0xbcf7('0xd'),'user':_0x143e58['Smtp'][_0xbcf7('0xe')],'accessToken':_0x143e58[_0xbcf7('0x7')][_0xbcf7('0xa')][_0xbcf7('0xf')]};}else{_0x42fa7c[_0xbcf7('0xc')]={'user':_0x143e58[_0xbcf7('0x7')][_0xbcf7('0xe')],'pass':_0x143e58['Smtp'][_0xbcf7('0x10')]};}}return _0x42fa7c;}}});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.rpc.js b/server/api/mailAccount/mailAccount.rpc.js index a5b0880..b5a48f6 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 _0x2ef3=['result','catch','MailAccount','findAll','options','attributes','limit','model','include','map','GetMailAccount','find','raw','smtp','setDataValue','smtpOptions','ShowMailAccount','stringify','NotifyMailAccount','body','mail','difference','keys','CmContact','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','List','Contacts','DESC','MailApplication','Applications','MailServerOut','Smtp','CloudProvider','get','account','omit','getSmtpOptions','applications','list','orderBy','priority','autoclose','push','length','close','*,*,*,*','defaults','create','List\x20not\x20found','messageId','generate','attach','MailInteraction','update','subject','format','YYYY-MM-DD\x20HH:mm:ss','interaction','created','attachments','originTo','ChatWebsiteId','Email','ChatOfflineMessageId','UserId','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','localhost','socket.io-emitter','./mailAccount.socket','register','then','info','MailAccount,\x20%s,\x20%s','debug','request\x20sent','error','message'];(function(_0x6c712d,_0x3ea26d){var _0x192acc=function(_0x45d762){while(--_0x45d762){_0x6c712d['push'](_0x6c712d['shift']());}};_0x192acc(++_0x3ea26d);}(_0x2ef3,0xba));var _0x32ef=function(_0x4ebdf7,_0x7187af){_0x4ebdf7=_0x4ebdf7-0x0;var _0x1b600d=_0x2ef3[_0x4ebdf7];return _0x1b600d;};'use strict';var _=require(_0x32ef('0x0'));var moment=require(_0x32ef('0x1'));var BPromise=require(_0x32ef('0x2'));var rs=require(_0x32ef('0x3'));var Redis=require(_0x32ef('0x4'));var db=require(_0x32ef('0x5'))['db'];var logger=require('../../config/logger')(_0x32ef('0x6'));var config=require(_0x32ef('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x32ef('0x8')][_0x32ef('0x9')]({'port':0x232c});config['redis']=_['defaults'](config[_0x32ef('0xa')],{'host':_0x32ef('0xb'),'port':0x18eb});var socket=require(_0x32ef('0xc'))(new Redis(config[_0x32ef('0xa')]));require(_0x32ef('0xd'))[_0x32ef('0xe')](socket);function respondWithRpcPromise(_0x2484a0,_0x2bbb50,_0x28275c){return new BPromise(function(_0x77df79,_0x56eb42){return client['request'](_0x2484a0,_0x28275c)[_0x32ef('0xf')](function(_0x33281d){logger[_0x32ef('0x10')](_0x32ef('0x11'),_0x2bbb50,'request\x20sent');logger[_0x32ef('0x12')]('MailAccount,\x20%s,\x20%s,\x20%s',_0x2bbb50,_0x32ef('0x13'),JSON['stringify'](_0x33281d));if(_0x33281d[_0x32ef('0x14')]){if(_0x33281d[_0x32ef('0x14')]['code']===0x1f4){logger['error'](_0x32ef('0x11'),_0x2bbb50,_0x33281d['error'][_0x32ef('0x15')]);return _0x56eb42(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}logger[_0x32ef('0x14')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,_0x33281d['error']['message']);return _0x77df79(_0x33281d[_0x32ef('0x14')][_0x32ef('0x15')]);}else{logger[_0x32ef('0x10')]('MailAccount,\x20%s,\x20%s',_0x2bbb50,'request\x20sent');_0x77df79(_0x33281d[_0x32ef('0x16')][_0x32ef('0x15')]);}})[_0x32ef('0x17')](function(_0x57863c){logger[_0x32ef('0x14')](_0x32ef('0x11'),_0x2bbb50,_0x57863c);_0x56eb42(_0x57863c);});});}exports['GetMailAccount']=function(_0x304505){var _0x314ef1=this;return new Promise(function(_0x26aff3,_0x251084){return db[_0x32ef('0x18')][_0x32ef('0x19')]({'raw':_0x304505['options']?_0x304505[_0x32ef('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['where']||null:null,'attributes':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')][_0x32ef('0x1b')]||null:null,'limit':_0x304505['options']?_0x304505['options'][_0x32ef('0x1c')]||null:null,'include':_0x304505[_0x32ef('0x1a')]?_0x304505[_0x32ef('0x1a')]['include']?_['map'](_0x304505[_0x32ef('0x1a')]['include'],function(_0x51a412){return{'model':db[_0x51a412[_0x32ef('0x1d')]],'as':_0x51a412['as'],'attributes':_0x51a412[_0x32ef('0x1b')],'include':_0x51a412[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x51a412[_0x32ef('0x1e')],function(_0x234175){return{'model':db[_0x234175[_0x32ef('0x1d')]],'as':_0x234175['as'],'attributes':_0x234175[_0x32ef('0x1b')],'include':_0x234175[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x234175[_0x32ef('0x1e')],function(_0xba4b3f){return{'model':db[_0xba4b3f['model']],'as':_0xba4b3f['as'],'attributes':_0xba4b3f[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x5a04cd){logger[_0x32ef('0x10')](_0x32ef('0x20'),_0x304505);logger[_0x32ef('0x12')](_0x32ef('0x20'),_0x304505,JSON['stringify'](_0x5a04cd));_0x26aff3(_0x5a04cd);})[_0x32ef('0x17')](function(_0x22bf86){logger[_0x32ef('0x14')](_0x32ef('0x20'),_0x22bf86[_0x32ef('0x15')],_0x304505);_0x251084(_0x314ef1[_0x32ef('0x14')](0x1f4,_0x22bf86[_0x32ef('0x15')]));});});};exports['ShowMailAccount']=function(_0x36ac37){var _0x537214=this;return new Promise(function(_0x38bf73,_0x2b6c6a){return db['MailAccount'][_0x32ef('0x21')]({'raw':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x22')]===undefined?!![]:![]:!![],'where':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options']['where']||null:null,'attributes':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37['options'][_0x32ef('0x1b')]||null:null,'include':_0x36ac37[_0x32ef('0x1a')]?_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x36ac37[_0x32ef('0x1a')]['include'],function(_0x482d3a){return{'model':db[_0x482d3a['model']],'as':_0x482d3a['as'],'attributes':_0x482d3a[_0x32ef('0x1b')],'include':_0x482d3a[_0x32ef('0x1e')]?_[_0x32ef('0x1f')](_0x482d3a['include'],function(_0x4fb402){return{'model':db[_0x4fb402[_0x32ef('0x1d')]],'as':_0x4fb402['as'],'attributes':_0x4fb402[_0x32ef('0x1b')],'include':_0x4fb402[_0x32ef('0x1e')]?_['map'](_0x4fb402['include'],function(_0xcbdec8){return{'model':db[_0xcbdec8[_0x32ef('0x1d')]],'as':_0xcbdec8['as'],'attributes':_0xcbdec8[_0x32ef('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x32ef('0xf')](function(_0x3a7c49){if(_0x36ac37[_0x32ef('0x1a')][_0x32ef('0x23')]===!![])_0x3a7c49[_0x32ef('0x24')](_0x32ef('0x25'),_0x3a7c49['getSmtpOptions']());logger[_0x32ef('0x10')](_0x32ef('0x26'),_0x36ac37);logger[_0x32ef('0x12')]('ShowMailAccount',_0x36ac37,JSON[_0x32ef('0x27')](_0x3a7c49));_0x38bf73(_0x3a7c49);})[_0x32ef('0x17')](function(_0x879e33){logger[_0x32ef('0x14')](_0x32ef('0x26'),_0x879e33[_0x32ef('0x15')],_0x36ac37);_0x2b6c6a(_0x537214[_0x32ef('0x14')](0x1f4,_0x879e33[_0x32ef('0x15')]));});});};exports[_0x32ef('0x28')]=function(_0x57a3c0){var _0xb4db74=this;return new Promise(function(_0x4615b4,_0x48e071){var _0x3cac2e={'body':_0x57a3c0[_0x32ef('0x29')],'channel':_0x32ef('0x2a')};var _0x1733e3=_[_0x32ef('0x2b')](_[_0x32ef('0x2c')](db[_0x32ef('0x2d')]['rawAttributes']),['createdAt',_0x32ef('0x2e'),_0x32ef('0x2f'),_0x32ef('0x30')]);var _0x765c63=![];if(_0x57a3c0['body']['id']){delete _0x57a3c0[_0x32ef('0x29')]['id'];}if(_[_0x32ef('0x31')](_0x57a3c0['body'][_0x32ef('0x32')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x33')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')])||_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x29')]===''){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x32ef('0x34')));}if(_[_0x32ef('0x31')](_0x57a3c0[_0x32ef('0x29')]['mapKey'])){return _0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x1733e3));}if(!_[_0x32ef('0x35')](_0x1733e3,_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')])){return _0x48e071(_0xb4db74['error'](0x1f4,_0x32ef('0x37')+_0x1733e3));}var _0x230ac9={};_0x230ac9[_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x36')]]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x18')]['find']({'where':{'id':_0x57a3c0['account']['id']},'include':[{'model':db[_0x32ef('0x38')],'as':_0x32ef('0x39'),'include':[{'model':db[_0x32ef('0x2d')],'as':_0x32ef('0x3a'),'where':_0x230ac9,'limit':0x1,'order':[[_0x32ef('0x2e'),_0x32ef('0x3b')]]}]},{'model':db[_0x32ef('0x3c')],'as':_0x32ef('0x3d')},{'model':db[_0x32ef('0x3e')],'as':_0x32ef('0x3f'),'include':[{'model':db[_0x32ef('0x40')],'as':_0x32ef('0x40')}]}]})[_0x32ef('0xf')](function(_0x4c2534){if(_0x4c2534&&_0x4c2534[_0x32ef('0x39')]){var _0x12fbd7=_0x4c2534[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x42')]=_[_0x32ef('0x43')](_0x12fbd7,[_0x32ef('0x3d'),_0x32ef('0x39')]);_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x25')]=_0x4c2534[_0x32ef('0x44')]();_0x3cac2e[_0x32ef('0x45')]=_0x12fbd7[_0x32ef('0x3d')];_0x3cac2e[_0x32ef('0x46')]=_0x12fbd7[_0x32ef('0x39')];_0x3cac2e[_0x32ef('0x45')]=_[_0x32ef('0x47')](_0x3cac2e[_0x32ef('0x45')],[_0x32ef('0x48')],['asc']);if(_0x3cac2e['account']&&_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x49')]){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4a')]({'id':0x0,'priority':_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x4b')]+0x1,'app':_0x32ef('0x4c'),'appdata':_0x32ef('0x49'),'interval':_0x32ef('0x4d')});}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x3d')]){delete _0x3cac2e['account'][_0x32ef('0x3d')];}if(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')]){delete _0x3cac2e[_0x32ef('0x42')][_0x32ef('0x39')];}if(_0x12fbd7[_0x32ef('0x39')]['Contacts'][_0x32ef('0x4b')]){return _0x12fbd7[_0x32ef('0x39')][_0x32ef('0x3a')][0x0];}var _0x56b7ce=_[_0x32ef('0x4e')](_0x57a3c0['body'],{'firstName':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')],'ListId':_0x12fbd7['ListId']});_0x56b7ce[_0x57a3c0[_0x32ef('0x29')]['mapKey']]=_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x32')];return db[_0x32ef('0x2d')][_0x32ef('0x4f')](_0x56b7ce);}else{throw new Error(_0x32ef('0x50'));}})[_0x32ef('0xf')](function(_0x42c7f4){_0x3cac2e['contact']=_0x42c7f4;if(_0x42c7f4){if(!_0x57a3c0['body'][_0x32ef('0x15')]['messageId']){_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')]=rs[_0x32ef('0x52')]()+'\x20'+_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x32')];}var _0x316547={'ContactId':_0x42c7f4['id'],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['messageId'],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0['body'][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['subject'],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'lastMsgAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'};return db[_0x32ef('0x54')]['find']({'where':{'closed':![],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id']},'include':[{'model':db['MailMessage'],'as':'Messages','attributes':[_0x32ef('0x51')],'where':{'messageId':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['inReplyTo']}}]})[_0x32ef('0xf')](function(_0x222b24){if(_0x222b24){return[_0x222b24,![]];}return db[_0x32ef('0x54')]['create'](_0x316547)[_0x32ef('0xf')](function(_0x12b7f8){return[_0x12b7f8,!![]];});});}else{throw new Error('Contact\x20not\x20found');}})['spread'](function(_0x2e20dc,_0x3a6697){if(_0x2e20dc){_0x765c63=_0x3a6697;if(!_0x3a6697){return _0x2e20dc[_0x32ef('0x55')]({'inReplyTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x51')],'to':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x32')],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x2e20dc[_0x32ef('0x53')]?_0x2e20dc[_0x32ef('0x53')]:_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x53')],'substatus':null,'substatusAt':moment()[_0x32ef('0x57')](_0x32ef('0x58')),'lastMsgAt':moment()[_0x32ef('0x57')]('YYYY-MM-DD\x20HH:mm:ss'),'lastMsgDirection':'in'});}else{return _0x2e20dc;}}})['then'](function(_0x2125de){_0x3cac2e[_0x32ef('0x59')]=_0x2125de[_0x32ef('0x41')]({'plain':!![]});_0x3cac2e[_0x32ef('0x59')][_0x32ef('0x5a')]=_0x765c63;return db['MailMessage'][_0x32ef('0x4f')]({'body':_0x57a3c0['body'][_0x32ef('0x29')],'MailAccountId':_0x57a3c0[_0x32ef('0x42')]['id'],'MailInteractionId':_0x2125de['id'],'direction':'in','ContactId':_0x3cac2e['contact']['id'],'messageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x51')],'from':_0x57a3c0[_0x32ef('0x29')]['message']['from'],'to':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['to'],'cc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['cc'],'subject':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x56')],'attach':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x53')],'Attachments':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5b')],'originTo':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')][_0x32ef('0x5c')],'originCc':_0x57a3c0[_0x32ef('0x29')]['message']['originCc'],'bcc':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['bcc'],'ChatWebsiteId':_0x57a3c0[_0x32ef('0x29')]['message'][_0x32ef('0x5d')]||null,'originChannel':_0x57a3c0[_0x32ef('0x29')][_0x32ef('0x15')]['originChannel']||_0x32ef('0x5e'),'ChatOfflineMessageId':_0x57a3c0['body'][_0x32ef('0x15')][_0x32ef('0x5f')]||null},{'include':[{'model':db['Attachment'],'as':'Attachments'}]});})[_0x32ef('0xf')](function(_0x5970db){_0x3cac2e[_0x32ef('0x15')]=_0x5970db;if(_0x3cac2e['interaction'][_0x32ef('0x60')]){return db[_0x32ef('0x61')][_0x32ef('0x21')]({'attributes':['id','name'],'where':{'id':_0x3cac2e['interaction']['UserId']}})[_0x32ef('0xf')](function(_0x5e5766){if(_0x5e5766){_0x3cac2e[_0x32ef('0x45')][_0x32ef('0x62')]({'id':0x0,'priority':0x0,'app':_0x32ef('0x63'),'appdata':_0x5e5766[_0x32ef('0x64')]+','+(_0x3cac2e[_0x32ef('0x42')][_0x32ef('0x65')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x32ef('0x66'),'startRouting',_0x3cac2e);});}return respondWithRpcPromise('Start',_0x32ef('0x67'),_0x3cac2e);})['then'](function(_0x145e27){_0x4615b4(_0x145e27);})[_0x32ef('0x17')](function(_0x4d64ec){_0x48e071(_0xb4db74[_0x32ef('0x14')](0x1f4,_0x4d64ec[_0x32ef('0x15')]));});});}; \ No newline at end of file +var _0x187d=['account','List','Contacts','DESC','MailApplication','Applications','MailServerOut','CloudProvider','get','list','applications','orderBy','priority','autoclose','length','List\x20not\x20found','contact','messageId','generate','subject','attach','format','YYYY-MM-DD\x20HH:mm:ss','MailMessage','Messages','inReplyTo','create','Contact\x20not\x20found','update','interaction','created','originTo','originCc','ChatWebsiteId','originChannel','Email','ChatOfflineMessageId','Attachment','User','unshift','agent','name','waitForTheAssignedAgent','Start','startRouting','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./mailAccount.socket','register','request','then','info','MailAccount,\x20%s,\x20%s','request\x20sent','MailAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetMailAccount','MailAccount','options','raw','attributes','include','model','map','debug','ShowMailAccount','find','where','smtp','smtpOptions','getSmtpOptions','NotifyMailAccount','body','mail','difference','keys','CmContact','rawAttributes','updatedAt','CompanyId','ListId','isNil','from','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey'];(function(_0x1bd247,_0x14f195){var _0x54d8d5=function(_0x2aaf14){while(--_0x2aaf14){_0x1bd247['push'](_0x1bd247['shift']());}};_0x54d8d5(++_0x14f195);}(_0x187d,0x93));var _0xd187=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0x187d[_0x47b58b];return _0x46bebe;};'use strict';var _=require(_0xd187('0x0'));var moment=require('moment');var BPromise=require(_0xd187('0x1'));var rs=require(_0xd187('0x2'));var Redis=require(_0xd187('0x3'));var db=require(_0xd187('0x4'))['db'];var logger=require(_0xd187('0x5'))(_0xd187('0x6'));var config=require('../../config/environment');var jayson=require(_0xd187('0x7'));var client=jayson[_0xd187('0x8')]['http']({'port':0x232c});config[_0xd187('0x9')]=_[_0xd187('0xa')](config[_0xd187('0x9')],{'host':_0xd187('0xb'),'port':0x18eb});var socket=require(_0xd187('0xc'))(new Redis(config[_0xd187('0x9')]));require(_0xd187('0xd'))[_0xd187('0xe')](socket);function respondWithRpcPromise(_0x5b480f,_0x342539,_0x42848b){return new BPromise(function(_0x4039f6,_0x473866){return client[_0xd187('0xf')](_0x5b480f,_0x42848b)[_0xd187('0x10')](function(_0x59c194){logger[_0xd187('0x11')](_0xd187('0x12'),_0x342539,_0xd187('0x13'));logger['debug'](_0xd187('0x14'),_0x342539,_0xd187('0x13'),JSON[_0xd187('0x15')](_0x59c194));if(_0x59c194['error']){if(_0x59c194[_0xd187('0x16')][_0xd187('0x17')]===0x1f4){logger[_0xd187('0x16')](_0xd187('0x12'),_0x342539,_0x59c194['error'][_0xd187('0x18')]);return _0x473866(_0x59c194[_0xd187('0x16')][_0xd187('0x18')]);}logger[_0xd187('0x16')]('MailAccount,\x20%s,\x20%s',_0x342539,_0x59c194[_0xd187('0x16')]['message']);return _0x4039f6(_0x59c194['error'][_0xd187('0x18')]);}else{logger['info']('MailAccount,\x20%s,\x20%s',_0x342539,_0xd187('0x13'));_0x4039f6(_0x59c194[_0xd187('0x19')][_0xd187('0x18')]);}})[_0xd187('0x1a')](function(_0x21df74){logger[_0xd187('0x16')](_0xd187('0x12'),_0x342539,_0x21df74);_0x473866(_0x21df74);});});}exports[_0xd187('0x1b')]=function(_0x4f2f88){var _0x46fca3=this;return new Promise(function(_0x170d5c,_0x11b2a1){return db[_0xd187('0x1c')]['findAll']({'raw':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88[_0xd187('0x1d')][_0xd187('0x1e')]===undefined?!![]:![]:!![],'where':_0x4f2f88['options']?_0x4f2f88['options']['where']||null:null,'attributes':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88[_0xd187('0x1d')][_0xd187('0x1f')]||null:null,'limit':_0x4f2f88['options']?_0x4f2f88[_0xd187('0x1d')]['limit']||null:null,'include':_0x4f2f88[_0xd187('0x1d')]?_0x4f2f88['options'][_0xd187('0x20')]?_['map'](_0x4f2f88['options'][_0xd187('0x20')],function(_0x4d992b){return{'model':db[_0x4d992b[_0xd187('0x21')]],'as':_0x4d992b['as'],'attributes':_0x4d992b[_0xd187('0x1f')],'include':_0x4d992b['include']?_['map'](_0x4d992b[_0xd187('0x20')],function(_0xeff822){return{'model':db[_0xeff822[_0xd187('0x21')]],'as':_0xeff822['as'],'attributes':_0xeff822[_0xd187('0x1f')],'include':_0xeff822['include']?_[_0xd187('0x22')](_0xeff822[_0xd187('0x20')],function(_0x5c8e52){return{'model':db[_0x5c8e52[_0xd187('0x21')]],'as':_0x5c8e52['as'],'attributes':_0x5c8e52[_0xd187('0x1f')]};}):[]};}):[]};}):[]:[]})[_0xd187('0x10')](function(_0x4c50a5){logger[_0xd187('0x11')]('GetMailAccount',_0x4f2f88);logger[_0xd187('0x23')](_0xd187('0x1b'),_0x4f2f88,JSON[_0xd187('0x15')](_0x4c50a5));_0x170d5c(_0x4c50a5);})[_0xd187('0x1a')](function(_0x489f2e){logger[_0xd187('0x16')](_0xd187('0x1b'),_0x489f2e['message'],_0x4f2f88);_0x11b2a1(_0x46fca3['error'](0x1f4,_0x489f2e[_0xd187('0x18')]));});});};exports[_0xd187('0x24')]=function(_0x13f285){var _0x481346=this;return new Promise(function(_0x2874b2,_0x2d8843){return db[_0xd187('0x1c')][_0xd187('0x25')]({'raw':_0x13f285['options']?_0x13f285[_0xd187('0x1d')][_0xd187('0x1e')]===undefined?!![]:![]:!![],'where':_0x13f285[_0xd187('0x1d')]?_0x13f285['options'][_0xd187('0x26')]||null:null,'attributes':_0x13f285['options']?_0x13f285[_0xd187('0x1d')][_0xd187('0x1f')]||null:null,'include':_0x13f285[_0xd187('0x1d')]?_0x13f285['options']['include']?_[_0xd187('0x22')](_0x13f285[_0xd187('0x1d')]['include'],function(_0x4591e0){return{'model':db[_0x4591e0[_0xd187('0x21')]],'as':_0x4591e0['as'],'attributes':_0x4591e0[_0xd187('0x1f')],'include':_0x4591e0['include']?_['map'](_0x4591e0[_0xd187('0x20')],function(_0xf32da2){return{'model':db[_0xf32da2['model']],'as':_0xf32da2['as'],'attributes':_0xf32da2['attributes'],'include':_0xf32da2['include']?_[_0xd187('0x22')](_0xf32da2['include'],function(_0x28c252){return{'model':db[_0x28c252[_0xd187('0x21')]],'as':_0x28c252['as'],'attributes':_0x28c252['attributes']};}):[]};}):[]};}):[]:[]})[_0xd187('0x10')](function(_0x5674ca){if(_0x13f285[_0xd187('0x1d')][_0xd187('0x27')]===!![])_0x5674ca['setDataValue'](_0xd187('0x28'),_0x5674ca[_0xd187('0x29')]());logger['info'](_0xd187('0x24'),_0x13f285);logger['debug']('ShowMailAccount',_0x13f285,JSON[_0xd187('0x15')](_0x5674ca));_0x2874b2(_0x5674ca);})[_0xd187('0x1a')](function(_0xdecb24){logger[_0xd187('0x16')](_0xd187('0x24'),_0xdecb24['message'],_0x13f285);_0x2d8843(_0x481346[_0xd187('0x16')](0x1f4,_0xdecb24[_0xd187('0x18')]));});});};exports[_0xd187('0x2a')]=function(_0x4f3139){var _0x4b121c=this;return new Promise(function(_0x538c05,_0x595195){var _0x21bb3c={'body':_0x4f3139[_0xd187('0x2b')],'channel':_0xd187('0x2c')};var _0x367303=_[_0xd187('0x2d')](_[_0xd187('0x2e')](db[_0xd187('0x2f')][_0xd187('0x30')]),['createdAt',_0xd187('0x31'),_0xd187('0x32'),_0xd187('0x33')]);var _0x51c7fc=![];if(_0x4f3139[_0xd187('0x2b')]['id']){delete _0x4f3139['body']['id'];}if(_[_0xd187('0x34')](_0x4f3139[_0xd187('0x2b')][_0xd187('0x35')])){return _0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,_0xd187('0x36')));}if(_['isNil'](_0x4f3139[_0xd187('0x2b')][_0xd187('0x2b')])||_0x4f3139[_0xd187('0x2b')][_0xd187('0x2b')]===''){return _0x595195(_0x4b121c['error'](0x1f4,_0xd187('0x37')));}if(_[_0xd187('0x34')](_0x4f3139['body'][_0xd187('0x38')])){return _0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,'mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x367303));}if(!_['includes'](_0x367303,_0x4f3139[_0xd187('0x2b')][_0xd187('0x38')])){return _0x595195(_0x4b121c['error'](0x1f4,'mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x367303));}var _0x4f616d={};_0x4f616d[_0x4f3139[_0xd187('0x2b')][_0xd187('0x38')]]=_0x4f3139[_0xd187('0x2b')][_0xd187('0x35')];return db[_0xd187('0x1c')][_0xd187('0x25')]({'where':{'id':_0x4f3139[_0xd187('0x39')]['id']},'include':[{'model':db['CmList'],'as':_0xd187('0x3a'),'include':[{'model':db[_0xd187('0x2f')],'as':_0xd187('0x3b'),'where':_0x4f616d,'limit':0x1,'order':[[_0xd187('0x31'),_0xd187('0x3c')]]}]},{'model':db[_0xd187('0x3d')],'as':_0xd187('0x3e')},{'model':db[_0xd187('0x3f')],'as':'Smtp','include':[{'model':db[_0xd187('0x40')],'as':_0xd187('0x40')}]}]})[_0xd187('0x10')](function(_0x1449d7){if(_0x1449d7&&_0x1449d7[_0xd187('0x3a')]){var _0x5ad646=_0x1449d7[_0xd187('0x41')]({'plain':!![]});_0x21bb3c[_0xd187('0x39')]=_['omit'](_0x5ad646,[_0xd187('0x3e'),_0xd187('0x3a')]);_0x21bb3c['account']['smtpOptions']=_0x1449d7['getSmtpOptions']();_0x21bb3c['applications']=_0x5ad646[_0xd187('0x3e')];_0x21bb3c[_0xd187('0x42')]=_0x5ad646[_0xd187('0x3a')];_0x21bb3c[_0xd187('0x43')]=_[_0xd187('0x44')](_0x21bb3c[_0xd187('0x43')],[_0xd187('0x45')],['asc']);if(_0x21bb3c[_0xd187('0x39')]&&_0x21bb3c[_0xd187('0x39')][_0xd187('0x46')]){_0x21bb3c[_0xd187('0x43')]['push']({'id':0x0,'priority':_0x21bb3c[_0xd187('0x43')]['length']+0x1,'app':'close','appdata':_0xd187('0x46'),'interval':'*,*,*,*'});}if(_0x21bb3c[_0xd187('0x39')][_0xd187('0x3e')]){delete _0x21bb3c[_0xd187('0x39')][_0xd187('0x3e')];}if(_0x21bb3c[_0xd187('0x39')][_0xd187('0x3a')]){delete _0x21bb3c[_0xd187('0x39')][_0xd187('0x3a')];}if(_0x5ad646[_0xd187('0x3a')]['Contacts'][_0xd187('0x47')]){return _0x5ad646[_0xd187('0x3a')]['Contacts'][0x0];}var _0x471f11=_[_0xd187('0xa')](_0x4f3139[_0xd187('0x2b')],{'firstName':_0x4f3139['body'][_0xd187('0x35')],'ListId':_0x5ad646[_0xd187('0x33')]});_0x471f11[_0x4f3139['body'][_0xd187('0x38')]]=_0x4f3139[_0xd187('0x2b')]['from'];return db[_0xd187('0x2f')]['create'](_0x471f11);}else{throw new Error(_0xd187('0x48'));}})[_0xd187('0x10')](function(_0x3a2a00){_0x21bb3c[_0xd187('0x49')]=_0x3a2a00;if(_0x3a2a00){if(!_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')]){_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x4a')]=rs[_0xd187('0x4b')]()+'\x20'+_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')];}var _0x945810={'ContactId':_0x3a2a00['id'],'MailAccountId':_0x4f3139[_0xd187('0x39')]['id'],'inReplyTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'to':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x35')],'cc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['cc'],'subject':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4c')],'attach':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4d')],'lastMsgAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgDirection':'in'};return db['MailInteraction'][_0xd187('0x25')]({'where':{'closed':![],'MailAccountId':_0x4f3139['account']['id']},'include':[{'model':db[_0xd187('0x50')],'as':_0xd187('0x51'),'attributes':[_0xd187('0x4a')],'where':{'messageId':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x52')]}}]})[_0xd187('0x10')](function(_0x4f89a6){if(_0x4f89a6){return[_0x4f89a6,![]];}return db['MailInteraction'][_0xd187('0x53')](_0x945810)[_0xd187('0x10')](function(_0x2870ad){return[_0x2870ad,!![]];});});}else{throw new Error(_0xd187('0x54'));}})['spread'](function(_0x2c1df4,_0x49543f){if(_0x2c1df4){_0x51c7fc=_0x49543f;if(!_0x49543f){return _0x2c1df4[_0xd187('0x55')]({'inReplyTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'to':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')],'cc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['cc'],'subject':_0x4f3139[_0xd187('0x2b')]['message']['subject'],'attach':_0x2c1df4[_0xd187('0x4d')]?_0x2c1df4[_0xd187('0x4d')]:_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4d')],'substatus':null,'substatusAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgAt':moment()[_0xd187('0x4e')](_0xd187('0x4f')),'lastMsgDirection':'in'});}else{return _0x2c1df4;}}})[_0xd187('0x10')](function(_0x379e89){_0x21bb3c[_0xd187('0x56')]=_0x379e89['get']({'plain':!![]});_0x21bb3c[_0xd187('0x56')][_0xd187('0x57')]=_0x51c7fc;return db['MailMessage'][_0xd187('0x53')]({'body':_0x4f3139[_0xd187('0x2b')]['body'],'MailAccountId':_0x4f3139['account']['id'],'MailInteractionId':_0x379e89['id'],'direction':'in','ContactId':_0x21bb3c[_0xd187('0x49')]['id'],'messageId':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x4a')],'from':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x35')],'to':_0x4f3139['body']['message']['to'],'cc':_0x4f3139[_0xd187('0x2b')]['message']['cc'],'subject':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['subject'],'attach':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x4d')],'Attachments':_0x4f3139['body']['message']['attachments'],'originTo':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x58')],'originCc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x59')],'bcc':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')]['bcc'],'ChatWebsiteId':_0x4f3139[_0xd187('0x2b')][_0xd187('0x18')][_0xd187('0x5a')]||null,'originChannel':_0x4f3139['body'][_0xd187('0x18')][_0xd187('0x5b')]||_0xd187('0x5c'),'ChatOfflineMessageId':_0x4f3139[_0xd187('0x2b')]['message'][_0xd187('0x5d')]||null},{'include':[{'model':db[_0xd187('0x5e')],'as':'Attachments'}]});})[_0xd187('0x10')](function(_0x3afdd9){_0x21bb3c[_0xd187('0x18')]=_0x3afdd9;if(_0x21bb3c[_0xd187('0x56')]['UserId']){return db[_0xd187('0x5f')][_0xd187('0x25')]({'attributes':['id','name'],'where':{'id':_0x21bb3c[_0xd187('0x56')]['UserId']}})['then'](function(_0x506c53){if(_0x506c53){_0x21bb3c[_0xd187('0x43')][_0xd187('0x60')]({'id':0x0,'priority':0x0,'app':_0xd187('0x61'),'appdata':_0x506c53[_0xd187('0x62')]+','+(_0x21bb3c[_0xd187('0x39')][_0xd187('0x63')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0xd187('0x64'),_0xd187('0x65'),_0x21bb3c);});}return respondWithRpcPromise('Start','startRouting',_0x21bb3c);})[_0xd187('0x10')](function(_0x3e1c19){_0x538c05(_0x3e1c19);})[_0xd187('0x1a')](function(_0x1f163a){_0x595195(_0x4b121c[_0xd187('0x16')](0x1f4,_0x1f163a[_0xd187('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/mailAccount/mailAccount.socket.js b/server/api/mailAccount/mailAccount.socket.js index 9841f9a..2eafefe 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 _0x0737=['length','mailAccount:','./mailAccount.events','save','remove','update','emit'];(function(_0x413feb,_0x10477f){var _0x40ee88=function(_0x32a3f6){while(--_0x32a3f6){_0x413feb['push'](_0x413feb['shift']());}};_0x40ee88(++_0x10477f);}(_0x0737,0x79));var _0x7073=function(_0x26d509,_0x56b7ff){_0x26d509=_0x26d509-0x0;var _0x19f020=_0x0737[_0x26d509];return _0x19f020;};'use strict';var MailAccountEvents=require(_0x7073('0x0'));var events=[_0x7073('0x1'),_0x7073('0x2'),_0x7073('0x3')];function createListener(_0x2c8fe7,_0x440bdc){return function(_0x5123f6){_0x440bdc[_0x7073('0x4')](_0x2c8fe7,_0x5123f6);};}function removeListener(_0x6d565e,_0x47937a){return function(){MailAccountEvents['removeListener'](_0x6d565e,_0x47937a);};}exports['register']=function(_0x11900d){for(var _0x40d010=0x0,_0xc0f021=events[_0x7073('0x5')];_0x40d010<_0xc0f021;_0x40d010++){var _0x1a93ee=events[_0x40d010];var _0x26b1d8=createListener(_0x7073('0x6')+_0x1a93ee,_0x11900d);MailAccountEvents['on'](_0x1a93ee,_0x26b1d8);}}; \ No newline at end of file +var _0xd407=['update','emit','register','mailAccount:','./mailAccount.events','save'];(function(_0x204f2c,_0x552f61){var _0x53e695=function(_0x479723){while(--_0x479723){_0x204f2c['push'](_0x204f2c['shift']());}};_0x53e695(++_0x552f61);}(_0xd407,0x1de));var _0x7d40=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd407[_0x3dd15e];return _0x231fd0;};'use strict';var MailAccountEvents=require(_0x7d40('0x0'));var events=[_0x7d40('0x1'),'remove',_0x7d40('0x2')];function createListener(_0x14e5e6,_0x562887){return function(_0x12d77d){_0x562887[_0x7d40('0x3')](_0x14e5e6,_0x12d77d);};}function removeListener(_0x2a50de,_0x5184e5){return function(){MailAccountEvents['removeListener'](_0x2a50de,_0x5184e5);};}exports[_0x7d40('0x4')]=function(_0x1ce147){for(var _0x46307f=0x0,_0x2009d7=events['length'];_0x46307f<_0x2009d7;_0x46307f++){var _0x2bbec2=events[_0x46307f];var _0xa981fe=createListener(_0x7d40('0x5')+_0x2bbec2,_0x1ce147);MailAccountEvents['on'](_0x2bbec2,_0xa981fe);}}; \ No newline at end of file diff --git a/server/api/mailApplication/index.js b/server/api/mailApplication/index.js index d8ab321..45d61d0 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 _0xea0f=['multer','util','path','connect-timeout','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show','put','update','delete','destroy','exports'];(function(_0x237968,_0x1558e0){var _0x3e06ee=function(_0x498b77){while(--_0x498b77){_0x237968['push'](_0x237968['shift']());}};_0x3e06ee(++_0x1558e0);}(_0xea0f,0x1ba));var _0xfea0=function(_0x580b56,_0x102ab3){_0x580b56=_0x580b56-0x0;var _0x12153f=_0xea0f[_0x580b56];return _0x12153f;};'use strict';var multer=require(_0xfea0('0x0'));var util=require(_0xfea0('0x1'));var path=require(_0xfea0('0x2'));var timeout=require(_0xfea0('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xfea0('0x4'));var interaction=require(_0xfea0('0x5'));var config=require(_0xfea0('0x6'));var controller=require(_0xfea0('0x7'));router[_0xfea0('0x8')](_0xfea0('0x9'),auth[_0xfea0('0xa')](),controller[_0xfea0('0xb')]);router[_0xfea0('0xc')](_0xfea0('0x9'),auth['isAuthenticated'](),controller[_0xfea0('0xd')]);router[_0xfea0('0xe')](_0xfea0('0x9'),auth[_0xfea0('0xa')](),controller[_0xfea0('0xf')]);module[_0xfea0('0x10')]=router; \ No newline at end of file +var _0x0a2e=['put','update','delete','destroy','exports','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailApplication.controller','get','/:id','isAuthenticated','show'];(function(_0x43788f,_0x2feb1e){var _0x161eaf=function(_0x2697a6){while(--_0x2697a6){_0x43788f['push'](_0x43788f['shift']());}};_0x161eaf(++_0x2feb1e);}(_0x0a2e,0x16d));var _0xe0a2=function(_0x363b81,_0x81e6ca){_0x363b81=_0x363b81-0x0;var _0x1d92fb=_0x0a2e[_0x363b81];return _0x1d92fb;};'use strict';var multer=require('multer');var util=require(_0xe0a2('0x0'));var path=require('path');var timeout=require(_0xe0a2('0x1'));var express=require(_0xe0a2('0x2'));var router=express[_0xe0a2('0x3')]();var fs_extra=require(_0xe0a2('0x4'));var auth=require(_0xe0a2('0x5'));var interaction=require(_0xe0a2('0x6'));var config=require(_0xe0a2('0x7'));var controller=require(_0xe0a2('0x8'));router[_0xe0a2('0x9')](_0xe0a2('0xa'),auth[_0xe0a2('0xb')](),controller[_0xe0a2('0xc')]);router[_0xe0a2('0xd')]('/:id',auth[_0xe0a2('0xb')](),controller[_0xe0a2('0xe')]);router[_0xe0a2('0xf')](_0xe0a2('0xa'),auth[_0xe0a2('0xb')](),controller[_0xe0a2('0x10')]);module[_0xe0a2('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.attributes.js b/server/api/mailApplication/mailApplication.attributes.js index 4294e8d..2b0c4de 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 _0xa391=['STRING','*,*,*,*','exports','INTEGER','TEXT'];(function(_0x39a50e,_0x4d06e6){var _0x3ce778=function(_0x289c00){while(--_0x289c00){_0x39a50e['push'](_0x39a50e['shift']());}};_0x3ce778(++_0x4d06e6);}(_0xa391,0x115));var _0x1a39=function(_0x32f7d7,_0x54231b){_0x32f7d7=_0x32f7d7-0x0;var _0x133d09=_0xa391[_0x32f7d7];return _0x133d09;};'use strict';var Sequelize=require('sequelize');module[_0x1a39('0x0')]={'priority':{'type':Sequelize[_0x1a39('0x1')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'noop'},'appdata':{'type':Sequelize[_0x1a39('0x2')]()},'description':{'type':Sequelize[_0x1a39('0x3')]},'interval':{'type':Sequelize['STRING'],'defaultValue':_0x1a39('0x4')}}; \ No newline at end of file +var _0x909c=['noop','TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING'];(function(_0x496a21,_0x45c7b4){var _0x18e8b6=function(_0x2b3e99){while(--_0x2b3e99){_0x496a21['push'](_0x496a21['shift']());}};_0x18e8b6(++_0x45c7b4);}(_0x909c,0x1b5));var _0xc909=function(_0x1caf6e,_0x4aa8f3){_0x1caf6e=_0x1caf6e-0x0;var _0x2fead2=_0x909c[_0x1caf6e];return _0x2fead2;};'use strict';var Sequelize=require(_0xc909('0x0'));module[_0xc909('0x1')]={'priority':{'type':Sequelize[_0xc909('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0xc909('0x3')],'allowNull':![],'defaultValue':_0xc909('0x4')},'appdata':{'type':Sequelize[_0xc909('0x5')]()},'description':{'type':Sequelize[_0xc909('0x3')]},'interval':{'type':Sequelize[_0xc909('0x3')],'defaultValue':_0xc909('0x6')}}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.controller.js b/server/api/mailApplication/mailApplication.controller.js index 6a1652b..1320960 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 _0xd8b0=['attributes','length','include','merge','find','catch','body','params','eml-format','rimraf','moment','bluebird','mustache','util','path','ejs','fs-extra','lodash','crypto','jsforce','to-csv','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','undefined','count','set','Content-Range','apply','save','update','then','destroy','error','name','show','model','MailApplication','query','keys','intersection','fields'];(function(_0x1b852e,_0x185f0d){var _0x2fd5cf=function(_0x1dc638){while(--_0x1dc638){_0x1b852e['push'](_0x1b852e['shift']());}};_0x2fd5cf(++_0x185f0d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var emlformat=require(_0x0d8b('0x0'));var rimraf=require(_0x0d8b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0d8b('0x2'));var BPromise=require(_0x0d8b('0x3'));var Mustache=require(_0x0d8b('0x4'));var util=require(_0x0d8b('0x5'));var path=require(_0x0d8b('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x0d8b('0x7'));var fs=require('fs');var fs_extra=require(_0x0d8b('0x8'));var _=require(_0x0d8b('0x9'));var squel=require('squel');var crypto=require(_0x0d8b('0xa'));var jsforce=require(_0x0d8b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x0d8b('0xc'));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(_0x0d8b('0x13'));var logger=require('../../config/logger')(_0x0d8b('0x14'));var utils=require('../../config/utils');var config=require(_0x0d8b('0x15'));var licenseUtil=require(_0x0d8b('0x16'));var db=require(_0x0d8b('0x17'))['db'];function respondWithStatusCode(_0x92cdd8,_0x35a07b){_0x35a07b=_0x35a07b||0xcc;return function(_0x32bb1a){if(_0x32bb1a){return _0x92cdd8[_0x0d8b('0x18')](_0x35a07b);}return _0x92cdd8[_0x0d8b('0x19')](_0x35a07b)[_0x0d8b('0x1a')]();};}function respondWithResult(_0x2ce75e,_0x5ad086){_0x5ad086=_0x5ad086||0xc8;return function(_0xe65334){if(_0xe65334){return _0x2ce75e[_0x0d8b('0x19')](_0x5ad086)[_0x0d8b('0x1b')](_0xe65334);}};}function respondWithFilteredResult(_0x4f6f21,_0x23eb7b){return function(_0xa86349){if(_0xa86349){var _0x17f7df=typeof _0x23eb7b[_0x0d8b('0x1c')]===_0x0d8b('0x1d')&&typeof _0x23eb7b['limit']===_0x0d8b('0x1d');var _0x4586c2=_0xa86349[_0x0d8b('0x1e')];var _0x5fecbd=_0x17f7df?0x0:_0x23eb7b[_0x0d8b('0x1c')];var _0x18dd2d=_0x17f7df?_0xa86349[_0x0d8b('0x1e')]:_0x23eb7b[_0x0d8b('0x1c')]+_0x23eb7b['limit'];var _0x27512e;if(_0x18dd2d>=_0x4586c2){_0x18dd2d=_0x4586c2;_0x27512e=0xc8;}else{_0x27512e=0xce;}_0x4f6f21[_0x0d8b('0x19')](_0x27512e);return _0x4f6f21[_0x0d8b('0x1f')](_0x0d8b('0x20'),_0x5fecbd+'-'+_0x18dd2d+'/'+_0x4586c2)[_0x0d8b('0x1b')](_0xa86349);}return null;};}function patchUpdates(_0x5b709c){return function(_0x393beb){try{jsonpatch[_0x0d8b('0x21')](_0x393beb,_0x5b709c,!![]);}catch(_0x50ec1e){return BPromise['reject'](_0x50ec1e);}return _0x393beb[_0x0d8b('0x22')]();};}function saveUpdates(_0x54a9a7,_0x56c729){return function(_0x5527d8){if(_0x5527d8){return _0x5527d8[_0x0d8b('0x23')](_0x54a9a7)[_0x0d8b('0x24')](function(_0x214778){return _0x214778;});}return null;};}function removeEntity(_0x38efc8,_0x221071){return function(_0x2c64e2){if(_0x2c64e2){return _0x2c64e2[_0x0d8b('0x25')]()[_0x0d8b('0x24')](function(){_0x38efc8[_0x0d8b('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe8bbee,_0x4463ee){return function(_0x5363e3){if(!_0x5363e3){_0xe8bbee[_0x0d8b('0x18')](0x194);}return _0x5363e3;};}function handleError(_0x4a0ae4,_0x3dd149){_0x3dd149=_0x3dd149||0x1f4;return function(_0x234bdd){logger[_0x0d8b('0x26')](_0x234bdd['stack']);if(_0x234bdd['name']){delete _0x234bdd[_0x0d8b('0x27')];}_0x4a0ae4[_0x0d8b('0x19')](_0x3dd149)['send'](_0x234bdd);};}exports[_0x0d8b('0x28')]=function(_0x59aa83,_0x1b2b59){var _0x4b59e5={'raw':!![],'where':{'id':_0x59aa83['params']['id']}},_0x97050a={};_0x97050a[_0x0d8b('0x29')]=_['keys'](db[_0x0d8b('0x2a')]['rawAttributes']);_0x97050a[_0x0d8b('0x2b')]=_[_0x0d8b('0x2c')](_0x59aa83[_0x0d8b('0x2b')]);_0x97050a['filters']=_['intersection'](_0x97050a['model'],_0x97050a[_0x0d8b('0x2b')]);_0x4b59e5['attributes']=_[_0x0d8b('0x2d')](_0x97050a['model'],qs['fields'](_0x59aa83[_0x0d8b('0x2b')][_0x0d8b('0x2e')]));_0x4b59e5[_0x0d8b('0x2f')]=_0x4b59e5[_0x0d8b('0x2f')][_0x0d8b('0x30')]?_0x4b59e5[_0x0d8b('0x2f')]:_0x97050a[_0x0d8b('0x29')];if(_0x59aa83[_0x0d8b('0x2b')]['includeAll']){_0x4b59e5[_0x0d8b('0x31')]=[{'all':!![]}];}_0x4b59e5=_[_0x0d8b('0x32')]({},_0x4b59e5,_0x59aa83['options']);return db[_0x0d8b('0x2a')][_0x0d8b('0x33')](_0x4b59e5)[_0x0d8b('0x24')](handleEntityNotFound(_0x1b2b59,null))['then'](respondWithResult(_0x1b2b59,null))[_0x0d8b('0x34')](handleError(_0x1b2b59,null));};exports[_0x0d8b('0x23')]=function(_0x206157,_0x31ceba){if(_0x206157[_0x0d8b('0x35')]['id']){delete _0x206157['body']['id'];}return db[_0x0d8b('0x2a')][_0x0d8b('0x33')]({'where':{'id':_0x206157['params']['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x31ceba,null))[_0x0d8b('0x24')](saveUpdates(_0x206157[_0x0d8b('0x35')],null))[_0x0d8b('0x24')](respondWithResult(_0x31ceba,null))[_0x0d8b('0x34')](handleError(_0x31ceba,null));};exports['destroy']=function(_0x497a71,_0x41b4f9){return db['MailApplication']['find']({'where':{'id':_0x497a71[_0x0d8b('0x36')]['id']}})[_0x0d8b('0x24')](handleEntityNotFound(_0x41b4f9,null))[_0x0d8b('0x24')](removeEntity(_0x41b4f9,null))[_0x0d8b('0x34')](handleError(_0x41b4f9,null));}; \ No newline at end of file +var _0xac4a=['Content-Range','apply','reject','save','update','destroy','then','error','stack','name','send','show','params','model','keys','MailApplication','query','filters','intersection','fields','attributes','length','includeAll','include','merge','options','catch','body','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','util','path','sox','ejs','lodash','crypto','jsforce','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set'];(function(_0x190a16,_0x2ccfae){var _0xf4a747=function(_0x529f6f){while(--_0x529f6f){_0x190a16['push'](_0x190a16['shift']());}};_0xf4a747(++_0x2ccfae);}(_0xac4a,0x13f));var _0xaac4=function(_0x34049f,_0xec089){_0x34049f=_0x34049f-0x0;var _0x372ce1=_0xac4a[_0x34049f];return _0x372ce1;};'use strict';var emlformat=require(_0xaac4('0x0'));var rimraf=require(_0xaac4('0x1'));var zipdir=require(_0xaac4('0x2'));var jsonpatch=require(_0xaac4('0x3'));var rp=require(_0xaac4('0x4'));var moment=require(_0xaac4('0x5'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xaac4('0x6'));var path=require(_0xaac4('0x7'));var sox=require(_0xaac4('0x8'));var csv=require('to-csv');var ejs=require(_0xaac4('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xaac4('0xa'));var squel=require('squel');var crypto=require(_0xaac4('0xb'));var jsforce=require(_0xaac4('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xaac4('0xd'));var Papa=require('papaparse');var Redis=require(_0xaac4('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xaac4('0xf'));var hardwareService=require(_0xaac4('0x10'));var logger=require(_0xaac4('0x11'))(_0xaac4('0x12'));var utils=require(_0xaac4('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xaac4('0x14'))['db'];function respondWithStatusCode(_0x2e2d02,_0x45e512){_0x45e512=_0x45e512||0xcc;return function(_0x5a4801){if(_0x5a4801){return _0x2e2d02[_0xaac4('0x15')](_0x45e512);}return _0x2e2d02[_0xaac4('0x16')](_0x45e512)['end']();};}function respondWithResult(_0xf06b1d,_0x2b20d0){_0x2b20d0=_0x2b20d0||0xc8;return function(_0x46698d){if(_0x46698d){return _0xf06b1d[_0xaac4('0x16')](_0x2b20d0)[_0xaac4('0x17')](_0x46698d);}};}function respondWithFilteredResult(_0x2fbeb7,_0x31b7e5){return function(_0x1df9ae){if(_0x1df9ae){var _0x233278=typeof _0x31b7e5[_0xaac4('0x18')]===_0xaac4('0x19')&&typeof _0x31b7e5[_0xaac4('0x1a')]===_0xaac4('0x19');var _0x52686a=_0x1df9ae[_0xaac4('0x1b')];var _0x52085a=_0x233278?0x0:_0x31b7e5[_0xaac4('0x18')];var _0x5b6fd6=_0x233278?_0x1df9ae[_0xaac4('0x1b')]:_0x31b7e5[_0xaac4('0x18')]+_0x31b7e5[_0xaac4('0x1a')];var _0x271bcb;if(_0x5b6fd6>=_0x52686a){_0x5b6fd6=_0x52686a;_0x271bcb=0xc8;}else{_0x271bcb=0xce;}_0x2fbeb7[_0xaac4('0x16')](_0x271bcb);return _0x2fbeb7[_0xaac4('0x1c')](_0xaac4('0x1d'),_0x52085a+'-'+_0x5b6fd6+'/'+_0x52686a)[_0xaac4('0x17')](_0x1df9ae);}return null;};}function patchUpdates(_0x4166ee){return function(_0x480fb0){try{jsonpatch[_0xaac4('0x1e')](_0x480fb0,_0x4166ee,!![]);}catch(_0x4e1e89){return BPromise[_0xaac4('0x1f')](_0x4e1e89);}return _0x480fb0[_0xaac4('0x20')]();};}function saveUpdates(_0x43625c,_0x477b77){return function(_0x17140f){if(_0x17140f){return _0x17140f[_0xaac4('0x21')](_0x43625c)['then'](function(_0x43ccdc){return _0x43ccdc;});}return null;};}function removeEntity(_0x27a84d,_0x174860){return function(_0x4f10ec){if(_0x4f10ec){return _0x4f10ec[_0xaac4('0x22')]()[_0xaac4('0x23')](function(){_0x27a84d[_0xaac4('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24186b,_0x4f1b65){return function(_0x54203b){if(!_0x54203b){_0x24186b['sendStatus'](0x194);}return _0x54203b;};}function handleError(_0x5a0bb3,_0x22d5a6){_0x22d5a6=_0x22d5a6||0x1f4;return function(_0x17d25f){logger[_0xaac4('0x24')](_0x17d25f[_0xaac4('0x25')]);if(_0x17d25f[_0xaac4('0x26')]){delete _0x17d25f[_0xaac4('0x26')];}_0x5a0bb3[_0xaac4('0x16')](_0x22d5a6)[_0xaac4('0x27')](_0x17d25f);};}exports[_0xaac4('0x28')]=function(_0x386c9b,_0x4d0f5f){var _0x316445={'raw':!![],'where':{'id':_0x386c9b[_0xaac4('0x29')]['id']}},_0x16b33c={};_0x16b33c[_0xaac4('0x2a')]=_[_0xaac4('0x2b')](db[_0xaac4('0x2c')]['rawAttributes']);_0x16b33c[_0xaac4('0x2d')]=_['keys'](_0x386c9b[_0xaac4('0x2d')]);_0x16b33c[_0xaac4('0x2e')]=_[_0xaac4('0x2f')](_0x16b33c[_0xaac4('0x2a')],_0x16b33c['query']);_0x316445['attributes']=_['intersection'](_0x16b33c[_0xaac4('0x2a')],qs[_0xaac4('0x30')](_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x30')]));_0x316445[_0xaac4('0x31')]=_0x316445[_0xaac4('0x31')][_0xaac4('0x32')]?_0x316445[_0xaac4('0x31')]:_0x16b33c[_0xaac4('0x2a')];if(_0x386c9b[_0xaac4('0x2d')][_0xaac4('0x33')]){_0x316445[_0xaac4('0x34')]=[{'all':!![]}];}_0x316445=_[_0xaac4('0x35')]({},_0x316445,_0x386c9b[_0xaac4('0x36')]);return db[_0xaac4('0x2c')]['find'](_0x316445)['then'](handleEntityNotFound(_0x4d0f5f,null))[_0xaac4('0x23')](respondWithResult(_0x4d0f5f,null))[_0xaac4('0x37')](handleError(_0x4d0f5f,null));};exports[_0xaac4('0x21')]=function(_0x5e6080,_0x191d0f){if(_0x5e6080[_0xaac4('0x38')]['id']){delete _0x5e6080[_0xaac4('0x38')]['id'];}return db[_0xaac4('0x2c')][_0xaac4('0x39')]({'where':{'id':_0x5e6080[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x191d0f,null))['then'](saveUpdates(_0x5e6080[_0xaac4('0x38')],null))[_0xaac4('0x23')](respondWithResult(_0x191d0f,null))[_0xaac4('0x37')](handleError(_0x191d0f,null));};exports['destroy']=function(_0x36d84a,_0x497e7b){return db['MailApplication'][_0xaac4('0x39')]({'where':{'id':_0x36d84a[_0xaac4('0x29')]['id']}})[_0xaac4('0x23')](handleEntityNotFound(_0x497e7b,null))['then'](removeEntity(_0x497e7b,null))['catch'](handleError(_0x497e7b,null));}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.model.js b/server/api/mailApplication/mailApplication.model.js index a220de8..7bdbea9 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 _0xa968=['util','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','lodash'];(function(_0x3d4876,_0x366386){var _0x58ca9d=function(_0x5bd045){while(--_0x5bd045){_0x3d4876['push'](_0x3d4876['shift']());}};_0x58ca9d(++_0x366386);}(_0xa968,0x151));var _0x8a96=function(_0x56e518,_0x50e1e3){_0x56e518=_0x56e518-0x0;var _0x3f1322=_0xa968[_0x56e518];return _0x3f1322;};'use strict';var _=require(_0x8a96('0x0'));var util=require(_0x8a96('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x8a96('0x2'));var BPromise=require(_0x8a96('0x3'));var rp=require(_0x8a96('0x4'));var fs=require('fs');var path=require(_0x8a96('0x5'));var rimraf=require(_0x8a96('0x6'));var config=require(_0x8a96('0x7'));var attributes=require(_0x8a96('0x8'));module[_0x8a96('0x9')]=function(_0x317168,_0x538961){return _0x317168[_0x8a96('0xa')](_0x8a96('0xb'),attributes,{'tableName':_0x8a96('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x30b3=['moment','bluebird','request-promise','rimraf','../../config/environment','./mailApplication.attributes','exports','define','MailApplication','mail_applications','utf8mb4','util','../../config/logger','api'];(function(_0x4bddc4,_0x55b14c){var _0x6a7b9=function(_0x42f7d5){while(--_0x42f7d5){_0x4bddc4['push'](_0x4bddc4['shift']());}};_0x6a7b9(++_0x55b14c);}(_0x30b3,0x89));var _0x330b=function(_0x202ae6,_0x424ff7){_0x202ae6=_0x202ae6-0x0;var _0x121b35=_0x30b3[_0x202ae6];return _0x121b35;};'use strict';var _=require('lodash');var util=require(_0x330b('0x0'));var logger=require(_0x330b('0x1'))(_0x330b('0x2'));var moment=require(_0x330b('0x3'));var BPromise=require(_0x330b('0x4'));var rp=require(_0x330b('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x330b('0x6'));var config=require(_0x330b('0x7'));var attributes=require(_0x330b('0x8'));module[_0x330b('0x9')]=function(_0x1573f5,_0xf789eb){return _0x1573f5[_0x330b('0xa')](_0x330b('0xb'),attributes,{'tableName':_0x330b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x330b('0xd'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailApplication/mailApplication.rpc.js b/server/api/mailApplication/mailApplication.rpc.js index 15e2a18..1bffed5 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 _0x3f60=['limit','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','UpdateMailApplication','MailApplication','body','options','where','attributes'];(function(_0x5c585d,_0x69819f){var _0x3fdd3b=function(_0x5234b4){while(--_0x5234b4){_0x5c585d['push'](_0x5c585d['shift']());}};_0x3fdd3b(++_0x69819f);}(_0x3f60,0x119));var _0x03f6=function(_0x499d15,_0x5376c1){_0x499d15=_0x499d15-0x0;var _0x189291=_0x3f60[_0x499d15];return _0x189291;};'use strict';var _=require(_0x03f6('0x0'));var util=require(_0x03f6('0x1'));var moment=require(_0x03f6('0x2'));var BPromise=require(_0x03f6('0x3'));var rs=require(_0x03f6('0x4'));var fs=require('fs');var Redis=require(_0x03f6('0x5'));var db=require(_0x03f6('0x6'))['db'];var utils=require(_0x03f6('0x7'));var logger=require('../../config/logger')(_0x03f6('0x8'));var config=require('../../config/environment');var jayson=require(_0x03f6('0x9'));var client=jayson[_0x03f6('0xa')][_0x03f6('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1af0d7,_0x14b8a4,_0x4d64fc){return new BPromise(function(_0x2eefb3,_0x34f83f){return client['request'](_0x1af0d7,_0x4d64fc)[_0x03f6('0xc')](function(_0x59c78a){logger[_0x03f6('0xd')](_0x03f6('0xe'),_0x14b8a4,_0x03f6('0xf'));logger[_0x03f6('0x10')](_0x03f6('0x11'),_0x14b8a4,_0x03f6('0xf'),JSON[_0x03f6('0x12')](_0x59c78a));if(_0x59c78a['error']){if(_0x59c78a[_0x03f6('0x13')][_0x03f6('0x14')]===0x1f4){logger[_0x03f6('0x13')](_0x03f6('0xe'),_0x14b8a4,_0x59c78a['error'][_0x03f6('0x15')]);return _0x34f83f(_0x59c78a[_0x03f6('0x13')][_0x03f6('0x15')]);}logger[_0x03f6('0x13')](_0x03f6('0xe'),_0x14b8a4,_0x59c78a[_0x03f6('0x13')]['message']);return _0x2eefb3(_0x59c78a[_0x03f6('0x13')][_0x03f6('0x15')]);}else{logger[_0x03f6('0xd')](_0x03f6('0xe'),_0x14b8a4,_0x03f6('0xf'));_0x2eefb3(_0x59c78a[_0x03f6('0x16')]['message']);}})['catch'](function(_0x4b0cd3){logger[_0x03f6('0x13')](_0x03f6('0xe'),_0x14b8a4,_0x4b0cd3);_0x34f83f(_0x4b0cd3);});});}exports[_0x03f6('0x17')]=function(_0x170b75){var _0x15e0bb=this;return new Promise(function(_0x51bc4d,_0x3eb45f){return db[_0x03f6('0x18')]['update'](_0x170b75[_0x03f6('0x19')],{'raw':_0x170b75[_0x03f6('0x1a')]?_0x170b75['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x170b75[_0x03f6('0x1a')]?_0x170b75[_0x03f6('0x1a')][_0x03f6('0x1b')]||null:null,'attributes':_0x170b75[_0x03f6('0x1a')]?_0x170b75['options'][_0x03f6('0x1c')]||null:null,'limit':_0x170b75['options']?_0x170b75[_0x03f6('0x1a')][_0x03f6('0x1d')]||null:null})[_0x03f6('0xc')](function(_0x6b0d6f){logger[_0x03f6('0xd')](_0x03f6('0x17'),_0x170b75);logger[_0x03f6('0x10')](_0x03f6('0x17'),_0x170b75,JSON[_0x03f6('0x12')](_0x6b0d6f));_0x51bc4d(_0x6b0d6f);})[_0x03f6('0x1e')](function(_0x1418ff){logger[_0x03f6('0x13')]('UpdateMailApplication',_0x1418ff[_0x03f6('0x15')],_0x170b75);_0x3eb45f(_0x15e0bb[_0x03f6('0x13')](0x1f4,_0x1418ff[_0x03f6('0x15')]));});});}; \ No newline at end of file +var _0x32b1=['stringify','error','message','catch','UpdateMailApplication','MailApplication','body','options','raw','where','attributes','limit','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','MailApplication,\x20%s,\x20%s','request\x20sent','debug','MailApplication,\x20%s,\x20%s,\x20%s'];(function(_0x41bfe0,_0x1f3d9b){var _0x157408=function(_0x5dd3a0){while(--_0x5dd3a0){_0x41bfe0['push'](_0x41bfe0['shift']());}};_0x157408(++_0x1f3d9b);}(_0x32b1,0x84));var _0x132b=function(_0xa1e82e,_0x1ad26e){_0xa1e82e=_0xa1e82e-0x0;var _0x318346=_0x32b1[_0xa1e82e];return _0x318346;};'use strict';var _=require(_0x132b('0x0'));var util=require(_0x132b('0x1'));var moment=require('moment');var BPromise=require(_0x132b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x132b('0x3'));var db=require(_0x132b('0x4'))['db'];var utils=require(_0x132b('0x5'));var logger=require(_0x132b('0x6'))('rpc');var config=require(_0x132b('0x7'));var jayson=require(_0x132b('0x8'));var client=jayson[_0x132b('0x9')][_0x132b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2e7093,_0x3b7e2d,_0x2de216){return new BPromise(function(_0x461578,_0x1a187e){return client[_0x132b('0xb')](_0x2e7093,_0x2de216)[_0x132b('0xc')](function(_0x177ef8){logger[_0x132b('0xd')](_0x132b('0xe'),_0x3b7e2d,_0x132b('0xf'));logger[_0x132b('0x10')](_0x132b('0x11'),_0x3b7e2d,'request\x20sent',JSON[_0x132b('0x12')](_0x177ef8));if(_0x177ef8[_0x132b('0x13')]){if(_0x177ef8['error']['code']===0x1f4){logger['error'](_0x132b('0xe'),_0x3b7e2d,_0x177ef8[_0x132b('0x13')][_0x132b('0x14')]);return _0x1a187e(_0x177ef8['error'][_0x132b('0x14')]);}logger['error'](_0x132b('0xe'),_0x3b7e2d,_0x177ef8[_0x132b('0x13')][_0x132b('0x14')]);return _0x461578(_0x177ef8[_0x132b('0x13')]['message']);}else{logger[_0x132b('0xd')](_0x132b('0xe'),_0x3b7e2d,'request\x20sent');_0x461578(_0x177ef8['result']['message']);}})[_0x132b('0x15')](function(_0x62ca02){logger[_0x132b('0x13')](_0x132b('0xe'),_0x3b7e2d,_0x62ca02);_0x1a187e(_0x62ca02);});});}exports[_0x132b('0x16')]=function(_0x411fbf){var _0x12e5b6=this;return new Promise(function(_0xa1183c,_0x3f3fda){return db[_0x132b('0x17')]['update'](_0x411fbf[_0x132b('0x18')],{'raw':_0x411fbf[_0x132b('0x19')]?_0x411fbf['options'][_0x132b('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x411fbf[_0x132b('0x19')]?_0x411fbf[_0x132b('0x19')][_0x132b('0x1b')]||null:null,'attributes':_0x411fbf[_0x132b('0x19')]?_0x411fbf[_0x132b('0x19')][_0x132b('0x1c')]||null:null,'limit':_0x411fbf[_0x132b('0x19')]?_0x411fbf['options'][_0x132b('0x1d')]||null:null})['then'](function(_0x45be7a){logger[_0x132b('0xd')](_0x132b('0x16'),_0x411fbf);logger[_0x132b('0x10')](_0x132b('0x16'),_0x411fbf,JSON['stringify'](_0x45be7a));_0xa1183c(_0x45be7a);})[_0x132b('0x15')](function(_0x3b7a8e){logger[_0x132b('0x13')](_0x132b('0x16'),_0x3b7a8e['message'],_0x411fbf);_0x3f3fda(_0x12e5b6[_0x132b('0x13')](0x1f4,_0x3b7a8e[_0x132b('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/index.js b/server/api/mailInteraction/index.js index 1c24c54..8f24e09 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 _0x2ab2=['mail','mailinteraction:addtags','addTags','put','update','delete','/:id','tracked','removeTags','exports','../../components/auth/service','get','isAuthenticated','index','describe','/:id/messages','getMessages','post','create','/:id/tags'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x2ab2,0xfa));var _0x22ab=function(_0x2f2b55,_0x19bee9){_0x2f2b55=_0x2f2b55-0x0;var _0xd7dd26=_0x2ab2[_0x2f2b55];return _0xd7dd26;};'use strict';var express=require('express');var router=express['Router']();var auth=require(_0x22ab('0x0'));var interaction=require('../../components/interaction/service');var controller=require('./mailInteraction.controller');router[_0x22ab('0x1')]('/',auth[_0x22ab('0x2')](),controller[_0x22ab('0x3')]);router[_0x22ab('0x1')]('/describe',auth[_0x22ab('0x2')](),controller[_0x22ab('0x4')]);router[_0x22ab('0x1')]('/:id',auth[_0x22ab('0x2')](),controller['show']);router['get'](_0x22ab('0x5'),auth['isAuthenticated'](),controller[_0x22ab('0x6')]);router['get']('/:id/download',auth[_0x22ab('0x2')](),controller['download']);router[_0x22ab('0x7')]('/',auth[_0x22ab('0x2')](),controller[_0x22ab('0x8')]);router['post'](_0x22ab('0x5'),auth[_0x22ab('0x2')](),controller['addMessage']);router['post'](_0x22ab('0x9'),auth[_0x22ab('0x2')](),interaction['tracked'](_0x22ab('0xa'),_0x22ab('0xb')),controller[_0x22ab('0xc')]);router[_0x22ab('0xd')]('/:id',auth['isAuthenticated'](),interaction['tracked']('mail','mailinteraction:update'),controller[_0x22ab('0xe')]);router[_0x22ab('0xf')](_0x22ab('0x10'),auth[_0x22ab('0x2')](),interaction[_0x22ab('0x11')](_0x22ab('0xa'),'mailinteraction:destroy'),controller['destroy']);router[_0x22ab('0xf')](_0x22ab('0x9'),auth[_0x22ab('0x2')](),controller[_0x22ab('0x12')]);module[_0x22ab('0x13')]=router; \ No newline at end of file +var _0x04a7=['isAuthenticated','/describe','show','/:id/messages','getMessages','/:id/download','download','post','create','addMessage','/:id/tags','tracked','mail','mailinteraction:addtags','put','mailinteraction:update','update','delete','/:id','mailinteraction:destroy','destroy','removeTags','exports','express','Router','../../components/auth/service','./mailInteraction.controller','get'];(function(_0x551592,_0x3950aa){var _0x1c7970=function(_0x55b722){while(--_0x55b722){_0x551592['push'](_0x551592['shift']());}};_0x1c7970(++_0x3950aa);}(_0x04a7,0x6b));var _0x704a=function(_0x2fd160,_0x53c0d6){_0x2fd160=_0x2fd160-0x0;var _0x5c2031=_0x04a7[_0x2fd160];return _0x5c2031;};'use strict';var express=require(_0x704a('0x0'));var router=express[_0x704a('0x1')]();var auth=require(_0x704a('0x2'));var interaction=require('../../components/interaction/service');var controller=require(_0x704a('0x3'));router[_0x704a('0x4')]('/',auth[_0x704a('0x5')](),controller['index']);router[_0x704a('0x4')](_0x704a('0x6'),auth[_0x704a('0x5')](),controller['describe']);router[_0x704a('0x4')]('/:id',auth['isAuthenticated'](),controller[_0x704a('0x7')]);router[_0x704a('0x4')](_0x704a('0x8'),auth[_0x704a('0x5')](),controller[_0x704a('0x9')]);router[_0x704a('0x4')](_0x704a('0xa'),auth[_0x704a('0x5')](),controller[_0x704a('0xb')]);router[_0x704a('0xc')]('/',auth[_0x704a('0x5')](),controller[_0x704a('0xd')]);router[_0x704a('0xc')](_0x704a('0x8'),auth[_0x704a('0x5')](),controller[_0x704a('0xe')]);router['post'](_0x704a('0xf'),auth[_0x704a('0x5')](),interaction[_0x704a('0x10')](_0x704a('0x11'),_0x704a('0x12')),controller['addTags']);router[_0x704a('0x13')]('/:id',auth[_0x704a('0x5')](),interaction['tracked'](_0x704a('0x11'),_0x704a('0x14')),controller[_0x704a('0x15')]);router[_0x704a('0x16')](_0x704a('0x17'),auth[_0x704a('0x5')](),interaction['tracked']('mail',_0x704a('0x18')),controller[_0x704a('0x19')]);router[_0x704a('0x16')]('/:id/tags',auth[_0x704a('0x5')](),controller[_0x704a('0x1a')]);module[_0x704a('0x1b')]=router; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.attributes.js b/server/api/mailInteraction/mailInteraction.attributes.js index cabb163..2ba645c 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 _0x2809=['long','TEXT','ENUM','out','exports','BOOLEAN','DATE','STRING'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0x2809,0xac));var _0x9280=function(_0x169600,_0x1d1346){_0x169600=_0x169600-0x0;var _0x3bee22=_0x2809[_0x169600];return _0x3bee22;};'use strict';var Sequelize=require('sequelize');var iconv=require('iconv');module[_0x9280('0x0')]={'closed':{'type':Sequelize[_0x9280('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9280('0x2')]},'disposition':{'type':Sequelize[_0x9280('0x3')]},'secondDisposition':{'type':Sequelize[_0x9280('0x3')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9280('0x3')]},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize[_0x9280('0x3')]},'cc':{'type':Sequelize['TEXT'](_0x9280('0x4'))},'subject':{'type':Sequelize[_0x9280('0x5')]()},'attach':{'type':Sequelize[_0x9280('0x1')],'defaultValue':![]},'read1stAt':{'type':Sequelize['DATE']},'substatus':{'type':Sequelize[_0x9280('0x3')](0x3c)},'substatusAt':{'type':Sequelize[_0x9280('0x2')]},'firstMsgDirection':{'type':Sequelize[_0x9280('0x6')]('in',_0x9280('0x7')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0x9280('0x2')]},'lastMsgDirection':{'type':Sequelize[_0x9280('0x6')]('in',_0x9280('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9280('0x1')],'defaultValue':![]}}; \ No newline at end of file +var _0x282b=['ENUM','out','sequelize','iconv','exports','BOOLEAN','DATE','STRING','TEXT','long'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x282b,0x19c));var _0xb282=function(_0x35863f,_0x1def8a){_0x35863f=_0x35863f-0x0;var _0x15f609=_0x282b[_0x35863f];return _0x15f609;};'use strict';var Sequelize=require(_0xb282('0x0'));var iconv=require(_0xb282('0x1'));module[_0xb282('0x2')]={'closed':{'type':Sequelize[_0xb282('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xb282('0x4')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize['STRING']},'thirdDisposition':{'type':Sequelize[_0xb282('0x5')]},'note':{'type':Sequelize['STRING']},'inReplyTo':{'type':Sequelize['STRING'](0x1fe)},'to':{'type':Sequelize['STRING']},'cc':{'type':Sequelize[_0xb282('0x6')](_0xb282('0x7'))},'subject':{'type':Sequelize[_0xb282('0x6')]()},'attach':{'type':Sequelize[_0xb282('0x3')],'defaultValue':![]},'read1stAt':{'type':Sequelize[_0xb282('0x4')]},'substatus':{'type':Sequelize[_0xb282('0x5')](0x3c)},'substatusAt':{'type':Sequelize[_0xb282('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xb282('0x8')]('in',_0xb282('0x9')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xb282('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xb282('0x8')]('in',_0xb282('0x9')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xb282('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.controller.js b/server/api/mailInteraction/mailInteraction.controller.js index 5bb2160..13890dd 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 _0x7fae=['length','includeAll','include','options','find','create','body','update','describe','addMessage','ids','omit','getMessages','findOne','MailMessage','hasOwnProperty','nolimit','order','sort','where','filters','pick','MailInteractionId','filter','merge','$gte','format','YYYY-MM-DD\x20HH:mm:ss','count','inlineCss','true','rows','addTags','spread','emit','mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','transcript-%d-%s.zip','attachments','push','Attachments','Messages','from','bcc','subject','createdAt','get','mkdirSync','each','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','Bcc','basename','type','readFileSync','writeFileSync','message%d.eml','unlinkSync','sendStatus','eml-format','rimraf','zip-dir','moment','bluebird','path','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','html-entities','redis','defaults','socket.io-emitter','status','end','json','offset','undefined','limit','Content-Range','then','destroy','error','name','send','index','map','MailInteraction','rawAttributes','fieldName','key','getOptions','findAll','mail','query','catch','params','model','keys','intersection','attributes','fields'];(function(_0x27a848,_0x2dfc9a){var _0x57dbb0=function(_0x403443){while(--_0x403443){_0x27a848['push'](_0x27a848['shift']());}};_0x57dbb0(++_0x2dfc9a);}(_0x7fae,0xb1));var _0xe7fa=function(_0x68c979,_0x431cff){_0x68c979=_0x68c979-0x0;var _0x4f0001=_0x7fae[_0x68c979];return _0x4f0001;};'use strict';var emlformat=require(_0xe7fa('0x0'));var rimraf=require(_0xe7fa('0x1'));var zipdir=require(_0xe7fa('0x2'));var moment=require(_0xe7fa('0x3'));var BPromise=require(_0xe7fa('0x4'));var util=require('util');var path=require(_0xe7fa('0x5'));var fs=require('fs');var _=require(_0xe7fa('0x6'));var juice=require(_0xe7fa('0x7'));var Redis=require(_0xe7fa('0x8'));var interaction=require(_0xe7fa('0x9'));var qs=require(_0xe7fa('0xa'));var logger=require(_0xe7fa('0xb'))(_0xe7fa('0xc'));var config=require(_0xe7fa('0xd'));var db=require('../../mysqldb')['db'];var htmlEntities=require(_0xe7fa('0xe'));config[_0xe7fa('0xf')]=_[_0xe7fa('0x10')](config[_0xe7fa('0xf')],{'host':'localhost','port':0x18eb});var socket=require(_0xe7fa('0x11'))(new Redis(config[_0xe7fa('0xf')]));require('./mailInteraction.socket')['register'](socket);function respondWithStatusCode(_0x29a47e,_0x2033e8){_0x2033e8=_0x2033e8||0xcc;return function(_0x2b61ab){if(_0x2b61ab){return _0x29a47e['sendStatus'](_0x2033e8);}return _0x29a47e[_0xe7fa('0x12')](_0x2033e8)[_0xe7fa('0x13')]();};}function respondWithResult(_0x47a751,_0x3b6af6){_0x3b6af6=_0x3b6af6||0xc8;return function(_0x225a27){if(_0x225a27){return _0x47a751[_0xe7fa('0x12')](_0x3b6af6)[_0xe7fa('0x14')](_0x225a27);}};}function respondWithFilteredResult(_0x166ad9,_0x387708){return function(_0x295e6d){if(_0x295e6d){var _0x27dfa6=typeof _0x387708[_0xe7fa('0x15')]===_0xe7fa('0x16')&&typeof _0x387708[_0xe7fa('0x17')]===_0xe7fa('0x16');var _0x1bb401=_0x295e6d['count'];var _0xab53e8=_0x27dfa6?0x0:_0x387708[_0xe7fa('0x15')];var _0x664f66=_0x27dfa6?_0x295e6d['count']:_0x387708['offset']+_0x387708['limit'];var _0x42da0e;if(_0x664f66>=_0x1bb401){_0x664f66=_0x1bb401;_0x42da0e=0xc8;}else{_0x42da0e=0xce;}_0x166ad9[_0xe7fa('0x12')](_0x42da0e);return _0x166ad9['set'](_0xe7fa('0x18'),_0xab53e8+'-'+_0x664f66+'/'+_0x1bb401)[_0xe7fa('0x14')](_0x295e6d);}return null;};}function saveUpdates(_0x4ecb84){return function(_0x2b5fe3){if(_0x2b5fe3){return _0x2b5fe3['update'](_0x4ecb84)[_0xe7fa('0x19')](function(_0xce27a7){return _0xce27a7;});}return null;};}function removeEntity(_0x859dfc){return function(_0x55d38c){if(_0x55d38c){return _0x55d38c[_0xe7fa('0x1a')]()['then'](function(){_0x859dfc[_0xe7fa('0x12')](0xcc)[_0xe7fa('0x13')]();});}};}function handleEntityNotFound(_0x259d79){return function(_0x133e97){if(!_0x133e97){_0x259d79['sendStatus'](0x194);}return _0x133e97;};}function handleError(_0x3234e8,_0x2169d4){_0x2169d4=_0x2169d4||0x1f4;return function(_0xf26a0){logger[_0xe7fa('0x1b')](_0xf26a0['stack']);if(_0xf26a0[_0xe7fa('0x1c')]){delete _0xf26a0['name'];}_0x3234e8[_0xe7fa('0x12')](_0x2169d4)[_0xe7fa('0x1d')](_0xf26a0);};}exports[_0xe7fa('0x1e')]=function(_0x1939e0,_0x34fec6){var _0x50fb14={};var _0x8030c=_[_0xe7fa('0x1f')](db[_0xe7fa('0x20')][_0xe7fa('0x21')],function(_0x38d17c){return{'name':_0x38d17c[_0xe7fa('0x22')],'type':_0x38d17c['type'][_0xe7fa('0x23')]};});_0x50fb14=qs[_0xe7fa('0x24')](_0x8030c,_0x1939e0);return interaction[_0xe7fa('0x25')](_0xe7fa('0x26'),_0x1939e0[_0xe7fa('0x27')],_0x1939e0['user'],_0x50fb14,_0x8030c)[_0xe7fa('0x19')](respondWithFilteredResult(_0x34fec6,_0x50fb14))[_0xe7fa('0x28')](handleError(_0x34fec6,null));};exports['show']=function(_0x53f478,_0x397808){var _0x20755c={'raw':![],'where':{'id':_0x53f478[_0xe7fa('0x29')]['id']}},_0x5a1784={};_0x5a1784[_0xe7fa('0x2a')]=_[_0xe7fa('0x2b')](db[_0xe7fa('0x20')][_0xe7fa('0x21')]);_0x5a1784[_0xe7fa('0x27')]=_[_0xe7fa('0x2b')](_0x53f478['query']);_0x5a1784['filters']=_[_0xe7fa('0x2c')](_0x5a1784[_0xe7fa('0x2a')],_0x5a1784[_0xe7fa('0x27')]);_0x20755c[_0xe7fa('0x2d')]=_['intersection'](_0x5a1784[_0xe7fa('0x2a')],qs[_0xe7fa('0x2e')](_0x53f478[_0xe7fa('0x27')]['fields']));_0x20755c[_0xe7fa('0x2d')]=_0x20755c[_0xe7fa('0x2d')][_0xe7fa('0x2f')]?_0x20755c[_0xe7fa('0x2d')]:_0x5a1784[_0xe7fa('0x2a')];if(_0x53f478[_0xe7fa('0x27')][_0xe7fa('0x30')]){_0x20755c[_0xe7fa('0x31')]=[{'all':!![]}];}_0x20755c=_['merge']({},_0x20755c,_0x53f478[_0xe7fa('0x32')]);return db[_0xe7fa('0x20')][_0xe7fa('0x33')](_0x20755c)[_0xe7fa('0x19')](handleEntityNotFound(_0x397808,null))[_0xe7fa('0x19')](respondWithResult(_0x397808,null))[_0xe7fa('0x28')](handleError(_0x397808,null));};exports[_0xe7fa('0x34')]=function(_0xbe9a21,_0x2d60f1){return db[_0xe7fa('0x20')]['create'](_0xbe9a21[_0xe7fa('0x35')],{})['then'](respondWithResult(_0x2d60f1,0xc9))['catch'](handleError(_0x2d60f1,null));};exports[_0xe7fa('0x36')]=function(_0x4408ea,_0x3762bc){if(_0x4408ea['body']['id']){delete _0x4408ea[_0xe7fa('0x35')]['id'];}return db[_0xe7fa('0x20')][_0xe7fa('0x33')]({'where':{'id':_0x4408ea[_0xe7fa('0x29')]['id']}})['then'](handleEntityNotFound(_0x3762bc,null))[_0xe7fa('0x19')](saveUpdates(_0x4408ea[_0xe7fa('0x35')],null))[_0xe7fa('0x19')](respondWithResult(_0x3762bc,null))[_0xe7fa('0x28')](handleError(_0x3762bc,null));};exports[_0xe7fa('0x1a')]=function(_0x1a49e6,_0x2695bb){return db[_0xe7fa('0x20')][_0xe7fa('0x33')]({'where':{'id':_0x1a49e6[_0xe7fa('0x29')]['id']}})[_0xe7fa('0x19')](handleEntityNotFound(_0x2695bb,null))['then'](removeEntity(_0x2695bb,null))['catch'](handleError(_0x2695bb,null));};exports[_0xe7fa('0x37')]=function(_0xfabcb0,_0xcf6c01){return db['MailInteraction'][_0xe7fa('0x37')]()[_0xe7fa('0x19')](respondWithResult(_0xcf6c01,null))[_0xe7fa('0x28')](handleError(_0xcf6c01,null));};exports[_0xe7fa('0x38')]=function(_0x4e0086,_0x1ab412){return db['MailMessage'][_0xe7fa('0x33')]({'where':{'id':_0x4e0086[_0xe7fa('0x29')]['id']}})[_0xe7fa('0x19')](handleEntityNotFound(_0x1ab412,null))[_0xe7fa('0x19')](function(_0x57d421){if(_0x57d421){return _0x57d421['addMessage'](_0x4e0086['body'][_0xe7fa('0x39')],_[_0xe7fa('0x3a')](_0x4e0086[_0xe7fa('0x35')],['ids','id'])||{});}})[_0xe7fa('0x19')](respondWithResult(_0x1ab412,null))[_0xe7fa('0x28')](handleError(_0x1ab412,null));};exports[_0xe7fa('0x3b')]=function(_0x16527e,_0x44c584){var _0x440076={'raw':![],'where':{}};var _0x13f095={};var _0x2bf035={'count':0x0,'rows':[]};return db[_0xe7fa('0x20')][_0xe7fa('0x3c')]({'where':{'id':_0x16527e['params']['id']}})[_0xe7fa('0x19')](handleEntityNotFound(_0x44c584,null))[_0xe7fa('0x19')](function(_0x3ae994){if(_0x3ae994){_0x13f095[_0xe7fa('0x2a')]=_[_0xe7fa('0x2b')](db[_0xe7fa('0x3d')][_0xe7fa('0x21')]);_0x13f095['query']=_[_0xe7fa('0x2b')](_0x16527e['query']);_0x13f095['filters']=_['intersection'](_0x13f095[_0xe7fa('0x2a')],_0x13f095[_0xe7fa('0x27')]);_0x440076[_0xe7fa('0x2d')]=_['intersection'](_0x13f095[_0xe7fa('0x2a')],qs[_0xe7fa('0x2e')](_0x16527e['query'][_0xe7fa('0x2e')]));_0x440076[_0xe7fa('0x2d')]=_0x440076[_0xe7fa('0x2d')]['length']?_0x440076[_0xe7fa('0x2d')]:_0x13f095[_0xe7fa('0x2a')];if(!_0x16527e[_0xe7fa('0x27')][_0xe7fa('0x3e')](_0xe7fa('0x3f'))){_0x440076['limit']=qs['limit'](_0x16527e[_0xe7fa('0x27')][_0xe7fa('0x17')]);_0x440076['offset']=qs[_0xe7fa('0x15')](_0x16527e[_0xe7fa('0x27')][_0xe7fa('0x15')]);}_0x440076[_0xe7fa('0x40')]=qs['sort'](_0x16527e['query'][_0xe7fa('0x41')]);_0x440076[_0xe7fa('0x42')]=qs[_0xe7fa('0x43')](_[_0xe7fa('0x44')](_0x16527e[_0xe7fa('0x27')],_0x13f095[_0xe7fa('0x43')]));_0x440076[_0xe7fa('0x42')][_0xe7fa('0x45')]=_0x3ae994['id'];if(_0x16527e['query'][_0xe7fa('0x46')]){_0x440076[_0xe7fa('0x42')]=_[_0xe7fa('0x47')](_0x440076[_0xe7fa('0x42')],{'$or':_[_0xe7fa('0x1f')](_0x440076[_0xe7fa('0x2d')],function(_0xa2c944){var _0x4623d2={};_0x4623d2[_0xa2c944]={'$like':'%'+_0x16527e[_0xe7fa('0x27')][_0xe7fa('0x46')]+'%'};return _0x4623d2;})});}if(_0x16527e[_0xe7fa('0x27')][_0xe7fa('0x48')]){var _0x3c2948=_0x16527e[_0xe7fa('0x27')]['$gte']['split'](',');var _0x512f80={};_0x512f80[_0x3c2948[0x0]]={'$gte':moment(_0x3c2948[0x1])[_0xe7fa('0x49')](_0xe7fa('0x4a'))};_0x440076[_0xe7fa('0x42')]=_['merge'](_0x440076['where'],_0x512f80);}_0x440076=_[_0xe7fa('0x47')]({},_0x440076,_0x16527e[_0xe7fa('0x32')]);return db[_0xe7fa('0x3d')][_0xe7fa('0x4b')]({'where':_0x440076['where']})[_0xe7fa('0x19')](function(_0x1520c3){_0x2bf035['count']=_0x1520c3;if(_0x16527e[_0xe7fa('0x27')][_0xe7fa('0x30')]){_0x440076['include']=[{'all':!![]}];}return db[_0xe7fa('0x3d')][_0xe7fa('0x25')](_0x440076);})[_0xe7fa('0x19')](function(_0x30773c){if(_0x16527e[_0xe7fa('0x27')][_0xe7fa('0x4c')]===_0xe7fa('0x4d')){for(var _0x1c3f1d=0x0;_0x1c3f1d<_0x30773c['length'];_0x1c3f1d++){_0x30773c[_0x1c3f1d][_0xe7fa('0x35')]=juice(_0x30773c[_0x1c3f1d][_0xe7fa('0x35')]);}}_0x2bf035[_0xe7fa('0x4e')]=_0x30773c;return _0x2bf035;});}})[_0xe7fa('0x19')](respondWithFilteredResult(_0x44c584,_0x440076))[_0xe7fa('0x28')](handleError(_0x44c584,null));};exports[_0xe7fa('0x4f')]=function(_0x4f9249,_0x5733f2){return db[_0xe7fa('0x20')][_0xe7fa('0x33')]({'where':{'id':_0x4f9249[_0xe7fa('0x29')]['id']}})[_0xe7fa('0x19')](handleEntityNotFound(_0x5733f2,null))[_0xe7fa('0x19')](function(_0x4d0dd3){if(_0x4d0dd3){return _0x4d0dd3['setTags'](_0x4f9249[_0xe7fa('0x35')][_0xe7fa('0x39')],_['omit'](_0x4f9249['body'],[_0xe7fa('0x39'),'id'])||{})[_0xe7fa('0x50')](function(){return db['Tag'][_0xe7fa('0x25')]({'attributes':['id',_0xe7fa('0x1c'),'color'],'where':{'id':_0x4f9249[_0xe7fa('0x35')]['ids']}});})[_0xe7fa('0x19')](function(_0x27a095){socket[_0xe7fa('0x51')](_0xe7fa('0x52'),{'id':Number(_0x4f9249[_0xe7fa('0x29')]['id']),'tags':_0x27a095||[]});return{'id':Number(_0x4f9249[_0xe7fa('0x29')]['id']),'tags':_0x27a095||[]};});}})[_0xe7fa('0x19')](respondWithResult(_0x5733f2,null))[_0xe7fa('0x28')](handleError(_0x5733f2,null));};exports[_0xe7fa('0x53')]=function(_0x3e44f8,_0x1246cb){return db['MailInteraction'][_0xe7fa('0x33')]({'where':{'id':_0x3e44f8[_0xe7fa('0x29')]['id']}})['then'](handleEntityNotFound(_0x1246cb,null))[_0xe7fa('0x19')](function(_0x5c00a1){if(_0x5c00a1){return _0x5c00a1['removeTags'](_0x3e44f8[_0xe7fa('0x27')][_0xe7fa('0x39')]);}})[_0xe7fa('0x19')](respondWithStatusCode(_0x1246cb,null))['catch'](handleError(_0x1246cb,null));};exports[_0xe7fa('0x54')]=function(_0x152f81,_0x4c0502){var _0x31c9ea=moment()[_0xe7fa('0x55')]()[_0xe7fa('0x56')]();var _0x3f8432=path[_0xe7fa('0x57')](config['root'],'server','files','tmp');var _0x3b9aa1=path['join'](config[_0xe7fa('0x58')],_0xe7fa('0x59'),'files','attachments');var _0x3271f4=path[_0xe7fa('0x57')](_0x3f8432,_0x31c9ea);var _0x47a29d=util[_0xe7fa('0x49')](_0xe7fa('0x5a'),_0x152f81[_0xe7fa('0x29')]['id'],_0x31c9ea);var _0x429a65=path[_0xe7fa('0x57')](_0x3f8432,_0x47a29d);var _0x414f6d=[];if(_0x152f81[_0xe7fa('0x27')][_0xe7fa('0x5b')]){_0x414f6d[_0xe7fa('0x5c')]({'model':db['Attachment'],'as':_0xe7fa('0x5d'),'raw':!![]});}var _0x501b7a=[{'model':db[_0xe7fa('0x3d')],'as':_0xe7fa('0x5e'),'attributes':['id',_0xe7fa('0x35'),_0xe7fa('0x5f'),'to','cc',_0xe7fa('0x60'),_0xe7fa('0x61'),_0xe7fa('0x62')],'where':{'secret':![]},'order':qs[_0xe7fa('0x41')]('id'),'include':_0x414f6d}];return db[_0xe7fa('0x20')]['find']({'where':{'id':_0x152f81[_0xe7fa('0x29')]['id']},'include':_0x501b7a})[_0xe7fa('0x19')](handleEntityNotFound(_0x4c0502,null))[_0xe7fa('0x19')](function(_0x3fd66b){if(_0x3fd66b&&_0x3fd66b[_0xe7fa('0x5e')]){var _0xd52f71=_0x3fd66b[_0xe7fa('0x63')]({'plain':!![]});fs[_0xe7fa('0x64')](_0x3271f4);return BPromise[_0xe7fa('0x65')](_0xd52f71[_0xe7fa('0x5e')],function(_0x15c7f5,_0x248e67){var _0x2261c2={'from':_0x15c7f5['from'],'to':_0x15c7f5['to']||'missing.recipient@your.company.com','subject':_0x15c7f5[_0xe7fa('0x61')],'html':htmlEntities['decode'](_0x15c7f5[_0xe7fa('0x35')]),'headers':{'Date':moment(_0x15c7f5[_0xe7fa('0x62')])[_0xe7fa('0x49')](_0xe7fa('0x66'))},'attachments':[]};if(_0x15c7f5['cc']){_0x2261c2[_0xe7fa('0x67')]['Cc']=_0x15c7f5['cc'];}if(_0x15c7f5[_0xe7fa('0x60')]){_0x2261c2[_0xe7fa('0x67')][_0xe7fa('0x68')]=_0x15c7f5[_0xe7fa('0x60')];}return new BPromise(function(_0x9ff1df,_0x3a239b){if(_0x15c7f5[_0xe7fa('0x5d')]){for(var _0x5ddecc=0x0;_0x5ddecc<_0x15c7f5[_0xe7fa('0x5d')][_0xe7fa('0x2f')];_0x5ddecc++){var _0x52af8d=_0x15c7f5[_0xe7fa('0x5d')][_0x5ddecc];var _0x312b86=path[_0xe7fa('0x57')](_0x3b9aa1,_0x52af8d[_0xe7fa('0x69')]);if(fs['existsSync'](_0x312b86)){_0x2261c2[_0xe7fa('0x5b')]['push']({'name':_0x52af8d[_0xe7fa('0x1c')],'contentType':_0x52af8d[_0xe7fa('0x6a')],'data':fs[_0xe7fa('0x6b')](_0x312b86)});}}}emlformat['build'](_0x2261c2,function(_0x7262cd,_0x2c9921){if(_0x7262cd)return _0x3a239b(_0x7262cd);fs[_0xe7fa('0x6c')](path[_0xe7fa('0x57')](_0x3271f4,util['format'](_0xe7fa('0x6d'),_0x248e67)),_0x2c9921);return _0x9ff1df(_0x2c9921);});});})[_0xe7fa('0x19')](function(){return new BPromise(function(_0x3d6cfd,_0x240e63){zipdir(_0x3271f4,{'saveTo':_0x429a65},function(_0x39db9a,_0x55c0dc){if(_0x39db9a)return _0x240e63(_0x39db9a);return _0x3d6cfd(_0x55c0dc);});})[_0xe7fa('0x19')](function(){return new BPromise(function(_0x2bcb01,_0x39f426){rimraf(_0x3271f4,function(_0x512ab7){if(_0x512ab7)_0x39f426(_0x512ab7);return _0x2bcb01();});});})[_0xe7fa('0x19')](function(){return _0x4c0502['download'](_0x429a65,_0x47a29d,function(_0x1c86aa){if(!_0x1c86aa)fs[_0xe7fa('0x6e')](_0x429a65);});});});}else{return _0x4c0502[_0xe7fa('0x6f')](0xc8);}})[_0xe7fa('0x28')](handleError(_0x4c0502,null));}; \ No newline at end of file +var _0x8192=['mailInteractionTags:save','removeTags','download','unix','toString','join','root','server','tmp','files','attachments','transcript-%d-%s.zip','Attachments','Messages','from','bcc','subject','createdAt','mkdirSync','each','missing.recipient@your.company.com','headers','Bcc','basename','existsSync','push','readFileSync','build','writeFileSync','message%d.eml','unlinkSync','eml-format','rimraf','moment','util','lodash','juice','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','register','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','update','then','error','stack','name','index','map','type','key','getOptions','mail','user','catch','model','keys','MailInteraction','rawAttributes','query','filters','intersection','attributes','fields','include','options','find','create','body','params','destroy','describe','MailMessage','omit','ids','getMessages','length','hasOwnProperty','sort','where','MailInteractionId','filter','merge','$gte','split','format','includeAll','findAll','true','rows','spread','color','emit'];(function(_0x259f1b,_0x39f819){var _0x41d721=function(_0x368ce6){while(--_0x368ce6){_0x259f1b['push'](_0x259f1b['shift']());}};_0x41d721(++_0x39f819);}(_0x8192,0x169));var _0x2819=function(_0x51c639,_0x2517ab){_0x51c639=_0x51c639-0x0;var _0x187858=_0x8192[_0x51c639];return _0x187858;};'use strict';var emlformat=require(_0x2819('0x0'));var rimraf=require(_0x2819('0x1'));var zipdir=require('zip-dir');var moment=require(_0x2819('0x2'));var BPromise=require('bluebird');var util=require(_0x2819('0x3'));var path=require('path');var fs=require('fs');var _=require(_0x2819('0x4'));var juice=require(_0x2819('0x5'));var Redis=require(_0x2819('0x6'));var interaction=require(_0x2819('0x7'));var qs=require(_0x2819('0x8'));var logger=require('../../config/logger')(_0x2819('0x9'));var config=require(_0x2819('0xa'));var db=require(_0x2819('0xb'))['db'];var htmlEntities=require('html-entities');config[_0x2819('0xc')]=_[_0x2819('0xd')](config['redis'],{'host':_0x2819('0xe'),'port':0x18eb});var socket=require(_0x2819('0xf'))(new Redis(config['redis']));require(_0x2819('0x10'))[_0x2819('0x11')](socket);function respondWithStatusCode(_0x13aee1,_0x4927e4){_0x4927e4=_0x4927e4||0xcc;return function(_0x39eb98){if(_0x39eb98){return _0x13aee1[_0x2819('0x12')](_0x4927e4);}return _0x13aee1['status'](_0x4927e4)[_0x2819('0x13')]();};}function respondWithResult(_0x57815d,_0x21fcbf){_0x21fcbf=_0x21fcbf||0xc8;return function(_0x3c1fc2){if(_0x3c1fc2){return _0x57815d[_0x2819('0x14')](_0x21fcbf)[_0x2819('0x15')](_0x3c1fc2);}};}function respondWithFilteredResult(_0x113e9b,_0x3cc073){return function(_0x50c546){if(_0x50c546){var _0xd085bf=typeof _0x3cc073['offset']===_0x2819('0x16')&&typeof _0x3cc073[_0x2819('0x17')]===_0x2819('0x16');var _0x44cc1c=_0x50c546[_0x2819('0x18')];var _0x5dd6fd=_0xd085bf?0x0:_0x3cc073['offset'];var _0x34599d=_0xd085bf?_0x50c546['count']:_0x3cc073[_0x2819('0x19')]+_0x3cc073['limit'];var _0x15d9bf;if(_0x34599d>=_0x44cc1c){_0x34599d=_0x44cc1c;_0x15d9bf=0xc8;}else{_0x15d9bf=0xce;}_0x113e9b['status'](_0x15d9bf);return _0x113e9b[_0x2819('0x1a')](_0x2819('0x1b'),_0x5dd6fd+'-'+_0x34599d+'/'+_0x44cc1c)['json'](_0x50c546);}return null;};}function saveUpdates(_0x5513e0){return function(_0x178d65){if(_0x178d65){return _0x178d65[_0x2819('0x1c')](_0x5513e0)[_0x2819('0x1d')](function(_0x378887){return _0x378887;});}return null;};}function removeEntity(_0x497ce6){return function(_0x324786){if(_0x324786){return _0x324786['destroy']()[_0x2819('0x1d')](function(){_0x497ce6['status'](0xcc)[_0x2819('0x13')]();});}};}function handleEntityNotFound(_0x251121){return function(_0x5aeca3){if(!_0x5aeca3){_0x251121['sendStatus'](0x194);}return _0x5aeca3;};}function handleError(_0x271772,_0x4fe965){_0x4fe965=_0x4fe965||0x1f4;return function(_0x5940cd){logger[_0x2819('0x1e')](_0x5940cd[_0x2819('0x1f')]);if(_0x5940cd[_0x2819('0x20')]){delete _0x5940cd['name'];}_0x271772['status'](_0x4fe965)['send'](_0x5940cd);};}exports[_0x2819('0x21')]=function(_0xbf8c17,_0x1d7a46){var _0x40f559={};var _0x2e4f27=_[_0x2819('0x22')](db['MailInteraction']['rawAttributes'],function(_0x168d04){return{'name':_0x168d04['fieldName'],'type':_0x168d04[_0x2819('0x23')][_0x2819('0x24')]};});_0x40f559=qs[_0x2819('0x25')](_0x2e4f27,_0xbf8c17);return interaction['findAll'](_0x2819('0x26'),_0xbf8c17['query'],_0xbf8c17[_0x2819('0x27')],_0x40f559,_0x2e4f27)['then'](respondWithFilteredResult(_0x1d7a46,_0x40f559))[_0x2819('0x28')](handleError(_0x1d7a46,null));};exports['show']=function(_0x24c414,_0x1b833e){var _0x131fe2={'raw':![],'where':{'id':_0x24c414['params']['id']}},_0x248c5a={};_0x248c5a[_0x2819('0x29')]=_[_0x2819('0x2a')](db[_0x2819('0x2b')][_0x2819('0x2c')]);_0x248c5a[_0x2819('0x2d')]=_['keys'](_0x24c414[_0x2819('0x2d')]);_0x248c5a[_0x2819('0x2e')]=_[_0x2819('0x2f')](_0x248c5a['model'],_0x248c5a['query']);_0x131fe2[_0x2819('0x30')]=_[_0x2819('0x2f')](_0x248c5a[_0x2819('0x29')],qs[_0x2819('0x31')](_0x24c414[_0x2819('0x2d')]['fields']));_0x131fe2[_0x2819('0x30')]=_0x131fe2[_0x2819('0x30')]['length']?_0x131fe2['attributes']:_0x248c5a[_0x2819('0x29')];if(_0x24c414[_0x2819('0x2d')]['includeAll']){_0x131fe2[_0x2819('0x32')]=[{'all':!![]}];}_0x131fe2=_['merge']({},_0x131fe2,_0x24c414[_0x2819('0x33')]);return db[_0x2819('0x2b')][_0x2819('0x34')](_0x131fe2)['then'](handleEntityNotFound(_0x1b833e,null))[_0x2819('0x1d')](respondWithResult(_0x1b833e,null))[_0x2819('0x28')](handleError(_0x1b833e,null));};exports[_0x2819('0x35')]=function(_0x344850,_0x3688e3){return db[_0x2819('0x2b')][_0x2819('0x35')](_0x344850[_0x2819('0x36')],{})['then'](respondWithResult(_0x3688e3,0xc9))[_0x2819('0x28')](handleError(_0x3688e3,null));};exports[_0x2819('0x1c')]=function(_0x2eaaab,_0x55f61c){if(_0x2eaaab['body']['id']){delete _0x2eaaab[_0x2819('0x36')]['id'];}return db[_0x2819('0x2b')]['find']({'where':{'id':_0x2eaaab[_0x2819('0x37')]['id']}})[_0x2819('0x1d')](handleEntityNotFound(_0x55f61c,null))[_0x2819('0x1d')](saveUpdates(_0x2eaaab[_0x2819('0x36')],null))[_0x2819('0x1d')](respondWithResult(_0x55f61c,null))[_0x2819('0x28')](handleError(_0x55f61c,null));};exports[_0x2819('0x38')]=function(_0x163928,_0x40293d){return db[_0x2819('0x2b')][_0x2819('0x34')]({'where':{'id':_0x163928[_0x2819('0x37')]['id']}})[_0x2819('0x1d')](handleEntityNotFound(_0x40293d,null))['then'](removeEntity(_0x40293d,null))[_0x2819('0x28')](handleError(_0x40293d,null));};exports[_0x2819('0x39')]=function(_0xc8a111,_0x123310){return db[_0x2819('0x2b')][_0x2819('0x39')]()['then'](respondWithResult(_0x123310,null))[_0x2819('0x28')](handleError(_0x123310,null));};exports['addMessage']=function(_0x12b9e0,_0x1ec20f){return db[_0x2819('0x3a')][_0x2819('0x34')]({'where':{'id':_0x12b9e0[_0x2819('0x37')]['id']}})[_0x2819('0x1d')](handleEntityNotFound(_0x1ec20f,null))[_0x2819('0x1d')](function(_0x2ef9de){if(_0x2ef9de){return _0x2ef9de['addMessage'](_0x12b9e0[_0x2819('0x36')]['ids'],_[_0x2819('0x3b')](_0x12b9e0[_0x2819('0x36')],[_0x2819('0x3c'),'id'])||{});}})[_0x2819('0x1d')](respondWithResult(_0x1ec20f,null))[_0x2819('0x28')](handleError(_0x1ec20f,null));};exports[_0x2819('0x3d')]=function(_0x491c23,_0x1c142b){var _0x2a52b5={'raw':![],'where':{}};var _0x2bbbef={};var _0x8797e4={'count':0x0,'rows':[]};return db[_0x2819('0x2b')]['findOne']({'where':{'id':_0x491c23[_0x2819('0x37')]['id']}})[_0x2819('0x1d')](handleEntityNotFound(_0x1c142b,null))[_0x2819('0x1d')](function(_0x58380d){if(_0x58380d){_0x2bbbef[_0x2819('0x29')]=_[_0x2819('0x2a')](db['MailMessage'][_0x2819('0x2c')]);_0x2bbbef['query']=_[_0x2819('0x2a')](_0x491c23[_0x2819('0x2d')]);_0x2bbbef['filters']=_[_0x2819('0x2f')](_0x2bbbef['model'],_0x2bbbef[_0x2819('0x2d')]);_0x2a52b5[_0x2819('0x30')]=_['intersection'](_0x2bbbef[_0x2819('0x29')],qs['fields'](_0x491c23['query'][_0x2819('0x31')]));_0x2a52b5[_0x2819('0x30')]=_0x2a52b5[_0x2819('0x30')][_0x2819('0x3e')]?_0x2a52b5[_0x2819('0x30')]:_0x2bbbef['model'];if(!_0x491c23['query'][_0x2819('0x3f')]('nolimit')){_0x2a52b5['limit']=qs[_0x2819('0x17')](_0x491c23[_0x2819('0x2d')][_0x2819('0x17')]);_0x2a52b5[_0x2819('0x19')]=qs[_0x2819('0x19')](_0x491c23[_0x2819('0x2d')][_0x2819('0x19')]);}_0x2a52b5['order']=qs[_0x2819('0x40')](_0x491c23[_0x2819('0x2d')][_0x2819('0x40')]);_0x2a52b5['where']=qs[_0x2819('0x2e')](_['pick'](_0x491c23[_0x2819('0x2d')],_0x2bbbef[_0x2819('0x2e')]));_0x2a52b5[_0x2819('0x41')][_0x2819('0x42')]=_0x58380d['id'];if(_0x491c23['query'][_0x2819('0x43')]){_0x2a52b5[_0x2819('0x41')]=_[_0x2819('0x44')](_0x2a52b5[_0x2819('0x41')],{'$or':_[_0x2819('0x22')](_0x2a52b5[_0x2819('0x30')],function(_0x4b63fb){var _0x2e1f81={};_0x2e1f81[_0x4b63fb]={'$like':'%'+_0x491c23[_0x2819('0x2d')]['filter']+'%'};return _0x2e1f81;})});}if(_0x491c23[_0x2819('0x2d')][_0x2819('0x45')]){var _0x369b56=_0x491c23['query'][_0x2819('0x45')][_0x2819('0x46')](',');var _0x2d7c54={};_0x2d7c54[_0x369b56[0x0]]={'$gte':moment(_0x369b56[0x1])[_0x2819('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x2a52b5[_0x2819('0x41')]=_[_0x2819('0x44')](_0x2a52b5[_0x2819('0x41')],_0x2d7c54);}_0x2a52b5=_[_0x2819('0x44')]({},_0x2a52b5,_0x491c23['options']);return db[_0x2819('0x3a')][_0x2819('0x18')]({'where':_0x2a52b5[_0x2819('0x41')]})[_0x2819('0x1d')](function(_0x161c5b){_0x8797e4[_0x2819('0x18')]=_0x161c5b;if(_0x491c23['query'][_0x2819('0x48')]){_0x2a52b5[_0x2819('0x32')]=[{'all':!![]}];}return db[_0x2819('0x3a')][_0x2819('0x49')](_0x2a52b5);})[_0x2819('0x1d')](function(_0xaea670){if(_0x491c23[_0x2819('0x2d')]['inlineCss']===_0x2819('0x4a')){for(var _0x22f47c=0x0;_0x22f47c<_0xaea670[_0x2819('0x3e')];_0x22f47c++){_0xaea670[_0x22f47c][_0x2819('0x36')]=juice(_0xaea670[_0x22f47c][_0x2819('0x36')]);}}_0x8797e4[_0x2819('0x4b')]=_0xaea670;return _0x8797e4;});}})[_0x2819('0x1d')](respondWithFilteredResult(_0x1c142b,_0x2a52b5))[_0x2819('0x28')](handleError(_0x1c142b,null));};exports['addTags']=function(_0x3d6393,_0x5b6afa){return db['MailInteraction'][_0x2819('0x34')]({'where':{'id':_0x3d6393[_0x2819('0x37')]['id']}})[_0x2819('0x1d')](handleEntityNotFound(_0x5b6afa,null))[_0x2819('0x1d')](function(_0x27121f){if(_0x27121f){return _0x27121f['setTags'](_0x3d6393[_0x2819('0x36')]['ids'],_[_0x2819('0x3b')](_0x3d6393[_0x2819('0x36')],['ids','id'])||{})[_0x2819('0x4c')](function(){return db['Tag']['findAll']({'attributes':['id',_0x2819('0x20'),_0x2819('0x4d')],'where':{'id':_0x3d6393[_0x2819('0x36')][_0x2819('0x3c')]}});})[_0x2819('0x1d')](function(_0x56fcf0){socket[_0x2819('0x4e')](_0x2819('0x4f'),{'id':Number(_0x3d6393[_0x2819('0x37')]['id']),'tags':_0x56fcf0||[]});return{'id':Number(_0x3d6393[_0x2819('0x37')]['id']),'tags':_0x56fcf0||[]};});}})[_0x2819('0x1d')](respondWithResult(_0x5b6afa,null))[_0x2819('0x28')](handleError(_0x5b6afa,null));};exports['removeTags']=function(_0x3bc95d,_0x262a2b){return db[_0x2819('0x2b')]['find']({'where':{'id':_0x3bc95d[_0x2819('0x37')]['id']}})[_0x2819('0x1d')](handleEntityNotFound(_0x262a2b,null))[_0x2819('0x1d')](function(_0x2eb353){if(_0x2eb353){return _0x2eb353[_0x2819('0x50')](_0x3bc95d['query'][_0x2819('0x3c')]);}})[_0x2819('0x1d')](respondWithStatusCode(_0x262a2b,null))[_0x2819('0x28')](handleError(_0x262a2b,null));};exports[_0x2819('0x51')]=function(_0x5ba424,_0x16277d){var _0x4a75eb=moment()[_0x2819('0x52')]()[_0x2819('0x53')]();var _0x2b6ca2=path[_0x2819('0x54')](config[_0x2819('0x55')],_0x2819('0x56'),'files',_0x2819('0x57'));var _0x4f0187=path[_0x2819('0x54')](config[_0x2819('0x55')],_0x2819('0x56'),_0x2819('0x58'),_0x2819('0x59'));var _0x2fad7d=path[_0x2819('0x54')](_0x2b6ca2,_0x4a75eb);var _0x95f51f=util[_0x2819('0x47')](_0x2819('0x5a'),_0x5ba424[_0x2819('0x37')]['id'],_0x4a75eb);var _0x2ba793=path[_0x2819('0x54')](_0x2b6ca2,_0x95f51f);var _0xd7ea8d=[];if(_0x5ba424[_0x2819('0x2d')][_0x2819('0x59')]){_0xd7ea8d['push']({'model':db['Attachment'],'as':_0x2819('0x5b'),'raw':!![]});}var _0x24e1da=[{'model':db['MailMessage'],'as':_0x2819('0x5c'),'attributes':['id',_0x2819('0x36'),_0x2819('0x5d'),'to','cc',_0x2819('0x5e'),_0x2819('0x5f'),_0x2819('0x60')],'where':{'secret':![]},'order':qs[_0x2819('0x40')]('id'),'include':_0xd7ea8d}];return db[_0x2819('0x2b')][_0x2819('0x34')]({'where':{'id':_0x5ba424[_0x2819('0x37')]['id']},'include':_0x24e1da})['then'](handleEntityNotFound(_0x16277d,null))['then'](function(_0x325e53){if(_0x325e53&&_0x325e53[_0x2819('0x5c')]){var _0x8a9d13=_0x325e53['get']({'plain':!![]});fs[_0x2819('0x61')](_0x2fad7d);return BPromise[_0x2819('0x62')](_0x8a9d13['Messages'],function(_0x50e685,_0x3614d6){var _0x4bf21c={'from':_0x50e685[_0x2819('0x5d')],'to':_0x50e685['to']||_0x2819('0x63'),'subject':_0x50e685[_0x2819('0x5f')],'html':htmlEntities['decode'](_0x50e685[_0x2819('0x36')]),'headers':{'Date':moment(_0x50e685[_0x2819('0x60')])[_0x2819('0x47')]('ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ')},'attachments':[]};if(_0x50e685['cc']){_0x4bf21c[_0x2819('0x64')]['Cc']=_0x50e685['cc'];}if(_0x50e685[_0x2819('0x5e')]){_0x4bf21c['headers'][_0x2819('0x65')]=_0x50e685['bcc'];}return new BPromise(function(_0x84223a,_0x324360){if(_0x50e685['Attachments']){for(var _0x352f3f=0x0;_0x352f3f<_0x50e685[_0x2819('0x5b')]['length'];_0x352f3f++){var _0x482ecd=_0x50e685[_0x2819('0x5b')][_0x352f3f];var _0x59bd2e=path[_0x2819('0x54')](_0x4f0187,_0x482ecd[_0x2819('0x66')]);if(fs[_0x2819('0x67')](_0x59bd2e)){_0x4bf21c[_0x2819('0x59')][_0x2819('0x68')]({'name':_0x482ecd[_0x2819('0x20')],'contentType':_0x482ecd[_0x2819('0x23')],'data':fs[_0x2819('0x69')](_0x59bd2e)});}}}emlformat[_0x2819('0x6a')](_0x4bf21c,function(_0x2536aa,_0x58e692){if(_0x2536aa)return _0x324360(_0x2536aa);fs[_0x2819('0x6b')](path['join'](_0x2fad7d,util[_0x2819('0x47')](_0x2819('0x6c'),_0x3614d6)),_0x58e692);return _0x84223a(_0x58e692);});});})[_0x2819('0x1d')](function(){return new BPromise(function(_0x9ba073,_0x3d1ef3){zipdir(_0x2fad7d,{'saveTo':_0x2ba793},function(_0x2c2898,_0x502d84){if(_0x2c2898)return _0x3d1ef3(_0x2c2898);return _0x9ba073(_0x502d84);});})[_0x2819('0x1d')](function(){return new BPromise(function(_0x4ab01e,_0x32d09b){rimraf(_0x2fad7d,function(_0x11e1bd){if(_0x11e1bd)_0x32d09b(_0x11e1bd);return _0x4ab01e();});});})[_0x2819('0x1d')](function(){return _0x16277d[_0x2819('0x51')](_0x2ba793,_0x95f51f,function(_0x37d57f){if(!_0x37d57f)fs[_0x2819('0x6d')](_0x2ba793);});});});}else{return _0x16277d[_0x2819('0x12')](0xc8);}})['catch'](handleError(_0x16277d,null));}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.events.js b/server/api/mailInteraction/mailInteraction.events.js index 155868b..2a1689a 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 _0x4f38=['save','update','remove','setDataValue','map','findAll','then','unreadMessages','length','catch','hook','exports','events','MailInteraction','../../mysqldb','MailMessage','setMaxListeners'];(function(_0xbd8972,_0x441803){var _0x4ebd73=function(_0x36f655){while(--_0x36f655){_0xbd8972['push'](_0xbd8972['shift']());}};_0x4ebd73(++_0x441803);}(_0x4f38,0x11c));var _0x84f3=function(_0xecd913,_0x2974e7){_0xecd913=_0xecd913-0x0;var _0x531174=_0x4f38[_0xecd913];return _0x531174;};'use strict';var EventEmitter=require(_0x84f3('0x0'));var MailInteraction=require('../../mysqldb')['db'][_0x84f3('0x1')];var MailMessage=require(_0x84f3('0x2'))['db'][_0x84f3('0x3')];var MailInteractionEvents=new EventEmitter();MailInteractionEvents[_0x84f3('0x4')](0x0);var events={'afterCreate':_0x84f3('0x5'),'afterUpdate':_0x84f3('0x6'),'afterDestroy':_0x84f3('0x7')};function emitEvent(_0x101dfb){return function(_0x4b8e02,_0x3015a1,_0x4a27e5){_0x4b8e02['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x3e55e2){_0x4b8e02[_0x84f3('0x8')]('Users',_0x3e55e2[_0x84f3('0x9')](function(_0x4e06d3){return{'id':_0x4e06d3['id']};}));return MailMessage[_0x84f3('0xa')]({'where':{'MailInteractionId':_0x4b8e02['id'],'direction':'in','read':![]},'raw':!![]});})[_0x84f3('0xb')](function(_0x280dd5){_0x4b8e02[_0x84f3('0x8')](_0x84f3('0xc'),_0x280dd5[_0x84f3('0xd')]);MailInteractionEvents['emit'](_0x101dfb+':'+_0x4b8e02['id'],_0x4b8e02);MailInteractionEvents['emit'](_0x101dfb,_0x4b8e02);_0x4a27e5(null);})[_0x84f3('0xe')](_0x4a27e5(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x84f3('0xf')](e,emitEvent(event));}}module[_0x84f3('0x10')]=MailInteractionEvents; \ No newline at end of file +var _0xb325=['then','setDataValue','Users','unreadMessages','catch','hook','exports','MailInteraction','save','update','remove','getUsers'];(function(_0x476830,_0x42506e){var _0x47b065=function(_0x46aa52){while(--_0x46aa52){_0x476830['push'](_0x476830['shift']());}};_0x47b065(++_0x42506e);}(_0xb325,0xbb));var _0x5b32=function(_0xa5d1b5,_0x30967b){_0xa5d1b5=_0xa5d1b5-0x0;var _0x5c1ef8=_0xb325[_0xa5d1b5];return _0x5c1ef8;};'use strict';var EventEmitter=require('events');var MailInteraction=require('../../mysqldb')['db'][_0x5b32('0x0')];var MailMessage=require('../../mysqldb')['db']['MailMessage'];var MailInteractionEvents=new EventEmitter();MailInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5b32('0x1'),'afterUpdate':_0x5b32('0x2'),'afterDestroy':_0x5b32('0x3')};function emitEvent(_0x372a4a){return function(_0x5619d3,_0x591336,_0x8521a8){_0x5619d3[_0x5b32('0x4')]({'attributes':['id'],'raw':!![]})[_0x5b32('0x5')](function(_0x5eb2b1){_0x5619d3[_0x5b32('0x6')](_0x5b32('0x7'),_0x5eb2b1['map'](function(_0x40cec5){return{'id':_0x40cec5['id']};}));return MailMessage['findAll']({'where':{'MailInteractionId':_0x5619d3['id'],'direction':'in','read':![]},'raw':!![]});})['then'](function(_0x34c1b5){_0x5619d3[_0x5b32('0x6')](_0x5b32('0x8'),_0x34c1b5['length']);MailInteractionEvents['emit'](_0x372a4a+':'+_0x5619d3['id'],_0x5619d3);MailInteractionEvents['emit'](_0x372a4a,_0x5619d3);_0x8521a8(null);})[_0x5b32('0x9')](_0x8521a8(null));};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];MailInteraction[_0x5b32('0xa')](e,emitEvent(event));}}module[_0x5b32('0xb')]=MailInteractionEvents; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.model.js b/server/api/mailInteraction/mailInteraction.model.js index e9b6f2d..b7e41b2 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 _0xb002=['FULLTEXT','substatus','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','format','changed','substatusAt','models','update','catch','utf8mb4','utf8mb4_unicode_ci','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./mailInteraction.attributes','define','mail_interactions','subject'];(function(_0x250de2,_0x2a85ec){var _0x3d6b80=function(_0x595709){while(--_0x595709){_0x250de2['push'](_0x250de2['shift']());}};_0x3d6b80(++_0x2a85ec);}(_0xb002,0x12d));var _0x2b00=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb002[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x2b00('0x0'))(_0x2b00('0x1'));var moment=require(_0x2b00('0x2'));var BPromise=require(_0x2b00('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2b00('0x4'));var rimraf=require(_0x2b00('0x5'));var config=require(_0x2b00('0x6'));var attributes=require(_0x2b00('0x7'));module['exports']=function(_0x398e41,_0x452bf0){return _0x398e41[_0x2b00('0x8')]('MailInteraction',attributes,{'tableName':_0x2b00('0x9'),'paranoid':![],'indexes':[{'name':'fti_mail_interactions','fields':[_0x2b00('0xa'),'to'],'type':_0x2b00('0xb')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x195bf2,_0x4db935,_0x3b43cd){if(_0x195bf2[_0x2b00('0xc')]){_0x195bf2['substatusAt']=moment()['format'](_0x2b00('0xd'));}if(_0x195bf2[_0x2b00('0xe')]){_0x195bf2[_0x2b00('0xf')]=moment()[_0x2b00('0x10')](_0x2b00('0xd'));}_0x3b43cd(null,_0x4db935);},'beforeUpdate':function(_0x43e786,_0x53415f,_0x109673){if(_0x43e786[_0x2b00('0x11')]('substatus')){_0x43e786[_0x2b00('0x12')]=_0x43e786[_0x2b00('0xc')]?moment()[_0x2b00('0x10')](_0x2b00('0xd')):null;}if(_0x43e786['changed'](_0x2b00('0xe'))){_0x43e786[_0x2b00('0xf')]=moment()['format'](_0x2b00('0xd'));_0x43e786[_0x2b00('0xc')]=null;_0x43e786[_0x2b00('0x12')]=null;}_0x109673(null,_0x43e786);},'afterUpdate':function(_0x359db8,_0x286487,_0x58e1ff){var _0xc60f0a=_0x398e41[_0x2b00('0x13')];var _0x37ffce=_0x359db8['get']({'plain':!![]});if(_0x37ffce[_0x2b00('0xe')]){return _0xc60f0a['MailMessage'][_0x2b00('0x14')]({'read':!![]},{'where':{'MailInteractionId':_0x37ffce['id']}})['then'](function(){_0x58e1ff();})[_0x2b00('0x15')](function(_0x5c5929){_0x58e1ff(_0x5c5929);});}else{_0x58e1ff();}}},'charset':_0x2b00('0x16'),'collate':_0x2b00('0x17')});}; \ No newline at end of file +var _0xe30a=['rimraf','../../config/environment','./mailInteraction.attributes','exports','define','MailInteraction','mail_interactions','fti_mail_interactions','FULLTEXT','substatus','substatusAt','format','YYYY-MM-DD\x20HH:mm:ss','changed','closed','models','get','MailMessage','update','then','catch','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x803331,_0x2fe25e){var _0x4ed9c=function(_0x5440a3){while(--_0x5440a3){_0x803331['push'](_0x803331['shift']());}};_0x4ed9c(++_0x2fe25e);}(_0xe30a,0x69));var _0xae30=function(_0x1f8204,_0x4e7a20){_0x1f8204=_0x1f8204-0x0;var _0x411cd4=_0xe30a[_0x1f8204];return _0x411cd4;};'use strict';var _=require(_0xae30('0x0'));var util=require(_0xae30('0x1'));var logger=require(_0xae30('0x2'))(_0xae30('0x3'));var moment=require(_0xae30('0x4'));var BPromise=require(_0xae30('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xae30('0x6'));var rimraf=require(_0xae30('0x7'));var config=require(_0xae30('0x8'));var attributes=require(_0xae30('0x9'));module[_0xae30('0xa')]=function(_0xc9fb84,_0x3cb3b8){return _0xc9fb84[_0xae30('0xb')](_0xae30('0xc'),attributes,{'tableName':_0xae30('0xd'),'paranoid':![],'indexes':[{'name':_0xae30('0xe'),'fields':['subject','to'],'type':_0xae30('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x18b921,_0x866f05,_0x98d00d){if(_0x18b921[_0xae30('0x10')]){_0x18b921[_0xae30('0x11')]=moment()[_0xae30('0x12')](_0xae30('0x13'));}if(_0x18b921['closed']){_0x18b921['closedAt']=moment()['format'](_0xae30('0x13'));}_0x98d00d(null,_0x866f05);},'beforeUpdate':function(_0x11316e,_0x1103da,_0x21c170){if(_0x11316e['changed'](_0xae30('0x10'))){_0x11316e[_0xae30('0x11')]=_0x11316e[_0xae30('0x10')]?moment()[_0xae30('0x12')](_0xae30('0x13')):null;}if(_0x11316e[_0xae30('0x14')](_0xae30('0x15'))){_0x11316e['closedAt']=moment()[_0xae30('0x12')](_0xae30('0x13'));_0x11316e['substatus']=null;_0x11316e[_0xae30('0x11')]=null;}_0x21c170(null,_0x11316e);},'afterUpdate':function(_0x31dab1,_0x242a58,_0x52edd9){var _0x586975=_0xc9fb84[_0xae30('0x16')];var _0xc39a02=_0x31dab1[_0xae30('0x17')]({'plain':!![]});if(_0xc39a02[_0xae30('0x15')]){return _0x586975[_0xae30('0x18')][_0xae30('0x19')]({'read':!![]},{'where':{'MailInteractionId':_0xc39a02['id']}})[_0xae30('0x1a')](function(){_0x52edd9();})[_0xae30('0x1b')](function(_0x3ec998){_0x52edd9(_0x3ec998);});}else{_0x52edd9();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.rpc.js b/server/api/mailInteraction/mailInteraction.rpc.js index 4eada7c..66105dc 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 _0x7567=['MailInteraction,\x20%s,\x20%s,\x20%s','stringify','error','MailInteraction,\x20%s,\x20%s','message','result','catch','UpdateMailInteraction','MailInteraction','update','options','where','attributes','debug','AddTagsToMailInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./mailInteraction.socket','request','then','info','request\x20sent'];(function(_0x5e2152,_0x172f3d){var _0x5ddcf6=function(_0x30a5cc){while(--_0x30a5cc){_0x5e2152['push'](_0x5e2152['shift']());}};_0x5ddcf6(++_0x172f3d);}(_0x7567,0x143));var _0x7756=function(_0x2f772b,_0x435228){_0x2f772b=_0x2f772b-0x0;var _0x4439ad=_0x7567[_0x2f772b];return _0x4439ad;};'use strict';var _=require(_0x7756('0x0'));var util=require(_0x7756('0x1'));var moment=require(_0x7756('0x2'));var BPromise=require(_0x7756('0x3'));var rs=require(_0x7756('0x4'));var fs=require('fs');var Redis=require(_0x7756('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x7756('0x6'));var logger=require(_0x7756('0x7'))(_0x7756('0x8'));var config=require(_0x7756('0x9'));var jayson=require(_0x7756('0xa'));var client=jayson['client'][_0x7756('0xb')]({'port':0x232a});config[_0x7756('0xc')]=_[_0x7756('0xd')](config[_0x7756('0xc')],{'host':_0x7756('0xe'),'port':0x18eb});var socket=require(_0x7756('0xf'))(new Redis(config[_0x7756('0xc')]));require(_0x7756('0x10'))['register'](socket);function respondWithRpcPromise(_0x58d891,_0x4f0081,_0x217251){return new BPromise(function(_0x59387c,_0x5ca726){return client[_0x7756('0x11')](_0x58d891,_0x217251)[_0x7756('0x12')](function(_0x23e939){logger[_0x7756('0x13')]('MailInteraction,\x20%s,\x20%s',_0x4f0081,_0x7756('0x14'));logger['debug'](_0x7756('0x15'),_0x4f0081,_0x7756('0x14'),JSON[_0x7756('0x16')](_0x23e939));if(_0x23e939[_0x7756('0x17')]){if(_0x23e939[_0x7756('0x17')]['code']===0x1f4){logger[_0x7756('0x17')](_0x7756('0x18'),_0x4f0081,_0x23e939[_0x7756('0x17')][_0x7756('0x19')]);return _0x5ca726(_0x23e939['error'][_0x7756('0x19')]);}logger[_0x7756('0x17')]('MailInteraction,\x20%s,\x20%s',_0x4f0081,_0x23e939[_0x7756('0x17')][_0x7756('0x19')]);return _0x59387c(_0x23e939[_0x7756('0x17')][_0x7756('0x19')]);}else{logger[_0x7756('0x13')](_0x7756('0x18'),_0x4f0081,'request\x20sent');_0x59387c(_0x23e939[_0x7756('0x1a')][_0x7756('0x19')]);}})[_0x7756('0x1b')](function(_0x10964a){logger['error']('MailInteraction,\x20%s,\x20%s',_0x4f0081,_0x10964a);_0x5ca726(_0x10964a);});});}exports[_0x7756('0x1c')]=function(_0x430ecd){var _0x432776=this;return new Promise(function(_0x34937a,_0x3c1be5){return db[_0x7756('0x1d')][_0x7756('0x1e')](_0x430ecd['body'],{'raw':_0x430ecd[_0x7756('0x1f')]?_0x430ecd[_0x7756('0x1f')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x430ecd[_0x7756('0x1f')]?_0x430ecd[_0x7756('0x1f')][_0x7756('0x20')]||null:null,'attributes':_0x430ecd['options']?_0x430ecd['options'][_0x7756('0x21')]||null:null,'limit':_0x430ecd[_0x7756('0x1f')]?_0x430ecd[_0x7756('0x1f')]['limit']||null:null})[_0x7756('0x12')](function(_0x4aa883){logger[_0x7756('0x13')](_0x7756('0x1c'),_0x430ecd);logger[_0x7756('0x22')](_0x7756('0x1c'),_0x430ecd,JSON[_0x7756('0x16')](_0x4aa883));_0x34937a(_0x4aa883);})[_0x7756('0x1b')](function(_0x4b3712){logger[_0x7756('0x17')](_0x7756('0x1c'),_0x4b3712[_0x7756('0x19')],_0x430ecd);_0x3c1be5(_0x432776['error'](0x1f4,_0x4b3712['message']));});});};exports[_0x7756('0x23')]=function(_0x11fbea){return new Promise(function(_0x284fe9,_0x149d30){return db[_0x7756('0x1d')][_0x7756('0x24')]({'where':_0x11fbea[_0x7756('0x1f')]?_0x11fbea[_0x7756('0x1f')]['where']||null:null})['then'](function(_0x292e91){if(_0x292e91){return _0x292e91[_0x7756('0x25')](_0x11fbea[_0x7756('0x26')][_0x7756('0x27')],_[_0x7756('0x28')](_0x11fbea[_0x7756('0x26')],[_0x7756('0x27'),'id'])||{});}})[_0x7756('0x29')](function(_0x539fb0){logger[_0x7756('0x13')](_0x7756('0x2a'),_0x11fbea);logger[_0x7756('0x22')](_0x7756('0x2a'),_0x11fbea,JSON['stringify'](_0x539fb0));_0x284fe9(_0x539fb0);})['catch'](function(_0xdecc6c){logger[_0x7756('0x17')]('AddTags',_0xdecc6c['message'],_0x11fbea);_0x149d30(_this[_0x7756('0x17')](0x1f4,_0xdecc6c[_0x7756('0x19')]));});});}; \ No newline at end of file +var _0xf8cc=['client','http','redis','localhost','socket.io-emitter','./mailInteraction.socket','register','request','then','debug','MailInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','MailInteraction,\x20%s,\x20%s','message','info','result','catch','UpdateMailInteraction','MailInteraction','update','options','raw','where','attributes','AddTagsToMailInteraction','find','addTags','body','ids','omit','spread','AddTags','lodash','util','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise'];(function(_0x2199f7,_0x4f6410){var _0x6efa6a=function(_0x1d2362){while(--_0x1d2362){_0x2199f7['push'](_0x2199f7['shift']());}};_0x6efa6a(++_0x4f6410);}(_0xf8cc,0x173));var _0xcf8c=function(_0x2290d8,_0x130253){_0x2290d8=_0x2290d8-0x0;var _0x1c0bb1=_0xf8cc[_0x2290d8];return _0x1c0bb1;};'use strict';var _=require(_0xcf8c('0x0'));var util=require(_0xcf8c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xcf8c('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xcf8c('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xcf8c('0x4'))('rpc');var config=require(_0xcf8c('0x5'));var jayson=require(_0xcf8c('0x6'));var client=jayson[_0xcf8c('0x7')][_0xcf8c('0x8')]({'port':0x232a});config[_0xcf8c('0x9')]=_['defaults'](config[_0xcf8c('0x9')],{'host':_0xcf8c('0xa'),'port':0x18eb});var socket=require(_0xcf8c('0xb'))(new Redis(config['redis']));require(_0xcf8c('0xc'))[_0xcf8c('0xd')](socket);function respondWithRpcPromise(_0x559a0a,_0x11e6cd,_0x2692fb){return new BPromise(function(_0x3a1e3d,_0x2fa46d){return client[_0xcf8c('0xe')](_0x559a0a,_0x2692fb)[_0xcf8c('0xf')](function(_0x55ed7e){logger['info']('MailInteraction,\x20%s,\x20%s',_0x11e6cd,'request\x20sent');logger[_0xcf8c('0x10')](_0xcf8c('0x11'),_0x11e6cd,_0xcf8c('0x12'),JSON[_0xcf8c('0x13')](_0x55ed7e));if(_0x55ed7e[_0xcf8c('0x14')]){if(_0x55ed7e[_0xcf8c('0x14')][_0xcf8c('0x15')]===0x1f4){logger[_0xcf8c('0x14')](_0xcf8c('0x16'),_0x11e6cd,_0x55ed7e['error'][_0xcf8c('0x17')]);return _0x2fa46d(_0x55ed7e[_0xcf8c('0x14')][_0xcf8c('0x17')]);}logger[_0xcf8c('0x14')](_0xcf8c('0x16'),_0x11e6cd,_0x55ed7e[_0xcf8c('0x14')][_0xcf8c('0x17')]);return _0x3a1e3d(_0x55ed7e[_0xcf8c('0x14')][_0xcf8c('0x17')]);}else{logger[_0xcf8c('0x18')](_0xcf8c('0x16'),_0x11e6cd,'request\x20sent');_0x3a1e3d(_0x55ed7e[_0xcf8c('0x19')][_0xcf8c('0x17')]);}})[_0xcf8c('0x1a')](function(_0x27425a){logger[_0xcf8c('0x14')]('MailInteraction,\x20%s,\x20%s',_0x11e6cd,_0x27425a);_0x2fa46d(_0x27425a);});});}exports[_0xcf8c('0x1b')]=function(_0x93c1ac){var _0x1ce11d=this;return new Promise(function(_0x2ea2fa,_0x345988){return db[_0xcf8c('0x1c')][_0xcf8c('0x1d')](_0x93c1ac['body'],{'raw':_0x93c1ac[_0xcf8c('0x1e')]?_0x93c1ac['options'][_0xcf8c('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x93c1ac[_0xcf8c('0x1e')]?_0x93c1ac[_0xcf8c('0x1e')][_0xcf8c('0x20')]||null:null,'attributes':_0x93c1ac[_0xcf8c('0x1e')]?_0x93c1ac[_0xcf8c('0x1e')][_0xcf8c('0x21')]||null:null,'limit':_0x93c1ac[_0xcf8c('0x1e')]?_0x93c1ac[_0xcf8c('0x1e')]['limit']||null:null})[_0xcf8c('0xf')](function(_0x209e38){logger[_0xcf8c('0x18')](_0xcf8c('0x1b'),_0x93c1ac);logger[_0xcf8c('0x10')](_0xcf8c('0x1b'),_0x93c1ac,JSON['stringify'](_0x209e38));_0x2ea2fa(_0x209e38);})[_0xcf8c('0x1a')](function(_0x27ad73){logger['error']('UpdateMailInteraction',_0x27ad73[_0xcf8c('0x17')],_0x93c1ac);_0x345988(_0x1ce11d['error'](0x1f4,_0x27ad73[_0xcf8c('0x17')]));});});};exports[_0xcf8c('0x22')]=function(_0x43f63b){return new Promise(function(_0x200d78,_0x4e2c21){return db['MailInteraction'][_0xcf8c('0x23')]({'where':_0x43f63b[_0xcf8c('0x1e')]?_0x43f63b[_0xcf8c('0x1e')]['where']||null:null})[_0xcf8c('0xf')](function(_0x24f3ae){if(_0x24f3ae){return _0x24f3ae[_0xcf8c('0x24')](_0x43f63b[_0xcf8c('0x25')][_0xcf8c('0x26')],_[_0xcf8c('0x27')](_0x43f63b[_0xcf8c('0x25')],[_0xcf8c('0x26'),'id'])||{});}})[_0xcf8c('0x28')](function(_0x5086be){logger[_0xcf8c('0x18')](_0xcf8c('0x29'),_0x43f63b);logger[_0xcf8c('0x10')]('AddTags',_0x43f63b,JSON['stringify'](_0x5086be));_0x200d78(_0x5086be);})[_0xcf8c('0x1a')](function(_0x224a48){logger['error'](_0xcf8c('0x29'),_0x224a48[_0xcf8c('0x17')],_0x43f63b);_0x4e2c21(_this[_0xcf8c('0x14')](0x1f4,_0x224a48[_0xcf8c('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/mailInteraction/mailInteraction.socket.js b/server/api/mailInteraction/mailInteraction.socket.js index e17123d..29b8398 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 _0x774a=['remove','update','removeListener','length','mailInteraction:'];(function(_0x15e289,_0x4d75f5){var _0x477c37=function(_0x36d9b0){while(--_0x36d9b0){_0x15e289['push'](_0x15e289['shift']());}};_0x477c37(++_0x4d75f5);}(_0x774a,0xd2));var _0xa774=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x774a[_0x19e35c];return _0x3e1fe8;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0xa774('0x0'),_0xa774('0x1')];function createListener(_0x386850,_0x28aefe){return function(_0x17bca8){_0x28aefe['emit'](_0x386850,_0x17bca8);};}function removeListener(_0x33b458,_0x20ff8c){return function(){MailInteractionEvents[_0xa774('0x2')](_0x33b458,_0x20ff8c);};}exports['register']=function(_0x42ec0e){for(var _0x5221f9=0x0,_0x27313b=events[_0xa774('0x3')];_0x5221f9<_0x27313b;_0x5221f9++){var _0x10573d=events[_0x5221f9];var _0x3941f5=createListener(_0xa774('0x4')+_0x10573d,_0x42ec0e);MailInteractionEvents['on'](_0x10573d,_0x3941f5);}}; \ No newline at end of file +var _0xd307=['remove','emit','removeListener','length','mailInteraction:'];(function(_0x8be82a,_0x500216){var _0x5f3cb5=function(_0xd50b3){while(--_0xd50b3){_0x8be82a['push'](_0x8be82a['shift']());}};_0x5f3cb5(++_0x500216);}(_0xd307,0xa0));var _0x7d30=function(_0xf6af1f,_0x23fd02){_0xf6af1f=_0xf6af1f-0x0;var _0x5d72f8=_0xd307[_0xf6af1f];return _0x5d72f8;};'use strict';var MailInteractionEvents=require('./mailInteraction.events');var events=['save',_0x7d30('0x0'),'update'];function createListener(_0x3d405e,_0x36c6d){return function(_0x260cbc){_0x36c6d[_0x7d30('0x1')](_0x3d405e,_0x260cbc);};}function removeListener(_0x370bb3,_0x390ba8){return function(){MailInteractionEvents[_0x7d30('0x2')](_0x370bb3,_0x390ba8);};}exports['register']=function(_0x14f440){for(var _0xfe31bf=0x0,_0x52a641=events[_0x7d30('0x3')];_0xfe31bf<_0x52a641;_0xfe31bf++){var _0x39916d=events[_0xfe31bf];var _0x1971e6=createListener(_0x7d30('0x4')+_0x39916d,_0x14f440);MailInteractionEvents['on'](_0x39916d,_0x1971e6);}}; \ No newline at end of file diff --git a/server/api/mailMessage/index.js b/server/api/mailMessage/index.js index aab154b..845fe36 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 _0xc901=['mail','mailmessage:create','create','update','/:id/accept','accept','/:id/reject','reject','delete','exports','multer','Router','fs-extra','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/download','download','post'];(function(_0x3f75ec,_0x5a156f){var _0x1f6bf3=function(_0x54a4a3){while(--_0x54a4a3){_0x3f75ec['push'](_0x3f75ec['shift']());}};_0x1f6bf3(++_0x5a156f);}(_0xc901,0x142));var _0x1c90=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc901[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x1c90('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1c90('0x1')]();var fs_extra=require(_0x1c90('0x2'));var auth=require('../../components/auth/service');var interaction=require(_0x1c90('0x3'));var config=require(_0x1c90('0x4'));var controller=require(_0x1c90('0x5'));router[_0x1c90('0x6')]('/',auth[_0x1c90('0x7')](),controller[_0x1c90('0x8')]);router[_0x1c90('0x6')](_0x1c90('0x9'),auth[_0x1c90('0x7')](),controller[_0x1c90('0xa')]);router['get'](_0x1c90('0xb'),auth[_0x1c90('0x7')](),controller[_0x1c90('0xc')]);router[_0x1c90('0x6')](_0x1c90('0xd'),auth[_0x1c90('0x7')](),controller[_0x1c90('0xe')]);router[_0x1c90('0xf')]('/',auth['isAuthenticated'](),interaction['tracked'](_0x1c90('0x10'),_0x1c90('0x11')),controller[_0x1c90('0x12')]);router['put']('/:id',auth[_0x1c90('0x7')](),controller[_0x1c90('0x13')]);router['put'](_0x1c90('0x14'),auth[_0x1c90('0x7')](),controller[_0x1c90('0x15')]);router['put'](_0x1c90('0x16'),auth['isAuthenticated'](),controller[_0x1c90('0x17')]);router[_0x1c90('0x18')](_0x1c90('0xb'),auth[_0x1c90('0x7')](),controller['destroy']);module[_0x1c90('0x19')]=router; \ No newline at end of file +var _0xfaf3=['destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailMessage.controller','get','isAuthenticated','index','/describe','describe','show','/:id/download','post','tracked','mail','mailmessage:create','create','put','/:id','accept','/:id/reject','delete'];(function(_0x84e325,_0x192242){var _0x4b61c9=function(_0x44f638){while(--_0x44f638){_0x84e325['push'](_0x84e325['shift']());}};_0x4b61c9(++_0x192242);}(_0xfaf3,0x93));var _0x3faf=function(_0x55d094,_0x42a723){_0x55d094=_0x55d094-0x0;var _0x42b5b2=_0xfaf3[_0x55d094];return _0x42b5b2;};'use strict';var multer=require(_0x3faf('0x0'));var util=require('util');var path=require(_0x3faf('0x1'));var timeout=require(_0x3faf('0x2'));var express=require(_0x3faf('0x3'));var router=express[_0x3faf('0x4')]();var fs_extra=require(_0x3faf('0x5'));var auth=require(_0x3faf('0x6'));var interaction=require(_0x3faf('0x7'));var config=require(_0x3faf('0x8'));var controller=require(_0x3faf('0x9'));router[_0x3faf('0xa')]('/',auth[_0x3faf('0xb')](),controller[_0x3faf('0xc')]);router[_0x3faf('0xa')](_0x3faf('0xd'),auth[_0x3faf('0xb')](),controller[_0x3faf('0xe')]);router[_0x3faf('0xa')]('/:id',auth[_0x3faf('0xb')](),controller[_0x3faf('0xf')]);router[_0x3faf('0xa')](_0x3faf('0x10'),auth[_0x3faf('0xb')](),controller['download']);router[_0x3faf('0x11')]('/',auth[_0x3faf('0xb')](),interaction[_0x3faf('0x12')](_0x3faf('0x13'),_0x3faf('0x14')),controller[_0x3faf('0x15')]);router[_0x3faf('0x16')](_0x3faf('0x17'),auth[_0x3faf('0xb')](),controller['update']);router[_0x3faf('0x16')]('/:id/accept',auth[_0x3faf('0xb')](),controller[_0x3faf('0x18')]);router['put'](_0x3faf('0x19'),auth['isAuthenticated'](),controller['reject']);router[_0x3faf('0x1a')]('/:id',auth['isAuthenticated'](),controller[_0x3faf('0x1b')]);module[_0x3faf('0x1c')]=router; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.attributes.js b/server/api/mailMessage/mailMessage.attributes.js index 7bb7d6d..1b4e2e7 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 _0x94a6=['out','STRING','DATE','INTEGER','BOOLEAN','Email','lodash','exports','TEXT','long','medium','ENUM'];(function(_0x348179,_0x769b94){var _0x53564d=function(_0x363165){while(--_0x363165){_0x348179['push'](_0x348179['shift']());}};_0x53564d(++_0x769b94);}(_0x94a6,0xae));var _0x694a=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x94a6[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require('sequelize');var _=require(_0x694a('0x0'));module[_0x694a('0x1')]={'body':{'type':Sequelize[_0x694a('0x2')](_0x694a('0x3')),'allowNull':![]},'plainBody':{'type':Sequelize[_0x694a('0x2')](_0x694a('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x694a('0x5')]('in','out'),'defaultValue':_0x694a('0x6'),'allowNull':![]},'messageId':{'type':Sequelize[_0x694a('0x7')](0x1fe)},'from':{'type':Sequelize[_0x694a('0x7')]},'to':{'type':Sequelize[_0x694a('0x2')](_0x694a('0x3'))},'cc':{'type':Sequelize[_0x694a('0x2')](_0x694a('0x3'))},'bcc':{'type':Sequelize[_0x694a('0x2')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x694a('0x8')]},'attach':{'type':Sequelize[_0x694a('0x9')],'defaultValue':0x0},'secret':{'type':Sequelize[_0x694a('0xa')],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x694a('0x2')](_0x694a('0x3'))},'originCc':{'type':Sequelize['TEXT'](_0x694a('0x3'))},'originChannel':{'type':Sequelize[_0x694a('0x5')](_0x694a('0xb'),'Chat'),'defaultValue':_0x694a('0xb'),'allowNull':![]}}; \ No newline at end of file +var _0x3f57=['lodash','exports','TEXT','medium','ENUM','out','STRING','long','DATE','INTEGER','Email','Chat','sequelize'];(function(_0x364471,_0x302e8a){var _0x59236f=function(_0x524944){while(--_0x524944){_0x364471['push'](_0x364471['shift']());}};_0x59236f(++_0x302e8a);}(_0x3f57,0x81));var _0x73f5=function(_0x283827,_0x3507c4){_0x283827=_0x283827-0x0;var _0x39896f=_0x3f57[_0x283827];return _0x39896f;};'use strict';var Sequelize=require(_0x73f5('0x0'));var _=require(_0x73f5('0x1'));module[_0x73f5('0x2')]={'body':{'type':Sequelize[_0x73f5('0x3')]('long'),'allowNull':![]},'plainBody':{'type':Sequelize[_0x73f5('0x3')](_0x73f5('0x4'))},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x73f5('0x5')]('in','out'),'defaultValue':_0x73f5('0x6'),'allowNull':![]},'messageId':{'type':Sequelize['STRING'](0x1fe)},'from':{'type':Sequelize[_0x73f5('0x7')]},'to':{'type':Sequelize['TEXT'](_0x73f5('0x8'))},'cc':{'type':Sequelize[_0x73f5('0x3')](_0x73f5('0x8'))},'bcc':{'type':Sequelize[_0x73f5('0x3')]('long')},'subject':{'type':Sequelize['TEXT']},'sentAt':{'type':Sequelize[_0x73f5('0x9')]},'attach':{'type':Sequelize[_0x73f5('0xa')],'defaultValue':0x0},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'readAt':{'type':Sequelize['DATE']},'originTo':{'type':Sequelize[_0x73f5('0x3')](_0x73f5('0x8'))},'originCc':{'type':Sequelize[_0x73f5('0x3')](_0x73f5('0x8'))},'originChannel':{'type':Sequelize['ENUM'](_0x73f5('0xb'),_0x73f5('0xc')),'defaultValue':_0x73f5('0xb'),'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.controller.js b/server/api/mailMessage/mailMessage.controller.js index 77e0273..9d709f9 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 _0x72ed=['server','files','tmp','message-%s.eml','from','Attachment','Attachments','subject','decode','createdAt','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','readFileSync','build','writeFileSync','unlinkSync','eml-format','moment','bluebird','util','lodash','ioredis','html-to-text','../../components/parsers/qs','../../config/logger','api','mail-interactions','../../config/environment','redis','defaults','localhost','socket.io-emitter','html-entities','./mailMessage.socket','register','jayson/promise','http','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','status','json','offset','undefined','limit','count','set','update','destroy','end','sendStatus','stack','name','send','index','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','order','sort','pick','filter','where','merge','VIRTUAL','options','MailMessage','includeAll','rows','catch','show','params','keys','find','body','describe','create','direction','out','secret','split','MailAccount','MailAccountId','CmList','List','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','getSmtpOptions','attachments','join','root','basename','ListId','SendMail','sendMail','messageId','format','YYYY-MM-DD\x20HH:mm:ss','accept','mail','read','readAt','UserId','user','agent','get','MailInteractionId','isNil','read1stAt','interaction','role','AcceptMessage','acceptMessage','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','channel','motionChannel','event','fromString','EventManager','MailInteraction','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','rejectMessage','reject','rejectmessage','unix','toString'];(function(_0x377797,_0x16a9bd){var _0x120f81=function(_0x56eebf){while(--_0x56eebf){_0x377797['push'](_0x377797['shift']());}};_0x120f81(++_0x16a9bd);}(_0x72ed,0xb4));var _0xd72e=function(_0x56916d,_0x37b935){_0x56916d=_0x56916d-0x0;var _0x2b7f1f=_0x72ed[_0x56916d];return _0x2b7f1f;};'use strict';var emlformat=require(_0xd72e('0x0'));var moment=require(_0xd72e('0x1'));var BPromise=require(_0xd72e('0x2'));var util=require(_0xd72e('0x3'));var path=require('path');var fs=require('fs');var _=require(_0xd72e('0x4'));var Redis=require(_0xd72e('0x5'));var htmlToText=require(_0xd72e('0x6'));var qs=require(_0xd72e('0x7'));var logger=require(_0xd72e('0x8'))(_0xd72e('0x9'));var interaction_log=require(_0xd72e('0x8'))(_0xd72e('0xa'));var config=require(_0xd72e('0xb'));var db=require('../../mysqldb')['db'];config[_0xd72e('0xc')]=_[_0xd72e('0xd')](config[_0xd72e('0xc')],{'host':_0xd72e('0xe'),'port':0x18eb});var socket=require(_0xd72e('0xf'))(new Redis(config[_0xd72e('0xc')]));var htmlEntities=require(_0xd72e('0x10'));require(_0xd72e('0x11'))[_0xd72e('0x12')](socket);var jayson=require(_0xd72e('0x13'));var client=jayson['client'][_0xd72e('0x14')]({'port':0x232c});var client9003=jayson['client'][_0xd72e('0x14')]({'port':0x232b});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4a8334,_0x5675e6,_0x227116,_0x234027){return new BPromise(function(_0x16e71e,_0x153c79){var _0x31c56a=_0x234027||client;return _0x31c56a['request'](_0x4a8334,_0x227116)[_0xd72e('0x15')](function(_0x4e44d0){logger[_0xd72e('0x16')](_0xd72e('0x17'),_0x5675e6,_0xd72e('0x18'));logger[_0xd72e('0x19')](_0xd72e('0x1a'),_0x5675e6,_0xd72e('0x18'),JSON[_0xd72e('0x1b')](_0x4e44d0));if(_0x4e44d0[_0xd72e('0x1c')]){if(_0x4e44d0[_0xd72e('0x1c')][_0xd72e('0x1d')]===0x1f4){logger['error']('MailMessage,\x20%s,\x20%s',_0x5675e6,_0x4e44d0[_0xd72e('0x1c')][_0xd72e('0x1e')]);return _0x153c79(_0x4e44d0[_0xd72e('0x1c')][_0xd72e('0x1e')]);}logger[_0xd72e('0x1c')](_0xd72e('0x17'),_0x5675e6,_0x4e44d0[_0xd72e('0x1c')][_0xd72e('0x1e')]);return _0x16e71e(_0x4e44d0[_0xd72e('0x1c')][_0xd72e('0x1e')]);}else{logger['info'](_0xd72e('0x17'),_0x5675e6,_0xd72e('0x18'));_0x16e71e(_0x4e44d0[_0xd72e('0x1f')][_0xd72e('0x1e')]);}})['catch'](function(_0x219dcc){logger[_0xd72e('0x1c')](_0xd72e('0x17'),_0x5675e6,_0x219dcc);_0x153c79(_0x219dcc);});});}function respondWithResult(_0x2298be,_0x318d12){_0x318d12=_0x318d12||0xc8;return function(_0x355a1c){if(_0x355a1c){return _0x2298be[_0xd72e('0x20')](_0x318d12)[_0xd72e('0x21')](_0x355a1c);}};}function respondWithFilteredResult(_0x172dff,_0x416d30){return function(_0x1e3365){if(_0x1e3365){var _0x81e1a4=typeof _0x416d30[_0xd72e('0x22')]===_0xd72e('0x23')&&typeof _0x416d30[_0xd72e('0x24')]===_0xd72e('0x23');var _0x3721e3=_0x1e3365[_0xd72e('0x25')];var _0x5e0db8=_0x81e1a4?0x0:_0x416d30[_0xd72e('0x22')];var _0x5d5a04=_0x81e1a4?_0x1e3365[_0xd72e('0x25')]:_0x416d30[_0xd72e('0x22')]+_0x416d30[_0xd72e('0x24')];var _0x4c9da5;if(_0x5d5a04>=_0x3721e3){_0x5d5a04=_0x3721e3;_0x4c9da5=0xc8;}else{_0x4c9da5=0xce;}_0x172dff[_0xd72e('0x20')](_0x4c9da5);return _0x172dff[_0xd72e('0x26')]('Content-Range',_0x5e0db8+'-'+_0x5d5a04+'/'+_0x3721e3)['json'](_0x1e3365);}return null;};}function saveUpdates(_0x25f456){return function(_0x884ac7){if(_0x884ac7){return _0x884ac7[_0xd72e('0x27')](_0x25f456)['then'](function(_0x359e98){return _0x359e98;});}return null;};}function removeEntity(_0x54d27b){return function(_0x230454){if(_0x230454){return _0x230454[_0xd72e('0x28')]()[_0xd72e('0x15')](function(){_0x54d27b[_0xd72e('0x20')](0xcc)[_0xd72e('0x29')]();});}};}function handleEntityNotFound(_0x2da280){return function(_0x262476){if(!_0x262476){_0x2da280[_0xd72e('0x2a')](0x194);}return _0x262476;};}function handleError(_0x283605,_0x45c5b0){_0x45c5b0=_0x45c5b0||0x1f4;return function(_0x5e0470){logger[_0xd72e('0x1c')](_0x5e0470[_0xd72e('0x2b')]);if(_0x5e0470[_0xd72e('0x2c')]){delete _0x5e0470[_0xd72e('0x2c')];}_0x283605[_0xd72e('0x20')](_0x45c5b0)[_0xd72e('0x2d')](_0x5e0470);};}exports[_0xd72e('0x2e')]=function(_0x38b812,_0x3a8dd1){var _0x35216d={},_0x1e2681={},_0x1bcba1={'count':0x0,'rows':[]};var _0x54d0bd=_['map'](db['MailMessage'][_0xd72e('0x2f')],function(_0x2ef9d8){return{'name':_0x2ef9d8[_0xd72e('0x30')],'type':_0x2ef9d8[_0xd72e('0x31')]['key']};});_0x1e2681['model']=_[_0xd72e('0x32')](_0x54d0bd,_0xd72e('0x2c'));_0x1e2681[_0xd72e('0x33')]=_['keys'](_0x38b812[_0xd72e('0x33')]);_0x1e2681[_0xd72e('0x34')]=_[_0xd72e('0x35')](_0x1e2681[_0xd72e('0x36')],_0x1e2681['query']);_0x35216d[_0xd72e('0x37')]=_['intersection'](_0x1e2681[_0xd72e('0x36')],qs[_0xd72e('0x38')](_0x38b812['query'][_0xd72e('0x38')]));_0x35216d[_0xd72e('0x37')]=_0x35216d[_0xd72e('0x37')][_0xd72e('0x39')]?_0x35216d[_0xd72e('0x37')]:_0x1e2681[_0xd72e('0x36')];if(!_0x38b812[_0xd72e('0x33')]['hasOwnProperty']('nolimit')){_0x35216d[_0xd72e('0x24')]=qs['limit'](_0x38b812[_0xd72e('0x33')][_0xd72e('0x24')]);_0x35216d['offset']=qs[_0xd72e('0x22')](_0x38b812[_0xd72e('0x33')][_0xd72e('0x22')]);}_0x35216d[_0xd72e('0x3a')]=qs['sort'](_0x38b812['query'][_0xd72e('0x3b')]);_0x35216d['where']=qs[_0xd72e('0x34')](_[_0xd72e('0x3c')](_0x38b812[_0xd72e('0x33')],_0x1e2681[_0xd72e('0x34')]),_0x54d0bd);if(_0x38b812[_0xd72e('0x33')][_0xd72e('0x3d')]){_0x35216d[_0xd72e('0x3e')]=_[_0xd72e('0x3f')](_0x35216d[_0xd72e('0x3e')],{'$or':_[_0xd72e('0x32')](_0x54d0bd,function(_0x476ac2){if(_0x476ac2[_0xd72e('0x31')]!==_0xd72e('0x40')){var _0xfb26ed={};_0xfb26ed[_0x476ac2['name']]={'$like':'%'+_0x38b812[_0xd72e('0x33')][_0xd72e('0x3d')]+'%'};return _0xfb26ed;}})});}_0x35216d=_[_0xd72e('0x3f')]({},_0x35216d,_0x38b812[_0xd72e('0x41')]);var _0x447825={'where':_0x35216d[_0xd72e('0x3e')]};return db[_0xd72e('0x42')][_0xd72e('0x25')](_0x447825)[_0xd72e('0x15')](function(_0x1e8084){_0x1bcba1['count']=_0x1e8084;if(_0x38b812[_0xd72e('0x33')][_0xd72e('0x43')]){_0x35216d['include']=[{'all':!![]}];}return db[_0xd72e('0x42')]['findAll'](_0x35216d);})[_0xd72e('0x15')](function(_0x44b5c9){_0x1bcba1[_0xd72e('0x44')]=_0x44b5c9;return _0x1bcba1;})[_0xd72e('0x15')](respondWithFilteredResult(_0x3a8dd1,_0x35216d))[_0xd72e('0x45')](handleError(_0x3a8dd1,null));};exports[_0xd72e('0x46')]=function(_0x3a317b,_0x15189d){var _0x34d2c3={'raw':!![],'where':{'id':_0x3a317b[_0xd72e('0x47')]['id']}},_0x7def28={};_0x7def28[_0xd72e('0x36')]=_[_0xd72e('0x48')](db[_0xd72e('0x42')][_0xd72e('0x2f')]);_0x7def28[_0xd72e('0x33')]=_[_0xd72e('0x48')](_0x3a317b[_0xd72e('0x33')]);_0x7def28[_0xd72e('0x34')]=_['intersection'](_0x7def28[_0xd72e('0x36')],_0x7def28['query']);_0x34d2c3[_0xd72e('0x37')]=_[_0xd72e('0x35')](_0x7def28[_0xd72e('0x36')],qs[_0xd72e('0x38')](_0x3a317b[_0xd72e('0x33')][_0xd72e('0x38')]));_0x34d2c3[_0xd72e('0x37')]=_0x34d2c3[_0xd72e('0x37')][_0xd72e('0x39')]?_0x34d2c3[_0xd72e('0x37')]:_0x7def28['model'];if(_0x3a317b['query'][_0xd72e('0x43')]){_0x34d2c3['include']=[{'all':!![]}];}_0x34d2c3=_[_0xd72e('0x3f')]({},_0x34d2c3,_0x3a317b[_0xd72e('0x41')]);return db[_0xd72e('0x42')][_0xd72e('0x49')](_0x34d2c3)[_0xd72e('0x15')](handleEntityNotFound(_0x15189d,null))['then'](respondWithResult(_0x15189d,null))[_0xd72e('0x45')](handleError(_0x15189d,null));};exports[_0xd72e('0x27')]=function(_0x523c53,_0x56ba30){if(_0x523c53[_0xd72e('0x4a')]['id']){delete _0x523c53[_0xd72e('0x4a')]['id'];}return db[_0xd72e('0x42')]['find']({'where':{'id':_0x523c53['params']['id']}})['then'](handleEntityNotFound(_0x56ba30,null))[_0xd72e('0x15')](saveUpdates(_0x523c53[_0xd72e('0x4a')],null))[_0xd72e('0x15')](respondWithResult(_0x56ba30,null))[_0xd72e('0x45')](handleError(_0x56ba30,null));};exports['destroy']=function(_0x1f51e6,_0x524d96){return db['MailMessage']['find']({'where':{'id':_0x1f51e6[_0xd72e('0x47')]['id']}})['then'](handleEntityNotFound(_0x524d96,null))['then'](removeEntity(_0x524d96,null))[_0xd72e('0x45')](handleError(_0x524d96,null));};exports['describe']=function(_0x25fe75,_0x2c57ad){return db[_0xd72e('0x42')][_0xd72e('0x4b')]()['then'](respondWithResult(_0x2c57ad,null))[_0xd72e('0x45')](handleError(_0x2c57ad,null));};exports['create']=function(_0x403a2b,_0x30d3cf){return db[_0xd72e('0x42')][_0xd72e('0x4c')](_0x403a2b['body'])[_0xd72e('0x15')](function(_0x33435f){if(_0x33435f){if(_0x33435f[_0xd72e('0x4d')]===_0xd72e('0x4e')&&!_0x33435f[_0xd72e('0x4f')]){var _0x565962,_0x4b53b5,_0x5494dd;if(_0x403a2b[_0xd72e('0x4a')]['to']){_0x4b53b5=_0x403a2b['body']['to'][_0xd72e('0x50')](',')[0x0];}return db[_0xd72e('0x51')]['findOne']({'where':{'id':_0x33435f[_0xd72e('0x52')]},'include':[{'model':db[_0xd72e('0x53')],'as':_0xd72e('0x54'),'include':[{'model':db['CmContact'],'as':_0xd72e('0x55'),'where':{'email':_0x4b53b5},'limit':0x1,'order':[[_0xd72e('0x56'),_0xd72e('0x57')]]}]},{'model':db[_0xd72e('0x58')],'as':_0xd72e('0x59'),'raw':!![],'include':[{'model':db[_0xd72e('0x5a')],'as':'CloudProvider','raw':!![]}]}]})['then'](function(_0x391bc8){_0x565962=_0x391bc8;if(!_0x565962||!_0x565962[_0xd72e('0x59')])return;var _0x3ed551=_0x565962[_0xd72e('0x5b')]();if(_0x403a2b[_0xd72e('0x4a')][_0xd72e('0x5c')]&&_0x403a2b[_0xd72e('0x4a')][_0xd72e('0x5c')]['length']){for(var _0x112b37=0x0;_0x112b37<_0x403a2b['body'][_0xd72e('0x5c')][_0xd72e('0x39')];_0x112b37+=0x1){_0x403a2b[_0xd72e('0x4a')][_0xd72e('0x5c')][_0x112b37]={'filename':_0x403a2b[_0xd72e('0x4a')][_0xd72e('0x5c')][_0x112b37][_0xd72e('0x2c')],'path':path[_0xd72e('0x5d')](config[_0xd72e('0x5e')],'server/files/attachments',_0x403a2b[_0xd72e('0x4a')]['attachments'][_0x112b37][_0xd72e('0x5f')])};}}_0x5494dd={'account':_0x3ed551,'message':_0x403a2b[_0xd72e('0x4a')]};return;})[_0xd72e('0x15')](function(){if(_0x565962[_0xd72e('0x54')]){if(_0x565962[_0xd72e('0x54')][_0xd72e('0x55')][_0xd72e('0x39')]){return _0x565962['List'][_0xd72e('0x55')][0x0];}else{return db['CmContact'][_0xd72e('0x4c')](_[_0xd72e('0xd')](_0x403a2b[_0xd72e('0x4a')],{'firstName':_0x403a2b[_0xd72e('0x4a')]['to'],'email':_0x403a2b['body']['to'],'phone':_0x403a2b[_0xd72e('0x4a')]['to'],'ListId':_0x565962[_0xd72e('0x60')]}));}}else{throw new Error('List\x20not\x20found');}})[_0xd72e('0x15')](function(){if(_0x5494dd){return respondWithRpcPromise(_0xd72e('0x61'),_0xd72e('0x62'),_0x5494dd,client9003)[_0xd72e('0x15')](function(_0x207c82){return _0x33435f[_0xd72e('0x27')]({'read':!![],'messageId':_0x207c82[_0xd72e('0x63')],'sentAt':moment()[_0xd72e('0x64')](_0xd72e('0x65'))});})[_0xd72e('0x45')](function(_0x123c15){logger['error']('%s',JSON[_0xd72e('0x1b')](_0x123c15));return _0x33435f;});}return _0x33435f;});}return _0x33435f;}})[_0xd72e('0x15')](respondWithResult(_0x30d3cf,0xc9))['catch'](handleError(_0x30d3cf,null));};exports[_0xd72e('0x66')]=function(_0x2ca7c3,_0x2c6af5){var _0x266e16={'agent':{},'channel':_0xd72e('0x67')};if(_0x2ca7c3[_0xd72e('0x4a')]['id']){delete _0x2ca7c3[_0xd72e('0x4a')]['id'];}_0x2ca7c3[_0xd72e('0x4a')][_0xd72e('0x68')]=!![];_0x2ca7c3['body'][_0xd72e('0x69')]=moment()[_0xd72e('0x64')](_0xd72e('0x65'));_0x2ca7c3['body'][_0xd72e('0x6a')]=_0x2ca7c3[_0xd72e('0x4a')]['UserId']||_0x2ca7c3[_0xd72e('0x6b')]['id'];_0x266e16[_0xd72e('0x6c')]['id']=_0x2ca7c3[_0xd72e('0x4a')][_0xd72e('0x6a')];return db[_0xd72e('0x42')][_0xd72e('0x49')]({'where':{'id':_0x2ca7c3['params']['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2c6af5,null))['then'](saveUpdates(_0x2ca7c3['body'],null))[_0xd72e('0x15')](function(_0x1fef83){if(_0x1fef83){_0x266e16['message']=_0x1fef83[_0xd72e('0x6d')]({'plain':!![]});return db['MailInteraction'][_0xd72e('0x49')]({'where':{'id':_0x1fef83[_0xd72e('0x6e')]}});}return null;})[_0xd72e('0x15')](handleEntityNotFound(_0x2c6af5,null))[_0xd72e('0x15')](function(_0x5287bc){if(_0x5287bc){return _0x5287bc[_0xd72e('0x27')]({'UserId':_0x2ca7c3[_0xd72e('0x4a')][_0xd72e('0x6a')],'read1stAt':_[_0xd72e('0x6f')](_0x5287bc[_0xd72e('0x70')])?moment()[_0xd72e('0x64')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0xd72e('0x15')](function(_0x58a078){if(_0x58a078){_0x266e16[_0xd72e('0x71')]=_0x58a078[_0xd72e('0x6d')]({'plain':!![]});interaction_log[_0xd72e('0x16')]('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x2ca7c3[_0xd72e('0x6b')]['id'],_0x2ca7c3[_0xd72e('0x6b')][_0xd72e('0x2c')],_0x2ca7c3[_0xd72e('0x6b')][_0xd72e('0x72')],_0x266e16[_0xd72e('0x71')]['id'],_0x2ca7c3[_0xd72e('0x4a')]?JSON['stringify'](_0x2ca7c3[_0xd72e('0x4a')]):'null');return respondWithRpcPromise(_0xd72e('0x73'),_0xd72e('0x74'),_0x266e16);}return null;})['then'](function(_0x238eb4){var _0x12f2dc='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x238eb4['message'][_0xd72e('0x75')];return db[_0xd72e('0x76')]['query'](_0x12f2dc,{'type':db[_0xd72e('0x77')][_0xd72e('0x78')][_0xd72e('0x79')],'raw':!![]})[_0xd72e('0x15')](function(_0x83c7cb){return _0x83c7cb;});})[_0xd72e('0x15')](function(_0x4dee4c){if(_0x4dee4c){_0x266e16[_0xd72e('0x1e')][_0xd72e('0x7a')]=_0x4dee4c[0x0];if(!_0x2ca7c3[_0xd72e('0x4a')][_0xd72e('0x6a')])return;return db[_0xd72e('0x7b')]['find']({'where':{'id':_0x2ca7c3[_0xd72e('0x4a')][_0xd72e('0x6a')],'role':_0xd72e('0x6c')},'attributes':['id',_0xd72e('0x2c'),_0xd72e('0x7c'),_0xd72e('0x7d'),_0xd72e('0x7e')],'raw':!![]});}return null;})[_0xd72e('0x15')](function(_0x1d8639){if(!_0x1d8639)return null;_0x266e16[_0xd72e('0x1e')][_0xd72e('0x6c')]=_0x1d8639;return _0x266e16;})['then'](function(_0x49d2a5){if(_0x49d2a5){if(_0x2ca7c3[_0xd72e('0x4a')][_0xd72e('0x7f')]){_0x266e16[_0xd72e('0x1e')][_0xd72e('0x80')]=util[_0xd72e('0x64')]('SIP/%s',_0x2ca7c3[_0xd72e('0x6b')][_0xd72e('0x2c')]);_0x266e16[_0xd72e('0x1e')]['channel']=_0x266e16[_0xd72e('0x81')];_0x266e16['message'][_0xd72e('0x82')]=_0x266e16[_0xd72e('0x81')];_0x266e16[_0xd72e('0x1e')][_0xd72e('0x83')]='accept';_0x266e16[_0xd72e('0x1e')][_0xd72e('0x4a')]=htmlToText[_0xd72e('0x84')](_0x266e16[_0xd72e('0x1e')][_0xd72e('0x4a')]);return respondWithRpcPromise(_0xd72e('0x85'),'EventManager',{'event':'acceptmessage','message':_0x266e16[_0xd72e('0x1e')]},client9002)[_0xd72e('0x15')](function(){return _0x266e16;});}return _0x266e16;}return null;})['then'](respondWithResult(_0x2c6af5,null))[_0xd72e('0x45')](handleError(_0x2c6af5,null));};exports['reject']=function(_0x473158,_0x1390a0){var _0x532c9c={'agent':{},'channel':_0xd72e('0x67')};if(_0x473158[_0xd72e('0x4a')]['id']){delete _0x473158[_0xd72e('0x4a')]['id'];}_0x473158[_0xd72e('0x4a')]['UserId']=_0x473158['body'][_0xd72e('0x6a')]||_0x473158[_0xd72e('0x6b')]['id'];_0x532c9c[_0xd72e('0x6c')]['id']=_0x473158[_0xd72e('0x4a')][_0xd72e('0x6a')];return db[_0xd72e('0x42')][_0xd72e('0x49')]({'where':{'id':_0x473158[_0xd72e('0x47')]['id'],'UserId':null}})[_0xd72e('0x15')](handleEntityNotFound(_0x1390a0,null))[_0xd72e('0x15')](function(_0xd8a593){if(_0xd8a593){_0x532c9c[_0xd72e('0x1e')]=_0xd8a593[_0xd72e('0x6d')]({'plain':!![]});return db[_0xd72e('0x86')][_0xd72e('0x49')]({'where':{'id':_0xd8a593[_0xd72e('0x6e')]}});}return null;})['then'](handleEntityNotFound(_0x1390a0,null))[_0xd72e('0x15')](function(_0x25f2cc){if(_0x25f2cc){_0x532c9c[_0xd72e('0x71')]=_0x25f2cc['get']({'plain':!![]});interaction_log[_0xd72e('0x16')](_0xd72e('0x87'),_0x473158['user']['id'],_0x473158[_0xd72e('0x6b')][_0xd72e('0x2c')],_0x473158['user'][_0xd72e('0x72')],_0x532c9c[_0xd72e('0x71')]['id'],_0x473158[_0xd72e('0x4a')]?JSON[_0xd72e('0x1b')](_0x473158[_0xd72e('0x4a')]):_0xd72e('0x88'));return respondWithRpcPromise('RejectMessage',_0xd72e('0x89'),_0x532c9c);}return null;})[_0xd72e('0x15')](function(_0x4a54b0){var _0x16930d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x4a54b0['message']['ContactId'];return db['sequelize'][_0xd72e('0x33')](_0x16930d,{'type':db[_0xd72e('0x77')][_0xd72e('0x78')][_0xd72e('0x79')],'raw':!![]})[_0xd72e('0x15')](function(_0x42c649){return _0x42c649;});})[_0xd72e('0x15')](function(_0x3079f4){if(_0x3079f4){_0x532c9c[_0xd72e('0x1e')][_0xd72e('0x7a')]=_0x3079f4[0x0];if(!_0x473158[_0xd72e('0x4a')]['UserId'])return;return db[_0xd72e('0x7b')][_0xd72e('0x49')]({'where':{'id':_0x473158['body']['UserId'],'role':_0xd72e('0x6c')},'attributes':['id',_0xd72e('0x2c'),_0xd72e('0x7c'),_0xd72e('0x7d'),'internal'],'raw':!![]});}return null;})[_0xd72e('0x15')](function(_0x12e105){if(!_0x12e105)return null;_0x532c9c['message'][_0xd72e('0x6c')]=_0x12e105;return _0x532c9c;})['then'](function(_0x4cb8bd){if(_0x4cb8bd){_0x4cb8bd[_0xd72e('0x1e')][_0xd72e('0x80')]=util[_0xd72e('0x64')]('SIP/%s',_0x473158['user']['name']);_0x4cb8bd[_0xd72e('0x1e')][_0xd72e('0x81')]=_0x532c9c[_0xd72e('0x81')];_0x4cb8bd[_0xd72e('0x1e')][_0xd72e('0x82')]=_0x532c9c['channel'];_0x4cb8bd['message'][_0xd72e('0x83')]=_0xd72e('0x8a');_0x4cb8bd['message'][_0xd72e('0x4a')]=htmlToText[_0xd72e('0x84')](_0x532c9c[_0xd72e('0x1e')][_0xd72e('0x4a')]);respondWithRpcPromise(_0xd72e('0x85'),'EventManager',{'event':_0xd72e('0x8b'),'message':_0x4cb8bd['message']},client9002);return _0x532c9c;}return null;})[_0xd72e('0x15')](respondWithResult(_0x1390a0,null))[_0xd72e('0x45')](handleError(_0x1390a0,null));};exports['download']=function(_0x53a234,_0x1ded00){var _0x19fff0=moment()[_0xd72e('0x8c')]()[_0xd72e('0x8d')]();var _0x15baa2=path[_0xd72e('0x5d')](config[_0xd72e('0x5e')],_0xd72e('0x8e'),_0xd72e('0x8f'),_0xd72e('0x90'));var _0x3044eb=path[_0xd72e('0x5d')](config['root'],_0xd72e('0x8e'),_0xd72e('0x8f'),_0xd72e('0x5c'));var _0x2f6567=util[_0xd72e('0x64')](_0xd72e('0x91'),_0x19fff0);return db[_0xd72e('0x42')]['find']({'where':{'id':_0x53a234[_0xd72e('0x47')]['id']},'attributes':['id',_0xd72e('0x4a'),_0xd72e('0x92'),'to','cc','bcc','subject','createdAt'],'include':_0x53a234[_0xd72e('0x33')][_0xd72e('0x5c')]?[{'model':db[_0xd72e('0x93')],'as':_0xd72e('0x94')}]:undefined})[_0xd72e('0x15')](handleEntityNotFound(_0x1ded00,null))[_0xd72e('0x15')](function(_0x2f2c3c){if(_0x2f2c3c){var _0x4630ea=_0x2f2c3c;var _0x56ed93={'from':_0x4630ea[_0xd72e('0x92')],'to':_0x4630ea['to'],'subject':_0x4630ea[_0xd72e('0x95')],'html':htmlEntities[_0xd72e('0x96')](_0x4630ea['body']),'headers':{'Date':moment(_0x4630ea[_0xd72e('0x97')])['format'](_0xd72e('0x98'))},'attachments':[]};if(_0x2f2c3c['cc']){_0x56ed93[_0xd72e('0x99')]['Cc']=_0x2f2c3c['cc'];}if(_0x2f2c3c[_0xd72e('0x9a')]){_0x56ed93['headers'][_0xd72e('0x9b')]=_0x2f2c3c[_0xd72e('0x9a')];}return new BPromise(function(_0x1c2c1d,_0x81fd1c){if(_0x2f2c3c[_0xd72e('0x94')]){for(var _0x1df378=0x0;_0x1df378<_0x2f2c3c['Attachments'][_0xd72e('0x39')];_0x1df378++){var _0x314bd7=_0x2f2c3c[_0xd72e('0x94')][_0x1df378];var _0x1bbf32=path['join'](_0x3044eb,_0x314bd7['basename']);if(fs[_0xd72e('0x9c')](_0x1bbf32)){_0x56ed93['attachments']['push']({'name':_0x314bd7['name'],'contentType':_0x314bd7[_0xd72e('0x31')],'data':fs[_0xd72e('0x9d')](_0x1bbf32)});}}}emlformat[_0xd72e('0x9e')](_0x56ed93,function(_0x29ab14,_0x2a85cf){if(_0x29ab14)return _0x81fd1c(_0x29ab14);fs[_0xd72e('0x9f')](path[_0xd72e('0x5d')](_0x15baa2,_0x2f6567),_0x2a85cf);return _0x1c2c1d(_0x2a85cf);});});}})[_0xd72e('0x15')](function(_0x45cfdc){if(_0x45cfdc){return _0x1ded00['download'](path[_0xd72e('0x5d')](_0x15baa2,_0x2f6567),_0x2f6567,function(_0x4726b6){if(!_0x4726b6)fs[_0xd72e('0xa0')](path[_0xd72e('0x5d')](_0x15baa2,_0x2f6567));});}})[_0xd72e('0x45')](handleError(_0x1ded00,null));}; \ No newline at end of file +var _0x5b80=['count','include','findAll','catch','show','params','includeAll','find','body','describe','create','direction','secret','split','MailAccount','MailAccountId','CmList','List','CmContact','Contacts','updatedAt','DESC','MailServerOut','Smtp','CloudProvider','attachments','join','root','server/files/attachments','basename','ListId','List\x20not\x20found','SendMail','sendMail','messageId','accept','mail','readAt','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','MailInteraction','isNil','interaction','role','null','AcceptMessage','acceptMessage','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','SIP/%s','channel','motionChannel','event','fromString','EventManager','acceptmessage','reject','MailInteractionId','[MAILMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','interface','rejectmessage','download','unix','toString','files','tmp','server','message-%s.eml','from','subject','createdAt','Attachment','Attachments','decode','ddd,\x20DD\x20MMM\x20YYYY\x20HH:mm:ss\x20ZZ','headers','bcc','Bcc','existsSync','push','readFileSync','build','writeFileSync','unlinkSync','moment','bluebird','util','path','lodash','ioredis','../../components/parsers/qs','../../config/logger','mail-interactions','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','html-entities','register','jayson/promise','client','http','request','info','MailMessage,\x20%s,\x20%s','request\x20sent','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','status','json','offset','limit','Content-Range','update','destroy','then','sendStatus','stack','send','map','MailMessage','rawAttributes','fieldName','type','key','name','query','keys','attributes','intersection','model','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','filter','VIRTUAL','merge','options'];(function(_0x642846,_0xcd3182){var _0x1144e0=function(_0xa0419f){while(--_0xa0419f){_0x642846['push'](_0x642846['shift']());}};_0x1144e0(++_0xcd3182);}(_0x5b80,0x1a9));var _0x05b8=function(_0x411add,_0x1aed38){_0x411add=_0x411add-0x0;var _0x238242=_0x5b80[_0x411add];return _0x238242;};'use strict';var emlformat=require('eml-format');var moment=require(_0x05b8('0x0'));var BPromise=require(_0x05b8('0x1'));var util=require(_0x05b8('0x2'));var path=require(_0x05b8('0x3'));var fs=require('fs');var _=require(_0x05b8('0x4'));var Redis=require(_0x05b8('0x5'));var htmlToText=require('html-to-text');var qs=require(_0x05b8('0x6'));var logger=require('../../config/logger')('api');var interaction_log=require(_0x05b8('0x7'))(_0x05b8('0x8'));var config=require(_0x05b8('0x9'));var db=require(_0x05b8('0xa'))['db'];config[_0x05b8('0xb')]=_[_0x05b8('0xc')](config['redis'],{'host':_0x05b8('0xd'),'port':0x18eb});var socket=require(_0x05b8('0xe'))(new Redis(config['redis']));var htmlEntities=require(_0x05b8('0xf'));require('./mailMessage.socket')[_0x05b8('0x10')](socket);var jayson=require(_0x05b8('0x11'));var client=jayson[_0x05b8('0x12')][_0x05b8('0x13')]({'port':0x232c});var client9003=jayson[_0x05b8('0x12')][_0x05b8('0x13')]({'port':0x232b});var client9002=jayson[_0x05b8('0x12')][_0x05b8('0x13')]({'port':0x232a});function respondWithRpcPromise(_0x444b25,_0x395d46,_0x1a4ba9,_0x20c768){return new BPromise(function(_0x1aca42,_0x2999a8){var _0x4432c2=_0x20c768||client;return _0x4432c2[_0x05b8('0x14')](_0x444b25,_0x1a4ba9)['then'](function(_0x56451d){logger[_0x05b8('0x15')](_0x05b8('0x16'),_0x395d46,_0x05b8('0x17'));logger['debug'](_0x05b8('0x18'),_0x395d46,_0x05b8('0x17'),JSON[_0x05b8('0x19')](_0x56451d));if(_0x56451d[_0x05b8('0x1a')]){if(_0x56451d[_0x05b8('0x1a')]['code']===0x1f4){logger['error'](_0x05b8('0x16'),_0x395d46,_0x56451d['error'][_0x05b8('0x1b')]);return _0x2999a8(_0x56451d[_0x05b8('0x1a')][_0x05b8('0x1b')]);}logger[_0x05b8('0x1a')]('MailMessage,\x20%s,\x20%s',_0x395d46,_0x56451d['error'][_0x05b8('0x1b')]);return _0x1aca42(_0x56451d[_0x05b8('0x1a')][_0x05b8('0x1b')]);}else{logger[_0x05b8('0x15')](_0x05b8('0x16'),_0x395d46,'request\x20sent');_0x1aca42(_0x56451d['result'][_0x05b8('0x1b')]);}})['catch'](function(_0x43d3cc){logger[_0x05b8('0x1a')](_0x05b8('0x16'),_0x395d46,_0x43d3cc);_0x2999a8(_0x43d3cc);});});}function respondWithResult(_0x37f662,_0x35b3d9){_0x35b3d9=_0x35b3d9||0xc8;return function(_0x4bd870){if(_0x4bd870){return _0x37f662[_0x05b8('0x1c')](_0x35b3d9)[_0x05b8('0x1d')](_0x4bd870);}};}function respondWithFilteredResult(_0x4e1597,_0x4fc734){return function(_0x291229){if(_0x291229){var _0x42b9b4=typeof _0x4fc734[_0x05b8('0x1e')]==='undefined'&&typeof _0x4fc734[_0x05b8('0x1f')]==='undefined';var _0x2d4b02=_0x291229['count'];var _0x3826a9=_0x42b9b4?0x0:_0x4fc734[_0x05b8('0x1e')];var _0x483570=_0x42b9b4?_0x291229['count']:_0x4fc734[_0x05b8('0x1e')]+_0x4fc734[_0x05b8('0x1f')];var _0x4bb27b;if(_0x483570>=_0x2d4b02){_0x483570=_0x2d4b02;_0x4bb27b=0xc8;}else{_0x4bb27b=0xce;}_0x4e1597[_0x05b8('0x1c')](_0x4bb27b);return _0x4e1597['set'](_0x05b8('0x20'),_0x3826a9+'-'+_0x483570+'/'+_0x2d4b02)[_0x05b8('0x1d')](_0x291229);}return null;};}function saveUpdates(_0x2b85e2){return function(_0x1e02cf){if(_0x1e02cf){return _0x1e02cf[_0x05b8('0x21')](_0x2b85e2)['then'](function(_0x29d5e8){return _0x29d5e8;});}return null;};}function removeEntity(_0x5add55){return function(_0x383357){if(_0x383357){return _0x383357[_0x05b8('0x22')]()[_0x05b8('0x23')](function(){_0x5add55[_0x05b8('0x1c')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb0a8af){return function(_0x1a6786){if(!_0x1a6786){_0xb0a8af[_0x05b8('0x24')](0x194);}return _0x1a6786;};}function handleError(_0x1c800c,_0x50fad1){_0x50fad1=_0x50fad1||0x1f4;return function(_0x3ec767){logger[_0x05b8('0x1a')](_0x3ec767[_0x05b8('0x25')]);if(_0x3ec767['name']){delete _0x3ec767['name'];}_0x1c800c[_0x05b8('0x1c')](_0x50fad1)[_0x05b8('0x26')](_0x3ec767);};}exports['index']=function(_0x5e9671,_0x5ea553){var _0x667125={},_0x45f341={},_0x56a112={'count':0x0,'rows':[]};var _0x3d6172=_[_0x05b8('0x27')](db[_0x05b8('0x28')][_0x05b8('0x29')],function(_0x4261f1){return{'name':_0x4261f1[_0x05b8('0x2a')],'type':_0x4261f1[_0x05b8('0x2b')][_0x05b8('0x2c')]};});_0x45f341['model']=_[_0x05b8('0x27')](_0x3d6172,_0x05b8('0x2d'));_0x45f341[_0x05b8('0x2e')]=_[_0x05b8('0x2f')](_0x5e9671[_0x05b8('0x2e')]);_0x45f341['filters']=_['intersection'](_0x45f341['model'],_0x45f341[_0x05b8('0x2e')]);_0x667125[_0x05b8('0x30')]=_[_0x05b8('0x31')](_0x45f341[_0x05b8('0x32')],qs[_0x05b8('0x33')](_0x5e9671[_0x05b8('0x2e')]['fields']));_0x667125[_0x05b8('0x30')]=_0x667125[_0x05b8('0x30')][_0x05b8('0x34')]?_0x667125[_0x05b8('0x30')]:_0x45f341[_0x05b8('0x32')];if(!_0x5e9671['query'][_0x05b8('0x35')](_0x05b8('0x36'))){_0x667125[_0x05b8('0x1f')]=qs[_0x05b8('0x1f')](_0x5e9671[_0x05b8('0x2e')][_0x05b8('0x1f')]);_0x667125[_0x05b8('0x1e')]=qs[_0x05b8('0x1e')](_0x5e9671[_0x05b8('0x2e')][_0x05b8('0x1e')]);}_0x667125[_0x05b8('0x37')]=qs[_0x05b8('0x38')](_0x5e9671[_0x05b8('0x2e')]['sort']);_0x667125[_0x05b8('0x39')]=qs['filters'](_[_0x05b8('0x3a')](_0x5e9671[_0x05b8('0x2e')],_0x45f341[_0x05b8('0x3b')]),_0x3d6172);if(_0x5e9671['query'][_0x05b8('0x3c')]){_0x667125[_0x05b8('0x39')]=_['merge'](_0x667125[_0x05b8('0x39')],{'$or':_[_0x05b8('0x27')](_0x3d6172,function(_0x1846ad){if(_0x1846ad['type']!==_0x05b8('0x3d')){var _0x235c2c={};_0x235c2c[_0x1846ad['name']]={'$like':'%'+_0x5e9671['query']['filter']+'%'};return _0x235c2c;}})});}_0x667125=_[_0x05b8('0x3e')]({},_0x667125,_0x5e9671[_0x05b8('0x3f')]);var _0x2dacc6={'where':_0x667125[_0x05b8('0x39')]};return db[_0x05b8('0x28')][_0x05b8('0x40')](_0x2dacc6)['then'](function(_0x181e35){_0x56a112[_0x05b8('0x40')]=_0x181e35;if(_0x5e9671[_0x05b8('0x2e')]['includeAll']){_0x667125[_0x05b8('0x41')]=[{'all':!![]}];}return db[_0x05b8('0x28')][_0x05b8('0x42')](_0x667125);})[_0x05b8('0x23')](function(_0x274dcb){_0x56a112['rows']=_0x274dcb;return _0x56a112;})[_0x05b8('0x23')](respondWithFilteredResult(_0x5ea553,_0x667125))[_0x05b8('0x43')](handleError(_0x5ea553,null));};exports[_0x05b8('0x44')]=function(_0x3a62cf,_0x58a4a4){var _0x5647ca={'raw':!![],'where':{'id':_0x3a62cf[_0x05b8('0x45')]['id']}},_0x359394={};_0x359394[_0x05b8('0x32')]=_[_0x05b8('0x2f')](db[_0x05b8('0x28')][_0x05b8('0x29')]);_0x359394['query']=_[_0x05b8('0x2f')](_0x3a62cf[_0x05b8('0x2e')]);_0x359394['filters']=_[_0x05b8('0x31')](_0x359394[_0x05b8('0x32')],_0x359394['query']);_0x5647ca[_0x05b8('0x30')]=_[_0x05b8('0x31')](_0x359394['model'],qs[_0x05b8('0x33')](_0x3a62cf['query'][_0x05b8('0x33')]));_0x5647ca[_0x05b8('0x30')]=_0x5647ca[_0x05b8('0x30')][_0x05b8('0x34')]?_0x5647ca[_0x05b8('0x30')]:_0x359394[_0x05b8('0x32')];if(_0x3a62cf[_0x05b8('0x2e')][_0x05b8('0x46')]){_0x5647ca[_0x05b8('0x41')]=[{'all':!![]}];}_0x5647ca=_[_0x05b8('0x3e')]({},_0x5647ca,_0x3a62cf['options']);return db[_0x05b8('0x28')][_0x05b8('0x47')](_0x5647ca)[_0x05b8('0x23')](handleEntityNotFound(_0x58a4a4,null))[_0x05b8('0x23')](respondWithResult(_0x58a4a4,null))[_0x05b8('0x43')](handleError(_0x58a4a4,null));};exports['update']=function(_0x1b8eb7,_0x27565d){if(_0x1b8eb7['body']['id']){delete _0x1b8eb7['body']['id'];}return db[_0x05b8('0x28')][_0x05b8('0x47')]({'where':{'id':_0x1b8eb7[_0x05b8('0x45')]['id']}})[_0x05b8('0x23')](handleEntityNotFound(_0x27565d,null))['then'](saveUpdates(_0x1b8eb7[_0x05b8('0x48')],null))[_0x05b8('0x23')](respondWithResult(_0x27565d,null))[_0x05b8('0x43')](handleError(_0x27565d,null));};exports[_0x05b8('0x22')]=function(_0x8342b5,_0x56c965){return db['MailMessage'][_0x05b8('0x47')]({'where':{'id':_0x8342b5['params']['id']}})[_0x05b8('0x23')](handleEntityNotFound(_0x56c965,null))[_0x05b8('0x23')](removeEntity(_0x56c965,null))[_0x05b8('0x43')](handleError(_0x56c965,null));};exports[_0x05b8('0x49')]=function(_0x1542aa,_0x218947){return db[_0x05b8('0x28')][_0x05b8('0x49')]()[_0x05b8('0x23')](respondWithResult(_0x218947,null))[_0x05b8('0x43')](handleError(_0x218947,null));};exports[_0x05b8('0x4a')]=function(_0x184268,_0x16414d){return db[_0x05b8('0x28')][_0x05b8('0x4a')](_0x184268[_0x05b8('0x48')])['then'](function(_0x4abf13){if(_0x4abf13){if(_0x4abf13[_0x05b8('0x4b')]==='out'&&!_0x4abf13[_0x05b8('0x4c')]){var _0x1aab54,_0x237fe0,_0x2a48c9;if(_0x184268['body']['to']){_0x237fe0=_0x184268['body']['to'][_0x05b8('0x4d')](',')[0x0];}return db[_0x05b8('0x4e')]['findOne']({'where':{'id':_0x4abf13[_0x05b8('0x4f')]},'include':[{'model':db[_0x05b8('0x50')],'as':_0x05b8('0x51'),'include':[{'model':db[_0x05b8('0x52')],'as':_0x05b8('0x53'),'where':{'email':_0x237fe0},'limit':0x1,'order':[[_0x05b8('0x54'),_0x05b8('0x55')]]}]},{'model':db[_0x05b8('0x56')],'as':_0x05b8('0x57'),'raw':!![],'include':[{'model':db[_0x05b8('0x58')],'as':_0x05b8('0x58'),'raw':!![]}]}]})[_0x05b8('0x23')](function(_0x3a82d6){_0x1aab54=_0x3a82d6;if(!_0x1aab54||!_0x1aab54[_0x05b8('0x57')])return;var _0x966352=_0x1aab54['getSmtpOptions']();if(_0x184268['body'][_0x05b8('0x59')]&&_0x184268['body'][_0x05b8('0x59')]['length']){for(var _0x4f1054=0x0;_0x4f1054<_0x184268[_0x05b8('0x48')]['attachments'][_0x05b8('0x34')];_0x4f1054+=0x1){_0x184268['body'][_0x05b8('0x59')][_0x4f1054]={'filename':_0x184268['body'][_0x05b8('0x59')][_0x4f1054]['name'],'path':path[_0x05b8('0x5a')](config[_0x05b8('0x5b')],_0x05b8('0x5c'),_0x184268[_0x05b8('0x48')][_0x05b8('0x59')][_0x4f1054][_0x05b8('0x5d')])};}}_0x2a48c9={'account':_0x966352,'message':_0x184268[_0x05b8('0x48')]};return;})[_0x05b8('0x23')](function(){if(_0x1aab54[_0x05b8('0x51')]){if(_0x1aab54['List'][_0x05b8('0x53')][_0x05b8('0x34')]){return _0x1aab54[_0x05b8('0x51')][_0x05b8('0x53')][0x0];}else{return db['CmContact'][_0x05b8('0x4a')](_[_0x05b8('0xc')](_0x184268[_0x05b8('0x48')],{'firstName':_0x184268[_0x05b8('0x48')]['to'],'email':_0x184268[_0x05b8('0x48')]['to'],'phone':_0x184268[_0x05b8('0x48')]['to'],'ListId':_0x1aab54[_0x05b8('0x5e')]}));}}else{throw new Error(_0x05b8('0x5f'));}})[_0x05b8('0x23')](function(){if(_0x2a48c9){return respondWithRpcPromise(_0x05b8('0x60'),_0x05b8('0x61'),_0x2a48c9,client9003)[_0x05b8('0x23')](function(_0x58e06e){return _0x4abf13[_0x05b8('0x21')]({'read':!![],'messageId':_0x58e06e[_0x05b8('0x62')],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')});})[_0x05b8('0x43')](function(_0x429db7){logger[_0x05b8('0x1a')]('%s',JSON['stringify'](_0x429db7));return _0x4abf13;});}return _0x4abf13;});}return _0x4abf13;}})[_0x05b8('0x23')](respondWithResult(_0x16414d,0xc9))[_0x05b8('0x43')](handleError(_0x16414d,null));};exports[_0x05b8('0x63')]=function(_0x862c48,_0x5837c9){var _0x4b71d3={'agent':{},'channel':_0x05b8('0x64')};if(_0x862c48['body']['id']){delete _0x862c48[_0x05b8('0x48')]['id'];}_0x862c48[_0x05b8('0x48')]['read']=!![];_0x862c48[_0x05b8('0x48')][_0x05b8('0x65')]=moment()[_0x05b8('0x66')](_0x05b8('0x67'));_0x862c48[_0x05b8('0x48')][_0x05b8('0x68')]=_0x862c48[_0x05b8('0x48')][_0x05b8('0x68')]||_0x862c48[_0x05b8('0x69')]['id'];_0x4b71d3[_0x05b8('0x6a')]['id']=_0x862c48[_0x05b8('0x48')]['UserId'];return db['MailMessage'][_0x05b8('0x47')]({'where':{'id':_0x862c48[_0x05b8('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x5837c9,null))[_0x05b8('0x23')](saveUpdates(_0x862c48['body'],null))['then'](function(_0x2ebf6a){if(_0x2ebf6a){_0x4b71d3[_0x05b8('0x1b')]=_0x2ebf6a[_0x05b8('0x6b')]({'plain':!![]});return db[_0x05b8('0x6c')][_0x05b8('0x47')]({'where':{'id':_0x2ebf6a['MailInteractionId']}});}return null;})[_0x05b8('0x23')](handleEntityNotFound(_0x5837c9,null))[_0x05b8('0x23')](function(_0x2c61a7){if(_0x2c61a7){return _0x2c61a7['update']({'UserId':_0x862c48[_0x05b8('0x48')][_0x05b8('0x68')],'read1stAt':_[_0x05b8('0x6d')](_0x2c61a7['read1stAt'])?moment()[_0x05b8('0x66')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x05b8('0x23')](function(_0x4c1997){if(_0x4c1997){_0x4b71d3[_0x05b8('0x6e')]=_0x4c1997[_0x05b8('0x6b')]({'plain':!![]});interaction_log['info']('[MAILMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x862c48[_0x05b8('0x69')]['id'],_0x862c48[_0x05b8('0x69')][_0x05b8('0x2d')],_0x862c48['user'][_0x05b8('0x6f')],_0x4b71d3['interaction']['id'],_0x862c48['body']?JSON['stringify'](_0x862c48[_0x05b8('0x48')]):_0x05b8('0x70'));return respondWithRpcPromise(_0x05b8('0x71'),_0x05b8('0x72'),_0x4b71d3);}return null;})[_0x05b8('0x23')](function(_0x5d6c9e){var _0x554f6a='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x5d6c9e[_0x05b8('0x1b')][_0x05b8('0x73')];return db[_0x05b8('0x74')][_0x05b8('0x2e')](_0x554f6a,{'type':db['Sequelize'][_0x05b8('0x75')][_0x05b8('0x76')],'raw':!![]})[_0x05b8('0x23')](function(_0x4ffc78){return _0x4ffc78;});})[_0x05b8('0x23')](function(_0x490ac3){if(_0x490ac3){_0x4b71d3[_0x05b8('0x1b')][_0x05b8('0x77')]=_0x490ac3[0x0];if(!_0x862c48[_0x05b8('0x48')][_0x05b8('0x68')])return;return db[_0x05b8('0x78')][_0x05b8('0x47')]({'where':{'id':_0x862c48[_0x05b8('0x48')]['UserId'],'role':_0x05b8('0x6a')},'attributes':['id',_0x05b8('0x2d'),_0x05b8('0x79'),_0x05b8('0x7a'),_0x05b8('0x7b')],'raw':!![]});}return null;})['then'](function(_0x4b783c){if(!_0x4b783c)return null;_0x4b71d3[_0x05b8('0x1b')][_0x05b8('0x6a')]=_0x4b783c;return _0x4b71d3;})[_0x05b8('0x23')](function(_0x8dc138){if(_0x8dc138){if(_0x862c48[_0x05b8('0x48')][_0x05b8('0x7c')]){_0x4b71d3[_0x05b8('0x1b')]['interface']=util[_0x05b8('0x66')](_0x05b8('0x7d'),_0x862c48[_0x05b8('0x69')]['name']);_0x4b71d3[_0x05b8('0x1b')][_0x05b8('0x7e')]=_0x4b71d3[_0x05b8('0x7e')];_0x4b71d3[_0x05b8('0x1b')][_0x05b8('0x7f')]=_0x4b71d3[_0x05b8('0x7e')];_0x4b71d3[_0x05b8('0x1b')][_0x05b8('0x80')]='accept';_0x4b71d3['message'][_0x05b8('0x48')]=htmlToText[_0x05b8('0x81')](_0x4b71d3['message'][_0x05b8('0x48')]);return respondWithRpcPromise(_0x05b8('0x82'),'EventManager',{'event':_0x05b8('0x83'),'message':_0x4b71d3[_0x05b8('0x1b')]},client9002)[_0x05b8('0x23')](function(){return _0x4b71d3;});}return _0x4b71d3;}return null;})['then'](respondWithResult(_0x5837c9,null))[_0x05b8('0x43')](handleError(_0x5837c9,null));};exports[_0x05b8('0x84')]=function(_0x573351,_0x2d4abe){var _0x13af7c={'agent':{},'channel':_0x05b8('0x64')};if(_0x573351[_0x05b8('0x48')]['id']){delete _0x573351['body']['id'];}_0x573351['body'][_0x05b8('0x68')]=_0x573351['body'][_0x05b8('0x68')]||_0x573351[_0x05b8('0x69')]['id'];_0x13af7c[_0x05b8('0x6a')]['id']=_0x573351[_0x05b8('0x48')][_0x05b8('0x68')];return db[_0x05b8('0x28')][_0x05b8('0x47')]({'where':{'id':_0x573351[_0x05b8('0x45')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x2d4abe,null))[_0x05b8('0x23')](function(_0x23ea43){if(_0x23ea43){_0x13af7c[_0x05b8('0x1b')]=_0x23ea43[_0x05b8('0x6b')]({'plain':!![]});return db['MailInteraction']['find']({'where':{'id':_0x23ea43[_0x05b8('0x85')]}});}return null;})['then'](handleEntityNotFound(_0x2d4abe,null))[_0x05b8('0x23')](function(_0x4b97ed){if(_0x4b97ed){_0x13af7c['interaction']=_0x4b97ed[_0x05b8('0x6b')]({'plain':!![]});interaction_log[_0x05b8('0x15')](_0x05b8('0x86'),_0x573351['user']['id'],_0x573351[_0x05b8('0x69')][_0x05b8('0x2d')],_0x573351['user'][_0x05b8('0x6f')],_0x13af7c[_0x05b8('0x6e')]['id'],_0x573351[_0x05b8('0x48')]?JSON[_0x05b8('0x19')](_0x573351[_0x05b8('0x48')]):'null');return respondWithRpcPromise(_0x05b8('0x87'),_0x05b8('0x88'),_0x13af7c);}return null;})[_0x05b8('0x23')](function(_0x4c167f){var _0x445546=_0x05b8('0x89')+_0x4c167f['message']['ContactId'];return db[_0x05b8('0x74')][_0x05b8('0x2e')](_0x445546,{'type':db['Sequelize']['QueryTypes'][_0x05b8('0x76')],'raw':!![]})[_0x05b8('0x23')](function(_0x58a339){return _0x58a339;});})['then'](function(_0x1a13fe){if(_0x1a13fe){_0x13af7c[_0x05b8('0x1b')][_0x05b8('0x77')]=_0x1a13fe[0x0];if(!_0x573351[_0x05b8('0x48')][_0x05b8('0x68')])return;return db['User'][_0x05b8('0x47')]({'where':{'id':_0x573351['body'][_0x05b8('0x68')],'role':_0x05b8('0x6a')},'attributes':['id',_0x05b8('0x2d'),'fullname',_0x05b8('0x7a'),_0x05b8('0x7b')],'raw':!![]});}return null;})[_0x05b8('0x23')](function(_0x26ba12){if(!_0x26ba12)return null;_0x13af7c[_0x05b8('0x1b')][_0x05b8('0x6a')]=_0x26ba12;return _0x13af7c;})['then'](function(_0x1eb254){if(_0x1eb254){_0x1eb254[_0x05b8('0x1b')][_0x05b8('0x8a')]=util['format'](_0x05b8('0x7d'),_0x573351['user'][_0x05b8('0x2d')]);_0x1eb254['message'][_0x05b8('0x7e')]=_0x13af7c[_0x05b8('0x7e')];_0x1eb254[_0x05b8('0x1b')][_0x05b8('0x7f')]=_0x13af7c['channel'];_0x1eb254[_0x05b8('0x1b')][_0x05b8('0x80')]=_0x05b8('0x84');_0x1eb254[_0x05b8('0x1b')][_0x05b8('0x48')]=htmlToText[_0x05b8('0x81')](_0x13af7c[_0x05b8('0x1b')][_0x05b8('0x48')]);respondWithRpcPromise(_0x05b8('0x82'),_0x05b8('0x82'),{'event':_0x05b8('0x8b'),'message':_0x1eb254['message']},client9002);return _0x13af7c;}return null;})['then'](respondWithResult(_0x2d4abe,null))['catch'](handleError(_0x2d4abe,null));};exports[_0x05b8('0x8c')]=function(_0x259311,_0xe6268e){var _0x23cba8=moment()[_0x05b8('0x8d')]()[_0x05b8('0x8e')]();var _0x1bd534=path[_0x05b8('0x5a')](config[_0x05b8('0x5b')],'server',_0x05b8('0x8f'),_0x05b8('0x90'));var _0x590087=path[_0x05b8('0x5a')](config[_0x05b8('0x5b')],_0x05b8('0x91'),_0x05b8('0x8f'),_0x05b8('0x59'));var _0x1ee29b=util['format'](_0x05b8('0x92'),_0x23cba8);return db['MailMessage'][_0x05b8('0x47')]({'where':{'id':_0x259311[_0x05b8('0x45')]['id']},'attributes':['id','body',_0x05b8('0x93'),'to','cc','bcc',_0x05b8('0x94'),_0x05b8('0x95')],'include':_0x259311[_0x05b8('0x2e')][_0x05b8('0x59')]?[{'model':db[_0x05b8('0x96')],'as':_0x05b8('0x97')}]:undefined})[_0x05b8('0x23')](handleEntityNotFound(_0xe6268e,null))['then'](function(_0x1689e2){if(_0x1689e2){var _0x4c012b=_0x1689e2;var _0x52289d={'from':_0x4c012b[_0x05b8('0x93')],'to':_0x4c012b['to'],'subject':_0x4c012b[_0x05b8('0x94')],'html':htmlEntities[_0x05b8('0x98')](_0x4c012b[_0x05b8('0x48')]),'headers':{'Date':moment(_0x4c012b[_0x05b8('0x95')])[_0x05b8('0x66')](_0x05b8('0x99'))},'attachments':[]};if(_0x1689e2['cc']){_0x52289d[_0x05b8('0x9a')]['Cc']=_0x1689e2['cc'];}if(_0x1689e2[_0x05b8('0x9b')]){_0x52289d[_0x05b8('0x9a')][_0x05b8('0x9c')]=_0x1689e2[_0x05b8('0x9b')];}return new BPromise(function(_0x21d8de,_0x4e47fc){if(_0x1689e2[_0x05b8('0x97')]){for(var _0x997544=0x0;_0x997544<_0x1689e2[_0x05b8('0x97')][_0x05b8('0x34')];_0x997544++){var _0x3c271a=_0x1689e2[_0x05b8('0x97')][_0x997544];var _0x2f413e=path['join'](_0x590087,_0x3c271a[_0x05b8('0x5d')]);if(fs[_0x05b8('0x9d')](_0x2f413e)){_0x52289d[_0x05b8('0x59')][_0x05b8('0x9e')]({'name':_0x3c271a[_0x05b8('0x2d')],'contentType':_0x3c271a[_0x05b8('0x2b')],'data':fs[_0x05b8('0x9f')](_0x2f413e)});}}}emlformat[_0x05b8('0xa0')](_0x52289d,function(_0x246ed7,_0x101696){if(_0x246ed7)return _0x4e47fc(_0x246ed7);fs[_0x05b8('0xa1')](path[_0x05b8('0x5a')](_0x1bd534,_0x1ee29b),_0x101696);return _0x21d8de(_0x101696);});});}})[_0x05b8('0x23')](function(_0x848aea){if(_0x848aea){return _0xe6268e[_0x05b8('0x8c')](path[_0x05b8('0x5a')](_0x1bd534,_0x1ee29b),_0x1ee29b,function(_0x3a71d9){if(!_0x3a71d9)fs[_0x05b8('0xa2')](path[_0x05b8('0x5a')](_0x1bd534,_0x1ee29b));});}})[_0x05b8('0x43')](handleError(_0xe6268e,null));}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.events.js b/server/api/mailMessage/mailMessage.events.js index f777391..d72cf7a 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 _0xc709=['setMaxListeners','save','remove','emit','hasOwnProperty','exports','events','MailMessage'];(function(_0x41418c,_0x463e02){var _0x59975f=function(_0x8ac0a0){while(--_0x8ac0a0){_0x41418c['push'](_0x41418c['shift']());}};_0x59975f(++_0x463e02);}(_0xc709,0x1a6));var _0x9c70=function(_0x483ab9,_0x419148){_0x483ab9=_0x483ab9-0x0;var _0x35043b=_0xc709[_0x483ab9];return _0x35043b;};'use strict';var EventEmitter=require(_0x9c70('0x0'));var MailMessage=require('../../mysqldb')['db'][_0x9c70('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents[_0x9c70('0x2')](0x0);var events={'afterCreate':_0x9c70('0x3'),'afterUpdate':'update','afterDestroy':_0x9c70('0x4')};function emitEvent(_0x30fc01){return function(_0x3f7908,_0x46cfe4,_0x93c99d){MailMessageEvents[_0x9c70('0x5')](_0x30fc01+':'+_0x3f7908['id'],_0x3f7908);MailMessageEvents['emit'](_0x30fc01,_0x3f7908);_0x93c99d(null);};}for(var e in events){if(events[_0x9c70('0x6')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0x9c70('0x7')]=MailMessageEvents; \ No newline at end of file +var _0x2e3c=['exports','events','MailMessage','update','remove','emit','hasOwnProperty'];(function(_0x3bbde7,_0x344127){var _0x117992=function(_0x1d0170){while(--_0x1d0170){_0x3bbde7['push'](_0x3bbde7['shift']());}};_0x117992(++_0x344127);}(_0x2e3c,0xa9));var _0xc2e3=function(_0x124236,_0x4bea45){_0x124236=_0x124236-0x0;var _0x4d76b=_0x2e3c[_0x124236];return _0x4d76b;};'use strict';var EventEmitter=require(_0xc2e3('0x0'));var MailMessage=require('../../mysqldb')['db'][_0xc2e3('0x1')];var MailMessageEvents=new EventEmitter();MailMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0xc2e3('0x2'),'afterDestroy':_0xc2e3('0x3')};function emitEvent(_0x2e9820){return function(_0x4aad89,_0xef3054,_0x3752c8){MailMessageEvents['emit'](_0x2e9820+':'+_0x4aad89['id'],_0x4aad89);MailMessageEvents[_0xc2e3('0x4')](_0x2e9820,_0x4aad89);_0x3752c8(null);};}for(var e in events){if(events[_0xc2e3('0x5')](e)){var event=events[e];MailMessage['hook'](e,emitEvent(event));}}module[_0xc2e3('0x6')]=MailMessageEvents; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.model.js b/server/api/mailMessage/mailMessage.model.js index b61610b..b27d31c 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 _0x51e9=['isNil','UserId','findOne','MailInteractionId','then','update','createdAt','error','utf8mb4','utf8mb4_unicode_ci','lodash','../../config/logger','api','moment','bluebird','request-promise','html-to-text','rimraf','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','fti_mail_messages','plainBody','subject','FULLTEXT','body','fromString','models','direction','toLowerCase','secret'];(function(_0x4f7bef,_0x16130e){var _0x1612e9=function(_0x330849){while(--_0x330849){_0x4f7bef['push'](_0x4f7bef['shift']());}};_0x1612e9(++_0x16130e);}(_0x51e9,0xdc));var _0x951e=function(_0x2fa5a4,_0x4f5c70){_0x2fa5a4=_0x2fa5a4-0x0;var _0x20b66a=_0x51e9[_0x2fa5a4];return _0x20b66a;};'use strict';var _=require(_0x951e('0x0'));var util=require('util');var logger=require(_0x951e('0x1'))(_0x951e('0x2'));var moment=require(_0x951e('0x3'));var BPromise=require(_0x951e('0x4'));var rp=require(_0x951e('0x5'));var htmlToText=require(_0x951e('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x951e('0x7'));var config=require(_0x951e('0x8'));var attributes=require(_0x951e('0x9'));module[_0x951e('0xa')]=function(_0x3cd8b9,_0x4a13e5){return _0x3cd8b9[_0x951e('0xb')](_0x951e('0xc'),attributes,{'tableName':_0x951e('0xd'),'paranoid':![],'indexes':[{'name':_0x951e('0xe'),'fields':[_0x951e('0xe')]},{'name':_0x951e('0xf'),'fields':[_0x951e('0x10'),_0x951e('0x11')],'type':_0x951e('0x12')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x549a8e,_0x12ab16,_0xfca8d9){if(_0x549a8e[_0x951e('0x13')]){_0x549a8e['plainBody']=htmlToText[_0x951e('0x14')](_0x549a8e[_0x951e('0x13')],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0xfca8d9(null,_0x12ab16);},'afterCreate':function(_0x2bff80,_0x3a8dbd,_0x802411){var _0x73ef9e=_0x3cd8b9[_0x951e('0x15')];var _0x230967=_0x2bff80['get']({'plain':!![]});if(_0x230967[_0x951e('0x16')][_0x951e('0x17')]()==='in'||_0x230967['direction'][_0x951e('0x17')]()==='out'&&!_0x230967[_0x951e('0x18')]&&!_[_0x951e('0x19')](_0x230967[_0x951e('0x1a')])){_0x73ef9e['MailInteraction'][_0x951e('0x1b')]({'where':{'id':_0x230967[_0x951e('0x1c')]}})[_0x951e('0x1d')](function(_0x35e0ac){if(_0x35e0ac){_0x35e0ac[_0x951e('0x1e')]({'lastMsgAt':_0x230967[_0x951e('0x1f')],'lastMsgDirection':_0x230967[_0x951e('0x16')][_0x951e('0x17')]()});}})['catch'](function(_0x3cf795){console[_0x951e('0x20')](_0x3cf795);});}_0x802411();}},'charset':_0x951e('0x21'),'collate':_0x951e('0x22')});}; \ No newline at end of file +var _0x880a=['direction','toLowerCase','out','secret','UserId','MailInteraction','then','update','createdAt','error','utf8mb4','lodash','util','../../config/logger','api','request-promise','html-to-text','path','../../config/environment','./mailMessage.attributes','exports','define','MailMessage','mail_messages','messageId','subject','FULLTEXT','body','plainBody','fromString','models','get'];(function(_0x2be053,_0x366ad1){var _0x17e51d=function(_0x396c25){while(--_0x396c25){_0x2be053['push'](_0x2be053['shift']());}};_0x17e51d(++_0x366ad1);}(_0x880a,0x12b));var _0xa880=function(_0x22fb92,_0x45b950){_0x22fb92=_0x22fb92-0x0;var _0x51c54a=_0x880a[_0x22fb92];return _0x51c54a;};'use strict';var _=require(_0xa880('0x0'));var util=require(_0xa880('0x1'));var logger=require(_0xa880('0x2'))(_0xa880('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xa880('0x4'));var htmlToText=require(_0xa880('0x5'));var fs=require('fs');var path=require(_0xa880('0x6'));var rimraf=require('rimraf');var config=require(_0xa880('0x7'));var attributes=require(_0xa880('0x8'));module[_0xa880('0x9')]=function(_0x5865a5,_0x3561c1){return _0x5865a5[_0xa880('0xa')](_0xa880('0xb'),attributes,{'tableName':_0xa880('0xc'),'paranoid':![],'indexes':[{'name':_0xa880('0xd'),'fields':['messageId']},{'name':'fti_mail_messages','fields':['plainBody',_0xa880('0xe')],'type':_0xa880('0xf')}],'timestamps':!![],'hooks':{'beforeCreate':function(_0x26fb3a,_0x3536b9,_0x33a680){if(_0x26fb3a[_0xa880('0x10')]){_0x26fb3a[_0xa880('0x11')]=htmlToText[_0xa880('0x12')](_0x26fb3a['body'],{'preserveNewlines':!![],'singleNewLineParagraphs':!![],'uppercaseHeadings':![],'noLinkBrackets':!![],'ignoreImage':!![]});}_0x33a680(null,_0x3536b9);},'afterCreate':function(_0x432280,_0x301bc4,_0xec2096){var _0x4843a1=_0x5865a5[_0xa880('0x13')];var _0x1773d1=_0x432280[_0xa880('0x14')]({'plain':!![]});if(_0x1773d1[_0xa880('0x15')][_0xa880('0x16')]()==='in'||_0x1773d1[_0xa880('0x15')][_0xa880('0x16')]()===_0xa880('0x17')&&!_0x1773d1[_0xa880('0x18')]&&!_['isNil'](_0x1773d1[_0xa880('0x19')])){_0x4843a1[_0xa880('0x1a')]['findOne']({'where':{'id':_0x1773d1['MailInteractionId']}})[_0xa880('0x1b')](function(_0x628647){if(_0x628647){_0x628647[_0xa880('0x1c')]({'lastMsgAt':_0x1773d1[_0xa880('0x1d')],'lastMsgDirection':_0x1773d1[_0xa880('0x15')][_0xa880('0x16')]()});}})['catch'](function(_0x5a229b){console[_0xa880('0x1e')](_0x5a229b);});}_0xec2096();}},'charset':_0xa880('0x1f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.rpc.js b/server/api/mailMessage/mailMessage.rpc.js index 8739e03..9e34a85 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 _0xb78e=['http','redis','defaults','localhost','socket.io-emitter','./mailMessage.socket','register','request','then','info','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateMailMessage','MailMessage','create','body','options','raw','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client'];(function(_0x510275,_0x5a9044){var _0x15488c=function(_0x56123a){while(--_0x56123a){_0x510275['push'](_0x510275['shift']());}};_0x15488c(++_0x5a9044);}(_0xb78e,0x1c9));var _0xeb78=function(_0x4b3a17,_0x30fdb4){_0x4b3a17=_0x4b3a17-0x0;var _0x574a2b=_0xb78e[_0x4b3a17];return _0x574a2b;};'use strict';var _=require(_0xeb78('0x0'));var util=require(_0xeb78('0x1'));var moment=require('moment');var BPromise=require(_0xeb78('0x2'));var rs=require(_0xeb78('0x3'));var fs=require('fs');var Redis=require(_0xeb78('0x4'));var db=require(_0xeb78('0x5'))['db'];var utils=require(_0xeb78('0x6'));var logger=require(_0xeb78('0x7'))(_0xeb78('0x8'));var config=require(_0xeb78('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xeb78('0xa')][_0xeb78('0xb')]({'port':0x232a});config[_0xeb78('0xc')]=_[_0xeb78('0xd')](config[_0xeb78('0xc')],{'host':_0xeb78('0xe'),'port':0x18eb});var socket=require(_0xeb78('0xf'))(new Redis(config['redis']));require(_0xeb78('0x10'))[_0xeb78('0x11')](socket);function respondWithRpcPromise(_0xa1ca82,_0x46fbad,_0x125e97){return new BPromise(function(_0x402680,_0x15137b){return client[_0xeb78('0x12')](_0xa1ca82,_0x125e97)[_0xeb78('0x13')](function(_0x59d8d8){logger[_0xeb78('0x14')](_0xeb78('0x15'),_0x46fbad,_0xeb78('0x16'));logger[_0xeb78('0x17')](_0xeb78('0x18'),_0x46fbad,_0xeb78('0x16'),JSON[_0xeb78('0x19')](_0x59d8d8));if(_0x59d8d8[_0xeb78('0x1a')]){if(_0x59d8d8[_0xeb78('0x1a')][_0xeb78('0x1b')]===0x1f4){logger['error'](_0xeb78('0x15'),_0x46fbad,_0x59d8d8[_0xeb78('0x1a')]['message']);return _0x15137b(_0x59d8d8['error']['message']);}logger[_0xeb78('0x1a')]('MailMessage,\x20%s,\x20%s',_0x46fbad,_0x59d8d8[_0xeb78('0x1a')][_0xeb78('0x1c')]);return _0x402680(_0x59d8d8['error'][_0xeb78('0x1c')]);}else{logger['info'](_0xeb78('0x15'),_0x46fbad,_0xeb78('0x16'));_0x402680(_0x59d8d8['result'][_0xeb78('0x1c')]);}})[_0xeb78('0x1d')](function(_0x1cb338){logger['error'](_0xeb78('0x15'),_0x46fbad,_0x1cb338);_0x15137b(_0x1cb338);});});}exports[_0xeb78('0x1e')]=function(_0x4ab933){var _0x48b106=this;return new Promise(function(_0x455e30,_0x106c5d){return db[_0xeb78('0x1f')][_0xeb78('0x20')](_0x4ab933[_0xeb78('0x21')],{'raw':_0x4ab933[_0xeb78('0x22')]?_0x4ab933[_0xeb78('0x22')][_0xeb78('0x23')]===undefined?!![]:![]:!![]})[_0xeb78('0x13')](function(_0x52b8c1){logger['info']('CreateMailMessage',_0x4ab933);logger['debug'](_0xeb78('0x1e'),_0x4ab933,JSON['stringify'](_0x52b8c1));_0x455e30(_0x52b8c1);})[_0xeb78('0x1d')](function(_0x1fbf2f){logger['error'](_0xeb78('0x1e'),_0x1fbf2f['message'],_0x4ab933);_0x106c5d(_0x48b106[_0xeb78('0x1a')](0x1f4,_0x1fbf2f[_0xeb78('0x1c')]));});});}; \ No newline at end of file +var _0xb9be=['redis','localhost','socket.io-emitter','./mailMessage.socket','register','then','MailMessage,\x20%s,\x20%s','request\x20sent','debug','MailMessage,\x20%s,\x20%s,\x20%s','error','code','message','info','result','catch','CreateMailMessage','MailMessage','create','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','defaults'];(function(_0x29f80e,_0x9027ff){var _0x5c7eaa=function(_0x48ec7c){while(--_0x48ec7c){_0x29f80e['push'](_0x29f80e['shift']());}};_0x5c7eaa(++_0x9027ff);}(_0xb9be,0xc5));var _0xeb9b=function(_0x4af01e,_0x543f5c){_0x4af01e=_0x4af01e-0x0;var _0x178c11=_0xb9be[_0x4af01e];return _0x178c11;};'use strict';var _=require(_0xeb9b('0x0'));var util=require(_0xeb9b('0x1'));var moment=require(_0xeb9b('0x2'));var BPromise=require(_0xeb9b('0x3'));var rs=require(_0xeb9b('0x4'));var fs=require('fs');var Redis=require(_0xeb9b('0x5'));var db=require(_0xeb9b('0x6'))['db'];var utils=require(_0xeb9b('0x7'));var logger=require(_0xeb9b('0x8'))('rpc');var config=require('../../config/environment');var jayson=require(_0xeb9b('0x9'));var client=jayson[_0xeb9b('0xa')][_0xeb9b('0xb')]({'port':0x232a});config['redis']=_[_0xeb9b('0xc')](config[_0xeb9b('0xd')],{'host':_0xeb9b('0xe'),'port':0x18eb});var socket=require(_0xeb9b('0xf'))(new Redis(config[_0xeb9b('0xd')]));require(_0xeb9b('0x10'))[_0xeb9b('0x11')](socket);function respondWithRpcPromise(_0x16761a,_0x32f0c4,_0x4f4952){return new BPromise(function(_0x20c855,_0x58d6a4){return client['request'](_0x16761a,_0x4f4952)[_0xeb9b('0x12')](function(_0x4236c0){logger['info'](_0xeb9b('0x13'),_0x32f0c4,_0xeb9b('0x14'));logger[_0xeb9b('0x15')](_0xeb9b('0x16'),_0x32f0c4,'request\x20sent',JSON['stringify'](_0x4236c0));if(_0x4236c0['error']){if(_0x4236c0[_0xeb9b('0x17')][_0xeb9b('0x18')]===0x1f4){logger[_0xeb9b('0x17')]('MailMessage,\x20%s,\x20%s',_0x32f0c4,_0x4236c0['error']['message']);return _0x58d6a4(_0x4236c0[_0xeb9b('0x17')][_0xeb9b('0x19')]);}logger[_0xeb9b('0x17')](_0xeb9b('0x13'),_0x32f0c4,_0x4236c0[_0xeb9b('0x17')][_0xeb9b('0x19')]);return _0x20c855(_0x4236c0[_0xeb9b('0x17')]['message']);}else{logger[_0xeb9b('0x1a')](_0xeb9b('0x13'),_0x32f0c4,_0xeb9b('0x14'));_0x20c855(_0x4236c0[_0xeb9b('0x1b')][_0xeb9b('0x19')]);}})[_0xeb9b('0x1c')](function(_0x21010e){logger[_0xeb9b('0x17')](_0xeb9b('0x13'),_0x32f0c4,_0x21010e);_0x58d6a4(_0x21010e);});});}exports[_0xeb9b('0x1d')]=function(_0x4f436e){var _0x43dc48=this;return new Promise(function(_0x5a7ffd,_0x5d5f54){return db[_0xeb9b('0x1e')][_0xeb9b('0x1f')](_0x4f436e['body'],{'raw':_0x4f436e[_0xeb9b('0x20')]?_0x4f436e[_0xeb9b('0x20')][_0xeb9b('0x21')]===undefined?!![]:![]:!![]})[_0xeb9b('0x12')](function(_0x3c8be7){logger[_0xeb9b('0x1a')](_0xeb9b('0x1d'),_0x4f436e);logger[_0xeb9b('0x15')](_0xeb9b('0x1d'),_0x4f436e,JSON[_0xeb9b('0x22')](_0x3c8be7));_0x5a7ffd(_0x3c8be7);})[_0xeb9b('0x1c')](function(_0x296f95){logger[_0xeb9b('0x17')](_0xeb9b('0x1d'),_0x296f95[_0xeb9b('0x19')],_0x4f436e);_0x5d5f54(_0x43dc48[_0xeb9b('0x17')](0x1f4,_0x296f95['message']));});});}; \ No newline at end of file diff --git a/server/api/mailMessage/mailMessage.socket.js b/server/api/mailMessage/mailMessage.socket.js index 4f95275..bbe8766 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 _0xb647=['register','length','mailMessage:','./mailMessage.events','save','remove','update','emit'];(function(_0x17d4fc,_0x22e86e){var _0x1fcb1d=function(_0x41a674){while(--_0x41a674){_0x17d4fc['push'](_0x17d4fc['shift']());}};_0x1fcb1d(++_0x22e86e);}(_0xb647,0xdb));var _0x7b64=function(_0x1f96da,_0x1bee5b){_0x1f96da=_0x1f96da-0x0;var _0x961b2=_0xb647[_0x1f96da];return _0x961b2;};'use strict';var MailMessageEvents=require(_0x7b64('0x0'));var events=[_0x7b64('0x1'),_0x7b64('0x2'),_0x7b64('0x3')];function createListener(_0x38de52,_0x3b659e){return function(_0x274824){_0x3b659e[_0x7b64('0x4')](_0x38de52,_0x274824);};}function removeListener(_0x54eee8,_0x36ff12){return function(){MailMessageEvents['removeListener'](_0x54eee8,_0x36ff12);};}exports[_0x7b64('0x5')]=function(_0x38ebf7){for(var _0x31915b=0x0,_0x80721a=events[_0x7b64('0x6')];_0x31915b<_0x80721a;_0x31915b++){var _0x22eca3=events[_0x31915b];var _0x727684=createListener(_0x7b64('0x7')+_0x22eca3,_0x38ebf7);MailMessageEvents['on'](_0x22eca3,_0x727684);}}; \ No newline at end of file +var _0x93fa=['register','length','mailMessage:','./mailMessage.events','remove','update','emit','removeListener'];(function(_0x120310,_0x41ae2c){var _0x168972=function(_0x33b7ca){while(--_0x33b7ca){_0x120310['push'](_0x120310['shift']());}};_0x168972(++_0x41ae2c);}(_0x93fa,0x17b));var _0xa93f=function(_0x2fc113,_0x45ec6e){_0x2fc113=_0x2fc113-0x0;var _0x5144ce=_0x93fa[_0x2fc113];return _0x5144ce;};'use strict';var MailMessageEvents=require(_0xa93f('0x0'));var events=['save',_0xa93f('0x1'),_0xa93f('0x2')];function createListener(_0x272eaf,_0x350532){return function(_0x3e3afb){_0x350532[_0xa93f('0x3')](_0x272eaf,_0x3e3afb);};}function removeListener(_0x17a24a,_0x3e3963){return function(){MailMessageEvents[_0xa93f('0x4')](_0x17a24a,_0x3e3963);};}exports[_0xa93f('0x5')]=function(_0x88310e){for(var _0x22f08b=0x0,_0x3f7fb4=events[_0xa93f('0x6')];_0x22f08b<_0x3f7fb4;_0x22f08b++){var _0x59d028=events[_0x22f08b];var _0x1e6ddc=createListener(_0xa93f('0x7')+_0x59d028,_0x88310e);MailMessageEvents['on'](_0x59d028,_0x1e6ddc);}}; \ No newline at end of file diff --git a/server/api/mailQueue/index.js b/server/api/mailQueue/index.js index 01df33e..52ebb59 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 _0x611c=['removeTeams','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./mailQueue.controller','get','isAuthenticated','index','/describe','describe','/:id','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','put','delete','destroy'];(function(_0x151418,_0x2cbffa){var _0x40e29a=function(_0xec4d7){while(--_0xec4d7){_0x151418['push'](_0x151418['shift']());}};_0x40e29a(++_0x2cbffa);}(_0x611c,0xc5));var _0xc611=function(_0x42539d,_0x3c9b8a){_0x42539d=_0x42539d-0x0;var _0x2dac44=_0x611c[_0x42539d];return _0x2dac44;};'use strict';var multer=require(_0xc611('0x0'));var util=require(_0xc611('0x1'));var path=require(_0xc611('0x2'));var timeout=require(_0xc611('0x3'));var express=require('express');var router=express[_0xc611('0x4')]();var fs_extra=require(_0xc611('0x5'));var auth=require(_0xc611('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc611('0x7'));var controller=require(_0xc611('0x8'));router[_0xc611('0x9')]('/',auth[_0xc611('0xa')](),controller[_0xc611('0xb')]);router['get'](_0xc611('0xc'),auth[_0xc611('0xa')](),controller[_0xc611('0xd')]);router[_0xc611('0x9')](_0xc611('0xe'),auth[_0xc611('0xa')](),controller['show']);router[_0xc611('0x9')](_0xc611('0xf'),auth[_0xc611('0xa')](),controller[_0xc611('0x10')]);router[_0xc611('0x9')]('/:id/teams',auth[_0xc611('0xa')](),controller[_0xc611('0x11')]);router[_0xc611('0x9')]('/:id/users',auth[_0xc611('0xa')](),controller[_0xc611('0x12')]);router[_0xc611('0x13')]('/',auth[_0xc611('0xa')](),controller[_0xc611('0x14')]);router[_0xc611('0x13')](_0xc611('0x15'),auth[_0xc611('0xa')](),controller[_0xc611('0x16')]);router[_0xc611('0x13')](_0xc611('0x17'),auth[_0xc611('0xa')](),controller['addAgents']);router[_0xc611('0x18')](_0xc611('0xe'),auth[_0xc611('0xa')](),controller['update']);router[_0xc611('0x19')]('/:id',auth[_0xc611('0xa')](),controller[_0xc611('0x1a')]);router[_0xc611('0x19')](_0xc611('0x15'),auth[_0xc611('0xa')](),controller[_0xc611('0x1b')]);router[_0xc611('0x19')](_0xc611('0x17'),auth[_0xc611('0xa')](),controller['removeAgents']);module['exports']=router; \ No newline at end of file +var _0xf51b=['get','describe','/:id','show','getMembers','getTeams','/:id/users','getAgents','create','post','addTeams','addAgents','put','update','destroy','delete','removeTeams','removeAgents','exports','multer','path','connect-timeout','express','Router','../../config/environment','isAuthenticated','index'];(function(_0x5944e9,_0xf3da60){var _0x1098b8=function(_0x265f4){while(--_0x265f4){_0x5944e9['push'](_0x5944e9['shift']());}};_0x1098b8(++_0xf3da60);}(_0xf51b,0x1de));var _0xbf51=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf51b[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0xbf51('0x0'));var util=require('util');var path=require(_0xbf51('0x1'));var timeout=require(_0xbf51('0x2'));var express=require(_0xbf51('0x3'));var router=express[_0xbf51('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xbf51('0x5'));var controller=require('./mailQueue.controller');router['get']('/',auth[_0xbf51('0x6')](),controller[_0xbf51('0x7')]);router[_0xbf51('0x8')]('/describe',auth['isAuthenticated'](),controller[_0xbf51('0x9')]);router['get'](_0xbf51('0xa'),auth[_0xbf51('0x6')](),controller[_0xbf51('0xb')]);router['get']('/:id/members',auth[_0xbf51('0x6')](),controller[_0xbf51('0xc')]);router['get']('/:id/teams',auth[_0xbf51('0x6')](),controller[_0xbf51('0xd')]);router[_0xbf51('0x8')](_0xbf51('0xe'),auth[_0xbf51('0x6')](),controller[_0xbf51('0xf')]);router['post']('/',auth[_0xbf51('0x6')](),controller[_0xbf51('0x10')]);router[_0xbf51('0x11')]('/:id/teams',auth['isAuthenticated'](),controller[_0xbf51('0x12')]);router['post']('/:id/users',auth[_0xbf51('0x6')](),controller[_0xbf51('0x13')]);router[_0xbf51('0x14')](_0xbf51('0xa'),auth[_0xbf51('0x6')](),controller[_0xbf51('0x15')]);router['delete'](_0xbf51('0xa'),auth['isAuthenticated'](),controller[_0xbf51('0x16')]);router[_0xbf51('0x17')]('/:id/teams',auth[_0xbf51('0x6')](),controller[_0xbf51('0x18')]);router['delete']('/:id/users',auth[_0xbf51('0x6')](),controller[_0xbf51('0x19')]);module[_0xbf51('0x1a')]=router; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.attributes.js b/server/api/mailQueue/mailQueue.attributes.js index 82cc8ae..1eca42f 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 _0x2052=['roundrobin','sequelize','exports','INTEGER','ENUM','rrmemory','beepall'];(function(_0x4fdcc0,_0x560a01){var _0xc0ce94=function(_0x36ea12){while(--_0x36ea12){_0x4fdcc0['push'](_0x4fdcc0['shift']());}};_0xc0ce94(++_0x560a01);}(_0x2052,0xef));var _0x2205=function(_0x418547,_0x5145af){_0x418547=_0x418547-0x0;var _0x30a56f=_0x2052[_0x418547];return _0x30a56f;};'use strict';var Sequelize=require(_0x2205('0x0'));module[_0x2205('0x1')]={'name':{'type':Sequelize['STRING'],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize['STRING']},'timeout':{'type':Sequelize[_0x2205('0x2')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x2205('0x3')](_0x2205('0x4'),_0x2205('0x5'),_0x2205('0x6'))}}; \ No newline at end of file +var _0xd8bb=['name','STRING','ENUM','beepall','roundrobin','sequelize','exports'];(function(_0x3a0657,_0xe6d0bc){var _0x458819=function(_0x1f66a5){while(--_0x1f66a5){_0x3a0657['push'](_0x3a0657['shift']());}};_0x458819(++_0xe6d0bc);}(_0xd8bb,0x1a2));var _0xbd8b=function(_0x11eb1d,_0xaa8fd4){_0x11eb1d=_0x11eb1d-0x0;var _0xbecc73=_0xd8bb[_0x11eb1d];return _0xbecc73;};'use strict';var Sequelize=require(_0xbd8b('0x0'));module[_0xbd8b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0xbd8b('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0xbd8b('0x3')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0xbd8b('0x4')]('rrmemory',_0xbd8b('0x5'),_0xbd8b('0x6'))}}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.controller.js b/server/api/mailQueue/mailQueue.controller.js index f9dd96a..e460746 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 _0xb7a9=['moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','sendStatus','status','end','offset','limit','undefined','set','json','apply','update','then','destroy','UserProfileResource','error','stack','name','send','map','MailQueue','rawAttributes','fieldName','key','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','count','includeAll','findAll','catch','show','params','keys','include','find','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','findOne','UserMailQueue','MailQueueId','User','mailPause','updatedAt','createdAt','rows','format','%s/%s','getTeams','Team','addTeams','ids','voicePause','flatMap','sequelize','transaction','each','forEach','userMailQueue:save','removeTeams','Agents','select','field','tq.TeamId','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','compact','value','isEmpty','removeAgents','emit','userMailQueue:remove','addAgents','isArray','getAgents','eml-format','rimraf','zip-dir','fast-json-patch'];(function(_0x81cf76,_0x4c434a){var _0x26d14f=function(_0x30786d){while(--_0x30786d){_0x81cf76['push'](_0x81cf76['shift']());}};_0x26d14f(++_0x4c434a);}(_0xb7a9,0x1a3));var _0x9b7a=function(_0xa9d74c,_0x3fa658){_0xa9d74c=_0xa9d74c-0x0;var _0x6a6c70=_0xb7a9[_0xa9d74c];return _0x6a6c70;};'use strict';var emlformat=require(_0x9b7a('0x0'));var rimraf=require(_0x9b7a('0x1'));var zipdir=require(_0x9b7a('0x2'));var jsonpatch=require(_0x9b7a('0x3'));var rp=require('request-promise');var moment=require(_0x9b7a('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x9b7a('0x5'));var util=require(_0x9b7a('0x6'));var path=require(_0x9b7a('0x7'));var sox=require(_0x9b7a('0x8'));var csv=require(_0x9b7a('0x9'));var ejs=require(_0x9b7a('0xa'));var fs=require('fs');var fs_extra=require(_0x9b7a('0xb'));var _=require(_0x9b7a('0xc'));var squel=require(_0x9b7a('0xd'));var crypto=require(_0x9b7a('0xe'));var jsforce=require(_0x9b7a('0xf'));var deskjs=require(_0x9b7a('0x10'));var toCsv=require('to-csv');var querystring=require(_0x9b7a('0x11'));var Papa=require(_0x9b7a('0x12'));var Redis=require(_0x9b7a('0x13'));var authService=require('../../components/auth/service');var qs=require(_0x9b7a('0x14'));var as=require(_0x9b7a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x9b7a('0x16'));var utils=require(_0x9b7a('0x17'));var config=require(_0x9b7a('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9b7a('0x19'))['db'];config[_0x9b7a('0x1a')]=_[_0x9b7a('0x1b')](config[_0x9b7a('0x1a')],{'host':_0x9b7a('0x1c'),'port':0x18eb});var socket=require(_0x9b7a('0x1d'))(new Redis(config[_0x9b7a('0x1a')]));require(_0x9b7a('0x1e'))[_0x9b7a('0x1f')](socket);function respondWithStatusCode(_0x1ec7f2,_0x3ab3c6){_0x3ab3c6=_0x3ab3c6||0xcc;return function(_0xe017bc){if(_0xe017bc){return _0x1ec7f2[_0x9b7a('0x20')](_0x3ab3c6);}return _0x1ec7f2[_0x9b7a('0x21')](_0x3ab3c6)[_0x9b7a('0x22')]();};}function respondWithResult(_0x423976,_0x1ae638){_0x1ae638=_0x1ae638||0xc8;return function(_0x1e4bfa){if(_0x1e4bfa){return _0x423976['status'](_0x1ae638)['json'](_0x1e4bfa);}};}function respondWithFilteredResult(_0x164ed3,_0xc8773){return function(_0x4f5831){if(_0x4f5831){var _0xed3ca=typeof _0xc8773[_0x9b7a('0x23')]==='undefined'&&typeof _0xc8773[_0x9b7a('0x24')]===_0x9b7a('0x25');var _0x4bd204=_0x4f5831['count'];var _0x57e8e7=_0xed3ca?0x0:_0xc8773[_0x9b7a('0x23')];var _0x33c33a=_0xed3ca?_0x4f5831['count']:_0xc8773[_0x9b7a('0x23')]+_0xc8773[_0x9b7a('0x24')];var _0x551498;if(_0x33c33a>=_0x4bd204){_0x33c33a=_0x4bd204;_0x551498=0xc8;}else{_0x551498=0xce;}_0x164ed3[_0x9b7a('0x21')](_0x551498);return _0x164ed3[_0x9b7a('0x26')]('Content-Range',_0x57e8e7+'-'+_0x33c33a+'/'+_0x4bd204)[_0x9b7a('0x27')](_0x4f5831);}return null;};}function patchUpdates(_0x2c1a26){return function(_0x19ec01){try{jsonpatch[_0x9b7a('0x28')](_0x19ec01,_0x2c1a26,!![]);}catch(_0x35c10c){return BPromise['reject'](_0x35c10c);}return _0x19ec01['save']();};}function saveUpdates(_0x3e53de,_0x5646bb){return function(_0x56c139){if(_0x56c139){return _0x56c139[_0x9b7a('0x29')](_0x3e53de)[_0x9b7a('0x2a')](function(_0x222a9d){return _0x222a9d;});}return null;};}function removeEntity(_0x30ec57,_0x5570c8){return function(_0x52990b){if(_0x52990b){return _0x52990b[_0x9b7a('0x2b')]()[_0x9b7a('0x2a')](function(){var _0x15fca3=_0x52990b['get']({'plain':!![]});var _0x520e15='MailQueues';return db[_0x9b7a('0x2c')]['destroy']({'where':{'type':_0x520e15,'resourceId':_0x15fca3['id']}})[_0x9b7a('0x2a')](function(){return _0x52990b;});})[_0x9b7a('0x2a')](function(){_0x30ec57[_0x9b7a('0x21')](0xcc)[_0x9b7a('0x22')]();});}};}function handleEntityNotFound(_0x1ab1a2,_0x3b5d54){return function(_0x4eb38d){if(!_0x4eb38d){_0x1ab1a2['sendStatus'](0x194);}return _0x4eb38d;};}function handleError(_0x4ad7d3,_0x431bdd){_0x431bdd=_0x431bdd||0x1f4;return function(_0xeb7500){logger[_0x9b7a('0x2d')](_0xeb7500[_0x9b7a('0x2e')]);if(_0xeb7500[_0x9b7a('0x2f')]){delete _0xeb7500[_0x9b7a('0x2f')];}_0x4ad7d3['status'](_0x431bdd)[_0x9b7a('0x30')](_0xeb7500);};}exports['index']=function(_0x28930e,_0xe88c6b){var _0x3cadf2={},_0x29e35f={},_0x509c2e={'count':0x0,'rows':[]};var _0x2b98f8=_[_0x9b7a('0x31')](db[_0x9b7a('0x32')][_0x9b7a('0x33')],function(_0x45fa62){return{'name':_0x45fa62[_0x9b7a('0x34')],'type':_0x45fa62['type'][_0x9b7a('0x35')]};});_0x29e35f['model']=_['map'](_0x2b98f8,_0x9b7a('0x2f'));_0x29e35f[_0x9b7a('0x36')]=_['keys'](_0x28930e['query']);_0x29e35f[_0x9b7a('0x37')]=_[_0x9b7a('0x38')](_0x29e35f[_0x9b7a('0x39')],_0x29e35f[_0x9b7a('0x36')]);_0x3cadf2[_0x9b7a('0x3a')]=_[_0x9b7a('0x38')](_0x29e35f[_0x9b7a('0x39')],qs[_0x9b7a('0x3b')](_0x28930e[_0x9b7a('0x36')]['fields']));_0x3cadf2[_0x9b7a('0x3a')]=_0x3cadf2['attributes'][_0x9b7a('0x3c')]?_0x3cadf2[_0x9b7a('0x3a')]:_0x29e35f['model'];if(!_0x28930e[_0x9b7a('0x36')][_0x9b7a('0x3d')](_0x9b7a('0x3e'))){_0x3cadf2[_0x9b7a('0x24')]=qs[_0x9b7a('0x24')](_0x28930e[_0x9b7a('0x36')][_0x9b7a('0x24')]);_0x3cadf2[_0x9b7a('0x23')]=qs[_0x9b7a('0x23')](_0x28930e[_0x9b7a('0x36')][_0x9b7a('0x23')]);}_0x3cadf2[_0x9b7a('0x3f')]=qs[_0x9b7a('0x40')](_0x28930e['query'][_0x9b7a('0x40')]);_0x3cadf2[_0x9b7a('0x41')]=qs['filters'](_[_0x9b7a('0x42')](_0x28930e[_0x9b7a('0x36')],_0x29e35f[_0x9b7a('0x37')]),_0x2b98f8);if(_0x28930e[_0x9b7a('0x36')][_0x9b7a('0x43')]){_0x3cadf2['where']=_[_0x9b7a('0x44')](_0x3cadf2[_0x9b7a('0x41')],{'$or':_[_0x9b7a('0x31')](_0x2b98f8,function(_0x5d4e1a){if(_0x5d4e1a[_0x9b7a('0x45')]!==_0x9b7a('0x46')){var _0x119075={};_0x119075[_0x5d4e1a[_0x9b7a('0x2f')]]={'$like':'%'+_0x28930e[_0x9b7a('0x36')][_0x9b7a('0x43')]+'%'};return _0x119075;}})});}_0x3cadf2=_[_0x9b7a('0x44')]({},_0x3cadf2,_0x28930e[_0x9b7a('0x47')]);var _0x4e278b={'where':_0x3cadf2[_0x9b7a('0x41')]};return db[_0x9b7a('0x32')]['count'](_0x4e278b)['then'](function(_0x42ab39){_0x509c2e[_0x9b7a('0x48')]=_0x42ab39;if(_0x28930e[_0x9b7a('0x36')][_0x9b7a('0x49')]){_0x3cadf2['include']=[{'all':!![]}];}return db['MailQueue'][_0x9b7a('0x4a')](_0x3cadf2);})[_0x9b7a('0x2a')](function(_0x1dc1de){_0x509c2e['rows']=_0x1dc1de;return _0x509c2e;})[_0x9b7a('0x2a')](respondWithFilteredResult(_0xe88c6b,_0x3cadf2))[_0x9b7a('0x4b')](handleError(_0xe88c6b,null));};exports[_0x9b7a('0x4c')]=function(_0x77192f,_0x19b83c){var _0x3c390b={'raw':!![],'where':{'id':_0x77192f[_0x9b7a('0x4d')]['id']}},_0x2db9b2={};_0x2db9b2[_0x9b7a('0x39')]=_[_0x9b7a('0x4e')](db[_0x9b7a('0x32')][_0x9b7a('0x33')]);_0x2db9b2['query']=_[_0x9b7a('0x4e')](_0x77192f[_0x9b7a('0x36')]);_0x2db9b2['filters']=_['intersection'](_0x2db9b2['model'],_0x2db9b2[_0x9b7a('0x36')]);_0x3c390b[_0x9b7a('0x3a')]=_[_0x9b7a('0x38')](_0x2db9b2[_0x9b7a('0x39')],qs['fields'](_0x77192f[_0x9b7a('0x36')][_0x9b7a('0x3b')]));_0x3c390b[_0x9b7a('0x3a')]=_0x3c390b[_0x9b7a('0x3a')][_0x9b7a('0x3c')]?_0x3c390b['attributes']:_0x2db9b2[_0x9b7a('0x39')];if(_0x77192f[_0x9b7a('0x36')]['includeAll']){_0x3c390b[_0x9b7a('0x4f')]=[{'all':!![]}];}_0x3c390b=_[_0x9b7a('0x44')]({},_0x3c390b,_0x77192f[_0x9b7a('0x47')]);return db[_0x9b7a('0x32')][_0x9b7a('0x50')](_0x3c390b)['then'](handleEntityNotFound(_0x19b83c,null))[_0x9b7a('0x2a')](respondWithResult(_0x19b83c,null))[_0x9b7a('0x4b')](handleError(_0x19b83c,null));};exports[_0x9b7a('0x51')]=function(_0x5a70af,_0x218b8b){return db[_0x9b7a('0x32')][_0x9b7a('0x51')](_0x5a70af['body'],{})[_0x9b7a('0x2a')](function(_0x21be4d){var _0x307f4c=_0x5a70af[_0x9b7a('0x52')][_0x9b7a('0x53')]({'plain':!![]});if(!_0x307f4c)throw new Error(_0x9b7a('0x54'));if(_0x307f4c[_0x9b7a('0x55')]==='user'){var _0x4cb5e5=_0x21be4d[_0x9b7a('0x53')]({'plain':!![]});var _0x5e5996=_0x9b7a('0x56');return db[_0x9b7a('0x57')]['find']({'where':{'name':_0x5e5996,'userProfileId':_0x307f4c[_0x9b7a('0x58')]},'raw':!![]})[_0x9b7a('0x2a')](function(_0x54a877){if(_0x54a877&&_0x54a877[_0x9b7a('0x59')]===0x0){return db[_0x9b7a('0x2c')][_0x9b7a('0x51')]({'name':_0x4cb5e5[_0x9b7a('0x2f')],'resourceId':_0x4cb5e5['id'],'type':_0x54a877[_0x9b7a('0x2f')],'sectionId':_0x54a877['id']},{})['then'](function(){return _0x21be4d;});}else{return _0x21be4d;}})[_0x9b7a('0x4b')](function(_0x4942f2){logger[_0x9b7a('0x2d')](_0x9b7a('0x5a'),_0x4942f2);throw _0x4942f2;});}return _0x21be4d;})['then'](respondWithResult(_0x218b8b,0xc9))[_0x9b7a('0x4b')](handleError(_0x218b8b,null));};exports['update']=function(_0x429bb4,_0x2051a3){if(_0x429bb4[_0x9b7a('0x5b')]['id']){delete _0x429bb4[_0x9b7a('0x5b')]['id'];}return db[_0x9b7a('0x32')][_0x9b7a('0x50')]({'where':{'id':_0x429bb4[_0x9b7a('0x4d')]['id']}})[_0x9b7a('0x2a')](handleEntityNotFound(_0x2051a3,null))[_0x9b7a('0x2a')](saveUpdates(_0x429bb4[_0x9b7a('0x5b')],null))[_0x9b7a('0x2a')](respondWithResult(_0x2051a3,null))[_0x9b7a('0x4b')](handleError(_0x2051a3,null));};exports[_0x9b7a('0x2b')]=function(_0x897dfa,_0x24c5c5){return db['MailQueue']['find']({'where':{'id':_0x897dfa[_0x9b7a('0x4d')]['id']}})[_0x9b7a('0x2a')](handleEntityNotFound(_0x24c5c5,null))[_0x9b7a('0x2a')](removeEntity(_0x24c5c5,null))[_0x9b7a('0x4b')](handleError(_0x24c5c5,null));};exports[_0x9b7a('0x5c')]=function(_0x21c5bf,_0x52c1e2){return db[_0x9b7a('0x32')][_0x9b7a('0x5c')]()[_0x9b7a('0x2a')](respondWithResult(_0x52c1e2,null))[_0x9b7a('0x4b')](handleError(_0x52c1e2,null));};exports['getMembers']=function(_0x2a9150,_0x260af2,_0x5c2ee3){var _0x4b40bc={'raw':!![],'where':{}},_0x28d6bc={},_0x5453b0;return db[_0x9b7a('0x32')][_0x9b7a('0x5d')]({'where':{'id':_0x2a9150['params']['id']}})[_0x9b7a('0x2a')](handleEntityNotFound(_0x260af2,null))[_0x9b7a('0x2a')](function(_0x38a621){if(_0x38a621){_0x5453b0=_0x38a621[_0x9b7a('0x53')]({'plain':!![]});_0x28d6bc[_0x9b7a('0x39')]=_[_0x9b7a('0x4e')](db[_0x9b7a('0x5e')]['rawAttributes']);_0x28d6bc[_0x9b7a('0x36')]=_[_0x9b7a('0x4e')](_0x2a9150[_0x9b7a('0x36')]);_0x28d6bc['filters']=_[_0x9b7a('0x38')](_0x28d6bc[_0x9b7a('0x39')],_0x28d6bc[_0x9b7a('0x36')]);_0x4b40bc['attributes']=_[_0x9b7a('0x38')](_0x28d6bc[_0x9b7a('0x39')],qs[_0x9b7a('0x3b')](_0x2a9150[_0x9b7a('0x36')]['fields']));_0x4b40bc['attributes']=_0x4b40bc[_0x9b7a('0x3a')][_0x9b7a('0x3c')]?_0x4b40bc[_0x9b7a('0x3a')]:_0x28d6bc[_0x9b7a('0x39')];if(!_0x2a9150[_0x9b7a('0x36')]['hasOwnProperty']('nolimit')){_0x4b40bc[_0x9b7a('0x24')]=qs[_0x9b7a('0x24')](_0x2a9150[_0x9b7a('0x36')]['limit']);_0x4b40bc['offset']=qs[_0x9b7a('0x23')](_0x2a9150['query']['offset']);}_0x4b40bc[_0x9b7a('0x3f')]=qs['sort'](_0x2a9150[_0x9b7a('0x36')]['sort']);_0x4b40bc[_0x9b7a('0x41')]=qs['filters'](_[_0x9b7a('0x42')](_0x2a9150['query'],_0x28d6bc[_0x9b7a('0x37')]));_0x4b40bc[_0x9b7a('0x41')][_0x9b7a('0x5f')]=_0x38a621['id'];if(_0x2a9150[_0x9b7a('0x36')][_0x9b7a('0x43')]){_0x4b40bc[_0x9b7a('0x41')]=_['merge'](_0x4b40bc[_0x9b7a('0x41')],{'$or':_[_0x9b7a('0x31')](_0x4b40bc[_0x9b7a('0x3a')],function(_0x2c89ee){var _0x40805a={};_0x40805a[_0x2c89ee]={'$like':'%'+_0x2a9150[_0x9b7a('0x36')]['filter']+'%'};return _0x40805a;})});}_0x4b40bc=_[_0x9b7a('0x44')]({},_0x4b40bc,_0x2a9150[_0x9b7a('0x47')]);return db[_0x9b7a('0x5e')][_0x9b7a('0x4a')](_0x4b40bc);}})[_0x9b7a('0x2a')](function(_0x5aa2d8){if(_0x5aa2d8){return db[_0x9b7a('0x60')]['findAndCountAll']({'where':{'id':_['map'](_0x5aa2d8,'UserId'),'role':'agent'},'attributes':['id',_0x9b7a('0x2f'),_0x9b7a('0x61'),_0x9b7a('0x62'),_0x9b7a('0x63')]});}})[_0x9b7a('0x2a')](function(_0x26df4e){if(_0x26df4e){return{'count':_0x26df4e[_0x9b7a('0x48')],'rows':_[_0x9b7a('0x31')](_0x26df4e[_0x9b7a('0x64')],function(_0x17707a){return{'membername':_0x17707a[_0x9b7a('0x2f')],'UserId':_0x17707a['id'],'queue_name':_0x5453b0['name'],'MailQueueId':_0x5453b0['id'],'interface':util[_0x9b7a('0x65')](_0x9b7a('0x66'),'SIP',_0x17707a[_0x9b7a('0x2f')]),'penalty':0x0,'paused':_0x17707a[_0x9b7a('0x61')],'createdAt':_0x17707a[_0x9b7a('0x63')],'updatedAt':_0x17707a[_0x9b7a('0x62')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x9b7a('0x2a')](respondWithFilteredResult(_0x260af2,_0x4b40bc))[_0x9b7a('0x4b')](handleError(_0x260af2,null));};exports[_0x9b7a('0x67')]=function(_0x1f2e4a,_0x2b2b33,_0x25fc1e){var _0x525abe={};var _0x1d0b5f={};var _0x576427;var _0x52c4a1;return db[_0x9b7a('0x32')][_0x9b7a('0x5d')]({'where':{'id':_0x1f2e4a[_0x9b7a('0x4d')]['id']}})[_0x9b7a('0x2a')](handleEntityNotFound(_0x2b2b33,null))[_0x9b7a('0x2a')](function(_0x6917b3){if(_0x6917b3){_0x576427=_0x6917b3;_0x1d0b5f['model']=_['keys'](db[_0x9b7a('0x68')][_0x9b7a('0x33')]);_0x1d0b5f[_0x9b7a('0x36')]=_[_0x9b7a('0x4e')](_0x1f2e4a[_0x9b7a('0x36')]);_0x1d0b5f[_0x9b7a('0x37')]=_[_0x9b7a('0x38')](_0x1d0b5f[_0x9b7a('0x39')],_0x1d0b5f[_0x9b7a('0x36')]);_0x525abe['attributes']=_[_0x9b7a('0x38')](_0x1d0b5f[_0x9b7a('0x39')],qs[_0x9b7a('0x3b')](_0x1f2e4a[_0x9b7a('0x36')]['fields']));_0x525abe['attributes']=_0x525abe['attributes'][_0x9b7a('0x3c')]?_0x525abe[_0x9b7a('0x3a')]:_0x1d0b5f['model'];_0x525abe['order']=qs[_0x9b7a('0x40')](_0x1f2e4a[_0x9b7a('0x36')][_0x9b7a('0x40')]);_0x525abe[_0x9b7a('0x41')]=qs['filters'](_[_0x9b7a('0x42')](_0x1f2e4a['query'],_0x1d0b5f[_0x9b7a('0x37')]));if(_0x1f2e4a[_0x9b7a('0x36')][_0x9b7a('0x43')]){_0x525abe[_0x9b7a('0x41')]=_['merge'](_0x525abe['where'],{'$or':_[_0x9b7a('0x31')](_0x525abe[_0x9b7a('0x3a')],function(_0x4b133b){var _0x4618db={};_0x4618db[_0x4b133b]={'$like':'%'+_0x1f2e4a['query'][_0x9b7a('0x43')]+'%'};return _0x4618db;})});}_0x525abe=_['merge']({},_0x525abe,_0x1f2e4a[_0x9b7a('0x47')]);return _0x576427[_0x9b7a('0x67')](_0x525abe);}})['then'](function(_0x5d1cd5){if(_0x5d1cd5){_0x52c4a1=_0x5d1cd5['length'];if(!_0x1f2e4a['query'][_0x9b7a('0x3d')](_0x9b7a('0x3e'))){_0x525abe[_0x9b7a('0x24')]=qs[_0x9b7a('0x24')](_0x1f2e4a[_0x9b7a('0x36')]['limit']);_0x525abe[_0x9b7a('0x23')]=qs['offset'](_0x1f2e4a['query'][_0x9b7a('0x23')]);}return _0x576427['getTeams'](_0x525abe);}})[_0x9b7a('0x2a')](function(_0x411324){if(_0x411324){return _0x411324?{'count':_0x52c4a1,'rows':_0x411324}:null;}})[_0x9b7a('0x2a')](respondWithResult(_0x2b2b33,null))[_0x9b7a('0x4b')](handleError(_0x2b2b33,null));};exports[_0x9b7a('0x69')]=function(_0x25f2a4,_0x699f9d,_0x481c66){var _0x19fbc9=_0x25f2a4[_0x9b7a('0x5b')][_0x9b7a('0x6a')];return db[_0x9b7a('0x68')][_0x9b7a('0x4a')]({'where':{'id':_0x19fbc9},'attributes':['id'],'include':[{'model':db['User'],'as':'Agents','attributes':['id',_0x9b7a('0x2f'),'online',_0x9b7a('0x6b'),'interface'],'raw':!![]}]})[_0x9b7a('0x2a')](function(_0x509b9a){if(_0x509b9a){var _0x750540=_[_0x9b7a('0x6c')](_0x509b9a,function(_0x13ba83){var _0x572c75=_0x13ba83['get']({'plain':!![]});return _0x572c75['Agents'];});return db['MailQueue']['find']({'where':{'id':_0x25f2a4[_0x9b7a('0x4d')]['id']}})['then'](function(_0x5775d1){return db[_0x9b7a('0x6d')][_0x9b7a('0x6e')](function(_0x372552){return _0x5775d1['addTeams'](_0x19fbc9,{'transaction':_0x372552})[_0x9b7a('0x2a')](function(){return BPromise[_0x9b7a('0x6f')](_0x750540,function(_0x500929){return db[_0x9b7a('0x5e')]['findOrCreate']({'where':{'UserId':_0x500929['id'],'MailQueueId':_0x25f2a4['params']['id']},'transaction':_0x372552});});})['then'](function(){_0x750540[_0x9b7a('0x70')](function(_0x274d53){socket['emit'](_0x9b7a('0x71'),{'UserId':_0x274d53['id'],'MailQueueId':_0x5775d1['id']});});});});});}})[_0x9b7a('0x2a')](respondWithStatusCode(_0x699f9d,null))[_0x9b7a('0x4b')](handleError(_0x699f9d,null));};exports[_0x9b7a('0x72')]=function(_0x2ac0ae,_0x1be72d,_0x24cc58){return db['Team']['findAll']({'where':{'id':_0x2ac0ae[_0x9b7a('0x36')][_0x9b7a('0x6a')]},'attributes':['id'],'include':[{'model':db[_0x9b7a('0x60')],'as':_0x9b7a('0x73'),'attributes':['id'],'raw':!![]}]})[_0x9b7a('0x2a')](handleEntityNotFound(_0x1be72d,null))[_0x9b7a('0x2a')](function(_0x462a61){var _0x570627=_[_0x9b7a('0x31')](_0x462a61,'id');var _0x21473f=[];var _0x2217ce=[];var _0xfc1cb4=squel[_0x9b7a('0x74')]();_0xfc1cb4[_0x9b7a('0x75')](_0x9b7a('0x76'))[_0x9b7a('0x77')]('team_has_mail_queues','tq')[_0x9b7a('0x78')](_0x9b7a('0x79'),'ut',_0x9b7a('0x7a'))[_0x9b7a('0x41')]('MailQueueId\x20=\x20?',_0x2ac0ae[_0x9b7a('0x4d')]['id']);for(var _0x5a6f51=0x0;_0x5a6f51<_0x462a61['length'];_0x5a6f51+=0x1){let _0x56e892=_0x462a61[_0x5a6f51];for(var _0x57229e=0x0;_0x57229e<_0x56e892['Agents']['length'];_0x57229e+=0x1){let _0x121d75=_0x56e892[_0x9b7a('0x73')][_0x57229e];var _0x3b7d29=_0xfc1cb4[_0x9b7a('0x7b')]();_0x3b7d29['where'](_0x9b7a('0x7c'),_0x121d75['id']);_0x2217ce[_0x9b7a('0x7d')](db[_0x9b7a('0x6d')]['query'](_0x3b7d29[_0x9b7a('0x7e')](),{'type':db[_0x9b7a('0x6d')][_0x9b7a('0x7f')][_0x9b7a('0x80')]})[_0x9b7a('0x2a')](function(_0x357046){if(_0x357046['length']===0x1){return _0x121d75['id'];}else{var _0x113165=_['every'](_[_0x9b7a('0x31')](_0x357046,_0x9b7a('0x81')),function(_0x3a19cf){return _[_0x9b7a('0x82')](_0x570627,_0x3a19cf);});if(_0x113165){return _0x121d75['id'];}}}));}}return BPromise[_0x9b7a('0x83')](_0x2217ce)[_0x9b7a('0x2a')](function(_0x36053f){_0x21473f=_(_0x21473f)['union'](_0x36053f)[_0x9b7a('0x84')]()[_0x9b7a('0x85')]();return db[_0x9b7a('0x32')][_0x9b7a('0x50')]({'where':{'id':_0x2ac0ae[_0x9b7a('0x4d')]['id']}})[_0x9b7a('0x2a')](function(_0xfd03dc){return db[_0x9b7a('0x6d')][_0x9b7a('0x6e')](function(_0x20e913){return _0xfd03dc['removeTeams'](_0x2ac0ae[_0x9b7a('0x36')][_0x9b7a('0x6a')],{'transaction':_0x20e913})[_0x9b7a('0x2a')](function(){if(!_[_0x9b7a('0x86')](_0x21473f)){return _0xfd03dc[_0x9b7a('0x87')](_0x21473f,{'transaction':_0x20e913});}})[_0x9b7a('0x2a')](function(){_0x21473f[_0x9b7a('0x70')](function(_0x8566ff){socket[_0x9b7a('0x88')](_0x9b7a('0x89'),{'UserId':_0x8566ff,'MailQueueId':_0xfd03dc['id']});});});});});});})[_0x9b7a('0x2a')](respondWithStatusCode(_0x1be72d,null))[_0x9b7a('0x4b')](handleError(_0x1be72d,null));};exports[_0x9b7a('0x8a')]=function(_0x3c6594,_0x35dc91,_0xdd6260){return db['MailQueue'][_0x9b7a('0x50')]({'where':{'id':_0x3c6594[_0x9b7a('0x4d')]['id']}})[_0x9b7a('0x2a')](handleEntityNotFound(_0x35dc91,null))[_0x9b7a('0x2a')](function(_0xb1a59c){if(_0xb1a59c){return _0xb1a59c[_0x9b7a('0x8a')](_0x3c6594['body'][_0x9b7a('0x6a')],_['omit'](_0x3c6594[_0x9b7a('0x5b')],[_0x9b7a('0x6a'),'id'])||{})['spread'](function(_0x5070ce){for(var _0x5719ce=0x0;_0x5719ce<_0x3c6594[_0x9b7a('0x5b')][_0x9b7a('0x6a')][_0x9b7a('0x3c')];_0x5719ce+=0x1){socket['emit'](_0x9b7a('0x71'),{'UserId':Number(_0x3c6594['body'][_0x9b7a('0x6a')][_0x5719ce]),'MailQueueId':Number(_0x3c6594[_0x9b7a('0x4d')]['id'])});}return _0x5070ce;});}})[_0x9b7a('0x2a')](respondWithResult(_0x35dc91,null))[_0x9b7a('0x4b')](handleError(_0x35dc91,null));};exports[_0x9b7a('0x87')]=function(_0x4d01cb,_0x293343,_0x55cd3e){return db[_0x9b7a('0x32')][_0x9b7a('0x50')]({'where':{'id':_0x4d01cb[_0x9b7a('0x4d')]['id']}})['then'](handleEntityNotFound(_0x293343,null))[_0x9b7a('0x2a')](function(_0x3760c5){if(_0x3760c5){return _0x3760c5[_0x9b7a('0x87')](_0x4d01cb[_0x9b7a('0x36')][_0x9b7a('0x6a')])[_0x9b7a('0x2a')](function(){if(_[_0x9b7a('0x8b')](_0x4d01cb[_0x9b7a('0x36')][_0x9b7a('0x6a')])){for(var _0x5209c1=0x0;_0x5209c1<_0x4d01cb[_0x9b7a('0x36')]['ids'][_0x9b7a('0x3c')];_0x5209c1+=0x1){socket['emit'](_0x9b7a('0x89'),{'UserId':Number(_0x4d01cb[_0x9b7a('0x36')]['ids'][_0x5209c1]),'MailQueueId':Number(_0x4d01cb[_0x9b7a('0x4d')]['id'])});}}else{socket[_0x9b7a('0x88')](_0x9b7a('0x89'),{'UserId':Number(_0x4d01cb['query']['ids']),'MailQueueId':Number(_0x4d01cb[_0x9b7a('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x293343,null))[_0x9b7a('0x4b')](handleError(_0x293343,null));};exports[_0x9b7a('0x8c')]=function(_0x2e7554,_0x346c3c,_0x28ff9a){var _0x5c6df0={};var _0x19296e={};var _0x22d3e0;var _0x1184f8;return db[_0x9b7a('0x32')][_0x9b7a('0x5d')]({'where':{'id':_0x2e7554[_0x9b7a('0x4d')]['id']}})[_0x9b7a('0x2a')](handleEntityNotFound(_0x346c3c,null))[_0x9b7a('0x2a')](function(_0x5a7c14){if(_0x5a7c14){_0x22d3e0=_0x5a7c14;_0x19296e[_0x9b7a('0x39')]=_[_0x9b7a('0x4e')](db[_0x9b7a('0x60')][_0x9b7a('0x33')]);_0x19296e['query']=_[_0x9b7a('0x4e')](_0x2e7554['query']);_0x19296e['filters']=_[_0x9b7a('0x38')](_0x19296e['model'],_0x19296e[_0x9b7a('0x36')]);_0x5c6df0[_0x9b7a('0x3a')]=_[_0x9b7a('0x38')](_0x19296e['model'],qs[_0x9b7a('0x3b')](_0x2e7554[_0x9b7a('0x36')][_0x9b7a('0x3b')]));_0x5c6df0[_0x9b7a('0x3a')]=_0x5c6df0[_0x9b7a('0x3a')]['length']?_0x5c6df0[_0x9b7a('0x3a')]:_0x19296e['model'];_0x5c6df0[_0x9b7a('0x3f')]=qs[_0x9b7a('0x40')](_0x2e7554[_0x9b7a('0x36')][_0x9b7a('0x40')]);_0x5c6df0[_0x9b7a('0x41')]=qs[_0x9b7a('0x37')](_[_0x9b7a('0x42')](_0x2e7554[_0x9b7a('0x36')],_0x19296e[_0x9b7a('0x37')]));if(_0x2e7554[_0x9b7a('0x36')]['filter']){_0x5c6df0[_0x9b7a('0x41')]=_[_0x9b7a('0x44')](_0x5c6df0[_0x9b7a('0x41')],{'$or':_[_0x9b7a('0x31')](_0x5c6df0[_0x9b7a('0x3a')],function(_0x22da36){var _0x1185eb={};_0x1185eb[_0x22da36]={'$like':'%'+_0x2e7554[_0x9b7a('0x36')][_0x9b7a('0x43')]+'%'};return _0x1185eb;})});}_0x5c6df0=_[_0x9b7a('0x44')]({},_0x5c6df0,_0x2e7554['options']);return _0x22d3e0[_0x9b7a('0x8c')](_0x5c6df0);}})[_0x9b7a('0x2a')](function(_0x2f22e2){if(_0x2f22e2){_0x1184f8=_0x2f22e2['length'];if(!_0x2e7554['query'][_0x9b7a('0x3d')]('nolimit')){_0x5c6df0[_0x9b7a('0x24')]=qs[_0x9b7a('0x24')](_0x2e7554[_0x9b7a('0x36')][_0x9b7a('0x24')]);_0x5c6df0['offset']=qs[_0x9b7a('0x23')](_0x2e7554[_0x9b7a('0x36')]['offset']);}return _0x22d3e0[_0x9b7a('0x8c')](_0x5c6df0);}})[_0x9b7a('0x2a')](function(_0x2136ba){if(_0x2136ba){return _0x2136ba?{'count':_0x1184f8,'rows':_0x2136ba}:null;}})['then'](respondWithResult(_0x346c3c,null))[_0x9b7a('0x4b')](handleError(_0x346c3c,null));}; \ No newline at end of file +var _0xf3a6=['include','findAll','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','MailQueues','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','catch','find','describe','getMembers','findOne','UserMailQueue','MailQueueId','User','findAndCountAll','agent','mailPause','updatedAt','createdAt','rows','format','%s/%s','SIP','Team','getTeams','addTeams','ids','online','voicePause','interface','Agents','sequelize','transaction','each','findOrCreate','forEach','emit','select','field','tq.TeamId','from','team_has_mail_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','includes','all','union','compact','value','isEmpty','removeAgents','userMailQueue:remove','addAgents','userMailQueue:save','isArray','getAgents','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/license/util','redis','./mailQueue.socket','register','sendStatus','status','undefined','count','offset','limit','set','json','save','update','then','get','UserProfileResource','destroy','end','stack','name','send','index','map','MailQueue','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','filter','options'];(function(_0x22fe5c,_0x28645c){var _0x17a217=function(_0x1306f0){while(--_0x1306f0){_0x22fe5c['push'](_0x22fe5c['shift']());}};_0x17a217(++_0x28645c);}(_0xf3a6,0x1e9));var _0x6f3a=function(_0x221ba2,_0x79208){_0x221ba2=_0x221ba2-0x0;var _0x47d08e=_0xf3a6[_0x221ba2];return _0x47d08e;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x6f3a('0x0'));var moment=require(_0x6f3a('0x1'));var BPromise=require(_0x6f3a('0x2'));var Mustache=require(_0x6f3a('0x3'));var util=require(_0x6f3a('0x4'));var path=require(_0x6f3a('0x5'));var sox=require(_0x6f3a('0x6'));var csv=require(_0x6f3a('0x7'));var ejs=require(_0x6f3a('0x8'));var fs=require('fs');var fs_extra=require(_0x6f3a('0x9'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x6f3a('0xa'));var deskjs=require(_0x6f3a('0xb'));var toCsv=require('to-csv');var querystring=require(_0x6f3a('0xc'));var Papa=require(_0x6f3a('0xd'));var Redis=require(_0x6f3a('0xe'));var authService=require(_0x6f3a('0xf'));var qs=require(_0x6f3a('0x10'));var as=require(_0x6f3a('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x6f3a('0x12'))(_0x6f3a('0x13'));var utils=require(_0x6f3a('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6f3a('0x15'));var db=require('../../mysqldb')['db'];config[_0x6f3a('0x16')]=_['defaults'](config[_0x6f3a('0x16')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6f3a('0x16')]));require(_0x6f3a('0x17'))[_0x6f3a('0x18')](socket);function respondWithStatusCode(_0x1d8724,_0x434907){_0x434907=_0x434907||0xcc;return function(_0x298b58){if(_0x298b58){return _0x1d8724[_0x6f3a('0x19')](_0x434907);}return _0x1d8724['status'](_0x434907)['end']();};}function respondWithResult(_0x3cb992,_0x5ba748){_0x5ba748=_0x5ba748||0xc8;return function(_0x5d8850){if(_0x5d8850){return _0x3cb992[_0x6f3a('0x1a')](_0x5ba748)['json'](_0x5d8850);}};}function respondWithFilteredResult(_0x1b6a3a,_0x395312){return function(_0x121496){if(_0x121496){var _0x2f5a35=typeof _0x395312['offset']===_0x6f3a('0x1b')&&typeof _0x395312['limit']===_0x6f3a('0x1b');var _0x15ac47=_0x121496[_0x6f3a('0x1c')];var _0x1d73a7=_0x2f5a35?0x0:_0x395312[_0x6f3a('0x1d')];var _0x535b39=_0x2f5a35?_0x121496[_0x6f3a('0x1c')]:_0x395312[_0x6f3a('0x1d')]+_0x395312[_0x6f3a('0x1e')];var _0x4f7880;if(_0x535b39>=_0x15ac47){_0x535b39=_0x15ac47;_0x4f7880=0xc8;}else{_0x4f7880=0xce;}_0x1b6a3a[_0x6f3a('0x1a')](_0x4f7880);return _0x1b6a3a[_0x6f3a('0x1f')]('Content-Range',_0x1d73a7+'-'+_0x535b39+'/'+_0x15ac47)[_0x6f3a('0x20')](_0x121496);}return null;};}function patchUpdates(_0x4fd599){return function(_0x82666b){try{jsonpatch['apply'](_0x82666b,_0x4fd599,!![]);}catch(_0x9487e0){return BPromise['reject'](_0x9487e0);}return _0x82666b[_0x6f3a('0x21')]();};}function saveUpdates(_0x5bbb4a,_0x5c9d35){return function(_0xb95a72){if(_0xb95a72){return _0xb95a72[_0x6f3a('0x22')](_0x5bbb4a)['then'](function(_0x2019a6){return _0x2019a6;});}return null;};}function removeEntity(_0x225711,_0x1aec34){return function(_0x33390f){if(_0x33390f){return _0x33390f['destroy']()[_0x6f3a('0x23')](function(){var _0x13f706=_0x33390f[_0x6f3a('0x24')]({'plain':!![]});var _0x29b123='MailQueues';return db[_0x6f3a('0x25')][_0x6f3a('0x26')]({'where':{'type':_0x29b123,'resourceId':_0x13f706['id']}})[_0x6f3a('0x23')](function(){return _0x33390f;});})[_0x6f3a('0x23')](function(){_0x225711[_0x6f3a('0x1a')](0xcc)[_0x6f3a('0x27')]();});}};}function handleEntityNotFound(_0x2dfccb,_0x5240d4){return function(_0x45bd46){if(!_0x45bd46){_0x2dfccb[_0x6f3a('0x19')](0x194);}return _0x45bd46;};}function handleError(_0x2cd6b6,_0x2d9498){_0x2d9498=_0x2d9498||0x1f4;return function(_0x3c4e72){logger['error'](_0x3c4e72[_0x6f3a('0x28')]);if(_0x3c4e72['name']){delete _0x3c4e72[_0x6f3a('0x29')];}_0x2cd6b6[_0x6f3a('0x1a')](_0x2d9498)[_0x6f3a('0x2a')](_0x3c4e72);};}exports[_0x6f3a('0x2b')]=function(_0x51f493,_0x31440d){var _0x27bdfa={},_0x2c304e={},_0x3b5d9c={'count':0x0,'rows':[]};var _0xb70111=_[_0x6f3a('0x2c')](db[_0x6f3a('0x2d')][_0x6f3a('0x2e')],function(_0x21cfc2){return{'name':_0x21cfc2[_0x6f3a('0x2f')],'type':_0x21cfc2[_0x6f3a('0x30')][_0x6f3a('0x31')]};});_0x2c304e['model']=_[_0x6f3a('0x2c')](_0xb70111,_0x6f3a('0x29'));_0x2c304e[_0x6f3a('0x32')]=_[_0x6f3a('0x33')](_0x51f493[_0x6f3a('0x32')]);_0x2c304e['filters']=_[_0x6f3a('0x34')](_0x2c304e[_0x6f3a('0x35')],_0x2c304e[_0x6f3a('0x32')]);_0x27bdfa['attributes']=_[_0x6f3a('0x34')](_0x2c304e[_0x6f3a('0x35')],qs[_0x6f3a('0x36')](_0x51f493[_0x6f3a('0x32')]['fields']));_0x27bdfa[_0x6f3a('0x37')]=_0x27bdfa[_0x6f3a('0x37')][_0x6f3a('0x38')]?_0x27bdfa[_0x6f3a('0x37')]:_0x2c304e[_0x6f3a('0x35')];if(!_0x51f493['query'][_0x6f3a('0x39')](_0x6f3a('0x3a'))){_0x27bdfa['limit']=qs[_0x6f3a('0x1e')](_0x51f493[_0x6f3a('0x32')][_0x6f3a('0x1e')]);_0x27bdfa[_0x6f3a('0x1d')]=qs['offset'](_0x51f493[_0x6f3a('0x32')][_0x6f3a('0x1d')]);}_0x27bdfa[_0x6f3a('0x3b')]=qs[_0x6f3a('0x3c')](_0x51f493['query'][_0x6f3a('0x3c')]);_0x27bdfa[_0x6f3a('0x3d')]=qs[_0x6f3a('0x3e')](_[_0x6f3a('0x3f')](_0x51f493['query'],_0x2c304e[_0x6f3a('0x3e')]),_0xb70111);if(_0x51f493[_0x6f3a('0x32')]['filter']){_0x27bdfa['where']=_[_0x6f3a('0x40')](_0x27bdfa['where'],{'$or':_['map'](_0xb70111,function(_0xbaaacb){if(_0xbaaacb[_0x6f3a('0x30')]!=='VIRTUAL'){var _0x14b03b={};_0x14b03b[_0xbaaacb['name']]={'$like':'%'+_0x51f493[_0x6f3a('0x32')][_0x6f3a('0x41')]+'%'};return _0x14b03b;}})});}_0x27bdfa=_['merge']({},_0x27bdfa,_0x51f493[_0x6f3a('0x42')]);var _0x323356={'where':_0x27bdfa[_0x6f3a('0x3d')]};return db[_0x6f3a('0x2d')][_0x6f3a('0x1c')](_0x323356)['then'](function(_0x704de9){_0x3b5d9c[_0x6f3a('0x1c')]=_0x704de9;if(_0x51f493[_0x6f3a('0x32')]['includeAll']){_0x27bdfa[_0x6f3a('0x43')]=[{'all':!![]}];}return db['MailQueue'][_0x6f3a('0x44')](_0x27bdfa);})[_0x6f3a('0x23')](function(_0x43245c){_0x3b5d9c['rows']=_0x43245c;return _0x3b5d9c;})[_0x6f3a('0x23')](respondWithFilteredResult(_0x31440d,_0x27bdfa))['catch'](handleError(_0x31440d,null));};exports[_0x6f3a('0x45')]=function(_0x15671f,_0x162aa4){var _0x5c538a={'raw':!![],'where':{'id':_0x15671f[_0x6f3a('0x46')]['id']}},_0x185914={};_0x185914['model']=_['keys'](db[_0x6f3a('0x2d')]['rawAttributes']);_0x185914[_0x6f3a('0x32')]=_['keys'](_0x15671f['query']);_0x185914['filters']=_[_0x6f3a('0x34')](_0x185914['model'],_0x185914[_0x6f3a('0x32')]);_0x5c538a['attributes']=_[_0x6f3a('0x34')](_0x185914[_0x6f3a('0x35')],qs['fields'](_0x15671f[_0x6f3a('0x32')][_0x6f3a('0x36')]));_0x5c538a[_0x6f3a('0x37')]=_0x5c538a['attributes'][_0x6f3a('0x38')]?_0x5c538a['attributes']:_0x185914[_0x6f3a('0x35')];if(_0x15671f[_0x6f3a('0x32')][_0x6f3a('0x47')]){_0x5c538a[_0x6f3a('0x43')]=[{'all':!![]}];}_0x5c538a=_[_0x6f3a('0x40')]({},_0x5c538a,_0x15671f[_0x6f3a('0x42')]);return db[_0x6f3a('0x2d')]['find'](_0x5c538a)['then'](handleEntityNotFound(_0x162aa4,null))[_0x6f3a('0x23')](respondWithResult(_0x162aa4,null))['catch'](handleError(_0x162aa4,null));};exports[_0x6f3a('0x48')]=function(_0x384a9e,_0x3c5785){return db[_0x6f3a('0x2d')]['create'](_0x384a9e[_0x6f3a('0x49')],{})['then'](function(_0x32c2ab){var _0x1614a8=_0x384a9e[_0x6f3a('0x4a')][_0x6f3a('0x24')]({'plain':!![]});if(!_0x1614a8)throw new Error(_0x6f3a('0x4b'));if(_0x1614a8[_0x6f3a('0x4c')]==='user'){var _0x298a57=_0x32c2ab[_0x6f3a('0x24')]({'plain':!![]});var _0x18dbc8=_0x6f3a('0x4d');return db[_0x6f3a('0x4e')]['find']({'where':{'name':_0x18dbc8,'userProfileId':_0x1614a8['userProfileId']},'raw':!![]})[_0x6f3a('0x23')](function(_0x3a4b1e){if(_0x3a4b1e&&_0x3a4b1e[_0x6f3a('0x4f')]===0x0){return db[_0x6f3a('0x25')]['create']({'name':_0x298a57[_0x6f3a('0x29')],'resourceId':_0x298a57['id'],'type':_0x3a4b1e[_0x6f3a('0x29')],'sectionId':_0x3a4b1e['id']},{})['then'](function(){return _0x32c2ab;});}else{return _0x32c2ab;}})['catch'](function(_0x3da78f){logger['error'](_0x6f3a('0x50'),_0x3da78f);throw _0x3da78f;});}return _0x32c2ab;})['then'](respondWithResult(_0x3c5785,0xc9))[_0x6f3a('0x51')](handleError(_0x3c5785,null));};exports['update']=function(_0xe87a76,_0x1bfe19){if(_0xe87a76['body']['id']){delete _0xe87a76['body']['id'];}return db[_0x6f3a('0x2d')]['find']({'where':{'id':_0xe87a76[_0x6f3a('0x46')]['id']}})[_0x6f3a('0x23')](handleEntityNotFound(_0x1bfe19,null))[_0x6f3a('0x23')](saveUpdates(_0xe87a76[_0x6f3a('0x49')],null))[_0x6f3a('0x23')](respondWithResult(_0x1bfe19,null))['catch'](handleError(_0x1bfe19,null));};exports['destroy']=function(_0x484ff0,_0x45d8cd){return db['MailQueue'][_0x6f3a('0x52')]({'where':{'id':_0x484ff0[_0x6f3a('0x46')]['id']}})['then'](handleEntityNotFound(_0x45d8cd,null))[_0x6f3a('0x23')](removeEntity(_0x45d8cd,null))[_0x6f3a('0x51')](handleError(_0x45d8cd,null));};exports[_0x6f3a('0x53')]=function(_0x3afa54,_0x286e0c){return db[_0x6f3a('0x2d')][_0x6f3a('0x53')]()[_0x6f3a('0x23')](respondWithResult(_0x286e0c,null))[_0x6f3a('0x51')](handleError(_0x286e0c,null));};exports[_0x6f3a('0x54')]=function(_0xdecab2,_0x5b34a9,_0x231470){var _0x214381={'raw':!![],'where':{}},_0x23558c={},_0x40357d;return db[_0x6f3a('0x2d')][_0x6f3a('0x55')]({'where':{'id':_0xdecab2[_0x6f3a('0x46')]['id']}})[_0x6f3a('0x23')](handleEntityNotFound(_0x5b34a9,null))[_0x6f3a('0x23')](function(_0x265f7e){if(_0x265f7e){_0x40357d=_0x265f7e['get']({'plain':!![]});_0x23558c[_0x6f3a('0x35')]=_['keys'](db[_0x6f3a('0x56')]['rawAttributes']);_0x23558c[_0x6f3a('0x32')]=_['keys'](_0xdecab2[_0x6f3a('0x32')]);_0x23558c[_0x6f3a('0x3e')]=_['intersection'](_0x23558c[_0x6f3a('0x35')],_0x23558c[_0x6f3a('0x32')]);_0x214381[_0x6f3a('0x37')]=_['intersection'](_0x23558c[_0x6f3a('0x35')],qs[_0x6f3a('0x36')](_0xdecab2[_0x6f3a('0x32')]['fields']));_0x214381[_0x6f3a('0x37')]=_0x214381[_0x6f3a('0x37')]['length']?_0x214381[_0x6f3a('0x37')]:_0x23558c[_0x6f3a('0x35')];if(!_0xdecab2['query'][_0x6f3a('0x39')](_0x6f3a('0x3a'))){_0x214381[_0x6f3a('0x1e')]=qs[_0x6f3a('0x1e')](_0xdecab2[_0x6f3a('0x32')][_0x6f3a('0x1e')]);_0x214381[_0x6f3a('0x1d')]=qs[_0x6f3a('0x1d')](_0xdecab2[_0x6f3a('0x32')][_0x6f3a('0x1d')]);}_0x214381[_0x6f3a('0x3b')]=qs[_0x6f3a('0x3c')](_0xdecab2['query'][_0x6f3a('0x3c')]);_0x214381['where']=qs[_0x6f3a('0x3e')](_[_0x6f3a('0x3f')](_0xdecab2[_0x6f3a('0x32')],_0x23558c[_0x6f3a('0x3e')]));_0x214381['where'][_0x6f3a('0x57')]=_0x265f7e['id'];if(_0xdecab2[_0x6f3a('0x32')][_0x6f3a('0x41')]){_0x214381[_0x6f3a('0x3d')]=_['merge'](_0x214381[_0x6f3a('0x3d')],{'$or':_[_0x6f3a('0x2c')](_0x214381['attributes'],function(_0xab044a){var _0x420717={};_0x420717[_0xab044a]={'$like':'%'+_0xdecab2[_0x6f3a('0x32')][_0x6f3a('0x41')]+'%'};return _0x420717;})});}_0x214381=_['merge']({},_0x214381,_0xdecab2['options']);return db['UserMailQueue'][_0x6f3a('0x44')](_0x214381);}})[_0x6f3a('0x23')](function(_0x5c2019){if(_0x5c2019){return db[_0x6f3a('0x58')][_0x6f3a('0x59')]({'where':{'id':_['map'](_0x5c2019,'UserId'),'role':_0x6f3a('0x5a')},'attributes':['id',_0x6f3a('0x29'),_0x6f3a('0x5b'),_0x6f3a('0x5c'),_0x6f3a('0x5d')]});}})[_0x6f3a('0x23')](function(_0x2051ef){if(_0x2051ef){return{'count':_0x2051ef[_0x6f3a('0x1c')],'rows':_[_0x6f3a('0x2c')](_0x2051ef[_0x6f3a('0x5e')],function(_0x36c38d){return{'membername':_0x36c38d[_0x6f3a('0x29')],'UserId':_0x36c38d['id'],'queue_name':_0x40357d[_0x6f3a('0x29')],'MailQueueId':_0x40357d['id'],'interface':util[_0x6f3a('0x5f')](_0x6f3a('0x60'),_0x6f3a('0x61'),_0x36c38d['name']),'penalty':0x0,'paused':_0x36c38d['mailPause'],'createdAt':_0x36c38d[_0x6f3a('0x5d')],'updatedAt':_0x36c38d['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0x6f3a('0x23')](respondWithFilteredResult(_0x5b34a9,_0x214381))[_0x6f3a('0x51')](handleError(_0x5b34a9,null));};exports['getTeams']=function(_0x2b79b1,_0x3a819b,_0x465765){var _0x2cd126={};var _0x531072={};var _0xb9c2e8;var _0x57393b;return db[_0x6f3a('0x2d')][_0x6f3a('0x55')]({'where':{'id':_0x2b79b1[_0x6f3a('0x46')]['id']}})[_0x6f3a('0x23')](handleEntityNotFound(_0x3a819b,null))[_0x6f3a('0x23')](function(_0x177d74){if(_0x177d74){_0xb9c2e8=_0x177d74;_0x531072[_0x6f3a('0x35')]=_[_0x6f3a('0x33')](db[_0x6f3a('0x62')]['rawAttributes']);_0x531072['query']=_[_0x6f3a('0x33')](_0x2b79b1['query']);_0x531072[_0x6f3a('0x3e')]=_[_0x6f3a('0x34')](_0x531072[_0x6f3a('0x35')],_0x531072[_0x6f3a('0x32')]);_0x2cd126['attributes']=_[_0x6f3a('0x34')](_0x531072[_0x6f3a('0x35')],qs['fields'](_0x2b79b1[_0x6f3a('0x32')]['fields']));_0x2cd126[_0x6f3a('0x37')]=_0x2cd126[_0x6f3a('0x37')]['length']?_0x2cd126[_0x6f3a('0x37')]:_0x531072[_0x6f3a('0x35')];_0x2cd126[_0x6f3a('0x3b')]=qs[_0x6f3a('0x3c')](_0x2b79b1[_0x6f3a('0x32')]['sort']);_0x2cd126['where']=qs['filters'](_['pick'](_0x2b79b1['query'],_0x531072[_0x6f3a('0x3e')]));if(_0x2b79b1[_0x6f3a('0x32')]['filter']){_0x2cd126['where']=_[_0x6f3a('0x40')](_0x2cd126[_0x6f3a('0x3d')],{'$or':_[_0x6f3a('0x2c')](_0x2cd126['attributes'],function(_0x17e327){var _0x576780={};_0x576780[_0x17e327]={'$like':'%'+_0x2b79b1[_0x6f3a('0x32')]['filter']+'%'};return _0x576780;})});}_0x2cd126=_[_0x6f3a('0x40')]({},_0x2cd126,_0x2b79b1[_0x6f3a('0x42')]);return _0xb9c2e8['getTeams'](_0x2cd126);}})[_0x6f3a('0x23')](function(_0x2950f8){if(_0x2950f8){_0x57393b=_0x2950f8[_0x6f3a('0x38')];if(!_0x2b79b1[_0x6f3a('0x32')][_0x6f3a('0x39')](_0x6f3a('0x3a'))){_0x2cd126[_0x6f3a('0x1e')]=qs[_0x6f3a('0x1e')](_0x2b79b1['query'][_0x6f3a('0x1e')]);_0x2cd126['offset']=qs[_0x6f3a('0x1d')](_0x2b79b1[_0x6f3a('0x32')][_0x6f3a('0x1d')]);}return _0xb9c2e8[_0x6f3a('0x63')](_0x2cd126);}})[_0x6f3a('0x23')](function(_0x50e8b5){if(_0x50e8b5){return _0x50e8b5?{'count':_0x57393b,'rows':_0x50e8b5}:null;}})[_0x6f3a('0x23')](respondWithResult(_0x3a819b,null))[_0x6f3a('0x51')](handleError(_0x3a819b,null));};exports[_0x6f3a('0x64')]=function(_0x5e105d,_0x493b09,_0x51e130){var _0x3bdfcc=_0x5e105d[_0x6f3a('0x49')][_0x6f3a('0x65')];return db[_0x6f3a('0x62')]['findAll']({'where':{'id':_0x3bdfcc},'attributes':['id'],'include':[{'model':db[_0x6f3a('0x58')],'as':'Agents','attributes':['id',_0x6f3a('0x29'),_0x6f3a('0x66'),_0x6f3a('0x67'),_0x6f3a('0x68')],'raw':!![]}]})[_0x6f3a('0x23')](function(_0x4d8871){if(_0x4d8871){var _0x1b3cb3=_['flatMap'](_0x4d8871,function(_0x9c776){var _0x22e4d6=_0x9c776['get']({'plain':!![]});return _0x22e4d6[_0x6f3a('0x69')];});return db[_0x6f3a('0x2d')][_0x6f3a('0x52')]({'where':{'id':_0x5e105d[_0x6f3a('0x46')]['id']}})[_0x6f3a('0x23')](function(_0x450e7d){return db[_0x6f3a('0x6a')][_0x6f3a('0x6b')](function(_0x721c4d){return _0x450e7d[_0x6f3a('0x64')](_0x3bdfcc,{'transaction':_0x721c4d})[_0x6f3a('0x23')](function(){return BPromise[_0x6f3a('0x6c')](_0x1b3cb3,function(_0x55a4e8){return db[_0x6f3a('0x56')][_0x6f3a('0x6d')]({'where':{'UserId':_0x55a4e8['id'],'MailQueueId':_0x5e105d[_0x6f3a('0x46')]['id']},'transaction':_0x721c4d});});})[_0x6f3a('0x23')](function(){_0x1b3cb3[_0x6f3a('0x6e')](function(_0x54e4d1){socket[_0x6f3a('0x6f')]('userMailQueue:save',{'UserId':_0x54e4d1['id'],'MailQueueId':_0x450e7d['id']});});});});});}})['then'](respondWithStatusCode(_0x493b09,null))[_0x6f3a('0x51')](handleError(_0x493b09,null));};exports['removeTeams']=function(_0xea782f,_0x42c5e0,_0x2f2bd0){return db[_0x6f3a('0x62')][_0x6f3a('0x44')]({'where':{'id':_0xea782f[_0x6f3a('0x32')][_0x6f3a('0x65')]},'attributes':['id'],'include':[{'model':db[_0x6f3a('0x58')],'as':_0x6f3a('0x69'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x42c5e0,null))[_0x6f3a('0x23')](function(_0x50fa79){var _0x566624=_[_0x6f3a('0x2c')](_0x50fa79,'id');var _0x3720c0=[];var _0x3490aa=[];var _0xa3579a=squel[_0x6f3a('0x70')]();_0xa3579a[_0x6f3a('0x71')](_0x6f3a('0x72'))[_0x6f3a('0x73')](_0x6f3a('0x74'),'tq')[_0x6f3a('0x75')](_0x6f3a('0x76'),'ut',_0x6f3a('0x77'))[_0x6f3a('0x3d')]('MailQueueId\x20=\x20?',_0xea782f[_0x6f3a('0x46')]['id']);for(var _0xc638fd=0x0;_0xc638fd<_0x50fa79['length'];_0xc638fd+=0x1){let _0xb532ff=_0x50fa79[_0xc638fd];for(var _0x43e93a=0x0;_0x43e93a<_0xb532ff['Agents'][_0x6f3a('0x38')];_0x43e93a+=0x1){let _0x5d22a3=_0xb532ff[_0x6f3a('0x69')][_0x43e93a];var _0x1dad3e=_0xa3579a[_0x6f3a('0x78')]();_0x1dad3e[_0x6f3a('0x3d')](_0x6f3a('0x79'),_0x5d22a3['id']);_0x3490aa[_0x6f3a('0x7a')](db[_0x6f3a('0x6a')]['query'](_0x1dad3e[_0x6f3a('0x7b')](),{'type':db['sequelize'][_0x6f3a('0x7c')][_0x6f3a('0x7d')]})[_0x6f3a('0x23')](function(_0x39646e){if(_0x39646e[_0x6f3a('0x38')]===0x1){return _0x5d22a3['id'];}else{var _0x2c011f=_[_0x6f3a('0x7e')](_[_0x6f3a('0x2c')](_0x39646e,'TeamId'),function(_0x5cbf2b){return _[_0x6f3a('0x7f')](_0x566624,_0x5cbf2b);});if(_0x2c011f){return _0x5d22a3['id'];}}}));}}return BPromise[_0x6f3a('0x80')](_0x3490aa)[_0x6f3a('0x23')](function(_0x45c358){_0x3720c0=_(_0x3720c0)[_0x6f3a('0x81')](_0x45c358)[_0x6f3a('0x82')]()[_0x6f3a('0x83')]();return db['MailQueue'][_0x6f3a('0x52')]({'where':{'id':_0xea782f[_0x6f3a('0x46')]['id']}})['then'](function(_0x5a252c){return db['sequelize'][_0x6f3a('0x6b')](function(_0x2eb691){return _0x5a252c['removeTeams'](_0xea782f['query'][_0x6f3a('0x65')],{'transaction':_0x2eb691})['then'](function(){if(!_[_0x6f3a('0x84')](_0x3720c0)){return _0x5a252c[_0x6f3a('0x85')](_0x3720c0,{'transaction':_0x2eb691});}})[_0x6f3a('0x23')](function(){_0x3720c0[_0x6f3a('0x6e')](function(_0x14f8af){socket[_0x6f3a('0x6f')](_0x6f3a('0x86'),{'UserId':_0x14f8af,'MailQueueId':_0x5a252c['id']});});});});});});})[_0x6f3a('0x23')](respondWithStatusCode(_0x42c5e0,null))[_0x6f3a('0x51')](handleError(_0x42c5e0,null));};exports['addAgents']=function(_0xab4ee9,_0x1db2fc,_0x4e0063){return db[_0x6f3a('0x2d')]['find']({'where':{'id':_0xab4ee9[_0x6f3a('0x46')]['id']}})['then'](handleEntityNotFound(_0x1db2fc,null))['then'](function(_0x867500){if(_0x867500){return _0x867500[_0x6f3a('0x87')](_0xab4ee9[_0x6f3a('0x49')]['ids'],_['omit'](_0xab4ee9[_0x6f3a('0x49')],['ids','id'])||{})['spread'](function(_0x236de9){for(var _0x5668a4=0x0;_0x5668a4<_0xab4ee9['body'][_0x6f3a('0x65')][_0x6f3a('0x38')];_0x5668a4+=0x1){socket[_0x6f3a('0x6f')](_0x6f3a('0x88'),{'UserId':Number(_0xab4ee9[_0x6f3a('0x49')][_0x6f3a('0x65')][_0x5668a4]),'MailQueueId':Number(_0xab4ee9[_0x6f3a('0x46')]['id'])});}return _0x236de9;});}})['then'](respondWithResult(_0x1db2fc,null))[_0x6f3a('0x51')](handleError(_0x1db2fc,null));};exports[_0x6f3a('0x85')]=function(_0x560050,_0x4eb0b7,_0x1f3f8a){return db['MailQueue'][_0x6f3a('0x52')]({'where':{'id':_0x560050[_0x6f3a('0x46')]['id']}})[_0x6f3a('0x23')](handleEntityNotFound(_0x4eb0b7,null))[_0x6f3a('0x23')](function(_0x59d8d5){if(_0x59d8d5){return _0x59d8d5[_0x6f3a('0x85')](_0x560050[_0x6f3a('0x32')][_0x6f3a('0x65')])[_0x6f3a('0x23')](function(){if(_[_0x6f3a('0x89')](_0x560050['query'][_0x6f3a('0x65')])){for(var _0x1e9613=0x0;_0x1e9613<_0x560050[_0x6f3a('0x32')][_0x6f3a('0x65')][_0x6f3a('0x38')];_0x1e9613+=0x1){socket['emit']('userMailQueue:remove',{'UserId':Number(_0x560050[_0x6f3a('0x32')][_0x6f3a('0x65')][_0x1e9613]),'MailQueueId':Number(_0x560050[_0x6f3a('0x46')]['id'])});}}else{socket['emit']('userMailQueue:remove',{'UserId':Number(_0x560050[_0x6f3a('0x32')][_0x6f3a('0x65')]),'MailQueueId':Number(_0x560050[_0x6f3a('0x46')]['id'])});}});}})[_0x6f3a('0x23')](respondWithStatusCode(_0x4eb0b7,null))[_0x6f3a('0x51')](handleError(_0x4eb0b7,null));};exports[_0x6f3a('0x8a')]=function(_0x529e35,_0x32a90d,_0xfd8921){var _0x1c088e={};var _0x482bcd={};var _0x39716d;var _0x23ab18;return db[_0x6f3a('0x2d')][_0x6f3a('0x55')]({'where':{'id':_0x529e35[_0x6f3a('0x46')]['id']}})[_0x6f3a('0x23')](handleEntityNotFound(_0x32a90d,null))[_0x6f3a('0x23')](function(_0xfa11c9){if(_0xfa11c9){_0x39716d=_0xfa11c9;_0x482bcd[_0x6f3a('0x35')]=_[_0x6f3a('0x33')](db['User'][_0x6f3a('0x2e')]);_0x482bcd[_0x6f3a('0x32')]=_['keys'](_0x529e35[_0x6f3a('0x32')]);_0x482bcd[_0x6f3a('0x3e')]=_['intersection'](_0x482bcd[_0x6f3a('0x35')],_0x482bcd[_0x6f3a('0x32')]);_0x1c088e[_0x6f3a('0x37')]=_[_0x6f3a('0x34')](_0x482bcd[_0x6f3a('0x35')],qs['fields'](_0x529e35[_0x6f3a('0x32')]['fields']));_0x1c088e[_0x6f3a('0x37')]=_0x1c088e[_0x6f3a('0x37')]['length']?_0x1c088e[_0x6f3a('0x37')]:_0x482bcd[_0x6f3a('0x35')];_0x1c088e[_0x6f3a('0x3b')]=qs[_0x6f3a('0x3c')](_0x529e35['query'][_0x6f3a('0x3c')]);_0x1c088e['where']=qs['filters'](_[_0x6f3a('0x3f')](_0x529e35[_0x6f3a('0x32')],_0x482bcd[_0x6f3a('0x3e')]));if(_0x529e35[_0x6f3a('0x32')][_0x6f3a('0x41')]){_0x1c088e['where']=_[_0x6f3a('0x40')](_0x1c088e[_0x6f3a('0x3d')],{'$or':_[_0x6f3a('0x2c')](_0x1c088e[_0x6f3a('0x37')],function(_0x3052f2){var _0x7b15ee={};_0x7b15ee[_0x3052f2]={'$like':'%'+_0x529e35[_0x6f3a('0x32')][_0x6f3a('0x41')]+'%'};return _0x7b15ee;})});}_0x1c088e=_[_0x6f3a('0x40')]({},_0x1c088e,_0x529e35[_0x6f3a('0x42')]);return _0x39716d[_0x6f3a('0x8a')](_0x1c088e);}})[_0x6f3a('0x23')](function(_0x552a0f){if(_0x552a0f){_0x23ab18=_0x552a0f[_0x6f3a('0x38')];if(!_0x529e35[_0x6f3a('0x32')][_0x6f3a('0x39')](_0x6f3a('0x3a'))){_0x1c088e[_0x6f3a('0x1e')]=qs['limit'](_0x529e35[_0x6f3a('0x32')][_0x6f3a('0x1e')]);_0x1c088e['offset']=qs[_0x6f3a('0x1d')](_0x529e35['query'][_0x6f3a('0x1d')]);}return _0x39716d['getAgents'](_0x1c088e);}})[_0x6f3a('0x23')](function(_0x2a1f6c){if(_0x2a1f6c){return _0x2a1f6c?{'count':_0x23ab18,'rows':_0x2a1f6c}:null;}})[_0x6f3a('0x23')](respondWithResult(_0x32a90d,null))['catch'](handleError(_0x32a90d,null));}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.events.js b/server/api/mailQueue/mailQueue.events.js index 4c00fff..4c43b90 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 _0x2525=['MailQueue','save','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0x2525,0xd0));var _0x5252=function(_0x3c4737,_0x2329ec){_0x3c4737=_0x3c4737-0x0;var _0x2bb926=_0x2525[_0x3c4737];return _0x2bb926;};'use strict';var EventEmitter=require(_0x5252('0x0'));var MailQueue=require(_0x5252('0x1'))['db'][_0x5252('0x2')];var MailQueueEvents=new EventEmitter();MailQueueEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x5252('0x3'),'afterUpdate':_0x5252('0x4'),'afterDestroy':_0x5252('0x5')};function emitEvent(_0x3ca440){return function(_0x4f67e8,_0x55a2eb,_0x35ebfd){MailQueueEvents[_0x5252('0x6')](_0x3ca440+':'+_0x4f67e8['id'],_0x4f67e8);MailQueueEvents[_0x5252('0x6')](_0x3ca440,_0x4f67e8);_0x35ebfd(null);};}for(var e in events){if(events[_0x5252('0x7')](e)){var event=events[e];MailQueue[_0x5252('0x8')](e,emitEvent(event));}}module[_0x5252('0x9')]=MailQueueEvents; \ No newline at end of file +var _0x3e08=['exports','events','MailQueue','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x2a9013,_0x3b945b){var _0x12bac4=function(_0x2df428){while(--_0x2df428){_0x2a9013['push'](_0x2a9013['shift']());}};_0x12bac4(++_0x3b945b);}(_0x3e08,0xdd));var _0x83e0=function(_0x49ca18,_0x5e6d05){_0x49ca18=_0x49ca18-0x0;var _0x145d54=_0x3e08[_0x49ca18];return _0x145d54;};'use strict';var EventEmitter=require(_0x83e0('0x0'));var MailQueue=require('../../mysqldb')['db'][_0x83e0('0x1')];var MailQueueEvents=new EventEmitter();MailQueueEvents[_0x83e0('0x2')](0x0);var events={'afterCreate':_0x83e0('0x3'),'afterUpdate':_0x83e0('0x4'),'afterDestroy':_0x83e0('0x5')};function emitEvent(_0x4d3445){return function(_0x3a9ec0,_0x22f955,_0x18b28d){MailQueueEvents[_0x83e0('0x6')](_0x4d3445+':'+_0x3a9ec0['id'],_0x3a9ec0);MailQueueEvents[_0x83e0('0x6')](_0x4d3445,_0x3a9ec0);_0x18b28d(null);};}for(var e in events){if(events[_0x83e0('0x7')](e)){var event=events[e];MailQueue[_0x83e0('0x8')](e,emitEvent(event));}}module[_0x83e0('0x9')]=MailQueueEvents; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.model.js b/server/api/mailQueue/mailQueue.model.js index 8f3391c..fcb3014 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 _0xb55e=['../../config/logger','api','bluebird','path','rimraf','./mailQueue.attributes','define','mail_queues','util'];(function(_0x4f7405,_0x2ecb6c){var _0x36b429=function(_0x335716){while(--_0x335716){_0x4f7405['push'](_0x4f7405['shift']());}};_0x36b429(++_0x2ecb6c);}(_0xb55e,0x1e5));var _0xeb55=function(_0x4b628f,_0x543683){_0x4b628f=_0x4b628f-0x0;var _0x366060=_0xb55e[_0x4b628f];return _0x366060;};'use strict';var _=require('lodash');var util=require(_0xeb55('0x0'));var logger=require(_0xeb55('0x1'))(_0xeb55('0x2'));var moment=require('moment');var BPromise=require(_0xeb55('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xeb55('0x4'));var rimraf=require(_0xeb55('0x5'));var config=require('../../config/environment');var attributes=require(_0xeb55('0x6'));module['exports']=function(_0x2a1ac4,_0x4db42c){return _0x2a1ac4[_0xeb55('0x7')]('MailQueue',attributes,{'tableName':_0xeb55('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5530=['mail_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./mailQueue.attributes','exports','define','MailQueue'];(function(_0x3dc68d,_0x1c1951){var _0xdf7f94=function(_0x339428){while(--_0x339428){_0x3dc68d['push'](_0x3dc68d['shift']());}};_0xdf7f94(++_0x1c1951);}(_0x5530,0xfd));var _0x0553=function(_0x22a832,_0x30f146){_0x22a832=_0x22a832-0x0;var _0x4c7a10=_0x5530[_0x22a832];return _0x4c7a10;};'use strict';var _=require(_0x0553('0x0'));var util=require(_0x0553('0x1'));var logger=require(_0x0553('0x2'))(_0x0553('0x3'));var moment=require(_0x0553('0x4'));var BPromise=require(_0x0553('0x5'));var rp=require(_0x0553('0x6'));var fs=require('fs');var path=require(_0x0553('0x7'));var rimraf=require('rimraf');var config=require(_0x0553('0x8'));var attributes=require(_0x0553('0x9'));module[_0x0553('0xa')]=function(_0x3425be,_0x34b67b){return _0x3425be[_0x0553('0xb')](_0x0553('0xc'),attributes,{'tableName':_0x0553('0xd'),'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 990677b..f10a1e4 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 _0x93cc=['jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register','request','then','request\x20sent','debug','MailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','MailQueue,\x20%s,\x20%s','message','info','result','catch','GetMailQueue','MailQueue','findAll','options','limit','map','include','attributes','model','ShowMailQueue','find','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment'];(function(_0x720f58,_0x51ad3d){var _0x4a7755=function(_0x21db74){while(--_0x21db74){_0x720f58['push'](_0x720f58['shift']());}};_0x4a7755(++_0x51ad3d);}(_0x93cc,0xc9));var _0xc93c=function(_0x5405f2,_0x5e801d){_0x5405f2=_0x5405f2-0x0;var _0x30c762=_0x93cc[_0x5405f2];return _0x30c762;};'use strict';var _=require(_0xc93c('0x0'));var util=require(_0xc93c('0x1'));var moment=require(_0xc93c('0x2'));var BPromise=require(_0xc93c('0x3'));var rs=require(_0xc93c('0x4'));var fs=require('fs');var Redis=require(_0xc93c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xc93c('0x6'));var logger=require(_0xc93c('0x7'))('rpc');var config=require(_0xc93c('0x8'));var jayson=require(_0xc93c('0x9'));var client=jayson[_0xc93c('0xa')][_0xc93c('0xb')]({'port':0x232a});config[_0xc93c('0xc')]=_[_0xc93c('0xd')](config['redis'],{'host':_0xc93c('0xe'),'port':0x18eb});var socket=require(_0xc93c('0xf'))(new Redis(config[_0xc93c('0xc')]));require('./mailQueue.socket')[_0xc93c('0x10')](socket);function respondWithRpcPromise(_0x54363f,_0x2a3927,_0x1c8801){return new BPromise(function(_0x2daf34,_0x451e64){return client[_0xc93c('0x11')](_0x54363f,_0x1c8801)[_0xc93c('0x12')](function(_0x5613a2){logger['info']('MailQueue,\x20%s,\x20%s',_0x2a3927,_0xc93c('0x13'));logger[_0xc93c('0x14')](_0xc93c('0x15'),_0x2a3927,'request\x20sent',JSON[_0xc93c('0x16')](_0x5613a2));if(_0x5613a2[_0xc93c('0x17')]){if(_0x5613a2[_0xc93c('0x17')][_0xc93c('0x18')]===0x1f4){logger[_0xc93c('0x17')](_0xc93c('0x19'),_0x2a3927,_0x5613a2[_0xc93c('0x17')][_0xc93c('0x1a')]);return _0x451e64(_0x5613a2['error']['message']);}logger[_0xc93c('0x17')](_0xc93c('0x19'),_0x2a3927,_0x5613a2[_0xc93c('0x17')][_0xc93c('0x1a')]);return _0x2daf34(_0x5613a2[_0xc93c('0x17')][_0xc93c('0x1a')]);}else{logger[_0xc93c('0x1b')](_0xc93c('0x19'),_0x2a3927,_0xc93c('0x13'));_0x2daf34(_0x5613a2[_0xc93c('0x1c')][_0xc93c('0x1a')]);}})[_0xc93c('0x1d')](function(_0x583cf0){logger[_0xc93c('0x17')]('MailQueue,\x20%s,\x20%s',_0x2a3927,_0x583cf0);_0x451e64(_0x583cf0);});});}exports[_0xc93c('0x1e')]=function(_0x9f8b65){var _0x524fce=this;return new Promise(function(_0x1996d6,_0x13313d){return db[_0xc93c('0x1f')][_0xc93c('0x20')]({'raw':_0x9f8b65[_0xc93c('0x21')]?_0x9f8b65['options']['raw']===undefined?!![]:![]:!![],'where':_0x9f8b65[_0xc93c('0x21')]?_0x9f8b65[_0xc93c('0x21')]['where']||null:null,'attributes':_0x9f8b65[_0xc93c('0x21')]?_0x9f8b65[_0xc93c('0x21')]['attributes']||null:null,'limit':_0x9f8b65[_0xc93c('0x21')]?_0x9f8b65[_0xc93c('0x21')][_0xc93c('0x22')]||null:null,'include':_0x9f8b65[_0xc93c('0x21')]?_0x9f8b65[_0xc93c('0x21')]['include']?_[_0xc93c('0x23')](_0x9f8b65['options'][_0xc93c('0x24')],function(_0x2f7214){return{'model':db[_0x2f7214['model']],'as':_0x2f7214['as'],'attributes':_0x2f7214[_0xc93c('0x25')],'include':_0x2f7214[_0xc93c('0x24')]?_[_0xc93c('0x23')](_0x2f7214[_0xc93c('0x24')],function(_0x583bb7){return{'model':db[_0x583bb7[_0xc93c('0x26')]],'as':_0x583bb7['as'],'attributes':_0x583bb7[_0xc93c('0x25')],'include':_0x583bb7[_0xc93c('0x24')]?_[_0xc93c('0x23')](_0x583bb7[_0xc93c('0x24')],function(_0x17f37b){return{'model':db[_0x17f37b[_0xc93c('0x26')]],'as':_0x17f37b['as'],'attributes':_0x17f37b[_0xc93c('0x25')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x992b91){logger['info'](_0xc93c('0x1e'),_0x9f8b65);logger[_0xc93c('0x14')]('GetMailQueue',_0x9f8b65,JSON[_0xc93c('0x16')](_0x992b91));_0x1996d6(_0x992b91);})['catch'](function(_0xa3f8cb){logger[_0xc93c('0x17')]('GetMailQueue',_0xa3f8cb[_0xc93c('0x1a')],_0x9f8b65);_0x13313d(_0x524fce[_0xc93c('0x17')](0x1f4,_0xa3f8cb[_0xc93c('0x1a')]));});});};exports[_0xc93c('0x27')]=function(_0x2c1033){var _0x40e8d0=this;return new Promise(function(_0x36096f,_0x548af1){return db[_0xc93c('0x1f')][_0xc93c('0x28')]({'raw':_0x2c1033[_0xc93c('0x21')]?_0x2c1033[_0xc93c('0x21')][_0xc93c('0x29')]===undefined?!![]:![]:!![],'where':_0x2c1033['options']?_0x2c1033['options']['where']||null:null,'attributes':_0x2c1033[_0xc93c('0x21')]?_0x2c1033[_0xc93c('0x21')][_0xc93c('0x25')]||null:null,'include':_0x2c1033[_0xc93c('0x21')]?_0x2c1033[_0xc93c('0x21')]['include']?_[_0xc93c('0x23')](_0x2c1033[_0xc93c('0x21')][_0xc93c('0x24')],function(_0x4a389d){return{'model':db[_0x4a389d[_0xc93c('0x26')]],'as':_0x4a389d['as'],'attributes':_0x4a389d[_0xc93c('0x25')],'include':_0x4a389d['include']?_[_0xc93c('0x23')](_0x4a389d[_0xc93c('0x24')],function(_0x12d66d){return{'model':db[_0x12d66d[_0xc93c('0x26')]],'as':_0x12d66d['as'],'attributes':_0x12d66d[_0xc93c('0x25')],'include':_0x12d66d[_0xc93c('0x24')]?_['map'](_0x12d66d[_0xc93c('0x24')],function(_0x5b53be){return{'model':db[_0x5b53be['model']],'as':_0x5b53be['as'],'attributes':_0x5b53be['attributes']};}):[]};}):[]};}):[]:[]})[_0xc93c('0x12')](function(_0x426ebe){logger[_0xc93c('0x1b')](_0xc93c('0x27'),_0x2c1033);logger['debug'](_0xc93c('0x27'),_0x2c1033,JSON['stringify'](_0x426ebe));_0x36096f(_0x426ebe);})[_0xc93c('0x1d')](function(_0x424bb6){logger['error'](_0xc93c('0x27'),_0x424bb6[_0xc93c('0x1a')],_0x2c1033);_0x548af1(_0x40e8d0[_0xc93c('0x17')](0x1f4,_0x424bb6[_0xc93c('0x1a')]));});});}; \ No newline at end of file +var _0xc0e6=['options','raw','where','attributes','limit','include','map','model','ShowMailQueue','find','then','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./mailQueue.socket','register','info','debug','stringify','error','code','MailQueue,\x20%s,\x20%s','message','request\x20sent','catch','GetMailQueue','MailQueue','findAll'];(function(_0x5dde65,_0x1eb6f7){var _0x1e9245=function(_0x5ce237){while(--_0x5ce237){_0x5dde65['push'](_0x5dde65['shift']());}};_0x1e9245(++_0x1eb6f7);}(_0xc0e6,0x1b8));var _0x6c0e=function(_0x17406a,_0x1e2320){_0x17406a=_0x17406a-0x0;var _0x1501ff=_0xc0e6[_0x17406a];return _0x1501ff;};'use strict';var _=require('lodash');var util=require(_0x6c0e('0x0'));var moment=require('moment');var BPromise=require(_0x6c0e('0x1'));var rs=require(_0x6c0e('0x2'));var fs=require('fs');var Redis=require(_0x6c0e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x6c0e('0x4'))(_0x6c0e('0x5'));var config=require(_0x6c0e('0x6'));var jayson=require(_0x6c0e('0x7'));var client=jayson[_0x6c0e('0x8')][_0x6c0e('0x9')]({'port':0x232a});config[_0x6c0e('0xa')]=_[_0x6c0e('0xb')](config[_0x6c0e('0xa')],{'host':_0x6c0e('0xc'),'port':0x18eb});var socket=require(_0x6c0e('0xd'))(new Redis(config[_0x6c0e('0xa')]));require(_0x6c0e('0xe'))[_0x6c0e('0xf')](socket);function respondWithRpcPromise(_0x3bc21e,_0x4db43d,_0x35312a){return new BPromise(function(_0x2b1038,_0x1683f2){return client['request'](_0x3bc21e,_0x35312a)['then'](function(_0xd941d5){logger[_0x6c0e('0x10')]('MailQueue,\x20%s,\x20%s',_0x4db43d,'request\x20sent');logger[_0x6c0e('0x11')]('MailQueue,\x20%s,\x20%s,\x20%s',_0x4db43d,'request\x20sent',JSON[_0x6c0e('0x12')](_0xd941d5));if(_0xd941d5[_0x6c0e('0x13')]){if(_0xd941d5[_0x6c0e('0x13')][_0x6c0e('0x14')]===0x1f4){logger[_0x6c0e('0x13')](_0x6c0e('0x15'),_0x4db43d,_0xd941d5['error'][_0x6c0e('0x16')]);return _0x1683f2(_0xd941d5[_0x6c0e('0x13')][_0x6c0e('0x16')]);}logger['error']('MailQueue,\x20%s,\x20%s',_0x4db43d,_0xd941d5[_0x6c0e('0x13')]['message']);return _0x2b1038(_0xd941d5[_0x6c0e('0x13')][_0x6c0e('0x16')]);}else{logger[_0x6c0e('0x10')]('MailQueue,\x20%s,\x20%s',_0x4db43d,_0x6c0e('0x17'));_0x2b1038(_0xd941d5['result'][_0x6c0e('0x16')]);}})[_0x6c0e('0x18')](function(_0x26e537){logger[_0x6c0e('0x13')](_0x6c0e('0x15'),_0x4db43d,_0x26e537);_0x1683f2(_0x26e537);});});}exports[_0x6c0e('0x19')]=function(_0x2b06cc){var _0x2d0859=this;return new Promise(function(_0x3c1952,_0x1ebed7){return db[_0x6c0e('0x1a')][_0x6c0e('0x1b')]({'raw':_0x2b06cc[_0x6c0e('0x1c')]?_0x2b06cc['options'][_0x6c0e('0x1d')]===undefined?!![]:![]:!![],'where':_0x2b06cc[_0x6c0e('0x1c')]?_0x2b06cc['options'][_0x6c0e('0x1e')]||null:null,'attributes':_0x2b06cc[_0x6c0e('0x1c')]?_0x2b06cc[_0x6c0e('0x1c')][_0x6c0e('0x1f')]||null:null,'limit':_0x2b06cc[_0x6c0e('0x1c')]?_0x2b06cc[_0x6c0e('0x1c')][_0x6c0e('0x20')]||null:null,'include':_0x2b06cc['options']?_0x2b06cc[_0x6c0e('0x1c')][_0x6c0e('0x21')]?_[_0x6c0e('0x22')](_0x2b06cc[_0x6c0e('0x1c')]['include'],function(_0x1e6c57){return{'model':db[_0x1e6c57[_0x6c0e('0x23')]],'as':_0x1e6c57['as'],'attributes':_0x1e6c57['attributes'],'include':_0x1e6c57['include']?_[_0x6c0e('0x22')](_0x1e6c57[_0x6c0e('0x21')],function(_0x15163e){return{'model':db[_0x15163e[_0x6c0e('0x23')]],'as':_0x15163e['as'],'attributes':_0x15163e['attributes'],'include':_0x15163e[_0x6c0e('0x21')]?_[_0x6c0e('0x22')](_0x15163e[_0x6c0e('0x21')],function(_0x14d7da){return{'model':db[_0x14d7da['model']],'as':_0x14d7da['as'],'attributes':_0x14d7da[_0x6c0e('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x38081a){logger['info'](_0x6c0e('0x19'),_0x2b06cc);logger[_0x6c0e('0x11')](_0x6c0e('0x19'),_0x2b06cc,JSON[_0x6c0e('0x12')](_0x38081a));_0x3c1952(_0x38081a);})[_0x6c0e('0x18')](function(_0x19fd6e){logger[_0x6c0e('0x13')](_0x6c0e('0x19'),_0x19fd6e[_0x6c0e('0x16')],_0x2b06cc);_0x1ebed7(_0x2d0859['error'](0x1f4,_0x19fd6e['message']));});});};exports[_0x6c0e('0x24')]=function(_0x40a4b2){var _0x571321=this;return new Promise(function(_0x12673a,_0x5112b0){return db[_0x6c0e('0x1a')][_0x6c0e('0x25')]({'raw':_0x40a4b2[_0x6c0e('0x1c')]?_0x40a4b2['options'][_0x6c0e('0x1d')]===undefined?!![]:![]:!![],'where':_0x40a4b2[_0x6c0e('0x1c')]?_0x40a4b2[_0x6c0e('0x1c')][_0x6c0e('0x1e')]||null:null,'attributes':_0x40a4b2[_0x6c0e('0x1c')]?_0x40a4b2[_0x6c0e('0x1c')][_0x6c0e('0x1f')]||null:null,'include':_0x40a4b2[_0x6c0e('0x1c')]?_0x40a4b2['options'][_0x6c0e('0x21')]?_['map'](_0x40a4b2[_0x6c0e('0x1c')][_0x6c0e('0x21')],function(_0x36e2a2){return{'model':db[_0x36e2a2['model']],'as':_0x36e2a2['as'],'attributes':_0x36e2a2['attributes'],'include':_0x36e2a2[_0x6c0e('0x21')]?_['map'](_0x36e2a2[_0x6c0e('0x21')],function(_0x5d6690){return{'model':db[_0x5d6690[_0x6c0e('0x23')]],'as':_0x5d6690['as'],'attributes':_0x5d6690[_0x6c0e('0x1f')],'include':_0x5d6690[_0x6c0e('0x21')]?_['map'](_0x5d6690[_0x6c0e('0x21')],function(_0x35d128){return{'model':db[_0x35d128['model']],'as':_0x35d128['as'],'attributes':_0x35d128[_0x6c0e('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6c0e('0x26')](function(_0x3acbda){logger[_0x6c0e('0x10')](_0x6c0e('0x24'),_0x40a4b2);logger['debug'](_0x6c0e('0x24'),_0x40a4b2,JSON[_0x6c0e('0x12')](_0x3acbda));_0x12673a(_0x3acbda);})[_0x6c0e('0x18')](function(_0x292a65){logger['error']('ShowMailQueue',_0x292a65[_0x6c0e('0x16')],_0x40a4b2);_0x5112b0(_0x571321[_0x6c0e('0x13')](0x1f4,_0x292a65['message']));});});}; \ No newline at end of file diff --git a/server/api/mailQueue/mailQueue.socket.js b/server/api/mailQueue/mailQueue.socket.js index 7a33c89..32ab935 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 _0xa5ea=['removeListener','length','mailQueue:','remove','update','emit'];(function(_0x2b690f,_0x1544c4){var _0x42df6a=function(_0x1c1dae){while(--_0x1c1dae){_0x2b690f['push'](_0x2b690f['shift']());}};_0x42df6a(++_0x1544c4);}(_0xa5ea,0x1e9));var _0xaa5e=function(_0x2bda08,_0x5e519c){_0x2bda08=_0x2bda08-0x0;var _0x5f24ca=_0xa5ea[_0x2bda08];return _0x5f24ca;};'use strict';var MailQueueEvents=require('./mailQueue.events');var events=['save',_0xaa5e('0x0'),_0xaa5e('0x1')];function createListener(_0x662a2f,_0x4ccda6){return function(_0x359b30){_0x4ccda6[_0xaa5e('0x2')](_0x662a2f,_0x359b30);};}function removeListener(_0x140db1,_0x17bb4d){return function(){MailQueueEvents[_0xaa5e('0x3')](_0x140db1,_0x17bb4d);};}exports['register']=function(_0x57edd3){for(var _0x133617=0x0,_0x465809=events[_0xaa5e('0x4')];_0x133617<_0x465809;_0x133617++){var _0xeb267f=events[_0x133617];var _0x1cf2ee=createListener(_0xaa5e('0x5')+_0xeb267f,_0x57edd3);MailQueueEvents['on'](_0xeb267f,_0x1cf2ee);}}; \ No newline at end of file +var _0x979e=['length','mailQueue:','./mailQueue.events','save','update','emit','removeListener','register'];(function(_0x3c75c1,_0x26bc61){var _0x21b7b3=function(_0xcb9e34){while(--_0xcb9e34){_0x3c75c1['push'](_0x3c75c1['shift']());}};_0x21b7b3(++_0x26bc61);}(_0x979e,0x17a));var _0xe979=function(_0x1e1e49,_0x274cf8){_0x1e1e49=_0x1e1e49-0x0;var _0x109b9e=_0x979e[_0x1e1e49];return _0x109b9e;};'use strict';var MailQueueEvents=require(_0xe979('0x0'));var events=[_0xe979('0x1'),'remove',_0xe979('0x2')];function createListener(_0x5640fe,_0x5aa5f9){return function(_0x79f9ab){_0x5aa5f9[_0xe979('0x3')](_0x5640fe,_0x79f9ab);};}function removeListener(_0xeff068,_0x404c4a){return function(){MailQueueEvents[_0xe979('0x4')](_0xeff068,_0x404c4a);};}exports[_0xe979('0x5')]=function(_0x1ac29e){for(var _0xa71936=0x0,_0x2024ce=events[_0xe979('0x6')];_0xa71936<_0x2024ce;_0xa71936++){var _0x56fccd=events[_0xa71936];var _0x64dd06=createListener(_0xe979('0x7')+_0x56fccd,_0x1ac29e);MailQueueEvents['on'](_0x56fccd,_0x64dd06);}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/index.js b/server/api/mailQueueReport/index.js index 9ca8330..4acc616 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 _0x9af0=['describe','show','post','create','put','/:id','update','delete','destroy','exports','multer','util','path','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe'];(function(_0x5e9ded,_0x537dec){var _0x2e9824=function(_0x245a8e){while(--_0x245a8e){_0x5e9ded['push'](_0x5e9ded['shift']());}};_0x2e9824(++_0x537dec);}(_0x9af0,0x1c3));var _0x09af=function(_0x48e38d,_0x5bf8e2){_0x48e38d=_0x48e38d-0x0;var _0x242b70=_0x9af0[_0x48e38d];return _0x242b70;};'use strict';var multer=require(_0x09af('0x0'));var util=require(_0x09af('0x1'));var path=require(_0x09af('0x2'));var timeout=require(_0x09af('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x09af('0x4'));var auth=require(_0x09af('0x5'));var interaction=require(_0x09af('0x6'));var config=require(_0x09af('0x7'));var controller=require('./mailQueueReport.controller');router[_0x09af('0x8')]('/',auth[_0x09af('0x9')](),controller['index']);router[_0x09af('0x8')](_0x09af('0xa'),auth[_0x09af('0x9')](),controller[_0x09af('0xb')]);router[_0x09af('0x8')]('/:id',auth['isAuthenticated'](),controller[_0x09af('0xc')]);router[_0x09af('0xd')]('/',auth['isAuthenticated'](),controller[_0x09af('0xe')]);router[_0x09af('0xf')](_0x09af('0x10'),auth[_0x09af('0x9')](),controller[_0x09af('0x11')]);router[_0x09af('0x12')](_0x09af('0x10'),auth[_0x09af('0x9')](),controller[_0x09af('0x13')]);module[_0x09af('0x14')]=router; \ No newline at end of file +var _0x0183=['../../config/environment','./mailQueueReport.controller','isAuthenticated','/describe','describe','get','post','put','/:id','delete','exports','util','path','connect-timeout','express','fs-extra','../../components/interaction/service'];(function(_0x11f37b,_0x42b767){var _0x529e69=function(_0x347a1f){while(--_0x347a1f){_0x11f37b['push'](_0x11f37b['shift']());}};_0x529e69(++_0x42b767);}(_0x0183,0x82));var _0x3018=function(_0x18c3e4,_0xdc74f2){_0x18c3e4=_0x18c3e4-0x0;var _0x5ac03a=_0x0183[_0x18c3e4];return _0x5ac03a;};'use strict';var multer=require('multer');var util=require(_0x3018('0x0'));var path=require(_0x3018('0x1'));var timeout=require(_0x3018('0x2'));var express=require(_0x3018('0x3'));var router=express['Router']();var fs_extra=require(_0x3018('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x3018('0x5'));var config=require(_0x3018('0x6'));var controller=require(_0x3018('0x7'));router['get']('/',auth[_0x3018('0x8')](),controller['index']);router['get'](_0x3018('0x9'),auth[_0x3018('0x8')](),controller[_0x3018('0xa')]);router[_0x3018('0xb')]('/:id',auth[_0x3018('0x8')](),controller['show']);router[_0x3018('0xc')]('/',auth[_0x3018('0x8')](),controller['create']);router[_0x3018('0xd')](_0x3018('0xe'),auth['isAuthenticated'](),controller['update']);router[_0x3018('0xf')](_0x3018('0xe'),auth[_0x3018('0x8')](),controller['destroy']);module[_0x3018('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.attributes.js b/server/api/mailQueueReport/mailQueueReport.attributes.js index 7c6dd9a..b478ca9 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 _0x58b9=['sequelize','exports','STRING','DATE','moment'];(function(_0x2d4154,_0x1f2102){var _0x581050=function(_0x3a117b){while(--_0x3a117b){_0x2d4154['push'](_0x2d4154['shift']());}};_0x581050(++_0x1f2102);}(_0x58b9,0x1b2));var _0x958b=function(_0x5c9ac8,_0x272210){_0x5c9ac8=_0x5c9ac8-0x0;var _0x2fabcd=_0x58b9[_0x5c9ac8];return _0x2fabcd;};'use strict';var moment=require(_0x958b('0x0'));var Sequelize=require(_0x958b('0x1'));module[_0x958b('0x2')]={'uniqueid':{'type':Sequelize[_0x958b('0x3')],'allowNull':![]},'from':{'type':Sequelize[_0x958b('0x3')]},'joinAt':{'type':Sequelize[_0x958b('0x4')]},'leaveAt':{'type':Sequelize[_0x958b('0x4')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize[_0x958b('0x3')]}}; \ No newline at end of file +var _0x980f=['sequelize','exports','STRING','DATE','moment'];(function(_0x5c3834,_0x2f4bcc){var _0x415f97=function(_0x1a76ed){while(--_0x1a76ed){_0x5c3834['push'](_0x5c3834['shift']());}};_0x415f97(++_0x2f4bcc);}(_0x980f,0x194));var _0xf980=function(_0x83cc7b,_0x337a6b){_0x83cc7b=_0x83cc7b-0x0;var _0x77e5ab=_0x980f[_0x83cc7b];return _0x77e5ab;};'use strict';var moment=require(_0xf980('0x0'));var Sequelize=require(_0xf980('0x1'));module[_0xf980('0x2')]={'uniqueid':{'type':Sequelize[_0xf980('0x3')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xf980('0x4')]},'leaveAt':{'type':Sequelize[_0xf980('0x4')]},'acceptAt':{'type':Sequelize[_0xf980('0x4')]},'exitAt':{'type':Sequelize[_0xf980('0x4')]},'reason':{'type':Sequelize[_0xf980('0x3')]}}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.controller.js b/server/api/mailQueueReport/mailQueueReport.controller.js index 082800d..7c43847 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 _0xc1c6=['filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','params','keys','length','find','create','body','describe','eml-format','rimraf','zip-dir','request-promise','bluebird','mustache','util','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','error','name','index','map','MailQueueReport','rawAttributes','type','key','model','query'];(function(_0x5302f9,_0x431617){var _0x108a62=function(_0x128e21){while(--_0x128e21){_0x5302f9['push'](_0x5302f9['shift']());}};_0x108a62(++_0x431617);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x5f09c4,_0x126d3b){_0x5f09c4=_0x5f09c4-0x0;var _0x3e1b43=_0xc1c6[_0x5f09c4];return _0x3e1b43;};'use strict';var emlformat=require(_0x6c1c('0x0'));var rimraf=require(_0x6c1c('0x1'));var zipdir=require(_0x6c1c('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x6c1c('0x3'));var moment=require('moment');var BPromise=require(_0x6c1c('0x4'));var Mustache=require(_0x6c1c('0x5'));var util=require(_0x6c1c('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0x6c1c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x6c1c('0x8'));var _=require('lodash');var squel=require(_0x6c1c('0x9'));var crypto=require(_0x6c1c('0xa'));var jsforce=require(_0x6c1c('0xb'));var deskjs=require(_0x6c1c('0xc'));var toCsv=require('to-csv');var querystring=require(_0x6c1c('0xd'));var Papa=require(_0x6c1c('0xe'));var Redis=require('ioredis');var authService=require(_0x6c1c('0xf'));var qs=require(_0x6c1c('0x10'));var as=require(_0x6c1c('0x11'));var hardwareService=require(_0x6c1c('0x12'));var logger=require('../../config/logger')(_0x6c1c('0x13'));var utils=require(_0x6c1c('0x14'));var config=require(_0x6c1c('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x6c1c('0x16'))['db'];function respondWithStatusCode(_0x12a9e6,_0x2067bd){_0x2067bd=_0x2067bd||0xcc;return function(_0x49304f){if(_0x49304f){return _0x12a9e6[_0x6c1c('0x17')](_0x2067bd);}return _0x12a9e6['status'](_0x2067bd)[_0x6c1c('0x18')]();};}function respondWithResult(_0x15a1fc,_0x2d279e){_0x2d279e=_0x2d279e||0xc8;return function(_0x154107){if(_0x154107){return _0x15a1fc[_0x6c1c('0x19')](_0x2d279e)[_0x6c1c('0x1a')](_0x154107);}};}function respondWithFilteredResult(_0x297c33,_0x41aa74){return function(_0x448f35){if(_0x448f35){var _0x5f3758=typeof _0x41aa74[_0x6c1c('0x1b')]===_0x6c1c('0x1c')&&typeof _0x41aa74['limit']===_0x6c1c('0x1c');var _0x237cac=_0x448f35['count'];var _0x137770=_0x5f3758?0x0:_0x41aa74['offset'];var _0x338dc2=_0x5f3758?_0x448f35[_0x6c1c('0x1d')]:_0x41aa74['offset']+_0x41aa74[_0x6c1c('0x1e')];var _0x59ab38;if(_0x338dc2>=_0x237cac){_0x338dc2=_0x237cac;_0x59ab38=0xc8;}else{_0x59ab38=0xce;}_0x297c33[_0x6c1c('0x19')](_0x59ab38);return _0x297c33[_0x6c1c('0x1f')](_0x6c1c('0x20'),_0x137770+'-'+_0x338dc2+'/'+_0x237cac)[_0x6c1c('0x1a')](_0x448f35);}return null;};}function patchUpdates(_0x1acf7f){return function(_0x1efb19){try{jsonpatch[_0x6c1c('0x21')](_0x1efb19,_0x1acf7f,!![]);}catch(_0x2ed830){return BPromise[_0x6c1c('0x22')](_0x2ed830);}return _0x1efb19[_0x6c1c('0x23')]();};}function saveUpdates(_0x3d2bf3,_0x450b1f){return function(_0x2382c0){if(_0x2382c0){return _0x2382c0[_0x6c1c('0x24')](_0x3d2bf3)[_0x6c1c('0x25')](function(_0x19c269){return _0x19c269;});}return null;};}function removeEntity(_0x2319d3,_0x12c638){return function(_0x3a3f13){if(_0x3a3f13){return _0x3a3f13[_0x6c1c('0x26')]()[_0x6c1c('0x25')](function(){_0x2319d3[_0x6c1c('0x19')](0xcc)[_0x6c1c('0x18')]();});}};}function handleEntityNotFound(_0x7ff10d,_0x18452d){return function(_0x80bc05){if(!_0x80bc05){_0x7ff10d[_0x6c1c('0x17')](0x194);}return _0x80bc05;};}function handleError(_0x1b9d7d,_0x2feaf4){_0x2feaf4=_0x2feaf4||0x1f4;return function(_0x5f4568){logger[_0x6c1c('0x27')](_0x5f4568['stack']);if(_0x5f4568[_0x6c1c('0x28')]){delete _0x5f4568['name'];}_0x1b9d7d[_0x6c1c('0x19')](_0x2feaf4)['send'](_0x5f4568);};}exports[_0x6c1c('0x29')]=function(_0xf557ba,_0x504348){var _0x3b1a4f={},_0x24da4c={},_0x4e13e3={'count':0x0,'rows':[]};var _0x3b319a=_[_0x6c1c('0x2a')](db[_0x6c1c('0x2b')][_0x6c1c('0x2c')],function(_0x4fc279){return{'name':_0x4fc279['fieldName'],'type':_0x4fc279[_0x6c1c('0x2d')][_0x6c1c('0x2e')]};});_0x24da4c[_0x6c1c('0x2f')]=_[_0x6c1c('0x2a')](_0x3b319a,_0x6c1c('0x28'));_0x24da4c[_0x6c1c('0x30')]=_['keys'](_0xf557ba[_0x6c1c('0x30')]);_0x24da4c[_0x6c1c('0x31')]=_['intersection'](_0x24da4c[_0x6c1c('0x2f')],_0x24da4c[_0x6c1c('0x30')]);_0x3b1a4f[_0x6c1c('0x32')]=_[_0x6c1c('0x33')](_0x24da4c['model'],qs[_0x6c1c('0x34')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x3b1a4f['attributes']=_0x3b1a4f[_0x6c1c('0x32')]['length']?_0x3b1a4f[_0x6c1c('0x32')]:_0x24da4c['model'];if(!_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x35')](_0x6c1c('0x36'))){_0x3b1a4f['limit']=qs['limit'](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x1e')]);_0x3b1a4f[_0x6c1c('0x1b')]=qs['offset'](_0xf557ba[_0x6c1c('0x30')]['offset']);}_0x3b1a4f['order']=qs[_0x6c1c('0x37')](_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x37')]);_0x3b1a4f[_0x6c1c('0x38')]=qs['filters'](_[_0x6c1c('0x39')](_0xf557ba[_0x6c1c('0x30')],_0x24da4c[_0x6c1c('0x31')]),_0x3b319a);if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]){_0x3b1a4f[_0x6c1c('0x38')]=_[_0x6c1c('0x3b')](_0x3b1a4f[_0x6c1c('0x38')],{'$or':_[_0x6c1c('0x2a')](_0x3b319a,function(_0x232508){if(_0x232508['type']!==_0x6c1c('0x3c')){var _0x464549={};_0x464549[_0x232508[_0x6c1c('0x28')]]={'$like':'%'+_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3a')]+'%'};return _0x464549;}})});}_0x3b1a4f=_['merge']({},_0x3b1a4f,_0xf557ba['options']);var _0x549db1={'where':_0x3b1a4f[_0x6c1c('0x38')]};return db['MailQueueReport']['count'](_0x549db1)[_0x6c1c('0x25')](function(_0x37244e){_0x4e13e3['count']=_0x37244e;if(_0xf557ba[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x3b1a4f[_0x6c1c('0x3e')]=[{'all':!![]}];}return db['MailQueueReport'][_0x6c1c('0x3f')](_0x3b1a4f);})[_0x6c1c('0x25')](function(_0x502e75){_0x4e13e3[_0x6c1c('0x40')]=_0x502e75;return _0x4e13e3;})['then'](respondWithFilteredResult(_0x504348,_0x3b1a4f))[_0x6c1c('0x41')](handleError(_0x504348,null));};exports[_0x6c1c('0x42')]=function(_0x16a389,_0x174f2c){var _0x10764a={'raw':!![],'where':{'id':_0x16a389[_0x6c1c('0x43')]['id']}},_0x595ba2={};_0x595ba2[_0x6c1c('0x2f')]=_[_0x6c1c('0x44')](db['MailQueueReport'][_0x6c1c('0x2c')]);_0x595ba2[_0x6c1c('0x30')]=_[_0x6c1c('0x44')](_0x16a389[_0x6c1c('0x30')]);_0x595ba2[_0x6c1c('0x31')]=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],_0x595ba2['query']);_0x10764a['attributes']=_['intersection'](_0x595ba2[_0x6c1c('0x2f')],qs[_0x6c1c('0x34')](_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x34')]));_0x10764a[_0x6c1c('0x32')]=_0x10764a[_0x6c1c('0x32')][_0x6c1c('0x45')]?_0x10764a[_0x6c1c('0x32')]:_0x595ba2['model'];if(_0x16a389[_0x6c1c('0x30')][_0x6c1c('0x3d')]){_0x10764a['include']=[{'all':!![]}];}_0x10764a=_[_0x6c1c('0x3b')]({},_0x10764a,_0x16a389['options']);return db[_0x6c1c('0x2b')][_0x6c1c('0x46')](_0x10764a)[_0x6c1c('0x25')](handleEntityNotFound(_0x174f2c,null))[_0x6c1c('0x25')](respondWithResult(_0x174f2c,null))[_0x6c1c('0x41')](handleError(_0x174f2c,null));};exports['create']=function(_0x1fe6e8,_0x58d075){return db[_0x6c1c('0x2b')][_0x6c1c('0x47')](_0x1fe6e8[_0x6c1c('0x48')],{})[_0x6c1c('0x25')](respondWithResult(_0x58d075,0xc9))[_0x6c1c('0x41')](handleError(_0x58d075,null));};exports[_0x6c1c('0x24')]=function(_0x52c14d,_0xa9889a){if(_0x52c14d[_0x6c1c('0x48')]['id']){delete _0x52c14d['body']['id'];}return db[_0x6c1c('0x2b')][_0x6c1c('0x46')]({'where':{'id':_0x52c14d[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0xa9889a,null))['then'](saveUpdates(_0x52c14d[_0x6c1c('0x48')],null))[_0x6c1c('0x25')](respondWithResult(_0xa9889a,null))[_0x6c1c('0x41')](handleError(_0xa9889a,null));};exports['destroy']=function(_0x5b8d69,_0x56b367){return db['MailQueueReport']['find']({'where':{'id':_0x5b8d69[_0x6c1c('0x43')]['id']}})[_0x6c1c('0x25')](handleEntityNotFound(_0x56b367,null))['then'](removeEntity(_0x56b367,null))[_0x6c1c('0x41')](handleError(_0x56b367,null));};exports[_0x6c1c('0x49')]=function(_0x2450ab,_0x5489ac){return db['MailQueueReport'][_0x6c1c('0x49')]()[_0x6c1c('0x25')](respondWithResult(_0x5489ac,null))['catch'](handleError(_0x5489ac,null));}; \ No newline at end of file +var _0x7096=['Content-Range','apply','reject','save','update','then','destroy','sendStatus','error','name','send','map','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','hasOwnProperty','limit','order','sort','where','pick','filter','VIRTUAL','merge','options','includeAll','include','rows','params','MailQueueReport','find','catch','create','body','describe','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','offset','undefined','count','set'];(function(_0x3a2147,_0x536e69){var _0x158499=function(_0x2244e4){while(--_0x2244e4){_0x3a2147['push'](_0x3a2147['shift']());}};_0x158499(++_0x536e69);}(_0x7096,0x10c));var _0x6709=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x7096[_0x5b561d];return _0x431060;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x6709('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x6709('0x1'));var rp=require('request-promise');var moment=require(_0x6709('0x2'));var BPromise=require(_0x6709('0x3'));var Mustache=require(_0x6709('0x4'));var util=require(_0x6709('0x5'));var path=require(_0x6709('0x6'));var sox=require(_0x6709('0x7'));var csv=require(_0x6709('0x8'));var ejs=require(_0x6709('0x9'));var fs=require('fs');var fs_extra=require(_0x6709('0xa'));var _=require(_0x6709('0xb'));var squel=require(_0x6709('0xc'));var crypto=require(_0x6709('0xd'));var jsforce=require(_0x6709('0xe'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x6709('0xf'));var Papa=require(_0x6709('0x10'));var Redis=require(_0x6709('0x11'));var authService=require(_0x6709('0x12'));var qs=require(_0x6709('0x13'));var as=require(_0x6709('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x6709('0x15'));var utils=require(_0x6709('0x16'));var config=require(_0x6709('0x17'));var licenseUtil=require(_0x6709('0x18'));var db=require(_0x6709('0x19'))['db'];function respondWithStatusCode(_0x288f51,_0x1d56a5){_0x1d56a5=_0x1d56a5||0xcc;return function(_0x1ac547){if(_0x1ac547){return _0x288f51['sendStatus'](_0x1d56a5);}return _0x288f51[_0x6709('0x1a')](_0x1d56a5)[_0x6709('0x1b')]();};}function respondWithResult(_0x4d5255,_0x3706e1){_0x3706e1=_0x3706e1||0xc8;return function(_0x4e4587){if(_0x4e4587){return _0x4d5255[_0x6709('0x1a')](_0x3706e1)['json'](_0x4e4587);}};}function respondWithFilteredResult(_0x41af1f,_0x4bc059){return function(_0x149233){if(_0x149233){var _0x28866a=typeof _0x4bc059[_0x6709('0x1c')]===_0x6709('0x1d')&&typeof _0x4bc059['limit']==='undefined';var _0x5c4f94=_0x149233[_0x6709('0x1e')];var _0x235a54=_0x28866a?0x0:_0x4bc059['offset'];var _0x9c1fd8=_0x28866a?_0x149233[_0x6709('0x1e')]:_0x4bc059[_0x6709('0x1c')]+_0x4bc059['limit'];var _0x13cf04;if(_0x9c1fd8>=_0x5c4f94){_0x9c1fd8=_0x5c4f94;_0x13cf04=0xc8;}else{_0x13cf04=0xce;}_0x41af1f[_0x6709('0x1a')](_0x13cf04);return _0x41af1f[_0x6709('0x1f')](_0x6709('0x20'),_0x235a54+'-'+_0x9c1fd8+'/'+_0x5c4f94)['json'](_0x149233);}return null;};}function patchUpdates(_0x3c4971){return function(_0x1edac3){try{jsonpatch[_0x6709('0x21')](_0x1edac3,_0x3c4971,!![]);}catch(_0x3cf882){return BPromise[_0x6709('0x22')](_0x3cf882);}return _0x1edac3[_0x6709('0x23')]();};}function saveUpdates(_0x45921e,_0x17763d){return function(_0x386224){if(_0x386224){return _0x386224[_0x6709('0x24')](_0x45921e)[_0x6709('0x25')](function(_0xa36371){return _0xa36371;});}return null;};}function removeEntity(_0x5cf48b,_0x29f25f){return function(_0x81138e){if(_0x81138e){return _0x81138e[_0x6709('0x26')]()['then'](function(){_0x5cf48b[_0x6709('0x1a')](0xcc)[_0x6709('0x1b')]();});}};}function handleEntityNotFound(_0x20a347,_0x44b465){return function(_0x588e00){if(!_0x588e00){_0x20a347[_0x6709('0x27')](0x194);}return _0x588e00;};}function handleError(_0x3076fe,_0x50f7d6){_0x50f7d6=_0x50f7d6||0x1f4;return function(_0x585073){logger[_0x6709('0x28')](_0x585073['stack']);if(_0x585073[_0x6709('0x29')]){delete _0x585073[_0x6709('0x29')];}_0x3076fe['status'](_0x50f7d6)[_0x6709('0x2a')](_0x585073);};}exports['index']=function(_0x46a325,_0x3cd555){var _0x5b6906={},_0x137137={},_0x4e6989={'count':0x0,'rows':[]};var _0xe066d8=_[_0x6709('0x2b')](db['MailQueueReport'][_0x6709('0x2c')],function(_0x5deff5){return{'name':_0x5deff5[_0x6709('0x2d')],'type':_0x5deff5[_0x6709('0x2e')]['key']};});_0x137137['model']=_[_0x6709('0x2b')](_0xe066d8,_0x6709('0x29'));_0x137137[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x46a325[_0x6709('0x2f')]);_0x137137[_0x6709('0x31')]=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],_0x137137[_0x6709('0x2f')]);_0x5b6906['attributes']=_[_0x6709('0x32')](_0x137137[_0x6709('0x33')],qs[_0x6709('0x34')](_0x46a325[_0x6709('0x2f')]['fields']));_0x5b6906[_0x6709('0x35')]=_0x5b6906[_0x6709('0x35')][_0x6709('0x36')]?_0x5b6906[_0x6709('0x35')]:_0x137137['model'];if(!_0x46a325[_0x6709('0x2f')][_0x6709('0x37')]('nolimit')){_0x5b6906[_0x6709('0x38')]=qs[_0x6709('0x38')](_0x46a325['query'][_0x6709('0x38')]);_0x5b6906[_0x6709('0x1c')]=qs[_0x6709('0x1c')](_0x46a325[_0x6709('0x2f')][_0x6709('0x1c')]);}_0x5b6906[_0x6709('0x39')]=qs[_0x6709('0x3a')](_0x46a325['query'][_0x6709('0x3a')]);_0x5b6906[_0x6709('0x3b')]=qs['filters'](_[_0x6709('0x3c')](_0x46a325[_0x6709('0x2f')],_0x137137[_0x6709('0x31')]),_0xe066d8);if(_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]){_0x5b6906[_0x6709('0x3b')]=_['merge'](_0x5b6906[_0x6709('0x3b')],{'$or':_['map'](_0xe066d8,function(_0x31e05a){if(_0x31e05a[_0x6709('0x2e')]!==_0x6709('0x3e')){var _0x48492f={};_0x48492f[_0x31e05a[_0x6709('0x29')]]={'$like':'%'+_0x46a325[_0x6709('0x2f')][_0x6709('0x3d')]+'%'};return _0x48492f;}})});}_0x5b6906=_[_0x6709('0x3f')]({},_0x5b6906,_0x46a325[_0x6709('0x40')]);var _0x1030ee={'where':_0x5b6906[_0x6709('0x3b')]};return db['MailQueueReport'][_0x6709('0x1e')](_0x1030ee)[_0x6709('0x25')](function(_0x50fbcd){_0x4e6989[_0x6709('0x1e')]=_0x50fbcd;if(_0x46a325[_0x6709('0x2f')][_0x6709('0x41')]){_0x5b6906[_0x6709('0x42')]=[{'all':!![]}];}return db['MailQueueReport']['findAll'](_0x5b6906);})[_0x6709('0x25')](function(_0x3f0da1){_0x4e6989[_0x6709('0x43')]=_0x3f0da1;return _0x4e6989;})[_0x6709('0x25')](respondWithFilteredResult(_0x3cd555,_0x5b6906))['catch'](handleError(_0x3cd555,null));};exports['show']=function(_0x5af1fb,_0x3d4237){var _0x293577={'raw':!![],'where':{'id':_0x5af1fb[_0x6709('0x44')]['id']}},_0x54f74e={};_0x54f74e[_0x6709('0x33')]=_['keys'](db['MailQueueReport'][_0x6709('0x2c')]);_0x54f74e[_0x6709('0x2f')]=_[_0x6709('0x30')](_0x5af1fb[_0x6709('0x2f')]);_0x54f74e[_0x6709('0x31')]=_['intersection'](_0x54f74e[_0x6709('0x33')],_0x54f74e['query']);_0x293577[_0x6709('0x35')]=_[_0x6709('0x32')](_0x54f74e[_0x6709('0x33')],qs['fields'](_0x5af1fb[_0x6709('0x2f')]['fields']));_0x293577['attributes']=_0x293577[_0x6709('0x35')][_0x6709('0x36')]?_0x293577[_0x6709('0x35')]:_0x54f74e[_0x6709('0x33')];if(_0x5af1fb[_0x6709('0x2f')][_0x6709('0x41')]){_0x293577[_0x6709('0x42')]=[{'all':!![]}];}_0x293577=_[_0x6709('0x3f')]({},_0x293577,_0x5af1fb[_0x6709('0x40')]);return db[_0x6709('0x45')][_0x6709('0x46')](_0x293577)[_0x6709('0x25')](handleEntityNotFound(_0x3d4237,null))[_0x6709('0x25')](respondWithResult(_0x3d4237,null))[_0x6709('0x47')](handleError(_0x3d4237,null));};exports[_0x6709('0x48')]=function(_0x4f82a0,_0xfbb810){return db['MailQueueReport']['create'](_0x4f82a0[_0x6709('0x49')],{})[_0x6709('0x25')](respondWithResult(_0xfbb810,0xc9))[_0x6709('0x47')](handleError(_0xfbb810,null));};exports[_0x6709('0x24')]=function(_0x22363b,_0x2b05dc){if(_0x22363b[_0x6709('0x49')]['id']){delete _0x22363b[_0x6709('0x49')]['id'];}return db['MailQueueReport'][_0x6709('0x46')]({'where':{'id':_0x22363b[_0x6709('0x44')]['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2b05dc,null))[_0x6709('0x25')](saveUpdates(_0x22363b['body'],null))[_0x6709('0x25')](respondWithResult(_0x2b05dc,null))['catch'](handleError(_0x2b05dc,null));};exports[_0x6709('0x26')]=function(_0x34a950,_0x2a563b){return db[_0x6709('0x45')][_0x6709('0x46')]({'where':{'id':_0x34a950['params']['id']}})[_0x6709('0x25')](handleEntityNotFound(_0x2a563b,null))[_0x6709('0x25')](removeEntity(_0x2a563b,null))[_0x6709('0x47')](handleError(_0x2a563b,null));};exports[_0x6709('0x4a')]=function(_0x1015e0,_0x55188c){return db['MailQueueReport'][_0x6709('0x4a')]()['then'](respondWithResult(_0x55188c,null))['catch'](handleError(_0x55188c,null));}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.model.js b/server/api/mailQueueReport/mailQueueReport.model.js index c5215ab..990de78 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 _0x4d1e=['exports','define','MailQueueReport','report_mail_queue','uniqueid','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailQueueReport.attributes'];(function(_0x44a64f,_0x38475c){var _0x52024b=function(_0x2cd055){while(--_0x2cd055){_0x44a64f['push'](_0x44a64f['shift']());}};_0x52024b(++_0x38475c);}(_0x4d1e,0xf5));var _0xe4d1=function(_0x2d486b,_0x5f213c){_0x2d486b=_0x2d486b-0x0;var _0x4291d1=_0x4d1e[_0x2d486b];return _0x4291d1;};'use strict';var _=require(_0xe4d1('0x0'));var util=require(_0xe4d1('0x1'));var logger=require(_0xe4d1('0x2'))(_0xe4d1('0x3'));var moment=require(_0xe4d1('0x4'));var BPromise=require(_0xe4d1('0x5'));var rp=require(_0xe4d1('0x6'));var fs=require('fs');var path=require(_0xe4d1('0x7'));var rimraf=require(_0xe4d1('0x8'));var config=require(_0xe4d1('0x9'));var attributes=require(_0xe4d1('0xa'));module[_0xe4d1('0xb')]=function(_0x376de2,_0x2b5471){return _0x376de2[_0xe4d1('0xc')](_0xe4d1('0xd'),attributes,{'tableName':_0xe4d1('0xe'),'paranoid':![],'indexes':[{'name':_0xe4d1('0xf'),'fields':[_0xe4d1('0xf')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4e87=['./mailQueueReport.attributes','exports','define','MailQueueReport','report_mail_queue','uniqueid','moment','bluebird','path','rimraf'];(function(_0x25aa2c,_0x5d1171){var _0x2706bc=function(_0x8924de){while(--_0x8924de){_0x25aa2c['push'](_0x25aa2c['shift']());}};_0x2706bc(++_0x5d1171);}(_0x4e87,0x1e6));var _0x74e8=function(_0x1bf69b,_0x3e889c){_0x1bf69b=_0x1bf69b-0x0;var _0x252aa8=_0x4e87[_0x1bf69b];return _0x252aa8;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x74e8('0x0'));var BPromise=require(_0x74e8('0x1'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x74e8('0x2'));var rimraf=require(_0x74e8('0x3'));var config=require('../../config/environment');var attributes=require(_0x74e8('0x4'));module[_0x74e8('0x5')]=function(_0x171948,_0x161a7d){return _0x171948[_0x74e8('0x6')](_0x74e8('0x7'),attributes,{'tableName':_0x74e8('0x8'),'paranoid':![],'indexes':[{'name':_0x74e8('0x9'),'fields':[_0x74e8('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailQueueReport/mailQueueReport.rpc.js b/server/api/mailQueueReport/mailQueueReport.rpc.js index b5595bb..364edc3 100644 --- a/server/api/mailQueueReport/mailQueueReport.rpc.js +++ b/server/api/mailQueueReport/mailQueueReport.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5f2f=['error','code','message','request\x20sent','result','catch','CreateMailQueueReport','MailQueueReport','create','body','options','raw','UpdateMailQueueReport','update','attributes','limit','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','MailQueueReport,\x20%s,\x20%s','debug','stringify'];(function(_0x4e9e3b,_0x47cb62){var _0x31b353=function(_0x557fba){while(--_0x557fba){_0x4e9e3b['push'](_0x4e9e3b['shift']());}};_0x31b353(++_0x47cb62);}(_0x5f2f,0x73));var _0xf5f2=function(_0x503ac6,_0x5ef9f5){_0x503ac6=_0x503ac6-0x0;var _0x3aa041=_0x5f2f[_0x503ac6];return _0x3aa041;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('MailQueueReport,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![]})['then'](function(_0x47acfc){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger['debug'](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x47acfc));_0x4ff59b(_0x47acfc);})[_0xf5f2('0x16')](function(_0x39c024){logger[_0xf5f2('0x11')]('CreateMailQueueReport',_0x39c024[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x39c024[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x1d')]=function(_0x287ad5){var _0x5bdf4a=this;return new Promise(function(_0x529f07,_0x5f1124){return db[_0xf5f2('0x18')][_0xf5f2('0x1e')](_0x287ad5[_0xf5f2('0x1a')],{'raw':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')]['where']||null:null,'attributes':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null,'limit':_0x287ad5[_0xf5f2('0x1b')]?_0x287ad5[_0xf5f2('0x1b')][_0xf5f2('0x20')]||null:null})['then'](function(_0x53cb96){logger[_0xf5f2('0xd')](_0xf5f2('0x1d'),_0x287ad5);logger[_0xf5f2('0xf')]('UpdateMailQueueReport',_0x287ad5,JSON['stringify'](_0x53cb96));_0x529f07(_0x53cb96);})[_0xf5f2('0x16')](function(_0x50b8a2){logger[_0xf5f2('0x11')](_0xf5f2('0x1d'),_0x50b8a2[_0xf5f2('0x13')],_0x287ad5);_0x5f1124(_0x5bdf4a['error'](0x1f4,_0x50b8a2['message']));});});}; \ No newline at end of file +var _0x2ef3=['options','raw','UpdateMailQueueReport','where','attributes','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailQueueReport,\x20%s,\x20%s','MailQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','CreateMailQueueReport','MailQueueReport','body'];(function(_0x308c00,_0x3cbd67){var _0x2b21b2=function(_0x4ce3fc){while(--_0x4ce3fc){_0x308c00['push'](_0x308c00['shift']());}};_0x2b21b2(++_0x3cbd67);}(_0x2ef3,0xba));var _0x32ef=function(_0x53bd16,_0x3c2f60){_0x53bd16=_0x53bd16-0x0;var _0x4820ba=_0x2ef3[_0x53bd16];return _0x4820ba;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailQueueReport,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});}exports[_0x32ef('0x15')]=function(_0x1a9476){var _0x286bfb=this;return new Promise(function(_0x57863c,_0xbe37f6){return db[_0x32ef('0x16')]['create'](_0x1a9476[_0x32ef('0x17')],{'raw':_0x1a9476[_0x32ef('0x18')]?_0x1a9476[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![]})[_0x32ef('0xb')](function(_0x3aec05){logger['info'](_0x32ef('0x15'),_0x1a9476);logger['debug'](_0x32ef('0x15'),_0x1a9476,JSON[_0x32ef('0x10')](_0x3aec05));_0x57863c(_0x3aec05);})['catch'](function(_0x1af371){logger[_0x32ef('0x11')](_0x32ef('0x15'),_0x1af371['message'],_0x1a9476);_0xbe37f6(_0x286bfb['error'](0x1f4,_0x1af371[_0x32ef('0x13')]));});});};exports[_0x32ef('0x1a')]=function(_0x225feb){var _0x478bef=this;return new Promise(function(_0x59585f,_0x19ea6){return db['MailQueueReport']['update'](_0x225feb[_0x32ef('0x17')],{'raw':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1b')]||null:null,'attributes':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')][_0x32ef('0x1c')]||null:null,'limit':_0x225feb[_0x32ef('0x18')]?_0x225feb[_0x32ef('0x18')]['limit']||null:null})[_0x32ef('0xb')](function(_0x2f5d06){logger['info'](_0x32ef('0x1a'),_0x225feb);logger[_0x32ef('0x1d')](_0x32ef('0x1a'),_0x225feb,JSON[_0x32ef('0x10')](_0x2f5d06));_0x59585f(_0x2f5d06);})['catch'](function(_0x10e38c){logger[_0x32ef('0x11')](_0x32ef('0x1a'),_0x10e38c[_0x32ef('0x13')],_0x225feb);_0x19ea6(_0x478bef[_0x32ef('0x11')](0x1f4,_0x10e38c[_0x32ef('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerIn/index.js b/server/api/mailServerIn/index.js index 30fb624..ed87745 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x30229c,_0x49fdc8){var _0x3c6edc=function(_0x54b050){while(--_0x54b050){_0x30229c['push'](_0x30229c['shift']());}};_0x3c6edc(++_0x49fdc8);}(_0xe706,0xa3));var _0x6e70=function(_0x425561,_0x3a4598){_0x425561=_0x425561-0x0;var _0x303b28=_0xe706[_0x425561];return _0x303b28;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x455953,_0x2ee57d){var _0x2d7d6b=function(_0x1453b7){while(--_0x1453b7){_0x455953['push'](_0x455953['shift']());}};_0x2d7d6b(++_0x2ee57d);}(_0x9c44,0x178));var _0x49c4=function(_0x2d7f0e,_0x3e6fbd){_0x2d7f0e=_0x2d7f0e-0x0;var _0x110b07=_0x9c44[_0x2d7f0e];return _0x110b07;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.attributes.js b/server/api/mailServerIn/mailServerIn.attributes.js index 92bf3ec..5125379 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 _0xf05f=['STRING','INTEGER','BOOLEAN','INBOX','exports'];(function(_0x28fcdc,_0x17e930){var _0x80bd4c=function(_0x2c490d){while(--_0x2c490d){_0x28fcdc['push'](_0x28fcdc['shift']());}};_0x80bd4c(++_0x17e930);}(_0xf05f,0xae));var _0xff05=function(_0x2a974a,_0x3ebbd3){_0x2a974a=_0x2a974a-0x0;var _0x2ffff6=_0xf05f[_0x2a974a];return _0x2ffff6;};'use strict';var Sequelize=require('sequelize');module[_0xff05('0x0')]={'description':{'type':Sequelize[_0xff05('0x1')]},'host':{'type':Sequelize[_0xff05('0x1')]},'authentication':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'user':{'type':Sequelize[_0xff05('0x1')]},'password':{'type':Sequelize[_0xff05('0x1')]},'port':{'type':Sequelize[_0xff05('0x2')]},'tls':{'type':Sequelize[_0xff05('0x3')],'defaultValue':!![]},'mailbox':{'type':Sequelize[_0xff05('0x1')],'defaultValue':_0xff05('0x4')},'connTimeout':{'type':Sequelize[_0xff05('0x2')],'defaultValue':0xa},'authTimeout':{'type':Sequelize[_0xff05('0x2')],'defaultValue':0x5},'service':{'type':Sequelize[_0xff05('0x1')]},'modernAuthentication':{'type':Sequelize[_0xff05('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x4016=['BOOLEAN','INTEGER','exports','STRING'];(function(_0x33c8db,_0x58f0cb){var _0xb92f73=function(_0x2b982e){while(--_0x2b982e){_0x33c8db['push'](_0x33c8db['shift']());}};_0xb92f73(++_0x58f0cb);}(_0x4016,0x1a2));var _0x6401=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x4016[_0x2b4411];return _0x8e41ef;};'use strict';var Sequelize=require('sequelize');module[_0x6401('0x0')]={'description':{'type':Sequelize[_0x6401('0x1')]},'host':{'type':Sequelize[_0x6401('0x1')]},'authentication':{'type':Sequelize[_0x6401('0x2')],'defaultValue':!![]},'user':{'type':Sequelize[_0x6401('0x1')]},'password':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x6401('0x3')]},'tls':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'mailbox':{'type':Sequelize['STRING'],'defaultValue':'INBOX'},'connTimeout':{'type':Sequelize[_0x6401('0x3')],'defaultValue':0xa},'authTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x5},'service':{'type':Sequelize[_0x6401('0x1')]},'modernAuthentication':{'type':Sequelize[_0x6401('0x2')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerIn/mailServerIn.model.js b/server/api/mailServerIn/mailServerIn.model.js index 00decfe..520aa4d 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 _0xde28=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','exports','define','MailServerIn','mail_servers_in','lodash'];(function(_0x17a68c,_0x2c01a4){var _0x258f21=function(_0x3f8b36){while(--_0x3f8b36){_0x17a68c['push'](_0x17a68c['shift']());}};_0x258f21(++_0x2c01a4);}(_0xde28,0xe9));var _0x8de2=function(_0x25336b,_0x55f6b6){_0x25336b=_0x25336b-0x0;var _0x4d2aea=_0xde28[_0x25336b];return _0x4d2aea;};'use strict';var _=require(_0x8de2('0x0'));var util=require(_0x8de2('0x1'));var logger=require('../../config/logger')(_0x8de2('0x2'));var moment=require(_0x8de2('0x3'));var BPromise=require(_0x8de2('0x4'));var rp=require(_0x8de2('0x5'));var fs=require('fs');var path=require(_0x8de2('0x6'));var rimraf=require(_0x8de2('0x7'));var config=require(_0x8de2('0x8'));var attributes=require('./mailServerIn.attributes');module[_0x8de2('0x9')]=function(_0x1f1cc3,_0x4b6f60){return _0x1f1cc3[_0x8de2('0xa')](_0x8de2('0xb'),attributes,{'tableName':_0x8de2('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3530=['util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./mailServerIn.attributes','MailServerIn','mail_servers_in','lodash'];(function(_0x4372e2,_0x47c46d){var _0x57ccea=function(_0x1efed1){while(--_0x1efed1){_0x4372e2['push'](_0x4372e2['shift']());}};_0x57ccea(++_0x47c46d);}(_0x3530,0x110));var _0x0353=function(_0x224f18,_0x356439){_0x224f18=_0x224f18-0x0;var _0x47ca27=_0x3530[_0x224f18];return _0x47ca27;};'use strict';var _=require(_0x0353('0x0'));var util=require(_0x0353('0x1'));var logger=require(_0x0353('0x2'))(_0x0353('0x3'));var moment=require(_0x0353('0x4'));var BPromise=require(_0x0353('0x5'));var rp=require(_0x0353('0x6'));var fs=require('fs');var path=require(_0x0353('0x7'));var rimraf=require(_0x0353('0x8'));var config=require(_0x0353('0x9'));var attributes=require(_0x0353('0xa'));module['exports']=function(_0x1d4136,_0x4334a9){return _0x1d4136['define'](_0x0353('0xb'),attributes,{'tableName':_0x0353('0xc'),'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 7cf6c57..1e43e50 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 _0x6de9=['../../config/environment','client','http','request','info','MailServerIn,\x20%s,\x20%s','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetMailServerIn','MailServerIn','findAll','options','raw','where','attributes','limit','include','map','model','then','debug','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc'];(function(_0x276279,_0x3f12ce){var _0x125071=function(_0x245a60){while(--_0x245a60){_0x276279['push'](_0x276279['shift']());}};_0x125071(++_0x3f12ce);}(_0x6de9,0xe6));var _0x96de=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x6de9[_0xbca1b1];return _0x4e1686;};'use strict';var _=require(_0x96de('0x0'));var util=require(_0x96de('0x1'));var moment=require(_0x96de('0x2'));var BPromise=require(_0x96de('0x3'));var rs=require(_0x96de('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x96de('0x5'))['db'];var utils=require(_0x96de('0x6'));var logger=require('../../config/logger')(_0x96de('0x7'));var config=require(_0x96de('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x96de('0x9')][_0x96de('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x20ed57,_0x46afa4,_0x48e213){return new BPromise(function(_0x8624be,_0x14fad5){return client[_0x96de('0xb')](_0x20ed57,_0x48e213)['then'](function(_0x415b5f){logger[_0x96de('0xc')](_0x96de('0xd'),_0x46afa4,'request\x20sent');logger['debug'](_0x96de('0xe'),_0x46afa4,_0x96de('0xf'),JSON['stringify'](_0x415b5f));if(_0x415b5f[_0x96de('0x10')]){if(_0x415b5f[_0x96de('0x10')]['code']===0x1f4){logger['error'](_0x96de('0xd'),_0x46afa4,_0x415b5f[_0x96de('0x10')]['message']);return _0x14fad5(_0x415b5f[_0x96de('0x10')]['message']);}logger['error'](_0x96de('0xd'),_0x46afa4,_0x415b5f[_0x96de('0x10')][_0x96de('0x11')]);return _0x8624be(_0x415b5f[_0x96de('0x10')][_0x96de('0x11')]);}else{logger['info'](_0x96de('0xd'),_0x46afa4,_0x96de('0xf'));_0x8624be(_0x415b5f[_0x96de('0x12')][_0x96de('0x11')]);}})[_0x96de('0x13')](function(_0x198663){logger[_0x96de('0x10')](_0x96de('0xd'),_0x46afa4,_0x198663);_0x14fad5(_0x198663);});});}exports[_0x96de('0x14')]=function(_0x9701bb){var _0x321bf4=this;return new Promise(function(_0x389a4d,_0xe0878b){return db[_0x96de('0x15')][_0x96de('0x16')]({'raw':_0x9701bb[_0x96de('0x17')]?_0x9701bb[_0x96de('0x17')][_0x96de('0x18')]===undefined?!![]:![]:!![],'where':_0x9701bb['options']?_0x9701bb[_0x96de('0x17')][_0x96de('0x19')]||null:null,'attributes':_0x9701bb[_0x96de('0x17')]?_0x9701bb['options'][_0x96de('0x1a')]||null:null,'limit':_0x9701bb['options']?_0x9701bb[_0x96de('0x17')][_0x96de('0x1b')]||null:null,'include':_0x9701bb[_0x96de('0x17')]?_0x9701bb[_0x96de('0x17')][_0x96de('0x1c')]?_[_0x96de('0x1d')](_0x9701bb[_0x96de('0x17')][_0x96de('0x1c')],function(_0x37b616){return{'model':db[_0x37b616['model']],'as':_0x37b616['as'],'attributes':_0x37b616[_0x96de('0x1a')],'include':_0x37b616['include']?_[_0x96de('0x1d')](_0x37b616[_0x96de('0x1c')],function(_0x2e0b75){return{'model':db[_0x2e0b75[_0x96de('0x1e')]],'as':_0x2e0b75['as'],'attributes':_0x2e0b75[_0x96de('0x1a')],'include':_0x2e0b75[_0x96de('0x1c')]?_[_0x96de('0x1d')](_0x2e0b75[_0x96de('0x1c')],function(_0x1f8f97){return{'model':db[_0x1f8f97[_0x96de('0x1e')]],'as':_0x1f8f97['as'],'attributes':_0x1f8f97[_0x96de('0x1a')]};}):[]};}):[]};}):[]:[]})[_0x96de('0x1f')](function(_0xe590fc){logger[_0x96de('0xc')]('GetMailServerIn',_0x9701bb);logger[_0x96de('0x20')](_0x96de('0x14'),_0x9701bb,JSON[_0x96de('0x21')](_0xe590fc));_0x389a4d(_0xe590fc);})[_0x96de('0x13')](function(_0x9d324f){logger['error']('GetMailServerIn',_0x9d324f[_0x96de('0x11')],_0x9701bb);_0xe0878b(_0x321bf4[_0x96de('0x10')](0x1f4,_0x9d324f[_0x96de('0x11')]));});});}; \ No newline at end of file +var _0x0482=['util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','MailServerIn,\x20%s,\x20%s','debug','MailServerIn,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','GetMailServerIn','MailServerIn','options','where','attributes','limit','map','include','model','lodash'];(function(_0x2f9467,_0x40576f){var _0x39894c=function(_0x13e344){while(--_0x13e344){_0x2f9467['push'](_0x2f9467['shift']());}};_0x39894c(++_0x40576f);}(_0x0482,0xc5));var _0x2048=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x0482[_0x595bd1];return _0xd0344f;};'use strict';var _=require(_0x2048('0x0'));var util=require(_0x2048('0x1'));var moment=require(_0x2048('0x2'));var BPromise=require('bluebird');var rs=require(_0x2048('0x3'));var fs=require('fs');var Redis=require(_0x2048('0x4'));var db=require(_0x2048('0x5'))['db'];var utils=require(_0x2048('0x6'));var logger=require(_0x2048('0x7'))(_0x2048('0x8'));var config=require(_0x2048('0x9'));var jayson=require(_0x2048('0xa'));var client=jayson['client'][_0x2048('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4755e9,_0x2d2834,_0x37ddbd){return new BPromise(function(_0x62239,_0x263510){return client[_0x2048('0xc')](_0x4755e9,_0x37ddbd)[_0x2048('0xd')](function(_0x5e1b0d){logger[_0x2048('0xe')](_0x2048('0xf'),_0x2d2834,'request\x20sent');logger[_0x2048('0x10')](_0x2048('0x11'),_0x2d2834,_0x2048('0x12'),JSON[_0x2048('0x13')](_0x5e1b0d));if(_0x5e1b0d['error']){if(_0x5e1b0d[_0x2048('0x14')]['code']===0x1f4){logger[_0x2048('0x14')](_0x2048('0xf'),_0x2d2834,_0x5e1b0d[_0x2048('0x14')][_0x2048('0x15')]);return _0x263510(_0x5e1b0d[_0x2048('0x14')][_0x2048('0x15')]);}logger[_0x2048('0x14')](_0x2048('0xf'),_0x2d2834,_0x5e1b0d['error'][_0x2048('0x15')]);return _0x62239(_0x5e1b0d[_0x2048('0x14')][_0x2048('0x15')]);}else{logger[_0x2048('0xe')](_0x2048('0xf'),_0x2d2834,'request\x20sent');_0x62239(_0x5e1b0d[_0x2048('0x16')]['message']);}})[_0x2048('0x17')](function(_0x39243f){logger[_0x2048('0x14')]('MailServerIn,\x20%s,\x20%s',_0x2d2834,_0x39243f);_0x263510(_0x39243f);});});}exports[_0x2048('0x18')]=function(_0x30b121){var _0x1581cf=this;return new Promise(function(_0xb0fd9e,_0x4bf297){return db[_0x2048('0x19')]['findAll']({'raw':_0x30b121[_0x2048('0x1a')]?_0x30b121[_0x2048('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x30b121[_0x2048('0x1a')]?_0x30b121[_0x2048('0x1a')][_0x2048('0x1b')]||null:null,'attributes':_0x30b121[_0x2048('0x1a')]?_0x30b121[_0x2048('0x1a')][_0x2048('0x1c')]||null:null,'limit':_0x30b121[_0x2048('0x1a')]?_0x30b121['options'][_0x2048('0x1d')]||null:null,'include':_0x30b121['options']?_0x30b121[_0x2048('0x1a')]['include']?_[_0x2048('0x1e')](_0x30b121[_0x2048('0x1a')][_0x2048('0x1f')],function(_0x4fdaaf){return{'model':db[_0x4fdaaf[_0x2048('0x20')]],'as':_0x4fdaaf['as'],'attributes':_0x4fdaaf[_0x2048('0x1c')],'include':_0x4fdaaf[_0x2048('0x1f')]?_['map'](_0x4fdaaf[_0x2048('0x1f')],function(_0x117663){return{'model':db[_0x117663['model']],'as':_0x117663['as'],'attributes':_0x117663[_0x2048('0x1c')],'include':_0x117663[_0x2048('0x1f')]?_[_0x2048('0x1e')](_0x117663[_0x2048('0x1f')],function(_0x13b709){return{'model':db[_0x13b709[_0x2048('0x20')]],'as':_0x13b709['as'],'attributes':_0x13b709[_0x2048('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x2048('0xd')](function(_0x4a89f6){logger['info'](_0x2048('0x18'),_0x30b121);logger[_0x2048('0x10')](_0x2048('0x18'),_0x30b121,JSON['stringify'](_0x4a89f6));_0xb0fd9e(_0x4a89f6);})['catch'](function(_0x3cb36f){logger[_0x2048('0x14')]('GetMailServerIn',_0x3cb36f['message'],_0x30b121);_0x4bf297(_0x1581cf[_0x2048('0x14')](0x1f4,_0x3cb36f[_0x2048('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/mailServerOut/index.js b/server/api/mailServerOut/index.js index 504a177..12a3d26 100644 --- a/server/api/mailServerOut/index.js +++ b/server/api/mailServerOut/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0x7a54,0x106));var _0x47a5=function(_0x5da3f5,_0x4a1e99){_0x5da3f5=_0x5da3f5-0x0;var _0x3897f5=_0x7a54[_0x5da3f5];return _0x3897f5;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file +var _0x7a54=['index','/:id','isAuthenticated','post','delete','destroy','exports','multer','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./mailServerOut.controller','get'];(function(_0x2a6809,_0x44edde){var _0x11c371=function(_0x1a4888){while(--_0x1a4888){_0x2a6809['push'](_0x2a6809['shift']());}};_0x11c371(++_0x44edde);}(_0x7a54,0x106));var _0x47a5=function(_0x1f3a9b,_0x4aea56){_0x1f3a9b=_0x1f3a9b-0x0;var _0x1d9795=_0x7a54[_0x1f3a9b];return _0x1d9795;};'use strict';var multer=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var path=require(_0x47a5('0x2'));var timeout=require('connect-timeout');var express=require(_0x47a5('0x3'));var router=express[_0x47a5('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x47a5('0x5'));var interaction=require(_0x47a5('0x6'));var config=require(_0x47a5('0x7'));var controller=require(_0x47a5('0x8'));router[_0x47a5('0x9')]('/',auth['isAuthenticated'](),controller[_0x47a5('0xa')]);router['get'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['show']);router[_0x47a5('0xd')]('/',auth['isAuthenticated'](),controller['create']);router['put'](_0x47a5('0xb'),auth[_0x47a5('0xc')](),controller['update']);router[_0x47a5('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x47a5('0xf')]);module[_0x47a5('0x10')]=router; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.attributes.js b/server/api/mailServerOut/mailServerOut.attributes.js index 456e1bc..921c022 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 _0x2e54=['BOOLEAN','sequelize','STRING','INTEGER'];(function(_0x2baf85,_0x2594af){var _0x4063bb=function(_0x16d4e5){while(--_0x16d4e5){_0x2baf85['push'](_0x2baf85['shift']());}};_0x4063bb(++_0x2594af);}(_0x2e54,0x1dd));var _0x42e5=function(_0xb3cfe9,_0x540100){_0xb3cfe9=_0xb3cfe9-0x0;var _0x1dc043=_0x2e54[_0xb3cfe9];return _0x1dc043;};'use strict';var Sequelize=require(_0x42e5('0x0'));module['exports']={'description':{'type':Sequelize['STRING']},'host':{'type':Sequelize[_0x42e5('0x1')]},'user':{'type':Sequelize[_0x42e5('0x1')]},'pass':{'type':Sequelize[_0x42e5('0x1')]},'port':{'type':Sequelize[_0x42e5('0x2')]},'secure':{'type':Sequelize[_0x42e5('0x3')],'defaultValue':![]},'service':{'type':Sequelize[_0x42e5('0x1')]},'authentication':{'type':Sequelize[_0x42e5('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6324=['STRING','BOOLEAN','sequelize','exports'];(function(_0x4b1012,_0x1415eb){var _0x23d715=function(_0x25f330){while(--_0x25f330){_0x4b1012['push'](_0x4b1012['shift']());}};_0x23d715(++_0x1415eb);}(_0x6324,0x142));var _0x4632=function(_0x2700d5,_0x1b113b){_0x2700d5=_0x2700d5-0x0;var _0xdc3338=_0x6324[_0x2700d5];return _0xdc3338;};'use strict';var Sequelize=require(_0x4632('0x0'));module[_0x4632('0x1')]={'description':{'type':Sequelize[_0x4632('0x2')]},'host':{'type':Sequelize[_0x4632('0x2')]},'user':{'type':Sequelize['STRING']},'pass':{'type':Sequelize[_0x4632('0x2')]},'port':{'type':Sequelize['INTEGER']},'secure':{'type':Sequelize[_0x4632('0x3')],'defaultValue':![]},'service':{'type':Sequelize['STRING']},'authentication':{'type':Sequelize[_0x4632('0x3')],'defaultValue':!![]},'modernAuthentication':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.controller.js b/server/api/mailServerOut/mailServerOut.controller.js index 761715f..ea578f9 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 _0x361b=['params','includeAll','include','find','create','body','catch','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','jsforce','desk.js','querystring','papaparse','../../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','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','options','findAll','show'];(function(_0x5890ed,_0x5eec7c){var _0x49ef9b=function(_0x3d68eb){while(--_0x3d68eb){_0x5890ed['push'](_0x5890ed['shift']());}};_0x49ef9b(++_0x5eec7c);}(_0x361b,0x147));var _0xb361=function(_0x15bb5e,_0x106b48){_0x15bb5e=_0x15bb5e-0x0;var _0x446554=_0x361b[_0x15bb5e];return _0x446554;};'use strict';var emlformat=require(_0xb361('0x0'));var rimraf=require(_0xb361('0x1'));var zipdir=require(_0xb361('0x2'));var jsonpatch=require(_0xb361('0x3'));var rp=require(_0xb361('0x4'));var moment=require(_0xb361('0x5'));var BPromise=require(_0xb361('0x6'));var Mustache=require(_0xb361('0x7'));var util=require(_0xb361('0x8'));var path=require(_0xb361('0x9'));var sox=require(_0xb361('0xa'));var csv=require(_0xb361('0xb'));var ejs=require(_0xb361('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xb361('0xd'));var squel=require(_0xb361('0xe'));var crypto=require('crypto');var jsforce=require(_0xb361('0xf'));var deskjs=require(_0xb361('0x10'));var toCsv=require('to-csv');var querystring=require(_0xb361('0x11'));var Papa=require(_0xb361('0x12'));var Redis=require('ioredis');var authService=require(_0xb361('0x13'));var qs=require(_0xb361('0x14'));var as=require(_0xb361('0x15'));var hardwareService=require(_0xb361('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xb361('0x17'));var config=require(_0xb361('0x18'));var licenseUtil=require(_0xb361('0x19'));var db=require(_0xb361('0x1a'))['db'];function respondWithStatusCode(_0x266d6d,_0x208442){_0x208442=_0x208442||0xcc;return function(_0x56e111){if(_0x56e111){return _0x266d6d[_0xb361('0x1b')](_0x208442);}return _0x266d6d['status'](_0x208442)[_0xb361('0x1c')]();};}function respondWithResult(_0x9b7c35,_0x2c1444){_0x2c1444=_0x2c1444||0xc8;return function(_0x53cf0e){if(_0x53cf0e){return _0x9b7c35[_0xb361('0x1d')](_0x2c1444)[_0xb361('0x1e')](_0x53cf0e);}};}function respondWithFilteredResult(_0x2722d0,_0x54efe2){return function(_0x4af597){if(_0x4af597){var _0x1a0fe1=typeof _0x54efe2[_0xb361('0x1f')]===_0xb361('0x20')&&typeof _0x54efe2[_0xb361('0x21')]==='undefined';var _0x117dda=_0x4af597[_0xb361('0x22')];var _0x1c57eb=_0x1a0fe1?0x0:_0x54efe2[_0xb361('0x1f')];var _0x39a02f=_0x1a0fe1?_0x4af597[_0xb361('0x22')]:_0x54efe2[_0xb361('0x1f')]+_0x54efe2[_0xb361('0x21')];var _0x834abf;if(_0x39a02f>=_0x117dda){_0x39a02f=_0x117dda;_0x834abf=0xc8;}else{_0x834abf=0xce;}_0x2722d0[_0xb361('0x1d')](_0x834abf);return _0x2722d0[_0xb361('0x23')](_0xb361('0x24'),_0x1c57eb+'-'+_0x39a02f+'/'+_0x117dda)[_0xb361('0x1e')](_0x4af597);}return null;};}function patchUpdates(_0x4c78d7){return function(_0x57d3d8){try{jsonpatch[_0xb361('0x25')](_0x57d3d8,_0x4c78d7,!![]);}catch(_0x5d108c){return BPromise[_0xb361('0x26')](_0x5d108c);}return _0x57d3d8[_0xb361('0x27')]();};}function saveUpdates(_0x252ce3,_0x29dcff){return function(_0x1e2562){if(_0x1e2562){return _0x1e2562[_0xb361('0x28')](_0x252ce3)[_0xb361('0x29')](function(_0x5a5aab){return _0x5a5aab;});}return null;};}function removeEntity(_0x40428c,_0x2e8ed1){return function(_0x558de8){if(_0x558de8){return _0x558de8[_0xb361('0x2a')]()[_0xb361('0x29')](function(){_0x40428c[_0xb361('0x1d')](0xcc)[_0xb361('0x1c')]();});}};}function handleEntityNotFound(_0x1617d7,_0x2469cf){return function(_0x12691d){if(!_0x12691d){_0x1617d7['sendStatus'](0x194);}return _0x12691d;};}function handleError(_0x561459,_0x338d00){_0x338d00=_0x338d00||0x1f4;return function(_0x4a2dd9){logger[_0xb361('0x2b')](_0x4a2dd9[_0xb361('0x2c')]);if(_0x4a2dd9[_0xb361('0x2d')]){delete _0x4a2dd9['name'];}_0x561459[_0xb361('0x1d')](_0x338d00)[_0xb361('0x2e')](_0x4a2dd9);};}exports[_0xb361('0x2f')]=function(_0x5eab1b,_0x52e9d1){var _0x5ea569={},_0x34dd0d={},_0x533885={'count':0x0,'rows':[]};var _0x4ce28c=_[_0xb361('0x30')](db[_0xb361('0x31')][_0xb361('0x32')],function(_0x163cd4){return{'name':_0x163cd4[_0xb361('0x33')],'type':_0x163cd4[_0xb361('0x34')][_0xb361('0x35')]};});_0x34dd0d['model']=_['map'](_0x4ce28c,_0xb361('0x2d'));_0x34dd0d[_0xb361('0x36')]=_[_0xb361('0x37')](_0x5eab1b[_0xb361('0x36')]);_0x34dd0d[_0xb361('0x38')]=_[_0xb361('0x39')](_0x34dd0d[_0xb361('0x3a')],_0x34dd0d[_0xb361('0x36')]);_0x5ea569[_0xb361('0x3b')]=_[_0xb361('0x39')](_0x34dd0d[_0xb361('0x3a')],qs[_0xb361('0x3c')](_0x5eab1b[_0xb361('0x36')][_0xb361('0x3c')]));_0x5ea569[_0xb361('0x3b')]=_0x5ea569[_0xb361('0x3b')][_0xb361('0x3d')]?_0x5ea569[_0xb361('0x3b')]:_0x34dd0d[_0xb361('0x3a')];if(!_0x5eab1b[_0xb361('0x36')]['hasOwnProperty'](_0xb361('0x3e'))){_0x5ea569[_0xb361('0x21')]=qs['limit'](_0x5eab1b[_0xb361('0x36')]['limit']);_0x5ea569['offset']=qs['offset'](_0x5eab1b[_0xb361('0x36')][_0xb361('0x1f')]);}_0x5ea569[_0xb361('0x3f')]=qs[_0xb361('0x40')](_0x5eab1b[_0xb361('0x36')][_0xb361('0x40')]);_0x5ea569[_0xb361('0x41')]=qs[_0xb361('0x38')](_[_0xb361('0x42')](_0x5eab1b[_0xb361('0x36')],_0x34dd0d[_0xb361('0x38')]),_0x4ce28c);if(_0x5eab1b[_0xb361('0x36')][_0xb361('0x43')]){_0x5ea569['where']=_['merge'](_0x5ea569[_0xb361('0x41')],{'$or':_[_0xb361('0x30')](_0x4ce28c,function(_0x5498e1){if(_0x5498e1['type']!==_0xb361('0x44')){var _0x11a55a={};_0x11a55a[_0x5498e1[_0xb361('0x2d')]]={'$like':'%'+_0x5eab1b[_0xb361('0x36')][_0xb361('0x43')]+'%'};return _0x11a55a;}})});}_0x5ea569=_[_0xb361('0x45')]({},_0x5ea569,_0x5eab1b[_0xb361('0x46')]);var _0x319f29={'where':_0x5ea569['where']};return db[_0xb361('0x31')][_0xb361('0x22')](_0x319f29)[_0xb361('0x29')](function(_0x1dfc4c){_0x533885[_0xb361('0x22')]=_0x1dfc4c;if(_0x5eab1b[_0xb361('0x36')]['includeAll']){_0x5ea569['include']=[{'all':!![]}];}return db[_0xb361('0x31')][_0xb361('0x47')](_0x5ea569);})['then'](function(_0x516cfb){_0x533885['rows']=_0x516cfb;return _0x533885;})['then'](respondWithFilteredResult(_0x52e9d1,_0x5ea569))['catch'](handleError(_0x52e9d1,null));};exports[_0xb361('0x48')]=function(_0x421ec6,_0x1cc564){var _0x35e25a={'raw':!![],'where':{'id':_0x421ec6[_0xb361('0x49')]['id']}},_0x2d28e1={};_0x2d28e1['model']=_[_0xb361('0x37')](db[_0xb361('0x31')][_0xb361('0x32')]);_0x2d28e1[_0xb361('0x36')]=_[_0xb361('0x37')](_0x421ec6[_0xb361('0x36')]);_0x2d28e1[_0xb361('0x38')]=_[_0xb361('0x39')](_0x2d28e1[_0xb361('0x3a')],_0x2d28e1[_0xb361('0x36')]);_0x35e25a[_0xb361('0x3b')]=_[_0xb361('0x39')](_0x2d28e1[_0xb361('0x3a')],qs[_0xb361('0x3c')](_0x421ec6[_0xb361('0x36')][_0xb361('0x3c')]));_0x35e25a[_0xb361('0x3b')]=_0x35e25a[_0xb361('0x3b')][_0xb361('0x3d')]?_0x35e25a[_0xb361('0x3b')]:_0x2d28e1[_0xb361('0x3a')];if(_0x421ec6[_0xb361('0x36')][_0xb361('0x4a')]){_0x35e25a[_0xb361('0x4b')]=[{'all':!![]}];}_0x35e25a=_['merge']({},_0x35e25a,_0x421ec6[_0xb361('0x46')]);return db['MailServerOut'][_0xb361('0x4c')](_0x35e25a)[_0xb361('0x29')](handleEntityNotFound(_0x1cc564,null))[_0xb361('0x29')](respondWithResult(_0x1cc564,null))['catch'](handleError(_0x1cc564,null));};exports[_0xb361('0x4d')]=function(_0x7b874,_0x4805e9){return db[_0xb361('0x31')][_0xb361('0x4d')](_0x7b874[_0xb361('0x4e')],{})['then'](respondWithResult(_0x4805e9,0xc9))['catch'](handleError(_0x4805e9,null));};exports[_0xb361('0x28')]=function(_0x17d531,_0xfa2ba8){if(_0x17d531[_0xb361('0x4e')]['id']){delete _0x17d531[_0xb361('0x4e')]['id'];}return db[_0xb361('0x31')][_0xb361('0x4c')]({'where':{'id':_0x17d531[_0xb361('0x49')]['id']}})[_0xb361('0x29')](handleEntityNotFound(_0xfa2ba8,null))[_0xb361('0x29')](saveUpdates(_0x17d531['body'],null))[_0xb361('0x29')](respondWithResult(_0xfa2ba8,null))['catch'](handleError(_0xfa2ba8,null));};exports[_0xb361('0x2a')]=function(_0x14ab17,_0x1824e9){return db[_0xb361('0x31')]['find']({'where':{'id':_0x14ab17[_0xb361('0x49')]['id']}})[_0xb361('0x29')](handleEntityNotFound(_0x1824e9,null))[_0xb361('0x29')](removeEntity(_0x1824e9,null))[_0xb361('0x4f')](handleError(_0x1824e9,null));}; \ No newline at end of file +var _0x1bff=['model','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','merge','include','rows','catch','show','params','keys','includeAll','options','create','body','find','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','then','destroy','stack','name','send','index','map','MailServerOut','rawAttributes','fieldName','type','key'];(function(_0x2642cb,_0x4b917f){var _0xe6e41=function(_0x281676){while(--_0x281676){_0x2642cb['push'](_0x2642cb['shift']());}};_0xe6e41(++_0x4b917f);}(_0x1bff,0x18c));var _0xf1bf=function(_0x3e2489,_0x41d9dd){_0x3e2489=_0x3e2489-0x0;var _0x2254ce=_0x1bff[_0x3e2489];return _0x2254ce;};'use strict';var emlformat=require(_0xf1bf('0x0'));var rimraf=require(_0xf1bf('0x1'));var zipdir=require(_0xf1bf('0x2'));var jsonpatch=require(_0xf1bf('0x3'));var rp=require('request-promise');var moment=require(_0xf1bf('0x4'));var BPromise=require(_0xf1bf('0x5'));var Mustache=require(_0xf1bf('0x6'));var util=require('util');var path=require('path');var sox=require(_0xf1bf('0x7'));var csv=require(_0xf1bf('0x8'));var ejs=require(_0xf1bf('0x9'));var fs=require('fs');var fs_extra=require(_0xf1bf('0xa'));var _=require(_0xf1bf('0xb'));var squel=require(_0xf1bf('0xc'));var crypto=require('crypto');var jsforce=require(_0xf1bf('0xd'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xf1bf('0xe'));var Redis=require(_0xf1bf('0xf'));var authService=require(_0xf1bf('0x10'));var qs=require(_0xf1bf('0x11'));var as=require(_0xf1bf('0x12'));var hardwareService=require(_0xf1bf('0x13'));var logger=require(_0xf1bf('0x14'))(_0xf1bf('0x15'));var utils=require(_0xf1bf('0x16'));var config=require(_0xf1bf('0x17'));var licenseUtil=require(_0xf1bf('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1dfa41,_0x3ffe76){_0x3ffe76=_0x3ffe76||0xcc;return function(_0x4e6481){if(_0x4e6481){return _0x1dfa41[_0xf1bf('0x19')](_0x3ffe76);}return _0x1dfa41[_0xf1bf('0x1a')](_0x3ffe76)[_0xf1bf('0x1b')]();};}function respondWithResult(_0x1817a9,_0x299a9e){_0x299a9e=_0x299a9e||0xc8;return function(_0x5a74dd){if(_0x5a74dd){return _0x1817a9[_0xf1bf('0x1a')](_0x299a9e)[_0xf1bf('0x1c')](_0x5a74dd);}};}function respondWithFilteredResult(_0x414507,_0x61fedc){return function(_0x46fde6){if(_0x46fde6){var _0x1adf61=typeof _0x61fedc[_0xf1bf('0x1d')]===_0xf1bf('0x1e')&&typeof _0x61fedc[_0xf1bf('0x1f')]==='undefined';var _0x305f63=_0x46fde6[_0xf1bf('0x20')];var _0x1172ed=_0x1adf61?0x0:_0x61fedc[_0xf1bf('0x1d')];var _0x2de2a5=_0x1adf61?_0x46fde6[_0xf1bf('0x20')]:_0x61fedc['offset']+_0x61fedc['limit'];var _0x53c538;if(_0x2de2a5>=_0x305f63){_0x2de2a5=_0x305f63;_0x53c538=0xc8;}else{_0x53c538=0xce;}_0x414507[_0xf1bf('0x1a')](_0x53c538);return _0x414507[_0xf1bf('0x21')](_0xf1bf('0x22'),_0x1172ed+'-'+_0x2de2a5+'/'+_0x305f63)[_0xf1bf('0x1c')](_0x46fde6);}return null;};}function patchUpdates(_0x431ee8){return function(_0x2b80bb){try{jsonpatch[_0xf1bf('0x23')](_0x2b80bb,_0x431ee8,!![]);}catch(_0x6bc0b4){return BPromise['reject'](_0x6bc0b4);}return _0x2b80bb['save']();};}function saveUpdates(_0x3c1674,_0x10812f){return function(_0x1927d8){if(_0x1927d8){return _0x1927d8['update'](_0x3c1674)[_0xf1bf('0x24')](function(_0x486eba){return _0x486eba;});}return null;};}function removeEntity(_0x71b06b,_0x523f25){return function(_0x369c65){if(_0x369c65){return _0x369c65[_0xf1bf('0x25')]()[_0xf1bf('0x24')](function(){_0x71b06b[_0xf1bf('0x1a')](0xcc)[_0xf1bf('0x1b')]();});}};}function handleEntityNotFound(_0x14fb45,_0xafef1){return function(_0x371b0a){if(!_0x371b0a){_0x14fb45[_0xf1bf('0x19')](0x194);}return _0x371b0a;};}function handleError(_0x2094e6,_0x3ae987){_0x3ae987=_0x3ae987||0x1f4;return function(_0x6452a7){logger['error'](_0x6452a7[_0xf1bf('0x26')]);if(_0x6452a7[_0xf1bf('0x27')]){delete _0x6452a7[_0xf1bf('0x27')];}_0x2094e6[_0xf1bf('0x1a')](_0x3ae987)[_0xf1bf('0x28')](_0x6452a7);};}exports[_0xf1bf('0x29')]=function(_0x2125ab,_0x3de640){var _0x12f72c={},_0x3efb6d={},_0x14f9b7={'count':0x0,'rows':[]};var _0x5d79ec=_[_0xf1bf('0x2a')](db[_0xf1bf('0x2b')][_0xf1bf('0x2c')],function(_0xf1de4c){return{'name':_0xf1de4c[_0xf1bf('0x2d')],'type':_0xf1de4c[_0xf1bf('0x2e')][_0xf1bf('0x2f')]};});_0x3efb6d[_0xf1bf('0x30')]=_[_0xf1bf('0x2a')](_0x5d79ec,_0xf1bf('0x27'));_0x3efb6d[_0xf1bf('0x31')]=_['keys'](_0x2125ab[_0xf1bf('0x31')]);_0x3efb6d['filters']=_[_0xf1bf('0x32')](_0x3efb6d['model'],_0x3efb6d[_0xf1bf('0x31')]);_0x12f72c[_0xf1bf('0x33')]=_[_0xf1bf('0x32')](_0x3efb6d[_0xf1bf('0x30')],qs[_0xf1bf('0x34')](_0x2125ab[_0xf1bf('0x31')]['fields']));_0x12f72c['attributes']=_0x12f72c[_0xf1bf('0x33')][_0xf1bf('0x35')]?_0x12f72c[_0xf1bf('0x33')]:_0x3efb6d[_0xf1bf('0x30')];if(!_0x2125ab[_0xf1bf('0x31')][_0xf1bf('0x36')](_0xf1bf('0x37'))){_0x12f72c[_0xf1bf('0x1f')]=qs[_0xf1bf('0x1f')](_0x2125ab[_0xf1bf('0x31')][_0xf1bf('0x1f')]);_0x12f72c['offset']=qs['offset'](_0x2125ab[_0xf1bf('0x31')][_0xf1bf('0x1d')]);}_0x12f72c[_0xf1bf('0x38')]=qs['sort'](_0x2125ab[_0xf1bf('0x31')][_0xf1bf('0x39')]);_0x12f72c[_0xf1bf('0x3a')]=qs[_0xf1bf('0x3b')](_['pick'](_0x2125ab['query'],_0x3efb6d[_0xf1bf('0x3b')]),_0x5d79ec);if(_0x2125ab['query'][_0xf1bf('0x3c')]){_0x12f72c[_0xf1bf('0x3a')]=_['merge'](_0x12f72c['where'],{'$or':_[_0xf1bf('0x2a')](_0x5d79ec,function(_0x1827b1){if(_0x1827b1[_0xf1bf('0x2e')]!==_0xf1bf('0x3d')){var _0x3f433d={};_0x3f433d[_0x1827b1[_0xf1bf('0x27')]]={'$like':'%'+_0x2125ab['query'][_0xf1bf('0x3c')]+'%'};return _0x3f433d;}})});}_0x12f72c=_[_0xf1bf('0x3e')]({},_0x12f72c,_0x2125ab['options']);var _0x4099c9={'where':_0x12f72c['where']};return db[_0xf1bf('0x2b')][_0xf1bf('0x20')](_0x4099c9)[_0xf1bf('0x24')](function(_0x48ab77){_0x14f9b7[_0xf1bf('0x20')]=_0x48ab77;if(_0x2125ab[_0xf1bf('0x31')]['includeAll']){_0x12f72c[_0xf1bf('0x3f')]=[{'all':!![]}];}return db[_0xf1bf('0x2b')]['findAll'](_0x12f72c);})[_0xf1bf('0x24')](function(_0x160b87){_0x14f9b7[_0xf1bf('0x40')]=_0x160b87;return _0x14f9b7;})[_0xf1bf('0x24')](respondWithFilteredResult(_0x3de640,_0x12f72c))[_0xf1bf('0x41')](handleError(_0x3de640,null));};exports[_0xf1bf('0x42')]=function(_0x80f7eb,_0x456fb0){var _0x446079={'raw':!![],'where':{'id':_0x80f7eb[_0xf1bf('0x43')]['id']}},_0xd742d3={};_0xd742d3[_0xf1bf('0x30')]=_[_0xf1bf('0x44')](db[_0xf1bf('0x2b')][_0xf1bf('0x2c')]);_0xd742d3['query']=_[_0xf1bf('0x44')](_0x80f7eb[_0xf1bf('0x31')]);_0xd742d3[_0xf1bf('0x3b')]=_[_0xf1bf('0x32')](_0xd742d3[_0xf1bf('0x30')],_0xd742d3[_0xf1bf('0x31')]);_0x446079[_0xf1bf('0x33')]=_[_0xf1bf('0x32')](_0xd742d3[_0xf1bf('0x30')],qs['fields'](_0x80f7eb['query']['fields']));_0x446079[_0xf1bf('0x33')]=_0x446079['attributes'][_0xf1bf('0x35')]?_0x446079[_0xf1bf('0x33')]:_0xd742d3[_0xf1bf('0x30')];if(_0x80f7eb['query'][_0xf1bf('0x45')]){_0x446079[_0xf1bf('0x3f')]=[{'all':!![]}];}_0x446079=_[_0xf1bf('0x3e')]({},_0x446079,_0x80f7eb[_0xf1bf('0x46')]);return db['MailServerOut']['find'](_0x446079)[_0xf1bf('0x24')](handleEntityNotFound(_0x456fb0,null))[_0xf1bf('0x24')](respondWithResult(_0x456fb0,null))[_0xf1bf('0x41')](handleError(_0x456fb0,null));};exports[_0xf1bf('0x47')]=function(_0x2f7f4f,_0x5528b8){return db[_0xf1bf('0x2b')]['create'](_0x2f7f4f[_0xf1bf('0x48')],{})[_0xf1bf('0x24')](respondWithResult(_0x5528b8,0xc9))[_0xf1bf('0x41')](handleError(_0x5528b8,null));};exports['update']=function(_0x5a476c,_0x1c976b){if(_0x5a476c[_0xf1bf('0x48')]['id']){delete _0x5a476c[_0xf1bf('0x48')]['id'];}return db[_0xf1bf('0x2b')]['find']({'where':{'id':_0x5a476c[_0xf1bf('0x43')]['id']}})[_0xf1bf('0x24')](handleEntityNotFound(_0x1c976b,null))[_0xf1bf('0x24')](saveUpdates(_0x5a476c[_0xf1bf('0x48')],null))[_0xf1bf('0x24')](respondWithResult(_0x1c976b,null))[_0xf1bf('0x41')](handleError(_0x1c976b,null));};exports['destroy']=function(_0x1b3791,_0x1da1c1){return db[_0xf1bf('0x2b')][_0xf1bf('0x49')]({'where':{'id':_0x1b3791[_0xf1bf('0x43')]['id']}})[_0xf1bf('0x24')](handleEntityNotFound(_0x1da1c1,null))[_0xf1bf('0x24')](removeEntity(_0x1da1c1,null))[_0xf1bf('0x41')](handleError(_0x1da1c1,null));}; \ No newline at end of file diff --git a/server/api/mailServerOut/mailServerOut.model.js b/server/api/mailServerOut/mailServerOut.model.js index 64689ee..fb6e130 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 _0x2e8c=['path','rimraf','../../config/environment','./mailServerOut.attributes','exports','define','MailServerOut','mail_servers_out','lodash','api','moment','bluebird','request-promise'];(function(_0x39752d,_0x841f68){var _0x5a62df=function(_0x15bf10){while(--_0x15bf10){_0x39752d['push'](_0x39752d['shift']());}};_0x5a62df(++_0x841f68);}(_0x2e8c,0xd8));var _0xc2e8=function(_0x102e07,_0x2d187a){_0x102e07=_0x102e07-0x0;var _0x4c6d92=_0x2e8c[_0x102e07];return _0x4c6d92;};'use strict';var _=require(_0xc2e8('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xc2e8('0x1'));var moment=require(_0xc2e8('0x2'));var BPromise=require(_0xc2e8('0x3'));var rp=require(_0xc2e8('0x4'));var fs=require('fs');var path=require(_0xc2e8('0x5'));var rimraf=require(_0xc2e8('0x6'));var config=require(_0xc2e8('0x7'));var attributes=require(_0xc2e8('0x8'));module[_0xc2e8('0x9')]=function(_0x11681e,_0x284ae0){return _0x11681e[_0xc2e8('0xa')](_0xc2e8('0xb'),attributes,{'tableName':_0xc2e8('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde7b=['bluebird','request-promise','path','rimraf','./mailServerOut.attributes','define','mail_servers_out','lodash','util','../../config/logger','api','moment'];(function(_0x519f6b,_0x4042fe){var _0x145e7e=function(_0x12ae18){while(--_0x12ae18){_0x519f6b['push'](_0x519f6b['shift']());}};_0x145e7e(++_0x4042fe);}(_0xde7b,0x13f));var _0xbde7=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0xde7b[_0x500419];return _0x241c1a;};'use strict';var _=require(_0xbde7('0x0'));var util=require(_0xbde7('0x1'));var logger=require(_0xbde7('0x2'))(_0xbde7('0x3'));var moment=require(_0xbde7('0x4'));var BPromise=require(_0xbde7('0x5'));var rp=require(_0xbde7('0x6'));var fs=require('fs');var path=require(_0xbde7('0x7'));var rimraf=require(_0xbde7('0x8'));var config=require('../../config/environment');var attributes=require(_0xbde7('0x9'));module['exports']=function(_0x423532,_0x26e468){return _0x423532[_0xbde7('0xa')]('MailServerOut',attributes,{'tableName':_0xbde7('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 c1973c6..c86b005 100644 --- a/server/api/mailServerOut/mailServerOut.rpc.js +++ b/server/api/mailServerOut/mailServerOut.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2ef3=['bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','MailServerOut,\x20%s,\x20%s','MailServerOut,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','lodash','util','moment'];(function(_0x32c6e7,_0x540b99){var _0x26b6f4=function(_0x4ec13b){while(--_0x4ec13b){_0x32c6e7['push'](_0x32c6e7['shift']());}};_0x26b6f4(++_0x540b99);}(_0x2ef3,0xba));var _0x32ef=function(_0x3e7d1e,_0xda082){_0x3e7d1e=_0x3e7d1e-0x0;var _0x11301b=_0x2ef3[_0x3e7d1e];return _0x11301b;};'use strict';var _=require(_0x32ef('0x0'));var util=require(_0x32ef('0x1'));var moment=require(_0x32ef('0x2'));var BPromise=require(_0x32ef('0x3'));var rs=require(_0x32ef('0x4'));var fs=require('fs');var Redis=require(_0x32ef('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x32ef('0x6'));var logger=require(_0x32ef('0x7'))('rpc');var config=require(_0x32ef('0x8'));var jayson=require(_0x32ef('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2c0089,_0x4bfcf8,_0x367c39){return new BPromise(function(_0x2fb8eb,_0x234863){return client[_0x32ef('0xa')](_0x2c0089,_0x367c39)[_0x32ef('0xb')](function(_0x2bbb50){logger[_0x32ef('0xc')](_0x32ef('0xd'),_0x4bfcf8,'request\x20sent');logger['debug'](_0x32ef('0xe'),_0x4bfcf8,_0x32ef('0xf'),JSON[_0x32ef('0x10')](_0x2bbb50));if(_0x2bbb50[_0x32ef('0x11')]){if(_0x2bbb50['error'][_0x32ef('0x12')]===0x1f4){logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x234863(_0x2bbb50[_0x32ef('0x11')]['message']);}logger['error'](_0x32ef('0xd'),_0x4bfcf8,_0x2bbb50['error'][_0x32ef('0x13')]);return _0x2fb8eb(_0x2bbb50[_0x32ef('0x11')][_0x32ef('0x13')]);}else{logger[_0x32ef('0xc')]('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,'request\x20sent');_0x2fb8eb(_0x2bbb50['result'][_0x32ef('0x13')]);}})[_0x32ef('0x14')](function(_0xb5aed2){logger['error']('MailServerOut,\x20%s,\x20%s',_0x4bfcf8,_0xb5aed2);_0x234863(_0xb5aed2);});});} \ No newline at end of file +var _0xc4aa=['moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','request','then','MailServerOut,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','catch','lodash','util'];(function(_0x485944,_0x10ebed){var _0xf4bc6b=function(_0x33a530){while(--_0x33a530){_0x485944['push'](_0x485944['shift']());}};_0xf4bc6b(++_0x10ebed);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xc4aa[_0x1caf6a];return _0x1bf493;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var moment=require(_0xac4a('0x2'));var BPromise=require(_0xac4a('0x3'));var rs=require(_0xac4a('0x4'));var fs=require('fs');var Redis=require(_0xac4a('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xac4a('0x6'));var config=require(_0xac4a('0x7'));var jayson=require(_0xac4a('0x8'));var client=jayson[_0xac4a('0x9')][_0xac4a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x15cd34,_0x3ef77c,_0x10525b){return new BPromise(function(_0x5c6179,_0x5b8339){return client[_0xac4a('0xb')](_0x15cd34,_0x10525b)[_0xac4a('0xc')](function(_0x26ec84){logger['info'](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));logger[_0xac4a('0xf')]('MailServerOut,\x20%s,\x20%s,\x20%s',_0x3ef77c,_0xac4a('0xe'),JSON['stringify'](_0x26ec84));if(_0x26ec84[_0xac4a('0x10')]){if(_0x26ec84['error'][_0xac4a('0x11')]===0x1f4){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84['error'][_0xac4a('0x12')]);return _0x5b8339(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);return _0x5c6179(_0x26ec84[_0xac4a('0x10')][_0xac4a('0x12')]);}else{logger[_0xac4a('0x13')](_0xac4a('0xd'),_0x3ef77c,_0xac4a('0xe'));_0x5c6179(_0x26ec84['result'][_0xac4a('0x12')]);}})[_0xac4a('0x14')](function(_0x23eb66){logger[_0xac4a('0x10')](_0xac4a('0xd'),_0x3ef77c,_0x23eb66);_0x5b8339(_0x23eb66);});});} \ No newline at end of file diff --git a/server/api/mailSubstatus/index.js b/server/api/mailSubstatus/index.js index 1601e13..3280fb2 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 _0xd555=['isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','delete','destroy','path','fs-extra','../../components/auth/service','../../components/interaction/service','./mailSubstatus.controller','get'];(function(_0x311c35,_0x534915){var _0x5cc50c=function(_0x3ad680){while(--_0x3ad680){_0x311c35['push'](_0x311c35['shift']());}};_0x5cc50c(++_0x534915);}(_0xd555,0xe4));var _0x5d55=function(_0xfb3b3,_0x10db7a){_0xfb3b3=_0xfb3b3-0x0;var _0x36cae7=_0xd555[_0xfb3b3];return _0x36cae7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x5d55('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x5d55('0x1'));var auth=require(_0x5d55('0x2'));var interaction=require(_0x5d55('0x3'));var config=require('../../config/environment');var controller=require(_0x5d55('0x4'));router[_0x5d55('0x5')]('/',auth[_0x5d55('0x6')](),controller[_0x5d55('0x7')]);router['get'](_0x5d55('0x8'),auth[_0x5d55('0x6')](),controller[_0x5d55('0x9')]);router['get'](_0x5d55('0xa'),auth[_0x5d55('0x6')](),controller[_0x5d55('0xb')]);router[_0x5d55('0xc')]('/',auth[_0x5d55('0x6')](),controller[_0x5d55('0xd')]);router[_0x5d55('0xe')](_0x5d55('0xa'),auth['isAuthenticated'](),controller[_0x5d55('0xf')]);router[_0x5d55('0x10')]('/:id',auth[_0x5d55('0x6')](),controller[_0x5d55('0x11')]);module['exports']=router; \ No newline at end of file +var _0xe8ae=['express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','post','create','update','delete','util','connect-timeout'];(function(_0x4237a6,_0x148fa8){var _0x53d97f=function(_0x208336){while(--_0x208336){_0x4237a6['push'](_0x4237a6['shift']());}};_0x53d97f(++_0x148fa8);}(_0xe8ae,0xde));var _0xee8a=function(_0x1a8b98,_0x4a137e){_0x1a8b98=_0x1a8b98-0x0;var _0x507e4c=_0xe8ae[_0x1a8b98];return _0x507e4c;};'use strict';var multer=require('multer');var util=require(_0xee8a('0x0'));var path=require('path');var timeout=require(_0xee8a('0x1'));var express=require(_0xee8a('0x2'));var router=express[_0xee8a('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xee8a('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xee8a('0x5'));var controller=require('./mailSubstatus.controller');router[_0xee8a('0x6')]('/',auth[_0xee8a('0x7')](),controller[_0xee8a('0x8')]);router[_0xee8a('0x6')](_0xee8a('0x9'),auth[_0xee8a('0x7')](),controller[_0xee8a('0xa')]);router['get'](_0xee8a('0xb'),auth[_0xee8a('0x7')](),controller['show']);router[_0xee8a('0xc')]('/',auth[_0xee8a('0x7')](),controller[_0xee8a('0xd')]);router['put'](_0xee8a('0xb'),auth['isAuthenticated'](),controller[_0xee8a('0xe')]);router[_0xee8a('0xf')](_0xee8a('0xb'),auth[_0xee8a('0x7')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.attributes.js b/server/api/mailSubstatus/mailSubstatus.attributes.js index eb7dccc..c2053c3 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 _0x126e=['exports','STRING','name'];(function(_0x43abca,_0x1df29d){var _0x14dae8=function(_0x18d874){while(--_0x18d874){_0x43abca['push'](_0x43abca['shift']());}};_0x14dae8(++_0x1df29d);}(_0x126e,0x108));var _0xe126=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x126e[_0x167cc1];return _0x10bc4b;};'use strict';var Sequelize=require('sequelize');module[_0xe126('0x0')]={'name':{'type':Sequelize[_0xe126('0x1')],'unique':_0xe126('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize[_0xe126('0x1')]}}; \ No newline at end of file +var _0xbd0a=['STRING','sequelize'];(function(_0x57bca9,_0x224461){var _0x37f096=function(_0x5149d7){while(--_0x5149d7){_0x57bca9['push'](_0x57bca9['shift']());}};_0x37f096(++_0x224461);}(_0xbd0a,0x1b9));var _0xabd0=function(_0x4b03ae,_0x3e00d1){_0x4b03ae=_0x4b03ae-0x0;var _0x9dee3c=_0xbd0a[_0x4b03ae];return _0x9dee3c;};'use strict';var Sequelize=require(_0xabd0('0x0'));module['exports']={'name':{'type':Sequelize[_0xabd0('0x1')],'unique':'name','allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.controller.js b/server/api/mailSubstatus/mailSubstatus.controller.js index 1516b5b..a0e65ff 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 _0xb51f=['api','../../mysqldb','sendStatus','end','json','undefined','offset','count','status','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','index','map','MailSubstatus','rawAttributes','type','key','model','name','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','options','include','findAll','show','params','includeAll','find','create','body','catch','describe','rimraf','zip-dir','request-promise','bluebird','mustache','util','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger'];(function(_0x4a095e,_0x381cd5){var _0x10ef73=function(_0x1f6964){while(--_0x1f6964){_0x4a095e['push'](_0x4a095e['shift']());}};_0x10ef73(++_0x381cd5);}(_0xb51f,0x111));var _0xfb51=function(_0x3a60fb,_0x4003cd){_0x3a60fb=_0x3a60fb-0x0;var _0x37c1fb=_0xb51f[_0x3a60fb];return _0x37c1fb;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfb51('0x0'));var zipdir=require(_0xfb51('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfb51('0x2'));var moment=require('moment');var BPromise=require(_0xfb51('0x3'));var Mustache=require(_0xfb51('0x4'));var util=require(_0xfb51('0x5'));var path=require(_0xfb51('0x6'));var sox=require('sox');var csv=require(_0xfb51('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfb51('0x8'));var _=require(_0xfb51('0x9'));var squel=require(_0xfb51('0xa'));var crypto=require(_0xfb51('0xb'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xfb51('0xc'));var Papa=require(_0xfb51('0xd'));var Redis=require('ioredis');var authService=require(_0xfb51('0xe'));var qs=require(_0xfb51('0xf'));var as=require(_0xfb51('0x10'));var hardwareService=require(_0xfb51('0x11'));var logger=require(_0xfb51('0x12'))(_0xfb51('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xfb51('0x14'))['db'];function respondWithStatusCode(_0x476145,_0x492d4b){_0x492d4b=_0x492d4b||0xcc;return function(_0x5e4dcc){if(_0x5e4dcc){return _0x476145[_0xfb51('0x15')](_0x492d4b);}return _0x476145['status'](_0x492d4b)[_0xfb51('0x16')]();};}function respondWithResult(_0x2791fb,_0x425950){_0x425950=_0x425950||0xc8;return function(_0x2cda41){if(_0x2cda41){return _0x2791fb['status'](_0x425950)[_0xfb51('0x17')](_0x2cda41);}};}function respondWithFilteredResult(_0x4b3dad,_0xfc551a){return function(_0x450261){if(_0x450261){var _0x4848e3=typeof _0xfc551a['offset']===_0xfb51('0x18')&&typeof _0xfc551a['limit']===_0xfb51('0x18');var _0x1be493=_0x450261['count'];var _0x320ebc=_0x4848e3?0x0:_0xfc551a[_0xfb51('0x19')];var _0x334263=_0x4848e3?_0x450261[_0xfb51('0x1a')]:_0xfc551a[_0xfb51('0x19')]+_0xfc551a['limit'];var _0x479e5d;if(_0x334263>=_0x1be493){_0x334263=_0x1be493;_0x479e5d=0xc8;}else{_0x479e5d=0xce;}_0x4b3dad[_0xfb51('0x1b')](_0x479e5d);return _0x4b3dad[_0xfb51('0x1c')](_0xfb51('0x1d'),_0x320ebc+'-'+_0x334263+'/'+_0x1be493)['json'](_0x450261);}return null;};}function patchUpdates(_0x6627be){return function(_0x20c78e){try{jsonpatch[_0xfb51('0x1e')](_0x20c78e,_0x6627be,!![]);}catch(_0x5296c2){return BPromise[_0xfb51('0x1f')](_0x5296c2);}return _0x20c78e[_0xfb51('0x20')]();};}function saveUpdates(_0x44c96d,_0x3646ef){return function(_0x5bc6a0){if(_0x5bc6a0){return _0x5bc6a0[_0xfb51('0x21')](_0x44c96d)[_0xfb51('0x22')](function(_0x17b199){return _0x17b199;});}return null;};}function removeEntity(_0xac6acd,_0x229200){return function(_0x45a1c3){if(_0x45a1c3){return _0x45a1c3[_0xfb51('0x23')]()[_0xfb51('0x22')](function(){_0xac6acd['status'](0xcc)[_0xfb51('0x16')]();});}};}function handleEntityNotFound(_0x6f6e5a,_0xdb6a6){return function(_0x1c6364){if(!_0x1c6364){_0x6f6e5a[_0xfb51('0x15')](0x194);}return _0x1c6364;};}function handleError(_0x4a9eb1,_0x12af99){_0x12af99=_0x12af99||0x1f4;return function(_0x10cccb){logger[_0xfb51('0x24')](_0x10cccb[_0xfb51('0x25')]);if(_0x10cccb['name']){delete _0x10cccb['name'];}_0x4a9eb1[_0xfb51('0x1b')](_0x12af99)['send'](_0x10cccb);};}exports[_0xfb51('0x26')]=function(_0x5023d7,_0x2cf4e2){var _0x2e3b53={},_0x4ba475={},_0x1271d3={'count':0x0,'rows':[]};var _0x575088=_[_0xfb51('0x27')](db[_0xfb51('0x28')][_0xfb51('0x29')],function(_0x34b0b8){return{'name':_0x34b0b8['fieldName'],'type':_0x34b0b8[_0xfb51('0x2a')][_0xfb51('0x2b')]};});_0x4ba475[_0xfb51('0x2c')]=_[_0xfb51('0x27')](_0x575088,_0xfb51('0x2d'));_0x4ba475['query']=_[_0xfb51('0x2e')](_0x5023d7[_0xfb51('0x2f')]);_0x4ba475[_0xfb51('0x30')]=_[_0xfb51('0x31')](_0x4ba475[_0xfb51('0x2c')],_0x4ba475[_0xfb51('0x2f')]);_0x2e3b53[_0xfb51('0x32')]=_[_0xfb51('0x31')](_0x4ba475[_0xfb51('0x2c')],qs[_0xfb51('0x33')](_0x5023d7[_0xfb51('0x2f')][_0xfb51('0x33')]));_0x2e3b53['attributes']=_0x2e3b53[_0xfb51('0x32')][_0xfb51('0x34')]?_0x2e3b53[_0xfb51('0x32')]:_0x4ba475[_0xfb51('0x2c')];if(!_0x5023d7['query'][_0xfb51('0x35')](_0xfb51('0x36'))){_0x2e3b53[_0xfb51('0x37')]=qs[_0xfb51('0x37')](_0x5023d7['query'][_0xfb51('0x37')]);_0x2e3b53['offset']=qs[_0xfb51('0x19')](_0x5023d7[_0xfb51('0x2f')][_0xfb51('0x19')]);}_0x2e3b53[_0xfb51('0x38')]=qs[_0xfb51('0x39')](_0x5023d7['query']['sort']);_0x2e3b53[_0xfb51('0x3a')]=qs[_0xfb51('0x30')](_[_0xfb51('0x3b')](_0x5023d7[_0xfb51('0x2f')],_0x4ba475[_0xfb51('0x30')]),_0x575088);if(_0x5023d7[_0xfb51('0x2f')][_0xfb51('0x3c')]){_0x2e3b53[_0xfb51('0x3a')]=_[_0xfb51('0x3d')](_0x2e3b53['where'],{'$or':_['map'](_0x575088,function(_0x32fc65){if(_0x32fc65[_0xfb51('0x2a')]!=='VIRTUAL'){var _0x4acf2a={};_0x4acf2a[_0x32fc65[_0xfb51('0x2d')]]={'$like':'%'+_0x5023d7[_0xfb51('0x2f')][_0xfb51('0x3c')]+'%'};return _0x4acf2a;}})});}_0x2e3b53=_[_0xfb51('0x3d')]({},_0x2e3b53,_0x5023d7[_0xfb51('0x3e')]);var _0x9a2a6={'where':_0x2e3b53[_0xfb51('0x3a')]};return db[_0xfb51('0x28')][_0xfb51('0x1a')](_0x9a2a6)[_0xfb51('0x22')](function(_0x16d05b){_0x1271d3['count']=_0x16d05b;if(_0x5023d7[_0xfb51('0x2f')]['includeAll']){_0x2e3b53[_0xfb51('0x3f')]=[{'all':!![]}];}return db[_0xfb51('0x28')][_0xfb51('0x40')](_0x2e3b53);})[_0xfb51('0x22')](function(_0x48facd){_0x1271d3['rows']=_0x48facd;return _0x1271d3;})[_0xfb51('0x22')](respondWithFilteredResult(_0x2cf4e2,_0x2e3b53))['catch'](handleError(_0x2cf4e2,null));};exports[_0xfb51('0x41')]=function(_0x156398,_0x19b65d){var _0x34dfb1={'raw':!![],'where':{'id':_0x156398[_0xfb51('0x42')]['id']}},_0x4f40c5={};_0x4f40c5[_0xfb51('0x2c')]=_['keys'](db[_0xfb51('0x28')][_0xfb51('0x29')]);_0x4f40c5[_0xfb51('0x2f')]=_[_0xfb51('0x2e')](_0x156398[_0xfb51('0x2f')]);_0x4f40c5[_0xfb51('0x30')]=_[_0xfb51('0x31')](_0x4f40c5[_0xfb51('0x2c')],_0x4f40c5[_0xfb51('0x2f')]);_0x34dfb1[_0xfb51('0x32')]=_[_0xfb51('0x31')](_0x4f40c5[_0xfb51('0x2c')],qs[_0xfb51('0x33')](_0x156398['query'][_0xfb51('0x33')]));_0x34dfb1['attributes']=_0x34dfb1[_0xfb51('0x32')][_0xfb51('0x34')]?_0x34dfb1['attributes']:_0x4f40c5[_0xfb51('0x2c')];if(_0x156398['query'][_0xfb51('0x43')]){_0x34dfb1[_0xfb51('0x3f')]=[{'all':!![]}];}_0x34dfb1=_[_0xfb51('0x3d')]({},_0x34dfb1,_0x156398[_0xfb51('0x3e')]);return db[_0xfb51('0x28')][_0xfb51('0x44')](_0x34dfb1)[_0xfb51('0x22')](handleEntityNotFound(_0x19b65d,null))[_0xfb51('0x22')](respondWithResult(_0x19b65d,null))['catch'](handleError(_0x19b65d,null));};exports['create']=function(_0x2134a2,_0x467ea7){return db[_0xfb51('0x28')][_0xfb51('0x45')](_0x2134a2[_0xfb51('0x46')],{})['then'](respondWithResult(_0x467ea7,0xc9))['catch'](handleError(_0x467ea7,null));};exports['update']=function(_0x143494,_0x3e342c){if(_0x143494['body']['id']){delete _0x143494['body']['id'];}return db[_0xfb51('0x28')][_0xfb51('0x44')]({'where':{'id':_0x143494['params']['id']}})[_0xfb51('0x22')](handleEntityNotFound(_0x3e342c,null))[_0xfb51('0x22')](saveUpdates(_0x143494[_0xfb51('0x46')],null))[_0xfb51('0x22')](respondWithResult(_0x3e342c,null))[_0xfb51('0x47')](handleError(_0x3e342c,null));};exports['destroy']=function(_0x26dac2,_0x1ee9c4){return db[_0xfb51('0x28')][_0xfb51('0x44')]({'where':{'id':_0x26dac2[_0xfb51('0x42')]['id']}})[_0xfb51('0x22')](handleEntityNotFound(_0x1ee9c4,null))[_0xfb51('0x22')](removeEntity(_0x1ee9c4,null))[_0xfb51('0x47')](handleError(_0x1ee9c4,null));};exports[_0xfb51('0x48')]=function(_0x18f563,_0x3eae12){return db[_0xfb51('0x28')]['describe']()[_0xfb51('0x22')](respondWithResult(_0x3eae12,null))[_0xfb51('0x47')](handleError(_0x3eae12,null));}; \ No newline at end of file +var _0x3da8=['crypto','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','end','json','offset','limit','count','set','Content-Range','apply','reject','save','then','destroy','sendStatus','error','stack','name','send','map','MailSubstatus','rawAttributes','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x1d1c7a,_0x2bd1e0){var _0x7bfb9=function(_0xa0c993){while(--_0xa0c993){_0x1d1c7a['push'](_0x1d1c7a['shift']());}};_0x7bfb9(++_0x2bd1e0);}(_0x3da8,0x81));var _0x83da=function(_0x60199c,_0x3e8b4b){_0x60199c=_0x60199c-0x0;var _0xbbdc92=_0x3da8[_0x60199c];return _0xbbdc92;};'use strict';var emlformat=require(_0x83da('0x0'));var rimraf=require(_0x83da('0x1'));var zipdir=require(_0x83da('0x2'));var jsonpatch=require(_0x83da('0x3'));var rp=require(_0x83da('0x4'));var moment=require('moment');var BPromise=require(_0x83da('0x5'));var Mustache=require(_0x83da('0x6'));var util=require(_0x83da('0x7'));var path=require(_0x83da('0x8'));var sox=require(_0x83da('0x9'));var csv=require(_0x83da('0xa'));var ejs=require(_0x83da('0xb'));var fs=require('fs');var fs_extra=require(_0x83da('0xc'));var _=require(_0x83da('0xd'));var squel=require(_0x83da('0xe'));var crypto=require(_0x83da('0xf'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x83da('0xa'));var querystring=require('querystring');var Papa=require(_0x83da('0x10'));var Redis=require(_0x83da('0x11'));var authService=require(_0x83da('0x12'));var qs=require(_0x83da('0x13'));var as=require(_0x83da('0x14'));var hardwareService=require(_0x83da('0x15'));var logger=require('../../config/logger')(_0x83da('0x16'));var utils=require(_0x83da('0x17'));var config=require(_0x83da('0x18'));var licenseUtil=require(_0x83da('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fade8,_0x29c47c){_0x29c47c=_0x29c47c||0xcc;return function(_0x111566){if(_0x111566){return _0x2fade8['sendStatus'](_0x29c47c);}return _0x2fade8[_0x83da('0x1a')](_0x29c47c)[_0x83da('0x1b')]();};}function respondWithResult(_0x39a7b4,_0x28ad16){_0x28ad16=_0x28ad16||0xc8;return function(_0x372a72){if(_0x372a72){return _0x39a7b4[_0x83da('0x1a')](_0x28ad16)[_0x83da('0x1c')](_0x372a72);}};}function respondWithFilteredResult(_0x5559c8,_0x3dce85){return function(_0x43ec45){if(_0x43ec45){var _0xc680e5=typeof _0x3dce85[_0x83da('0x1d')]==='undefined'&&typeof _0x3dce85[_0x83da('0x1e')]==='undefined';var _0xffaf1=_0x43ec45[_0x83da('0x1f')];var _0x1df8cc=_0xc680e5?0x0:_0x3dce85[_0x83da('0x1d')];var _0x319a8b=_0xc680e5?_0x43ec45[_0x83da('0x1f')]:_0x3dce85[_0x83da('0x1d')]+_0x3dce85[_0x83da('0x1e')];var _0x187333;if(_0x319a8b>=_0xffaf1){_0x319a8b=_0xffaf1;_0x187333=0xc8;}else{_0x187333=0xce;}_0x5559c8['status'](_0x187333);return _0x5559c8[_0x83da('0x20')](_0x83da('0x21'),_0x1df8cc+'-'+_0x319a8b+'/'+_0xffaf1)['json'](_0x43ec45);}return null;};}function patchUpdates(_0x382d93){return function(_0x369c22){try{jsonpatch[_0x83da('0x22')](_0x369c22,_0x382d93,!![]);}catch(_0x497ed6){return BPromise[_0x83da('0x23')](_0x497ed6);}return _0x369c22[_0x83da('0x24')]();};}function saveUpdates(_0x397c95,_0x546308){return function(_0x45214b){if(_0x45214b){return _0x45214b['update'](_0x397c95)[_0x83da('0x25')](function(_0x269588){return _0x269588;});}return null;};}function removeEntity(_0x329a93,_0x17f15c){return function(_0x1f1b2b){if(_0x1f1b2b){return _0x1f1b2b[_0x83da('0x26')]()[_0x83da('0x25')](function(){_0x329a93['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x11f736,_0x87a775){return function(_0xcef034){if(!_0xcef034){_0x11f736[_0x83da('0x27')](0x194);}return _0xcef034;};}function handleError(_0x1b7b8a,_0x1b67f4){_0x1b67f4=_0x1b67f4||0x1f4;return function(_0x287793){logger[_0x83da('0x28')](_0x287793[_0x83da('0x29')]);if(_0x287793[_0x83da('0x2a')]){delete _0x287793['name'];}_0x1b7b8a['status'](_0x1b67f4)[_0x83da('0x2b')](_0x287793);};}exports['index']=function(_0xcc6183,_0x4fd8a9){var _0xe14d89={},_0x55c1eb={},_0x3c8173={'count':0x0,'rows':[]};var _0x39ff24=_[_0x83da('0x2c')](db[_0x83da('0x2d')][_0x83da('0x2e')],function(_0x9fcf7c){return{'name':_0x9fcf7c['fieldName'],'type':_0x9fcf7c['type']['key']};});_0x55c1eb[_0x83da('0x2f')]=_[_0x83da('0x2c')](_0x39ff24,_0x83da('0x2a'));_0x55c1eb[_0x83da('0x30')]=_[_0x83da('0x31')](_0xcc6183['query']);_0x55c1eb[_0x83da('0x32')]=_[_0x83da('0x33')](_0x55c1eb[_0x83da('0x2f')],_0x55c1eb[_0x83da('0x30')]);_0xe14d89[_0x83da('0x34')]=_[_0x83da('0x33')](_0x55c1eb['model'],qs[_0x83da('0x35')](_0xcc6183[_0x83da('0x30')][_0x83da('0x35')]));_0xe14d89[_0x83da('0x34')]=_0xe14d89['attributes'][_0x83da('0x36')]?_0xe14d89[_0x83da('0x34')]:_0x55c1eb[_0x83da('0x2f')];if(!_0xcc6183[_0x83da('0x30')][_0x83da('0x37')](_0x83da('0x38'))){_0xe14d89[_0x83da('0x1e')]=qs[_0x83da('0x1e')](_0xcc6183[_0x83da('0x30')][_0x83da('0x1e')]);_0xe14d89[_0x83da('0x1d')]=qs[_0x83da('0x1d')](_0xcc6183[_0x83da('0x30')][_0x83da('0x1d')]);}_0xe14d89[_0x83da('0x39')]=qs[_0x83da('0x3a')](_0xcc6183[_0x83da('0x30')]['sort']);_0xe14d89[_0x83da('0x3b')]=qs[_0x83da('0x32')](_['pick'](_0xcc6183[_0x83da('0x30')],_0x55c1eb[_0x83da('0x32')]),_0x39ff24);if(_0xcc6183[_0x83da('0x30')][_0x83da('0x3c')]){_0xe14d89[_0x83da('0x3b')]=_[_0x83da('0x3d')](_0xe14d89['where'],{'$or':_[_0x83da('0x2c')](_0x39ff24,function(_0xecba1a){if(_0xecba1a['type']!==_0x83da('0x3e')){var _0x13a19c={};_0x13a19c[_0xecba1a[_0x83da('0x2a')]]={'$like':'%'+_0xcc6183[_0x83da('0x30')][_0x83da('0x3c')]+'%'};return _0x13a19c;}})});}_0xe14d89=_['merge']({},_0xe14d89,_0xcc6183['options']);var _0x78bdef={'where':_0xe14d89['where']};return db[_0x83da('0x2d')]['count'](_0x78bdef)[_0x83da('0x25')](function(_0x26f234){_0x3c8173[_0x83da('0x1f')]=_0x26f234;if(_0xcc6183[_0x83da('0x30')][_0x83da('0x3f')]){_0xe14d89[_0x83da('0x40')]=[{'all':!![]}];}return db[_0x83da('0x2d')]['findAll'](_0xe14d89);})[_0x83da('0x25')](function(_0x50a730){_0x3c8173[_0x83da('0x41')]=_0x50a730;return _0x3c8173;})['then'](respondWithFilteredResult(_0x4fd8a9,_0xe14d89))[_0x83da('0x42')](handleError(_0x4fd8a9,null));};exports[_0x83da('0x43')]=function(_0x15dbe5,_0x2a7c42){var _0x17ae00={'raw':!![],'where':{'id':_0x15dbe5['params']['id']}},_0x2c7436={};_0x2c7436[_0x83da('0x2f')]=_[_0x83da('0x31')](db[_0x83da('0x2d')][_0x83da('0x2e')]);_0x2c7436[_0x83da('0x30')]=_[_0x83da('0x31')](_0x15dbe5[_0x83da('0x30')]);_0x2c7436[_0x83da('0x32')]=_['intersection'](_0x2c7436[_0x83da('0x2f')],_0x2c7436['query']);_0x17ae00['attributes']=_[_0x83da('0x33')](_0x2c7436['model'],qs['fields'](_0x15dbe5[_0x83da('0x30')]['fields']));_0x17ae00['attributes']=_0x17ae00[_0x83da('0x34')][_0x83da('0x36')]?_0x17ae00[_0x83da('0x34')]:_0x2c7436[_0x83da('0x2f')];if(_0x15dbe5['query'][_0x83da('0x3f')]){_0x17ae00[_0x83da('0x40')]=[{'all':!![]}];}_0x17ae00=_[_0x83da('0x3d')]({},_0x17ae00,_0x15dbe5['options']);return db[_0x83da('0x2d')]['find'](_0x17ae00)[_0x83da('0x25')](handleEntityNotFound(_0x2a7c42,null))['then'](respondWithResult(_0x2a7c42,null))[_0x83da('0x42')](handleError(_0x2a7c42,null));};exports[_0x83da('0x44')]=function(_0x23acd9,_0xa0dc11){return db[_0x83da('0x2d')][_0x83da('0x44')](_0x23acd9[_0x83da('0x45')],{})[_0x83da('0x25')](respondWithResult(_0xa0dc11,0xc9))[_0x83da('0x42')](handleError(_0xa0dc11,null));};exports['update']=function(_0x40a1f8,_0x35a313){if(_0x40a1f8[_0x83da('0x45')]['id']){delete _0x40a1f8[_0x83da('0x45')]['id'];}return db['MailSubstatus'][_0x83da('0x46')]({'where':{'id':_0x40a1f8[_0x83da('0x47')]['id']}})[_0x83da('0x25')](handleEntityNotFound(_0x35a313,null))[_0x83da('0x25')](saveUpdates(_0x40a1f8[_0x83da('0x45')],null))[_0x83da('0x25')](respondWithResult(_0x35a313,null))[_0x83da('0x42')](handleError(_0x35a313,null));};exports[_0x83da('0x26')]=function(_0x1bb358,_0x5b0f27){return db['MailSubstatus']['find']({'where':{'id':_0x1bb358[_0x83da('0x47')]['id']}})[_0x83da('0x25')](handleEntityNotFound(_0x5b0f27,null))[_0x83da('0x25')](removeEntity(_0x5b0f27,null))[_0x83da('0x42')](handleError(_0x5b0f27,null));};exports['describe']=function(_0x57f5cb,_0x3db131){return db['MailSubstatus']['describe']()[_0x83da('0x25')](respondWithResult(_0x3db131,null))[_0x83da('0x42')](handleError(_0x3db131,null));}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.events.js b/server/api/mailSubstatus/mailSubstatus.events.js index 6fa8371..eaecf16 100644 --- a/server/api/mailSubstatus/mailSubstatus.events.js +++ b/server/api/mailSubstatus/mailSubstatus.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb181=['emit','hasOwnProperty','hook','exports','events','MailSubstatus','setMaxListeners','update'];(function(_0x147e3f,_0x3d6ce4){var _0x1ce9e5=function(_0x1aebdf){while(--_0x1aebdf){_0x147e3f['push'](_0x147e3f['shift']());}};_0x1ce9e5(++_0x3d6ce4);}(_0xb181,0x124));var _0x1b18=function(_0x32860a,_0x60692b){_0x32860a=_0x32860a-0x0;var _0x2f0b18=_0xb181[_0x32860a];return _0x2f0b18;};'use strict';var EventEmitter=require(_0x1b18('0x0'));var MailSubstatus=require('../../mysqldb')['db'][_0x1b18('0x1')];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x1b18('0x2')](0x0);var events={'afterUpdate':_0x1b18('0x3')};function emitEvent(_0x345a03){return function(_0xa86291,_0x1ed987,_0x166851){MailSubstatusEvents[_0x1b18('0x4')](_0x345a03+':'+_0xa86291['id'],_0xa86291);MailSubstatusEvents[_0x1b18('0x4')](_0x345a03,_0xa86291);_0x166851(null);};}for(var e in events){if(events[_0x1b18('0x5')](e)){var event=events[e];MailSubstatus[_0x1b18('0x6')](e,emitEvent(event));}}module[_0x1b18('0x7')]=MailSubstatusEvents; \ No newline at end of file +var _0x2464=['exports','events','../../mysqldb','setMaxListeners','emit','hasOwnProperty','hook'];(function(_0x31c5ea,_0x217bba){var _0x134bec=function(_0x26c95c){while(--_0x26c95c){_0x31c5ea['push'](_0x31c5ea['shift']());}};_0x134bec(++_0x217bba);}(_0x2464,0x86));var _0x4246=function(_0x25e120,_0x4554a7){_0x25e120=_0x25e120-0x0;var _0x29d460=_0x2464[_0x25e120];return _0x29d460;};'use strict';var EventEmitter=require(_0x4246('0x0'));var MailSubstatus=require(_0x4246('0x1'))['db']['MailSubstatus'];var MailSubstatusEvents=new EventEmitter();MailSubstatusEvents[_0x4246('0x2')](0x0);var events={'afterUpdate':'update'};function emitEvent(_0x35ce94){return function(_0x372f81,_0x108da9,_0x1dd7e4){MailSubstatusEvents[_0x4246('0x3')](_0x35ce94+':'+_0x372f81['id'],_0x372f81);MailSubstatusEvents[_0x4246('0x3')](_0x35ce94,_0x372f81);_0x1dd7e4(null);};}for(var e in events){if(events[_0x4246('0x4')](e)){var event=events[e];MailSubstatus[_0x4246('0x5')](e,emitEvent(event));}}module[_0x4246('0x6')]=MailSubstatusEvents; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.model.js b/server/api/mailSubstatus/mailSubstatus.model.js index f52750c..a8d7311 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 _0xa5db=['MailSubstatus','mail_substatuses','Condition','update','name','mailSubstatus','then','catch','./mailSubstatus.attributes','exports','define'];(function(_0x57e857,_0xc01b48){var _0x52166f=function(_0x199d26){while(--_0x199d26){_0x57e857['push'](_0x57e857['shift']());}};_0x52166f(++_0xc01b48);}(_0xa5db,0x1e1));var _0xba5d=function(_0xf706c7,_0x6c9079){_0xf706c7=_0xf706c7-0x0;var _0x23894f=_0xa5db[_0xf706c7];return _0x23894f;};'use strict';var attributes=require(_0xba5d('0x0'));module[_0xba5d('0x1')]=function(_0x522ad8){var _0x5566ab=_0x522ad8['models'];return _0x522ad8[_0xba5d('0x2')](_0xba5d('0x3'),attributes,{'tableName':_0xba5d('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x4eecfc,_0x3e83a8,_0xf48ba4){return _0x5566ab[_0xba5d('0x5')][_0xba5d('0x6')]({'value':_0x4eecfc[_0xba5d('0x7')]},{'where':{'field':_0xba5d('0x8'),'value':_0x4eecfc['_previousDataValues'][_0xba5d('0x7')]}})[_0xba5d('0x9')](function(){_0xf48ba4();})[_0xba5d('0xa')](function(_0x5aca5d){_0xf48ba4(_0x5aca5d);});}}});}; \ No newline at end of file +var _0xce0d=['_previousDataValues','then','catch','./mailSubstatus.attributes','exports','models','define','mail_substatuses','update','name','mailSubstatus'];(function(_0x163bbf,_0x3aaecf){var _0x2197af=function(_0xce02df){while(--_0xce02df){_0x163bbf['push'](_0x163bbf['shift']());}};_0x2197af(++_0x3aaecf);}(_0xce0d,0x19a));var _0xdce0=function(_0x3782f1,_0xdb9da7){_0x3782f1=_0x3782f1-0x0;var _0x59aa2c=_0xce0d[_0x3782f1];return _0x59aa2c;};'use strict';var attributes=require(_0xdce0('0x0'));module[_0xdce0('0x1')]=function(_0x27e316){var _0x303824=_0x27e316[_0xdce0('0x2')];return _0x27e316[_0xdce0('0x3')]('MailSubstatus',attributes,{'tableName':_0xdce0('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterUpdate':function(_0x90fac8,_0x3d4fc6,_0x294690){return _0x303824['Condition'][_0xdce0('0x5')]({'value':_0x90fac8[_0xdce0('0x6')]},{'where':{'field':_0xdce0('0x7'),'value':_0x90fac8[_0xdce0('0x8')][_0xdce0('0x6')]}})[_0xdce0('0x9')](function(){_0x294690();})[_0xdce0('0xa')](function(_0x687508){_0x294690(_0x687508);});}}});}; \ No newline at end of file diff --git a/server/api/mailSubstatus/mailSubstatus.rpc.js b/server/api/mailSubstatus/mailSubstatus.rpc.js index ba1261f..f79a7b7 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 _0x48ab=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','request','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','MailSubstatus,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','util','moment','bluebird'];(function(_0x87d11c,_0x479956){var _0x43f3ac=function(_0x48ce57){while(--_0x48ce57){_0x87d11c['push'](_0x87d11c['shift']());}};_0x43f3ac(++_0x479956);}(_0x48ab,0x6b));var _0xb48a=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x48ab[_0x3b0731];return _0x4204d7;};'use strict';var _=require('lodash');var util=require(_0xb48a('0x0'));var moment=require(_0xb48a('0x1'));var BPromise=require(_0xb48a('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xb48a('0x3'));var db=require(_0xb48a('0x4'))['db'];var utils=require(_0xb48a('0x5'));var logger=require(_0xb48a('0x6'))(_0xb48a('0x7'));var config=require(_0xb48a('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xb48a('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xf3718,_0x5dafaa,_0x27c104){return new BPromise(function(_0x13775f,_0x147397){return client[_0xb48a('0xa')](_0xf3718,_0x27c104)['then'](function(_0x2260ac){logger[_0xb48a('0xb')](_0xb48a('0xc'),_0x5dafaa,_0xb48a('0xd'));logger[_0xb48a('0xe')](_0xb48a('0xf'),_0x5dafaa,_0xb48a('0xd'),JSON[_0xb48a('0x10')](_0x2260ac));if(_0x2260ac[_0xb48a('0x11')]){if(_0x2260ac[_0xb48a('0x11')][_0xb48a('0x12')]===0x1f4){logger['error'](_0xb48a('0xc'),_0x5dafaa,_0x2260ac[_0xb48a('0x11')][_0xb48a('0x13')]);return _0x147397(_0x2260ac[_0xb48a('0x11')]['message']);}logger[_0xb48a('0x11')](_0xb48a('0xc'),_0x5dafaa,_0x2260ac[_0xb48a('0x11')][_0xb48a('0x13')]);return _0x13775f(_0x2260ac['error']['message']);}else{logger['info'](_0xb48a('0xc'),_0x5dafaa,_0xb48a('0xd'));_0x13775f(_0x2260ac[_0xb48a('0x14')][_0xb48a('0x13')]);}})[_0xb48a('0x15')](function(_0x51c8b5){logger['error'](_0xb48a('0xc'),_0x5dafaa,_0x51c8b5);_0x147397(_0x51c8b5);});});} \ No newline at end of file +var _0x155b=['error','code','message','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','request','then','info','MailSubstatus,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x315805,_0x40e334){var _0x55e123=function(_0x179a52){while(--_0x179a52){_0x315805['push'](_0x315805['shift']());}};_0x55e123(++_0x40e334);}(_0x155b,0xbd));var _0xb155=function(_0x3ee7e2,_0x15cf09){_0x3ee7e2=_0x3ee7e2-0x0;var _0x1c1f18=_0x155b[_0x3ee7e2];return _0x1c1f18;};'use strict';var _=require(_0xb155('0x0'));var util=require(_0xb155('0x1'));var moment=require('moment');var BPromise=require(_0xb155('0x2'));var rs=require(_0xb155('0x3'));var fs=require('fs');var Redis=require(_0xb155('0x4'));var db=require(_0xb155('0x5'))['db'];var utils=require(_0xb155('0x6'));var logger=require('../../config/logger')(_0xb155('0x7'));var config=require('../../config/environment');var jayson=require(_0xb155('0x8'));var client=jayson[_0xb155('0x9')][_0xb155('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x44f63e,_0x2cbea2,_0x19ac33){return new BPromise(function(_0x57b00c,_0x38cfc0){return client[_0xb155('0xb')](_0x44f63e,_0x19ac33)[_0xb155('0xc')](function(_0x430a3c){logger[_0xb155('0xd')](_0xb155('0xe'),_0x2cbea2,_0xb155('0xf'));logger[_0xb155('0x10')]('MailSubstatus,\x20%s,\x20%s,\x20%s',_0x2cbea2,'request\x20sent',JSON[_0xb155('0x11')](_0x430a3c));if(_0x430a3c[_0xb155('0x12')]){if(_0x430a3c[_0xb155('0x12')][_0xb155('0x13')]===0x1f4){logger['error'](_0xb155('0xe'),_0x2cbea2,_0x430a3c[_0xb155('0x12')][_0xb155('0x14')]);return _0x38cfc0(_0x430a3c[_0xb155('0x12')][_0xb155('0x14')]);}logger[_0xb155('0x12')](_0xb155('0xe'),_0x2cbea2,_0x430a3c[_0xb155('0x12')][_0xb155('0x14')]);return _0x57b00c(_0x430a3c['error'][_0xb155('0x14')]);}else{logger['info'](_0xb155('0xe'),_0x2cbea2,_0xb155('0xf'));_0x57b00c(_0x430a3c[_0xb155('0x15')][_0xb155('0x14')]);}})[_0xb155('0x16')](function(_0x4e53f8){logger[_0xb155('0x12')]('MailSubstatus,\x20%s,\x20%s',_0x2cbea2,_0x4e53f8);_0x38cfc0(_0x4e53f8);});});} \ No newline at end of file diff --git a/server/api/mailTransferReport/index.js b/server/api/mailTransferReport/index.js index 9f6a571..2016c47 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 _0xdad4=['delete','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./mailTransferReport.controller','get','isAuthenticated','index','describe','show','post','create','put','/:id','update'];(function(_0x22506b,_0x426ee8){var _0xb87ce4=function(_0x245239){while(--_0x245239){_0x22506b['push'](_0x22506b['shift']());}};_0xb87ce4(++_0x426ee8);}(_0xdad4,0x99));var _0x4dad=function(_0x11e03f,_0x20b967){_0x11e03f=_0x11e03f-0x0;var _0x5666fe=_0xdad4[_0x11e03f];return _0x5666fe;};'use strict';var multer=require(_0x4dad('0x0'));var util=require(_0x4dad('0x1'));var path=require('path');var timeout=require(_0x4dad('0x2'));var express=require('express');var router=express[_0x4dad('0x3')]();var fs_extra=require(_0x4dad('0x4'));var auth=require(_0x4dad('0x5'));var interaction=require(_0x4dad('0x6'));var config=require('../../config/environment');var controller=require(_0x4dad('0x7'));router[_0x4dad('0x8')]('/',auth[_0x4dad('0x9')](),controller[_0x4dad('0xa')]);router[_0x4dad('0x8')]('/describe',auth[_0x4dad('0x9')](),controller[_0x4dad('0xb')]);router[_0x4dad('0x8')]('/:id',auth[_0x4dad('0x9')](),controller[_0x4dad('0xc')]);router[_0x4dad('0xd')]('/',auth[_0x4dad('0x9')](),controller[_0x4dad('0xe')]);router[_0x4dad('0xf')](_0x4dad('0x10'),auth[_0x4dad('0x9')](),controller[_0x4dad('0x11')]);router[_0x4dad('0x12')](_0x4dad('0x10'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0xc768=['Router','../../components/auth/service','../../components/interaction/service','isAuthenticated','index','get','/describe','/:id','show','post','create','put','update','exports','multer','path','connect-timeout','express'];(function(_0x9ca21f,_0x437553){var _0x9ef54b=function(_0x1aafff){while(--_0x1aafff){_0x9ca21f['push'](_0x9ca21f['shift']());}};_0x9ef54b(++_0x437553);}(_0xc768,0x164));var _0x8c76=function(_0x35c52a,_0x31e2ed){_0x35c52a=_0x35c52a-0x0;var _0x5d7ae7=_0xc768[_0x35c52a];return _0x5d7ae7;};'use strict';var multer=require(_0x8c76('0x0'));var util=require('util');var path=require(_0x8c76('0x1'));var timeout=require(_0x8c76('0x2'));var express=require(_0x8c76('0x3'));var router=express[_0x8c76('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x8c76('0x5'));var interaction=require(_0x8c76('0x6'));var config=require('../../config/environment');var controller=require('./mailTransferReport.controller');router['get']('/',auth[_0x8c76('0x7')](),controller[_0x8c76('0x8')]);router[_0x8c76('0x9')](_0x8c76('0xa'),auth[_0x8c76('0x7')](),controller['describe']);router[_0x8c76('0x9')](_0x8c76('0xb'),auth[_0x8c76('0x7')](),controller[_0x8c76('0xc')]);router[_0x8c76('0xd')]('/',auth['isAuthenticated'](),controller[_0x8c76('0xe')]);router[_0x8c76('0xf')]('/:id',auth[_0x8c76('0x7')](),controller[_0x8c76('0x10')]);router['delete'](_0x8c76('0xb'),auth[_0x8c76('0x7')](),controller['destroy']);module[_0x8c76('0x11')]=router; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.attributes.js b/server/api/mailTransferReport/mailTransferReport.attributes.js index 58b5f7c..b4839f4 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 _0xb43b=['DATE','NOW','moment','sequelize','STRING','ENUM','account','queue'];(function(_0x2fc012,_0x503e5b){var _0x2891f9=function(_0x295f5e){while(--_0x295f5e){_0x2fc012['push'](_0x2fc012['shift']());}};_0x2891f9(++_0x503e5b);}(_0xb43b,0x1b2));var _0xbb43=function(_0x2b2678,_0x576151){_0x2b2678=_0x2b2678-0x0;var _0x300d2=_0xb43b[_0x2b2678];return _0x300d2;};'use strict';var moment=require(_0xbb43('0x0'));var Sequelize=require(_0xbb43('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xbb43('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xbb43('0x3')](_0xbb43('0x4'),'agent',_0xbb43('0x5')),'allowNull':![],'defaultValue':_0xbb43('0x5')},'transferredAt':{'type':Sequelize[_0xbb43('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xbb43('0x7')]}}; \ No newline at end of file +var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x24e0c5,_0x54497c){var _0x454d1e=function(_0x55f9ba){while(--_0x55f9ba){_0x24e0c5['push'](_0x24e0c5['shift']());}};_0x454d1e(++_0x54497c);}(_0x70e0,0x17b));var _0x070e=function(_0x4e3546,_0x1f11fe){_0x4e3546=_0x4e3546-0x0;var _0x1581d8=_0x70e0[_0x4e3546];return _0x1581d8;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.controller.js b/server/api/mailTransferReport/mailTransferReport.controller.js index 1e9e3f9..7b0743c 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 _0xd1a4=['include','findAll','rows','catch','show','params','rawAttributes','find','create','body','describe','rimraf','moment','bluebird','util','path','to-csv','ejs','fs-extra','squel','jsforce','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','count','set','Content-Range','apply','save','update','end','error','stack','name','send','map','fieldName','type','key','model','keys','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','MailTransferReport','then','includeAll'];(function(_0x1976b7,_0xea718a){var _0x2ad878=function(_0x34412a){while(--_0x34412a){_0x1976b7['push'](_0x1976b7['shift']());}};_0x2ad878(++_0xea718a);}(_0xd1a4,0x16e));var _0x4d1a=function(_0x50d16f,_0x236757){_0x50d16f=_0x50d16f-0x0;var _0x479855=_0xd1a4[_0x50d16f];return _0x479855;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x4d1a('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x4d1a('0x1'));var BPromise=require(_0x4d1a('0x2'));var Mustache=require('mustache');var util=require(_0x4d1a('0x3'));var path=require(_0x4d1a('0x4'));var sox=require('sox');var csv=require(_0x4d1a('0x5'));var ejs=require(_0x4d1a('0x6'));var fs=require('fs');var fs_extra=require(_0x4d1a('0x7'));var _=require('lodash');var squel=require(_0x4d1a('0x8'));var crypto=require('crypto');var jsforce=require(_0x4d1a('0x9'));var deskjs=require('desk.js');var toCsv=require(_0x4d1a('0x5'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x4d1a('0xa'));var authService=require(_0x4d1a('0xb'));var qs=require(_0x4d1a('0xc'));var as=require(_0x4d1a('0xd'));var hardwareService=require(_0x4d1a('0xe'));var logger=require(_0x4d1a('0xf'))('api');var utils=require(_0x4d1a('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0x4d1a('0x11'));var db=require(_0x4d1a('0x12'))['db'];function respondWithStatusCode(_0x3a37c3,_0x46c26a){_0x46c26a=_0x46c26a||0xcc;return function(_0x2a6beb){if(_0x2a6beb){return _0x3a37c3[_0x4d1a('0x13')](_0x46c26a);}return _0x3a37c3[_0x4d1a('0x14')](_0x46c26a)['end']();};}function respondWithResult(_0x1292b6,_0x36390b){_0x36390b=_0x36390b||0xc8;return function(_0x5f24b0){if(_0x5f24b0){return _0x1292b6['status'](_0x36390b)[_0x4d1a('0x15')](_0x5f24b0);}};}function respondWithFilteredResult(_0x237d87,_0x4c2726){return function(_0xddd5b1){if(_0xddd5b1){var _0x2be92e=typeof _0x4c2726[_0x4d1a('0x16')]==='undefined'&&typeof _0x4c2726[_0x4d1a('0x17')]==='undefined';var _0x2970c5=_0xddd5b1[_0x4d1a('0x18')];var _0x4c1ceb=_0x2be92e?0x0:_0x4c2726['offset'];var _0x5b32a3=_0x2be92e?_0xddd5b1[_0x4d1a('0x18')]:_0x4c2726[_0x4d1a('0x16')]+_0x4c2726[_0x4d1a('0x17')];var _0x278a95;if(_0x5b32a3>=_0x2970c5){_0x5b32a3=_0x2970c5;_0x278a95=0xc8;}else{_0x278a95=0xce;}_0x237d87[_0x4d1a('0x14')](_0x278a95);return _0x237d87[_0x4d1a('0x19')](_0x4d1a('0x1a'),_0x4c1ceb+'-'+_0x5b32a3+'/'+_0x2970c5)[_0x4d1a('0x15')](_0xddd5b1);}return null;};}function patchUpdates(_0x59375f){return function(_0x6d84b7){try{jsonpatch[_0x4d1a('0x1b')](_0x6d84b7,_0x59375f,!![]);}catch(_0x2f6158){return BPromise['reject'](_0x2f6158);}return _0x6d84b7[_0x4d1a('0x1c')]();};}function saveUpdates(_0x55f589,_0x1b7334){return function(_0x516e80){if(_0x516e80){return _0x516e80[_0x4d1a('0x1d')](_0x55f589)['then'](function(_0x53e68c){return _0x53e68c;});}return null;};}function removeEntity(_0x19c769,_0x4c8240){return function(_0xe1bd2b){if(_0xe1bd2b){return _0xe1bd2b['destroy']()['then'](function(){_0x19c769[_0x4d1a('0x14')](0xcc)[_0x4d1a('0x1e')]();});}};}function handleEntityNotFound(_0x5169dd,_0x4c1887){return function(_0x2ff62e){if(!_0x2ff62e){_0x5169dd[_0x4d1a('0x13')](0x194);}return _0x2ff62e;};}function handleError(_0x98c5f0,_0x30fbdb){_0x30fbdb=_0x30fbdb||0x1f4;return function(_0x2b63c1){logger[_0x4d1a('0x1f')](_0x2b63c1[_0x4d1a('0x20')]);if(_0x2b63c1[_0x4d1a('0x21')]){delete _0x2b63c1['name'];}_0x98c5f0[_0x4d1a('0x14')](_0x30fbdb)[_0x4d1a('0x22')](_0x2b63c1);};}exports['index']=function(_0x9e9c3a,_0x4c8172){var _0x2e310a={},_0x65e141={},_0xd7afe7={'count':0x0,'rows':[]};var _0x3856c2=_[_0x4d1a('0x23')](db['MailTransferReport']['rawAttributes'],function(_0x2a7ec2){return{'name':_0x2a7ec2[_0x4d1a('0x24')],'type':_0x2a7ec2[_0x4d1a('0x25')][_0x4d1a('0x26')]};});_0x65e141[_0x4d1a('0x27')]=_[_0x4d1a('0x23')](_0x3856c2,_0x4d1a('0x21'));_0x65e141['query']=_[_0x4d1a('0x28')](_0x9e9c3a[_0x4d1a('0x29')]);_0x65e141['filters']=_[_0x4d1a('0x2a')](_0x65e141[_0x4d1a('0x27')],_0x65e141[_0x4d1a('0x29')]);_0x2e310a['attributes']=_[_0x4d1a('0x2a')](_0x65e141[_0x4d1a('0x27')],qs[_0x4d1a('0x2b')](_0x9e9c3a[_0x4d1a('0x29')]['fields']));_0x2e310a[_0x4d1a('0x2c')]=_0x2e310a['attributes'][_0x4d1a('0x2d')]?_0x2e310a['attributes']:_0x65e141[_0x4d1a('0x27')];if(!_0x9e9c3a[_0x4d1a('0x29')][_0x4d1a('0x2e')](_0x4d1a('0x2f'))){_0x2e310a['limit']=qs[_0x4d1a('0x17')](_0x9e9c3a[_0x4d1a('0x29')][_0x4d1a('0x17')]);_0x2e310a[_0x4d1a('0x16')]=qs[_0x4d1a('0x16')](_0x9e9c3a['query'][_0x4d1a('0x16')]);}_0x2e310a[_0x4d1a('0x30')]=qs[_0x4d1a('0x31')](_0x9e9c3a[_0x4d1a('0x29')][_0x4d1a('0x31')]);_0x2e310a[_0x4d1a('0x32')]=qs[_0x4d1a('0x33')](_[_0x4d1a('0x34')](_0x9e9c3a['query'],_0x65e141[_0x4d1a('0x33')]),_0x3856c2);if(_0x9e9c3a[_0x4d1a('0x29')][_0x4d1a('0x35')]){_0x2e310a['where']=_[_0x4d1a('0x36')](_0x2e310a[_0x4d1a('0x32')],{'$or':_['map'](_0x3856c2,function(_0x2ea2c9){if(_0x2ea2c9['type']!==_0x4d1a('0x37')){var _0x252c51={};_0x252c51[_0x2ea2c9['name']]={'$like':'%'+_0x9e9c3a[_0x4d1a('0x29')][_0x4d1a('0x35')]+'%'};return _0x252c51;}})});}_0x2e310a=_[_0x4d1a('0x36')]({},_0x2e310a,_0x9e9c3a[_0x4d1a('0x38')]);var _0x1cdbb4={'where':_0x2e310a[_0x4d1a('0x32')]};return db[_0x4d1a('0x39')][_0x4d1a('0x18')](_0x1cdbb4)[_0x4d1a('0x3a')](function(_0x3a7ad3){_0xd7afe7['count']=_0x3a7ad3;if(_0x9e9c3a['query'][_0x4d1a('0x3b')]){_0x2e310a[_0x4d1a('0x3c')]=[{'all':!![]}];}return db[_0x4d1a('0x39')][_0x4d1a('0x3d')](_0x2e310a);})[_0x4d1a('0x3a')](function(_0x512009){_0xd7afe7[_0x4d1a('0x3e')]=_0x512009;return _0xd7afe7;})[_0x4d1a('0x3a')](respondWithFilteredResult(_0x4c8172,_0x2e310a))[_0x4d1a('0x3f')](handleError(_0x4c8172,null));};exports[_0x4d1a('0x40')]=function(_0x466695,_0xec8da1){var _0x5b8ec9={'raw':!![],'where':{'id':_0x466695[_0x4d1a('0x41')]['id']}},_0x22f2c5={};_0x22f2c5['model']=_['keys'](db[_0x4d1a('0x39')][_0x4d1a('0x42')]);_0x22f2c5[_0x4d1a('0x29')]=_['keys'](_0x466695[_0x4d1a('0x29')]);_0x22f2c5[_0x4d1a('0x33')]=_['intersection'](_0x22f2c5[_0x4d1a('0x27')],_0x22f2c5[_0x4d1a('0x29')]);_0x5b8ec9[_0x4d1a('0x2c')]=_[_0x4d1a('0x2a')](_0x22f2c5[_0x4d1a('0x27')],qs[_0x4d1a('0x2b')](_0x466695[_0x4d1a('0x29')][_0x4d1a('0x2b')]));_0x5b8ec9[_0x4d1a('0x2c')]=_0x5b8ec9[_0x4d1a('0x2c')][_0x4d1a('0x2d')]?_0x5b8ec9[_0x4d1a('0x2c')]:_0x22f2c5[_0x4d1a('0x27')];if(_0x466695[_0x4d1a('0x29')]['includeAll']){_0x5b8ec9[_0x4d1a('0x3c')]=[{'all':!![]}];}_0x5b8ec9=_['merge']({},_0x5b8ec9,_0x466695[_0x4d1a('0x38')]);return db[_0x4d1a('0x39')][_0x4d1a('0x43')](_0x5b8ec9)[_0x4d1a('0x3a')](handleEntityNotFound(_0xec8da1,null))[_0x4d1a('0x3a')](respondWithResult(_0xec8da1,null))[_0x4d1a('0x3f')](handleError(_0xec8da1,null));};exports[_0x4d1a('0x44')]=function(_0x375152,_0x5b2ea0){return db[_0x4d1a('0x39')][_0x4d1a('0x44')](_0x375152[_0x4d1a('0x45')],{})[_0x4d1a('0x3a')](respondWithResult(_0x5b2ea0,0xc9))[_0x4d1a('0x3f')](handleError(_0x5b2ea0,null));};exports[_0x4d1a('0x1d')]=function(_0x18b843,_0x44b241){if(_0x18b843[_0x4d1a('0x45')]['id']){delete _0x18b843[_0x4d1a('0x45')]['id'];}return db[_0x4d1a('0x39')][_0x4d1a('0x43')]({'where':{'id':_0x18b843[_0x4d1a('0x41')]['id']}})['then'](handleEntityNotFound(_0x44b241,null))[_0x4d1a('0x3a')](saveUpdates(_0x18b843[_0x4d1a('0x45')],null))[_0x4d1a('0x3a')](respondWithResult(_0x44b241,null))[_0x4d1a('0x3f')](handleError(_0x44b241,null));};exports['destroy']=function(_0x1591e8,_0x3691c4){return db[_0x4d1a('0x39')][_0x4d1a('0x43')]({'where':{'id':_0x1591e8[_0x4d1a('0x41')]['id']}})[_0x4d1a('0x3a')](handleEntityNotFound(_0x3691c4,null))['then'](removeEntity(_0x3691c4,null))[_0x4d1a('0x3f')](handleError(_0x3691c4,null));};exports[_0x4d1a('0x46')]=function(_0x4fa6fd,_0x588a11){return db[_0x4d1a('0x39')][_0x4d1a('0x46')]()[_0x4d1a('0x3a')](respondWithResult(_0x588a11,null))[_0x4d1a('0x3f')](handleError(_0x588a11,null));}; \ No newline at end of file +var _0xd512=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','Content-Range','reject','update','then','end','error','stack','name','index','map','rawAttributes','fieldName','type','key','query','keys','intersection','model','fields','attributes','length','nolimit','filters','filter','where','merge','VIRTUAL','options','includeAll','include','MailTransferReport','findAll','catch','show','params','body','find'];(function(_0x395b5e,_0x4a1efe){var _0x11c257=function(_0x47ea59){while(--_0x47ea59){_0x395b5e['push'](_0x395b5e['shift']());}};_0x11c257(++_0x4a1efe);}(_0xd512,0xd6));var _0x2d51=function(_0x4ee0a8,_0x47dca0){_0x4ee0a8=_0x4ee0a8-0x0;var _0xd9e04f=_0xd512[_0x4ee0a8];return _0xd9e04f;};'use strict';var emlformat=require(_0x2d51('0x0'));var rimraf=require(_0x2d51('0x1'));var zipdir=require(_0x2d51('0x2'));var jsonpatch=require(_0x2d51('0x3'));var rp=require(_0x2d51('0x4'));var moment=require('moment');var BPromise=require(_0x2d51('0x5'));var Mustache=require(_0x2d51('0x6'));var util=require(_0x2d51('0x7'));var path=require(_0x2d51('0x8'));var sox=require(_0x2d51('0x9'));var csv=require(_0x2d51('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2d51('0xb'));var squel=require(_0x2d51('0xc'));var crypto=require(_0x2d51('0xd'));var jsforce=require(_0x2d51('0xe'));var deskjs=require(_0x2d51('0xf'));var toCsv=require(_0x2d51('0xa'));var querystring=require(_0x2d51('0x10'));var Papa=require(_0x2d51('0x11'));var Redis=require('ioredis');var authService=require(_0x2d51('0x12'));var qs=require(_0x2d51('0x13'));var as=require(_0x2d51('0x14'));var hardwareService=require(_0x2d51('0x15'));var logger=require(_0x2d51('0x16'))(_0x2d51('0x17'));var utils=require(_0x2d51('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x2d51('0x19'))['db'];function respondWithStatusCode(_0x5e3a92,_0x5d1862){_0x5d1862=_0x5d1862||0xcc;return function(_0x6e0e87){if(_0x6e0e87){return _0x5e3a92[_0x2d51('0x1a')](_0x5d1862);}return _0x5e3a92['status'](_0x5d1862)['end']();};}function respondWithResult(_0x1e4988,_0x16a2af){_0x16a2af=_0x16a2af||0xc8;return function(_0x4bba1a){if(_0x4bba1a){return _0x1e4988['status'](_0x16a2af)[_0x2d51('0x1b')](_0x4bba1a);}};}function respondWithFilteredResult(_0x1f8252,_0x567685){return function(_0x4d16e8){if(_0x4d16e8){var _0x5730e7=typeof _0x567685[_0x2d51('0x1c')]===_0x2d51('0x1d')&&typeof _0x567685[_0x2d51('0x1e')]==='undefined';var _0x3ce199=_0x4d16e8[_0x2d51('0x1f')];var _0x4837c7=_0x5730e7?0x0:_0x567685[_0x2d51('0x1c')];var _0x4dc84c=_0x5730e7?_0x4d16e8[_0x2d51('0x1f')]:_0x567685[_0x2d51('0x1c')]+_0x567685[_0x2d51('0x1e')];var _0xa0876a;if(_0x4dc84c>=_0x3ce199){_0x4dc84c=_0x3ce199;_0xa0876a=0xc8;}else{_0xa0876a=0xce;}_0x1f8252[_0x2d51('0x20')](_0xa0876a);return _0x1f8252['set'](_0x2d51('0x21'),_0x4837c7+'-'+_0x4dc84c+'/'+_0x3ce199)[_0x2d51('0x1b')](_0x4d16e8);}return null;};}function patchUpdates(_0x3132d4){return function(_0x2891a0){try{jsonpatch['apply'](_0x2891a0,_0x3132d4,!![]);}catch(_0x25eee7){return BPromise[_0x2d51('0x22')](_0x25eee7);}return _0x2891a0['save']();};}function saveUpdates(_0x4aa98a,_0x1cbcff){return function(_0x2688dd){if(_0x2688dd){return _0x2688dd[_0x2d51('0x23')](_0x4aa98a)[_0x2d51('0x24')](function(_0xc1ed34){return _0xc1ed34;});}return null;};}function removeEntity(_0xf3121b,_0x5e5b7b){return function(_0xcc45fc){if(_0xcc45fc){return _0xcc45fc['destroy']()[_0x2d51('0x24')](function(){_0xf3121b[_0x2d51('0x20')](0xcc)[_0x2d51('0x25')]();});}};}function handleEntityNotFound(_0x3af98b,_0x39ffcd){return function(_0x5d853f){if(!_0x5d853f){_0x3af98b[_0x2d51('0x1a')](0x194);}return _0x5d853f;};}function handleError(_0x2f2193,_0x4233ca){_0x4233ca=_0x4233ca||0x1f4;return function(_0x3f7a99){logger[_0x2d51('0x26')](_0x3f7a99[_0x2d51('0x27')]);if(_0x3f7a99[_0x2d51('0x28')]){delete _0x3f7a99[_0x2d51('0x28')];}_0x2f2193[_0x2d51('0x20')](_0x4233ca)['send'](_0x3f7a99);};}exports[_0x2d51('0x29')]=function(_0x52f717,_0x1f95ee){var _0xaf7498={},_0x4bb423={},_0x38ceb7={'count':0x0,'rows':[]};var _0x4f226b=_[_0x2d51('0x2a')](db['MailTransferReport'][_0x2d51('0x2b')],function(_0x3bc2c1){return{'name':_0x3bc2c1[_0x2d51('0x2c')],'type':_0x3bc2c1[_0x2d51('0x2d')][_0x2d51('0x2e')]};});_0x4bb423['model']=_['map'](_0x4f226b,_0x2d51('0x28'));_0x4bb423[_0x2d51('0x2f')]=_[_0x2d51('0x30')](_0x52f717[_0x2d51('0x2f')]);_0x4bb423['filters']=_[_0x2d51('0x31')](_0x4bb423[_0x2d51('0x32')],_0x4bb423[_0x2d51('0x2f')]);_0xaf7498['attributes']=_['intersection'](_0x4bb423['model'],qs[_0x2d51('0x33')](_0x52f717[_0x2d51('0x2f')]['fields']));_0xaf7498[_0x2d51('0x34')]=_0xaf7498[_0x2d51('0x34')][_0x2d51('0x35')]?_0xaf7498['attributes']:_0x4bb423['model'];if(!_0x52f717['query']['hasOwnProperty'](_0x2d51('0x36'))){_0xaf7498[_0x2d51('0x1e')]=qs[_0x2d51('0x1e')](_0x52f717[_0x2d51('0x2f')][_0x2d51('0x1e')]);_0xaf7498[_0x2d51('0x1c')]=qs['offset'](_0x52f717[_0x2d51('0x2f')]['offset']);}_0xaf7498['order']=qs['sort'](_0x52f717[_0x2d51('0x2f')]['sort']);_0xaf7498['where']=qs[_0x2d51('0x37')](_['pick'](_0x52f717[_0x2d51('0x2f')],_0x4bb423[_0x2d51('0x37')]),_0x4f226b);if(_0x52f717['query'][_0x2d51('0x38')]){_0xaf7498[_0x2d51('0x39')]=_[_0x2d51('0x3a')](_0xaf7498[_0x2d51('0x39')],{'$or':_[_0x2d51('0x2a')](_0x4f226b,function(_0x3678b3){if(_0x3678b3[_0x2d51('0x2d')]!==_0x2d51('0x3b')){var _0x372eb0={};_0x372eb0[_0x3678b3[_0x2d51('0x28')]]={'$like':'%'+_0x52f717[_0x2d51('0x2f')][_0x2d51('0x38')]+'%'};return _0x372eb0;}})});}_0xaf7498=_[_0x2d51('0x3a')]({},_0xaf7498,_0x52f717[_0x2d51('0x3c')]);var _0x31ec41={'where':_0xaf7498[_0x2d51('0x39')]};return db['MailTransferReport'][_0x2d51('0x1f')](_0x31ec41)['then'](function(_0x5366bb){_0x38ceb7[_0x2d51('0x1f')]=_0x5366bb;if(_0x52f717[_0x2d51('0x2f')][_0x2d51('0x3d')]){_0xaf7498[_0x2d51('0x3e')]=[{'all':!![]}];}return db[_0x2d51('0x3f')][_0x2d51('0x40')](_0xaf7498);})[_0x2d51('0x24')](function(_0x27d185){_0x38ceb7['rows']=_0x27d185;return _0x38ceb7;})[_0x2d51('0x24')](respondWithFilteredResult(_0x1f95ee,_0xaf7498))[_0x2d51('0x41')](handleError(_0x1f95ee,null));};exports[_0x2d51('0x42')]=function(_0x264f10,_0x4e21a9){var _0x1dae23={'raw':!![],'where':{'id':_0x264f10[_0x2d51('0x43')]['id']}},_0x47f337={};_0x47f337[_0x2d51('0x32')]=_[_0x2d51('0x30')](db[_0x2d51('0x3f')][_0x2d51('0x2b')]);_0x47f337[_0x2d51('0x2f')]=_[_0x2d51('0x30')](_0x264f10[_0x2d51('0x2f')]);_0x47f337[_0x2d51('0x37')]=_[_0x2d51('0x31')](_0x47f337['model'],_0x47f337[_0x2d51('0x2f')]);_0x1dae23[_0x2d51('0x34')]=_[_0x2d51('0x31')](_0x47f337[_0x2d51('0x32')],qs[_0x2d51('0x33')](_0x264f10['query']['fields']));_0x1dae23[_0x2d51('0x34')]=_0x1dae23[_0x2d51('0x34')][_0x2d51('0x35')]?_0x1dae23[_0x2d51('0x34')]:_0x47f337['model'];if(_0x264f10[_0x2d51('0x2f')]['includeAll']){_0x1dae23[_0x2d51('0x3e')]=[{'all':!![]}];}_0x1dae23=_[_0x2d51('0x3a')]({},_0x1dae23,_0x264f10[_0x2d51('0x3c')]);return db['MailTransferReport']['find'](_0x1dae23)['then'](handleEntityNotFound(_0x4e21a9,null))[_0x2d51('0x24')](respondWithResult(_0x4e21a9,null))[_0x2d51('0x41')](handleError(_0x4e21a9,null));};exports['create']=function(_0x5eee92,_0x2d1e28){return db[_0x2d51('0x3f')]['create'](_0x5eee92['body'],{})[_0x2d51('0x24')](respondWithResult(_0x2d1e28,0xc9))['catch'](handleError(_0x2d1e28,null));};exports[_0x2d51('0x23')]=function(_0x577cb4,_0x152b66){if(_0x577cb4[_0x2d51('0x44')]['id']){delete _0x577cb4[_0x2d51('0x44')]['id'];}return db[_0x2d51('0x3f')][_0x2d51('0x45')]({'where':{'id':_0x577cb4[_0x2d51('0x43')]['id']}})[_0x2d51('0x24')](handleEntityNotFound(_0x152b66,null))[_0x2d51('0x24')](saveUpdates(_0x577cb4[_0x2d51('0x44')],null))['then'](respondWithResult(_0x152b66,null))[_0x2d51('0x41')](handleError(_0x152b66,null));};exports['destroy']=function(_0x47f5ee,_0x453679){return db[_0x2d51('0x3f')]['find']({'where':{'id':_0x47f5ee[_0x2d51('0x43')]['id']}})[_0x2d51('0x24')](handleEntityNotFound(_0x453679,null))[_0x2d51('0x24')](removeEntity(_0x453679,null))[_0x2d51('0x41')](handleError(_0x453679,null));};exports[_0x2d51('0x46')]=function(_0x1047ff,_0x47d193){return db[_0x2d51('0x3f')][_0x2d51('0x46')]()['then'](respondWithResult(_0x47d193,null))['catch'](handleError(_0x47d193,null));}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.model.js b/server/api/mailTransferReport/mailTransferReport.model.js index e73d4c9..7d2da54 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 _0x7aaa=['request-promise','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','uniqueid','lodash','../../config/logger','api','moment'];(function(_0x1fdb40,_0x51351c){var _0x281f93=function(_0x35eebe){while(--_0x35eebe){_0x1fdb40['push'](_0x1fdb40['shift']());}};_0x281f93(++_0x51351c);}(_0x7aaa,0x164));var _0xa7aa=function(_0x381dbb,_0x4a1419){_0x381dbb=_0x381dbb-0x0;var _0x301378=_0x7aaa[_0x381dbb];return _0x301378;};'use strict';var _=require(_0xa7aa('0x0'));var util=require('util');var logger=require(_0xa7aa('0x1'))(_0xa7aa('0x2'));var moment=require(_0xa7aa('0x3'));var BPromise=require('bluebird');var rp=require(_0xa7aa('0x4'));var fs=require('fs');var path=require(_0xa7aa('0x5'));var rimraf=require(_0xa7aa('0x6'));var config=require('../../config/environment');var attributes=require(_0xa7aa('0x7'));module[_0xa7aa('0x8')]=function(_0x3eaa6a,_0x166a17){return _0x3eaa6a[_0xa7aa('0x9')](_0xa7aa('0xa'),attributes,{'tableName':'report_mail_transfer','paranoid':![],'indexes':[{'name':_0xa7aa('0xb'),'fields':[_0xa7aa('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xe008=['moment','bluebird','path','rimraf','./mailTransferReport.attributes','exports','define','MailTransferReport','report_mail_transfer','uniqueid','util','../../config/logger','api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xe008,0x14f));var _0x8e00=function(_0x2f1c1c,_0xddd2a2){_0x2f1c1c=_0x2f1c1c-0x0;var _0x27ef27=_0xe008[_0x2f1c1c];return _0x27ef27;};'use strict';var _=require('lodash');var util=require(_0x8e00('0x0'));var logger=require(_0x8e00('0x1'))(_0x8e00('0x2'));var moment=require(_0x8e00('0x3'));var BPromise=require(_0x8e00('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x8e00('0x5'));var rimraf=require(_0x8e00('0x6'));var config=require('../../config/environment');var attributes=require(_0x8e00('0x7'));module[_0x8e00('0x8')]=function(_0x4ded8c,_0x1d324e){return _0x4ded8c[_0x8e00('0x9')](_0x8e00('0xa'),attributes,{'tableName':_0x8e00('0xb'),'paranoid':![],'indexes':[{'name':_0x8e00('0xc'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/mailTransferReport/mailTransferReport.rpc.js b/server/api/mailTransferReport/mailTransferReport.rpc.js index a28d0a7..b1a9f99 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 _0x6eb9=['request','info','MailTransferReport,\x20%s,\x20%s','request\x20sent','debug','MailTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client'];(function(_0x40119b,_0x574bdf){var _0x5c2688=function(_0x5e75bd){while(--_0x5e75bd){_0x40119b['push'](_0x40119b['shift']());}};_0x5c2688(++_0x574bdf);}(_0x6eb9,0xaa));var _0x96eb=function(_0xdbc5d,_0x2f34a0){_0xdbc5d=_0xdbc5d-0x0;var _0x18717a=_0x6eb9[_0xdbc5d];return _0x18717a;};'use strict';var _=require('lodash');var util=require(_0x96eb('0x0'));var moment=require(_0x96eb('0x1'));var BPromise=require(_0x96eb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x96eb('0x3'));var db=require(_0x96eb('0x4'))['db'];var utils=require(_0x96eb('0x5'));var logger=require(_0x96eb('0x6'))(_0x96eb('0x7'));var config=require('../../config/environment');var jayson=require(_0x96eb('0x8'));var client=jayson[_0x96eb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5c527f,_0x3bb97e,_0x3dd5c8){return new BPromise(function(_0x3fcbc3,_0x46c91c){return client[_0x96eb('0xa')](_0x5c527f,_0x3dd5c8)['then'](function(_0x1183e6){logger[_0x96eb('0xb')](_0x96eb('0xc'),_0x3bb97e,_0x96eb('0xd'));logger[_0x96eb('0xe')](_0x96eb('0xf'),_0x3bb97e,'request\x20sent',JSON[_0x96eb('0x10')](_0x1183e6));if(_0x1183e6['error']){if(_0x1183e6[_0x96eb('0x11')]['code']===0x1f4){logger[_0x96eb('0x11')](_0x96eb('0xc'),_0x3bb97e,_0x1183e6[_0x96eb('0x11')]['message']);return _0x46c91c(_0x1183e6[_0x96eb('0x11')][_0x96eb('0x12')]);}logger['error'](_0x96eb('0xc'),_0x3bb97e,_0x1183e6[_0x96eb('0x11')][_0x96eb('0x12')]);return _0x3fcbc3(_0x1183e6[_0x96eb('0x11')][_0x96eb('0x12')]);}else{logger[_0x96eb('0xb')](_0x96eb('0xc'),_0x3bb97e,'request\x20sent');_0x3fcbc3(_0x1183e6['result']['message']);}})[_0x96eb('0x13')](function(_0x536eea){logger[_0x96eb('0x11')](_0x96eb('0xc'),_0x3bb97e,_0x536eea);_0x46c91c(_0x536eea);});});} \ No newline at end of file +var _0xfc2a=['../../config/environment','jayson/promise','client','http','request','then','info','MailTransferReport,\x20%s,\x20%s','debug','request\x20sent','stringify','message','error','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfc2a,0xb0));var _0xafc2=function(_0x15a9a7,_0x5efc32){_0x15a9a7=_0x15a9a7-0x0;var _0x11cef9=_0xfc2a[_0x15a9a7];return _0x11cef9;};'use strict';var _=require(_0xafc2('0x0'));var util=require(_0xafc2('0x1'));var moment=require(_0xafc2('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xafc2('0x3'));var db=require(_0xafc2('0x4'))['db'];var utils=require(_0xafc2('0x5'));var logger=require(_0xafc2('0x6'))(_0xafc2('0x7'));var config=require(_0xafc2('0x8'));var jayson=require(_0xafc2('0x9'));var client=jayson[_0xafc2('0xa')][_0xafc2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2fcafe,_0x196d94,_0x30ad3b){return new BPromise(function(_0x23e12f,_0x97256f){return client[_0xafc2('0xc')](_0x2fcafe,_0x30ad3b)[_0xafc2('0xd')](function(_0x680d3c){logger[_0xafc2('0xe')](_0xafc2('0xf'),_0x196d94,'request\x20sent');logger[_0xafc2('0x10')]('MailTransferReport,\x20%s,\x20%s,\x20%s',_0x196d94,_0xafc2('0x11'),JSON[_0xafc2('0x12')](_0x680d3c));if(_0x680d3c['error']){if(_0x680d3c['error']['code']===0x1f4){logger['error']('MailTransferReport,\x20%s,\x20%s',_0x196d94,_0x680d3c['error'][_0xafc2('0x13')]);return _0x97256f(_0x680d3c['error']['message']);}logger[_0xafc2('0x14')](_0xafc2('0xf'),_0x196d94,_0x680d3c[_0xafc2('0x14')][_0xafc2('0x13')]);return _0x23e12f(_0x680d3c['error']['message']);}else{logger[_0xafc2('0xe')](_0xafc2('0xf'),_0x196d94,'request\x20sent');_0x23e12f(_0x680d3c[_0xafc2('0x15')][_0xafc2('0x13')]);}})[_0xafc2('0x16')](function(_0xa825b6){logger[_0xafc2('0x14')](_0xafc2('0xf'),_0x196d94,_0xa825b6);_0x97256f(_0xa825b6);});});} \ No newline at end of file diff --git a/server/api/memberReport/index.js b/server/api/memberReport/index.js index 56892bf..b1160d4 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 _0x22d0=['../../components/auth/service','../../config/environment','./memberReport.controller','index','get','/describe','isAuthenticated','describe','show','post','create','put','/:id','update','delete','exports','multer','path','connect-timeout','Router','fs-extra'];(function(_0x4a8e35,_0x1613b5){var _0x2c38d9=function(_0x9b189c){while(--_0x9b189c){_0x4a8e35['push'](_0x4a8e35['shift']());}};_0x2c38d9(++_0x1613b5);}(_0x22d0,0x160));var _0x022d=function(_0x4fe19c,_0x45d0fe){_0x4fe19c=_0x4fe19c-0x0;var _0x952ac7=_0x22d0[_0x4fe19c];return _0x952ac7;};'use strict';var multer=require(_0x022d('0x0'));var util=require('util');var path=require(_0x022d('0x1'));var timeout=require(_0x022d('0x2'));var express=require('express');var router=express[_0x022d('0x3')]();var fs_extra=require(_0x022d('0x4'));var auth=require(_0x022d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x022d('0x6'));var controller=require(_0x022d('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x022d('0x8')]);router[_0x022d('0x9')](_0x022d('0xa'),auth[_0x022d('0xb')](),controller[_0x022d('0xc')]);router[_0x022d('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x022d('0xd')]);router[_0x022d('0xe')]('/',auth[_0x022d('0xb')](),controller[_0x022d('0xf')]);router[_0x022d('0x10')](_0x022d('0x11'),auth[_0x022d('0xb')](),controller[_0x022d('0x12')]);router[_0x022d('0x13')](_0x022d('0x11'),auth[_0x022d('0xb')](),controller['destroy']);module[_0x022d('0x14')]=router; \ No newline at end of file +var _0x4ee6=['exports','multer','util','fs-extra','../../components/auth/service','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','update','destroy'];(function(_0x5f45ea,_0x1fcf63){var _0x2b8768=function(_0x42df3d){while(--_0x42df3d){_0x5f45ea['push'](_0x5f45ea['shift']());}};_0x2b8768(++_0x1fcf63);}(_0x4ee6,0x144));var _0x64ee=function(_0x2d8e7f,_0xedb8e9){_0x2d8e7f=_0x2d8e7f-0x0;var _0x276092=_0x4ee6[_0x2d8e7f];return _0x276092;};'use strict';var multer=require(_0x64ee('0x0'));var util=require(_0x64ee('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express['Router']();var fs_extra=require(_0x64ee('0x2'));var auth=require(_0x64ee('0x3'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require('./memberReport.controller');router[_0x64ee('0x4')]('/',auth[_0x64ee('0x5')](),controller[_0x64ee('0x6')]);router['get'](_0x64ee('0x7'),auth['isAuthenticated'](),controller[_0x64ee('0x8')]);router[_0x64ee('0x4')](_0x64ee('0x9'),auth['isAuthenticated'](),controller[_0x64ee('0xa')]);router[_0x64ee('0xb')]('/',auth[_0x64ee('0x5')](),controller[_0x64ee('0xc')]);router[_0x64ee('0xd')](_0x64ee('0x9'),auth[_0x64ee('0x5')](),controller[_0x64ee('0xe')]);router['delete'](_0x64ee('0x9'),auth[_0x64ee('0x5')](),controller[_0x64ee('0xf')]);module[_0x64ee('0x10')]=router; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.attributes.js b/server/api/memberReport/memberReport.attributes.js index 8d59073..2c1c7f8 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 _0x356c=['sequelize','moment','STRING','DEFAULT\x20PAUSE','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','getDataValue','enterAt','diff','seconds','setDataValue','exitAt','duration','talk:[start]','talk:[destination]','talk:[dial\x20string]','talk:[queue]'];(function(_0x549c39,_0x1f88de){var _0xb88b84=function(_0x1dee91){while(--_0x1dee91){_0x549c39['push'](_0x549c39['shift']());}};_0xb88b84(++_0x1f88de);}(_0x356c,0x143));var _0xc356=function(_0x53b064,_0x26b63a){_0x53b064=_0x53b064-0x0;var _0x174482=_0x356c[_0x53b064];return _0x174482;};'use strict';var Sequelize=require(_0xc356('0x0'));var moment=require(_0xc356('0x1'));module['exports']={'channel':{'type':Sequelize['STRING']},'membername':{'type':Sequelize[_0xc356('0x2')]},'interface':{'type':Sequelize[_0xc356('0x2')]},'type':{'type':Sequelize[_0xc356('0x2')],'defaultValue':_0xc356('0x3'),'comment':_0xc356('0x4')},'duration':{'type':Sequelize[_0xc356('0x5')]},'enterAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize['DATE'],'set':function(_0x539ce8){var _0x5ba6d5=moment(_0x539ce8);var _0xbd6af4=moment(this[_0xc356('0x6')](_0xc356('0x7')));var _0x235b9e=_0x5ba6d5[_0xc356('0x8')](_0xbd6af4,_0xc356('0x9'));this[_0xc356('0xa')](_0xc356('0xb'),_0x539ce8);this[_0xc356('0xa')](_0xc356('0xc'),_0x235b9e>=0x0?_0x235b9e:null);}},'data1':{'type':Sequelize['STRING'],'comment':'talk:[inbound,\x20outbound],\x20pause:[reason]'},'data2':{'type':Sequelize[_0xc356('0x2')],'comment':_0xc356('0xd')},'data3':{'type':Sequelize[_0xc356('0x2')],'comment':_0xc356('0xe')},'data4':{'type':Sequelize[_0xc356('0x2')],'comment':_0xc356('0xf')},'data5':{'type':Sequelize[_0xc356('0x2')],'comment':_0xc356('0x10')},'role':{'type':Sequelize[_0xc356('0x2')]},'internal':{'type':Sequelize[_0xc356('0x5')]},'uniqueid':{'type':Sequelize[_0xc356('0x2')]}}; \ No newline at end of file +var _0x01ba=['duration','talk:[inbound,\x20outbound],\x20pause:[reason]','talk:[start]','talk:[destination]','talk:[dial\x20string]','sequelize','moment','exports','STRING','LOGIN,\x20PAUSE,\x20TALKING','INTEGER','DATE','getDataValue','enterAt','seconds','setDataValue'];(function(_0x28aaee,_0x417819){var _0x36fadb=function(_0x39a0fb){while(--_0x39a0fb){_0x28aaee['push'](_0x28aaee['shift']());}};_0x36fadb(++_0x417819);}(_0x01ba,0x135));var _0xa01b=function(_0x25b676,_0x2dd8d6){_0x25b676=_0x25b676-0x0;var _0x4284c5=_0x01ba[_0x25b676];return _0x4284c5;};'use strict';var Sequelize=require(_0xa01b('0x0'));var moment=require(_0xa01b('0x1'));module[_0xa01b('0x2')]={'channel':{'type':Sequelize[_0xa01b('0x3')]},'membername':{'type':Sequelize[_0xa01b('0x3')]},'interface':{'type':Sequelize['STRING']},'type':{'type':Sequelize['STRING'],'defaultValue':'DEFAULT\x20PAUSE','comment':_0xa01b('0x4')},'duration':{'type':Sequelize[_0xa01b('0x5')]},'enterAt':{'type':Sequelize[_0xa01b('0x6')]},'exitAt':{'type':Sequelize[_0xa01b('0x6')],'set':function(_0x4b58f5){var _0x5e261c=moment(_0x4b58f5);var _0x51d4be=moment(this[_0xa01b('0x7')](_0xa01b('0x8')));var _0x5f3817=_0x5e261c['diff'](_0x51d4be,_0xa01b('0x9'));this[_0xa01b('0xa')]('exitAt',_0x4b58f5);this[_0xa01b('0xa')](_0xa01b('0xb'),_0x5f3817>=0x0?_0x5f3817:null);}},'data1':{'type':Sequelize[_0xa01b('0x3')],'comment':_0xa01b('0xc')},'data2':{'type':Sequelize[_0xa01b('0x3')],'comment':_0xa01b('0xd')},'data3':{'type':Sequelize[_0xa01b('0x3')],'comment':_0xa01b('0xe')},'data4':{'type':Sequelize[_0xa01b('0x3')],'comment':_0xa01b('0xf')},'data5':{'type':Sequelize[_0xa01b('0x3')],'comment':'talk:[queue]'},'role':{'type':Sequelize[_0xa01b('0x3')]},'internal':{'type':Sequelize['INTEGER']},'uniqueid':{'type':Sequelize[_0xa01b('0x3')]}}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.controller.js b/server/api/memberReport/memberReport.controller.js index 139fdb5..02d1bc3 100644 --- a/server/api/memberReport/memberReport.controller.js +++ b/server/api/memberReport/memberReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x55ca=['merge','filter','includeAll','include','findAll','rawAttributes','options','create','body','find','params','catch','destroy','describe','eml-format','rimraf','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','reject','update','then','end','sendStatus','error','stack','name','send','index','map','MemberReport','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','where'];(function(_0x8c43de,_0x90ff31){var _0xa6591b=function(_0x469716){while(--_0x469716){_0x8c43de['push'](_0x8c43de['shift']());}};_0xa6591b(++_0x90ff31);}(_0x55ca,0x126));var _0xa55c=function(_0x3d1996,_0x1f08f0){_0x3d1996=_0x3d1996-0x0;var _0x550afd=_0x55ca[_0x3d1996];return _0x550afd;};'use strict';var emlformat=require(_0xa55c('0x0'));var rimraf=require(_0xa55c('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xa55c('0x2'));var BPromise=require(_0xa55c('0x3'));var Mustache=require('mustache');var util=require(_0xa55c('0x4'));var path=require(_0xa55c('0x5'));var sox=require(_0xa55c('0x6'));var csv=require(_0xa55c('0x7'));var ejs=require(_0xa55c('0x8'));var fs=require('fs');var fs_extra=require(_0xa55c('0x9'));var _=require(_0xa55c('0xa'));var squel=require('squel');var crypto=require(_0xa55c('0xb'));var jsforce=require(_0xa55c('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa55c('0x7'));var querystring=require(_0xa55c('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa55c('0xe'));var qs=require(_0xa55c('0xf'));var as=require(_0xa55c('0x10'));var hardwareService=require(_0xa55c('0x11'));var logger=require(_0xa55c('0x12'))(_0xa55c('0x13'));var utils=require(_0xa55c('0x14'));var config=require(_0xa55c('0x15'));var licenseUtil=require(_0xa55c('0x16'));var db=require(_0xa55c('0x17'))['db'];function respondWithStatusCode(_0x5d47ff,_0x59d84a){_0x59d84a=_0x59d84a||0xcc;return function(_0x2a35be){if(_0x2a35be){return _0x5d47ff['sendStatus'](_0x59d84a);}return _0x5d47ff['status'](_0x59d84a)['end']();};}function respondWithResult(_0x18ee85,_0x3930e4){_0x3930e4=_0x3930e4||0xc8;return function(_0x462cd6){if(_0x462cd6){return _0x18ee85[_0xa55c('0x18')](_0x3930e4)[_0xa55c('0x19')](_0x462cd6);}};}function respondWithFilteredResult(_0x247e77,_0x4e0b2f){return function(_0x3ccf65){if(_0x3ccf65){var _0x3dcf4f=typeof _0x4e0b2f[_0xa55c('0x1a')]===_0xa55c('0x1b')&&typeof _0x4e0b2f[_0xa55c('0x1c')]===_0xa55c('0x1b');var _0x51590e=_0x3ccf65[_0xa55c('0x1d')];var _0x24783b=_0x3dcf4f?0x0:_0x4e0b2f['offset'];var _0x3d4c9e=_0x3dcf4f?_0x3ccf65[_0xa55c('0x1d')]:_0x4e0b2f[_0xa55c('0x1a')]+_0x4e0b2f[_0xa55c('0x1c')];var _0x23a1ae;if(_0x3d4c9e>=_0x51590e){_0x3d4c9e=_0x51590e;_0x23a1ae=0xc8;}else{_0x23a1ae=0xce;}_0x247e77[_0xa55c('0x18')](_0x23a1ae);return _0x247e77['set']('Content-Range',_0x24783b+'-'+_0x3d4c9e+'/'+_0x51590e)[_0xa55c('0x19')](_0x3ccf65);}return null;};}function patchUpdates(_0x3776ac){return function(_0xade4c4){try{jsonpatch['apply'](_0xade4c4,_0x3776ac,!![]);}catch(_0x383d92){return BPromise[_0xa55c('0x1e')](_0x383d92);}return _0xade4c4['save']();};}function saveUpdates(_0x187a87,_0x133096){return function(_0x940f28){if(_0x940f28){return _0x940f28[_0xa55c('0x1f')](_0x187a87)[_0xa55c('0x20')](function(_0x49ed04){return _0x49ed04;});}return null;};}function removeEntity(_0x1fc828,_0x504c24){return function(_0x5ba836){if(_0x5ba836){return _0x5ba836['destroy']()[_0xa55c('0x20')](function(){_0x1fc828['status'](0xcc)[_0xa55c('0x21')]();});}};}function handleEntityNotFound(_0x190757,_0x3f64de){return function(_0xf0e574){if(!_0xf0e574){_0x190757[_0xa55c('0x22')](0x194);}return _0xf0e574;};}function handleError(_0x170ba4,_0x1da633){_0x1da633=_0x1da633||0x1f4;return function(_0x11e7f7){logger[_0xa55c('0x23')](_0x11e7f7[_0xa55c('0x24')]);if(_0x11e7f7[_0xa55c('0x25')]){delete _0x11e7f7['name'];}_0x170ba4[_0xa55c('0x18')](_0x1da633)[_0xa55c('0x26')](_0x11e7f7);};}exports[_0xa55c('0x27')]=function(_0x906caa,_0x5d940d){var _0x1377b0={},_0x22f6b6={},_0x1b8388={'count':0x0,'rows':[]};var _0x201941=_[_0xa55c('0x28')](db[_0xa55c('0x29')]['rawAttributes'],function(_0x23e698){return{'name':_0x23e698['fieldName'],'type':_0x23e698[_0xa55c('0x2a')][_0xa55c('0x2b')]};});_0x22f6b6[_0xa55c('0x2c')]=_[_0xa55c('0x28')](_0x201941,'name');_0x22f6b6[_0xa55c('0x2d')]=_[_0xa55c('0x2e')](_0x906caa[_0xa55c('0x2d')]);_0x22f6b6[_0xa55c('0x2f')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],_0x22f6b6[_0xa55c('0x2d')]);_0x1377b0[_0xa55c('0x31')]=_[_0xa55c('0x30')](_0x22f6b6[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x906caa['query']['fields']));_0x1377b0[_0xa55c('0x31')]=_0x1377b0[_0xa55c('0x31')]['length']?_0x1377b0[_0xa55c('0x31')]:_0x22f6b6[_0xa55c('0x2c')];if(!_0x906caa[_0xa55c('0x2d')][_0xa55c('0x33')](_0xa55c('0x34'))){_0x1377b0[_0xa55c('0x1c')]=qs[_0xa55c('0x1c')](_0x906caa[_0xa55c('0x2d')][_0xa55c('0x1c')]);_0x1377b0['offset']=qs['offset'](_0x906caa['query'][_0xa55c('0x1a')]);}_0x1377b0[_0xa55c('0x35')]=qs[_0xa55c('0x36')](_0x906caa['query'][_0xa55c('0x36')]);_0x1377b0['where']=qs[_0xa55c('0x2f')](_['pick'](_0x906caa[_0xa55c('0x2d')],_0x22f6b6[_0xa55c('0x2f')]),_0x201941);if(_0x906caa[_0xa55c('0x2d')]['filter']){_0x1377b0[_0xa55c('0x37')]=_[_0xa55c('0x38')](_0x1377b0['where'],{'$or':_[_0xa55c('0x28')](_0x201941,function(_0x194e78){if(_0x194e78['type']!=='VIRTUAL'){var _0x235f6b={};_0x235f6b[_0x194e78['name']]={'$like':'%'+_0x906caa[_0xa55c('0x2d')][_0xa55c('0x39')]+'%'};return _0x235f6b;}})});}_0x1377b0=_['merge']({},_0x1377b0,_0x906caa['options']);var _0x5e50b6={'where':_0x1377b0['where']};return db[_0xa55c('0x29')][_0xa55c('0x1d')](_0x5e50b6)[_0xa55c('0x20')](function(_0x99c4f8){_0x1b8388[_0xa55c('0x1d')]=_0x99c4f8;if(_0x906caa['query'][_0xa55c('0x3a')]){_0x1377b0[_0xa55c('0x3b')]=[{'all':!![]}];}return db[_0xa55c('0x29')][_0xa55c('0x3c')](_0x1377b0);})[_0xa55c('0x20')](function(_0x23cef5){_0x1b8388['rows']=_0x23cef5;return _0x1b8388;})[_0xa55c('0x20')](respondWithFilteredResult(_0x5d940d,_0x1377b0))['catch'](handleError(_0x5d940d,null));};exports['show']=function(_0x404e7f,_0x1f63d8){var _0x496920={'raw':!![],'where':{'id':_0x404e7f['params']['id']}},_0x2bd98b={};_0x2bd98b['model']=_[_0xa55c('0x2e')](db[_0xa55c('0x29')][_0xa55c('0x3d')]);_0x2bd98b['query']=_[_0xa55c('0x2e')](_0x404e7f[_0xa55c('0x2d')]);_0x2bd98b['filters']=_[_0xa55c('0x30')](_0x2bd98b['model'],_0x2bd98b[_0xa55c('0x2d')]);_0x496920[_0xa55c('0x31')]=_['intersection'](_0x2bd98b[_0xa55c('0x2c')],qs[_0xa55c('0x32')](_0x404e7f['query'][_0xa55c('0x32')]));_0x496920[_0xa55c('0x31')]=_0x496920[_0xa55c('0x31')]['length']?_0x496920[_0xa55c('0x31')]:_0x2bd98b['model'];if(_0x404e7f[_0xa55c('0x2d')][_0xa55c('0x3a')]){_0x496920[_0xa55c('0x3b')]=[{'all':!![]}];}_0x496920=_['merge']({},_0x496920,_0x404e7f[_0xa55c('0x3e')]);return db[_0xa55c('0x29')]['find'](_0x496920)[_0xa55c('0x20')](handleEntityNotFound(_0x1f63d8,null))[_0xa55c('0x20')](respondWithResult(_0x1f63d8,null))['catch'](handleError(_0x1f63d8,null));};exports[_0xa55c('0x3f')]=function(_0xd3fe78,_0x52f9a7){return db[_0xa55c('0x29')][_0xa55c('0x3f')](_0xd3fe78[_0xa55c('0x40')],{})[_0xa55c('0x20')](respondWithResult(_0x52f9a7,0xc9))['catch'](handleError(_0x52f9a7,null));};exports[_0xa55c('0x1f')]=function(_0x58a7ea,_0x2157d6){if(_0x58a7ea[_0xa55c('0x40')]['id']){delete _0x58a7ea[_0xa55c('0x40')]['id'];}return db['MemberReport'][_0xa55c('0x41')]({'where':{'id':_0x58a7ea[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x2157d6,null))[_0xa55c('0x20')](saveUpdates(_0x58a7ea[_0xa55c('0x40')],null))[_0xa55c('0x20')](respondWithResult(_0x2157d6,null))[_0xa55c('0x43')](handleError(_0x2157d6,null));};exports[_0xa55c('0x44')]=function(_0x1c84d9,_0x1e1293){return db[_0xa55c('0x29')][_0xa55c('0x41')]({'where':{'id':_0x1c84d9[_0xa55c('0x42')]['id']}})['then'](handleEntityNotFound(_0x1e1293,null))[_0xa55c('0x20')](removeEntity(_0x1e1293,null))[_0xa55c('0x43')](handleError(_0x1e1293,null));};exports[_0xa55c('0x45')]=function(_0x4f73b6,_0x4c3095){return db[_0xa55c('0x29')]['describe']()[_0xa55c('0x20')](respondWithResult(_0x4c3095,null))['catch'](handleError(_0x4c3095,null));}; \ No newline at end of file +var _0x34e8=['path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','save','update','then','destroy','error','stack','name','map','MemberReport','rawAttributes','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','pick','filter','merge','options','includeAll','catch','show','params','keys','include','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util'];(function(_0x1e381c,_0x47b5b9){var _0x9b5ea9=function(_0x6d2be5){while(--_0x6d2be5){_0x1e381c['push'](_0x1e381c['shift']());}};_0x9b5ea9(++_0x47b5b9);}(_0x34e8,0x12c));var _0x834e=function(_0x48b7cb,_0x22ac11){_0x48b7cb=_0x48b7cb-0x0;var _0x51094b=_0x34e8[_0x48b7cb];return _0x51094b;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e5b6d,_0x6cd9b9){_0x6cd9b9=_0x6cd9b9||0xcc;return function(_0x58a27e){if(_0x58a27e){return _0x5e5b6d[_0x834e('0x1c')](_0x6cd9b9);}return _0x5e5b6d[_0x834e('0x1d')](_0x6cd9b9)[_0x834e('0x1e')]();};}function respondWithResult(_0x21cc0a,_0x50e860){_0x50e860=_0x50e860||0xc8;return function(_0x43156c){if(_0x43156c){return _0x21cc0a[_0x834e('0x1d')](_0x50e860)['json'](_0x43156c);}};}function respondWithFilteredResult(_0x316205,_0x4a9cdc){return function(_0x38a8cd){if(_0x38a8cd){var _0x36d443=typeof _0x4a9cdc['offset']===_0x834e('0x1f')&&typeof _0x4a9cdc[_0x834e('0x20')]===_0x834e('0x1f');var _0x50b3f6=_0x38a8cd[_0x834e('0x21')];var _0x211e9a=_0x36d443?0x0:_0x4a9cdc[_0x834e('0x22')];var _0xb993a1=_0x36d443?_0x38a8cd[_0x834e('0x21')]:_0x4a9cdc[_0x834e('0x22')]+_0x4a9cdc[_0x834e('0x20')];var _0x595515;if(_0xb993a1>=_0x50b3f6){_0xb993a1=_0x50b3f6;_0x595515=0xc8;}else{_0x595515=0xce;}_0x316205[_0x834e('0x1d')](_0x595515);return _0x316205[_0x834e('0x23')](_0x834e('0x24'),_0x211e9a+'-'+_0xb993a1+'/'+_0x50b3f6)[_0x834e('0x25')](_0x38a8cd);}return null;};}function patchUpdates(_0x4ab05d){return function(_0x45a630){try{jsonpatch[_0x834e('0x26')](_0x45a630,_0x4ab05d,!![]);}catch(_0x5a05c0){return BPromise[_0x834e('0x27')](_0x5a05c0);}return _0x45a630[_0x834e('0x28')]();};}function saveUpdates(_0x8d406e,_0x5c55ca){return function(_0x4e3f48){if(_0x4e3f48){return _0x4e3f48[_0x834e('0x29')](_0x8d406e)[_0x834e('0x2a')](function(_0x589dde){return _0x589dde;});}return null;};}function removeEntity(_0x25ee1d,_0x1dc1e0){return function(_0x58f4fd){if(_0x58f4fd){return _0x58f4fd[_0x834e('0x2b')]()[_0x834e('0x2a')](function(){_0x25ee1d[_0x834e('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x24fcf7,_0x3e310f){return function(_0x5e1cc5){if(!_0x5e1cc5){_0x24fcf7['sendStatus'](0x194);}return _0x5e1cc5;};}function handleError(_0x1e713a,_0x508a1d){_0x508a1d=_0x508a1d||0x1f4;return function(_0x2826ec){logger[_0x834e('0x2c')](_0x2826ec[_0x834e('0x2d')]);if(_0x2826ec[_0x834e('0x2e')]){delete _0x2826ec[_0x834e('0x2e')];}_0x1e713a[_0x834e('0x1d')](_0x508a1d)['send'](_0x2826ec);};}exports['index']=function(_0x4dc64a,_0x58c1d7){var _0x2c7a8d={},_0x567cea={},_0x106d6a={'count':0x0,'rows':[]};var _0x5dacc1=_[_0x834e('0x2f')](db[_0x834e('0x30')][_0x834e('0x31')],function(_0x1e026a){return{'name':_0x1e026a[_0x834e('0x32')],'type':_0x1e026a[_0x834e('0x33')][_0x834e('0x34')]};});_0x567cea[_0x834e('0x35')]=_[_0x834e('0x2f')](_0x5dacc1,'name');_0x567cea[_0x834e('0x36')]=_['keys'](_0x4dc64a[_0x834e('0x36')]);_0x567cea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],_0x567cea[_0x834e('0x36')]);_0x2c7a8d[_0x834e('0x39')]=_[_0x834e('0x38')](_0x567cea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x4dc64a[_0x834e('0x36')]['fields']));_0x2c7a8d[_0x834e('0x39')]=_0x2c7a8d[_0x834e('0x39')][_0x834e('0x3b')]?_0x2c7a8d[_0x834e('0x39')]:_0x567cea['model'];if(!_0x4dc64a[_0x834e('0x36')][_0x834e('0x3c')]('nolimit')){_0x2c7a8d['limit']=qs['limit'](_0x4dc64a[_0x834e('0x36')][_0x834e('0x20')]);_0x2c7a8d[_0x834e('0x22')]=qs[_0x834e('0x22')](_0x4dc64a[_0x834e('0x36')][_0x834e('0x22')]);}_0x2c7a8d['order']=qs[_0x834e('0x3d')](_0x4dc64a['query'][_0x834e('0x3d')]);_0x2c7a8d[_0x834e('0x3e')]=qs['filters'](_[_0x834e('0x3f')](_0x4dc64a[_0x834e('0x36')],_0x567cea['filters']),_0x5dacc1);if(_0x4dc64a['query'][_0x834e('0x40')]){_0x2c7a8d[_0x834e('0x3e')]=_[_0x834e('0x41')](_0x2c7a8d[_0x834e('0x3e')],{'$or':_[_0x834e('0x2f')](_0x5dacc1,function(_0x4ca43c){if(_0x4ca43c[_0x834e('0x33')]!=='VIRTUAL'){var _0x50c243={};_0x50c243[_0x4ca43c[_0x834e('0x2e')]]={'$like':'%'+_0x4dc64a['query'][_0x834e('0x40')]+'%'};return _0x50c243;}})});}_0x2c7a8d=_[_0x834e('0x41')]({},_0x2c7a8d,_0x4dc64a[_0x834e('0x42')]);var _0x3c59af={'where':_0x2c7a8d[_0x834e('0x3e')]};return db['MemberReport'][_0x834e('0x21')](_0x3c59af)[_0x834e('0x2a')](function(_0x38f266){_0x106d6a['count']=_0x38f266;if(_0x4dc64a[_0x834e('0x36')][_0x834e('0x43')]){_0x2c7a8d['include']=[{'all':!![]}];}return db[_0x834e('0x30')]['findAll'](_0x2c7a8d);})[_0x834e('0x2a')](function(_0x585335){_0x106d6a['rows']=_0x585335;return _0x106d6a;})['then'](respondWithFilteredResult(_0x58c1d7,_0x2c7a8d))[_0x834e('0x44')](handleError(_0x58c1d7,null));};exports[_0x834e('0x45')]=function(_0x3bcbf4,_0xbc1571){var _0x8ad264={'raw':!![],'where':{'id':_0x3bcbf4[_0x834e('0x46')]['id']}},_0x23feea={};_0x23feea['model']=_[_0x834e('0x47')](db['MemberReport'][_0x834e('0x31')]);_0x23feea['query']=_[_0x834e('0x47')](_0x3bcbf4['query']);_0x23feea[_0x834e('0x37')]=_[_0x834e('0x38')](_0x23feea['model'],_0x23feea[_0x834e('0x36')]);_0x8ad264[_0x834e('0x39')]=_[_0x834e('0x38')](_0x23feea[_0x834e('0x35')],qs[_0x834e('0x3a')](_0x3bcbf4[_0x834e('0x36')][_0x834e('0x3a')]));_0x8ad264[_0x834e('0x39')]=_0x8ad264[_0x834e('0x39')][_0x834e('0x3b')]?_0x8ad264['attributes']:_0x23feea[_0x834e('0x35')];if(_0x3bcbf4[_0x834e('0x36')]['includeAll']){_0x8ad264[_0x834e('0x48')]=[{'all':!![]}];}_0x8ad264=_[_0x834e('0x41')]({},_0x8ad264,_0x3bcbf4[_0x834e('0x42')]);return db[_0x834e('0x30')][_0x834e('0x49')](_0x8ad264)[_0x834e('0x2a')](handleEntityNotFound(_0xbc1571,null))['then'](respondWithResult(_0xbc1571,null))['catch'](handleError(_0xbc1571,null));};exports[_0x834e('0x4a')]=function(_0x1a5444,_0x30568e){return db[_0x834e('0x30')][_0x834e('0x4a')](_0x1a5444[_0x834e('0x4b')],{})[_0x834e('0x2a')](respondWithResult(_0x30568e,0xc9))[_0x834e('0x44')](handleError(_0x30568e,null));};exports[_0x834e('0x29')]=function(_0x390c45,_0xf02f0d){if(_0x390c45[_0x834e('0x4b')]['id']){delete _0x390c45[_0x834e('0x4b')]['id'];}return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x390c45[_0x834e('0x46')]['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0xf02f0d,null))[_0x834e('0x2a')](saveUpdates(_0x390c45[_0x834e('0x4b')],null))[_0x834e('0x2a')](respondWithResult(_0xf02f0d,null))['catch'](handleError(_0xf02f0d,null));};exports[_0x834e('0x2b')]=function(_0x1f08b9,_0x4e73e0){return db[_0x834e('0x30')][_0x834e('0x49')]({'where':{'id':_0x1f08b9['params']['id']}})[_0x834e('0x2a')](handleEntityNotFound(_0x4e73e0,null))[_0x834e('0x2a')](removeEntity(_0x4e73e0,null))[_0x834e('0x44')](handleError(_0x4e73e0,null));};exports[_0x834e('0x4c')]=function(_0x4288e4,_0xb77aab){return db[_0x834e('0x30')]['describe']()[_0x834e('0x2a')](respondWithResult(_0xb77aab,null))[_0x834e('0x44')](handleError(_0xb77aab,null));}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.model.js b/server/api/memberReport/memberReport.model.js index 9ad3465..28b384e 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 _0x5e61=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./memberReport.attributes','define','MemberReport','membername_interface','interface'];(function(_0xbac4d6,_0x2ad886){var _0x490136=function(_0x1dc185){while(--_0x1dc185){_0xbac4d6['push'](_0xbac4d6['shift']());}};_0x490136(++_0x2ad886);}(_0x5e61,0x1e0));var _0x15e6=function(_0x3fe5f5,_0x374689){_0x3fe5f5=_0x3fe5f5-0x0;var _0x2d9c4e=_0x5e61[_0x3fe5f5];return _0x2d9c4e;};'use strict';var _=require(_0x15e6('0x0'));var util=require(_0x15e6('0x1'));var logger=require(_0x15e6('0x2'))(_0x15e6('0x3'));var moment=require(_0x15e6('0x4'));var BPromise=require(_0x15e6('0x5'));var rp=require(_0x15e6('0x6'));var fs=require('fs');var path=require(_0x15e6('0x7'));var rimraf=require(_0x15e6('0x8'));var config=require(_0x15e6('0x9'));var attributes=require(_0x15e6('0xa'));module['exports']=function(_0x5daa6a,_0x382aff){return _0x5daa6a[_0x15e6('0xb')](_0x15e6('0xc'),attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x15e6('0xd'),'fields':['membername',_0x15e6('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xc0f4=['membername','interface','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','./memberReport.attributes','exports','define','membername_interface'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0xc0f4,0x16e));var _0x4c0f=function(_0x5d24a7,_0x6b5670){_0x5d24a7=_0x5d24a7-0x0;var _0x35d15d=_0xc0f4[_0x5d24a7];return _0x35d15d;};'use strict';var _=require(_0x4c0f('0x0'));var util=require(_0x4c0f('0x1'));var logger=require(_0x4c0f('0x2'))(_0x4c0f('0x3'));var moment=require(_0x4c0f('0x4'));var BPromise=require('bluebird');var rp=require(_0x4c0f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x4c0f('0x6'));var config=require(_0x4c0f('0x7'));var attributes=require(_0x4c0f('0x8'));module[_0x4c0f('0x9')]=function(_0x4ec2bd,_0x123d70){return _0x4ec2bd[_0x4c0f('0xa')]('MemberReport',attributes,{'tableName':'report_member','paranoid':![],'indexes':[{'name':_0x4c0f('0xb'),'fields':[_0x4c0f('0xc'),_0x4c0f('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/memberReport/memberReport.rpc.js b/server/api/memberReport/memberReport.rpc.js index ca900ba..4153a2f 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 _0x0b3d=['result','GetMemberReport','MemberReport','options','raw','where','attributes','limit','map','include','model','then','CreateMemberReport','create','body','catch','UpdateMemberReport','update','debug','lodash','moment','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','MemberReport,\x20%s,\x20%s','request\x20sent','stringify','error','message','info'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0x0b3d,0x76));var _0xd0b3=function(_0x732d54,_0x5708f4){_0x732d54=_0x732d54-0x0;var _0x55e766=_0x0b3d[_0x732d54];return _0x55e766;};'use strict';var _=require(_0xd0b3('0x0'));var util=require('util');var moment=require(_0xd0b3('0x1'));var BPromise=require('bluebird');var rs=require(_0xd0b3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd0b3('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0xd0b3('0x4'))('rpc');var config=require(_0xd0b3('0x5'));var jayson=require(_0xd0b3('0x6'));var client=jayson['client'][_0xd0b3('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5bc883,_0x872957,_0x5f3196){return new BPromise(function(_0x5ab5b2,_0x2f79f7){return client['request'](_0x5bc883,_0x5f3196)['then'](function(_0x7b8b92){logger['info'](_0xd0b3('0x8'),_0x872957,_0xd0b3('0x9'));logger['debug']('MemberReport,\x20%s,\x20%s,\x20%s',_0x872957,_0xd0b3('0x9'),JSON[_0xd0b3('0xa')](_0x7b8b92));if(_0x7b8b92[_0xd0b3('0xb')]){if(_0x7b8b92[_0xd0b3('0xb')]['code']===0x1f4){logger['error'](_0xd0b3('0x8'),_0x872957,_0x7b8b92[_0xd0b3('0xb')][_0xd0b3('0xc')]);return _0x2f79f7(_0x7b8b92[_0xd0b3('0xb')][_0xd0b3('0xc')]);}logger[_0xd0b3('0xb')](_0xd0b3('0x8'),_0x872957,_0x7b8b92['error'][_0xd0b3('0xc')]);return _0x5ab5b2(_0x7b8b92[_0xd0b3('0xb')][_0xd0b3('0xc')]);}else{logger[_0xd0b3('0xd')]('MemberReport,\x20%s,\x20%s',_0x872957,_0xd0b3('0x9'));_0x5ab5b2(_0x7b8b92[_0xd0b3('0xe')][_0xd0b3('0xc')]);}})['catch'](function(_0x537e76){logger[_0xd0b3('0xb')]('MemberReport,\x20%s,\x20%s',_0x872957,_0x537e76);_0x2f79f7(_0x537e76);});});}exports[_0xd0b3('0xf')]=function(_0x232e6a){var _0x5045b4=this;return new Promise(function(_0x4ed917,_0x3fc7be){return db[_0xd0b3('0x10')]['findAll']({'raw':_0x232e6a[_0xd0b3('0x11')]?_0x232e6a[_0xd0b3('0x11')][_0xd0b3('0x12')]===undefined?!![]:![]:!![],'where':_0x232e6a['options']?_0x232e6a['options'][_0xd0b3('0x13')]||null:null,'attributes':_0x232e6a['options']?_0x232e6a[_0xd0b3('0x11')][_0xd0b3('0x14')]||null:null,'limit':_0x232e6a[_0xd0b3('0x11')]?_0x232e6a[_0xd0b3('0x11')][_0xd0b3('0x15')]||null:null,'include':_0x232e6a['options']?_0x232e6a['options']['include']?_[_0xd0b3('0x16')](_0x232e6a[_0xd0b3('0x11')][_0xd0b3('0x17')],function(_0x1bfe7b){return{'model':db[_0x1bfe7b[_0xd0b3('0x18')]],'as':_0x1bfe7b['as'],'attributes':_0x1bfe7b['attributes'],'include':_0x1bfe7b[_0xd0b3('0x17')]?_[_0xd0b3('0x16')](_0x1bfe7b[_0xd0b3('0x17')],function(_0x2e0dcc){return{'model':db[_0x2e0dcc['model']],'as':_0x2e0dcc['as'],'attributes':_0x2e0dcc[_0xd0b3('0x14')],'include':_0x2e0dcc[_0xd0b3('0x17')]?_[_0xd0b3('0x16')](_0x2e0dcc['include'],function(_0x48fb43){return{'model':db[_0x48fb43[_0xd0b3('0x18')]],'as':_0x48fb43['as'],'attributes':_0x48fb43[_0xd0b3('0x14')]};}):[]};}):[]};}):[]:[]})[_0xd0b3('0x19')](function(_0x4d42b4){logger[_0xd0b3('0xd')](_0xd0b3('0xf'),_0x232e6a);logger['debug'](_0xd0b3('0xf'),_0x232e6a,JSON[_0xd0b3('0xa')](_0x4d42b4));_0x4ed917(_0x4d42b4);})['catch'](function(_0x2b2d05){logger['error'](_0xd0b3('0xf'),_0x2b2d05['message'],_0x232e6a);_0x3fc7be(_0x5045b4[_0xd0b3('0xb')](0x1f4,_0x2b2d05[_0xd0b3('0xc')]));});});};exports[_0xd0b3('0x1a')]=function(_0x366931){var _0x23609e=this;return new Promise(function(_0x2f79cd,_0x44e5ad){return db['MemberReport'][_0xd0b3('0x1b')](_0x366931[_0xd0b3('0x1c')],{'raw':_0x366931[_0xd0b3('0x11')]?_0x366931[_0xd0b3('0x11')]['raw']===undefined?!![]:![]:!![]})[_0xd0b3('0x19')](function(_0x246bee){logger[_0xd0b3('0xd')](_0xd0b3('0x1a'),_0x366931);logger['debug'](_0xd0b3('0x1a'),_0x366931,JSON[_0xd0b3('0xa')](_0x246bee));_0x2f79cd(_0x246bee);})[_0xd0b3('0x1d')](function(_0x2f2e00){logger[_0xd0b3('0xb')](_0xd0b3('0x1a'),_0x2f2e00[_0xd0b3('0xc')],_0x366931);_0x44e5ad(_0x23609e[_0xd0b3('0xb')](0x1f4,_0x2f2e00[_0xd0b3('0xc')]));});});};exports[_0xd0b3('0x1e')]=function(_0x22de39){var _0xa53787=this;return new Promise(function(_0x1926ca,_0x1f587f){return db['MemberReport'][_0xd0b3('0x1f')](_0x22de39[_0xd0b3('0x1c')],{'raw':_0x22de39[_0xd0b3('0x11')]?_0x22de39[_0xd0b3('0x11')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x22de39['options']?_0x22de39['options'][_0xd0b3('0x13')]||null:null,'attributes':_0x22de39[_0xd0b3('0x11')]?_0x22de39[_0xd0b3('0x11')][_0xd0b3('0x14')]||null:null,'limit':_0x22de39[_0xd0b3('0x11')]?_0x22de39[_0xd0b3('0x11')]['limit']||null:null})[_0xd0b3('0x19')](function(_0x4504e5){logger[_0xd0b3('0xd')](_0xd0b3('0x1e'),_0x22de39);logger[_0xd0b3('0x20')](_0xd0b3('0x1e'),_0x22de39,JSON[_0xd0b3('0xa')](_0x4504e5));_0x1926ca(_0x4504e5);})[_0xd0b3('0x1d')](function(_0x3be7ee){logger[_0xd0b3('0xb')](_0xd0b3('0x1e'),_0x3be7ee['message'],_0x22de39);_0x1f587f(_0xa53787['error'](0x1f4,_0x3be7ee[_0xd0b3('0xc')]));});});}; \ No newline at end of file +var _0xab36=['where','include','map','model','attributes','stringify','CreateMemberReport','create','body','UpdateMemberReport','update','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','MemberReport,\x20%s,\x20%s','request\x20sent','debug','MemberReport,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetMemberReport','MemberReport','findAll','options','raw'];(function(_0x5426b3,_0x5f38d6){var _0x3746c3=function(_0x19cdc9){while(--_0x19cdc9){_0x5426b3['push'](_0x5426b3['shift']());}};_0x3746c3(++_0x5f38d6);}(_0xab36,0x1df));var _0x6ab3=function(_0xc34e70,_0x559d04){_0xc34e70=_0xc34e70-0x0;var _0x2c000e=_0xab36[_0xc34e70];return _0x2c000e;};'use strict';var _=require(_0x6ab3('0x0'));var util=require(_0x6ab3('0x1'));var moment=require(_0x6ab3('0x2'));var BPromise=require(_0x6ab3('0x3'));var rs=require(_0x6ab3('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6ab3('0x5'))['db'];var utils=require(_0x6ab3('0x6'));var logger=require(_0x6ab3('0x7'))('rpc');var config=require(_0x6ab3('0x8'));var jayson=require(_0x6ab3('0x9'));var client=jayson[_0x6ab3('0xa')][_0x6ab3('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x33fc2a,_0x416eb2,_0x4ba5e3){return new BPromise(function(_0x2a9076,_0x1a795a){return client['request'](_0x33fc2a,_0x4ba5e3)[_0x6ab3('0xc')](function(_0x4b05d5){logger[_0x6ab3('0xd')](_0x6ab3('0xe'),_0x416eb2,_0x6ab3('0xf'));logger[_0x6ab3('0x10')](_0x6ab3('0x11'),_0x416eb2,_0x6ab3('0xf'),JSON['stringify'](_0x4b05d5));if(_0x4b05d5[_0x6ab3('0x12')]){if(_0x4b05d5['error'][_0x6ab3('0x13')]===0x1f4){logger[_0x6ab3('0x12')](_0x6ab3('0xe'),_0x416eb2,_0x4b05d5[_0x6ab3('0x12')][_0x6ab3('0x14')]);return _0x1a795a(_0x4b05d5['error'][_0x6ab3('0x14')]);}logger[_0x6ab3('0x12')](_0x6ab3('0xe'),_0x416eb2,_0x4b05d5[_0x6ab3('0x12')][_0x6ab3('0x14')]);return _0x2a9076(_0x4b05d5['error'][_0x6ab3('0x14')]);}else{logger['info'](_0x6ab3('0xe'),_0x416eb2,_0x6ab3('0xf'));_0x2a9076(_0x4b05d5[_0x6ab3('0x15')][_0x6ab3('0x14')]);}})[_0x6ab3('0x16')](function(_0x32dd54){logger[_0x6ab3('0x12')](_0x6ab3('0xe'),_0x416eb2,_0x32dd54);_0x1a795a(_0x32dd54);});});}exports[_0x6ab3('0x17')]=function(_0x586dcb){var _0x99ef3d=this;return new Promise(function(_0x5db46c,_0x8af982){return db[_0x6ab3('0x18')][_0x6ab3('0x19')]({'raw':_0x586dcb[_0x6ab3('0x1a')]?_0x586dcb[_0x6ab3('0x1a')][_0x6ab3('0x1b')]===undefined?!![]:![]:!![],'where':_0x586dcb[_0x6ab3('0x1a')]?_0x586dcb['options'][_0x6ab3('0x1c')]||null:null,'attributes':_0x586dcb[_0x6ab3('0x1a')]?_0x586dcb[_0x6ab3('0x1a')]['attributes']||null:null,'limit':_0x586dcb[_0x6ab3('0x1a')]?_0x586dcb['options']['limit']||null:null,'include':_0x586dcb[_0x6ab3('0x1a')]?_0x586dcb['options'][_0x6ab3('0x1d')]?_[_0x6ab3('0x1e')](_0x586dcb[_0x6ab3('0x1a')][_0x6ab3('0x1d')],function(_0x344e9f){return{'model':db[_0x344e9f[_0x6ab3('0x1f')]],'as':_0x344e9f['as'],'attributes':_0x344e9f[_0x6ab3('0x20')],'include':_0x344e9f[_0x6ab3('0x1d')]?_[_0x6ab3('0x1e')](_0x344e9f[_0x6ab3('0x1d')],function(_0x16cfb2){return{'model':db[_0x16cfb2[_0x6ab3('0x1f')]],'as':_0x16cfb2['as'],'attributes':_0x16cfb2[_0x6ab3('0x20')],'include':_0x16cfb2[_0x6ab3('0x1d')]?_['map'](_0x16cfb2[_0x6ab3('0x1d')],function(_0x554cf0){return{'model':db[_0x554cf0[_0x6ab3('0x1f')]],'as':_0x554cf0['as'],'attributes':_0x554cf0[_0x6ab3('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6ab3('0xc')](function(_0x2c5692){logger[_0x6ab3('0xd')](_0x6ab3('0x17'),_0x586dcb);logger['debug']('GetMemberReport',_0x586dcb,JSON[_0x6ab3('0x21')](_0x2c5692));_0x5db46c(_0x2c5692);})['catch'](function(_0x5370d7){logger[_0x6ab3('0x12')](_0x6ab3('0x17'),_0x5370d7[_0x6ab3('0x14')],_0x586dcb);_0x8af982(_0x99ef3d[_0x6ab3('0x12')](0x1f4,_0x5370d7[_0x6ab3('0x14')]));});});};exports[_0x6ab3('0x22')]=function(_0x345b14){var _0x376e4f=this;return new Promise(function(_0x5d109e,_0x340a6d){return db[_0x6ab3('0x18')][_0x6ab3('0x23')](_0x345b14[_0x6ab3('0x24')],{'raw':_0x345b14[_0x6ab3('0x1a')]?_0x345b14[_0x6ab3('0x1a')][_0x6ab3('0x1b')]===undefined?!![]:![]:!![]})[_0x6ab3('0xc')](function(_0x5c7b3e){logger[_0x6ab3('0xd')]('CreateMemberReport',_0x345b14);logger['debug'](_0x6ab3('0x22'),_0x345b14,JSON['stringify'](_0x5c7b3e));_0x5d109e(_0x5c7b3e);})[_0x6ab3('0x16')](function(_0xec01b7){logger[_0x6ab3('0x12')](_0x6ab3('0x22'),_0xec01b7[_0x6ab3('0x14')],_0x345b14);_0x340a6d(_0x376e4f[_0x6ab3('0x12')](0x1f4,_0xec01b7[_0x6ab3('0x14')]));});});};exports[_0x6ab3('0x25')]=function(_0x1e24f7){var _0x1ff824=this;return new Promise(function(_0x4a4737,_0x22e39a){return db[_0x6ab3('0x18')][_0x6ab3('0x26')](_0x1e24f7['body'],{'raw':_0x1e24f7[_0x6ab3('0x1a')]?_0x1e24f7[_0x6ab3('0x1a')][_0x6ab3('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1e24f7[_0x6ab3('0x1a')]?_0x1e24f7[_0x6ab3('0x1a')][_0x6ab3('0x1c')]||null:null,'attributes':_0x1e24f7['options']?_0x1e24f7[_0x6ab3('0x1a')]['attributes']||null:null,'limit':_0x1e24f7[_0x6ab3('0x1a')]?_0x1e24f7[_0x6ab3('0x1a')]['limit']||null:null})[_0x6ab3('0xc')](function(_0x33c9dc){logger['info']('UpdateMemberReport',_0x1e24f7);logger[_0x6ab3('0x10')]('UpdateMemberReport',_0x1e24f7,JSON[_0x6ab3('0x21')](_0x33c9dc));_0x4a4737(_0x33c9dc);})[_0x6ab3('0x16')](function(_0x571a4c){logger['error'](_0x6ab3('0x25'),_0x571a4c[_0x6ab3('0x14')],_0x1e24f7);_0x22e39a(_0x1ff824['error'](0x1f4,_0x571a4c['message']));});});}; \ No newline at end of file diff --git a/server/api/migration/index.js b/server/api/migration/index.js index 1ed5ae3..6c7e6d8 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 _0x120b=['multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./migration.controller','get','index','exports'];(function(_0x21fe10,_0x184540){var _0x255397=function(_0x43c663){while(--_0x43c663){_0x21fe10['push'](_0x21fe10['shift']());}};_0x255397(++_0x184540);}(_0x120b,0x8f));var _0xb120=function(_0x528001,_0x1f0b84){_0x528001=_0x528001-0x0;var _0x2823f2=_0x120b[_0x528001];return _0x2823f2;};'use strict';var multer=require(_0xb120('0x0'));var util=require(_0xb120('0x1'));var path=require('path');var timeout=require(_0xb120('0x2'));var express=require(_0xb120('0x3'));var router=express[_0xb120('0x4')]();var fs_extra=require(_0xb120('0x5'));var auth=require(_0xb120('0x6'));var interaction=require(_0xb120('0x7'));var config=require(_0xb120('0x8'));var controller=require(_0xb120('0x9'));router[_0xb120('0xa')]('/',controller[_0xb120('0xb')]);module[_0xb120('0xc')]=router; \ No newline at end of file +var _0xd981=['Router','fs-extra','../../config/environment','./migration.controller','index','multer','connect-timeout','express'];(function(_0x590d33,_0x2595bf){var _0x49afa3=function(_0x23cd41){while(--_0x23cd41){_0x590d33['push'](_0x590d33['shift']());}};_0x49afa3(++_0x2595bf);}(_0xd981,0x1ad));var _0x1d98=function(_0x32c8c2,_0x5e0ab0){_0x32c8c2=_0x32c8c2-0x0;var _0x16ed42=_0xd981[_0x32c8c2];return _0x16ed42;};'use strict';var multer=require(_0x1d98('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x1d98('0x1'));var express=require(_0x1d98('0x2'));var router=express[_0x1d98('0x3')]();var fs_extra=require(_0x1d98('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x1d98('0x5'));var controller=require(_0x1d98('0x6'));router['get']('/',controller[_0x1d98('0x7')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/migration/migration.attributes.js b/server/api/migration/migration.attributes.js index 0d7ef1a..ea96e08 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 _0xbd50=['exports','STRING','version'];(function(_0x402ad2,_0x4f1ac0){var _0x5de770=function(_0x5f299c){while(--_0x5f299c){_0x402ad2['push'](_0x402ad2['shift']());}};_0x5de770(++_0x4f1ac0);}(_0xbd50,0xc3));var _0x0bd5=function(_0x11cb91,_0x5ef17c){_0x11cb91=_0x11cb91-0x0;var _0x2bc42f=_0xbd50[_0x11cb91];return _0x2bc42f;};'use strict';var Sequelize=require('sequelize');module[_0x0bd5('0x0')]={'version':{'type':Sequelize[_0x0bd5('0x1')],'unique':_0x0bd5('0x2')}}; \ No newline at end of file +var _0x6c70=['version','sequelize','STRING'];(function(_0x471d38,_0x100a89){var _0x3f613c=function(_0x413271){while(--_0x413271){_0x471d38['push'](_0x471d38['shift']());}};_0x3f613c(++_0x100a89);}(_0x6c70,0xd6));var _0x06c7=function(_0x1b5aea,_0x3f04b7){_0x1b5aea=_0x1b5aea-0x0;var _0x15cfc6=_0x6c70[_0x1b5aea];return _0x15cfc6;};'use strict';var Sequelize=require(_0x06c7('0x0'));module['exports']={'version':{'type':Sequelize[_0x06c7('0x1')],'unique':_0x06c7('0x2')}}; \ No newline at end of file diff --git a/server/api/migration/migration.controller.js b/server/api/migration/migration.controller.js index f7ccbbf..51fb11e 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 _0xc592=['../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','limit','undefined','count','status','set','Content-Range','apply','reject','save','update','then','error','stack','name','index','map','Migration','rawAttributes','fieldName','type','key','keys','query','intersection','model','attributes','length','nolimit','sort','where','filters','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service'];(function(_0x4856eb,_0x159ef9){var _0x59377f=function(_0x1026cd){while(--_0x1026cd){_0x4856eb['push'](_0x4856eb['shift']());}};_0x59377f(++_0x159ef9);}(_0xc592,0x18c));var _0x2c59=function(_0x1ab92c,_0x369d5a){_0x1ab92c=_0x1ab92c-0x0;var _0x300e70=_0xc592[_0x1ab92c];return _0x300e70;};'use strict';var emlformat=require(_0x2c59('0x0'));var rimraf=require(_0x2c59('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2c59('0x2'));var rp=require('request-promise');var moment=require(_0x2c59('0x3'));var BPromise=require(_0x2c59('0x4'));var Mustache=require(_0x2c59('0x5'));var util=require(_0x2c59('0x6'));var path=require(_0x2c59('0x7'));var sox=require(_0x2c59('0x8'));var csv=require('to-csv');var ejs=require(_0x2c59('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2c59('0xa'));var squel=require(_0x2c59('0xb'));var crypto=require(_0x2c59('0xc'));var jsforce=require(_0x2c59('0xd'));var deskjs=require(_0x2c59('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2c59('0xf'));var Redis=require(_0x2c59('0x10'));var authService=require(_0x2c59('0x11'));var qs=require(_0x2c59('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2c59('0x13'));var logger=require(_0x2c59('0x14'))('api');var utils=require(_0x2c59('0x15'));var config=require(_0x2c59('0x16'));var licenseUtil=require(_0x2c59('0x17'));var db=require(_0x2c59('0x18'))['db'];function respondWithStatusCode(_0x14f73d,_0x575b61){_0x575b61=_0x575b61||0xcc;return function(_0x4a247a){if(_0x4a247a){return _0x14f73d[_0x2c59('0x19')](_0x575b61);}return _0x14f73d['status'](_0x575b61)[_0x2c59('0x1a')]();};}function respondWithResult(_0x3d7710,_0xe5eb40){_0xe5eb40=_0xe5eb40||0xc8;return function(_0x3d9faf){if(_0x3d9faf){return _0x3d7710['status'](_0xe5eb40)[_0x2c59('0x1b')](_0x3d9faf);}};}function respondWithFilteredResult(_0x1c5a6e,_0x14bdb9){return function(_0xb6ff7a){if(_0xb6ff7a){var _0x30036a=typeof _0x14bdb9[_0x2c59('0x1c')]==='undefined'&&typeof _0x14bdb9[_0x2c59('0x1d')]===_0x2c59('0x1e');var _0x130e48=_0xb6ff7a[_0x2c59('0x1f')];var _0x5733a7=_0x30036a?0x0:_0x14bdb9[_0x2c59('0x1c')];var _0x3b3bb6=_0x30036a?_0xb6ff7a[_0x2c59('0x1f')]:_0x14bdb9[_0x2c59('0x1c')]+_0x14bdb9[_0x2c59('0x1d')];var _0x1ad12b;if(_0x3b3bb6>=_0x130e48){_0x3b3bb6=_0x130e48;_0x1ad12b=0xc8;}else{_0x1ad12b=0xce;}_0x1c5a6e[_0x2c59('0x20')](_0x1ad12b);return _0x1c5a6e[_0x2c59('0x21')](_0x2c59('0x22'),_0x5733a7+'-'+_0x3b3bb6+'/'+_0x130e48)[_0x2c59('0x1b')](_0xb6ff7a);}return null;};}function patchUpdates(_0x1ef071){return function(_0x393936){try{jsonpatch[_0x2c59('0x23')](_0x393936,_0x1ef071,!![]);}catch(_0x15598a){return BPromise[_0x2c59('0x24')](_0x15598a);}return _0x393936[_0x2c59('0x25')]();};}function saveUpdates(_0x35825c,_0x48f8bd){return function(_0x15e73e){if(_0x15e73e){return _0x15e73e[_0x2c59('0x26')](_0x35825c)[_0x2c59('0x27')](function(_0x1d42b3){return _0x1d42b3;});}return null;};}function removeEntity(_0x4ddb97,_0x6e653d){return function(_0x592bfd){if(_0x592bfd){return _0x592bfd['destroy']()[_0x2c59('0x27')](function(){_0x4ddb97[_0x2c59('0x20')](0xcc)[_0x2c59('0x1a')]();});}};}function handleEntityNotFound(_0x3a56b5,_0x4fa332){return function(_0x2c5c16){if(!_0x2c5c16){_0x3a56b5[_0x2c59('0x19')](0x194);}return _0x2c5c16;};}function handleError(_0x2b48e0,_0x5b2d8d){_0x5b2d8d=_0x5b2d8d||0x1f4;return function(_0x33b8f3){logger[_0x2c59('0x28')](_0x33b8f3[_0x2c59('0x29')]);if(_0x33b8f3[_0x2c59('0x2a')]){delete _0x33b8f3[_0x2c59('0x2a')];}_0x2b48e0[_0x2c59('0x20')](_0x5b2d8d)['send'](_0x33b8f3);};}exports[_0x2c59('0x2b')]=function(_0x814d2c,_0x473706){var _0x5da8d6={},_0x1eda06={},_0x10cd0b={'count':0x0,'rows':[]};var _0x9f1dec=_[_0x2c59('0x2c')](db[_0x2c59('0x2d')][_0x2c59('0x2e')],function(_0x3e4dc1){return{'name':_0x3e4dc1[_0x2c59('0x2f')],'type':_0x3e4dc1[_0x2c59('0x30')][_0x2c59('0x31')]};});_0x1eda06['model']=_[_0x2c59('0x2c')](_0x9f1dec,_0x2c59('0x2a'));_0x1eda06['query']=_[_0x2c59('0x32')](_0x814d2c[_0x2c59('0x33')]);_0x1eda06['filters']=_[_0x2c59('0x34')](_0x1eda06[_0x2c59('0x35')],_0x1eda06[_0x2c59('0x33')]);_0x5da8d6[_0x2c59('0x36')]=_[_0x2c59('0x34')](_0x1eda06[_0x2c59('0x35')],qs['fields'](_0x814d2c[_0x2c59('0x33')]['fields']));_0x5da8d6[_0x2c59('0x36')]=_0x5da8d6[_0x2c59('0x36')][_0x2c59('0x37')]?_0x5da8d6[_0x2c59('0x36')]:_0x1eda06[_0x2c59('0x35')];if(!_0x814d2c[_0x2c59('0x33')]['hasOwnProperty'](_0x2c59('0x38'))){_0x5da8d6[_0x2c59('0x1d')]=qs['limit'](_0x814d2c[_0x2c59('0x33')][_0x2c59('0x1d')]);_0x5da8d6[_0x2c59('0x1c')]=qs[_0x2c59('0x1c')](_0x814d2c[_0x2c59('0x33')]['offset']);}_0x5da8d6['order']=qs[_0x2c59('0x39')](_0x814d2c['query'][_0x2c59('0x39')]);_0x5da8d6[_0x2c59('0x3a')]=qs[_0x2c59('0x3b')](_['pick'](_0x814d2c[_0x2c59('0x33')],_0x1eda06[_0x2c59('0x3b')]),_0x9f1dec);if(_0x814d2c[_0x2c59('0x33')]['filter']){_0x5da8d6['where']=_[_0x2c59('0x3c')](_0x5da8d6[_0x2c59('0x3a')],{'$or':_['map'](_0x9f1dec,function(_0x2cc799){if(_0x2cc799[_0x2c59('0x30')]!==_0x2c59('0x3d')){var _0xe5b3c8={};_0xe5b3c8[_0x2cc799[_0x2c59('0x2a')]]={'$like':'%'+_0x814d2c[_0x2c59('0x33')][_0x2c59('0x3e')]+'%'};return _0xe5b3c8;}})});}_0x5da8d6=_[_0x2c59('0x3c')]({},_0x5da8d6,_0x814d2c[_0x2c59('0x3f')]);var _0x3e5e83={'where':_0x5da8d6['where']};return db[_0x2c59('0x2d')][_0x2c59('0x1f')](_0x3e5e83)['then'](function(_0x2d734b){_0x10cd0b[_0x2c59('0x1f')]=_0x2d734b;if(_0x814d2c[_0x2c59('0x33')][_0x2c59('0x40')]){_0x5da8d6[_0x2c59('0x41')]=[{'all':!![]}];}return db[_0x2c59('0x2d')][_0x2c59('0x42')](_0x5da8d6);})[_0x2c59('0x27')](function(_0x4377f8){_0x10cd0b[_0x2c59('0x43')]=_0x4377f8;return _0x10cd0b;})[_0x2c59('0x27')](respondWithFilteredResult(_0x473706,_0x5da8d6))[_0x2c59('0x44')](handleError(_0x473706,null));}; \ No newline at end of file +var _0x2e1f=['query','attributes','fields','length','hasOwnProperty','nolimit','order','filters','pick','where','merge','VIRTUAL','filter','includeAll','findAll','rows','catch','eml-format','rimraf','zip-dir','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','destroy','then','error','name','index','Migration','rawAttributes','type','key','model','map'];(function(_0x1dcc53,_0xad37cf){var _0x2995fc=function(_0x816fd0){while(--_0x816fd0){_0x1dcc53['push'](_0x1dcc53['shift']());}};_0x2995fc(++_0xad37cf);}(_0x2e1f,0x93));var _0xf2e1=function(_0x4c3ffe,_0x457374){_0x4c3ffe=_0x4c3ffe-0x0;var _0x28d3eb=_0x2e1f[_0x4c3ffe];return _0x28d3eb;};'use strict';var emlformat=require(_0xf2e1('0x0'));var rimraf=require(_0xf2e1('0x1'));var zipdir=require(_0xf2e1('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xf2e1('0x3'));var Mustache=require(_0xf2e1('0x4'));var util=require(_0xf2e1('0x5'));var path=require(_0xf2e1('0x6'));var sox=require(_0xf2e1('0x7'));var csv=require(_0xf2e1('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xf2e1('0x9'));var _=require(_0xf2e1('0xa'));var squel=require(_0xf2e1('0xb'));var crypto=require(_0xf2e1('0xc'));var jsforce=require(_0xf2e1('0xd'));var deskjs=require(_0xf2e1('0xe'));var toCsv=require(_0xf2e1('0x8'));var querystring=require(_0xf2e1('0xf'));var Papa=require(_0xf2e1('0x10'));var Redis=require('ioredis');var authService=require(_0xf2e1('0x11'));var qs=require(_0xf2e1('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf2e1('0x13'));var logger=require(_0xf2e1('0x14'))(_0xf2e1('0x15'));var utils=require('../../config/utils');var config=require(_0xf2e1('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0xf2e1('0x17'))['db'];function respondWithStatusCode(_0x20dafe,_0x3bffe8){_0x3bffe8=_0x3bffe8||0xcc;return function(_0x1b1dc0){if(_0x1b1dc0){return _0x20dafe[_0xf2e1('0x18')](_0x3bffe8);}return _0x20dafe[_0xf2e1('0x19')](_0x3bffe8)[_0xf2e1('0x1a')]();};}function respondWithResult(_0x3c2806,_0x3cd958){_0x3cd958=_0x3cd958||0xc8;return function(_0xf2a5dc){if(_0xf2a5dc){return _0x3c2806[_0xf2e1('0x19')](_0x3cd958)[_0xf2e1('0x1b')](_0xf2a5dc);}};}function respondWithFilteredResult(_0x287743,_0x9b02ef){return function(_0x30fdad){if(_0x30fdad){var _0x2fdd6f=typeof _0x9b02ef[_0xf2e1('0x1c')]===_0xf2e1('0x1d')&&typeof _0x9b02ef['limit']===_0xf2e1('0x1d');var _0x23f6fe=_0x30fdad[_0xf2e1('0x1e')];var _0x44950e=_0x2fdd6f?0x0:_0x9b02ef[_0xf2e1('0x1c')];var _0xab418f=_0x2fdd6f?_0x30fdad['count']:_0x9b02ef[_0xf2e1('0x1c')]+_0x9b02ef[_0xf2e1('0x1f')];var _0x14f183;if(_0xab418f>=_0x23f6fe){_0xab418f=_0x23f6fe;_0x14f183=0xc8;}else{_0x14f183=0xce;}_0x287743[_0xf2e1('0x19')](_0x14f183);return _0x287743[_0xf2e1('0x20')](_0xf2e1('0x21'),_0x44950e+'-'+_0xab418f+'/'+_0x23f6fe)[_0xf2e1('0x1b')](_0x30fdad);}return null;};}function patchUpdates(_0x6b24cd){return function(_0x2bebe6){try{jsonpatch[_0xf2e1('0x22')](_0x2bebe6,_0x6b24cd,!![]);}catch(_0x245800){return BPromise[_0xf2e1('0x23')](_0x245800);}return _0x2bebe6[_0xf2e1('0x24')]();};}function saveUpdates(_0x1bb24e,_0x115b2c){return function(_0x1a8b6c){if(_0x1a8b6c){return _0x1a8b6c['update'](_0x1bb24e)['then'](function(_0x1b0a7d){return _0x1b0a7d;});}return null;};}function removeEntity(_0x44e0d3,_0x27d8ab){return function(_0x5e2cd8){if(_0x5e2cd8){return _0x5e2cd8[_0xf2e1('0x25')]()[_0xf2e1('0x26')](function(){_0x44e0d3[_0xf2e1('0x19')](0xcc)[_0xf2e1('0x1a')]();});}};}function handleEntityNotFound(_0x57e8fb,_0x584ff5){return function(_0x1b1518){if(!_0x1b1518){_0x57e8fb[_0xf2e1('0x18')](0x194);}return _0x1b1518;};}function handleError(_0x443ed6,_0x369da5){_0x369da5=_0x369da5||0x1f4;return function(_0x1b337f){logger[_0xf2e1('0x27')](_0x1b337f['stack']);if(_0x1b337f[_0xf2e1('0x28')]){delete _0x1b337f[_0xf2e1('0x28')];}_0x443ed6[_0xf2e1('0x19')](_0x369da5)['send'](_0x1b337f);};}exports[_0xf2e1('0x29')]=function(_0x4446ea,_0x11849d){var _0x501c18={},_0x4325c7={},_0x135d5a={'count':0x0,'rows':[]};var _0x597111=_['map'](db[_0xf2e1('0x2a')][_0xf2e1('0x2b')],function(_0x3f613a){return{'name':_0x3f613a['fieldName'],'type':_0x3f613a[_0xf2e1('0x2c')][_0xf2e1('0x2d')]};});_0x4325c7[_0xf2e1('0x2e')]=_[_0xf2e1('0x2f')](_0x597111,_0xf2e1('0x28'));_0x4325c7['query']=_['keys'](_0x4446ea[_0xf2e1('0x30')]);_0x4325c7['filters']=_['intersection'](_0x4325c7[_0xf2e1('0x2e')],_0x4325c7[_0xf2e1('0x30')]);_0x501c18[_0xf2e1('0x31')]=_['intersection'](_0x4325c7[_0xf2e1('0x2e')],qs[_0xf2e1('0x32')](_0x4446ea[_0xf2e1('0x30')][_0xf2e1('0x32')]));_0x501c18[_0xf2e1('0x31')]=_0x501c18[_0xf2e1('0x31')][_0xf2e1('0x33')]?_0x501c18[_0xf2e1('0x31')]:_0x4325c7[_0xf2e1('0x2e')];if(!_0x4446ea[_0xf2e1('0x30')][_0xf2e1('0x34')](_0xf2e1('0x35'))){_0x501c18['limit']=qs[_0xf2e1('0x1f')](_0x4446ea[_0xf2e1('0x30')][_0xf2e1('0x1f')]);_0x501c18['offset']=qs[_0xf2e1('0x1c')](_0x4446ea['query'][_0xf2e1('0x1c')]);}_0x501c18[_0xf2e1('0x36')]=qs['sort'](_0x4446ea[_0xf2e1('0x30')]['sort']);_0x501c18['where']=qs[_0xf2e1('0x37')](_[_0xf2e1('0x38')](_0x4446ea[_0xf2e1('0x30')],_0x4325c7[_0xf2e1('0x37')]),_0x597111);if(_0x4446ea[_0xf2e1('0x30')]['filter']){_0x501c18[_0xf2e1('0x39')]=_[_0xf2e1('0x3a')](_0x501c18['where'],{'$or':_[_0xf2e1('0x2f')](_0x597111,function(_0x6341bb){if(_0x6341bb[_0xf2e1('0x2c')]!==_0xf2e1('0x3b')){var _0x9bd61a={};_0x9bd61a[_0x6341bb[_0xf2e1('0x28')]]={'$like':'%'+_0x4446ea['query'][_0xf2e1('0x3c')]+'%'};return _0x9bd61a;}})});}_0x501c18=_['merge']({},_0x501c18,_0x4446ea['options']);var _0x3abb49={'where':_0x501c18[_0xf2e1('0x39')]};return db['Migration'][_0xf2e1('0x1e')](_0x3abb49)[_0xf2e1('0x26')](function(_0x47c619){_0x135d5a['count']=_0x47c619;if(_0x4446ea[_0xf2e1('0x30')][_0xf2e1('0x3d')]){_0x501c18['include']=[{'all':!![]}];}return db[_0xf2e1('0x2a')][_0xf2e1('0x3e')](_0x501c18);})[_0xf2e1('0x26')](function(_0x3f41de){_0x135d5a[_0xf2e1('0x3f')]=_0x3f41de;return _0x135d5a;})[_0xf2e1('0x26')](respondWithFilteredResult(_0x11849d,_0x501c18))[_0xf2e1('0x40')](handleError(_0x11849d,null));}; \ No newline at end of file diff --git a/server/api/migration/migration.model.js b/server/api/migration/migration.model.js index fc065a8..9f263a7 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 _0x167e=['path','rimraf','../../config/environment','./migration.attributes','exports','define','Migration','util','api','bluebird','request-promise'];(function(_0x294a3c,_0x2c7f0d){var _0x511f60=function(_0x1f7444){while(--_0x1f7444){_0x294a3c['push'](_0x294a3c['shift']());}};_0x511f60(++_0x2c7f0d);}(_0x167e,0xe3));var _0xe167=function(_0x21f657,_0x391ac1){_0x21f657=_0x21f657-0x0;var _0x4b04a7=_0x167e[_0x21f657];return _0x4b04a7;};'use strict';var _=require('lodash');var util=require(_0xe167('0x0'));var logger=require('../../config/logger')(_0xe167('0x1'));var moment=require('moment');var BPromise=require(_0xe167('0x2'));var rp=require(_0xe167('0x3'));var fs=require('fs');var path=require(_0xe167('0x4'));var rimraf=require(_0xe167('0x5'));var config=require(_0xe167('0x6'));var attributes=require(_0xe167('0x7'));module[_0xe167('0x8')]=function(_0x50a283,_0x396fa2){return _0x50a283[_0xe167('0x9')](_0xe167('0xa'),attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7f73=['exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./migration.attributes'];(function(_0xb327f0,_0x35df9c){var _0x585904=function(_0x2e0617){while(--_0x2e0617){_0xb327f0['push'](_0xb327f0['shift']());}};_0x585904(++_0x35df9c);}(_0x7f73,0x188));var _0x37f7=function(_0x6b4178,_0x4ae487){_0x6b4178=_0x6b4178-0x0;var _0x3c4720=_0x7f73[_0x6b4178];return _0x3c4720;};'use strict';var _=require(_0x37f7('0x0'));var util=require(_0x37f7('0x1'));var logger=require(_0x37f7('0x2'))(_0x37f7('0x3'));var moment=require(_0x37f7('0x4'));var BPromise=require(_0x37f7('0x5'));var rp=require(_0x37f7('0x6'));var fs=require('fs');var path=require(_0x37f7('0x7'));var rimraf=require(_0x37f7('0x8'));var config=require(_0x37f7('0x9'));var attributes=require(_0x37f7('0xa'));module[_0x37f7('0xb')]=function(_0x962bae,_0x1d12dd){return _0x962bae[_0x37f7('0xc')]('Migration',attributes,{'tableName':'migrations','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/migration/migration.rpc.js b/server/api/migration/migration.rpc.js index ed4e111..de63ee3 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 _0xe0b2=['ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Migration,\x20%s,\x20%s','request\x20sent','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','util','moment','bluebird','randomstring'];(function(_0x1992ab,_0x9abd59){var _0x1cf51a=function(_0x22c202){while(--_0x22c202){_0x1992ab['push'](_0x1992ab['shift']());}};_0x1cf51a(++_0x9abd59);}(_0xe0b2,0xec));var _0x2e0b=function(_0x11c28b,_0x55bcd1){_0x11c28b=_0x11c28b-0x0;var _0xdc52e0=_0xe0b2[_0x11c28b];return _0xdc52e0;};'use strict';var _=require('lodash');var util=require(_0x2e0b('0x0'));var moment=require(_0x2e0b('0x1'));var BPromise=require(_0x2e0b('0x2'));var rs=require(_0x2e0b('0x3'));var fs=require('fs');var Redis=require(_0x2e0b('0x4'));var db=require(_0x2e0b('0x5'))['db'];var utils=require(_0x2e0b('0x6'));var logger=require('../../config/logger')(_0x2e0b('0x7'));var config=require(_0x2e0b('0x8'));var jayson=require(_0x2e0b('0x9'));var client=jayson[_0x2e0b('0xa')][_0x2e0b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x264319,_0x4b62b7,_0x2e1e40){return new BPromise(function(_0x504ea6,_0x1afd43){return client[_0x2e0b('0xc')](_0x264319,_0x2e1e40)[_0x2e0b('0xd')](function(_0x3078eb){logger[_0x2e0b('0xe')](_0x2e0b('0xf'),_0x4b62b7,_0x2e0b('0x10'));logger[_0x2e0b('0x11')](_0x2e0b('0x12'),_0x4b62b7,'request\x20sent',JSON[_0x2e0b('0x13')](_0x3078eb));if(_0x3078eb[_0x2e0b('0x14')]){if(_0x3078eb['error']['code']===0x1f4){logger[_0x2e0b('0x14')](_0x2e0b('0xf'),_0x4b62b7,_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);return _0x1afd43(_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);}logger[_0x2e0b('0x14')](_0x2e0b('0xf'),_0x4b62b7,_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);return _0x504ea6(_0x3078eb[_0x2e0b('0x14')][_0x2e0b('0x15')]);}else{logger['info']('Migration,\x20%s,\x20%s',_0x4b62b7,'request\x20sent');_0x504ea6(_0x3078eb[_0x2e0b('0x16')]['message']);}})[_0x2e0b('0x17')](function(_0x426879){logger['error']('Migration,\x20%s,\x20%s',_0x4b62b7,_0x426879);_0x1afd43(_0x426879);});});} \ No newline at end of file +var _0xfecd=['message','result','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','then','info','debug','Migration,\x20%s,\x20%s,\x20%s','stringify','error','code','Migration,\x20%s,\x20%s'];(function(_0x22a941,_0x72269b){var _0x27e1f0=function(_0x5c79e2){while(--_0x5c79e2){_0x22a941['push'](_0x22a941['shift']());}};_0x27e1f0(++_0x72269b);}(_0xfecd,0x107));var _0xdfec=function(_0x3d8651,_0x354057){_0x3d8651=_0x3d8651-0x0;var _0x55dec7=_0xfecd[_0x3d8651];return _0x55dec7;};'use strict';var _=require(_0xdfec('0x0'));var util=require('util');var moment=require(_0xdfec('0x1'));var BPromise=require(_0xdfec('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdfec('0x3'));var db=require(_0xdfec('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdfec('0x5'))('rpc');var config=require(_0xdfec('0x6'));var jayson=require(_0xdfec('0x7'));var client=jayson[_0xdfec('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x2f35a8,_0x6090af,_0x40782c){return new BPromise(function(_0x81175c,_0x413c88){return client['request'](_0x2f35a8,_0x40782c)[_0xdfec('0x9')](function(_0x194755){logger[_0xdfec('0xa')]('Migration,\x20%s,\x20%s',_0x6090af,'request\x20sent');logger[_0xdfec('0xb')](_0xdfec('0xc'),_0x6090af,'request\x20sent',JSON[_0xdfec('0xd')](_0x194755));if(_0x194755[_0xdfec('0xe')]){if(_0x194755['error'][_0xdfec('0xf')]===0x1f4){logger['error'](_0xdfec('0x10'),_0x6090af,_0x194755[_0xdfec('0xe')][_0xdfec('0x11')]);return _0x413c88(_0x194755[_0xdfec('0xe')][_0xdfec('0x11')]);}logger[_0xdfec('0xe')](_0xdfec('0x10'),_0x6090af,_0x194755[_0xdfec('0xe')]['message']);return _0x81175c(_0x194755[_0xdfec('0xe')][_0xdfec('0x11')]);}else{logger['info'](_0xdfec('0x10'),_0x6090af,'request\x20sent');_0x81175c(_0x194755[_0xdfec('0x12')][_0xdfec('0x11')]);}})[_0xdfec('0x13')](function(_0x2354ad){logger['error'](_0xdfec('0x10'),_0x6090af,_0x2354ad);_0x413c88(_0x2354ad);});});} \ No newline at end of file diff --git a/server/api/network/index.js b/server/api/network/index.js index 19a77cf..6339553 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 _0xf31b=['path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','isAuthenticated','get','/:id','post','create','put','update','delete','destroy','exports','multer','util'];(function(_0x2e51e7,_0x3a8704){var _0x201f8a=function(_0x1c57e9){while(--_0x1c57e9){_0x2e51e7['push'](_0x2e51e7['shift']());}};_0x201f8a(++_0x3a8704);}(_0xf31b,0x1a0));var _0xbf31=function(_0x3ee25b,_0x3c2491){_0x3ee25b=_0x3ee25b-0x0;var _0x3a6cf7=_0xf31b[_0x3ee25b];return _0x3a6cf7;};'use strict';var multer=require(_0xbf31('0x0'));var util=require(_0xbf31('0x1'));var path=require(_0xbf31('0x2'));var timeout=require(_0xbf31('0x3'));var express=require(_0xbf31('0x4'));var router=express[_0xbf31('0x5')]();var fs_extra=require(_0xbf31('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xbf31('0x7'));var config=require(_0xbf31('0x8'));var controller=require('./network.controller');router['get']('/',auth[_0xbf31('0x9')](),controller['index']);router[_0xbf31('0xa')](_0xbf31('0xb'),auth['isAuthenticated'](),controller['show']);router[_0xbf31('0xc')]('/',auth['isAuthenticated'](),controller[_0xbf31('0xd')]);router[_0xbf31('0xe')](_0xbf31('0xb'),auth[_0xbf31('0x9')](),controller[_0xbf31('0xf')]);router[_0xbf31('0x10')](_0xbf31('0xb'),auth[_0xbf31('0x9')](),controller[_0xbf31('0x11')]);module[_0xbf31('0x12')]=router; \ No newline at end of file +var _0x6822=['../../components/interaction/service','./network.controller','isAuthenticated','index','get','post','create','put','update','delete','/:id','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service'];(function(_0x2092a7,_0x544d07){var _0x19265f=function(_0x18855d){while(--_0x18855d){_0x2092a7['push'](_0x2092a7['shift']());}};_0x19265f(++_0x544d07);}(_0x6822,0xca));var _0x2682=function(_0x11d3a2,_0xc85916){_0x11d3a2=_0x11d3a2-0x0;var _0x1db5fb=_0x6822[_0x11d3a2];return _0x1db5fb;};'use strict';var multer=require(_0x2682('0x0'));var util=require(_0x2682('0x1'));var path=require(_0x2682('0x2'));var timeout=require(_0x2682('0x3'));var express=require(_0x2682('0x4'));var router=express[_0x2682('0x5')]();var fs_extra=require(_0x2682('0x6'));var auth=require(_0x2682('0x7'));var interaction=require(_0x2682('0x8'));var config=require('../../config/environment');var controller=require(_0x2682('0x9'));router['get']('/',auth[_0x2682('0xa')](),controller[_0x2682('0xb')]);router[_0x2682('0xc')]('/:id',auth['isAuthenticated'](),controller['show']);router[_0x2682('0xd')]('/',auth[_0x2682('0xa')](),controller[_0x2682('0xe')]);router[_0x2682('0xf')]('/:id',auth[_0x2682('0xa')](),controller[_0x2682('0x10')]);router[_0x2682('0x11')](_0x2682('0x12'),auth['isAuthenticated'](),controller[_0x2682('0x13')]);module[_0x2682('0x14')]=router; \ No newline at end of file diff --git a/server/api/network/network.attributes.js b/server/api/network/network.attributes.js index ce9f38c..18fdc28 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 _0x6f48=['stun','turn','STRING','sequelize','exports','ENUM','externip'];(function(_0x3daf97,_0x226682){var _0x20575b=function(_0x83e0db){while(--_0x83e0db){_0x3daf97['push'](_0x3daf97['shift']());}};_0x20575b(++_0x226682);}(_0x6f48,0x168));var _0x86f4=function(_0x298429,_0x50450d){_0x298429=_0x298429-0x0;var _0x51e296=_0x6f48[_0x298429];return _0x51e296;};'use strict';var Sequelize=require(_0x86f4('0x0'));module[_0x86f4('0x1')]={'type':{'type':Sequelize[_0x86f4('0x2')]('localnet',_0x86f4('0x3'),_0x86f4('0x4'),_0x86f4('0x5'))},'value':{'type':Sequelize[_0x86f4('0x6')]},'username':{'type':Sequelize[_0x86f4('0x6')]},'password':{'type':Sequelize[_0x86f4('0x6')]}}; \ No newline at end of file +var _0x8812=['sequelize','exports','ENUM','localnet','externip','stun','turn','STRING'];(function(_0x343816,_0x1eb1b8){var _0x47af8f=function(_0x11db3c){while(--_0x11db3c){_0x343816['push'](_0x343816['shift']());}};_0x47af8f(++_0x1eb1b8);}(_0x8812,0x120));var _0x2881=function(_0x1de093,_0x1ee1c2){_0x1de093=_0x1de093-0x0;var _0x29d9bb=_0x8812[_0x1de093];return _0x29d9bb;};'use strict';var Sequelize=require(_0x2881('0x0'));module[_0x2881('0x1')]={'type':{'type':Sequelize[_0x2881('0x2')](_0x2881('0x3'),_0x2881('0x4'),_0x2881('0x5'),_0x2881('0x6'))},'value':{'type':Sequelize[_0x2881('0x7')]},'username':{'type':Sequelize[_0x2881('0x7')]},'password':{'type':Sequelize[_0x2881('0x7')]}}; \ No newline at end of file diff --git a/server/api/network/network.controller.js b/server/api/network/network.controller.js index e75c176..abc7bc1 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 _0xa1d2=['stack','name','send','index','map','Network','rawAttributes','fieldName','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','filter','merge','type','VIRTUAL','findAll','rows','show','includeAll','include','find','create','body','STUN','readFileSync','root','utf8','writeFileSync','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','join','server/files/templates/turn_multiple.ejs','render','Reload','server/files/templates/network.ejs','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','params','server/files/templates/stun_multiple.ejs','toUpperCase','format','chan_sip.so','destroy','/etc/asterisk/turn_xcally.conf','path','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','jayson/promise','http','request','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','status','json','limit','count','offset','set','Content-Range','update'];(function(_0x2859f7,_0x306f98){var _0x453c90=function(_0x1b7b1c){while(--_0x1b7b1c){_0x2859f7['push'](_0x2859f7['shift']());}};_0x453c90(++_0x306f98);}(_0xa1d2,0x136));var _0x2a1d=function(_0x593a62,_0x2d15bc){_0x593a62=_0x593a62-0x0;var _0x1a5e17=_0xa1d2[_0x593a62];return _0x1a5e17;};'use strict';var util=require('util');var path=require(_0x2a1d('0x0'));var ejs=require('ejs');var fs=require('fs');var _=require(_0x2a1d('0x1'));var qs=require(_0x2a1d('0x2'));var logger=require(_0x2a1d('0x3'))(_0x2a1d('0x4'));var config=require(_0x2a1d('0x5'));var db=require(_0x2a1d('0x6'))['db'];var jayson=require(_0x2a1d('0x7'));var client=jayson['client'][_0x2a1d('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4c58f5,_0x1b480b,_0x299080,_0x123587){return new Promise(function(_0x563d3d,_0x23ea4b){var _0xcd4c2c=_0x123587||client;return _0xcd4c2c[_0x2a1d('0x9')](_0x4c58f5,_0x299080)[_0x2a1d('0xa')](function(_0x32c9fc){logger[_0x2a1d('0xb')](_0x2a1d('0xc'),_0x1b480b,_0x2a1d('0xd'));logger[_0x2a1d('0xe')](_0x2a1d('0xf'),_0x1b480b,_0x2a1d('0xd'),JSON[_0x2a1d('0x10')](_0x32c9fc));if(_0x32c9fc['error']){if(_0x32c9fc[_0x2a1d('0x11')][_0x2a1d('0x12')]===0x1f4){logger[_0x2a1d('0x11')](_0x2a1d('0xc'),_0x1b480b,_0x32c9fc[_0x2a1d('0x11')][_0x2a1d('0x13')]);return _0x23ea4b(_0x32c9fc[_0x2a1d('0x11')][_0x2a1d('0x13')]);}logger['error'](_0x2a1d('0xc'),_0x1b480b,_0x32c9fc['error'][_0x2a1d('0x13')]);return _0x563d3d(_0x32c9fc[_0x2a1d('0x11')][_0x2a1d('0x13')]);}else{logger[_0x2a1d('0xb')](_0x2a1d('0xc'),_0x1b480b,_0x2a1d('0xd'));_0x563d3d(_0x32c9fc[_0x2a1d('0x14')][_0x2a1d('0x13')]);}})[_0x2a1d('0x15')](function(_0x44825c){logger['error'](_0x2a1d('0xc'),_0x1b480b,_0x44825c);_0x23ea4b(_0x44825c);});});}function respondWithResult(_0x17247c,_0x4872fa){_0x4872fa=_0x4872fa||0xc8;return function(_0x269f9d){if(_0x269f9d){return _0x17247c[_0x2a1d('0x16')](_0x4872fa)[_0x2a1d('0x17')](_0x269f9d);}};}function respondWithFilteredResult(_0x397cc5,_0x365398){return function(_0x43b6e0){if(_0x43b6e0){var _0x5189e2=typeof _0x365398['offset']==='undefined'&&typeof _0x365398[_0x2a1d('0x18')]==='undefined';var _0x1e8fd3=_0x43b6e0[_0x2a1d('0x19')];var _0x4a72cc=_0x5189e2?0x0:_0x365398[_0x2a1d('0x1a')];var _0x130321=_0x5189e2?_0x43b6e0[_0x2a1d('0x19')]:_0x365398[_0x2a1d('0x1a')]+_0x365398[_0x2a1d('0x18')];var _0x5167f5;if(_0x130321>=_0x1e8fd3){_0x130321=_0x1e8fd3;_0x5167f5=0xc8;}else{_0x5167f5=0xce;}_0x397cc5['status'](_0x5167f5);return _0x397cc5[_0x2a1d('0x1b')](_0x2a1d('0x1c'),_0x4a72cc+'-'+_0x130321+'/'+_0x1e8fd3)[_0x2a1d('0x17')](_0x43b6e0);}return null;};}function saveUpdates(_0x17a4f6){return function(_0x32d98c){if(_0x32d98c){return _0x32d98c[_0x2a1d('0x1d')](_0x17a4f6)[_0x2a1d('0xa')](function(_0x2f7ed7){return _0x2f7ed7;});}return null;};}function removeEntity(_0x223093){return function(_0xc61d9c){if(_0xc61d9c){return _0xc61d9c['destroy']()[_0x2a1d('0xa')](function(){_0x223093[_0x2a1d('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5c56eb){return function(_0x4c37ca){if(!_0x4c37ca){_0x5c56eb['sendStatus'](0x194);}return _0x4c37ca;};}function handleError(_0x667686,_0x7cf457){_0x7cf457=_0x7cf457||0x1f4;return function(_0x185568){logger[_0x2a1d('0x11')](_0x185568[_0x2a1d('0x1e')]);if(_0x185568[_0x2a1d('0x1f')]){delete _0x185568['name'];}_0x667686[_0x2a1d('0x16')](_0x7cf457)[_0x2a1d('0x20')](_0x185568);};}exports[_0x2a1d('0x21')]=function(_0x2a2fe6,_0x2d8ad5){var _0x5e76da={},_0x5ed660={},_0x391446={'count':0x0,'rows':[]};var _0x58d250=_[_0x2a1d('0x22')](db[_0x2a1d('0x23')][_0x2a1d('0x24')],function(_0x38181a){return{'name':_0x38181a[_0x2a1d('0x25')],'type':_0x38181a['type']['key']};});_0x5ed660[_0x2a1d('0x26')]=_['map'](_0x58d250,_0x2a1d('0x1f'));_0x5ed660['query']=_[_0x2a1d('0x27')](_0x2a2fe6['query']);_0x5ed660[_0x2a1d('0x28')]=_[_0x2a1d('0x29')](_0x5ed660['model'],_0x5ed660['query']);_0x5e76da[_0x2a1d('0x2a')]=_['intersection'](_0x5ed660[_0x2a1d('0x26')],qs[_0x2a1d('0x2b')](_0x2a2fe6[_0x2a1d('0x2c')][_0x2a1d('0x2b')]));_0x5e76da[_0x2a1d('0x2a')]=_0x5e76da[_0x2a1d('0x2a')][_0x2a1d('0x2d')]?_0x5e76da['attributes']:_0x5ed660[_0x2a1d('0x26')];if(!_0x2a2fe6[_0x2a1d('0x2c')][_0x2a1d('0x2e')]('nolimit')){_0x5e76da[_0x2a1d('0x18')]=qs[_0x2a1d('0x18')](_0x2a2fe6[_0x2a1d('0x2c')][_0x2a1d('0x18')]);_0x5e76da[_0x2a1d('0x1a')]=qs['offset'](_0x2a2fe6['query']['offset']);}_0x5e76da[_0x2a1d('0x2f')]=qs[_0x2a1d('0x30')](_0x2a2fe6[_0x2a1d('0x2c')][_0x2a1d('0x30')]);_0x5e76da[_0x2a1d('0x31')]=qs[_0x2a1d('0x28')](_[_0x2a1d('0x32')](_0x2a2fe6[_0x2a1d('0x2c')],_0x5ed660[_0x2a1d('0x28')]),_0x58d250);if(_0x2a2fe6[_0x2a1d('0x2c')][_0x2a1d('0x33')]){_0x5e76da['where']=_[_0x2a1d('0x34')](_0x5e76da[_0x2a1d('0x31')],{'$or':_['map'](_0x58d250,function(_0x35a25c){if(_0x35a25c[_0x2a1d('0x35')]!==_0x2a1d('0x36')){var _0x1cde5f={};_0x1cde5f[_0x35a25c['name']]={'$like':'%'+_0x2a2fe6[_0x2a1d('0x2c')]['filter']+'%'};return _0x1cde5f;}})});}_0x5e76da=_['merge']({},_0x5e76da,_0x2a2fe6['options']);var _0x35e6f7={'where':_0x5e76da[_0x2a1d('0x31')]};return db[_0x2a1d('0x23')]['count'](_0x35e6f7)['then'](function(_0x1151a4){_0x391446[_0x2a1d('0x19')]=_0x1151a4;if(_0x2a2fe6[_0x2a1d('0x2c')]['includeAll']){_0x5e76da['include']=[{'all':!![]}];}return db[_0x2a1d('0x23')][_0x2a1d('0x37')](_0x5e76da);})[_0x2a1d('0xa')](function(_0x3c34cb){_0x391446[_0x2a1d('0x38')]=_0x3c34cb;return _0x391446;})[_0x2a1d('0xa')](respondWithFilteredResult(_0x2d8ad5,_0x5e76da))[_0x2a1d('0x15')](handleError(_0x2d8ad5,null));};exports[_0x2a1d('0x39')]=function(_0x48b490,_0x58df38){var _0x56bd90={'raw':!![],'where':{'id':_0x48b490['params']['id']}},_0x20e88e={};_0x20e88e[_0x2a1d('0x26')]=_[_0x2a1d('0x27')](db['Network'][_0x2a1d('0x24')]);_0x20e88e['query']=_[_0x2a1d('0x27')](_0x48b490['query']);_0x20e88e[_0x2a1d('0x28')]=_[_0x2a1d('0x29')](_0x20e88e['model'],_0x20e88e[_0x2a1d('0x2c')]);_0x56bd90[_0x2a1d('0x2a')]=_[_0x2a1d('0x29')](_0x20e88e[_0x2a1d('0x26')],qs[_0x2a1d('0x2b')](_0x48b490[_0x2a1d('0x2c')]['fields']));_0x56bd90['attributes']=_0x56bd90[_0x2a1d('0x2a')]['length']?_0x56bd90[_0x2a1d('0x2a')]:_0x20e88e[_0x2a1d('0x26')];if(_0x48b490[_0x2a1d('0x2c')][_0x2a1d('0x3a')]){_0x56bd90[_0x2a1d('0x3b')]=[{'all':!![]}];}_0x56bd90=_[_0x2a1d('0x34')]({},_0x56bd90,_0x48b490['options']);return db[_0x2a1d('0x23')][_0x2a1d('0x3c')](_0x56bd90)[_0x2a1d('0xa')](handleEntityNotFound(_0x58df38,null))[_0x2a1d('0xa')](respondWithResult(_0x58df38,null))[_0x2a1d('0x15')](handleError(_0x58df38,null));};exports[_0x2a1d('0x3d')]=function(_0x105643,_0x14cb80){var _0x518ca8;return db[_0x2a1d('0x23')]['create'](_0x105643[_0x2a1d('0x3e')],{'raw':!![]})['then'](function(_0x532fce){_0x518ca8=_0x532fce;return db['Network']['findAll']({'where':{'type':_0x105643['body'][_0x2a1d('0x35')]},'raw':!![]});})['then'](function(_0x3be717){if(_0x518ca8[_0x2a1d('0x35')]['toUpperCase']()==_0x2a1d('0x3f')){var _0x14390f=fs[_0x2a1d('0x40')](path['join'](config[_0x2a1d('0x41')],'server/files/templates/stun_multiple.ejs'),_0x2a1d('0x42'));var _0x4a9a81=ejs['render'](_0x14390f,{'networks':_0x3be717||[]});fs[_0x2a1d('0x43')](_0x2a1d('0x44'),_0x4a9a81);return respondWithRpcPromise('Reload',_0x2a1d('0x3d'),{'module':_0x2a1d('0x45')});}else if(_0x518ca8[_0x2a1d('0x35')]['toUpperCase']()==_0x2a1d('0x46')){var _0x5378f4=fs[_0x2a1d('0x40')](path[_0x2a1d('0x47')](config[_0x2a1d('0x41')],_0x2a1d('0x48')),'utf8');var _0x171cf8=ejs[_0x2a1d('0x49')](_0x5378f4,{'networks':_0x3be717||[]});fs[_0x2a1d('0x43')]('/etc/asterisk/turn_xcally.conf',_0x171cf8);return respondWithRpcPromise(_0x2a1d('0x4a'),'create',{'module':_0x2a1d('0x45')});}else{var _0x47e3d0=fs[_0x2a1d('0x40')](path['join'](config[_0x2a1d('0x41')],_0x2a1d('0x4b')),'utf8');var _0x585ce6=ejs[_0x2a1d('0x49')](_0x47e3d0,{'networks':_0x3be717||[]});fs['writeFileSync'](util['format'](_0x2a1d('0x4c'),_0x105643[_0x2a1d('0x3e')][_0x2a1d('0x35')][_0x2a1d('0x4d')]()),_0x585ce6);return respondWithRpcPromise(_0x2a1d('0x4a'),_0x2a1d('0x3d'),{'module':'chan_sip.so'});}})[_0x2a1d('0xa')](function(){return _0x518ca8;})[_0x2a1d('0xa')](respondWithResult(_0x14cb80,0xc9))[_0x2a1d('0x15')](handleError(_0x14cb80,null));};exports['update']=function(_0x336b5a,_0x177459){var _0x5bf869;return db[_0x2a1d('0x23')]['find']({'where':{'id':_0x336b5a[_0x2a1d('0x4e')]['id']}})['then'](handleEntityNotFound(_0x177459,null))[_0x2a1d('0xa')](saveUpdates(_0x336b5a['body'],null))[_0x2a1d('0xa')](function(_0x2892be){if(_0x2892be){_0x5bf869=_0x2892be;return db['Network'][_0x2a1d('0x37')]({'where':{'type':_0x5bf869[_0x2a1d('0x35')]},'raw':!![]});}return null;})[_0x2a1d('0xa')](function(_0xdbc2bc){if(_0x5bf869['type']['toUpperCase']()==_0x2a1d('0x3f')){var _0x53a8fb=fs[_0x2a1d('0x40')](path['join'](config[_0x2a1d('0x41')],_0x2a1d('0x4f')),_0x2a1d('0x42'));var _0x548a03=ejs[_0x2a1d('0x49')](_0x53a8fb,{'networks':_0xdbc2bc||[]});fs[_0x2a1d('0x43')](_0x2a1d('0x44'),_0x548a03);return respondWithRpcPromise(_0x2a1d('0x4a'),_0x2a1d('0x1d'),{'module':_0x2a1d('0x45')});}else if(_0x5bf869['type'][_0x2a1d('0x50')]()=='TURN'){var _0x29f44d=fs[_0x2a1d('0x40')](path['join'](config[_0x2a1d('0x41')],_0x2a1d('0x48')),_0x2a1d('0x42'));var _0x710116=ejs[_0x2a1d('0x49')](_0x29f44d,{'networks':_0xdbc2bc||[]});fs[_0x2a1d('0x43')]('/etc/asterisk/turn_xcally.conf',_0x710116);return respondWithRpcPromise('Reload',_0x2a1d('0x1d'),{'module':_0x2a1d('0x45')});}else{var _0x467608=fs[_0x2a1d('0x40')](path['join'](config[_0x2a1d('0x41')],_0x2a1d('0x4b')),_0x2a1d('0x42'));var _0x2d7d03=ejs[_0x2a1d('0x49')](_0x467608,{'networks':_0xdbc2bc||[]});fs['writeFileSync'](util[_0x2a1d('0x51')](_0x2a1d('0x4c'),_0x336b5a[_0x2a1d('0x3e')][_0x2a1d('0x35')][_0x2a1d('0x4d')]()),_0x2d7d03);return respondWithRpcPromise('Reload','update',{'module':_0x2a1d('0x52')});}})[_0x2a1d('0xa')](function(_0x53b5cd){if(_0x53b5cd){return _0x5bf869;}return null;})[_0x2a1d('0xa')](respondWithResult(_0x177459,null))['catch'](handleError(_0x177459,null));};exports[_0x2a1d('0x53')]=function(_0xf43ded,_0x22c989){var _0x181b7f;return db['Network'][_0x2a1d('0x3c')]({'where':{'id':_0xf43ded[_0x2a1d('0x4e')]['id']}})['then'](function(_0x230aa8){_0x181b7f=_0x230aa8;return _0x230aa8;})[_0x2a1d('0xa')](handleEntityNotFound(_0x22c989,null))[_0x2a1d('0xa')](removeEntity(_0x22c989,null))[_0x2a1d('0xa')](function(){if(_0x181b7f){return db['Network'][_0x2a1d('0x37')]({'where':{'type':_0x181b7f[_0x2a1d('0x35')]},'raw':!![]});}})[_0x2a1d('0xa')](function(_0x206962){if(_0x181b7f[_0x2a1d('0x35')][_0x2a1d('0x50')]()=='STUN'){var _0x23b43d=fs[_0x2a1d('0x40')](path[_0x2a1d('0x47')](config[_0x2a1d('0x41')],_0x2a1d('0x4f')),'utf8');var _0x491323=ejs[_0x2a1d('0x49')](_0x23b43d,{'networks':_0x206962||[]});fs[_0x2a1d('0x43')](_0x2a1d('0x44'),_0x491323);return respondWithRpcPromise(_0x2a1d('0x4a'),_0x2a1d('0x53'),{'module':'res_stun_monitor.so'});}else if(_0x181b7f[_0x2a1d('0x35')][_0x2a1d('0x50')]()==_0x2a1d('0x46')){var _0x144720=fs[_0x2a1d('0x40')](path[_0x2a1d('0x47')](config[_0x2a1d('0x41')],_0x2a1d('0x48')),_0x2a1d('0x42'));var _0x5d7e0d=ejs['render'](_0x144720,{'networks':_0x206962||[]});fs[_0x2a1d('0x43')](_0x2a1d('0x54'),_0x5d7e0d);return respondWithRpcPromise(_0x2a1d('0x4a'),_0x2a1d('0x53'),{'module':_0x2a1d('0x45')});}else{var _0x4f48ba=fs['readFileSync'](path[_0x2a1d('0x47')](config[_0x2a1d('0x41')],_0x2a1d('0x4b')),_0x2a1d('0x42'));var _0x8f5131=ejs['render'](_0x4f48ba,{'networks':_0x206962||[]});fs[_0x2a1d('0x43')](util[_0x2a1d('0x51')]('/etc/asterisk/sip_xcally_%s.conf',_0x181b7f['type'][_0x2a1d('0x4d')]()),_0x8f5131);return respondWithRpcPromise('Reload',_0x2a1d('0x53'),{'module':_0x2a1d('0x52')});}})[_0x2a1d('0x15')](handleError(_0x22c989,null));}; \ No newline at end of file +var _0xd4b9=['type','VIRTUAL','options','include','findAll','show','includeAll','find','catch','create','body','toUpperCase','STUN','readFileSync','join','root','server/files/templates/stun_multiple.ejs','utf8','render','/etc/asterisk/stun_xcally.conf','res_stun_monitor.so','TURN','server/files/templates/turn_multiple.ejs','writeFileSync','/etc/asterisk/turn_xcally.conf','server/files/templates/network.ejs','format','/etc/asterisk/sip_xcally_%s.conf','toLowerCase','chan_sip.so','params','Reload','util','ejs','lodash','../../config/logger','api','../../config/environment','../../mysqldb','client','http','then','info','Network,\x20%s,\x20%s','debug','Network,\x20%s,\x20%s,\x20%s','error','code','message','request\x20sent','result','status','json','offset','undefined','limit','count','update','destroy','sendStatus','name','index','map','Network','rawAttributes','fieldName','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge'];(function(_0xf50820,_0x56f041){var _0x2a9b10=function(_0x33f0f4){while(--_0x33f0f4){_0xf50820['push'](_0xf50820['shift']());}};_0x2a9b10(++_0x56f041);}(_0xd4b9,0x71));var _0x9d4b=function(_0x50f72d,_0x5b2954){_0x50f72d=_0x50f72d-0x0;var _0x476d87=_0xd4b9[_0x50f72d];return _0x476d87;};'use strict';var util=require(_0x9d4b('0x0'));var path=require('path');var ejs=require(_0x9d4b('0x1'));var fs=require('fs');var _=require(_0x9d4b('0x2'));var qs=require('../../components/parsers/qs');var logger=require(_0x9d4b('0x3'))(_0x9d4b('0x4'));var config=require(_0x9d4b('0x5'));var db=require(_0x9d4b('0x6'))['db'];var jayson=require('jayson/promise');var client=jayson[_0x9d4b('0x7')][_0x9d4b('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1beb76,_0x1e6acf,_0x2469b8,_0x508df8){return new Promise(function(_0x53fd55,_0x1cead2){var _0x2ddb24=_0x508df8||client;return _0x2ddb24['request'](_0x1beb76,_0x2469b8)[_0x9d4b('0x9')](function(_0x3f7fc9){logger[_0x9d4b('0xa')](_0x9d4b('0xb'),_0x1e6acf,'request\x20sent');logger[_0x9d4b('0xc')](_0x9d4b('0xd'),_0x1e6acf,'request\x20sent',JSON['stringify'](_0x3f7fc9));if(_0x3f7fc9[_0x9d4b('0xe')]){if(_0x3f7fc9[_0x9d4b('0xe')][_0x9d4b('0xf')]===0x1f4){logger[_0x9d4b('0xe')](_0x9d4b('0xb'),_0x1e6acf,_0x3f7fc9['error']['message']);return _0x1cead2(_0x3f7fc9[_0x9d4b('0xe')][_0x9d4b('0x10')]);}logger[_0x9d4b('0xe')](_0x9d4b('0xb'),_0x1e6acf,_0x3f7fc9[_0x9d4b('0xe')][_0x9d4b('0x10')]);return _0x53fd55(_0x3f7fc9[_0x9d4b('0xe')][_0x9d4b('0x10')]);}else{logger[_0x9d4b('0xa')]('Network,\x20%s,\x20%s',_0x1e6acf,_0x9d4b('0x11'));_0x53fd55(_0x3f7fc9[_0x9d4b('0x12')][_0x9d4b('0x10')]);}})['catch'](function(_0x2dc381){logger[_0x9d4b('0xe')]('Network,\x20%s,\x20%s',_0x1e6acf,_0x2dc381);_0x1cead2(_0x2dc381);});});}function respondWithResult(_0x1b8d50,_0x490503){_0x490503=_0x490503||0xc8;return function(_0x2935c6){if(_0x2935c6){return _0x1b8d50[_0x9d4b('0x13')](_0x490503)[_0x9d4b('0x14')](_0x2935c6);}};}function respondWithFilteredResult(_0x412ab2,_0xe0a869){return function(_0xe9f02d){if(_0xe9f02d){var _0x2d27e5=typeof _0xe0a869[_0x9d4b('0x15')]===_0x9d4b('0x16')&&typeof _0xe0a869[_0x9d4b('0x17')]==='undefined';var _0x452fa8=_0xe9f02d[_0x9d4b('0x18')];var _0x434c3a=_0x2d27e5?0x0:_0xe0a869[_0x9d4b('0x15')];var _0x24ca2a=_0x2d27e5?_0xe9f02d[_0x9d4b('0x18')]:_0xe0a869[_0x9d4b('0x15')]+_0xe0a869[_0x9d4b('0x17')];var _0x3eb358;if(_0x24ca2a>=_0x452fa8){_0x24ca2a=_0x452fa8;_0x3eb358=0xc8;}else{_0x3eb358=0xce;}_0x412ab2['status'](_0x3eb358);return _0x412ab2['set']('Content-Range',_0x434c3a+'-'+_0x24ca2a+'/'+_0x452fa8)[_0x9d4b('0x14')](_0xe9f02d);}return null;};}function saveUpdates(_0xa122a0){return function(_0x575e03){if(_0x575e03){return _0x575e03[_0x9d4b('0x19')](_0xa122a0)[_0x9d4b('0x9')](function(_0x3c6ec6){return _0x3c6ec6;});}return null;};}function removeEntity(_0x21ce67){return function(_0x2672ff){if(_0x2672ff){return _0x2672ff[_0x9d4b('0x1a')]()['then'](function(){_0x21ce67[_0x9d4b('0x13')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27af30){return function(_0x417737){if(!_0x417737){_0x27af30[_0x9d4b('0x1b')](0x194);}return _0x417737;};}function handleError(_0x344810,_0x5d9fc8){_0x5d9fc8=_0x5d9fc8||0x1f4;return function(_0x29ac16){logger[_0x9d4b('0xe')](_0x29ac16['stack']);if(_0x29ac16['name']){delete _0x29ac16[_0x9d4b('0x1c')];}_0x344810['status'](_0x5d9fc8)['send'](_0x29ac16);};}exports[_0x9d4b('0x1d')]=function(_0x140b05,_0x3bbaca){var _0x1cc2f2={},_0x1d8e5f={},_0x409deb={'count':0x0,'rows':[]};var _0x492f52=_[_0x9d4b('0x1e')](db[_0x9d4b('0x1f')][_0x9d4b('0x20')],function(_0x3a2ef7){return{'name':_0x3a2ef7[_0x9d4b('0x21')],'type':_0x3a2ef7['type']['key']};});_0x1d8e5f[_0x9d4b('0x22')]=_[_0x9d4b('0x1e')](_0x492f52,_0x9d4b('0x1c'));_0x1d8e5f[_0x9d4b('0x23')]=_[_0x9d4b('0x24')](_0x140b05[_0x9d4b('0x23')]);_0x1d8e5f[_0x9d4b('0x25')]=_['intersection'](_0x1d8e5f[_0x9d4b('0x22')],_0x1d8e5f[_0x9d4b('0x23')]);_0x1cc2f2[_0x9d4b('0x26')]=_[_0x9d4b('0x27')](_0x1d8e5f[_0x9d4b('0x22')],qs[_0x9d4b('0x28')](_0x140b05['query'][_0x9d4b('0x28')]));_0x1cc2f2['attributes']=_0x1cc2f2[_0x9d4b('0x26')][_0x9d4b('0x29')]?_0x1cc2f2[_0x9d4b('0x26')]:_0x1d8e5f['model'];if(!_0x140b05[_0x9d4b('0x23')][_0x9d4b('0x2a')](_0x9d4b('0x2b'))){_0x1cc2f2[_0x9d4b('0x17')]=qs[_0x9d4b('0x17')](_0x140b05[_0x9d4b('0x23')][_0x9d4b('0x17')]);_0x1cc2f2['offset']=qs[_0x9d4b('0x15')](_0x140b05[_0x9d4b('0x23')][_0x9d4b('0x15')]);}_0x1cc2f2[_0x9d4b('0x2c')]=qs[_0x9d4b('0x2d')](_0x140b05[_0x9d4b('0x23')][_0x9d4b('0x2d')]);_0x1cc2f2[_0x9d4b('0x2e')]=qs[_0x9d4b('0x25')](_['pick'](_0x140b05[_0x9d4b('0x23')],_0x1d8e5f[_0x9d4b('0x25')]),_0x492f52);if(_0x140b05[_0x9d4b('0x23')][_0x9d4b('0x2f')]){_0x1cc2f2['where']=_[_0x9d4b('0x30')](_0x1cc2f2[_0x9d4b('0x2e')],{'$or':_[_0x9d4b('0x1e')](_0x492f52,function(_0x2b5d52){if(_0x2b5d52[_0x9d4b('0x31')]!==_0x9d4b('0x32')){var _0x2113b9={};_0x2113b9[_0x2b5d52[_0x9d4b('0x1c')]]={'$like':'%'+_0x140b05[_0x9d4b('0x23')][_0x9d4b('0x2f')]+'%'};return _0x2113b9;}})});}_0x1cc2f2=_[_0x9d4b('0x30')]({},_0x1cc2f2,_0x140b05[_0x9d4b('0x33')]);var _0x161d51={'where':_0x1cc2f2[_0x9d4b('0x2e')]};return db[_0x9d4b('0x1f')][_0x9d4b('0x18')](_0x161d51)[_0x9d4b('0x9')](function(_0x7730fd){_0x409deb[_0x9d4b('0x18')]=_0x7730fd;if(_0x140b05['query']['includeAll']){_0x1cc2f2[_0x9d4b('0x34')]=[{'all':!![]}];}return db[_0x9d4b('0x1f')][_0x9d4b('0x35')](_0x1cc2f2);})['then'](function(_0x475d29){_0x409deb['rows']=_0x475d29;return _0x409deb;})[_0x9d4b('0x9')](respondWithFilteredResult(_0x3bbaca,_0x1cc2f2))['catch'](handleError(_0x3bbaca,null));};exports[_0x9d4b('0x36')]=function(_0x9f4356,_0x444f15){var _0x1cbf00={'raw':!![],'where':{'id':_0x9f4356['params']['id']}},_0xe2eb03={};_0xe2eb03[_0x9d4b('0x22')]=_[_0x9d4b('0x24')](db[_0x9d4b('0x1f')][_0x9d4b('0x20')]);_0xe2eb03[_0x9d4b('0x23')]=_[_0x9d4b('0x24')](_0x9f4356[_0x9d4b('0x23')]);_0xe2eb03[_0x9d4b('0x25')]=_[_0x9d4b('0x27')](_0xe2eb03[_0x9d4b('0x22')],_0xe2eb03[_0x9d4b('0x23')]);_0x1cbf00[_0x9d4b('0x26')]=_[_0x9d4b('0x27')](_0xe2eb03['model'],qs[_0x9d4b('0x28')](_0x9f4356[_0x9d4b('0x23')][_0x9d4b('0x28')]));_0x1cbf00[_0x9d4b('0x26')]=_0x1cbf00[_0x9d4b('0x26')][_0x9d4b('0x29')]?_0x1cbf00[_0x9d4b('0x26')]:_0xe2eb03[_0x9d4b('0x22')];if(_0x9f4356['query'][_0x9d4b('0x37')]){_0x1cbf00[_0x9d4b('0x34')]=[{'all':!![]}];}_0x1cbf00=_[_0x9d4b('0x30')]({},_0x1cbf00,_0x9f4356[_0x9d4b('0x33')]);return db[_0x9d4b('0x1f')][_0x9d4b('0x38')](_0x1cbf00)[_0x9d4b('0x9')](handleEntityNotFound(_0x444f15,null))[_0x9d4b('0x9')](respondWithResult(_0x444f15,null))[_0x9d4b('0x39')](handleError(_0x444f15,null));};exports[_0x9d4b('0x3a')]=function(_0x4e2ac7,_0x150cdb){var _0x1799b7;return db['Network'][_0x9d4b('0x3a')](_0x4e2ac7[_0x9d4b('0x3b')],{'raw':!![]})[_0x9d4b('0x9')](function(_0x4b6c22){_0x1799b7=_0x4b6c22;return db[_0x9d4b('0x1f')][_0x9d4b('0x35')]({'where':{'type':_0x4e2ac7[_0x9d4b('0x3b')][_0x9d4b('0x31')]},'raw':!![]});})['then'](function(_0x4674fd){if(_0x1799b7['type'][_0x9d4b('0x3c')]()==_0x9d4b('0x3d')){var _0xa74be7=fs[_0x9d4b('0x3e')](path[_0x9d4b('0x3f')](config[_0x9d4b('0x40')],_0x9d4b('0x41')),_0x9d4b('0x42'));var _0x4de97d=ejs[_0x9d4b('0x43')](_0xa74be7,{'networks':_0x4674fd||[]});fs['writeFileSync'](_0x9d4b('0x44'),_0x4de97d);return respondWithRpcPromise('Reload',_0x9d4b('0x3a'),{'module':_0x9d4b('0x45')});}else if(_0x1799b7[_0x9d4b('0x31')][_0x9d4b('0x3c')]()==_0x9d4b('0x46')){var _0x45aa44=fs[_0x9d4b('0x3e')](path[_0x9d4b('0x3f')](config[_0x9d4b('0x40')],_0x9d4b('0x47')),_0x9d4b('0x42'));var _0x53ff7c=ejs[_0x9d4b('0x43')](_0x45aa44,{'networks':_0x4674fd||[]});fs[_0x9d4b('0x48')](_0x9d4b('0x49'),_0x53ff7c);return respondWithRpcPromise('Reload',_0x9d4b('0x3a'),{'module':'res_stun_monitor.so'});}else{var _0x3fe75b=fs[_0x9d4b('0x3e')](path[_0x9d4b('0x3f')](config[_0x9d4b('0x40')],_0x9d4b('0x4a')),'utf8');var _0x11d66a=ejs['render'](_0x3fe75b,{'networks':_0x4674fd||[]});fs['writeFileSync'](util[_0x9d4b('0x4b')](_0x9d4b('0x4c'),_0x4e2ac7[_0x9d4b('0x3b')][_0x9d4b('0x31')][_0x9d4b('0x4d')]()),_0x11d66a);return respondWithRpcPromise('Reload',_0x9d4b('0x3a'),{'module':_0x9d4b('0x4e')});}})['then'](function(){return _0x1799b7;})[_0x9d4b('0x9')](respondWithResult(_0x150cdb,0xc9))['catch'](handleError(_0x150cdb,null));};exports[_0x9d4b('0x19')]=function(_0x275d14,_0x2403bb){var _0x42cd5b;return db[_0x9d4b('0x1f')][_0x9d4b('0x38')]({'where':{'id':_0x275d14[_0x9d4b('0x4f')]['id']}})[_0x9d4b('0x9')](handleEntityNotFound(_0x2403bb,null))['then'](saveUpdates(_0x275d14['body'],null))[_0x9d4b('0x9')](function(_0x263587){if(_0x263587){_0x42cd5b=_0x263587;return db[_0x9d4b('0x1f')][_0x9d4b('0x35')]({'where':{'type':_0x42cd5b['type']},'raw':!![]});}return null;})[_0x9d4b('0x9')](function(_0x198aba){if(_0x42cd5b['type'][_0x9d4b('0x3c')]()==_0x9d4b('0x3d')){var _0x38a66c=fs[_0x9d4b('0x3e')](path[_0x9d4b('0x3f')](config['root'],_0x9d4b('0x41')),_0x9d4b('0x42'));var _0x3f9e0e=ejs['render'](_0x38a66c,{'networks':_0x198aba||[]});fs[_0x9d4b('0x48')](_0x9d4b('0x44'),_0x3f9e0e);return respondWithRpcPromise(_0x9d4b('0x50'),'update',{'module':_0x9d4b('0x45')});}else if(_0x42cd5b['type'][_0x9d4b('0x3c')]()=='TURN'){var _0x270da0=fs['readFileSync'](path[_0x9d4b('0x3f')](config[_0x9d4b('0x40')],_0x9d4b('0x47')),_0x9d4b('0x42'));var _0x430589=ejs[_0x9d4b('0x43')](_0x270da0,{'networks':_0x198aba||[]});fs[_0x9d4b('0x48')](_0x9d4b('0x49'),_0x430589);return respondWithRpcPromise(_0x9d4b('0x50'),_0x9d4b('0x19'),{'module':_0x9d4b('0x45')});}else{var _0xeff4e7=fs[_0x9d4b('0x3e')](path['join'](config[_0x9d4b('0x40')],_0x9d4b('0x4a')),'utf8');var _0x3d73af=ejs[_0x9d4b('0x43')](_0xeff4e7,{'networks':_0x198aba||[]});fs[_0x9d4b('0x48')](util[_0x9d4b('0x4b')]('/etc/asterisk/sip_xcally_%s.conf',_0x275d14['body'][_0x9d4b('0x31')]['toLowerCase']()),_0x3d73af);return respondWithRpcPromise('Reload','update',{'module':_0x9d4b('0x4e')});}})[_0x9d4b('0x9')](function(_0x52fd9b){if(_0x52fd9b){return _0x42cd5b;}return null;})[_0x9d4b('0x9')](respondWithResult(_0x2403bb,null))[_0x9d4b('0x39')](handleError(_0x2403bb,null));};exports[_0x9d4b('0x1a')]=function(_0x4b1d34,_0x5482a8){var _0x19ff59;return db[_0x9d4b('0x1f')][_0x9d4b('0x38')]({'where':{'id':_0x4b1d34[_0x9d4b('0x4f')]['id']}})[_0x9d4b('0x9')](function(_0x587376){_0x19ff59=_0x587376;return _0x587376;})[_0x9d4b('0x9')](handleEntityNotFound(_0x5482a8,null))[_0x9d4b('0x9')](removeEntity(_0x5482a8,null))[_0x9d4b('0x9')](function(){if(_0x19ff59){return db[_0x9d4b('0x1f')][_0x9d4b('0x35')]({'where':{'type':_0x19ff59[_0x9d4b('0x31')]},'raw':!![]});}})['then'](function(_0x2c00c3){if(_0x19ff59[_0x9d4b('0x31')]['toUpperCase']()=='STUN'){var _0x47a706=fs[_0x9d4b('0x3e')](path['join'](config[_0x9d4b('0x40')],_0x9d4b('0x41')),_0x9d4b('0x42'));var _0x43d985=ejs[_0x9d4b('0x43')](_0x47a706,{'networks':_0x2c00c3||[]});fs[_0x9d4b('0x48')](_0x9d4b('0x44'),_0x43d985);return respondWithRpcPromise(_0x9d4b('0x50'),'destroy',{'module':_0x9d4b('0x45')});}else if(_0x19ff59[_0x9d4b('0x31')][_0x9d4b('0x3c')]()=='TURN'){var _0x169506=fs[_0x9d4b('0x3e')](path[_0x9d4b('0x3f')](config[_0x9d4b('0x40')],_0x9d4b('0x47')),_0x9d4b('0x42'));var _0x3fb665=ejs[_0x9d4b('0x43')](_0x169506,{'networks':_0x2c00c3||[]});fs['writeFileSync'](_0x9d4b('0x49'),_0x3fb665);return respondWithRpcPromise(_0x9d4b('0x50'),'destroy',{'module':_0x9d4b('0x45')});}else{var _0x3da178=fs[_0x9d4b('0x3e')](path[_0x9d4b('0x3f')](config['root'],_0x9d4b('0x4a')),_0x9d4b('0x42'));var _0x9cc6c3=ejs[_0x9d4b('0x43')](_0x3da178,{'networks':_0x2c00c3||[]});fs['writeFileSync'](util[_0x9d4b('0x4b')]('/etc/asterisk/sip_xcally_%s.conf',_0x19ff59[_0x9d4b('0x31')][_0x9d4b('0x4d')]()),_0x9cc6c3);return respondWithRpcPromise(_0x9d4b('0x50'),'destroy',{'module':_0x9d4b('0x4e')});}})[_0x9d4b('0x39')](handleError(_0x5482a8,null));}; \ No newline at end of file diff --git a/server/api/network/network.model.js b/server/api/network/network.model.js index 582ed2c..ddd4ae7 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 _0x3667=['network','lodash','util','../../config/logger','api','moment','request-promise','path','../../config/environment','./network.attributes','exports','Network'];(function(_0xeb8606,_0x425ff3){var _0xb86a0c=function(_0x390ea2){while(--_0x390ea2){_0xeb8606['push'](_0xeb8606['shift']());}};_0xb86a0c(++_0x425ff3);}(_0x3667,0xcd));var _0x7366=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3667[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7366('0x0'));var util=require(_0x7366('0x1'));var logger=require(_0x7366('0x2'))(_0x7366('0x3'));var moment=require(_0x7366('0x4'));var BPromise=require('bluebird');var rp=require(_0x7366('0x5'));var fs=require('fs');var path=require(_0x7366('0x6'));var rimraf=require('rimraf');var config=require(_0x7366('0x7'));var attributes=require(_0x7366('0x8'));module[_0x7366('0x9')]=function(_0x1c0cf4,_0x101e3d){return _0x1c0cf4['define'](_0x7366('0xa'),attributes,{'tableName':_0x7366('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1bca=['Network','network','util','moment','request-promise','path','rimraf','./network.attributes','exports'];(function(_0xcf244f,_0xff2170){var _0x4676b6=function(_0x594fd0){while(--_0x594fd0){_0xcf244f['push'](_0xcf244f['shift']());}};_0x4676b6(++_0xff2170);}(_0x1bca,0xb6));var _0xa1bc=function(_0x3144c8,_0x3fe1a2){_0x3144c8=_0x3144c8-0x0;var _0x1468f0=_0x1bca[_0x3144c8];return _0x1468f0;};'use strict';var _=require('lodash');var util=require(_0xa1bc('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xa1bc('0x1'));var BPromise=require('bluebird');var rp=require(_0xa1bc('0x2'));var fs=require('fs');var path=require(_0xa1bc('0x3'));var rimraf=require(_0xa1bc('0x4'));var config=require('../../config/environment');var attributes=require(_0xa1bc('0x5'));module[_0xa1bc('0x6')]=function(_0x168b44,_0x268ced){return _0x168b44['define'](_0xa1bc('0x7'),attributes,{'tableName':_0xa1bc('0x8'),'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 1ba7393..8cc7e8a 100644 --- a/server/api/network/network.rpc.js +++ b/server/api/network/network.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','then','info','Network,\x20%s,\x20%s','request\x20sent','debug','Network,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x11cece,_0x44252d){var _0x11e4fa=function(_0x6060f7){while(--_0x6060f7){_0x11cece['push'](_0x11cece['shift']());}};_0x11e4fa(++_0x44252d);}(_0x9957,0x93));var _0x7995=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x9957[_0x5ddb1c];return _0x354adc;};'use strict';var _=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var moment=require(_0x7995('0x2'));var BPromise=require(_0x7995('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x7995('0x4'));var db=require(_0x7995('0x5'))['db'];var utils=require(_0x7995('0x6'));var logger=require(_0x7995('0x7'))('rpc');var config=require(_0x7995('0x8'));var jayson=require(_0x7995('0x9'));var client=jayson[_0x7995('0xa')][_0x7995('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xbda126,_0x326741,_0x4996ca){return new BPromise(function(_0x465276,_0x1cad37){return client['request'](_0xbda126,_0x4996ca)[_0x7995('0xc')](function(_0x3116fb){logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));logger[_0x7995('0x10')](_0x7995('0x11'),_0x326741,'request\x20sent',JSON[_0x7995('0x12')](_0x3116fb));if(_0x3116fb[_0x7995('0x13')]){if(_0x3116fb['error'][_0x7995('0x14')]===0x1f4){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x1cad37(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}logger['error']('Network,\x20%s,\x20%s',_0x326741,_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);return _0x465276(_0x3116fb[_0x7995('0x13')][_0x7995('0x15')]);}else{logger[_0x7995('0xd')](_0x7995('0xe'),_0x326741,_0x7995('0xf'));_0x465276(_0x3116fb[_0x7995('0x16')]['message']);}})[_0x7995('0x17')](function(_0x565d97){logger[_0x7995('0x13')](_0x7995('0xe'),_0x326741,_0x565d97);_0x1cad37(_0x565d97);});});} \ No newline at end of file +var _0x7a54=['info','Network,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0x7a54,0x106));var _0x47a5=function(_0x14ffa2,_0x460be6){_0x14ffa2=_0x14ffa2-0x0;var _0x353a81=_0x7a54[_0x14ffa2];return _0x353a81;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Network,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/index.js b/server/api/openchannelAccount/index.js index 953ada4..a6c5dc4 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 _0xf085=['express','fs-extra','../../components/auth/service','../../components/interaction/service','./openchannelAccount.controller','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/applications','getApplications','getInteractions','/:id/users','getAgents','post','create','addDisposition','/:id/notify','notify','addAgents','send','delete','destroy','removeAnswers','removeAgents','multer','util','path','connect-timeout'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf085,0x194));var _0x5f08=function(_0x1ebeea,_0x2f54f4){_0x1ebeea=_0x1ebeea-0x0;var _0x576465=_0xf085[_0x1ebeea];return _0x576465;};'use strict';var multer=require(_0x5f08('0x0'));var util=require(_0x5f08('0x1'));var path=require(_0x5f08('0x2'));var timeout=require(_0x5f08('0x3'));var express=require(_0x5f08('0x4'));var router=express['Router']();var fs_extra=require(_0x5f08('0x5'));var auth=require(_0x5f08('0x6'));var interaction=require(_0x5f08('0x7'));var config=require('../../config/environment');var controller=require(_0x5f08('0x8'));router[_0x5f08('0x9')]('/',auth[_0x5f08('0xa')](),controller['index']);router[_0x5f08('0x9')](_0x5f08('0xb'),auth[_0x5f08('0xa')](),controller[_0x5f08('0xc')]);router['get'](_0x5f08('0xd'),auth['isAuthenticated'](),controller[_0x5f08('0xe')]);router[_0x5f08('0x9')](_0x5f08('0xf'),auth[_0x5f08('0xa')](),controller[_0x5f08('0x10')]);router[_0x5f08('0x9')](_0x5f08('0x11'),auth['isAuthenticated'](),controller['getAnswers']);router['get'](_0x5f08('0x12'),auth['isAuthenticated'](),controller[_0x5f08('0x13')]);router['get']('/:id/interactions',auth[_0x5f08('0xa')](),controller[_0x5f08('0x14')]);router[_0x5f08('0x9')](_0x5f08('0x15'),auth[_0x5f08('0xa')](),controller[_0x5f08('0x16')]);router[_0x5f08('0x17')]('/',auth[_0x5f08('0xa')](),controller[_0x5f08('0x18')]);router[_0x5f08('0x17')]('/:id/dispositions',auth['isAuthenticated'](),controller[_0x5f08('0x19')]);router[_0x5f08('0x17')](_0x5f08('0x11'),auth['isAuthenticated'](),controller['addAnswer']);router['post'](_0x5f08('0x1a'),controller[_0x5f08('0x1b')]);router[_0x5f08('0x17')]('/:id/applications',auth[_0x5f08('0xa')](),controller['addApplications']);router[_0x5f08('0x17')]('/:id/users',auth['isAuthenticated'](),controller[_0x5f08('0x1c')]);router[_0x5f08('0x17')]('/:id/send',auth['isAuthenticated'](),controller[_0x5f08('0x1d')]);router['put'](_0x5f08('0xd'),auth[_0x5f08('0xa')](),controller['update']);router[_0x5f08('0x1e')](_0x5f08('0xd'),auth[_0x5f08('0xa')](),controller[_0x5f08('0x1f')]);router[_0x5f08('0x1e')](_0x5f08('0xf'),auth[_0x5f08('0xa')](),controller['removeDispositions']);router['delete'](_0x5f08('0x11'),auth[_0x5f08('0xa')](),controller[_0x5f08('0x20')]);router[_0x5f08('0x1e')](_0x5f08('0x15'),auth[_0x5f08('0xa')](),controller[_0x5f08('0x21')]);module['exports']=router; \ No newline at end of file +var _0x8d1d=['express','fs-extra','../../config/environment','./openchannelAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','/:id/users','getAgents','post','create','addDisposition','addAnswer','/:id/notify','notify','addApplications','addAgents','put','update','delete','destroy','removeDispositions','removeAgents','exports','multer','util','path','connect-timeout'];(function(_0x3f2dd5,_0xd6fc41){var _0x3d1b10=function(_0x37fe84){while(--_0x37fe84){_0x3f2dd5['push'](_0x3f2dd5['shift']());}};_0x3d1b10(++_0xd6fc41);}(_0x8d1d,0x1a9));var _0xd8d1=function(_0x2ce458,_0x297d54){_0x2ce458=_0x2ce458-0x0;var _0x260831=_0x8d1d[_0x2ce458];return _0x260831;};'use strict';var multer=require(_0xd8d1('0x0'));var util=require(_0xd8d1('0x1'));var path=require(_0xd8d1('0x2'));var timeout=require(_0xd8d1('0x3'));var express=require(_0xd8d1('0x4'));var router=express['Router']();var fs_extra=require(_0xd8d1('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd8d1('0x6'));var controller=require(_0xd8d1('0x7'));router[_0xd8d1('0x8')]('/',auth[_0xd8d1('0x9')](),controller[_0xd8d1('0xa')]);router[_0xd8d1('0x8')](_0xd8d1('0xb'),auth[_0xd8d1('0x9')](),controller[_0xd8d1('0xc')]);router[_0xd8d1('0x8')](_0xd8d1('0xd'),auth['isAuthenticated'](),controller[_0xd8d1('0xe')]);router[_0xd8d1('0x8')](_0xd8d1('0xf'),auth[_0xd8d1('0x9')](),controller[_0xd8d1('0x10')]);router['get'](_0xd8d1('0x11'),auth[_0xd8d1('0x9')](),controller[_0xd8d1('0x12')]);router[_0xd8d1('0x8')](_0xd8d1('0x13'),auth[_0xd8d1('0x9')](),controller[_0xd8d1('0x14')]);router[_0xd8d1('0x8')](_0xd8d1('0x15'),auth[_0xd8d1('0x9')](),controller['getInteractions']);router[_0xd8d1('0x8')](_0xd8d1('0x16'),auth[_0xd8d1('0x9')](),controller[_0xd8d1('0x17')]);router[_0xd8d1('0x18')]('/',auth['isAuthenticated'](),controller[_0xd8d1('0x19')]);router[_0xd8d1('0x18')](_0xd8d1('0xf'),auth[_0xd8d1('0x9')](),controller[_0xd8d1('0x1a')]);router[_0xd8d1('0x18')](_0xd8d1('0x11'),auth[_0xd8d1('0x9')](),controller[_0xd8d1('0x1b')]);router[_0xd8d1('0x18')](_0xd8d1('0x1c'),controller[_0xd8d1('0x1d')]);router[_0xd8d1('0x18')](_0xd8d1('0x13'),auth[_0xd8d1('0x9')](),controller[_0xd8d1('0x1e')]);router[_0xd8d1('0x18')](_0xd8d1('0x16'),auth[_0xd8d1('0x9')](),controller[_0xd8d1('0x1f')]);router['post']('/:id/send',auth[_0xd8d1('0x9')](),controller['send']);router[_0xd8d1('0x20')](_0xd8d1('0xd'),auth[_0xd8d1('0x9')](),controller[_0xd8d1('0x21')]);router[_0xd8d1('0x22')](_0xd8d1('0xd'),auth['isAuthenticated'](),controller[_0xd8d1('0x23')]);router[_0xd8d1('0x22')](_0xd8d1('0xf'),auth[_0xd8d1('0x9')](),controller[_0xd8d1('0x24')]);router[_0xd8d1('0x22')]('/:id/canned_answers',auth[_0xd8d1('0x9')](),controller['removeAnswers']);router[_0xd8d1('0x22')]('/:id/users',auth[_0xd8d1('0x9')](),controller[_0xd8d1('0x25')]);module[_0xd8d1('0x26')]=router; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.attributes.js b/server/api/openchannelAccount/openchannelAccount.attributes.js index 90a8702..08f4668 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 _0xf15e=['mandatoryDisposition','sequelize','randomstring','exports','STRING','name','generate','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue'];(function(_0x2ccd32,_0x406b2d){var _0x5e4fef=function(_0x333065){while(--_0x333065){_0x2ccd32['push'](_0x2ccd32['shift']());}};_0x5e4fef(++_0x406b2d);}(_0xf15e,0x15f));var _0xef15=function(_0x4d1fa2,_0xcdf2c7){_0x4d1fa2=_0x4d1fa2-0x0;var _0x249a40=_0xf15e[_0x4d1fa2];return _0x249a40;};'use strict';var Sequelize=require(_0xef15('0x0'));var rs=require(_0xef15('0x1'));module[_0xef15('0x2')]={'name':{'type':Sequelize[_0xef15('0x3')],'unique':_0xef15('0x4'),'allowNull':![]},'description':{'type':Sequelize['STRING']},'token':{'type':Sequelize[_0xef15('0x3')],'defaultValue':function(){return rs[_0xef15('0x5')]();}},'replyUri':{'type':Sequelize[_0xef15('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize[_0xef15('0x3')],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0xef15('0x6')],'defaultValue':function(){return _0xef15('0x7');}},'notificationSound':{'type':Sequelize[_0xef15('0x8')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0xef15('0x8')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0xef15('0x3')]},'queueTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0xef15('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0xef15('0x8')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0xef15('0x9')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0xef15('0x9')],'allowNull':!![],'defaultValue':null,'comment':_0xef15('0xa')},'mandatoryDisposition':{'type':Sequelize[_0xef15('0x8')],'defaultValue':![],'comment':_0xef15('0xb'),'set':function(_0x2df8f8){if(!_0x2df8f8)this[_0xef15('0xc')]('mandatoryDispositionPauseId',null);this[_0xef15('0xc')](_0xef15('0xd'),_0x2df8f8);}}}; \ No newline at end of file +var _0x4219=['randomstring','exports','STRING','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','mandatoryDispositionPauseId','mandatoryDisposition','sequelize'];(function(_0x34d823,_0x2d20b0){var _0x1eb90c=function(_0x43eda6){while(--_0x43eda6){_0x34d823['push'](_0x34d823['shift']());}};_0x1eb90c(++_0x2d20b0);}(_0x4219,0x103));var _0x9421=function(_0x5d0082,_0x5662b3){_0x5d0082=_0x5d0082-0x0;var _0x5ee87e=_0x4219[_0x5d0082];return _0x5ee87e;};'use strict';var Sequelize=require(_0x9421('0x0'));var rs=require(_0x9421('0x1'));module[_0x9421('0x2')]={'name':{'type':Sequelize[_0x9421('0x3')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x9421('0x3')]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x9421('0x4')]();}},'replyUri':{'type':Sequelize[_0x9421('0x3')],'validate':{'isUrl':!![]}},'key':{'type':Sequelize['STRING'],'allowNull':![]},'notificationTemplate':{'type':Sequelize[_0x9421('0x5')],'defaultValue':function(){return _0x9421('0x6');}},'notificationSound':{'type':Sequelize[_0x9421('0x7')],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9421('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'mapKey':{'type':Sequelize[_0x9421('0x3')]},'queueTransfer':{'type':Sequelize[_0x9421('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9421('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9421('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9421('0x8')],'allowNull':!![],'defaultValue':null,'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x9421('0x9'),'set':function(_0x206724){if(!_0x206724)this[_0x9421('0xa')](_0x9421('0xb'),null);this[_0x9421('0xa')](_0x9421('0xc'),_0x206724);}}}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.controller.js b/server/api/openchannelAccount/openchannelAccount.controller.js index 57930ed..e1e220f 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 _0x92e8=['fields','query','length','order','sort','where','pick','filters','filter','merge','VIRTUAL','includeAll','findAll','rows','catch','show','mandatoryDispositionPause','keys','include','options','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','OpenchannelAccountId','Disposition','getDispositions','findOne','nolimit','removeDispositions','ids','addAnswer','CannedAnswer','getAnswers','hasOwnProperty','removeAnswers','openchannel','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','isNil','from','body\x20is\x20mandatory\x20and\x20not\x20empty','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','mapKey','CmList','List','CmContact','Contacts','DESC','OpenchannelApplication','Applications','account','list','applications','orderBy','asc','contact','firstName','lastName','threadId','externalUrl','OpenchannelInteraction','ContactId','spread','messageId','interaction','created','autoclose','unmanaged','*,*,*,*','OpenchannelMessage','AttachmentId','UserId','unshift','agent','waitForTheAssignedAgent','forcedOwnership','startRouting','Start','EventManager','notify','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findAndCountAll','finally','json','getApplications','getInteractions','Contact','User','Owner','fullname','internal','Tag','Tags','color','tag','addAgents','omit','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','out','Messages','dataValues','push','eml-format','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','crypto','desk.js','to-csv','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelAccount.socket','register','jayson/promise','client','http','request','then','info','OpenchannelAccount,\x20%s,\x20%s','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','sendStatus','limit','undefined','count','offset','status','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelAccounts','end','stack','name','send','Pause','OpenchannelAccount','rawAttributes','fieldName','type','key','model','map','intersection','attributes'];(function(_0x38854e,_0x23cbc9){var _0x3f8415=function(_0x4e493e){while(--_0x4e493e){_0x38854e['push'](_0x38854e['shift']());}};_0x3f8415(++_0x23cbc9);}(_0x92e8,0x7f));var _0x892e=function(_0x23884b,_0x50c307){_0x23884b=_0x23884b-0x0;var _0x28113b=_0x92e8[_0x23884b];return _0x28113b;};'use strict';var emlformat=require(_0x892e('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x892e('0x1'));var rp=require('request-promise');var moment=require(_0x892e('0x2'));var BPromise=require(_0x892e('0x3'));var Mustache=require(_0x892e('0x4'));var util=require(_0x892e('0x5'));var path=require(_0x892e('0x6'));var sox=require(_0x892e('0x7'));var csv=require('to-csv');var ejs=require(_0x892e('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x892e('0x9'));var squel=require('squel');var crypto=require(_0x892e('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x892e('0xb'));var toCsv=require(_0x892e('0xc'));var querystring=require(_0x892e('0xd'));var Papa=require('papaparse');var Redis=require(_0x892e('0xe'));var authService=require(_0x892e('0xf'));var qs=require(_0x892e('0x10'));var as=require(_0x892e('0x11'));var hardwareService=require(_0x892e('0x12'));var logger=require('../../config/logger')(_0x892e('0x13'));var utils=require(_0x892e('0x14'));var config=require(_0x892e('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x892e('0x16'))['db'];config['redis']=_[_0x892e('0x17')](config[_0x892e('0x18')],{'host':_0x892e('0x19'),'port':0x18eb});var socket=require(_0x892e('0x1a'))(new Redis(config[_0x892e('0x18')]));require(_0x892e('0x1b'))[_0x892e('0x1c')](socket);var jayson=require(_0x892e('0x1d'));var client=jayson[_0x892e('0x1e')][_0x892e('0x1f')]({'port':0x232c});var client9002=jayson[_0x892e('0x1e')]['http']({'port':0x232a});function respondWithRpcPromise(_0x356a4f,_0x5a86eb,_0x1ff7f3,_0x5b238d){return new BPromise(function(_0x54da87,_0x719b5e){var _0x111ee2=_0x5b238d||client;return _0x111ee2[_0x892e('0x20')](_0x356a4f,_0x1ff7f3)[_0x892e('0x21')](function(_0x263ae9){logger[_0x892e('0x22')](_0x892e('0x23'),_0x5a86eb,'request\x20sent');logger[_0x892e('0x24')](_0x892e('0x25'),_0x5a86eb,_0x892e('0x26'),JSON[_0x892e('0x27')](_0x263ae9));if(_0x263ae9[_0x892e('0x28')]){if(_0x263ae9[_0x892e('0x28')][_0x892e('0x29')]===0x1f4){logger[_0x892e('0x28')](_0x892e('0x23'),_0x5a86eb,_0x263ae9[_0x892e('0x28')][_0x892e('0x2a')]);return _0x719b5e(_0x263ae9[_0x892e('0x28')][_0x892e('0x2a')]);}logger['error']('OpenchannelAccount,\x20%s,\x20%s',_0x5a86eb,_0x263ae9[_0x892e('0x28')][_0x892e('0x2a')]);return _0x54da87(_0x263ae9[_0x892e('0x28')]['message']);}else{logger[_0x892e('0x22')](_0x892e('0x23'),_0x5a86eb,_0x892e('0x26'));_0x54da87(_0x263ae9['result'][_0x892e('0x2a')]);}})['catch'](function(_0x5d8f7c){logger['error'](_0x892e('0x23'),_0x5a86eb,_0x5d8f7c);_0x719b5e(_0x5d8f7c);});});}function respondWithStatusCode(_0x468fa6,_0x1ab645){_0x1ab645=_0x1ab645||0xcc;return function(_0x3a9378){if(_0x3a9378){return _0x468fa6[_0x892e('0x2b')](_0x1ab645);}return _0x468fa6['status'](_0x1ab645)['end']();};}function respondWithResult(_0x1daf9f,_0x1dfc69){_0x1dfc69=_0x1dfc69||0xc8;return function(_0x471abd){if(_0x471abd){return _0x1daf9f['status'](_0x1dfc69)['json'](_0x471abd);}};}function respondWithFilteredResult(_0x1fac3c,_0x56dcc4){return function(_0x45dc0a){if(_0x45dc0a){var _0x253c76=typeof _0x56dcc4['offset']==='undefined'&&typeof _0x56dcc4[_0x892e('0x2c')]===_0x892e('0x2d');var _0x561721=_0x45dc0a[_0x892e('0x2e')];var _0xed104d=_0x253c76?0x0:_0x56dcc4[_0x892e('0x2f')];var _0x3a6350=_0x253c76?_0x45dc0a[_0x892e('0x2e')]:_0x56dcc4[_0x892e('0x2f')]+_0x56dcc4[_0x892e('0x2c')];var _0xb6c376;if(_0x3a6350>=_0x561721){_0x3a6350=_0x561721;_0xb6c376=0xc8;}else{_0xb6c376=0xce;}_0x1fac3c[_0x892e('0x30')](_0xb6c376);return _0x1fac3c[_0x892e('0x31')](_0x892e('0x32'),_0xed104d+'-'+_0x3a6350+'/'+_0x561721)['json'](_0x45dc0a);}return null;};}function patchUpdates(_0x573f7c){return function(_0x480c12){try{jsonpatch[_0x892e('0x33')](_0x480c12,_0x573f7c,!![]);}catch(_0xa0cbaa){return BPromise[_0x892e('0x34')](_0xa0cbaa);}return _0x480c12[_0x892e('0x35')]();};}function saveUpdates(_0x956644,_0x255d17){return function(_0x4e8426){if(_0x4e8426){return _0x4e8426[_0x892e('0x36')](_0x956644)[_0x892e('0x21')](function(_0x3fc5d2){return _0x3fc5d2;});}return null;};}function removeEntity(_0x2923e3,_0x525ff1){return function(_0x4c937e){if(_0x4c937e){return _0x4c937e[_0x892e('0x37')]()[_0x892e('0x21')](function(){var _0x4c5a9b=_0x4c937e[_0x892e('0x38')]({'plain':!![]});var _0x39ddd0=_0x892e('0x39');return db['UserProfileResource'][_0x892e('0x37')]({'where':{'type':_0x39ddd0,'resourceId':_0x4c5a9b['id']}})[_0x892e('0x21')](function(){return _0x4c937e;});})[_0x892e('0x21')](function(){_0x2923e3[_0x892e('0x30')](0xcc)[_0x892e('0x3a')]();});}};}function handleEntityNotFound(_0x27961d,_0x1394cb){return function(_0x3e26a3){if(!_0x3e26a3){_0x27961d[_0x892e('0x2b')](0x194);}return _0x3e26a3;};}function handleError(_0x59fabc,_0x2dd36c){_0x2dd36c=_0x2dd36c||0x1f4;return function(_0x127e68){logger[_0x892e('0x28')](_0x127e68[_0x892e('0x3b')]);if(_0x127e68[_0x892e('0x3c')]){delete _0x127e68['name'];}_0x59fabc['status'](_0x2dd36c)[_0x892e('0x3d')](_0x127e68);};}exports['index']=function(_0x1eb841,_0x10dbb9){var _0x106f50={'include':[{'model':db[_0x892e('0x3e')],'as':'mandatoryDispositionPause'}]},_0x3bc5db={},_0xcefcb9={'count':0x0,'rows':[]};var _0x8540b8=_['map'](db[_0x892e('0x3f')][_0x892e('0x40')],function(_0x49e77e){return{'name':_0x49e77e[_0x892e('0x41')],'type':_0x49e77e[_0x892e('0x42')][_0x892e('0x43')]};});_0x3bc5db[_0x892e('0x44')]=_[_0x892e('0x45')](_0x8540b8,_0x892e('0x3c'));_0x3bc5db['query']=_['keys'](_0x1eb841['query']);_0x3bc5db['filters']=_[_0x892e('0x46')](_0x3bc5db[_0x892e('0x44')],_0x3bc5db['query']);_0x106f50[_0x892e('0x47')]=_[_0x892e('0x46')](_0x3bc5db[_0x892e('0x44')],qs[_0x892e('0x48')](_0x1eb841[_0x892e('0x49')][_0x892e('0x48')]));_0x106f50[_0x892e('0x47')]=_0x106f50[_0x892e('0x47')][_0x892e('0x4a')]?_0x106f50[_0x892e('0x47')]:_0x3bc5db[_0x892e('0x44')];if(!_0x1eb841['query']['hasOwnProperty']('nolimit')){_0x106f50[_0x892e('0x2c')]=qs['limit'](_0x1eb841[_0x892e('0x49')][_0x892e('0x2c')]);_0x106f50[_0x892e('0x2f')]=qs[_0x892e('0x2f')](_0x1eb841['query'][_0x892e('0x2f')]);}_0x106f50[_0x892e('0x4b')]=qs[_0x892e('0x4c')](_0x1eb841[_0x892e('0x49')][_0x892e('0x4c')]);_0x106f50[_0x892e('0x4d')]=qs['filters'](_[_0x892e('0x4e')](_0x1eb841[_0x892e('0x49')],_0x3bc5db[_0x892e('0x4f')]),_0x8540b8);if(_0x1eb841[_0x892e('0x49')][_0x892e('0x50')]){_0x106f50[_0x892e('0x4d')]=_[_0x892e('0x51')](_0x106f50['where'],{'$or':_['map'](_0x8540b8,function(_0x4d8d95){if(_0x4d8d95[_0x892e('0x42')]!==_0x892e('0x52')){var _0x3e35f7={};_0x3e35f7[_0x4d8d95['name']]={'$like':'%'+_0x1eb841[_0x892e('0x49')]['filter']+'%'};return _0x3e35f7;}})});}_0x106f50=_[_0x892e('0x51')]({},_0x106f50,_0x1eb841['options']);var _0x3919c4={'where':_0x106f50[_0x892e('0x4d')]};return db[_0x892e('0x3f')]['count'](_0x3919c4)[_0x892e('0x21')](function(_0xfabfa4){_0xcefcb9['count']=_0xfabfa4;if(_0x1eb841['query'][_0x892e('0x53')]){_0x106f50['include']=[{'all':!![]}];}return db['OpenchannelAccount'][_0x892e('0x54')](_0x106f50);})['then'](function(_0xd7d2ae){_0xcefcb9[_0x892e('0x55')]=_0xd7d2ae;return _0xcefcb9;})[_0x892e('0x21')](respondWithFilteredResult(_0x10dbb9,_0x106f50))[_0x892e('0x56')](handleError(_0x10dbb9,null));};exports[_0x892e('0x57')]=function(_0x4a46b9,_0x108861){var _0x365e5f={'raw':![],'where':{'id':_0x4a46b9['params']['id']},'include':[{'model':db['Pause'],'as':_0x892e('0x58')}]},_0x2a821c={};_0x2a821c['model']=_[_0x892e('0x59')](db['OpenchannelAccount'][_0x892e('0x40')]);_0x2a821c[_0x892e('0x49')]=_[_0x892e('0x59')](_0x4a46b9[_0x892e('0x49')]);_0x2a821c[_0x892e('0x4f')]=_[_0x892e('0x46')](_0x2a821c['model'],_0x2a821c[_0x892e('0x49')]);_0x365e5f[_0x892e('0x47')]=_[_0x892e('0x46')](_0x2a821c['model'],qs['fields'](_0x4a46b9[_0x892e('0x49')][_0x892e('0x48')]));_0x365e5f['attributes']=_0x365e5f['attributes'][_0x892e('0x4a')]?_0x365e5f[_0x892e('0x47')]:_0x2a821c[_0x892e('0x44')];if(_0x4a46b9[_0x892e('0x49')][_0x892e('0x53')]){_0x365e5f[_0x892e('0x5a')]=[{'all':!![]}];}_0x365e5f=_[_0x892e('0x51')]({},_0x365e5f,_0x4a46b9[_0x892e('0x5b')]);return db[_0x892e('0x3f')]['find'](_0x365e5f)['then'](handleEntityNotFound(_0x108861,null))[_0x892e('0x21')](respondWithResult(_0x108861,null))[_0x892e('0x56')](handleError(_0x108861,null));};exports[_0x892e('0x5c')]=function(_0x2bdb69,_0x190174){return db['OpenchannelAccount'][_0x892e('0x5c')](_0x2bdb69[_0x892e('0x5d')],{})[_0x892e('0x21')](function(_0xfb4780){var _0x1b693c=_0x2bdb69[_0x892e('0x5e')]['get']({'plain':!![]});if(!_0x1b693c)throw new Error(_0x892e('0x5f'));if(_0x1b693c[_0x892e('0x60')]==='user'){var _0x846dd3=_0xfb4780[_0x892e('0x38')]({'plain':!![]});var _0x21038e=_0x892e('0x39');return db[_0x892e('0x61')][_0x892e('0x62')]({'where':{'name':_0x21038e,'userProfileId':_0x1b693c['userProfileId']},'raw':!![]})['then'](function(_0x51abf5){if(_0x51abf5&&_0x51abf5[_0x892e('0x63')]===0x0){return db['UserProfileResource']['create']({'name':_0x846dd3['name'],'resourceId':_0x846dd3['id'],'type':_0x51abf5['name'],'sectionId':_0x51abf5['id']},{})['then'](function(){return _0xfb4780;});}else{return _0xfb4780;}})[_0x892e('0x56')](function(_0x31b044){logger[_0x892e('0x28')](_0x892e('0x64'),_0x31b044);throw _0x31b044;});}return _0xfb4780;})[_0x892e('0x21')](respondWithResult(_0x190174,0xc9))['catch'](handleError(_0x190174,null));};exports[_0x892e('0x36')]=function(_0x53ca50,_0x380f16){if(_0x53ca50[_0x892e('0x5d')]['id']){delete _0x53ca50[_0x892e('0x5d')]['id'];}return db[_0x892e('0x3f')][_0x892e('0x62')]({'where':{'id':_0x53ca50[_0x892e('0x65')]['id']},'include':[{'model':db[_0x892e('0x3e')],'as':_0x892e('0x58')}]})[_0x892e('0x21')](handleEntityNotFound(_0x380f16,null))['then'](saveUpdates(_0x53ca50[_0x892e('0x5d')],null))[_0x892e('0x21')](respondWithResult(_0x380f16,null))[_0x892e('0x56')](handleError(_0x380f16,null));};exports[_0x892e('0x37')]=function(_0x55a662,_0x4baa59){return db[_0x892e('0x3f')]['find']({'where':{'id':_0x55a662[_0x892e('0x65')]['id']}})[_0x892e('0x21')](handleEntityNotFound(_0x4baa59,null))[_0x892e('0x21')](removeEntity(_0x4baa59,null))['catch'](handleError(_0x4baa59,null));};exports[_0x892e('0x66')]=function(_0x2eae4d,_0x25819b){return db[_0x892e('0x3f')][_0x892e('0x66')]()['then'](respondWithResult(_0x25819b,null))['catch'](handleError(_0x25819b,null));};exports['addDisposition']=function(_0x151f9b,_0x321d48,_0x3308eb){if(_0x151f9b[_0x892e('0x5d')]['id']){delete _0x151f9b[_0x892e('0x5d')]['id'];}return db[_0x892e('0x3f')][_0x892e('0x62')]({'where':{'id':_0x151f9b[_0x892e('0x65')]['id']}})[_0x892e('0x21')](handleEntityNotFound(_0x321d48,null))['then'](function(_0x351187){if(_0x351187){_0x151f9b[_0x892e('0x5d')][_0x892e('0x67')]=_0x351187['id'];return db[_0x892e('0x68')][_0x892e('0x5c')](_0x151f9b[_0x892e('0x5d')]);}})['then'](respondWithResult(_0x321d48,null))['catch'](handleError(_0x321d48,null));};exports[_0x892e('0x69')]=function(_0x114513,_0x247a32,_0x98492e){var _0x718849={'raw':![],'where':{}};var _0x3ae30b={};var _0x2b7dbb={'count':0x0,'rows':[]};return db[_0x892e('0x3f')][_0x892e('0x6a')]({'where':{'id':_0x114513[_0x892e('0x65')]['id']}})['then'](handleEntityNotFound(_0x247a32,null))[_0x892e('0x21')](function(_0x42a5e0){if(_0x42a5e0){_0x3ae30b['model']=_['keys'](db[_0x892e('0x68')]['rawAttributes']);_0x3ae30b[_0x892e('0x49')]=_[_0x892e('0x59')](_0x114513[_0x892e('0x49')]);_0x3ae30b[_0x892e('0x4f')]=_[_0x892e('0x46')](_0x3ae30b[_0x892e('0x44')],_0x3ae30b['query']);_0x718849[_0x892e('0x47')]=_[_0x892e('0x46')](_0x3ae30b[_0x892e('0x44')],qs[_0x892e('0x48')](_0x114513[_0x892e('0x49')][_0x892e('0x48')]));_0x718849['attributes']=_0x718849[_0x892e('0x47')]['length']?_0x718849[_0x892e('0x47')]:_0x3ae30b[_0x892e('0x44')];if(!_0x114513[_0x892e('0x49')]['hasOwnProperty'](_0x892e('0x6b'))){_0x718849[_0x892e('0x2c')]=qs[_0x892e('0x2c')](_0x114513['query']['limit']);_0x718849[_0x892e('0x2f')]=qs[_0x892e('0x2f')](_0x114513['query']['offset']);}_0x718849[_0x892e('0x4b')]=qs[_0x892e('0x4c')](_0x114513[_0x892e('0x49')][_0x892e('0x4c')]);_0x718849['where']=qs['filters'](_[_0x892e('0x4e')](_0x114513[_0x892e('0x49')],_0x3ae30b[_0x892e('0x4f')]));_0x718849[_0x892e('0x4d')][_0x892e('0x67')]=_0x42a5e0['id'];if(_0x114513[_0x892e('0x49')]['filter']){_0x718849['where']=_[_0x892e('0x51')](_0x718849[_0x892e('0x4d')],{'$or':_[_0x892e('0x45')](_0x718849[_0x892e('0x47')],function(_0x4e0bee){var _0x353389={};_0x353389[_0x4e0bee]={'$like':'%'+_0x114513[_0x892e('0x49')][_0x892e('0x50')]+'%'};return _0x353389;})});}_0x718849=_[_0x892e('0x51')]({},_0x718849,_0x114513['options']);return db[_0x892e('0x68')]['count']({'where':_0x718849[_0x892e('0x4d')]})[_0x892e('0x21')](function(_0x20de4e){_0x2b7dbb[_0x892e('0x2e')]=_0x20de4e;if(_0x114513[_0x892e('0x49')]['includeAll']){_0x718849[_0x892e('0x5a')]=[{'all':!![]}];}return db[_0x892e('0x68')][_0x892e('0x54')](_0x718849);})[_0x892e('0x21')](function(_0x3e8fdf){_0x2b7dbb[_0x892e('0x55')]=_0x3e8fdf;return _0x2b7dbb;});}})[_0x892e('0x21')](respondWithFilteredResult(_0x247a32,_0x718849))[_0x892e('0x56')](handleError(_0x247a32,null));};exports[_0x892e('0x6c')]=function(_0x325ad9,_0x5853e1,_0x45c86b){return db[_0x892e('0x3f')]['find']({'where':{'id':_0x325ad9[_0x892e('0x65')]['id']}})[_0x892e('0x21')](handleEntityNotFound(_0x5853e1,null))[_0x892e('0x21')](function(_0xa7d0d2){if(_0xa7d0d2){return _0xa7d0d2[_0x892e('0x6c')](_0x325ad9[_0x892e('0x49')][_0x892e('0x6d')]);}})['then'](respondWithStatusCode(_0x5853e1,null))[_0x892e('0x56')](handleError(_0x5853e1,null));};exports[_0x892e('0x6e')]=function(_0x4fed18,_0x2413f6,_0x2268de){if(_0x4fed18['body']['id']){delete _0x4fed18['body']['id'];}return db[_0x892e('0x3f')][_0x892e('0x62')]({'where':{'id':_0x4fed18[_0x892e('0x65')]['id']}})[_0x892e('0x21')](handleEntityNotFound(_0x2413f6,null))[_0x892e('0x21')](function(_0x3b6e14){if(_0x3b6e14){_0x4fed18['body'][_0x892e('0x67')]=_0x3b6e14['id'];return db[_0x892e('0x6f')][_0x892e('0x5c')](_0x4fed18[_0x892e('0x5d')]);}})[_0x892e('0x21')](respondWithResult(_0x2413f6,null))[_0x892e('0x56')](handleError(_0x2413f6,null));};exports[_0x892e('0x70')]=function(_0x5389a2,_0x50c4c3,_0x339421){var _0x1d8ba7={'raw':![],'where':{}};var _0x1adeb8={};var _0x1062b1={'count':0x0,'rows':[]};return db[_0x892e('0x3f')][_0x892e('0x6a')]({'where':{'id':_0x5389a2[_0x892e('0x65')]['id']}})[_0x892e('0x21')](handleEntityNotFound(_0x50c4c3,null))[_0x892e('0x21')](function(_0x21146d){if(_0x21146d){_0x1adeb8['model']=_['keys'](db[_0x892e('0x6f')]['rawAttributes']);_0x1adeb8[_0x892e('0x49')]=_[_0x892e('0x59')](_0x5389a2[_0x892e('0x49')]);_0x1adeb8['filters']=_[_0x892e('0x46')](_0x1adeb8[_0x892e('0x44')],_0x1adeb8[_0x892e('0x49')]);_0x1d8ba7[_0x892e('0x47')]=_[_0x892e('0x46')](_0x1adeb8[_0x892e('0x44')],qs['fields'](_0x5389a2['query'][_0x892e('0x48')]));_0x1d8ba7['attributes']=_0x1d8ba7[_0x892e('0x47')]['length']?_0x1d8ba7[_0x892e('0x47')]:_0x1adeb8['model'];if(!_0x5389a2[_0x892e('0x49')][_0x892e('0x71')](_0x892e('0x6b'))){_0x1d8ba7[_0x892e('0x2c')]=qs['limit'](_0x5389a2['query'][_0x892e('0x2c')]);_0x1d8ba7[_0x892e('0x2f')]=qs[_0x892e('0x2f')](_0x5389a2[_0x892e('0x49')]['offset']);}_0x1d8ba7['order']=qs[_0x892e('0x4c')](_0x5389a2[_0x892e('0x49')][_0x892e('0x4c')]);_0x1d8ba7[_0x892e('0x4d')]=qs[_0x892e('0x4f')](_[_0x892e('0x4e')](_0x5389a2[_0x892e('0x49')],_0x1adeb8['filters']));_0x1d8ba7[_0x892e('0x4d')][_0x892e('0x67')]=_0x21146d['id'];if(_0x5389a2[_0x892e('0x49')][_0x892e('0x50')]){_0x1d8ba7[_0x892e('0x4d')]=_['merge'](_0x1d8ba7[_0x892e('0x4d')],{'$or':_['map'](_0x1d8ba7['attributes'],function(_0x212b26){var _0x488a85={};_0x488a85[_0x212b26]={'$like':'%'+_0x5389a2[_0x892e('0x49')][_0x892e('0x50')]+'%'};return _0x488a85;})});}_0x1d8ba7=_['merge']({},_0x1d8ba7,_0x5389a2[_0x892e('0x5b')]);return db['CannedAnswer'][_0x892e('0x2e')]({'where':_0x1d8ba7[_0x892e('0x4d')]})[_0x892e('0x21')](function(_0xc8db3f){_0x1062b1[_0x892e('0x2e')]=_0xc8db3f;if(_0x5389a2['query']['includeAll']){_0x1d8ba7['include']=[{'all':!![]}];}return db[_0x892e('0x6f')][_0x892e('0x54')](_0x1d8ba7);})['then'](function(_0x580a35){_0x1062b1['rows']=_0x580a35;return _0x1062b1;});}})['then'](respondWithFilteredResult(_0x50c4c3,_0x1d8ba7))['catch'](handleError(_0x50c4c3,null));};exports['removeAnswers']=function(_0x458bb4,_0xac8b96,_0x351e7d){return db[_0x892e('0x3f')][_0x892e('0x62')]({'where':{'id':_0x458bb4[_0x892e('0x65')]['id']}})[_0x892e('0x21')](handleEntityNotFound(_0xac8b96,null))['then'](function(_0x407d4e){if(_0x407d4e){return _0x407d4e[_0x892e('0x72')](_0x458bb4[_0x892e('0x49')][_0x892e('0x6d')]);}})[_0x892e('0x21')](respondWithStatusCode(_0xac8b96,null))[_0x892e('0x56')](handleError(_0xac8b96,null));};exports['notify']=function(_0x34733b,_0x5b4005,_0x396a83){var _0x4cf5b0={'body':_0x34733b[_0x892e('0x5d')],'channel':_0x892e('0x73')};var _0x2bfacf=[];var _0x223296=[];var _0x117190={};var _0x2b1dda=![];return db['CmContact'][_0x892e('0x66')]()[_0x892e('0x21')](function(_0x520e03){if(!_0x520e03){throw new db[(_0x892e('0x74'))][(_0x892e('0x75'))](_0x892e('0x76'));}_0x2bfacf=_[_0x892e('0x77')](_['keys'](_0x520e03),[_0x892e('0x78'),_0x892e('0x79')]);_0x223296=_[_0x892e('0x77')](_[_0x892e('0x59')](_0x520e03),[_0x892e('0x78'),_0x892e('0x79'),_0x892e('0x7a'),_0x892e('0x7b')]);if(_0x34733b[_0x892e('0x5d')]['id']){delete _0x34733b[_0x892e('0x5d')]['id'];}if(_[_0x892e('0x7c')](_0x34733b[_0x892e('0x5d')][_0x892e('0x7d')])){throw new db[(_0x892e('0x74'))][(_0x892e('0x75'))]('from\x20is\x20mandatory');}if(_[_0x892e('0x7c')](_0x34733b[_0x892e('0x5d')][_0x892e('0x5d')])||_0x34733b[_0x892e('0x5d')]['body']===''){throw new db[(_0x892e('0x74'))][(_0x892e('0x75'))](_0x892e('0x7e'));}if(_[_0x892e('0x7c')](_0x34733b['body']['mapKey'])){throw new db[(_0x892e('0x74'))][(_0x892e('0x75'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x223296);}if(!_[_0x892e('0x7f')](_0x223296,_0x34733b[_0x892e('0x5d')]['mapKey'])){throw new db[(_0x892e('0x74'))][(_0x892e('0x75'))](_0x892e('0x80')+_0x223296);}_0x117190[_0x34733b[_0x892e('0x5d')][_0x892e('0x81')]]=_0x34733b[_0x892e('0x5d')][_0x892e('0x7d')];})['then'](function(){return db[_0x892e('0x3f')][_0x892e('0x62')]({'where':{'id':_0x34733b[_0x892e('0x65')]['id']},'include':[{'model':db[_0x892e('0x82')],'as':_0x892e('0x83'),'include':[{'model':db[_0x892e('0x84')],'as':_0x892e('0x85'),'where':_0x117190,'limit':0x1,'order':[[_0x892e('0x79'),_0x892e('0x86')]]}]},{'model':db[_0x892e('0x87')],'as':_0x892e('0x88')}]});})[_0x892e('0x21')](handleEntityNotFound(_0x5b4005,null))[_0x892e('0x21')](function(_0xb6abc8){if(_0xb6abc8&&_0xb6abc8['List']){_0x4cf5b0[_0x892e('0x89')]=_0xb6abc8;_0x4cf5b0['applications']=_0xb6abc8[_0x892e('0x88')];_0x4cf5b0[_0x892e('0x8a')]=_0xb6abc8[_0x892e('0x83')];_0x4cf5b0[_0x892e('0x8b')]=_[_0x892e('0x8c')](_0x4cf5b0['applications'],['priority'],[_0x892e('0x8d')]);if(_0x4cf5b0[_0x892e('0x89')]['Applications']){delete _0x4cf5b0[_0x892e('0x89')]['Applications'];}if(_0x4cf5b0[_0x892e('0x89')]['List']&&_0x4cf5b0[_0x892e('0x89')][_0x892e('0x83')][_0x892e('0x85')][_0x892e('0x4a')]){return _0x4cf5b0['account'][_0x892e('0x83')]['Contacts'][0x0];}var _0x4d7223=_['defaults'](_0x34733b[_0x892e('0x5d')],{'firstName':_0x34733b[_0x892e('0x5d')][_0x892e('0x7d')],'ListId':_0xb6abc8[_0x892e('0x7b')]});_0x4d7223[_0x34733b[_0x892e('0x5d')]['mapKey']]=_0x34733b[_0x892e('0x5d')][_0x892e('0x7d')];return db['CmContact']['create'](_0x4d7223,{'fields':_0x2bfacf,'raw':!![]});}})[_0x892e('0x21')](handleEntityNotFound(_0x5b4005,null))[_0x892e('0x21')](function(_0x487eb2){_0x4cf5b0[_0x892e('0x8e')]=_0x487eb2;if(_0x487eb2){var _0x32acc9={'ContactId':_0x487eb2['id'],'OpenchannelAccountId':_0x34733b[_0x892e('0x65')]['id'],'from':(_0x487eb2[_0x892e('0x8f')]||'')+'\x20'+(_0x487eb2[_0x892e('0x90')]||'')};var _0x5f129a={'OpenchannelAccountId':_0x34733b[_0x892e('0x65')]['id'],'closed':![]};if(_0x34733b[_0x892e('0x5d')][_0x892e('0x91')]){_0x5f129a[_0x892e('0x91')]=_0x34733b['body'][_0x892e('0x91')];return db['OpenchannelInteraction'][_0x892e('0x62')]({'where':_0x5f129a})[_0x892e('0x21')](function(_0x1ba3f2){if(_0x1ba3f2){return[_0x1ba3f2,![]];}_0x32acc9['threadId']=_0x34733b[_0x892e('0x5d')][_0x892e('0x91')];_0x32acc9[_0x892e('0x92')]=_0x34733b[_0x892e('0x5d')]['externalUrl'];return db[_0x892e('0x93')][_0x892e('0x5c')](_0x32acc9)[_0x892e('0x21')](function(_0x327c2e){return[_0x327c2e,!![]];});});}else{_0x5f129a['threadId']=null;}_0x5f129a[_0x892e('0x94')]=_0x487eb2['id'];return db['OpenchannelInteraction'][_0x892e('0x62')]({'where':_0x5f129a})['then'](function(_0x4668b4){if(_0x4668b4){return[_0x4668b4,![]];}return db['OpenchannelInteraction'][_0x892e('0x5c')](_0x32acc9)['then'](function(_0x5e5e07){return[_0x5e5e07,!![]];});});}})[_0x892e('0x95')](function(_0x47e3f2,_0x1d724b){if(_0x47e3f2){_0x2b1dda=_0x1d724b;if(!_0x1d724b){var _0x1a9d94={'from':(_0x4cf5b0['contact'][_0x892e('0x8f')]||'')+'\x20'+(_0x4cf5b0[_0x892e('0x8e')][_0x892e('0x90')]||'')};if(_0x34733b['body']['threadId']&&_0x34733b[_0x892e('0x5d')][_0x892e('0x96')]&&_0x34733b[_0x892e('0x5d')][_0x892e('0x91')]!=_0x34733b['body'][_0x892e('0x96')]){_0x1a9d94[_0x892e('0x91')]=_0x34733b[_0x892e('0x5d')][_0x892e('0x96')];}return _0x47e3f2['update'](_0x1a9d94);}else{return _0x47e3f2;}}})[_0x892e('0x21')](function(_0x348423){_0x4cf5b0[_0x892e('0x97')]=_0x348423['get']({'plain':!![]});_0x4cf5b0[_0x892e('0x97')][_0x892e('0x98')]=_0x2b1dda;if(_0x4cf5b0[_0x892e('0x97')][_0x892e('0x98')]){if(_0x4cf5b0[_0x892e('0x89')][_0x892e('0x99')]){_0x4cf5b0[_0x892e('0x8b')]['push']({'id':0x0,'priority':_0x4cf5b0[_0x892e('0x8b')][_0x892e('0x4a')]+0x1,'app':'close','appdata':_0x892e('0x9a'),'interval':_0x892e('0x9b')});}}return db[_0x892e('0x9c')][_0x892e('0x5c')]({'body':_0x34733b['body'][_0x892e('0x5d')],'OpenchannelAccountId':_0x34733b[_0x892e('0x65')]['id'],'OpenchannelInteractionId':_0x348423['id'],'direction':'in','ContactId':_0x4cf5b0[_0x892e('0x8e')]['id'],'AttachmentId':_0x34733b['body'][_0x892e('0x9d')]});})[_0x892e('0x21')](function(_0xda0d0f){_0x4cf5b0[_0x892e('0x2a')]=_0xda0d0f;if(_0x4cf5b0[_0x892e('0x97')]['UserId']){return db['User'][_0x892e('0x62')]({'attributes':['id','name'],'where':{'id':_0x4cf5b0['interaction'][_0x892e('0x9e')]}})['then'](function(_0x14d935){if(_0x14d935){_0x4cf5b0[_0x892e('0x8b')][_0x892e('0x9f')]({'id':0x0,'priority':0x0,'app':_0x892e('0xa0'),'appdata':_0x14d935[_0x892e('0x3c')]+','+(_0x4cf5b0[_0x892e('0x89')][_0x892e('0xa1')]||0xa),'interval':_0x892e('0x9b')});_0x4cf5b0[_0x892e('0xa2')]=![];}return respondWithRpcPromise('Start',_0x892e('0xa3'),_0x4cf5b0);});}return respondWithRpcPromise(_0x892e('0xa4'),_0x892e('0xa3'),_0x4cf5b0);})[_0x892e('0x21')](function(_0x4f6c19){respondWithRpcPromise('EventManager',_0x892e('0xa5'),{'event':_0x892e('0xa6'),'message':_0x4f6c19},client9002);return _0x4f6c19;})[_0x892e('0x21')](respondWithResult(_0x5b4005,null))['catch'](handleError(_0x5b4005,null));};exports[_0x892e('0xa7')]=function(_0x1e3983,_0x52d365){var _0x325623=_0x1e3983[_0x892e('0x65')]['id'];var _0x1c07e2=_0x1e3983[_0x892e('0x5d')];var _0x50a956=0xc8;var _0x1d2a8c=null;return db[_0x892e('0xa8')][_0x892e('0xa9')]({'isolationLevel':db[_0x892e('0xa8')][_0x892e('0xaa')][_0x892e('0xab')][_0x892e('0xac')]},function(_0x203bba){return db[_0x892e('0x3f')][_0x892e('0x6a')]({'where':{'id':_0x325623},'transaction':_0x203bba})['then'](function(_0x110389){if(_0x110389){return db['OpenchannelApplication'][_0x892e('0x37')]({'where':{'OpenchannelAccountId':_0x325623},'transaction':_0x203bba})[_0x892e('0x21')](function(){var _0x445b73=_[_0x892e('0x45')](_0x1c07e2,function(_0x81c0c3){_0x81c0c3[_0x892e('0x67')]=_0x325623;return _0x81c0c3;});return db[_0x892e('0x87')]['bulkCreate'](_0x445b73,{'transaction':_0x203bba});});}else{_0x50a956=0x194;_0x1d2a8c=[];}});})[_0x892e('0x21')](function(){if(_0x50a956!==0x194){return db[_0x892e('0x87')][_0x892e('0xad')]({'where':{'OpenchannelAccountId':_0x325623},'order':'priority'})['then'](function(_0x15e785){_0x1d2a8c=_0x15e785;});}})[_0x892e('0x56')](function(_0x384de2){_0x50a956=0x1f4;logger[_0x892e('0x28')](_0x384de2[_0x892e('0x3b')]);if(_0x384de2[_0x892e('0x3c')]){delete _0x384de2[_0x892e('0x3c')];}_0x1d2a8c=_0x384de2;})[_0x892e('0xae')](function(){if(_0x1d2a8c===null){_0x52d365[_0x892e('0x2b')](_0x50a956);}else{if(_0x50a956===0x1f4){_0x52d365[_0x892e('0x30')](_0x50a956)['send'](_0x1d2a8c);}else{_0x52d365[_0x892e('0x30')](_0x50a956)[_0x892e('0xaf')](_0x1d2a8c);}}});};exports[_0x892e('0xb0')]=function(_0x427400,_0x35773a,_0x338fd1){var _0x29b436={};var _0xce12a2={};var _0x36b114;var _0x12707f;return db[_0x892e('0x3f')][_0x892e('0x6a')]({'where':{'id':_0x427400[_0x892e('0x65')]['id']}})['then'](handleEntityNotFound(_0x35773a,null))[_0x892e('0x21')](function(_0x5eaa34){if(_0x5eaa34){_0x36b114=_0x5eaa34;_0xce12a2[_0x892e('0x44')]=_[_0x892e('0x59')](db[_0x892e('0x87')][_0x892e('0x40')]);_0xce12a2['query']=_[_0x892e('0x59')](_0x427400[_0x892e('0x49')]);_0xce12a2[_0x892e('0x4f')]=_[_0x892e('0x46')](_0xce12a2[_0x892e('0x44')],_0xce12a2[_0x892e('0x49')]);_0x29b436['attributes']=_['intersection'](_0xce12a2[_0x892e('0x44')],qs[_0x892e('0x48')](_0x427400[_0x892e('0x49')]['fields']));_0x29b436[_0x892e('0x47')]=_0x29b436[_0x892e('0x47')][_0x892e('0x4a')]?_0x29b436[_0x892e('0x47')]:_0xce12a2[_0x892e('0x44')];_0x29b436['order']=qs[_0x892e('0x4c')](_0x427400[_0x892e('0x49')][_0x892e('0x4c')]);_0x29b436[_0x892e('0x4d')]=qs[_0x892e('0x4f')](_[_0x892e('0x4e')](_0x427400['query'],_0xce12a2['filters']));if(_0x427400['query']['filter']){_0x29b436[_0x892e('0x4d')]=_[_0x892e('0x51')](_0x29b436[_0x892e('0x4d')],{'$or':_['map'](_0x29b436[_0x892e('0x47')],function(_0x43ca07){var _0xff59d4={};_0xff59d4[_0x43ca07]={'$like':'%'+_0x427400[_0x892e('0x49')]['filter']+'%'};return _0xff59d4;})});}_0x29b436=_[_0x892e('0x51')]({},_0x29b436,_0x427400['options']);return _0x36b114[_0x892e('0xb0')](_0x29b436);}})[_0x892e('0x21')](function(_0x5dc283){if(_0x5dc283){_0x12707f=_0x5dc283[_0x892e('0x4a')];if(!_0x427400[_0x892e('0x49')][_0x892e('0x71')](_0x892e('0x6b'))){_0x29b436[_0x892e('0x2c')]=qs['limit'](_0x427400[_0x892e('0x49')][_0x892e('0x2c')]);_0x29b436[_0x892e('0x2f')]=qs[_0x892e('0x2f')](_0x427400['query']['offset']);}return _0x36b114[_0x892e('0xb0')](_0x29b436);}})['then'](function(_0x3d9708){if(_0x3d9708){return _0x3d9708?{'count':_0x12707f,'rows':_0x3d9708}:null;}})['then'](respondWithResult(_0x35773a,null))[_0x892e('0x56')](handleError(_0x35773a,null));};exports[_0x892e('0xb1')]=function(_0x54aac8,_0x21cf56,_0x507f0c){var _0x144a51={'raw':![],'where':{}};var _0xaef3b6={};var _0x16859e={'count':0x0,'rows':[]};return db['OpenchannelAccount'][_0x892e('0x6a')]({'where':{'id':_0x54aac8[_0x892e('0x65')]['id']}})[_0x892e('0x21')](handleEntityNotFound(_0x21cf56,null))[_0x892e('0x21')](function(_0x4a2d0e){if(_0x4a2d0e){_0xaef3b6[_0x892e('0x44')]=_[_0x892e('0x59')](db[_0x892e('0x93')][_0x892e('0x40')]);_0xaef3b6[_0x892e('0x49')]=_['keys'](_0x54aac8[_0x892e('0x49')]);_0xaef3b6[_0x892e('0x4f')]=_[_0x892e('0x46')](_0xaef3b6[_0x892e('0x44')],_0xaef3b6[_0x892e('0x49')]);_0x144a51[_0x892e('0x47')]=_['intersection'](_0xaef3b6[_0x892e('0x44')],qs[_0x892e('0x48')](_0x54aac8[_0x892e('0x49')]['fields']));_0x144a51['attributes']=_0x144a51[_0x892e('0x47')][_0x892e('0x4a')]?_0x144a51[_0x892e('0x47')]:_0xaef3b6['model'];if(!_0x54aac8[_0x892e('0x49')][_0x892e('0x71')](_0x892e('0x6b'))){_0x144a51['limit']=qs[_0x892e('0x2c')](_0x54aac8['query'][_0x892e('0x2c')]);_0x144a51[_0x892e('0x2f')]=qs['offset'](_0x54aac8[_0x892e('0x49')][_0x892e('0x2f')]);}_0x144a51[_0x892e('0x4b')]=qs['sort'](_0x54aac8[_0x892e('0x49')][_0x892e('0x4c')]);_0x144a51[_0x892e('0x4d')]=qs['filters'](_[_0x892e('0x4e')](_0x54aac8[_0x892e('0x49')],_0xaef3b6['filters']));_0x144a51[_0x892e('0x4d')][_0x892e('0x67')]=_0x4a2d0e['id'];if(_0x54aac8['query'][_0x892e('0x50')]){_0x144a51[_0x892e('0x4d')]=_['merge'](_0x144a51[_0x892e('0x4d')],{'$or':_[_0x892e('0x45')](_0x144a51[_0x892e('0x47')],function(_0xe38144){var _0x162efb={};_0x162efb[_0xe38144]={'$like':'%'+_0x54aac8[_0x892e('0x49')]['filter']+'%'};return _0x162efb;})});}_0x144a51=_[_0x892e('0x51')]({},_0x144a51,_0x54aac8[_0x892e('0x5b')]);return db[_0x892e('0x93')]['count']({'where':_0x144a51[_0x892e('0x4d')]})[_0x892e('0x21')](function(_0x22ccd7){_0x16859e[_0x892e('0x2e')]=_0x22ccd7;if(_0x54aac8[_0x892e('0x49')][_0x892e('0x53')]){_0x144a51['include']=[{'model':db[_0x892e('0x84')],'as':_0x892e('0xb2'),'required':![]},{'model':db[_0x892e('0xb3')],'as':_0x892e('0xb4'),'attributes':[_0x892e('0x3c'),_0x892e('0xb5'),_0x892e('0xb6')],'required':![]},{'model':db[_0x892e('0xb7')],'as':_0x892e('0xb8'),'attributes':['id',_0x892e('0x3c'),_0x892e('0xb9')],'where':_0x54aac8[_0x892e('0x49')][_0x892e('0xba')]?{'id':_0x54aac8[_0x892e('0x49')]['tag']}:undefined,'required':_0x54aac8[_0x892e('0x49')][_0x892e('0xba')]?!![]:![]}];}return db['OpenchannelInteraction']['findAll'](_0x144a51);})[_0x892e('0x21')](function(_0x5b847f){_0x16859e[_0x892e('0x55')]=_0x5b847f;return _0x16859e;});}})[_0x892e('0x21')](respondWithFilteredResult(_0x21cf56,_0x144a51))[_0x892e('0x56')](handleError(_0x21cf56,null));};exports[_0x892e('0xbb')]=function(_0x3587d2,_0xb3608,_0x107f90){return db['OpenchannelAccount'][_0x892e('0x62')]({'where':{'id':_0x3587d2[_0x892e('0x65')]['id']}})[_0x892e('0x21')](handleEntityNotFound(_0xb3608,null))['then'](function(_0x5369a8){if(_0x5369a8){return _0x5369a8[_0x892e('0xbb')](_0x3587d2[_0x892e('0x5d')][_0x892e('0x6d')],_[_0x892e('0xbc')](_0x3587d2[_0x892e('0x5d')],['ids','id'])||{})['spread'](function(_0x33fb52){for(var _0x3229b8=0x0;_0x3229b8<_0x3587d2[_0x892e('0x5d')]['ids']['length'];_0x3229b8+=0x1){socket[_0x892e('0xbd')](_0x892e('0xbe'),{'UserId':Number(_0x3587d2[_0x892e('0x5d')][_0x892e('0x6d')][_0x3229b8]),'OpenchannelAccountId':Number(_0x3587d2[_0x892e('0x65')]['id'])});}return _0x33fb52;});}})['then'](respondWithResult(_0xb3608,null))[_0x892e('0x56')](handleError(_0xb3608,null));};exports[_0x892e('0xbf')]=function(_0xd5d64b,_0x368fcf,_0x4fa156){return db[_0x892e('0x3f')][_0x892e('0x62')]({'where':{'id':_0xd5d64b[_0x892e('0x65')]['id']}})[_0x892e('0x21')](handleEntityNotFound(_0x368fcf,null))['then'](function(_0x1b9ff8){if(_0x1b9ff8){return _0x1b9ff8[_0x892e('0xbf')](_0xd5d64b['query'][_0x892e('0x6d')])[_0x892e('0x21')](function(){if(_[_0x892e('0xc0')](_0xd5d64b[_0x892e('0x49')][_0x892e('0x6d')])){for(var _0x241348=0x0;_0x241348<_0xd5d64b[_0x892e('0x49')][_0x892e('0x6d')][_0x892e('0x4a')];_0x241348+=0x1){socket[_0x892e('0xbd')]('userOpenchannelAccount:remove',{'UserId':Number(_0xd5d64b[_0x892e('0x49')][_0x892e('0x6d')][_0x241348]),'OpenchannelAccountId':Number(_0xd5d64b['params']['id'])});}}else{socket[_0x892e('0xbd')](_0x892e('0xc1'),{'UserId':Number(_0xd5d64b['query']['ids']),'OpenchannelAccountId':Number(_0xd5d64b[_0x892e('0x65')]['id'])});}});}})['then'](respondWithStatusCode(_0x368fcf,null))[_0x892e('0x56')](handleError(_0x368fcf,null));};exports[_0x892e('0xc2')]=function(_0x1ca9fc,_0x1b56e3,_0x35d5f3){var _0x2c90ef={};var _0x1d261a={};var _0x2cca1b;var _0x2c6c91;return db[_0x892e('0x3f')][_0x892e('0x6a')]({'where':{'id':_0x1ca9fc[_0x892e('0x65')]['id']}})['then'](handleEntityNotFound(_0x1b56e3,null))['then'](function(_0x214030){if(_0x214030){_0x2cca1b=_0x214030;_0x1d261a[_0x892e('0x44')]=_[_0x892e('0x59')](db[_0x892e('0xb3')][_0x892e('0x40')]);_0x1d261a[_0x892e('0x49')]=_['keys'](_0x1ca9fc['query']);_0x1d261a[_0x892e('0x4f')]=_[_0x892e('0x46')](_0x1d261a[_0x892e('0x44')],_0x1d261a[_0x892e('0x49')]);_0x2c90ef[_0x892e('0x47')]=_[_0x892e('0x46')](_0x1d261a[_0x892e('0x44')],qs[_0x892e('0x48')](_0x1ca9fc[_0x892e('0x49')]['fields']));_0x2c90ef['attributes']=_0x2c90ef[_0x892e('0x47')]['length']?_0x2c90ef[_0x892e('0x47')]:_0x1d261a[_0x892e('0x44')];_0x2c90ef[_0x892e('0x4b')]=qs[_0x892e('0x4c')](_0x1ca9fc[_0x892e('0x49')][_0x892e('0x4c')]);_0x2c90ef['where']=qs['filters'](_[_0x892e('0x4e')](_0x1ca9fc[_0x892e('0x49')],_0x1d261a['filters']));if(_0x1ca9fc['query'][_0x892e('0x50')]){_0x2c90ef[_0x892e('0x4d')]=_[_0x892e('0x51')](_0x2c90ef[_0x892e('0x4d')],{'$or':_[_0x892e('0x45')](_0x2c90ef[_0x892e('0x47')],function(_0x3e14b7){var _0x42c8f1={};_0x42c8f1[_0x3e14b7]={'$like':'%'+_0x1ca9fc[_0x892e('0x49')]['filter']+'%'};return _0x42c8f1;})});}_0x2c90ef=_['merge']({},_0x2c90ef,_0x1ca9fc[_0x892e('0x5b')]);return _0x2cca1b['getAgents'](_0x2c90ef);}})[_0x892e('0x21')](function(_0x2be8e9){if(_0x2be8e9){_0x2c6c91=_0x2be8e9[_0x892e('0x4a')];if(!_0x1ca9fc[_0x892e('0x49')]['hasOwnProperty'](_0x892e('0x6b'))){_0x2c90ef['limit']=qs['limit'](_0x1ca9fc[_0x892e('0x49')][_0x892e('0x2c')]);_0x2c90ef[_0x892e('0x2f')]=qs[_0x892e('0x2f')](_0x1ca9fc['query']['offset']);}return _0x2cca1b['getAgents'](_0x2c90ef);}})[_0x892e('0x21')](function(_0x1e5ffe){if(_0x1e5ffe){return _0x1e5ffe?{'count':_0x2c6c91,'rows':_0x1e5ffe}:null;}})[_0x892e('0x21')](respondWithResult(_0x1b56e3,null))[_0x892e('0x56')](handleError(_0x1b56e3,null));};exports[_0x892e('0x3d')]=function(_0x340ce0,_0x3cdfd8,_0x4766e0){var _0x43ecba,_0x202fda,_0xfe8aeb;if(_[_0x892e('0x7c')](_0x340ce0['body'][_0x892e('0x5d')])||_0x340ce0[_0x892e('0x5d')][_0x892e('0x5d')]===''){throw new db[(_0x892e('0x74'))][(_0x892e('0x75'))](_0x892e('0x7e'));}if(_[_0x892e('0x7c')](_0x340ce0[_0x892e('0x5d')]['to'])){}_0x43ecba=_0x340ce0['body']['to'];return db[_0x892e('0x3f')][_0x892e('0x6a')]({'where':{'id':_0x340ce0[_0x892e('0x65')]['id']}})[_0x892e('0x21')](handleEntityNotFound(_0x3cdfd8,null))['then'](function(_0x15251a){if(_0x15251a){return db['OpenchannelAccount'][_0x892e('0x62')]({'where':{'id':_0x15251a['id']},'include':[{'model':db[_0x892e('0x82')],'as':'List','include':[{'model':db[_0x892e('0x84')],'as':'Contacts','where':{[_0x15251a[_0x892e('0x81')]]:_0x43ecba},'limit':0x1,'order':[[_0x892e('0x79'),_0x892e('0x86')]]}]}]})['then'](handleEntityNotFound(_0x3cdfd8,null))[_0x892e('0x21')](function(_0x5c0a6a){if(_0x5c0a6a&&_0x5c0a6a[_0x892e('0x83')]){_0x202fda=_0x5c0a6a[_0x892e('0x38')]({'plain':!![]});if(_0x202fda['List']&&_0x202fda[_0x892e('0x83')][_0x892e('0x85')][_0x892e('0x4a')]){return _0x202fda[_0x892e('0x83')][_0x892e('0x85')][0x0];}return db[_0x892e('0x84')][_0x892e('0x5c')](_['defaults'](_0x340ce0[_0x892e('0x5d')],{'firstName':_0x43ecba,[_0x5c0a6a[_0x892e('0x81')]]:_0x43ecba,'phone':_0x43ecba,'ListId':_0x202fda['ListId']}));}})[_0x892e('0x21')](handleEntityNotFound(_0x3cdfd8,null))['then'](function(_0x1f9638){if(_0x1f9638){_0xfe8aeb=_0x1f9638;return db[_0x892e('0x93')][_0x892e('0x62')]({'where':{'ContactId':_0xfe8aeb['id'],'closed':![],'OpenchannelAccountId':_0x202fda['id']}})[_0x892e('0x21')](function(_0x1930f8){if(_0x1930f8){return[_0x1930f8,![]];}return db['OpenchannelInteraction']['create']({'UserId':_0x340ce0[_0x892e('0x5e')]['id'],'ContactId':_0xfe8aeb['id'],'OpenchannelAccountId':_0x202fda['id'],'lastMsgDirection':'out','firstMsgDirection':_0x892e('0xc3'),'Messages':[_[_0x892e('0x51')](_0x340ce0[_0x892e('0x5d')],{'read':![],'body':_0x340ce0[_0x892e('0x5d')][_0x892e('0x5d')],'OpenchannelAccountId':_0x202fda['id'],'UserId':_0x340ce0[_0x892e('0x5e')]['id'],'ContactId':_0xfe8aeb['id']})]},{'include':[{'model':db[_0x892e('0x9c')],'as':_0x892e('0xc4')}]})[_0x892e('0x21')](function(_0x33262e){return[_0x33262e,!![]];});});}})['spread'](function(_0xadfc2b,_0x190a39){if(_0x190a39){return _0xadfc2b;}return db[_0x892e('0x9c')][_0x892e('0x5c')](_[_0x892e('0x51')](_0x340ce0['body'],{'read':![],'body':_0x340ce0['body']['body'],'OpenchannelAccountId':_0x202fda['id'],'OpenchannelInteractionId':_0xadfc2b['id'],'UserId':_0x340ce0['user']['id'],'ContactId':_0xfe8aeb['id']}))[_0x892e('0x21')](function(_0x162de2){_0xadfc2b[_0x892e('0xc5')][_0x892e('0xc4')]=[];_0xadfc2b[_0x892e('0xc5')][_0x892e('0xc4')][_0x892e('0xc6')](_0x162de2['dataValues']);return _0xadfc2b;});});}})[_0x892e('0x21')](respondWithResult(_0x3cdfd8,null))[_0x892e('0x56')](handleError(_0x3cdfd8,null));}; \ No newline at end of file +var _0x1fec=['fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','OpenchannelAccount','includeAll','include','rows','show','Pause','find','create','body','user','role','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','addDisposition','OpenchannelAccountId','Disposition','getDispositions','findOne','findAll','removeDispositions','ids','CannedAnswer','getAnswers','notify','openchannel','CmContact','describe','Sequelize','no\x20available\x20attributes','createdAt','updatedAt','difference','CompanyId','ListId','from','ValidationError','from\x20is\x20mandatory','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','List','Contacts','OpenchannelApplication','Applications','account','applications','orderBy','priority','asc','defaults','contact','firstName','lastName','threadId','OpenchannelInteraction','externalUrl','ContactId','messageId','interaction','created','autoclose','push','OpenchannelMessage','AttachmentId','UserId','User','unshift','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','EventManager','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','getApplications','Contact','Owner','fullname','internal','Tags','color','tag','addAgents','omit','spread','emit','userOpenchannelAccount:save','removeAgents','isArray','userOpenchannelAccount:remove','getAgents','CmList','DESC','out','Messages','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','jayson/promise','client','request','then','info','OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','reject','update','destroy','get','OpenchannelAccounts','UserProfileResource','stack','name','send','index','mandatoryDispositionPause','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes'];(function(_0x22656e,_0x1163dc){var _0x3e4255=function(_0x200a38){while(--_0x200a38){_0x22656e['push'](_0x22656e['shift']());}};_0x3e4255(++_0x1163dc);}(_0x1fec,0x1ea));var _0xc1fe=function(_0x4c12ec,_0x2e9103){_0x4c12ec=_0x4c12ec-0x0;var _0x3ae42c=_0x1fec[_0x4c12ec];return _0x3ae42c;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1fe('0x0'));var zipdir=require(_0xc1fe('0x1'));var jsonpatch=require(_0xc1fe('0x2'));var rp=require(_0xc1fe('0x3'));var moment=require(_0xc1fe('0x4'));var BPromise=require(_0xc1fe('0x5'));var Mustache=require(_0xc1fe('0x6'));var util=require(_0xc1fe('0x7'));var path=require('path');var sox=require(_0xc1fe('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xc1fe('0x9'));var _=require(_0xc1fe('0xa'));var squel=require(_0xc1fe('0xb'));var crypto=require(_0xc1fe('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xc1fe('0xd'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xc1fe('0xe'));var Redis=require(_0xc1fe('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xc1fe('0x10'));var as=require(_0xc1fe('0x11'));var hardwareService=require(_0xc1fe('0x12'));var logger=require(_0xc1fe('0x13'))(_0xc1fe('0x14'));var utils=require('../../config/utils');var config=require(_0xc1fe('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0xc1fe('0x16'))['db'];config[_0xc1fe('0x17')]=_['defaults'](config['redis'],{'host':_0xc1fe('0x18'),'port':0x18eb});var socket=require(_0xc1fe('0x19'))(new Redis(config['redis']));require('./openchannelAccount.socket')['register'](socket);var jayson=require(_0xc1fe('0x1a'));var client=jayson[_0xc1fe('0x1b')]['http']({'port':0x232c});var client9002=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x48bed5,_0x483391,_0x5be3f0,_0x36ff77){return new BPromise(function(_0x2fc121,_0x1cdd15){var _0x358785=_0x36ff77||client;return _0x358785[_0xc1fe('0x1c')](_0x48bed5,_0x5be3f0)[_0xc1fe('0x1d')](function(_0x450e7f){logger[_0xc1fe('0x1e')](_0xc1fe('0x1f'),_0x483391,_0xc1fe('0x20'));logger[_0xc1fe('0x21')]('OpenchannelAccount,\x20%s,\x20%s,\x20%s',_0x483391,_0xc1fe('0x20'),JSON[_0xc1fe('0x22')](_0x450e7f));if(_0x450e7f['error']){if(_0x450e7f[_0xc1fe('0x23')][_0xc1fe('0x24')]===0x1f4){logger[_0xc1fe('0x23')](_0xc1fe('0x1f'),_0x483391,_0x450e7f['error'][_0xc1fe('0x25')]);return _0x1cdd15(_0x450e7f[_0xc1fe('0x23')]['message']);}logger['error'](_0xc1fe('0x1f'),_0x483391,_0x450e7f[_0xc1fe('0x23')]['message']);return _0x2fc121(_0x450e7f['error']['message']);}else{logger[_0xc1fe('0x1e')](_0xc1fe('0x1f'),_0x483391,_0xc1fe('0x20'));_0x2fc121(_0x450e7f[_0xc1fe('0x26')][_0xc1fe('0x25')]);}})[_0xc1fe('0x27')](function(_0x3c460c){logger[_0xc1fe('0x23')](_0xc1fe('0x1f'),_0x483391,_0x3c460c);_0x1cdd15(_0x3c460c);});});}function respondWithStatusCode(_0x3b9b35,_0x18e3a4){_0x18e3a4=_0x18e3a4||0xcc;return function(_0x4db6b0){if(_0x4db6b0){return _0x3b9b35[_0xc1fe('0x28')](_0x18e3a4);}return _0x3b9b35[_0xc1fe('0x29')](_0x18e3a4)[_0xc1fe('0x2a')]();};}function respondWithResult(_0x1e3044,_0x5b8e41){_0x5b8e41=_0x5b8e41||0xc8;return function(_0x5a9d0a){if(_0x5a9d0a){return _0x1e3044[_0xc1fe('0x29')](_0x5b8e41)[_0xc1fe('0x2b')](_0x5a9d0a);}};}function respondWithFilteredResult(_0x31d84c,_0x43a8d2){return function(_0x426a36){if(_0x426a36){var _0x50eb92=typeof _0x43a8d2[_0xc1fe('0x2c')]===_0xc1fe('0x2d')&&typeof _0x43a8d2[_0xc1fe('0x2e')]===_0xc1fe('0x2d');var _0x2c1b31=_0x426a36['count'];var _0x3b409b=_0x50eb92?0x0:_0x43a8d2['offset'];var _0x1bf5b3=_0x50eb92?_0x426a36[_0xc1fe('0x2f')]:_0x43a8d2[_0xc1fe('0x2c')]+_0x43a8d2[_0xc1fe('0x2e')];var _0x40a734;if(_0x1bf5b3>=_0x2c1b31){_0x1bf5b3=_0x2c1b31;_0x40a734=0xc8;}else{_0x40a734=0xce;}_0x31d84c[_0xc1fe('0x29')](_0x40a734);return _0x31d84c['set'](_0xc1fe('0x30'),_0x3b409b+'-'+_0x1bf5b3+'/'+_0x2c1b31)[_0xc1fe('0x2b')](_0x426a36);}return null;};}function patchUpdates(_0x3a4687){return function(_0xdec465){try{jsonpatch[_0xc1fe('0x31')](_0xdec465,_0x3a4687,!![]);}catch(_0x4b39ba){return BPromise[_0xc1fe('0x32')](_0x4b39ba);}return _0xdec465['save']();};}function saveUpdates(_0xf8080,_0x29c055){return function(_0x35f9c8){if(_0x35f9c8){return _0x35f9c8[_0xc1fe('0x33')](_0xf8080)[_0xc1fe('0x1d')](function(_0x4dce0b){return _0x4dce0b;});}return null;};}function removeEntity(_0x450926,_0xcb3b22){return function(_0x167d6a){if(_0x167d6a){return _0x167d6a[_0xc1fe('0x34')]()[_0xc1fe('0x1d')](function(){var _0xbdbd76=_0x167d6a[_0xc1fe('0x35')]({'plain':!![]});var _0x3918aa=_0xc1fe('0x36');return db[_0xc1fe('0x37')][_0xc1fe('0x34')]({'where':{'type':_0x3918aa,'resourceId':_0xbdbd76['id']}})[_0xc1fe('0x1d')](function(){return _0x167d6a;});})[_0xc1fe('0x1d')](function(){_0x450926[_0xc1fe('0x29')](0xcc)[_0xc1fe('0x2a')]();});}};}function handleEntityNotFound(_0x46ba29,_0xbaaed9){return function(_0x560d87){if(!_0x560d87){_0x46ba29[_0xc1fe('0x28')](0x194);}return _0x560d87;};}function handleError(_0x526db4,_0x4c29c4){_0x4c29c4=_0x4c29c4||0x1f4;return function(_0x2223fd){logger['error'](_0x2223fd[_0xc1fe('0x38')]);if(_0x2223fd[_0xc1fe('0x39')]){delete _0x2223fd[_0xc1fe('0x39')];}_0x526db4['status'](_0x4c29c4)[_0xc1fe('0x3a')](_0x2223fd);};}exports[_0xc1fe('0x3b')]=function(_0x418dd1,_0x2cd6eb){var _0x999d72={'include':[{'model':db['Pause'],'as':_0xc1fe('0x3c')}]},_0xb170d={},_0x58443d={'count':0x0,'rows':[]};var _0x44fe6d=_[_0xc1fe('0x3d')](db['OpenchannelAccount'][_0xc1fe('0x3e')],function(_0x2375e2){return{'name':_0x2375e2[_0xc1fe('0x3f')],'type':_0x2375e2[_0xc1fe('0x40')]['key']};});_0xb170d[_0xc1fe('0x41')]=_[_0xc1fe('0x3d')](_0x44fe6d,_0xc1fe('0x39'));_0xb170d[_0xc1fe('0x42')]=_[_0xc1fe('0x43')](_0x418dd1[_0xc1fe('0x42')]);_0xb170d[_0xc1fe('0x44')]=_[_0xc1fe('0x45')](_0xb170d[_0xc1fe('0x41')],_0xb170d[_0xc1fe('0x42')]);_0x999d72[_0xc1fe('0x46')]=_['intersection'](_0xb170d['model'],qs[_0xc1fe('0x47')](_0x418dd1[_0xc1fe('0x42')][_0xc1fe('0x47')]));_0x999d72[_0xc1fe('0x46')]=_0x999d72[_0xc1fe('0x46')][_0xc1fe('0x48')]?_0x999d72[_0xc1fe('0x46')]:_0xb170d['model'];if(!_0x418dd1[_0xc1fe('0x42')][_0xc1fe('0x49')](_0xc1fe('0x4a'))){_0x999d72[_0xc1fe('0x2e')]=qs[_0xc1fe('0x2e')](_0x418dd1['query'][_0xc1fe('0x2e')]);_0x999d72[_0xc1fe('0x2c')]=qs['offset'](_0x418dd1[_0xc1fe('0x42')]['offset']);}_0x999d72[_0xc1fe('0x4b')]=qs[_0xc1fe('0x4c')](_0x418dd1[_0xc1fe('0x42')][_0xc1fe('0x4c')]);_0x999d72[_0xc1fe('0x4d')]=qs['filters'](_[_0xc1fe('0x4e')](_0x418dd1['query'],_0xb170d[_0xc1fe('0x44')]),_0x44fe6d);if(_0x418dd1[_0xc1fe('0x42')]['filter']){_0x999d72[_0xc1fe('0x4d')]=_['merge'](_0x999d72[_0xc1fe('0x4d')],{'$or':_[_0xc1fe('0x3d')](_0x44fe6d,function(_0xf26b49){if(_0xf26b49[_0xc1fe('0x40')]!=='VIRTUAL'){var _0x1633d9={};_0x1633d9[_0xf26b49[_0xc1fe('0x39')]]={'$like':'%'+_0x418dd1[_0xc1fe('0x42')][_0xc1fe('0x4f')]+'%'};return _0x1633d9;}})});}_0x999d72=_[_0xc1fe('0x50')]({},_0x999d72,_0x418dd1[_0xc1fe('0x51')]);var _0x12e833={'where':_0x999d72['where']};return db[_0xc1fe('0x52')][_0xc1fe('0x2f')](_0x12e833)[_0xc1fe('0x1d')](function(_0x3e640f){_0x58443d['count']=_0x3e640f;if(_0x418dd1[_0xc1fe('0x42')][_0xc1fe('0x53')]){_0x999d72[_0xc1fe('0x54')]=[{'all':!![]}];}return db[_0xc1fe('0x52')]['findAll'](_0x999d72);})[_0xc1fe('0x1d')](function(_0x43ef12){_0x58443d[_0xc1fe('0x55')]=_0x43ef12;return _0x58443d;})[_0xc1fe('0x1d')](respondWithFilteredResult(_0x2cd6eb,_0x999d72))[_0xc1fe('0x27')](handleError(_0x2cd6eb,null));};exports[_0xc1fe('0x56')]=function(_0xec85d0,_0x577f7f){var _0x59dcb0={'raw':![],'where':{'id':_0xec85d0['params']['id']},'include':[{'model':db[_0xc1fe('0x57')],'as':_0xc1fe('0x3c')}]},_0x41898c={};_0x41898c[_0xc1fe('0x41')]=_[_0xc1fe('0x43')](db[_0xc1fe('0x52')][_0xc1fe('0x3e')]);_0x41898c[_0xc1fe('0x42')]=_['keys'](_0xec85d0[_0xc1fe('0x42')]);_0x41898c['filters']=_[_0xc1fe('0x45')](_0x41898c['model'],_0x41898c[_0xc1fe('0x42')]);_0x59dcb0[_0xc1fe('0x46')]=_[_0xc1fe('0x45')](_0x41898c['model'],qs[_0xc1fe('0x47')](_0xec85d0[_0xc1fe('0x42')][_0xc1fe('0x47')]));_0x59dcb0[_0xc1fe('0x46')]=_0x59dcb0[_0xc1fe('0x46')][_0xc1fe('0x48')]?_0x59dcb0[_0xc1fe('0x46')]:_0x41898c[_0xc1fe('0x41')];if(_0xec85d0[_0xc1fe('0x42')][_0xc1fe('0x53')]){_0x59dcb0[_0xc1fe('0x54')]=[{'all':!![]}];}_0x59dcb0=_[_0xc1fe('0x50')]({},_0x59dcb0,_0xec85d0[_0xc1fe('0x51')]);return db[_0xc1fe('0x52')][_0xc1fe('0x58')](_0x59dcb0)[_0xc1fe('0x1d')](handleEntityNotFound(_0x577f7f,null))[_0xc1fe('0x1d')](respondWithResult(_0x577f7f,null))[_0xc1fe('0x27')](handleError(_0x577f7f,null));};exports['create']=function(_0x594721,_0x45e796){return db[_0xc1fe('0x52')][_0xc1fe('0x59')](_0x594721[_0xc1fe('0x5a')],{})[_0xc1fe('0x1d')](function(_0x457703){var _0x4ed374=_0x594721[_0xc1fe('0x5b')][_0xc1fe('0x35')]({'plain':!![]});if(!_0x4ed374)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4ed374[_0xc1fe('0x5c')]==='user'){var _0x5c9f79=_0x457703[_0xc1fe('0x35')]({'plain':!![]});var _0x225f7f='OpenchannelAccounts';return db['UserProfileSection'][_0xc1fe('0x58')]({'where':{'name':_0x225f7f,'userProfileId':_0x4ed374[_0xc1fe('0x5d')]},'raw':!![]})[_0xc1fe('0x1d')](function(_0x4219ad){if(_0x4219ad&&_0x4219ad[_0xc1fe('0x5e')]===0x0){return db[_0xc1fe('0x37')]['create']({'name':_0x5c9f79[_0xc1fe('0x39')],'resourceId':_0x5c9f79['id'],'type':_0x4219ad[_0xc1fe('0x39')],'sectionId':_0x4219ad['id']},{})[_0xc1fe('0x1d')](function(){return _0x457703;});}else{return _0x457703;}})[_0xc1fe('0x27')](function(_0x3d1a30){logger[_0xc1fe('0x23')](_0xc1fe('0x5f'),_0x3d1a30);throw _0x3d1a30;});}return _0x457703;})[_0xc1fe('0x1d')](respondWithResult(_0x45e796,0xc9))['catch'](handleError(_0x45e796,null));};exports[_0xc1fe('0x33')]=function(_0x3b2a1a,_0x24bbca){if(_0x3b2a1a[_0xc1fe('0x5a')]['id']){delete _0x3b2a1a[_0xc1fe('0x5a')]['id'];}return db[_0xc1fe('0x52')][_0xc1fe('0x58')]({'where':{'id':_0x3b2a1a[_0xc1fe('0x60')]['id']},'include':[{'model':db['Pause'],'as':'mandatoryDispositionPause'}]})[_0xc1fe('0x1d')](handleEntityNotFound(_0x24bbca,null))['then'](saveUpdates(_0x3b2a1a[_0xc1fe('0x5a')],null))['then'](respondWithResult(_0x24bbca,null))['catch'](handleError(_0x24bbca,null));};exports[_0xc1fe('0x34')]=function(_0x2da46e,_0x2162f2){return db['OpenchannelAccount'][_0xc1fe('0x58')]({'where':{'id':_0x2da46e['params']['id']}})[_0xc1fe('0x1d')](handleEntityNotFound(_0x2162f2,null))[_0xc1fe('0x1d')](removeEntity(_0x2162f2,null))[_0xc1fe('0x27')](handleError(_0x2162f2,null));};exports['describe']=function(_0x24ad51,_0x58a637){return db[_0xc1fe('0x52')]['describe']()[_0xc1fe('0x1d')](respondWithResult(_0x58a637,null))[_0xc1fe('0x27')](handleError(_0x58a637,null));};exports[_0xc1fe('0x61')]=function(_0x3668cd,_0x356aef,_0x233ba4){if(_0x3668cd[_0xc1fe('0x5a')]['id']){delete _0x3668cd[_0xc1fe('0x5a')]['id'];}return db['OpenchannelAccount'][_0xc1fe('0x58')]({'where':{'id':_0x3668cd['params']['id']}})[_0xc1fe('0x1d')](handleEntityNotFound(_0x356aef,null))[_0xc1fe('0x1d')](function(_0x5709ae){if(_0x5709ae){_0x3668cd[_0xc1fe('0x5a')][_0xc1fe('0x62')]=_0x5709ae['id'];return db[_0xc1fe('0x63')][_0xc1fe('0x59')](_0x3668cd[_0xc1fe('0x5a')]);}})[_0xc1fe('0x1d')](respondWithResult(_0x356aef,null))[_0xc1fe('0x27')](handleError(_0x356aef,null));};exports[_0xc1fe('0x64')]=function(_0x16697c,_0xe24f7,_0x210241){var _0x10d165={'raw':![],'where':{}};var _0xc74136={};var _0x46d41f={'count':0x0,'rows':[]};return db[_0xc1fe('0x52')][_0xc1fe('0x65')]({'where':{'id':_0x16697c['params']['id']}})[_0xc1fe('0x1d')](handleEntityNotFound(_0xe24f7,null))[_0xc1fe('0x1d')](function(_0x2b7be9){if(_0x2b7be9){_0xc74136['model']=_[_0xc1fe('0x43')](db[_0xc1fe('0x63')][_0xc1fe('0x3e')]);_0xc74136[_0xc1fe('0x42')]=_['keys'](_0x16697c['query']);_0xc74136[_0xc1fe('0x44')]=_['intersection'](_0xc74136[_0xc1fe('0x41')],_0xc74136['query']);_0x10d165[_0xc1fe('0x46')]=_['intersection'](_0xc74136[_0xc1fe('0x41')],qs[_0xc1fe('0x47')](_0x16697c[_0xc1fe('0x42')]['fields']));_0x10d165[_0xc1fe('0x46')]=_0x10d165['attributes'][_0xc1fe('0x48')]?_0x10d165[_0xc1fe('0x46')]:_0xc74136['model'];if(!_0x16697c['query'][_0xc1fe('0x49')](_0xc1fe('0x4a'))){_0x10d165['limit']=qs['limit'](_0x16697c['query'][_0xc1fe('0x2e')]);_0x10d165[_0xc1fe('0x2c')]=qs['offset'](_0x16697c['query'][_0xc1fe('0x2c')]);}_0x10d165[_0xc1fe('0x4b')]=qs[_0xc1fe('0x4c')](_0x16697c[_0xc1fe('0x42')][_0xc1fe('0x4c')]);_0x10d165[_0xc1fe('0x4d')]=qs['filters'](_[_0xc1fe('0x4e')](_0x16697c['query'],_0xc74136[_0xc1fe('0x44')]));_0x10d165[_0xc1fe('0x4d')][_0xc1fe('0x62')]=_0x2b7be9['id'];if(_0x16697c[_0xc1fe('0x42')][_0xc1fe('0x4f')]){_0x10d165['where']=_['merge'](_0x10d165['where'],{'$or':_['map'](_0x10d165[_0xc1fe('0x46')],function(_0x37a02e){var _0x2b0659={};_0x2b0659[_0x37a02e]={'$like':'%'+_0x16697c['query'][_0xc1fe('0x4f')]+'%'};return _0x2b0659;})});}_0x10d165=_[_0xc1fe('0x50')]({},_0x10d165,_0x16697c[_0xc1fe('0x51')]);return db['Disposition'][_0xc1fe('0x2f')]({'where':_0x10d165[_0xc1fe('0x4d')]})[_0xc1fe('0x1d')](function(_0x441aca){_0x46d41f[_0xc1fe('0x2f')]=_0x441aca;if(_0x16697c[_0xc1fe('0x42')][_0xc1fe('0x53')]){_0x10d165['include']=[{'all':!![]}];}return db[_0xc1fe('0x63')][_0xc1fe('0x66')](_0x10d165);})['then'](function(_0x43fc50){_0x46d41f['rows']=_0x43fc50;return _0x46d41f;});}})[_0xc1fe('0x1d')](respondWithFilteredResult(_0xe24f7,_0x10d165))['catch'](handleError(_0xe24f7,null));};exports[_0xc1fe('0x67')]=function(_0x40967e,_0x5c7dd0,_0x3daf76){return db[_0xc1fe('0x52')]['find']({'where':{'id':_0x40967e[_0xc1fe('0x60')]['id']}})['then'](handleEntityNotFound(_0x5c7dd0,null))['then'](function(_0x49c2df){if(_0x49c2df){return _0x49c2df[_0xc1fe('0x67')](_0x40967e[_0xc1fe('0x42')][_0xc1fe('0x68')]);}})[_0xc1fe('0x1d')](respondWithStatusCode(_0x5c7dd0,null))[_0xc1fe('0x27')](handleError(_0x5c7dd0,null));};exports['addAnswer']=function(_0x24eb4e,_0x405bd1,_0x530e22){if(_0x24eb4e[_0xc1fe('0x5a')]['id']){delete _0x24eb4e[_0xc1fe('0x5a')]['id'];}return db[_0xc1fe('0x52')][_0xc1fe('0x58')]({'where':{'id':_0x24eb4e['params']['id']}})['then'](handleEntityNotFound(_0x405bd1,null))['then'](function(_0x5c091e){if(_0x5c091e){_0x24eb4e[_0xc1fe('0x5a')][_0xc1fe('0x62')]=_0x5c091e['id'];return db[_0xc1fe('0x69')][_0xc1fe('0x59')](_0x24eb4e[_0xc1fe('0x5a')]);}})[_0xc1fe('0x1d')](respondWithResult(_0x405bd1,null))[_0xc1fe('0x27')](handleError(_0x405bd1,null));};exports[_0xc1fe('0x6a')]=function(_0x177d80,_0x12f979,_0x5bf367){var _0xe064a2={'raw':![],'where':{}};var _0x37f621={};var _0x38737b={'count':0x0,'rows':[]};return db[_0xc1fe('0x52')][_0xc1fe('0x65')]({'where':{'id':_0x177d80[_0xc1fe('0x60')]['id']}})[_0xc1fe('0x1d')](handleEntityNotFound(_0x12f979,null))[_0xc1fe('0x1d')](function(_0x379f82){if(_0x379f82){_0x37f621[_0xc1fe('0x41')]=_[_0xc1fe('0x43')](db[_0xc1fe('0x69')][_0xc1fe('0x3e')]);_0x37f621['query']=_[_0xc1fe('0x43')](_0x177d80['query']);_0x37f621[_0xc1fe('0x44')]=_[_0xc1fe('0x45')](_0x37f621['model'],_0x37f621[_0xc1fe('0x42')]);_0xe064a2[_0xc1fe('0x46')]=_[_0xc1fe('0x45')](_0x37f621[_0xc1fe('0x41')],qs[_0xc1fe('0x47')](_0x177d80[_0xc1fe('0x42')][_0xc1fe('0x47')]));_0xe064a2[_0xc1fe('0x46')]=_0xe064a2[_0xc1fe('0x46')][_0xc1fe('0x48')]?_0xe064a2[_0xc1fe('0x46')]:_0x37f621['model'];if(!_0x177d80[_0xc1fe('0x42')][_0xc1fe('0x49')](_0xc1fe('0x4a'))){_0xe064a2[_0xc1fe('0x2e')]=qs[_0xc1fe('0x2e')](_0x177d80[_0xc1fe('0x42')][_0xc1fe('0x2e')]);_0xe064a2[_0xc1fe('0x2c')]=qs['offset'](_0x177d80['query']['offset']);}_0xe064a2[_0xc1fe('0x4b')]=qs[_0xc1fe('0x4c')](_0x177d80[_0xc1fe('0x42')][_0xc1fe('0x4c')]);_0xe064a2[_0xc1fe('0x4d')]=qs['filters'](_[_0xc1fe('0x4e')](_0x177d80['query'],_0x37f621['filters']));_0xe064a2['where'][_0xc1fe('0x62')]=_0x379f82['id'];if(_0x177d80[_0xc1fe('0x42')]['filter']){_0xe064a2[_0xc1fe('0x4d')]=_[_0xc1fe('0x50')](_0xe064a2['where'],{'$or':_[_0xc1fe('0x3d')](_0xe064a2[_0xc1fe('0x46')],function(_0x1acab8){var _0x4266c8={};_0x4266c8[_0x1acab8]={'$like':'%'+_0x177d80['query']['filter']+'%'};return _0x4266c8;})});}_0xe064a2=_[_0xc1fe('0x50')]({},_0xe064a2,_0x177d80['options']);return db[_0xc1fe('0x69')][_0xc1fe('0x2f')]({'where':_0xe064a2[_0xc1fe('0x4d')]})[_0xc1fe('0x1d')](function(_0x374647){_0x38737b[_0xc1fe('0x2f')]=_0x374647;if(_0x177d80[_0xc1fe('0x42')]['includeAll']){_0xe064a2[_0xc1fe('0x54')]=[{'all':!![]}];}return db[_0xc1fe('0x69')]['findAll'](_0xe064a2);})[_0xc1fe('0x1d')](function(_0xae9e49){_0x38737b[_0xc1fe('0x55')]=_0xae9e49;return _0x38737b;});}})[_0xc1fe('0x1d')](respondWithFilteredResult(_0x12f979,_0xe064a2))['catch'](handleError(_0x12f979,null));};exports['removeAnswers']=function(_0x4f74ce,_0x56ddbe,_0x68c2d5){return db[_0xc1fe('0x52')][_0xc1fe('0x58')]({'where':{'id':_0x4f74ce[_0xc1fe('0x60')]['id']}})[_0xc1fe('0x1d')](handleEntityNotFound(_0x56ddbe,null))['then'](function(_0x5d9f48){if(_0x5d9f48){return _0x5d9f48['removeAnswers'](_0x4f74ce['query'][_0xc1fe('0x68')]);}})[_0xc1fe('0x1d')](respondWithStatusCode(_0x56ddbe,null))[_0xc1fe('0x27')](handleError(_0x56ddbe,null));};exports[_0xc1fe('0x6b')]=function(_0x5c25ab,_0x3b5246,_0x85e8e4){var _0x47c1fd={'body':_0x5c25ab[_0xc1fe('0x5a')],'channel':_0xc1fe('0x6c')};var _0x1dad7b=[];var _0x58bf82=[];var _0x15aef9={};var _0x55fc87=![];return db[_0xc1fe('0x6d')][_0xc1fe('0x6e')]()[_0xc1fe('0x1d')](function(_0x259f93){if(!_0x259f93){throw new db[(_0xc1fe('0x6f'))]['ValidationError'](_0xc1fe('0x70'));}_0x1dad7b=_['difference'](_[_0xc1fe('0x43')](_0x259f93),[_0xc1fe('0x71'),_0xc1fe('0x72')]);_0x58bf82=_[_0xc1fe('0x73')](_['keys'](_0x259f93),[_0xc1fe('0x71'),_0xc1fe('0x72'),_0xc1fe('0x74'),_0xc1fe('0x75')]);if(_0x5c25ab[_0xc1fe('0x5a')]['id']){delete _0x5c25ab['body']['id'];}if(_['isNil'](_0x5c25ab[_0xc1fe('0x5a')][_0xc1fe('0x76')])){throw new db['Sequelize'][(_0xc1fe('0x77'))](_0xc1fe('0x78'));}if(_[_0xc1fe('0x79')](_0x5c25ab[_0xc1fe('0x5a')][_0xc1fe('0x5a')])||_0x5c25ab['body'][_0xc1fe('0x5a')]===''){throw new db[(_0xc1fe('0x6f'))][(_0xc1fe('0x77'))](_0xc1fe('0x7a'));}if(_[_0xc1fe('0x79')](_0x5c25ab[_0xc1fe('0x5a')][_0xc1fe('0x7b')])){throw new db['Sequelize'][(_0xc1fe('0x77'))](_0xc1fe('0x7c')+_0x58bf82);}if(!_[_0xc1fe('0x7d')](_0x58bf82,_0x5c25ab['body'][_0xc1fe('0x7b')])){throw new db['Sequelize'][(_0xc1fe('0x77'))]('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x58bf82);}_0x15aef9[_0x5c25ab[_0xc1fe('0x5a')][_0xc1fe('0x7b')]]=_0x5c25ab['body'][_0xc1fe('0x76')];})[_0xc1fe('0x1d')](function(){return db[_0xc1fe('0x52')][_0xc1fe('0x58')]({'where':{'id':_0x5c25ab['params']['id']},'include':[{'model':db['CmList'],'as':_0xc1fe('0x7e'),'include':[{'model':db[_0xc1fe('0x6d')],'as':_0xc1fe('0x7f'),'where':_0x15aef9,'limit':0x1,'order':[[_0xc1fe('0x72'),'DESC']]}]},{'model':db[_0xc1fe('0x80')],'as':_0xc1fe('0x81')}]});})[_0xc1fe('0x1d')](handleEntityNotFound(_0x3b5246,null))[_0xc1fe('0x1d')](function(_0x4fc271){if(_0x4fc271&&_0x4fc271[_0xc1fe('0x7e')]){_0x47c1fd[_0xc1fe('0x82')]=_0x4fc271;_0x47c1fd['applications']=_0x4fc271[_0xc1fe('0x81')];_0x47c1fd['list']=_0x4fc271[_0xc1fe('0x7e')];_0x47c1fd[_0xc1fe('0x83')]=_[_0xc1fe('0x84')](_0x47c1fd[_0xc1fe('0x83')],[_0xc1fe('0x85')],[_0xc1fe('0x86')]);if(_0x47c1fd['account'][_0xc1fe('0x81')]){delete _0x47c1fd[_0xc1fe('0x82')][_0xc1fe('0x81')];}if(_0x47c1fd['account'][_0xc1fe('0x7e')]&&_0x47c1fd['account'][_0xc1fe('0x7e')]['Contacts'][_0xc1fe('0x48')]){return _0x47c1fd[_0xc1fe('0x82')][_0xc1fe('0x7e')]['Contacts'][0x0];}var _0x438ef4=_[_0xc1fe('0x87')](_0x5c25ab[_0xc1fe('0x5a')],{'firstName':_0x5c25ab[_0xc1fe('0x5a')][_0xc1fe('0x76')],'ListId':_0x4fc271[_0xc1fe('0x75')]});_0x438ef4[_0x5c25ab['body'][_0xc1fe('0x7b')]]=_0x5c25ab[_0xc1fe('0x5a')][_0xc1fe('0x76')];return db[_0xc1fe('0x6d')][_0xc1fe('0x59')](_0x438ef4,{'fields':_0x1dad7b,'raw':!![]});}})[_0xc1fe('0x1d')](handleEntityNotFound(_0x3b5246,null))[_0xc1fe('0x1d')](function(_0x380020){_0x47c1fd[_0xc1fe('0x88')]=_0x380020;if(_0x380020){var _0x45aa36={'ContactId':_0x380020['id'],'OpenchannelAccountId':_0x5c25ab['params']['id'],'from':(_0x380020[_0xc1fe('0x89')]||'')+'\x20'+(_0x380020[_0xc1fe('0x8a')]||'')};var _0x151e2d={'OpenchannelAccountId':_0x5c25ab[_0xc1fe('0x60')]['id'],'closed':![]};if(_0x5c25ab[_0xc1fe('0x5a')][_0xc1fe('0x8b')]){_0x151e2d[_0xc1fe('0x8b')]=_0x5c25ab[_0xc1fe('0x5a')]['threadId'];return db[_0xc1fe('0x8c')]['find']({'where':_0x151e2d})[_0xc1fe('0x1d')](function(_0x149de7){if(_0x149de7){return[_0x149de7,![]];}_0x45aa36[_0xc1fe('0x8b')]=_0x5c25ab[_0xc1fe('0x5a')][_0xc1fe('0x8b')];_0x45aa36[_0xc1fe('0x8d')]=_0x5c25ab[_0xc1fe('0x5a')][_0xc1fe('0x8d')];return db[_0xc1fe('0x8c')][_0xc1fe('0x59')](_0x45aa36)[_0xc1fe('0x1d')](function(_0x457840){return[_0x457840,!![]];});});}else{_0x151e2d[_0xc1fe('0x8b')]=null;}_0x151e2d[_0xc1fe('0x8e')]=_0x380020['id'];return db[_0xc1fe('0x8c')][_0xc1fe('0x58')]({'where':_0x151e2d})['then'](function(_0x66b0dd){if(_0x66b0dd){return[_0x66b0dd,![]];}return db[_0xc1fe('0x8c')][_0xc1fe('0x59')](_0x45aa36)['then'](function(_0x1b4999){return[_0x1b4999,!![]];});});}})['spread'](function(_0x245547,_0x31e5b8){if(_0x245547){_0x55fc87=_0x31e5b8;if(!_0x31e5b8){var _0x585d0a={'from':(_0x47c1fd[_0xc1fe('0x88')]['firstName']||'')+'\x20'+(_0x47c1fd[_0xc1fe('0x88')][_0xc1fe('0x8a')]||'')};if(_0x5c25ab[_0xc1fe('0x5a')][_0xc1fe('0x8b')]&&_0x5c25ab['body'][_0xc1fe('0x8f')]&&_0x5c25ab['body'][_0xc1fe('0x8b')]!=_0x5c25ab['body'][_0xc1fe('0x8f')]){_0x585d0a['threadId']=_0x5c25ab[_0xc1fe('0x5a')][_0xc1fe('0x8f')];}return _0x245547[_0xc1fe('0x33')](_0x585d0a);}else{return _0x245547;}}})[_0xc1fe('0x1d')](function(_0x244735){_0x47c1fd[_0xc1fe('0x90')]=_0x244735[_0xc1fe('0x35')]({'plain':!![]});_0x47c1fd[_0xc1fe('0x90')][_0xc1fe('0x91')]=_0x55fc87;if(_0x47c1fd[_0xc1fe('0x90')][_0xc1fe('0x91')]){if(_0x47c1fd['account'][_0xc1fe('0x92')]){_0x47c1fd[_0xc1fe('0x83')][_0xc1fe('0x93')]({'id':0x0,'priority':_0x47c1fd[_0xc1fe('0x83')][_0xc1fe('0x48')]+0x1,'app':'close','appdata':'unmanaged','interval':'*,*,*,*'});}}return db[_0xc1fe('0x94')][_0xc1fe('0x59')]({'body':_0x5c25ab[_0xc1fe('0x5a')][_0xc1fe('0x5a')],'OpenchannelAccountId':_0x5c25ab['params']['id'],'OpenchannelInteractionId':_0x244735['id'],'direction':'in','ContactId':_0x47c1fd[_0xc1fe('0x88')]['id'],'AttachmentId':_0x5c25ab[_0xc1fe('0x5a')][_0xc1fe('0x95')]});})[_0xc1fe('0x1d')](function(_0x9cfcae){_0x47c1fd['message']=_0x9cfcae;if(_0x47c1fd[_0xc1fe('0x90')][_0xc1fe('0x96')]){return db[_0xc1fe('0x97')][_0xc1fe('0x58')]({'attributes':['id',_0xc1fe('0x39')],'where':{'id':_0x47c1fd[_0xc1fe('0x90')][_0xc1fe('0x96')]}})['then'](function(_0x5d658a){if(_0x5d658a){_0x47c1fd['applications'][_0xc1fe('0x98')]({'id':0x0,'priority':0x0,'app':_0xc1fe('0x99'),'appdata':_0x5d658a[_0xc1fe('0x39')]+','+(_0x47c1fd[_0xc1fe('0x82')][_0xc1fe('0x9a')]||0xa),'interval':_0xc1fe('0x9b')});_0x47c1fd['forcedOwnership']=![];}return respondWithRpcPromise(_0xc1fe('0x9c'),_0xc1fe('0x9d'),_0x47c1fd);});}return respondWithRpcPromise(_0xc1fe('0x9c'),'startRouting',_0x47c1fd);})[_0xc1fe('0x1d')](function(_0x433008){respondWithRpcPromise(_0xc1fe('0x9e'),_0xc1fe('0x9e'),{'event':'notify','message':_0x433008},client9002);return _0x433008;})[_0xc1fe('0x1d')](respondWithResult(_0x3b5246,null))[_0xc1fe('0x27')](handleError(_0x3b5246,null));};exports[_0xc1fe('0x9f')]=function(_0x15b5a8,_0x16b23c){var _0xe08ae8=_0x15b5a8['params']['id'];var _0x59e755=_0x15b5a8[_0xc1fe('0x5a')];var _0x4a1db=0xc8;var _0x504d89=null;return db[_0xc1fe('0xa0')][_0xc1fe('0xa1')]({'isolationLevel':db[_0xc1fe('0xa0')][_0xc1fe('0xa2')][_0xc1fe('0xa3')][_0xc1fe('0xa4')]},function(_0x6057f1){return db[_0xc1fe('0x52')][_0xc1fe('0x65')]({'where':{'id':_0xe08ae8},'transaction':_0x6057f1})[_0xc1fe('0x1d')](function(_0x23a779){if(_0x23a779){return db[_0xc1fe('0x80')][_0xc1fe('0x34')]({'where':{'OpenchannelAccountId':_0xe08ae8},'transaction':_0x6057f1})[_0xc1fe('0x1d')](function(){var _0xe91cbe=_[_0xc1fe('0x3d')](_0x59e755,function(_0x3aec01){_0x3aec01['OpenchannelAccountId']=_0xe08ae8;return _0x3aec01;});return db[_0xc1fe('0x80')][_0xc1fe('0xa5')](_0xe91cbe,{'transaction':_0x6057f1});});}else{_0x4a1db=0x194;_0x504d89=[];}});})[_0xc1fe('0x1d')](function(){if(_0x4a1db!==0x194){return db[_0xc1fe('0x80')]['findAndCountAll']({'where':{'OpenchannelAccountId':_0xe08ae8},'order':_0xc1fe('0x85')})[_0xc1fe('0x1d')](function(_0x776abf){_0x504d89=_0x776abf;});}})[_0xc1fe('0x27')](function(_0x534101){_0x4a1db=0x1f4;logger[_0xc1fe('0x23')](_0x534101[_0xc1fe('0x38')]);if(_0x534101[_0xc1fe('0x39')]){delete _0x534101['name'];}_0x504d89=_0x534101;})['finally'](function(){if(_0x504d89===null){_0x16b23c[_0xc1fe('0x28')](_0x4a1db);}else{if(_0x4a1db===0x1f4){_0x16b23c[_0xc1fe('0x29')](_0x4a1db)[_0xc1fe('0x3a')](_0x504d89);}else{_0x16b23c[_0xc1fe('0x29')](_0x4a1db)[_0xc1fe('0x2b')](_0x504d89);}}});};exports['getApplications']=function(_0x4f6c62,_0x31d2f6,_0x60ad19){var _0x5b678f={};var _0x31d72a={};var _0x4c9902;var _0x4a0934;return db[_0xc1fe('0x52')][_0xc1fe('0x65')]({'where':{'id':_0x4f6c62[_0xc1fe('0x60')]['id']}})[_0xc1fe('0x1d')](handleEntityNotFound(_0x31d2f6,null))[_0xc1fe('0x1d')](function(_0x12992a){if(_0x12992a){_0x4c9902=_0x12992a;_0x31d72a[_0xc1fe('0x41')]=_[_0xc1fe('0x43')](db[_0xc1fe('0x80')]['rawAttributes']);_0x31d72a[_0xc1fe('0x42')]=_[_0xc1fe('0x43')](_0x4f6c62[_0xc1fe('0x42')]);_0x31d72a['filters']=_[_0xc1fe('0x45')](_0x31d72a[_0xc1fe('0x41')],_0x31d72a['query']);_0x5b678f['attributes']=_[_0xc1fe('0x45')](_0x31d72a[_0xc1fe('0x41')],qs[_0xc1fe('0x47')](_0x4f6c62[_0xc1fe('0x42')][_0xc1fe('0x47')]));_0x5b678f[_0xc1fe('0x46')]=_0x5b678f[_0xc1fe('0x46')][_0xc1fe('0x48')]?_0x5b678f['attributes']:_0x31d72a['model'];_0x5b678f[_0xc1fe('0x4b')]=qs[_0xc1fe('0x4c')](_0x4f6c62[_0xc1fe('0x42')]['sort']);_0x5b678f[_0xc1fe('0x4d')]=qs[_0xc1fe('0x44')](_[_0xc1fe('0x4e')](_0x4f6c62[_0xc1fe('0x42')],_0x31d72a[_0xc1fe('0x44')]));if(_0x4f6c62[_0xc1fe('0x42')][_0xc1fe('0x4f')]){_0x5b678f['where']=_['merge'](_0x5b678f[_0xc1fe('0x4d')],{'$or':_[_0xc1fe('0x3d')](_0x5b678f['attributes'],function(_0x17be2a){var _0x430ad0={};_0x430ad0[_0x17be2a]={'$like':'%'+_0x4f6c62[_0xc1fe('0x42')][_0xc1fe('0x4f')]+'%'};return _0x430ad0;})});}_0x5b678f=_[_0xc1fe('0x50')]({},_0x5b678f,_0x4f6c62[_0xc1fe('0x51')]);return _0x4c9902[_0xc1fe('0xa6')](_0x5b678f);}})[_0xc1fe('0x1d')](function(_0xf54499){if(_0xf54499){_0x4a0934=_0xf54499['length'];if(!_0x4f6c62['query'][_0xc1fe('0x49')](_0xc1fe('0x4a'))){_0x5b678f['limit']=qs[_0xc1fe('0x2e')](_0x4f6c62[_0xc1fe('0x42')][_0xc1fe('0x2e')]);_0x5b678f['offset']=qs[_0xc1fe('0x2c')](_0x4f6c62[_0xc1fe('0x42')]['offset']);}return _0x4c9902[_0xc1fe('0xa6')](_0x5b678f);}})[_0xc1fe('0x1d')](function(_0x5073fe){if(_0x5073fe){return _0x5073fe?{'count':_0x4a0934,'rows':_0x5073fe}:null;}})[_0xc1fe('0x1d')](respondWithResult(_0x31d2f6,null))[_0xc1fe('0x27')](handleError(_0x31d2f6,null));};exports['getInteractions']=function(_0x1f89fd,_0x2b1c77,_0x50e089){var _0x4b1b78={'raw':![],'where':{}};var _0x53bf65={};var _0x11fa4c={'count':0x0,'rows':[]};return db[_0xc1fe('0x52')][_0xc1fe('0x65')]({'where':{'id':_0x1f89fd[_0xc1fe('0x60')]['id']}})[_0xc1fe('0x1d')](handleEntityNotFound(_0x2b1c77,null))[_0xc1fe('0x1d')](function(_0x2d925d){if(_0x2d925d){_0x53bf65['model']=_[_0xc1fe('0x43')](db[_0xc1fe('0x8c')][_0xc1fe('0x3e')]);_0x53bf65[_0xc1fe('0x42')]=_[_0xc1fe('0x43')](_0x1f89fd[_0xc1fe('0x42')]);_0x53bf65[_0xc1fe('0x44')]=_[_0xc1fe('0x45')](_0x53bf65[_0xc1fe('0x41')],_0x53bf65[_0xc1fe('0x42')]);_0x4b1b78[_0xc1fe('0x46')]=_[_0xc1fe('0x45')](_0x53bf65[_0xc1fe('0x41')],qs['fields'](_0x1f89fd[_0xc1fe('0x42')][_0xc1fe('0x47')]));_0x4b1b78['attributes']=_0x4b1b78[_0xc1fe('0x46')][_0xc1fe('0x48')]?_0x4b1b78[_0xc1fe('0x46')]:_0x53bf65[_0xc1fe('0x41')];if(!_0x1f89fd[_0xc1fe('0x42')][_0xc1fe('0x49')](_0xc1fe('0x4a'))){_0x4b1b78[_0xc1fe('0x2e')]=qs[_0xc1fe('0x2e')](_0x1f89fd[_0xc1fe('0x42')]['limit']);_0x4b1b78['offset']=qs[_0xc1fe('0x2c')](_0x1f89fd[_0xc1fe('0x42')][_0xc1fe('0x2c')]);}_0x4b1b78[_0xc1fe('0x4b')]=qs[_0xc1fe('0x4c')](_0x1f89fd[_0xc1fe('0x42')][_0xc1fe('0x4c')]);_0x4b1b78[_0xc1fe('0x4d')]=qs[_0xc1fe('0x44')](_['pick'](_0x1f89fd['query'],_0x53bf65[_0xc1fe('0x44')]));_0x4b1b78[_0xc1fe('0x4d')]['OpenchannelAccountId']=_0x2d925d['id'];if(_0x1f89fd[_0xc1fe('0x42')][_0xc1fe('0x4f')]){_0x4b1b78[_0xc1fe('0x4d')]=_[_0xc1fe('0x50')](_0x4b1b78[_0xc1fe('0x4d')],{'$or':_[_0xc1fe('0x3d')](_0x4b1b78[_0xc1fe('0x46')],function(_0x5f09ea){var _0x372728={};_0x372728[_0x5f09ea]={'$like':'%'+_0x1f89fd[_0xc1fe('0x42')][_0xc1fe('0x4f')]+'%'};return _0x372728;})});}_0x4b1b78=_[_0xc1fe('0x50')]({},_0x4b1b78,_0x1f89fd[_0xc1fe('0x51')]);return db['OpenchannelInteraction'][_0xc1fe('0x2f')]({'where':_0x4b1b78['where']})[_0xc1fe('0x1d')](function(_0x35bf3e){_0x11fa4c[_0xc1fe('0x2f')]=_0x35bf3e;if(_0x1f89fd[_0xc1fe('0x42')][_0xc1fe('0x53')]){_0x4b1b78[_0xc1fe('0x54')]=[{'model':db[_0xc1fe('0x6d')],'as':_0xc1fe('0xa7'),'required':![]},{'model':db['User'],'as':_0xc1fe('0xa8'),'attributes':[_0xc1fe('0x39'),_0xc1fe('0xa9'),_0xc1fe('0xaa')],'required':![]},{'model':db['Tag'],'as':_0xc1fe('0xab'),'attributes':['id','name',_0xc1fe('0xac')],'where':_0x1f89fd[_0xc1fe('0x42')][_0xc1fe('0xad')]?{'id':_0x1f89fd[_0xc1fe('0x42')][_0xc1fe('0xad')]}:undefined,'required':_0x1f89fd[_0xc1fe('0x42')][_0xc1fe('0xad')]?!![]:![]}];}return db[_0xc1fe('0x8c')][_0xc1fe('0x66')](_0x4b1b78);})[_0xc1fe('0x1d')](function(_0x2e29a0){_0x11fa4c[_0xc1fe('0x55')]=_0x2e29a0;return _0x11fa4c;});}})[_0xc1fe('0x1d')](respondWithFilteredResult(_0x2b1c77,_0x4b1b78))[_0xc1fe('0x27')](handleError(_0x2b1c77,null));};exports['addAgents']=function(_0x23ca7d,_0x51352f,_0x1069de){return db['OpenchannelAccount'][_0xc1fe('0x58')]({'where':{'id':_0x23ca7d[_0xc1fe('0x60')]['id']}})[_0xc1fe('0x1d')](handleEntityNotFound(_0x51352f,null))[_0xc1fe('0x1d')](function(_0x4869c1){if(_0x4869c1){return _0x4869c1[_0xc1fe('0xae')](_0x23ca7d[_0xc1fe('0x5a')][_0xc1fe('0x68')],_[_0xc1fe('0xaf')](_0x23ca7d[_0xc1fe('0x5a')],['ids','id'])||{})[_0xc1fe('0xb0')](function(_0xee4028){for(var _0x34996c=0x0;_0x34996c<_0x23ca7d[_0xc1fe('0x5a')][_0xc1fe('0x68')]['length'];_0x34996c+=0x1){socket[_0xc1fe('0xb1')](_0xc1fe('0xb2'),{'UserId':Number(_0x23ca7d[_0xc1fe('0x5a')][_0xc1fe('0x68')][_0x34996c]),'OpenchannelAccountId':Number(_0x23ca7d[_0xc1fe('0x60')]['id'])});}return _0xee4028;});}})['then'](respondWithResult(_0x51352f,null))[_0xc1fe('0x27')](handleError(_0x51352f,null));};exports[_0xc1fe('0xb3')]=function(_0x136890,_0x400a09,_0x2f3567){return db[_0xc1fe('0x52')]['find']({'where':{'id':_0x136890['params']['id']}})[_0xc1fe('0x1d')](handleEntityNotFound(_0x400a09,null))[_0xc1fe('0x1d')](function(_0x30f818){if(_0x30f818){return _0x30f818[_0xc1fe('0xb3')](_0x136890[_0xc1fe('0x42')][_0xc1fe('0x68')])['then'](function(){if(_[_0xc1fe('0xb4')](_0x136890[_0xc1fe('0x42')][_0xc1fe('0x68')])){for(var _0x18adb4=0x0;_0x18adb4<_0x136890[_0xc1fe('0x42')][_0xc1fe('0x68')][_0xc1fe('0x48')];_0x18adb4+=0x1){socket[_0xc1fe('0xb1')](_0xc1fe('0xb5'),{'UserId':Number(_0x136890['query'][_0xc1fe('0x68')][_0x18adb4]),'OpenchannelAccountId':Number(_0x136890[_0xc1fe('0x60')]['id'])});}}else{socket[_0xc1fe('0xb1')](_0xc1fe('0xb5'),{'UserId':Number(_0x136890[_0xc1fe('0x42')]['ids']),'OpenchannelAccountId':Number(_0x136890[_0xc1fe('0x60')]['id'])});}});}})[_0xc1fe('0x1d')](respondWithStatusCode(_0x400a09,null))['catch'](handleError(_0x400a09,null));};exports['getAgents']=function(_0x3f1db3,_0x5db8b4,_0x50d635){var _0x26ccc3={};var _0x521b5a={};var _0x3c131b;var _0x49732c;return db[_0xc1fe('0x52')][_0xc1fe('0x65')]({'where':{'id':_0x3f1db3[_0xc1fe('0x60')]['id']}})[_0xc1fe('0x1d')](handleEntityNotFound(_0x5db8b4,null))['then'](function(_0x1282a7){if(_0x1282a7){_0x3c131b=_0x1282a7;_0x521b5a[_0xc1fe('0x41')]=_[_0xc1fe('0x43')](db['User'][_0xc1fe('0x3e')]);_0x521b5a['query']=_[_0xc1fe('0x43')](_0x3f1db3[_0xc1fe('0x42')]);_0x521b5a[_0xc1fe('0x44')]=_[_0xc1fe('0x45')](_0x521b5a[_0xc1fe('0x41')],_0x521b5a[_0xc1fe('0x42')]);_0x26ccc3[_0xc1fe('0x46')]=_[_0xc1fe('0x45')](_0x521b5a[_0xc1fe('0x41')],qs[_0xc1fe('0x47')](_0x3f1db3['query'][_0xc1fe('0x47')]));_0x26ccc3['attributes']=_0x26ccc3[_0xc1fe('0x46')][_0xc1fe('0x48')]?_0x26ccc3['attributes']:_0x521b5a['model'];_0x26ccc3['order']=qs[_0xc1fe('0x4c')](_0x3f1db3[_0xc1fe('0x42')]['sort']);_0x26ccc3[_0xc1fe('0x4d')]=qs[_0xc1fe('0x44')](_[_0xc1fe('0x4e')](_0x3f1db3[_0xc1fe('0x42')],_0x521b5a['filters']));if(_0x3f1db3[_0xc1fe('0x42')][_0xc1fe('0x4f')]){_0x26ccc3[_0xc1fe('0x4d')]=_['merge'](_0x26ccc3[_0xc1fe('0x4d')],{'$or':_['map'](_0x26ccc3['attributes'],function(_0x151bc6){var _0x202edd={};_0x202edd[_0x151bc6]={'$like':'%'+_0x3f1db3[_0xc1fe('0x42')][_0xc1fe('0x4f')]+'%'};return _0x202edd;})});}_0x26ccc3=_[_0xc1fe('0x50')]({},_0x26ccc3,_0x3f1db3['options']);return _0x3c131b[_0xc1fe('0xb6')](_0x26ccc3);}})[_0xc1fe('0x1d')](function(_0x230c3d){if(_0x230c3d){_0x49732c=_0x230c3d[_0xc1fe('0x48')];if(!_0x3f1db3['query'][_0xc1fe('0x49')](_0xc1fe('0x4a'))){_0x26ccc3[_0xc1fe('0x2e')]=qs[_0xc1fe('0x2e')](_0x3f1db3[_0xc1fe('0x42')][_0xc1fe('0x2e')]);_0x26ccc3[_0xc1fe('0x2c')]=qs[_0xc1fe('0x2c')](_0x3f1db3[_0xc1fe('0x42')][_0xc1fe('0x2c')]);}return _0x3c131b[_0xc1fe('0xb6')](_0x26ccc3);}})['then'](function(_0xd2cfc2){if(_0xd2cfc2){return _0xd2cfc2?{'count':_0x49732c,'rows':_0xd2cfc2}:null;}})[_0xc1fe('0x1d')](respondWithResult(_0x5db8b4,null))['catch'](handleError(_0x5db8b4,null));};exports[_0xc1fe('0x3a')]=function(_0x39ee49,_0x41e33e,_0x5d7d11){var _0x32a72c,_0x80147d,_0x2258e9;if(_[_0xc1fe('0x79')](_0x39ee49[_0xc1fe('0x5a')][_0xc1fe('0x5a')])||_0x39ee49[_0xc1fe('0x5a')]['body']===''){throw new db[(_0xc1fe('0x6f'))][(_0xc1fe('0x77'))](_0xc1fe('0x7a'));}if(_[_0xc1fe('0x79')](_0x39ee49[_0xc1fe('0x5a')]['to'])){}_0x32a72c=_0x39ee49[_0xc1fe('0x5a')]['to'];return db[_0xc1fe('0x52')][_0xc1fe('0x65')]({'where':{'id':_0x39ee49['params']['id']}})[_0xc1fe('0x1d')](handleEntityNotFound(_0x41e33e,null))[_0xc1fe('0x1d')](function(_0x5e5100){if(_0x5e5100){return db[_0xc1fe('0x52')][_0xc1fe('0x58')]({'where':{'id':_0x5e5100['id']},'include':[{'model':db[_0xc1fe('0xb7')],'as':_0xc1fe('0x7e'),'include':[{'model':db[_0xc1fe('0x6d')],'as':_0xc1fe('0x7f'),'where':{[_0x5e5100[_0xc1fe('0x7b')]]:_0x32a72c},'limit':0x1,'order':[[_0xc1fe('0x72'),_0xc1fe('0xb8')]]}]}]})[_0xc1fe('0x1d')](handleEntityNotFound(_0x41e33e,null))[_0xc1fe('0x1d')](function(_0xff4ca6){if(_0xff4ca6&&_0xff4ca6['List']){_0x80147d=_0xff4ca6[_0xc1fe('0x35')]({'plain':!![]});if(_0x80147d[_0xc1fe('0x7e')]&&_0x80147d[_0xc1fe('0x7e')][_0xc1fe('0x7f')]['length']){return _0x80147d[_0xc1fe('0x7e')]['Contacts'][0x0];}return db['CmContact'][_0xc1fe('0x59')](_[_0xc1fe('0x87')](_0x39ee49[_0xc1fe('0x5a')],{'firstName':_0x32a72c,[_0xff4ca6[_0xc1fe('0x7b')]]:_0x32a72c,'phone':_0x32a72c,'ListId':_0x80147d[_0xc1fe('0x75')]}));}})[_0xc1fe('0x1d')](handleEntityNotFound(_0x41e33e,null))[_0xc1fe('0x1d')](function(_0x3173f1){if(_0x3173f1){_0x2258e9=_0x3173f1;return db[_0xc1fe('0x8c')][_0xc1fe('0x58')]({'where':{'ContactId':_0x2258e9['id'],'closed':![],'OpenchannelAccountId':_0x80147d['id']}})[_0xc1fe('0x1d')](function(_0x32c1d5){if(_0x32c1d5){return[_0x32c1d5,![]];}return db['OpenchannelInteraction'][_0xc1fe('0x59')]({'UserId':_0x39ee49[_0xc1fe('0x5b')]['id'],'ContactId':_0x2258e9['id'],'OpenchannelAccountId':_0x80147d['id'],'lastMsgDirection':'out','firstMsgDirection':_0xc1fe('0xb9'),'Messages':[_[_0xc1fe('0x50')](_0x39ee49[_0xc1fe('0x5a')],{'read':![],'body':_0x39ee49[_0xc1fe('0x5a')][_0xc1fe('0x5a')],'OpenchannelAccountId':_0x80147d['id'],'UserId':_0x39ee49[_0xc1fe('0x5b')]['id'],'ContactId':_0x2258e9['id']})]},{'include':[{'model':db[_0xc1fe('0x94')],'as':_0xc1fe('0xba')}]})[_0xc1fe('0x1d')](function(_0x3fec83){return[_0x3fec83,!![]];});});}})[_0xc1fe('0xb0')](function(_0x370414,_0x2295ca){if(_0x2295ca){return _0x370414;}return db[_0xc1fe('0x94')][_0xc1fe('0x59')](_[_0xc1fe('0x50')](_0x39ee49[_0xc1fe('0x5a')],{'read':![],'body':_0x39ee49[_0xc1fe('0x5a')][_0xc1fe('0x5a')],'OpenchannelAccountId':_0x80147d['id'],'OpenchannelInteractionId':_0x370414['id'],'UserId':_0x39ee49[_0xc1fe('0x5b')]['id'],'ContactId':_0x2258e9['id']}))[_0xc1fe('0x1d')](function(_0xd53ac0){_0x370414['dataValues'][_0xc1fe('0xba')]=[];_0x370414['dataValues'][_0xc1fe('0xba')]['push'](_0xd53ac0['dataValues']);return _0x370414;});});}})[_0xc1fe('0x1d')](respondWithResult(_0x41e33e,null))['catch'](handleError(_0x41e33e,null));}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.events.js b/server/api/openchannelAccount/openchannelAccount.events.js index e34807c..64fcb9f 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 _0xb688=['../../mysqldb','OpenchannelAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','exports'];(function(_0x279c80,_0x3c9692){var _0x4e1f5c=function(_0xe42af3){while(--_0xe42af3){_0x279c80['push'](_0x279c80['shift']());}};_0x4e1f5c(++_0x3c9692);}(_0xb688,0xcf));var _0x8b68=function(_0x21c2c8,_0x44257e){_0x21c2c8=_0x21c2c8-0x0;var _0x4dd745=_0xb688[_0x21c2c8];return _0x4dd745;};'use strict';var EventEmitter=require('events');var OpenchannelAccount=require(_0x8b68('0x0'))['db'][_0x8b68('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0x8b68('0x2')](0x0);var events={'afterCreate':_0x8b68('0x3'),'afterUpdate':_0x8b68('0x4'),'afterDestroy':_0x8b68('0x5')};function emitEvent(_0x4e281c){return function(_0x41030e,_0x27925d,_0x30f33d){OpenchannelAccountEvents[_0x8b68('0x6')](_0x4e281c+':'+_0x41030e['id'],_0x41030e);OpenchannelAccountEvents['emit'](_0x4e281c,_0x41030e);_0x30f33d(null);};}for(var e in events){if(events[_0x8b68('0x7')](e)){var event=events[e];OpenchannelAccount['hook'](e,emitEvent(event));}}module[_0x8b68('0x8')]=OpenchannelAccountEvents; \ No newline at end of file +var _0x2dae=['remove','emit','hasOwnProperty','hook','exports','events','OpenchannelAccount','setMaxListeners','save','update'];(function(_0x2bc59f,_0x5b2e53){var _0x524029=function(_0x383d4b){while(--_0x383d4b){_0x2bc59f['push'](_0x2bc59f['shift']());}};_0x524029(++_0x5b2e53);}(_0x2dae,0xc3));var _0xe2da=function(_0x282a1f,_0x49a6ef){_0x282a1f=_0x282a1f-0x0;var _0x296ea7=_0x2dae[_0x282a1f];return _0x296ea7;};'use strict';var EventEmitter=require(_0xe2da('0x0'));var OpenchannelAccount=require('../../mysqldb')['db'][_0xe2da('0x1')];var OpenchannelAccountEvents=new EventEmitter();OpenchannelAccountEvents[_0xe2da('0x2')](0x0);var events={'afterCreate':_0xe2da('0x3'),'afterUpdate':_0xe2da('0x4'),'afterDestroy':_0xe2da('0x5')};function emitEvent(_0x481d97){return function(_0x25b9f2,_0x439b5d,_0x77e45e){OpenchannelAccountEvents[_0xe2da('0x6')](_0x481d97+':'+_0x25b9f2['id'],_0x25b9f2);OpenchannelAccountEvents['emit'](_0x481d97,_0x25b9f2);_0x77e45e(null);};}for(var e in events){if(events[_0xe2da('0x7')](e)){var event=events[e];OpenchannelAccount[_0xe2da('0x8')](e,emitEvent(event));}}module[_0xe2da('0x9')]=OpenchannelAccountEvents; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.model.js b/server/api/openchannelAccount/openchannelAccount.model.js index 4041b4b..0b8802c 100644 --- a/server/api/openchannelAccount/openchannelAccount.model.js +++ b/server/api/openchannelAccount/openchannelAccount.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x3c0a55,_0x3509b4){var _0x3fba6f=function(_0x3b5162){while(--_0x3b5162){_0x3c0a55['push'](_0x3c0a55['shift']());}};_0x3fba6f(++_0x3509b4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x45e98e,_0x169b60){_0x45e98e=_0x45e98e-0x0;var _0x374dba=_0xa9e0[_0x45e98e];return _0x374dba;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./openchannelAccount.attributes','exports','define','OpenchannelAccount','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0xe54b56,_0x1b9b50){var _0x51937a=function(_0x5648a1){while(--_0x5648a1){_0xe54b56['push'](_0xe54b56['shift']());}};_0x51937a(++_0x1b9b50);}(_0xa9e0,0x123));var _0x0a9e=function(_0x387777,_0x356171){_0x387777=_0x387777-0x0;var _0x3f84c0=_0xa9e0[_0x387777];return _0x3f84c0;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'openchannel_accounts','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.rpc.js b/server/api/openchannelAccount/openchannelAccount.rpc.js index fa1cfaa..e333219 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 _0xf45e=['OpenchannelAccount,\x20%s,\x20%s','request\x20sent','debug','OpenchannelAccount,\x20%s,\x20%s,\x20%s','error','message','result','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelAccount.socket','register','request','then'];(function(_0x474542,_0x214f97){var _0x5a5619=function(_0x126665){while(--_0x126665){_0x474542['push'](_0x474542['shift']());}};_0x5a5619(++_0x214f97);}(_0xf45e,0x115));var _0xef45=function(_0x1439fb,_0x1b69d7){_0x1439fb=_0x1439fb-0x0;var _0x39151e=_0xf45e[_0x1439fb];return _0x39151e;};'use strict';var _=require(_0xef45('0x0'));var util=require('util');var moment=require(_0xef45('0x1'));var BPromise=require('bluebird');var rs=require(_0xef45('0x2'));var fs=require('fs');var Redis=require(_0xef45('0x3'));var db=require(_0xef45('0x4'))['db'];var utils=require(_0xef45('0x5'));var logger=require(_0xef45('0x6'))(_0xef45('0x7'));var config=require(_0xef45('0x8'));var jayson=require(_0xef45('0x9'));var client=jayson[_0xef45('0xa')][_0xef45('0xb')]({'port':0x232a});config[_0xef45('0xc')]=_[_0xef45('0xd')](config[_0xef45('0xc')],{'host':_0xef45('0xe'),'port':0x18eb});var socket=require(_0xef45('0xf'))(new Redis(config[_0xef45('0xc')]));require(_0xef45('0x10'))[_0xef45('0x11')](socket);function respondWithRpcPromise(_0xdac512,_0x4d5cc7,_0x3e852f){return new BPromise(function(_0x400d25,_0x46cfeb){return client[_0xef45('0x12')](_0xdac512,_0x3e852f)[_0xef45('0x13')](function(_0x2b429f){logger['info'](_0xef45('0x14'),_0x4d5cc7,_0xef45('0x15'));logger[_0xef45('0x16')](_0xef45('0x17'),_0x4d5cc7,_0xef45('0x15'),JSON['stringify'](_0x2b429f));if(_0x2b429f['error']){if(_0x2b429f[_0xef45('0x18')]['code']===0x1f4){logger[_0xef45('0x18')](_0xef45('0x14'),_0x4d5cc7,_0x2b429f[_0xef45('0x18')]['message']);return _0x46cfeb(_0x2b429f['error'][_0xef45('0x19')]);}logger['error'](_0xef45('0x14'),_0x4d5cc7,_0x2b429f[_0xef45('0x18')][_0xef45('0x19')]);return _0x400d25(_0x2b429f[_0xef45('0x18')]['message']);}else{logger['info'](_0xef45('0x14'),_0x4d5cc7,_0xef45('0x15'));_0x400d25(_0x2b429f[_0xef45('0x1a')][_0xef45('0x19')]);}})['catch'](function(_0x562955){logger[_0xef45('0x18')](_0xef45('0x14'),_0x4d5cc7,_0x562955);_0x46cfeb(_0x562955);});});} \ No newline at end of file +var _0x1bc6=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./openchannelAccount.socket','request\x20sent','OpenchannelAccount,\x20%s,\x20%s,\x20%s','code','error','message','OpenchannelAccount,\x20%s,\x20%s','result','catch','lodash','util'];(function(_0x30ae5e,_0x391fc4){var _0x1f2e93=function(_0x60307d){while(--_0x60307d){_0x30ae5e['push'](_0x30ae5e['shift']());}};_0x1f2e93(++_0x391fc4);}(_0x1bc6,0x94));var _0x61bc=function(_0x5a8780,_0x937b65){_0x5a8780=_0x5a8780-0x0;var _0x473759=_0x1bc6[_0x5a8780];return _0x473759;};'use strict';var _=require(_0x61bc('0x0'));var util=require(_0x61bc('0x1'));var moment=require(_0x61bc('0x2'));var BPromise=require(_0x61bc('0x3'));var rs=require(_0x61bc('0x4'));var fs=require('fs');var Redis=require(_0x61bc('0x5'));var db=require(_0x61bc('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x61bc('0x7'))(_0x61bc('0x8'));var config=require(_0x61bc('0x9'));var jayson=require(_0x61bc('0xa'));var client=jayson[_0x61bc('0xb')][_0x61bc('0xc')]({'port':0x232a});config[_0x61bc('0xd')]=_[_0x61bc('0xe')](config[_0x61bc('0xd')],{'host':'localhost','port':0x18eb});var socket=require(_0x61bc('0xf'))(new Redis(config['redis']));require(_0x61bc('0x10'))['register'](socket);function respondWithRpcPromise(_0x139c92,_0x526b6c,_0x23ff47){return new BPromise(function(_0x34650a,_0x955483){return client['request'](_0x139c92,_0x23ff47)['then'](function(_0x508f2f){logger['info']('OpenchannelAccount,\x20%s,\x20%s',_0x526b6c,_0x61bc('0x11'));logger['debug'](_0x61bc('0x12'),_0x526b6c,_0x61bc('0x11'),JSON['stringify'](_0x508f2f));if(_0x508f2f['error']){if(_0x508f2f['error'][_0x61bc('0x13')]===0x1f4){logger[_0x61bc('0x14')]('OpenchannelAccount,\x20%s,\x20%s',_0x526b6c,_0x508f2f[_0x61bc('0x14')][_0x61bc('0x15')]);return _0x955483(_0x508f2f[_0x61bc('0x14')][_0x61bc('0x15')]);}logger[_0x61bc('0x14')](_0x61bc('0x16'),_0x526b6c,_0x508f2f['error'][_0x61bc('0x15')]);return _0x34650a(_0x508f2f[_0x61bc('0x14')]['message']);}else{logger['info'](_0x61bc('0x16'),_0x526b6c,_0x61bc('0x11'));_0x34650a(_0x508f2f[_0x61bc('0x17')]['message']);}})[_0x61bc('0x18')](function(_0x44b6d1){logger[_0x61bc('0x14')](_0x61bc('0x16'),_0x526b6c,_0x44b6d1);_0x955483(_0x44b6d1);});});} \ No newline at end of file diff --git a/server/api/openchannelAccount/openchannelAccount.socket.js b/server/api/openchannelAccount/openchannelAccount.socket.js index 623068e..3186092 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 _0x1b73=['openchannelAccount:','save','remove','update','register','length'];(function(_0x359a73,_0x2ee207){var _0x41baa4=function(_0x5f16f){while(--_0x5f16f){_0x359a73['push'](_0x359a73['shift']());}};_0x41baa4(++_0x2ee207);}(_0x1b73,0x1d5));var _0x31b7=function(_0x1afd7b,_0x3b2ab8){_0x1afd7b=_0x1afd7b-0x0;var _0xf8d47e=_0x1b73[_0x1afd7b];return _0xf8d47e;};'use strict';var OpenchannelAccountEvents=require('./openchannelAccount.events');var events=[_0x31b7('0x0'),_0x31b7('0x1'),_0x31b7('0x2')];function createListener(_0x5c767e,_0x4bf5ae){return function(_0x17c0ef){_0x4bf5ae['emit'](_0x5c767e,_0x17c0ef);};}function removeListener(_0x40fef2,_0x3682cc){return function(){OpenchannelAccountEvents['removeListener'](_0x40fef2,_0x3682cc);};}exports[_0x31b7('0x3')]=function(_0x3d058f){for(var _0x15c31e=0x0,_0x502838=events[_0x31b7('0x4')];_0x15c31e<_0x502838;_0x15c31e++){var _0x1a730f=events[_0x15c31e];var _0x86ef8e=createListener(_0x31b7('0x5')+_0x1a730f,_0x3d058f);OpenchannelAccountEvents['on'](_0x1a730f,_0x86ef8e);}}; \ No newline at end of file +var _0xffaa=['removeListener','register','openchannelAccount:','./openchannelAccount.events','save','remove','emit'];(function(_0x2b2c40,_0x850b0){var _0x1413c7=function(_0x4bf462){while(--_0x4bf462){_0x2b2c40['push'](_0x2b2c40['shift']());}};_0x1413c7(++_0x850b0);}(_0xffaa,0x130));var _0xaffa=function(_0x5878c5,_0x434a2a){_0x5878c5=_0x5878c5-0x0;var _0x307295=_0xffaa[_0x5878c5];return _0x307295;};'use strict';var OpenchannelAccountEvents=require(_0xaffa('0x0'));var events=[_0xaffa('0x1'),_0xaffa('0x2'),'update'];function createListener(_0x5d597a,_0x124832){return function(_0x2433d9){_0x124832[_0xaffa('0x3')](_0x5d597a,_0x2433d9);};}function removeListener(_0xd01185,_0x444eef){return function(){OpenchannelAccountEvents[_0xaffa('0x4')](_0xd01185,_0x444eef);};}exports[_0xaffa('0x5')]=function(_0x40a369){for(var _0x4306c0=0x0,_0x281191=events['length'];_0x4306c0<_0x281191;_0x4306c0++){var _0xa081be=events[_0x4306c0];var _0x7c018f=createListener(_0xaffa('0x6')+_0xa081be,_0x40a369);OpenchannelAccountEvents['on'](_0xa081be,_0x7c018f);}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/index.js b/server/api/openchannelApplication/index.js index fb5c8fc..09cb4a6 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 _0x9460=['Router','../../components/auth/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','put','/:id','delete','destroy','multer','util','path','connect-timeout','express'];(function(_0x2c5a58,_0x33ef57){var _0x2f6988=function(_0x51584b){while(--_0x51584b){_0x2c5a58['push'](_0x2c5a58['shift']());}};_0x2f6988(++_0x33ef57);}(_0x9460,0x1e8));var _0x0946=function(_0x34c5d2,_0x2878ee){_0x34c5d2=_0x34c5d2-0x0;var _0x90e47c=_0x9460[_0x34c5d2];return _0x90e47c;};'use strict';var multer=require(_0x0946('0x0'));var util=require(_0x0946('0x1'));var path=require(_0x0946('0x2'));var timeout=require(_0x0946('0x3'));var express=require(_0x0946('0x4'));var router=express[_0x0946('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0946('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x0946('0x7'));var controller=require(_0x0946('0x8'));router[_0x0946('0x9')]('/',auth[_0x0946('0xa')](),controller[_0x0946('0xb')]);router[_0x0946('0x9')]('/:id',auth[_0x0946('0xa')](),controller[_0x0946('0xc')]);router['post']('/',auth[_0x0946('0xa')](),controller['create']);router[_0x0946('0xd')](_0x0946('0xe'),auth[_0x0946('0xa')](),controller['update']);router[_0x0946('0xf')](_0x0946('0xe'),auth['isAuthenticated'](),controller[_0x0946('0x10')]);module['exports']=router; \ No newline at end of file +var _0xf582=['path','connect-timeout','express','Router','../../components/interaction/service','../../config/environment','./openchannelApplication.controller','get','isAuthenticated','index','show','post','create','put','/:id','delete','destroy','exports','multer','util'];(function(_0x521f06,_0x1f8e7c){var _0x410a40=function(_0x471e9d){while(--_0x471e9d){_0x521f06['push'](_0x521f06['shift']());}};_0x410a40(++_0x1f8e7c);}(_0xf582,0x166));var _0x2f58=function(_0x41d364,_0xdfdc1a){_0x41d364=_0x41d364-0x0;var _0x5ace98=_0xf582[_0x41d364];return _0x5ace98;};'use strict';var multer=require(_0x2f58('0x0'));var util=require(_0x2f58('0x1'));var path=require(_0x2f58('0x2'));var timeout=require(_0x2f58('0x3'));var express=require(_0x2f58('0x4'));var router=express[_0x2f58('0x5')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x2f58('0x6'));var config=require(_0x2f58('0x7'));var controller=require(_0x2f58('0x8'));router[_0x2f58('0x9')]('/',auth[_0x2f58('0xa')](),controller[_0x2f58('0xb')]);router[_0x2f58('0x9')]('/:id',auth[_0x2f58('0xa')](),controller[_0x2f58('0xc')]);router[_0x2f58('0xd')]('/',auth[_0x2f58('0xa')](),controller[_0x2f58('0xe')]);router[_0x2f58('0xf')](_0x2f58('0x10'),auth[_0x2f58('0xa')](),controller['update']);router[_0x2f58('0x11')](_0x2f58('0x10'),auth['isAuthenticated'](),controller[_0x2f58('0x12')]);module[_0x2f58('0x13')]=router; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.attributes.js b/server/api/openchannelApplication/openchannelApplication.attributes.js index 8532159..b73c777 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 _0xe107=['INTEGER','noop','STRING','sequelize','exports'];(function(_0x50c35a,_0x514e66){var _0x4dda1e=function(_0x18b5d1){while(--_0x18b5d1){_0x50c35a['push'](_0x50c35a['shift']());}};_0x4dda1e(++_0x514e66);}(_0xe107,0x17a));var _0x7e10=function(_0x4ca392,_0x5cfea3){_0x4ca392=_0x4ca392-0x0;var _0xb0f431=_0xe107[_0x4ca392];return _0xb0f431;};'use strict';var Sequelize=require(_0x7e10('0x0'));module[_0x7e10('0x1')]={'priority':{'type':Sequelize[_0x7e10('0x2')],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x7e10('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x7e10('0x4')]},'interval':{'type':Sequelize[_0x7e10('0x4')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0xd160=['sequelize','noop','TEXT','STRING','*,*,*,*'];(function(_0x53ccf2,_0x13cb67){var _0x5a2964=function(_0x3b0514){while(--_0x3b0514){_0x53ccf2['push'](_0x53ccf2['shift']());}};_0x5a2964(++_0x13cb67);}(_0xd160,0x159));var _0x0d16=function(_0x402731,_0x43c115){_0x402731=_0x402731-0x0;var _0x111736=_0xd160[_0x402731];return _0x111736;};'use strict';var Sequelize=require(_0x0d16('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0d16('0x1')},'appdata':{'type':Sequelize[_0x0d16('0x2')]()},'description':{'type':Sequelize[_0x0d16('0x3')]},'interval':{'type':Sequelize[_0x0d16('0x3')],'defaultValue':_0x0d16('0x4')}}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.controller.js b/server/api/openchannelApplication/openchannelApplication.controller.js index a8389ed..eb0336b 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 _0xbf0d=['path','sox','to-csv','ejs','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','save','update','then','destroy','error','stack','name','send','index','rawAttributes','fieldName','type','key','model','map','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','OpenchannelApplication','include','findAll','catch','show','params','keys','includeAll','find','create','body','zip-dir','fast-json-patch','request-promise','moment','bluebird','util'];(function(_0x179535,_0x494780){var _0x11ef66=function(_0x5d924f){while(--_0x5d924f){_0x179535['push'](_0x179535['shift']());}};_0x11ef66(++_0x494780);}(_0xbf0d,0x1bc));var _0xdbf0=function(_0x313118,_0x112646){_0x313118=_0x313118-0x0;var _0x14052d=_0xbf0d[_0x313118];return _0x14052d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xdbf0('0x0'));var jsonpatch=require(_0xdbf0('0x1'));var rp=require(_0xdbf0('0x2'));var moment=require(_0xdbf0('0x3'));var BPromise=require(_0xdbf0('0x4'));var Mustache=require('mustache');var util=require(_0xdbf0('0x5'));var path=require(_0xdbf0('0x6'));var sox=require(_0xdbf0('0x7'));var csv=require(_0xdbf0('0x8'));var ejs=require(_0xdbf0('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xdbf0('0xa'));var squel=require('squel');var crypto=require(_0xdbf0('0xb'));var jsforce=require(_0xdbf0('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xdbf0('0xd'));var Papa=require(_0xdbf0('0xe'));var Redis=require(_0xdbf0('0xf'));var authService=require(_0xdbf0('0x10'));var qs=require(_0xdbf0('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xdbf0('0x12'));var logger=require(_0xdbf0('0x13'))('api');var utils=require('../../config/utils');var config=require(_0xdbf0('0x14'));var licenseUtil=require(_0xdbf0('0x15'));var db=require(_0xdbf0('0x16'))['db'];function respondWithStatusCode(_0x2ad122,_0xa4906a){_0xa4906a=_0xa4906a||0xcc;return function(_0xe94eaa){if(_0xe94eaa){return _0x2ad122[_0xdbf0('0x17')](_0xa4906a);}return _0x2ad122[_0xdbf0('0x18')](_0xa4906a)[_0xdbf0('0x19')]();};}function respondWithResult(_0x18435c,_0x3fd03d){_0x3fd03d=_0x3fd03d||0xc8;return function(_0x168564){if(_0x168564){return _0x18435c[_0xdbf0('0x18')](_0x3fd03d)[_0xdbf0('0x1a')](_0x168564);}};}function respondWithFilteredResult(_0x842959,_0x355714){return function(_0xd7458e){if(_0xd7458e){var _0x201c98=typeof _0x355714[_0xdbf0('0x1b')]==='undefined'&&typeof _0x355714[_0xdbf0('0x1c')]===_0xdbf0('0x1d');var _0x56fafc=_0xd7458e[_0xdbf0('0x1e')];var _0x36df84=_0x201c98?0x0:_0x355714[_0xdbf0('0x1b')];var _0x21dccc=_0x201c98?_0xd7458e['count']:_0x355714[_0xdbf0('0x1b')]+_0x355714[_0xdbf0('0x1c')];var _0x4c86e0;if(_0x21dccc>=_0x56fafc){_0x21dccc=_0x56fafc;_0x4c86e0=0xc8;}else{_0x4c86e0=0xce;}_0x842959[_0xdbf0('0x18')](_0x4c86e0);return _0x842959['set'](_0xdbf0('0x1f'),_0x36df84+'-'+_0x21dccc+'/'+_0x56fafc)['json'](_0xd7458e);}return null;};}function patchUpdates(_0x2f3e1d){return function(_0x4f1517){try{jsonpatch[_0xdbf0('0x20')](_0x4f1517,_0x2f3e1d,!![]);}catch(_0x26c013){return BPromise['reject'](_0x26c013);}return _0x4f1517[_0xdbf0('0x21')]();};}function saveUpdates(_0x948a27,_0x33355e){return function(_0x44cd25){if(_0x44cd25){return _0x44cd25[_0xdbf0('0x22')](_0x948a27)[_0xdbf0('0x23')](function(_0x316cf5){return _0x316cf5;});}return null;};}function removeEntity(_0x3ad326,_0x41e822){return function(_0x17ba8a){if(_0x17ba8a){return _0x17ba8a[_0xdbf0('0x24')]()[_0xdbf0('0x23')](function(){_0x3ad326['status'](0xcc)[_0xdbf0('0x19')]();});}};}function handleEntityNotFound(_0x217ce9,_0x1e295e){return function(_0x5b82df){if(!_0x5b82df){_0x217ce9['sendStatus'](0x194);}return _0x5b82df;};}function handleError(_0x5f4bfb,_0x1915d7){_0x1915d7=_0x1915d7||0x1f4;return function(_0x3b0cba){logger[_0xdbf0('0x25')](_0x3b0cba[_0xdbf0('0x26')]);if(_0x3b0cba[_0xdbf0('0x27')]){delete _0x3b0cba[_0xdbf0('0x27')];}_0x5f4bfb['status'](_0x1915d7)[_0xdbf0('0x28')](_0x3b0cba);};}exports[_0xdbf0('0x29')]=function(_0x1a1125,_0xd9399c){var _0x55d692={},_0x2b6399={},_0x1c7cec={'count':0x0,'rows':[]};var _0x5ee7fc=_['map'](db['OpenchannelApplication'][_0xdbf0('0x2a')],function(_0x4230a0){return{'name':_0x4230a0[_0xdbf0('0x2b')],'type':_0x4230a0[_0xdbf0('0x2c')][_0xdbf0('0x2d')]};});_0x2b6399[_0xdbf0('0x2e')]=_[_0xdbf0('0x2f')](_0x5ee7fc,_0xdbf0('0x27'));_0x2b6399[_0xdbf0('0x30')]=_['keys'](_0x1a1125[_0xdbf0('0x30')]);_0x2b6399[_0xdbf0('0x31')]=_['intersection'](_0x2b6399[_0xdbf0('0x2e')],_0x2b6399[_0xdbf0('0x30')]);_0x55d692[_0xdbf0('0x32')]=_[_0xdbf0('0x33')](_0x2b6399[_0xdbf0('0x2e')],qs[_0xdbf0('0x34')](_0x1a1125['query'][_0xdbf0('0x34')]));_0x55d692[_0xdbf0('0x32')]=_0x55d692[_0xdbf0('0x32')][_0xdbf0('0x35')]?_0x55d692[_0xdbf0('0x32')]:_0x2b6399['model'];if(!_0x1a1125[_0xdbf0('0x30')][_0xdbf0('0x36')](_0xdbf0('0x37'))){_0x55d692[_0xdbf0('0x1c')]=qs[_0xdbf0('0x1c')](_0x1a1125[_0xdbf0('0x30')][_0xdbf0('0x1c')]);_0x55d692[_0xdbf0('0x1b')]=qs[_0xdbf0('0x1b')](_0x1a1125[_0xdbf0('0x30')][_0xdbf0('0x1b')]);}_0x55d692[_0xdbf0('0x38')]=qs[_0xdbf0('0x39')](_0x1a1125['query'][_0xdbf0('0x39')]);_0x55d692[_0xdbf0('0x3a')]=qs[_0xdbf0('0x31')](_[_0xdbf0('0x3b')](_0x1a1125[_0xdbf0('0x30')],_0x2b6399[_0xdbf0('0x31')]),_0x5ee7fc);if(_0x1a1125['query'][_0xdbf0('0x3c')]){_0x55d692['where']=_[_0xdbf0('0x3d')](_0x55d692[_0xdbf0('0x3a')],{'$or':_['map'](_0x5ee7fc,function(_0x3b859d){if(_0x3b859d['type']!==_0xdbf0('0x3e')){var _0x2201b4={};_0x2201b4[_0x3b859d[_0xdbf0('0x27')]]={'$like':'%'+_0x1a1125[_0xdbf0('0x30')][_0xdbf0('0x3c')]+'%'};return _0x2201b4;}})});}_0x55d692=_[_0xdbf0('0x3d')]({},_0x55d692,_0x1a1125[_0xdbf0('0x3f')]);var _0x400db5={'where':_0x55d692['where']};return db[_0xdbf0('0x40')][_0xdbf0('0x1e')](_0x400db5)[_0xdbf0('0x23')](function(_0x38ec5b){_0x1c7cec['count']=_0x38ec5b;if(_0x1a1125[_0xdbf0('0x30')]['includeAll']){_0x55d692[_0xdbf0('0x41')]=[{'all':!![]}];}return db[_0xdbf0('0x40')][_0xdbf0('0x42')](_0x55d692);})[_0xdbf0('0x23')](function(_0xc93a3){_0x1c7cec['rows']=_0xc93a3;return _0x1c7cec;})[_0xdbf0('0x23')](respondWithFilteredResult(_0xd9399c,_0x55d692))[_0xdbf0('0x43')](handleError(_0xd9399c,null));};exports[_0xdbf0('0x44')]=function(_0x571ca3,_0x113b73){var _0x15ee40={'raw':!![],'where':{'id':_0x571ca3[_0xdbf0('0x45')]['id']}},_0x2e65bd={};_0x2e65bd[_0xdbf0('0x2e')]=_[_0xdbf0('0x46')](db['OpenchannelApplication'][_0xdbf0('0x2a')]);_0x2e65bd[_0xdbf0('0x30')]=_['keys'](_0x571ca3['query']);_0x2e65bd[_0xdbf0('0x31')]=_[_0xdbf0('0x33')](_0x2e65bd[_0xdbf0('0x2e')],_0x2e65bd[_0xdbf0('0x30')]);_0x15ee40['attributes']=_[_0xdbf0('0x33')](_0x2e65bd[_0xdbf0('0x2e')],qs[_0xdbf0('0x34')](_0x571ca3['query'][_0xdbf0('0x34')]));_0x15ee40['attributes']=_0x15ee40[_0xdbf0('0x32')][_0xdbf0('0x35')]?_0x15ee40[_0xdbf0('0x32')]:_0x2e65bd['model'];if(_0x571ca3['query'][_0xdbf0('0x47')]){_0x15ee40[_0xdbf0('0x41')]=[{'all':!![]}];}_0x15ee40=_[_0xdbf0('0x3d')]({},_0x15ee40,_0x571ca3['options']);return db['OpenchannelApplication'][_0xdbf0('0x48')](_0x15ee40)['then'](handleEntityNotFound(_0x113b73,null))['then'](respondWithResult(_0x113b73,null))[_0xdbf0('0x43')](handleError(_0x113b73,null));};exports[_0xdbf0('0x49')]=function(_0x170e76,_0x2e31ae){return db[_0xdbf0('0x40')][_0xdbf0('0x49')](_0x170e76[_0xdbf0('0x4a')],{})['then'](respondWithResult(_0x2e31ae,0xc9))[_0xdbf0('0x43')](handleError(_0x2e31ae,null));};exports[_0xdbf0('0x22')]=function(_0x18f0f6,_0x378c8b){if(_0x18f0f6['body']['id']){delete _0x18f0f6['body']['id'];}return db['OpenchannelApplication'][_0xdbf0('0x48')]({'where':{'id':_0x18f0f6[_0xdbf0('0x45')]['id']}})[_0xdbf0('0x23')](handleEntityNotFound(_0x378c8b,null))[_0xdbf0('0x23')](saveUpdates(_0x18f0f6['body'],null))['then'](respondWithResult(_0x378c8b,null))[_0xdbf0('0x43')](handleError(_0x378c8b,null));};exports[_0xdbf0('0x24')]=function(_0x2f11b3,_0xbbb69){return db[_0xdbf0('0x40')]['find']({'where':{'id':_0x2f11b3[_0xdbf0('0x45')]['id']}})[_0xdbf0('0x23')](handleEntityNotFound(_0xbbb69,null))[_0xdbf0('0x23')](removeEntity(_0xbbb69,null))[_0xdbf0('0x43')](handleError(_0xbbb69,null));}; \ No newline at end of file +var _0x3f83=['query','length','nolimit','sort','where','merge','filter','options','includeAll','include','show','find','catch','create','body','params','eml-format','rimraf','fast-json-patch','moment','bluebird','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','status','end','json','undefined','count','offset','limit','Content-Range','apply','reject','update','destroy','then','sendStatus','error','name','send','map','OpenchannelApplication','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields'];(function(_0x2c9a78,_0x10cb8f){var _0x50cd5f=function(_0x25cc1e){while(--_0x25cc1e){_0x2c9a78['push'](_0x2c9a78['shift']());}};_0x50cd5f(++_0x10cb8f);}(_0x3f83,0x92));var _0x33f8=function(_0x3a0f57,_0x4c4734){_0x3a0f57=_0x3a0f57-0x0;var _0x1d4f8d=_0x3f83[_0x3a0f57];return _0x1d4f8d;};'use strict';var emlformat=require(_0x33f8('0x0'));var rimraf=require(_0x33f8('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x33f8('0x2'));var rp=require('request-promise');var moment=require(_0x33f8('0x3'));var BPromise=require(_0x33f8('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x33f8('0x5'));var sox=require(_0x33f8('0x6'));var csv=require(_0x33f8('0x7'));var ejs=require(_0x33f8('0x8'));var fs=require('fs');var fs_extra=require(_0x33f8('0x9'));var _=require('lodash');var squel=require(_0x33f8('0xa'));var crypto=require(_0x33f8('0xb'));var jsforce=require(_0x33f8('0xc'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x33f8('0xd'));var Redis=require(_0x33f8('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x33f8('0xf'));var hardwareService=require(_0x33f8('0x10'));var logger=require(_0x33f8('0x11'))(_0x33f8('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x33f8('0x13'));var db=require(_0x33f8('0x14'))['db'];function respondWithStatusCode(_0x202aa9,_0x5da4b4){_0x5da4b4=_0x5da4b4||0xcc;return function(_0x341e92){if(_0x341e92){return _0x202aa9['sendStatus'](_0x5da4b4);}return _0x202aa9[_0x33f8('0x15')](_0x5da4b4)[_0x33f8('0x16')]();};}function respondWithResult(_0x3f8753,_0x406bd6){_0x406bd6=_0x406bd6||0xc8;return function(_0x307c7e){if(_0x307c7e){return _0x3f8753[_0x33f8('0x15')](_0x406bd6)[_0x33f8('0x17')](_0x307c7e);}};}function respondWithFilteredResult(_0x17f8e,_0x3eaf72){return function(_0x4291cc){if(_0x4291cc){var _0x6198e6=typeof _0x3eaf72['offset']===_0x33f8('0x18')&&typeof _0x3eaf72['limit']===_0x33f8('0x18');var _0x268471=_0x4291cc[_0x33f8('0x19')];var _0x11a535=_0x6198e6?0x0:_0x3eaf72[_0x33f8('0x1a')];var _0x13eba8=_0x6198e6?_0x4291cc[_0x33f8('0x19')]:_0x3eaf72[_0x33f8('0x1a')]+_0x3eaf72[_0x33f8('0x1b')];var _0x1daea4;if(_0x13eba8>=_0x268471){_0x13eba8=_0x268471;_0x1daea4=0xc8;}else{_0x1daea4=0xce;}_0x17f8e[_0x33f8('0x15')](_0x1daea4);return _0x17f8e['set'](_0x33f8('0x1c'),_0x11a535+'-'+_0x13eba8+'/'+_0x268471)[_0x33f8('0x17')](_0x4291cc);}return null;};}function patchUpdates(_0x266101){return function(_0x442bd5){try{jsonpatch[_0x33f8('0x1d')](_0x442bd5,_0x266101,!![]);}catch(_0x4787cb){return BPromise[_0x33f8('0x1e')](_0x4787cb);}return _0x442bd5['save']();};}function saveUpdates(_0x4af4f4,_0x55e209){return function(_0x1e7805){if(_0x1e7805){return _0x1e7805[_0x33f8('0x1f')](_0x4af4f4)['then'](function(_0xb1ea5f){return _0xb1ea5f;});}return null;};}function removeEntity(_0x2f89aa,_0x2b4b84){return function(_0x436db2){if(_0x436db2){return _0x436db2[_0x33f8('0x20')]()[_0x33f8('0x21')](function(){_0x2f89aa[_0x33f8('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x3593ba,_0x1d5ad4){return function(_0x59e100){if(!_0x59e100){_0x3593ba[_0x33f8('0x22')](0x194);}return _0x59e100;};}function handleError(_0x29564f,_0x1e3dda){_0x1e3dda=_0x1e3dda||0x1f4;return function(_0x594839){logger[_0x33f8('0x23')](_0x594839['stack']);if(_0x594839[_0x33f8('0x24')]){delete _0x594839[_0x33f8('0x24')];}_0x29564f[_0x33f8('0x15')](_0x1e3dda)[_0x33f8('0x25')](_0x594839);};}exports['index']=function(_0x14f194,_0x23baa8){var _0x53535c={},_0x29954f={},_0x4c2f24={'count':0x0,'rows':[]};var _0x1f1555=_[_0x33f8('0x26')](db[_0x33f8('0x27')][_0x33f8('0x28')],function(_0x2baded){return{'name':_0x2baded['fieldName'],'type':_0x2baded[_0x33f8('0x29')][_0x33f8('0x2a')]};});_0x29954f[_0x33f8('0x2b')]=_['map'](_0x1f1555,_0x33f8('0x24'));_0x29954f['query']=_[_0x33f8('0x2c')](_0x14f194['query']);_0x29954f[_0x33f8('0x2d')]=_[_0x33f8('0x2e')](_0x29954f[_0x33f8('0x2b')],_0x29954f['query']);_0x53535c[_0x33f8('0x2f')]=_[_0x33f8('0x2e')](_0x29954f[_0x33f8('0x2b')],qs[_0x33f8('0x30')](_0x14f194[_0x33f8('0x31')][_0x33f8('0x30')]));_0x53535c[_0x33f8('0x2f')]=_0x53535c[_0x33f8('0x2f')][_0x33f8('0x32')]?_0x53535c[_0x33f8('0x2f')]:_0x29954f[_0x33f8('0x2b')];if(!_0x14f194[_0x33f8('0x31')]['hasOwnProperty'](_0x33f8('0x33'))){_0x53535c['limit']=qs[_0x33f8('0x1b')](_0x14f194[_0x33f8('0x31')][_0x33f8('0x1b')]);_0x53535c[_0x33f8('0x1a')]=qs[_0x33f8('0x1a')](_0x14f194[_0x33f8('0x31')][_0x33f8('0x1a')]);}_0x53535c['order']=qs[_0x33f8('0x34')](_0x14f194[_0x33f8('0x31')][_0x33f8('0x34')]);_0x53535c[_0x33f8('0x35')]=qs[_0x33f8('0x2d')](_['pick'](_0x14f194['query'],_0x29954f[_0x33f8('0x2d')]),_0x1f1555);if(_0x14f194[_0x33f8('0x31')]['filter']){_0x53535c[_0x33f8('0x35')]=_[_0x33f8('0x36')](_0x53535c[_0x33f8('0x35')],{'$or':_[_0x33f8('0x26')](_0x1f1555,function(_0x10567f){if(_0x10567f[_0x33f8('0x29')]!=='VIRTUAL'){var _0x45e213={};_0x45e213[_0x10567f['name']]={'$like':'%'+_0x14f194[_0x33f8('0x31')][_0x33f8('0x37')]+'%'};return _0x45e213;}})});}_0x53535c=_[_0x33f8('0x36')]({},_0x53535c,_0x14f194[_0x33f8('0x38')]);var _0x1ff665={'where':_0x53535c[_0x33f8('0x35')]};return db[_0x33f8('0x27')][_0x33f8('0x19')](_0x1ff665)[_0x33f8('0x21')](function(_0x204814){_0x4c2f24[_0x33f8('0x19')]=_0x204814;if(_0x14f194[_0x33f8('0x31')][_0x33f8('0x39')]){_0x53535c[_0x33f8('0x3a')]=[{'all':!![]}];}return db[_0x33f8('0x27')]['findAll'](_0x53535c);})[_0x33f8('0x21')](function(_0x5296f5){_0x4c2f24['rows']=_0x5296f5;return _0x4c2f24;})[_0x33f8('0x21')](respondWithFilteredResult(_0x23baa8,_0x53535c))['catch'](handleError(_0x23baa8,null));};exports[_0x33f8('0x3b')]=function(_0x5cc90f,_0x2f5dc7){var _0x441a73={'raw':!![],'where':{'id':_0x5cc90f['params']['id']}},_0x51419e={};_0x51419e[_0x33f8('0x2b')]=_['keys'](db[_0x33f8('0x27')][_0x33f8('0x28')]);_0x51419e[_0x33f8('0x31')]=_[_0x33f8('0x2c')](_0x5cc90f['query']);_0x51419e['filters']=_[_0x33f8('0x2e')](_0x51419e[_0x33f8('0x2b')],_0x51419e[_0x33f8('0x31')]);_0x441a73[_0x33f8('0x2f')]=_['intersection'](_0x51419e[_0x33f8('0x2b')],qs['fields'](_0x5cc90f['query'][_0x33f8('0x30')]));_0x441a73[_0x33f8('0x2f')]=_0x441a73[_0x33f8('0x2f')][_0x33f8('0x32')]?_0x441a73['attributes']:_0x51419e[_0x33f8('0x2b')];if(_0x5cc90f[_0x33f8('0x31')]['includeAll']){_0x441a73['include']=[{'all':!![]}];}_0x441a73=_[_0x33f8('0x36')]({},_0x441a73,_0x5cc90f[_0x33f8('0x38')]);return db['OpenchannelApplication'][_0x33f8('0x3c')](_0x441a73)[_0x33f8('0x21')](handleEntityNotFound(_0x2f5dc7,null))[_0x33f8('0x21')](respondWithResult(_0x2f5dc7,null))[_0x33f8('0x3d')](handleError(_0x2f5dc7,null));};exports[_0x33f8('0x3e')]=function(_0x88948c,_0x441b32){return db[_0x33f8('0x27')][_0x33f8('0x3e')](_0x88948c[_0x33f8('0x3f')],{})[_0x33f8('0x21')](respondWithResult(_0x441b32,0xc9))[_0x33f8('0x3d')](handleError(_0x441b32,null));};exports['update']=function(_0x967482,_0xeaac66){if(_0x967482['body']['id']){delete _0x967482['body']['id'];}return db['OpenchannelApplication'][_0x33f8('0x3c')]({'where':{'id':_0x967482[_0x33f8('0x40')]['id']}})[_0x33f8('0x21')](handleEntityNotFound(_0xeaac66,null))[_0x33f8('0x21')](saveUpdates(_0x967482[_0x33f8('0x3f')],null))[_0x33f8('0x21')](respondWithResult(_0xeaac66,null))['catch'](handleError(_0xeaac66,null));};exports['destroy']=function(_0x1bda26,_0x4e3f8b){return db[_0x33f8('0x27')][_0x33f8('0x3c')]({'where':{'id':_0x1bda26[_0x33f8('0x40')]['id']}})[_0x33f8('0x21')](handleEntityNotFound(_0x4e3f8b,null))[_0x33f8('0x21')](removeEntity(_0x4e3f8b,null))[_0x33f8('0x3d')](handleError(_0x4e3f8b,null));}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.model.js b/server/api/openchannelApplication/openchannelApplication.model.js index ef9287b..a8ad9b2 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 _0xd7e8=['path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','OpenchannelApplication','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x296897,_0x4d23ea){var _0x2b44ab=function(_0xdf90d8){while(--_0xdf90d8){_0x296897['push'](_0x296897['shift']());}};_0x2b44ab(++_0x4d23ea);}(_0xd7e8,0xba));var _0x8d7e=function(_0x52440f,_0x50868d){_0x52440f=_0x52440f-0x0;var _0x3c760b=_0xd7e8[_0x52440f];return _0x3c760b;};'use strict';var _=require(_0x8d7e('0x0'));var util=require(_0x8d7e('0x1'));var logger=require(_0x8d7e('0x2'))('api');var moment=require(_0x8d7e('0x3'));var BPromise=require(_0x8d7e('0x4'));var rp=require(_0x8d7e('0x5'));var fs=require('fs');var path=require(_0x8d7e('0x6'));var rimraf=require(_0x8d7e('0x7'));var config=require(_0x8d7e('0x8'));var attributes=require(_0x8d7e('0x9'));module[_0x8d7e('0xa')]=function(_0x4fbe13,_0x1a54d3){return _0x4fbe13[_0x8d7e('0xb')](_0x8d7e('0xc'),attributes,{'tableName':_0x8d7e('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x8d7e('0xe'),'collate':_0x8d7e('0xf')});}; \ No newline at end of file +var _0x72c3=['api','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelApplication.attributes','exports','define','openchannel_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger'];(function(_0x2b799f,_0x312ff8){var _0x39cb72=function(_0x234dab){while(--_0x234dab){_0x2b799f['push'](_0x2b799f['shift']());}};_0x39cb72(++_0x312ff8);}(_0x72c3,0xcf));var _0x372c=function(_0x4d1eef,_0xb9c2dc){_0x4d1eef=_0x4d1eef-0x0;var _0x7176c6=_0x72c3[_0x4d1eef];return _0x7176c6;};'use strict';var _=require(_0x372c('0x0'));var util=require(_0x372c('0x1'));var logger=require(_0x372c('0x2'))(_0x372c('0x3'));var moment=require('moment');var BPromise=require(_0x372c('0x4'));var rp=require(_0x372c('0x5'));var fs=require('fs');var path=require(_0x372c('0x6'));var rimraf=require(_0x372c('0x7'));var config=require(_0x372c('0x8'));var attributes=require(_0x372c('0x9'));module[_0x372c('0xa')]=function(_0x5e87de,_0x28610f){return _0x5e87de[_0x372c('0xb')]('OpenchannelApplication',attributes,{'tableName':_0x372c('0xc'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x372c('0xd'),'collate':_0x372c('0xe')});}; \ No newline at end of file diff --git a/server/api/openchannelApplication/openchannelApplication.rpc.js b/server/api/openchannelApplication/openchannelApplication.rpc.js index cec0071..b11b5c2 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 _0x2451=['../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','debug','OpenchannelApplication,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','update','body','options','raw','attributes','limit','UpdateOpenchannelApplication','catch','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1cd715,_0x17f636){var _0x1e60b6=function(_0x47ac27){while(--_0x47ac27){_0x1cd715['push'](_0x1cd715['shift']());}};_0x1e60b6(++_0x17f636);}(_0x2451,0x191));var _0x1245=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x2451[_0x30ae5e];return _0x1f2e93;};'use strict';var _=require('lodash');var util=require(_0x1245('0x0'));var moment=require(_0x1245('0x1'));var BPromise=require(_0x1245('0x2'));var rs=require(_0x1245('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1245('0x4'))['db'];var utils=require(_0x1245('0x5'));var logger=require('../../config/logger')(_0x1245('0x6'));var config=require(_0x1245('0x7'));var jayson=require(_0x1245('0x8'));var client=jayson[_0x1245('0x9')][_0x1245('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x189a13,_0x49a999,_0x40d900){return new BPromise(function(_0xf0a65e,_0x56b91d){return client['request'](_0x189a13,_0x40d900)[_0x1245('0xb')](function(_0x48afdf){logger['info'](_0x1245('0xc'),_0x49a999,_0x1245('0xd'));logger[_0x1245('0xe')](_0x1245('0xf'),_0x49a999,_0x1245('0xd'),JSON[_0x1245('0x10')](_0x48afdf));if(_0x48afdf[_0x1245('0x11')]){if(_0x48afdf[_0x1245('0x11')]['code']===0x1f4){logger[_0x1245('0x11')](_0x1245('0xc'),_0x49a999,_0x48afdf[_0x1245('0x11')][_0x1245('0x12')]);return _0x56b91d(_0x48afdf['error'][_0x1245('0x12')]);}logger[_0x1245('0x11')](_0x1245('0xc'),_0x49a999,_0x48afdf['error'][_0x1245('0x12')]);return _0xf0a65e(_0x48afdf[_0x1245('0x11')][_0x1245('0x12')]);}else{logger[_0x1245('0x13')](_0x1245('0xc'),_0x49a999,_0x1245('0xd'));_0xf0a65e(_0x48afdf[_0x1245('0x14')][_0x1245('0x12')]);}})['catch'](function(_0x64ecbd){logger['error'](_0x1245('0xc'),_0x49a999,_0x64ecbd);_0x56b91d(_0x64ecbd);});});}exports['UpdateOpenchannelApplication']=function(_0x314c94){var _0x17ff90=this;return new Promise(function(_0x160b34,_0x3268bc){return db['OpenchannelApplication'][_0x1245('0x15')](_0x314c94[_0x1245('0x16')],{'raw':_0x314c94['options']?_0x314c94[_0x1245('0x17')][_0x1245('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x314c94[_0x1245('0x17')]?_0x314c94[_0x1245('0x17')]['where']||null:null,'attributes':_0x314c94[_0x1245('0x17')]?_0x314c94['options'][_0x1245('0x19')]||null:null,'limit':_0x314c94[_0x1245('0x17')]?_0x314c94['options'][_0x1245('0x1a')]||null:null})[_0x1245('0xb')](function(_0xe7618f){logger[_0x1245('0x13')]('UpdateOpenchannelApplication',_0x314c94);logger[_0x1245('0xe')](_0x1245('0x1b'),_0x314c94,JSON[_0x1245('0x10')](_0xe7618f));_0x160b34(_0xe7618f);})[_0x1245('0x1c')](function(_0x4cb48b){logger['error'](_0x1245('0x1b'),_0x4cb48b[_0x1245('0x12')],_0x314c94);_0x3268bc(_0x17ff90[_0x1245('0x11')](0x1f4,_0x4cb48b[_0x1245('0x12')]));});});}; \ No newline at end of file +var _0x29f3=['moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelApplication,\x20%s,\x20%s','request\x20sent','OpenchannelApplication,\x20%s,\x20%s,\x20%s','code','error','message','UpdateOpenchannelApplication','OpenchannelApplication','options','limit','debug','catch','util'];(function(_0x23e5d2,_0x415e7a){var _0x51ee49=function(_0x2cc5fd){while(--_0x2cc5fd){_0x23e5d2['push'](_0x23e5d2['shift']());}};_0x51ee49(++_0x415e7a);}(_0x29f3,0x6b));var _0x329f=function(_0x1220f2,_0x3cf5d5){_0x1220f2=_0x1220f2-0x0;var _0x409d1c=_0x29f3[_0x1220f2];return _0x409d1c;};'use strict';var _=require('lodash');var util=require(_0x329f('0x0'));var moment=require(_0x329f('0x1'));var BPromise=require('bluebird');var rs=require(_0x329f('0x2'));var fs=require('fs');var Redis=require(_0x329f('0x3'));var db=require(_0x329f('0x4'))['db'];var utils=require(_0x329f('0x5'));var logger=require(_0x329f('0x6'))(_0x329f('0x7'));var config=require(_0x329f('0x8'));var jayson=require(_0x329f('0x9'));var client=jayson[_0x329f('0xa')][_0x329f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4ba002,_0x511f0b,_0x5b0563){return new BPromise(function(_0x54a155,_0x1563d8){return client[_0x329f('0xc')](_0x4ba002,_0x5b0563)[_0x329f('0xd')](function(_0x3eb223){logger[_0x329f('0xe')](_0x329f('0xf'),_0x511f0b,_0x329f('0x10'));logger['debug'](_0x329f('0x11'),_0x511f0b,_0x329f('0x10'),JSON['stringify'](_0x3eb223));if(_0x3eb223['error']){if(_0x3eb223['error'][_0x329f('0x12')]===0x1f4){logger[_0x329f('0x13')](_0x329f('0xf'),_0x511f0b,_0x3eb223[_0x329f('0x13')][_0x329f('0x14')]);return _0x1563d8(_0x3eb223[_0x329f('0x13')][_0x329f('0x14')]);}logger['error'](_0x329f('0xf'),_0x511f0b,_0x3eb223[_0x329f('0x13')][_0x329f('0x14')]);return _0x54a155(_0x3eb223[_0x329f('0x13')][_0x329f('0x14')]);}else{logger[_0x329f('0xe')](_0x329f('0xf'),_0x511f0b,_0x329f('0x10'));_0x54a155(_0x3eb223['result'][_0x329f('0x14')]);}})['catch'](function(_0x45a732){logger[_0x329f('0x13')](_0x329f('0xf'),_0x511f0b,_0x45a732);_0x1563d8(_0x45a732);});});}exports[_0x329f('0x15')]=function(_0x416e92){var _0x57ee9b=this;return new Promise(function(_0xf58bb2,_0x2a2609){return db[_0x329f('0x16')]['update'](_0x416e92['body'],{'raw':_0x416e92[_0x329f('0x17')]?_0x416e92[_0x329f('0x17')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x416e92['options']?_0x416e92[_0x329f('0x17')]['where']||null:null,'attributes':_0x416e92['options']?_0x416e92['options']['attributes']||null:null,'limit':_0x416e92[_0x329f('0x17')]?_0x416e92[_0x329f('0x17')][_0x329f('0x18')]||null:null})[_0x329f('0xd')](function(_0x4788d1){logger[_0x329f('0xe')](_0x329f('0x15'),_0x416e92);logger[_0x329f('0x19')](_0x329f('0x15'),_0x416e92,JSON['stringify'](_0x4788d1));_0xf58bb2(_0x4788d1);})[_0x329f('0x1a')](function(_0x69d417){logger[_0x329f('0x13')]('UpdateOpenchannelApplication',_0x69d417[_0x329f('0x14')],_0x416e92);_0x2a2609(_0x57ee9b[_0x329f('0x13')](0x1f4,_0x69d417[_0x329f('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/index.js b/server/api/openchannelInteraction/index.js index 5bc0b47..58da283 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 _0x8cdf=['update','delete','openchannelinteraction:destroy','destroy','removeTags','exports','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelInteraction.controller','get','isAuthenticated','index','/describe','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:addtags','addTags','put','openchannelinteraction:update'];(function(_0x5317b5,_0x4dfd6e){var _0x3b7ce2=function(_0xc146d6){while(--_0xc146d6){_0x5317b5['push'](_0x5317b5['shift']());}};_0x3b7ce2(++_0x4dfd6e);}(_0x8cdf,0x16e));var _0xf8cd=function(_0x5f55da,_0x561ccc){_0x5f55da=_0x5f55da-0x0;var _0x53b511=_0x8cdf[_0x5f55da];return _0x53b511;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xf8cd('0x0'));var express=require(_0xf8cd('0x1'));var router=express[_0xf8cd('0x2')]();var fs_extra=require(_0xf8cd('0x3'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xf8cd('0x4'));var controller=require(_0xf8cd('0x5'));router[_0xf8cd('0x6')]('/',auth[_0xf8cd('0x7')](),controller[_0xf8cd('0x8')]);router[_0xf8cd('0x6')](_0xf8cd('0x9'),auth[_0xf8cd('0x7')](),controller['describe']);router[_0xf8cd('0x6')](_0xf8cd('0xa'),auth[_0xf8cd('0x7')](),controller['show']);router[_0xf8cd('0x6')](_0xf8cd('0xb'),auth[_0xf8cd('0x7')](),controller[_0xf8cd('0xc')]);router['get'](_0xf8cd('0xd'),auth[_0xf8cd('0x7')](),controller[_0xf8cd('0xe')]);router[_0xf8cd('0xf')]('/',auth[_0xf8cd('0x7')](),controller['create']);router[_0xf8cd('0xf')](_0xf8cd('0xb'),auth['isAuthenticated'](),controller[_0xf8cd('0x10')]);router['post'](_0xf8cd('0x11'),auth[_0xf8cd('0x7')](),interaction[_0xf8cd('0x12')](_0xf8cd('0x13'),_0xf8cd('0x14')),controller[_0xf8cd('0x15')]);router[_0xf8cd('0x16')](_0xf8cd('0xa'),auth[_0xf8cd('0x7')](),interaction[_0xf8cd('0x12')](_0xf8cd('0x13'),_0xf8cd('0x17')),controller[_0xf8cd('0x18')]);router[_0xf8cd('0x19')](_0xf8cd('0xa'),auth['isAuthenticated'](),interaction[_0xf8cd('0x12')](_0xf8cd('0x13'),_0xf8cd('0x1a')),controller[_0xf8cd('0x1b')]);router['delete'](_0xf8cd('0x11'),auth[_0xf8cd('0x7')](),controller[_0xf8cd('0x1c')]);module[_0xf8cd('0x1d')]=router; \ No newline at end of file +var _0xa829=['post','/:id/messages','addMessage','/:id/tags','tracked','openchannel','openchannelinteraction:update','update','delete','removeTags','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/describe','describe','/:id','isAuthenticated','show','getMessages','download'];(function(_0xc4aa6a,_0x35ec2c){var _0x53d6cf=function(_0x1515f5){while(--_0x1515f5){_0xc4aa6a['push'](_0xc4aa6a['shift']());}};_0x53d6cf(++_0x35ec2c);}(_0xa829,0x1af));var _0x9a82=function(_0x472032,_0x2784cb){_0x472032=_0x472032-0x0;var _0x257c7b=_0xa829[_0x472032];return _0x257c7b;};'use strict';var multer=require(_0x9a82('0x0'));var util=require('util');var path=require(_0x9a82('0x1'));var timeout=require(_0x9a82('0x2'));var express=require(_0x9a82('0x3'));var router=express[_0x9a82('0x4')]();var fs_extra=require(_0x9a82('0x5'));var auth=require(_0x9a82('0x6'));var interaction=require(_0x9a82('0x7'));var config=require(_0x9a82('0x8'));var controller=require('./openchannelInteraction.controller');router[_0x9a82('0x9')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x9a82('0xa'),auth['isAuthenticated'](),controller[_0x9a82('0xb')]);router[_0x9a82('0x9')](_0x9a82('0xc'),auth[_0x9a82('0xd')](),controller[_0x9a82('0xe')]);router[_0x9a82('0x9')]('/:id/messages',auth[_0x9a82('0xd')](),controller[_0x9a82('0xf')]);router['get']('/:id/download',auth['isAuthenticated'](),controller[_0x9a82('0x10')]);router[_0x9a82('0x11')]('/',auth[_0x9a82('0xd')](),controller['create']);router[_0x9a82('0x11')](_0x9a82('0x12'),auth[_0x9a82('0xd')](),controller[_0x9a82('0x13')]);router['post'](_0x9a82('0x14'),auth[_0x9a82('0xd')](),interaction[_0x9a82('0x15')](_0x9a82('0x16'),'openchannelinteraction:addtags'),controller['addTags']);router['put'](_0x9a82('0xc'),auth[_0x9a82('0xd')](),interaction[_0x9a82('0x15')](_0x9a82('0x16'),_0x9a82('0x17')),controller[_0x9a82('0x18')]);router[_0x9a82('0x19')](_0x9a82('0xc'),auth[_0x9a82('0xd')](),interaction[_0x9a82('0x15')](_0x9a82('0x16'),'openchannelinteraction:destroy'),controller['destroy']);router[_0x9a82('0x19')]('/:id/tags',auth[_0x9a82('0xd')](),controller[_0x9a82('0x1a')]);module[_0x9a82('0x1b')]=router; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.attributes.js b/server/api/openchannelInteraction/openchannelInteraction.attributes.js index 9e2b354..7dee2a6 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 _0xbdeb=['ENUM','out','BOOLEAN','exports','DATE','STRING'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xbdeb,0x6f));var _0xbbde=function(_0x55cd06,_0x49cbdd){_0x55cd06=_0x55cd06-0x0;var _0x12b2b1=_0xbdeb[_0x55cd06];return _0x12b2b1;};'use strict';var Sequelize=require('sequelize');module[_0xbbde('0x0')]={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xbbde('0x1')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xbbde('0x2')]},'thirdDisposition':{'type':Sequelize[_0xbbde('0x2')]},'note':{'type':Sequelize[_0xbbde('0x2')]},'read1stAt':{'type':Sequelize[_0xbbde('0x1')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize['STRING']},'lastMsgAt':{'type':Sequelize[_0xbbde('0x1')]},'firstMsgDirection':{'type':Sequelize[_0xbbde('0x3')]('in',_0xbbde('0x4')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xbbde('0x3')]('in','out'),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize['STRING']},'autoreplyExecuted':{'type':Sequelize[_0xbbde('0x5')],'defaultValue':![]}}; \ No newline at end of file +var _0x1c4d=['STRING','ENUM','out','exports','BOOLEAN','DATE'];(function(_0x162c83,_0x125a02){var _0x3a8d4f=function(_0x159887){while(--_0x159887){_0x162c83['push'](_0x162c83['shift']());}};_0x3a8d4f(++_0x125a02);}(_0x1c4d,0x1d7));var _0xd1c4=function(_0x4d3cf6,_0x533fe5){_0x4d3cf6=_0x4d3cf6-0x0;var _0x1a13f9=_0x1c4d[_0x4d3cf6];return _0x1a13f9;};'use strict';var Sequelize=require('sequelize');module[_0xd1c4('0x0')]={'closed':{'type':Sequelize[_0xd1c4('0x1')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0xd1c4('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd1c4('0x3')]},'thirdDisposition':{'type':Sequelize[_0xd1c4('0x3')]},'note':{'type':Sequelize[_0xd1c4('0x3')]},'read1stAt':{'type':Sequelize[_0xd1c4('0x2')]},'threadId':{'type':Sequelize['STRING']},'externalUrl':{'type':Sequelize[_0xd1c4('0x3')]},'lastMsgAt':{'type':Sequelize['DATE']},'firstMsgDirection':{'type':Sequelize[_0xd1c4('0x4')]('in',_0xd1c4('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgDirection':{'type':Sequelize[_0xd1c4('0x4')]('in',_0xd1c4('0x5')),'defaultValue':'in','allowNull':![]},'from':{'type':Sequelize[_0xd1c4('0x3')]},'autoreplyExecuted':{'type':Sequelize[_0xd1c4('0x1')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.controller.js b/server/api/openchannelInteraction/openchannelInteraction.controller.js index 64d8dc7..25e4dec 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 _0xa5bf=['include','rows','addTags','setTags','spread','Tag','color','emit','openchannelInteractionTags:save','removeTags','download','unix','join','root','server','files','tmp','attachments','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','Messages','createdAt','secret','read','OpenchannelAccount','Account','Owner','get','N.A.','Public','existsSync','pipe','createWriteStream','basename','toString','direction','out','System','value','renderFile','views','transcript-','.pdf','Openchannel','createPdfFromHTML','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','moment','path','ejs','lodash','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','then','error','name','send','map','OpenchannelInteraction','rawAttributes','fieldName','type','key','findAll','openchannel','query','user','show','from','params','keys','filters','intersection','model','attributes','fields','includeAll','merge','options','find','catch','create','body','describe','addMessage','OpenchannelMessage','omit','ids','getMessages','findOne','length','hasOwnProperty','nolimit','order','sort','pick','where','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xc471d2,_0x26ab16){var _0x334c68=function(_0x2deae4){while(--_0x2deae4){_0xc471d2['push'](_0xc471d2['shift']());}};_0x334c68(++_0x26ab16);}(_0xa5bf,0xb4));var _0xfa5b=function(_0x4e1d03,_0x786f3a){_0x4e1d03=_0x4e1d03-0x0;var _0x362d4b=_0xa5bf[_0x4e1d03];return _0x362d4b;};'use strict';var rimraf=require('rimraf');var zipdir=require('zip-dir');var moment=require(_0xfa5b('0x0'));var util=require('util');var path=require(_0xfa5b('0x1'));var ejs=require(_0xfa5b('0x2'));var fs=require('fs');var _=require(_0xfa5b('0x3'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0xfa5b('0x4'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0xfa5b('0x5'));var config=require(_0xfa5b('0x6'));var db=require(_0xfa5b('0x7'))['db'];config[_0xfa5b('0x8')]=_[_0xfa5b('0x9')](config[_0xfa5b('0x8')],{'host':_0xfa5b('0xa'),'port':0x18eb});var socket=require(_0xfa5b('0xb'))(new Redis(config[_0xfa5b('0x8')]));require(_0xfa5b('0xc'))[_0xfa5b('0xd')](socket);function respondWithStatusCode(_0x395d7e,_0x530732){_0x530732=_0x530732||0xcc;return function(_0x10043f){if(_0x10043f){return _0x395d7e[_0xfa5b('0xe')](_0x530732);}return _0x395d7e[_0xfa5b('0xf')](_0x530732)[_0xfa5b('0x10')]();};}function respondWithResult(_0x4db865,_0x35fc84){_0x35fc84=_0x35fc84||0xc8;return function(_0x385f91){if(_0x385f91){return _0x4db865[_0xfa5b('0xf')](_0x35fc84)['json'](_0x385f91);}};}function respondWithFilteredResult(_0xb52bba,_0x4a4245){return function(_0x404a53){if(_0x404a53){var _0x1c3ffb=typeof _0x4a4245[_0xfa5b('0x11')]===_0xfa5b('0x12')&&typeof _0x4a4245[_0xfa5b('0x13')]===_0xfa5b('0x12');var _0x2a343f=_0x404a53[_0xfa5b('0x14')];var _0xc2e7e8=_0x1c3ffb?0x0:_0x4a4245['offset'];var _0x322461=_0x1c3ffb?_0x404a53[_0xfa5b('0x14')]:_0x4a4245[_0xfa5b('0x11')]+_0x4a4245['limit'];var _0x32818b;if(_0x322461>=_0x2a343f){_0x322461=_0x2a343f;_0x32818b=0xc8;}else{_0x32818b=0xce;}_0xb52bba[_0xfa5b('0xf')](_0x32818b);return _0xb52bba[_0xfa5b('0x15')](_0xfa5b('0x16'),_0xc2e7e8+'-'+_0x322461+'/'+_0x2a343f)[_0xfa5b('0x17')](_0x404a53);}return null;};}function saveUpdates(_0x2abdc3){return function(_0x10d9de){if(_0x10d9de){return _0x10d9de['update'](_0x2abdc3)['then'](function(_0x5d6bc7){return _0x5d6bc7;});}return null;};}function removeEntity(_0x5536e7){return function(_0x2413e6){if(_0x2413e6){return _0x2413e6[_0xfa5b('0x18')]()[_0xfa5b('0x19')](function(){_0x5536e7[_0xfa5b('0xf')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2b91b7){return function(_0x44eb4a){if(!_0x44eb4a){_0x2b91b7['sendStatus'](0x194);}return _0x44eb4a;};}function handleError(_0x42ece4,_0x4b10bd){_0x4b10bd=_0x4b10bd||0x1f4;return function(_0x52d7f8){logger[_0xfa5b('0x1a')](_0x52d7f8['stack']);if(_0x52d7f8[_0xfa5b('0x1b')]){delete _0x52d7f8[_0xfa5b('0x1b')];}_0x42ece4[_0xfa5b('0xf')](_0x4b10bd)[_0xfa5b('0x1c')](_0x52d7f8);};}exports['index']=function(_0x38d4d0,_0x56ef30){var _0x3e56fc={};var _0x109ad1=_[_0xfa5b('0x1d')](db[_0xfa5b('0x1e')][_0xfa5b('0x1f')],function(_0x5793b3){return{'name':_0x5793b3[_0xfa5b('0x20')],'type':_0x5793b3[_0xfa5b('0x21')][_0xfa5b('0x22')]};});_0x3e56fc=qs['getOptions'](_0x109ad1,_0x38d4d0);return interaction[_0xfa5b('0x23')](_0xfa5b('0x24'),_0x38d4d0[_0xfa5b('0x25')],_0x38d4d0[_0xfa5b('0x26')],_0x3e56fc,_0x109ad1)[_0xfa5b('0x19')](respondWithFilteredResult(_0x56ef30,_0x3e56fc))['catch'](handleError(_0x56ef30,null));};exports[_0xfa5b('0x27')]=function(_0x315b9e,_0x17e2ac){var _0x18d2bd={};if(_0x315b9e[_0xfa5b('0x25')][_0xfa5b('0x21')]&&_0x315b9e[_0xfa5b('0x25')][_0xfa5b('0x21')]===_0xfa5b('0x28')){_0x18d2bd[_0xfa5b('0x28')]=_0x315b9e[_0xfa5b('0x29')]['id'];}else{_0x18d2bd['id']=_0x315b9e[_0xfa5b('0x29')]['id'];}var _0x3b6c83={'raw':![],'where':_0x18d2bd},_0x28d828={};_0x28d828['model']=_[_0xfa5b('0x2a')](db[_0xfa5b('0x1e')][_0xfa5b('0x1f')]);_0x28d828[_0xfa5b('0x25')]=_['keys'](_0x315b9e[_0xfa5b('0x25')]);_0x28d828[_0xfa5b('0x2b')]=_[_0xfa5b('0x2c')](_0x28d828[_0xfa5b('0x2d')],_0x28d828[_0xfa5b('0x25')]);_0x3b6c83[_0xfa5b('0x2e')]=_[_0xfa5b('0x2c')](_0x28d828[_0xfa5b('0x2d')],qs[_0xfa5b('0x2f')](_0x315b9e['query']['fields']));_0x3b6c83[_0xfa5b('0x2e')]=_0x3b6c83[_0xfa5b('0x2e')]['length']?_0x3b6c83[_0xfa5b('0x2e')]:_0x28d828[_0xfa5b('0x2d')];if(_0x315b9e[_0xfa5b('0x25')][_0xfa5b('0x30')]){_0x3b6c83['include']=[{'all':!![]}];}_0x3b6c83=_[_0xfa5b('0x31')]({},_0x3b6c83,_0x315b9e[_0xfa5b('0x32')]);return db[_0xfa5b('0x1e')][_0xfa5b('0x33')](_0x3b6c83)['then'](handleEntityNotFound(_0x17e2ac,null))['then'](respondWithResult(_0x17e2ac,null))[_0xfa5b('0x34')](handleError(_0x17e2ac,null));};exports[_0xfa5b('0x35')]=function(_0xb8b9bb,_0x336910){return db[_0xfa5b('0x1e')][_0xfa5b('0x35')](_0xb8b9bb['body'],{})[_0xfa5b('0x19')](respondWithResult(_0x336910,0xc9))['catch'](handleError(_0x336910,null));};exports['update']=function(_0x54a4e9,_0x1ea65e){if(_0x54a4e9[_0xfa5b('0x36')]['id']){delete _0x54a4e9[_0xfa5b('0x36')]['id'];}return db[_0xfa5b('0x1e')][_0xfa5b('0x33')]({'where':{'id':_0x54a4e9['params']['id']}})['then'](handleEntityNotFound(_0x1ea65e,null))['then'](saveUpdates(_0x54a4e9[_0xfa5b('0x36')],null))[_0xfa5b('0x19')](respondWithResult(_0x1ea65e,null))[_0xfa5b('0x34')](handleError(_0x1ea65e,null));};exports['destroy']=function(_0x536c00,_0x37b329){return db[_0xfa5b('0x1e')][_0xfa5b('0x33')]({'where':{'id':_0x536c00[_0xfa5b('0x29')]['id']}})[_0xfa5b('0x19')](handleEntityNotFound(_0x37b329,null))['then'](removeEntity(_0x37b329,null))['catch'](handleError(_0x37b329,null));};exports[_0xfa5b('0x37')]=function(_0xae2ee9,_0x14c73b){return db[_0xfa5b('0x1e')]['describe']()[_0xfa5b('0x19')](respondWithResult(_0x14c73b,null))[_0xfa5b('0x34')](handleError(_0x14c73b,null));};exports[_0xfa5b('0x38')]=function(_0x13e14b,_0xc68a20){return db[_0xfa5b('0x39')][_0xfa5b('0x33')]({'where':{'id':_0x13e14b[_0xfa5b('0x29')]['id']}})[_0xfa5b('0x19')](handleEntityNotFound(_0xc68a20,null))[_0xfa5b('0x19')](function(_0x8bdd63){if(_0x8bdd63){return _0x8bdd63[_0xfa5b('0x38')](_0x13e14b[_0xfa5b('0x36')]['ids'],_[_0xfa5b('0x3a')](_0x13e14b[_0xfa5b('0x36')],[_0xfa5b('0x3b'),'id'])||{});}})[_0xfa5b('0x19')](respondWithResult(_0xc68a20,null))[_0xfa5b('0x34')](handleError(_0xc68a20,null));};exports[_0xfa5b('0x3c')]=function(_0x4d7028,_0x8c98a){var _0x374ed4={'raw':![],'where':{}};var _0x1ac42a={};var _0x36f0ca={'count':0x0,'rows':[]};return db[_0xfa5b('0x1e')][_0xfa5b('0x3d')]({'where':{'id':_0x4d7028[_0xfa5b('0x29')]['id']}})['then'](handleEntityNotFound(_0x8c98a,null))[_0xfa5b('0x19')](function(_0x25f35b){if(_0x25f35b){_0x1ac42a[_0xfa5b('0x2d')]=_[_0xfa5b('0x2a')](db[_0xfa5b('0x39')]['rawAttributes']);_0x1ac42a['query']=_['keys'](_0x4d7028['query']);_0x1ac42a[_0xfa5b('0x2b')]=_[_0xfa5b('0x2c')](_0x1ac42a['model'],_0x1ac42a[_0xfa5b('0x25')]);_0x374ed4['attributes']=_['intersection'](_0x1ac42a[_0xfa5b('0x2d')],qs[_0xfa5b('0x2f')](_0x4d7028['query'][_0xfa5b('0x2f')]));_0x374ed4['attributes']=_0x374ed4[_0xfa5b('0x2e')][_0xfa5b('0x3e')]?_0x374ed4[_0xfa5b('0x2e')]:_0x1ac42a[_0xfa5b('0x2d')];if(!_0x4d7028['query'][_0xfa5b('0x3f')](_0xfa5b('0x40'))){_0x374ed4[_0xfa5b('0x13')]=qs[_0xfa5b('0x13')](_0x4d7028[_0xfa5b('0x25')][_0xfa5b('0x13')]);_0x374ed4[_0xfa5b('0x11')]=qs['offset'](_0x4d7028[_0xfa5b('0x25')][_0xfa5b('0x11')]);}_0x374ed4[_0xfa5b('0x41')]=qs[_0xfa5b('0x42')](_0x4d7028[_0xfa5b('0x25')][_0xfa5b('0x42')]);_0x374ed4['where']=qs[_0xfa5b('0x2b')](_[_0xfa5b('0x43')](_0x4d7028[_0xfa5b('0x25')],_0x1ac42a['filters']));_0x374ed4[_0xfa5b('0x44')][_0xfa5b('0x45')]=_0x25f35b['id'];if(_0x4d7028['query']['filter']){_0x374ed4[_0xfa5b('0x44')]=_['merge'](_0x374ed4[_0xfa5b('0x44')],{'$or':_['map'](_0x374ed4[_0xfa5b('0x2e')],function(_0x2b82c9){var _0x86d2ff={};_0x86d2ff[_0x2b82c9]={'$like':'%'+_0x4d7028[_0xfa5b('0x25')][_0xfa5b('0x46')]+'%'};return _0x86d2ff;})});}if(_0x4d7028[_0xfa5b('0x25')][_0xfa5b('0x47')]){var _0x26a858=_0x4d7028[_0xfa5b('0x25')]['$gte']['split'](',');var _0x4acff1={};_0x4acff1[_0x26a858[0x0]]={'$gte':moment(_0x26a858[0x1])[_0xfa5b('0x48')](_0xfa5b('0x49'))};_0x374ed4[_0xfa5b('0x44')]=_[_0xfa5b('0x31')](_0x374ed4[_0xfa5b('0x44')],_0x4acff1);}_0x374ed4=_[_0xfa5b('0x31')]({},_0x374ed4,_0x4d7028[_0xfa5b('0x32')]);return db[_0xfa5b('0x39')][_0xfa5b('0x14')]({'where':_0x374ed4[_0xfa5b('0x44')]})[_0xfa5b('0x19')](function(_0x23e91a){_0x36f0ca['count']=_0x23e91a;if(_0x4d7028[_0xfa5b('0x25')]['includeAll']){_0x374ed4[_0xfa5b('0x4a')]=[{'all':!![]}];}return db[_0xfa5b('0x39')]['findAll'](_0x374ed4);})['then'](function(_0x13691f){_0x36f0ca[_0xfa5b('0x4b')]=_0x13691f;return _0x36f0ca;});}})[_0xfa5b('0x19')](respondWithFilteredResult(_0x8c98a,_0x374ed4))[_0xfa5b('0x34')](handleError(_0x8c98a,null));};exports[_0xfa5b('0x4c')]=function(_0x47034b,_0x2f74c2){return db[_0xfa5b('0x1e')][_0xfa5b('0x33')]({'where':{'id':_0x47034b[_0xfa5b('0x29')]['id']}})[_0xfa5b('0x19')](handleEntityNotFound(_0x2f74c2,null))[_0xfa5b('0x19')](function(_0x5bb80d){if(_0x5bb80d){return _0x5bb80d[_0xfa5b('0x4d')](_0x47034b[_0xfa5b('0x36')][_0xfa5b('0x3b')],_[_0xfa5b('0x3a')](_0x47034b[_0xfa5b('0x36')],[_0xfa5b('0x3b'),'id'])||{})[_0xfa5b('0x4e')](function(){return db[_0xfa5b('0x4f')][_0xfa5b('0x23')]({'attributes':['id','name',_0xfa5b('0x50')],'where':{'id':_0x47034b['body'][_0xfa5b('0x3b')]}});})[_0xfa5b('0x19')](function(_0x26ee77){socket[_0xfa5b('0x51')](_0xfa5b('0x52'),{'id':Number(_0x47034b[_0xfa5b('0x29')]['id']),'tags':_0x26ee77||[]});return{'id':Number(_0x47034b[_0xfa5b('0x29')]['id']),'tags':_0x26ee77||[]};});}})[_0xfa5b('0x19')](respondWithResult(_0x2f74c2,null))['catch'](handleError(_0x2f74c2,null));};exports[_0xfa5b('0x53')]=function(_0x2460d4,_0xd4ed38){return db[_0xfa5b('0x1e')][_0xfa5b('0x33')]({'where':{'id':_0x2460d4[_0xfa5b('0x29')]['id']}})[_0xfa5b('0x19')](handleEntityNotFound(_0xd4ed38,null))[_0xfa5b('0x19')](function(_0x5bc5b){if(_0x5bc5b){return _0x5bc5b['removeTags'](_0x2460d4[_0xfa5b('0x25')]['ids']);}})[_0xfa5b('0x19')](respondWithStatusCode(_0xd4ed38,null))['catch'](handleError(_0xd4ed38,null));};exports[_0xfa5b('0x54')]=function(_0x21092e,_0x1e1862){var _0x73f294=moment()[_0xfa5b('0x55')]()['toString']();var _0x4a127a=path[_0xfa5b('0x56')](config[_0xfa5b('0x57')],_0xfa5b('0x58'),_0xfa5b('0x59'),_0xfa5b('0x5a'));var _0x559082=path[_0xfa5b('0x56')](config[_0xfa5b('0x57')],'server',_0xfa5b('0x59'),_0xfa5b('0x5b'));var _0x4f4ed1=path[_0xfa5b('0x56')](_0x4a127a,_0x73f294);var _0x92ab77=util[_0xfa5b('0x48')]('transcript-%d-%s.zip',_0x21092e[_0xfa5b('0x29')]['id'],_0x73f294);var _0x335127=path[_0xfa5b('0x56')](_0x4a127a,_0x92ab77);var _0x446fab=[];_0x446fab[_0xfa5b('0x5c')]({'model':db[_0xfa5b('0x5d')],'as':'User','attributes':['id',_0xfa5b('0x5e')],'raw':!![]});_0x446fab[_0xfa5b('0x5c')]({'model':db[_0xfa5b('0x5f')],'as':_0xfa5b('0x60'),'attributes':['id',_0xfa5b('0x61'),_0xfa5b('0x62')],'raw':!![]});if(_0x21092e[_0xfa5b('0x25')][_0xfa5b('0x5b')]){_0x446fab['push']({'model':db[_0xfa5b('0x63')],'as':_0xfa5b('0x63'),'raw':!![]});}var _0x498e2a=[{'model':db['OpenchannelMessage'],'as':_0xfa5b('0x64'),'attributes':['id',_0xfa5b('0x36'),_0xfa5b('0x65'),'direction',_0xfa5b('0x66'),_0xfa5b('0x67')],'include':_0x446fab}];_0x498e2a[_0xfa5b('0x5c')]({'model':db[_0xfa5b('0x68')],'as':_0xfa5b('0x69'),'attributes':['id',_0xfa5b('0x1b')]});_0x498e2a[_0xfa5b('0x5c')]({'model':db[_0xfa5b('0x5d')],'as':_0xfa5b('0x6a'),'attributes':['id',_0xfa5b('0x5e')]});return db['OpenchannelInteraction'][_0xfa5b('0x33')]({'where':{'id':_0x21092e[_0xfa5b('0x29')]['id']},'include':_0x498e2a})[_0xfa5b('0x19')](handleEntityNotFound(_0x1e1862,null))[_0xfa5b('0x19')](function(_0x542f59){if(_0x542f59){var _0x424d4a=_0x542f59[_0xfa5b('0x6b')]({'plain':!![]});fs['mkdirSync'](_0x4f4ed1);var _0x2caca5={'channel':'Openchannel','account':_0x424d4a[_0xfa5b('0x69')][_0xfa5b('0x1b')],'agent':_0x424d4a[_0xfa5b('0x6a')]?_0x424d4a[_0xfa5b('0x6a')][_0xfa5b('0x5e')]:_0xfa5b('0x6c'),'createdAt':moment(_0x424d4a['createdAt'])['format'](_0xfa5b('0x49'))['toString'](),'closedAt':_0x424d4a['closed']?moment(_0x424d4a['closedAt'])[_0xfa5b('0x48')]('YYYY-MM-DD\x20HH:mm:ss')['toString']():'','disposition':_0x424d4a['disposition'],'visibility':_0x424d4a['threadId']?_0xfa5b('0x6d'):'Private','messages':_(_0x424d4a[_0xfa5b('0x64')])['filter']({'secret':![]})[_0xfa5b('0x1d')](function(_0x447264){if(_0x447264[_0xfa5b('0x63')]){var _0xe67650=path['join'](_0x559082,_0x447264[_0xfa5b('0x63')]['basename']);if(fs[_0xfa5b('0x6e')](_0xe67650)){fs['createReadStream'](_0xe67650)[_0xfa5b('0x6f')](fs[_0xfa5b('0x70')](path[_0xfa5b('0x56')](_0x4f4ed1,_0x447264[_0xfa5b('0x63')][_0xfa5b('0x71')])));}}return{'date':moment(_0x447264[_0xfa5b('0x65')])[_0xfa5b('0x48')](_0xfa5b('0x49'))[_0xfa5b('0x72')](),'sender':_0x447264[_0xfa5b('0x73')]===_0xfa5b('0x74')?_0x447264['User']?_0x447264[_0xfa5b('0x5d')]['fullname']:_0xfa5b('0x75'):_0x447264[_0xfa5b('0x60')]['firstName']+(_0x447264[_0xfa5b('0x60')][_0xfa5b('0x62')]?'\x20'+_0x447264[_0xfa5b('0x60')][_0xfa5b('0x62')]:''),'body':_0x447264[_0xfa5b('0x63')]?_0x447264[_0xfa5b('0x63')][_0xfa5b('0x71')]:_0x447264[_0xfa5b('0x36')],'direction':_0x447264[_0xfa5b('0x73')]==='out'?'A':'C','secret':_0x447264[_0xfa5b('0x66')],'read':_0x447264[_0xfa5b('0x67')],'attachment':_0x447264[_0xfa5b('0x63')]};})[_0xfa5b('0x76')]()};return ejs[_0xfa5b('0x77')](path[_0xfa5b('0x56')](config[_0xfa5b('0x57')],_0xfa5b('0x58'),_0xfa5b('0x78'),'downloadInteraction.ejs'),{'interaction':_0x2caca5})[_0xfa5b('0x19')](function(_0x490ade){var _0x488748=path['join'](_0x4f4ed1,_0xfa5b('0x79')+_0x424d4a['id']+'-'+_0x73f294+_0xfa5b('0x7a'));var _0x181cc0={'path':_0x488748,'channel':_0xfa5b('0x7b'),'interactionId':_0x424d4a['id']};return pdf[_0xfa5b('0x7c')](_0x490ade,_0x181cc0);})[_0xfa5b('0x19')](function(){return new Promise(function(_0x4b89a5,_0x38def7){zipdir(_0x4f4ed1,{'saveTo':_0x335127},function(_0x567e1c,_0x3f4bc2){if(_0x567e1c)return _0x38def7(_0x567e1c);return _0x4b89a5(_0x3f4bc2);});})[_0xfa5b('0x19')](function(){return new Promise(function(_0x32e16b,_0x54bee2){rimraf(_0x4f4ed1,function(_0x40ecce){if(_0x40ecce)_0x54bee2(_0x40ecce);return _0x32e16b();});});})[_0xfa5b('0x19')](function(){return _0x1e1862['download'](_0x335127,_0x92ab77,function(_0x85b13c){if(_0x85b13c){logger[_0xfa5b('0x1a')](_0xfa5b('0x7d'),_0x85b13c);}else{fs[_0xfa5b('0x7e')](_0x335127);}});});});}else{return _0x1e1862[_0xfa5b('0xe')](0xc8);}})[_0xfa5b('0x34')](handleError(_0x1e1862,null));}; \ No newline at end of file +var _0x2544=['Contact','firstName','lastName','Attachment','Messages','createdAt','direction','OpenchannelAccount','Account','mkdirSync','Openchannel','Owner','N.A.','toString','closed','disposition','threadId','Public','Private','createReadStream','basename','System','out','secret','read','value','renderFile','transcript-','createPdfFromHTML','error','Unable\x20to\x20delete\x20zip\x20file','unlinkSync','rimraf','moment','util','path','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelInteraction.socket','register','sendStatus','status','json','offset','undefined','limit','count','set','update','then','destroy','end','stack','name','send','map','fieldName','type','findAll','openchannel','query','user','show','params','keys','rawAttributes','model','intersection','fields','length','attributes','includeAll','include','merge','options','OpenchannelInteraction','find','catch','create','body','describe','addMessage','OpenchannelMessage','ids','omit','getMessages','findOne','filters','nolimit','order','sort','where','pick','OpenchannelInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','setTags','spread','color','emit','removeTags','join','root','server','files','tmp','attachments','User','fullname','push','CmContact'];(function(_0x4cfc1d,_0x2c0927){var _0x1c01a0=function(_0x264a74){while(--_0x264a74){_0x4cfc1d['push'](_0x4cfc1d['shift']());}};_0x1c01a0(++_0x2c0927);}(_0x2544,0x18e));var _0x4254=function(_0x2a4c46,_0x38e4a4){_0x2a4c46=_0x2a4c46-0x0;var _0x130ff7=_0x2544[_0x2a4c46];return _0x130ff7;};'use strict';var rimraf=require(_0x4254('0x0'));var zipdir=require('zip-dir');var moment=require(_0x4254('0x1'));var util=require(_0x4254('0x2'));var path=require(_0x4254('0x3'));var ejs=require(_0x4254('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x4254('0x5'));var interaction=require(_0x4254('0x6'));var qs=require(_0x4254('0x7'));var pdf=require('../../components/export/pdf');var logger=require('../../config/logger')(_0x4254('0x8'));var config=require(_0x4254('0x9'));var db=require(_0x4254('0xa'))['db'];config[_0x4254('0xb')]=_[_0x4254('0xc')](config[_0x4254('0xb')],{'host':_0x4254('0xd'),'port':0x18eb});var socket=require(_0x4254('0xe'))(new Redis(config[_0x4254('0xb')]));require(_0x4254('0xf'))[_0x4254('0x10')](socket);function respondWithStatusCode(_0x5c045e,_0x122052){_0x122052=_0x122052||0xcc;return function(_0x55c11b){if(_0x55c11b){return _0x5c045e[_0x4254('0x11')](_0x122052);}return _0x5c045e['status'](_0x122052)['end']();};}function respondWithResult(_0x5e1640,_0x231ec3){_0x231ec3=_0x231ec3||0xc8;return function(_0x13dff2){if(_0x13dff2){return _0x5e1640[_0x4254('0x12')](_0x231ec3)[_0x4254('0x13')](_0x13dff2);}};}function respondWithFilteredResult(_0x300573,_0x534b1f){return function(_0x1a9584){if(_0x1a9584){var _0x4dbd4b=typeof _0x534b1f[_0x4254('0x14')]===_0x4254('0x15')&&typeof _0x534b1f[_0x4254('0x16')]===_0x4254('0x15');var _0x9fd263=_0x1a9584[_0x4254('0x17')];var _0x208f0a=_0x4dbd4b?0x0:_0x534b1f[_0x4254('0x14')];var _0x46a990=_0x4dbd4b?_0x1a9584[_0x4254('0x17')]:_0x534b1f['offset']+_0x534b1f[_0x4254('0x16')];var _0x2559aa;if(_0x46a990>=_0x9fd263){_0x46a990=_0x9fd263;_0x2559aa=0xc8;}else{_0x2559aa=0xce;}_0x300573[_0x4254('0x12')](_0x2559aa);return _0x300573[_0x4254('0x18')]('Content-Range',_0x208f0a+'-'+_0x46a990+'/'+_0x9fd263)[_0x4254('0x13')](_0x1a9584);}return null;};}function saveUpdates(_0x110dac){return function(_0x341e00){if(_0x341e00){return _0x341e00[_0x4254('0x19')](_0x110dac)[_0x4254('0x1a')](function(_0x13ba0d){return _0x13ba0d;});}return null;};}function removeEntity(_0x234867){return function(_0x358b35){if(_0x358b35){return _0x358b35[_0x4254('0x1b')]()[_0x4254('0x1a')](function(){_0x234867['status'](0xcc)[_0x4254('0x1c')]();});}};}function handleEntityNotFound(_0x260415){return function(_0x2ec323){if(!_0x2ec323){_0x260415[_0x4254('0x11')](0x194);}return _0x2ec323;};}function handleError(_0x509d1f,_0x4f1270){_0x4f1270=_0x4f1270||0x1f4;return function(_0x446bb9){logger['error'](_0x446bb9[_0x4254('0x1d')]);if(_0x446bb9['name']){delete _0x446bb9[_0x4254('0x1e')];}_0x509d1f[_0x4254('0x12')](_0x4f1270)[_0x4254('0x1f')](_0x446bb9);};}exports['index']=function(_0x2341cc,_0x957ec1){var _0x525d3c={};var _0x14dc72=_[_0x4254('0x20')](db['OpenchannelInteraction']['rawAttributes'],function(_0x36385e){return{'name':_0x36385e[_0x4254('0x21')],'type':_0x36385e[_0x4254('0x22')]['key']};});_0x525d3c=qs['getOptions'](_0x14dc72,_0x2341cc);return interaction[_0x4254('0x23')](_0x4254('0x24'),_0x2341cc[_0x4254('0x25')],_0x2341cc[_0x4254('0x26')],_0x525d3c,_0x14dc72)['then'](respondWithFilteredResult(_0x957ec1,_0x525d3c))['catch'](handleError(_0x957ec1,null));};exports[_0x4254('0x27')]=function(_0x1c00dc,_0x2af6c6){var _0x5bf7d4={};if(_0x1c00dc['query'][_0x4254('0x22')]&&_0x1c00dc[_0x4254('0x25')][_0x4254('0x22')]==='from'){_0x5bf7d4['from']=_0x1c00dc[_0x4254('0x28')]['id'];}else{_0x5bf7d4['id']=_0x1c00dc[_0x4254('0x28')]['id'];}var _0x40fcb9={'raw':![],'where':_0x5bf7d4},_0x4b45a5={};_0x4b45a5['model']=_[_0x4254('0x29')](db['OpenchannelInteraction'][_0x4254('0x2a')]);_0x4b45a5[_0x4254('0x25')]=_['keys'](_0x1c00dc['query']);_0x4b45a5['filters']=_['intersection'](_0x4b45a5[_0x4254('0x2b')],_0x4b45a5[_0x4254('0x25')]);_0x40fcb9['attributes']=_[_0x4254('0x2c')](_0x4b45a5[_0x4254('0x2b')],qs[_0x4254('0x2d')](_0x1c00dc[_0x4254('0x25')][_0x4254('0x2d')]));_0x40fcb9['attributes']=_0x40fcb9['attributes'][_0x4254('0x2e')]?_0x40fcb9[_0x4254('0x2f')]:_0x4b45a5[_0x4254('0x2b')];if(_0x1c00dc[_0x4254('0x25')][_0x4254('0x30')]){_0x40fcb9[_0x4254('0x31')]=[{'all':!![]}];}_0x40fcb9=_[_0x4254('0x32')]({},_0x40fcb9,_0x1c00dc[_0x4254('0x33')]);return db[_0x4254('0x34')][_0x4254('0x35')](_0x40fcb9)[_0x4254('0x1a')](handleEntityNotFound(_0x2af6c6,null))[_0x4254('0x1a')](respondWithResult(_0x2af6c6,null))[_0x4254('0x36')](handleError(_0x2af6c6,null));};exports[_0x4254('0x37')]=function(_0xacaab1,_0x454c41){return db[_0x4254('0x34')][_0x4254('0x37')](_0xacaab1[_0x4254('0x38')],{})[_0x4254('0x1a')](respondWithResult(_0x454c41,0xc9))[_0x4254('0x36')](handleError(_0x454c41,null));};exports[_0x4254('0x19')]=function(_0x3b5801,_0x239e7e){if(_0x3b5801['body']['id']){delete _0x3b5801[_0x4254('0x38')]['id'];}return db['OpenchannelInteraction'][_0x4254('0x35')]({'where':{'id':_0x3b5801[_0x4254('0x28')]['id']}})[_0x4254('0x1a')](handleEntityNotFound(_0x239e7e,null))[_0x4254('0x1a')](saveUpdates(_0x3b5801[_0x4254('0x38')],null))[_0x4254('0x1a')](respondWithResult(_0x239e7e,null))[_0x4254('0x36')](handleError(_0x239e7e,null));};exports['destroy']=function(_0x5c3a5f,_0x1f4454){return db[_0x4254('0x34')][_0x4254('0x35')]({'where':{'id':_0x5c3a5f[_0x4254('0x28')]['id']}})[_0x4254('0x1a')](handleEntityNotFound(_0x1f4454,null))[_0x4254('0x1a')](removeEntity(_0x1f4454,null))['catch'](handleError(_0x1f4454,null));};exports[_0x4254('0x39')]=function(_0x1e542c,_0x353e25){return db[_0x4254('0x34')][_0x4254('0x39')]()[_0x4254('0x1a')](respondWithResult(_0x353e25,null))[_0x4254('0x36')](handleError(_0x353e25,null));};exports[_0x4254('0x3a')]=function(_0x52bfe8,_0x4fc702){return db[_0x4254('0x3b')][_0x4254('0x35')]({'where':{'id':_0x52bfe8[_0x4254('0x28')]['id']}})[_0x4254('0x1a')](handleEntityNotFound(_0x4fc702,null))[_0x4254('0x1a')](function(_0x5ca8b){if(_0x5ca8b){return _0x5ca8b[_0x4254('0x3a')](_0x52bfe8[_0x4254('0x38')][_0x4254('0x3c')],_[_0x4254('0x3d')](_0x52bfe8[_0x4254('0x38')],['ids','id'])||{});}})[_0x4254('0x1a')](respondWithResult(_0x4fc702,null))[_0x4254('0x36')](handleError(_0x4fc702,null));};exports[_0x4254('0x3e')]=function(_0x56febb,_0x23a8ca){var _0x28c88a={'raw':![],'where':{}};var _0x209584={};var _0x5ac19a={'count':0x0,'rows':[]};return db[_0x4254('0x34')][_0x4254('0x3f')]({'where':{'id':_0x56febb['params']['id']}})[_0x4254('0x1a')](handleEntityNotFound(_0x23a8ca,null))[_0x4254('0x1a')](function(_0x3738cc){if(_0x3738cc){_0x209584[_0x4254('0x2b')]=_[_0x4254('0x29')](db[_0x4254('0x3b')][_0x4254('0x2a')]);_0x209584[_0x4254('0x25')]=_[_0x4254('0x29')](_0x56febb['query']);_0x209584[_0x4254('0x40')]=_[_0x4254('0x2c')](_0x209584[_0x4254('0x2b')],_0x209584[_0x4254('0x25')]);_0x28c88a[_0x4254('0x2f')]=_[_0x4254('0x2c')](_0x209584[_0x4254('0x2b')],qs[_0x4254('0x2d')](_0x56febb['query'][_0x4254('0x2d')]));_0x28c88a['attributes']=_0x28c88a['attributes'][_0x4254('0x2e')]?_0x28c88a[_0x4254('0x2f')]:_0x209584[_0x4254('0x2b')];if(!_0x56febb[_0x4254('0x25')]['hasOwnProperty'](_0x4254('0x41'))){_0x28c88a['limit']=qs[_0x4254('0x16')](_0x56febb[_0x4254('0x25')][_0x4254('0x16')]);_0x28c88a[_0x4254('0x14')]=qs[_0x4254('0x14')](_0x56febb['query'][_0x4254('0x14')]);}_0x28c88a[_0x4254('0x42')]=qs[_0x4254('0x43')](_0x56febb[_0x4254('0x25')][_0x4254('0x43')]);_0x28c88a[_0x4254('0x44')]=qs[_0x4254('0x40')](_[_0x4254('0x45')](_0x56febb[_0x4254('0x25')],_0x209584[_0x4254('0x40')]));_0x28c88a[_0x4254('0x44')][_0x4254('0x46')]=_0x3738cc['id'];if(_0x56febb[_0x4254('0x25')][_0x4254('0x47')]){_0x28c88a['where']=_[_0x4254('0x32')](_0x28c88a['where'],{'$or':_[_0x4254('0x20')](_0x28c88a['attributes'],function(_0x5dd7c5){var _0x3d0939={};_0x3d0939[_0x5dd7c5]={'$like':'%'+_0x56febb[_0x4254('0x25')]['filter']+'%'};return _0x3d0939;})});}if(_0x56febb['query']['$gte']){var _0x2fb8c6=_0x56febb['query'][_0x4254('0x48')]['split'](',');var _0x5f55ed={};_0x5f55ed[_0x2fb8c6[0x0]]={'$gte':moment(_0x2fb8c6[0x1])[_0x4254('0x49')](_0x4254('0x4a'))};_0x28c88a[_0x4254('0x44')]=_[_0x4254('0x32')](_0x28c88a[_0x4254('0x44')],_0x5f55ed);}_0x28c88a=_['merge']({},_0x28c88a,_0x56febb['options']);return db['OpenchannelMessage']['count']({'where':_0x28c88a['where']})[_0x4254('0x1a')](function(_0x51e7de){_0x5ac19a[_0x4254('0x17')]=_0x51e7de;if(_0x56febb[_0x4254('0x25')]['includeAll']){_0x28c88a[_0x4254('0x31')]=[{'all':!![]}];}return db[_0x4254('0x3b')][_0x4254('0x23')](_0x28c88a);})[_0x4254('0x1a')](function(_0x294f10){_0x5ac19a['rows']=_0x294f10;return _0x5ac19a;});}})[_0x4254('0x1a')](respondWithFilteredResult(_0x23a8ca,_0x28c88a))[_0x4254('0x36')](handleError(_0x23a8ca,null));};exports['addTags']=function(_0x1b3bd2,_0x5c8511){return db['OpenchannelInteraction'][_0x4254('0x35')]({'where':{'id':_0x1b3bd2[_0x4254('0x28')]['id']}})[_0x4254('0x1a')](handleEntityNotFound(_0x5c8511,null))['then'](function(_0x3339c8){if(_0x3339c8){return _0x3339c8[_0x4254('0x4b')](_0x1b3bd2[_0x4254('0x38')][_0x4254('0x3c')],_[_0x4254('0x3d')](_0x1b3bd2[_0x4254('0x38')],[_0x4254('0x3c'),'id'])||{})[_0x4254('0x4c')](function(){return db['Tag'][_0x4254('0x23')]({'attributes':['id',_0x4254('0x1e'),_0x4254('0x4d')],'where':{'id':_0x1b3bd2['body'][_0x4254('0x3c')]}});})['then'](function(_0x4dab87){socket[_0x4254('0x4e')]('openchannelInteractionTags:save',{'id':Number(_0x1b3bd2[_0x4254('0x28')]['id']),'tags':_0x4dab87||[]});return{'id':Number(_0x1b3bd2[_0x4254('0x28')]['id']),'tags':_0x4dab87||[]};});}})[_0x4254('0x1a')](respondWithResult(_0x5c8511,null))['catch'](handleError(_0x5c8511,null));};exports[_0x4254('0x4f')]=function(_0x26711c,_0x6dd9cc){return db['OpenchannelInteraction'][_0x4254('0x35')]({'where':{'id':_0x26711c[_0x4254('0x28')]['id']}})[_0x4254('0x1a')](handleEntityNotFound(_0x6dd9cc,null))[_0x4254('0x1a')](function(_0x22bc13){if(_0x22bc13){return _0x22bc13[_0x4254('0x4f')](_0x26711c[_0x4254('0x25')][_0x4254('0x3c')]);}})[_0x4254('0x1a')](respondWithStatusCode(_0x6dd9cc,null))[_0x4254('0x36')](handleError(_0x6dd9cc,null));};exports['download']=function(_0x4f5e26,_0x4989e3){var _0x44ed88=moment()['unix']()['toString']();var _0x592e51=path[_0x4254('0x50')](config[_0x4254('0x51')],_0x4254('0x52'),_0x4254('0x53'),_0x4254('0x54'));var _0x5ab1aa=path[_0x4254('0x50')](config[_0x4254('0x51')],'server',_0x4254('0x53'),_0x4254('0x55'));var _0x4443d8=path[_0x4254('0x50')](_0x592e51,_0x44ed88);var _0x647e63=util[_0x4254('0x49')]('transcript-%d-%s.zip',_0x4f5e26[_0x4254('0x28')]['id'],_0x44ed88);var _0x4124d3=path[_0x4254('0x50')](_0x592e51,_0x647e63);var _0x43700d=[];_0x43700d['push']({'model':db['User'],'as':_0x4254('0x56'),'attributes':['id',_0x4254('0x57')],'raw':!![]});_0x43700d[_0x4254('0x58')]({'model':db[_0x4254('0x59')],'as':_0x4254('0x5a'),'attributes':['id',_0x4254('0x5b'),_0x4254('0x5c')],'raw':!![]});if(_0x4f5e26[_0x4254('0x25')][_0x4254('0x55')]){_0x43700d['push']({'model':db[_0x4254('0x5d')],'as':_0x4254('0x5d'),'raw':!![]});}var _0x304dd7=[{'model':db[_0x4254('0x3b')],'as':_0x4254('0x5e'),'attributes':['id','body',_0x4254('0x5f'),_0x4254('0x60'),'secret','read'],'include':_0x43700d}];_0x304dd7[_0x4254('0x58')]({'model':db[_0x4254('0x61')],'as':_0x4254('0x62'),'attributes':['id',_0x4254('0x1e')]});_0x304dd7[_0x4254('0x58')]({'model':db['User'],'as':'Owner','attributes':['id','fullname']});return db[_0x4254('0x34')][_0x4254('0x35')]({'where':{'id':_0x4f5e26[_0x4254('0x28')]['id']},'include':_0x304dd7})[_0x4254('0x1a')](handleEntityNotFound(_0x4989e3,null))[_0x4254('0x1a')](function(_0x5f4923){if(_0x5f4923){var _0x16ac3b=_0x5f4923['get']({'plain':!![]});fs[_0x4254('0x63')](_0x4443d8);var _0xdb02b9={'channel':_0x4254('0x64'),'account':_0x16ac3b[_0x4254('0x62')][_0x4254('0x1e')],'agent':_0x16ac3b[_0x4254('0x65')]?_0x16ac3b['Owner'][_0x4254('0x57')]:_0x4254('0x66'),'createdAt':moment(_0x16ac3b[_0x4254('0x5f')])[_0x4254('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4254('0x67')](),'closedAt':_0x16ac3b[_0x4254('0x68')]?moment(_0x16ac3b['closedAt'])[_0x4254('0x49')](_0x4254('0x4a'))[_0x4254('0x67')]():'','disposition':_0x16ac3b[_0x4254('0x69')],'visibility':_0x16ac3b[_0x4254('0x6a')]?_0x4254('0x6b'):_0x4254('0x6c'),'messages':_(_0x16ac3b[_0x4254('0x5e')])['filter']({'secret':![]})[_0x4254('0x20')](function(_0x55507e){if(_0x55507e[_0x4254('0x5d')]){var _0x33ae50=path[_0x4254('0x50')](_0x5ab1aa,_0x55507e[_0x4254('0x5d')]['basename']);if(fs['existsSync'](_0x33ae50)){fs[_0x4254('0x6d')](_0x33ae50)['pipe'](fs['createWriteStream'](path[_0x4254('0x50')](_0x4443d8,_0x55507e[_0x4254('0x5d')][_0x4254('0x6e')])));}}return{'date':moment(_0x55507e[_0x4254('0x5f')])[_0x4254('0x49')]('YYYY-MM-DD\x20HH:mm:ss')['toString'](),'sender':_0x55507e[_0x4254('0x60')]==='out'?_0x55507e['User']?_0x55507e[_0x4254('0x56')][_0x4254('0x57')]:_0x4254('0x6f'):_0x55507e[_0x4254('0x5a')][_0x4254('0x5b')]+(_0x55507e['Contact'][_0x4254('0x5c')]?'\x20'+_0x55507e[_0x4254('0x5a')][_0x4254('0x5c')]:''),'body':_0x55507e[_0x4254('0x5d')]?_0x55507e[_0x4254('0x5d')][_0x4254('0x6e')]:_0x55507e[_0x4254('0x38')],'direction':_0x55507e[_0x4254('0x60')]===_0x4254('0x70')?'A':'C','secret':_0x55507e[_0x4254('0x71')],'read':_0x55507e[_0x4254('0x72')],'attachment':_0x55507e['Attachment']};})[_0x4254('0x73')]()};return ejs[_0x4254('0x74')](path[_0x4254('0x50')](config[_0x4254('0x51')],_0x4254('0x52'),'views','downloadInteraction.ejs'),{'interaction':_0xdb02b9})[_0x4254('0x1a')](function(_0x457de6){var _0x117de8=path[_0x4254('0x50')](_0x4443d8,_0x4254('0x75')+_0x16ac3b['id']+'-'+_0x44ed88+'.pdf');var _0x1901d0={'path':_0x117de8,'channel':_0x4254('0x64'),'interactionId':_0x16ac3b['id']};return pdf[_0x4254('0x76')](_0x457de6,_0x1901d0);})['then'](function(){return new Promise(function(_0x22dca5,_0x2beebd){zipdir(_0x4443d8,{'saveTo':_0x4124d3},function(_0x90169f,_0x421617){if(_0x90169f)return _0x2beebd(_0x90169f);return _0x22dca5(_0x421617);});})[_0x4254('0x1a')](function(){return new Promise(function(_0x48f0ab,_0x4a3a05){rimraf(_0x4443d8,function(_0x529c31){if(_0x529c31)_0x4a3a05(_0x529c31);return _0x48f0ab();});});})['then'](function(){return _0x4989e3['download'](_0x4124d3,_0x647e63,function(_0x53d64f){if(_0x53d64f){logger[_0x4254('0x77')](_0x4254('0x78'),_0x53d64f);}else{fs[_0x4254('0x79')](_0x4124d3);}});});});}else{return _0x4989e3['sendStatus'](0xc8);}})['catch'](handleError(_0x4989e3,null));}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.events.js b/server/api/openchannelInteraction/openchannelInteraction.events.js index 18dff50..d69b89f 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 _0xe6da=['unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelInteraction','OpenchannelMessage','save','update','remove','then','setDataValue','Users','findAll'];(function(_0x377df1,_0x4f3680){var _0x589a16=function(_0x43228d){while(--_0x43228d){_0x377df1['push'](_0x377df1['shift']());}};_0x589a16(++_0x4f3680);}(_0xe6da,0x14b));var _0xae6d=function(_0x285bc5,_0xab4d91){_0x285bc5=_0x285bc5-0x0;var _0x2cc2c6=_0xe6da[_0x285bc5];return _0x2cc2c6;};'use strict';var EventEmitter=require(_0xae6d('0x0'));var OpenchannelInteraction=require(_0xae6d('0x1'))['db'][_0xae6d('0x2')];var OpenchannelMessage=require('../../mysqldb')['db'][_0xae6d('0x3')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xae6d('0x4'),'afterUpdate':_0xae6d('0x5'),'afterDestroy':_0xae6d('0x6')};function emitEvent(_0x4b534c){return function(_0x325b4c,_0x16ff70,_0x5d2e75){_0x325b4c['getUsers']({'attributes':['id'],'raw':!![]})[_0xae6d('0x7')](function(_0x3a4d05){_0x325b4c[_0xae6d('0x8')](_0xae6d('0x9'),_0x3a4d05['map'](function(_0x4efba2){return{'id':_0x4efba2['id']};}));return OpenchannelMessage[_0xae6d('0xa')]({'where':{'OpenchannelInteractionId':_0x325b4c['id'],'direction':'in','read':![]},'raw':!![]});})[_0xae6d('0x7')](function(_0x8caee1){_0x325b4c['setDataValue'](_0xae6d('0xb'),_0x8caee1[_0xae6d('0xc')]);OpenchannelInteractionEvents[_0xae6d('0xd')](_0x4b534c+':'+_0x325b4c['id'],_0x325b4c);OpenchannelInteractionEvents['emit'](_0x4b534c,_0x325b4c);_0x5d2e75(null);})[_0xae6d('0xe')](_0x5d2e75(null));};}for(var e in events){if(events[_0xae6d('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xae6d('0x10')](e,emitEvent(event));}}module[_0xae6d('0x11')]=OpenchannelInteractionEvents; \ No newline at end of file +var _0xd83a=['hasOwnProperty','hook','exports','events','../../mysqldb','OpenchannelMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','map','findAll','length','emit','catch'];(function(_0x25cf07,_0x4d3fa2){var _0x33d720=function(_0x13b424){while(--_0x13b424){_0x25cf07['push'](_0x25cf07['shift']());}};_0x33d720(++_0x4d3fa2);}(_0xd83a,0x1e9));var _0xad83=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0xd83a[_0x31e29a];return _0x32d892;};'use strict';var EventEmitter=require(_0xad83('0x0'));var OpenchannelInteraction=require(_0xad83('0x1'))['db']['OpenchannelInteraction'];var OpenchannelMessage=require(_0xad83('0x1'))['db'][_0xad83('0x2')];var OpenchannelInteractionEvents=new EventEmitter();OpenchannelInteractionEvents[_0xad83('0x3')](0x0);var events={'afterCreate':_0xad83('0x4'),'afterUpdate':_0xad83('0x5'),'afterDestroy':_0xad83('0x6')};function emitEvent(_0x5af2c2){return function(_0xee4536,_0x4c37fc,_0x520718){_0xee4536[_0xad83('0x7')]({'attributes':['id'],'raw':!![]})[_0xad83('0x8')](function(_0x58ebc1){_0xee4536[_0xad83('0x9')]('Users',_0x58ebc1[_0xad83('0xa')](function(_0x2569d2){return{'id':_0x2569d2['id']};}));return OpenchannelMessage[_0xad83('0xb')]({'where':{'OpenchannelInteractionId':_0xee4536['id'],'direction':'in','read':![]},'raw':!![]});})[_0xad83('0x8')](function(_0x454e82){_0xee4536[_0xad83('0x9')]('unreadMessages',_0x454e82[_0xad83('0xc')]);OpenchannelInteractionEvents[_0xad83('0xd')](_0x5af2c2+':'+_0xee4536['id'],_0xee4536);OpenchannelInteractionEvents['emit'](_0x5af2c2,_0xee4536);_0x520718(null);})[_0xad83('0xe')](_0x520718(null));};}for(var e in events){if(events[_0xad83('0xf')](e)){var event=events[e];OpenchannelInteraction[_0xad83('0x10')](e,emitEvent(event));}}module[_0xad83('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 ef6eb17..a706ed3 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 _0x285f=['YYYY-MM-DD\x20HH:mm:ss','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','OpenchannelInteraction','openchannel_interactions','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format'];(function(_0x11f7c9,_0xd41d19){var _0x31e087=function(_0x37c531){while(--_0x37c531){_0x11f7c9['push'](_0x11f7c9['shift']());}};_0x31e087(++_0xd41d19);}(_0x285f,0x18d));var _0xf285=function(_0x3c38fe,_0x2ec535){_0x3c38fe=_0x3c38fe-0x0;var _0x30880e=_0x285f[_0x3c38fe];return _0x30880e;};'use strict';var _=require(_0xf285('0x0'));var util=require(_0xf285('0x1'));var logger=require(_0xf285('0x2'))('api');var moment=require(_0xf285('0x3'));var BPromise=require(_0xf285('0x4'));var rp=require(_0xf285('0x5'));var fs=require('fs');var path=require(_0xf285('0x6'));var rimraf=require(_0xf285('0x7'));var config=require(_0xf285('0x8'));var attributes=require('./openchannelInteraction.attributes');module['exports']=function(_0xb5ec91,_0x3fa241){return _0xb5ec91['define'](_0xf285('0x9'),attributes,{'tableName':_0xf285('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf285('0xb'),'collate':_0xf285('0xc'),'hooks':{'beforeUpdate':function(_0x5ea054,_0x16c79c,_0x3f6e39){if(_0x5ea054[_0xf285('0xd')](_0xf285('0xe'))){_0x5ea054[_0xf285('0xf')]=moment()[_0xf285('0x10')](_0xf285('0x11'));}_0x3f6e39(null,_0x5ea054);}}});}; \ No newline at end of file +var _0x56ab=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelInteraction.attributes','exports','utf8mb4','utf8mb4_unicode_ci','changed','closed','closedAt','format','lodash'];(function(_0x2994e1,_0x321e20){var _0x201001=function(_0x4c148f){while(--_0x4c148f){_0x2994e1['push'](_0x2994e1['shift']());}};_0x201001(++_0x321e20);}(_0x56ab,0x186));var _0xb56a=function(_0x5bf975,_0x114bfb){_0x5bf975=_0x5bf975-0x0;var _0x3d07a2=_0x56ab[_0x5bf975];return _0x3d07a2;};'use strict';var _=require(_0xb56a('0x0'));var util=require(_0xb56a('0x1'));var logger=require('../../config/logger')(_0xb56a('0x2'));var moment=require(_0xb56a('0x3'));var BPromise=require(_0xb56a('0x4'));var rp=require(_0xb56a('0x5'));var fs=require('fs');var path=require(_0xb56a('0x6'));var rimraf=require(_0xb56a('0x7'));var config=require(_0xb56a('0x8'));var attributes=require(_0xb56a('0x9'));module[_0xb56a('0xa')]=function(_0x4706eb,_0x52f210){return _0x4706eb['define']('OpenchannelInteraction',attributes,{'tableName':'openchannel_interactions','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xb56a('0xb'),'collate':_0xb56a('0xc'),'hooks':{'beforeUpdate':function(_0x50ab4e,_0x2c3325,_0x2786dd){if(_0x50ab4e[_0xb56a('0xd')](_0xb56a('0xe'))){_0x50ab4e[_0xb56a('0xf')]=moment()[_0xb56a('0x10')]('YYYY-MM-DD\x20HH:mm:ss');}_0x2786dd(null,_0x50ab4e);}}});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.rpc.js b/server/api/openchannelInteraction/openchannelInteraction.rpc.js index 01c8e6b..8a3c6f0 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 _0x3316=['code','message','result','catch','UpdateOpenchannelInteraction','OpenchannelInteraction','options','where','attributes','limit','find','addTags','body','ids','spread','AddTags','util','moment','randomstring','../../mysqldb','../../config/utils','rpc','client','http','socket.io-emitter','redis','./openchannelInteraction.socket','register','request','then','info','OpenchannelInteraction,\x20%s,\x20%s','debug','OpenchannelInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x5c12f2,_0x5de043){var _0x5e8344=function(_0x445932){while(--_0x445932){_0x5c12f2['push'](_0x5c12f2['shift']());}};_0x5e8344(++_0x5de043);}(_0x3316,0xa4));var _0x6331=function(_0x3aaef5,_0x16cdc8){_0x3aaef5=_0x3aaef5-0x0;var _0x4c0ed5=_0x3316[_0x3aaef5];return _0x4c0ed5;};'use strict';var _=require('lodash');var util=require(_0x6331('0x0'));var moment=require(_0x6331('0x1'));var BPromise=require('bluebird');var rs=require(_0x6331('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6331('0x3'))['db'];var utils=require(_0x6331('0x4'));var logger=require('../../config/logger')(_0x6331('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6331('0x6')][_0x6331('0x7')]({'port':0x232a});config['redis']=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x6331('0x8'))(new Redis(config[_0x6331('0x9')]));require(_0x6331('0xa'))[_0x6331('0xb')](socket);function respondWithRpcPromise(_0x4ed937,_0x1c835b,_0x2be131){return new BPromise(function(_0x5de119,_0x7bf939){return client[_0x6331('0xc')](_0x4ed937,_0x2be131)[_0x6331('0xd')](function(_0x34b840){logger[_0x6331('0xe')](_0x6331('0xf'),_0x1c835b,'request\x20sent');logger[_0x6331('0x10')](_0x6331('0x11'),_0x1c835b,_0x6331('0x12'),JSON[_0x6331('0x13')](_0x34b840));if(_0x34b840[_0x6331('0x14')]){if(_0x34b840[_0x6331('0x14')][_0x6331('0x15')]===0x1f4){logger['error'](_0x6331('0xf'),_0x1c835b,_0x34b840[_0x6331('0x14')]['message']);return _0x7bf939(_0x34b840[_0x6331('0x14')][_0x6331('0x16')]);}logger[_0x6331('0x14')](_0x6331('0xf'),_0x1c835b,_0x34b840[_0x6331('0x14')][_0x6331('0x16')]);return _0x5de119(_0x34b840['error'][_0x6331('0x16')]);}else{logger[_0x6331('0xe')](_0x6331('0xf'),_0x1c835b,_0x6331('0x12'));_0x5de119(_0x34b840[_0x6331('0x17')][_0x6331('0x16')]);}})[_0x6331('0x18')](function(_0x4b98c3){logger['error'](_0x6331('0xf'),_0x1c835b,_0x4b98c3);_0x7bf939(_0x4b98c3);});});}exports[_0x6331('0x19')]=function(_0x1798f2){var _0x7f8a10=this;return new Promise(function(_0x1f18cb,_0x275d40){return db[_0x6331('0x1a')]['update'](_0x1798f2['body'],{'raw':_0x1798f2[_0x6331('0x1b')]?_0x1798f2['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1798f2[_0x6331('0x1b')]?_0x1798f2[_0x6331('0x1b')][_0x6331('0x1c')]||null:null,'attributes':_0x1798f2[_0x6331('0x1b')]?_0x1798f2[_0x6331('0x1b')][_0x6331('0x1d')]||null:null,'limit':_0x1798f2[_0x6331('0x1b')]?_0x1798f2[_0x6331('0x1b')][_0x6331('0x1e')]||null:null})[_0x6331('0xd')](function(_0x1e4e52){logger[_0x6331('0xe')]('UpdateOpenchannelInteraction',_0x1798f2);logger['debug']('UpdateOpenchannelInteraction',_0x1798f2,JSON[_0x6331('0x13')](_0x1e4e52));_0x1f18cb(_0x1e4e52);})[_0x6331('0x18')](function(_0x2df1f5){logger[_0x6331('0x14')]('UpdateOpenchannelInteraction',_0x2df1f5[_0x6331('0x16')],_0x1798f2);_0x275d40(_0x7f8a10[_0x6331('0x14')](0x1f4,_0x2df1f5[_0x6331('0x16')]));});});};exports['AddTagsToOpenchannelInteraction']=function(_0x452c59){return new Promise(function(_0x225e50,_0xc5032f){return db[_0x6331('0x1a')][_0x6331('0x1f')]({'where':_0x452c59[_0x6331('0x1b')]?_0x452c59[_0x6331('0x1b')]['where']||null:null})[_0x6331('0xd')](function(_0x528e9b){if(_0x528e9b){return _0x528e9b[_0x6331('0x20')](_0x452c59[_0x6331('0x21')][_0x6331('0x22')],_['omit'](_0x452c59[_0x6331('0x21')],[_0x6331('0x22'),'id'])||{});}})[_0x6331('0x23')](function(_0x484b95){logger['info'](_0x6331('0x24'),_0x452c59);logger[_0x6331('0x10')]('AddTags',_0x452c59,JSON[_0x6331('0x13')](_0x484b95));_0x225e50(_0x484b95);})[_0x6331('0x18')](function(_0x4d81f2){logger[_0x6331('0x14')](_0x6331('0x24'),_0x4d81f2['message'],_0x452c59);_0xc5032f(_this[_0x6331('0x14')](0x1f4,_0x4d81f2['message']));});});}; \ No newline at end of file +var _0x5c0b=['request','then','info','OpenchannelInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateOpenchannelInteraction','update','body','options','debug','AddTagsToOpenchannelInteraction','OpenchannelInteraction','where','addTags','ids','omit','spread','AddTags','util','bluebird','randomstring','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','register'];(function(_0x1bd434,_0x159dbd){var _0x3faac8=function(_0x5f073f){while(--_0x5f073f){_0x1bd434['push'](_0x1bd434['shift']());}};_0x3faac8(++_0x159dbd);}(_0x5c0b,0x11a));var _0xb5c0=function(_0x23ca5b,_0x1f45ad){_0x23ca5b=_0x23ca5b-0x0;var _0x575db3=_0x5c0b[_0x23ca5b];return _0x575db3;};'use strict';var _=require('lodash');var util=require(_0xb5c0('0x0'));var moment=require('moment');var BPromise=require(_0xb5c0('0x1'));var rs=require(_0xb5c0('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb5c0('0x3'))(_0xb5c0('0x4'));var config=require(_0xb5c0('0x5'));var jayson=require(_0xb5c0('0x6'));var client=jayson[_0xb5c0('0x7')][_0xb5c0('0x8')]({'port':0x232a});config[_0xb5c0('0x9')]=_[_0xb5c0('0xa')](config['redis'],{'host':_0xb5c0('0xb'),'port':0x18eb});var socket=require(_0xb5c0('0xc'))(new Redis(config[_0xb5c0('0x9')]));require('./openchannelInteraction.socket')[_0xb5c0('0xd')](socket);function respondWithRpcPromise(_0x217671,_0x262c54,_0x36a692){return new BPromise(function(_0x331012,_0xe359ba){return client[_0xb5c0('0xe')](_0x217671,_0x36a692)[_0xb5c0('0xf')](function(_0x2fd84c){logger[_0xb5c0('0x10')](_0xb5c0('0x11'),_0x262c54,_0xb5c0('0x12'));logger['debug']('OpenchannelInteraction,\x20%s,\x20%s,\x20%s',_0x262c54,_0xb5c0('0x12'),JSON[_0xb5c0('0x13')](_0x2fd84c));if(_0x2fd84c[_0xb5c0('0x14')]){if(_0x2fd84c[_0xb5c0('0x14')][_0xb5c0('0x15')]===0x1f4){logger[_0xb5c0('0x14')]('OpenchannelInteraction,\x20%s,\x20%s',_0x262c54,_0x2fd84c[_0xb5c0('0x14')][_0xb5c0('0x16')]);return _0xe359ba(_0x2fd84c[_0xb5c0('0x14')][_0xb5c0('0x16')]);}logger[_0xb5c0('0x14')](_0xb5c0('0x11'),_0x262c54,_0x2fd84c['error'][_0xb5c0('0x16')]);return _0x331012(_0x2fd84c['error'][_0xb5c0('0x16')]);}else{logger['info']('OpenchannelInteraction,\x20%s,\x20%s',_0x262c54,_0xb5c0('0x12'));_0x331012(_0x2fd84c['result'][_0xb5c0('0x16')]);}})[_0xb5c0('0x17')](function(_0x37d89d){logger['error']('OpenchannelInteraction,\x20%s,\x20%s',_0x262c54,_0x37d89d);_0xe359ba(_0x37d89d);});});}exports[_0xb5c0('0x18')]=function(_0x1a47b4){var _0x27212b=this;return new Promise(function(_0x1cd5ef,_0x30b770){return db['OpenchannelInteraction'][_0xb5c0('0x19')](_0x1a47b4[_0xb5c0('0x1a')],{'raw':_0x1a47b4['options']?_0x1a47b4[_0xb5c0('0x1b')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x1a47b4[_0xb5c0('0x1b')]?_0x1a47b4[_0xb5c0('0x1b')]['where']||null:null,'attributes':_0x1a47b4[_0xb5c0('0x1b')]?_0x1a47b4['options']['attributes']||null:null,'limit':_0x1a47b4[_0xb5c0('0x1b')]?_0x1a47b4['options']['limit']||null:null})[_0xb5c0('0xf')](function(_0x4c6b95){logger[_0xb5c0('0x10')]('UpdateOpenchannelInteraction',_0x1a47b4);logger[_0xb5c0('0x1c')]('UpdateOpenchannelInteraction',_0x1a47b4,JSON['stringify'](_0x4c6b95));_0x1cd5ef(_0x4c6b95);})[_0xb5c0('0x17')](function(_0x3e8dc4){logger[_0xb5c0('0x14')](_0xb5c0('0x18'),_0x3e8dc4[_0xb5c0('0x16')],_0x1a47b4);_0x30b770(_0x27212b[_0xb5c0('0x14')](0x1f4,_0x3e8dc4[_0xb5c0('0x16')]));});});};exports[_0xb5c0('0x1d')]=function(_0x35c858){return new Promise(function(_0x57798e,_0x29b158){return db[_0xb5c0('0x1e')]['find']({'where':_0x35c858[_0xb5c0('0x1b')]?_0x35c858[_0xb5c0('0x1b')][_0xb5c0('0x1f')]||null:null})[_0xb5c0('0xf')](function(_0x5b8b54){if(_0x5b8b54){return _0x5b8b54[_0xb5c0('0x20')](_0x35c858['body'][_0xb5c0('0x21')],_[_0xb5c0('0x22')](_0x35c858[_0xb5c0('0x1a')],[_0xb5c0('0x21'),'id'])||{});}})[_0xb5c0('0x23')](function(_0x13a791){logger[_0xb5c0('0x10')]('AddTags',_0x35c858);logger[_0xb5c0('0x1c')](_0xb5c0('0x24'),_0x35c858,JSON[_0xb5c0('0x13')](_0x13a791));_0x57798e(_0x13a791);})[_0xb5c0('0x17')](function(_0x174165){logger[_0xb5c0('0x14')]('AddTags',_0x174165[_0xb5c0('0x16')],_0x35c858);_0x29b158(_this[_0xb5c0('0x14')](0x1f4,_0x174165[_0xb5c0('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelInteraction/openchannelInteraction.socket.js b/server/api/openchannelInteraction/openchannelInteraction.socket.js index 6589a6a..f575323 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 _0x8aa6=['emit','removeListener','register','length','openchannelInteraction:','save','remove','update'];(function(_0x3f36f1,_0x3dc4e1){var _0x74dd1=function(_0x531315){while(--_0x531315){_0x3f36f1['push'](_0x3f36f1['shift']());}};_0x74dd1(++_0x3dc4e1);}(_0x8aa6,0xfd));var _0x68aa=function(_0x1a3fe2,_0x553b71){_0x1a3fe2=_0x1a3fe2-0x0;var _0x490ee2=_0x8aa6[_0x1a3fe2];return _0x490ee2;};'use strict';var OpenchannelInteractionEvents=require('./openchannelInteraction.events');var events=[_0x68aa('0x0'),_0x68aa('0x1'),_0x68aa('0x2')];function createListener(_0x3943e2,_0x304492){return function(_0x5c75f4){_0x304492[_0x68aa('0x3')](_0x3943e2,_0x5c75f4);};}function removeListener(_0x279442,_0x45474f){return function(){OpenchannelInteractionEvents[_0x68aa('0x4')](_0x279442,_0x45474f);};}exports[_0x68aa('0x5')]=function(_0x54f240){for(var _0xb8f495=0x0,_0x1b15bc=events[_0x68aa('0x6')];_0xb8f495<_0x1b15bc;_0xb8f495++){var _0x186f02=events[_0xb8f495];var _0x3dd4bf=createListener(_0x68aa('0x7')+_0x186f02,_0x54f240);OpenchannelInteractionEvents['on'](_0x186f02,_0x3dd4bf);}}; \ No newline at end of file +var _0xe451=['length','openchannelInteraction:','./openchannelInteraction.events','save','remove','update','removeListener','register'];(function(_0x3a3807,_0x1541e2){var _0x291f29=function(_0x2738bd){while(--_0x2738bd){_0x3a3807['push'](_0x3a3807['shift']());}};_0x291f29(++_0x1541e2);}(_0xe451,0x1ea));var _0x1e45=function(_0x3bb4b7,_0x4934aa){_0x3bb4b7=_0x3bb4b7-0x0;var _0x47ce5b=_0xe451[_0x3bb4b7];return _0x47ce5b;};'use strict';var OpenchannelInteractionEvents=require(_0x1e45('0x0'));var events=[_0x1e45('0x1'),_0x1e45('0x2'),_0x1e45('0x3')];function createListener(_0x45ea47,_0x477dfa){return function(_0x528a36){_0x477dfa['emit'](_0x45ea47,_0x528a36);};}function removeListener(_0x414275,_0x1d62b5){return function(){OpenchannelInteractionEvents[_0x1e45('0x4')](_0x414275,_0x1d62b5);};}exports[_0x1e45('0x5')]=function(_0x45d06b){for(var _0x1f8e2f=0x0,_0x3f66e2=events[_0x1e45('0x6')];_0x1f8e2f<_0x3f66e2;_0x1f8e2f++){var _0x43c6dc=events[_0x1f8e2f];var _0x4f15d4=createListener(_0x1e45('0x7')+_0x43c6dc,_0x45d06b);OpenchannelInteractionEvents['on'](_0x43c6dc,_0x4f15d4);}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/index.js b/server/api/openchannelMessage/index.js index 8cf8f11..d3fb293 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 _0xe706=['fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelMessage.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','tracked','openchannel','openchannelmessage:create','create','update','put','/:id/accept','accept','/:id/reject','exports','multer','util','path','express','Router'];(function(_0x4d2329,_0x5c505a){var _0x37233b=function(_0x300618){while(--_0x300618){_0x4d2329['push'](_0x4d2329['shift']());}};_0x37233b(++_0x5c505a);}(_0xe706,0xa3));var _0x6e70=function(_0x2820fc,_0x481318){_0x2820fc=_0x2820fc-0x0;var _0x1e1508=_0xe706[_0x2820fc];return _0x1e1508;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),interaction[_0x6e70('0x12')](_0x6e70('0x13'),_0x6e70('0x14')),controller[_0x6e70('0x15')]);router['put']('/:id',auth[_0x6e70('0xb')](),controller[_0x6e70('0x16')]);router[_0x6e70('0x17')](_0x6e70('0x18'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x19')]);router[_0x6e70('0x17')](_0x6e70('0x1a'),auth['isAuthenticated'](),controller['reject']);router['delete'](_0x6e70('0xf'),auth['isAuthenticated'](),controller['destroy']);module[_0x6e70('0x1b')]=router; \ No newline at end of file +var _0x0713=['get','isAuthenticated','index','/describe','describe','/:id','post','tracked','openchannel','openchannelmessage:create','put','update','accept','/:id/reject','delete','destroy','exports','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./openchannelMessage.controller'];(function(_0x5d2803,_0xf375bd){var _0xdcad2c=function(_0x3c3a98){while(--_0x3c3a98){_0x5d2803['push'](_0x5d2803['shift']());}};_0xdcad2c(++_0xf375bd);}(_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')](),interaction[_0x3071('0xf')](_0x3071('0x10'),_0x3071('0x11')),controller['create']);router[_0x3071('0x12')](_0x3071('0xd'),auth[_0x3071('0x9')](),controller[_0x3071('0x13')]);router[_0x3071('0x12')]('/:id/accept',auth['isAuthenticated'](),controller[_0x3071('0x14')]);router['put'](_0x3071('0x15'),auth[_0x3071('0x9')](),controller['reject']);router[_0x3071('0x16')]('/:id',auth[_0x3071('0x9')](),controller[_0x3071('0x17')]);module[_0x3071('0x18')]=router; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.attributes.js b/server/api/openchannelMessage/openchannelMessage.attributes.js index 2c0e3cf..6d412c5 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 _0xbc87=['STRING','TEXT','sequelize','medium','BOOLEAN','out','DATE'];(function(_0x56a48f,_0x2e9d81){var _0x19ed7b=function(_0x214c1a){while(--_0x214c1a){_0x56a48f['push'](_0x56a48f['shift']());}};_0x19ed7b(++_0x2e9d81);}(_0xbc87,0x144));var _0x7bc8=function(_0x3ac5fb,_0x5fbe6f){_0x3ac5fb=_0x3ac5fb-0x0;var _0x56260f=_0xbc87[_0x3ac5fb];return _0x56260f;};'use strict';var Sequelize=require(_0x7bc8('0x0'));module['exports']={'body':{'type':Sequelize['TEXT'](_0x7bc8('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x7bc8('0x2')],'defaultValue':![]},'secret':{'type':Sequelize[_0x7bc8('0x2')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':_0x7bc8('0x3'),'allowNull':![]},'readAt':{'type':Sequelize[_0x7bc8('0x4')]},'providerName':{'type':Sequelize[_0x7bc8('0x5')]},'providerResponse':{'type':Sequelize[_0x7bc8('0x6')]}}; \ No newline at end of file +var _0x988c=['BOOLEAN','ENUM','STRING','TEXT','sequelize'];(function(_0x57cbcc,_0x43768c){var _0x170b04=function(_0x124de6){while(--_0x124de6){_0x57cbcc['push'](_0x57cbcc['shift']());}};_0x170b04(++_0x43768c);}(_0x988c,0x19e));var _0xc988=function(_0x228840,_0x4d4281){_0x228840=_0x228840-0x0;var _0xcf66c0=_0x988c[_0x228840];return _0xcf66c0;};'use strict';var Sequelize=require(_0xc988('0x0'));module['exports']={'body':{'type':Sequelize['TEXT']('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xc988('0x1')],'defaultValue':![]},'secret':{'type':Sequelize[_0xc988('0x1')],'defaultValue':![]},'direction':{'type':Sequelize[_0xc988('0x2')]('in','out'),'defaultValue':'out','allowNull':![]},'readAt':{'type':Sequelize['DATE']},'providerName':{'type':Sequelize[_0xc988('0x3')]},'providerResponse':{'type':Sequelize[_0xc988('0x4')]}}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.controller.js b/server/api/openchannelMessage/openchannelMessage.controller.js index 23c87fe..b97fc46 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 _0xe453=['AcceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','openchannel-interactions','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','rejectMessage','event','rejectmessage','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','defaults','redis','localhost','socket.io-emitter','./openchannelMessage.socket','register','jayson/promise','client','http','then','request\x20sent','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','OpenchannelMessage,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','end','stack','name','index','OpenchannelMessage','rawAttributes','fieldName','key','map','query','keys','filters','model','attributes','intersection','fields','length','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','includeAll','include','rows','find','create','body','destroy','params','describe','accept','openchannel','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','OpenchannelInteractionId','read1stAt','interaction','get','info','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null'];(function(_0x29ecbc,_0x2929d9){var _0x5709b0=function(_0x277721){while(--_0x277721){_0x29ecbc['push'](_0x29ecbc['shift']());}};_0x5709b0(++_0x2929d9);}(_0xe453,0x97));var _0x3e45=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe453[_0x57b54c];return _0x59cc19;};'use strict';var emlformat=require(_0x3e45('0x0'));var rimraf=require(_0x3e45('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x3e45('0x2'));var rp=require(_0x3e45('0x3'));var moment=require('moment');var BPromise=require(_0x3e45('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0x3e45('0x5'));var sox=require(_0x3e45('0x6'));var csv=require(_0x3e45('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x3e45('0x8'));var _=require(_0x3e45('0x9'));var squel=require(_0x3e45('0xa'));var crypto=require(_0x3e45('0xb'));var jsforce=require(_0x3e45('0xc'));var deskjs=require(_0x3e45('0xd'));var toCsv=require(_0x3e45('0x7'));var querystring=require(_0x3e45('0xe'));var Papa=require(_0x3e45('0xf'));var Redis=require(_0x3e45('0x10'));var authService=require(_0x3e45('0x11'));var qs=require(_0x3e45('0x12'));var as=require(_0x3e45('0x13'));var hardwareService=require(_0x3e45('0x14'));var logger=require(_0x3e45('0x15'))(_0x3e45('0x16'));var utils=require(_0x3e45('0x17'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x3e45('0x18'))['db'];config['redis']=_[_0x3e45('0x19')](config[_0x3e45('0x1a')],{'host':_0x3e45('0x1b'),'port':0x18eb});var socket=require(_0x3e45('0x1c'))(new Redis(config['redis']));require(_0x3e45('0x1d'))[_0x3e45('0x1e')](socket);var jayson=require(_0x3e45('0x1f'));var client=jayson[_0x3e45('0x20')][_0x3e45('0x21')]({'port':0x232c});var client9002=jayson[_0x3e45('0x20')][_0x3e45('0x21')]({'port':0x232a});function respondWithRpcPromise(_0x293c3d,_0x3e0286,_0x10df45,_0x14cfc1){return new BPromise(function(_0x189e4e,_0x1cb6e9){var _0x2e59a8=_0x14cfc1||client;return _0x2e59a8['request'](_0x293c3d,_0x10df45)[_0x3e45('0x22')](function(_0x5d8589){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x3e0286,_0x3e45('0x23'));logger['debug'](_0x3e45('0x24'),_0x3e0286,'request\x20sent',JSON[_0x3e45('0x25')](_0x5d8589));if(_0x5d8589['error']){if(_0x5d8589[_0x3e45('0x26')]['code']===0x1f4){logger[_0x3e45('0x26')](_0x3e45('0x27'),_0x3e0286,_0x5d8589[_0x3e45('0x26')][_0x3e45('0x28')]);return _0x1cb6e9(_0x5d8589[_0x3e45('0x26')][_0x3e45('0x28')]);}logger['error'](_0x3e45('0x27'),_0x3e0286,_0x5d8589['error'][_0x3e45('0x28')]);return _0x189e4e(_0x5d8589[_0x3e45('0x26')]['message']);}else{logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x3e0286,'request\x20sent');_0x189e4e(_0x5d8589[_0x3e45('0x29')][_0x3e45('0x28')]);}})[_0x3e45('0x2a')](function(_0x3f08ea){logger[_0x3e45('0x26')](_0x3e45('0x27'),_0x3e0286,_0x3f08ea);_0x1cb6e9(_0x3f08ea);});});}function respondWithStatusCode(_0x2e5a65,_0x281c05){_0x281c05=_0x281c05||0xcc;return function(_0x459ed4){if(_0x459ed4){return _0x2e5a65[_0x3e45('0x2b')](_0x281c05);}return _0x2e5a65[_0x3e45('0x2c')](_0x281c05)['end']();};}function respondWithResult(_0x40cf98,_0x15e401){_0x15e401=_0x15e401||0xc8;return function(_0x1aef3a){if(_0x1aef3a){return _0x40cf98[_0x3e45('0x2c')](_0x15e401)[_0x3e45('0x2d')](_0x1aef3a);}};}function respondWithFilteredResult(_0x1982ff,_0x19f3b1){return function(_0x400bfb){if(_0x400bfb){var _0x59ba97=typeof _0x19f3b1[_0x3e45('0x2e')]===_0x3e45('0x2f')&&typeof _0x19f3b1[_0x3e45('0x30')]==='undefined';var _0x3d82d3=_0x400bfb['count'];var _0x4206c7=_0x59ba97?0x0:_0x19f3b1['offset'];var _0x4419e0=_0x59ba97?_0x400bfb[_0x3e45('0x31')]:_0x19f3b1[_0x3e45('0x2e')]+_0x19f3b1[_0x3e45('0x30')];var _0x4166a1;if(_0x4419e0>=_0x3d82d3){_0x4419e0=_0x3d82d3;_0x4166a1=0xc8;}else{_0x4166a1=0xce;}_0x1982ff['status'](_0x4166a1);return _0x1982ff[_0x3e45('0x32')](_0x3e45('0x33'),_0x4206c7+'-'+_0x4419e0+'/'+_0x3d82d3)[_0x3e45('0x2d')](_0x400bfb);}return null;};}function patchUpdates(_0x22ff51){return function(_0x59894f){try{jsonpatch[_0x3e45('0x34')](_0x59894f,_0x22ff51,!![]);}catch(_0x2c16f1){return BPromise[_0x3e45('0x35')](_0x2c16f1);}return _0x59894f[_0x3e45('0x36')]();};}function saveUpdates(_0x302dce,_0x58232f){return function(_0x52fd1a){if(_0x52fd1a){return _0x52fd1a['update'](_0x302dce)[_0x3e45('0x22')](function(_0x480090){return _0x480090;});}return null;};}function removeEntity(_0x11cf8e,_0x57a0a5){return function(_0x5d4f3e){if(_0x5d4f3e){return _0x5d4f3e['destroy']()['then'](function(){_0x11cf8e[_0x3e45('0x2c')](0xcc)[_0x3e45('0x37')]();});}};}function handleEntityNotFound(_0x1e9a77,_0x496c81){return function(_0x729542){if(!_0x729542){_0x1e9a77[_0x3e45('0x2b')](0x194);}return _0x729542;};}function handleError(_0x48b4b2,_0x1611ce){_0x1611ce=_0x1611ce||0x1f4;return function(_0x247abd){logger[_0x3e45('0x26')](_0x247abd[_0x3e45('0x38')]);if(_0x247abd[_0x3e45('0x39')]){delete _0x247abd['name'];}_0x48b4b2['status'](_0x1611ce)['send'](_0x247abd);};}exports[_0x3e45('0x3a')]=function(_0x48c001,_0x2407ad){var _0x56f237={},_0x3b9d96={},_0x41d36c={'count':0x0,'rows':[]};var _0x445a43=_['map'](db[_0x3e45('0x3b')][_0x3e45('0x3c')],function(_0x45f7f0){return{'name':_0x45f7f0[_0x3e45('0x3d')],'type':_0x45f7f0['type'][_0x3e45('0x3e')]};});_0x3b9d96['model']=_[_0x3e45('0x3f')](_0x445a43,_0x3e45('0x39'));_0x3b9d96[_0x3e45('0x40')]=_[_0x3e45('0x41')](_0x48c001[_0x3e45('0x40')]);_0x3b9d96[_0x3e45('0x42')]=_['intersection'](_0x3b9d96[_0x3e45('0x43')],_0x3b9d96[_0x3e45('0x40')]);_0x56f237[_0x3e45('0x44')]=_[_0x3e45('0x45')](_0x3b9d96[_0x3e45('0x43')],qs[_0x3e45('0x46')](_0x48c001[_0x3e45('0x40')][_0x3e45('0x46')]));_0x56f237['attributes']=_0x56f237[_0x3e45('0x44')][_0x3e45('0x47')]?_0x56f237[_0x3e45('0x44')]:_0x3b9d96[_0x3e45('0x43')];if(!_0x48c001['query']['hasOwnProperty'](_0x3e45('0x48'))){_0x56f237[_0x3e45('0x30')]=qs[_0x3e45('0x30')](_0x48c001[_0x3e45('0x40')][_0x3e45('0x30')]);_0x56f237[_0x3e45('0x2e')]=qs['offset'](_0x48c001[_0x3e45('0x40')][_0x3e45('0x2e')]);}_0x56f237[_0x3e45('0x49')]=qs[_0x3e45('0x4a')](_0x48c001[_0x3e45('0x40')][_0x3e45('0x4a')]);_0x56f237[_0x3e45('0x4b')]=qs[_0x3e45('0x42')](_['pick'](_0x48c001[_0x3e45('0x40')],_0x3b9d96[_0x3e45('0x42')]),_0x445a43);if(_0x48c001[_0x3e45('0x40')]['filter']){_0x56f237[_0x3e45('0x4b')]=_[_0x3e45('0x4c')](_0x56f237[_0x3e45('0x4b')],{'$or':_[_0x3e45('0x3f')](_0x445a43,function(_0x4a7a49){if(_0x4a7a49[_0x3e45('0x4d')]!==_0x3e45('0x4e')){var _0x34db1e={};_0x34db1e[_0x4a7a49[_0x3e45('0x39')]]={'$like':'%'+_0x48c001['query'][_0x3e45('0x4f')]+'%'};return _0x34db1e;}})});}_0x56f237=_[_0x3e45('0x4c')]({},_0x56f237,_0x48c001[_0x3e45('0x50')]);var _0x1c4703={'where':_0x56f237['where']};return db[_0x3e45('0x3b')]['count'](_0x1c4703)['then'](function(_0x4cf62f){_0x41d36c[_0x3e45('0x31')]=_0x4cf62f;if(_0x48c001[_0x3e45('0x40')][_0x3e45('0x51')]){_0x56f237[_0x3e45('0x52')]=[{'all':!![]}];}return db[_0x3e45('0x3b')]['findAll'](_0x56f237);})[_0x3e45('0x22')](function(_0x267cba){_0x41d36c[_0x3e45('0x53')]=_0x267cba;return _0x41d36c;})[_0x3e45('0x22')](respondWithFilteredResult(_0x2407ad,_0x56f237))[_0x3e45('0x2a')](handleError(_0x2407ad,null));};exports['show']=function(_0x36b6ff,_0x2ea707){var _0x2cf963={'raw':!![],'where':{'id':_0x36b6ff['params']['id']}},_0x22ec6d={};_0x22ec6d[_0x3e45('0x43')]=_[_0x3e45('0x41')](db[_0x3e45('0x3b')][_0x3e45('0x3c')]);_0x22ec6d['query']=_[_0x3e45('0x41')](_0x36b6ff[_0x3e45('0x40')]);_0x22ec6d['filters']=_[_0x3e45('0x45')](_0x22ec6d[_0x3e45('0x43')],_0x22ec6d[_0x3e45('0x40')]);_0x2cf963[_0x3e45('0x44')]=_[_0x3e45('0x45')](_0x22ec6d[_0x3e45('0x43')],qs[_0x3e45('0x46')](_0x36b6ff[_0x3e45('0x40')][_0x3e45('0x46')]));_0x2cf963[_0x3e45('0x44')]=_0x2cf963[_0x3e45('0x44')][_0x3e45('0x47')]?_0x2cf963[_0x3e45('0x44')]:_0x22ec6d[_0x3e45('0x43')];if(_0x36b6ff['query'][_0x3e45('0x51')]){_0x2cf963['include']=[{'all':!![]}];}_0x2cf963=_[_0x3e45('0x4c')]({},_0x2cf963,_0x36b6ff[_0x3e45('0x50')]);return db[_0x3e45('0x3b')][_0x3e45('0x54')](_0x2cf963)[_0x3e45('0x22')](handleEntityNotFound(_0x2ea707,null))[_0x3e45('0x22')](respondWithResult(_0x2ea707,null))[_0x3e45('0x2a')](handleError(_0x2ea707,null));};exports[_0x3e45('0x55')]=function(_0x364662,_0x3f3212){return db['OpenchannelMessage'][_0x3e45('0x55')](_0x364662[_0x3e45('0x56')],{})[_0x3e45('0x22')](respondWithResult(_0x3f3212,0xc9))[_0x3e45('0x2a')](handleError(_0x3f3212,null));};exports['update']=function(_0x1c72ff,_0x765fb4){if(_0x1c72ff[_0x3e45('0x56')]['id']){delete _0x1c72ff[_0x3e45('0x56')]['id'];}return db[_0x3e45('0x3b')][_0x3e45('0x54')]({'where':{'id':_0x1c72ff['params']['id']}})[_0x3e45('0x22')](handleEntityNotFound(_0x765fb4,null))[_0x3e45('0x22')](saveUpdates(_0x1c72ff[_0x3e45('0x56')],null))['then'](respondWithResult(_0x765fb4,null))[_0x3e45('0x2a')](handleError(_0x765fb4,null));};exports[_0x3e45('0x57')]=function(_0x13a36a,_0x231266){return db[_0x3e45('0x3b')][_0x3e45('0x54')]({'where':{'id':_0x13a36a[_0x3e45('0x58')]['id']}})[_0x3e45('0x22')](handleEntityNotFound(_0x231266,null))[_0x3e45('0x22')](removeEntity(_0x231266,null))[_0x3e45('0x2a')](handleError(_0x231266,null));};exports[_0x3e45('0x59')]=function(_0x185507,_0x461b1a){return db['OpenchannelMessage']['describe']()[_0x3e45('0x22')](respondWithResult(_0x461b1a,null))['catch'](handleError(_0x461b1a,null));};var interaction_log=require(_0x3e45('0x15'))('openchannel-interactions');exports[_0x3e45('0x5a')]=function(_0xc1dba0,_0x88725,_0x11f13a){var _0xbd6590={'agent':{},'channel':_0x3e45('0x5b')};if(_0xc1dba0[_0x3e45('0x56')]['id']){delete _0xc1dba0['body']['id'];}_0xc1dba0[_0x3e45('0x56')]['read']=!![];_0xc1dba0[_0x3e45('0x56')]['readAt']=moment()[_0x3e45('0x5c')](_0x3e45('0x5d'));_0xc1dba0[_0x3e45('0x56')]['UserId']=_0xc1dba0[_0x3e45('0x56')][_0x3e45('0x5e')]||_0xc1dba0[_0x3e45('0x5f')]['id'];_0xbd6590[_0x3e45('0x60')]['id']=_0xc1dba0[_0x3e45('0x56')]['UserId'];return db[_0x3e45('0x3b')][_0x3e45('0x54')]({'where':{'id':_0xc1dba0['params']['id'],'UserId':null}})[_0x3e45('0x22')](handleEntityNotFound(_0x88725,null))[_0x3e45('0x22')](saveUpdates(_0xc1dba0['body'],null))[_0x3e45('0x22')](function(_0x3e42bb){if(_0x3e42bb){_0xbd6590['message']=_0x3e42bb['get']({'plain':!![]});return db['OpenchannelInteraction'][_0x3e45('0x54')]({'where':{'id':_0x3e42bb[_0x3e45('0x61')]}});}return null;})[_0x3e45('0x22')](handleEntityNotFound(_0x88725,null))['then'](function(_0x3116ae){if(_0x3116ae){return _0x3116ae['update']({'UserId':_0xc1dba0[_0x3e45('0x56')][_0x3e45('0x5e')],'read1stAt':_['isNil'](_0x3116ae[_0x3e45('0x62')])?moment()[_0x3e45('0x5c')](_0x3e45('0x5d')):undefined});}return null;})['then'](function(_0x1f8e9f){if(_0x1f8e9f){_0xbd6590[_0x3e45('0x63')]=_0x1f8e9f[_0x3e45('0x64')]({'plain':!![]});interaction_log[_0x3e45('0x65')](_0x3e45('0x66'),_0xc1dba0[_0x3e45('0x5f')]['id'],_0xc1dba0[_0x3e45('0x5f')][_0x3e45('0x39')],_0xc1dba0[_0x3e45('0x5f')][_0x3e45('0x67')],_0xbd6590[_0x3e45('0x63')]['id'],_0xc1dba0['body']?JSON[_0x3e45('0x25')](_0xc1dba0[_0x3e45('0x56')]):_0x3e45('0x68'));return respondWithRpcPromise(_0x3e45('0x69'),'acceptMessage',_0xbd6590);}return null;})[_0x3e45('0x22')](function(_0x3f265b){var _0x1a0e01=_0x3e45('0x6a')+_0x3f265b[_0x3e45('0x28')][_0x3e45('0x6b')];return db[_0x3e45('0x6c')]['query'](_0x1a0e01,{'type':db[_0x3e45('0x6d')][_0x3e45('0x6e')][_0x3e45('0x6f')],'raw':!![]})[_0x3e45('0x22')](function(_0x3fbb6c){return _0x3fbb6c;});})[_0x3e45('0x22')](function(_0x5cb051){if(_0x5cb051){_0xbd6590[_0x3e45('0x28')][_0x3e45('0x70')]=_0x5cb051[0x0];if(!_0xc1dba0[_0x3e45('0x56')][_0x3e45('0x5e')])return;return db[_0x3e45('0x71')]['find']({'where':{'id':_0xc1dba0[_0x3e45('0x56')][_0x3e45('0x5e')],'role':_0x3e45('0x60')},'attributes':['id','name',_0x3e45('0x72'),_0x3e45('0x73'),'internal'],'raw':!![]});}return null;})[_0x3e45('0x22')](function(_0x55d708){if(!_0x55d708)return null;_0xbd6590['message'][_0x3e45('0x60')]=_0x55d708;return _0xbd6590;})['then'](function(_0x5ed828){if(_0x5ed828){if(_0xc1dba0['body'][_0x3e45('0x74')]){_0xbd6590['message'][_0x3e45('0x75')]=util[_0x3e45('0x5c')](_0x3e45('0x76'),_0xc1dba0[_0x3e45('0x5f')]['name']);_0xbd6590[_0x3e45('0x28')][_0x3e45('0x77')]=_0xbd6590[_0x3e45('0x77')];_0xbd6590[_0x3e45('0x28')][_0x3e45('0x78')]=_0xbd6590[_0x3e45('0x77')];_0xbd6590[_0x3e45('0x28')]['event']=_0x3e45('0x5a');return respondWithRpcPromise(_0x3e45('0x79'),_0x3e45('0x79'),{'event':_0x3e45('0x7a'),'message':_0xbd6590[_0x3e45('0x28')]},client9002)[_0x3e45('0x22')](function(){return _0xbd6590;});}return _0xbd6590;}return null;})[_0x3e45('0x22')](respondWithResult(_0x88725,null))[_0x3e45('0x2a')](handleError(_0x88725,null));};var interaction_log=require('../../config/logger')(_0x3e45('0x7b'));exports[_0x3e45('0x35')]=function(_0xf18552,_0x105f54,_0x56721e){var _0xd3cf85={'agent':{},'channel':_0x3e45('0x5b')};if(_0xf18552[_0x3e45('0x56')]['id']){delete _0xf18552['body']['id'];}_0xf18552[_0x3e45('0x56')][_0x3e45('0x5e')]=_0xf18552[_0x3e45('0x56')][_0x3e45('0x5e')]||_0xf18552[_0x3e45('0x5f')]['id'];_0xd3cf85[_0x3e45('0x60')]['id']=_0xf18552[_0x3e45('0x56')][_0x3e45('0x5e')];return db[_0x3e45('0x3b')][_0x3e45('0x54')]({'where':{'id':_0xf18552[_0x3e45('0x58')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x105f54,null))[_0x3e45('0x22')](function(_0x1d401d){if(_0x1d401d){_0xd3cf85['message']=_0x1d401d[_0x3e45('0x64')]({'plain':!![]});return db['OpenchannelInteraction'][_0x3e45('0x54')]({'where':{'id':_0x1d401d[_0x3e45('0x61')]}});}return null;})[_0x3e45('0x22')](handleEntityNotFound(_0x105f54,null))[_0x3e45('0x22')](function(_0x2389ca){if(_0x2389ca){_0xd3cf85[_0x3e45('0x63')]=_0x2389ca[_0x3e45('0x64')]({'plain':!![]});interaction_log['info'](_0x3e45('0x7c'),_0xf18552[_0x3e45('0x5f')]['id'],_0xf18552[_0x3e45('0x5f')]['name'],_0xf18552[_0x3e45('0x5f')]['role'],_0xd3cf85[_0x3e45('0x63')]['id'],_0xf18552[_0x3e45('0x56')]?JSON[_0x3e45('0x25')](_0xf18552['body']):'null');return respondWithRpcPromise('RejectMessage',_0x3e45('0x7d'),_0xd3cf85);}return null;})['then'](function(_0x22aee7){var _0x2e2ffd=_0x3e45('0x6a')+_0x22aee7[_0x3e45('0x28')]['ContactId'];return db[_0x3e45('0x6c')][_0x3e45('0x40')](_0x2e2ffd,{'type':db[_0x3e45('0x6d')]['QueryTypes'][_0x3e45('0x6f')],'raw':!![]})[_0x3e45('0x22')](function(_0x51b8ec){return _0x51b8ec;});})[_0x3e45('0x22')](function(_0x282395){if(_0x282395){_0xd3cf85[_0x3e45('0x28')][_0x3e45('0x70')]=_0x282395[0x0];if(!_0xf18552['body'][_0x3e45('0x5e')])return;return db[_0x3e45('0x71')]['find']({'where':{'id':_0xf18552['body'][_0x3e45('0x5e')],'role':_0x3e45('0x60')},'attributes':['id','name',_0x3e45('0x72'),_0x3e45('0x73'),'internal'],'raw':!![]});}return null;})['then'](function(_0x162413){if(!_0x162413)return null;_0xd3cf85[_0x3e45('0x28')]['agent']=_0x162413;return _0xd3cf85;})['then'](function(_0x3b967b){if(_0x3b967b){_0x3b967b[_0x3e45('0x28')][_0x3e45('0x75')]=util[_0x3e45('0x5c')]('SIP/%s',_0xf18552['user'][_0x3e45('0x39')]);_0x3b967b['message'][_0x3e45('0x77')]=_0xd3cf85['channel'];_0x3b967b[_0x3e45('0x28')][_0x3e45('0x78')]=_0xd3cf85['channel'];_0x3b967b[_0x3e45('0x28')][_0x3e45('0x7e')]=_0x3e45('0x35');respondWithRpcPromise(_0x3e45('0x79'),'EventManager',{'event':_0x3e45('0x7f'),'message':_0x3b967b[_0x3e45('0x28')]},client9002);return _0xd3cf85;}return null;})[_0x3e45('0x22')](respondWithResult(_0x105f54,null))[_0x3e45('0x2a')](handleError(_0x105f54,null));}; \ No newline at end of file +var _0x85d6=['catch','create','body','describe','openchannel-interactions','openchannel','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','OpenchannelInteraction','OpenchannelInteractionId','isNil','read1stAt','interaction','[OPENCHANNELMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','Sequelize','QueryTypes','contact','User','agent','email','internal','manual','channel','event','accept','EventManager','acceptmessage','[OPENCHANNELMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','RejectMessage','rejectMessage','ContactId','sequelize','SELECT','fullname','SIP/%s','motionChannel','reject','rejectmessage','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','jayson/promise','client','http','request','then','OpenchannelMessage,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info','status','json','undefined','limit','count','offset','Content-Range','apply','update','destroy','end','name','send','index','map','OpenchannelMessage','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','filter','where','merge','type','VIRTUAL','options','include','rows','show','params','includeAll','find'];(function(_0x1d1779,_0x284147){var _0x2377e9=function(_0x299f6f){while(--_0x299f6f){_0x1d1779['push'](_0x1d1779['shift']());}};_0x2377e9(++_0x284147);}(_0x85d6,0x135));var _0x685d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x85d6[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x685d('0x0'));var rimraf=require(_0x685d('0x1'));var zipdir=require(_0x685d('0x2'));var jsonpatch=require(_0x685d('0x3'));var rp=require(_0x685d('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x685d('0x5'));var util=require('util');var path=require(_0x685d('0x6'));var sox=require(_0x685d('0x7'));var csv=require(_0x685d('0x8'));var ejs=require(_0x685d('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x685d('0xa'));var squel=require(_0x685d('0xb'));var crypto=require(_0x685d('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x685d('0xd'));var Papa=require('papaparse');var Redis=require(_0x685d('0xe'));var authService=require(_0x685d('0xf'));var qs=require(_0x685d('0x10'));var as=require(_0x685d('0x11'));var hardwareService=require(_0x685d('0x12'));var logger=require(_0x685d('0x13'))('api');var utils=require(_0x685d('0x14'));var config=require(_0x685d('0x15'));var licenseUtil=require(_0x685d('0x16'));var db=require(_0x685d('0x17'))['db'];config[_0x685d('0x18')]=_[_0x685d('0x19')](config[_0x685d('0x18')],{'host':_0x685d('0x1a'),'port':0x18eb});var socket=require(_0x685d('0x1b'))(new Redis(config[_0x685d('0x18')]));require(_0x685d('0x1c'))['register'](socket);var jayson=require(_0x685d('0x1d'));var client=jayson[_0x685d('0x1e')][_0x685d('0x1f')]({'port':0x232c});var client9002=jayson['client'][_0x685d('0x1f')]({'port':0x232a});function respondWithRpcPromise(_0x6102ba,_0x3ab65d,_0x1a7c2d,_0x32baaf){return new BPromise(function(_0x2a373e,_0x4ea443){var _0x5cb2c1=_0x32baaf||client;return _0x5cb2c1[_0x685d('0x20')](_0x6102ba,_0x1a7c2d)[_0x685d('0x21')](function(_0x2bdda0){logger['info'](_0x685d('0x22'),_0x3ab65d,'request\x20sent');logger[_0x685d('0x23')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x3ab65d,_0x685d('0x24'),JSON[_0x685d('0x25')](_0x2bdda0));if(_0x2bdda0[_0x685d('0x26')]){if(_0x2bdda0['error'][_0x685d('0x27')]===0x1f4){logger[_0x685d('0x26')]('OpenchannelMessage,\x20%s,\x20%s',_0x3ab65d,_0x2bdda0['error'][_0x685d('0x28')]);return _0x4ea443(_0x2bdda0[_0x685d('0x26')][_0x685d('0x28')]);}logger[_0x685d('0x26')](_0x685d('0x22'),_0x3ab65d,_0x2bdda0['error'][_0x685d('0x28')]);return _0x2a373e(_0x2bdda0['error'][_0x685d('0x28')]);}else{logger[_0x685d('0x29')](_0x685d('0x22'),_0x3ab65d,'request\x20sent');_0x2a373e(_0x2bdda0['result'][_0x685d('0x28')]);}})['catch'](function(_0x412391){logger[_0x685d('0x26')](_0x685d('0x22'),_0x3ab65d,_0x412391);_0x4ea443(_0x412391);});});}function respondWithStatusCode(_0x404131,_0x539c7b){_0x539c7b=_0x539c7b||0xcc;return function(_0x9e1bb4){if(_0x9e1bb4){return _0x404131['sendStatus'](_0x539c7b);}return _0x404131[_0x685d('0x2a')](_0x539c7b)['end']();};}function respondWithResult(_0x5c638a,_0x32e4f7){_0x32e4f7=_0x32e4f7||0xc8;return function(_0x867082){if(_0x867082){return _0x5c638a[_0x685d('0x2a')](_0x32e4f7)[_0x685d('0x2b')](_0x867082);}};}function respondWithFilteredResult(_0x48275e,_0x6246e5){return function(_0x4d84d3){if(_0x4d84d3){var _0x1b6f3a=typeof _0x6246e5['offset']===_0x685d('0x2c')&&typeof _0x6246e5[_0x685d('0x2d')]===_0x685d('0x2c');var _0x4b37e4=_0x4d84d3[_0x685d('0x2e')];var _0x53a32c=_0x1b6f3a?0x0:_0x6246e5['offset'];var _0x58fba9=_0x1b6f3a?_0x4d84d3[_0x685d('0x2e')]:_0x6246e5[_0x685d('0x2f')]+_0x6246e5[_0x685d('0x2d')];var _0xa0a2f1;if(_0x58fba9>=_0x4b37e4){_0x58fba9=_0x4b37e4;_0xa0a2f1=0xc8;}else{_0xa0a2f1=0xce;}_0x48275e[_0x685d('0x2a')](_0xa0a2f1);return _0x48275e['set'](_0x685d('0x30'),_0x53a32c+'-'+_0x58fba9+'/'+_0x4b37e4)[_0x685d('0x2b')](_0x4d84d3);}return null;};}function patchUpdates(_0x3c24dc){return function(_0x3e8a19){try{jsonpatch[_0x685d('0x31')](_0x3e8a19,_0x3c24dc,!![]);}catch(_0x47e7aa){return BPromise['reject'](_0x47e7aa);}return _0x3e8a19['save']();};}function saveUpdates(_0x41f508,_0x2fb89e){return function(_0x2e18c5){if(_0x2e18c5){return _0x2e18c5[_0x685d('0x32')](_0x41f508)['then'](function(_0x618350){return _0x618350;});}return null;};}function removeEntity(_0x360810,_0x4c4d52){return function(_0xa81e39){if(_0xa81e39){return _0xa81e39[_0x685d('0x33')]()[_0x685d('0x21')](function(){_0x360810[_0x685d('0x2a')](0xcc)[_0x685d('0x34')]();});}};}function handleEntityNotFound(_0x5c0ca7,_0xd768f0){return function(_0x266c45){if(!_0x266c45){_0x5c0ca7['sendStatus'](0x194);}return _0x266c45;};}function handleError(_0x1fbabf,_0x495c9e){_0x495c9e=_0x495c9e||0x1f4;return function(_0x253bfc){logger[_0x685d('0x26')](_0x253bfc['stack']);if(_0x253bfc[_0x685d('0x35')]){delete _0x253bfc[_0x685d('0x35')];}_0x1fbabf[_0x685d('0x2a')](_0x495c9e)[_0x685d('0x36')](_0x253bfc);};}exports[_0x685d('0x37')]=function(_0x4834d9,_0x3cc9ac){var _0x378df8={},_0x44baaa={},_0x4aca7c={'count':0x0,'rows':[]};var _0x53e6a9=_[_0x685d('0x38')](db[_0x685d('0x39')][_0x685d('0x3a')],function(_0x5bd03d){return{'name':_0x5bd03d[_0x685d('0x3b')],'type':_0x5bd03d['type'][_0x685d('0x3c')]};});_0x44baaa[_0x685d('0x3d')]=_[_0x685d('0x38')](_0x53e6a9,_0x685d('0x35'));_0x44baaa[_0x685d('0x3e')]=_[_0x685d('0x3f')](_0x4834d9[_0x685d('0x3e')]);_0x44baaa[_0x685d('0x40')]=_[_0x685d('0x41')](_0x44baaa[_0x685d('0x3d')],_0x44baaa[_0x685d('0x3e')]);_0x378df8[_0x685d('0x42')]=_[_0x685d('0x41')](_0x44baaa['model'],qs[_0x685d('0x43')](_0x4834d9[_0x685d('0x3e')][_0x685d('0x43')]));_0x378df8[_0x685d('0x42')]=_0x378df8[_0x685d('0x42')][_0x685d('0x44')]?_0x378df8['attributes']:_0x44baaa[_0x685d('0x3d')];if(!_0x4834d9[_0x685d('0x3e')][_0x685d('0x45')]('nolimit')){_0x378df8[_0x685d('0x2d')]=qs['limit'](_0x4834d9[_0x685d('0x3e')]['limit']);_0x378df8[_0x685d('0x2f')]=qs[_0x685d('0x2f')](_0x4834d9[_0x685d('0x3e')][_0x685d('0x2f')]);}_0x378df8[_0x685d('0x46')]=qs[_0x685d('0x47')](_0x4834d9[_0x685d('0x3e')][_0x685d('0x47')]);_0x378df8['where']=qs['filters'](_['pick'](_0x4834d9[_0x685d('0x3e')],_0x44baaa[_0x685d('0x40')]),_0x53e6a9);if(_0x4834d9[_0x685d('0x3e')][_0x685d('0x48')]){_0x378df8[_0x685d('0x49')]=_[_0x685d('0x4a')](_0x378df8['where'],{'$or':_[_0x685d('0x38')](_0x53e6a9,function(_0x1aa9f0){if(_0x1aa9f0[_0x685d('0x4b')]!==_0x685d('0x4c')){var _0x5d8230={};_0x5d8230[_0x1aa9f0['name']]={'$like':'%'+_0x4834d9[_0x685d('0x3e')]['filter']+'%'};return _0x5d8230;}})});}_0x378df8=_['merge']({},_0x378df8,_0x4834d9[_0x685d('0x4d')]);var _0x29891b={'where':_0x378df8[_0x685d('0x49')]};return db['OpenchannelMessage']['count'](_0x29891b)[_0x685d('0x21')](function(_0x436fff){_0x4aca7c['count']=_0x436fff;if(_0x4834d9[_0x685d('0x3e')]['includeAll']){_0x378df8[_0x685d('0x4e')]=[{'all':!![]}];}return db[_0x685d('0x39')]['findAll'](_0x378df8);})[_0x685d('0x21')](function(_0x1e6c3c){_0x4aca7c[_0x685d('0x4f')]=_0x1e6c3c;return _0x4aca7c;})[_0x685d('0x21')](respondWithFilteredResult(_0x3cc9ac,_0x378df8))['catch'](handleError(_0x3cc9ac,null));};exports[_0x685d('0x50')]=function(_0x2db7fa,_0x4b2f7b){var _0x306a57={'raw':!![],'where':{'id':_0x2db7fa[_0x685d('0x51')]['id']}},_0x252a28={};_0x252a28[_0x685d('0x3d')]=_[_0x685d('0x3f')](db['OpenchannelMessage']['rawAttributes']);_0x252a28[_0x685d('0x3e')]=_[_0x685d('0x3f')](_0x2db7fa[_0x685d('0x3e')]);_0x252a28[_0x685d('0x40')]=_['intersection'](_0x252a28[_0x685d('0x3d')],_0x252a28[_0x685d('0x3e')]);_0x306a57[_0x685d('0x42')]=_[_0x685d('0x41')](_0x252a28[_0x685d('0x3d')],qs['fields'](_0x2db7fa[_0x685d('0x3e')][_0x685d('0x43')]));_0x306a57[_0x685d('0x42')]=_0x306a57['attributes'][_0x685d('0x44')]?_0x306a57[_0x685d('0x42')]:_0x252a28[_0x685d('0x3d')];if(_0x2db7fa['query'][_0x685d('0x52')]){_0x306a57[_0x685d('0x4e')]=[{'all':!![]}];}_0x306a57=_[_0x685d('0x4a')]({},_0x306a57,_0x2db7fa[_0x685d('0x4d')]);return db['OpenchannelMessage'][_0x685d('0x53')](_0x306a57)[_0x685d('0x21')](handleEntityNotFound(_0x4b2f7b,null))[_0x685d('0x21')](respondWithResult(_0x4b2f7b,null))[_0x685d('0x54')](handleError(_0x4b2f7b,null));};exports['create']=function(_0x47dc35,_0x350bc9){return db[_0x685d('0x39')][_0x685d('0x55')](_0x47dc35[_0x685d('0x56')],{})['then'](respondWithResult(_0x350bc9,0xc9))[_0x685d('0x54')](handleError(_0x350bc9,null));};exports[_0x685d('0x32')]=function(_0x21ba24,_0x2cbc49){if(_0x21ba24['body']['id']){delete _0x21ba24[_0x685d('0x56')]['id'];}return db['OpenchannelMessage'][_0x685d('0x53')]({'where':{'id':_0x21ba24[_0x685d('0x51')]['id']}})[_0x685d('0x21')](handleEntityNotFound(_0x2cbc49,null))[_0x685d('0x21')](saveUpdates(_0x21ba24[_0x685d('0x56')],null))['then'](respondWithResult(_0x2cbc49,null))[_0x685d('0x54')](handleError(_0x2cbc49,null));};exports[_0x685d('0x33')]=function(_0x203db5,_0x391c78){return db[_0x685d('0x39')][_0x685d('0x53')]({'where':{'id':_0x203db5['params']['id']}})['then'](handleEntityNotFound(_0x391c78,null))[_0x685d('0x21')](removeEntity(_0x391c78,null))[_0x685d('0x54')](handleError(_0x391c78,null));};exports[_0x685d('0x57')]=function(_0x1e4ed3,_0x47fcca){return db[_0x685d('0x39')][_0x685d('0x57')]()['then'](respondWithResult(_0x47fcca,null))[_0x685d('0x54')](handleError(_0x47fcca,null));};var interaction_log=require(_0x685d('0x13'))(_0x685d('0x58'));exports['accept']=function(_0x13239e,_0x31f60f,_0x362160){var _0xc5a0f4={'agent':{},'channel':_0x685d('0x59')};if(_0x13239e[_0x685d('0x56')]['id']){delete _0x13239e['body']['id'];}_0x13239e['body'][_0x685d('0x5a')]=!![];_0x13239e[_0x685d('0x56')]['readAt']=moment()[_0x685d('0x5b')](_0x685d('0x5c'));_0x13239e[_0x685d('0x56')][_0x685d('0x5d')]=_0x13239e[_0x685d('0x56')][_0x685d('0x5d')]||_0x13239e['user']['id'];_0xc5a0f4['agent']['id']=_0x13239e[_0x685d('0x56')][_0x685d('0x5d')];return db[_0x685d('0x39')][_0x685d('0x53')]({'where':{'id':_0x13239e[_0x685d('0x51')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x31f60f,null))[_0x685d('0x21')](saveUpdates(_0x13239e[_0x685d('0x56')],null))['then'](function(_0x196f6c){if(_0x196f6c){_0xc5a0f4[_0x685d('0x28')]=_0x196f6c[_0x685d('0x5e')]({'plain':!![]});return db[_0x685d('0x5f')][_0x685d('0x53')]({'where':{'id':_0x196f6c[_0x685d('0x60')]}});}return null;})[_0x685d('0x21')](handleEntityNotFound(_0x31f60f,null))['then'](function(_0x41a8fa){if(_0x41a8fa){return _0x41a8fa['update']({'UserId':_0x13239e[_0x685d('0x56')][_0x685d('0x5d')],'read1stAt':_[_0x685d('0x61')](_0x41a8fa[_0x685d('0x62')])?moment()[_0x685d('0x5b')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x685d('0x21')](function(_0x469352){if(_0x469352){_0xc5a0f4[_0x685d('0x63')]=_0x469352['get']({'plain':!![]});interaction_log[_0x685d('0x29')](_0x685d('0x64'),_0x13239e[_0x685d('0x65')]['id'],_0x13239e[_0x685d('0x65')]['name'],_0x13239e[_0x685d('0x65')][_0x685d('0x66')],_0xc5a0f4[_0x685d('0x63')]['id'],_0x13239e[_0x685d('0x56')]?JSON[_0x685d('0x25')](_0x13239e[_0x685d('0x56')]):_0x685d('0x67'));return respondWithRpcPromise(_0x685d('0x68'),_0x685d('0x69'),_0xc5a0f4);}return null;})[_0x685d('0x21')](function(_0x3efc2c){var _0x5aa8a0=_0x685d('0x6a')+_0x3efc2c['message']['ContactId'];return db['sequelize']['query'](_0x5aa8a0,{'type':db[_0x685d('0x6b')][_0x685d('0x6c')]['SELECT'],'raw':!![]})['then'](function(_0xe278e2){return _0xe278e2;});})[_0x685d('0x21')](function(_0x13923b){if(_0x13923b){_0xc5a0f4[_0x685d('0x28')][_0x685d('0x6d')]=_0x13923b[0x0];if(!_0x13239e[_0x685d('0x56')][_0x685d('0x5d')])return;return db[_0x685d('0x6e')][_0x685d('0x53')]({'where':{'id':_0x13239e[_0x685d('0x56')][_0x685d('0x5d')],'role':_0x685d('0x6f')},'attributes':['id','name','fullname',_0x685d('0x70'),_0x685d('0x71')],'raw':!![]});}return null;})[_0x685d('0x21')](function(_0x1c422f){if(!_0x1c422f)return null;_0xc5a0f4[_0x685d('0x28')][_0x685d('0x6f')]=_0x1c422f;return _0xc5a0f4;})['then'](function(_0x4a1987){if(_0x4a1987){if(_0x13239e[_0x685d('0x56')][_0x685d('0x72')]){_0xc5a0f4[_0x685d('0x28')]['interface']=util[_0x685d('0x5b')]('SIP/%s',_0x13239e[_0x685d('0x65')]['name']);_0xc5a0f4['message'][_0x685d('0x73')]=_0xc5a0f4['channel'];_0xc5a0f4['message']['motionChannel']=_0xc5a0f4[_0x685d('0x73')];_0xc5a0f4['message'][_0x685d('0x74')]=_0x685d('0x75');return respondWithRpcPromise(_0x685d('0x76'),_0x685d('0x76'),{'event':_0x685d('0x77'),'message':_0xc5a0f4['message']},client9002)[_0x685d('0x21')](function(){return _0xc5a0f4;});}return _0xc5a0f4;}return null;})[_0x685d('0x21')](respondWithResult(_0x31f60f,null))[_0x685d('0x54')](handleError(_0x31f60f,null));};var interaction_log=require(_0x685d('0x13'))(_0x685d('0x58'));exports['reject']=function(_0x11df93,_0xef3009,_0x58a291){var _0x32c652={'agent':{},'channel':_0x685d('0x59')};if(_0x11df93[_0x685d('0x56')]['id']){delete _0x11df93['body']['id'];}_0x11df93[_0x685d('0x56')]['UserId']=_0x11df93['body'][_0x685d('0x5d')]||_0x11df93[_0x685d('0x65')]['id'];_0x32c652[_0x685d('0x6f')]['id']=_0x11df93[_0x685d('0x56')][_0x685d('0x5d')];return db[_0x685d('0x39')][_0x685d('0x53')]({'where':{'id':_0x11df93[_0x685d('0x51')]['id'],'UserId':null}})[_0x685d('0x21')](handleEntityNotFound(_0xef3009,null))[_0x685d('0x21')](function(_0x548999){if(_0x548999){_0x32c652[_0x685d('0x28')]=_0x548999['get']({'plain':!![]});return db[_0x685d('0x5f')]['find']({'where':{'id':_0x548999[_0x685d('0x60')]}});}return null;})[_0x685d('0x21')](handleEntityNotFound(_0xef3009,null))[_0x685d('0x21')](function(_0x170787){if(_0x170787){_0x32c652[_0x685d('0x63')]=_0x170787['get']({'plain':!![]});interaction_log[_0x685d('0x29')](_0x685d('0x78'),_0x11df93['user']['id'],_0x11df93['user'][_0x685d('0x35')],_0x11df93['user']['role'],_0x32c652[_0x685d('0x63')]['id'],_0x11df93[_0x685d('0x56')]?JSON[_0x685d('0x25')](_0x11df93['body']):_0x685d('0x67'));return respondWithRpcPromise(_0x685d('0x79'),_0x685d('0x7a'),_0x32c652);}return null;})[_0x685d('0x21')](function(_0x3c61e5){var _0x5b601e='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x3c61e5[_0x685d('0x28')][_0x685d('0x7b')];return db[_0x685d('0x7c')][_0x685d('0x3e')](_0x5b601e,{'type':db['Sequelize']['QueryTypes'][_0x685d('0x7d')],'raw':!![]})[_0x685d('0x21')](function(_0xaf432f){return _0xaf432f;});})[_0x685d('0x21')](function(_0x3d808e){if(_0x3d808e){_0x32c652[_0x685d('0x28')][_0x685d('0x6d')]=_0x3d808e[0x0];if(!_0x11df93['body'][_0x685d('0x5d')])return;return db[_0x685d('0x6e')][_0x685d('0x53')]({'where':{'id':_0x11df93[_0x685d('0x56')][_0x685d('0x5d')],'role':_0x685d('0x6f')},'attributes':['id','name',_0x685d('0x7e'),_0x685d('0x70'),_0x685d('0x71')],'raw':!![]});}return null;})[_0x685d('0x21')](function(_0x2b29f4){if(!_0x2b29f4)return null;_0x32c652['message']['agent']=_0x2b29f4;return _0x32c652;})[_0x685d('0x21')](function(_0x5f6217){if(_0x5f6217){_0x5f6217[_0x685d('0x28')]['interface']=util[_0x685d('0x5b')](_0x685d('0x7f'),_0x11df93['user'][_0x685d('0x35')]);_0x5f6217[_0x685d('0x28')][_0x685d('0x73')]=_0x32c652[_0x685d('0x73')];_0x5f6217['message'][_0x685d('0x80')]=_0x32c652[_0x685d('0x73')];_0x5f6217['message']['event']=_0x685d('0x81');respondWithRpcPromise(_0x685d('0x76'),'EventManager',{'event':_0x685d('0x82'),'message':_0x5f6217[_0x685d('0x28')]},client9002);return _0x32c652;}return null;})[_0x685d('0x21')](respondWithResult(_0xef3009,null))[_0x685d('0x54')](handleError(_0xef3009,null));}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.events.js b/server/api/openchannelMessage/openchannelMessage.events.js index 2dd12c5..9e9c6d2 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 _0xf339=['../../mysqldb','setMaxListeners','save','update','remove','hook','exports','events'];(function(_0xd8a8af,_0x1e93f0){var _0x5b7278=function(_0x458800){while(--_0x458800){_0xd8a8af['push'](_0xd8a8af['shift']());}};_0x5b7278(++_0x1e93f0);}(_0xf339,0x157));var _0x9f33=function(_0x2c91e9,_0x2fb965){_0x2c91e9=_0x2c91e9-0x0;var _0x13f0ff=_0xf339[_0x2c91e9];return _0x13f0ff;};'use strict';var EventEmitter=require(_0x9f33('0x0'));var OpenchannelMessage=require(_0x9f33('0x1'))['db']['OpenchannelMessage'];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0x9f33('0x2')](0x0);var events={'afterCreate':_0x9f33('0x3'),'afterUpdate':_0x9f33('0x4'),'afterDestroy':_0x9f33('0x5')};function emitEvent(_0x12cfd8){return function(_0x1b4e8f,_0x138bb2,_0x3c766c){OpenchannelMessageEvents['emit'](_0x12cfd8+':'+_0x1b4e8f['id'],_0x1b4e8f);OpenchannelMessageEvents['emit'](_0x12cfd8,_0x1b4e8f);_0x3c766c(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelMessage[_0x9f33('0x6')](e,emitEvent(event));}}module[_0x9f33('0x7')]=OpenchannelMessageEvents; \ No newline at end of file +var _0xfa6c=['OpenchannelMessage','setMaxListeners','emit','hasOwnProperty','hook','exports','events'];(function(_0x221802,_0x37dfe5){var _0x5c4aa9=function(_0x42c9bf){while(--_0x42c9bf){_0x221802['push'](_0x221802['shift']());}};_0x5c4aa9(++_0x37dfe5);}(_0xfa6c,0xf4));var _0xcfa6=function(_0x12b65b,_0x444f37){_0x12b65b=_0x12b65b-0x0;var _0x3f6a7e=_0xfa6c[_0x12b65b];return _0x3f6a7e;};'use strict';var EventEmitter=require(_0xcfa6('0x0'));var OpenchannelMessage=require('../../mysqldb')['db'][_0xcfa6('0x1')];var OpenchannelMessageEvents=new EventEmitter();OpenchannelMessageEvents[_0xcfa6('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x54aa5f){return function(_0x447bcd,_0x516f51,_0xeb4d16){OpenchannelMessageEvents[_0xcfa6('0x3')](_0x54aa5f+':'+_0x447bcd['id'],_0x447bcd);OpenchannelMessageEvents['emit'](_0x54aa5f,_0x447bcd);_0xeb4d16(null);};}for(var e in events){if(events[_0xcfa6('0x4')](e)){var event=events[e];OpenchannelMessage[_0xcfa6('0x5')](e,emitEvent(event));}}module[_0xcfa6('0x6')]=OpenchannelMessageEvents; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.model.js b/server/api/openchannelMessage/openchannelMessage.model.js index 02f5fa4..b941ccb 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 _0xeb90=['isNil','OpenchannelInteraction','OpenchannelInteractionId','createdAt','catch','CmContact','describe','OpenchannelAccount','find','OpenchannelAccountId','Interactions','Contact','keys','get','replyUri','OpenchannelMessage,\x20%s,\x20%s','Forwarding\x20message\x20%d\x20to\x20%s','length','Interaction','omit','method','POST','body','then','info','afterCreate','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','error','inspect','finally','utf8mb4_unicode_ci','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelMessage.attributes','exports','define','OpenchannelMessage','openchannel_messages','fti_openchannel_messages','FULLTEXT','direction','toLowerCase','out','secret'];(function(_0x1591d4,_0x4ea3bd){var _0x4c46bb=function(_0x13b7e7){while(--_0x13b7e7){_0x1591d4['push'](_0x1591d4['shift']());}};_0x4c46bb(++_0x4ea3bd);}(_0xeb90,0x89));var _0x0eb9=function(_0x1e401c,_0x33fb4d){_0x1e401c=_0x1e401c-0x0;var _0x599214=_0xeb90[_0x1e401c];return _0x599214;};'use strict';var _=require('lodash');var util=require(_0x0eb9('0x0'));var logger=require(_0x0eb9('0x1'))(_0x0eb9('0x2'));var moment=require(_0x0eb9('0x3'));var BPromise=require(_0x0eb9('0x4'));var rp=require(_0x0eb9('0x5'));var fs=require('fs');var path=require(_0x0eb9('0x6'));var rimraf=require('rimraf');var config=require(_0x0eb9('0x7'));var attributes=require(_0x0eb9('0x8'));module[_0x0eb9('0x9')]=function(_0x25399b,_0x39c88c){return _0x25399b[_0x0eb9('0xa')](_0x0eb9('0xb'),attributes,{'tableName':_0x0eb9('0xc'),'paranoid':![],'indexes':[{'name':_0x0eb9('0xd'),'fields':['body'],'type':_0x0eb9('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4a2b95,_0x5eec84,_0x543951){var _0x2226bc=_0x25399b['models'];var _0x945314=_0x4a2b95['get']({'plain':!![]});if(_0x945314[_0x0eb9('0xf')][_0x0eb9('0x10')]()==='in'||_0x945314[_0x0eb9('0xf')][_0x0eb9('0x10')]()===_0x0eb9('0x11')&&!_0x945314[_0x0eb9('0x12')]&&!_[_0x0eb9('0x13')](_0x945314['UserId'])){_0x2226bc[_0x0eb9('0x14')]['findOne']({'where':{'id':_0x945314[_0x0eb9('0x15')]}})['then'](function(_0x233191){if(_0x233191){_0x233191['update']({'lastMsgAt':_0x945314[_0x0eb9('0x16')],'lastMsgDirection':_0x945314[_0x0eb9('0xf')][_0x0eb9('0x10')]()});}})[_0x0eb9('0x17')](function(_0x179c9c){console['error'](_0x179c9c);});}if(_0x945314[_0x0eb9('0xf')]===_0x0eb9('0x11')&&!_0x945314[_0x0eb9('0x12')]){var _0x4e4a41;_0x2226bc[_0x0eb9('0x18')][_0x0eb9('0x19')]()['then'](function(_0x379fe8){return _0x2226bc[_0x0eb9('0x1a')][_0x0eb9('0x1b')]({'where':{'id':_0x945314[_0x0eb9('0x1c')]},'include':[{'model':_0x2226bc[_0x0eb9('0x14')],'as':_0x0eb9('0x1d'),'where':{'id':_0x945314[_0x0eb9('0x15')]},'limit':0x1,'include':[{'model':_0x2226bc[_0x0eb9('0x18')],'as':_0x0eb9('0x1e'),'attributes':_[_0x0eb9('0x1f')](_0x379fe8)}]}]});})['then'](function(_0x2ff7ff){_0x4e4a41=_0x2ff7ff[_0x0eb9('0x20')]({'plain':!![]});if(_0x4e4a41&&_0x4e4a41[_0x0eb9('0x21')]){logger['info'](_0x0eb9('0x22'),'afterCreate',util['format'](_0x0eb9('0x23'),_0x945314['id'],_0x4e4a41[_0x0eb9('0x21')]));if(_0x4e4a41[_0x0eb9('0x1d')]&&_0x4e4a41[_0x0eb9('0x1d')][_0x0eb9('0x24')]){_0x945314[_0x0eb9('0x25')]=_[_0x0eb9('0x26')](_0x4e4a41[_0x0eb9('0x1d')][0x0],_0x0eb9('0x1e'));_0x945314['Contact']=_0x4e4a41[_0x0eb9('0x1d')][0x0][_0x0eb9('0x1e')];}var _0x5eec84={'method':'POST','uri':encodeURI(_0x4e4a41[_0x0eb9('0x21')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x5eec84[_0x0eb9('0x27')]){case'GET':_0x5eec84['qs']=_0x945314;break;case _0x0eb9('0x28'):_0x5eec84[_0x0eb9('0x29')]=_0x945314;break;}return rp(_0x5eec84)[_0x0eb9('0x2a')](function(_0x4bb40c){logger[_0x0eb9('0x2b')](_0x0eb9('0x22'),_0x0eb9('0x2c'),util['format'](_0x0eb9('0x2d'),_0x945314['id'],_0x4e4a41[_0x0eb9('0x21')]));if(_0x4bb40c[_0x0eb9('0x29')][_0x0eb9('0x2e')]&&_0x4bb40c[_0x0eb9('0x29')]['threadId']!=_0x945314[_0x0eb9('0x25')][_0x0eb9('0x2e')]){return _0x2226bc[_0x0eb9('0x14')][_0x0eb9('0x2f')]({'threadId':_0x4bb40c[_0x0eb9('0x29')][_0x0eb9('0x2e')]},{'where':{'id':_0x945314[_0x0eb9('0x25')]['id']}});}else{return;}})['then'](function(){return _0x4a2b95[_0x0eb9('0x2f')]({'read':!![]});})[_0x0eb9('0x17')](function(_0x1dbf1e){logger[_0x0eb9('0x30')]('OpenchannelMessage,\x20%s,\x20%s','afterCreate',util[_0x0eb9('0x31')](_0x1dbf1e,{'showHidden':![],'depth':null}));_0x543951();});}else{_0x543951();}})[_0x0eb9('0x32')](function(){_0x543951();});}else{_0x543951();}}},'charset':'utf8mb4','collate':_0x0eb9('0x33')});}; \ No newline at end of file +var _0x74f3=['info','format','Message\x20%d\x20forwarded\x20to\x20%s','threadId','update','inspect','finally','utf8mb4','lodash','../../config/logger','api','moment','bluebird','request-promise','../../config/environment','./openchannelMessage.attributes','openchannel_messages','fti_openchannel_messages','FULLTEXT','models','get','direction','toLowerCase','out','isNil','UserId','OpenchannelInteraction','OpenchannelInteractionId','then','createdAt','catch','error','secret','CmContact','describe','OpenchannelAccount','find','Interactions','keys','replyUri','afterCreate','Forwarding\x20message\x20%d\x20to\x20%s','Interaction','omit','Contact','POST','method','body'];(function(_0x51d9e7,_0x171e04){var _0x5ee791=function(_0x53b9c7){while(--_0x53b9c7){_0x51d9e7['push'](_0x51d9e7['shift']());}};_0x5ee791(++_0x171e04);}(_0x74f3,0x98));var _0x374f=function(_0x150893,_0x143c41){_0x150893=_0x150893-0x0;var _0x3ae774=_0x74f3[_0x150893];return _0x3ae774;};'use strict';var _=require(_0x374f('0x0'));var util=require('util');var logger=require(_0x374f('0x1'))(_0x374f('0x2'));var moment=require(_0x374f('0x3'));var BPromise=require(_0x374f('0x4'));var rp=require(_0x374f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x374f('0x6'));var attributes=require(_0x374f('0x7'));module['exports']=function(_0x3c048f,_0x4d201c){return _0x3c048f['define']('OpenchannelMessage',attributes,{'tableName':_0x374f('0x8'),'paranoid':![],'indexes':[{'name':_0x374f('0x9'),'fields':['body'],'type':_0x374f('0xa')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x356e43,_0x45143a,_0x655552){var _0x3fec00=_0x3c048f[_0x374f('0xb')];var _0xa7523a=_0x356e43[_0x374f('0xc')]({'plain':!![]});if(_0xa7523a[_0x374f('0xd')][_0x374f('0xe')]()==='in'||_0xa7523a[_0x374f('0xd')][_0x374f('0xe')]()===_0x374f('0xf')&&!_0xa7523a['secret']&&!_[_0x374f('0x10')](_0xa7523a[_0x374f('0x11')])){_0x3fec00[_0x374f('0x12')]['findOne']({'where':{'id':_0xa7523a[_0x374f('0x13')]}})[_0x374f('0x14')](function(_0x54dee2){if(_0x54dee2){_0x54dee2['update']({'lastMsgAt':_0xa7523a[_0x374f('0x15')],'lastMsgDirection':_0xa7523a['direction'][_0x374f('0xe')]()});}})[_0x374f('0x16')](function(_0x262b95){console[_0x374f('0x17')](_0x262b95);});}if(_0xa7523a['direction']===_0x374f('0xf')&&!_0xa7523a[_0x374f('0x18')]){var _0x5f36e4;_0x3fec00[_0x374f('0x19')][_0x374f('0x1a')]()['then'](function(_0x590dcf){return _0x3fec00[_0x374f('0x1b')][_0x374f('0x1c')]({'where':{'id':_0xa7523a['OpenchannelAccountId']},'include':[{'model':_0x3fec00['OpenchannelInteraction'],'as':_0x374f('0x1d'),'where':{'id':_0xa7523a['OpenchannelInteractionId']},'limit':0x1,'include':[{'model':_0x3fec00['CmContact'],'as':'Contact','attributes':_[_0x374f('0x1e')](_0x590dcf)}]}]});})[_0x374f('0x14')](function(_0x2b5432){_0x5f36e4=_0x2b5432[_0x374f('0xc')]({'plain':!![]});if(_0x5f36e4&&_0x5f36e4[_0x374f('0x1f')]){logger['info']('OpenchannelMessage,\x20%s,\x20%s',_0x374f('0x20'),util['format'](_0x374f('0x21'),_0xa7523a['id'],_0x5f36e4[_0x374f('0x1f')]));if(_0x5f36e4['Interactions']&&_0x5f36e4[_0x374f('0x1d')]['length']){_0xa7523a[_0x374f('0x22')]=_[_0x374f('0x23')](_0x5f36e4[_0x374f('0x1d')][0x0],_0x374f('0x24'));_0xa7523a[_0x374f('0x24')]=_0x5f36e4[_0x374f('0x1d')][0x0][_0x374f('0x24')];}var _0x45143a={'method':_0x374f('0x25'),'uri':encodeURI(_0x5f36e4[_0x374f('0x1f')]),'json':!![],'resolveWithFullResponse':!![]};switch(_0x45143a[_0x374f('0x26')]){case'GET':_0x45143a['qs']=_0xa7523a;break;case _0x374f('0x25'):_0x45143a[_0x374f('0x27')]=_0xa7523a;break;}return rp(_0x45143a)[_0x374f('0x14')](function(_0x4b8f35){logger[_0x374f('0x28')]('OpenchannelMessage,\x20%s,\x20%s',_0x374f('0x20'),util[_0x374f('0x29')](_0x374f('0x2a'),_0xa7523a['id'],_0x5f36e4[_0x374f('0x1f')]));if(_0x4b8f35['body']['threadId']&&_0x4b8f35[_0x374f('0x27')]['threadId']!=_0xa7523a['Interaction'][_0x374f('0x2b')]){return _0x3fec00['OpenchannelInteraction']['update']({'threadId':_0x4b8f35[_0x374f('0x27')][_0x374f('0x2b')]},{'where':{'id':_0xa7523a[_0x374f('0x22')]['id']}});}else{return;}})[_0x374f('0x14')](function(){return _0x356e43[_0x374f('0x2c')]({'read':!![]});})[_0x374f('0x16')](function(_0x594a6d){logger[_0x374f('0x17')]('OpenchannelMessage,\x20%s,\x20%s',_0x374f('0x20'),util[_0x374f('0x2d')](_0x594a6d,{'showHidden':![],'depth':null}));_0x655552();});}else{_0x655552();}})[_0x374f('0x2e')](function(){_0x655552();});}else{_0x655552();}}},'charset':_0x374f('0x2f'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.rpc.js b/server/api/openchannelMessage/openchannelMessage.rpc.js index 51c77c3..fe7ac53 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 _0x0b0e=['message','result','OpenchannelMessage','create','body','options','CreateOpenchannelMessage','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./openchannelMessage.socket','then','info','request\x20sent','debug','OpenchannelMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x4616e7,_0x505f88){var _0x38f22d=function(_0x27d26e){while(--_0x27d26e){_0x4616e7['push'](_0x4616e7['shift']());}};_0x38f22d(++_0x505f88);}(_0x0b0e,0x187));var _0xe0b0=function(_0x4b03d3,_0x32f1d2){_0x4b03d3=_0x4b03d3-0x0;var _0x58a968=_0x0b0e[_0x4b03d3];return _0x58a968;};'use strict';var _=require(_0xe0b0('0x0'));var util=require('util');var moment=require(_0xe0b0('0x1'));var BPromise=require('bluebird');var rs=require(_0xe0b0('0x2'));var fs=require('fs');var Redis=require(_0xe0b0('0x3'));var db=require(_0xe0b0('0x4'))['db'];var utils=require(_0xe0b0('0x5'));var logger=require(_0xe0b0('0x6'))(_0xe0b0('0x7'));var config=require(_0xe0b0('0x8'));var jayson=require(_0xe0b0('0x9'));var client=jayson[_0xe0b0('0xa')][_0xe0b0('0xb')]({'port':0x232a});config[_0xe0b0('0xc')]=_['defaults'](config['redis'],{'host':_0xe0b0('0xd'),'port':0x18eb});var socket=require(_0xe0b0('0xe'))(new Redis(config[_0xe0b0('0xc')]));require(_0xe0b0('0xf'))['register'](socket);function respondWithRpcPromise(_0x338e7c,_0x1dd3b8,_0x553d4f){return new BPromise(function(_0x1fef28,_0x2f32b6){return client['request'](_0x338e7c,_0x553d4f)[_0xe0b0('0x10')](function(_0x2cdad2){logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0xe0b0('0x12'));logger[_0xe0b0('0x13')](_0xe0b0('0x14'),_0x1dd3b8,_0xe0b0('0x12'),JSON[_0xe0b0('0x15')](_0x2cdad2));if(_0x2cdad2['error']){if(_0x2cdad2[_0xe0b0('0x16')][_0xe0b0('0x17')]===0x1f4){logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2[_0xe0b0('0x16')]['message']);return _0x2f32b6(_0x2cdad2[_0xe0b0('0x16')]['message']);}logger[_0xe0b0('0x16')](_0xe0b0('0x18'),_0x1dd3b8,_0x2cdad2['error'][_0xe0b0('0x19')]);return _0x1fef28(_0x2cdad2['error'][_0xe0b0('0x19')]);}else{logger[_0xe0b0('0x11')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,'request\x20sent');_0x1fef28(_0x2cdad2[_0xe0b0('0x1a')]['message']);}})['catch'](function(_0x4bce65){logger[_0xe0b0('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x1dd3b8,_0x4bce65);_0x2f32b6(_0x4bce65);});});}exports['CreateOpenchannelMessage']=function(_0x10cde1){var _0x59dff5=this;return new Promise(function(_0x472286,_0x5dba2f){return db[_0xe0b0('0x1b')][_0xe0b0('0x1c')](_0x10cde1[_0xe0b0('0x1d')],{'raw':_0x10cde1[_0xe0b0('0x1e')]?_0x10cde1[_0xe0b0('0x1e')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x2fa820){logger['info'](_0xe0b0('0x1f'),_0x10cde1);logger[_0xe0b0('0x13')]('CreateOpenchannelMessage',_0x10cde1,JSON[_0xe0b0('0x15')](_0x2fa820));_0x472286(_0x2fa820);})['catch'](function(_0x2208d0){logger['error'](_0xe0b0('0x1f'),_0x2208d0['message'],_0x10cde1);_0x5dba2f(_0x59dff5[_0xe0b0('0x16')](0x1f4,_0x2208d0['message']));});});}; \ No newline at end of file +var _0xadb5=['debug','request\x20sent','stringify','error','code','message','info','result','catch','OpenchannelMessage','body','raw','CreateOpenchannelMessage','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./openchannelMessage.socket','register','request','then','OpenchannelMessage,\x20%s,\x20%s'];(function(_0x241bb9,_0x231283){var _0x35a725=function(_0x2e1317){while(--_0x2e1317){_0x241bb9['push'](_0x241bb9['shift']());}};_0x35a725(++_0x231283);}(_0xadb5,0xad));var _0x5adb=function(_0x21bcad,_0x5c8172){_0x21bcad=_0x21bcad-0x0;var _0x33cb09=_0xadb5[_0x21bcad];return _0x33cb09;};'use strict';var _=require('lodash');var util=require(_0x5adb('0x0'));var moment=require('moment');var BPromise=require(_0x5adb('0x1'));var rs=require(_0x5adb('0x2'));var fs=require('fs');var Redis=require(_0x5adb('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x5adb('0x4'));var logger=require(_0x5adb('0x5'))(_0x5adb('0x6'));var config=require('../../config/environment');var jayson=require(_0x5adb('0x7'));var client=jayson[_0x5adb('0x8')][_0x5adb('0x9')]({'port':0x232a});config[_0x5adb('0xa')]=_[_0x5adb('0xb')](config[_0x5adb('0xa')],{'host':_0x5adb('0xc'),'port':0x18eb});var socket=require(_0x5adb('0xd'))(new Redis(config[_0x5adb('0xa')]));require(_0x5adb('0xe'))[_0x5adb('0xf')](socket);function respondWithRpcPromise(_0x336bad,_0x129f5a,_0x275428){return new BPromise(function(_0x563d86,_0x4c268d){return client[_0x5adb('0x10')](_0x336bad,_0x275428)[_0x5adb('0x11')](function(_0x82e67e){logger['info'](_0x5adb('0x12'),_0x129f5a,'request\x20sent');logger[_0x5adb('0x13')]('OpenchannelMessage,\x20%s,\x20%s,\x20%s',_0x129f5a,_0x5adb('0x14'),JSON[_0x5adb('0x15')](_0x82e67e));if(_0x82e67e[_0x5adb('0x16')]){if(_0x82e67e['error'][_0x5adb('0x17')]===0x1f4){logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e['error'][_0x5adb('0x18')]);return _0x4c268d(_0x82e67e['error'][_0x5adb('0x18')]);}logger[_0x5adb('0x16')](_0x5adb('0x12'),_0x129f5a,_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);return _0x563d86(_0x82e67e[_0x5adb('0x16')][_0x5adb('0x18')]);}else{logger[_0x5adb('0x19')](_0x5adb('0x12'),_0x129f5a,'request\x20sent');_0x563d86(_0x82e67e[_0x5adb('0x1a')]['message']);}})[_0x5adb('0x1b')](function(_0x558f76){logger[_0x5adb('0x16')]('OpenchannelMessage,\x20%s,\x20%s',_0x129f5a,_0x558f76);_0x4c268d(_0x558f76);});});}exports['CreateOpenchannelMessage']=function(_0x1fbaa5){var _0x1bed20=this;return new Promise(function(_0x438671,_0x1fd4a7){return db[_0x5adb('0x1c')]['create'](_0x1fbaa5[_0x5adb('0x1d')],{'raw':_0x1fbaa5['options']?_0x1fbaa5['options'][_0x5adb('0x1e')]===undefined?!![]:![]:!![]})[_0x5adb('0x11')](function(_0x1a38d3){logger[_0x5adb('0x19')](_0x5adb('0x1f'),_0x1fbaa5);logger[_0x5adb('0x13')](_0x5adb('0x1f'),_0x1fbaa5,JSON['stringify'](_0x1a38d3));_0x438671(_0x1a38d3);})[_0x5adb('0x1b')](function(_0x373cc3){logger[_0x5adb('0x16')](_0x5adb('0x1f'),_0x373cc3[_0x5adb('0x18')],_0x1fbaa5);_0x1fd4a7(_0x1bed20['error'](0x1f4,_0x373cc3[_0x5adb('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelMessage/openchannelMessage.socket.js b/server/api/openchannelMessage/openchannelMessage.socket.js index a582c90..ae03524 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 _0xcf71=['register','length','./openchannelMessage.events','save','remove','update','emit','removeListener'];(function(_0x42cc41,_0x3c8e8e){var _0x345142=function(_0x47912e){while(--_0x47912e){_0x42cc41['push'](_0x42cc41['shift']());}};_0x345142(++_0x3c8e8e);}(_0xcf71,0xba));var _0x1cf7=function(_0x8854f2,_0x79542c){_0x8854f2=_0x8854f2-0x0;var _0x38505d=_0xcf71[_0x8854f2];return _0x38505d;};'use strict';var OpenchannelMessageEvents=require(_0x1cf7('0x0'));var events=[_0x1cf7('0x1'),_0x1cf7('0x2'),_0x1cf7('0x3')];function createListener(_0x50d1a1,_0x32cb2f){return function(_0x409e6f){_0x32cb2f[_0x1cf7('0x4')](_0x50d1a1,_0x409e6f);};}function removeListener(_0x21307d,_0x11e462){return function(){OpenchannelMessageEvents[_0x1cf7('0x5')](_0x21307d,_0x11e462);};}exports[_0x1cf7('0x6')]=function(_0x20e097){for(var _0x314796=0x0,_0x45ee6b=events[_0x1cf7('0x7')];_0x314796<_0x45ee6b;_0x314796++){var _0x19b626=events[_0x314796];var _0x4f908a=createListener('openchannelMessage:'+_0x19b626,_0x20e097);OpenchannelMessageEvents['on'](_0x19b626,_0x4f908a);}}; \ No newline at end of file +var _0x3cb7=['register','length','openchannelMessage:','./openchannelMessage.events','save','update','removeListener'];(function(_0x2d8270,_0x474996){var _0x2fa65f=function(_0x2fe69b){while(--_0x2fe69b){_0x2d8270['push'](_0x2d8270['shift']());}};_0x2fa65f(++_0x474996);}(_0x3cb7,0x1ae));var _0x73cb=function(_0x38e177,_0x59ec9f){_0x38e177=_0x38e177-0x0;var _0x1faf15=_0x3cb7[_0x38e177];return _0x1faf15;};'use strict';var OpenchannelMessageEvents=require(_0x73cb('0x0'));var events=[_0x73cb('0x1'),'remove',_0x73cb('0x2')];function createListener(_0x1fb998,_0x32049b){return function(_0x181662){_0x32049b['emit'](_0x1fb998,_0x181662);};}function removeListener(_0x5f923d,_0x2b16b7){return function(){OpenchannelMessageEvents[_0x73cb('0x3')](_0x5f923d,_0x2b16b7);};}exports[_0x73cb('0x4')]=function(_0x4386e9){for(var _0x2e260a=0x0,_0x9df70d=events[_0x73cb('0x5')];_0x2e260a<_0x9df70d;_0x2e260a++){var _0xa9f09a=events[_0x2e260a];var _0x102342=createListener(_0x73cb('0x6')+_0xa9f09a,_0x4386e9);OpenchannelMessageEvents['on'](_0xa9f09a,_0x102342);}}; \ No newline at end of file diff --git a/server/api/openchannelQueue/index.js b/server/api/openchannelQueue/index.js index 198f6b0..710e7c4 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 _0x6457=['get','isAuthenticated','index','describe','show','/:id/members','getMembers','/:id/teams','getTeams','post','create','addTeams','addAgents','put','update','/:id','removeTeams','delete','/:id/users','removeAgents','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./openchannelQueue.controller'];(function(_0x540dcb,_0x4eacb6){var _0x49353c=function(_0x449bb1){while(--_0x449bb1){_0x540dcb['push'](_0x540dcb['shift']());}};_0x49353c(++_0x4eacb6);}(_0x6457,0xab));var _0x7645=function(_0x396ebd,_0x2b620b){_0x396ebd=_0x396ebd-0x0;var _0x42fbe2=_0x6457[_0x396ebd];return _0x42fbe2;};'use strict';var multer=require(_0x7645('0x0'));var util=require(_0x7645('0x1'));var path=require('path');var timeout=require(_0x7645('0x2'));var express=require(_0x7645('0x3'));var router=express[_0x7645('0x4')]();var fs_extra=require(_0x7645('0x5'));var auth=require(_0x7645('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x7645('0x7'));var controller=require(_0x7645('0x8'));router[_0x7645('0x9')]('/',auth[_0x7645('0xa')](),controller[_0x7645('0xb')]);router[_0x7645('0x9')]('/describe',auth[_0x7645('0xa')](),controller[_0x7645('0xc')]);router[_0x7645('0x9')]('/:id',auth['isAuthenticated'](),controller[_0x7645('0xd')]);router[_0x7645('0x9')](_0x7645('0xe'),auth[_0x7645('0xa')](),controller[_0x7645('0xf')]);router[_0x7645('0x9')](_0x7645('0x10'),auth['isAuthenticated'](),controller[_0x7645('0x11')]);router['get']('/:id/users',auth[_0x7645('0xa')](),controller['getAgents']);router[_0x7645('0x12')]('/',auth[_0x7645('0xa')](),controller[_0x7645('0x13')]);router['post'](_0x7645('0x10'),auth[_0x7645('0xa')](),controller[_0x7645('0x14')]);router[_0x7645('0x12')]('/:id/users',auth[_0x7645('0xa')](),controller[_0x7645('0x15')]);router[_0x7645('0x16')]('/:id',auth[_0x7645('0xa')](),controller[_0x7645('0x17')]);router['delete'](_0x7645('0x18'),auth[_0x7645('0xa')](),controller['destroy']);router['delete']('/:id/teams',auth[_0x7645('0xa')](),controller[_0x7645('0x19')]);router[_0x7645('0x1a')](_0x7645('0x1b'),auth[_0x7645('0xa')](),controller[_0x7645('0x1c')]);module[_0x7645('0x1d')]=router; \ No newline at end of file +var _0xe0a6=['path','connect-timeout','fs-extra','../../config/environment','index','/describe','describe','get','/:id','isAuthenticated','show','/:id/members','getMembers','getTeams','getAgents','post','create','/:id/teams','addTeams','/:id/users','put','delete','destroy','removeAgents','exports','multer','util'];(function(_0xeda4ba,_0x4215d5){var _0x121c71=function(_0x43b17f){while(--_0x43b17f){_0xeda4ba['push'](_0xeda4ba['shift']());}};_0x121c71(++_0x4215d5);}(_0xe0a6,0x10c));var _0x6e0a=function(_0x47d034,_0x2bc52b){_0x47d034=_0x47d034-0x0;var _0x2a9cd2=_0xe0a6[_0x47d034];return _0x2a9cd2;};'use strict';var multer=require(_0x6e0a('0x0'));var util=require(_0x6e0a('0x1'));var path=require(_0x6e0a('0x2'));var timeout=require(_0x6e0a('0x3'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6e0a('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6e0a('0x5'));var controller=require('./openchannelQueue.controller');router['get']('/',auth['isAuthenticated'](),controller[_0x6e0a('0x6')]);router['get'](_0x6e0a('0x7'),auth['isAuthenticated'](),controller[_0x6e0a('0x8')]);router[_0x6e0a('0x9')](_0x6e0a('0xa'),auth[_0x6e0a('0xb')](),controller[_0x6e0a('0xc')]);router['get'](_0x6e0a('0xd'),auth[_0x6e0a('0xb')](),controller[_0x6e0a('0xe')]);router[_0x6e0a('0x9')]('/:id/teams',auth[_0x6e0a('0xb')](),controller[_0x6e0a('0xf')]);router[_0x6e0a('0x9')]('/:id/users',auth[_0x6e0a('0xb')](),controller[_0x6e0a('0x10')]);router[_0x6e0a('0x11')]('/',auth[_0x6e0a('0xb')](),controller[_0x6e0a('0x12')]);router[_0x6e0a('0x11')](_0x6e0a('0x13'),auth[_0x6e0a('0xb')](),controller[_0x6e0a('0x14')]);router['post'](_0x6e0a('0x15'),auth[_0x6e0a('0xb')](),controller['addAgents']);router[_0x6e0a('0x16')](_0x6e0a('0xa'),auth[_0x6e0a('0xb')](),controller['update']);router[_0x6e0a('0x17')](_0x6e0a('0xa'),auth['isAuthenticated'](),controller[_0x6e0a('0x18')]);router[_0x6e0a('0x17')]('/:id/teams',auth[_0x6e0a('0xb')](),controller['removeTeams']);router[_0x6e0a('0x17')](_0x6e0a('0x15'),auth['isAuthenticated'](),controller[_0x6e0a('0x19')]);module[_0x6e0a('0x1a')]=router; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.attributes.js b/server/api/openchannelQueue/openchannelQueue.attributes.js index 4e29d4d..d85e080 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 _0x22e3=['sequelize','STRING','name','INTEGER','ENUM','rrmemory','beepall'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x22e3,0x103));var _0x322e=function(_0x45bece,_0x419dfa){_0x45bece=_0x45bece-0x0;var _0x17b639=_0x22e3[_0x45bece];return _0x17b639;};'use strict';var Sequelize=require(_0x322e('0x0'));module['exports']={'name':{'type':Sequelize[_0x322e('0x1')],'unique':_0x322e('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x322e('0x1')]},'timeout':{'type':Sequelize[_0x322e('0x3')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x322e('0x4')](_0x322e('0x5'),_0x322e('0x6'),'roundrobin')}}; \ No newline at end of file +var _0x4c88=['exports','STRING','name','ENUM','beepall','sequelize'];(function(_0x295ead,_0x375902){var _0x4ec292=function(_0x20cb67){while(--_0x20cb67){_0x295ead['push'](_0x295ead['shift']());}};_0x4ec292(++_0x375902);}(_0x4c88,0x119));var _0x84c8=function(_0x59ee6f,_0x450239){_0x59ee6f=_0x59ee6f-0x0;var _0x4c0979=_0x4c88[_0x59ee6f];return _0x4c0979;};'use strict';var Sequelize=require(_0x84c8('0x0'));module[_0x84c8('0x1')]={'name':{'type':Sequelize[_0x84c8('0x2')],'unique':_0x84c8('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x84c8('0x2')]},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x84c8('0x4')]('rrmemory',_0x84c8('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 f2a042f..c4306bd 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 _0xed4e=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','get','OpenchannelQueues','UserProfileResource','destroy','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','params','find','create','body','user','role','UserProfileSection','userProfileId','autoAssociation','describe','getMembers','findOne','UserOpenchannelQueue','OpenchannelQueueId','findAll','User','UserId','agent','openchannelPause','rows','format','%s/%s','SIP','createdAt','updatedAt','getTeams','Team','Agents','interface','sequelize','transaction','addTeams','each','findOrCreate','emit','userOpenchannelQueue:save','removeTeams','select','field','tq.TeamId','from','user_has_teams','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','ids','isEmpty','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','ioredis','../../components/parsers/qs'];(function(_0x489fec,_0x47af23){var _0x74ebfb=function(_0x111ef6){while(--_0x111ef6){_0x489fec['push'](_0x489fec['shift']());}};_0x74ebfb(++_0x47af23);}(_0xed4e,0x80));var _0xeed4=function(_0x48132a,_0x4692a0){_0x48132a=_0x48132a-0x0;var _0x3dfd6e=_0xed4e[_0x48132a];return _0x3dfd6e;};'use strict';var emlformat=require(_0xeed4('0x0'));var rimraf=require(_0xeed4('0x1'));var zipdir=require(_0xeed4('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xeed4('0x3'));var moment=require(_0xeed4('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xeed4('0x5'));var util=require(_0xeed4('0x6'));var path=require(_0xeed4('0x7'));var sox=require(_0xeed4('0x8'));var csv=require(_0xeed4('0x9'));var ejs=require(_0xeed4('0xa'));var fs=require('fs');var fs_extra=require(_0xeed4('0xb'));var _=require(_0xeed4('0xc'));var squel=require(_0xeed4('0xd'));var crypto=require('crypto');var jsforce=require(_0xeed4('0xe'));var deskjs=require(_0xeed4('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xeed4('0x10'));var authService=require('../../components/auth/service');var qs=require(_0xeed4('0x11'));var as=require(_0xeed4('0x12'));var hardwareService=require(_0xeed4('0x13'));var logger=require(_0xeed4('0x14'))('api');var utils=require(_0xeed4('0x15'));var config=require(_0xeed4('0x16'));var licenseUtil=require(_0xeed4('0x17'));var db=require(_0xeed4('0x18'))['db'];config[_0xeed4('0x19')]=_[_0xeed4('0x1a')](config[_0xeed4('0x19')],{'host':_0xeed4('0x1b'),'port':0x18eb});var socket=require(_0xeed4('0x1c'))(new Redis(config[_0xeed4('0x19')]));require('./openchannelQueue.socket')[_0xeed4('0x1d')](socket);function respondWithStatusCode(_0x3ea40f,_0x2734e8){_0x2734e8=_0x2734e8||0xcc;return function(_0x146fee){if(_0x146fee){return _0x3ea40f[_0xeed4('0x1e')](_0x2734e8);}return _0x3ea40f[_0xeed4('0x1f')](_0x2734e8)[_0xeed4('0x20')]();};}function respondWithResult(_0xa20806,_0x4d7e09){_0x4d7e09=_0x4d7e09||0xc8;return function(_0x177fba){if(_0x177fba){return _0xa20806[_0xeed4('0x1f')](_0x4d7e09)[_0xeed4('0x21')](_0x177fba);}};}function respondWithFilteredResult(_0x2eb46a,_0x374ef3){return function(_0x25a449){if(_0x25a449){var _0x4d200c=typeof _0x374ef3[_0xeed4('0x22')]==='undefined'&&typeof _0x374ef3['limit']===_0xeed4('0x23');var _0x3ba4a0=_0x25a449['count'];var _0x37bfd6=_0x4d200c?0x0:_0x374ef3[_0xeed4('0x22')];var _0x1fd914=_0x4d200c?_0x25a449[_0xeed4('0x24')]:_0x374ef3[_0xeed4('0x22')]+_0x374ef3[_0xeed4('0x25')];var _0x1c1966;if(_0x1fd914>=_0x3ba4a0){_0x1fd914=_0x3ba4a0;_0x1c1966=0xc8;}else{_0x1c1966=0xce;}_0x2eb46a['status'](_0x1c1966);return _0x2eb46a[_0xeed4('0x26')](_0xeed4('0x27'),_0x37bfd6+'-'+_0x1fd914+'/'+_0x3ba4a0)[_0xeed4('0x21')](_0x25a449);}return null;};}function patchUpdates(_0x2c4ebe){return function(_0x51fc50){try{jsonpatch[_0xeed4('0x28')](_0x51fc50,_0x2c4ebe,!![]);}catch(_0x48b4b0){return BPromise[_0xeed4('0x29')](_0x48b4b0);}return _0x51fc50[_0xeed4('0x2a')]();};}function saveUpdates(_0x156675,_0x34d5a1){return function(_0x304d8b){if(_0x304d8b){return _0x304d8b[_0xeed4('0x2b')](_0x156675)[_0xeed4('0x2c')](function(_0x315328){return _0x315328;});}return null;};}function removeEntity(_0x1f7c87,_0x5b66bd){return function(_0x403664){if(_0x403664){return _0x403664['destroy']()[_0xeed4('0x2c')](function(){var _0x214ba9=_0x403664[_0xeed4('0x2d')]({'plain':!![]});var _0x5c7f9b=_0xeed4('0x2e');return db[_0xeed4('0x2f')][_0xeed4('0x30')]({'where':{'type':_0x5c7f9b,'resourceId':_0x214ba9['id']}})[_0xeed4('0x2c')](function(){return _0x403664;});})[_0xeed4('0x2c')](function(){_0x1f7c87[_0xeed4('0x1f')](0xcc)[_0xeed4('0x20')]();});}};}function handleEntityNotFound(_0x321417,_0x50e3de){return function(_0x3b341a){if(!_0x3b341a){_0x321417['sendStatus'](0x194);}return _0x3b341a;};}function handleError(_0xaa76d8,_0x4bb0a1){_0x4bb0a1=_0x4bb0a1||0x1f4;return function(_0x400ebf){logger[_0xeed4('0x31')](_0x400ebf[_0xeed4('0x32')]);if(_0x400ebf[_0xeed4('0x33')]){delete _0x400ebf[_0xeed4('0x33')];}_0xaa76d8[_0xeed4('0x1f')](_0x4bb0a1)[_0xeed4('0x34')](_0x400ebf);};}exports[_0xeed4('0x35')]=function(_0x1db6dc,_0x34017e){var _0x596c5b={},_0x3e4f98={},_0xb21984={'count':0x0,'rows':[]};var _0x4c1059=_[_0xeed4('0x36')](db[_0xeed4('0x37')][_0xeed4('0x38')],function(_0x1a9a4f){return{'name':_0x1a9a4f[_0xeed4('0x39')],'type':_0x1a9a4f[_0xeed4('0x3a')][_0xeed4('0x3b')]};});_0x3e4f98[_0xeed4('0x3c')]=_[_0xeed4('0x36')](_0x4c1059,_0xeed4('0x33'));_0x3e4f98[_0xeed4('0x3d')]=_[_0xeed4('0x3e')](_0x1db6dc[_0xeed4('0x3d')]);_0x3e4f98[_0xeed4('0x3f')]=_[_0xeed4('0x40')](_0x3e4f98['model'],_0x3e4f98['query']);_0x596c5b['attributes']=_['intersection'](_0x3e4f98[_0xeed4('0x3c')],qs[_0xeed4('0x41')](_0x1db6dc[_0xeed4('0x3d')][_0xeed4('0x41')]));_0x596c5b['attributes']=_0x596c5b[_0xeed4('0x42')][_0xeed4('0x43')]?_0x596c5b[_0xeed4('0x42')]:_0x3e4f98[_0xeed4('0x3c')];if(!_0x1db6dc[_0xeed4('0x3d')][_0xeed4('0x44')](_0xeed4('0x45'))){_0x596c5b['limit']=qs['limit'](_0x1db6dc[_0xeed4('0x3d')][_0xeed4('0x25')]);_0x596c5b['offset']=qs[_0xeed4('0x22')](_0x1db6dc['query']['offset']);}_0x596c5b[_0xeed4('0x46')]=qs[_0xeed4('0x47')](_0x1db6dc['query']['sort']);_0x596c5b[_0xeed4('0x48')]=qs[_0xeed4('0x3f')](_[_0xeed4('0x49')](_0x1db6dc[_0xeed4('0x3d')],_0x3e4f98[_0xeed4('0x3f')]),_0x4c1059);if(_0x1db6dc[_0xeed4('0x3d')][_0xeed4('0x4a')]){_0x596c5b['where']=_[_0xeed4('0x4b')](_0x596c5b[_0xeed4('0x48')],{'$or':_['map'](_0x4c1059,function(_0x2910ff){if(_0x2910ff[_0xeed4('0x3a')]!==_0xeed4('0x4c')){var _0x341287={};_0x341287[_0x2910ff['name']]={'$like':'%'+_0x1db6dc[_0xeed4('0x3d')][_0xeed4('0x4a')]+'%'};return _0x341287;}})});}_0x596c5b=_[_0xeed4('0x4b')]({},_0x596c5b,_0x1db6dc[_0xeed4('0x4d')]);var _0xc69dbf={'where':_0x596c5b[_0xeed4('0x48')]};return db[_0xeed4('0x37')][_0xeed4('0x24')](_0xc69dbf)[_0xeed4('0x2c')](function(_0x1a31b4){_0xb21984[_0xeed4('0x24')]=_0x1a31b4;if(_0x1db6dc[_0xeed4('0x3d')][_0xeed4('0x4e')]){_0x596c5b[_0xeed4('0x4f')]=[{'all':!![]}];}return db['OpenchannelQueue']['findAll'](_0x596c5b);})['then'](function(_0x583221){_0xb21984['rows']=_0x583221;return _0xb21984;})[_0xeed4('0x2c')](respondWithFilteredResult(_0x34017e,_0x596c5b))[_0xeed4('0x50')](handleError(_0x34017e,null));};exports['show']=function(_0x9d16ea,_0x3cb173){var _0x1a7063={'raw':!![],'where':{'id':_0x9d16ea[_0xeed4('0x51')]['id']}},_0xf3fe3e={};_0xf3fe3e[_0xeed4('0x3c')]=_[_0xeed4('0x3e')](db['OpenchannelQueue'][_0xeed4('0x38')]);_0xf3fe3e[_0xeed4('0x3d')]=_['keys'](_0x9d16ea[_0xeed4('0x3d')]);_0xf3fe3e[_0xeed4('0x3f')]=_['intersection'](_0xf3fe3e[_0xeed4('0x3c')],_0xf3fe3e['query']);_0x1a7063[_0xeed4('0x42')]=_[_0xeed4('0x40')](_0xf3fe3e[_0xeed4('0x3c')],qs['fields'](_0x9d16ea[_0xeed4('0x3d')][_0xeed4('0x41')]));_0x1a7063[_0xeed4('0x42')]=_0x1a7063['attributes'][_0xeed4('0x43')]?_0x1a7063[_0xeed4('0x42')]:_0xf3fe3e[_0xeed4('0x3c')];if(_0x9d16ea[_0xeed4('0x3d')][_0xeed4('0x4e')]){_0x1a7063[_0xeed4('0x4f')]=[{'all':!![]}];}_0x1a7063=_[_0xeed4('0x4b')]({},_0x1a7063,_0x9d16ea[_0xeed4('0x4d')]);return db[_0xeed4('0x37')][_0xeed4('0x52')](_0x1a7063)['then'](handleEntityNotFound(_0x3cb173,null))['then'](respondWithResult(_0x3cb173,null))['catch'](handleError(_0x3cb173,null));};exports['create']=function(_0x24a351,_0x1aaa99){return db[_0xeed4('0x37')][_0xeed4('0x53')](_0x24a351[_0xeed4('0x54')],{})[_0xeed4('0x2c')](function(_0x4ef36f){var _0x2e2e2c=_0x24a351[_0xeed4('0x55')]['get']({'plain':!![]});if(!_0x2e2e2c)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2e2e2c[_0xeed4('0x56')]===_0xeed4('0x55')){var _0x198cd7=_0x4ef36f[_0xeed4('0x2d')]({'plain':!![]});var _0x16e7a3=_0xeed4('0x2e');return db[_0xeed4('0x57')][_0xeed4('0x52')]({'where':{'name':_0x16e7a3,'userProfileId':_0x2e2e2c[_0xeed4('0x58')]},'raw':!![]})['then'](function(_0x260148){if(_0x260148&&_0x260148[_0xeed4('0x59')]===0x0){return db[_0xeed4('0x2f')][_0xeed4('0x53')]({'name':_0x198cd7[_0xeed4('0x33')],'resourceId':_0x198cd7['id'],'type':_0x260148[_0xeed4('0x33')],'sectionId':_0x260148['id']},{})[_0xeed4('0x2c')](function(){return _0x4ef36f;});}else{return _0x4ef36f;}})['catch'](function(_0x128e9d){logger[_0xeed4('0x31')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x128e9d);throw _0x128e9d;});}return _0x4ef36f;})[_0xeed4('0x2c')](respondWithResult(_0x1aaa99,0xc9))[_0xeed4('0x50')](handleError(_0x1aaa99,null));};exports['update']=function(_0x29ca2a,_0x5710a3){if(_0x29ca2a[_0xeed4('0x54')]['id']){delete _0x29ca2a['body']['id'];}return db[_0xeed4('0x37')][_0xeed4('0x52')]({'where':{'id':_0x29ca2a[_0xeed4('0x51')]['id']}})[_0xeed4('0x2c')](handleEntityNotFound(_0x5710a3,null))['then'](saveUpdates(_0x29ca2a[_0xeed4('0x54')],null))[_0xeed4('0x2c')](respondWithResult(_0x5710a3,null))[_0xeed4('0x50')](handleError(_0x5710a3,null));};exports[_0xeed4('0x30')]=function(_0x49570e,_0x26f2a7){return db[_0xeed4('0x37')][_0xeed4('0x52')]({'where':{'id':_0x49570e['params']['id']}})['then'](handleEntityNotFound(_0x26f2a7,null))['then'](removeEntity(_0x26f2a7,null))[_0xeed4('0x50')](handleError(_0x26f2a7,null));};exports[_0xeed4('0x5a')]=function(_0x34501a,_0x27aa4c){return db[_0xeed4('0x37')]['describe']()[_0xeed4('0x2c')](respondWithResult(_0x27aa4c,null))[_0xeed4('0x50')](handleError(_0x27aa4c,null));};exports[_0xeed4('0x5b')]=function(_0x2c4c51,_0x35fe8d,_0x2c8243){var _0x341764={'raw':!![],'where':{}},_0x12ea44={},_0x1331cd;return db[_0xeed4('0x37')][_0xeed4('0x5c')]({'where':{'id':_0x2c4c51[_0xeed4('0x51')]['id']}})[_0xeed4('0x2c')](handleEntityNotFound(_0x35fe8d,null))[_0xeed4('0x2c')](function(_0x4579a3){if(_0x4579a3){_0x1331cd=_0x4579a3[_0xeed4('0x2d')]({'plain':!![]});_0x12ea44[_0xeed4('0x3c')]=_['keys'](db[_0xeed4('0x5d')]['rawAttributes']);_0x12ea44[_0xeed4('0x3d')]=_[_0xeed4('0x3e')](_0x2c4c51[_0xeed4('0x3d')]);_0x12ea44[_0xeed4('0x3f')]=_[_0xeed4('0x40')](_0x12ea44[_0xeed4('0x3c')],_0x12ea44[_0xeed4('0x3d')]);_0x341764[_0xeed4('0x42')]=_[_0xeed4('0x40')](_0x12ea44[_0xeed4('0x3c')],qs[_0xeed4('0x41')](_0x2c4c51[_0xeed4('0x3d')][_0xeed4('0x41')]));_0x341764[_0xeed4('0x42')]=_0x341764[_0xeed4('0x42')][_0xeed4('0x43')]?_0x341764[_0xeed4('0x42')]:_0x12ea44[_0xeed4('0x3c')];if(!_0x2c4c51[_0xeed4('0x3d')][_0xeed4('0x44')](_0xeed4('0x45'))){_0x341764[_0xeed4('0x25')]=qs[_0xeed4('0x25')](_0x2c4c51[_0xeed4('0x3d')][_0xeed4('0x25')]);_0x341764[_0xeed4('0x22')]=qs['offset'](_0x2c4c51['query'][_0xeed4('0x22')]);}_0x341764[_0xeed4('0x46')]=qs['sort'](_0x2c4c51[_0xeed4('0x3d')]['sort']);_0x341764[_0xeed4('0x48')]=qs[_0xeed4('0x3f')](_['pick'](_0x2c4c51[_0xeed4('0x3d')],_0x12ea44[_0xeed4('0x3f')]));_0x341764[_0xeed4('0x48')][_0xeed4('0x5e')]=_0x4579a3['id'];if(_0x2c4c51[_0xeed4('0x3d')][_0xeed4('0x4a')]){_0x341764[_0xeed4('0x48')]=_[_0xeed4('0x4b')](_0x341764['where'],{'$or':_[_0xeed4('0x36')](_0x341764[_0xeed4('0x42')],function(_0x266760){var _0x390530={};_0x390530[_0x266760]={'$like':'%'+_0x2c4c51['query'][_0xeed4('0x4a')]+'%'};return _0x390530;})});}_0x341764=_[_0xeed4('0x4b')]({},_0x341764,_0x2c4c51[_0xeed4('0x4d')]);return db[_0xeed4('0x5d')][_0xeed4('0x5f')](_0x341764);}})[_0xeed4('0x2c')](function(_0x61630c){if(_0x61630c){return db[_0xeed4('0x60')]['findAndCountAll']({'where':{'id':_[_0xeed4('0x36')](_0x61630c,_0xeed4('0x61')),'role':_0xeed4('0x62')},'attributes':['id',_0xeed4('0x33'),_0xeed4('0x63'),'updatedAt','createdAt']});}})[_0xeed4('0x2c')](function(_0x2ded63){if(_0x2ded63){return{'count':_0x2ded63[_0xeed4('0x24')],'rows':_['map'](_0x2ded63[_0xeed4('0x64')],function(_0x321c87){return{'membername':_0x321c87['name'],'UserId':_0x321c87['id'],'queue_name':_0x1331cd['name'],'OpenchannelQueueId':_0x1331cd['id'],'interface':util[_0xeed4('0x65')](_0xeed4('0x66'),_0xeed4('0x67'),_0x321c87[_0xeed4('0x33')]),'penalty':0x0,'paused':_0x321c87[_0xeed4('0x63')],'createdAt':_0x321c87[_0xeed4('0x68')],'updatedAt':_0x321c87[_0xeed4('0x69')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x35fe8d,_0x341764))[_0xeed4('0x50')](handleError(_0x35fe8d,null));};exports[_0xeed4('0x6a')]=function(_0x275a21,_0x18282a,_0x2808ff){var _0x1e1b9e={};var _0x44f0dc={};var _0x2ebd77;var _0x505d23;return db[_0xeed4('0x37')][_0xeed4('0x5c')]({'where':{'id':_0x275a21[_0xeed4('0x51')]['id']}})[_0xeed4('0x2c')](handleEntityNotFound(_0x18282a,null))['then'](function(_0x26adfd){if(_0x26adfd){_0x2ebd77=_0x26adfd;_0x44f0dc[_0xeed4('0x3c')]=_[_0xeed4('0x3e')](db[_0xeed4('0x6b')]['rawAttributes']);_0x44f0dc[_0xeed4('0x3d')]=_[_0xeed4('0x3e')](_0x275a21['query']);_0x44f0dc[_0xeed4('0x3f')]=_[_0xeed4('0x40')](_0x44f0dc['model'],_0x44f0dc[_0xeed4('0x3d')]);_0x1e1b9e[_0xeed4('0x42')]=_['intersection'](_0x44f0dc[_0xeed4('0x3c')],qs['fields'](_0x275a21[_0xeed4('0x3d')][_0xeed4('0x41')]));_0x1e1b9e[_0xeed4('0x42')]=_0x1e1b9e[_0xeed4('0x42')][_0xeed4('0x43')]?_0x1e1b9e[_0xeed4('0x42')]:_0x44f0dc[_0xeed4('0x3c')];_0x1e1b9e[_0xeed4('0x46')]=qs[_0xeed4('0x47')](_0x275a21[_0xeed4('0x3d')]['sort']);_0x1e1b9e['where']=qs[_0xeed4('0x3f')](_[_0xeed4('0x49')](_0x275a21['query'],_0x44f0dc[_0xeed4('0x3f')]));if(_0x275a21['query'][_0xeed4('0x4a')]){_0x1e1b9e[_0xeed4('0x48')]=_[_0xeed4('0x4b')](_0x1e1b9e[_0xeed4('0x48')],{'$or':_['map'](_0x1e1b9e[_0xeed4('0x42')],function(_0x3ddcc1){var _0xd91441={};_0xd91441[_0x3ddcc1]={'$like':'%'+_0x275a21[_0xeed4('0x3d')][_0xeed4('0x4a')]+'%'};return _0xd91441;})});}_0x1e1b9e=_[_0xeed4('0x4b')]({},_0x1e1b9e,_0x275a21[_0xeed4('0x4d')]);return _0x2ebd77[_0xeed4('0x6a')](_0x1e1b9e);}})[_0xeed4('0x2c')](function(_0x34eba7){if(_0x34eba7){_0x505d23=_0x34eba7[_0xeed4('0x43')];if(!_0x275a21['query'][_0xeed4('0x44')]('nolimit')){_0x1e1b9e[_0xeed4('0x25')]=qs[_0xeed4('0x25')](_0x275a21[_0xeed4('0x3d')][_0xeed4('0x25')]);_0x1e1b9e[_0xeed4('0x22')]=qs['offset'](_0x275a21[_0xeed4('0x3d')][_0xeed4('0x22')]);}return _0x2ebd77[_0xeed4('0x6a')](_0x1e1b9e);}})[_0xeed4('0x2c')](function(_0x160c31){if(_0x160c31){return _0x160c31?{'count':_0x505d23,'rows':_0x160c31}:null;}})[_0xeed4('0x2c')](respondWithResult(_0x18282a,null))[_0xeed4('0x50')](handleError(_0x18282a,null));};exports['addTeams']=function(_0x3e15c1,_0x4dc1b8,_0x94aa56){var _0x1748bc=_0x3e15c1[_0xeed4('0x54')]['ids'];return db['Team'][_0xeed4('0x5f')]({'where':{'id':_0x1748bc},'attributes':['id'],'include':[{'model':db[_0xeed4('0x60')],'as':_0xeed4('0x6c'),'attributes':['id',_0xeed4('0x33'),'online','voicePause',_0xeed4('0x6d')],'raw':!![]}]})['then'](function(_0x1677de){if(_0x1677de){var _0x1557d0=_['flatMap'](_0x1677de,function(_0x5c3c51){var _0x1b6607=_0x5c3c51[_0xeed4('0x2d')]({'plain':!![]});return _0x1b6607[_0xeed4('0x6c')];});return db['OpenchannelQueue'][_0xeed4('0x52')]({'where':{'id':_0x3e15c1[_0xeed4('0x51')]['id']}})['then'](function(_0x2ff2e3){return db[_0xeed4('0x6e')][_0xeed4('0x6f')](function(_0x243058){return _0x2ff2e3[_0xeed4('0x70')](_0x1748bc,{'transaction':_0x243058})[_0xeed4('0x2c')](function(){return BPromise[_0xeed4('0x71')](_0x1557d0,function(_0x439650){return db[_0xeed4('0x5d')][_0xeed4('0x72')]({'where':{'UserId':_0x439650['id'],'OpenchannelQueueId':_0x3e15c1[_0xeed4('0x51')]['id']},'transaction':_0x243058});});})[_0xeed4('0x2c')](function(){_0x1557d0['forEach'](function(_0x2f5189){socket[_0xeed4('0x73')](_0xeed4('0x74'),{'UserId':_0x2f5189['id'],'OpenchannelQueueId':_0x2ff2e3['id']});});});});});}})['then'](respondWithStatusCode(_0x4dc1b8,null))[_0xeed4('0x50')](handleError(_0x4dc1b8,null));};exports[_0xeed4('0x75')]=function(_0x23d674,_0x21b872,_0x1f2e25){return db[_0xeed4('0x6b')][_0xeed4('0x5f')]({'where':{'id':_0x23d674[_0xeed4('0x3d')]['ids']},'attributes':['id'],'include':[{'model':db[_0xeed4('0x60')],'as':_0xeed4('0x6c'),'attributes':['id'],'raw':!![]}]})[_0xeed4('0x2c')](handleEntityNotFound(_0x21b872,null))[_0xeed4('0x2c')](function(_0x350955){var _0x3715d3=_['map'](_0x350955,'id');var _0x4ddc95=[];var _0x9a4c8b=[];var _0x48eb41=squel[_0xeed4('0x76')]();_0x48eb41[_0xeed4('0x77')](_0xeed4('0x78'))[_0xeed4('0x79')]('team_has_openchannel_queues','tq')['join'](_0xeed4('0x7a'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0xeed4('0x48')](_0xeed4('0x7b'),_0x23d674['params']['id']);for(var _0xd7868f=0x0;_0xd7868f<_0x350955['length'];_0xd7868f+=0x1){let _0x58fae3=_0x350955[_0xd7868f];for(var _0x4c6105=0x0;_0x4c6105<_0x58fae3[_0xeed4('0x6c')][_0xeed4('0x43')];_0x4c6105+=0x1){let _0x50f894=_0x58fae3['Agents'][_0x4c6105];var _0x585ce4=_0x48eb41[_0xeed4('0x7c')]();_0x585ce4[_0xeed4('0x48')](_0xeed4('0x7d'),_0x50f894['id']);_0x9a4c8b[_0xeed4('0x7e')](db[_0xeed4('0x6e')][_0xeed4('0x3d')](_0x585ce4[_0xeed4('0x7f')](),{'type':db[_0xeed4('0x6e')][_0xeed4('0x80')][_0xeed4('0x81')]})[_0xeed4('0x2c')](function(_0x20702a){if(_0x20702a[_0xeed4('0x43')]===0x1){return _0x50f894['id'];}else{var _0x11a4c9=_[_0xeed4('0x82')](_[_0xeed4('0x36')](_0x20702a,_0xeed4('0x83')),function(_0x2ef5eb){return _[_0xeed4('0x84')](_0x3715d3,_0x2ef5eb);});if(_0x11a4c9){return _0x50f894['id'];}}}));}}return BPromise[_0xeed4('0x85')](_0x9a4c8b)[_0xeed4('0x2c')](function(_0x47e8f2){_0x4ddc95=_(_0x4ddc95)[_0xeed4('0x86')](_0x47e8f2)[_0xeed4('0x87')]()[_0xeed4('0x88')]();return db[_0xeed4('0x37')]['find']({'where':{'id':_0x23d674[_0xeed4('0x51')]['id']}})[_0xeed4('0x2c')](function(_0x398a2d){return db['sequelize'][_0xeed4('0x6f')](function(_0x507710){return _0x398a2d['removeTeams'](_0x23d674[_0xeed4('0x3d')][_0xeed4('0x89')],{'transaction':_0x507710})['then'](function(){if(!_[_0xeed4('0x8a')](_0x4ddc95)){return _0x398a2d['removeAgents'](_0x4ddc95,{'transaction':_0x507710});}})[_0xeed4('0x2c')](function(){_0x4ddc95[_0xeed4('0x8b')](function(_0x41bcf0){socket[_0xeed4('0x73')](_0xeed4('0x8c'),{'UserId':_0x41bcf0,'OpenchannelQueueId':_0x398a2d['id']});});});});});});})[_0xeed4('0x2c')](respondWithStatusCode(_0x21b872,null))[_0xeed4('0x50')](handleError(_0x21b872,null));};exports['addAgents']=function(_0x1bc6c6,_0x3a26b4,_0x43bd03){return db['OpenchannelQueue'][_0xeed4('0x52')]({'where':{'id':_0x1bc6c6[_0xeed4('0x51')]['id']}})[_0xeed4('0x2c')](handleEntityNotFound(_0x3a26b4,null))[_0xeed4('0x2c')](function(_0xdb8b1c){if(_0xdb8b1c){return _0xdb8b1c[_0xeed4('0x8d')](_0x1bc6c6[_0xeed4('0x54')][_0xeed4('0x89')],_[_0xeed4('0x8e')](_0x1bc6c6['body'],[_0xeed4('0x89'),'id'])||{})[_0xeed4('0x8f')](function(_0x4c27ce){for(var _0x2d8979=0x0;_0x2d8979<_0x1bc6c6[_0xeed4('0x54')][_0xeed4('0x89')][_0xeed4('0x43')];_0x2d8979+=0x1){socket[_0xeed4('0x73')](_0xeed4('0x74'),{'UserId':Number(_0x1bc6c6['body'][_0xeed4('0x89')][_0x2d8979]),'OpenchannelQueueId':Number(_0x1bc6c6[_0xeed4('0x51')]['id'])});}return _0x4c27ce;});}})['then'](respondWithResult(_0x3a26b4,null))[_0xeed4('0x50')](handleError(_0x3a26b4,null));};exports['removeAgents']=function(_0xd1d63c,_0x539d04,_0x2ffb84){return db[_0xeed4('0x37')][_0xeed4('0x52')]({'where':{'id':_0xd1d63c[_0xeed4('0x51')]['id']}})['then'](handleEntityNotFound(_0x539d04,null))['then'](function(_0x182d99){if(_0x182d99){return _0x182d99['removeAgents'](_0xd1d63c[_0xeed4('0x3d')]['ids'])[_0xeed4('0x2c')](function(){if(_[_0xeed4('0x90')](_0xd1d63c['query'][_0xeed4('0x89')])){for(var _0xb296cc=0x0;_0xb296cc<_0xd1d63c[_0xeed4('0x3d')]['ids'][_0xeed4('0x43')];_0xb296cc+=0x1){socket['emit'](_0xeed4('0x8c'),{'UserId':Number(_0xd1d63c['query'][_0xeed4('0x89')][_0xb296cc]),'OpenchannelQueueId':Number(_0xd1d63c[_0xeed4('0x51')]['id'])});}}else{socket[_0xeed4('0x73')](_0xeed4('0x8c'),{'UserId':Number(_0xd1d63c[_0xeed4('0x3d')][_0xeed4('0x89')]),'OpenchannelQueueId':Number(_0xd1d63c['params']['id'])});}});}})[_0xeed4('0x2c')](respondWithStatusCode(_0x539d04,null))[_0xeed4('0x50')](handleError(_0x539d04,null));};exports[_0xeed4('0x91')]=function(_0x403483,_0x56b9e1,_0x48a39b){var _0x53a35f={};var _0x1b4e86={};var _0x4c3f4f;var _0x51174d;return db[_0xeed4('0x37')][_0xeed4('0x5c')]({'where':{'id':_0x403483[_0xeed4('0x51')]['id']}})[_0xeed4('0x2c')](handleEntityNotFound(_0x56b9e1,null))[_0xeed4('0x2c')](function(_0x7471d9){if(_0x7471d9){_0x4c3f4f=_0x7471d9;_0x1b4e86['model']=_[_0xeed4('0x3e')](db[_0xeed4('0x60')]['rawAttributes']);_0x1b4e86[_0xeed4('0x3d')]=_[_0xeed4('0x3e')](_0x403483[_0xeed4('0x3d')]);_0x1b4e86[_0xeed4('0x3f')]=_[_0xeed4('0x40')](_0x1b4e86[_0xeed4('0x3c')],_0x1b4e86[_0xeed4('0x3d')]);_0x53a35f[_0xeed4('0x42')]=_[_0xeed4('0x40')](_0x1b4e86[_0xeed4('0x3c')],qs[_0xeed4('0x41')](_0x403483[_0xeed4('0x3d')][_0xeed4('0x41')]));_0x53a35f[_0xeed4('0x42')]=_0x53a35f[_0xeed4('0x42')][_0xeed4('0x43')]?_0x53a35f[_0xeed4('0x42')]:_0x1b4e86[_0xeed4('0x3c')];_0x53a35f[_0xeed4('0x46')]=qs[_0xeed4('0x47')](_0x403483[_0xeed4('0x3d')][_0xeed4('0x47')]);_0x53a35f['where']=qs[_0xeed4('0x3f')](_[_0xeed4('0x49')](_0x403483[_0xeed4('0x3d')],_0x1b4e86[_0xeed4('0x3f')]));if(_0x403483[_0xeed4('0x3d')][_0xeed4('0x4a')]){_0x53a35f[_0xeed4('0x48')]=_[_0xeed4('0x4b')](_0x53a35f[_0xeed4('0x48')],{'$or':_[_0xeed4('0x36')](_0x53a35f[_0xeed4('0x42')],function(_0x4bdeed){var _0x482e97={};_0x482e97[_0x4bdeed]={'$like':'%'+_0x403483[_0xeed4('0x3d')]['filter']+'%'};return _0x482e97;})});}_0x53a35f=_[_0xeed4('0x4b')]({},_0x53a35f,_0x403483['options']);return _0x4c3f4f[_0xeed4('0x91')](_0x53a35f);}})[_0xeed4('0x2c')](function(_0x682608){if(_0x682608){_0x51174d=_0x682608[_0xeed4('0x43')];if(!_0x403483[_0xeed4('0x3d')][_0xeed4('0x44')](_0xeed4('0x45'))){_0x53a35f[_0xeed4('0x25')]=qs[_0xeed4('0x25')](_0x403483[_0xeed4('0x3d')][_0xeed4('0x25')]);_0x53a35f[_0xeed4('0x22')]=qs['offset'](_0x403483[_0xeed4('0x3d')][_0xeed4('0x22')]);}return _0x4c3f4f['getAgents'](_0x53a35f);}})[_0xeed4('0x2c')](function(_0x2dffc1){if(_0x2dffc1){return _0x2dffc1?{'count':_0x51174d,'rows':_0x2dffc1}:null;}})[_0xeed4('0x2c')](respondWithResult(_0x56b9e1,null))[_0xeed4('0x50')](handleError(_0x56b9e1,null));}; \ No newline at end of file +var _0x49c4=['../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','localhost','socket.io-emitter','./openchannelQueue.socket','register','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','OpenchannelQueues','UserProfileResource','then','sendStatus','error','stack','name','send','index','map','OpenchannelQueue','rawAttributes','type','key','model','keys','filters','intersection','query','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','findAll','rows','catch','params','includeAll','include','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','getMembers','findOne','UserOpenchannelQueue','nolimit','findAndCountAll','UserId','agent','updatedAt','createdAt','format','%s/%s','SIP','openchannelPause','getTeams','addTeams','ids','User','Agents','online','interface','flatMap','sequelize','transaction','each','emit','userOpenchannelQueue:save','removeTeams','Team','field','tq.TeamId','from','team_has_openchannel_queues','join','ut.TeamId\x20=\x20tq.TeamId','OpenchannelQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','TeamId','includes','all','compact','value','forEach','userOpenchannelQueue:remove','addAgents','omit','spread','removeAgents','isArray','getAgents','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','papaparse','ioredis'];(function(_0x2c8533,_0x41ce7e){var _0x4e5f45=function(_0x2ce4c7){while(--_0x2ce4c7){_0x2c8533['push'](_0x2c8533['shift']());}};_0x4e5f45(++_0x41ce7e);}(_0x49c4,0x7e));var _0x449c=function(_0x4f9b18,_0x2cb5ca){_0x4f9b18=_0x4f9b18-0x0;var _0x29f20c=_0x49c4[_0x4f9b18];return _0x29f20c;};'use strict';var emlformat=require(_0x449c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x449c('0x1'));var jsonpatch=require(_0x449c('0x2'));var rp=require(_0x449c('0x3'));var moment=require('moment');var BPromise=require(_0x449c('0x4'));var Mustache=require(_0x449c('0x5'));var util=require('util');var path=require('path');var sox=require(_0x449c('0x6'));var csv=require(_0x449c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x449c('0x8'));var _=require('lodash');var squel=require(_0x449c('0x9'));var crypto=require(_0x449c('0xa'));var jsforce=require('jsforce');var deskjs=require(_0x449c('0xb'));var toCsv=require('to-csv');var querystring=require(_0x449c('0xc'));var Papa=require(_0x449c('0xd'));var Redis=require(_0x449c('0xe'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x449c('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x449c('0x10'))(_0x449c('0x11'));var utils=require(_0x449c('0x12'));var config=require(_0x449c('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x449c('0x14'))['db'];config[_0x449c('0x15')]=_['defaults'](config[_0x449c('0x15')],{'host':_0x449c('0x16'),'port':0x18eb});var socket=require(_0x449c('0x17'))(new Redis(config[_0x449c('0x15')]));require(_0x449c('0x18'))[_0x449c('0x19')](socket);function respondWithStatusCode(_0x37cf5d,_0x3c8c2f){_0x3c8c2f=_0x3c8c2f||0xcc;return function(_0x1bda78){if(_0x1bda78){return _0x37cf5d['sendStatus'](_0x3c8c2f);}return _0x37cf5d[_0x449c('0x1a')](_0x3c8c2f)[_0x449c('0x1b')]();};}function respondWithResult(_0x34afa8,_0x1f836b){_0x1f836b=_0x1f836b||0xc8;return function(_0x391cb3){if(_0x391cb3){return _0x34afa8[_0x449c('0x1a')](_0x1f836b)[_0x449c('0x1c')](_0x391cb3);}};}function respondWithFilteredResult(_0x3acbd0,_0x12ecf4){return function(_0x534c15){if(_0x534c15){var _0x33c630=typeof _0x12ecf4[_0x449c('0x1d')]===_0x449c('0x1e')&&typeof _0x12ecf4[_0x449c('0x1f')]===_0x449c('0x1e');var _0x1bff74=_0x534c15[_0x449c('0x20')];var _0x28a72d=_0x33c630?0x0:_0x12ecf4['offset'];var _0x34cd2e=_0x33c630?_0x534c15[_0x449c('0x20')]:_0x12ecf4[_0x449c('0x1d')]+_0x12ecf4['limit'];var _0x5dfd48;if(_0x34cd2e>=_0x1bff74){_0x34cd2e=_0x1bff74;_0x5dfd48=0xc8;}else{_0x5dfd48=0xce;}_0x3acbd0['status'](_0x5dfd48);return _0x3acbd0[_0x449c('0x21')](_0x449c('0x22'),_0x28a72d+'-'+_0x34cd2e+'/'+_0x1bff74)[_0x449c('0x1c')](_0x534c15);}return null;};}function patchUpdates(_0x322f19){return function(_0x3a8028){try{jsonpatch[_0x449c('0x23')](_0x3a8028,_0x322f19,!![]);}catch(_0x215ede){return BPromise[_0x449c('0x24')](_0x215ede);}return _0x3a8028[_0x449c('0x25')]();};}function saveUpdates(_0x5cce65,_0x2fc600){return function(_0x391dd6){if(_0x391dd6){return _0x391dd6[_0x449c('0x26')](_0x5cce65)['then'](function(_0x716f4b){return _0x716f4b;});}return null;};}function removeEntity(_0x2ebff2,_0x164dea){return function(_0x4e6540){if(_0x4e6540){return _0x4e6540[_0x449c('0x27')]()['then'](function(){var _0x53e552=_0x4e6540[_0x449c('0x28')]({'plain':!![]});var _0x1d6d7b=_0x449c('0x29');return db[_0x449c('0x2a')][_0x449c('0x27')]({'where':{'type':_0x1d6d7b,'resourceId':_0x53e552['id']}})[_0x449c('0x2b')](function(){return _0x4e6540;});})[_0x449c('0x2b')](function(){_0x2ebff2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36d2ce,_0x1e8d45){return function(_0x4512cf){if(!_0x4512cf){_0x36d2ce[_0x449c('0x2c')](0x194);}return _0x4512cf;};}function handleError(_0x24f6e3,_0x48068f){_0x48068f=_0x48068f||0x1f4;return function(_0x5310e7){logger[_0x449c('0x2d')](_0x5310e7[_0x449c('0x2e')]);if(_0x5310e7[_0x449c('0x2f')]){delete _0x5310e7[_0x449c('0x2f')];}_0x24f6e3[_0x449c('0x1a')](_0x48068f)[_0x449c('0x30')](_0x5310e7);};}exports[_0x449c('0x31')]=function(_0x4fcc2b,_0x583252){var _0x1d2063={},_0xa3bbe={},_0xb6beca={'count':0x0,'rows':[]};var _0x31239e=_[_0x449c('0x32')](db[_0x449c('0x33')][_0x449c('0x34')],function(_0x1f4738){return{'name':_0x1f4738['fieldName'],'type':_0x1f4738[_0x449c('0x35')][_0x449c('0x36')]};});_0xa3bbe[_0x449c('0x37')]=_[_0x449c('0x32')](_0x31239e,'name');_0xa3bbe['query']=_[_0x449c('0x38')](_0x4fcc2b['query']);_0xa3bbe[_0x449c('0x39')]=_[_0x449c('0x3a')](_0xa3bbe[_0x449c('0x37')],_0xa3bbe[_0x449c('0x3b')]);_0x1d2063[_0x449c('0x3c')]=_[_0x449c('0x3a')](_0xa3bbe[_0x449c('0x37')],qs['fields'](_0x4fcc2b['query'][_0x449c('0x3d')]));_0x1d2063['attributes']=_0x1d2063['attributes'][_0x449c('0x3e')]?_0x1d2063['attributes']:_0xa3bbe['model'];if(!_0x4fcc2b[_0x449c('0x3b')][_0x449c('0x3f')]('nolimit')){_0x1d2063[_0x449c('0x1f')]=qs[_0x449c('0x1f')](_0x4fcc2b[_0x449c('0x3b')]['limit']);_0x1d2063[_0x449c('0x1d')]=qs[_0x449c('0x1d')](_0x4fcc2b[_0x449c('0x3b')][_0x449c('0x1d')]);}_0x1d2063[_0x449c('0x40')]=qs['sort'](_0x4fcc2b['query'][_0x449c('0x41')]);_0x1d2063[_0x449c('0x42')]=qs['filters'](_[_0x449c('0x43')](_0x4fcc2b[_0x449c('0x3b')],_0xa3bbe[_0x449c('0x39')]),_0x31239e);if(_0x4fcc2b['query'][_0x449c('0x44')]){_0x1d2063[_0x449c('0x42')]=_[_0x449c('0x45')](_0x1d2063[_0x449c('0x42')],{'$or':_[_0x449c('0x32')](_0x31239e,function(_0x211d33){if(_0x211d33['type']!==_0x449c('0x46')){var _0x37e316={};_0x37e316[_0x211d33[_0x449c('0x2f')]]={'$like':'%'+_0x4fcc2b[_0x449c('0x3b')][_0x449c('0x44')]+'%'};return _0x37e316;}})});}_0x1d2063=_[_0x449c('0x45')]({},_0x1d2063,_0x4fcc2b[_0x449c('0x47')]);var _0x3ca4bf={'where':_0x1d2063[_0x449c('0x42')]};return db[_0x449c('0x33')][_0x449c('0x20')](_0x3ca4bf)[_0x449c('0x2b')](function(_0x13f61c){_0xb6beca[_0x449c('0x20')]=_0x13f61c;if(_0x4fcc2b['query']['includeAll']){_0x1d2063['include']=[{'all':!![]}];}return db[_0x449c('0x33')][_0x449c('0x48')](_0x1d2063);})['then'](function(_0x5a20bf){_0xb6beca[_0x449c('0x49')]=_0x5a20bf;return _0xb6beca;})[_0x449c('0x2b')](respondWithFilteredResult(_0x583252,_0x1d2063))[_0x449c('0x4a')](handleError(_0x583252,null));};exports['show']=function(_0xe4a3b,_0x32c1f7){var _0x144988={'raw':!![],'where':{'id':_0xe4a3b[_0x449c('0x4b')]['id']}},_0x4ab275={};_0x4ab275[_0x449c('0x37')]=_[_0x449c('0x38')](db[_0x449c('0x33')]['rawAttributes']);_0x4ab275[_0x449c('0x3b')]=_[_0x449c('0x38')](_0xe4a3b[_0x449c('0x3b')]);_0x4ab275[_0x449c('0x39')]=_[_0x449c('0x3a')](_0x4ab275['model'],_0x4ab275[_0x449c('0x3b')]);_0x144988[_0x449c('0x3c')]=_[_0x449c('0x3a')](_0x4ab275[_0x449c('0x37')],qs[_0x449c('0x3d')](_0xe4a3b[_0x449c('0x3b')][_0x449c('0x3d')]));_0x144988[_0x449c('0x3c')]=_0x144988[_0x449c('0x3c')][_0x449c('0x3e')]?_0x144988[_0x449c('0x3c')]:_0x4ab275['model'];if(_0xe4a3b[_0x449c('0x3b')][_0x449c('0x4c')]){_0x144988[_0x449c('0x4d')]=[{'all':!![]}];}_0x144988=_[_0x449c('0x45')]({},_0x144988,_0xe4a3b[_0x449c('0x47')]);return db[_0x449c('0x33')]['find'](_0x144988)['then'](handleEntityNotFound(_0x32c1f7,null))[_0x449c('0x2b')](respondWithResult(_0x32c1f7,null))[_0x449c('0x4a')](handleError(_0x32c1f7,null));};exports[_0x449c('0x4e')]=function(_0xf745f3,_0x4ba07e){return db[_0x449c('0x33')][_0x449c('0x4e')](_0xf745f3['body'],{})['then'](function(_0x49f576){var _0x4f74d5=_0xf745f3[_0x449c('0x4f')][_0x449c('0x28')]({'plain':!![]});if(!_0x4f74d5)throw new Error(_0x449c('0x50'));if(_0x4f74d5[_0x449c('0x51')]==='user'){var _0x4f2aed=_0x49f576['get']({'plain':!![]});var _0x2bb126=_0x449c('0x29');return db[_0x449c('0x52')][_0x449c('0x53')]({'where':{'name':_0x2bb126,'userProfileId':_0x4f74d5['userProfileId']},'raw':!![]})[_0x449c('0x2b')](function(_0x46f91d){if(_0x46f91d&&_0x46f91d['autoAssociation']===0x0){return db['UserProfileResource'][_0x449c('0x4e')]({'name':_0x4f2aed[_0x449c('0x2f')],'resourceId':_0x4f2aed['id'],'type':_0x46f91d['name'],'sectionId':_0x46f91d['id']},{})[_0x449c('0x2b')](function(){return _0x49f576;});}else{return _0x49f576;}})[_0x449c('0x4a')](function(_0x409379){logger[_0x449c('0x2d')](_0x449c('0x54'),_0x409379);throw _0x409379;});}return _0x49f576;})[_0x449c('0x2b')](respondWithResult(_0x4ba07e,0xc9))[_0x449c('0x4a')](handleError(_0x4ba07e,null));};exports[_0x449c('0x26')]=function(_0x1a8ae6,_0x2dbe54){if(_0x1a8ae6[_0x449c('0x55')]['id']){delete _0x1a8ae6[_0x449c('0x55')]['id'];}return db[_0x449c('0x33')][_0x449c('0x53')]({'where':{'id':_0x1a8ae6[_0x449c('0x4b')]['id']}})[_0x449c('0x2b')](handleEntityNotFound(_0x2dbe54,null))[_0x449c('0x2b')](saveUpdates(_0x1a8ae6[_0x449c('0x55')],null))['then'](respondWithResult(_0x2dbe54,null))['catch'](handleError(_0x2dbe54,null));};exports[_0x449c('0x27')]=function(_0x3df8c9,_0x8485bf){return db[_0x449c('0x33')][_0x449c('0x53')]({'where':{'id':_0x3df8c9[_0x449c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x8485bf,null))[_0x449c('0x2b')](removeEntity(_0x8485bf,null))[_0x449c('0x4a')](handleError(_0x8485bf,null));};exports[_0x449c('0x56')]=function(_0x4d778b,_0x2fb9b9){return db[_0x449c('0x33')][_0x449c('0x56')]()[_0x449c('0x2b')](respondWithResult(_0x2fb9b9,null))['catch'](handleError(_0x2fb9b9,null));};exports[_0x449c('0x57')]=function(_0x23b32c,_0x6f3d79,_0x4787e6){var _0x1c9eaf={'raw':!![],'where':{}},_0x4baced={},_0x29737f;return db['OpenchannelQueue'][_0x449c('0x58')]({'where':{'id':_0x23b32c['params']['id']}})[_0x449c('0x2b')](handleEntityNotFound(_0x6f3d79,null))[_0x449c('0x2b')](function(_0x2fdbd5){if(_0x2fdbd5){_0x29737f=_0x2fdbd5[_0x449c('0x28')]({'plain':!![]});_0x4baced['model']=_['keys'](db[_0x449c('0x59')][_0x449c('0x34')]);_0x4baced['query']=_[_0x449c('0x38')](_0x23b32c['query']);_0x4baced[_0x449c('0x39')]=_[_0x449c('0x3a')](_0x4baced[_0x449c('0x37')],_0x4baced[_0x449c('0x3b')]);_0x1c9eaf[_0x449c('0x3c')]=_['intersection'](_0x4baced['model'],qs[_0x449c('0x3d')](_0x23b32c[_0x449c('0x3b')][_0x449c('0x3d')]));_0x1c9eaf['attributes']=_0x1c9eaf[_0x449c('0x3c')][_0x449c('0x3e')]?_0x1c9eaf[_0x449c('0x3c')]:_0x4baced[_0x449c('0x37')];if(!_0x23b32c['query'][_0x449c('0x3f')](_0x449c('0x5a'))){_0x1c9eaf[_0x449c('0x1f')]=qs[_0x449c('0x1f')](_0x23b32c[_0x449c('0x3b')][_0x449c('0x1f')]);_0x1c9eaf['offset']=qs[_0x449c('0x1d')](_0x23b32c[_0x449c('0x3b')]['offset']);}_0x1c9eaf[_0x449c('0x40')]=qs['sort'](_0x23b32c[_0x449c('0x3b')][_0x449c('0x41')]);_0x1c9eaf[_0x449c('0x42')]=qs[_0x449c('0x39')](_['pick'](_0x23b32c[_0x449c('0x3b')],_0x4baced[_0x449c('0x39')]));_0x1c9eaf[_0x449c('0x42')]['OpenchannelQueueId']=_0x2fdbd5['id'];if(_0x23b32c[_0x449c('0x3b')]['filter']){_0x1c9eaf[_0x449c('0x42')]=_['merge'](_0x1c9eaf[_0x449c('0x42')],{'$or':_[_0x449c('0x32')](_0x1c9eaf[_0x449c('0x3c')],function(_0x314c2c){var _0x4edd89={};_0x4edd89[_0x314c2c]={'$like':'%'+_0x23b32c[_0x449c('0x3b')][_0x449c('0x44')]+'%'};return _0x4edd89;})});}_0x1c9eaf=_[_0x449c('0x45')]({},_0x1c9eaf,_0x23b32c[_0x449c('0x47')]);return db[_0x449c('0x59')]['findAll'](_0x1c9eaf);}})[_0x449c('0x2b')](function(_0x5bb162){if(_0x5bb162){return db['User'][_0x449c('0x5b')]({'where':{'id':_[_0x449c('0x32')](_0x5bb162,_0x449c('0x5c')),'role':_0x449c('0x5d')},'attributes':['id',_0x449c('0x2f'),'openchannelPause',_0x449c('0x5e'),_0x449c('0x5f')]});}})['then'](function(_0x8904e1){if(_0x8904e1){return{'count':_0x8904e1[_0x449c('0x20')],'rows':_['map'](_0x8904e1['rows'],function(_0x59937a){return{'membername':_0x59937a[_0x449c('0x2f')],'UserId':_0x59937a['id'],'queue_name':_0x29737f['name'],'OpenchannelQueueId':_0x29737f['id'],'interface':util[_0x449c('0x60')](_0x449c('0x61'),_0x449c('0x62'),_0x59937a[_0x449c('0x2f')]),'penalty':0x0,'paused':_0x59937a[_0x449c('0x63')],'createdAt':_0x59937a['createdAt'],'updatedAt':_0x59937a[_0x449c('0x5e')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x6f3d79,_0x1c9eaf))[_0x449c('0x4a')](handleError(_0x6f3d79,null));};exports[_0x449c('0x64')]=function(_0x2bce00,_0x30f4b7,_0x134e62){var _0x126536={};var _0x1d42f3={};var _0x38a13a;var _0x4c6d0d;return db['OpenchannelQueue'][_0x449c('0x58')]({'where':{'id':_0x2bce00['params']['id']}})[_0x449c('0x2b')](handleEntityNotFound(_0x30f4b7,null))[_0x449c('0x2b')](function(_0x550efe){if(_0x550efe){_0x38a13a=_0x550efe;_0x1d42f3[_0x449c('0x37')]=_[_0x449c('0x38')](db['Team'][_0x449c('0x34')]);_0x1d42f3[_0x449c('0x3b')]=_[_0x449c('0x38')](_0x2bce00[_0x449c('0x3b')]);_0x1d42f3[_0x449c('0x39')]=_['intersection'](_0x1d42f3['model'],_0x1d42f3[_0x449c('0x3b')]);_0x126536[_0x449c('0x3c')]=_['intersection'](_0x1d42f3['model'],qs[_0x449c('0x3d')](_0x2bce00[_0x449c('0x3b')][_0x449c('0x3d')]));_0x126536[_0x449c('0x3c')]=_0x126536['attributes'][_0x449c('0x3e')]?_0x126536[_0x449c('0x3c')]:_0x1d42f3[_0x449c('0x37')];_0x126536[_0x449c('0x40')]=qs[_0x449c('0x41')](_0x2bce00[_0x449c('0x3b')][_0x449c('0x41')]);_0x126536['where']=qs[_0x449c('0x39')](_['pick'](_0x2bce00['query'],_0x1d42f3['filters']));if(_0x2bce00['query'][_0x449c('0x44')]){_0x126536[_0x449c('0x42')]=_[_0x449c('0x45')](_0x126536[_0x449c('0x42')],{'$or':_[_0x449c('0x32')](_0x126536[_0x449c('0x3c')],function(_0x131146){var _0x3c370a={};_0x3c370a[_0x131146]={'$like':'%'+_0x2bce00[_0x449c('0x3b')]['filter']+'%'};return _0x3c370a;})});}_0x126536=_[_0x449c('0x45')]({},_0x126536,_0x2bce00[_0x449c('0x47')]);return _0x38a13a[_0x449c('0x64')](_0x126536);}})[_0x449c('0x2b')](function(_0x7b98f9){if(_0x7b98f9){_0x4c6d0d=_0x7b98f9[_0x449c('0x3e')];if(!_0x2bce00['query'][_0x449c('0x3f')]('nolimit')){_0x126536[_0x449c('0x1f')]=qs[_0x449c('0x1f')](_0x2bce00[_0x449c('0x3b')][_0x449c('0x1f')]);_0x126536[_0x449c('0x1d')]=qs[_0x449c('0x1d')](_0x2bce00[_0x449c('0x3b')][_0x449c('0x1d')]);}return _0x38a13a[_0x449c('0x64')](_0x126536);}})[_0x449c('0x2b')](function(_0x3b8277){if(_0x3b8277){return _0x3b8277?{'count':_0x4c6d0d,'rows':_0x3b8277}:null;}})[_0x449c('0x2b')](respondWithResult(_0x30f4b7,null))[_0x449c('0x4a')](handleError(_0x30f4b7,null));};exports[_0x449c('0x65')]=function(_0x5c46e3,_0x3d3308,_0x58dc07){var _0x5e3b27=_0x5c46e3[_0x449c('0x55')][_0x449c('0x66')];return db['Team'][_0x449c('0x48')]({'where':{'id':_0x5e3b27},'attributes':['id'],'include':[{'model':db[_0x449c('0x67')],'as':_0x449c('0x68'),'attributes':['id',_0x449c('0x2f'),_0x449c('0x69'),'voicePause',_0x449c('0x6a')],'raw':!![]}]})[_0x449c('0x2b')](function(_0x3a203b){if(_0x3a203b){var _0x5c03b5=_[_0x449c('0x6b')](_0x3a203b,function(_0x1ba0f4){var _0x47ee37=_0x1ba0f4['get']({'plain':!![]});return _0x47ee37[_0x449c('0x68')];});return db[_0x449c('0x33')][_0x449c('0x53')]({'where':{'id':_0x5c46e3['params']['id']}})[_0x449c('0x2b')](function(_0xdfaa25){return db[_0x449c('0x6c')][_0x449c('0x6d')](function(_0x113984){return _0xdfaa25[_0x449c('0x65')](_0x5e3b27,{'transaction':_0x113984})[_0x449c('0x2b')](function(){return BPromise[_0x449c('0x6e')](_0x5c03b5,function(_0x417b3f){return db[_0x449c('0x59')]['findOrCreate']({'where':{'UserId':_0x417b3f['id'],'OpenchannelQueueId':_0x5c46e3['params']['id']},'transaction':_0x113984});});})[_0x449c('0x2b')](function(){_0x5c03b5['forEach'](function(_0x14e817){socket[_0x449c('0x6f')](_0x449c('0x70'),{'UserId':_0x14e817['id'],'OpenchannelQueueId':_0xdfaa25['id']});});});});});}})['then'](respondWithStatusCode(_0x3d3308,null))[_0x449c('0x4a')](handleError(_0x3d3308,null));};exports[_0x449c('0x71')]=function(_0x2b3b52,_0x13b824,_0x513500){return db[_0x449c('0x72')][_0x449c('0x48')]({'where':{'id':_0x2b3b52[_0x449c('0x3b')][_0x449c('0x66')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0x449c('0x68'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x13b824,null))[_0x449c('0x2b')](function(_0x2a0757){var _0x2398d6=_[_0x449c('0x32')](_0x2a0757,'id');var _0x449850=[];var _0x43bcae=[];var _0x306615=squel['select']();_0x306615[_0x449c('0x73')](_0x449c('0x74'))[_0x449c('0x75')](_0x449c('0x76'),'tq')[_0x449c('0x77')]('user_has_teams','ut',_0x449c('0x78'))[_0x449c('0x42')](_0x449c('0x79'),_0x2b3b52[_0x449c('0x4b')]['id']);for(var _0x364a0c=0x0;_0x364a0c<_0x2a0757[_0x449c('0x3e')];_0x364a0c+=0x1){let _0x4b76a3=_0x2a0757[_0x364a0c];for(var _0x425ae3=0x0;_0x425ae3<_0x4b76a3[_0x449c('0x68')][_0x449c('0x3e')];_0x425ae3+=0x1){let _0x739a6d=_0x4b76a3[_0x449c('0x68')][_0x425ae3];var _0x1425f9=_0x306615[_0x449c('0x7a')]();_0x1425f9[_0x449c('0x42')](_0x449c('0x7b'),_0x739a6d['id']);_0x43bcae[_0x449c('0x7c')](db[_0x449c('0x6c')][_0x449c('0x3b')](_0x1425f9[_0x449c('0x7d')](),{'type':db[_0x449c('0x6c')][_0x449c('0x7e')][_0x449c('0x7f')]})[_0x449c('0x2b')](function(_0x239755){if(_0x239755[_0x449c('0x3e')]===0x1){return _0x739a6d['id'];}else{var _0x25ec1e=_['every'](_[_0x449c('0x32')](_0x239755,_0x449c('0x80')),function(_0x1ffce6){return _[_0x449c('0x81')](_0x2398d6,_0x1ffce6);});if(_0x25ec1e){return _0x739a6d['id'];}}}));}}return BPromise[_0x449c('0x82')](_0x43bcae)[_0x449c('0x2b')](function(_0x47a824){_0x449850=_(_0x449850)['union'](_0x47a824)[_0x449c('0x83')]()[_0x449c('0x84')]();return db['OpenchannelQueue'][_0x449c('0x53')]({'where':{'id':_0x2b3b52[_0x449c('0x4b')]['id']}})[_0x449c('0x2b')](function(_0x261ea1){return db[_0x449c('0x6c')][_0x449c('0x6d')](function(_0x5bfa0b){return _0x261ea1[_0x449c('0x71')](_0x2b3b52['query'][_0x449c('0x66')],{'transaction':_0x5bfa0b})[_0x449c('0x2b')](function(){if(!_['isEmpty'](_0x449850)){return _0x261ea1['removeAgents'](_0x449850,{'transaction':_0x5bfa0b});}})[_0x449c('0x2b')](function(){_0x449850[_0x449c('0x85')](function(_0x38abd9){socket[_0x449c('0x6f')](_0x449c('0x86'),{'UserId':_0x38abd9,'OpenchannelQueueId':_0x261ea1['id']});});});});});});})['then'](respondWithStatusCode(_0x13b824,null))[_0x449c('0x4a')](handleError(_0x13b824,null));};exports[_0x449c('0x87')]=function(_0x4b2811,_0x3e3414,_0x421e35){return db[_0x449c('0x33')][_0x449c('0x53')]({'where':{'id':_0x4b2811[_0x449c('0x4b')]['id']}})['then'](handleEntityNotFound(_0x3e3414,null))[_0x449c('0x2b')](function(_0x401bbd){if(_0x401bbd){return _0x401bbd[_0x449c('0x87')](_0x4b2811[_0x449c('0x55')][_0x449c('0x66')],_[_0x449c('0x88')](_0x4b2811['body'],[_0x449c('0x66'),'id'])||{})[_0x449c('0x89')](function(_0x4d09d9){for(var _0x2dda72=0x0;_0x2dda72<_0x4b2811[_0x449c('0x55')]['ids'][_0x449c('0x3e')];_0x2dda72+=0x1){socket[_0x449c('0x6f')]('userOpenchannelQueue:save',{'UserId':Number(_0x4b2811['body'][_0x449c('0x66')][_0x2dda72]),'OpenchannelQueueId':Number(_0x4b2811[_0x449c('0x4b')]['id'])});}return _0x4d09d9;});}})[_0x449c('0x2b')](respondWithResult(_0x3e3414,null))[_0x449c('0x4a')](handleError(_0x3e3414,null));};exports[_0x449c('0x8a')]=function(_0x3322a3,_0x5666bc,_0x454fe0){return db[_0x449c('0x33')][_0x449c('0x53')]({'where':{'id':_0x3322a3['params']['id']}})[_0x449c('0x2b')](handleEntityNotFound(_0x5666bc,null))[_0x449c('0x2b')](function(_0x50d0a0){if(_0x50d0a0){return _0x50d0a0[_0x449c('0x8a')](_0x3322a3[_0x449c('0x3b')]['ids'])[_0x449c('0x2b')](function(){if(_[_0x449c('0x8b')](_0x3322a3[_0x449c('0x3b')]['ids'])){for(var _0x45e215=0x0;_0x45e215<_0x3322a3[_0x449c('0x3b')][_0x449c('0x66')][_0x449c('0x3e')];_0x45e215+=0x1){socket[_0x449c('0x6f')](_0x449c('0x86'),{'UserId':Number(_0x3322a3[_0x449c('0x3b')][_0x449c('0x66')][_0x45e215]),'OpenchannelQueueId':Number(_0x3322a3[_0x449c('0x4b')]['id'])});}}else{socket[_0x449c('0x6f')](_0x449c('0x86'),{'UserId':Number(_0x3322a3['query'][_0x449c('0x66')]),'OpenchannelQueueId':Number(_0x3322a3[_0x449c('0x4b')]['id'])});}});}})[_0x449c('0x2b')](respondWithStatusCode(_0x5666bc,null))['catch'](handleError(_0x5666bc,null));};exports['getAgents']=function(_0x4bf870,_0x1a73e9,_0x58dbb9){var _0x51e9a4={};var _0x12bf4d={};var _0x224611;var _0x11c9a4;return db[_0x449c('0x33')]['findOne']({'where':{'id':_0x4bf870[_0x449c('0x4b')]['id']}})[_0x449c('0x2b')](handleEntityNotFound(_0x1a73e9,null))[_0x449c('0x2b')](function(_0x50592a){if(_0x50592a){_0x224611=_0x50592a;_0x12bf4d[_0x449c('0x37')]=_[_0x449c('0x38')](db[_0x449c('0x67')][_0x449c('0x34')]);_0x12bf4d['query']=_[_0x449c('0x38')](_0x4bf870['query']);_0x12bf4d[_0x449c('0x39')]=_[_0x449c('0x3a')](_0x12bf4d[_0x449c('0x37')],_0x12bf4d[_0x449c('0x3b')]);_0x51e9a4[_0x449c('0x3c')]=_['intersection'](_0x12bf4d['model'],qs[_0x449c('0x3d')](_0x4bf870[_0x449c('0x3b')][_0x449c('0x3d')]));_0x51e9a4[_0x449c('0x3c')]=_0x51e9a4[_0x449c('0x3c')][_0x449c('0x3e')]?_0x51e9a4[_0x449c('0x3c')]:_0x12bf4d['model'];_0x51e9a4[_0x449c('0x40')]=qs[_0x449c('0x41')](_0x4bf870[_0x449c('0x3b')][_0x449c('0x41')]);_0x51e9a4[_0x449c('0x42')]=qs[_0x449c('0x39')](_[_0x449c('0x43')](_0x4bf870[_0x449c('0x3b')],_0x12bf4d['filters']));if(_0x4bf870[_0x449c('0x3b')][_0x449c('0x44')]){_0x51e9a4[_0x449c('0x42')]=_[_0x449c('0x45')](_0x51e9a4[_0x449c('0x42')],{'$or':_[_0x449c('0x32')](_0x51e9a4['attributes'],function(_0x2a6852){var _0x278ab0={};_0x278ab0[_0x2a6852]={'$like':'%'+_0x4bf870[_0x449c('0x3b')]['filter']+'%'};return _0x278ab0;})});}_0x51e9a4=_['merge']({},_0x51e9a4,_0x4bf870['options']);return _0x224611[_0x449c('0x8c')](_0x51e9a4);}})[_0x449c('0x2b')](function(_0x52f80e){if(_0x52f80e){_0x11c9a4=_0x52f80e[_0x449c('0x3e')];if(!_0x4bf870[_0x449c('0x3b')][_0x449c('0x3f')](_0x449c('0x5a'))){_0x51e9a4[_0x449c('0x1f')]=qs[_0x449c('0x1f')](_0x4bf870[_0x449c('0x3b')][_0x449c('0x1f')]);_0x51e9a4['offset']=qs[_0x449c('0x1d')](_0x4bf870[_0x449c('0x3b')]['offset']);}return _0x224611[_0x449c('0x8c')](_0x51e9a4);}})[_0x449c('0x2b')](function(_0x123c6c){if(_0x123c6c){return _0x123c6c?{'count':_0x11c9a4,'rows':_0x123c6c}:null;}})['then'](respondWithResult(_0x1a73e9,null))['catch'](handleError(_0x1a73e9,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.events.js b/server/api/openchannelQueue/openchannelQueue.events.js index 6ad61cd..83e0e18 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 _0x93c8=['events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty','hook','exports'];(function(_0x1859e8,_0x577325){var _0x485082=function(_0x1a950c){while(--_0x1a950c){_0x1859e8['push'](_0x1859e8['shift']());}};_0x485082(++_0x577325);}(_0x93c8,0x10e));var _0x893c=function(_0x126558,_0x143c9a){_0x126558=_0x126558-0x0;var _0x1f6d14=_0x93c8[_0x126558];return _0x1f6d14;};'use strict';var EventEmitter=require(_0x893c('0x0'));var OpenchannelQueue=require(_0x893c('0x1'))['db']['OpenchannelQueue'];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x893c('0x2')](0x0);var events={'afterCreate':_0x893c('0x3'),'afterUpdate':_0x893c('0x4'),'afterDestroy':'remove'};function emitEvent(_0x1e1839){return function(_0x4ce367,_0x32526,_0x130aff){OpenchannelQueueEvents[_0x893c('0x5')](_0x1e1839+':'+_0x4ce367['id'],_0x4ce367);OpenchannelQueueEvents[_0x893c('0x5')](_0x1e1839,_0x4ce367);_0x130aff(null);};}for(var e in events){if(events[_0x893c('0x6')](e)){var event=events[e];OpenchannelQueue[_0x893c('0x7')](e,emitEvent(event));}}module[_0x893c('0x8')]=OpenchannelQueueEvents; \ No newline at end of file +var _0x9fc5=['remove','emit','hook','exports','../../mysqldb','OpenchannelQueue','setMaxListeners','update'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0x9fc5,0x84));var _0x59fc=function(_0x595bd1,_0xb1e7a){_0x595bd1=_0x595bd1-0x0;var _0xd0344f=_0x9fc5[_0x595bd1];return _0xd0344f;};'use strict';var EventEmitter=require('events');var OpenchannelQueue=require(_0x59fc('0x0'))['db'][_0x59fc('0x1')];var OpenchannelQueueEvents=new EventEmitter();OpenchannelQueueEvents[_0x59fc('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x59fc('0x3'),'afterDestroy':_0x59fc('0x4')};function emitEvent(_0x325bc1){return function(_0x14bdac,_0x3453c7,_0x58a9cc){OpenchannelQueueEvents[_0x59fc('0x5')](_0x325bc1+':'+_0x14bdac['id'],_0x14bdac);OpenchannelQueueEvents[_0x59fc('0x5')](_0x325bc1,_0x14bdac);_0x58a9cc(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];OpenchannelQueue[_0x59fc('0x6')](e,emitEvent(event));}}module[_0x59fc('0x7')]=OpenchannelQueueEvents; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.model.js b/server/api/openchannelQueue/openchannelQueue.model.js index e264ae1..023920b 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 _0x5124=['../../config/environment','./openchannelQueue.attributes','exports','define','OpenchannelQueue','openchannel_queues','lodash','util','../../config/logger','moment','bluebird','request-promise','path','rimraf'];(function(_0x210e5d,_0x455fe9){var _0x3cfc28=function(_0x2a239f){while(--_0x2a239f){_0x210e5d['push'](_0x210e5d['shift']());}};_0x3cfc28(++_0x455fe9);}(_0x5124,0x1c6));var _0x4512=function(_0x27e065,_0x370d12){_0x27e065=_0x27e065-0x0;var _0x12d5df=_0x5124[_0x27e065];return _0x12d5df;};'use strict';var _=require(_0x4512('0x0'));var util=require(_0x4512('0x1'));var logger=require(_0x4512('0x2'))('api');var moment=require(_0x4512('0x3'));var BPromise=require(_0x4512('0x4'));var rp=require(_0x4512('0x5'));var fs=require('fs');var path=require(_0x4512('0x6'));var rimraf=require(_0x4512('0x7'));var config=require(_0x4512('0x8'));var attributes=require(_0x4512('0x9'));module[_0x4512('0xa')]=function(_0x2de8da,_0x26e93d){return _0x2de8da[_0x4512('0xb')](_0x4512('0xc'),attributes,{'tableName':_0x4512('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d2c=['util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','./openchannelQueue.attributes','exports','OpenchannelQueue','openchannel_queues'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0x3d2c,0x1ec));var _0xc3d2=function(_0x2db185,_0x2ba146){_0x2db185=_0x2db185-0x0;var _0x3442e4=_0x3d2c[_0x2db185];return _0x3442e4;};'use strict';var _=require('lodash');var util=require(_0xc3d2('0x0'));var logger=require(_0xc3d2('0x1'))(_0xc3d2('0x2'));var moment=require(_0xc3d2('0x3'));var BPromise=require(_0xc3d2('0x4'));var rp=require(_0xc3d2('0x5'));var fs=require('fs');var path=require(_0xc3d2('0x6'));var rimraf=require('rimraf');var config=require(_0xc3d2('0x7'));var attributes=require(_0xc3d2('0x8'));module[_0xc3d2('0x9')]=function(_0x2b9191,_0x417adb){return _0x2b9191['define'](_0xc3d2('0xa'),attributes,{'tableName':_0xc3d2('0xb'),'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 7d3bd0f..abe2054 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 _0x7176=['register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','OpenchannelQueue','findAll','options','raw','where','attributes','limit','include','map','model','GetOpenchannelQueue','debug','ShowOpenchannelQueue','find','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','redis','defaults','localhost','./openchannelQueue.socket'];(function(_0x18298c,_0x49f0ee){var _0x27bf0a=function(_0x1b9ec4){while(--_0x1b9ec4){_0x18298c['push'](_0x18298c['shift']());}};_0x27bf0a(++_0x49f0ee);}(_0x7176,0x6b));var _0x6717=function(_0x288e72,_0xd94c34){_0x288e72=_0x288e72-0x0;var _0x4af292=_0x7176[_0x288e72];return _0x4af292;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x6717('0x0'));var BPromise=require(_0x6717('0x1'));var rs=require(_0x6717('0x2'));var fs=require('fs');var Redis=require(_0x6717('0x3'));var db=require(_0x6717('0x4'))['db'];var utils=require(_0x6717('0x5'));var logger=require(_0x6717('0x6'))(_0x6717('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6717('0x8')]['http']({'port':0x232a});config[_0x6717('0x9')]=_[_0x6717('0xa')](config[_0x6717('0x9')],{'host':_0x6717('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6717('0x9')]));require(_0x6717('0xc'))[_0x6717('0xd')](socket);function respondWithRpcPromise(_0x3ad3e2,_0x1e0652,_0x415ad3){return new BPromise(function(_0x643707,_0x2c79f1){return client[_0x6717('0xe')](_0x3ad3e2,_0x415ad3)[_0x6717('0xf')](function(_0x2d36ba){logger[_0x6717('0x10')](_0x6717('0x11'),_0x1e0652,_0x6717('0x12'));logger['debug'](_0x6717('0x13'),_0x1e0652,_0x6717('0x12'),JSON[_0x6717('0x14')](_0x2d36ba));if(_0x2d36ba[_0x6717('0x15')]){if(_0x2d36ba[_0x6717('0x15')][_0x6717('0x16')]===0x1f4){logger[_0x6717('0x15')]('OpenchannelQueue,\x20%s,\x20%s',_0x1e0652,_0x2d36ba[_0x6717('0x15')][_0x6717('0x17')]);return _0x2c79f1(_0x2d36ba[_0x6717('0x15')][_0x6717('0x17')]);}logger[_0x6717('0x15')](_0x6717('0x11'),_0x1e0652,_0x2d36ba[_0x6717('0x15')]['message']);return _0x643707(_0x2d36ba[_0x6717('0x15')]['message']);}else{logger['info'](_0x6717('0x11'),_0x1e0652,_0x6717('0x12'));_0x643707(_0x2d36ba[_0x6717('0x18')][_0x6717('0x17')]);}})[_0x6717('0x19')](function(_0xffba1e){logger['error'](_0x6717('0x11'),_0x1e0652,_0xffba1e);_0x2c79f1(_0xffba1e);});});}exports['GetOpenchannelQueue']=function(_0x27d577){var _0x4307a7=this;return new Promise(function(_0x4d916e,_0x413afc){return db[_0x6717('0x1a')][_0x6717('0x1b')]({'raw':_0x27d577[_0x6717('0x1c')]?_0x27d577[_0x6717('0x1c')][_0x6717('0x1d')]===undefined?!![]:![]:!![],'where':_0x27d577[_0x6717('0x1c')]?_0x27d577[_0x6717('0x1c')][_0x6717('0x1e')]||null:null,'attributes':_0x27d577['options']?_0x27d577[_0x6717('0x1c')][_0x6717('0x1f')]||null:null,'limit':_0x27d577[_0x6717('0x1c')]?_0x27d577['options'][_0x6717('0x20')]||null:null,'include':_0x27d577[_0x6717('0x1c')]?_0x27d577['options'][_0x6717('0x21')]?_[_0x6717('0x22')](_0x27d577['options'][_0x6717('0x21')],function(_0x1a7837){return{'model':db[_0x1a7837[_0x6717('0x23')]],'as':_0x1a7837['as'],'attributes':_0x1a7837['attributes'],'include':_0x1a7837[_0x6717('0x21')]?_[_0x6717('0x22')](_0x1a7837[_0x6717('0x21')],function(_0x2c9d49){return{'model':db[_0x2c9d49[_0x6717('0x23')]],'as':_0x2c9d49['as'],'attributes':_0x2c9d49['attributes'],'include':_0x2c9d49[_0x6717('0x21')]?_[_0x6717('0x22')](_0x2c9d49['include'],function(_0x4d15b0){return{'model':db[_0x4d15b0[_0x6717('0x23')]],'as':_0x4d15b0['as'],'attributes':_0x4d15b0[_0x6717('0x1f')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x3277b7){logger[_0x6717('0x10')](_0x6717('0x24'),_0x27d577);logger[_0x6717('0x25')](_0x6717('0x24'),_0x27d577,JSON['stringify'](_0x3277b7));_0x4d916e(_0x3277b7);})[_0x6717('0x19')](function(_0x308835){logger[_0x6717('0x15')](_0x6717('0x24'),_0x308835[_0x6717('0x17')],_0x27d577);_0x413afc(_0x4307a7[_0x6717('0x15')](0x1f4,_0x308835[_0x6717('0x17')]));});});};exports[_0x6717('0x26')]=function(_0x422201){var _0x3746fe=this;return new Promise(function(_0x25bd53,_0x32c7cb){return db[_0x6717('0x1a')][_0x6717('0x27')]({'raw':_0x422201[_0x6717('0x1c')]?_0x422201[_0x6717('0x1c')][_0x6717('0x1d')]===undefined?!![]:![]:!![],'where':_0x422201[_0x6717('0x1c')]?_0x422201[_0x6717('0x1c')][_0x6717('0x1e')]||null:null,'attributes':_0x422201[_0x6717('0x1c')]?_0x422201[_0x6717('0x1c')][_0x6717('0x1f')]||null:null,'include':_0x422201[_0x6717('0x1c')]?_0x422201[_0x6717('0x1c')][_0x6717('0x21')]?_[_0x6717('0x22')](_0x422201['options'][_0x6717('0x21')],function(_0x228216){return{'model':db[_0x228216[_0x6717('0x23')]],'as':_0x228216['as'],'attributes':_0x228216[_0x6717('0x1f')],'include':_0x228216[_0x6717('0x21')]?_[_0x6717('0x22')](_0x228216[_0x6717('0x21')],function(_0x333596){return{'model':db[_0x333596[_0x6717('0x23')]],'as':_0x333596['as'],'attributes':_0x333596[_0x6717('0x1f')],'include':_0x333596[_0x6717('0x21')]?_[_0x6717('0x22')](_0x333596[_0x6717('0x21')],function(_0xce308f){return{'model':db[_0xce308f[_0x6717('0x23')]],'as':_0xce308f['as'],'attributes':_0xce308f[_0x6717('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6717('0xf')](function(_0x249548){logger['info'](_0x6717('0x26'),_0x422201);logger[_0x6717('0x25')]('ShowOpenchannelQueue',_0x422201,JSON[_0x6717('0x14')](_0x249548));_0x25bd53(_0x249548);})[_0x6717('0x19')](function(_0x2f46e7){logger[_0x6717('0x15')](_0x6717('0x26'),_0x2f46e7[_0x6717('0x17')],_0x422201);_0x32c7cb(_0x3746fe['error'](0x1f4,_0x2f46e7['message']));});});}; \ No newline at end of file +var _0x0295=['./openchannelQueue.socket','register','request','then','info','OpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetOpenchannelQueue','OpenchannelQueue','findAll','options','where','attributes','limit','map','include','model','ShowOpenchannelQueue','find','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter'];(function(_0x4ea971,_0x174234){var _0x86b88d=function(_0x549b7e){while(--_0x549b7e){_0x4ea971['push'](_0x4ea971['shift']());}};_0x86b88d(++_0x174234);}(_0x0295,0xed));var _0x5029=function(_0x1e9483,_0x1a4949){_0x1e9483=_0x1e9483-0x0;var _0x4b7e09=_0x0295[_0x1e9483];return _0x4b7e09;};'use strict';var _=require(_0x5029('0x0'));var util=require('util');var moment=require(_0x5029('0x1'));var BPromise=require(_0x5029('0x2'));var rs=require(_0x5029('0x3'));var fs=require('fs');var Redis=require(_0x5029('0x4'));var db=require(_0x5029('0x5'))['db'];var utils=require(_0x5029('0x6'));var logger=require(_0x5029('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5029('0x8'));var client=jayson[_0x5029('0x9')][_0x5029('0xa')]({'port':0x232a});config[_0x5029('0xb')]=_[_0x5029('0xc')](config[_0x5029('0xb')],{'host':_0x5029('0xd'),'port':0x18eb});var socket=require(_0x5029('0xe'))(new Redis(config[_0x5029('0xb')]));require(_0x5029('0xf'))[_0x5029('0x10')](socket);function respondWithRpcPromise(_0x3f069b,_0x2bdd75,_0x406b76){return new BPromise(function(_0x333c0a,_0x338476){return client[_0x5029('0x11')](_0x3f069b,_0x406b76)[_0x5029('0x12')](function(_0xfe22f4){logger[_0x5029('0x13')](_0x5029('0x14'),_0x2bdd75,_0x5029('0x15'));logger[_0x5029('0x16')](_0x5029('0x17'),_0x2bdd75,'request\x20sent',JSON[_0x5029('0x18')](_0xfe22f4));if(_0xfe22f4['error']){if(_0xfe22f4[_0x5029('0x19')][_0x5029('0x1a')]===0x1f4){logger['error'](_0x5029('0x14'),_0x2bdd75,_0xfe22f4[_0x5029('0x19')]['message']);return _0x338476(_0xfe22f4[_0x5029('0x19')]['message']);}logger['error'](_0x5029('0x14'),_0x2bdd75,_0xfe22f4[_0x5029('0x19')][_0x5029('0x1b')]);return _0x333c0a(_0xfe22f4[_0x5029('0x19')][_0x5029('0x1b')]);}else{logger[_0x5029('0x13')]('OpenchannelQueue,\x20%s,\x20%s',_0x2bdd75,'request\x20sent');_0x333c0a(_0xfe22f4[_0x5029('0x1c')][_0x5029('0x1b')]);}})[_0x5029('0x1d')](function(_0x482abb){logger[_0x5029('0x19')](_0x5029('0x14'),_0x2bdd75,_0x482abb);_0x338476(_0x482abb);});});}exports[_0x5029('0x1e')]=function(_0xdc390b){var _0xe9a1bd=this;return new Promise(function(_0x2ed80c,_0x236f8a){return db[_0x5029('0x1f')][_0x5029('0x20')]({'raw':_0xdc390b[_0x5029('0x21')]?_0xdc390b['options']['raw']===undefined?!![]:![]:!![],'where':_0xdc390b[_0x5029('0x21')]?_0xdc390b[_0x5029('0x21')][_0x5029('0x22')]||null:null,'attributes':_0xdc390b[_0x5029('0x21')]?_0xdc390b[_0x5029('0x21')][_0x5029('0x23')]||null:null,'limit':_0xdc390b['options']?_0xdc390b[_0x5029('0x21')][_0x5029('0x24')]||null:null,'include':_0xdc390b['options']?_0xdc390b[_0x5029('0x21')]['include']?_[_0x5029('0x25')](_0xdc390b[_0x5029('0x21')][_0x5029('0x26')],function(_0x3bf664){return{'model':db[_0x3bf664['model']],'as':_0x3bf664['as'],'attributes':_0x3bf664[_0x5029('0x23')],'include':_0x3bf664[_0x5029('0x26')]?_[_0x5029('0x25')](_0x3bf664[_0x5029('0x26')],function(_0x50df2e){return{'model':db[_0x50df2e[_0x5029('0x27')]],'as':_0x50df2e['as'],'attributes':_0x50df2e[_0x5029('0x23')],'include':_0x50df2e['include']?_[_0x5029('0x25')](_0x50df2e[_0x5029('0x26')],function(_0x22fdd9){return{'model':db[_0x22fdd9[_0x5029('0x27')]],'as':_0x22fdd9['as'],'attributes':_0x22fdd9[_0x5029('0x23')]};}):[]};}):[]};}):[]:[]})[_0x5029('0x12')](function(_0xd62c09){logger[_0x5029('0x13')]('GetOpenchannelQueue',_0xdc390b);logger[_0x5029('0x16')](_0x5029('0x1e'),_0xdc390b,JSON[_0x5029('0x18')](_0xd62c09));_0x2ed80c(_0xd62c09);})[_0x5029('0x1d')](function(_0x60fb3f){logger['error'](_0x5029('0x1e'),_0x60fb3f['message'],_0xdc390b);_0x236f8a(_0xe9a1bd[_0x5029('0x19')](0x1f4,_0x60fb3f['message']));});});};exports[_0x5029('0x28')]=function(_0x1c6326){var _0x5022f9=this;return new Promise(function(_0x43e328,_0x550821){return db[_0x5029('0x1f')][_0x5029('0x29')]({'raw':_0x1c6326[_0x5029('0x21')]?_0x1c6326[_0x5029('0x21')]['raw']===undefined?!![]:![]:!![],'where':_0x1c6326[_0x5029('0x21')]?_0x1c6326[_0x5029('0x21')]['where']||null:null,'attributes':_0x1c6326[_0x5029('0x21')]?_0x1c6326[_0x5029('0x21')]['attributes']||null:null,'include':_0x1c6326['options']?_0x1c6326[_0x5029('0x21')][_0x5029('0x26')]?_[_0x5029('0x25')](_0x1c6326['options'][_0x5029('0x26')],function(_0x1c11be){return{'model':db[_0x1c11be[_0x5029('0x27')]],'as':_0x1c11be['as'],'attributes':_0x1c11be[_0x5029('0x23')],'include':_0x1c11be[_0x5029('0x26')]?_[_0x5029('0x25')](_0x1c11be[_0x5029('0x26')],function(_0x36b4d6){return{'model':db[_0x36b4d6[_0x5029('0x27')]],'as':_0x36b4d6['as'],'attributes':_0x36b4d6[_0x5029('0x23')],'include':_0x36b4d6[_0x5029('0x26')]?_[_0x5029('0x25')](_0x36b4d6[_0x5029('0x26')],function(_0x3528f6){return{'model':db[_0x3528f6[_0x5029('0x27')]],'as':_0x3528f6['as'],'attributes':_0x3528f6[_0x5029('0x23')]};}):[]};}):[]};}):[]:[]})[_0x5029('0x12')](function(_0x599126){logger[_0x5029('0x13')](_0x5029('0x28'),_0x1c6326);logger['debug'](_0x5029('0x28'),_0x1c6326,JSON['stringify'](_0x599126));_0x43e328(_0x599126);})[_0x5029('0x1d')](function(_0x3d86ba){logger['error'](_0x5029('0x28'),_0x3d86ba[_0x5029('0x1b')],_0x1c6326);_0x550821(_0x5022f9[_0x5029('0x19')](0x1f4,_0x3d86ba[_0x5029('0x1b')]));});});}; \ No newline at end of file diff --git a/server/api/openchannelQueue/openchannelQueue.socket.js b/server/api/openchannelQueue/openchannelQueue.socket.js index f0a3dcb..7a2c6ab 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 _0x0bba=['emit','register','openchannelQueue:','save','remove','update'];(function(_0x38e57d,_0x4b8e13){var _0x2af007=function(_0x1e6b69){while(--_0x1e6b69){_0x38e57d['push'](_0x38e57d['shift']());}};_0x2af007(++_0x4b8e13);}(_0x0bba,0x129));var _0xa0bb=function(_0xc28920,_0x2d5919){_0xc28920=_0xc28920-0x0;var _0x381942=_0x0bba[_0xc28920];return _0x381942;};'use strict';var OpenchannelQueueEvents=require('./openchannelQueue.events');var events=[_0xa0bb('0x0'),_0xa0bb('0x1'),_0xa0bb('0x2')];function createListener(_0x259478,_0x4f1116){return function(_0x3e1fc5){_0x4f1116[_0xa0bb('0x3')](_0x259478,_0x3e1fc5);};}function removeListener(_0x1b1961,_0x2d2232){return function(){OpenchannelQueueEvents['removeListener'](_0x1b1961,_0x2d2232);};}exports[_0xa0bb('0x4')]=function(_0x500d31){for(var _0x275348=0x0,_0x40ee29=events['length'];_0x275348<_0x40ee29;_0x275348++){var _0x1f9ac4=events[_0x275348];var _0x291b02=createListener(_0xa0bb('0x5')+_0x1f9ac4,_0x500d31);OpenchannelQueueEvents['on'](_0x1f9ac4,_0x291b02);}}; \ No newline at end of file +var _0x1bc9=['./openchannelQueue.events','remove','update','emit','removeListener','register','length','openchannelQueue:'];(function(_0x592cea,_0x4e72f1){var _0x1e9cc6=function(_0x166217){while(--_0x166217){_0x592cea['push'](_0x592cea['shift']());}};_0x1e9cc6(++_0x4e72f1);}(_0x1bc9,0x1c8));var _0x91bc=function(_0x1acc2d,_0x597696){_0x1acc2d=_0x1acc2d-0x0;var _0xabfa6d=_0x1bc9[_0x1acc2d];return _0xabfa6d;};'use strict';var OpenchannelQueueEvents=require(_0x91bc('0x0'));var events=['save',_0x91bc('0x1'),_0x91bc('0x2')];function createListener(_0x50f43a,_0x35fdf4){return function(_0x4dd4d7){_0x35fdf4[_0x91bc('0x3')](_0x50f43a,_0x4dd4d7);};}function removeListener(_0x10dd61,_0x3d1fc0){return function(){OpenchannelQueueEvents[_0x91bc('0x4')](_0x10dd61,_0x3d1fc0);};}exports[_0x91bc('0x5')]=function(_0x16069c){for(var _0x11a7e8=0x0,_0x1a51d2=events[_0x91bc('0x6')];_0x11a7e8<_0x1a51d2;_0x11a7e8++){var _0x11f2c4=events[_0x11a7e8];var _0x4b58ae=createListener(_0x91bc('0x7')+_0x11f2c4,_0x16069c);OpenchannelQueueEvents['on'](_0x11f2c4,_0x4b58ae);}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/index.js b/server/api/openchannelQueueReport/index.js index e20f944..590b08f 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 _0x59df=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./openchannelQueueReport.controller','get','isAuthenticated','index','/describe','describe','show','post','create','put','/:id','destroy','multer','util','path','connect-timeout','express'];(function(_0x491485,_0xed71e8){var _0x38e71c=function(_0x33e72c){while(--_0x33e72c){_0x491485['push'](_0x491485['shift']());}};_0x38e71c(++_0xed71e8);}(_0x59df,0x1f3));var _0xf59d=function(_0x2a927c,_0x599c05){_0x2a927c=_0x2a927c-0x0;var _0x4f91ea=_0x59df[_0x2a927c];return _0x4f91ea;};'use strict';var multer=require(_0xf59d('0x0'));var util=require(_0xf59d('0x1'));var path=require(_0xf59d('0x2'));var timeout=require(_0xf59d('0x3'));var express=require(_0xf59d('0x4'));var router=express[_0xf59d('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xf59d('0x6'));var interaction=require(_0xf59d('0x7'));var config=require(_0xf59d('0x8'));var controller=require(_0xf59d('0x9'));router[_0xf59d('0xa')]('/',auth[_0xf59d('0xb')](),controller[_0xf59d('0xc')]);router[_0xf59d('0xa')](_0xf59d('0xd'),auth[_0xf59d('0xb')](),controller[_0xf59d('0xe')]);router[_0xf59d('0xa')]('/:id',auth[_0xf59d('0xb')](),controller[_0xf59d('0xf')]);router[_0xf59d('0x10')]('/',auth[_0xf59d('0xb')](),controller[_0xf59d('0x11')]);router[_0xf59d('0x12')](_0xf59d('0x13'),auth[_0xf59d('0xb')](),controller['update']);router['delete'](_0xf59d('0x13'),auth[_0xf59d('0xb')](),controller[_0xf59d('0x14')]);module['exports']=router; \ No newline at end of file +var _0x3546=['destroy','multer','path','connect-timeout','express','Router','fs-extra','../../config/environment','./openchannelQueueReport.controller','isAuthenticated','index','get','/describe','describe','/:id','show','put','update','delete'];(function(_0xd36b48,_0x625c83){var _0x2b148d=function(_0x3a1d1a){while(--_0x3a1d1a){_0xd36b48['push'](_0xd36b48['shift']());}};_0x2b148d(++_0x625c83);}(_0x3546,0x1dc));var _0x6354=function(_0x57f8c0,_0x136cf6){_0x57f8c0=_0x57f8c0-0x0;var _0x117f08=_0x3546[_0x57f8c0];return _0x117f08;};'use strict';var multer=require(_0x6354('0x0'));var util=require('util');var path=require(_0x6354('0x1'));var timeout=require(_0x6354('0x2'));var express=require(_0x6354('0x3'));var router=express[_0x6354('0x4')]();var fs_extra=require(_0x6354('0x5'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x6354('0x6'));var controller=require(_0x6354('0x7'));router['get']('/',auth[_0x6354('0x8')](),controller[_0x6354('0x9')]);router[_0x6354('0xa')](_0x6354('0xb'),auth[_0x6354('0x8')](),controller[_0x6354('0xc')]);router['get'](_0x6354('0xd'),auth['isAuthenticated'](),controller[_0x6354('0xe')]);router['post']('/',auth[_0x6354('0x8')](),controller['create']);router[_0x6354('0xf')](_0x6354('0xd'),auth[_0x6354('0x8')](),controller[_0x6354('0x10')]);router[_0x6354('0x11')]('/:id',auth['isAuthenticated'](),controller[_0x6354('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js b/server/api/openchannelQueueReport/openchannelQueueReport.attributes.js index ddd16b8..a5512b3 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 _0xb0ac=['moment','sequelize','STRING','DATE'];(function(_0x1128a0,_0x40bb1f){var _0xbd4e17=function(_0x269380){while(--_0x269380){_0x1128a0['push'](_0x1128a0['shift']());}};_0xbd4e17(++_0x40bb1f);}(_0xb0ac,0x110));var _0xcb0a=function(_0x4ea4ed,_0x47e40f){_0x4ea4ed=_0x4ea4ed-0x0;var _0x140fb2=_0xb0ac[_0x4ea4ed];return _0x140fb2;};'use strict';var moment=require(_0xcb0a('0x0'));var Sequelize=require(_0xcb0a('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xcb0a('0x2')],'allowNull':![]},'from':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xcb0a('0x3')]},'leaveAt':{'type':Sequelize[_0xcb0a('0x3')]},'acceptAt':{'type':Sequelize[_0xcb0a('0x3')]},'exitAt':{'type':Sequelize['DATE']},'reason':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x44ed=['sequelize','STRING','DATE','moment'];(function(_0xb36adc,_0x1ed5cd){var _0x1dedd7=function(_0x4bb9db){while(--_0x4bb9db){_0xb36adc['push'](_0xb36adc['shift']());}};_0x1dedd7(++_0x1ed5cd);}(_0x44ed,0x183));var _0xd44e=function(_0x28ef79,_0x4f77e1){_0x28ef79=_0x28ef79-0x0;var _0x2d15ab=_0x44ed[_0x28ef79];return _0x2d15ab;};'use strict';var moment=require(_0xd44e('0x0'));var Sequelize=require(_0xd44e('0x1'));module['exports']={'uniqueid':{'type':Sequelize[_0xd44e('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0xd44e('0x2')]},'joinAt':{'type':Sequelize[_0xd44e('0x3')]},'leaveAt':{'type':Sequelize[_0xd44e('0x3')]},'acceptAt':{'type':Sequelize['DATE']},'exitAt':{'type':Sequelize[_0xd44e('0x3')]},'reason':{'type':Sequelize[_0xd44e('0x2')]}}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.controller.js b/server/api/openchannelQueueReport/openchannelQueueReport.controller.js index 1db4896..93ef1c1 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 _0xb532=['OpenchannelQueueReport','includeAll','include','findAll','rows','catch','show','params','keys','attributes','find','create','update','body','describe','eml-format','rimraf','fast-json-patch','request-promise','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','save','then','error','name','send','rawAttributes','type','key','model','query','intersection','fields','length','hasOwnProperty','nolimit','order','sort','pick','filters','filter','where','merge','map','VIRTUAL','options'];(function(_0x7d0a91,_0x12de53){var _0x21139b=function(_0x1801ba){while(--_0x1801ba){_0x7d0a91['push'](_0x7d0a91['shift']());}};_0x21139b(++_0x12de53);}(_0xb532,0xa3));var _0x2b53=function(_0x596b3d,_0x2a6e03){_0x596b3d=_0x596b3d-0x0;var _0x53dda8=_0xb532[_0x596b3d];return _0x53dda8;};'use strict';var emlformat=require(_0x2b53('0x0'));var rimraf=require(_0x2b53('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2b53('0x2'));var rp=require(_0x2b53('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x2b53('0x4'));var util=require(_0x2b53('0x5'));var path=require('path');var sox=require(_0x2b53('0x6'));var csv=require(_0x2b53('0x7'));var ejs=require(_0x2b53('0x8'));var fs=require('fs');var fs_extra=require(_0x2b53('0x9'));var _=require(_0x2b53('0xa'));var squel=require(_0x2b53('0xb'));var crypto=require('crypto');var jsforce=require(_0x2b53('0xc'));var deskjs=require(_0x2b53('0xd'));var toCsv=require(_0x2b53('0x7'));var querystring=require(_0x2b53('0xe'));var Papa=require('papaparse');var Redis=require(_0x2b53('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x2b53('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x2b53('0x11'));var logger=require(_0x2b53('0x12'))(_0x2b53('0x13'));var utils=require('../../config/utils');var config=require(_0x2b53('0x14'));var licenseUtil=require(_0x2b53('0x15'));var db=require(_0x2b53('0x16'))['db'];function respondWithStatusCode(_0x2d5fe7,_0x169b2a){_0x169b2a=_0x169b2a||0xcc;return function(_0xf124aa){if(_0xf124aa){return _0x2d5fe7[_0x2b53('0x17')](_0x169b2a);}return _0x2d5fe7['status'](_0x169b2a)[_0x2b53('0x18')]();};}function respondWithResult(_0x41b525,_0x1a1353){_0x1a1353=_0x1a1353||0xc8;return function(_0x6ede99){if(_0x6ede99){return _0x41b525['status'](_0x1a1353)[_0x2b53('0x19')](_0x6ede99);}};}function respondWithFilteredResult(_0x1b5428,_0x2f69da){return function(_0x262b3d){if(_0x262b3d){var _0x4e7991=typeof _0x2f69da[_0x2b53('0x1a')]===_0x2b53('0x1b')&&typeof _0x2f69da[_0x2b53('0x1c')]===_0x2b53('0x1b');var _0x47be33=_0x262b3d[_0x2b53('0x1d')];var _0x4324f1=_0x4e7991?0x0:_0x2f69da[_0x2b53('0x1a')];var _0x2a6070=_0x4e7991?_0x262b3d[_0x2b53('0x1d')]:_0x2f69da['offset']+_0x2f69da[_0x2b53('0x1c')];var _0x547e03;if(_0x2a6070>=_0x47be33){_0x2a6070=_0x47be33;_0x547e03=0xc8;}else{_0x547e03=0xce;}_0x1b5428[_0x2b53('0x1e')](_0x547e03);return _0x1b5428[_0x2b53('0x1f')](_0x2b53('0x20'),_0x4324f1+'-'+_0x2a6070+'/'+_0x47be33)[_0x2b53('0x19')](_0x262b3d);}return null;};}function patchUpdates(_0x3cbf72){return function(_0x46a7d2){try{jsonpatch[_0x2b53('0x21')](_0x46a7d2,_0x3cbf72,!![]);}catch(_0x818166){return BPromise['reject'](_0x818166);}return _0x46a7d2[_0x2b53('0x22')]();};}function saveUpdates(_0x141993,_0x32f830){return function(_0x139ee1){if(_0x139ee1){return _0x139ee1['update'](_0x141993)[_0x2b53('0x23')](function(_0x2f4a3f){return _0x2f4a3f;});}return null;};}function removeEntity(_0x3b585a,_0x11b680){return function(_0xa9d870){if(_0xa9d870){return _0xa9d870['destroy']()[_0x2b53('0x23')](function(){_0x3b585a[_0x2b53('0x1e')](0xcc)[_0x2b53('0x18')]();});}};}function handleEntityNotFound(_0x4d040d,_0x5512d5){return function(_0x2a9d02){if(!_0x2a9d02){_0x4d040d[_0x2b53('0x17')](0x194);}return _0x2a9d02;};}function handleError(_0x73294a,_0x310aab){_0x310aab=_0x310aab||0x1f4;return function(_0x4099ac){logger[_0x2b53('0x24')](_0x4099ac['stack']);if(_0x4099ac[_0x2b53('0x25')]){delete _0x4099ac[_0x2b53('0x25')];}_0x73294a[_0x2b53('0x1e')](_0x310aab)[_0x2b53('0x26')](_0x4099ac);};}exports['index']=function(_0x2b8e6a,_0x2548ee){var _0x2f9511={},_0x451fdb={},_0x195f48={'count':0x0,'rows':[]};var _0x22fe02=_['map'](db['OpenchannelQueueReport'][_0x2b53('0x27')],function(_0x273e9d){return{'name':_0x273e9d['fieldName'],'type':_0x273e9d[_0x2b53('0x28')][_0x2b53('0x29')]};});_0x451fdb[_0x2b53('0x2a')]=_['map'](_0x22fe02,'name');_0x451fdb[_0x2b53('0x2b')]=_['keys'](_0x2b8e6a[_0x2b53('0x2b')]);_0x451fdb['filters']=_[_0x2b53('0x2c')](_0x451fdb['model'],_0x451fdb[_0x2b53('0x2b')]);_0x2f9511['attributes']=_[_0x2b53('0x2c')](_0x451fdb[_0x2b53('0x2a')],qs[_0x2b53('0x2d')](_0x2b8e6a[_0x2b53('0x2b')][_0x2b53('0x2d')]));_0x2f9511['attributes']=_0x2f9511['attributes'][_0x2b53('0x2e')]?_0x2f9511['attributes']:_0x451fdb[_0x2b53('0x2a')];if(!_0x2b8e6a['query'][_0x2b53('0x2f')](_0x2b53('0x30'))){_0x2f9511[_0x2b53('0x1c')]=qs[_0x2b53('0x1c')](_0x2b8e6a['query']['limit']);_0x2f9511['offset']=qs[_0x2b53('0x1a')](_0x2b8e6a[_0x2b53('0x2b')]['offset']);}_0x2f9511[_0x2b53('0x31')]=qs[_0x2b53('0x32')](_0x2b8e6a[_0x2b53('0x2b')][_0x2b53('0x32')]);_0x2f9511['where']=qs['filters'](_[_0x2b53('0x33')](_0x2b8e6a[_0x2b53('0x2b')],_0x451fdb[_0x2b53('0x34')]),_0x22fe02);if(_0x2b8e6a['query'][_0x2b53('0x35')]){_0x2f9511[_0x2b53('0x36')]=_[_0x2b53('0x37')](_0x2f9511[_0x2b53('0x36')],{'$or':_[_0x2b53('0x38')](_0x22fe02,function(_0x2145f0){if(_0x2145f0['type']!==_0x2b53('0x39')){var _0x2f0689={};_0x2f0689[_0x2145f0[_0x2b53('0x25')]]={'$like':'%'+_0x2b8e6a['query']['filter']+'%'};return _0x2f0689;}})});}_0x2f9511=_[_0x2b53('0x37')]({},_0x2f9511,_0x2b8e6a[_0x2b53('0x3a')]);var _0x41d7cd={'where':_0x2f9511[_0x2b53('0x36')]};return db[_0x2b53('0x3b')]['count'](_0x41d7cd)[_0x2b53('0x23')](function(_0x4aed8a){_0x195f48[_0x2b53('0x1d')]=_0x4aed8a;if(_0x2b8e6a[_0x2b53('0x2b')][_0x2b53('0x3c')]){_0x2f9511[_0x2b53('0x3d')]=[{'all':!![]}];}return db[_0x2b53('0x3b')][_0x2b53('0x3e')](_0x2f9511);})[_0x2b53('0x23')](function(_0x29aad3){_0x195f48[_0x2b53('0x3f')]=_0x29aad3;return _0x195f48;})[_0x2b53('0x23')](respondWithFilteredResult(_0x2548ee,_0x2f9511))[_0x2b53('0x40')](handleError(_0x2548ee,null));};exports[_0x2b53('0x41')]=function(_0x33e8c2,_0x3bfd7c){var _0x4d8bca={'raw':!![],'where':{'id':_0x33e8c2[_0x2b53('0x42')]['id']}},_0x196005={};_0x196005['model']=_['keys'](db['OpenchannelQueueReport'][_0x2b53('0x27')]);_0x196005[_0x2b53('0x2b')]=_[_0x2b53('0x43')](_0x33e8c2[_0x2b53('0x2b')]);_0x196005[_0x2b53('0x34')]=_['intersection'](_0x196005['model'],_0x196005['query']);_0x4d8bca[_0x2b53('0x44')]=_[_0x2b53('0x2c')](_0x196005[_0x2b53('0x2a')],qs[_0x2b53('0x2d')](_0x33e8c2['query']['fields']));_0x4d8bca[_0x2b53('0x44')]=_0x4d8bca['attributes'][_0x2b53('0x2e')]?_0x4d8bca[_0x2b53('0x44')]:_0x196005['model'];if(_0x33e8c2[_0x2b53('0x2b')]['includeAll']){_0x4d8bca[_0x2b53('0x3d')]=[{'all':!![]}];}_0x4d8bca=_[_0x2b53('0x37')]({},_0x4d8bca,_0x33e8c2[_0x2b53('0x3a')]);return db[_0x2b53('0x3b')][_0x2b53('0x45')](_0x4d8bca)[_0x2b53('0x23')](handleEntityNotFound(_0x3bfd7c,null))[_0x2b53('0x23')](respondWithResult(_0x3bfd7c,null))[_0x2b53('0x40')](handleError(_0x3bfd7c,null));};exports[_0x2b53('0x46')]=function(_0x30566c,_0x22ee00){return db[_0x2b53('0x3b')][_0x2b53('0x46')](_0x30566c['body'],{})[_0x2b53('0x23')](respondWithResult(_0x22ee00,0xc9))[_0x2b53('0x40')](handleError(_0x22ee00,null));};exports[_0x2b53('0x47')]=function(_0x26dc03,_0x23a796){if(_0x26dc03[_0x2b53('0x48')]['id']){delete _0x26dc03[_0x2b53('0x48')]['id'];}return db[_0x2b53('0x3b')][_0x2b53('0x45')]({'where':{'id':_0x26dc03[_0x2b53('0x42')]['id']}})[_0x2b53('0x23')](handleEntityNotFound(_0x23a796,null))['then'](saveUpdates(_0x26dc03[_0x2b53('0x48')],null))[_0x2b53('0x23')](respondWithResult(_0x23a796,null))[_0x2b53('0x40')](handleError(_0x23a796,null));};exports['destroy']=function(_0x4b29ac,_0x35ca85){return db[_0x2b53('0x3b')][_0x2b53('0x45')]({'where':{'id':_0x4b29ac[_0x2b53('0x42')]['id']}})[_0x2b53('0x23')](handleEntityNotFound(_0x35ca85,null))['then'](removeEntity(_0x35ca85,null))[_0x2b53('0x40')](handleError(_0x35ca85,null));};exports[_0x2b53('0x49')]=function(_0x5e45c8,_0x2f8a23){return db[_0x2b53('0x3b')][_0x2b53('0x49')]()[_0x2b53('0x23')](respondWithResult(_0x2f8a23,null))[_0x2b53('0x40')](handleError(_0x2f8a23,null));}; \ No newline at end of file +var _0x57ee=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','save','destroy','error','stack','name','index','OpenchannelQueueReport','rawAttributes','fieldName','key','model','map','keys','query','filters','attributes','intersection','fields','length','sort','where','pick','merge','type','VIRTUAL','filter','options','then','include','findAll','rows','catch','show','includeAll','find','create','body','update','params','describe','eml-format','rimraf','fast-json-patch','request-promise','moment','mustache','path','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch'];(function(_0x44e843,_0x18e958){var _0x4f0a2d=function(_0xd7cb2){while(--_0xd7cb2){_0x44e843['push'](_0x44e843['shift']());}};_0x4f0a2d(++_0x18e958);}(_0x57ee,0x16d));var _0xe57e=function(_0x5b0c74,_0x89689b){_0x5b0c74=_0x5b0c74-0x0;var _0x4a7d3f=_0x57ee[_0x5b0c74];return _0x4a7d3f;};'use strict';var emlformat=require(_0xe57e('0x0'));var rimraf=require(_0xe57e('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe57e('0x2'));var rp=require(_0xe57e('0x3'));var moment=require(_0xe57e('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xe57e('0x5'));var util=require('util');var path=require(_0xe57e('0x6'));var sox=require(_0xe57e('0x7'));var csv=require(_0xe57e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xe57e('0x9'));var _=require(_0xe57e('0xa'));var squel=require(_0xe57e('0xb'));var crypto=require(_0xe57e('0xc'));var jsforce=require(_0xe57e('0xd'));var deskjs=require(_0xe57e('0xe'));var toCsv=require('to-csv');var querystring=require(_0xe57e('0xf'));var Papa=require(_0xe57e('0x10'));var Redis=require(_0xe57e('0x11'));var authService=require(_0xe57e('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xe57e('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe57e('0x14'))(_0xe57e('0x15'));var utils=require(_0xe57e('0x16'));var config=require(_0xe57e('0x17'));var licenseUtil=require(_0xe57e('0x18'));var db=require(_0xe57e('0x19'))['db'];function respondWithStatusCode(_0xc063b7,_0xebfa17){_0xebfa17=_0xebfa17||0xcc;return function(_0x3a0564){if(_0x3a0564){return _0xc063b7[_0xe57e('0x1a')](_0xebfa17);}return _0xc063b7[_0xe57e('0x1b')](_0xebfa17)[_0xe57e('0x1c')]();};}function respondWithResult(_0x31b74e,_0x2bf613){_0x2bf613=_0x2bf613||0xc8;return function(_0x4afffc){if(_0x4afffc){return _0x31b74e[_0xe57e('0x1b')](_0x2bf613)['json'](_0x4afffc);}};}function respondWithFilteredResult(_0xfa9c0c,_0x382ad3){return function(_0x5ad9a9){if(_0x5ad9a9){var _0xd74c1a=typeof _0x382ad3[_0xe57e('0x1d')]===_0xe57e('0x1e')&&typeof _0x382ad3[_0xe57e('0x1f')]===_0xe57e('0x1e');var _0x2e9937=_0x5ad9a9[_0xe57e('0x20')];var _0x10c508=_0xd74c1a?0x0:_0x382ad3[_0xe57e('0x1d')];var _0x1dc29c=_0xd74c1a?_0x5ad9a9[_0xe57e('0x20')]:_0x382ad3[_0xe57e('0x1d')]+_0x382ad3[_0xe57e('0x1f')];var _0x4f0e37;if(_0x1dc29c>=_0x2e9937){_0x1dc29c=_0x2e9937;_0x4f0e37=0xc8;}else{_0x4f0e37=0xce;}_0xfa9c0c[_0xe57e('0x1b')](_0x4f0e37);return _0xfa9c0c[_0xe57e('0x21')](_0xe57e('0x22'),_0x10c508+'-'+_0x1dc29c+'/'+_0x2e9937)[_0xe57e('0x23')](_0x5ad9a9);}return null;};}function patchUpdates(_0xfa836d){return function(_0x5d5b7e){try{jsonpatch[_0xe57e('0x24')](_0x5d5b7e,_0xfa836d,!![]);}catch(_0x1c2c7f){return BPromise['reject'](_0x1c2c7f);}return _0x5d5b7e[_0xe57e('0x25')]();};}function saveUpdates(_0x46db48,_0x3f1f90){return function(_0x2d78f0){if(_0x2d78f0){return _0x2d78f0['update'](_0x46db48)['then'](function(_0x25e18d){return _0x25e18d;});}return null;};}function removeEntity(_0x552ec6,_0x534e7c){return function(_0x31a75a){if(_0x31a75a){return _0x31a75a[_0xe57e('0x26')]()['then'](function(){_0x552ec6[_0xe57e('0x1b')](0xcc)[_0xe57e('0x1c')]();});}};}function handleEntityNotFound(_0x59c909,_0x431243){return function(_0x56ab5a){if(!_0x56ab5a){_0x59c909[_0xe57e('0x1a')](0x194);}return _0x56ab5a;};}function handleError(_0x5e9c07,_0x20340e){_0x20340e=_0x20340e||0x1f4;return function(_0x29af42){logger[_0xe57e('0x27')](_0x29af42[_0xe57e('0x28')]);if(_0x29af42['name']){delete _0x29af42[_0xe57e('0x29')];}_0x5e9c07['status'](_0x20340e)['send'](_0x29af42);};}exports[_0xe57e('0x2a')]=function(_0x38c9c0,_0x282776){var _0x573e86={},_0x24500f={},_0x11a7e5={'count':0x0,'rows':[]};var _0x1d2453=_['map'](db[_0xe57e('0x2b')][_0xe57e('0x2c')],function(_0x18f592){return{'name':_0x18f592[_0xe57e('0x2d')],'type':_0x18f592['type'][_0xe57e('0x2e')]};});_0x24500f[_0xe57e('0x2f')]=_[_0xe57e('0x30')](_0x1d2453,_0xe57e('0x29'));_0x24500f['query']=_[_0xe57e('0x31')](_0x38c9c0[_0xe57e('0x32')]);_0x24500f[_0xe57e('0x33')]=_['intersection'](_0x24500f[_0xe57e('0x2f')],_0x24500f[_0xe57e('0x32')]);_0x573e86[_0xe57e('0x34')]=_[_0xe57e('0x35')](_0x24500f[_0xe57e('0x2f')],qs[_0xe57e('0x36')](_0x38c9c0[_0xe57e('0x32')][_0xe57e('0x36')]));_0x573e86[_0xe57e('0x34')]=_0x573e86[_0xe57e('0x34')][_0xe57e('0x37')]?_0x573e86['attributes']:_0x24500f[_0xe57e('0x2f')];if(!_0x38c9c0[_0xe57e('0x32')]['hasOwnProperty']('nolimit')){_0x573e86['limit']=qs[_0xe57e('0x1f')](_0x38c9c0[_0xe57e('0x32')][_0xe57e('0x1f')]);_0x573e86[_0xe57e('0x1d')]=qs['offset'](_0x38c9c0['query'][_0xe57e('0x1d')]);}_0x573e86['order']=qs[_0xe57e('0x38')](_0x38c9c0[_0xe57e('0x32')]['sort']);_0x573e86[_0xe57e('0x39')]=qs[_0xe57e('0x33')](_[_0xe57e('0x3a')](_0x38c9c0[_0xe57e('0x32')],_0x24500f[_0xe57e('0x33')]),_0x1d2453);if(_0x38c9c0[_0xe57e('0x32')]['filter']){_0x573e86[_0xe57e('0x39')]=_[_0xe57e('0x3b')](_0x573e86[_0xe57e('0x39')],{'$or':_['map'](_0x1d2453,function(_0x5b1838){if(_0x5b1838[_0xe57e('0x3c')]!==_0xe57e('0x3d')){var _0x43990f={};_0x43990f[_0x5b1838[_0xe57e('0x29')]]={'$like':'%'+_0x38c9c0['query'][_0xe57e('0x3e')]+'%'};return _0x43990f;}})});}_0x573e86=_['merge']({},_0x573e86,_0x38c9c0[_0xe57e('0x3f')]);var _0x3cdc2f={'where':_0x573e86[_0xe57e('0x39')]};return db[_0xe57e('0x2b')][_0xe57e('0x20')](_0x3cdc2f)[_0xe57e('0x40')](function(_0x2621f1){_0x11a7e5[_0xe57e('0x20')]=_0x2621f1;if(_0x38c9c0[_0xe57e('0x32')]['includeAll']){_0x573e86[_0xe57e('0x41')]=[{'all':!![]}];}return db['OpenchannelQueueReport'][_0xe57e('0x42')](_0x573e86);})[_0xe57e('0x40')](function(_0x3220d6){_0x11a7e5[_0xe57e('0x43')]=_0x3220d6;return _0x11a7e5;})[_0xe57e('0x40')](respondWithFilteredResult(_0x282776,_0x573e86))[_0xe57e('0x44')](handleError(_0x282776,null));};exports[_0xe57e('0x45')]=function(_0x3d77d4,_0x5e84b0){var _0x1cf9de={'raw':!![],'where':{'id':_0x3d77d4['params']['id']}},_0x2af973={};_0x2af973[_0xe57e('0x2f')]=_['keys'](db[_0xe57e('0x2b')][_0xe57e('0x2c')]);_0x2af973['query']=_[_0xe57e('0x31')](_0x3d77d4[_0xe57e('0x32')]);_0x2af973[_0xe57e('0x33')]=_[_0xe57e('0x35')](_0x2af973[_0xe57e('0x2f')],_0x2af973['query']);_0x1cf9de[_0xe57e('0x34')]=_[_0xe57e('0x35')](_0x2af973[_0xe57e('0x2f')],qs[_0xe57e('0x36')](_0x3d77d4['query']['fields']));_0x1cf9de['attributes']=_0x1cf9de['attributes'][_0xe57e('0x37')]?_0x1cf9de[_0xe57e('0x34')]:_0x2af973[_0xe57e('0x2f')];if(_0x3d77d4[_0xe57e('0x32')][_0xe57e('0x46')]){_0x1cf9de['include']=[{'all':!![]}];}_0x1cf9de=_['merge']({},_0x1cf9de,_0x3d77d4[_0xe57e('0x3f')]);return db['OpenchannelQueueReport'][_0xe57e('0x47')](_0x1cf9de)['then'](handleEntityNotFound(_0x5e84b0,null))[_0xe57e('0x40')](respondWithResult(_0x5e84b0,null))[_0xe57e('0x44')](handleError(_0x5e84b0,null));};exports[_0xe57e('0x48')]=function(_0x5ab123,_0x2e7275){return db[_0xe57e('0x2b')][_0xe57e('0x48')](_0x5ab123[_0xe57e('0x49')],{})[_0xe57e('0x40')](respondWithResult(_0x2e7275,0xc9))['catch'](handleError(_0x2e7275,null));};exports[_0xe57e('0x4a')]=function(_0x1226c8,_0x4a4f52){if(_0x1226c8['body']['id']){delete _0x1226c8[_0xe57e('0x49')]['id'];}return db['OpenchannelQueueReport'][_0xe57e('0x47')]({'where':{'id':_0x1226c8[_0xe57e('0x4b')]['id']}})[_0xe57e('0x40')](handleEntityNotFound(_0x4a4f52,null))[_0xe57e('0x40')](saveUpdates(_0x1226c8[_0xe57e('0x49')],null))['then'](respondWithResult(_0x4a4f52,null))[_0xe57e('0x44')](handleError(_0x4a4f52,null));};exports['destroy']=function(_0x2acc17,_0x3a62a7){return db[_0xe57e('0x2b')][_0xe57e('0x47')]({'where':{'id':_0x2acc17[_0xe57e('0x4b')]['id']}})[_0xe57e('0x40')](handleEntityNotFound(_0x3a62a7,null))[_0xe57e('0x40')](removeEntity(_0x3a62a7,null))['catch'](handleError(_0x3a62a7,null));};exports[_0xe57e('0x4c')]=function(_0x28f9e7,_0x99548e){return db[_0xe57e('0x2b')][_0xe57e('0x4c')]()[_0xe57e('0x40')](respondWithResult(_0x99548e,null))[_0xe57e('0x44')](handleError(_0x99548e,null));}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.model.js b/server/api/openchannelQueueReport/openchannelQueueReport.model.js index cac9d2a..86e3a6c 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 _0xc4aa=['bluebird','../../config/environment','./openchannelQueueReport.attributes','exports','define','OpenchannelQueueReport','report_openchannel_queue','lodash','util','../../config/logger','api','moment'];(function(_0x3116be,_0x56cefa){var _0x38934a=function(_0x519e15){while(--_0x519e15){_0x3116be['push'](_0x3116be['shift']());}};_0x38934a(++_0x56cefa);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x17b6e3,_0x4522ed){_0x17b6e3=_0x17b6e3-0x0;var _0x3906f3=_0xc4aa[_0x17b6e3];return _0x3906f3;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var logger=require(_0xac4a('0x2'))(_0xac4a('0x3'));var moment=require(_0xac4a('0x4'));var BPromise=require(_0xac4a('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0xac4a('0x6'));var attributes=require(_0xac4a('0x7'));module[_0xac4a('0x8')]=function(_0x215f39,_0x96be2b){return _0x215f39[_0xac4a('0x9')](_0xac4a('0xa'),attributes,{'tableName':_0xac4a('0xb'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x1261=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./openchannelQueueReport.attributes','define','report_openchannel_queue','uniqueid','util'];(function(_0x52b975,_0x10d77f){var _0x757dfe=function(_0xfedb3f){while(--_0xfedb3f){_0x52b975['push'](_0x52b975['shift']());}};_0x757dfe(++_0x10d77f);}(_0x1261,0x144));var _0x1126=function(_0x503287,_0x252ead){_0x503287=_0x503287-0x0;var _0x3709ef=_0x1261[_0x503287];return _0x3709ef;};'use strict';var _=require('lodash');var util=require(_0x1126('0x0'));var logger=require(_0x1126('0x1'))(_0x1126('0x2'));var moment=require(_0x1126('0x3'));var BPromise=require(_0x1126('0x4'));var rp=require(_0x1126('0x5'));var fs=require('fs');var path=require(_0x1126('0x6'));var rimraf=require(_0x1126('0x7'));var config=require(_0x1126('0x8'));var attributes=require(_0x1126('0x9'));module['exports']=function(_0x5c68c8,_0x40ba58){return _0x5c68c8[_0x1126('0xa')]('OpenchannelQueueReport',attributes,{'tableName':_0x1126('0xb'),'paranoid':![],'indexes':[{'name':_0x1126('0xc'),'fields':[_0x1126('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js b/server/api/openchannelQueueReport/openchannelQueueReport.rpc.js index 5bc7af2..f2a09d1 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 _0x8374=['limit','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','OpenchannelQueueReport,\x20%s,\x20%s','request\x20sent','debug','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','error','code','message','catch','CreateOpenchannelQueueReport','OpenchannelQueueReport','create','body','options','UpdateOpenchannelQueueReport','update','raw','where','attributes'];(function(_0x195577,_0x5de53a){var _0x13c367=function(_0x583022){while(--_0x583022){_0x195577['push'](_0x195577['shift']());}};_0x13c367(++_0x5de53a);}(_0x8374,0x174));var _0x4837=function(_0x1d54b8,_0x560503){_0x1d54b8=_0x1d54b8-0x0;var _0x32b5a4=_0x8374[_0x1d54b8];return _0x32b5a4;};'use strict';var _=require(_0x4837('0x0'));var util=require(_0x4837('0x1'));var moment=require(_0x4837('0x2'));var BPromise=require(_0x4837('0x3'));var rs=require(_0x4837('0x4'));var fs=require('fs');var Redis=require(_0x4837('0x5'));var db=require(_0x4837('0x6'))['db'];var utils=require(_0x4837('0x7'));var logger=require(_0x4837('0x8'))(_0x4837('0x9'));var config=require(_0x4837('0xa'));var jayson=require(_0x4837('0xb'));var client=jayson[_0x4837('0xc')][_0x4837('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x4e0e60,_0x2036a4,_0x560c37){return new BPromise(function(_0x408c14,_0x476a1d){return client[_0x4837('0xe')](_0x4e0e60,_0x560c37)[_0x4837('0xf')](function(_0x2f0ca6){logger[_0x4837('0x10')](_0x4837('0x11'),_0x2036a4,_0x4837('0x12'));logger[_0x4837('0x13')](_0x4837('0x14'),_0x2036a4,'request\x20sent',JSON['stringify'](_0x2f0ca6));if(_0x2f0ca6[_0x4837('0x15')]){if(_0x2f0ca6['error'][_0x4837('0x16')]===0x1f4){logger[_0x4837('0x15')]('OpenchannelQueueReport,\x20%s,\x20%s',_0x2036a4,_0x2f0ca6['error']['message']);return _0x476a1d(_0x2f0ca6[_0x4837('0x15')][_0x4837('0x17')]);}logger[_0x4837('0x15')](_0x4837('0x11'),_0x2036a4,_0x2f0ca6['error'][_0x4837('0x17')]);return _0x408c14(_0x2f0ca6[_0x4837('0x15')][_0x4837('0x17')]);}else{logger['info'](_0x4837('0x11'),_0x2036a4,_0x4837('0x12'));_0x408c14(_0x2f0ca6['result'][_0x4837('0x17')]);}})[_0x4837('0x18')](function(_0xb95296){logger[_0x4837('0x15')](_0x4837('0x11'),_0x2036a4,_0xb95296);_0x476a1d(_0xb95296);});});}exports[_0x4837('0x19')]=function(_0x48b61b){var _0xf21681=this;return new Promise(function(_0x1cb24a,_0x427171){return db[_0x4837('0x1a')][_0x4837('0x1b')](_0x48b61b[_0x4837('0x1c')],{'raw':_0x48b61b[_0x4837('0x1d')]?_0x48b61b['options']['raw']===undefined?!![]:![]:!![]})[_0x4837('0xf')](function(_0x133e9d){logger[_0x4837('0x10')](_0x4837('0x19'),_0x48b61b);logger['debug'](_0x4837('0x19'),_0x48b61b,JSON['stringify'](_0x133e9d));_0x1cb24a(_0x133e9d);})[_0x4837('0x18')](function(_0x5f5631){logger['error'](_0x4837('0x19'),_0x5f5631['message'],_0x48b61b);_0x427171(_0xf21681['error'](0x1f4,_0x5f5631['message']));});});};exports[_0x4837('0x1e')]=function(_0x2d820a){var _0x4bbfbd=this;return new Promise(function(_0x36b841,_0xa10b75){return db['OpenchannelQueueReport'][_0x4837('0x1f')](_0x2d820a[_0x4837('0x1c')],{'raw':_0x2d820a['options']?_0x2d820a[_0x4837('0x1d')][_0x4837('0x20')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2d820a[_0x4837('0x1d')]?_0x2d820a[_0x4837('0x1d')][_0x4837('0x21')]||null:null,'attributes':_0x2d820a['options']?_0x2d820a[_0x4837('0x1d')][_0x4837('0x22')]||null:null,'limit':_0x2d820a[_0x4837('0x1d')]?_0x2d820a[_0x4837('0x1d')][_0x4837('0x23')]||null:null})[_0x4837('0xf')](function(_0x215858){logger[_0x4837('0x10')]('UpdateOpenchannelQueueReport',_0x2d820a);logger[_0x4837('0x13')](_0x4837('0x1e'),_0x2d820a,JSON[_0x4837('0x24')](_0x215858));_0x36b841(_0x215858);})[_0x4837('0x18')](function(_0x594039){logger[_0x4837('0x15')](_0x4837('0x1e'),_0x594039[_0x4837('0x17')],_0x2d820a);_0xa10b75(_0x4bbfbd[_0x4837('0x15')](0x1f4,_0x594039['message']));});});}; \ No newline at end of file +var _0x282b=['catch','CreateOpenchannelQueueReport','create','body','options','raw','debug','OpenchannelQueueReport','update','where','attributes','UpdateOpenchannelQueueReport','lodash','util','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','then','info','OpenchannelQueueReport,\x20%s,\x20%s','OpenchannelQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result'];(function(_0x114356,_0x561b7a){var _0xd46fa7=function(_0x4b93ef){while(--_0x4b93ef){_0x114356['push'](_0x114356['shift']());}};_0xd46fa7(++_0x561b7a);}(_0x282b,0xec));var _0xb282=function(_0x3b419c,_0x310633){_0x3b419c=_0x3b419c-0x0;var _0x2a822c=_0x282b[_0x3b419c];return _0x2a822c;};'use strict';var _=require(_0xb282('0x0'));var util=require(_0xb282('0x1'));var moment=require(_0xb282('0x2'));var BPromise=require(_0xb282('0x3'));var rs=require(_0xb282('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xb282('0x5'));var logger=require('../../config/logger')(_0xb282('0x6'));var config=require(_0xb282('0x7'));var jayson=require(_0xb282('0x8'));var client=jayson[_0xb282('0x9')][_0xb282('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x33635f,_0x4f0410,_0x4a0d28){return new BPromise(function(_0x17fba1,_0x436eaa){return client['request'](_0x33635f,_0x4a0d28)[_0xb282('0xb')](function(_0x20f517){logger[_0xb282('0xc')](_0xb282('0xd'),_0x4f0410,'request\x20sent');logger['debug'](_0xb282('0xe'),_0x4f0410,_0xb282('0xf'),JSON[_0xb282('0x10')](_0x20f517));if(_0x20f517[_0xb282('0x11')]){if(_0x20f517[_0xb282('0x11')]['code']===0x1f4){logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);return _0x436eaa(_0x20f517[_0xb282('0x11')][_0xb282('0x12')]);}logger['error'](_0xb282('0xd'),_0x4f0410,_0x20f517['error'][_0xb282('0x12')]);return _0x17fba1(_0x20f517[_0xb282('0x11')]['message']);}else{logger['info']('OpenchannelQueueReport,\x20%s,\x20%s',_0x4f0410,_0xb282('0xf'));_0x17fba1(_0x20f517[_0xb282('0x13')][_0xb282('0x12')]);}})[_0xb282('0x14')](function(_0x438a05){logger['error'](_0xb282('0xd'),_0x4f0410,_0x438a05);_0x436eaa(_0x438a05);});});}exports[_0xb282('0x15')]=function(_0xca5f12){var _0x45b070=this;return new Promise(function(_0x3f8a3f,_0x492d20){return db['OpenchannelQueueReport'][_0xb282('0x16')](_0xca5f12[_0xb282('0x17')],{'raw':_0xca5f12['options']?_0xca5f12[_0xb282('0x18')][_0xb282('0x19')]===undefined?!![]:![]:!![]})[_0xb282('0xb')](function(_0x438dbe){logger[_0xb282('0xc')]('CreateOpenchannelQueueReport',_0xca5f12);logger[_0xb282('0x1a')](_0xb282('0x15'),_0xca5f12,JSON[_0xb282('0x10')](_0x438dbe));_0x3f8a3f(_0x438dbe);})['catch'](function(_0x437d66){logger[_0xb282('0x11')](_0xb282('0x15'),_0x437d66[_0xb282('0x12')],_0xca5f12);_0x492d20(_0x45b070[_0xb282('0x11')](0x1f4,_0x437d66['message']));});});};exports['UpdateOpenchannelQueueReport']=function(_0x360f15){var _0x3c7f1f=this;return new Promise(function(_0x4934f0,_0x5e828e){return db[_0xb282('0x1b')][_0xb282('0x1c')](_0x360f15[_0xb282('0x17')],{'raw':_0x360f15[_0xb282('0x18')]?_0x360f15[_0xb282('0x18')][_0xb282('0x19')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x360f15['options']?_0x360f15[_0xb282('0x18')][_0xb282('0x1d')]||null:null,'attributes':_0x360f15['options']?_0x360f15[_0xb282('0x18')][_0xb282('0x1e')]||null:null,'limit':_0x360f15[_0xb282('0x18')]?_0x360f15[_0xb282('0x18')]['limit']||null:null})[_0xb282('0xb')](function(_0x1fb89f){logger[_0xb282('0xc')](_0xb282('0x1f'),_0x360f15);logger[_0xb282('0x1a')](_0xb282('0x1f'),_0x360f15,JSON[_0xb282('0x10')](_0x1fb89f));_0x4934f0(_0x1fb89f);})['catch'](function(_0x1b15b5){logger[_0xb282('0x11')](_0xb282('0x1f'),_0x1b15b5[_0xb282('0x12')],_0x360f15);_0x5e828e(_0x3c7f1f[_0xb282('0x11')](0x1f4,_0x1b15b5['message']));});});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/index.js b/server/api/openchannelTransferReport/index.js index 3c051ef..6df633c 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 _0x6889=['create','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6889,0x1d6));var _0x9688=function(_0x2bcc8d,_0x5691d1){_0x2bcc8d=_0x2bcc8d-0x0;var _0x123b6a=_0x6889[_0x2bcc8d];return _0x123b6a;};'use strict';var multer=require(_0x9688('0x0'));var util=require(_0x9688('0x1'));var path=require(_0x9688('0x2'));var timeout=require(_0x9688('0x3'));var express=require('express');var router=express[_0x9688('0x4')]();var fs_extra=require(_0x9688('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0x9688('0x6'));var config=require(_0x9688('0x7'));var controller=require('./openchannelTransferReport.controller');router[_0x9688('0x8')]('/',auth[_0x9688('0x9')](),controller[_0x9688('0xa')]);router[_0x9688('0x8')](_0x9688('0xb'),auth['isAuthenticated'](),controller[_0x9688('0xc')]);router[_0x9688('0x8')](_0x9688('0xd'),auth['isAuthenticated'](),controller[_0x9688('0xe')]);router[_0x9688('0xf')]('/',auth[_0x9688('0x9')](),controller[_0x9688('0x10')]);router['put'](_0x9688('0xd'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x9688('0xd'),auth['isAuthenticated'](),controller['destroy']);module[_0x9688('0x11')]=router; \ No newline at end of file +var _0xd0d2=['../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','index','get','/describe','describe','/:id','show','post','put','update','delete','connect-timeout','express','Router'];(function(_0x24237f,_0x4cf32c){var _0x48298e=function(_0x3f7511){while(--_0x3f7511){_0x24237f['push'](_0x24237f['shift']());}};_0x48298e(++_0x4cf32c);}(_0xd0d2,0xa7));var _0x2d0d=function(_0x526a69,_0x5bbb63){_0x526a69=_0x526a69-0x0;var _0x47af50=_0xd0d2[_0x526a69];return _0x47af50;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0x2d0d('0x0'));var express=require(_0x2d0d('0x1'));var router=express[_0x2d0d('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x2d0d('0x3'));var interaction=require(_0x2d0d('0x4'));var config=require(_0x2d0d('0x5'));var controller=require('./openchannelTransferReport.controller');router['get']('/',auth[_0x2d0d('0x6')](),controller[_0x2d0d('0x7')]);router[_0x2d0d('0x8')](_0x2d0d('0x9'),auth['isAuthenticated'](),controller[_0x2d0d('0xa')]);router[_0x2d0d('0x8')](_0x2d0d('0xb'),auth[_0x2d0d('0x6')](),controller[_0x2d0d('0xc')]);router[_0x2d0d('0xd')]('/',auth[_0x2d0d('0x6')](),controller['create']);router[_0x2d0d('0xe')](_0x2d0d('0xb'),auth[_0x2d0d('0x6')](),controller[_0x2d0d('0xf')]);router[_0x2d0d('0x10')](_0x2d0d('0xb'),auth['isAuthenticated'](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js index b26fff4..9ce5c29 100644 --- a/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js +++ b/server/api/openchannelTransferReport/openchannelTransferReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['NOW','moment','sequelize','exports','account','agent','queue'];(function(_0x556b01,_0xad5f4b){var _0x35824f=function(_0x4d044b){while(--_0x4d044b){_0x556b01['push'](_0x556b01['shift']());}};_0x35824f(++_0xad5f4b);}(_0x70e0,0x17b));var _0x070e=function(_0x1e7b35,_0x4234ab){_0x1e7b35=_0x1e7b35-0x0;var _0x347ca5=_0x70e0[_0x1e7b35];return _0x347ca5;};'use strict';var moment=require(_0x070e('0x0'));var Sequelize=require(_0x070e('0x1'));module[_0x070e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x070e('0x3'),_0x070e('0x4'),_0x070e('0x5')),'allowNull':![],'defaultValue':_0x070e('0x5')},'transferredAt':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize[_0x070e('0x6')]}}; \ No newline at end of file +var _0x4b84=['moment','sequelize','ENUM','queue','DATE'];(function(_0x4eae35,_0x3d9d32){var _0x174a7e=function(_0x569e4b){while(--_0x569e4b){_0x4eae35['push'](_0x4eae35['shift']());}};_0x174a7e(++_0x3d9d32);}(_0x4b84,0x1cc));var _0x44b8=function(_0x473ee7,_0x4dd754){_0x473ee7=_0x473ee7-0x0;var _0x30f0d4=_0x4b84[_0x473ee7];return _0x30f0d4;};'use strict';var moment=require(_0x44b8('0x0'));var Sequelize=require(_0x44b8('0x1'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0x44b8('0x2')]('account','agent',_0x44b8('0x3')),'allowNull':![],'defaultValue':_0x44b8('0x3')},'transferredAt':{'type':Sequelize[_0x44b8('0x4')],'allowNull':![],'defaultValue':Sequelize['NOW']}}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.controller.js b/server/api/openchannelTransferReport/openchannelTransferReport.controller.js index 574a4ea..0e414dd 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 _0x18b9=['sendStatus','status','json','undefined','limit','count','offset','set','reject','save','update','then','destroy','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes','key','model','query','attributes','intersection','fields','length','nolimit','sort','where','filters','filter','type','VIRTUAL','options','includeAll','include','catch','show','params','keys','create','body','find','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','mustache','util','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','../../config/utils','../../config/environment','../../mysqldb'];(function(_0x3a78a0,_0x44985f){var _0x48e917=function(_0x1e428c){while(--_0x1e428c){_0x3a78a0['push'](_0x3a78a0['shift']());}};_0x48e917(++_0x44985f);}(_0x18b9,0xb8));var _0x918b=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0x18b9[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x918b('0x0'));var rimraf=require(_0x918b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x918b('0x2'));var rp=require(_0x918b('0x3'));var moment=require('moment');var BPromise=require(_0x918b('0x4'));var Mustache=require(_0x918b('0x5'));var util=require(_0x918b('0x6'));var path=require('path');var sox=require(_0x918b('0x7'));var csv=require(_0x918b('0x8'));var ejs=require(_0x918b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x918b('0xa'));var squel=require(_0x918b('0xb'));var crypto=require(_0x918b('0xc'));var jsforce=require(_0x918b('0xd'));var deskjs=require(_0x918b('0xe'));var toCsv=require(_0x918b('0x8'));var querystring=require('querystring');var Papa=require(_0x918b('0xf'));var Redis=require(_0x918b('0x10'));var authService=require(_0x918b('0x11'));var qs=require(_0x918b('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x918b('0x13'))('api');var utils=require(_0x918b('0x14'));var config=require(_0x918b('0x15'));var licenseUtil=require('../../config/license/util');var db=require(_0x918b('0x16'))['db'];function respondWithStatusCode(_0x167fb3,_0x236206){_0x236206=_0x236206||0xcc;return function(_0x4dd104){if(_0x4dd104){return _0x167fb3[_0x918b('0x17')](_0x236206);}return _0x167fb3[_0x918b('0x18')](_0x236206)['end']();};}function respondWithResult(_0x31e5c7,_0x260d59){_0x260d59=_0x260d59||0xc8;return function(_0x53f36b){if(_0x53f36b){return _0x31e5c7['status'](_0x260d59)[_0x918b('0x19')](_0x53f36b);}};}function respondWithFilteredResult(_0x2aaeb3,_0x3265b8){return function(_0x1d5011){if(_0x1d5011){var _0x3d6947=typeof _0x3265b8['offset']===_0x918b('0x1a')&&typeof _0x3265b8[_0x918b('0x1b')]==='undefined';var _0x5e7c87=_0x1d5011[_0x918b('0x1c')];var _0x13f7d3=_0x3d6947?0x0:_0x3265b8[_0x918b('0x1d')];var _0x464c5f=_0x3d6947?_0x1d5011[_0x918b('0x1c')]:_0x3265b8['offset']+_0x3265b8[_0x918b('0x1b')];var _0x51a03;if(_0x464c5f>=_0x5e7c87){_0x464c5f=_0x5e7c87;_0x51a03=0xc8;}else{_0x51a03=0xce;}_0x2aaeb3['status'](_0x51a03);return _0x2aaeb3[_0x918b('0x1e')]('Content-Range',_0x13f7d3+'-'+_0x464c5f+'/'+_0x5e7c87)['json'](_0x1d5011);}return null;};}function patchUpdates(_0xae1ab3){return function(_0x2ad9f9){try{jsonpatch['apply'](_0x2ad9f9,_0xae1ab3,!![]);}catch(_0x44c761){return BPromise[_0x918b('0x1f')](_0x44c761);}return _0x2ad9f9[_0x918b('0x20')]();};}function saveUpdates(_0x285b80,_0x320524){return function(_0xd362b1){if(_0xd362b1){return _0xd362b1[_0x918b('0x21')](_0x285b80)[_0x918b('0x22')](function(_0x257f5c){return _0x257f5c;});}return null;};}function removeEntity(_0x32e0f3,_0x4cd9a1){return function(_0x159eca){if(_0x159eca){return _0x159eca[_0x918b('0x23')]()[_0x918b('0x22')](function(){_0x32e0f3[_0x918b('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x27aaf3,_0x476c2e){return function(_0x5c2558){if(!_0x5c2558){_0x27aaf3['sendStatus'](0x194);}return _0x5c2558;};}function handleError(_0x19d39a,_0x38d672){_0x38d672=_0x38d672||0x1f4;return function(_0x5ab3b0){logger[_0x918b('0x24')](_0x5ab3b0[_0x918b('0x25')]);if(_0x5ab3b0[_0x918b('0x26')]){delete _0x5ab3b0[_0x918b('0x26')];}_0x19d39a[_0x918b('0x18')](_0x38d672)[_0x918b('0x27')](_0x5ab3b0);};}exports[_0x918b('0x28')]=function(_0x64248,_0x79748d){var _0x1411b5={},_0x56069b={},_0x12737a={'count':0x0,'rows':[]};var _0x4c4c85=_[_0x918b('0x29')](db[_0x918b('0x2a')][_0x918b('0x2b')],function(_0x2c1d2f){return{'name':_0x2c1d2f['fieldName'],'type':_0x2c1d2f['type'][_0x918b('0x2c')]};});_0x56069b[_0x918b('0x2d')]=_[_0x918b('0x29')](_0x4c4c85,_0x918b('0x26'));_0x56069b[_0x918b('0x2e')]=_['keys'](_0x64248[_0x918b('0x2e')]);_0x56069b['filters']=_['intersection'](_0x56069b[_0x918b('0x2d')],_0x56069b[_0x918b('0x2e')]);_0x1411b5[_0x918b('0x2f')]=_[_0x918b('0x30')](_0x56069b[_0x918b('0x2d')],qs[_0x918b('0x31')](_0x64248[_0x918b('0x2e')][_0x918b('0x31')]));_0x1411b5['attributes']=_0x1411b5['attributes'][_0x918b('0x32')]?_0x1411b5['attributes']:_0x56069b[_0x918b('0x2d')];if(!_0x64248[_0x918b('0x2e')]['hasOwnProperty'](_0x918b('0x33'))){_0x1411b5[_0x918b('0x1b')]=qs[_0x918b('0x1b')](_0x64248['query']['limit']);_0x1411b5[_0x918b('0x1d')]=qs[_0x918b('0x1d')](_0x64248['query']['offset']);}_0x1411b5['order']=qs['sort'](_0x64248[_0x918b('0x2e')][_0x918b('0x34')]);_0x1411b5[_0x918b('0x35')]=qs[_0x918b('0x36')](_['pick'](_0x64248['query'],_0x56069b[_0x918b('0x36')]),_0x4c4c85);if(_0x64248[_0x918b('0x2e')][_0x918b('0x37')]){_0x1411b5[_0x918b('0x35')]=_['merge'](_0x1411b5['where'],{'$or':_[_0x918b('0x29')](_0x4c4c85,function(_0x381d34){if(_0x381d34[_0x918b('0x38')]!==_0x918b('0x39')){var _0x5164ff={};_0x5164ff[_0x381d34['name']]={'$like':'%'+_0x64248[_0x918b('0x2e')][_0x918b('0x37')]+'%'};return _0x5164ff;}})});}_0x1411b5=_['merge']({},_0x1411b5,_0x64248[_0x918b('0x3a')]);var _0x1c3b2a={'where':_0x1411b5[_0x918b('0x35')]};return db[_0x918b('0x2a')]['count'](_0x1c3b2a)[_0x918b('0x22')](function(_0x5cb8ef){_0x12737a[_0x918b('0x1c')]=_0x5cb8ef;if(_0x64248[_0x918b('0x2e')][_0x918b('0x3b')]){_0x1411b5[_0x918b('0x3c')]=[{'all':!![]}];}return db[_0x918b('0x2a')]['findAll'](_0x1411b5);})['then'](function(_0x54f4e9){_0x12737a['rows']=_0x54f4e9;return _0x12737a;})['then'](respondWithFilteredResult(_0x79748d,_0x1411b5))[_0x918b('0x3d')](handleError(_0x79748d,null));};exports[_0x918b('0x3e')]=function(_0x11a215,_0x1ab7a8){var _0x141456={'raw':!![],'where':{'id':_0x11a215[_0x918b('0x3f')]['id']}},_0x51f686={};_0x51f686[_0x918b('0x2d')]=_[_0x918b('0x40')](db[_0x918b('0x2a')][_0x918b('0x2b')]);_0x51f686[_0x918b('0x2e')]=_[_0x918b('0x40')](_0x11a215[_0x918b('0x2e')]);_0x51f686[_0x918b('0x36')]=_['intersection'](_0x51f686['model'],_0x51f686[_0x918b('0x2e')]);_0x141456['attributes']=_[_0x918b('0x30')](_0x51f686[_0x918b('0x2d')],qs['fields'](_0x11a215[_0x918b('0x2e')]['fields']));_0x141456[_0x918b('0x2f')]=_0x141456[_0x918b('0x2f')][_0x918b('0x32')]?_0x141456[_0x918b('0x2f')]:_0x51f686[_0x918b('0x2d')];if(_0x11a215[_0x918b('0x2e')]['includeAll']){_0x141456[_0x918b('0x3c')]=[{'all':!![]}];}_0x141456=_['merge']({},_0x141456,_0x11a215['options']);return db[_0x918b('0x2a')]['find'](_0x141456)['then'](handleEntityNotFound(_0x1ab7a8,null))['then'](respondWithResult(_0x1ab7a8,null))[_0x918b('0x3d')](handleError(_0x1ab7a8,null));};exports['create']=function(_0x4ee8da,_0x4034cb){return db[_0x918b('0x2a')][_0x918b('0x41')](_0x4ee8da[_0x918b('0x42')],{})[_0x918b('0x22')](respondWithResult(_0x4034cb,0xc9))[_0x918b('0x3d')](handleError(_0x4034cb,null));};exports[_0x918b('0x21')]=function(_0x52d06b,_0x3d0a99){if(_0x52d06b['body']['id']){delete _0x52d06b[_0x918b('0x42')]['id'];}return db[_0x918b('0x2a')][_0x918b('0x43')]({'where':{'id':_0x52d06b[_0x918b('0x3f')]['id']}})[_0x918b('0x22')](handleEntityNotFound(_0x3d0a99,null))[_0x918b('0x22')](saveUpdates(_0x52d06b[_0x918b('0x42')],null))[_0x918b('0x22')](respondWithResult(_0x3d0a99,null))[_0x918b('0x3d')](handleError(_0x3d0a99,null));};exports[_0x918b('0x23')]=function(_0x691222,_0x243cd4){return db[_0x918b('0x2a')][_0x918b('0x43')]({'where':{'id':_0x691222[_0x918b('0x3f')]['id']}})[_0x918b('0x22')](handleEntityNotFound(_0x243cd4,null))[_0x918b('0x22')](removeEntity(_0x243cd4,null))[_0x918b('0x3d')](handleError(_0x243cd4,null));};exports[_0x918b('0x44')]=function(_0x2a9b8d,_0x353ce5){return db[_0x918b('0x2a')][_0x918b('0x44')]()[_0x918b('0x22')](respondWithResult(_0x353ce5,null))['catch'](handleError(_0x353ce5,null));}; \ No newline at end of file +var _0x1ff6=['key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','show','create','catch','body','find','params','describe','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','status','json','undefined','limit','offset','count','Content-Range','save','update','destroy','then','end','sendStatus','error','stack','name','send','index','map','OpenchannelTransferReport','rawAttributes'];(function(_0x1bca00,_0x5679cb){var _0x3c21d9=function(_0x4367cd){while(--_0x4367cd){_0x1bca00['push'](_0x1bca00['shift']());}};_0x3c21d9(++_0x5679cb);}(_0x1ff6,0x68));var _0x61ff=function(_0x85f059,_0x27d70e){_0x85f059=_0x85f059-0x0;var _0x3520f7=_0x1ff6[_0x85f059];return _0x3520f7;};'use strict';var emlformat=require(_0x61ff('0x0'));var rimraf=require(_0x61ff('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x61ff('0x2'));var moment=require(_0x61ff('0x3'));var BPromise=require(_0x61ff('0x4'));var Mustache=require(_0x61ff('0x5'));var util=require(_0x61ff('0x6'));var path=require(_0x61ff('0x7'));var sox=require('sox');var csv=require(_0x61ff('0x8'));var ejs=require(_0x61ff('0x9'));var fs=require('fs');var fs_extra=require(_0x61ff('0xa'));var _=require(_0x61ff('0xb'));var squel=require(_0x61ff('0xc'));var crypto=require(_0x61ff('0xd'));var jsforce=require(_0x61ff('0xe'));var deskjs=require(_0x61ff('0xf'));var toCsv=require(_0x61ff('0x8'));var querystring=require(_0x61ff('0x10'));var Papa=require(_0x61ff('0x11'));var Redis=require(_0x61ff('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x61ff('0x13'));var hardwareService=require(_0x61ff('0x14'));var logger=require('../../config/logger')(_0x61ff('0x15'));var utils=require(_0x61ff('0x16'));var config=require(_0x61ff('0x17'));var licenseUtil=require(_0x61ff('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x43954d,_0x237bf5){_0x237bf5=_0x237bf5||0xcc;return function(_0x4db818){if(_0x4db818){return _0x43954d['sendStatus'](_0x237bf5);}return _0x43954d[_0x61ff('0x19')](_0x237bf5)['end']();};}function respondWithResult(_0x517e1d,_0x3f7091){_0x3f7091=_0x3f7091||0xc8;return function(_0x5038a7){if(_0x5038a7){return _0x517e1d['status'](_0x3f7091)[_0x61ff('0x1a')](_0x5038a7);}};}function respondWithFilteredResult(_0x6de6eb,_0x5612dd){return function(_0x4e2bd7){if(_0x4e2bd7){var _0xd6e906=typeof _0x5612dd['offset']===_0x61ff('0x1b')&&typeof _0x5612dd[_0x61ff('0x1c')]===_0x61ff('0x1b');var _0x449714=_0x4e2bd7['count'];var _0x272050=_0xd6e906?0x0:_0x5612dd[_0x61ff('0x1d')];var _0x5ad756=_0xd6e906?_0x4e2bd7[_0x61ff('0x1e')]:_0x5612dd['offset']+_0x5612dd[_0x61ff('0x1c')];var _0x1f8aec;if(_0x5ad756>=_0x449714){_0x5ad756=_0x449714;_0x1f8aec=0xc8;}else{_0x1f8aec=0xce;}_0x6de6eb['status'](_0x1f8aec);return _0x6de6eb['set'](_0x61ff('0x1f'),_0x272050+'-'+_0x5ad756+'/'+_0x449714)[_0x61ff('0x1a')](_0x4e2bd7);}return null;};}function patchUpdates(_0x46e78c){return function(_0x2b2d09){try{jsonpatch['apply'](_0x2b2d09,_0x46e78c,!![]);}catch(_0x191514){return BPromise['reject'](_0x191514);}return _0x2b2d09[_0x61ff('0x20')]();};}function saveUpdates(_0x1ad957,_0x296384){return function(_0x3e2f95){if(_0x3e2f95){return _0x3e2f95[_0x61ff('0x21')](_0x1ad957)['then'](function(_0x1e2440){return _0x1e2440;});}return null;};}function removeEntity(_0x5cd924,_0xa02699){return function(_0x51d4bb){if(_0x51d4bb){return _0x51d4bb[_0x61ff('0x22')]()[_0x61ff('0x23')](function(){_0x5cd924[_0x61ff('0x19')](0xcc)[_0x61ff('0x24')]();});}};}function handleEntityNotFound(_0x6813e9,_0x3725b4){return function(_0x4e426c){if(!_0x4e426c){_0x6813e9[_0x61ff('0x25')](0x194);}return _0x4e426c;};}function handleError(_0x44fee5,_0x386b8d){_0x386b8d=_0x386b8d||0x1f4;return function(_0x359444){logger[_0x61ff('0x26')](_0x359444[_0x61ff('0x27')]);if(_0x359444[_0x61ff('0x28')]){delete _0x359444[_0x61ff('0x28')];}_0x44fee5['status'](_0x386b8d)[_0x61ff('0x29')](_0x359444);};}exports[_0x61ff('0x2a')]=function(_0xb6e95b,_0x260778){var _0x5c512b={},_0x104d78={},_0x2f6934={'count':0x0,'rows':[]};var _0x3c3edb=_[_0x61ff('0x2b')](db[_0x61ff('0x2c')][_0x61ff('0x2d')],function(_0x52ea00){return{'name':_0x52ea00['fieldName'],'type':_0x52ea00['type'][_0x61ff('0x2e')]};});_0x104d78['model']=_[_0x61ff('0x2b')](_0x3c3edb,_0x61ff('0x28'));_0x104d78[_0x61ff('0x2f')]=_[_0x61ff('0x30')](_0xb6e95b[_0x61ff('0x2f')]);_0x104d78[_0x61ff('0x31')]=_[_0x61ff('0x32')](_0x104d78[_0x61ff('0x33')],_0x104d78[_0x61ff('0x2f')]);_0x5c512b[_0x61ff('0x34')]=_[_0x61ff('0x32')](_0x104d78['model'],qs[_0x61ff('0x35')](_0xb6e95b[_0x61ff('0x2f')][_0x61ff('0x35')]));_0x5c512b[_0x61ff('0x34')]=_0x5c512b[_0x61ff('0x34')][_0x61ff('0x36')]?_0x5c512b[_0x61ff('0x34')]:_0x104d78[_0x61ff('0x33')];if(!_0xb6e95b['query'][_0x61ff('0x37')](_0x61ff('0x38'))){_0x5c512b[_0x61ff('0x1c')]=qs[_0x61ff('0x1c')](_0xb6e95b[_0x61ff('0x2f')][_0x61ff('0x1c')]);_0x5c512b[_0x61ff('0x1d')]=qs[_0x61ff('0x1d')](_0xb6e95b[_0x61ff('0x2f')][_0x61ff('0x1d')]);}_0x5c512b[_0x61ff('0x39')]=qs[_0x61ff('0x3a')](_0xb6e95b[_0x61ff('0x2f')][_0x61ff('0x3a')]);_0x5c512b[_0x61ff('0x3b')]=qs[_0x61ff('0x31')](_[_0x61ff('0x3c')](_0xb6e95b[_0x61ff('0x2f')],_0x104d78[_0x61ff('0x31')]),_0x3c3edb);if(_0xb6e95b[_0x61ff('0x2f')][_0x61ff('0x3d')]){_0x5c512b['where']=_[_0x61ff('0x3e')](_0x5c512b[_0x61ff('0x3b')],{'$or':_[_0x61ff('0x2b')](_0x3c3edb,function(_0x1d53d3){if(_0x1d53d3[_0x61ff('0x3f')]!==_0x61ff('0x40')){var _0x45946a={};_0x45946a[_0x1d53d3[_0x61ff('0x28')]]={'$like':'%'+_0xb6e95b['query'][_0x61ff('0x3d')]+'%'};return _0x45946a;}})});}_0x5c512b=_[_0x61ff('0x3e')]({},_0x5c512b,_0xb6e95b[_0x61ff('0x41')]);var _0x4b47d7={'where':_0x5c512b['where']};return db[_0x61ff('0x2c')][_0x61ff('0x1e')](_0x4b47d7)[_0x61ff('0x23')](function(_0x101974){_0x2f6934[_0x61ff('0x1e')]=_0x101974;if(_0xb6e95b['query'][_0x61ff('0x42')]){_0x5c512b[_0x61ff('0x43')]=[{'all':!![]}];}return db[_0x61ff('0x2c')]['findAll'](_0x5c512b);})[_0x61ff('0x23')](function(_0x1f12ed){_0x2f6934['rows']=_0x1f12ed;return _0x2f6934;})[_0x61ff('0x23')](respondWithFilteredResult(_0x260778,_0x5c512b))['catch'](handleError(_0x260778,null));};exports[_0x61ff('0x44')]=function(_0x5c9e23,_0x3ec2bd){var _0x3e71d1={'raw':!![],'where':{'id':_0x5c9e23['params']['id']}},_0x552d6b={};_0x552d6b['model']=_[_0x61ff('0x30')](db['OpenchannelTransferReport']['rawAttributes']);_0x552d6b[_0x61ff('0x2f')]=_[_0x61ff('0x30')](_0x5c9e23['query']);_0x552d6b['filters']=_[_0x61ff('0x32')](_0x552d6b[_0x61ff('0x33')],_0x552d6b[_0x61ff('0x2f')]);_0x3e71d1[_0x61ff('0x34')]=_['intersection'](_0x552d6b['model'],qs[_0x61ff('0x35')](_0x5c9e23[_0x61ff('0x2f')][_0x61ff('0x35')]));_0x3e71d1[_0x61ff('0x34')]=_0x3e71d1[_0x61ff('0x34')]['length']?_0x3e71d1[_0x61ff('0x34')]:_0x552d6b[_0x61ff('0x33')];if(_0x5c9e23[_0x61ff('0x2f')][_0x61ff('0x42')]){_0x3e71d1[_0x61ff('0x43')]=[{'all':!![]}];}_0x3e71d1=_[_0x61ff('0x3e')]({},_0x3e71d1,_0x5c9e23['options']);return db[_0x61ff('0x2c')]['find'](_0x3e71d1)[_0x61ff('0x23')](handleEntityNotFound(_0x3ec2bd,null))[_0x61ff('0x23')](respondWithResult(_0x3ec2bd,null))['catch'](handleError(_0x3ec2bd,null));};exports[_0x61ff('0x45')]=function(_0x214ec3,_0x3593f5){return db[_0x61ff('0x2c')][_0x61ff('0x45')](_0x214ec3['body'],{})[_0x61ff('0x23')](respondWithResult(_0x3593f5,0xc9))[_0x61ff('0x46')](handleError(_0x3593f5,null));};exports[_0x61ff('0x21')]=function(_0x23fa3c,_0x3e649e){if(_0x23fa3c[_0x61ff('0x47')]['id']){delete _0x23fa3c[_0x61ff('0x47')]['id'];}return db['OpenchannelTransferReport'][_0x61ff('0x48')]({'where':{'id':_0x23fa3c['params']['id']}})[_0x61ff('0x23')](handleEntityNotFound(_0x3e649e,null))[_0x61ff('0x23')](saveUpdates(_0x23fa3c[_0x61ff('0x47')],null))[_0x61ff('0x23')](respondWithResult(_0x3e649e,null))['catch'](handleError(_0x3e649e,null));};exports[_0x61ff('0x22')]=function(_0x6e1095,_0x45a1cb){return db[_0x61ff('0x2c')][_0x61ff('0x48')]({'where':{'id':_0x6e1095[_0x61ff('0x49')]['id']}})['then'](handleEntityNotFound(_0x45a1cb,null))[_0x61ff('0x23')](removeEntity(_0x45a1cb,null))[_0x61ff('0x46')](handleError(_0x45a1cb,null));};exports[_0x61ff('0x4a')]=function(_0x252cc7,_0x4eca0a){return db['OpenchannelTransferReport'][_0x61ff('0x4a')]()[_0x61ff('0x23')](respondWithResult(_0x4eca0a,null))['catch'](handleError(_0x4eca0a,null));}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.model.js b/server/api/openchannelTransferReport/openchannelTransferReport.model.js index 13f2097..f0944db 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 _0x9654=['../../config/logger','api','bluebird','request-promise','path','rimraf','./openchannelTransferReport.attributes','exports','OpenchannelTransferReport','report_openchannel_transfer','lodash'];(function(_0x581a4b,_0x3252f9){var _0x200f3=function(_0x2fcd79){while(--_0x2fcd79){_0x581a4b['push'](_0x581a4b['shift']());}};_0x200f3(++_0x3252f9);}(_0x9654,0x107));var _0x4965=function(_0x27031e,_0x1eb8cd){_0x27031e=_0x27031e-0x0;var _0xfd46b3=_0x9654[_0x27031e];return _0xfd46b3;};'use strict';var _=require(_0x4965('0x0'));var util=require('util');var logger=require(_0x4965('0x1'))(_0x4965('0x2'));var moment=require('moment');var BPromise=require(_0x4965('0x3'));var rp=require(_0x4965('0x4'));var fs=require('fs');var path=require(_0x4965('0x5'));var rimraf=require(_0x4965('0x6'));var config=require('../../config/environment');var attributes=require(_0x4965('0x7'));module[_0x4965('0x8')]=function(_0x58b31c,_0x28cd1a){return _0x58b31c['define'](_0x4965('0x9'),attributes,{'tableName':_0x4965('0xa'),'paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x48bb=['./openchannelTransferReport.attributes','exports','define','uniqueid','api','moment','request-promise','path','../../config/environment'];(function(_0x4d6298,_0x502f6b){var _0x57ccf0=function(_0x3cef94){while(--_0x3cef94){_0x4d6298['push'](_0x4d6298['shift']());}};_0x57ccf0(++_0x502f6b);}(_0x48bb,0x1ab));var _0xb48b=function(_0x142020,_0x1f7233){_0x142020=_0x142020-0x0;var _0x40da8f=_0x48bb[_0x142020];return _0x40da8f;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xb48b('0x0'));var moment=require(_0xb48b('0x1'));var BPromise=require('bluebird');var rp=require(_0xb48b('0x2'));var fs=require('fs');var path=require(_0xb48b('0x3'));var rimraf=require('rimraf');var config=require(_0xb48b('0x4'));var attributes=require(_0xb48b('0x5'));module[_0xb48b('0x6')]=function(_0x22ea37,_0x3a880b){return _0x22ea37[_0xb48b('0x7')]('OpenchannelTransferReport',attributes,{'tableName':'report_openchannel_transfer','paranoid':![],'indexes':[{'name':_0xb48b('0x8'),'fields':[_0xb48b('0x8')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js b/server/api/openchannelTransferReport/openchannelTransferReport.rpc.js index bba4a5f..41ed28b 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 _0x3bd7=['request\x20sent','debug','OpenchannelTransferReport,\x20%s,\x20%s,\x20%s','stringify','error','code','OpenchannelTransferReport,\x20%s,\x20%s','message','result','catch','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','request','info'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3bd7,0x199));var _0x73bd=function(_0x36d703,_0x55b354){_0x36d703=_0x36d703-0x0;var _0x12c909=_0x3bd7[_0x36d703];return _0x12c909;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x73bd('0x0'));var BPromise=require(_0x73bd('0x1'));var rs=require(_0x73bd('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x73bd('0x3'))['db'];var utils=require(_0x73bd('0x4'));var logger=require(_0x73bd('0x5'))('rpc');var config=require(_0x73bd('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x73bd('0x7')][_0x73bd('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bca41,_0x38ffbb,_0x4c1254){return new BPromise(function(_0x569bef,_0x549abe){return client[_0x73bd('0x9')](_0x4bca41,_0x4c1254)['then'](function(_0x4f627c){logger[_0x73bd('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x38ffbb,_0x73bd('0xb'));logger[_0x73bd('0xc')](_0x73bd('0xd'),_0x38ffbb,_0x73bd('0xb'),JSON[_0x73bd('0xe')](_0x4f627c));if(_0x4f627c[_0x73bd('0xf')]){if(_0x4f627c['error'][_0x73bd('0x10')]===0x1f4){logger[_0x73bd('0xf')](_0x73bd('0x11'),_0x38ffbb,_0x4f627c[_0x73bd('0xf')][_0x73bd('0x12')]);return _0x549abe(_0x4f627c[_0x73bd('0xf')]['message']);}logger[_0x73bd('0xf')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x38ffbb,_0x4f627c[_0x73bd('0xf')][_0x73bd('0x12')]);return _0x569bef(_0x4f627c[_0x73bd('0xf')][_0x73bd('0x12')]);}else{logger[_0x73bd('0xa')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x38ffbb,_0x73bd('0xb'));_0x569bef(_0x4f627c[_0x73bd('0x13')][_0x73bd('0x12')]);}})[_0x73bd('0x14')](function(_0x411931){logger[_0x73bd('0xf')](_0x73bd('0x11'),_0x38ffbb,_0x411931);_0x549abe(_0x411931);});});} \ No newline at end of file +var _0x60c2=['stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','OpenchannelTransferReport,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x23a0a5,_0x2c8d5e){var _0x4bef70=function(_0x41edbf){while(--_0x41edbf){_0x23a0a5['push'](_0x23a0a5['shift']());}};_0x4bef70(++_0x2c8d5e);}(_0x60c2,0x8f));var _0x260c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x60c2[_0x14add3];return _0x4a174f;};'use strict';var _=require('lodash');var util=require(_0x260c('0x0'));var moment=require(_0x260c('0x1'));var BPromise=require(_0x260c('0x2'));var rs=require(_0x260c('0x3'));var fs=require('fs');var Redis=require(_0x260c('0x4'));var db=require(_0x260c('0x5'))['db'];var utils=require(_0x260c('0x6'));var logger=require(_0x260c('0x7'))(_0x260c('0x8'));var config=require(_0x260c('0x9'));var jayson=require(_0x260c('0xa'));var client=jayson[_0x260c('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x14fab2,_0x2c2cd8,_0x3b432d){return new BPromise(function(_0xf22c37,_0x4b2992){return client[_0x260c('0xc')](_0x14fab2,_0x3b432d)[_0x260c('0xd')](function(_0x8378bb){logger[_0x260c('0xe')](_0x260c('0xf'),_0x2c2cd8,_0x260c('0x10'));logger[_0x260c('0x11')]('OpenchannelTransferReport,\x20%s,\x20%s,\x20%s',_0x2c2cd8,_0x260c('0x10'),JSON[_0x260c('0x12')](_0x8378bb));if(_0x8378bb[_0x260c('0x13')]){if(_0x8378bb['error'][_0x260c('0x14')]===0x1f4){logger[_0x260c('0x13')](_0x260c('0xf'),_0x2c2cd8,_0x8378bb['error'][_0x260c('0x15')]);return _0x4b2992(_0x8378bb[_0x260c('0x13')][_0x260c('0x15')]);}logger[_0x260c('0x13')](_0x260c('0xf'),_0x2c2cd8,_0x8378bb['error'][_0x260c('0x15')]);return _0xf22c37(_0x8378bb['error'][_0x260c('0x15')]);}else{logger[_0x260c('0xe')]('OpenchannelTransferReport,\x20%s,\x20%s',_0x2c2cd8,_0x260c('0x10'));_0xf22c37(_0x8378bb['result'][_0x260c('0x15')]);}})[_0x260c('0x16')](function(_0x411970){logger[_0x260c('0x13')](_0x260c('0xf'),_0x2c2cd8,_0x411970);_0x4b2992(_0x411970);});});} \ No newline at end of file diff --git a/server/api/pause/index.js b/server/api/pause/index.js index 5914042..f156420 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 _0x4439=['/:id','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','show','post','put'];(function(_0x23522d,_0xeb71dd){var _0xc85ee3=function(_0x29c5bd){while(--_0x29c5bd){_0x23522d['push'](_0x23522d['shift']());}};_0xc85ee3(++_0xeb71dd);}(_0x4439,0x1e2));var _0x9443=function(_0x40ebff,_0x1dd15e){_0x40ebff=_0x40ebff-0x0;var _0x40122a=_0x4439[_0x40ebff];return _0x40122a;};'use strict';var multer=require(_0x9443('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x9443('0x1'));var express=require(_0x9443('0x2'));var router=express[_0x9443('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x9443('0x4'));var interaction=require(_0x9443('0x5'));var config=require(_0x9443('0x6'));var controller=require('./pause.controller');router[_0x9443('0x7')]('/',auth[_0x9443('0x8')](),controller[_0x9443('0x9')]);router['get']('/:id',auth[_0x9443('0x8')](),controller[_0x9443('0xa')]);router[_0x9443('0xb')]('/',auth[_0x9443('0x8')](),controller['create']);router[_0x9443('0xc')]('/:id',auth[_0x9443('0x8')](),controller['update']);router['delete'](_0x9443('0xd'),auth[_0x9443('0x8')](),controller['destroy']);module[_0x9443('0xe')]=router; \ No newline at end of file +var _0xaa2d=['../../config/environment','./pause.controller','get','isAuthenticated','show','post','create','put','/:id','update','delete','destroy','util','Router','fs-extra','../../components/auth/service'];(function(_0x354fad,_0x46d589){var _0xca81f5=function(_0x54fea6){while(--_0x54fea6){_0x354fad['push'](_0x354fad['shift']());}};_0xca81f5(++_0x46d589);}(_0xaa2d,0x11c));var _0xdaa2=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xaa2d[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require(_0xdaa2('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0xdaa2('0x1')]();var fs_extra=require(_0xdaa2('0x2'));var auth=require(_0xdaa2('0x3'));var interaction=require('../../components/interaction/service');var config=require(_0xdaa2('0x4'));var controller=require(_0xdaa2('0x5'));router[_0xdaa2('0x6')]('/',auth['isAuthenticated'](),controller['index']);router[_0xdaa2('0x6')]('/:id',auth[_0xdaa2('0x7')](),controller[_0xdaa2('0x8')]);router[_0xdaa2('0x9')]('/',auth['isAuthenticated'](),controller[_0xdaa2('0xa')]);router[_0xdaa2('0xb')](_0xdaa2('0xc'),auth[_0xdaa2('0x7')](),controller[_0xdaa2('0xd')]);router[_0xdaa2('0xe')]('/:id',auth['isAuthenticated'](),controller[_0xdaa2('0xf')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/pause/pause.attributes.js b/server/api/pause/pause.attributes.js index e79d7c4..e045973 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 _0x9330=['sequelize','exports','STRING'];(function(_0x561968,_0x1f9151){var _0x510072=function(_0x475895){while(--_0x475895){_0x561968['push'](_0x561968['shift']());}};_0x510072(++_0x1f9151);}(_0x9330,0x1ec));var _0x0933=function(_0x3998d3,_0x270413){_0x3998d3=_0x3998d3-0x0;var _0x5cadf1=_0x9330[_0x3998d3];return _0x5cadf1;};'use strict';var Sequelize=require(_0x0933('0x0'));module[_0x0933('0x1')]={'name':{'type':Sequelize[_0x0933('0x2')],'unique':'name','allowNull':![]},'description':{'type':Sequelize[_0x0933('0x2')]}}; \ No newline at end of file +var _0x9128=['name','STRING','sequelize'];(function(_0x162a9a,_0x27a189){var _0x86efba=function(_0xccdb9e){while(--_0xccdb9e){_0x162a9a['push'](_0x162a9a['shift']());}};_0x86efba(++_0x27a189);}(_0x9128,0x14f));var _0x8912=function(_0x57fc2a,_0x14bbe5){_0x57fc2a=_0x57fc2a-0x0;var _0xa839b=_0x9128[_0x57fc2a];return _0xa839b;};'use strict';var Sequelize=require(_0x8912('0x0'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x8912('0x1'),'allowNull':![]},'description':{'type':Sequelize[_0x8912('0x2')]}}; \ No newline at end of file diff --git a/server/api/pause/pause.controller.js b/server/api/pause/pause.controller.js index 344b46d..00aedd8 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 _0x24b9=['params','intersection','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','userProfileId','autoAssociation','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','json','offset','undefined','limit','count','status','Content-Range','reject','update','then','destroy','get','Pauses','UserProfileResource','end','error','name','map','Pause','rawAttributes','fieldName','type','key','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','query','sort','where','VIRTUAL','filter','merge','includeAll','include','findAll','rows','catch'];(function(_0x20c21f,_0x999c2e){var _0x31f189=function(_0x178b55){while(--_0x178b55){_0x20c21f['push'](_0x20c21f['shift']());}};_0x31f189(++_0x999c2e);}(_0x24b9,0xa8));var _0x924b=function(_0x231ba1,_0x8ecc2d){_0x231ba1=_0x231ba1-0x0;var _0xdbe5ac=_0x24b9[_0x231ba1];return _0xdbe5ac;};'use strict';var emlformat=require(_0x924b('0x0'));var rimraf=require(_0x924b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x924b('0x2'));var rp=require(_0x924b('0x3'));var moment=require(_0x924b('0x4'));var BPromise=require(_0x924b('0x5'));var Mustache=require(_0x924b('0x6'));var util=require(_0x924b('0x7'));var path=require(_0x924b('0x8'));var sox=require(_0x924b('0x9'));var csv=require(_0x924b('0xa'));var ejs=require(_0x924b('0xb'));var fs=require('fs');var fs_extra=require(_0x924b('0xc'));var _=require(_0x924b('0xd'));var squel=require(_0x924b('0xe'));var crypto=require(_0x924b('0xf'));var jsforce=require(_0x924b('0x10'));var deskjs=require(_0x924b('0x11'));var toCsv=require(_0x924b('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x924b('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x924b('0x13'));var as=require(_0x924b('0x14'));var hardwareService=require(_0x924b('0x15'));var logger=require(_0x924b('0x16'))(_0x924b('0x17'));var utils=require(_0x924b('0x18'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x924b('0x19'))['db'];function respondWithStatusCode(_0x107a42,_0x4a5d5c){_0x4a5d5c=_0x4a5d5c||0xcc;return function(_0x468944){if(_0x468944){return _0x107a42[_0x924b('0x1a')](_0x4a5d5c);}return _0x107a42['status'](_0x4a5d5c)['end']();};}function respondWithResult(_0x2538e0,_0x160aa3){_0x160aa3=_0x160aa3||0xc8;return function(_0x125a3d){if(_0x125a3d){return _0x2538e0['status'](_0x160aa3)[_0x924b('0x1b')](_0x125a3d);}};}function respondWithFilteredResult(_0x8c9f1e,_0x46feda){return function(_0x5218d2){if(_0x5218d2){var _0x7957b9=typeof _0x46feda[_0x924b('0x1c')]===_0x924b('0x1d')&&typeof _0x46feda[_0x924b('0x1e')]==='undefined';var _0x5e8bae=_0x5218d2[_0x924b('0x1f')];var _0x3c7c97=_0x7957b9?0x0:_0x46feda[_0x924b('0x1c')];var _0x20bfb1=_0x7957b9?_0x5218d2[_0x924b('0x1f')]:_0x46feda[_0x924b('0x1c')]+_0x46feda[_0x924b('0x1e')];var _0x38df3e;if(_0x20bfb1>=_0x5e8bae){_0x20bfb1=_0x5e8bae;_0x38df3e=0xc8;}else{_0x38df3e=0xce;}_0x8c9f1e[_0x924b('0x20')](_0x38df3e);return _0x8c9f1e['set'](_0x924b('0x21'),_0x3c7c97+'-'+_0x20bfb1+'/'+_0x5e8bae)[_0x924b('0x1b')](_0x5218d2);}return null;};}function patchUpdates(_0x53dfdc){return function(_0x3338ea){try{jsonpatch['apply'](_0x3338ea,_0x53dfdc,!![]);}catch(_0x5481bd){return BPromise[_0x924b('0x22')](_0x5481bd);}return _0x3338ea['save']();};}function saveUpdates(_0x5a86c4,_0x37d696){return function(_0x491e2f){if(_0x491e2f){return _0x491e2f[_0x924b('0x23')](_0x5a86c4)[_0x924b('0x24')](function(_0x4895e4){return _0x4895e4;});}return null;};}function removeEntity(_0x125721,_0x5b6e1e){return function(_0x2e5948){if(_0x2e5948){return _0x2e5948[_0x924b('0x25')]()[_0x924b('0x24')](function(){var _0x1d9eb9=_0x2e5948[_0x924b('0x26')]({'plain':!![]});var _0x446eb0=_0x924b('0x27');return db[_0x924b('0x28')][_0x924b('0x25')]({'where':{'type':_0x446eb0,'resourceId':_0x1d9eb9['id']}})[_0x924b('0x24')](function(){return _0x2e5948;});})[_0x924b('0x24')](function(){_0x125721[_0x924b('0x20')](0xcc)[_0x924b('0x29')]();});}};}function handleEntityNotFound(_0x483805,_0x12aa5c){return function(_0x5caf53){if(!_0x5caf53){_0x483805['sendStatus'](0x194);}return _0x5caf53;};}function handleError(_0x2bc2ca,_0xca41ab){_0xca41ab=_0xca41ab||0x1f4;return function(_0x39bfa9){logger[_0x924b('0x2a')](_0x39bfa9['stack']);if(_0x39bfa9[_0x924b('0x2b')]){delete _0x39bfa9[_0x924b('0x2b')];}_0x2bc2ca[_0x924b('0x20')](_0xca41ab)['send'](_0x39bfa9);};}exports['index']=function(_0x4a7c27,_0x559775){var _0x19340c={},_0x377fac={},_0x5d031d={'count':0x0,'rows':[]};var _0x556066=_[_0x924b('0x2c')](db[_0x924b('0x2d')][_0x924b('0x2e')],function(_0x11f0d0){return{'name':_0x11f0d0[_0x924b('0x2f')],'type':_0x11f0d0[_0x924b('0x30')][_0x924b('0x31')]};});_0x377fac['model']=_[_0x924b('0x2c')](_0x556066,_0x924b('0x2b'));_0x377fac['query']=_[_0x924b('0x32')](_0x4a7c27['query']);_0x377fac[_0x924b('0x33')]=_['intersection'](_0x377fac[_0x924b('0x34')],_0x377fac['query']);_0x19340c[_0x924b('0x35')]=_['intersection'](_0x377fac[_0x924b('0x34')],qs['fields'](_0x4a7c27['query'][_0x924b('0x36')]));_0x19340c[_0x924b('0x35')]=_0x19340c['attributes'][_0x924b('0x37')]?_0x19340c[_0x924b('0x35')]:_0x377fac['model'];if(!_0x4a7c27['query'][_0x924b('0x38')](_0x924b('0x39'))){_0x19340c[_0x924b('0x1e')]=qs[_0x924b('0x1e')](_0x4a7c27[_0x924b('0x3a')][_0x924b('0x1e')]);_0x19340c[_0x924b('0x1c')]=qs[_0x924b('0x1c')](_0x4a7c27[_0x924b('0x3a')][_0x924b('0x1c')]);}_0x19340c['order']=qs[_0x924b('0x3b')](_0x4a7c27[_0x924b('0x3a')][_0x924b('0x3b')]);_0x19340c[_0x924b('0x3c')]=qs[_0x924b('0x33')](_['pick'](_0x4a7c27[_0x924b('0x3a')],_0x377fac[_0x924b('0x33')]),_0x556066);if(_0x4a7c27[_0x924b('0x3a')]['filter']){_0x19340c[_0x924b('0x3c')]=_['merge'](_0x19340c[_0x924b('0x3c')],{'$or':_[_0x924b('0x2c')](_0x556066,function(_0xefa67e){if(_0xefa67e[_0x924b('0x30')]!==_0x924b('0x3d')){var _0x318b44={};_0x318b44[_0xefa67e['name']]={'$like':'%'+_0x4a7c27[_0x924b('0x3a')][_0x924b('0x3e')]+'%'};return _0x318b44;}})});}_0x19340c=_[_0x924b('0x3f')]({},_0x19340c,_0x4a7c27['options']);var _0x54fedf={'where':_0x19340c[_0x924b('0x3c')]};return db['Pause'][_0x924b('0x1f')](_0x54fedf)['then'](function(_0x1481d0){_0x5d031d['count']=_0x1481d0;if(_0x4a7c27[_0x924b('0x3a')][_0x924b('0x40')]){_0x19340c[_0x924b('0x41')]=[{'all':!![]}];}return db[_0x924b('0x2d')][_0x924b('0x42')](_0x19340c);})[_0x924b('0x24')](function(_0x30c5d2){_0x5d031d[_0x924b('0x43')]=_0x30c5d2;return _0x5d031d;})[_0x924b('0x24')](respondWithFilteredResult(_0x559775,_0x19340c))[_0x924b('0x44')](handleError(_0x559775,null));};exports['show']=function(_0x52b23e,_0x28d5d9){var _0x2efd0f={'raw':!![],'where':{'id':_0x52b23e[_0x924b('0x45')]['id']}},_0xce8b0b={};_0xce8b0b[_0x924b('0x34')]=_[_0x924b('0x32')](db[_0x924b('0x2d')][_0x924b('0x2e')]);_0xce8b0b[_0x924b('0x3a')]=_[_0x924b('0x32')](_0x52b23e[_0x924b('0x3a')]);_0xce8b0b[_0x924b('0x33')]=_[_0x924b('0x46')](_0xce8b0b['model'],_0xce8b0b[_0x924b('0x3a')]);_0x2efd0f[_0x924b('0x35')]=_[_0x924b('0x46')](_0xce8b0b['model'],qs[_0x924b('0x36')](_0x52b23e[_0x924b('0x3a')][_0x924b('0x36')]));_0x2efd0f[_0x924b('0x35')]=_0x2efd0f[_0x924b('0x35')]['length']?_0x2efd0f[_0x924b('0x35')]:_0xce8b0b[_0x924b('0x34')];if(_0x52b23e[_0x924b('0x3a')][_0x924b('0x40')]){_0x2efd0f[_0x924b('0x41')]=[{'all':!![]}];}_0x2efd0f=_[_0x924b('0x3f')]({},_0x2efd0f,_0x52b23e[_0x924b('0x47')]);return db['Pause'][_0x924b('0x48')](_0x2efd0f)[_0x924b('0x24')](handleEntityNotFound(_0x28d5d9,null))['then'](respondWithResult(_0x28d5d9,null))[_0x924b('0x44')](handleError(_0x28d5d9,null));};exports[_0x924b('0x49')]=function(_0x551d5a,_0x879ec1){return db['Pause'][_0x924b('0x49')](_0x551d5a[_0x924b('0x4a')],{})[_0x924b('0x24')](function(_0x133efb){var _0x4ce200=_0x551d5a[_0x924b('0x4b')][_0x924b('0x26')]({'plain':!![]});if(!_0x4ce200)throw new Error(_0x924b('0x4c'));if(_0x4ce200['role']==='user'){var _0x3b0a62=_0x133efb[_0x924b('0x26')]({'plain':!![]});var _0x1fcf5c=_0x924b('0x27');return db['UserProfileSection'][_0x924b('0x48')]({'where':{'name':_0x1fcf5c,'userProfileId':_0x4ce200[_0x924b('0x4d')]},'raw':!![]})['then'](function(_0x33d01b){if(_0x33d01b&&_0x33d01b[_0x924b('0x4e')]===0x0){return db[_0x924b('0x28')]['create']({'name':_0x3b0a62[_0x924b('0x2b')],'resourceId':_0x3b0a62['id'],'type':_0x33d01b[_0x924b('0x2b')],'sectionId':_0x33d01b['id']},{})[_0x924b('0x24')](function(){return _0x133efb;});}else{return _0x133efb;}})[_0x924b('0x44')](function(_0x1bb591){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bb591);throw _0x1bb591;});}return _0x133efb;})[_0x924b('0x24')](respondWithResult(_0x879ec1,0xc9))[_0x924b('0x44')](handleError(_0x879ec1,null));};exports[_0x924b('0x23')]=function(_0x52f01e,_0x17d8c5){if(_0x52f01e[_0x924b('0x4a')]['id']){delete _0x52f01e[_0x924b('0x4a')]['id'];}return db[_0x924b('0x2d')][_0x924b('0x48')]({'where':{'id':_0x52f01e[_0x924b('0x45')]['id']}})['then'](handleEntityNotFound(_0x17d8c5,null))[_0x924b('0x24')](saveUpdates(_0x52f01e[_0x924b('0x4a')],null))[_0x924b('0x24')](respondWithResult(_0x17d8c5,null))[_0x924b('0x44')](handleError(_0x17d8c5,null));};exports[_0x924b('0x25')]=function(_0x3837b7,_0x26b7aa){return db['Pause'][_0x924b('0x48')]({'where':{'id':_0x3837b7[_0x924b('0x45')]['id']}})[_0x924b('0x24')](handleEntityNotFound(_0x26b7aa,null))[_0x924b('0x24')](removeEntity(_0x26b7aa,null))[_0x924b('0x44')](handleError(_0x26b7aa,null));}; \ No newline at end of file +var _0xe135=['nolimit','order','sort','where','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','keys','rawAttributes','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','find','userProfileId','autoAssociation','update','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','jsforce','querystring','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','Pauses','UserProfileResource','sendStatus','error','stack','name','send','index','map','Pause','fieldName','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty'];(function(_0x168127,_0x59cea1){var _0x4c99ad=function(_0x4ab3f2){while(--_0x4ab3f2){_0x168127['push'](_0x168127['shift']());}};_0x4c99ad(++_0x59cea1);}(_0xe135,0x177));var _0x5e13=function(_0x4be79b,_0x21e987){_0x4be79b=_0x4be79b-0x0;var _0x14d71e=_0xe135[_0x4be79b];return _0x14d71e;};'use strict';var emlformat=require(_0x5e13('0x0'));var rimraf=require(_0x5e13('0x1'));var zipdir=require(_0x5e13('0x2'));var jsonpatch=require(_0x5e13('0x3'));var rp=require(_0x5e13('0x4'));var moment=require(_0x5e13('0x5'));var BPromise=require(_0x5e13('0x6'));var Mustache=require('mustache');var util=require(_0x5e13('0x7'));var path=require(_0x5e13('0x8'));var sox=require(_0x5e13('0x9'));var csv=require(_0x5e13('0xa'));var ejs=require(_0x5e13('0xb'));var fs=require('fs');var fs_extra=require(_0x5e13('0xc'));var _=require(_0x5e13('0xd'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x5e13('0xe'));var deskjs=require('desk.js');var toCsv=require(_0x5e13('0xa'));var querystring=require(_0x5e13('0xf'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x5e13('0x10'));var qs=require(_0x5e13('0x11'));var as=require(_0x5e13('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x5e13('0x13'));var utils=require(_0x5e13('0x14'));var config=require(_0x5e13('0x15'));var licenseUtil=require(_0x5e13('0x16'));var db=require(_0x5e13('0x17'))['db'];function respondWithStatusCode(_0x4ea102,_0x260afb){_0x260afb=_0x260afb||0xcc;return function(_0x401a14){if(_0x401a14){return _0x4ea102['sendStatus'](_0x260afb);}return _0x4ea102['status'](_0x260afb)[_0x5e13('0x18')]();};}function respondWithResult(_0x35ec86,_0x4fafb4){_0x4fafb4=_0x4fafb4||0xc8;return function(_0x1eff2f){if(_0x1eff2f){return _0x35ec86[_0x5e13('0x19')](_0x4fafb4)[_0x5e13('0x1a')](_0x1eff2f);}};}function respondWithFilteredResult(_0x3c546c,_0x1eb314){return function(_0x174711){if(_0x174711){var _0x114b67=typeof _0x1eb314[_0x5e13('0x1b')]===_0x5e13('0x1c')&&typeof _0x1eb314[_0x5e13('0x1d')]===_0x5e13('0x1c');var _0x49e611=_0x174711[_0x5e13('0x1e')];var _0x2f0c3f=_0x114b67?0x0:_0x1eb314[_0x5e13('0x1b')];var _0xc27e27=_0x114b67?_0x174711[_0x5e13('0x1e')]:_0x1eb314['offset']+_0x1eb314[_0x5e13('0x1d')];var _0x4d5cb2;if(_0xc27e27>=_0x49e611){_0xc27e27=_0x49e611;_0x4d5cb2=0xc8;}else{_0x4d5cb2=0xce;}_0x3c546c['status'](_0x4d5cb2);return _0x3c546c[_0x5e13('0x1f')](_0x5e13('0x20'),_0x2f0c3f+'-'+_0xc27e27+'/'+_0x49e611)['json'](_0x174711);}return null;};}function patchUpdates(_0x55e843){return function(_0x4fd4b1){try{jsonpatch[_0x5e13('0x21')](_0x4fd4b1,_0x55e843,!![]);}catch(_0x2316fa){return BPromise[_0x5e13('0x22')](_0x2316fa);}return _0x4fd4b1[_0x5e13('0x23')]();};}function saveUpdates(_0x5d0ca6,_0x30bd20){return function(_0x5aaa39){if(_0x5aaa39){return _0x5aaa39['update'](_0x5d0ca6)[_0x5e13('0x24')](function(_0xbee377){return _0xbee377;});}return null;};}function removeEntity(_0x1e1247,_0x30bf03){return function(_0x125559){if(_0x125559){return _0x125559[_0x5e13('0x25')]()[_0x5e13('0x24')](function(){var _0x2a5e0c=_0x125559[_0x5e13('0x26')]({'plain':!![]});var _0xb92e1e=_0x5e13('0x27');return db[_0x5e13('0x28')][_0x5e13('0x25')]({'where':{'type':_0xb92e1e,'resourceId':_0x2a5e0c['id']}})['then'](function(){return _0x125559;});})[_0x5e13('0x24')](function(){_0x1e1247['status'](0xcc)[_0x5e13('0x18')]();});}};}function handleEntityNotFound(_0x5595c6,_0x544ea4){return function(_0xb34ace){if(!_0xb34ace){_0x5595c6[_0x5e13('0x29')](0x194);}return _0xb34ace;};}function handleError(_0x140dbc,_0x546c47){_0x546c47=_0x546c47||0x1f4;return function(_0x272d02){logger[_0x5e13('0x2a')](_0x272d02[_0x5e13('0x2b')]);if(_0x272d02['name']){delete _0x272d02[_0x5e13('0x2c')];}_0x140dbc['status'](_0x546c47)[_0x5e13('0x2d')](_0x272d02);};}exports[_0x5e13('0x2e')]=function(_0x5bb367,_0x55d588){var _0x2ad087={},_0x20b155={},_0x49c4b6={'count':0x0,'rows':[]};var _0x3ab587=_[_0x5e13('0x2f')](db[_0x5e13('0x30')]['rawAttributes'],function(_0x4e0727){return{'name':_0x4e0727[_0x5e13('0x31')],'type':_0x4e0727[_0x5e13('0x32')][_0x5e13('0x33')]};});_0x20b155[_0x5e13('0x34')]=_[_0x5e13('0x2f')](_0x3ab587,'name');_0x20b155['query']=_['keys'](_0x5bb367[_0x5e13('0x35')]);_0x20b155[_0x5e13('0x36')]=_[_0x5e13('0x37')](_0x20b155['model'],_0x20b155[_0x5e13('0x35')]);_0x2ad087[_0x5e13('0x38')]=_[_0x5e13('0x37')](_0x20b155['model'],qs[_0x5e13('0x39')](_0x5bb367[_0x5e13('0x35')][_0x5e13('0x39')]));_0x2ad087[_0x5e13('0x38')]=_0x2ad087[_0x5e13('0x38')][_0x5e13('0x3a')]?_0x2ad087['attributes']:_0x20b155[_0x5e13('0x34')];if(!_0x5bb367[_0x5e13('0x35')][_0x5e13('0x3b')](_0x5e13('0x3c'))){_0x2ad087[_0x5e13('0x1d')]=qs[_0x5e13('0x1d')](_0x5bb367[_0x5e13('0x35')][_0x5e13('0x1d')]);_0x2ad087[_0x5e13('0x1b')]=qs['offset'](_0x5bb367['query'][_0x5e13('0x1b')]);}_0x2ad087[_0x5e13('0x3d')]=qs[_0x5e13('0x3e')](_0x5bb367[_0x5e13('0x35')][_0x5e13('0x3e')]);_0x2ad087[_0x5e13('0x3f')]=qs['filters'](_['pick'](_0x5bb367[_0x5e13('0x35')],_0x20b155[_0x5e13('0x36')]),_0x3ab587);if(_0x5bb367[_0x5e13('0x35')][_0x5e13('0x40')]){_0x2ad087[_0x5e13('0x3f')]=_['merge'](_0x2ad087[_0x5e13('0x3f')],{'$or':_[_0x5e13('0x2f')](_0x3ab587,function(_0x7d934){if(_0x7d934[_0x5e13('0x32')]!==_0x5e13('0x41')){var _0x5a4d3c={};_0x5a4d3c[_0x7d934[_0x5e13('0x2c')]]={'$like':'%'+_0x5bb367[_0x5e13('0x35')]['filter']+'%'};return _0x5a4d3c;}})});}_0x2ad087=_[_0x5e13('0x42')]({},_0x2ad087,_0x5bb367[_0x5e13('0x43')]);var _0x249e87={'where':_0x2ad087['where']};return db[_0x5e13('0x30')][_0x5e13('0x1e')](_0x249e87)[_0x5e13('0x24')](function(_0x55d717){_0x49c4b6[_0x5e13('0x1e')]=_0x55d717;if(_0x5bb367[_0x5e13('0x35')][_0x5e13('0x44')]){_0x2ad087[_0x5e13('0x45')]=[{'all':!![]}];}return db[_0x5e13('0x30')][_0x5e13('0x46')](_0x2ad087);})['then'](function(_0x1e8952){_0x49c4b6[_0x5e13('0x47')]=_0x1e8952;return _0x49c4b6;})['then'](respondWithFilteredResult(_0x55d588,_0x2ad087))[_0x5e13('0x48')](handleError(_0x55d588,null));};exports[_0x5e13('0x49')]=function(_0xb13f94,_0x3616e6){var _0x3f8f9e={'raw':!![],'where':{'id':_0xb13f94[_0x5e13('0x4a')]['id']}},_0x25cf8f={};_0x25cf8f[_0x5e13('0x34')]=_[_0x5e13('0x4b')](db[_0x5e13('0x30')][_0x5e13('0x4c')]);_0x25cf8f[_0x5e13('0x35')]=_['keys'](_0xb13f94['query']);_0x25cf8f[_0x5e13('0x36')]=_['intersection'](_0x25cf8f[_0x5e13('0x34')],_0x25cf8f[_0x5e13('0x35')]);_0x3f8f9e['attributes']=_[_0x5e13('0x37')](_0x25cf8f[_0x5e13('0x34')],qs[_0x5e13('0x39')](_0xb13f94[_0x5e13('0x35')][_0x5e13('0x39')]));_0x3f8f9e['attributes']=_0x3f8f9e[_0x5e13('0x38')][_0x5e13('0x3a')]?_0x3f8f9e[_0x5e13('0x38')]:_0x25cf8f[_0x5e13('0x34')];if(_0xb13f94[_0x5e13('0x35')][_0x5e13('0x44')]){_0x3f8f9e[_0x5e13('0x45')]=[{'all':!![]}];}_0x3f8f9e=_[_0x5e13('0x42')]({},_0x3f8f9e,_0xb13f94['options']);return db[_0x5e13('0x30')]['find'](_0x3f8f9e)[_0x5e13('0x24')](handleEntityNotFound(_0x3616e6,null))[_0x5e13('0x24')](respondWithResult(_0x3616e6,null))['catch'](handleError(_0x3616e6,null));};exports['create']=function(_0x49fc9a,_0x5995a5){return db[_0x5e13('0x30')][_0x5e13('0x4d')](_0x49fc9a['body'],{})[_0x5e13('0x24')](function(_0x49ed2b){var _0x7941d=_0x49fc9a['user'][_0x5e13('0x26')]({'plain':!![]});if(!_0x7941d)throw new Error(_0x5e13('0x4e'));if(_0x7941d[_0x5e13('0x4f')]===_0x5e13('0x50')){var _0xca0f0b=_0x49ed2b['get']({'plain':!![]});var _0x2e178f=_0x5e13('0x27');return db[_0x5e13('0x51')][_0x5e13('0x52')]({'where':{'name':_0x2e178f,'userProfileId':_0x7941d[_0x5e13('0x53')]},'raw':!![]})[_0x5e13('0x24')](function(_0x285dae){if(_0x285dae&&_0x285dae[_0x5e13('0x54')]===0x0){return db[_0x5e13('0x28')][_0x5e13('0x4d')]({'name':_0xca0f0b[_0x5e13('0x2c')],'resourceId':_0xca0f0b['id'],'type':_0x285dae['name'],'sectionId':_0x285dae['id']},{})[_0x5e13('0x24')](function(){return _0x49ed2b;});}else{return _0x49ed2b;}})[_0x5e13('0x48')](function(_0x2ab649){logger[_0x5e13('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x2ab649);throw _0x2ab649;});}return _0x49ed2b;})[_0x5e13('0x24')](respondWithResult(_0x5995a5,0xc9))[_0x5e13('0x48')](handleError(_0x5995a5,null));};exports[_0x5e13('0x55')]=function(_0x1b4bd6,_0x5e435a){if(_0x1b4bd6['body']['id']){delete _0x1b4bd6[_0x5e13('0x56')]['id'];}return db[_0x5e13('0x30')][_0x5e13('0x52')]({'where':{'id':_0x1b4bd6[_0x5e13('0x4a')]['id']}})[_0x5e13('0x24')](handleEntityNotFound(_0x5e435a,null))['then'](saveUpdates(_0x1b4bd6[_0x5e13('0x56')],null))[_0x5e13('0x24')](respondWithResult(_0x5e435a,null))['catch'](handleError(_0x5e435a,null));};exports[_0x5e13('0x25')]=function(_0x51a151,_0x5e66bf){return db[_0x5e13('0x30')][_0x5e13('0x52')]({'where':{'id':_0x51a151['params']['id']}})[_0x5e13('0x24')](handleEntityNotFound(_0x5e66bf,null))[_0x5e13('0x24')](removeEntity(_0x5e66bf,null))[_0x5e13('0x48')](handleError(_0x5e66bf,null));}; \ No newline at end of file diff --git a/server/api/pause/pause.model.js b/server/api/pause/pause.model.js index fa5783a..805ec8f 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 _0x814b=['define','Pause','lodash','util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./pause.attributes','exports'];(function(_0xea1dea,_0xa3008d){var _0x193236=function(_0x4f4ba9){while(--_0x4f4ba9){_0xea1dea['push'](_0xea1dea['shift']());}};_0x193236(++_0xa3008d);}(_0x814b,0x1a2));var _0xb814=function(_0x2ab76b,_0x176579){_0x2ab76b=_0x2ab76b-0x0;var _0x201126=_0x814b[_0x2ab76b];return _0x201126;};'use strict';var _=require(_0xb814('0x0'));var util=require(_0xb814('0x1'));var logger=require(_0xb814('0x2'))(_0xb814('0x3'));var moment=require(_0xb814('0x4'));var BPromise=require(_0xb814('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb814('0x6'));var rimraf=require(_0xb814('0x7'));var config=require(_0xb814('0x8'));var attributes=require(_0xb814('0x9'));module[_0xb814('0xa')]=function(_0x322a70,_0x53e507){return _0x322a70[_0xb814('0xb')](_0xb814('0xc'),attributes,{'tableName':'tools_pauses','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6aa7=['Pause','tools_pauses','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','define'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6aa7,0x178));var _0x76aa=function(_0x52bf4e,_0x5aa4aa){_0x52bf4e=_0x52bf4e-0x0;var _0x32f44b=_0x6aa7[_0x52bf4e];return _0x32f44b;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var logger=require(_0x76aa('0x1'))(_0x76aa('0x2'));var moment=require(_0x76aa('0x3'));var BPromise=require(_0x76aa('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x76aa('0x5'));var rimraf=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var attributes=require('./pause.attributes');module['exports']=function(_0x1aceaa,_0x4d53f6){return _0x1aceaa[_0x76aa('0x8')](_0x76aa('0x9'),attributes,{'tableName':_0x76aa('0xa'),'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 1f6c7a0..390c1c2 100644 --- a/server/api/pause/pause.rpc.js +++ b/server/api/pause/pause.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['message','request\x20sent','result','catch','Pause','find','options','raw','where','attributes','map','include','model','ShowPause','lodash','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Pause,\x20%s,\x20%s','debug','stringify','error','code'];(function(_0x41dc24,_0x3132a2){var _0x2c1553=function(_0xfe307c){while(--_0xfe307c){_0x41dc24['push'](_0x41dc24['shift']());}};_0x2c1553(++_0x3132a2);}(_0x7a54,0x106));var _0x47a5=function(_0x26b8e1,_0x77c85d){_0x26b8e1=_0x26b8e1-0x0;var _0x3f3d4d=_0x7a54[_0x26b8e1];return _0x3f3d4d;};'use strict';var _=require(_0x47a5('0x0'));var util=require(_0x47a5('0x1'));var moment=require(_0x47a5('0x2'));var BPromise=require('bluebird');var rs=require(_0x47a5('0x3'));var fs=require('fs');var Redis=require(_0x47a5('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x47a5('0x5'));var logger=require(_0x47a5('0x6'))(_0x47a5('0x7'));var config=require(_0x47a5('0x8'));var jayson=require(_0x47a5('0x9'));var client=jayson['client'][_0x47a5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x59199c,_0x343372,_0x30e405){return new BPromise(function(_0x506eda,_0x194fb0){return client['request'](_0x59199c,_0x30e405)['then'](function(_0x582352){logger[_0x47a5('0xb')](_0x47a5('0xc'),_0x343372,'request\x20sent');logger[_0x47a5('0xd')]('Pause,\x20%s,\x20%s,\x20%s',_0x343372,'request\x20sent',JSON[_0x47a5('0xe')](_0x582352));if(_0x582352[_0x47a5('0xf')]){if(_0x582352[_0x47a5('0xf')][_0x47a5('0x10')]===0x1f4){logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')]['message']);return _0x194fb0(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}logger[_0x47a5('0xf')](_0x47a5('0xc'),_0x343372,_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);return _0x506eda(_0x582352[_0x47a5('0xf')][_0x47a5('0x11')]);}else{logger['info'](_0x47a5('0xc'),_0x343372,_0x47a5('0x12'));_0x506eda(_0x582352[_0x47a5('0x13')][_0x47a5('0x11')]);}})[_0x47a5('0x14')](function(_0x574af6){logger['error'](_0x47a5('0xc'),_0x343372,_0x574af6);_0x194fb0(_0x574af6);});});}exports['ShowPause']=function(_0x5247fd){var _0x423a81=this;return new Promise(function(_0xaf70a6,_0x2ce454){return db[_0x47a5('0x15')][_0x47a5('0x16')]({'raw':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')][_0x47a5('0x18')]===undefined?!![]:![]:!![],'where':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x19')]||null:null,'attributes':_0x5247fd[_0x47a5('0x17')]?_0x5247fd['options'][_0x47a5('0x1a')]||null:null,'include':_0x5247fd[_0x47a5('0x17')]?_0x5247fd[_0x47a5('0x17')]['include']?_[_0x47a5('0x1b')](_0x5247fd[_0x47a5('0x17')][_0x47a5('0x1c')],function(_0x7a9f9e){return{'model':db[_0x7a9f9e['model']],'as':_0x7a9f9e['as'],'attributes':_0x7a9f9e[_0x47a5('0x1a')],'include':_0x7a9f9e[_0x47a5('0x1c')]?_['map'](_0x7a9f9e[_0x47a5('0x1c')],function(_0xc4cd63){return{'model':db[_0xc4cd63[_0x47a5('0x1d')]],'as':_0xc4cd63['as'],'attributes':_0xc4cd63[_0x47a5('0x1a')],'include':_0xc4cd63[_0x47a5('0x1c')]?_['map'](_0xc4cd63['include'],function(_0x136745){return{'model':db[_0x136745['model']],'as':_0x136745['as'],'attributes':_0x136745[_0x47a5('0x1a')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x23cb77){logger[_0x47a5('0xb')](_0x47a5('0x1e'),_0x5247fd);logger[_0x47a5('0xd')](_0x47a5('0x1e'),_0x5247fd,JSON[_0x47a5('0xe')](_0x23cb77));_0xaf70a6(_0x23cb77);})[_0x47a5('0x14')](function(_0x136b14){logger[_0x47a5('0xf')](_0x47a5('0x1e'),_0x136b14[_0x47a5('0x11')],_0x5247fd);_0x2ce454(_0x423a81[_0x47a5('0xf')](0x1f4,_0x136b14[_0x47a5('0x11')]));});});}; \ No newline at end of file +var _0xb10b=['catch','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','Pause,\x20%s,\x20%s','Pause,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','ShowPause','Pause','find','options','raw','where','attributes','map','include','model','debug'];(function(_0x1939e4,_0x40f43f){var _0x48c1ca=function(_0x3a4c3d){while(--_0x3a4c3d){_0x1939e4['push'](_0x1939e4['shift']());}};_0x48c1ca(++_0x40f43f);}(_0xb10b,0x12a));var _0xbb10=function(_0x41f5a6,_0xb35c51){_0x41f5a6=_0x41f5a6-0x0;var _0x241efd=_0xb10b[_0x41f5a6];return _0x241efd;};'use strict';var _=require(_0xbb10('0x0'));var util=require('util');var moment=require(_0xbb10('0x1'));var BPromise=require(_0xbb10('0x2'));var rs=require(_0xbb10('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbb10('0x4'))['db'];var utils=require(_0xbb10('0x5'));var logger=require(_0xbb10('0x6'))(_0xbb10('0x7'));var config=require(_0xbb10('0x8'));var jayson=require(_0xbb10('0x9'));var client=jayson['client'][_0xbb10('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3cdd53,_0x513741,_0x1b9e94){return new BPromise(function(_0x3fb675,_0x21370f){return client[_0xbb10('0xb')](_0x3cdd53,_0x1b9e94)[_0xbb10('0xc')](function(_0x1ce33e){logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,'request\x20sent');logger['debug'](_0xbb10('0xf'),_0x513741,_0xbb10('0x10'),JSON[_0xbb10('0x11')](_0x1ce33e));if(_0x1ce33e['error']){if(_0x1ce33e[_0xbb10('0x12')]['code']===0x1f4){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x21370f(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}logger['error'](_0xbb10('0xe'),_0x513741,_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);return _0x3fb675(_0x1ce33e[_0xbb10('0x12')][_0xbb10('0x13')]);}else{logger[_0xbb10('0xd')](_0xbb10('0xe'),_0x513741,_0xbb10('0x10'));_0x3fb675(_0x1ce33e[_0xbb10('0x14')][_0xbb10('0x13')]);}})['catch'](function(_0x2eca0f){logger[_0xbb10('0x12')](_0xbb10('0xe'),_0x513741,_0x2eca0f);_0x21370f(_0x2eca0f);});});}exports[_0xbb10('0x15')]=function(_0x378da8){var _0x1682a4=this;return new Promise(function(_0x575cca,_0x30efc6){return db[_0xbb10('0x16')][_0xbb10('0x17')]({'raw':_0x378da8['options']?_0x378da8[_0xbb10('0x18')][_0xbb10('0x19')]===undefined?!![]:![]:!![],'where':_0x378da8[_0xbb10('0x18')]?_0x378da8[_0xbb10('0x18')][_0xbb10('0x1a')]||null:null,'attributes':_0x378da8[_0xbb10('0x18')]?_0x378da8['options'][_0xbb10('0x1b')]||null:null,'include':_0x378da8[_0xbb10('0x18')]?_0x378da8['options']['include']?_[_0xbb10('0x1c')](_0x378da8[_0xbb10('0x18')][_0xbb10('0x1d')],function(_0x317da4){return{'model':db[_0x317da4[_0xbb10('0x1e')]],'as':_0x317da4['as'],'attributes':_0x317da4[_0xbb10('0x1b')],'include':_0x317da4[_0xbb10('0x1d')]?_[_0xbb10('0x1c')](_0x317da4[_0xbb10('0x1d')],function(_0x395404){return{'model':db[_0x395404[_0xbb10('0x1e')]],'as':_0x395404['as'],'attributes':_0x395404[_0xbb10('0x1b')],'include':_0x395404['include']?_['map'](_0x395404['include'],function(_0xc93a04){return{'model':db[_0xc93a04[_0xbb10('0x1e')]],'as':_0xc93a04['as'],'attributes':_0xc93a04[_0xbb10('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x2fdde9){logger[_0xbb10('0xd')](_0xbb10('0x15'),_0x378da8);logger[_0xbb10('0x1f')](_0xbb10('0x15'),_0x378da8,JSON[_0xbb10('0x11')](_0x2fdde9));_0x575cca(_0x2fdde9);})[_0xbb10('0x20')](function(_0x4aabb9){logger[_0xbb10('0x12')](_0xbb10('0x15'),_0x4aabb9[_0xbb10('0x13')],_0x378da8);_0x30efc6(_0x1682a4[_0xbb10('0x12')](0x1f4,_0x4aabb9[_0xbb10('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/index.js b/server/api/plugin/index.js index 9661f66..286f2de 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 _0x4c4e=['webhookGet','/:id','/:id/download','download','diskStorage','join','root','server/files/plugins','originalname','replace','format','basename','now','extname','post','single','file','upload','webhookPost','put','update','delete','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./plugin.controller','isAuthenticated','index','get','/webhook'];(function(_0x2eaacb,_0x5c68c9){var _0x3a84dd=function(_0x4c8c7a){while(--_0x4c8c7a){_0x2eaacb['push'](_0x2eaacb['shift']());}};_0x3a84dd(++_0x5c68c9);}(_0x4c4e,0x152));var _0xe4c4=function(_0x482f87,_0x1eaacc){_0x482f87=_0x482f87-0x0;var _0x34ce77=_0x4c4e[_0x482f87];return _0x34ce77;};'use strict';var multer=require(_0xe4c4('0x0'));var util=require('util');var path=require(_0xe4c4('0x1'));var timeout=require(_0xe4c4('0x2'));var express=require(_0xe4c4('0x3'));var router=express['Router']();var fs_extra=require(_0xe4c4('0x4'));var auth=require(_0xe4c4('0x5'));var interaction=require(_0xe4c4('0x6'));var config=require('../../config/environment');var controller=require(_0xe4c4('0x7'));router['get']('/',auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x9')]);router[_0xe4c4('0xa')](_0xe4c4('0xb'),controller[_0xe4c4('0xc')]);router[_0xe4c4('0xa')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller['show']);router['get'](_0xe4c4('0xe'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0xf')]);var upload=multer({'storage':multer[_0xe4c4('0x10')]({'destination':function(_0x333c08,_0x2f4d5f,_0x50264f){_0x50264f(null,path[_0xe4c4('0x11')](config[_0xe4c4('0x12')],_0xe4c4('0x13')));},'filename':function(_0x2483d0,_0x50bfab,_0x262083){_0x50bfab[_0xe4c4('0x14')]=_0x50bfab['originalname'][_0xe4c4('0x15')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x262083(null,util[_0xe4c4('0x16')]('%s-%s%s',path[_0xe4c4('0x17')](_0x50bfab[_0xe4c4('0x14')],path['extname'](_0x50bfab[_0xe4c4('0x14')])),Date[_0xe4c4('0x18')](),path[_0xe4c4('0x19')](_0x50bfab[_0xe4c4('0x14')])));}})});router[_0xe4c4('0x1a')]('/',upload[_0xe4c4('0x1b')](_0xe4c4('0x1c')),controller[_0xe4c4('0x1d')]);router[_0xe4c4('0x1a')](_0xe4c4('0xb'),controller[_0xe4c4('0x1e')]);router[_0xe4c4('0x1f')](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x20')]);router['delete'](_0xe4c4('0xd'),auth[_0xe4c4('0x8')](),controller[_0xe4c4('0x21')]);module[_0xe4c4('0x22')]=router; \ No newline at end of file +var _0xb821=['upload','post','update','delete','exports','util','path','Router','../../components/interaction/service','../../config/environment','./plugin.controller','get','index','/webhook','webhookGet','/:id','isAuthenticated','show','download','diskStorage','join','root','originalname','replace','basename','extname','single'];(function(_0x3df1c1,_0x26e6ee){var _0xdf592=function(_0x20c281){while(--_0x20c281){_0x3df1c1['push'](_0x3df1c1['shift']());}};_0xdf592(++_0x26e6ee);}(_0xb821,0xa7));var _0x1b82=function(_0xfd75c7,_0x4b6dd2){_0xfd75c7=_0xfd75c7-0x0;var _0x2b106e=_0xb821[_0xfd75c7];return _0x2b106e;};'use strict';var multer=require('multer');var util=require(_0x1b82('0x0'));var path=require(_0x1b82('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x1b82('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x1b82('0x3'));var config=require(_0x1b82('0x4'));var controller=require(_0x1b82('0x5'));router[_0x1b82('0x6')]('/',auth['isAuthenticated'](),controller[_0x1b82('0x7')]);router[_0x1b82('0x6')](_0x1b82('0x8'),controller[_0x1b82('0x9')]);router[_0x1b82('0x6')](_0x1b82('0xa'),auth[_0x1b82('0xb')](),controller[_0x1b82('0xc')]);router[_0x1b82('0x6')]('/:id/download',auth[_0x1b82('0xb')](),controller[_0x1b82('0xd')]);var upload=multer({'storage':multer[_0x1b82('0xe')]({'destination':function(_0x14c57a,_0xcffb87,_0x17a96b){_0x17a96b(null,path[_0x1b82('0xf')](config[_0x1b82('0x10')],'server/files/plugins'));},'filename':function(_0x46007e,_0x241d11,_0x2391f5){_0x241d11[_0x1b82('0x11')]=_0x241d11['originalname'][_0x1b82('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x2391f5(null,util['format']('%s-%s%s',path[_0x1b82('0x13')](_0x241d11['originalname'],path[_0x1b82('0x14')](_0x241d11[_0x1b82('0x11')])),Date['now'](),path[_0x1b82('0x14')](_0x241d11['originalname'])));}})});router['post']('/',upload[_0x1b82('0x15')]('file'),controller[_0x1b82('0x16')]);router[_0x1b82('0x17')](_0x1b82('0x8'),controller['webhookPost']);router['put'](_0x1b82('0xa'),auth['isAuthenticated'](),controller[_0x1b82('0x18')]);router[_0x1b82('0x19')](_0x1b82('0xa'),auth['isAuthenticated'](),controller[_0x1b82('0x19')]);module[_0x1b82('0x1a')]=router; \ No newline at end of file diff --git a/server/api/plugin/plugin.attributes.js b/server/api/plugin/plugin.attributes.js index b13feab..4f0cfe9 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 _0x8473=['exports','STRING','ENUM','html','script','TEXT','BOOLEAN','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','always','never','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x549b6e,_0x215925){var _0x499ff1=function(_0x2acb3b){while(--_0x2acb3b){_0x549b6e['push'](_0x549b6e['shift']());}};_0x499ff1(++_0x215925);}(_0x8473,0xcc));var _0x3847=function(_0x3668c6,_0x148226){_0x3668c6=_0x3668c6-0x0;var _0x3c60ef=_0x8473[_0x3668c6];return _0x3c60ef;};'use strict';var Sequelize=require('sequelize');module[_0x3847('0x0')]={'name':{'type':Sequelize[_0x3847('0x1')]},'type':{'type':Sequelize[_0x3847('0x2')](_0x3847('0x3'),_0x3847('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize[_0x3847('0x5')]},'path':{'type':Sequelize[_0x3847('0x1')],'comment':'The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.'},'active':{'type':Sequelize[_0x3847('0x6')],'defaultValue':0x0,'comment':_0x3847('0x7')},'sidebar':{'type':Sequelize[_0x3847('0x2')](_0x3847('0x8'),'agentOnly',_0x3847('0x9'),_0x3847('0xa')),'defaultValue':_0x3847('0x9'),'comment':_0x3847('0xb')},'icon':{'type':Sequelize[_0x3847('0x1')]},'adminUrl':{'type':Sequelize[_0x3847('0x1')]},'agentUrl':{'type':Sequelize[_0x3847('0x1')]},'scriptName':{'type':Sequelize[_0x3847('0x1')]},'scriptPath':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x6dc9=['sequelize','exports','ENUM','html','script','STRING','The\x20physical\x20path\x20where\x20the\x20plugin\x20is\x20stored.','Indicates\x20whether\x20the\x20plugin\x20is\x20installed.\x20Updated\x20when\x20the\x20plugin\x20is\x20installed/uninstalled.','adminOnly','agentOnly','always','Indicates\x20whether\x20to\x20display\x20the\x20plugin\x20in\x20the\x20sidebar.'];(function(_0x120376,_0x571898){var _0x28c529=function(_0x4f130c){while(--_0x4f130c){_0x120376['push'](_0x120376['shift']());}};_0x28c529(++_0x571898);}(_0x6dc9,0x1ec));var _0x96dc=function(_0x3bb968,_0xd3f6b0){_0x3bb968=_0x3bb968-0x0;var _0x49b09f=_0x6dc9[_0x3bb968];return _0x49b09f;};'use strict';var Sequelize=require(_0x96dc('0x0'));module[_0x96dc('0x1')]={'name':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x96dc('0x2')](_0x96dc('0x3'),_0x96dc('0x4'))},'description':{'type':Sequelize['TEXT']},'version':{'type':Sequelize['TEXT']},'path':{'type':Sequelize[_0x96dc('0x5')],'comment':_0x96dc('0x6')},'active':{'type':Sequelize['BOOLEAN'],'defaultValue':0x0,'comment':_0x96dc('0x7')},'sidebar':{'type':Sequelize['ENUM'](_0x96dc('0x8'),_0x96dc('0x9'),_0x96dc('0xa'),'never'),'defaultValue':_0x96dc('0xa'),'comment':_0x96dc('0xb')},'icon':{'type':Sequelize[_0x96dc('0x5')]},'adminUrl':{'type':Sequelize[_0x96dc('0x5')]},'agentUrl':{'type':Sequelize['STRING']},'scriptName':{'type':Sequelize['STRING']},'scriptPath':{'type':Sequelize[_0x96dc('0x5')]}}; \ No newline at end of file diff --git a/server/api/plugin/plugin.controller.js b/server/api/plugin/plugin.controller.js index dc08f74..2c41fd4 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 _0x7cd7=['../../config/utils','../../config/license/util','redis','defaults','socket.io-emitter','./plugin.socket','register','sendStatus','status','end','json','offset','limit','undefined','count','set','Content-Range','apply','save','then','destroy','get','error','stack','name','map','Plugin','fieldName','type','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','params','rawAttributes','find','download','join','root','format','%s.zip','createWriteStream','zip','warning','code','ENOENT','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','**/*','server/files/plugins','dirname','basename','attachments/**/*','Sequelize','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','upload','extname','file','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','readdirSync','Invalid\x20plugin\x20structure','isFile','isDirectory','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20name\x20missing','Invalid\x20manifest:\x20type\x20missing','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','script','Invalid\x20manifest:\x20script\x20name\x20missing','scriptPath','Invalid\x20manifest:\x20invalid\x20type','sidebar','always','icon','icon-apps','plugins','agent','test','Warning:\x20agent\x20view\x20not\x20specified','scriptName','create','body','userProfileId','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','send','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','hostname','port','http://localhost:','method','%s%s','headers','content-length','content-type','endsWith','statusCode','webhookPost','encoding','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','extract-zip','ioredis','../../components/auth/service','../../config/logger','api'];(function(_0x4ef15e,_0x4fab49){var _0x52e558=function(_0x27f061){while(--_0x27f061){_0x4ef15e['push'](_0x4ef15e['shift']());}};_0x52e558(++_0x4fab49);}(_0x7cd7,0x130));var _0x77cd=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7cd7[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x77cd('0x0'));var rimraf=require(_0x77cd('0x1'));var zipdir=require(_0x77cd('0x2'));var jsonpatch=require(_0x77cd('0x3'));var rp=require(_0x77cd('0x4'));var moment=require(_0x77cd('0x5'));var BPromise=require(_0x77cd('0x6'));var Mustache=require(_0x77cd('0x7'));var util=require('util');var path=require(_0x77cd('0x8'));var sox=require(_0x77cd('0x9'));var csv=require(_0x77cd('0xa'));var ejs=require(_0x77cd('0xb'));var fs=require('fs');var fs_extra=require(_0x77cd('0xc'));var _=require(_0x77cd('0xd'));var squel=require(_0x77cd('0xe'));var crypto=require('crypto');var jsforce=require(_0x77cd('0xf'));var deskjs=require(_0x77cd('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var extract=require(_0x77cd('0x11'));var rimraf=require(_0x77cd('0x1'));var archiver=require('archiver');var Redis=require(_0x77cd('0x12'));var authService=require(_0x77cd('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x77cd('0x14'))(_0x77cd('0x15'));var utils=require(_0x77cd('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x77cd('0x17'));var db=require('../../mysqldb')['db'];config[_0x77cd('0x18')]=_[_0x77cd('0x19')](config[_0x77cd('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x77cd('0x1a'))(new Redis(config['redis']));require(_0x77cd('0x1b'))[_0x77cd('0x1c')](socket);function respondWithStatusCode(_0x2417f6,_0x4918e9){_0x4918e9=_0x4918e9||0xcc;return function(_0x59d819){if(_0x59d819){return _0x2417f6[_0x77cd('0x1d')](_0x4918e9);}return _0x2417f6[_0x77cd('0x1e')](_0x4918e9)[_0x77cd('0x1f')]();};}function respondWithResult(_0x49de86,_0x406df8){_0x406df8=_0x406df8||0xc8;return function(_0x3eaf33){if(_0x3eaf33){return _0x49de86['status'](_0x406df8)[_0x77cd('0x20')](_0x3eaf33);}};}function respondWithFilteredResult(_0x478dd0,_0x41607b){return function(_0x27bde9){if(_0x27bde9){var _0x5cbe4c=typeof _0x41607b[_0x77cd('0x21')]==='undefined'&&typeof _0x41607b[_0x77cd('0x22')]===_0x77cd('0x23');var _0x311569=_0x27bde9['count'];var _0x2cef0f=_0x5cbe4c?0x0:_0x41607b[_0x77cd('0x21')];var _0x385618=_0x5cbe4c?_0x27bde9[_0x77cd('0x24')]:_0x41607b[_0x77cd('0x21')]+_0x41607b['limit'];var _0x2ec4b4;if(_0x385618>=_0x311569){_0x385618=_0x311569;_0x2ec4b4=0xc8;}else{_0x2ec4b4=0xce;}_0x478dd0[_0x77cd('0x1e')](_0x2ec4b4);return _0x478dd0[_0x77cd('0x25')](_0x77cd('0x26'),_0x2cef0f+'-'+_0x385618+'/'+_0x311569)[_0x77cd('0x20')](_0x27bde9);}return null;};}function patchUpdates(_0x386e19){return function(_0x40a920){try{jsonpatch[_0x77cd('0x27')](_0x40a920,_0x386e19,!![]);}catch(_0x3c5dcb){return BPromise['reject'](_0x3c5dcb);}return _0x40a920[_0x77cd('0x28')]();};}function saveUpdates(_0x199d9a,_0x44c303){return function(_0x21040c){if(_0x21040c){return _0x21040c['update'](_0x199d9a)[_0x77cd('0x29')](function(_0xf4d0bf){return _0xf4d0bf;});}return null;};}function removeEntity(_0x1c28a9,_0xf45ade){return function(_0x3e011c){if(_0x3e011c){return _0x3e011c[_0x77cd('0x2a')]()[_0x77cd('0x29')](function(){var _0x11bf7f=_0x3e011c[_0x77cd('0x2b')]({'plain':!![]});var _0x1866fd='Plugins';return db['UserProfileResource'][_0x77cd('0x2a')]({'where':{'type':_0x1866fd,'resourceId':_0x11bf7f['id']}})['then'](function(){return _0x3e011c;});})[_0x77cd('0x29')](function(){_0x1c28a9[_0x77cd('0x1e')](0xcc)[_0x77cd('0x1f')]();});}};}function handleEntityNotFound(_0x3952dc,_0x197feb){return function(_0x28bd40){if(!_0x28bd40){_0x3952dc['sendStatus'](0x194);}return _0x28bd40;};}function handleError(_0x5d1173,_0x297b1c){_0x297b1c=_0x297b1c||0x1f4;return function(_0x1c56c7){logger[_0x77cd('0x2c')](_0x1c56c7[_0x77cd('0x2d')]);if(_0x1c56c7[_0x77cd('0x2e')]){delete _0x1c56c7[_0x77cd('0x2e')];}_0x5d1173[_0x77cd('0x1e')](_0x297b1c)['send'](_0x1c56c7);};}exports['index']=function(_0x4bdd91,_0x1bc672){var _0x39fa33={},_0x2b7583={},_0x17fe49={'count':0x0,'rows':[]};var _0x1c31f3=_[_0x77cd('0x2f')](db[_0x77cd('0x30')]['rawAttributes'],function(_0x43e210){return{'name':_0x43e210[_0x77cd('0x31')],'type':_0x43e210[_0x77cd('0x32')]['key']};});_0x2b7583[_0x77cd('0x33')]=_[_0x77cd('0x2f')](_0x1c31f3,_0x77cd('0x2e'));_0x2b7583[_0x77cd('0x34')]=_[_0x77cd('0x35')](_0x4bdd91[_0x77cd('0x34')]);_0x2b7583['filters']=_[_0x77cd('0x36')](_0x2b7583[_0x77cd('0x33')],_0x2b7583[_0x77cd('0x34')]);_0x39fa33[_0x77cd('0x37')]=_[_0x77cd('0x36')](_0x2b7583['model'],qs[_0x77cd('0x38')](_0x4bdd91[_0x77cd('0x34')][_0x77cd('0x38')]));_0x39fa33[_0x77cd('0x37')]=_0x39fa33[_0x77cd('0x37')][_0x77cd('0x39')]?_0x39fa33[_0x77cd('0x37')]:_0x2b7583[_0x77cd('0x33')];if(!_0x4bdd91[_0x77cd('0x34')][_0x77cd('0x3a')](_0x77cd('0x3b'))){_0x39fa33[_0x77cd('0x22')]=qs['limit'](_0x4bdd91[_0x77cd('0x34')]['limit']);_0x39fa33['offset']=qs[_0x77cd('0x21')](_0x4bdd91['query']['offset']);}_0x39fa33[_0x77cd('0x3c')]=qs[_0x77cd('0x3d')](_0x4bdd91[_0x77cd('0x34')]['sort']);_0x39fa33[_0x77cd('0x3e')]=qs[_0x77cd('0x3f')](_[_0x77cd('0x40')](_0x4bdd91[_0x77cd('0x34')],_0x2b7583[_0x77cd('0x3f')]),_0x1c31f3);if(_0x4bdd91[_0x77cd('0x34')][_0x77cd('0x41')]){_0x39fa33['where']=_[_0x77cd('0x42')](_0x39fa33[_0x77cd('0x3e')],{'$or':_[_0x77cd('0x2f')](_0x1c31f3,function(_0x15f931){if(_0x15f931['type']!==_0x77cd('0x43')){var _0x2aec96={};_0x2aec96[_0x15f931[_0x77cd('0x2e')]]={'$like':'%'+_0x4bdd91[_0x77cd('0x34')]['filter']+'%'};return _0x2aec96;}})});}_0x39fa33=_[_0x77cd('0x42')]({},_0x39fa33,_0x4bdd91[_0x77cd('0x44')]);var _0x5a0bc8={'where':_0x39fa33[_0x77cd('0x3e')]};return db[_0x77cd('0x30')][_0x77cd('0x24')](_0x5a0bc8)['then'](function(_0x4c68ba){_0x17fe49['count']=_0x4c68ba;if(_0x4bdd91[_0x77cd('0x34')][_0x77cd('0x45')]){_0x39fa33[_0x77cd('0x46')]=[{'all':!![]}];}return db['Plugin'][_0x77cd('0x47')](_0x39fa33);})[_0x77cd('0x29')](function(_0x11d076){_0x17fe49[_0x77cd('0x48')]=_0x11d076;return _0x17fe49;})[_0x77cd('0x29')](respondWithFilteredResult(_0x1bc672,_0x39fa33))[_0x77cd('0x49')](handleError(_0x1bc672,null));};exports['show']=function(_0x2c23d3,_0x176780){var _0x275e0a={'raw':!![],'where':{'id':_0x2c23d3[_0x77cd('0x4a')]['id']}},_0x5d16d7={};_0x5d16d7[_0x77cd('0x33')]=_[_0x77cd('0x35')](db['Plugin'][_0x77cd('0x4b')]);_0x5d16d7[_0x77cd('0x34')]=_['keys'](_0x2c23d3[_0x77cd('0x34')]);_0x5d16d7[_0x77cd('0x3f')]=_[_0x77cd('0x36')](_0x5d16d7[_0x77cd('0x33')],_0x5d16d7[_0x77cd('0x34')]);_0x275e0a[_0x77cd('0x37')]=_['intersection'](_0x5d16d7[_0x77cd('0x33')],qs['fields'](_0x2c23d3[_0x77cd('0x34')][_0x77cd('0x38')]));_0x275e0a['attributes']=_0x275e0a[_0x77cd('0x37')][_0x77cd('0x39')]?_0x275e0a[_0x77cd('0x37')]:_0x5d16d7['model'];if(_0x2c23d3['query'][_0x77cd('0x45')]){_0x275e0a[_0x77cd('0x46')]=[{'all':!![]}];}_0x275e0a=_['merge']({},_0x275e0a,_0x2c23d3[_0x77cd('0x44')]);return db[_0x77cd('0x30')][_0x77cd('0x4c')](_0x275e0a)[_0x77cd('0x29')](handleEntityNotFound(_0x176780,null))[_0x77cd('0x29')](respondWithResult(_0x176780,null))[_0x77cd('0x49')](handleError(_0x176780,null));};exports[_0x77cd('0x4d')]=function(_0x3a35f4,_0x4fa222,_0x42db4d){return db[_0x77cd('0x30')][_0x77cd('0x4c')]({'where':{'id':_0x3a35f4[_0x77cd('0x4a')]['id']},'attributes':[_0x77cd('0x2e'),_0x77cd('0x8')],'raw':!![]})[_0x77cd('0x29')](handleEntityNotFound(_0x4fa222,null))[_0x77cd('0x29')](function(_0x3a8238){if(_0x3a8238){var _0x5a8eea=path[_0x77cd('0x4e')](config[_0x77cd('0x4f')],'server/files/plugins',util[_0x77cd('0x50')](_0x77cd('0x51'),path['basename'](_0x3a8238[_0x77cd('0x8')])));var _0xeaa165=fs[_0x77cd('0x52')](_0x5a8eea);var _0x2627cc=archiver(_0x77cd('0x53'),{'zlib':{'level':0x9}});_0x2627cc['on'](_0x77cd('0x54'),function(_0x9f402e){if(_0x9f402e[_0x77cd('0x55')]===_0x77cd('0x56')){logger[_0x77cd('0x2c')](_0x9f402e);}else{throw new db['Sequelize'][(_0x77cd('0x57'))](_0x77cd('0x58'));}});_0x2627cc['on'](_0x77cd('0x2c'),function(_0x28a0b6){throw new db['Sequelize'][(_0x77cd('0x57'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');});_0x2627cc[_0x77cd('0x59')](_0xeaa165);_0x2627cc['glob'](_0x77cd('0x5a'),{'cwd':path['join'](config[_0x77cd('0x4f')],_0x77cd('0x5b'),path[_0x77cd('0x5c')](_0x3a8238[_0x77cd('0x8')])),'ignore':[path[_0x77cd('0x4e')](path[_0x77cd('0x5d')](_0x3a8238[_0x77cd('0x8')]),'node_modules/**/*'),path[_0x77cd('0x4e')](path[_0x77cd('0x5d')](_0x3a8238[_0x77cd('0x8')]),_0x77cd('0x5e'))],'nodir':!![]})['finalize']();_0xeaa165['on']('close',function(){if(!fs['existsSync'](_0x5a8eea)){throw new db[(_0x77cd('0x5f'))][(_0x77cd('0x57'))]('Plugin\x20not\x20found');}return _0x4fa222[_0x77cd('0x4d')](_0x5a8eea,util['format'](_0x77cd('0x51'),path[_0x77cd('0x5d')](_0x3a8238['path'])),function(_0x455811){if(_0x455811){throw new db[(_0x77cd('0x5f'))]['Error'](_0x77cd('0x60'));}fs[_0x77cd('0x61')](_0x5a8eea);logger[_0x77cd('0x62')]('Download\x20completed');logger['info']('Temporary\x20file\x20removed');});});}return null;})[_0x77cd('0x49')](handleError(_0x4fa222,null));};exports[_0x77cd('0x63')]=function(_0x3cbbc4,_0x8bd8,_0x590769){var _0x4c2719=path[_0x77cd('0x5d')](_0x3cbbc4['file']['filename'],path[_0x77cd('0x64')](_0x3cbbc4[_0x77cd('0x65')]['filename']));var _0x3edcea=path[_0x77cd('0x4e')](config[_0x77cd('0x4f')],_0x77cd('0x5b'),_0x3cbbc4[_0x77cd('0x65')]['filename']);var _0x16b37a=path[_0x77cd('0x4e')](config[_0x77cd('0x4f')],_0x77cd('0x5b'),_0x4c2719);logger[_0x77cd('0x62')](_0x77cd('0x66'),_0x3edcea);logger[_0x77cd('0x62')](_0x77cd('0x67'),_0x16b37a);try{fs[_0x77cd('0x68')](_0x3edcea,parseInt(_0x77cd('0x69'),0x8));extract(_0x3edcea,{'dir':_0x16b37a},function(_0x293e33){if(_0x293e33){logger[_0x77cd('0x2c')](_0x293e33);handleError(_0x293e33,!![]);};var _0x158bca=fs[_0x77cd('0x6a')](_0x16b37a);if(_0x158bca['length']>0x1){removeReferences(_0x3edcea,_0x16b37a);logger[_0x77cd('0x2c')](_0x77cd('0x6b'));return _0x590769(new Error('Invalid\x20plugin\x20structure'));}var _0x37d493=fs['lstatSync'](path[_0x77cd('0x4e')](_0x16b37a,_0x158bca[0x0]));if(_0x37d493[_0x77cd('0x6c')]()){removeReferences(_0x3edcea,_0x16b37a);logger[_0x77cd('0x2c')]('Invalid\x20plugin\x20structure');return _0x590769(new Error(_0x77cd('0x6b')));}if(_0x37d493[_0x77cd('0x6d')]()){var _0x3e40af=fs[_0x77cd('0x6a')](path[_0x77cd('0x4e')](_0x16b37a,_0x158bca[0x0]));if(_0x3e40af[_0x77cd('0x39')]===0x0){removeReferences(_0x3edcea,_0x16b37a);logger['error'](_0x77cd('0x6b'));return _0x590769(new Error(_0x77cd('0x6b')));}var _0x3eb1d7=_0x3e40af[_0x77cd('0x6e')](function(_0x1a82e3){return _0x1a82e3===_0x77cd('0x6f');});if(!_0x3eb1d7){return _0x590769(new Error(_0x77cd('0x70')));}var _0x4b592a=fs[_0x77cd('0x71')](path['join'](_0x16b37a,_0x158bca[0x0],_0x77cd('0x6f')));var _0x1e19e6=JSON[_0x77cd('0x72')](_0x4b592a);if('undefined'==typeof _0x1e19e6[_0x77cd('0x2e')]){return _0x590769(new Error(_0x77cd('0x73')));}if('undefined'==typeof _0x1e19e6['type']){return _0x590769(new Error(_0x77cd('0x74')));}if(_0x77cd('0x23')==typeof _0x1e19e6['version']){return _0x590769(new Error(_0x77cd('0x75')));}if(_0x77cd('0x23')==typeof _0x1e19e6[_0x77cd('0x76')]){return _0x590769(new Error(_0x77cd('0x77')));}if(_0x1e19e6[_0x77cd('0x32')]===_0x77cd('0x78')){if(_0x77cd('0x23')==typeof _0x1e19e6[_0x77cd('0x76')][_0x77cd('0x79')]){return _0x590769(new Error(_0x77cd('0x7a')));}if('undefined'==typeof _0x1e19e6['parameters'][_0x77cd('0x79')][_0x77cd('0x7b')]&&'undefined'==typeof _0x1e19e6[_0x77cd('0x76')][_0x77cd('0x79')]['agent']){return _0x590769(new Error('Invalid\x20manifest:\x20no\x20view\x20specified'));}}else if(_0x1e19e6['type']===_0x77cd('0x7c')){if(_0x77cd('0x23')==typeof _0x1e19e6['parameters']['scriptName']){return _0x590769(new Error(_0x77cd('0x7d')));}if(_0x77cd('0x23')==typeof _0x1e19e6[_0x77cd('0x76')][_0x77cd('0x7e')]){return _0x590769(new Error('Invalid\x20manifest:\x20script\x20path\x20missing'));}}else{return _0x590769(new Error(_0x77cd('0x7f')));}var _0x40cd75=_0x1e19e6[_0x77cd('0x2e')];var _0x4cfaed=_0x1e19e6['description'];var _0x181e85=_0x1e19e6[_0x77cd('0x32')];var _0x489bf0=_0x1e19e6['sidebar']?_0x1e19e6[_0x77cd('0x80')]:_0x77cd('0x81');var _0x4046a6=_0x1e19e6['icon']?_0x1e19e6[_0x77cd('0x82')]:_0x77cd('0x83');var _0x26bfb5='';var _0x10cc1b='';var _0x6fdf73='';var _0x5e441e='';var _0x508a30=_0x1e19e6['version'];if(_0x181e85===_0x77cd('0x78')){if('undefined'!=typeof _0x1e19e6[_0x77cd('0x76')][_0x77cd('0x79')]['admin']){var _0x3b09fa=_0x1e19e6['parameters'][_0x77cd('0x79')][_0x77cd('0x7b')];if(!/^(f|ht)tps?:\/\//i['test'](_0x3b09fa)){_0x26bfb5=path[_0x77cd('0x4e')](_0x77cd('0x84'),_0x4c2719,_0x158bca[0x0],_0x3b09fa);}else{_0x26bfb5=_0x3b09fa;}}else{logger['info']('Warning:\x20admin\x20view\x20not\x20specified');}if('undefined'!=typeof _0x1e19e6['parameters'][_0x77cd('0x79')][_0x77cd('0x85')]){var _0x1f578a=_0x1e19e6[_0x77cd('0x76')]['views'][_0x77cd('0x85')];if(!/^(f|ht)tps?:\/\//i[_0x77cd('0x86')](_0x1f578a)){_0x10cc1b=path[_0x77cd('0x4e')]('plugins',_0x4c2719,_0x158bca[0x0],_0x1f578a);}else{_0x10cc1b=_0x1f578a;}}else{logger['info'](_0x77cd('0x87'));}}else if(_0x181e85===_0x77cd('0x7c')){_0x6fdf73=_0x1e19e6['parameters'][_0x77cd('0x88')];_0x5e441e=_0x1e19e6['parameters'][_0x77cd('0x7e')];if(_0x77cd('0x23')!=typeof _0x1e19e6[_0x77cd('0x76')][_0x77cd('0x79')]){if(_0x77cd('0x23')!=typeof _0x1e19e6[_0x77cd('0x76')][_0x77cd('0x79')][_0x77cd('0x7b')]){var _0x3b09fa=_0x1e19e6[_0x77cd('0x76')][_0x77cd('0x79')][_0x77cd('0x7b')];if(!/^(f|ht)tps?:\/\//i[_0x77cd('0x86')](_0x3b09fa)){_0x26bfb5=path['join'](_0x77cd('0x84'),_0x4c2719,_0x158bca[0x0],_0x3b09fa);}else{_0x26bfb5=_0x3b09fa;}}if(_0x77cd('0x23')!=typeof _0x1e19e6['parameters'][_0x77cd('0x79')][_0x77cd('0x85')]){var _0x1f578a=_0x1e19e6['parameters'][_0x77cd('0x79')][_0x77cd('0x85')];if(!/^(f|ht)tps?:\/\//i['test'](_0x1f578a)){_0x10cc1b=path[_0x77cd('0x4e')](_0x77cd('0x84'),_0x4c2719,_0x158bca[0x0],_0x1f578a);}else{_0x10cc1b=_0x1f578a;}}}}var _0x5a055d={'name':_0x40cd75,'description':_0x4cfaed,'path':path[_0x77cd('0x4e')](_0x4c2719,_0x158bca[0x0]),'type':_0x181e85,'sidebar':_0x489bf0,'icon':_0x4046a6,'adminUrl':_0x26bfb5,'agentUrl':_0x10cc1b,'scriptName':_0x6fdf73,'scriptPath':_0x5e441e,'version':_0x508a30};removeReferences(_0x3edcea,null);return db['Plugin'][_0x77cd('0x89')](_0x5a055d)[_0x77cd('0x29')](function(_0x1afd16){var _0x5cc284={'role':_0x3cbbc4['body']['role'],'userProfileId':_0x3cbbc4[_0x77cd('0x8a')][_0x77cd('0x8b')]};if(!_0x5cc284)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5cc284['role']===_0x77cd('0x8c')){var _0x4c4b4d=_0x1afd16[_0x77cd('0x2b')]({'plain':!![]});return db[_0x77cd('0x8d')][_0x77cd('0x4c')]({'where':{'name':'Plugins','userProfileId':_0x5cc284[_0x77cd('0x8b')]},'raw':!![]})[_0x77cd('0x29')](function(_0x513263){if(_0x513263&&_0x513263[_0x77cd('0x8e')]===0x0){return db['UserProfileResource'][_0x77cd('0x89')]({'name':_0x4c4b4d[_0x77cd('0x2e')],'resourceId':_0x4c4b4d['id'],'type':_0x513263[_0x77cd('0x2e')],'sectionId':_0x513263['id']},{})[_0x77cd('0x29')](function(){return _0x1afd16;});}else{return _0x1afd16;}})[_0x77cd('0x49')](function(_0x19b599){logger[_0x77cd('0x2c')](_0x77cd('0x8f'),_0x19b599);throw _0x19b599;});}return _0x1afd16;})[_0x77cd('0x29')](respondWithResult(_0x8bd8,null))['catch'](handleError(_0x8bd8,null));}});}catch(_0x5e0b44){_0x8bd8[_0x77cd('0x1e')](0x1f4)[_0x77cd('0x90')](_0x5e0b44);}};function removeReferences(_0x4fbb0a,_0x5383dc){try{if(_0x4fbb0a){fs[_0x77cd('0x61')](_0x4fbb0a);logger[_0x77cd('0x62')](_0x77cd('0x91'));}if(_0x5383dc){rimraf(_0x5383dc,function(){});logger[_0x77cd('0x62')](_0x77cd('0x92'));}}catch(_0x1983b4){logger['error'](_0x1983b4);}}exports['update']=function(_0x1a3df7,_0x44ad75,_0x4d24df){return db['Plugin'][_0x77cd('0x4c')]({'where':{'id':_0x1a3df7[_0x77cd('0x4a')]['id']}})[_0x77cd('0x29')](handleEntityNotFound(_0x44ad75,null))[_0x77cd('0x29')](saveUpdates(_0x1a3df7[_0x77cd('0x8a')],null))[_0x77cd('0x29')](respondWithResult(_0x44ad75,null))[_0x77cd('0x49')](handleError(_0x44ad75,null));};exports[_0x77cd('0x93')]=function(_0x5573d9,_0x2f46c9,_0x59878b){return db[_0x77cd('0x30')][_0x77cd('0x4c')]({'where':{'id':_0x5573d9[_0x77cd('0x4a')]['id']}})[_0x77cd('0x29')](function(_0x373792){if(_0x373792){return _0x373792[_0x77cd('0x2a')]();}})[_0x77cd('0x29')](function(_0x5b32d7){rimraf(path['join'](config['root'],_0x77cd('0x5b'),path['dirname'](_0x5b32d7[_0x77cd('0x8')])),function(){});return _0x5b32d7;})[_0x77cd('0x29')](handleEntityNotFound(_0x2f46c9,null))[_0x77cd('0x29')](respondWithStatusCode(_0x2f46c9,null))[_0x77cd('0x49')](handleError(_0x2f46c9,null));};exports[_0x77cd('0x94')]=function(_0xaf48a2,_0x560865,_0x28ec13){return BPromise[_0x77cd('0x95')]()[_0x77cd('0x29')](function(){if(!_0xaf48a2[_0x77cd('0x34')][_0x77cd('0x8')]){throw new Error(_0x77cd('0x96'));}if(!_0xaf48a2[_0x77cd('0x34')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x91f5c9=_0xaf48a2[_0x77cd('0x34')]['hostname']?_0xaf48a2[_0x77cd('0x34')][_0x77cd('0x97')]+':'+_0xaf48a2[_0x77cd('0x34')][_0x77cd('0x98')]:_0x77cd('0x99')+_0xaf48a2[_0x77cd('0x34')][_0x77cd('0x98')];var _0xbb9c23=_0xaf48a2[_0x77cd('0x34')][_0x77cd('0x20')]?_0xaf48a2[_0x77cd('0x34')][_0x77cd('0x20')]:!![];var _0x4bda09=_0xaf48a2[_0x77cd('0x34')]['encoding']?_0xaf48a2[_0x77cd('0x34')]['encoding']:null;var _0x3a7e4e={'method':_0xaf48a2[_0x77cd('0x9a')],'uri':util['format'](_0x77cd('0x9b'),_0x91f5c9,_0xaf48a2['query'][_0x77cd('0x8')]),'json':_0xbb9c23,'resolveWithFullResponse':!![],'encoding':_0x4bda09,'qs':_0xaf48a2[_0x77cd('0x34')]};if(_0xaf48a2['headers']){_0x3a7e4e[_0x77cd('0x9c')]=_0xaf48a2[_0x77cd('0x9c')];if(_0x3a7e4e['headers'][_0x77cd('0x9d')]){delete _0x3a7e4e[_0x77cd('0x9c')]['content-length'];}}if(_0x3a7e4e[_0x77cd('0x9c')][_0x77cd('0x9e')]){delete _0x3a7e4e[_0x77cd('0x9c')][_0x77cd('0x9e')];}return rp(_0x3a7e4e);})[_0x77cd('0x29')](function(_0xb2e20d){if(_0xb2e20d){_0x560865[_0x77cd('0x25')](_0xb2e20d[_0x77cd('0x9c')]);logger[_0x77cd('0x62')](_0xb2e20d[_0x77cd('0x8a')]);if(_[_0x77cd('0x9f')](_0xaf48a2[_0x77cd('0x34')][_0x77cd('0x8')],_0x77cd('0x4d'))&&_0xb2e20d[_0x77cd('0xa0')]==0x1f4){return _0x560865[_0x77cd('0x1d')](_0xb2e20d[_0x77cd('0xa0')]);}else{return _0x560865[_0x77cd('0x1e')](_0xb2e20d[_0x77cd('0xa0')])[_0x77cd('0x90')](_0xb2e20d[_0x77cd('0x8a')]);}}else{return _0x560865[_0x77cd('0x1d')](0xc8);}})[_0x77cd('0x49')](handleError(_0x560865,null));};exports[_0x77cd('0xa1')]=function(_0x23ae10,_0x3fb571,_0x1894f4){return BPromise[_0x77cd('0x95')]()[_0x77cd('0x29')](function(){if(!_0x23ae10['query'][_0x77cd('0x8')]){throw new Error(_0x77cd('0x96'));}if(!_0x23ae10[_0x77cd('0x34')]['port']){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x5d7531=_0x23ae10[_0x77cd('0x34')][_0x77cd('0x97')]?_0x23ae10['query']['hostname']+':'+_0x23ae10[_0x77cd('0x34')][_0x77cd('0x98')]:'http://localhost:'+_0x23ae10[_0x77cd('0x34')][_0x77cd('0x98')];var _0xd0f101=_0x23ae10[_0x77cd('0x34')]['json']?_0x23ae10[_0x77cd('0x34')][_0x77cd('0x20')]:!![];var _0x4f7a17=_0x23ae10[_0x77cd('0x34')]['encoding']?_0x23ae10['query'][_0x77cd('0xa2')]:null;var _0x2eb15b={'method':_0x23ae10['method'],'uri':util[_0x77cd('0x50')]('%s%s',_0x5d7531,_0x23ae10[_0x77cd('0x34')][_0x77cd('0x8')]),'json':_0xd0f101,'resolveWithFullResponse':!![],'encoding':_0x4f7a17,'body':_0x23ae10[_0x77cd('0x8a')]};if(_0x23ae10['headers']){_0x2eb15b[_0x77cd('0x9c')]=_0x23ae10[_0x77cd('0x9c')];if(_0x2eb15b[_0x77cd('0x9c')][_0x77cd('0x9d')]){delete _0x2eb15b[_0x77cd('0x9c')]['content-length'];}}if(_0x2eb15b[_0x77cd('0x9c')][_0x77cd('0x9e')]){delete _0x2eb15b[_0x77cd('0x9c')][_0x77cd('0x9e')];}return rp(_0x2eb15b);})['then'](function(_0x17cb9d){if(_0x17cb9d){_0x3fb571['set'](_0x17cb9d['headers']);logger['info'](_0x17cb9d[_0x77cd('0x8a')]);return _0x3fb571[_0x77cd('0x1e')](_0x17cb9d[_0x77cd('0xa0')])[_0x77cd('0x90')](_0x17cb9d[_0x77cd('0x8a')]);}else{return _0x3fb571['sendStatus'](0xc8);}})[_0x77cd('0x49')](handleError(_0x3fb571,null));}; \ No newline at end of file +var _0xe70a=['Sequelize','Error','Error\x20while\x20generating\x20the\x20zip\x20archive','pipe','glob','**/*','dirname','attachments/**/*','finalize','close','existsSync','Plugin\x20not\x20found','%s.zip','Error\x20while\x20downloading\x20the\x20plugin','unlinkSync','info','Download\x20completed','Temporary\x20file\x20removed','upload','file','filename','extname','Plugin\x20upload\x20filepath:\x20%s','Plugin\x20upload\x20destination:\x20%s','chmodSync','0777','Invalid\x20plugin\x20structure','isFile','isDirectory','readdirSync','some','manifest.json','Plugin\x20manifest\x20missing','readFileSync','parse','Invalid\x20manifest:\x20type\x20missing','version','Invalid\x20manifest:\x20version\x20not\x20specified','parameters','Invalid\x20manifest:\x20parameters\x20missing','html','views','Invalid\x20manifest:\x20views\x20missing','admin','Invalid\x20manifest:\x20no\x20view\x20specified','scriptName','Invalid\x20manifest:\x20script\x20name\x20missing','Invalid\x20manifest:\x20script\x20path\x20missing','Invalid\x20manifest:\x20invalid\x20type','description','sidebar','always','icon','agent','test','plugins','Warning:\x20agent\x20view\x20not\x20specified','script','scriptPath','create','body','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Zip\x20archive\x20removed','Extracted\x20folder\x20removed','delete','webhookGet','resolve','\x27PATH\x27\x20parameter\x20not\x20specified','port','hostname','http://localhost:','encoding','%s%s','headers','statusCode','webhookPost','\x27PORT\x27\x20parameter\x20not\x20specified','method','content-length','content-type','rimraf','zip-dir','fast-json-patch','moment','util','path','ejs','lodash','crypto','jsforce','querystring','extract-zip','archiver','ioredis','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./plugin.socket','status','end','json','offset','undefined','limit','count','set','Content-Range','reject','update','destroy','then','get','Plugins','UserProfileResource','sendStatus','error','stack','name','send','index','fieldName','type','key','model','map','keys','filters','intersection','fields','query','attributes','length','hasOwnProperty','nolimit','sort','filter','where','merge','options','Plugin','includeAll','include','findAll','rows','catch','show','params','rawAttributes','find','download','join','root','server/files/plugins','format','basename','zip','warning','code'];(function(_0x8740c3,_0xddd750){var _0x10d404=function(_0x3360a4){while(--_0x3360a4){_0x8740c3['push'](_0x8740c3['shift']());}};_0x10d404(++_0xddd750);}(_0xe70a,0x1a2));var _0xae70=function(_0x66a39d,_0x479652){_0x66a39d=_0x66a39d-0x0;var _0x80e0f=_0xe70a[_0x66a39d];return _0x80e0f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xae70('0x0'));var zipdir=require(_0xae70('0x1'));var jsonpatch=require(_0xae70('0x2'));var rp=require('request-promise');var moment=require(_0xae70('0x3'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xae70('0x4'));var path=require(_0xae70('0x5'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0xae70('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xae70('0x7'));var squel=require('squel');var crypto=require(_0xae70('0x8'));var jsforce=require(_0xae70('0x9'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xae70('0xa'));var Papa=require('papaparse');var extract=require(_0xae70('0xb'));var rimraf=require('rimraf');var archiver=require(_0xae70('0xc'));var Redis=require(_0xae70('0xd'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xae70('0xe'));var logger=require('../../config/logger')('api');var utils=require(_0xae70('0xf'));var config=require(_0xae70('0x10'));var licenseUtil=require(_0xae70('0x11'));var db=require(_0xae70('0x12'))['db'];config[_0xae70('0x13')]=_['defaults'](config[_0xae70('0x13')],{'host':_0xae70('0x14'),'port':0x18eb});var socket=require(_0xae70('0x15'))(new Redis(config[_0xae70('0x13')]));require(_0xae70('0x16'))['register'](socket);function respondWithStatusCode(_0x446d94,_0xcf30a8){_0xcf30a8=_0xcf30a8||0xcc;return function(_0x1e41a4){if(_0x1e41a4){return _0x446d94['sendStatus'](_0xcf30a8);}return _0x446d94[_0xae70('0x17')](_0xcf30a8)[_0xae70('0x18')]();};}function respondWithResult(_0x3bc60c,_0x2e21f2){_0x2e21f2=_0x2e21f2||0xc8;return function(_0x1a7495){if(_0x1a7495){return _0x3bc60c[_0xae70('0x17')](_0x2e21f2)[_0xae70('0x19')](_0x1a7495);}};}function respondWithFilteredResult(_0xf9162e,_0x34cc41){return function(_0x91c47a){if(_0x91c47a){var _0x3fad15=typeof _0x34cc41[_0xae70('0x1a')]===_0xae70('0x1b')&&typeof _0x34cc41[_0xae70('0x1c')]===_0xae70('0x1b');var _0x2dbd7c=_0x91c47a[_0xae70('0x1d')];var _0x45cff2=_0x3fad15?0x0:_0x34cc41['offset'];var _0x293d9b=_0x3fad15?_0x91c47a[_0xae70('0x1d')]:_0x34cc41[_0xae70('0x1a')]+_0x34cc41['limit'];var _0x36f5d7;if(_0x293d9b>=_0x2dbd7c){_0x293d9b=_0x2dbd7c;_0x36f5d7=0xc8;}else{_0x36f5d7=0xce;}_0xf9162e[_0xae70('0x17')](_0x36f5d7);return _0xf9162e[_0xae70('0x1e')](_0xae70('0x1f'),_0x45cff2+'-'+_0x293d9b+'/'+_0x2dbd7c)[_0xae70('0x19')](_0x91c47a);}return null;};}function patchUpdates(_0x2f3403){return function(_0x238836){try{jsonpatch['apply'](_0x238836,_0x2f3403,!![]);}catch(_0x33ba87){return BPromise[_0xae70('0x20')](_0x33ba87);}return _0x238836['save']();};}function saveUpdates(_0x352921,_0xaba724){return function(_0x559c45){if(_0x559c45){return _0x559c45[_0xae70('0x21')](_0x352921)['then'](function(_0x21da6){return _0x21da6;});}return null;};}function removeEntity(_0x2ab113,_0x53ac82){return function(_0x20fa60){if(_0x20fa60){return _0x20fa60[_0xae70('0x22')]()[_0xae70('0x23')](function(){var _0x5dff04=_0x20fa60[_0xae70('0x24')]({'plain':!![]});var _0x2ec42c=_0xae70('0x25');return db[_0xae70('0x26')][_0xae70('0x22')]({'where':{'type':_0x2ec42c,'resourceId':_0x5dff04['id']}})[_0xae70('0x23')](function(){return _0x20fa60;});})[_0xae70('0x23')](function(){_0x2ab113[_0xae70('0x17')](0xcc)[_0xae70('0x18')]();});}};}function handleEntityNotFound(_0x5545f5,_0x1c6c61){return function(_0x1eb125){if(!_0x1eb125){_0x5545f5[_0xae70('0x27')](0x194);}return _0x1eb125;};}function handleError(_0x58067e,_0x44f6c2){_0x44f6c2=_0x44f6c2||0x1f4;return function(_0x1ca1c3){logger[_0xae70('0x28')](_0x1ca1c3[_0xae70('0x29')]);if(_0x1ca1c3[_0xae70('0x2a')]){delete _0x1ca1c3[_0xae70('0x2a')];}_0x58067e['status'](_0x44f6c2)[_0xae70('0x2b')](_0x1ca1c3);};}exports[_0xae70('0x2c')]=function(_0x2c422b,_0x566d84){var _0x5e385c={},_0x1a7dfb={},_0x52b2f2={'count':0x0,'rows':[]};var _0x640b99=_['map'](db['Plugin']['rawAttributes'],function(_0x367ac3){return{'name':_0x367ac3[_0xae70('0x2d')],'type':_0x367ac3[_0xae70('0x2e')][_0xae70('0x2f')]};});_0x1a7dfb[_0xae70('0x30')]=_[_0xae70('0x31')](_0x640b99,_0xae70('0x2a'));_0x1a7dfb['query']=_[_0xae70('0x32')](_0x2c422b['query']);_0x1a7dfb[_0xae70('0x33')]=_[_0xae70('0x34')](_0x1a7dfb[_0xae70('0x30')],_0x1a7dfb['query']);_0x5e385c['attributes']=_[_0xae70('0x34')](_0x1a7dfb[_0xae70('0x30')],qs[_0xae70('0x35')](_0x2c422b[_0xae70('0x36')][_0xae70('0x35')]));_0x5e385c[_0xae70('0x37')]=_0x5e385c[_0xae70('0x37')][_0xae70('0x38')]?_0x5e385c[_0xae70('0x37')]:_0x1a7dfb['model'];if(!_0x2c422b[_0xae70('0x36')][_0xae70('0x39')](_0xae70('0x3a'))){_0x5e385c['limit']=qs[_0xae70('0x1c')](_0x2c422b[_0xae70('0x36')]['limit']);_0x5e385c[_0xae70('0x1a')]=qs[_0xae70('0x1a')](_0x2c422b[_0xae70('0x36')][_0xae70('0x1a')]);}_0x5e385c['order']=qs['sort'](_0x2c422b[_0xae70('0x36')][_0xae70('0x3b')]);_0x5e385c['where']=qs[_0xae70('0x33')](_['pick'](_0x2c422b['query'],_0x1a7dfb[_0xae70('0x33')]),_0x640b99);if(_0x2c422b[_0xae70('0x36')][_0xae70('0x3c')]){_0x5e385c[_0xae70('0x3d')]=_[_0xae70('0x3e')](_0x5e385c[_0xae70('0x3d')],{'$or':_[_0xae70('0x31')](_0x640b99,function(_0x373562){if(_0x373562[_0xae70('0x2e')]!=='VIRTUAL'){var _0x5078cc={};_0x5078cc[_0x373562['name']]={'$like':'%'+_0x2c422b[_0xae70('0x36')]['filter']+'%'};return _0x5078cc;}})});}_0x5e385c=_[_0xae70('0x3e')]({},_0x5e385c,_0x2c422b[_0xae70('0x3f')]);var _0x392ffd={'where':_0x5e385c['where']};return db[_0xae70('0x40')]['count'](_0x392ffd)[_0xae70('0x23')](function(_0xd63cf9){_0x52b2f2[_0xae70('0x1d')]=_0xd63cf9;if(_0x2c422b[_0xae70('0x36')][_0xae70('0x41')]){_0x5e385c[_0xae70('0x42')]=[{'all':!![]}];}return db[_0xae70('0x40')][_0xae70('0x43')](_0x5e385c);})[_0xae70('0x23')](function(_0x1972e8){_0x52b2f2[_0xae70('0x44')]=_0x1972e8;return _0x52b2f2;})[_0xae70('0x23')](respondWithFilteredResult(_0x566d84,_0x5e385c))[_0xae70('0x45')](handleError(_0x566d84,null));};exports[_0xae70('0x46')]=function(_0x4dde8d,_0x1df54c){var _0x560921={'raw':!![],'where':{'id':_0x4dde8d[_0xae70('0x47')]['id']}},_0x49ba96={};_0x49ba96[_0xae70('0x30')]=_[_0xae70('0x32')](db[_0xae70('0x40')][_0xae70('0x48')]);_0x49ba96[_0xae70('0x36')]=_[_0xae70('0x32')](_0x4dde8d['query']);_0x49ba96['filters']=_['intersection'](_0x49ba96[_0xae70('0x30')],_0x49ba96[_0xae70('0x36')]);_0x560921['attributes']=_[_0xae70('0x34')](_0x49ba96['model'],qs[_0xae70('0x35')](_0x4dde8d[_0xae70('0x36')]['fields']));_0x560921[_0xae70('0x37')]=_0x560921[_0xae70('0x37')][_0xae70('0x38')]?_0x560921[_0xae70('0x37')]:_0x49ba96[_0xae70('0x30')];if(_0x4dde8d[_0xae70('0x36')]['includeAll']){_0x560921[_0xae70('0x42')]=[{'all':!![]}];}_0x560921=_[_0xae70('0x3e')]({},_0x560921,_0x4dde8d[_0xae70('0x3f')]);return db[_0xae70('0x40')][_0xae70('0x49')](_0x560921)['then'](handleEntityNotFound(_0x1df54c,null))[_0xae70('0x23')](respondWithResult(_0x1df54c,null))[_0xae70('0x45')](handleError(_0x1df54c,null));};exports[_0xae70('0x4a')]=function(_0x1132c8,_0x532baa,_0x11b5dc){return db[_0xae70('0x40')][_0xae70('0x49')]({'where':{'id':_0x1132c8[_0xae70('0x47')]['id']},'attributes':[_0xae70('0x2a'),_0xae70('0x5')],'raw':!![]})[_0xae70('0x23')](handleEntityNotFound(_0x532baa,null))[_0xae70('0x23')](function(_0x40fa14){if(_0x40fa14){var _0x2eb63f=path[_0xae70('0x4b')](config[_0xae70('0x4c')],_0xae70('0x4d'),util[_0xae70('0x4e')]('%s.zip',path[_0xae70('0x4f')](_0x40fa14[_0xae70('0x5')])));var _0x32d884=fs['createWriteStream'](_0x2eb63f);var _0x7c5ef5=archiver(_0xae70('0x50'),{'zlib':{'level':0x9}});_0x7c5ef5['on'](_0xae70('0x51'),function(_0x23110f){if(_0x23110f[_0xae70('0x52')]==='ENOENT'){logger[_0xae70('0x28')](_0x23110f);}else{throw new db[(_0xae70('0x53'))][(_0xae70('0x54'))]('Error\x20while\x20generating\x20the\x20zip\x20archive');}});_0x7c5ef5['on'](_0xae70('0x28'),function(_0x2a2c04){throw new db[(_0xae70('0x53'))]['Error'](_0xae70('0x55'));});_0x7c5ef5[_0xae70('0x56')](_0x32d884);_0x7c5ef5[_0xae70('0x57')](_0xae70('0x58'),{'cwd':path[_0xae70('0x4b')](config['root'],_0xae70('0x4d'),path[_0xae70('0x59')](_0x40fa14['path'])),'ignore':[path['join'](path['basename'](_0x40fa14['path']),'node_modules/**/*'),path[_0xae70('0x4b')](path[_0xae70('0x4f')](_0x40fa14[_0xae70('0x5')]),_0xae70('0x5a'))],'nodir':!![]})[_0xae70('0x5b')]();_0x32d884['on'](_0xae70('0x5c'),function(){if(!fs[_0xae70('0x5d')](_0x2eb63f)){throw new db['Sequelize']['Error'](_0xae70('0x5e'));}return _0x532baa['download'](_0x2eb63f,util[_0xae70('0x4e')](_0xae70('0x5f'),path[_0xae70('0x4f')](_0x40fa14['path'])),function(_0xf32cfb){if(_0xf32cfb){throw new db[(_0xae70('0x53'))]['Error'](_0xae70('0x60'));}fs[_0xae70('0x61')](_0x2eb63f);logger[_0xae70('0x62')](_0xae70('0x63'));logger['info'](_0xae70('0x64'));});});}return null;})['catch'](handleError(_0x532baa,null));};exports[_0xae70('0x65')]=function(_0x566880,_0x567b08,_0x4a9ab6){var _0x429d26=path[_0xae70('0x4f')](_0x566880[_0xae70('0x66')][_0xae70('0x67')],path[_0xae70('0x68')](_0x566880[_0xae70('0x66')]['filename']));var _0x19d2bc=path[_0xae70('0x4b')](config[_0xae70('0x4c')],_0xae70('0x4d'),_0x566880['file']['filename']);var _0x3b72c3=path['join'](config[_0xae70('0x4c')],_0xae70('0x4d'),_0x429d26);logger[_0xae70('0x62')](_0xae70('0x69'),_0x19d2bc);logger[_0xae70('0x62')](_0xae70('0x6a'),_0x3b72c3);try{fs[_0xae70('0x6b')](_0x19d2bc,parseInt(_0xae70('0x6c'),0x8));extract(_0x19d2bc,{'dir':_0x3b72c3},function(_0x5acf21){if(_0x5acf21){logger[_0xae70('0x28')](_0x5acf21);handleError(_0x5acf21,!![]);};var _0x18b00c=fs['readdirSync'](_0x3b72c3);if(_0x18b00c[_0xae70('0x38')]>0x1){removeReferences(_0x19d2bc,_0x3b72c3);logger[_0xae70('0x28')](_0xae70('0x6d'));return _0x4a9ab6(new Error('Invalid\x20plugin\x20structure'));}var _0x3422f0=fs['lstatSync'](path[_0xae70('0x4b')](_0x3b72c3,_0x18b00c[0x0]));if(_0x3422f0[_0xae70('0x6e')]()){removeReferences(_0x19d2bc,_0x3b72c3);logger[_0xae70('0x28')](_0xae70('0x6d'));return _0x4a9ab6(new Error(_0xae70('0x6d')));}if(_0x3422f0[_0xae70('0x6f')]()){var _0x259893=fs[_0xae70('0x70')](path[_0xae70('0x4b')](_0x3b72c3,_0x18b00c[0x0]));if(_0x259893[_0xae70('0x38')]===0x0){removeReferences(_0x19d2bc,_0x3b72c3);logger['error'](_0xae70('0x6d'));return _0x4a9ab6(new Error(_0xae70('0x6d')));}var _0x56a743=_0x259893[_0xae70('0x71')](function(_0x16fab1){return _0x16fab1===_0xae70('0x72');});if(!_0x56a743){return _0x4a9ab6(new Error(_0xae70('0x73')));}var _0x798c44=fs[_0xae70('0x74')](path[_0xae70('0x4b')](_0x3b72c3,_0x18b00c[0x0],_0xae70('0x72')));var _0x21c1b7=JSON[_0xae70('0x75')](_0x798c44);if(_0xae70('0x1b')==typeof _0x21c1b7[_0xae70('0x2a')]){return _0x4a9ab6(new Error('Invalid\x20manifest:\x20name\x20missing'));}if(_0xae70('0x1b')==typeof _0x21c1b7[_0xae70('0x2e')]){return _0x4a9ab6(new Error(_0xae70('0x76')));}if(_0xae70('0x1b')==typeof _0x21c1b7[_0xae70('0x77')]){return _0x4a9ab6(new Error(_0xae70('0x78')));}if('undefined'==typeof _0x21c1b7[_0xae70('0x79')]){return _0x4a9ab6(new Error(_0xae70('0x7a')));}if(_0x21c1b7[_0xae70('0x2e')]===_0xae70('0x7b')){if(_0xae70('0x1b')==typeof _0x21c1b7[_0xae70('0x79')][_0xae70('0x7c')]){return _0x4a9ab6(new Error(_0xae70('0x7d')));}if('undefined'==typeof _0x21c1b7['parameters']['views'][_0xae70('0x7e')]&&_0xae70('0x1b')==typeof _0x21c1b7[_0xae70('0x79')][_0xae70('0x7c')]['agent']){return _0x4a9ab6(new Error(_0xae70('0x7f')));}}else if(_0x21c1b7[_0xae70('0x2e')]==='script'){if(_0xae70('0x1b')==typeof _0x21c1b7[_0xae70('0x79')][_0xae70('0x80')]){return _0x4a9ab6(new Error(_0xae70('0x81')));}if('undefined'==typeof _0x21c1b7[_0xae70('0x79')]['scriptPath']){return _0x4a9ab6(new Error(_0xae70('0x82')));}}else{return _0x4a9ab6(new Error(_0xae70('0x83')));}var _0x379f42=_0x21c1b7['name'];var _0x57f04e=_0x21c1b7[_0xae70('0x84')];var _0x482edc=_0x21c1b7[_0xae70('0x2e')];var _0xf07063=_0x21c1b7[_0xae70('0x85')]?_0x21c1b7[_0xae70('0x85')]:_0xae70('0x86');var _0xd1f189=_0x21c1b7[_0xae70('0x87')]?_0x21c1b7[_0xae70('0x87')]:'icon-apps';var _0x3d20ad='';var _0x36305e='';var _0x5907d2='';var _0x295473='';var _0x583aaf=_0x21c1b7[_0xae70('0x77')];if(_0x482edc===_0xae70('0x7b')){if(_0xae70('0x1b')!=typeof _0x21c1b7[_0xae70('0x79')][_0xae70('0x7c')]['admin']){var _0xa6aa31=_0x21c1b7[_0xae70('0x79')]['views'][_0xae70('0x7e')];if(!/^(f|ht)tps?:\/\//i['test'](_0xa6aa31)){_0x3d20ad=path[_0xae70('0x4b')]('plugins',_0x429d26,_0x18b00c[0x0],_0xa6aa31);}else{_0x3d20ad=_0xa6aa31;}}else{logger[_0xae70('0x62')]('Warning:\x20admin\x20view\x20not\x20specified');}if(_0xae70('0x1b')!=typeof _0x21c1b7[_0xae70('0x79')][_0xae70('0x7c')][_0xae70('0x88')]){var _0x1fd07c=_0x21c1b7[_0xae70('0x79')]['views'][_0xae70('0x88')];if(!/^(f|ht)tps?:\/\//i[_0xae70('0x89')](_0x1fd07c)){_0x36305e=path[_0xae70('0x4b')](_0xae70('0x8a'),_0x429d26,_0x18b00c[0x0],_0x1fd07c);}else{_0x36305e=_0x1fd07c;}}else{logger[_0xae70('0x62')](_0xae70('0x8b'));}}else if(_0x482edc===_0xae70('0x8c')){_0x5907d2=_0x21c1b7['parameters'][_0xae70('0x80')];_0x295473=_0x21c1b7[_0xae70('0x79')][_0xae70('0x8d')];if(_0xae70('0x1b')!=typeof _0x21c1b7['parameters'][_0xae70('0x7c')]){if(_0xae70('0x1b')!=typeof _0x21c1b7[_0xae70('0x79')][_0xae70('0x7c')][_0xae70('0x7e')]){var _0xa6aa31=_0x21c1b7['parameters'][_0xae70('0x7c')][_0xae70('0x7e')];if(!/^(f|ht)tps?:\/\//i[_0xae70('0x89')](_0xa6aa31)){_0x3d20ad=path[_0xae70('0x4b')]('plugins',_0x429d26,_0x18b00c[0x0],_0xa6aa31);}else{_0x3d20ad=_0xa6aa31;}}if(_0xae70('0x1b')!=typeof _0x21c1b7[_0xae70('0x79')][_0xae70('0x7c')][_0xae70('0x88')]){var _0x1fd07c=_0x21c1b7[_0xae70('0x79')]['views'][_0xae70('0x88')];if(!/^(f|ht)tps?:\/\//i[_0xae70('0x89')](_0x1fd07c)){_0x36305e=path[_0xae70('0x4b')]('plugins',_0x429d26,_0x18b00c[0x0],_0x1fd07c);}else{_0x36305e=_0x1fd07c;}}}}var _0x535952={'name':_0x379f42,'description':_0x57f04e,'path':path[_0xae70('0x4b')](_0x429d26,_0x18b00c[0x0]),'type':_0x482edc,'sidebar':_0xf07063,'icon':_0xd1f189,'adminUrl':_0x3d20ad,'agentUrl':_0x36305e,'scriptName':_0x5907d2,'scriptPath':_0x295473,'version':_0x583aaf};removeReferences(_0x19d2bc,null);return db[_0xae70('0x40')][_0xae70('0x8e')](_0x535952)[_0xae70('0x23')](function(_0x1b9ac0){var _0x3f6fc8={'role':_0x566880[_0xae70('0x8f')]['role'],'userProfileId':_0x566880['body'][_0xae70('0x90')]};if(!_0x3f6fc8)throw new Error(_0xae70('0x91'));if(_0x3f6fc8[_0xae70('0x92')]==='user'){var _0x45ebd7=_0x1b9ac0[_0xae70('0x24')]({'plain':!![]});return db[_0xae70('0x93')]['find']({'where':{'name':_0xae70('0x25'),'userProfileId':_0x3f6fc8[_0xae70('0x90')]},'raw':!![]})[_0xae70('0x23')](function(_0x379305){if(_0x379305&&_0x379305[_0xae70('0x94')]===0x0){return db[_0xae70('0x26')][_0xae70('0x8e')]({'name':_0x45ebd7[_0xae70('0x2a')],'resourceId':_0x45ebd7['id'],'type':_0x379305[_0xae70('0x2a')],'sectionId':_0x379305['id']},{})['then'](function(){return _0x1b9ac0;});}else{return _0x1b9ac0;}})[_0xae70('0x45')](function(_0x363ad3){logger[_0xae70('0x28')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x363ad3);throw _0x363ad3;});}return _0x1b9ac0;})[_0xae70('0x23')](respondWithResult(_0x567b08,null))['catch'](handleError(_0x567b08,null));}});}catch(_0x5be9a7){_0x567b08[_0xae70('0x17')](0x1f4)[_0xae70('0x2b')](_0x5be9a7);}};function removeReferences(_0x1fafbd,_0x373ea6){try{if(_0x1fafbd){fs[_0xae70('0x61')](_0x1fafbd);logger[_0xae70('0x62')](_0xae70('0x95'));}if(_0x373ea6){rimraf(_0x373ea6,function(){});logger[_0xae70('0x62')](_0xae70('0x96'));}}catch(_0x5b90d2){logger[_0xae70('0x28')](_0x5b90d2);}}exports[_0xae70('0x21')]=function(_0x562a76,_0x377eec,_0x31b1ab){return db[_0xae70('0x40')][_0xae70('0x49')]({'where':{'id':_0x562a76[_0xae70('0x47')]['id']}})[_0xae70('0x23')](handleEntityNotFound(_0x377eec,null))[_0xae70('0x23')](saveUpdates(_0x562a76['body'],null))[_0xae70('0x23')](respondWithResult(_0x377eec,null))[_0xae70('0x45')](handleError(_0x377eec,null));};exports[_0xae70('0x97')]=function(_0x9e8244,_0x47affc,_0xb64315){return db[_0xae70('0x40')][_0xae70('0x49')]({'where':{'id':_0x9e8244['params']['id']}})['then'](function(_0x4dcdbc){if(_0x4dcdbc){return _0x4dcdbc[_0xae70('0x22')]();}})[_0xae70('0x23')](function(_0x170b3e){rimraf(path['join'](config[_0xae70('0x4c')],_0xae70('0x4d'),path[_0xae70('0x59')](_0x170b3e[_0xae70('0x5')])),function(){});return _0x170b3e;})[_0xae70('0x23')](handleEntityNotFound(_0x47affc,null))[_0xae70('0x23')](respondWithStatusCode(_0x47affc,null))[_0xae70('0x45')](handleError(_0x47affc,null));};exports[_0xae70('0x98')]=function(_0xc6755f,_0x559369,_0xee5d3b){return BPromise[_0xae70('0x99')]()['then'](function(){if(!_0xc6755f[_0xae70('0x36')][_0xae70('0x5')]){throw new Error(_0xae70('0x9a'));}if(!_0xc6755f['query'][_0xae70('0x9b')]){throw new Error('\x27PORT\x27\x20parameter\x20not\x20specified');}var _0x353d98=_0xc6755f[_0xae70('0x36')][_0xae70('0x9c')]?_0xc6755f[_0xae70('0x36')][_0xae70('0x9c')]+':'+_0xc6755f['query'][_0xae70('0x9b')]:_0xae70('0x9d')+_0xc6755f['query']['port'];var _0x5dc20b=_0xc6755f[_0xae70('0x36')]['json']?_0xc6755f[_0xae70('0x36')][_0xae70('0x19')]:!![];var _0x2c9955=_0xc6755f[_0xae70('0x36')][_0xae70('0x9e')]?_0xc6755f[_0xae70('0x36')][_0xae70('0x9e')]:null;var _0x479a63={'method':_0xc6755f['method'],'uri':util['format'](_0xae70('0x9f'),_0x353d98,_0xc6755f[_0xae70('0x36')][_0xae70('0x5')]),'json':_0x5dc20b,'resolveWithFullResponse':!![],'encoding':_0x2c9955,'qs':_0xc6755f[_0xae70('0x36')]};if(_0xc6755f[_0xae70('0xa0')]){_0x479a63[_0xae70('0xa0')]=_0xc6755f['headers'];if(_0x479a63['headers']['content-length']){delete _0x479a63[_0xae70('0xa0')]['content-length'];}}if(_0x479a63[_0xae70('0xa0')]['content-type']){delete _0x479a63['headers']['content-type'];}return rp(_0x479a63);})[_0xae70('0x23')](function(_0x13f51d){if(_0x13f51d){_0x559369[_0xae70('0x1e')](_0x13f51d['headers']);logger[_0xae70('0x62')](_0x13f51d[_0xae70('0x8f')]);if(_['endsWith'](_0xc6755f[_0xae70('0x36')][_0xae70('0x5')],_0xae70('0x4a'))&&_0x13f51d[_0xae70('0xa1')]==0x1f4){return _0x559369[_0xae70('0x27')](_0x13f51d['statusCode']);}else{return _0x559369['status'](_0x13f51d[_0xae70('0xa1')])[_0xae70('0x2b')](_0x13f51d['body']);}}else{return _0x559369[_0xae70('0x27')](0xc8);}})[_0xae70('0x45')](handleError(_0x559369,null));};exports[_0xae70('0xa2')]=function(_0x3f3634,_0x37b5f3,_0x4feb88){return BPromise[_0xae70('0x99')]()[_0xae70('0x23')](function(){if(!_0x3f3634[_0xae70('0x36')][_0xae70('0x5')]){throw new Error('\x27PATH\x27\x20parameter\x20not\x20specified');}if(!_0x3f3634[_0xae70('0x36')]['port']){throw new Error(_0xae70('0xa3'));}var _0xe1aa1d=_0x3f3634['query']['hostname']?_0x3f3634[_0xae70('0x36')]['hostname']+':'+_0x3f3634['query']['port']:_0xae70('0x9d')+_0x3f3634[_0xae70('0x36')][_0xae70('0x9b')];var _0x224f15=_0x3f3634['query'][_0xae70('0x19')]?_0x3f3634[_0xae70('0x36')][_0xae70('0x19')]:!![];var _0x786548=_0x3f3634['query'][_0xae70('0x9e')]?_0x3f3634[_0xae70('0x36')][_0xae70('0x9e')]:null;var _0x46234f={'method':_0x3f3634[_0xae70('0xa4')],'uri':util['format']('%s%s',_0xe1aa1d,_0x3f3634[_0xae70('0x36')]['path']),'json':_0x224f15,'resolveWithFullResponse':!![],'encoding':_0x786548,'body':_0x3f3634[_0xae70('0x8f')]};if(_0x3f3634[_0xae70('0xa0')]){_0x46234f['headers']=_0x3f3634[_0xae70('0xa0')];if(_0x46234f['headers'][_0xae70('0xa5')]){delete _0x46234f[_0xae70('0xa0')][_0xae70('0xa5')];}}if(_0x46234f[_0xae70('0xa0')]['content-type']){delete _0x46234f[_0xae70('0xa0')][_0xae70('0xa6')];}return rp(_0x46234f);})['then'](function(_0x454302){if(_0x454302){_0x37b5f3[_0xae70('0x1e')](_0x454302[_0xae70('0xa0')]);logger[_0xae70('0x62')](_0x454302[_0xae70('0x8f')]);return _0x37b5f3['status'](_0x454302[_0xae70('0xa1')])[_0xae70('0x2b')](_0x454302[_0xae70('0x8f')]);}else{return _0x37b5f3[_0xae70('0x27')](0xc8);}})[_0xae70('0x45')](handleError(_0x37b5f3,null));}; \ No newline at end of file diff --git a/server/api/plugin/plugin.events.js b/server/api/plugin/plugin.events.js index 498e27c..7d2fe0c 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 _0x307e=['emit','hasOwnProperty','exports','events','../../mysqldb','Plugin','setMaxListeners','save','remove'];(function(_0x47708b,_0x13f7f7){var _0x4b8d36=function(_0x9b175e){while(--_0x9b175e){_0x47708b['push'](_0x47708b['shift']());}};_0x4b8d36(++_0x13f7f7);}(_0x307e,0xc9));var _0xe307=function(_0x728545,_0x3e3f4d){_0x728545=_0x728545-0x0;var _0x25023b=_0x307e[_0x728545];return _0x25023b;};'use strict';var EventEmitter=require(_0xe307('0x0'));var Plugin=require(_0xe307('0x1'))['db'][_0xe307('0x2')];var PluginEvents=new EventEmitter();PluginEvents[_0xe307('0x3')](0x0);var events={'afterCreate':_0xe307('0x4'),'afterUpdate':'update','afterDestroy':_0xe307('0x5')};function emitEvent(_0xcb2f6e){return function(_0x516a1d,_0x1eee4d,_0x532403){PluginEvents[_0xe307('0x6')](_0xcb2f6e+':'+_0x516a1d['id'],_0x516a1d);PluginEvents[_0xe307('0x6')](_0xcb2f6e,_0x516a1d);_0x532403(null);};}for(var e in events){if(events[_0xe307('0x7')](e)){var event=events[e];Plugin['hook'](e,emitEvent(event));}}module[_0xe307('0x8')]=PluginEvents; \ No newline at end of file +var _0xbd51=['events','Plugin','setMaxListeners','save','update','emit','hook','exports'];(function(_0x1fb044,_0x1211eb){var _0x18a559=function(_0x4694f6){while(--_0x4694f6){_0x1fb044['push'](_0x1fb044['shift']());}};_0x18a559(++_0x1211eb);}(_0xbd51,0x1a8));var _0x1bd5=function(_0x13c963,_0xe0e056){_0x13c963=_0x13c963-0x0;var _0x514857=_0xbd51[_0x13c963];return _0x514857;};'use strict';var EventEmitter=require(_0x1bd5('0x0'));var Plugin=require('../../mysqldb')['db'][_0x1bd5('0x1')];var PluginEvents=new EventEmitter();PluginEvents[_0x1bd5('0x2')](0x0);var events={'afterCreate':_0x1bd5('0x3'),'afterUpdate':_0x1bd5('0x4'),'afterDestroy':'remove'};function emitEvent(_0x4d1bba){return function(_0x58af16,_0x531028,_0x3bce00){PluginEvents[_0x1bd5('0x5')](_0x4d1bba+':'+_0x58af16['id'],_0x58af16);PluginEvents[_0x1bd5('0x5')](_0x4d1bba,_0x58af16);_0x3bce00(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];Plugin[_0x1bd5('0x6')](e,emitEvent(event));}}module[_0x1bd5('0x7')]=PluginEvents; \ No newline at end of file diff --git a/server/api/plugin/plugin.model.js b/server/api/plugin/plugin.model.js index 4baa576..b3caaae 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 _0x4be6=['plugins','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./plugin.attributes','define'];(function(_0x5a66be,_0x5c6d5d){var _0x40982d=function(_0x4adf7a){while(--_0x4adf7a){_0x5a66be['push'](_0x5a66be['shift']());}};_0x40982d(++_0x5c6d5d);}(_0x4be6,0xb5));var _0x64be=function(_0x2316b9,_0x87059b){_0x2316b9=_0x2316b9-0x0;var _0x4405a9=_0x4be6[_0x2316b9];return _0x4405a9;};'use strict';var _=require('lodash');var util=require(_0x64be('0x0'));var logger=require(_0x64be('0x1'))(_0x64be('0x2'));var moment=require(_0x64be('0x3'));var BPromise=require(_0x64be('0x4'));var rp=require(_0x64be('0x5'));var fs=require('fs');var path=require(_0x64be('0x6'));var rimraf=require(_0x64be('0x7'));var config=require(_0x64be('0x8'));var attributes=require(_0x64be('0x9'));module['exports']=function(_0x131822,_0x2430e2){return _0x131822[_0x64be('0xa')]('Plugin',attributes,{'tableName':_0x64be('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x71a6=['lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','exports','define','plugins'];(function(_0x49092a,_0x170bf1){var _0x3e0190=function(_0x5d2315){while(--_0x5d2315){_0x49092a['push'](_0x49092a['shift']());}};_0x3e0190(++_0x170bf1);}(_0x71a6,0x108));var _0x671a=function(_0xa223ad,_0x5a574b){_0xa223ad=_0xa223ad-0x0;var _0x306d47=_0x71a6[_0xa223ad];return _0x306d47;};'use strict';var _=require(_0x671a('0x0'));var util=require(_0x671a('0x1'));var logger=require(_0x671a('0x2'))(_0x671a('0x3'));var moment=require(_0x671a('0x4'));var BPromise=require('bluebird');var rp=require(_0x671a('0x5'));var fs=require('fs');var path=require(_0x671a('0x6'));var rimraf=require(_0x671a('0x7'));var config=require(_0x671a('0x8'));var attributes=require('./plugin.attributes');module[_0x671a('0x9')]=function(_0x5b1847,_0xf21b0b){return _0x5b1847[_0x671a('0xa')]('Plugin',attributes,{'tableName':_0x671a('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 8bca27c..480fd91 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 _0x9e63=['catch','CreatePlugin','create','options','then','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','socket.io-emitter','./plugin.socket','request','info','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x547c8a,_0x53aca8){var _0x3d2e6f=function(_0x4253fb){while(--_0x4253fb){_0x547c8a['push'](_0x547c8a['shift']());}};_0x3d2e6f(++_0x53aca8);}(_0x9e63,0x65));var _0x39e6=function(_0x4b7b62,_0x4920a9){_0x4b7b62=_0x4b7b62-0x0;var _0x2280df=_0x9e63[_0x4b7b62];return _0x2280df;};'use strict';var _=require(_0x39e6('0x0'));var util=require(_0x39e6('0x1'));var moment=require(_0x39e6('0x2'));var BPromise=require('bluebird');var rs=require(_0x39e6('0x3'));var fs=require('fs');var Redis=require(_0x39e6('0x4'));var db=require(_0x39e6('0x5'))['db'];var utils=require(_0x39e6('0x6'));var logger=require(_0x39e6('0x7'))(_0x39e6('0x8'));var config=require(_0x39e6('0x9'));var jayson=require(_0x39e6('0xa'));var client=jayson['client'][_0x39e6('0xb')]({'port':0x232a});config[_0x39e6('0xc')]=_[_0x39e6('0xd')](config['redis'],{'host':_0x39e6('0xe'),'port':0x18eb});var socket=require(_0x39e6('0xf'))(new Redis(config['redis']));require(_0x39e6('0x10'))['register'](socket);function respondWithRpcPromise(_0x5ddfd6,_0x37731c,_0xfbdcd){return new BPromise(function(_0x3e5fec,_0x2d4acf){return client[_0x39e6('0x11')](_0x5ddfd6,_0xfbdcd)['then'](function(_0x4fcb02){logger[_0x39e6('0x12')](_0x39e6('0x13'),_0x37731c,_0x39e6('0x14'));logger[_0x39e6('0x15')](_0x39e6('0x16'),_0x37731c,'request\x20sent',JSON[_0x39e6('0x17')](_0x4fcb02));if(_0x4fcb02[_0x39e6('0x18')]){if(_0x4fcb02[_0x39e6('0x18')][_0x39e6('0x19')]===0x1f4){logger['error']('Plugin,\x20%s,\x20%s',_0x37731c,_0x4fcb02[_0x39e6('0x18')][_0x39e6('0x1a')]);return _0x2d4acf(_0x4fcb02[_0x39e6('0x18')][_0x39e6('0x1a')]);}logger[_0x39e6('0x18')]('Plugin,\x20%s,\x20%s',_0x37731c,_0x4fcb02[_0x39e6('0x18')][_0x39e6('0x1a')]);return _0x3e5fec(_0x4fcb02[_0x39e6('0x18')][_0x39e6('0x1a')]);}else{logger[_0x39e6('0x12')](_0x39e6('0x13'),_0x37731c,_0x39e6('0x14'));_0x3e5fec(_0x4fcb02['result'][_0x39e6('0x1a')]);}})[_0x39e6('0x1b')](function(_0x297060){logger['error']('Plugin,\x20%s,\x20%s',_0x37731c,_0x297060);_0x2d4acf(_0x297060);});});}exports[_0x39e6('0x1c')]=function(_0x445f12){var _0x1d81aa=this;return new Promise(function(_0x2d9a98,_0x18031b){return db['Plugin'][_0x39e6('0x1d')](_0x445f12['body'],{'raw':_0x445f12[_0x39e6('0x1e')]?_0x445f12[_0x39e6('0x1e')]['raw']===undefined?!![]:![]:!![]})[_0x39e6('0x1f')](function(_0x1c626a){logger[_0x39e6('0x12')](_0x39e6('0x1c'),_0x445f12);logger[_0x39e6('0x15')](_0x39e6('0x1c'),_0x445f12,JSON[_0x39e6('0x17')](_0x1c626a));_0x2d9a98(_0x1c626a);})[_0x39e6('0x1b')](function(_0x302f77){logger[_0x39e6('0x18')](_0x39e6('0x1c'),_0x302f77[_0x39e6('0x1a')],_0x445f12);_0x18031b(_0x1d81aa[_0x39e6('0x18')](0x1f4,_0x302f77['message']));});});}; \ No newline at end of file +var _0x5235=['register','Plugin,\x20%s,\x20%s','request\x20sent','debug','Plugin,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','CreatePlugin','Plugin','create','options','raw','then','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis'];(function(_0x18d29b,_0x3034d2){var _0x3c354f=function(_0xb6ea2){while(--_0xb6ea2){_0x18d29b['push'](_0x18d29b['shift']());}};_0x3c354f(++_0x3034d2);}(_0x5235,0x1f2));var _0x5523=function(_0x2272b5,_0x362458){_0x2272b5=_0x2272b5-0x0;var _0x110156=_0x5235[_0x2272b5];return _0x110156;};'use strict';var _=require(_0x5523('0x0'));var util=require('util');var moment=require(_0x5523('0x1'));var BPromise=require(_0x5523('0x2'));var rs=require(_0x5523('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5523('0x4'))['db'];var utils=require(_0x5523('0x5'));var logger=require(_0x5523('0x6'))(_0x5523('0x7'));var config=require(_0x5523('0x8'));var jayson=require(_0x5523('0x9'));var client=jayson[_0x5523('0xa')][_0x5523('0xb')]({'port':0x232a});config['redis']=_[_0x5523('0xc')](config[_0x5523('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x5523('0xd')]));require('./plugin.socket')[_0x5523('0xe')](socket);function respondWithRpcPromise(_0x51818a,_0x24612b,_0x1e834a){return new BPromise(function(_0x20388a,_0x3e2a4f){return client['request'](_0x51818a,_0x1e834a)['then'](function(_0x3b0d49){logger['info'](_0x5523('0xf'),_0x24612b,_0x5523('0x10'));logger[_0x5523('0x11')](_0x5523('0x12'),_0x24612b,_0x5523('0x10'),JSON[_0x5523('0x13')](_0x3b0d49));if(_0x3b0d49[_0x5523('0x14')]){if(_0x3b0d49[_0x5523('0x14')][_0x5523('0x15')]===0x1f4){logger[_0x5523('0x14')](_0x5523('0xf'),_0x24612b,_0x3b0d49['error'][_0x5523('0x16')]);return _0x3e2a4f(_0x3b0d49[_0x5523('0x14')]['message']);}logger[_0x5523('0x14')](_0x5523('0xf'),_0x24612b,_0x3b0d49[_0x5523('0x14')][_0x5523('0x16')]);return _0x20388a(_0x3b0d49['error'][_0x5523('0x16')]);}else{logger[_0x5523('0x17')]('Plugin,\x20%s,\x20%s',_0x24612b,_0x5523('0x10'));_0x20388a(_0x3b0d49[_0x5523('0x18')][_0x5523('0x16')]);}})[_0x5523('0x19')](function(_0x5b69dc){logger[_0x5523('0x14')](_0x5523('0xf'),_0x24612b,_0x5b69dc);_0x3e2a4f(_0x5b69dc);});});}exports[_0x5523('0x1a')]=function(_0xaad9b4){var _0x34500d=this;return new Promise(function(_0x385e44,_0x4fdce7){return db[_0x5523('0x1b')][_0x5523('0x1c')](_0xaad9b4['body'],{'raw':_0xaad9b4[_0x5523('0x1d')]?_0xaad9b4['options'][_0x5523('0x1e')]===undefined?!![]:![]:!![]})[_0x5523('0x1f')](function(_0x4bba1c){logger['info'](_0x5523('0x1a'),_0xaad9b4);logger[_0x5523('0x11')](_0x5523('0x1a'),_0xaad9b4,JSON['stringify'](_0x4bba1c));_0x385e44(_0x4bba1c);})[_0x5523('0x19')](function(_0x8d4181){logger[_0x5523('0x14')]('CreatePlugin',_0x8d4181['message'],_0xaad9b4);_0x4fdce7(_0x34500d[_0x5523('0x14')](0x1f4,_0x8d4181[_0x5523('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/plugin/plugin.socket.js b/server/api/plugin/plugin.socket.js index 1a44708..fb8cde1 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 _0x6119=['emit','length','./plugin.events','remove','update'];(function(_0x2494f5,_0x1f1d3c){var _0x5c60a4=function(_0x437901){while(--_0x437901){_0x2494f5['push'](_0x2494f5['shift']());}};_0x5c60a4(++_0x1f1d3c);}(_0x6119,0x93));var _0x9611=function(_0x5967b1,_0x278124){_0x5967b1=_0x5967b1-0x0;var _0x75cbd3=_0x6119[_0x5967b1];return _0x75cbd3;};'use strict';var PluginEvents=require(_0x9611('0x0'));var events=['save',_0x9611('0x1'),_0x9611('0x2')];function createListener(_0x295540,_0x36f847){return function(_0x2c0b7d){_0x36f847[_0x9611('0x3')](_0x295540,_0x2c0b7d);};}function removeListener(_0x5b07af,_0x1eee10){return function(){PluginEvents['removeListener'](_0x5b07af,_0x1eee10);};}exports['register']=function(_0x493453){for(var _0x5c8871=0x0,_0xc9472b=events[_0x9611('0x4')];_0x5c8871<_0xc9472b;_0x5c8871++){var _0x41f9ad=events[_0x5c8871];var _0x35960a=createListener('plugin:'+_0x41f9ad,_0x493453);PluginEvents['on'](_0x41f9ad,_0x35960a);}}; \ No newline at end of file +var _0x3b23=['plugin:','./plugin.events','save','remove','update','emit','removeListener','length'];(function(_0x2318a3,_0x2be49f){var _0x5c0a8e=function(_0x1f02d4){while(--_0x1f02d4){_0x2318a3['push'](_0x2318a3['shift']());}};_0x5c0a8e(++_0x2be49f);}(_0x3b23,0x1a9));var _0x33b2=function(_0x278c85,_0x386fe1){_0x278c85=_0x278c85-0x0;var _0x35a8ce=_0x3b23[_0x278c85];return _0x35a8ce;};'use strict';var PluginEvents=require(_0x33b2('0x0'));var events=[_0x33b2('0x1'),_0x33b2('0x2'),_0x33b2('0x3')];function createListener(_0x557cd2,_0x343b5a){return function(_0x269c77){_0x343b5a[_0x33b2('0x4')](_0x557cd2,_0x269c77);};}function removeListener(_0x1f3421,_0x2842e7){return function(){PluginEvents[_0x33b2('0x5')](_0x1f3421,_0x2842e7);};}exports['register']=function(_0x127237){for(var _0x445226=0x0,_0x38e7ba=events[_0x33b2('0x6')];_0x445226<_0x38e7ba;_0x445226++){var _0x59f1c2=events[_0x445226];var _0xe621e2=createListener(_0x33b2('0x7')+_0x59f1c2,_0x127237);PluginEvents['on'](_0x59f1c2,_0xe621e2);}}; \ No newline at end of file diff --git a/server/api/pm2/index.js b/server/api/pm2/index.js index 0e8888a..37cc2be 100644 --- a/server/api/pm2/index.js +++ b/server/api/pm2/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x923f9b,_0x911264){var _0xfdf48e=function(_0x49bd30){while(--_0x49bd30){_0x923f9b['push'](_0x923f9b['shift']());}};_0xfdf48e(++_0x911264);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file +var _0xa9e0=['create','put','delete','destroy','exports','express','Router','../../components/auth/service','isAuthenticated','get','/:id','show','post'];(function(_0x105b5a,_0xa6fd0f){var _0x226bb8=function(_0x4ae4d3){while(--_0x4ae4d3){_0x105b5a['push'](_0x105b5a['shift']());}};_0x226bb8(++_0xa6fd0f);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2cfb58,_0x3d9412){_0x2cfb58=_0x2cfb58-0x0;var _0xd99951=_0xa9e0[_0x2cfb58];return _0xd99951;};'use strict';var express=require(_0x0a9e('0x0'));var router=express[_0x0a9e('0x1')]();var auth=require(_0x0a9e('0x2'));var controller=require('./pm2.controller');router['get']('/',auth[_0x0a9e('0x3')](),controller['index']);router[_0x0a9e('0x4')](_0x0a9e('0x5'),auth[_0x0a9e('0x3')](),controller[_0x0a9e('0x6')]);router[_0x0a9e('0x7')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x8')]);router[_0x0a9e('0x9')](_0x0a9e('0x5'),auth['isAuthenticated'](),controller['update']);router[_0x0a9e('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);module[_0x0a9e('0xc')]=router; \ No newline at end of file diff --git a/server/api/pm2/pm2.controller.js b/server/api/pm2/pm2.controller.js index 2093dc6..a377cf0 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 _0x7af2=['sendStatus','json','error','stack','name','status','info','index','list','then','reject','express','motion2','length','catch','show','describe','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path','update','stop','hasOwnProperty','params','send','destroy','Unknown\x20id','../../config/pm2','../../config/logger','api','path','exec','bluebird'];(function(_0x26658e,_0x1bb1a9){var _0x572802=function(_0x168565){while(--_0x168565){_0x26658e['push'](_0x26658e['shift']());}};_0x572802(++_0x1bb1a9);}(_0x7af2,0x119));var _0x27af=function(_0x3f1a89,_0x17ce94){_0x3f1a89=_0x3f1a89-0x0;var _0x3efe92=_0x7af2[_0x3f1a89];return _0x3efe92;};'use strict';var _=require('lodash');var pm2=require(_0x27af('0x0'));var logger=require(_0x27af('0x1'))(_0x27af('0x2'));var path=require(_0x27af('0x3'));var exec=require('child_process')[_0x27af('0x4')];var BPromise=require(_0x27af('0x5'));function handleEntityNotFound(_0x709cb6,_0x2a542f){return function(_0x22ae46){if(!_0x22ae46){_0x709cb6[_0x27af('0x6')](0x194);;}return _0x22ae46;};}function respondWithResult(_0x350532,_0x184630){_0x184630=_0x184630||0xc8;return function(_0x2193c6){if(_0x2193c6){return _0x350532['status'](_0x184630)[_0x27af('0x7')](_0x2193c6);}return null;};}function handleError(_0x366868,_0x389e97){_0x389e97=_0x389e97||0x1f4;return function(_0x583db8){logger[_0x27af('0x8')](_0x583db8[_0x27af('0x9')]);if(_0x583db8[_0x27af('0xa')]){delete _0x583db8['name'];}_0x366868[_0x27af('0xb')](_0x389e97)['send'](_0x583db8);};}function execChildProcess(){return new BPromise(function(_0x4d4729,_0x3e4b33){exec('npm\x20install',function(_0x50fe01,_0x184e25,_0x59c073){logger[_0x27af('0xc')](_0x184e25);logger['info'](_0x59c073);if(_0x50fe01){logger[_0x27af('0x8')](_0x50fe01);return _0x3e4b33(_0x50fe01);}return _0x4d4729(_0x184e25);});});}exports[_0x27af('0xd')]=function(_0x1fd964,_0x23f9ec){return pm2[_0x27af('0xe')]()[_0x27af('0xf')](function(_0x234825){if(_0x234825){var _0x3da435=_[_0x27af('0x10')](_0x234825,function(_0x4724e0){return _0x4724e0[_0x27af('0xa')]===_0x27af('0x11')||_0x4724e0[_0x27af('0xa')]===_0x27af('0x12');});return{'rows':_0x3da435,'count':_0x3da435[_0x27af('0x13')]};}return null;})[_0x27af('0xf')](respondWithResult(_0x23f9ec,null))[_0x27af('0x14')](handleError(_0x23f9ec,null));};exports[_0x27af('0x15')]=function(_0x58583a,_0x315661){return pm2[_0x27af('0x16')](_0x58583a['params']['id'])['then'](respondWithResult(_0x315661,null))[_0x27af('0xf')](handleEntityNotFound(_0x315661,null))[_0x27af('0x14')](handleError(_0x315661,null));};exports[_0x27af('0x17')]=function(_0x31573a,_0xec699a){if(_0x31573a['body'][_0x27af('0xa')]&&_0x31573a[_0x27af('0x18')][_0x27af('0x19')]){var _0x5e7c19=path[_0x27af('0x1a')](__dirname,_0x27af('0x1b'),_0x31573a[_0x27af('0x18')]['script']);var _0x2dce2b=process[_0x27af('0x1c')]();process[_0x27af('0x1d')](path[_0x27af('0x1e')](_0x5e7c19));return execChildProcess()[_0x27af('0xf')](function(_0x396156){process[_0x27af('0x1d')](_0x2dce2b);return pm2[_0x27af('0x1f')]({'name':_0x31573a[_0x27af('0x18')]['name'],'script':_0x5e7c19});})['then'](function(_0x4b8fe6){pm2[_0x27af('0x20')]();return _0x4b8fe6[0x0];})['then'](respondWithResult(_0xec699a,0xc9))[_0x27af('0x14')](handleError(_0xec699a,null));}else{return _0xec699a[_0x27af('0xb')](0x1f4)['send']({'message':_0x27af('0x21')});}};exports[_0x27af('0x22')]=function(_0x463e36,_0x424490){if(_0x463e36[_0x27af('0x18')]['id']){delete _0x463e36[_0x27af('0x18')]['id'];}var _0x775d4e={'online':'restart','stopped':_0x27af('0x23')};if(_0x775d4e[_0x27af('0x24')](_0x463e36[_0x27af('0x18')][_0x27af('0xb')])){return pm2[_0x775d4e[_0x463e36[_0x27af('0x18')][_0x27af('0xb')]]](_0x463e36[_0x27af('0x25')]['id'])[_0x27af('0xf')](respondWithResult(_0x424490,0xc8))[_0x27af('0x14')](handleError(_0x424490,null));}else{return _0x424490[_0x27af('0xb')](0x1f4)[_0x27af('0x26')]({'message':'Unknown\x20status'});}};exports[_0x27af('0x27')]=function(_0x14b2e7,_0x3800a1){if(_0x14b2e7[_0x27af('0x18')]['id']){delete _0x14b2e7[_0x27af('0x18')]['id'];}if(_0x14b2e7[_0x27af('0x25')]['id']){return pm2['delete'](_0x14b2e7['params']['id'])[_0x27af('0xf')](function(_0x37cb41){pm2['dump']();return _0x37cb41[0x0];})[_0x27af('0xf')](respondWithResult(_0x3800a1,null))[_0x27af('0x14')](handleError(_0x3800a1,null));}else{return _0x3800a1[_0x27af('0xb')](0x1f4)[_0x27af('0x26')]({'message':_0x27af('0x28')});}}; \ No newline at end of file +var _0xd2ea=['update','restart','stop','hasOwnProperty','Unknown\x20status','destroy','delete','lodash','../../config/pm2','../../config/logger','api','path','exec','bluebird','sendStatus','status','json','stack','name','send','npm\x20install','info','index','reject','express','motion2','length','then','catch','show','describe','params','create','body','script','join','../../files/plugins','cwd','chdir','dirname','start','dump','Missing\x20name\x20and/or\x20path'];(function(_0x10a5ea,_0x541876){var _0x3c8448=function(_0x1c4f3a){while(--_0x1c4f3a){_0x10a5ea['push'](_0x10a5ea['shift']());}};_0x3c8448(++_0x541876);}(_0xd2ea,0x15f));var _0xad2e=function(_0xa49c14,_0x26c05f){_0xa49c14=_0xa49c14-0x0;var _0x5a5179=_0xd2ea[_0xa49c14];return _0x5a5179;};'use strict';var _=require(_0xad2e('0x0'));var pm2=require(_0xad2e('0x1'));var logger=require(_0xad2e('0x2'))(_0xad2e('0x3'));var path=require(_0xad2e('0x4'));var exec=require('child_process')[_0xad2e('0x5')];var BPromise=require(_0xad2e('0x6'));function handleEntityNotFound(_0xcba7cb,_0x3e0741){return function(_0x2afdc4){if(!_0x2afdc4){_0xcba7cb[_0xad2e('0x7')](0x194);;}return _0x2afdc4;};}function respondWithResult(_0x29e97f,_0x592e8b){_0x592e8b=_0x592e8b||0xc8;return function(_0x3b5170){if(_0x3b5170){return _0x29e97f[_0xad2e('0x8')](_0x592e8b)[_0xad2e('0x9')](_0x3b5170);}return null;};}function handleError(_0x5710ac,_0x1e0e9e){_0x1e0e9e=_0x1e0e9e||0x1f4;return function(_0x19bb0d){logger['error'](_0x19bb0d[_0xad2e('0xa')]);if(_0x19bb0d['name']){delete _0x19bb0d[_0xad2e('0xb')];}_0x5710ac[_0xad2e('0x8')](_0x1e0e9e)[_0xad2e('0xc')](_0x19bb0d);};}function execChildProcess(){return new BPromise(function(_0x24c5da,_0x489f25){exec(_0xad2e('0xd'),function(_0x5707a5,_0x42d2ac,_0x347559){logger[_0xad2e('0xe')](_0x42d2ac);logger[_0xad2e('0xe')](_0x347559);if(_0x5707a5){logger['error'](_0x5707a5);return _0x489f25(_0x5707a5);}return _0x24c5da(_0x42d2ac);});});}exports[_0xad2e('0xf')]=function(_0x59201f,_0x1a91ce){return pm2['list']()['then'](function(_0x4a812b){if(_0x4a812b){var _0x5c96a7=_[_0xad2e('0x10')](_0x4a812b,function(_0x282780){return _0x282780[_0xad2e('0xb')]===_0xad2e('0x11')||_0x282780[_0xad2e('0xb')]===_0xad2e('0x12');});return{'rows':_0x5c96a7,'count':_0x5c96a7[_0xad2e('0x13')]};}return null;})[_0xad2e('0x14')](respondWithResult(_0x1a91ce,null))[_0xad2e('0x15')](handleError(_0x1a91ce,null));};exports[_0xad2e('0x16')]=function(_0x2af208,_0x39c5e4){return pm2[_0xad2e('0x17')](_0x2af208[_0xad2e('0x18')]['id'])[_0xad2e('0x14')](respondWithResult(_0x39c5e4,null))['then'](handleEntityNotFound(_0x39c5e4,null))[_0xad2e('0x15')](handleError(_0x39c5e4,null));};exports[_0xad2e('0x19')]=function(_0x489585,_0x50eb1a){if(_0x489585['body']['name']&&_0x489585[_0xad2e('0x1a')][_0xad2e('0x1b')]){var _0x5549db=path[_0xad2e('0x1c')](__dirname,_0xad2e('0x1d'),_0x489585[_0xad2e('0x1a')][_0xad2e('0x1b')]);var _0x23c0b6=process[_0xad2e('0x1e')]();process[_0xad2e('0x1f')](path[_0xad2e('0x20')](_0x5549db));return execChildProcess()[_0xad2e('0x14')](function(_0xd907a9){process[_0xad2e('0x1f')](_0x23c0b6);return pm2[_0xad2e('0x21')]({'name':_0x489585[_0xad2e('0x1a')]['name'],'script':_0x5549db});})[_0xad2e('0x14')](function(_0x2e8887){pm2[_0xad2e('0x22')]();return _0x2e8887[0x0];})[_0xad2e('0x14')](respondWithResult(_0x50eb1a,0xc9))[_0xad2e('0x15')](handleError(_0x50eb1a,null));}else{return _0x50eb1a[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':_0xad2e('0x23')});}};exports[_0xad2e('0x24')]=function(_0x50d446,_0x356a19){if(_0x50d446['body']['id']){delete _0x50d446[_0xad2e('0x1a')]['id'];}var _0x28ef72={'online':_0xad2e('0x25'),'stopped':_0xad2e('0x26')};if(_0x28ef72[_0xad2e('0x27')](_0x50d446[_0xad2e('0x1a')][_0xad2e('0x8')])){return pm2[_0x28ef72[_0x50d446[_0xad2e('0x1a')][_0xad2e('0x8')]]](_0x50d446[_0xad2e('0x18')]['id'])['then'](respondWithResult(_0x356a19,0xc8))[_0xad2e('0x15')](handleError(_0x356a19,null));}else{return _0x356a19[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':_0xad2e('0x28')});}};exports[_0xad2e('0x29')]=function(_0x9b4a23,_0x409f58){if(_0x9b4a23[_0xad2e('0x1a')]['id']){delete _0x9b4a23[_0xad2e('0x1a')]['id'];}if(_0x9b4a23[_0xad2e('0x18')]['id']){return pm2[_0xad2e('0x2a')](_0x9b4a23['params']['id'])[_0xad2e('0x14')](function(_0x55e1dc){pm2[_0xad2e('0x22')]();return _0x55e1dc[0x0];})[_0xad2e('0x14')](respondWithResult(_0x409f58,null))[_0xad2e('0x15')](handleError(_0x409f58,null));}else{return _0x409f58[_0xad2e('0x8')](0x1f4)[_0xad2e('0xc')]({'message':'Unknown\x20id'});}}; \ No newline at end of file diff --git a/server/api/realtime/index.js b/server/api/realtime/index.js index a1ff72f..cff70f6 100644 --- a/server/api/realtime/index.js +++ b/server/api/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9739=['../../components/auth/service','./realtime.controller','get','/agents','isAuthenticated','getAgents','/queues','getQueues','exports','express','Router'];(function(_0x24cffe,_0x20d7eb){var _0x5cdfe5=function(_0x4e7873){while(--_0x4e7873){_0x24cffe['push'](_0x24cffe['shift']());}};_0x5cdfe5(++_0x20d7eb);}(_0x9739,0x13d));var _0x9973=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0x9739[_0x34d346];return _0x122d76;};'use strict';var express=require(_0x9973('0x0'));var router=express[_0x9973('0x1')]();var auth=require(_0x9973('0x2'));var controller=require(_0x9973('0x3'));router[_0x9973('0x4')](_0x9973('0x5'),auth[_0x9973('0x6')](),controller[_0x9973('0x7')]);router[_0x9973('0x4')](_0x9973('0x8'),auth[_0x9973('0x6')](),controller[_0x9973('0x9')]);module[_0x9973('0xa')]=router; \ No newline at end of file +var _0x4a81=['./realtime.controller','get','/queues','isAuthenticated','getQueues','exports','Router','../../components/auth/service'];(function(_0x2706f2,_0x9a058){var _0x595bab=function(_0x54371f){while(--_0x54371f){_0x2706f2['push'](_0x2706f2['shift']());}};_0x595bab(++_0x9a058);}(_0x4a81,0xd6));var _0x14a8=function(_0x3ca75c,_0x2a9af8){_0x3ca75c=_0x3ca75c-0x0;var _0x978711=_0x4a81[_0x3ca75c];return _0x978711;};'use strict';var express=require('express');var router=express[_0x14a8('0x0')]();var auth=require(_0x14a8('0x1'));var controller=require(_0x14a8('0x2'));router[_0x14a8('0x3')]('/agents',auth['isAuthenticated'](),controller['getAgents']);router[_0x14a8('0x3')](_0x14a8('0x4'),auth[_0x14a8('0x5')](),controller[_0x14a8('0x6')]);module[_0x14a8('0x7')]=router; \ No newline at end of file diff --git a/server/api/realtime/realtime.controller.js b/server/api/realtime/realtime.controller.js index d27baa0..658ef37 100644 --- a/server/api/realtime/realtime.controller.js +++ b/server/api/realtime/realtime.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcca7=['pick','resolve','startCase','Queue','key','voice','outbound','dialActive','dialMethod','userProfileId','QueueCampaigns','Queues','name','assign','getRealtimeQueues','initializeQueues','lodash','util','../../components/realtime/agents','../../components/realtime/queues','../../mysqldb','APIBadRequestError','../../errors/api','handleError','undefined','limit','count','offset','status','set','Content-Range','json','getChannels','query','globalQueueFilter','pauseTypeFilter','pause','*pause','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','globalStatus','validateSortParameter','getUpdatedSortOptions','fields','join','order','getAgentIdsByQueues','getRealtimeAgents','rows','getAgentIdsByStatus','then','map','User','rawAttributes','fieldName','type','role','agent','getOptions','length','push','sequelize','FIELD(id,','forEach','Pause','where','merge','user','Agents','UserProfile','getResources','findAndCountAll','find','filterAgentAttributes','Status','sortAgentsByStatus','split'];(function(_0x4cfd4a,_0x340a41){var _0x42a03c=function(_0x3f3833){while(--_0x3f3833){_0x4cfd4a['push'](_0x4cfd4a['shift']());}};_0x42a03c(++_0x340a41);}(_0xcca7,0x1aa));var _0x7cca=function(_0x5e39ab,_0x137552){_0x5e39ab=_0x5e39ab-0x0;var _0x21cbce=_0xcca7[_0x5e39ab];return _0x21cbce;};'use strict';var _=require(_0x7cca('0x0'));var util=require(_0x7cca('0x1'));var rta=require(_0x7cca('0x2'));var rtq=require(_0x7cca('0x3'));var qs=require('../../components/parsers/qs');var utils=require('../../config/utils');var db=require(_0x7cca('0x4'))['db'];var APIBadRequestError=require('../../errors/api')[_0x7cca('0x5')];var APIHandleError=require(_0x7cca('0x6'))[_0x7cca('0x7')];function respondWithFilteredResult(_0x312e98,_0x1c6c95){return function(_0xe70805){if(_0xe70805){var _0x5aec51=typeof _0x1c6c95['offset']===_0x7cca('0x8')&&typeof _0x1c6c95[_0x7cca('0x9')]===_0x7cca('0x8');var _0x1e8cb9=_0xe70805[_0x7cca('0xa')];var _0xe800a5=_0x5aec51?0x0:_0x1c6c95[_0x7cca('0xb')];var _0x2b8b62=_0x5aec51?_0xe70805[_0x7cca('0xa')]:_0x1c6c95[_0x7cca('0xb')]+_0x1c6c95['limit'];var _0x302367;if(_0x2b8b62>=_0x1e8cb9){_0x2b8b62=_0x1e8cb9;_0x302367=0xc8;}else{_0x302367=0xce;}_0x312e98[_0x7cca('0xc')](_0x302367);return _0x312e98[_0x7cca('0xd')](_0x7cca('0xe'),_0xe800a5+'-'+_0x2b8b62+'/'+_0x1e8cb9)[_0x7cca('0xf')](_0xe70805);}return null;};}exports['getAgents']=function(_0x2a14cc,_0x41e0a2){var _0x2854c7={'count':0x0,'rows':[]};var _0x4d0d6d={};var _0x54e492;var _0x8ea157=utils[_0x7cca('0x10')]();var _0x27d671;var _0x847cce;var _0x444465=_0x2a14cc[_0x7cca('0x11')][_0x7cca('0x12')];var _0x5a357d=_0x2a14cc[_0x7cca('0x11')]['globalStatusFilter'];var _0x5cd551=_0x2a14cc['query'][_0x7cca('0x13')];var _0xbaf563=_0x5a357d===_0x7cca('0x14')||_0x5a357d===_0x7cca('0x15')?!![]:![];var _0x44294b=[];var _0x5e7c42;var _0xb35e1d;Promise['resolve']()['then'](function(){if(_0x2a14cc['query'][_0x7cca('0x16')]){if(!utils[_0x7cca('0x17')](_0x2a14cc[_0x7cca('0x11')][_0x7cca('0x16')])){throw new APIBadRequestError(util[_0x7cca('0x18')](_0x7cca('0x19'),_0x2a14cc[_0x7cca('0x11')][_0x7cca('0x16')]));}_0x54e492=_0x2a14cc['query'][_0x7cca('0x16')][_0x7cca('0x1a')]();}if(!_0x2a14cc[_0x7cca('0x11')][_0x7cca('0x1b')]||!_0x2a14cc['query'][_0x7cca('0x1b')][_0x7cca('0x1c')](_0x7cca('0x1d'))){_0x2a14cc[_0x7cca('0x11')][_0x7cca('0x1b')]=rta[_0x7cca('0x1e')](_0x2a14cc[_0x7cca('0x11')][_0x7cca('0x1b')]);return;}var _0x4b99b6=rta[_0x7cca('0x1f')](_0x2a14cc[_0x7cca('0x11')][_0x7cca('0x1b')]);_0x2a14cc[_0x7cca('0x11')][_0x7cca('0x1b')]=_0x4b99b6[_0x7cca('0x20')][_0x7cca('0x21')](',');_0x5e7c42=_0x4b99b6[_0x7cca('0x22')];})['then'](function(){if(!_0x444465){return[];}return rta[_0x7cca('0x23')](_0x444465,_0x54e492);})['then'](function(_0xc86c1b){_0x44294b=_0xc86c1b;return rta[_0x7cca('0x24')]();})['then'](function(_0x17b137){_0x847cce=_0x17b137[_0x7cca('0x25')];if((!_0x5a357d||_0xbaf563)&&!_0x5e7c42){return _0x44294b;}if(_0x5e7c42&&!_0x5a357d){return rta['getSortedAgentsIdsByStatus'](_0x847cce,_0x44294b,_0x5e7c42);}else{return rta[_0x7cca('0x26')](_0x847cce,_0x44294b,_0x5a357d);}})[_0x7cca('0x27')](function(_0x100061){_0x44294b=_0x100061;var _0x52fb40=![];if(_0x44294b['length']===0x0){if(_0x444465||_0x5a357d){_0x52fb40=!![];}if(_0xbaf563){_0x52fb40=![];}}if(_0x52fb40){return _0x2854c7;}var _0x41f5bc=_[_0x7cca('0x28')](db[_0x7cca('0x29')][_0x7cca('0x2a')],function(_0x34336c){return{'name':_0x34336c[_0x7cca('0x2b')],'type':_0x34336c[_0x7cca('0x2c')]['key']};});_0x2a14cc['query'][_0x7cca('0x2d')]=_0x7cca('0x2e');_0x2a14cc[_0x7cca('0x11')]['online']=!![];_0x4d0d6d=qs[_0x7cca('0x2f')](_0x41f5bc,_0x2a14cc);_0x4d0d6d['raw']=!![];var _0x2061fe=[];if(_0x44294b[_0x7cca('0x30')]>0x0){_0x2061fe[_0x7cca('0x31')]({'id':{'$in':_0x44294b}});if(_0x5e7c42&&!_0x5a357d){_0xb35e1d=[db[_0x7cca('0x32')]['literal'](_0x7cca('0x33')+_0x44294b+')')];_0x4d0d6d[_0x7cca('0x22')]=_0xb35e1d;}}if(_0xbaf563){_0x8ea157[_0x7cca('0x34')](function(_0x52eaf7){var _0x589542=!![];if(_0x5a357d==='*pause'&&_0x54e492!==_0x52eaf7){_0x589542=![];}_0x2061fe[_0x7cca('0x31')]({[_0x52eaf7+_0x7cca('0x35')]:_0x589542});});if(_0x5cd551){_0x2061fe['push']({'pauseType':_0x5cd551});}}else if(_0x5a357d){_0x8ea157[_0x7cca('0x34')](function(_0xc34146){_0x2061fe[_0x7cca('0x31')]({[_0xc34146+_0x7cca('0x35')]:![]});});}_0x4d0d6d[_0x7cca('0x36')]=_[_0x7cca('0x37')](_0x4d0d6d[_0x7cca('0x36')],{'$and':_0x2061fe});if(_0x2a14cc['user'][_0x7cca('0x2d')]===_0x7cca('0x38')){var _0x4128e5={'params':{'id':_0x2a14cc[_0x7cca('0x38')]['userProfileId']},'query':{'section':_0x7cca('0x39'),'role':_0x7cca('0x2e'),'online':!![],'raw':!![],'ids':_0x44294b,'customSorting':_0xb35e1d}};if(_0xbaf563){_0x4128e5[_0x7cca('0x11')]['extraQueryConditions']=_0x2061fe;}_0x4128e5[_0x7cca('0x11')]=Object['assign'](_0x4128e5[_0x7cca('0x11')],_0x2a14cc[_0x7cca('0x11')]);delete _0x4128e5[_0x7cca('0x11')]['id'];return db[_0x7cca('0x3a')][_0x7cca('0x3b')](_0x4128e5);}return db[_0x7cca('0x29')][_0x7cca('0x3c')](_0x4d0d6d);})[_0x7cca('0x27')](function(_0x3617b8){_0x2854c7['count']=_0x3617b8['count'];_0x27d671=_0x3617b8[_0x7cca('0x25')];return _0x27d671[_0x7cca('0x28')](function(_0x5cb715){var _0x48d87f=_[_0x7cca('0x3d')](_0x847cce,['id',_0x5cb715['id']]);if(_0x48d87f){var _0x2ca9bf=rta[_0x7cca('0x3e')](_0x48d87f);_[_0x7cca('0x37')](_0x5cb715,_0x2ca9bf);}_0x5cb715[_0x7cca('0x1d')]=rta['getAgentStatus'](_0x5cb715);if(_0x5cb715[_0x7cca('0x1d')]['includes']('pause')){_0x8ea157[_0x7cca('0x34')](function(_0x33d069){if(_0x5cb715[_0x33d069+'Pause']){_0x5cb715[_0x33d069+_0x7cca('0x3f')]='pause';}});}return _0x5cb715;});})[_0x7cca('0x27')](function(_0x3edb26){if(!_0x5e7c42||_0xb35e1d){return _0x3edb26;}return rta[_0x7cca('0x40')](_0x3edb26,_0x5e7c42);})['then'](function(_0xb966da){var _0x207250=null;if(_0x2a14cc[_0x7cca('0x11')][_0x7cca('0x20')]){var _0x516774=_0x2a14cc[_0x7cca('0x11')][_0x7cca('0x20')][_0x7cca('0x41')](',');_0x207250=_0xb966da[_0x7cca('0x28')](function(_0x2aa126){return _[_0x7cca('0x42')](_0x2aa126,_0x516774);});}_0x2854c7['rows']=_0x207250||_0xb966da;return _0x2854c7;})['then'](respondWithFilteredResult(_0x41e0a2,_0x4d0d6d))['catch'](APIHandleError(_0x41e0a2));};exports['getQueues']=function(_0x643649,_0x4f2d5d){var _0x51e564={'count':0x0,'rows':[]};var _0x272828={};var _0x258d0b;var _0x2d9a28;var _0x2bf218;Promise[_0x7cca('0x43')]()['then'](function(){if(_0x643649[_0x7cca('0x11')][_0x7cca('0x16')]){if(!utils[_0x7cca('0x17')](_0x643649[_0x7cca('0x11')][_0x7cca('0x16')])){throw new APIBadRequestError(util[_0x7cca('0x18')](_0x7cca('0x19'),_0x643649[_0x7cca('0x11')][_0x7cca('0x16')]));}_0x258d0b=_0x643649[_0x7cca('0x11')][_0x7cca('0x16')]['toLowerCase']();}var _0x504fd7=_[_0x7cca('0x44')](_0x258d0b)+_0x7cca('0x45');var _0x40eb40=_[_0x7cca('0x28')](db[_0x504fd7][_0x7cca('0x2a')],function(_0x461c79){return{'name':_0x461c79[_0x7cca('0x2b')],'type':_0x461c79[_0x7cca('0x2c')][_0x7cca('0x46')]};});if(!_0x643649[_0x7cca('0x11')][_0x7cca('0x20')]){var _0x3eb069=['id','name'];if(_0x258d0b===_0x7cca('0x47')){_0x3eb069[_0x7cca('0x31')](_0x7cca('0x2c'));if(_0x643649[_0x7cca('0x11')][_0x7cca('0x2c')]===_0x7cca('0x48')){_0x3eb069[_0x7cca('0x31')]([_0x7cca('0x49'),_0x7cca('0x4a')]);}}_0x643649[_0x7cca('0x11')][_0x7cca('0x20')]=_0x3eb069[_0x7cca('0x21')](',');}_0x272828=qs[_0x7cca('0x2f')](_0x40eb40,_0x643649);if(_0x643649[_0x7cca('0x38')][_0x7cca('0x2d')]===_0x7cca('0x38')){var _0x45d6ff={'params':{'id':_0x643649[_0x7cca('0x38')][_0x7cca('0x4b')]},'query':{'section':_0x258d0b===_0x7cca('0x47')&&_0x643649[_0x7cca('0x11')][_0x7cca('0x2c')]===_0x7cca('0x48')?_0x7cca('0x4c'):_[_0x7cca('0x44')](_0x258d0b)+_0x7cca('0x4d'),'type':_0x643649['query'][_0x7cca('0x2c')],'nolimit':!![],'sort':_0x7cca('0x4e'),'filter':_0x643649['query']['filter']}};_0x45d6ff['query']=Object[_0x7cca('0x4f')](_0x45d6ff[_0x7cca('0x11')],_0x643649['query']);delete _0x45d6ff[_0x7cca('0x11')]['id'];return db[_0x7cca('0x3a')]['getResources'](_0x45d6ff);}return db[_0x504fd7][_0x7cca('0x3c')](_0x272828);})['then'](function(_0x1aa39b){_0x51e564[_0x7cca('0xa')]=_0x1aa39b[_0x7cca('0xa')];_0x2d9a28=_0x1aa39b[_0x7cca('0x25')];return rtq[_0x7cca('0x50')](_0x643649,_0x258d0b);})[_0x7cca('0x27')](function(_0x286c77){_0x2bf218=_0x286c77[_0x7cca('0x25')];return rtq[_0x7cca('0x51')](_0x2d9a28,_0x2bf218,_0x258d0b,_0x643649[_0x7cca('0x11')][_0x7cca('0x2c')]);})[_0x7cca('0x27')](function(_0xb359da){_0x51e564['rows']=_0xb359da;return _0x51e564;})[_0x7cca('0x27')](respondWithFilteredResult(_0x4f2d5d,_0x272828))['catch'](APIHandleError(_0x4f2d5d));}; \ No newline at end of file +var _0x5636=['split','pick','catch','resolve','startCase','Queue','name','voice','dialMethod','userProfileId','QueueCampaigns','Queues','filter','getRealtimeQueues','initializeQueues','lodash','util','../../config/utils','../../mysqldb','../../errors/api','handleError','offset','undefined','limit','count','set','Content-Range','json','getAgents','getChannels','query','globalQueueFilter','globalStatusFilter','then','channel','isValidChannel','format','Channel\x20parameter\x20%s\x20is\x20invalid','toLowerCase','sort','includes','join','order','getAgentIdsByQueues','rows','getSortedAgentsIdsByStatus','getAgentIdsByStatus','map','User','rawAttributes','fieldName','type','key','role','agent','online','getOptions','raw','length','push','sequelize','FIELD(id,','forEach','*pause','Pause','where','user','Agents','extraQueryConditions','assign','UserProfile','getResources','findAndCountAll','find','merge','globalStatus','getAgentStatus','Status','pause','sortAgentsByStatus','fields'];(function(_0x72f0ab,_0xdce6fd){var _0x4041ba=function(_0x2fc978){while(--_0x2fc978){_0x72f0ab['push'](_0x72f0ab['shift']());}};_0x4041ba(++_0xdce6fd);}(_0x5636,0x102));var _0x6563=function(_0x127463,_0x263d98){_0x127463=_0x127463-0x0;var _0x1ea601=_0x5636[_0x127463];return _0x1ea601;};'use strict';var _=require(_0x6563('0x0'));var util=require(_0x6563('0x1'));var rta=require('../../components/realtime/agents');var rtq=require('../../components/realtime/queues');var qs=require('../../components/parsers/qs');var utils=require(_0x6563('0x2'));var db=require(_0x6563('0x3'))['db'];var APIBadRequestError=require(_0x6563('0x4'))['APIBadRequestError'];var APIHandleError=require(_0x6563('0x4'))[_0x6563('0x5')];function respondWithFilteredResult(_0x453da9,_0x39792f){return function(_0x29f687){if(_0x29f687){var _0x193942=typeof _0x39792f[_0x6563('0x6')]===_0x6563('0x7')&&typeof _0x39792f[_0x6563('0x8')]===_0x6563('0x7');var _0x11a7a9=_0x29f687[_0x6563('0x9')];var _0x3ccb4e=_0x193942?0x0:_0x39792f['offset'];var _0x51fdc2=_0x193942?_0x29f687[_0x6563('0x9')]:_0x39792f[_0x6563('0x6')]+_0x39792f['limit'];var _0x506ee9;if(_0x51fdc2>=_0x11a7a9){_0x51fdc2=_0x11a7a9;_0x506ee9=0xc8;}else{_0x506ee9=0xce;}_0x453da9['status'](_0x506ee9);return _0x453da9[_0x6563('0xa')](_0x6563('0xb'),_0x3ccb4e+'-'+_0x51fdc2+'/'+_0x11a7a9)[_0x6563('0xc')](_0x29f687);}return null;};}exports[_0x6563('0xd')]=function(_0x33816e,_0x2ed676){var _0x31d3fa={'count':0x0,'rows':[]};var _0xbbae72={};var _0x447f9a;var _0x51aeca=utils[_0x6563('0xe')]();var _0x5e9329;var _0x37131e;var _0x59bee1=_0x33816e[_0x6563('0xf')][_0x6563('0x10')];var _0x5af5d0=_0x33816e[_0x6563('0xf')][_0x6563('0x11')];var _0x477d9b=_0x33816e[_0x6563('0xf')]['pauseTypeFilter'];var _0x3563fd=_0x5af5d0==='pause'||_0x5af5d0==='*pause'?!![]:![];var _0x47972a=[];var _0x14c6a6;var _0x4f5609;Promise['resolve']()[_0x6563('0x12')](function(){if(_0x33816e[_0x6563('0xf')][_0x6563('0x13')]){if(!utils[_0x6563('0x14')](_0x33816e[_0x6563('0xf')][_0x6563('0x13')])){throw new APIBadRequestError(util[_0x6563('0x15')](_0x6563('0x16'),_0x33816e[_0x6563('0xf')]['channel']));}_0x447f9a=_0x33816e[_0x6563('0xf')][_0x6563('0x13')][_0x6563('0x17')]();}if(!_0x33816e['query'][_0x6563('0x18')]||!_0x33816e['query'][_0x6563('0x18')][_0x6563('0x19')]('globalStatus')){_0x33816e['query'][_0x6563('0x18')]=rta['validateSortParameter'](_0x33816e[_0x6563('0xf')][_0x6563('0x18')]);return;}var _0x20d152=rta['getUpdatedSortOptions'](_0x33816e[_0x6563('0xf')]['sort']);_0x33816e[_0x6563('0xf')][_0x6563('0x18')]=_0x20d152['fields'][_0x6563('0x1a')](',');_0x14c6a6=_0x20d152[_0x6563('0x1b')];})['then'](function(){if(!_0x59bee1){return[];}return rta[_0x6563('0x1c')](_0x59bee1,_0x447f9a);})['then'](function(_0x1fe1cb){_0x47972a=_0x1fe1cb;return rta['getRealtimeAgents']();})['then'](function(_0x30f05a){_0x37131e=_0x30f05a[_0x6563('0x1d')];if((!_0x5af5d0||_0x3563fd)&&!_0x14c6a6){return _0x47972a;}if(_0x14c6a6&&!_0x5af5d0){return rta[_0x6563('0x1e')](_0x37131e,_0x47972a,_0x14c6a6);}else{return rta[_0x6563('0x1f')](_0x37131e,_0x47972a,_0x5af5d0);}})[_0x6563('0x12')](function(_0x4b4d3b){_0x47972a=_0x4b4d3b;var _0x3c8bd1=![];if(_0x47972a['length']===0x0){if(_0x59bee1||_0x5af5d0){_0x3c8bd1=!![];}if(_0x3563fd){_0x3c8bd1=![];}}if(_0x3c8bd1){return _0x31d3fa;}var _0x5b100b=_[_0x6563('0x20')](db[_0x6563('0x21')][_0x6563('0x22')],function(_0xdbbdda){return{'name':_0xdbbdda[_0x6563('0x23')],'type':_0xdbbdda[_0x6563('0x24')][_0x6563('0x25')]};});_0x33816e[_0x6563('0xf')][_0x6563('0x26')]=_0x6563('0x27');_0x33816e['query'][_0x6563('0x28')]=!![];_0xbbae72=qs[_0x6563('0x29')](_0x5b100b,_0x33816e);_0xbbae72[_0x6563('0x2a')]=!![];var _0x1558fb=[];if(_0x47972a[_0x6563('0x2b')]>0x0){_0x1558fb[_0x6563('0x2c')]({'id':{'$in':_0x47972a}});if(_0x14c6a6&&!_0x5af5d0){_0x4f5609=[db[_0x6563('0x2d')]['literal'](_0x6563('0x2e')+_0x47972a+')')];_0xbbae72[_0x6563('0x1b')]=_0x4f5609;}}if(_0x3563fd){_0x51aeca[_0x6563('0x2f')](function(_0x46fb1b){var _0x3f79da=!![];if(_0x5af5d0===_0x6563('0x30')&&_0x447f9a!==_0x46fb1b){_0x3f79da=![];}_0x1558fb['push']({[_0x46fb1b+_0x6563('0x31')]:_0x3f79da});});if(_0x477d9b){_0x1558fb[_0x6563('0x2c')]({'pauseType':_0x477d9b});}}else if(_0x5af5d0){_0x51aeca[_0x6563('0x2f')](function(_0x33aa0b){_0x1558fb[_0x6563('0x2c')]({[_0x33aa0b+_0x6563('0x31')]:![]});});}_0xbbae72[_0x6563('0x32')]=_['merge'](_0xbbae72[_0x6563('0x32')],{'$and':_0x1558fb});if(_0x33816e[_0x6563('0x33')]['role']===_0x6563('0x33')){var _0x1ff47d={'params':{'id':_0x33816e['user']['userProfileId']},'query':{'section':_0x6563('0x34'),'role':_0x6563('0x27'),'online':!![],'raw':!![],'ids':_0x47972a,'customSorting':_0x4f5609}};if(_0x3563fd){_0x1ff47d[_0x6563('0xf')][_0x6563('0x35')]=_0x1558fb;}_0x1ff47d['query']=Object[_0x6563('0x36')](_0x1ff47d[_0x6563('0xf')],_0x33816e['query']);delete _0x1ff47d[_0x6563('0xf')]['id'];return db[_0x6563('0x37')][_0x6563('0x38')](_0x1ff47d);}return db[_0x6563('0x21')][_0x6563('0x39')](_0xbbae72);})[_0x6563('0x12')](function(_0x95e404){_0x31d3fa[_0x6563('0x9')]=_0x95e404[_0x6563('0x9')];_0x5e9329=_0x95e404['rows'];return _0x5e9329[_0x6563('0x20')](function(_0x772286){var _0x3b7a24=_[_0x6563('0x3a')](_0x37131e,['id',_0x772286['id']]);if(_0x3b7a24){var _0x5ebe88=rta['filterAgentAttributes'](_0x3b7a24);_[_0x6563('0x3b')](_0x772286,_0x5ebe88);}_0x772286[_0x6563('0x3c')]=rta[_0x6563('0x3d')](_0x772286);if(_0x772286['globalStatus'][_0x6563('0x19')]('pause')){_0x51aeca[_0x6563('0x2f')](function(_0x9d8d1a){if(_0x772286[_0x9d8d1a+'Pause']){_0x772286[_0x9d8d1a+_0x6563('0x3e')]=_0x6563('0x3f');}});}return _0x772286;});})[_0x6563('0x12')](function(_0xcf92cd){if(!_0x14c6a6||_0x4f5609){return _0xcf92cd;}return rta[_0x6563('0x40')](_0xcf92cd,_0x14c6a6);})[_0x6563('0x12')](function(_0x2dde9f){var _0x32932f=null;if(_0x33816e[_0x6563('0xf')][_0x6563('0x41')]){var _0x2acb52=_0x33816e['query']['fields'][_0x6563('0x42')](',');_0x32932f=_0x2dde9f[_0x6563('0x20')](function(_0x43a33e){return _[_0x6563('0x43')](_0x43a33e,_0x2acb52);});}_0x31d3fa[_0x6563('0x1d')]=_0x32932f||_0x2dde9f;return _0x31d3fa;})[_0x6563('0x12')](respondWithFilteredResult(_0x2ed676,_0xbbae72))[_0x6563('0x44')](APIHandleError(_0x2ed676));};exports['getQueues']=function(_0x1c9535,_0x52f709){var _0x41fff0={'count':0x0,'rows':[]};var _0xdb9a23={};var _0x4c56ad;var _0x355c97;var _0x21131a;Promise[_0x6563('0x45')]()[_0x6563('0x12')](function(){if(_0x1c9535[_0x6563('0xf')]['channel']){if(!utils['isValidChannel'](_0x1c9535[_0x6563('0xf')][_0x6563('0x13')])){throw new APIBadRequestError(util[_0x6563('0x15')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x1c9535[_0x6563('0xf')][_0x6563('0x13')]));}_0x4c56ad=_0x1c9535[_0x6563('0xf')][_0x6563('0x13')]['toLowerCase']();}var _0x417731=_[_0x6563('0x46')](_0x4c56ad)+_0x6563('0x47');var _0x55e927=_[_0x6563('0x20')](db[_0x417731]['rawAttributes'],function(_0xb80d6a){return{'name':_0xb80d6a['fieldName'],'type':_0xb80d6a['type'][_0x6563('0x25')]};});if(!_0x1c9535[_0x6563('0xf')][_0x6563('0x41')]){var _0xb84325=['id',_0x6563('0x48')];if(_0x4c56ad===_0x6563('0x49')){_0xb84325[_0x6563('0x2c')](_0x6563('0x24'));if(_0x1c9535[_0x6563('0xf')][_0x6563('0x24')]==='outbound'){_0xb84325[_0x6563('0x2c')](['dialActive',_0x6563('0x4a')]);}}_0x1c9535[_0x6563('0xf')][_0x6563('0x41')]=_0xb84325['join'](',');}_0xdb9a23=qs[_0x6563('0x29')](_0x55e927,_0x1c9535);if(_0x1c9535[_0x6563('0x33')]['role']===_0x6563('0x33')){var _0x391d23={'params':{'id':_0x1c9535[_0x6563('0x33')][_0x6563('0x4b')]},'query':{'section':_0x4c56ad===_0x6563('0x49')&&_0x1c9535['query'][_0x6563('0x24')]==='outbound'?_0x6563('0x4c'):_['startCase'](_0x4c56ad)+_0x6563('0x4d'),'type':_0x1c9535['query']['type'],'nolimit':!![],'sort':'name','filter':_0x1c9535['query'][_0x6563('0x4e')]}};_0x391d23['query']=Object[_0x6563('0x36')](_0x391d23['query'],_0x1c9535[_0x6563('0xf')]);delete _0x391d23[_0x6563('0xf')]['id'];return db[_0x6563('0x37')][_0x6563('0x38')](_0x391d23);}return db[_0x417731][_0x6563('0x39')](_0xdb9a23);})[_0x6563('0x12')](function(_0x23c94a){_0x41fff0[_0x6563('0x9')]=_0x23c94a[_0x6563('0x9')];_0x355c97=_0x23c94a['rows'];return rtq[_0x6563('0x4f')](_0x1c9535,_0x4c56ad);})[_0x6563('0x12')](function(_0x97ee3){_0x21131a=_0x97ee3[_0x6563('0x1d')];return rtq[_0x6563('0x50')](_0x355c97,_0x21131a,_0x4c56ad,_0x1c9535[_0x6563('0xf')][_0x6563('0x24')]);})[_0x6563('0x12')](function(_0xb83e51){_0x41fff0[_0x6563('0x1d')]=_0xb83e51;return _0x41fff0;})[_0x6563('0x12')](respondWithFilteredResult(_0x52f709,_0xdb9a23))['catch'](APIHandleError(_0x52f709));}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/index.js b/server/api/reportAgentPreview/index.js index b051a28..68b519b 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 _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3c9838,_0x435eb1){var _0x24c2ae=function(_0x189d25){while(--_0x189d25){_0x3c9838['push'](_0x3c9838['shift']());}};_0x24c2ae(++_0x435eb1);}(_0xe706,0xa3));var _0x6e70=function(_0x1e5c8d,_0x1bd355){_0x1e5c8d=_0x1e5c8d-0x0;var _0x17f720=_0xe706[_0x1e5c8d];return _0x17f720;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x26c1ed,_0x4d953f){var _0x8455bc=function(_0x297b4a){while(--_0x297b4a){_0x26c1ed['push'](_0x26c1ed['shift']());}};_0x8455bc(++_0x4d953f);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x50f0a9,_0x2b0c57){_0x50f0a9=_0x50f0a9-0x0;var _0x5a33d9=_0xcb91[_0x50f0a9];return _0x5a33d9;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.attributes.js b/server/api/reportAgentPreview/reportAgentPreview.attributes.js index 322b63a..aa65dba 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 _0xf360=['INTEGER','DATE','STRING','sequelize','exports'];(function(_0x1be3ff,_0x285342){var _0x10bd91=function(_0x27fe9f){while(--_0x27fe9f){_0x1be3ff['push'](_0x1be3ff['shift']());}};_0x10bd91(++_0x285342);}(_0xf360,0x9e));var _0x0f36=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xf360[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0f36('0x0'));module[_0x0f36('0x1')]={'state':{'type':Sequelize[_0x0f36('0x2')](0x2)},'statedesc':{'type':Sequelize['STRING']},'scheduledat':{'type':Sequelize[_0x0f36('0x3')]},'uniqueid':{'type':Sequelize['STRING']},'starttime':{'type':Sequelize[_0x0f36('0x3')]},'responsetime':{'type':Sequelize[_0x0f36('0x3')]},'ringtime':{'type':Sequelize[_0x0f36('0x2')],'defaultValue':0x0},'campaign':{'type':Sequelize['STRING']},'campaigntype':{'type':Sequelize[_0x0f36('0x4')]},'membername':{'type':Sequelize[_0x0f36('0x4')]}}; \ No newline at end of file +var _0x06bf=['DATE','sequelize','exports','INTEGER','STRING'];(function(_0x432682,_0x253044){var _0x463d05=function(_0xa73403){while(--_0xa73403){_0x432682['push'](_0x432682['shift']());}};_0x463d05(++_0x253044);}(_0x06bf,0x105));var _0xf06b=function(_0x174a37,_0x1cf3e7){_0x174a37=_0x174a37-0x0;var _0x435a10=_0x06bf[_0x174a37];return _0x435a10;};'use strict';var Sequelize=require(_0xf06b('0x0'));module[_0xf06b('0x1')]={'state':{'type':Sequelize[_0xf06b('0x2')](0x2)},'statedesc':{'type':Sequelize[_0xf06b('0x3')]},'scheduledat':{'type':Sequelize[_0xf06b('0x4')]},'uniqueid':{'type':Sequelize[_0xf06b('0x3')]},'starttime':{'type':Sequelize[_0xf06b('0x4')]},'responsetime':{'type':Sequelize[_0xf06b('0x4')]},'ringtime':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'campaign':{'type':Sequelize[_0xf06b('0x3')]},'campaigntype':{'type':Sequelize[_0xf06b('0x3')]},'membername':{'type':Sequelize[_0xf06b('0x3')]}}; \ No newline at end of file diff --git a/server/api/reportAgentPreview/reportAgentPreview.model.js b/server/api/reportAgentPreview/reportAgentPreview.model.js index 8f2990a..7f88541 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 _0x2e3b=['lodash','util','api','moment','bluebird','request-promise','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview'];(function(_0x386129,_0x414a79){var _0x9af1f4=function(_0x57cf06){while(--_0x57cf06){_0x386129['push'](_0x386129['shift']());}};_0x9af1f4(++_0x414a79);}(_0x2e3b,0x1ba));var _0xb2e3=function(_0xe0c176,_0x2ec47f){_0xe0c176=_0xe0c176-0x0;var _0xfd8ae3=_0x2e3b[_0xe0c176];return _0xfd8ae3;};'use strict';var _=require(_0xb2e3('0x0'));var util=require(_0xb2e3('0x1'));var logger=require('../../config/logger')(_0xb2e3('0x2'));var moment=require(_0xb2e3('0x3'));var BPromise=require(_0xb2e3('0x4'));var rp=require(_0xb2e3('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xb2e3('0x6'));var config=require(_0xb2e3('0x7'));var attributes=require(_0xb2e3('0x8'));module[_0xb2e3('0x9')]=function(_0x20845f,_0x27bffa){return _0x20845f[_0xb2e3('0xa')](_0xb2e3('0xb'),attributes,{'tableName':_0xb2e3('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x21c4=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./reportAgentPreview.attributes','exports','define','ReportAgentPreview','report_agent_preview'];(function(_0xa6fde1,_0x3625aa){var _0x103037=function(_0x36c484){while(--_0x36c484){_0xa6fde1['push'](_0xa6fde1['shift']());}};_0x103037(++_0x3625aa);}(_0x21c4,0xea));var _0x421c=function(_0x10b434,_0x521745){_0x10b434=_0x10b434-0x0;var _0x31050b=_0x21c4[_0x10b434];return _0x31050b;};'use strict';var _=require('lodash');var util=require(_0x421c('0x0'));var logger=require('../../config/logger')(_0x421c('0x1'));var moment=require(_0x421c('0x2'));var BPromise=require(_0x421c('0x3'));var rp=require(_0x421c('0x4'));var fs=require('fs');var path=require(_0x421c('0x5'));var rimraf=require(_0x421c('0x6'));var config=require(_0x421c('0x7'));var attributes=require(_0x421c('0x8'));module[_0x421c('0x9')]=function(_0x376edc,_0x3b5c16){return _0x376edc[_0x421c('0xa')](_0x421c('0xb'),attributes,{'tableName':_0x421c('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 726b489..8ee46f1 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 _0x8e7c=['catch','CreateReportAgentPreview','ReportAgentPreview','body','options','raw','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result'];(function(_0x641451,_0x9c5d0f){var _0x4e57a6=function(_0x174a2a){while(--_0x174a2a){_0x641451['push'](_0x641451['shift']());}};_0x4e57a6(++_0x9c5d0f);}(_0x8e7c,0x129));var _0xc8e7=function(_0x1bea92,_0x1a4394){_0x1bea92=_0x1bea92-0x0;var _0x2a021a=_0x8e7c[_0x1bea92];return _0x2a021a;};'use strict';var _=require(_0xc8e7('0x0'));var util=require(_0xc8e7('0x1'));var moment=require(_0xc8e7('0x2'));var BPromise=require(_0xc8e7('0x3'));var rs=require(_0xc8e7('0x4'));var fs=require('fs');var Redis=require(_0xc8e7('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc8e7('0x6'))(_0xc8e7('0x7'));var config=require(_0xc8e7('0x8'));var jayson=require(_0xc8e7('0x9'));var client=jayson[_0xc8e7('0xa')][_0xc8e7('0xb')]({'port':0x232a});function respondWithRpcPromise(_0xddeaa1,_0x27af9f,_0x11c3c3){return new BPromise(function(_0x4a793c,_0x5758ec){return client[_0xc8e7('0xc')](_0xddeaa1,_0x11c3c3)[_0xc8e7('0xd')](function(_0x26e704){logger[_0xc8e7('0xe')](_0xc8e7('0xf'),_0x27af9f,'request\x20sent');logger['debug']('ReportAgentPreview,\x20%s,\x20%s,\x20%s',_0x27af9f,_0xc8e7('0x10'),JSON[_0xc8e7('0x11')](_0x26e704));if(_0x26e704[_0xc8e7('0x12')]){if(_0x26e704[_0xc8e7('0x12')][_0xc8e7('0x13')]===0x1f4){logger['error'](_0xc8e7('0xf'),_0x27af9f,_0x26e704[_0xc8e7('0x12')][_0xc8e7('0x14')]);return _0x5758ec(_0x26e704[_0xc8e7('0x12')][_0xc8e7('0x14')]);}logger[_0xc8e7('0x12')](_0xc8e7('0xf'),_0x27af9f,_0x26e704[_0xc8e7('0x12')][_0xc8e7('0x14')]);return _0x4a793c(_0x26e704[_0xc8e7('0x12')][_0xc8e7('0x14')]);}else{logger[_0xc8e7('0xe')](_0xc8e7('0xf'),_0x27af9f,_0xc8e7('0x10'));_0x4a793c(_0x26e704[_0xc8e7('0x15')][_0xc8e7('0x14')]);}})[_0xc8e7('0x16')](function(_0x5ba62e){logger['error'](_0xc8e7('0xf'),_0x27af9f,_0x5ba62e);_0x5758ec(_0x5ba62e);});});}exports[_0xc8e7('0x17')]=function(_0x2bdf2c){var _0x9c6c9a=this;return new Promise(function(_0x4493d7,_0x203b6f){return db[_0xc8e7('0x18')]['create'](_0x2bdf2c[_0xc8e7('0x19')],{'raw':_0x2bdf2c[_0xc8e7('0x1a')]?_0x2bdf2c['options'][_0xc8e7('0x1b')]===undefined?!![]:![]:!![]})[_0xc8e7('0xd')](function(_0x5c8bba){logger[_0xc8e7('0xe')](_0xc8e7('0x17'),_0x2bdf2c);logger[_0xc8e7('0x1c')](_0xc8e7('0x17'),_0x2bdf2c,JSON[_0xc8e7('0x11')](_0x5c8bba));_0x4493d7(_0x5c8bba);})['catch'](function(_0x5d5966){logger['error'](_0xc8e7('0x17'),_0x5d5966['message'],_0x2bdf2c);_0x203b6f(_0x9c6c9a['error'](0x1f4,_0x5d5966['message']));});});}; \ No newline at end of file +var _0xdec6=['result','catch','ReportAgentPreview','body','options','raw','CreateReportAgentPreview','debug','stringify','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','jayson/promise','client','request','then','info','ReportAgentPreview,\x20%s,\x20%s','request\x20sent','ReportAgentPreview,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0x5608a3,_0x5b33c5){var _0x1ed50a=function(_0x959171){while(--_0x959171){_0x5608a3['push'](_0x5608a3['shift']());}};_0x1ed50a(++_0x5b33c5);}(_0xdec6,0xa5));var _0x6dec=function(_0x187ee1,_0x3fd1e6){_0x187ee1=_0x187ee1-0x0;var _0x388160=_0xdec6[_0x187ee1];return _0x388160;};'use strict';var _=require(_0x6dec('0x0'));var util=require(_0x6dec('0x1'));var moment=require(_0x6dec('0x2'));var BPromise=require(_0x6dec('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6dec('0x4'))['db'];var utils=require(_0x6dec('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6dec('0x6'));var client=jayson[_0x6dec('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x55c1e6,_0x4f783a,_0x2fd48b){return new BPromise(function(_0x3fc971,_0x20776e){return client[_0x6dec('0x8')](_0x55c1e6,_0x2fd48b)[_0x6dec('0x9')](function(_0x29743f){logger[_0x6dec('0xa')](_0x6dec('0xb'),_0x4f783a,_0x6dec('0xc'));logger['debug'](_0x6dec('0xd'),_0x4f783a,_0x6dec('0xc'),JSON['stringify'](_0x29743f));if(_0x29743f[_0x6dec('0xe')]){if(_0x29743f[_0x6dec('0xe')][_0x6dec('0xf')]===0x1f4){logger[_0x6dec('0xe')](_0x6dec('0xb'),_0x4f783a,_0x29743f['error'][_0x6dec('0x10')]);return _0x20776e(_0x29743f[_0x6dec('0xe')][_0x6dec('0x10')]);}logger[_0x6dec('0xe')](_0x6dec('0xb'),_0x4f783a,_0x29743f[_0x6dec('0xe')]['message']);return _0x3fc971(_0x29743f[_0x6dec('0xe')][_0x6dec('0x10')]);}else{logger[_0x6dec('0xa')]('ReportAgentPreview,\x20%s,\x20%s',_0x4f783a,_0x6dec('0xc'));_0x3fc971(_0x29743f[_0x6dec('0x11')][_0x6dec('0x10')]);}})[_0x6dec('0x12')](function(_0x340514){logger[_0x6dec('0xe')](_0x6dec('0xb'),_0x4f783a,_0x340514);_0x20776e(_0x340514);});});}exports['CreateReportAgentPreview']=function(_0x6322b){var _0x525ffc=this;return new Promise(function(_0x420cec,_0x28e105){return db[_0x6dec('0x13')]['create'](_0x6322b[_0x6dec('0x14')],{'raw':_0x6322b['options']?_0x6322b[_0x6dec('0x15')][_0x6dec('0x16')]===undefined?!![]:![]:!![]})[_0x6dec('0x9')](function(_0x2e1c86){logger[_0x6dec('0xa')](_0x6dec('0x17'),_0x6322b);logger[_0x6dec('0x18')]('CreateReportAgentPreview',_0x6322b,JSON[_0x6dec('0x19')](_0x2e1c86));_0x420cec(_0x2e1c86);})['catch'](function(_0x1fcc37){logger[_0x6dec('0xe')](_0x6dec('0x17'),_0x1fcc37[_0x6dec('0x10')],_0x6322b);_0x28e105(_0x525ffc['error'](0x1f4,_0x1fcc37[_0x6dec('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/rpc/index.js b/server/api/rpc/index.js index b29281a..6ac257a 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 _0xf813=['../../components/auth/service','./rpc.controller','get','/voice/channels','isAuthenticated','/voice/channels/:uniqueid/mixmonitor','voiceChannelMixMonitor','/voice/channels/:uniqueid/stopmixmonitor','voiceChannelStopMixMonitor','voiceQueues','/chat/queues','/mail/queues','mailAccounts','openchannelQueues','/sms/queues','smsQueues','/whatsapp/queues','faxQueues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','/voice/queues/channels/:uniqueid/hangup','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','put','updateVoiceQueue','/outbound','outbound','/outbound/channels','outboundChannels','/agents','/agents/:id/capacity','agentCapacity','/telephones','trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','/openchannel/queues/:id/waitinginteractions','openchannelQueuesIdWaitingInteractions','smsQueuesWaitingInteractions','/whatsapp/queues/waitinginteractions','whatsappQueuesWaitingInteractions','post','/mail/queues/:id/notify','queueNotify','mail','/mail/queues/:id','showMailQueues','/chat/queues/:id/notify','/chat/queues/:id','showChatQueues','/fax/queues/:id/notify','fax','openchannel','showOpenchannelQueues','sms','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','/agents/:id/notify','agentNotify','multer','path','express'];(function(_0x4ded65,_0xc8d7c1){var _0x5864fb=function(_0x40df9d){while(--_0x40df9d){_0x4ded65['push'](_0x4ded65['shift']());}};_0x5864fb(++_0xc8d7c1);}(_0xf813,0xde));var _0x3f81=function(_0x3c4087,_0x5c764b){_0x3c4087=_0x3c4087-0x0;var _0x23ad1f=_0xf813[_0x3c4087];return _0x23ad1f;};'use strict';var multer=require(_0x3f81('0x0'));var util=require('util');var path=require(_0x3f81('0x1'));var express=require(_0x3f81('0x2'));var router=express['Router']();var auth=require(_0x3f81('0x3'));var controller=require(_0x3f81('0x4'));router[_0x3f81('0x5')](_0x3f81('0x6'),auth[_0x3f81('0x7')](),controller['voiceChannels']);router[_0x3f81('0x5')](_0x3f81('0x8'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x9')]);router[_0x3f81('0x5')](_0x3f81('0xa'),auth['isAuthenticated'](),controller[_0x3f81('0xb')]);router[_0x3f81('0x5')]('/voice/queues',auth['isAuthenticated'](),controller[_0x3f81('0xc')]);router['get'](_0x3f81('0xd'),auth[_0x3f81('0x7')](),controller['chatQueues']);router['get'](_0x3f81('0xe'),auth['isAuthenticated'](),controller['mailQueues']);router[_0x3f81('0x5')]('/mail/accounts',auth[_0x3f81('0x7')](),controller[_0x3f81('0xf')]);router[_0x3f81('0x5')]('/openchannel/queues',auth['isAuthenticated'](),controller[_0x3f81('0x10')]);router[_0x3f81('0x5')](_0x3f81('0x11'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x12')]);router['get'](_0x3f81('0x13'),auth[_0x3f81('0x7')](),controller['whatsappQueues']);router[_0x3f81('0x5')]('/fax/queues',auth[_0x3f81('0x7')](),controller[_0x3f81('0x14')]);router[_0x3f81('0x5')](_0x3f81('0x15'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x16')]);router[_0x3f81('0x5')](_0x3f81('0x17'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x18')]);router[_0x3f81('0x5')](_0x3f81('0x19'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x1a')]);router['get'](_0x3f81('0x1b'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x1c')]);router[_0x3f81('0x5')](_0x3f81('0x1d'),auth[_0x3f81('0x7')](),controller['voiceQueuesChannelRedirect']);router[_0x3f81('0x5')](_0x3f81('0x1e'),auth['isAuthenticated'](),controller['showVoiceQueues']);router[_0x3f81('0x1f')](_0x3f81('0x1e'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x20')]);router[_0x3f81('0x5')](_0x3f81('0x21'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x22')]);router[_0x3f81('0x5')](_0x3f81('0x23'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x24')]);router[_0x3f81('0x5')](_0x3f81('0x25'),auth['isAuthenticated'](),controller['agents']);router[_0x3f81('0x1f')](_0x3f81('0x26'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x27')]);router[_0x3f81('0x5')](_0x3f81('0x28'),auth[_0x3f81('0x7')](),controller['telephones']);router[_0x3f81('0x5')]('/trunks',auth[_0x3f81('0x7')](),controller[_0x3f81('0x29')]);router[_0x3f81('0x5')](_0x3f81('0x2a'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x2b')]);router['get'](_0x3f81('0x2c'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x2d')]);router['get'](_0x3f81('0x2e'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x2f')]);router[_0x3f81('0x5')]('/mail/queues/waitinginteractions',auth[_0x3f81('0x7')](),controller[_0x3f81('0x30')]);router[_0x3f81('0x5')]('/openchannel/queues/waitinginteractions',auth[_0x3f81('0x7')](),controller[_0x3f81('0x31')]);router[_0x3f81('0x5')](_0x3f81('0x32'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x33')]);router['get']('/sms/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x3f81('0x34')]);router['get'](_0x3f81('0x35'),auth['isAuthenticated'](),controller[_0x3f81('0x36')]);router[_0x3f81('0x5')]('/fax/queues/waitinginteractions',auth['isAuthenticated'](),controller['faxQueuesWaitingInteractions']);router[_0x3f81('0x37')](_0x3f81('0x38'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x39')](_0x3f81('0x3a')));router[_0x3f81('0x5')](_0x3f81('0x3b'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x3c')]);router[_0x3f81('0x37')](_0x3f81('0x3d'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x39')]('chat'));router[_0x3f81('0x5')](_0x3f81('0x3e'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x3f')]);router[_0x3f81('0x37')](_0x3f81('0x40'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x39')](_0x3f81('0x41')));router[_0x3f81('0x5')]('/fax/queues/:id',auth[_0x3f81('0x7')](),controller['showFaxQueues']);router[_0x3f81('0x37')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x3f81('0x39')](_0x3f81('0x42')));router[_0x3f81('0x5')]('/openchannel/queues/:id',auth[_0x3f81('0x7')](),controller[_0x3f81('0x43')]);router[_0x3f81('0x37')]('/sms/queues/:id/notify',auth['isAuthenticated'](),controller[_0x3f81('0x39')](_0x3f81('0x44')));router['post']('/whatsapp/queues/:id/notify',auth[_0x3f81('0x7')](),controller['queueNotify']('whatsapp'));router[_0x3f81('0x5')](_0x3f81('0x45'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x46')]);router[_0x3f81('0x5')](_0x3f81('0x47'),auth['isAuthenticated'](),controller[_0x3f81('0x48')]);router[_0x3f81('0x37')](_0x3f81('0x49'),auth[_0x3f81('0x7')](),controller[_0x3f81('0x4a')]);module['exports']=router; \ No newline at end of file +var _0x9c61=['Router','../../components/auth/service','./rpc.controller','get','/voice/channels','voiceChannels','isAuthenticated','voiceChannelMixMonitor','voiceChannelStopMixMonitor','/voice/queues','voiceQueues','/chat/queues','chatQueues','/mail/queues','/mail/accounts','mailAccounts','openchannelQueues','smsQueues','whatsappQueues','/fax/queues','/voice/queues/preview/:id','voiceQueuesPreview','/voice/queues/channels','voiceQueuesChannels','/voice/queues/channels/:uniqueid','voiceQueuesChannel','voiceQueuesChannelHangup','/voice/queues/channels/:uniqueid/redirect/:exten','/voice/queues/:id','showVoiceQueues','put','outbound','/outbound/channels','outboundChannels','/agents','agents','/telephones','telephones','/trunks','/campaigns','campaigns','/fax/accounts','faxAccounts','/chat/queues/waitinginteractions','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','/chat/queues/:id/notify','chat','showChatQueues','/fax/queues/:id/notify','fax','/fax/queues/:id','post','openchannel','showOpenchannelQueues','/sms/queues/:id/notify','/whatsapp/queues/:id/notify','whatsapp','/sms/queues/:id','showSmsQueues','/whatsapp/queues/:id','showWhatsappQueues','agentNotify','multer','util','path'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0x9c61,0x1d1));var _0x19c6=function(_0x5d7c7d,_0xb243cc){_0x5d7c7d=_0x5d7c7d-0x0;var _0x30ae4f=_0x9c61[_0x5d7c7d];return _0x30ae4f;};'use strict';var multer=require(_0x19c6('0x0'));var util=require(_0x19c6('0x1'));var path=require(_0x19c6('0x2'));var express=require('express');var router=express[_0x19c6('0x3')]();var auth=require(_0x19c6('0x4'));var controller=require(_0x19c6('0x5'));router[_0x19c6('0x6')](_0x19c6('0x7'),auth['isAuthenticated'](),controller[_0x19c6('0x8')]);router[_0x19c6('0x6')]('/voice/channels/:uniqueid/mixmonitor',auth[_0x19c6('0x9')](),controller[_0x19c6('0xa')]);router[_0x19c6('0x6')]('/voice/channels/:uniqueid/stopmixmonitor',auth[_0x19c6('0x9')](),controller[_0x19c6('0xb')]);router[_0x19c6('0x6')](_0x19c6('0xc'),auth['isAuthenticated'](),controller[_0x19c6('0xd')]);router[_0x19c6('0x6')](_0x19c6('0xe'),auth[_0x19c6('0x9')](),controller[_0x19c6('0xf')]);router[_0x19c6('0x6')](_0x19c6('0x10'),auth[_0x19c6('0x9')](),controller['mailQueues']);router[_0x19c6('0x6')](_0x19c6('0x11'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x12')]);router[_0x19c6('0x6')]('/openchannel/queues',auth[_0x19c6('0x9')](),controller[_0x19c6('0x13')]);router[_0x19c6('0x6')]('/sms/queues',auth[_0x19c6('0x9')](),controller[_0x19c6('0x14')]);router['get']('/whatsapp/queues',auth[_0x19c6('0x9')](),controller[_0x19c6('0x15')]);router[_0x19c6('0x6')](_0x19c6('0x16'),auth[_0x19c6('0x9')](),controller['faxQueues']);router[_0x19c6('0x6')](_0x19c6('0x17'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x18')]);router[_0x19c6('0x6')](_0x19c6('0x19'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x1a')]);router[_0x19c6('0x6')](_0x19c6('0x1b'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x1c')]);router[_0x19c6('0x6')]('/voice/queues/channels/:uniqueid/hangup',auth['isAuthenticated'](),controller[_0x19c6('0x1d')]);router[_0x19c6('0x6')](_0x19c6('0x1e'),auth[_0x19c6('0x9')](),controller['voiceQueuesChannelRedirect']);router[_0x19c6('0x6')](_0x19c6('0x1f'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x20')]);router[_0x19c6('0x21')](_0x19c6('0x1f'),auth[_0x19c6('0x9')](),controller['updateVoiceQueue']);router[_0x19c6('0x6')]('/outbound',auth[_0x19c6('0x9')](),controller[_0x19c6('0x22')]);router[_0x19c6('0x6')](_0x19c6('0x23'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x24')]);router['get'](_0x19c6('0x25'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x26')]);router[_0x19c6('0x21')]('/agents/:id/capacity',auth['isAuthenticated'](),controller['agentCapacity']);router['get'](_0x19c6('0x27'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x28')]);router[_0x19c6('0x6')](_0x19c6('0x29'),auth[_0x19c6('0x9')](),controller['trunks']);router[_0x19c6('0x6')](_0x19c6('0x2a'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x2b')]);router[_0x19c6('0x6')](_0x19c6('0x2c'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x2d')]);router[_0x19c6('0x6')](_0x19c6('0x2e'),auth[_0x19c6('0x9')](),controller['chatQueuesWaitingInteractions']);router[_0x19c6('0x6')]('/mail/queues/waitinginteractions',auth['isAuthenticated'](),controller[_0x19c6('0x2f')]);router[_0x19c6('0x6')](_0x19c6('0x30'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x31')]);router['get'](_0x19c6('0x32'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x33')]);router[_0x19c6('0x6')](_0x19c6('0x34'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x35')]);router['get'](_0x19c6('0x36'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x37')]);router['get']('/fax/queues/waitinginteractions',auth[_0x19c6('0x9')](),controller[_0x19c6('0x38')]);router['post'](_0x19c6('0x39'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x3a')]('mail'));router[_0x19c6('0x6')](_0x19c6('0x3b'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x3c')]);router['post'](_0x19c6('0x3d'),auth[_0x19c6('0x9')](),controller['queueNotify'](_0x19c6('0x3e')));router[_0x19c6('0x6')]('/chat/queues/:id',auth[_0x19c6('0x9')](),controller[_0x19c6('0x3f')]);router['post'](_0x19c6('0x40'),auth['isAuthenticated'](),controller[_0x19c6('0x3a')](_0x19c6('0x41')));router['get'](_0x19c6('0x42'),auth[_0x19c6('0x9')](),controller['showFaxQueues']);router[_0x19c6('0x43')]('/openchannel/queues/:id/notify',auth['isAuthenticated'](),controller[_0x19c6('0x3a')](_0x19c6('0x44')));router[_0x19c6('0x6')]('/openchannel/queues/:id',auth[_0x19c6('0x9')](),controller[_0x19c6('0x45')]);router[_0x19c6('0x43')](_0x19c6('0x46'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x3a')]('sms'));router['post'](_0x19c6('0x47'),auth[_0x19c6('0x9')](),controller[_0x19c6('0x3a')](_0x19c6('0x48')));router['get'](_0x19c6('0x49'),auth['isAuthenticated'](),controller[_0x19c6('0x4a')]);router[_0x19c6('0x6')](_0x19c6('0x4b'),auth['isAuthenticated'](),controller[_0x19c6('0x4c')]);router[_0x19c6('0x43')]('/agents/:id/notify',auth[_0x19c6('0x9')](),controller[_0x19c6('0x4d')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/rpc/rpc.controller.js b/server/api/rpc/rpc.controller.js index 43da5df..7d7e310 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 _0x904b=['showOpenchannelQueues','smsQueues','SmsQueues','showSmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','chatQueuesWaitingInteractions','ChatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','OpenchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','filter','queue_id','uniq','value','indexOf','smsQueuesWaitingInteractions','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','findOne','\x20Queue\x20not\x20found','Message','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','InteractionId','QueueId','TransferReport','*,*,*,*','channel','User','Agent\x20not\x20found','From','create','Start','agentTransferTimeout','moment','util','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','error','code','message','result','catch','status','json','sendStatus','stack','name','send','isNil','rows','find','voiceChannels','VoiceChannels','query','voiceChannelMixMonitor','VoiceChannelMixMonitor','merge','params','voiceChannelStopMixMonitor','VoiceChannelStopMixMonitor','voiceQueues','VoiceQueues','showVoiceQueues','updateVoiceQueue','voiceQueuesPreview','VoiceQueuesPreview','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','voiceQueuesChannelRedirect','VoiceQueuesChannelRedirect','outbound','OutboundChannels','agents','Agents','body','user','interaction','hasOwnProperty','MemberReport','INTERACTION','updateAttributes','length','findOrCreate','interface','format','YYYY-MM-DD\x20HH:mm:ss','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','Trunks','campaigns','chatQueues','ChatQueues','showChatQueues','MailQueues','showMailQueues','mailAccounts','MailAccounts','openchannelQueues','OpenchannelQueues'];(function(_0x1ebe90,_0x5d29fc){var _0x447c82=function(_0x1c2646){while(--_0x1c2646){_0x1ebe90['push'](_0x1ebe90['shift']());}};_0x447c82(++_0x5d29fc);}(_0x904b,0xb6));var _0xb904=function(_0x2f3e97,_0x24abcc){_0x2f3e97=_0x2f3e97-0x0;var _0x4b918c=_0x904b[_0x2f3e97];return _0x4b918c;};'use strict';var BPromise=require('bluebird');var moment=require(_0xb904('0x0'));var _=require('lodash');var util=require(_0xb904('0x1'));var db=require(_0xb904('0x2'))['db'];var logger=require(_0xb904('0x3'))('api');var jayson=require(_0xb904('0x4'));var amiClient=jayson[_0xb904('0x5')][_0xb904('0x6')]({'port':0x232a});var mailClient=jayson['client']['http']({'port':0x232b});var routingClient=jayson[_0xb904('0x5')][_0xb904('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x580125,_0xb407fd,_0x5012f3){return new BPromise(function(_0x3a329e,_0x408cbf){var _0x789fa1=_0x5012f3?_0x5012f3:amiClient;return _0x789fa1[_0xb904('0x7')](_0x580125,_0xb407fd)[_0xb904('0x8')](function(_0x523af6){if(_0x523af6[_0xb904('0x9')]){if(_0x523af6['error'][_0xb904('0xa')]===0x1f4){return _0x408cbf(_0x523af6[_0xb904('0x9')][_0xb904('0xb')]);}return _0x3a329e(_0x523af6['error'][_0xb904('0xb')]);}else{_0x3a329e(_0x523af6[_0xb904('0xc')]);}})[_0xb904('0xd')](function(_0xef5a89){_0x408cbf(_0xef5a89);});});}function respondWithResult(_0x44c7ab,_0x3c95cd){_0x3c95cd=_0x3c95cd||0xc8;return function(_0x37abc1){if(_0x37abc1){return _0x44c7ab[_0xb904('0xe')](_0x3c95cd)[_0xb904('0xf')](_0x37abc1);}return _0x44c7ab[_0xb904('0x10')](0x194);};}function handleError(_0x1cc90a,_0x4c6201){_0x4c6201=_0x4c6201||0x1f4;return function(_0x4c83a2){logger['error'](_0x4c83a2[_0xb904('0x11')]);if(_0x4c83a2[_0xb904('0x12')]){delete _0x4c83a2[_0xb904('0x12')];}_0x1cc90a[_0xb904('0xe')](_0x4c6201)[_0xb904('0x13')](_0x4c83a2);};}function findById(_0x43b571){return function(_0x2f872f){if(!_['isNil'](_0x43b571)&&!_['isNil'](_0x2f872f)&&!_[_0xb904('0x14')](_0x2f872f[_0xb904('0x15')])){return _[_0xb904('0x16')](_0x2f872f['rows'],function(_0x512736){return _0x512736['id']==_0x43b571;});}return null;};}exports[_0xb904('0x17')]=function(_0x270795,_0x34e7f4){return respondWithRpcPromise(_0xb904('0x18'),_0x270795[_0xb904('0x19')])[_0xb904('0x8')](respondWithResult(_0x34e7f4,null))['catch'](handleError(_0x34e7f4,null));};exports[_0xb904('0x1a')]=function(_0x7e36c,_0x4197c0){return respondWithRpcPromise(_0xb904('0x1b'),_[_0xb904('0x1c')](_0x7e36c[_0xb904('0x19')],_0x7e36c[_0xb904('0x1d')]))[_0xb904('0x8')](respondWithResult(_0x4197c0,null))[_0xb904('0xd')](handleError(_0x4197c0,null));};exports[_0xb904('0x1e')]=function(_0x4b1937,_0x51fdff){return respondWithRpcPromise(_0xb904('0x1f'),_[_0xb904('0x1c')](_0x4b1937['query'],_0x4b1937['params']))[_0xb904('0x8')](respondWithResult(_0x51fdff,null))[_0xb904('0xd')](handleError(_0x51fdff,null));};exports[_0xb904('0x20')]=function(_0x2aceb4,_0x466a65){return respondWithRpcPromise(_0xb904('0x21'),_0x2aceb4[_0xb904('0x19')])['then'](respondWithResult(_0x466a65,null))[_0xb904('0xd')](handleError(_0x466a65,null));};exports[_0xb904('0x22')]=function(_0x26a376,_0x3ddd0e){return respondWithRpcPromise(_0xb904('0x21'),_0x26a376['query'])[_0xb904('0x8')](findById(_0x26a376[_0xb904('0x1d')]['id']))[_0xb904('0x8')](respondWithResult(_0x3ddd0e,null))[_0xb904('0xd')](handleError(_0x3ddd0e,null));};exports[_0xb904('0x23')]=function(_0x5f5567,_0x566e50){return respondWithRpcPromise('UpdateVoiceQueue',_[_0xb904('0x1c')](_0x5f5567['body'],_0x5f5567[_0xb904('0x1d')]))[_0xb904('0x8')](respondWithResult(_0x566e50,null))[_0xb904('0xd')](handleError(_0x566e50,null));};exports[_0xb904('0x24')]=function(_0x5f17e3,_0x100084){return respondWithRpcPromise(_0xb904('0x25'),_[_0xb904('0x1c')](_0x5f17e3[_0xb904('0x19')],_0x5f17e3[_0xb904('0x1d')]))['then'](respondWithResult(_0x100084,null))[_0xb904('0xd')](handleError(_0x100084,null));};exports['voiceQueuesChannels']=function(_0x2f4ba2,_0x3dde24){return respondWithRpcPromise(_0xb904('0x26'),_0x2f4ba2[_0xb904('0x19')])['then'](respondWithResult(_0x3dde24,null))[_0xb904('0xd')](handleError(_0x3dde24,null));};exports[_0xb904('0x27')]=function(_0x371961,_0x15b819){return respondWithRpcPromise(_0xb904('0x28'),_[_0xb904('0x1c')](_0x371961['query'],_0x371961[_0xb904('0x1d')]))[_0xb904('0x8')](respondWithResult(_0x15b819,null))[_0xb904('0xd')](handleError(_0x15b819,null));};exports['voiceQueuesChannelHangup']=function(_0xfb3b75,_0x44c8a5){return respondWithRpcPromise(_0xb904('0x29'),_[_0xb904('0x1c')](_0xfb3b75['query'],_0xfb3b75['params']))[_0xb904('0x8')](respondWithResult(_0x44c8a5,null))[_0xb904('0xd')](handleError(_0x44c8a5,null));};exports[_0xb904('0x2a')]=function(_0x471531,_0x209a6b){return respondWithRpcPromise(_0xb904('0x2b'),_['merge'](_0x471531[_0xb904('0x19')],_0x471531[_0xb904('0x1d')]))[_0xb904('0x8')](respondWithResult(_0x209a6b,null))[_0xb904('0xd')](handleError(_0x209a6b,null));};exports[_0xb904('0x2c')]=function(_0x2f78e8,_0x4be0a0){return respondWithRpcPromise('Outbound',_0x2f78e8[_0xb904('0x19')])['then'](respondWithResult(_0x4be0a0,null))[_0xb904('0xd')](handleError(_0x4be0a0,null));};exports['outboundChannels']=function(_0x1cb7e0,_0x3613b6){return respondWithRpcPromise(_0xb904('0x2d'),_0x1cb7e0[_0xb904('0x19')])[_0xb904('0x8')](respondWithResult(_0x3613b6,null))[_0xb904('0xd')](handleError(_0x3613b6,null));};exports[_0xb904('0x2e')]=function(_0x6bb506,_0x4e9bea){var _0x5daca1;return respondWithRpcPromise(_0xb904('0x2f'),_0x6bb506[_0xb904('0x19')])[_0xb904('0x8')](function(_0x6003e1){_0x5daca1=_0x6003e1;return respondWithRpcPromise('Agents',_0x6bb506[_0xb904('0x19')],routingClient);})[_0xb904('0x8')](function(_0x52ae00){return _[_0xb904('0x1c')]({},_0x52ae00,_0x5daca1);})[_0xb904('0x8')](respondWithResult(_0x4e9bea,null))[_0xb904('0xd')](handleError(_0x4e9bea,null));};exports['agentCapacity']=function(_0xbbffd0,_0x3461e4){if(_0xbbffd0['body']&&_0xbbffd0[_0xb904('0x30')]['interaction']&&_0xbbffd0[_0xb904('0x31')]&&_0xbbffd0['user'][_0xb904('0x12')]){for(var _0x32fc9a in _0xbbffd0[_0xb904('0x30')]['interaction']){if(_0xbbffd0[_0xb904('0x30')][_0xb904('0x32')][_0xb904('0x33')](_0x32fc9a)){db[_0xb904('0x34')]['findAll']({'where':{'channel':_0x32fc9a,'membername':_0xbbffd0[_0xb904('0x31')][_0xb904('0x12')],'type':_0xb904('0x35'),'exitAt':null,'uniqueid':_0xbbffd0['body']['interaction'][_0x32fc9a]&&_0xbbffd0[_0xb904('0x30')][_0xb904('0x32')][_0x32fc9a]['length']?{'$notIn':_0xbbffd0['body'][_0xb904('0x32')][_0x32fc9a]}:{'$ne':null}}})[_0xb904('0x8')](function(_0x391d0c){var _0x5839ad=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');for(var _0x537b27=0x0,_0x1288e1=_0x391d0c['length'];_0x537b27<_0x1288e1;_0x537b27+=0x1){_0x391d0c[_0x537b27][_0xb904('0x36')]({'exitAt':_0x5839ad});}});for(var _0x3eacc6=0x0;_0x3eacc6<_0xbbffd0[_0xb904('0x30')][_0xb904('0x32')][_0x32fc9a][_0xb904('0x37')];_0x3eacc6+=0x1){db[_0xb904('0x34')][_0xb904('0x38')]({'where':{'channel':_0x32fc9a,'membername':_0xbbffd0[_0xb904('0x31')][_0xb904('0x12')],'type':_0xb904('0x35'),'uniqueid':_0xbbffd0[_0xb904('0x30')][_0xb904('0x32')][_0x32fc9a][_0x3eacc6],'exitAt':null},'defaults':{'channel':_0x32fc9a,'membername':_0xbbffd0['user'][_0xb904('0x12')],'interface':_[_0xb904('0x14')](_0xbbffd0[_0xb904('0x31')][_0xb904('0x39')])?util['format']('SIP/%s',_0xbbffd0[_0xb904('0x31')][_0xb904('0x12')]):_0xbbffd0['user'][_0xb904('0x39')],'type':'INTERACTION','enterAt':moment()[_0xb904('0x3a')](_0xb904('0x3b')),'role':_0xb904('0x3c'),'internal':_0xbbffd0[_0xb904('0x31')][_0xb904('0x3d')],'uniqueid':_0xbbffd0[_0xb904('0x30')]['interaction'][_0x32fc9a][_0x3eacc6]}});}}}}return respondWithRpcPromise(_0xb904('0x3e'),{'id':_0xbbffd0['params']['id'],'capacity':_0xbbffd0[_0xb904('0x30')][_0xb904('0x3f')]},routingClient)['then'](respondWithResult(_0x3461e4,null))['catch'](handleError(_0x3461e4,null));};exports[_0xb904('0x40')]=function(_0x2e0242,_0x48c307){return respondWithRpcPromise(_0xb904('0x41'),_0x2e0242['query'])['then'](respondWithResult(_0x48c307,null))[_0xb904('0xd')](handleError(_0x48c307,null));};exports[_0xb904('0x42')]=function(_0x187f82,_0x181d64){return respondWithRpcPromise(_0xb904('0x43'),_0x187f82['query'])[_0xb904('0x8')](respondWithResult(_0x181d64,null))[_0xb904('0xd')](handleError(_0x181d64,null));};exports[_0xb904('0x44')]=function(_0x51c754,_0x1da5dd){return respondWithRpcPromise('Campaigns',_0x51c754['query'])[_0xb904('0x8')](respondWithResult(_0x1da5dd,null))[_0xb904('0xd')](handleError(_0x1da5dd,null));};exports[_0xb904('0x45')]=function(_0x109fe0,_0x20343d){return respondWithRpcPromise(_0xb904('0x46'),_0x109fe0[_0xb904('0x19')],routingClient)[_0xb904('0x8')](respondWithResult(_0x20343d,null))[_0xb904('0xd')](handleError(_0x20343d,null));};exports[_0xb904('0x47')]=function(_0x589a19,_0x3ddc76){return respondWithRpcPromise(_0xb904('0x46'),_0x589a19['query'],routingClient)['then'](findById(_0x589a19[_0xb904('0x1d')]['id']))[_0xb904('0x8')](respondWithResult(_0x3ddc76,null))[_0xb904('0xd')](handleError(_0x3ddc76,null));};exports['mailQueues']=function(_0x4a6e44,_0x2b3b08){return respondWithRpcPromise(_0xb904('0x48'),_0x4a6e44[_0xb904('0x19')],routingClient)[_0xb904('0x8')](respondWithResult(_0x2b3b08,null))[_0xb904('0xd')](handleError(_0x2b3b08,null));};exports[_0xb904('0x49')]=function(_0x3068c4,_0x1fd462){return respondWithRpcPromise(_0xb904('0x48'),_0x3068c4['query'],routingClient)[_0xb904('0x8')](findById(_0x3068c4['params']['id']))[_0xb904('0x8')](respondWithResult(_0x1fd462,null))[_0xb904('0xd')](handleError(_0x1fd462,null));};exports[_0xb904('0x4a')]=function(_0x3f45ca,_0x6612ef){return respondWithRpcPromise(_0xb904('0x4b'),_0x3f45ca[_0xb904('0x19')],mailClient)[_0xb904('0x8')](respondWithResult(_0x6612ef,null))[_0xb904('0xd')](handleError(_0x6612ef,null));};exports[_0xb904('0x4c')]=function(_0xbce1f0,_0x1feaa2){return respondWithRpcPromise(_0xb904('0x4d'),_0xbce1f0[_0xb904('0x19')],routingClient)['then'](respondWithResult(_0x1feaa2,null))[_0xb904('0xd')](handleError(_0x1feaa2,null));};exports[_0xb904('0x4e')]=function(_0x36320a,_0xf769bd){return respondWithRpcPromise(_0xb904('0x4d'),_0x36320a[_0xb904('0x19')],routingClient)[_0xb904('0x8')](findById(_0x36320a['params']['id']))['then'](respondWithResult(_0xf769bd,null))['catch'](handleError(_0xf769bd,null));};exports[_0xb904('0x4f')]=function(_0x145f07,_0x231d5a){return respondWithRpcPromise(_0xb904('0x50'),_0x145f07[_0xb904('0x19')],routingClient)['then'](respondWithResult(_0x231d5a,null))[_0xb904('0xd')](handleError(_0x231d5a,null));};exports[_0xb904('0x51')]=function(_0x17cdd3,_0x5372f6){return respondWithRpcPromise(_0xb904('0x50'),_0x17cdd3[_0xb904('0x19')],routingClient)['then'](findById(_0x17cdd3[_0xb904('0x1d')]['id']))[_0xb904('0x8')](respondWithResult(_0x5372f6,null))[_0xb904('0xd')](handleError(_0x5372f6,null));};exports[_0xb904('0x52')]=function(_0x1dcd85,_0x2a419d){return respondWithRpcPromise(_0xb904('0x53'),_0x1dcd85[_0xb904('0x19')],routingClient)[_0xb904('0x8')](respondWithResult(_0x2a419d,null))[_0xb904('0xd')](handleError(_0x2a419d,null));};exports['showWhatsappQueues']=function(_0x59b157,_0x30b717){return respondWithRpcPromise('WhatsappQueues',_0x59b157[_0xb904('0x19')],routingClient)[_0xb904('0x8')](findById(_0x59b157[_0xb904('0x1d')]['id']))[_0xb904('0x8')](respondWithResult(_0x30b717,null))[_0xb904('0xd')](handleError(_0x30b717,null));};exports[_0xb904('0x54')]=function(_0x5e4257,_0x58da1f){return respondWithRpcPromise(_0xb904('0x55'),_0x5e4257[_0xb904('0x19')],routingClient)[_0xb904('0x8')](respondWithResult(_0x58da1f,null))[_0xb904('0xd')](handleError(_0x58da1f,null));};exports[_0xb904('0x56')]=function(_0x2c4640,_0x4ee96f){return respondWithRpcPromise(_0xb904('0x55'),_0x2c4640['query'],routingClient)[_0xb904('0x8')](findById(_0x2c4640['params']['id']))[_0xb904('0x8')](respondWithResult(_0x4ee96f,null))['catch'](handleError(_0x4ee96f,null));};exports[_0xb904('0x57')]=function(_0x5582ec,_0x2ef3ec){return respondWithRpcPromise('FaxAccounts',_0x5582ec['query'])[_0xb904('0x8')](respondWithResult(_0x2ef3ec,null))['catch'](handleError(_0x2ef3ec,null));};exports[_0xb904('0x58')]=function(_0x3760b6,_0x11fee8){return respondWithRpcPromise(_0xb904('0x59'),_0x3760b6[_0xb904('0x19')],routingClient)['then'](respondWithResult(_0x11fee8,null))[_0xb904('0xd')](handleError(_0x11fee8,null));};exports[_0xb904('0x5a')]=function(_0x24ea93,_0x5e81b8){return respondWithRpcPromise(_0xb904('0x5b'),_0x24ea93[_0xb904('0x19')],routingClient)['then'](respondWithResult(_0x5e81b8,null))['catch'](handleError(_0x5e81b8,null));};exports['openchannelQueuesWaitingInteractions']=function(_0x358b5c,_0x59e0bf){return respondWithRpcPromise(_0xb904('0x5c'),_0x358b5c['query'],routingClient)[_0xb904('0x8')](respondWithResult(_0x59e0bf,null))[_0xb904('0xd')](handleError(_0x59e0bf,null));};exports[_0xb904('0x5d')]=function(_0x38597d,_0x117d48){return respondWithRpcPromise(_0xb904('0x5c'),_0x38597d['query'],routingClient)[_0xb904('0x8')](function(_0x1b652a){if(_0x38597d[_0xb904('0x19')]['type']!==undefined){var _0x2fa000=_(_0x1b652a[_0xb904('0x15')])[_0xb904('0x5e')]([_0x38597d[_0xb904('0x19')]['type'],_0x38597d[_0xb904('0x1d')]['id']])['map'](_0xb904('0x5f'))[_0xb904('0x60')]()[_0xb904('0x61')]();return _0x1b652a[_0xb904('0x15')][_0xb904('0x5e')](function(_0x377c36){return _0x2fa000[_0xb904('0x62')](_0x377c36[_0xb904('0x5f')])>-0x1;});}else{return _0x1b652a[_0xb904('0x15')][_0xb904('0x5e')](function(_0x14c666){return _0x14c666[_0xb904('0x5f')]===parseInt(_0x38597d[_0xb904('0x1d')]['id']);});}})[_0xb904('0x8')](respondWithResult(_0x117d48,null))['catch'](handleError(_0x117d48,null));};exports[_0xb904('0x63')]=function(_0x2444c8,_0xb6faf4){return respondWithRpcPromise(_0xb904('0x64'),_0x2444c8[_0xb904('0x19')],routingClient)[_0xb904('0x8')](respondWithResult(_0xb6faf4,null))[_0xb904('0xd')](handleError(_0xb6faf4,null));};exports[_0xb904('0x65')]=function(_0xee2da7,_0x2934c0){return respondWithRpcPromise('WhatsappQueuesWaitingInteractions',_0xee2da7[_0xb904('0x19')],routingClient)['then'](respondWithResult(_0x2934c0,null))[_0xb904('0xd')](handleError(_0x2934c0,null));};exports[_0xb904('0x66')]=function(_0x2d83ee,_0x4aa423){return respondWithRpcPromise(_0xb904('0x67'),_0x2d83ee[_0xb904('0x19')],routingClient)[_0xb904('0x8')](respondWithResult(_0x4aa423,null))['catch'](handleError(_0x4aa423,null));};exports[_0xb904('0x68')]=function(_0x2a669b){return function(_0x3b5e38,_0x31ae93){var _0x341a13,_0x23a9a0;var _0x4f77e8=_[_0xb904('0x69')](_0x2a669b);var _0x230178=_0x2a669b===_0xb904('0x6a')?_0xb904('0x6b'):_0xb904('0x6c');return db[_0x4f77e8+_0xb904('0x6d')][_0xb904('0x6e')]({'raw':!![],'where':{'id':_0x3b5e38['params']['id']}})[_0xb904('0x8')](function(_0x5dac72){if(_[_0xb904('0x14')](_0x5dac72)){throw new Error(_0x4f77e8+_0xb904('0x6f'));}_0x341a13=_0x5dac72;return db[_0x4f77e8+_0xb904('0x70')][_0xb904('0x6e')]({'where':{'id':_0x3b5e38[_0xb904('0x30')][_0xb904('0x71')]},'include':[{'model':db[_0x4f77e8+'Interaction'],'as':_0xb904('0x72')},{'model':db[_0x4f77e8+_0x230178],'as':_0xb904('0x6c')}]});})['then'](function(_0x2400b2){if(_[_0xb904('0x14')](_0x2400b2)){throw new Error(_0x4f77e8+_0xb904('0x73'));}_0x23a9a0=_0x2400b2;return _0x2400b2[_0xb904('0x74')]({'read':0x0,'readAt':null,'UserId':null});})[_0xb904('0x8')](function(){var _0x5d9a09={'uniqueid':_0x2a669b+'.'+_0x23a9a0['id']+'.'+_0x23a9a0[_0xb904('0x72')]['id'],'FromUserId':_0x3b5e38[_0xb904('0x31')]['id'],'type':_0xb904('0x75')};_0x5d9a09[_0x4f77e8+_0xb904('0x76')]=_0x23a9a0['id'];_0x5d9a09[_0x4f77e8+_0xb904('0x77')]=_0x23a9a0[_0xb904('0x72')]['id'];_0x5d9a09['From'+_0x4f77e8+_0x230178+'Id']=_0x23a9a0[_0xb904('0x6c')]['id'];_0x5d9a09['To'+_0x4f77e8+_0xb904('0x78')]=_0x341a13['id'];return db[_0x4f77e8+_0xb904('0x79')]['create'](_0x5d9a09);})[_0xb904('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x2a669b,'interaction':_0x23a9a0[_0xb904('0x72')],'message':_0x23a9a0,'account':_0x23a9a0[_0xb904('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':'queue','appdata':_0x341a13[_0xb904('0x12')]+','+(_0x23a9a0[_0xb904('0x6c')]['queueTransferTimeout']||0x12c),'interval':_0xb904('0x7a')}]},routingClient);})[_0xb904('0x8')](respondWithResult(_0x31ae93,null))['catch'](handleError(_0x31ae93,null));};};exports['agentNotify']=function(_0x1654ff,_0x22098d){var _0x5ee6fe,_0xb96b4d;if(_[_0xb904('0x14')](_0x1654ff[_0xb904('0x30')][_0xb904('0x7b')])){throw new Error('Channel\x20field\x20is\x20mandatory');}var _0x43cf3a=_0x1654ff[_0xb904('0x30')][_0xb904('0x7b')];var _0x212014=_[_0xb904('0x69')](_0x43cf3a);var _0x1d1c17=_0x43cf3a===_0xb904('0x6a')?_0xb904('0x6b'):'Account';return db[_0xb904('0x7c')][_0xb904('0x6e')]({'raw':!![],'where':{'id':_0x1654ff[_0xb904('0x1d')]['id'],'role':_0xb904('0x3c')}})['then'](function(_0x527ffa){if(_[_0xb904('0x14')](_0x527ffa)){throw new Error(_0xb904('0x7d'));}_0x5ee6fe=_0x527ffa;return db[_0x212014+_0xb904('0x70')][_0xb904('0x6e')]({'where':{'id':_0x1654ff[_0xb904('0x30')][_0xb904('0x71')]},'include':[{'model':db[_0x212014+'Interaction'],'as':'Interaction'},{'model':db[_0x212014+_0x1d1c17],'as':_0xb904('0x6c')}]});})['then'](function(_0x13ed10){if(_['isNil'](_0x13ed10)){throw new Error(_0x212014+_0xb904('0x73'));}_0xb96b4d=_0x13ed10;return _0x13ed10['update']({'read':0x0,'readAt':null,'UserId':null});})[_0xb904('0x8')](function(){var _0x123a45={'uniqueid':_0x43cf3a+'.'+_0xb96b4d['id']+'.'+_0xb96b4d[_0xb904('0x72')]['id'],'FromUserId':_0x1654ff['user']['id'],'type':_0xb904('0x3c'),'ToUserId':_0x5ee6fe['id']};_0x123a45[_0x212014+_0xb904('0x76')]=_0xb96b4d['id'];_0x123a45[_0x212014+_0xb904('0x77')]=_0xb96b4d['Interaction']['id'];_0x123a45[_0xb904('0x7e')+_0x212014+_0x1d1c17+'Id']=_0xb96b4d[_0xb904('0x6c')]['id'];return db[_0x212014+_0xb904('0x79')][_0xb904('0x7f')](_0x123a45);})[_0xb904('0x8')](function(){return respondWithRpcPromise(_0xb904('0x80'),{'channel':_0x43cf3a,'interaction':_0xb96b4d[_0xb904('0x72')],'message':_0xb96b4d,'account':_0xb96b4d[_0xb904('0x6c')],'applications':[{'id':0x0,'priority':0x1,'app':_0xb904('0x3c'),'appdata':_0x5ee6fe[_0xb904('0x12')]+','+(_0xb96b4d[_0xb904('0x6c')][_0xb904('0x81')]||0x12c),'interval':_0xb904('0x7a')}]},routingClient);})[_0xb904('0x8')](respondWithResult(_0x22098d,null))[_0xb904('0xd')](handleError(_0x22098d,null));}; \ No newline at end of file +var _0x7941=['chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','MailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','openchannelQueuesIdWaitingInteractions','OpenchannelQueuesWaitingInteractions','type','map','uniq','value','filter','indexOf','queue_id','SmsQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','WhatsappQueuesWaitingInteractions','faxQueuesWaitingInteractions','FaxQueuesWaitingInteractions','queueNotify','capitalize','chat','Website','Account','Queue','\x20Queue\x20not\x20found','findOne','messageId','Interaction','\x20Message\x20not\x20found','update','queue','MessageId','QueueId','TransferReport','Start','queueTransferTimeout','*,*,*,*','agentNotify','Channel\x20field\x20is\x20mandatory','channel','User','Agent\x20not\x20found','Message','From','create','agentTransferTimeout','moment','lodash','util','../../mysqldb','../../config/logger','client','http','request','then','error','code','message','catch','status','json','sendStatus','stack','name','send','isNil','find','rows','voiceChannels','VoiceChannels','voiceChannelMixMonitor','VoiceChannelMixMonitor','query','params','VoiceChannelStopMixMonitor','merge','voiceQueues','VoiceQueues','updateVoiceQueue','UpdateVoiceQueue','body','voiceQueuesPreview','voiceQueuesChannels','VoiceQueuesChannels','voiceQueuesChannel','VoiceQueuesChannel','VoiceQueuesChannelHangup','VoiceQueuesChannelRedirect','outbound','Outbound','outboundChannels','OutboundChannels','agents','Agents','agentCapacity','interaction','user','hasOwnProperty','findAll','length','format','YYYY-MM-DD\x20HH:mm:ss','updateAttributes','findOrCreate','INTERACTION','interface','agent','internal','AgentCapacity','capacity','telephones','Telephones','trunks','campaigns','Campaigns','chatQueues','ChatQueues','mailQueues','showMailQueues','MailQueues','mailAccounts','MailAccounts','showOpenchannelQueues','OpenchannelQueues','smsQueues','SmsQueues','whatsappQueues','WhatsappQueues','faxQueues','FaxQueues','showFaxQueues','faxAccounts','FaxAccounts'];(function(_0xc4966b,_0x6cd5e0){var _0x1802bb=function(_0x12f623){while(--_0x12f623){_0xc4966b['push'](_0xc4966b['shift']());}};_0x1802bb(++_0x6cd5e0);}(_0x7941,0x1bd));var _0x1794=function(_0x43a2a7,_0x23b0de){_0x43a2a7=_0x43a2a7-0x0;var _0x5d0cb3=_0x7941[_0x43a2a7];return _0x5d0cb3;};'use strict';var BPromise=require('bluebird');var moment=require(_0x1794('0x0'));var _=require(_0x1794('0x1'));var util=require(_0x1794('0x2'));var db=require(_0x1794('0x3'))['db'];var logger=require(_0x1794('0x4'))('api');var jayson=require('jayson/promise');var amiClient=jayson[_0x1794('0x5')][_0x1794('0x6')]({'port':0x232a});var mailClient=jayson[_0x1794('0x5')][_0x1794('0x6')]({'port':0x232b});var routingClient=jayson[_0x1794('0x5')][_0x1794('0x6')]({'port':0x232c});function respondWithRpcPromise(_0x39c35e,_0x27d241,_0x5c7173){return new BPromise(function(_0x32a3f7,_0xfda114){var _0x304fd4=_0x5c7173?_0x5c7173:amiClient;return _0x304fd4[_0x1794('0x7')](_0x39c35e,_0x27d241)[_0x1794('0x8')](function(_0x597807){if(_0x597807[_0x1794('0x9')]){if(_0x597807[_0x1794('0x9')][_0x1794('0xa')]===0x1f4){return _0xfda114(_0x597807[_0x1794('0x9')][_0x1794('0xb')]);}return _0x32a3f7(_0x597807['error'][_0x1794('0xb')]);}else{_0x32a3f7(_0x597807['result']);}})[_0x1794('0xc')](function(_0x4660fe){_0xfda114(_0x4660fe);});});}function respondWithResult(_0x5d5844,_0x371cb6){_0x371cb6=_0x371cb6||0xc8;return function(_0x12003a){if(_0x12003a){return _0x5d5844[_0x1794('0xd')](_0x371cb6)[_0x1794('0xe')](_0x12003a);}return _0x5d5844[_0x1794('0xf')](0x194);};}function handleError(_0x50a04e,_0x477d92){_0x477d92=_0x477d92||0x1f4;return function(_0x3ea9dc){logger['error'](_0x3ea9dc[_0x1794('0x10')]);if(_0x3ea9dc[_0x1794('0x11')]){delete _0x3ea9dc[_0x1794('0x11')];}_0x50a04e[_0x1794('0xd')](_0x477d92)[_0x1794('0x12')](_0x3ea9dc);};}function findById(_0x1939ac){return function(_0x9e09f0){if(!_[_0x1794('0x13')](_0x1939ac)&&!_[_0x1794('0x13')](_0x9e09f0)&&!_['isNil'](_0x9e09f0['rows'])){return _[_0x1794('0x14')](_0x9e09f0[_0x1794('0x15')],function(_0x372f3b){return _0x372f3b['id']==_0x1939ac;});}return null;};}exports[_0x1794('0x16')]=function(_0xf2a93,_0x257566){return respondWithRpcPromise(_0x1794('0x17'),_0xf2a93['query'])['then'](respondWithResult(_0x257566,null))[_0x1794('0xc')](handleError(_0x257566,null));};exports[_0x1794('0x18')]=function(_0x44d368,_0x52cd7c){return respondWithRpcPromise(_0x1794('0x19'),_['merge'](_0x44d368[_0x1794('0x1a')],_0x44d368[_0x1794('0x1b')]))['then'](respondWithResult(_0x52cd7c,null))[_0x1794('0xc')](handleError(_0x52cd7c,null));};exports['voiceChannelStopMixMonitor']=function(_0xcce050,_0x77b8c6){return respondWithRpcPromise(_0x1794('0x1c'),_[_0x1794('0x1d')](_0xcce050['query'],_0xcce050[_0x1794('0x1b')]))[_0x1794('0x8')](respondWithResult(_0x77b8c6,null))['catch'](handleError(_0x77b8c6,null));};exports[_0x1794('0x1e')]=function(_0x2e39b8,_0x26e83b){return respondWithRpcPromise(_0x1794('0x1f'),_0x2e39b8[_0x1794('0x1a')])['then'](respondWithResult(_0x26e83b,null))[_0x1794('0xc')](handleError(_0x26e83b,null));};exports['showVoiceQueues']=function(_0x278518,_0x169548){return respondWithRpcPromise('VoiceQueues',_0x278518[_0x1794('0x1a')])[_0x1794('0x8')](findById(_0x278518[_0x1794('0x1b')]['id']))[_0x1794('0x8')](respondWithResult(_0x169548,null))[_0x1794('0xc')](handleError(_0x169548,null));};exports[_0x1794('0x20')]=function(_0x1ec223,_0x569ef5){return respondWithRpcPromise(_0x1794('0x21'),_[_0x1794('0x1d')](_0x1ec223[_0x1794('0x22')],_0x1ec223[_0x1794('0x1b')]))[_0x1794('0x8')](respondWithResult(_0x569ef5,null))[_0x1794('0xc')](handleError(_0x569ef5,null));};exports[_0x1794('0x23')]=function(_0xa5b4dd,_0x244c0d){return respondWithRpcPromise('VoiceQueuesPreview',_[_0x1794('0x1d')](_0xa5b4dd[_0x1794('0x1a')],_0xa5b4dd[_0x1794('0x1b')]))[_0x1794('0x8')](respondWithResult(_0x244c0d,null))[_0x1794('0xc')](handleError(_0x244c0d,null));};exports[_0x1794('0x24')]=function(_0x26872d,_0x39fbb1){return respondWithRpcPromise(_0x1794('0x25'),_0x26872d[_0x1794('0x1a')])[_0x1794('0x8')](respondWithResult(_0x39fbb1,null))[_0x1794('0xc')](handleError(_0x39fbb1,null));};exports[_0x1794('0x26')]=function(_0x2bd9b7,_0x34ef33){return respondWithRpcPromise(_0x1794('0x27'),_[_0x1794('0x1d')](_0x2bd9b7[_0x1794('0x1a')],_0x2bd9b7['params']))[_0x1794('0x8')](respondWithResult(_0x34ef33,null))['catch'](handleError(_0x34ef33,null));};exports['voiceQueuesChannelHangup']=function(_0x572258,_0x2dab2e){return respondWithRpcPromise(_0x1794('0x28'),_['merge'](_0x572258[_0x1794('0x1a')],_0x572258['params']))[_0x1794('0x8')](respondWithResult(_0x2dab2e,null))['catch'](handleError(_0x2dab2e,null));};exports['voiceQueuesChannelRedirect']=function(_0x507443,_0x1eb29e){return respondWithRpcPromise(_0x1794('0x29'),_['merge'](_0x507443[_0x1794('0x1a')],_0x507443['params']))[_0x1794('0x8')](respondWithResult(_0x1eb29e,null))[_0x1794('0xc')](handleError(_0x1eb29e,null));};exports[_0x1794('0x2a')]=function(_0x4f7e6b,_0x5e2c08){return respondWithRpcPromise(_0x1794('0x2b'),_0x4f7e6b[_0x1794('0x1a')])[_0x1794('0x8')](respondWithResult(_0x5e2c08,null))[_0x1794('0xc')](handleError(_0x5e2c08,null));};exports[_0x1794('0x2c')]=function(_0x5ef27d,_0xf25bff){return respondWithRpcPromise(_0x1794('0x2d'),_0x5ef27d[_0x1794('0x1a')])['then'](respondWithResult(_0xf25bff,null))[_0x1794('0xc')](handleError(_0xf25bff,null));};exports[_0x1794('0x2e')]=function(_0x513ad7,_0x4b351a){var _0x408432;return respondWithRpcPromise(_0x1794('0x2f'),_0x513ad7[_0x1794('0x1a')])[_0x1794('0x8')](function(_0x2d7dc8){_0x408432=_0x2d7dc8;return respondWithRpcPromise(_0x1794('0x2f'),_0x513ad7[_0x1794('0x1a')],routingClient);})[_0x1794('0x8')](function(_0x10f5c6){return _['merge']({},_0x10f5c6,_0x408432);})[_0x1794('0x8')](respondWithResult(_0x4b351a,null))[_0x1794('0xc')](handleError(_0x4b351a,null));};exports[_0x1794('0x30')]=function(_0x46a690,_0x38ed04){if(_0x46a690[_0x1794('0x22')]&&_0x46a690[_0x1794('0x22')][_0x1794('0x31')]&&_0x46a690[_0x1794('0x32')]&&_0x46a690[_0x1794('0x32')][_0x1794('0x11')]){for(var _0x35138a in _0x46a690[_0x1794('0x22')][_0x1794('0x31')]){if(_0x46a690['body'][_0x1794('0x31')][_0x1794('0x33')](_0x35138a)){db['MemberReport'][_0x1794('0x34')]({'where':{'channel':_0x35138a,'membername':_0x46a690[_0x1794('0x32')][_0x1794('0x11')],'type':'INTERACTION','exitAt':null,'uniqueid':_0x46a690[_0x1794('0x22')][_0x1794('0x31')][_0x35138a]&&_0x46a690['body'][_0x1794('0x31')][_0x35138a][_0x1794('0x35')]?{'$notIn':_0x46a690[_0x1794('0x22')][_0x1794('0x31')][_0x35138a]}:{'$ne':null}}})[_0x1794('0x8')](function(_0x136339){var _0x8d61e5=moment()[_0x1794('0x36')](_0x1794('0x37'));for(var _0x56d732=0x0,_0x8560b6=_0x136339[_0x1794('0x35')];_0x56d732<_0x8560b6;_0x56d732+=0x1){_0x136339[_0x56d732][_0x1794('0x38')]({'exitAt':_0x8d61e5});}});for(var _0xb42703=0x0;_0xb42703<_0x46a690[_0x1794('0x22')]['interaction'][_0x35138a]['length'];_0xb42703+=0x1){db['MemberReport'][_0x1794('0x39')]({'where':{'channel':_0x35138a,'membername':_0x46a690[_0x1794('0x32')]['name'],'type':_0x1794('0x3a'),'uniqueid':_0x46a690['body'][_0x1794('0x31')][_0x35138a][_0xb42703],'exitAt':null},'defaults':{'channel':_0x35138a,'membername':_0x46a690[_0x1794('0x32')][_0x1794('0x11')],'interface':_[_0x1794('0x13')](_0x46a690[_0x1794('0x32')][_0x1794('0x3b')])?util[_0x1794('0x36')]('SIP/%s',_0x46a690['user']['name']):_0x46a690[_0x1794('0x32')][_0x1794('0x3b')],'type':_0x1794('0x3a'),'enterAt':moment()['format'](_0x1794('0x37')),'role':_0x1794('0x3c'),'internal':_0x46a690[_0x1794('0x32')][_0x1794('0x3d')],'uniqueid':_0x46a690[_0x1794('0x22')][_0x1794('0x31')][_0x35138a][_0xb42703]}});}}}}return respondWithRpcPromise(_0x1794('0x3e'),{'id':_0x46a690[_0x1794('0x1b')]['id'],'capacity':_0x46a690[_0x1794('0x22')][_0x1794('0x3f')]},routingClient)['then'](respondWithResult(_0x38ed04,null))[_0x1794('0xc')](handleError(_0x38ed04,null));};exports[_0x1794('0x40')]=function(_0x26881e,_0x308fd3){return respondWithRpcPromise(_0x1794('0x41'),_0x26881e[_0x1794('0x1a')])['then'](respondWithResult(_0x308fd3,null))[_0x1794('0xc')](handleError(_0x308fd3,null));};exports[_0x1794('0x42')]=function(_0x21e1f6,_0x89119){return respondWithRpcPromise('Trunks',_0x21e1f6['query'])[_0x1794('0x8')](respondWithResult(_0x89119,null))['catch'](handleError(_0x89119,null));};exports[_0x1794('0x43')]=function(_0x4aba7c,_0x3e603a){return respondWithRpcPromise(_0x1794('0x44'),_0x4aba7c[_0x1794('0x1a')])['then'](respondWithResult(_0x3e603a,null))['catch'](handleError(_0x3e603a,null));};exports[_0x1794('0x45')]=function(_0x2cad59,_0x4c491d){return respondWithRpcPromise(_0x1794('0x46'),_0x2cad59[_0x1794('0x1a')],routingClient)[_0x1794('0x8')](respondWithResult(_0x4c491d,null))[_0x1794('0xc')](handleError(_0x4c491d,null));};exports['showChatQueues']=function(_0x43790c,_0xb5bc13){return respondWithRpcPromise(_0x1794('0x46'),_0x43790c[_0x1794('0x1a')],routingClient)[_0x1794('0x8')](findById(_0x43790c[_0x1794('0x1b')]['id']))[_0x1794('0x8')](respondWithResult(_0xb5bc13,null))[_0x1794('0xc')](handleError(_0xb5bc13,null));};exports[_0x1794('0x47')]=function(_0x1b6406,_0x13cfd0){return respondWithRpcPromise('MailQueues',_0x1b6406[_0x1794('0x1a')],routingClient)[_0x1794('0x8')](respondWithResult(_0x13cfd0,null))[_0x1794('0xc')](handleError(_0x13cfd0,null));};exports[_0x1794('0x48')]=function(_0x2549b9,_0xae1cd0){return respondWithRpcPromise(_0x1794('0x49'),_0x2549b9['query'],routingClient)[_0x1794('0x8')](findById(_0x2549b9[_0x1794('0x1b')]['id']))[_0x1794('0x8')](respondWithResult(_0xae1cd0,null))['catch'](handleError(_0xae1cd0,null));};exports[_0x1794('0x4a')]=function(_0x15508c,_0x45711e){return respondWithRpcPromise(_0x1794('0x4b'),_0x15508c[_0x1794('0x1a')],mailClient)['then'](respondWithResult(_0x45711e,null))['catch'](handleError(_0x45711e,null));};exports['openchannelQueues']=function(_0x498d7c,_0x5ac730){return respondWithRpcPromise('OpenchannelQueues',_0x498d7c['query'],routingClient)[_0x1794('0x8')](respondWithResult(_0x5ac730,null))[_0x1794('0xc')](handleError(_0x5ac730,null));};exports[_0x1794('0x4c')]=function(_0x162059,_0x437f10){return respondWithRpcPromise(_0x1794('0x4d'),_0x162059[_0x1794('0x1a')],routingClient)['then'](findById(_0x162059[_0x1794('0x1b')]['id']))[_0x1794('0x8')](respondWithResult(_0x437f10,null))[_0x1794('0xc')](handleError(_0x437f10,null));};exports[_0x1794('0x4e')]=function(_0x397618,_0x88fab9){return respondWithRpcPromise('SmsQueues',_0x397618[_0x1794('0x1a')],routingClient)[_0x1794('0x8')](respondWithResult(_0x88fab9,null))[_0x1794('0xc')](handleError(_0x88fab9,null));};exports['showSmsQueues']=function(_0x5e71df,_0x1df839){return respondWithRpcPromise(_0x1794('0x4f'),_0x5e71df[_0x1794('0x1a')],routingClient)[_0x1794('0x8')](findById(_0x5e71df[_0x1794('0x1b')]['id']))['then'](respondWithResult(_0x1df839,null))[_0x1794('0xc')](handleError(_0x1df839,null));};exports[_0x1794('0x50')]=function(_0x40b008,_0x3e289c){return respondWithRpcPromise(_0x1794('0x51'),_0x40b008['query'],routingClient)[_0x1794('0x8')](respondWithResult(_0x3e289c,null))[_0x1794('0xc')](handleError(_0x3e289c,null));};exports['showWhatsappQueues']=function(_0x450368,_0xc3306c){return respondWithRpcPromise(_0x1794('0x51'),_0x450368[_0x1794('0x1a')],routingClient)[_0x1794('0x8')](findById(_0x450368[_0x1794('0x1b')]['id']))[_0x1794('0x8')](respondWithResult(_0xc3306c,null))[_0x1794('0xc')](handleError(_0xc3306c,null));};exports[_0x1794('0x52')]=function(_0x173bba,_0x238f7f){return respondWithRpcPromise(_0x1794('0x53'),_0x173bba[_0x1794('0x1a')],routingClient)[_0x1794('0x8')](respondWithResult(_0x238f7f,null))['catch'](handleError(_0x238f7f,null));};exports[_0x1794('0x54')]=function(_0x276406,_0x54771b){return respondWithRpcPromise(_0x1794('0x53'),_0x276406[_0x1794('0x1a')],routingClient)[_0x1794('0x8')](findById(_0x276406[_0x1794('0x1b')]['id']))[_0x1794('0x8')](respondWithResult(_0x54771b,null))[_0x1794('0xc')](handleError(_0x54771b,null));};exports[_0x1794('0x55')]=function(_0x525535,_0x1b0902){return respondWithRpcPromise(_0x1794('0x56'),_0x525535[_0x1794('0x1a')])[_0x1794('0x8')](respondWithResult(_0x1b0902,null))[_0x1794('0xc')](handleError(_0x1b0902,null));};exports[_0x1794('0x57')]=function(_0x1dbb0a,_0x40325e){return respondWithRpcPromise('ChatQueuesWaitingInteractions',_0x1dbb0a['query'],routingClient)[_0x1794('0x8')](respondWithResult(_0x40325e,null))[_0x1794('0xc')](handleError(_0x40325e,null));};exports[_0x1794('0x58')]=function(_0x5096af,_0xbb4d53){return respondWithRpcPromise(_0x1794('0x59'),_0x5096af[_0x1794('0x1a')],routingClient)[_0x1794('0x8')](respondWithResult(_0xbb4d53,null))[_0x1794('0xc')](handleError(_0xbb4d53,null));};exports[_0x1794('0x5a')]=function(_0x5d59ce,_0x28539d){return respondWithRpcPromise('OpenchannelQueuesWaitingInteractions',_0x5d59ce[_0x1794('0x1a')],routingClient)[_0x1794('0x8')](respondWithResult(_0x28539d,null))['catch'](handleError(_0x28539d,null));};exports[_0x1794('0x5b')]=function(_0x28bfe0,_0x4cb85f){return respondWithRpcPromise(_0x1794('0x5c'),_0x28bfe0[_0x1794('0x1a')],routingClient)[_0x1794('0x8')](function(_0x56338a){if(_0x28bfe0[_0x1794('0x1a')][_0x1794('0x5d')]!==undefined){var _0xb00e3d=_(_0x56338a['rows'])['filter']([_0x28bfe0[_0x1794('0x1a')][_0x1794('0x5d')],_0x28bfe0[_0x1794('0x1b')]['id']])[_0x1794('0x5e')]('queue_id')[_0x1794('0x5f')]()[_0x1794('0x60')]();return _0x56338a[_0x1794('0x15')][_0x1794('0x61')](function(_0x4b8134){return _0xb00e3d[_0x1794('0x62')](_0x4b8134[_0x1794('0x63')])>-0x1;});}else{return _0x56338a[_0x1794('0x15')][_0x1794('0x61')](function(_0x449089){return _0x449089[_0x1794('0x63')]===parseInt(_0x28bfe0[_0x1794('0x1b')]['id']);});}})[_0x1794('0x8')](respondWithResult(_0x4cb85f,null))[_0x1794('0xc')](handleError(_0x4cb85f,null));};exports['smsQueuesWaitingInteractions']=function(_0x1efc11,_0x5aa84c){return respondWithRpcPromise(_0x1794('0x64'),_0x1efc11[_0x1794('0x1a')],routingClient)[_0x1794('0x8')](respondWithResult(_0x5aa84c,null))[_0x1794('0xc')](handleError(_0x5aa84c,null));};exports[_0x1794('0x65')]=function(_0x1b0ba9,_0x27fa35){return respondWithRpcPromise(_0x1794('0x66'),_0x1b0ba9[_0x1794('0x1a')],routingClient)[_0x1794('0x8')](respondWithResult(_0x27fa35,null))[_0x1794('0xc')](handleError(_0x27fa35,null));};exports[_0x1794('0x67')]=function(_0xb08819,_0xa9f22){return respondWithRpcPromise(_0x1794('0x68'),_0xb08819[_0x1794('0x1a')],routingClient)[_0x1794('0x8')](respondWithResult(_0xa9f22,null))[_0x1794('0xc')](handleError(_0xa9f22,null));};exports[_0x1794('0x69')]=function(_0x48558d){return function(_0x2dddc2,_0x5a3a54){var _0x2792be,_0x3919aa;var _0x5061e6=_[_0x1794('0x6a')](_0x48558d);var _0x39a866=_0x48558d===_0x1794('0x6b')?_0x1794('0x6c'):_0x1794('0x6d');return db[_0x5061e6+_0x1794('0x6e')]['findOne']({'raw':!![],'where':{'id':_0x2dddc2['params']['id']}})[_0x1794('0x8')](function(_0x2e1a1d){if(_['isNil'](_0x2e1a1d)){throw new Error(_0x5061e6+_0x1794('0x6f'));}_0x2792be=_0x2e1a1d;return db[_0x5061e6+'Message'][_0x1794('0x70')]({'where':{'id':_0x2dddc2[_0x1794('0x22')][_0x1794('0x71')]},'include':[{'model':db[_0x5061e6+_0x1794('0x72')],'as':_0x1794('0x72')},{'model':db[_0x5061e6+_0x39a866],'as':_0x1794('0x6d')}]});})[_0x1794('0x8')](function(_0x183b0d){if(_[_0x1794('0x13')](_0x183b0d)){throw new Error(_0x5061e6+_0x1794('0x73'));}_0x3919aa=_0x183b0d;return _0x183b0d[_0x1794('0x74')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1794('0x8')](function(){var _0x1e1cae={'uniqueid':_0x48558d+'.'+_0x3919aa['id']+'.'+_0x3919aa[_0x1794('0x72')]['id'],'FromUserId':_0x2dddc2['user']['id'],'type':_0x1794('0x75')};_0x1e1cae[_0x5061e6+_0x1794('0x76')]=_0x3919aa['id'];_0x1e1cae[_0x5061e6+'InteractionId']=_0x3919aa[_0x1794('0x72')]['id'];_0x1e1cae['From'+_0x5061e6+_0x39a866+'Id']=_0x3919aa[_0x1794('0x6d')]['id'];_0x1e1cae['To'+_0x5061e6+_0x1794('0x77')]=_0x2792be['id'];return db[_0x5061e6+_0x1794('0x78')]['create'](_0x1e1cae);})[_0x1794('0x8')](function(){return respondWithRpcPromise(_0x1794('0x79'),{'channel':_0x48558d,'interaction':_0x3919aa[_0x1794('0x72')],'message':_0x3919aa,'account':_0x3919aa[_0x1794('0x6d')],'applications':[{'id':0x0,'priority':0x1,'app':_0x1794('0x75'),'appdata':_0x2792be['name']+','+(_0x3919aa[_0x1794('0x6d')][_0x1794('0x7a')]||0x12c),'interval':_0x1794('0x7b')}]},routingClient);})[_0x1794('0x8')](respondWithResult(_0x5a3a54,null))[_0x1794('0xc')](handleError(_0x5a3a54,null));};};exports[_0x1794('0x7c')]=function(_0x2602ea,_0x5e8554){var _0x14e80c,_0x2d20d4;if(_[_0x1794('0x13')](_0x2602ea[_0x1794('0x22')]['channel'])){throw new Error(_0x1794('0x7d'));}var _0x51c919=_0x2602ea['body'][_0x1794('0x7e')];var _0x1c80c2=_[_0x1794('0x6a')](_0x51c919);var _0x4b1cf4=_0x51c919===_0x1794('0x6b')?_0x1794('0x6c'):_0x1794('0x6d');return db[_0x1794('0x7f')]['findOne']({'raw':!![],'where':{'id':_0x2602ea[_0x1794('0x1b')]['id'],'role':_0x1794('0x3c')}})[_0x1794('0x8')](function(_0x294856){if(_[_0x1794('0x13')](_0x294856)){throw new Error(_0x1794('0x80'));}_0x14e80c=_0x294856;return db[_0x1c80c2+_0x1794('0x81')][_0x1794('0x70')]({'where':{'id':_0x2602ea[_0x1794('0x22')][_0x1794('0x71')]},'include':[{'model':db[_0x1c80c2+_0x1794('0x72')],'as':_0x1794('0x72')},{'model':db[_0x1c80c2+_0x4b1cf4],'as':'Account'}]});})['then'](function(_0x201bfb){if(_[_0x1794('0x13')](_0x201bfb)){throw new Error(_0x1c80c2+'\x20Message\x20not\x20found');}_0x2d20d4=_0x201bfb;return _0x201bfb[_0x1794('0x74')]({'read':0x0,'readAt':null,'UserId':null});})[_0x1794('0x8')](function(){var _0x4bcb45={'uniqueid':_0x51c919+'.'+_0x2d20d4['id']+'.'+_0x2d20d4[_0x1794('0x72')]['id'],'FromUserId':_0x2602ea[_0x1794('0x32')]['id'],'type':_0x1794('0x3c'),'ToUserId':_0x14e80c['id']};_0x4bcb45[_0x1c80c2+_0x1794('0x76')]=_0x2d20d4['id'];_0x4bcb45[_0x1c80c2+'InteractionId']=_0x2d20d4['Interaction']['id'];_0x4bcb45[_0x1794('0x82')+_0x1c80c2+_0x4b1cf4+'Id']=_0x2d20d4[_0x1794('0x6d')]['id'];return db[_0x1c80c2+_0x1794('0x78')][_0x1794('0x83')](_0x4bcb45);})[_0x1794('0x8')](function(){return respondWithRpcPromise('Start',{'channel':_0x51c919,'interaction':_0x2d20d4[_0x1794('0x72')],'message':_0x2d20d4,'account':_0x2d20d4['Account'],'applications':[{'id':0x0,'priority':0x1,'app':_0x1794('0x3c'),'appdata':_0x14e80c[_0x1794('0x11')]+','+(_0x2d20d4[_0x1794('0x6d')][_0x1794('0x84')]||0x12c),'interval':'*,*,*,*'}]},routingClient);})[_0x1794('0x8')](respondWithResult(_0x5e8554,null))['catch'](handleError(_0x5e8554,null));}; \ No newline at end of file diff --git a/server/api/schedule/index.js b/server/api/schedule/index.js index 8f26441..53873c4 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 _0x62ef=['isAuthenticated','index','get','/:id','show','post','create','put','update','delete','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./schedule.controller'];(function(_0x64e3c1,_0x14da00){var _0x44adc8=function(_0x2529ce){while(--_0x2529ce){_0x64e3c1['push'](_0x64e3c1['shift']());}};_0x44adc8(++_0x14da00);}(_0x62ef,0xd3));var _0xf62e=function(_0x5a12ff,_0x2e18db){_0x5a12ff=_0x5a12ff-0x0;var _0x285f8d=_0x62ef[_0x5a12ff];return _0x285f8d;};'use strict';var multer=require('multer');var util=require(_0xf62e('0x0'));var path=require(_0xf62e('0x1'));var timeout=require('connect-timeout');var express=require(_0xf62e('0x2'));var router=express[_0xf62e('0x3')]();var fs_extra=require(_0xf62e('0x4'));var auth=require(_0xf62e('0x5'));var interaction=require(_0xf62e('0x6'));var config=require(_0xf62e('0x7'));var controller=require(_0xf62e('0x8'));router['get']('/',auth[_0xf62e('0x9')](),controller[_0xf62e('0xa')]);router[_0xf62e('0xb')](_0xf62e('0xc'),auth[_0xf62e('0x9')](),controller[_0xf62e('0xd')]);router[_0xf62e('0xb')]('/:id/run',auth[_0xf62e('0x9')](),controller['run']);router[_0xf62e('0xe')]('/',auth[_0xf62e('0x9')](),controller[_0xf62e('0xf')]);router[_0xf62e('0x10')]('/:id',auth['isAuthenticated'](),controller[_0xf62e('0x11')]);router[_0xf62e('0x12')](_0xf62e('0xc'),auth[_0xf62e('0x9')](),controller['destroy']);module[_0xf62e('0x13')]=router; \ No newline at end of file +var _0xf93f=['index','/:id','run','post','create','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated'];(function(_0x44e50a,_0x1cc4a2){var _0x1b5994=function(_0x29a487){while(--_0x29a487){_0x44e50a['push'](_0x44e50a['shift']());}};_0x1b5994(++_0x1cc4a2);}(_0xf93f,0xf9));var _0xff93=function(_0x4e227c,_0x159950){_0x4e227c=_0x4e227c-0x0;var _0x24b1f0=_0xf93f[_0x4e227c];return _0x24b1f0;};'use strict';var multer=require(_0xff93('0x0'));var util=require(_0xff93('0x1'));var path=require(_0xff93('0x2'));var timeout=require(_0xff93('0x3'));var express=require(_0xff93('0x4'));var router=express[_0xff93('0x5')]();var fs_extra=require(_0xff93('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0xff93('0x7'));var config=require(_0xff93('0x8'));var controller=require('./schedule.controller');router[_0xff93('0x9')]('/',auth[_0xff93('0xa')](),controller[_0xff93('0xb')]);router[_0xff93('0x9')](_0xff93('0xc'),auth[_0xff93('0xa')](),controller['show']);router[_0xff93('0x9')]('/:id/run',auth[_0xff93('0xa')](),controller[_0xff93('0xd')]);router[_0xff93('0xe')]('/',auth[_0xff93('0xa')](),controller[_0xff93('0xf')]);router[_0xff93('0x10')](_0xff93('0xc'),auth['isAuthenticated'](),controller['update']);router[_0xff93('0x11')](_0xff93('0xc'),auth[_0xff93('0xa')](),controller[_0xff93('0x12')]);module[_0xff93('0x13')]=router; \ No newline at end of file diff --git a/server/api/schedule/schedule.attributes.js b/server/api/schedule/schedule.attributes.js index b9adc8c..ae4c960 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 _0x8e1f=['years','quarters','months','weeks','days','hours','minutes','csv','pdf','custom','TEXT','sequelize','exports','STRING','BOOLEAN','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x8e1f,0x90));var _0xf8e1=function(_0x9713d4,_0x191452){_0x9713d4=_0x9713d4-0x0;var _0x1bfaa4=_0x8e1f[_0x9713d4];return _0x1bfaa4;};'use strict';var Sequelize=require(_0xf8e1('0x0'));module[_0xf8e1('0x1')]={'name':{'type':Sequelize[_0xf8e1('0x2')],'allowNull':![]},'description':{'type':Sequelize[_0xf8e1('0x2')]},'active':{'type':Sequelize[_0xf8e1('0x3')],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0xf8e1('0x2')],'allowNull':![],'defaultValue':_0xf8e1('0x4')},'startAt':{'type':Sequelize[_0xf8e1('0x5')],'allowNull':![]},'endAt':{'type':Sequelize[_0xf8e1('0x5')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0xf8e1('0x6')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0xf8e1('0x7')](_0xf8e1('0x8'),_0xf8e1('0x9'),_0xf8e1('0xa'),_0xf8e1('0xb'),_0xf8e1('0xc'),_0xf8e1('0xd'),_0xf8e1('0xe')),'allowNull':![],'defaultValue':_0xf8e1('0xc')},'output':{'type':Sequelize[_0xf8e1('0x7')](_0xf8e1('0xf'),_0xf8e1('0x10'),'xlsx'),'allowNull':![],'defaultValue':_0xf8e1('0xf')},'type':{'type':Sequelize[_0xf8e1('0x7')](_0xf8e1('0x11'),'default'),'allowNull':![],'defaultValue':_0xf8e1('0x11')},'sendMail':{'type':Sequelize[_0xf8e1('0x3')],'defaultValue':![]},'email':{'type':Sequelize[_0xf8e1('0x2')]},'cc':{'type':Sequelize[_0xf8e1('0x12')]},'bcc':{'type':Sequelize[_0xf8e1('0x12')]},'sendIfEmpty':{'type':Sequelize[_0xf8e1('0x3')],'defaultValue':!![]}}; \ No newline at end of file +var _0xaf37=['minutes','days','pdf','csv','custom','BOOLEAN','STRING','0\x200\x20*\x20*\x20*','DATE','INTEGER','ENUM','years','quarters','months','weeks','hours'];(function(_0x170d38,_0x40a1a8){var _0x24fe37=function(_0x3f6f95){while(--_0x3f6f95){_0x170d38['push'](_0x170d38['shift']());}};_0x24fe37(++_0x40a1a8);}(_0xaf37,0x1b6));var _0x7af3=function(_0x3e44fa,_0x75ed2a){_0x3e44fa=_0x3e44fa-0x0;var _0x2a0aba=_0xaf37[_0x3e44fa];return _0x2a0aba;};'use strict';var Sequelize=require('sequelize');module['exports']={'name':{'type':Sequelize[_0x7af3('0x0')],'allowNull':![]},'description':{'type':Sequelize[_0x7af3('0x0')]},'active':{'type':Sequelize['BOOLEAN'],'allowNull':![],'defaultValue':![]},'cron':{'type':Sequelize[_0x7af3('0x0')],'allowNull':![],'defaultValue':_0x7af3('0x1')},'startAt':{'type':Sequelize[_0x7af3('0x2')],'allowNull':![]},'endAt':{'type':Sequelize[_0x7af3('0x2')],'allowNull':![]},'subtractNumber':{'type':Sequelize[_0x7af3('0x3')],'allowNull':![],'defaultValue':0x1,'validate':{'min':0x1}},'subtractUnit':{'type':Sequelize[_0x7af3('0x4')](_0x7af3('0x5'),_0x7af3('0x6'),_0x7af3('0x7'),_0x7af3('0x8'),'days',_0x7af3('0x9'),_0x7af3('0xa')),'allowNull':![],'defaultValue':_0x7af3('0xb')},'output':{'type':Sequelize['ENUM']('csv',_0x7af3('0xc'),'xlsx'),'allowNull':![],'defaultValue':_0x7af3('0xd')},'type':{'type':Sequelize[_0x7af3('0x4')](_0x7af3('0xe'),'default'),'allowNull':![],'defaultValue':'custom'},'sendMail':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'email':{'type':Sequelize['STRING']},'cc':{'type':Sequelize['TEXT']},'bcc':{'type':Sequelize['TEXT']},'sendIfEmpty':{'type':Sequelize[_0x7af3('0xf')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/schedule/schedule.controller.js b/server/api/schedule/schedule.controller.js index 052376b..98cf37a 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 _0xf582=['to-csv','fs-extra','lodash','squel','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','end','status','json','offset','limit','count','set','Content-Range','apply','reject','save','then','get','UserProfileResource','destroy','sendStatus','error','stack','name','send','index','Schedule','rawAttributes','fieldName','type','map','query','filters','attributes','intersection','fields','length','model','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','show','params','keys','find','catch','create','body','user','role','Scheduler','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','run','../../config/schedule','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox'];(function(_0x5263da,_0x116f8d){var _0x5675b8=function(_0x104dd2){while(--_0x104dd2){_0x5263da['push'](_0x5263da['shift']());}};_0x5675b8(++_0x116f8d);}(_0xf582,0x15a));var _0x2f58=function(_0x46460e,_0x4a6c5e){_0x46460e=_0x46460e-0x0;var _0x4c36a3=_0xf582[_0x46460e];return _0x4c36a3;};'use strict';var emlformat=require(_0x2f58('0x0'));var rimraf=require(_0x2f58('0x1'));var zipdir=require(_0x2f58('0x2'));var jsonpatch=require(_0x2f58('0x3'));var rp=require(_0x2f58('0x4'));var moment=require(_0x2f58('0x5'));var BPromise=require(_0x2f58('0x6'));var Mustache=require(_0x2f58('0x7'));var util=require('util');var path=require(_0x2f58('0x8'));var sox=require(_0x2f58('0x9'));var csv=require(_0x2f58('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x2f58('0xb'));var _=require(_0x2f58('0xc'));var squel=require(_0x2f58('0xd'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x2f58('0xe'));var toCsv=require(_0x2f58('0xa'));var querystring=require(_0x2f58('0xf'));var Papa=require(_0x2f58('0x10'));var Redis=require(_0x2f58('0x11'));var authService=require(_0x2f58('0x12'));var qs=require(_0x2f58('0x13'));var as=require(_0x2f58('0x14'));var hardwareService=require(_0x2f58('0x15'));var logger=require(_0x2f58('0x16'))(_0x2f58('0x17'));var utils=require(_0x2f58('0x18'));var config=require(_0x2f58('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x2f58('0x1a'))['db'];function respondWithStatusCode(_0x275c03,_0x4474b2){_0x4474b2=_0x4474b2||0xcc;return function(_0x5f5d00){if(_0x5f5d00){return _0x275c03['sendStatus'](_0x4474b2);}return _0x275c03['status'](_0x4474b2)[_0x2f58('0x1b')]();};}function respondWithResult(_0x265ee7,_0x41c3f1){_0x41c3f1=_0x41c3f1||0xc8;return function(_0x26976c){if(_0x26976c){return _0x265ee7[_0x2f58('0x1c')](_0x41c3f1)[_0x2f58('0x1d')](_0x26976c);}};}function respondWithFilteredResult(_0x4336e9,_0x59bf38){return function(_0x19899f){if(_0x19899f){var _0x318945=typeof _0x59bf38[_0x2f58('0x1e')]==='undefined'&&typeof _0x59bf38[_0x2f58('0x1f')]==='undefined';var _0xcb089a=_0x19899f[_0x2f58('0x20')];var _0x3a36ba=_0x318945?0x0:_0x59bf38[_0x2f58('0x1e')];var _0x145439=_0x318945?_0x19899f['count']:_0x59bf38[_0x2f58('0x1e')]+_0x59bf38['limit'];var _0x5b09e3;if(_0x145439>=_0xcb089a){_0x145439=_0xcb089a;_0x5b09e3=0xc8;}else{_0x5b09e3=0xce;}_0x4336e9[_0x2f58('0x1c')](_0x5b09e3);return _0x4336e9[_0x2f58('0x21')](_0x2f58('0x22'),_0x3a36ba+'-'+_0x145439+'/'+_0xcb089a)[_0x2f58('0x1d')](_0x19899f);}return null;};}function patchUpdates(_0x20a3ac){return function(_0x54241e){try{jsonpatch[_0x2f58('0x23')](_0x54241e,_0x20a3ac,!![]);}catch(_0x4eca4f){return BPromise[_0x2f58('0x24')](_0x4eca4f);}return _0x54241e[_0x2f58('0x25')]();};}function saveUpdates(_0x347dae,_0x167ba0){return function(_0x57c725){if(_0x57c725){return _0x57c725['update'](_0x347dae)[_0x2f58('0x26')](function(_0x26b41a){return _0x26b41a;});}return null;};}function removeEntity(_0x287cd3,_0x4ad716){return function(_0x33ed6c){if(_0x33ed6c){return _0x33ed6c['destroy']()[_0x2f58('0x26')](function(){var _0x4d79fb=_0x33ed6c[_0x2f58('0x27')]({'plain':!![]});var _0x116043='Scheduler';return db[_0x2f58('0x28')][_0x2f58('0x29')]({'where':{'type':_0x116043,'resourceId':_0x4d79fb['id']}})[_0x2f58('0x26')](function(){return _0x33ed6c;});})[_0x2f58('0x26')](function(){_0x287cd3['status'](0xcc)[_0x2f58('0x1b')]();});}};}function handleEntityNotFound(_0x4e6d12,_0x57f6f3){return function(_0x12c23a){if(!_0x12c23a){_0x4e6d12[_0x2f58('0x2a')](0x194);}return _0x12c23a;};}function handleError(_0x41335e,_0x5323af){_0x5323af=_0x5323af||0x1f4;return function(_0x232065){logger[_0x2f58('0x2b')](_0x232065[_0x2f58('0x2c')]);if(_0x232065[_0x2f58('0x2d')]){delete _0x232065[_0x2f58('0x2d')];}_0x41335e[_0x2f58('0x1c')](_0x5323af)[_0x2f58('0x2e')](_0x232065);};}exports[_0x2f58('0x2f')]=function(_0x219c7d,_0x35dddb){var _0x47affa={},_0x1651db={},_0x350413={'count':0x0,'rows':[]};var _0x2078c8=_['map'](db[_0x2f58('0x30')][_0x2f58('0x31')],function(_0x33c9bd){return{'name':_0x33c9bd[_0x2f58('0x32')],'type':_0x33c9bd[_0x2f58('0x33')]['key']};});_0x1651db['model']=_[_0x2f58('0x34')](_0x2078c8,'name');_0x1651db[_0x2f58('0x35')]=_['keys'](_0x219c7d[_0x2f58('0x35')]);_0x1651db[_0x2f58('0x36')]=_['intersection'](_0x1651db['model'],_0x1651db[_0x2f58('0x35')]);_0x47affa[_0x2f58('0x37')]=_[_0x2f58('0x38')](_0x1651db['model'],qs['fields'](_0x219c7d[_0x2f58('0x35')][_0x2f58('0x39')]));_0x47affa[_0x2f58('0x37')]=_0x47affa[_0x2f58('0x37')][_0x2f58('0x3a')]?_0x47affa[_0x2f58('0x37')]:_0x1651db[_0x2f58('0x3b')];if(!_0x219c7d[_0x2f58('0x35')][_0x2f58('0x3c')](_0x2f58('0x3d'))){_0x47affa[_0x2f58('0x1f')]=qs[_0x2f58('0x1f')](_0x219c7d[_0x2f58('0x35')][_0x2f58('0x1f')]);_0x47affa[_0x2f58('0x1e')]=qs[_0x2f58('0x1e')](_0x219c7d[_0x2f58('0x35')]['offset']);}_0x47affa[_0x2f58('0x3e')]=qs['sort'](_0x219c7d[_0x2f58('0x35')][_0x2f58('0x3f')]);_0x47affa['where']=qs[_0x2f58('0x36')](_[_0x2f58('0x40')](_0x219c7d[_0x2f58('0x35')],_0x1651db['filters']),_0x2078c8);if(_0x219c7d[_0x2f58('0x35')][_0x2f58('0x41')]){_0x47affa[_0x2f58('0x42')]=_[_0x2f58('0x43')](_0x47affa[_0x2f58('0x42')],{'$or':_[_0x2f58('0x34')](_0x2078c8,function(_0x1d21dc){if(_0x1d21dc[_0x2f58('0x33')]!==_0x2f58('0x44')){var _0x25ac1={};_0x25ac1[_0x1d21dc['name']]={'$like':'%'+_0x219c7d[_0x2f58('0x35')][_0x2f58('0x41')]+'%'};return _0x25ac1;}})});}_0x47affa=_[_0x2f58('0x43')]({},_0x47affa,_0x219c7d[_0x2f58('0x45')]);var _0x4b8696={'where':_0x47affa['where']};return db[_0x2f58('0x30')][_0x2f58('0x20')](_0x4b8696)[_0x2f58('0x26')](function(_0xb2a173){_0x350413['count']=_0xb2a173;if(_0x219c7d['query'][_0x2f58('0x46')]){_0x47affa[_0x2f58('0x47')]=[{'all':!![]}];}return db['Schedule'][_0x2f58('0x48')](_0x47affa);})[_0x2f58('0x26')](function(_0x869df){_0x350413['rows']=_0x869df;return _0x350413;})[_0x2f58('0x26')](respondWithFilteredResult(_0x35dddb,_0x47affa))['catch'](handleError(_0x35dddb,null));};exports[_0x2f58('0x49')]=function(_0x374771,_0x496e5d){var _0x38eb90={'raw':![],'where':{'id':_0x374771[_0x2f58('0x4a')]['id']}},_0x58a3db={};_0x58a3db[_0x2f58('0x3b')]=_[_0x2f58('0x4b')](db[_0x2f58('0x30')][_0x2f58('0x31')]);_0x58a3db[_0x2f58('0x35')]=_[_0x2f58('0x4b')](_0x374771[_0x2f58('0x35')]);_0x58a3db[_0x2f58('0x36')]=_[_0x2f58('0x38')](_0x58a3db[_0x2f58('0x3b')],_0x58a3db['query']);_0x38eb90[_0x2f58('0x37')]=_[_0x2f58('0x38')](_0x58a3db[_0x2f58('0x3b')],qs['fields'](_0x374771[_0x2f58('0x35')][_0x2f58('0x39')]));_0x38eb90[_0x2f58('0x37')]=_0x38eb90[_0x2f58('0x37')][_0x2f58('0x3a')]?_0x38eb90[_0x2f58('0x37')]:_0x58a3db[_0x2f58('0x3b')];if(_0x374771[_0x2f58('0x35')][_0x2f58('0x46')]){_0x38eb90[_0x2f58('0x47')]=[{'all':!![]}];}_0x38eb90=_[_0x2f58('0x43')]({},_0x38eb90,_0x374771[_0x2f58('0x45')]);return db[_0x2f58('0x30')][_0x2f58('0x4c')](_0x38eb90)['then'](handleEntityNotFound(_0x496e5d,null))[_0x2f58('0x26')](respondWithResult(_0x496e5d,null))[_0x2f58('0x4d')](handleError(_0x496e5d,null));};exports[_0x2f58('0x4e')]=function(_0x463388,_0x174583){return db['Schedule'][_0x2f58('0x4e')](_0x463388[_0x2f58('0x4f')],{})[_0x2f58('0x26')](function(_0x3acaed){var _0x2c6160=_0x463388[_0x2f58('0x50')][_0x2f58('0x27')]({'plain':!![]});if(!_0x2c6160)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x2c6160[_0x2f58('0x51')]===_0x2f58('0x50')){var _0x3c1c14=_0x3acaed['get']({'plain':!![]});var _0x14a2fe=_0x2f58('0x52');return db[_0x2f58('0x53')][_0x2f58('0x4c')]({'where':{'name':_0x14a2fe,'userProfileId':_0x2c6160['userProfileId']},'raw':!![]})[_0x2f58('0x26')](function(_0x4761f0){if(_0x4761f0&&_0x4761f0[_0x2f58('0x54')]===0x0){return db[_0x2f58('0x28')][_0x2f58('0x4e')]({'name':_0x3c1c14[_0x2f58('0x2d')],'resourceId':_0x3c1c14['id'],'type':_0x4761f0[_0x2f58('0x2d')],'sectionId':_0x4761f0['id']},{})['then'](function(){return _0x3acaed;});}else{return _0x3acaed;}})[_0x2f58('0x4d')](function(_0x5b30dd){logger[_0x2f58('0x2b')](_0x2f58('0x55'),_0x5b30dd);throw _0x5b30dd;});}return _0x3acaed;})['then'](respondWithResult(_0x174583,0xc9))[_0x2f58('0x4d')](handleError(_0x174583,null));};exports[_0x2f58('0x56')]=function(_0x7ffbb1,_0x1e6b33){if(_0x7ffbb1[_0x2f58('0x4f')]['id']){delete _0x7ffbb1[_0x2f58('0x4f')]['id'];}return db[_0x2f58('0x30')][_0x2f58('0x4c')]({'where':{'id':_0x7ffbb1[_0x2f58('0x4a')]['id']}})[_0x2f58('0x26')](handleEntityNotFound(_0x1e6b33,null))[_0x2f58('0x26')](saveUpdates(_0x7ffbb1[_0x2f58('0x4f')],null))['then'](respondWithResult(_0x1e6b33,null))[_0x2f58('0x4d')](handleError(_0x1e6b33,null));};exports['destroy']=function(_0x3d2acd,_0x13f662){return db[_0x2f58('0x30')][_0x2f58('0x4c')]({'where':{'id':_0x3d2acd[_0x2f58('0x4a')]['id']}})[_0x2f58('0x26')](handleEntityNotFound(_0x13f662,null))[_0x2f58('0x26')](removeEntity(_0x13f662,null))[_0x2f58('0x4d')](handleError(_0x13f662,null));};exports[_0x2f58('0x57')]=function(_0x4b6188,_0x4db0ab,_0x22bc6c){var _0x5e301b=require(_0x2f58('0x58'));return db['Schedule'][_0x2f58('0x4c')]({'where':{'id':_0x4b6188[_0x2f58('0x4a')]['id']},'raw':!![]})[_0x2f58('0x26')](handleEntityNotFound(_0x4db0ab,null))[_0x2f58('0x26')](function(){_0x5e301b[_0x2f58('0x57')](_0x4b6188[_0x2f58('0x4a')]['id']);})[_0x2f58('0x26')](respondWithStatusCode(_0x4db0ab,null))['catch'](handleError(_0x4db0ab,null));}; \ No newline at end of file +var _0xf471=['mustache','util','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','offset','undefined','limit','count','set','json','apply','reject','save','update','then','get','UserProfileResource','destroy','name','send','index','map','Schedule','fieldName','type','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','sort','where','pick','filter','merge','options','includeAll','include','rows','show','rawAttributes','length','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','params','run','eml-format','zip-dir','fast-json-patch','request-promise','moment'];(function(_0x4df1f8,_0x45d96b){var _0x227d88=function(_0x1ce8ab){while(--_0x1ce8ab){_0x4df1f8['push'](_0x4df1f8['shift']());}};_0x227d88(++_0x45d96b);}(_0xf471,0x190));var _0x1f47=function(_0x574cc9,_0x72ad1e){_0x574cc9=_0x574cc9-0x0;var _0x17492c=_0xf471[_0x574cc9];return _0x17492c;};'use strict';var emlformat=require(_0x1f47('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1f47('0x1'));var jsonpatch=require(_0x1f47('0x2'));var rp=require(_0x1f47('0x3'));var moment=require(_0x1f47('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x1f47('0x5'));var util=require(_0x1f47('0x6'));var path=require(_0x1f47('0x7'));var sox=require('sox');var csv=require(_0x1f47('0x8'));var ejs=require(_0x1f47('0x9'));var fs=require('fs');var fs_extra=require(_0x1f47('0xa'));var _=require('lodash');var squel=require(_0x1f47('0xb'));var crypto=require(_0x1f47('0xc'));var jsforce=require(_0x1f47('0xd'));var deskjs=require(_0x1f47('0xe'));var toCsv=require('to-csv');var querystring=require(_0x1f47('0xf'));var Papa=require(_0x1f47('0x10'));var Redis=require(_0x1f47('0x11'));var authService=require(_0x1f47('0x12'));var qs=require(_0x1f47('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x1f47('0x14'))(_0x1f47('0x15'));var utils=require(_0x1f47('0x16'));var config=require(_0x1f47('0x17'));var licenseUtil=require(_0x1f47('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x4d3c03,_0xa7c0a1){_0xa7c0a1=_0xa7c0a1||0xcc;return function(_0x103bf0){if(_0x103bf0){return _0x4d3c03[_0x1f47('0x19')](_0xa7c0a1);}return _0x4d3c03[_0x1f47('0x1a')](_0xa7c0a1)[_0x1f47('0x1b')]();};}function respondWithResult(_0x12292c,_0x28136f){_0x28136f=_0x28136f||0xc8;return function(_0x512f89){if(_0x512f89){return _0x12292c[_0x1f47('0x1a')](_0x28136f)['json'](_0x512f89);}};}function respondWithFilteredResult(_0x2e67d2,_0x483f64){return function(_0x52bd16){if(_0x52bd16){var _0x372888=typeof _0x483f64[_0x1f47('0x1c')]===_0x1f47('0x1d')&&typeof _0x483f64[_0x1f47('0x1e')]==='undefined';var _0x1cac84=_0x52bd16[_0x1f47('0x1f')];var _0x1e1607=_0x372888?0x0:_0x483f64[_0x1f47('0x1c')];var _0x24d88b=_0x372888?_0x52bd16[_0x1f47('0x1f')]:_0x483f64[_0x1f47('0x1c')]+_0x483f64[_0x1f47('0x1e')];var _0x415f52;if(_0x24d88b>=_0x1cac84){_0x24d88b=_0x1cac84;_0x415f52=0xc8;}else{_0x415f52=0xce;}_0x2e67d2[_0x1f47('0x1a')](_0x415f52);return _0x2e67d2[_0x1f47('0x20')]('Content-Range',_0x1e1607+'-'+_0x24d88b+'/'+_0x1cac84)[_0x1f47('0x21')](_0x52bd16);}return null;};}function patchUpdates(_0x4acf28){return function(_0x1635e8){try{jsonpatch[_0x1f47('0x22')](_0x1635e8,_0x4acf28,!![]);}catch(_0x1ae555){return BPromise[_0x1f47('0x23')](_0x1ae555);}return _0x1635e8[_0x1f47('0x24')]();};}function saveUpdates(_0x29fc21,_0x4d7ec2){return function(_0xe1ed5e){if(_0xe1ed5e){return _0xe1ed5e[_0x1f47('0x25')](_0x29fc21)[_0x1f47('0x26')](function(_0x5db7ae){return _0x5db7ae;});}return null;};}function removeEntity(_0x13f725,_0x2eb7a2){return function(_0x43fa5c){if(_0x43fa5c){return _0x43fa5c['destroy']()[_0x1f47('0x26')](function(){var _0x2f1fae=_0x43fa5c[_0x1f47('0x27')]({'plain':!![]});var _0x1506cf='Scheduler';return db[_0x1f47('0x28')][_0x1f47('0x29')]({'where':{'type':_0x1506cf,'resourceId':_0x2f1fae['id']}})[_0x1f47('0x26')](function(){return _0x43fa5c;});})[_0x1f47('0x26')](function(){_0x13f725[_0x1f47('0x1a')](0xcc)[_0x1f47('0x1b')]();});}};}function handleEntityNotFound(_0x209cab,_0x300c0e){return function(_0x2db156){if(!_0x2db156){_0x209cab['sendStatus'](0x194);}return _0x2db156;};}function handleError(_0x355c54,_0x512de7){_0x512de7=_0x512de7||0x1f4;return function(_0x45ee37){logger['error'](_0x45ee37['stack']);if(_0x45ee37[_0x1f47('0x2a')]){delete _0x45ee37[_0x1f47('0x2a')];}_0x355c54[_0x1f47('0x1a')](_0x512de7)[_0x1f47('0x2b')](_0x45ee37);};}exports[_0x1f47('0x2c')]=function(_0x5a5ef2,_0x42ca32){var _0x185f43={},_0x4ded43={},_0x554d51={'count':0x0,'rows':[]};var _0x5cdb03=_[_0x1f47('0x2d')](db[_0x1f47('0x2e')]['rawAttributes'],function(_0x5ae3df){return{'name':_0x5ae3df[_0x1f47('0x2f')],'type':_0x5ae3df[_0x1f47('0x30')]['key']};});_0x4ded43[_0x1f47('0x31')]=_[_0x1f47('0x2d')](_0x5cdb03,_0x1f47('0x2a'));_0x4ded43[_0x1f47('0x32')]=_[_0x1f47('0x33')](_0x5a5ef2[_0x1f47('0x32')]);_0x4ded43[_0x1f47('0x34')]=_[_0x1f47('0x35')](_0x4ded43[_0x1f47('0x31')],_0x4ded43[_0x1f47('0x32')]);_0x185f43['attributes']=_[_0x1f47('0x35')](_0x4ded43[_0x1f47('0x31')],qs[_0x1f47('0x36')](_0x5a5ef2[_0x1f47('0x32')][_0x1f47('0x36')]));_0x185f43[_0x1f47('0x37')]=_0x185f43[_0x1f47('0x37')]['length']?_0x185f43['attributes']:_0x4ded43[_0x1f47('0x31')];if(!_0x5a5ef2[_0x1f47('0x32')][_0x1f47('0x38')](_0x1f47('0x39'))){_0x185f43[_0x1f47('0x1e')]=qs[_0x1f47('0x1e')](_0x5a5ef2[_0x1f47('0x32')][_0x1f47('0x1e')]);_0x185f43['offset']=qs[_0x1f47('0x1c')](_0x5a5ef2['query']['offset']);}_0x185f43['order']=qs[_0x1f47('0x3a')](_0x5a5ef2[_0x1f47('0x32')][_0x1f47('0x3a')]);_0x185f43[_0x1f47('0x3b')]=qs[_0x1f47('0x34')](_[_0x1f47('0x3c')](_0x5a5ef2[_0x1f47('0x32')],_0x4ded43[_0x1f47('0x34')]),_0x5cdb03);if(_0x5a5ef2[_0x1f47('0x32')][_0x1f47('0x3d')]){_0x185f43[_0x1f47('0x3b')]=_[_0x1f47('0x3e')](_0x185f43[_0x1f47('0x3b')],{'$or':_['map'](_0x5cdb03,function(_0x350a8b){if(_0x350a8b[_0x1f47('0x30')]!=='VIRTUAL'){var _0x2977b7={};_0x2977b7[_0x350a8b[_0x1f47('0x2a')]]={'$like':'%'+_0x5a5ef2[_0x1f47('0x32')][_0x1f47('0x3d')]+'%'};return _0x2977b7;}})});}_0x185f43=_[_0x1f47('0x3e')]({},_0x185f43,_0x5a5ef2[_0x1f47('0x3f')]);var _0x5c80ae={'where':_0x185f43[_0x1f47('0x3b')]};return db[_0x1f47('0x2e')][_0x1f47('0x1f')](_0x5c80ae)[_0x1f47('0x26')](function(_0x2d511c){_0x554d51['count']=_0x2d511c;if(_0x5a5ef2['query'][_0x1f47('0x40')]){_0x185f43[_0x1f47('0x41')]=[{'all':!![]}];}return db[_0x1f47('0x2e')]['findAll'](_0x185f43);})['then'](function(_0xaeba2f){_0x554d51[_0x1f47('0x42')]=_0xaeba2f;return _0x554d51;})['then'](respondWithFilteredResult(_0x42ca32,_0x185f43))['catch'](handleError(_0x42ca32,null));};exports[_0x1f47('0x43')]=function(_0xb54ea4,_0x328aad){var _0x26dd2f={'raw':![],'where':{'id':_0xb54ea4['params']['id']}},_0x52b389={};_0x52b389['model']=_[_0x1f47('0x33')](db[_0x1f47('0x2e')][_0x1f47('0x44')]);_0x52b389[_0x1f47('0x32')]=_[_0x1f47('0x33')](_0xb54ea4[_0x1f47('0x32')]);_0x52b389['filters']=_[_0x1f47('0x35')](_0x52b389[_0x1f47('0x31')],_0x52b389['query']);_0x26dd2f['attributes']=_['intersection'](_0x52b389[_0x1f47('0x31')],qs[_0x1f47('0x36')](_0xb54ea4[_0x1f47('0x32')][_0x1f47('0x36')]));_0x26dd2f[_0x1f47('0x37')]=_0x26dd2f[_0x1f47('0x37')][_0x1f47('0x45')]?_0x26dd2f['attributes']:_0x52b389[_0x1f47('0x31')];if(_0xb54ea4[_0x1f47('0x32')][_0x1f47('0x40')]){_0x26dd2f['include']=[{'all':!![]}];}_0x26dd2f=_[_0x1f47('0x3e')]({},_0x26dd2f,_0xb54ea4[_0x1f47('0x3f')]);return db['Schedule']['find'](_0x26dd2f)['then'](handleEntityNotFound(_0x328aad,null))[_0x1f47('0x26')](respondWithResult(_0x328aad,null))[_0x1f47('0x46')](handleError(_0x328aad,null));};exports[_0x1f47('0x47')]=function(_0x5683da,_0x33d97d){return db[_0x1f47('0x2e')][_0x1f47('0x47')](_0x5683da[_0x1f47('0x48')],{})['then'](function(_0x422169){var _0x34761d=_0x5683da[_0x1f47('0x49')][_0x1f47('0x27')]({'plain':!![]});if(!_0x34761d)throw new Error(_0x1f47('0x4a'));if(_0x34761d[_0x1f47('0x4b')]==='user'){var _0x4c61b9=_0x422169[_0x1f47('0x27')]({'plain':!![]});var _0x2335d7='Scheduler';return db[_0x1f47('0x4c')][_0x1f47('0x4d')]({'where':{'name':_0x2335d7,'userProfileId':_0x34761d[_0x1f47('0x4e')]},'raw':!![]})[_0x1f47('0x26')](function(_0x55ea33){if(_0x55ea33&&_0x55ea33['autoAssociation']===0x0){return db[_0x1f47('0x28')][_0x1f47('0x47')]({'name':_0x4c61b9[_0x1f47('0x2a')],'resourceId':_0x4c61b9['id'],'type':_0x55ea33[_0x1f47('0x2a')],'sectionId':_0x55ea33['id']},{})[_0x1f47('0x26')](function(){return _0x422169;});}else{return _0x422169;}})[_0x1f47('0x46')](function(_0x32067a){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x32067a);throw _0x32067a;});}return _0x422169;})[_0x1f47('0x26')](respondWithResult(_0x33d97d,0xc9))[_0x1f47('0x46')](handleError(_0x33d97d,null));};exports['update']=function(_0x2dd49e,_0x42e1ac){if(_0x2dd49e[_0x1f47('0x48')]['id']){delete _0x2dd49e[_0x1f47('0x48')]['id'];}return db[_0x1f47('0x2e')][_0x1f47('0x4d')]({'where':{'id':_0x2dd49e[_0x1f47('0x4f')]['id']}})[_0x1f47('0x26')](handleEntityNotFound(_0x42e1ac,null))['then'](saveUpdates(_0x2dd49e['body'],null))[_0x1f47('0x26')](respondWithResult(_0x42e1ac,null))[_0x1f47('0x46')](handleError(_0x42e1ac,null));};exports[_0x1f47('0x29')]=function(_0xb87096,_0x4bb727){return db['Schedule'][_0x1f47('0x4d')]({'where':{'id':_0xb87096[_0x1f47('0x4f')]['id']}})[_0x1f47('0x26')](handleEntityNotFound(_0x4bb727,null))[_0x1f47('0x26')](removeEntity(_0x4bb727,null))['catch'](handleError(_0x4bb727,null));};exports[_0x1f47('0x50')]=function(_0x1206b2,_0x3cd62f,_0x468d3d){var _0x4ee2ce=require('../../config/schedule');return db['Schedule'][_0x1f47('0x4d')]({'where':{'id':_0x1206b2[_0x1f47('0x4f')]['id']},'raw':!![]})[_0x1f47('0x26')](handleEntityNotFound(_0x3cd62f,null))[_0x1f47('0x26')](function(){_0x4ee2ce['run'](_0x1206b2[_0x1f47('0x4f')]['id']);})[_0x1f47('0x26')](respondWithStatusCode(_0x3cd62f,null))[_0x1f47('0x46')](handleError(_0x3cd62f,null));}; \ No newline at end of file diff --git a/server/api/schedule/schedule.model.js b/server/api/schedule/schedule.model.js index 01b3c29..616cbb8 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 _0x1794=['tools_schedules','util','api','moment','bluebird','path','./schedule.attributes','exports','define'];(function(_0x3ccc8f,_0x1e7f1e){var _0x49959c=function(_0x4e4fbe){while(--_0x4e4fbe){_0x3ccc8f['push'](_0x3ccc8f['shift']());}};_0x49959c(++_0x1e7f1e);}(_0x1794,0x12a));var _0x4179=function(_0x463ca5,_0x576d59){_0x463ca5=_0x463ca5-0x0;var _0x29f40d=_0x1794[_0x463ca5];return _0x29f40d;};'use strict';var _=require('lodash');var util=require(_0x4179('0x0'));var logger=require('../../config/logger')(_0x4179('0x1'));var moment=require(_0x4179('0x2'));var BPromise=require(_0x4179('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x4179('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x4179('0x5'));module[_0x4179('0x6')]=function(_0x521377,_0xefb38){return _0x521377[_0x4179('0x7')]('Schedule',attributes,{'tableName':_0x4179('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1620=['moment','rimraf','./schedule.attributes','exports','tools_schedules','lodash','util','../../config/logger','api'];(function(_0x383bfa,_0x4fee56){var _0x2607a6=function(_0x2a1b7d){while(--_0x2a1b7d){_0x383bfa['push'](_0x383bfa['shift']());}};_0x2607a6(++_0x4fee56);}(_0x1620,0x9e));var _0x0162=function(_0x17ae8c,_0x3d1d49){_0x17ae8c=_0x17ae8c-0x0;var _0x43b387=_0x1620[_0x17ae8c];return _0x43b387;};'use strict';var _=require(_0x0162('0x0'));var util=require(_0x0162('0x1'));var logger=require(_0x0162('0x2'))(_0x0162('0x3'));var moment=require(_0x0162('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x0162('0x5'));var config=require('../../config/environment');var attributes=require(_0x0162('0x6'));module[_0x0162('0x7')]=function(_0x407696,_0x3f3046){return _0x407696['define']('Schedule',attributes,{'tableName':_0x0162('0x8'),'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 9487c95..173e634 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 _0x5181=['../../config/logger','rpc','../../config/environment','client','http','request','then','info','Schedule,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','util','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2300f2,_0x315c5f){var _0x6bd508=function(_0x2fa0f6){while(--_0x2fa0f6){_0x2300f2['push'](_0x2300f2['shift']());}};_0x6bd508(++_0x315c5f);}(_0x5181,0x175));var _0x1518=function(_0x16b51e,_0x30cb17){_0x16b51e=_0x16b51e-0x0;var _0x27b91a=_0x5181[_0x16b51e];return _0x27b91a;};'use strict';var _=require('lodash');var util=require(_0x1518('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1518('0x1'));var fs=require('fs');var Redis=require(_0x1518('0x2'));var db=require(_0x1518('0x3'))['db'];var utils=require(_0x1518('0x4'));var logger=require(_0x1518('0x5'))(_0x1518('0x6'));var config=require(_0x1518('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x1518('0x8')][_0x1518('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3ba52f,_0x35b83d,_0x1614a7){return new BPromise(function(_0x3bce17,_0x4d8a36){return client[_0x1518('0xa')](_0x3ba52f,_0x1614a7)[_0x1518('0xb')](function(_0xd9d7bc){logger[_0x1518('0xc')](_0x1518('0xd'),_0x35b83d,_0x1518('0xe'));logger[_0x1518('0xf')]('Schedule,\x20%s,\x20%s,\x20%s',_0x35b83d,_0x1518('0xe'),JSON[_0x1518('0x10')](_0xd9d7bc));if(_0xd9d7bc['error']){if(_0xd9d7bc[_0x1518('0x11')][_0x1518('0x12')]===0x1f4){logger['error'](_0x1518('0xd'),_0x35b83d,_0xd9d7bc[_0x1518('0x11')][_0x1518('0x13')]);return _0x4d8a36(_0xd9d7bc[_0x1518('0x11')][_0x1518('0x13')]);}logger[_0x1518('0x11')](_0x1518('0xd'),_0x35b83d,_0xd9d7bc[_0x1518('0x11')][_0x1518('0x13')]);return _0x3bce17(_0xd9d7bc['error'][_0x1518('0x13')]);}else{logger[_0x1518('0xc')](_0x1518('0xd'),_0x35b83d,_0x1518('0xe'));_0x3bce17(_0xd9d7bc[_0x1518('0x14')][_0x1518('0x13')]);}})['catch'](function(_0x3815e5){logger[_0x1518('0x11')](_0x1518('0xd'),_0x35b83d,_0x3815e5);_0x4d8a36(_0x3815e5);});});} \ No newline at end of file +var _0xffd9=['client','http','then','info','request\x20sent','debug','Schedule,\x20%s,\x20%s,\x20%s','stringify','error','code','Schedule,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise'];(function(_0x43f1fa,_0x1fab79){var _0x1c2c1f=function(_0x22f653){while(--_0x22f653){_0x43f1fa['push'](_0x43f1fa['shift']());}};_0x1c2c1f(++_0x1fab79);}(_0xffd9,0x65));var _0x9ffd=function(_0x406095,_0x15cd7a){_0x406095=_0x406095-0x0;var _0x542d35=_0xffd9[_0x406095];return _0x542d35;};'use strict';var _=require(_0x9ffd('0x0'));var util=require(_0x9ffd('0x1'));var moment=require(_0x9ffd('0x2'));var BPromise=require(_0x9ffd('0x3'));var rs=require(_0x9ffd('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x9ffd('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9ffd('0x6'));var config=require(_0x9ffd('0x7'));var jayson=require(_0x9ffd('0x8'));var client=jayson[_0x9ffd('0x9')][_0x9ffd('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4f5b53,_0x4372ce,_0x60ade){return new BPromise(function(_0x3f14b8,_0x179c77){return client['request'](_0x4f5b53,_0x60ade)[_0x9ffd('0xb')](function(_0x329984){logger[_0x9ffd('0xc')]('Schedule,\x20%s,\x20%s',_0x4372ce,_0x9ffd('0xd'));logger[_0x9ffd('0xe')](_0x9ffd('0xf'),_0x4372ce,_0x9ffd('0xd'),JSON[_0x9ffd('0x10')](_0x329984));if(_0x329984[_0x9ffd('0x11')]){if(_0x329984['error'][_0x9ffd('0x12')]===0x1f4){logger['error']('Schedule,\x20%s,\x20%s',_0x4372ce,_0x329984[_0x9ffd('0x11')]['message']);return _0x179c77(_0x329984[_0x9ffd('0x11')]['message']);}logger[_0x9ffd('0x11')](_0x9ffd('0x13'),_0x4372ce,_0x329984[_0x9ffd('0x11')][_0x9ffd('0x14')]);return _0x3f14b8(_0x329984[_0x9ffd('0x11')]['message']);}else{logger[_0x9ffd('0xc')](_0x9ffd('0x13'),_0x4372ce,'request\x20sent');_0x3f14b8(_0x329984[_0x9ffd('0x15')][_0x9ffd('0x14')]);}})['catch'](function(_0x4695f4){logger[_0x9ffd('0x11')]('Schedule,\x20%s,\x20%s',_0x4372ce,_0x4695f4);_0x179c77(_0x4695f4);});});} \ No newline at end of file diff --git a/server/api/screenRecording/index.js b/server/api/screenRecording/index.js index 8d4a1f2..c26d96c 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 _0x52b9=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','/:id','/:id/download','download','create','update','delete','exports','multer','util','path'];(function(_0x4fdac2,_0x5d5118){var _0x395e08=function(_0x5c7138){while(--_0x5c7138){_0x4fdac2['push'](_0x4fdac2['shift']());}};_0x395e08(++_0x5d5118);}(_0x52b9,0x18d));var _0x952b=function(_0x3c015d,_0x452a75){_0x3c015d=_0x3c015d-0x0;var _0x533fde=_0x52b9[_0x3c015d];return _0x533fde;};'use strict';var multer=require(_0x952b('0x0'));var util=require(_0x952b('0x1'));var path=require(_0x952b('0x2'));var timeout=require(_0x952b('0x3'));var express=require(_0x952b('0x4'));var router=express[_0x952b('0x5')]();var fs_extra=require(_0x952b('0x6'));var auth=require(_0x952b('0x7'));var interaction=require(_0x952b('0x8'));var config=require(_0x952b('0x9'));var controller=require('./screenRecording.controller');router['get']('/',auth[_0x952b('0xa')](),controller['index']);router[_0x952b('0xb')]('/describe',auth[_0x952b('0xa')](),controller[_0x952b('0xc')]);router[_0x952b('0xb')](_0x952b('0xd'),auth[_0x952b('0xa')](),controller['show']);router[_0x952b('0xb')](_0x952b('0xe'),auth[_0x952b('0xa')](),controller[_0x952b('0xf')]);router['post']('/',auth[_0x952b('0xa')](),controller[_0x952b('0x10')]);router['put'](_0x952b('0xd'),auth['isAuthenticated'](),controller[_0x952b('0x11')]);router[_0x952b('0x12')](_0x952b('0xd'),auth[_0x952b('0xa')](),controller['destroy']);module[_0x952b('0x13')]=router; \ No newline at end of file +var _0x42a1=['get','isAuthenticated','index','describe','/:id','show','/:id/download','delete','destroy','exports','Router','fs-extra','../../components/interaction/service','../../config/environment','./screenRecording.controller'];(function(_0x2817aa,_0x52591e){var _0x22e33b=function(_0x14aca1){while(--_0x14aca1){_0x2817aa['push'](_0x2817aa['shift']());}};_0x22e33b(++_0x52591e);}(_0x42a1,0x1ea));var _0x142a=function(_0x5d80de,_0x2cf15d){_0x5d80de=_0x5d80de-0x0;var _0x1c7556=_0x42a1[_0x5d80de];return _0x1c7556;};'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[_0x142a('0x0')]();var fs_extra=require(_0x142a('0x1'));var auth=require('../../components/auth/service');var interaction=require(_0x142a('0x2'));var config=require(_0x142a('0x3'));var controller=require(_0x142a('0x4'));router[_0x142a('0x5')]('/',auth[_0x142a('0x6')](),controller[_0x142a('0x7')]);router['get']('/describe',auth[_0x142a('0x6')](),controller[_0x142a('0x8')]);router[_0x142a('0x5')](_0x142a('0x9'),auth[_0x142a('0x6')](),controller[_0x142a('0xa')]);router[_0x142a('0x5')](_0x142a('0xb'),auth[_0x142a('0x6')](),controller['download']);router['post']('/',auth[_0x142a('0x6')](),controller['create']);router['put'](_0x142a('0x9'),auth[_0x142a('0x6')](),controller['update']);router[_0x142a('0xc')](_0x142a('0x9'),auth[_0x142a('0x6')](),controller[_0x142a('0xd')]);module[_0x142a('0xe')]=router; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.attributes.js b/server/api/screenRecording/screenRecording.attributes.js index 14a8bf0..5009e00 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 _0x7af9=['createdAt','updatedAt','sequelize','path','../../config/environment','VIRTUAL','getDataValue','value','extname','STRING','replace','INTEGER','setDataValue','subtract','closedAt','duration','DATE','startedAt','format','MM-DD-YYYY\x20HH:mm','toString'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7af9,0x95));var _0x97af=function(_0xb2c52a,_0x29e0ba){_0xb2c52a=_0xb2c52a-0x0;var _0x1b2498=_0x7af9[_0xb2c52a];return _0x1b2498;};'use strict';var Sequelize=require(_0x97af('0x0'));var moment=require('moment');var path=require(_0x97af('0x1'));var config=require(_0x97af('0x2'));module['exports']={'format':{'type':Sequelize[_0x97af('0x3')],'get':function(){return this[_0x97af('0x4')](_0x97af('0x5'))?path[_0x97af('0x6')](this[_0x97af('0x4')]('value')):undefined;}},'interactionid':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'value':{'type':Sequelize[_0x97af('0x7')],'set':function(_0x966c4e){var _0x265d22=_0x966c4e[_0x97af('0x8')](/\\/g,'/');this['setDataValue'](_0x97af('0x5'),_0x265d22);}},'rating':{'type':Sequelize[_0x97af('0x9')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x97af('0x9')],'set':function(_0x4b866a){this[_0x97af('0xa')]('startedAt',moment()[_0x97af('0xb')](_0x4b866a,'ms'));this[_0x97af('0xa')](_0x97af('0xc'),moment());this[_0x97af('0xa')](_0x97af('0xd'),_0x4b866a);}},'startedAt':{'type':Sequelize[_0x97af('0xe')],'get':function(){return moment(this[_0x97af('0x4')](_0x97af('0xf')))[_0x97af('0x10')](_0x97af('0x11'))[_0x97af('0x12')]();}},'closedAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x97af('0x4')]('closedAt'))['format'](_0x97af('0x11'))[_0x97af('0x12')]();}},'createdAt':{'type':Sequelize[_0x97af('0xe')],'get':function(){return moment(this[_0x97af('0x4')](_0x97af('0x13')))[_0x97af('0x10')](_0x97af('0x11'))['toString']();}},'updatedAt':{'type':Sequelize[_0x97af('0xe')],'get':function(){return moment(this['getDataValue'](_0x97af('0x14')))['format'](_0x97af('0x11'))['toString']();}}}; \ No newline at end of file +var _0xe797=['INTEGER','startedAt','subtract','setDataValue','closedAt','duration','DATE','getDataValue','MM-DD-YYYY\x20HH:mm','format','toString','createdAt','sequelize','moment','path','../../config/environment','exports','VIRTUAL','value','extname','STRING','replace'];(function(_0x40220a,_0x22feb1){var _0x3903cc=function(_0x33a296){while(--_0x33a296){_0x40220a['push'](_0x40220a['shift']());}};_0x3903cc(++_0x22feb1);}(_0xe797,0x12a));var _0x7e79=function(_0x214d03,_0x5008f6){_0x214d03=_0x214d03-0x0;var _0x5e5881=_0xe797[_0x214d03];return _0x5e5881;};'use strict';var Sequelize=require(_0x7e79('0x0'));var moment=require(_0x7e79('0x1'));var path=require(_0x7e79('0x2'));var config=require(_0x7e79('0x3'));module[_0x7e79('0x4')]={'format':{'type':Sequelize[_0x7e79('0x5')],'get':function(){return this['getDataValue'](_0x7e79('0x6'))?path[_0x7e79('0x7')](this['getDataValue'](_0x7e79('0x6'))):undefined;}},'interactionid':{'type':Sequelize[_0x7e79('0x8')]},'channel':{'type':Sequelize[_0x7e79('0x8')]},'value':{'type':Sequelize['STRING'],'set':function(_0x4fdfa1){var _0x9dd35a=_0x4fdfa1[_0x7e79('0x9')](/\\/g,'/');this['setDataValue']('value',_0x9dd35a);}},'rating':{'type':Sequelize[_0x7e79('0xa')],'validate':{'max':0x5,'min':0x0}},'duration':{'type':Sequelize[_0x7e79('0xa')],'set':function(_0x134e89){this['setDataValue'](_0x7e79('0xb'),moment()[_0x7e79('0xc')](_0x134e89,'ms'));this[_0x7e79('0xd')](_0x7e79('0xe'),moment());this[_0x7e79('0xd')](_0x7e79('0xf'),_0x134e89);}},'startedAt':{'type':Sequelize[_0x7e79('0x10')],'get':function(){return moment(this[_0x7e79('0x11')](_0x7e79('0xb')))['format'](_0x7e79('0x12'))['toString']();}},'closedAt':{'type':Sequelize[_0x7e79('0x10')],'get':function(){return moment(this['getDataValue'](_0x7e79('0xe')))[_0x7e79('0x13')](_0x7e79('0x12'))[_0x7e79('0x14')]();}},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x7e79('0x11')](_0x7e79('0x15')))[_0x7e79('0x13')](_0x7e79('0x12'))[_0x7e79('0x14')]();}},'updatedAt':{'type':Sequelize[_0x7e79('0x10')],'get':function(){return moment(this[_0x7e79('0x11')]('updatedAt'))[_0x7e79('0x13')](_0x7e79('0x12'))[_0x7e79('0x14')]();}}}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.controller.js b/server/api/screenRecording/screenRecording.controller.js index cc10af8..1e5a52b 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 _0x6f47=['zip-dir','request-promise','bluebird','util','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','reject','save','update','then','destroy','error','stack','name','send','ScreenRecording','fieldName','type','key','model','format','query','keys','filters','intersection','attributes','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','fields','catch','create','body','duration','createdAt','closedAt','value','find','describe','uniqueid','join','existsSync','decryptFile','secrets','recording','Sequelize','ValidationError','ScreenRecording\x20not\x20found','filename','unlink','Not\x20found','isNil','Entity\x20not\x20found','root','server/files/screen_recordings','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','info','rimraf'];(function(_0x117e30,_0x343bd7){var _0x266c91=function(_0x4f668f){while(--_0x4f668f){_0x117e30['push'](_0x117e30['shift']());}};_0x266c91(++_0x343bd7);}(_0x6f47,0xc7));var _0x76f4=function(_0x31e29a,_0x349c9b){_0x31e29a=_0x31e29a-0x0;var _0x32d892=_0x6f47[_0x31e29a];return _0x32d892;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x76f4('0x0'));var zipdir=require(_0x76f4('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x76f4('0x2'));var moment=require('moment');var BPromise=require(_0x76f4('0x3'));var Mustache=require('mustache');var util=require(_0x76f4('0x4'));var path=require(_0x76f4('0x5'));var sox=require(_0x76f4('0x6'));var csv=require(_0x76f4('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x76f4('0x8'));var _=require(_0x76f4('0x9'));var squel=require(_0x76f4('0xa'));var crypto=require('crypto');var jsforce=require(_0x76f4('0xb'));var deskjs=require(_0x76f4('0xc'));var toCsv=require(_0x76f4('0x7'));var querystring=require(_0x76f4('0xd'));var Papa=require(_0x76f4('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x76f4('0xf'));var as=require(_0x76f4('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x76f4('0x11'));var utils=require(_0x76f4('0x12'));var config=require(_0x76f4('0x13'));var licenseUtil=require(_0x76f4('0x14'));var db=require(_0x76f4('0x15'))['db'];function respondWithStatusCode(_0xafd21e,_0xf7e347){_0xf7e347=_0xf7e347||0xcc;return function(_0x3ec740){if(_0x3ec740){return _0xafd21e[_0x76f4('0x16')](_0xf7e347);}return _0xafd21e['status'](_0xf7e347)[_0x76f4('0x17')]();};}function respondWithResult(_0x30dabf,_0x5da1ff){_0x5da1ff=_0x5da1ff||0xc8;return function(_0x4b6021){if(_0x4b6021){return _0x30dabf['status'](_0x5da1ff)[_0x76f4('0x18')](_0x4b6021);}};}function respondWithFilteredResult(_0x3dd240,_0x979946){return function(_0x40252d){if(_0x40252d){var _0x3d8f5a=typeof _0x979946[_0x76f4('0x19')]===_0x76f4('0x1a')&&typeof _0x979946[_0x76f4('0x1b')]===_0x76f4('0x1a');var _0xb159a9=_0x40252d[_0x76f4('0x1c')];var _0x2d4bd1=_0x3d8f5a?0x0:_0x979946[_0x76f4('0x19')];var _0x38450e=_0x3d8f5a?_0x40252d[_0x76f4('0x1c')]:_0x979946[_0x76f4('0x19')]+_0x979946[_0x76f4('0x1b')];var _0x3e809f;if(_0x38450e>=_0xb159a9){_0x38450e=_0xb159a9;_0x3e809f=0xc8;}else{_0x3e809f=0xce;}_0x3dd240[_0x76f4('0x1d')](_0x3e809f);return _0x3dd240[_0x76f4('0x1e')](_0x76f4('0x1f'),_0x2d4bd1+'-'+_0x38450e+'/'+_0xb159a9)[_0x76f4('0x18')](_0x40252d);}return null;};}function patchUpdates(_0x5bf3d5){return function(_0x262937){try{jsonpatch['apply'](_0x262937,_0x5bf3d5,!![]);}catch(_0x13f3b1){return BPromise[_0x76f4('0x20')](_0x13f3b1);}return _0x262937[_0x76f4('0x21')]();};}function saveUpdates(_0x517c00,_0x567f2a){return function(_0x52da65){if(_0x52da65){return _0x52da65[_0x76f4('0x22')](_0x517c00)[_0x76f4('0x23')](function(_0x14bfe5){return _0x14bfe5;});}return null;};}function removeEntity(_0x2b6d51,_0x42ef70){return function(_0x4786c9){if(_0x4786c9){return _0x4786c9[_0x76f4('0x24')]()['then'](function(){_0x2b6d51['status'](0xcc)[_0x76f4('0x17')]();});}};}function handleEntityNotFound(_0x497913,_0x288365){return function(_0x5355bd){if(!_0x5355bd){_0x497913['sendStatus'](0x194);}return _0x5355bd;};}function handleError(_0x4f6087,_0x470242){_0x470242=_0x470242||0x1f4;return function(_0x38300d){logger[_0x76f4('0x25')](_0x38300d[_0x76f4('0x26')]);if(_0x38300d[_0x76f4('0x27')]){delete _0x38300d[_0x76f4('0x27')];}_0x4f6087['status'](_0x470242)[_0x76f4('0x28')](_0x38300d);};}exports['index']=function(_0x5346be,_0x5b3f07){var _0x10ddb4={},_0x30f02e={},_0x41dea4={'count':0x0,'rows':[]};var _0x1dea0e=_['map'](db[_0x76f4('0x29')]['rawAttributes'],function(_0x259c26){return{'name':_0x259c26[_0x76f4('0x2a')],'type':_0x259c26[_0x76f4('0x2b')][_0x76f4('0x2c')]};});_0x30f02e[_0x76f4('0x2d')]=_['differenceBy'](_['map'](_0x1dea0e,_0x76f4('0x27')),[_0x76f4('0x2e')]);_0x30f02e[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0x5346be[_0x76f4('0x2f')]);_0x30f02e[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],_0x30f02e[_0x76f4('0x2f')]);_0x10ddb4[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x30f02e[_0x76f4('0x2d')],qs['fields'](_0x5346be['query']['fields']));_0x10ddb4['attributes']=_0x10ddb4[_0x76f4('0x33')][_0x76f4('0x34')]?_0x10ddb4[_0x76f4('0x33')]:_0x30f02e[_0x76f4('0x2d')];if(!_0x5346be[_0x76f4('0x2f')]['hasOwnProperty'](_0x76f4('0x35'))){_0x10ddb4[_0x76f4('0x1b')]=qs[_0x76f4('0x1b')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x1b')]);_0x10ddb4[_0x76f4('0x19')]=qs[_0x76f4('0x19')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x19')]);}_0x10ddb4[_0x76f4('0x36')]=qs[_0x76f4('0x37')](_0x5346be[_0x76f4('0x2f')][_0x76f4('0x37')]);_0x10ddb4[_0x76f4('0x38')]=qs[_0x76f4('0x31')](_[_0x76f4('0x39')](_0x5346be[_0x76f4('0x2f')],_0x30f02e[_0x76f4('0x31')]),_0x1dea0e);if(_0x5346be['query'][_0x76f4('0x3a')]){_0x10ddb4[_0x76f4('0x38')]=_[_0x76f4('0x3b')](_0x10ddb4['where'],{'$or':_['map'](_0x1dea0e,function(_0x237fba){if(_0x237fba['type']!==_0x76f4('0x3c')){var _0x5ac18f={};_0x5ac18f[_0x237fba[_0x76f4('0x27')]]={'$like':'%'+_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3a')]+'%'};return _0x5ac18f;}})});}_0x10ddb4=_[_0x76f4('0x3b')]({},_0x10ddb4,_0x5346be[_0x76f4('0x3d')]);var _0x2d99e3={'where':_0x10ddb4[_0x76f4('0x38')]};return db[_0x76f4('0x29')][_0x76f4('0x1c')](_0x2d99e3)[_0x76f4('0x23')](function(_0x5340a9){_0x41dea4['count']=_0x5340a9;if(_0x5346be[_0x76f4('0x2f')][_0x76f4('0x3e')]){_0x10ddb4[_0x76f4('0x3f')]=[{'all':!![]}];}return db[_0x76f4('0x29')][_0x76f4('0x40')](_0x10ddb4);})[_0x76f4('0x23')](function(_0x42754d){_0x41dea4[_0x76f4('0x41')]=_0x42754d;return _0x41dea4;})[_0x76f4('0x23')](respondWithFilteredResult(_0x5b3f07,_0x10ddb4))['catch'](handleError(_0x5b3f07,null));};exports[_0x76f4('0x42')]=function(_0xe744af,_0x4f0d1a){var _0x5ad90a={'raw':![],'where':{'id':_0xe744af[_0x76f4('0x43')]['id']}},_0x26c411={};_0x26c411[_0x76f4('0x2d')]=_[_0x76f4('0x30')](db[_0x76f4('0x29')]['rawAttributes']);_0x26c411[_0x76f4('0x2f')]=_[_0x76f4('0x30')](_0xe744af[_0x76f4('0x2f')]);_0x26c411[_0x76f4('0x31')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],_0x26c411['query']);_0x5ad90a[_0x76f4('0x33')]=_[_0x76f4('0x32')](_0x26c411[_0x76f4('0x2d')],qs['fields'](_0xe744af['query'][_0x76f4('0x44')]));_0x5ad90a[_0x76f4('0x33')]=_0x5ad90a[_0x76f4('0x33')][_0x76f4('0x34')]?_0x5ad90a[_0x76f4('0x33')]:_0x26c411['model'];if(_0xe744af['query'][_0x76f4('0x3e')]){_0x5ad90a['include']=[{'all':!![]}];}_0x5ad90a=_[_0x76f4('0x3b')]({},_0x5ad90a,_0xe744af[_0x76f4('0x3d')]);return db['ScreenRecording']['find'](_0x5ad90a)[_0x76f4('0x23')](handleEntityNotFound(_0x4f0d1a,null))[_0x76f4('0x23')](respondWithResult(_0x4f0d1a,null))[_0x76f4('0x45')](handleError(_0x4f0d1a,null));};exports[_0x76f4('0x46')]=function(_0x55e4cc,_0x9baa0f){return db[_0x76f4('0x29')][_0x76f4('0x46')](_0x55e4cc['body'],{})[_0x76f4('0x23')](respondWithResult(_0x9baa0f,0xc9))[_0x76f4('0x45')](handleError(_0x9baa0f,null));};exports['update']=function(_0x56d905,_0x4ab620){if(_0x56d905[_0x76f4('0x47')]['id']){delete _0x56d905[_0x76f4('0x47')]['id'];}delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x48')];delete _0x56d905['body'][_0x76f4('0x49')];delete _0x56d905['body'][_0x76f4('0x4a')];delete _0x56d905[_0x76f4('0x47')][_0x76f4('0x4b')];return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x56d905[_0x76f4('0x43')]['id']}})['then'](handleEntityNotFound(_0x4ab620,null))[_0x76f4('0x23')](saveUpdates(_0x56d905[_0x76f4('0x47')],null))[_0x76f4('0x23')](respondWithResult(_0x4ab620,null))[_0x76f4('0x45')](handleError(_0x4ab620,null));};exports[_0x76f4('0x4d')]=function(_0x479c4b,_0x1041da){return db['ScreenRecording'][_0x76f4('0x4d')]()[_0x76f4('0x23')](respondWithResult(_0x1041da,null))[_0x76f4('0x45')](handleError(_0x1041da,null));};exports['download']=function(_0x141b1c,_0x46c944,_0x3fc794){var _0x3bec16=require('../../components/encryptor');var _0x2028e9=![];var _0xf11e07={};if(_0x141b1c[_0x76f4('0x2f')][_0x76f4('0x2b')]&&_0x141b1c['query'][_0x76f4('0x2b')]==='uniqueid'){_0xf11e07[_0x76f4('0x4e')]=_0x141b1c[_0x76f4('0x43')]['id'];}else{_0xf11e07['id']=_0x141b1c['params']['id'];}return db['ScreenRecording'][_0x76f4('0x4c')]({'where':_0xf11e07,'attributes':['id',_0x76f4('0x4b')],'raw':!![]})[_0x76f4('0x23')](handleEntityNotFound(_0x46c944,null))['then'](function(_0x27ba06){if(_0x27ba06){var _0x15ec0f=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x27ba06[_0x76f4('0x4b')]);var _0x367238=util['format']('%s.cypher',_0x15ec0f);if(fs[_0x76f4('0x50')](_0x367238)){_0x2028e9=!![];return _0x3bec16[_0x76f4('0x51')](_0x367238,_0x15ec0f,config[_0x76f4('0x52')][_0x76f4('0x53')])[_0x76f4('0x23')](function(){return _0x27ba06;});}return _0x27ba06;}})[_0x76f4('0x23')](function(_0x97be11){if(_0x97be11){var _0x36a52a=path[_0x76f4('0x4f')](config['root'],'server/files/screen_recordings',_0x97be11['value']);if(!fs[_0x76f4('0x50')](_0x36a52a)){throw new db[(_0x76f4('0x54'))][(_0x76f4('0x55'))](_0x76f4('0x56'));}if(_0x97be11['filename']){return _0x46c944['download'](_0x36a52a,_0x97be11[_0x76f4('0x57')]+path['extname'](_0x36a52a),function(){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}else{return _0x46c944['download'](_0x36a52a,function(_0x4285dd){if(_0x2028e9){fs[_0x76f4('0x58')](_0x36a52a);}});}}})[_0x76f4('0x45')](function(_0x3317a4){if(_0x3317a4['message']===_0x76f4('0x56')){_0x46c944[_0x76f4('0x1d')](0x194)[_0x76f4('0x28')](_0x76f4('0x59'));}else{return handleError(_0x46c944,null);}});};exports[_0x76f4('0x24')]=function(_0x2a6f19,_0x46245f){return db['ScreenRecording'][_0x76f4('0x4c')]({'where':{'id':_0x2a6f19[_0x76f4('0x43')]['id']}})[_0x76f4('0x23')](function(_0x320a87){if(_[_0x76f4('0x5a')](_0x320a87)){throw new ReferenceError(_0x76f4('0x5b'));}return _0x320a87;})[_0x76f4('0x23')](function(_0x551d38){var _0x5724c3=path['join'](config[_0x76f4('0x5c')],_0x76f4('0x5d'),_0x551d38[_0x76f4('0x4b')]);logger['info'](_0x76f4('0x5e'),_0x5724c3);if(!_['isNil'](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger['info'](_0x76f4('0x5f')+_0x5724c3+_0x76f4('0x60'));fs[_0x76f4('0x61')](_0x5724c3);}_0x5724c3=_0x5724c3+_0x76f4('0x62');if(!_[_0x76f4('0x5a')](_0x551d38[_0x76f4('0x4b')])&&fs[_0x76f4('0x50')](_0x5724c3)){logger[_0x76f4('0x63')](_0x76f4('0x5f')+_0x5724c3+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x76f4('0x61')](_0x5724c3);}return _0x551d38;})['then'](function(_0x318fcb){if(!_0x318fcb)throw new InternalError();return _0x318fcb[_0x76f4('0x24')]();})[_0x76f4('0x23')](function(){_0x46245f[_0x76f4('0x1d')](0xcc)[_0x76f4('0x17')]();})[_0x76f4('0x45')](handleError(_0x46245f,null));}; \ No newline at end of file +var _0x5075=['send','Not\x20found','Entity\x20not\x20found','cancellazione\x20fisica\x20documento\x20%s','isNil','info','File:\x20\x22','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','Content-Range','json','apply','save','update','then','destroy','end','error','name','index','map','ScreenRecording','rawAttributes','fieldName','model','differenceBy','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','type','VIRTUAL','filter','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','createdAt','closedAt','value','describe','download','../../components/encryptor','uniqueid','join','root','server/files/screen_recordings','format','%s.cypher','existsSync','decryptFile','secrets','recording','Sequelize','ScreenRecording\x20not\x20found','filename','extname','unlink','message'];(function(_0x377b25,_0x2392ed){var _0x24cb76=function(_0x18940b){while(--_0x18940b){_0x377b25['push'](_0x377b25['shift']());}};_0x24cb76(++_0x2392ed);}(_0x5075,0x73));var _0x5507=function(_0x24ca1f,_0x3d2164){_0x24ca1f=_0x24ca1f-0x0;var _0x5f4222=_0x5075[_0x24ca1f];return _0x5f4222;};'use strict';var emlformat=require(_0x5507('0x0'));var rimraf=require(_0x5507('0x1'));var zipdir=require(_0x5507('0x2'));var jsonpatch=require(_0x5507('0x3'));var rp=require(_0x5507('0x4'));var moment=require(_0x5507('0x5'));var BPromise=require(_0x5507('0x6'));var Mustache=require('mustache');var util=require(_0x5507('0x7'));var path=require(_0x5507('0x8'));var sox=require(_0x5507('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5507('0xa'));var _=require(_0x5507('0xb'));var squel=require('squel');var crypto=require(_0x5507('0xc'));var jsforce=require(_0x5507('0xd'));var deskjs=require(_0x5507('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5507('0xf'));var Redis=require(_0x5507('0x10'));var authService=require(_0x5507('0x11'));var qs=require(_0x5507('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x5507('0x13'));var logger=require(_0x5507('0x14'))('api');var utils=require(_0x5507('0x15'));var config=require(_0x5507('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x5507('0x17'))['db'];function respondWithStatusCode(_0x2a2ea0,_0x32c872){_0x32c872=_0x32c872||0xcc;return function(_0x267f27){if(_0x267f27){return _0x2a2ea0[_0x5507('0x18')](_0x32c872);}return _0x2a2ea0[_0x5507('0x19')](_0x32c872)['end']();};}function respondWithResult(_0x9cc3f9,_0x2b7c43){_0x2b7c43=_0x2b7c43||0xc8;return function(_0xc828e5){if(_0xc828e5){return _0x9cc3f9[_0x5507('0x19')](_0x2b7c43)['json'](_0xc828e5);}};}function respondWithFilteredResult(_0x49e400,_0x10d7b9){return function(_0x2dfd06){if(_0x2dfd06){var _0x1ab167=typeof _0x10d7b9[_0x5507('0x1a')]===_0x5507('0x1b')&&typeof _0x10d7b9[_0x5507('0x1c')]===_0x5507('0x1b');var _0x3d1619=_0x2dfd06[_0x5507('0x1d')];var _0x233b6a=_0x1ab167?0x0:_0x10d7b9[_0x5507('0x1a')];var _0x3822dd=_0x1ab167?_0x2dfd06['count']:_0x10d7b9[_0x5507('0x1a')]+_0x10d7b9[_0x5507('0x1c')];var _0x4054c6;if(_0x3822dd>=_0x3d1619){_0x3822dd=_0x3d1619;_0x4054c6=0xc8;}else{_0x4054c6=0xce;}_0x49e400[_0x5507('0x19')](_0x4054c6);return _0x49e400['set'](_0x5507('0x1e'),_0x233b6a+'-'+_0x3822dd+'/'+_0x3d1619)[_0x5507('0x1f')](_0x2dfd06);}return null;};}function patchUpdates(_0x1a54b0){return function(_0x3ca1f7){try{jsonpatch[_0x5507('0x20')](_0x3ca1f7,_0x1a54b0,!![]);}catch(_0x1be8b1){return BPromise['reject'](_0x1be8b1);}return _0x3ca1f7[_0x5507('0x21')]();};}function saveUpdates(_0x105535,_0x1f6325){return function(_0xa3e2cf){if(_0xa3e2cf){return _0xa3e2cf[_0x5507('0x22')](_0x105535)[_0x5507('0x23')](function(_0x1fcc8d){return _0x1fcc8d;});}return null;};}function removeEntity(_0x10f149,_0x398911){return function(_0xa47641){if(_0xa47641){return _0xa47641[_0x5507('0x24')]()[_0x5507('0x23')](function(){_0x10f149[_0x5507('0x19')](0xcc)[_0x5507('0x25')]();});}};}function handleEntityNotFound(_0x1a2203,_0x4915ed){return function(_0x4e8906){if(!_0x4e8906){_0x1a2203['sendStatus'](0x194);}return _0x4e8906;};}function handleError(_0x26335e,_0x4ea271){_0x4ea271=_0x4ea271||0x1f4;return function(_0xa66a01){logger[_0x5507('0x26')](_0xa66a01['stack']);if(_0xa66a01['name']){delete _0xa66a01[_0x5507('0x27')];}_0x26335e[_0x5507('0x19')](_0x4ea271)['send'](_0xa66a01);};}exports[_0x5507('0x28')]=function(_0x24574b,_0x85d383){var _0x38f4d9={},_0x1e5ce6={},_0x14fdea={'count':0x0,'rows':[]};var _0x55e889=_[_0x5507('0x29')](db[_0x5507('0x2a')][_0x5507('0x2b')],function(_0x38f0f5){return{'name':_0x38f0f5[_0x5507('0x2c')],'type':_0x38f0f5['type']['key']};});_0x1e5ce6[_0x5507('0x2d')]=_[_0x5507('0x2e')](_[_0x5507('0x29')](_0x55e889,_0x5507('0x27')),['format']);_0x1e5ce6[_0x5507('0x2f')]=_[_0x5507('0x30')](_0x24574b[_0x5507('0x2f')]);_0x1e5ce6[_0x5507('0x31')]=_[_0x5507('0x32')](_0x1e5ce6[_0x5507('0x2d')],_0x1e5ce6[_0x5507('0x2f')]);_0x38f4d9[_0x5507('0x33')]=_['intersection'](_0x1e5ce6[_0x5507('0x2d')],qs[_0x5507('0x34')](_0x24574b[_0x5507('0x2f')]['fields']));_0x38f4d9['attributes']=_0x38f4d9[_0x5507('0x33')][_0x5507('0x35')]?_0x38f4d9[_0x5507('0x33')]:_0x1e5ce6[_0x5507('0x2d')];if(!_0x24574b[_0x5507('0x2f')]['hasOwnProperty']('nolimit')){_0x38f4d9[_0x5507('0x1c')]=qs[_0x5507('0x1c')](_0x24574b[_0x5507('0x2f')][_0x5507('0x1c')]);_0x38f4d9['offset']=qs['offset'](_0x24574b[_0x5507('0x2f')]['offset']);}_0x38f4d9[_0x5507('0x36')]=qs[_0x5507('0x37')](_0x24574b[_0x5507('0x2f')][_0x5507('0x37')]);_0x38f4d9[_0x5507('0x38')]=qs[_0x5507('0x31')](_[_0x5507('0x39')](_0x24574b[_0x5507('0x2f')],_0x1e5ce6[_0x5507('0x31')]),_0x55e889);if(_0x24574b[_0x5507('0x2f')]['filter']){_0x38f4d9['where']=_['merge'](_0x38f4d9['where'],{'$or':_[_0x5507('0x29')](_0x55e889,function(_0x2cf512){if(_0x2cf512[_0x5507('0x3a')]!==_0x5507('0x3b')){var _0x2b32a5={};_0x2b32a5[_0x2cf512[_0x5507('0x27')]]={'$like':'%'+_0x24574b[_0x5507('0x2f')][_0x5507('0x3c')]+'%'};return _0x2b32a5;}})});}_0x38f4d9=_[_0x5507('0x3d')]({},_0x38f4d9,_0x24574b[_0x5507('0x3e')]);var _0x3ec0ed={'where':_0x38f4d9[_0x5507('0x38')]};return db[_0x5507('0x2a')][_0x5507('0x1d')](_0x3ec0ed)['then'](function(_0x53b3f3){_0x14fdea['count']=_0x53b3f3;if(_0x24574b[_0x5507('0x2f')][_0x5507('0x3f')]){_0x38f4d9[_0x5507('0x40')]=[{'all':!![]}];}return db[_0x5507('0x2a')][_0x5507('0x41')](_0x38f4d9);})[_0x5507('0x23')](function(_0x340c4c){_0x14fdea[_0x5507('0x42')]=_0x340c4c;return _0x14fdea;})[_0x5507('0x23')](respondWithFilteredResult(_0x85d383,_0x38f4d9))[_0x5507('0x43')](handleError(_0x85d383,null));};exports[_0x5507('0x44')]=function(_0x192a00,_0x24d7b5){var _0x25496b={'raw':![],'where':{'id':_0x192a00[_0x5507('0x45')]['id']}},_0x1b3006={};_0x1b3006[_0x5507('0x2d')]=_[_0x5507('0x30')](db[_0x5507('0x2a')]['rawAttributes']);_0x1b3006[_0x5507('0x2f')]=_[_0x5507('0x30')](_0x192a00['query']);_0x1b3006['filters']=_[_0x5507('0x32')](_0x1b3006[_0x5507('0x2d')],_0x1b3006[_0x5507('0x2f')]);_0x25496b[_0x5507('0x33')]=_[_0x5507('0x32')](_0x1b3006['model'],qs[_0x5507('0x34')](_0x192a00[_0x5507('0x2f')][_0x5507('0x34')]));_0x25496b['attributes']=_0x25496b[_0x5507('0x33')][_0x5507('0x35')]?_0x25496b[_0x5507('0x33')]:_0x1b3006[_0x5507('0x2d')];if(_0x192a00[_0x5507('0x2f')]['includeAll']){_0x25496b[_0x5507('0x40')]=[{'all':!![]}];}_0x25496b=_['merge']({},_0x25496b,_0x192a00[_0x5507('0x3e')]);return db[_0x5507('0x2a')][_0x5507('0x46')](_0x25496b)[_0x5507('0x23')](handleEntityNotFound(_0x24d7b5,null))[_0x5507('0x23')](respondWithResult(_0x24d7b5,null))[_0x5507('0x43')](handleError(_0x24d7b5,null));};exports[_0x5507('0x47')]=function(_0x3452e4,_0x549cf0){return db[_0x5507('0x2a')][_0x5507('0x47')](_0x3452e4['body'],{})['then'](respondWithResult(_0x549cf0,0xc9))['catch'](handleError(_0x549cf0,null));};exports[_0x5507('0x22')]=function(_0x5961fd,_0x403d03){if(_0x5961fd['body']['id']){delete _0x5961fd[_0x5507('0x48')]['id'];}delete _0x5961fd['body']['duration'];delete _0x5961fd[_0x5507('0x48')][_0x5507('0x49')];delete _0x5961fd[_0x5507('0x48')][_0x5507('0x4a')];delete _0x5961fd[_0x5507('0x48')][_0x5507('0x4b')];return db['ScreenRecording'][_0x5507('0x46')]({'where':{'id':_0x5961fd[_0x5507('0x45')]['id']}})[_0x5507('0x23')](handleEntityNotFound(_0x403d03,null))['then'](saveUpdates(_0x5961fd[_0x5507('0x48')],null))[_0x5507('0x23')](respondWithResult(_0x403d03,null))[_0x5507('0x43')](handleError(_0x403d03,null));};exports[_0x5507('0x4c')]=function(_0x300c9f,_0x3af70f){return db[_0x5507('0x2a')][_0x5507('0x4c')]()[_0x5507('0x23')](respondWithResult(_0x3af70f,null))[_0x5507('0x43')](handleError(_0x3af70f,null));};exports[_0x5507('0x4d')]=function(_0x49a2f8,_0x570928,_0x1992fa){var _0x5d7753=require(_0x5507('0x4e'));var _0x1b34c8=![];var _0xce851d={};if(_0x49a2f8[_0x5507('0x2f')][_0x5507('0x3a')]&&_0x49a2f8[_0x5507('0x2f')][_0x5507('0x3a')]===_0x5507('0x4f')){_0xce851d[_0x5507('0x4f')]=_0x49a2f8[_0x5507('0x45')]['id'];}else{_0xce851d['id']=_0x49a2f8[_0x5507('0x45')]['id'];}return db[_0x5507('0x2a')][_0x5507('0x46')]({'where':_0xce851d,'attributes':['id',_0x5507('0x4b')],'raw':!![]})['then'](handleEntityNotFound(_0x570928,null))[_0x5507('0x23')](function(_0x56e0cd){if(_0x56e0cd){var _0x5af5f5=path[_0x5507('0x50')](config[_0x5507('0x51')],_0x5507('0x52'),_0x56e0cd[_0x5507('0x4b')]);var _0x52b9f2=util[_0x5507('0x53')](_0x5507('0x54'),_0x5af5f5);if(fs[_0x5507('0x55')](_0x52b9f2)){_0x1b34c8=!![];return _0x5d7753[_0x5507('0x56')](_0x52b9f2,_0x5af5f5,config[_0x5507('0x57')][_0x5507('0x58')])['then'](function(){return _0x56e0cd;});}return _0x56e0cd;}})[_0x5507('0x23')](function(_0x46e589){if(_0x46e589){var _0x3a2f9f=path['join'](config['root'],_0x5507('0x52'),_0x46e589['value']);if(!fs[_0x5507('0x55')](_0x3a2f9f)){throw new db[(_0x5507('0x59'))]['ValidationError'](_0x5507('0x5a'));}if(_0x46e589[_0x5507('0x5b')]){return _0x570928[_0x5507('0x4d')](_0x3a2f9f,_0x46e589[_0x5507('0x5b')]+path[_0x5507('0x5c')](_0x3a2f9f),function(){if(_0x1b34c8){fs[_0x5507('0x5d')](_0x3a2f9f);}});}else{return _0x570928[_0x5507('0x4d')](_0x3a2f9f,function(_0x2928f2){if(_0x1b34c8){fs[_0x5507('0x5d')](_0x3a2f9f);}});}}})[_0x5507('0x43')](function(_0x1453f1){if(_0x1453f1[_0x5507('0x5e')]==='ScreenRecording\x20not\x20found'){_0x570928[_0x5507('0x19')](0x194)[_0x5507('0x5f')](_0x5507('0x60'));}else{return handleError(_0x570928,null);}});};exports[_0x5507('0x24')]=function(_0x3c4422,_0x5183ae){return db[_0x5507('0x2a')]['find']({'where':{'id':_0x3c4422[_0x5507('0x45')]['id']}})[_0x5507('0x23')](function(_0x241733){if(_['isNil'](_0x241733)){throw new ReferenceError(_0x5507('0x61'));}return _0x241733;})[_0x5507('0x23')](function(_0x2a9672){var _0x56632b=path[_0x5507('0x50')](config['root'],_0x5507('0x52'),_0x2a9672['value']);logger['info'](_0x5507('0x62'),_0x56632b);if(!_[_0x5507('0x63')](_0x2a9672[_0x5507('0x4b')])&&fs[_0x5507('0x55')](_0x56632b)){logger[_0x5507('0x64')](_0x5507('0x65')+_0x56632b+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x56632b);}_0x56632b=_0x56632b+_0x5507('0x66');if(!_[_0x5507('0x63')](_0x2a9672[_0x5507('0x4b')])&&fs[_0x5507('0x55')](_0x56632b)){logger['info'](_0x5507('0x65')+_0x56632b+_0x5507('0x67'));fs[_0x5507('0x68')](_0x56632b);}return _0x2a9672;})[_0x5507('0x23')](function(_0x296cf5){if(!_0x296cf5)throw new InternalError();return _0x296cf5[_0x5507('0x24')]();})[_0x5507('0x23')](function(){_0x5183ae['status'](0xcc)[_0x5507('0x25')]();})[_0x5507('0x43')](handleError(_0x5183ae,null));}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.model.js b/server/api/screenRecording/screenRecording.model.js index af08c78..53d2974 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 _0x379d=['../../config/logger','api','request-promise','path','rimraf','../../config/environment','exports','define','ScreenRecording','screen_recordings','interactionid','lodash','util'];(function(_0x4816a5,_0x41efac){var _0x166cd1=function(_0x8bc3f7){while(--_0x8bc3f7){_0x4816a5['push'](_0x4816a5['shift']());}};_0x166cd1(++_0x41efac);}(_0x379d,0x191));var _0xd379=function(_0x4aad01,_0x47660a){_0x4aad01=_0x4aad01-0x0;var _0x6923b=_0x379d[_0x4aad01];return _0x6923b;};'use strict';var _=require(_0xd379('0x0'));var util=require(_0xd379('0x1'));var logger=require(_0xd379('0x2'))(_0xd379('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd379('0x4'));var fs=require('fs');var path=require(_0xd379('0x5'));var rimraf=require(_0xd379('0x6'));var config=require(_0xd379('0x7'));var attributes=require('./screenRecording.attributes');module[_0xd379('0x8')]=function(_0x1885c8,_0x11d697){return _0x1885c8[_0xd379('0x9')](_0xd379('0xa'),attributes,{'tableName':_0xd379('0xb'),'paranoid':![],'indexes':[{'name':_0xd379('0xc'),'fields':[_0xd379('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xbb5c=['define','ScreenRecording','screen_recordings','interactionid','util','../../config/logger','api','bluebird','rimraf','../../config/environment','./screenRecording.attributes','exports'];(function(_0x24cdf2,_0x54ade2){var _0x323890=function(_0x274c73){while(--_0x274c73){_0x24cdf2['push'](_0x24cdf2['shift']());}};_0x323890(++_0x54ade2);}(_0xbb5c,0x7c));var _0xcbb5=function(_0x21c53d,_0x59c881){_0x21c53d=_0x21c53d-0x0;var _0x247700=_0xbb5c[_0x21c53d];return _0x247700;};'use strict';var _=require('lodash');var util=require(_0xcbb5('0x0'));var logger=require(_0xcbb5('0x1'))(_0xcbb5('0x2'));var moment=require('moment');var BPromise=require(_0xcbb5('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0xcbb5('0x4'));var config=require(_0xcbb5('0x5'));var attributes=require(_0xcbb5('0x6'));module[_0xcbb5('0x7')]=function(_0x52797a,_0x18b2d5){return _0x52797a[_0xcbb5('0x8')](_0xcbb5('0x9'),attributes,{'tableName':_0xcbb5('0xa'),'paranoid':![],'indexes':[{'name':_0xcbb5('0xb'),'fields':[_0xcbb5('0xb')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/screenRecording/screenRecording.rpc.js b/server/api/screenRecording/screenRecording.rpc.js index 0a5d461..27f7ca5 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 _0x2ab2=['code','message','info','result','catch','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0x3c769d,_0x215272){var _0x1c19e2=function(_0x3ddc0d){while(--_0x3ddc0d){_0x3c769d['push'](_0x3c769d['shift']());}};_0x1c19e2(++_0x215272);}(_0x2ab2,0x139));var _0x22ab=function(_0x50bcc8,_0x4ede2a){_0x50bcc8=_0x50bcc8-0x0;var _0x1c7728=_0x2ab2[_0x50bcc8];return _0x1c7728;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x22ab('0x0'));var BPromise=require(_0x22ab('0x1'));var rs=require(_0x22ab('0x2'));var fs=require('fs');var Redis=require(_0x22ab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x22ab('0x4'));var logger=require(_0x22ab('0x5'))('rpc');var config=require(_0x22ab('0x6'));var jayson=require(_0x22ab('0x7'));var client=jayson[_0x22ab('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x31ec84,_0x33c470,_0x332c07){return new BPromise(function(_0x25e586,_0x1b6cb3){return client[_0x22ab('0x9')](_0x31ec84,_0x332c07)[_0x22ab('0xa')](function(_0x477d36){logger['info'](_0x22ab('0xb'),_0x33c470,_0x22ab('0xc'));logger[_0x22ab('0xd')](_0x22ab('0xe'),_0x33c470,_0x22ab('0xc'),JSON[_0x22ab('0xf')](_0x477d36));if(_0x477d36[_0x22ab('0x10')]){if(_0x477d36[_0x22ab('0x10')][_0x22ab('0x11')]===0x1f4){logger['error'](_0x22ab('0xb'),_0x33c470,_0x477d36['error'][_0x22ab('0x12')]);return _0x1b6cb3(_0x477d36[_0x22ab('0x10')][_0x22ab('0x12')]);}logger[_0x22ab('0x10')](_0x22ab('0xb'),_0x33c470,_0x477d36['error'][_0x22ab('0x12')]);return _0x25e586(_0x477d36[_0x22ab('0x10')]['message']);}else{logger[_0x22ab('0x13')](_0x22ab('0xb'),_0x33c470,_0x22ab('0xc'));_0x25e586(_0x477d36[_0x22ab('0x14')]['message']);}})[_0x22ab('0x15')](function(_0x283127){logger['error'](_0x22ab('0xb'),_0x33c470,_0x283127);_0x1b6cb3(_0x283127);});});} \ No newline at end of file +var _0x1eb7=['stringify','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','client','http','info','ScreenRecording,\x20%s,\x20%s','request\x20sent','debug','ScreenRecording,\x20%s,\x20%s,\x20%s'];(function(_0x5bb837,_0x38c858){var _0x1fe739=function(_0x27a463){while(--_0x27a463){_0x5bb837['push'](_0x5bb837['shift']());}};_0x1fe739(++_0x38c858);}(_0x1eb7,0x91));var _0x71eb=function(_0x262d5c,_0x3e5ecf){_0x262d5c=_0x262d5c-0x0;var _0x1f50d6=_0x1eb7[_0x262d5c];return _0x1f50d6;};'use strict';var _=require('lodash');var util=require(_0x71eb('0x0'));var moment=require(_0x71eb('0x1'));var BPromise=require(_0x71eb('0x2'));var rs=require(_0x71eb('0x3'));var fs=require('fs');var Redis=require(_0x71eb('0x4'));var db=require(_0x71eb('0x5'))['db'];var utils=require(_0x71eb('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x71eb('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x71eb('0x8')][_0x71eb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x48e5f4,_0x223687,_0x53fcc4){return new BPromise(function(_0x1b17c9,_0x28c00a){return client['request'](_0x48e5f4,_0x53fcc4)['then'](function(_0x2b8bd6){logger[_0x71eb('0xa')](_0x71eb('0xb'),_0x223687,_0x71eb('0xc'));logger[_0x71eb('0xd')](_0x71eb('0xe'),_0x223687,_0x71eb('0xc'),JSON[_0x71eb('0xf')](_0x2b8bd6));if(_0x2b8bd6[_0x71eb('0x10')]){if(_0x2b8bd6['error'][_0x71eb('0x11')]===0x1f4){logger[_0x71eb('0x10')](_0x71eb('0xb'),_0x223687,_0x2b8bd6['error'][_0x71eb('0x12')]);return _0x28c00a(_0x2b8bd6[_0x71eb('0x10')][_0x71eb('0x12')]);}logger[_0x71eb('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x223687,_0x2b8bd6[_0x71eb('0x10')]['message']);return _0x1b17c9(_0x2b8bd6[_0x71eb('0x10')][_0x71eb('0x12')]);}else{logger[_0x71eb('0xa')](_0x71eb('0xb'),_0x223687,'request\x20sent');_0x1b17c9(_0x2b8bd6['result'][_0x71eb('0x12')]);}})[_0x71eb('0x13')](function(_0xca971f){logger[_0x71eb('0x10')]('ScreenRecording,\x20%s,\x20%s',_0x223687,_0xca971f);_0x28c00a(_0xca971f);});});} \ No newline at end of file diff --git a/server/api/setting/index.js b/server/api/setting/index.js index 187599a..2877094 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 _0x4be5=['../../config/environment','./setting.controller','get','isAuthenticated','index','/:id','/:id/logo','getLogo','/:id/logo_login','getLogoLogin','/:id/gdpr','gdpr','getPreferred','/:id/favicon','getFavicon','diskStorage','join','root','server/files/images/logos/','format','%s%s','logo','extname','originalname','post','single','addLogo','logologin','file','addLogoLogin','preferred','put','update','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x4be5,0x1f0));var _0x54be=function(_0x11a55c,_0x4eced9){_0x11a55c=_0x11a55c-0x0;var _0x26c390=_0x4be5[_0x11a55c];return _0x26c390;};'use strict';var multer=require(_0x54be('0x0'));var util=require(_0x54be('0x1'));var path=require(_0x54be('0x2'));var timeout=require('connect-timeout');var express=require(_0x54be('0x3'));var router=express[_0x54be('0x4')]();var fs_extra=require(_0x54be('0x5'));var auth=require(_0x54be('0x6'));var interaction=require(_0x54be('0x7'));var config=require(_0x54be('0x8'));var controller=require(_0x54be('0x9'));router[_0x54be('0xa')]('/',auth[_0x54be('0xb')](),controller[_0x54be('0xc')]);router[_0x54be('0xa')]('/now',controller['getDate']);router[_0x54be('0xa')](_0x54be('0xd'),controller['show']);router[_0x54be('0xa')](_0x54be('0xe'),controller[_0x54be('0xf')]);router[_0x54be('0xa')](_0x54be('0x10'),controller[_0x54be('0x11')]);router[_0x54be('0xa')](_0x54be('0x12'),controller[_0x54be('0x13')]);router[_0x54be('0xa')]('/:id/preferred',controller[_0x54be('0x14')]);router[_0x54be('0xa')](_0x54be('0x15'),controller[_0x54be('0x16')]);var upload=multer({'storage':multer[_0x54be('0x17')]({'destination':function(_0x1ab838,_0x1e8644,_0x21a3e6){_0x21a3e6(null,path[_0x54be('0x18')](config[_0x54be('0x19')],_0x54be('0x1a')));},'filename':function(_0x302a7e,_0x6f00f8,_0xf1d344){_0xf1d344(null,util[_0x54be('0x1b')](_0x54be('0x1c'),_0x54be('0x1d'),path[_0x54be('0x1e')](_0x6f00f8[_0x54be('0x1f')])));}})});router[_0x54be('0x20')]('/:id/logo',upload[_0x54be('0x21')]('file'),controller[_0x54be('0x22')]);var upload=multer({'storage':multer[_0x54be('0x17')]({'destination':function(_0x3a00f4,_0x242a1a,_0x250811){_0x250811(null,path[_0x54be('0x18')](config['root'],_0x54be('0x1a')));},'filename':function(_0x4ca163,_0xeae9af,_0x4ff235){_0x4ff235(null,util[_0x54be('0x1b')]('%s%s',_0x54be('0x23'),path[_0x54be('0x1e')](_0xeae9af[_0x54be('0x1f')])));}})});router[_0x54be('0x20')](_0x54be('0x10'),upload['single'](_0x54be('0x24')),controller[_0x54be('0x25')]);var upload=multer({'storage':multer[_0x54be('0x17')]({'destination':function(_0x3a02e1,_0x31414b,_0x2862f2){_0x2862f2(null,path[_0x54be('0x18')](config[_0x54be('0x19')],'server/files/images/logos/'));},'filename':function(_0x58bbe7,_0x161536,_0x4ca320){_0x4ca320(null,util['format'](_0x54be('0x1c'),_0x54be('0x26'),path[_0x54be('0x1e')](_0x161536[_0x54be('0x1f')])));}})});router[_0x54be('0x20')]('/:id/preferred',upload[_0x54be('0x21')](_0x54be('0x24')),controller['addPreferred']);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x157225,_0x304da8,_0x3cc59e){_0x3cc59e(null,path[_0x54be('0x18')](config[_0x54be('0x19')],_0x54be('0x1a')));},'filename':function(_0x4ed136,_0x42e1e0,_0x26d0e2){_0x26d0e2(null,util[_0x54be('0x1b')](_0x54be('0x1c'),'favicon',path[_0x54be('0x1e')](_0x42e1e0['originalname'])));}})});router['post']('/:id/favicon',upload['single'](_0x54be('0x24')),controller['addFavicon']);router[_0x54be('0x27')]('/:id',auth[_0x54be('0xb')](),controller[_0x54be('0x28')]);module[_0x54be('0x29')]=router; \ No newline at end of file +var _0x8a71=['/:id/logo_login','addLogoLogin','preferred','favicon','addFavicon','isAuthenticated','update','exports','multer','util','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./setting.controller','index','get','/now','/:id','/:id/logo','getLogo','getLogoLogin','gdpr','/:id/preferred','getPreferred','/:id/favicon','diskStorage','join','root','format','%s%s','extname','originalname','post','single','file','addLogo','server/files/images/logos/','logologin'];(function(_0x40b682,_0xa71dbf){var _0x18fac9=function(_0x3bcddb){while(--_0x3bcddb){_0x40b682['push'](_0x40b682['shift']());}};_0x18fac9(++_0xa71dbf);}(_0x8a71,0xa8));var _0x18a7=function(_0x269644,_0x204ca2){_0x269644=_0x269644-0x0;var _0x2e3291=_0x8a71[_0x269644];return _0x2e3291;};'use strict';var multer=require(_0x18a7('0x0'));var util=require(_0x18a7('0x1'));var path=require('path');var timeout=require(_0x18a7('0x2'));var express=require(_0x18a7('0x3'));var router=express[_0x18a7('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x18a7('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x18a7('0x6'));var controller=require(_0x18a7('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x18a7('0x8')]);router[_0x18a7('0x9')](_0x18a7('0xa'),controller['getDate']);router[_0x18a7('0x9')](_0x18a7('0xb'),controller['show']);router[_0x18a7('0x9')](_0x18a7('0xc'),controller[_0x18a7('0xd')]);router[_0x18a7('0x9')]('/:id/logo_login',controller[_0x18a7('0xe')]);router['get']('/:id/gdpr',controller[_0x18a7('0xf')]);router[_0x18a7('0x9')](_0x18a7('0x10'),controller[_0x18a7('0x11')]);router[_0x18a7('0x9')](_0x18a7('0x12'),controller['getFavicon']);var upload=multer({'storage':multer[_0x18a7('0x13')]({'destination':function(_0xe948bd,_0x2fa748,_0x46e679){_0x46e679(null,path[_0x18a7('0x14')](config[_0x18a7('0x15')],'server/files/images/logos/'));},'filename':function(_0x50edbc,_0x3035d6,_0x1bdf33){_0x1bdf33(null,util[_0x18a7('0x16')](_0x18a7('0x17'),'logo',path[_0x18a7('0x18')](_0x3035d6[_0x18a7('0x19')])));}})});router[_0x18a7('0x1a')]('/:id/logo',upload[_0x18a7('0x1b')](_0x18a7('0x1c')),controller[_0x18a7('0x1d')]);var upload=multer({'storage':multer[_0x18a7('0x13')]({'destination':function(_0x353a42,_0x1ce74c,_0x973fb9){_0x973fb9(null,path[_0x18a7('0x14')](config['root'],_0x18a7('0x1e')));},'filename':function(_0xe560d2,_0x1179d7,_0x4bfedc){_0x4bfedc(null,util[_0x18a7('0x16')](_0x18a7('0x17'),_0x18a7('0x1f'),path[_0x18a7('0x18')](_0x1179d7['originalname'])));}})});router[_0x18a7('0x1a')](_0x18a7('0x20'),upload[_0x18a7('0x1b')](_0x18a7('0x1c')),controller[_0x18a7('0x21')]);var upload=multer({'storage':multer['diskStorage']({'destination':function(_0x21fe80,_0x272aba,_0x6cc0aa){_0x6cc0aa(null,path[_0x18a7('0x14')](config[_0x18a7('0x15')],_0x18a7('0x1e')));},'filename':function(_0x15ba9b,_0x332fbf,_0x409ac9){_0x409ac9(null,util[_0x18a7('0x16')](_0x18a7('0x17'),_0x18a7('0x22'),path[_0x18a7('0x18')](_0x332fbf['originalname'])));}})});router[_0x18a7('0x1a')](_0x18a7('0x10'),upload[_0x18a7('0x1b')](_0x18a7('0x1c')),controller['addPreferred']);var upload=multer({'storage':multer[_0x18a7('0x13')]({'destination':function(_0x2f67ce,_0x22b298,_0x2da222){_0x2da222(null,path[_0x18a7('0x14')](config[_0x18a7('0x15')],'server/files/images/logos/'));},'filename':function(_0xcd1812,_0x2450fa,_0x31085a){_0x31085a(null,util['format'](_0x18a7('0x17'),_0x18a7('0x23'),path[_0x18a7('0x18')](_0x2450fa['originalname'])));}})});router['post'](_0x18a7('0x12'),upload['single']('file'),controller[_0x18a7('0x24')]);router['put'](_0x18a7('0xb'),auth[_0x18a7('0x25')](),controller[_0x18a7('0x26')]);module[_0x18a7('0x27')]=router; \ No newline at end of file diff --git a/server/api/setting/setting.attributes.js b/server/api/setting/setting.attributes.js index 93e927f..23294d6 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 _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x35fa94,_0x2f9f3d){var _0xfb31f3=function(_0x2fb4af){while(--_0x2fb4af){_0x35fa94['push'](_0x35fa94['shift']());}};_0xfb31f3(++_0x2f9f3d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file +var _0xa9e0=['BOOLEAN','alternate','UNSIGNED','sequelize','exports','INTEGER','min_mailbox','STRING','/var/opt/motion2/server/files/sounds/converted'];(function(_0x29b714,_0x41abb5){var _0x41b5e2=function(_0x1850ad){while(--_0x1850ad){_0x29b714['push'](_0x29b714['shift']());}};_0x41b5e2(++_0x41abb5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x8de54f,_0x271987){_0x8de54f=_0x8de54f-0x0;var _0x14cba4=_0xa9e0[_0x8de54f];return _0x14cba4;};'use strict';var Sequelize=require(_0x0a9e('0x0'));module[_0x0a9e('0x1')]={'min_internal':{'type':Sequelize[_0x0a9e('0x2')](0xb),'unique':'min_internal','defaultValue':0x3e8},'min_mailbox':{'type':Sequelize['INTEGER'](0xb),'unique':_0x0a9e('0x3'),'defaultValue':0x3e8},'agi_port':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x11dd},'soundPath':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x5')},'logo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLogo':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'loginLogo':{'type':Sequelize[_0x0a9e('0x4')]},'defaultLoginLogo':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'headerWhiteLabel':{'type':Sequelize[_0x0a9e('0x4')]},'defaultHeaderWhiteLabel':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'securePassword':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'firstSetup':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'stunaddr':{'type':Sequelize['STRING']},'turnaddr':{'type':Sequelize[_0x0a9e('0x4')]},'turnusername':{'type':Sequelize['STRING']},'turnpassword':{'type':Sequelize['STRING']},'pageTitle':{'type':Sequelize[_0x0a9e('0x4')]},'defaultPageTitle':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'callRecordingEncryption':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'passwordExpiresDays':{'type':Sequelize[_0x0a9e('0x2')](0xb),'defaultValue':0x5a},'phoneBarAutoUpdater':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'phoneBarAutoUpdaterUrl':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':'https://www.xcally.com/bar/phonebar/autoupdater.xml'},'enableEmailPreview':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'split':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'splitSizeCsv':{'type':Sequelize['INTEGER'],'defaultValue':0x1388},'splitSizePdf':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'splitSizeXlsx':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1388},'messagesAlignment':{'type':Sequelize[_0x0a9e('0x4')],'defaultValue':_0x0a9e('0x7')},'chatTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x1e},'phoneBarRememberMeEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'preferred':{'type':Sequelize['STRING']},'defaultPreferred':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'rtlSupport':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'defaultScreenRecordingPath':{'type':Sequelize[_0x0a9e('0x4')]},'allowedLoginAttempts':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5},'blockDuration':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa},'favicon':{'type':Sequelize[_0x0a9e('0x4')]},'defaultFavicon':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'loginMailFrequency':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0xa,'validate':{'min':0xa}},'transcribe':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'automaticTranscribe':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'transcribeAccountId':{'type':Sequelize['INTEGER']},'transcribeRegion':{'type':Sequelize[_0x0a9e('0x4')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'automaticSentiment':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'sentimentAccountId':{'type':Sequelize[_0x0a9e('0x2')]},'sentimentRegion':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x4')]},'bucket':{'type':Sequelize[_0x0a9e('0x4')]},'googleSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'enforcePasswordHistory':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'passwordHistoryLimit':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5}},'privacyPolicyEmail':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyName':{'type':Sequelize[_0x0a9e('0x2')](0x2)[_0x0a9e('0x8')],'defaultValue':0x0},'privacyPolicyNumber':{'type':Sequelize[_0x0a9e('0x2')](0x2)['UNSIGNED'],'defaultValue':0x0},'searchOnEnterKey':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'chatInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'mailInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'openchannelInteractionsReloadTimeout':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x0},'smsInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappInteractionsReloadTimeout':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'stopRecordingOnTransfer':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':![]},'secureCookieEnabled':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'viewHelpSection':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':!![]},'previewRecallmeReminderInterval':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x5,'validate':{'min':0x1}},'disabledCookie':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'limitTabs':{'type':Sequelize[_0x0a9e('0x2')],'defaultValue':0x14}}; \ No newline at end of file diff --git a/server/api/setting/setting.controller.js b/server/api/setting/setting.controller.js index 3b6c3ba..f649501 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 _0x11cd=['toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','download','getLogoLogin','getLicense','favicon','default_loginLogo.svg','\x20not\x20found','gdpr','securePassword','addPreferred','getPreferred','defaultLogo','default_preferred.png','addFavicon','getFavicon','default_favicon.ico','getDate','utcOffset','format','YYYY-MM-DD\x20HH:mm:ss:SSS','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','http','request','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','status','json','offset','limit','undefined','count','Content-Range','apply','reject','then','destroy','end','sendStatus','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','pick','merge','where','VIRTUAL','filter','options','Setting','includeAll','include','findAll','rows','params','body','addLogo','file','filename','find','loginLogo','getLogo','server/files/images/logos','logo','preferred','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0x11cd,0x194));var _0xd11c=function(_0x12d736,_0x387aae){_0x12d736=_0x12d736-0x0;var _0x3ff082=_0x11cd[_0x12d736];return _0x3ff082;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xd11c('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd11c('0x1'));var rp=require(_0xd11c('0x2'));var moment=require(_0xd11c('0x3'));var BPromise=require(_0xd11c('0x4'));var Mustache=require(_0xd11c('0x5'));var util=require('util');var path=require(_0xd11c('0x6'));var sox=require(_0xd11c('0x7'));var csv=require(_0xd11c('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd11c('0x9'));var _=require('lodash');var squel=require(_0xd11c('0xa'));var crypto=require(_0xd11c('0xb'));var jsforce=require(_0xd11c('0xc'));var deskjs=require(_0xd11c('0xd'));var toCsv=require(_0xd11c('0x8'));var querystring=require(_0xd11c('0xe'));var Papa=require('papaparse');var Redis=require(_0xd11c('0xf'));var authService=require(_0xd11c('0x10'));var qs=require(_0xd11c('0x11'));var as=require(_0xd11c('0x12'));var hardwareService=require(_0xd11c('0x13'));var logger=require('../../config/logger')(_0xd11c('0x14'));var utils=require(_0xd11c('0x15'));var config=require(_0xd11c('0x16'));var licenseUtil=require(_0xd11c('0x17'));var db=require('../../mysqldb')['db'];var jayson=require(_0xd11c('0x18'));var client=jayson[_0xd11c('0x19')][_0xd11c('0x1a')]({'port':0x232a});function respondWithRpcPromise(_0x5327dd,_0x36394b,_0x2d4071,_0x5d3195){return new BPromise(function(_0x28ecd8,_0x1b8300){var _0x3c8a98=_0x5d3195||client;return _0x3c8a98[_0xd11c('0x1b')](_0x5327dd,_0x2d4071)['then'](function(_0x53a934){logger['info'](_0xd11c('0x1c'),_0x36394b,_0xd11c('0x1d'));logger[_0xd11c('0x1e')](_0xd11c('0x1f'),_0x36394b,_0xd11c('0x1d'),JSON[_0xd11c('0x20')](_0x53a934));if(_0x53a934['error']){if(_0x53a934[_0xd11c('0x21')][_0xd11c('0x22')]===0x1f4){logger['error'](_0xd11c('0x1c'),_0x36394b,_0x53a934[_0xd11c('0x21')]['message']);return _0x1b8300(_0x53a934[_0xd11c('0x21')][_0xd11c('0x23')]);}logger['error'](_0xd11c('0x1c'),_0x36394b,_0x53a934['error'][_0xd11c('0x23')]);return _0x28ecd8(_0x53a934[_0xd11c('0x21')][_0xd11c('0x23')]);}else{logger[_0xd11c('0x24')](_0xd11c('0x1c'),_0x36394b,'request\x20sent');_0x28ecd8(_0x53a934['result'][_0xd11c('0x23')]);}})[_0xd11c('0x25')](function(_0x3ecb08){logger['error']('Setting,\x20%s,\x20%s',_0x36394b,_0x3ecb08);_0x1b8300(_0x3ecb08);});});}function respondWithStatusCode(_0x55ce8b,_0x37e002){_0x37e002=_0x37e002||0xcc;return function(_0x14922a){if(_0x14922a){return _0x55ce8b['sendStatus'](_0x37e002);}return _0x55ce8b[_0xd11c('0x26')](_0x37e002)['end']();};}function respondWithResult(_0x538a44,_0x4297a7){_0x4297a7=_0x4297a7||0xc8;return function(_0x475b76){if(_0x475b76){return _0x538a44[_0xd11c('0x26')](_0x4297a7)[_0xd11c('0x27')](_0x475b76);}};}function respondWithFilteredResult(_0x54e947,_0x250d6a){return function(_0x27196d){if(_0x27196d){var _0x1fef59=typeof _0x250d6a[_0xd11c('0x28')]==='undefined'&&typeof _0x250d6a[_0xd11c('0x29')]===_0xd11c('0x2a');var _0x2e95e2=_0x27196d['count'];var _0x234ce8=_0x1fef59?0x0:_0x250d6a[_0xd11c('0x28')];var _0x6c9247=_0x1fef59?_0x27196d[_0xd11c('0x2b')]:_0x250d6a[_0xd11c('0x28')]+_0x250d6a[_0xd11c('0x29')];var _0x1ea842;if(_0x6c9247>=_0x2e95e2){_0x6c9247=_0x2e95e2;_0x1ea842=0xc8;}else{_0x1ea842=0xce;}_0x54e947[_0xd11c('0x26')](_0x1ea842);return _0x54e947['set'](_0xd11c('0x2c'),_0x234ce8+'-'+_0x6c9247+'/'+_0x2e95e2)[_0xd11c('0x27')](_0x27196d);}return null;};}function patchUpdates(_0x11071c){return function(_0x1aefa0){try{jsonpatch[_0xd11c('0x2d')](_0x1aefa0,_0x11071c,!![]);}catch(_0x157e9f){return BPromise[_0xd11c('0x2e')](_0x157e9f);}return _0x1aefa0['save']();};}function saveUpdates(_0x1fd9c8,_0x3acae0){return function(_0x1f6cd4){if(_0x1f6cd4){return _0x1f6cd4['update'](_0x1fd9c8)[_0xd11c('0x2f')](function(_0x1830d1){return _0x1830d1;});}return null;};}function removeEntity(_0x8ca4ae,_0x5ded86){return function(_0x57eac9){if(_0x57eac9){return _0x57eac9[_0xd11c('0x30')]()[_0xd11c('0x2f')](function(){_0x8ca4ae[_0xd11c('0x26')](0xcc)[_0xd11c('0x31')]();});}};}function handleEntityNotFound(_0x2fd8a3,_0x112d48){return function(_0x543a9b){if(!_0x543a9b){_0x2fd8a3[_0xd11c('0x32')](0x194);}return _0x543a9b;};}function handleError(_0x1eaa58,_0x32c4c8){_0x32c4c8=_0x32c4c8||0x1f4;return function(_0x1e28b0){logger[_0xd11c('0x21')](_0x1e28b0[_0xd11c('0x33')]);if(_0x1e28b0[_0xd11c('0x34')]){delete _0x1e28b0[_0xd11c('0x34')];}_0x1eaa58['status'](_0x32c4c8)[_0xd11c('0x35')](_0x1e28b0);};}exports[_0xd11c('0x36')]=function(_0x4060fe,_0x3ca10d){var _0x215f5d={},_0x44551b={},_0x161207={'count':0x0,'rows':[]};var _0x443761=_[_0xd11c('0x37')](db['Setting'][_0xd11c('0x38')],function(_0x34c4b6){return{'name':_0x34c4b6[_0xd11c('0x39')],'type':_0x34c4b6[_0xd11c('0x3a')][_0xd11c('0x3b')]};});_0x44551b[_0xd11c('0x3c')]=_['map'](_0x443761,_0xd11c('0x34'));_0x44551b['query']=_[_0xd11c('0x3d')](_0x4060fe[_0xd11c('0x3e')]);_0x44551b[_0xd11c('0x3f')]=_[_0xd11c('0x40')](_0x44551b[_0xd11c('0x3c')],_0x44551b[_0xd11c('0x3e')]);_0x215f5d['attributes']=_['intersection'](_0x44551b['model'],qs[_0xd11c('0x41')](_0x4060fe[_0xd11c('0x3e')][_0xd11c('0x41')]));_0x215f5d[_0xd11c('0x42')]=_0x215f5d[_0xd11c('0x42')][_0xd11c('0x43')]?_0x215f5d[_0xd11c('0x42')]:_0x44551b[_0xd11c('0x3c')];if(!_0x4060fe[_0xd11c('0x3e')][_0xd11c('0x44')](_0xd11c('0x45'))){_0x215f5d[_0xd11c('0x29')]=qs[_0xd11c('0x29')](_0x4060fe['query'][_0xd11c('0x29')]);_0x215f5d[_0xd11c('0x28')]=qs[_0xd11c('0x28')](_0x4060fe[_0xd11c('0x3e')][_0xd11c('0x28')]);}_0x215f5d[_0xd11c('0x46')]=qs['sort'](_0x4060fe[_0xd11c('0x3e')][_0xd11c('0x47')]);_0x215f5d['where']=qs[_0xd11c('0x3f')](_[_0xd11c('0x48')](_0x4060fe[_0xd11c('0x3e')],_0x44551b['filters']),_0x443761);if(_0x4060fe[_0xd11c('0x3e')]['filter']){_0x215f5d['where']=_[_0xd11c('0x49')](_0x215f5d[_0xd11c('0x4a')],{'$or':_[_0xd11c('0x37')](_0x443761,function(_0x2c343c){if(_0x2c343c[_0xd11c('0x3a')]!==_0xd11c('0x4b')){var _0x428844={};_0x428844[_0x2c343c[_0xd11c('0x34')]]={'$like':'%'+_0x4060fe[_0xd11c('0x3e')][_0xd11c('0x4c')]+'%'};return _0x428844;}})});}_0x215f5d=_[_0xd11c('0x49')]({},_0x215f5d,_0x4060fe[_0xd11c('0x4d')]);var _0xa88421={'where':_0x215f5d[_0xd11c('0x4a')]};return db[_0xd11c('0x4e')][_0xd11c('0x2b')](_0xa88421)[_0xd11c('0x2f')](function(_0x3ce8a4){_0x161207[_0xd11c('0x2b')]=_0x3ce8a4;if(_0x4060fe[_0xd11c('0x3e')][_0xd11c('0x4f')]){_0x215f5d[_0xd11c('0x50')]=[{'all':!![]}];}return db[_0xd11c('0x4e')][_0xd11c('0x51')](_0x215f5d);})[_0xd11c('0x2f')](function(_0xa998f2){_0x161207[_0xd11c('0x52')]=_0xa998f2;return _0x161207;})['then'](respondWithFilteredResult(_0x3ca10d,_0x215f5d))[_0xd11c('0x25')](handleError(_0x3ca10d,null));};exports['show']=function(_0x5da4ba,_0x4eeb32){var _0x4a457e={'raw':![],'where':{'id':_0x5da4ba[_0xd11c('0x53')]['id']}},_0x2c44b8={};_0x2c44b8[_0xd11c('0x3c')]=_[_0xd11c('0x3d')](db[_0xd11c('0x4e')]['rawAttributes']);_0x2c44b8[_0xd11c('0x3e')]=_['keys'](_0x5da4ba[_0xd11c('0x3e')]);_0x2c44b8['filters']=_['intersection'](_0x2c44b8[_0xd11c('0x3c')],_0x2c44b8[_0xd11c('0x3e')]);_0x4a457e[_0xd11c('0x42')]=_[_0xd11c('0x40')](_0x2c44b8[_0xd11c('0x3c')],qs['fields'](_0x5da4ba[_0xd11c('0x3e')]['fields']));_0x4a457e['attributes']=_0x4a457e[_0xd11c('0x42')]['length']?_0x4a457e[_0xd11c('0x42')]:_0x2c44b8[_0xd11c('0x3c')];if(_0x5da4ba[_0xd11c('0x3e')]['includeAll']){_0x4a457e[_0xd11c('0x50')]=[{'all':!![]}];}_0x4a457e=_[_0xd11c('0x49')]({},_0x4a457e,_0x5da4ba[_0xd11c('0x4d')]);return db[_0xd11c('0x4e')]['find'](_0x4a457e)[_0xd11c('0x2f')](handleEntityNotFound(_0x4eeb32,null))[_0xd11c('0x2f')](respondWithResult(_0x4eeb32,null))[_0xd11c('0x25')](handleError(_0x4eeb32,null));};exports['update']=function(_0x6666ae,_0x16384e){if(_0x6666ae[_0xd11c('0x54')]['id']){delete _0x6666ae['body']['id'];}return db['Setting']['find']({'where':{'id':_0x6666ae['params']['id']}})[_0xd11c('0x2f')](handleEntityNotFound(_0x16384e,null))[_0xd11c('0x2f')](saveUpdates(_0x6666ae['body'],null))[_0xd11c('0x2f')](respondWithResult(_0x16384e,null))[_0xd11c('0x25')](handleError(_0x16384e,null));};exports[_0xd11c('0x55')]=function(_0x290767,_0x246bf0,_0x41ad11){if(_0x290767[_0xd11c('0x56')]&&_0x290767[_0xd11c('0x56')][_0xd11c('0x57')]){_0x290767['body']['logo']=_0x290767[_0xd11c('0x56')][_0xd11c('0x57')];}return db[_0xd11c('0x4e')][_0xd11c('0x58')]({'where':{'id':_0x290767[_0xd11c('0x53')]['id']}})[_0xd11c('0x2f')](handleEntityNotFound(_0x246bf0,null))[_0xd11c('0x2f')](saveUpdates(_0x290767[_0xd11c('0x54')],null))[_0xd11c('0x2f')](respondWithResult(_0x246bf0,null))[_0xd11c('0x25')](handleError(_0x246bf0,null));};exports['addLogoLogin']=function(_0x4f68cf,_0x265a6a,_0x50dd5c){if(_0x4f68cf[_0xd11c('0x56')]&&_0x4f68cf['file'][_0xd11c('0x57')]){_0x4f68cf[_0xd11c('0x54')][_0xd11c('0x59')]=_0x4f68cf[_0xd11c('0x56')][_0xd11c('0x57')];}return db[_0xd11c('0x4e')]['find']({'where':{'id':_0x4f68cf[_0xd11c('0x53')]['id']}})[_0xd11c('0x2f')](handleEntityNotFound(_0x265a6a,null))['then'](saveUpdates(_0x4f68cf['body'],null))[_0xd11c('0x2f')](respondWithResult(_0x265a6a,null))[_0xd11c('0x25')](handleError(_0x265a6a,null));};var utilLicense=require(_0xd11c('0x17'));exports[_0xd11c('0x5a')]=function(_0x19d8c1,_0x2416a7,_0x2d6190){var _0x2e8411=_0xd11c('0x5b');var _0x52c521={'custom':![]};return utilLicense['getLicense']()['then'](function(_0x2c9cd7){if(_0x2c9cd7){_0x52c521=_0x2c9cd7;}return db[_0xd11c('0x4e')][_0xd11c('0x58')]({'where':{'id':_0x19d8c1[_0xd11c('0x53')]['id']},'attributes':[_0xd11c('0x5c'),_0xd11c('0x59'),_0xd11c('0x5d'),'favicon','defaultLogo',_0xd11c('0x5e'),_0xd11c('0x5f'),_0xd11c('0x60')],'raw':!![]});})['then'](handleEntityNotFound(_0x2416a7,null))[_0xd11c('0x2f')](function(_0x212bb2){if(_0x212bb2){var _0x1c64b4=_0x212bb2['logo']&&fs[_0xd11c('0x61')](path[_0xd11c('0x62')](config[_0xd11c('0x63')],_0x2e8411,_[_0xd11c('0x64')](_0x212bb2[_0xd11c('0x5c')])))?path[_0xd11c('0x62')](config[_0xd11c('0x63')],_0x2e8411,_['toLower'](_0x212bb2[_0xd11c('0x5c')])):path[_0xd11c('0x62')](config['root'],_0x2e8411,_[_0xd11c('0x64')](_0xd11c('0x65')));var _0x169507=_0xd11c('0x66')+_[_0xd11c('0x67')]('logo');if(_0x212bb2[_0x169507]||!_0x52c521[_0xd11c('0x68')]){_0x1c64b4=path[_0xd11c('0x62')](config[_0xd11c('0x63')],_0x2e8411,_[_0xd11c('0x64')]('default_logo.svg'));}if(!fs[_0xd11c('0x61')](_0x1c64b4)){throw new db[(_0xd11c('0x69'))][(_0xd11c('0x6a'))](_[_0xd11c('0x67')](_0xd11c('0x5c'))+'\x20not\x20found');}return _0x2416a7[_0xd11c('0x6b')](_0x1c64b4);}})[_0xd11c('0x25')](handleError(_0x2416a7,null));};var utilLicense=require('../../config/license/util');exports[_0xd11c('0x6c')]=function(_0x23faa5,_0x4928a4,_0x3a593f){var _0x4a6669=_0xd11c('0x5b');var _0x9f1748={'custom':![]};return utilLicense[_0xd11c('0x6d')]()[_0xd11c('0x2f')](function(_0x3cd59b){if(_0x3cd59b){_0x9f1748=_0x3cd59b;}return db[_0xd11c('0x4e')][_0xd11c('0x58')]({'where':{'id':_0x23faa5[_0xd11c('0x53')]['id']},'attributes':[_0xd11c('0x5c'),_0xd11c('0x59'),'preferred',_0xd11c('0x6e'),'defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon'],'raw':!![]});})[_0xd11c('0x2f')](handleEntityNotFound(_0x4928a4,null))[_0xd11c('0x2f')](function(_0x3a8eb4){if(_0x3a8eb4){var _0x3b6b5e=_0x3a8eb4[_0xd11c('0x59')]&&fs[_0xd11c('0x61')](path[_0xd11c('0x62')](config[_0xd11c('0x63')],_0x4a6669,_[_0xd11c('0x64')](_0x3a8eb4[_0xd11c('0x59')])))?path[_0xd11c('0x62')](config['root'],_0x4a6669,_['toLower'](_0x3a8eb4['loginLogo'])):path[_0xd11c('0x62')](config[_0xd11c('0x63')],_0x4a6669,_[_0xd11c('0x64')](_0xd11c('0x6f')));var _0x315d33='default'+_[_0xd11c('0x67')]('loginLogo');if(_0x3a8eb4[_0x315d33]||!_0x9f1748[_0xd11c('0x68')]){_0x3b6b5e=path[_0xd11c('0x62')](config[_0xd11c('0x63')],_0x4a6669,_[_0xd11c('0x64')]('default_loginLogo.svg'));}if(!fs[_0xd11c('0x61')](_0x3b6b5e)){throw new db[(_0xd11c('0x69'))][(_0xd11c('0x6a'))](_[_0xd11c('0x67')]('loginLogo')+_0xd11c('0x70'));}return _0x4928a4[_0xd11c('0x6b')](_0x3b6b5e);}})[_0xd11c('0x25')](handleError(_0x4928a4,null));};exports[_0xd11c('0x71')]=function(_0x20e6d1,_0x455534){return db['Setting'][_0xd11c('0x58')]({'where':{'id':_0x20e6d1[_0xd11c('0x53')]['id']},'attributes':[_0xd11c('0x72')]})[_0xd11c('0x2f')](respondWithResult(_0x455534,null))[_0xd11c('0x25')](handleError(_0x455534,null));};exports[_0xd11c('0x73')]=function(_0xd7113f,_0xafcfb0,_0xda7d42){if(_0xd7113f[_0xd11c('0x56')]&&_0xd7113f['file'][_0xd11c('0x57')]){_0xd7113f[_0xd11c('0x54')][_0xd11c('0x5d')]=_0xd7113f[_0xd11c('0x56')][_0xd11c('0x57')];}return db[_0xd11c('0x4e')]['find']({'where':{'id':_0xd7113f['params']['id']}})[_0xd11c('0x2f')](handleEntityNotFound(_0xafcfb0,null))[_0xd11c('0x2f')](saveUpdates(_0xd7113f['body'],null))[_0xd11c('0x2f')](respondWithResult(_0xafcfb0,null))[_0xd11c('0x25')](handleError(_0xafcfb0,null));};var utilLicense=require(_0xd11c('0x17'));exports[_0xd11c('0x74')]=function(_0x5afd29,_0x5bee92,_0x3a71cc){var _0x114884=_0xd11c('0x5b');var _0x51d8d4={'custom':![]};return utilLicense[_0xd11c('0x6d')]()[_0xd11c('0x2f')](function(_0x56c7b8){if(_0x56c7b8){_0x51d8d4=_0x56c7b8;}return db[_0xd11c('0x4e')]['find']({'where':{'id':_0x5afd29['params']['id']},'attributes':[_0xd11c('0x5c'),_0xd11c('0x59'),_0xd11c('0x5d'),'favicon',_0xd11c('0x75'),_0xd11c('0x5e'),_0xd11c('0x5f'),_0xd11c('0x60')],'raw':!![]});})[_0xd11c('0x2f')](handleEntityNotFound(_0x5bee92,null))[_0xd11c('0x2f')](function(_0x5c2451){if(_0x5c2451){var _0x87f36d=_0x5c2451[_0xd11c('0x5d')]&&fs[_0xd11c('0x61')](path[_0xd11c('0x62')](config[_0xd11c('0x63')],_0x114884,_['toLower'](_0x5c2451[_0xd11c('0x5d')])))?path[_0xd11c('0x62')](config[_0xd11c('0x63')],_0x114884,_['toLower'](_0x5c2451[_0xd11c('0x5d')])):path['join'](config[_0xd11c('0x63')],_0x114884,_['toLower'](_0xd11c('0x76')));var _0x4963e9=_0xd11c('0x66')+_['upperFirst'](_0xd11c('0x5d'));if(_0x5c2451[_0x4963e9]||!_0x51d8d4['custom']||!_0x51d8d4[_0xd11c('0x5d')]){_0x87f36d=path[_0xd11c('0x62')](config[_0xd11c('0x63')],_0x114884,_[_0xd11c('0x64')](_0xd11c('0x76')));}if(!fs['existsSync'](_0x87f36d)){throw new db[(_0xd11c('0x69'))]['ValidationError'](_[_0xd11c('0x67')](_0xd11c('0x5d'))+_0xd11c('0x70'));}return _0x5bee92[_0xd11c('0x6b')](_0x87f36d);}})[_0xd11c('0x25')](handleError(_0x5bee92,null));};exports[_0xd11c('0x77')]=function(_0x2feb5a,_0xf96fc9,_0xd96400){if(_0x2feb5a[_0xd11c('0x56')]&&_0x2feb5a[_0xd11c('0x56')][_0xd11c('0x57')]){_0x2feb5a['body'][_0xd11c('0x6e')]=_0x2feb5a[_0xd11c('0x56')][_0xd11c('0x57')];}return db[_0xd11c('0x4e')][_0xd11c('0x58')]({'where':{'id':_0x2feb5a[_0xd11c('0x53')]['id']}})['then'](handleEntityNotFound(_0xf96fc9,null))[_0xd11c('0x2f')](saveUpdates(_0x2feb5a[_0xd11c('0x54')],null))[_0xd11c('0x2f')](respondWithResult(_0xf96fc9,null))[_0xd11c('0x25')](handleError(_0xf96fc9,null));};var utilLicense=require(_0xd11c('0x17'));exports[_0xd11c('0x78')]=function(_0xe6b76e,_0x32638d,_0x465d8a){var _0x2f88c8='server/files/images/logos';var _0x2ec4c4={'custom':![]};return utilLicense[_0xd11c('0x6d')]()[_0xd11c('0x2f')](function(_0x1a5767){if(_0x1a5767){_0x2ec4c4=_0x1a5767;}return db[_0xd11c('0x4e')][_0xd11c('0x58')]({'where':{'id':_0xe6b76e[_0xd11c('0x53')]['id']},'attributes':[_0xd11c('0x5c'),'loginLogo','preferred',_0xd11c('0x6e'),_0xd11c('0x75'),_0xd11c('0x5e'),_0xd11c('0x5f'),_0xd11c('0x60')],'raw':!![]});})[_0xd11c('0x2f')](handleEntityNotFound(_0x32638d,null))['then'](function(_0x21b501){if(_0x21b501){var _0x4ad5d7=_0x21b501['favicon']&&fs[_0xd11c('0x61')](path[_0xd11c('0x62')](config[_0xd11c('0x63')],_0x2f88c8,_[_0xd11c('0x64')](_0x21b501['favicon'])))?path[_0xd11c('0x62')](config['root'],_0x2f88c8,_[_0xd11c('0x64')](_0x21b501[_0xd11c('0x6e')])):path[_0xd11c('0x62')](config[_0xd11c('0x63')],_0x2f88c8,_[_0xd11c('0x64')](_0xd11c('0x79')));var _0x1a3345=_0xd11c('0x66')+_[_0xd11c('0x67')](_0xd11c('0x6e'));if(_0x21b501[_0x1a3345]||!_0x2ec4c4[_0xd11c('0x68')]){_0x4ad5d7=path['join'](config['root'],_0x2f88c8,_[_0xd11c('0x64')]('default_favicon.ico'));}if(!fs[_0xd11c('0x61')](_0x4ad5d7)){throw new db[(_0xd11c('0x69'))][(_0xd11c('0x6a'))](_['upperFirst']('favicon')+_0xd11c('0x70'));}return _0x32638d[_0xd11c('0x6b')](_0x4ad5d7);}})['catch'](handleError(_0x32638d,null));};exports[_0xd11c('0x7a')]=function(_0x473d2d,_0x505e25){var _0x3deae8={'offset':moment()[_0xd11c('0x7b')]()};_0x3deae8['now']=moment()[_0xd11c('0x7b')](_0x3deae8[_0xd11c('0x28')])[_0xd11c('0x7c')](_0xd11c('0x7d'));return _0x505e25['status'](0xc8)['send'](_0x3deae8);}; \ No newline at end of file +var _0x8150=['offset','undefined','limit','count','apply','reject','update','end','stack','name','send','index','map','Setting','rawAttributes','fieldName','query','keys','filters','intersection','attributes','model','fields','order','sort','where','filter','merge','type','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','body','file','filename','getLogo','server/files/images/logos','logo','loginLogo','favicon','defaultLogo','defaultLoginLogo','defaultPreferred','defaultFavicon','existsSync','join','root','toLower','default_logo.svg','default','upperFirst','custom','Sequelize','ValidationError','\x20not\x20found','download','default_loginLogo.svg','gdpr','securePassword','getPreferred','preferred','default_preferred.png','addFavicon','getLicense','default_favicon.ico','utcOffset','now','format','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/license/util','../../mysqldb','jayson/promise','http','request','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','sendStatus','status','json'];(function(_0x2e49be,_0x2af005){var _0x5990bb=function(_0x525fef){while(--_0x525fef){_0x2e49be['push'](_0x2e49be['shift']());}};_0x5990bb(++_0x2af005);}(_0x8150,0x1a7));var _0x0815=function(_0x5a791b,_0xed3be3){_0x5a791b=_0x5a791b-0x0;var _0xff531d=_0x8150[_0x5a791b];return _0xff531d;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x0815('0x0'));var rp=require(_0x0815('0x1'));var moment=require(_0x0815('0x2'));var BPromise=require(_0x0815('0x3'));var Mustache=require(_0x0815('0x4'));var util=require('util');var path=require(_0x0815('0x5'));var sox=require('sox');var csv=require(_0x0815('0x6'));var ejs=require(_0x0815('0x7'));var fs=require('fs');var fs_extra=require(_0x0815('0x8'));var _=require('lodash');var squel=require(_0x0815('0x9'));var crypto=require(_0x0815('0xa'));var jsforce=require(_0x0815('0xb'));var deskjs=require(_0x0815('0xc'));var toCsv=require(_0x0815('0x6'));var querystring=require(_0x0815('0xd'));var Papa=require(_0x0815('0xe'));var Redis=require(_0x0815('0xf'));var authService=require(_0x0815('0x10'));var qs=require(_0x0815('0x11'));var as=require(_0x0815('0x12'));var hardwareService=require(_0x0815('0x13'));var logger=require('../../config/logger')(_0x0815('0x14'));var utils=require(_0x0815('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x0815('0x16'));var db=require(_0x0815('0x17'))['db'];var jayson=require(_0x0815('0x18'));var client=jayson['client'][_0x0815('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x20fe78,_0x35b113,_0x3b9e73,_0x403407){return new BPromise(function(_0x566387,_0x2ea0f9){var _0x3cc7e5=_0x403407||client;return _0x3cc7e5[_0x0815('0x1a')](_0x20fe78,_0x3b9e73)[_0x0815('0x1b')](function(_0x229719){logger[_0x0815('0x1c')](_0x0815('0x1d'),_0x35b113,_0x0815('0x1e'));logger[_0x0815('0x1f')](_0x0815('0x20'),_0x35b113,_0x0815('0x1e'),JSON[_0x0815('0x21')](_0x229719));if(_0x229719['error']){if(_0x229719[_0x0815('0x22')][_0x0815('0x23')]===0x1f4){logger['error'](_0x0815('0x1d'),_0x35b113,_0x229719[_0x0815('0x22')][_0x0815('0x24')]);return _0x2ea0f9(_0x229719['error'][_0x0815('0x24')]);}logger['error'](_0x0815('0x1d'),_0x35b113,_0x229719[_0x0815('0x22')][_0x0815('0x24')]);return _0x566387(_0x229719[_0x0815('0x22')][_0x0815('0x24')]);}else{logger['info']('Setting,\x20%s,\x20%s',_0x35b113,_0x0815('0x1e'));_0x566387(_0x229719['result'][_0x0815('0x24')]);}})[_0x0815('0x25')](function(_0x5812c0){logger[_0x0815('0x22')](_0x0815('0x1d'),_0x35b113,_0x5812c0);_0x2ea0f9(_0x5812c0);});});}function respondWithStatusCode(_0x526651,_0x5e7a90){_0x5e7a90=_0x5e7a90||0xcc;return function(_0x9042ed){if(_0x9042ed){return _0x526651[_0x0815('0x26')](_0x5e7a90);}return _0x526651[_0x0815('0x27')](_0x5e7a90)['end']();};}function respondWithResult(_0x2172e9,_0x2d5323){_0x2d5323=_0x2d5323||0xc8;return function(_0x4a77f4){if(_0x4a77f4){return _0x2172e9[_0x0815('0x27')](_0x2d5323)[_0x0815('0x28')](_0x4a77f4);}};}function respondWithFilteredResult(_0x72b44c,_0x1b2449){return function(_0x3e80bc){if(_0x3e80bc){var _0x513bdf=typeof _0x1b2449[_0x0815('0x29')]===_0x0815('0x2a')&&typeof _0x1b2449[_0x0815('0x2b')]===_0x0815('0x2a');var _0x21b861=_0x3e80bc['count'];var _0x3ba93d=_0x513bdf?0x0:_0x1b2449['offset'];var _0x4c2fba=_0x513bdf?_0x3e80bc[_0x0815('0x2c')]:_0x1b2449[_0x0815('0x29')]+_0x1b2449[_0x0815('0x2b')];var _0x16bd6e;if(_0x4c2fba>=_0x21b861){_0x4c2fba=_0x21b861;_0x16bd6e=0xc8;}else{_0x16bd6e=0xce;}_0x72b44c[_0x0815('0x27')](_0x16bd6e);return _0x72b44c['set']('Content-Range',_0x3ba93d+'-'+_0x4c2fba+'/'+_0x21b861)[_0x0815('0x28')](_0x3e80bc);}return null;};}function patchUpdates(_0xeefd29){return function(_0x497742){try{jsonpatch[_0x0815('0x2d')](_0x497742,_0xeefd29,!![]);}catch(_0x3218f9){return BPromise[_0x0815('0x2e')](_0x3218f9);}return _0x497742['save']();};}function saveUpdates(_0x257dba,_0xd39dbc){return function(_0x462884){if(_0x462884){return _0x462884[_0x0815('0x2f')](_0x257dba)[_0x0815('0x1b')](function(_0x2d74a1){return _0x2d74a1;});}return null;};}function removeEntity(_0x36d054,_0x58181c){return function(_0x3da4e1){if(_0x3da4e1){return _0x3da4e1['destroy']()['then'](function(){_0x36d054['status'](0xcc)[_0x0815('0x30')]();});}};}function handleEntityNotFound(_0x353e04,_0x27adf4){return function(_0x4e58df){if(!_0x4e58df){_0x353e04[_0x0815('0x26')](0x194);}return _0x4e58df;};}function handleError(_0xab3529,_0x633630){_0x633630=_0x633630||0x1f4;return function(_0x770b77){logger[_0x0815('0x22')](_0x770b77[_0x0815('0x31')]);if(_0x770b77[_0x0815('0x32')]){delete _0x770b77[_0x0815('0x32')];}_0xab3529[_0x0815('0x27')](_0x633630)[_0x0815('0x33')](_0x770b77);};}exports[_0x0815('0x34')]=function(_0x37f85c,_0x5dce85){var _0x1d599d={},_0x33789a={},_0x3089f1={'count':0x0,'rows':[]};var _0x3dcbb0=_[_0x0815('0x35')](db[_0x0815('0x36')][_0x0815('0x37')],function(_0x3b8b98){return{'name':_0x3b8b98[_0x0815('0x38')],'type':_0x3b8b98['type']['key']};});_0x33789a['model']=_['map'](_0x3dcbb0,'name');_0x33789a[_0x0815('0x39')]=_[_0x0815('0x3a')](_0x37f85c[_0x0815('0x39')]);_0x33789a[_0x0815('0x3b')]=_[_0x0815('0x3c')](_0x33789a['model'],_0x33789a[_0x0815('0x39')]);_0x1d599d[_0x0815('0x3d')]=_['intersection'](_0x33789a[_0x0815('0x3e')],qs['fields'](_0x37f85c[_0x0815('0x39')][_0x0815('0x3f')]));_0x1d599d['attributes']=_0x1d599d[_0x0815('0x3d')]['length']?_0x1d599d[_0x0815('0x3d')]:_0x33789a[_0x0815('0x3e')];if(!_0x37f85c[_0x0815('0x39')]['hasOwnProperty']('nolimit')){_0x1d599d[_0x0815('0x2b')]=qs[_0x0815('0x2b')](_0x37f85c[_0x0815('0x39')][_0x0815('0x2b')]);_0x1d599d[_0x0815('0x29')]=qs[_0x0815('0x29')](_0x37f85c['query'][_0x0815('0x29')]);}_0x1d599d[_0x0815('0x40')]=qs[_0x0815('0x41')](_0x37f85c[_0x0815('0x39')][_0x0815('0x41')]);_0x1d599d[_0x0815('0x42')]=qs[_0x0815('0x3b')](_['pick'](_0x37f85c[_0x0815('0x39')],_0x33789a[_0x0815('0x3b')]),_0x3dcbb0);if(_0x37f85c['query'][_0x0815('0x43')]){_0x1d599d[_0x0815('0x42')]=_[_0x0815('0x44')](_0x1d599d[_0x0815('0x42')],{'$or':_[_0x0815('0x35')](_0x3dcbb0,function(_0x45da79){if(_0x45da79[_0x0815('0x45')]!==_0x0815('0x46')){var _0x298e75={};_0x298e75[_0x45da79[_0x0815('0x32')]]={'$like':'%'+_0x37f85c['query'][_0x0815('0x43')]+'%'};return _0x298e75;}})});}_0x1d599d=_[_0x0815('0x44')]({},_0x1d599d,_0x37f85c[_0x0815('0x47')]);var _0x1b1252={'where':_0x1d599d[_0x0815('0x42')]};return db[_0x0815('0x36')][_0x0815('0x2c')](_0x1b1252)[_0x0815('0x1b')](function(_0x5c31e0){_0x3089f1[_0x0815('0x2c')]=_0x5c31e0;if(_0x37f85c[_0x0815('0x39')]['includeAll']){_0x1d599d[_0x0815('0x48')]=[{'all':!![]}];}return db[_0x0815('0x36')][_0x0815('0x49')](_0x1d599d);})[_0x0815('0x1b')](function(_0xe408da){_0x3089f1[_0x0815('0x4a')]=_0xe408da;return _0x3089f1;})[_0x0815('0x1b')](respondWithFilteredResult(_0x5dce85,_0x1d599d))[_0x0815('0x25')](handleError(_0x5dce85,null));};exports[_0x0815('0x4b')]=function(_0x3b24fa,_0x1fd94f){var _0x403036={'raw':![],'where':{'id':_0x3b24fa[_0x0815('0x4c')]['id']}},_0x2199a3={};_0x2199a3[_0x0815('0x3e')]=_[_0x0815('0x3a')](db[_0x0815('0x36')]['rawAttributes']);_0x2199a3[_0x0815('0x39')]=_['keys'](_0x3b24fa['query']);_0x2199a3[_0x0815('0x3b')]=_[_0x0815('0x3c')](_0x2199a3[_0x0815('0x3e')],_0x2199a3[_0x0815('0x39')]);_0x403036[_0x0815('0x3d')]=_[_0x0815('0x3c')](_0x2199a3['model'],qs[_0x0815('0x3f')](_0x3b24fa[_0x0815('0x39')]['fields']));_0x403036[_0x0815('0x3d')]=_0x403036[_0x0815('0x3d')][_0x0815('0x4d')]?_0x403036[_0x0815('0x3d')]:_0x2199a3[_0x0815('0x3e')];if(_0x3b24fa['query'][_0x0815('0x4e')]){_0x403036['include']=[{'all':!![]}];}_0x403036=_[_0x0815('0x44')]({},_0x403036,_0x3b24fa[_0x0815('0x47')]);return db[_0x0815('0x36')][_0x0815('0x4f')](_0x403036)[_0x0815('0x1b')](handleEntityNotFound(_0x1fd94f,null))[_0x0815('0x1b')](respondWithResult(_0x1fd94f,null))[_0x0815('0x25')](handleError(_0x1fd94f,null));};exports[_0x0815('0x2f')]=function(_0x66cf50,_0x3e8e58){if(_0x66cf50[_0x0815('0x50')]['id']){delete _0x66cf50['body']['id'];}return db[_0x0815('0x36')][_0x0815('0x4f')]({'where':{'id':_0x66cf50[_0x0815('0x4c')]['id']}})[_0x0815('0x1b')](handleEntityNotFound(_0x3e8e58,null))[_0x0815('0x1b')](saveUpdates(_0x66cf50[_0x0815('0x50')],null))[_0x0815('0x1b')](respondWithResult(_0x3e8e58,null))[_0x0815('0x25')](handleError(_0x3e8e58,null));};exports['addLogo']=function(_0x822d3b,_0x25b321,_0x2a1fd3){if(_0x822d3b[_0x0815('0x51')]&&_0x822d3b['file'][_0x0815('0x52')]){_0x822d3b[_0x0815('0x50')]['logo']=_0x822d3b[_0x0815('0x51')][_0x0815('0x52')];}return db[_0x0815('0x36')][_0x0815('0x4f')]({'where':{'id':_0x822d3b[_0x0815('0x4c')]['id']}})['then'](handleEntityNotFound(_0x25b321,null))[_0x0815('0x1b')](saveUpdates(_0x822d3b[_0x0815('0x50')],null))[_0x0815('0x1b')](respondWithResult(_0x25b321,null))[_0x0815('0x25')](handleError(_0x25b321,null));};exports['addLogoLogin']=function(_0x2081d6,_0x32863b,_0x3e067c){if(_0x2081d6[_0x0815('0x51')]&&_0x2081d6[_0x0815('0x51')]['filename']){_0x2081d6['body']['loginLogo']=_0x2081d6[_0x0815('0x51')][_0x0815('0x52')];}return db[_0x0815('0x36')]['find']({'where':{'id':_0x2081d6[_0x0815('0x4c')]['id']}})['then'](handleEntityNotFound(_0x32863b,null))[_0x0815('0x1b')](saveUpdates(_0x2081d6['body'],null))['then'](respondWithResult(_0x32863b,null))[_0x0815('0x25')](handleError(_0x32863b,null));};var utilLicense=require(_0x0815('0x16'));exports[_0x0815('0x53')]=function(_0x34439f,_0x3162c1,_0x286bca){var _0x5a084d=_0x0815('0x54');var _0x41aa19={'custom':![]};return utilLicense['getLicense']()['then'](function(_0xf2bd1f){if(_0xf2bd1f){_0x41aa19=_0xf2bd1f;}return db['Setting']['find']({'where':{'id':_0x34439f[_0x0815('0x4c')]['id']},'attributes':[_0x0815('0x55'),_0x0815('0x56'),'preferred',_0x0815('0x57'),_0x0815('0x58'),_0x0815('0x59'),_0x0815('0x5a'),_0x0815('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x3162c1,null))[_0x0815('0x1b')](function(_0x57141f){if(_0x57141f){var _0x4ce6f1=_0x57141f[_0x0815('0x55')]&&fs[_0x0815('0x5c')](path[_0x0815('0x5d')](config[_0x0815('0x5e')],_0x5a084d,_[_0x0815('0x5f')](_0x57141f['logo'])))?path[_0x0815('0x5d')](config[_0x0815('0x5e')],_0x5a084d,_['toLower'](_0x57141f['logo'])):path['join'](config[_0x0815('0x5e')],_0x5a084d,_[_0x0815('0x5f')](_0x0815('0x60')));var _0x5d416c=_0x0815('0x61')+_[_0x0815('0x62')](_0x0815('0x55'));if(_0x57141f[_0x5d416c]||!_0x41aa19[_0x0815('0x63')]){_0x4ce6f1=path[_0x0815('0x5d')](config[_0x0815('0x5e')],_0x5a084d,_['toLower'](_0x0815('0x60')));}if(!fs['existsSync'](_0x4ce6f1)){throw new db[(_0x0815('0x64'))][(_0x0815('0x65'))](_[_0x0815('0x62')](_0x0815('0x55'))+_0x0815('0x66'));}return _0x3162c1[_0x0815('0x67')](_0x4ce6f1);}})[_0x0815('0x25')](handleError(_0x3162c1,null));};var utilLicense=require(_0x0815('0x16'));exports['getLogoLogin']=function(_0x43dbc3,_0x598695,_0x75a63a){var _0x2c3b6c='server/files/images/logos';var _0x49b2b1={'custom':![]};return utilLicense['getLicense']()[_0x0815('0x1b')](function(_0x14ce45){if(_0x14ce45){_0x49b2b1=_0x14ce45;}return db[_0x0815('0x36')][_0x0815('0x4f')]({'where':{'id':_0x43dbc3[_0x0815('0x4c')]['id']},'attributes':[_0x0815('0x55'),_0x0815('0x56'),'preferred','favicon',_0x0815('0x58'),'defaultLoginLogo','defaultPreferred',_0x0815('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x598695,null))['then'](function(_0x5f529c){if(_0x5f529c){var _0x575791=_0x5f529c[_0x0815('0x56')]&&fs[_0x0815('0x5c')](path[_0x0815('0x5d')](config[_0x0815('0x5e')],_0x2c3b6c,_['toLower'](_0x5f529c[_0x0815('0x56')])))?path[_0x0815('0x5d')](config[_0x0815('0x5e')],_0x2c3b6c,_['toLower'](_0x5f529c[_0x0815('0x56')])):path[_0x0815('0x5d')](config[_0x0815('0x5e')],_0x2c3b6c,_[_0x0815('0x5f')](_0x0815('0x68')));var _0x7385ad=_0x0815('0x61')+_[_0x0815('0x62')](_0x0815('0x56'));if(_0x5f529c[_0x7385ad]||!_0x49b2b1['custom']){_0x575791=path[_0x0815('0x5d')](config[_0x0815('0x5e')],_0x2c3b6c,_[_0x0815('0x5f')]('default_loginLogo.svg'));}if(!fs[_0x0815('0x5c')](_0x575791)){throw new db['Sequelize'][(_0x0815('0x65'))](_[_0x0815('0x62')]('loginLogo')+_0x0815('0x66'));}return _0x598695[_0x0815('0x67')](_0x575791);}})['catch'](handleError(_0x598695,null));};exports[_0x0815('0x69')]=function(_0x4e2dbd,_0x2011f1){return db[_0x0815('0x36')][_0x0815('0x4f')]({'where':{'id':_0x4e2dbd[_0x0815('0x4c')]['id']},'attributes':[_0x0815('0x6a')]})[_0x0815('0x1b')](respondWithResult(_0x2011f1,null))['catch'](handleError(_0x2011f1,null));};exports['addPreferred']=function(_0x446c6e,_0x484263,_0x5c130e){if(_0x446c6e['file']&&_0x446c6e[_0x0815('0x51')][_0x0815('0x52')]){_0x446c6e[_0x0815('0x50')]['preferred']=_0x446c6e[_0x0815('0x51')][_0x0815('0x52')];}return db[_0x0815('0x36')]['find']({'where':{'id':_0x446c6e[_0x0815('0x4c')]['id']}})[_0x0815('0x1b')](handleEntityNotFound(_0x484263,null))['then'](saveUpdates(_0x446c6e[_0x0815('0x50')],null))[_0x0815('0x1b')](respondWithResult(_0x484263,null))['catch'](handleError(_0x484263,null));};var utilLicense=require(_0x0815('0x16'));exports[_0x0815('0x6b')]=function(_0x2a0d7f,_0x522023,_0x2a341b){var _0x4d78c6='server/files/images/logos';var _0x1db1d0={'custom':![]};return utilLicense['getLicense']()[_0x0815('0x1b')](function(_0x410f97){if(_0x410f97){_0x1db1d0=_0x410f97;}return db['Setting'][_0x0815('0x4f')]({'where':{'id':_0x2a0d7f['params']['id']},'attributes':[_0x0815('0x55'),'loginLogo','preferred','favicon',_0x0815('0x58'),_0x0815('0x59'),_0x0815('0x5a'),_0x0815('0x5b')],'raw':!![]});})[_0x0815('0x1b')](handleEntityNotFound(_0x522023,null))[_0x0815('0x1b')](function(_0x31abe1){if(_0x31abe1){var _0x4b79c7=_0x31abe1[_0x0815('0x6c')]&&fs[_0x0815('0x5c')](path[_0x0815('0x5d')](config[_0x0815('0x5e')],_0x4d78c6,_[_0x0815('0x5f')](_0x31abe1[_0x0815('0x6c')])))?path[_0x0815('0x5d')](config[_0x0815('0x5e')],_0x4d78c6,_['toLower'](_0x31abe1[_0x0815('0x6c')])):path[_0x0815('0x5d')](config['root'],_0x4d78c6,_['toLower']('default_preferred.png'));var _0x760e3=_0x0815('0x61')+_['upperFirst'](_0x0815('0x6c'));if(_0x31abe1[_0x760e3]||!_0x1db1d0[_0x0815('0x63')]||!_0x1db1d0[_0x0815('0x6c')]){_0x4b79c7=path[_0x0815('0x5d')](config['root'],_0x4d78c6,_[_0x0815('0x5f')](_0x0815('0x6d')));}if(!fs[_0x0815('0x5c')](_0x4b79c7)){throw new db[(_0x0815('0x64'))]['ValidationError'](_[_0x0815('0x62')](_0x0815('0x6c'))+_0x0815('0x66'));}return _0x522023[_0x0815('0x67')](_0x4b79c7);}})[_0x0815('0x25')](handleError(_0x522023,null));};exports[_0x0815('0x6e')]=function(_0x4807bf,_0x4e7f82,_0x200391){if(_0x4807bf[_0x0815('0x51')]&&_0x4807bf[_0x0815('0x51')]['filename']){_0x4807bf[_0x0815('0x50')]['favicon']=_0x4807bf[_0x0815('0x51')][_0x0815('0x52')];}return db[_0x0815('0x36')][_0x0815('0x4f')]({'where':{'id':_0x4807bf[_0x0815('0x4c')]['id']}})[_0x0815('0x1b')](handleEntityNotFound(_0x4e7f82,null))[_0x0815('0x1b')](saveUpdates(_0x4807bf[_0x0815('0x50')],null))[_0x0815('0x1b')](respondWithResult(_0x4e7f82,null))[_0x0815('0x25')](handleError(_0x4e7f82,null));};var utilLicense=require(_0x0815('0x16'));exports['getFavicon']=function(_0x1c5f1f,_0x2b8dfc,_0x297324){var _0x566a68=_0x0815('0x54');var _0x108395={'custom':![]};return utilLicense[_0x0815('0x6f')]()[_0x0815('0x1b')](function(_0x29a457){if(_0x29a457){_0x108395=_0x29a457;}return db['Setting'][_0x0815('0x4f')]({'where':{'id':_0x1c5f1f[_0x0815('0x4c')]['id']},'attributes':[_0x0815('0x55'),'loginLogo',_0x0815('0x6c'),_0x0815('0x57'),'defaultLogo',_0x0815('0x59'),_0x0815('0x5a'),_0x0815('0x5b')],'raw':!![]});})['then'](handleEntityNotFound(_0x2b8dfc,null))['then'](function(_0x1f6c96){if(_0x1f6c96){var _0xbdb19e=_0x1f6c96['favicon']&&fs['existsSync'](path[_0x0815('0x5d')](config[_0x0815('0x5e')],_0x566a68,_[_0x0815('0x5f')](_0x1f6c96[_0x0815('0x57')])))?path[_0x0815('0x5d')](config[_0x0815('0x5e')],_0x566a68,_[_0x0815('0x5f')](_0x1f6c96[_0x0815('0x57')])):path[_0x0815('0x5d')](config[_0x0815('0x5e')],_0x566a68,_[_0x0815('0x5f')](_0x0815('0x70')));var _0x13bdbe=_0x0815('0x61')+_[_0x0815('0x62')](_0x0815('0x57'));if(_0x1f6c96[_0x13bdbe]||!_0x108395[_0x0815('0x63')]){_0xbdb19e=path[_0x0815('0x5d')](config['root'],_0x566a68,_[_0x0815('0x5f')](_0x0815('0x70')));}if(!fs[_0x0815('0x5c')](_0xbdb19e)){throw new db[(_0x0815('0x64'))][(_0x0815('0x65'))](_['upperFirst'](_0x0815('0x57'))+_0x0815('0x66'));}return _0x2b8dfc[_0x0815('0x67')](_0xbdb19e);}})[_0x0815('0x25')](handleError(_0x2b8dfc,null));};exports['getDate']=function(_0x4b2e39,_0x2466df){var _0x4faeae={'offset':moment()[_0x0815('0x71')]()};_0x4faeae[_0x0815('0x72')]=moment()['utcOffset'](_0x4faeae[_0x0815('0x29')])[_0x0815('0x73')]('YYYY-MM-DD\x20HH:mm:ss:SSS');return _0x2466df['status'](0xc8)[_0x0815('0x33')](_0x4faeae);}; \ No newline at end of file diff --git a/server/api/setting/setting.model.js b/server/api/setting/setting.model.js index c952665..159dd85 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 _0x7217=['../../config/environment','./setting.attributes','exports','define','Setting','settings','lodash','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x24f31b,_0x44b8f3){var _0x488401=function(_0x204caf){while(--_0x204caf){_0x24f31b['push'](_0x24f31b['shift']());}};_0x488401(++_0x44b8f3);}(_0x7217,0x19e));var _0x7721=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x7217[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x7721('0x0'));var util=require('util');var logger=require(_0x7721('0x1'))(_0x7721('0x2'));var moment=require(_0x7721('0x3'));var BPromise=require(_0x7721('0x4'));var rp=require(_0x7721('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x7721('0x6'));var attributes=require(_0x7721('0x7'));module[_0x7721('0x8')]=function(_0x3fe47c,_0xb239e0){return _0x3fe47c[_0x7721('0x9')](_0x7721('0xa'),attributes,{'tableName':_0x7721('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x34e8=['settings','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./setting.attributes','exports','Setting'];(function(_0x4f4e71,_0x1042a3){var _0x22ced1=function(_0x22ec4a){while(--_0x22ec4a){_0x4f4e71['push'](_0x4f4e71['shift']());}};_0x22ced1(++_0x1042a3);}(_0x34e8,0x12c));var _0x834e=function(_0x2fb898,_0x49e63b){_0x2fb898=_0x2fb898-0x0;var _0x1345e3=_0x34e8[_0x2fb898];return _0x1345e3;};'use strict';var _=require(_0x834e('0x0'));var util=require(_0x834e('0x1'));var logger=require(_0x834e('0x2'))(_0x834e('0x3'));var moment=require('moment');var BPromise=require(_0x834e('0x4'));var rp=require(_0x834e('0x5'));var fs=require('fs');var path=require(_0x834e('0x6'));var rimraf=require(_0x834e('0x7'));var config=require(_0x834e('0x8'));var attributes=require(_0x834e('0x9'));module[_0x834e('0xa')]=function(_0x4a2018,_0x858aa1){return _0x4a2018['define'](_0x834e('0xb'),attributes,{'tableName':_0x834e('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/setting/setting.rpc.js b/server/api/setting/setting.rpc.js index 53c9ee7..8dcf65b 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 _0x1ca6=['Setting,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','ShowSetting','Setting','find','options','raw','where','attributes','include','model','map','util','bluebird','../../mysqldb','../../config/logger','rpc','client','http','request','then','Setting,\x20%s,\x20%s','request\x20sent'];(function(_0x1cbcf1,_0x3f9fd9){var _0x3a06f0=function(_0x5425d4){while(--_0x5425d4){_0x1cbcf1['push'](_0x1cbcf1['shift']());}};_0x3a06f0(++_0x3f9fd9);}(_0x1ca6,0x151));var _0x61ca=function(_0x3ce8c9,_0x2ccfaa){_0x3ce8c9=_0x3ce8c9-0x0;var _0x184215=_0x1ca6[_0x3ce8c9];return _0x184215;};'use strict';var _=require('lodash');var util=require(_0x61ca('0x0'));var moment=require('moment');var BPromise=require(_0x61ca('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x61ca('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0x61ca('0x3'))(_0x61ca('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x61ca('0x5')][_0x61ca('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x9a54cd,_0x2be744,_0xee0ea8){return new BPromise(function(_0x279a9f,_0x4a348c){return client[_0x61ca('0x7')](_0x9a54cd,_0xee0ea8)[_0x61ca('0x8')](function(_0x460a6e){logger['info'](_0x61ca('0x9'),_0x2be744,_0x61ca('0xa'));logger['debug'](_0x61ca('0xb'),_0x2be744,_0x61ca('0xa'),JSON[_0x61ca('0xc')](_0x460a6e));if(_0x460a6e[_0x61ca('0xd')]){if(_0x460a6e[_0x61ca('0xd')][_0x61ca('0xe')]===0x1f4){logger[_0x61ca('0xd')](_0x61ca('0x9'),_0x2be744,_0x460a6e[_0x61ca('0xd')][_0x61ca('0xf')]);return _0x4a348c(_0x460a6e[_0x61ca('0xd')][_0x61ca('0xf')]);}logger[_0x61ca('0xd')](_0x61ca('0x9'),_0x2be744,_0x460a6e[_0x61ca('0xd')][_0x61ca('0xf')]);return _0x279a9f(_0x460a6e[_0x61ca('0xd')]['message']);}else{logger[_0x61ca('0x10')](_0x61ca('0x9'),_0x2be744,'request\x20sent');_0x279a9f(_0x460a6e[_0x61ca('0x11')][_0x61ca('0xf')]);}})[_0x61ca('0x12')](function(_0x22555d){logger[_0x61ca('0xd')]('Setting,\x20%s,\x20%s',_0x2be744,_0x22555d);_0x4a348c(_0x22555d);});});}exports[_0x61ca('0x13')]=function(_0x5ca0c0){var _0x46694f=this;return new Promise(function(_0x26d4e3,_0x263b5d){return db[_0x61ca('0x14')][_0x61ca('0x15')]({'raw':_0x5ca0c0[_0x61ca('0x16')]?_0x5ca0c0[_0x61ca('0x16')][_0x61ca('0x17')]===undefined?!![]:![]:!![],'where':_0x5ca0c0['options']?_0x5ca0c0[_0x61ca('0x16')][_0x61ca('0x18')]||null:null,'attributes':_0x5ca0c0['options']?_0x5ca0c0['options'][_0x61ca('0x19')]||null:null,'include':_0x5ca0c0[_0x61ca('0x16')]?_0x5ca0c0[_0x61ca('0x16')][_0x61ca('0x1a')]?_['map'](_0x5ca0c0['options']['include'],function(_0x5b8241){return{'model':db[_0x5b8241[_0x61ca('0x1b')]],'as':_0x5b8241['as'],'attributes':_0x5b8241[_0x61ca('0x19')],'include':_0x5b8241['include']?_[_0x61ca('0x1c')](_0x5b8241['include'],function(_0x3ea338){return{'model':db[_0x3ea338[_0x61ca('0x1b')]],'as':_0x3ea338['as'],'attributes':_0x3ea338[_0x61ca('0x19')],'include':_0x3ea338[_0x61ca('0x1a')]?_['map'](_0x3ea338[_0x61ca('0x1a')],function(_0xf1fe82){return{'model':db[_0xf1fe82['model']],'as':_0xf1fe82['as'],'attributes':_0xf1fe82[_0x61ca('0x19')]};}):[]};}):[]};}):[]:[]})[_0x61ca('0x8')](function(_0x2765e6){logger[_0x61ca('0x10')](_0x61ca('0x13'),_0x5ca0c0);logger['debug'](_0x61ca('0x13'),_0x5ca0c0,JSON['stringify'](_0x2765e6));_0x26d4e3(_0x2765e6);})[_0x61ca('0x12')](function(_0x174aae){logger[_0x61ca('0xd')](_0x61ca('0x13'),_0x174aae['message'],_0x5ca0c0);_0x263b5d(_0x46694f[_0x61ca('0xd')](0x1f4,_0x174aae[_0x61ca('0xf')]));});});}; \ No newline at end of file +var _0x916f=['client','http','then','info','Setting,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','ShowSetting','Setting','options','raw','attributes','include','map','model','stringify','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x2478c9,_0x43576d){var _0x32916a=function(_0x150580){while(--_0x150580){_0x2478c9['push'](_0x2478c9['shift']());}};_0x32916a(++_0x43576d);}(_0x916f,0xfd));var _0xf916=function(_0xdda921,_0x18bb02){_0xdda921=_0xdda921-0x0;var _0x747a97=_0x916f[_0xdda921];return _0x747a97;};'use strict';var _=require('lodash');var util=require(_0xf916('0x0'));var moment=require(_0xf916('0x1'));var BPromise=require('bluebird');var rs=require(_0xf916('0x2'));var fs=require('fs');var Redis=require(_0xf916('0x3'));var db=require(_0xf916('0x4'))['db'];var utils=require(_0xf916('0x5'));var logger=require('../../config/logger')(_0xf916('0x6'));var config=require(_0xf916('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xf916('0x8')][_0xf916('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x1ba1c7,_0x348a08,_0x1ba24b){return new BPromise(function(_0x4a7851,_0x2bd819){return client['request'](_0x1ba1c7,_0x1ba24b)[_0xf916('0xa')](function(_0x407bd5){logger[_0xf916('0xb')](_0xf916('0xc'),_0x348a08,_0xf916('0xd'));logger[_0xf916('0xe')]('Setting,\x20%s,\x20%s,\x20%s',_0x348a08,_0xf916('0xd'),JSON['stringify'](_0x407bd5));if(_0x407bd5['error']){if(_0x407bd5[_0xf916('0xf')][_0xf916('0x10')]===0x1f4){logger[_0xf916('0xf')](_0xf916('0xc'),_0x348a08,_0x407bd5[_0xf916('0xf')]['message']);return _0x2bd819(_0x407bd5[_0xf916('0xf')][_0xf916('0x11')]);}logger['error']('Setting,\x20%s,\x20%s',_0x348a08,_0x407bd5[_0xf916('0xf')][_0xf916('0x11')]);return _0x4a7851(_0x407bd5[_0xf916('0xf')][_0xf916('0x11')]);}else{logger[_0xf916('0xb')](_0xf916('0xc'),_0x348a08,_0xf916('0xd'));_0x4a7851(_0x407bd5[_0xf916('0x12')][_0xf916('0x11')]);}})[_0xf916('0x13')](function(_0x4777b5){logger[_0xf916('0xf')](_0xf916('0xc'),_0x348a08,_0x4777b5);_0x2bd819(_0x4777b5);});});}exports[_0xf916('0x14')]=function(_0x5c1c34){var _0x3d4bdc=this;return new Promise(function(_0x3e518e,_0x59b403){return db[_0xf916('0x15')]['find']({'raw':_0x5c1c34[_0xf916('0x16')]?_0x5c1c34[_0xf916('0x16')][_0xf916('0x17')]===undefined?!![]:![]:!![],'where':_0x5c1c34[_0xf916('0x16')]?_0x5c1c34['options']['where']||null:null,'attributes':_0x5c1c34[_0xf916('0x16')]?_0x5c1c34[_0xf916('0x16')][_0xf916('0x18')]||null:null,'include':_0x5c1c34['options']?_0x5c1c34[_0xf916('0x16')][_0xf916('0x19')]?_[_0xf916('0x1a')](_0x5c1c34[_0xf916('0x16')][_0xf916('0x19')],function(_0x5dd310){return{'model':db[_0x5dd310[_0xf916('0x1b')]],'as':_0x5dd310['as'],'attributes':_0x5dd310[_0xf916('0x18')],'include':_0x5dd310[_0xf916('0x19')]?_[_0xf916('0x1a')](_0x5dd310[_0xf916('0x19')],function(_0x59d549){return{'model':db[_0x59d549[_0xf916('0x1b')]],'as':_0x59d549['as'],'attributes':_0x59d549[_0xf916('0x18')],'include':_0x59d549[_0xf916('0x19')]?_[_0xf916('0x1a')](_0x59d549['include'],function(_0x9fa3b5){return{'model':db[_0x9fa3b5[_0xf916('0x1b')]],'as':_0x9fa3b5['as'],'attributes':_0x9fa3b5[_0xf916('0x18')]};}):[]};}):[]};}):[]:[]})[_0xf916('0xa')](function(_0xd9c9b7){logger[_0xf916('0xb')]('ShowSetting',_0x5c1c34);logger['debug'](_0xf916('0x14'),_0x5c1c34,JSON[_0xf916('0x1c')](_0xd9c9b7));_0x3e518e(_0xd9c9b7);})[_0xf916('0x13')](function(_0xd4a0cc){logger['error'](_0xf916('0x14'),_0xd4a0cc[_0xf916('0x11')],_0x5c1c34);_0x59b403(_0x3d4bdc[_0xf916('0xf')](0x1f4,_0xd4a0cc[_0xf916('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/index.js b/server/api/smsAccount/index.js index cdfda1e..6803046 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 _0xabce=['/:id/users','getAgents','create','post','addAnswer','/:id/notify','notify','/:id/send','send','status','addAgents','put','update','delete','/:id','destroy','removeDispositions','removeAnswers','exports','multer','util','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','describe','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status'];(function(_0x612a0e,_0x1a5012){var _0x4738a1=function(_0x59ad77){while(--_0x59ad77){_0x612a0e['push'](_0x612a0e['shift']());}};_0x4738a1(++_0x1a5012);}(_0xabce,0x103));var _0xeabc=function(_0x1d9aa0,_0x272488){_0x1d9aa0=_0x1d9aa0-0x0;var _0x226868=_0xabce[_0x1d9aa0];return _0x226868;};'use strict';var multer=require(_0xeabc('0x0'));var util=require(_0xeabc('0x1'));var path=require(_0xeabc('0x2'));var timeout=require(_0xeabc('0x3'));var express=require(_0xeabc('0x4'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xeabc('0x5'));var interaction=require(_0xeabc('0x6'));var config=require(_0xeabc('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0xeabc('0x8')](),controller['index']);router[_0xeabc('0x9')]('/describe',auth[_0xeabc('0x8')](),controller[_0xeabc('0xa')]);router[_0xeabc('0x9')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0xb')]);router[_0xeabc('0x9')](_0xeabc('0xc'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xd')]);router[_0xeabc('0x9')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0xf')]);router[_0xeabc('0x9')](_0xeabc('0x10'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x11')]);router[_0xeabc('0x9')](_0xeabc('0x12'),auth['isAuthenticated'](),controller[_0xeabc('0x13')]);router[_0xeabc('0x9')](_0xeabc('0x14'),controller['statusGet']);router['get'](_0xeabc('0x15'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x16')]);router['post']('/',auth[_0xeabc('0x8')](),controller[_0xeabc('0x17')]);router['post']('/:id/dispositions',auth[_0xeabc('0x8')](),controller['addDisposition']);router[_0xeabc('0x18')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x19')]);router[_0xeabc('0x18')](_0xeabc('0x1a'),controller[_0xeabc('0x1b')]);router[_0xeabc('0x18')]('/:id/applications',auth[_0xeabc('0x8')](),controller['addApplications']);router[_0xeabc('0x18')](_0xeabc('0x1c'),auth['isAuthenticated'](),controller[_0xeabc('0x1d')]);router[_0xeabc('0x18')](_0xeabc('0x14'),controller[_0xeabc('0x1e')]);router[_0xeabc('0x18')]('/:id/users',auth[_0xeabc('0x8')](),controller[_0xeabc('0x1f')]);router[_0xeabc('0x20')]('/:id',auth[_0xeabc('0x8')](),controller[_0xeabc('0x21')]);router[_0xeabc('0x22')](_0xeabc('0x23'),auth['isAuthenticated'](),controller[_0xeabc('0x24')]);router['delete'](_0xeabc('0xc'),auth['isAuthenticated'](),controller[_0xeabc('0x25')]);router[_0xeabc('0x22')](_0xeabc('0xe'),auth[_0xeabc('0x8')](),controller[_0xeabc('0x26')]);router[_0xeabc('0x22')](_0xeabc('0x15'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xeabc('0x27')]=router; \ No newline at end of file +var _0x6aa7=['create','addDisposition','addAnswer','addApplications','/:id/send','send','status','addAgents','put','update','delete','destroy','removeDispositions','removeAnswers','removeAgents','exports','multer','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','isAuthenticated','get','/describe','/:id','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/applications','getApplications','/:id/interactions','getInteractions','/:id/status','/:id/users','getAgents','post'];(function(_0x57615d,_0x30965c){var _0x1c5a92=function(_0x584475){while(--_0x584475){_0x57615d['push'](_0x57615d['shift']());}};_0x1c5a92(++_0x30965c);}(_0x6aa7,0x178));var _0x76aa=function(_0x255aaf,_0x282056){_0x255aaf=_0x255aaf-0x0;var _0x145bd2=_0x6aa7[_0x255aaf];return _0x145bd2;};'use strict';var multer=require(_0x76aa('0x0'));var util=require('util');var path=require(_0x76aa('0x1'));var timeout=require(_0x76aa('0x2'));var express=require(_0x76aa('0x3'));var router=express[_0x76aa('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x76aa('0x5'));var interaction=require(_0x76aa('0x6'));var config=require(_0x76aa('0x7'));var controller=require('./smsAccount.controller');router['get']('/',auth[_0x76aa('0x8')](),controller['index']);router[_0x76aa('0x9')](_0x76aa('0xa'),auth[_0x76aa('0x8')](),controller['describe']);router[_0x76aa('0x9')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller['show']);router[_0x76aa('0x9')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xd')]);router[_0x76aa('0x9')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0xf')]);router[_0x76aa('0x9')](_0x76aa('0x10'),auth['isAuthenticated'](),controller[_0x76aa('0x11')]);router['get'](_0x76aa('0x12'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x13')]);router[_0x76aa('0x9')](_0x76aa('0x14'),controller['statusGet']);router['get'](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x16')]);router[_0x76aa('0x17')]('/',auth['isAuthenticated'](),controller[_0x76aa('0x18')]);router['post'](_0x76aa('0xc'),auth['isAuthenticated'](),controller[_0x76aa('0x19')]);router[_0x76aa('0x17')](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1a')]);router[_0x76aa('0x17')]('/:id/notify',controller['notify']);router[_0x76aa('0x17')](_0x76aa('0x10'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1b')]);router[_0x76aa('0x17')](_0x76aa('0x1c'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x1d')]);router[_0x76aa('0x17')]('/:id/status',controller[_0x76aa('0x1e')]);router[_0x76aa('0x17')](_0x76aa('0x15'),auth['isAuthenticated'](),controller[_0x76aa('0x1f')]);router[_0x76aa('0x20')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x21')]);router[_0x76aa('0x22')](_0x76aa('0xb'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x23')]);router[_0x76aa('0x22')](_0x76aa('0xc'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x24')]);router['delete'](_0x76aa('0xe'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x25')]);router[_0x76aa('0x22')](_0x76aa('0x15'),auth[_0x76aa('0x8')](),controller[_0x76aa('0x26')]);module[_0x76aa('0x27')]=router; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.attributes.js b/server/api/smsAccount/smsAccount.attributes.js index 68113f7..e792d5f 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 _0xcba9=['generate','ENUM','twilio','skebby','connectel','clicksend','clickatell','bandwidth','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','mandatoryDispositionPauseId','setDataValue','mandatoryDisposition','sequelize','randomstring','name','STRING'];(function(_0x1ca66c,_0x3e3868){var _0x5a78ce=function(_0x5432ac){while(--_0x5432ac){_0x1ca66c['push'](_0x1ca66c['shift']());}};_0x5a78ce(++_0x3e3868);}(_0xcba9,0xc4));var _0x9cba=function(_0x581543,_0x5d08cf){_0x581543=_0x581543-0x0;var _0x2845f5=_0xcba9[_0x581543];return _0x2845f5;};'use strict';var Sequelize=require(_0x9cba('0x0'));var rs=require(_0x9cba('0x1'));module['exports']={'name':{'type':Sequelize['STRING'],'unique':_0x9cba('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x9cba('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x9cba('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x9cba('0x3')],'defaultValue':function(){return rs[_0x9cba('0x4')]();}},'phone':{'type':Sequelize[_0x9cba('0x3')]},'type':{'type':Sequelize[_0x9cba('0x5')](_0x9cba('0x6'),_0x9cba('0x7'),_0x9cba('0x8'),_0x9cba('0x9'),'plivo',_0x9cba('0xa'),_0x9cba('0xb'),'csc','infobip',_0x9cba('0xc'))},'accountSid':{'type':Sequelize[_0x9cba('0x3')]},'authId':{'type':Sequelize[_0x9cba('0x3')]},'authToken':{'type':Sequelize['STRING']},'smsMethod':{'type':Sequelize['ENUM']('SI','TI','GP')},'username':{'type':Sequelize[_0x9cba('0x3')]},'password':{'type':Sequelize[_0x9cba('0x3')]},'apiKey':{'type':Sequelize[_0x9cba('0x3')]},'applicationId':{'type':Sequelize[_0x9cba('0x3')]},'accountId':{'type':Sequelize[_0x9cba('0x3')]},'senderString':{'type':Sequelize[_0x9cba('0x3')]},'deliveryReport':{'type':Sequelize[_0x9cba('0xd')],'defaultValue':![]},'description':{'type':Sequelize[_0x9cba('0x3')]},'notificationTemplate':{'type':Sequelize[_0x9cba('0xe')],'defaultValue':function(){return _0x9cba('0xf');}},'notificationSound':{'type':Sequelize[_0x9cba('0xd')],'defaultValue':!![]},'notificationShake':{'type':Sequelize[_0x9cba('0xd')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9cba('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9cba('0xd')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x9cba('0x10')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9cba('0xd')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize['STRING']},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9cba('0x10')],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize[_0x9cba('0xd')],'defaultValue':![],'comment':'Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','set':function(_0x218bea){if(!_0x218bea)this['setDataValue'](_0x9cba('0x11'),null);this[_0x9cba('0x12')](_0x9cba('0x13'),_0x218bea);}}}; \ No newline at end of file +var _0x2359=['setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','name','STRING','generate','ENUM','twilio','skebby','clicksend','plivo','clickatell','bandwidth','csc','infobip','intelepeer','BOOLEAN','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x2359,0xc3));var _0x9235=function(_0x6c993a,_0x5ea3ab){_0x6c993a=_0x6c993a-0x0;var _0x27f547=_0x2359[_0x6c993a];return _0x27f547;};'use strict';var Sequelize=require(_0x9235('0x0'));var rs=require('randomstring');module[_0x9235('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9235('0x2'),'allowNull':![]},'key':{'type':Sequelize[_0x9235('0x3')],'allowNull':![]},'remote':{'type':Sequelize[_0x9235('0x3')],'allowNull':![]},'token':{'type':Sequelize[_0x9235('0x3')],'defaultValue':function(){return rs[_0x9235('0x4')]();}},'phone':{'type':Sequelize[_0x9235('0x3')]},'type':{'type':Sequelize[_0x9235('0x5')](_0x9235('0x6'),_0x9235('0x7'),'connectel',_0x9235('0x8'),_0x9235('0x9'),_0x9235('0xa'),_0x9235('0xb'),_0x9235('0xc'),_0x9235('0xd'),_0x9235('0xe'))},'accountSid':{'type':Sequelize['STRING']},'authId':{'type':Sequelize[_0x9235('0x3')]},'authToken':{'type':Sequelize[_0x9235('0x3')]},'smsMethod':{'type':Sequelize[_0x9235('0x5')]('SI','TI','GP')},'username':{'type':Sequelize[_0x9235('0x3')]},'password':{'type':Sequelize[_0x9235('0x3')]},'apiKey':{'type':Sequelize[_0x9235('0x3')]},'applicationId':{'type':Sequelize[_0x9235('0x3')]},'accountId':{'type':Sequelize['STRING']},'senderString':{'type':Sequelize[_0x9235('0x3')]},'deliveryReport':{'type':Sequelize[_0x9235('0xf')],'defaultValue':![]},'description':{'type':Sequelize[_0x9235('0x3')]},'notificationTemplate':{'type':Sequelize[_0x9235('0x10')],'defaultValue':function(){return _0x9235('0x11');}},'notificationSound':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x9235('0x12')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x9235('0xf')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x9235('0xf')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'baseUrl':{'type':Sequelize[_0x9235('0x3')]},'mandatoryDispositionPauseId':{'type':Sequelize[_0x9235('0x12')],'comment':_0x9235('0x13')},'mandatoryDisposition':{'type':Sequelize[_0x9235('0xf')],'defaultValue':![],'comment':_0x9235('0x14'),'set':function(_0x59457a){if(!_0x59457a)this[_0x9235('0x15')](_0x9235('0x16'),null);this[_0x9235('0x15')](_0x9235('0x17'),_0x59457a);}}}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.controller.js b/server/api/smsAccount/smsAccount.controller.js index 2956b9e..f5a6fa3 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 _0x2f9e=['Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','ISOLATION_LEVELS','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','Contact','fullname','internal','Tag','Tags','color','tag','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','List','out','Messages','dataValues','SmsAccount,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','skebby','skebby_dispatch_id','statusInt','requestid','status_code','infobip','groupName','DELIVERED','redif','inspect','error_code','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','bandwidth','message-delivered','DELIVRD','ACCEPTD','message-id','state','addAgents','emit','userSmsAccount:save','removeAgents','isArray','userSmsAccount:remove','getAgents','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','./smsAccount.socket','register','client','http','request','then','info','SmsAccount,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','destroy','get','UserProfileResource','stack','send','index','Pause','SmsAccount','rawAttributes','type','key','model','map','name','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','VIRTUAL','filter','merge','includeAll','include','findAll','catch','show','params','mandatoryDispositionPause','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','SmsAccounts','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','describe','addDisposition','SmsAccountId','Disposition','getDispositions','findOne','rows','removeDispositions','ids','CannedAnswer','getAnswers','removeAnswers','notify','sms','SmsApplication','Applications','account','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','Body','messageId','MessageSid','sender','text','connectel','clicksend','message_id','plivo','Text','MessageUUID','results','csc','originatingAddress','segmentedMessage','clickatell','fromNumber','replyMessageId','intelepeer','refid','isNil','from\x20is\x20mandatory','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','omit','Contacts','contact','SmsInteraction','spread','interaction','autoclose','push','close','unmanaged','created','SmsMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','*,*,*,*','Start','startRouting','receiveMessage','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s'];(function(_0x3fb77c,_0x1968ad){var _0x465848=function(_0x4a1ad0){while(--_0x4a1ad0){_0x3fb77c['push'](_0x3fb77c['shift']());}};_0x465848(++_0x1968ad);}(_0x2f9e,0x128));var _0xe2f9=function(_0x4565bf,_0x5ad9d6){_0x4565bf=_0x4565bf-0x0;var _0x5610ba=_0x2f9e[_0x4565bf];return _0x5610ba;};'use strict';var emlformat=require(_0xe2f9('0x0'));var rimraf=require(_0xe2f9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe2f9('0x2'));var rp=require(_0xe2f9('0x3'));var moment=require(_0xe2f9('0x4'));var BPromise=require(_0xe2f9('0x5'));var Mustache=require(_0xe2f9('0x6'));var util=require('util');var path=require(_0xe2f9('0x7'));var sox=require(_0xe2f9('0x8'));var csv=require('to-csv');var ejs=require(_0xe2f9('0x9'));var fs=require('fs');var fs_extra=require(_0xe2f9('0xa'));var _=require(_0xe2f9('0xb'));var squel=require(_0xe2f9('0xc'));var crypto=require(_0xe2f9('0xd'));var jsforce=require(_0xe2f9('0xe'));var deskjs=require(_0xe2f9('0xf'));var toCsv=require(_0xe2f9('0x10'));var querystring=require('querystring');var Papa=require(_0xe2f9('0x11'));var Redis=require(_0xe2f9('0x12'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xe2f9('0x13'));var hardwareService=require(_0xe2f9('0x14'));var logger=require(_0xe2f9('0x15'))(_0xe2f9('0x16'));var utils=require(_0xe2f9('0x17'));var config=require(_0xe2f9('0x18'));var licenseUtil=require(_0xe2f9('0x19'));var db=require(_0xe2f9('0x1a'))['db'];config[_0xe2f9('0x1b')]=_[_0xe2f9('0x1c')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xe2f9('0x1d'))[_0xe2f9('0x1e')](socket);var jayson=require('jayson/promise');var client=jayson[_0xe2f9('0x1f')][_0xe2f9('0x20')]({'port':0x232c});function respondWithRpcPromise(_0x2fa86f,_0x38911f,_0x7e2c28,_0xdd073){return new BPromise(function(_0x5dd5d3,_0xf174d5){var _0x17278e=_0xdd073||client;return _0x17278e[_0xe2f9('0x21')](_0x2fa86f,_0x7e2c28)[_0xe2f9('0x22')](function(_0x54aff5){logger[_0xe2f9('0x23')](_0xe2f9('0x24'),_0x38911f,_0xe2f9('0x25'));logger[_0xe2f9('0x26')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x38911f,_0xe2f9('0x25'),JSON[_0xe2f9('0x27')](_0x54aff5));if(_0x54aff5[_0xe2f9('0x28')]){if(_0x54aff5['error'][_0xe2f9('0x29')]===0x1f4){logger[_0xe2f9('0x28')](_0xe2f9('0x24'),_0x38911f,_0x54aff5[_0xe2f9('0x28')][_0xe2f9('0x2a')]);return _0xf174d5(_0x54aff5[_0xe2f9('0x28')][_0xe2f9('0x2a')]);}logger[_0xe2f9('0x28')](_0xe2f9('0x24'),_0x38911f,_0x54aff5['error'][_0xe2f9('0x2a')]);return _0x5dd5d3(_0x54aff5[_0xe2f9('0x28')][_0xe2f9('0x2a')]);}else{logger[_0xe2f9('0x23')]('SmsAccount,\x20%s,\x20%s',_0x38911f,'request\x20sent');_0x5dd5d3(_0x54aff5[_0xe2f9('0x2b')][_0xe2f9('0x2a')]);}})['catch'](function(_0x1faa2f){logger[_0xe2f9('0x28')](_0xe2f9('0x24'),_0x38911f,_0x1faa2f);_0xf174d5(_0x1faa2f);});});}function respondWithStatusCode(_0x55dcff,_0x5ab4fb){_0x5ab4fb=_0x5ab4fb||0xcc;return function(_0x4a600a){if(_0x4a600a){return _0x55dcff[_0xe2f9('0x2c')](_0x5ab4fb);}return _0x55dcff[_0xe2f9('0x2d')](_0x5ab4fb)[_0xe2f9('0x2e')]();};}function respondWithResult(_0x3bad4f,_0x173093){_0x173093=_0x173093||0xc8;return function(_0x3ebe6a){if(_0x3ebe6a){return _0x3bad4f[_0xe2f9('0x2d')](_0x173093)[_0xe2f9('0x2f')](_0x3ebe6a);}};}function respondWithFilteredResult(_0x53cb94,_0x270e58){return function(_0x5e1912){if(_0x5e1912){var _0x402d86=typeof _0x270e58['offset']===_0xe2f9('0x30')&&typeof _0x270e58[_0xe2f9('0x31')]===_0xe2f9('0x30');var _0x330728=_0x5e1912[_0xe2f9('0x32')];var _0x37d693=_0x402d86?0x0:_0x270e58['offset'];var _0x53e553=_0x402d86?_0x5e1912[_0xe2f9('0x32')]:_0x270e58[_0xe2f9('0x33')]+_0x270e58[_0xe2f9('0x31')];var _0x5b155a;if(_0x53e553>=_0x330728){_0x53e553=_0x330728;_0x5b155a=0xc8;}else{_0x5b155a=0xce;}_0x53cb94[_0xe2f9('0x2d')](_0x5b155a);return _0x53cb94[_0xe2f9('0x34')](_0xe2f9('0x35'),_0x37d693+'-'+_0x53e553+'/'+_0x330728)['json'](_0x5e1912);}return null;};}function patchUpdates(_0x5e6ae4){return function(_0x218e10){try{jsonpatch[_0xe2f9('0x36')](_0x218e10,_0x5e6ae4,!![]);}catch(_0x23490d){return BPromise[_0xe2f9('0x37')](_0x23490d);}return _0x218e10[_0xe2f9('0x38')]();};}function saveUpdates(_0x4badfc,_0x2aab33){return function(_0x19d9d2){if(_0x19d9d2){return _0x19d9d2[_0xe2f9('0x39')](_0x4badfc)[_0xe2f9('0x22')](function(_0x28464f){return _0x28464f;});}return null;};}function removeEntity(_0x27db28,_0x231aa2){return function(_0x49517a){if(_0x49517a){return _0x49517a[_0xe2f9('0x3a')]()[_0xe2f9('0x22')](function(){var _0x5a1e80=_0x49517a[_0xe2f9('0x3b')]({'plain':!![]});var _0xc68265='SmsAccounts';return db[_0xe2f9('0x3c')]['destroy']({'where':{'type':_0xc68265,'resourceId':_0x5a1e80['id']}})[_0xe2f9('0x22')](function(){return _0x49517a;});})[_0xe2f9('0x22')](function(){_0x27db28[_0xe2f9('0x2d')](0xcc)[_0xe2f9('0x2e')]();});}};}function handleEntityNotFound(_0x3b99d7,_0x5b431b){return function(_0x2f23f6){if(!_0x2f23f6){_0x3b99d7[_0xe2f9('0x2c')](0x194);}return _0x2f23f6;};}function handleError(_0x7588a0,_0x499a95){_0x499a95=_0x499a95||0x1f4;return function(_0x2d8c15){logger[_0xe2f9('0x28')](_0x2d8c15[_0xe2f9('0x3d')]);if(_0x2d8c15['name']){delete _0x2d8c15['name'];}_0x7588a0['status'](_0x499a95)[_0xe2f9('0x3e')](_0x2d8c15);};}exports[_0xe2f9('0x3f')]=function(_0x2096b4,_0x5dad9a){var _0x5d6544={'include':[{'model':db[_0xe2f9('0x40')],'as':'mandatoryDispositionPause'}]},_0x2c2331={},_0x3eee53={'count':0x0,'rows':[]};var _0x49415f=_['map'](db[_0xe2f9('0x41')][_0xe2f9('0x42')],function(_0x493ef1){return{'name':_0x493ef1['fieldName'],'type':_0x493ef1[_0xe2f9('0x43')][_0xe2f9('0x44')]};});_0x2c2331[_0xe2f9('0x45')]=_[_0xe2f9('0x46')](_0x49415f,_0xe2f9('0x47'));_0x2c2331[_0xe2f9('0x48')]=_[_0xe2f9('0x49')](_0x2096b4['query']);_0x2c2331[_0xe2f9('0x4a')]=_['intersection'](_0x2c2331[_0xe2f9('0x45')],_0x2c2331[_0xe2f9('0x48')]);_0x5d6544[_0xe2f9('0x4b')]=_[_0xe2f9('0x4c')](_0x2c2331[_0xe2f9('0x45')],qs[_0xe2f9('0x4d')](_0x2096b4[_0xe2f9('0x48')][_0xe2f9('0x4d')]));_0x5d6544[_0xe2f9('0x4b')]=_0x5d6544[_0xe2f9('0x4b')][_0xe2f9('0x4e')]?_0x5d6544[_0xe2f9('0x4b')]:_0x2c2331['model'];if(!_0x2096b4[_0xe2f9('0x48')][_0xe2f9('0x4f')](_0xe2f9('0x50'))){_0x5d6544['limit']=qs['limit'](_0x2096b4[_0xe2f9('0x48')][_0xe2f9('0x31')]);_0x5d6544[_0xe2f9('0x33')]=qs[_0xe2f9('0x33')](_0x2096b4[_0xe2f9('0x48')][_0xe2f9('0x33')]);}_0x5d6544[_0xe2f9('0x51')]=qs['sort'](_0x2096b4['query'][_0xe2f9('0x52')]);_0x5d6544[_0xe2f9('0x53')]=qs[_0xe2f9('0x4a')](_[_0xe2f9('0x54')](_0x2096b4[_0xe2f9('0x48')],_0x2c2331[_0xe2f9('0x4a')]),_0x49415f);if(_0x2096b4['query']['filter']){_0x5d6544[_0xe2f9('0x53')]=_['merge'](_0x5d6544['where'],{'$or':_['map'](_0x49415f,function(_0x20b87f){if(_0x20b87f[_0xe2f9('0x43')]!==_0xe2f9('0x55')){var _0x2661b2={};_0x2661b2[_0x20b87f['name']]={'$like':'%'+_0x2096b4['query'][_0xe2f9('0x56')]+'%'};return _0x2661b2;}})});}_0x5d6544=_[_0xe2f9('0x57')]({},_0x5d6544,_0x2096b4['options']);var _0x5def11={'where':_0x5d6544[_0xe2f9('0x53')]};return db['SmsAccount'][_0xe2f9('0x32')](_0x5def11)[_0xe2f9('0x22')](function(_0x1a692d){_0x3eee53[_0xe2f9('0x32')]=_0x1a692d;if(_0x2096b4[_0xe2f9('0x48')][_0xe2f9('0x58')]){_0x5d6544[_0xe2f9('0x59')]=[{'all':!![]}];}return db[_0xe2f9('0x41')][_0xe2f9('0x5a')](_0x5d6544);})[_0xe2f9('0x22')](function(_0x1b1c96){_0x3eee53['rows']=_0x1b1c96;return _0x3eee53;})[_0xe2f9('0x22')](respondWithFilteredResult(_0x5dad9a,_0x5d6544))[_0xe2f9('0x5b')](handleError(_0x5dad9a,null));};exports[_0xe2f9('0x5c')]=function(_0x484058,_0x8f717a){var _0x5340ae={'raw':![],'where':{'id':_0x484058[_0xe2f9('0x5d')]['id']},'include':[{'model':db[_0xe2f9('0x40')],'as':_0xe2f9('0x5e')}]},_0x2fe88a={};_0x2fe88a['model']=_[_0xe2f9('0x49')](db['SmsAccount']['rawAttributes']);_0x2fe88a[_0xe2f9('0x48')]=_[_0xe2f9('0x49')](_0x484058[_0xe2f9('0x48')]);_0x2fe88a['filters']=_[_0xe2f9('0x4c')](_0x2fe88a[_0xe2f9('0x45')],_0x2fe88a['query']);_0x5340ae[_0xe2f9('0x4b')]=_['intersection'](_0x2fe88a[_0xe2f9('0x45')],qs[_0xe2f9('0x4d')](_0x484058['query']['fields']));_0x5340ae[_0xe2f9('0x4b')]=_0x5340ae[_0xe2f9('0x4b')][_0xe2f9('0x4e')]?_0x5340ae[_0xe2f9('0x4b')]:_0x2fe88a[_0xe2f9('0x45')];if(_0x484058[_0xe2f9('0x48')][_0xe2f9('0x58')]){_0x5340ae['include']=[{'all':!![]}];}_0x5340ae=_['merge']({},_0x5340ae,_0x484058[_0xe2f9('0x5f')]);return db[_0xe2f9('0x41')][_0xe2f9('0x60')](_0x5340ae)['then'](handleEntityNotFound(_0x8f717a,null))[_0xe2f9('0x22')](respondWithResult(_0x8f717a,null))[_0xe2f9('0x5b')](handleError(_0x8f717a,null));};exports[_0xe2f9('0x61')]=function(_0x21b587,_0x35dab6){return db[_0xe2f9('0x41')][_0xe2f9('0x61')](_0x21b587[_0xe2f9('0x62')],{})['then'](function(_0x5244ae){var _0xadea77=_0x21b587[_0xe2f9('0x63')][_0xe2f9('0x3b')]({'plain':!![]});if(!_0xadea77)throw new Error(_0xe2f9('0x64'));if(_0xadea77['role']===_0xe2f9('0x63')){var _0x8ddacb=_0x5244ae[_0xe2f9('0x3b')]({'plain':!![]});var _0x2c047d=_0xe2f9('0x65');return db[_0xe2f9('0x66')]['find']({'where':{'name':_0x2c047d,'userProfileId':_0xadea77['userProfileId']},'raw':!![]})['then'](function(_0x292f80){if(_0x292f80&&_0x292f80[_0xe2f9('0x67')]===0x0){return db[_0xe2f9('0x3c')]['create']({'name':_0x8ddacb[_0xe2f9('0x47')],'resourceId':_0x8ddacb['id'],'type':_0x292f80[_0xe2f9('0x47')],'sectionId':_0x292f80['id']},{})[_0xe2f9('0x22')](function(){return _0x5244ae;});}else{return _0x5244ae;}})['catch'](function(_0x34e559){logger[_0xe2f9('0x28')](_0xe2f9('0x68'),_0x34e559);throw _0x34e559;});}return _0x5244ae;})[_0xe2f9('0x22')](respondWithResult(_0x35dab6,0xc9))[_0xe2f9('0x5b')](handleError(_0x35dab6,null));};exports[_0xe2f9('0x39')]=function(_0x17d3e6,_0x2a64d8){if(_0x17d3e6['body']['id']){delete _0x17d3e6[_0xe2f9('0x62')]['id'];}return db[_0xe2f9('0x41')]['find']({'where':{'id':_0x17d3e6[_0xe2f9('0x5d')]['id']},'include':[{'model':db[_0xe2f9('0x40')],'as':_0xe2f9('0x5e')}]})[_0xe2f9('0x22')](handleEntityNotFound(_0x2a64d8,null))[_0xe2f9('0x22')](saveUpdates(_0x17d3e6[_0xe2f9('0x62')],null))[_0xe2f9('0x22')](respondWithResult(_0x2a64d8,null))[_0xe2f9('0x5b')](handleError(_0x2a64d8,null));};exports[_0xe2f9('0x3a')]=function(_0x757466,_0x18f548){return db[_0xe2f9('0x41')][_0xe2f9('0x60')]({'where':{'id':_0x757466[_0xe2f9('0x5d')]['id']}})[_0xe2f9('0x22')](handleEntityNotFound(_0x18f548,null))[_0xe2f9('0x22')](removeEntity(_0x18f548,null))[_0xe2f9('0x5b')](handleError(_0x18f548,null));};exports[_0xe2f9('0x69')]=function(_0x2fe630,_0x5e3645){return db[_0xe2f9('0x41')]['describe']()[_0xe2f9('0x22')](respondWithResult(_0x5e3645,null))[_0xe2f9('0x5b')](handleError(_0x5e3645,null));};exports[_0xe2f9('0x6a')]=function(_0x558752,_0x451fe5,_0x49f374){if(_0x558752['body']['id']){delete _0x558752[_0xe2f9('0x62')]['id'];}return db[_0xe2f9('0x41')][_0xe2f9('0x60')]({'where':{'id':_0x558752['params']['id']}})['then'](handleEntityNotFound(_0x451fe5,null))[_0xe2f9('0x22')](function(_0xb0df52){if(_0xb0df52){_0x558752[_0xe2f9('0x62')][_0xe2f9('0x6b')]=_0xb0df52['id'];return db[_0xe2f9('0x6c')]['create'](_0x558752[_0xe2f9('0x62')]);}})[_0xe2f9('0x22')](respondWithResult(_0x451fe5,null))['catch'](handleError(_0x451fe5,null));};exports[_0xe2f9('0x6d')]=function(_0x2e1c53,_0x2a912a,_0x1caa1c){var _0x10b0a0={'raw':![],'where':{}};var _0x2f9947={};var _0x5706bf={'count':0x0,'rows':[]};return db[_0xe2f9('0x41')][_0xe2f9('0x6e')]({'where':{'id':_0x2e1c53[_0xe2f9('0x5d')]['id']}})[_0xe2f9('0x22')](handleEntityNotFound(_0x2a912a,null))[_0xe2f9('0x22')](function(_0x4eaa3d){if(_0x4eaa3d){_0x2f9947['model']=_[_0xe2f9('0x49')](db[_0xe2f9('0x6c')]['rawAttributes']);_0x2f9947[_0xe2f9('0x48')]=_['keys'](_0x2e1c53['query']);_0x2f9947['filters']=_['intersection'](_0x2f9947['model'],_0x2f9947[_0xe2f9('0x48')]);_0x10b0a0['attributes']=_[_0xe2f9('0x4c')](_0x2f9947['model'],qs[_0xe2f9('0x4d')](_0x2e1c53[_0xe2f9('0x48')]['fields']));_0x10b0a0[_0xe2f9('0x4b')]=_0x10b0a0[_0xe2f9('0x4b')]['length']?_0x10b0a0[_0xe2f9('0x4b')]:_0x2f9947[_0xe2f9('0x45')];if(!_0x2e1c53[_0xe2f9('0x48')]['hasOwnProperty'](_0xe2f9('0x50'))){_0x10b0a0[_0xe2f9('0x31')]=qs[_0xe2f9('0x31')](_0x2e1c53['query'][_0xe2f9('0x31')]);_0x10b0a0['offset']=qs[_0xe2f9('0x33')](_0x2e1c53[_0xe2f9('0x48')][_0xe2f9('0x33')]);}_0x10b0a0[_0xe2f9('0x51')]=qs['sort'](_0x2e1c53['query'][_0xe2f9('0x52')]);_0x10b0a0[_0xe2f9('0x53')]=qs[_0xe2f9('0x4a')](_[_0xe2f9('0x54')](_0x2e1c53[_0xe2f9('0x48')],_0x2f9947[_0xe2f9('0x4a')]));_0x10b0a0[_0xe2f9('0x53')][_0xe2f9('0x6b')]=_0x4eaa3d['id'];if(_0x2e1c53[_0xe2f9('0x48')][_0xe2f9('0x56')]){_0x10b0a0[_0xe2f9('0x53')]=_[_0xe2f9('0x57')](_0x10b0a0[_0xe2f9('0x53')],{'$or':_['map'](_0x10b0a0[_0xe2f9('0x4b')],function(_0x18bc8a){var _0x13bf58={};_0x13bf58[_0x18bc8a]={'$like':'%'+_0x2e1c53['query']['filter']+'%'};return _0x13bf58;})});}_0x10b0a0=_[_0xe2f9('0x57')]({},_0x10b0a0,_0x2e1c53[_0xe2f9('0x5f')]);return db[_0xe2f9('0x6c')]['count']({'where':_0x10b0a0[_0xe2f9('0x53')]})[_0xe2f9('0x22')](function(_0x981d9e){_0x5706bf['count']=_0x981d9e;if(_0x2e1c53['query'][_0xe2f9('0x58')]){_0x10b0a0[_0xe2f9('0x59')]=[{'all':!![]}];}return db['Disposition']['findAll'](_0x10b0a0);})[_0xe2f9('0x22')](function(_0x359a56){_0x5706bf[_0xe2f9('0x6f')]=_0x359a56;return _0x5706bf;});}})[_0xe2f9('0x22')](respondWithFilteredResult(_0x2a912a,_0x10b0a0))[_0xe2f9('0x5b')](handleError(_0x2a912a,null));};exports[_0xe2f9('0x70')]=function(_0x460037,_0x34c5c6,_0x2cf7b7){return db['SmsAccount'][_0xe2f9('0x60')]({'where':{'id':_0x460037[_0xe2f9('0x5d')]['id']}})['then'](handleEntityNotFound(_0x34c5c6,null))['then'](function(_0x2dafef){if(_0x2dafef){return _0x2dafef[_0xe2f9('0x70')](_0x460037[_0xe2f9('0x48')][_0xe2f9('0x71')]);}})[_0xe2f9('0x22')](respondWithStatusCode(_0x34c5c6,null))[_0xe2f9('0x5b')](handleError(_0x34c5c6,null));};exports['addAnswer']=function(_0x176f8c,_0x472892,_0x5e20dc){if(_0x176f8c[_0xe2f9('0x62')]['id']){delete _0x176f8c['body']['id'];}return db['SmsAccount'][_0xe2f9('0x60')]({'where':{'id':_0x176f8c['params']['id']}})[_0xe2f9('0x22')](handleEntityNotFound(_0x472892,null))['then'](function(_0x33dc53){if(_0x33dc53){_0x176f8c['body']['SmsAccountId']=_0x33dc53['id'];return db[_0xe2f9('0x72')]['create'](_0x176f8c[_0xe2f9('0x62')]);}})[_0xe2f9('0x22')](respondWithResult(_0x472892,null))[_0xe2f9('0x5b')](handleError(_0x472892,null));};exports[_0xe2f9('0x73')]=function(_0x3150fb,_0x55a4f4,_0x266272){var _0x6f632b={'raw':![],'where':{}};var _0x5cdc28={};var _0x630e79={'count':0x0,'rows':[]};return db[_0xe2f9('0x41')][_0xe2f9('0x6e')]({'where':{'id':_0x3150fb['params']['id']}})[_0xe2f9('0x22')](handleEntityNotFound(_0x55a4f4,null))[_0xe2f9('0x22')](function(_0x5380f8){if(_0x5380f8){_0x5cdc28[_0xe2f9('0x45')]=_[_0xe2f9('0x49')](db[_0xe2f9('0x72')][_0xe2f9('0x42')]);_0x5cdc28[_0xe2f9('0x48')]=_[_0xe2f9('0x49')](_0x3150fb['query']);_0x5cdc28[_0xe2f9('0x4a')]=_[_0xe2f9('0x4c')](_0x5cdc28[_0xe2f9('0x45')],_0x5cdc28[_0xe2f9('0x48')]);_0x6f632b[_0xe2f9('0x4b')]=_['intersection'](_0x5cdc28[_0xe2f9('0x45')],qs[_0xe2f9('0x4d')](_0x3150fb[_0xe2f9('0x48')][_0xe2f9('0x4d')]));_0x6f632b[_0xe2f9('0x4b')]=_0x6f632b[_0xe2f9('0x4b')][_0xe2f9('0x4e')]?_0x6f632b[_0xe2f9('0x4b')]:_0x5cdc28[_0xe2f9('0x45')];if(!_0x3150fb[_0xe2f9('0x48')][_0xe2f9('0x4f')](_0xe2f9('0x50'))){_0x6f632b[_0xe2f9('0x31')]=qs[_0xe2f9('0x31')](_0x3150fb[_0xe2f9('0x48')][_0xe2f9('0x31')]);_0x6f632b[_0xe2f9('0x33')]=qs[_0xe2f9('0x33')](_0x3150fb['query'][_0xe2f9('0x33')]);}_0x6f632b[_0xe2f9('0x51')]=qs[_0xe2f9('0x52')](_0x3150fb['query']['sort']);_0x6f632b[_0xe2f9('0x53')]=qs[_0xe2f9('0x4a')](_[_0xe2f9('0x54')](_0x3150fb['query'],_0x5cdc28[_0xe2f9('0x4a')]));_0x6f632b[_0xe2f9('0x53')][_0xe2f9('0x6b')]=_0x5380f8['id'];if(_0x3150fb['query'][_0xe2f9('0x56')]){_0x6f632b[_0xe2f9('0x53')]=_[_0xe2f9('0x57')](_0x6f632b[_0xe2f9('0x53')],{'$or':_[_0xe2f9('0x46')](_0x6f632b[_0xe2f9('0x4b')],function(_0x3cdb98){var _0x333b17={};_0x333b17[_0x3cdb98]={'$like':'%'+_0x3150fb[_0xe2f9('0x48')][_0xe2f9('0x56')]+'%'};return _0x333b17;})});}_0x6f632b=_[_0xe2f9('0x57')]({},_0x6f632b,_0x3150fb[_0xe2f9('0x5f')]);return db[_0xe2f9('0x72')]['count']({'where':_0x6f632b['where']})[_0xe2f9('0x22')](function(_0x3d3b9d){_0x630e79[_0xe2f9('0x32')]=_0x3d3b9d;if(_0x3150fb[_0xe2f9('0x48')][_0xe2f9('0x58')]){_0x6f632b['include']=[{'all':!![]}];}return db[_0xe2f9('0x72')][_0xe2f9('0x5a')](_0x6f632b);})[_0xe2f9('0x22')](function(_0x1d3827){_0x630e79[_0xe2f9('0x6f')]=_0x1d3827;return _0x630e79;});}})[_0xe2f9('0x22')](respondWithFilteredResult(_0x55a4f4,_0x6f632b))[_0xe2f9('0x5b')](handleError(_0x55a4f4,null));};exports[_0xe2f9('0x74')]=function(_0x3aa98d,_0x2b3094,_0x38f479){return db[_0xe2f9('0x41')]['find']({'where':{'id':_0x3aa98d[_0xe2f9('0x5d')]['id']}})[_0xe2f9('0x22')](handleEntityNotFound(_0x2b3094,null))[_0xe2f9('0x22')](function(_0x3006e7){if(_0x3006e7){return _0x3006e7['removeAnswers'](_0x3aa98d[_0xe2f9('0x48')]['ids']);}})[_0xe2f9('0x22')](respondWithStatusCode(_0x2b3094,null))[_0xe2f9('0x5b')](handleError(_0x2b3094,null));};exports[_0xe2f9('0x75')]=function(_0x15430d,_0x495396,_0xd6a0b8){var _0x55c65a={'channel':_0xe2f9('0x76')};var _0x207ed3=[];var _0x15955b=[];var _0x2f95f0={};return db[_0xe2f9('0x41')][_0xe2f9('0x60')]({'where':{'id':_0x15430d['params']['id']},'include':[{'model':db[_0xe2f9('0x77')],'as':_0xe2f9('0x78')}]})['then'](handleEntityNotFound(_0x495396,null))[_0xe2f9('0x22')](function(_0x4de656){_0x55c65a[_0xe2f9('0x79')]=_0x4de656;_0x55c65a[_0xe2f9('0x7a')]=_[_0xe2f9('0x7b')](_0x4de656[_0xe2f9('0x78')],[_0xe2f9('0x7c')],[_0xe2f9('0x7d')]);if(_0x55c65a[_0xe2f9('0x79')][_0xe2f9('0x78')]){delete _0x55c65a[_0xe2f9('0x79')][_0xe2f9('0x78')];}return db[_0xe2f9('0x7e')]['describe']();})[_0xe2f9('0x22')](function(_0x4b1424){if(!_0x4b1424){throw new db[(_0xe2f9('0x7f'))][(_0xe2f9('0x80'))](_0xe2f9('0x81'));}_0x207ed3=_[_0xe2f9('0x82')](_[_0xe2f9('0x49')](_0x4b1424),[_0xe2f9('0x83'),_0xe2f9('0x84')]);_0x15955b=_[_0xe2f9('0x82')](_[_0xe2f9('0x49')](_0x4b1424),[_0xe2f9('0x83'),_0xe2f9('0x84'),_0xe2f9('0x85'),_0xe2f9('0x86')]);_0x55c65a[_0xe2f9('0x62')]={'mapKey':_0xe2f9('0x87')};if(_0x55c65a[_0xe2f9('0x79')][_0xe2f9('0x43')]){switch(_0x55c65a[_0xe2f9('0x79')][_0xe2f9('0x43')]){case _0xe2f9('0x88'):_0x55c65a['body'][_0xe2f9('0x89')]=_0x15430d['body'][_0xe2f9('0x8a')];_0x55c65a[_0xe2f9('0x62')]['body']=_0x15430d[_0xe2f9('0x62')][_0xe2f9('0x8b')];_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x8c')]=_0x15430d[_0xe2f9('0x62')][_0xe2f9('0x8d')];break;case'skebby':_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x89')]='+'+_0x15430d['body'][_0xe2f9('0x8e')];_0x55c65a[_0xe2f9('0x62')]['body']=_0x15430d[_0xe2f9('0x62')][_0xe2f9('0x8f')];break;case _0xe2f9('0x90'):_0x55c65a['body'][_0xe2f9('0x89')]=_0x15430d[_0xe2f9('0x62')]['from'];_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x62')]=_0x15430d['body']['message'];break;case _0xe2f9('0x91'):_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x89')]=_0x15430d['body']['from'];_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x62')]=_0x15430d['body'][_0xe2f9('0x62')];_0x55c65a[_0xe2f9('0x62')]['messageId']=_0x15430d[_0xe2f9('0x62')][_0xe2f9('0x92')];break;case _0xe2f9('0x93'):_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x89')]=_0x15430d[_0xe2f9('0x62')]['From'];_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x62')]=_0x15430d[_0xe2f9('0x62')][_0xe2f9('0x94')];_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x8c')]=_0x15430d[_0xe2f9('0x62')][_0xe2f9('0x95')];break;case'infobip':_0x55c65a['body']['from']='+'+_0x15430d[_0xe2f9('0x62')][_0xe2f9('0x96')][0x0]['from'];_0x55c65a['body'][_0xe2f9('0x62')]=_0x15430d[_0xe2f9('0x62')][_0xe2f9('0x96')][0x0][_0xe2f9('0x8f')];_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x8c')]=_0x15430d['body'][_0xe2f9('0x96')][0x0][_0xe2f9('0x8c')];break;case _0xe2f9('0x97'):_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x89')]=_0x15430d[_0xe2f9('0x62')][_0xe2f9('0x98')];_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x62')]=_0x15430d[_0xe2f9('0x62')][_0xe2f9('0x99')][_0xe2f9('0x2a')];break;case _0xe2f9('0x9a'):_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x89')]=_0x15430d[_0xe2f9('0x62')][_0xe2f9('0x9b')];_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x62')]=_0x15430d['body'][_0xe2f9('0x8f')];_0x55c65a[_0xe2f9('0x62')]['messageId']=_0x15430d[_0xe2f9('0x62')][_0xe2f9('0x9c')];break;case'bandwidth':_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x8c')]=_0x15430d['body'][0x0]['message']['id'];_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x89')]=_0x15430d['body'][0x0][_0xe2f9('0x2a')][_0xe2f9('0x89')];_0x55c65a['body']['body']=_0x15430d['body'][0x0]['message'][_0xe2f9('0x8f')];break;case _0xe2f9('0x9d'):_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x89')]=_0x15430d[_0xe2f9('0x62')]['from'];_0x55c65a[_0xe2f9('0x62')]['body']=_0x15430d['body'][_0xe2f9('0x2a')];_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x8c')]=_0x15430d[_0xe2f9('0x62')][_0xe2f9('0x9e')];break;}}if(_0x55c65a[_0xe2f9('0x62')]['id']){delete _0x55c65a[_0xe2f9('0x62')]['id'];}if(_[_0xe2f9('0x9f')](_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x89')])){throw new db['Sequelize']['ValidationError'](_0xe2f9('0xa0'));}if(_[_0xe2f9('0x9f')](_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x62')])||_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x62')]===''){throw new db[(_0xe2f9('0x7f'))][(_0xe2f9('0x80'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_['isNil'](_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0xa1')])){throw new db['Sequelize']['ValidationError'](_0xe2f9('0xa2')+_0x15955b);}if(!_[_0xe2f9('0xa3')](_0x15955b,_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0xa1')])){throw new db['Sequelize'][(_0xe2f9('0x80'))](_0xe2f9('0xa4')+_0x15955b);}_0x2f95f0[_0x55c65a[_0xe2f9('0x62')]['mapKey']]=_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x89')];return db[_0xe2f9('0xa5')][_0xe2f9('0x60')]({'where':{'id':_0x55c65a['account'][_0xe2f9('0x86')]},'include':[{'model':db['CmContact'],'as':'Contacts','where':_0x2f95f0,'limit':0x1,'order':[['updatedAt',_0xe2f9('0xa6')]]}]});})['then'](handleEntityNotFound(_0x495396,null))[_0xe2f9('0x22')](function(_0x279cb5){if(_0x279cb5){_0x55c65a['list']=_[_0xe2f9('0xa7')](_0x279cb5,[_0xe2f9('0xa8')]);if(_0x279cb5['Contacts'][_0xe2f9('0x4e')]){return _0x279cb5['Contacts'][0x0];}var _0x140e70=_['defaults'](_0x55c65a[_0xe2f9('0x62')],{'firstName':_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x89')],'ListId':_0x279cb5['id']});_0x140e70[_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0xa1')]]=_0x55c65a[_0xe2f9('0x62')]['from'];return db['CmContact']['create'](_0x140e70,{'fields':_0x207ed3,'raw':!![]});}})[_0xe2f9('0x22')](handleEntityNotFound(_0x495396,null))[_0xe2f9('0x22')](function(_0xf67fc3){if(_0xf67fc3){_0x55c65a[_0xe2f9('0xa9')]=_0xf67fc3;var _0x1dd442={'ContactId':_0xf67fc3['id'],'phone':_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x89')],'SmsAccountId':_0x15430d[_0xe2f9('0x5d')]['id']};var _0x48585d={'ContactId':_0xf67fc3['id'],'SmsAccountId':_0x15430d[_0xe2f9('0x5d')]['id'],'closed':![]};return db[_0xe2f9('0xaa')][_0xe2f9('0x60')]({'where':_0x48585d})[_0xe2f9('0x22')](function(_0x42a62d){if(_0x42a62d){return[_0x42a62d,![]];}return db['SmsInteraction'][_0xe2f9('0x61')](_0x1dd442)[_0xe2f9('0x22')](function(_0x83103e){return[_0x83103e,!![]];});});}})[_0xe2f9('0xab')](function(_0x2c4e15,_0xff806d){_0x55c65a[_0xe2f9('0xac')]=_0x2c4e15[_0xe2f9('0x3b')]({'plain':!![]});_0x55c65a['interaction']['created']=![];if(_0xff806d){if(_0x55c65a['account'][_0xe2f9('0xad')]){_0x55c65a['applications'][_0xe2f9('0xae')]({'id':0x0,'priority':_0x55c65a['applications']['length']+0x1,'app':_0xe2f9('0xaf'),'appdata':_0xe2f9('0xb0'),'interval':'*,*,*,*'});}_0x55c65a[_0xe2f9('0xac')][_0xe2f9('0xb1')]=!![];}return db[_0xe2f9('0xb2')]['create']({'phone':_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0x89')],'messageId':_0x55c65a['body'][_0xe2f9('0x8c')],'body':_0x55c65a[_0xe2f9('0x62')]['body'],'SmsAccountId':_0x15430d['params']['id'],'SmsInteractionId':_0x2c4e15['id'],'direction':'in','ContactId':_0x2c4e15['ContactId'],'AttachmentId':_0x55c65a[_0xe2f9('0x62')][_0xe2f9('0xb3')]});})['then'](function(_0x4dc4e9){_0x55c65a[_0xe2f9('0x2a')]=_0x4dc4e9;if(_0x55c65a[_0xe2f9('0xac')][_0xe2f9('0xb4')]){return db[_0xe2f9('0xb5')][_0xe2f9('0x60')]({'attributes':['id',_0xe2f9('0x47')],'where':{'id':_0x55c65a[_0xe2f9('0xac')][_0xe2f9('0xb4')]}})[_0xe2f9('0x22')](function(_0x37fe8b){if(_0x37fe8b){_0x55c65a[_0xe2f9('0x7a')]['unshift']({'id':0x0,'priority':0x0,'app':_0xe2f9('0xb6'),'appdata':_0x37fe8b['name']+','+(_0x55c65a[_0xe2f9('0x79')][_0xe2f9('0xb7')]||0xa),'interval':_0xe2f9('0xb8')});}return respondWithRpcPromise(_0xe2f9('0xb9'),'startRouting',_0x55c65a);});}return respondWithRpcPromise(_0xe2f9('0xb9'),_0xe2f9('0xba'),_0x55c65a);})[_0xe2f9('0x22')](function(_0x1bc072){if(_0x1bc072){var _0x240028=0xc8;var _0x183e34=_0xe2f9('0xbb');logger[_0xe2f9('0x23')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x183e34,_0x240028,_0xe2f9('0xbc'));logger[_0xe2f9('0x26')](_0xe2f9('0xbd'),_0x183e34,_0x240028,_0xe2f9('0xbc'),JSON[_0xe2f9('0x27')](_0x1bc072));if(_0x55c65a[_0xe2f9('0x79')][_0xe2f9('0x43')]===_0xe2f9('0x88')){return _0x495396[_0xe2f9('0x2d')](_0x240028)[_0xe2f9('0x34')](_0xe2f9('0xbe'),_0xe2f9('0xbf'))[_0xe2f9('0x3e')](_0xe2f9('0xc0'));}else{return _0x495396[_0xe2f9('0x2d')](_0x240028)['json'](_0x1bc072);}}})[_0xe2f9('0x5b')](handleError(_0x495396,null));};exports[_0xe2f9('0xc1')]=function(_0x39e804,_0x3c5f2e){var _0x5b5a19=_0x39e804[_0xe2f9('0x5d')]['id'];var _0x3b678c=_0x39e804[_0xe2f9('0x62')];var _0x1ddf1a=0xc8;var _0x2d6e33=null;return db[_0xe2f9('0xc2')][_0xe2f9('0xc3')]({'isolationLevel':db['sequelize']['Transaction'][_0xe2f9('0xc4')][_0xe2f9('0xc5')]},function(_0x42fd18){return db[_0xe2f9('0x41')]['findOne']({'where':{'id':_0x5b5a19},'transaction':_0x42fd18})[_0xe2f9('0x22')](function(_0x317549){if(_0x317549){return db[_0xe2f9('0x77')][_0xe2f9('0x3a')]({'where':{'SmsAccountId':_0x5b5a19},'transaction':_0x42fd18})[_0xe2f9('0x22')](function(){var _0xd72dfb=_[_0xe2f9('0x46')](_0x3b678c,function(_0x2f73ad){_0x2f73ad[_0xe2f9('0x6b')]=_0x5b5a19;return _0x2f73ad;});return db['SmsApplication'][_0xe2f9('0xc6')](_0xd72dfb,{'transaction':_0x42fd18});});}else{_0x1ddf1a=0x194;_0x2d6e33=[];}});})[_0xe2f9('0x22')](function(){if(_0x1ddf1a!==0x194){return db[_0xe2f9('0x77')]['findAndCountAll']({'where':{'SmsAccountId':_0x5b5a19},'order':_0xe2f9('0x7c')})[_0xe2f9('0x22')](function(_0xc152f4){_0x2d6e33=_0xc152f4;});}})[_0xe2f9('0x5b')](function(_0x333f4e){_0x1ddf1a=0x1f4;logger[_0xe2f9('0x28')](_0x333f4e[_0xe2f9('0x3d')]);if(_0x333f4e[_0xe2f9('0x47')]){delete _0x333f4e[_0xe2f9('0x47')];}_0x2d6e33=_0x333f4e;})[_0xe2f9('0xc7')](function(){if(_0x2d6e33===null){_0x3c5f2e[_0xe2f9('0x2c')](_0x1ddf1a);}else{if(_0x1ddf1a===0x1f4){_0x3c5f2e[_0xe2f9('0x2d')](_0x1ddf1a)['send'](_0x2d6e33);}else{_0x3c5f2e['status'](_0x1ddf1a)[_0xe2f9('0x2f')](_0x2d6e33);}}});};exports['getApplications']=function(_0xad6799,_0x4423f9,_0x4e1bab){var _0x3c65dc={};var _0x367858={};var _0x427673;var _0x3b217e;return db[_0xe2f9('0x41')][_0xe2f9('0x6e')]({'where':{'id':_0xad6799[_0xe2f9('0x5d')]['id']}})[_0xe2f9('0x22')](handleEntityNotFound(_0x4423f9,null))[_0xe2f9('0x22')](function(_0x3d88b6){if(_0x3d88b6){_0x427673=_0x3d88b6;_0x367858[_0xe2f9('0x45')]=_[_0xe2f9('0x49')](db[_0xe2f9('0x77')][_0xe2f9('0x42')]);_0x367858['query']=_['keys'](_0xad6799['query']);_0x367858[_0xe2f9('0x4a')]=_[_0xe2f9('0x4c')](_0x367858[_0xe2f9('0x45')],_0x367858[_0xe2f9('0x48')]);_0x3c65dc[_0xe2f9('0x4b')]=_[_0xe2f9('0x4c')](_0x367858[_0xe2f9('0x45')],qs['fields'](_0xad6799[_0xe2f9('0x48')]['fields']));_0x3c65dc['attributes']=_0x3c65dc[_0xe2f9('0x4b')][_0xe2f9('0x4e')]?_0x3c65dc[_0xe2f9('0x4b')]:_0x367858[_0xe2f9('0x45')];_0x3c65dc[_0xe2f9('0x51')]=qs[_0xe2f9('0x52')](_0xad6799[_0xe2f9('0x48')][_0xe2f9('0x52')]);_0x3c65dc['where']=qs[_0xe2f9('0x4a')](_['pick'](_0xad6799[_0xe2f9('0x48')],_0x367858[_0xe2f9('0x4a')]));if(_0xad6799[_0xe2f9('0x48')][_0xe2f9('0x56')]){_0x3c65dc['where']=_[_0xe2f9('0x57')](_0x3c65dc[_0xe2f9('0x53')],{'$or':_['map'](_0x3c65dc[_0xe2f9('0x4b')],function(_0x2fbecd){var _0x395b12={};_0x395b12[_0x2fbecd]={'$like':'%'+_0xad6799[_0xe2f9('0x48')][_0xe2f9('0x56')]+'%'};return _0x395b12;})});}_0x3c65dc=_[_0xe2f9('0x57')]({},_0x3c65dc,_0xad6799['options']);return _0x427673[_0xe2f9('0xc8')](_0x3c65dc);}})[_0xe2f9('0x22')](function(_0x396169){if(_0x396169){_0x3b217e=_0x396169['length'];if(!_0xad6799[_0xe2f9('0x48')][_0xe2f9('0x4f')](_0xe2f9('0x50'))){_0x3c65dc['limit']=qs[_0xe2f9('0x31')](_0xad6799[_0xe2f9('0x48')][_0xe2f9('0x31')]);_0x3c65dc[_0xe2f9('0x33')]=qs[_0xe2f9('0x33')](_0xad6799['query'][_0xe2f9('0x33')]);}return _0x427673[_0xe2f9('0xc8')](_0x3c65dc);}})['then'](function(_0x4b67a9){if(_0x4b67a9){return _0x4b67a9?{'count':_0x3b217e,'rows':_0x4b67a9}:null;}})[_0xe2f9('0x22')](respondWithResult(_0x4423f9,null))[_0xe2f9('0x5b')](handleError(_0x4423f9,null));};exports[_0xe2f9('0xc9')]=function(_0x2939d1,_0x45779c,_0x5e8e2d){var _0x2b4381={'raw':![],'where':{}};var _0x21b80b={};var _0x531322={'count':0x0,'rows':[]};return db['SmsAccount'][_0xe2f9('0x6e')]({'where':{'id':_0x2939d1[_0xe2f9('0x5d')]['id']}})[_0xe2f9('0x22')](handleEntityNotFound(_0x45779c,null))[_0xe2f9('0x22')](function(_0x3e3d16){if(_0x3e3d16){_0x21b80b[_0xe2f9('0x45')]=_[_0xe2f9('0x49')](db[_0xe2f9('0xaa')]['rawAttributes']);_0x21b80b['query']=_[_0xe2f9('0x49')](_0x2939d1['query']);_0x21b80b[_0xe2f9('0x4a')]=_[_0xe2f9('0x4c')](_0x21b80b[_0xe2f9('0x45')],_0x21b80b[_0xe2f9('0x48')]);_0x2b4381['attributes']=_[_0xe2f9('0x4c')](_0x21b80b[_0xe2f9('0x45')],qs[_0xe2f9('0x4d')](_0x2939d1[_0xe2f9('0x48')][_0xe2f9('0x4d')]));_0x2b4381[_0xe2f9('0x4b')]=_0x2b4381[_0xe2f9('0x4b')][_0xe2f9('0x4e')]?_0x2b4381[_0xe2f9('0x4b')]:_0x21b80b[_0xe2f9('0x45')];if(!_0x2939d1[_0xe2f9('0x48')][_0xe2f9('0x4f')]('nolimit')){_0x2b4381[_0xe2f9('0x31')]=qs[_0xe2f9('0x31')](_0x2939d1['query']['limit']);_0x2b4381[_0xe2f9('0x33')]=qs[_0xe2f9('0x33')](_0x2939d1[_0xe2f9('0x48')]['offset']);}_0x2b4381['order']=qs['sort'](_0x2939d1['query'][_0xe2f9('0x52')]);_0x2b4381[_0xe2f9('0x53')]=qs[_0xe2f9('0x4a')](_['pick'](_0x2939d1[_0xe2f9('0x48')],_0x21b80b[_0xe2f9('0x4a')]));_0x2b4381[_0xe2f9('0x53')][_0xe2f9('0x6b')]=_0x3e3d16['id'];if(_0x2939d1[_0xe2f9('0x48')]['filter']){_0x2b4381[_0xe2f9('0x53')]=_[_0xe2f9('0x57')](_0x2b4381[_0xe2f9('0x53')],{'$or':_[_0xe2f9('0x46')](_0x2b4381['attributes'],function(_0x4b4296){var _0x132fd7={};_0x132fd7[_0x4b4296]={'$like':'%'+_0x2939d1[_0xe2f9('0x48')][_0xe2f9('0x56')]+'%'};return _0x132fd7;})});}_0x2b4381=_[_0xe2f9('0x57')]({},_0x2b4381,_0x2939d1['options']);return db['SmsInteraction'][_0xe2f9('0x32')]({'where':_0x2b4381[_0xe2f9('0x53')]})[_0xe2f9('0x22')](function(_0x5e40f8){_0x531322[_0xe2f9('0x32')]=_0x5e40f8;if(_0x2939d1[_0xe2f9('0x48')]['includeAll']){_0x2b4381[_0xe2f9('0x59')]=[{'model':db[_0xe2f9('0x7e')],'as':_0xe2f9('0xca'),'required':![]},{'model':db['User'],'as':'Owner','attributes':[_0xe2f9('0x47'),_0xe2f9('0xcb'),_0xe2f9('0xcc')],'required':![]},{'model':db[_0xe2f9('0xcd')],'as':_0xe2f9('0xce'),'attributes':['id','name',_0xe2f9('0xcf')],'where':_0x2939d1[_0xe2f9('0x48')][_0xe2f9('0xd0')]?{'id':_0x2939d1[_0xe2f9('0x48')]['tag']}:undefined,'required':_0x2939d1[_0xe2f9('0x48')][_0xe2f9('0xd0')]?!![]:![]}];}return db['SmsInteraction'][_0xe2f9('0x5a')](_0x2b4381);})[_0xe2f9('0x22')](function(_0x30c45d){_0x531322['rows']=_0x30c45d;return _0x531322;});}})[_0xe2f9('0x22')](respondWithFilteredResult(_0x45779c,_0x2b4381))['catch'](handleError(_0x45779c,null));};exports[_0xe2f9('0x3e')]=function(_0x1249c9,_0x105282,_0x219511){var _0x4e7ce0,_0x255059,_0x2f2357;if(_['isNil'](_0x1249c9['body']['body'])||_0x1249c9[_0xe2f9('0x62')][_0xe2f9('0x62')]===''){throw new db['Sequelize']['ValidationError'](_0xe2f9('0xd1'));}if(_[_0xe2f9('0x9f')](_0x1249c9[_0xe2f9('0x62')]['to'])){throw new db[(_0xe2f9('0x7f'))][(_0xe2f9('0x80'))](_0xe2f9('0xd2'));}_0x4e7ce0=_0x1249c9[_0xe2f9('0x62')]['to'];return db[_0xe2f9('0x41')]['find']({'where':{'id':_0x1249c9[_0xe2f9('0x5d')]['id']},'include':[{'model':db[_0xe2f9('0xa5')],'as':'List','include':[{'model':db[_0xe2f9('0x7e')],'as':_0xe2f9('0xa8'),'where':{'mobile':_0x4e7ce0},'limit':0x1,'order':[[_0xe2f9('0x84'),_0xe2f9('0xa6')]]}]}]})['then'](handleEntityNotFound(_0x105282,null))[_0xe2f9('0x22')](function(_0xc46d81){if(_0xc46d81&&_0xc46d81['List']){_0x255059=_0xc46d81[_0xe2f9('0x3b')]({'plain':!![]});if(_0x255059[_0xe2f9('0xd3')]&&_0x255059['List']['Contacts'][_0xe2f9('0x4e')]){return _0x255059['List'][_0xe2f9('0xa8')][0x0];}return db['CmContact']['create'](_[_0xe2f9('0x1c')](_0x1249c9[_0xe2f9('0x62')],{'firstName':_0x4e7ce0,'mobile':_0x4e7ce0,'phone':_0x4e7ce0,'ListId':_0x255059[_0xe2f9('0x86')]}));}})[_0xe2f9('0x22')](handleEntityNotFound(_0x105282,null))[_0xe2f9('0x22')](function(_0x68ae05){if(_0x68ae05){_0x2f2357=_0x68ae05;return db[_0xe2f9('0xaa')][_0xe2f9('0x60')]({'where':{'ContactId':_0x2f2357['id'],'closed':![],'SmsAccountId':_0x255059['id']}})['then'](function(_0x376045){if(_0x376045){return[_0x376045,![]];}return db[_0xe2f9('0xaa')]['create']({'UserId':_0x1249c9[_0xe2f9('0x63')]['id'],'ContactId':_0x2f2357['id'],'SmsAccountId':_0x255059['id'],'phone':_0x4e7ce0,'firstMsgDirection':_0xe2f9('0xd4'),'Messages':[_[_0xe2f9('0x57')](_0x1249c9[_0xe2f9('0x62')],{'read':![],'body':_0x1249c9[_0xe2f9('0x62')][_0xe2f9('0x62')],'phone':_0x4e7ce0,'SmsAccountId':_0x255059['id'],'UserId':_0x1249c9[_0xe2f9('0x63')]['id'],'ContactId':_0x2f2357['id']})]},{'include':[{'model':db[_0xe2f9('0xb2')],'as':_0xe2f9('0xd5')}]})[_0xe2f9('0x22')](function(_0x3b3de2){return[_0x3b3de2,!![]];});});}})['spread'](function(_0x1f89f5,_0x5adbc9){if(_0x5adbc9){return _0x1f89f5;}return db[_0xe2f9('0xb2')][_0xe2f9('0x61')](_[_0xe2f9('0x57')](_0x1249c9['body'],{'read':![],'body':_0x1249c9[_0xe2f9('0x62')][_0xe2f9('0x62')],'phone':_0x4e7ce0,'SmsAccountId':_0x255059['id'],'SmsInteractionId':_0x1f89f5['id'],'UserId':_0x1249c9[_0xe2f9('0x63')]['id'],'ContactId':_0x2f2357['id']}))['then'](function(_0x3d8aa7){_0x1f89f5[_0xe2f9('0xd6')][_0xe2f9('0xd5')]=[];_0x1f89f5[_0xe2f9('0xd6')][_0xe2f9('0xd5')]['push'](_0x3d8aa7[_0xe2f9('0xd6')]);return _0x1f89f5;});})[_0xe2f9('0x22')](respondWithResult(_0x105282,null))[_0xe2f9('0x5b')](handleError(_0x105282,null));};exports[_0xe2f9('0x2d')]=function(_0x128ab5,_0x76748,_0x45bd2d){if(_0x128ab5['body']['id']){delete _0x128ab5[_0xe2f9('0x62')]['id'];}var _0x3ccc73,_0xc3a969,_0x124156;return db[_0xe2f9('0x41')][_0xe2f9('0x60')]({'where':{'id':_0x128ab5[_0xe2f9('0x5d')]['id']}})[_0xe2f9('0x22')](handleEntityNotFound(_0x76748,null))['then'](function(_0x25583f){if(_0x25583f){_0x124156=_0x25583f;logger[_0xe2f9('0x26')](_0xe2f9('0xd7'),_0xe2f9('0x2d'),_0xe2f9('0xd8'),_0x25583f['type'],util['inspect'](_0x128ab5[_0xe2f9('0x62')],{'showHidden':![],'depth':null}));switch(_0x25583f[_0xe2f9('0x43')]){case _0xe2f9('0xd9'):if(_0x128ab5[_0xe2f9('0x62')][_0xe2f9('0xda')]&&_0x128ab5['body']['status']){_0xc3a969=_0x128ab5[_0xe2f9('0x62')][_0xe2f9('0x2d')];return db[_0xe2f9('0xb2')][_0xe2f9('0x60')]({'where':{'messageId':_0x128ab5[_0xe2f9('0x62')][_0xe2f9('0xda')]}});}break;case _0xe2f9('0x90'):if(_0x128ab5[_0xe2f9('0x62')]['requestid']&&_0x128ab5['body'][_0xe2f9('0xdb')]){_0xc3a969=_0x128ab5['body'][_0xe2f9('0xdb')];return db['SmsMessage'][_0xe2f9('0x60')]({'where':{'messageId':_0x128ab5[_0xe2f9('0x62')][_0xe2f9('0xdc')]}});}break;case _0xe2f9('0x91'):if(_0x128ab5[_0xe2f9('0x62')]['message_id']&&_0x128ab5[_0xe2f9('0x62')][_0xe2f9('0xdd')]){_0xc3a969=_0x128ab5['body'][_0xe2f9('0xdd')];return db[_0xe2f9('0xb2')][_0xe2f9('0x60')]({'where':{'messageId':_0x128ab5[_0xe2f9('0x62')][_0xe2f9('0x92')]}});}break;case _0xe2f9('0xde'):var _0x148b95=_0x128ab5[_0xe2f9('0x62')][_0xe2f9('0x96')][0x0];if(_0x148b95[_0xe2f9('0x8c')]&&_0x148b95[_0xe2f9('0x2d')][_0xe2f9('0xdf')]===_0xe2f9('0xe0')){_0xc3a969=_0x148b95['status'][_0xe2f9('0xdf')];return db['SmsMessage']['find']({'where':{'messageId':_0x148b95[_0xe2f9('0x8c')]}});}break;case'clickatell':if(_0x128ab5[_0xe2f9('0x62')][_0xe2f9('0x8c')]&&_0x128ab5[_0xe2f9('0x62')]['status']){_0xc3a969=_0x128ab5[_0xe2f9('0x62')][_0xe2f9('0x2d')];return db[_0xe2f9('0xb2')][_0xe2f9('0x60')]({'where':{'messageId':_0x128ab5['body'][_0xe2f9('0x8c')]}});}break;case'bandwidth':if(_0x128ab5[_0xe2f9('0x62')][0x0][_0xe2f9('0x2a')]['id']){_0xc3a969=_0x128ab5[_0xe2f9('0x62')][0x0][_0xe2f9('0x43')];return db[_0xe2f9('0xb2')]['find']({'where':{'messageId':_0x128ab5[_0xe2f9('0x62')][0x0][_0xe2f9('0x2a')]['id']}});}break;case _0xe2f9('0x9d'):if(_0x128ab5['body'][_0xe2f9('0xe1')]&&_0x128ab5[_0xe2f9('0x62')][_0xe2f9('0x2d')]){_0xc3a969=_0x128ab5[_0xe2f9('0x62')][_0xe2f9('0x2d')];return db[_0xe2f9('0xb2')]['find']({'where':{'messageId':_0x128ab5[_0xe2f9('0x62')][_0xe2f9('0xe1')]}});}break;}}})[_0xe2f9('0x22')](handleEntityNotFound(_0x76748,null))[_0xe2f9('0x22')](function(_0x2fb63d){if(_0x2fb63d){_0x3ccc73=_0x2fb63d;switch(_0x124156[_0xe2f9('0x43')]){case'skebby':if(_0xc3a969==='DELIVERED'){return _0x3ccc73[_0xe2f9('0x39')]({'read':!![]});}else{logger[_0xe2f9('0x28')](_0xe2f9('0xd7'),_0xe2f9('0x2d'),_0xe2f9('0xd9'),util[_0xe2f9('0xe2')](_0x128ab5[_0xe2f9('0x62')],{'showHidden':![],'depth':null}));}break;case _0xe2f9('0x90'):if(_0xc3a969==='1'){return _0x3ccc73[_0xe2f9('0x39')]({'read':!![]});}else{logger[_0xe2f9('0x28')](_0xe2f9('0xd7'),_0xe2f9('0x2d'),_0xe2f9('0xd9'),util[_0xe2f9('0xe2')](_0x128ab5[_0xe2f9('0x62')],{'showHidden':![],'depth':null}));}break;case _0xe2f9('0x91'):if(!_0x128ab5[_0xe2f9('0x62')][_0xe2f9('0xe3')]&&_0xc3a969>=0xc8&&_0xc3a969<=0xce){return _0x3ccc73['update']({'read':!![]});}else{logger[_0xe2f9('0x28')](_0xe2f9('0xd7'),_0xe2f9('0x2d'),_0xe2f9('0x91'),util[_0xe2f9('0xe2')](_0x128ab5[_0xe2f9('0x62')],{'showHidden':![],'depth':null}));}break;case _0xe2f9('0xde'):var _0x8ce33e=_0x128ab5['body'][_0xe2f9('0x96')][0x0];if(_0x8ce33e[_0xe2f9('0x2d')][_0xe2f9('0xdf')]==='DELIVERED'){return _0x3ccc73['update']({'read':!![]});}else{logger[_0xe2f9('0x28')](_0xe2f9('0xd7'),_0xe2f9('0x2d'),'infobip',util[_0xe2f9('0xe2')](_0x128ab5[_0xe2f9('0x62')],{'showHidden':![],'depth':null}));}break;case _0xe2f9('0x9a'):if(_0xc3a969==_0xe2f9('0xe4')||_0xc3a969==_0xe2f9('0xe5')){return _0x3ccc73[_0xe2f9('0x39')]({'read':!![]});}else{logger[_0xe2f9('0x28')](_0xe2f9('0xd7'),_0xe2f9('0x2d'),'clickatell',util[_0xe2f9('0xe2')](_0x128ab5[_0xe2f9('0x62')],{'showHidden':![],'depth':null}));}break;case _0xe2f9('0xe6'):if(_0xc3a969==_0xe2f9('0xe7')){return _0x3ccc73[_0xe2f9('0x39')]({'read':!![]});}else{logger[_0xe2f9('0x28')](_0xe2f9('0xd7'),_0xe2f9('0x2d'),'bandwidth',util[_0xe2f9('0xe2')](_0x128ab5[_0xe2f9('0x62')],{'showHidden':![],'depth':null}));}break;case'intelepeer':if(_0xc3a969===_0xe2f9('0xe8')||_0xc3a969===_0xe2f9('0xe9')){return _0x3ccc73[_0xe2f9('0x39')]({'read':!![]});}else{logger[_0xe2f9('0x28')](_0xe2f9('0xd7'),_0xe2f9('0x2d'),_0xe2f9('0x9d'),util[_0xe2f9('0xe2')](_0x128ab5['body'],{'showHidden':![],'depth':null}));}break;}return _0x3ccc73;}})[_0xe2f9('0x22')](respondWithResult(_0x76748,null))[_0xe2f9('0x5b')](handleError(_0x76748,null));};exports['statusGet']=function(_0x2feefe,_0x1ad0ed,_0x5a6989){var _0x59294b,_0x50c80c,_0x10b966;return db['SmsAccount']['find']({'where':{'id':_0x2feefe[_0xe2f9('0x5d')]['id']}})[_0xe2f9('0x22')](handleEntityNotFound(_0x1ad0ed,null))[_0xe2f9('0x22')](function(_0x58844e){if(_0x58844e){_0x10b966=_0x58844e;logger[_0xe2f9('0x26')](_0xe2f9('0xd7'),_0xe2f9('0x2d'),_0xe2f9('0xd8'),_0x58844e[_0xe2f9('0x43')],util[_0xe2f9('0xe2')](_0x2feefe[_0xe2f9('0x48')],{'showHidden':![],'depth':null}));switch(_0x58844e['type']){case'csc':if(_0x2feefe[_0xe2f9('0x48')][_0xe2f9('0xea')]&&_0x2feefe[_0xe2f9('0x48')][_0xe2f9('0xeb')]){_0x50c80c=_0x2feefe[_0xe2f9('0x48')][_0xe2f9('0xeb')];return db[_0xe2f9('0xb2')][_0xe2f9('0x60')]({'where':{'messageId':_0x2feefe['query'][_0xe2f9('0xea')]}});}break;}}})[_0xe2f9('0x22')](handleEntityNotFound(_0x1ad0ed,null))[_0xe2f9('0x22')](function(_0x271dc3){if(_0x271dc3){_0x59294b=_0x271dc3;switch(_0x10b966[_0xe2f9('0x43')]){case _0xe2f9('0x97'):if(_0x50c80c==='2'||_0x50c80c==='6'){return _0x59294b[_0xe2f9('0x39')]({'read':!![]});}else{logger['error'](_0xe2f9('0xd7'),'status',_0xe2f9('0x97'),util[_0xe2f9('0xe2')](_0x2feefe['query'],{'showHidden':![],'depth':null}));};break;}return _0x59294b;}})[_0xe2f9('0x22')](respondWithResult(_0x1ad0ed,null))[_0xe2f9('0x5b')](handleError(_0x1ad0ed,null));};exports[_0xe2f9('0xec')]=function(_0x3f540,_0xfd93c2,_0x3ce7a7){return db[_0xe2f9('0x41')][_0xe2f9('0x60')]({'where':{'id':_0x3f540[_0xe2f9('0x5d')]['id']}})[_0xe2f9('0x22')](handleEntityNotFound(_0xfd93c2,null))[_0xe2f9('0x22')](function(_0x256d2c){if(_0x256d2c){return _0x256d2c[_0xe2f9('0xec')](_0x3f540[_0xe2f9('0x62')][_0xe2f9('0x71')],_['omit'](_0x3f540[_0xe2f9('0x62')],[_0xe2f9('0x71'),'id'])||{})[_0xe2f9('0xab')](function(_0x564381){for(var _0x45d20a=0x0;_0x45d20a<_0x3f540[_0xe2f9('0x62')][_0xe2f9('0x71')][_0xe2f9('0x4e')];_0x45d20a+=0x1){socket[_0xe2f9('0xed')](_0xe2f9('0xee'),{'UserId':Number(_0x3f540[_0xe2f9('0x62')][_0xe2f9('0x71')][_0x45d20a]),'SmsAccountId':Number(_0x3f540['params']['id'])});}return _0x564381;});}})[_0xe2f9('0x22')](respondWithResult(_0xfd93c2,null))[_0xe2f9('0x5b')](handleError(_0xfd93c2,null));};exports[_0xe2f9('0xef')]=function(_0x4adb5f,_0x377f2c,_0x3e279d){return db[_0xe2f9('0x41')][_0xe2f9('0x60')]({'where':{'id':_0x4adb5f['params']['id']}})[_0xe2f9('0x22')](handleEntityNotFound(_0x377f2c,null))[_0xe2f9('0x22')](function(_0x4394e3){if(_0x4394e3){return _0x4394e3[_0xe2f9('0xef')](_0x4adb5f[_0xe2f9('0x48')]['ids'])[_0xe2f9('0x22')](function(){if(_[_0xe2f9('0xf0')](_0x4adb5f['query'][_0xe2f9('0x71')])){for(var _0x3e4cec=0x0;_0x3e4cec<_0x4adb5f[_0xe2f9('0x48')][_0xe2f9('0x71')][_0xe2f9('0x4e')];_0x3e4cec+=0x1){socket[_0xe2f9('0xed')](_0xe2f9('0xf1'),{'UserId':Number(_0x4adb5f['query'][_0xe2f9('0x71')][_0x3e4cec]),'SmsAccountId':Number(_0x4adb5f[_0xe2f9('0x5d')]['id'])});}}else{socket[_0xe2f9('0xed')](_0xe2f9('0xf1'),{'UserId':Number(_0x4adb5f['query']['ids']),'SmsAccountId':Number(_0x4adb5f[_0xe2f9('0x5d')]['id'])});}});}})['then'](respondWithStatusCode(_0x377f2c,null))[_0xe2f9('0x5b')](handleError(_0x377f2c,null));};exports[_0xe2f9('0xf2')]=function(_0xab7cd7,_0x3e3820,_0x3ac8aa){var _0xdce340={};var _0x28e040={};var _0x36a19e;var _0x41f20a;return db['SmsAccount'][_0xe2f9('0x6e')]({'where':{'id':_0xab7cd7[_0xe2f9('0x5d')]['id']}})[_0xe2f9('0x22')](handleEntityNotFound(_0x3e3820,null))[_0xe2f9('0x22')](function(_0x1cb287){if(_0x1cb287){_0x36a19e=_0x1cb287;_0x28e040[_0xe2f9('0x45')]=_['keys'](db[_0xe2f9('0xb5')][_0xe2f9('0x42')]);_0x28e040[_0xe2f9('0x48')]=_[_0xe2f9('0x49')](_0xab7cd7[_0xe2f9('0x48')]);_0x28e040[_0xe2f9('0x4a')]=_[_0xe2f9('0x4c')](_0x28e040[_0xe2f9('0x45')],_0x28e040[_0xe2f9('0x48')]);_0xdce340[_0xe2f9('0x4b')]=_[_0xe2f9('0x4c')](_0x28e040['model'],qs[_0xe2f9('0x4d')](_0xab7cd7['query'][_0xe2f9('0x4d')]));_0xdce340[_0xe2f9('0x4b')]=_0xdce340[_0xe2f9('0x4b')][_0xe2f9('0x4e')]?_0xdce340['attributes']:_0x28e040[_0xe2f9('0x45')];_0xdce340[_0xe2f9('0x51')]=qs[_0xe2f9('0x52')](_0xab7cd7['query']['sort']);_0xdce340[_0xe2f9('0x53')]=qs[_0xe2f9('0x4a')](_['pick'](_0xab7cd7[_0xe2f9('0x48')],_0x28e040[_0xe2f9('0x4a')]));if(_0xab7cd7[_0xe2f9('0x48')][_0xe2f9('0x56')]){_0xdce340[_0xe2f9('0x53')]=_['merge'](_0xdce340[_0xe2f9('0x53')],{'$or':_['map'](_0xdce340[_0xe2f9('0x4b')],function(_0x49b466){var _0x57ef84={};_0x57ef84[_0x49b466]={'$like':'%'+_0xab7cd7[_0xe2f9('0x48')][_0xe2f9('0x56')]+'%'};return _0x57ef84;})});}_0xdce340=_[_0xe2f9('0x57')]({},_0xdce340,_0xab7cd7['options']);return _0x36a19e[_0xe2f9('0xf2')](_0xdce340);}})[_0xe2f9('0x22')](function(_0x5bd43b){if(_0x5bd43b){_0x41f20a=_0x5bd43b['length'];if(!_0xab7cd7['query']['hasOwnProperty'](_0xe2f9('0x50'))){_0xdce340[_0xe2f9('0x31')]=qs[_0xe2f9('0x31')](_0xab7cd7[_0xe2f9('0x48')]['limit']);_0xdce340[_0xe2f9('0x33')]=qs[_0xe2f9('0x33')](_0xab7cd7['query'][_0xe2f9('0x33')]);}return _0x36a19e['getAgents'](_0xdce340);}})[_0xe2f9('0x22')](function(_0x2fd63e){if(_0x2fd63e){return _0x2fd63e?{'count':_0x41f20a,'rows':_0x2fd63e}:null;}})[_0xe2f9('0x22')](respondWithResult(_0x3e3820,null))['catch'](handleError(_0x3e3820,null));}; \ No newline at end of file +var _0x0760=['count','Content-Range','apply','reject','save','update','destroy','get','SmsAccounts','UserProfileResource','end','stack','name','send','Pause','map','SmsAccount','rawAttributes','fieldName','type','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','mandatoryDispositionPause','keys','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','SmsAccountId','Disposition','findOne','ids','CannedAnswer','notify','sms','SmsApplication','Applications','orderBy','priority','asc','account','CmContact','Sequelize','ValidationError','no\x20available\x20attributes','difference','createdAt','updatedAt','CompanyId','ListId','twilio','from','Body','messageId','skebby','text','clicksend','plivo','From','Text','MessageUUID','infobip','results','csc','originatingAddress','segmentedMessage','clickatell','replyMessageId','bandwidth','intelepeer','refid','isNil','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmList','DESC','list','omit','Contacts','defaults','contact','spread','created','autoclose','applications','push','unmanaged','*,*,*,*','interaction','SmsMessage','AttachmentId','UserId','User','agent','waitForTheAssignedAgent','Start','startRouting','receiveMessage','SmsAccount,\x20%s,\x20%s,\x20%s','entity\x20found','SmsAccount,\x20%s,\x20%s,\x20%s,\x20%s','set','Content-Type','text/xml','\x0a','addApplications','sequelize','transaction','Transaction','READ_COMMITTED','bulkCreate','finally','getApplications','getInteractions','SmsInteraction','Contact','Owner','fullname','internal','Tag','Tags','tag','List','out','dataValues','Messages','received\x20delivery\x20report\x20from','skebby_dispatch_id','connectel','statusInt','requestid','message_id','status_code','groupName','redif','DELIVERED','error_code','inspect','DELIVERED_TO_GATEWAY','RECEIVED_BY_RECIPIENT','message-delivered','DELIVRD','statusGet','message-id','state','addAgents','emit','userSmsAccount:save','isArray','userSmsAccount:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','lodash','squel','desk.js','querystring','papaparse','../../config/license/hardware','../../config/logger','api','../../config/environment','redis','localhost','socket.io-emitter','register','jayson/promise','http','request','then','info','debug','stringify','error','code','SmsAccount,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','offset','undefined','limit'];(function(_0x365763,_0x5dc192){var _0x503645=function(_0x409390){while(--_0x409390){_0x365763['push'](_0x365763['shift']());}};_0x503645(++_0x5dc192);}(_0x0760,0xb4));var _0x0076=function(_0x35769a,_0x9336c3){_0x35769a=_0x35769a-0x0;var _0x268bef=_0x0760[_0x35769a];return _0x268bef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0076('0x0'));var zipdir=require(_0x0076('0x1'));var jsonpatch=require(_0x0076('0x2'));var rp=require('request-promise');var moment=require(_0x0076('0x3'));var BPromise=require(_0x0076('0x4'));var Mustache=require(_0x0076('0x5'));var util=require(_0x0076('0x6'));var path=require(_0x0076('0x7'));var sox=require(_0x0076('0x8'));var csv=require(_0x0076('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0076('0xa'));var squel=require(_0x0076('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0076('0xc'));var toCsv=require(_0x0076('0x9'));var querystring=require(_0x0076('0xd'));var Papa=require(_0x0076('0xe'));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(_0x0076('0xf'));var logger=require(_0x0076('0x10'))(_0x0076('0x11'));var utils=require('../../config/utils');var config=require(_0x0076('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];config[_0x0076('0x13')]=_['defaults'](config[_0x0076('0x13')],{'host':_0x0076('0x14'),'port':0x18eb});var socket=require(_0x0076('0x15'))(new Redis(config['redis']));require('./smsAccount.socket')[_0x0076('0x16')](socket);var jayson=require(_0x0076('0x17'));var client=jayson['client'][_0x0076('0x18')]({'port':0x232c});function respondWithRpcPromise(_0x198773,_0x35f7d6,_0x574dca,_0x305a55){return new BPromise(function(_0x108ced,_0x5bc26f){var _0x4b1ec9=_0x305a55||client;return _0x4b1ec9[_0x0076('0x19')](_0x198773,_0x574dca)[_0x0076('0x1a')](function(_0x49af55){logger[_0x0076('0x1b')]('SmsAccount,\x20%s,\x20%s',_0x35f7d6,'request\x20sent');logger[_0x0076('0x1c')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x35f7d6,'request\x20sent',JSON[_0x0076('0x1d')](_0x49af55));if(_0x49af55[_0x0076('0x1e')]){if(_0x49af55[_0x0076('0x1e')][_0x0076('0x1f')]===0x1f4){logger[_0x0076('0x1e')](_0x0076('0x20'),_0x35f7d6,_0x49af55[_0x0076('0x1e')][_0x0076('0x21')]);return _0x5bc26f(_0x49af55[_0x0076('0x1e')][_0x0076('0x21')]);}logger['error']('SmsAccount,\x20%s,\x20%s',_0x35f7d6,_0x49af55[_0x0076('0x1e')]['message']);return _0x108ced(_0x49af55[_0x0076('0x1e')]['message']);}else{logger['info'](_0x0076('0x20'),_0x35f7d6,'request\x20sent');_0x108ced(_0x49af55[_0x0076('0x22')][_0x0076('0x21')]);}})[_0x0076('0x23')](function(_0x121bf4){logger['error'](_0x0076('0x20'),_0x35f7d6,_0x121bf4);_0x5bc26f(_0x121bf4);});});}function respondWithStatusCode(_0xd2aaa,_0x9b70ff){_0x9b70ff=_0x9b70ff||0xcc;return function(_0x2e6204){if(_0x2e6204){return _0xd2aaa[_0x0076('0x24')](_0x9b70ff);}return _0xd2aaa[_0x0076('0x25')](_0x9b70ff)['end']();};}function respondWithResult(_0x53a0f2,_0x211a87){_0x211a87=_0x211a87||0xc8;return function(_0x39272d){if(_0x39272d){return _0x53a0f2[_0x0076('0x25')](_0x211a87)[_0x0076('0x26')](_0x39272d);}};}function respondWithFilteredResult(_0x561640,_0x4b60cc){return function(_0x3645a9){if(_0x3645a9){var _0x3b4aab=typeof _0x4b60cc[_0x0076('0x27')]===_0x0076('0x28')&&typeof _0x4b60cc[_0x0076('0x29')]==='undefined';var _0x28e9e8=_0x3645a9[_0x0076('0x2a')];var _0x4d828f=_0x3b4aab?0x0:_0x4b60cc[_0x0076('0x27')];var _0x4af2ed=_0x3b4aab?_0x3645a9[_0x0076('0x2a')]:_0x4b60cc[_0x0076('0x27')]+_0x4b60cc[_0x0076('0x29')];var _0x328ffd;if(_0x4af2ed>=_0x28e9e8){_0x4af2ed=_0x28e9e8;_0x328ffd=0xc8;}else{_0x328ffd=0xce;}_0x561640[_0x0076('0x25')](_0x328ffd);return _0x561640['set'](_0x0076('0x2b'),_0x4d828f+'-'+_0x4af2ed+'/'+_0x28e9e8)[_0x0076('0x26')](_0x3645a9);}return null;};}function patchUpdates(_0x48853d){return function(_0x72583c){try{jsonpatch[_0x0076('0x2c')](_0x72583c,_0x48853d,!![]);}catch(_0x305339){return BPromise[_0x0076('0x2d')](_0x305339);}return _0x72583c[_0x0076('0x2e')]();};}function saveUpdates(_0x592ebb,_0x290f0f){return function(_0x1cbbcc){if(_0x1cbbcc){return _0x1cbbcc[_0x0076('0x2f')](_0x592ebb)[_0x0076('0x1a')](function(_0x143f66){return _0x143f66;});}return null;};}function removeEntity(_0x23d100,_0x43c790){return function(_0x1ae202){if(_0x1ae202){return _0x1ae202[_0x0076('0x30')]()['then'](function(){var _0x3d2eb2=_0x1ae202[_0x0076('0x31')]({'plain':!![]});var _0x1318fa=_0x0076('0x32');return db[_0x0076('0x33')][_0x0076('0x30')]({'where':{'type':_0x1318fa,'resourceId':_0x3d2eb2['id']}})[_0x0076('0x1a')](function(){return _0x1ae202;});})[_0x0076('0x1a')](function(){_0x23d100[_0x0076('0x25')](0xcc)[_0x0076('0x34')]();});}};}function handleEntityNotFound(_0x11f275,_0x1bb639){return function(_0x3eef29){if(!_0x3eef29){_0x11f275[_0x0076('0x24')](0x194);}return _0x3eef29;};}function handleError(_0x51ced9,_0x168ac3){_0x168ac3=_0x168ac3||0x1f4;return function(_0x2358fe){logger[_0x0076('0x1e')](_0x2358fe[_0x0076('0x35')]);if(_0x2358fe['name']){delete _0x2358fe[_0x0076('0x36')];}_0x51ced9['status'](_0x168ac3)[_0x0076('0x37')](_0x2358fe);};}exports['index']=function(_0x1a2e2d,_0x1c52f2){var _0x36b503={'include':[{'model':db[_0x0076('0x38')],'as':'mandatoryDispositionPause'}]},_0x57fbfc={},_0x2647fc={'count':0x0,'rows':[]};var _0x5b5ed0=_[_0x0076('0x39')](db[_0x0076('0x3a')][_0x0076('0x3b')],function(_0x237631){return{'name':_0x237631[_0x0076('0x3c')],'type':_0x237631[_0x0076('0x3d')]['key']};});_0x57fbfc[_0x0076('0x3e')]=_['map'](_0x5b5ed0,_0x0076('0x36'));_0x57fbfc[_0x0076('0x3f')]=_['keys'](_0x1a2e2d[_0x0076('0x3f')]);_0x57fbfc[_0x0076('0x40')]=_[_0x0076('0x41')](_0x57fbfc[_0x0076('0x3e')],_0x57fbfc[_0x0076('0x3f')]);_0x36b503[_0x0076('0x42')]=_[_0x0076('0x41')](_0x57fbfc['model'],qs[_0x0076('0x43')](_0x1a2e2d[_0x0076('0x3f')][_0x0076('0x43')]));_0x36b503[_0x0076('0x42')]=_0x36b503[_0x0076('0x42')][_0x0076('0x44')]?_0x36b503['attributes']:_0x57fbfc['model'];if(!_0x1a2e2d[_0x0076('0x3f')][_0x0076('0x45')](_0x0076('0x46'))){_0x36b503['limit']=qs['limit'](_0x1a2e2d['query'][_0x0076('0x29')]);_0x36b503[_0x0076('0x27')]=qs['offset'](_0x1a2e2d[_0x0076('0x3f')]['offset']);}_0x36b503[_0x0076('0x47')]=qs[_0x0076('0x48')](_0x1a2e2d[_0x0076('0x3f')][_0x0076('0x48')]);_0x36b503[_0x0076('0x49')]=qs[_0x0076('0x40')](_[_0x0076('0x4a')](_0x1a2e2d[_0x0076('0x3f')],_0x57fbfc['filters']),_0x5b5ed0);if(_0x1a2e2d[_0x0076('0x3f')]['filter']){_0x36b503[_0x0076('0x49')]=_[_0x0076('0x4b')](_0x36b503['where'],{'$or':_['map'](_0x5b5ed0,function(_0x56c298){if(_0x56c298[_0x0076('0x3d')]!==_0x0076('0x4c')){var _0x5f44a8={};_0x5f44a8[_0x56c298[_0x0076('0x36')]]={'$like':'%'+_0x1a2e2d['query'][_0x0076('0x4d')]+'%'};return _0x5f44a8;}})});}_0x36b503=_[_0x0076('0x4b')]({},_0x36b503,_0x1a2e2d[_0x0076('0x4e')]);var _0x524e6e={'where':_0x36b503[_0x0076('0x49')]};return db['SmsAccount'][_0x0076('0x2a')](_0x524e6e)[_0x0076('0x1a')](function(_0x3d1505){_0x2647fc[_0x0076('0x2a')]=_0x3d1505;if(_0x1a2e2d[_0x0076('0x3f')][_0x0076('0x4f')]){_0x36b503[_0x0076('0x50')]=[{'all':!![]}];}return db[_0x0076('0x3a')][_0x0076('0x51')](_0x36b503);})[_0x0076('0x1a')](function(_0x37ac96){_0x2647fc[_0x0076('0x52')]=_0x37ac96;return _0x2647fc;})['then'](respondWithFilteredResult(_0x1c52f2,_0x36b503))[_0x0076('0x23')](handleError(_0x1c52f2,null));};exports['show']=function(_0x2bdc51,_0x24c816){var _0x560e00={'raw':![],'where':{'id':_0x2bdc51[_0x0076('0x53')]['id']},'include':[{'model':db['Pause'],'as':_0x0076('0x54')}]},_0x129006={};_0x129006[_0x0076('0x3e')]=_['keys'](db[_0x0076('0x3a')][_0x0076('0x3b')]);_0x129006[_0x0076('0x3f')]=_[_0x0076('0x55')](_0x2bdc51[_0x0076('0x3f')]);_0x129006['filters']=_[_0x0076('0x41')](_0x129006[_0x0076('0x3e')],_0x129006[_0x0076('0x3f')]);_0x560e00['attributes']=_[_0x0076('0x41')](_0x129006['model'],qs[_0x0076('0x43')](_0x2bdc51[_0x0076('0x3f')][_0x0076('0x43')]));_0x560e00[_0x0076('0x42')]=_0x560e00[_0x0076('0x42')][_0x0076('0x44')]?_0x560e00['attributes']:_0x129006[_0x0076('0x3e')];if(_0x2bdc51[_0x0076('0x3f')]['includeAll']){_0x560e00['include']=[{'all':!![]}];}_0x560e00=_['merge']({},_0x560e00,_0x2bdc51['options']);return db[_0x0076('0x3a')][_0x0076('0x56')](_0x560e00)['then'](handleEntityNotFound(_0x24c816,null))[_0x0076('0x1a')](respondWithResult(_0x24c816,null))[_0x0076('0x23')](handleError(_0x24c816,null));};exports[_0x0076('0x57')]=function(_0x5c89cb,_0x3822ae){return db[_0x0076('0x3a')]['create'](_0x5c89cb['body'],{})[_0x0076('0x1a')](function(_0xa7ffa2){var _0x3c45b9=_0x5c89cb['user']['get']({'plain':!![]});if(!_0x3c45b9)throw new Error(_0x0076('0x58'));if(_0x3c45b9[_0x0076('0x59')]===_0x0076('0x5a')){var _0x30b939=_0xa7ffa2['get']({'plain':!![]});var _0x37426c=_0x0076('0x32');return db['UserProfileSection'][_0x0076('0x56')]({'where':{'name':_0x37426c,'userProfileId':_0x3c45b9[_0x0076('0x5b')]},'raw':!![]})['then'](function(_0x17e26){if(_0x17e26&&_0x17e26[_0x0076('0x5c')]===0x0){return db['UserProfileResource'][_0x0076('0x57')]({'name':_0x30b939[_0x0076('0x36')],'resourceId':_0x30b939['id'],'type':_0x17e26[_0x0076('0x36')],'sectionId':_0x17e26['id']},{})['then'](function(){return _0xa7ffa2;});}else{return _0xa7ffa2;}})[_0x0076('0x23')](function(_0x43ea10){logger['error'](_0x0076('0x5d'),_0x43ea10);throw _0x43ea10;});}return _0xa7ffa2;})['then'](respondWithResult(_0x3822ae,0xc9))[_0x0076('0x23')](handleError(_0x3822ae,null));};exports[_0x0076('0x2f')]=function(_0x57954a,_0x1e28b8){if(_0x57954a[_0x0076('0x5e')]['id']){delete _0x57954a[_0x0076('0x5e')]['id'];}return db[_0x0076('0x3a')]['find']({'where':{'id':_0x57954a[_0x0076('0x53')]['id']},'include':[{'model':db[_0x0076('0x38')],'as':_0x0076('0x54')}]})['then'](handleEntityNotFound(_0x1e28b8,null))['then'](saveUpdates(_0x57954a[_0x0076('0x5e')],null))[_0x0076('0x1a')](respondWithResult(_0x1e28b8,null))['catch'](handleError(_0x1e28b8,null));};exports[_0x0076('0x30')]=function(_0x26c4c9,_0x336e55){return db[_0x0076('0x3a')][_0x0076('0x56')]({'where':{'id':_0x26c4c9[_0x0076('0x53')]['id']}})[_0x0076('0x1a')](handleEntityNotFound(_0x336e55,null))[_0x0076('0x1a')](removeEntity(_0x336e55,null))[_0x0076('0x23')](handleError(_0x336e55,null));};exports['describe']=function(_0xf7c6a4,_0x49482d){return db[_0x0076('0x3a')][_0x0076('0x5f')]()[_0x0076('0x1a')](respondWithResult(_0x49482d,null))[_0x0076('0x23')](handleError(_0x49482d,null));};exports['addDisposition']=function(_0x2643fa,_0x4af1fe,_0x1a910f){if(_0x2643fa[_0x0076('0x5e')]['id']){delete _0x2643fa[_0x0076('0x5e')]['id'];}return db[_0x0076('0x3a')][_0x0076('0x56')]({'where':{'id':_0x2643fa['params']['id']}})[_0x0076('0x1a')](handleEntityNotFound(_0x4af1fe,null))['then'](function(_0x59a319){if(_0x59a319){_0x2643fa[_0x0076('0x5e')][_0x0076('0x60')]=_0x59a319['id'];return db[_0x0076('0x61')][_0x0076('0x57')](_0x2643fa['body']);}})[_0x0076('0x1a')](respondWithResult(_0x4af1fe,null))['catch'](handleError(_0x4af1fe,null));};exports['getDispositions']=function(_0x25a390,_0x424794,_0x22ee6f){var _0x47cee4={'raw':![],'where':{}};var _0x3fbeef={};var _0x2e2b4b={'count':0x0,'rows':[]};return db[_0x0076('0x3a')][_0x0076('0x62')]({'where':{'id':_0x25a390[_0x0076('0x53')]['id']}})['then'](handleEntityNotFound(_0x424794,null))[_0x0076('0x1a')](function(_0x36ea88){if(_0x36ea88){_0x3fbeef['model']=_[_0x0076('0x55')](db[_0x0076('0x61')][_0x0076('0x3b')]);_0x3fbeef['query']=_[_0x0076('0x55')](_0x25a390['query']);_0x3fbeef[_0x0076('0x40')]=_['intersection'](_0x3fbeef[_0x0076('0x3e')],_0x3fbeef[_0x0076('0x3f')]);_0x47cee4[_0x0076('0x42')]=_[_0x0076('0x41')](_0x3fbeef[_0x0076('0x3e')],qs['fields'](_0x25a390[_0x0076('0x3f')]['fields']));_0x47cee4[_0x0076('0x42')]=_0x47cee4['attributes'][_0x0076('0x44')]?_0x47cee4[_0x0076('0x42')]:_0x3fbeef[_0x0076('0x3e')];if(!_0x25a390[_0x0076('0x3f')][_0x0076('0x45')](_0x0076('0x46'))){_0x47cee4[_0x0076('0x29')]=qs[_0x0076('0x29')](_0x25a390[_0x0076('0x3f')][_0x0076('0x29')]);_0x47cee4['offset']=qs[_0x0076('0x27')](_0x25a390[_0x0076('0x3f')][_0x0076('0x27')]);}_0x47cee4[_0x0076('0x47')]=qs[_0x0076('0x48')](_0x25a390['query'][_0x0076('0x48')]);_0x47cee4['where']=qs['filters'](_['pick'](_0x25a390[_0x0076('0x3f')],_0x3fbeef[_0x0076('0x40')]));_0x47cee4[_0x0076('0x49')][_0x0076('0x60')]=_0x36ea88['id'];if(_0x25a390[_0x0076('0x3f')][_0x0076('0x4d')]){_0x47cee4[_0x0076('0x49')]=_['merge'](_0x47cee4[_0x0076('0x49')],{'$or':_[_0x0076('0x39')](_0x47cee4['attributes'],function(_0x256e1f){var _0x554c5f={};_0x554c5f[_0x256e1f]={'$like':'%'+_0x25a390[_0x0076('0x3f')]['filter']+'%'};return _0x554c5f;})});}_0x47cee4=_[_0x0076('0x4b')]({},_0x47cee4,_0x25a390['options']);return db[_0x0076('0x61')]['count']({'where':_0x47cee4['where']})[_0x0076('0x1a')](function(_0x4daaa1){_0x2e2b4b[_0x0076('0x2a')]=_0x4daaa1;if(_0x25a390[_0x0076('0x3f')]['includeAll']){_0x47cee4['include']=[{'all':!![]}];}return db[_0x0076('0x61')]['findAll'](_0x47cee4);})['then'](function(_0x22944b){_0x2e2b4b[_0x0076('0x52')]=_0x22944b;return _0x2e2b4b;});}})['then'](respondWithFilteredResult(_0x424794,_0x47cee4))[_0x0076('0x23')](handleError(_0x424794,null));};exports['removeDispositions']=function(_0x1f0d01,_0x4268a5,_0x199cd9){return db[_0x0076('0x3a')][_0x0076('0x56')]({'where':{'id':_0x1f0d01[_0x0076('0x53')]['id']}})[_0x0076('0x1a')](handleEntityNotFound(_0x4268a5,null))['then'](function(_0x2cb26a){if(_0x2cb26a){return _0x2cb26a['removeDispositions'](_0x1f0d01[_0x0076('0x3f')][_0x0076('0x63')]);}})['then'](respondWithStatusCode(_0x4268a5,null))[_0x0076('0x23')](handleError(_0x4268a5,null));};exports['addAnswer']=function(_0x2e54ee,_0xc22b97,_0xc4bfcf){if(_0x2e54ee[_0x0076('0x5e')]['id']){delete _0x2e54ee[_0x0076('0x5e')]['id'];}return db[_0x0076('0x3a')]['find']({'where':{'id':_0x2e54ee['params']['id']}})['then'](handleEntityNotFound(_0xc22b97,null))[_0x0076('0x1a')](function(_0x38c231){if(_0x38c231){_0x2e54ee['body']['SmsAccountId']=_0x38c231['id'];return db[_0x0076('0x64')]['create'](_0x2e54ee[_0x0076('0x5e')]);}})[_0x0076('0x1a')](respondWithResult(_0xc22b97,null))['catch'](handleError(_0xc22b97,null));};exports['getAnswers']=function(_0x598c0c,_0x7cae8e,_0x3386ac){var _0x5db308={'raw':![],'where':{}};var _0x196332={};var _0x432c6d={'count':0x0,'rows':[]};return db['SmsAccount'][_0x0076('0x62')]({'where':{'id':_0x598c0c['params']['id']}})['then'](handleEntityNotFound(_0x7cae8e,null))[_0x0076('0x1a')](function(_0x451ccb){if(_0x451ccb){_0x196332[_0x0076('0x3e')]=_[_0x0076('0x55')](db[_0x0076('0x64')][_0x0076('0x3b')]);_0x196332[_0x0076('0x3f')]=_[_0x0076('0x55')](_0x598c0c[_0x0076('0x3f')]);_0x196332[_0x0076('0x40')]=_['intersection'](_0x196332[_0x0076('0x3e')],_0x196332[_0x0076('0x3f')]);_0x5db308[_0x0076('0x42')]=_[_0x0076('0x41')](_0x196332[_0x0076('0x3e')],qs[_0x0076('0x43')](_0x598c0c[_0x0076('0x3f')][_0x0076('0x43')]));_0x5db308[_0x0076('0x42')]=_0x5db308[_0x0076('0x42')][_0x0076('0x44')]?_0x5db308[_0x0076('0x42')]:_0x196332[_0x0076('0x3e')];if(!_0x598c0c[_0x0076('0x3f')][_0x0076('0x45')](_0x0076('0x46'))){_0x5db308[_0x0076('0x29')]=qs['limit'](_0x598c0c[_0x0076('0x3f')][_0x0076('0x29')]);_0x5db308['offset']=qs[_0x0076('0x27')](_0x598c0c[_0x0076('0x3f')][_0x0076('0x27')]);}_0x5db308[_0x0076('0x47')]=qs[_0x0076('0x48')](_0x598c0c[_0x0076('0x3f')][_0x0076('0x48')]);_0x5db308['where']=qs['filters'](_[_0x0076('0x4a')](_0x598c0c['query'],_0x196332[_0x0076('0x40')]));_0x5db308[_0x0076('0x49')][_0x0076('0x60')]=_0x451ccb['id'];if(_0x598c0c[_0x0076('0x3f')][_0x0076('0x4d')]){_0x5db308[_0x0076('0x49')]=_[_0x0076('0x4b')](_0x5db308[_0x0076('0x49')],{'$or':_[_0x0076('0x39')](_0x5db308[_0x0076('0x42')],function(_0x2d6f15){var _0x3eca72={};_0x3eca72[_0x2d6f15]={'$like':'%'+_0x598c0c['query']['filter']+'%'};return _0x3eca72;})});}_0x5db308=_[_0x0076('0x4b')]({},_0x5db308,_0x598c0c['options']);return db[_0x0076('0x64')][_0x0076('0x2a')]({'where':_0x5db308[_0x0076('0x49')]})['then'](function(_0xfe8f2c){_0x432c6d[_0x0076('0x2a')]=_0xfe8f2c;if(_0x598c0c['query'][_0x0076('0x4f')]){_0x5db308[_0x0076('0x50')]=[{'all':!![]}];}return db[_0x0076('0x64')][_0x0076('0x51')](_0x5db308);})[_0x0076('0x1a')](function(_0x3a3f62){_0x432c6d[_0x0076('0x52')]=_0x3a3f62;return _0x432c6d;});}})['then'](respondWithFilteredResult(_0x7cae8e,_0x5db308))[_0x0076('0x23')](handleError(_0x7cae8e,null));};exports['removeAnswers']=function(_0x2a78ac,_0x4c7e62,_0xa07843){return db['SmsAccount'][_0x0076('0x56')]({'where':{'id':_0x2a78ac[_0x0076('0x53')]['id']}})['then'](handleEntityNotFound(_0x4c7e62,null))[_0x0076('0x1a')](function(_0x5887ee){if(_0x5887ee){return _0x5887ee['removeAnswers'](_0x2a78ac['query']['ids']);}})[_0x0076('0x1a')](respondWithStatusCode(_0x4c7e62,null))['catch'](handleError(_0x4c7e62,null));};exports[_0x0076('0x65')]=function(_0x49ad22,_0x36ac23,_0x557730){var _0x585096={'channel':_0x0076('0x66')};var _0x22e554=[];var _0x5dd189=[];var _0x139990={};return db[_0x0076('0x3a')][_0x0076('0x56')]({'where':{'id':_0x49ad22[_0x0076('0x53')]['id']},'include':[{'model':db[_0x0076('0x67')],'as':_0x0076('0x68')}]})['then'](handleEntityNotFound(_0x36ac23,null))[_0x0076('0x1a')](function(_0x100ad5){_0x585096['account']=_0x100ad5;_0x585096['applications']=_[_0x0076('0x69')](_0x100ad5[_0x0076('0x68')],[_0x0076('0x6a')],[_0x0076('0x6b')]);if(_0x585096[_0x0076('0x6c')][_0x0076('0x68')]){delete _0x585096['account'][_0x0076('0x68')];}return db[_0x0076('0x6d')][_0x0076('0x5f')]();})['then'](function(_0x49f185){if(!_0x49f185){throw new db[(_0x0076('0x6e'))][(_0x0076('0x6f'))](_0x0076('0x70'));}_0x22e554=_[_0x0076('0x71')](_[_0x0076('0x55')](_0x49f185),[_0x0076('0x72'),_0x0076('0x73')]);_0x5dd189=_[_0x0076('0x71')](_['keys'](_0x49f185),[_0x0076('0x72'),_0x0076('0x73'),_0x0076('0x74'),_0x0076('0x75')]);_0x585096['body']={'mapKey':'mobile'};if(_0x585096['account'][_0x0076('0x3d')]){switch(_0x585096[_0x0076('0x6c')][_0x0076('0x3d')]){case _0x0076('0x76'):_0x585096[_0x0076('0x5e')][_0x0076('0x77')]=_0x49ad22[_0x0076('0x5e')]['From'];_0x585096[_0x0076('0x5e')][_0x0076('0x5e')]=_0x49ad22[_0x0076('0x5e')][_0x0076('0x78')];_0x585096[_0x0076('0x5e')][_0x0076('0x79')]=_0x49ad22[_0x0076('0x5e')]['MessageSid'];break;case _0x0076('0x7a'):_0x585096[_0x0076('0x5e')][_0x0076('0x77')]='+'+_0x49ad22[_0x0076('0x5e')]['sender'];_0x585096[_0x0076('0x5e')]['body']=_0x49ad22[_0x0076('0x5e')][_0x0076('0x7b')];break;case'connectel':_0x585096[_0x0076('0x5e')][_0x0076('0x77')]=_0x49ad22[_0x0076('0x5e')][_0x0076('0x77')];_0x585096[_0x0076('0x5e')]['body']=_0x49ad22['body'][_0x0076('0x21')];break;case _0x0076('0x7c'):_0x585096[_0x0076('0x5e')][_0x0076('0x77')]=_0x49ad22[_0x0076('0x5e')][_0x0076('0x77')];_0x585096['body'][_0x0076('0x5e')]=_0x49ad22[_0x0076('0x5e')][_0x0076('0x5e')];_0x585096[_0x0076('0x5e')][_0x0076('0x79')]=_0x49ad22[_0x0076('0x5e')]['message_id'];break;case _0x0076('0x7d'):_0x585096[_0x0076('0x5e')][_0x0076('0x77')]=_0x49ad22[_0x0076('0x5e')][_0x0076('0x7e')];_0x585096['body'][_0x0076('0x5e')]=_0x49ad22[_0x0076('0x5e')][_0x0076('0x7f')];_0x585096[_0x0076('0x5e')][_0x0076('0x79')]=_0x49ad22[_0x0076('0x5e')][_0x0076('0x80')];break;case _0x0076('0x81'):_0x585096[_0x0076('0x5e')][_0x0076('0x77')]='+'+_0x49ad22[_0x0076('0x5e')][_0x0076('0x82')][0x0][_0x0076('0x77')];_0x585096[_0x0076('0x5e')][_0x0076('0x5e')]=_0x49ad22['body'][_0x0076('0x82')][0x0][_0x0076('0x7b')];_0x585096['body'][_0x0076('0x79')]=_0x49ad22[_0x0076('0x5e')][_0x0076('0x82')][0x0][_0x0076('0x79')];break;case _0x0076('0x83'):_0x585096['body'][_0x0076('0x77')]=_0x49ad22[_0x0076('0x5e')][_0x0076('0x84')];_0x585096[_0x0076('0x5e')][_0x0076('0x5e')]=_0x49ad22[_0x0076('0x5e')][_0x0076('0x85')][_0x0076('0x21')];break;case _0x0076('0x86'):_0x585096['body']['from']=_0x49ad22[_0x0076('0x5e')]['fromNumber'];_0x585096['body']['body']=_0x49ad22['body']['text'];_0x585096[_0x0076('0x5e')]['messageId']=_0x49ad22['body'][_0x0076('0x87')];break;case _0x0076('0x88'):_0x585096[_0x0076('0x5e')][_0x0076('0x79')]=_0x49ad22[_0x0076('0x5e')][0x0][_0x0076('0x21')]['id'];_0x585096[_0x0076('0x5e')][_0x0076('0x77')]=_0x49ad22[_0x0076('0x5e')][0x0]['message'][_0x0076('0x77')];_0x585096[_0x0076('0x5e')][_0x0076('0x5e')]=_0x49ad22[_0x0076('0x5e')][0x0]['message'][_0x0076('0x7b')];break;case _0x0076('0x89'):_0x585096[_0x0076('0x5e')]['from']=_0x49ad22['body'][_0x0076('0x77')];_0x585096[_0x0076('0x5e')][_0x0076('0x5e')]=_0x49ad22[_0x0076('0x5e')][_0x0076('0x21')];_0x585096[_0x0076('0x5e')][_0x0076('0x79')]=_0x49ad22[_0x0076('0x5e')][_0x0076('0x8a')];break;}}if(_0x585096[_0x0076('0x5e')]['id']){delete _0x585096[_0x0076('0x5e')]['id'];}if(_[_0x0076('0x8b')](_0x585096['body'][_0x0076('0x77')])){throw new db[(_0x0076('0x6e'))][(_0x0076('0x6f'))]('from\x20is\x20mandatory');}if(_[_0x0076('0x8b')](_0x585096[_0x0076('0x5e')][_0x0076('0x5e')])||_0x585096[_0x0076('0x5e')][_0x0076('0x5e')]===''){throw new db[(_0x0076('0x6e'))]['ValidationError'](_0x0076('0x8c'));}if(_['isNil'](_0x585096[_0x0076('0x5e')][_0x0076('0x8d')])){throw new db[(_0x0076('0x6e'))][(_0x0076('0x6f'))](_0x0076('0x8e')+_0x5dd189);}if(!_[_0x0076('0x8f')](_0x5dd189,_0x585096[_0x0076('0x5e')]['mapKey'])){throw new db['Sequelize'][(_0x0076('0x6f'))](_0x0076('0x90')+_0x5dd189);}_0x139990[_0x585096[_0x0076('0x5e')][_0x0076('0x8d')]]=_0x585096['body'][_0x0076('0x77')];return db[_0x0076('0x91')][_0x0076('0x56')]({'where':{'id':_0x585096[_0x0076('0x6c')][_0x0076('0x75')]},'include':[{'model':db[_0x0076('0x6d')],'as':'Contacts','where':_0x139990,'limit':0x1,'order':[[_0x0076('0x73'),_0x0076('0x92')]]}]});})[_0x0076('0x1a')](handleEntityNotFound(_0x36ac23,null))[_0x0076('0x1a')](function(_0x22e12b){if(_0x22e12b){_0x585096[_0x0076('0x93')]=_[_0x0076('0x94')](_0x22e12b,[_0x0076('0x95')]);if(_0x22e12b[_0x0076('0x95')][_0x0076('0x44')]){return _0x22e12b[_0x0076('0x95')][0x0];}var _0x44655f=_[_0x0076('0x96')](_0x585096[_0x0076('0x5e')],{'firstName':_0x585096['body'][_0x0076('0x77')],'ListId':_0x22e12b['id']});_0x44655f[_0x585096[_0x0076('0x5e')][_0x0076('0x8d')]]=_0x585096[_0x0076('0x5e')][_0x0076('0x77')];return db[_0x0076('0x6d')]['create'](_0x44655f,{'fields':_0x22e554,'raw':!![]});}})[_0x0076('0x1a')](handleEntityNotFound(_0x36ac23,null))[_0x0076('0x1a')](function(_0x52a92e){if(_0x52a92e){_0x585096[_0x0076('0x97')]=_0x52a92e;var _0x58e44a={'ContactId':_0x52a92e['id'],'phone':_0x585096['body'][_0x0076('0x77')],'SmsAccountId':_0x49ad22[_0x0076('0x53')]['id']};var _0x37a1d8={'ContactId':_0x52a92e['id'],'SmsAccountId':_0x49ad22[_0x0076('0x53')]['id'],'closed':![]};return db['SmsInteraction'][_0x0076('0x56')]({'where':_0x37a1d8})['then'](function(_0x3627ae){if(_0x3627ae){return[_0x3627ae,![]];}return db['SmsInteraction'][_0x0076('0x57')](_0x58e44a)[_0x0076('0x1a')](function(_0x5255eb){return[_0x5255eb,!![]];});});}})[_0x0076('0x98')](function(_0x38cad4,_0x52c751){_0x585096['interaction']=_0x38cad4[_0x0076('0x31')]({'plain':!![]});_0x585096['interaction'][_0x0076('0x99')]=![];if(_0x52c751){if(_0x585096['account'][_0x0076('0x9a')]){_0x585096[_0x0076('0x9b')][_0x0076('0x9c')]({'id':0x0,'priority':_0x585096[_0x0076('0x9b')]['length']+0x1,'app':'close','appdata':_0x0076('0x9d'),'interval':_0x0076('0x9e')});}_0x585096[_0x0076('0x9f')][_0x0076('0x99')]=!![];}return db[_0x0076('0xa0')][_0x0076('0x57')]({'phone':_0x585096['body']['from'],'messageId':_0x585096[_0x0076('0x5e')][_0x0076('0x79')],'body':_0x585096[_0x0076('0x5e')][_0x0076('0x5e')],'SmsAccountId':_0x49ad22[_0x0076('0x53')]['id'],'SmsInteractionId':_0x38cad4['id'],'direction':'in','ContactId':_0x38cad4['ContactId'],'AttachmentId':_0x585096['body'][_0x0076('0xa1')]});})[_0x0076('0x1a')](function(_0x557402){_0x585096[_0x0076('0x21')]=_0x557402;if(_0x585096[_0x0076('0x9f')][_0x0076('0xa2')]){return db[_0x0076('0xa3')][_0x0076('0x56')]({'attributes':['id',_0x0076('0x36')],'where':{'id':_0x585096[_0x0076('0x9f')]['UserId']}})[_0x0076('0x1a')](function(_0x3fc797){if(_0x3fc797){_0x585096[_0x0076('0x9b')]['unshift']({'id':0x0,'priority':0x0,'app':_0x0076('0xa4'),'appdata':_0x3fc797[_0x0076('0x36')]+','+(_0x585096[_0x0076('0x6c')][_0x0076('0xa5')]||0xa),'interval':'*,*,*,*'});}return respondWithRpcPromise(_0x0076('0xa6'),_0x0076('0xa7'),_0x585096);});}return respondWithRpcPromise(_0x0076('0xa6'),_0x0076('0xa7'),_0x585096);})[_0x0076('0x1a')](function(_0x47405f){if(_0x47405f){var _0x40715c=0xc8;var _0x2f5207=_0x0076('0xa8');logger['info'](_0x0076('0xa9'),_0x2f5207,_0x40715c,_0x0076('0xaa'));logger[_0x0076('0x1c')](_0x0076('0xab'),_0x2f5207,_0x40715c,_0x0076('0xaa'),JSON[_0x0076('0x1d')](_0x47405f));if(_0x585096[_0x0076('0x6c')][_0x0076('0x3d')]===_0x0076('0x76')){return _0x36ac23[_0x0076('0x25')](_0x40715c)[_0x0076('0xac')](_0x0076('0xad'),_0x0076('0xae'))['send'](_0x0076('0xaf'));}else{return _0x36ac23[_0x0076('0x25')](_0x40715c)[_0x0076('0x26')](_0x47405f);}}})[_0x0076('0x23')](handleError(_0x36ac23,null));};exports[_0x0076('0xb0')]=function(_0x33a012,_0x13d490){var _0x638d83=_0x33a012[_0x0076('0x53')]['id'];var _0x435b76=_0x33a012[_0x0076('0x5e')];var _0xff5dee=0xc8;var _0x391014=null;return db[_0x0076('0xb1')][_0x0076('0xb2')]({'isolationLevel':db[_0x0076('0xb1')][_0x0076('0xb3')]['ISOLATION_LEVELS'][_0x0076('0xb4')]},function(_0x28d58a){return db[_0x0076('0x3a')][_0x0076('0x62')]({'where':{'id':_0x638d83},'transaction':_0x28d58a})[_0x0076('0x1a')](function(_0x3341a2){if(_0x3341a2){return db[_0x0076('0x67')][_0x0076('0x30')]({'where':{'SmsAccountId':_0x638d83},'transaction':_0x28d58a})[_0x0076('0x1a')](function(){var _0x10ba5a=_[_0x0076('0x39')](_0x435b76,function(_0x362d06){_0x362d06[_0x0076('0x60')]=_0x638d83;return _0x362d06;});return db[_0x0076('0x67')][_0x0076('0xb5')](_0x10ba5a,{'transaction':_0x28d58a});});}else{_0xff5dee=0x194;_0x391014=[];}});})[_0x0076('0x1a')](function(){if(_0xff5dee!==0x194){return db['SmsApplication']['findAndCountAll']({'where':{'SmsAccountId':_0x638d83},'order':_0x0076('0x6a')})[_0x0076('0x1a')](function(_0x54d350){_0x391014=_0x54d350;});}})['catch'](function(_0x833d09){_0xff5dee=0x1f4;logger[_0x0076('0x1e')](_0x833d09[_0x0076('0x35')]);if(_0x833d09['name']){delete _0x833d09['name'];}_0x391014=_0x833d09;})[_0x0076('0xb6')](function(){if(_0x391014===null){_0x13d490[_0x0076('0x24')](_0xff5dee);}else{if(_0xff5dee===0x1f4){_0x13d490[_0x0076('0x25')](_0xff5dee)['send'](_0x391014);}else{_0x13d490[_0x0076('0x25')](_0xff5dee)[_0x0076('0x26')](_0x391014);}}});};exports[_0x0076('0xb7')]=function(_0x3e9c70,_0x179674,_0x2c1c73){var _0x328167={};var _0x5f2900={};var _0x161167;var _0x5a901c;return db[_0x0076('0x3a')][_0x0076('0x62')]({'where':{'id':_0x3e9c70[_0x0076('0x53')]['id']}})['then'](handleEntityNotFound(_0x179674,null))[_0x0076('0x1a')](function(_0x1cdf99){if(_0x1cdf99){_0x161167=_0x1cdf99;_0x5f2900[_0x0076('0x3e')]=_[_0x0076('0x55')](db[_0x0076('0x67')][_0x0076('0x3b')]);_0x5f2900[_0x0076('0x3f')]=_[_0x0076('0x55')](_0x3e9c70[_0x0076('0x3f')]);_0x5f2900[_0x0076('0x40')]=_[_0x0076('0x41')](_0x5f2900['model'],_0x5f2900['query']);_0x328167['attributes']=_[_0x0076('0x41')](_0x5f2900['model'],qs['fields'](_0x3e9c70['query']['fields']));_0x328167['attributes']=_0x328167['attributes'][_0x0076('0x44')]?_0x328167['attributes']:_0x5f2900['model'];_0x328167[_0x0076('0x47')]=qs[_0x0076('0x48')](_0x3e9c70[_0x0076('0x3f')][_0x0076('0x48')]);_0x328167[_0x0076('0x49')]=qs['filters'](_['pick'](_0x3e9c70[_0x0076('0x3f')],_0x5f2900[_0x0076('0x40')]));if(_0x3e9c70[_0x0076('0x3f')][_0x0076('0x4d')]){_0x328167[_0x0076('0x49')]=_[_0x0076('0x4b')](_0x328167['where'],{'$or':_['map'](_0x328167[_0x0076('0x42')],function(_0x4ce438){var _0x5637b7={};_0x5637b7[_0x4ce438]={'$like':'%'+_0x3e9c70[_0x0076('0x3f')]['filter']+'%'};return _0x5637b7;})});}_0x328167=_[_0x0076('0x4b')]({},_0x328167,_0x3e9c70['options']);return _0x161167[_0x0076('0xb7')](_0x328167);}})[_0x0076('0x1a')](function(_0x2c092c){if(_0x2c092c){_0x5a901c=_0x2c092c[_0x0076('0x44')];if(!_0x3e9c70[_0x0076('0x3f')][_0x0076('0x45')](_0x0076('0x46'))){_0x328167[_0x0076('0x29')]=qs[_0x0076('0x29')](_0x3e9c70[_0x0076('0x3f')][_0x0076('0x29')]);_0x328167[_0x0076('0x27')]=qs[_0x0076('0x27')](_0x3e9c70[_0x0076('0x3f')][_0x0076('0x27')]);}return _0x161167[_0x0076('0xb7')](_0x328167);}})['then'](function(_0x3cbb69){if(_0x3cbb69){return _0x3cbb69?{'count':_0x5a901c,'rows':_0x3cbb69}:null;}})[_0x0076('0x1a')](respondWithResult(_0x179674,null))[_0x0076('0x23')](handleError(_0x179674,null));};exports[_0x0076('0xb8')]=function(_0x25fdcb,_0xe2a536,_0xbd47c2){var _0x1b0824={'raw':![],'where':{}};var _0x492716={};var _0x4ba8dc={'count':0x0,'rows':[]};return db[_0x0076('0x3a')]['findOne']({'where':{'id':_0x25fdcb[_0x0076('0x53')]['id']}})[_0x0076('0x1a')](handleEntityNotFound(_0xe2a536,null))['then'](function(_0x4f2714){if(_0x4f2714){_0x492716['model']=_['keys'](db['SmsInteraction'][_0x0076('0x3b')]);_0x492716[_0x0076('0x3f')]=_[_0x0076('0x55')](_0x25fdcb[_0x0076('0x3f')]);_0x492716[_0x0076('0x40')]=_[_0x0076('0x41')](_0x492716[_0x0076('0x3e')],_0x492716[_0x0076('0x3f')]);_0x1b0824[_0x0076('0x42')]=_[_0x0076('0x41')](_0x492716[_0x0076('0x3e')],qs[_0x0076('0x43')](_0x25fdcb['query'][_0x0076('0x43')]));_0x1b0824[_0x0076('0x42')]=_0x1b0824[_0x0076('0x42')]['length']?_0x1b0824[_0x0076('0x42')]:_0x492716[_0x0076('0x3e')];if(!_0x25fdcb[_0x0076('0x3f')]['hasOwnProperty'](_0x0076('0x46'))){_0x1b0824['limit']=qs['limit'](_0x25fdcb[_0x0076('0x3f')]['limit']);_0x1b0824[_0x0076('0x27')]=qs[_0x0076('0x27')](_0x25fdcb[_0x0076('0x3f')]['offset']);}_0x1b0824[_0x0076('0x47')]=qs[_0x0076('0x48')](_0x25fdcb[_0x0076('0x3f')][_0x0076('0x48')]);_0x1b0824[_0x0076('0x49')]=qs[_0x0076('0x40')](_[_0x0076('0x4a')](_0x25fdcb[_0x0076('0x3f')],_0x492716[_0x0076('0x40')]));_0x1b0824[_0x0076('0x49')][_0x0076('0x60')]=_0x4f2714['id'];if(_0x25fdcb[_0x0076('0x3f')][_0x0076('0x4d')]){_0x1b0824[_0x0076('0x49')]=_['merge'](_0x1b0824[_0x0076('0x49')],{'$or':_[_0x0076('0x39')](_0x1b0824[_0x0076('0x42')],function(_0x57488c){var _0x30610c={};_0x30610c[_0x57488c]={'$like':'%'+_0x25fdcb[_0x0076('0x3f')][_0x0076('0x4d')]+'%'};return _0x30610c;})});}_0x1b0824=_[_0x0076('0x4b')]({},_0x1b0824,_0x25fdcb['options']);return db[_0x0076('0xb9')]['count']({'where':_0x1b0824[_0x0076('0x49')]})[_0x0076('0x1a')](function(_0x18ba37){_0x4ba8dc[_0x0076('0x2a')]=_0x18ba37;if(_0x25fdcb['query'][_0x0076('0x4f')]){_0x1b0824[_0x0076('0x50')]=[{'model':db[_0x0076('0x6d')],'as':_0x0076('0xba'),'required':![]},{'model':db[_0x0076('0xa3')],'as':_0x0076('0xbb'),'attributes':[_0x0076('0x36'),_0x0076('0xbc'),_0x0076('0xbd')],'required':![]},{'model':db[_0x0076('0xbe')],'as':_0x0076('0xbf'),'attributes':['id','name','color'],'where':_0x25fdcb[_0x0076('0x3f')][_0x0076('0xc0')]?{'id':_0x25fdcb[_0x0076('0x3f')][_0x0076('0xc0')]}:undefined,'required':_0x25fdcb[_0x0076('0x3f')]['tag']?!![]:![]}];}return db[_0x0076('0xb9')]['findAll'](_0x1b0824);})[_0x0076('0x1a')](function(_0x3d1953){_0x4ba8dc['rows']=_0x3d1953;return _0x4ba8dc;});}})[_0x0076('0x1a')](respondWithFilteredResult(_0xe2a536,_0x1b0824))['catch'](handleError(_0xe2a536,null));};exports['send']=function(_0x1c1e4d,_0x40f7a5,_0x33532f){var _0x2dbc7d,_0xa4ebfa,_0x20886f;if(_['isNil'](_0x1c1e4d['body'][_0x0076('0x5e')])||_0x1c1e4d['body'][_0x0076('0x5e')]===''){throw new db[(_0x0076('0x6e'))]['ValidationError'](_0x0076('0x8c'));}if(_['isNil'](_0x1c1e4d[_0x0076('0x5e')]['to'])){throw new db[(_0x0076('0x6e'))][(_0x0076('0x6f'))]('to\x20is\x20mandatory');}_0x2dbc7d=_0x1c1e4d[_0x0076('0x5e')]['to'];return db[_0x0076('0x3a')][_0x0076('0x56')]({'where':{'id':_0x1c1e4d[_0x0076('0x53')]['id']},'include':[{'model':db[_0x0076('0x91')],'as':_0x0076('0xc1'),'include':[{'model':db[_0x0076('0x6d')],'as':_0x0076('0x95'),'where':{'mobile':_0x2dbc7d},'limit':0x1,'order':[[_0x0076('0x73'),_0x0076('0x92')]]}]}]})[_0x0076('0x1a')](handleEntityNotFound(_0x40f7a5,null))[_0x0076('0x1a')](function(_0x256f99){if(_0x256f99&&_0x256f99[_0x0076('0xc1')]){_0xa4ebfa=_0x256f99[_0x0076('0x31')]({'plain':!![]});if(_0xa4ebfa['List']&&_0xa4ebfa[_0x0076('0xc1')]['Contacts']['length']){return _0xa4ebfa[_0x0076('0xc1')][_0x0076('0x95')][0x0];}return db[_0x0076('0x6d')][_0x0076('0x57')](_[_0x0076('0x96')](_0x1c1e4d['body'],{'firstName':_0x2dbc7d,'mobile':_0x2dbc7d,'phone':_0x2dbc7d,'ListId':_0xa4ebfa['ListId']}));}})[_0x0076('0x1a')](handleEntityNotFound(_0x40f7a5,null))[_0x0076('0x1a')](function(_0x8b6b03){if(_0x8b6b03){_0x20886f=_0x8b6b03;return db[_0x0076('0xb9')]['find']({'where':{'ContactId':_0x20886f['id'],'closed':![],'SmsAccountId':_0xa4ebfa['id']}})[_0x0076('0x1a')](function(_0x207b4d){if(_0x207b4d){return[_0x207b4d,![]];}return db['SmsInteraction'][_0x0076('0x57')]({'UserId':_0x1c1e4d['user']['id'],'ContactId':_0x20886f['id'],'SmsAccountId':_0xa4ebfa['id'],'phone':_0x2dbc7d,'firstMsgDirection':_0x0076('0xc2'),'Messages':[_[_0x0076('0x4b')](_0x1c1e4d[_0x0076('0x5e')],{'read':![],'body':_0x1c1e4d['body'][_0x0076('0x5e')],'phone':_0x2dbc7d,'SmsAccountId':_0xa4ebfa['id'],'UserId':_0x1c1e4d['user']['id'],'ContactId':_0x20886f['id']})]},{'include':[{'model':db['SmsMessage'],'as':'Messages'}]})[_0x0076('0x1a')](function(_0x4316c0){return[_0x4316c0,!![]];});});}})[_0x0076('0x98')](function(_0x224414,_0x512f98){if(_0x512f98){return _0x224414;}return db[_0x0076('0xa0')][_0x0076('0x57')](_['merge'](_0x1c1e4d[_0x0076('0x5e')],{'read':![],'body':_0x1c1e4d[_0x0076('0x5e')][_0x0076('0x5e')],'phone':_0x2dbc7d,'SmsAccountId':_0xa4ebfa['id'],'SmsInteractionId':_0x224414['id'],'UserId':_0x1c1e4d[_0x0076('0x5a')]['id'],'ContactId':_0x20886f['id']}))[_0x0076('0x1a')](function(_0x588678){_0x224414[_0x0076('0xc3')][_0x0076('0xc4')]=[];_0x224414[_0x0076('0xc3')][_0x0076('0xc4')]['push'](_0x588678['dataValues']);return _0x224414;});})[_0x0076('0x1a')](respondWithResult(_0x40f7a5,null))[_0x0076('0x23')](handleError(_0x40f7a5,null));};exports[_0x0076('0x25')]=function(_0x546662,_0x314c14,_0x46e3c7){if(_0x546662[_0x0076('0x5e')]['id']){delete _0x546662['body']['id'];}var _0x4a1c90,_0x149dfb,_0x1c0d77;return db[_0x0076('0x3a')][_0x0076('0x56')]({'where':{'id':_0x546662['params']['id']}})[_0x0076('0x1a')](handleEntityNotFound(_0x314c14,null))[_0x0076('0x1a')](function(_0x29d7){if(_0x29d7){_0x1c0d77=_0x29d7;logger[_0x0076('0x1c')](_0x0076('0xa9'),_0x0076('0x25'),_0x0076('0xc5'),_0x29d7[_0x0076('0x3d')],util['inspect'](_0x546662[_0x0076('0x5e')],{'showHidden':![],'depth':null}));switch(_0x29d7[_0x0076('0x3d')]){case _0x0076('0x7a'):if(_0x546662['body']['skebby_dispatch_id']&&_0x546662['body'][_0x0076('0x25')]){_0x149dfb=_0x546662[_0x0076('0x5e')][_0x0076('0x25')];return db[_0x0076('0xa0')][_0x0076('0x56')]({'where':{'messageId':_0x546662[_0x0076('0x5e')][_0x0076('0xc6')]}});}break;case _0x0076('0xc7'):if(_0x546662[_0x0076('0x5e')]['requestid']&&_0x546662[_0x0076('0x5e')][_0x0076('0xc8')]){_0x149dfb=_0x546662['body'][_0x0076('0xc8')];return db[_0x0076('0xa0')][_0x0076('0x56')]({'where':{'messageId':_0x546662[_0x0076('0x5e')][_0x0076('0xc9')]}});}break;case _0x0076('0x7c'):if(_0x546662[_0x0076('0x5e')][_0x0076('0xca')]&&_0x546662[_0x0076('0x5e')][_0x0076('0xcb')]){_0x149dfb=_0x546662[_0x0076('0x5e')][_0x0076('0xcb')];return db[_0x0076('0xa0')]['find']({'where':{'messageId':_0x546662[_0x0076('0x5e')]['message_id']}});}break;case _0x0076('0x81'):var _0x1f5811=_0x546662['body'][_0x0076('0x82')][0x0];if(_0x1f5811['messageId']&&_0x1f5811[_0x0076('0x25')][_0x0076('0xcc')]==='DELIVERED'){_0x149dfb=_0x1f5811[_0x0076('0x25')][_0x0076('0xcc')];return db[_0x0076('0xa0')][_0x0076('0x56')]({'where':{'messageId':_0x1f5811[_0x0076('0x79')]}});}break;case'clickatell':if(_0x546662['body'][_0x0076('0x79')]&&_0x546662[_0x0076('0x5e')][_0x0076('0x25')]){_0x149dfb=_0x546662[_0x0076('0x5e')][_0x0076('0x25')];return db[_0x0076('0xa0')][_0x0076('0x56')]({'where':{'messageId':_0x546662[_0x0076('0x5e')][_0x0076('0x79')]}});}break;case _0x0076('0x88'):if(_0x546662[_0x0076('0x5e')][0x0]['message']['id']){_0x149dfb=_0x546662[_0x0076('0x5e')][0x0][_0x0076('0x3d')];return db[_0x0076('0xa0')][_0x0076('0x56')]({'where':{'messageId':_0x546662[_0x0076('0x5e')][0x0]['message']['id']}});}break;case _0x0076('0x89'):if(_0x546662[_0x0076('0x5e')][_0x0076('0xcd')]&&_0x546662['body']['status']){_0x149dfb=_0x546662['body'][_0x0076('0x25')];return db[_0x0076('0xa0')][_0x0076('0x56')]({'where':{'messageId':_0x546662['body'][_0x0076('0xcd')]}});}break;}}})[_0x0076('0x1a')](handleEntityNotFound(_0x314c14,null))['then'](function(_0xfb0ca1){if(_0xfb0ca1){_0x4a1c90=_0xfb0ca1;switch(_0x1c0d77[_0x0076('0x3d')]){case _0x0076('0x7a'):if(_0x149dfb===_0x0076('0xce')){return _0x4a1c90[_0x0076('0x2f')]({'read':!![]});}else{logger[_0x0076('0x1e')](_0x0076('0xa9'),_0x0076('0x25'),_0x0076('0x7a'),util['inspect'](_0x546662[_0x0076('0x5e')],{'showHidden':![],'depth':null}));}break;case'connectel':if(_0x149dfb==='1'){return _0x4a1c90[_0x0076('0x2f')]({'read':!![]});}else{logger[_0x0076('0x1e')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0076('0x25'),'skebby',util['inspect'](_0x546662['body'],{'showHidden':![],'depth':null}));}break;case'clicksend':if(!_0x546662[_0x0076('0x5e')][_0x0076('0xcf')]&&_0x149dfb>=0xc8&&_0x149dfb<=0xce){return _0x4a1c90[_0x0076('0x2f')]({'read':!![]});}else{logger[_0x0076('0x1e')](_0x0076('0xa9'),_0x0076('0x25'),_0x0076('0x7c'),util['inspect'](_0x546662[_0x0076('0x5e')],{'showHidden':![],'depth':null}));}break;case'infobip':var _0x213537=_0x546662[_0x0076('0x5e')][_0x0076('0x82')][0x0];if(_0x213537[_0x0076('0x25')][_0x0076('0xcc')]==='DELIVERED'){return _0x4a1c90['update']({'read':!![]});}else{logger['error'](_0x0076('0xa9'),_0x0076('0x25'),_0x0076('0x81'),util[_0x0076('0xd0')](_0x546662['body'],{'showHidden':![],'depth':null}));}break;case _0x0076('0x86'):if(_0x149dfb==_0x0076('0xd1')||_0x149dfb==_0x0076('0xd2')){return _0x4a1c90[_0x0076('0x2f')]({'read':!![]});}else{logger[_0x0076('0x1e')](_0x0076('0xa9'),_0x0076('0x25'),_0x0076('0x86'),util[_0x0076('0xd0')](_0x546662[_0x0076('0x5e')],{'showHidden':![],'depth':null}));}break;case'bandwidth':if(_0x149dfb==_0x0076('0xd3')){return _0x4a1c90[_0x0076('0x2f')]({'read':!![]});}else{logger['error'](_0x0076('0xa9'),_0x0076('0x25'),'bandwidth',util[_0x0076('0xd0')](_0x546662[_0x0076('0x5e')],{'showHidden':![],'depth':null}));}break;case _0x0076('0x89'):if(_0x149dfb===_0x0076('0xd4')||_0x149dfb==='ACCEPTD'){return _0x4a1c90[_0x0076('0x2f')]({'read':!![]});}else{logger[_0x0076('0x1e')](_0x0076('0xa9'),_0x0076('0x25'),'intelepeer',util[_0x0076('0xd0')](_0x546662[_0x0076('0x5e')],{'showHidden':![],'depth':null}));}break;}return _0x4a1c90;}})[_0x0076('0x1a')](respondWithResult(_0x314c14,null))[_0x0076('0x23')](handleError(_0x314c14,null));};exports[_0x0076('0xd5')]=function(_0x40f242,_0x5050bf,_0x457b21){var _0x5c2a35,_0x52de93,_0x15331c;return db[_0x0076('0x3a')][_0x0076('0x56')]({'where':{'id':_0x40f242[_0x0076('0x53')]['id']}})[_0x0076('0x1a')](handleEntityNotFound(_0x5050bf,null))[_0x0076('0x1a')](function(_0x3ef75a){if(_0x3ef75a){_0x15331c=_0x3ef75a;logger[_0x0076('0x1c')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x0076('0x25'),_0x0076('0xc5'),_0x3ef75a[_0x0076('0x3d')],util['inspect'](_0x40f242['query'],{'showHidden':![],'depth':null}));switch(_0x3ef75a[_0x0076('0x3d')]){case _0x0076('0x83'):if(_0x40f242[_0x0076('0x3f')][_0x0076('0xd6')]&&_0x40f242[_0x0076('0x3f')]['state']){_0x52de93=_0x40f242[_0x0076('0x3f')][_0x0076('0xd7')];return db['SmsMessage'][_0x0076('0x56')]({'where':{'messageId':_0x40f242[_0x0076('0x3f')][_0x0076('0xd6')]}});}break;}}})[_0x0076('0x1a')](handleEntityNotFound(_0x5050bf,null))[_0x0076('0x1a')](function(_0x55b805){if(_0x55b805){_0x5c2a35=_0x55b805;switch(_0x15331c[_0x0076('0x3d')]){case _0x0076('0x83'):if(_0x52de93==='2'||_0x52de93==='6'){return _0x5c2a35[_0x0076('0x2f')]({'read':!![]});}else{logger['error'](_0x0076('0xa9'),_0x0076('0x25'),'csc',util[_0x0076('0xd0')](_0x40f242[_0x0076('0x3f')],{'showHidden':![],'depth':null}));};break;}return _0x5c2a35;}})[_0x0076('0x1a')](respondWithResult(_0x5050bf,null))[_0x0076('0x23')](handleError(_0x5050bf,null));};exports['addAgents']=function(_0x21d4e5,_0xf5d528,_0x12778e){return db[_0x0076('0x3a')][_0x0076('0x56')]({'where':{'id':_0x21d4e5[_0x0076('0x53')]['id']}})[_0x0076('0x1a')](handleEntityNotFound(_0xf5d528,null))[_0x0076('0x1a')](function(_0x4f4f50){if(_0x4f4f50){return _0x4f4f50[_0x0076('0xd8')](_0x21d4e5[_0x0076('0x5e')]['ids'],_[_0x0076('0x94')](_0x21d4e5[_0x0076('0x5e')],[_0x0076('0x63'),'id'])||{})['spread'](function(_0x2085dc){for(var _0x42c9f5=0x0;_0x42c9f5<_0x21d4e5[_0x0076('0x5e')][_0x0076('0x63')][_0x0076('0x44')];_0x42c9f5+=0x1){socket[_0x0076('0xd9')](_0x0076('0xda'),{'UserId':Number(_0x21d4e5[_0x0076('0x5e')][_0x0076('0x63')][_0x42c9f5]),'SmsAccountId':Number(_0x21d4e5[_0x0076('0x53')]['id'])});}return _0x2085dc;});}})[_0x0076('0x1a')](respondWithResult(_0xf5d528,null))[_0x0076('0x23')](handleError(_0xf5d528,null));};exports['removeAgents']=function(_0x49e133,_0x360d40,_0x665604){return db[_0x0076('0x3a')][_0x0076('0x56')]({'where':{'id':_0x49e133[_0x0076('0x53')]['id']}})[_0x0076('0x1a')](handleEntityNotFound(_0x360d40,null))[_0x0076('0x1a')](function(_0x8242a3){if(_0x8242a3){return _0x8242a3['removeAgents'](_0x49e133['query'][_0x0076('0x63')])[_0x0076('0x1a')](function(){if(_[_0x0076('0xdb')](_0x49e133[_0x0076('0x3f')][_0x0076('0x63')])){for(var _0x580386=0x0;_0x580386<_0x49e133[_0x0076('0x3f')][_0x0076('0x63')][_0x0076('0x44')];_0x580386+=0x1){socket[_0x0076('0xd9')](_0x0076('0xdc'),{'UserId':Number(_0x49e133['query']['ids'][_0x580386]),'SmsAccountId':Number(_0x49e133[_0x0076('0x53')]['id'])});}}else{socket['emit']('userSmsAccount:remove',{'UserId':Number(_0x49e133['query'][_0x0076('0x63')]),'SmsAccountId':Number(_0x49e133[_0x0076('0x53')]['id'])});}});}})['then'](respondWithStatusCode(_0x360d40,null))[_0x0076('0x23')](handleError(_0x360d40,null));};exports[_0x0076('0xdd')]=function(_0x368a75,_0x498eee,_0x1a1c12){var _0x224907={};var _0x31ff6d={};var _0x58f574;var _0x33d18b;return db[_0x0076('0x3a')][_0x0076('0x62')]({'where':{'id':_0x368a75[_0x0076('0x53')]['id']}})['then'](handleEntityNotFound(_0x498eee,null))['then'](function(_0x3978fb){if(_0x3978fb){_0x58f574=_0x3978fb;_0x31ff6d[_0x0076('0x3e')]=_[_0x0076('0x55')](db['User']['rawAttributes']);_0x31ff6d[_0x0076('0x3f')]=_[_0x0076('0x55')](_0x368a75[_0x0076('0x3f')]);_0x31ff6d[_0x0076('0x40')]=_[_0x0076('0x41')](_0x31ff6d['model'],_0x31ff6d[_0x0076('0x3f')]);_0x224907['attributes']=_[_0x0076('0x41')](_0x31ff6d[_0x0076('0x3e')],qs[_0x0076('0x43')](_0x368a75['query'][_0x0076('0x43')]));_0x224907['attributes']=_0x224907[_0x0076('0x42')][_0x0076('0x44')]?_0x224907[_0x0076('0x42')]:_0x31ff6d['model'];_0x224907[_0x0076('0x47')]=qs[_0x0076('0x48')](_0x368a75[_0x0076('0x3f')][_0x0076('0x48')]);_0x224907[_0x0076('0x49')]=qs[_0x0076('0x40')](_[_0x0076('0x4a')](_0x368a75[_0x0076('0x3f')],_0x31ff6d[_0x0076('0x40')]));if(_0x368a75[_0x0076('0x3f')]['filter']){_0x224907[_0x0076('0x49')]=_[_0x0076('0x4b')](_0x224907['where'],{'$or':_['map'](_0x224907[_0x0076('0x42')],function(_0x2553c0){var _0x51e3ea={};_0x51e3ea[_0x2553c0]={'$like':'%'+_0x368a75['query'][_0x0076('0x4d')]+'%'};return _0x51e3ea;})});}_0x224907=_[_0x0076('0x4b')]({},_0x224907,_0x368a75[_0x0076('0x4e')]);return _0x58f574[_0x0076('0xdd')](_0x224907);}})[_0x0076('0x1a')](function(_0x8017bf){if(_0x8017bf){_0x33d18b=_0x8017bf[_0x0076('0x44')];if(!_0x368a75[_0x0076('0x3f')][_0x0076('0x45')](_0x0076('0x46'))){_0x224907['limit']=qs[_0x0076('0x29')](_0x368a75[_0x0076('0x3f')][_0x0076('0x29')]);_0x224907[_0x0076('0x27')]=qs[_0x0076('0x27')](_0x368a75[_0x0076('0x3f')][_0x0076('0x27')]);}return _0x58f574[_0x0076('0xdd')](_0x224907);}})[_0x0076('0x1a')](function(_0x33dd85){if(_0x33dd85){return _0x33dd85?{'count':_0x33d18b,'rows':_0x33dd85}:null;}})['then'](respondWithResult(_0x498eee,null))[_0x0076('0x23')](handleError(_0x498eee,null));}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.events.js b/server/api/smsAccount/smsAccount.events.js index 11b5080..9b63181 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 _0x7a81=['update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x1b5aea,_0x3f04b7){var _0x15cfc6=function(_0x204e92){while(--_0x204e92){_0x1b5aea['push'](_0x1b5aea['shift']());}};_0x15cfc6(++_0x3f04b7);}(_0x7a81,0x150));var _0x17a8=function(_0x16e8b0,_0x114394){_0x16e8b0=_0x16e8b0-0x0;var _0x53b3a7=_0x7a81[_0x16e8b0];return _0x53b3a7;};'use strict';var EventEmitter=require(_0x17a8('0x0'));var SmsAccount=require(_0x17a8('0x1'))['db']['SmsAccount'];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x17a8('0x2')](0x0);var events={'afterCreate':_0x17a8('0x3'),'afterUpdate':_0x17a8('0x4'),'afterDestroy':_0x17a8('0x5')};function emitEvent(_0x36a017){return function(_0x37a92b,_0x497b99,_0x499683){SmsAccountEvents[_0x17a8('0x6')](_0x36a017+':'+_0x37a92b['id'],_0x37a92b);SmsAccountEvents[_0x17a8('0x6')](_0x36a017,_0x37a92b);_0x499683(null);};}for(var e in events){if(events[_0x17a8('0x7')](e)){var event=events[e];SmsAccount[_0x17a8('0x8')](e,emitEvent(event));}}module[_0x17a8('0x9')]=SmsAccountEvents; \ No newline at end of file +var _0xc880=['SmsAccount','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x2d1f90,_0x4e2d93){var _0x3603e7=function(_0x16bdf6){while(--_0x16bdf6){_0x2d1f90['push'](_0x2d1f90['shift']());}};_0x3603e7(++_0x4e2d93);}(_0xc880,0xda));var _0x0c88=function(_0x4e07ec,_0x4dc601){_0x4e07ec=_0x4e07ec-0x0;var _0x1a3cc4=_0xc880[_0x4e07ec];return _0x1a3cc4;};'use strict';var EventEmitter=require(_0x0c88('0x0'));var SmsAccount=require(_0x0c88('0x1'))['db'][_0x0c88('0x2')];var SmsAccountEvents=new EventEmitter();SmsAccountEvents[_0x0c88('0x3')](0x0);var events={'afterCreate':_0x0c88('0x4'),'afterUpdate':_0x0c88('0x5'),'afterDestroy':_0x0c88('0x6')};function emitEvent(_0x5a9828){return function(_0x2b7afb,_0xec7025,_0x4a8ff0){SmsAccountEvents['emit'](_0x5a9828+':'+_0x2b7afb['id'],_0x2b7afb);SmsAccountEvents[_0x0c88('0x7')](_0x5a9828,_0x2b7afb);_0x4a8ff0(null);};}for(var e in events){if(events[_0x0c88('0x8')](e)){var event=events[e];SmsAccount[_0x0c88('0x9')](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 3fa7962..c31cdbe 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 _0x9e11=['sms_accounts','lodash','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','exports','define','SmsAccount'];(function(_0xd5af65,_0x4af5bc){var _0x376458=function(_0x356ca8){while(--_0x356ca8){_0xd5af65['push'](_0xd5af65['shift']());}};_0x376458(++_0x4af5bc);}(_0x9e11,0x9d));var _0x19e1=function(_0x20cffb,_0x5101cb){_0x20cffb=_0x20cffb-0x0;var _0xd26c32=_0x9e11[_0x20cffb];return _0xd26c32;};'use strict';var _=require(_0x19e1('0x0'));var util=require('util');var logger=require(_0x19e1('0x1'))(_0x19e1('0x2'));var moment=require(_0x19e1('0x3'));var BPromise=require(_0x19e1('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x19e1('0x5'));var rimraf=require(_0x19e1('0x6'));var config=require(_0x19e1('0x7'));var attributes=require('./smsAccount.attributes');module[_0x19e1('0x8')]=function(_0x385033,_0xa7e5b0){return _0x385033[_0x19e1('0x9')](_0x19e1('0xa'),attributes,{'tableName':_0x19e1('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc1f0=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','rimraf','../../config/environment','./smsAccount.attributes','exports','define','sms_accounts'];(function(_0x87b0ff,_0x314389){var _0x3bc0b2=function(_0x41682b){while(--_0x41682b){_0x87b0ff['push'](_0x87b0ff['shift']());}};_0x3bc0b2(++_0x314389);}(_0xc1f0,0x1ad));var _0x0c1f=function(_0xc0247c,_0x61a80a){_0xc0247c=_0xc0247c-0x0;var _0x3698b4=_0xc1f0[_0xc0247c];return _0x3698b4;};'use strict';var _=require(_0x0c1f('0x0'));var util=require(_0x0c1f('0x1'));var logger=require(_0x0c1f('0x2'))(_0x0c1f('0x3'));var moment=require(_0x0c1f('0x4'));var BPromise=require(_0x0c1f('0x5'));var rp=require(_0x0c1f('0x6'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c1f('0x7'));var config=require(_0x0c1f('0x8'));var attributes=require(_0x0c1f('0x9'));module[_0x0c1f('0xa')]=function(_0x5d8483,_0x312c01){return _0x5d8483[_0x0c1f('0xb')]('SmsAccount',attributes,{'tableName':_0x0c1f('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 f15357f..0e52b78 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 _0x270d=['stringify','error','code','message','catch','ShowSmsAccount','SmsAccount','find','options','raw','where','include','map','model','attributes','then','info','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','jayson/promise','http','redis','defaults','socket.io-emitter','./smsAccount.socket','register','request','SmsAccount,\x20%s,\x20%s','debug','SmsAccount,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x506eae,_0x137a43){var _0x5ee501=function(_0xb20930){while(--_0xb20930){_0x506eae['push'](_0x506eae['shift']());}};_0x5ee501(++_0x137a43);}(_0x270d,0x139));var _0xd270=function(_0x25bfa2,_0x5f2095){_0x25bfa2=_0x25bfa2-0x0;var _0x455105=_0x270d[_0x25bfa2];return _0x455105;};'use strict';var _=require(_0xd270('0x0'));var util=require(_0xd270('0x1'));var moment=require(_0xd270('0x2'));var BPromise=require(_0xd270('0x3'));var rs=require(_0xd270('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xd270('0x5'))['db'];var utils=require(_0xd270('0x6'));var logger=require('../../config/logger')(_0xd270('0x7'));var config=require('../../config/environment');var jayson=require(_0xd270('0x8'));var client=jayson['client'][_0xd270('0x9')]({'port':0x232a});config[_0xd270('0xa')]=_[_0xd270('0xb')](config[_0xd270('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0xd270('0xc'))(new Redis(config[_0xd270('0xa')]));require(_0xd270('0xd'))[_0xd270('0xe')](socket);function respondWithRpcPromise(_0x5d2702,_0x5b9101,_0x5bb2cc){return new BPromise(function(_0x1d1d03,_0x21b30c){return client[_0xd270('0xf')](_0x5d2702,_0x5bb2cc)['then'](function(_0x395a9f){logger['info'](_0xd270('0x10'),_0x5b9101,'request\x20sent');logger[_0xd270('0x11')](_0xd270('0x12'),_0x5b9101,_0xd270('0x13'),JSON[_0xd270('0x14')](_0x395a9f));if(_0x395a9f[_0xd270('0x15')]){if(_0x395a9f[_0xd270('0x15')][_0xd270('0x16')]===0x1f4){logger[_0xd270('0x15')](_0xd270('0x10'),_0x5b9101,_0x395a9f['error']['message']);return _0x21b30c(_0x395a9f[_0xd270('0x15')][_0xd270('0x17')]);}logger[_0xd270('0x15')](_0xd270('0x10'),_0x5b9101,_0x395a9f[_0xd270('0x15')]['message']);return _0x1d1d03(_0x395a9f[_0xd270('0x15')][_0xd270('0x17')]);}else{logger['info'](_0xd270('0x10'),_0x5b9101,_0xd270('0x13'));_0x1d1d03(_0x395a9f['result'][_0xd270('0x17')]);}})[_0xd270('0x18')](function(_0x3ca204){logger[_0xd270('0x15')](_0xd270('0x10'),_0x5b9101,_0x3ca204);_0x21b30c(_0x3ca204);});});}exports[_0xd270('0x19')]=function(_0x35c9e4){var _0x465665=this;return new Promise(function(_0x4a3c9a,_0x5cd56d){return db[_0xd270('0x1a')][_0xd270('0x1b')]({'raw':_0x35c9e4[_0xd270('0x1c')]?_0x35c9e4[_0xd270('0x1c')][_0xd270('0x1d')]===undefined?!![]:![]:!![],'where':_0x35c9e4[_0xd270('0x1c')]?_0x35c9e4[_0xd270('0x1c')][_0xd270('0x1e')]||null:null,'attributes':_0x35c9e4[_0xd270('0x1c')]?_0x35c9e4[_0xd270('0x1c')]['attributes']||null:null,'include':_0x35c9e4[_0xd270('0x1c')]?_0x35c9e4[_0xd270('0x1c')][_0xd270('0x1f')]?_[_0xd270('0x20')](_0x35c9e4[_0xd270('0x1c')]['include'],function(_0x4f733d){return{'model':db[_0x4f733d[_0xd270('0x21')]],'as':_0x4f733d['as'],'attributes':_0x4f733d['attributes'],'include':_0x4f733d['include']?_['map'](_0x4f733d[_0xd270('0x1f')],function(_0x2c3c89){return{'model':db[_0x2c3c89['model']],'as':_0x2c3c89['as'],'attributes':_0x2c3c89['attributes'],'include':_0x2c3c89[_0xd270('0x1f')]?_[_0xd270('0x20')](_0x2c3c89[_0xd270('0x1f')],function(_0x30bf9a){return{'model':db[_0x30bf9a[_0xd270('0x21')]],'as':_0x30bf9a['as'],'attributes':_0x30bf9a[_0xd270('0x22')]};}):[]};}):[]};}):[]:[]})[_0xd270('0x23')](function(_0x31137d){logger[_0xd270('0x24')]('ShowSmsAccount',_0x35c9e4);logger[_0xd270('0x11')](_0xd270('0x19'),_0x35c9e4,JSON['stringify'](_0x31137d));_0x4a3c9a(_0x31137d);})[_0xd270('0x18')](function(_0x134f7f){logger['error'](_0xd270('0x19'),_0x134f7f[_0xd270('0x17')],_0x35c9e4);_0x5cd56d(_0x465665['error'](0x1f4,_0x134f7f[_0xd270('0x17')]));});});}; \ No newline at end of file +var _0x48c8=['debug','request\x20sent','stringify','error','code','message','result','SmsAccount','options','raw','where','include','model','map','attributes','ShowSmsAccount','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','http','redis','defaults','localhost','./smsAccount.socket','register','request','then','info','SmsAccount,\x20%s,\x20%s'];(function(_0x4b4a30,_0x5cb771){var _0x3efa26=function(_0x2994bd){while(--_0x2994bd){_0x4b4a30['push'](_0x4b4a30['shift']());}};_0x3efa26(++_0x5cb771);}(_0x48c8,0xd6));var _0x848c=function(_0x333160,_0x4c1df7){_0x333160=_0x333160-0x0;var _0x256d5a=_0x48c8[_0x333160];return _0x256d5a;};'use strict';var _=require(_0x848c('0x0'));var util=require(_0x848c('0x1'));var moment=require('moment');var BPromise=require(_0x848c('0x2'));var rs=require(_0x848c('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x848c('0x4'))['db'];var utils=require(_0x848c('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x848c('0x6'));var client=jayson['client'][_0x848c('0x7')]({'port':0x232a});config[_0x848c('0x8')]=_[_0x848c('0x9')](config[_0x848c('0x8')],{'host':_0x848c('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x848c('0x8')]));require(_0x848c('0xb'))[_0x848c('0xc')](socket);function respondWithRpcPromise(_0x2bffaf,_0xa58c67,_0x46a21f){return new BPromise(function(_0x6b7909,_0x2ff9a){return client[_0x848c('0xd')](_0x2bffaf,_0x46a21f)[_0x848c('0xe')](function(_0x2f907c){logger[_0x848c('0xf')](_0x848c('0x10'),_0xa58c67,'request\x20sent');logger[_0x848c('0x11')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0xa58c67,_0x848c('0x12'),JSON[_0x848c('0x13')](_0x2f907c));if(_0x2f907c[_0x848c('0x14')]){if(_0x2f907c[_0x848c('0x14')][_0x848c('0x15')]===0x1f4){logger[_0x848c('0x14')](_0x848c('0x10'),_0xa58c67,_0x2f907c[_0x848c('0x14')][_0x848c('0x16')]);return _0x2ff9a(_0x2f907c[_0x848c('0x14')][_0x848c('0x16')]);}logger[_0x848c('0x14')](_0x848c('0x10'),_0xa58c67,_0x2f907c['error'][_0x848c('0x16')]);return _0x6b7909(_0x2f907c[_0x848c('0x14')][_0x848c('0x16')]);}else{logger[_0x848c('0xf')](_0x848c('0x10'),_0xa58c67,_0x848c('0x12'));_0x6b7909(_0x2f907c[_0x848c('0x17')]['message']);}})['catch'](function(_0x59169b){logger[_0x848c('0x14')]('SmsAccount,\x20%s,\x20%s',_0xa58c67,_0x59169b);_0x2ff9a(_0x59169b);});});}exports['ShowSmsAccount']=function(_0x5f4470){var _0x5d217d=this;return new Promise(function(_0x3a4d5d,_0x534e65){return db[_0x848c('0x18')]['find']({'raw':_0x5f4470[_0x848c('0x19')]?_0x5f4470['options'][_0x848c('0x1a')]===undefined?!![]:![]:!![],'where':_0x5f4470['options']?_0x5f4470[_0x848c('0x19')][_0x848c('0x1b')]||null:null,'attributes':_0x5f4470[_0x848c('0x19')]?_0x5f4470[_0x848c('0x19')]['attributes']||null:null,'include':_0x5f4470[_0x848c('0x19')]?_0x5f4470['options'][_0x848c('0x1c')]?_['map'](_0x5f4470[_0x848c('0x19')][_0x848c('0x1c')],function(_0x401599){return{'model':db[_0x401599[_0x848c('0x1d')]],'as':_0x401599['as'],'attributes':_0x401599['attributes'],'include':_0x401599[_0x848c('0x1c')]?_[_0x848c('0x1e')](_0x401599[_0x848c('0x1c')],function(_0x3fdc9e){return{'model':db[_0x3fdc9e[_0x848c('0x1d')]],'as':_0x3fdc9e['as'],'attributes':_0x3fdc9e[_0x848c('0x1f')],'include':_0x3fdc9e[_0x848c('0x1c')]?_[_0x848c('0x1e')](_0x3fdc9e['include'],function(_0x11fbd4){return{'model':db[_0x11fbd4[_0x848c('0x1d')]],'as':_0x11fbd4['as'],'attributes':_0x11fbd4[_0x848c('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x848c('0xe')](function(_0x38df67){logger[_0x848c('0xf')](_0x848c('0x20'),_0x5f4470);logger[_0x848c('0x11')]('ShowSmsAccount',_0x5f4470,JSON[_0x848c('0x13')](_0x38df67));_0x3a4d5d(_0x38df67);})['catch'](function(_0x572354){logger[_0x848c('0x14')](_0x848c('0x20'),_0x572354[_0x848c('0x16')],_0x5f4470);_0x534e65(_0x5d217d[_0x848c('0x14')](0x1f4,_0x572354['message']));});});}; \ No newline at end of file diff --git a/server/api/smsAccount/smsAccount.socket.js b/server/api/smsAccount/smsAccount.socket.js index 41bf8b4..1345518 100644 --- a/server/api/smsAccount/smsAccount.socket.js +++ b/server/api/smsAccount/smsAccount.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3c2a69,_0x4c8b41){_0x3c2a69=_0x3c2a69-0x0;var _0x596bc8=_0xa9e0[_0x3c2a69];return _0x596bc8;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file +var _0xa9e0=['register','length','smsAccount:','./smsAccount.events','save','remove','emit','removeListener'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var SmsAccountEvents=require(_0x0a9e('0x0'));var events=[_0x0a9e('0x1'),_0x0a9e('0x2'),'update'];function createListener(_0x550fbc,_0x18d5c9){return function(_0x4ce2f1){_0x18d5c9[_0x0a9e('0x3')](_0x550fbc,_0x4ce2f1);};}function removeListener(_0x432180,_0x2ab90b){return function(){SmsAccountEvents[_0x0a9e('0x4')](_0x432180,_0x2ab90b);};}exports[_0x0a9e('0x5')]=function(_0x57b080){for(var _0x219af0=0x0,_0x441e3a=events[_0x0a9e('0x6')];_0x219af0<_0x441e3a;_0x219af0++){var _0x5f41ea=events[_0x219af0];var _0x503809=createListener(_0x0a9e('0x7')+_0x5f41ea,_0x57b080);SmsAccountEvents['on'](_0x5f41ea,_0x503809);}}; \ No newline at end of file diff --git a/server/api/smsApplication/index.js b/server/api/smsApplication/index.js index ffa244d..5dababc 100644 --- a/server/api/smsApplication/index.js +++ b/server/api/smsApplication/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['path','connect-timeout','express','../../components/auth/service','../../config/environment','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete','exports','multer'];(function(_0x52aa1d,_0x2c150f){var _0x8024f8=function(_0x12adb8){while(--_0x12adb8){_0x52aa1d['push'](_0x52aa1d['shift']());}};_0x8024f8(++_0x2c150f);}(_0x3e74,0x175));var _0x43e7=function(_0x41161e,_0x4baa2f){_0x41161e=_0x41161e-0x0;var _0xcc9595=_0x3e74[_0x41161e];return _0xcc9595;};'use strict';var multer=require(_0x43e7('0x0'));var util=require('util');var path=require(_0x43e7('0x1'));var timeout=require(_0x43e7('0x2'));var express=require(_0x43e7('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x43e7('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0x43e7('0x5'));var controller=require(_0x43e7('0x6'));router[_0x43e7('0x7')]('/',auth[_0x43e7('0x8')](),controller[_0x43e7('0x9')]);router['get'](_0x43e7('0xa'),auth[_0x43e7('0x8')](),controller[_0x43e7('0xb')]);router[_0x43e7('0xc')]('/',auth[_0x43e7('0x8')](),controller['create']);router[_0x43e7('0xd')]('/:id',auth['isAuthenticated'](),controller[_0x43e7('0xe')]);router[_0x43e7('0xf')]('/:id',auth[_0x43e7('0x8')](),controller['destroy']);module[_0x43e7('0x10')]=router; \ No newline at end of file +var _0x9957=['multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./smsApplication.controller','get','isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0x9957,0x93));var _0x7995=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0x9957[_0xbca1b1];return _0x4e1686;};'use strict';var multer=require(_0x7995('0x0'));var util=require(_0x7995('0x1'));var path=require(_0x7995('0x2'));var timeout=require(_0x7995('0x3'));var express=require('express');var router=express[_0x7995('0x4')]();var fs_extra=require(_0x7995('0x5'));var auth=require(_0x7995('0x6'));var interaction=require(_0x7995('0x7'));var config=require('../../config/environment');var controller=require(_0x7995('0x8'));router[_0x7995('0x9')]('/',auth[_0x7995('0xa')](),controller[_0x7995('0xb')]);router[_0x7995('0x9')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0xd')]);router[_0x7995('0xe')]('/',auth['isAuthenticated'](),controller[_0x7995('0xf')]);router[_0x7995('0x10')](_0x7995('0xc'),auth[_0x7995('0xa')](),controller[_0x7995('0x11')]);router[_0x7995('0x12')](_0x7995('0xc'),auth['isAuthenticated'](),controller[_0x7995('0x13')]);module[_0x7995('0x14')]=router; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.attributes.js b/server/api/smsApplication/smsApplication.attributes.js index 8dba0de..de8f699 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 _0x759c=['noop','TEXT','sequelize','STRING'];(function(_0x48cb9c,_0x3235de){var _0x58b934=function(_0x1f3653){while(--_0x1f3653){_0x48cb9c['push'](_0x48cb9c['shift']());}};_0x58b934(++_0x3235de);}(_0x759c,0x7a));var _0xc759=function(_0x541b66,_0x5b5933){_0x541b66=_0x541b66-0x0;var _0x11989d=_0x759c[_0x541b66];return _0x11989d;};'use strict';var Sequelize=require(_0xc759('0x0'));module['exports']={'priority':{'type':Sequelize['INTEGER'],'allowNull':![]},'app':{'type':Sequelize[_0xc759('0x1')],'allowNull':![],'defaultValue':_0xc759('0x2')},'appdata':{'type':Sequelize[_0xc759('0x3')]()},'description':{'type':Sequelize[_0xc759('0x1')]},'interval':{'type':Sequelize['STRING'],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x0430=['TEXT','*,*,*,*','sequelize','exports','INTEGER','STRING','noop'];(function(_0x25bd07,_0x57e1f6){var _0x42e324=function(_0x22c77e){while(--_0x22c77e){_0x25bd07['push'](_0x25bd07['shift']());}};_0x42e324(++_0x57e1f6);}(_0x0430,0x152));var _0x0043=function(_0x49d8b3,_0xeac856){_0x49d8b3=_0x49d8b3-0x0;var _0x2c124e=_0x0430[_0x49d8b3];return _0x2c124e;};'use strict';var Sequelize=require(_0x0043('0x0'));module[_0x0043('0x1')]={'priority':{'type':Sequelize[_0x0043('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x0043('0x3')],'allowNull':![],'defaultValue':_0x0043('0x4')},'appdata':{'type':Sequelize[_0x0043('0x5')]()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x0043('0x3')],'defaultValue':_0x0043('0x6')}}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.controller.js b/server/api/smsApplication/smsApplication.controller.js index deb5ed1..0af61f2 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 _0xe0c4=['moment','bluebird','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','json','offset','undefined','limit','count','set','reject','then','error','stack','name','send','index','map','SmsApplication','rawAttributes','type','key','model','keys','filters','intersection','attributes','fields','query','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','include','findAll','show','params','length','options','catch','create','body','update','find','eml-format','zip-dir','fast-json-patch','request-promise'];(function(_0x459b74,_0x5773bd){var _0x46cb16=function(_0x97867f){while(--_0x97867f){_0x459b74['push'](_0x459b74['shift']());}};_0x46cb16(++_0x5773bd);}(_0xe0c4,0x15a));var _0x4e0c=function(_0x2bb787,_0x41bf02){_0x2bb787=_0x2bb787-0x0;var _0x425b33=_0xe0c4[_0x2bb787];return _0x425b33;};'use strict';var emlformat=require(_0x4e0c('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4e0c('0x1'));var jsonpatch=require(_0x4e0c('0x2'));var rp=require(_0x4e0c('0x3'));var moment=require(_0x4e0c('0x4'));var BPromise=require(_0x4e0c('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0x4e0c('0x6'));var csv=require(_0x4e0c('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x4e0c('0x8'));var _=require(_0x4e0c('0x9'));var squel=require(_0x4e0c('0xa'));var crypto=require(_0x4e0c('0xb'));var jsforce=require(_0x4e0c('0xc'));var deskjs=require(_0x4e0c('0xd'));var toCsv=require(_0x4e0c('0x7'));var querystring=require(_0x4e0c('0xe'));var Papa=require('papaparse');var Redis=require(_0x4e0c('0xf'));var authService=require(_0x4e0c('0x10'));var qs=require(_0x4e0c('0x11'));var as=require(_0x4e0c('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x4e0c('0x13'))(_0x4e0c('0x14'));var utils=require(_0x4e0c('0x15'));var config=require(_0x4e0c('0x16'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x141f0d,_0x34a82e){_0x34a82e=_0x34a82e||0xcc;return function(_0x5a652a){if(_0x5a652a){return _0x141f0d[_0x4e0c('0x17')](_0x34a82e);}return _0x141f0d[_0x4e0c('0x18')](_0x34a82e)[_0x4e0c('0x19')]();};}function respondWithResult(_0xd101cc,_0x52b941){_0x52b941=_0x52b941||0xc8;return function(_0x2024e1){if(_0x2024e1){return _0xd101cc[_0x4e0c('0x18')](_0x52b941)[_0x4e0c('0x1a')](_0x2024e1);}};}function respondWithFilteredResult(_0x233f6f,_0x42dc23){return function(_0x16fd1f){if(_0x16fd1f){var _0x576a0b=typeof _0x42dc23[_0x4e0c('0x1b')]===_0x4e0c('0x1c')&&typeof _0x42dc23[_0x4e0c('0x1d')]===_0x4e0c('0x1c');var _0x5cb422=_0x16fd1f[_0x4e0c('0x1e')];var _0x49ec20=_0x576a0b?0x0:_0x42dc23[_0x4e0c('0x1b')];var _0x595749=_0x576a0b?_0x16fd1f['count']:_0x42dc23[_0x4e0c('0x1b')]+_0x42dc23[_0x4e0c('0x1d')];var _0x41f388;if(_0x595749>=_0x5cb422){_0x595749=_0x5cb422;_0x41f388=0xc8;}else{_0x41f388=0xce;}_0x233f6f['status'](_0x41f388);return _0x233f6f[_0x4e0c('0x1f')]('Content-Range',_0x49ec20+'-'+_0x595749+'/'+_0x5cb422)[_0x4e0c('0x1a')](_0x16fd1f);}return null;};}function patchUpdates(_0x8f2350){return function(_0x12cf78){try{jsonpatch['apply'](_0x12cf78,_0x8f2350,!![]);}catch(_0x20e30a){return BPromise[_0x4e0c('0x20')](_0x20e30a);}return _0x12cf78['save']();};}function saveUpdates(_0x1e3509,_0xa14398){return function(_0x4eec6d){if(_0x4eec6d){return _0x4eec6d['update'](_0x1e3509)['then'](function(_0x171faf){return _0x171faf;});}return null;};}function removeEntity(_0x17eb92,_0x1ed0de){return function(_0x270ef4){if(_0x270ef4){return _0x270ef4['destroy']()[_0x4e0c('0x21')](function(){_0x17eb92[_0x4e0c('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0xe82510,_0x29e4ec){return function(_0x28ddb8){if(!_0x28ddb8){_0xe82510[_0x4e0c('0x17')](0x194);}return _0x28ddb8;};}function handleError(_0x419402,_0x152552){_0x152552=_0x152552||0x1f4;return function(_0x3a17ea){logger[_0x4e0c('0x22')](_0x3a17ea[_0x4e0c('0x23')]);if(_0x3a17ea[_0x4e0c('0x24')]){delete _0x3a17ea[_0x4e0c('0x24')];}_0x419402[_0x4e0c('0x18')](_0x152552)[_0x4e0c('0x25')](_0x3a17ea);};}exports[_0x4e0c('0x26')]=function(_0x2b2d57,_0x95aade){var _0x16c498={},_0x33c524={},_0x2fd40f={'count':0x0,'rows':[]};var _0x49a886=_[_0x4e0c('0x27')](db[_0x4e0c('0x28')][_0x4e0c('0x29')],function(_0x25c7c7){return{'name':_0x25c7c7['fieldName'],'type':_0x25c7c7[_0x4e0c('0x2a')][_0x4e0c('0x2b')]};});_0x33c524[_0x4e0c('0x2c')]=_[_0x4e0c('0x27')](_0x49a886,'name');_0x33c524['query']=_[_0x4e0c('0x2d')](_0x2b2d57['query']);_0x33c524[_0x4e0c('0x2e')]=_[_0x4e0c('0x2f')](_0x33c524[_0x4e0c('0x2c')],_0x33c524['query']);_0x16c498[_0x4e0c('0x30')]=_[_0x4e0c('0x2f')](_0x33c524[_0x4e0c('0x2c')],qs[_0x4e0c('0x31')](_0x2b2d57[_0x4e0c('0x32')][_0x4e0c('0x31')]));_0x16c498[_0x4e0c('0x30')]=_0x16c498[_0x4e0c('0x30')]['length']?_0x16c498[_0x4e0c('0x30')]:_0x33c524[_0x4e0c('0x2c')];if(!_0x2b2d57[_0x4e0c('0x32')]['hasOwnProperty'](_0x4e0c('0x33'))){_0x16c498['limit']=qs[_0x4e0c('0x1d')](_0x2b2d57[_0x4e0c('0x32')][_0x4e0c('0x1d')]);_0x16c498['offset']=qs[_0x4e0c('0x1b')](_0x2b2d57[_0x4e0c('0x32')][_0x4e0c('0x1b')]);}_0x16c498[_0x4e0c('0x34')]=qs['sort'](_0x2b2d57['query'][_0x4e0c('0x35')]);_0x16c498['where']=qs[_0x4e0c('0x2e')](_[_0x4e0c('0x36')](_0x2b2d57['query'],_0x33c524['filters']),_0x49a886);if(_0x2b2d57[_0x4e0c('0x32')][_0x4e0c('0x37')]){_0x16c498[_0x4e0c('0x38')]=_[_0x4e0c('0x39')](_0x16c498[_0x4e0c('0x38')],{'$or':_['map'](_0x49a886,function(_0x464266){if(_0x464266[_0x4e0c('0x2a')]!==_0x4e0c('0x3a')){var _0x51d921={};_0x51d921[_0x464266[_0x4e0c('0x24')]]={'$like':'%'+_0x2b2d57['query'][_0x4e0c('0x37')]+'%'};return _0x51d921;}})});}_0x16c498=_[_0x4e0c('0x39')]({},_0x16c498,_0x2b2d57['options']);var _0x37987f={'where':_0x16c498[_0x4e0c('0x38')]};return db[_0x4e0c('0x28')][_0x4e0c('0x1e')](_0x37987f)[_0x4e0c('0x21')](function(_0x144a3c){_0x2fd40f['count']=_0x144a3c;if(_0x2b2d57['query']['includeAll']){_0x16c498[_0x4e0c('0x3b')]=[{'all':!![]}];}return db[_0x4e0c('0x28')][_0x4e0c('0x3c')](_0x16c498);})[_0x4e0c('0x21')](function(_0x37b930){_0x2fd40f['rows']=_0x37b930;return _0x2fd40f;})[_0x4e0c('0x21')](respondWithFilteredResult(_0x95aade,_0x16c498))['catch'](handleError(_0x95aade,null));};exports[_0x4e0c('0x3d')]=function(_0x5d7fd0,_0x3d54bd){var _0x203b38={'raw':!![],'where':{'id':_0x5d7fd0[_0x4e0c('0x3e')]['id']}},_0x2cf6a5={};_0x2cf6a5[_0x4e0c('0x2c')]=_['keys'](db[_0x4e0c('0x28')]['rawAttributes']);_0x2cf6a5[_0x4e0c('0x32')]=_[_0x4e0c('0x2d')](_0x5d7fd0[_0x4e0c('0x32')]);_0x2cf6a5[_0x4e0c('0x2e')]=_[_0x4e0c('0x2f')](_0x2cf6a5['model'],_0x2cf6a5[_0x4e0c('0x32')]);_0x203b38['attributes']=_['intersection'](_0x2cf6a5[_0x4e0c('0x2c')],qs['fields'](_0x5d7fd0[_0x4e0c('0x32')][_0x4e0c('0x31')]));_0x203b38['attributes']=_0x203b38['attributes'][_0x4e0c('0x3f')]?_0x203b38[_0x4e0c('0x30')]:_0x2cf6a5[_0x4e0c('0x2c')];if(_0x5d7fd0[_0x4e0c('0x32')]['includeAll']){_0x203b38['include']=[{'all':!![]}];}_0x203b38=_['merge']({},_0x203b38,_0x5d7fd0[_0x4e0c('0x40')]);return db[_0x4e0c('0x28')]['find'](_0x203b38)['then'](handleEntityNotFound(_0x3d54bd,null))[_0x4e0c('0x21')](respondWithResult(_0x3d54bd,null))[_0x4e0c('0x41')](handleError(_0x3d54bd,null));};exports[_0x4e0c('0x42')]=function(_0x5b449a,_0x160371){return db['SmsApplication'][_0x4e0c('0x42')](_0x5b449a[_0x4e0c('0x43')],{})['then'](respondWithResult(_0x160371,0xc9))[_0x4e0c('0x41')](handleError(_0x160371,null));};exports[_0x4e0c('0x44')]=function(_0xebbcf9,_0x53a24a){if(_0xebbcf9['body']['id']){delete _0xebbcf9[_0x4e0c('0x43')]['id'];}return db[_0x4e0c('0x28')][_0x4e0c('0x45')]({'where':{'id':_0xebbcf9[_0x4e0c('0x3e')]['id']}})[_0x4e0c('0x21')](handleEntityNotFound(_0x53a24a,null))[_0x4e0c('0x21')](saveUpdates(_0xebbcf9[_0x4e0c('0x43')],null))[_0x4e0c('0x21')](respondWithResult(_0x53a24a,null))[_0x4e0c('0x41')](handleError(_0x53a24a,null));};exports['destroy']=function(_0x253bd0,_0x30a49d){return db[_0x4e0c('0x28')][_0x4e0c('0x45')]({'where':{'id':_0x253bd0[_0x4e0c('0x3e')]['id']}})[_0x4e0c('0x21')](handleEntityNotFound(_0x30a49d,null))['then'](removeEntity(_0x30a49d,null))[_0x4e0c('0x41')](handleError(_0x30a49d,null));}; \ No newline at end of file +var _0xcba8=['body','catch','eml-format','rimraf','zip-dir','request-promise','moment','mustache','sox','lodash','squel','crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','destroy','then','end','name','send','index','map','rawAttributes','fieldName','type','key','model','keys','filters','intersection','attributes','fields','query','length','hasOwnProperty','order','sort','where','pick','merge','VIRTUAL','filter','SmsApplication','includeAll','include','findAll','rows','show','params','options','find','create'];(function(_0x39578c,_0x23635b){var _0x15ee51=function(_0x1fb117){while(--_0x1fb117){_0x39578c['push'](_0x39578c['shift']());}};_0x15ee51(++_0x23635b);}(_0xcba8,0x98));var _0x8cba=function(_0x258158,_0x2a54f6){_0x258158=_0x258158-0x0;var _0x4a7fb3=_0xcba8[_0x258158];return _0x4a7fb3;};'use strict';var emlformat=require(_0x8cba('0x0'));var rimraf=require(_0x8cba('0x1'));var zipdir=require(_0x8cba('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x8cba('0x3'));var moment=require(_0x8cba('0x4'));var BPromise=require('bluebird');var Mustache=require(_0x8cba('0x5'));var util=require('util');var path=require('path');var sox=require(_0x8cba('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x8cba('0x7'));var squel=require(_0x8cba('0x8'));var crypto=require(_0x8cba('0x9'));var jsforce=require(_0x8cba('0xa'));var deskjs=require(_0x8cba('0xb'));var toCsv=require(_0x8cba('0xc'));var querystring=require(_0x8cba('0xd'));var Papa=require(_0x8cba('0xe'));var Redis=require(_0x8cba('0xf'));var authService=require(_0x8cba('0x10'));var qs=require(_0x8cba('0x11'));var as=require(_0x8cba('0x12'));var hardwareService=require(_0x8cba('0x13'));var logger=require(_0x8cba('0x14'))('api');var utils=require(_0x8cba('0x15'));var config=require(_0x8cba('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x8cba('0x17'))['db'];function respondWithStatusCode(_0x3005c7,_0x2680bc){_0x2680bc=_0x2680bc||0xcc;return function(_0x37b825){if(_0x37b825){return _0x3005c7[_0x8cba('0x18')](_0x2680bc);}return _0x3005c7[_0x8cba('0x19')](_0x2680bc)['end']();};}function respondWithResult(_0x4d3293,_0x5a269b){_0x5a269b=_0x5a269b||0xc8;return function(_0x6f2914){if(_0x6f2914){return _0x4d3293[_0x8cba('0x19')](_0x5a269b)['json'](_0x6f2914);}};}function respondWithFilteredResult(_0x3832f1,_0x57a611){return function(_0x4e5322){if(_0x4e5322){var _0x5e632e=typeof _0x57a611[_0x8cba('0x1a')]===_0x8cba('0x1b')&&typeof _0x57a611[_0x8cba('0x1c')]==='undefined';var _0x85e2e3=_0x4e5322['count'];var _0xd626c8=_0x5e632e?0x0:_0x57a611[_0x8cba('0x1a')];var _0x3f95dc=_0x5e632e?_0x4e5322[_0x8cba('0x1d')]:_0x57a611[_0x8cba('0x1a')]+_0x57a611[_0x8cba('0x1c')];var _0x5aaa33;if(_0x3f95dc>=_0x85e2e3){_0x3f95dc=_0x85e2e3;_0x5aaa33=0xc8;}else{_0x5aaa33=0xce;}_0x3832f1[_0x8cba('0x19')](_0x5aaa33);return _0x3832f1[_0x8cba('0x1e')](_0x8cba('0x1f'),_0xd626c8+'-'+_0x3f95dc+'/'+_0x85e2e3)[_0x8cba('0x20')](_0x4e5322);}return null;};}function patchUpdates(_0x4772f0){return function(_0x2be3b8){try{jsonpatch[_0x8cba('0x21')](_0x2be3b8,_0x4772f0,!![]);}catch(_0x18c67c){return BPromise[_0x8cba('0x22')](_0x18c67c);}return _0x2be3b8['save']();};}function saveUpdates(_0xcebfb8,_0x4a6331){return function(_0x5d95eb){if(_0x5d95eb){return _0x5d95eb[_0x8cba('0x23')](_0xcebfb8)['then'](function(_0x12ac24){return _0x12ac24;});}return null;};}function removeEntity(_0x50b54f,_0x2c285a){return function(_0x2d2e2a){if(_0x2d2e2a){return _0x2d2e2a[_0x8cba('0x24')]()[_0x8cba('0x25')](function(){_0x50b54f[_0x8cba('0x19')](0xcc)[_0x8cba('0x26')]();});}};}function handleEntityNotFound(_0x28085d,_0x32e2aa){return function(_0x515f4f){if(!_0x515f4f){_0x28085d[_0x8cba('0x18')](0x194);}return _0x515f4f;};}function handleError(_0x29f971,_0x15808e){_0x15808e=_0x15808e||0x1f4;return function(_0x2ed53d){logger['error'](_0x2ed53d['stack']);if(_0x2ed53d[_0x8cba('0x27')]){delete _0x2ed53d[_0x8cba('0x27')];}_0x29f971[_0x8cba('0x19')](_0x15808e)[_0x8cba('0x28')](_0x2ed53d);};}exports[_0x8cba('0x29')]=function(_0x5c09b1,_0x3fe66e){var _0x436912={},_0x51843e={},_0x16b13f={'count':0x0,'rows':[]};var _0x359a1b=_[_0x8cba('0x2a')](db['SmsApplication'][_0x8cba('0x2b')],function(_0x5c1ad5){return{'name':_0x5c1ad5[_0x8cba('0x2c')],'type':_0x5c1ad5[_0x8cba('0x2d')][_0x8cba('0x2e')]};});_0x51843e[_0x8cba('0x2f')]=_['map'](_0x359a1b,'name');_0x51843e['query']=_[_0x8cba('0x30')](_0x5c09b1['query']);_0x51843e[_0x8cba('0x31')]=_[_0x8cba('0x32')](_0x51843e['model'],_0x51843e['query']);_0x436912[_0x8cba('0x33')]=_[_0x8cba('0x32')](_0x51843e[_0x8cba('0x2f')],qs[_0x8cba('0x34')](_0x5c09b1[_0x8cba('0x35')]['fields']));_0x436912[_0x8cba('0x33')]=_0x436912['attributes'][_0x8cba('0x36')]?_0x436912['attributes']:_0x51843e[_0x8cba('0x2f')];if(!_0x5c09b1[_0x8cba('0x35')][_0x8cba('0x37')]('nolimit')){_0x436912[_0x8cba('0x1c')]=qs[_0x8cba('0x1c')](_0x5c09b1[_0x8cba('0x35')]['limit']);_0x436912[_0x8cba('0x1a')]=qs[_0x8cba('0x1a')](_0x5c09b1[_0x8cba('0x35')][_0x8cba('0x1a')]);}_0x436912[_0x8cba('0x38')]=qs['sort'](_0x5c09b1[_0x8cba('0x35')][_0x8cba('0x39')]);_0x436912[_0x8cba('0x3a')]=qs[_0x8cba('0x31')](_[_0x8cba('0x3b')](_0x5c09b1[_0x8cba('0x35')],_0x51843e[_0x8cba('0x31')]),_0x359a1b);if(_0x5c09b1[_0x8cba('0x35')]['filter']){_0x436912['where']=_[_0x8cba('0x3c')](_0x436912[_0x8cba('0x3a')],{'$or':_[_0x8cba('0x2a')](_0x359a1b,function(_0x455eb5){if(_0x455eb5['type']!==_0x8cba('0x3d')){var _0x348be7={};_0x348be7[_0x455eb5['name']]={'$like':'%'+_0x5c09b1[_0x8cba('0x35')][_0x8cba('0x3e')]+'%'};return _0x348be7;}})});}_0x436912=_[_0x8cba('0x3c')]({},_0x436912,_0x5c09b1['options']);var _0x55882d={'where':_0x436912[_0x8cba('0x3a')]};return db[_0x8cba('0x3f')][_0x8cba('0x1d')](_0x55882d)[_0x8cba('0x25')](function(_0x2d741f){_0x16b13f['count']=_0x2d741f;if(_0x5c09b1[_0x8cba('0x35')][_0x8cba('0x40')]){_0x436912[_0x8cba('0x41')]=[{'all':!![]}];}return db['SmsApplication'][_0x8cba('0x42')](_0x436912);})[_0x8cba('0x25')](function(_0x332696){_0x16b13f[_0x8cba('0x43')]=_0x332696;return _0x16b13f;})[_0x8cba('0x25')](respondWithFilteredResult(_0x3fe66e,_0x436912))['catch'](handleError(_0x3fe66e,null));};exports[_0x8cba('0x44')]=function(_0x2efcae,_0x40f59f){var _0x24b115={'raw':!![],'where':{'id':_0x2efcae[_0x8cba('0x45')]['id']}},_0x221a41={};_0x221a41[_0x8cba('0x2f')]=_[_0x8cba('0x30')](db[_0x8cba('0x3f')][_0x8cba('0x2b')]);_0x221a41['query']=_[_0x8cba('0x30')](_0x2efcae[_0x8cba('0x35')]);_0x221a41[_0x8cba('0x31')]=_[_0x8cba('0x32')](_0x221a41[_0x8cba('0x2f')],_0x221a41[_0x8cba('0x35')]);_0x24b115[_0x8cba('0x33')]=_[_0x8cba('0x32')](_0x221a41[_0x8cba('0x2f')],qs[_0x8cba('0x34')](_0x2efcae[_0x8cba('0x35')][_0x8cba('0x34')]));_0x24b115[_0x8cba('0x33')]=_0x24b115[_0x8cba('0x33')][_0x8cba('0x36')]?_0x24b115[_0x8cba('0x33')]:_0x221a41['model'];if(_0x2efcae[_0x8cba('0x35')]['includeAll']){_0x24b115['include']=[{'all':!![]}];}_0x24b115=_[_0x8cba('0x3c')]({},_0x24b115,_0x2efcae[_0x8cba('0x46')]);return db['SmsApplication'][_0x8cba('0x47')](_0x24b115)[_0x8cba('0x25')](handleEntityNotFound(_0x40f59f,null))[_0x8cba('0x25')](respondWithResult(_0x40f59f,null))['catch'](handleError(_0x40f59f,null));};exports['create']=function(_0x26621f,_0x15231f){return db[_0x8cba('0x3f')][_0x8cba('0x48')](_0x26621f[_0x8cba('0x49')],{})[_0x8cba('0x25')](respondWithResult(_0x15231f,0xc9))[_0x8cba('0x4a')](handleError(_0x15231f,null));};exports[_0x8cba('0x23')]=function(_0x1064ce,_0x581180){if(_0x1064ce[_0x8cba('0x49')]['id']){delete _0x1064ce[_0x8cba('0x49')]['id'];}return db['SmsApplication'][_0x8cba('0x47')]({'where':{'id':_0x1064ce[_0x8cba('0x45')]['id']}})[_0x8cba('0x25')](handleEntityNotFound(_0x581180,null))[_0x8cba('0x25')](saveUpdates(_0x1064ce[_0x8cba('0x49')],null))[_0x8cba('0x25')](respondWithResult(_0x581180,null))[_0x8cba('0x4a')](handleError(_0x581180,null));};exports['destroy']=function(_0x2cf59f,_0x9a2479){return db[_0x8cba('0x3f')][_0x8cba('0x47')]({'where':{'id':_0x2cf59f['params']['id']}})[_0x8cba('0x25')](handleEntityNotFound(_0x9a2479,null))[_0x8cba('0x25')](removeEntity(_0x9a2479,null))[_0x8cba('0x4a')](handleError(_0x9a2479,null));}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.model.js b/server/api/smsApplication/smsApplication.model.js index 3e65cc6..8424c71 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 _0x27ff=['lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsApplication.attributes','exports','define','SmsApplication','sms_applications','utf8mb4'];(function(_0x2cf2e9,_0xd58ea1){var _0xd3670d=function(_0x272868){while(--_0x272868){_0x2cf2e9['push'](_0x2cf2e9['shift']());}};_0xd3670d(++_0xd58ea1);}(_0x27ff,0x78));var _0xf27f=function(_0x5d1044,_0x18f656){_0x5d1044=_0x5d1044-0x0;var _0x3cd90e=_0x27ff[_0x5d1044];return _0x3cd90e;};'use strict';var _=require(_0xf27f('0x0'));var util=require('util');var logger=require(_0xf27f('0x1'))(_0xf27f('0x2'));var moment=require(_0xf27f('0x3'));var BPromise=require(_0xf27f('0x4'));var rp=require(_0xf27f('0x5'));var fs=require('fs');var path=require(_0xf27f('0x6'));var rimraf=require(_0xf27f('0x7'));var config=require(_0xf27f('0x8'));var attributes=require(_0xf27f('0x9'));module[_0xf27f('0xa')]=function(_0x10f950,_0x262024){return _0x10f950[_0xf27f('0xb')](_0xf27f('0xc'),attributes,{'tableName':_0xf27f('0xd'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xf27f('0xe'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x6086=['moment','bluebird','../../config/environment','./smsApplication.attributes','SmsApplication','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','api'];(function(_0x5dc508,_0x52a2de){var _0x186735=function(_0x1e8ec8){while(--_0x1e8ec8){_0x5dc508['push'](_0x5dc508['shift']());}};_0x186735(++_0x52a2de);}(_0x6086,0xcd));var _0x6608=function(_0x20c124,_0x495bb8){_0x20c124=_0x20c124-0x0;var _0x5ac2bc=_0x6086[_0x20c124];return _0x5ac2bc;};'use strict';var _=require(_0x6608('0x0'));var util=require(_0x6608('0x1'));var logger=require(_0x6608('0x2'))(_0x6608('0x3'));var moment=require(_0x6608('0x4'));var BPromise=require(_0x6608('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x6608('0x6'));var attributes=require(_0x6608('0x7'));module['exports']=function(_0x11636b,_0x5ad5c0){return _0x11636b['define'](_0x6608('0x8'),attributes,{'tableName':'sms_applications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x6608('0x9'),'collate':_0x6608('0xa')});}; \ No newline at end of file diff --git a/server/api/smsApplication/smsApplication.rpc.js b/server/api/smsApplication/smsApplication.rpc.js index 7e6f62b..aecd6a3 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 _0xbca0=['stringify','error','code','SmsApplication,\x20%s,\x20%s','message','result','catch','lodash','util','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','then','info','debug','SmsApplication,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x11ce46,_0x7a1715){var _0x272001=function(_0x38c599){while(--_0x38c599){_0x11ce46['push'](_0x11ce46['shift']());}};_0x272001(++_0x7a1715);}(_0xbca0,0x8b));var _0x0bca=function(_0x2b23e5,_0x2265ad){_0x2b23e5=_0x2b23e5-0x0;var _0x7f0e5a=_0xbca0[_0x2b23e5];return _0x7f0e5a;};'use strict';var _=require(_0x0bca('0x0'));var util=require(_0x0bca('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x0bca('0x2'));var db=require(_0x0bca('0x3'))['db'];var utils=require(_0x0bca('0x4'));var logger=require(_0x0bca('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x0bca('0x6'));var client=jayson[_0x0bca('0x7')][_0x0bca('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x454627,_0x4dcba6,_0x48260c){return new BPromise(function(_0x55fbf0,_0x241ca5){return client[_0x0bca('0x9')](_0x454627,_0x48260c)[_0x0bca('0xa')](function(_0x206194){logger[_0x0bca('0xb')]('SmsApplication,\x20%s,\x20%s',_0x4dcba6,'request\x20sent');logger[_0x0bca('0xc')](_0x0bca('0xd'),_0x4dcba6,_0x0bca('0xe'),JSON[_0x0bca('0xf')](_0x206194));if(_0x206194[_0x0bca('0x10')]){if(_0x206194[_0x0bca('0x10')][_0x0bca('0x11')]===0x1f4){logger[_0x0bca('0x10')](_0x0bca('0x12'),_0x4dcba6,_0x206194[_0x0bca('0x10')][_0x0bca('0x13')]);return _0x241ca5(_0x206194[_0x0bca('0x10')][_0x0bca('0x13')]);}logger[_0x0bca('0x10')](_0x0bca('0x12'),_0x4dcba6,_0x206194[_0x0bca('0x10')][_0x0bca('0x13')]);return _0x55fbf0(_0x206194[_0x0bca('0x10')][_0x0bca('0x13')]);}else{logger['info'](_0x0bca('0x12'),_0x4dcba6,_0x0bca('0xe'));_0x55fbf0(_0x206194[_0x0bca('0x14')][_0x0bca('0x13')]);}})[_0x0bca('0x15')](function(_0x2ed970){logger[_0x0bca('0x10')]('SmsApplication,\x20%s,\x20%s',_0x4dcba6,_0x2ed970);_0x241ca5(_0x2ed970);});});} \ No newline at end of file +var _0xf3e2=['rpc','jayson/promise','client','http','then','info','SmsApplication,\x20%s,\x20%s','request\x20sent','debug','SmsApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xf3e2,0x168));var _0x2f3e=function(_0x2fc1f6,_0x51543e){_0x2fc1f6=_0x2fc1f6-0x0;var _0x7a3346=_0xf3e2[_0x2fc1f6];return _0x7a3346;};'use strict';var _=require(_0x2f3e('0x0'));var util=require(_0x2f3e('0x1'));var moment=require(_0x2f3e('0x2'));var BPromise=require(_0x2f3e('0x3'));var rs=require(_0x2f3e('0x4'));var fs=require('fs');var Redis=require(_0x2f3e('0x5'));var db=require(_0x2f3e('0x6'))['db'];var utils=require(_0x2f3e('0x7'));var logger=require('../../config/logger')(_0x2f3e('0x8'));var config=require('../../config/environment');var jayson=require(_0x2f3e('0x9'));var client=jayson[_0x2f3e('0xa')][_0x2f3e('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x392f91,_0x3b556b,_0x1ac142){return new BPromise(function(_0x30f939,_0x46ec1b){return client['request'](_0x392f91,_0x1ac142)[_0x2f3e('0xc')](function(_0x4d7f7d){logger[_0x2f3e('0xd')](_0x2f3e('0xe'),_0x3b556b,_0x2f3e('0xf'));logger[_0x2f3e('0x10')](_0x2f3e('0x11'),_0x3b556b,_0x2f3e('0xf'),JSON[_0x2f3e('0x12')](_0x4d7f7d));if(_0x4d7f7d[_0x2f3e('0x13')]){if(_0x4d7f7d[_0x2f3e('0x13')][_0x2f3e('0x14')]===0x1f4){logger[_0x2f3e('0x13')](_0x2f3e('0xe'),_0x3b556b,_0x4d7f7d['error'][_0x2f3e('0x15')]);return _0x46ec1b(_0x4d7f7d['error'][_0x2f3e('0x15')]);}logger[_0x2f3e('0x13')]('SmsApplication,\x20%s,\x20%s',_0x3b556b,_0x4d7f7d['error'][_0x2f3e('0x15')]);return _0x30f939(_0x4d7f7d[_0x2f3e('0x13')][_0x2f3e('0x15')]);}else{logger[_0x2f3e('0xd')](_0x2f3e('0xe'),_0x3b556b,_0x2f3e('0xf'));_0x30f939(_0x4d7f7d['result'][_0x2f3e('0x15')]);}})[_0x2f3e('0x16')](function(_0x15398d){logger[_0x2f3e('0x13')]('SmsApplication,\x20%s,\x20%s',_0x3b556b,_0x15398d);_0x46ec1b(_0x15398d);});});} \ No newline at end of file diff --git a/server/api/smsInteraction/index.js b/server/api/smsInteraction/index.js index 92c46bc..634f144 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 _0xb62e=['removeTags','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','get','describe','/:id','/:id/messages','getMessages','/:id/download','download','post','addMessage','/:id/tags','tracked','smsinteraction:addtags','addTags','put','sms','smsinteraction:update','update','delete','smsinteraction:destroy','destroy'];(function(_0x362480,_0x73fcd1){var _0x1dd0ba=function(_0x4f674e){while(--_0x4f674e){_0x362480['push'](_0x362480['shift']());}};_0x1dd0ba(++_0x73fcd1);}(_0xb62e,0x1de));var _0xeb62=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0xb62e[_0x501510];return _0x1e6ee5;};'use strict';var multer=require(_0xeb62('0x0'));var util=require(_0xeb62('0x1'));var path=require(_0xeb62('0x2'));var timeout=require(_0xeb62('0x3'));var express=require('express');var router=express[_0xeb62('0x4')]();var fs_extra=require(_0xeb62('0x5'));var auth=require(_0xeb62('0x6'));var interaction=require(_0xeb62('0x7'));var config=require(_0xeb62('0x8'));var controller=require(_0xeb62('0x9'));router['get']('/',auth[_0xeb62('0xa')](),controller[_0xeb62('0xb')]);router[_0xeb62('0xc')]('/describe',auth[_0xeb62('0xa')](),controller[_0xeb62('0xd')]);router[_0xeb62('0xc')](_0xeb62('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xeb62('0xc')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x10')]);router[_0xeb62('0xc')](_0xeb62('0x11'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x12')]);router[_0xeb62('0x13')]('/',auth[_0xeb62('0xa')](),controller['create']);router[_0xeb62('0x13')](_0xeb62('0xf'),auth[_0xeb62('0xa')](),controller[_0xeb62('0x14')]);router['post'](_0xeb62('0x15'),auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')]('sms',_0xeb62('0x17')),controller[_0xeb62('0x18')]);router[_0xeb62('0x19')]('/:id',auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')](_0xeb62('0x1a'),_0xeb62('0x1b')),controller[_0xeb62('0x1c')]);router[_0xeb62('0x1d')](_0xeb62('0xe'),auth[_0xeb62('0xa')](),interaction[_0xeb62('0x16')](_0xeb62('0x1a'),_0xeb62('0x1e')),controller[_0xeb62('0x1f')]);router[_0xeb62('0x1d')]('/:id/tags',auth[_0xeb62('0xa')](),controller[_0xeb62('0x20')]);module[_0xeb62('0x21')]=router; \ No newline at end of file +var _0x4fc2=['removeTags','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./smsInteraction.controller','isAuthenticated','index','/describe','describe','get','/:id','/:id/messages','getMessages','/:id/download','download','create','addMessage','post','/:id/tags','sms','smsinteraction:addtags','addTags','put','smsinteraction:update','update','delete','tracked','smsinteraction:destroy','destroy'];(function(_0x41fb10,_0x1aca33){var _0x3ac44a=function(_0x4c2f57){while(--_0x4c2f57){_0x41fb10['push'](_0x41fb10['shift']());}};_0x3ac44a(++_0x1aca33);}(_0x4fc2,0x111));var _0x24fc=function(_0x1a0daa,_0x2a4634){_0x1a0daa=_0x1a0daa-0x0;var _0x1dbe15=_0x4fc2[_0x1a0daa];return _0x1dbe15;};'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')](_0x24fc('0xe'),auth[_0x24fc('0x9')](),controller['show']);router[_0x24fc('0xd')](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x10')]);router[_0x24fc('0xd')](_0x24fc('0x11'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x12')]);router['post']('/',auth[_0x24fc('0x9')](),controller[_0x24fc('0x13')]);router['post'](_0x24fc('0xf'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x14')]);router[_0x24fc('0x15')](_0x24fc('0x16'),auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x18')),controller[_0x24fc('0x19')]);router[_0x24fc('0x1a')]('/:id',auth[_0x24fc('0x9')](),interaction['tracked'](_0x24fc('0x17'),_0x24fc('0x1b')),controller[_0x24fc('0x1c')]);router[_0x24fc('0x1d')](_0x24fc('0xe'),auth['isAuthenticated'](),interaction[_0x24fc('0x1e')](_0x24fc('0x17'),_0x24fc('0x1f')),controller[_0x24fc('0x20')]);router['delete'](_0x24fc('0x16'),auth[_0x24fc('0x9')](),controller[_0x24fc('0x21')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.attributes.js b/server/api/smsInteraction/smsInteraction.attributes.js index 3a91bc3..60cdddd 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 _0x737d=['moment','STRING','DATE','ENUM','out','BOOLEAN','sequelize'];(function(_0x48d4ba,_0x227896){var _0x3f2a86=function(_0x3be05e){while(--_0x3be05e){_0x48d4ba['push'](_0x48d4ba['shift']());}};_0x3f2a86(++_0x227896);}(_0x737d,0xbc));var _0xd737=function(_0x22d468,_0x302fd6){_0x22d468=_0x22d468-0x0;var _0x49cb97=_0x737d[_0x22d468];return _0x49cb97;};'use strict';var Sequelize=require(_0xd737('0x0'));var moment=require(_0xd737('0x1'));module['exports']={'closed':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xd737('0x2')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0xd737('0x2')]},'phone':{'type':Sequelize['STRING']},'read1stAt':{'type':Sequelize[_0xd737('0x3')]},'firstMsgDirection':{'type':Sequelize[_0xd737('0x4')]('in',_0xd737('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xd737('0x3')]},'lastMsgDirection':{'type':Sequelize[_0xd737('0x4')]('in',_0xd737('0x5')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xd737('0x6')],'defaultValue':![]}}; \ No newline at end of file +var _0xec39=['moment','exports','BOOLEAN','DATE','STRING','ENUM','out','sequelize'];(function(_0x34692a,_0x2b3382){var _0x2db8bd=function(_0x490872){while(--_0x490872){_0x34692a['push'](_0x34692a['shift']());}};_0x2db8bd(++_0x2b3382);}(_0xec39,0x19f));var _0x9ec3=function(_0xe267c8,_0x2d605b){_0xe267c8=_0xe267c8-0x0;var _0x6f9f5e=_0xec39[_0xe267c8];return _0x6f9f5e;};'use strict';var Sequelize=require(_0x9ec3('0x0'));var moment=require(_0x9ec3('0x1'));module[_0x9ec3('0x2')]={'closed':{'type':Sequelize[_0x9ec3('0x3')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x9ec3('0x4')]},'disposition':{'type':Sequelize[_0x9ec3('0x5')]},'secondDisposition':{'type':Sequelize[_0x9ec3('0x5')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize[_0x9ec3('0x5')]},'phone':{'type':Sequelize[_0x9ec3('0x5')]},'read1stAt':{'type':Sequelize[_0x9ec3('0x4')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x9ec3('0x6')]('in',_0x9ec3('0x7')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0x9ec3('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.controller.js b/server/api/smsInteraction/smsInteraction.controller.js index 0a9d1ec..08bc775 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 _0xe811=['SmsMessage','ids','omit','getMessages','findOne','fields','length','hasOwnProperty','nolimit','order','where','filters','pick','$gte','split','format','YYYY-MM-DD\x20HH:mm:ss','addTags','setTags','spread','Tag','color','emit','removeTags','download','unix','toString','root','server','files','tmp','join','push','User','fullname','CmContact','firstName','Messages','direction','secret','read','Account','get','mkdirSync','Sms','createdAt','closed','closedAt','disposition','filter','System','Contact','lastName','out','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','log','err','unlinkSync','rimraf','zip-dir','bluebird','util','ejs','ioredis','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','offset','limit','count','update','then','destroy','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','getOptions','findAll','sms','query','user','catch','show','keys','intersection','attributes','model','includeAll','include','merge','options','find','create','body','params','describe','addMessage'];(function(_0x2d417d,_0x40e0ff){var _0x103155=function(_0x137fab){while(--_0x137fab){_0x2d417d['push'](_0x2d417d['shift']());}};_0x103155(++_0x40e0ff);}(_0xe811,0x1a8));var _0x1e81=function(_0xa68cd9,_0x35b670){_0xa68cd9=_0xa68cd9-0x0;var _0x567abc=_0xe811[_0xa68cd9];return _0x567abc;};'use strict';var rimraf=require(_0x1e81('0x0'));var zipdir=require(_0x1e81('0x1'));var moment=require('moment');var BPromise=require(_0x1e81('0x2'));var util=require(_0x1e81('0x3'));var path=require('path');var ejs=require(_0x1e81('0x4'));var fs=require('fs');var _=require('lodash');var Redis=require(_0x1e81('0x5'));var interaction=require(_0x1e81('0x6'));var qs=require(_0x1e81('0x7'));var pdf=require(_0x1e81('0x8'));var logger=require(_0x1e81('0x9'))(_0x1e81('0xa'));var config=require(_0x1e81('0xb'));var db=require(_0x1e81('0xc'))['db'];config[_0x1e81('0xd')]=_[_0x1e81('0xe')](config[_0x1e81('0xd')],{'host':_0x1e81('0xf'),'port':0x18eb});var socket=require(_0x1e81('0x10'))(new Redis(config[_0x1e81('0xd')]));require('./smsInteraction.socket')['register'](socket);function respondWithStatusCode(_0x3ba9ec,_0x5c689e){_0x5c689e=_0x5c689e||0xcc;return function(_0x15d432){if(_0x15d432){return _0x3ba9ec[_0x1e81('0x11')](_0x5c689e);}return _0x3ba9ec[_0x1e81('0x12')](_0x5c689e)[_0x1e81('0x13')]();};}function respondWithResult(_0xf698f3,_0x32b0f5){_0x32b0f5=_0x32b0f5||0xc8;return function(_0x586858){if(_0x586858){return _0xf698f3['status'](_0x32b0f5)[_0x1e81('0x14')](_0x586858);}};}function respondWithFilteredResult(_0x5883f7,_0x166d40){return function(_0x111924){if(_0x111924){var _0x42bb6a=typeof _0x166d40[_0x1e81('0x15')]==='undefined'&&typeof _0x166d40[_0x1e81('0x16')]==='undefined';var _0x1375c4=_0x111924[_0x1e81('0x17')];var _0x2c7b6b=_0x42bb6a?0x0:_0x166d40[_0x1e81('0x15')];var _0x11d4e1=_0x42bb6a?_0x111924['count']:_0x166d40['offset']+_0x166d40[_0x1e81('0x16')];var _0x1bf69c;if(_0x11d4e1>=_0x1375c4){_0x11d4e1=_0x1375c4;_0x1bf69c=0xc8;}else{_0x1bf69c=0xce;}_0x5883f7[_0x1e81('0x12')](_0x1bf69c);return _0x5883f7['set']('Content-Range',_0x2c7b6b+'-'+_0x11d4e1+'/'+_0x1375c4)[_0x1e81('0x14')](_0x111924);}return null;};}function saveUpdates(_0x356c55){return function(_0x58876f){if(_0x58876f){return _0x58876f[_0x1e81('0x18')](_0x356c55)[_0x1e81('0x19')](function(_0x240581){return _0x240581;});}return null;};}function removeEntity(_0xfa5146){return function(_0xd4586d){if(_0xd4586d){return _0xd4586d[_0x1e81('0x1a')]()[_0x1e81('0x19')](function(){_0xfa5146[_0x1e81('0x12')](0xcc)[_0x1e81('0x13')]();});}};}function handleEntityNotFound(_0x4300d6){return function(_0x29d9d9){if(!_0x29d9d9){_0x4300d6[_0x1e81('0x11')](0x194);}return _0x29d9d9;};}function handleError(_0x258fe4,_0x4f4ab6){_0x4f4ab6=_0x4f4ab6||0x1f4;return function(_0xf81469){logger['error'](_0xf81469[_0x1e81('0x1b')]);if(_0xf81469[_0x1e81('0x1c')]){delete _0xf81469['name'];}_0x258fe4[_0x1e81('0x12')](_0x4f4ab6)[_0x1e81('0x1d')](_0xf81469);};}exports[_0x1e81('0x1e')]=function(_0x15fad9,_0x3654b1){var _0x7eb085={};var _0x43df7b=_[_0x1e81('0x1f')](db[_0x1e81('0x20')][_0x1e81('0x21')],function(_0x25bad4){return{'name':_0x25bad4[_0x1e81('0x22')],'type':_0x25bad4['type']['key']};});_0x7eb085=qs[_0x1e81('0x23')](_0x43df7b,_0x15fad9);return interaction[_0x1e81('0x24')](_0x1e81('0x25'),_0x15fad9[_0x1e81('0x26')],_0x15fad9[_0x1e81('0x27')],_0x7eb085,_0x43df7b)[_0x1e81('0x19')](respondWithFilteredResult(_0x3654b1,_0x7eb085))[_0x1e81('0x28')](handleError(_0x3654b1,null));};exports[_0x1e81('0x29')]=function(_0x214f34,_0x322a38){var _0x1cf43f={'raw':![],'where':{'id':_0x214f34['params']['id']}},_0x1be496={};_0x1be496['model']=_[_0x1e81('0x2a')](db[_0x1e81('0x20')][_0x1e81('0x21')]);_0x1be496[_0x1e81('0x26')]=_[_0x1e81('0x2a')](_0x214f34[_0x1e81('0x26')]);_0x1be496['filters']=_['intersection'](_0x1be496['model'],_0x1be496[_0x1e81('0x26')]);_0x1cf43f['attributes']=_[_0x1e81('0x2b')](_0x1be496['model'],qs['fields'](_0x214f34[_0x1e81('0x26')]['fields']));_0x1cf43f['attributes']=_0x1cf43f['attributes']['length']?_0x1cf43f[_0x1e81('0x2c')]:_0x1be496[_0x1e81('0x2d')];if(_0x214f34['query'][_0x1e81('0x2e')]){_0x1cf43f[_0x1e81('0x2f')]=[{'all':!![]}];}_0x1cf43f=_[_0x1e81('0x30')]({},_0x1cf43f,_0x214f34[_0x1e81('0x31')]);return db[_0x1e81('0x20')][_0x1e81('0x32')](_0x1cf43f)[_0x1e81('0x19')](handleEntityNotFound(_0x322a38,null))[_0x1e81('0x19')](respondWithResult(_0x322a38,null))[_0x1e81('0x28')](handleError(_0x322a38,null));};exports[_0x1e81('0x33')]=function(_0x365157,_0x27ab12){return db['SmsInteraction'][_0x1e81('0x33')](_0x365157[_0x1e81('0x34')],{})[_0x1e81('0x19')](respondWithResult(_0x27ab12,0xc9))['catch'](handleError(_0x27ab12,null));};exports[_0x1e81('0x18')]=function(_0x130020,_0x543a6d){if(_0x130020[_0x1e81('0x34')]['id']){delete _0x130020[_0x1e81('0x34')]['id'];}return db[_0x1e81('0x20')][_0x1e81('0x32')]({'where':{'id':_0x130020[_0x1e81('0x35')]['id']}})[_0x1e81('0x19')](handleEntityNotFound(_0x543a6d,null))[_0x1e81('0x19')](saveUpdates(_0x130020[_0x1e81('0x34')],null))['then'](respondWithResult(_0x543a6d,null))[_0x1e81('0x28')](handleError(_0x543a6d,null));};exports[_0x1e81('0x1a')]=function(_0x1661c1,_0x3eb832){return db['SmsInteraction'][_0x1e81('0x32')]({'where':{'id':_0x1661c1['params']['id']}})['then'](handleEntityNotFound(_0x3eb832,null))['then'](removeEntity(_0x3eb832,null))[_0x1e81('0x28')](handleError(_0x3eb832,null));};exports[_0x1e81('0x36')]=function(_0xbf9418,_0x55b506){return db[_0x1e81('0x20')][_0x1e81('0x36')]()[_0x1e81('0x19')](respondWithResult(_0x55b506,null))[_0x1e81('0x28')](handleError(_0x55b506,null));};exports[_0x1e81('0x37')]=function(_0x42c761,_0x3a9d20){return db[_0x1e81('0x38')][_0x1e81('0x32')]({'where':{'id':_0x42c761['params']['id']}})[_0x1e81('0x19')](handleEntityNotFound(_0x3a9d20,null))['then'](function(_0x3d4d4f){if(_0x3d4d4f){return _0x3d4d4f['addMessage'](_0x42c761[_0x1e81('0x34')][_0x1e81('0x39')],_[_0x1e81('0x3a')](_0x42c761[_0x1e81('0x34')],[_0x1e81('0x39'),'id'])||{});}})[_0x1e81('0x19')](respondWithResult(_0x3a9d20,null))[_0x1e81('0x28')](handleError(_0x3a9d20,null));};exports[_0x1e81('0x3b')]=function(_0xb7cdc8,_0x3015de){var _0x5acd9e={'raw':![],'where':{}};var _0x1ecfe7={};var _0x3793ca={'count':0x0,'rows':[]};return db[_0x1e81('0x20')][_0x1e81('0x3c')]({'where':{'id':_0xb7cdc8['params']['id']}})[_0x1e81('0x19')](handleEntityNotFound(_0x3015de,null))[_0x1e81('0x19')](function(_0x92732e){if(_0x92732e){_0x1ecfe7[_0x1e81('0x2d')]=_[_0x1e81('0x2a')](db['SmsMessage'][_0x1e81('0x21')]);_0x1ecfe7['query']=_[_0x1e81('0x2a')](_0xb7cdc8['query']);_0x1ecfe7['filters']=_[_0x1e81('0x2b')](_0x1ecfe7['model'],_0x1ecfe7['query']);_0x5acd9e[_0x1e81('0x2c')]=_['intersection'](_0x1ecfe7[_0x1e81('0x2d')],qs[_0x1e81('0x3d')](_0xb7cdc8['query'][_0x1e81('0x3d')]));_0x5acd9e[_0x1e81('0x2c')]=_0x5acd9e[_0x1e81('0x2c')][_0x1e81('0x3e')]?_0x5acd9e['attributes']:_0x1ecfe7['model'];if(!_0xb7cdc8[_0x1e81('0x26')][_0x1e81('0x3f')](_0x1e81('0x40'))){_0x5acd9e[_0x1e81('0x16')]=qs['limit'](_0xb7cdc8[_0x1e81('0x26')]['limit']);_0x5acd9e['offset']=qs[_0x1e81('0x15')](_0xb7cdc8[_0x1e81('0x26')]['offset']);}_0x5acd9e[_0x1e81('0x41')]=qs['sort'](_0xb7cdc8[_0x1e81('0x26')]['sort']);_0x5acd9e[_0x1e81('0x42')]=qs[_0x1e81('0x43')](_[_0x1e81('0x44')](_0xb7cdc8[_0x1e81('0x26')],_0x1ecfe7['filters']));_0x5acd9e[_0x1e81('0x42')]['SmsInteractionId']=_0x92732e['id'];if(_0xb7cdc8[_0x1e81('0x26')]['filter']){_0x5acd9e[_0x1e81('0x42')]=_[_0x1e81('0x30')](_0x5acd9e[_0x1e81('0x42')],{'$or':_[_0x1e81('0x1f')](_0x5acd9e[_0x1e81('0x2c')],function(_0x44a79f){var _0x4a7a49={};_0x4a7a49[_0x44a79f]={'$like':'%'+_0xb7cdc8[_0x1e81('0x26')]['filter']+'%'};return _0x4a7a49;})});}if(_0xb7cdc8[_0x1e81('0x26')][_0x1e81('0x45')]){var _0x4564e0=_0xb7cdc8[_0x1e81('0x26')][_0x1e81('0x45')][_0x1e81('0x46')](',');var _0x27d600={};_0x27d600[_0x4564e0[0x0]]={'$gte':moment(_0x4564e0[0x1])[_0x1e81('0x47')](_0x1e81('0x48'))};_0x5acd9e[_0x1e81('0x42')]=_[_0x1e81('0x30')](_0x5acd9e[_0x1e81('0x42')],_0x27d600);}_0x5acd9e=_['merge']({},_0x5acd9e,_0xb7cdc8[_0x1e81('0x31')]);return db[_0x1e81('0x38')][_0x1e81('0x17')]({'where':_0x5acd9e['where']})['then'](function(_0x370607){_0x3793ca[_0x1e81('0x17')]=_0x370607;if(_0xb7cdc8[_0x1e81('0x26')][_0x1e81('0x2e')]){_0x5acd9e[_0x1e81('0x2f')]=[{'all':!![]}];}return db[_0x1e81('0x38')]['findAll'](_0x5acd9e);})[_0x1e81('0x19')](function(_0x3ebdfb){_0x3793ca['rows']=_0x3ebdfb;return _0x3793ca;});}})[_0x1e81('0x19')](respondWithFilteredResult(_0x3015de,_0x5acd9e))[_0x1e81('0x28')](handleError(_0x3015de,null));};exports[_0x1e81('0x49')]=function(_0x44c3c2,_0x4617bb){return db[_0x1e81('0x20')][_0x1e81('0x32')]({'where':{'id':_0x44c3c2[_0x1e81('0x35')]['id']}})[_0x1e81('0x19')](handleEntityNotFound(_0x4617bb,null))[_0x1e81('0x19')](function(_0x362c24){if(_0x362c24){return _0x362c24[_0x1e81('0x4a')](_0x44c3c2[_0x1e81('0x34')][_0x1e81('0x39')],_[_0x1e81('0x3a')](_0x44c3c2[_0x1e81('0x34')],['ids','id'])||{})[_0x1e81('0x4b')](function(){return db[_0x1e81('0x4c')][_0x1e81('0x24')]({'attributes':['id',_0x1e81('0x1c'),_0x1e81('0x4d')],'where':{'id':_0x44c3c2['body'][_0x1e81('0x39')]}});})[_0x1e81('0x19')](function(_0x3152ed){socket[_0x1e81('0x4e')]('smsInteractionTags:save',{'id':Number(_0x44c3c2[_0x1e81('0x35')]['id']),'tags':_0x3152ed||[]});return{'id':Number(_0x44c3c2['params']['id']),'tags':_0x3152ed||[]};});}})[_0x1e81('0x19')](respondWithResult(_0x4617bb,null))['catch'](handleError(_0x4617bb,null));};exports[_0x1e81('0x4f')]=function(_0x4abf05,_0x32cae4){return db[_0x1e81('0x20')][_0x1e81('0x32')]({'where':{'id':_0x4abf05['params']['id']}})[_0x1e81('0x19')](handleEntityNotFound(_0x32cae4,null))[_0x1e81('0x19')](function(_0x1bfcc2){if(_0x1bfcc2){return _0x1bfcc2[_0x1e81('0x4f')](_0x4abf05[_0x1e81('0x26')][_0x1e81('0x39')]);}})[_0x1e81('0x19')](respondWithStatusCode(_0x32cae4,null))[_0x1e81('0x28')](handleError(_0x32cae4,null));};exports[_0x1e81('0x50')]=function(_0x27db0b,_0x53a9a8){var _0x4974a5=moment()[_0x1e81('0x51')]()[_0x1e81('0x52')]();var _0x21c508=path['join'](config[_0x1e81('0x53')],_0x1e81('0x54'),_0x1e81('0x55'),_0x1e81('0x56'));var _0x2eae38=path[_0x1e81('0x57')](_0x21c508,_0x4974a5);var _0x584d36=util['format']('transcript-%d-%s.zip',_0x27db0b[_0x1e81('0x35')]['id'],_0x4974a5);var _0x2e6bf1=path[_0x1e81('0x57')](_0x21c508,_0x584d36);var _0x209a0a=[];_0x209a0a[_0x1e81('0x58')]({'model':db[_0x1e81('0x59')],'as':'User','attributes':['id',_0x1e81('0x5a')],'raw':!![]});_0x209a0a['push']({'model':db[_0x1e81('0x5b')],'as':'Contact','attributes':['id',_0x1e81('0x5c'),'lastName'],'raw':!![]});var _0x13fda5=[{'model':db[_0x1e81('0x38')],'as':_0x1e81('0x5d'),'attributes':['id',_0x1e81('0x34'),'createdAt',_0x1e81('0x5e'),_0x1e81('0x5f'),_0x1e81('0x60')],'include':_0x209a0a}];_0x13fda5['push']({'model':db['SmsAccount'],'as':_0x1e81('0x61'),'attributes':['id',_0x1e81('0x1c')]});_0x13fda5[_0x1e81('0x58')]({'model':db[_0x1e81('0x59')],'as':'Owner','attributes':['id',_0x1e81('0x5a')]});return db['SmsInteraction'][_0x1e81('0x32')]({'where':{'id':_0x27db0b[_0x1e81('0x35')]['id']},'include':_0x13fda5})[_0x1e81('0x19')](handleEntityNotFound(_0x53a9a8,null))[_0x1e81('0x19')](function(_0x2a49d3){if(_0x2a49d3){var _0x1654d4=_0x2a49d3[_0x1e81('0x62')]({'plain':!![]});fs[_0x1e81('0x63')](_0x2eae38);var _0x429704={'channel':_0x1e81('0x64'),'account':_0x1654d4[_0x1e81('0x61')]['name'],'agent':_0x1654d4['Owner']?_0x1654d4['Owner'][_0x1e81('0x5a')]:'N.A.','createdAt':moment(_0x1654d4[_0x1e81('0x65')])[_0x1e81('0x47')](_0x1e81('0x48'))['toString'](),'closedAt':_0x1654d4[_0x1e81('0x66')]?moment(_0x1654d4[_0x1e81('0x67')])['format'](_0x1e81('0x48'))[_0x1e81('0x52')]():'','disposition':_0x1654d4[_0x1e81('0x68')],'messages':_(_0x1654d4[_0x1e81('0x5d')])[_0x1e81('0x69')]({'secret':![]})['map'](function(_0x186303){return{'date':moment(_0x186303[_0x1e81('0x65')])['format']('YYYY-MM-DD\x20HH:mm:ss')[_0x1e81('0x52')](),'sender':_0x186303[_0x1e81('0x5e')]==='out'?_0x186303[_0x1e81('0x59')]?_0x186303[_0x1e81('0x59')][_0x1e81('0x5a')]:_0x1e81('0x6a'):_0x186303[_0x1e81('0x6b')][_0x1e81('0x5c')]+(_0x186303[_0x1e81('0x6b')][_0x1e81('0x6c')]?'\x20'+_0x186303['Contact']['lastName']:''),'body':_0x186303[_0x1e81('0x34')],'direction':_0x186303[_0x1e81('0x5e')]===_0x1e81('0x6d')?'A':'C','secret':_0x186303[_0x1e81('0x5f')],'read':_0x186303[_0x1e81('0x60')]};})[_0x1e81('0x6e')]()};return ejs[_0x1e81('0x6f')](path[_0x1e81('0x57')](config[_0x1e81('0x53')],_0x1e81('0x54'),_0x1e81('0x70'),_0x1e81('0x71')),{'interaction':_0x429704})['then'](function(_0x1b8804){var _0x54ea9d=path['join'](_0x2eae38,_0x1e81('0x72')+_0x1654d4['id']+'-'+_0x4974a5+_0x1e81('0x73'));var _0x34f0dc={'path':_0x54ea9d,'channel':_0x1e81('0x64'),'interactionId':_0x1654d4['id']};return pdf[_0x1e81('0x74')](_0x1b8804,_0x34f0dc);})[_0x1e81('0x19')](function(){return new BPromise(function(_0x13ade9,_0x5e863a){zipdir(_0x2eae38,{'saveTo':_0x2e6bf1},function(_0x17efc5,_0x186634){if(_0x17efc5)return _0x5e863a(_0x17efc5);return _0x13ade9(_0x186634);});})[_0x1e81('0x19')](function(){return new BPromise(function(_0x1bd9db,_0x281050){rimraf(_0x2eae38,function(_0x1c6f3b){if(_0x1c6f3b)_0x281050(_0x1c6f3b);return _0x1bd9db();});});})[_0x1e81('0x19')](function(){return _0x53a9a8['download'](_0x2e6bf1,_0x584d36,function(_0x1fb3b2){if(_0x1fb3b2){console[_0x1e81('0x75')](_0x1e81('0x76'),_0x1fb3b2);}else{fs[_0x1e81('0x77')](_0x2e6bf1);}});});});}else{return _0x53a9a8[_0x1e81('0x11')](0xc8);}})['catch'](handleError(_0x53a9a8,null));}; \ No newline at end of file +var _0x2494=['join','root','views','downloadInteraction.ejs','transcript-','.pdf','createPdfFromHTML','download','log','err','unlinkSync','rimraf','moment','bluebird','util','path','ejs','lodash','../../components/parsers/qs','../../config/logger','api','../../config/environment','redis','defaults','./smsInteraction.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','then','destroy','end','error','stack','name','send','index','map','SmsInteraction','rawAttributes','fieldName','type','getOptions','findAll','sms','query','show','params','keys','filters','model','intersection','fields','attributes','length','includeAll','options','find','catch','create','body','update','describe','addMessage','SmsMessage','ids','getMessages','hasOwnProperty','nolimit','sort','where','SmsInteractionId','filter','$gte','format','YYYY-MM-DD\x20HH:mm:ss','merge','rows','addTags','setTags','omit','spread','Tag','emit','smsInteractionTags:save','removeTags','server','files','tmp','push','User','fullname','CmContact','Contact','firstName','Messages','createdAt','direction','secret','SmsAccount','Account','Owner','get','Sms','N.A.','toString','closed','disposition','out','System','lastName','value','renderFile'];(function(_0x13309c,_0x5266eb){var _0x2de76c=function(_0x3915f4){while(--_0x3915f4){_0x13309c['push'](_0x13309c['shift']());}};_0x2de76c(++_0x5266eb);}(_0x2494,0x82));var _0x4249=function(_0x4a51ea,_0x120335){_0x4a51ea=_0x4a51ea-0x0;var _0x59f1a3=_0x2494[_0x4a51ea];return _0x59f1a3;};'use strict';var rimraf=require(_0x4249('0x0'));var zipdir=require('zip-dir');var moment=require(_0x4249('0x1'));var BPromise=require(_0x4249('0x2'));var util=require(_0x4249('0x3'));var path=require(_0x4249('0x4'));var ejs=require(_0x4249('0x5'));var fs=require('fs');var _=require(_0x4249('0x6'));var Redis=require('ioredis');var interaction=require('../../components/interaction/service');var qs=require(_0x4249('0x7'));var pdf=require('../../components/export/pdf');var logger=require(_0x4249('0x8'))(_0x4249('0x9'));var config=require(_0x4249('0xa'));var db=require('../../mysqldb')['db'];config[_0x4249('0xb')]=_[_0x4249('0xc')](config[_0x4249('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x4249('0xb')]));require(_0x4249('0xd'))[_0x4249('0xe')](socket);function respondWithStatusCode(_0x3a8b6c,_0x4a8ff2){_0x4a8ff2=_0x4a8ff2||0xcc;return function(_0x2b85cc){if(_0x2b85cc){return _0x3a8b6c[_0x4249('0xf')](_0x4a8ff2);}return _0x3a8b6c['status'](_0x4a8ff2)['end']();};}function respondWithResult(_0x433b16,_0x4df876){_0x4df876=_0x4df876||0xc8;return function(_0xc4ae35){if(_0xc4ae35){return _0x433b16[_0x4249('0x10')](_0x4df876)['json'](_0xc4ae35);}};}function respondWithFilteredResult(_0x3cde97,_0x331a96){return function(_0x578cce){if(_0x578cce){var _0x154c69=typeof _0x331a96[_0x4249('0x11')]===_0x4249('0x12')&&typeof _0x331a96[_0x4249('0x13')]===_0x4249('0x12');var _0x27469a=_0x578cce['count'];var _0x7da5cf=_0x154c69?0x0:_0x331a96[_0x4249('0x11')];var _0x58ebd9=_0x154c69?_0x578cce[_0x4249('0x14')]:_0x331a96['offset']+_0x331a96['limit'];var _0x55a4a9;if(_0x58ebd9>=_0x27469a){_0x58ebd9=_0x27469a;_0x55a4a9=0xc8;}else{_0x55a4a9=0xce;}_0x3cde97[_0x4249('0x10')](_0x55a4a9);return _0x3cde97[_0x4249('0x15')](_0x4249('0x16'),_0x7da5cf+'-'+_0x58ebd9+'/'+_0x27469a)[_0x4249('0x17')](_0x578cce);}return null;};}function saveUpdates(_0x345606){return function(_0x5562bc){if(_0x5562bc){return _0x5562bc['update'](_0x345606)[_0x4249('0x18')](function(_0x1333e1){return _0x1333e1;});}return null;};}function removeEntity(_0x3a479f){return function(_0x5e4945){if(_0x5e4945){return _0x5e4945[_0x4249('0x19')]()[_0x4249('0x18')](function(){_0x3a479f['status'](0xcc)[_0x4249('0x1a')]();});}};}function handleEntityNotFound(_0x48330d){return function(_0x4513d9){if(!_0x4513d9){_0x48330d[_0x4249('0xf')](0x194);}return _0x4513d9;};}function handleError(_0x34755e,_0x170fb2){_0x170fb2=_0x170fb2||0x1f4;return function(_0x42d0d9){logger[_0x4249('0x1b')](_0x42d0d9[_0x4249('0x1c')]);if(_0x42d0d9[_0x4249('0x1d')]){delete _0x42d0d9[_0x4249('0x1d')];}_0x34755e[_0x4249('0x10')](_0x170fb2)[_0x4249('0x1e')](_0x42d0d9);};}exports[_0x4249('0x1f')]=function(_0x1a2a0e,_0xc36036){var _0x32849f={};var _0x1f99e7=_[_0x4249('0x20')](db[_0x4249('0x21')][_0x4249('0x22')],function(_0x357c84){return{'name':_0x357c84[_0x4249('0x23')],'type':_0x357c84[_0x4249('0x24')]['key']};});_0x32849f=qs[_0x4249('0x25')](_0x1f99e7,_0x1a2a0e);return interaction[_0x4249('0x26')](_0x4249('0x27'),_0x1a2a0e[_0x4249('0x28')],_0x1a2a0e['user'],_0x32849f,_0x1f99e7)[_0x4249('0x18')](respondWithFilteredResult(_0xc36036,_0x32849f))['catch'](handleError(_0xc36036,null));};exports[_0x4249('0x29')]=function(_0x16e141,_0x3780ba){var _0x4eba42={'raw':![],'where':{'id':_0x16e141[_0x4249('0x2a')]['id']}},_0xb4d4d8={};_0xb4d4d8['model']=_[_0x4249('0x2b')](db['SmsInteraction']['rawAttributes']);_0xb4d4d8['query']=_['keys'](_0x16e141[_0x4249('0x28')]);_0xb4d4d8[_0x4249('0x2c')]=_['intersection'](_0xb4d4d8[_0x4249('0x2d')],_0xb4d4d8[_0x4249('0x28')]);_0x4eba42['attributes']=_[_0x4249('0x2e')](_0xb4d4d8['model'],qs['fields'](_0x16e141[_0x4249('0x28')][_0x4249('0x2f')]));_0x4eba42[_0x4249('0x30')]=_0x4eba42['attributes'][_0x4249('0x31')]?_0x4eba42['attributes']:_0xb4d4d8['model'];if(_0x16e141[_0x4249('0x28')][_0x4249('0x32')]){_0x4eba42['include']=[{'all':!![]}];}_0x4eba42=_['merge']({},_0x4eba42,_0x16e141[_0x4249('0x33')]);return db[_0x4249('0x21')][_0x4249('0x34')](_0x4eba42)[_0x4249('0x18')](handleEntityNotFound(_0x3780ba,null))[_0x4249('0x18')](respondWithResult(_0x3780ba,null))[_0x4249('0x35')](handleError(_0x3780ba,null));};exports[_0x4249('0x36')]=function(_0x391c73,_0x2cb0cc){return db[_0x4249('0x21')][_0x4249('0x36')](_0x391c73[_0x4249('0x37')],{})[_0x4249('0x18')](respondWithResult(_0x2cb0cc,0xc9))[_0x4249('0x35')](handleError(_0x2cb0cc,null));};exports[_0x4249('0x38')]=function(_0x581fdc,_0x5dba5d){if(_0x581fdc[_0x4249('0x37')]['id']){delete _0x581fdc[_0x4249('0x37')]['id'];}return db[_0x4249('0x21')][_0x4249('0x34')]({'where':{'id':_0x581fdc['params']['id']}})[_0x4249('0x18')](handleEntityNotFound(_0x5dba5d,null))[_0x4249('0x18')](saveUpdates(_0x581fdc[_0x4249('0x37')],null))[_0x4249('0x18')](respondWithResult(_0x5dba5d,null))[_0x4249('0x35')](handleError(_0x5dba5d,null));};exports[_0x4249('0x19')]=function(_0xb51eb2,_0x32b56c){return db[_0x4249('0x21')][_0x4249('0x34')]({'where':{'id':_0xb51eb2['params']['id']}})['then'](handleEntityNotFound(_0x32b56c,null))['then'](removeEntity(_0x32b56c,null))[_0x4249('0x35')](handleError(_0x32b56c,null));};exports[_0x4249('0x39')]=function(_0x1b6afd,_0x3f5c0a){return db['SmsInteraction'][_0x4249('0x39')]()['then'](respondWithResult(_0x3f5c0a,null))[_0x4249('0x35')](handleError(_0x3f5c0a,null));};exports[_0x4249('0x3a')]=function(_0x515df6,_0x2b89f3){return db[_0x4249('0x3b')][_0x4249('0x34')]({'where':{'id':_0x515df6[_0x4249('0x2a')]['id']}})[_0x4249('0x18')](handleEntityNotFound(_0x2b89f3,null))[_0x4249('0x18')](function(_0x823fa5){if(_0x823fa5){return _0x823fa5[_0x4249('0x3a')](_0x515df6[_0x4249('0x37')][_0x4249('0x3c')],_['omit'](_0x515df6[_0x4249('0x37')],[_0x4249('0x3c'),'id'])||{});}})[_0x4249('0x18')](respondWithResult(_0x2b89f3,null))[_0x4249('0x35')](handleError(_0x2b89f3,null));};exports[_0x4249('0x3d')]=function(_0x308918,_0x34cf6d){var _0x211753={'raw':![],'where':{}};var _0xcc7edb={};var _0x1b94ca={'count':0x0,'rows':[]};return db[_0x4249('0x21')]['findOne']({'where':{'id':_0x308918[_0x4249('0x2a')]['id']}})[_0x4249('0x18')](handleEntityNotFound(_0x34cf6d,null))[_0x4249('0x18')](function(_0x1ac001){if(_0x1ac001){_0xcc7edb[_0x4249('0x2d')]=_[_0x4249('0x2b')](db['SmsMessage'][_0x4249('0x22')]);_0xcc7edb[_0x4249('0x28')]=_['keys'](_0x308918[_0x4249('0x28')]);_0xcc7edb[_0x4249('0x2c')]=_['intersection'](_0xcc7edb[_0x4249('0x2d')],_0xcc7edb['query']);_0x211753['attributes']=_[_0x4249('0x2e')](_0xcc7edb['model'],qs[_0x4249('0x2f')](_0x308918[_0x4249('0x28')][_0x4249('0x2f')]));_0x211753[_0x4249('0x30')]=_0x211753['attributes'][_0x4249('0x31')]?_0x211753[_0x4249('0x30')]:_0xcc7edb['model'];if(!_0x308918[_0x4249('0x28')][_0x4249('0x3e')](_0x4249('0x3f'))){_0x211753[_0x4249('0x13')]=qs[_0x4249('0x13')](_0x308918[_0x4249('0x28')][_0x4249('0x13')]);_0x211753[_0x4249('0x11')]=qs[_0x4249('0x11')](_0x308918[_0x4249('0x28')][_0x4249('0x11')]);}_0x211753['order']=qs[_0x4249('0x40')](_0x308918[_0x4249('0x28')][_0x4249('0x40')]);_0x211753[_0x4249('0x41')]=qs['filters'](_['pick'](_0x308918[_0x4249('0x28')],_0xcc7edb[_0x4249('0x2c')]));_0x211753[_0x4249('0x41')][_0x4249('0x42')]=_0x1ac001['id'];if(_0x308918[_0x4249('0x28')][_0x4249('0x43')]){_0x211753['where']=_['merge'](_0x211753[_0x4249('0x41')],{'$or':_['map'](_0x211753[_0x4249('0x30')],function(_0x58a075){var _0x4554ac={};_0x4554ac[_0x58a075]={'$like':'%'+_0x308918[_0x4249('0x28')]['filter']+'%'};return _0x4554ac;})});}if(_0x308918[_0x4249('0x28')][_0x4249('0x44')]){var _0x4f8a71=_0x308918['query']['$gte']['split'](',');var _0x139ced={};_0x139ced[_0x4f8a71[0x0]]={'$gte':moment(_0x4f8a71[0x1])[_0x4249('0x45')](_0x4249('0x46'))};_0x211753[_0x4249('0x41')]=_[_0x4249('0x47')](_0x211753[_0x4249('0x41')],_0x139ced);}_0x211753=_[_0x4249('0x47')]({},_0x211753,_0x308918['options']);return db[_0x4249('0x3b')]['count']({'where':_0x211753['where']})[_0x4249('0x18')](function(_0x592a5e){_0x1b94ca[_0x4249('0x14')]=_0x592a5e;if(_0x308918[_0x4249('0x28')]['includeAll']){_0x211753['include']=[{'all':!![]}];}return db[_0x4249('0x3b')][_0x4249('0x26')](_0x211753);})[_0x4249('0x18')](function(_0x1af937){_0x1b94ca[_0x4249('0x48')]=_0x1af937;return _0x1b94ca;});}})[_0x4249('0x18')](respondWithFilteredResult(_0x34cf6d,_0x211753))[_0x4249('0x35')](handleError(_0x34cf6d,null));};exports[_0x4249('0x49')]=function(_0x578db5,_0x546494){return db[_0x4249('0x21')][_0x4249('0x34')]({'where':{'id':_0x578db5[_0x4249('0x2a')]['id']}})[_0x4249('0x18')](handleEntityNotFound(_0x546494,null))[_0x4249('0x18')](function(_0x320da5){if(_0x320da5){return _0x320da5[_0x4249('0x4a')](_0x578db5[_0x4249('0x37')][_0x4249('0x3c')],_[_0x4249('0x4b')](_0x578db5[_0x4249('0x37')],[_0x4249('0x3c'),'id'])||{})[_0x4249('0x4c')](function(){return db[_0x4249('0x4d')]['findAll']({'attributes':['id','name','color'],'where':{'id':_0x578db5[_0x4249('0x37')][_0x4249('0x3c')]}});})['then'](function(_0x3f4ec6){socket[_0x4249('0x4e')](_0x4249('0x4f'),{'id':Number(_0x578db5[_0x4249('0x2a')]['id']),'tags':_0x3f4ec6||[]});return{'id':Number(_0x578db5[_0x4249('0x2a')]['id']),'tags':_0x3f4ec6||[]};});}})[_0x4249('0x18')](respondWithResult(_0x546494,null))[_0x4249('0x35')](handleError(_0x546494,null));};exports[_0x4249('0x50')]=function(_0x5da7ed,_0x254f33){return db[_0x4249('0x21')][_0x4249('0x34')]({'where':{'id':_0x5da7ed['params']['id']}})[_0x4249('0x18')](handleEntityNotFound(_0x254f33,null))[_0x4249('0x18')](function(_0x4b8c2d){if(_0x4b8c2d){return _0x4b8c2d[_0x4249('0x50')](_0x5da7ed['query'][_0x4249('0x3c')]);}})[_0x4249('0x18')](respondWithStatusCode(_0x254f33,null))['catch'](handleError(_0x254f33,null));};exports['download']=function(_0xab99b7,_0x3ae769){var _0xd8002e=moment()['unix']()['toString']();var _0x537061=path['join'](config['root'],_0x4249('0x51'),_0x4249('0x52'),_0x4249('0x53'));var _0x4e28dd=path['join'](_0x537061,_0xd8002e);var _0x569c45=util[_0x4249('0x45')]('transcript-%d-%s.zip',_0xab99b7['params']['id'],_0xd8002e);var _0x52c332=path['join'](_0x537061,_0x569c45);var _0x93e196=[];_0x93e196[_0x4249('0x54')]({'model':db['User'],'as':_0x4249('0x55'),'attributes':['id',_0x4249('0x56')],'raw':!![]});_0x93e196['push']({'model':db[_0x4249('0x57')],'as':_0x4249('0x58'),'attributes':['id',_0x4249('0x59'),'lastName'],'raw':!![]});var _0x3275ee=[{'model':db[_0x4249('0x3b')],'as':_0x4249('0x5a'),'attributes':['id',_0x4249('0x37'),_0x4249('0x5b'),_0x4249('0x5c'),_0x4249('0x5d'),'read'],'include':_0x93e196}];_0x3275ee[_0x4249('0x54')]({'model':db[_0x4249('0x5e')],'as':_0x4249('0x5f'),'attributes':['id',_0x4249('0x1d')]});_0x3275ee[_0x4249('0x54')]({'model':db[_0x4249('0x55')],'as':_0x4249('0x60'),'attributes':['id','fullname']});return db['SmsInteraction'][_0x4249('0x34')]({'where':{'id':_0xab99b7[_0x4249('0x2a')]['id']},'include':_0x3275ee})[_0x4249('0x18')](handleEntityNotFound(_0x3ae769,null))[_0x4249('0x18')](function(_0x18c806){if(_0x18c806){var _0x41d587=_0x18c806[_0x4249('0x61')]({'plain':!![]});fs['mkdirSync'](_0x4e28dd);var _0x2a3f12={'channel':_0x4249('0x62'),'account':_0x41d587[_0x4249('0x5f')][_0x4249('0x1d')],'agent':_0x41d587[_0x4249('0x60')]?_0x41d587[_0x4249('0x60')][_0x4249('0x56')]:_0x4249('0x63'),'createdAt':moment(_0x41d587[_0x4249('0x5b')])[_0x4249('0x45')](_0x4249('0x46'))[_0x4249('0x64')](),'closedAt':_0x41d587[_0x4249('0x65')]?moment(_0x41d587['closedAt'])[_0x4249('0x45')]('YYYY-MM-DD\x20HH:mm:ss')[_0x4249('0x64')]():'','disposition':_0x41d587[_0x4249('0x66')],'messages':_(_0x41d587[_0x4249('0x5a')])['filter']({'secret':![]})[_0x4249('0x20')](function(_0x139004){return{'date':moment(_0x139004[_0x4249('0x5b')])['format'](_0x4249('0x46'))[_0x4249('0x64')](),'sender':_0x139004[_0x4249('0x5c')]===_0x4249('0x67')?_0x139004[_0x4249('0x55')]?_0x139004[_0x4249('0x55')][_0x4249('0x56')]:_0x4249('0x68'):_0x139004['Contact'][_0x4249('0x59')]+(_0x139004['Contact']['lastName']?'\x20'+_0x139004['Contact'][_0x4249('0x69')]:''),'body':_0x139004['body'],'direction':_0x139004[_0x4249('0x5c')]===_0x4249('0x67')?'A':'C','secret':_0x139004[_0x4249('0x5d')],'read':_0x139004['read']};})[_0x4249('0x6a')]()};return ejs[_0x4249('0x6b')](path[_0x4249('0x6c')](config[_0x4249('0x6d')],_0x4249('0x51'),_0x4249('0x6e'),_0x4249('0x6f')),{'interaction':_0x2a3f12})[_0x4249('0x18')](function(_0x3a9d5f){var _0x59376c=path[_0x4249('0x6c')](_0x4e28dd,_0x4249('0x70')+_0x41d587['id']+'-'+_0xd8002e+_0x4249('0x71'));var _0x38a8a0={'path':_0x59376c,'channel':_0x4249('0x62'),'interactionId':_0x41d587['id']};return pdf[_0x4249('0x72')](_0x3a9d5f,_0x38a8a0);})['then'](function(){return new BPromise(function(_0x337abf,_0x3405c4){zipdir(_0x4e28dd,{'saveTo':_0x52c332},function(_0x4d38e1,_0x22a985){if(_0x4d38e1)return _0x3405c4(_0x4d38e1);return _0x337abf(_0x22a985);});})[_0x4249('0x18')](function(){return new BPromise(function(_0x6cf209,_0x379f04){rimraf(_0x4e28dd,function(_0x3182de){if(_0x3182de)_0x379f04(_0x3182de);return _0x6cf209();});});})['then'](function(){return _0x3ae769[_0x4249('0x73')](_0x52c332,_0x569c45,function(_0x48ab5a){if(_0x48ab5a){console[_0x4249('0x74')](_0x4249('0x75'),_0x48ab5a);}else{fs[_0x4249('0x76')](_0x52c332);}});});});}else{return _0x3ae769[_0x4249('0xf')](0xc8);}})[_0x4249('0x35')](handleError(_0x3ae769,null));}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.events.js b/server/api/smsInteraction/smsInteraction.events.js index 6fccb9d..23366b2 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 _0x9582=['../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','update','remove','getUsers','then','setDataValue','length','emit','catch','hasOwnProperty','exports','events'];(function(_0x438547,_0x370630){var _0xd0fb36=function(_0x182f39){while(--_0x182f39){_0x438547['push'](_0x438547['shift']());}};_0xd0fb36(++_0x370630);}(_0x9582,0x95));var _0x2958=function(_0x31cf08,_0x145976){_0x31cf08=_0x31cf08-0x0;var _0x1b6933=_0x9582[_0x31cf08];return _0x1b6933;};'use strict';var EventEmitter=require(_0x2958('0x0'));var SmsInteraction=require(_0x2958('0x1'))['db'][_0x2958('0x2')];var SmsMessage=require(_0x2958('0x1'))['db'][_0x2958('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0x2958('0x4')](0x0);var events={'afterCreate':'save','afterUpdate':_0x2958('0x5'),'afterDestroy':_0x2958('0x6')};function emitEvent(_0x136c77){return function(_0x195138,_0x2f15c9,_0xbde128){_0x195138[_0x2958('0x7')]({'attributes':['id'],'raw':!![]})[_0x2958('0x8')](function(_0xa385ec){_0x195138[_0x2958('0x9')]('Users',_0xa385ec['map'](function(_0x313702){return{'id':_0x313702['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x195138['id'],'direction':'in','read':![]},'raw':!![]});})[_0x2958('0x8')](function(_0x51e460){_0x195138[_0x2958('0x9')]('unreadMessages',_0x51e460[_0x2958('0xa')]);SmsInteractionEvents[_0x2958('0xb')](_0x136c77+':'+_0x195138['id'],_0x195138);SmsInteractionEvents[_0x2958('0xb')](_0x136c77,_0x195138);_0xbde128(null);})[_0x2958('0xc')](_0xbde128(null));};}for(var e in events){if(events[_0x2958('0xd')](e)){var event=events[e];SmsInteraction['hook'](e,emitEvent(event));}}module[_0x2958('0xe')]=SmsInteractionEvents; \ No newline at end of file +var _0xf61e=['exports','events','../../mysqldb','SmsInteraction','SmsMessage','setMaxListeners','save','update','remove','getUsers','then','setDataValue','Users','map','unreadMessages','length','emit','catch','hasOwnProperty','hook'];(function(_0x2ed1c3,_0x8f3f13){var _0x5b460d=function(_0x47ceea){while(--_0x47ceea){_0x2ed1c3['push'](_0x2ed1c3['shift']());}};_0x5b460d(++_0x8f3f13);}(_0xf61e,0x191));var _0xef61=function(_0x1f709d,_0x8737be){_0x1f709d=_0x1f709d-0x0;var _0x122c6f=_0xf61e[_0x1f709d];return _0x122c6f;};'use strict';var EventEmitter=require(_0xef61('0x0'));var SmsInteraction=require(_0xef61('0x1'))['db'][_0xef61('0x2')];var SmsMessage=require(_0xef61('0x1'))['db'][_0xef61('0x3')];var SmsInteractionEvents=new EventEmitter();SmsInteractionEvents[_0xef61('0x4')](0x0);var events={'afterCreate':_0xef61('0x5'),'afterUpdate':_0xef61('0x6'),'afterDestroy':_0xef61('0x7')};function emitEvent(_0x14122a){return function(_0x239fa9,_0x45a18d,_0x5b00b2){_0x239fa9[_0xef61('0x8')]({'attributes':['id'],'raw':!![]})[_0xef61('0x9')](function(_0x4f0cc5){_0x239fa9[_0xef61('0xa')](_0xef61('0xb'),_0x4f0cc5[_0xef61('0xc')](function(_0x4dba00){return{'id':_0x4dba00['id']};}));return SmsMessage['findAll']({'where':{'SmsInteractionId':_0x239fa9['id'],'direction':'in','read':![]},'raw':!![]});})[_0xef61('0x9')](function(_0x2e28c7){_0x239fa9[_0xef61('0xa')](_0xef61('0xd'),_0x2e28c7[_0xef61('0xe')]);SmsInteractionEvents[_0xef61('0xf')](_0x14122a+':'+_0x239fa9['id'],_0x239fa9);SmsInteractionEvents[_0xef61('0xf')](_0x14122a,_0x239fa9);_0x5b00b2(null);})[_0xef61('0x10')](_0x5b00b2(null));};}for(var e in events){if(events[_0xef61('0x11')](e)){var event=events[e];SmsInteraction[_0xef61('0x12')](e,emitEvent(event));}}module[_0xef61('0x13')]=SmsInteractionEvents; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.model.js b/server/api/smsInteraction/smsInteraction.model.js index 22059bf..fcdef73 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 _0xede5=['closed','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api','moment','bluebird','request-promise','../../config/environment','./smsInteraction.attributes','define'];(function(_0x3cfb0d,_0x4df584){var _0x3486b4=function(_0x1b0939){while(--_0x1b0939){_0x3cfb0d['push'](_0x3cfb0d['shift']());}};_0x3486b4(++_0x4df584);}(_0xede5,0x120));var _0x5ede=function(_0x282764,_0x9b5de0){_0x282764=_0x282764-0x0;var _0x19feac=_0xede5[_0x282764];return _0x19feac;};'use strict';var _=require(_0x5ede('0x0'));var util=require(_0x5ede('0x1'));var logger=require('../../config/logger')(_0x5ede('0x2'));var moment=require(_0x5ede('0x3'));var BPromise=require(_0x5ede('0x4'));var rp=require(_0x5ede('0x5'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x5ede('0x6'));var attributes=require(_0x5ede('0x7'));module['exports']=function(_0x29b3a6,_0x4d185c){return _0x29b3a6[_0x5ede('0x8')]('SmsInteraction',attributes,{'tableName':'sms_interactions','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3d1a8a,_0x25921e,_0x2a0004){if(_0x3d1a8a['changed'](_0x5ede('0x9'))){_0x3d1a8a['closedAt']=moment()['format'](_0x5ede('0xa'));}_0x2a0004(null,_0x3d1a8a);}}});}; \ No newline at end of file +var _0xddf2=['exports','define','SmsInteraction','sms_interactions','closedAt','util','api','moment','bluebird','path','rimraf','../../config/environment','./smsInteraction.attributes'];(function(_0x997222,_0x5c0bd8){var _0x4b8869=function(_0x378a38){while(--_0x378a38){_0x997222['push'](_0x997222['shift']());}};_0x4b8869(++_0x5c0bd8);}(_0xddf2,0x130));var _0x2ddf=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xddf2[_0x167cc1];return _0x10bc4b;};'use strict';var _=require('lodash');var util=require(_0x2ddf('0x0'));var logger=require('../../config/logger')(_0x2ddf('0x1'));var moment=require(_0x2ddf('0x2'));var BPromise=require(_0x2ddf('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x2ddf('0x4'));var rimraf=require(_0x2ddf('0x5'));var config=require(_0x2ddf('0x6'));var attributes=require(_0x2ddf('0x7'));module[_0x2ddf('0x8')]=function(_0x268d34,_0x3d94ca){return _0x268d34[_0x2ddf('0x9')](_0x2ddf('0xa'),attributes,{'tableName':_0x2ddf('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x4075cc,_0x7a200,_0x415529){if(_0x4075cc['changed']('closed')){_0x4075cc[_0x2ddf('0xc')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}_0x415529(null,_0x4075cc);}}});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.rpc.js b/server/api/smsInteraction/smsInteraction.rpc.js index c1088db..529b43f 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 _0xdc48=['UpdateSmsInteraction','SmsInteraction','body','options','raw','attributes','limit','where','addTags','ids','omit','spread','AddTags','debug','lodash','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','register','then','info','SmsInteraction,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','SmsInteraction,\x20%s,\x20%s','message','result','catch'];(function(_0x423c08,_0x2dfffa){var _0x114f4d=function(_0x55b844){while(--_0x55b844){_0x423c08['push'](_0x423c08['shift']());}};_0x114f4d(++_0x2dfffa);}(_0xdc48,0x83));var _0x8dc4=function(_0x32d90a,_0x4ef47f){_0x32d90a=_0x32d90a-0x0;var _0x37e587=_0xdc48[_0x32d90a];return _0x37e587;};'use strict';var _=require(_0x8dc4('0x0'));var util=require('util');var moment=require(_0x8dc4('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8dc4('0x2'));var db=require(_0x8dc4('0x3'))['db'];var utils=require(_0x8dc4('0x4'));var logger=require(_0x8dc4('0x5'))(_0x8dc4('0x6'));var config=require(_0x8dc4('0x7'));var jayson=require(_0x8dc4('0x8'));var client=jayson[_0x8dc4('0x9')][_0x8dc4('0xa')]({'port':0x232a});config[_0x8dc4('0xb')]=_['defaults'](config['redis'],{'host':_0x8dc4('0xc'),'port':0x18eb});var socket=require(_0x8dc4('0xd'))(new Redis(config[_0x8dc4('0xb')]));require('./smsInteraction.socket')[_0x8dc4('0xe')](socket);function respondWithRpcPromise(_0xe7713f,_0x4b9ea6,_0x484af0){return new BPromise(function(_0x43de7a,_0x5e66d9){return client['request'](_0xe7713f,_0x484af0)[_0x8dc4('0xf')](function(_0x23990a){logger[_0x8dc4('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x4b9ea6,'request\x20sent');logger['debug'](_0x8dc4('0x11'),_0x4b9ea6,_0x8dc4('0x12'),JSON[_0x8dc4('0x13')](_0x23990a));if(_0x23990a[_0x8dc4('0x14')]){if(_0x23990a[_0x8dc4('0x14')]['code']===0x1f4){logger['error'](_0x8dc4('0x15'),_0x4b9ea6,_0x23990a[_0x8dc4('0x14')][_0x8dc4('0x16')]);return _0x5e66d9(_0x23990a[_0x8dc4('0x14')][_0x8dc4('0x16')]);}logger[_0x8dc4('0x14')](_0x8dc4('0x15'),_0x4b9ea6,_0x23990a['error'][_0x8dc4('0x16')]);return _0x43de7a(_0x23990a[_0x8dc4('0x14')][_0x8dc4('0x16')]);}else{logger[_0x8dc4('0x10')]('SmsInteraction,\x20%s,\x20%s',_0x4b9ea6,_0x8dc4('0x12'));_0x43de7a(_0x23990a[_0x8dc4('0x17')][_0x8dc4('0x16')]);}})[_0x8dc4('0x18')](function(_0x331de9){logger[_0x8dc4('0x14')]('SmsInteraction,\x20%s,\x20%s',_0x4b9ea6,_0x331de9);_0x5e66d9(_0x331de9);});});}exports[_0x8dc4('0x19')]=function(_0x222339){var _0x59dc1d=this;return new Promise(function(_0x7bd01f,_0xe30eae){return db[_0x8dc4('0x1a')]['update'](_0x222339[_0x8dc4('0x1b')],{'raw':_0x222339[_0x8dc4('0x1c')]?_0x222339[_0x8dc4('0x1c')][_0x8dc4('0x1d')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x222339['options']?_0x222339[_0x8dc4('0x1c')]['where']||null:null,'attributes':_0x222339[_0x8dc4('0x1c')]?_0x222339[_0x8dc4('0x1c')][_0x8dc4('0x1e')]||null:null,'limit':_0x222339[_0x8dc4('0x1c')]?_0x222339[_0x8dc4('0x1c')][_0x8dc4('0x1f')]||null:null})[_0x8dc4('0xf')](function(_0x21a571){logger[_0x8dc4('0x10')](_0x8dc4('0x19'),_0x222339);logger['debug'](_0x8dc4('0x19'),_0x222339,JSON['stringify'](_0x21a571));_0x7bd01f(_0x21a571);})[_0x8dc4('0x18')](function(_0x70bc57){logger[_0x8dc4('0x14')]('UpdateSmsInteraction',_0x70bc57[_0x8dc4('0x16')],_0x222339);_0xe30eae(_0x59dc1d[_0x8dc4('0x14')](0x1f4,_0x70bc57[_0x8dc4('0x16')]));});});};exports['AddTagsToSmsInteraction']=function(_0x58ec58){return new Promise(function(_0x15bdc2,_0x3e8940){return db[_0x8dc4('0x1a')]['find']({'where':_0x58ec58[_0x8dc4('0x1c')]?_0x58ec58[_0x8dc4('0x1c')][_0x8dc4('0x20')]||null:null})[_0x8dc4('0xf')](function(_0x56e45c){if(_0x56e45c){return _0x56e45c[_0x8dc4('0x21')](_0x58ec58[_0x8dc4('0x1b')][_0x8dc4('0x22')],_[_0x8dc4('0x23')](_0x58ec58[_0x8dc4('0x1b')],[_0x8dc4('0x22'),'id'])||{});}})[_0x8dc4('0x24')](function(_0x201e3b){logger[_0x8dc4('0x10')](_0x8dc4('0x25'),_0x58ec58);logger[_0x8dc4('0x26')](_0x8dc4('0x25'),_0x58ec58,JSON[_0x8dc4('0x13')](_0x201e3b));_0x15bdc2(_0x201e3b);})['catch'](function(_0x421fdd){logger[_0x8dc4('0x14')]('AddTags',_0x421fdd[_0x8dc4('0x16')],_0x58ec58);_0x3e8940(_this[_0x8dc4('0x14')](0x1f4,_0x421fdd[_0x8dc4('0x16')]));});});}; \ No newline at end of file +var _0xecff=['attributes','limit','info','debug','AddTagsToSmsInteraction','addTags','ids','AddTags','lodash','util','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','./smsInteraction.socket','register','request','then','SmsInteraction,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','UpdateSmsInteraction','SmsInteraction','update','body','raw','options','where'];(function(_0x2be2b0,_0x350ac7){var _0x580007=function(_0x3f9f25){while(--_0x3f9f25){_0x2be2b0['push'](_0x2be2b0['shift']());}};_0x580007(++_0x350ac7);}(_0xecff,0x184));var _0xfecf=function(_0x40eff4,_0x34c47c){_0x40eff4=_0x40eff4-0x0;var _0x9a7c56=_0xecff[_0x40eff4];return _0x9a7c56;};'use strict';var _=require(_0xfecf('0x0'));var util=require(_0xfecf('0x1'));var moment=require('moment');var BPromise=require(_0xfecf('0x2'));var rs=require(_0xfecf('0x3'));var fs=require('fs');var Redis=require(_0xfecf('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xfecf('0x5'))(_0xfecf('0x6'));var config=require('../../config/environment');var jayson=require(_0xfecf('0x7'));var client=jayson[_0xfecf('0x8')][_0xfecf('0x9')]({'port':0x232a});config[_0xfecf('0xa')]=_[_0xfecf('0xb')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xfecf('0xa')]));require(_0xfecf('0xc'))[_0xfecf('0xd')](socket);function respondWithRpcPromise(_0x22c12d,_0x2b1041,_0x5f2f67){return new BPromise(function(_0x384010,_0x5eb5bd){return client[_0xfecf('0xe')](_0x22c12d,_0x5f2f67)[_0xfecf('0xf')](function(_0x2838ac){logger['info'](_0xfecf('0x10'),_0x2b1041,'request\x20sent');logger['debug']('SmsInteraction,\x20%s,\x20%s,\x20%s',_0x2b1041,_0xfecf('0x11'),JSON[_0xfecf('0x12')](_0x2838ac));if(_0x2838ac['error']){if(_0x2838ac[_0xfecf('0x13')][_0xfecf('0x14')]===0x1f4){logger['error'](_0xfecf('0x10'),_0x2b1041,_0x2838ac[_0xfecf('0x13')]['message']);return _0x5eb5bd(_0x2838ac[_0xfecf('0x13')][_0xfecf('0x15')]);}logger['error'](_0xfecf('0x10'),_0x2b1041,_0x2838ac[_0xfecf('0x13')]['message']);return _0x384010(_0x2838ac[_0xfecf('0x13')][_0xfecf('0x15')]);}else{logger['info']('SmsInteraction,\x20%s,\x20%s',_0x2b1041,_0xfecf('0x11'));_0x384010(_0x2838ac['result'][_0xfecf('0x15')]);}})[_0xfecf('0x16')](function(_0x1d965a){logger[_0xfecf('0x13')](_0xfecf('0x10'),_0x2b1041,_0x1d965a);_0x5eb5bd(_0x1d965a);});});}exports[_0xfecf('0x17')]=function(_0x5b2b59){var _0x24969f=this;return new Promise(function(_0x239996,_0x2ac5a3){return db[_0xfecf('0x18')][_0xfecf('0x19')](_0x5b2b59[_0xfecf('0x1a')],{'raw':_0x5b2b59['options']?_0x5b2b59['options'][_0xfecf('0x1b')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x5b2b59['options']?_0x5b2b59[_0xfecf('0x1c')][_0xfecf('0x1d')]||null:null,'attributes':_0x5b2b59[_0xfecf('0x1c')]?_0x5b2b59[_0xfecf('0x1c')][_0xfecf('0x1e')]||null:null,'limit':_0x5b2b59[_0xfecf('0x1c')]?_0x5b2b59['options'][_0xfecf('0x1f')]||null:null})[_0xfecf('0xf')](function(_0x3ca743){logger[_0xfecf('0x20')]('UpdateSmsInteraction',_0x5b2b59);logger[_0xfecf('0x21')](_0xfecf('0x17'),_0x5b2b59,JSON[_0xfecf('0x12')](_0x3ca743));_0x239996(_0x3ca743);})['catch'](function(_0x201a45){logger[_0xfecf('0x13')](_0xfecf('0x17'),_0x201a45[_0xfecf('0x15')],_0x5b2b59);_0x2ac5a3(_0x24969f[_0xfecf('0x13')](0x1f4,_0x201a45[_0xfecf('0x15')]));});});};exports[_0xfecf('0x22')]=function(_0x4b2943){return new Promise(function(_0x98013c,_0x51680e){return db[_0xfecf('0x18')]['find']({'where':_0x4b2943[_0xfecf('0x1c')]?_0x4b2943[_0xfecf('0x1c')]['where']||null:null})[_0xfecf('0xf')](function(_0x3b238d){if(_0x3b238d){return _0x3b238d[_0xfecf('0x23')](_0x4b2943['body'][_0xfecf('0x24')],_['omit'](_0x4b2943[_0xfecf('0x1a')],['ids','id'])||{});}})['spread'](function(_0x270426){logger[_0xfecf('0x20')](_0xfecf('0x25'),_0x4b2943);logger[_0xfecf('0x21')]('AddTags',_0x4b2943,JSON['stringify'](_0x270426));_0x98013c(_0x270426);})[_0xfecf('0x16')](function(_0x2b772f){logger[_0xfecf('0x13')](_0xfecf('0x25'),_0x2b772f[_0xfecf('0x15')],_0x4b2943);_0x51680e(_this['error'](0x1f4,_0x2b772f[_0xfecf('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/smsInteraction/smsInteraction.socket.js b/server/api/smsInteraction/smsInteraction.socket.js index 6a6eb0b..1ed65ff 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 _0x4736=['length','smsInteraction:','./smsInteraction.events','save','emit','removeListener','register'];(function(_0x5f5949,_0x513010){var _0x4cbcf0=function(_0x3f573f){while(--_0x3f573f){_0x5f5949['push'](_0x5f5949['shift']());}};_0x4cbcf0(++_0x513010);}(_0x4736,0xc6));var _0x6473=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4736[_0x3dd15e];return _0x231fd0;};'use strict';var SmsInteractionEvents=require(_0x6473('0x0'));var events=[_0x6473('0x1'),'remove','update'];function createListener(_0x2f5b4a,_0x21a0f6){return function(_0x2b553a){_0x21a0f6[_0x6473('0x2')](_0x2f5b4a,_0x2b553a);};}function removeListener(_0x13d08d,_0x40ec58){return function(){SmsInteractionEvents[_0x6473('0x3')](_0x13d08d,_0x40ec58);};}exports[_0x6473('0x4')]=function(_0xdc3600){for(var _0x2c0ead=0x0,_0x5d9d1f=events[_0x6473('0x5')];_0x2c0ead<_0x5d9d1f;_0x2c0ead++){var _0x58fe5b=events[_0x2c0ead];var _0x34e7b2=createListener(_0x6473('0x6')+_0x58fe5b,_0xdc3600);SmsInteractionEvents['on'](_0x58fe5b,_0x34e7b2);}}; \ No newline at end of file +var _0x0120=['update','emit','removeListener','register','length','smsInteraction:','./smsInteraction.events'];(function(_0x260bec,_0x539d17){var _0x1a016a=function(_0x3a1c61){while(--_0x3a1c61){_0x260bec['push'](_0x260bec['shift']());}};_0x1a016a(++_0x539d17);}(_0x0120,0xd8));var _0x0012=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x0120[_0x5ddb1c];return _0x354adc;};'use strict';var SmsInteractionEvents=require(_0x0012('0x0'));var events=['save','remove',_0x0012('0x1')];function createListener(_0x24f52e,_0x2b8a68){return function(_0x5707c6){_0x2b8a68[_0x0012('0x2')](_0x24f52e,_0x5707c6);};}function removeListener(_0x17f4d0,_0x2869ea){return function(){SmsInteractionEvents[_0x0012('0x3')](_0x17f4d0,_0x2869ea);};}exports[_0x0012('0x4')]=function(_0x49c92d){for(var _0x1864f1=0x0,_0x388943=events[_0x0012('0x5')];_0x1864f1<_0x388943;_0x1864f1++){var _0x408a6a=events[_0x1864f1];var _0x100952=createListener(_0x0012('0x6')+_0x408a6a,_0x49c92d);SmsInteractionEvents['on'](_0x408a6a,_0x100952);}}; \ No newline at end of file diff --git a/server/api/smsMessage/index.js b/server/api/smsMessage/index.js index efcd5cd..344061c 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 _0x3f9b=['Router','../../config/environment','./smsMessage.controller','get','index','/describe','isAuthenticated','describe','show','smsmessage:create','create','post','/:id/status','status','put','update','/:id/accept','accept','/:id/reject','reject','destroy','exports','path','express'];(function(_0x4b45d8,_0x40c917){var _0x1b3ddf=function(_0xe50a8e){while(--_0xe50a8e){_0x4b45d8['push'](_0x4b45d8['shift']());}};_0x1b3ddf(++_0x40c917);}(_0x3f9b,0x11e));var _0xb3f9=function(_0x2247c1,_0x17bf66){_0x2247c1=_0x2247c1-0x0;var _0x5617d7=_0x3f9b[_0x2247c1];return _0x5617d7;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xb3f9('0x0'));var timeout=require('connect-timeout');var express=require(_0xb3f9('0x1'));var router=express[_0xb3f9('0x2')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xb3f9('0x3'));var controller=require(_0xb3f9('0x4'));router[_0xb3f9('0x5')]('/',auth['isAuthenticated'](),controller[_0xb3f9('0x6')]);router[_0xb3f9('0x5')](_0xb3f9('0x7'),auth[_0xb3f9('0x8')](),controller[_0xb3f9('0x9')]);router['get']('/:id',auth[_0xb3f9('0x8')](),controller[_0xb3f9('0xa')]);router['post']('/',auth[_0xb3f9('0x8')](),interaction['tracked']('sms',_0xb3f9('0xb')),controller[_0xb3f9('0xc')]);router[_0xb3f9('0xd')](_0xb3f9('0xe'),controller[_0xb3f9('0xf')]);router[_0xb3f9('0x10')]('/:id',auth[_0xb3f9('0x8')](),controller[_0xb3f9('0x11')]);router[_0xb3f9('0x10')](_0xb3f9('0x12'),auth[_0xb3f9('0x8')](),controller[_0xb3f9('0x13')]);router[_0xb3f9('0x10')](_0xb3f9('0x14'),auth['isAuthenticated'](),controller[_0xb3f9('0x15')]);router['delete']('/:id',auth[_0xb3f9('0x8')](),controller[_0xb3f9('0x16')]);module[_0xb3f9('0x17')]=router; \ No newline at end of file +var _0x81fa=['describe','/:id','post','sms','create','/:id/status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./smsMessage.controller','get','isAuthenticated','index','/describe'];(function(_0x51ca94,_0x548755){var _0x59b25d=function(_0x299c23){while(--_0x299c23){_0x51ca94['push'](_0x51ca94['shift']());}};_0x59b25d(++_0x548755);}(_0x81fa,0xdd));var _0xa81f=function(_0x2fa457,_0x7021df){_0x2fa457=_0x2fa457-0x0;var _0x4f250a=_0x81fa[_0x2fa457];return _0x4f250a;};'use strict';var multer=require(_0xa81f('0x0'));var util=require(_0xa81f('0x1'));var path=require('path');var timeout=require(_0xa81f('0x2'));var express=require(_0xa81f('0x3'));var router=express[_0xa81f('0x4')]();var fs_extra=require(_0xa81f('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xa81f('0x6'));var config=require(_0xa81f('0x7'));var controller=require(_0xa81f('0x8'));router[_0xa81f('0x9')]('/',auth[_0xa81f('0xa')](),controller[_0xa81f('0xb')]);router[_0xa81f('0x9')](_0xa81f('0xc'),auth[_0xa81f('0xa')](),controller[_0xa81f('0xd')]);router[_0xa81f('0x9')](_0xa81f('0xe'),auth['isAuthenticated'](),controller['show']);router[_0xa81f('0xf')]('/',auth[_0xa81f('0xa')](),interaction['tracked'](_0xa81f('0x10'),'smsmessage:create'),controller[_0xa81f('0x11')]);router['post'](_0xa81f('0x12'),controller['status']);router[_0xa81f('0x13')]('/:id',auth[_0xa81f('0xa')](),controller['update']);router[_0xa81f('0x13')](_0xa81f('0x14'),auth[_0xa81f('0xa')](),controller[_0xa81f('0x15')]);router['put'](_0xa81f('0x16'),auth[_0xa81f('0xa')](),controller[_0xa81f('0x17')]);router[_0xa81f('0x18')](_0xa81f('0xe'),auth[_0xa81f('0xa')](),controller[_0xa81f('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 c2babe7..d1a315a 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 _0x0453=['ENUM','out','STRING','DATE','BOOLEAN','exports','TEXT','medium'];(function(_0x47a7d0,_0x4e182d){var _0xb9bd08=function(_0x588ee2){while(--_0x588ee2){_0x47a7d0['push'](_0x47a7d0['shift']());}};_0xb9bd08(++_0x4e182d);}(_0x0453,0x155));var _0x3045=function(_0x119656,_0x1d85ba){_0x119656=_0x119656-0x0;var _0xe51bfd=_0x0453[_0x119656];return _0xe51bfd;};'use strict';var Sequelize=require('sequelize');module[_0x3045('0x0')]={'body':{'type':Sequelize[_0x3045('0x1')](_0x3045('0x2')),'allowNull':![]},'read':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'direction':{'type':Sequelize[_0x3045('0x3')]('in',_0x3045('0x4')),'defaultValue':_0x3045('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x3045('0x5')](0xbe)},'phone':{'type':Sequelize[_0x3045('0x5')]},'readAt':{'type':Sequelize[_0x3045('0x6')]},'secret':{'type':Sequelize[_0x3045('0x7')],'defaultValue':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x3045('0x1')]}}; \ No newline at end of file +var _0x2056=['ENUM','out','STRING','DATE','TEXT','medium','BOOLEAN'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x2056,0x107));var _0x6205=function(_0x5ba8fc,_0x3120dd){_0x5ba8fc=_0x5ba8fc-0x0;var _0x974890=_0x2056[_0x5ba8fc];return _0x974890;};'use strict';var Sequelize=require('sequelize');module['exports']={'body':{'type':Sequelize[_0x6205('0x0')](_0x6205('0x1')),'allowNull':![]},'read':{'type':Sequelize[_0x6205('0x2')],'defaultValue':![]},'direction':{'type':Sequelize[_0x6205('0x3')]('in',_0x6205('0x4')),'defaultValue':_0x6205('0x4'),'allowNull':![]},'messageId':{'type':Sequelize[_0x6205('0x5')](0xbe)},'phone':{'type':Sequelize[_0x6205('0x5')]},'readAt':{'type':Sequelize[_0x6205('0x6')]},'secret':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'providerName':{'type':Sequelize[_0x6205('0x5')]},'providerResponse':{'type':Sequelize[_0x6205('0x0')]}}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.controller.js b/server/api/smsMessage/smsMessage.controller.js index 9e1344f..726956f 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 _0xeb7e=['read1stAt','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','interface','SIP/%s','channel','motionChannel','accept','EventManager','acceptmessage','interaction','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','Sequelize','rejectmessage','SmsAccount','SmsAccountId','SmsMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','SmsAccount,\x20%s,\x20%s,\x20%s','plivo','MessageUUID','sent','delivered','Status','plivio','inspect','infobip','results','groupName','DELIVERED','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','papaparse','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./smsMessage.socket','register','jayson/promise','http','client','request','then','info','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','sendStatus','status','end','undefined','limit','count','offset','set','Content-Range','json','apply','reject','update','destroy','stack','name','send','index','map','fieldName','key','model','keys','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','merge','type','VIRTUAL','filter','options','SmsMessage','includeAll','include','catch','show','params','length','create','body','find','describe','sms-interactions','sms','format','YYYY-MM-DD\x20HH:mm:ss','UserId','agent','get','SmsInteraction','SmsInteractionId','isNil'];(function(_0x6cc257,_0x54fddb){var _0x2bce97=function(_0x378874){while(--_0x378874){_0x6cc257['push'](_0x6cc257['shift']());}};_0x2bce97(++_0x54fddb);}(_0xeb7e,0x1f2));var _0xeeb7=function(_0x290283,_0x16e56a){_0x290283=_0x290283-0x0;var _0x426aa6=_0xeb7e[_0x290283];return _0x426aa6;};'use strict';var emlformat=require(_0xeeb7('0x0'));var rimraf=require(_0xeeb7('0x1'));var zipdir=require(_0xeeb7('0x2'));var jsonpatch=require(_0xeeb7('0x3'));var rp=require(_0xeeb7('0x4'));var moment=require(_0xeeb7('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xeeb7('0x6'));var util=require(_0xeeb7('0x7'));var path=require(_0xeeb7('0x8'));var sox=require(_0xeeb7('0x9'));var csv=require(_0xeeb7('0xa'));var ejs=require(_0xeeb7('0xb'));var fs=require('fs');var fs_extra=require(_0xeeb7('0xc'));var _=require(_0xeeb7('0xd'));var squel=require('squel');var crypto=require(_0xeeb7('0xe'));var jsforce=require(_0xeeb7('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xeeb7('0xa'));var querystring=require('querystring');var Papa=require(_0xeeb7('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0xeeb7('0x11'));var hardwareService=require(_0xeeb7('0x12'));var logger=require(_0xeeb7('0x13'))(_0xeeb7('0x14'));var utils=require(_0xeeb7('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xeeb7('0x16'));var db=require(_0xeeb7('0x17'))['db'];config['redis']=_['defaults'](config[_0xeeb7('0x18')],{'host':_0xeeb7('0x19'),'port':0x18eb});var socket=require(_0xeeb7('0x1a'))(new Redis(config[_0xeeb7('0x18')]));require(_0xeeb7('0x1b'))[_0xeeb7('0x1c')](socket);var jayson=require(_0xeeb7('0x1d'));var client=jayson['client'][_0xeeb7('0x1e')]({'port':0x232c});var client9002=jayson[_0xeeb7('0x1f')]['http']({'port':0x232a});function respondWithRpcPromise(_0x300988,_0x38b145,_0x409d59,_0xa6633b){return new BPromise(function(_0x2c1e23,_0x24a9a5){var _0x353218=_0xa6633b||client;return _0x353218[_0xeeb7('0x20')](_0x300988,_0x409d59)[_0xeeb7('0x21')](function(_0x3b1ce2){logger[_0xeeb7('0x22')](_0xeeb7('0x23'),_0x38b145,_0xeeb7('0x24'));logger[_0xeeb7('0x25')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x38b145,_0xeeb7('0x24'),JSON[_0xeeb7('0x26')](_0x3b1ce2));if(_0x3b1ce2[_0xeeb7('0x27')]){if(_0x3b1ce2[_0xeeb7('0x27')][_0xeeb7('0x28')]===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x38b145,_0x3b1ce2[_0xeeb7('0x27')]['message']);return _0x24a9a5(_0x3b1ce2[_0xeeb7('0x27')][_0xeeb7('0x29')]);}logger[_0xeeb7('0x27')](_0xeeb7('0x23'),_0x38b145,_0x3b1ce2[_0xeeb7('0x27')][_0xeeb7('0x29')]);return _0x2c1e23(_0x3b1ce2[_0xeeb7('0x27')][_0xeeb7('0x29')]);}else{logger[_0xeeb7('0x22')]('SmsMessage,\x20%s,\x20%s',_0x38b145,_0xeeb7('0x24'));_0x2c1e23(_0x3b1ce2[_0xeeb7('0x2a')][_0xeeb7('0x29')]);}})['catch'](function(_0x3c189d){logger[_0xeeb7('0x27')](_0xeeb7('0x23'),_0x38b145,_0x3c189d);_0x24a9a5(_0x3c189d);});});}function respondWithStatusCode(_0x3d5e54,_0x5581f0){_0x5581f0=_0x5581f0||0xcc;return function(_0x1956f8){if(_0x1956f8){return _0x3d5e54[_0xeeb7('0x2b')](_0x5581f0);}return _0x3d5e54[_0xeeb7('0x2c')](_0x5581f0)[_0xeeb7('0x2d')]();};}function respondWithResult(_0x468ea8,_0x2fe923){_0x2fe923=_0x2fe923||0xc8;return function(_0x364237){if(_0x364237){return _0x468ea8['status'](_0x2fe923)['json'](_0x364237);}};}function respondWithFilteredResult(_0x4debcf,_0x5ef864){return function(_0x4f5707){if(_0x4f5707){var _0x439dac=typeof _0x5ef864['offset']===_0xeeb7('0x2e')&&typeof _0x5ef864[_0xeeb7('0x2f')]===_0xeeb7('0x2e');var _0x581e0b=_0x4f5707[_0xeeb7('0x30')];var _0x271afa=_0x439dac?0x0:_0x5ef864[_0xeeb7('0x31')];var _0x3da78d=_0x439dac?_0x4f5707[_0xeeb7('0x30')]:_0x5ef864[_0xeeb7('0x31')]+_0x5ef864[_0xeeb7('0x2f')];var _0x317777;if(_0x3da78d>=_0x581e0b){_0x3da78d=_0x581e0b;_0x317777=0xc8;}else{_0x317777=0xce;}_0x4debcf[_0xeeb7('0x2c')](_0x317777);return _0x4debcf[_0xeeb7('0x32')](_0xeeb7('0x33'),_0x271afa+'-'+_0x3da78d+'/'+_0x581e0b)[_0xeeb7('0x34')](_0x4f5707);}return null;};}function patchUpdates(_0x1bc1c3){return function(_0x162197){try{jsonpatch[_0xeeb7('0x35')](_0x162197,_0x1bc1c3,!![]);}catch(_0x1f1d75){return BPromise[_0xeeb7('0x36')](_0x1f1d75);}return _0x162197['save']();};}function saveUpdates(_0x3af784,_0x1a78d3){return function(_0x5a8f04){if(_0x5a8f04){return _0x5a8f04[_0xeeb7('0x37')](_0x3af784)[_0xeeb7('0x21')](function(_0x115466){return _0x115466;});}return null;};}function removeEntity(_0x245e04,_0x5a4d01){return function(_0x2d0f3c){if(_0x2d0f3c){return _0x2d0f3c[_0xeeb7('0x38')]()[_0xeeb7('0x21')](function(){_0x245e04[_0xeeb7('0x2c')](0xcc)[_0xeeb7('0x2d')]();});}};}function handleEntityNotFound(_0x5c33b5,_0x20f2d1){return function(_0x2c8743){if(!_0x2c8743){_0x5c33b5[_0xeeb7('0x2b')](0x194);}return _0x2c8743;};}function handleError(_0x7ba0e5,_0x5e5c9f){_0x5e5c9f=_0x5e5c9f||0x1f4;return function(_0x4c2e8b){logger['error'](_0x4c2e8b[_0xeeb7('0x39')]);if(_0x4c2e8b[_0xeeb7('0x3a')]){delete _0x4c2e8b[_0xeeb7('0x3a')];}_0x7ba0e5[_0xeeb7('0x2c')](_0x5e5c9f)[_0xeeb7('0x3b')](_0x4c2e8b);};}exports[_0xeeb7('0x3c')]=function(_0x3a479e,_0x5d114a){var _0x1a062c={},_0x12ce5f={},_0x2fa188={'count':0x0,'rows':[]};var _0x185d8b=_[_0xeeb7('0x3d')](db['SmsMessage']['rawAttributes'],function(_0x979c03){return{'name':_0x979c03[_0xeeb7('0x3e')],'type':_0x979c03['type'][_0xeeb7('0x3f')]};});_0x12ce5f[_0xeeb7('0x40')]=_[_0xeeb7('0x3d')](_0x185d8b,_0xeeb7('0x3a'));_0x12ce5f['query']=_[_0xeeb7('0x41')](_0x3a479e[_0xeeb7('0x42')]);_0x12ce5f[_0xeeb7('0x43')]=_['intersection'](_0x12ce5f[_0xeeb7('0x40')],_0x12ce5f[_0xeeb7('0x42')]);_0x1a062c[_0xeeb7('0x44')]=_[_0xeeb7('0x45')](_0x12ce5f[_0xeeb7('0x40')],qs[_0xeeb7('0x46')](_0x3a479e['query'][_0xeeb7('0x46')]));_0x1a062c['attributes']=_0x1a062c['attributes']['length']?_0x1a062c[_0xeeb7('0x44')]:_0x12ce5f[_0xeeb7('0x40')];if(!_0x3a479e['query'][_0xeeb7('0x47')](_0xeeb7('0x48'))){_0x1a062c[_0xeeb7('0x2f')]=qs[_0xeeb7('0x2f')](_0x3a479e['query'][_0xeeb7('0x2f')]);_0x1a062c[_0xeeb7('0x31')]=qs['offset'](_0x3a479e[_0xeeb7('0x42')]['offset']);}_0x1a062c['order']=qs['sort'](_0x3a479e[_0xeeb7('0x42')][_0xeeb7('0x49')]);_0x1a062c[_0xeeb7('0x4a')]=qs[_0xeeb7('0x43')](_[_0xeeb7('0x4b')](_0x3a479e[_0xeeb7('0x42')],_0x12ce5f[_0xeeb7('0x43')]),_0x185d8b);if(_0x3a479e[_0xeeb7('0x42')]['filter']){_0x1a062c['where']=_[_0xeeb7('0x4c')](_0x1a062c[_0xeeb7('0x4a')],{'$or':_[_0xeeb7('0x3d')](_0x185d8b,function(_0x93ee0e){if(_0x93ee0e[_0xeeb7('0x4d')]!==_0xeeb7('0x4e')){var _0x3842af={};_0x3842af[_0x93ee0e['name']]={'$like':'%'+_0x3a479e[_0xeeb7('0x42')][_0xeeb7('0x4f')]+'%'};return _0x3842af;}})});}_0x1a062c=_['merge']({},_0x1a062c,_0x3a479e[_0xeeb7('0x50')]);var _0x30785a={'where':_0x1a062c[_0xeeb7('0x4a')]};return db[_0xeeb7('0x51')][_0xeeb7('0x30')](_0x30785a)[_0xeeb7('0x21')](function(_0x44cbd0){_0x2fa188['count']=_0x44cbd0;if(_0x3a479e[_0xeeb7('0x42')][_0xeeb7('0x52')]){_0x1a062c[_0xeeb7('0x53')]=[{'all':!![]}];}return db[_0xeeb7('0x51')]['findAll'](_0x1a062c);})[_0xeeb7('0x21')](function(_0x8ba840){_0x2fa188['rows']=_0x8ba840;return _0x2fa188;})[_0xeeb7('0x21')](respondWithFilteredResult(_0x5d114a,_0x1a062c))[_0xeeb7('0x54')](handleError(_0x5d114a,null));};exports[_0xeeb7('0x55')]=function(_0x1e6c7e,_0x3d781c){var _0x2810d1={'raw':!![],'where':{'id':_0x1e6c7e[_0xeeb7('0x56')]['id']}},_0x1021cd={};_0x1021cd[_0xeeb7('0x40')]=_[_0xeeb7('0x41')](db[_0xeeb7('0x51')]['rawAttributes']);_0x1021cd['query']=_[_0xeeb7('0x41')](_0x1e6c7e[_0xeeb7('0x42')]);_0x1021cd['filters']=_['intersection'](_0x1021cd['model'],_0x1021cd[_0xeeb7('0x42')]);_0x2810d1[_0xeeb7('0x44')]=_[_0xeeb7('0x45')](_0x1021cd[_0xeeb7('0x40')],qs[_0xeeb7('0x46')](_0x1e6c7e[_0xeeb7('0x42')][_0xeeb7('0x46')]));_0x2810d1[_0xeeb7('0x44')]=_0x2810d1[_0xeeb7('0x44')][_0xeeb7('0x57')]?_0x2810d1[_0xeeb7('0x44')]:_0x1021cd[_0xeeb7('0x40')];if(_0x1e6c7e[_0xeeb7('0x42')]['includeAll']){_0x2810d1['include']=[{'all':!![]}];}_0x2810d1=_[_0xeeb7('0x4c')]({},_0x2810d1,_0x1e6c7e[_0xeeb7('0x50')]);return db['SmsMessage']['find'](_0x2810d1)['then'](handleEntityNotFound(_0x3d781c,null))['then'](respondWithResult(_0x3d781c,null))[_0xeeb7('0x54')](handleError(_0x3d781c,null));};exports[_0xeeb7('0x58')]=function(_0x72707f,_0x4d554e){return db[_0xeeb7('0x51')]['create'](_0x72707f[_0xeeb7('0x59')],{})[_0xeeb7('0x21')](respondWithResult(_0x4d554e,0xc9))[_0xeeb7('0x54')](handleError(_0x4d554e,null));};exports['update']=function(_0x16b00a,_0x46a216){if(_0x16b00a[_0xeeb7('0x59')]['id']){delete _0x16b00a[_0xeeb7('0x59')]['id'];}return db[_0xeeb7('0x51')]['find']({'where':{'id':_0x16b00a['params']['id']}})[_0xeeb7('0x21')](handleEntityNotFound(_0x46a216,null))[_0xeeb7('0x21')](saveUpdates(_0x16b00a[_0xeeb7('0x59')],null))[_0xeeb7('0x21')](respondWithResult(_0x46a216,null))[_0xeeb7('0x54')](handleError(_0x46a216,null));};exports[_0xeeb7('0x38')]=function(_0x2f2065,_0x22b0a1){return db['SmsMessage'][_0xeeb7('0x5a')]({'where':{'id':_0x2f2065[_0xeeb7('0x56')]['id']}})[_0xeeb7('0x21')](handleEntityNotFound(_0x22b0a1,null))['then'](removeEntity(_0x22b0a1,null))[_0xeeb7('0x54')](handleError(_0x22b0a1,null));};exports[_0xeeb7('0x5b')]=function(_0x20f41b,_0x3c5dd5){return db['SmsMessage'][_0xeeb7('0x5b')]()['then'](respondWithResult(_0x3c5dd5,null))[_0xeeb7('0x54')](handleError(_0x3c5dd5,null));};var interaction_log=require(_0xeeb7('0x13'))(_0xeeb7('0x5c'));exports['accept']=function(_0x44b4a7,_0x21837c,_0x54b240){var _0x5f5c68={'agent':{},'channel':_0xeeb7('0x5d')};if(_0x44b4a7[_0xeeb7('0x59')]['id']){delete _0x44b4a7[_0xeeb7('0x59')]['id'];}_0x44b4a7['body']['read']=!![];_0x44b4a7[_0xeeb7('0x59')]['readAt']=moment()[_0xeeb7('0x5e')](_0xeeb7('0x5f'));_0x44b4a7[_0xeeb7('0x59')][_0xeeb7('0x60')]=_0x44b4a7[_0xeeb7('0x59')][_0xeeb7('0x60')]||_0x44b4a7['user']['id'];_0x5f5c68[_0xeeb7('0x61')]['id']=_0x44b4a7['body'][_0xeeb7('0x60')];return db[_0xeeb7('0x51')][_0xeeb7('0x5a')]({'where':{'id':_0x44b4a7['params']['id'],'UserId':null}})[_0xeeb7('0x21')](handleEntityNotFound(_0x21837c,null))['then'](saveUpdates(_0x44b4a7[_0xeeb7('0x59')],null))[_0xeeb7('0x21')](function(_0x3c6b29){if(_0x3c6b29){_0x5f5c68[_0xeeb7('0x29')]=_0x3c6b29[_0xeeb7('0x62')]({'plain':!![]});return db[_0xeeb7('0x63')][_0xeeb7('0x5a')]({'where':{'id':_0x3c6b29[_0xeeb7('0x64')]}});}return null;})[_0xeeb7('0x21')](handleEntityNotFound(_0x21837c,null))[_0xeeb7('0x21')](function(_0x5cadb6){if(_0x5cadb6){return _0x5cadb6[_0xeeb7('0x37')]({'UserId':_0x44b4a7[_0xeeb7('0x59')][_0xeeb7('0x60')],'read1stAt':_[_0xeeb7('0x65')](_0x5cadb6[_0xeeb7('0x66')])?moment()[_0xeeb7('0x5e')](_0xeeb7('0x5f')):undefined});}return null;})[_0xeeb7('0x21')](function(_0x12c5be){if(_0x12c5be){_0x5f5c68['interaction']=_0x12c5be[_0xeeb7('0x62')]({'plain':!![]});interaction_log[_0xeeb7('0x22')](_0xeeb7('0x67'),_0x44b4a7[_0xeeb7('0x68')]['id'],_0x44b4a7['user'][_0xeeb7('0x3a')],_0x44b4a7[_0xeeb7('0x68')][_0xeeb7('0x69')],_0x5f5c68['interaction']['id'],_0x44b4a7[_0xeeb7('0x59')]?JSON['stringify'](_0x44b4a7[_0xeeb7('0x59')]):'null');return respondWithRpcPromise('AcceptMessage',_0xeeb7('0x6a'),_0x5f5c68);}return null;})[_0xeeb7('0x21')](function(_0x53e237){var _0x4bd9d7=_0xeeb7('0x6b')+_0x53e237[_0xeeb7('0x29')][_0xeeb7('0x6c')];return db[_0xeeb7('0x6d')][_0xeeb7('0x42')](_0x4bd9d7,{'type':db['Sequelize'][_0xeeb7('0x6e')][_0xeeb7('0x6f')],'raw':!![]})[_0xeeb7('0x21')](function(_0x54bcaf){return _0x54bcaf;});})[_0xeeb7('0x21')](function(_0x197832){if(_0x197832){_0x5f5c68['message'][_0xeeb7('0x70')]=_0x197832[0x0];if(!_0x44b4a7[_0xeeb7('0x59')][_0xeeb7('0x60')])return;return db[_0xeeb7('0x71')]['find']({'where':{'id':_0x44b4a7[_0xeeb7('0x59')][_0xeeb7('0x60')],'role':_0xeeb7('0x61')},'attributes':['id','name',_0xeeb7('0x72'),_0xeeb7('0x73'),_0xeeb7('0x74')],'raw':!![]});}return null;})[_0xeeb7('0x21')](function(_0x198da5){if(!_0x198da5)return null;_0x5f5c68[_0xeeb7('0x29')][_0xeeb7('0x61')]=_0x198da5;return _0x5f5c68;})[_0xeeb7('0x21')](function(_0x3a21cb){if(_0x3a21cb){if(_0x44b4a7[_0xeeb7('0x59')]['manual']){_0x5f5c68['message'][_0xeeb7('0x75')]=util[_0xeeb7('0x5e')](_0xeeb7('0x76'),_0x44b4a7['user']['name']);_0x5f5c68[_0xeeb7('0x29')]['channel']=_0x5f5c68[_0xeeb7('0x77')];_0x5f5c68[_0xeeb7('0x29')][_0xeeb7('0x78')]=_0x5f5c68[_0xeeb7('0x77')];_0x5f5c68['message']['event']=_0xeeb7('0x79');return respondWithRpcPromise(_0xeeb7('0x7a'),'EventManager',{'event':_0xeeb7('0x7b'),'message':_0x5f5c68['message']},client9002)['then'](function(){return _0x5f5c68;});}return _0x5f5c68;}return null;})[_0xeeb7('0x21')](respondWithResult(_0x21837c,null))[_0xeeb7('0x54')](handleError(_0x21837c,null));};var interaction_log=require('../../config/logger')(_0xeeb7('0x5c'));exports[_0xeeb7('0x36')]=function(_0x377653,_0x46c2a4,_0xfd0486){var _0x24a405={'agent':{},'channel':_0xeeb7('0x5d')};if(_0x377653[_0xeeb7('0x59')]['id']){delete _0x377653['body']['id'];}_0x377653[_0xeeb7('0x59')][_0xeeb7('0x60')]=_0x377653['body'][_0xeeb7('0x60')]||_0x377653[_0xeeb7('0x68')]['id'];_0x24a405[_0xeeb7('0x61')]['id']=_0x377653[_0xeeb7('0x59')]['UserId'];return db[_0xeeb7('0x51')][_0xeeb7('0x5a')]({'where':{'id':_0x377653[_0xeeb7('0x56')]['id'],'UserId':null}})[_0xeeb7('0x21')](handleEntityNotFound(_0x46c2a4,null))[_0xeeb7('0x21')](function(_0x1f0ca4){if(_0x1f0ca4){_0x24a405[_0xeeb7('0x29')]=_0x1f0ca4[_0xeeb7('0x62')]({'plain':!![]});return db[_0xeeb7('0x63')][_0xeeb7('0x5a')]({'where':{'id':_0x1f0ca4[_0xeeb7('0x64')]}});}return null;})[_0xeeb7('0x21')](handleEntityNotFound(_0x46c2a4,null))[_0xeeb7('0x21')](function(_0x2c2700){if(_0x2c2700){_0x24a405[_0xeeb7('0x7c')]=_0x2c2700[_0xeeb7('0x62')]({'plain':!![]});interaction_log[_0xeeb7('0x22')](_0xeeb7('0x7d'),_0x377653['user']['id'],_0x377653[_0xeeb7('0x68')]['name'],_0x377653[_0xeeb7('0x68')][_0xeeb7('0x69')],_0x24a405['interaction']['id'],_0x377653[_0xeeb7('0x59')]?JSON['stringify'](_0x377653[_0xeeb7('0x59')]):_0xeeb7('0x7e'));return respondWithRpcPromise(_0xeeb7('0x7f'),_0xeeb7('0x80'),_0x24a405);}return null;})[_0xeeb7('0x21')](function(_0x2d3fa3){var _0x54f142='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x2d3fa3[_0xeeb7('0x29')][_0xeeb7('0x6c')];return db[_0xeeb7('0x6d')][_0xeeb7('0x42')](_0x54f142,{'type':db[_0xeeb7('0x81')][_0xeeb7('0x6e')][_0xeeb7('0x6f')],'raw':!![]})[_0xeeb7('0x21')](function(_0x57ddec){return _0x57ddec;});})[_0xeeb7('0x21')](function(_0x4e9dc1){if(_0x4e9dc1){_0x24a405[_0xeeb7('0x29')][_0xeeb7('0x70')]=_0x4e9dc1[0x0];if(!_0x377653[_0xeeb7('0x59')][_0xeeb7('0x60')])return;return db[_0xeeb7('0x71')][_0xeeb7('0x5a')]({'where':{'id':_0x377653[_0xeeb7('0x59')][_0xeeb7('0x60')],'role':'agent'},'attributes':['id',_0xeeb7('0x3a'),'fullname','email',_0xeeb7('0x74')],'raw':!![]});}return null;})[_0xeeb7('0x21')](function(_0x951f62){if(!_0x951f62)return null;_0x24a405['message'][_0xeeb7('0x61')]=_0x951f62;return _0x24a405;})[_0xeeb7('0x21')](function(_0x3cc143){if(_0x3cc143){_0x3cc143[_0xeeb7('0x29')][_0xeeb7('0x75')]=util['format'](_0xeeb7('0x76'),_0x377653['user'][_0xeeb7('0x3a')]);_0x3cc143[_0xeeb7('0x29')][_0xeeb7('0x77')]=_0x24a405[_0xeeb7('0x77')];_0x3cc143['message'][_0xeeb7('0x78')]=_0x24a405[_0xeeb7('0x77')];_0x3cc143['message']['event']='reject';respondWithRpcPromise(_0xeeb7('0x7a'),'EventManager',{'event':_0xeeb7('0x82'),'message':_0x3cc143[_0xeeb7('0x29')]},client9002);return _0x24a405;}return null;})['then'](respondWithResult(_0x46c2a4,null))[_0xeeb7('0x54')](handleError(_0x46c2a4,null));};exports[_0xeeb7('0x2c')]=function(_0x1e7c22,_0x459c60,_0x322c8b){if(_0x1e7c22[_0xeeb7('0x59')]['id']){delete _0x1e7c22[_0xeeb7('0x59')]['id'];}var _0xd78377;return db[_0xeeb7('0x51')][_0xeeb7('0x5a')]({'where':{'id':_0x1e7c22[_0xeeb7('0x56')]['id']}})[_0xeeb7('0x21')](handleEntityNotFound(_0x459c60,null))[_0xeeb7('0x21')](function(_0x2ce572){if(_0x2ce572){_0xd78377=_0x2ce572;return db[_0xeeb7('0x83')]['find']({'where':{'id':_0x2ce572[_0xeeb7('0x84')]}});}})[_0xeeb7('0x21')](handleEntityNotFound(_0x459c60,null))[_0xeeb7('0x21')](function(_0x2b7d00){if(_0x2b7d00){logger['debug'](_0xeeb7('0x85'),'status',_0xeeb7('0x86'),_0x2b7d00[_0xeeb7('0x4d')],util['inspect'](_0x1e7c22[_0xeeb7('0x59')],{'showHidden':![],'depth':null}));switch(_0x2b7d00[_0xeeb7('0x4d')]){case _0xeeb7('0x87'):if(_0x1e7c22['body'][_0xeeb7('0x88')]&&_0x1e7c22['body'][_0xeeb7('0x88')]===_0xd78377[_0xeeb7('0x89')]){return _0xd78377['update']({'read':!![]});}else{logger['error'](_0xeeb7('0x8a'),_0xeeb7('0x2c'),'twilio',util['inspect'](_0x1e7c22['body'],{'showHidden':![],'depth':null}));}break;case _0xeeb7('0x8b'):if(_0x1e7c22[_0xeeb7('0x59')][_0xeeb7('0x8c')]&&_0x1e7c22['body'][_0xeeb7('0x8c')]===_0xd78377[_0xeeb7('0x89')]&&_['indexOf']([_0xeeb7('0x8d'),_0xeeb7('0x8e')],_0x1e7c22[_0xeeb7('0x59')][_0xeeb7('0x8f')])>=0x0){return _0xd78377[_0xeeb7('0x37')]({'read':!![]});}else{logger[_0xeeb7('0x27')](_0xeeb7('0x8a'),_0xeeb7('0x2c'),_0xeeb7('0x90'),util[_0xeeb7('0x91')](_0x1e7c22[_0xeeb7('0x59')],{'showHidden':![],'depth':null}));}break;case _0xeeb7('0x92'):var _0x2a1db6=_0x1e7c22['body'][_0xeeb7('0x93')][0x0];if(_0x2a1db6['status'][_0xeeb7('0x94')]===_0xeeb7('0x95')){return _0xd78377['update']({'read':!![]});}else{logger[_0xeeb7('0x27')](_0xeeb7('0x8a'),_0xeeb7('0x2c'),'infobip',util[_0xeeb7('0x91')](_0x1e7c22[_0xeeb7('0x59')],{'showHidden':![],'depth':null}));}break;}return _0xd78377;}})[_0xeeb7('0x21')](respondWithResult(_0x459c60,null))[_0xeeb7('0x54')](handleError(_0x459c60,null));}; \ No newline at end of file +var _0x97e6=['readAt','format','UserId','agent','read1stAt','YYYY-MM-DD\x20HH:mm:ss','get','[SMSMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','Sequelize','QueryTypes','SELECT','contact','User','fullname','email','internal','manual','interface','SIP/%s','channel','motionChannel','EventManager','acceptmessage','SmsInteractionId','[SMSMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','null','RejectMessage','rejectMessage','event','reject','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','inspect','plivo','MessageUUID','sent','delivered','Status','infobip','results','groupName','DELIVERED','SmsAccount,\x20%s,\x20%s,\x20%s','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','to-csv','ejs','fs-extra','lodash','squel','crypto','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','jayson/promise','client','http','request','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','SmsMessage,\x20%s,\x20%s','message','result','sendStatus','status','json','undefined','offset','count','limit','set','Content-Range','apply','save','update','then','destroy','end','stack','name','SmsMessage','type','key','map','query','keys','filters','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','catch','show','params','rawAttributes','intersection','find','create','body','describe','sms-interactions','accept','sms'];(function(_0x555346,_0x431716){var _0x10926c=function(_0x55f228){while(--_0x55f228){_0x555346['push'](_0x555346['shift']());}};_0x10926c(++_0x431716);}(_0x97e6,0x159));var _0x697e=function(_0xf1226a,_0x29a250){_0xf1226a=_0xf1226a-0x0;var _0x1b8fe7=_0x97e6[_0xf1226a];return _0x1b8fe7;};'use strict';var emlformat=require(_0x697e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x697e('0x1'));var jsonpatch=require(_0x697e('0x2'));var rp=require(_0x697e('0x3'));var moment=require('moment');var BPromise=require(_0x697e('0x4'));var Mustache=require(_0x697e('0x5'));var util=require('util');var path=require(_0x697e('0x6'));var sox=require('sox');var csv=require(_0x697e('0x7'));var ejs=require(_0x697e('0x8'));var fs=require('fs');var fs_extra=require(_0x697e('0x9'));var _=require(_0x697e('0xa'));var squel=require(_0x697e('0xb'));var crypto=require(_0x697e('0xc'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0x697e('0x7'));var querystring=require(_0x697e('0xd'));var Papa=require(_0x697e('0xe'));var Redis=require('ioredis');var authService=require(_0x697e('0xf'));var qs=require(_0x697e('0x10'));var as=require(_0x697e('0x11'));var hardwareService=require(_0x697e('0x12'));var logger=require(_0x697e('0x13'))('api');var utils=require(_0x697e('0x14'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x697e('0x15'))['db'];config[_0x697e('0x16')]=_[_0x697e('0x17')](config['redis'],{'host':_0x697e('0x18'),'port':0x18eb});var socket=require(_0x697e('0x19'))(new Redis(config['redis']));require('./smsMessage.socket')[_0x697e('0x1a')](socket);var jayson=require(_0x697e('0x1b'));var client=jayson[_0x697e('0x1c')][_0x697e('0x1d')]({'port':0x232c});var client9002=jayson[_0x697e('0x1c')][_0x697e('0x1d')]({'port':0x232a});function respondWithRpcPromise(_0x1f0f4f,_0x32ff03,_0x3931a5,_0x5bc624){return new BPromise(function(_0x316bdb,_0x19a938){var _0x5581e7=_0x5bc624||client;return _0x5581e7[_0x697e('0x1e')](_0x1f0f4f,_0x3931a5)['then'](function(_0x233404){logger[_0x697e('0x1f')]('SmsMessage,\x20%s,\x20%s',_0x32ff03,_0x697e('0x20'));logger[_0x697e('0x21')](_0x697e('0x22'),_0x32ff03,_0x697e('0x20'),JSON[_0x697e('0x23')](_0x233404));if(_0x233404[_0x697e('0x24')]){if(_0x233404[_0x697e('0x24')][_0x697e('0x25')]===0x1f4){logger[_0x697e('0x24')](_0x697e('0x26'),_0x32ff03,_0x233404[_0x697e('0x24')]['message']);return _0x19a938(_0x233404[_0x697e('0x24')]['message']);}logger[_0x697e('0x24')](_0x697e('0x26'),_0x32ff03,_0x233404['error'][_0x697e('0x27')]);return _0x316bdb(_0x233404['error'][_0x697e('0x27')]);}else{logger[_0x697e('0x1f')](_0x697e('0x26'),_0x32ff03,_0x697e('0x20'));_0x316bdb(_0x233404[_0x697e('0x28')]['message']);}})['catch'](function(_0xc3d9d0){logger[_0x697e('0x24')](_0x697e('0x26'),_0x32ff03,_0xc3d9d0);_0x19a938(_0xc3d9d0);});});}function respondWithStatusCode(_0x3f6432,_0xb33a1c){_0xb33a1c=_0xb33a1c||0xcc;return function(_0x411c63){if(_0x411c63){return _0x3f6432[_0x697e('0x29')](_0xb33a1c);}return _0x3f6432['status'](_0xb33a1c)['end']();};}function respondWithResult(_0x1e3803,_0x2cc855){_0x2cc855=_0x2cc855||0xc8;return function(_0xfa2388){if(_0xfa2388){return _0x1e3803[_0x697e('0x2a')](_0x2cc855)[_0x697e('0x2b')](_0xfa2388);}};}function respondWithFilteredResult(_0x46e01b,_0x33f4b5){return function(_0x55833e){if(_0x55833e){var _0x492b6a=typeof _0x33f4b5['offset']===_0x697e('0x2c')&&typeof _0x33f4b5['limit']==='undefined';var _0x5785e5=_0x55833e['count'];var _0x367f74=_0x492b6a?0x0:_0x33f4b5[_0x697e('0x2d')];var _0x164cef=_0x492b6a?_0x55833e[_0x697e('0x2e')]:_0x33f4b5['offset']+_0x33f4b5[_0x697e('0x2f')];var _0x1eafca;if(_0x164cef>=_0x5785e5){_0x164cef=_0x5785e5;_0x1eafca=0xc8;}else{_0x1eafca=0xce;}_0x46e01b[_0x697e('0x2a')](_0x1eafca);return _0x46e01b[_0x697e('0x30')](_0x697e('0x31'),_0x367f74+'-'+_0x164cef+'/'+_0x5785e5)[_0x697e('0x2b')](_0x55833e);}return null;};}function patchUpdates(_0x5c54f9){return function(_0x5c2b84){try{jsonpatch[_0x697e('0x32')](_0x5c2b84,_0x5c54f9,!![]);}catch(_0x4160e3){return BPromise['reject'](_0x4160e3);}return _0x5c2b84[_0x697e('0x33')]();};}function saveUpdates(_0x19fd4c,_0x4cb9f6){return function(_0xd951b0){if(_0xd951b0){return _0xd951b0[_0x697e('0x34')](_0x19fd4c)[_0x697e('0x35')](function(_0x4171bd){return _0x4171bd;});}return null;};}function removeEntity(_0x1b7152,_0x390d4a){return function(_0x57f82b){if(_0x57f82b){return _0x57f82b[_0x697e('0x36')]()['then'](function(){_0x1b7152['status'](0xcc)[_0x697e('0x37')]();});}};}function handleEntityNotFound(_0x1c1040,_0x2bcac5){return function(_0x4e9052){if(!_0x4e9052){_0x1c1040[_0x697e('0x29')](0x194);}return _0x4e9052;};}function handleError(_0x27f773,_0x343135){_0x343135=_0x343135||0x1f4;return function(_0x4f61c2){logger[_0x697e('0x24')](_0x4f61c2[_0x697e('0x38')]);if(_0x4f61c2[_0x697e('0x39')]){delete _0x4f61c2[_0x697e('0x39')];}_0x27f773[_0x697e('0x2a')](_0x343135)['send'](_0x4f61c2);};}exports['index']=function(_0x2cb01e,_0x37655a){var _0x28ed6e={},_0x2bb49c={},_0xcf366d={'count':0x0,'rows':[]};var _0x170dbb=_['map'](db[_0x697e('0x3a')]['rawAttributes'],function(_0x3c796d){return{'name':_0x3c796d['fieldName'],'type':_0x3c796d[_0x697e('0x3b')][_0x697e('0x3c')]};});_0x2bb49c['model']=_[_0x697e('0x3d')](_0x170dbb,_0x697e('0x39'));_0x2bb49c[_0x697e('0x3e')]=_[_0x697e('0x3f')](_0x2cb01e[_0x697e('0x3e')]);_0x2bb49c[_0x697e('0x40')]=_['intersection'](_0x2bb49c[_0x697e('0x41')],_0x2bb49c[_0x697e('0x3e')]);_0x28ed6e[_0x697e('0x42')]=_['intersection'](_0x2bb49c[_0x697e('0x41')],qs['fields'](_0x2cb01e[_0x697e('0x3e')][_0x697e('0x43')]));_0x28ed6e[_0x697e('0x42')]=_0x28ed6e['attributes'][_0x697e('0x44')]?_0x28ed6e[_0x697e('0x42')]:_0x2bb49c[_0x697e('0x41')];if(!_0x2cb01e[_0x697e('0x3e')][_0x697e('0x45')](_0x697e('0x46'))){_0x28ed6e['limit']=qs[_0x697e('0x2f')](_0x2cb01e[_0x697e('0x3e')][_0x697e('0x2f')]);_0x28ed6e['offset']=qs[_0x697e('0x2d')](_0x2cb01e['query']['offset']);}_0x28ed6e[_0x697e('0x47')]=qs[_0x697e('0x48')](_0x2cb01e['query'][_0x697e('0x48')]);_0x28ed6e['where']=qs[_0x697e('0x40')](_[_0x697e('0x49')](_0x2cb01e[_0x697e('0x3e')],_0x2bb49c['filters']),_0x170dbb);if(_0x2cb01e[_0x697e('0x3e')][_0x697e('0x4a')]){_0x28ed6e[_0x697e('0x4b')]=_['merge'](_0x28ed6e['where'],{'$or':_[_0x697e('0x3d')](_0x170dbb,function(_0x2909b1){if(_0x2909b1[_0x697e('0x3b')]!==_0x697e('0x4c')){var _0x177225={};_0x177225[_0x2909b1[_0x697e('0x39')]]={'$like':'%'+_0x2cb01e[_0x697e('0x3e')][_0x697e('0x4a')]+'%'};return _0x177225;}})});}_0x28ed6e=_[_0x697e('0x4d')]({},_0x28ed6e,_0x2cb01e[_0x697e('0x4e')]);var _0x13986c={'where':_0x28ed6e[_0x697e('0x4b')]};return db[_0x697e('0x3a')]['count'](_0x13986c)[_0x697e('0x35')](function(_0x44a90a){_0xcf366d[_0x697e('0x2e')]=_0x44a90a;if(_0x2cb01e[_0x697e('0x3e')][_0x697e('0x4f')]){_0x28ed6e[_0x697e('0x50')]=[{'all':!![]}];}return db[_0x697e('0x3a')]['findAll'](_0x28ed6e);})[_0x697e('0x35')](function(_0x70a9f3){_0xcf366d['rows']=_0x70a9f3;return _0xcf366d;})[_0x697e('0x35')](respondWithFilteredResult(_0x37655a,_0x28ed6e))[_0x697e('0x51')](handleError(_0x37655a,null));};exports[_0x697e('0x52')]=function(_0x17f4bb,_0x2605d4){var _0x345c05={'raw':!![],'where':{'id':_0x17f4bb[_0x697e('0x53')]['id']}},_0x57641c={};_0x57641c[_0x697e('0x41')]=_[_0x697e('0x3f')](db[_0x697e('0x3a')][_0x697e('0x54')]);_0x57641c['query']=_[_0x697e('0x3f')](_0x17f4bb['query']);_0x57641c[_0x697e('0x40')]=_[_0x697e('0x55')](_0x57641c['model'],_0x57641c[_0x697e('0x3e')]);_0x345c05[_0x697e('0x42')]=_[_0x697e('0x55')](_0x57641c[_0x697e('0x41')],qs['fields'](_0x17f4bb[_0x697e('0x3e')][_0x697e('0x43')]));_0x345c05[_0x697e('0x42')]=_0x345c05['attributes'][_0x697e('0x44')]?_0x345c05[_0x697e('0x42')]:_0x57641c[_0x697e('0x41')];if(_0x17f4bb['query']['includeAll']){_0x345c05[_0x697e('0x50')]=[{'all':!![]}];}_0x345c05=_[_0x697e('0x4d')]({},_0x345c05,_0x17f4bb['options']);return db[_0x697e('0x3a')][_0x697e('0x56')](_0x345c05)[_0x697e('0x35')](handleEntityNotFound(_0x2605d4,null))[_0x697e('0x35')](respondWithResult(_0x2605d4,null))[_0x697e('0x51')](handleError(_0x2605d4,null));};exports['create']=function(_0x532805,_0x4c2d31){return db[_0x697e('0x3a')][_0x697e('0x57')](_0x532805[_0x697e('0x58')],{})[_0x697e('0x35')](respondWithResult(_0x4c2d31,0xc9))[_0x697e('0x51')](handleError(_0x4c2d31,null));};exports[_0x697e('0x34')]=function(_0x56b1c9,_0x524692){if(_0x56b1c9[_0x697e('0x58')]['id']){delete _0x56b1c9['body']['id'];}return db[_0x697e('0x3a')][_0x697e('0x56')]({'where':{'id':_0x56b1c9[_0x697e('0x53')]['id']}})[_0x697e('0x35')](handleEntityNotFound(_0x524692,null))[_0x697e('0x35')](saveUpdates(_0x56b1c9[_0x697e('0x58')],null))[_0x697e('0x35')](respondWithResult(_0x524692,null))[_0x697e('0x51')](handleError(_0x524692,null));};exports[_0x697e('0x36')]=function(_0x5eeacf,_0xce8a6c){return db['SmsMessage']['find']({'where':{'id':_0x5eeacf[_0x697e('0x53')]['id']}})[_0x697e('0x35')](handleEntityNotFound(_0xce8a6c,null))[_0x697e('0x35')](removeEntity(_0xce8a6c,null))[_0x697e('0x51')](handleError(_0xce8a6c,null));};exports['describe']=function(_0x25d33d,_0x572f1b){return db['SmsMessage'][_0x697e('0x59')]()[_0x697e('0x35')](respondWithResult(_0x572f1b,null))[_0x697e('0x51')](handleError(_0x572f1b,null));};var interaction_log=require('../../config/logger')(_0x697e('0x5a'));exports[_0x697e('0x5b')]=function(_0x3000ac,_0x4524ea,_0x3b463b){var _0x57f0a5={'agent':{},'channel':_0x697e('0x5c')};if(_0x3000ac[_0x697e('0x58')]['id']){delete _0x3000ac['body']['id'];}_0x3000ac[_0x697e('0x58')]['read']=!![];_0x3000ac[_0x697e('0x58')][_0x697e('0x5d')]=moment()[_0x697e('0x5e')]('YYYY-MM-DD\x20HH:mm:ss');_0x3000ac[_0x697e('0x58')][_0x697e('0x5f')]=_0x3000ac['body'][_0x697e('0x5f')]||_0x3000ac['user']['id'];_0x57f0a5[_0x697e('0x60')]['id']=_0x3000ac[_0x697e('0x58')][_0x697e('0x5f')];return db[_0x697e('0x3a')][_0x697e('0x56')]({'where':{'id':_0x3000ac[_0x697e('0x53')]['id'],'UserId':null}})[_0x697e('0x35')](handleEntityNotFound(_0x4524ea,null))[_0x697e('0x35')](saveUpdates(_0x3000ac[_0x697e('0x58')],null))['then'](function(_0x2c63e4){if(_0x2c63e4){_0x57f0a5[_0x697e('0x27')]=_0x2c63e4['get']({'plain':!![]});return db['SmsInteraction'][_0x697e('0x56')]({'where':{'id':_0x2c63e4['SmsInteractionId']}});}return null;})[_0x697e('0x35')](handleEntityNotFound(_0x4524ea,null))[_0x697e('0x35')](function(_0x148e23){if(_0x148e23){return _0x148e23[_0x697e('0x34')]({'UserId':_0x3000ac[_0x697e('0x58')][_0x697e('0x5f')],'read1stAt':_['isNil'](_0x148e23[_0x697e('0x61')])?moment()[_0x697e('0x5e')](_0x697e('0x62')):undefined});}return null;})[_0x697e('0x35')](function(_0x435060){if(_0x435060){_0x57f0a5['interaction']=_0x435060[_0x697e('0x63')]({'plain':!![]});interaction_log[_0x697e('0x1f')](_0x697e('0x64'),_0x3000ac[_0x697e('0x65')]['id'],_0x3000ac[_0x697e('0x65')][_0x697e('0x39')],_0x3000ac[_0x697e('0x65')][_0x697e('0x66')],_0x57f0a5[_0x697e('0x67')]['id'],_0x3000ac[_0x697e('0x58')]?JSON[_0x697e('0x23')](_0x3000ac[_0x697e('0x58')]):'null');return respondWithRpcPromise(_0x697e('0x68'),_0x697e('0x69'),_0x57f0a5);}return null;})[_0x697e('0x35')](function(_0x320e39){var _0x121656=_0x697e('0x6a')+_0x320e39[_0x697e('0x27')][_0x697e('0x6b')];return db[_0x697e('0x6c')]['query'](_0x121656,{'type':db[_0x697e('0x6d')][_0x697e('0x6e')][_0x697e('0x6f')],'raw':!![]})['then'](function(_0x48cc83){return _0x48cc83;});})['then'](function(_0x1cf629){if(_0x1cf629){_0x57f0a5[_0x697e('0x27')][_0x697e('0x70')]=_0x1cf629[0x0];if(!_0x3000ac['body'][_0x697e('0x5f')])return;return db[_0x697e('0x71')][_0x697e('0x56')]({'where':{'id':_0x3000ac['body'][_0x697e('0x5f')],'role':'agent'},'attributes':['id',_0x697e('0x39'),_0x697e('0x72'),_0x697e('0x73'),_0x697e('0x74')],'raw':!![]});}return null;})[_0x697e('0x35')](function(_0x206513){if(!_0x206513)return null;_0x57f0a5[_0x697e('0x27')]['agent']=_0x206513;return _0x57f0a5;})[_0x697e('0x35')](function(_0x47a599){if(_0x47a599){if(_0x3000ac[_0x697e('0x58')][_0x697e('0x75')]){_0x57f0a5[_0x697e('0x27')][_0x697e('0x76')]=util['format'](_0x697e('0x77'),_0x3000ac['user'][_0x697e('0x39')]);_0x57f0a5[_0x697e('0x27')][_0x697e('0x78')]=_0x57f0a5[_0x697e('0x78')];_0x57f0a5['message'][_0x697e('0x79')]=_0x57f0a5['channel'];_0x57f0a5['message']['event']=_0x697e('0x5b');return respondWithRpcPromise(_0x697e('0x7a'),'EventManager',{'event':_0x697e('0x7b'),'message':_0x57f0a5[_0x697e('0x27')]},client9002)[_0x697e('0x35')](function(){return _0x57f0a5;});}return _0x57f0a5;}return null;})[_0x697e('0x35')](respondWithResult(_0x4524ea,null))[_0x697e('0x51')](handleError(_0x4524ea,null));};var interaction_log=require(_0x697e('0x13'))(_0x697e('0x5a'));exports['reject']=function(_0x3e9554,_0x44213d,_0x536bac){var _0x3ee30f={'agent':{},'channel':_0x697e('0x5c')};if(_0x3e9554[_0x697e('0x58')]['id']){delete _0x3e9554['body']['id'];}_0x3e9554[_0x697e('0x58')][_0x697e('0x5f')]=_0x3e9554[_0x697e('0x58')][_0x697e('0x5f')]||_0x3e9554['user']['id'];_0x3ee30f['agent']['id']=_0x3e9554[_0x697e('0x58')][_0x697e('0x5f')];return db[_0x697e('0x3a')][_0x697e('0x56')]({'where':{'id':_0x3e9554[_0x697e('0x53')]['id'],'UserId':null}})['then'](handleEntityNotFound(_0x44213d,null))['then'](function(_0x14af20){if(_0x14af20){_0x3ee30f[_0x697e('0x27')]=_0x14af20['get']({'plain':!![]});return db['SmsInteraction'][_0x697e('0x56')]({'where':{'id':_0x14af20[_0x697e('0x7c')]}});}return null;})[_0x697e('0x35')](handleEntityNotFound(_0x44213d,null))[_0x697e('0x35')](function(_0x50e7c3){if(_0x50e7c3){_0x3ee30f[_0x697e('0x67')]=_0x50e7c3['get']({'plain':!![]});interaction_log['info'](_0x697e('0x7d'),_0x3e9554[_0x697e('0x65')]['id'],_0x3e9554[_0x697e('0x65')][_0x697e('0x39')],_0x3e9554['user'][_0x697e('0x66')],_0x3ee30f[_0x697e('0x67')]['id'],_0x3e9554[_0x697e('0x58')]?JSON[_0x697e('0x23')](_0x3e9554['body']):_0x697e('0x7e'));return respondWithRpcPromise(_0x697e('0x7f'),_0x697e('0x80'),_0x3ee30f);}return null;})[_0x697e('0x35')](function(_0x49ab53){var _0x3750d5='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x49ab53[_0x697e('0x27')][_0x697e('0x6b')];return db['sequelize'][_0x697e('0x3e')](_0x3750d5,{'type':db[_0x697e('0x6d')]['QueryTypes'][_0x697e('0x6f')],'raw':!![]})[_0x697e('0x35')](function(_0x8f12a3){return _0x8f12a3;});})['then'](function(_0x29de13){if(_0x29de13){_0x3ee30f[_0x697e('0x27')][_0x697e('0x70')]=_0x29de13[0x0];if(!_0x3e9554['body'][_0x697e('0x5f')])return;return db[_0x697e('0x71')][_0x697e('0x56')]({'where':{'id':_0x3e9554[_0x697e('0x58')]['UserId'],'role':'agent'},'attributes':['id',_0x697e('0x39'),_0x697e('0x72'),_0x697e('0x73'),_0x697e('0x74')],'raw':!![]});}return null;})[_0x697e('0x35')](function(_0x611687){if(!_0x611687)return null;_0x3ee30f[_0x697e('0x27')][_0x697e('0x60')]=_0x611687;return _0x3ee30f;})[_0x697e('0x35')](function(_0x4019b2){if(_0x4019b2){_0x4019b2[_0x697e('0x27')][_0x697e('0x76')]=util[_0x697e('0x5e')](_0x697e('0x77'),_0x3e9554['user']['name']);_0x4019b2[_0x697e('0x27')][_0x697e('0x78')]=_0x3ee30f[_0x697e('0x78')];_0x4019b2['message']['motionChannel']=_0x3ee30f['channel'];_0x4019b2[_0x697e('0x27')][_0x697e('0x81')]=_0x697e('0x82');respondWithRpcPromise(_0x697e('0x7a'),_0x697e('0x7a'),{'event':'rejectmessage','message':_0x4019b2[_0x697e('0x27')]},client9002);return _0x3ee30f;}return null;})['then'](respondWithResult(_0x44213d,null))['catch'](handleError(_0x44213d,null));};exports[_0x697e('0x2a')]=function(_0x4e2d0c,_0x26fcb8,_0x436f64){if(_0x4e2d0c[_0x697e('0x58')]['id']){delete _0x4e2d0c['body']['id'];}var _0x3ffd43;return db[_0x697e('0x3a')][_0x697e('0x56')]({'where':{'id':_0x4e2d0c[_0x697e('0x53')]['id']}})[_0x697e('0x35')](handleEntityNotFound(_0x26fcb8,null))[_0x697e('0x35')](function(_0x533bb7){if(_0x533bb7){_0x3ffd43=_0x533bb7;return db['SmsAccount'][_0x697e('0x56')]({'where':{'id':_0x533bb7['SmsAccountId']}});}})['then'](handleEntityNotFound(_0x26fcb8,null))[_0x697e('0x35')](function(_0x88f113){if(_0x88f113){logger[_0x697e('0x21')](_0x697e('0x22'),_0x697e('0x2a'),_0x697e('0x83'),_0x88f113[_0x697e('0x3b')],util['inspect'](_0x4e2d0c[_0x697e('0x58')],{'showHidden':![],'depth':null}));switch(_0x88f113[_0x697e('0x3b')]){case _0x697e('0x84'):if(_0x4e2d0c[_0x697e('0x58')]['MessageSid']&&_0x4e2d0c[_0x697e('0x58')][_0x697e('0x85')]===_0x3ffd43[_0x697e('0x86')]){return _0x3ffd43[_0x697e('0x34')]({'read':!![]});}else{logger['error']('SmsAccount,\x20%s,\x20%s,\x20%s',_0x697e('0x2a'),_0x697e('0x84'),util[_0x697e('0x87')](_0x4e2d0c[_0x697e('0x58')],{'showHidden':![],'depth':null}));}break;case _0x697e('0x88'):if(_0x4e2d0c['body']['MessageUUID']&&_0x4e2d0c['body'][_0x697e('0x89')]===_0x3ffd43[_0x697e('0x86')]&&_['indexOf']([_0x697e('0x8a'),_0x697e('0x8b')],_0x4e2d0c[_0x697e('0x58')][_0x697e('0x8c')])>=0x0){return _0x3ffd43[_0x697e('0x34')]({'read':!![]});}else{logger[_0x697e('0x24')]('SmsAccount,\x20%s,\x20%s,\x20%s',_0x697e('0x2a'),'plivio',util['inspect'](_0x4e2d0c['body'],{'showHidden':![],'depth':null}));}break;case _0x697e('0x8d'):var _0x204155=_0x4e2d0c[_0x697e('0x58')][_0x697e('0x8e')][0x0];if(_0x204155[_0x697e('0x2a')][_0x697e('0x8f')]===_0x697e('0x90')){return _0x3ffd43[_0x697e('0x34')]({'read':!![]});}else{logger[_0x697e('0x24')](_0x697e('0x91'),_0x697e('0x2a'),_0x697e('0x8d'),util['inspect'](_0x4e2d0c[_0x697e('0x58')],{'showHidden':![],'depth':null}));}break;}return _0x3ffd43;}})[_0x697e('0x35')](respondWithResult(_0x26fcb8,null))['catch'](handleError(_0x26fcb8,null));}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.events.js b/server/api/smsMessage/smsMessage.events.js index 42b6c29..22ca291 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 _0x94a9=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x413ff0,_0x1e782d){var _0x3826d4=function(_0x46c7ae){while(--_0x46c7ae){_0x413ff0['push'](_0x413ff0['shift']());}};_0x3826d4(++_0x1e782d);}(_0x94a9,0x1a6));var _0x994a=function(_0x5425e4,_0x5e979e){_0x5425e4=_0x5425e4-0x0;var _0x2dea2d=_0x94a9[_0x5425e4];return _0x2dea2d;};'use strict';var EventEmitter=require(_0x994a('0x0'));var SmsMessage=require(_0x994a('0x1'))['db'][_0x994a('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x994a('0x3')](0x0);var events={'afterCreate':_0x994a('0x4'),'afterUpdate':_0x994a('0x5'),'afterDestroy':_0x994a('0x6')};function emitEvent(_0x29ad5a){return function(_0x5b55f8,_0x1d51e7,_0x1e9c14){SmsMessageEvents[_0x994a('0x7')](_0x29ad5a+':'+_0x5b55f8['id'],_0x5b55f8);SmsMessageEvents[_0x994a('0x7')](_0x29ad5a,_0x5b55f8);_0x1e9c14(null);};}for(var e in events){if(events[_0x994a('0x8')](e)){var event=events[e];SmsMessage[_0x994a('0x9')](e,emitEvent(event));}}module[_0x994a('0xa')]=SmsMessageEvents; \ No newline at end of file +var _0xbaf8=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsMessage','setMaxListeners','save','update','remove'];(function(_0x4c4080,_0x60d300){var _0x3dc479=function(_0x29e229){while(--_0x29e229){_0x4c4080['push'](_0x4c4080['shift']());}};_0x3dc479(++_0x60d300);}(_0xbaf8,0x16f));var _0x8baf=function(_0x3c4047,_0x26c881){_0x3c4047=_0x3c4047-0x0;var _0xea78a2=_0xbaf8[_0x3c4047];return _0xea78a2;};'use strict';var EventEmitter=require(_0x8baf('0x0'));var SmsMessage=require(_0x8baf('0x1'))['db'][_0x8baf('0x2')];var SmsMessageEvents=new EventEmitter();SmsMessageEvents[_0x8baf('0x3')](0x0);var events={'afterCreate':_0x8baf('0x4'),'afterUpdate':_0x8baf('0x5'),'afterDestroy':_0x8baf('0x6')};function emitEvent(_0x139135){return function(_0x4126ba,_0x3f8a65,_0x26e881){SmsMessageEvents[_0x8baf('0x7')](_0x139135+':'+_0x4126ba['id'],_0x4126ba);SmsMessageEvents[_0x8baf('0x7')](_0x139135,_0x4126ba);_0x26e881(null);};}for(var e in events){if(events[_0x8baf('0x8')](e)){var event=events[e];SmsMessage[_0x8baf('0x9')](e,emitEvent(event));}}module[_0x8baf('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 113cea1..4d539ca 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 _0x1169=['sid','catch','SmsMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','skebby','password','smsMethod','sender','login?username=','username','&password=','GET','split','internal_order_id','deliveryReport','read','Missing\x20parameters:\x20username,\x20password','senderString','https://smsapi.connectel.se/api/v2/send/','requestid','connectel','clicksend','format','%s:%s','POST','https://rest.clicksend.com/v3/sms/send','Basic\x20%s','toString','base64','http_code','head','data','message_id','clickSend','plivo','authId','/status?token=','https://api.plivo.com/v1/Account/%s/Message/','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','/auth/1/session','/sms/2/text/advanced','application/json','IBSSO\x20','Missing\x20parameters:\x20base_url','apiKey','login','text','timestamp','keys','length','createHash','md5','digest','hex','signature=','/external/get/send.php?','id_sms','csc','Missing\x20parameters:\x20apiKey','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','bandwidth','https://messaging.bandwidth.com/api/v2/users/','accountId','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','Token\x20not\x20received','finally','utf8mb4_unicode_ci','lodash','util','../../config/logger','api','rimraf','./smsMessage.attributes','exports','define','sms_messages','messageId','fti_sms_messages','body','FULLTEXT','get','direction','toLowerCase','out','secret','UserId','isNil','SmsInteractionId','SmsInteraction','findOne','then','update','createdAt','error','SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','token'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0x1169,0x1b9));var _0x9116=function(_0x17dea9,_0x4c1134){_0x17dea9=_0x17dea9-0x0;var _0x1962ca=_0x1169[_0x17dea9];return _0x1962ca;};'use strict';var _=require(_0x9116('0x0'));var util=require(_0x9116('0x1'));var logger=require(_0x9116('0x2'))(_0x9116('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x9116('0x4'));var config=require('../../config/environment');var attributes=require(_0x9116('0x5'));module[_0x9116('0x6')]=function(_0x249860,_0x4de516){return _0x249860[_0x9116('0x7')]('SmsMessage',attributes,{'tableName':_0x9116('0x8'),'paranoid':![],'indexes':[{'name':_0x9116('0x9'),'fields':[_0x9116('0x9')]},{'name':_0x9116('0xa'),'fields':[_0x9116('0xb')],'type':_0x9116('0xc')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x1aa278,_0x240499,_0x456db1){var _0x34e2a7=_0x249860['models'];var _0x3fd607=_0x1aa278[_0x9116('0xd')]({'plain':!![]});if(_0x3fd607[_0x9116('0xe')][_0x9116('0xf')]()==='in'||_0x3fd607[_0x9116('0xe')][_0x9116('0xf')]()===_0x9116('0x10')&&!_0x3fd607[_0x9116('0x11')]&&!_['isNil'](_0x3fd607[_0x9116('0x12')])&&!_[_0x9116('0x13')](_0x3fd607[_0x9116('0x14')])){_0x34e2a7[_0x9116('0x15')][_0x9116('0x16')]({'where':{'id':_0x3fd607['SmsInteractionId']}})[_0x9116('0x17')](function(_0x2d663e){if(_0x2d663e){_0x2d663e[_0x9116('0x18')]({'lastMsgAt':_0x3fd607[_0x9116('0x19')],'lastMsgDirection':_0x3fd607[_0x9116('0xe')]['toLowerCase']()});}})['catch'](function(_0x1b3310){console[_0x9116('0x1a')](_0x1b3310);});}if(_0x3fd607['direction']==='out'&&!_0x3fd607[_0x9116('0x11')]){var _0x1b1166;_0x34e2a7[_0x9116('0x1b')][_0x9116('0x1c')]({'where':{'id':_0x3fd607[_0x9116('0x1d')]},'raw':!![]})[_0x9116('0x17')](function(_0x5b6e90){_0x1b1166=_0x5b6e90;if(_0x1b1166&&_0x1b1166[_0x9116('0x1e')]){switch(_0x1b1166[_0x9116('0x1e')]){case _0x9116('0x1f'):var _0x3062fa=require('twilio');if(_0x1b1166[_0x9116('0x20')]&&_0x1b1166[_0x9116('0x21')]&&_0x1b1166[_0x9116('0x22')]){var _0x462d09=new _0x3062fa(_0x1b1166[_0x9116('0x20')],_0x1b1166[_0x9116('0x21')]);_0x462d09[_0x9116('0x23')]['create']({'body':_0x3fd607['body'],'to':_0x3fd607[_0x9116('0x22')],'from':_0x1b1166[_0x9116('0x22')],'statusCallback':_0x1b1166[_0x9116('0x24')]+_0x9116('0x25')+_0x3fd607['id']+'/status?token='+_0x1b1166[_0x9116('0x26')]})[_0x9116('0x17')](function(_0x52570d){if(_0x52570d[_0x9116('0x27')]){return _0x1aa278[_0x9116('0x18')]({'messageId':_0x52570d['sid']});}})[_0x9116('0x28')](function(_0x41ada2){logger[_0x9116('0x1a')](_0x9116('0x29'),'afterCreate','twilio',util[_0x9116('0x2a')](_0x41ada2,{'showHidden':![],'depth':null}));});}else{logger[_0x9116('0x1a')](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x1f'),'Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken');}break;case _0x9116('0x2c'):var _0x31ba1e='https://api.skebby.it/API/v1.0/REST/';if(_0x1b1166['username']&&_0x1b1166[_0x9116('0x2d')]){var _0x4bab5e={'recipient':[_0x3fd607[_0x9116('0x22')]],'message':_0x3fd607[_0x9116('0xb')],'message_type':_0x1b1166[_0x9116('0x2e')]};if(_0x1b1166['smsMethod']&&_0x1b1166[_0x9116('0x2e')]!=='SI'){_0x4bab5e[_0x9116('0x2f')]=_0x1b1166['phone'];}var _0x424b78={'url':_0x31ba1e+_0x9116('0x30')+_0x1b1166[_0x9116('0x31')]+_0x9116('0x32')+_0x1b1166[_0x9116('0x2d')],'method':_0x9116('0x33')};rp(_0x424b78)[_0x9116('0x17')](function(_0x109233){var _0x16186d=_0x109233[_0x9116('0x34')](';');var _0x286037={'user_key':_0x16186d[0x0],'session_key':_0x16186d[0x1]};_0x424b78={'url':_0x31ba1e+'sms','method':'POST','headers':{'user_key':_0x286037['user_key'],'Session_key':_0x286037['session_key']},'json':!![],'body':_0x4bab5e};return rp(_0x424b78);})[_0x9116('0x17')](function(_0x3198eb){if(_0x3198eb['total_sent']>=0x1){var _0x5f2a23={'messageId':_0x3198eb[_0x9116('0x35')]};if(_0x1b1166[_0x9116('0x2e')]!=='GP'||!_0x1b1166[_0x9116('0x36')]){_0x5f2a23[_0x9116('0x37')]=!![];}return _0x1aa278[_0x9116('0x18')](_0x5f2a23);}else{return logger[_0x9116('0x1a')](_0x9116('0x29'),_0x9116('0x2b'),'skebby',util['inspect'](_0x3198eb,{'showHidden':![],'depth':null}));}})[_0x9116('0x28')](function(_0x395d97){return logger[_0x9116('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9116('0x2b'),_0x9116('0x2c'),util[_0x9116('0x2a')](_0x395d97,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x2c'),_0x9116('0x38'));}break;case'connectel':if(_0x1b1166['authToken']){var _0x4d976a={'recipient':_0x3fd607['phone'],'message':_0x3fd607['body'],'sender':_0x1b1166[_0x9116('0x39')]||_0x1b1166[_0x9116('0x22')],'authorization':_0x1b1166[_0x9116('0x21')]};var _0x240499={'method':'POST','uri':_0x9116('0x3a'),'body':_0x4d976a,'json':!![]};rp(_0x240499)['then'](function(_0x29a34d){var _0xcff540={'messageId':_0x29a34d[_0x9116('0x3b')]};if(!_0x1b1166[_0x9116('0x36')]){_0xcff540[_0x9116('0x37')]=!![];}return _0x1aa278['update'](_0xcff540);})[_0x9116('0x28')](function(_0x1b6735){logger[_0x9116('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9116('0x2b'),_0x9116('0x3c'),util[_0x9116('0x2a')](_0x1b6735,{'showHidden':![],'depth':null}));});}else{logger[_0x9116('0x1a')](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x3c'),'Missing\x20parameters:\x20authToken');}break;case _0x9116('0x3d'):if(_0x1b1166['username']&&_0x1b1166['password']){var _0x4d976a={'messages':[{'source':'xCALLY\x20Motion','to':_0x3fd607[_0x9116('0x22')],'body':_0x3fd607[_0x9116('0xb')],'from':_0x1b1166[_0x9116('0x39')]||_0x1b1166[_0x9116('0x22')]}]};var _0x3d31c8=util[_0x9116('0x3e')](_0x9116('0x3f'),_0x1b1166[_0x9116('0x31')],_0x1b1166['password']);var _0x240499={'method':_0x9116('0x40'),'uri':_0x9116('0x41'),'body':_0x4d976a,'headers':{'Authorization':util[_0x9116('0x3e')](_0x9116('0x42'),new Buffer(_0x3d31c8)[_0x9116('0x43')](_0x9116('0x44')))},'json':!![]};rp(_0x240499)[_0x9116('0x17')](function(_0x3d1be3){if(_0x3d1be3[_0x9116('0x45')]>=0xc8&&_0x3d1be3['http_code']<=0xce){if(_0x3d1be3['data']&&_0x3d1be3['data']['queued_count']>0x0){var _0xadd9f3=_[_0x9116('0x46')](_0x3d1be3[_0x9116('0x47')][_0x9116('0x23')]);var _0x2f9cd2={'messageId':_0xadd9f3[_0x9116('0x48')]};if(!_0x1b1166['deliveryReport']){_0x2f9cd2[_0x9116('0x37')]=!![];}return _0x1aa278['update'](_0x2f9cd2);}else{logger['error'](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x49'),util[_0x9116('0x2a')](_0x3d1be3,{'showHidden':![],'depth':null}));}}else{logger[_0x9116('0x1a')](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x49'),util[_0x9116('0x2a')](_0x3d1be3,{'showHidden':![],'depth':null}));}})[_0x9116('0x28')](function(_0x356a0c){logger[_0x9116('0x1a')](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x49'),util[_0x9116('0x2a')](_0x356a0c,{'showHidden':![],'depth':null}));});}else{logger[_0x9116('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9116('0x2b'),_0x9116('0x49'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x9116('0x4a'):if(_0x1b1166[_0x9116('0x4b')]&&_0x1b1166[_0x9116('0x21')]){var _0x4d976a={'dst':_0x3fd607['phone'],'text':_0x3fd607['body'],'src':_0x1b1166[_0x9116('0x39')]||_0x1b1166[_0x9116('0x22')],'url':_0x1b1166['remote']+_0x9116('0x25')+_0x3fd607['id']+_0x9116('0x4c')+_0x1b1166[_0x9116('0x26')]};var _0x3d31c8=util[_0x9116('0x3e')]('%s:%s',_0x1b1166[_0x9116('0x4b')],_0x1b1166[_0x9116('0x21')]);var _0x240499={'method':_0x9116('0x40'),'uri':util[_0x9116('0x3e')](_0x9116('0x4d'),_0x1b1166[_0x9116('0x4b')]),'body':_0x4d976a,'headers':{'Authorization':util[_0x9116('0x3e')](_0x9116('0x42'),new Buffer(_0x3d31c8)[_0x9116('0x43')]('base64'))},'json':!![]};rp(_0x240499)['then'](function(_0x517b5d){var _0x2b9980={'messageId':_0x517b5d[_0x9116('0x4e')][0x0]};return _0x1aa278[_0x9116('0x18')](_0x2b9980);})[_0x9116('0x28')](function(_0x1290df){logger[_0x9116('0x1a')](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x4a'),util[_0x9116('0x2a')](_0x1290df,{'showHidden':![],'depth':null}));});}else{logger[_0x9116('0x1a')](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x4a'),_0x9116('0x4f'));}break;case _0x9116('0x50'):if(_0x1b1166[_0x9116('0x31')]&&_0x1b1166['password']){if(_0x1b1166[_0x9116('0x51')]){var _0x182fac={'method':_0x9116('0x40'),'uri':_0x1b1166[_0x9116('0x51')]+_0x9116('0x52'),'body':{'username':_0x1b1166[_0x9116('0x31')],'password':_0x1b1166['password']},'json':!![]};return rp(_0x182fac)[_0x9116('0x17')](function(_0x3bc00d){var _0x299c57={'method':_0x9116('0x40'),'uri':_0x1b1166['baseUrl']+_0x9116('0x53'),'body':{'messages':[{'from':_0x1b1166['phone'],'destinations':[{'to':_0x3fd607[_0x9116('0x22')]}],'text':_0x3fd607[_0x9116('0xb')],'notifyUrl':_0x1b1166['remote']+_0x9116('0x25')+_0x3fd607['id']+_0x9116('0x4c')+_0x1b1166[_0x9116('0x26')],'notifyContentType':_0x9116('0x54'),'callbackData':_0x1b1166[_0x9116('0x22')]+';'+_0x3fd607[_0x9116('0xb')]}]},'headers':{'Authorization':_0x9116('0x55')+_0x3bc00d['token']},'json':!![]};return rp(_0x299c57)['then'](function(_0x574fc6){if(_0x574fc6[_0x9116('0x23')]){var _0x186d0f={'messageId':_0x574fc6[_0x9116('0x23')][0x0]['messageId']};if(!_0x1b1166['deliveryReport']){_0x186d0f[_0x9116('0x37')]=!![];}return _0x1aa278[_0x9116('0x18')](_0x186d0f);}else{return logger[_0x9116('0x1a')](_0x9116('0x29'),_0x9116('0x2b'),'infobip',util[_0x9116('0x2a')](_0x574fc6,{'showHidden':![],'depth':null}));}});})[_0x9116('0x28')](function(_0x2f11b0){return logger[_0x9116('0x1a')](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x50'),util[_0x9116('0x2a')](_0x2f11b0,{'showHidden':![],'depth':null}));});}else{logger[_0x9116('0x1a')](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x50'),_0x9116('0x56'));}}else{logger[_0x9116('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9116('0x2b'),_0x9116('0x50'),_0x9116('0x38'));}break;case'csc':var _0x4de31f=require('crypto');if(_0x1b1166[_0x9116('0x57')]){var _0x241d57={};_0x241d57[_0x9116('0x58')]=_0x1b1166['username'];_0x241d57[_0x9116('0x22')]=_0x3fd607['phone'];_0x241d57['sender']=_0x1b1166[_0x9116('0x22')];_0x241d57[_0x9116('0x59')]=_0x3fd607[_0x9116('0xb')];_0x241d57[_0x9116('0x5a')]=+new Date();var _0x3f4fb5='';var _0xaf27c1='';var _0x546ffb=Object[_0x9116('0x5b')](_0x241d57);_0x546ffb['sort']();for(var _0xbc4c90=0x0;_0xbc4c90<_0x546ffb[_0x9116('0x5c')];_0xbc4c90++){if(_0x3f4fb5!=''){_0x3f4fb5+='&';}_0x3f4fb5+=_0x546ffb[_0xbc4c90]+'='+encodeURIComponent(_0x241d57[_0x546ffb[_0xbc4c90]]);_0xaf27c1+=_0x241d57[_0x546ffb[_0xbc4c90]];}_0xaf27c1+=_0x1b1166['apiKey'];_0xaf27c1=_0x4de31f[_0x9116('0x5d')](_0x9116('0x5e'))[_0x9116('0x18')](_0xaf27c1)[_0x9116('0x5f')](_0x9116('0x60'));if(_0x3f4fb5!==''){_0x3f4fb5+='&';}_0x3f4fb5+=_0x9116('0x61')+_0xaf27c1;var _0x424b78={'method':_0x9116('0x33'),'uri':_0x1b1166[_0x9116('0x51')]+_0x9116('0x62')+_0x3f4fb5,'json':!![]};return rp(_0x424b78)[_0x9116('0x17')](function(_0x1d0fcd){var _0x3009e3=Object[_0x9116('0x5b')](_0x1d0fcd);if(_0x1d0fcd[_0x3009e3[0x0]][_0x9116('0x1a')]&&parseInt(_0x1d0fcd[_0x3009e3[0x0]][_0x9116('0x1a')])===0x0){var _0x55eae1={'messageId':_0x1d0fcd[_0x3009e3[0x0]][_0x9116('0x63')]};if(!_0x1b1166[_0x9116('0x36')]){_0x55eae1[_0x9116('0x37')]=!![];}return _0x1aa278['update'](_0x55eae1);}else{return logger[_0x9116('0x1a')](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x64'),util[_0x9116('0x2a')](_0x1d0fcd[_0x9116('0x1a')],{'showHidden':![],'depth':null}));}})['catch'](function(_0x3bd292){return logger[_0x9116('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9116('0x2b'),_0x9116('0x64'),util['inspect'](_0x3bd292,{'showHidden':![],'depth':null}));});}else{logger['error'](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x64'),_0x9116('0x65'));}break;case _0x9116('0x66'):if(_0x1b1166[_0x9116('0x57')]){var _0x7b60d0={'method':_0x9116('0x40'),'uri':_0x9116('0x67'),'headers':{'Authorization':_0x1b1166[_0x9116('0x57')]},'body':{'content':_0x3fd607[_0x9116('0xb')],'to':[_0x3fd607['phone']],'from':_0x1b1166[_0x9116('0x22')],'binary':![],'clientMessageId':_0x9116('0x68'),'charset':_0x9116('0x69')},'json':!![]};rp(_0x7b60d0)[_0x9116('0x17')](function(_0x391fe5){if(!_0x391fe5['error']){var _0x2c3e87={'messageId':_0x391fe5[_0x9116('0x23')][0x0]['apiMessageId']};if(!_0x1b1166[_0x9116('0x36')]){_0x2c3e87[_0x9116('0x37')]=!![];}return _0x1aa278[_0x9116('0x18')](_0x2c3e87);}else{return logger['error'](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x66'),util[_0x9116('0x2a')](_0x391fe5[_0x9116('0x1a')],{'showHidden':![],'depth':null}));}})[_0x9116('0x28')](function(_0x113ea4){return logger['error'](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x66'),util[_0x9116('0x2a')](_0x113ea4,{'showHidden':![],'depth':null}));});}else{logger[_0x9116('0x1a')](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x66'),_0x9116('0x65'));}break;case _0x9116('0x6a'):if(_0x1b1166['username']&&_0x1b1166[_0x9116('0x2d')]){var _0x3d31c8=util[_0x9116('0x3e')](_0x9116('0x3f'),_0x1b1166[_0x9116('0x31')],_0x1b1166['password']);var _0x240499={'method':_0x9116('0x40'),'uri':_0x9116('0x6b')+_0x1b1166[_0x9116('0x6c')]+'/messages','body':{'to':[_0x3fd607[_0x9116('0x22')]],'text':_0x3fd607['body'],'from':_0x1b1166['phone'],'applicationId':_0x1b1166[_0x9116('0x6d')]},'headers':{'Authorization':util[_0x9116('0x3e')](_0x9116('0x42'),new Buffer(_0x3d31c8)['toString'](_0x9116('0x44')))},'json':!![]};rp(_0x240499)[_0x9116('0x17')](function(_0x246dca){if(_0x246dca['id']){var _0x4ebf3d={'messageId':_0x246dca['id']};return _0x1aa278['update'](_0x4ebf3d);}else{logger[_0x9116('0x1a')](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x6a'),util[_0x9116('0x2a')](_0x246dca,{'showHidden':![],'depth':null}));}})[_0x9116('0x28')](function(_0x1d4371){logger[_0x9116('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9116('0x2b'),'bandwidth',util[_0x9116('0x2a')](_0x1d4371,{'showHidden':![],'depth':null}));});}else{logger[_0x9116('0x1a')](_0x9116('0x29'),_0x9116('0x2b'),_0x9116('0x6a'),'Missing\x20parameters:\x20username,\x20password');}break;case _0x9116('0x6e'):if(_0x1b1166[_0x9116('0x57')]){var _0x5311c9={};var _0x424b78={'method':'POST','uri':_0x9116('0x6f'),'headers':{'Authorization':_0x9116('0x70')+_0x1b1166[_0x9116('0x57')],'Content-Type':'application/json'},'body':{'from':_0x1b1166[_0x9116('0x22')],'to':_0x3fd607[_0x9116('0x22')],'text':_0x3fd607[_0x9116('0xb')]},'json':!![]};return rp(_0x424b78)[_0x9116('0x17')](function(_0x5d4c92){if(_0x5d4c92[_0x9116('0x71')]==0xca){_0x5311c9[_0x9116('0x72')]=_0x5d4c92;var _0x5622de={'method':'POST','uri':_0x9116('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x1b1166[_0x9116('0x57')],'Content-Type':_0x9116('0x54')},'body':{'refid':_0x5311c9['message']['refid']},'json':!![]};return rp(_0x5622de)['then'](function(_0x31f5c1){_0x5311c9['status']=_0x31f5c1;var _0x2fc608={'messageId':_0x5311c9['message'][_0x9116('0x74')],'read':!![]};return _0x1aa278[_0x9116('0x18')](_0x2fc608);});}else{return logger['error'](_0x9116('0x29'),'afterCreate','intelepeer',util['inspect'](_0x5d4c92,{'showHidden':![],'depth':null}));}})['catch'](function(_0x1eb874){return logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9116('0x2b'),'intelepeer',util['inspect'](_0x1eb874,{'showHidden':![],'depth':null}));});}else{return logger[_0x9116('0x1a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0x9116('0x2b'),_0x9116('0x6e'),_0x9116('0x75'));}break;}}})[_0x9116('0x76')](function(){_0x456db1();});}else{_0x456db1();}}},'charset':'utf8mb4','collate':_0x9116('0x77')});}; \ No newline at end of file +var _0xf8db=['SmsAccount','find','SmsAccountId','type','twilio','accountSid','authToken','phone','messages','remote','/api/sms/messages/','/status?token=','sid','catch','error','SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','skebby','username','smsMethod','sender','login?username=','&password=','password','GET','split','sms','user_key','total_sent','internal_order_id','deliveryReport','inspect','Missing\x20parameters:\x20username,\x20password','connectel','senderString','POST','https://smsapi.connectel.se/api/v2/send/','requestid','read','xCALLY\x20Motion','%s:%s','https://rest.clicksend.com/v3/sms/send','format','Basic\x20%s','toString','base64','http_code','data','head','message_id','clickSend','plivo','authId','token','message_uuid','Missing\x20parameters:\x20authId,\x20authToken','infobip','baseUrl','csc','crypto','apiKey','login','keys','sort','length','createHash','md5','digest','hex','/external/get/send.php?','id_sms','clickatell','https://platform.clickatell.com/messages','uuid','UTF-8','apiMessageId','Missing\x20parameters:\x20apiKey','https://messaging.bandwidth.com/api/v2/users/','accountId','applicationId','bandwidth','https://api.intelepeer.com/_rest/v4/app/sms/send','Bearer\x20','application/json','code','message','https://api.intelepeer.com/_rest/v4/app/sms/mdr','refid','intelepeer','Token\x20not\x20received','utf8mb4','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsMessage.attributes','exports','define','SmsMessage','messageId','fti_sms_messages','body','FULLTEXT','models','direction','toLowerCase','out','secret','UserId','isNil','SmsInteractionId','then','update','createdAt'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xf8db,0x14c));var _0xbf8d=function(_0x441c12,_0x491e5a){_0x441c12=_0x441c12-0x0;var _0x312edf=_0xf8db[_0x441c12];return _0x312edf;};'use strict';var _=require(_0xbf8d('0x0'));var util=require(_0xbf8d('0x1'));var logger=require('../../config/logger')(_0xbf8d('0x2'));var moment=require(_0xbf8d('0x3'));var BPromise=require(_0xbf8d('0x4'));var rp=require(_0xbf8d('0x5'));var fs=require('fs');var path=require(_0xbf8d('0x6'));var rimraf=require(_0xbf8d('0x7'));var config=require(_0xbf8d('0x8'));var attributes=require(_0xbf8d('0x9'));module[_0xbf8d('0xa')]=function(_0x15696e,_0x2c8fbc){return _0x15696e[_0xbf8d('0xb')](_0xbf8d('0xc'),attributes,{'tableName':'sms_messages','paranoid':![],'indexes':[{'name':_0xbf8d('0xd'),'fields':['messageId']},{'name':_0xbf8d('0xe'),'fields':[_0xbf8d('0xf')],'type':_0xbf8d('0x10')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x159f90,_0x5bfdaa,_0x3ed885){var _0x884204=_0x15696e[_0xbf8d('0x11')];var _0x569194=_0x159f90['get']({'plain':!![]});if(_0x569194[_0xbf8d('0x12')][_0xbf8d('0x13')]()==='in'||_0x569194[_0xbf8d('0x12')][_0xbf8d('0x13')]()===_0xbf8d('0x14')&&!_0x569194[_0xbf8d('0x15')]&&!_['isNil'](_0x569194[_0xbf8d('0x16')])&&!_[_0xbf8d('0x17')](_0x569194[_0xbf8d('0x18')])){_0x884204['SmsInteraction']['findOne']({'where':{'id':_0x569194[_0xbf8d('0x18')]}})[_0xbf8d('0x19')](function(_0x1856c2){if(_0x1856c2){_0x1856c2[_0xbf8d('0x1a')]({'lastMsgAt':_0x569194[_0xbf8d('0x1b')],'lastMsgDirection':_0x569194[_0xbf8d('0x12')][_0xbf8d('0x13')]()});}})['catch'](function(_0x4f0c14){console['error'](_0x4f0c14);});}if(_0x569194[_0xbf8d('0x12')]===_0xbf8d('0x14')&&!_0x569194[_0xbf8d('0x15')]){var _0x16e335;_0x884204[_0xbf8d('0x1c')][_0xbf8d('0x1d')]({'where':{'id':_0x569194[_0xbf8d('0x1e')]},'raw':!![]})['then'](function(_0x132368){_0x16e335=_0x132368;if(_0x16e335&&_0x16e335[_0xbf8d('0x1f')]){switch(_0x16e335[_0xbf8d('0x1f')]){case'twilio':var _0x2a4134=require(_0xbf8d('0x20'));if(_0x16e335[_0xbf8d('0x21')]&&_0x16e335[_0xbf8d('0x22')]&&_0x16e335[_0xbf8d('0x23')]){var _0x1bf9b6=new _0x2a4134(_0x16e335[_0xbf8d('0x21')],_0x16e335[_0xbf8d('0x22')]);_0x1bf9b6[_0xbf8d('0x24')]['create']({'body':_0x569194[_0xbf8d('0xf')],'to':_0x569194['phone'],'from':_0x16e335[_0xbf8d('0x23')],'statusCallback':_0x16e335[_0xbf8d('0x25')]+_0xbf8d('0x26')+_0x569194['id']+_0xbf8d('0x27')+_0x16e335['token']})[_0xbf8d('0x19')](function(_0x43f11d){if(_0x43f11d['sid']){return _0x159f90[_0xbf8d('0x1a')]({'messageId':_0x43f11d[_0xbf8d('0x28')]});}})[_0xbf8d('0x29')](function(_0x5c1c09){logger[_0xbf8d('0x2a')](_0xbf8d('0x2b'),_0xbf8d('0x2c'),_0xbf8d('0x20'),util['inspect'](_0x5c1c09,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbf8d('0x2b'),_0xbf8d('0x2c'),_0xbf8d('0x20'),_0xbf8d('0x2d'));}break;case _0xbf8d('0x2e'):var _0x72e21c='https://api.skebby.it/API/v1.0/REST/';if(_0x16e335[_0xbf8d('0x2f')]&&_0x16e335['password']){var _0x56fd63={'recipient':[_0x569194[_0xbf8d('0x23')]],'message':_0x569194[_0xbf8d('0xf')],'message_type':_0x16e335[_0xbf8d('0x30')]};if(_0x16e335[_0xbf8d('0x30')]&&_0x16e335[_0xbf8d('0x30')]!=='SI'){_0x56fd63[_0xbf8d('0x31')]=_0x16e335[_0xbf8d('0x23')];}var _0x1043da={'url':_0x72e21c+_0xbf8d('0x32')+_0x16e335[_0xbf8d('0x2f')]+_0xbf8d('0x33')+_0x16e335[_0xbf8d('0x34')],'method':_0xbf8d('0x35')};rp(_0x1043da)[_0xbf8d('0x19')](function(_0x49700c){var _0x245055=_0x49700c[_0xbf8d('0x36')](';');var _0x1e28da={'user_key':_0x245055[0x0],'session_key':_0x245055[0x1]};_0x1043da={'url':_0x72e21c+_0xbf8d('0x37'),'method':'POST','headers':{'user_key':_0x1e28da[_0xbf8d('0x38')],'Session_key':_0x1e28da['session_key']},'json':!![],'body':_0x56fd63};return rp(_0x1043da);})[_0xbf8d('0x19')](function(_0x260cb9){if(_0x260cb9[_0xbf8d('0x39')]>=0x1){var _0x80f39e={'messageId':_0x260cb9[_0xbf8d('0x3a')]};if(_0x16e335[_0xbf8d('0x30')]!=='GP'||!_0x16e335[_0xbf8d('0x3b')]){_0x80f39e['read']=!![];}return _0x159f90['update'](_0x80f39e);}else{return logger[_0xbf8d('0x2a')](_0xbf8d('0x2b'),_0xbf8d('0x2c'),_0xbf8d('0x2e'),util[_0xbf8d('0x3c')](_0x260cb9,{'showHidden':![],'depth':null}));}})['catch'](function(_0x55e5b7){return logger[_0xbf8d('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbf8d('0x2c'),_0xbf8d('0x2e'),util['inspect'](_0x55e5b7,{'showHidden':![],'depth':null}));});}else{logger[_0xbf8d('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xbf8d('0x2e'),_0xbf8d('0x3d'));}break;case _0xbf8d('0x3e'):if(_0x16e335[_0xbf8d('0x22')]){var _0x294b96={'recipient':_0x569194[_0xbf8d('0x23')],'message':_0x569194['body'],'sender':_0x16e335[_0xbf8d('0x3f')]||_0x16e335[_0xbf8d('0x23')],'authorization':_0x16e335[_0xbf8d('0x22')]};var _0x5bfdaa={'method':_0xbf8d('0x40'),'uri':_0xbf8d('0x41'),'body':_0x294b96,'json':!![]};rp(_0x5bfdaa)[_0xbf8d('0x19')](function(_0x39b26a){var _0x37c65c={'messageId':_0x39b26a[_0xbf8d('0x42')]};if(!_0x16e335['deliveryReport']){_0x37c65c[_0xbf8d('0x43')]=!![];}return _0x159f90['update'](_0x37c65c);})['catch'](function(_0x53a693){logger[_0xbf8d('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbf8d('0x2c'),_0xbf8d('0x3e'),util[_0xbf8d('0x3c')](_0x53a693,{'showHidden':![],'depth':null}));});}else{logger[_0xbf8d('0x2a')](_0xbf8d('0x2b'),_0xbf8d('0x2c'),_0xbf8d('0x3e'),'Missing\x20parameters:\x20authToken');}break;case'clicksend':if(_0x16e335[_0xbf8d('0x2f')]&&_0x16e335[_0xbf8d('0x34')]){var _0x294b96={'messages':[{'source':_0xbf8d('0x44'),'to':_0x569194[_0xbf8d('0x23')],'body':_0x569194[_0xbf8d('0xf')],'from':_0x16e335[_0xbf8d('0x3f')]||_0x16e335[_0xbf8d('0x23')]}]};var _0x1278ec=util['format'](_0xbf8d('0x45'),_0x16e335[_0xbf8d('0x2f')],_0x16e335['password']);var _0x5bfdaa={'method':_0xbf8d('0x40'),'uri':_0xbf8d('0x46'),'body':_0x294b96,'headers':{'Authorization':util[_0xbf8d('0x47')](_0xbf8d('0x48'),new Buffer(_0x1278ec)[_0xbf8d('0x49')](_0xbf8d('0x4a')))},'json':!![]};rp(_0x5bfdaa)['then'](function(_0x20e15a){if(_0x20e15a[_0xbf8d('0x4b')]>=0xc8&&_0x20e15a[_0xbf8d('0x4b')]<=0xce){if(_0x20e15a[_0xbf8d('0x4c')]&&_0x20e15a[_0xbf8d('0x4c')]['queued_count']>0x0){var _0x27cb2e=_[_0xbf8d('0x4d')](_0x20e15a[_0xbf8d('0x4c')][_0xbf8d('0x24')]);var _0x47ec95={'messageId':_0x27cb2e[_0xbf8d('0x4e')]};if(!_0x16e335[_0xbf8d('0x3b')]){_0x47ec95[_0xbf8d('0x43')]=!![];}return _0x159f90['update'](_0x47ec95);}else{logger[_0xbf8d('0x2a')](_0xbf8d('0x2b'),'afterCreate',_0xbf8d('0x4f'),util[_0xbf8d('0x3c')](_0x20e15a,{'showHidden':![],'depth':null}));}}else{logger['error'](_0xbf8d('0x2b'),_0xbf8d('0x2c'),_0xbf8d('0x4f'),util[_0xbf8d('0x3c')](_0x20e15a,{'showHidden':![],'depth':null}));}})[_0xbf8d('0x29')](function(_0x4540d9){logger[_0xbf8d('0x2a')](_0xbf8d('0x2b'),_0xbf8d('0x2c'),_0xbf8d('0x4f'),util[_0xbf8d('0x3c')](_0x4540d9,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbf8d('0x2b'),_0xbf8d('0x2c'),_0xbf8d('0x4f'),_0xbf8d('0x3d'));}break;case _0xbf8d('0x50'):if(_0x16e335[_0xbf8d('0x51')]&&_0x16e335[_0xbf8d('0x22')]){var _0x294b96={'dst':_0x569194[_0xbf8d('0x23')],'text':_0x569194['body'],'src':_0x16e335['senderString']||_0x16e335['phone'],'url':_0x16e335[_0xbf8d('0x25')]+_0xbf8d('0x26')+_0x569194['id']+_0xbf8d('0x27')+_0x16e335[_0xbf8d('0x52')]};var _0x1278ec=util[_0xbf8d('0x47')]('%s:%s',_0x16e335['authId'],_0x16e335[_0xbf8d('0x22')]);var _0x5bfdaa={'method':_0xbf8d('0x40'),'uri':util[_0xbf8d('0x47')]('https://api.plivo.com/v1/Account/%s/Message/',_0x16e335[_0xbf8d('0x51')]),'body':_0x294b96,'headers':{'Authorization':util[_0xbf8d('0x47')](_0xbf8d('0x48'),new Buffer(_0x1278ec)[_0xbf8d('0x49')](_0xbf8d('0x4a')))},'json':!![]};rp(_0x5bfdaa)[_0xbf8d('0x19')](function(_0x121798){var _0x5b158e={'messageId':_0x121798[_0xbf8d('0x53')][0x0]};return _0x159f90['update'](_0x5b158e);})[_0xbf8d('0x29')](function(_0x5ca687){logger[_0xbf8d('0x2a')](_0xbf8d('0x2b'),_0xbf8d('0x2c'),_0xbf8d('0x50'),util[_0xbf8d('0x3c')](_0x5ca687,{'showHidden':![],'depth':null}));});}else{logger[_0xbf8d('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbf8d('0x2c'),_0xbf8d('0x50'),_0xbf8d('0x54'));}break;case _0xbf8d('0x55'):if(_0x16e335[_0xbf8d('0x2f')]&&_0x16e335[_0xbf8d('0x34')]){if(_0x16e335[_0xbf8d('0x56')]){var _0x34c920={'method':'POST','uri':_0x16e335[_0xbf8d('0x56')]+'/auth/1/session','body':{'username':_0x16e335[_0xbf8d('0x2f')],'password':_0x16e335[_0xbf8d('0x34')]},'json':!![]};return rp(_0x34c920)[_0xbf8d('0x19')](function(_0x3b33ab){var _0xb4d99={'method':_0xbf8d('0x40'),'uri':_0x16e335[_0xbf8d('0x56')]+'/sms/2/text/advanced','body':{'messages':[{'from':_0x16e335[_0xbf8d('0x23')],'destinations':[{'to':_0x569194[_0xbf8d('0x23')]}],'text':_0x569194[_0xbf8d('0xf')],'notifyUrl':_0x16e335[_0xbf8d('0x25')]+_0xbf8d('0x26')+_0x569194['id']+'/status?token='+_0x16e335[_0xbf8d('0x52')],'notifyContentType':'application/json','callbackData':_0x16e335['phone']+';'+_0x569194['body']}]},'headers':{'Authorization':'IBSSO\x20'+_0x3b33ab[_0xbf8d('0x52')]},'json':!![]};return rp(_0xb4d99)[_0xbf8d('0x19')](function(_0x35c47b){if(_0x35c47b[_0xbf8d('0x24')]){var _0x46f901={'messageId':_0x35c47b[_0xbf8d('0x24')][0x0][_0xbf8d('0xd')]};if(!_0x16e335[_0xbf8d('0x3b')]){_0x46f901[_0xbf8d('0x43')]=!![];}return _0x159f90[_0xbf8d('0x1a')](_0x46f901);}else{return logger[_0xbf8d('0x2a')](_0xbf8d('0x2b'),_0xbf8d('0x2c'),_0xbf8d('0x55'),util[_0xbf8d('0x3c')](_0x35c47b,{'showHidden':![],'depth':null}));}});})[_0xbf8d('0x29')](function(_0x13d483){return logger[_0xbf8d('0x2a')](_0xbf8d('0x2b'),'afterCreate',_0xbf8d('0x55'),util[_0xbf8d('0x3c')](_0x13d483,{'showHidden':![],'depth':null}));});}else{logger[_0xbf8d('0x2a')](_0xbf8d('0x2b'),_0xbf8d('0x2c'),_0xbf8d('0x55'),'Missing\x20parameters:\x20base_url');}}else{logger[_0xbf8d('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbf8d('0x2c'),_0xbf8d('0x55'),_0xbf8d('0x3d'));}break;case _0xbf8d('0x57'):var _0x1b10e0=require(_0xbf8d('0x58'));if(_0x16e335[_0xbf8d('0x59')]){var _0x175327={};_0x175327[_0xbf8d('0x5a')]=_0x16e335[_0xbf8d('0x2f')];_0x175327['phone']=_0x569194[_0xbf8d('0x23')];_0x175327[_0xbf8d('0x31')]=_0x16e335[_0xbf8d('0x23')];_0x175327['text']=_0x569194[_0xbf8d('0xf')];_0x175327['timestamp']=+new Date();var _0x47bc8c='';var _0x3b4feb='';var _0x9082e5=Object[_0xbf8d('0x5b')](_0x175327);_0x9082e5[_0xbf8d('0x5c')]();for(var _0x246eb3=0x0;_0x246eb3<_0x9082e5[_0xbf8d('0x5d')];_0x246eb3++){if(_0x47bc8c!=''){_0x47bc8c+='&';}_0x47bc8c+=_0x9082e5[_0x246eb3]+'='+encodeURIComponent(_0x175327[_0x9082e5[_0x246eb3]]);_0x3b4feb+=_0x175327[_0x9082e5[_0x246eb3]];}_0x3b4feb+=_0x16e335[_0xbf8d('0x59')];_0x3b4feb=_0x1b10e0[_0xbf8d('0x5e')](_0xbf8d('0x5f'))[_0xbf8d('0x1a')](_0x3b4feb)[_0xbf8d('0x60')](_0xbf8d('0x61'));if(_0x47bc8c!==''){_0x47bc8c+='&';}_0x47bc8c+='signature='+_0x3b4feb;var _0x1043da={'method':_0xbf8d('0x35'),'uri':_0x16e335[_0xbf8d('0x56')]+_0xbf8d('0x62')+_0x47bc8c,'json':!![]};return rp(_0x1043da)[_0xbf8d('0x19')](function(_0x544a77){var _0x36b799=Object[_0xbf8d('0x5b')](_0x544a77);if(_0x544a77[_0x36b799[0x0]][_0xbf8d('0x2a')]&&parseInt(_0x544a77[_0x36b799[0x0]][_0xbf8d('0x2a')])===0x0){var _0xb65d5b={'messageId':_0x544a77[_0x36b799[0x0]][_0xbf8d('0x63')]};if(!_0x16e335[_0xbf8d('0x3b')]){_0xb65d5b['read']=!![];}return _0x159f90[_0xbf8d('0x1a')](_0xb65d5b);}else{return logger['error'](_0xbf8d('0x2b'),_0xbf8d('0x2c'),_0xbf8d('0x57'),util[_0xbf8d('0x3c')](_0x544a77[_0xbf8d('0x2a')],{'showHidden':![],'depth':null}));}})[_0xbf8d('0x29')](function(_0x5c4baa){return logger[_0xbf8d('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbf8d('0x2c'),_0xbf8d('0x57'),util[_0xbf8d('0x3c')](_0x5c4baa,{'showHidden':![],'depth':null}));});}else{logger[_0xbf8d('0x2a')](_0xbf8d('0x2b'),'afterCreate',_0xbf8d('0x57'),'Missing\x20parameters:\x20apiKey');}break;case _0xbf8d('0x64'):if(_0x16e335[_0xbf8d('0x59')]){var _0x406eb0={'method':_0xbf8d('0x40'),'uri':_0xbf8d('0x65'),'headers':{'Authorization':_0x16e335[_0xbf8d('0x59')]},'body':{'content':_0x569194[_0xbf8d('0xf')],'to':[_0x569194[_0xbf8d('0x23')]],'from':_0x16e335[_0xbf8d('0x23')],'binary':![],'clientMessageId':_0xbf8d('0x66'),'charset':_0xbf8d('0x67')},'json':!![]};rp(_0x406eb0)[_0xbf8d('0x19')](function(_0x56e149){if(!_0x56e149[_0xbf8d('0x2a')]){var _0xfa93a3={'messageId':_0x56e149[_0xbf8d('0x24')][0x0][_0xbf8d('0x68')]};if(!_0x16e335[_0xbf8d('0x3b')]){_0xfa93a3[_0xbf8d('0x43')]=!![];}return _0x159f90[_0xbf8d('0x1a')](_0xfa93a3);}else{return logger[_0xbf8d('0x2a')](_0xbf8d('0x2b'),_0xbf8d('0x2c'),_0xbf8d('0x64'),util['inspect'](_0x56e149[_0xbf8d('0x2a')],{'showHidden':![],'depth':null}));}})[_0xbf8d('0x29')](function(_0x1b7cda){return logger['error'](_0xbf8d('0x2b'),_0xbf8d('0x2c'),_0xbf8d('0x64'),util['inspect'](_0x1b7cda,{'showHidden':![],'depth':null}));});}else{logger['error']('SmsMessage,\x20%s,\x20%s,\x20%s','afterCreate',_0xbf8d('0x64'),_0xbf8d('0x69'));}break;case'bandwidth':if(_0x16e335[_0xbf8d('0x2f')]&&_0x16e335[_0xbf8d('0x34')]){var _0x1278ec=util[_0xbf8d('0x47')](_0xbf8d('0x45'),_0x16e335[_0xbf8d('0x2f')],_0x16e335[_0xbf8d('0x34')]);var _0x5bfdaa={'method':_0xbf8d('0x40'),'uri':_0xbf8d('0x6a')+_0x16e335[_0xbf8d('0x6b')]+'/messages','body':{'to':[_0x569194[_0xbf8d('0x23')]],'text':_0x569194[_0xbf8d('0xf')],'from':_0x16e335['phone'],'applicationId':_0x16e335[_0xbf8d('0x6c')]},'headers':{'Authorization':util[_0xbf8d('0x47')]('Basic\x20%s',new Buffer(_0x1278ec)[_0xbf8d('0x49')](_0xbf8d('0x4a')))},'json':!![]};rp(_0x5bfdaa)[_0xbf8d('0x19')](function(_0x116d54){if(_0x116d54['id']){var _0x5f3462={'messageId':_0x116d54['id']};return _0x159f90[_0xbf8d('0x1a')](_0x5f3462);}else{logger[_0xbf8d('0x2a')](_0xbf8d('0x2b'),_0xbf8d('0x2c'),_0xbf8d('0x6d'),util[_0xbf8d('0x3c')](_0x116d54,{'showHidden':![],'depth':null}));}})[_0xbf8d('0x29')](function(_0x8ace1){logger[_0xbf8d('0x2a')](_0xbf8d('0x2b'),_0xbf8d('0x2c'),'bandwidth',util['inspect'](_0x8ace1,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xbf8d('0x2b'),_0xbf8d('0x2c'),'bandwidth','Missing\x20parameters:\x20username,\x20password');}break;case'intelepeer':if(_0x16e335[_0xbf8d('0x59')]){var _0x24ef30={};var _0x1043da={'method':_0xbf8d('0x40'),'uri':_0xbf8d('0x6e'),'headers':{'Authorization':_0xbf8d('0x6f')+_0x16e335[_0xbf8d('0x59')],'Content-Type':_0xbf8d('0x70')},'body':{'from':_0x16e335[_0xbf8d('0x23')],'to':_0x569194[_0xbf8d('0x23')],'text':_0x569194['body']},'json':!![]};return rp(_0x1043da)['then'](function(_0x7371d1){if(_0x7371d1[_0xbf8d('0x71')]==0xca){_0x24ef30[_0xbf8d('0x72')]=_0x7371d1;var _0x572310={'method':_0xbf8d('0x40'),'uri':_0xbf8d('0x73'),'headers':{'Authorization':'Bearer\x20'+_0x16e335[_0xbf8d('0x59')],'Content-Type':_0xbf8d('0x70')},'body':{'refid':_0x24ef30[_0xbf8d('0x72')][_0xbf8d('0x74')]},'json':!![]};return rp(_0x572310)[_0xbf8d('0x19')](function(_0xe3ed7d){_0x24ef30['status']=_0xe3ed7d;var _0x3d9895={'messageId':_0x24ef30['message'][_0xbf8d('0x74')],'read':!![]};return _0x159f90['update'](_0x3d9895);});}else{return logger[_0xbf8d('0x2a')](_0xbf8d('0x2b'),_0xbf8d('0x2c'),'intelepeer',util[_0xbf8d('0x3c')](_0x7371d1,{'showHidden':![],'depth':null}));}})[_0xbf8d('0x29')](function(_0x13226c){return logger['error'](_0xbf8d('0x2b'),_0xbf8d('0x2c'),_0xbf8d('0x75'),util[_0xbf8d('0x3c')](_0x13226c,{'showHidden':![],'depth':null}));});}else{return logger[_0xbf8d('0x2a')]('SmsMessage,\x20%s,\x20%s,\x20%s',_0xbf8d('0x2c'),'intelepeer',_0xbf8d('0x76'));}break;}}})['finally'](function(){_0x3ed885();});}else{_0x3ed885();}}},'charset':_0xbf8d('0x77'),'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 39ff356..5ad6f38 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 _0xf0f9=['stringify','code','error','SmsMessage,\x20%s,\x20%s','message','catch','CreateSmsMessage','SmsMessage','options','raw','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','http','redis','localhost','socket.io-emitter','./smsMessage.socket','register','then','info','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s'];(function(_0x3c3a37,_0x137fc5){var _0x30e6cc=function(_0x419e36){while(--_0x419e36){_0x3c3a37['push'](_0x3c3a37['shift']());}};_0x30e6cc(++_0x137fc5);}(_0xf0f9,0x14a));var _0x9f0f=function(_0x1711f1,_0x5dd611){_0x1711f1=_0x1711f1-0x0;var _0x2e170d=_0xf0f9[_0x1711f1];return _0x2e170d;};'use strict';var _=require(_0x9f0f('0x0'));var util=require(_0x9f0f('0x1'));var moment=require(_0x9f0f('0x2'));var BPromise=require(_0x9f0f('0x3'));var rs=require(_0x9f0f('0x4'));var fs=require('fs');var Redis=require(_0x9f0f('0x5'));var db=require(_0x9f0f('0x6'))['db'];var utils=require(_0x9f0f('0x7'));var logger=require(_0x9f0f('0x8'))(_0x9f0f('0x9'));var config=require('../../config/environment');var jayson=require(_0x9f0f('0xa'));var client=jayson['client'][_0x9f0f('0xb')]({'port':0x232a});config[_0x9f0f('0xc')]=_['defaults'](config[_0x9f0f('0xc')],{'host':_0x9f0f('0xd'),'port':0x18eb});var socket=require(_0x9f0f('0xe'))(new Redis(config[_0x9f0f('0xc')]));require(_0x9f0f('0xf'))[_0x9f0f('0x10')](socket);function respondWithRpcPromise(_0x18bf6a,_0x5d51c3,_0x2f663e){return new BPromise(function(_0x379517,_0x59b3db){return client['request'](_0x18bf6a,_0x2f663e)[_0x9f0f('0x11')](function(_0x22e52b){logger[_0x9f0f('0x12')]('SmsMessage,\x20%s,\x20%s',_0x5d51c3,_0x9f0f('0x13'));logger[_0x9f0f('0x14')](_0x9f0f('0x15'),_0x5d51c3,'request\x20sent',JSON[_0x9f0f('0x16')](_0x22e52b));if(_0x22e52b['error']){if(_0x22e52b['error'][_0x9f0f('0x17')]===0x1f4){logger[_0x9f0f('0x18')](_0x9f0f('0x19'),_0x5d51c3,_0x22e52b[_0x9f0f('0x18')][_0x9f0f('0x1a')]);return _0x59b3db(_0x22e52b[_0x9f0f('0x18')][_0x9f0f('0x1a')]);}logger['error'](_0x9f0f('0x19'),_0x5d51c3,_0x22e52b[_0x9f0f('0x18')][_0x9f0f('0x1a')]);return _0x379517(_0x22e52b[_0x9f0f('0x18')][_0x9f0f('0x1a')]);}else{logger[_0x9f0f('0x12')](_0x9f0f('0x19'),_0x5d51c3,'request\x20sent');_0x379517(_0x22e52b['result']['message']);}})[_0x9f0f('0x1b')](function(_0x28f733){logger[_0x9f0f('0x18')](_0x9f0f('0x19'),_0x5d51c3,_0x28f733);_0x59b3db(_0x28f733);});});}exports[_0x9f0f('0x1c')]=function(_0x373710){var _0x42457b=this;return new Promise(function(_0x15b307,_0x5c85dd){return db[_0x9f0f('0x1d')]['create'](_0x373710['body'],{'raw':_0x373710[_0x9f0f('0x1e')]?_0x373710[_0x9f0f('0x1e')][_0x9f0f('0x1f')]===undefined?!![]:![]:!![]})[_0x9f0f('0x11')](function(_0x4e9966){logger[_0x9f0f('0x12')](_0x9f0f('0x1c'),_0x373710);logger[_0x9f0f('0x14')](_0x9f0f('0x1c'),_0x373710,JSON[_0x9f0f('0x16')](_0x4e9966));_0x15b307(_0x4e9966);})[_0x9f0f('0x1b')](function(_0x5b13a8){logger['error'](_0x9f0f('0x1c'),_0x5b13a8[_0x9f0f('0x1a')],_0x373710);_0x5c85dd(_0x42457b[_0x9f0f('0x18')](0x1f4,_0x5b13a8['message']));});});}; \ No newline at end of file +var _0xcfeb=['create','body','options','raw','then','CreateSmsMessage','lodash','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','defaults','redis','localhost','./smsMessage.socket','register','request','SmsMessage,\x20%s,\x20%s','request\x20sent','debug','SmsMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','SmsMessage'];(function(_0x11b677,_0x2e556f){var _0x34ccdb=function(_0x28c277){while(--_0x28c277){_0x11b677['push'](_0x11b677['shift']());}};_0x34ccdb(++_0x2e556f);}(_0xcfeb,0x187));var _0xbcfe=function(_0x26d26d,_0x3c56de){_0x26d26d=_0x26d26d-0x0;var _0x4ef747=_0xcfeb[_0x26d26d];return _0x4ef747;};'use strict';var _=require(_0xbcfe('0x0'));var util=require(_0xbcfe('0x1'));var moment=require(_0xbcfe('0x2'));var BPromise=require('bluebird');var rs=require(_0xbcfe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbcfe('0x4'))['db'];var utils=require(_0xbcfe('0x5'));var logger=require(_0xbcfe('0x6'))(_0xbcfe('0x7'));var config=require(_0xbcfe('0x8'));var jayson=require(_0xbcfe('0x9'));var client=jayson[_0xbcfe('0xa')][_0xbcfe('0xb')]({'port':0x232a});config['redis']=_[_0xbcfe('0xc')](config[_0xbcfe('0xd')],{'host':_0xbcfe('0xe'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xbcfe('0xd')]));require(_0xbcfe('0xf'))[_0xbcfe('0x10')](socket);function respondWithRpcPromise(_0x1ce488,_0x4d90b3,_0x855a94){return new BPromise(function(_0x42b34b,_0x3cb594){return client[_0xbcfe('0x11')](_0x1ce488,_0x855a94)['then'](function(_0x59a705){logger['info'](_0xbcfe('0x12'),_0x4d90b3,_0xbcfe('0x13'));logger[_0xbcfe('0x14')](_0xbcfe('0x15'),_0x4d90b3,_0xbcfe('0x13'),JSON[_0xbcfe('0x16')](_0x59a705));if(_0x59a705[_0xbcfe('0x17')]){if(_0x59a705[_0xbcfe('0x17')]['code']===0x1f4){logger['error']('SmsMessage,\x20%s,\x20%s',_0x4d90b3,_0x59a705[_0xbcfe('0x17')][_0xbcfe('0x18')]);return _0x3cb594(_0x59a705[_0xbcfe('0x17')]['message']);}logger[_0xbcfe('0x17')](_0xbcfe('0x12'),_0x4d90b3,_0x59a705[_0xbcfe('0x17')][_0xbcfe('0x18')]);return _0x42b34b(_0x59a705[_0xbcfe('0x17')][_0xbcfe('0x18')]);}else{logger[_0xbcfe('0x19')](_0xbcfe('0x12'),_0x4d90b3,_0xbcfe('0x13'));_0x42b34b(_0x59a705[_0xbcfe('0x1a')][_0xbcfe('0x18')]);}})[_0xbcfe('0x1b')](function(_0x2ba539){logger['error'](_0xbcfe('0x12'),_0x4d90b3,_0x2ba539);_0x3cb594(_0x2ba539);});});}exports['CreateSmsMessage']=function(_0x48a7e5){var _0x518b8d=this;return new Promise(function(_0x434621,_0x5b6b51){return db[_0xbcfe('0x1c')][_0xbcfe('0x1d')](_0x48a7e5[_0xbcfe('0x1e')],{'raw':_0x48a7e5[_0xbcfe('0x1f')]?_0x48a7e5[_0xbcfe('0x1f')][_0xbcfe('0x20')]===undefined?!![]:![]:!![]})[_0xbcfe('0x21')](function(_0x418aaf){logger[_0xbcfe('0x19')]('CreateSmsMessage',_0x48a7e5);logger['debug']('CreateSmsMessage',_0x48a7e5,JSON[_0xbcfe('0x16')](_0x418aaf));_0x434621(_0x418aaf);})['catch'](function(_0x1a04d1){logger[_0xbcfe('0x17')](_0xbcfe('0x22'),_0x1a04d1[_0xbcfe('0x18')],_0x48a7e5);_0x5b6b51(_0x518b8d[_0xbcfe('0x17')](0x1f4,_0x1a04d1[_0xbcfe('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsMessage/smsMessage.socket.js b/server/api/smsMessage/smsMessage.socket.js index ac372df..ecedbfc 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 _0xe977=['emit','removeListener','register','length','smsMessage:','./smsMessage.events','save','remove','update'];(function(_0xbca15c,_0x5ac4cc){var _0x2f2a88=function(_0x1ab4b6){while(--_0x1ab4b6){_0xbca15c['push'](_0xbca15c['shift']());}};_0x2f2a88(++_0x5ac4cc);}(_0xe977,0xdd));var _0x7e97=function(_0x11dae,_0x30b871){_0x11dae=_0x11dae-0x0;var _0x1c25f1=_0xe977[_0x11dae];return _0x1c25f1;};'use strict';var SmsMessageEvents=require(_0x7e97('0x0'));var events=[_0x7e97('0x1'),_0x7e97('0x2'),_0x7e97('0x3')];function createListener(_0x1967e5,_0x1a5ddc){return function(_0x14bb04){_0x1a5ddc[_0x7e97('0x4')](_0x1967e5,_0x14bb04);};}function removeListener(_0x5ad800,_0x46a4a9){return function(){SmsMessageEvents[_0x7e97('0x5')](_0x5ad800,_0x46a4a9);};}exports[_0x7e97('0x6')]=function(_0x3ed82a){for(var _0x584dbd=0x0,_0xd4cd1a=events[_0x7e97('0x7')];_0x584dbd<_0xd4cd1a;_0x584dbd++){var _0x30b16e=events[_0x584dbd];var _0x599ebb=createListener(_0x7e97('0x8')+_0x30b16e,_0x3ed82a);SmsMessageEvents['on'](_0x30b16e,_0x599ebb);}}; \ No newline at end of file +var _0xf553=['update','emit','removeListener','length','smsMessage:','./smsMessage.events'];(function(_0x10df18,_0x13338c){var _0x1f9a1d=function(_0x3157f4){while(--_0x3157f4){_0x10df18['push'](_0x10df18['shift']());}};_0x1f9a1d(++_0x13338c);}(_0xf553,0x1c1));var _0x3f55=function(_0x34d346,_0x4c6502){_0x34d346=_0x34d346-0x0;var _0x122d76=_0xf553[_0x34d346];return _0x122d76;};'use strict';var SmsMessageEvents=require(_0x3f55('0x0'));var events=['save','remove',_0x3f55('0x1')];function createListener(_0x1a8414,_0x41bd98){return function(_0x360132){_0x41bd98[_0x3f55('0x2')](_0x1a8414,_0x360132);};}function removeListener(_0x1578d9,_0x36e985){return function(){SmsMessageEvents[_0x3f55('0x3')](_0x1578d9,_0x36e985);};}exports['register']=function(_0x4dcdb5){for(var _0x1575d7=0x0,_0x45a74b=events[_0x3f55('0x4')];_0x1575d7<_0x45a74b;_0x1575d7++){var _0x18a5a2=events[_0x1575d7];var _0x801ddf=createListener(_0x3f55('0x5')+_0x18a5a2,_0x4dcdb5);SmsMessageEvents['on'](_0x18a5a2,_0x801ddf);}}; \ No newline at end of file diff --git a/server/api/smsQueue/index.js b/server/api/smsQueue/index.js index c2384c0..ee55513 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 _0xac5d=['exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','index','/describe','/:id','isAuthenticated','show','/:id/teams','getTeams','/:id/users','post','create','addTeams','addAgents','put','update','delete','removeTeams'];(function(_0x431b24,_0x40d94e){var _0xb787ea=function(_0x4da066){while(--_0x4da066){_0x431b24['push'](_0x431b24['shift']());}};_0xb787ea(++_0x40d94e);}(_0xac5d,0x135));var _0xdac5=function(_0x185952,_0x914ad8){_0x185952=_0x185952-0x0;var _0x3b2d90=_0xac5d[_0x185952];return _0x3b2d90;};'use strict';var multer=require(_0xdac5('0x0'));var util=require(_0xdac5('0x1'));var path=require(_0xdac5('0x2'));var timeout=require(_0xdac5('0x3'));var express=require('express');var router=express[_0xdac5('0x4')]();var fs_extra=require(_0xdac5('0x5'));var auth=require(_0xdac5('0x6'));var interaction=require(_0xdac5('0x7'));var config=require(_0xdac5('0x8'));var controller=require(_0xdac5('0x9'));router[_0xdac5('0xa')]('/',auth['isAuthenticated'](),controller[_0xdac5('0xb')]);router[_0xdac5('0xa')](_0xdac5('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0xdac5('0xa')](_0xdac5('0xd'),auth[_0xdac5('0xe')](),controller[_0xdac5('0xf')]);router['get']('/:id/members',auth[_0xdac5('0xe')](),controller['getMembers']);router[_0xdac5('0xa')](_0xdac5('0x10'),auth[_0xdac5('0xe')](),controller[_0xdac5('0x11')]);router['get'](_0xdac5('0x12'),auth[_0xdac5('0xe')](),controller['getAgents']);router[_0xdac5('0x13')]('/',auth[_0xdac5('0xe')](),controller[_0xdac5('0x14')]);router['post']('/:id/teams',auth[_0xdac5('0xe')](),controller[_0xdac5('0x15')]);router[_0xdac5('0x13')](_0xdac5('0x12'),auth[_0xdac5('0xe')](),controller[_0xdac5('0x16')]);router[_0xdac5('0x17')](_0xdac5('0xd'),auth['isAuthenticated'](),controller[_0xdac5('0x18')]);router[_0xdac5('0x19')](_0xdac5('0xd'),auth[_0xdac5('0xe')](),controller['destroy']);router[_0xdac5('0x19')]('/:id/teams',auth['isAuthenticated'](),controller[_0xdac5('0x1a')]);router[_0xdac5('0x19')]('/:id/users',auth[_0xdac5('0xe')](),controller['removeAgents']);module[_0xdac5('0x1b')]=router; \ No newline at end of file +var _0xb1e5=['show','/:id/members','getMembers','getTeams','post','create','/:id/teams','addTeams','/:id/users','addAgents','delete','removeTeams','removeAgents','exports','util','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueue.controller','get','/describe','isAuthenticated','describe','/:id'];(function(_0x2f8e79,_0x23c4b4){var _0x168fb5=function(_0x30810a){while(--_0x30810a){_0x2f8e79['push'](_0x2f8e79['shift']());}};_0x168fb5(++_0x23c4b4);}(_0xb1e5,0x95));var _0x5b1e=function(_0x42d57e,_0x5477f0){_0x42d57e=_0x42d57e-0x0;var _0x2ce901=_0xb1e5[_0x42d57e];return _0x2ce901;};'use strict';var multer=require('multer');var util=require(_0x5b1e('0x0'));var path=require('path');var timeout=require(_0x5b1e('0x1'));var express=require(_0x5b1e('0x2'));var router=express['Router']();var fs_extra=require(_0x5b1e('0x3'));var auth=require(_0x5b1e('0x4'));var interaction=require(_0x5b1e('0x5'));var config=require(_0x5b1e('0x6'));var controller=require(_0x5b1e('0x7'));router[_0x5b1e('0x8')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x5b1e('0x9'),auth[_0x5b1e('0xa')](),controller[_0x5b1e('0xb')]);router[_0x5b1e('0x8')](_0x5b1e('0xc'),auth[_0x5b1e('0xa')](),controller[_0x5b1e('0xd')]);router[_0x5b1e('0x8')](_0x5b1e('0xe'),auth['isAuthenticated'](),controller[_0x5b1e('0xf')]);router[_0x5b1e('0x8')]('/:id/teams',auth['isAuthenticated'](),controller[_0x5b1e('0x10')]);router[_0x5b1e('0x8')]('/:id/users',auth[_0x5b1e('0xa')](),controller['getAgents']);router[_0x5b1e('0x11')]('/',auth[_0x5b1e('0xa')](),controller[_0x5b1e('0x12')]);router[_0x5b1e('0x11')](_0x5b1e('0x13'),auth[_0x5b1e('0xa')](),controller[_0x5b1e('0x14')]);router[_0x5b1e('0x11')](_0x5b1e('0x15'),auth[_0x5b1e('0xa')](),controller[_0x5b1e('0x16')]);router['put'](_0x5b1e('0xc'),auth[_0x5b1e('0xa')](),controller['update']);router[_0x5b1e('0x17')](_0x5b1e('0xc'),auth[_0x5b1e('0xa')](),controller['destroy']);router['delete'](_0x5b1e('0x13'),auth[_0x5b1e('0xa')](),controller[_0x5b1e('0x18')]);router['delete']('/:id/users',auth[_0x5b1e('0xa')](),controller[_0x5b1e('0x19')]);module[_0x5b1e('0x1a')]=router; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.attributes.js b/server/api/smsQueue/smsQueue.attributes.js index df22692..901e9d7 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 _0x2325=['STRING','INTEGER','ENUM','rrmemory','roundrobin','sequelize','exports','name'];(function(_0x410c19,_0x2aad59){var _0x29de6e=function(_0x5b7af9){while(--_0x5b7af9){_0x410c19['push'](_0x410c19['shift']());}};_0x29de6e(++_0x2aad59);}(_0x2325,0xed));var _0x5232=function(_0x467075,_0x524d49){_0x467075=_0x467075-0x0;var _0x61a8c6=_0x2325[_0x467075];return _0x61a8c6;};'use strict';var Sequelize=require(_0x5232('0x0'));module[_0x5232('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x5232('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x5232('0x3')]},'timeout':{'type':Sequelize[_0x5232('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x5232('0x5')](_0x5232('0x6'),'beepall',_0x5232('0x7'))}}; \ No newline at end of file +var _0x0519=['roundrobin','sequelize','exports','name','STRING','INTEGER','ENUM','rrmemory','beepall'];(function(_0x5bb5fa,_0x2af3c4){var _0x243960=function(_0x532605){while(--_0x532605){_0x5bb5fa['push'](_0x5bb5fa['shift']());}};_0x243960(++_0x2af3c4);}(_0x0519,0x106));var _0x9051=function(_0x149ca0,_0x2ac7f5){_0x149ca0=_0x149ca0-0x0;var _0x56b6b9=_0x0519[_0x149ca0];return _0x56b6b9;};'use strict';var Sequelize=require(_0x9051('0x0'));module[_0x9051('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x9051('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'description':{'type':Sequelize[_0x9051('0x3')]},'timeout':{'type':Sequelize[_0x9051('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x9051('0x5')](_0x9051('0x6'),_0x9051('0x7'),_0x9051('0x8'))}}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.controller.js b/server/api/smsQueue/smsQueue.controller.js index 264b766..4030711 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 _0x52f3=['UserSmsQueue','hasOwnProperty','SmsQueueId','findAll','User','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','getTeams','findOne','Team','addTeams','ids','Agents','voicePause','interface','flatMap','transaction','each','forEach','emit','removeTeams','field','from','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','sequelize','toString','TeamId','includes','all','union','compact','value','removeAgents','userSmsQueue:remove','addAgents','spread','getAgents','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','localhost','socket.io-emitter','redis','./smsQueue.socket','register','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','end','sendStatus','error','stack','name','index','rawAttributes','model','map','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','pick','where','merge','type','VIRTUAL','filter','SmsQueue','includeAll','include','rows','catch','show','params','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SmsQueues','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe'];(function(_0x3030f5,_0x26458b){var _0x26991b=function(_0x43007d){while(--_0x43007d){_0x3030f5['push'](_0x3030f5['shift']());}};_0x26991b(++_0x26458b);}(_0x52f3,0xba));var _0x352f=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x52f3[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x352f('0x0'));var zipdir=require(_0x352f('0x1'));var jsonpatch=require(_0x352f('0x2'));var rp=require(_0x352f('0x3'));var moment=require(_0x352f('0x4'));var BPromise=require(_0x352f('0x5'));var Mustache=require(_0x352f('0x6'));var util=require(_0x352f('0x7'));var path=require(_0x352f('0x8'));var sox=require(_0x352f('0x9'));var csv=require('to-csv');var ejs=require(_0x352f('0xa'));var fs=require('fs');var fs_extra=require(_0x352f('0xb'));var _=require(_0x352f('0xc'));var squel=require(_0x352f('0xd'));var crypto=require(_0x352f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x352f('0xf'));var toCsv=require('to-csv');var querystring=require(_0x352f('0x10'));var Papa=require(_0x352f('0x11'));var Redis=require(_0x352f('0x12'));var authService=require(_0x352f('0x13'));var qs=require(_0x352f('0x14'));var as=require(_0x352f('0x15'));var hardwareService=require(_0x352f('0x16'));var logger=require('../../config/logger')(_0x352f('0x17'));var utils=require(_0x352f('0x18'));var config=require(_0x352f('0x19'));var licenseUtil=require('../../config/license/util');var db=require(_0x352f('0x1a'))['db'];config['redis']=_['defaults'](config['redis'],{'host':_0x352f('0x1b'),'port':0x18eb});var socket=require(_0x352f('0x1c'))(new Redis(config[_0x352f('0x1d')]));require(_0x352f('0x1e'))[_0x352f('0x1f')](socket);function respondWithStatusCode(_0x3134ba,_0xb7dcd3){_0xb7dcd3=_0xb7dcd3||0xcc;return function(_0x182602){if(_0x182602){return _0x3134ba['sendStatus'](_0xb7dcd3);}return _0x3134ba[_0x352f('0x20')](_0xb7dcd3)['end']();};}function respondWithResult(_0x2b7345,_0x58a762){_0x58a762=_0x58a762||0xc8;return function(_0x44f12f){if(_0x44f12f){return _0x2b7345['status'](_0x58a762)[_0x352f('0x21')](_0x44f12f);}};}function respondWithFilteredResult(_0x187f5e,_0x1c8767){return function(_0x38944f){if(_0x38944f){var _0x2ee10d=typeof _0x1c8767[_0x352f('0x22')]===_0x352f('0x23')&&typeof _0x1c8767[_0x352f('0x24')]===_0x352f('0x23');var _0x168473=_0x38944f['count'];var _0xa8d71a=_0x2ee10d?0x0:_0x1c8767['offset'];var _0x4861e9=_0x2ee10d?_0x38944f[_0x352f('0x25')]:_0x1c8767[_0x352f('0x22')]+_0x1c8767[_0x352f('0x24')];var _0x5b1167;if(_0x4861e9>=_0x168473){_0x4861e9=_0x168473;_0x5b1167=0xc8;}else{_0x5b1167=0xce;}_0x187f5e['status'](_0x5b1167);return _0x187f5e[_0x352f('0x26')](_0x352f('0x27'),_0xa8d71a+'-'+_0x4861e9+'/'+_0x168473)[_0x352f('0x21')](_0x38944f);}return null;};}function patchUpdates(_0x17050c){return function(_0x49986e){try{jsonpatch[_0x352f('0x28')](_0x49986e,_0x17050c,!![]);}catch(_0x5b8bb5){return BPromise[_0x352f('0x29')](_0x5b8bb5);}return _0x49986e[_0x352f('0x2a')]();};}function saveUpdates(_0x3ccccb,_0x36f4e0){return function(_0x28262e){if(_0x28262e){return _0x28262e['update'](_0x3ccccb)[_0x352f('0x2b')](function(_0x6a6a57){return _0x6a6a57;});}return null;};}function removeEntity(_0x1478c7,_0x3bebdf){return function(_0x57e198){if(_0x57e198){return _0x57e198[_0x352f('0x2c')]()[_0x352f('0x2b')](function(){var _0x2e340b=_0x57e198[_0x352f('0x2d')]({'plain':!![]});var _0x37e41b='SmsQueues';return db[_0x352f('0x2e')]['destroy']({'where':{'type':_0x37e41b,'resourceId':_0x2e340b['id']}})['then'](function(){return _0x57e198;});})[_0x352f('0x2b')](function(){_0x1478c7[_0x352f('0x20')](0xcc)[_0x352f('0x2f')]();});}};}function handleEntityNotFound(_0x741f4e,_0x2109c2){return function(_0x30c4e9){if(!_0x30c4e9){_0x741f4e[_0x352f('0x30')](0x194);}return _0x30c4e9;};}function handleError(_0x345a29,_0x2ddcc0){_0x2ddcc0=_0x2ddcc0||0x1f4;return function(_0xa6b5a){logger[_0x352f('0x31')](_0xa6b5a[_0x352f('0x32')]);if(_0xa6b5a[_0x352f('0x33')]){delete _0xa6b5a['name'];}_0x345a29[_0x352f('0x20')](_0x2ddcc0)['send'](_0xa6b5a);};}exports[_0x352f('0x34')]=function(_0x12e1b1,_0x11eb90){var _0x3ea96d={},_0x194b7f={},_0x234687={'count':0x0,'rows':[]};var _0x128fa3=_['map'](db['SmsQueue'][_0x352f('0x35')],function(_0x475d41){return{'name':_0x475d41['fieldName'],'type':_0x475d41['type']['key']};});_0x194b7f[_0x352f('0x36')]=_[_0x352f('0x37')](_0x128fa3,_0x352f('0x33'));_0x194b7f[_0x352f('0x38')]=_[_0x352f('0x39')](_0x12e1b1[_0x352f('0x38')]);_0x194b7f[_0x352f('0x3a')]=_[_0x352f('0x3b')](_0x194b7f[_0x352f('0x36')],_0x194b7f['query']);_0x3ea96d[_0x352f('0x3c')]=_[_0x352f('0x3b')](_0x194b7f[_0x352f('0x36')],qs[_0x352f('0x3d')](_0x12e1b1['query'][_0x352f('0x3d')]));_0x3ea96d[_0x352f('0x3c')]=_0x3ea96d['attributes'][_0x352f('0x3e')]?_0x3ea96d[_0x352f('0x3c')]:_0x194b7f[_0x352f('0x36')];if(!_0x12e1b1[_0x352f('0x38')]['hasOwnProperty'](_0x352f('0x3f'))){_0x3ea96d['limit']=qs[_0x352f('0x24')](_0x12e1b1[_0x352f('0x38')][_0x352f('0x24')]);_0x3ea96d[_0x352f('0x22')]=qs[_0x352f('0x22')](_0x12e1b1[_0x352f('0x38')][_0x352f('0x22')]);}_0x3ea96d[_0x352f('0x40')]=qs[_0x352f('0x41')](_0x12e1b1[_0x352f('0x38')][_0x352f('0x41')]);_0x3ea96d['where']=qs[_0x352f('0x3a')](_[_0x352f('0x42')](_0x12e1b1[_0x352f('0x38')],_0x194b7f['filters']),_0x128fa3);if(_0x12e1b1[_0x352f('0x38')]['filter']){_0x3ea96d[_0x352f('0x43')]=_[_0x352f('0x44')](_0x3ea96d['where'],{'$or':_[_0x352f('0x37')](_0x128fa3,function(_0x451721){if(_0x451721[_0x352f('0x45')]!==_0x352f('0x46')){var _0x321e38={};_0x321e38[_0x451721[_0x352f('0x33')]]={'$like':'%'+_0x12e1b1[_0x352f('0x38')][_0x352f('0x47')]+'%'};return _0x321e38;}})});}_0x3ea96d=_[_0x352f('0x44')]({},_0x3ea96d,_0x12e1b1['options']);var _0x4a851b={'where':_0x3ea96d[_0x352f('0x43')]};return db[_0x352f('0x48')]['count'](_0x4a851b)[_0x352f('0x2b')](function(_0x31b0ae){_0x234687[_0x352f('0x25')]=_0x31b0ae;if(_0x12e1b1[_0x352f('0x38')][_0x352f('0x49')]){_0x3ea96d[_0x352f('0x4a')]=[{'all':!![]}];}return db[_0x352f('0x48')]['findAll'](_0x3ea96d);})['then'](function(_0x50df8a){_0x234687[_0x352f('0x4b')]=_0x50df8a;return _0x234687;})[_0x352f('0x2b')](respondWithFilteredResult(_0x11eb90,_0x3ea96d))[_0x352f('0x4c')](handleError(_0x11eb90,null));};exports[_0x352f('0x4d')]=function(_0x15bf60,_0x32fd0c){var _0x364b6a={'raw':!![],'where':{'id':_0x15bf60[_0x352f('0x4e')]['id']}},_0x44c5fd={};_0x44c5fd[_0x352f('0x36')]=_[_0x352f('0x39')](db['SmsQueue'][_0x352f('0x35')]);_0x44c5fd['query']=_[_0x352f('0x39')](_0x15bf60[_0x352f('0x38')]);_0x44c5fd[_0x352f('0x3a')]=_['intersection'](_0x44c5fd[_0x352f('0x36')],_0x44c5fd[_0x352f('0x38')]);_0x364b6a[_0x352f('0x3c')]=_[_0x352f('0x3b')](_0x44c5fd['model'],qs[_0x352f('0x3d')](_0x15bf60[_0x352f('0x38')][_0x352f('0x3d')]));_0x364b6a[_0x352f('0x3c')]=_0x364b6a[_0x352f('0x3c')][_0x352f('0x3e')]?_0x364b6a['attributes']:_0x44c5fd[_0x352f('0x36')];if(_0x15bf60['query'][_0x352f('0x49')]){_0x364b6a[_0x352f('0x4a')]=[{'all':!![]}];}_0x364b6a=_[_0x352f('0x44')]({},_0x364b6a,_0x15bf60[_0x352f('0x4f')]);return db[_0x352f('0x48')][_0x352f('0x50')](_0x364b6a)[_0x352f('0x2b')](handleEntityNotFound(_0x32fd0c,null))[_0x352f('0x2b')](respondWithResult(_0x32fd0c,null))[_0x352f('0x4c')](handleError(_0x32fd0c,null));};exports['create']=function(_0x22e082,_0x1d8045){return db[_0x352f('0x48')][_0x352f('0x51')](_0x22e082[_0x352f('0x52')],{})[_0x352f('0x2b')](function(_0x26b794){var _0x376dbb=_0x22e082['user']['get']({'plain':!![]});if(!_0x376dbb)throw new Error(_0x352f('0x53'));if(_0x376dbb[_0x352f('0x54')]==='user'){var _0x27ef8d=_0x26b794[_0x352f('0x2d')]({'plain':!![]});var _0x12dca2=_0x352f('0x55');return db[_0x352f('0x56')][_0x352f('0x50')]({'where':{'name':_0x12dca2,'userProfileId':_0x376dbb[_0x352f('0x57')]},'raw':!![]})['then'](function(_0x1327dd){if(_0x1327dd&&_0x1327dd[_0x352f('0x58')]===0x0){return db[_0x352f('0x2e')][_0x352f('0x51')]({'name':_0x27ef8d['name'],'resourceId':_0x27ef8d['id'],'type':_0x1327dd[_0x352f('0x33')],'sectionId':_0x1327dd['id']},{})['then'](function(){return _0x26b794;});}else{return _0x26b794;}})[_0x352f('0x4c')](function(_0x58dca2){logger[_0x352f('0x31')](_0x352f('0x59'),_0x58dca2);throw _0x58dca2;});}return _0x26b794;})['then'](respondWithResult(_0x1d8045,0xc9))['catch'](handleError(_0x1d8045,null));};exports[_0x352f('0x5a')]=function(_0xee1c47,_0x369fd3){if(_0xee1c47[_0x352f('0x52')]['id']){delete _0xee1c47[_0x352f('0x52')]['id'];}return db['SmsQueue'][_0x352f('0x50')]({'where':{'id':_0xee1c47[_0x352f('0x4e')]['id']}})['then'](handleEntityNotFound(_0x369fd3,null))[_0x352f('0x2b')](saveUpdates(_0xee1c47[_0x352f('0x52')],null))[_0x352f('0x2b')](respondWithResult(_0x369fd3,null))[_0x352f('0x4c')](handleError(_0x369fd3,null));};exports[_0x352f('0x2c')]=function(_0x6ff17a,_0x3d7939){return db[_0x352f('0x48')][_0x352f('0x50')]({'where':{'id':_0x6ff17a[_0x352f('0x4e')]['id']}})[_0x352f('0x2b')](handleEntityNotFound(_0x3d7939,null))['then'](removeEntity(_0x3d7939,null))[_0x352f('0x4c')](handleError(_0x3d7939,null));};exports[_0x352f('0x5b')]=function(_0x1b3720,_0x2ebf2d){return db[_0x352f('0x48')][_0x352f('0x5b')]()[_0x352f('0x2b')](respondWithResult(_0x2ebf2d,null))[_0x352f('0x4c')](handleError(_0x2ebf2d,null));};exports['getMembers']=function(_0x560852,_0x4482f7,_0x14e1da){var _0x499904={'raw':!![],'where':{}},_0x416ba9={},_0x59dd26;return db[_0x352f('0x48')]['findOne']({'where':{'id':_0x560852[_0x352f('0x4e')]['id']}})[_0x352f('0x2b')](handleEntityNotFound(_0x4482f7,null))[_0x352f('0x2b')](function(_0x31f8f1){if(_0x31f8f1){_0x59dd26=_0x31f8f1[_0x352f('0x2d')]({'plain':!![]});_0x416ba9['model']=_[_0x352f('0x39')](db[_0x352f('0x5c')][_0x352f('0x35')]);_0x416ba9[_0x352f('0x38')]=_[_0x352f('0x39')](_0x560852['query']);_0x416ba9['filters']=_[_0x352f('0x3b')](_0x416ba9['model'],_0x416ba9['query']);_0x499904[_0x352f('0x3c')]=_[_0x352f('0x3b')](_0x416ba9['model'],qs[_0x352f('0x3d')](_0x560852[_0x352f('0x38')][_0x352f('0x3d')]));_0x499904[_0x352f('0x3c')]=_0x499904['attributes'][_0x352f('0x3e')]?_0x499904['attributes']:_0x416ba9[_0x352f('0x36')];if(!_0x560852[_0x352f('0x38')][_0x352f('0x5d')](_0x352f('0x3f'))){_0x499904[_0x352f('0x24')]=qs[_0x352f('0x24')](_0x560852['query'][_0x352f('0x24')]);_0x499904['offset']=qs[_0x352f('0x22')](_0x560852[_0x352f('0x38')][_0x352f('0x22')]);}_0x499904['order']=qs[_0x352f('0x41')](_0x560852['query']['sort']);_0x499904[_0x352f('0x43')]=qs[_0x352f('0x3a')](_[_0x352f('0x42')](_0x560852[_0x352f('0x38')],_0x416ba9[_0x352f('0x3a')]));_0x499904[_0x352f('0x43')][_0x352f('0x5e')]=_0x31f8f1['id'];if(_0x560852[_0x352f('0x38')][_0x352f('0x47')]){_0x499904[_0x352f('0x43')]=_[_0x352f('0x44')](_0x499904[_0x352f('0x43')],{'$or':_['map'](_0x499904['attributes'],function(_0xa563bf){var _0x36b9b5={};_0x36b9b5[_0xa563bf]={'$like':'%'+_0x560852[_0x352f('0x38')][_0x352f('0x47')]+'%'};return _0x36b9b5;})});}_0x499904=_['merge']({},_0x499904,_0x560852[_0x352f('0x4f')]);return db[_0x352f('0x5c')][_0x352f('0x5f')](_0x499904);}})[_0x352f('0x2b')](function(_0x19c9a1){if(_0x19c9a1){return db[_0x352f('0x60')][_0x352f('0x61')]({'where':{'id':_['map'](_0x19c9a1,_0x352f('0x62')),'role':_0x352f('0x63')},'attributes':['id','name',_0x352f('0x64'),_0x352f('0x65'),_0x352f('0x66')]});}})['then'](function(_0x2f5c65){if(_0x2f5c65){return{'count':_0x2f5c65[_0x352f('0x25')],'rows':_[_0x352f('0x37')](_0x2f5c65[_0x352f('0x4b')],function(_0x1f1d2e){return{'membername':_0x1f1d2e[_0x352f('0x33')],'UserId':_0x1f1d2e['id'],'queue_name':_0x59dd26[_0x352f('0x33')],'SmsQueueId':_0x59dd26['id'],'interface':util[_0x352f('0x67')](_0x352f('0x68'),'SIP',_0x1f1d2e[_0x352f('0x33')]),'penalty':0x0,'paused':_0x1f1d2e[_0x352f('0x64')],'createdAt':_0x1f1d2e[_0x352f('0x66')],'updatedAt':_0x1f1d2e[_0x352f('0x65')]};})};}else{return{'count':0x0,'rows':[]};}})[_0x352f('0x2b')](respondWithFilteredResult(_0x4482f7,_0x499904))[_0x352f('0x4c')](handleError(_0x4482f7,null));};exports[_0x352f('0x69')]=function(_0x272479,_0x40ec65,_0x5c3068){var _0x1c9742={};var _0x50178f={};var _0x487519;var _0x54413f;return db[_0x352f('0x48')][_0x352f('0x6a')]({'where':{'id':_0x272479[_0x352f('0x4e')]['id']}})[_0x352f('0x2b')](handleEntityNotFound(_0x40ec65,null))[_0x352f('0x2b')](function(_0x2d4fd8){if(_0x2d4fd8){_0x487519=_0x2d4fd8;_0x50178f['model']=_[_0x352f('0x39')](db[_0x352f('0x6b')][_0x352f('0x35')]);_0x50178f['query']=_['keys'](_0x272479[_0x352f('0x38')]);_0x50178f['filters']=_[_0x352f('0x3b')](_0x50178f[_0x352f('0x36')],_0x50178f[_0x352f('0x38')]);_0x1c9742[_0x352f('0x3c')]=_[_0x352f('0x3b')](_0x50178f[_0x352f('0x36')],qs[_0x352f('0x3d')](_0x272479[_0x352f('0x38')][_0x352f('0x3d')]));_0x1c9742[_0x352f('0x3c')]=_0x1c9742[_0x352f('0x3c')]['length']?_0x1c9742[_0x352f('0x3c')]:_0x50178f[_0x352f('0x36')];_0x1c9742[_0x352f('0x40')]=qs[_0x352f('0x41')](_0x272479[_0x352f('0x38')][_0x352f('0x41')]);_0x1c9742[_0x352f('0x43')]=qs[_0x352f('0x3a')](_[_0x352f('0x42')](_0x272479[_0x352f('0x38')],_0x50178f[_0x352f('0x3a')]));if(_0x272479[_0x352f('0x38')][_0x352f('0x47')]){_0x1c9742[_0x352f('0x43')]=_[_0x352f('0x44')](_0x1c9742['where'],{'$or':_['map'](_0x1c9742[_0x352f('0x3c')],function(_0x36fd90){var _0x28ea6b={};_0x28ea6b[_0x36fd90]={'$like':'%'+_0x272479[_0x352f('0x38')][_0x352f('0x47')]+'%'};return _0x28ea6b;})});}_0x1c9742=_[_0x352f('0x44')]({},_0x1c9742,_0x272479[_0x352f('0x4f')]);return _0x487519[_0x352f('0x69')](_0x1c9742);}})[_0x352f('0x2b')](function(_0x507e25){if(_0x507e25){_0x54413f=_0x507e25['length'];if(!_0x272479[_0x352f('0x38')][_0x352f('0x5d')]('nolimit')){_0x1c9742[_0x352f('0x24')]=qs[_0x352f('0x24')](_0x272479[_0x352f('0x38')][_0x352f('0x24')]);_0x1c9742[_0x352f('0x22')]=qs[_0x352f('0x22')](_0x272479[_0x352f('0x38')]['offset']);}return _0x487519[_0x352f('0x69')](_0x1c9742);}})['then'](function(_0xe874dd){if(_0xe874dd){return _0xe874dd?{'count':_0x54413f,'rows':_0xe874dd}:null;}})['then'](respondWithResult(_0x40ec65,null))[_0x352f('0x4c')](handleError(_0x40ec65,null));};exports[_0x352f('0x6c')]=function(_0x71adb8,_0x394e82,_0x48973c){var _0x127925=_0x71adb8[_0x352f('0x52')][_0x352f('0x6d')];return db[_0x352f('0x6b')][_0x352f('0x5f')]({'where':{'id':_0x127925},'attributes':['id'],'include':[{'model':db[_0x352f('0x60')],'as':_0x352f('0x6e'),'attributes':['id',_0x352f('0x33'),'online',_0x352f('0x6f'),_0x352f('0x70')],'raw':!![]}]})['then'](function(_0x521f2b){if(_0x521f2b){var _0x36eae8=_[_0x352f('0x71')](_0x521f2b,function(_0x92ee3e){var _0x29454d=_0x92ee3e['get']({'plain':!![]});return _0x29454d['Agents'];});return db[_0x352f('0x48')][_0x352f('0x50')]({'where':{'id':_0x71adb8[_0x352f('0x4e')]['id']}})[_0x352f('0x2b')](function(_0x265d32){return db['sequelize'][_0x352f('0x72')](function(_0x47a073){return _0x265d32[_0x352f('0x6c')](_0x127925,{'transaction':_0x47a073})[_0x352f('0x2b')](function(){return BPromise[_0x352f('0x73')](_0x36eae8,function(_0xafe265){return db['UserSmsQueue']['findOrCreate']({'where':{'UserId':_0xafe265['id'],'SmsQueueId':_0x71adb8[_0x352f('0x4e')]['id']},'transaction':_0x47a073});});})[_0x352f('0x2b')](function(){_0x36eae8[_0x352f('0x74')](function(_0x5ce4bc){socket[_0x352f('0x75')]('userSmsQueue:save',{'UserId':_0x5ce4bc['id'],'SmsQueueId':_0x265d32['id']});});});});});}})[_0x352f('0x2b')](respondWithStatusCode(_0x394e82,null))[_0x352f('0x4c')](handleError(_0x394e82,null));};exports[_0x352f('0x76')]=function(_0x3a847c,_0x46d000,_0x2099aa){return db['Team']['findAll']({'where':{'id':_0x3a847c[_0x352f('0x38')][_0x352f('0x6d')]},'attributes':['id'],'include':[{'model':db[_0x352f('0x60')],'as':_0x352f('0x6e'),'attributes':['id'],'raw':!![]}]})[_0x352f('0x2b')](handleEntityNotFound(_0x46d000,null))[_0x352f('0x2b')](function(_0xfc7ca4){var _0x29fc5f=_[_0x352f('0x37')](_0xfc7ca4,'id');var _0x1ed57f=[];var _0xe25db=[];var _0x40538d=squel['select']();_0x40538d[_0x352f('0x77')]('tq.TeamId')[_0x352f('0x78')]('team_has_sms_queues','tq')[_0x352f('0x79')](_0x352f('0x7a'),'ut',_0x352f('0x7b'))[_0x352f('0x43')](_0x352f('0x7c'),_0x3a847c[_0x352f('0x4e')]['id']);for(var _0x14c86b=0x0;_0x14c86b<_0xfc7ca4['length'];_0x14c86b+=0x1){let _0x32b77d=_0xfc7ca4[_0x14c86b];for(var _0x230f21=0x0;_0x230f21<_0x32b77d[_0x352f('0x6e')]['length'];_0x230f21+=0x1){let _0x5f4622=_0x32b77d[_0x352f('0x6e')][_0x230f21];var _0x55a6ca=_0x40538d[_0x352f('0x7d')]();_0x55a6ca[_0x352f('0x43')]('ut.UserId\x20=\x20?',_0x5f4622['id']);_0xe25db['push'](db[_0x352f('0x7e')]['query'](_0x55a6ca[_0x352f('0x7f')](),{'type':db[_0x352f('0x7e')]['QueryTypes']['SELECT']})[_0x352f('0x2b')](function(_0x5c2109){if(_0x5c2109[_0x352f('0x3e')]===0x1){return _0x5f4622['id'];}else{var _0xbaa7bb=_['every'](_[_0x352f('0x37')](_0x5c2109,_0x352f('0x80')),function(_0x50b2c6){return _[_0x352f('0x81')](_0x29fc5f,_0x50b2c6);});if(_0xbaa7bb){return _0x5f4622['id'];}}}));}}return BPromise[_0x352f('0x82')](_0xe25db)[_0x352f('0x2b')](function(_0x151808){_0x1ed57f=_(_0x1ed57f)[_0x352f('0x83')](_0x151808)[_0x352f('0x84')]()[_0x352f('0x85')]();return db['SmsQueue'][_0x352f('0x50')]({'where':{'id':_0x3a847c[_0x352f('0x4e')]['id']}})['then'](function(_0x4d3028){return db['sequelize']['transaction'](function(_0x34154e){return _0x4d3028[_0x352f('0x76')](_0x3a847c['query'][_0x352f('0x6d')],{'transaction':_0x34154e})[_0x352f('0x2b')](function(){if(!_['isEmpty'](_0x1ed57f)){return _0x4d3028[_0x352f('0x86')](_0x1ed57f,{'transaction':_0x34154e});}})[_0x352f('0x2b')](function(){_0x1ed57f[_0x352f('0x74')](function(_0xdbcd07){socket[_0x352f('0x75')](_0x352f('0x87'),{'UserId':_0xdbcd07,'SmsQueueId':_0x4d3028['id']});});});});});});})[_0x352f('0x2b')](respondWithStatusCode(_0x46d000,null))['catch'](handleError(_0x46d000,null));};exports[_0x352f('0x88')]=function(_0x5df68e,_0x45c0b6,_0x84e2dd){return db[_0x352f('0x48')][_0x352f('0x50')]({'where':{'id':_0x5df68e[_0x352f('0x4e')]['id']}})[_0x352f('0x2b')](handleEntityNotFound(_0x45c0b6,null))[_0x352f('0x2b')](function(_0x10b8e9){if(_0x10b8e9){return _0x10b8e9[_0x352f('0x88')](_0x5df68e['body'][_0x352f('0x6d')],_['omit'](_0x5df68e[_0x352f('0x52')],['ids','id'])||{})[_0x352f('0x89')](function(_0x56b192){for(var _0x568d14=0x0;_0x568d14<_0x5df68e[_0x352f('0x52')][_0x352f('0x6d')]['length'];_0x568d14+=0x1){socket[_0x352f('0x75')]('userSmsQueue:save',{'UserId':Number(_0x5df68e[_0x352f('0x52')]['ids'][_0x568d14]),'SmsQueueId':Number(_0x5df68e[_0x352f('0x4e')]['id'])});}return _0x56b192;});}})[_0x352f('0x2b')](respondWithResult(_0x45c0b6,null))['catch'](handleError(_0x45c0b6,null));};exports[_0x352f('0x86')]=function(_0x58953d,_0x5c045e,_0x2f9ec2){return db['SmsQueue'][_0x352f('0x50')]({'where':{'id':_0x58953d[_0x352f('0x4e')]['id']}})[_0x352f('0x2b')](handleEntityNotFound(_0x5c045e,null))[_0x352f('0x2b')](function(_0x232bc7){if(_0x232bc7){return _0x232bc7[_0x352f('0x86')](_0x58953d['query']['ids'])[_0x352f('0x2b')](function(){if(_['isArray'](_0x58953d[_0x352f('0x38')][_0x352f('0x6d')])){for(var _0x480d2f=0x0;_0x480d2f<_0x58953d[_0x352f('0x38')][_0x352f('0x6d')][_0x352f('0x3e')];_0x480d2f+=0x1){socket[_0x352f('0x75')](_0x352f('0x87'),{'UserId':Number(_0x58953d['query'][_0x352f('0x6d')][_0x480d2f]),'SmsQueueId':Number(_0x58953d[_0x352f('0x4e')]['id'])});}}else{socket[_0x352f('0x75')](_0x352f('0x87'),{'UserId':Number(_0x58953d[_0x352f('0x38')][_0x352f('0x6d')]),'SmsQueueId':Number(_0x58953d[_0x352f('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x5c045e,null))[_0x352f('0x4c')](handleError(_0x5c045e,null));};exports['getAgents']=function(_0x837d80,_0x597619,_0xe1f1b9){var _0x34f69c={};var _0x385485={};var _0x255091;var _0x295480;return db['SmsQueue'][_0x352f('0x6a')]({'where':{'id':_0x837d80[_0x352f('0x4e')]['id']}})[_0x352f('0x2b')](handleEntityNotFound(_0x597619,null))['then'](function(_0xd77d37){if(_0xd77d37){_0x255091=_0xd77d37;_0x385485[_0x352f('0x36')]=_['keys'](db[_0x352f('0x60')]['rawAttributes']);_0x385485[_0x352f('0x38')]=_[_0x352f('0x39')](_0x837d80[_0x352f('0x38')]);_0x385485[_0x352f('0x3a')]=_[_0x352f('0x3b')](_0x385485['model'],_0x385485[_0x352f('0x38')]);_0x34f69c[_0x352f('0x3c')]=_[_0x352f('0x3b')](_0x385485[_0x352f('0x36')],qs['fields'](_0x837d80[_0x352f('0x38')]['fields']));_0x34f69c['attributes']=_0x34f69c[_0x352f('0x3c')]['length']?_0x34f69c[_0x352f('0x3c')]:_0x385485['model'];_0x34f69c[_0x352f('0x40')]=qs[_0x352f('0x41')](_0x837d80[_0x352f('0x38')][_0x352f('0x41')]);_0x34f69c[_0x352f('0x43')]=qs[_0x352f('0x3a')](_[_0x352f('0x42')](_0x837d80[_0x352f('0x38')],_0x385485['filters']));if(_0x837d80[_0x352f('0x38')]['filter']){_0x34f69c[_0x352f('0x43')]=_[_0x352f('0x44')](_0x34f69c[_0x352f('0x43')],{'$or':_[_0x352f('0x37')](_0x34f69c[_0x352f('0x3c')],function(_0x4638ef){var _0x323578={};_0x323578[_0x4638ef]={'$like':'%'+_0x837d80[_0x352f('0x38')][_0x352f('0x47')]+'%'};return _0x323578;})});}_0x34f69c=_[_0x352f('0x44')]({},_0x34f69c,_0x837d80[_0x352f('0x4f')]);return _0x255091[_0x352f('0x8a')](_0x34f69c);}})[_0x352f('0x2b')](function(_0x526e91){if(_0x526e91){_0x295480=_0x526e91[_0x352f('0x3e')];if(!_0x837d80[_0x352f('0x38')][_0x352f('0x5d')](_0x352f('0x3f'))){_0x34f69c[_0x352f('0x24')]=qs[_0x352f('0x24')](_0x837d80[_0x352f('0x38')]['limit']);_0x34f69c[_0x352f('0x22')]=qs[_0x352f('0x22')](_0x837d80[_0x352f('0x38')][_0x352f('0x22')]);}return _0x255091[_0x352f('0x8a')](_0x34f69c);}})[_0x352f('0x2b')](function(_0x5bd9d2){if(_0x5bd9d2){return _0x5bd9d2?{'count':_0x295480,'rows':_0x5bd9d2}:null;}})[_0x352f('0x2b')](respondWithResult(_0x597619,null))[_0x352f('0x4c')](handleError(_0x597619,null));}; \ No newline at end of file +var _0x241a=['sendStatus','end','status','json','offset','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','get','SmsQueues','error','stack','name','send','index','map','SmsQueue','rawAttributes','fieldName','type','key','query','keys','filters','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','limit','order','sort','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','describe','UserSmsQueue','SmsQueueId','findAndCountAll','UserId','agent','smsPause','updatedAt','createdAt','format','%s/%s','SIP','Team','getTeams','addTeams','ids','User','Agents','online','voicePause','sequelize','transaction','forEach','userSmsQueue:save','removeTeams','field','tq.TeamId','from','team_has_sms_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','SmsQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','toString','QueryTypes','SELECT','every','all','union','value','removeAgents','userSmsQueue:remove','addAgents','spread','emit','isArray','getAgents','eml-format','fast-json-patch','request-promise','bluebird','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./smsQueue.socket','register'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x241a,0x18b));var _0xa241=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x241a[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0xa241('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xa241('0x1'));var rp=require(_0xa241('0x2'));var moment=require('moment');var BPromise=require(_0xa241('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xa241('0x4'));var ejs=require(_0xa241('0x5'));var fs=require('fs');var fs_extra=require(_0xa241('0x6'));var _=require(_0xa241('0x7'));var squel=require(_0xa241('0x8'));var crypto=require('crypto');var jsforce=require(_0xa241('0x9'));var deskjs=require(_0xa241('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xa241('0xb'));var Redis=require('ioredis');var authService=require(_0xa241('0xc'));var qs=require(_0xa241('0xd'));var as=require(_0xa241('0xe'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xa241('0xf'))('api');var utils=require(_0xa241('0x10'));var config=require('../../config/environment');var licenseUtil=require(_0xa241('0x11'));var db=require(_0xa241('0x12'))['db'];config[_0xa241('0x13')]=_[_0xa241('0x14')](config['redis'],{'host':_0xa241('0x15'),'port':0x18eb});var socket=require(_0xa241('0x16'))(new Redis(config[_0xa241('0x13')]));require(_0xa241('0x17'))[_0xa241('0x18')](socket);function respondWithStatusCode(_0x4b75fb,_0x368b60){_0x368b60=_0x368b60||0xcc;return function(_0x217e23){if(_0x217e23){return _0x4b75fb[_0xa241('0x19')](_0x368b60);}return _0x4b75fb['status'](_0x368b60)[_0xa241('0x1a')]();};}function respondWithResult(_0x3e3bcb,_0x25e4aa){_0x25e4aa=_0x25e4aa||0xc8;return function(_0x479c30){if(_0x479c30){return _0x3e3bcb[_0xa241('0x1b')](_0x25e4aa)[_0xa241('0x1c')](_0x479c30);}};}function respondWithFilteredResult(_0x49e6e7,_0x45d9c6){return function(_0x483d25){if(_0x483d25){var _0x4bbfa7=typeof _0x45d9c6[_0xa241('0x1d')]===_0xa241('0x1e')&&typeof _0x45d9c6['limit']===_0xa241('0x1e');var _0x42370f=_0x483d25['count'];var _0x427b1a=_0x4bbfa7?0x0:_0x45d9c6[_0xa241('0x1d')];var _0x144648=_0x4bbfa7?_0x483d25[_0xa241('0x1f')]:_0x45d9c6[_0xa241('0x1d')]+_0x45d9c6['limit'];var _0x3e3715;if(_0x144648>=_0x42370f){_0x144648=_0x42370f;_0x3e3715=0xc8;}else{_0x3e3715=0xce;}_0x49e6e7['status'](_0x3e3715);return _0x49e6e7[_0xa241('0x20')](_0xa241('0x21'),_0x427b1a+'-'+_0x144648+'/'+_0x42370f)[_0xa241('0x1c')](_0x483d25);}return null;};}function patchUpdates(_0x450c72){return function(_0x1b6a7d){try{jsonpatch[_0xa241('0x22')](_0x1b6a7d,_0x450c72,!![]);}catch(_0x92bd74){return BPromise[_0xa241('0x23')](_0x92bd74);}return _0x1b6a7d[_0xa241('0x24')]();};}function saveUpdates(_0x3784c7,_0x4bc96c){return function(_0x1a2cb8){if(_0x1a2cb8){return _0x1a2cb8[_0xa241('0x25')](_0x3784c7)[_0xa241('0x26')](function(_0x9bff73){return _0x9bff73;});}return null;};}function removeEntity(_0x462973,_0x44ab52){return function(_0x4fbd84){if(_0x4fbd84){return _0x4fbd84[_0xa241('0x27')]()['then'](function(){var _0x276830=_0x4fbd84[_0xa241('0x28')]({'plain':!![]});var _0x4ea587=_0xa241('0x29');return db['UserProfileResource'][_0xa241('0x27')]({'where':{'type':_0x4ea587,'resourceId':_0x276830['id']}})[_0xa241('0x26')](function(){return _0x4fbd84;});})['then'](function(){_0x462973[_0xa241('0x1b')](0xcc)['end']();});}};}function handleEntityNotFound(_0x16a1bc,_0x17b393){return function(_0xd83c8){if(!_0xd83c8){_0x16a1bc[_0xa241('0x19')](0x194);}return _0xd83c8;};}function handleError(_0x11b96d,_0x408f24){_0x408f24=_0x408f24||0x1f4;return function(_0x7402ed){logger[_0xa241('0x2a')](_0x7402ed[_0xa241('0x2b')]);if(_0x7402ed[_0xa241('0x2c')]){delete _0x7402ed[_0xa241('0x2c')];}_0x11b96d[_0xa241('0x1b')](_0x408f24)[_0xa241('0x2d')](_0x7402ed);};}exports[_0xa241('0x2e')]=function(_0x466cbf,_0x19e5fa){var _0x580d56={},_0x27a4f8={},_0x50b4a1={'count':0x0,'rows':[]};var _0x368ee2=_[_0xa241('0x2f')](db[_0xa241('0x30')][_0xa241('0x31')],function(_0x3eb313){return{'name':_0x3eb313[_0xa241('0x32')],'type':_0x3eb313[_0xa241('0x33')][_0xa241('0x34')]};});_0x27a4f8['model']=_[_0xa241('0x2f')](_0x368ee2,_0xa241('0x2c'));_0x27a4f8[_0xa241('0x35')]=_[_0xa241('0x36')](_0x466cbf['query']);_0x27a4f8[_0xa241('0x37')]=_['intersection'](_0x27a4f8[_0xa241('0x38')],_0x27a4f8[_0xa241('0x35')]);_0x580d56[_0xa241('0x39')]=_[_0xa241('0x3a')](_0x27a4f8['model'],qs[_0xa241('0x3b')](_0x466cbf[_0xa241('0x35')][_0xa241('0x3b')]));_0x580d56['attributes']=_0x580d56[_0xa241('0x39')][_0xa241('0x3c')]?_0x580d56[_0xa241('0x39')]:_0x27a4f8[_0xa241('0x38')];if(!_0x466cbf['query'][_0xa241('0x3d')](_0xa241('0x3e'))){_0x580d56[_0xa241('0x3f')]=qs[_0xa241('0x3f')](_0x466cbf[_0xa241('0x35')][_0xa241('0x3f')]);_0x580d56[_0xa241('0x1d')]=qs[_0xa241('0x1d')](_0x466cbf['query']['offset']);}_0x580d56[_0xa241('0x40')]=qs[_0xa241('0x41')](_0x466cbf[_0xa241('0x35')][_0xa241('0x41')]);_0x580d56[_0xa241('0x42')]=qs[_0xa241('0x37')](_[_0xa241('0x43')](_0x466cbf[_0xa241('0x35')],_0x27a4f8['filters']),_0x368ee2);if(_0x466cbf[_0xa241('0x35')][_0xa241('0x44')]){_0x580d56[_0xa241('0x42')]=_[_0xa241('0x45')](_0x580d56[_0xa241('0x42')],{'$or':_['map'](_0x368ee2,function(_0x5ddade){if(_0x5ddade[_0xa241('0x33')]!==_0xa241('0x46')){var _0x3fa1ba={};_0x3fa1ba[_0x5ddade[_0xa241('0x2c')]]={'$like':'%'+_0x466cbf['query'][_0xa241('0x44')]+'%'};return _0x3fa1ba;}})});}_0x580d56=_[_0xa241('0x45')]({},_0x580d56,_0x466cbf[_0xa241('0x47')]);var _0xe8f239={'where':_0x580d56['where']};return db['SmsQueue'][_0xa241('0x1f')](_0xe8f239)['then'](function(_0x451a27){_0x50b4a1[_0xa241('0x1f')]=_0x451a27;if(_0x466cbf[_0xa241('0x35')]['includeAll']){_0x580d56[_0xa241('0x48')]=[{'all':!![]}];}return db[_0xa241('0x30')][_0xa241('0x49')](_0x580d56);})[_0xa241('0x26')](function(_0x2a19be){_0x50b4a1[_0xa241('0x4a')]=_0x2a19be;return _0x50b4a1;})[_0xa241('0x26')](respondWithFilteredResult(_0x19e5fa,_0x580d56))[_0xa241('0x4b')](handleError(_0x19e5fa,null));};exports[_0xa241('0x4c')]=function(_0x26d541,_0x510f7c){var _0x1c3a91={'raw':!![],'where':{'id':_0x26d541[_0xa241('0x4d')]['id']}},_0x20cfeb={};_0x20cfeb[_0xa241('0x38')]=_[_0xa241('0x36')](db[_0xa241('0x30')][_0xa241('0x31')]);_0x20cfeb['query']=_[_0xa241('0x36')](_0x26d541[_0xa241('0x35')]);_0x20cfeb['filters']=_[_0xa241('0x3a')](_0x20cfeb['model'],_0x20cfeb['query']);_0x1c3a91[_0xa241('0x39')]=_[_0xa241('0x3a')](_0x20cfeb['model'],qs['fields'](_0x26d541['query']['fields']));_0x1c3a91[_0xa241('0x39')]=_0x1c3a91[_0xa241('0x39')][_0xa241('0x3c')]?_0x1c3a91['attributes']:_0x20cfeb[_0xa241('0x38')];if(_0x26d541[_0xa241('0x35')][_0xa241('0x4e')]){_0x1c3a91[_0xa241('0x48')]=[{'all':!![]}];}_0x1c3a91=_[_0xa241('0x45')]({},_0x1c3a91,_0x26d541['options']);return db['SmsQueue']['find'](_0x1c3a91)['then'](handleEntityNotFound(_0x510f7c,null))[_0xa241('0x26')](respondWithResult(_0x510f7c,null))['catch'](handleError(_0x510f7c,null));};exports['create']=function(_0x376c3a,_0x5197d0){return db[_0xa241('0x30')][_0xa241('0x4f')](_0x376c3a[_0xa241('0x50')],{})[_0xa241('0x26')](function(_0xc7c677){var _0x57e8cd=_0x376c3a[_0xa241('0x51')]['get']({'plain':!![]});if(!_0x57e8cd)throw new Error(_0xa241('0x52'));if(_0x57e8cd[_0xa241('0x53')]==='user'){var _0x4c204c=_0xc7c677[_0xa241('0x28')]({'plain':!![]});var _0x329fce=_0xa241('0x29');return db[_0xa241('0x54')]['find']({'where':{'name':_0x329fce,'userProfileId':_0x57e8cd[_0xa241('0x55')]},'raw':!![]})[_0xa241('0x26')](function(_0x44a00d){if(_0x44a00d&&_0x44a00d[_0xa241('0x56')]===0x0){return db[_0xa241('0x57')][_0xa241('0x4f')]({'name':_0x4c204c['name'],'resourceId':_0x4c204c['id'],'type':_0x44a00d['name'],'sectionId':_0x44a00d['id']},{})[_0xa241('0x26')](function(){return _0xc7c677;});}else{return _0xc7c677;}})[_0xa241('0x4b')](function(_0x328c14){logger['error'](_0xa241('0x58'),_0x328c14);throw _0x328c14;});}return _0xc7c677;})[_0xa241('0x26')](respondWithResult(_0x5197d0,0xc9))[_0xa241('0x4b')](handleError(_0x5197d0,null));};exports[_0xa241('0x25')]=function(_0x30ec28,_0x13acac){if(_0x30ec28[_0xa241('0x50')]['id']){delete _0x30ec28[_0xa241('0x50')]['id'];}return db[_0xa241('0x30')]['find']({'where':{'id':_0x30ec28['params']['id']}})[_0xa241('0x26')](handleEntityNotFound(_0x13acac,null))['then'](saveUpdates(_0x30ec28[_0xa241('0x50')],null))['then'](respondWithResult(_0x13acac,null))[_0xa241('0x4b')](handleError(_0x13acac,null));};exports[_0xa241('0x27')]=function(_0x2c1537,_0x466336){return db[_0xa241('0x30')][_0xa241('0x59')]({'where':{'id':_0x2c1537[_0xa241('0x4d')]['id']}})[_0xa241('0x26')](handleEntityNotFound(_0x466336,null))[_0xa241('0x26')](removeEntity(_0x466336,null))[_0xa241('0x4b')](handleError(_0x466336,null));};exports['describe']=function(_0x3067bf,_0x59e139){return db[_0xa241('0x30')][_0xa241('0x5a')]()[_0xa241('0x26')](respondWithResult(_0x59e139,null))['catch'](handleError(_0x59e139,null));};exports['getMembers']=function(_0x399de7,_0x41d3b2,_0x45f173){var _0xff2868={'raw':!![],'where':{}},_0x44fa6e={},_0x52f26;return db[_0xa241('0x30')]['findOne']({'where':{'id':_0x399de7['params']['id']}})[_0xa241('0x26')](handleEntityNotFound(_0x41d3b2,null))['then'](function(_0x28d878){if(_0x28d878){_0x52f26=_0x28d878[_0xa241('0x28')]({'plain':!![]});_0x44fa6e[_0xa241('0x38')]=_[_0xa241('0x36')](db[_0xa241('0x5b')]['rawAttributes']);_0x44fa6e[_0xa241('0x35')]=_['keys'](_0x399de7['query']);_0x44fa6e[_0xa241('0x37')]=_['intersection'](_0x44fa6e[_0xa241('0x38')],_0x44fa6e['query']);_0xff2868[_0xa241('0x39')]=_[_0xa241('0x3a')](_0x44fa6e[_0xa241('0x38')],qs['fields'](_0x399de7[_0xa241('0x35')][_0xa241('0x3b')]));_0xff2868['attributes']=_0xff2868[_0xa241('0x39')][_0xa241('0x3c')]?_0xff2868[_0xa241('0x39')]:_0x44fa6e[_0xa241('0x38')];if(!_0x399de7[_0xa241('0x35')][_0xa241('0x3d')]('nolimit')){_0xff2868[_0xa241('0x3f')]=qs['limit'](_0x399de7[_0xa241('0x35')][_0xa241('0x3f')]);_0xff2868[_0xa241('0x1d')]=qs['offset'](_0x399de7[_0xa241('0x35')][_0xa241('0x1d')]);}_0xff2868[_0xa241('0x40')]=qs[_0xa241('0x41')](_0x399de7['query'][_0xa241('0x41')]);_0xff2868[_0xa241('0x42')]=qs[_0xa241('0x37')](_[_0xa241('0x43')](_0x399de7['query'],_0x44fa6e[_0xa241('0x37')]));_0xff2868[_0xa241('0x42')][_0xa241('0x5c')]=_0x28d878['id'];if(_0x399de7['query'][_0xa241('0x44')]){_0xff2868[_0xa241('0x42')]=_[_0xa241('0x45')](_0xff2868[_0xa241('0x42')],{'$or':_[_0xa241('0x2f')](_0xff2868[_0xa241('0x39')],function(_0x37e1ff){var _0x142d15={};_0x142d15[_0x37e1ff]={'$like':'%'+_0x399de7['query'][_0xa241('0x44')]+'%'};return _0x142d15;})});}_0xff2868=_['merge']({},_0xff2868,_0x399de7[_0xa241('0x47')]);return db[_0xa241('0x5b')][_0xa241('0x49')](_0xff2868);}})['then'](function(_0x1be6fc){if(_0x1be6fc){return db['User'][_0xa241('0x5d')]({'where':{'id':_['map'](_0x1be6fc,_0xa241('0x5e')),'role':_0xa241('0x5f')},'attributes':['id',_0xa241('0x2c'),_0xa241('0x60'),_0xa241('0x61'),_0xa241('0x62')]});}})[_0xa241('0x26')](function(_0x329702){if(_0x329702){return{'count':_0x329702['count'],'rows':_[_0xa241('0x2f')](_0x329702[_0xa241('0x4a')],function(_0x35d09e){return{'membername':_0x35d09e[_0xa241('0x2c')],'UserId':_0x35d09e['id'],'queue_name':_0x52f26[_0xa241('0x2c')],'SmsQueueId':_0x52f26['id'],'interface':util[_0xa241('0x63')](_0xa241('0x64'),_0xa241('0x65'),_0x35d09e[_0xa241('0x2c')]),'penalty':0x0,'paused':_0x35d09e[_0xa241('0x60')],'createdAt':_0x35d09e[_0xa241('0x62')],'updatedAt':_0x35d09e[_0xa241('0x61')]};})};}else{return{'count':0x0,'rows':[]};}})[_0xa241('0x26')](respondWithFilteredResult(_0x41d3b2,_0xff2868))[_0xa241('0x4b')](handleError(_0x41d3b2,null));};exports['getTeams']=function(_0x1afe4b,_0x3436fc,_0x2e684d){var _0x9f5240={};var _0x282517={};var _0x23aa85;var _0x455770;return db[_0xa241('0x30')]['findOne']({'where':{'id':_0x1afe4b[_0xa241('0x4d')]['id']}})[_0xa241('0x26')](handleEntityNotFound(_0x3436fc,null))[_0xa241('0x26')](function(_0x2c13e1){if(_0x2c13e1){_0x23aa85=_0x2c13e1;_0x282517[_0xa241('0x38')]=_[_0xa241('0x36')](db[_0xa241('0x66')][_0xa241('0x31')]);_0x282517['query']=_[_0xa241('0x36')](_0x1afe4b[_0xa241('0x35')]);_0x282517['filters']=_[_0xa241('0x3a')](_0x282517['model'],_0x282517[_0xa241('0x35')]);_0x9f5240['attributes']=_[_0xa241('0x3a')](_0x282517['model'],qs[_0xa241('0x3b')](_0x1afe4b[_0xa241('0x35')][_0xa241('0x3b')]));_0x9f5240[_0xa241('0x39')]=_0x9f5240[_0xa241('0x39')][_0xa241('0x3c')]?_0x9f5240['attributes']:_0x282517[_0xa241('0x38')];_0x9f5240[_0xa241('0x40')]=qs[_0xa241('0x41')](_0x1afe4b['query'][_0xa241('0x41')]);_0x9f5240[_0xa241('0x42')]=qs[_0xa241('0x37')](_['pick'](_0x1afe4b[_0xa241('0x35')],_0x282517['filters']));if(_0x1afe4b[_0xa241('0x35')][_0xa241('0x44')]){_0x9f5240[_0xa241('0x42')]=_[_0xa241('0x45')](_0x9f5240['where'],{'$or':_[_0xa241('0x2f')](_0x9f5240[_0xa241('0x39')],function(_0x1d31a5){var _0x26324e={};_0x26324e[_0x1d31a5]={'$like':'%'+_0x1afe4b[_0xa241('0x35')]['filter']+'%'};return _0x26324e;})});}_0x9f5240=_['merge']({},_0x9f5240,_0x1afe4b[_0xa241('0x47')]);return _0x23aa85[_0xa241('0x67')](_0x9f5240);}})[_0xa241('0x26')](function(_0x394aa8){if(_0x394aa8){_0x455770=_0x394aa8[_0xa241('0x3c')];if(!_0x1afe4b[_0xa241('0x35')][_0xa241('0x3d')]('nolimit')){_0x9f5240[_0xa241('0x3f')]=qs[_0xa241('0x3f')](_0x1afe4b[_0xa241('0x35')][_0xa241('0x3f')]);_0x9f5240[_0xa241('0x1d')]=qs[_0xa241('0x1d')](_0x1afe4b[_0xa241('0x35')][_0xa241('0x1d')]);}return _0x23aa85[_0xa241('0x67')](_0x9f5240);}})['then'](function(_0x22aeb5){if(_0x22aeb5){return _0x22aeb5?{'count':_0x455770,'rows':_0x22aeb5}:null;}})['then'](respondWithResult(_0x3436fc,null))[_0xa241('0x4b')](handleError(_0x3436fc,null));};exports[_0xa241('0x68')]=function(_0x17644f,_0x1332da,_0x36ed66){var _0x5e3062=_0x17644f[_0xa241('0x50')][_0xa241('0x69')];return db[_0xa241('0x66')]['findAll']({'where':{'id':_0x5e3062},'attributes':['id'],'include':[{'model':db[_0xa241('0x6a')],'as':_0xa241('0x6b'),'attributes':['id',_0xa241('0x2c'),_0xa241('0x6c'),_0xa241('0x6d'),'interface'],'raw':!![]}]})[_0xa241('0x26')](function(_0x1d379e){if(_0x1d379e){var _0x474384=_['flatMap'](_0x1d379e,function(_0x50e0ad){var _0x3001e2=_0x50e0ad[_0xa241('0x28')]({'plain':!![]});return _0x3001e2[_0xa241('0x6b')];});return db[_0xa241('0x30')][_0xa241('0x59')]({'where':{'id':_0x17644f[_0xa241('0x4d')]['id']}})[_0xa241('0x26')](function(_0x357fb8){return db[_0xa241('0x6e')][_0xa241('0x6f')](function(_0xa9d23c){return _0x357fb8[_0xa241('0x68')](_0x5e3062,{'transaction':_0xa9d23c})['then'](function(){return BPromise['each'](_0x474384,function(_0x450150){return db[_0xa241('0x5b')]['findOrCreate']({'where':{'UserId':_0x450150['id'],'SmsQueueId':_0x17644f[_0xa241('0x4d')]['id']},'transaction':_0xa9d23c});});})[_0xa241('0x26')](function(){_0x474384[_0xa241('0x70')](function(_0x29b706){socket['emit'](_0xa241('0x71'),{'UserId':_0x29b706['id'],'SmsQueueId':_0x357fb8['id']});});});});});}})[_0xa241('0x26')](respondWithStatusCode(_0x1332da,null))[_0xa241('0x4b')](handleError(_0x1332da,null));};exports[_0xa241('0x72')]=function(_0x4b4b15,_0x31cc67,_0x375ac1){return db[_0xa241('0x66')][_0xa241('0x49')]({'where':{'id':_0x4b4b15['query'][_0xa241('0x69')]},'attributes':['id'],'include':[{'model':db[_0xa241('0x6a')],'as':_0xa241('0x6b'),'attributes':['id'],'raw':!![]}]})['then'](handleEntityNotFound(_0x31cc67,null))['then'](function(_0x356cde){var _0x14b29f=_[_0xa241('0x2f')](_0x356cde,'id');var _0x4e63ac=[];var _0x1e2244=[];var _0x81de3a=squel['select']();_0x81de3a[_0xa241('0x73')](_0xa241('0x74'))[_0xa241('0x75')](_0xa241('0x76'),'tq')[_0xa241('0x77')](_0xa241('0x78'),'ut',_0xa241('0x79'))[_0xa241('0x42')](_0xa241('0x7a'),_0x4b4b15[_0xa241('0x4d')]['id']);for(var _0x51d8fa=0x0;_0x51d8fa<_0x356cde[_0xa241('0x3c')];_0x51d8fa+=0x1){let _0x423c21=_0x356cde[_0x51d8fa];for(var _0x322e88=0x0;_0x322e88<_0x423c21['Agents'][_0xa241('0x3c')];_0x322e88+=0x1){let _0x17308a=_0x423c21[_0xa241('0x6b')][_0x322e88];var _0x3c9db1=_0x81de3a[_0xa241('0x7b')]();_0x3c9db1['where'](_0xa241('0x7c'),_0x17308a['id']);_0x1e2244[_0xa241('0x7d')](db[_0xa241('0x6e')][_0xa241('0x35')](_0x3c9db1[_0xa241('0x7e')](),{'type':db[_0xa241('0x6e')][_0xa241('0x7f')][_0xa241('0x80')]})[_0xa241('0x26')](function(_0x54e59b){if(_0x54e59b[_0xa241('0x3c')]===0x1){return _0x17308a['id'];}else{var _0x368806=_[_0xa241('0x81')](_[_0xa241('0x2f')](_0x54e59b,'TeamId'),function(_0x291523){return _['includes'](_0x14b29f,_0x291523);});if(_0x368806){return _0x17308a['id'];}}}));}}return BPromise[_0xa241('0x82')](_0x1e2244)[_0xa241('0x26')](function(_0x4278ea){_0x4e63ac=_(_0x4e63ac)[_0xa241('0x83')](_0x4278ea)['compact']()[_0xa241('0x84')]();return db[_0xa241('0x30')][_0xa241('0x59')]({'where':{'id':_0x4b4b15[_0xa241('0x4d')]['id']}})[_0xa241('0x26')](function(_0x2b61c7){return db[_0xa241('0x6e')]['transaction'](function(_0x3951d7){return _0x2b61c7['removeTeams'](_0x4b4b15[_0xa241('0x35')][_0xa241('0x69')],{'transaction':_0x3951d7})['then'](function(){if(!_['isEmpty'](_0x4e63ac)){return _0x2b61c7[_0xa241('0x85')](_0x4e63ac,{'transaction':_0x3951d7});}})['then'](function(){_0x4e63ac[_0xa241('0x70')](function(_0x347ee4){socket['emit'](_0xa241('0x86'),{'UserId':_0x347ee4,'SmsQueueId':_0x2b61c7['id']});});});});});});})[_0xa241('0x26')](respondWithStatusCode(_0x31cc67,null))[_0xa241('0x4b')](handleError(_0x31cc67,null));};exports[_0xa241('0x87')]=function(_0xd1bb09,_0x193801,_0xe2051){return db[_0xa241('0x30')][_0xa241('0x59')]({'where':{'id':_0xd1bb09[_0xa241('0x4d')]['id']}})[_0xa241('0x26')](handleEntityNotFound(_0x193801,null))['then'](function(_0x5921a5){if(_0x5921a5){return _0x5921a5[_0xa241('0x87')](_0xd1bb09[_0xa241('0x50')][_0xa241('0x69')],_['omit'](_0xd1bb09[_0xa241('0x50')],[_0xa241('0x69'),'id'])||{})[_0xa241('0x88')](function(_0x57eb4d){for(var _0x4910cc=0x0;_0x4910cc<_0xd1bb09[_0xa241('0x50')][_0xa241('0x69')][_0xa241('0x3c')];_0x4910cc+=0x1){socket[_0xa241('0x89')](_0xa241('0x71'),{'UserId':Number(_0xd1bb09[_0xa241('0x50')][_0xa241('0x69')][_0x4910cc]),'SmsQueueId':Number(_0xd1bb09[_0xa241('0x4d')]['id'])});}return _0x57eb4d;});}})[_0xa241('0x26')](respondWithResult(_0x193801,null))[_0xa241('0x4b')](handleError(_0x193801,null));};exports[_0xa241('0x85')]=function(_0x47766b,_0x272342,_0x4fe5d6){return db[_0xa241('0x30')][_0xa241('0x59')]({'where':{'id':_0x47766b[_0xa241('0x4d')]['id']}})[_0xa241('0x26')](handleEntityNotFound(_0x272342,null))[_0xa241('0x26')](function(_0x401221){if(_0x401221){return _0x401221['removeAgents'](_0x47766b[_0xa241('0x35')][_0xa241('0x69')])['then'](function(){if(_[_0xa241('0x8a')](_0x47766b[_0xa241('0x35')][_0xa241('0x69')])){for(var _0x152cd9=0x0;_0x152cd9<_0x47766b[_0xa241('0x35')]['ids'][_0xa241('0x3c')];_0x152cd9+=0x1){socket[_0xa241('0x89')](_0xa241('0x86'),{'UserId':Number(_0x47766b[_0xa241('0x35')]['ids'][_0x152cd9]),'SmsQueueId':Number(_0x47766b[_0xa241('0x4d')]['id'])});}}else{socket[_0xa241('0x89')](_0xa241('0x86'),{'UserId':Number(_0x47766b[_0xa241('0x35')][_0xa241('0x69')]),'SmsQueueId':Number(_0x47766b[_0xa241('0x4d')]['id'])});}});}})['then'](respondWithStatusCode(_0x272342,null))['catch'](handleError(_0x272342,null));};exports['getAgents']=function(_0x5ae16b,_0x106f3e,_0x38398d){var _0x2e4eed={};var _0x3636f7={};var _0x37c3b5;var _0xccdc15;return db[_0xa241('0x30')]['findOne']({'where':{'id':_0x5ae16b[_0xa241('0x4d')]['id']}})[_0xa241('0x26')](handleEntityNotFound(_0x106f3e,null))[_0xa241('0x26')](function(_0x2364f3){if(_0x2364f3){_0x37c3b5=_0x2364f3;_0x3636f7['model']=_[_0xa241('0x36')](db[_0xa241('0x6a')][_0xa241('0x31')]);_0x3636f7[_0xa241('0x35')]=_[_0xa241('0x36')](_0x5ae16b['query']);_0x3636f7[_0xa241('0x37')]=_[_0xa241('0x3a')](_0x3636f7[_0xa241('0x38')],_0x3636f7[_0xa241('0x35')]);_0x2e4eed['attributes']=_[_0xa241('0x3a')](_0x3636f7['model'],qs[_0xa241('0x3b')](_0x5ae16b[_0xa241('0x35')][_0xa241('0x3b')]));_0x2e4eed[_0xa241('0x39')]=_0x2e4eed['attributes'][_0xa241('0x3c')]?_0x2e4eed[_0xa241('0x39')]:_0x3636f7[_0xa241('0x38')];_0x2e4eed['order']=qs[_0xa241('0x41')](_0x5ae16b[_0xa241('0x35')][_0xa241('0x41')]);_0x2e4eed['where']=qs['filters'](_[_0xa241('0x43')](_0x5ae16b['query'],_0x3636f7[_0xa241('0x37')]));if(_0x5ae16b['query']['filter']){_0x2e4eed[_0xa241('0x42')]=_['merge'](_0x2e4eed[_0xa241('0x42')],{'$or':_[_0xa241('0x2f')](_0x2e4eed['attributes'],function(_0x3375c3){var _0x2d5479={};_0x2d5479[_0x3375c3]={'$like':'%'+_0x5ae16b[_0xa241('0x35')][_0xa241('0x44')]+'%'};return _0x2d5479;})});}_0x2e4eed=_['merge']({},_0x2e4eed,_0x5ae16b['options']);return _0x37c3b5[_0xa241('0x8b')](_0x2e4eed);}})['then'](function(_0x391f95){if(_0x391f95){_0xccdc15=_0x391f95[_0xa241('0x3c')];if(!_0x5ae16b[_0xa241('0x35')]['hasOwnProperty'](_0xa241('0x3e'))){_0x2e4eed[_0xa241('0x3f')]=qs[_0xa241('0x3f')](_0x5ae16b[_0xa241('0x35')][_0xa241('0x3f')]);_0x2e4eed[_0xa241('0x1d')]=qs[_0xa241('0x1d')](_0x5ae16b[_0xa241('0x35')]['offset']);}return _0x37c3b5[_0xa241('0x8b')](_0x2e4eed);}})[_0xa241('0x26')](function(_0x1435c5){if(_0x1435c5){return _0x1435c5?{'count':_0xccdc15,'rows':_0x1435c5}:null;}})['then'](respondWithResult(_0x106f3e,null))['catch'](handleError(_0x106f3e,null));}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.events.js b/server/api/smsQueue/smsQueue.events.js index 2971e72..96d167e 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 _0x6f1b=['setMaxListeners','save','update','remove','emit','hook','exports','../../mysqldb'];(function(_0x4c05da,_0x414720){var _0x1614db=function(_0xa19cf6){while(--_0xa19cf6){_0x4c05da['push'](_0x4c05da['shift']());}};_0x1614db(++_0x414720);}(_0x6f1b,0xe7));var _0xb6f1=function(_0x3d2d19,_0x446b61){_0x3d2d19=_0x3d2d19-0x0;var _0x2b469c=_0x6f1b[_0x3d2d19];return _0x2b469c;};'use strict';var EventEmitter=require('events');var SmsQueue=require(_0xb6f1('0x0'))['db']['SmsQueue'];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0xb6f1('0x1')](0x0);var events={'afterCreate':_0xb6f1('0x2'),'afterUpdate':_0xb6f1('0x3'),'afterDestroy':_0xb6f1('0x4')};function emitEvent(_0x44c141){return function(_0x2c535f,_0x57f037,_0x33caec){SmsQueueEvents[_0xb6f1('0x5')](_0x44c141+':'+_0x2c535f['id'],_0x2c535f);SmsQueueEvents[_0xb6f1('0x5')](_0x44c141,_0x2c535f);_0x33caec(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];SmsQueue[_0xb6f1('0x6')](e,emitEvent(event));}}module[_0xb6f1('0x7')]=SmsQueueEvents; \ No newline at end of file +var _0x95b2=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','SmsQueue','setMaxListeners','save','update','remove'];(function(_0x3793bb,_0x39dfdd){var _0x380006=function(_0x4d30ba){while(--_0x4d30ba){_0x3793bb['push'](_0x3793bb['shift']());}};_0x380006(++_0x39dfdd);}(_0x95b2,0x1dd));var _0x295b=function(_0x332e0b,_0x85c36f){_0x332e0b=_0x332e0b-0x0;var _0x13f11d=_0x95b2[_0x332e0b];return _0x13f11d;};'use strict';var EventEmitter=require(_0x295b('0x0'));var SmsQueue=require(_0x295b('0x1'))['db'][_0x295b('0x2')];var SmsQueueEvents=new EventEmitter();SmsQueueEvents[_0x295b('0x3')](0x0);var events={'afterCreate':_0x295b('0x4'),'afterUpdate':_0x295b('0x5'),'afterDestroy':_0x295b('0x6')};function emitEvent(_0x17036a){return function(_0x490b69,_0x45a804,_0x45fbcd){SmsQueueEvents['emit'](_0x17036a+':'+_0x490b69['id'],_0x490b69);SmsQueueEvents[_0x295b('0x7')](_0x17036a,_0x490b69);_0x45fbcd(null);};}for(var e in events){if(events[_0x295b('0x8')](e)){var event=events[e];SmsQueue[_0x295b('0x9')](e,emitEvent(event));}}module[_0x295b('0xa')]=SmsQueueEvents; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.model.js b/server/api/smsQueue/smsQueue.model.js index 4fb099c..c1e6e5c 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 _0x7793=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SmsQueue','util','../../config/logger','api','moment'];(function(_0x88eed3,_0x1741d7){var _0xf8b3a6=function(_0xb53a90){while(--_0xb53a90){_0x88eed3['push'](_0x88eed3['shift']());}};_0xf8b3a6(++_0x1741d7);}(_0x7793,0x11c));var _0x3779=function(_0x16a5fe,_0x4d32e4){_0x16a5fe=_0x16a5fe-0x0;var _0x4a6cc4=_0x7793[_0x16a5fe];return _0x4a6cc4;};'use strict';var _=require('lodash');var util=require(_0x3779('0x0'));var logger=require(_0x3779('0x1'))(_0x3779('0x2'));var moment=require(_0x3779('0x3'));var BPromise=require(_0x3779('0x4'));var rp=require(_0x3779('0x5'));var fs=require('fs');var path=require(_0x3779('0x6'));var rimraf=require(_0x3779('0x7'));var config=require(_0x3779('0x8'));var attributes=require('./smsQueue.attributes');module[_0x3779('0x9')]=function(_0x140d17,_0x4f91f0){return _0x140d17[_0x3779('0xa')](_0x3779('0xb'),attributes,{'tableName':'sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x0cb5=['request-promise','path','./smsQueue.attributes','exports','sms_queues','util','../../config/logger','api','moment','bluebird'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x0cb5,0x18b));var _0x50cb=function(_0x1e7b16,_0x4607a1){_0x1e7b16=_0x1e7b16-0x0;var _0x37fadc=_0x0cb5[_0x1e7b16];return _0x37fadc;};'use strict';var _=require('lodash');var util=require(_0x50cb('0x0'));var logger=require(_0x50cb('0x1'))(_0x50cb('0x2'));var moment=require(_0x50cb('0x3'));var BPromise=require(_0x50cb('0x4'));var rp=require(_0x50cb('0x5'));var fs=require('fs');var path=require(_0x50cb('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x50cb('0x7'));module[_0x50cb('0x8')]=function(_0x5db2dd,_0x83f51c){return _0x5db2dd['define']('SmsQueue',attributes,{'tableName':_0x50cb('0x9'),'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 5e37ae7..215b762 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 _0xe364=['moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','redis','socket.io-emitter','./smsQueue.socket','register','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetSmsQueue','SmsQueue','findAll','options','raw','where','attributes','limit','include','map','model','then','ShowSmsQueue','lodash'];(function(_0x4869f3,_0x4a62ca){var _0x2443a4=function(_0x2bbb57){while(--_0x2bbb57){_0x4869f3['push'](_0x4869f3['shift']());}};_0x2443a4(++_0x4a62ca);}(_0xe364,0x1ed));var _0x4e36=function(_0x27604f,_0x5ae336){_0x27604f=_0x27604f-0x0;var _0x40d189=_0xe364[_0x27604f];return _0x40d189;};'use strict';var _=require(_0x4e36('0x0'));var util=require('util');var moment=require(_0x4e36('0x1'));var BPromise=require(_0x4e36('0x2'));var rs=require(_0x4e36('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4e36('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x4e36('0x5'));var config=require(_0x4e36('0x6'));var jayson=require(_0x4e36('0x7'));var client=jayson[_0x4e36('0x8')][_0x4e36('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x4e36('0xa')],{'host':'localhost','port':0x18eb});var socket=require(_0x4e36('0xb'))(new Redis(config['redis']));require(_0x4e36('0xc'))[_0x4e36('0xd')](socket);function respondWithRpcPromise(_0x2e76c3,_0x3c3a72,_0xe1ab90){return new BPromise(function(_0x13105d,_0x51f15f){return client[_0x4e36('0xe')](_0x2e76c3,_0xe1ab90)['then'](function(_0x3ec1b1){logger[_0x4e36('0xf')](_0x4e36('0x10'),_0x3c3a72,_0x4e36('0x11'));logger[_0x4e36('0x12')](_0x4e36('0x13'),_0x3c3a72,_0x4e36('0x11'),JSON[_0x4e36('0x14')](_0x3ec1b1));if(_0x3ec1b1[_0x4e36('0x15')]){if(_0x3ec1b1[_0x4e36('0x15')][_0x4e36('0x16')]===0x1f4){logger[_0x4e36('0x15')](_0x4e36('0x10'),_0x3c3a72,_0x3ec1b1[_0x4e36('0x15')]['message']);return _0x51f15f(_0x3ec1b1[_0x4e36('0x15')][_0x4e36('0x17')]);}logger[_0x4e36('0x15')](_0x4e36('0x10'),_0x3c3a72,_0x3ec1b1[_0x4e36('0x15')]['message']);return _0x13105d(_0x3ec1b1[_0x4e36('0x15')][_0x4e36('0x17')]);}else{logger[_0x4e36('0xf')](_0x4e36('0x10'),_0x3c3a72,_0x4e36('0x11'));_0x13105d(_0x3ec1b1['result'][_0x4e36('0x17')]);}})[_0x4e36('0x18')](function(_0x26a9a8){logger[_0x4e36('0x15')](_0x4e36('0x10'),_0x3c3a72,_0x26a9a8);_0x51f15f(_0x26a9a8);});});}exports[_0x4e36('0x19')]=function(_0x44b9a9){var _0x2e9df9=this;return new Promise(function(_0x94634f,_0x1ae19d){return db[_0x4e36('0x1a')][_0x4e36('0x1b')]({'raw':_0x44b9a9['options']?_0x44b9a9[_0x4e36('0x1c')][_0x4e36('0x1d')]===undefined?!![]:![]:!![],'where':_0x44b9a9['options']?_0x44b9a9[_0x4e36('0x1c')][_0x4e36('0x1e')]||null:null,'attributes':_0x44b9a9['options']?_0x44b9a9['options'][_0x4e36('0x1f')]||null:null,'limit':_0x44b9a9[_0x4e36('0x1c')]?_0x44b9a9[_0x4e36('0x1c')][_0x4e36('0x20')]||null:null,'include':_0x44b9a9['options']?_0x44b9a9['options'][_0x4e36('0x21')]?_[_0x4e36('0x22')](_0x44b9a9[_0x4e36('0x1c')][_0x4e36('0x21')],function(_0x234ef2){return{'model':db[_0x234ef2[_0x4e36('0x23')]],'as':_0x234ef2['as'],'attributes':_0x234ef2['attributes'],'include':_0x234ef2[_0x4e36('0x21')]?_['map'](_0x234ef2[_0x4e36('0x21')],function(_0x3b0baa){return{'model':db[_0x3b0baa[_0x4e36('0x23')]],'as':_0x3b0baa['as'],'attributes':_0x3b0baa[_0x4e36('0x1f')],'include':_0x3b0baa['include']?_[_0x4e36('0x22')](_0x3b0baa['include'],function(_0x256cd9){return{'model':db[_0x256cd9[_0x4e36('0x23')]],'as':_0x256cd9['as'],'attributes':_0x256cd9[_0x4e36('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4e36('0x24')](function(_0x3356e7){logger[_0x4e36('0xf')](_0x4e36('0x19'),_0x44b9a9);logger[_0x4e36('0x12')](_0x4e36('0x19'),_0x44b9a9,JSON['stringify'](_0x3356e7));_0x94634f(_0x3356e7);})[_0x4e36('0x18')](function(_0x5b464f){logger[_0x4e36('0x15')](_0x4e36('0x19'),_0x5b464f['message'],_0x44b9a9);_0x1ae19d(_0x2e9df9[_0x4e36('0x15')](0x1f4,_0x5b464f[_0x4e36('0x17')]));});});};exports[_0x4e36('0x25')]=function(_0x1e63d8){var _0xfb5b32=this;return new Promise(function(_0x1813e9,_0x58fb42){return db['SmsQueue']['find']({'raw':_0x1e63d8[_0x4e36('0x1c')]?_0x1e63d8['options'][_0x4e36('0x1d')]===undefined?!![]:![]:!![],'where':_0x1e63d8[_0x4e36('0x1c')]?_0x1e63d8[_0x4e36('0x1c')]['where']||null:null,'attributes':_0x1e63d8[_0x4e36('0x1c')]?_0x1e63d8[_0x4e36('0x1c')][_0x4e36('0x1f')]||null:null,'include':_0x1e63d8['options']?_0x1e63d8[_0x4e36('0x1c')][_0x4e36('0x21')]?_[_0x4e36('0x22')](_0x1e63d8[_0x4e36('0x1c')]['include'],function(_0x12cd5b){return{'model':db[_0x12cd5b[_0x4e36('0x23')]],'as':_0x12cd5b['as'],'attributes':_0x12cd5b[_0x4e36('0x1f')],'include':_0x12cd5b[_0x4e36('0x21')]?_[_0x4e36('0x22')](_0x12cd5b[_0x4e36('0x21')],function(_0x259f49){return{'model':db[_0x259f49[_0x4e36('0x23')]],'as':_0x259f49['as'],'attributes':_0x259f49['attributes'],'include':_0x259f49[_0x4e36('0x21')]?_[_0x4e36('0x22')](_0x259f49[_0x4e36('0x21')],function(_0x489b81){return{'model':db[_0x489b81['model']],'as':_0x489b81['as'],'attributes':_0x489b81[_0x4e36('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x4e36('0x24')](function(_0x1dd799){logger[_0x4e36('0xf')](_0x4e36('0x25'),_0x1e63d8);logger['debug'](_0x4e36('0x25'),_0x1e63d8,JSON['stringify'](_0x1dd799));_0x1813e9(_0x1dd799);})[_0x4e36('0x18')](function(_0x3cb69d){logger[_0x4e36('0x15')](_0x4e36('0x25'),_0x3cb69d['message'],_0x1e63d8);_0x58fb42(_0xfb5b32[_0x4e36('0x15')](0x1f4,_0x3cb69d[_0x4e36('0x17')]));});});}; \ No newline at end of file +var _0xfa18=['include','map','model','then','ShowSmsQueue','find','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','request','info','SmsQueue,\x20%s,\x20%s','request\x20sent','debug','SmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetSmsQueue','findAll','options','raw','where','attributes','limit'];(function(_0x204191,_0x55d566){var _0x526ccf=function(_0x22427d){while(--_0x22427d){_0x204191['push'](_0x204191['shift']());}};_0x526ccf(++_0x55d566);}(_0xfa18,0xa6));var _0x8fa1=function(_0x2ca5de,_0x3f2e0d){_0x2ca5de=_0x2ca5de-0x0;var _0x3d6516=_0xfa18[_0x2ca5de];return _0x3d6516;};'use strict';var _=require(_0x8fa1('0x0'));var util=require(_0x8fa1('0x1'));var moment=require(_0x8fa1('0x2'));var BPromise=require(_0x8fa1('0x3'));var rs=require(_0x8fa1('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fa1('0x5'))['db'];var utils=require(_0x8fa1('0x6'));var logger=require(_0x8fa1('0x7'))('rpc');var config=require(_0x8fa1('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x8fa1('0x9')][_0x8fa1('0xa')]({'port':0x232a});config[_0x8fa1('0xb')]=_[_0x8fa1('0xc')](config[_0x8fa1('0xb')],{'host':_0x8fa1('0xd'),'port':0x18eb});var socket=require(_0x8fa1('0xe'))(new Redis(config['redis']));require('./smsQueue.socket')['register'](socket);function respondWithRpcPromise(_0x133fcf,_0x147ebe,_0x3b5f3c){return new BPromise(function(_0x52c7c7,_0x4d917c){return client[_0x8fa1('0xf')](_0x133fcf,_0x3b5f3c)['then'](function(_0x24c8fd){logger[_0x8fa1('0x10')](_0x8fa1('0x11'),_0x147ebe,_0x8fa1('0x12'));logger[_0x8fa1('0x13')](_0x8fa1('0x14'),_0x147ebe,_0x8fa1('0x12'),JSON[_0x8fa1('0x15')](_0x24c8fd));if(_0x24c8fd[_0x8fa1('0x16')]){if(_0x24c8fd[_0x8fa1('0x16')][_0x8fa1('0x17')]===0x1f4){logger[_0x8fa1('0x16')](_0x8fa1('0x11'),_0x147ebe,_0x24c8fd[_0x8fa1('0x16')][_0x8fa1('0x18')]);return _0x4d917c(_0x24c8fd['error'][_0x8fa1('0x18')]);}logger['error'](_0x8fa1('0x11'),_0x147ebe,_0x24c8fd[_0x8fa1('0x16')][_0x8fa1('0x18')]);return _0x52c7c7(_0x24c8fd[_0x8fa1('0x16')]['message']);}else{logger[_0x8fa1('0x10')](_0x8fa1('0x11'),_0x147ebe,_0x8fa1('0x12'));_0x52c7c7(_0x24c8fd[_0x8fa1('0x19')]['message']);}})[_0x8fa1('0x1a')](function(_0x5cabff){logger[_0x8fa1('0x16')](_0x8fa1('0x11'),_0x147ebe,_0x5cabff);_0x4d917c(_0x5cabff);});});}exports[_0x8fa1('0x1b')]=function(_0x5ae02a){var _0x1549fd=this;return new Promise(function(_0x1c5444,_0x456ae5){return db['SmsQueue'][_0x8fa1('0x1c')]({'raw':_0x5ae02a[_0x8fa1('0x1d')]?_0x5ae02a['options'][_0x8fa1('0x1e')]===undefined?!![]:![]:!![],'where':_0x5ae02a[_0x8fa1('0x1d')]?_0x5ae02a[_0x8fa1('0x1d')][_0x8fa1('0x1f')]||null:null,'attributes':_0x5ae02a[_0x8fa1('0x1d')]?_0x5ae02a[_0x8fa1('0x1d')][_0x8fa1('0x20')]||null:null,'limit':_0x5ae02a['options']?_0x5ae02a[_0x8fa1('0x1d')][_0x8fa1('0x21')]||null:null,'include':_0x5ae02a[_0x8fa1('0x1d')]?_0x5ae02a[_0x8fa1('0x1d')][_0x8fa1('0x22')]?_['map'](_0x5ae02a['options'][_0x8fa1('0x22')],function(_0x23169f){return{'model':db[_0x23169f['model']],'as':_0x23169f['as'],'attributes':_0x23169f[_0x8fa1('0x20')],'include':_0x23169f[_0x8fa1('0x22')]?_[_0x8fa1('0x23')](_0x23169f[_0x8fa1('0x22')],function(_0x2fab27){return{'model':db[_0x2fab27[_0x8fa1('0x24')]],'as':_0x2fab27['as'],'attributes':_0x2fab27['attributes'],'include':_0x2fab27[_0x8fa1('0x22')]?_[_0x8fa1('0x23')](_0x2fab27[_0x8fa1('0x22')],function(_0x26420d){return{'model':db[_0x26420d[_0x8fa1('0x24')]],'as':_0x26420d['as'],'attributes':_0x26420d[_0x8fa1('0x20')]};}):[]};}):[]};}):[]:[]})[_0x8fa1('0x25')](function(_0x3c5222){logger[_0x8fa1('0x10')](_0x8fa1('0x1b'),_0x5ae02a);logger[_0x8fa1('0x13')](_0x8fa1('0x1b'),_0x5ae02a,JSON['stringify'](_0x3c5222));_0x1c5444(_0x3c5222);})['catch'](function(_0x4535ec){logger[_0x8fa1('0x16')](_0x8fa1('0x1b'),_0x4535ec[_0x8fa1('0x18')],_0x5ae02a);_0x456ae5(_0x1549fd[_0x8fa1('0x16')](0x1f4,_0x4535ec[_0x8fa1('0x18')]));});});};exports[_0x8fa1('0x26')]=function(_0x159766){var _0x56577c=this;return new Promise(function(_0x37091b,_0x40e7da){return db['SmsQueue'][_0x8fa1('0x27')]({'raw':_0x159766[_0x8fa1('0x1d')]?_0x159766[_0x8fa1('0x1d')]['raw']===undefined?!![]:![]:!![],'where':_0x159766[_0x8fa1('0x1d')]?_0x159766['options'][_0x8fa1('0x1f')]||null:null,'attributes':_0x159766[_0x8fa1('0x1d')]?_0x159766[_0x8fa1('0x1d')][_0x8fa1('0x20')]||null:null,'include':_0x159766['options']?_0x159766['options'][_0x8fa1('0x22')]?_['map'](_0x159766['options'][_0x8fa1('0x22')],function(_0x56ea23){return{'model':db[_0x56ea23[_0x8fa1('0x24')]],'as':_0x56ea23['as'],'attributes':_0x56ea23['attributes'],'include':_0x56ea23[_0x8fa1('0x22')]?_[_0x8fa1('0x23')](_0x56ea23[_0x8fa1('0x22')],function(_0x5e10f7){return{'model':db[_0x5e10f7['model']],'as':_0x5e10f7['as'],'attributes':_0x5e10f7[_0x8fa1('0x20')],'include':_0x5e10f7[_0x8fa1('0x22')]?_[_0x8fa1('0x23')](_0x5e10f7[_0x8fa1('0x22')],function(_0x2a1aaa){return{'model':db[_0x2a1aaa['model']],'as':_0x2a1aaa['as'],'attributes':_0x2a1aaa['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x4b5d85){logger[_0x8fa1('0x10')](_0x8fa1('0x26'),_0x159766);logger[_0x8fa1('0x13')](_0x8fa1('0x26'),_0x159766,JSON[_0x8fa1('0x15')](_0x4b5d85));_0x37091b(_0x4b5d85);})[_0x8fa1('0x1a')](function(_0x410755){logger[_0x8fa1('0x16')](_0x8fa1('0x26'),_0x410755[_0x8fa1('0x18')],_0x159766);_0x40e7da(_0x56577c[_0x8fa1('0x16')](0x1f4,_0x410755[_0x8fa1('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/smsQueue/smsQueue.socket.js b/server/api/smsQueue/smsQueue.socket.js index 8d45118..ecba226 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 _0x18c1=['update','emit','removeListener','length','smsQueue:','./smsQueue.events','save','remove'];(function(_0x96c763,_0x55a7d0){var _0x587f2c=function(_0x36de63){while(--_0x36de63){_0x96c763['push'](_0x96c763['shift']());}};_0x587f2c(++_0x55a7d0);}(_0x18c1,0x10d));var _0x118c=function(_0x3615e0,_0x2ebb85){_0x3615e0=_0x3615e0-0x0;var _0x48657d=_0x18c1[_0x3615e0];return _0x48657d;};'use strict';var SmsQueueEvents=require(_0x118c('0x0'));var events=[_0x118c('0x1'),_0x118c('0x2'),_0x118c('0x3')];function createListener(_0x562009,_0x23e1b5){return function(_0x3edf1c){_0x23e1b5[_0x118c('0x4')](_0x562009,_0x3edf1c);};}function removeListener(_0x3ac72d,_0x5c0a0a){return function(){SmsQueueEvents[_0x118c('0x5')](_0x3ac72d,_0x5c0a0a);};}exports['register']=function(_0xc7c2d0){for(var _0x403b50=0x0,_0x51a16d=events[_0x118c('0x6')];_0x403b50<_0x51a16d;_0x403b50++){var _0x1a02fb=events[_0x403b50];var _0x196576=createListener(_0x118c('0x7')+_0x1a02fb,_0xc7c2d0);SmsQueueEvents['on'](_0x1a02fb,_0x196576);}}; \ No newline at end of file +var _0xd034=['removeListener','register','length','./smsQueue.events','remove','update','emit'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0xd034,0xc7));var _0x4d03=function(_0x1c5860,_0x49638a){_0x1c5860=_0x1c5860-0x0;var _0x33970c=_0xd034[_0x1c5860];return _0x33970c;};'use strict';var SmsQueueEvents=require(_0x4d03('0x0'));var events=['save',_0x4d03('0x1'),_0x4d03('0x2')];function createListener(_0xcb036e,_0xd89986){return function(_0x872fe3){_0xd89986[_0x4d03('0x3')](_0xcb036e,_0x872fe3);};}function removeListener(_0x3ed8c9,_0x26a8fa){return function(){SmsQueueEvents[_0x4d03('0x4')](_0x3ed8c9,_0x26a8fa);};}exports[_0x4d03('0x5')]=function(_0x2979fe){for(var _0x2ff190=0x0,_0xf6f480=events[_0x4d03('0x6')];_0x2ff190<_0xf6f480;_0x2ff190++){var _0x193598=events[_0x2ff190];var _0x7a4a48=createListener('smsQueue:'+_0x193598,_0x2979fe);SmsQueueEvents['on'](_0x193598,_0x7a4a48);}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/index.js b/server/api/smsQueueReport/index.js index ef38d1c..013c218 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 _0x9208=['put','delete','destroy','exports','multer','util','connect-timeout','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','index','/describe','describe','/:id','show','post','create'];(function(_0x2292b1,_0x792536){var _0x303a39=function(_0x469235){while(--_0x469235){_0x2292b1['push'](_0x2292b1['shift']());}};_0x303a39(++_0x792536);}(_0x9208,0x108));var _0x8920=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x9208[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x8920('0x0'));var util=require(_0x8920('0x1'));var path=require('path');var timeout=require(_0x8920('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x8920('0x3'));var auth=require(_0x8920('0x4'));var interaction=require(_0x8920('0x5'));var config=require(_0x8920('0x6'));var controller=require('./smsQueueReport.controller');router[_0x8920('0x7')]('/',auth[_0x8920('0x8')](),controller[_0x8920('0x9')]);router['get'](_0x8920('0xa'),auth[_0x8920('0x8')](),controller[_0x8920('0xb')]);router[_0x8920('0x7')](_0x8920('0xc'),auth[_0x8920('0x8')](),controller[_0x8920('0xd')]);router[_0x8920('0xe')]('/',auth['isAuthenticated'](),controller[_0x8920('0xf')]);router[_0x8920('0x10')](_0x8920('0xc'),auth[_0x8920('0x8')](),controller['update']);router[_0x8920('0x11')](_0x8920('0xc'),auth['isAuthenticated'](),controller[_0x8920('0x12')]);module[_0x8920('0x13')]=router; \ No newline at end of file +var _0x477f=['exports','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsQueueReport.controller','get','isAuthenticated','describe','/:id','show','create','put','delete','destroy'];(function(_0x36c5b0,_0x5001da){var _0xf19333=function(_0x1e880a){while(--_0x1e880a){_0x36c5b0['push'](_0x36c5b0['shift']());}};_0xf19333(++_0x5001da);}(_0x477f,0x1dc));var _0xf477=function(_0x42da39,_0x4d2c19){_0x42da39=_0x42da39-0x0;var _0x94bf65=_0x477f[_0x42da39];return _0x94bf65;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xf477('0x0'));var timeout=require(_0xf477('0x1'));var express=require(_0xf477('0x2'));var router=express[_0xf477('0x3')]();var fs_extra=require(_0xf477('0x4'));var auth=require(_0xf477('0x5'));var interaction=require(_0xf477('0x6'));var config=require(_0xf477('0x7'));var controller=require(_0xf477('0x8'));router[_0xf477('0x9')]('/',auth[_0xf477('0xa')](),controller['index']);router[_0xf477('0x9')]('/describe',auth['isAuthenticated'](),controller[_0xf477('0xb')]);router[_0xf477('0x9')](_0xf477('0xc'),auth[_0xf477('0xa')](),controller[_0xf477('0xd')]);router['post']('/',auth[_0xf477('0xa')](),controller[_0xf477('0xe')]);router[_0xf477('0xf')](_0xf477('0xc'),auth[_0xf477('0xa')](),controller['update']);router[_0xf477('0x10')](_0xf477('0xc'),auth[_0xf477('0xa')](),controller[_0xf477('0x11')]);module[_0xf477('0x12')]=router; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.attributes.js b/server/api/smsQueueReport/smsQueueReport.attributes.js index 61f846c..47cbeaa 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 _0x7889=['exports','STRING','DATE','sequelize'];(function(_0x4f55f1,_0x20bd10){var _0x4270e1=function(_0x524759){while(--_0x524759){_0x4f55f1['push'](_0x4f55f1['shift']());}};_0x4270e1(++_0x20bd10);}(_0x7889,0xf7));var _0x9788=function(_0xd06028,_0x5c8d0f){_0xd06028=_0xd06028-0x0;var _0x5ab081=_0x7889[_0xd06028];return _0x5ab081;};'use strict';var moment=require('moment');var Sequelize=require(_0x9788('0x0'));module[_0x9788('0x1')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x9788('0x2')]},'joinAt':{'type':Sequelize[_0x9788('0x3')]},'leaveAt':{'type':Sequelize[_0x9788('0x3')]},'acceptAt':{'type':Sequelize[_0x9788('0x3')]},'exitAt':{'type':Sequelize[_0x9788('0x3')]},'reason':{'type':Sequelize[_0x9788('0x2')]}}; \ No newline at end of file +var _0x6838=['DATE','sequelize','STRING'];(function(_0x54f01c,_0x59dbe3){var _0x1ad071=function(_0x32e107){while(--_0x32e107){_0x54f01c['push'](_0x54f01c['shift']());}};_0x1ad071(++_0x59dbe3);}(_0x6838,0x67));var _0x8683=function(_0x261e29,_0x10fffd){_0x261e29=_0x261e29-0x0;var _0x25ef43=_0x6838[_0x261e29];return _0x25ef43;};'use strict';var moment=require('moment');var Sequelize=require(_0x8683('0x0'));module['exports']={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'from':{'type':Sequelize[_0x8683('0x1')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize['DATE']},'acceptAt':{'type':Sequelize[_0x8683('0x2')]},'exitAt':{'type':Sequelize[_0x8683('0x2')]},'reason':{'type':Sequelize[_0x8683('0x1')]}}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.controller.js b/server/api/smsQueueReport/smsQueueReport.controller.js index ade402b..56e059a 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 _0xde1b=['describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','SmsQueueReport','rawAttributes','type','key','model','map','keys','query','filters','intersection','fields','attributes','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','includeAll','include','rows','catch','show','params','length','options','create','body','destroy','find'];(function(_0x48d6a3,_0x37c848){var _0x38bfa0=function(_0x3fba2e){while(--_0x3fba2e){_0x48d6a3['push'](_0x48d6a3['shift']());}};_0x38bfa0(++_0x37c848);}(_0xde1b,0xeb));var _0xbde1=function(_0x21cdd1,_0x195645){_0x21cdd1=_0x21cdd1-0x0;var _0x4f37ae=_0xde1b[_0x21cdd1];return _0x4f37ae;};'use strict';var emlformat=require(_0xbde1('0x0'));var rimraf=require(_0xbde1('0x1'));var zipdir=require(_0xbde1('0x2'));var jsonpatch=require(_0xbde1('0x3'));var rp=require(_0xbde1('0x4'));var moment=require(_0xbde1('0x5'));var BPromise=require('bluebird');var Mustache=require(_0xbde1('0x6'));var util=require(_0xbde1('0x7'));var path=require(_0xbde1('0x8'));var sox=require(_0xbde1('0x9'));var csv=require(_0xbde1('0xa'));var ejs=require(_0xbde1('0xb'));var fs=require('fs');var fs_extra=require(_0xbde1('0xc'));var _=require('lodash');var squel=require(_0xbde1('0xd'));var crypto=require(_0xbde1('0xe'));var jsforce=require(_0xbde1('0xf'));var deskjs=require(_0xbde1('0x10'));var toCsv=require('to-csv');var querystring=require(_0xbde1('0x11'));var Papa=require(_0xbde1('0x12'));var Redis=require(_0xbde1('0x13'));var authService=require(_0xbde1('0x14'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xbde1('0x15'));var logger=require('../../config/logger')(_0xbde1('0x16'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xbde1('0x17'));var db=require(_0xbde1('0x18'))['db'];function respondWithStatusCode(_0x1f6a50,_0x4da58d){_0x4da58d=_0x4da58d||0xcc;return function(_0x2dde7e){if(_0x2dde7e){return _0x1f6a50[_0xbde1('0x19')](_0x4da58d);}return _0x1f6a50[_0xbde1('0x1a')](_0x4da58d)[_0xbde1('0x1b')]();};}function respondWithResult(_0x436975,_0xe9af37){_0xe9af37=_0xe9af37||0xc8;return function(_0x2695fd){if(_0x2695fd){return _0x436975['status'](_0xe9af37)[_0xbde1('0x1c')](_0x2695fd);}};}function respondWithFilteredResult(_0x45ffba,_0x3b1034){return function(_0x768ab){if(_0x768ab){var _0x2d54eb=typeof _0x3b1034[_0xbde1('0x1d')]===_0xbde1('0x1e')&&typeof _0x3b1034[_0xbde1('0x1f')]===_0xbde1('0x1e');var _0xdaae53=_0x768ab[_0xbde1('0x20')];var _0x1adf5f=_0x2d54eb?0x0:_0x3b1034[_0xbde1('0x1d')];var _0xfbd965=_0x2d54eb?_0x768ab[_0xbde1('0x20')]:_0x3b1034['offset']+_0x3b1034[_0xbde1('0x1f')];var _0xea0f12;if(_0xfbd965>=_0xdaae53){_0xfbd965=_0xdaae53;_0xea0f12=0xc8;}else{_0xea0f12=0xce;}_0x45ffba[_0xbde1('0x1a')](_0xea0f12);return _0x45ffba[_0xbde1('0x21')](_0xbde1('0x22'),_0x1adf5f+'-'+_0xfbd965+'/'+_0xdaae53)['json'](_0x768ab);}return null;};}function patchUpdates(_0x576da9){return function(_0x1a788a){try{jsonpatch[_0xbde1('0x23')](_0x1a788a,_0x576da9,!![]);}catch(_0x2f41d6){return BPromise[_0xbde1('0x24')](_0x2f41d6);}return _0x1a788a[_0xbde1('0x25')]();};}function saveUpdates(_0x20d101,_0x1c44f3){return function(_0xe1b3c4){if(_0xe1b3c4){return _0xe1b3c4[_0xbde1('0x26')](_0x20d101)[_0xbde1('0x27')](function(_0x3b42e0){return _0x3b42e0;});}return null;};}function removeEntity(_0x4d14ae,_0x4fc460){return function(_0xaa910a){if(_0xaa910a){return _0xaa910a['destroy']()[_0xbde1('0x27')](function(){_0x4d14ae[_0xbde1('0x1a')](0xcc)[_0xbde1('0x1b')]();});}};}function handleEntityNotFound(_0x21556d,_0x3134ef){return function(_0x36dcd1){if(!_0x36dcd1){_0x21556d[_0xbde1('0x19')](0x194);}return _0x36dcd1;};}function handleError(_0x3daadf,_0x2411f2){_0x2411f2=_0x2411f2||0x1f4;return function(_0x15b034){logger[_0xbde1('0x28')](_0x15b034[_0xbde1('0x29')]);if(_0x15b034[_0xbde1('0x2a')]){delete _0x15b034[_0xbde1('0x2a')];}_0x3daadf[_0xbde1('0x1a')](_0x2411f2)[_0xbde1('0x2b')](_0x15b034);};}exports[_0xbde1('0x2c')]=function(_0x2b613e,_0x5617bb){var _0x5befab={},_0x2100c9={},_0x16fc59={'count':0x0,'rows':[]};var _0x29312c=_['map'](db[_0xbde1('0x2d')][_0xbde1('0x2e')],function(_0x4a76f0){return{'name':_0x4a76f0['fieldName'],'type':_0x4a76f0[_0xbde1('0x2f')][_0xbde1('0x30')]};});_0x2100c9[_0xbde1('0x31')]=_[_0xbde1('0x32')](_0x29312c,_0xbde1('0x2a'));_0x2100c9['query']=_[_0xbde1('0x33')](_0x2b613e[_0xbde1('0x34')]);_0x2100c9[_0xbde1('0x35')]=_[_0xbde1('0x36')](_0x2100c9['model'],_0x2100c9[_0xbde1('0x34')]);_0x5befab['attributes']=_['intersection'](_0x2100c9[_0xbde1('0x31')],qs[_0xbde1('0x37')](_0x2b613e[_0xbde1('0x34')][_0xbde1('0x37')]));_0x5befab[_0xbde1('0x38')]=_0x5befab['attributes']['length']?_0x5befab[_0xbde1('0x38')]:_0x2100c9[_0xbde1('0x31')];if(!_0x2b613e[_0xbde1('0x34')][_0xbde1('0x39')]('nolimit')){_0x5befab[_0xbde1('0x1f')]=qs[_0xbde1('0x1f')](_0x2b613e[_0xbde1('0x34')][_0xbde1('0x1f')]);_0x5befab['offset']=qs['offset'](_0x2b613e[_0xbde1('0x34')][_0xbde1('0x1d')]);}_0x5befab[_0xbde1('0x3a')]=qs[_0xbde1('0x3b')](_0x2b613e['query'][_0xbde1('0x3b')]);_0x5befab[_0xbde1('0x3c')]=qs[_0xbde1('0x35')](_[_0xbde1('0x3d')](_0x2b613e[_0xbde1('0x34')],_0x2100c9[_0xbde1('0x35')]),_0x29312c);if(_0x2b613e[_0xbde1('0x34')][_0xbde1('0x3e')]){_0x5befab[_0xbde1('0x3c')]=_[_0xbde1('0x3f')](_0x5befab['where'],{'$or':_[_0xbde1('0x32')](_0x29312c,function(_0x35d9ff){if(_0x35d9ff[_0xbde1('0x2f')]!==_0xbde1('0x40')){var _0x5779dc={};_0x5779dc[_0x35d9ff[_0xbde1('0x2a')]]={'$like':'%'+_0x2b613e['query'][_0xbde1('0x3e')]+'%'};return _0x5779dc;}})});}_0x5befab=_[_0xbde1('0x3f')]({},_0x5befab,_0x2b613e['options']);var _0x478ba8={'where':_0x5befab[_0xbde1('0x3c')]};return db[_0xbde1('0x2d')][_0xbde1('0x20')](_0x478ba8)[_0xbde1('0x27')](function(_0x45042e){_0x16fc59['count']=_0x45042e;if(_0x2b613e[_0xbde1('0x34')][_0xbde1('0x41')]){_0x5befab[_0xbde1('0x42')]=[{'all':!![]}];}return db[_0xbde1('0x2d')]['findAll'](_0x5befab);})['then'](function(_0x33f77b){_0x16fc59[_0xbde1('0x43')]=_0x33f77b;return _0x16fc59;})['then'](respondWithFilteredResult(_0x5617bb,_0x5befab))[_0xbde1('0x44')](handleError(_0x5617bb,null));};exports[_0xbde1('0x45')]=function(_0x5bf202,_0x44c72e){var _0x477ae1={'raw':!![],'where':{'id':_0x5bf202[_0xbde1('0x46')]['id']}},_0x544d39={};_0x544d39[_0xbde1('0x31')]=_[_0xbde1('0x33')](db[_0xbde1('0x2d')][_0xbde1('0x2e')]);_0x544d39[_0xbde1('0x34')]=_[_0xbde1('0x33')](_0x5bf202[_0xbde1('0x34')]);_0x544d39['filters']=_['intersection'](_0x544d39[_0xbde1('0x31')],_0x544d39[_0xbde1('0x34')]);_0x477ae1[_0xbde1('0x38')]=_[_0xbde1('0x36')](_0x544d39[_0xbde1('0x31')],qs[_0xbde1('0x37')](_0x5bf202['query'][_0xbde1('0x37')]));_0x477ae1[_0xbde1('0x38')]=_0x477ae1['attributes'][_0xbde1('0x47')]?_0x477ae1['attributes']:_0x544d39[_0xbde1('0x31')];if(_0x5bf202[_0xbde1('0x34')]['includeAll']){_0x477ae1[_0xbde1('0x42')]=[{'all':!![]}];}_0x477ae1=_['merge']({},_0x477ae1,_0x5bf202[_0xbde1('0x48')]);return db[_0xbde1('0x2d')]['find'](_0x477ae1)['then'](handleEntityNotFound(_0x44c72e,null))[_0xbde1('0x27')](respondWithResult(_0x44c72e,null))['catch'](handleError(_0x44c72e,null));};exports[_0xbde1('0x49')]=function(_0x13f4e1,_0xe2165b){return db['SmsQueueReport']['create'](_0x13f4e1[_0xbde1('0x4a')],{})[_0xbde1('0x27')](respondWithResult(_0xe2165b,0xc9))[_0xbde1('0x44')](handleError(_0xe2165b,null));};exports[_0xbde1('0x26')]=function(_0x1dfeea,_0x4cbf89){if(_0x1dfeea[_0xbde1('0x4a')]['id']){delete _0x1dfeea[_0xbde1('0x4a')]['id'];}return db[_0xbde1('0x2d')]['find']({'where':{'id':_0x1dfeea[_0xbde1('0x46')]['id']}})[_0xbde1('0x27')](handleEntityNotFound(_0x4cbf89,null))[_0xbde1('0x27')](saveUpdates(_0x1dfeea[_0xbde1('0x4a')],null))[_0xbde1('0x27')](respondWithResult(_0x4cbf89,null))[_0xbde1('0x44')](handleError(_0x4cbf89,null));};exports[_0xbde1('0x4b')]=function(_0xd8977a,_0x14c529){return db[_0xbde1('0x2d')][_0xbde1('0x4c')]({'where':{'id':_0xd8977a['params']['id']}})[_0xbde1('0x27')](handleEntityNotFound(_0x14c529,null))['then'](removeEntity(_0x14c529,null))[_0xbde1('0x44')](handleError(_0x14c529,null));};exports['describe']=function(_0x15dabf,_0x1f0d85){return db[_0xbde1('0x2d')][_0xbde1('0x4d')]()['then'](respondWithResult(_0x1f0d85,null))['catch'](handleError(_0x1f0d85,null));}; \ No newline at end of file +var _0xc705=['filter','type','merge','options','includeAll','findAll','rows','catch','show','params','include','body','update','find','describe','eml-format','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','set','Content-Range','apply','reject','then','destroy','error','stack','name','send','index','map','SmsQueueReport','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filters'];(function(_0x4c0cd2,_0x134872){var _0x5417e5=function(_0x1b1894){while(--_0x1b1894){_0x4c0cd2['push'](_0x4c0cd2['shift']());}};_0x5417e5(++_0x134872);}(_0xc705,0x186));var _0x5c70=function(_0x5a26db,_0x2c5ccd){_0x5a26db=_0x5a26db-0x0;var _0x4619dd=_0xc705[_0x5a26db];return _0x4619dd;};'use strict';var emlformat=require(_0x5c70('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x5c70('0x1'));var jsonpatch=require(_0x5c70('0x2'));var rp=require(_0x5c70('0x3'));var moment=require('moment');var BPromise=require(_0x5c70('0x4'));var Mustache=require(_0x5c70('0x5'));var util=require(_0x5c70('0x6'));var path=require(_0x5c70('0x7'));var sox=require(_0x5c70('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x5c70('0x9'));var _=require(_0x5c70('0xa'));var squel=require('squel');var crypto=require(_0x5c70('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x5c70('0xc'));var toCsv=require('to-csv');var querystring=require(_0x5c70('0xd'));var Papa=require(_0x5c70('0xe'));var Redis=require(_0x5c70('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x5c70('0x10'));var as=require(_0x5c70('0x11'));var hardwareService=require(_0x5c70('0x12'));var logger=require(_0x5c70('0x13'))(_0x5c70('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5c70('0x15'));var db=require(_0x5c70('0x16'))['db'];function respondWithStatusCode(_0x2b88b9,_0x583484){_0x583484=_0x583484||0xcc;return function(_0x118492){if(_0x118492){return _0x2b88b9[_0x5c70('0x17')](_0x583484);}return _0x2b88b9[_0x5c70('0x18')](_0x583484)[_0x5c70('0x19')]();};}function respondWithResult(_0x3fed8b,_0x2450f1){_0x2450f1=_0x2450f1||0xc8;return function(_0x4d1d06){if(_0x4d1d06){return _0x3fed8b[_0x5c70('0x18')](_0x2450f1)[_0x5c70('0x1a')](_0x4d1d06);}};}function respondWithFilteredResult(_0x212f00,_0x423794){return function(_0x38d35c){if(_0x38d35c){var _0x199237=typeof _0x423794[_0x5c70('0x1b')]===_0x5c70('0x1c')&&typeof _0x423794['limit']===_0x5c70('0x1c');var _0x24a6b2=_0x38d35c[_0x5c70('0x1d')];var _0xbe9322=_0x199237?0x0:_0x423794[_0x5c70('0x1b')];var _0x1f7176=_0x199237?_0x38d35c['count']:_0x423794[_0x5c70('0x1b')]+_0x423794[_0x5c70('0x1e')];var _0x28ca34;if(_0x1f7176>=_0x24a6b2){_0x1f7176=_0x24a6b2;_0x28ca34=0xc8;}else{_0x28ca34=0xce;}_0x212f00[_0x5c70('0x18')](_0x28ca34);return _0x212f00[_0x5c70('0x1f')](_0x5c70('0x20'),_0xbe9322+'-'+_0x1f7176+'/'+_0x24a6b2)[_0x5c70('0x1a')](_0x38d35c);}return null;};}function patchUpdates(_0x390397){return function(_0x158f7d){try{jsonpatch[_0x5c70('0x21')](_0x158f7d,_0x390397,!![]);}catch(_0x3388d0){return BPromise[_0x5c70('0x22')](_0x3388d0);}return _0x158f7d['save']();};}function saveUpdates(_0x370a9a,_0xfaae28){return function(_0x36f126){if(_0x36f126){return _0x36f126['update'](_0x370a9a)[_0x5c70('0x23')](function(_0x3805d5){return _0x3805d5;});}return null;};}function removeEntity(_0x43433f,_0x5de7df){return function(_0xe85ebf){if(_0xe85ebf){return _0xe85ebf[_0x5c70('0x24')]()[_0x5c70('0x23')](function(){_0x43433f[_0x5c70('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x633cdf,_0x310e6d){return function(_0x2b7f1b){if(!_0x2b7f1b){_0x633cdf[_0x5c70('0x17')](0x194);}return _0x2b7f1b;};}function handleError(_0x11c3fb,_0x3c8490){_0x3c8490=_0x3c8490||0x1f4;return function(_0x3c05b4){logger[_0x5c70('0x25')](_0x3c05b4[_0x5c70('0x26')]);if(_0x3c05b4['name']){delete _0x3c05b4[_0x5c70('0x27')];}_0x11c3fb[_0x5c70('0x18')](_0x3c8490)[_0x5c70('0x28')](_0x3c05b4);};}exports[_0x5c70('0x29')]=function(_0x59f6cc,_0x238ec2){var _0x10ddbb={},_0x346de4={},_0x35d836={'count':0x0,'rows':[]};var _0x1b48db=_[_0x5c70('0x2a')](db[_0x5c70('0x2b')][_0x5c70('0x2c')],function(_0xf3a358){return{'name':_0xf3a358[_0x5c70('0x2d')],'type':_0xf3a358['type'][_0x5c70('0x2e')]};});_0x346de4[_0x5c70('0x2f')]=_[_0x5c70('0x2a')](_0x1b48db,_0x5c70('0x27'));_0x346de4[_0x5c70('0x30')]=_[_0x5c70('0x31')](_0x59f6cc[_0x5c70('0x30')]);_0x346de4['filters']=_[_0x5c70('0x32')](_0x346de4[_0x5c70('0x2f')],_0x346de4['query']);_0x10ddbb[_0x5c70('0x33')]=_[_0x5c70('0x32')](_0x346de4[_0x5c70('0x2f')],qs[_0x5c70('0x34')](_0x59f6cc['query'][_0x5c70('0x34')]));_0x10ddbb[_0x5c70('0x33')]=_0x10ddbb[_0x5c70('0x33')][_0x5c70('0x35')]?_0x10ddbb[_0x5c70('0x33')]:_0x346de4[_0x5c70('0x2f')];if(!_0x59f6cc['query'][_0x5c70('0x36')]('nolimit')){_0x10ddbb[_0x5c70('0x1e')]=qs[_0x5c70('0x1e')](_0x59f6cc[_0x5c70('0x30')][_0x5c70('0x1e')]);_0x10ddbb[_0x5c70('0x1b')]=qs[_0x5c70('0x1b')](_0x59f6cc[_0x5c70('0x30')]['offset']);}_0x10ddbb[_0x5c70('0x37')]=qs[_0x5c70('0x38')](_0x59f6cc[_0x5c70('0x30')][_0x5c70('0x38')]);_0x10ddbb[_0x5c70('0x39')]=qs['filters'](_[_0x5c70('0x3a')](_0x59f6cc['query'],_0x346de4[_0x5c70('0x3b')]),_0x1b48db);if(_0x59f6cc['query'][_0x5c70('0x3c')]){_0x10ddbb[_0x5c70('0x39')]=_['merge'](_0x10ddbb[_0x5c70('0x39')],{'$or':_[_0x5c70('0x2a')](_0x1b48db,function(_0x10d287){if(_0x10d287[_0x5c70('0x3d')]!=='VIRTUAL'){var _0x3b0457={};_0x3b0457[_0x10d287['name']]={'$like':'%'+_0x59f6cc[_0x5c70('0x30')]['filter']+'%'};return _0x3b0457;}})});}_0x10ddbb=_[_0x5c70('0x3e')]({},_0x10ddbb,_0x59f6cc[_0x5c70('0x3f')]);var _0x3b7455={'where':_0x10ddbb[_0x5c70('0x39')]};return db[_0x5c70('0x2b')][_0x5c70('0x1d')](_0x3b7455)[_0x5c70('0x23')](function(_0x5aced1){_0x35d836[_0x5c70('0x1d')]=_0x5aced1;if(_0x59f6cc[_0x5c70('0x30')][_0x5c70('0x40')]){_0x10ddbb['include']=[{'all':!![]}];}return db['SmsQueueReport'][_0x5c70('0x41')](_0x10ddbb);})[_0x5c70('0x23')](function(_0x2deaad){_0x35d836[_0x5c70('0x42')]=_0x2deaad;return _0x35d836;})[_0x5c70('0x23')](respondWithFilteredResult(_0x238ec2,_0x10ddbb))[_0x5c70('0x43')](handleError(_0x238ec2,null));};exports[_0x5c70('0x44')]=function(_0x50308a,_0x1e0112){var _0x145d33={'raw':!![],'where':{'id':_0x50308a[_0x5c70('0x45')]['id']}},_0x2c5a7c={};_0x2c5a7c[_0x5c70('0x2f')]=_[_0x5c70('0x31')](db['SmsQueueReport'][_0x5c70('0x2c')]);_0x2c5a7c[_0x5c70('0x30')]=_[_0x5c70('0x31')](_0x50308a[_0x5c70('0x30')]);_0x2c5a7c[_0x5c70('0x3b')]=_['intersection'](_0x2c5a7c[_0x5c70('0x2f')],_0x2c5a7c[_0x5c70('0x30')]);_0x145d33[_0x5c70('0x33')]=_[_0x5c70('0x32')](_0x2c5a7c[_0x5c70('0x2f')],qs[_0x5c70('0x34')](_0x50308a['query'][_0x5c70('0x34')]));_0x145d33[_0x5c70('0x33')]=_0x145d33[_0x5c70('0x33')][_0x5c70('0x35')]?_0x145d33[_0x5c70('0x33')]:_0x2c5a7c[_0x5c70('0x2f')];if(_0x50308a[_0x5c70('0x30')][_0x5c70('0x40')]){_0x145d33[_0x5c70('0x46')]=[{'all':!![]}];}_0x145d33=_[_0x5c70('0x3e')]({},_0x145d33,_0x50308a[_0x5c70('0x3f')]);return db[_0x5c70('0x2b')]['find'](_0x145d33)[_0x5c70('0x23')](handleEntityNotFound(_0x1e0112,null))[_0x5c70('0x23')](respondWithResult(_0x1e0112,null))[_0x5c70('0x43')](handleError(_0x1e0112,null));};exports['create']=function(_0xdc567f,_0x588a56){return db[_0x5c70('0x2b')]['create'](_0xdc567f[_0x5c70('0x47')],{})[_0x5c70('0x23')](respondWithResult(_0x588a56,0xc9))[_0x5c70('0x43')](handleError(_0x588a56,null));};exports[_0x5c70('0x48')]=function(_0x4e9526,_0x3cacc5){if(_0x4e9526[_0x5c70('0x47')]['id']){delete _0x4e9526[_0x5c70('0x47')]['id'];}return db[_0x5c70('0x2b')][_0x5c70('0x49')]({'where':{'id':_0x4e9526[_0x5c70('0x45')]['id']}})[_0x5c70('0x23')](handleEntityNotFound(_0x3cacc5,null))[_0x5c70('0x23')](saveUpdates(_0x4e9526[_0x5c70('0x47')],null))[_0x5c70('0x23')](respondWithResult(_0x3cacc5,null))[_0x5c70('0x43')](handleError(_0x3cacc5,null));};exports[_0x5c70('0x24')]=function(_0x33df9e,_0x13512e){return db[_0x5c70('0x2b')][_0x5c70('0x49')]({'where':{'id':_0x33df9e[_0x5c70('0x45')]['id']}})['then'](handleEntityNotFound(_0x13512e,null))[_0x5c70('0x23')](removeEntity(_0x13512e,null))[_0x5c70('0x43')](handleError(_0x13512e,null));};exports[_0x5c70('0x4a')]=function(_0x3e85a6,_0x21b993){return db[_0x5c70('0x2b')]['describe']()[_0x5c70('0x23')](respondWithResult(_0x21b993,null))['catch'](handleError(_0x21b993,null));}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.model.js b/server/api/smsQueueReport/smsQueueReport.model.js index 5200c7d..d60881e 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 _0xe706=['../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsQueueReport.attributes','exports','define','SmsQueueReport','report_sms_queue','uniqueid','lodash','util'];(function(_0x1839fa,_0x2d18ba){var _0x599af0=function(_0x4b1afe){while(--_0x4b1afe){_0x1839fa['push'](_0x1839fa['shift']());}};_0x599af0(++_0x2d18ba);}(_0xe706,0xa3));var _0x6e70=function(_0x5bd60b,_0x13465a){_0x5bd60b=_0x5bd60b-0x0;var _0x2dcff0=_0xe706[_0x5bd60b];return _0x2dcff0;};'use strict';var _=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var logger=require(_0x6e70('0x2'))('api');var moment=require(_0x6e70('0x3'));var BPromise=require(_0x6e70('0x4'));var rp=require(_0x6e70('0x5'));var fs=require('fs');var path=require(_0x6e70('0x6'));var rimraf=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var attributes=require(_0x6e70('0x9'));module[_0x6e70('0xa')]=function(_0x1b0389,_0x4381d1){return _0x1b0389[_0x6e70('0xb')](_0x6e70('0xc'),attributes,{'tableName':_0x6e70('0xd'),'paranoid':![],'indexes':[{'name':_0x6e70('0xe'),'fields':[_0x6e70('0xe')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x70e0=['util','../../config/logger','bluebird','request-promise','path','rimraf','./smsQueueReport.attributes','report_sms_queue','uniqueid','lodash'];(function(_0x130e38,_0x27339b){var _0x31b127=function(_0x200690){while(--_0x200690){_0x130e38['push'](_0x130e38['shift']());}};_0x31b127(++_0x27339b);}(_0x70e0,0x17b));var _0x070e=function(_0x50ff5a,_0x56e0d2){_0x50ff5a=_0x50ff5a-0x0;var _0x185734=_0x70e0[_0x50ff5a];return _0x185734;};'use strict';var _=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var logger=require(_0x070e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x070e('0x3'));var rp=require(_0x070e('0x4'));var fs=require('fs');var path=require(_0x070e('0x5'));var rimraf=require(_0x070e('0x6'));var config=require('../../config/environment');var attributes=require(_0x070e('0x7'));module['exports']=function(_0x46fe68,_0x4b041d){return _0x46fe68['define']('SmsQueueReport',attributes,{'tableName':_0x070e('0x8'),'paranoid':![],'indexes':[{'name':_0x070e('0x9'),'fields':[_0x070e('0x9')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsQueueReport/smsQueueReport.rpc.js b/server/api/smsQueueReport/smsQueueReport.rpc.js index 8f31582..cb12fa5 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 _0x8ec3=['SmsQueueReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','SmsQueueReport,\x20%s,\x20%s','message','catch','CreateSmsQueueReport','body','options','UpdateSmsQueueReport','update','raw','where','attributes','limit','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','then','info','debug'];(function(_0x8ba988,_0x25d3bf){var _0x441ac7=function(_0x277a08){while(--_0x277a08){_0x8ba988['push'](_0x8ba988['shift']());}};_0x441ac7(++_0x25d3bf);}(_0x8ec3,0x111));var _0x38ec=function(_0x119800,_0x224fc9){_0x119800=_0x119800-0x0;var _0x12720=_0x8ec3[_0x119800];return _0x12720;};'use strict';var _=require('lodash');var util=require(_0x38ec('0x0'));var moment=require(_0x38ec('0x1'));var BPromise=require(_0x38ec('0x2'));var rs=require(_0x38ec('0x3'));var fs=require('fs');var Redis=require(_0x38ec('0x4'));var db=require(_0x38ec('0x5'))['db'];var utils=require(_0x38ec('0x6'));var logger=require('../../config/logger')(_0x38ec('0x7'));var config=require(_0x38ec('0x8'));var jayson=require(_0x38ec('0x9'));var client=jayson[_0x38ec('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b8882,_0xe46b05,_0x5bc07a){return new BPromise(function(_0x39edb5,_0x4c1a9d){return client[_0x38ec('0xb')](_0x1b8882,_0x5bc07a)[_0x38ec('0xc')](function(_0x48554c){logger[_0x38ec('0xd')]('SmsQueueReport,\x20%s,\x20%s',_0xe46b05,'request\x20sent');logger[_0x38ec('0xe')](_0x38ec('0xf'),_0xe46b05,_0x38ec('0x10'),JSON[_0x38ec('0x11')](_0x48554c));if(_0x48554c[_0x38ec('0x12')]){if(_0x48554c['error'][_0x38ec('0x13')]===0x1f4){logger[_0x38ec('0x12')](_0x38ec('0x14'),_0xe46b05,_0x48554c[_0x38ec('0x12')][_0x38ec('0x15')]);return _0x4c1a9d(_0x48554c[_0x38ec('0x12')][_0x38ec('0x15')]);}logger[_0x38ec('0x12')]('SmsQueueReport,\x20%s,\x20%s',_0xe46b05,_0x48554c[_0x38ec('0x12')][_0x38ec('0x15')]);return _0x39edb5(_0x48554c[_0x38ec('0x12')][_0x38ec('0x15')]);}else{logger[_0x38ec('0xd')](_0x38ec('0x14'),_0xe46b05,_0x38ec('0x10'));_0x39edb5(_0x48554c['result'][_0x38ec('0x15')]);}})[_0x38ec('0x16')](function(_0x345fad){logger[_0x38ec('0x12')](_0x38ec('0x14'),_0xe46b05,_0x345fad);_0x4c1a9d(_0x345fad);});});}exports[_0x38ec('0x17')]=function(_0x5d7007){var _0x356799=this;return new Promise(function(_0x1a384e,_0x3b6af5){return db['SmsQueueReport']['create'](_0x5d7007[_0x38ec('0x18')],{'raw':_0x5d7007[_0x38ec('0x19')]?_0x5d7007[_0x38ec('0x19')]['raw']===undefined?!![]:![]:!![]})['then'](function(_0x1a9f6e){logger[_0x38ec('0xd')]('CreateSmsQueueReport',_0x5d7007);logger[_0x38ec('0xe')](_0x38ec('0x17'),_0x5d7007,JSON[_0x38ec('0x11')](_0x1a9f6e));_0x1a384e(_0x1a9f6e);})['catch'](function(_0x154a89){logger[_0x38ec('0x12')]('CreateSmsQueueReport',_0x154a89['message'],_0x5d7007);_0x3b6af5(_0x356799[_0x38ec('0x12')](0x1f4,_0x154a89[_0x38ec('0x15')]));});});};exports[_0x38ec('0x1a')]=function(_0x255e36){var _0x549b26=this;return new Promise(function(_0x473772,_0x4ee249){return db['SmsQueueReport'][_0x38ec('0x1b')](_0x255e36['body'],{'raw':_0x255e36['options']?_0x255e36[_0x38ec('0x19')][_0x38ec('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x255e36[_0x38ec('0x19')]?_0x255e36[_0x38ec('0x19')][_0x38ec('0x1d')]||null:null,'attributes':_0x255e36[_0x38ec('0x19')]?_0x255e36[_0x38ec('0x19')][_0x38ec('0x1e')]||null:null,'limit':_0x255e36['options']?_0x255e36['options'][_0x38ec('0x1f')]||null:null})[_0x38ec('0xc')](function(_0x591156){logger[_0x38ec('0xd')](_0x38ec('0x1a'),_0x255e36);logger[_0x38ec('0xe')]('UpdateSmsQueueReport',_0x255e36,JSON['stringify'](_0x591156));_0x473772(_0x591156);})[_0x38ec('0x16')](function(_0x104801){logger[_0x38ec('0x12')](_0x38ec('0x1a'),_0x104801[_0x38ec('0x15')],_0x255e36);_0x4ee249(_0x549b26['error'](0x1f4,_0x104801[_0x38ec('0x15')]));});});}; \ No newline at end of file +var _0x6fb8=['jayson/promise','http','request','then','info','SmsQueueReport,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','CreateSmsQueueReport','SmsQueueReport','create','body','options','raw','debug','catch','UpdateSmsQueueReport','update','where','attributes','limit','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x468ac5,_0x2edfd5){var _0x33a807=function(_0x204fb5){while(--_0x204fb5){_0x468ac5['push'](_0x468ac5['shift']());}};_0x33a807(++_0x2edfd5);}(_0x6fb8,0x111));var _0x86fb=function(_0x4314d7,_0x355218){_0x4314d7=_0x4314d7-0x0;var _0x5c599b=_0x6fb8[_0x4314d7];return _0x5c599b;};'use strict';var _=require('lodash');var util=require(_0x86fb('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x86fb('0x1'));var fs=require('fs');var Redis=require(_0x86fb('0x2'));var db=require(_0x86fb('0x3'))['db'];var utils=require(_0x86fb('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x86fb('0x5'));var jayson=require(_0x86fb('0x6'));var client=jayson['client'][_0x86fb('0x7')]({'port':0x232a});function respondWithRpcPromise(_0xf03f66,_0x5ea4ed,_0x55c063){return new BPromise(function(_0x5b1262,_0x89c7aa){return client[_0x86fb('0x8')](_0xf03f66,_0x55c063)[_0x86fb('0x9')](function(_0x3de881){logger[_0x86fb('0xa')](_0x86fb('0xb'),_0x5ea4ed,_0x86fb('0xc'));logger['debug']('SmsQueueReport,\x20%s,\x20%s,\x20%s',_0x5ea4ed,_0x86fb('0xc'),JSON[_0x86fb('0xd')](_0x3de881));if(_0x3de881[_0x86fb('0xe')]){if(_0x3de881['error'][_0x86fb('0xf')]===0x1f4){logger[_0x86fb('0xe')](_0x86fb('0xb'),_0x5ea4ed,_0x3de881['error']['message']);return _0x89c7aa(_0x3de881['error'][_0x86fb('0x10')]);}logger[_0x86fb('0xe')](_0x86fb('0xb'),_0x5ea4ed,_0x3de881['error']['message']);return _0x5b1262(_0x3de881[_0x86fb('0xe')][_0x86fb('0x10')]);}else{logger[_0x86fb('0xa')](_0x86fb('0xb'),_0x5ea4ed,_0x86fb('0xc'));_0x5b1262(_0x3de881[_0x86fb('0x11')][_0x86fb('0x10')]);}})['catch'](function(_0x58e7a4){logger['error'](_0x86fb('0xb'),_0x5ea4ed,_0x58e7a4);_0x89c7aa(_0x58e7a4);});});}exports[_0x86fb('0x12')]=function(_0xa1144f){var _0x3f62a9=this;return new Promise(function(_0x229eca,_0x13b8af){return db[_0x86fb('0x13')][_0x86fb('0x14')](_0xa1144f[_0x86fb('0x15')],{'raw':_0xa1144f[_0x86fb('0x16')]?_0xa1144f[_0x86fb('0x16')][_0x86fb('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0xea7516){logger[_0x86fb('0xa')](_0x86fb('0x12'),_0xa1144f);logger[_0x86fb('0x18')](_0x86fb('0x12'),_0xa1144f,JSON[_0x86fb('0xd')](_0xea7516));_0x229eca(_0xea7516);})[_0x86fb('0x19')](function(_0x2a5420){logger[_0x86fb('0xe')](_0x86fb('0x12'),_0x2a5420[_0x86fb('0x10')],_0xa1144f);_0x13b8af(_0x3f62a9[_0x86fb('0xe')](0x1f4,_0x2a5420[_0x86fb('0x10')]));});});};exports[_0x86fb('0x1a')]=function(_0x3d7f21){var _0x564147=this;return new Promise(function(_0x3b9916,_0x31fb0d){return db[_0x86fb('0x13')][_0x86fb('0x1b')](_0x3d7f21['body'],{'raw':_0x3d7f21['options']?_0x3d7f21['options'][_0x86fb('0x17')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3d7f21[_0x86fb('0x16')]?_0x3d7f21['options'][_0x86fb('0x1c')]||null:null,'attributes':_0x3d7f21['options']?_0x3d7f21['options'][_0x86fb('0x1d')]||null:null,'limit':_0x3d7f21[_0x86fb('0x16')]?_0x3d7f21[_0x86fb('0x16')][_0x86fb('0x1e')]||null:null})['then'](function(_0x3806b4){logger[_0x86fb('0xa')](_0x86fb('0x1a'),_0x3d7f21);logger['debug'](_0x86fb('0x1a'),_0x3d7f21,JSON[_0x86fb('0xd')](_0x3806b4));_0x3b9916(_0x3806b4);})[_0x86fb('0x19')](function(_0x31689c){logger[_0x86fb('0xe')](_0x86fb('0x1a'),_0x31689c[_0x86fb('0x10')],_0x3d7f21);_0x31fb0d(_0x564147[_0x86fb('0xe')](0x1f4,_0x31689c[_0x86fb('0x10')]));});});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/index.js b/server/api/smsTransferReport/index.js index 8f15027..42e6581 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 _0x7bae=['isAuthenticated','index','/describe','describe','/:id','post','create','put','update','delete','destroy','path','connect-timeout','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./smsTransferReport.controller','get'];(function(_0xf659b9,_0x4e686f){var _0x554601=function(_0x178f05){while(--_0x178f05){_0xf659b9['push'](_0xf659b9['shift']());}};_0x554601(++_0x4e686f);}(_0x7bae,0x13b));var _0xe7ba=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x7bae[_0x33032e];return _0x13316b;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0xe7ba('0x0'));var timeout=require(_0xe7ba('0x1'));var express=require('express');var router=express[_0xe7ba('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0xe7ba('0x3'));var interaction=require(_0xe7ba('0x4'));var config=require(_0xe7ba('0x5'));var controller=require(_0xe7ba('0x6'));router[_0xe7ba('0x7')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x9')]);router[_0xe7ba('0x7')](_0xe7ba('0xa'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xb')]);router[_0xe7ba('0x7')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller['show']);router[_0xe7ba('0xd')]('/',auth[_0xe7ba('0x8')](),controller[_0xe7ba('0xe')]);router[_0xe7ba('0xf')](_0xe7ba('0xc'),auth[_0xe7ba('0x8')](),controller[_0xe7ba('0x10')]);router[_0xe7ba('0x11')](_0xe7ba('0xc'),auth['isAuthenticated'](),controller[_0xe7ba('0x12')]);module['exports']=router; \ No newline at end of file +var _0x31c2=['connect-timeout','express','Router','fs-extra','../../components/auth/service','./smsTransferReport.controller','get','isAuthenticated','index','/describe','describe','/:id','show','post','create','put','delete','destroy','exports','multer','util','path'];(function(_0x710815,_0x520da8){var _0x5b3b89=function(_0x2e1a8e){while(--_0x2e1a8e){_0x710815['push'](_0x710815['shift']());}};_0x5b3b89(++_0x520da8);}(_0x31c2,0x1e1));var _0x231c=function(_0x54aa16,_0x3936ac){_0x54aa16=_0x54aa16-0x0;var _0x1cdf55=_0x31c2[_0x54aa16];return _0x1cdf55;};'use strict';var multer=require(_0x231c('0x0'));var util=require(_0x231c('0x1'));var path=require(_0x231c('0x2'));var timeout=require(_0x231c('0x3'));var express=require(_0x231c('0x4'));var router=express[_0x231c('0x5')]();var fs_extra=require(_0x231c('0x6'));var auth=require(_0x231c('0x7'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x231c('0x8'));router[_0x231c('0x9')]('/',auth[_0x231c('0xa')](),controller[_0x231c('0xb')]);router['get'](_0x231c('0xc'),auth['isAuthenticated'](),controller[_0x231c('0xd')]);router[_0x231c('0x9')](_0x231c('0xe'),auth['isAuthenticated'](),controller[_0x231c('0xf')]);router[_0x231c('0x10')]('/',auth[_0x231c('0xa')](),controller[_0x231c('0x11')]);router[_0x231c('0x12')](_0x231c('0xe'),auth[_0x231c('0xa')](),controller['update']);router[_0x231c('0x13')](_0x231c('0xe'),auth['isAuthenticated'](),controller[_0x231c('0x14')]);module[_0x231c('0x15')]=router; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.attributes.js b/server/api/smsTransferReport/smsTransferReport.attributes.js index 69dfc46..29c7764 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 _0x00bb=['moment','sequelize','exports','ENUM','agent','queue','DATE','NOW'];(function(_0x2da103,_0x2f2460){var _0x62804a=function(_0x46c55e){while(--_0x46c55e){_0x2da103['push'](_0x2da103['shift']());}};_0x62804a(++_0x2f2460);}(_0x00bb,0x1d8));var _0xb00b=function(_0x24237f,_0x4cf32c){_0x24237f=_0x24237f-0x0;var _0x48298e=_0x00bb[_0x24237f];return _0x48298e;};'use strict';var moment=require(_0xb00b('0x0'));var Sequelize=require(_0xb00b('0x1'));module[_0xb00b('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize[_0xb00b('0x3')]('account',_0xb00b('0x4'),_0xb00b('0x5')),'allowNull':![],'defaultValue':'queue'},'transferredAt':{'type':Sequelize[_0xb00b('0x6')],'allowNull':![],'defaultValue':Sequelize[_0xb00b('0x7')]}}; \ No newline at end of file +var _0xa9e0=['account','queue','DATE','NOW','moment','sequelize','exports'];(function(_0x3b510c,_0xabe056){var _0x2e185c=function(_0x27145b){while(--_0x27145b){_0x3b510c['push'](_0x3b510c['shift']());}};_0x2e185c(++_0xabe056);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var moment=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));module[_0x0a9e('0x2')]={'uniqueid':{'type':Sequelize['STRING'],'allowNull':![]},'type':{'type':Sequelize['ENUM'](_0x0a9e('0x3'),'agent',_0x0a9e('0x4')),'allowNull':![],'defaultValue':_0x0a9e('0x4')},'transferredAt':{'type':Sequelize[_0x0a9e('0x5')],'allowNull':![],'defaultValue':Sequelize[_0x0a9e('0x6')]}}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.controller.js b/server/api/smsTransferReport/smsTransferReport.controller.js index 4cced1e..6db723b 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 _0xa9b9=['options','includeAll','include','findAll','catch','show','params','rawAttributes','create','body','find','describe','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','end','sendStatus','stack','name','send','index','map','SmsTransferReport','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','order','sort','where','pick','filter','merge','VIRTUAL'];(function(_0x52585b,_0x33f30){var _0x2b2adb=function(_0x2b0a37){while(--_0x2b0a37){_0x52585b['push'](_0x52585b['shift']());}};_0x2b2adb(++_0x33f30);}(_0xa9b9,0xf6));var _0x9a9b=function(_0x223a00,_0x1f1e9f){_0x223a00=_0x223a00-0x0;var _0x152f91=_0xa9b9[_0x223a00];return _0x152f91;};'use strict';var emlformat=require(_0x9a9b('0x0'));var rimraf=require(_0x9a9b('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x9a9b('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x9a9b('0x3'));var Mustache=require(_0x9a9b('0x4'));var util=require(_0x9a9b('0x5'));var path=require(_0x9a9b('0x6'));var sox=require(_0x9a9b('0x7'));var csv=require(_0x9a9b('0x8'));var ejs=require(_0x9a9b('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x9a9b('0xa'));var squel=require(_0x9a9b('0xb'));var crypto=require(_0x9a9b('0xc'));var jsforce=require(_0x9a9b('0xd'));var deskjs=require('desk.js');var toCsv=require(_0x9a9b('0x8'));var querystring=require(_0x9a9b('0xe'));var Papa=require('papaparse');var Redis=require(_0x9a9b('0xf'));var authService=require('../../components/auth/service');var qs=require(_0x9a9b('0x10'));var as=require(_0x9a9b('0x11'));var hardwareService=require(_0x9a9b('0x12'));var logger=require(_0x9a9b('0x13'))(_0x9a9b('0x14'));var utils=require(_0x9a9b('0x15'));var config=require(_0x9a9b('0x16'));var licenseUtil=require(_0x9a9b('0x17'));var db=require(_0x9a9b('0x18'))['db'];function respondWithStatusCode(_0x435216,_0x27cb89){_0x27cb89=_0x27cb89||0xcc;return function(_0x3e14c2){if(_0x3e14c2){return _0x435216['sendStatus'](_0x27cb89);}return _0x435216[_0x9a9b('0x19')](_0x27cb89)['end']();};}function respondWithResult(_0x390858,_0x148150){_0x148150=_0x148150||0xc8;return function(_0x5e13fd){if(_0x5e13fd){return _0x390858[_0x9a9b('0x19')](_0x148150)[_0x9a9b('0x1a')](_0x5e13fd);}};}function respondWithFilteredResult(_0x465974,_0x18450a){return function(_0x276219){if(_0x276219){var _0x56206f=typeof _0x18450a[_0x9a9b('0x1b')]==='undefined'&&typeof _0x18450a[_0x9a9b('0x1c')]===_0x9a9b('0x1d');var _0x5c9c25=_0x276219[_0x9a9b('0x1e')];var _0x1ed32a=_0x56206f?0x0:_0x18450a[_0x9a9b('0x1b')];var _0x3055cd=_0x56206f?_0x276219['count']:_0x18450a[_0x9a9b('0x1b')]+_0x18450a[_0x9a9b('0x1c')];var _0x1b7b49;if(_0x3055cd>=_0x5c9c25){_0x3055cd=_0x5c9c25;_0x1b7b49=0xc8;}else{_0x1b7b49=0xce;}_0x465974['status'](_0x1b7b49);return _0x465974[_0x9a9b('0x1f')](_0x9a9b('0x20'),_0x1ed32a+'-'+_0x3055cd+'/'+_0x5c9c25)[_0x9a9b('0x1a')](_0x276219);}return null;};}function patchUpdates(_0x31eba1){return function(_0x4aee95){try{jsonpatch[_0x9a9b('0x21')](_0x4aee95,_0x31eba1,!![]);}catch(_0x534a62){return BPromise[_0x9a9b('0x22')](_0x534a62);}return _0x4aee95[_0x9a9b('0x23')]();};}function saveUpdates(_0x38289c,_0x133edb){return function(_0x1387eb){if(_0x1387eb){return _0x1387eb[_0x9a9b('0x24')](_0x38289c)[_0x9a9b('0x25')](function(_0xa17745){return _0xa17745;});}return null;};}function removeEntity(_0x16dc3e,_0x36fb8d){return function(_0xc0498c){if(_0xc0498c){return _0xc0498c[_0x9a9b('0x26')]()[_0x9a9b('0x25')](function(){_0x16dc3e[_0x9a9b('0x19')](0xcc)[_0x9a9b('0x27')]();});}};}function handleEntityNotFound(_0x19b6c3,_0x2cac9c){return function(_0x4fdb88){if(!_0x4fdb88){_0x19b6c3[_0x9a9b('0x28')](0x194);}return _0x4fdb88;};}function handleError(_0x5c6da7,_0x13e208){_0x13e208=_0x13e208||0x1f4;return function(_0x2ab330){logger['error'](_0x2ab330[_0x9a9b('0x29')]);if(_0x2ab330[_0x9a9b('0x2a')]){delete _0x2ab330['name'];}_0x5c6da7[_0x9a9b('0x19')](_0x13e208)[_0x9a9b('0x2b')](_0x2ab330);};}exports[_0x9a9b('0x2c')]=function(_0x872e0a,_0x12226a){var _0x4403a4={},_0x3ead73={},_0x20454e={'count':0x0,'rows':[]};var _0x583a55=_[_0x9a9b('0x2d')](db[_0x9a9b('0x2e')]['rawAttributes'],function(_0x109305){return{'name':_0x109305[_0x9a9b('0x2f')],'type':_0x109305[_0x9a9b('0x30')][_0x9a9b('0x31')]};});_0x3ead73[_0x9a9b('0x32')]=_[_0x9a9b('0x2d')](_0x583a55,_0x9a9b('0x2a'));_0x3ead73[_0x9a9b('0x33')]=_[_0x9a9b('0x34')](_0x872e0a[_0x9a9b('0x33')]);_0x3ead73[_0x9a9b('0x35')]=_[_0x9a9b('0x36')](_0x3ead73[_0x9a9b('0x32')],_0x3ead73[_0x9a9b('0x33')]);_0x4403a4[_0x9a9b('0x37')]=_[_0x9a9b('0x36')](_0x3ead73['model'],qs[_0x9a9b('0x38')](_0x872e0a['query'][_0x9a9b('0x38')]));_0x4403a4[_0x9a9b('0x37')]=_0x4403a4[_0x9a9b('0x37')][_0x9a9b('0x39')]?_0x4403a4['attributes']:_0x3ead73['model'];if(!_0x872e0a[_0x9a9b('0x33')]['hasOwnProperty'](_0x9a9b('0x3a'))){_0x4403a4['limit']=qs[_0x9a9b('0x1c')](_0x872e0a[_0x9a9b('0x33')][_0x9a9b('0x1c')]);_0x4403a4[_0x9a9b('0x1b')]=qs[_0x9a9b('0x1b')](_0x872e0a[_0x9a9b('0x33')][_0x9a9b('0x1b')]);}_0x4403a4[_0x9a9b('0x3b')]=qs[_0x9a9b('0x3c')](_0x872e0a['query'][_0x9a9b('0x3c')]);_0x4403a4[_0x9a9b('0x3d')]=qs[_0x9a9b('0x35')](_[_0x9a9b('0x3e')](_0x872e0a[_0x9a9b('0x33')],_0x3ead73['filters']),_0x583a55);if(_0x872e0a['query'][_0x9a9b('0x3f')]){_0x4403a4[_0x9a9b('0x3d')]=_[_0x9a9b('0x40')](_0x4403a4[_0x9a9b('0x3d')],{'$or':_[_0x9a9b('0x2d')](_0x583a55,function(_0x36634b){if(_0x36634b[_0x9a9b('0x30')]!==_0x9a9b('0x41')){var _0x523c2c={};_0x523c2c[_0x36634b[_0x9a9b('0x2a')]]={'$like':'%'+_0x872e0a[_0x9a9b('0x33')][_0x9a9b('0x3f')]+'%'};return _0x523c2c;}})});}_0x4403a4=_['merge']({},_0x4403a4,_0x872e0a[_0x9a9b('0x42')]);var _0x503fb6={'where':_0x4403a4[_0x9a9b('0x3d')]};return db[_0x9a9b('0x2e')][_0x9a9b('0x1e')](_0x503fb6)[_0x9a9b('0x25')](function(_0x3aa900){_0x20454e[_0x9a9b('0x1e')]=_0x3aa900;if(_0x872e0a[_0x9a9b('0x33')][_0x9a9b('0x43')]){_0x4403a4[_0x9a9b('0x44')]=[{'all':!![]}];}return db[_0x9a9b('0x2e')][_0x9a9b('0x45')](_0x4403a4);})['then'](function(_0x4d9531){_0x20454e['rows']=_0x4d9531;return _0x20454e;})[_0x9a9b('0x25')](respondWithFilteredResult(_0x12226a,_0x4403a4))[_0x9a9b('0x46')](handleError(_0x12226a,null));};exports[_0x9a9b('0x47')]=function(_0x2e96d9,_0x4d8fee){var _0x3e6722={'raw':!![],'where':{'id':_0x2e96d9[_0x9a9b('0x48')]['id']}},_0x34373a={};_0x34373a[_0x9a9b('0x32')]=_['keys'](db[_0x9a9b('0x2e')][_0x9a9b('0x49')]);_0x34373a[_0x9a9b('0x33')]=_['keys'](_0x2e96d9[_0x9a9b('0x33')]);_0x34373a[_0x9a9b('0x35')]=_['intersection'](_0x34373a['model'],_0x34373a[_0x9a9b('0x33')]);_0x3e6722[_0x9a9b('0x37')]=_[_0x9a9b('0x36')](_0x34373a[_0x9a9b('0x32')],qs[_0x9a9b('0x38')](_0x2e96d9[_0x9a9b('0x33')][_0x9a9b('0x38')]));_0x3e6722[_0x9a9b('0x37')]=_0x3e6722['attributes']['length']?_0x3e6722[_0x9a9b('0x37')]:_0x34373a['model'];if(_0x2e96d9[_0x9a9b('0x33')][_0x9a9b('0x43')]){_0x3e6722[_0x9a9b('0x44')]=[{'all':!![]}];}_0x3e6722=_[_0x9a9b('0x40')]({},_0x3e6722,_0x2e96d9[_0x9a9b('0x42')]);return db[_0x9a9b('0x2e')]['find'](_0x3e6722)[_0x9a9b('0x25')](handleEntityNotFound(_0x4d8fee,null))[_0x9a9b('0x25')](respondWithResult(_0x4d8fee,null))[_0x9a9b('0x46')](handleError(_0x4d8fee,null));};exports[_0x9a9b('0x4a')]=function(_0x43c316,_0x221457){return db['SmsTransferReport']['create'](_0x43c316[_0x9a9b('0x4b')],{})[_0x9a9b('0x25')](respondWithResult(_0x221457,0xc9))[_0x9a9b('0x46')](handleError(_0x221457,null));};exports[_0x9a9b('0x24')]=function(_0x2f88f8,_0x2be28a){if(_0x2f88f8[_0x9a9b('0x4b')]['id']){delete _0x2f88f8[_0x9a9b('0x4b')]['id'];}return db[_0x9a9b('0x2e')][_0x9a9b('0x4c')]({'where':{'id':_0x2f88f8[_0x9a9b('0x48')]['id']}})[_0x9a9b('0x25')](handleEntityNotFound(_0x2be28a,null))['then'](saveUpdates(_0x2f88f8[_0x9a9b('0x4b')],null))[_0x9a9b('0x25')](respondWithResult(_0x2be28a,null))[_0x9a9b('0x46')](handleError(_0x2be28a,null));};exports[_0x9a9b('0x26')]=function(_0x24ec95,_0x463061){return db[_0x9a9b('0x2e')]['find']({'where':{'id':_0x24ec95['params']['id']}})[_0x9a9b('0x25')](handleEntityNotFound(_0x463061,null))[_0x9a9b('0x25')](removeEntity(_0x463061,null))[_0x9a9b('0x46')](handleError(_0x463061,null));};exports[_0x9a9b('0x4d')]=function(_0x3cc25d,_0x30fd4c){return db[_0x9a9b('0x2e')][_0x9a9b('0x4d')]()[_0x9a9b('0x25')](respondWithResult(_0x30fd4c,null))[_0x9a9b('0x46')](handleError(_0x30fd4c,null));}; \ No newline at end of file +var _0x91a1=['index','map','rawAttributes','fieldName','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','merge','type','VIRTUAL','filter','options','SmsTransferReport','includeAll','include','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','apply','save','update','destroy','then','error','stack','name'];(function(_0x5c0837,_0x25907f){var _0x567836=function(_0x333262){while(--_0x333262){_0x5c0837['push'](_0x5c0837['shift']());}};_0x567836(++_0x25907f);}(_0x91a1,0x151));var _0x191a=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x91a1[_0x14add3];return _0x4a174f;};'use strict';var emlformat=require(_0x191a('0x0'));var rimraf=require(_0x191a('0x1'));var zipdir=require(_0x191a('0x2'));var jsonpatch=require(_0x191a('0x3'));var rp=require(_0x191a('0x4'));var moment=require(_0x191a('0x5'));var BPromise=require(_0x191a('0x6'));var Mustache=require(_0x191a('0x7'));var util=require(_0x191a('0x8'));var path=require(_0x191a('0x9'));var sox=require(_0x191a('0xa'));var csv=require(_0x191a('0xb'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x191a('0xc'));var _=require(_0x191a('0xd'));var squel=require('squel');var crypto=require(_0x191a('0xe'));var jsforce=require(_0x191a('0xf'));var deskjs=require(_0x191a('0x10'));var toCsv=require(_0x191a('0xb'));var querystring=require(_0x191a('0x11'));var Papa=require('papaparse');var Redis=require(_0x191a('0x12'));var authService=require(_0x191a('0x13'));var qs=require(_0x191a('0x14'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x191a('0x15'));var logger=require(_0x191a('0x16'))(_0x191a('0x17'));var utils=require('../../config/utils');var config=require(_0x191a('0x18'));var licenseUtil=require(_0x191a('0x19'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x9a65b0,_0x414e39){_0x414e39=_0x414e39||0xcc;return function(_0x2df5b2){if(_0x2df5b2){return _0x9a65b0[_0x191a('0x1a')](_0x414e39);}return _0x9a65b0[_0x191a('0x1b')](_0x414e39)[_0x191a('0x1c')]();};}function respondWithResult(_0x5eb495,_0x24a57a){_0x24a57a=_0x24a57a||0xc8;return function(_0xa73eac){if(_0xa73eac){return _0x5eb495['status'](_0x24a57a)[_0x191a('0x1d')](_0xa73eac);}};}function respondWithFilteredResult(_0x176a8f,_0x2fc2ed){return function(_0xab783b){if(_0xab783b){var _0x5ad4e3=typeof _0x2fc2ed[_0x191a('0x1e')]===_0x191a('0x1f')&&typeof _0x2fc2ed[_0x191a('0x20')]==='undefined';var _0xba4c87=_0xab783b[_0x191a('0x21')];var _0x147d5b=_0x5ad4e3?0x0:_0x2fc2ed[_0x191a('0x1e')];var _0x421dbd=_0x5ad4e3?_0xab783b['count']:_0x2fc2ed[_0x191a('0x1e')]+_0x2fc2ed[_0x191a('0x20')];var _0x3eb233;if(_0x421dbd>=_0xba4c87){_0x421dbd=_0xba4c87;_0x3eb233=0xc8;}else{_0x3eb233=0xce;}_0x176a8f['status'](_0x3eb233);return _0x176a8f['set'](_0x191a('0x22'),_0x147d5b+'-'+_0x421dbd+'/'+_0xba4c87)['json'](_0xab783b);}return null;};}function patchUpdates(_0x594541){return function(_0x108c36){try{jsonpatch[_0x191a('0x23')](_0x108c36,_0x594541,!![]);}catch(_0x421905){return BPromise['reject'](_0x421905);}return _0x108c36[_0x191a('0x24')]();};}function saveUpdates(_0x3cc089,_0x474e34){return function(_0x27ab95){if(_0x27ab95){return _0x27ab95[_0x191a('0x25')](_0x3cc089)['then'](function(_0x3377a7){return _0x3377a7;});}return null;};}function removeEntity(_0x1d8ed5,_0x2d2aa7){return function(_0x4030ab){if(_0x4030ab){return _0x4030ab[_0x191a('0x26')]()[_0x191a('0x27')](function(){_0x1d8ed5['status'](0xcc)[_0x191a('0x1c')]();});}};}function handleEntityNotFound(_0x5f0a67,_0x2b9491){return function(_0x24737d){if(!_0x24737d){_0x5f0a67[_0x191a('0x1a')](0x194);}return _0x24737d;};}function handleError(_0x443a66,_0x5c14e2){_0x5c14e2=_0x5c14e2||0x1f4;return function(_0x44cba9){logger[_0x191a('0x28')](_0x44cba9[_0x191a('0x29')]);if(_0x44cba9[_0x191a('0x2a')]){delete _0x44cba9[_0x191a('0x2a')];}_0x443a66['status'](_0x5c14e2)['send'](_0x44cba9);};}exports[_0x191a('0x2b')]=function(_0x3963bb,_0x353e44){var _0x4bbad9={},_0x194060={},_0x2c71f2={'count':0x0,'rows':[]};var _0x1ff535=_[_0x191a('0x2c')](db['SmsTransferReport'][_0x191a('0x2d')],function(_0x3c22eb){return{'name':_0x3c22eb[_0x191a('0x2e')],'type':_0x3c22eb['type']['key']};});_0x194060['model']=_[_0x191a('0x2c')](_0x1ff535,_0x191a('0x2a'));_0x194060[_0x191a('0x2f')]=_[_0x191a('0x30')](_0x3963bb[_0x191a('0x2f')]);_0x194060[_0x191a('0x31')]=_[_0x191a('0x32')](_0x194060[_0x191a('0x33')],_0x194060[_0x191a('0x2f')]);_0x4bbad9[_0x191a('0x34')]=_['intersection'](_0x194060['model'],qs[_0x191a('0x35')](_0x3963bb['query'][_0x191a('0x35')]));_0x4bbad9[_0x191a('0x34')]=_0x4bbad9[_0x191a('0x34')][_0x191a('0x36')]?_0x4bbad9[_0x191a('0x34')]:_0x194060['model'];if(!_0x3963bb['query'][_0x191a('0x37')]('nolimit')){_0x4bbad9[_0x191a('0x20')]=qs['limit'](_0x3963bb[_0x191a('0x2f')][_0x191a('0x20')]);_0x4bbad9[_0x191a('0x1e')]=qs['offset'](_0x3963bb[_0x191a('0x2f')][_0x191a('0x1e')]);}_0x4bbad9[_0x191a('0x38')]=qs[_0x191a('0x39')](_0x3963bb[_0x191a('0x2f')][_0x191a('0x39')]);_0x4bbad9[_0x191a('0x3a')]=qs['filters'](_[_0x191a('0x3b')](_0x3963bb[_0x191a('0x2f')],_0x194060[_0x191a('0x31')]),_0x1ff535);if(_0x3963bb[_0x191a('0x2f')]['filter']){_0x4bbad9['where']=_[_0x191a('0x3c')](_0x4bbad9['where'],{'$or':_[_0x191a('0x2c')](_0x1ff535,function(_0x5a467f){if(_0x5a467f[_0x191a('0x3d')]!==_0x191a('0x3e')){var _0x48563={};_0x48563[_0x5a467f[_0x191a('0x2a')]]={'$like':'%'+_0x3963bb[_0x191a('0x2f')][_0x191a('0x3f')]+'%'};return _0x48563;}})});}_0x4bbad9=_['merge']({},_0x4bbad9,_0x3963bb[_0x191a('0x40')]);var _0x156576={'where':_0x4bbad9[_0x191a('0x3a')]};return db[_0x191a('0x41')]['count'](_0x156576)[_0x191a('0x27')](function(_0xd8643e){_0x2c71f2[_0x191a('0x21')]=_0xd8643e;if(_0x3963bb['query'][_0x191a('0x42')]){_0x4bbad9[_0x191a('0x43')]=[{'all':!![]}];}return db[_0x191a('0x41')]['findAll'](_0x4bbad9);})[_0x191a('0x27')](function(_0x599c6b){_0x2c71f2[_0x191a('0x44')]=_0x599c6b;return _0x2c71f2;})[_0x191a('0x27')](respondWithFilteredResult(_0x353e44,_0x4bbad9))[_0x191a('0x45')](handleError(_0x353e44,null));};exports[_0x191a('0x46')]=function(_0x210eb1,_0xe7a538){var _0x1ef482={'raw':!![],'where':{'id':_0x210eb1[_0x191a('0x47')]['id']}},_0x37cf46={};_0x37cf46['model']=_[_0x191a('0x30')](db[_0x191a('0x41')]['rawAttributes']);_0x37cf46[_0x191a('0x2f')]=_[_0x191a('0x30')](_0x210eb1['query']);_0x37cf46[_0x191a('0x31')]=_[_0x191a('0x32')](_0x37cf46[_0x191a('0x33')],_0x37cf46[_0x191a('0x2f')]);_0x1ef482[_0x191a('0x34')]=_[_0x191a('0x32')](_0x37cf46['model'],qs[_0x191a('0x35')](_0x210eb1[_0x191a('0x2f')]['fields']));_0x1ef482[_0x191a('0x34')]=_0x1ef482[_0x191a('0x34')]['length']?_0x1ef482['attributes']:_0x37cf46[_0x191a('0x33')];if(_0x210eb1[_0x191a('0x2f')][_0x191a('0x42')]){_0x1ef482[_0x191a('0x43')]=[{'all':!![]}];}_0x1ef482=_[_0x191a('0x3c')]({},_0x1ef482,_0x210eb1[_0x191a('0x40')]);return db['SmsTransferReport'][_0x191a('0x48')](_0x1ef482)[_0x191a('0x27')](handleEntityNotFound(_0xe7a538,null))[_0x191a('0x27')](respondWithResult(_0xe7a538,null))[_0x191a('0x45')](handleError(_0xe7a538,null));};exports['create']=function(_0x576a3d,_0x5d10e4){return db[_0x191a('0x41')][_0x191a('0x49')](_0x576a3d[_0x191a('0x4a')],{})[_0x191a('0x27')](respondWithResult(_0x5d10e4,0xc9))[_0x191a('0x45')](handleError(_0x5d10e4,null));};exports[_0x191a('0x25')]=function(_0x219e91,_0x4cae6c){if(_0x219e91[_0x191a('0x4a')]['id']){delete _0x219e91['body']['id'];}return db[_0x191a('0x41')][_0x191a('0x48')]({'where':{'id':_0x219e91[_0x191a('0x47')]['id']}})[_0x191a('0x27')](handleEntityNotFound(_0x4cae6c,null))[_0x191a('0x27')](saveUpdates(_0x219e91[_0x191a('0x4a')],null))[_0x191a('0x27')](respondWithResult(_0x4cae6c,null))[_0x191a('0x45')](handleError(_0x4cae6c,null));};exports['destroy']=function(_0x4ba682,_0x45ecb9){return db[_0x191a('0x41')][_0x191a('0x48')]({'where':{'id':_0x4ba682[_0x191a('0x47')]['id']}})[_0x191a('0x27')](handleEntityNotFound(_0x45ecb9,null))[_0x191a('0x27')](removeEntity(_0x45ecb9,null))[_0x191a('0x45')](handleError(_0x45ecb9,null));};exports[_0x191a('0x4b')]=function(_0x5ecf63,_0x493491){return db[_0x191a('0x41')][_0x191a('0x4b')]()[_0x191a('0x27')](respondWithResult(_0x493491,null))[_0x191a('0x45')](handleError(_0x493491,null));}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.model.js b/server/api/smsTransferReport/smsTransferReport.model.js index 27d85fe..f532da6 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 _0xc737=['util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','SmsTransferReport','lodash'];(function(_0x264119,_0x257b3d){var _0x35fb4c=function(_0x2588b3){while(--_0x2588b3){_0x264119['push'](_0x264119['shift']());}};_0x35fb4c(++_0x257b3d);}(_0xc737,0x8e));var _0x7c73=function(_0x3f51cd,_0x190943){_0x3f51cd=_0x3f51cd-0x0;var _0x5152f6=_0xc737[_0x3f51cd];return _0x5152f6;};'use strict';var _=require(_0x7c73('0x0'));var util=require(_0x7c73('0x1'));var logger=require('../../config/logger')(_0x7c73('0x2'));var moment=require(_0x7c73('0x3'));var BPromise=require(_0x7c73('0x4'));var rp=require(_0x7c73('0x5'));var fs=require('fs');var path=require(_0x7c73('0x6'));var rimraf=require(_0x7c73('0x7'));var config=require(_0x7c73('0x8'));var attributes=require('./smsTransferReport.attributes');module['exports']=function(_0x1eb29f,_0x2f09f7){return _0x1eb29f[_0x7c73('0x9')](_0x7c73('0xa'),attributes,{'tableName':'report_sms_transfer','paranoid':![],'indexes':[{'name':'uniqueid','fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x746f=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./smsTransferReport.attributes','exports','define','SmsTransferReport','report_sms_transfer','uniqueid','lodash','util','../../config/logger','api'];(function(_0x4eafed,_0x26e2bc){var _0x159c85=function(_0x6f129f){while(--_0x6f129f){_0x4eafed['push'](_0x4eafed['shift']());}};_0x159c85(++_0x26e2bc);}(_0x746f,0x9c));var _0xf746=function(_0x4aec51,_0x35559e){_0x4aec51=_0x4aec51-0x0;var _0x1ee7c1=_0x746f[_0x4aec51];return _0x1ee7c1;};'use strict';var _=require(_0xf746('0x0'));var util=require(_0xf746('0x1'));var logger=require(_0xf746('0x2'))(_0xf746('0x3'));var moment=require(_0xf746('0x4'));var BPromise=require(_0xf746('0x5'));var rp=require(_0xf746('0x6'));var fs=require('fs');var path=require(_0xf746('0x7'));var rimraf=require(_0xf746('0x8'));var config=require(_0xf746('0x9'));var attributes=require(_0xf746('0xa'));module[_0xf746('0xb')]=function(_0x19d855,_0x2f0f3c){return _0x19d855[_0xf746('0xc')](_0xf746('0xd'),attributes,{'tableName':_0xf746('0xe'),'paranoid':![],'indexes':[{'name':_0xf746('0xf'),'fields':[_0xf746('0xf')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/smsTransferReport/smsTransferReport.rpc.js b/server/api/smsTransferReport/smsTransferReport.rpc.js index bf4b30a..603ab03 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 _0x89fe=['stringify','error','code','message','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s'];(function(_0x12f688,_0x585c25){var _0x59c3de=function(_0x4ac301){while(--_0x4ac301){_0x12f688['push'](_0x12f688['shift']());}};_0x59c3de(++_0x585c25);}(_0x89fe,0x83));var _0xe89f=function(_0x469df1,_0x17f245){_0x469df1=_0x469df1-0x0;var _0x574b74=_0x89fe[_0x469df1];return _0x574b74;};'use strict';var _=require(_0xe89f('0x0'));var util=require(_0xe89f('0x1'));var moment=require(_0xe89f('0x2'));var BPromise=require(_0xe89f('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe89f('0x4'));var db=require(_0xe89f('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe89f('0x6'))(_0xe89f('0x7'));var config=require(_0xe89f('0x8'));var jayson=require(_0xe89f('0x9'));var client=jayson[_0xe89f('0xa')][_0xe89f('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x24358f,_0x5427d2,_0x4639f0){return new BPromise(function(_0x3e9998,_0x7043f3){return client[_0xe89f('0xc')](_0x24358f,_0x4639f0)[_0xe89f('0xd')](function(_0x4fa2fa){logger[_0xe89f('0xe')](_0xe89f('0xf'),_0x5427d2,_0xe89f('0x10'));logger[_0xe89f('0x11')](_0xe89f('0x12'),_0x5427d2,_0xe89f('0x10'),JSON[_0xe89f('0x13')](_0x4fa2fa));if(_0x4fa2fa[_0xe89f('0x14')]){if(_0x4fa2fa[_0xe89f('0x14')][_0xe89f('0x15')]===0x1f4){logger['error']('SmsTransferReport,\x20%s,\x20%s',_0x5427d2,_0x4fa2fa['error']['message']);return _0x7043f3(_0x4fa2fa['error'][_0xe89f('0x16')]);}logger[_0xe89f('0x14')]('SmsTransferReport,\x20%s,\x20%s',_0x5427d2,_0x4fa2fa['error'][_0xe89f('0x16')]);return _0x3e9998(_0x4fa2fa[_0xe89f('0x14')][_0xe89f('0x16')]);}else{logger[_0xe89f('0xe')](_0xe89f('0xf'),_0x5427d2,_0xe89f('0x10'));_0x3e9998(_0x4fa2fa[_0xe89f('0x17')][_0xe89f('0x16')]);}})[_0xe89f('0x18')](function(_0x16bfe0){logger['error'](_0xe89f('0xf'),_0x5427d2,_0x16bfe0);_0x7043f3(_0x16bfe0);});});} \ No newline at end of file +var _0x432b=['http','request','info','SmsTransferReport,\x20%s,\x20%s','request\x20sent','debug','SmsTransferReport,\x20%s,\x20%s,\x20%s','error','message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/logger','../../config/environment','client'];(function(_0x91ff52,_0x2cde3c){var _0x37d193=function(_0x5cb450){while(--_0x5cb450){_0x91ff52['push'](_0x91ff52['shift']());}};_0x37d193(++_0x2cde3c);}(_0x432b,0x161));var _0xb432=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x432b[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xb432('0x0'));var util=require('util');var moment=require(_0xb432('0x1'));var BPromise=require(_0xb432('0x2'));var rs=require(_0xb432('0x3'));var fs=require('fs');var Redis=require(_0xb432('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xb432('0x5'))('rpc');var config=require(_0xb432('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xb432('0x7')][_0xb432('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x274447,_0x45f857,_0x14fed4){return new BPromise(function(_0x6833df,_0x198b71){return client[_0xb432('0x9')](_0x274447,_0x14fed4)['then'](function(_0x12adbe){logger[_0xb432('0xa')](_0xb432('0xb'),_0x45f857,_0xb432('0xc'));logger[_0xb432('0xd')](_0xb432('0xe'),_0x45f857,'request\x20sent',JSON['stringify'](_0x12adbe));if(_0x12adbe[_0xb432('0xf')]){if(_0x12adbe[_0xb432('0xf')]['code']===0x1f4){logger[_0xb432('0xf')](_0xb432('0xb'),_0x45f857,_0x12adbe[_0xb432('0xf')]['message']);return _0x198b71(_0x12adbe[_0xb432('0xf')][_0xb432('0x10')]);}logger['error'](_0xb432('0xb'),_0x45f857,_0x12adbe[_0xb432('0xf')][_0xb432('0x10')]);return _0x6833df(_0x12adbe[_0xb432('0xf')][_0xb432('0x10')]);}else{logger['info']('SmsTransferReport,\x20%s,\x20%s',_0x45f857,_0xb432('0xc'));_0x6833df(_0x12adbe[_0xb432('0x11')][_0xb432('0x10')]);}})[_0xb432('0x12')](function(_0x27365c){logger[_0xb432('0xf')](_0xb432('0xb'),_0x45f857,_0x27365c);_0x198b71(_0x27365c);});});} \ No newline at end of file diff --git a/server/api/sound/index.js b/server/api/sound/index.js index f0db666..bb7dc57 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 _0x9a6b=['util','path','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','/:id','/:id/download','download','diskStorage','join','root','server/files/sounds/original/','originalname','replace','basename','now','extname','single','file','put','update','delete','exports','multer'];(function(_0xcbf2ba,_0x42829d){var _0x4e3371=function(_0x180e44){while(--_0x180e44){_0xcbf2ba['push'](_0xcbf2ba['shift']());}};_0x4e3371(++_0x42829d);}(_0x9a6b,0x14f));var _0xb9a6=function(_0xaa1cd2,_0x4d3de3){_0xaa1cd2=_0xaa1cd2-0x0;var _0x4bdd82=_0x9a6b[_0xaa1cd2];return _0x4bdd82;};'use strict';var multer=require(_0xb9a6('0x0'));var util=require(_0xb9a6('0x1'));var path=require(_0xb9a6('0x2'));var timeout=require(_0xb9a6('0x3'));var express=require(_0xb9a6('0x4'));var router=express['Router']();var fs_extra=require(_0xb9a6('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xb9a6('0x6'));var config=require(_0xb9a6('0x7'));var controller=require('./sound.controller');router[_0xb9a6('0x8')]('/',auth[_0xb9a6('0x9')](),controller['index']);router[_0xb9a6('0x8')](_0xb9a6('0xa'),auth[_0xb9a6('0x9')](),controller['show']);router[_0xb9a6('0x8')](_0xb9a6('0xb'),auth[_0xb9a6('0x9')](),controller[_0xb9a6('0xc')]);var upload=multer({'storage':multer[_0xb9a6('0xd')]({'destination':function(_0xe4bfdf,_0x38cf9b,_0x28a33e){_0x28a33e(null,path[_0xb9a6('0xe')](config[_0xb9a6('0xf')],_0xb9a6('0x10')));},'filename':function(_0x54e014,_0x3907df,_0x4d011e){_0x3907df[_0xb9a6('0x11')]=_0x3907df[_0xb9a6('0x11')][_0xb9a6('0x12')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x4d011e(null,util['format']('%s-%s%s',path[_0xb9a6('0x13')](_0x3907df['originalname'],path['extname'](_0x3907df[_0xb9a6('0x11')])),Date[_0xb9a6('0x14')](),path[_0xb9a6('0x15')](_0x3907df[_0xb9a6('0x11')])));}})});router['post']('/',upload[_0xb9a6('0x16')](_0xb9a6('0x17')),controller['create']);router[_0xb9a6('0x18')](_0xb9a6('0xa'),auth[_0xb9a6('0x9')](),controller[_0xb9a6('0x19')]);router[_0xb9a6('0x1a')](_0xb9a6('0xa'),auth[_0xb9a6('0x9')](),controller['delete']);module[_0xb9a6('0x1b')]=router; \ No newline at end of file +var _0xeb24=['/:id/download','diskStorage','join','root','originalname','replace','format','%s-%s%s','basename','extname','now','post','single','file','put','delete','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./sound.controller','get','isAuthenticated','index','/:id','show'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0xeb24,0x151));var _0x4eb2=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0xeb24[_0xfae23b];return _0x200640;};'use strict';var multer=require(_0x4eb2('0x0'));var util=require(_0x4eb2('0x1'));var path=require(_0x4eb2('0x2'));var timeout=require('connect-timeout');var express=require(_0x4eb2('0x3'));var router=express[_0x4eb2('0x4')]();var fs_extra=require(_0x4eb2('0x5'));var auth=require(_0x4eb2('0x6'));var interaction=require(_0x4eb2('0x7'));var config=require(_0x4eb2('0x8'));var controller=require(_0x4eb2('0x9'));router[_0x4eb2('0xa')]('/',auth[_0x4eb2('0xb')](),controller[_0x4eb2('0xc')]);router[_0x4eb2('0xa')](_0x4eb2('0xd'),auth[_0x4eb2('0xb')](),controller[_0x4eb2('0xe')]);router[_0x4eb2('0xa')](_0x4eb2('0xf'),auth[_0x4eb2('0xb')](),controller['download']);var upload=multer({'storage':multer[_0x4eb2('0x10')]({'destination':function(_0x2054e6,_0x5f4c75,_0x57b692){_0x57b692(null,path[_0x4eb2('0x11')](config[_0x4eb2('0x12')],'server/files/sounds/original/'));},'filename':function(_0xe05125,_0x491433,_0x5448bd){_0x491433['originalname']=_0x491433[_0x4eb2('0x13')][_0x4eb2('0x14')](/[+@&\/\\#,+()$~%'":*?<>{}\s\\|]/g,'-');_0x5448bd(null,util[_0x4eb2('0x15')](_0x4eb2('0x16'),path[_0x4eb2('0x17')](_0x491433['originalname'],path[_0x4eb2('0x18')](_0x491433[_0x4eb2('0x13')])),Date[_0x4eb2('0x19')](),path[_0x4eb2('0x18')](_0x491433[_0x4eb2('0x13')])));}})});router[_0x4eb2('0x1a')]('/',upload[_0x4eb2('0x1b')](_0x4eb2('0x1c')),controller['create']);router[_0x4eb2('0x1d')]('/:id',auth[_0x4eb2('0xb')](),controller['update']);router[_0x4eb2('0x1e')](_0x4eb2('0xd'),auth[_0x4eb2('0xb')](),controller[_0x4eb2('0x1e')]);module[_0x4eb2('0x1f')]=router; \ No newline at end of file diff --git a/server/api/sound/sound.attributes.js b/server/api/sound/sound.attributes.js index 32bc8aa..97f0d10 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 _0x0807=['exports','STRING','FLOAT','INTEGER','BIGINT'];(function(_0x3f6043,_0x406f5e){var _0x199858=function(_0x3b46d5){while(--_0x3b46d5){_0x3f6043['push'](_0x3f6043['shift']());}};_0x199858(++_0x406f5e);}(_0x0807,0x13b));var _0x7080=function(_0x2549ca,_0xef2675){_0x2549ca=_0x2549ca-0x0;var _0x50dc32=_0x0807[_0x2549ca];return _0x50dc32;};'use strict';var Sequelize=require('sequelize');module[_0x7080('0x0')]={'name':{'type':Sequelize['STRING'],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x7080('0x1')]},'display_name':{'type':Sequelize['STRING'],'defaultValue':''},'description':{'type':Sequelize['STRING']},'original_format':{'type':Sequelize[_0x7080('0x1')]},'original_duration':{'type':Sequelize[_0x7080('0x2')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize[_0x7080('0x3')]},'original_bitRate':{'type':Sequelize[_0x7080('0x4')]},'original_sampleRate':{'type':Sequelize['INTEGER']},'converted_format':{'type':Sequelize[_0x7080('0x1')]},'converted_duration':{'type':Sequelize[_0x7080('0x2')]},'converted_sampleCount':{'type':Sequelize[_0x7080('0x4')]},'converted_channelCount':{'type':Sequelize[_0x7080('0x3')]},'converted_bitRate':{'type':Sequelize[_0x7080('0x4')]},'converted_sampleRate':{'type':Sequelize[_0x7080('0x3')]}}; \ No newline at end of file +var _0x3c16=['FLOAT','INTEGER','BIGINT','sequelize','exports','STRING'];(function(_0x1ea729,_0x3552bb){var _0x3576c4=function(_0xb12275){while(--_0xb12275){_0x1ea729['push'](_0x1ea729['shift']());}};_0x3576c4(++_0x3552bb);}(_0x3c16,0x1dd));var _0x63c1=function(_0x2d0af8,_0x12728e){_0x2d0af8=_0x2d0af8-0x0;var _0x1ff6fd=_0x3c16[_0x2d0af8];return _0x1ff6fd;};'use strict';var Sequelize=require(_0x63c1('0x0'));module[_0x63c1('0x1')]={'name':{'type':Sequelize[_0x63c1('0x2')],'unique':'name','allowNull':![]},'save_name':{'type':Sequelize[_0x63c1('0x2')]},'display_name':{'type':Sequelize[_0x63c1('0x2')],'defaultValue':''},'description':{'type':Sequelize[_0x63c1('0x2')]},'original_format':{'type':Sequelize[_0x63c1('0x2')]},'original_duration':{'type':Sequelize[_0x63c1('0x3')]},'original_sampleCount':{'type':Sequelize['BIGINT']},'original_channelCount':{'type':Sequelize['INTEGER']},'original_bitRate':{'type':Sequelize['BIGINT']},'original_sampleRate':{'type':Sequelize[_0x63c1('0x4')]},'converted_format':{'type':Sequelize[_0x63c1('0x2')]},'converted_duration':{'type':Sequelize['FLOAT']},'converted_sampleCount':{'type':Sequelize[_0x63c1('0x5')]},'converted_channelCount':{'type':Sequelize['INTEGER']},'converted_bitRate':{'type':Sequelize[_0x63c1('0x5')]},'converted_sampleRate':{'type':Sequelize[_0x63c1('0x4')]}}; \ No newline at end of file diff --git a/server/api/sound/sound.controller.js b/server/api/sound/sound.controller.js index db3bf50..ad67357 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 _0xb8d9=['api','../../config/utils','../../config/environment','status','end','json','offset','limit','undefined','count','set','Content-Range','reject','update','destroy','then','get','Sounds','UserProfileResource','sendStatus','error','stack','name','send','index','map','rawAttributes','fieldName','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','Sound','include','findAll','rows','catch','show','params','includeAll','find','download','save_name','converted_format','existsSync','Sequelize','ValidationError','Sound\x20not\x20found','join','root','format','create','file','originalname','extname','basename','filename','substring','wav','%s.%s','info','Sound\x20upload\x20filepath:\x20%s','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','user','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','pick','description','server/files/sounds/original','original_format','server/files/sounds/converted','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger'];(function(_0x314079,_0x2b98a0){var _0x423351=function(_0x501dcc){while(--_0x501dcc){_0x314079['push'](_0x314079['shift']());}};_0x423351(++_0x2b98a0);}(_0xb8d9,0xed));var _0x9b8d=function(_0x523b19,_0x3a23f8){_0x523b19=_0x523b19-0x0;var _0x29e1af=_0xb8d9[_0x523b19];return _0x29e1af;};'use strict';var emlformat=require(_0x9b8d('0x0'));var rimraf=require(_0x9b8d('0x1'));var zipdir=require(_0x9b8d('0x2'));var jsonpatch=require(_0x9b8d('0x3'));var rp=require(_0x9b8d('0x4'));var moment=require(_0x9b8d('0x5'));var BPromise=require(_0x9b8d('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x9b8d('0x7'));var sox=require(_0x9b8d('0x8'));var csv=require(_0x9b8d('0x9'));var ejs=require(_0x9b8d('0xa'));var fs=require('fs');var fs_extra=require(_0x9b8d('0xb'));var _=require(_0x9b8d('0xc'));var squel=require(_0x9b8d('0xd'));var crypto=require('crypto');var jsforce=require(_0x9b8d('0xe'));var deskjs=require(_0x9b8d('0xf'));var toCsv=require(_0x9b8d('0x9'));var querystring=require('querystring');var Papa=require(_0x9b8d('0x10'));var Redis=require(_0x9b8d('0x11'));var authService=require(_0x9b8d('0x12'));var qs=require(_0x9b8d('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x9b8d('0x14'))(_0x9b8d('0x15'));var utils=require(_0x9b8d('0x16'));var config=require(_0x9b8d('0x17'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0xb29b8a,_0x280ed6){_0x280ed6=_0x280ed6||0xcc;return function(_0x80e82f){if(_0x80e82f){return _0xb29b8a['sendStatus'](_0x280ed6);}return _0xb29b8a[_0x9b8d('0x18')](_0x280ed6)[_0x9b8d('0x19')]();};}function respondWithResult(_0x191cf5,_0x2dc0c4){_0x2dc0c4=_0x2dc0c4||0xc8;return function(_0x2865c2){if(_0x2865c2){return _0x191cf5[_0x9b8d('0x18')](_0x2dc0c4)[_0x9b8d('0x1a')](_0x2865c2);}};}function respondWithFilteredResult(_0x1f34a2,_0x492e16){return function(_0x1d2138){if(_0x1d2138){var _0x5de223=typeof _0x492e16[_0x9b8d('0x1b')]==='undefined'&&typeof _0x492e16[_0x9b8d('0x1c')]===_0x9b8d('0x1d');var _0x4c2aa8=_0x1d2138[_0x9b8d('0x1e')];var _0x144a34=_0x5de223?0x0:_0x492e16[_0x9b8d('0x1b')];var _0x1fcdac=_0x5de223?_0x1d2138[_0x9b8d('0x1e')]:_0x492e16['offset']+_0x492e16[_0x9b8d('0x1c')];var _0x389aad;if(_0x1fcdac>=_0x4c2aa8){_0x1fcdac=_0x4c2aa8;_0x389aad=0xc8;}else{_0x389aad=0xce;}_0x1f34a2[_0x9b8d('0x18')](_0x389aad);return _0x1f34a2[_0x9b8d('0x1f')](_0x9b8d('0x20'),_0x144a34+'-'+_0x1fcdac+'/'+_0x4c2aa8)[_0x9b8d('0x1a')](_0x1d2138);}return null;};}function patchUpdates(_0x3e9925){return function(_0x481eb6){try{jsonpatch['apply'](_0x481eb6,_0x3e9925,!![]);}catch(_0x392c67){return BPromise[_0x9b8d('0x21')](_0x392c67);}return _0x481eb6['save']();};}function saveUpdates(_0x270e95,_0x325619){return function(_0x5539b6){if(_0x5539b6){return _0x5539b6[_0x9b8d('0x22')](_0x270e95)['then'](function(_0x4cab4e){return _0x4cab4e;});}return null;};}function removeEntity(_0x49faa3,_0xa60d34){return function(_0x16938e){if(_0x16938e){return _0x16938e[_0x9b8d('0x23')]()[_0x9b8d('0x24')](function(){var _0x2586e1=_0x16938e[_0x9b8d('0x25')]({'plain':!![]});var _0x297ef9=_0x9b8d('0x26');return db[_0x9b8d('0x27')]['destroy']({'where':{'type':_0x297ef9,'resourceId':_0x2586e1['id']}})['then'](function(){return _0x16938e;});})[_0x9b8d('0x24')](function(){_0x49faa3[_0x9b8d('0x18')](0xcc)[_0x9b8d('0x19')]();});}};}function handleEntityNotFound(_0x12ec8f,_0x2b6aa2){return function(_0x8f6913){if(!_0x8f6913){_0x12ec8f[_0x9b8d('0x28')](0x194);}return _0x8f6913;};}function handleError(_0x46ca57,_0x51aad7){_0x51aad7=_0x51aad7||0x1f4;return function(_0x4a31d5){logger[_0x9b8d('0x29')](_0x4a31d5[_0x9b8d('0x2a')]);if(_0x4a31d5[_0x9b8d('0x2b')]){delete _0x4a31d5[_0x9b8d('0x2b')];}_0x46ca57[_0x9b8d('0x18')](_0x51aad7)[_0x9b8d('0x2c')](_0x4a31d5);};}exports[_0x9b8d('0x2d')]=function(_0x319547,_0x2a56c3){var _0x9b45ad={},_0x3089bd={},_0x557f8f={'count':0x0,'rows':[]};var _0x1d0a21=_[_0x9b8d('0x2e')](db['Sound'][_0x9b8d('0x2f')],function(_0x18a4bc){return{'name':_0x18a4bc[_0x9b8d('0x30')],'type':_0x18a4bc[_0x9b8d('0x31')]['key']};});_0x3089bd[_0x9b8d('0x32')]=_['map'](_0x1d0a21,_0x9b8d('0x2b'));_0x3089bd[_0x9b8d('0x33')]=_[_0x9b8d('0x34')](_0x319547['query']);_0x3089bd[_0x9b8d('0x35')]=_[_0x9b8d('0x36')](_0x3089bd[_0x9b8d('0x32')],_0x3089bd[_0x9b8d('0x33')]);_0x9b45ad[_0x9b8d('0x37')]=_['intersection'](_0x3089bd[_0x9b8d('0x32')],qs[_0x9b8d('0x38')](_0x319547[_0x9b8d('0x33')][_0x9b8d('0x38')]));_0x9b45ad[_0x9b8d('0x37')]=_0x9b45ad[_0x9b8d('0x37')][_0x9b8d('0x39')]?_0x9b45ad[_0x9b8d('0x37')]:_0x3089bd[_0x9b8d('0x32')];if(!_0x319547[_0x9b8d('0x33')][_0x9b8d('0x3a')]('nolimit')){_0x9b45ad[_0x9b8d('0x1c')]=qs[_0x9b8d('0x1c')](_0x319547[_0x9b8d('0x33')][_0x9b8d('0x1c')]);_0x9b45ad['offset']=qs[_0x9b8d('0x1b')](_0x319547[_0x9b8d('0x33')][_0x9b8d('0x1b')]);}_0x9b45ad['order']=qs[_0x9b8d('0x3b')](_0x319547['query'][_0x9b8d('0x3b')]);_0x9b45ad[_0x9b8d('0x3c')]=qs[_0x9b8d('0x35')](_['pick'](_0x319547[_0x9b8d('0x33')],_0x3089bd['filters']),_0x1d0a21);if(_0x319547[_0x9b8d('0x33')][_0x9b8d('0x3d')]){_0x9b45ad[_0x9b8d('0x3c')]=_[_0x9b8d('0x3e')](_0x9b45ad['where'],{'$or':_[_0x9b8d('0x2e')](_0x1d0a21,function(_0x1e3784){if(_0x1e3784['type']!==_0x9b8d('0x3f')){var _0x48f4fd={};_0x48f4fd[_0x1e3784[_0x9b8d('0x2b')]]={'$like':'%'+_0x319547[_0x9b8d('0x33')][_0x9b8d('0x3d')]+'%'};return _0x48f4fd;}})});}_0x9b45ad=_[_0x9b8d('0x3e')]({},_0x9b45ad,_0x319547[_0x9b8d('0x40')]);var _0x17756e={'where':_0x9b45ad[_0x9b8d('0x3c')]};return db[_0x9b8d('0x41')]['count'](_0x17756e)[_0x9b8d('0x24')](function(_0x215f11){_0x557f8f['count']=_0x215f11;if(_0x319547[_0x9b8d('0x33')]['includeAll']){_0x9b45ad[_0x9b8d('0x42')]=[{'all':!![]}];}return db['Sound'][_0x9b8d('0x43')](_0x9b45ad);})[_0x9b8d('0x24')](function(_0xf3f7ce){_0x557f8f[_0x9b8d('0x44')]=_0xf3f7ce;return _0x557f8f;})[_0x9b8d('0x24')](respondWithFilteredResult(_0x2a56c3,_0x9b45ad))[_0x9b8d('0x45')](handleError(_0x2a56c3,null));};exports[_0x9b8d('0x46')]=function(_0xb5b553,_0x354128){var _0x37abf6={'raw':!![],'where':{'id':_0xb5b553[_0x9b8d('0x47')]['id']}},_0x3ef6f3={};_0x3ef6f3['model']=_[_0x9b8d('0x34')](db['Sound'][_0x9b8d('0x2f')]);_0x3ef6f3[_0x9b8d('0x33')]=_[_0x9b8d('0x34')](_0xb5b553[_0x9b8d('0x33')]);_0x3ef6f3[_0x9b8d('0x35')]=_[_0x9b8d('0x36')](_0x3ef6f3[_0x9b8d('0x32')],_0x3ef6f3['query']);_0x37abf6[_0x9b8d('0x37')]=_[_0x9b8d('0x36')](_0x3ef6f3[_0x9b8d('0x32')],qs[_0x9b8d('0x38')](_0xb5b553[_0x9b8d('0x33')][_0x9b8d('0x38')]));_0x37abf6['attributes']=_0x37abf6['attributes']['length']?_0x37abf6[_0x9b8d('0x37')]:_0x3ef6f3[_0x9b8d('0x32')];if(_0xb5b553['query'][_0x9b8d('0x48')]){_0x37abf6[_0x9b8d('0x42')]=[{'all':!![]}];}_0x37abf6=_['merge']({},_0x37abf6,_0xb5b553['options']);return db[_0x9b8d('0x41')][_0x9b8d('0x49')](_0x37abf6)[_0x9b8d('0x24')](handleEntityNotFound(_0x354128,null))[_0x9b8d('0x24')](respondWithResult(_0x354128,null))[_0x9b8d('0x45')](handleError(_0x354128,null));};exports[_0x9b8d('0x4a')]=function(_0x1f2953,_0x3a58c4,_0x4f33fb){return db[_0x9b8d('0x41')][_0x9b8d('0x49')]({'where':{'id':_0x1f2953[_0x9b8d('0x47')]['id']},'attributes':['name',_0x9b8d('0x4b'),_0x9b8d('0x4c')],'raw':!![]})['then'](handleEntityNotFound(_0x3a58c4,null))[_0x9b8d('0x24')](function(_0x475ca3){if(_0x475ca3){if(!fs[_0x9b8d('0x4d')](path['join'](config['root'],'server/files/sounds/converted',_0x475ca3['save_name']+'.'+_0x475ca3[_0x9b8d('0x4c')]))){throw new db[(_0x9b8d('0x4e'))][(_0x9b8d('0x4f'))](_0x9b8d('0x50'));}return _0x3a58c4['download'](path[_0x9b8d('0x51')](config[_0x9b8d('0x52')],'server/files/sounds/converted',util[_0x9b8d('0x53')]('%s.%s',_0x475ca3['save_name'],_0x475ca3[_0x9b8d('0x4c')])),util[_0x9b8d('0x53')]('%s.%s',_0x475ca3[_0x9b8d('0x2b')],_0x475ca3[_0x9b8d('0x4c')]));}return null;})[_0x9b8d('0x45')](handleError(_0x3a58c4,null));};exports[_0x9b8d('0x54')]=function(_0x543355,_0x522a05,_0x32233c){var _0x34e296={'name':path['basename'](_0x543355[_0x9b8d('0x55')][_0x9b8d('0x56')],path[_0x9b8d('0x57')](_0x543355[_0x9b8d('0x55')][_0x9b8d('0x56')])),'save_name':path[_0x9b8d('0x58')](_0x543355[_0x9b8d('0x55')][_0x9b8d('0x59')],path['extname'](_0x543355['file'][_0x9b8d('0x59')])),'original_format':path[_0x9b8d('0x57')](_0x543355[_0x9b8d('0x55')][_0x9b8d('0x56')])[_0x9b8d('0x5a')](0x1),'converted_format':_0x9b8d('0x5b')};var _0x35e9a2=path[_0x9b8d('0x51')](config[_0x9b8d('0x52')],'server/files/sounds/original',_0x543355[_0x9b8d('0x55')][_0x9b8d('0x59')]);var _0x47871c=path[_0x9b8d('0x51')](config[_0x9b8d('0x52')],'server/files/sounds/converted',util[_0x9b8d('0x53')](_0x9b8d('0x5c'),path['basename'](_0x543355[_0x9b8d('0x55')][_0x9b8d('0x59')],path[_0x9b8d('0x57')](_0x543355[_0x9b8d('0x55')][_0x9b8d('0x59')])),_0x34e296[_0x9b8d('0x4c')]));logger[_0x9b8d('0x5d')](_0x9b8d('0x5e'),_0x35e9a2);logger[_0x9b8d('0x5d')](_0x9b8d('0x5f'),_0x47871c);try{fs[_0x9b8d('0x60')](_0x35e9a2,parseInt(_0x9b8d('0x61'),0x8));var _0x479e64=sox[_0x9b8d('0x62')](_0x35e9a2,_0x47871c,{'sampleRate':0x1f40,'format':_0x9b8d('0x5b'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x479e64['on']('error',function(_0x568d0c){fs[_0x9b8d('0x63')](_0x35e9a2);_0x522a05[_0x9b8d('0x18')](0x1f4)[_0x9b8d('0x2c')](_0x568d0c);});_0x479e64['on'](_0x9b8d('0x64'),function(_0x536ca1){_0x34e296[_0x9b8d('0x65')]=isNaN(_0x536ca1[_0x9b8d('0x66')])?null:_0x536ca1[_0x9b8d('0x66')]*0x3e8;_0x34e296[_0x9b8d('0x67')]=isNaN(_0x536ca1[_0x9b8d('0x68')])?null:_0x536ca1[_0x9b8d('0x68')];_0x34e296[_0x9b8d('0x69')]=isNaN(_0x536ca1[_0x9b8d('0x6a')])?null:_0x536ca1['channelCount'];_0x34e296[_0x9b8d('0x6b')]=isNaN(_0x536ca1[_0x9b8d('0x6c')])?null:_0x536ca1[_0x9b8d('0x6c')];_0x34e296[_0x9b8d('0x6d')]=isNaN(_0x536ca1[_0x9b8d('0x6e')])?null:_0x536ca1[_0x9b8d('0x6e')];});_0x479e64['on'](_0x9b8d('0x6f'),function(_0x5c1878){_0x34e296[_0x9b8d('0x70')]=isNaN(_0x5c1878[_0x9b8d('0x66')])?null:_0x5c1878[_0x9b8d('0x66')]*0x3e8;_0x34e296[_0x9b8d('0x71')]=isNaN(_0x5c1878[_0x9b8d('0x68')])?null:_0x5c1878[_0x9b8d('0x68')];_0x34e296[_0x9b8d('0x72')]=isNaN(_0x5c1878[_0x9b8d('0x6a')])?null:_0x5c1878[_0x9b8d('0x6a')];_0x34e296[_0x9b8d('0x73')]=isNaN(_0x5c1878['bitRate'])?null:_0x5c1878[_0x9b8d('0x6c')];_0x34e296[_0x9b8d('0x74')]=isNaN(_0x5c1878[_0x9b8d('0x6e')])?null:_0x5c1878[_0x9b8d('0x6e')];});_0x479e64['on'](_0x9b8d('0x19'),function(){fs[_0x9b8d('0x60')](_0x47871c,parseInt(_0x9b8d('0x61'),0x8));return db['Sound'][_0x9b8d('0x54')](_0x34e296)[_0x9b8d('0x24')](function(_0xca58c7){var _0x5f1cb0={'role':_0x543355[_0x9b8d('0x75')][_0x9b8d('0x76')],'userProfileId':_0x543355[_0x9b8d('0x75')][_0x9b8d('0x77')]};if(!_0x5f1cb0)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5f1cb0[_0x9b8d('0x76')]===_0x9b8d('0x78')){var _0x5e1ac7=_0xca58c7[_0x9b8d('0x25')]({'plain':!![]});return db['UserProfileSection'][_0x9b8d('0x49')]({'where':{'name':_0x9b8d('0x26'),'userProfileId':_0x5f1cb0[_0x9b8d('0x77')]},'raw':!![]})['then'](function(_0xf005db){if(_0xf005db&&_0xf005db[_0x9b8d('0x79')]===0x0){return db[_0x9b8d('0x27')]['create']({'name':_0x5e1ac7[_0x9b8d('0x2b')],'resourceId':_0x5e1ac7['id'],'type':_0xf005db[_0x9b8d('0x2b')],'sectionId':_0xf005db['id']},{})[_0x9b8d('0x24')](function(){return _0xca58c7;});}else{return _0xca58c7;}})[_0x9b8d('0x45')](function(_0x507f70){logger['error'](_0x9b8d('0x7a'),_0x507f70);throw _0x507f70;});}return _0xca58c7;})[_0x9b8d('0x24')](respondWithResult(_0x522a05,null))[_0x9b8d('0x45')](handleError(_0x522a05,null));});_0x479e64[_0x9b8d('0x7b')]();}catch(_0x10382d){_0x522a05[_0x9b8d('0x18')](0x1f4)[_0x9b8d('0x2c')](_0x10382d);}};exports[_0x9b8d('0x22')]=function(_0x3e3f14,_0x2c3992,_0x385298){return db[_0x9b8d('0x41')][_0x9b8d('0x49')]({'where':{'id':_0x3e3f14[_0x9b8d('0x47')]['id']}})[_0x9b8d('0x24')](handleEntityNotFound(_0x2c3992,null))['then'](saveUpdates(_[_0x9b8d('0x7c')](_0x3e3f14[_0x9b8d('0x75')],[_0x9b8d('0x2b'),_0x9b8d('0x7d')]),null))[_0x9b8d('0x24')](respondWithResult(_0x2c3992,null))[_0x9b8d('0x45')](handleError(_0x2c3992,null));};exports['delete']=function(_0x4c062f,_0x1d8450,_0x2be4f3){return db['Sound']['find']({'where':{'id':_0x4c062f[_0x9b8d('0x47')]['id']}})[_0x9b8d('0x24')](function(_0x585d2b){if(_0x585d2b){return _0x585d2b[_0x9b8d('0x23')]();}})[_0x9b8d('0x24')](function(_0x393197){var _0x3f276d=path[_0x9b8d('0x51')](config[_0x9b8d('0x52')],_0x9b8d('0x7e'),util[_0x9b8d('0x53')](_0x9b8d('0x5c'),_0x393197['save_name'],_0x393197[_0x9b8d('0x7f')]));var _0x564bb0=path[_0x9b8d('0x51')](config['root'],_0x9b8d('0x80'),util[_0x9b8d('0x53')](_0x9b8d('0x5c'),_0x393197[_0x9b8d('0x4b')],_0x393197[_0x9b8d('0x4c')]));fs['unlinkSync'](_0x3f276d);fs['unlinkSync'](_0x564bb0);return _0x393197;})[_0x9b8d('0x24')](function(_0x147f06){if(_0x147f06){return _0x1d8450['status'](0xcc)[_0x9b8d('0x19')]();}})['then'](handleEntityNotFound(_0x1d8450,null))[_0x9b8d('0x45')](handleError(_0x1d8450,null));}; \ No newline at end of file +var _0x8501=['fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','limit','Content-Range','save','update','then','destroy','get','Sounds','UserProfileResource','error','name','index','rawAttributes','fieldName','type','key','model','keys','query','filters','intersection','attributes','fields','hasOwnProperty','sort','pick','where','map','VIRTUAL','merge','options','count','includeAll','include','findAll','rows','catch','show','Sound','find','download','params','save_name','converted_format','existsSync','join','root','server/files/sounds/converted','ValidationError','Sound\x20not\x20found','format','%s.%s','create','basename','file','originalname','filename','substring','wav','server/files/sounds/original','extname','info','Sound\x20upload\x20destination:\x20%s','chmodSync','0777','transcode','unlinkSync','src','original_duration','duration','original_sampleCount','sampleCount','original_channelCount','channelCount','original_bitRate','bitRate','original_sampleRate','sampleRate','dest','converted_duration','converted_sampleCount','converted_channelCount','converted_bitRate','converted_sampleRate','body','role','userProfileId','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','start','send','description','delete','original_format','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','ejs'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0x8501,0x1ef));var _0x1850=function(_0x5ce3c8,_0x2503bd){_0x5ce3c8=_0x5ce3c8-0x0;var _0xa76867=_0x8501[_0x5ce3c8];return _0xa76867;};'use strict';var emlformat=require(_0x1850('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x1850('0x1'));var jsonpatch=require(_0x1850('0x2'));var rp=require(_0x1850('0x3'));var moment=require(_0x1850('0x4'));var BPromise=require(_0x1850('0x5'));var Mustache=require('mustache');var util=require(_0x1850('0x6'));var path=require(_0x1850('0x7'));var sox=require('sox');var csv=require('to-csv');var ejs=require(_0x1850('0x8'));var fs=require('fs');var fs_extra=require(_0x1850('0x9'));var _=require(_0x1850('0xa'));var squel=require(_0x1850('0xb'));var crypto=require(_0x1850('0xc'));var jsforce=require('jsforce');var deskjs=require(_0x1850('0xd'));var toCsv=require(_0x1850('0xe'));var querystring=require(_0x1850('0xf'));var Papa=require('papaparse');var Redis=require(_0x1850('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x1850('0x11'));var as=require(_0x1850('0x12'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x1850('0x13'))('api');var utils=require(_0x1850('0x14'));var config=require(_0x1850('0x15'));var licenseUtil=require(_0x1850('0x16'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x3596d5,_0x371a29){_0x371a29=_0x371a29||0xcc;return function(_0xc6ec4f){if(_0xc6ec4f){return _0x3596d5[_0x1850('0x17')](_0x371a29);}return _0x3596d5[_0x1850('0x18')](_0x371a29)[_0x1850('0x19')]();};}function respondWithResult(_0x2ac7e8,_0x2a43b5){_0x2a43b5=_0x2a43b5||0xc8;return function(_0x3c234d){if(_0x3c234d){return _0x2ac7e8[_0x1850('0x18')](_0x2a43b5)[_0x1850('0x1a')](_0x3c234d);}};}function respondWithFilteredResult(_0x554289,_0xd21b8){return function(_0x4f057a){if(_0x4f057a){var _0xaec353=typeof _0xd21b8[_0x1850('0x1b')]===_0x1850('0x1c')&&typeof _0xd21b8['limit']==='undefined';var _0x1f57f9=_0x4f057a['count'];var _0x5015c4=_0xaec353?0x0:_0xd21b8['offset'];var _0x26caa1=_0xaec353?_0x4f057a['count']:_0xd21b8[_0x1850('0x1b')]+_0xd21b8[_0x1850('0x1d')];var _0x484f86;if(_0x26caa1>=_0x1f57f9){_0x26caa1=_0x1f57f9;_0x484f86=0xc8;}else{_0x484f86=0xce;}_0x554289[_0x1850('0x18')](_0x484f86);return _0x554289['set'](_0x1850('0x1e'),_0x5015c4+'-'+_0x26caa1+'/'+_0x1f57f9)[_0x1850('0x1a')](_0x4f057a);}return null;};}function patchUpdates(_0x184a9c){return function(_0x201770){try{jsonpatch['apply'](_0x201770,_0x184a9c,!![]);}catch(_0x3f5383){return BPromise['reject'](_0x3f5383);}return _0x201770[_0x1850('0x1f')]();};}function saveUpdates(_0x1cecce,_0x101ec8){return function(_0x42d65a){if(_0x42d65a){return _0x42d65a[_0x1850('0x20')](_0x1cecce)[_0x1850('0x21')](function(_0x4e6255){return _0x4e6255;});}return null;};}function removeEntity(_0x5d5892,_0x434574){return function(_0x4e1aa9){if(_0x4e1aa9){return _0x4e1aa9[_0x1850('0x22')]()[_0x1850('0x21')](function(){var _0x2f65c1=_0x4e1aa9[_0x1850('0x23')]({'plain':!![]});var _0x5daff6=_0x1850('0x24');return db[_0x1850('0x25')]['destroy']({'where':{'type':_0x5daff6,'resourceId':_0x2f65c1['id']}})[_0x1850('0x21')](function(){return _0x4e1aa9;});})[_0x1850('0x21')](function(){_0x5d5892[_0x1850('0x18')](0xcc)[_0x1850('0x19')]();});}};}function handleEntityNotFound(_0x5daf7e,_0x25d559){return function(_0x3e689b){if(!_0x3e689b){_0x5daf7e[_0x1850('0x17')](0x194);}return _0x3e689b;};}function handleError(_0x266b00,_0xf26d31){_0xf26d31=_0xf26d31||0x1f4;return function(_0x5278cc){logger[_0x1850('0x26')](_0x5278cc['stack']);if(_0x5278cc[_0x1850('0x27')]){delete _0x5278cc[_0x1850('0x27')];}_0x266b00[_0x1850('0x18')](_0xf26d31)['send'](_0x5278cc);};}exports[_0x1850('0x28')]=function(_0x466ad1,_0x500c9a){var _0x471d05={},_0x51772a={},_0x2ffcf8={'count':0x0,'rows':[]};var _0x10e671=_['map'](db['Sound'][_0x1850('0x29')],function(_0x38f340){return{'name':_0x38f340[_0x1850('0x2a')],'type':_0x38f340[_0x1850('0x2b')][_0x1850('0x2c')]};});_0x51772a[_0x1850('0x2d')]=_['map'](_0x10e671,_0x1850('0x27'));_0x51772a['query']=_[_0x1850('0x2e')](_0x466ad1[_0x1850('0x2f')]);_0x51772a[_0x1850('0x30')]=_[_0x1850('0x31')](_0x51772a[_0x1850('0x2d')],_0x51772a[_0x1850('0x2f')]);_0x471d05[_0x1850('0x32')]=_[_0x1850('0x31')](_0x51772a[_0x1850('0x2d')],qs[_0x1850('0x33')](_0x466ad1[_0x1850('0x2f')][_0x1850('0x33')]));_0x471d05[_0x1850('0x32')]=_0x471d05['attributes']['length']?_0x471d05[_0x1850('0x32')]:_0x51772a[_0x1850('0x2d')];if(!_0x466ad1[_0x1850('0x2f')][_0x1850('0x34')]('nolimit')){_0x471d05[_0x1850('0x1d')]=qs[_0x1850('0x1d')](_0x466ad1[_0x1850('0x2f')][_0x1850('0x1d')]);_0x471d05[_0x1850('0x1b')]=qs[_0x1850('0x1b')](_0x466ad1[_0x1850('0x2f')][_0x1850('0x1b')]);}_0x471d05['order']=qs[_0x1850('0x35')](_0x466ad1[_0x1850('0x2f')]['sort']);_0x471d05['where']=qs[_0x1850('0x30')](_[_0x1850('0x36')](_0x466ad1[_0x1850('0x2f')],_0x51772a[_0x1850('0x30')]),_0x10e671);if(_0x466ad1[_0x1850('0x2f')]['filter']){_0x471d05[_0x1850('0x37')]=_['merge'](_0x471d05[_0x1850('0x37')],{'$or':_[_0x1850('0x38')](_0x10e671,function(_0x5eb472){if(_0x5eb472['type']!==_0x1850('0x39')){var _0x365fb4={};_0x365fb4[_0x5eb472[_0x1850('0x27')]]={'$like':'%'+_0x466ad1[_0x1850('0x2f')]['filter']+'%'};return _0x365fb4;}})});}_0x471d05=_[_0x1850('0x3a')]({},_0x471d05,_0x466ad1[_0x1850('0x3b')]);var _0x251748={'where':_0x471d05['where']};return db['Sound']['count'](_0x251748)[_0x1850('0x21')](function(_0x5eeb80){_0x2ffcf8[_0x1850('0x3c')]=_0x5eeb80;if(_0x466ad1[_0x1850('0x2f')][_0x1850('0x3d')]){_0x471d05[_0x1850('0x3e')]=[{'all':!![]}];}return db['Sound'][_0x1850('0x3f')](_0x471d05);})[_0x1850('0x21')](function(_0x561cd1){_0x2ffcf8[_0x1850('0x40')]=_0x561cd1;return _0x2ffcf8;})[_0x1850('0x21')](respondWithFilteredResult(_0x500c9a,_0x471d05))[_0x1850('0x41')](handleError(_0x500c9a,null));};exports[_0x1850('0x42')]=function(_0x125e78,_0x2b7d18){var _0x397197={'raw':!![],'where':{'id':_0x125e78['params']['id']}},_0x564383={};_0x564383[_0x1850('0x2d')]=_[_0x1850('0x2e')](db[_0x1850('0x43')][_0x1850('0x29')]);_0x564383[_0x1850('0x2f')]=_[_0x1850('0x2e')](_0x125e78[_0x1850('0x2f')]);_0x564383[_0x1850('0x30')]=_[_0x1850('0x31')](_0x564383[_0x1850('0x2d')],_0x564383['query']);_0x397197[_0x1850('0x32')]=_[_0x1850('0x31')](_0x564383[_0x1850('0x2d')],qs[_0x1850('0x33')](_0x125e78[_0x1850('0x2f')]['fields']));_0x397197[_0x1850('0x32')]=_0x397197[_0x1850('0x32')]['length']?_0x397197[_0x1850('0x32')]:_0x564383['model'];if(_0x125e78[_0x1850('0x2f')]['includeAll']){_0x397197[_0x1850('0x3e')]=[{'all':!![]}];}_0x397197=_[_0x1850('0x3a')]({},_0x397197,_0x125e78[_0x1850('0x3b')]);return db[_0x1850('0x43')][_0x1850('0x44')](_0x397197)['then'](handleEntityNotFound(_0x2b7d18,null))[_0x1850('0x21')](respondWithResult(_0x2b7d18,null))[_0x1850('0x41')](handleError(_0x2b7d18,null));};exports[_0x1850('0x45')]=function(_0x4bbad3,_0x113493,_0x1c5143){return db[_0x1850('0x43')][_0x1850('0x44')]({'where':{'id':_0x4bbad3[_0x1850('0x46')]['id']},'attributes':[_0x1850('0x27'),_0x1850('0x47'),_0x1850('0x48')],'raw':!![]})[_0x1850('0x21')](handleEntityNotFound(_0x113493,null))[_0x1850('0x21')](function(_0x39902b){if(_0x39902b){if(!fs[_0x1850('0x49')](path[_0x1850('0x4a')](config[_0x1850('0x4b')],_0x1850('0x4c'),_0x39902b['save_name']+'.'+_0x39902b['converted_format']))){throw new db['Sequelize'][(_0x1850('0x4d'))](_0x1850('0x4e'));}return _0x113493[_0x1850('0x45')](path[_0x1850('0x4a')](config[_0x1850('0x4b')],_0x1850('0x4c'),util[_0x1850('0x4f')]('%s.%s',_0x39902b[_0x1850('0x47')],_0x39902b[_0x1850('0x48')])),util['format'](_0x1850('0x50'),_0x39902b[_0x1850('0x27')],_0x39902b[_0x1850('0x48')]));}return null;})['catch'](handleError(_0x113493,null));};exports[_0x1850('0x51')]=function(_0x1c93fd,_0x2d4015,_0xdb73bf){var _0x219edf={'name':path[_0x1850('0x52')](_0x1c93fd[_0x1850('0x53')][_0x1850('0x54')],path['extname'](_0x1c93fd['file'][_0x1850('0x54')])),'save_name':path[_0x1850('0x52')](_0x1c93fd[_0x1850('0x53')]['filename'],path['extname'](_0x1c93fd[_0x1850('0x53')][_0x1850('0x55')])),'original_format':path['extname'](_0x1c93fd['file'][_0x1850('0x54')])[_0x1850('0x56')](0x1),'converted_format':_0x1850('0x57')};var _0x115d53=path[_0x1850('0x4a')](config[_0x1850('0x4b')],_0x1850('0x58'),_0x1c93fd[_0x1850('0x53')]['filename']);var _0x1530c6=path[_0x1850('0x4a')](config[_0x1850('0x4b')],_0x1850('0x4c'),util[_0x1850('0x4f')]('%s.%s',path[_0x1850('0x52')](_0x1c93fd['file']['filename'],path[_0x1850('0x59')](_0x1c93fd[_0x1850('0x53')][_0x1850('0x55')])),_0x219edf[_0x1850('0x48')]));logger[_0x1850('0x5a')]('Sound\x20upload\x20filepath:\x20%s',_0x115d53);logger[_0x1850('0x5a')](_0x1850('0x5b'),_0x1530c6);try{fs[_0x1850('0x5c')](_0x115d53,parseInt(_0x1850('0x5d'),0x8));var _0x2aa2f8=sox[_0x1850('0x5e')](_0x115d53,_0x1530c6,{'sampleRate':0x1f40,'format':_0x1850('0x57'),'channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x2aa2f8['on']('error',function(_0x19d587){fs[_0x1850('0x5f')](_0x115d53);_0x2d4015[_0x1850('0x18')](0x1f4)['send'](_0x19d587);});_0x2aa2f8['on'](_0x1850('0x60'),function(_0x1ea49e){_0x219edf[_0x1850('0x61')]=isNaN(_0x1ea49e[_0x1850('0x62')])?null:_0x1ea49e[_0x1850('0x62')]*0x3e8;_0x219edf[_0x1850('0x63')]=isNaN(_0x1ea49e[_0x1850('0x64')])?null:_0x1ea49e[_0x1850('0x64')];_0x219edf[_0x1850('0x65')]=isNaN(_0x1ea49e['channelCount'])?null:_0x1ea49e[_0x1850('0x66')];_0x219edf[_0x1850('0x67')]=isNaN(_0x1ea49e[_0x1850('0x68')])?null:_0x1ea49e[_0x1850('0x68')];_0x219edf[_0x1850('0x69')]=isNaN(_0x1ea49e[_0x1850('0x6a')])?null:_0x1ea49e[_0x1850('0x6a')];});_0x2aa2f8['on'](_0x1850('0x6b'),function(_0x2e4137){_0x219edf[_0x1850('0x6c')]=isNaN(_0x2e4137['duration'])?null:_0x2e4137[_0x1850('0x62')]*0x3e8;_0x219edf[_0x1850('0x6d')]=isNaN(_0x2e4137[_0x1850('0x64')])?null:_0x2e4137[_0x1850('0x64')];_0x219edf[_0x1850('0x6e')]=isNaN(_0x2e4137[_0x1850('0x66')])?null:_0x2e4137['channelCount'];_0x219edf[_0x1850('0x6f')]=isNaN(_0x2e4137[_0x1850('0x68')])?null:_0x2e4137[_0x1850('0x68')];_0x219edf[_0x1850('0x70')]=isNaN(_0x2e4137[_0x1850('0x6a')])?null:_0x2e4137[_0x1850('0x6a')];});_0x2aa2f8['on']('end',function(){fs[_0x1850('0x5c')](_0x1530c6,parseInt(_0x1850('0x5d'),0x8));return db[_0x1850('0x43')][_0x1850('0x51')](_0x219edf)[_0x1850('0x21')](function(_0x342fe1){var _0x55ca56={'role':_0x1c93fd[_0x1850('0x71')][_0x1850('0x72')],'userProfileId':_0x1c93fd[_0x1850('0x71')][_0x1850('0x73')]};if(!_0x55ca56)throw new Error(_0x1850('0x74'));if(_0x55ca56[_0x1850('0x72')]===_0x1850('0x75')){var _0x4c9315=_0x342fe1[_0x1850('0x23')]({'plain':!![]});return db[_0x1850('0x76')][_0x1850('0x44')]({'where':{'name':_0x1850('0x24'),'userProfileId':_0x55ca56[_0x1850('0x73')]},'raw':!![]})[_0x1850('0x21')](function(_0x5a3269){if(_0x5a3269&&_0x5a3269[_0x1850('0x77')]===0x0){return db[_0x1850('0x25')][_0x1850('0x51')]({'name':_0x4c9315[_0x1850('0x27')],'resourceId':_0x4c9315['id'],'type':_0x5a3269[_0x1850('0x27')],'sectionId':_0x5a3269['id']},{})['then'](function(){return _0x342fe1;});}else{return _0x342fe1;}})[_0x1850('0x41')](function(_0x43edc4){logger[_0x1850('0x26')](_0x1850('0x78'),_0x43edc4);throw _0x43edc4;});}return _0x342fe1;})['then'](respondWithResult(_0x2d4015,null))[_0x1850('0x41')](handleError(_0x2d4015,null));});_0x2aa2f8[_0x1850('0x79')]();}catch(_0x869e01){_0x2d4015['status'](0x1f4)[_0x1850('0x7a')](_0x869e01);}};exports[_0x1850('0x20')]=function(_0x38d378,_0x452a16,_0x2472da){return db[_0x1850('0x43')]['find']({'where':{'id':_0x38d378['params']['id']}})[_0x1850('0x21')](handleEntityNotFound(_0x452a16,null))[_0x1850('0x21')](saveUpdates(_[_0x1850('0x36')](_0x38d378[_0x1850('0x71')],[_0x1850('0x27'),_0x1850('0x7b')]),null))[_0x1850('0x21')](respondWithResult(_0x452a16,null))[_0x1850('0x41')](handleError(_0x452a16,null));};exports[_0x1850('0x7c')]=function(_0x1afbef,_0x13814e,_0x5ad637){return db[_0x1850('0x43')][_0x1850('0x44')]({'where':{'id':_0x1afbef[_0x1850('0x46')]['id']}})[_0x1850('0x21')](function(_0x2b6f2c){if(_0x2b6f2c){return _0x2b6f2c[_0x1850('0x22')]();}})[_0x1850('0x21')](function(_0x4f84b8){var _0xec9d14=path[_0x1850('0x4a')](config[_0x1850('0x4b')],_0x1850('0x58'),util['format'](_0x1850('0x50'),_0x4f84b8[_0x1850('0x47')],_0x4f84b8[_0x1850('0x7d')]));var _0x1881b5=path['join'](config[_0x1850('0x4b')],_0x1850('0x4c'),util[_0x1850('0x4f')]('%s.%s',_0x4f84b8[_0x1850('0x47')],_0x4f84b8[_0x1850('0x48')]));fs[_0x1850('0x5f')](_0xec9d14);fs[_0x1850('0x5f')](_0x1881b5);return _0x4f84b8;})['then'](function(_0x487087){if(_0x487087){return _0x13814e[_0x1850('0x18')](0xcc)[_0x1850('0x19')]();}})['then'](handleEntityNotFound(_0x13814e,null))[_0x1850('0x41')](handleError(_0x13814e,null));}; \ No newline at end of file diff --git a/server/api/sound/sound.model.js b/server/api/sound/sound.model.js index 04f965c..9789633 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 _0xc5b0=['rimraf','./sound.attributes','exports','define','Sound','tools_sounds','util','api','moment','request-promise'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xc5b0,0x1d2));var _0x0c5b=function(_0x2f7d91,_0x3f24a8){_0x2f7d91=_0x2f7d91-0x0;var _0x33dad7=_0xc5b0[_0x2f7d91];return _0x33dad7;};'use strict';var _=require('lodash');var util=require(_0x0c5b('0x0'));var logger=require('../../config/logger')(_0x0c5b('0x1'));var moment=require(_0x0c5b('0x2'));var BPromise=require('bluebird');var rp=require(_0x0c5b('0x3'));var fs=require('fs');var path=require('path');var rimraf=require(_0x0c5b('0x4'));var config=require('../../config/environment');var attributes=require(_0x0c5b('0x5'));module[_0x0c5b('0x6')]=function(_0x4fc675,_0x2debad){return _0x4fc675[_0x0c5b('0x7')](_0x0c5b('0x8'),attributes,{'tableName':_0x0c5b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x905e=['util','../../config/logger','api','path','rimraf','Sound','tools_sounds','lodash'];(function(_0x782c58,_0xc176a1){var _0x1c139=function(_0x2e2079){while(--_0x2e2079){_0x782c58['push'](_0x782c58['shift']());}};_0x1c139(++_0xc176a1);}(_0x905e,0xd7));var _0xe905=function(_0x32e2a2,_0x3c86fc){_0x32e2a2=_0x32e2a2-0x0;var _0x123e3f=_0x905e[_0x32e2a2];return _0x123e3f;};'use strict';var _=require(_0xe905('0x0'));var util=require(_0xe905('0x1'));var logger=require(_0xe905('0x2'))(_0xe905('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xe905('0x4'));var rimraf=require(_0xe905('0x5'));var config=require('../../config/environment');var attributes=require('./sound.attributes');module['exports']=function(_0x3e21b4,_0x1ab6c9){return _0x3e21b4['define'](_0xe905('0x6'),attributes,{'tableName':_0xe905('0x7'),'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 3224a48..5942f25 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 _0x5990=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','info','Sound,\x20%s,\x20%s','request\x20sent','Sound,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','ShowSound','Sound','options','raw','where','model','attributes','include','map','then','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x5785f5,_0x4a9c2e){var _0xc36cc0=function(_0x538e4b){while(--_0x538e4b){_0x5785f5['push'](_0x5785f5['shift']());}};_0xc36cc0(++_0x4a9c2e);}(_0x5990,0x101));var _0x0599=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x5990[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x0599('0x0'));var util=require(_0x0599('0x1'));var moment=require(_0x0599('0x2'));var BPromise=require(_0x0599('0x3'));var rs=require(_0x0599('0x4'));var fs=require('fs');var Redis=require(_0x0599('0x5'));var db=require(_0x0599('0x6'))['db'];var utils=require(_0x0599('0x7'));var logger=require(_0x0599('0x8'))(_0x0599('0x9'));var config=require(_0x0599('0xa'));var jayson=require(_0x0599('0xb'));var client=jayson[_0x0599('0xc')]['http']({'port':0x232a});function respondWithRpcPromise(_0xc3cdee,_0x39fa1c,_0x49e70e){return new BPromise(function(_0x5aa568,_0x111818){return client[_0x0599('0xd')](_0xc3cdee,_0x49e70e)['then'](function(_0x443f16){logger[_0x0599('0xe')](_0x0599('0xf'),_0x39fa1c,_0x0599('0x10'));logger['debug'](_0x0599('0x11'),_0x39fa1c,_0x0599('0x10'),JSON[_0x0599('0x12')](_0x443f16));if(_0x443f16['error']){if(_0x443f16[_0x0599('0x13')]['code']===0x1f4){logger[_0x0599('0x13')](_0x0599('0xf'),_0x39fa1c,_0x443f16['error'][_0x0599('0x14')]);return _0x111818(_0x443f16[_0x0599('0x13')][_0x0599('0x14')]);}logger[_0x0599('0x13')](_0x0599('0xf'),_0x39fa1c,_0x443f16[_0x0599('0x13')][_0x0599('0x14')]);return _0x5aa568(_0x443f16[_0x0599('0x13')][_0x0599('0x14')]);}else{logger[_0x0599('0xe')]('Sound,\x20%s,\x20%s',_0x39fa1c,_0x0599('0x10'));_0x5aa568(_0x443f16['result'][_0x0599('0x14')]);}})[_0x0599('0x15')](function(_0x277f43){logger['error']('Sound,\x20%s,\x20%s',_0x39fa1c,_0x277f43);_0x111818(_0x277f43);});});}exports[_0x0599('0x16')]=function(_0x1c1483){var _0x246f05=this;return new Promise(function(_0x5055d6,_0x506e32){return db[_0x0599('0x17')]['find']({'raw':_0x1c1483['options']?_0x1c1483[_0x0599('0x18')][_0x0599('0x19')]===undefined?!![]:![]:!![],'where':_0x1c1483[_0x0599('0x18')]?_0x1c1483['options'][_0x0599('0x1a')]||null:null,'attributes':_0x1c1483[_0x0599('0x18')]?_0x1c1483['options']['attributes']||null:null,'include':_0x1c1483[_0x0599('0x18')]?_0x1c1483[_0x0599('0x18')]['include']?_['map'](_0x1c1483[_0x0599('0x18')]['include'],function(_0x1a0334){return{'model':db[_0x1a0334[_0x0599('0x1b')]],'as':_0x1a0334['as'],'attributes':_0x1a0334[_0x0599('0x1c')],'include':_0x1a0334[_0x0599('0x1d')]?_[_0x0599('0x1e')](_0x1a0334[_0x0599('0x1d')],function(_0x101956){return{'model':db[_0x101956[_0x0599('0x1b')]],'as':_0x101956['as'],'attributes':_0x101956[_0x0599('0x1c')],'include':_0x101956[_0x0599('0x1d')]?_[_0x0599('0x1e')](_0x101956['include'],function(_0x9808dc){return{'model':db[_0x9808dc[_0x0599('0x1b')]],'as':_0x9808dc['as'],'attributes':_0x9808dc[_0x0599('0x1c')]};}):[]};}):[]};}):[]:[]})[_0x0599('0x1f')](function(_0x5119b4){logger['info'](_0x0599('0x16'),_0x1c1483);logger[_0x0599('0x20')](_0x0599('0x16'),_0x1c1483,JSON[_0x0599('0x12')](_0x5119b4));_0x5055d6(_0x5119b4);})['catch'](function(_0x22ad9d){logger[_0x0599('0x13')]('ShowSound',_0x22ad9d[_0x0599('0x14')],_0x1c1483);_0x506e32(_0x246f05[_0x0599('0x13')](0x1f4,_0x22ad9d[_0x0599('0x14')]));});});}; \ No newline at end of file +var _0xb148=['http','request','then','info','request\x20sent','stringify','error','code','Sound,\x20%s,\x20%s','message','result','catch','Sound','find','options','include','map','model','attributes','ShowSound','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x52cc82,_0x287e0a){var _0x3f7c3e=function(_0x2fb68d){while(--_0x2fb68d){_0x52cc82['push'](_0x52cc82['shift']());}};_0x3f7c3e(++_0x287e0a);}(_0xb148,0x8d));var _0x8b14=function(_0x55821d,_0x27a22e){_0x55821d=_0x55821d-0x0;var _0x58ea8a=_0xb148[_0x55821d];return _0x58ea8a;};'use strict';var _=require(_0x8b14('0x0'));var util=require('util');var moment=require(_0x8b14('0x1'));var BPromise=require(_0x8b14('0x2'));var rs=require(_0x8b14('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8b14('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8b14('0x5'))(_0x8b14('0x6'));var config=require(_0x8b14('0x7'));var jayson=require(_0x8b14('0x8'));var client=jayson['client'][_0x8b14('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3bcebb,_0x9a84ee,_0x4d7237){return new BPromise(function(_0x5c5458,_0x5e2dee){return client[_0x8b14('0xa')](_0x3bcebb,_0x4d7237)[_0x8b14('0xb')](function(_0x8f19a2){logger[_0x8b14('0xc')]('Sound,\x20%s,\x20%s',_0x9a84ee,_0x8b14('0xd'));logger['debug']('Sound,\x20%s,\x20%s,\x20%s',_0x9a84ee,_0x8b14('0xd'),JSON[_0x8b14('0xe')](_0x8f19a2));if(_0x8f19a2['error']){if(_0x8f19a2[_0x8b14('0xf')][_0x8b14('0x10')]===0x1f4){logger[_0x8b14('0xf')](_0x8b14('0x11'),_0x9a84ee,_0x8f19a2['error'][_0x8b14('0x12')]);return _0x5e2dee(_0x8f19a2['error'][_0x8b14('0x12')]);}logger[_0x8b14('0xf')]('Sound,\x20%s,\x20%s',_0x9a84ee,_0x8f19a2[_0x8b14('0xf')]['message']);return _0x5c5458(_0x8f19a2[_0x8b14('0xf')]['message']);}else{logger['info'](_0x8b14('0x11'),_0x9a84ee,_0x8b14('0xd'));_0x5c5458(_0x8f19a2[_0x8b14('0x13')]['message']);}})[_0x8b14('0x14')](function(_0x3cab79){logger[_0x8b14('0xf')]('Sound,\x20%s,\x20%s',_0x9a84ee,_0x3cab79);_0x5e2dee(_0x3cab79);});});}exports['ShowSound']=function(_0xa8e92d){var _0x2e4fc5=this;return new Promise(function(_0x127c3b,_0x36d69c){return db[_0x8b14('0x15')][_0x8b14('0x16')]({'raw':_0xa8e92d['options']?_0xa8e92d[_0x8b14('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0xa8e92d[_0x8b14('0x17')]?_0xa8e92d[_0x8b14('0x17')]['where']||null:null,'attributes':_0xa8e92d['options']?_0xa8e92d[_0x8b14('0x17')]['attributes']||null:null,'include':_0xa8e92d['options']?_0xa8e92d[_0x8b14('0x17')][_0x8b14('0x18')]?_[_0x8b14('0x19')](_0xa8e92d[_0x8b14('0x17')][_0x8b14('0x18')],function(_0x1e6a29){return{'model':db[_0x1e6a29[_0x8b14('0x1a')]],'as':_0x1e6a29['as'],'attributes':_0x1e6a29['attributes'],'include':_0x1e6a29[_0x8b14('0x18')]?_[_0x8b14('0x19')](_0x1e6a29[_0x8b14('0x18')],function(_0x5ba6bb){return{'model':db[_0x5ba6bb['model']],'as':_0x5ba6bb['as'],'attributes':_0x5ba6bb[_0x8b14('0x1b')],'include':_0x5ba6bb[_0x8b14('0x18')]?_['map'](_0x5ba6bb[_0x8b14('0x18')],function(_0x57280a){return{'model':db[_0x57280a[_0x8b14('0x1a')]],'as':_0x57280a['as'],'attributes':_0x57280a[_0x8b14('0x1b')]};}):[]};}):[]};}):[]:[]})[_0x8b14('0xb')](function(_0x3d565b){logger[_0x8b14('0xc')](_0x8b14('0x1c'),_0xa8e92d);logger[_0x8b14('0x1d')](_0x8b14('0x1c'),_0xa8e92d,JSON['stringify'](_0x3d565b));_0x127c3b(_0x3d565b);})[_0x8b14('0x14')](function(_0x147d04){logger[_0x8b14('0xf')](_0x8b14('0x1c'),_0x147d04[_0x8b14('0x12')],_0xa8e92d);_0x36d69c(_0x2e4fc5[_0x8b14('0xf')](0x1f4,_0x147d04[_0x8b14('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareMessage/index.js b/server/api/squareMessage/index.js index 40013ed..bd2cad1 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 _0x2032=['exports','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./squareMessage.controller','get','isAuthenticated','index','/:id','show','post','put','update','delete'];(function(_0x4f7da1,_0x21ae99){var _0x5473f4=function(_0x2c5adc){while(--_0x2c5adc){_0x4f7da1['push'](_0x4f7da1['shift']());}};_0x5473f4(++_0x21ae99);}(_0x2032,0xd9));var _0x2203=function(_0x21edaf,_0x16e72d){_0x21edaf=_0x21edaf-0x0;var _0x34ac92=_0x2032[_0x21edaf];return _0x34ac92;};'use strict';var multer=require('multer');var util=require(_0x2203('0x0'));var path=require(_0x2203('0x1'));var timeout=require(_0x2203('0x2'));var express=require('express');var router=express[_0x2203('0x3')]();var fs_extra=require(_0x2203('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x2203('0x5'));var config=require(_0x2203('0x6'));var controller=require(_0x2203('0x7'));router[_0x2203('0x8')]('/',auth[_0x2203('0x9')](),controller[_0x2203('0xa')]);router[_0x2203('0x8')](_0x2203('0xb'),auth[_0x2203('0x9')](),controller[_0x2203('0xc')]);router[_0x2203('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x2203('0xe')]('/:id',auth[_0x2203('0x9')](),controller[_0x2203('0xf')]);router[_0x2203('0x10')]('/:id',auth[_0x2203('0x9')](),controller['destroy']);module[_0x2203('0x11')]=router; \ No newline at end of file +var _0xda2d=['isAuthenticated','index','/:id','show','post','create','put','update','delete','destroy','exports','util','path','connect-timeout','express','Router','../../config/environment','./squareMessage.controller','get'];(function(_0xe7d24e,_0x235022){var _0x42c6e3=function(_0x7fe642){while(--_0x7fe642){_0xe7d24e['push'](_0xe7d24e['shift']());}};_0x42c6e3(++_0x235022);}(_0xda2d,0x102));var _0xdda2=function(_0x35730c,_0x4066d6){_0x35730c=_0x35730c-0x0;var _0x91ea14=_0xda2d[_0x35730c];return _0x91ea14;};'use strict';var multer=require('multer');var util=require(_0xdda2('0x0'));var path=require(_0xdda2('0x1'));var timeout=require(_0xdda2('0x2'));var express=require(_0xdda2('0x3'));var router=express[_0xdda2('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xdda2('0x5'));var controller=require(_0xdda2('0x6'));router[_0xdda2('0x7')]('/',auth[_0xdda2('0x8')](),controller[_0xdda2('0x9')]);router[_0xdda2('0x7')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0xb')]);router[_0xdda2('0xc')]('/',auth['isAuthenticated'](),controller[_0xdda2('0xd')]);router[_0xdda2('0xe')]('/:id',auth[_0xdda2('0x8')](),controller[_0xdda2('0xf')]);router[_0xdda2('0x10')](_0xdda2('0xa'),auth[_0xdda2('0x8')](),controller[_0xdda2('0x11')]);module[_0xdda2('0x12')]=router; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.attributes.js b/server/api/squareMessage/squareMessage.attributes.js index 791d57e..2ae5892 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 _0x8428=['exports','STRING','TEXT','ENUM','out'];(function(_0x558ba0,_0x235b91){var _0x27b5a5=function(_0xd2957c){while(--_0xd2957c){_0x558ba0['push'](_0x558ba0['shift']());}};_0x27b5a5(++_0x235b91);}(_0x8428,0x91));var _0x8842=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8428[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');module[_0x8842('0x0')]={'uniqueid':{'type':Sequelize[_0x8842('0x1')]},'body':{'type':Sequelize[_0x8842('0x2')]('medium'),'allowNull':![]},'direction':{'type':Sequelize[_0x8842('0x3')]('in',_0x8842('0x4')),'defaultValue':_0x8842('0x4'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize[_0x8842('0x2')]}}; \ No newline at end of file +var _0xd84e=['TEXT','medium','ENUM','out','exports','STRING'];(function(_0x29cb88,_0x36e887){var _0x7988a7=function(_0x3de7f5){while(--_0x3de7f5){_0x29cb88['push'](_0x29cb88['shift']());}};_0x7988a7(++_0x36e887);}(_0xd84e,0x166));var _0xed84=function(_0x55a133,_0x13a97f){_0x55a133=_0x55a133-0x0;var _0x318478=_0xd84e[_0x55a133];return _0x318478;};'use strict';var Sequelize=require('sequelize');module[_0xed84('0x0')]={'uniqueid':{'type':Sequelize[_0xed84('0x1')]},'body':{'type':Sequelize[_0xed84('0x2')](_0xed84('0x3')),'allowNull':![]},'direction':{'type':Sequelize[_0xed84('0x4')]('in','out'),'defaultValue':_0xed84('0x5'),'allowNull':![]},'providerName':{'type':Sequelize['STRING']},'providerResponse':{'type':Sequelize['TEXT']}}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.controller.js b/server/api/squareMessage/squareMessage.controller.js index 73af279..4a4b84e 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 _0xf7a8=['fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','offset','order','filters','merge','map','VIRTUAL','filter','options','includeAll','include','findAll','rows','params','rawAttributes','find','catch','create','body','update','eml-format','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','sendStatus','status','json','limit','undefined','count','set','Content-Range','apply','save','then','destroy','end','error','name','send','SquareMessage'];(function(_0x552200,_0xa152){var _0x332a63=function(_0x8d0708){while(--_0x8d0708){_0x552200['push'](_0x552200['shift']());}};_0x332a63(++_0xa152);}(_0xf7a8,0xfa));var _0x8f7a=function(_0x32c2ce,_0x405a52){_0x32c2ce=_0x32c2ce-0x0;var _0x10311d=_0xf7a8[_0x32c2ce];return _0x10311d;};'use strict';var emlformat=require(_0x8f7a('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x8f7a('0x1'));var jsonpatch=require(_0x8f7a('0x2'));var rp=require('request-promise');var moment=require(_0x8f7a('0x3'));var BPromise=require(_0x8f7a('0x4'));var Mustache=require(_0x8f7a('0x5'));var util=require(_0x8f7a('0x6'));var path=require(_0x8f7a('0x7'));var sox=require(_0x8f7a('0x8'));var csv=require(_0x8f7a('0x9'));var ejs=require(_0x8f7a('0xa'));var fs=require('fs');var fs_extra=require(_0x8f7a('0xb'));var _=require(_0x8f7a('0xc'));var squel=require(_0x8f7a('0xd'));var crypto=require(_0x8f7a('0xe'));var jsforce=require(_0x8f7a('0xf'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x8f7a('0x10'));var Papa=require(_0x8f7a('0x11'));var Redis=require(_0x8f7a('0x12'));var authService=require(_0x8f7a('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x8f7a('0x14'));var hardwareService=require(_0x8f7a('0x15'));var logger=require(_0x8f7a('0x16'))(_0x8f7a('0x17'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x8f7a('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5e9970,_0xaeffea){_0xaeffea=_0xaeffea||0xcc;return function(_0x25c91d){if(_0x25c91d){return _0x5e9970[_0x8f7a('0x19')](_0xaeffea);}return _0x5e9970['status'](_0xaeffea)['end']();};}function respondWithResult(_0x280f7e,_0x1448c1){_0x1448c1=_0x1448c1||0xc8;return function(_0x50fc94){if(_0x50fc94){return _0x280f7e[_0x8f7a('0x1a')](_0x1448c1)[_0x8f7a('0x1b')](_0x50fc94);}};}function respondWithFilteredResult(_0x3f9005,_0x39907f){return function(_0x4a7da7){if(_0x4a7da7){var _0x19da9b=typeof _0x39907f['offset']==='undefined'&&typeof _0x39907f[_0x8f7a('0x1c')]===_0x8f7a('0x1d');var _0x591144=_0x4a7da7[_0x8f7a('0x1e')];var _0x49cf6e=_0x19da9b?0x0:_0x39907f['offset'];var _0x9702f8=_0x19da9b?_0x4a7da7['count']:_0x39907f['offset']+_0x39907f['limit'];var _0xc236de;if(_0x9702f8>=_0x591144){_0x9702f8=_0x591144;_0xc236de=0xc8;}else{_0xc236de=0xce;}_0x3f9005['status'](_0xc236de);return _0x3f9005[_0x8f7a('0x1f')](_0x8f7a('0x20'),_0x49cf6e+'-'+_0x9702f8+'/'+_0x591144)[_0x8f7a('0x1b')](_0x4a7da7);}return null;};}function patchUpdates(_0x3048eb){return function(_0x1b851e){try{jsonpatch[_0x8f7a('0x21')](_0x1b851e,_0x3048eb,!![]);}catch(_0x2fcbb7){return BPromise['reject'](_0x2fcbb7);}return _0x1b851e[_0x8f7a('0x22')]();};}function saveUpdates(_0x386c33,_0x4e4fa4){return function(_0x219592){if(_0x219592){return _0x219592['update'](_0x386c33)[_0x8f7a('0x23')](function(_0x5b797){return _0x5b797;});}return null;};}function removeEntity(_0x45c1c7,_0x52c6b1){return function(_0xde5147){if(_0xde5147){return _0xde5147[_0x8f7a('0x24')]()[_0x8f7a('0x23')](function(){_0x45c1c7[_0x8f7a('0x1a')](0xcc)[_0x8f7a('0x25')]();});}};}function handleEntityNotFound(_0x53b837,_0x3bc543){return function(_0x668189){if(!_0x668189){_0x53b837[_0x8f7a('0x19')](0x194);}return _0x668189;};}function handleError(_0x24c049,_0x3a26c4){_0x3a26c4=_0x3a26c4||0x1f4;return function(_0x5e6ccb){logger[_0x8f7a('0x26')](_0x5e6ccb['stack']);if(_0x5e6ccb[_0x8f7a('0x27')]){delete _0x5e6ccb[_0x8f7a('0x27')];}_0x24c049[_0x8f7a('0x1a')](_0x3a26c4)[_0x8f7a('0x28')](_0x5e6ccb);};}exports['index']=function(_0x15ca12,_0x4c8739){var _0x5650e9={},_0x37389c={},_0x2cd36c={'count':0x0,'rows':[]};var _0x17c557=_['map'](db[_0x8f7a('0x29')]['rawAttributes'],function(_0x1ce9da){return{'name':_0x1ce9da[_0x8f7a('0x2a')],'type':_0x1ce9da[_0x8f7a('0x2b')][_0x8f7a('0x2c')]};});_0x37389c[_0x8f7a('0x2d')]=_['map'](_0x17c557,_0x8f7a('0x27'));_0x37389c[_0x8f7a('0x2e')]=_[_0x8f7a('0x2f')](_0x15ca12['query']);_0x37389c['filters']=_[_0x8f7a('0x30')](_0x37389c[_0x8f7a('0x2d')],_0x37389c[_0x8f7a('0x2e')]);_0x5650e9[_0x8f7a('0x31')]=_[_0x8f7a('0x30')](_0x37389c['model'],qs[_0x8f7a('0x32')](_0x15ca12['query'][_0x8f7a('0x32')]));_0x5650e9[_0x8f7a('0x31')]=_0x5650e9[_0x8f7a('0x31')][_0x8f7a('0x33')]?_0x5650e9['attributes']:_0x37389c[_0x8f7a('0x2d')];if(!_0x15ca12[_0x8f7a('0x2e')][_0x8f7a('0x34')](_0x8f7a('0x35'))){_0x5650e9[_0x8f7a('0x1c')]=qs[_0x8f7a('0x1c')](_0x15ca12[_0x8f7a('0x2e')][_0x8f7a('0x1c')]);_0x5650e9[_0x8f7a('0x36')]=qs['offset'](_0x15ca12[_0x8f7a('0x2e')][_0x8f7a('0x36')]);}_0x5650e9[_0x8f7a('0x37')]=qs['sort'](_0x15ca12[_0x8f7a('0x2e')]['sort']);_0x5650e9['where']=qs[_0x8f7a('0x38')](_['pick'](_0x15ca12[_0x8f7a('0x2e')],_0x37389c[_0x8f7a('0x38')]),_0x17c557);if(_0x15ca12['query']['filter']){_0x5650e9['where']=_[_0x8f7a('0x39')](_0x5650e9['where'],{'$or':_[_0x8f7a('0x3a')](_0x17c557,function(_0x456465){if(_0x456465[_0x8f7a('0x2b')]!==_0x8f7a('0x3b')){var _0x1e920c={};_0x1e920c[_0x456465[_0x8f7a('0x27')]]={'$like':'%'+_0x15ca12[_0x8f7a('0x2e')][_0x8f7a('0x3c')]+'%'};return _0x1e920c;}})});}_0x5650e9=_[_0x8f7a('0x39')]({},_0x5650e9,_0x15ca12[_0x8f7a('0x3d')]);var _0x218e3d={'where':_0x5650e9['where']};return db[_0x8f7a('0x29')][_0x8f7a('0x1e')](_0x218e3d)[_0x8f7a('0x23')](function(_0x2e9c4c){_0x2cd36c[_0x8f7a('0x1e')]=_0x2e9c4c;if(_0x15ca12[_0x8f7a('0x2e')][_0x8f7a('0x3e')]){_0x5650e9[_0x8f7a('0x3f')]=[{'all':!![]}];}return db[_0x8f7a('0x29')][_0x8f7a('0x40')](_0x5650e9);})[_0x8f7a('0x23')](function(_0xd03542){_0x2cd36c[_0x8f7a('0x41')]=_0xd03542;return _0x2cd36c;})[_0x8f7a('0x23')](respondWithFilteredResult(_0x4c8739,_0x5650e9))['catch'](handleError(_0x4c8739,null));};exports['show']=function(_0x2b47f0,_0x3a80b1){var _0x110ac0={'raw':!![],'where':{'id':_0x2b47f0[_0x8f7a('0x42')]['id']}},_0x3aa322={};_0x3aa322[_0x8f7a('0x2d')]=_['keys'](db[_0x8f7a('0x29')][_0x8f7a('0x43')]);_0x3aa322['query']=_[_0x8f7a('0x2f')](_0x2b47f0['query']);_0x3aa322[_0x8f7a('0x38')]=_[_0x8f7a('0x30')](_0x3aa322[_0x8f7a('0x2d')],_0x3aa322[_0x8f7a('0x2e')]);_0x110ac0[_0x8f7a('0x31')]=_[_0x8f7a('0x30')](_0x3aa322[_0x8f7a('0x2d')],qs[_0x8f7a('0x32')](_0x2b47f0['query'][_0x8f7a('0x32')]));_0x110ac0[_0x8f7a('0x31')]=_0x110ac0[_0x8f7a('0x31')][_0x8f7a('0x33')]?_0x110ac0[_0x8f7a('0x31')]:_0x3aa322[_0x8f7a('0x2d')];if(_0x2b47f0['query']['includeAll']){_0x110ac0[_0x8f7a('0x3f')]=[{'all':!![]}];}_0x110ac0=_[_0x8f7a('0x39')]({},_0x110ac0,_0x2b47f0[_0x8f7a('0x3d')]);return db[_0x8f7a('0x29')][_0x8f7a('0x44')](_0x110ac0)[_0x8f7a('0x23')](handleEntityNotFound(_0x3a80b1,null))[_0x8f7a('0x23')](respondWithResult(_0x3a80b1,null))[_0x8f7a('0x45')](handleError(_0x3a80b1,null));};exports[_0x8f7a('0x46')]=function(_0x272eab,_0x287d29){return db[_0x8f7a('0x29')]['create'](_0x272eab[_0x8f7a('0x47')],{})[_0x8f7a('0x23')](respondWithResult(_0x287d29,0xc9))['catch'](handleError(_0x287d29,null));};exports[_0x8f7a('0x48')]=function(_0x5ad5c5,_0x32473f){if(_0x5ad5c5[_0x8f7a('0x47')]['id']){delete _0x5ad5c5[_0x8f7a('0x47')]['id'];}return db[_0x8f7a('0x29')][_0x8f7a('0x44')]({'where':{'id':_0x5ad5c5[_0x8f7a('0x42')]['id']}})[_0x8f7a('0x23')](handleEntityNotFound(_0x32473f,null))[_0x8f7a('0x23')](saveUpdates(_0x5ad5c5[_0x8f7a('0x47')],null))['then'](respondWithResult(_0x32473f,null))['catch'](handleError(_0x32473f,null));};exports[_0x8f7a('0x24')]=function(_0x26bc51,_0x5db888){return db[_0x8f7a('0x29')][_0x8f7a('0x44')]({'where':{'id':_0x26bc51['params']['id']}})['then'](handleEntityNotFound(_0x5db888,null))[_0x8f7a('0x23')](removeEntity(_0x5db888,null))[_0x8f7a('0x45')](handleError(_0x5db888,null));}; \ No newline at end of file +var _0xf628=['util','path','sox','to-csv','fs-extra','squel','crypto','desk.js','querystring','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','count','limit','set','json','update','destroy','stack','name','send','index','map','rawAttributes','fieldName','type','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','VIRTUAL','merge','options','then','includeAll','include','SquareMessage','findAll','rows','catch','length','create','body','find','params','eml-format','rimraf','zip-dir','fast-json-patch','mustache'];(function(_0x3bb45b,_0x2dcc0b){var _0x513162=function(_0x46f44b){while(--_0x46f44b){_0x3bb45b['push'](_0x3bb45b['shift']());}};_0x513162(++_0x2dcc0b);}(_0xf628,0x7f));var _0x8f62=function(_0x5aac40,_0x592695){_0x5aac40=_0x5aac40-0x0;var _0x157d54=_0xf628[_0x5aac40];return _0x157d54;};'use strict';var emlformat=require(_0x8f62('0x0'));var rimraf=require(_0x8f62('0x1'));var zipdir=require(_0x8f62('0x2'));var jsonpatch=require(_0x8f62('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x8f62('0x4'));var util=require(_0x8f62('0x5'));var path=require(_0x8f62('0x6'));var sox=require(_0x8f62('0x7'));var csv=require(_0x8f62('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x8f62('0x9'));var _=require('lodash');var squel=require(_0x8f62('0xa'));var crypto=require(_0x8f62('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x8f62('0xc'));var toCsv=require(_0x8f62('0x8'));var querystring=require(_0x8f62('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8f62('0xe'));var logger=require(_0x8f62('0xf'))('api');var utils=require(_0x8f62('0x10'));var config=require(_0x8f62('0x11'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x5260c8,_0x371d3d){_0x371d3d=_0x371d3d||0xcc;return function(_0x2aab6e){if(_0x2aab6e){return _0x5260c8[_0x8f62('0x12')](_0x371d3d);}return _0x5260c8[_0x8f62('0x13')](_0x371d3d)[_0x8f62('0x14')]();};}function respondWithResult(_0x377dfd,_0x4756a3){_0x4756a3=_0x4756a3||0xc8;return function(_0x545116){if(_0x545116){return _0x377dfd[_0x8f62('0x13')](_0x4756a3)['json'](_0x545116);}};}function respondWithFilteredResult(_0x43dd50,_0x58a7d7){return function(_0xbe2da7){if(_0xbe2da7){var _0x35cf5f=typeof _0x58a7d7[_0x8f62('0x15')]===_0x8f62('0x16')&&typeof _0x58a7d7['limit']===_0x8f62('0x16');var _0x2b02d6=_0xbe2da7['count'];var _0x4bf0d3=_0x35cf5f?0x0:_0x58a7d7[_0x8f62('0x15')];var _0x4dd4fd=_0x35cf5f?_0xbe2da7[_0x8f62('0x17')]:_0x58a7d7['offset']+_0x58a7d7[_0x8f62('0x18')];var _0xde5808;if(_0x4dd4fd>=_0x2b02d6){_0x4dd4fd=_0x2b02d6;_0xde5808=0xc8;}else{_0xde5808=0xce;}_0x43dd50[_0x8f62('0x13')](_0xde5808);return _0x43dd50[_0x8f62('0x19')]('Content-Range',_0x4bf0d3+'-'+_0x4dd4fd+'/'+_0x2b02d6)[_0x8f62('0x1a')](_0xbe2da7);}return null;};}function patchUpdates(_0x5071d6){return function(_0x50fc4b){try{jsonpatch['apply'](_0x50fc4b,_0x5071d6,!![]);}catch(_0x398c08){return BPromise['reject'](_0x398c08);}return _0x50fc4b['save']();};}function saveUpdates(_0x578eee,_0x295de6){return function(_0x475b13){if(_0x475b13){return _0x475b13[_0x8f62('0x1b')](_0x578eee)['then'](function(_0x50f9cd){return _0x50f9cd;});}return null;};}function removeEntity(_0x329dae,_0x4a0935){return function(_0x276b02){if(_0x276b02){return _0x276b02[_0x8f62('0x1c')]()['then'](function(){_0x329dae['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4a436c,_0x24e6ac){return function(_0x72b937){if(!_0x72b937){_0x4a436c['sendStatus'](0x194);}return _0x72b937;};}function handleError(_0x199bdc,_0x2d5017){_0x2d5017=_0x2d5017||0x1f4;return function(_0x4a6b21){logger['error'](_0x4a6b21[_0x8f62('0x1d')]);if(_0x4a6b21[_0x8f62('0x1e')]){delete _0x4a6b21[_0x8f62('0x1e')];}_0x199bdc[_0x8f62('0x13')](_0x2d5017)[_0x8f62('0x1f')](_0x4a6b21);};}exports[_0x8f62('0x20')]=function(_0x2a0000,_0x2ca228){var _0x5b9961={},_0x39d684={},_0x60251f={'count':0x0,'rows':[]};var _0x4b462b=_[_0x8f62('0x21')](db['SquareMessage'][_0x8f62('0x22')],function(_0x1a6510){return{'name':_0x1a6510[_0x8f62('0x23')],'type':_0x1a6510[_0x8f62('0x24')][_0x8f62('0x25')]};});_0x39d684['model']=_[_0x8f62('0x21')](_0x4b462b,_0x8f62('0x1e'));_0x39d684['query']=_[_0x8f62('0x26')](_0x2a0000[_0x8f62('0x27')]);_0x39d684[_0x8f62('0x28')]=_[_0x8f62('0x29')](_0x39d684[_0x8f62('0x2a')],_0x39d684[_0x8f62('0x27')]);_0x5b9961[_0x8f62('0x2b')]=_[_0x8f62('0x29')](_0x39d684[_0x8f62('0x2a')],qs[_0x8f62('0x2c')](_0x2a0000[_0x8f62('0x27')][_0x8f62('0x2c')]));_0x5b9961[_0x8f62('0x2b')]=_0x5b9961['attributes']['length']?_0x5b9961[_0x8f62('0x2b')]:_0x39d684[_0x8f62('0x2a')];if(!_0x2a0000[_0x8f62('0x27')][_0x8f62('0x2d')]('nolimit')){_0x5b9961[_0x8f62('0x18')]=qs[_0x8f62('0x18')](_0x2a0000[_0x8f62('0x27')]['limit']);_0x5b9961[_0x8f62('0x15')]=qs[_0x8f62('0x15')](_0x2a0000[_0x8f62('0x27')][_0x8f62('0x15')]);}_0x5b9961[_0x8f62('0x2e')]=qs[_0x8f62('0x2f')](_0x2a0000['query']['sort']);_0x5b9961[_0x8f62('0x30')]=qs['filters'](_[_0x8f62('0x31')](_0x2a0000[_0x8f62('0x27')],_0x39d684['filters']),_0x4b462b);if(_0x2a0000['query'][_0x8f62('0x32')]){_0x5b9961[_0x8f62('0x30')]=_['merge'](_0x5b9961[_0x8f62('0x30')],{'$or':_[_0x8f62('0x21')](_0x4b462b,function(_0x3b05a2){if(_0x3b05a2[_0x8f62('0x24')]!==_0x8f62('0x33')){var _0x2c3b85={};_0x2c3b85[_0x3b05a2['name']]={'$like':'%'+_0x2a0000[_0x8f62('0x27')][_0x8f62('0x32')]+'%'};return _0x2c3b85;}})});}_0x5b9961=_[_0x8f62('0x34')]({},_0x5b9961,_0x2a0000[_0x8f62('0x35')]);var _0x326b3c={'where':_0x5b9961['where']};return db['SquareMessage'][_0x8f62('0x17')](_0x326b3c)[_0x8f62('0x36')](function(_0x159cdd){_0x60251f['count']=_0x159cdd;if(_0x2a0000['query'][_0x8f62('0x37')]){_0x5b9961[_0x8f62('0x38')]=[{'all':!![]}];}return db[_0x8f62('0x39')][_0x8f62('0x3a')](_0x5b9961);})[_0x8f62('0x36')](function(_0x5bf579){_0x60251f[_0x8f62('0x3b')]=_0x5bf579;return _0x60251f;})[_0x8f62('0x36')](respondWithFilteredResult(_0x2ca228,_0x5b9961))[_0x8f62('0x3c')](handleError(_0x2ca228,null));};exports['show']=function(_0x5be14b,_0x33e6dc){var _0x591017={'raw':!![],'where':{'id':_0x5be14b['params']['id']}},_0x3b2c68={};_0x3b2c68['model']=_[_0x8f62('0x26')](db['SquareMessage'][_0x8f62('0x22')]);_0x3b2c68[_0x8f62('0x27')]=_[_0x8f62('0x26')](_0x5be14b[_0x8f62('0x27')]);_0x3b2c68[_0x8f62('0x28')]=_[_0x8f62('0x29')](_0x3b2c68[_0x8f62('0x2a')],_0x3b2c68['query']);_0x591017[_0x8f62('0x2b')]=_['intersection'](_0x3b2c68['model'],qs[_0x8f62('0x2c')](_0x5be14b[_0x8f62('0x27')]['fields']));_0x591017[_0x8f62('0x2b')]=_0x591017['attributes'][_0x8f62('0x3d')]?_0x591017[_0x8f62('0x2b')]:_0x3b2c68[_0x8f62('0x2a')];if(_0x5be14b[_0x8f62('0x27')][_0x8f62('0x37')]){_0x591017[_0x8f62('0x38')]=[{'all':!![]}];}_0x591017=_[_0x8f62('0x34')]({},_0x591017,_0x5be14b[_0x8f62('0x35')]);return db['SquareMessage']['find'](_0x591017)[_0x8f62('0x36')](handleEntityNotFound(_0x33e6dc,null))['then'](respondWithResult(_0x33e6dc,null))[_0x8f62('0x3c')](handleError(_0x33e6dc,null));};exports[_0x8f62('0x3e')]=function(_0x29db79,_0x4ab21e){return db['SquareMessage'][_0x8f62('0x3e')](_0x29db79[_0x8f62('0x3f')],{})[_0x8f62('0x36')](respondWithResult(_0x4ab21e,0xc9))[_0x8f62('0x3c')](handleError(_0x4ab21e,null));};exports[_0x8f62('0x1b')]=function(_0x27f50b,_0x397c57){if(_0x27f50b[_0x8f62('0x3f')]['id']){delete _0x27f50b[_0x8f62('0x3f')]['id'];}return db[_0x8f62('0x39')][_0x8f62('0x40')]({'where':{'id':_0x27f50b['params']['id']}})[_0x8f62('0x36')](handleEntityNotFound(_0x397c57,null))[_0x8f62('0x36')](saveUpdates(_0x27f50b[_0x8f62('0x3f')],null))[_0x8f62('0x36')](respondWithResult(_0x397c57,null))['catch'](handleError(_0x397c57,null));};exports[_0x8f62('0x1c')]=function(_0x3dd828,_0x7a03e7){return db[_0x8f62('0x39')][_0x8f62('0x40')]({'where':{'id':_0x3dd828[_0x8f62('0x41')]['id']}})[_0x8f62('0x36')](handleEntityNotFound(_0x7a03e7,null))[_0x8f62('0x36')](removeEntity(_0x7a03e7,null))[_0x8f62('0x3c')](handleError(_0x7a03e7,null));}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.model.js b/server/api/squareMessage/squareMessage.model.js index 11237bd..d2a2e85 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 _0x8ccc=['square_messages','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','define','SquareMessage'];(function(_0x1218c2,_0x3fe72d){var _0xba222c=function(_0x2873c7){while(--_0x2873c7){_0x1218c2['push'](_0x1218c2['shift']());}};_0xba222c(++_0x3fe72d);}(_0x8ccc,0x1b9));var _0xc8cc=function(_0x28b389,_0x302fc3){_0x28b389=_0x28b389-0x0;var _0x4ca159=_0x8ccc[_0x28b389];return _0x4ca159;};'use strict';var _=require('lodash');var util=require(_0xc8cc('0x0'));var logger=require(_0xc8cc('0x1'))(_0xc8cc('0x2'));var moment=require(_0xc8cc('0x3'));var BPromise=require('bluebird');var rp=require(_0xc8cc('0x4'));var fs=require('fs');var path=require(_0xc8cc('0x5'));var rimraf=require(_0xc8cc('0x6'));var config=require(_0xc8cc('0x7'));var attributes=require('./squareMessage.attributes');module['exports']=function(_0x536212,_0x4e83c4){return _0x536212[_0xc8cc('0x8')](_0xc8cc('0x9'),attributes,{'tableName':_0xc8cc('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x9cf8=['exports','define','SquareMessage','lodash','util','api','moment','request-promise','rimraf'];(function(_0x34d346,_0x4c6502){var _0x122d76=function(_0x22a5fd){while(--_0x22a5fd){_0x34d346['push'](_0x34d346['shift']());}};_0x122d76(++_0x4c6502);}(_0x9cf8,0x150));var _0x89cf=function(_0x467be3,_0x5622da){_0x467be3=_0x467be3-0x0;var _0x4313fe=_0x9cf8[_0x467be3];return _0x4313fe;};'use strict';var _=require(_0x89cf('0x0'));var util=require(_0x89cf('0x1'));var logger=require('../../config/logger')(_0x89cf('0x2'));var moment=require(_0x89cf('0x3'));var BPromise=require('bluebird');var rp=require(_0x89cf('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0x89cf('0x5'));var config=require('../../config/environment');var attributes=require('./squareMessage.attributes');module[_0x89cf('0x6')]=function(_0x54b90b,_0x3969c3){return _0x54b90b[_0x89cf('0x7')](_0x89cf('0x8'),attributes,{'tableName':'square_messages','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareMessage/squareMessage.rpc.js b/server/api/squareMessage/squareMessage.rpc.js index a704a40..d698e03 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 _0xfdfd=['../../config/environment','client','request','then','request\x20sent','SquareMessage,\x20%s,\x20%s,\x20%s','error','SquareMessage,\x20%s,\x20%s','message','info','catch','CreateSquareMessage','SquareMessage','create','raw','debug','stringify','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x184759,_0x1cc38a){var _0xf26d5f=function(_0x1010c8){while(--_0x1010c8){_0x184759['push'](_0x184759['shift']());}};_0xf26d5f(++_0x1cc38a);}(_0xfdfd,0xc7));var _0xdfdf=function(_0x3f8abf,_0x22e23a){_0x3f8abf=_0x3f8abf-0x0;var _0x1e2169=_0xfdfd[_0x3f8abf];return _0x1e2169;};'use strict';var _=require(_0xdfdf('0x0'));var util=require(_0xdfdf('0x1'));var moment=require('moment');var BPromise=require(_0xdfdf('0x2'));var rs=require(_0xdfdf('0x3'));var fs=require('fs');var Redis=require(_0xdfdf('0x4'));var db=require(_0xdfdf('0x5'))['db'];var utils=require(_0xdfdf('0x6'));var logger=require(_0xdfdf('0x7'))(_0xdfdf('0x8'));var config=require(_0xdfdf('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xdfdf('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a0591,_0x37b06e,_0x5dffae){return new BPromise(function(_0x367209,_0x82831c){return client[_0xdfdf('0xb')](_0x4a0591,_0x5dffae)[_0xdfdf('0xc')](function(_0x19d4b0){logger['info']('SquareMessage,\x20%s,\x20%s',_0x37b06e,_0xdfdf('0xd'));logger['debug'](_0xdfdf('0xe'),_0x37b06e,'request\x20sent',JSON['stringify'](_0x19d4b0));if(_0x19d4b0[_0xdfdf('0xf')]){if(_0x19d4b0['error']['code']===0x1f4){logger[_0xdfdf('0xf')](_0xdfdf('0x10'),_0x37b06e,_0x19d4b0[_0xdfdf('0xf')][_0xdfdf('0x11')]);return _0x82831c(_0x19d4b0[_0xdfdf('0xf')]['message']);}logger[_0xdfdf('0xf')](_0xdfdf('0x10'),_0x37b06e,_0x19d4b0[_0xdfdf('0xf')][_0xdfdf('0x11')]);return _0x367209(_0x19d4b0['error']['message']);}else{logger[_0xdfdf('0x12')]('SquareMessage,\x20%s,\x20%s',_0x37b06e,_0xdfdf('0xd'));_0x367209(_0x19d4b0['result'][_0xdfdf('0x11')]);}})[_0xdfdf('0x13')](function(_0x255b17){logger[_0xdfdf('0xf')](_0xdfdf('0x10'),_0x37b06e,_0x255b17);_0x82831c(_0x255b17);});});}exports[_0xdfdf('0x14')]=function(_0x970859){var _0x2ca8e8=this;return new Promise(function(_0x25a2d3,_0x39b107){return db[_0xdfdf('0x15')][_0xdfdf('0x16')](_0x970859['body'],{'raw':_0x970859['options']?_0x970859['options'][_0xdfdf('0x17')]===undefined?!![]:![]:!![]})['then'](function(_0x115dc5){logger[_0xdfdf('0x12')](_0xdfdf('0x14'),_0x970859);logger[_0xdfdf('0x18')](_0xdfdf('0x14'),_0x970859,JSON[_0xdfdf('0x19')](_0x115dc5));_0x25a2d3(_0x115dc5);})[_0xdfdf('0x13')](function(_0x50c96a){logger['error'](_0xdfdf('0x14'),_0x50c96a[_0xdfdf('0x11')],_0x970859);_0x39b107(_0x2ca8e8[_0xdfdf('0xf')](0x1f4,_0x50c96a[_0xdfdf('0x11')]));});});}; \ No newline at end of file +var _0x749d=['error','code','message','result','catch','CreateSquareMessage','SquareMessage','body','options','lodash','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','SquareMessage,\x20%s,\x20%s','request\x20sent','debug','stringify'];(function(_0x3861e2,_0x2a08fa){var _0xce1fda=function(_0x492a76){while(--_0x492a76){_0x3861e2['push'](_0x3861e2['shift']());}};_0xce1fda(++_0x2a08fa);}(_0x749d,0x183));var _0xd749=function(_0x4e2b73,_0x5dfde9){_0x4e2b73=_0x4e2b73-0x0;var _0xa03b99=_0x749d[_0x4e2b73];return _0xa03b99;};'use strict';var _=require(_0xd749('0x0'));var util=require(_0xd749('0x1'));var moment=require('moment');var BPromise=require(_0xd749('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd749('0x3'));var db=require(_0xd749('0x4'))['db'];var utils=require(_0xd749('0x5'));var logger=require(_0xd749('0x6'))(_0xd749('0x7'));var config=require('../../config/environment');var jayson=require(_0xd749('0x8'));var client=jayson[_0xd749('0x9')][_0xd749('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5942c8,_0x430f7f,_0x55c23d){return new BPromise(function(_0x3ccbae,_0x5daa09){return client[_0xd749('0xb')](_0x5942c8,_0x55c23d)[_0xd749('0xc')](function(_0xf325db){logger[_0xd749('0xd')](_0xd749('0xe'),_0x430f7f,_0xd749('0xf'));logger[_0xd749('0x10')]('SquareMessage,\x20%s,\x20%s,\x20%s',_0x430f7f,_0xd749('0xf'),JSON[_0xd749('0x11')](_0xf325db));if(_0xf325db['error']){if(_0xf325db[_0xd749('0x12')][_0xd749('0x13')]===0x1f4){logger[_0xd749('0x12')](_0xd749('0xe'),_0x430f7f,_0xf325db[_0xd749('0x12')][_0xd749('0x14')]);return _0x5daa09(_0xf325db[_0xd749('0x12')]['message']);}logger[_0xd749('0x12')](_0xd749('0xe'),_0x430f7f,_0xf325db[_0xd749('0x12')][_0xd749('0x14')]);return _0x3ccbae(_0xf325db[_0xd749('0x12')][_0xd749('0x14')]);}else{logger[_0xd749('0xd')]('SquareMessage,\x20%s,\x20%s',_0x430f7f,_0xd749('0xf'));_0x3ccbae(_0xf325db[_0xd749('0x15')][_0xd749('0x14')]);}})[_0xd749('0x16')](function(_0x142804){logger['error'](_0xd749('0xe'),_0x430f7f,_0x142804);_0x5daa09(_0x142804);});});}exports[_0xd749('0x17')]=function(_0x502803){var _0x548ef7=this;return new Promise(function(_0x2e1ba1,_0x5715d9){return db[_0xd749('0x18')]['create'](_0x502803[_0xd749('0x19')],{'raw':_0x502803[_0xd749('0x1a')]?_0x502803['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x4b787f){logger[_0xd749('0xd')](_0xd749('0x17'),_0x502803);logger[_0xd749('0x10')](_0xd749('0x17'),_0x502803,JSON['stringify'](_0x4b787f));_0x2e1ba1(_0x4b787f);})[_0xd749('0x16')](function(_0x4d96bc){logger[_0xd749('0x12')](_0xd749('0x17'),_0x4d96bc[_0xd749('0x14')],_0x502803);_0x5715d9(_0x548ef7[_0xd749('0x12')](0x1f4,_0x4d96bc[_0xd749('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareOdbc/index.js b/server/api/squareOdbc/index.js index 37ae4f7..ecc1165 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 _0xfd23=['../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','index','isAuthenticated','show','/:id/test','15s','test','post','create','put','/:id','update','delete','exports','multer','util','express','Router','fs-extra'];(function(_0xb0f7c3,_0x4eae95){var _0x28ea68=function(_0x4395a7){while(--_0x4395a7){_0xb0f7c3['push'](_0xb0f7c3['shift']());}};_0x28ea68(++_0x4eae95);}(_0xfd23,0x9c));var _0x3fd2=function(_0x20a558,_0x160e0e){_0x20a558=_0x20a558-0x0;var _0x53d3f7=_0xfd23[_0x20a558];return _0x53d3f7;};'use strict';var multer=require(_0x3fd2('0x0'));var util=require(_0x3fd2('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x3fd2('0x2'));var router=express[_0x3fd2('0x3')]();var fs_extra=require(_0x3fd2('0x4'));var auth=require(_0x3fd2('0x5'));var interaction=require(_0x3fd2('0x6'));var config=require(_0x3fd2('0x7'));var controller=require(_0x3fd2('0x8'));router[_0x3fd2('0x9')]('/',auth['isAuthenticated'](),controller[_0x3fd2('0xa')]);router[_0x3fd2('0x9')]('/:id',auth[_0x3fd2('0xb')](),controller[_0x3fd2('0xc')]);router[_0x3fd2('0x9')](_0x3fd2('0xd'),auth[_0x3fd2('0xb')](),timeout(_0x3fd2('0xe')),controller[_0x3fd2('0xf')]);router[_0x3fd2('0x10')]('/',auth[_0x3fd2('0xb')](),controller[_0x3fd2('0x11')]);router[_0x3fd2('0x12')](_0x3fd2('0x13'),auth['isAuthenticated'](),controller[_0x3fd2('0x14')]);router[_0x3fd2('0x15')](_0x3fd2('0x13'),auth[_0x3fd2('0xb')](),controller['destroy']);module[_0x3fd2('0x16')]=router; \ No newline at end of file +var _0xf03a=['create','put','destroy','exports','multer','path','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareOdbc.controller','get','isAuthenticated','index','/:id','show','/:id/test','test','post'];(function(_0x257083,_0x1d479a){var _0x47d7ff=function(_0x5361d4){while(--_0x5361d4){_0x257083['push'](_0x257083['shift']());}};_0x47d7ff(++_0x1d479a);}(_0xf03a,0x1a8));var _0xaf03=function(_0x1996c7,_0x43be9a){_0x1996c7=_0x1996c7-0x0;var _0x18e5fe=_0xf03a[_0x1996c7];return _0x18e5fe;};'use strict';var multer=require(_0xaf03('0x0'));var util=require('util');var path=require(_0xaf03('0x1'));var timeout=require(_0xaf03('0x2'));var express=require(_0xaf03('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0xaf03('0x4'));var interaction=require(_0xaf03('0x5'));var config=require(_0xaf03('0x6'));var controller=require(_0xaf03('0x7'));router[_0xaf03('0x8')]('/',auth[_0xaf03('0x9')](),controller[_0xaf03('0xa')]);router[_0xaf03('0x8')](_0xaf03('0xb'),auth[_0xaf03('0x9')](),controller[_0xaf03('0xc')]);router[_0xaf03('0x8')](_0xaf03('0xd'),auth[_0xaf03('0x9')](),timeout('15s'),controller[_0xaf03('0xe')]);router[_0xaf03('0xf')]('/',auth[_0xaf03('0x9')](),controller[_0xaf03('0x10')]);router[_0xaf03('0x11')](_0xaf03('0xb'),auth['isAuthenticated'](),controller['update']);router['delete']('/:id',auth[_0xaf03('0x9')](),controller[_0xaf03('0x12')]);module[_0xaf03('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.attributes.js b/server/api/squareOdbc/squareOdbc.attributes.js index f58b59b..f0db45f 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 _0x4504=['name','sequelize','STRING'];(function(_0x559fad,_0x4f905a){var _0x2dd50b=function(_0x4b604a){while(--_0x4b604a){_0x559fad['push'](_0x559fad['shift']());}};_0x2dd50b(++_0x4f905a);}(_0x4504,0x1a2));var _0x4450=function(_0x28d7c3,_0x5e47d4){_0x28d7c3=_0x28d7c3-0x0;var _0x59e143=_0x4504[_0x28d7c3];return _0x59e143;};'use strict';var Sequelize=require(_0x4450('0x0'));module['exports']={'name':{'type':Sequelize[_0x4450('0x1')],'unique':_0x4450('0x2'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x4318=['exports','STRING','name','sequelize'];(function(_0x21d658,_0x4c4422){var _0x1c38e8=function(_0x167e50){while(--_0x167e50){_0x21d658['push'](_0x21d658['shift']());}};_0x1c38e8(++_0x4c4422);}(_0x4318,0x117));var _0x8431=function(_0x4d7402,_0x5b9679){_0x4d7402=_0x4d7402-0x0;var _0x1addeb=_0x4318[_0x4d7402];return _0x1addeb;};'use strict';var Sequelize=require(_0x8431('0x0'));module[_0x8431('0x1')]={'name':{'type':Sequelize[_0x8431('0x2')],'unique':_0x8431('0x3'),'allowNull':![]},'dsn':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0x8431('0x2')]}}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.controller.js b/server/api/squareOdbc/squareOdbc.controller.js index 794a2a5..77d9500 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 _0x95a8=['crypto','jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','update','then','destroy','get','UserProfileResource','stack','name','send','index','map','SquareOdbc','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','catch','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','ODBC','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','test','openSync','dsn','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','fs-extra','lodash'];(function(_0x56bcff,_0x158e5f){var _0x340351=function(_0x3b7729){while(--_0x3b7729){_0x56bcff['push'](_0x56bcff['shift']());}};_0x340351(++_0x158e5f);}(_0x95a8,0xff));var _0x895a=function(_0x264341,_0x30f134){_0x264341=_0x264341-0x0;var _0x5c6408=_0x95a8[_0x264341];return _0x5c6408;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x895a('0x0'));var zipdir=require(_0x895a('0x1'));var jsonpatch=require(_0x895a('0x2'));var rp=require(_0x895a('0x3'));var moment=require(_0x895a('0x4'));var BPromise=require(_0x895a('0x5'));var Mustache=require(_0x895a('0x6'));var util=require(_0x895a('0x7'));var path=require(_0x895a('0x8'));var sox=require(_0x895a('0x9'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x895a('0xa'));var _=require(_0x895a('0xb'));var squel=require('squel');var crypto=require(_0x895a('0xc'));var jsforce=require(_0x895a('0xd'));var deskjs=require(_0x895a('0xe'));var toCsv=require(_0x895a('0xf'));var querystring=require(_0x895a('0x10'));var Papa=require(_0x895a('0x11'));var Redis=require(_0x895a('0x12'));var authService=require(_0x895a('0x13'));var qs=require(_0x895a('0x14'));var as=require(_0x895a('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x895a('0x16'));var utils=require('../../config/utils');var config=require(_0x895a('0x17'));var licenseUtil=require(_0x895a('0x18'));var db=require(_0x895a('0x19'))['db'];function respondWithStatusCode(_0x357d65,_0x540260){_0x540260=_0x540260||0xcc;return function(_0x44b399){if(_0x44b399){return _0x357d65[_0x895a('0x1a')](_0x540260);}return _0x357d65[_0x895a('0x1b')](_0x540260)[_0x895a('0x1c')]();};}function respondWithResult(_0x69b04f,_0x5e5310){_0x5e5310=_0x5e5310||0xc8;return function(_0x36bddf){if(_0x36bddf){return _0x69b04f[_0x895a('0x1b')](_0x5e5310)[_0x895a('0x1d')](_0x36bddf);}};}function respondWithFilteredResult(_0x18ac37,_0x31669e){return function(_0x33d4ee){if(_0x33d4ee){var _0x1b1081=typeof _0x31669e[_0x895a('0x1e')]===_0x895a('0x1f')&&typeof _0x31669e[_0x895a('0x20')]===_0x895a('0x1f');var _0x2fcbb8=_0x33d4ee['count'];var _0xe3831=_0x1b1081?0x0:_0x31669e['offset'];var _0x454533=_0x1b1081?_0x33d4ee['count']:_0x31669e[_0x895a('0x1e')]+_0x31669e[_0x895a('0x20')];var _0xbe570c;if(_0x454533>=_0x2fcbb8){_0x454533=_0x2fcbb8;_0xbe570c=0xc8;}else{_0xbe570c=0xce;}_0x18ac37[_0x895a('0x1b')](_0xbe570c);return _0x18ac37[_0x895a('0x21')](_0x895a('0x22'),_0xe3831+'-'+_0x454533+'/'+_0x2fcbb8)[_0x895a('0x1d')](_0x33d4ee);}return null;};}function patchUpdates(_0x4618cb){return function(_0x58a9b4){try{jsonpatch[_0x895a('0x23')](_0x58a9b4,_0x4618cb,!![]);}catch(_0x17d068){return BPromise[_0x895a('0x24')](_0x17d068);}return _0x58a9b4['save']();};}function saveUpdates(_0x145e5a,_0x245696){return function(_0x53f519){if(_0x53f519){return _0x53f519[_0x895a('0x25')](_0x145e5a)[_0x895a('0x26')](function(_0xbdc464){return _0xbdc464;});}return null;};}function removeEntity(_0x4e4c77,_0x58b339){return function(_0x59b880){if(_0x59b880){return _0x59b880[_0x895a('0x27')]()[_0x895a('0x26')](function(){var _0x1f7bca=_0x59b880[_0x895a('0x28')]({'plain':!![]});var _0x128e02='ODBC';return db[_0x895a('0x29')][_0x895a('0x27')]({'where':{'type':_0x128e02,'resourceId':_0x1f7bca['id']}})['then'](function(){return _0x59b880;});})['then'](function(){_0x4e4c77['status'](0xcc)[_0x895a('0x1c')]();});}};}function handleEntityNotFound(_0x5be467,_0x71e069){return function(_0x195d21){if(!_0x195d21){_0x5be467[_0x895a('0x1a')](0x194);}return _0x195d21;};}function handleError(_0x212d4d,_0x4f6ec7){_0x4f6ec7=_0x4f6ec7||0x1f4;return function(_0x3e2efb){logger['error'](_0x3e2efb[_0x895a('0x2a')]);if(_0x3e2efb[_0x895a('0x2b')]){delete _0x3e2efb['name'];}_0x212d4d[_0x895a('0x1b')](_0x4f6ec7)[_0x895a('0x2c')](_0x3e2efb);};}exports[_0x895a('0x2d')]=function(_0x483897,_0x3e5bdf){var _0x18a52c={},_0x4b4a3f={},_0x45a75f={'count':0x0,'rows':[]};var _0x4a1ac1=_[_0x895a('0x2e')](db[_0x895a('0x2f')][_0x895a('0x30')],function(_0x301d98){return{'name':_0x301d98[_0x895a('0x31')],'type':_0x301d98[_0x895a('0x32')][_0x895a('0x33')]};});_0x4b4a3f['model']=_['map'](_0x4a1ac1,_0x895a('0x2b'));_0x4b4a3f[_0x895a('0x34')]=_[_0x895a('0x35')](_0x483897[_0x895a('0x34')]);_0x4b4a3f[_0x895a('0x36')]=_[_0x895a('0x37')](_0x4b4a3f[_0x895a('0x38')],_0x4b4a3f[_0x895a('0x34')]);_0x18a52c[_0x895a('0x39')]=_[_0x895a('0x37')](_0x4b4a3f[_0x895a('0x38')],qs[_0x895a('0x3a')](_0x483897[_0x895a('0x34')][_0x895a('0x3a')]));_0x18a52c[_0x895a('0x39')]=_0x18a52c[_0x895a('0x39')][_0x895a('0x3b')]?_0x18a52c[_0x895a('0x39')]:_0x4b4a3f[_0x895a('0x38')];if(!_0x483897[_0x895a('0x34')][_0x895a('0x3c')](_0x895a('0x3d'))){_0x18a52c[_0x895a('0x20')]=qs['limit'](_0x483897[_0x895a('0x34')]['limit']);_0x18a52c[_0x895a('0x1e')]=qs[_0x895a('0x1e')](_0x483897['query'][_0x895a('0x1e')]);}_0x18a52c[_0x895a('0x3e')]=qs[_0x895a('0x3f')](_0x483897[_0x895a('0x34')][_0x895a('0x3f')]);_0x18a52c[_0x895a('0x40')]=qs[_0x895a('0x36')](_[_0x895a('0x41')](_0x483897['query'],_0x4b4a3f['filters']),_0x4a1ac1);if(_0x483897['query'][_0x895a('0x42')]){_0x18a52c[_0x895a('0x40')]=_[_0x895a('0x43')](_0x18a52c[_0x895a('0x40')],{'$or':_[_0x895a('0x2e')](_0x4a1ac1,function(_0x64688b){if(_0x64688b[_0x895a('0x32')]!==_0x895a('0x44')){var _0x3fe51d={};_0x3fe51d[_0x64688b[_0x895a('0x2b')]]={'$like':'%'+_0x483897['query'][_0x895a('0x42')]+'%'};return _0x3fe51d;}})});}_0x18a52c=_[_0x895a('0x43')]({},_0x18a52c,_0x483897[_0x895a('0x45')]);var _0x59e37d={'where':_0x18a52c['where']};return db[_0x895a('0x2f')]['count'](_0x59e37d)['then'](function(_0x2096a8){_0x45a75f[_0x895a('0x46')]=_0x2096a8;if(_0x483897['query'][_0x895a('0x47')]){_0x18a52c[_0x895a('0x48')]=[{'all':!![]}];}return db['SquareOdbc'][_0x895a('0x49')](_0x18a52c);})[_0x895a('0x26')](function(_0x430665){_0x45a75f['rows']=_0x430665;return _0x45a75f;})['then'](respondWithFilteredResult(_0x3e5bdf,_0x18a52c))[_0x895a('0x4a')](handleError(_0x3e5bdf,null));};exports['show']=function(_0x5c76d1,_0x355539){var _0x18293f={'raw':!![],'where':{'id':_0x5c76d1[_0x895a('0x4b')]['id']}},_0x1f0e25={};_0x1f0e25[_0x895a('0x38')]=_[_0x895a('0x35')](db['SquareOdbc']['rawAttributes']);_0x1f0e25['query']=_[_0x895a('0x35')](_0x5c76d1[_0x895a('0x34')]);_0x1f0e25['filters']=_['intersection'](_0x1f0e25[_0x895a('0x38')],_0x1f0e25['query']);_0x18293f['attributes']=_[_0x895a('0x37')](_0x1f0e25[_0x895a('0x38')],qs[_0x895a('0x3a')](_0x5c76d1[_0x895a('0x34')][_0x895a('0x3a')]));_0x18293f[_0x895a('0x39')]=_0x18293f[_0x895a('0x39')]['length']?_0x18293f[_0x895a('0x39')]:_0x1f0e25[_0x895a('0x38')];if(_0x5c76d1['query']['includeAll']){_0x18293f['include']=[{'all':!![]}];}_0x18293f=_[_0x895a('0x43')]({},_0x18293f,_0x5c76d1[_0x895a('0x45')]);return db[_0x895a('0x2f')][_0x895a('0x4c')](_0x18293f)[_0x895a('0x26')](handleEntityNotFound(_0x355539,null))[_0x895a('0x26')](respondWithResult(_0x355539,null))[_0x895a('0x4a')](handleError(_0x355539,null));};exports[_0x895a('0x4d')]=function(_0x1fe317,_0x3ac5cb){return db[_0x895a('0x2f')][_0x895a('0x4d')](_0x1fe317[_0x895a('0x4e')],{})[_0x895a('0x26')](function(_0x1639e2){var _0x5d08ce=_0x1fe317[_0x895a('0x4f')][_0x895a('0x28')]({'plain':!![]});if(!_0x5d08ce)throw new Error(_0x895a('0x50'));if(_0x5d08ce[_0x895a('0x51')]==='user'){var _0xafc6c8=_0x1639e2['get']({'plain':!![]});var _0x9c0bb9=_0x895a('0x52');return db[_0x895a('0x53')]['find']({'where':{'name':_0x9c0bb9,'userProfileId':_0x5d08ce[_0x895a('0x54')]},'raw':!![]})[_0x895a('0x26')](function(_0x5b4a55){if(_0x5b4a55&&_0x5b4a55['autoAssociation']===0x0){return db['UserProfileResource'][_0x895a('0x4d')]({'name':_0xafc6c8[_0x895a('0x2b')],'resourceId':_0xafc6c8['id'],'type':_0x5b4a55[_0x895a('0x2b')],'sectionId':_0x5b4a55['id']},{})[_0x895a('0x26')](function(){return _0x1639e2;});}else{return _0x1639e2;}})[_0x895a('0x4a')](function(_0x66b743){logger['error'](_0x895a('0x55'),_0x66b743);throw _0x66b743;});}return _0x1639e2;})[_0x895a('0x26')](respondWithResult(_0x3ac5cb,0xc9))[_0x895a('0x4a')](handleError(_0x3ac5cb,null));};exports['update']=function(_0x29b72c,_0x4b6afd){if(_0x29b72c[_0x895a('0x4e')]['id']){delete _0x29b72c[_0x895a('0x4e')]['id'];}return db['SquareOdbc'][_0x895a('0x4c')]({'where':{'id':_0x29b72c[_0x895a('0x4b')]['id']}})[_0x895a('0x26')](handleEntityNotFound(_0x4b6afd,null))[_0x895a('0x26')](saveUpdates(_0x29b72c[_0x895a('0x4e')],null))['then'](respondWithResult(_0x4b6afd,null))[_0x895a('0x4a')](handleError(_0x4b6afd,null));};exports[_0x895a('0x27')]=function(_0x2ad129,_0x588f06){return db[_0x895a('0x2f')][_0x895a('0x4c')]({'where':{'id':_0x2ad129['params']['id']}})[_0x895a('0x26')](handleEntityNotFound(_0x588f06,null))[_0x895a('0x26')](removeEntity(_0x588f06,null))['catch'](handleError(_0x588f06,null));};exports[_0x895a('0x56')]=function(_0x1e6b42,_0x4d4c3d,_0x5d0292){var _0x3edbb9;return db[_0x895a('0x2f')]['find']({'where':{'id':_0x1e6b42[_0x895a('0x4b')]['id']},'attributes':['id','dsn']})['then'](handleEntityNotFound(_0x4d4c3d,null))[_0x895a('0x26')](function(_0x564458){if(_0x564458){var _0x5eae2c=require('odbc')();_0x5eae2c[_0x895a('0x57')](_0x564458[_0x895a('0x58')]);_0x5eae2c['closeSync']();return _0x564458;}})['then'](respondWithResult(_0x4d4c3d,null))[_0x895a('0x4a')](handleError(_0x4d4c3d,null));}; \ No newline at end of file +var _0xe998=['filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','length','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','find','dsn','odbc','openSync','closeSync','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','destroy','then','get','ODBC','UserProfileResource','end','error','stack','name','send','index','SquareOdbc','rawAttributes','type','key','map','query','keys','filters','intersection','model','attributes','fields','hasOwnProperty','order','sort','where','pick'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xe998,0x183));var _0x8e99=function(_0x7fcd4f,_0x1636da){_0x7fcd4f=_0x7fcd4f-0x0;var _0x7f3907=_0xe998[_0x7fcd4f];return _0x7f3907;};'use strict';var emlformat=require(_0x8e99('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0x8e99('0x1'));var rp=require(_0x8e99('0x2'));var moment=require(_0x8e99('0x3'));var BPromise=require(_0x8e99('0x4'));var Mustache=require(_0x8e99('0x5'));var util=require(_0x8e99('0x6'));var path=require(_0x8e99('0x7'));var sox=require('sox');var csv=require(_0x8e99('0x8'));var ejs=require(_0x8e99('0x9'));var fs=require('fs');var fs_extra=require(_0x8e99('0xa'));var _=require(_0x8e99('0xb'));var squel=require(_0x8e99('0xc'));var crypto=require(_0x8e99('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x8e99('0xe'));var toCsv=require(_0x8e99('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0x8e99('0xf'));var authService=require(_0x8e99('0x10'));var qs=require(_0x8e99('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x8e99('0x12'));var logger=require(_0x8e99('0x13'))('api');var utils=require('../../config/utils');var config=require(_0x8e99('0x14'));var licenseUtil=require(_0x8e99('0x15'));var db=require(_0x8e99('0x16'))['db'];function respondWithStatusCode(_0x1957d7,_0xf8c319){_0xf8c319=_0xf8c319||0xcc;return function(_0x149485){if(_0x149485){return _0x1957d7[_0x8e99('0x17')](_0xf8c319);}return _0x1957d7[_0x8e99('0x18')](_0xf8c319)['end']();};}function respondWithResult(_0x50bc04,_0x101ebe){_0x101ebe=_0x101ebe||0xc8;return function(_0x2314cd){if(_0x2314cd){return _0x50bc04['status'](_0x101ebe)[_0x8e99('0x19')](_0x2314cd);}};}function respondWithFilteredResult(_0x514fe7,_0x19fc38){return function(_0x17d347){if(_0x17d347){var _0x5ed438=typeof _0x19fc38['offset']===_0x8e99('0x1a')&&typeof _0x19fc38[_0x8e99('0x1b')]===_0x8e99('0x1a');var _0x2ba87f=_0x17d347[_0x8e99('0x1c')];var _0x171762=_0x5ed438?0x0:_0x19fc38[_0x8e99('0x1d')];var _0x5b21d7=_0x5ed438?_0x17d347[_0x8e99('0x1c')]:_0x19fc38['offset']+_0x19fc38['limit'];var _0x17becb;if(_0x5b21d7>=_0x2ba87f){_0x5b21d7=_0x2ba87f;_0x17becb=0xc8;}else{_0x17becb=0xce;}_0x514fe7['status'](_0x17becb);return _0x514fe7[_0x8e99('0x1e')](_0x8e99('0x1f'),_0x171762+'-'+_0x5b21d7+'/'+_0x2ba87f)[_0x8e99('0x19')](_0x17d347);}return null;};}function patchUpdates(_0x5e5fda){return function(_0x361e60){try{jsonpatch[_0x8e99('0x20')](_0x361e60,_0x5e5fda,!![]);}catch(_0x6d0bc9){return BPromise[_0x8e99('0x21')](_0x6d0bc9);}return _0x361e60[_0x8e99('0x22')]();};}function saveUpdates(_0x5958b1,_0x2c13e2){return function(_0x218936){if(_0x218936){return _0x218936['update'](_0x5958b1)['then'](function(_0x2ca38a){return _0x2ca38a;});}return null;};}function removeEntity(_0x37153c,_0x40d72a){return function(_0x4e909a){if(_0x4e909a){return _0x4e909a[_0x8e99('0x23')]()[_0x8e99('0x24')](function(){var _0x479fe6=_0x4e909a[_0x8e99('0x25')]({'plain':!![]});var _0x31537c=_0x8e99('0x26');return db[_0x8e99('0x27')]['destroy']({'where':{'type':_0x31537c,'resourceId':_0x479fe6['id']}})[_0x8e99('0x24')](function(){return _0x4e909a;});})[_0x8e99('0x24')](function(){_0x37153c[_0x8e99('0x18')](0xcc)[_0x8e99('0x28')]();});}};}function handleEntityNotFound(_0x501159,_0x40ebd6){return function(_0x359304){if(!_0x359304){_0x501159['sendStatus'](0x194);}return _0x359304;};}function handleError(_0x209e9e,_0xca0fbe){_0xca0fbe=_0xca0fbe||0x1f4;return function(_0x29c99c){logger[_0x8e99('0x29')](_0x29c99c[_0x8e99('0x2a')]);if(_0x29c99c[_0x8e99('0x2b')]){delete _0x29c99c[_0x8e99('0x2b')];}_0x209e9e[_0x8e99('0x18')](_0xca0fbe)[_0x8e99('0x2c')](_0x29c99c);};}exports[_0x8e99('0x2d')]=function(_0x241d10,_0xdf1c89){var _0x286b4e={},_0x4d9411={},_0x10b471={'count':0x0,'rows':[]};var _0x172adc=_['map'](db[_0x8e99('0x2e')][_0x8e99('0x2f')],function(_0x4684cd){return{'name':_0x4684cd['fieldName'],'type':_0x4684cd[_0x8e99('0x30')][_0x8e99('0x31')]};});_0x4d9411['model']=_[_0x8e99('0x32')](_0x172adc,'name');_0x4d9411[_0x8e99('0x33')]=_[_0x8e99('0x34')](_0x241d10[_0x8e99('0x33')]);_0x4d9411[_0x8e99('0x35')]=_[_0x8e99('0x36')](_0x4d9411[_0x8e99('0x37')],_0x4d9411[_0x8e99('0x33')]);_0x286b4e[_0x8e99('0x38')]=_['intersection'](_0x4d9411[_0x8e99('0x37')],qs[_0x8e99('0x39')](_0x241d10['query'][_0x8e99('0x39')]));_0x286b4e[_0x8e99('0x38')]=_0x286b4e[_0x8e99('0x38')]['length']?_0x286b4e[_0x8e99('0x38')]:_0x4d9411[_0x8e99('0x37')];if(!_0x241d10[_0x8e99('0x33')][_0x8e99('0x3a')]('nolimit')){_0x286b4e['limit']=qs[_0x8e99('0x1b')](_0x241d10[_0x8e99('0x33')]['limit']);_0x286b4e[_0x8e99('0x1d')]=qs[_0x8e99('0x1d')](_0x241d10[_0x8e99('0x33')][_0x8e99('0x1d')]);}_0x286b4e[_0x8e99('0x3b')]=qs[_0x8e99('0x3c')](_0x241d10['query'][_0x8e99('0x3c')]);_0x286b4e[_0x8e99('0x3d')]=qs[_0x8e99('0x35')](_[_0x8e99('0x3e')](_0x241d10[_0x8e99('0x33')],_0x4d9411['filters']),_0x172adc);if(_0x241d10[_0x8e99('0x33')][_0x8e99('0x3f')]){_0x286b4e[_0x8e99('0x3d')]=_[_0x8e99('0x40')](_0x286b4e[_0x8e99('0x3d')],{'$or':_[_0x8e99('0x32')](_0x172adc,function(_0xf3b9c9){if(_0xf3b9c9['type']!==_0x8e99('0x41')){var _0x43b5d4={};_0x43b5d4[_0xf3b9c9[_0x8e99('0x2b')]]={'$like':'%'+_0x241d10[_0x8e99('0x33')][_0x8e99('0x3f')]+'%'};return _0x43b5d4;}})});}_0x286b4e=_[_0x8e99('0x40')]({},_0x286b4e,_0x241d10[_0x8e99('0x42')]);var _0x69758e={'where':_0x286b4e[_0x8e99('0x3d')]};return db[_0x8e99('0x2e')][_0x8e99('0x1c')](_0x69758e)[_0x8e99('0x24')](function(_0x399a7b){_0x10b471[_0x8e99('0x1c')]=_0x399a7b;if(_0x241d10[_0x8e99('0x33')][_0x8e99('0x43')]){_0x286b4e[_0x8e99('0x44')]=[{'all':!![]}];}return db[_0x8e99('0x2e')][_0x8e99('0x45')](_0x286b4e);})[_0x8e99('0x24')](function(_0x4aba1f){_0x10b471[_0x8e99('0x46')]=_0x4aba1f;return _0x10b471;})['then'](respondWithFilteredResult(_0xdf1c89,_0x286b4e))[_0x8e99('0x47')](handleError(_0xdf1c89,null));};exports[_0x8e99('0x48')]=function(_0x1f0f7b,_0x8e0a61){var _0x2c5207={'raw':!![],'where':{'id':_0x1f0f7b[_0x8e99('0x49')]['id']}},_0x4dfb95={};_0x4dfb95[_0x8e99('0x37')]=_[_0x8e99('0x34')](db[_0x8e99('0x2e')][_0x8e99('0x2f')]);_0x4dfb95['query']=_[_0x8e99('0x34')](_0x1f0f7b[_0x8e99('0x33')]);_0x4dfb95['filters']=_['intersection'](_0x4dfb95[_0x8e99('0x37')],_0x4dfb95[_0x8e99('0x33')]);_0x2c5207[_0x8e99('0x38')]=_[_0x8e99('0x36')](_0x4dfb95[_0x8e99('0x37')],qs['fields'](_0x1f0f7b['query']['fields']));_0x2c5207[_0x8e99('0x38')]=_0x2c5207[_0x8e99('0x38')][_0x8e99('0x4a')]?_0x2c5207[_0x8e99('0x38')]:_0x4dfb95[_0x8e99('0x37')];if(_0x1f0f7b[_0x8e99('0x33')][_0x8e99('0x43')]){_0x2c5207[_0x8e99('0x44')]=[{'all':!![]}];}_0x2c5207=_[_0x8e99('0x40')]({},_0x2c5207,_0x1f0f7b[_0x8e99('0x42')]);return db[_0x8e99('0x2e')]['find'](_0x2c5207)[_0x8e99('0x24')](handleEntityNotFound(_0x8e0a61,null))[_0x8e99('0x24')](respondWithResult(_0x8e0a61,null))['catch'](handleError(_0x8e0a61,null));};exports[_0x8e99('0x4b')]=function(_0x572888,_0x501599){return db[_0x8e99('0x2e')][_0x8e99('0x4b')](_0x572888[_0x8e99('0x4c')],{})[_0x8e99('0x24')](function(_0x328e78){var _0x1f0e93=_0x572888[_0x8e99('0x4d')][_0x8e99('0x25')]({'plain':!![]});if(!_0x1f0e93)throw new Error(_0x8e99('0x4e'));if(_0x1f0e93[_0x8e99('0x4f')]===_0x8e99('0x4d')){var _0x23ae4b=_0x328e78[_0x8e99('0x25')]({'plain':!![]});var _0x7933a8=_0x8e99('0x26');return db[_0x8e99('0x50')]['find']({'where':{'name':_0x7933a8,'userProfileId':_0x1f0e93[_0x8e99('0x51')]},'raw':!![]})['then'](function(_0x881973){if(_0x881973&&_0x881973[_0x8e99('0x52')]===0x0){return db[_0x8e99('0x27')][_0x8e99('0x4b')]({'name':_0x23ae4b[_0x8e99('0x2b')],'resourceId':_0x23ae4b['id'],'type':_0x881973[_0x8e99('0x2b')],'sectionId':_0x881973['id']},{})[_0x8e99('0x24')](function(){return _0x328e78;});}else{return _0x328e78;}})['catch'](function(_0x117923){logger[_0x8e99('0x29')](_0x8e99('0x53'),_0x117923);throw _0x117923;});}return _0x328e78;})[_0x8e99('0x24')](respondWithResult(_0x501599,0xc9))[_0x8e99('0x47')](handleError(_0x501599,null));};exports[_0x8e99('0x54')]=function(_0x5b4df4,_0x1d8483){if(_0x5b4df4['body']['id']){delete _0x5b4df4[_0x8e99('0x4c')]['id'];}return db['SquareOdbc']['find']({'where':{'id':_0x5b4df4[_0x8e99('0x49')]['id']}})[_0x8e99('0x24')](handleEntityNotFound(_0x1d8483,null))[_0x8e99('0x24')](saveUpdates(_0x5b4df4[_0x8e99('0x4c')],null))['then'](respondWithResult(_0x1d8483,null))['catch'](handleError(_0x1d8483,null));};exports[_0x8e99('0x23')]=function(_0x1d7e47,_0xb608ae){return db[_0x8e99('0x2e')]['find']({'where':{'id':_0x1d7e47[_0x8e99('0x49')]['id']}})[_0x8e99('0x24')](handleEntityNotFound(_0xb608ae,null))[_0x8e99('0x24')](removeEntity(_0xb608ae,null))[_0x8e99('0x47')](handleError(_0xb608ae,null));};exports['test']=function(_0x26e60a,_0xcf6b8c,_0x3fe74c){var _0x5e1392;return db[_0x8e99('0x2e')][_0x8e99('0x55')]({'where':{'id':_0x26e60a[_0x8e99('0x49')]['id']},'attributes':['id',_0x8e99('0x56')]})['then'](handleEntityNotFound(_0xcf6b8c,null))['then'](function(_0x4ebaf5){if(_0x4ebaf5){var _0x563d97=require(_0x8e99('0x57'))();_0x563d97[_0x8e99('0x58')](_0x4ebaf5[_0x8e99('0x56')]);_0x563d97[_0x8e99('0x59')]();return _0x4ebaf5;}})[_0x8e99('0x24')](respondWithResult(_0xcf6b8c,null))[_0x8e99('0x47')](handleError(_0xcf6b8c,null));}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.model.js b/server/api/squareOdbc/squareOdbc.model.js index b48b078..ab7bea3 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 _0x1fe1=['exports','SquareOdbc','square_odbc','lodash','util','../../config/logger','api','moment','bluebird','rimraf','./squareOdbc.attributes'];(function(_0x94d44b,_0x40b0a2){var _0x578ac2=function(_0x41f61c){while(--_0x41f61c){_0x94d44b['push'](_0x94d44b['shift']());}};_0x578ac2(++_0x40b0a2);}(_0x1fe1,0xdf));var _0x11fe=function(_0x1fb188,_0x9f079b){_0x1fb188=_0x1fb188-0x0;var _0x32cb64=_0x1fe1[_0x1fb188];return _0x32cb64;};'use strict';var _=require(_0x11fe('0x0'));var util=require(_0x11fe('0x1'));var logger=require(_0x11fe('0x2'))(_0x11fe('0x3'));var moment=require(_0x11fe('0x4'));var BPromise=require(_0x11fe('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x11fe('0x6'));var config=require('../../config/environment');var attributes=require(_0x11fe('0x7'));module[_0x11fe('0x8')]=function(_0x1f21e6,_0xc75479){return _0x1f21e6['define'](_0x11fe('0x9'),attributes,{'tableName':_0x11fe('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc3cf=['util','moment','bluebird','request-promise','rimraf','../../config/environment','./squareOdbc.attributes','exports','define','SquareOdbc','lodash'];(function(_0x2f750a,_0x15c89f){var _0x2a208b=function(_0x2ccf7e){while(--_0x2ccf7e){_0x2f750a['push'](_0x2f750a['shift']());}};_0x2a208b(++_0x15c89f);}(_0xc3cf,0xdb));var _0xfc3c=function(_0x6f298,_0x1d1f09){_0x6f298=_0x6f298-0x0;var _0x55b5be=_0xc3cf[_0x6f298];return _0x55b5be;};'use strict';var _=require(_0xfc3c('0x0'));var util=require(_0xfc3c('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xfc3c('0x2'));var BPromise=require(_0xfc3c('0x3'));var rp=require(_0xfc3c('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xfc3c('0x5'));var config=require(_0xfc3c('0x6'));var attributes=require(_0xfc3c('0x7'));module[_0xfc3c('0x8')]=function(_0x329e4d,_0x4ce549){return _0x329e4d[_0xfc3c('0x9')](_0xfc3c('0xa'),attributes,{'tableName':'square_odbc','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareOdbc/squareOdbc.rpc.js b/server/api/squareOdbc/squareOdbc.rpc.js index 1cf033b..ec2580c 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 _0x26ca=['where','attributes','map','include','model','stringify','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info','SquareOdbc,\x20%s,\x20%s','debug','SquareOdbc,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','ShowSquareOdbc','find','options'];(function(_0x44dfce,_0x21bba4){var _0x20c4f5=function(_0x4ad148){while(--_0x4ad148){_0x44dfce['push'](_0x44dfce['shift']());}};_0x20c4f5(++_0x21bba4);}(_0x26ca,0x1d8));var _0xa26c=function(_0xfbdff6,_0x2af690){_0xfbdff6=_0xfbdff6-0x0;var _0x4cb9be=_0x26ca[_0xfbdff6];return _0x4cb9be;};'use strict';var _=require(_0xa26c('0x0'));var util=require(_0xa26c('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa26c('0x2'));var fs=require('fs');var Redis=require(_0xa26c('0x3'));var db=require(_0xa26c('0x4'))['db'];var utils=require(_0xa26c('0x5'));var logger=require(_0xa26c('0x6'))(_0xa26c('0x7'));var config=require(_0xa26c('0x8'));var jayson=require(_0xa26c('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x3a55d1,_0x57854f,_0x4356f1){return new BPromise(function(_0x1f2707,_0x1265fa){return client[_0xa26c('0xa')](_0x3a55d1,_0x4356f1)[_0xa26c('0xb')](function(_0x53b2f1){logger[_0xa26c('0xc')](_0xa26c('0xd'),_0x57854f,'request\x20sent');logger[_0xa26c('0xe')](_0xa26c('0xf'),_0x57854f,_0xa26c('0x10'),JSON['stringify'](_0x53b2f1));if(_0x53b2f1[_0xa26c('0x11')]){if(_0x53b2f1[_0xa26c('0x11')][_0xa26c('0x12')]===0x1f4){logger['error'](_0xa26c('0xd'),_0x57854f,_0x53b2f1[_0xa26c('0x11')]['message']);return _0x1265fa(_0x53b2f1[_0xa26c('0x11')][_0xa26c('0x13')]);}logger[_0xa26c('0x11')](_0xa26c('0xd'),_0x57854f,_0x53b2f1[_0xa26c('0x11')][_0xa26c('0x13')]);return _0x1f2707(_0x53b2f1['error'][_0xa26c('0x13')]);}else{logger['info'](_0xa26c('0xd'),_0x57854f,_0xa26c('0x10'));_0x1f2707(_0x53b2f1[_0xa26c('0x14')]['message']);}})['catch'](function(_0x2ae255){logger['error']('SquareOdbc,\x20%s,\x20%s',_0x57854f,_0x2ae255);_0x1265fa(_0x2ae255);});});}exports[_0xa26c('0x15')]=function(_0x4a4f55){var _0x102bf2=this;return new Promise(function(_0x35f457,_0x5d6b62){return db['SquareOdbc'][_0xa26c('0x16')]({'raw':_0x4a4f55['options']?_0x4a4f55[_0xa26c('0x17')]['raw']===undefined?!![]:![]:!![],'where':_0x4a4f55['options']?_0x4a4f55[_0xa26c('0x17')][_0xa26c('0x18')]||null:null,'attributes':_0x4a4f55[_0xa26c('0x17')]?_0x4a4f55[_0xa26c('0x17')][_0xa26c('0x19')]||null:null,'include':_0x4a4f55['options']?_0x4a4f55[_0xa26c('0x17')]['include']?_[_0xa26c('0x1a')](_0x4a4f55['options'][_0xa26c('0x1b')],function(_0x5adefa){return{'model':db[_0x5adefa[_0xa26c('0x1c')]],'as':_0x5adefa['as'],'attributes':_0x5adefa[_0xa26c('0x19')],'include':_0x5adefa[_0xa26c('0x1b')]?_[_0xa26c('0x1a')](_0x5adefa[_0xa26c('0x1b')],function(_0x10a3a5){return{'model':db[_0x10a3a5[_0xa26c('0x1c')]],'as':_0x10a3a5['as'],'attributes':_0x10a3a5[_0xa26c('0x19')],'include':_0x10a3a5[_0xa26c('0x1b')]?_[_0xa26c('0x1a')](_0x10a3a5[_0xa26c('0x1b')],function(_0x56e7c8){return{'model':db[_0x56e7c8[_0xa26c('0x1c')]],'as':_0x56e7c8['as'],'attributes':_0x56e7c8[_0xa26c('0x19')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1d5c08){logger[_0xa26c('0xc')](_0xa26c('0x15'),_0x4a4f55);logger[_0xa26c('0xe')](_0xa26c('0x15'),_0x4a4f55,JSON[_0xa26c('0x1d')](_0x1d5c08));_0x35f457(_0x1d5c08);})[_0xa26c('0x1e')](function(_0x444e58){logger[_0xa26c('0x11')](_0xa26c('0x15'),_0x444e58[_0xa26c('0x13')],_0x4a4f55);_0x5d6b62(_0x102bf2[_0xa26c('0x11')](0x1f4,_0x444e58[_0xa26c('0x13')]));});});}; \ No newline at end of file +var _0x4d4e=['stringify','error','message','result','find','options','raw','where','attributes','include','map','model','ShowSquareOdbc','catch','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','client','http','request','then','info','SquareOdbc,\x20%s,\x20%s','request\x20sent','debug','SquareOdbc,\x20%s,\x20%s,\x20%s'];(function(_0x6f3151,_0x406745){var _0x305fb8=function(_0x24e5a8){while(--_0x24e5a8){_0x6f3151['push'](_0x6f3151['shift']());}};_0x305fb8(++_0x406745);}(_0x4d4e,0x194));var _0xe4d4=function(_0x52282a,_0x45aef7){_0x52282a=_0x52282a-0x0;var _0x3c66b4=_0x4d4e[_0x52282a];return _0x3c66b4;};'use strict';var _=require(_0xe4d4('0x0'));var util=require('util');var moment=require(_0xe4d4('0x1'));var BPromise=require(_0xe4d4('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xe4d4('0x3'));var db=require(_0xe4d4('0x4'))['db'];var utils=require(_0xe4d4('0x5'));var logger=require('../../config/logger')(_0xe4d4('0x6'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe4d4('0x7')][_0xe4d4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x219be6,_0x3e52f1,_0x57f862){return new BPromise(function(_0x4b3778,_0x102a6a){return client[_0xe4d4('0x9')](_0x219be6,_0x57f862)[_0xe4d4('0xa')](function(_0x47c262){logger[_0xe4d4('0xb')](_0xe4d4('0xc'),_0x3e52f1,_0xe4d4('0xd'));logger[_0xe4d4('0xe')](_0xe4d4('0xf'),_0x3e52f1,_0xe4d4('0xd'),JSON[_0xe4d4('0x10')](_0x47c262));if(_0x47c262[_0xe4d4('0x11')]){if(_0x47c262[_0xe4d4('0x11')]['code']===0x1f4){logger[_0xe4d4('0x11')](_0xe4d4('0xc'),_0x3e52f1,_0x47c262[_0xe4d4('0x11')][_0xe4d4('0x12')]);return _0x102a6a(_0x47c262['error'][_0xe4d4('0x12')]);}logger[_0xe4d4('0x11')](_0xe4d4('0xc'),_0x3e52f1,_0x47c262[_0xe4d4('0x11')][_0xe4d4('0x12')]);return _0x4b3778(_0x47c262[_0xe4d4('0x11')][_0xe4d4('0x12')]);}else{logger[_0xe4d4('0xb')](_0xe4d4('0xc'),_0x3e52f1,'request\x20sent');_0x4b3778(_0x47c262[_0xe4d4('0x13')][_0xe4d4('0x12')]);}})['catch'](function(_0x4b6304){logger[_0xe4d4('0x11')](_0xe4d4('0xc'),_0x3e52f1,_0x4b6304);_0x102a6a(_0x4b6304);});});}exports['ShowSquareOdbc']=function(_0x31342e){var _0x8ae6fa=this;return new Promise(function(_0x59e625,_0x234564){return db['SquareOdbc'][_0xe4d4('0x14')]({'raw':_0x31342e[_0xe4d4('0x15')]?_0x31342e[_0xe4d4('0x15')][_0xe4d4('0x16')]===undefined?!![]:![]:!![],'where':_0x31342e[_0xe4d4('0x15')]?_0x31342e[_0xe4d4('0x15')][_0xe4d4('0x17')]||null:null,'attributes':_0x31342e[_0xe4d4('0x15')]?_0x31342e['options'][_0xe4d4('0x18')]||null:null,'include':_0x31342e[_0xe4d4('0x15')]?_0x31342e[_0xe4d4('0x15')][_0xe4d4('0x19')]?_[_0xe4d4('0x1a')](_0x31342e[_0xe4d4('0x15')][_0xe4d4('0x19')],function(_0x4362f5){return{'model':db[_0x4362f5[_0xe4d4('0x1b')]],'as':_0x4362f5['as'],'attributes':_0x4362f5[_0xe4d4('0x18')],'include':_0x4362f5[_0xe4d4('0x19')]?_[_0xe4d4('0x1a')](_0x4362f5[_0xe4d4('0x19')],function(_0x212083){return{'model':db[_0x212083['model']],'as':_0x212083['as'],'attributes':_0x212083[_0xe4d4('0x18')],'include':_0x212083[_0xe4d4('0x19')]?_[_0xe4d4('0x1a')](_0x212083[_0xe4d4('0x19')],function(_0x4e2a1e){return{'model':db[_0x4e2a1e[_0xe4d4('0x1b')]],'as':_0x4e2a1e['as'],'attributes':_0x4e2a1e['attributes']};}):[]};}):[]};}):[]:[]})[_0xe4d4('0xa')](function(_0x3a64ea){logger[_0xe4d4('0xb')](_0xe4d4('0x1c'),_0x31342e);logger[_0xe4d4('0xe')](_0xe4d4('0x1c'),_0x31342e,JSON[_0xe4d4('0x10')](_0x3a64ea));_0x59e625(_0x3a64ea);})[_0xe4d4('0x1d')](function(_0x5a5c81){logger[_0xe4d4('0x11')](_0xe4d4('0x1c'),_0x5a5c81[_0xe4d4('0x12')],_0x31342e);_0x234564(_0x8ae6fa[_0xe4d4('0x11')](0x1f4,_0x5a5c81[_0xe4d4('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/index.js b/server/api/squareProject/index.js index 0544ce2..2868b2a 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 _0xfd00=['update','delete','destroy','exports','multer','path','Router','../../components/auth/service','../../components/interaction/service','./squareProject.controller','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x1b5e95,_0xb28feb){var _0x2ee2b=function(_0x1a9b12){while(--_0x1a9b12){_0x1b5e95['push'](_0x1b5e95['shift']());}};_0x2ee2b(++_0xb28feb);}(_0xfd00,0x136));var _0x0fd0=function(_0x573705,_0x46b51c){_0x573705=_0x573705-0x0;var _0x566b07=_0xfd00[_0x573705];return _0x566b07;};'use strict';var multer=require(_0x0fd0('0x0'));var util=require('util');var path=require(_0x0fd0('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0fd0('0x2')]();var fs_extra=require('fs-extra');var auth=require(_0x0fd0('0x3'));var interaction=require(_0x0fd0('0x4'));var config=require('../../config/environment');var controller=require(_0x0fd0('0x5'));router[_0x0fd0('0x6')]('/',auth[_0x0fd0('0x7')](),controller[_0x0fd0('0x8')]);router[_0x0fd0('0x6')](_0x0fd0('0x9'),auth[_0x0fd0('0x7')](),controller['show']);router[_0x0fd0('0xa')]('/',auth[_0x0fd0('0x7')](),controller[_0x0fd0('0xb')]);router[_0x0fd0('0xc')](_0x0fd0('0x9'),auth['isAuthenticated'](),controller[_0x0fd0('0xd')]);router[_0x0fd0('0xe')](_0x0fd0('0x9'),auth[_0x0fd0('0x7')](),controller[_0x0fd0('0xf')]);module[_0x0fd0('0x10')]=router; \ No newline at end of file +var _0x9fa4=['isAuthenticated','/:id','show','post','create','put','update','delete','destroy','exports','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareProject.controller','get'];(function(_0x1814cf,_0x50bb2c){var _0x2efc86=function(_0xba07e3){while(--_0xba07e3){_0x1814cf['push'](_0x1814cf['shift']());}};_0x2efc86(++_0x50bb2c);}(_0x9fa4,0x15e));var _0x49fa=function(_0x7e01a5,_0x1bbef6){_0x7e01a5=_0x7e01a5-0x0;var _0x2e464b=_0x9fa4[_0x7e01a5];return _0x2e464b;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0x49fa('0x0'));var router=express['Router']();var fs_extra=require(_0x49fa('0x1'));var auth=require(_0x49fa('0x2'));var interaction=require(_0x49fa('0x3'));var config=require(_0x49fa('0x4'));var controller=require(_0x49fa('0x5'));router[_0x49fa('0x6')]('/',auth[_0x49fa('0x7')](),controller['index']);router[_0x49fa('0x6')](_0x49fa('0x8'),auth[_0x49fa('0x7')](),controller[_0x49fa('0x9')]);router[_0x49fa('0xa')]('/',auth['isAuthenticated'](),controller[_0x49fa('0xb')]);router[_0x49fa('0xc')](_0x49fa('0x8'),auth[_0x49fa('0x7')](),controller[_0x49fa('0xd')]);router[_0x49fa('0xe')](_0x49fa('0x8'),auth['isAuthenticated'](),controller[_0x49fa('0xf')]);module[_0x49fa('0x10')]=router; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.attributes.js b/server/api/squareProject/squareProject.attributes.js index aacb493..630a00b 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 _0x2fb7=['DATE','exports','STRING','name','BLOB','long','getDataValue','preproduction','toString','utf8','production'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0x2fb7,0x90));var _0x72fb=function(_0x4dd100,_0x2aa8a7){_0x4dd100=_0x4dd100-0x0;var _0x2de53a=_0x2fb7[_0x4dd100];return _0x2de53a;};'use strict';var Sequelize=require('sequelize');module[_0x72fb('0x0')]={'name':{'type':Sequelize[_0x72fb('0x1')],'unique':_0x72fb('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x72fb('0x1')]},'notes':{'type':Sequelize['TEXT']},'preproduction':{'type':Sequelize[_0x72fb('0x3')](_0x72fb('0x4')),'get':function(){if(this[_0x72fb('0x5')]('preproduction')){return this[_0x72fb('0x5')](_0x72fb('0x6'))[_0x72fb('0x7')](_0x72fb('0x8'));}}},'production':{'type':Sequelize['BLOB'](_0x72fb('0x4')),'get':function(){if(this[_0x72fb('0x5')](_0x72fb('0x9'))){return this['getDataValue'](_0x72fb('0x9'))[_0x72fb('0x7')](_0x72fb('0x8'));}}},'savedAt':{'type':Sequelize[_0x72fb('0xa')]},'publishedAt':{'type':Sequelize[_0x72fb('0xa')]}}; \ No newline at end of file +var _0xe0a8=['preproduction','toString','utf8','production','DATE','exports','STRING','name','TEXT','BLOB','long','getDataValue'];(function(_0x483d6a,_0x5c3688){var _0x2b9a4f=function(_0x58637a){while(--_0x58637a){_0x483d6a['push'](_0x483d6a['shift']());}};_0x2b9a4f(++_0x5c3688);}(_0xe0a8,0x161));var _0x8e0a=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0xe0a8[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require('sequelize');module[_0x8e0a('0x0')]={'name':{'type':Sequelize[_0x8e0a('0x1')],'unique':_0x8e0a('0x2'),'allowNull':![]},'description':{'type':Sequelize[_0x8e0a('0x1')]},'notes':{'type':Sequelize[_0x8e0a('0x3')]},'preproduction':{'type':Sequelize[_0x8e0a('0x4')](_0x8e0a('0x5')),'get':function(){if(this[_0x8e0a('0x6')](_0x8e0a('0x7'))){return this[_0x8e0a('0x6')]('preproduction')[_0x8e0a('0x8')](_0x8e0a('0x9'));}}},'production':{'type':Sequelize[_0x8e0a('0x4')]('long'),'get':function(){if(this[_0x8e0a('0x6')]('production')){return this[_0x8e0a('0x6')](_0x8e0a('0xa'))[_0x8e0a('0x8')](_0x8e0a('0x9'));}}},'savedAt':{'type':Sequelize[_0x8e0a('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 c68d865..81e0f58 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 _0xd7f6=['rows','catch','rawAttributes','includeAll','options','create','body','user','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','params','publish','production','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','defaults','localhost','./squareProject.socket','json','undefined','limit','count','offset','status','Content-Range','update','then','destroy','get','SquareProjects','UserProfileResource','agi','stringify','end','sendStatus','error','name','send','index','map','SquareProject','fieldName','key','model','query','keys','filters','intersection','attributes','length','hasOwnProperty','nolimit','sort','where','pick','merge','type','findAll'];(function(_0x1b196,_0x1dd81c){var _0x264ed0=function(_0x1e6706){while(--_0x1e6706){_0x1b196['push'](_0x1b196['shift']());}};_0x264ed0(++_0x1dd81c);}(_0xd7f6,0x1e5));var _0x6d7f=function(_0x54fc28,_0x2f4708){_0x54fc28=_0x54fc28-0x0;var _0x3227c8=_0xd7f6[_0x54fc28];return _0x3227c8;};'use strict';var _=require(_0x6d7f('0x0'));var Redis=require(_0x6d7f('0x1'));var qs=require(_0x6d7f('0x2'));var logger=require(_0x6d7f('0x3'))(_0x6d7f('0x4'));var config=require(_0x6d7f('0x5'));var db=require(_0x6d7f('0x6'))['db'];config[_0x6d7f('0x7')]=_[_0x6d7f('0x8')](config['redis'],{'host':_0x6d7f('0x9'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x6d7f('0x7')]));require(_0x6d7f('0xa'))['register'](socket);function respondWithResult(_0x31014a,_0x1d507c){_0x1d507c=_0x1d507c||0xc8;return function(_0x482370){if(_0x482370){return _0x31014a['status'](_0x1d507c)[_0x6d7f('0xb')](_0x482370);}};}function respondWithFilteredResult(_0x33c101,_0x124181){return function(_0x1a42e0){if(_0x1a42e0){var _0x16acbb=typeof _0x124181['offset']===_0x6d7f('0xc')&&typeof _0x124181[_0x6d7f('0xd')]==='undefined';var _0x4d66c2=_0x1a42e0[_0x6d7f('0xe')];var _0x4f4857=_0x16acbb?0x0:_0x124181[_0x6d7f('0xf')];var _0x4083fe=_0x16acbb?_0x1a42e0[_0x6d7f('0xe')]:_0x124181[_0x6d7f('0xf')]+_0x124181['limit'];var _0x2e7b67;if(_0x4083fe>=_0x4d66c2){_0x4083fe=_0x4d66c2;_0x2e7b67=0xc8;}else{_0x2e7b67=0xce;}_0x33c101[_0x6d7f('0x10')](_0x2e7b67);return _0x33c101['set'](_0x6d7f('0x11'),_0x4f4857+'-'+_0x4083fe+'/'+_0x4d66c2)[_0x6d7f('0xb')](_0x1a42e0);}return null;};}function saveUpdates(_0x31400f){return function(_0x420196){if(_0x420196){return _0x420196[_0x6d7f('0x12')](_0x31400f)[_0x6d7f('0x13')](function(_0x348eee){return _0x348eee;});}return null;};}function removeEntity(_0x3e2c5b){return function(_0x544805){if(_0x544805){return _0x544805[_0x6d7f('0x14')]()[_0x6d7f('0x13')](function(){var _0x36f687=_0x544805[_0x6d7f('0x15')]({'plain':!![]});var _0x3a7cc6=_0x6d7f('0x16');return db[_0x6d7f('0x17')][_0x6d7f('0x14')]({'where':{'type':_0x3a7cc6,'resourceId':_0x36f687['id']}})['then'](function(){return _0x544805;});})[_0x6d7f('0x13')](function(){var _0x11f9a6=new Redis(config[_0x6d7f('0x7')]);_0x11f9a6['publish'](_0x6d7f('0x18'),JSON[_0x6d7f('0x19')]({'id':_0x544805['id'],'deleted':!![]}));})[_0x6d7f('0x13')](function(){_0x3e2c5b[_0x6d7f('0x10')](0xcc)[_0x6d7f('0x1a')]();});}};}function handleEntityNotFound(_0x3c9433){return function(_0x15001b){if(!_0x15001b){_0x3c9433[_0x6d7f('0x1b')](0x194);}return _0x15001b;};}function handleError(_0x2dbfec,_0x136dce){_0x136dce=_0x136dce||0x1f4;return function(_0x4f9d8e){logger[_0x6d7f('0x1c')](_0x4f9d8e['stack']);if(_0x4f9d8e[_0x6d7f('0x1d')]){delete _0x4f9d8e['name'];}_0x2dbfec[_0x6d7f('0x10')](_0x136dce)[_0x6d7f('0x1e')](_0x4f9d8e);};}exports[_0x6d7f('0x1f')]=function(_0x554537,_0x267e16){var _0x5f4b41={},_0x43143f={},_0x5e4537={'count':0x0,'rows':[]};var _0x5a45f7=_[_0x6d7f('0x20')](db[_0x6d7f('0x21')]['rawAttributes'],function(_0xd6da44){return{'name':_0xd6da44[_0x6d7f('0x22')],'type':_0xd6da44['type'][_0x6d7f('0x23')]};});_0x43143f[_0x6d7f('0x24')]=_[_0x6d7f('0x20')](_0x5a45f7,'name');_0x43143f[_0x6d7f('0x25')]=_[_0x6d7f('0x26')](_0x554537[_0x6d7f('0x25')]);_0x43143f[_0x6d7f('0x27')]=_[_0x6d7f('0x28')](_0x43143f[_0x6d7f('0x24')],_0x43143f['query']);_0x5f4b41[_0x6d7f('0x29')]=_[_0x6d7f('0x28')](_0x43143f[_0x6d7f('0x24')],qs['fields'](_0x554537['query']['fields']));_0x5f4b41[_0x6d7f('0x29')]=_0x5f4b41[_0x6d7f('0x29')][_0x6d7f('0x2a')]?_0x5f4b41[_0x6d7f('0x29')]:_0x43143f[_0x6d7f('0x24')];if(!_0x554537[_0x6d7f('0x25')][_0x6d7f('0x2b')](_0x6d7f('0x2c'))){_0x5f4b41[_0x6d7f('0xd')]=qs['limit'](_0x554537[_0x6d7f('0x25')]['limit']);_0x5f4b41['offset']=qs[_0x6d7f('0xf')](_0x554537['query'][_0x6d7f('0xf')]);}_0x5f4b41['order']=qs[_0x6d7f('0x2d')](_0x554537[_0x6d7f('0x25')][_0x6d7f('0x2d')]);_0x5f4b41[_0x6d7f('0x2e')]=qs[_0x6d7f('0x27')](_[_0x6d7f('0x2f')](_0x554537[_0x6d7f('0x25')],_0x43143f[_0x6d7f('0x27')]),_0x5a45f7);if(_0x554537['query']['filter']){_0x5f4b41[_0x6d7f('0x2e')]=_[_0x6d7f('0x30')](_0x5f4b41['where'],{'$or':_[_0x6d7f('0x20')](_0x5a45f7,function(_0x481899){if(_0x481899[_0x6d7f('0x31')]!=='VIRTUAL'){var _0x2426b4={};_0x2426b4[_0x481899[_0x6d7f('0x1d')]]={'$like':'%'+_0x554537[_0x6d7f('0x25')]['filter']+'%'};return _0x2426b4;}})});}_0x5f4b41=_['merge']({},_0x5f4b41,_0x554537['options']);var _0x3f2756={'where':_0x5f4b41[_0x6d7f('0x2e')]};return db['SquareProject']['count'](_0x3f2756)[_0x6d7f('0x13')](function(_0x4f007e){_0x5e4537[_0x6d7f('0xe')]=_0x4f007e;if(_0x554537[_0x6d7f('0x25')]['includeAll']){_0x5f4b41['include']=[{'all':!![]}];}return db[_0x6d7f('0x21')][_0x6d7f('0x32')](_0x5f4b41);})[_0x6d7f('0x13')](function(_0x76369){_0x5e4537[_0x6d7f('0x33')]=_0x76369;return _0x5e4537;})[_0x6d7f('0x13')](respondWithFilteredResult(_0x267e16,_0x5f4b41))[_0x6d7f('0x34')](handleError(_0x267e16,null));};exports['show']=function(_0x2cf5be,_0x3b9ce1){var _0x138ae7={'raw':![],'where':{'id':_0x2cf5be['params']['id']}},_0x173ac6={};_0x173ac6['model']=_[_0x6d7f('0x26')](db[_0x6d7f('0x21')][_0x6d7f('0x35')]);_0x173ac6[_0x6d7f('0x25')]=_[_0x6d7f('0x26')](_0x2cf5be[_0x6d7f('0x25')]);_0x173ac6[_0x6d7f('0x27')]=_[_0x6d7f('0x28')](_0x173ac6['model'],_0x173ac6['query']);_0x138ae7[_0x6d7f('0x29')]=_['intersection'](_0x173ac6[_0x6d7f('0x24')],qs['fields'](_0x2cf5be[_0x6d7f('0x25')]['fields']));_0x138ae7[_0x6d7f('0x29')]=_0x138ae7[_0x6d7f('0x29')][_0x6d7f('0x2a')]?_0x138ae7['attributes']:_0x173ac6[_0x6d7f('0x24')];if(_0x2cf5be['query'][_0x6d7f('0x36')]){_0x138ae7['include']=[{'all':!![]}];}_0x138ae7=_['merge']({},_0x138ae7,_0x2cf5be[_0x6d7f('0x37')]);return db[_0x6d7f('0x21')]['find'](_0x138ae7)[_0x6d7f('0x13')](handleEntityNotFound(_0x3b9ce1,null))[_0x6d7f('0x13')](respondWithResult(_0x3b9ce1,null))[_0x6d7f('0x34')](handleError(_0x3b9ce1,null));};exports[_0x6d7f('0x38')]=function(_0x4bdfaa,_0xe47af1){return db[_0x6d7f('0x21')]['create'](_0x4bdfaa[_0x6d7f('0x39')],{})[_0x6d7f('0x13')](function(_0x308924){var _0x28366e=_0x4bdfaa[_0x6d7f('0x3a')][_0x6d7f('0x15')]({'plain':!![]});if(!_0x28366e)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x28366e[_0x6d7f('0x3b')]===_0x6d7f('0x3a')){var _0x3a286a=_0x308924[_0x6d7f('0x15')]({'plain':!![]});var _0x51069d=_0x6d7f('0x16');return db[_0x6d7f('0x3c')]['find']({'where':{'name':_0x51069d,'userProfileId':_0x28366e[_0x6d7f('0x3d')]},'raw':!![]})[_0x6d7f('0x13')](function(_0x5a4f18){if(_0x5a4f18&&_0x5a4f18['autoAssociation']===0x0){return db[_0x6d7f('0x17')][_0x6d7f('0x38')]({'name':_0x3a286a['name'],'resourceId':_0x3a286a['id'],'type':_0x5a4f18[_0x6d7f('0x1d')],'sectionId':_0x5a4f18['id']},{})[_0x6d7f('0x13')](function(){return _0x308924;});}else{return _0x308924;}})['catch'](function(_0x1004b2){logger[_0x6d7f('0x1c')](_0x6d7f('0x3e'),_0x1004b2);throw _0x1004b2;});}return _0x308924;})[_0x6d7f('0x13')](respondWithResult(_0xe47af1,0xc9))['catch'](handleError(_0xe47af1,null));};exports[_0x6d7f('0x12')]=function(_0xebe670,_0x535f2d){if(_0xebe670['body']['id']){delete _0xebe670[_0x6d7f('0x39')]['id'];}return db[_0x6d7f('0x21')][_0x6d7f('0x3f')]({'where':{'id':_0xebe670[_0x6d7f('0x40')]['id']}})[_0x6d7f('0x13')](handleEntityNotFound(_0x535f2d,null))[_0x6d7f('0x13')](saveUpdates(_0xebe670['body'],null))[_0x6d7f('0x13')](function(_0x22387e){if(!_0x22387e)return;var _0x34b916=_0x22387e['get']({'plain':!![]});return _0x34b916;})[_0x6d7f('0x13')](function(_0xf95665){var _0x2aff54=new Redis(config[_0x6d7f('0x7')]);_0x2aff54[_0x6d7f('0x41')](_0x6d7f('0x18'),JSON[_0x6d7f('0x19')](_[_0x6d7f('0x2f')](_0xf95665,['id','name',_0x6d7f('0x42')])));return _0xf95665;})[_0x6d7f('0x13')](respondWithResult(_0x535f2d,null))['catch'](handleError(_0x535f2d,null));};exports[_0x6d7f('0x14')]=function(_0x678c51,_0x8205a3){return db[_0x6d7f('0x21')][_0x6d7f('0x3f')]({'where':{'id':_0x678c51[_0x6d7f('0x40')]['id']}})[_0x6d7f('0x13')](handleEntityNotFound(_0x8205a3,null))['then'](removeEntity(_0x8205a3,null))[_0x6d7f('0x34')](handleError(_0x8205a3,null));}; \ No newline at end of file +var _0xe43b=['hasOwnProperty','nolimit','sort','where','filters','filter','type','VIRTUAL','merge','options','count','rows','show','params','keys','includeAll','include','find','catch','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','SquareProjects','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','pick','lodash','ioredis','../../components/parsers/qs','../../config/logger','api','redis','localhost','socket.io-emitter','./squareProject.socket','register','status','json','undefined','offset','limit','Content-Range','update','then','UserProfileResource','destroy','publish','agi','stringify','end','sendStatus','error','stack','name','send','index','map','SquareProject','rawAttributes','fieldName','key','model','query','intersection','attributes','fields','length'];(function(_0x160227,_0x8aaa20){var _0x5834ac=function(_0x429b26){while(--_0x429b26){_0x160227['push'](_0x160227['shift']());}};_0x5834ac(++_0x8aaa20);}(_0xe43b,0x13a));var _0xbe43=function(_0x4fe7bb,_0x1bdd1c){_0x4fe7bb=_0x4fe7bb-0x0;var _0x5659cc=_0xe43b[_0x4fe7bb];return _0x5659cc;};'use strict';var _=require(_0xbe43('0x0'));var Redis=require(_0xbe43('0x1'));var qs=require(_0xbe43('0x2'));var logger=require(_0xbe43('0x3'))(_0xbe43('0x4'));var config=require('../../config/environment');var db=require('../../mysqldb')['db'];config[_0xbe43('0x5')]=_['defaults'](config[_0xbe43('0x5')],{'host':_0xbe43('0x6'),'port':0x18eb});var socket=require(_0xbe43('0x7'))(new Redis(config[_0xbe43('0x5')]));require(_0xbe43('0x8'))[_0xbe43('0x9')](socket);function respondWithResult(_0x1c440c,_0x102c8a){_0x102c8a=_0x102c8a||0xc8;return function(_0x31a570){if(_0x31a570){return _0x1c440c[_0xbe43('0xa')](_0x102c8a)[_0xbe43('0xb')](_0x31a570);}};}function respondWithFilteredResult(_0x5104de,_0x578939){return function(_0x188750){if(_0x188750){var _0xb98bf2=typeof _0x578939['offset']===_0xbe43('0xc')&&typeof _0x578939['limit']===_0xbe43('0xc');var _0xef1729=_0x188750['count'];var _0x20da8a=_0xb98bf2?0x0:_0x578939['offset'];var _0x41a3f7=_0xb98bf2?_0x188750['count']:_0x578939[_0xbe43('0xd')]+_0x578939[_0xbe43('0xe')];var _0x5a59dc;if(_0x41a3f7>=_0xef1729){_0x41a3f7=_0xef1729;_0x5a59dc=0xc8;}else{_0x5a59dc=0xce;}_0x5104de[_0xbe43('0xa')](_0x5a59dc);return _0x5104de['set'](_0xbe43('0xf'),_0x20da8a+'-'+_0x41a3f7+'/'+_0xef1729)[_0xbe43('0xb')](_0x188750);}return null;};}function saveUpdates(_0x28d56b){return function(_0x3fa199){if(_0x3fa199){return _0x3fa199[_0xbe43('0x10')](_0x28d56b)[_0xbe43('0x11')](function(_0x1783ff){return _0x1783ff;});}return null;};}function removeEntity(_0x40382a){return function(_0x5f4364){if(_0x5f4364){return _0x5f4364['destroy']()[_0xbe43('0x11')](function(){var _0x116ab4=_0x5f4364['get']({'plain':!![]});var _0x2d97d5='SquareProjects';return db[_0xbe43('0x12')][_0xbe43('0x13')]({'where':{'type':_0x2d97d5,'resourceId':_0x116ab4['id']}})[_0xbe43('0x11')](function(){return _0x5f4364;});})[_0xbe43('0x11')](function(){var _0x3db58e=new Redis(config['redis']);_0x3db58e[_0xbe43('0x14')](_0xbe43('0x15'),JSON[_0xbe43('0x16')]({'id':_0x5f4364['id'],'deleted':!![]}));})[_0xbe43('0x11')](function(){_0x40382a[_0xbe43('0xa')](0xcc)[_0xbe43('0x17')]();});}};}function handleEntityNotFound(_0x139b09){return function(_0x1fb0a2){if(!_0x1fb0a2){_0x139b09[_0xbe43('0x18')](0x194);}return _0x1fb0a2;};}function handleError(_0x3252f0,_0x280417){_0x280417=_0x280417||0x1f4;return function(_0x9c6e2d){logger[_0xbe43('0x19')](_0x9c6e2d[_0xbe43('0x1a')]);if(_0x9c6e2d[_0xbe43('0x1b')]){delete _0x9c6e2d[_0xbe43('0x1b')];}_0x3252f0[_0xbe43('0xa')](_0x280417)[_0xbe43('0x1c')](_0x9c6e2d);};}exports[_0xbe43('0x1d')]=function(_0x2ea19e,_0x2daf15){var _0x57531f={},_0x1834b7={},_0x3e0981={'count':0x0,'rows':[]};var _0x33f039=_[_0xbe43('0x1e')](db[_0xbe43('0x1f')][_0xbe43('0x20')],function(_0x128f35){return{'name':_0x128f35[_0xbe43('0x21')],'type':_0x128f35['type'][_0xbe43('0x22')]};});_0x1834b7[_0xbe43('0x23')]=_['map'](_0x33f039,_0xbe43('0x1b'));_0x1834b7[_0xbe43('0x24')]=_['keys'](_0x2ea19e[_0xbe43('0x24')]);_0x1834b7['filters']=_[_0xbe43('0x25')](_0x1834b7[_0xbe43('0x23')],_0x1834b7[_0xbe43('0x24')]);_0x57531f[_0xbe43('0x26')]=_[_0xbe43('0x25')](_0x1834b7['model'],qs[_0xbe43('0x27')](_0x2ea19e['query'][_0xbe43('0x27')]));_0x57531f[_0xbe43('0x26')]=_0x57531f['attributes'][_0xbe43('0x28')]?_0x57531f[_0xbe43('0x26')]:_0x1834b7[_0xbe43('0x23')];if(!_0x2ea19e['query'][_0xbe43('0x29')](_0xbe43('0x2a'))){_0x57531f[_0xbe43('0xe')]=qs[_0xbe43('0xe')](_0x2ea19e[_0xbe43('0x24')][_0xbe43('0xe')]);_0x57531f['offset']=qs[_0xbe43('0xd')](_0x2ea19e[_0xbe43('0x24')][_0xbe43('0xd')]);}_0x57531f['order']=qs[_0xbe43('0x2b')](_0x2ea19e[_0xbe43('0x24')][_0xbe43('0x2b')]);_0x57531f[_0xbe43('0x2c')]=qs[_0xbe43('0x2d')](_['pick'](_0x2ea19e[_0xbe43('0x24')],_0x1834b7['filters']),_0x33f039);if(_0x2ea19e[_0xbe43('0x24')][_0xbe43('0x2e')]){_0x57531f[_0xbe43('0x2c')]=_['merge'](_0x57531f['where'],{'$or':_[_0xbe43('0x1e')](_0x33f039,function(_0x2d0c1c){if(_0x2d0c1c[_0xbe43('0x2f')]!==_0xbe43('0x30')){var _0x18e8a5={};_0x18e8a5[_0x2d0c1c[_0xbe43('0x1b')]]={'$like':'%'+_0x2ea19e['query'][_0xbe43('0x2e')]+'%'};return _0x18e8a5;}})});}_0x57531f=_[_0xbe43('0x31')]({},_0x57531f,_0x2ea19e[_0xbe43('0x32')]);var _0x3f87e9={'where':_0x57531f['where']};return db[_0xbe43('0x1f')]['count'](_0x3f87e9)[_0xbe43('0x11')](function(_0x29c1af){_0x3e0981[_0xbe43('0x33')]=_0x29c1af;if(_0x2ea19e[_0xbe43('0x24')]['includeAll']){_0x57531f['include']=[{'all':!![]}];}return db[_0xbe43('0x1f')]['findAll'](_0x57531f);})[_0xbe43('0x11')](function(_0x5b88b4){_0x3e0981[_0xbe43('0x34')]=_0x5b88b4;return _0x3e0981;})[_0xbe43('0x11')](respondWithFilteredResult(_0x2daf15,_0x57531f))['catch'](handleError(_0x2daf15,null));};exports[_0xbe43('0x35')]=function(_0x20ec39,_0x5bb7ee){var _0x4a00c6={'raw':![],'where':{'id':_0x20ec39[_0xbe43('0x36')]['id']}},_0x273692={};_0x273692['model']=_[_0xbe43('0x37')](db[_0xbe43('0x1f')][_0xbe43('0x20')]);_0x273692[_0xbe43('0x24')]=_[_0xbe43('0x37')](_0x20ec39[_0xbe43('0x24')]);_0x273692[_0xbe43('0x2d')]=_[_0xbe43('0x25')](_0x273692[_0xbe43('0x23')],_0x273692[_0xbe43('0x24')]);_0x4a00c6['attributes']=_[_0xbe43('0x25')](_0x273692[_0xbe43('0x23')],qs[_0xbe43('0x27')](_0x20ec39[_0xbe43('0x24')][_0xbe43('0x27')]));_0x4a00c6[_0xbe43('0x26')]=_0x4a00c6[_0xbe43('0x26')][_0xbe43('0x28')]?_0x4a00c6[_0xbe43('0x26')]:_0x273692[_0xbe43('0x23')];if(_0x20ec39[_0xbe43('0x24')][_0xbe43('0x38')]){_0x4a00c6[_0xbe43('0x39')]=[{'all':!![]}];}_0x4a00c6=_[_0xbe43('0x31')]({},_0x4a00c6,_0x20ec39[_0xbe43('0x32')]);return db[_0xbe43('0x1f')][_0xbe43('0x3a')](_0x4a00c6)['then'](handleEntityNotFound(_0x5bb7ee,null))[_0xbe43('0x11')](respondWithResult(_0x5bb7ee,null))[_0xbe43('0x3b')](handleError(_0x5bb7ee,null));};exports[_0xbe43('0x3c')]=function(_0x59e4c1,_0x57f352){return db[_0xbe43('0x1f')]['create'](_0x59e4c1[_0xbe43('0x3d')],{})['then'](function(_0xf35243){var _0x127111=_0x59e4c1[_0xbe43('0x3e')][_0xbe43('0x3f')]({'plain':!![]});if(!_0x127111)throw new Error(_0xbe43('0x40'));if(_0x127111[_0xbe43('0x41')]==='user'){var _0x2d4487=_0xf35243[_0xbe43('0x3f')]({'plain':!![]});var _0x1fb435=_0xbe43('0x42');return db[_0xbe43('0x43')][_0xbe43('0x3a')]({'where':{'name':_0x1fb435,'userProfileId':_0x127111['userProfileId']},'raw':!![]})[_0xbe43('0x11')](function(_0x23e2ad){if(_0x23e2ad&&_0x23e2ad[_0xbe43('0x44')]===0x0){return db[_0xbe43('0x12')][_0xbe43('0x3c')]({'name':_0x2d4487[_0xbe43('0x1b')],'resourceId':_0x2d4487['id'],'type':_0x23e2ad[_0xbe43('0x1b')],'sectionId':_0x23e2ad['id']},{})['then'](function(){return _0xf35243;});}else{return _0xf35243;}})[_0xbe43('0x3b')](function(_0xc6587a){logger[_0xbe43('0x19')](_0xbe43('0x45'),_0xc6587a);throw _0xc6587a;});}return _0xf35243;})[_0xbe43('0x11')](respondWithResult(_0x57f352,0xc9))['catch'](handleError(_0x57f352,null));};exports[_0xbe43('0x10')]=function(_0x1e9cbf,_0x341f09){if(_0x1e9cbf[_0xbe43('0x3d')]['id']){delete _0x1e9cbf[_0xbe43('0x3d')]['id'];}return db[_0xbe43('0x1f')]['find']({'where':{'id':_0x1e9cbf[_0xbe43('0x36')]['id']}})[_0xbe43('0x11')](handleEntityNotFound(_0x341f09,null))['then'](saveUpdates(_0x1e9cbf[_0xbe43('0x3d')],null))[_0xbe43('0x11')](function(_0x2197e5){if(!_0x2197e5)return;var _0x3b6628=_0x2197e5[_0xbe43('0x3f')]({'plain':!![]});return _0x3b6628;})[_0xbe43('0x11')](function(_0x4c3562){var _0x520b06=new Redis(config['redis']);_0x520b06['publish']('agi',JSON[_0xbe43('0x16')](_[_0xbe43('0x46')](_0x4c3562,['id',_0xbe43('0x1b'),'production'])));return _0x4c3562;})[_0xbe43('0x11')](respondWithResult(_0x341f09,null))[_0xbe43('0x3b')](handleError(_0x341f09,null));};exports['destroy']=function(_0x23eb1e,_0x561738){return db[_0xbe43('0x1f')]['find']({'where':{'id':_0x23eb1e[_0xbe43('0x36')]['id']}})['then'](handleEntityNotFound(_0x561738,null))[_0xbe43('0x11')](removeEntity(_0x561738,null))[_0xbe43('0x3b')](handleError(_0x561738,null));}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.events.js b/server/api/squareProject/squareProject.events.js index f17094c..6897319 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 _0xe3c8=['exports','events','../../mysqldb','SquareProject','update','remove','emit','hasOwnProperty','hook'];(function(_0xa464c9,_0x7c86d8){var _0x3d73c4=function(_0x5c2056){while(--_0x5c2056){_0xa464c9['push'](_0xa464c9['shift']());}};_0x3d73c4(++_0x7c86d8);}(_0xe3c8,0x160));var _0x8e3c=function(_0x4b4491,_0x103807){_0x4b4491=_0x4b4491-0x0;var _0x14d955=_0xe3c8[_0x4b4491];return _0x14d955;};'use strict';var EventEmitter=require(_0x8e3c('0x0'));var SquareProject=require(_0x8e3c('0x1'))['db'][_0x8e3c('0x2')];var SquareProjectEvents=new EventEmitter();SquareProjectEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':_0x8e3c('0x3'),'afterDestroy':_0x8e3c('0x4')};function emitEvent(_0x37aee4){return function(_0x466ad9,_0x351bfb,_0x434f63){SquareProjectEvents[_0x8e3c('0x5')](_0x37aee4+':'+_0x466ad9['id'],_0x466ad9);SquareProjectEvents[_0x8e3c('0x5')](_0x37aee4,_0x466ad9);_0x434f63(null);};}for(var e in events){if(events[_0x8e3c('0x6')](e)){var event=events[e];SquareProject[_0x8e3c('0x7')](e,emitEvent(event));}}module[_0x8e3c('0x8')]=SquareProjectEvents; \ No newline at end of file +var _0x61e1=['exports','../../mysqldb','setMaxListeners','save','remove','emit','hasOwnProperty','hook'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x61e1,0x1c1));var _0x161e=function(_0x25ce4f,_0xad7194){_0x25ce4f=_0x25ce4f-0x0;var _0x3de67c=_0x61e1[_0x25ce4f];return _0x3de67c;};'use strict';var EventEmitter=require('events');var SquareProject=require(_0x161e('0x0'))['db']['SquareProject'];var SquareProjectEvents=new EventEmitter();SquareProjectEvents[_0x161e('0x1')](0x0);var events={'afterCreate':_0x161e('0x2'),'afterUpdate':'update','afterDestroy':_0x161e('0x3')};function emitEvent(_0x30e4c1){return function(_0x5c1fe1,_0x508136,_0x296f78){SquareProjectEvents[_0x161e('0x4')](_0x30e4c1+':'+_0x5c1fe1['id'],_0x5c1fe1);SquareProjectEvents[_0x161e('0x4')](_0x30e4c1,_0x5c1fe1);_0x296f78(null);};}for(var e in events){if(events[_0x161e('0x5')](e)){var event=events[e];SquareProject[_0x161e('0x6')](e,emitEvent(event));}}module[_0x161e('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 e63dc27..e21aac6 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 _0x5a20=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./squareProject.attributes','exports','define','preproduction','savedAt','changed','production','publishedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','util'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x5a20,0x19c));var _0x05a2=function(_0x961b28,_0x1fdbaa){_0x961b28=_0x961b28-0x0;var _0x477083=_0x5a20[_0x961b28];return _0x477083;};'use strict';var _=require(_0x05a2('0x0'));var util=require(_0x05a2('0x1'));var logger=require(_0x05a2('0x2'))(_0x05a2('0x3'));var moment=require(_0x05a2('0x4'));var BPromise=require('bluebird');var rp=require(_0x05a2('0x5'));var fs=require('fs');var path=require(_0x05a2('0x6'));var rimraf=require(_0x05a2('0x7'));var config=require(_0x05a2('0x8'));var attributes=require(_0x05a2('0x9'));module[_0x05a2('0xa')]=function(_0x1d2ccc,_0x4c83f6){return _0x1d2ccc[_0x05a2('0xb')]('SquareProject',attributes,{'tableName':'square_projects','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x1aced9,_0x4f22f0,_0x1babc5){if(_0x1aced9['changed'](_0x05a2('0xc'))){_0x1aced9[_0x05a2('0xd')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}if(_0x1aced9[_0x05a2('0xe')](_0x05a2('0xf'))){_0x1aced9[_0x05a2('0x10')]=moment()['format'](_0x05a2('0x11'));}_0x1babc5(null,_0x1aced9);}}});}; \ No newline at end of file +var _0x5b6f=['SquareProject','square_projects','changed','preproduction','savedAt','YYYY-MM-DD\x20HH:mm:ss','production','publishedAt','format','lodash','util','../../config/logger','api','bluebird','request-promise','path','../../config/environment','./squareProject.attributes','define'];(function(_0x2c3609,_0x412199){var _0x461da2=function(_0x5c8284){while(--_0x5c8284){_0x2c3609['push'](_0x2c3609['shift']());}};_0x461da2(++_0x412199);}(_0x5b6f,0x8e));var _0xf5b6=function(_0xaada6a,_0x2ac9c7){_0xaada6a=_0xaada6a-0x0;var _0x106a81=_0x5b6f[_0xaada6a];return _0x106a81;};'use strict';var _=require(_0xf5b6('0x0'));var util=require(_0xf5b6('0x1'));var logger=require(_0xf5b6('0x2'))(_0xf5b6('0x3'));var moment=require('moment');var BPromise=require(_0xf5b6('0x4'));var rp=require(_0xf5b6('0x5'));var fs=require('fs');var path=require(_0xf5b6('0x6'));var rimraf=require('rimraf');var config=require(_0xf5b6('0x7'));var attributes=require(_0xf5b6('0x8'));module['exports']=function(_0x4b2270,_0x55f19d){return _0x4b2270[_0xf5b6('0x9')](_0xf5b6('0xa'),attributes,{'tableName':_0xf5b6('0xb'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3f7fda,_0x4c349f,_0x5c95f7){if(_0x3f7fda[_0xf5b6('0xc')](_0xf5b6('0xd'))){_0x3f7fda[_0xf5b6('0xe')]=moment()['format'](_0xf5b6('0xf'));}if(_0x3f7fda[_0xf5b6('0xc')](_0xf5b6('0x10'))){_0x3f7fda[_0xf5b6('0x11')]=moment()[_0xf5b6('0x12')]('YYYY-MM-DD\x20HH:mm:ss');}_0x5c95f7(null,_0x3f7fda);}}});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.rpc.js b/server/api/squareProject/squareProject.rpc.js index 5d1551b..6d20ed6 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 _0x77cc=['../../config/logger','rpc','../../config/environment','redis','defaults','localhost','socket.io-emitter','./squareProject.socket','register','GetSquareProjects','findAll','options','raw','where','attributes','limit','include','map','model','then','info','debug','stringify','catch','message','error','ShowSquareProject','SquareProject','find','lodash','ioredis','../../mysqldb'];(function(_0x11d08e,_0x2a8620){var _0x4d4f45=function(_0x4340b1){while(--_0x4340b1){_0x11d08e['push'](_0x11d08e['shift']());}};_0x4d4f45(++_0x2a8620);}(_0x77cc,0x7d));var _0xc77c=function(_0x1690b3,_0xe1a9e4){_0x1690b3=_0x1690b3-0x0;var _0x38dfb0=_0x77cc[_0x1690b3];return _0x38dfb0;};'use strict';var _=require(_0xc77c('0x0'));var Redis=require(_0xc77c('0x1'));var db=require(_0xc77c('0x2'))['db'];var logger=require(_0xc77c('0x3'))(_0xc77c('0x4'));var config=require(_0xc77c('0x5'));config[_0xc77c('0x6')]=_[_0xc77c('0x7')](config[_0xc77c('0x6')],{'host':_0xc77c('0x8'),'port':0x18eb});var socket=require(_0xc77c('0x9'))(new Redis(config['redis']));require(_0xc77c('0xa'))[_0xc77c('0xb')](socket);exports[_0xc77c('0xc')]=function(_0x3c6ee){var _0x3effd2=this;return new Promise(function(_0x445bb2,_0x52ce4d){return db['SquareProject'][_0xc77c('0xd')]({'raw':_0x3c6ee[_0xc77c('0xe')]?_0x3c6ee['options'][_0xc77c('0xf')]===undefined?!![]:![]:!![],'where':_0x3c6ee['options']?_0x3c6ee[_0xc77c('0xe')][_0xc77c('0x10')]||null:null,'attributes':_0x3c6ee[_0xc77c('0xe')]?_0x3c6ee[_0xc77c('0xe')][_0xc77c('0x11')]||null:null,'limit':_0x3c6ee[_0xc77c('0xe')]?_0x3c6ee['options'][_0xc77c('0x12')]||null:null,'include':_0x3c6ee[_0xc77c('0xe')]?_0x3c6ee[_0xc77c('0xe')][_0xc77c('0x13')]?_[_0xc77c('0x14')](_0x3c6ee[_0xc77c('0xe')]['include'],function(_0x1d70e3){return{'model':db[_0x1d70e3[_0xc77c('0x15')]],'as':_0x1d70e3['as'],'attributes':_0x1d70e3[_0xc77c('0x11')],'include':_0x1d70e3['include']?_[_0xc77c('0x14')](_0x1d70e3[_0xc77c('0x13')],function(_0x136d12){return{'model':db[_0x136d12[_0xc77c('0x15')]],'as':_0x136d12['as'],'attributes':_0x136d12['attributes'],'include':_0x136d12[_0xc77c('0x13')]?_[_0xc77c('0x14')](_0x136d12[_0xc77c('0x13')],function(_0xeebcc3){return{'model':db[_0xeebcc3[_0xc77c('0x15')]],'as':_0xeebcc3['as'],'attributes':_0xeebcc3['attributes']};}):[]};}):[]};}):[]:[]})[_0xc77c('0x16')](function(_0x2b1012){logger[_0xc77c('0x17')]('GetSquareProjects',_0x3c6ee);logger[_0xc77c('0x18')]('GetSquareProjects',_0x3c6ee,JSON[_0xc77c('0x19')](_0x2b1012));_0x445bb2(_0x2b1012);})[_0xc77c('0x1a')](function(_0x5cd09d){logger['error'](_0xc77c('0xc'),_0x5cd09d[_0xc77c('0x1b')],_0x3c6ee);_0x52ce4d(_0x3effd2[_0xc77c('0x1c')](0x1f4,_0x5cd09d[_0xc77c('0x1b')]));});});};exports[_0xc77c('0x1d')]=function(_0x58fbd1){var _0x3da86c=this;return new Promise(function(_0x176ba4,_0x428977){return db[_0xc77c('0x1e')][_0xc77c('0x1f')]({'raw':_0x58fbd1[_0xc77c('0xe')]?_0x58fbd1[_0xc77c('0xe')][_0xc77c('0xf')]===undefined?!![]:![]:!![],'where':_0x58fbd1[_0xc77c('0xe')]?_0x58fbd1['options'][_0xc77c('0x10')]||null:null,'attributes':_0x58fbd1[_0xc77c('0xe')]?_0x58fbd1['options'][_0xc77c('0x11')]||null:null,'include':_0x58fbd1[_0xc77c('0xe')]?_0x58fbd1[_0xc77c('0xe')][_0xc77c('0x13')]?_[_0xc77c('0x14')](_0x58fbd1[_0xc77c('0xe')][_0xc77c('0x13')],function(_0x47dad0){return{'model':db[_0x47dad0[_0xc77c('0x15')]],'as':_0x47dad0['as'],'attributes':_0x47dad0[_0xc77c('0x11')],'include':_0x47dad0[_0xc77c('0x13')]?_[_0xc77c('0x14')](_0x47dad0[_0xc77c('0x13')],function(_0x1b8694){return{'model':db[_0x1b8694[_0xc77c('0x15')]],'as':_0x1b8694['as'],'attributes':_0x1b8694[_0xc77c('0x11')],'include':_0x1b8694[_0xc77c('0x13')]?_['map'](_0x1b8694['include'],function(_0x3cb516){return{'model':db[_0x3cb516['model']],'as':_0x3cb516['as'],'attributes':_0x3cb516['attributes']};}):[]};}):[]};}):[]:[]})[_0xc77c('0x16')](function(_0x1bc21c){logger[_0xc77c('0x17')](_0xc77c('0x1d'),_0x58fbd1);logger[_0xc77c('0x18')](_0xc77c('0x1d'),_0x58fbd1,JSON[_0xc77c('0x19')](_0x1bc21c));_0x176ba4(_0x1bc21c);})['catch'](function(_0x4f7fac){logger[_0xc77c('0x1c')]('ShowSquareProject',_0x4f7fac[_0xc77c('0x1b')],_0x58fbd1);_0x428977(_0x3da86c[_0xc77c('0x1c')](0x1f4,_0x4f7fac[_0xc77c('0x1b')]));});});}; \ No newline at end of file +var _0xef11=['../../config/logger','rpc','../../config/environment','defaults','redis','localhost','socket.io-emitter','GetSquareProjects','SquareProject','findAll','options','where','attributes','include','map','model','then','info','debug','stringify','catch','error','message','ShowSquareProject','find','raw','lodash','ioredis','../../mysqldb'];(function(_0x1ed7d0,_0x2a855a){var _0x52e8ab=function(_0x17f260){while(--_0x17f260){_0x1ed7d0['push'](_0x1ed7d0['shift']());}};_0x52e8ab(++_0x2a855a);}(_0xef11,0x159));var _0x1ef1=function(_0x1beef3,_0x57c4b8){_0x1beef3=_0x1beef3-0x0;var _0x5af964=_0xef11[_0x1beef3];return _0x5af964;};'use strict';var _=require(_0x1ef1('0x0'));var Redis=require(_0x1ef1('0x1'));var db=require(_0x1ef1('0x2'))['db'];var logger=require(_0x1ef1('0x3'))(_0x1ef1('0x4'));var config=require(_0x1ef1('0x5'));config['redis']=_[_0x1ef1('0x6')](config[_0x1ef1('0x7')],{'host':_0x1ef1('0x8'),'port':0x18eb});var socket=require(_0x1ef1('0x9'))(new Redis(config['redis']));require('./squareProject.socket')['register'](socket);exports[_0x1ef1('0xa')]=function(_0x28444f){var _0x341ac3=this;return new Promise(function(_0x30e772,_0x2beb87){return db[_0x1ef1('0xb')][_0x1ef1('0xc')]({'raw':_0x28444f[_0x1ef1('0xd')]?_0x28444f[_0x1ef1('0xd')]['raw']===undefined?!![]:![]:!![],'where':_0x28444f[_0x1ef1('0xd')]?_0x28444f[_0x1ef1('0xd')][_0x1ef1('0xe')]||null:null,'attributes':_0x28444f[_0x1ef1('0xd')]?_0x28444f['options'][_0x1ef1('0xf')]||null:null,'limit':_0x28444f['options']?_0x28444f['options']['limit']||null:null,'include':_0x28444f[_0x1ef1('0xd')]?_0x28444f[_0x1ef1('0xd')][_0x1ef1('0x10')]?_[_0x1ef1('0x11')](_0x28444f[_0x1ef1('0xd')]['include'],function(_0x14f8ce){return{'model':db[_0x14f8ce['model']],'as':_0x14f8ce['as'],'attributes':_0x14f8ce[_0x1ef1('0xf')],'include':_0x14f8ce[_0x1ef1('0x10')]?_[_0x1ef1('0x11')](_0x14f8ce['include'],function(_0x4eda56){return{'model':db[_0x4eda56[_0x1ef1('0x12')]],'as':_0x4eda56['as'],'attributes':_0x4eda56[_0x1ef1('0xf')],'include':_0x4eda56['include']?_[_0x1ef1('0x11')](_0x4eda56[_0x1ef1('0x10')],function(_0x4f29cc){return{'model':db[_0x4f29cc[_0x1ef1('0x12')]],'as':_0x4f29cc['as'],'attributes':_0x4f29cc[_0x1ef1('0xf')]};}):[]};}):[]};}):[]:[]})[_0x1ef1('0x13')](function(_0xff95db){logger[_0x1ef1('0x14')]('GetSquareProjects',_0x28444f);logger[_0x1ef1('0x15')](_0x1ef1('0xa'),_0x28444f,JSON[_0x1ef1('0x16')](_0xff95db));_0x30e772(_0xff95db);})[_0x1ef1('0x17')](function(_0x4060bf){logger[_0x1ef1('0x18')](_0x1ef1('0xa'),_0x4060bf['message'],_0x28444f);_0x2beb87(_0x341ac3['error'](0x1f4,_0x4060bf[_0x1ef1('0x19')]));});});};exports[_0x1ef1('0x1a')]=function(_0xf1e123){var _0x33bdb9=this;return new Promise(function(_0xf8b493,_0x22863d){return db[_0x1ef1('0xb')][_0x1ef1('0x1b')]({'raw':_0xf1e123[_0x1ef1('0xd')]?_0xf1e123[_0x1ef1('0xd')][_0x1ef1('0x1c')]===undefined?!![]:![]:!![],'where':_0xf1e123[_0x1ef1('0xd')]?_0xf1e123['options'][_0x1ef1('0xe')]||null:null,'attributes':_0xf1e123[_0x1ef1('0xd')]?_0xf1e123['options'][_0x1ef1('0xf')]||null:null,'include':_0xf1e123['options']?_0xf1e123['options'][_0x1ef1('0x10')]?_[_0x1ef1('0x11')](_0xf1e123[_0x1ef1('0xd')][_0x1ef1('0x10')],function(_0x2f4c5b){return{'model':db[_0x2f4c5b['model']],'as':_0x2f4c5b['as'],'attributes':_0x2f4c5b[_0x1ef1('0xf')],'include':_0x2f4c5b[_0x1ef1('0x10')]?_['map'](_0x2f4c5b[_0x1ef1('0x10')],function(_0x3200ac){return{'model':db[_0x3200ac[_0x1ef1('0x12')]],'as':_0x3200ac['as'],'attributes':_0x3200ac[_0x1ef1('0xf')],'include':_0x3200ac[_0x1ef1('0x10')]?_[_0x1ef1('0x11')](_0x3200ac[_0x1ef1('0x10')],function(_0x38f245){return{'model':db[_0x38f245['model']],'as':_0x38f245['as'],'attributes':_0x38f245['attributes']};}):[]};}):[]};}):[]:[]})[_0x1ef1('0x13')](function(_0x1f8cbe){logger[_0x1ef1('0x14')](_0x1ef1('0x1a'),_0xf1e123);logger[_0x1ef1('0x15')](_0x1ef1('0x1a'),_0xf1e123,JSON[_0x1ef1('0x16')](_0x1f8cbe));_0xf8b493(_0x1f8cbe);})['catch'](function(_0x1c3649){logger[_0x1ef1('0x18')](_0x1ef1('0x1a'),_0x1c3649[_0x1ef1('0x19')],_0xf1e123);_0x22863d(_0x33bdb9[_0x1ef1('0x18')](0x1f4,_0x1c3649[_0x1ef1('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/squareProject/squareProject.socket.js b/server/api/squareProject/squareProject.socket.js index 460a788..bd57256 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 _0x18f1=['squareProject:','save','remove','emit','register','length'];(function(_0x34b638,_0x39cb7c){var _0x574638=function(_0xcf46b6){while(--_0xcf46b6){_0x34b638['push'](_0x34b638['shift']());}};_0x574638(++_0x39cb7c);}(_0x18f1,0x7f));var _0x118f=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x18f1[_0x57b54c];return _0x59cc19;};'use strict';var SquareProjectEvents=require('./squareProject.events');var events=[_0x118f('0x0'),_0x118f('0x1'),'update'];function createListener(_0x20778e,_0x588028){return function(_0x603c0e){_0x588028[_0x118f('0x2')](_0x20778e,_0x603c0e);};}function removeListener(_0x524e71,_0x1fecf0){return function(){SquareProjectEvents['removeListener'](_0x524e71,_0x1fecf0);};}exports[_0x118f('0x3')]=function(_0x35d3c8){for(var _0x47ca22=0x0,_0x575054=events[_0x118f('0x4')];_0x47ca22<_0x575054;_0x47ca22++){var _0x399177=events[_0x47ca22];var _0x437f4e=createListener(_0x118f('0x5')+_0x399177,_0x35d3c8);SquareProjectEvents['on'](_0x399177,_0x437f4e);}}; \ No newline at end of file +var _0x7cf5=['removeListener','register','length','squareProject:','./squareProject.events','save','remove','update'];(function(_0x18a4de,_0x41a042){var _0x51081a=function(_0x4f399f){while(--_0x4f399f){_0x18a4de['push'](_0x18a4de['shift']());}};_0x51081a(++_0x41a042);}(_0x7cf5,0x1ac));var _0x57cf=function(_0x5f22a6,_0x4f6b07){_0x5f22a6=_0x5f22a6-0x0;var _0x2524d2=_0x7cf5[_0x5f22a6];return _0x2524d2;};'use strict';var SquareProjectEvents=require(_0x57cf('0x0'));var events=[_0x57cf('0x1'),_0x57cf('0x2'),_0x57cf('0x3')];function createListener(_0x45aa3f,_0x17a995){return function(_0x1779cb){_0x17a995['emit'](_0x45aa3f,_0x1779cb);};}function removeListener(_0x3515b9,_0x567f70){return function(){SquareProjectEvents[_0x57cf('0x4')](_0x3515b9,_0x567f70);};}exports[_0x57cf('0x5')]=function(_0x49a30f){for(var _0x562c01=0x0,_0x1b0570=events[_0x57cf('0x6')];_0x562c01<_0x1b0570;_0x562c01++){var _0x49ac07=events[_0x562c01];var _0x39abcc=createListener(_0x57cf('0x7')+_0x49ac07,_0x49a30f);SquareProjectEvents['on'](_0x49ac07,_0x39abcc);}}; \ No newline at end of file diff --git a/server/api/squareRecording/index.js b/server/api/squareRecording/index.js index f00687c..1f10c01 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 _0xe14b=['Router','../../components/auth/service','./squareRecording.controller','get','isAuthenticated','index','/:id','download','post','delete','destroy','exports','multer','util','express'];(function(_0x2e74b2,_0x2b6259){var _0x49aa19=function(_0x5e060e){while(--_0x5e060e){_0x2e74b2['push'](_0x2e74b2['shift']());}};_0x49aa19(++_0x2b6259);}(_0xe14b,0x93));var _0xbe14=function(_0x488c9a,_0x39a741){_0x488c9a=_0x488c9a-0x0;var _0x3b3807=_0xe14b[_0x488c9a];return _0x3b3807;};'use strict';var multer=require(_0xbe14('0x0'));var util=require(_0xbe14('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xbe14('0x2'));var router=express[_0xbe14('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xbe14('0x4'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0xbe14('0x5'));router[_0xbe14('0x6')]('/',auth[_0xbe14('0x7')](),controller[_0xbe14('0x8')]);router[_0xbe14('0x6')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['show']);router['get']('/:id/download',auth[_0xbe14('0x7')](),controller[_0xbe14('0xa')]);router[_0xbe14('0xb')]('/',auth[_0xbe14('0x7')](),controller['create']);router['put'](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller['update']);router[_0xbe14('0xc')](_0xbe14('0x9'),auth[_0xbe14('0x7')](),controller[_0xbe14('0xd')]);module[_0xbe14('0xe')]=router; \ No newline at end of file +var _0x4975=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareRecording.controller','get','index','/:id','isAuthenticated','show','/:id/download','download','post','create','put','update','destroy','exports','multer','path','connect-timeout','express'];(function(_0x270876,_0x50516b){var _0x1bc190=function(_0x555995){while(--_0x555995){_0x270876['push'](_0x270876['shift']());}};_0x1bc190(++_0x50516b);}(_0x4975,0x86));var _0x5497=function(_0x1ab1e6,_0x5edd5d){_0x1ab1e6=_0x1ab1e6-0x0;var _0x2ab36a=_0x4975[_0x1ab1e6];return _0x2ab36a;};'use strict';var multer=require(_0x5497('0x0'));var util=require('util');var path=require(_0x5497('0x1'));var timeout=require(_0x5497('0x2'));var express=require(_0x5497('0x3'));var router=express[_0x5497('0x4')]();var fs_extra=require(_0x5497('0x5'));var auth=require(_0x5497('0x6'));var interaction=require(_0x5497('0x7'));var config=require(_0x5497('0x8'));var controller=require(_0x5497('0x9'));router[_0x5497('0xa')]('/',auth['isAuthenticated'](),controller[_0x5497('0xb')]);router['get'](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0xe')]);router['get'](_0x5497('0xf'),auth['isAuthenticated'](),controller[_0x5497('0x10')]);router[_0x5497('0x11')]('/',auth[_0x5497('0xd')](),controller[_0x5497('0x12')]);router[_0x5497('0x13')](_0x5497('0xc'),auth[_0x5497('0xd')](),controller[_0x5497('0x14')]);router['delete']('/:id',auth['isAuthenticated'](),controller[_0x5497('0x15')]);module[_0x5497('0x16')]=router; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.attributes.js b/server/api/squareRecording/squareRecording.attributes.js index c303646..bf4c8e5 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 _0xdc97=['savePath','substring','lastIndexOf','sequelize','exports','STRING','VIRTUAL','getDataValue'];(function(_0x2085f3,_0x50105b){var _0x384e3c=function(_0x235fa0){while(--_0x235fa0){_0x2085f3['push'](_0x2085f3['shift']());}};_0x384e3c(++_0x50105b);}(_0xdc97,0x13b));var _0x7dc9=function(_0x645c10,_0x3530a2){_0x645c10=_0x645c10-0x0;var _0x45cf45=_0xdc97[_0x645c10];return _0x45cf45;};'use strict';var Sequelize=require(_0x7dc9('0x0'));module[_0x7dc9('0x1')]={'uniqueid':{'type':Sequelize[_0x7dc9('0x2')]},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x7dc9('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x7dc9('0x2')]},'priority':{'type':Sequelize[_0x7dc9('0x2')]},'accountcode':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize[_0x7dc9('0x2')]},'projectName':{'type':Sequelize[_0x7dc9('0x2')]},'saveName':{'type':Sequelize[_0x7dc9('0x2')]},'filename':{'type':Sequelize[_0x7dc9('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x7dc9('0x3')],'get':function(){var _0x4f91c7='';var _0x4b3229=this[_0x7dc9('0x4')](_0x7dc9('0x5'));if(_0x4b3229){_0x4f91c7=_0x4b3229[_0x7dc9('0x6')](_0x4b3229[_0x7dc9('0x7')]('.'));}return _0x4f91c7;}}}; \ No newline at end of file +var _0xa630=['substring','sequelize','exports','STRING','VIRTUAL','getDataValue','savePath'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa630,0xbe));var _0x0a63=function(_0xc17925,_0x49af85){_0xc17925=_0xc17925-0x0;var _0x526a2c=_0xa630[_0xc17925];return _0x526a2c;};'use strict';var Sequelize=require(_0x0a63('0x0'));module[_0x0a63('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize[_0x0a63('0x2')]},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x0a63('0x2')]},'priority':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x0a63('0x2')]},'dnid':{'type':Sequelize[_0x0a63('0x2')]},'projectName':{'type':Sequelize[_0x0a63('0x2')]},'saveName':{'type':Sequelize[_0x0a63('0x2')]},'filename':{'type':Sequelize[_0x0a63('0x2')]},'savePath':{'type':Sequelize['STRING']},'format':{'type':Sequelize[_0x0a63('0x3')],'get':function(){var _0x3d5f0b='';var _0xc2dcd7=this[_0x0a63('0x4')](_0x0a63('0x5'));if(_0xc2dcd7){_0x3d5f0b=_0xc2dcd7[_0x0a63('0x6')](_0xc2dcd7['lastIndexOf']('.'));}return _0x3d5f0b;}}}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.controller.js b/server/api/squareRecording/squareRecording.controller.js index 77d11f3..938435f 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 _0xcce5=['filename','format','decryptFile','secrets','recording','existsSync','ValidationError','SquareRecording\x20not\x20found','extname','unlink','message','Not\x20found','isNil','cancellazione\x20fisica\x20documento\x20%s','info','unlinkSync','.cypher','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','Content-Range','reject','save','update','then','destroy','end','error','stack','name','send','index','SquareRecording','rawAttributes','type','key','model','query','keys','filters','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','options','includeAll','include','rows','show','params','intersection','fields','find','catch','create','body','download','uniqueid','savePath'];(function(_0x178e48,_0x3c9509){var _0x440d7e=function(_0xc2f8a0){while(--_0xc2f8a0){_0x178e48['push'](_0x178e48['shift']());}};_0x440d7e(++_0x3c9509);}(_0xcce5,0x73));var _0x5cce=function(_0x548684,_0x1eec08){_0x548684=_0x548684-0x0;var _0x57bfc9=_0xcce5[_0x548684];return _0x57bfc9;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5cce('0x0'));var zipdir=require(_0x5cce('0x1'));var jsonpatch=require(_0x5cce('0x2'));var rp=require(_0x5cce('0x3'));var moment=require('moment');var BPromise=require(_0x5cce('0x4'));var Mustache=require(_0x5cce('0x5'));var util=require(_0x5cce('0x6'));var path=require(_0x5cce('0x7'));var sox=require(_0x5cce('0x8'));var csv=require(_0x5cce('0x9'));var ejs=require(_0x5cce('0xa'));var fs=require('fs');var fs_extra=require(_0x5cce('0xb'));var _=require(_0x5cce('0xc'));var squel=require(_0x5cce('0xd'));var crypto=require(_0x5cce('0xe'));var jsforce=require(_0x5cce('0xf'));var deskjs=require(_0x5cce('0x10'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x5cce('0x11'));var Redis=require(_0x5cce('0x12'));var authService=require(_0x5cce('0x13'));var qs=require(_0x5cce('0x14'));var as=require(_0x5cce('0x15'));var hardwareService=require(_0x5cce('0x16'));var logger=require(_0x5cce('0x17'))(_0x5cce('0x18'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x5cce('0x19'));var db=require(_0x5cce('0x1a'))['db'];function respondWithStatusCode(_0x137b01,_0x6cd34b){_0x6cd34b=_0x6cd34b||0xcc;return function(_0x3144c6){if(_0x3144c6){return _0x137b01[_0x5cce('0x1b')](_0x6cd34b);}return _0x137b01[_0x5cce('0x1c')](_0x6cd34b)['end']();};}function respondWithResult(_0x5404e3,_0x5b566d){_0x5b566d=_0x5b566d||0xc8;return function(_0x451c06){if(_0x451c06){return _0x5404e3[_0x5cce('0x1c')](_0x5b566d)[_0x5cce('0x1d')](_0x451c06);}};}function respondWithFilteredResult(_0x39395d,_0x54bdc9){return function(_0x2e2292){if(_0x2e2292){var _0x32b5f9=typeof _0x54bdc9[_0x5cce('0x1e')]===_0x5cce('0x1f')&&typeof _0x54bdc9[_0x5cce('0x20')]===_0x5cce('0x1f');var _0xf54efa=_0x2e2292[_0x5cce('0x21')];var _0x226461=_0x32b5f9?0x0:_0x54bdc9[_0x5cce('0x1e')];var _0x4398e4=_0x32b5f9?_0x2e2292[_0x5cce('0x21')]:_0x54bdc9['offset']+_0x54bdc9['limit'];var _0x25dfab;if(_0x4398e4>=_0xf54efa){_0x4398e4=_0xf54efa;_0x25dfab=0xc8;}else{_0x25dfab=0xce;}_0x39395d[_0x5cce('0x1c')](_0x25dfab);return _0x39395d['set'](_0x5cce('0x22'),_0x226461+'-'+_0x4398e4+'/'+_0xf54efa)[_0x5cce('0x1d')](_0x2e2292);}return null;};}function patchUpdates(_0x3f706d){return function(_0x2b216d){try{jsonpatch['apply'](_0x2b216d,_0x3f706d,!![]);}catch(_0x55a597){return BPromise[_0x5cce('0x23')](_0x55a597);}return _0x2b216d[_0x5cce('0x24')]();};}function saveUpdates(_0x474142,_0x5ec6c1){return function(_0xf31ef6){if(_0xf31ef6){return _0xf31ef6[_0x5cce('0x25')](_0x474142)[_0x5cce('0x26')](function(_0x3db7b0){return _0x3db7b0;});}return null;};}function removeEntity(_0x13ce77,_0x31f02c){return function(_0x1383b7){if(_0x1383b7){return _0x1383b7[_0x5cce('0x27')]()[_0x5cce('0x26')](function(){_0x13ce77[_0x5cce('0x1c')](0xcc)[_0x5cce('0x28')]();});}};}function handleEntityNotFound(_0x15518b,_0xc660d4){return function(_0x35e55a){if(!_0x35e55a){_0x15518b[_0x5cce('0x1b')](0x194);}return _0x35e55a;};}function handleError(_0x36a76c,_0x400de5){_0x400de5=_0x400de5||0x1f4;return function(_0x596f43){logger[_0x5cce('0x29')](_0x596f43[_0x5cce('0x2a')]);if(_0x596f43[_0x5cce('0x2b')]){delete _0x596f43[_0x5cce('0x2b')];}_0x36a76c[_0x5cce('0x1c')](_0x400de5)[_0x5cce('0x2c')](_0x596f43);};}exports[_0x5cce('0x2d')]=function(_0x5c4fe8,_0x102f21){var _0x2018da={},_0x343799={},_0xf6856={'count':0x0,'rows':[]};var _0x188bfe=_['map'](db[_0x5cce('0x2e')][_0x5cce('0x2f')],function(_0x451625){return{'name':_0x451625['fieldName'],'type':_0x451625[_0x5cce('0x30')][_0x5cce('0x31')]};});_0x343799[_0x5cce('0x32')]=_['map'](_0x188bfe,_0x5cce('0x2b'));_0x343799[_0x5cce('0x33')]=_[_0x5cce('0x34')](_0x5c4fe8[_0x5cce('0x33')]);_0x343799[_0x5cce('0x35')]=_['intersection'](_0x343799[_0x5cce('0x32')],_0x343799[_0x5cce('0x33')]);_0x2018da[_0x5cce('0x36')]=_['intersection'](_0x343799[_0x5cce('0x32')],qs['fields'](_0x5c4fe8[_0x5cce('0x33')]['fields']));_0x2018da['attributes']=_0x2018da[_0x5cce('0x36')][_0x5cce('0x37')]?_0x2018da[_0x5cce('0x36')]:_0x343799[_0x5cce('0x32')];if(!_0x5c4fe8['query'][_0x5cce('0x38')](_0x5cce('0x39'))){_0x2018da[_0x5cce('0x20')]=qs[_0x5cce('0x20')](_0x5c4fe8[_0x5cce('0x33')][_0x5cce('0x20')]);_0x2018da['offset']=qs['offset'](_0x5c4fe8[_0x5cce('0x33')][_0x5cce('0x1e')]);}_0x2018da[_0x5cce('0x3a')]=qs[_0x5cce('0x3b')](_0x5c4fe8[_0x5cce('0x33')][_0x5cce('0x3b')]);_0x2018da[_0x5cce('0x3c')]=qs['filters'](_[_0x5cce('0x3d')](_0x5c4fe8[_0x5cce('0x33')],_0x343799[_0x5cce('0x35')]),_0x188bfe);if(_0x5c4fe8['query'][_0x5cce('0x3e')]){_0x2018da[_0x5cce('0x3c')]=_[_0x5cce('0x3f')](_0x2018da[_0x5cce('0x3c')],{'$or':_['map'](_0x188bfe,function(_0x490aab){if(_0x490aab['type']!=='VIRTUAL'){var _0x59d346={};_0x59d346[_0x490aab['name']]={'$like':'%'+_0x5c4fe8[_0x5cce('0x33')][_0x5cce('0x3e')]+'%'};return _0x59d346;}})});}_0x2018da=_[_0x5cce('0x3f')]({},_0x2018da,_0x5c4fe8[_0x5cce('0x40')]);var _0x311fb9={'where':_0x2018da['where']};return db['SquareRecording']['count'](_0x311fb9)[_0x5cce('0x26')](function(_0x15f2ad){_0xf6856[_0x5cce('0x21')]=_0x15f2ad;if(_0x5c4fe8[_0x5cce('0x33')][_0x5cce('0x41')]){_0x2018da[_0x5cce('0x42')]=[{'all':!![]}];}return db[_0x5cce('0x2e')]['findAll'](_0x2018da);})[_0x5cce('0x26')](function(_0x19a498){_0xf6856[_0x5cce('0x43')]=_0x19a498;return _0xf6856;})['then'](respondWithFilteredResult(_0x102f21,_0x2018da))['catch'](handleError(_0x102f21,null));};exports[_0x5cce('0x44')]=function(_0x4b92f1,_0x3aea94){var _0x54823a={'raw':!![],'where':{'id':_0x4b92f1[_0x5cce('0x45')]['id']}},_0x12f45a={};_0x12f45a['model']=_[_0x5cce('0x34')](db[_0x5cce('0x2e')][_0x5cce('0x2f')]);_0x12f45a['query']=_[_0x5cce('0x34')](_0x4b92f1[_0x5cce('0x33')]);_0x12f45a[_0x5cce('0x35')]=_['intersection'](_0x12f45a['model'],_0x12f45a[_0x5cce('0x33')]);_0x54823a[_0x5cce('0x36')]=_[_0x5cce('0x46')](_0x12f45a[_0x5cce('0x32')],qs[_0x5cce('0x47')](_0x4b92f1['query'][_0x5cce('0x47')]));_0x54823a['attributes']=_0x54823a['attributes']['length']?_0x54823a[_0x5cce('0x36')]:_0x12f45a[_0x5cce('0x32')];if(_0x4b92f1[_0x5cce('0x33')][_0x5cce('0x41')]){_0x54823a[_0x5cce('0x42')]=[{'all':!![]}];}_0x54823a=_[_0x5cce('0x3f')]({},_0x54823a,_0x4b92f1['options']);return db[_0x5cce('0x2e')][_0x5cce('0x48')](_0x54823a)['then'](handleEntityNotFound(_0x3aea94,null))[_0x5cce('0x26')](respondWithResult(_0x3aea94,null))[_0x5cce('0x49')](handleError(_0x3aea94,null));};exports['create']=function(_0x47e109,_0x49f58c){return db[_0x5cce('0x2e')][_0x5cce('0x4a')](_0x47e109[_0x5cce('0x4b')],{})['then'](respondWithResult(_0x49f58c,0xc9))[_0x5cce('0x49')](handleError(_0x49f58c,null));};exports[_0x5cce('0x25')]=function(_0x509eb3,_0x5964fa){if(_0x509eb3['body']['id']){delete _0x509eb3[_0x5cce('0x4b')]['id'];}return db[_0x5cce('0x2e')][_0x5cce('0x48')]({'where':{'id':_0x509eb3[_0x5cce('0x45')]['id']}})['then'](handleEntityNotFound(_0x5964fa,null))[_0x5cce('0x26')](saveUpdates(_0x509eb3[_0x5cce('0x4b')],null))[_0x5cce('0x26')](respondWithResult(_0x5964fa,null))[_0x5cce('0x49')](handleError(_0x5964fa,null));};exports[_0x5cce('0x4c')]=function(_0x6656b1,_0x36f2ac,_0x4a312d){var _0x32ca15=require('../../components/encryptor');var _0x29ed69=![];var _0x418843={};if(_0x6656b1['query'][_0x5cce('0x30')]&&_0x6656b1[_0x5cce('0x33')]['type']===_0x5cce('0x4d')){_0x418843[_0x5cce('0x4d')]=_0x6656b1[_0x5cce('0x45')]['id'];}else{_0x418843['id']=_0x6656b1['params']['id'];}return db[_0x5cce('0x2e')]['find']({'where':_0x418843,'attributes':['id',_0x5cce('0x4e'),_0x5cce('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x36f2ac,null))[_0x5cce('0x26')](function(_0x3db75d){if(_0x3db75d){var _0x345670=_0x3db75d['savePath'];var _0x8bd6a3=util[_0x5cce('0x50')]('%s.cypher',_0x345670);if(fs['existsSync'](_0x8bd6a3)){_0x29ed69=!![];return _0x32ca15[_0x5cce('0x51')](_0x8bd6a3,_0x345670,config[_0x5cce('0x52')][_0x5cce('0x53')])['then'](function(){return _0x3db75d;});}return _0x3db75d;}})[_0x5cce('0x26')](function(_0x3f3966){if(_0x3f3966){var _0x40cc6d=_0x3f3966[_0x5cce('0x4e')];if(!fs[_0x5cce('0x54')](_0x40cc6d)){throw new db['Sequelize'][(_0x5cce('0x55'))](_0x5cce('0x56'));}if(_0x3f3966[_0x5cce('0x4f')]){return _0x36f2ac['download'](_0x40cc6d,_0x3f3966['filename']+path[_0x5cce('0x57')](_0x40cc6d),function(){if(_0x29ed69){fs[_0x5cce('0x58')](_0x40cc6d);}});}else{return _0x36f2ac[_0x5cce('0x4c')](_0x40cc6d,function(_0x341a63){if(_0x29ed69){fs[_0x5cce('0x58')](_0x40cc6d);}});}}})[_0x5cce('0x49')](function(_0x4d59f1){if(_0x4d59f1[_0x5cce('0x59')]==='SquareRecording\x20not\x20found'){_0x36f2ac['status'](0x194)[_0x5cce('0x2c')](_0x5cce('0x5a'));}else{return handleError(_0x36f2ac,null);}});};exports[_0x5cce('0x27')]=function(_0x6ad149,_0x241dce){return db[_0x5cce('0x2e')]['find']({'where':{'id':_0x6ad149['params']['id']}})[_0x5cce('0x26')](function(_0x1e0921){if(_[_0x5cce('0x5b')](_0x1e0921)){throw new ReferenceError('Entity\x20not\x20found');}return _0x1e0921;})[_0x5cce('0x26')](function(_0x130fc3){var _0x56f338=_0x130fc3[_0x5cce('0x4e')];logger['info'](_0x5cce('0x5c'),_0x56f338);if(!_[_0x5cce('0x5b')](_0x130fc3[_0x5cce('0x4e')])&&fs[_0x5cce('0x54')](_0x56f338)){logger[_0x5cce('0x5d')]('File:\x20\x22'+_0x56f338+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x5cce('0x5e')](_0x56f338);}_0x56f338=_0x56f338+_0x5cce('0x5f');if(!_[_0x5cce('0x5b')](_0x130fc3[_0x5cce('0x4e')])&&fs[_0x5cce('0x54')](_0x56f338)){logger[_0x5cce('0x5d')]('File:\x20\x22'+_0x56f338+_0x5cce('0x60'));fs[_0x5cce('0x5e')](_0x56f338);}return _0x130fc3;})[_0x5cce('0x26')](function(_0x1657de){if(!_0x1657de)throw new InternalError();return _0x1657de[_0x5cce('0x27')]();})['then'](function(){_0x241dce[_0x5cce('0x1c')](0xcc)[_0x5cce('0x28')]();})[_0x5cce('0x49')](handleError(_0x241dce,null));}; \ No newline at end of file +var _0x9a8d=['../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','offset','undefined','count','limit','set','Content-Range','reject','save','update','then','destroy','sendStatus','error','stack','name','index','map','SquareRecording','rawAttributes','fieldName','type','key','query','keys','intersection','model','attributes','length','nolimit','order','sort','filters','filter','where','merge','options','includeAll','include','findAll','show','params','fields','find','catch','create','body','download','../../components/encryptor','uniqueid','savePath','filename','format','existsSync','secrets','recording','Sequelize','SquareRecording\x20not\x20found','unlink','message','isNil','Entity\x20not\x20found','info','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','.cypher','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','sox','to-csv','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs'];(function(_0x279b2b,_0x41aceb){var _0xba1cd3=function(_0x733981){while(--_0x733981){_0x279b2b['push'](_0x279b2b['shift']());}};_0xba1cd3(++_0x41aceb);}(_0x9a8d,0x1c6));var _0xd9a8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9a8d[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0xd9a8('0x0'));var rimraf=require(_0xd9a8('0x1'));var zipdir=require(_0xd9a8('0x2'));var jsonpatch=require(_0xd9a8('0x3'));var rp=require('request-promise');var moment=require(_0xd9a8('0x4'));var BPromise=require(_0xd9a8('0x5'));var Mustache=require(_0xd9a8('0x6'));var util=require(_0xd9a8('0x7'));var path=require('path');var sox=require(_0xd9a8('0x8'));var csv=require(_0xd9a8('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xd9a8('0xa'));var _=require(_0xd9a8('0xb'));var squel=require(_0xd9a8('0xc'));var crypto=require(_0xd9a8('0xd'));var jsforce=require(_0xd9a8('0xe'));var deskjs=require(_0xd9a8('0xf'));var toCsv=require(_0xd9a8('0x9'));var querystring=require(_0xd9a8('0x10'));var Papa=require(_0xd9a8('0x11'));var Redis=require(_0xd9a8('0x12'));var authService=require(_0xd9a8('0x13'));var qs=require(_0xd9a8('0x14'));var as=require(_0xd9a8('0x15'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xd9a8('0x16'))('api');var utils=require(_0xd9a8('0x17'));var config=require(_0xd9a8('0x18'));var licenseUtil=require(_0xd9a8('0x19'));var db=require(_0xd9a8('0x1a'))['db'];function respondWithStatusCode(_0x5849d0,_0x539b38){_0x539b38=_0x539b38||0xcc;return function(_0x48394a){if(_0x48394a){return _0x5849d0['sendStatus'](_0x539b38);}return _0x5849d0['status'](_0x539b38)[_0xd9a8('0x1b')]();};}function respondWithResult(_0x427e4a,_0xd839e4){_0xd839e4=_0xd839e4||0xc8;return function(_0x4002b9){if(_0x4002b9){return _0x427e4a[_0xd9a8('0x1c')](_0xd839e4)['json'](_0x4002b9);}};}function respondWithFilteredResult(_0x4cecc0,_0x4ddc3d){return function(_0x74ae2e){if(_0x74ae2e){var _0x1d29fa=typeof _0x4ddc3d[_0xd9a8('0x1d')]===_0xd9a8('0x1e')&&typeof _0x4ddc3d['limit']==='undefined';var _0x3dae59=_0x74ae2e[_0xd9a8('0x1f')];var _0x17c577=_0x1d29fa?0x0:_0x4ddc3d[_0xd9a8('0x1d')];var _0x387238=_0x1d29fa?_0x74ae2e[_0xd9a8('0x1f')]:_0x4ddc3d[_0xd9a8('0x1d')]+_0x4ddc3d[_0xd9a8('0x20')];var _0x2a31b4;if(_0x387238>=_0x3dae59){_0x387238=_0x3dae59;_0x2a31b4=0xc8;}else{_0x2a31b4=0xce;}_0x4cecc0[_0xd9a8('0x1c')](_0x2a31b4);return _0x4cecc0[_0xd9a8('0x21')](_0xd9a8('0x22'),_0x17c577+'-'+_0x387238+'/'+_0x3dae59)['json'](_0x74ae2e);}return null;};}function patchUpdates(_0x504e10){return function(_0x3bcb34){try{jsonpatch['apply'](_0x3bcb34,_0x504e10,!![]);}catch(_0x44ea49){return BPromise[_0xd9a8('0x23')](_0x44ea49);}return _0x3bcb34[_0xd9a8('0x24')]();};}function saveUpdates(_0x353972,_0x114109){return function(_0x3c3d03){if(_0x3c3d03){return _0x3c3d03[_0xd9a8('0x25')](_0x353972)[_0xd9a8('0x26')](function(_0x253c2a){return _0x253c2a;});}return null;};}function removeEntity(_0x39df35,_0x3cf1ab){return function(_0x1ff326){if(_0x1ff326){return _0x1ff326[_0xd9a8('0x27')]()['then'](function(){_0x39df35[_0xd9a8('0x1c')](0xcc)[_0xd9a8('0x1b')]();});}};}function handleEntityNotFound(_0x5b7203,_0x1d1c62){return function(_0x197ca7){if(!_0x197ca7){_0x5b7203[_0xd9a8('0x28')](0x194);}return _0x197ca7;};}function handleError(_0x5289c2,_0x28d95c){_0x28d95c=_0x28d95c||0x1f4;return function(_0x68628a){logger[_0xd9a8('0x29')](_0x68628a[_0xd9a8('0x2a')]);if(_0x68628a[_0xd9a8('0x2b')]){delete _0x68628a[_0xd9a8('0x2b')];}_0x5289c2[_0xd9a8('0x1c')](_0x28d95c)['send'](_0x68628a);};}exports[_0xd9a8('0x2c')]=function(_0x69513b,_0x599dad){var _0x263e58={},_0x38c711={},_0x20c0be={'count':0x0,'rows':[]};var _0x484154=_[_0xd9a8('0x2d')](db[_0xd9a8('0x2e')][_0xd9a8('0x2f')],function(_0x27ced8){return{'name':_0x27ced8[_0xd9a8('0x30')],'type':_0x27ced8[_0xd9a8('0x31')][_0xd9a8('0x32')]};});_0x38c711['model']=_[_0xd9a8('0x2d')](_0x484154,'name');_0x38c711[_0xd9a8('0x33')]=_[_0xd9a8('0x34')](_0x69513b[_0xd9a8('0x33')]);_0x38c711['filters']=_[_0xd9a8('0x35')](_0x38c711['model'],_0x38c711['query']);_0x263e58['attributes']=_[_0xd9a8('0x35')](_0x38c711[_0xd9a8('0x36')],qs['fields'](_0x69513b[_0xd9a8('0x33')]['fields']));_0x263e58[_0xd9a8('0x37')]=_0x263e58[_0xd9a8('0x37')][_0xd9a8('0x38')]?_0x263e58['attributes']:_0x38c711['model'];if(!_0x69513b[_0xd9a8('0x33')]['hasOwnProperty'](_0xd9a8('0x39'))){_0x263e58[_0xd9a8('0x20')]=qs[_0xd9a8('0x20')](_0x69513b[_0xd9a8('0x33')][_0xd9a8('0x20')]);_0x263e58['offset']=qs[_0xd9a8('0x1d')](_0x69513b[_0xd9a8('0x33')][_0xd9a8('0x1d')]);}_0x263e58[_0xd9a8('0x3a')]=qs['sort'](_0x69513b[_0xd9a8('0x33')][_0xd9a8('0x3b')]);_0x263e58['where']=qs[_0xd9a8('0x3c')](_['pick'](_0x69513b[_0xd9a8('0x33')],_0x38c711['filters']),_0x484154);if(_0x69513b[_0xd9a8('0x33')][_0xd9a8('0x3d')]){_0x263e58[_0xd9a8('0x3e')]=_['merge'](_0x263e58[_0xd9a8('0x3e')],{'$or':_['map'](_0x484154,function(_0x27ccca){if(_0x27ccca[_0xd9a8('0x31')]!=='VIRTUAL'){var _0x59032e={};_0x59032e[_0x27ccca[_0xd9a8('0x2b')]]={'$like':'%'+_0x69513b[_0xd9a8('0x33')][_0xd9a8('0x3d')]+'%'};return _0x59032e;}})});}_0x263e58=_[_0xd9a8('0x3f')]({},_0x263e58,_0x69513b[_0xd9a8('0x40')]);var _0x602c16={'where':_0x263e58[_0xd9a8('0x3e')]};return db[_0xd9a8('0x2e')][_0xd9a8('0x1f')](_0x602c16)['then'](function(_0x1cf161){_0x20c0be[_0xd9a8('0x1f')]=_0x1cf161;if(_0x69513b[_0xd9a8('0x33')][_0xd9a8('0x41')]){_0x263e58[_0xd9a8('0x42')]=[{'all':!![]}];}return db['SquareRecording'][_0xd9a8('0x43')](_0x263e58);})[_0xd9a8('0x26')](function(_0x3f1381){_0x20c0be['rows']=_0x3f1381;return _0x20c0be;})[_0xd9a8('0x26')](respondWithFilteredResult(_0x599dad,_0x263e58))['catch'](handleError(_0x599dad,null));};exports[_0xd9a8('0x44')]=function(_0x52ed9e,_0x4c9641){var _0x13e758={'raw':!![],'where':{'id':_0x52ed9e[_0xd9a8('0x45')]['id']}},_0x43d0c3={};_0x43d0c3[_0xd9a8('0x36')]=_['keys'](db[_0xd9a8('0x2e')][_0xd9a8('0x2f')]);_0x43d0c3['query']=_[_0xd9a8('0x34')](_0x52ed9e[_0xd9a8('0x33')]);_0x43d0c3[_0xd9a8('0x3c')]=_[_0xd9a8('0x35')](_0x43d0c3[_0xd9a8('0x36')],_0x43d0c3[_0xd9a8('0x33')]);_0x13e758['attributes']=_['intersection'](_0x43d0c3[_0xd9a8('0x36')],qs[_0xd9a8('0x46')](_0x52ed9e[_0xd9a8('0x33')][_0xd9a8('0x46')]));_0x13e758[_0xd9a8('0x37')]=_0x13e758[_0xd9a8('0x37')]['length']?_0x13e758[_0xd9a8('0x37')]:_0x43d0c3['model'];if(_0x52ed9e[_0xd9a8('0x33')][_0xd9a8('0x41')]){_0x13e758[_0xd9a8('0x42')]=[{'all':!![]}];}_0x13e758=_[_0xd9a8('0x3f')]({},_0x13e758,_0x52ed9e[_0xd9a8('0x40')]);return db['SquareRecording'][_0xd9a8('0x47')](_0x13e758)[_0xd9a8('0x26')](handleEntityNotFound(_0x4c9641,null))[_0xd9a8('0x26')](respondWithResult(_0x4c9641,null))[_0xd9a8('0x48')](handleError(_0x4c9641,null));};exports[_0xd9a8('0x49')]=function(_0xdb2b22,_0x1bdbd2){return db[_0xd9a8('0x2e')][_0xd9a8('0x49')](_0xdb2b22[_0xd9a8('0x4a')],{})[_0xd9a8('0x26')](respondWithResult(_0x1bdbd2,0xc9))['catch'](handleError(_0x1bdbd2,null));};exports[_0xd9a8('0x25')]=function(_0x520dae,_0x547a0f){if(_0x520dae[_0xd9a8('0x4a')]['id']){delete _0x520dae['body']['id'];}return db[_0xd9a8('0x2e')][_0xd9a8('0x47')]({'where':{'id':_0x520dae['params']['id']}})[_0xd9a8('0x26')](handleEntityNotFound(_0x547a0f,null))[_0xd9a8('0x26')](saveUpdates(_0x520dae[_0xd9a8('0x4a')],null))[_0xd9a8('0x26')](respondWithResult(_0x547a0f,null))['catch'](handleError(_0x547a0f,null));};exports[_0xd9a8('0x4b')]=function(_0x2ca425,_0x9fdb9e,_0x4913c1){var _0x3b6d73=require(_0xd9a8('0x4c'));var _0x1dabc9=![];var _0xa68077={};if(_0x2ca425['query'][_0xd9a8('0x31')]&&_0x2ca425[_0xd9a8('0x33')][_0xd9a8('0x31')]===_0xd9a8('0x4d')){_0xa68077[_0xd9a8('0x4d')]=_0x2ca425['params']['id'];}else{_0xa68077['id']=_0x2ca425[_0xd9a8('0x45')]['id'];}return db[_0xd9a8('0x2e')][_0xd9a8('0x47')]({'where':_0xa68077,'attributes':['id',_0xd9a8('0x4e'),_0xd9a8('0x4f')],'raw':!![]})['then'](handleEntityNotFound(_0x9fdb9e,null))['then'](function(_0x31f8c3){if(_0x31f8c3){var _0x409af3=_0x31f8c3[_0xd9a8('0x4e')];var _0x27524d=util[_0xd9a8('0x50')]('%s.cypher',_0x409af3);if(fs[_0xd9a8('0x51')](_0x27524d)){_0x1dabc9=!![];return _0x3b6d73['decryptFile'](_0x27524d,_0x409af3,config[_0xd9a8('0x52')][_0xd9a8('0x53')])[_0xd9a8('0x26')](function(){return _0x31f8c3;});}return _0x31f8c3;}})[_0xd9a8('0x26')](function(_0x3b8162){if(_0x3b8162){var _0x3bd603=_0x3b8162[_0xd9a8('0x4e')];if(!fs[_0xd9a8('0x51')](_0x3bd603)){throw new db[(_0xd9a8('0x54'))]['ValidationError'](_0xd9a8('0x55'));}if(_0x3b8162[_0xd9a8('0x4f')]){return _0x9fdb9e[_0xd9a8('0x4b')](_0x3bd603,_0x3b8162[_0xd9a8('0x4f')]+path['extname'](_0x3bd603),function(){if(_0x1dabc9){fs[_0xd9a8('0x56')](_0x3bd603);}});}else{return _0x9fdb9e[_0xd9a8('0x4b')](_0x3bd603,function(_0xa7c456){if(_0x1dabc9){fs[_0xd9a8('0x56')](_0x3bd603);}});}}})[_0xd9a8('0x48')](function(_0x2b9ea3){if(_0x2b9ea3[_0xd9a8('0x57')]===_0xd9a8('0x55')){_0x9fdb9e[_0xd9a8('0x1c')](0x194)['send']('Not\x20found');}else{return handleError(_0x9fdb9e,null);}});};exports[_0xd9a8('0x27')]=function(_0x2b9324,_0xeb2c16){return db[_0xd9a8('0x2e')][_0xd9a8('0x47')]({'where':{'id':_0x2b9324[_0xd9a8('0x45')]['id']}})[_0xd9a8('0x26')](function(_0x4112f6){if(_[_0xd9a8('0x58')](_0x4112f6)){throw new ReferenceError(_0xd9a8('0x59'));}return _0x4112f6;})[_0xd9a8('0x26')](function(_0x4accb7){var _0x323b98=_0x4accb7['savePath'];logger[_0xd9a8('0x5a')]('cancellazione\x20fisica\x20documento\x20%s',_0x323b98);if(!_[_0xd9a8('0x58')](_0x4accb7['savePath'])&&fs[_0xd9a8('0x51')](_0x323b98)){logger[_0xd9a8('0x5a')](_0xd9a8('0x5b')+_0x323b98+_0xd9a8('0x5c'));fs[_0xd9a8('0x5d')](_0x323b98);}_0x323b98=_0x323b98+_0xd9a8('0x5e');if(!_[_0xd9a8('0x58')](_0x4accb7['savePath'])&&fs[_0xd9a8('0x51')](_0x323b98)){logger['info']('File:\x20\x22'+_0x323b98+_0xd9a8('0x5c'));fs[_0xd9a8('0x5d')](_0x323b98);}return _0x4accb7;})['then'](function(_0x525915){if(!_0x525915)throw new InternalError();return _0x525915[_0xd9a8('0x27')]();})[_0xd9a8('0x26')](function(){_0xeb2c16['status'](0xcc)['end']();})['catch'](handleError(_0xeb2c16,null));}; \ No newline at end of file diff --git a/server/api/squareRecording/squareRecording.model.js b/server/api/squareRecording/squareRecording.model.js index c838958..5853fde 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 _0x8277=['moment','bluebird','path','rimraf','./squareRecording.attributes','exports','define','SquareRecording','square_recordings','util','../../config/logger'];(function(_0x3ef98e,_0x569661){var _0xa75d4=function(_0x3286bd){while(--_0x3286bd){_0x3ef98e['push'](_0x3ef98e['shift']());}};_0xa75d4(++_0x569661);}(_0x8277,0xcf));var _0x7827=function(_0x5c78d9,_0x2736c7){_0x5c78d9=_0x5c78d9-0x0;var _0x69ae1f=_0x8277[_0x5c78d9];return _0x69ae1f;};'use strict';var _=require('lodash');var util=require(_0x7827('0x0'));var logger=require(_0x7827('0x1'))('api');var moment=require(_0x7827('0x2'));var BPromise=require(_0x7827('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x7827('0x4'));var rimraf=require(_0x7827('0x5'));var config=require('../../config/environment');var attributes=require(_0x7827('0x6'));module[_0x7827('0x7')]=function(_0x3ebcdf,_0x47e18c){return _0x3ebcdf[_0x7827('0x8')](_0x7827('0x9'),attributes,{'tableName':_0x7827('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa701=['SquareRecording','square_recordings','util','../../config/logger','bluebird','rimraf','../../config/environment','./squareRecording.attributes','exports','define'];(function(_0x280ae7,_0x456fb1){var _0x418b9e=function(_0x4d730d){while(--_0x4d730d){_0x280ae7['push'](_0x280ae7['shift']());}};_0x418b9e(++_0x456fb1);}(_0xa701,0xd4));var _0x1a70=function(_0x1fb984,_0x4355e5){_0x1fb984=_0x1fb984-0x0;var _0x4f66ee=_0xa701[_0x1fb984];return _0x4f66ee;};'use strict';var _=require('lodash');var util=require(_0x1a70('0x0'));var logger=require(_0x1a70('0x1'))('api');var moment=require('moment');var BPromise=require(_0x1a70('0x2'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x1a70('0x3'));var config=require(_0x1a70('0x4'));var attributes=require(_0x1a70('0x5'));module[_0x1a70('0x6')]=function(_0x48532f,_0x5ec401){return _0x48532f[_0x1a70('0x7')](_0x1a70('0x8'),attributes,{'tableName':_0x1a70('0x9'),'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 20495fe..e338454 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 _0x8bc9=['create','body','CreateSquareRecording','catch','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','SquareRecording'];(function(_0x13182e,_0x45e0f4){var _0x464946=function(_0x1a2816){while(--_0x1a2816){_0x13182e['push'](_0x13182e['shift']());}};_0x464946(++_0x45e0f4);}(_0x8bc9,0xb4));var _0x98bc=function(_0x47613a,_0x346e1c){_0x47613a=_0x47613a-0x0;var _0x334126=_0x8bc9[_0x47613a];return _0x334126;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0x98bc('0x0'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x98bc('0x1'))['db'];var utils=require(_0x98bc('0x2'));var logger=require(_0x98bc('0x3'))(_0x98bc('0x4'));var config=require(_0x98bc('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x98bc('0x6')][_0x98bc('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x5aa349,_0x2200ef,_0x1dd39a){return new BPromise(function(_0x1f249b,_0x3e35c4){return client['request'](_0x5aa349,_0x1dd39a)['then'](function(_0x19b9b0){logger[_0x98bc('0x8')](_0x98bc('0x9'),_0x2200ef,_0x98bc('0xa'));logger[_0x98bc('0xb')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x2200ef,_0x98bc('0xa'),JSON[_0x98bc('0xc')](_0x19b9b0));if(_0x19b9b0[_0x98bc('0xd')]){if(_0x19b9b0[_0x98bc('0xd')][_0x98bc('0xe')]===0x1f4){logger['error'](_0x98bc('0x9'),_0x2200ef,_0x19b9b0[_0x98bc('0xd')][_0x98bc('0xf')]);return _0x3e35c4(_0x19b9b0[_0x98bc('0xd')][_0x98bc('0xf')]);}logger[_0x98bc('0xd')](_0x98bc('0x9'),_0x2200ef,_0x19b9b0[_0x98bc('0xd')][_0x98bc('0xf')]);return _0x1f249b(_0x19b9b0[_0x98bc('0xd')][_0x98bc('0xf')]);}else{logger[_0x98bc('0x8')](_0x98bc('0x9'),_0x2200ef,_0x98bc('0xa'));_0x1f249b(_0x19b9b0[_0x98bc('0x10')][_0x98bc('0xf')]);}})['catch'](function(_0xcf936b){logger[_0x98bc('0xd')]('SquareRecording,\x20%s,\x20%s',_0x2200ef,_0xcf936b);_0x3e35c4(_0xcf936b);});});}exports['CreateSquareRecording']=function(_0x511052){var _0x278880=this;return new Promise(function(_0x4f830a,_0x125bab){return db[_0x98bc('0x11')][_0x98bc('0x12')](_0x511052[_0x98bc('0x13')],{'raw':_0x511052['options']?_0x511052['options']['raw']===undefined?!![]:![]:!![]})['then'](function(_0x5e29b2){logger[_0x98bc('0x8')](_0x98bc('0x14'),_0x511052);logger['debug'](_0x98bc('0x14'),_0x511052,JSON[_0x98bc('0xc')](_0x5e29b2));_0x4f830a(_0x5e29b2);})[_0x98bc('0x15')](function(_0x2e35eb){logger[_0x98bc('0xd')](_0x98bc('0x14'),_0x2e35eb[_0x98bc('0xf')],_0x511052);_0x125bab(_0x278880[_0x98bc('0xd')](0x1f4,_0x2e35eb[_0x98bc('0xf')]));});});}; \ No newline at end of file +var _0x2507=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','request\x20sent','catch','SquareRecording','create','body','options','raw','CreateSquareRecording','lodash','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x539386,_0x4cbc27){var _0x3d370c=function(_0xacae0c){while(--_0xacae0c){_0x539386['push'](_0x539386['shift']());}};_0x3d370c(++_0x4cbc27);}(_0x2507,0x1da));var _0x7250=function(_0x46d054,_0x5c695c){_0x46d054=_0x46d054-0x0;var _0x1ddffe=_0x2507[_0x46d054];return _0x1ddffe;};'use strict';var _=require(_0x7250('0x0'));var util=require(_0x7250('0x1'));var moment=require('moment');var BPromise=require(_0x7250('0x2'));var rs=require(_0x7250('0x3'));var fs=require('fs');var Redis=require(_0x7250('0x4'));var db=require(_0x7250('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x7250('0x6'))(_0x7250('0x7'));var config=require(_0x7250('0x8'));var jayson=require(_0x7250('0x9'));var client=jayson[_0x7250('0xa')][_0x7250('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x566ba9,_0x4500b8,_0x458f2a){return new BPromise(function(_0x8e1406,_0x9ac485){return client[_0x7250('0xc')](_0x566ba9,_0x458f2a)[_0x7250('0xd')](function(_0x67e476){logger['info'](_0x7250('0xe'),_0x4500b8,'request\x20sent');logger[_0x7250('0xf')](_0x7250('0x10'),_0x4500b8,'request\x20sent',JSON[_0x7250('0x11')](_0x67e476));if(_0x67e476['error']){if(_0x67e476[_0x7250('0x12')][_0x7250('0x13')]===0x1f4){logger['error']('SquareRecording,\x20%s,\x20%s',_0x4500b8,_0x67e476[_0x7250('0x12')][_0x7250('0x14')]);return _0x9ac485(_0x67e476[_0x7250('0x12')][_0x7250('0x14')]);}logger[_0x7250('0x12')]('SquareRecording,\x20%s,\x20%s',_0x4500b8,_0x67e476['error'][_0x7250('0x14')]);return _0x8e1406(_0x67e476[_0x7250('0x12')][_0x7250('0x14')]);}else{logger[_0x7250('0x15')](_0x7250('0xe'),_0x4500b8,_0x7250('0x16'));_0x8e1406(_0x67e476['result'][_0x7250('0x14')]);}})[_0x7250('0x17')](function(_0x47b7f7){logger[_0x7250('0x12')]('SquareRecording,\x20%s,\x20%s',_0x4500b8,_0x47b7f7);_0x9ac485(_0x47b7f7);});});}exports['CreateSquareRecording']=function(_0x5353df){var _0x5b6d2e=this;return new Promise(function(_0x6a36f,_0x49b3ed){return db[_0x7250('0x18')][_0x7250('0x19')](_0x5353df[_0x7250('0x1a')],{'raw':_0x5353df[_0x7250('0x1b')]?_0x5353df['options'][_0x7250('0x1c')]===undefined?!![]:![]:!![]})[_0x7250('0xd')](function(_0x4765dd){logger[_0x7250('0x15')](_0x7250('0x1d'),_0x5353df);logger[_0x7250('0xf')](_0x7250('0x1d'),_0x5353df,JSON[_0x7250('0x11')](_0x4765dd));_0x6a36f(_0x4765dd);})['catch'](function(_0x37ba10){logger['error'](_0x7250('0x1d'),_0x37ba10[_0x7250('0x14')],_0x5353df);_0x49b3ed(_0x5b6d2e['error'](0x1f4,_0x37ba10[_0x7250('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/squareReport/index.js b/server/api/squareReport/index.js index 2884e80..45ddfd3 100644 --- a/server/api/squareReport/index.js +++ b/server/api/squareReport/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['/describe','describe','/:id','show','post','create','put','destroy','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','isAuthenticated','index'];(function(_0x11e5c3,_0x5ec825){var _0x3ec292=function(_0x476eb0){while(--_0x476eb0){_0x11e5c3['push'](_0x11e5c3['shift']());}};_0x3ec292(++_0x5ec825);}(_0xe706,0xa3));var _0x6e70=function(_0x492221,_0x9e2521){_0x492221=_0x492221-0x0;var _0x398bf9=_0xe706[_0x492221];return _0x398bf9;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));var controller=require(_0x6e70('0x9'));router[_0x6e70('0xa')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0xc')]);router[_0x6e70('0xa')](_0x6e70('0xd'),auth[_0x6e70('0xb')](),controller[_0x6e70('0xe')]);router[_0x6e70('0xa')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x10')]);router[_0x6e70('0x11')]('/',auth[_0x6e70('0xb')](),controller[_0x6e70('0x12')]);router[_0x6e70('0x13')](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller['update']);router['delete'](_0x6e70('0xf'),auth[_0x6e70('0xb')](),controller[_0x6e70('0x14')]);module[_0x6e70('0x15')]=router; \ No newline at end of file +var _0xa9e0=['isAuthenticated','create','put','/:id','destroy','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./squareReport.controller','get','index','/describe','show','post'];(function(_0x2db12b,_0x30ab1d){var _0x20990b=function(_0x589477){while(--_0x589477){_0x2db12b['push'](_0x2db12b['shift']());}};_0x20990b(++_0x30ab1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4154a6,_0x2c0b8e){_0x4154a6=_0x4154a6-0x0;var _0x3b2786=_0xa9e0[_0x4154a6];return _0x3b2786;};'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/squareReport/squareReport.attributes.js b/server/api/squareReport/squareReport.attributes.js index 39e168d..2b3d5b0 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 _0x997a=['DATE','BOOLEAN','exports','STRING'];(function(_0x12e3e3,_0x501eaf){var _0x26602e=function(_0x427882){while(--_0x427882){_0x12e3e3['push'](_0x12e3e3['shift']());}};_0x26602e(++_0x501eaf);}(_0x997a,0xce));var _0xa997=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x997a[_0x432682];return _0x463d05;};'use strict';var Sequelize=require('sequelize');module[_0xa997('0x0')]={'network':{'type':Sequelize[_0xa997('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize[_0xa997('0x1')]},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0xa997('0x1')]},'type':{'type':Sequelize[_0xa997('0x1')]},'uniqueid':{'type':Sequelize[_0xa997('0x1')]},'version':{'type':Sequelize[_0xa997('0x1')]},'callerid':{'type':Sequelize[_0xa997('0x1')]},'calleridname':{'type':Sequelize[_0xa997('0x1')]},'callingpres':{'type':Sequelize[_0xa997('0x1')]},'callingani2':{'type':Sequelize[_0xa997('0x1')]},'callington':{'type':Sequelize[_0xa997('0x1')]},'callingtns':{'type':Sequelize['STRING']},'dnid':{'type':Sequelize['STRING']},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xa997('0x1')]},'priority':{'type':Sequelize[_0xa997('0x1')]},'enhanced':{'type':Sequelize[_0xa997('0x1')]},'accountcode':{'type':Sequelize[_0xa997('0x1')]},'threadid':{'type':Sequelize[_0xa997('0x1')]},'project_name':{'type':Sequelize['STRING']},'joinAt':{'type':Sequelize[_0xa997('0x2')]},'leaveAt':{'type':Sequelize[_0xa997('0x2')]},'bot':{'type':Sequelize[_0xa997('0x3')],'defaultValue':![]}}; \ No newline at end of file +var _0x7024=['BOOLEAN','exports','STRING','DATE'];(function(_0x21642b,_0x2c93e8){var _0x34ac67=function(_0xe2ac39){while(--_0xe2ac39){_0x21642b['push'](_0x21642b['shift']());}};_0x34ac67(++_0x2c93e8);}(_0x7024,0xa1));var _0x4702=function(_0x1bef20,_0x131cf3){_0x1bef20=_0x1bef20-0x0;var _0x4fa28d=_0x7024[_0x1bef20];return _0x4fa28d;};'use strict';var Sequelize=require('sequelize');module[_0x4702('0x0')]={'network':{'type':Sequelize[_0x4702('0x1')]},'network_script':{'type':Sequelize['STRING']},'request':{'type':Sequelize['STRING']},'channel':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x4702('0x1')]},'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x4702('0x1')]},'version':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0x4702('0x1')]},'calleridname':{'type':Sequelize[_0x4702('0x1')]},'callingpres':{'type':Sequelize[_0x4702('0x1')]},'callingani2':{'type':Sequelize[_0x4702('0x1')]},'callington':{'type':Sequelize[_0x4702('0x1')]},'callingtns':{'type':Sequelize[_0x4702('0x1')]},'dnid':{'type':Sequelize[_0x4702('0x1')]},'rdnis':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x4702('0x1')]},'extension':{'type':Sequelize[_0x4702('0x1')]},'priority':{'type':Sequelize['STRING']},'enhanced':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x4702('0x1')]},'threadid':{'type':Sequelize[_0x4702('0x1')]},'project_name':{'type':Sequelize[_0x4702('0x1')]},'joinAt':{'type':Sequelize[_0x4702('0x2')]},'leaveAt':{'type':Sequelize[_0x4702('0x2')]},'bot':{'type':Sequelize[_0x4702('0x3')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.controller.js b/server/api/squareReport/squareReport.controller.js index 6fafd29..c8f01f3 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 _0xd3d4=['destroy','sendStatus','error','stack','name','index','SquareReport','rawAttributes','fieldName','type','model','map','query','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','keys','create','update','body','find','describe','eml-format','zip-dir','request-promise','moment','bluebird','mustache','util','sox','to-csv','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','end','status','json','undefined','limit','count','offset','set','Content-Range','reject','save','then'];(function(_0x3c8e57,_0x1ee1a1){var _0x583b29=function(_0x13e29e){while(--_0x13e29e){_0x3c8e57['push'](_0x3c8e57['shift']());}};_0x583b29(++_0x1ee1a1);}(_0xd3d4,0x1e3));var _0x4d3d=function(_0x14f54a,_0x42536b){_0x14f54a=_0x14f54a-0x0;var _0x122b3a=_0xd3d4[_0x14f54a];return _0x122b3a;};'use strict';var emlformat=require(_0x4d3d('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x4d3d('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x4d3d('0x2'));var moment=require(_0x4d3d('0x3'));var BPromise=require(_0x4d3d('0x4'));var Mustache=require(_0x4d3d('0x5'));var util=require(_0x4d3d('0x6'));var path=require('path');var sox=require(_0x4d3d('0x7'));var csv=require(_0x4d3d('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x4d3d('0x9'));var squel=require(_0x4d3d('0xa'));var crypto=require(_0x4d3d('0xb'));var jsforce=require(_0x4d3d('0xc'));var deskjs=require('desk.js');var toCsv=require(_0x4d3d('0x8'));var querystring=require(_0x4d3d('0xd'));var Papa=require(_0x4d3d('0xe'));var Redis=require(_0x4d3d('0xf'));var authService=require(_0x4d3d('0x10'));var qs=require(_0x4d3d('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x4d3d('0x12'));var logger=require('../../config/logger')('api');var utils=require(_0x4d3d('0x13'));var config=require(_0x4d3d('0x14'));var licenseUtil=require(_0x4d3d('0x15'));var db=require(_0x4d3d('0x16'))['db'];function respondWithStatusCode(_0x1ae956,_0x3b49c6){_0x3b49c6=_0x3b49c6||0xcc;return function(_0x47d928){if(_0x47d928){return _0x1ae956['sendStatus'](_0x3b49c6);}return _0x1ae956['status'](_0x3b49c6)[_0x4d3d('0x17')]();};}function respondWithResult(_0x5a245e,_0x1fdeec){_0x1fdeec=_0x1fdeec||0xc8;return function(_0x455ca7){if(_0x455ca7){return _0x5a245e[_0x4d3d('0x18')](_0x1fdeec)[_0x4d3d('0x19')](_0x455ca7);}};}function respondWithFilteredResult(_0x83d9ed,_0x764d47){return function(_0x4c3354){if(_0x4c3354){var _0x1ddeb9=typeof _0x764d47['offset']===_0x4d3d('0x1a')&&typeof _0x764d47[_0x4d3d('0x1b')]===_0x4d3d('0x1a');var _0x42c714=_0x4c3354[_0x4d3d('0x1c')];var _0x32175d=_0x1ddeb9?0x0:_0x764d47[_0x4d3d('0x1d')];var _0x16f77f=_0x1ddeb9?_0x4c3354[_0x4d3d('0x1c')]:_0x764d47[_0x4d3d('0x1d')]+_0x764d47[_0x4d3d('0x1b')];var _0x5b7fe6;if(_0x16f77f>=_0x42c714){_0x16f77f=_0x42c714;_0x5b7fe6=0xc8;}else{_0x5b7fe6=0xce;}_0x83d9ed[_0x4d3d('0x18')](_0x5b7fe6);return _0x83d9ed[_0x4d3d('0x1e')](_0x4d3d('0x1f'),_0x32175d+'-'+_0x16f77f+'/'+_0x42c714)['json'](_0x4c3354);}return null;};}function patchUpdates(_0x1e5ba4){return function(_0x6f29e3){try{jsonpatch['apply'](_0x6f29e3,_0x1e5ba4,!![]);}catch(_0x3e1962){return BPromise[_0x4d3d('0x20')](_0x3e1962);}return _0x6f29e3[_0x4d3d('0x21')]();};}function saveUpdates(_0x16382c,_0x2d1415){return function(_0x506617){if(_0x506617){return _0x506617['update'](_0x16382c)[_0x4d3d('0x22')](function(_0x1ca7b1){return _0x1ca7b1;});}return null;};}function removeEntity(_0x2e8807,_0x8052a8){return function(_0x3f4be0){if(_0x3f4be0){return _0x3f4be0[_0x4d3d('0x23')]()['then'](function(){_0x2e8807[_0x4d3d('0x18')](0xcc)[_0x4d3d('0x17')]();});}};}function handleEntityNotFound(_0x21f016,_0x8490d3){return function(_0x2cad8c){if(!_0x2cad8c){_0x21f016[_0x4d3d('0x24')](0x194);}return _0x2cad8c;};}function handleError(_0x3b1ca8,_0x4f4b06){_0x4f4b06=_0x4f4b06||0x1f4;return function(_0xaf51b2){logger[_0x4d3d('0x25')](_0xaf51b2[_0x4d3d('0x26')]);if(_0xaf51b2[_0x4d3d('0x27')]){delete _0xaf51b2['name'];}_0x3b1ca8['status'](_0x4f4b06)['send'](_0xaf51b2);};}exports[_0x4d3d('0x28')]=function(_0x2d9062,_0x204f84){var _0x228795={},_0x552bb4={},_0x2df56c={'count':0x0,'rows':[]};var _0x53aca8=_['map'](db[_0x4d3d('0x29')][_0x4d3d('0x2a')],function(_0x38b40a){return{'name':_0x38b40a[_0x4d3d('0x2b')],'type':_0x38b40a[_0x4d3d('0x2c')]['key']};});_0x552bb4[_0x4d3d('0x2d')]=_[_0x4d3d('0x2e')](_0x53aca8,'name');_0x552bb4[_0x4d3d('0x2f')]=_['keys'](_0x2d9062[_0x4d3d('0x2f')]);_0x552bb4['filters']=_[_0x4d3d('0x30')](_0x552bb4[_0x4d3d('0x2d')],_0x552bb4[_0x4d3d('0x2f')]);_0x228795['attributes']=_['intersection'](_0x552bb4[_0x4d3d('0x2d')],qs[_0x4d3d('0x31')](_0x2d9062['query'][_0x4d3d('0x31')]));_0x228795[_0x4d3d('0x32')]=_0x228795['attributes'][_0x4d3d('0x33')]?_0x228795['attributes']:_0x552bb4[_0x4d3d('0x2d')];if(!_0x2d9062[_0x4d3d('0x2f')][_0x4d3d('0x34')](_0x4d3d('0x35'))){_0x228795[_0x4d3d('0x1b')]=qs[_0x4d3d('0x1b')](_0x2d9062[_0x4d3d('0x2f')]['limit']);_0x228795[_0x4d3d('0x1d')]=qs['offset'](_0x2d9062[_0x4d3d('0x2f')][_0x4d3d('0x1d')]);}_0x228795[_0x4d3d('0x36')]=qs[_0x4d3d('0x37')](_0x2d9062[_0x4d3d('0x2f')][_0x4d3d('0x37')]);_0x228795[_0x4d3d('0x38')]=qs[_0x4d3d('0x39')](_[_0x4d3d('0x3a')](_0x2d9062[_0x4d3d('0x2f')],_0x552bb4['filters']),_0x53aca8);if(_0x2d9062['query'][_0x4d3d('0x3b')]){_0x228795[_0x4d3d('0x38')]=_[_0x4d3d('0x3c')](_0x228795[_0x4d3d('0x38')],{'$or':_[_0x4d3d('0x2e')](_0x53aca8,function(_0x1a1059){if(_0x1a1059[_0x4d3d('0x2c')]!=='VIRTUAL'){var _0x419bb9={};_0x419bb9[_0x1a1059[_0x4d3d('0x27')]]={'$like':'%'+_0x2d9062['query']['filter']+'%'};return _0x419bb9;}})});}_0x228795=_[_0x4d3d('0x3c')]({},_0x228795,_0x2d9062[_0x4d3d('0x3d')]);var _0x1e7c76={'where':_0x228795[_0x4d3d('0x38')]};return db[_0x4d3d('0x29')][_0x4d3d('0x1c')](_0x1e7c76)[_0x4d3d('0x22')](function(_0x3c22dc){_0x2df56c[_0x4d3d('0x1c')]=_0x3c22dc;if(_0x2d9062['query'][_0x4d3d('0x3e')]){_0x228795[_0x4d3d('0x3f')]=[{'all':!![]}];}return db[_0x4d3d('0x29')][_0x4d3d('0x40')](_0x228795);})[_0x4d3d('0x22')](function(_0xe5bbd5){_0x2df56c['rows']=_0xe5bbd5;return _0x2df56c;})[_0x4d3d('0x22')](respondWithFilteredResult(_0x204f84,_0x228795))[_0x4d3d('0x41')](handleError(_0x204f84,null));};exports[_0x4d3d('0x42')]=function(_0x38ef5f,_0x54e27f){var _0x385e0a={'raw':!![],'where':{'id':_0x38ef5f[_0x4d3d('0x43')]['id']}},_0x47cf82={};_0x47cf82['model']=_[_0x4d3d('0x44')](db[_0x4d3d('0x29')][_0x4d3d('0x2a')]);_0x47cf82[_0x4d3d('0x2f')]=_[_0x4d3d('0x44')](_0x38ef5f[_0x4d3d('0x2f')]);_0x47cf82[_0x4d3d('0x39')]=_[_0x4d3d('0x30')](_0x47cf82['model'],_0x47cf82[_0x4d3d('0x2f')]);_0x385e0a[_0x4d3d('0x32')]=_[_0x4d3d('0x30')](_0x47cf82[_0x4d3d('0x2d')],qs['fields'](_0x38ef5f['query'][_0x4d3d('0x31')]));_0x385e0a[_0x4d3d('0x32')]=_0x385e0a['attributes'][_0x4d3d('0x33')]?_0x385e0a['attributes']:_0x47cf82[_0x4d3d('0x2d')];if(_0x38ef5f[_0x4d3d('0x2f')]['includeAll']){_0x385e0a[_0x4d3d('0x3f')]=[{'all':!![]}];}_0x385e0a=_[_0x4d3d('0x3c')]({},_0x385e0a,_0x38ef5f['options']);return db[_0x4d3d('0x29')]['find'](_0x385e0a)[_0x4d3d('0x22')](handleEntityNotFound(_0x54e27f,null))[_0x4d3d('0x22')](respondWithResult(_0x54e27f,null))[_0x4d3d('0x41')](handleError(_0x54e27f,null));};exports[_0x4d3d('0x45')]=function(_0x58293f,_0x1b1398){return db['SquareReport'][_0x4d3d('0x45')](_0x58293f['body'],{})['then'](respondWithResult(_0x1b1398,0xc9))[_0x4d3d('0x41')](handleError(_0x1b1398,null));};exports[_0x4d3d('0x46')]=function(_0x2c49bf,_0x52c9bb){if(_0x2c49bf['body']['id']){delete _0x2c49bf[_0x4d3d('0x47')]['id'];}return db['SquareReport'][_0x4d3d('0x48')]({'where':{'id':_0x2c49bf[_0x4d3d('0x43')]['id']}})[_0x4d3d('0x22')](handleEntityNotFound(_0x52c9bb,null))[_0x4d3d('0x22')](saveUpdates(_0x2c49bf[_0x4d3d('0x47')],null))[_0x4d3d('0x22')](respondWithResult(_0x52c9bb,null))['catch'](handleError(_0x52c9bb,null));};exports[_0x4d3d('0x23')]=function(_0x13a4f8,_0xf48c96){return db[_0x4d3d('0x29')][_0x4d3d('0x48')]({'where':{'id':_0x13a4f8[_0x4d3d('0x43')]['id']}})[_0x4d3d('0x22')](handleEntityNotFound(_0xf48c96,null))['then'](removeEntity(_0xf48c96,null))[_0x4d3d('0x41')](handleError(_0xf48c96,null));};exports[_0x4d3d('0x49')]=function(_0x24253d,_0x4a22dc){return db[_0x4d3d('0x29')][_0x4d3d('0x49')]()[_0x4d3d('0x22')](respondWithResult(_0x4a22dc,null))[_0x4d3d('0x41')](handleError(_0x4a22dc,null));}; \ No newline at end of file +var _0xb03a=['querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','then','error','stack','name','send','index','map','SquareReport','type','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','options','findAll','rows','catch','params','rawAttributes','includeAll','include','create','body','find','destroy','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce'];(function(_0x3649eb,_0x4fdeac){var _0x489f19=function(_0x31ad7b){while(--_0x31ad7b){_0x3649eb['push'](_0x3649eb['shift']());}};_0x489f19(++_0x4fdeac);}(_0xb03a,0x171));var _0xab03=function(_0xc11dff,_0x1b278b){_0xc11dff=_0xc11dff-0x0;var _0x38f4b5=_0xb03a[_0xc11dff];return _0x38f4b5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xab03('0x0'));var zipdir=require(_0xab03('0x1'));var jsonpatch=require(_0xab03('0x2'));var rp=require(_0xab03('0x3'));var moment=require(_0xab03('0x4'));var BPromise=require(_0xab03('0x5'));var Mustache=require(_0xab03('0x6'));var util=require(_0xab03('0x7'));var path=require(_0xab03('0x8'));var sox=require(_0xab03('0x9'));var csv=require(_0xab03('0xa'));var ejs=require(_0xab03('0xb'));var fs=require('fs');var fs_extra=require(_0xab03('0xc'));var _=require(_0xab03('0xd'));var squel=require(_0xab03('0xe'));var crypto=require('crypto');var jsforce=require(_0xab03('0xf'));var deskjs=require('desk.js');var toCsv=require(_0xab03('0xa'));var querystring=require(_0xab03('0x10'));var Papa=require(_0xab03('0x11'));var Redis=require('ioredis');var authService=require(_0xab03('0x12'));var qs=require(_0xab03('0x13'));var as=require(_0xab03('0x14'));var hardwareService=require(_0xab03('0x15'));var logger=require('../../config/logger')(_0xab03('0x16'));var utils=require(_0xab03('0x17'));var config=require(_0xab03('0x18'));var licenseUtil=require(_0xab03('0x19'));var db=require(_0xab03('0x1a'))['db'];function respondWithStatusCode(_0x1492c6,_0x38500c){_0x38500c=_0x38500c||0xcc;return function(_0x30298b){if(_0x30298b){return _0x1492c6[_0xab03('0x1b')](_0x38500c);}return _0x1492c6[_0xab03('0x1c')](_0x38500c)[_0xab03('0x1d')]();};}function respondWithResult(_0x3cd95d,_0x4615f8){_0x4615f8=_0x4615f8||0xc8;return function(_0x4b96af){if(_0x4b96af){return _0x3cd95d[_0xab03('0x1c')](_0x4615f8)[_0xab03('0x1e')](_0x4b96af);}};}function respondWithFilteredResult(_0x145733,_0x407e6b){return function(_0x407b50){if(_0x407b50){var _0x120b3d=typeof _0x407e6b[_0xab03('0x1f')]===_0xab03('0x20')&&typeof _0x407e6b['limit']===_0xab03('0x20');var _0x1069a7=_0x407b50[_0xab03('0x21')];var _0x26a935=_0x120b3d?0x0:_0x407e6b['offset'];var _0x5678a9=_0x120b3d?_0x407b50[_0xab03('0x21')]:_0x407e6b['offset']+_0x407e6b[_0xab03('0x22')];var _0x2ce6f0;if(_0x5678a9>=_0x1069a7){_0x5678a9=_0x1069a7;_0x2ce6f0=0xc8;}else{_0x2ce6f0=0xce;}_0x145733['status'](_0x2ce6f0);return _0x145733['set'](_0xab03('0x23'),_0x26a935+'-'+_0x5678a9+'/'+_0x1069a7)[_0xab03('0x1e')](_0x407b50);}return null;};}function patchUpdates(_0x545083){return function(_0x55c236){try{jsonpatch[_0xab03('0x24')](_0x55c236,_0x545083,!![]);}catch(_0x11558d){return BPromise[_0xab03('0x25')](_0x11558d);}return _0x55c236['save']();};}function saveUpdates(_0x333a8f,_0x13050c){return function(_0x2896e0){if(_0x2896e0){return _0x2896e0[_0xab03('0x26')](_0x333a8f)[_0xab03('0x27')](function(_0x2d2d62){return _0x2d2d62;});}return null;};}function removeEntity(_0x903a05,_0x2c5c41){return function(_0x286089){if(_0x286089){return _0x286089['destroy']()[_0xab03('0x27')](function(){_0x903a05[_0xab03('0x1c')](0xcc)[_0xab03('0x1d')]();});}};}function handleEntityNotFound(_0x4da456,_0x208bcb){return function(_0x5dc68c){if(!_0x5dc68c){_0x4da456[_0xab03('0x1b')](0x194);}return _0x5dc68c;};}function handleError(_0x5de8b4,_0xeba040){_0xeba040=_0xeba040||0x1f4;return function(_0xbad2f1){logger[_0xab03('0x28')](_0xbad2f1[_0xab03('0x29')]);if(_0xbad2f1[_0xab03('0x2a')]){delete _0xbad2f1[_0xab03('0x2a')];}_0x5de8b4['status'](_0xeba040)[_0xab03('0x2b')](_0xbad2f1);};}exports[_0xab03('0x2c')]=function(_0xcf85a9,_0x5e013f){var _0x4a2149={},_0x2bada2={},_0x41551d={'count':0x0,'rows':[]};var _0x270df3=_[_0xab03('0x2d')](db[_0xab03('0x2e')]['rawAttributes'],function(_0x5d988e){return{'name':_0x5d988e['fieldName'],'type':_0x5d988e[_0xab03('0x2f')]['key']};});_0x2bada2[_0xab03('0x30')]=_[_0xab03('0x2d')](_0x270df3,_0xab03('0x2a'));_0x2bada2[_0xab03('0x31')]=_[_0xab03('0x32')](_0xcf85a9[_0xab03('0x31')]);_0x2bada2[_0xab03('0x33')]=_[_0xab03('0x34')](_0x2bada2[_0xab03('0x30')],_0x2bada2['query']);_0x4a2149[_0xab03('0x35')]=_['intersection'](_0x2bada2[_0xab03('0x30')],qs[_0xab03('0x36')](_0xcf85a9[_0xab03('0x31')]['fields']));_0x4a2149['attributes']=_0x4a2149['attributes'][_0xab03('0x37')]?_0x4a2149[_0xab03('0x35')]:_0x2bada2[_0xab03('0x30')];if(!_0xcf85a9[_0xab03('0x31')][_0xab03('0x38')](_0xab03('0x39'))){_0x4a2149[_0xab03('0x22')]=qs['limit'](_0xcf85a9[_0xab03('0x31')]['limit']);_0x4a2149[_0xab03('0x1f')]=qs[_0xab03('0x1f')](_0xcf85a9['query'][_0xab03('0x1f')]);}_0x4a2149[_0xab03('0x3a')]=qs['sort'](_0xcf85a9[_0xab03('0x31')][_0xab03('0x3b')]);_0x4a2149['where']=qs[_0xab03('0x33')](_[_0xab03('0x3c')](_0xcf85a9[_0xab03('0x31')],_0x2bada2[_0xab03('0x33')]),_0x270df3);if(_0xcf85a9[_0xab03('0x31')][_0xab03('0x3d')]){_0x4a2149[_0xab03('0x3e')]=_[_0xab03('0x3f')](_0x4a2149[_0xab03('0x3e')],{'$or':_[_0xab03('0x2d')](_0x270df3,function(_0xca4388){if(_0xca4388[_0xab03('0x2f')]!==_0xab03('0x40')){var _0x14c60e={};_0x14c60e[_0xca4388[_0xab03('0x2a')]]={'$like':'%'+_0xcf85a9['query']['filter']+'%'};return _0x14c60e;}})});}_0x4a2149=_[_0xab03('0x3f')]({},_0x4a2149,_0xcf85a9[_0xab03('0x41')]);var _0x1c8e27={'where':_0x4a2149[_0xab03('0x3e')]};return db[_0xab03('0x2e')]['count'](_0x1c8e27)[_0xab03('0x27')](function(_0x5134bf){_0x41551d['count']=_0x5134bf;if(_0xcf85a9['query']['includeAll']){_0x4a2149['include']=[{'all':!![]}];}return db[_0xab03('0x2e')][_0xab03('0x42')](_0x4a2149);})[_0xab03('0x27')](function(_0x24c80b){_0x41551d[_0xab03('0x43')]=_0x24c80b;return _0x41551d;})[_0xab03('0x27')](respondWithFilteredResult(_0x5e013f,_0x4a2149))[_0xab03('0x44')](handleError(_0x5e013f,null));};exports['show']=function(_0x45e3da,_0xf7e4f6){var _0x37dd81={'raw':!![],'where':{'id':_0x45e3da[_0xab03('0x45')]['id']}},_0x27cae4={};_0x27cae4[_0xab03('0x30')]=_[_0xab03('0x32')](db[_0xab03('0x2e')][_0xab03('0x46')]);_0x27cae4['query']=_['keys'](_0x45e3da[_0xab03('0x31')]);_0x27cae4['filters']=_[_0xab03('0x34')](_0x27cae4['model'],_0x27cae4['query']);_0x37dd81[_0xab03('0x35')]=_[_0xab03('0x34')](_0x27cae4[_0xab03('0x30')],qs[_0xab03('0x36')](_0x45e3da[_0xab03('0x31')][_0xab03('0x36')]));_0x37dd81[_0xab03('0x35')]=_0x37dd81[_0xab03('0x35')][_0xab03('0x37')]?_0x37dd81[_0xab03('0x35')]:_0x27cae4[_0xab03('0x30')];if(_0x45e3da[_0xab03('0x31')][_0xab03('0x47')]){_0x37dd81[_0xab03('0x48')]=[{'all':!![]}];}_0x37dd81=_[_0xab03('0x3f')]({},_0x37dd81,_0x45e3da[_0xab03('0x41')]);return db['SquareReport']['find'](_0x37dd81)[_0xab03('0x27')](handleEntityNotFound(_0xf7e4f6,null))['then'](respondWithResult(_0xf7e4f6,null))[_0xab03('0x44')](handleError(_0xf7e4f6,null));};exports[_0xab03('0x49')]=function(_0x4e55d5,_0x17b0db){return db[_0xab03('0x2e')][_0xab03('0x49')](_0x4e55d5['body'],{})['then'](respondWithResult(_0x17b0db,0xc9))[_0xab03('0x44')](handleError(_0x17b0db,null));};exports[_0xab03('0x26')]=function(_0x516491,_0x53c918){if(_0x516491[_0xab03('0x4a')]['id']){delete _0x516491[_0xab03('0x4a')]['id'];}return db[_0xab03('0x2e')][_0xab03('0x4b')]({'where':{'id':_0x516491[_0xab03('0x45')]['id']}})['then'](handleEntityNotFound(_0x53c918,null))[_0xab03('0x27')](saveUpdates(_0x516491[_0xab03('0x4a')],null))[_0xab03('0x27')](respondWithResult(_0x53c918,null))['catch'](handleError(_0x53c918,null));};exports[_0xab03('0x4c')]=function(_0x7ee290,_0x291d06){return db[_0xab03('0x2e')][_0xab03('0x4b')]({'where':{'id':_0x7ee290[_0xab03('0x45')]['id']}})[_0xab03('0x27')](handleEntityNotFound(_0x291d06,null))[_0xab03('0x27')](removeEntity(_0x291d06,null))[_0xab03('0x44')](handleError(_0x291d06,null));};exports['describe']=function(_0x48ab08,_0x31bdc0){return db[_0xab03('0x2e')]['describe']()['then'](respondWithResult(_0x31bdc0,null))['catch'](handleError(_0x31bdc0,null));}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.model.js b/server/api/squareReport/squareReport.model.js index f482240..1065f5f 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 _0xbe06=['SquareReport','report_square','uid_pname','project_name','leaveAt','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe06,0xc8));var _0x6be0=function(_0x11ba83,_0xd5611a){_0x11ba83=_0x11ba83-0x0;var _0x3f3925=_0xbe06[_0x11ba83];return _0x3f3925;};'use strict';var _=require(_0x6be0('0x0'));var util=require(_0x6be0('0x1'));var logger=require(_0x6be0('0x2'))(_0x6be0('0x3'));var moment=require(_0x6be0('0x4'));var BPromise=require(_0x6be0('0x5'));var rp=require(_0x6be0('0x6'));var fs=require('fs');var path=require(_0x6be0('0x7'));var rimraf=require('rimraf');var config=require(_0x6be0('0x8'));var attributes=require('./squareReport.attributes');module[_0x6be0('0x9')]=function(_0xc7c7df,_0x30c3d6){return _0xc7c7df['define'](_0x6be0('0xa'),attributes,{'tableName':_0x6be0('0xb'),'paranoid':![],'indexes':[{'name':_0x6be0('0xc'),'fields':['uniqueid',_0x6be0('0xd')]},{'name':_0x6be0('0xe'),'fields':['leaveAt']}],'timestamps':!![]});}; \ No newline at end of file +var _0x5587=['leaveAt','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment','./squareReport.attributes','exports','SquareReport','report_square','uid_pname','project_name'];(function(_0x4618da,_0x27c024){var _0xede04a=function(_0x2bdf4c){while(--_0x2bdf4c){_0x4618da['push'](_0x4618da['shift']());}};_0xede04a(++_0x27c024);}(_0x5587,0x7f));var _0x7558=function(_0x15f6dc,_0x1b3f7a){_0x15f6dc=_0x15f6dc-0x0;var _0x5ab9d2=_0x5587[_0x15f6dc];return _0x5ab9d2;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7558('0x0'))(_0x7558('0x1'));var moment=require('moment');var BPromise=require(_0x7558('0x2'));var rp=require(_0x7558('0x3'));var fs=require('fs');var path=require(_0x7558('0x4'));var rimraf=require(_0x7558('0x5'));var config=require(_0x7558('0x6'));var attributes=require(_0x7558('0x7'));module[_0x7558('0x8')]=function(_0x27b691,_0x5f2273){return _0x27b691['define'](_0x7558('0x9'),attributes,{'tableName':_0x7558('0xa'),'paranoid':![],'indexes':[{'name':_0x7558('0xb'),'fields':['uniqueid',_0x7558('0xc')]},{'name':_0x7558('0xd'),'fields':[_0x7558('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReport/squareReport.rpc.js b/server/api/squareReport/squareReport.rpc.js index 4c5195b..72e98d2 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 _0xb523=['raw','CreateSquareReport','UpdateSquareReport','update','attributes','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info','SquareReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','SquareReport','create','body','options'];(function(_0x36501b,_0x442101){var _0x1dc204=function(_0xe7b088){while(--_0xe7b088){_0x36501b['push'](_0x36501b['shift']());}};_0x1dc204(++_0x442101);}(_0xb523,0x179));var _0x3b52=function(_0x1dafb5,_0x47281b){_0x1dafb5=_0x1dafb5-0x0;var _0x55a156=_0xb523[_0x1dafb5];return _0x55a156;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x3b52('0x0'));var BPromise=require(_0x3b52('0x1'));var rs=require(_0x3b52('0x2'));var fs=require('fs');var Redis=require(_0x3b52('0x3'));var db=require(_0x3b52('0x4'))['db'];var utils=require(_0x3b52('0x5'));var logger=require(_0x3b52('0x6'))(_0x3b52('0x7'));var config=require(_0x3b52('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x3b52('0x9')][_0x3b52('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5bc480,_0x439fa1,_0x11a624){return new BPromise(function(_0x219423,_0x4945f8){return client[_0x3b52('0xb')](_0x5bc480,_0x11a624)[_0x3b52('0xc')](function(_0x58457f){logger[_0x3b52('0xd')](_0x3b52('0xe'),_0x439fa1,_0x3b52('0xf'));logger[_0x3b52('0x10')]('SquareReport,\x20%s,\x20%s,\x20%s',_0x439fa1,_0x3b52('0xf'),JSON[_0x3b52('0x11')](_0x58457f));if(_0x58457f['error']){if(_0x58457f[_0x3b52('0x12')][_0x3b52('0x13')]===0x1f4){logger[_0x3b52('0x12')](_0x3b52('0xe'),_0x439fa1,_0x58457f[_0x3b52('0x12')][_0x3b52('0x14')]);return _0x4945f8(_0x58457f['error'][_0x3b52('0x14')]);}logger[_0x3b52('0x12')](_0x3b52('0xe'),_0x439fa1,_0x58457f[_0x3b52('0x12')]['message']);return _0x219423(_0x58457f[_0x3b52('0x12')][_0x3b52('0x14')]);}else{logger[_0x3b52('0xd')]('SquareReport,\x20%s,\x20%s',_0x439fa1,_0x3b52('0xf'));_0x219423(_0x58457f['result'][_0x3b52('0x14')]);}})[_0x3b52('0x15')](function(_0xc266f1){logger[_0x3b52('0x12')]('SquareReport,\x20%s,\x20%s',_0x439fa1,_0xc266f1);_0x4945f8(_0xc266f1);});});}exports['CreateSquareReport']=function(_0x5227bc){var _0x53d4ff=this;return new Promise(function(_0x230a86,_0x163ad5){return db[_0x3b52('0x16')][_0x3b52('0x17')](_0x5227bc[_0x3b52('0x18')],{'raw':_0x5227bc[_0x3b52('0x19')]?_0x5227bc[_0x3b52('0x19')][_0x3b52('0x1a')]===undefined?!![]:![]:!![]})['then'](function(_0x51faa1){logger[_0x3b52('0xd')](_0x3b52('0x1b'),_0x5227bc);logger[_0x3b52('0x10')](_0x3b52('0x1b'),_0x5227bc,JSON[_0x3b52('0x11')](_0x51faa1));_0x230a86(_0x51faa1);})[_0x3b52('0x15')](function(_0x428ac7){logger[_0x3b52('0x12')](_0x3b52('0x1b'),_0x428ac7[_0x3b52('0x14')],_0x5227bc);_0x163ad5(_0x53d4ff[_0x3b52('0x12')](0x1f4,_0x428ac7[_0x3b52('0x14')]));});});};exports[_0x3b52('0x1c')]=function(_0x488ecb){var _0x52db64=this;return new Promise(function(_0x4628e5,_0x3431ac){return db['SquareReport'][_0x3b52('0x1d')](_0x488ecb['body'],{'raw':_0x488ecb[_0x3b52('0x19')]?_0x488ecb[_0x3b52('0x19')][_0x3b52('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x488ecb['options']?_0x488ecb[_0x3b52('0x19')]['where']||null:null,'attributes':_0x488ecb[_0x3b52('0x19')]?_0x488ecb[_0x3b52('0x19')][_0x3b52('0x1e')]||null:null,'limit':_0x488ecb[_0x3b52('0x19')]?_0x488ecb['options']['limit']||null:null})[_0x3b52('0xc')](function(_0x457531){logger[_0x3b52('0xd')](_0x3b52('0x1c'),_0x488ecb);logger[_0x3b52('0x10')]('UpdateSquareReport',_0x488ecb,JSON[_0x3b52('0x11')](_0x457531));_0x4628e5(_0x457531);})[_0x3b52('0x15')](function(_0x2e29a9){logger['error']('UpdateSquareReport',_0x2e29a9['message'],_0x488ecb);_0x3431ac(_0x52db64[_0x3b52('0x12')](0x1f4,_0x2e29a9[_0x3b52('0x14')]));});});}; \ No newline at end of file +var _0xcabd=['request\x20sent','SquareReport,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateSquareReport','create','body','options','raw','UpdateSquareReport','SquareReport','update','limit','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','SquareReport,\x20%s,\x20%s'];(function(_0x11005e,_0x20c3d2){var _0x29338f=function(_0x3384e9){while(--_0x3384e9){_0x11005e['push'](_0x11005e['shift']());}};_0x29338f(++_0x20c3d2);}(_0xcabd,0x128));var _0xdcab=function(_0x376b45,_0x5964fb){_0x376b45=_0x376b45-0x0;var _0x2341b3=_0xcabd[_0x376b45];return _0x2341b3;};'use strict';var _=require(_0xdcab('0x0'));var util=require('util');var moment=require(_0xdcab('0x1'));var BPromise=require(_0xdcab('0x2'));var rs=require(_0xdcab('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xdcab('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xdcab('0x5'))(_0xdcab('0x6'));var config=require(_0xdcab('0x7'));var jayson=require(_0xdcab('0x8'));var client=jayson[_0xdcab('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1d6219,_0xac0e75,_0x4f75f5){return new BPromise(function(_0x5ce8aa,_0x30775f){return client[_0xdcab('0xa')](_0x1d6219,_0x4f75f5)[_0xdcab('0xb')](function(_0x27a281){logger[_0xdcab('0xc')](_0xdcab('0xd'),_0xac0e75,_0xdcab('0xe'));logger['debug'](_0xdcab('0xf'),_0xac0e75,_0xdcab('0xe'),JSON[_0xdcab('0x10')](_0x27a281));if(_0x27a281[_0xdcab('0x11')]){if(_0x27a281[_0xdcab('0x11')]['code']===0x1f4){logger[_0xdcab('0x11')](_0xdcab('0xd'),_0xac0e75,_0x27a281[_0xdcab('0x11')]['message']);return _0x30775f(_0x27a281[_0xdcab('0x11')]['message']);}logger[_0xdcab('0x11')](_0xdcab('0xd'),_0xac0e75,_0x27a281['error'][_0xdcab('0x12')]);return _0x5ce8aa(_0x27a281[_0xdcab('0x11')]['message']);}else{logger[_0xdcab('0xc')](_0xdcab('0xd'),_0xac0e75,_0xdcab('0xe'));_0x5ce8aa(_0x27a281[_0xdcab('0x13')][_0xdcab('0x12')]);}})[_0xdcab('0x14')](function(_0x4e450a){logger[_0xdcab('0x11')]('SquareReport,\x20%s,\x20%s',_0xac0e75,_0x4e450a);_0x30775f(_0x4e450a);});});}exports[_0xdcab('0x15')]=function(_0x4436d0){var _0x5e9a3e=this;return new Promise(function(_0xac43a1,_0x32027b){return db['SquareReport'][_0xdcab('0x16')](_0x4436d0[_0xdcab('0x17')],{'raw':_0x4436d0[_0xdcab('0x18')]?_0x4436d0[_0xdcab('0x18')][_0xdcab('0x19')]===undefined?!![]:![]:!![]})[_0xdcab('0xb')](function(_0x1430b5){logger[_0xdcab('0xc')](_0xdcab('0x15'),_0x4436d0);logger['debug'](_0xdcab('0x15'),_0x4436d0,JSON[_0xdcab('0x10')](_0x1430b5));_0xac43a1(_0x1430b5);})['catch'](function(_0x52ff6b){logger[_0xdcab('0x11')](_0xdcab('0x15'),_0x52ff6b['message'],_0x4436d0);_0x32027b(_0x5e9a3e[_0xdcab('0x11')](0x1f4,_0x52ff6b[_0xdcab('0x12')]));});});};exports[_0xdcab('0x1a')]=function(_0x443ea2){var _0x2c5ad7=this;return new Promise(function(_0x368759,_0x1634c1){return db[_0xdcab('0x1b')][_0xdcab('0x1c')](_0x443ea2['body'],{'raw':_0x443ea2[_0xdcab('0x18')]?_0x443ea2[_0xdcab('0x18')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x443ea2['options']?_0x443ea2[_0xdcab('0x18')]['where']||null:null,'attributes':_0x443ea2['options']?_0x443ea2[_0xdcab('0x18')]['attributes']||null:null,'limit':_0x443ea2['options']?_0x443ea2['options'][_0xdcab('0x1d')]||null:null})[_0xdcab('0xb')](function(_0x2d3f27){logger[_0xdcab('0xc')](_0xdcab('0x1a'),_0x443ea2);logger[_0xdcab('0x1e')](_0xdcab('0x1a'),_0x443ea2,JSON[_0xdcab('0x10')](_0x2d3f27));_0x368759(_0x2d3f27);})[_0xdcab('0x14')](function(_0x4bf2c1){logger['error'](_0xdcab('0x1a'),_0x4bf2c1[_0xdcab('0x12')],_0x443ea2);_0x1634c1(_0x2c5ad7[_0xdcab('0x11')](0x1f4,_0x4bf2c1['message']));});});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/index.js b/server/api/squareReportDetail/index.js index eab3274..27fe870 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 _0x84dc=['describe','/:id','show','post','create','update','delete','destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe'];(function(_0x16b654,_0x3fe8cb){var _0x39fcc4=function(_0x1a401c){while(--_0x1a401c){_0x16b654['push'](_0x16b654['shift']());}};_0x39fcc4(++_0x3fe8cb);}(_0x84dc,0x17f));var _0xc84d=function(_0x4deacd,_0x4d7e3a){_0x4deacd=_0x4deacd-0x0;var _0x462519=_0x84dc[_0x4deacd];return _0x462519;};'use strict';var multer=require(_0xc84d('0x0'));var util=require(_0xc84d('0x1'));var path=require(_0xc84d('0x2'));var timeout=require(_0xc84d('0x3'));var express=require('express');var router=express[_0xc84d('0x4')]();var fs_extra=require(_0xc84d('0x5'));var auth=require(_0xc84d('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xc84d('0x7'));var controller=require(_0xc84d('0x8'));router[_0xc84d('0x9')]('/',auth[_0xc84d('0xa')](),controller[_0xc84d('0xb')]);router[_0xc84d('0x9')](_0xc84d('0xc'),auth['isAuthenticated'](),controller[_0xc84d('0xd')]);router[_0xc84d('0x9')](_0xc84d('0xe'),auth['isAuthenticated'](),controller[_0xc84d('0xf')]);router[_0xc84d('0x10')]('/',auth[_0xc84d('0xa')](),controller[_0xc84d('0x11')]);router['put']('/:id',auth[_0xc84d('0xa')](),controller[_0xc84d('0x12')]);router[_0xc84d('0x13')](_0xc84d('0xe'),auth[_0xc84d('0xa')](),controller[_0xc84d('0x14')]);module[_0xc84d('0x15')]=router; \ No newline at end of file +var _0x518d=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./squareReportDetail.controller','get','isAuthenticated','index','/describe','/:id','show','post','put','destroy','exports'];(function(_0x5f0e0f,_0x6385e6){var _0x3e6158=function(_0x10fbb9){while(--_0x10fbb9){_0x5f0e0f['push'](_0x5f0e0f['shift']());}};_0x3e6158(++_0x6385e6);}(_0x518d,0x8c));var _0xd518=function(_0x338602,_0x41bffa){_0x338602=_0x338602-0x0;var _0x14d117=_0x518d[_0x338602];return _0x14d117;};'use strict';var multer=require(_0xd518('0x0'));var util=require(_0xd518('0x1'));var path=require(_0xd518('0x2'));var timeout=require(_0xd518('0x3'));var express=require(_0xd518('0x4'));var router=express[_0xd518('0x5')]();var fs_extra=require(_0xd518('0x6'));var auth=require(_0xd518('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xd518('0x8'));var controller=require(_0xd518('0x9'));router[_0xd518('0xa')]('/',auth[_0xd518('0xb')](),controller[_0xd518('0xc')]);router[_0xd518('0xa')](_0xd518('0xd'),auth[_0xd518('0xb')](),controller['describe']);router[_0xd518('0xa')](_0xd518('0xe'),auth['isAuthenticated'](),controller[_0xd518('0xf')]);router[_0xd518('0x10')]('/',auth[_0xd518('0xb')](),controller['create']);router[_0xd518('0x11')](_0xd518('0xe'),auth[_0xd518('0xb')](),controller['update']);router['delete'](_0xd518('0xe'),auth[_0xd518('0xb')](),controller[_0xd518('0x12')]);module[_0xd518('0x13')]=router; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.attributes.js b/server/api/squareReportDetail/squareReportDetail.attributes.js index 85e61c7..3f13f7a 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 _0x5cc3=['STRING','TEXT','sequelize','exports'];(function(_0x152136,_0x4f14f1){var _0x20df44=function(_0x362877){while(--_0x362877){_0x152136['push'](_0x152136['shift']());}};_0x20df44(++_0x4f14f1);}(_0x5cc3,0xce));var _0x35cc=function(_0x501510,_0x61caa9){_0x501510=_0x501510-0x0;var _0x1e6ee5=_0x5cc3[_0x501510];return _0x1e6ee5;};'use strict';var Sequelize=require(_0x35cc('0x0'));module[_0x35cc('0x1')]={'uniqueid':{'type':Sequelize[_0x35cc('0x2')]},'node':{'type':Sequelize[_0x35cc('0x2')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0x35cc('0x3')]},'project_name':{'type':Sequelize[_0x35cc('0x2')]},'callerid':{'type':Sequelize[_0x35cc('0x2')]}}; \ No newline at end of file +var _0xe3bd=['exports','STRING','TEXT'];(function(_0x27f5de,_0x577080){var _0x484149=function(_0x7e9adb){while(--_0x7e9adb){_0x27f5de['push'](_0x27f5de['shift']());}};_0x484149(++_0x577080);}(_0xe3bd,0x126));var _0xde3b=function(_0x40b66c,_0x5c1d58){_0x40b66c=_0x40b66c-0x0;var _0x159671=_0xe3bd[_0x40b66c];return _0x159671;};'use strict';var Sequelize=require('sequelize');module[_0xde3b('0x0')]={'uniqueid':{'type':Sequelize[_0xde3b('0x1')]},'node':{'type':Sequelize[_0xde3b('0x1')]},'application':{'type':Sequelize['STRING']},'data':{'type':Sequelize[_0xde3b('0x2')]},'project_name':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xde3b('0x1')]}}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.controller.js b/server/api/squareReportDetail/squareReportDetail.controller.js index eff9c5f..5414ec7 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 _0x8dcc=['VIRTUAL','includeAll','include','findAll','rows','catch','params','merge','options','find','create','body','describe','eml-format','zip-dir','fast-json-patch','moment','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','count','offset','Content-Range','json','reject','save','update','destroy','then','error','stack','name','send','SquareDetailsReport','rawAttributes','fieldName','type','query','keys','filters','intersection','model','fields','attributes','length','nolimit','limit','order','sort','where','pick','filter','map'];(function(_0x1589dd,_0x2b9d22){var _0x1bddd1=function(_0x3687f8){while(--_0x3687f8){_0x1589dd['push'](_0x1589dd['shift']());}};_0x1bddd1(++_0x2b9d22);}(_0x8dcc,0xf1));var _0xc8dc=function(_0x275fab,_0x1e7bd7){_0x275fab=_0x275fab-0x0;var _0x1a0f2c=_0x8dcc[_0x275fab];return _0x1a0f2c;};'use strict';var emlformat=require(_0xc8dc('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xc8dc('0x1'));var jsonpatch=require(_0xc8dc('0x2'));var rp=require('request-promise');var moment=require(_0xc8dc('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc8dc('0x4'));var util=require(_0xc8dc('0x5'));var path=require('path');var sox=require(_0xc8dc('0x6'));var csv=require(_0xc8dc('0x7'));var ejs=require(_0xc8dc('0x8'));var fs=require('fs');var fs_extra=require(_0xc8dc('0x9'));var _=require(_0xc8dc('0xa'));var squel=require(_0xc8dc('0xb'));var crypto=require(_0xc8dc('0xc'));var jsforce=require(_0xc8dc('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc8dc('0x7'));var querystring=require(_0xc8dc('0xe'));var Papa=require('papaparse');var Redis=require(_0xc8dc('0xf'));var authService=require(_0xc8dc('0x10'));var qs=require(_0xc8dc('0x11'));var as=require(_0xc8dc('0x12'));var hardwareService=require(_0xc8dc('0x13'));var logger=require(_0xc8dc('0x14'))(_0xc8dc('0x15'));var utils=require(_0xc8dc('0x16'));var config=require(_0xc8dc('0x17'));var licenseUtil=require(_0xc8dc('0x18'));var db=require(_0xc8dc('0x19'))['db'];function respondWithStatusCode(_0x499dde,_0x504470){_0x504470=_0x504470||0xcc;return function(_0x208ce1){if(_0x208ce1){return _0x499dde[_0xc8dc('0x1a')](_0x504470);}return _0x499dde[_0xc8dc('0x1b')](_0x504470)[_0xc8dc('0x1c')]();};}function respondWithResult(_0x2c9281,_0x49ab99){_0x49ab99=_0x49ab99||0xc8;return function(_0x489f80){if(_0x489f80){return _0x2c9281[_0xc8dc('0x1b')](_0x49ab99)['json'](_0x489f80);}};}function respondWithFilteredResult(_0x2e85aa,_0x32be9c){return function(_0x292845){if(_0x292845){var _0x5c2061=typeof _0x32be9c['offset']==='undefined'&&typeof _0x32be9c['limit']===_0xc8dc('0x1d');var _0x35bd8f=_0x292845[_0xc8dc('0x1e')];var _0x1dd564=_0x5c2061?0x0:_0x32be9c[_0xc8dc('0x1f')];var _0xf9de1e=_0x5c2061?_0x292845[_0xc8dc('0x1e')]:_0x32be9c[_0xc8dc('0x1f')]+_0x32be9c['limit'];var _0x290894;if(_0xf9de1e>=_0x35bd8f){_0xf9de1e=_0x35bd8f;_0x290894=0xc8;}else{_0x290894=0xce;}_0x2e85aa[_0xc8dc('0x1b')](_0x290894);return _0x2e85aa['set'](_0xc8dc('0x20'),_0x1dd564+'-'+_0xf9de1e+'/'+_0x35bd8f)[_0xc8dc('0x21')](_0x292845);}return null;};}function patchUpdates(_0xb36b81){return function(_0x488a84){try{jsonpatch['apply'](_0x488a84,_0xb36b81,!![]);}catch(_0x57ec7d){return BPromise[_0xc8dc('0x22')](_0x57ec7d);}return _0x488a84[_0xc8dc('0x23')]();};}function saveUpdates(_0x283ad3,_0xf65d7f){return function(_0x22fdf7){if(_0x22fdf7){return _0x22fdf7[_0xc8dc('0x24')](_0x283ad3)['then'](function(_0x36201c){return _0x36201c;});}return null;};}function removeEntity(_0xf26187,_0x502b0c){return function(_0x305c0b){if(_0x305c0b){return _0x305c0b[_0xc8dc('0x25')]()[_0xc8dc('0x26')](function(){_0xf26187[_0xc8dc('0x1b')](0xcc)[_0xc8dc('0x1c')]();});}};}function handleEntityNotFound(_0x2edc4c,_0x4e2ae5){return function(_0x4e93ea){if(!_0x4e93ea){_0x2edc4c[_0xc8dc('0x1a')](0x194);}return _0x4e93ea;};}function handleError(_0x5a747f,_0x3e1f42){_0x3e1f42=_0x3e1f42||0x1f4;return function(_0x3482d2){logger[_0xc8dc('0x27')](_0x3482d2[_0xc8dc('0x28')]);if(_0x3482d2['name']){delete _0x3482d2[_0xc8dc('0x29')];}_0x5a747f[_0xc8dc('0x1b')](_0x3e1f42)[_0xc8dc('0x2a')](_0x3482d2);};}exports['index']=function(_0x1bd777,_0x4c6239){var _0x320f97={},_0x28e34b={},_0x48a366={'count':0x0,'rows':[]};var _0x143631=_['map'](db[_0xc8dc('0x2b')][_0xc8dc('0x2c')],function(_0x46728f){return{'name':_0x46728f[_0xc8dc('0x2d')],'type':_0x46728f[_0xc8dc('0x2e')]['key']};});_0x28e34b['model']=_['map'](_0x143631,_0xc8dc('0x29'));_0x28e34b[_0xc8dc('0x2f')]=_[_0xc8dc('0x30')](_0x1bd777[_0xc8dc('0x2f')]);_0x28e34b[_0xc8dc('0x31')]=_['intersection'](_0x28e34b['model'],_0x28e34b[_0xc8dc('0x2f')]);_0x320f97['attributes']=_[_0xc8dc('0x32')](_0x28e34b[_0xc8dc('0x33')],qs[_0xc8dc('0x34')](_0x1bd777['query'][_0xc8dc('0x34')]));_0x320f97[_0xc8dc('0x35')]=_0x320f97['attributes'][_0xc8dc('0x36')]?_0x320f97['attributes']:_0x28e34b[_0xc8dc('0x33')];if(!_0x1bd777[_0xc8dc('0x2f')]['hasOwnProperty'](_0xc8dc('0x37'))){_0x320f97[_0xc8dc('0x38')]=qs[_0xc8dc('0x38')](_0x1bd777[_0xc8dc('0x2f')][_0xc8dc('0x38')]);_0x320f97['offset']=qs[_0xc8dc('0x1f')](_0x1bd777['query'][_0xc8dc('0x1f')]);}_0x320f97[_0xc8dc('0x39')]=qs[_0xc8dc('0x3a')](_0x1bd777[_0xc8dc('0x2f')]['sort']);_0x320f97[_0xc8dc('0x3b')]=qs[_0xc8dc('0x31')](_[_0xc8dc('0x3c')](_0x1bd777[_0xc8dc('0x2f')],_0x28e34b[_0xc8dc('0x31')]),_0x143631);if(_0x1bd777['query'][_0xc8dc('0x3d')]){_0x320f97[_0xc8dc('0x3b')]=_['merge'](_0x320f97[_0xc8dc('0x3b')],{'$or':_[_0xc8dc('0x3e')](_0x143631,function(_0x406d27){if(_0x406d27[_0xc8dc('0x2e')]!==_0xc8dc('0x3f')){var _0xbd2c9={};_0xbd2c9[_0x406d27[_0xc8dc('0x29')]]={'$like':'%'+_0x1bd777[_0xc8dc('0x2f')][_0xc8dc('0x3d')]+'%'};return _0xbd2c9;}})});}_0x320f97=_['merge']({},_0x320f97,_0x1bd777['options']);var _0x154f49={'where':_0x320f97['where']};return db[_0xc8dc('0x2b')][_0xc8dc('0x1e')](_0x154f49)[_0xc8dc('0x26')](function(_0x527f23){_0x48a366[_0xc8dc('0x1e')]=_0x527f23;if(_0x1bd777[_0xc8dc('0x2f')][_0xc8dc('0x40')]){_0x320f97[_0xc8dc('0x41')]=[{'all':!![]}];}return db[_0xc8dc('0x2b')][_0xc8dc('0x42')](_0x320f97);})['then'](function(_0x1ffef9){_0x48a366[_0xc8dc('0x43')]=_0x1ffef9;return _0x48a366;})[_0xc8dc('0x26')](respondWithFilteredResult(_0x4c6239,_0x320f97))[_0xc8dc('0x44')](handleError(_0x4c6239,null));};exports['show']=function(_0xa59e62,_0x2751b7){var _0x5090cc={'raw':!![],'where':{'id':_0xa59e62[_0xc8dc('0x45')]['id']}},_0x470f48={};_0x470f48[_0xc8dc('0x33')]=_[_0xc8dc('0x30')](db[_0xc8dc('0x2b')][_0xc8dc('0x2c')]);_0x470f48[_0xc8dc('0x2f')]=_[_0xc8dc('0x30')](_0xa59e62[_0xc8dc('0x2f')]);_0x470f48[_0xc8dc('0x31')]=_[_0xc8dc('0x32')](_0x470f48[_0xc8dc('0x33')],_0x470f48[_0xc8dc('0x2f')]);_0x5090cc[_0xc8dc('0x35')]=_['intersection'](_0x470f48[_0xc8dc('0x33')],qs[_0xc8dc('0x34')](_0xa59e62[_0xc8dc('0x2f')][_0xc8dc('0x34')]));_0x5090cc[_0xc8dc('0x35')]=_0x5090cc[_0xc8dc('0x35')][_0xc8dc('0x36')]?_0x5090cc['attributes']:_0x470f48[_0xc8dc('0x33')];if(_0xa59e62[_0xc8dc('0x2f')]['includeAll']){_0x5090cc['include']=[{'all':!![]}];}_0x5090cc=_[_0xc8dc('0x46')]({},_0x5090cc,_0xa59e62[_0xc8dc('0x47')]);return db[_0xc8dc('0x2b')][_0xc8dc('0x48')](_0x5090cc)['then'](handleEntityNotFound(_0x2751b7,null))[_0xc8dc('0x26')](respondWithResult(_0x2751b7,null))['catch'](handleError(_0x2751b7,null));};exports[_0xc8dc('0x49')]=function(_0x4d4d98,_0x356e16){return db[_0xc8dc('0x2b')]['create'](_0x4d4d98[_0xc8dc('0x4a')],{})[_0xc8dc('0x26')](respondWithResult(_0x356e16,0xc9))[_0xc8dc('0x44')](handleError(_0x356e16,null));};exports[_0xc8dc('0x24')]=function(_0x59ec0d,_0x2b9213){if(_0x59ec0d[_0xc8dc('0x4a')]['id']){delete _0x59ec0d[_0xc8dc('0x4a')]['id'];}return db[_0xc8dc('0x2b')][_0xc8dc('0x48')]({'where':{'id':_0x59ec0d[_0xc8dc('0x45')]['id']}})[_0xc8dc('0x26')](handleEntityNotFound(_0x2b9213,null))[_0xc8dc('0x26')](saveUpdates(_0x59ec0d['body'],null))[_0xc8dc('0x26')](respondWithResult(_0x2b9213,null))[_0xc8dc('0x44')](handleError(_0x2b9213,null));};exports['destroy']=function(_0x10f91f,_0x40be28){return db['SquareDetailsReport'][_0xc8dc('0x48')]({'where':{'id':_0x10f91f[_0xc8dc('0x45')]['id']}})['then'](handleEntityNotFound(_0x40be28,null))[_0xc8dc('0x26')](removeEntity(_0x40be28,null))['catch'](handleError(_0x40be28,null));};exports['describe']=function(_0x3f7627,_0x266931){return db[_0xc8dc('0x2b')][_0xc8dc('0x4b')]()[_0xc8dc('0x26')](respondWithResult(_0x266931,null))[_0xc8dc('0x44')](handleError(_0x266931,null));}; \ No newline at end of file +var _0xd983=['hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','limit','undefined','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','SquareDetailsReport','rawAttributes','type','key','model','keys','filters','intersection','fields','query','attributes','length'];(function(_0x37bd26,_0x5ad346){var _0xe83dc4=function(_0x1ac229){while(--_0x1ac229){_0x37bd26['push'](_0x37bd26['shift']());}};_0xe83dc4(++_0x5ad346);}(_0xd983,0x10b));var _0x3d98=function(_0x226cca,_0xc7facd){_0x226cca=_0x226cca-0x0;var _0x2e0be8=_0xd983[_0x226cca];return _0x2e0be8;};'use strict';var emlformat=require(_0x3d98('0x0'));var rimraf=require(_0x3d98('0x1'));var zipdir=require(_0x3d98('0x2'));var jsonpatch=require(_0x3d98('0x3'));var rp=require(_0x3d98('0x4'));var moment=require(_0x3d98('0x5'));var BPromise=require(_0x3d98('0x6'));var Mustache=require(_0x3d98('0x7'));var util=require(_0x3d98('0x8'));var path=require(_0x3d98('0x9'));var sox=require(_0x3d98('0xa'));var csv=require('to-csv');var ejs=require(_0x3d98('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x3d98('0xc'));var squel=require(_0x3d98('0xd'));var crypto=require(_0x3d98('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x3d98('0xf'));var toCsv=require(_0x3d98('0x10'));var querystring=require('querystring');var Papa=require(_0x3d98('0x11'));var Redis=require(_0x3d98('0x12'));var authService=require(_0x3d98('0x13'));var qs=require('../../components/parsers/qs');var as=require(_0x3d98('0x14'));var hardwareService=require(_0x3d98('0x15'));var logger=require(_0x3d98('0x16'))(_0x3d98('0x17'));var utils=require(_0x3d98('0x18'));var config=require(_0x3d98('0x19'));var licenseUtil=require(_0x3d98('0x1a'));var db=require(_0x3d98('0x1b'))['db'];function respondWithStatusCode(_0xf54967,_0x2398ac){_0x2398ac=_0x2398ac||0xcc;return function(_0x4bc597){if(_0x4bc597){return _0xf54967[_0x3d98('0x1c')](_0x2398ac);}return _0xf54967['status'](_0x2398ac)[_0x3d98('0x1d')]();};}function respondWithResult(_0xc3b640,_0x1d40e8){_0x1d40e8=_0x1d40e8||0xc8;return function(_0x518fda){if(_0x518fda){return _0xc3b640[_0x3d98('0x1e')](_0x1d40e8)[_0x3d98('0x1f')](_0x518fda);}};}function respondWithFilteredResult(_0x46d2bb,_0x59ff88){return function(_0xd4238a){if(_0xd4238a){var _0x36af84=typeof _0x59ff88[_0x3d98('0x20')]==='undefined'&&typeof _0x59ff88[_0x3d98('0x21')]===_0x3d98('0x22');var _0x3ee722=_0xd4238a[_0x3d98('0x23')];var _0xdeedc4=_0x36af84?0x0:_0x59ff88[_0x3d98('0x20')];var _0x518bfe=_0x36af84?_0xd4238a['count']:_0x59ff88[_0x3d98('0x20')]+_0x59ff88[_0x3d98('0x21')];var _0x4969f3;if(_0x518bfe>=_0x3ee722){_0x518bfe=_0x3ee722;_0x4969f3=0xc8;}else{_0x4969f3=0xce;}_0x46d2bb[_0x3d98('0x1e')](_0x4969f3);return _0x46d2bb[_0x3d98('0x24')](_0x3d98('0x25'),_0xdeedc4+'-'+_0x518bfe+'/'+_0x3ee722)[_0x3d98('0x1f')](_0xd4238a);}return null;};}function patchUpdates(_0x2f8d8e){return function(_0x21ca70){try{jsonpatch[_0x3d98('0x26')](_0x21ca70,_0x2f8d8e,!![]);}catch(_0x364337){return BPromise[_0x3d98('0x27')](_0x364337);}return _0x21ca70[_0x3d98('0x28')]();};}function saveUpdates(_0x32ed77,_0x22f4c4){return function(_0x540e5e){if(_0x540e5e){return _0x540e5e[_0x3d98('0x29')](_0x32ed77)[_0x3d98('0x2a')](function(_0x19638a){return _0x19638a;});}return null;};}function removeEntity(_0x1246c7,_0x5bdcb6){return function(_0xcffcd4){if(_0xcffcd4){return _0xcffcd4[_0x3d98('0x2b')]()[_0x3d98('0x2a')](function(){_0x1246c7['status'](0xcc)[_0x3d98('0x1d')]();});}};}function handleEntityNotFound(_0x201ce5,_0x6227eb){return function(_0x3dc3d0){if(!_0x3dc3d0){_0x201ce5[_0x3d98('0x1c')](0x194);}return _0x3dc3d0;};}function handleError(_0x13c144,_0x46847f){_0x46847f=_0x46847f||0x1f4;return function(_0x5a64c3){logger[_0x3d98('0x2c')](_0x5a64c3[_0x3d98('0x2d')]);if(_0x5a64c3[_0x3d98('0x2e')]){delete _0x5a64c3[_0x3d98('0x2e')];}_0x13c144[_0x3d98('0x1e')](_0x46847f)[_0x3d98('0x2f')](_0x5a64c3);};}exports['index']=function(_0x4c70dc,_0x9de4f3){var _0x53d9df={},_0x5e74a0={},_0x2df03f={'count':0x0,'rows':[]};var _0x417dfb=_[_0x3d98('0x30')](db[_0x3d98('0x31')][_0x3d98('0x32')],function(_0x39064d){return{'name':_0x39064d['fieldName'],'type':_0x39064d[_0x3d98('0x33')][_0x3d98('0x34')]};});_0x5e74a0[_0x3d98('0x35')]=_[_0x3d98('0x30')](_0x417dfb,_0x3d98('0x2e'));_0x5e74a0['query']=_[_0x3d98('0x36')](_0x4c70dc['query']);_0x5e74a0[_0x3d98('0x37')]=_[_0x3d98('0x38')](_0x5e74a0['model'],_0x5e74a0['query']);_0x53d9df['attributes']=_[_0x3d98('0x38')](_0x5e74a0[_0x3d98('0x35')],qs[_0x3d98('0x39')](_0x4c70dc[_0x3d98('0x3a')]['fields']));_0x53d9df[_0x3d98('0x3b')]=_0x53d9df[_0x3d98('0x3b')][_0x3d98('0x3c')]?_0x53d9df[_0x3d98('0x3b')]:_0x5e74a0[_0x3d98('0x35')];if(!_0x4c70dc[_0x3d98('0x3a')][_0x3d98('0x3d')](_0x3d98('0x3e'))){_0x53d9df['limit']=qs[_0x3d98('0x21')](_0x4c70dc['query']['limit']);_0x53d9df[_0x3d98('0x20')]=qs[_0x3d98('0x20')](_0x4c70dc[_0x3d98('0x3a')][_0x3d98('0x20')]);}_0x53d9df[_0x3d98('0x3f')]=qs[_0x3d98('0x40')](_0x4c70dc[_0x3d98('0x3a')][_0x3d98('0x40')]);_0x53d9df[_0x3d98('0x41')]=qs[_0x3d98('0x37')](_[_0x3d98('0x42')](_0x4c70dc[_0x3d98('0x3a')],_0x5e74a0[_0x3d98('0x37')]),_0x417dfb);if(_0x4c70dc[_0x3d98('0x3a')][_0x3d98('0x43')]){_0x53d9df[_0x3d98('0x41')]=_[_0x3d98('0x44')](_0x53d9df[_0x3d98('0x41')],{'$or':_[_0x3d98('0x30')](_0x417dfb,function(_0x475a22){if(_0x475a22[_0x3d98('0x33')]!==_0x3d98('0x45')){var _0x5d1362={};_0x5d1362[_0x475a22[_0x3d98('0x2e')]]={'$like':'%'+_0x4c70dc[_0x3d98('0x3a')]['filter']+'%'};return _0x5d1362;}})});}_0x53d9df=_[_0x3d98('0x44')]({},_0x53d9df,_0x4c70dc[_0x3d98('0x46')]);var _0x404d5c={'where':_0x53d9df['where']};return db[_0x3d98('0x31')]['count'](_0x404d5c)[_0x3d98('0x2a')](function(_0x8199ff){_0x2df03f['count']=_0x8199ff;if(_0x4c70dc[_0x3d98('0x3a')][_0x3d98('0x47')]){_0x53d9df[_0x3d98('0x48')]=[{'all':!![]}];}return db['SquareDetailsReport'][_0x3d98('0x49')](_0x53d9df);})['then'](function(_0x257cae){_0x2df03f[_0x3d98('0x4a')]=_0x257cae;return _0x2df03f;})[_0x3d98('0x2a')](respondWithFilteredResult(_0x9de4f3,_0x53d9df))[_0x3d98('0x4b')](handleError(_0x9de4f3,null));};exports[_0x3d98('0x4c')]=function(_0x534f20,_0x2a1b3d){var _0xe3593b={'raw':!![],'where':{'id':_0x534f20[_0x3d98('0x4d')]['id']}},_0x6ca05c={};_0x6ca05c[_0x3d98('0x35')]=_['keys'](db[_0x3d98('0x31')][_0x3d98('0x32')]);_0x6ca05c[_0x3d98('0x3a')]=_[_0x3d98('0x36')](_0x534f20[_0x3d98('0x3a')]);_0x6ca05c['filters']=_[_0x3d98('0x38')](_0x6ca05c[_0x3d98('0x35')],_0x6ca05c['query']);_0xe3593b['attributes']=_[_0x3d98('0x38')](_0x6ca05c[_0x3d98('0x35')],qs[_0x3d98('0x39')](_0x534f20[_0x3d98('0x3a')][_0x3d98('0x39')]));_0xe3593b[_0x3d98('0x3b')]=_0xe3593b[_0x3d98('0x3b')][_0x3d98('0x3c')]?_0xe3593b['attributes']:_0x6ca05c[_0x3d98('0x35')];if(_0x534f20[_0x3d98('0x3a')][_0x3d98('0x47')]){_0xe3593b['include']=[{'all':!![]}];}_0xe3593b=_[_0x3d98('0x44')]({},_0xe3593b,_0x534f20[_0x3d98('0x46')]);return db[_0x3d98('0x31')][_0x3d98('0x4e')](_0xe3593b)[_0x3d98('0x2a')](handleEntityNotFound(_0x2a1b3d,null))[_0x3d98('0x2a')](respondWithResult(_0x2a1b3d,null))[_0x3d98('0x4b')](handleError(_0x2a1b3d,null));};exports[_0x3d98('0x4f')]=function(_0x46de91,_0x50f208){return db['SquareDetailsReport'][_0x3d98('0x4f')](_0x46de91[_0x3d98('0x50')],{})[_0x3d98('0x2a')](respondWithResult(_0x50f208,0xc9))[_0x3d98('0x4b')](handleError(_0x50f208,null));};exports[_0x3d98('0x29')]=function(_0x55d39a,_0x50cb14){if(_0x55d39a[_0x3d98('0x50')]['id']){delete _0x55d39a['body']['id'];}return db[_0x3d98('0x31')][_0x3d98('0x4e')]({'where':{'id':_0x55d39a[_0x3d98('0x4d')]['id']}})['then'](handleEntityNotFound(_0x50cb14,null))[_0x3d98('0x2a')](saveUpdates(_0x55d39a[_0x3d98('0x50')],null))[_0x3d98('0x2a')](respondWithResult(_0x50cb14,null))[_0x3d98('0x4b')](handleError(_0x50cb14,null));};exports[_0x3d98('0x2b')]=function(_0x500272,_0x1c19a5){return db['SquareDetailsReport'][_0x3d98('0x4e')]({'where':{'id':_0x500272[_0x3d98('0x4d')]['id']}})[_0x3d98('0x2a')](handleEntityNotFound(_0x1c19a5,null))['then'](removeEntity(_0x1c19a5,null))[_0x3d98('0x4b')](handleError(_0x1c19a5,null));};exports[_0x3d98('0x51')]=function(_0x54c171,_0x11b16f){return db[_0x3d98('0x31')]['describe']()[_0x3d98('0x2a')](respondWithResult(_0x11b16f,null))[_0x3d98('0x4b')](handleError(_0x11b16f,null));}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.model.js b/server/api/squareReportDetail/squareReportDetail.model.js index 55b670c..07e4297 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 _0xdc11=['exports','define','SquareDetailsReport','report_square_details','lodash','util','../../config/logger','api','bluebird','request-promise','path','rimraf','../../config/environment'];(function(_0x38013a,_0x52b537){var _0x503db5=function(_0xc1b809){while(--_0xc1b809){_0x38013a['push'](_0x38013a['shift']());}};_0x503db5(++_0x52b537);}(_0xdc11,0x1a4));var _0x1dc1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xdc11[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1dc1('0x0'));var util=require(_0x1dc1('0x1'));var logger=require(_0x1dc1('0x2'))(_0x1dc1('0x3'));var moment=require('moment');var BPromise=require(_0x1dc1('0x4'));var rp=require(_0x1dc1('0x5'));var fs=require('fs');var path=require(_0x1dc1('0x6'));var rimraf=require(_0x1dc1('0x7'));var config=require(_0x1dc1('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0x1dc1('0x9')]=function(_0x1bea19,_0x543694){return _0x1bea19[_0x1dc1('0xa')](_0x1dc1('0xb'),attributes,{'tableName':_0x1dc1('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb4e5=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','SquareDetailsReport','lodash','../../config/logger','api','moment'];(function(_0x497781,_0x414f14){var _0x40ba8e=function(_0x527562){while(--_0x527562){_0x497781['push'](_0x497781['shift']());}};_0x40ba8e(++_0x414f14);}(_0xb4e5,0x104));var _0x5b4e=function(_0x41938e,_0x91c6e0){_0x41938e=_0x41938e-0x0;var _0x3403d6=_0xb4e5[_0x41938e];return _0x3403d6;};'use strict';var _=require(_0x5b4e('0x0'));var util=require('util');var logger=require(_0x5b4e('0x1'))(_0x5b4e('0x2'));var moment=require(_0x5b4e('0x3'));var BPromise=require(_0x5b4e('0x4'));var rp=require(_0x5b4e('0x5'));var fs=require('fs');var path=require(_0x5b4e('0x6'));var rimraf=require(_0x5b4e('0x7'));var config=require(_0x5b4e('0x8'));var attributes=require('./squareReportDetail.attributes');module[_0x5b4e('0x9')]=function(_0x5875ef,_0x5d5f1e){return _0x5875ef[_0x5b4e('0xa')](_0x5b4e('0xb'),attributes,{'tableName':'report_square_details','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/squareReportDetail/squareReportDetail.rpc.js b/server/api/squareReportDetail/squareReportDetail.rpc.js index e3cfa21..2cba907 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 _0xda2d=['bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','client','http','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','debug','SquareDetailsReport,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','CreateSquareDetailsReport','SquareDetailsReport','create','body','options','raw','util','moment'];(function(_0x4e41a6,_0xb252d){var _0x401bc5=function(_0x4a2881){while(--_0x4a2881){_0x4e41a6['push'](_0x4e41a6['shift']());}};_0x401bc5(++_0xb252d);}(_0xda2d,0x102));var _0xdda2=function(_0x4bcc73,_0x1e19e8){_0x4bcc73=_0x4bcc73-0x0;var _0x79ace4=_0xda2d[_0x4bcc73];return _0x79ace4;};'use strict';var _=require('lodash');var util=require(_0xdda2('0x0'));var moment=require(_0xdda2('0x1'));var BPromise=require(_0xdda2('0x2'));var rs=require(_0xdda2('0x3'));var fs=require('fs');var Redis=require(_0xdda2('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xdda2('0x5'));var config=require(_0xdda2('0x6'));var jayson=require(_0xdda2('0x7'));var client=jayson[_0xdda2('0x8')][_0xdda2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xf38e58,_0x2f55dc,_0x436676){return new BPromise(function(_0x2e2523,_0x341c7b){return client['request'](_0xf38e58,_0x436676)[_0xdda2('0xa')](function(_0x22c6e5){logger['info'](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));logger[_0xdda2('0xd')](_0xdda2('0xe'),_0x2f55dc,_0xdda2('0xc'),JSON[_0xdda2('0xf')](_0x22c6e5));if(_0x22c6e5[_0xdda2('0x10')]){if(_0x22c6e5[_0xdda2('0x10')]['code']===0x1f4){logger['error']('SquareDetailsReport,\x20%s,\x20%s',_0x2f55dc,_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);return _0x341c7b(_0x22c6e5[_0xdda2('0x10')][_0xdda2('0x11')]);}logger[_0xdda2('0x10')](_0xdda2('0xb'),_0x2f55dc,_0x22c6e5[_0xdda2('0x10')]['message']);return _0x2e2523(_0x22c6e5[_0xdda2('0x10')]['message']);}else{logger[_0xdda2('0x12')](_0xdda2('0xb'),_0x2f55dc,_0xdda2('0xc'));_0x2e2523(_0x22c6e5[_0xdda2('0x13')][_0xdda2('0x11')]);}})['catch'](function(_0x55d674){logger[_0xdda2('0x10')]('SquareDetailsReport,\x20%s,\x20%s',_0x2f55dc,_0x55d674);_0x341c7b(_0x55d674);});});}exports[_0xdda2('0x14')]=function(_0x1a3b35){var _0x335fb5=this;return new Promise(function(_0x2b6ee8,_0x8d44b7){return db[_0xdda2('0x15')][_0xdda2('0x16')](_0x1a3b35[_0xdda2('0x17')],{'raw':_0x1a3b35[_0xdda2('0x18')]?_0x1a3b35[_0xdda2('0x18')][_0xdda2('0x19')]===undefined?!![]:![]:!![]})[_0xdda2('0xa')](function(_0x4eed30){logger[_0xdda2('0x12')]('CreateSquareDetailsReport',_0x1a3b35);logger[_0xdda2('0xd')](_0xdda2('0x14'),_0x1a3b35,JSON[_0xdda2('0xf')](_0x4eed30));_0x2b6ee8(_0x4eed30);})['catch'](function(_0x347ee6){logger['error'](_0xdda2('0x14'),_0x347ee6[_0xdda2('0x11')],_0x1a3b35);_0x8d44b7(_0x335fb5['error'](0x1f4,_0x347ee6[_0xdda2('0x11')]));});});}; \ No newline at end of file +var _0x8603=['util','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client','http','then','SquareDetailsReport,\x20%s,\x20%s','request\x20sent','SquareDetailsReport,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateSquareDetailsReport','SquareDetailsReport','create','options','raw','debug','stringify'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x8603,0x190));var _0x3860=function(_0x40d73d,_0x107d1a){_0x40d73d=_0x40d73d-0x0;var _0x1e7882=_0x8603[_0x40d73d];return _0x1e7882;};'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);});});}exports[_0x3860('0x12')]=function(_0x45b799){var _0x4b6b15=this;return new Promise(function(_0x4863bd,_0x373b06){return db[_0x3860('0x13')][_0x3860('0x14')](_0x45b799['body'],{'raw':_0x45b799[_0x3860('0x15')]?_0x45b799[_0x3860('0x15')][_0x3860('0x16')]===undefined?!![]:![]:!![]})[_0x3860('0x9')](function(_0x20a5b0){logger[_0x3860('0xf')](_0x3860('0x12'),_0x45b799);logger[_0x3860('0x17')](_0x3860('0x12'),_0x45b799,JSON[_0x3860('0x18')](_0x20a5b0));_0x4863bd(_0x20a5b0);})[_0x3860('0x11')](function(_0x2e0b6e){logger[_0x3860('0xd')](_0x3860('0x12'),_0x2e0b6e[_0x3860('0xe')],_0x45b799);_0x373b06(_0x4b6b15['error'](0x1f4,_0x2e0b6e[_0x3860('0xe')]));});});}; \ No newline at end of file diff --git a/server/api/system/index.js b/server/api/system/index.js index 34d1997..0c15123 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 _0xc1cc=['/process/:pid/kill','exports','Router','../../components/auth/service','./system.controller','get','isAuthenticated','index'];(function(_0x218391,_0x5f3c5a){var _0x320f1=function(_0x314b23){while(--_0x314b23){_0x218391['push'](_0x218391['shift']());}};_0x320f1(++_0x5f3c5a);}(_0xc1cc,0x16a));var _0xcc1c=function(_0x3c56cf,_0x5892f4){_0x3c56cf=_0x3c56cf-0x0;var _0x26bdba=_0xc1cc[_0x3c56cf];return _0x26bdba;};'use strict';var express=require('express');var router=express[_0xcc1c('0x0')]();var auth=require(_0xcc1c('0x1'));var controller=require(_0xcc1c('0x2'));router[_0xcc1c('0x3')]('/',auth[_0xcc1c('0x4')](),controller[_0xcc1c('0x5')]);router['get'](_0xcc1c('0x6'),auth[_0xcc1c('0x4')](),controller['killProcess']);module[_0xcc1c('0x7')]=router; \ No newline at end of file +var _0x565c=['killProcess','exports','express','Router','./system.controller','get','index','/process/:pid/kill','isAuthenticated'];(function(_0x391c55,_0x168617){var _0xa434e0=function(_0x51fa5c){while(--_0x51fa5c){_0x391c55['push'](_0x391c55['shift']());}};_0xa434e0(++_0x168617);}(_0x565c,0x110));var _0xc565=function(_0x527e11,_0x493b1a){_0x527e11=_0x527e11-0x0;var _0x3edc6c=_0x565c[_0x527e11];return _0x3edc6c;};'use strict';var express=require(_0xc565('0x0'));var router=express[_0xc565('0x1')]();var auth=require('../../components/auth/service');var controller=require(_0xc565('0x2'));router[_0xc565('0x3')]('/',auth['isAuthenticated'](),controller[_0xc565('0x4')]);router['get'](_0xc565('0x5'),auth[_0xc565('0x6')](),controller[_0xc565('0x7')]);module[_0xc565('0x8')]=router; \ No newline at end of file diff --git a/server/api/system/system.controller.js b/server/api/system/system.controller.js index 6b2aa91..56cbe9b 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 _0x455a=['bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name','status','send','then','json','catch','killProcess','components/import/cm','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','pid','split','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','kill','systeminformation','exec','../../config/logger','api','util'];(function(_0x43b06b,_0x1929c7){var _0x2c555b=function(_0x30fa8c){while(--_0x30fa8c){_0x43b06b['push'](_0x43b06b['shift']());}};_0x2c555b(++_0x1929c7);}(_0x455a,0x124));var _0xa455=function(_0x26a0d4,_0x4e402e){_0x26a0d4=_0x26a0d4-0x0;var _0x2302e6=_0x455a[_0x26a0d4];return _0x2302e6;};'use strict';var info=require(_0xa455('0x0'));var exec=require('child_process')[_0xa455('0x1')];var logger=require(_0xa455('0x2'))(_0xa455('0x3'));var util=require(_0xa455('0x4'));var BPromise=require(_0xa455('0x5'));var _=require(_0xa455('0x6'));function handleError(_0x11a03c,_0x2e9891,_0xe6dbbe){_0x2e9891=_0x2e9891||0x1f4;return function(_0x28c87f){logger[_0xa455('0x7')](_0xa455('0x8'),_0xe6dbbe,_0x2e9891,util[_0xa455('0x9')](_0x28c87f,{'showHidden':![],'depth':null}));delete _0x28c87f[_0xa455('0xa')];_0x11a03c[_0xa455('0xb')](_0x2e9891)[_0xa455('0xc')](_0x28c87f);};}exports['index']=function(_0x15c4b1,_0x1c7b6c){return info['getAllData']()[_0xa455('0xd')](function(_0x26324c){return _0x1c7b6c[_0xa455('0xb')](0xc8)[_0xa455('0xe')](_0x26324c);})[_0xa455('0xf')](function(_0x1a7f1d){return _0x1c7b6c[_0xa455('0xb')](0x1f4)[_0xa455('0xe')](_0x1a7f1d);});};exports[_0xa455('0x10')]=function(_0x2321bc,_0x4a9632){var _0x551f08=[_0xa455('0x11')];return new BPromise(function(_0x119553,_0x27bdc4){return exec(util[_0xa455('0x12')](_0xa455('0x13'),_0x2321bc[_0xa455('0x14')][_0xa455('0x15')]),function(_0xd5f003,_0x11b86f,_0x210e30){if(_0xd5f003){return _0x27bdc4(_0xd5f003);}return _0x119553(_0x11b86f);});})['then'](function(_0x192a7b){var _0x26967c=![];var _0x1dafea=_0x192a7b[_0xa455('0x16')](/\n/);for(var _0x4a14dd=0x0,_0x3d6ca3=_0x551f08[_0xa455('0x17')];_0x4a14dd<_0x3d6ca3,_0x26967c===![];_0x4a14dd+=0x1){if(_0x192a7b[_0xa455('0x18')](_0x551f08[_0x4a14dd])>=0x0){_0x26967c=!![];}}if(!_0x26967c){throw new Error(util['format'](_0xa455('0x19'),_0x2321bc[_0xa455('0x14')]['pid']));}process[_0xa455('0x1a')](_0x2321bc[_0xa455('0x14')][_0xa455('0x15')],'SIGINT');return _0x4a9632[_0xa455('0xb')](0xc8)[_0xa455('0xe')]({'message':util['format']('Process\x20with\x20pid\x20%s\x20killed\x20correctly',_0x2321bc[_0xa455('0x14')][_0xa455('0x15')])});})['catch'](handleError(_0x4a9632,null,'killProcess'));}; \ No newline at end of file +var _0xa3f9=['status','index','json','catch','killProcess','format','ps\x20-p\x20%s\x20-ww\x20-o\x20args','params','length','indexOf','Process\x20with\x20pid\x20%s\x20not\x20found!','pid','kill','SIGINT','Process\x20with\x20pid\x20%s\x20killed\x20correctly','../../config/logger','bluebird','lodash','error','<%-\x20name\x20%>,\x20%s,\x20%s,\x20%s','inspect','name'];(function(_0xa51ba0,_0x3bf58d){var _0x17f343=function(_0x149d7a){while(--_0x149d7a){_0xa51ba0['push'](_0xa51ba0['shift']());}};_0x17f343(++_0x3bf58d);}(_0xa3f9,0x1f3));var _0x9a3f=function(_0x58ffd3,_0x3f0515){_0x58ffd3=_0x58ffd3-0x0;var _0x8b45d5=_0xa3f9[_0x58ffd3];return _0x8b45d5;};'use strict';var info=require('systeminformation');var exec=require('child_process')['exec'];var logger=require(_0x9a3f('0x0'))('api');var util=require('util');var BPromise=require(_0x9a3f('0x1'));var _=require(_0x9a3f('0x2'));function handleError(_0x4981f6,_0x4cbd8c,_0xd3f36b){_0x4cbd8c=_0x4cbd8c||0x1f4;return function(_0x54cb89){logger[_0x9a3f('0x3')](_0x9a3f('0x4'),_0xd3f36b,_0x4cbd8c,util[_0x9a3f('0x5')](_0x54cb89,{'showHidden':![],'depth':null}));delete _0x54cb89[_0x9a3f('0x6')];_0x4981f6[_0x9a3f('0x7')](_0x4cbd8c)['send'](_0x54cb89);};}exports[_0x9a3f('0x8')]=function(_0xf29334,_0x4036ee){return info['getAllData']()['then'](function(_0x4ab10b){return _0x4036ee[_0x9a3f('0x7')](0xc8)[_0x9a3f('0x9')](_0x4ab10b);})[_0x9a3f('0xa')](function(_0x2d6e39){return _0x4036ee[_0x9a3f('0x7')](0x1f4)[_0x9a3f('0x9')](_0x2d6e39);});};exports[_0x9a3f('0xb')]=function(_0xa5e330,_0x32e43d){var _0x3eca29=['components/import/cm'];return new BPromise(function(_0x6d48c9,_0x3d9be6){return exec(util[_0x9a3f('0xc')](_0x9a3f('0xd'),_0xa5e330[_0x9a3f('0xe')]['pid']),function(_0x4a1664,_0x241214,_0x59c50b){if(_0x4a1664){return _0x3d9be6(_0x4a1664);}return _0x6d48c9(_0x241214);});})['then'](function(_0x36a899){var _0x28bbe3=![];var _0x3f54a3=_0x36a899['split'](/\n/);for(var _0x5691a2=0x0,_0x2137d3=_0x3eca29[_0x9a3f('0xf')];_0x5691a2<_0x2137d3,_0x28bbe3===![];_0x5691a2+=0x1){if(_0x36a899[_0x9a3f('0x10')](_0x3eca29[_0x5691a2])>=0x0){_0x28bbe3=!![];}}if(!_0x28bbe3){throw new Error(util[_0x9a3f('0xc')](_0x9a3f('0x11'),_0xa5e330[_0x9a3f('0xe')][_0x9a3f('0x12')]));}process[_0x9a3f('0x13')](_0xa5e330[_0x9a3f('0xe')]['pid'],_0x9a3f('0x14'));return _0x32e43d[_0x9a3f('0x7')](0xc8)[_0x9a3f('0x9')]({'message':util[_0x9a3f('0xc')](_0x9a3f('0x15'),_0xa5e330[_0x9a3f('0xe')][_0x9a3f('0x12')])});})[_0x9a3f('0xa')](handleError(_0x32e43d,null,_0x9a3f('0xb')));}; \ No newline at end of file diff --git a/server/api/tag/index.js b/server/api/tag/index.js index f054284..cd69075 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 _0x7b37=['/:id','post','put','update','delete','destroy','multer','util','path','express','../../components/interaction/service','../../config/environment','./tag.controller','get','isAuthenticated','index'];(function(_0x4627c8,_0x259f2f){var _0x42eed8=function(_0xadf14b){while(--_0xadf14b){_0x4627c8['push'](_0x4627c8['shift']());}};_0x42eed8(++_0x259f2f);}(_0x7b37,0xf6));var _0x77b3=function(_0x4d82ea,_0x4d459f){_0x4d82ea=_0x4d82ea-0x0;var _0x257f4a=_0x7b37[_0x4d82ea];return _0x257f4a;};'use strict';var multer=require(_0x77b3('0x0'));var util=require(_0x77b3('0x1'));var path=require(_0x77b3('0x2'));var timeout=require('connect-timeout');var express=require(_0x77b3('0x3'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x77b3('0x4'));var config=require(_0x77b3('0x5'));var controller=require(_0x77b3('0x6'));router[_0x77b3('0x7')]('/',auth[_0x77b3('0x8')](),controller[_0x77b3('0x9')]);router['get'](_0x77b3('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x77b3('0xb')]('/',auth[_0x77b3('0x8')](),controller['create']);router[_0x77b3('0xc')](_0x77b3('0xa'),auth[_0x77b3('0x8')](),controller[_0x77b3('0xd')]);router[_0x77b3('0xe')](_0x77b3('0xa'),auth[_0x77b3('0x8')](),controller[_0x77b3('0xf')]);module['exports']=router; \ No newline at end of file +var _0xd948=['put','update','destroy','exports','path','Router','fs-extra','../../config/environment','get','isAuthenticated','index','/:id','show','create'];(function(_0x42b449,_0x185e15){var _0x409327=function(_0x443ad7){while(--_0x443ad7){_0x42b449['push'](_0x42b449['shift']());}};_0x409327(++_0x185e15);}(_0xd948,0x12a));var _0x8d94=function(_0x38695d,_0x457252){_0x38695d=_0x38695d-0x0;var _0x1679be=_0xd948[_0x38695d];return _0x1679be;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x8d94('0x0'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x8d94('0x1')]();var fs_extra=require(_0x8d94('0x2'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x8d94('0x3'));var controller=require('./tag.controller');router[_0x8d94('0x4')]('/',auth[_0x8d94('0x5')](),controller[_0x8d94('0x6')]);router[_0x8d94('0x4')](_0x8d94('0x7'),auth['isAuthenticated'](),controller[_0x8d94('0x8')]);router['post']('/',auth[_0x8d94('0x5')](),controller[_0x8d94('0x9')]);router[_0x8d94('0xa')]('/:id',auth['isAuthenticated'](),controller[_0x8d94('0xb')]);router['delete'](_0x8d94('0x7'),auth[_0x8d94('0x5')](),controller[_0x8d94('0xc')]);module[_0x8d94('0xd')]=router; \ No newline at end of file diff --git a/server/api/tag/tag.attributes.js b/server/api/tag/tag.attributes.js index f683223..07a2a4b 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 _0x4fc2=['STRING','name','#0091EA','sequelize','exports'];(function(_0x3d3b05,_0x334c57){var _0x2c6ca3=function(_0x3fd1cc){while(--_0x3fd1cc){_0x3d3b05['push'](_0x3d3b05['shift']());}};_0x2c6ca3(++_0x334c57);}(_0x4fc2,0x111));var _0x24fc=function(_0x12553b,_0x5a9b35){_0x12553b=_0x12553b-0x0;var _0x86a99a=_0x4fc2[_0x12553b];return _0x86a99a;};'use strict';var Sequelize=require(_0x24fc('0x0'));module[_0x24fc('0x1')]={'name':{'type':Sequelize[_0x24fc('0x2')],'unique':_0x24fc('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x24fc('0x4')},'description':{'type':Sequelize[_0x24fc('0x2')]}}; \ No newline at end of file +var _0x7117=['name','#0091EA','sequelize','exports','STRING'];(function(_0x48df6e,_0xd49de5){var _0x2f9610=function(_0x658b9f){while(--_0x658b9f){_0x48df6e['push'](_0x48df6e['shift']());}};_0x2f9610(++_0xd49de5);}(_0x7117,0x1ec));var _0x7711=function(_0x2c1d94,_0x1065c5){_0x2c1d94=_0x2c1d94-0x0;var _0x3586d8=_0x7117[_0x2c1d94];return _0x3586d8;};'use strict';var Sequelize=require(_0x7711('0x0'));module[_0x7711('0x1')]={'name':{'type':Sequelize[_0x7711('0x2')],'unique':_0x7711('0x3'),'allowNull':![],'validate':{'is':/[A-Za-z0-9._\\+*!-]+/,'notEmpty':!![]}},'color':{'type':Sequelize['STRING'],'defaultValue':_0x7711('0x4')},'description':{'type':Sequelize[_0x7711('0x2')]}}; \ No newline at end of file diff --git a/server/api/tag/tag.controller.js b/server/api/tag/tag.controller.js index 278f18e..b3f54ca 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 _0x74f0=['rimraf','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','offset','undefined','limit','count','Content-Range','apply','reject','save','update','then','destroy','UserProfileResource','error','stack','name','index','map','Tag','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','options','includeAll','include','findAll','show','params','merge','catch','create','body','user','get','role','Tags','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find'];(function(_0x3f25b2,_0x412bd4){var _0xd8caeb=function(_0x52d252){while(--_0x52d252){_0x3f25b2['push'](_0x3f25b2['shift']());}};_0xd8caeb(++_0x412bd4);}(_0x74f0,0xf3));var _0x074f=function(_0x140202,_0x4245c7){_0x140202=_0x140202-0x0;var _0x3037c2=_0x74f0[_0x140202];return _0x3037c2;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x074f('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x074f('0x1'));var moment=require(_0x074f('0x2'));var BPromise=require(_0x074f('0x3'));var Mustache=require(_0x074f('0x4'));var util=require('util');var path=require('path');var sox=require(_0x074f('0x5'));var csv=require(_0x074f('0x6'));var ejs=require(_0x074f('0x7'));var fs=require('fs');var fs_extra=require(_0x074f('0x8'));var _=require(_0x074f('0x9'));var squel=require(_0x074f('0xa'));var crypto=require(_0x074f('0xb'));var jsforce=require('jsforce');var deskjs=require(_0x074f('0xc'));var toCsv=require(_0x074f('0x6'));var querystring=require('querystring');var Papa=require(_0x074f('0xd'));var Redis=require(_0x074f('0xe'));var authService=require(_0x074f('0xf'));var qs=require(_0x074f('0x10'));var as=require(_0x074f('0x11'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x074f('0x12'));var utils=require(_0x074f('0x13'));var config=require(_0x074f('0x14'));var licenseUtil=require(_0x074f('0x15'));var db=require(_0x074f('0x16'))['db'];function respondWithStatusCode(_0x2416e0,_0x1d3304){_0x1d3304=_0x1d3304||0xcc;return function(_0x46cea0){if(_0x46cea0){return _0x2416e0[_0x074f('0x17')](_0x1d3304);}return _0x2416e0['status'](_0x1d3304)[_0x074f('0x18')]();};}function respondWithResult(_0x59f78a,_0x12ed92){_0x12ed92=_0x12ed92||0xc8;return function(_0x3bf07f){if(_0x3bf07f){return _0x59f78a[_0x074f('0x19')](_0x12ed92)[_0x074f('0x1a')](_0x3bf07f);}};}function respondWithFilteredResult(_0x2d7c55,_0x237960){return function(_0x7e19fe){if(_0x7e19fe){var _0x1edf9c=typeof _0x237960[_0x074f('0x1b')]===_0x074f('0x1c')&&typeof _0x237960[_0x074f('0x1d')]==='undefined';var _0x111e1f=_0x7e19fe[_0x074f('0x1e')];var _0x200e43=_0x1edf9c?0x0:_0x237960[_0x074f('0x1b')];var _0x315e7d=_0x1edf9c?_0x7e19fe[_0x074f('0x1e')]:_0x237960['offset']+_0x237960['limit'];var _0x1d241d;if(_0x315e7d>=_0x111e1f){_0x315e7d=_0x111e1f;_0x1d241d=0xc8;}else{_0x1d241d=0xce;}_0x2d7c55['status'](_0x1d241d);return _0x2d7c55['set'](_0x074f('0x1f'),_0x200e43+'-'+_0x315e7d+'/'+_0x111e1f)[_0x074f('0x1a')](_0x7e19fe);}return null;};}function patchUpdates(_0x1563f3){return function(_0x5feafd){try{jsonpatch[_0x074f('0x20')](_0x5feafd,_0x1563f3,!![]);}catch(_0x210221){return BPromise[_0x074f('0x21')](_0x210221);}return _0x5feafd[_0x074f('0x22')]();};}function saveUpdates(_0x1acf0a,_0x2c3b23){return function(_0x335170){if(_0x335170){return _0x335170[_0x074f('0x23')](_0x1acf0a)[_0x074f('0x24')](function(_0x2fc5b0){return _0x2fc5b0;});}return null;};}function removeEntity(_0x39e502,_0x1bd2c7){return function(_0xdfa2d8){if(_0xdfa2d8){return _0xdfa2d8[_0x074f('0x25')]()[_0x074f('0x24')](function(){var _0x8b8e98=_0xdfa2d8['get']({'plain':!![]});var _0x4ee6ac='Tags';return db[_0x074f('0x26')][_0x074f('0x25')]({'where':{'type':_0x4ee6ac,'resourceId':_0x8b8e98['id']}})[_0x074f('0x24')](function(){return _0xdfa2d8;});})[_0x074f('0x24')](function(){_0x39e502['status'](0xcc)[_0x074f('0x18')]();});}};}function handleEntityNotFound(_0x339370,_0x3fb202){return function(_0x312119){if(!_0x312119){_0x339370[_0x074f('0x17')](0x194);}return _0x312119;};}function handleError(_0xb9722a,_0x508db2){_0x508db2=_0x508db2||0x1f4;return function(_0x1bf574){logger[_0x074f('0x27')](_0x1bf574[_0x074f('0x28')]);if(_0x1bf574['name']){delete _0x1bf574[_0x074f('0x29')];}_0xb9722a['status'](_0x508db2)['send'](_0x1bf574);};}exports[_0x074f('0x2a')]=function(_0x4b540c,_0x4aa96f){var _0x214611={},_0x3d6bc1={},_0x177d53={'count':0x0,'rows':[]};var _0x5526b7=_[_0x074f('0x2b')](db[_0x074f('0x2c')][_0x074f('0x2d')],function(_0x50314d){return{'name':_0x50314d[_0x074f('0x2e')],'type':_0x50314d[_0x074f('0x2f')][_0x074f('0x30')]};});_0x3d6bc1[_0x074f('0x31')]=_[_0x074f('0x2b')](_0x5526b7,'name');_0x3d6bc1[_0x074f('0x32')]=_[_0x074f('0x33')](_0x4b540c['query']);_0x3d6bc1[_0x074f('0x34')]=_[_0x074f('0x35')](_0x3d6bc1[_0x074f('0x31')],_0x3d6bc1['query']);_0x214611[_0x074f('0x36')]=_[_0x074f('0x35')](_0x3d6bc1['model'],qs[_0x074f('0x37')](_0x4b540c[_0x074f('0x32')][_0x074f('0x37')]));_0x214611[_0x074f('0x36')]=_0x214611[_0x074f('0x36')][_0x074f('0x38')]?_0x214611[_0x074f('0x36')]:_0x3d6bc1[_0x074f('0x31')];if(!_0x4b540c[_0x074f('0x32')][_0x074f('0x39')]('nolimit')){_0x214611[_0x074f('0x1d')]=qs[_0x074f('0x1d')](_0x4b540c['query'][_0x074f('0x1d')]);_0x214611[_0x074f('0x1b')]=qs[_0x074f('0x1b')](_0x4b540c[_0x074f('0x32')][_0x074f('0x1b')]);}_0x214611[_0x074f('0x3a')]=qs[_0x074f('0x3b')](_0x4b540c['query'][_0x074f('0x3b')]);_0x214611[_0x074f('0x3c')]=qs[_0x074f('0x34')](_[_0x074f('0x3d')](_0x4b540c[_0x074f('0x32')],_0x3d6bc1[_0x074f('0x34')]),_0x5526b7);if(_0x4b540c['query'][_0x074f('0x3e')]){_0x214611[_0x074f('0x3c')]=_['merge'](_0x214611[_0x074f('0x3c')],{'$or':_[_0x074f('0x2b')](_0x5526b7,function(_0x61f8c9){if(_0x61f8c9['type']!=='VIRTUAL'){var _0x5f39e5={};_0x5f39e5[_0x61f8c9[_0x074f('0x29')]]={'$like':'%'+_0x4b540c[_0x074f('0x32')][_0x074f('0x3e')]+'%'};return _0x5f39e5;}})});}_0x214611=_['merge']({},_0x214611,_0x4b540c[_0x074f('0x3f')]);var _0x2a0340={'where':_0x214611['where']};return db[_0x074f('0x2c')][_0x074f('0x1e')](_0x2a0340)[_0x074f('0x24')](function(_0x46ca91){_0x177d53[_0x074f('0x1e')]=_0x46ca91;if(_0x4b540c[_0x074f('0x32')][_0x074f('0x40')]){_0x214611[_0x074f('0x41')]=[{'all':!![]}];}return db[_0x074f('0x2c')][_0x074f('0x42')](_0x214611);})['then'](function(_0x1bee97){_0x177d53['rows']=_0x1bee97;return _0x177d53;})[_0x074f('0x24')](respondWithFilteredResult(_0x4aa96f,_0x214611))['catch'](handleError(_0x4aa96f,null));};exports[_0x074f('0x43')]=function(_0x4c59ec,_0x1f70c5){var _0x4b9244={'raw':!![],'where':{'id':_0x4c59ec[_0x074f('0x44')]['id']}},_0x654e6e={};_0x654e6e[_0x074f('0x31')]=_[_0x074f('0x33')](db[_0x074f('0x2c')][_0x074f('0x2d')]);_0x654e6e[_0x074f('0x32')]=_['keys'](_0x4c59ec[_0x074f('0x32')]);_0x654e6e[_0x074f('0x34')]=_[_0x074f('0x35')](_0x654e6e[_0x074f('0x31')],_0x654e6e['query']);_0x4b9244[_0x074f('0x36')]=_['intersection'](_0x654e6e[_0x074f('0x31')],qs[_0x074f('0x37')](_0x4c59ec[_0x074f('0x32')]['fields']));_0x4b9244[_0x074f('0x36')]=_0x4b9244['attributes'][_0x074f('0x38')]?_0x4b9244[_0x074f('0x36')]:_0x654e6e['model'];if(_0x4c59ec[_0x074f('0x32')]['includeAll']){_0x4b9244[_0x074f('0x41')]=[{'all':!![]}];}_0x4b9244=_[_0x074f('0x45')]({},_0x4b9244,_0x4c59ec['options']);return db['Tag']['find'](_0x4b9244)['then'](handleEntityNotFound(_0x1f70c5,null))[_0x074f('0x24')](respondWithResult(_0x1f70c5,null))[_0x074f('0x46')](handleError(_0x1f70c5,null));};exports[_0x074f('0x47')]=function(_0xdd3709,_0x53b1e5){return db[_0x074f('0x2c')][_0x074f('0x47')](_0xdd3709[_0x074f('0x48')],{})[_0x074f('0x24')](function(_0xb66ad7){var _0x42ab64=_0xdd3709[_0x074f('0x49')][_0x074f('0x4a')]({'plain':!![]});if(!_0x42ab64)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x42ab64[_0x074f('0x4b')]===_0x074f('0x49')){var _0x2ff3ab=_0xb66ad7[_0x074f('0x4a')]({'plain':!![]});var _0x522777=_0x074f('0x4c');return db[_0x074f('0x4d')]['find']({'where':{'name':_0x522777,'userProfileId':_0x42ab64['userProfileId']},'raw':!![]})[_0x074f('0x24')](function(_0x423393){if(_0x423393&&_0x423393[_0x074f('0x4e')]===0x0){return db[_0x074f('0x26')]['create']({'name':_0x2ff3ab['name'],'resourceId':_0x2ff3ab['id'],'type':_0x423393[_0x074f('0x29')],'sectionId':_0x423393['id']},{})[_0x074f('0x24')](function(){return _0xb66ad7;});}else{return _0xb66ad7;}})[_0x074f('0x46')](function(_0x32684a){logger[_0x074f('0x27')](_0x074f('0x4f'),_0x32684a);throw _0x32684a;});}return _0xb66ad7;})[_0x074f('0x24')](respondWithResult(_0x53b1e5,0xc9))[_0x074f('0x46')](handleError(_0x53b1e5,null));};exports[_0x074f('0x23')]=function(_0x5bda95,_0x24d267){if(_0x5bda95[_0x074f('0x48')]['id']){delete _0x5bda95[_0x074f('0x48')]['id'];}return db[_0x074f('0x2c')][_0x074f('0x50')]({'where':{'id':_0x5bda95[_0x074f('0x44')]['id']}})['then'](handleEntityNotFound(_0x24d267,null))[_0x074f('0x24')](saveUpdates(_0x5bda95[_0x074f('0x48')],null))['then'](respondWithResult(_0x24d267,null))[_0x074f('0x46')](handleError(_0x24d267,null));};exports[_0x074f('0x25')]=function(_0x1096b3,_0x417fa1){return db[_0x074f('0x2c')][_0x074f('0x50')]({'where':{'id':_0x1096b3[_0x074f('0x44')]['id']}})[_0x074f('0x24')](handleEntityNotFound(_0x417fa1,null))[_0x074f('0x24')](removeEntity(_0x417fa1,null))[_0x074f('0x46')](handleError(_0x417fa1,null));}; \ No newline at end of file +var _0x6c76=['to-csv','ejs','lodash','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','set','apply','reject','save','then','destroy','get','Tags','UserProfileResource','error','name','send','index','map','Tag','rawAttributes','fieldName','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','type','VIRTUAL','filter','options','count','includeAll','include','rows','params','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','update','eml-format','rimraf','zip-dir','request-promise','moment','util','path'];(function(_0x36ed48,_0x1ee0d4){var _0x51c63a=function(_0x2d0a40){while(--_0x2d0a40){_0x36ed48['push'](_0x36ed48['shift']());}};_0x51c63a(++_0x1ee0d4);}(_0x6c76,0x184));var _0x66c7=function(_0x29c2bb,_0x1bde54){_0x29c2bb=_0x29c2bb-0x0;var _0x5446f1=_0x6c76[_0x29c2bb];return _0x5446f1;};'use strict';var emlformat=require(_0x66c7('0x0'));var rimraf=require(_0x66c7('0x1'));var zipdir=require(_0x66c7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0x66c7('0x3'));var moment=require(_0x66c7('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x66c7('0x5'));var path=require(_0x66c7('0x6'));var sox=require('sox');var csv=require(_0x66c7('0x7'));var ejs=require(_0x66c7('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x66c7('0x9'));var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x66c7('0xa'));var deskjs=require(_0x66c7('0xb'));var toCsv=require(_0x66c7('0x7'));var querystring=require('querystring');var Papa=require(_0x66c7('0xc'));var Redis=require(_0x66c7('0xd'));var authService=require(_0x66c7('0xe'));var qs=require(_0x66c7('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x66c7('0x10'));var logger=require(_0x66c7('0x11'))(_0x66c7('0x12'));var utils=require(_0x66c7('0x13'));var config=require(_0x66c7('0x14'));var licenseUtil=require(_0x66c7('0x15'));var db=require(_0x66c7('0x16'))['db'];function respondWithStatusCode(_0x5176a3,_0x18c309){_0x18c309=_0x18c309||0xcc;return function(_0x760e36){if(_0x760e36){return _0x5176a3[_0x66c7('0x17')](_0x18c309);}return _0x5176a3[_0x66c7('0x18')](_0x18c309)[_0x66c7('0x19')]();};}function respondWithResult(_0x1e91d1,_0x618bd7){_0x618bd7=_0x618bd7||0xc8;return function(_0xf3b04){if(_0xf3b04){return _0x1e91d1[_0x66c7('0x18')](_0x618bd7)['json'](_0xf3b04);}};}function respondWithFilteredResult(_0x110f6d,_0x4dd902){return function(_0x208010){if(_0x208010){var _0x39f951=typeof _0x4dd902[_0x66c7('0x1a')]===_0x66c7('0x1b')&&typeof _0x4dd902[_0x66c7('0x1c')]==='undefined';var _0x5cf913=_0x208010['count'];var _0x5129f6=_0x39f951?0x0:_0x4dd902[_0x66c7('0x1a')];var _0x19f29d=_0x39f951?_0x208010['count']:_0x4dd902['offset']+_0x4dd902[_0x66c7('0x1c')];var _0x9b65cf;if(_0x19f29d>=_0x5cf913){_0x19f29d=_0x5cf913;_0x9b65cf=0xc8;}else{_0x9b65cf=0xce;}_0x110f6d[_0x66c7('0x18')](_0x9b65cf);return _0x110f6d[_0x66c7('0x1d')]('Content-Range',_0x5129f6+'-'+_0x19f29d+'/'+_0x5cf913)['json'](_0x208010);}return null;};}function patchUpdates(_0x1853b2){return function(_0x237177){try{jsonpatch[_0x66c7('0x1e')](_0x237177,_0x1853b2,!![]);}catch(_0x1c43c4){return BPromise[_0x66c7('0x1f')](_0x1c43c4);}return _0x237177[_0x66c7('0x20')]();};}function saveUpdates(_0x4804cf,_0x4ddbd2){return function(_0x366e9b){if(_0x366e9b){return _0x366e9b['update'](_0x4804cf)[_0x66c7('0x21')](function(_0x8b96b1){return _0x8b96b1;});}return null;};}function removeEntity(_0x44bdef,_0x1fc9d3){return function(_0x5bfaf6){if(_0x5bfaf6){return _0x5bfaf6[_0x66c7('0x22')]()[_0x66c7('0x21')](function(){var _0x5b28e6=_0x5bfaf6[_0x66c7('0x23')]({'plain':!![]});var _0x11a6b9=_0x66c7('0x24');return db[_0x66c7('0x25')][_0x66c7('0x22')]({'where':{'type':_0x11a6b9,'resourceId':_0x5b28e6['id']}})['then'](function(){return _0x5bfaf6;});})['then'](function(){_0x44bdef['status'](0xcc)[_0x66c7('0x19')]();});}};}function handleEntityNotFound(_0x542ff1,_0x5c5e42){return function(_0x9afd50){if(!_0x9afd50){_0x542ff1[_0x66c7('0x17')](0x194);}return _0x9afd50;};}function handleError(_0x205b7e,_0xb4b65b){_0xb4b65b=_0xb4b65b||0x1f4;return function(_0x36a830){logger[_0x66c7('0x26')](_0x36a830['stack']);if(_0x36a830[_0x66c7('0x27')]){delete _0x36a830[_0x66c7('0x27')];}_0x205b7e[_0x66c7('0x18')](_0xb4b65b)[_0x66c7('0x28')](_0x36a830);};}exports[_0x66c7('0x29')]=function(_0x592f0e,_0x263b48){var _0x4f1a34={},_0xfbd97={},_0x543fbf={'count':0x0,'rows':[]};var _0x296875=_[_0x66c7('0x2a')](db[_0x66c7('0x2b')][_0x66c7('0x2c')],function(_0xb26028){return{'name':_0xb26028[_0x66c7('0x2d')],'type':_0xb26028['type']['key']};});_0xfbd97[_0x66c7('0x2e')]=_[_0x66c7('0x2a')](_0x296875,_0x66c7('0x27'));_0xfbd97[_0x66c7('0x2f')]=_[_0x66c7('0x30')](_0x592f0e[_0x66c7('0x2f')]);_0xfbd97[_0x66c7('0x31')]=_[_0x66c7('0x32')](_0xfbd97[_0x66c7('0x2e')],_0xfbd97[_0x66c7('0x2f')]);_0x4f1a34[_0x66c7('0x33')]=_[_0x66c7('0x32')](_0xfbd97['model'],qs['fields'](_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x34')]));_0x4f1a34[_0x66c7('0x33')]=_0x4f1a34[_0x66c7('0x33')][_0x66c7('0x35')]?_0x4f1a34[_0x66c7('0x33')]:_0xfbd97[_0x66c7('0x2e')];if(!_0x592f0e['query'][_0x66c7('0x36')](_0x66c7('0x37'))){_0x4f1a34[_0x66c7('0x1c')]=qs[_0x66c7('0x1c')](_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x1c')]);_0x4f1a34[_0x66c7('0x1a')]=qs[_0x66c7('0x1a')](_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x1a')]);}_0x4f1a34[_0x66c7('0x38')]=qs['sort'](_0x592f0e['query'][_0x66c7('0x39')]);_0x4f1a34[_0x66c7('0x3a')]=qs[_0x66c7('0x31')](_['pick'](_0x592f0e['query'],_0xfbd97[_0x66c7('0x31')]),_0x296875);if(_0x592f0e[_0x66c7('0x2f')]['filter']){_0x4f1a34[_0x66c7('0x3a')]=_[_0x66c7('0x3b')](_0x4f1a34[_0x66c7('0x3a')],{'$or':_['map'](_0x296875,function(_0x20374a){if(_0x20374a[_0x66c7('0x3c')]!==_0x66c7('0x3d')){var _0x14d59c={};_0x14d59c[_0x20374a[_0x66c7('0x27')]]={'$like':'%'+_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x3e')]+'%'};return _0x14d59c;}})});}_0x4f1a34=_[_0x66c7('0x3b')]({},_0x4f1a34,_0x592f0e[_0x66c7('0x3f')]);var _0x5f34ed={'where':_0x4f1a34[_0x66c7('0x3a')]};return db[_0x66c7('0x2b')][_0x66c7('0x40')](_0x5f34ed)[_0x66c7('0x21')](function(_0x3f169e){_0x543fbf[_0x66c7('0x40')]=_0x3f169e;if(_0x592f0e[_0x66c7('0x2f')][_0x66c7('0x41')]){_0x4f1a34[_0x66c7('0x42')]=[{'all':!![]}];}return db[_0x66c7('0x2b')]['findAll'](_0x4f1a34);})['then'](function(_0x528f5c){_0x543fbf[_0x66c7('0x43')]=_0x528f5c;return _0x543fbf;})[_0x66c7('0x21')](respondWithFilteredResult(_0x263b48,_0x4f1a34))['catch'](handleError(_0x263b48,null));};exports['show']=function(_0x34d002,_0x3cd3ab){var _0x44d637={'raw':!![],'where':{'id':_0x34d002[_0x66c7('0x44')]['id']}},_0x900ee7={};_0x900ee7['model']=_[_0x66c7('0x30')](db['Tag']['rawAttributes']);_0x900ee7[_0x66c7('0x2f')]=_[_0x66c7('0x30')](_0x34d002[_0x66c7('0x2f')]);_0x900ee7[_0x66c7('0x31')]=_['intersection'](_0x900ee7['model'],_0x900ee7[_0x66c7('0x2f')]);_0x44d637['attributes']=_['intersection'](_0x900ee7[_0x66c7('0x2e')],qs[_0x66c7('0x34')](_0x34d002[_0x66c7('0x2f')][_0x66c7('0x34')]));_0x44d637['attributes']=_0x44d637[_0x66c7('0x33')][_0x66c7('0x35')]?_0x44d637[_0x66c7('0x33')]:_0x900ee7['model'];if(_0x34d002[_0x66c7('0x2f')][_0x66c7('0x41')]){_0x44d637[_0x66c7('0x42')]=[{'all':!![]}];}_0x44d637=_[_0x66c7('0x3b')]({},_0x44d637,_0x34d002[_0x66c7('0x3f')]);return db[_0x66c7('0x2b')][_0x66c7('0x45')](_0x44d637)[_0x66c7('0x21')](handleEntityNotFound(_0x3cd3ab,null))['then'](respondWithResult(_0x3cd3ab,null))[_0x66c7('0x46')](handleError(_0x3cd3ab,null));};exports[_0x66c7('0x47')]=function(_0x23d0eb,_0x1386a2){return db[_0x66c7('0x2b')][_0x66c7('0x47')](_0x23d0eb[_0x66c7('0x48')],{})[_0x66c7('0x21')](function(_0x1b3dc2){var _0x2d8eeb=_0x23d0eb[_0x66c7('0x49')][_0x66c7('0x23')]({'plain':!![]});if(!_0x2d8eeb)throw new Error(_0x66c7('0x4a'));if(_0x2d8eeb[_0x66c7('0x4b')]==='user'){var _0x43d4db=_0x1b3dc2[_0x66c7('0x23')]({'plain':!![]});var _0x27070b=_0x66c7('0x24');return db['UserProfileSection'][_0x66c7('0x45')]({'where':{'name':_0x27070b,'userProfileId':_0x2d8eeb[_0x66c7('0x4c')]},'raw':!![]})['then'](function(_0x275a20){if(_0x275a20&&_0x275a20[_0x66c7('0x4d')]===0x0){return db[_0x66c7('0x25')][_0x66c7('0x47')]({'name':_0x43d4db[_0x66c7('0x27')],'resourceId':_0x43d4db['id'],'type':_0x275a20[_0x66c7('0x27')],'sectionId':_0x275a20['id']},{})[_0x66c7('0x21')](function(){return _0x1b3dc2;});}else{return _0x1b3dc2;}})['catch'](function(_0x933dd6){logger[_0x66c7('0x26')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x933dd6);throw _0x933dd6;});}return _0x1b3dc2;})[_0x66c7('0x21')](respondWithResult(_0x1386a2,0xc9))[_0x66c7('0x46')](handleError(_0x1386a2,null));};exports[_0x66c7('0x4e')]=function(_0x5df6d1,_0x382a48){if(_0x5df6d1[_0x66c7('0x48')]['id']){delete _0x5df6d1[_0x66c7('0x48')]['id'];}return db[_0x66c7('0x2b')][_0x66c7('0x45')]({'where':{'id':_0x5df6d1[_0x66c7('0x44')]['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x382a48,null))[_0x66c7('0x21')](saveUpdates(_0x5df6d1['body'],null))[_0x66c7('0x21')](respondWithResult(_0x382a48,null))[_0x66c7('0x46')](handleError(_0x382a48,null));};exports['destroy']=function(_0x23f865,_0x167968){return db[_0x66c7('0x2b')]['find']({'where':{'id':_0x23f865['params']['id']}})[_0x66c7('0x21')](handleEntityNotFound(_0x167968,null))['then'](removeEntity(_0x167968,null))[_0x66c7('0x46')](handleError(_0x167968,null));}; \ No newline at end of file diff --git a/server/api/tag/tag.model.js b/server/api/tag/tag.model.js index e6ae2b7..faee82c 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 _0xb863=['util','../../config/logger','api','moment','request-promise','path','./tag.attributes','exports','define','tools_tags','lodash'];(function(_0x3e6c4f,_0x7cf4ee){var _0x2ccb13=function(_0x335818){while(--_0x335818){_0x3e6c4f['push'](_0x3e6c4f['shift']());}};_0x2ccb13(++_0x7cf4ee);}(_0xb863,0x11d));var _0x3b86=function(_0x1d1779,_0x284147){_0x1d1779=_0x1d1779-0x0;var _0x2377e9=_0xb863[_0x1d1779];return _0x2377e9;};'use strict';var _=require(_0x3b86('0x0'));var util=require(_0x3b86('0x1'));var logger=require(_0x3b86('0x2'))(_0x3b86('0x3'));var moment=require(_0x3b86('0x4'));var BPromise=require('bluebird');var rp=require(_0x3b86('0x5'));var fs=require('fs');var path=require(_0x3b86('0x6'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x3b86('0x7'));module[_0x3b86('0x8')]=function(_0x580daf,_0x48aa07){return _0x580daf[_0x3b86('0x9')]('Tag',attributes,{'tableName':_0x3b86('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x52e3=['rimraf','exports','Tag','tools_tags','util','../../config/logger','moment','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x52e3,0x11b));var _0x352e=function(_0x451317,_0x1c2c55){_0x451317=_0x451317-0x0;var _0x279a6e=_0x52e3[_0x451317];return _0x279a6e;};'use strict';var _=require('lodash');var util=require(_0x352e('0x0'));var logger=require(_0x352e('0x1'))('api');var moment=require(_0x352e('0x2'));var BPromise=require('bluebird');var rp=require(_0x352e('0x3'));var fs=require('fs');var path=require(_0x352e('0x4'));var rimraf=require(_0x352e('0x5'));var config=require('../../config/environment');var attributes=require('./tag.attributes');module[_0x352e('0x6')]=function(_0x56ab4c,_0x4ea737){return _0x56ab4c['define'](_0x352e('0x7'),attributes,{'tableName':_0x352e('0x8'),'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 a0ba627..081efd5 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 _0xfd28=['error','code','message','info','result','util','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','Tag,\x20%s,\x20%s','debug','request\x20sent'];(function(_0x25171a,_0x17dbba){var _0x149349=function(_0x1eca89){while(--_0x1eca89){_0x25171a['push'](_0x25171a['shift']());}};_0x149349(++_0x17dbba);}(_0xfd28,0x148));var _0x8fd2=function(_0x4d337e,_0x2f7eed){_0x4d337e=_0x4d337e-0x0;var _0x247963=_0xfd28[_0x4d337e];return _0x247963;};'use strict';var _=require('lodash');var util=require(_0x8fd2('0x0'));var moment=require(_0x8fd2('0x1'));var BPromise=require('bluebird');var rs=require(_0x8fd2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x8fd2('0x3'))['db'];var utils=require(_0x8fd2('0x4'));var logger=require(_0x8fd2('0x5'))('rpc');var config=require(_0x8fd2('0x6'));var jayson=require(_0x8fd2('0x7'));var client=jayson[_0x8fd2('0x8')][_0x8fd2('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2f0afc,_0x4bdc1a,_0x53d938){return new BPromise(function(_0x10fccf,_0x466c3d){return client[_0x8fd2('0xa')](_0x2f0afc,_0x53d938)['then'](function(_0x13cc69){logger['info'](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');logger[_0x8fd2('0xc')]('Tag,\x20%s,\x20%s,\x20%s',_0x4bdc1a,_0x8fd2('0xd'),JSON['stringify'](_0x13cc69));if(_0x13cc69[_0x8fd2('0xe')]){if(_0x13cc69['error'][_0x8fd2('0xf')]===0x1f4){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x466c3d(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);return _0x10fccf(_0x13cc69[_0x8fd2('0xe')][_0x8fd2('0x10')]);}else{logger[_0x8fd2('0x11')](_0x8fd2('0xb'),_0x4bdc1a,'request\x20sent');_0x10fccf(_0x13cc69[_0x8fd2('0x12')]['message']);}})['catch'](function(_0x56f75d){logger[_0x8fd2('0xe')](_0x8fd2('0xb'),_0x4bdc1a,_0x56f75d);_0x466c3d(_0x56f75d);});});} \ No newline at end of file +var _0xcb81=['lodash','util','bluebird','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','Tag,\x20%s,\x20%s','request\x20sent','debug','Tag,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch'];(function(_0x5b40c4,_0xf444e8){var _0x18f904=function(_0x14d44){while(--_0x14d44){_0x5b40c4['push'](_0x5b40c4['shift']());}};_0x18f904(++_0xf444e8);}(_0xcb81,0x154));var _0x1cb8=function(_0x43d16c,_0x2b5447){_0x43d16c=_0x43d16c-0x0;var _0x208cce=_0xcb81[_0x43d16c];return _0x208cce;};'use strict';var _=require(_0x1cb8('0x0'));var util=require(_0x1cb8('0x1'));var moment=require('moment');var BPromise=require(_0x1cb8('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x1cb8('0x3'));var logger=require(_0x1cb8('0x4'))(_0x1cb8('0x5'));var config=require(_0x1cb8('0x6'));var jayson=require(_0x1cb8('0x7'));var client=jayson['client'][_0x1cb8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2ac2d6,_0x584b16,_0x2408c2){return new BPromise(function(_0x39b4ad,_0x282fd8){return client['request'](_0x2ac2d6,_0x2408c2)[_0x1cb8('0x9')](function(_0x51dc9e){logger['info'](_0x1cb8('0xa'),_0x584b16,_0x1cb8('0xb'));logger[_0x1cb8('0xc')](_0x1cb8('0xd'),_0x584b16,_0x1cb8('0xb'),JSON[_0x1cb8('0xe')](_0x51dc9e));if(_0x51dc9e[_0x1cb8('0xf')]){if(_0x51dc9e[_0x1cb8('0xf')]['code']===0x1f4){logger[_0x1cb8('0xf')](_0x1cb8('0xa'),_0x584b16,_0x51dc9e[_0x1cb8('0xf')][_0x1cb8('0x10')]);return _0x282fd8(_0x51dc9e[_0x1cb8('0xf')]['message']);}logger[_0x1cb8('0xf')](_0x1cb8('0xa'),_0x584b16,_0x51dc9e[_0x1cb8('0xf')][_0x1cb8('0x10')]);return _0x39b4ad(_0x51dc9e[_0x1cb8('0xf')][_0x1cb8('0x10')]);}else{logger[_0x1cb8('0x11')](_0x1cb8('0xa'),_0x584b16,'request\x20sent');_0x39b4ad(_0x51dc9e[_0x1cb8('0x12')]['message']);}})[_0x1cb8('0x13')](function(_0x28b8ff){logger[_0x1cb8('0xf')](_0x1cb8('0xa'),_0x584b16,_0x28b8ff);_0x282fd8(_0x28b8ff);});});} \ No newline at end of file diff --git a/server/api/team/index.js b/server/api/team/index.js index 4bbc4a8..0dc8f49 100644 --- a/server/api/team/index.js +++ b/server/api/team/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0xa9e0[_0x5c3c0b];return _0x52ecd2;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file +var _0xa9e0=['Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./team.controller','get','index','/:id','getQueues','/:id/users','isAuthenticated','getAgents','post','addQueues','addAgents','update','delete','removeAgents','multer','util','path'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3054be,_0x1bdc8b){_0x3054be=_0x3054be-0x0;var _0x3df150=_0xa9e0[_0x3054be];return _0x3df150;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/queues',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0xf')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/queues',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0xf')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x11')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x12')]);router[_0x0a9e('0x13')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller['destroy']);router[_0x0a9e('0x13')]('/:id/queues',auth[_0x0a9e('0xd')](),controller['removeQueues']);router[_0x0a9e('0x13')](_0x0a9e('0xc'),auth['isAuthenticated'](),controller[_0x0a9e('0x14')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/team/team.attributes.js b/server/api/team/team.attributes.js index 9c6051a..74f8e63 100644 --- a/server/api/team/team.attributes.js +++ b/server/api/team/team.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['name','sequelize','STRING'];(function(_0x2098e7,_0x262646){var _0x474be9=function(_0x5b785f){while(--_0x5b785f){_0x2098e7['push'](_0x2098e7['shift']());}};_0x474be9(++_0x262646);}(_0xb10b,0x12a));var _0xbb10=function(_0x3a28e2,_0x58325a){_0x3a28e2=_0x3a28e2-0x0;var _0xfd325a=_0xb10b[_0x3a28e2];return _0xfd325a;};'use strict';var Sequelize=require(_0xbb10('0x0'));module['exports']={'name':{'type':Sequelize[_0xbb10('0x1')],'allowNull':![],'unique':_0xbb10('0x2')},'description':{'type':Sequelize[_0xbb10('0x1')]}}; \ No newline at end of file +var _0xd8b0=['exports','sequelize'];(function(_0x58ff0e,_0x120e5b){var _0x3724bd=function(_0x34ad73){while(--_0x34ad73){_0x58ff0e['push'](_0x58ff0e['shift']());}};_0x3724bd(++_0x120e5b);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':'name'},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/team/team.controller.js b/server/api/team/team.controller.js index 11236b2..1e308e1 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 _0x291a=['api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','offset','undefined','limit','count','set','Content-Range','json','apply','reject','update','then','error','stack','name','send','Team','rawAttributes','fieldName','type','key','model','map','query','keys','intersection','attributes','fields','order','sort','where','filters','pick','filter','merge','options','includeAll','include','findAll','catch','show','params','length','create','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','sequelize','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','Sequelize','QueryTypes','SELECT','UserId','VoiceQueueId','UserVoiceQueue','destroy','SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20','MailQueueId','UserMailQueue','SmsQueueId','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','UserFaxQueue','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams','end','getQueues','findOne','channel','isValidChannel','ValidationError','capitalize','toLowerCase','addQueues','Unknown\x20channel','add','Queues','ids','removeQueues','remove','isArray','Voice','Chat','Mail','Sms','Fax','Whatsapp','penalty','QueueId','TeamVoiceQueue','User','Queue','findOrCreate','emit','Queue:save','online','voicePause','interface','isNil','format','all','upsert','addAgents','spread','removeAgents','Openchannel','Queue:remove','UserVoiceQueueRt','getAgents','hasOwnProperty','nolimit','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','querystring','../../components/auth/service','../../components/parsers/qs','../../config/logger'];(function(_0x1a6967,_0x24dd5a){var _0xe571f9=function(_0x17cab3){while(--_0x17cab3){_0x1a6967['push'](_0x1a6967['shift']());}};_0xe571f9(++_0x24dd5a);}(_0x291a,0x123));var _0xa291=function(_0x3e26cf,_0x39943d){_0x3e26cf=_0x3e26cf-0x0;var _0x258d3c=_0x291a[_0x3e26cf];return _0x258d3c;};'use strict';var emlformat=require(_0xa291('0x0'));var rimraf=require(_0xa291('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xa291('0x2'));var moment=require(_0xa291('0x3'));var BPromise=require(_0xa291('0x4'));var Mustache=require(_0xa291('0x5'));var util=require(_0xa291('0x6'));var path=require('path');var sox=require(_0xa291('0x7'));var csv=require(_0xa291('0x8'));var ejs=require(_0xa291('0x9'));var fs=require('fs');var fs_extra=require(_0xa291('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require(_0xa291('0x8'));var querystring=require(_0xa291('0xb'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xa291('0xc'));var qs=require(_0xa291('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xa291('0xe'))(_0xa291('0xf'));var utils=require(_0xa291('0x10'));var config=require(_0xa291('0x11'));var licenseUtil=require('../../config/license/util');var db=require(_0xa291('0x12'))['db'];config[_0xa291('0x13')]=_[_0xa291('0x14')](config[_0xa291('0x13')],{'host':_0xa291('0x15'),'port':0x18eb});var socket=require(_0xa291('0x16'))(new Redis(config[_0xa291('0x13')]));require(_0xa291('0x17'))[_0xa291('0x18')](socket);function respondWithStatusCode(_0x2b4441,_0x352f9e){_0x352f9e=_0x352f9e||0xcc;return function(_0x53ebdd){if(_0x53ebdd){return _0x2b4441[_0xa291('0x19')](_0x352f9e);}return _0x2b4441[_0xa291('0x1a')](_0x352f9e)['end']();};}function respondWithResult(_0x333261,_0x5e9103){_0x5e9103=_0x5e9103||0xc8;return function(_0x533b50){if(_0x533b50){return _0x333261['status'](_0x5e9103)['json'](_0x533b50);}};}function respondWithFilteredResult(_0x471d09,_0x2ef48c){return function(_0x50fc16){if(_0x50fc16){var _0x50edc5=typeof _0x2ef48c[_0xa291('0x1b')]===_0xa291('0x1c')&&typeof _0x2ef48c[_0xa291('0x1d')]===_0xa291('0x1c');var _0x293a6e=_0x50fc16[_0xa291('0x1e')];var _0x397c2e=_0x50edc5?0x0:_0x2ef48c[_0xa291('0x1b')];var _0x5f3b7c=_0x50edc5?_0x50fc16[_0xa291('0x1e')]:_0x2ef48c[_0xa291('0x1b')]+_0x2ef48c['limit'];var _0x532cbb;if(_0x5f3b7c>=_0x293a6e){_0x5f3b7c=_0x293a6e;_0x532cbb=0xc8;}else{_0x532cbb=0xce;}_0x471d09[_0xa291('0x1a')](_0x532cbb);return _0x471d09[_0xa291('0x1f')](_0xa291('0x20'),_0x397c2e+'-'+_0x5f3b7c+'/'+_0x293a6e)[_0xa291('0x21')](_0x50fc16);}return null;};}function patchUpdates(_0x3fb45f){return function(_0x52c412){try{jsonpatch[_0xa291('0x22')](_0x52c412,_0x3fb45f,!![]);}catch(_0x5cb3ae){return BPromise[_0xa291('0x23')](_0x5cb3ae);}return _0x52c412['save']();};}function saveUpdates(_0x5f2db3,_0x2ed65f){return function(_0x2f56f5){if(_0x2f56f5){return _0x2f56f5[_0xa291('0x24')](_0x5f2db3)[_0xa291('0x25')](function(_0x1a24db){return _0x1a24db;});}return null;};}function handleEntityNotFound(_0x339875,_0x4885c6){return function(_0x52455a){if(!_0x52455a){_0x339875[_0xa291('0x19')](0x194);}return _0x52455a;};}function handleError(_0x18cc99,_0x28016e){_0x28016e=_0x28016e||0x1f4;return function(_0x3c4256){logger[_0xa291('0x26')](_0x3c4256[_0xa291('0x27')]);if(_0x3c4256[_0xa291('0x28')]){delete _0x3c4256[_0xa291('0x28')];}_0x18cc99['status'](_0x28016e)[_0xa291('0x29')](_0x3c4256);};}exports['index']=function(_0x2f13dc,_0x588789){var _0x3462da={},_0x5ef4cb={},_0x262585={'count':0x0,'rows':[]};var _0x402463=_['map'](db[_0xa291('0x2a')][_0xa291('0x2b')],function(_0x1304d5){return{'name':_0x1304d5[_0xa291('0x2c')],'type':_0x1304d5[_0xa291('0x2d')][_0xa291('0x2e')]};});_0x5ef4cb[_0xa291('0x2f')]=_[_0xa291('0x30')](_0x402463,_0xa291('0x28'));_0x5ef4cb[_0xa291('0x31')]=_[_0xa291('0x32')](_0x2f13dc['query']);_0x5ef4cb['filters']=_[_0xa291('0x33')](_0x5ef4cb[_0xa291('0x2f')],_0x5ef4cb[_0xa291('0x31')]);_0x3462da[_0xa291('0x34')]=_[_0xa291('0x33')](_0x5ef4cb[_0xa291('0x2f')],qs[_0xa291('0x35')](_0x2f13dc[_0xa291('0x31')][_0xa291('0x35')]));_0x3462da['attributes']=_0x3462da[_0xa291('0x34')]['length']?_0x3462da[_0xa291('0x34')]:_0x5ef4cb[_0xa291('0x2f')];if(!_0x2f13dc[_0xa291('0x31')]['hasOwnProperty']('nolimit')){_0x3462da[_0xa291('0x1d')]=qs[_0xa291('0x1d')](_0x2f13dc[_0xa291('0x31')][_0xa291('0x1d')]);_0x3462da[_0xa291('0x1b')]=qs[_0xa291('0x1b')](_0x2f13dc[_0xa291('0x31')]['offset']);}_0x3462da[_0xa291('0x36')]=qs['sort'](_0x2f13dc[_0xa291('0x31')][_0xa291('0x37')]);_0x3462da[_0xa291('0x38')]=qs[_0xa291('0x39')](_[_0xa291('0x3a')](_0x2f13dc[_0xa291('0x31')],_0x5ef4cb['filters']),_0x402463);if(_0x2f13dc[_0xa291('0x31')][_0xa291('0x3b')]){_0x3462da[_0xa291('0x38')]=_[_0xa291('0x3c')](_0x3462da[_0xa291('0x38')],{'$or':_[_0xa291('0x30')](_0x402463,function(_0x5c23c8){if(_0x5c23c8[_0xa291('0x2d')]!=='VIRTUAL'){var _0x4dd6dd={};_0x4dd6dd[_0x5c23c8[_0xa291('0x28')]]={'$like':'%'+_0x2f13dc[_0xa291('0x31')][_0xa291('0x3b')]+'%'};return _0x4dd6dd;}})});}_0x3462da=_[_0xa291('0x3c')]({},_0x3462da,_0x2f13dc[_0xa291('0x3d')]);var _0x24ba9b={'where':_0x3462da[_0xa291('0x38')]};return db['Team'][_0xa291('0x1e')](_0x24ba9b)[_0xa291('0x25')](function(_0xf5c420){_0x262585[_0xa291('0x1e')]=_0xf5c420;if(_0x2f13dc[_0xa291('0x31')][_0xa291('0x3e')]){_0x3462da[_0xa291('0x3f')]=[{'all':!![]}];}return db[_0xa291('0x2a')][_0xa291('0x40')](_0x3462da);})[_0xa291('0x25')](function(_0x25c382){_0x262585['rows']=_0x25c382;return _0x262585;})[_0xa291('0x25')](respondWithFilteredResult(_0x588789,_0x3462da))[_0xa291('0x41')](handleError(_0x588789,null));};exports[_0xa291('0x42')]=function(_0x11029b,_0x3f4b37){var _0x3a128a={'raw':![],'where':{'id':_0x11029b[_0xa291('0x43')]['id']}},_0xe5f5fa={};_0xe5f5fa[_0xa291('0x2f')]=_[_0xa291('0x32')](db[_0xa291('0x2a')][_0xa291('0x2b')]);_0xe5f5fa[_0xa291('0x31')]=_[_0xa291('0x32')](_0x11029b[_0xa291('0x31')]);_0xe5f5fa[_0xa291('0x39')]=_[_0xa291('0x33')](_0xe5f5fa[_0xa291('0x2f')],_0xe5f5fa[_0xa291('0x31')]);_0x3a128a[_0xa291('0x34')]=_[_0xa291('0x33')](_0xe5f5fa[_0xa291('0x2f')],qs[_0xa291('0x35')](_0x11029b[_0xa291('0x31')][_0xa291('0x35')]));_0x3a128a[_0xa291('0x34')]=_0x3a128a[_0xa291('0x34')][_0xa291('0x44')]?_0x3a128a[_0xa291('0x34')]:_0xe5f5fa[_0xa291('0x2f')];if(_0x11029b[_0xa291('0x31')][_0xa291('0x3e')]){_0x3a128a['include']=[{'all':!![]}];}_0x3a128a=_[_0xa291('0x3c')]({},_0x3a128a,_0x11029b[_0xa291('0x3d')]);return db[_0xa291('0x2a')]['find'](_0x3a128a)[_0xa291('0x25')](handleEntityNotFound(_0x3f4b37,null))[_0xa291('0x25')](respondWithResult(_0x3f4b37,null))['catch'](handleError(_0x3f4b37,null));};exports[_0xa291('0x45')]=function(_0xe1931e,_0x31ffcf){return db['Team'][_0xa291('0x45')](_0xe1931e['body'],{})[_0xa291('0x25')](function(_0x5a6904){var _0x5ef71e=_0xe1931e[_0xa291('0x46')][_0xa291('0x47')]({'plain':!![]});if(!_0x5ef71e)throw new Error(_0xa291('0x48'));if(_0x5ef71e[_0xa291('0x49')]===_0xa291('0x46')){var _0x5c9700=_0x5a6904[_0xa291('0x47')]({'plain':!![]});var _0x52a88e='Teams';return db[_0xa291('0x4a')][_0xa291('0x4b')]({'where':{'name':_0x52a88e,'userProfileId':_0x5ef71e['userProfileId']},'raw':!![]})[_0xa291('0x25')](function(_0x157421){if(_0x157421&&_0x157421[_0xa291('0x4c')]===0x0){return db['UserProfileResource'][_0xa291('0x45')]({'name':_0x5c9700[_0xa291('0x28')],'resourceId':_0x5c9700['id'],'type':_0x157421[_0xa291('0x28')],'sectionId':_0x157421['id']},{})[_0xa291('0x25')](function(){return _0x5a6904;});}else{return _0x5a6904;}})[_0xa291('0x41')](function(_0x13635a){logger['error'](_0xa291('0x4d'),_0x13635a);throw _0x13635a;});}return _0x5a6904;})[_0xa291('0x25')](respondWithResult(_0x31ffcf,0xc9))[_0xa291('0x41')](handleError(_0x31ffcf,null));};exports[_0xa291('0x24')]=function(_0x14a0af,_0x4a1011){if(_0x14a0af[_0xa291('0x4e')]['id']){delete _0x14a0af[_0xa291('0x4e')]['id'];}return db[_0xa291('0x2a')][_0xa291('0x4b')]({'where':{'id':_0x14a0af[_0xa291('0x43')]['id']}})['then'](handleEntityNotFound(_0x4a1011,null))['then'](saveUpdates(_0x14a0af[_0xa291('0x4e')],null))[_0xa291('0x25')](respondWithResult(_0x4a1011,null))[_0xa291('0x41')](handleError(_0x4a1011,null));};exports['destroy']=function(_0x26f013,_0x12fb0e){var _0x56fae3=_0x26f013[_0xa291('0x43')]['id'];var _0x51d3dd=[];return db[_0xa291('0x4f')][_0xa291('0x50')](function(_0x58094d){var _0x516881=_0xa291('0x51')+_0x56fae3;return db[_0xa291('0x4f')][_0xa291('0x31')](_0x516881,{'type':db[_0xa291('0x52')][_0xa291('0x53')][_0xa291('0x54')],'raw':!![],'transaction':_0x58094d})[_0xa291('0x25')](function(_0x32546f){_0x51d3dd=_[_0xa291('0x30')](_0x32546f,function(_0x5b7770){return Number(_0x5b7770[_0xa291('0x55')]);});})['then'](function(){var _0x11769c='SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20'+_0x56fae3;return db['sequelize'][_0xa291('0x31')](_0x11769c,{'type':db[_0xa291('0x52')][_0xa291('0x53')][_0xa291('0x54')],'raw':!![],'transaction':_0x58094d});})[_0xa291('0x25')](function(_0x49f6e9){var _0x4d2aa8=_[_0xa291('0x30')](_0x49f6e9,function(_0x54f22b){return Number(_0x54f22b[_0xa291('0x56')]);});return db[_0xa291('0x57')][_0xa291('0x58')]({'where':{'UserId':{'$in':_0x51d3dd},'VoiceQueueId':{'$in':_0x4d2aa8}},'transaction':_0x58094d});})[_0xa291('0x25')](function(){var _0x43cd0f=_0xa291('0x59')+_0x56fae3;return db[_0xa291('0x4f')][_0xa291('0x31')](_0x43cd0f,{'type':db['Sequelize'][_0xa291('0x53')][_0xa291('0x54')],'raw':!![],'transaction':_0x58094d});})[_0xa291('0x25')](function(_0x65ba17){var _0x545824=_[_0xa291('0x30')](_0x65ba17,function(_0x46822f){return Number(_0x46822f[_0xa291('0x5a')]);});return db[_0xa291('0x5b')][_0xa291('0x58')]({'where':{'UserId':{'$in':_0x51d3dd},'MailQueueId':{'$in':_0x545824}},'transaction':_0x58094d});})[_0xa291('0x25')](function(){var _0x167138='SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20'+_0x56fae3;return db['sequelize'][_0xa291('0x31')](_0x167138,{'type':db[_0xa291('0x52')][_0xa291('0x53')][_0xa291('0x54')],'raw':!![],'transaction':_0x58094d});})['then'](function(_0x27f44c){var _0x196e5c=_[_0xa291('0x30')](_0x27f44c,function(_0x3ef4df){return Number(_0x3ef4df[_0xa291('0x5c')]);});return db['UserSmsQueue'][_0xa291('0x58')]({'where':{'UserId':{'$in':_0x51d3dd},'SmsQueueId':{'$in':_0x196e5c}},'transaction':_0x58094d});})[_0xa291('0x25')](function(){var _0x3c3b03=_0xa291('0x5d')+_0x56fae3;return db[_0xa291('0x4f')][_0xa291('0x31')](_0x3c3b03,{'type':db[_0xa291('0x52')][_0xa291('0x53')]['SELECT'],'raw':!![],'transaction':_0x58094d});})[_0xa291('0x25')](function(_0x46b524){var _0x5885e8=_[_0xa291('0x30')](_0x46b524,function(_0x5e8c55){return Number(_0x5e8c55[_0xa291('0x5e')]);});return db[_0xa291('0x5f')][_0xa291('0x58')]({'where':{'UserId':{'$in':_0x51d3dd},'ChatQueueId':{'$in':_0x5885e8}},'transaction':_0x58094d});})['then'](function(){var _0x4b6e82='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x56fae3;return db[_0xa291('0x4f')][_0xa291('0x31')](_0x4b6e82,{'type':db[_0xa291('0x52')][_0xa291('0x53')][_0xa291('0x54')],'raw':!![],'transaction':_0x58094d});})[_0xa291('0x25')](function(_0x502314){var _0x468756=_['map'](_0x502314,function(_0x164b40){return Number(_0x164b40[_0xa291('0x60')]);});return db[_0xa291('0x61')][_0xa291('0x58')]({'where':{'UserId':{'$in':_0x51d3dd},'FaxQueueId':{'$in':_0x468756}},'transaction':_0x58094d});})[_0xa291('0x25')](function(){var _0x41e752=_0xa291('0x62')+_0x56fae3;return db[_0xa291('0x4f')][_0xa291('0x31')](_0x41e752,{'type':db['Sequelize']['QueryTypes'][_0xa291('0x54')],'raw':!![],'transaction':_0x58094d});})['then'](function(_0x5cd15a){var _0x106b61=_[_0xa291('0x30')](_0x5cd15a,function(_0x1e29ba){return Number(_0x1e29ba['OpenchannelQueueId']);});return db[_0xa291('0x63')][_0xa291('0x58')]({'where':{'UserId':{'$in':_0x51d3dd},'OpenchannelQueueId':{'$in':_0x106b61}},'transaction':_0x58094d});})[_0xa291('0x25')](function(){var _0x471be6=_0xa291('0x64')+_0x56fae3;return db[_0xa291('0x4f')][_0xa291('0x31')](_0x471be6,{'type':db['Sequelize'][_0xa291('0x53')][_0xa291('0x54')],'raw':!![],'transaction':_0x58094d});})[_0xa291('0x25')](function(_0x2b4f67){var _0x3ff447=_['map'](_0x2b4f67,function(_0x3f2529){return Number(_0x3f2529[_0xa291('0x65')]);});return db[_0xa291('0x66')]['destroy']({'where':{'UserId':{'$in':_0x51d3dd},'WhatsappQueueId':{'$in':_0x3ff447}},'transaction':_0x58094d});})['then'](function(){return db[_0xa291('0x67')]['find']({'where':{'TeamId':_0x56fae3}});})[_0xa291('0x25')](function(_0x33cc71){if(_0x33cc71===null){return;}return db[_0xa291('0x68')]['destroy']({'where':{'UserId':{'$in':_0x51d3dd},'VoicePrefixId':_0x33cc71[_0xa291('0x69')]},'transaction':_0x58094d});})[_0xa291('0x25')](function(){return db[_0xa291('0x2a')][_0xa291('0x58')]({'where':{'id':_0x56fae3},'cascade':!![],'transaction':_0x58094d});})[_0xa291('0x25')](function(_0x51a446){if(_0x51a446===0x0){_0x12fb0e[_0xa291('0x19')](0x194);}else{return db['UserProfileResource'][_0xa291('0x58')]({'where':{'type':_0xa291('0x6a'),'resourceId':_0x56fae3},'cascade':!![],'transaction':_0x58094d})['then'](function(){_0x12fb0e[_0xa291('0x1a')](0xcc)[_0xa291('0x6b')]();});}})[_0xa291('0x41')](function(_0x349e4f){_0x12fb0e[_0xa291('0x1a')](0x1f4)[_0xa291('0x29')](_0x349e4f);});});};exports[_0xa291('0x6c')]=function(_0x158636,_0x580244,_0x118db7){return db[_0xa291('0x2a')][_0xa291('0x6d')]({'where':{'id':_0x158636[_0xa291('0x43')]['id']}})[_0xa291('0x25')](handleEntityNotFound(_0x580244,null))['then'](function(_0x448ea7){if(!_0x158636[_0xa291('0x31')][_0xa291('0x6e')]||!utils[_0xa291('0x6f')](_0x158636[_0xa291('0x31')][_0xa291('0x6e')])){throw new db[(_0xa291('0x52'))][(_0xa291('0x70'))]('Unknown\x20channel');}var _0xd86d4a={};var _0x1cfa2a={};_0x1cfa2a[_0xa291('0x2f')]=_[_0xa291('0x32')](db[_[_0xa291('0x71')](_0x158636[_0xa291('0x31')][_0xa291('0x6e')]['toLowerCase']())+'Queue'][_0xa291('0x2b')]);_0x1cfa2a[_0xa291('0x31')]=_[_0xa291('0x32')](_0x158636[_0xa291('0x31')]);_0x1cfa2a[_0xa291('0x39')]=_[_0xa291('0x33')](_0x1cfa2a[_0xa291('0x2f')],_0x1cfa2a['query']);_0xd86d4a[_0xa291('0x34')]=_['intersection'](_0x1cfa2a[_0xa291('0x2f')],qs[_0xa291('0x35')](_0x158636[_0xa291('0x31')][_0xa291('0x35')]));_0xd86d4a[_0xa291('0x34')]=_0xd86d4a[_0xa291('0x34')]['length']?_0xd86d4a[_0xa291('0x34')]:_0x1cfa2a[_0xa291('0x2f')];_0xd86d4a[_0xa291('0x1d')]=qs[_0xa291('0x1d')](_0x158636[_0xa291('0x31')][_0xa291('0x1d')]);_0xd86d4a[_0xa291('0x1b')]=qs[_0xa291('0x1b')](_0x158636[_0xa291('0x31')][_0xa291('0x1b')]);_0xd86d4a[_0xa291('0x36')]=qs['sort'](_0x158636[_0xa291('0x31')][_0xa291('0x37')]);_0xd86d4a[_0xa291('0x38')]=qs['filters'](_[_0xa291('0x3a')](_0x158636[_0xa291('0x31')],_0x1cfa2a[_0xa291('0x39')]));_0xd86d4a=_[_0xa291('0x3c')]({},_0xd86d4a,_0x158636[_0xa291('0x3d')]);return _0x448ea7['get'+_[_0xa291('0x71')](_0x158636['query'][_0xa291('0x6e')][_0xa291('0x72')]())+'Queues'](_0xd86d4a);})[_0xa291('0x25')](respondWithResult(_0x580244,null))['catch'](handleError(_0x580244,null));};exports[_0xa291('0x73')]=function(_0x3bcd54,_0xfd4d6a,_0x198cd8){return db['Team'][_0xa291('0x6d')]({'where':{'id':_0x3bcd54[_0xa291('0x43')]['id']}})['then'](function(_0x47464c){if(_0x47464c){if(!_0x3bcd54[_0xa291('0x4e')]['channel']||!utils[_0xa291('0x6f')](_0x3bcd54['body'][_0xa291('0x6e')])){throw new db['Sequelize'][(_0xa291('0x70'))](_0xa291('0x74'));}return _0x47464c[_0xa291('0x75')+_['capitalize'](_0x3bcd54[_0xa291('0x4e')][_0xa291('0x6e')][_0xa291('0x72')]())+_0xa291('0x76')](_0x3bcd54[_0xa291('0x4e')][_0xa291('0x77')]);}return null;})[_0xa291('0x25')](handleEntityNotFound(_0xfd4d6a,null))['then'](respondWithStatusCode(_0xfd4d6a,null))[_0xa291('0x41')](handleError(_0xfd4d6a,null));};exports[_0xa291('0x78')]=function(_0xf01d97,_0x341674,_0x346f04){return db['Team']['findOne']({'where':{'id':_0xf01d97[_0xa291('0x43')]['id']}})['then'](function(_0x783382){if(_0x783382){if(!_0xf01d97[_0xa291('0x31')][_0xa291('0x6e')]||!utils[_0xa291('0x6f')](_0xf01d97['query'][_0xa291('0x6e')])){throw new db[(_0xa291('0x52'))][(_0xa291('0x70'))](_0xa291('0x74'));}return _0x783382[_0xa291('0x79')+_[_0xa291('0x71')](_0xf01d97[_0xa291('0x31')][_0xa291('0x6e')][_0xa291('0x72')]())+_0xa291('0x76')](_0xf01d97[_0xa291('0x31')][_0xa291('0x77')]);}return null;})[_0xa291('0x25')](handleEntityNotFound(_0x341674,null))['then'](respondWithStatusCode(_0x341674,null))['catch'](handleError(_0x341674,null));};exports['addAgents']=function(_0x2b6152,_0x3fa37e){var _0x1e3b6c=_[_0xa291('0x7a')](_0x2b6152[_0xa291('0x4e')]['ids'])?_0x2b6152[_0xa291('0x4e')][_0xa291('0x77')]:[_0x2b6152[_0xa291('0x4e')]['ids']];var _0x4ef341=_0x2b6152[_0xa291('0x43')]['id'];return db[_0xa291('0x2a')][_0xa291('0x4b')]({'where':{'id':_0x4ef341}})[_0xa291('0x25')](handleEntityNotFound(_0x3fa37e,null))['then'](function(_0x24ccb7){if(_0x24ccb7){var _0x4a14bf=[_0xa291('0x7b'),_0xa291('0x7c'),_0xa291('0x7d'),_0xa291('0x7e'),_0xa291('0x7f'),'Openchannel',_0xa291('0x80')];return db[_0xa291('0x4f')][_0xa291('0x50')](function(_0x3b09e0){var _0x2de68c=_[_0xa291('0x30')](_0x4a14bf,function(_0x48c8fe){var _0xc30eeb={'attributes':['id','name']};if(_0x48c8fe===_0xa291('0x7b')){_0xc30eeb['through']={'attributes':[_0xa291('0x81')]};}return _0x24ccb7[_0xa291('0x47')+_0x48c8fe+'Queues'](_0xc30eeb)[_0xa291('0x25')](function(_0x1cc35a){var _0x25fbe8=_['map'](_0x1cc35a,function(_0x3942d5){var _0x321eef=_[_0xa291('0x30')](_0x1e3b6c,function(_0x429df8){var _0x12809d={'where':{'UserId':_0x429df8,[_0x48c8fe+_0xa291('0x82')]:_0x3942d5['id']},'transaction':_0x3b09e0};if(_0x48c8fe===_0xa291('0x7b')){_0x12809d[_0xa291('0x14')]={'penalty':_0x3942d5[_0xa291('0x83')][_0xa291('0x81')]};}return db[_0xa291('0x84')+_0x48c8fe+_0xa291('0x85')][_0xa291('0x86')](_0x12809d)['then'](function(){socket[_0xa291('0x87')](_0xa291('0x46')+_0x48c8fe+_0xa291('0x88'),{'UserId':_0x429df8,[_0x48c8fe+_0xa291('0x82')]:_0x3942d5['id']});if(_0x48c8fe!==_0xa291('0x7b')){return;}return db['User']['findAll']({'where':{'id':_0x1e3b6c,'online':0x1},'attributes':['id',_0xa291('0x28'),_0xa291('0x89'),_0xa291('0x8a'),_0xa291('0x8b')],'raw':!![]})['then'](function(_0x36db65){var _0x5bf74c=_[_0xa291('0x30')](_0x36db65,function(_0x105b58){return db['UserVoiceQueueRt']['upsert']({'membername':_0x105b58[_0xa291('0x28')],'UserId':_0x105b58['id'],'queue_name':_0x3942d5[_0xa291('0x28')],'VoiceQueueId':_0x3942d5['id'],'interface':_[_0xa291('0x8c')](_0x105b58[_0xa291('0x8b')])?util[_0xa291('0x8d')]('SIP/%s',_0x105b58['name']):_0x105b58[_0xa291('0x8b')],'paused':_0x105b58[_0xa291('0x8a')]||![],'penalty':_0x3942d5[_0xa291('0x83')][_0xa291('0x81')]},{'transaction':_0x3b09e0});});return Promise[_0xa291('0x8e')](_0x5bf74c);});});});return Promise[_0xa291('0x8e')](_0x321eef);});return Promise[_0xa291('0x8e')](_0x25fbe8);})['then'](function(){return db[_0xa291('0x67')][_0xa291('0x6d')]({'where':{'teamId':_0x4ef341}})[_0xa291('0x25')](function(_0x4defef){if(_0x4defef){var _0x44f5f2=_[_0xa291('0x30')](_0x1e3b6c,function(_0xb2b34b){db[_0xa291('0x68')][_0xa291('0x8f')]({'UserId':_0xb2b34b,'VoicePrefixId':_0x4defef['VoicePrefixId']});});return Promise[_0xa291('0x8e')](_0x44f5f2);}});});});return Promise[_0xa291('0x8e')](_0x2de68c)[_0xa291('0x25')](function(){return _0x24ccb7[_0xa291('0x90')](_0x1e3b6c,{'transaction':_0x3b09e0})[_0xa291('0x91')](function(_0x436127){return _0x436127;});});});}})[_0xa291('0x25')](respondWithResult(_0x3fa37e,null))[_0xa291('0x41')](handleError(_0x3fa37e,null));};exports[_0xa291('0x92')]=function(_0xba346a,_0x5bdf5d){var _0x29dc9d=_[_0xa291('0x7a')](_0xba346a[_0xa291('0x31')][_0xa291('0x77')])?_0xba346a[_0xa291('0x31')]['ids']:[_0xba346a[_0xa291('0x31')][_0xa291('0x77')]];var _0x42bfb4=_0xba346a[_0xa291('0x43')]['id'];return db[_0xa291('0x2a')]['find']({'where':{'id':_0x42bfb4}})['then'](handleEntityNotFound(_0x5bdf5d,null))['then'](function(_0x184700){if(_0x184700){var _0x4ff5d0=[_0xa291('0x7b'),_0xa291('0x7c'),'Mail',_0xa291('0x7e'),_0xa291('0x7f'),_0xa291('0x93'),_0xa291('0x80')];return db['sequelize'][_0xa291('0x50')](function(_0x486fc7){var _0x59cb48=_[_0xa291('0x30')](_0x4ff5d0,function(_0x3253c1){var _0x168cd2={'attributes':['id',_0xa291('0x28')]};return _0x184700[_0xa291('0x47')+_0x3253c1+_0xa291('0x76')](_0x168cd2)[_0xa291('0x25')](function(_0x146747){var _0x356b2e=_[_0xa291('0x30')](_0x146747,function(_0xae2c08){return _0xae2c08[_0xa291('0x92')](_0x29dc9d,{'transaction':_0x486fc7})[_0xa291('0x25')](function(){var _0x591e5d=_[_0xa291('0x30')](_0x29dc9d,function(_0x1d5396){socket['emit'](_0xa291('0x46')+_0x3253c1+_0xa291('0x94'),{'UserId':Number(_0x1d5396),[_0x3253c1+_0xa291('0x82')]:_0xae2c08['id']});if(_0x3253c1!==_0xa291('0x7b')){return;}return db[_0xa291('0x95')][_0xa291('0x58')]({'where':{'VoiceQueueId':_0xae2c08['id'],'UserId':_0x1d5396},'transaction':_0x486fc7});});return Promise[_0xa291('0x8e')](_0x591e5d);});});return Promise[_0xa291('0x8e')](_0x356b2e);});});return Promise[_0xa291('0x8e')](_0x59cb48)[_0xa291('0x25')](function(){return _0x184700[_0xa291('0x92')](_0x29dc9d,{'transaction':_0x486fc7});})['then'](function(){return db[_0xa291('0x67')][_0xa291('0x6d')]({'where':{'teamId':_0x42bfb4}})[_0xa291('0x25')](function(_0x460edf){if(_0x460edf){var _0x566055=_['map'](_0x29dc9d,function(_0x6afd02){db['UserVoicePrefix']['destroy']({'where':{'UserId':_0x6afd02,'VoicePrefixId':_0x460edf['VoicePrefixId']}});});return Promise['all'](_0x566055);}});});});}})[_0xa291('0x25')](respondWithStatusCode(_0x5bdf5d,null))[_0xa291('0x41')](handleError(_0x5bdf5d,null));};exports['getAgents']=function(_0x5d332f,_0x6dd6c8,_0x18ffc6){var _0x1786c1={};var _0x3171d4={};var _0x4fcf2b;var _0x3cfb46;return db[_0xa291('0x2a')]['findOne']({'where':{'id':_0x5d332f[_0xa291('0x43')]['id']}})[_0xa291('0x25')](handleEntityNotFound(_0x6dd6c8,null))[_0xa291('0x25')](function(_0xb82c80){if(_0xb82c80){_0x4fcf2b=_0xb82c80;_0x3171d4['model']=_['keys'](db[_0xa291('0x84')][_0xa291('0x2b')]);_0x3171d4[_0xa291('0x31')]=_['keys'](_0x5d332f[_0xa291('0x31')]);_0x3171d4['filters']=_[_0xa291('0x33')](_0x3171d4[_0xa291('0x2f')],_0x3171d4[_0xa291('0x31')]);_0x1786c1[_0xa291('0x34')]=_[_0xa291('0x33')](_0x3171d4[_0xa291('0x2f')],qs[_0xa291('0x35')](_0x5d332f[_0xa291('0x31')]['fields']));_0x1786c1[_0xa291('0x34')]=_0x1786c1[_0xa291('0x34')][_0xa291('0x44')]?_0x1786c1[_0xa291('0x34')]:_0x3171d4[_0xa291('0x2f')];_0x1786c1['order']=qs['sort'](_0x5d332f[_0xa291('0x31')]['sort']);_0x1786c1[_0xa291('0x38')]=qs[_0xa291('0x39')](_[_0xa291('0x3a')](_0x5d332f['query'],_0x3171d4[_0xa291('0x39')]));if(_0x5d332f[_0xa291('0x31')]['filter']){_0x1786c1['where']=_['merge'](_0x1786c1[_0xa291('0x38')],{'$or':_[_0xa291('0x30')](_0x1786c1[_0xa291('0x34')],function(_0x29fb7a){var _0x5d0996={};_0x5d0996[_0x29fb7a]={'$like':'%'+_0x5d332f[_0xa291('0x31')][_0xa291('0x3b')]+'%'};return _0x5d0996;})});}_0x1786c1=_['merge']({},_0x1786c1,_0x5d332f[_0xa291('0x3d')]);return _0x4fcf2b[_0xa291('0x96')](_0x1786c1);}})[_0xa291('0x25')](function(_0x1fbf9e){if(_0x1fbf9e){_0x3cfb46=_0x1fbf9e[_0xa291('0x44')];if(!_0x5d332f['query'][_0xa291('0x97')](_0xa291('0x98'))){_0x1786c1[_0xa291('0x1d')]=qs[_0xa291('0x1d')](_0x5d332f[_0xa291('0x31')]['limit']);_0x1786c1['offset']=qs[_0xa291('0x1b')](_0x5d332f['query'][_0xa291('0x1b')]);}return _0x4fcf2b[_0xa291('0x96')](_0x1786c1);}})[_0xa291('0x25')](function(_0x38f091){if(_0x38f091){return _0x38f091?{'count':_0x3cfb46,'rows':_0x38f091}:null;}})[_0xa291('0x25')](respondWithResult(_0x6dd6c8,null))[_0xa291('0x41')](handleError(_0x6dd6c8,null));}; \ No newline at end of file +var _0x5fee=['getAgents','User','rimraf','fast-json-patch','request-promise','bluebird','sox','to-csv','ejs','fs-extra','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./team.socket','register','sendStatus','status','json','offset','limit','undefined','count','Content-Range','apply','reject','update','then','error','stack','name','index','map','fieldName','type','model','filters','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','sort','VIRTUAL','filter','merge','options','where','includeAll','Team','findAll','rows','catch','show','rawAttributes','keys','include','find','create','body','user','get','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','UserProfileResource','params','destroy','transaction','SELECT\x20UserId\x20FROM\x20user_has_teams\x20WHERE\x20TeamId\x20=\x20','sequelize','Sequelize','UserId','SELECT\x20VoiceQueueId\x20FROM\x20team_has_voice_queues\x20WHERE\x20TeamId\x20=\x20','QueryTypes','SELECT','VoiceQueueId','MailQueueId','UserMailQueue','SELECT\x20SmsQueueId\x20FROM\x20team_has_sms_queues\x20WHERE\x20TeamId\x20=\x20','SmsQueueId','UserSmsQueue','SELECT\x20ChatQueueId\x20FROM\x20team_has_chat_queues\x20WHERE\x20TeamId\x20=\x20','ChatQueueId','UserChatQueue','FaxQueueId','SELECT\x20OpenchannelQueueId\x20FROM\x20team_has_openchannel_queues\x20WHERE\x20TeamId\x20=\x20','OpenchannelQueueId','UserOpenchannelQueue','SELECT\x20WhatsappQueueId\x20FROM\x20team_has_whatsapp_queues\x20WHERE\x20TeamId\x20=\x20','WhatsappQueueId','UserWhatsappQueue','TeamVoicePrefix','UserVoicePrefix','VoicePrefixId','Teams','end','send','getQueues','isValidChannel','channel','Unknown\x20channel','toLowerCase','Queue','order','pick','capitalize','Queues','addQueues','findOne','ValidationError','add','ids','removeQueues','remove','addAgents','Voice','Chat','Mail','Sms','Fax','Openchannel','through','penalty','QueueId','defaults','TeamVoiceQueue','findOrCreate','emit','online','voicePause','interface','isNil','SIP/%s','all','upsert','removeAgents','isArray','Whatsapp','Queue:remove','UserVoiceQueueRt'];(function(_0xa029a,_0x2771d5){var _0x495458=function(_0x5e5e01){while(--_0x5e5e01){_0xa029a['push'](_0xa029a['shift']());}};_0x495458(++_0x2771d5);}(_0x5fee,0x9e));var _0xe5fe=function(_0x2963b3,_0x179f6d){_0x2963b3=_0x2963b3-0x0;var _0x333b8e=_0x5fee[_0x2963b3];return _0x333b8e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xe5fe('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0xe5fe('0x1'));var rp=require(_0xe5fe('0x2'));var moment=require('moment');var BPromise=require(_0xe5fe('0x3'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require(_0xe5fe('0x4'));var csv=require(_0xe5fe('0x5'));var ejs=require(_0xe5fe('0x6'));var fs=require('fs');var fs_extra=require(_0xe5fe('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0xe5fe('0x8'));var deskjs=require(_0xe5fe('0x9'));var toCsv=require('to-csv');var querystring=require(_0xe5fe('0xa'));var Papa=require(_0xe5fe('0xb'));var Redis=require(_0xe5fe('0xc'));var authService=require(_0xe5fe('0xd'));var qs=require(_0xe5fe('0xe'));var as=require(_0xe5fe('0xf'));var hardwareService=require(_0xe5fe('0x10'));var logger=require(_0xe5fe('0x11'))('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xe5fe('0x12'));var db=require(_0xe5fe('0x13'))['db'];config['redis']=_['defaults'](config[_0xe5fe('0x14')],{'host':_0xe5fe('0x15'),'port':0x18eb});var socket=require(_0xe5fe('0x16'))(new Redis(config[_0xe5fe('0x14')]));require(_0xe5fe('0x17'))[_0xe5fe('0x18')](socket);function respondWithStatusCode(_0x517ae7,_0x56e9e8){_0x56e9e8=_0x56e9e8||0xcc;return function(_0x1a78fd){if(_0x1a78fd){return _0x517ae7[_0xe5fe('0x19')](_0x56e9e8);}return _0x517ae7[_0xe5fe('0x1a')](_0x56e9e8)['end']();};}function respondWithResult(_0x4ffcdc,_0x49b167){_0x49b167=_0x49b167||0xc8;return function(_0x171036){if(_0x171036){return _0x4ffcdc[_0xe5fe('0x1a')](_0x49b167)[_0xe5fe('0x1b')](_0x171036);}};}function respondWithFilteredResult(_0x4192b4,_0x41aa2d){return function(_0x21bd48){if(_0x21bd48){var _0x2bd44f=typeof _0x41aa2d[_0xe5fe('0x1c')]==='undefined'&&typeof _0x41aa2d[_0xe5fe('0x1d')]===_0xe5fe('0x1e');var _0x34ab45=_0x21bd48['count'];var _0x1d23d2=_0x2bd44f?0x0:_0x41aa2d[_0xe5fe('0x1c')];var _0x47b78e=_0x2bd44f?_0x21bd48[_0xe5fe('0x1f')]:_0x41aa2d[_0xe5fe('0x1c')]+_0x41aa2d[_0xe5fe('0x1d')];var _0x3bc266;if(_0x47b78e>=_0x34ab45){_0x47b78e=_0x34ab45;_0x3bc266=0xc8;}else{_0x3bc266=0xce;}_0x4192b4[_0xe5fe('0x1a')](_0x3bc266);return _0x4192b4['set'](_0xe5fe('0x20'),_0x1d23d2+'-'+_0x47b78e+'/'+_0x34ab45)['json'](_0x21bd48);}return null;};}function patchUpdates(_0x5560fc){return function(_0x2928a3){try{jsonpatch[_0xe5fe('0x21')](_0x2928a3,_0x5560fc,!![]);}catch(_0x2eb1d8){return BPromise[_0xe5fe('0x22')](_0x2eb1d8);}return _0x2928a3['save']();};}function saveUpdates(_0x18d3bb,_0x430d02){return function(_0x37292b){if(_0x37292b){return _0x37292b[_0xe5fe('0x23')](_0x18d3bb)[_0xe5fe('0x24')](function(_0xeb7589){return _0xeb7589;});}return null;};}function handleEntityNotFound(_0x137f9f,_0x5ac6bd){return function(_0x2327f2){if(!_0x2327f2){_0x137f9f[_0xe5fe('0x19')](0x194);}return _0x2327f2;};}function handleError(_0xeabffd,_0x43e4e6){_0x43e4e6=_0x43e4e6||0x1f4;return function(_0x54022a){logger[_0xe5fe('0x25')](_0x54022a[_0xe5fe('0x26')]);if(_0x54022a[_0xe5fe('0x27')]){delete _0x54022a[_0xe5fe('0x27')];}_0xeabffd[_0xe5fe('0x1a')](_0x43e4e6)['send'](_0x54022a);};}exports[_0xe5fe('0x28')]=function(_0x11825e,_0x51befe){var _0x362f87={},_0x28d126={},_0x5cb991={'count':0x0,'rows':[]};var _0x30880e=_[_0xe5fe('0x29')](db['Team']['rawAttributes'],function(_0x46f15b){return{'name':_0x46f15b[_0xe5fe('0x2a')],'type':_0x46f15b[_0xe5fe('0x2b')]['key']};});_0x28d126[_0xe5fe('0x2c')]=_[_0xe5fe('0x29')](_0x30880e,_0xe5fe('0x27'));_0x28d126['query']=_['keys'](_0x11825e['query']);_0x28d126[_0xe5fe('0x2d')]=_[_0xe5fe('0x2e')](_0x28d126[_0xe5fe('0x2c')],_0x28d126[_0xe5fe('0x2f')]);_0x362f87[_0xe5fe('0x30')]=_[_0xe5fe('0x2e')](_0x28d126[_0xe5fe('0x2c')],qs['fields'](_0x11825e[_0xe5fe('0x2f')][_0xe5fe('0x31')]));_0x362f87[_0xe5fe('0x30')]=_0x362f87[_0xe5fe('0x30')][_0xe5fe('0x32')]?_0x362f87['attributes']:_0x28d126[_0xe5fe('0x2c')];if(!_0x11825e[_0xe5fe('0x2f')][_0xe5fe('0x33')](_0xe5fe('0x34'))){_0x362f87[_0xe5fe('0x1d')]=qs[_0xe5fe('0x1d')](_0x11825e[_0xe5fe('0x2f')][_0xe5fe('0x1d')]);_0x362f87[_0xe5fe('0x1c')]=qs['offset'](_0x11825e['query'][_0xe5fe('0x1c')]);}_0x362f87['order']=qs['sort'](_0x11825e[_0xe5fe('0x2f')][_0xe5fe('0x35')]);_0x362f87['where']=qs[_0xe5fe('0x2d')](_['pick'](_0x11825e['query'],_0x28d126['filters']),_0x30880e);if(_0x11825e[_0xe5fe('0x2f')]['filter']){_0x362f87['where']=_['merge'](_0x362f87['where'],{'$or':_[_0xe5fe('0x29')](_0x30880e,function(_0x16d559){if(_0x16d559[_0xe5fe('0x2b')]!==_0xe5fe('0x36')){var _0x49a45e={};_0x49a45e[_0x16d559[_0xe5fe('0x27')]]={'$like':'%'+_0x11825e['query'][_0xe5fe('0x37')]+'%'};return _0x49a45e;}})});}_0x362f87=_[_0xe5fe('0x38')]({},_0x362f87,_0x11825e[_0xe5fe('0x39')]);var _0x34b1e2={'where':_0x362f87[_0xe5fe('0x3a')]};return db['Team'][_0xe5fe('0x1f')](_0x34b1e2)[_0xe5fe('0x24')](function(_0x48befb){_0x5cb991[_0xe5fe('0x1f')]=_0x48befb;if(_0x11825e['query'][_0xe5fe('0x3b')]){_0x362f87['include']=[{'all':!![]}];}return db[_0xe5fe('0x3c')][_0xe5fe('0x3d')](_0x362f87);})[_0xe5fe('0x24')](function(_0x2f7c90){_0x5cb991[_0xe5fe('0x3e')]=_0x2f7c90;return _0x5cb991;})[_0xe5fe('0x24')](respondWithFilteredResult(_0x51befe,_0x362f87))[_0xe5fe('0x3f')](handleError(_0x51befe,null));};exports[_0xe5fe('0x40')]=function(_0x2a96f5,_0x5ddc70){var _0x3fea30={'raw':![],'where':{'id':_0x2a96f5['params']['id']}},_0x1a89fd={};_0x1a89fd['model']=_['keys'](db[_0xe5fe('0x3c')][_0xe5fe('0x41')]);_0x1a89fd[_0xe5fe('0x2f')]=_[_0xe5fe('0x42')](_0x2a96f5[_0xe5fe('0x2f')]);_0x1a89fd['filters']=_['intersection'](_0x1a89fd['model'],_0x1a89fd['query']);_0x3fea30[_0xe5fe('0x30')]=_[_0xe5fe('0x2e')](_0x1a89fd[_0xe5fe('0x2c')],qs[_0xe5fe('0x31')](_0x2a96f5[_0xe5fe('0x2f')][_0xe5fe('0x31')]));_0x3fea30[_0xe5fe('0x30')]=_0x3fea30[_0xe5fe('0x30')][_0xe5fe('0x32')]?_0x3fea30['attributes']:_0x1a89fd['model'];if(_0x2a96f5[_0xe5fe('0x2f')][_0xe5fe('0x3b')]){_0x3fea30[_0xe5fe('0x43')]=[{'all':!![]}];}_0x3fea30=_[_0xe5fe('0x38')]({},_0x3fea30,_0x2a96f5[_0xe5fe('0x39')]);return db['Team'][_0xe5fe('0x44')](_0x3fea30)[_0xe5fe('0x24')](handleEntityNotFound(_0x5ddc70,null))[_0xe5fe('0x24')](respondWithResult(_0x5ddc70,null))[_0xe5fe('0x3f')](handleError(_0x5ddc70,null));};exports['create']=function(_0x3bb52e,_0x5e1671){return db['Team'][_0xe5fe('0x45')](_0x3bb52e[_0xe5fe('0x46')],{})[_0xe5fe('0x24')](function(_0x44797e){var _0x4337f4=_0x3bb52e[_0xe5fe('0x47')][_0xe5fe('0x48')]({'plain':!![]});if(!_0x4337f4)throw new Error(_0xe5fe('0x49'));if(_0x4337f4[_0xe5fe('0x4a')]===_0xe5fe('0x47')){var _0x56fd75=_0x44797e[_0xe5fe('0x48')]({'plain':!![]});var _0x4f6abd='Teams';return db[_0xe5fe('0x4b')][_0xe5fe('0x44')]({'where':{'name':_0x4f6abd,'userProfileId':_0x4337f4[_0xe5fe('0x4c')]},'raw':!![]})[_0xe5fe('0x24')](function(_0x3a5b98){if(_0x3a5b98&&_0x3a5b98[_0xe5fe('0x4d')]===0x0){return db[_0xe5fe('0x4e')][_0xe5fe('0x45')]({'name':_0x56fd75[_0xe5fe('0x27')],'resourceId':_0x56fd75['id'],'type':_0x3a5b98['name'],'sectionId':_0x3a5b98['id']},{})[_0xe5fe('0x24')](function(){return _0x44797e;});}else{return _0x44797e;}})['catch'](function(_0x4248b9){logger[_0xe5fe('0x25')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x4248b9);throw _0x4248b9;});}return _0x44797e;})[_0xe5fe('0x24')](respondWithResult(_0x5e1671,0xc9))[_0xe5fe('0x3f')](handleError(_0x5e1671,null));};exports[_0xe5fe('0x23')]=function(_0x4c94f0,_0x2c34d3){if(_0x4c94f0[_0xe5fe('0x46')]['id']){delete _0x4c94f0['body']['id'];}return db['Team'][_0xe5fe('0x44')]({'where':{'id':_0x4c94f0[_0xe5fe('0x4f')]['id']}})[_0xe5fe('0x24')](handleEntityNotFound(_0x2c34d3,null))[_0xe5fe('0x24')](saveUpdates(_0x4c94f0[_0xe5fe('0x46')],null))[_0xe5fe('0x24')](respondWithResult(_0x2c34d3,null))[_0xe5fe('0x3f')](handleError(_0x2c34d3,null));};exports[_0xe5fe('0x50')]=function(_0xe62554,_0x1d0fe0){var _0x197cd6=_0xe62554[_0xe5fe('0x4f')]['id'];var _0xcaba07=[];return db['sequelize'][_0xe5fe('0x51')](function(_0x1801cb){var _0x217728=_0xe5fe('0x52')+_0x197cd6;return db[_0xe5fe('0x53')]['query'](_0x217728,{'type':db[_0xe5fe('0x54')]['QueryTypes']['SELECT'],'raw':!![],'transaction':_0x1801cb})[_0xe5fe('0x24')](function(_0x47288a){_0xcaba07=_[_0xe5fe('0x29')](_0x47288a,function(_0x1dd975){return Number(_0x1dd975[_0xe5fe('0x55')]);});})['then'](function(){var _0x1d6f1c=_0xe5fe('0x56')+_0x197cd6;return db[_0xe5fe('0x53')][_0xe5fe('0x2f')](_0x1d6f1c,{'type':db['Sequelize'][_0xe5fe('0x57')][_0xe5fe('0x58')],'raw':!![],'transaction':_0x1801cb});})['then'](function(_0x24c324){var _0x4b22d9=_['map'](_0x24c324,function(_0x5dbb66){return Number(_0x5dbb66[_0xe5fe('0x59')]);});return db['UserVoiceQueue']['destroy']({'where':{'UserId':{'$in':_0xcaba07},'VoiceQueueId':{'$in':_0x4b22d9}},'transaction':_0x1801cb});})[_0xe5fe('0x24')](function(){var _0xe180ab='SELECT\x20MailQueueId\x20FROM\x20team_has_mail_queues\x20WHERE\x20TeamId\x20=\x20'+_0x197cd6;return db[_0xe5fe('0x53')]['query'](_0xe180ab,{'type':db['Sequelize'][_0xe5fe('0x57')][_0xe5fe('0x58')],'raw':!![],'transaction':_0x1801cb});})[_0xe5fe('0x24')](function(_0x2054c6){var _0xb5b0f9=_[_0xe5fe('0x29')](_0x2054c6,function(_0x14a008){return Number(_0x14a008[_0xe5fe('0x5a')]);});return db[_0xe5fe('0x5b')]['destroy']({'where':{'UserId':{'$in':_0xcaba07},'MailQueueId':{'$in':_0xb5b0f9}},'transaction':_0x1801cb});})[_0xe5fe('0x24')](function(){var _0xa8f17d=_0xe5fe('0x5c')+_0x197cd6;return db[_0xe5fe('0x53')][_0xe5fe('0x2f')](_0xa8f17d,{'type':db['Sequelize'][_0xe5fe('0x57')][_0xe5fe('0x58')],'raw':!![],'transaction':_0x1801cb});})[_0xe5fe('0x24')](function(_0x56f2d6){var _0x4ba769=_[_0xe5fe('0x29')](_0x56f2d6,function(_0x2aa0fb){return Number(_0x2aa0fb[_0xe5fe('0x5d')]);});return db[_0xe5fe('0x5e')][_0xe5fe('0x50')]({'where':{'UserId':{'$in':_0xcaba07},'SmsQueueId':{'$in':_0x4ba769}},'transaction':_0x1801cb});})[_0xe5fe('0x24')](function(){var _0x1dbaf6=_0xe5fe('0x5f')+_0x197cd6;return db[_0xe5fe('0x53')][_0xe5fe('0x2f')](_0x1dbaf6,{'type':db[_0xe5fe('0x54')]['QueryTypes'][_0xe5fe('0x58')],'raw':!![],'transaction':_0x1801cb});})[_0xe5fe('0x24')](function(_0x3bab27){var _0x573685=_[_0xe5fe('0x29')](_0x3bab27,function(_0x19e6a2){return Number(_0x19e6a2[_0xe5fe('0x60')]);});return db[_0xe5fe('0x61')]['destroy']({'where':{'UserId':{'$in':_0xcaba07},'ChatQueueId':{'$in':_0x573685}},'transaction':_0x1801cb});})[_0xe5fe('0x24')](function(){var _0x34698d='SELECT\x20FaxQueueId\x20FROM\x20team_has_fax_queues\x20WHERE\x20TeamId\x20=\x20'+_0x197cd6;return db[_0xe5fe('0x53')][_0xe5fe('0x2f')](_0x34698d,{'type':db['Sequelize'][_0xe5fe('0x57')][_0xe5fe('0x58')],'raw':!![],'transaction':_0x1801cb});})[_0xe5fe('0x24')](function(_0x51bc3e){var _0x463a8a=_[_0xe5fe('0x29')](_0x51bc3e,function(_0x20e2a7){return Number(_0x20e2a7[_0xe5fe('0x62')]);});return db['UserFaxQueue'][_0xe5fe('0x50')]({'where':{'UserId':{'$in':_0xcaba07},'FaxQueueId':{'$in':_0x463a8a}},'transaction':_0x1801cb});})[_0xe5fe('0x24')](function(){var _0x39f7b3=_0xe5fe('0x63')+_0x197cd6;return db['sequelize']['query'](_0x39f7b3,{'type':db[_0xe5fe('0x54')]['QueryTypes'][_0xe5fe('0x58')],'raw':!![],'transaction':_0x1801cb});})['then'](function(_0x2ccb6e){var _0x532a4c=_[_0xe5fe('0x29')](_0x2ccb6e,function(_0xdec00f){return Number(_0xdec00f[_0xe5fe('0x64')]);});return db[_0xe5fe('0x65')][_0xe5fe('0x50')]({'where':{'UserId':{'$in':_0xcaba07},'OpenchannelQueueId':{'$in':_0x532a4c}},'transaction':_0x1801cb});})[_0xe5fe('0x24')](function(){var _0x2a8304=_0xe5fe('0x66')+_0x197cd6;return db[_0xe5fe('0x53')][_0xe5fe('0x2f')](_0x2a8304,{'type':db['Sequelize'][_0xe5fe('0x57')][_0xe5fe('0x58')],'raw':!![],'transaction':_0x1801cb});})[_0xe5fe('0x24')](function(_0x41890b){var _0x1371d3=_['map'](_0x41890b,function(_0x5ec444){return Number(_0x5ec444[_0xe5fe('0x67')]);});return db[_0xe5fe('0x68')][_0xe5fe('0x50')]({'where':{'UserId':{'$in':_0xcaba07},'WhatsappQueueId':{'$in':_0x1371d3}},'transaction':_0x1801cb});})[_0xe5fe('0x24')](function(){return db[_0xe5fe('0x69')][_0xe5fe('0x44')]({'where':{'TeamId':_0x197cd6}});})[_0xe5fe('0x24')](function(_0x1b01e6){if(_0x1b01e6===null){return;}return db[_0xe5fe('0x6a')][_0xe5fe('0x50')]({'where':{'UserId':{'$in':_0xcaba07},'VoicePrefixId':_0x1b01e6[_0xe5fe('0x6b')]},'transaction':_0x1801cb});})['then'](function(){return db[_0xe5fe('0x3c')][_0xe5fe('0x50')]({'where':{'id':_0x197cd6},'cascade':!![],'transaction':_0x1801cb});})[_0xe5fe('0x24')](function(_0x723351){if(_0x723351===0x0){_0x1d0fe0['sendStatus'](0x194);}else{return db['UserProfileResource'][_0xe5fe('0x50')]({'where':{'type':_0xe5fe('0x6c'),'resourceId':_0x197cd6},'cascade':!![],'transaction':_0x1801cb})[_0xe5fe('0x24')](function(){_0x1d0fe0[_0xe5fe('0x1a')](0xcc)[_0xe5fe('0x6d')]();});}})['catch'](function(_0x2876d1){_0x1d0fe0[_0xe5fe('0x1a')](0x1f4)[_0xe5fe('0x6e')](_0x2876d1);});});};exports[_0xe5fe('0x6f')]=function(_0x31020c,_0xaa8050,_0x244f1a){return db['Team']['findOne']({'where':{'id':_0x31020c[_0xe5fe('0x4f')]['id']}})[_0xe5fe('0x24')](handleEntityNotFound(_0xaa8050,null))[_0xe5fe('0x24')](function(_0x3d6de4){if(!_0x31020c[_0xe5fe('0x2f')]['channel']||!utils[_0xe5fe('0x70')](_0x31020c[_0xe5fe('0x2f')][_0xe5fe('0x71')])){throw new db[(_0xe5fe('0x54'))]['ValidationError'](_0xe5fe('0x72'));}var _0xd61a6={};var _0x4eff5d={};_0x4eff5d[_0xe5fe('0x2c')]=_[_0xe5fe('0x42')](db[_['capitalize'](_0x31020c[_0xe5fe('0x2f')][_0xe5fe('0x71')][_0xe5fe('0x73')]())+_0xe5fe('0x74')][_0xe5fe('0x41')]);_0x4eff5d['query']=_['keys'](_0x31020c['query']);_0x4eff5d[_0xe5fe('0x2d')]=_[_0xe5fe('0x2e')](_0x4eff5d['model'],_0x4eff5d[_0xe5fe('0x2f')]);_0xd61a6[_0xe5fe('0x30')]=_[_0xe5fe('0x2e')](_0x4eff5d[_0xe5fe('0x2c')],qs['fields'](_0x31020c[_0xe5fe('0x2f')][_0xe5fe('0x31')]));_0xd61a6['attributes']=_0xd61a6['attributes'][_0xe5fe('0x32')]?_0xd61a6['attributes']:_0x4eff5d[_0xe5fe('0x2c')];_0xd61a6[_0xe5fe('0x1d')]=qs[_0xe5fe('0x1d')](_0x31020c[_0xe5fe('0x2f')]['limit']);_0xd61a6[_0xe5fe('0x1c')]=qs[_0xe5fe('0x1c')](_0x31020c['query'][_0xe5fe('0x1c')]);_0xd61a6[_0xe5fe('0x75')]=qs[_0xe5fe('0x35')](_0x31020c[_0xe5fe('0x2f')]['sort']);_0xd61a6[_0xe5fe('0x3a')]=qs[_0xe5fe('0x2d')](_[_0xe5fe('0x76')](_0x31020c[_0xe5fe('0x2f')],_0x4eff5d['filters']));_0xd61a6=_[_0xe5fe('0x38')]({},_0xd61a6,_0x31020c[_0xe5fe('0x39')]);return _0x3d6de4['get'+_[_0xe5fe('0x77')](_0x31020c[_0xe5fe('0x2f')][_0xe5fe('0x71')]['toLowerCase']())+_0xe5fe('0x78')](_0xd61a6);})[_0xe5fe('0x24')](respondWithResult(_0xaa8050,null))[_0xe5fe('0x3f')](handleError(_0xaa8050,null));};exports[_0xe5fe('0x79')]=function(_0x400f0d,_0x5f12ac,_0x4819fc){return db[_0xe5fe('0x3c')][_0xe5fe('0x7a')]({'where':{'id':_0x400f0d[_0xe5fe('0x4f')]['id']}})[_0xe5fe('0x24')](function(_0x4a48cd){if(_0x4a48cd){if(!_0x400f0d['body'][_0xe5fe('0x71')]||!utils['isValidChannel'](_0x400f0d[_0xe5fe('0x46')][_0xe5fe('0x71')])){throw new db[(_0xe5fe('0x54'))][(_0xe5fe('0x7b'))](_0xe5fe('0x72'));}return _0x4a48cd[_0xe5fe('0x7c')+_[_0xe5fe('0x77')](_0x400f0d[_0xe5fe('0x46')][_0xe5fe('0x71')][_0xe5fe('0x73')]())+_0xe5fe('0x78')](_0x400f0d[_0xe5fe('0x46')][_0xe5fe('0x7d')]);}return null;})[_0xe5fe('0x24')](handleEntityNotFound(_0x5f12ac,null))['then'](respondWithStatusCode(_0x5f12ac,null))['catch'](handleError(_0x5f12ac,null));};exports[_0xe5fe('0x7e')]=function(_0x5353a2,_0x37dcaf,_0x2aa013){return db[_0xe5fe('0x3c')][_0xe5fe('0x7a')]({'where':{'id':_0x5353a2[_0xe5fe('0x4f')]['id']}})[_0xe5fe('0x24')](function(_0x21c7f1){if(_0x21c7f1){if(!_0x5353a2[_0xe5fe('0x2f')][_0xe5fe('0x71')]||!utils[_0xe5fe('0x70')](_0x5353a2[_0xe5fe('0x2f')]['channel'])){throw new db[(_0xe5fe('0x54'))][(_0xe5fe('0x7b'))]('Unknown\x20channel');}return _0x21c7f1[_0xe5fe('0x7f')+_[_0xe5fe('0x77')](_0x5353a2[_0xe5fe('0x2f')][_0xe5fe('0x71')][_0xe5fe('0x73')]())+_0xe5fe('0x78')](_0x5353a2[_0xe5fe('0x2f')]['ids']);}return null;})[_0xe5fe('0x24')](handleEntityNotFound(_0x37dcaf,null))['then'](respondWithStatusCode(_0x37dcaf,null))['catch'](handleError(_0x37dcaf,null));};exports[_0xe5fe('0x80')]=function(_0x46de2f,_0x5d21a6){var _0xc6f5fc=_['isArray'](_0x46de2f['body'][_0xe5fe('0x7d')])?_0x46de2f[_0xe5fe('0x46')][_0xe5fe('0x7d')]:[_0x46de2f[_0xe5fe('0x46')]['ids']];var _0x1b4e91=_0x46de2f[_0xe5fe('0x4f')]['id'];return db[_0xe5fe('0x3c')]['find']({'where':{'id':_0x1b4e91}})[_0xe5fe('0x24')](handleEntityNotFound(_0x5d21a6,null))['then'](function(_0x383eff){if(_0x383eff){var _0x311b95=[_0xe5fe('0x81'),_0xe5fe('0x82'),_0xe5fe('0x83'),_0xe5fe('0x84'),_0xe5fe('0x85'),_0xe5fe('0x86'),'Whatsapp'];return db[_0xe5fe('0x53')][_0xe5fe('0x51')](function(_0x1534d9){var _0x4d4b04=_['map'](_0x311b95,function(_0x5aaf00){var _0x276c9c={'attributes':['id',_0xe5fe('0x27')]};if(_0x5aaf00===_0xe5fe('0x81')){_0x276c9c[_0xe5fe('0x87')]={'attributes':[_0xe5fe('0x88')]};}return _0x383eff[_0xe5fe('0x48')+_0x5aaf00+_0xe5fe('0x78')](_0x276c9c)[_0xe5fe('0x24')](function(_0x3d4be1){var _0x28904a=_[_0xe5fe('0x29')](_0x3d4be1,function(_0x2890ef){var _0x1ab535=_[_0xe5fe('0x29')](_0xc6f5fc,function(_0xf82f8){var _0x3a7180={'where':{'UserId':_0xf82f8,[_0x5aaf00+_0xe5fe('0x89')]:_0x2890ef['id']},'transaction':_0x1534d9};if(_0x5aaf00===_0xe5fe('0x81')){_0x3a7180[_0xe5fe('0x8a')]={'penalty':_0x2890ef[_0xe5fe('0x8b')][_0xe5fe('0x88')]};}return db['User'+_0x5aaf00+_0xe5fe('0x74')][_0xe5fe('0x8c')](_0x3a7180)[_0xe5fe('0x24')](function(){socket[_0xe5fe('0x8d')](_0xe5fe('0x47')+_0x5aaf00+'Queue:save',{'UserId':_0xf82f8,[_0x5aaf00+_0xe5fe('0x89')]:_0x2890ef['id']});if(_0x5aaf00!==_0xe5fe('0x81')){return;}return db['User']['findAll']({'where':{'id':_0xc6f5fc,'online':0x1},'attributes':['id',_0xe5fe('0x27'),_0xe5fe('0x8e'),_0xe5fe('0x8f'),_0xe5fe('0x90')],'raw':!![]})['then'](function(_0x409dd1){var _0x4b65b6=_[_0xe5fe('0x29')](_0x409dd1,function(_0x4b5c09){return db['UserVoiceQueueRt']['upsert']({'membername':_0x4b5c09[_0xe5fe('0x27')],'UserId':_0x4b5c09['id'],'queue_name':_0x2890ef[_0xe5fe('0x27')],'VoiceQueueId':_0x2890ef['id'],'interface':_[_0xe5fe('0x91')](_0x4b5c09[_0xe5fe('0x90')])?util['format'](_0xe5fe('0x92'),_0x4b5c09[_0xe5fe('0x27')]):_0x4b5c09[_0xe5fe('0x90')],'paused':_0x4b5c09['voicePause']||![],'penalty':_0x2890ef[_0xe5fe('0x8b')]['penalty']},{'transaction':_0x1534d9});});return Promise[_0xe5fe('0x93')](_0x4b65b6);});});});return Promise['all'](_0x1ab535);});return Promise[_0xe5fe('0x93')](_0x28904a);})[_0xe5fe('0x24')](function(){return db['TeamVoicePrefix']['findOne']({'where':{'teamId':_0x1b4e91}})[_0xe5fe('0x24')](function(_0x1ab1b8){if(_0x1ab1b8){var _0x1fa11f=_['map'](_0xc6f5fc,function(_0x4c89ab){db[_0xe5fe('0x6a')][_0xe5fe('0x94')]({'UserId':_0x4c89ab,'VoicePrefixId':_0x1ab1b8[_0xe5fe('0x6b')]});});return Promise[_0xe5fe('0x93')](_0x1fa11f);}});});});return Promise[_0xe5fe('0x93')](_0x4d4b04)[_0xe5fe('0x24')](function(){return _0x383eff[_0xe5fe('0x80')](_0xc6f5fc,{'transaction':_0x1534d9})['spread'](function(_0x3369f4){return _0x3369f4;});});});}})['then'](respondWithResult(_0x5d21a6,null))[_0xe5fe('0x3f')](handleError(_0x5d21a6,null));};exports[_0xe5fe('0x95')]=function(_0xdb8c59,_0x200c0a){var _0x146809=_[_0xe5fe('0x96')](_0xdb8c59[_0xe5fe('0x2f')][_0xe5fe('0x7d')])?_0xdb8c59[_0xe5fe('0x2f')][_0xe5fe('0x7d')]:[_0xdb8c59[_0xe5fe('0x2f')][_0xe5fe('0x7d')]];var _0x283490=_0xdb8c59[_0xe5fe('0x4f')]['id'];return db[_0xe5fe('0x3c')][_0xe5fe('0x44')]({'where':{'id':_0x283490}})[_0xe5fe('0x24')](handleEntityNotFound(_0x200c0a,null))[_0xe5fe('0x24')](function(_0x4d6690){if(_0x4d6690){var _0xe6f451=[_0xe5fe('0x81'),_0xe5fe('0x82'),_0xe5fe('0x83'),'Sms',_0xe5fe('0x85'),_0xe5fe('0x86'),_0xe5fe('0x97')];return db[_0xe5fe('0x53')]['transaction'](function(_0x1353a8){var _0x4aaa89=_[_0xe5fe('0x29')](_0xe6f451,function(_0xb72b50){var _0x216312={'attributes':['id','name']};return _0x4d6690[_0xe5fe('0x48')+_0xb72b50+'Queues'](_0x216312)[_0xe5fe('0x24')](function(_0x27225d){var _0x54e9f6=_[_0xe5fe('0x29')](_0x27225d,function(_0x119eb1){return _0x119eb1[_0xe5fe('0x95')](_0x146809,{'transaction':_0x1353a8})['then'](function(){var _0xe72135=_[_0xe5fe('0x29')](_0x146809,function(_0x2d2a8e){socket[_0xe5fe('0x8d')](_0xe5fe('0x47')+_0xb72b50+_0xe5fe('0x98'),{'UserId':Number(_0x2d2a8e),[_0xb72b50+_0xe5fe('0x89')]:_0x119eb1['id']});if(_0xb72b50!==_0xe5fe('0x81')){return;}return db[_0xe5fe('0x99')][_0xe5fe('0x50')]({'where':{'VoiceQueueId':_0x119eb1['id'],'UserId':_0x2d2a8e},'transaction':_0x1353a8});});return Promise[_0xe5fe('0x93')](_0xe72135);});});return Promise[_0xe5fe('0x93')](_0x54e9f6);});});return Promise[_0xe5fe('0x93')](_0x4aaa89)[_0xe5fe('0x24')](function(){return _0x4d6690['removeAgents'](_0x146809,{'transaction':_0x1353a8});})[_0xe5fe('0x24')](function(){return db[_0xe5fe('0x69')][_0xe5fe('0x7a')]({'where':{'teamId':_0x283490}})['then'](function(_0xe2911){if(_0xe2911){var _0x574c21=_[_0xe5fe('0x29')](_0x146809,function(_0x271513){db['UserVoicePrefix'][_0xe5fe('0x50')]({'where':{'UserId':_0x271513,'VoicePrefixId':_0xe2911[_0xe5fe('0x6b')]}});});return Promise[_0xe5fe('0x93')](_0x574c21);}});});});}})[_0xe5fe('0x24')](respondWithStatusCode(_0x200c0a,null))[_0xe5fe('0x3f')](handleError(_0x200c0a,null));};exports[_0xe5fe('0x9a')]=function(_0x5f5a3d,_0x555020,_0xfc7bb5){var _0x5b2d1c={};var _0x3cd2e4={};var _0x50af1b;var _0x218d77;return db['Team'][_0xe5fe('0x7a')]({'where':{'id':_0x5f5a3d['params']['id']}})['then'](handleEntityNotFound(_0x555020,null))[_0xe5fe('0x24')](function(_0x5e4b5b){if(_0x5e4b5b){_0x50af1b=_0x5e4b5b;_0x3cd2e4[_0xe5fe('0x2c')]=_[_0xe5fe('0x42')](db[_0xe5fe('0x9b')][_0xe5fe('0x41')]);_0x3cd2e4[_0xe5fe('0x2f')]=_[_0xe5fe('0x42')](_0x5f5a3d[_0xe5fe('0x2f')]);_0x3cd2e4[_0xe5fe('0x2d')]=_[_0xe5fe('0x2e')](_0x3cd2e4[_0xe5fe('0x2c')],_0x3cd2e4['query']);_0x5b2d1c[_0xe5fe('0x30')]=_['intersection'](_0x3cd2e4[_0xe5fe('0x2c')],qs[_0xe5fe('0x31')](_0x5f5a3d[_0xe5fe('0x2f')][_0xe5fe('0x31')]));_0x5b2d1c[_0xe5fe('0x30')]=_0x5b2d1c['attributes'][_0xe5fe('0x32')]?_0x5b2d1c[_0xe5fe('0x30')]:_0x3cd2e4['model'];_0x5b2d1c[_0xe5fe('0x75')]=qs[_0xe5fe('0x35')](_0x5f5a3d['query']['sort']);_0x5b2d1c[_0xe5fe('0x3a')]=qs['filters'](_['pick'](_0x5f5a3d[_0xe5fe('0x2f')],_0x3cd2e4[_0xe5fe('0x2d')]));if(_0x5f5a3d[_0xe5fe('0x2f')][_0xe5fe('0x37')]){_0x5b2d1c[_0xe5fe('0x3a')]=_[_0xe5fe('0x38')](_0x5b2d1c[_0xe5fe('0x3a')],{'$or':_[_0xe5fe('0x29')](_0x5b2d1c[_0xe5fe('0x30')],function(_0x1589b9){var _0x27b96f={};_0x27b96f[_0x1589b9]={'$like':'%'+_0x5f5a3d[_0xe5fe('0x2f')][_0xe5fe('0x37')]+'%'};return _0x27b96f;})});}_0x5b2d1c=_[_0xe5fe('0x38')]({},_0x5b2d1c,_0x5f5a3d['options']);return _0x50af1b['getAgents'](_0x5b2d1c);}})[_0xe5fe('0x24')](function(_0x34b570){if(_0x34b570){_0x218d77=_0x34b570[_0xe5fe('0x32')];if(!_0x5f5a3d[_0xe5fe('0x2f')][_0xe5fe('0x33')](_0xe5fe('0x34'))){_0x5b2d1c[_0xe5fe('0x1d')]=qs['limit'](_0x5f5a3d['query'][_0xe5fe('0x1d')]);_0x5b2d1c[_0xe5fe('0x1c')]=qs[_0xe5fe('0x1c')](_0x5f5a3d[_0xe5fe('0x2f')][_0xe5fe('0x1c')]);}return _0x50af1b[_0xe5fe('0x9a')](_0x5b2d1c);}})[_0xe5fe('0x24')](function(_0x317a79){if(_0x317a79){return _0x317a79?{'count':_0x218d77,'rows':_0x317a79}:null;}})[_0xe5fe('0x24')](respondWithResult(_0x555020,null))[_0xe5fe('0x3f')](handleError(_0x555020,null));}; \ No newline at end of file diff --git a/server/api/team/team.events.js b/server/api/team/team.events.js index 7cebaf0..838a62d 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 _0xd0aa=['hasOwnProperty','hook','exports','../../mysqldb','Team','setMaxListeners','save','update','remove','emit'];(function(_0x3daab5,_0x4c82c0){var _0x5c9961=function(_0xd26f32){while(--_0xd26f32){_0x3daab5['push'](_0x3daab5['shift']());}};_0x5c9961(++_0x4c82c0);}(_0xd0aa,0xd5));var _0xad0a=function(_0x413837,_0x4c72d){_0x413837=_0x413837-0x0;var _0x2c0361=_0xd0aa[_0x413837];return _0x2c0361;};'use strict';var EventEmitter=require('events');var Team=require(_0xad0a('0x0'))['db'][_0xad0a('0x1')];var TeamEvents=new EventEmitter();TeamEvents[_0xad0a('0x2')](0x0);var events={'afterCreate':_0xad0a('0x3'),'afterUpdate':_0xad0a('0x4'),'afterDestroy':_0xad0a('0x5')};function emitEvent(_0xe9d20e){return function(_0x42ab08,_0xe15023,_0x37f3c7){TeamEvents['emit'](_0xe9d20e+':'+_0x42ab08['id'],_0x42ab08);TeamEvents[_0xad0a('0x6')](_0xe9d20e,_0x42ab08);_0x37f3c7(null);};}for(var e in events){if(events[_0xad0a('0x7')](e)){var event=events[e];Team[_0xad0a('0x8')](e,emitEvent(event));}}module[_0xad0a('0x9')]=TeamEvents; \ No newline at end of file +var _0x5008=['update','emit','hasOwnProperty','hook','../../mysqldb','save'];(function(_0x41a24f,_0x2e74fb){var _0x2b4ccd=function(_0x393a8e){while(--_0x393a8e){_0x41a24f['push'](_0x41a24f['shift']());}};_0x2b4ccd(++_0x2e74fb);}(_0x5008,0x178));var _0x8500=function(_0x1f1a97,_0xadfc15){_0x1f1a97=_0x1f1a97-0x0;var _0x29fc6a=_0x5008[_0x1f1a97];return _0x29fc6a;};'use strict';var EventEmitter=require('events');var Team=require(_0x8500('0x0'))['db']['Team'];var TeamEvents=new EventEmitter();TeamEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x8500('0x1'),'afterUpdate':_0x8500('0x2'),'afterDestroy':'remove'};function emitEvent(_0xc7b92e){return function(_0x4194ec,_0x39baab,_0x104457){TeamEvents[_0x8500('0x3')](_0xc7b92e+':'+_0x4194ec['id'],_0x4194ec);TeamEvents[_0x8500('0x3')](_0xc7b92e,_0x4194ec);_0x104457(null);};}for(var e in events){if(events[_0x8500('0x4')](e)){var event=events[e];Team[_0x8500('0x5')](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 12f03c8..d67a930 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 _0xab74=['teams','Chat','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','map','all','Queues','then','setDataValue','catch','exports','define'];(function(_0x2aec52,_0x59d962){var _0x3b8835=function(_0x3e2604){while(--_0x3e2604){_0x2aec52['push'](_0x2aec52['shift']());}};_0x3b8835(++_0x59d962);}(_0xab74,0x17a));var _0x4ab7=function(_0x44ec35,_0x35c3f6){_0x44ec35=_0x44ec35-0x0;var _0x282db4=_0xab74[_0x44ec35];return _0x282db4;};'use strict';var _=require('lodash');var attributes=require('./team.attributes');function getQueuesByChannel(_0x494533,_0x46bd94){var _0x7a27a9='get'+_0x46bd94+_0x4ab7('0x0');return _0x494533[_0x7a27a9]()[_0x4ab7('0x1')](function(_0x82c134){return _['map'](_0x82c134,function(_0x5a1207){_0x5a1207[_0x4ab7('0x2')]('channel',_0x46bd94);return _0x5a1207;});})[_0x4ab7('0x3')](function(_0x1feb66){throw _0x1feb66;});}module[_0x4ab7('0x4')]=function(_0x4571d7){return _0x4571d7[_0x4ab7('0x5')]('Team',attributes,{'tableName':_0x4ab7('0x6'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x49fb99=this;var _0x1f2d3d=[_0x4ab7('0x7'),'Fax',_0x4ab7('0x8'),_0x4ab7('0x9'),_0x4ab7('0xa'),_0x4ab7('0xb'),_0x4ab7('0xc')];return Promise[_0x4ab7('0xd')]()[_0x4ab7('0x1')](function(){var _0x15cc07=_[_0x4ab7('0xe')](_0x1f2d3d,function(_0x31cf72){return getQueuesByChannel(_0x49fb99,_0x31cf72);});return Promise[_0x4ab7('0xf')](_0x15cc07);})[_0x4ab7('0x3')](function(_0x5943b6){throw _0x5943b6;});}}});}; \ No newline at end of file +var _0x07bf=['then','setDataValue','channel','catch','define','Team','teams','Chat','Fax','Mail','Openchannel','Sms','Voice','Whatsapp','resolve','lodash','get','Queues'];(function(_0x149319,_0x4182b5){var _0x4637c9=function(_0x2ff6ce){while(--_0x2ff6ce){_0x149319['push'](_0x149319['shift']());}};_0x4637c9(++_0x4182b5);}(_0x07bf,0x189));var _0xf07b=function(_0x3d5ab4,_0x589189){_0x3d5ab4=_0x3d5ab4-0x0;var _0xdd8f15=_0x07bf[_0x3d5ab4];return _0xdd8f15;};'use strict';var _=require(_0xf07b('0x0'));var attributes=require('./team.attributes');function getQueuesByChannel(_0x56c97d,_0x3992ac){var _0xf9d29=_0xf07b('0x1')+_0x3992ac+_0xf07b('0x2');return _0x56c97d[_0xf9d29]()[_0xf07b('0x3')](function(_0x260671){return _['map'](_0x260671,function(_0x2e7391){_0x2e7391[_0xf07b('0x4')](_0xf07b('0x5'),_0x3992ac);return _0x2e7391;});})[_0xf07b('0x6')](function(_0x46ef1c){throw _0x46ef1c;});}module['exports']=function(_0xfc09bf){return _0xfc09bf[_0xf07b('0x7')](_0xf07b('0x8'),attributes,{'tableName':_0xf07b('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'getAssociatedQueues':function(){var _0x5eae8b=this;var _0x2afa84=[_0xf07b('0xa'),_0xf07b('0xb'),_0xf07b('0xc'),_0xf07b('0xd'),_0xf07b('0xe'),_0xf07b('0xf'),_0xf07b('0x10')];return Promise[_0xf07b('0x11')]()[_0xf07b('0x3')](function(){var _0x100d2a=_['map'](_0x2afa84,function(_0x3e761e){return getQueuesByChannel(_0x5eae8b,_0x3e761e);});return Promise['all'](_0x100d2a);})[_0xf07b('0x6')](function(_0x52eac4){throw _0x52eac4;});}}});}; \ No newline at end of file diff --git a/server/api/team/team.rpc.js b/server/api/team/team.rpc.js index 74f1d19..0f525fd 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 _0xa500=['ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','localhost','socket.io-emitter','register','request','then','info','Team,\x20%s,\x20%s','request\x20sent','debug','error','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x502c7d,_0x2f1285){var _0x30b7ed=function(_0x2d92f3){while(--_0x2d92f3){_0x502c7d['push'](_0x502c7d['shift']());}};_0x30b7ed(++_0x2f1285);}(_0xa500,0x1ef));var _0x0a50=function(_0x25c1d3,_0x4f41c6){_0x25c1d3=_0x25c1d3-0x0;var _0x11afe1=_0xa500[_0x25c1d3];return _0x11afe1;};'use strict';var _=require(_0x0a50('0x0'));var util=require(_0x0a50('0x1'));var moment=require(_0x0a50('0x2'));var BPromise=require(_0x0a50('0x3'));var rs=require(_0x0a50('0x4'));var fs=require('fs');var Redis=require(_0x0a50('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x0a50('0x6'));var logger=require(_0x0a50('0x7'))(_0x0a50('0x8'));var config=require('../../config/environment');var jayson=require(_0x0a50('0x9'));var client=jayson[_0x0a50('0xa')]['http']({'port':0x232a});config[_0x0a50('0xb')]=_['defaults'](config[_0x0a50('0xb')],{'host':_0x0a50('0xc'),'port':0x18eb});var socket=require(_0x0a50('0xd'))(new Redis(config['redis']));require('./team.socket')[_0x0a50('0xe')](socket);function respondWithRpcPromise(_0x5e4406,_0x5a7b1b,_0x4954f8){return new BPromise(function(_0x166fa0,_0xac6328){return client[_0x0a50('0xf')](_0x5e4406,_0x4954f8)[_0x0a50('0x10')](function(_0x50504c){logger[_0x0a50('0x11')](_0x0a50('0x12'),_0x5a7b1b,_0x0a50('0x13'));logger[_0x0a50('0x14')]('Team,\x20%s,\x20%s,\x20%s',_0x5a7b1b,'request\x20sent',JSON['stringify'](_0x50504c));if(_0x50504c[_0x0a50('0x15')]){if(_0x50504c[_0x0a50('0x15')]['code']===0x1f4){logger[_0x0a50('0x15')](_0x0a50('0x12'),_0x5a7b1b,_0x50504c['error'][_0x0a50('0x16')]);return _0xac6328(_0x50504c[_0x0a50('0x15')][_0x0a50('0x16')]);}logger[_0x0a50('0x15')](_0x0a50('0x12'),_0x5a7b1b,_0x50504c[_0x0a50('0x15')][_0x0a50('0x16')]);return _0x166fa0(_0x50504c[_0x0a50('0x15')][_0x0a50('0x16')]);}else{logger['info'](_0x0a50('0x12'),_0x5a7b1b,_0x0a50('0x13'));_0x166fa0(_0x50504c[_0x0a50('0x17')][_0x0a50('0x16')]);}})[_0x0a50('0x18')](function(_0x5e0f47){logger['error'](_0x0a50('0x12'),_0x5a7b1b,_0x5e0f47);_0xac6328(_0x5e0f47);});});} \ No newline at end of file +var _0x99d6=['ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','register','request','then','info','request\x20sent','debug','Team,\x20%s,\x20%s,\x20%s','error','code','message','Team,\x20%s,\x20%s','result','catch','lodash','randomstring'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x99d6,0x193));var _0x699d=function(_0x35ef6b,_0x202c42){_0x35ef6b=_0x35ef6b-0x0;var _0x3ad145=_0x99d6[_0x35ef6b];return _0x3ad145;};'use strict';var _=require(_0x699d('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x699d('0x1'));var fs=require('fs');var Redis=require(_0x699d('0x2'));var db=require(_0x699d('0x3'))['db'];var utils=require(_0x699d('0x4'));var logger=require(_0x699d('0x5'))(_0x699d('0x6'));var config=require(_0x699d('0x7'));var jayson=require(_0x699d('0x8'));var client=jayson[_0x699d('0x9')][_0x699d('0xa')]({'port':0x232a});config[_0x699d('0xb')]=_[_0x699d('0xc')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x699d('0xd'))(new Redis(config[_0x699d('0xb')]));require('./team.socket')[_0x699d('0xe')](socket);function respondWithRpcPromise(_0x306e61,_0x49616c,_0xf6f99b){return new BPromise(function(_0x23bc4c,_0x3beb18){return client[_0x699d('0xf')](_0x306e61,_0xf6f99b)[_0x699d('0x10')](function(_0xf04185){logger[_0x699d('0x11')]('Team,\x20%s,\x20%s',_0x49616c,_0x699d('0x12'));logger[_0x699d('0x13')](_0x699d('0x14'),_0x49616c,_0x699d('0x12'),JSON['stringify'](_0xf04185));if(_0xf04185[_0x699d('0x15')]){if(_0xf04185['error'][_0x699d('0x16')]===0x1f4){logger[_0x699d('0x15')]('Team,\x20%s,\x20%s',_0x49616c,_0xf04185[_0x699d('0x15')][_0x699d('0x17')]);return _0x3beb18(_0xf04185[_0x699d('0x15')][_0x699d('0x17')]);}logger[_0x699d('0x15')](_0x699d('0x18'),_0x49616c,_0xf04185[_0x699d('0x15')][_0x699d('0x17')]);return _0x23bc4c(_0xf04185['error'][_0x699d('0x17')]);}else{logger[_0x699d('0x11')](_0x699d('0x18'),_0x49616c,_0x699d('0x12'));_0x23bc4c(_0xf04185[_0x699d('0x19')][_0x699d('0x17')]);}})[_0x699d('0x1a')](function(_0x49a6e2){logger[_0x699d('0x15')]('Team,\x20%s,\x20%s',_0x49616c,_0x49a6e2);_0x3beb18(_0x49a6e2);});});} \ No newline at end of file diff --git a/server/api/team/team.socket.js b/server/api/team/team.socket.js index e076cc6..50739b5 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 _0xc357=['remove','update','emit','removeListener','length','team:','save'];(function(_0x555800,_0x489d4c){var _0x27a4ef=function(_0x22b64e){while(--_0x22b64e){_0x555800['push'](_0x555800['shift']());}};_0x27a4ef(++_0x489d4c);}(_0xc357,0x8b));var _0x7c35=function(_0x5da28d,_0x3b019a){_0x5da28d=_0x5da28d-0x0;var _0x56fd02=_0xc357[_0x5da28d];return _0x56fd02;};'use strict';var TeamEvents=require('./team.events');var events=[_0x7c35('0x0'),_0x7c35('0x1'),_0x7c35('0x2')];function createListener(_0x5ca00c,_0x3935db){return function(_0x341efd){_0x3935db[_0x7c35('0x3')](_0x5ca00c,_0x341efd);};}function removeListener(_0x202049,_0x2a3cca){return function(){TeamEvents[_0x7c35('0x4')](_0x202049,_0x2a3cca);};}exports['register']=function(_0x2b1f35){for(var _0x146120=0x0,_0x4697dc=events[_0x7c35('0x5')];_0x146120<_0x4697dc;_0x146120++){var _0x2829ad=events[_0x146120];var _0x2acfc9=createListener(_0x7c35('0x6')+_0x2829ad,_0x2b1f35);TeamEvents['on'](_0x2829ad,_0x2acfc9);}}; \ No newline at end of file +var _0xaa10=['emit','removeListener','length','team:','./team.events','save','remove','update'];(function(_0xce3d93,_0x504f1c){var _0x16bcf8=function(_0xff82f3){while(--_0xff82f3){_0xce3d93['push'](_0xce3d93['shift']());}};_0x16bcf8(++_0x504f1c);}(_0xaa10,0x1ac));var _0x0aa1=function(_0x59dcc1,_0xce12c3){_0x59dcc1=_0x59dcc1-0x0;var _0x1d92bb=_0xaa10[_0x59dcc1];return _0x1d92bb;};'use strict';var TeamEvents=require(_0x0aa1('0x0'));var events=[_0x0aa1('0x1'),_0x0aa1('0x2'),_0x0aa1('0x3')];function createListener(_0x8d4477,_0x544b10){return function(_0x13adc0){_0x544b10[_0x0aa1('0x4')](_0x8d4477,_0x13adc0);};}function removeListener(_0x5ae858,_0x2f9c28){return function(){TeamEvents[_0x0aa1('0x5')](_0x5ae858,_0x2f9c28);};}exports['register']=function(_0x33c2c8){for(var _0x73f4ec=0x0,_0x10ceb0=events[_0x0aa1('0x6')];_0x73f4ec<_0x10ceb0;_0x73f4ec++){var _0x3d2840=events[_0x73f4ec];var _0x5399b2=createListener(_0x0aa1('0x7')+_0x3d2840,_0x33c2c8);TeamEvents['on'](_0x3d2840,_0x5399b2);}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js index 6297dc2..a7ea01e 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8f7d=['exports','INTEGER','sequelize'];(function(_0x2fe882,_0x1f4e97){var _0x53bf6f=function(_0x25147b){while(--_0x25147b){_0x2fe882['push'](_0x2fe882['shift']());}};_0x53bf6f(++_0x1f4e97);}(_0x8f7d,0xf5));var _0xd8f7=function(_0x4ede22,_0x7770ed){_0x4ede22=_0x4ede22-0x0;var _0xf13a3c=_0x8f7d[_0x4ede22];return _0xf13a3c;};'use strict';var Sequelize=require(_0xd8f7('0x0'));module[_0xd8f7('0x1')]={'TeamId':{'type':Sequelize['INTEGER']},'VoicePrefixId':{'type':Sequelize[_0xd8f7('0x2')]}}; \ No newline at end of file +var _0xb677=['INTEGER','sequelize'];(function(_0x138adb,_0x193fee){var _0x1b27f2=function(_0x5e97a2){while(--_0x5e97a2){_0x138adb['push'](_0x138adb['shift']());}};_0x1b27f2(++_0x193fee);}(_0xb677,0x119));var _0x7b67=function(_0x5a6127,_0x6d773){_0x5a6127=_0x5a6127-0x0;var _0x40197c=_0xb677[_0x5a6127];return _0x40197c;};'use strict';var Sequelize=require(_0x7b67('0x0'));module['exports']={'TeamId':{'type':Sequelize[_0x7b67('0x1')]},'VoicePrefixId':{'type':Sequelize[_0x7b67('0x1')]}}; \ No newline at end of file diff --git a/server/api/teamVoicePrefix/teamVoicePrefix.model.js b/server/api/teamVoicePrefix/teamVoicePrefix.model.js index 154fa99..9ab2f1c 100644 --- a/server/api/teamVoicePrefix/teamVoicePrefix.model.js +++ b/server/api/teamVoicePrefix/teamVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0427=['api','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoicePrefix.attributes','exports','define','TeamVoicePrefix','team_has_voice_prefixes','../../config/logger'];(function(_0x95b616,_0x296372){var _0x596532=function(_0x384b06){while(--_0x384b06){_0x95b616['push'](_0x95b616['shift']());}};_0x596532(++_0x296372);}(_0x0427,0x137));var _0x7042=function(_0x50ea27,_0x435099){_0x50ea27=_0x50ea27-0x0;var _0x26972d=_0x0427[_0x50ea27];return _0x26972d;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x7042('0x0'))(_0x7042('0x1'));var moment=require('moment');var BPromise=require(_0x7042('0x2'));var rp=require(_0x7042('0x3'));var fs=require('fs');var path=require(_0x7042('0x4'));var rimraf=require(_0x7042('0x5'));var config=require(_0x7042('0x6'));var attributes=require(_0x7042('0x7'));module[_0x7042('0x8')]=function(_0x53ab81,_0x37a35b){return _0x53ab81[_0x7042('0x9')](_0x7042('0xa'),attributes,{'tableName':_0x7042('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3d45=['../../config/environment','define','TeamVoicePrefix','team_has_voice_prefixes','lodash','util','../../config/logger','api','moment','request-promise','path'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x3d45,0x1d2));var _0x53d4=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0x3d45[_0x28947d];return _0x12d2ee;};'use strict';var _=require(_0x53d4('0x0'));var util=require(_0x53d4('0x1'));var logger=require(_0x53d4('0x2'))(_0x53d4('0x3'));var moment=require(_0x53d4('0x4'));var BPromise=require('bluebird');var rp=require(_0x53d4('0x5'));var fs=require('fs');var path=require(_0x53d4('0x6'));var rimraf=require('rimraf');var config=require(_0x53d4('0x7'));var attributes=require('./teamVoicePrefix.attributes');module['exports']=function(_0x4cfea8,_0x54b0a4){return _0x4cfea8[_0x53d4('0x8')](_0x53d4('0x9'),attributes,{'tableName':_0x53d4('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/index.js b/server/api/teamVoiceQueue/index.js index d5300db..5728dc6 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 _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x5a9197,_0x2a1c8f){var _0x4f9431=function(_0x184f2b){while(--_0x184f2b){_0x5a9197['push'](_0x5a9197['shift']());}};_0x4f9431(++_0x2a1c8f);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file +var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x163796,_0x24d48f){var _0x295beb=function(_0x553b75){while(--_0x553b75){_0x163796['push'](_0x163796['shift']());}};_0x295beb(++_0x24d48f);}(_0x70e0,0x17b));var _0x070e=function(_0x47aba7,_0x26155b){_0x47aba7=_0x47aba7-0x0;var _0x50099c=_0x70e0[_0x47aba7];return _0x50099c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js b/server/api/teamVoiceQueue/teamVoiceQueue.attributes.js index 7aa4c23..35bfc3b 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 _0xd043=['exports','INTEGER','sequelize'];(function(_0x12d4a4,_0x2bf452){var _0x36f176=function(_0x5bb4c4){while(--_0x5bb4c4){_0x12d4a4['push'](_0x12d4a4['shift']());}};_0x36f176(++_0x2bf452);}(_0xd043,0x143));var _0x3d04=function(_0xa82688,_0x3d82f0){_0xa82688=_0xa82688-0x0;var _0x5c1582=_0xd043[_0xa82688];return _0x5c1582;};'use strict';var Sequelize=require(_0x3d04('0x0'));module[_0x3d04('0x1')]={'penalty':{'type':Sequelize[_0x3d04('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x95d6=['exports'];(function(_0x409deb,_0x2b731){var _0x15a4f7=function(_0x556510){while(--_0x556510){_0x409deb['push'](_0x409deb['shift']());}};_0x15a4f7(++_0x2b731);}(_0x95d6,0xdf));var _0x695d=function(_0x1ce1e2,_0x1e00ea){_0x1ce1e2=_0x1ce1e2-0x0;var _0xfeba07=_0x95d6[_0x1ce1e2];return _0xfeba07;};'use strict';var Sequelize=require('sequelize');module[_0x695d('0x0')]={'penalty':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/teamVoiceQueue/teamVoiceQueue.model.js b/server/api/teamVoiceQueue/teamVoiceQueue.model.js index 6f62415..d0fe0f7 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 _0x636f=['request-promise','rimraf','../../config/environment','./teamVoiceQueue.attributes','exports','define','TeamVoiceQueue','team_has_voice_queues','../../config/logger','api','moment','bluebird'];(function(_0x1719ed,_0x10d1f3){var _0x5d46be=function(_0x4ece5b){while(--_0x4ece5b){_0x1719ed['push'](_0x1719ed['shift']());}};_0x5d46be(++_0x10d1f3);}(_0x636f,0x188));var _0xf636=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x636f[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xf636('0x0'))(_0xf636('0x1'));var moment=require(_0xf636('0x2'));var BPromise=require(_0xf636('0x3'));var rp=require(_0xf636('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xf636('0x5'));var config=require(_0xf636('0x6'));var attributes=require(_0xf636('0x7'));module[_0xf636('0x8')]=function(_0x39c5f1,_0x526990){return _0x39c5f1[_0xf636('0x9')](_0xf636('0xa'),attributes,{'tableName':_0xf636('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x57d4=['exports','TeamVoiceQueue','team_has_voice_queues','lodash','util','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./teamVoiceQueue.attributes'];(function(_0x22b68a,_0x2bffc3){var _0x1ac67a=function(_0x25f9d5){while(--_0x25f9d5){_0x22b68a['push'](_0x22b68a['shift']());}};_0x1ac67a(++_0x2bffc3);}(_0x57d4,0x78));var _0x457d=function(_0xc4b27b,_0x4188a6){_0xc4b27b=_0xc4b27b-0x0;var _0xf3f6cd=_0x57d4[_0xc4b27b];return _0xf3f6cd;};'use strict';var _=require(_0x457d('0x0'));var util=require(_0x457d('0x1'));var logger=require('../../config/logger')(_0x457d('0x2'));var moment=require(_0x457d('0x3'));var BPromise=require(_0x457d('0x4'));var rp=require(_0x457d('0x5'));var fs=require('fs');var path=require(_0x457d('0x6'));var rimraf=require(_0x457d('0x7'));var config=require(_0x457d('0x8'));var attributes=require(_0x457d('0x9'));module[_0x457d('0xa')]=function(_0x247ec7,_0x3fd867){return _0x247ec7['define'](_0x457d('0xb'),attributes,{'tableName':_0x457d('0xc'),'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 490ed62..3699cb5 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 _0x8ccb=['ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','http','request','info','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','TeamVoiceQueue,\x20%s,\x20%s','message','request\x20sent','result','lodash','util','bluebird','randomstring'];(function(_0x1fd315,_0x34d10f){var _0x59b43f=function(_0x46751e){while(--_0x46751e){_0x1fd315['push'](_0x1fd315['shift']());}};_0x59b43f(++_0x34d10f);}(_0x8ccb,0x1c4));var _0xb8cc=function(_0x946518,_0x22816f){_0x946518=_0x946518-0x0;var _0x909b69=_0x8ccb[_0x946518];return _0x909b69;};'use strict';var _=require(_0xb8cc('0x0'));var util=require(_0xb8cc('0x1'));var moment=require('moment');var BPromise=require(_0xb8cc('0x2'));var rs=require(_0xb8cc('0x3'));var fs=require('fs');var Redis=require(_0xb8cc('0x4'));var db=require(_0xb8cc('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xb8cc('0x6'));var config=require(_0xb8cc('0x7'));var jayson=require(_0xb8cc('0x8'));var client=jayson['client'][_0xb8cc('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x349552,_0x139945,_0x56951f){return new BPromise(function(_0x35c86d,_0x2c338f){return client[_0xb8cc('0xa')](_0x349552,_0x56951f)['then'](function(_0x175473){logger[_0xb8cc('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x139945,'request\x20sent');logger[_0xb8cc('0xc')](_0xb8cc('0xd'),_0x139945,'request\x20sent',JSON['stringify'](_0x175473));if(_0x175473[_0xb8cc('0xe')]){if(_0x175473[_0xb8cc('0xe')]['code']===0x1f4){logger[_0xb8cc('0xe')](_0xb8cc('0xf'),_0x139945,_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);return _0x2c338f(_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);}logger[_0xb8cc('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x139945,_0x175473[_0xb8cc('0xe')]['message']);return _0x35c86d(_0x175473[_0xb8cc('0xe')][_0xb8cc('0x10')]);}else{logger[_0xb8cc('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x139945,_0xb8cc('0x11'));_0x35c86d(_0x175473[_0xb8cc('0x12')][_0xb8cc('0x10')]);}})['catch'](function(_0x2ba498){logger['error'](_0xb8cc('0xf'),_0x139945,_0x2ba498);_0x2c338f(_0x2ba498);});});} \ No newline at end of file +var _0xe356=['lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','TeamVoiceQueue,\x20%s,\x20%s','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','info','result'];(function(_0x503306,_0x356f2f){var _0x44a99d=function(_0x1a6ec4){while(--_0x1a6ec4){_0x503306['push'](_0x503306['shift']());}};_0x44a99d(++_0x356f2f);}(_0xe356,0x1ee));var _0x6e35=function(_0x49f72f,_0x54ff2f){_0x49f72f=_0x49f72f-0x0;var _0x49a339=_0xe356[_0x49f72f];return _0x49a339;};'use strict';var _=require(_0x6e35('0x0'));var util=require(_0x6e35('0x1'));var moment=require(_0x6e35('0x2'));var BPromise=require(_0x6e35('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6e35('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6e35('0x5'));var logger=require(_0x6e35('0x6'))(_0x6e35('0x7'));var config=require('../../config/environment');var jayson=require(_0x6e35('0x8'));var client=jayson[_0x6e35('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x389ae2,_0xba948e,_0x114b4c){return new BPromise(function(_0x1da99b,_0x5119fa){return client[_0x6e35('0xa')](_0x389ae2,_0x114b4c)['then'](function(_0x3b3c16){logger['info'](_0x6e35('0xb'),_0xba948e,'request\x20sent');logger['debug'](_0x6e35('0xc'),_0xba948e,_0x6e35('0xd'),JSON['stringify'](_0x3b3c16));if(_0x3b3c16['error']){if(_0x3b3c16[_0x6e35('0xe')][_0x6e35('0xf')]===0x1f4){logger[_0x6e35('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0xba948e,_0x3b3c16[_0x6e35('0xe')][_0x6e35('0x10')]);return _0x5119fa(_0x3b3c16[_0x6e35('0xe')]['message']);}logger[_0x6e35('0xe')](_0x6e35('0xb'),_0xba948e,_0x3b3c16[_0x6e35('0xe')]['message']);return _0x1da99b(_0x3b3c16[_0x6e35('0xe')][_0x6e35('0x10')]);}else{logger[_0x6e35('0x11')]('TeamVoiceQueue,\x20%s,\x20%s',_0xba948e,_0x6e35('0xd'));_0x1da99b(_0x3b3c16[_0x6e35('0x12')][_0x6e35('0x10')]);}})['catch'](function(_0x3e7e7a){logger[_0x6e35('0xe')](_0x6e35('0xb'),_0xba948e,_0x3e7e7a);_0x5119fa(_0x3e7e7a);});});} \ No newline at end of file diff --git a/server/api/template/index.js b/server/api/template/index.js index 1e52b10..45955cf 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 _0xa5d7=['exports','multer','util','path','connect-timeout','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/:id','post','create','put','update','delete','destroy'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa5d7,0x1c3));var _0x7a5d=function(_0x11d686,_0x497362){_0x11d686=_0x11d686-0x0;var _0x3e3566=_0xa5d7[_0x11d686];return _0x3e3566;};'use strict';var multer=require(_0x7a5d('0x0'));var util=require(_0x7a5d('0x1'));var path=require(_0x7a5d('0x2'));var timeout=require(_0x7a5d('0x3'));var express=require('express');var router=express[_0x7a5d('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0x7a5d('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7a5d('0x6'));var controller=require('./template.controller');router[_0x7a5d('0x7')]('/',auth[_0x7a5d('0x8')](),controller[_0x7a5d('0x9')]);router['get'](_0x7a5d('0xa'),auth[_0x7a5d('0x8')](),controller['show']);router[_0x7a5d('0xb')]('/',auth['isAuthenticated'](),controller[_0x7a5d('0xc')]);router[_0x7a5d('0xd')](_0x7a5d('0xa'),auth['isAuthenticated'](),controller[_0x7a5d('0xe')]);router[_0x7a5d('0xf')](_0x7a5d('0xa'),auth[_0x7a5d('0x8')](),controller[_0x7a5d('0x10')]);module[_0x7a5d('0x11')]=router; \ No newline at end of file +var _0x781d=['/:id','show','post','create','delete','exports','multer','util','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./template.controller','get','isAuthenticated','index'];(function(_0x196ddb,_0x29aea4){var _0x3d6407=function(_0x43e78a){while(--_0x43e78a){_0x196ddb['push'](_0x196ddb['shift']());}};_0x3d6407(++_0x29aea4);}(_0x781d,0x14a));var _0xd781=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x781d[_0x3b380d];return _0x54502b;};'use strict';var multer=require(_0xd781('0x0'));var util=require(_0xd781('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0xd781('0x2'));var router=express[_0xd781('0x3')]();var fs_extra=require(_0xd781('0x4'));var auth=require(_0xd781('0x5'));var interaction=require(_0xd781('0x6'));var config=require(_0xd781('0x7'));var controller=require(_0xd781('0x8'));router[_0xd781('0x9')]('/',auth[_0xd781('0xa')](),controller[_0xd781('0xb')]);router['get'](_0xd781('0xc'),auth[_0xd781('0xa')](),controller[_0xd781('0xd')]);router[_0xd781('0xe')]('/',auth['isAuthenticated'](),controller[_0xd781('0xf')]);router['put'](_0xd781('0xc'),auth[_0xd781('0xa')](),controller['update']);router[_0xd781('0x10')](_0xd781('0xc'),auth['isAuthenticated'](),controller['destroy']);module[_0xd781('0x11')]=router; \ No newline at end of file diff --git a/server/api/template/template.attributes.js b/server/api/template/template.attributes.js index 890d27b..35c06e7 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 _0x75ae=['sequelize','exports','STRING','TEXT'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x75ae,0x174));var _0xe75a=function(_0x2243f5,_0x18029c){_0x2243f5=_0x2243f5-0x0;var _0x2a1c50=_0x75ae[_0x2243f5];return _0x2a1c50;};'use strict';var Sequelize=require(_0xe75a('0x0'));module[_0xe75a('0x1')]={'name':{'type':Sequelize['STRING']},'description':{'type':Sequelize[_0xe75a('0x2')]},'html':{'type':Sequelize[_0xe75a('0x3')]}}; \ No newline at end of file +var _0x4d4f=['sequelize','exports','STRING','TEXT'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x4d4f,0x118));var _0xf4d4=function(_0x22f6e7,_0x316776){_0x22f6e7=_0x22f6e7-0x0;var _0x4ef26f=_0x4d4f[_0x22f6e7];return _0x4ef26f;};'use strict';var Sequelize=require(_0xf4d4('0x0'));module[_0xf4d4('0x1')]={'name':{'type':Sequelize[_0xf4d4('0x2')]},'description':{'type':Sequelize[_0xf4d4('0x2')]},'html':{'type':Sequelize[_0xf4d4('0x3')]}}; \ No newline at end of file diff --git a/server/api/template/template.controller.js b/server/api/template/template.controller.js index 129d86f..7f2967e 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 _0xc2ee=['map','Template','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','VIRTUAL','filter','merge','options','includeAll','include','rows','catch','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','find','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','params','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','to-csv','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','get','Templates','UserProfileResource','error','stack','name','send','index'];(function(_0x522453,_0x3f05a3){var _0x1f9be5=function(_0x4ccfb0){while(--_0x4ccfb0){_0x522453['push'](_0x522453['shift']());}};_0x1f9be5(++_0x3f05a3);}(_0xc2ee,0x7a));var _0xec2e=function(_0x257c0e,_0x4631da){_0x257c0e=_0x257c0e-0x0;var _0x393c16=_0xc2ee[_0x257c0e];return _0x393c16;};'use strict';var emlformat=require(_0xec2e('0x0'));var rimraf=require(_0xec2e('0x1'));var zipdir=require(_0xec2e('0x2'));var jsonpatch=require(_0xec2e('0x3'));var rp=require('request-promise');var moment=require(_0xec2e('0x4'));var BPromise=require(_0xec2e('0x5'));var Mustache=require('mustache');var util=require('util');var path=require('path');var sox=require('sox');var csv=require(_0xec2e('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xec2e('0x7'));var _=require(_0xec2e('0x8'));var squel=require(_0xec2e('0x9'));var crypto=require(_0xec2e('0xa'));var jsforce=require(_0xec2e('0xb'));var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0xec2e('0xc'));var Papa=require(_0xec2e('0xd'));var Redis=require('ioredis');var authService=require(_0xec2e('0xe'));var qs=require('../../components/parsers/qs');var as=require(_0xec2e('0xf'));var hardwareService=require(_0xec2e('0x10'));var logger=require(_0xec2e('0x11'))('api');var utils=require(_0xec2e('0x12'));var config=require(_0xec2e('0x13'));var licenseUtil=require(_0xec2e('0x14'));var db=require(_0xec2e('0x15'))['db'];function respondWithStatusCode(_0x52cc72,_0x2620b9){_0x2620b9=_0x2620b9||0xcc;return function(_0x2c607b){if(_0x2c607b){return _0x52cc72[_0xec2e('0x16')](_0x2620b9);}return _0x52cc72[_0xec2e('0x17')](_0x2620b9)[_0xec2e('0x18')]();};}function respondWithResult(_0x110d4c,_0x1a9442){_0x1a9442=_0x1a9442||0xc8;return function(_0x5c305d){if(_0x5c305d){return _0x110d4c[_0xec2e('0x17')](_0x1a9442)[_0xec2e('0x19')](_0x5c305d);}};}function respondWithFilteredResult(_0x2f90c2,_0x3d413d){return function(_0x381de2){if(_0x381de2){var _0xe6fe31=typeof _0x3d413d['offset']===_0xec2e('0x1a')&&typeof _0x3d413d[_0xec2e('0x1b')]==='undefined';var _0x5ac631=_0x381de2[_0xec2e('0x1c')];var _0x402da8=_0xe6fe31?0x0:_0x3d413d['offset'];var _0x56c576=_0xe6fe31?_0x381de2[_0xec2e('0x1c')]:_0x3d413d[_0xec2e('0x1d')]+_0x3d413d[_0xec2e('0x1b')];var _0x297c14;if(_0x56c576>=_0x5ac631){_0x56c576=_0x5ac631;_0x297c14=0xc8;}else{_0x297c14=0xce;}_0x2f90c2[_0xec2e('0x17')](_0x297c14);return _0x2f90c2[_0xec2e('0x1e')](_0xec2e('0x1f'),_0x402da8+'-'+_0x56c576+'/'+_0x5ac631)[_0xec2e('0x19')](_0x381de2);}return null;};}function patchUpdates(_0x5833f8){return function(_0x16ba52){try{jsonpatch[_0xec2e('0x20')](_0x16ba52,_0x5833f8,!![]);}catch(_0x3f5639){return BPromise[_0xec2e('0x21')](_0x3f5639);}return _0x16ba52[_0xec2e('0x22')]();};}function saveUpdates(_0x275359,_0x239fd2){return function(_0x310b5a){if(_0x310b5a){return _0x310b5a[_0xec2e('0x23')](_0x275359)[_0xec2e('0x24')](function(_0x3b9edc){return _0x3b9edc;});}return null;};}function removeEntity(_0x28e083,_0x15c710){return function(_0x40f3c5){if(_0x40f3c5){return _0x40f3c5[_0xec2e('0x25')]()[_0xec2e('0x24')](function(){var _0x96eddb=_0x40f3c5[_0xec2e('0x26')]({'plain':!![]});var _0x26d64d=_0xec2e('0x27');return db[_0xec2e('0x28')][_0xec2e('0x25')]({'where':{'type':_0x26d64d,'resourceId':_0x96eddb['id']}})[_0xec2e('0x24')](function(){return _0x40f3c5;});})[_0xec2e('0x24')](function(){_0x28e083['status'](0xcc)[_0xec2e('0x18')]();});}};}function handleEntityNotFound(_0xc41d71,_0x45f952){return function(_0x181c2e){if(!_0x181c2e){_0xc41d71[_0xec2e('0x16')](0x194);}return _0x181c2e;};}function handleError(_0x57c127,_0x2e4478){_0x2e4478=_0x2e4478||0x1f4;return function(_0x24b9db){logger[_0xec2e('0x29')](_0x24b9db[_0xec2e('0x2a')]);if(_0x24b9db[_0xec2e('0x2b')]){delete _0x24b9db[_0xec2e('0x2b')];}_0x57c127[_0xec2e('0x17')](_0x2e4478)[_0xec2e('0x2c')](_0x24b9db);};}exports[_0xec2e('0x2d')]=function(_0x4d61d3,_0x1f322a){var _0x2abbeb={},_0x4c56c0={},_0x12707c={'count':0x0,'rows':[]};var _0x58192c=_[_0xec2e('0x2e')](db[_0xec2e('0x2f')][_0xec2e('0x30')],function(_0x4904e4){return{'name':_0x4904e4[_0xec2e('0x31')],'type':_0x4904e4[_0xec2e('0x32')][_0xec2e('0x33')]};});_0x4c56c0[_0xec2e('0x34')]=_[_0xec2e('0x2e')](_0x58192c,'name');_0x4c56c0['query']=_[_0xec2e('0x35')](_0x4d61d3[_0xec2e('0x36')]);_0x4c56c0['filters']=_[_0xec2e('0x37')](_0x4c56c0[_0xec2e('0x34')],_0x4c56c0[_0xec2e('0x36')]);_0x2abbeb[_0xec2e('0x38')]=_[_0xec2e('0x37')](_0x4c56c0[_0xec2e('0x34')],qs[_0xec2e('0x39')](_0x4d61d3[_0xec2e('0x36')][_0xec2e('0x39')]));_0x2abbeb[_0xec2e('0x38')]=_0x2abbeb[_0xec2e('0x38')][_0xec2e('0x3a')]?_0x2abbeb[_0xec2e('0x38')]:_0x4c56c0[_0xec2e('0x34')];if(!_0x4d61d3[_0xec2e('0x36')][_0xec2e('0x3b')](_0xec2e('0x3c'))){_0x2abbeb[_0xec2e('0x1b')]=qs[_0xec2e('0x1b')](_0x4d61d3[_0xec2e('0x36')]['limit']);_0x2abbeb[_0xec2e('0x1d')]=qs[_0xec2e('0x1d')](_0x4d61d3[_0xec2e('0x36')][_0xec2e('0x1d')]);}_0x2abbeb[_0xec2e('0x3d')]=qs[_0xec2e('0x3e')](_0x4d61d3[_0xec2e('0x36')][_0xec2e('0x3e')]);_0x2abbeb[_0xec2e('0x3f')]=qs[_0xec2e('0x40')](_[_0xec2e('0x41')](_0x4d61d3[_0xec2e('0x36')],_0x4c56c0[_0xec2e('0x40')]),_0x58192c);if(_0x4d61d3['query']['filter']){_0x2abbeb[_0xec2e('0x3f')]=_['merge'](_0x2abbeb[_0xec2e('0x3f')],{'$or':_[_0xec2e('0x2e')](_0x58192c,function(_0x5576ca){if(_0x5576ca[_0xec2e('0x32')]!==_0xec2e('0x42')){var _0x529fd7={};_0x529fd7[_0x5576ca[_0xec2e('0x2b')]]={'$like':'%'+_0x4d61d3[_0xec2e('0x36')][_0xec2e('0x43')]+'%'};return _0x529fd7;}})});}_0x2abbeb=_[_0xec2e('0x44')]({},_0x2abbeb,_0x4d61d3[_0xec2e('0x45')]);var _0x5656d1={'where':_0x2abbeb[_0xec2e('0x3f')]};return db['Template']['count'](_0x5656d1)[_0xec2e('0x24')](function(_0x2d1aec){_0x12707c[_0xec2e('0x1c')]=_0x2d1aec;if(_0x4d61d3['query'][_0xec2e('0x46')]){_0x2abbeb[_0xec2e('0x47')]=[{'all':!![]}];}return db[_0xec2e('0x2f')]['findAll'](_0x2abbeb);})[_0xec2e('0x24')](function(_0x2e283e){_0x12707c[_0xec2e('0x48')]=_0x2e283e;return _0x12707c;})[_0xec2e('0x24')](respondWithFilteredResult(_0x1f322a,_0x2abbeb))['catch'](handleError(_0x1f322a,null));};exports['show']=function(_0xe4041a,_0x3d0aae){var _0xa2defd={'raw':!![],'where':{'id':_0xe4041a['params']['id']}},_0xff4659={};_0xff4659['model']=_['keys'](db[_0xec2e('0x2f')][_0xec2e('0x30')]);_0xff4659[_0xec2e('0x36')]=_[_0xec2e('0x35')](_0xe4041a['query']);_0xff4659[_0xec2e('0x40')]=_[_0xec2e('0x37')](_0xff4659[_0xec2e('0x34')],_0xff4659[_0xec2e('0x36')]);_0xa2defd[_0xec2e('0x38')]=_[_0xec2e('0x37')](_0xff4659['model'],qs[_0xec2e('0x39')](_0xe4041a['query'][_0xec2e('0x39')]));_0xa2defd[_0xec2e('0x38')]=_0xa2defd[_0xec2e('0x38')][_0xec2e('0x3a')]?_0xa2defd[_0xec2e('0x38')]:_0xff4659['model'];if(_0xe4041a['query'][_0xec2e('0x46')]){_0xa2defd[_0xec2e('0x47')]=[{'all':!![]}];}_0xa2defd=_['merge']({},_0xa2defd,_0xe4041a['options']);return db[_0xec2e('0x2f')]['find'](_0xa2defd)[_0xec2e('0x24')](handleEntityNotFound(_0x3d0aae,null))[_0xec2e('0x24')](respondWithResult(_0x3d0aae,null))[_0xec2e('0x49')](handleError(_0x3d0aae,null));};exports[_0xec2e('0x4a')]=function(_0x54cf78,_0x5128e1){return db[_0xec2e('0x2f')][_0xec2e('0x4a')](_0x54cf78['body'],{})['then'](function(_0x2d3471){var _0x6846df=_0x54cf78[_0xec2e('0x4b')][_0xec2e('0x26')]({'plain':!![]});if(!_0x6846df)throw new Error(_0xec2e('0x4c'));if(_0x6846df[_0xec2e('0x4d')]===_0xec2e('0x4b')){var _0x2408d4=_0x2d3471['get']({'plain':!![]});var _0x540a5d=_0xec2e('0x27');return db[_0xec2e('0x4e')][_0xec2e('0x4f')]({'where':{'name':_0x540a5d,'userProfileId':_0x6846df[_0xec2e('0x50')]},'raw':!![]})['then'](function(_0x2d98be){if(_0x2d98be&&_0x2d98be['autoAssociation']===0x0){return db[_0xec2e('0x28')][_0xec2e('0x4a')]({'name':_0x2408d4['name'],'resourceId':_0x2408d4['id'],'type':_0x2d98be['name'],'sectionId':_0x2d98be['id']},{})[_0xec2e('0x24')](function(){return _0x2d3471;});}else{return _0x2d3471;}})[_0xec2e('0x49')](function(_0x4f14df){logger[_0xec2e('0x29')](_0xec2e('0x51'),_0x4f14df);throw _0x4f14df;});}return _0x2d3471;})[_0xec2e('0x24')](respondWithResult(_0x5128e1,0xc9))['catch'](handleError(_0x5128e1,null));};exports[_0xec2e('0x23')]=function(_0xc5b632,_0x43197c){if(_0xc5b632[_0xec2e('0x52')]['id']){delete _0xc5b632[_0xec2e('0x52')]['id'];}return db[_0xec2e('0x2f')][_0xec2e('0x4f')]({'where':{'id':_0xc5b632[_0xec2e('0x53')]['id']}})['then'](handleEntityNotFound(_0x43197c,null))[_0xec2e('0x24')](saveUpdates(_0xc5b632[_0xec2e('0x52')],null))['then'](respondWithResult(_0x43197c,null))[_0xec2e('0x49')](handleError(_0x43197c,null));};exports[_0xec2e('0x25')]=function(_0x352112,_0x2bb040){return db[_0xec2e('0x2f')][_0xec2e('0x4f')]({'where':{'id':_0x352112[_0xec2e('0x53')]['id']}})['then'](handleEntityNotFound(_0x2bb040,null))[_0xec2e('0x24')](removeEntity(_0x2bb040,null))[_0xec2e('0x49')](handleError(_0x2bb040,null));}; \ No newline at end of file +var _0xd94f=['get','Templates','UserProfileResource','destroy','error','stack','name','send','index','map','Template','type','key','model','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','merge','where','VIRTUAL','options','includeAll','include','rows','catch','show','params','keys','rawAttributes','find','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','rimraf','zip-dir','request-promise','moment','mustache','util','path','fs-extra','crypto','jsforce','desk.js','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','save','update','then'];(function(_0x3d0386,_0x2263a1){var _0x3f442c=function(_0xe9006){while(--_0xe9006){_0x3d0386['push'](_0x3d0386['shift']());}};_0x3f442c(++_0x2263a1);}(_0xd94f,0x79));var _0xfd94=function(_0x29e0eb,_0x9acb52){_0x29e0eb=_0x29e0eb-0x0;var _0x597d2d=_0xd94f[_0x29e0eb];return _0x597d2d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xfd94('0x0'));var zipdir=require(_0xfd94('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xfd94('0x2'));var moment=require(_0xfd94('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xfd94('0x4'));var util=require(_0xfd94('0x5'));var path=require(_0xfd94('0x6'));var sox=require('sox');var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xfd94('0x7'));var _=require('lodash');var squel=require('squel');var crypto=require(_0xfd94('0x8'));var jsforce=require(_0xfd94('0x9'));var deskjs=require(_0xfd94('0xa'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xfd94('0xb'));var authService=require(_0xfd94('0xc'));var qs=require('../../components/parsers/qs');var as=require(_0xfd94('0xd'));var hardwareService=require(_0xfd94('0xe'));var logger=require(_0xfd94('0xf'))(_0xfd94('0x10'));var utils=require(_0xfd94('0x11'));var config=require(_0xfd94('0x12'));var licenseUtil=require('../../config/license/util');var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x1ae80c,_0xf87021){_0xf87021=_0xf87021||0xcc;return function(_0x2a1c43){if(_0x2a1c43){return _0x1ae80c[_0xfd94('0x13')](_0xf87021);}return _0x1ae80c[_0xfd94('0x14')](_0xf87021)[_0xfd94('0x15')]();};}function respondWithResult(_0x576384,_0x2a8aa3){_0x2a8aa3=_0x2a8aa3||0xc8;return function(_0x22f1dc){if(_0x22f1dc){return _0x576384[_0xfd94('0x14')](_0x2a8aa3)['json'](_0x22f1dc);}};}function respondWithFilteredResult(_0x47b133,_0x495ae3){return function(_0x5ec93c){if(_0x5ec93c){var _0x37f8b2=typeof _0x495ae3[_0xfd94('0x16')]===_0xfd94('0x17')&&typeof _0x495ae3[_0xfd94('0x18')]===_0xfd94('0x17');var _0x58f122=_0x5ec93c[_0xfd94('0x19')];var _0x2328c7=_0x37f8b2?0x0:_0x495ae3[_0xfd94('0x16')];var _0x44eb2d=_0x37f8b2?_0x5ec93c[_0xfd94('0x19')]:_0x495ae3['offset']+_0x495ae3['limit'];var _0x270c49;if(_0x44eb2d>=_0x58f122){_0x44eb2d=_0x58f122;_0x270c49=0xc8;}else{_0x270c49=0xce;}_0x47b133[_0xfd94('0x14')](_0x270c49);return _0x47b133['set'](_0xfd94('0x1a'),_0x2328c7+'-'+_0x44eb2d+'/'+_0x58f122)[_0xfd94('0x1b')](_0x5ec93c);}return null;};}function patchUpdates(_0x1ae423){return function(_0x14043a){try{jsonpatch['apply'](_0x14043a,_0x1ae423,!![]);}catch(_0xa5e9a9){return BPromise['reject'](_0xa5e9a9);}return _0x14043a[_0xfd94('0x1c')]();};}function saveUpdates(_0x267bba,_0x57b8e6){return function(_0x2154a8){if(_0x2154a8){return _0x2154a8[_0xfd94('0x1d')](_0x267bba)[_0xfd94('0x1e')](function(_0x499d29){return _0x499d29;});}return null;};}function removeEntity(_0x483282,_0x3764f8){return function(_0x5ba2be){if(_0x5ba2be){return _0x5ba2be['destroy']()[_0xfd94('0x1e')](function(){var _0xb0ec8d=_0x5ba2be[_0xfd94('0x1f')]({'plain':!![]});var _0x51fb9b=_0xfd94('0x20');return db[_0xfd94('0x21')][_0xfd94('0x22')]({'where':{'type':_0x51fb9b,'resourceId':_0xb0ec8d['id']}})[_0xfd94('0x1e')](function(){return _0x5ba2be;});})['then'](function(){_0x483282['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x36ee53,_0x3e2d44){return function(_0x1d7ec1){if(!_0x1d7ec1){_0x36ee53[_0xfd94('0x13')](0x194);}return _0x1d7ec1;};}function handleError(_0x2f39c1,_0x2b4ea5){_0x2b4ea5=_0x2b4ea5||0x1f4;return function(_0x2374d7){logger[_0xfd94('0x23')](_0x2374d7[_0xfd94('0x24')]);if(_0x2374d7[_0xfd94('0x25')]){delete _0x2374d7['name'];}_0x2f39c1[_0xfd94('0x14')](_0x2b4ea5)[_0xfd94('0x26')](_0x2374d7);};}exports[_0xfd94('0x27')]=function(_0x26bc6e,_0x16db4c){var _0x4076dc={},_0x540ae8={},_0x48cdb3={'count':0x0,'rows':[]};var _0x21a08f=_[_0xfd94('0x28')](db[_0xfd94('0x29')]['rawAttributes'],function(_0x15dde2){return{'name':_0x15dde2['fieldName'],'type':_0x15dde2[_0xfd94('0x2a')][_0xfd94('0x2b')]};});_0x540ae8[_0xfd94('0x2c')]=_[_0xfd94('0x28')](_0x21a08f,'name');_0x540ae8[_0xfd94('0x2d')]=_['keys'](_0x26bc6e['query']);_0x540ae8[_0xfd94('0x2e')]=_[_0xfd94('0x2f')](_0x540ae8['model'],_0x540ae8['query']);_0x4076dc[_0xfd94('0x30')]=_[_0xfd94('0x2f')](_0x540ae8[_0xfd94('0x2c')],qs[_0xfd94('0x31')](_0x26bc6e[_0xfd94('0x2d')][_0xfd94('0x31')]));_0x4076dc[_0xfd94('0x30')]=_0x4076dc[_0xfd94('0x30')][_0xfd94('0x32')]?_0x4076dc[_0xfd94('0x30')]:_0x540ae8['model'];if(!_0x26bc6e[_0xfd94('0x2d')][_0xfd94('0x33')](_0xfd94('0x34'))){_0x4076dc['limit']=qs[_0xfd94('0x18')](_0x26bc6e[_0xfd94('0x2d')][_0xfd94('0x18')]);_0x4076dc['offset']=qs['offset'](_0x26bc6e[_0xfd94('0x2d')][_0xfd94('0x16')]);}_0x4076dc[_0xfd94('0x35')]=qs[_0xfd94('0x36')](_0x26bc6e[_0xfd94('0x2d')][_0xfd94('0x36')]);_0x4076dc['where']=qs[_0xfd94('0x2e')](_[_0xfd94('0x37')](_0x26bc6e[_0xfd94('0x2d')],_0x540ae8[_0xfd94('0x2e')]),_0x21a08f);if(_0x26bc6e['query'][_0xfd94('0x38')]){_0x4076dc['where']=_[_0xfd94('0x39')](_0x4076dc[_0xfd94('0x3a')],{'$or':_[_0xfd94('0x28')](_0x21a08f,function(_0x1078f2){if(_0x1078f2['type']!==_0xfd94('0x3b')){var _0x4b8acd={};_0x4b8acd[_0x1078f2[_0xfd94('0x25')]]={'$like':'%'+_0x26bc6e[_0xfd94('0x2d')]['filter']+'%'};return _0x4b8acd;}})});}_0x4076dc=_[_0xfd94('0x39')]({},_0x4076dc,_0x26bc6e[_0xfd94('0x3c')]);var _0x2d9ea7={'where':_0x4076dc[_0xfd94('0x3a')]};return db[_0xfd94('0x29')][_0xfd94('0x19')](_0x2d9ea7)[_0xfd94('0x1e')](function(_0x30d4aa){_0x48cdb3[_0xfd94('0x19')]=_0x30d4aa;if(_0x26bc6e['query'][_0xfd94('0x3d')]){_0x4076dc[_0xfd94('0x3e')]=[{'all':!![]}];}return db[_0xfd94('0x29')]['findAll'](_0x4076dc);})[_0xfd94('0x1e')](function(_0x47ee2b){_0x48cdb3[_0xfd94('0x3f')]=_0x47ee2b;return _0x48cdb3;})['then'](respondWithFilteredResult(_0x16db4c,_0x4076dc))[_0xfd94('0x40')](handleError(_0x16db4c,null));};exports[_0xfd94('0x41')]=function(_0xb185ea,_0x264b77){var _0x4ac0f6={'raw':!![],'where':{'id':_0xb185ea[_0xfd94('0x42')]['id']}},_0x42617f={};_0x42617f[_0xfd94('0x2c')]=_[_0xfd94('0x43')](db[_0xfd94('0x29')][_0xfd94('0x44')]);_0x42617f[_0xfd94('0x2d')]=_[_0xfd94('0x43')](_0xb185ea[_0xfd94('0x2d')]);_0x42617f['filters']=_[_0xfd94('0x2f')](_0x42617f[_0xfd94('0x2c')],_0x42617f['query']);_0x4ac0f6[_0xfd94('0x30')]=_[_0xfd94('0x2f')](_0x42617f[_0xfd94('0x2c')],qs[_0xfd94('0x31')](_0xb185ea[_0xfd94('0x2d')]['fields']));_0x4ac0f6['attributes']=_0x4ac0f6[_0xfd94('0x30')][_0xfd94('0x32')]?_0x4ac0f6[_0xfd94('0x30')]:_0x42617f[_0xfd94('0x2c')];if(_0xb185ea['query'][_0xfd94('0x3d')]){_0x4ac0f6['include']=[{'all':!![]}];}_0x4ac0f6=_[_0xfd94('0x39')]({},_0x4ac0f6,_0xb185ea['options']);return db[_0xfd94('0x29')][_0xfd94('0x45')](_0x4ac0f6)[_0xfd94('0x1e')](handleEntityNotFound(_0x264b77,null))['then'](respondWithResult(_0x264b77,null))[_0xfd94('0x40')](handleError(_0x264b77,null));};exports['create']=function(_0x233902,_0x3500f3){return db['Template'][_0xfd94('0x46')](_0x233902['body'],{})['then'](function(_0x568e7c){var _0x1f2958=_0x233902[_0xfd94('0x47')][_0xfd94('0x1f')]({'plain':!![]});if(!_0x1f2958)throw new Error(_0xfd94('0x48'));if(_0x1f2958[_0xfd94('0x49')]===_0xfd94('0x47')){var _0xe8fcc6=_0x568e7c[_0xfd94('0x1f')]({'plain':!![]});var _0x158043=_0xfd94('0x20');return db['UserProfileSection']['find']({'where':{'name':_0x158043,'userProfileId':_0x1f2958['userProfileId']},'raw':!![]})[_0xfd94('0x1e')](function(_0x41b4f4){if(_0x41b4f4&&_0x41b4f4['autoAssociation']===0x0){return db[_0xfd94('0x21')][_0xfd94('0x46')]({'name':_0xe8fcc6['name'],'resourceId':_0xe8fcc6['id'],'type':_0x41b4f4['name'],'sectionId':_0x41b4f4['id']},{})['then'](function(){return _0x568e7c;});}else{return _0x568e7c;}})['catch'](function(_0x52b536){logger[_0xfd94('0x23')](_0xfd94('0x4a'),_0x52b536);throw _0x52b536;});}return _0x568e7c;})[_0xfd94('0x1e')](respondWithResult(_0x3500f3,0xc9))[_0xfd94('0x40')](handleError(_0x3500f3,null));};exports[_0xfd94('0x1d')]=function(_0x3daf5d,_0x3165d5){if(_0x3daf5d['body']['id']){delete _0x3daf5d[_0xfd94('0x4b')]['id'];}return db[_0xfd94('0x29')][_0xfd94('0x45')]({'where':{'id':_0x3daf5d[_0xfd94('0x42')]['id']}})[_0xfd94('0x1e')](handleEntityNotFound(_0x3165d5,null))['then'](saveUpdates(_0x3daf5d[_0xfd94('0x4b')],null))[_0xfd94('0x1e')](respondWithResult(_0x3165d5,null))['catch'](handleError(_0x3165d5,null));};exports[_0xfd94('0x22')]=function(_0x1cacf4,_0xa79553){return db['Template'][_0xfd94('0x45')]({'where':{'id':_0x1cacf4[_0xfd94('0x42')]['id']}})['then'](handleEntityNotFound(_0xa79553,null))[_0xfd94('0x1e')](removeEntity(_0xa79553,null))[_0xfd94('0x40')](handleError(_0xa79553,null));}; \ No newline at end of file diff --git a/server/api/template/template.model.js b/server/api/template/template.model.js index 03d64e1..9af4aa7 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 _0x21a0=['moment','bluebird','path','rimraf','../../config/environment','./template.attributes','define','Template','tools_templates','lodash','util','../../config/logger'];(function(_0x39fba9,_0x245311){var _0x3078c5=function(_0x4540ff){while(--_0x4540ff){_0x39fba9['push'](_0x39fba9['shift']());}};_0x3078c5(++_0x245311);}(_0x21a0,0x165));var _0x021a=function(_0x4c8742,_0x3f315a){_0x4c8742=_0x4c8742-0x0;var _0x5d56f9=_0x21a0[_0x4c8742];return _0x5d56f9;};'use strict';var _=require(_0x021a('0x0'));var util=require(_0x021a('0x1'));var logger=require(_0x021a('0x2'))('api');var moment=require(_0x021a('0x3'));var BPromise=require(_0x021a('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x021a('0x5'));var rimraf=require(_0x021a('0x6'));var config=require(_0x021a('0x7'));var attributes=require(_0x021a('0x8'));module['exports']=function(_0x4868fd,_0x1e2664){return _0x4868fd[_0x021a('0x9')](_0x021a('0xa'),attributes,{'tableName':_0x021a('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xfe07=['path','rimraf','../../config/environment','./template.attributes','exports','define','lodash','../../config/logger','api','moment','request-promise'];(function(_0x88cd7b,_0x4c884c){var _0x56fcc8=function(_0x513b3d){while(--_0x513b3d){_0x88cd7b['push'](_0x88cd7b['shift']());}};_0x56fcc8(++_0x4c884c);}(_0xfe07,0x124));var _0x7fe0=function(_0x27b760,_0x5d1a98){_0x27b760=_0x27b760-0x0;var _0x13d8af=_0xfe07[_0x27b760];return _0x13d8af;};'use strict';var _=require(_0x7fe0('0x0'));var util=require('util');var logger=require(_0x7fe0('0x1'))(_0x7fe0('0x2'));var moment=require(_0x7fe0('0x3'));var BPromise=require('bluebird');var rp=require(_0x7fe0('0x4'));var fs=require('fs');var path=require(_0x7fe0('0x5'));var rimraf=require(_0x7fe0('0x6'));var config=require(_0x7fe0('0x7'));var attributes=require(_0x7fe0('0x8'));module[_0x7fe0('0x9')]=function(_0x4e698f,_0x1194f9){return _0x4e698f[_0x7fe0('0xa')]('Template',attributes,{'tableName':'tools_templates','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 a186c38..acfe997 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 _0xd509=['code','message','result','GetTemplate','findAll','options','raw','where','limit','include','map','model','attributes','then','stringify','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','Template,\x20%s,\x20%s','request\x20sent','debug','Template,\x20%s,\x20%s,\x20%s','error'];(function(_0x2df13f,_0x3a3921){var _0x5c8a3f=function(_0x38aba4){while(--_0x38aba4){_0x2df13f['push'](_0x2df13f['shift']());}};_0x5c8a3f(++_0x3a3921);}(_0xd509,0x19c));var _0x9d50=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xd509[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x9d50('0x0'));var util=require('util');var moment=require(_0x9d50('0x1'));var BPromise=require(_0x9d50('0x2'));var rs=require(_0x9d50('0x3'));var fs=require('fs');var Redis=require(_0x9d50('0x4'));var db=require(_0x9d50('0x5'))['db'];var utils=require(_0x9d50('0x6'));var logger=require(_0x9d50('0x7'))(_0x9d50('0x8'));var config=require(_0x9d50('0x9'));var jayson=require(_0x9d50('0xa'));var client=jayson[_0x9d50('0xb')][_0x9d50('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2dc95c,_0x3b2776,_0x56c5d5){return new BPromise(function(_0x22c3c5,_0x349002){return client[_0x9d50('0xd')](_0x2dc95c,_0x56c5d5)['then'](function(_0x42a2b7){logger[_0x9d50('0xe')](_0x9d50('0xf'),_0x3b2776,_0x9d50('0x10'));logger[_0x9d50('0x11')](_0x9d50('0x12'),_0x3b2776,_0x9d50('0x10'),JSON['stringify'](_0x42a2b7));if(_0x42a2b7['error']){if(_0x42a2b7[_0x9d50('0x13')][_0x9d50('0x14')]===0x1f4){logger[_0x9d50('0x13')](_0x9d50('0xf'),_0x3b2776,_0x42a2b7[_0x9d50('0x13')][_0x9d50('0x15')]);return _0x349002(_0x42a2b7[_0x9d50('0x13')][_0x9d50('0x15')]);}logger[_0x9d50('0x13')]('Template,\x20%s,\x20%s',_0x3b2776,_0x42a2b7[_0x9d50('0x13')][_0x9d50('0x15')]);return _0x22c3c5(_0x42a2b7[_0x9d50('0x13')][_0x9d50('0x15')]);}else{logger['info'](_0x9d50('0xf'),_0x3b2776,'request\x20sent');_0x22c3c5(_0x42a2b7[_0x9d50('0x16')][_0x9d50('0x15')]);}})['catch'](function(_0x6405ef){logger[_0x9d50('0x13')](_0x9d50('0xf'),_0x3b2776,_0x6405ef);_0x349002(_0x6405ef);});});}exports[_0x9d50('0x17')]=function(_0x20e6d8){var _0x2aae16=this;return new Promise(function(_0x3753ba,_0x138a07){return db['Template'][_0x9d50('0x18')]({'raw':_0x20e6d8[_0x9d50('0x19')]?_0x20e6d8['options'][_0x9d50('0x1a')]===undefined?!![]:![]:!![],'where':_0x20e6d8['options']?_0x20e6d8['options'][_0x9d50('0x1b')]||null:null,'attributes':_0x20e6d8['options']?_0x20e6d8[_0x9d50('0x19')]['attributes']||null:null,'limit':_0x20e6d8['options']?_0x20e6d8[_0x9d50('0x19')][_0x9d50('0x1c')]||null:null,'include':_0x20e6d8[_0x9d50('0x19')]?_0x20e6d8[_0x9d50('0x19')][_0x9d50('0x1d')]?_[_0x9d50('0x1e')](_0x20e6d8[_0x9d50('0x19')]['include'],function(_0x3a530d){return{'model':db[_0x3a530d[_0x9d50('0x1f')]],'as':_0x3a530d['as'],'attributes':_0x3a530d['attributes'],'include':_0x3a530d[_0x9d50('0x1d')]?_[_0x9d50('0x1e')](_0x3a530d['include'],function(_0x2cc469){return{'model':db[_0x2cc469[_0x9d50('0x1f')]],'as':_0x2cc469['as'],'attributes':_0x2cc469[_0x9d50('0x20')],'include':_0x2cc469['include']?_[_0x9d50('0x1e')](_0x2cc469[_0x9d50('0x1d')],function(_0x71bf76){return{'model':db[_0x71bf76[_0x9d50('0x1f')]],'as':_0x71bf76['as'],'attributes':_0x71bf76[_0x9d50('0x20')]};}):[]};}):[]};}):[]:[]})[_0x9d50('0x21')](function(_0x2c5d40){logger['info'](_0x9d50('0x17'),_0x20e6d8);logger[_0x9d50('0x11')](_0x9d50('0x17'),_0x20e6d8,JSON[_0x9d50('0x22')](_0x2c5d40));_0x3753ba(_0x2c5d40);})[_0x9d50('0x23')](function(_0x1abf1e){logger[_0x9d50('0x13')]('GetTemplate',_0x1abf1e[_0x9d50('0x15')],_0x20e6d8);_0x138a07(_0x2aae16['error'](0x1f4,_0x1abf1e[_0x9d50('0x15')]));});});}; \ No newline at end of file +var _0x213c=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','info','Template,\x20%s,\x20%s','request\x20sent','Template,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','GetTemplate','Template','options','raw','where','limit','include','map','model','attributes','then','debug','stringify','lodash','moment'];(function(_0x5d4607,_0x6b5e7b){var _0x5e4a86=function(_0x46891a){while(--_0x46891a){_0x5d4607['push'](_0x5d4607['shift']());}};_0x5e4a86(++_0x6b5e7b);}(_0x213c,0xc4));var _0xc213=function(_0x326641,_0x64a869){_0x326641=_0x326641-0x0;var _0x4f37ef=_0x213c[_0x326641];return _0x4f37ef;};'use strict';var _=require(_0xc213('0x0'));var util=require('util');var moment=require(_0xc213('0x1'));var BPromise=require(_0xc213('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc213('0x3'));var db=require(_0xc213('0x4'))['db'];var utils=require(_0xc213('0x5'));var logger=require(_0xc213('0x6'))(_0xc213('0x7'));var config=require(_0xc213('0x8'));var jayson=require(_0xc213('0x9'));var client=jayson['client'][_0xc213('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x296daf,_0x277c6a,_0x1718f9){return new BPromise(function(_0x137ff3,_0x3c7b57){return client['request'](_0x296daf,_0x1718f9)['then'](function(_0x295397){logger[_0xc213('0xb')](_0xc213('0xc'),_0x277c6a,_0xc213('0xd'));logger['debug'](_0xc213('0xe'),_0x277c6a,_0xc213('0xd'),JSON['stringify'](_0x295397));if(_0x295397[_0xc213('0xf')]){if(_0x295397['error'][_0xc213('0x10')]===0x1f4){logger[_0xc213('0xf')](_0xc213('0xc'),_0x277c6a,_0x295397['error'][_0xc213('0x11')]);return _0x3c7b57(_0x295397['error']['message']);}logger['error'](_0xc213('0xc'),_0x277c6a,_0x295397[_0xc213('0xf')][_0xc213('0x11')]);return _0x137ff3(_0x295397[_0xc213('0xf')][_0xc213('0x11')]);}else{logger['info'](_0xc213('0xc'),_0x277c6a,_0xc213('0xd'));_0x137ff3(_0x295397[_0xc213('0x12')]['message']);}})[_0xc213('0x13')](function(_0x161722){logger['error']('Template,\x20%s,\x20%s',_0x277c6a,_0x161722);_0x3c7b57(_0x161722);});});}exports[_0xc213('0x14')]=function(_0xee67f3){var _0x65639e=this;return new Promise(function(_0x417868,_0x261680){return db[_0xc213('0x15')]['findAll']({'raw':_0xee67f3[_0xc213('0x16')]?_0xee67f3[_0xc213('0x16')][_0xc213('0x17')]===undefined?!![]:![]:!![],'where':_0xee67f3[_0xc213('0x16')]?_0xee67f3['options'][_0xc213('0x18')]||null:null,'attributes':_0xee67f3[_0xc213('0x16')]?_0xee67f3[_0xc213('0x16')]['attributes']||null:null,'limit':_0xee67f3['options']?_0xee67f3[_0xc213('0x16')][_0xc213('0x19')]||null:null,'include':_0xee67f3[_0xc213('0x16')]?_0xee67f3['options'][_0xc213('0x1a')]?_[_0xc213('0x1b')](_0xee67f3['options'][_0xc213('0x1a')],function(_0x3232bc){return{'model':db[_0x3232bc[_0xc213('0x1c')]],'as':_0x3232bc['as'],'attributes':_0x3232bc[_0xc213('0x1d')],'include':_0x3232bc['include']?_['map'](_0x3232bc[_0xc213('0x1a')],function(_0x57bf57){return{'model':db[_0x57bf57[_0xc213('0x1c')]],'as':_0x57bf57['as'],'attributes':_0x57bf57['attributes'],'include':_0x57bf57[_0xc213('0x1a')]?_['map'](_0x57bf57[_0xc213('0x1a')],function(_0x37f6ee){return{'model':db[_0x37f6ee[_0xc213('0x1c')]],'as':_0x37f6ee['as'],'attributes':_0x37f6ee[_0xc213('0x1d')]};}):[]};}):[]};}):[]:[]})[_0xc213('0x1e')](function(_0x53d8f4){logger[_0xc213('0xb')]('GetTemplate',_0xee67f3);logger[_0xc213('0x1f')](_0xc213('0x14'),_0xee67f3,JSON[_0xc213('0x20')](_0x53d8f4));_0x417868(_0x53d8f4);})[_0xc213('0x13')](function(_0xb35e4){logger[_0xc213('0xf')]('GetTemplate',_0xb35e4[_0xc213('0x11')],_0xee67f3);_0x261680(_0x65639e['error'](0x1f4,_0xb35e4[_0xc213('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/trigger/index.js b/server/api/trigger/index.js index 22c3663..f7ae651 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 _0x896e=['../../components/auth/service','../../components/interaction/service','../../config/environment','./trigger.controller','get','index','/:id','isAuthenticated','show','/:id/all_conditions','getAllConditions','/:id/any_conditions','getAnyConditions','/:id/actions','getActions','create','post','addAllCondition','addAnyCondition','addAction','put','update','delete','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0x5a037a,_0x44a3fc){var _0x28ff57=function(_0x13d49f){while(--_0x13d49f){_0x5a037a['push'](_0x5a037a['shift']());}};_0x28ff57(++_0x44a3fc);}(_0x896e,0x1e9));var _0xe896=function(_0x258545,_0x229853){_0x258545=_0x258545-0x0;var _0x35b821=_0x896e[_0x258545];return _0x35b821;};'use strict';var multer=require(_0xe896('0x0'));var util=require(_0xe896('0x1'));var path=require(_0xe896('0x2'));var timeout=require(_0xe896('0x3'));var express=require(_0xe896('0x4'));var router=express[_0xe896('0x5')]();var fs_extra=require(_0xe896('0x6'));var auth=require(_0xe896('0x7'));var interaction=require(_0xe896('0x8'));var config=require(_0xe896('0x9'));var controller=require(_0xe896('0xa'));router[_0xe896('0xb')]('/',auth['isAuthenticated'](),controller[_0xe896('0xc')]);router[_0xe896('0xb')](_0xe896('0xd'),auth[_0xe896('0xe')](),controller[_0xe896('0xf')]);router['get'](_0xe896('0x10'),auth[_0xe896('0xe')](),controller[_0xe896('0x11')]);router['get'](_0xe896('0x12'),auth['isAuthenticated'](),controller[_0xe896('0x13')]);router['get'](_0xe896('0x14'),auth[_0xe896('0xe')](),controller[_0xe896('0x15')]);router['post']('/',auth[_0xe896('0xe')](),controller[_0xe896('0x16')]);router[_0xe896('0x17')]('/:id/all_conditions',auth[_0xe896('0xe')](),controller[_0xe896('0x18')]);router[_0xe896('0x17')]('/:id/any_conditions',auth[_0xe896('0xe')](),controller[_0xe896('0x19')]);router[_0xe896('0x17')]('/:id/actions',auth['isAuthenticated'](),controller[_0xe896('0x1a')]);router[_0xe896('0x1b')]('/:id',auth['isAuthenticated'](),controller[_0xe896('0x1c')]);router[_0xe896('0x1d')]('/:id',auth[_0xe896('0xe')](),controller['destroy']);module[_0xe896('0x1e')]=router; \ No newline at end of file +var _0xc19a=['delete','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./trigger.controller','isAuthenticated','index','/:id','/:id/all_conditions','getAllConditions','get','/:id/any_conditions','getAnyConditions','getActions','post','addAllCondition','/:id/actions','addAction','update'];(function(_0x1e4734,_0x2da22d){var _0x128873=function(_0x5c02e8){while(--_0x5c02e8){_0x1e4734['push'](_0x1e4734['shift']());}};_0x128873(++_0x2da22d);}(_0xc19a,0x7f));var _0xac19=function(_0x3d48b3,_0x8ef6b8){_0x3d48b3=_0x3d48b3-0x0;var _0x5cef6e=_0xc19a[_0x3d48b3];return _0x5cef6e;};'use strict';var multer=require(_0xac19('0x0'));var util=require(_0xac19('0x1'));var path=require(_0xac19('0x2'));var timeout=require(_0xac19('0x3'));var express=require('express');var router=express[_0xac19('0x4')]();var fs_extra=require(_0xac19('0x5'));var auth=require(_0xac19('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xac19('0x7'));var controller=require(_0xac19('0x8'));router['get']('/',auth[_0xac19('0x9')](),controller[_0xac19('0xa')]);router['get'](_0xac19('0xb'),auth['isAuthenticated'](),controller['show']);router['get'](_0xac19('0xc'),auth[_0xac19('0x9')](),controller[_0xac19('0xd')]);router[_0xac19('0xe')](_0xac19('0xf'),auth[_0xac19('0x9')](),controller[_0xac19('0x10')]);router[_0xac19('0xe')]('/:id/actions',auth[_0xac19('0x9')](),controller[_0xac19('0x11')]);router[_0xac19('0x12')]('/',auth['isAuthenticated'](),controller['create']);router['post']('/:id/all_conditions',auth[_0xac19('0x9')](),controller[_0xac19('0x13')]);router['post']('/:id/any_conditions',auth[_0xac19('0x9')](),controller['addAnyCondition']);router[_0xac19('0x12')](_0xac19('0x14'),auth['isAuthenticated'](),controller[_0xac19('0x15')]);router['put'](_0xac19('0xb'),auth[_0xac19('0x9')](),controller[_0xac19('0x16')]);router[_0xac19('0x17')](_0xac19('0xb'),auth['isAuthenticated'](),controller['destroy']);module[_0xac19('0x18')]=router; \ No newline at end of file diff --git a/server/api/trigger/trigger.attributes.js b/server/api/trigger/trigger.attributes.js index 8c7a36d..a38aa6b 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 _0x61bb=['STRING','sequelize','exports'];(function(_0x3f3524,_0x384738){var _0x45e277=function(_0x68f882){while(--_0x68f882){_0x3f3524['push'](_0x3f3524['shift']());}};_0x45e277(++_0x384738);}(_0x61bb,0x1b1));var _0xb61b=function(_0x4a9499,_0xcc334f){_0x4a9499=_0x4a9499-0x0;var _0x1e960d=_0x61bb[_0x4a9499];return _0x1e960d;};'use strict';var Sequelize=require(_0xb61b('0x0'));module[_0xb61b('0x1')]={'name':{'type':Sequelize['STRING']},'channel':{'type':Sequelize[_0xb61b('0x2')]},'description':{'type':Sequelize['STRING']},'status':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x6aeb=['exports','STRING','BOOLEAN','sequelize'];(function(_0x532324,_0x336b78){var _0x49c22b=function(_0x5b00ee){while(--_0x5b00ee){_0x532324['push'](_0x532324['shift']());}};_0x49c22b(++_0x336b78);}(_0x6aeb,0x12b));var _0xb6ae=function(_0x4b4d43,_0x1590f7){_0x4b4d43=_0x4b4d43-0x0;var _0x5706ba=_0x6aeb[_0x4b4d43];return _0x5706ba;};'use strict';var Sequelize=require(_0xb6ae('0x0'));module[_0xb6ae('0x1')]={'name':{'type':Sequelize[_0xb6ae('0x2')]},'channel':{'type':Sequelize[_0xb6ae('0x2')]},'description':{'type':Sequelize[_0xb6ae('0x2')]},'status':{'type':Sequelize[_0xb6ae('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 2661a04..133893c 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 _0x91af=['findOne','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','set','Content-Range','apply','reject','save','then','destroy','get','UserProfileResource','error','stack','name','send','map','Trigger','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','show','params','length','find','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','addAllCondition','TriggerAllId','Condition','create','getAllConditions','nolimit','getAnyConditions','addAction','TriggerId','Action','getActions'];(function(_0x2fadb8,_0x4e7e6e){var _0x2c90bd=function(_0x453f05){while(--_0x453f05){_0x2fadb8['push'](_0x2fadb8['shift']());}};_0x2c90bd(++_0x4e7e6e);}(_0x91af,0x189));var _0xf91a=function(_0x36760a,_0x580db6){_0x36760a=_0x36760a-0x0;var _0x4f034c=_0x91af[_0x36760a];return _0x4f034c;};'use strict';var emlformat=require(_0xf91a('0x0'));var rimraf=require(_0xf91a('0x1'));var zipdir=require(_0xf91a('0x2'));var jsonpatch=require(_0xf91a('0x3'));var rp=require(_0xf91a('0x4'));var moment=require(_0xf91a('0x5'));var BPromise=require(_0xf91a('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0xf91a('0x7'));var sox=require(_0xf91a('0x8'));var csv=require(_0xf91a('0x9'));var ejs=require(_0xf91a('0xa'));var fs=require('fs');var fs_extra=require(_0xf91a('0xb'));var _=require(_0xf91a('0xc'));var squel=require(_0xf91a('0xd'));var crypto=require('crypto');var jsforce=require(_0xf91a('0xe'));var deskjs=require(_0xf91a('0xf'));var toCsv=require(_0xf91a('0x9'));var querystring=require('querystring');var Papa=require(_0xf91a('0x10'));var Redis=require(_0xf91a('0x11'));var authService=require(_0xf91a('0x12'));var qs=require(_0xf91a('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xf91a('0x14'));var logger=require(_0xf91a('0x15'))(_0xf91a('0x16'));var utils=require('../../config/utils');var config=require(_0xf91a('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xf91a('0x18'))['db'];function respondWithStatusCode(_0x166051,_0x393f81){_0x393f81=_0x393f81||0xcc;return function(_0xacdf94){if(_0xacdf94){return _0x166051[_0xf91a('0x19')](_0x393f81);}return _0x166051[_0xf91a('0x1a')](_0x393f81)[_0xf91a('0x1b')]();};}function respondWithResult(_0x278817,_0x1a8bcc){_0x1a8bcc=_0x1a8bcc||0xc8;return function(_0x4168a4){if(_0x4168a4){return _0x278817[_0xf91a('0x1a')](_0x1a8bcc)[_0xf91a('0x1c')](_0x4168a4);}};}function respondWithFilteredResult(_0x1f0156,_0x5728a6){return function(_0x38be65){if(_0x38be65){var _0x1f2cde=typeof _0x5728a6[_0xf91a('0x1d')]===_0xf91a('0x1e')&&typeof _0x5728a6[_0xf91a('0x1f')]===_0xf91a('0x1e');var _0x46087c=_0x38be65['count'];var _0x41e659=_0x1f2cde?0x0:_0x5728a6[_0xf91a('0x1d')];var _0x5c1622=_0x1f2cde?_0x38be65['count']:_0x5728a6[_0xf91a('0x1d')]+_0x5728a6[_0xf91a('0x1f')];var _0x4a83ed;if(_0x5c1622>=_0x46087c){_0x5c1622=_0x46087c;_0x4a83ed=0xc8;}else{_0x4a83ed=0xce;}_0x1f0156[_0xf91a('0x1a')](_0x4a83ed);return _0x1f0156[_0xf91a('0x20')](_0xf91a('0x21'),_0x41e659+'-'+_0x5c1622+'/'+_0x46087c)[_0xf91a('0x1c')](_0x38be65);}return null;};}function patchUpdates(_0x56e531){return function(_0x1ac9e7){try{jsonpatch[_0xf91a('0x22')](_0x1ac9e7,_0x56e531,!![]);}catch(_0x2fcb33){return BPromise[_0xf91a('0x23')](_0x2fcb33);}return _0x1ac9e7[_0xf91a('0x24')]();};}function saveUpdates(_0x2926b3,_0x58f836){return function(_0x4a38fa){if(_0x4a38fa){return _0x4a38fa['update'](_0x2926b3)[_0xf91a('0x25')](function(_0x346d33){return _0x346d33;});}return null;};}function removeEntity(_0x133e45,_0x50aa88){return function(_0x2389f1){if(_0x2389f1){return _0x2389f1[_0xf91a('0x26')]()[_0xf91a('0x25')](function(){var _0x2d0e20=_0x2389f1[_0xf91a('0x27')]({'plain':!![]});var _0x18a0bc='Triggers';return db[_0xf91a('0x28')][_0xf91a('0x26')]({'where':{'type':_0x18a0bc,'resourceId':_0x2d0e20['id']}})['then'](function(){return _0x2389f1;});})[_0xf91a('0x25')](function(){_0x133e45[_0xf91a('0x1a')](0xcc)[_0xf91a('0x1b')]();});}};}function handleEntityNotFound(_0x4ca540,_0x5cd9e7){return function(_0x2219ea){if(!_0x2219ea){_0x4ca540[_0xf91a('0x19')](0x194);}return _0x2219ea;};}function handleError(_0x3ef3ea,_0x25f9b7){_0x25f9b7=_0x25f9b7||0x1f4;return function(_0x51786f){logger[_0xf91a('0x29')](_0x51786f[_0xf91a('0x2a')]);if(_0x51786f[_0xf91a('0x2b')]){delete _0x51786f['name'];}_0x3ef3ea[_0xf91a('0x1a')](_0x25f9b7)[_0xf91a('0x2c')](_0x51786f);};}exports['index']=function(_0x198e47,_0x2d2709){var _0x567fcd={},_0x9ca69={},_0x211a94={'count':0x0,'rows':[]};var _0x496bce=_[_0xf91a('0x2d')](db[_0xf91a('0x2e')][_0xf91a('0x2f')],function(_0x13608d){return{'name':_0x13608d[_0xf91a('0x30')],'type':_0x13608d[_0xf91a('0x31')][_0xf91a('0x32')]};});_0x9ca69[_0xf91a('0x33')]=_[_0xf91a('0x2d')](_0x496bce,_0xf91a('0x2b'));_0x9ca69[_0xf91a('0x34')]=_[_0xf91a('0x35')](_0x198e47[_0xf91a('0x34')]);_0x9ca69[_0xf91a('0x36')]=_[_0xf91a('0x37')](_0x9ca69['model'],_0x9ca69[_0xf91a('0x34')]);_0x567fcd[_0xf91a('0x38')]=_[_0xf91a('0x37')](_0x9ca69['model'],qs['fields'](_0x198e47['query'][_0xf91a('0x39')]));_0x567fcd['attributes']=_0x567fcd[_0xf91a('0x38')]['length']?_0x567fcd[_0xf91a('0x38')]:_0x9ca69['model'];if(!_0x198e47['query'][_0xf91a('0x3a')]('nolimit')){_0x567fcd['limit']=qs[_0xf91a('0x1f')](_0x198e47[_0xf91a('0x34')][_0xf91a('0x1f')]);_0x567fcd[_0xf91a('0x1d')]=qs['offset'](_0x198e47[_0xf91a('0x34')]['offset']);}_0x567fcd[_0xf91a('0x3b')]=qs['sort'](_0x198e47[_0xf91a('0x34')][_0xf91a('0x3c')]);_0x567fcd[_0xf91a('0x3d')]=qs[_0xf91a('0x36')](_[_0xf91a('0x3e')](_0x198e47[_0xf91a('0x34')],_0x9ca69[_0xf91a('0x36')]),_0x496bce);if(_0x198e47[_0xf91a('0x34')][_0xf91a('0x3f')]){_0x567fcd['where']=_[_0xf91a('0x40')](_0x567fcd[_0xf91a('0x3d')],{'$or':_[_0xf91a('0x2d')](_0x496bce,function(_0x32fa07){if(_0x32fa07[_0xf91a('0x31')]!==_0xf91a('0x41')){var _0x582e8a={};_0x582e8a[_0x32fa07[_0xf91a('0x2b')]]={'$like':'%'+_0x198e47[_0xf91a('0x34')][_0xf91a('0x3f')]+'%'};return _0x582e8a;}})});}_0x567fcd=_[_0xf91a('0x40')]({},_0x567fcd,_0x198e47[_0xf91a('0x42')]);var _0x55188a={'where':_0x567fcd[_0xf91a('0x3d')]};return db[_0xf91a('0x2e')][_0xf91a('0x43')](_0x55188a)[_0xf91a('0x25')](function(_0x387927){_0x211a94[_0xf91a('0x43')]=_0x387927;if(_0x198e47['query'][_0xf91a('0x44')]){_0x567fcd[_0xf91a('0x45')]=[{'all':!![]}];}return db['Trigger'][_0xf91a('0x46')](_0x567fcd);})['then'](function(_0x4870b7){_0x211a94[_0xf91a('0x47')]=_0x4870b7;return _0x211a94;})[_0xf91a('0x25')](respondWithFilteredResult(_0x2d2709,_0x567fcd))[_0xf91a('0x48')](handleError(_0x2d2709,null));};exports[_0xf91a('0x49')]=function(_0x4d1e44,_0x2cf0d3){var _0x5b6dba={'raw':![],'where':{'id':_0x4d1e44[_0xf91a('0x4a')]['id']}},_0x26ee24={};_0x26ee24[_0xf91a('0x33')]=_[_0xf91a('0x35')](db[_0xf91a('0x2e')][_0xf91a('0x2f')]);_0x26ee24[_0xf91a('0x34')]=_[_0xf91a('0x35')](_0x4d1e44['query']);_0x26ee24[_0xf91a('0x36')]=_[_0xf91a('0x37')](_0x26ee24[_0xf91a('0x33')],_0x26ee24[_0xf91a('0x34')]);_0x5b6dba['attributes']=_[_0xf91a('0x37')](_0x26ee24[_0xf91a('0x33')],qs[_0xf91a('0x39')](_0x4d1e44['query']['fields']));_0x5b6dba[_0xf91a('0x38')]=_0x5b6dba['attributes'][_0xf91a('0x4b')]?_0x5b6dba[_0xf91a('0x38')]:_0x26ee24[_0xf91a('0x33')];if(_0x4d1e44[_0xf91a('0x34')][_0xf91a('0x44')]){_0x5b6dba[_0xf91a('0x45')]=[{'all':!![]}];}_0x5b6dba=_[_0xf91a('0x40')]({},_0x5b6dba,_0x4d1e44[_0xf91a('0x42')]);return db[_0xf91a('0x2e')][_0xf91a('0x4c')](_0x5b6dba)['then'](handleEntityNotFound(_0x2cf0d3,null))[_0xf91a('0x25')](respondWithResult(_0x2cf0d3,null))[_0xf91a('0x48')](handleError(_0x2cf0d3,null));};exports['create']=function(_0x4cc5de,_0x505580){return db[_0xf91a('0x2e')]['create'](_0x4cc5de['body'],{})[_0xf91a('0x25')](function(_0x59815){var _0x454cb2=_0x4cc5de[_0xf91a('0x4d')][_0xf91a('0x27')]({'plain':!![]});if(!_0x454cb2)throw new Error(_0xf91a('0x4e'));if(_0x454cb2[_0xf91a('0x4f')]===_0xf91a('0x4d')){var _0x55ad21=_0x59815[_0xf91a('0x27')]({'plain':!![]});var _0x435d40='Triggers';return db[_0xf91a('0x50')][_0xf91a('0x4c')]({'where':{'name':_0x435d40,'userProfileId':_0x454cb2[_0xf91a('0x51')]},'raw':!![]})[_0xf91a('0x25')](function(_0x5115d2){if(_0x5115d2&&_0x5115d2[_0xf91a('0x52')]===0x0){return db[_0xf91a('0x28')]['create']({'name':_0x55ad21[_0xf91a('0x2b')],'resourceId':_0x55ad21['id'],'type':_0x5115d2[_0xf91a('0x2b')],'sectionId':_0x5115d2['id']},{})[_0xf91a('0x25')](function(){return _0x59815;});}else{return _0x59815;}})[_0xf91a('0x48')](function(_0x42e04b){logger['error'](_0xf91a('0x53'),_0x42e04b);throw _0x42e04b;});}return _0x59815;})[_0xf91a('0x25')](respondWithResult(_0x505580,0xc9))[_0xf91a('0x48')](handleError(_0x505580,null));};exports[_0xf91a('0x54')]=function(_0x14de4e,_0x52121c){if(_0x14de4e[_0xf91a('0x55')]['id']){delete _0x14de4e['body']['id'];}return db[_0xf91a('0x2e')][_0xf91a('0x4c')]({'where':{'id':_0x14de4e['params']['id']}})['then'](handleEntityNotFound(_0x52121c,null))[_0xf91a('0x25')](saveUpdates(_0x14de4e['body'],null))[_0xf91a('0x25')](respondWithResult(_0x52121c,null))[_0xf91a('0x48')](handleError(_0x52121c,null));};exports[_0xf91a('0x26')]=function(_0x5098bf,_0x5d6423){return db[_0xf91a('0x2e')][_0xf91a('0x4c')]({'where':{'id':_0x5098bf[_0xf91a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d6423,null))[_0xf91a('0x25')](removeEntity(_0x5d6423,null))[_0xf91a('0x48')](handleError(_0x5d6423,null));};exports[_0xf91a('0x56')]=function(_0x29a431,_0x44fb7d,_0xa58d21){if(_0x29a431[_0xf91a('0x55')]['id']){delete _0x29a431[_0xf91a('0x55')]['id'];}return db['Trigger'][_0xf91a('0x4c')]({'where':{'id':_0x29a431[_0xf91a('0x4a')]['id']}})[_0xf91a('0x25')](handleEntityNotFound(_0x44fb7d,null))[_0xf91a('0x25')](function(_0x52eba1){if(_0x52eba1){_0x29a431[_0xf91a('0x55')][_0xf91a('0x57')]=_0x52eba1['id'];return db[_0xf91a('0x58')]['create'](_0x29a431[_0xf91a('0x55')]);}})[_0xf91a('0x25')](respondWithResult(_0x44fb7d,null))[_0xf91a('0x48')](handleError(_0x44fb7d,null));};exports['addAnyCondition']=function(_0x1d376e,_0x543d77,_0x3818b6){if(_0x1d376e[_0xf91a('0x55')]['id']){delete _0x1d376e[_0xf91a('0x55')]['id'];}return db[_0xf91a('0x2e')][_0xf91a('0x4c')]({'where':{'id':_0x1d376e[_0xf91a('0x4a')]['id']}})['then'](handleEntityNotFound(_0x543d77,null))[_0xf91a('0x25')](function(_0xc5a5c8){if(_0xc5a5c8){_0x1d376e[_0xf91a('0x55')]['TriggerAnyId']=_0xc5a5c8['id'];return db[_0xf91a('0x58')][_0xf91a('0x59')](_0x1d376e[_0xf91a('0x55')]);}})[_0xf91a('0x25')](respondWithResult(_0x543d77,null))[_0xf91a('0x48')](handleError(_0x543d77,null));};exports[_0xf91a('0x5a')]=function(_0x49c01d,_0x4e2c90,_0xa1e800){var _0x2913f1={};var _0x5499b6={};var _0x498f08;var _0x13a15a;return db[_0xf91a('0x2e')]['findOne']({'where':{'id':_0x49c01d[_0xf91a('0x4a')]['id']}})[_0xf91a('0x25')](handleEntityNotFound(_0x4e2c90,null))[_0xf91a('0x25')](function(_0x3101ab){if(_0x3101ab){_0x498f08=_0x3101ab;_0x5499b6[_0xf91a('0x33')]=_['keys'](db[_0xf91a('0x58')][_0xf91a('0x2f')]);_0x5499b6[_0xf91a('0x34')]=_[_0xf91a('0x35')](_0x49c01d[_0xf91a('0x34')]);_0x5499b6[_0xf91a('0x36')]=_[_0xf91a('0x37')](_0x5499b6[_0xf91a('0x33')],_0x5499b6[_0xf91a('0x34')]);_0x2913f1[_0xf91a('0x38')]=_['intersection'](_0x5499b6['model'],qs['fields'](_0x49c01d['query'][_0xf91a('0x39')]));_0x2913f1[_0xf91a('0x38')]=_0x2913f1[_0xf91a('0x38')][_0xf91a('0x4b')]?_0x2913f1[_0xf91a('0x38')]:_0x5499b6[_0xf91a('0x33')];_0x2913f1['order']=qs[_0xf91a('0x3c')](_0x49c01d[_0xf91a('0x34')][_0xf91a('0x3c')]);_0x2913f1[_0xf91a('0x3d')]=qs[_0xf91a('0x36')](_[_0xf91a('0x3e')](_0x49c01d['query'],_0x5499b6[_0xf91a('0x36')]));if(_0x49c01d['query'][_0xf91a('0x3f')]){_0x2913f1[_0xf91a('0x3d')]=_['merge'](_0x2913f1[_0xf91a('0x3d')],{'$or':_['map'](_0x2913f1[_0xf91a('0x38')],function(_0x77d6a0){var _0x4de3fb={};_0x4de3fb[_0x77d6a0]={'$like':'%'+_0x49c01d['query'][_0xf91a('0x3f')]+'%'};return _0x4de3fb;})});}_0x2913f1=_[_0xf91a('0x40')]({},_0x2913f1,_0x49c01d[_0xf91a('0x42')]);return _0x498f08[_0xf91a('0x5a')](_0x2913f1);}})[_0xf91a('0x25')](function(_0x3362f7){if(_0x3362f7){_0x13a15a=_0x3362f7[_0xf91a('0x4b')];if(!_0x49c01d['query'][_0xf91a('0x3a')](_0xf91a('0x5b'))){_0x2913f1['limit']=qs[_0xf91a('0x1f')](_0x49c01d[_0xf91a('0x34')]['limit']);_0x2913f1[_0xf91a('0x1d')]=qs[_0xf91a('0x1d')](_0x49c01d[_0xf91a('0x34')]['offset']);}return _0x498f08[_0xf91a('0x5a')](_0x2913f1);}})[_0xf91a('0x25')](function(_0x2e2658){if(_0x2e2658){return _0x2e2658?{'count':_0x13a15a,'rows':_0x2e2658}:null;}})[_0xf91a('0x25')](respondWithResult(_0x4e2c90,null))[_0xf91a('0x48')](handleError(_0x4e2c90,null));};exports[_0xf91a('0x5c')]=function(_0x3ae2b0,_0x20707f,_0x1d6d79){var _0x398fc6={};var _0x1906eb={};var _0x489b15;var _0x30311b;return db[_0xf91a('0x2e')]['findOne']({'where':{'id':_0x3ae2b0['params']['id']}})[_0xf91a('0x25')](handleEntityNotFound(_0x20707f,null))[_0xf91a('0x25')](function(_0x515f28){if(_0x515f28){_0x489b15=_0x515f28;_0x1906eb[_0xf91a('0x33')]=_[_0xf91a('0x35')](db[_0xf91a('0x58')]['rawAttributes']);_0x1906eb['query']=_[_0xf91a('0x35')](_0x3ae2b0['query']);_0x1906eb[_0xf91a('0x36')]=_['intersection'](_0x1906eb[_0xf91a('0x33')],_0x1906eb[_0xf91a('0x34')]);_0x398fc6[_0xf91a('0x38')]=_[_0xf91a('0x37')](_0x1906eb[_0xf91a('0x33')],qs[_0xf91a('0x39')](_0x3ae2b0[_0xf91a('0x34')]['fields']));_0x398fc6[_0xf91a('0x38')]=_0x398fc6[_0xf91a('0x38')]['length']?_0x398fc6[_0xf91a('0x38')]:_0x1906eb['model'];_0x398fc6[_0xf91a('0x3b')]=qs['sort'](_0x3ae2b0['query'][_0xf91a('0x3c')]);_0x398fc6[_0xf91a('0x3d')]=qs[_0xf91a('0x36')](_['pick'](_0x3ae2b0['query'],_0x1906eb[_0xf91a('0x36')]));if(_0x3ae2b0[_0xf91a('0x34')][_0xf91a('0x3f')]){_0x398fc6['where']=_[_0xf91a('0x40')](_0x398fc6['where'],{'$or':_[_0xf91a('0x2d')](_0x398fc6[_0xf91a('0x38')],function(_0x56ba96){var _0x10fad8={};_0x10fad8[_0x56ba96]={'$like':'%'+_0x3ae2b0['query'][_0xf91a('0x3f')]+'%'};return _0x10fad8;})});}_0x398fc6=_[_0xf91a('0x40')]({},_0x398fc6,_0x3ae2b0[_0xf91a('0x42')]);return _0x489b15[_0xf91a('0x5c')](_0x398fc6);}})['then'](function(_0x5142ef){if(_0x5142ef){_0x30311b=_0x5142ef[_0xf91a('0x4b')];if(!_0x3ae2b0[_0xf91a('0x34')][_0xf91a('0x3a')]('nolimit')){_0x398fc6[_0xf91a('0x1f')]=qs[_0xf91a('0x1f')](_0x3ae2b0[_0xf91a('0x34')][_0xf91a('0x1f')]);_0x398fc6[_0xf91a('0x1d')]=qs['offset'](_0x3ae2b0[_0xf91a('0x34')][_0xf91a('0x1d')]);}return _0x489b15['getAnyConditions'](_0x398fc6);}})[_0xf91a('0x25')](function(_0x4e856a){if(_0x4e856a){return _0x4e856a?{'count':_0x30311b,'rows':_0x4e856a}:null;}})['then'](respondWithResult(_0x20707f,null))['catch'](handleError(_0x20707f,null));};exports[_0xf91a('0x5d')]=function(_0x6b6691,_0x5231a5,_0x161187){if(_0x6b6691[_0xf91a('0x55')]['id']){delete _0x6b6691['body']['id'];}return db[_0xf91a('0x2e')]['find']({'where':{'id':_0x6b6691['params']['id']}})[_0xf91a('0x25')](handleEntityNotFound(_0x5231a5,null))[_0xf91a('0x25')](function(_0x26cc3f){if(_0x26cc3f){_0x6b6691[_0xf91a('0x55')][_0xf91a('0x5e')]=_0x26cc3f['id'];return db[_0xf91a('0x5f')][_0xf91a('0x59')](_0x6b6691[_0xf91a('0x55')]);}})[_0xf91a('0x25')](respondWithResult(_0x5231a5,null))[_0xf91a('0x48')](handleError(_0x5231a5,null));};exports[_0xf91a('0x60')]=function(_0x5d4de4,_0x4d3801,_0x7eb677){var _0x5d549b={};var _0x3da1c4={};var _0x5e8973;var _0xc15603;return db['Trigger'][_0xf91a('0x61')]({'where':{'id':_0x5d4de4[_0xf91a('0x4a')]['id']}})[_0xf91a('0x25')](handleEntityNotFound(_0x4d3801,null))[_0xf91a('0x25')](function(_0x5a0780){if(_0x5a0780){_0x5e8973=_0x5a0780;_0x3da1c4['model']=_['keys'](db[_0xf91a('0x5f')][_0xf91a('0x2f')]);_0x3da1c4[_0xf91a('0x34')]=_[_0xf91a('0x35')](_0x5d4de4[_0xf91a('0x34')]);_0x3da1c4[_0xf91a('0x36')]=_[_0xf91a('0x37')](_0x3da1c4[_0xf91a('0x33')],_0x3da1c4['query']);_0x5d549b[_0xf91a('0x38')]=_[_0xf91a('0x37')](_0x3da1c4[_0xf91a('0x33')],qs['fields'](_0x5d4de4[_0xf91a('0x34')][_0xf91a('0x39')]));_0x5d549b[_0xf91a('0x38')]=_0x5d549b['attributes'][_0xf91a('0x4b')]?_0x5d549b[_0xf91a('0x38')]:_0x3da1c4[_0xf91a('0x33')];_0x5d549b[_0xf91a('0x3b')]=qs[_0xf91a('0x3c')](_0x5d4de4[_0xf91a('0x34')][_0xf91a('0x3c')]);_0x5d549b[_0xf91a('0x3d')]=qs[_0xf91a('0x36')](_[_0xf91a('0x3e')](_0x5d4de4[_0xf91a('0x34')],_0x3da1c4[_0xf91a('0x36')]));if(_0x5d4de4[_0xf91a('0x34')]['filter']){_0x5d549b[_0xf91a('0x3d')]=_[_0xf91a('0x40')](_0x5d549b[_0xf91a('0x3d')],{'$or':_[_0xf91a('0x2d')](_0x5d549b[_0xf91a('0x38')],function(_0xf2bdf0){var _0x495120={};_0x495120[_0xf2bdf0]={'$like':'%'+_0x5d4de4[_0xf91a('0x34')][_0xf91a('0x3f')]+'%'};return _0x495120;})});}_0x5d549b=_[_0xf91a('0x40')]({},_0x5d549b,_0x5d4de4[_0xf91a('0x42')]);return _0x5e8973[_0xf91a('0x60')](_0x5d549b);}})[_0xf91a('0x25')](function(_0x14c765){if(_0x14c765){_0xc15603=_0x14c765[_0xf91a('0x4b')];if(!_0x5d4de4[_0xf91a('0x34')]['hasOwnProperty'](_0xf91a('0x5b'))){_0x5d549b[_0xf91a('0x1f')]=qs[_0xf91a('0x1f')](_0x5d4de4[_0xf91a('0x34')]['limit']);_0x5d549b['offset']=qs[_0xf91a('0x1d')](_0x5d4de4['query'][_0xf91a('0x1d')]);}return _0x5e8973['getActions'](_0x5d549b);}})[_0xf91a('0x25')](function(_0x1b9f69){if(_0x1b9f69){return _0x1b9f69?{'count':_0xc15603,'rows':_0x1b9f69}:null;}})[_0xf91a('0x25')](respondWithResult(_0x4d3801,null))[_0xf91a('0x48')](handleError(_0x4d3801,null));}; \ No newline at end of file +var _0xdd99=['catch','params','Trigger','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','addAllCondition','TriggerAllId','addAnyCondition','TriggerAnyId','Condition','getAllConditions','findOne','rawAttributes','pick','hasOwnProperty','getAnyConditions','TriggerId','Action','order','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','path','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','end','status','undefined','limit','count','set','Content-Range','json','apply','reject','save','update','then','destroy','get','Triggers','UserProfileResource','error','stack','name','send','map','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','nolimit','offset','sort','where','merge','VIRTUAL','filter','options','includeAll','include','findAll','rows'];(function(_0x47d6ac,_0x1c3199){var _0x259744=function(_0x591247){while(--_0x591247){_0x47d6ac['push'](_0x47d6ac['shift']());}};_0x259744(++_0x1c3199);}(_0xdd99,0x1a3));var _0x9dd9=function(_0x555c95,_0x16efeb){_0x555c95=_0x555c95-0x0;var _0x5ab140=_0xdd99[_0x555c95];return _0x5ab140;};'use strict';var emlformat=require(_0x9dd9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x9dd9('0x1'));var jsonpatch=require(_0x9dd9('0x2'));var rp=require(_0x9dd9('0x3'));var moment=require(_0x9dd9('0x4'));var BPromise=require(_0x9dd9('0x5'));var Mustache=require(_0x9dd9('0x6'));var util=require('util');var path=require(_0x9dd9('0x7'));var sox=require('sox');var csv=require(_0x9dd9('0x8'));var ejs=require(_0x9dd9('0x9'));var fs=require('fs');var fs_extra=require(_0x9dd9('0xa'));var _=require(_0x9dd9('0xb'));var squel=require(_0x9dd9('0xc'));var crypto=require(_0x9dd9('0xd'));var jsforce=require(_0x9dd9('0xe'));var deskjs=require(_0x9dd9('0xf'));var toCsv=require(_0x9dd9('0x8'));var querystring=require(_0x9dd9('0x10'));var Papa=require(_0x9dd9('0x11'));var Redis=require(_0x9dd9('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x9dd9('0x13'));var as=require(_0x9dd9('0x14'));var hardwareService=require(_0x9dd9('0x15'));var logger=require(_0x9dd9('0x16'))(_0x9dd9('0x17'));var utils=require('../../config/utils');var config=require(_0x9dd9('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9dd9('0x19'))['db'];function respondWithStatusCode(_0x13e8ac,_0x2a0173){_0x2a0173=_0x2a0173||0xcc;return function(_0x411cfc){if(_0x411cfc){return _0x13e8ac['sendStatus'](_0x2a0173);}return _0x13e8ac['status'](_0x2a0173)[_0x9dd9('0x1a')]();};}function respondWithResult(_0x315af5,_0x312623){_0x312623=_0x312623||0xc8;return function(_0x483dad){if(_0x483dad){return _0x315af5[_0x9dd9('0x1b')](_0x312623)['json'](_0x483dad);}};}function respondWithFilteredResult(_0x4fe76d,_0x3f6a44){return function(_0x3aa695){if(_0x3aa695){var _0xcc5c42=typeof _0x3f6a44['offset']===_0x9dd9('0x1c')&&typeof _0x3f6a44[_0x9dd9('0x1d')]==='undefined';var _0x543c88=_0x3aa695['count'];var _0x25b53f=_0xcc5c42?0x0:_0x3f6a44['offset'];var _0x28b479=_0xcc5c42?_0x3aa695[_0x9dd9('0x1e')]:_0x3f6a44['offset']+_0x3f6a44['limit'];var _0x35155e;if(_0x28b479>=_0x543c88){_0x28b479=_0x543c88;_0x35155e=0xc8;}else{_0x35155e=0xce;}_0x4fe76d[_0x9dd9('0x1b')](_0x35155e);return _0x4fe76d[_0x9dd9('0x1f')](_0x9dd9('0x20'),_0x25b53f+'-'+_0x28b479+'/'+_0x543c88)[_0x9dd9('0x21')](_0x3aa695);}return null;};}function patchUpdates(_0x1fc4ae){return function(_0x3c1bc4){try{jsonpatch[_0x9dd9('0x22')](_0x3c1bc4,_0x1fc4ae,!![]);}catch(_0x370ebc){return BPromise[_0x9dd9('0x23')](_0x370ebc);}return _0x3c1bc4[_0x9dd9('0x24')]();};}function saveUpdates(_0x2441bd,_0x5543c6){return function(_0x1080da){if(_0x1080da){return _0x1080da[_0x9dd9('0x25')](_0x2441bd)[_0x9dd9('0x26')](function(_0x4b5df8){return _0x4b5df8;});}return null;};}function removeEntity(_0xf521d0,_0x507255){return function(_0x4e2e0e){if(_0x4e2e0e){return _0x4e2e0e[_0x9dd9('0x27')]()[_0x9dd9('0x26')](function(){var _0x50f18f=_0x4e2e0e[_0x9dd9('0x28')]({'plain':!![]});var _0x53624e=_0x9dd9('0x29');return db[_0x9dd9('0x2a')][_0x9dd9('0x27')]({'where':{'type':_0x53624e,'resourceId':_0x50f18f['id']}})['then'](function(){return _0x4e2e0e;});})[_0x9dd9('0x26')](function(){_0xf521d0['status'](0xcc)[_0x9dd9('0x1a')]();});}};}function handleEntityNotFound(_0x5ce215,_0x23faaf){return function(_0x14b23a){if(!_0x14b23a){_0x5ce215['sendStatus'](0x194);}return _0x14b23a;};}function handleError(_0x9ad5aa,_0x53990f){_0x53990f=_0x53990f||0x1f4;return function(_0xa1e3e6){logger[_0x9dd9('0x2b')](_0xa1e3e6[_0x9dd9('0x2c')]);if(_0xa1e3e6[_0x9dd9('0x2d')]){delete _0xa1e3e6[_0x9dd9('0x2d')];}_0x9ad5aa[_0x9dd9('0x1b')](_0x53990f)[_0x9dd9('0x2e')](_0xa1e3e6);};}exports['index']=function(_0x1bd295,_0x3e106b){var _0x4ae895={},_0x4c8c2d={},_0xc6a39={'count':0x0,'rows':[]};var _0x4326cd=_[_0x9dd9('0x2f')](db['Trigger']['rawAttributes'],function(_0x1ade1e){return{'name':_0x1ade1e[_0x9dd9('0x30')],'type':_0x1ade1e[_0x9dd9('0x31')][_0x9dd9('0x32')]};});_0x4c8c2d[_0x9dd9('0x33')]=_['map'](_0x4326cd,'name');_0x4c8c2d[_0x9dd9('0x34')]=_[_0x9dd9('0x35')](_0x1bd295[_0x9dd9('0x34')]);_0x4c8c2d[_0x9dd9('0x36')]=_[_0x9dd9('0x37')](_0x4c8c2d['model'],_0x4c8c2d[_0x9dd9('0x34')]);_0x4ae895[_0x9dd9('0x38')]=_[_0x9dd9('0x37')](_0x4c8c2d[_0x9dd9('0x33')],qs['fields'](_0x1bd295[_0x9dd9('0x34')][_0x9dd9('0x39')]));_0x4ae895[_0x9dd9('0x38')]=_0x4ae895[_0x9dd9('0x38')][_0x9dd9('0x3a')]?_0x4ae895['attributes']:_0x4c8c2d[_0x9dd9('0x33')];if(!_0x1bd295['query']['hasOwnProperty'](_0x9dd9('0x3b'))){_0x4ae895[_0x9dd9('0x1d')]=qs[_0x9dd9('0x1d')](_0x1bd295[_0x9dd9('0x34')][_0x9dd9('0x1d')]);_0x4ae895[_0x9dd9('0x3c')]=qs['offset'](_0x1bd295[_0x9dd9('0x34')][_0x9dd9('0x3c')]);}_0x4ae895['order']=qs[_0x9dd9('0x3d')](_0x1bd295['query'][_0x9dd9('0x3d')]);_0x4ae895[_0x9dd9('0x3e')]=qs[_0x9dd9('0x36')](_['pick'](_0x1bd295[_0x9dd9('0x34')],_0x4c8c2d[_0x9dd9('0x36')]),_0x4326cd);if(_0x1bd295[_0x9dd9('0x34')]['filter']){_0x4ae895[_0x9dd9('0x3e')]=_[_0x9dd9('0x3f')](_0x4ae895[_0x9dd9('0x3e')],{'$or':_[_0x9dd9('0x2f')](_0x4326cd,function(_0x453207){if(_0x453207['type']!==_0x9dd9('0x40')){var _0x39c038={};_0x39c038[_0x453207['name']]={'$like':'%'+_0x1bd295[_0x9dd9('0x34')][_0x9dd9('0x41')]+'%'};return _0x39c038;}})});}_0x4ae895=_[_0x9dd9('0x3f')]({},_0x4ae895,_0x1bd295[_0x9dd9('0x42')]);var _0x396295={'where':_0x4ae895['where']};return db['Trigger'][_0x9dd9('0x1e')](_0x396295)[_0x9dd9('0x26')](function(_0x40b0b4){_0xc6a39['count']=_0x40b0b4;if(_0x1bd295[_0x9dd9('0x34')][_0x9dd9('0x43')]){_0x4ae895[_0x9dd9('0x44')]=[{'all':!![]}];}return db['Trigger'][_0x9dd9('0x45')](_0x4ae895);})[_0x9dd9('0x26')](function(_0x11f85e){_0xc6a39[_0x9dd9('0x46')]=_0x11f85e;return _0xc6a39;})[_0x9dd9('0x26')](respondWithFilteredResult(_0x3e106b,_0x4ae895))[_0x9dd9('0x47')](handleError(_0x3e106b,null));};exports['show']=function(_0x2942eb,_0x4e5d31){var _0x2e25f4={'raw':![],'where':{'id':_0x2942eb[_0x9dd9('0x48')]['id']}},_0x3aa2a2={};_0x3aa2a2['model']=_[_0x9dd9('0x35')](db[_0x9dd9('0x49')]['rawAttributes']);_0x3aa2a2[_0x9dd9('0x34')]=_[_0x9dd9('0x35')](_0x2942eb[_0x9dd9('0x34')]);_0x3aa2a2[_0x9dd9('0x36')]=_[_0x9dd9('0x37')](_0x3aa2a2[_0x9dd9('0x33')],_0x3aa2a2[_0x9dd9('0x34')]);_0x2e25f4[_0x9dd9('0x38')]=_[_0x9dd9('0x37')](_0x3aa2a2[_0x9dd9('0x33')],qs[_0x9dd9('0x39')](_0x2942eb[_0x9dd9('0x34')]['fields']));_0x2e25f4['attributes']=_0x2e25f4[_0x9dd9('0x38')][_0x9dd9('0x3a')]?_0x2e25f4[_0x9dd9('0x38')]:_0x3aa2a2['model'];if(_0x2942eb[_0x9dd9('0x34')][_0x9dd9('0x43')]){_0x2e25f4['include']=[{'all':!![]}];}_0x2e25f4=_[_0x9dd9('0x3f')]({},_0x2e25f4,_0x2942eb['options']);return db['Trigger'][_0x9dd9('0x4a')](_0x2e25f4)[_0x9dd9('0x26')](handleEntityNotFound(_0x4e5d31,null))[_0x9dd9('0x26')](respondWithResult(_0x4e5d31,null))['catch'](handleError(_0x4e5d31,null));};exports[_0x9dd9('0x4b')]=function(_0x4aca5b,_0x47d0e7){return db[_0x9dd9('0x49')][_0x9dd9('0x4b')](_0x4aca5b[_0x9dd9('0x4c')],{})['then'](function(_0x3d076d){var _0x342130=_0x4aca5b[_0x9dd9('0x4d')]['get']({'plain':!![]});if(!_0x342130)throw new Error(_0x9dd9('0x4e'));if(_0x342130[_0x9dd9('0x4f')]===_0x9dd9('0x4d')){var _0x3211c3=_0x3d076d[_0x9dd9('0x28')]({'plain':!![]});var _0x32e52c='Triggers';return db[_0x9dd9('0x50')]['find']({'where':{'name':_0x32e52c,'userProfileId':_0x342130[_0x9dd9('0x51')]},'raw':!![]})[_0x9dd9('0x26')](function(_0x569316){if(_0x569316&&_0x569316[_0x9dd9('0x52')]===0x0){return db[_0x9dd9('0x2a')][_0x9dd9('0x4b')]({'name':_0x3211c3['name'],'resourceId':_0x3211c3['id'],'type':_0x569316[_0x9dd9('0x2d')],'sectionId':_0x569316['id']},{})['then'](function(){return _0x3d076d;});}else{return _0x3d076d;}})[_0x9dd9('0x47')](function(_0x340a39){logger[_0x9dd9('0x2b')](_0x9dd9('0x53'),_0x340a39);throw _0x340a39;});}return _0x3d076d;})[_0x9dd9('0x26')](respondWithResult(_0x47d0e7,0xc9))[_0x9dd9('0x47')](handleError(_0x47d0e7,null));};exports['update']=function(_0x3a67ba,_0x269290){if(_0x3a67ba[_0x9dd9('0x4c')]['id']){delete _0x3a67ba[_0x9dd9('0x4c')]['id'];}return db[_0x9dd9('0x49')][_0x9dd9('0x4a')]({'where':{'id':_0x3a67ba[_0x9dd9('0x48')]['id']}})['then'](handleEntityNotFound(_0x269290,null))[_0x9dd9('0x26')](saveUpdates(_0x3a67ba[_0x9dd9('0x4c')],null))[_0x9dd9('0x26')](respondWithResult(_0x269290,null))[_0x9dd9('0x47')](handleError(_0x269290,null));};exports[_0x9dd9('0x27')]=function(_0x2781ec,_0x491ffb){return db[_0x9dd9('0x49')][_0x9dd9('0x4a')]({'where':{'id':_0x2781ec['params']['id']}})[_0x9dd9('0x26')](handleEntityNotFound(_0x491ffb,null))['then'](removeEntity(_0x491ffb,null))[_0x9dd9('0x47')](handleError(_0x491ffb,null));};exports[_0x9dd9('0x54')]=function(_0x2ed15c,_0x2b79d2,_0x7d8162){if(_0x2ed15c[_0x9dd9('0x4c')]['id']){delete _0x2ed15c[_0x9dd9('0x4c')]['id'];}return db[_0x9dd9('0x49')][_0x9dd9('0x4a')]({'where':{'id':_0x2ed15c[_0x9dd9('0x48')]['id']}})[_0x9dd9('0x26')](handleEntityNotFound(_0x2b79d2,null))[_0x9dd9('0x26')](function(_0x4bd31e){if(_0x4bd31e){_0x2ed15c['body'][_0x9dd9('0x55')]=_0x4bd31e['id'];return db['Condition'][_0x9dd9('0x4b')](_0x2ed15c['body']);}})[_0x9dd9('0x26')](respondWithResult(_0x2b79d2,null))[_0x9dd9('0x47')](handleError(_0x2b79d2,null));};exports[_0x9dd9('0x56')]=function(_0xbbc7f,_0x5c201b,_0x562a09){if(_0xbbc7f[_0x9dd9('0x4c')]['id']){delete _0xbbc7f['body']['id'];}return db[_0x9dd9('0x49')]['find']({'where':{'id':_0xbbc7f[_0x9dd9('0x48')]['id']}})[_0x9dd9('0x26')](handleEntityNotFound(_0x5c201b,null))[_0x9dd9('0x26')](function(_0x2e5c6f){if(_0x2e5c6f){_0xbbc7f['body'][_0x9dd9('0x57')]=_0x2e5c6f['id'];return db[_0x9dd9('0x58')][_0x9dd9('0x4b')](_0xbbc7f[_0x9dd9('0x4c')]);}})[_0x9dd9('0x26')](respondWithResult(_0x5c201b,null))[_0x9dd9('0x47')](handleError(_0x5c201b,null));};exports[_0x9dd9('0x59')]=function(_0x549500,_0x19ced0,_0x45e046){var _0x29ea16={};var _0x421979={};var _0x3f2ec9;var _0x16d42f;return db[_0x9dd9('0x49')][_0x9dd9('0x5a')]({'where':{'id':_0x549500[_0x9dd9('0x48')]['id']}})[_0x9dd9('0x26')](handleEntityNotFound(_0x19ced0,null))[_0x9dd9('0x26')](function(_0x3548e4){if(_0x3548e4){_0x3f2ec9=_0x3548e4;_0x421979[_0x9dd9('0x33')]=_['keys'](db[_0x9dd9('0x58')][_0x9dd9('0x5b')]);_0x421979['query']=_[_0x9dd9('0x35')](_0x549500[_0x9dd9('0x34')]);_0x421979[_0x9dd9('0x36')]=_[_0x9dd9('0x37')](_0x421979[_0x9dd9('0x33')],_0x421979[_0x9dd9('0x34')]);_0x29ea16[_0x9dd9('0x38')]=_[_0x9dd9('0x37')](_0x421979['model'],qs[_0x9dd9('0x39')](_0x549500['query'][_0x9dd9('0x39')]));_0x29ea16[_0x9dd9('0x38')]=_0x29ea16[_0x9dd9('0x38')][_0x9dd9('0x3a')]?_0x29ea16[_0x9dd9('0x38')]:_0x421979[_0x9dd9('0x33')];_0x29ea16['order']=qs['sort'](_0x549500[_0x9dd9('0x34')][_0x9dd9('0x3d')]);_0x29ea16[_0x9dd9('0x3e')]=qs[_0x9dd9('0x36')](_[_0x9dd9('0x5c')](_0x549500[_0x9dd9('0x34')],_0x421979[_0x9dd9('0x36')]));if(_0x549500[_0x9dd9('0x34')][_0x9dd9('0x41')]){_0x29ea16[_0x9dd9('0x3e')]=_[_0x9dd9('0x3f')](_0x29ea16['where'],{'$or':_[_0x9dd9('0x2f')](_0x29ea16[_0x9dd9('0x38')],function(_0x542e51){var _0x4c9fd9={};_0x4c9fd9[_0x542e51]={'$like':'%'+_0x549500['query']['filter']+'%'};return _0x4c9fd9;})});}_0x29ea16=_['merge']({},_0x29ea16,_0x549500[_0x9dd9('0x42')]);return _0x3f2ec9[_0x9dd9('0x59')](_0x29ea16);}})[_0x9dd9('0x26')](function(_0x13f893){if(_0x13f893){_0x16d42f=_0x13f893['length'];if(!_0x549500[_0x9dd9('0x34')][_0x9dd9('0x5d')](_0x9dd9('0x3b'))){_0x29ea16[_0x9dd9('0x1d')]=qs['limit'](_0x549500[_0x9dd9('0x34')][_0x9dd9('0x1d')]);_0x29ea16[_0x9dd9('0x3c')]=qs[_0x9dd9('0x3c')](_0x549500[_0x9dd9('0x34')]['offset']);}return _0x3f2ec9[_0x9dd9('0x59')](_0x29ea16);}})[_0x9dd9('0x26')](function(_0x76460d){if(_0x76460d){return _0x76460d?{'count':_0x16d42f,'rows':_0x76460d}:null;}})['then'](respondWithResult(_0x19ced0,null))[_0x9dd9('0x47')](handleError(_0x19ced0,null));};exports[_0x9dd9('0x5e')]=function(_0x294664,_0x31fc2e,_0x5963a7){var _0x27e3ae={};var _0x56b623={};var _0x484662;var _0x509a1e;return db[_0x9dd9('0x49')][_0x9dd9('0x5a')]({'where':{'id':_0x294664[_0x9dd9('0x48')]['id']}})[_0x9dd9('0x26')](handleEntityNotFound(_0x31fc2e,null))[_0x9dd9('0x26')](function(_0x402727){if(_0x402727){_0x484662=_0x402727;_0x56b623[_0x9dd9('0x33')]=_[_0x9dd9('0x35')](db[_0x9dd9('0x58')][_0x9dd9('0x5b')]);_0x56b623[_0x9dd9('0x34')]=_[_0x9dd9('0x35')](_0x294664[_0x9dd9('0x34')]);_0x56b623[_0x9dd9('0x36')]=_[_0x9dd9('0x37')](_0x56b623[_0x9dd9('0x33')],_0x56b623[_0x9dd9('0x34')]);_0x27e3ae[_0x9dd9('0x38')]=_[_0x9dd9('0x37')](_0x56b623[_0x9dd9('0x33')],qs[_0x9dd9('0x39')](_0x294664[_0x9dd9('0x34')][_0x9dd9('0x39')]));_0x27e3ae['attributes']=_0x27e3ae[_0x9dd9('0x38')][_0x9dd9('0x3a')]?_0x27e3ae[_0x9dd9('0x38')]:_0x56b623[_0x9dd9('0x33')];_0x27e3ae['order']=qs['sort'](_0x294664[_0x9dd9('0x34')][_0x9dd9('0x3d')]);_0x27e3ae[_0x9dd9('0x3e')]=qs['filters'](_[_0x9dd9('0x5c')](_0x294664[_0x9dd9('0x34')],_0x56b623['filters']));if(_0x294664[_0x9dd9('0x34')][_0x9dd9('0x41')]){_0x27e3ae[_0x9dd9('0x3e')]=_[_0x9dd9('0x3f')](_0x27e3ae[_0x9dd9('0x3e')],{'$or':_[_0x9dd9('0x2f')](_0x27e3ae['attributes'],function(_0x291b4b){var _0x41cbd2={};_0x41cbd2[_0x291b4b]={'$like':'%'+_0x294664['query'][_0x9dd9('0x41')]+'%'};return _0x41cbd2;})});}_0x27e3ae=_[_0x9dd9('0x3f')]({},_0x27e3ae,_0x294664[_0x9dd9('0x42')]);return _0x484662['getAnyConditions'](_0x27e3ae);}})[_0x9dd9('0x26')](function(_0x8733b8){if(_0x8733b8){_0x509a1e=_0x8733b8[_0x9dd9('0x3a')];if(!_0x294664[_0x9dd9('0x34')][_0x9dd9('0x5d')](_0x9dd9('0x3b'))){_0x27e3ae[_0x9dd9('0x1d')]=qs[_0x9dd9('0x1d')](_0x294664[_0x9dd9('0x34')][_0x9dd9('0x1d')]);_0x27e3ae['offset']=qs[_0x9dd9('0x3c')](_0x294664[_0x9dd9('0x34')]['offset']);}return _0x484662[_0x9dd9('0x5e')](_0x27e3ae);}})[_0x9dd9('0x26')](function(_0x129c9d){if(_0x129c9d){return _0x129c9d?{'count':_0x509a1e,'rows':_0x129c9d}:null;}})['then'](respondWithResult(_0x31fc2e,null))['catch'](handleError(_0x31fc2e,null));};exports['addAction']=function(_0x287d63,_0x3e70f2,_0x3c66f3){if(_0x287d63['body']['id']){delete _0x287d63[_0x9dd9('0x4c')]['id'];}return db[_0x9dd9('0x49')]['find']({'where':{'id':_0x287d63[_0x9dd9('0x48')]['id']}})[_0x9dd9('0x26')](handleEntityNotFound(_0x3e70f2,null))['then'](function(_0x40bbce){if(_0x40bbce){_0x287d63['body'][_0x9dd9('0x5f')]=_0x40bbce['id'];return db['Action'][_0x9dd9('0x4b')](_0x287d63['body']);}})[_0x9dd9('0x26')](respondWithResult(_0x3e70f2,null))['catch'](handleError(_0x3e70f2,null));};exports['getActions']=function(_0x242bbd,_0x1e5196,_0x19ada8){var _0x9db142={};var _0x30acfd={};var _0x3ab6f8;var _0x2cb835;return db[_0x9dd9('0x49')]['findOne']({'where':{'id':_0x242bbd[_0x9dd9('0x48')]['id']}})[_0x9dd9('0x26')](handleEntityNotFound(_0x1e5196,null))[_0x9dd9('0x26')](function(_0xe3b0cc){if(_0xe3b0cc){_0x3ab6f8=_0xe3b0cc;_0x30acfd[_0x9dd9('0x33')]=_[_0x9dd9('0x35')](db[_0x9dd9('0x60')]['rawAttributes']);_0x30acfd[_0x9dd9('0x34')]=_[_0x9dd9('0x35')](_0x242bbd[_0x9dd9('0x34')]);_0x30acfd['filters']=_[_0x9dd9('0x37')](_0x30acfd[_0x9dd9('0x33')],_0x30acfd[_0x9dd9('0x34')]);_0x9db142['attributes']=_[_0x9dd9('0x37')](_0x30acfd[_0x9dd9('0x33')],qs[_0x9dd9('0x39')](_0x242bbd['query'][_0x9dd9('0x39')]));_0x9db142[_0x9dd9('0x38')]=_0x9db142['attributes'][_0x9dd9('0x3a')]?_0x9db142[_0x9dd9('0x38')]:_0x30acfd[_0x9dd9('0x33')];_0x9db142[_0x9dd9('0x61')]=qs[_0x9dd9('0x3d')](_0x242bbd[_0x9dd9('0x34')][_0x9dd9('0x3d')]);_0x9db142[_0x9dd9('0x3e')]=qs['filters'](_[_0x9dd9('0x5c')](_0x242bbd[_0x9dd9('0x34')],_0x30acfd['filters']));if(_0x242bbd[_0x9dd9('0x34')]['filter']){_0x9db142[_0x9dd9('0x3e')]=_[_0x9dd9('0x3f')](_0x9db142[_0x9dd9('0x3e')],{'$or':_['map'](_0x9db142[_0x9dd9('0x38')],function(_0x31b954){var _0x44e2c1={};_0x44e2c1[_0x31b954]={'$like':'%'+_0x242bbd['query']['filter']+'%'};return _0x44e2c1;})});}_0x9db142=_[_0x9dd9('0x3f')]({},_0x9db142,_0x242bbd[_0x9dd9('0x42')]);return _0x3ab6f8['getActions'](_0x9db142);}})[_0x9dd9('0x26')](function(_0x36adb8){if(_0x36adb8){_0x2cb835=_0x36adb8[_0x9dd9('0x3a')];if(!_0x242bbd[_0x9dd9('0x34')][_0x9dd9('0x5d')](_0x9dd9('0x3b'))){_0x9db142[_0x9dd9('0x1d')]=qs[_0x9dd9('0x1d')](_0x242bbd[_0x9dd9('0x34')][_0x9dd9('0x1d')]);_0x9db142[_0x9dd9('0x3c')]=qs[_0x9dd9('0x3c')](_0x242bbd[_0x9dd9('0x34')]['offset']);}return _0x3ab6f8['getActions'](_0x9db142);}})[_0x9dd9('0x26')](function(_0x1ba07a){if(_0x1ba07a){return _0x1ba07a?{'count':_0x2cb835,'rows':_0x1ba07a}:null;}})['then'](respondWithResult(_0x1e5196,null))[_0x9dd9('0x47')](handleError(_0x1e5196,null));}; \ No newline at end of file diff --git a/server/api/trigger/trigger.model.js b/server/api/trigger/trigger.model.js index a8f4ef1..32f7d1c 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 _0x3c6d=['rimraf','../../config/environment','./trigger.attributes','define','Trigger','tools_triggers','lodash','util','../../config/logger','api','bluebird','request-promise','path'];(function(_0x246bd1,_0x184711){var _0x348a6c=function(_0x47d3e4){while(--_0x47d3e4){_0x246bd1['push'](_0x246bd1['shift']());}};_0x348a6c(++_0x184711);}(_0x3c6d,0x199));var _0xd3c6=function(_0x5079d7,_0x95668d){_0x5079d7=_0x5079d7-0x0;var _0x459c5a=_0x3c6d[_0x5079d7];return _0x459c5a;};'use strict';var _=require(_0xd3c6('0x0'));var util=require(_0xd3c6('0x1'));var logger=require(_0xd3c6('0x2'))(_0xd3c6('0x3'));var moment=require('moment');var BPromise=require(_0xd3c6('0x4'));var rp=require(_0xd3c6('0x5'));var fs=require('fs');var path=require(_0xd3c6('0x6'));var rimraf=require(_0xd3c6('0x7'));var config=require(_0xd3c6('0x8'));var attributes=require(_0xd3c6('0x9'));module['exports']=function(_0x11fb61,_0xe7c405){return _0x11fb61[_0xd3c6('0xa')](_0xd3c6('0xb'),attributes,{'tableName':_0xd3c6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x7d55=['./trigger.attributes','exports','define','Trigger','lodash','util','../../config/logger','api','request-promise','path','rimraf'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0x7d55,0x1bc));var _0x57d5=function(_0x116a80,_0x475ffe){_0x116a80=_0x116a80-0x0;var _0x86c227=_0x7d55[_0x116a80];return _0x86c227;};'use strict';var _=require(_0x57d5('0x0'));var util=require(_0x57d5('0x1'));var logger=require(_0x57d5('0x2'))(_0x57d5('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x57d5('0x4'));var fs=require('fs');var path=require(_0x57d5('0x5'));var rimraf=require(_0x57d5('0x6'));var config=require('../../config/environment');var attributes=require(_0x57d5('0x7'));module[_0x57d5('0x8')]=function(_0x15c349,_0x30fcfe){return _0x15c349[_0x57d5('0x9')](_0x57d5('0xa'),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 2b01a2e..5bb6d39 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 _0x4abd=['Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','GetTrigger','findAll','options','raw','attributes','limit','map','include','model','debug','ShowTrigger','Trigger','find','where','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','http','then','info'];(function(_0x141fcd,_0x810edc){var _0x3a968d=function(_0x2cebda){while(--_0x2cebda){_0x141fcd['push'](_0x141fcd['shift']());}};_0x3a968d(++_0x810edc);}(_0x4abd,0x9a));var _0xd4ab=function(_0x59ee41,_0xaf7db8){_0x59ee41=_0x59ee41-0x0;var _0x3ecd3e=_0x4abd[_0x59ee41];return _0x3ecd3e;};'use strict';var _=require('lodash');var util=require(_0xd4ab('0x0'));var moment=require(_0xd4ab('0x1'));var BPromise=require(_0xd4ab('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd4ab('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xd4ab('0x4'));var logger=require(_0xd4ab('0x5'))('rpc');var config=require(_0xd4ab('0x6'));var jayson=require(_0xd4ab('0x7'));var client=jayson['client'][_0xd4ab('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3d2778,_0x3d1155,_0x516547){return new BPromise(function(_0x5df6e4,_0x542499){return client['request'](_0x3d2778,_0x516547)[_0xd4ab('0x9')](function(_0x5913ad){logger[_0xd4ab('0xa')](_0xd4ab('0xb'),_0x3d1155,_0xd4ab('0xc'));logger['debug'](_0xd4ab('0xd'),_0x3d1155,_0xd4ab('0xc'),JSON[_0xd4ab('0xe')](_0x5913ad));if(_0x5913ad[_0xd4ab('0xf')]){if(_0x5913ad[_0xd4ab('0xf')]['code']===0x1f4){logger[_0xd4ab('0xf')]('Trigger,\x20%s,\x20%s',_0x3d1155,_0x5913ad[_0xd4ab('0xf')][_0xd4ab('0x10')]);return _0x542499(_0x5913ad['error']['message']);}logger['error'](_0xd4ab('0xb'),_0x3d1155,_0x5913ad[_0xd4ab('0xf')][_0xd4ab('0x10')]);return _0x5df6e4(_0x5913ad['error']['message']);}else{logger[_0xd4ab('0xa')](_0xd4ab('0xb'),_0x3d1155,_0xd4ab('0xc'));_0x5df6e4(_0x5913ad[_0xd4ab('0x11')][_0xd4ab('0x10')]);}})[_0xd4ab('0x12')](function(_0x12795f){logger[_0xd4ab('0xf')](_0xd4ab('0xb'),_0x3d1155,_0x12795f);_0x542499(_0x12795f);});});}exports[_0xd4ab('0x13')]=function(_0x46ea62){var _0x19b8de=this;return new Promise(function(_0x4c6ac3,_0x451e18){return db['Trigger'][_0xd4ab('0x14')]({'raw':_0x46ea62[_0xd4ab('0x15')]?_0x46ea62[_0xd4ab('0x15')][_0xd4ab('0x16')]===undefined?!![]:![]:!![],'where':_0x46ea62[_0xd4ab('0x15')]?_0x46ea62[_0xd4ab('0x15')]['where']||null:null,'attributes':_0x46ea62['options']?_0x46ea62[_0xd4ab('0x15')][_0xd4ab('0x17')]||null:null,'limit':_0x46ea62[_0xd4ab('0x15')]?_0x46ea62[_0xd4ab('0x15')][_0xd4ab('0x18')]||null:null,'include':_0x46ea62['options']?_0x46ea62[_0xd4ab('0x15')]['include']?_[_0xd4ab('0x19')](_0x46ea62['options'][_0xd4ab('0x1a')],function(_0x340485){return{'model':db[_0x340485[_0xd4ab('0x1b')]],'as':_0x340485['as'],'attributes':_0x340485[_0xd4ab('0x17')],'include':_0x340485[_0xd4ab('0x1a')]?_[_0xd4ab('0x19')](_0x340485[_0xd4ab('0x1a')],function(_0x74dd2e){return{'model':db[_0x74dd2e[_0xd4ab('0x1b')]],'as':_0x74dd2e['as'],'attributes':_0x74dd2e[_0xd4ab('0x17')],'include':_0x74dd2e[_0xd4ab('0x1a')]?_[_0xd4ab('0x19')](_0x74dd2e[_0xd4ab('0x1a')],function(_0x563e8c){return{'model':db[_0x563e8c[_0xd4ab('0x1b')]],'as':_0x563e8c['as'],'attributes':_0x563e8c[_0xd4ab('0x17')]};}):[]};}):[]};}):[]:[]})[_0xd4ab('0x9')](function(_0x21904d){logger['info'](_0xd4ab('0x13'),_0x46ea62);logger[_0xd4ab('0x1c')](_0xd4ab('0x13'),_0x46ea62,JSON[_0xd4ab('0xe')](_0x21904d));_0x4c6ac3(_0x21904d);})['catch'](function(_0x33de67){logger[_0xd4ab('0xf')](_0xd4ab('0x13'),_0x33de67[_0xd4ab('0x10')],_0x46ea62);_0x451e18(_0x19b8de[_0xd4ab('0xf')](0x1f4,_0x33de67[_0xd4ab('0x10')]));});});};exports[_0xd4ab('0x1d')]=function(_0x32c35c){var _0x176a4c=this;return new Promise(function(_0x3aff62,_0x431674){return db[_0xd4ab('0x1e')][_0xd4ab('0x1f')]({'raw':_0x32c35c['options']?_0x32c35c[_0xd4ab('0x15')]['raw']===undefined?!![]:![]:!![],'where':_0x32c35c[_0xd4ab('0x15')]?_0x32c35c[_0xd4ab('0x15')][_0xd4ab('0x20')]||null:null,'attributes':_0x32c35c[_0xd4ab('0x15')]?_0x32c35c['options'][_0xd4ab('0x17')]||null:null,'include':_0x32c35c['options']?_0x32c35c['options'][_0xd4ab('0x1a')]?_[_0xd4ab('0x19')](_0x32c35c[_0xd4ab('0x15')][_0xd4ab('0x1a')],function(_0xf9ee79){return{'model':db[_0xf9ee79[_0xd4ab('0x1b')]],'as':_0xf9ee79['as'],'attributes':_0xf9ee79[_0xd4ab('0x17')],'include':_0xf9ee79[_0xd4ab('0x1a')]?_[_0xd4ab('0x19')](_0xf9ee79[_0xd4ab('0x1a')],function(_0xf05828){return{'model':db[_0xf05828[_0xd4ab('0x1b')]],'as':_0xf05828['as'],'attributes':_0xf05828[_0xd4ab('0x17')],'include':_0xf05828[_0xd4ab('0x1a')]?_[_0xd4ab('0x19')](_0xf05828['include'],function(_0x2eb353){return{'model':db[_0x2eb353[_0xd4ab('0x1b')]],'as':_0x2eb353['as'],'attributes':_0x2eb353['attributes']};}):[]};}):[]};}):[]:[]})[_0xd4ab('0x9')](function(_0x5a83e4){logger[_0xd4ab('0xa')]('ShowTrigger',_0x32c35c);logger[_0xd4ab('0x1c')]('ShowTrigger',_0x32c35c,JSON[_0xd4ab('0xe')](_0x5a83e4));_0x3aff62(_0x5a83e4);})['catch'](function(_0x5ca38e){logger['error'](_0xd4ab('0x1d'),_0x5ca38e['message'],_0x32c35c);_0x431674(_0x176a4c[_0xd4ab('0xf')](0x1f4,_0x5ca38e[_0xd4ab('0x10')]));});});}; \ No newline at end of file +var _0xe283=['util','moment','bluebird','randomstring','../../config/utils','../../config/logger','../../config/environment','client','request','then','info','Trigger,\x20%s,\x20%s','request\x20sent','Trigger,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','options','raw','where','attributes','limit','include','map','model','GetTrigger','debug','Trigger','find','ShowTrigger','catch','lodash'];(function(_0x11e30d,_0x5584aa){var _0x2d4e29=function(_0x2486ce){while(--_0x2486ce){_0x11e30d['push'](_0x11e30d['shift']());}};_0x2d4e29(++_0x5584aa);}(_0xe283,0xcb));var _0x3e28=function(_0x2af160,_0x765b1){_0x2af160=_0x2af160-0x0;var _0x439d67=_0xe283[_0x2af160];return _0x439d67;};'use strict';var _=require(_0x3e28('0x0'));var util=require(_0x3e28('0x1'));var moment=require(_0x3e28('0x2'));var BPromise=require(_0x3e28('0x3'));var rs=require(_0x3e28('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x3e28('0x5'));var logger=require(_0x3e28('0x6'))('rpc');var config=require(_0x3e28('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3e28('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1f01f5,_0x5cdd09,_0x2aeb77){return new BPromise(function(_0x42e67d,_0x2909df){return client[_0x3e28('0x9')](_0x1f01f5,_0x2aeb77)[_0x3e28('0xa')](function(_0xca0625){logger[_0x3e28('0xb')](_0x3e28('0xc'),_0x5cdd09,_0x3e28('0xd'));logger['debug'](_0x3e28('0xe'),_0x5cdd09,'request\x20sent',JSON[_0x3e28('0xf')](_0xca0625));if(_0xca0625['error']){if(_0xca0625[_0x3e28('0x10')][_0x3e28('0x11')]===0x1f4){logger[_0x3e28('0x10')](_0x3e28('0xc'),_0x5cdd09,_0xca0625[_0x3e28('0x10')][_0x3e28('0x12')]);return _0x2909df(_0xca0625[_0x3e28('0x10')]['message']);}logger['error'](_0x3e28('0xc'),_0x5cdd09,_0xca0625[_0x3e28('0x10')][_0x3e28('0x12')]);return _0x42e67d(_0xca0625[_0x3e28('0x10')]['message']);}else{logger['info'](_0x3e28('0xc'),_0x5cdd09,_0x3e28('0xd'));_0x42e67d(_0xca0625[_0x3e28('0x13')]['message']);}})['catch'](function(_0x5d5ea2){logger[_0x3e28('0x10')]('Trigger,\x20%s,\x20%s',_0x5cdd09,_0x5d5ea2);_0x2909df(_0x5d5ea2);});});}exports['GetTrigger']=function(_0x5ba647){var _0x2904bf=this;return new Promise(function(_0x1aa59d,_0x57bdef){return db['Trigger']['findAll']({'raw':_0x5ba647[_0x3e28('0x14')]?_0x5ba647['options'][_0x3e28('0x15')]===undefined?!![]:![]:!![],'where':_0x5ba647['options']?_0x5ba647[_0x3e28('0x14')][_0x3e28('0x16')]||null:null,'attributes':_0x5ba647[_0x3e28('0x14')]?_0x5ba647['options'][_0x3e28('0x17')]||null:null,'limit':_0x5ba647[_0x3e28('0x14')]?_0x5ba647[_0x3e28('0x14')][_0x3e28('0x18')]||null:null,'include':_0x5ba647['options']?_0x5ba647[_0x3e28('0x14')][_0x3e28('0x19')]?_[_0x3e28('0x1a')](_0x5ba647['options'][_0x3e28('0x19')],function(_0x3a2eca){return{'model':db[_0x3a2eca[_0x3e28('0x1b')]],'as':_0x3a2eca['as'],'attributes':_0x3a2eca[_0x3e28('0x17')],'include':_0x3a2eca[_0x3e28('0x19')]?_[_0x3e28('0x1a')](_0x3a2eca[_0x3e28('0x19')],function(_0x55ff98){return{'model':db[_0x55ff98[_0x3e28('0x1b')]],'as':_0x55ff98['as'],'attributes':_0x55ff98[_0x3e28('0x17')],'include':_0x55ff98['include']?_['map'](_0x55ff98[_0x3e28('0x19')],function(_0x384339){return{'model':db[_0x384339[_0x3e28('0x1b')]],'as':_0x384339['as'],'attributes':_0x384339[_0x3e28('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3e28('0xa')](function(_0x1f4db4){logger[_0x3e28('0xb')](_0x3e28('0x1c'),_0x5ba647);logger[_0x3e28('0x1d')](_0x3e28('0x1c'),_0x5ba647,JSON[_0x3e28('0xf')](_0x1f4db4));_0x1aa59d(_0x1f4db4);})['catch'](function(_0x392eb7){logger[_0x3e28('0x10')](_0x3e28('0x1c'),_0x392eb7[_0x3e28('0x12')],_0x5ba647);_0x57bdef(_0x2904bf['error'](0x1f4,_0x392eb7[_0x3e28('0x12')]));});});};exports['ShowTrigger']=function(_0x2eca00){var _0x9d64a1=this;return new Promise(function(_0xf5fe06,_0x241573){return db[_0x3e28('0x1e')][_0x3e28('0x1f')]({'raw':_0x2eca00[_0x3e28('0x14')]?_0x2eca00[_0x3e28('0x14')]['raw']===undefined?!![]:![]:!![],'where':_0x2eca00[_0x3e28('0x14')]?_0x2eca00[_0x3e28('0x14')][_0x3e28('0x16')]||null:null,'attributes':_0x2eca00[_0x3e28('0x14')]?_0x2eca00[_0x3e28('0x14')][_0x3e28('0x17')]||null:null,'include':_0x2eca00[_0x3e28('0x14')]?_0x2eca00['options'][_0x3e28('0x19')]?_[_0x3e28('0x1a')](_0x2eca00[_0x3e28('0x14')][_0x3e28('0x19')],function(_0x40efbb){return{'model':db[_0x40efbb[_0x3e28('0x1b')]],'as':_0x40efbb['as'],'attributes':_0x40efbb[_0x3e28('0x17')],'include':_0x40efbb[_0x3e28('0x19')]?_['map'](_0x40efbb[_0x3e28('0x19')],function(_0x356d46){return{'model':db[_0x356d46[_0x3e28('0x1b')]],'as':_0x356d46['as'],'attributes':_0x356d46[_0x3e28('0x17')],'include':_0x356d46['include']?_[_0x3e28('0x1a')](_0x356d46[_0x3e28('0x19')],function(_0x2484bb){return{'model':db[_0x2484bb[_0x3e28('0x1b')]],'as':_0x2484bb['as'],'attributes':_0x2484bb[_0x3e28('0x17')]};}):[]};}):[]};}):[]:[]})[_0x3e28('0xa')](function(_0x5bbee5){logger[_0x3e28('0xb')](_0x3e28('0x20'),_0x2eca00);logger['debug'](_0x3e28('0x20'),_0x2eca00,JSON[_0x3e28('0xf')](_0x5bbee5));_0xf5fe06(_0x5bbee5);})[_0x3e28('0x21')](function(_0x439721){logger[_0x3e28('0x10')]('ShowTrigger',_0x439721[_0x3e28('0x12')],_0x2eca00);_0x241573(_0x9d64a1[_0x3e28('0x10')](0x1f4,_0x439721[_0x3e28('0x12')]));});});}; \ No newline at end of file diff --git a/server/api/trunk/index.js b/server/api/trunk/index.js index 974ce00..2972c05 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 _0x8d70=['isAuthenticated','index','show','post','/:id/clone','clone','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./trunk.controller','get'];(function(_0x1ae975,_0x70b40e){var _0x2576ca=function(_0x1b4e97){while(--_0x1b4e97){_0x1ae975['push'](_0x1ae975['shift']());}};_0x2576ca(++_0x70b40e);}(_0x8d70,0x182));var _0x08d7=function(_0x524ed1,_0x8882d9){_0x524ed1=_0x524ed1-0x0;var _0x272401=_0x8d70[_0x524ed1];return _0x272401;};'use strict';var multer=require(_0x08d7('0x0'));var util=require(_0x08d7('0x1'));var path=require('path');var timeout=require(_0x08d7('0x2'));var express=require(_0x08d7('0x3'));var router=express[_0x08d7('0x4')]();var fs_extra=require(_0x08d7('0x5'));var auth=require(_0x08d7('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x08d7('0x7'));var controller=require(_0x08d7('0x8'));router[_0x08d7('0x9')]('/',auth[_0x08d7('0xa')](),controller[_0x08d7('0xb')]);router[_0x08d7('0x9')]('/:id',auth[_0x08d7('0xa')](),controller[_0x08d7('0xc')]);router[_0x08d7('0xd')](_0x08d7('0xe'),auth[_0x08d7('0xa')](),controller[_0x08d7('0xf')]);router['post']('/',auth['isAuthenticated'](),controller[_0x08d7('0x10')]);router['put'](_0x08d7('0x11'),auth[_0x08d7('0xa')](),controller[_0x08d7('0x12')]);router[_0x08d7('0x13')]('/:id',auth['isAuthenticated'](),controller[_0x08d7('0x14')]);module[_0x08d7('0x15')]=router; \ No newline at end of file +var _0x7620=['put','update','exports','util','express','Router','fs-extra','../../components/interaction/service','../../config/environment','./trunk.controller','get','isAuthenticated','index','/:id','show','clone','post','create'];(function(_0x5e4320,_0x10030d){var _0x594819=function(_0xaa6e1c){while(--_0xaa6e1c){_0x5e4320['push'](_0x5e4320['shift']());}};_0x594819(++_0x10030d);}(_0x7620,0x18f));var _0x0762=function(_0x1d98a3,_0x28e1b8){_0x1d98a3=_0x1d98a3-0x0;var _0x4b8246=_0x7620[_0x1d98a3];return _0x4b8246;};'use strict';var multer=require('multer');var util=require(_0x0762('0x0'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0762('0x1'));var router=express[_0x0762('0x2')]();var fs_extra=require(_0x0762('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0762('0x4'));var config=require(_0x0762('0x5'));var controller=require(_0x0762('0x6'));router[_0x0762('0x7')]('/',auth[_0x0762('0x8')](),controller[_0x0762('0x9')]);router[_0x0762('0x7')](_0x0762('0xa'),auth[_0x0762('0x8')](),controller[_0x0762('0xb')]);router['post']('/:id/clone',auth[_0x0762('0x8')](),controller[_0x0762('0xc')]);router[_0x0762('0xd')]('/',auth['isAuthenticated'](),controller[_0x0762('0xe')]);router[_0x0762('0xf')](_0x0762('0xa'),auth[_0x0762('0x8')](),controller[_0x0762('0x10')]);router['delete']('/:id',auth[_0x0762('0x8')](),controller['destroy']);module[_0x0762('0x11')]=router; \ No newline at end of file diff --git a/server/api/trunk/trunk.attributes.js b/server/api/trunk/trunk.attributes.js index dc71db7..ed9daa5 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 _0x6f7e=['split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','INTEGER','\x22\x22\x20<>','accept','refuse','originate','uac','uas','pai','fingerprint','certificate','active','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','friend','user','from-voip-provider','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_FAILED_SCREEN','udp','setDataValue','transport','join','getDataValue','inband','auto','rfc2833','yes','nonat','update','force_rport,comedia','nat'];(function(_0x27ad4d,_0x395f87){var _0x368abc=function(_0x236765){while(--_0x236765){_0x27ad4d['push'](_0x27ad4d['shift']());}};_0x368abc(++_0x395f87);}(_0x6f7e,0x12a));var _0xe6f7=function(_0x5ceb69,_0x59e104){_0x5ceb69=_0x5ceb69-0x0;var _0x3f6a4d=_0x6f7e[_0x5ceb69];return _0x3f6a4d;};'use strict';var Sequelize=require(_0xe6f7('0x0'));module['exports']={'name':{'type':Sequelize[_0xe6f7('0x1')],'allowNull':![],'unique':_0xe6f7('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x4'),_0xe6f7('0x5'),'peer'),'allowNull':![],'defaultValue':_0xe6f7('0x4')},'context':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xe6f7('0x6')},'callingpres':{'type':Sequelize['ENUM']('ALLOWED_NOT_SCREENED',_0xe6f7('0x7'),_0xe6f7('0x8'),_0xe6f7('0x9'),'PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN',_0xe6f7('0xa'),'PROHIB')},'deny':{'type':Sequelize[_0xe6f7('0x1')]},'permit':{'type':Sequelize[_0xe6f7('0x1')]},'secret':{'type':Sequelize[_0xe6f7('0x1')]},'md5secret':{'type':Sequelize['STRING']},'remotesecret':{'type':Sequelize[_0xe6f7('0x1')]},'transport':{'type':Sequelize[_0xe6f7('0x1')],'defaultValue':_0xe6f7('0xb'),'set':function(_0x2843e0){this[_0xe6f7('0xc')](_0xe6f7('0xd'),_0x2843e0?_0x2843e0[_0xe6f7('0xe')](','):null);},'get':function(){return this[_0xe6f7('0xf')](_0xe6f7('0xd'))?this['getDataValue']('transport')['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]'},'dtmfmode':{'type':Sequelize[_0xe6f7('0x3')]('rfc2833','info','shortinfo',_0xe6f7('0x10'),_0xe6f7('0x11')),'defaultValue':_0xe6f7('0x12')},'directmedia':{'type':Sequelize['ENUM'](_0xe6f7('0x13'),'no',_0xe6f7('0x14'),_0xe6f7('0x15'),'outgoing'),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x13'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0xe6f7('0x1')]},'directmediadeny':{'type':Sequelize[_0xe6f7('0x1')]},'nat':{'type':Sequelize[_0xe6f7('0x1')],'defaultValue':_0xe6f7('0x16'),'set':function(_0x4f612d){this[_0xe6f7('0xc')](_0xe6f7('0x17'),_0x4f612d?_0x4f612d['join'](','):null);},'get':function(){return this[_0xe6f7('0xf')]('nat')?this['getDataValue'](_0xe6f7('0x17'))[_0xe6f7('0x18')](','):null;},'comment':_0xe6f7('0x19')},'callgroup':{'type':Sequelize[_0xe6f7('0x1')]},'namedcallgroup':{'type':Sequelize['STRING']},'pickupgroup':{'type':Sequelize['STRING']},'namedpickupgroup':{'type':Sequelize[_0xe6f7('0x1')]},'language':{'type':Sequelize[_0xe6f7('0x1')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0xe6f7('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0xe6f7('0x1')],'defaultValue':'all'},'allow':{'type':Sequelize[_0xe6f7('0x1')],'allowNull':![],'defaultValue':_0xe6f7('0x1a'),'set':function(_0x22a397){this['setDataValue'](_0xe6f7('0x1b'),_0x22a397?_0x22a397[_0xe6f7('0xe')](';'):_0xe6f7('0x1a'));},'get':function(){return this[_0xe6f7('0xf')](_0xe6f7('0x1b'))?this[_0xe6f7('0xf')](_0xe6f7('0x1b'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0xe6f7('0x13'),'no')},'insecure':{'type':Sequelize[_0xe6f7('0x1')],'defaultValue':'port,invite','set':function(_0x19ac50){this[_0xe6f7('0xc')](_0xe6f7('0x1c'),_0x19ac50?_0x19ac50[_0xe6f7('0xe')](','):null);},'get':function(){return this[_0xe6f7('0xf')]('insecure')?this[_0xe6f7('0xf')](_0xe6f7('0x1c'))[_0xe6f7('0x18')](','):null;},'comment':_0xe6f7('0x1d')},'trustrpid':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x13'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x13'),'no','never')},'promiscredir':{'type':Sequelize[_0xe6f7('0x3')]('yes','no')},'useclientcode':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x13'),'no')},'accountcode':{'type':Sequelize[_0xe6f7('0x1e')](0xb)},'setvar':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xe6f7('0x1')],'defaultValue':_0xe6f7('0x1f')},'amaflags':{'type':Sequelize[_0xe6f7('0x1')]},'callcounter':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x13'),'no'),'defaultValue':_0xe6f7('0x13')},'busylevel':{'type':Sequelize[_0xe6f7('0x1e')](0xb)},'allowoverlap':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x13'),'no')},'allowsubscribe':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x13'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0xe6f7('0x13'),'no')},'ignoresdpversion':{'type':Sequelize['ENUM'](_0xe6f7('0x13'),'no')},'subscribecontext':{'type':Sequelize[_0xe6f7('0x1')]},'template':{'type':Sequelize['STRING']},'videosupport':{'type':Sequelize[_0xe6f7('0x3')]('yes','no','always'),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0xe6f7('0x1e')](0xb)},'rfc2833compensate':{'type':Sequelize['ENUM'](_0xe6f7('0x13'),'no')},'mailbox':{'type':Sequelize[_0xe6f7('0x1')]},'session_timers':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x20'),_0xe6f7('0x21'),_0xe6f7('0x22'))},'session_expires':{'type':Sequelize[_0xe6f7('0x1e')](0xb)},'session_minse':{'type':Sequelize[_0xe6f7('0x1e')](0xb)},'session_refresher':{'type':Sequelize['ENUM'](_0xe6f7('0x23'),_0xe6f7('0x24')),'defaultValue':_0xe6f7('0x24')},'t38pt_usertpsource':{'type':Sequelize['STRING']},'regexten':{'type':Sequelize[_0xe6f7('0x1')]},'fromdomain':{'type':Sequelize['STRING']},'fromuser':{'type':Sequelize[_0xe6f7('0x1')]},'port':{'type':Sequelize[_0xe6f7('0x1e')](0x5)},'qualify':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x13'),'no'),'defaultValue':_0xe6f7('0x13')},'keepalive':{'type':Sequelize[_0xe6f7('0x1e')](0xb)},'defaultip':{'type':Sequelize['STRING']},'defaultuser':{'type':Sequelize[_0xe6f7('0x1')]},'rtptimeout':{'type':Sequelize[_0xe6f7('0x1e')](0xb)},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpkeepalive':{'type':Sequelize[_0xe6f7('0x1e')](0xb)},'sendrpid':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x13'),'no',_0xe6f7('0x25')),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0xe6f7('0x1')]},'callbackextension':{'type':Sequelize[_0xe6f7('0x1')]},'timert1':{'type':Sequelize[_0xe6f7('0x1e')](0xb)},'timerb':{'type':Sequelize[_0xe6f7('0x1e')](0xb)},'qualifyfreq':{'type':Sequelize[_0xe6f7('0x1e')](0xb)},'contactpermit':{'type':Sequelize['STRING']},'contactdeny':{'type':Sequelize[_0xe6f7('0x1')]},'contactacl':{'type':Sequelize[_0xe6f7('0x1')]},'unsolicited_mailbox':{'type':Sequelize['STRING']},'use_q850_reason':{'type':Sequelize[_0xe6f7('0x1')]},'maxforwards':{'type':Sequelize[_0xe6f7('0x1e')](0xb)},'encryption':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x13'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x13'),'no')},'force_avp':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x13'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0xe6f7('0x13'),'no')},'dtlsenable':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x13'),'no')},'dtlsverify':{'type':Sequelize[_0xe6f7('0x3')]('yes','no',_0xe6f7('0x26'),_0xe6f7('0x27'))},'dtlsrekey':{'type':Sequelize[_0xe6f7('0x1e')](0xb)},'dtlscertfile':{'type':Sequelize[_0xe6f7('0x1')]},'dtlsprivatekey':{'type':Sequelize[_0xe6f7('0x1')]},'dtlscipher':{'type':Sequelize[_0xe6f7('0x1')]},'dtlscafile':{'type':Sequelize[_0xe6f7('0x1')]},'dtlscapath':{'type':Sequelize[_0xe6f7('0x1')]},'dtlssetup':{'type':Sequelize['ENUM'](_0xe6f7('0x28'),_0xe6f7('0x29'),_0xe6f7('0x2a')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0xe6f7('0x1')]},'usereqphone':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x13'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0xe6f7('0x1')]},'recordofffeature':{'type':Sequelize[_0xe6f7('0x1')]},'call_limit':{'type':Sequelize[_0xe6f7('0x1e')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize['ENUM'](_0xe6f7('0x13'),'no')},'subscribemwi':{'type':Sequelize[_0xe6f7('0x3')](_0xe6f7('0x13'),'no')},'vmexten':{'type':Sequelize[_0xe6f7('0x1')]},'mohinterpret':{'type':Sequelize[_0xe6f7('0x1')]},'mohsuggest':{'type':Sequelize[_0xe6f7('0x1')]},'parkinglot':{'type':Sequelize[_0xe6f7('0x1')]},'description':{'type':Sequelize[_0xe6f7('0x1')]},'host':{'type':Sequelize[_0xe6f7('0x1')],'defaultValue':_0xe6f7('0x2b')},'canreinvite':{'type':Sequelize['ENUM']('yes','no',_0xe6f7('0x14'),_0xe6f7('0x15'),_0xe6f7('0x2c')),'defaultValue':'no'},'registry':{'type':Sequelize[_0xe6f7('0x1')]},'otherFields':{'type':Sequelize[_0xe6f7('0x1')]},'active':{'type':Sequelize[_0xe6f7('0x2d')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize[_0xe6f7('0x1')],'defaultValue':'no'}}; \ No newline at end of file +var _0x7241=['outgoing','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','never','INTEGER','\x22\x22\x20<>','always','accept','uac','uas','fingerprint','passive','actpass','dynamic','update,nonat','BOOLEAN','sequelize','STRING','name','ENUM','friend','user','peer','from-voip-provider','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','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'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x7241,0x10f));var _0x1724=function(_0x565c49,_0x54acd0){_0x565c49=_0x565c49-0x0;var _0x20ca34=_0x7241[_0x565c49];return _0x20ca34;};'use strict';var Sequelize=require(_0x1724('0x0'));module['exports']={'name':{'type':Sequelize[_0x1724('0x1')],'allowNull':![],'unique':_0x1724('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x4'),_0x1724('0x5'),_0x1724('0x6')),'allowNull':![],'defaultValue':_0x1724('0x4')},'context':{'type':Sequelize[_0x1724('0x1')],'allowNull':![],'defaultValue':_0x1724('0x7')},'callingpres':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x8'),'ALLOWED_PASSED_SCREEN',_0x1724('0x9'),_0x1724('0xa'),_0x1724('0xb'),'PROHIB_PASSED_SCREEN',_0x1724('0xc'),_0x1724('0xd'))},'deny':{'type':Sequelize[_0x1724('0x1')]},'permit':{'type':Sequelize['STRING']},'secret':{'type':Sequelize[_0x1724('0x1')]},'md5secret':{'type':Sequelize[_0x1724('0x1')]},'remotesecret':{'type':Sequelize[_0x1724('0x1')]},'transport':{'type':Sequelize[_0x1724('0x1')],'defaultValue':_0x1724('0xe'),'set':function(_0xc2a6b){this[_0x1724('0xf')](_0x1724('0x10'),_0xc2a6b?_0xc2a6b[_0x1724('0x11')](','):null);},'get':function(){return this[_0x1724('0x12')](_0x1724('0x10'))?this['getDataValue']('transport')[_0x1724('0x13')](','):null;},'comment':_0x1724('0x14')},'dtmfmode':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x15'),_0x1724('0x16'),_0x1724('0x17'),_0x1724('0x18'),_0x1724('0x19')),'defaultValue':_0x1724('0x15')},'directmedia':{'type':Sequelize['ENUM'](_0x1724('0x1a'),'no',_0x1724('0x1b'),_0x1724('0x1c'),_0x1724('0x1d')),'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no'),'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING']},'directmediadeny':{'type':Sequelize[_0x1724('0x1')]},'nat':{'type':Sequelize[_0x1724('0x1')],'defaultValue':_0x1724('0x1e'),'set':function(_0x2a0c14){this[_0x1724('0xf')](_0x1724('0x1f'),_0x2a0c14?_0x2a0c14[_0x1724('0x11')](','):null);},'get':function(){return this[_0x1724('0x12')](_0x1724('0x1f'))?this['getDataValue'](_0x1724('0x1f'))[_0x1724('0x13')](','):null;},'comment':_0x1724('0x20')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1724('0x1')]},'pickupgroup':{'type':Sequelize[_0x1724('0x1')]},'namedpickupgroup':{'type':Sequelize[_0x1724('0x1')]},'language':{'type':Sequelize['STRING'],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1724('0x1')],'allowNull':!![]},'disallow':{'type':Sequelize[_0x1724('0x1')],'defaultValue':_0x1724('0x21')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x40dba9){this[_0x1724('0xf')](_0x1724('0x22'),_0x40dba9?_0x40dba9[_0x1724('0x11')](';'):_0x1724('0x23'));},'get':function(){return this[_0x1724('0x12')](_0x1724('0x22'))?this[_0x1724('0x12')](_0x1724('0x22'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22alaw\x22]'},'autoframing':{'type':Sequelize[_0x1724('0x3')]('yes','no')},'insecure':{'type':Sequelize[_0x1724('0x1')],'defaultValue':'port,invite','set':function(_0x3159cf){this[_0x1724('0xf')]('insecure',_0x3159cf?_0x3159cf[_0x1724('0x11')](','):null);},'get':function(){return this[_0x1724('0x12')]('insecure')?this[_0x1724('0x12')](_0x1724('0x24'))['split'](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no'),'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no'),'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no',_0x1724('0x25'))},'promiscredir':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no')},'useclientcode':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no')},'accountcode':{'type':Sequelize[_0x1724('0x26')](0xb)},'setvar':{'type':Sequelize[_0x1724('0x1')]},'callerid':{'type':Sequelize[_0x1724('0x1')],'defaultValue':_0x1724('0x27')},'amaflags':{'type':Sequelize[_0x1724('0x1')]},'callcounter':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':_0x1724('0x1a')},'busylevel':{'type':Sequelize['INTEGER'](0xb)},'allowoverlap':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no')},'allowsubscribe':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no')},'allowtransfer':{'type':Sequelize['ENUM'](_0x1724('0x1a'),'no')},'ignoresdpversion':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no')},'subscribecontext':{'type':Sequelize[_0x1724('0x1')]},'template':{'type':Sequelize[_0x1724('0x1')]},'videosupport':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no',_0x1724('0x28')),'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1724('0x26')](0xb)},'rfc2833compensate':{'type':Sequelize[_0x1724('0x3')]('yes','no')},'mailbox':{'type':Sequelize[_0x1724('0x1')]},'session_timers':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x29'),'refuse','originate')},'session_expires':{'type':Sequelize[_0x1724('0x26')](0xb)},'session_minse':{'type':Sequelize[_0x1724('0x26')](0xb)},'session_refresher':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x2a'),_0x1724('0x2b')),'defaultValue':_0x1724('0x2b')},'t38pt_usertpsource':{'type':Sequelize[_0x1724('0x1')]},'regexten':{'type':Sequelize[_0x1724('0x1')]},'fromdomain':{'type':Sequelize[_0x1724('0x1')]},'fromuser':{'type':Sequelize['STRING']},'port':{'type':Sequelize[_0x1724('0x26')](0x5)},'qualify':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no'),'defaultValue':_0x1724('0x1a')},'keepalive':{'type':Sequelize[_0x1724('0x26')](0xb)},'defaultip':{'type':Sequelize[_0x1724('0x1')]},'defaultuser':{'type':Sequelize[_0x1724('0x1')]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb)},'rtpholdtimeout':{'type':Sequelize[_0x1724('0x26')](0xb)},'rtpkeepalive':{'type':Sequelize[_0x1724('0x26')](0xb)},'sendrpid':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no','pai'),'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1724('0x1')]},'callbackextension':{'type':Sequelize[_0x1724('0x1')]},'timert1':{'type':Sequelize['INTEGER'](0xb)},'timerb':{'type':Sequelize[_0x1724('0x26')](0xb)},'qualifyfreq':{'type':Sequelize[_0x1724('0x26')](0xb)},'contactpermit':{'type':Sequelize[_0x1724('0x1')]},'contactdeny':{'type':Sequelize[_0x1724('0x1')]},'contactacl':{'type':Sequelize[_0x1724('0x1')]},'unsolicited_mailbox':{'type':Sequelize[_0x1724('0x1')]},'use_q850_reason':{'type':Sequelize['STRING']},'maxforwards':{'type':Sequelize[_0x1724('0x26')](0xb)},'encryption':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no'),'defaultValue':'no'},'avpf':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no')},'force_avp':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no')},'icesupport':{'type':Sequelize['ENUM'](_0x1724('0x1a'),'no')},'dtlsenable':{'type':Sequelize[_0x1724('0x3')]('yes','no')},'dtlsverify':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no',_0x1724('0x2c'),'certificate')},'dtlsrekey':{'type':Sequelize[_0x1724('0x26')](0xb)},'dtlscertfile':{'type':Sequelize['STRING']},'dtlsprivatekey':{'type':Sequelize['STRING']},'dtlscipher':{'type':Sequelize[_0x1724('0x1')]},'dtlscafile':{'type':Sequelize['STRING']},'dtlscapath':{'type':Sequelize[_0x1724('0x1')]},'dtlssetup':{'type':Sequelize[_0x1724('0x3')]('active',_0x1724('0x2d'),_0x1724('0x2e')),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1724('0x1')]},'usereqphone':{'type':Sequelize['ENUM'](_0x1724('0x1a'),'no'),'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1724('0x1')]},'recordofffeature':{'type':Sequelize[_0x1724('0x1')]},'call_limit':{'type':Sequelize[_0x1724('0x26')](0xb),'defaultValue':0x3e8},'registertrying':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no')},'subscribemwi':{'type':Sequelize[_0x1724('0x3')](_0x1724('0x1a'),'no')},'vmexten':{'type':Sequelize['STRING']},'mohinterpret':{'type':Sequelize[_0x1724('0x1')]},'mohsuggest':{'type':Sequelize[_0x1724('0x1')]},'parkinglot':{'type':Sequelize[_0x1724('0x1')]},'description':{'type':Sequelize[_0x1724('0x1')]},'host':{'type':Sequelize[_0x1724('0x1')],'defaultValue':_0x1724('0x2f')},'canreinvite':{'type':Sequelize[_0x1724('0x3')]('yes','no','nonat',_0x1724('0x1c'),_0x1724('0x30')),'defaultValue':'no'},'registry':{'type':Sequelize['STRING']},'otherFields':{'type':Sequelize[_0x1724('0x1')]},'active':{'type':Sequelize[_0x1724('0x31')],'allowNull':![],'defaultValue':!![]},'t38pt_udptl':{'type':Sequelize['STRING'],'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 851b1b3..0c70e3e 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 _0x3e74=['map','Trunk','rawAttributes','fieldName','key','model','keys','query','filters','intersection','fields','attributes','length','nolimit','order','sort','pick','where','type','filter','merge','options','includeAll','include','findAll','params','clone','find','get','omit','createdAt','body','updatedAt','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','create','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','server/files/templates/registry.ejs','render','/etc/asterisk/sip_xcally_trunks.conf','registry','/etc/asterisk/sip_xcally_registers.conf','Reload','chan_sip.so','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','mustache','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','jayson/promise','client','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','Trunk,\x20%s,\x20%s','message','result','catch','sendStatus','status','json','undefined','count','offset','limit','set','Content-Range','apply','reject','update','destroy','Trunks','UserProfileResource','stack','name','send','index'];(function(_0x19e691,_0x57d0c3){var _0x1b624b=function(_0x19108f){while(--_0x19108f){_0x19e691['push'](_0x19e691['shift']());}};_0x1b624b(++_0x57d0c3);}(_0x3e74,0x175));var _0x43e7=function(_0x3250bd,_0x5c2f65){_0x3250bd=_0x3250bd-0x0;var _0x4823f1=_0x3e74[_0x3250bd];return _0x4823f1;};'use strict';var emlformat=require(_0x43e7('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x43e7('0x1'));var jsonpatch=require(_0x43e7('0x2'));var rp=require(_0x43e7('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x43e7('0x4'));var util=require('util');var path=require(_0x43e7('0x5'));var sox=require(_0x43e7('0x6'));var csv=require(_0x43e7('0x7'));var ejs=require(_0x43e7('0x8'));var fs=require('fs');var fs_extra=require(_0x43e7('0x9'));var _=require('lodash');var squel=require(_0x43e7('0xa'));var crypto=require(_0x43e7('0xb'));var jsforce=require(_0x43e7('0xc'));var deskjs=require(_0x43e7('0xd'));var toCsv=require(_0x43e7('0x7'));var querystring=require('querystring');var Papa=require(_0x43e7('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x43e7('0xf'));var as=require(_0x43e7('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x43e7('0x11'))('api');var utils=require(_0x43e7('0x12'));var config=require(_0x43e7('0x13'));var licenseUtil=require('../../config/license/util');var db=require(_0x43e7('0x14'))['db'];var jayson=require(_0x43e7('0x15'));var client=jayson[_0x43e7('0x16')][_0x43e7('0x17')]({'port':0x232a});function respondWithRpcPromise(_0x4e008c,_0x583d85,_0x2fcb36,_0x21fdd3){return new BPromise(function(_0x44b0bd,_0x51b974){var _0x5e641c=_0x21fdd3||client;return _0x5e641c[_0x43e7('0x18')](_0x4e008c,_0x2fcb36)[_0x43e7('0x19')](function(_0x203378){logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,'request\x20sent');logger[_0x43e7('0x1b')](_0x43e7('0x1c'),_0x583d85,_0x43e7('0x1d'),JSON['stringify'](_0x203378));if(_0x203378['error']){if(_0x203378[_0x43e7('0x1e')][_0x43e7('0x1f')]===0x1f4){logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x51b974(_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);}logger[_0x43e7('0x1e')](_0x43e7('0x20'),_0x583d85,_0x203378[_0x43e7('0x1e')][_0x43e7('0x21')]);return _0x44b0bd(_0x203378['error'][_0x43e7('0x21')]);}else{logger[_0x43e7('0x1a')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x43e7('0x1d'));_0x44b0bd(_0x203378[_0x43e7('0x22')][_0x43e7('0x21')]);}})[_0x43e7('0x23')](function(_0x4077fb){logger[_0x43e7('0x1e')]('Trunk,\x20%s,\x20%s',_0x583d85,_0x4077fb);_0x51b974(_0x4077fb);});});}function respondWithStatusCode(_0x454359,_0x4eea52){_0x4eea52=_0x4eea52||0xcc;return function(_0x4c9df3){if(_0x4c9df3){return _0x454359[_0x43e7('0x24')](_0x4eea52);}return _0x454359[_0x43e7('0x25')](_0x4eea52)['end']();};}function respondWithResult(_0x1f0673,_0x4ca5cf){_0x4ca5cf=_0x4ca5cf||0xc8;return function(_0x326dab){if(_0x326dab){return _0x1f0673['status'](_0x4ca5cf)[_0x43e7('0x26')](_0x326dab);}};}function respondWithFilteredResult(_0x1b5f50,_0x20888b){return function(_0x405f85){if(_0x405f85){var _0x51f4d7=typeof _0x20888b['offset']===_0x43e7('0x27')&&typeof _0x20888b['limit']===_0x43e7('0x27');var _0x40dc8f=_0x405f85[_0x43e7('0x28')];var _0xb1fc63=_0x51f4d7?0x0:_0x20888b['offset'];var _0x33a1a5=_0x51f4d7?_0x405f85[_0x43e7('0x28')]:_0x20888b[_0x43e7('0x29')]+_0x20888b[_0x43e7('0x2a')];var _0x442c3b;if(_0x33a1a5>=_0x40dc8f){_0x33a1a5=_0x40dc8f;_0x442c3b=0xc8;}else{_0x442c3b=0xce;}_0x1b5f50[_0x43e7('0x25')](_0x442c3b);return _0x1b5f50[_0x43e7('0x2b')](_0x43e7('0x2c'),_0xb1fc63+'-'+_0x33a1a5+'/'+_0x40dc8f)[_0x43e7('0x26')](_0x405f85);}return null;};}function patchUpdates(_0x35dbcd){return function(_0x17df44){try{jsonpatch[_0x43e7('0x2d')](_0x17df44,_0x35dbcd,!![]);}catch(_0x2bde44){return BPromise[_0x43e7('0x2e')](_0x2bde44);}return _0x17df44['save']();};}function saveUpdates(_0x238321,_0x44f6b0){return function(_0x3b8f78){if(_0x3b8f78){return _0x3b8f78[_0x43e7('0x2f')](_0x238321)[_0x43e7('0x19')](function(_0x4c8650){return _0x4c8650;});}return null;};}function removeEntity(_0x1eba65,_0x49b83d){return function(_0x30d47e){if(_0x30d47e){return _0x30d47e[_0x43e7('0x30')]()['then'](function(){var _0x5a7342=_0x30d47e['get']({'plain':!![]});var _0xf8320=_0x43e7('0x31');return db[_0x43e7('0x32')][_0x43e7('0x30')]({'where':{'type':_0xf8320,'resourceId':_0x5a7342['id']}})[_0x43e7('0x19')](function(){return _0x30d47e;});})[_0x43e7('0x19')](function(){_0x1eba65['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ac23d,_0x59e5b2){return function(_0x4e8e86){if(!_0x4e8e86){_0x4ac23d['sendStatus'](0x194);}return _0x4e8e86;};}function handleError(_0x5cb753,_0x14d888){_0x14d888=_0x14d888||0x1f4;return function(_0x49cda6){logger[_0x43e7('0x1e')](_0x49cda6[_0x43e7('0x33')]);if(_0x49cda6[_0x43e7('0x34')]){delete _0x49cda6[_0x43e7('0x34')];}_0x5cb753[_0x43e7('0x25')](_0x14d888)[_0x43e7('0x35')](_0x49cda6);};}exports[_0x43e7('0x36')]=function(_0x4f1a5f,_0x5332d9){var _0x5d84f4={},_0xfa0474={},_0xfe70e9={'count':0x0,'rows':[]};var _0x199ff6=_[_0x43e7('0x37')](db[_0x43e7('0x38')][_0x43e7('0x39')],function(_0x1d4589){return{'name':_0x1d4589[_0x43e7('0x3a')],'type':_0x1d4589['type'][_0x43e7('0x3b')]};});_0xfa0474[_0x43e7('0x3c')]=_['map'](_0x199ff6,_0x43e7('0x34'));_0xfa0474['query']=_[_0x43e7('0x3d')](_0x4f1a5f[_0x43e7('0x3e')]);_0xfa0474[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0xfa0474[_0x43e7('0x3c')],_0xfa0474[_0x43e7('0x3e')]);_0x5d84f4['attributes']=_['intersection'](_0xfa0474[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x41')]));_0x5d84f4[_0x43e7('0x42')]=_0x5d84f4['attributes'][_0x43e7('0x43')]?_0x5d84f4[_0x43e7('0x42')]:_0xfa0474['model'];if(!_0x4f1a5f[_0x43e7('0x3e')]['hasOwnProperty'](_0x43e7('0x44'))){_0x5d84f4['limit']=qs[_0x43e7('0x2a')](_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x2a')]);_0x5d84f4[_0x43e7('0x29')]=qs['offset'](_0x4f1a5f['query'][_0x43e7('0x29')]);}_0x5d84f4[_0x43e7('0x45')]=qs[_0x43e7('0x46')](_0x4f1a5f[_0x43e7('0x3e')]['sort']);_0x5d84f4['where']=qs['filters'](_[_0x43e7('0x47')](_0x4f1a5f['query'],_0xfa0474[_0x43e7('0x3f')]),_0x199ff6);if(_0x4f1a5f['query']['filter']){_0x5d84f4[_0x43e7('0x48')]=_['merge'](_0x5d84f4[_0x43e7('0x48')],{'$or':_[_0x43e7('0x37')](_0x199ff6,function(_0x257bd8){if(_0x257bd8[_0x43e7('0x49')]!=='VIRTUAL'){var _0x91f1e4={};_0x91f1e4[_0x257bd8[_0x43e7('0x34')]]={'$like':'%'+_0x4f1a5f[_0x43e7('0x3e')][_0x43e7('0x4a')]+'%'};return _0x91f1e4;}})});}_0x5d84f4=_[_0x43e7('0x4b')]({},_0x5d84f4,_0x4f1a5f[_0x43e7('0x4c')]);var _0x51eef4={'where':_0x5d84f4['where']};return db[_0x43e7('0x38')][_0x43e7('0x28')](_0x51eef4)[_0x43e7('0x19')](function(_0x4c00a8){_0xfe70e9['count']=_0x4c00a8;if(_0x4f1a5f['query'][_0x43e7('0x4d')]){_0x5d84f4[_0x43e7('0x4e')]=[{'all':!![]}];}return db['Trunk'][_0x43e7('0x4f')](_0x5d84f4);})[_0x43e7('0x19')](function(_0x3c96fe){_0xfe70e9['rows']=_0x3c96fe;return _0xfe70e9;})['then'](respondWithFilteredResult(_0x5332d9,_0x5d84f4))['catch'](handleError(_0x5332d9,null));};exports['show']=function(_0x214e7e,_0xe955fc){var _0x52fea5={'raw':![],'where':{'id':_0x214e7e[_0x43e7('0x50')]['id']}},_0x23e7cb={};_0x23e7cb[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0x23e7cb['query']=_['keys'](_0x214e7e[_0x43e7('0x3e')]);_0x23e7cb[_0x43e7('0x3f')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],_0x23e7cb[_0x43e7('0x3e')]);_0x52fea5[_0x43e7('0x42')]=_[_0x43e7('0x40')](_0x23e7cb[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x214e7e[_0x43e7('0x3e')]['fields']));_0x52fea5[_0x43e7('0x42')]=_0x52fea5[_0x43e7('0x42')]['length']?_0x52fea5[_0x43e7('0x42')]:_0x23e7cb['model'];if(_0x214e7e[_0x43e7('0x3e')][_0x43e7('0x4d')]){_0x52fea5[_0x43e7('0x4e')]=[{'all':!![]}];}_0x52fea5=_[_0x43e7('0x4b')]({},_0x52fea5,_0x214e7e[_0x43e7('0x4c')]);return db['Trunk']['find'](_0x52fea5)[_0x43e7('0x19')](handleEntityNotFound(_0xe955fc,null))[_0x43e7('0x19')](respondWithResult(_0xe955fc,null))[_0x43e7('0x23')](handleError(_0xe955fc,null));};exports[_0x43e7('0x51')]=function(_0x23d835,_0x25bb44){var _0xa47464={'where':{'id':_0x23d835[_0x43e7('0x50')]['id']}},_0x44f8a0={};_0x44f8a0[_0x43e7('0x3c')]=_[_0x43e7('0x3d')](db['Trunk'][_0x43e7('0x39')]);_0xa47464[_0x43e7('0x42')]=_['intersection'](_0x44f8a0[_0x43e7('0x3c')],qs[_0x43e7('0x41')](_0x23d835[_0x43e7('0x3e')]['fields']));_0xa47464['attributes']=_0xa47464[_0x43e7('0x42')][_0x43e7('0x43')]?_0xa47464['attributes']:_0x44f8a0[_0x43e7('0x3c')];if(_0x23d835['query']['includeAll']){_0xa47464[_0x43e7('0x4e')]=[{'all':!![]}];}_0xa47464=_[_0x43e7('0x4b')]({},_0xa47464,_0x23d835[_0x43e7('0x4c')]);return db[_0x43e7('0x38')][_0x43e7('0x52')](_0xa47464)['then'](handleEntityNotFound(_0x25bb44,null))[_0x43e7('0x19')](function(_0xdb9fbe){if(_0xdb9fbe){var _0x4d89bd=_0xdb9fbe[_0x43e7('0x53')]({'plain':!![]});_0x4d89bd=qs[_0x43e7('0x54')](_0x4d89bd,['id',_0x43e7('0x55'),'updatedAt']);_0x23d835['body']=_['omit'](_0x23d835[_0x43e7('0x56')],['id',_0x43e7('0x55'),_0x43e7('0x57')]);return db[_0x43e7('0x38')]['create'](_['merge'](_0x4d89bd,_0x23d835[_0x43e7('0x56')]),{'include':_0x23d835[_0x43e7('0x3e')][_0x43e7('0x4d')]?[{'all':!![]}]:undefined})[_0x43e7('0x19')](function(_0x5ea0db){var _0x4438c0=_0x23d835[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x4438c0)throw new Error(_0x43e7('0x59'));if(_0x4438c0[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x4665db=_0x5ea0db[_0x43e7('0x53')]({'plain':!![]});var _0x406155=_0x43e7('0x31');return db[_0x43e7('0x5b')]['find']({'where':{'name':_0x406155,'userProfileId':_0x4438c0['userProfileId']},'raw':!![]})[_0x43e7('0x19')](function(_0x58a3a8){if(_0x58a3a8&&_0x58a3a8['autoAssociation']===0x0){return db['UserProfileResource'][_0x43e7('0x5c')]({'name':_0x4665db[_0x43e7('0x34')],'resourceId':_0x4665db['id'],'type':_0x58a3a8['name'],'sectionId':_0x58a3a8['id']},{})[_0x43e7('0x19')](function(){return _0x5ea0db;});}else{return _0x5ea0db;}})[_0x43e7('0x23')](function(_0x1d8438){logger['error'](_0x43e7('0x5d'),_0x1d8438);throw _0x1d8438;});}return _0x5ea0db;});}})[_0x43e7('0x19')](respondWithResult(_0x25bb44,0xc9))[_0x43e7('0x23')](handleError(_0x25bb44,null));};exports[_0x43e7('0x5c')]=function(_0x2f43d7,_0x472a19,_0x1e02fa){var _0x515f01;return db[_0x43e7('0x38')][_0x43e7('0x5c')](_0x2f43d7[_0x43e7('0x56')],{'raw':!![]})['then'](function(_0x56b06d){_0x515f01=_0x56b06d;return db[_0x43e7('0x38')]['findAll']({'raw':!![]});})['then'](function(_0x1b793d){var _0x154e47=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x16499c=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x4e5956=ejs[_0x43e7('0x64')](_0x154e47,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x65'),_0x4e5956);if(_0x515f01[_0x43e7('0x66')]){var _0x37301b=ejs[_0x43e7('0x64')](_0x16499c,{'trunks':_0x1b793d||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x37301b);}})[_0x43e7('0x19')](function(){return respondWithRpcPromise(_0x43e7('0x68'),'create',{'module':_0x43e7('0x69')});})[_0x43e7('0x19')](function(){var _0x219dc6=_0x2f43d7[_0x43e7('0x58')][_0x43e7('0x53')]({'plain':!![]});if(!_0x219dc6)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x219dc6[_0x43e7('0x5a')]===_0x43e7('0x58')){var _0x35d133=_0x515f01[_0x43e7('0x53')]({'plain':!![]});return db[_0x43e7('0x5b')][_0x43e7('0x52')]({'where':{'name':_0x43e7('0x31'),'userProfileId':_0x219dc6['userProfileId']},'raw':!![]})['then'](function(_0x405faa){if(_0x405faa&&_0x405faa['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x35d133[_0x43e7('0x34')],'resourceId':_0x35d133['id'],'type':_0x405faa[_0x43e7('0x34')],'sectionId':_0x405faa['id']},{})[_0x43e7('0x19')](function(){return _0x515f01;});}else{return _0x515f01;}})[_0x43e7('0x23')](function(_0x18713b){logger[_0x43e7('0x1e')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x18713b);throw _0x18713b;});}return _0x515f01;})[_0x43e7('0x19')](respondWithResult(_0x472a19,0xc9))[_0x43e7('0x23')](handleError(_0x472a19,null));};exports[_0x43e7('0x2f')]=function(_0x5b4c76,_0x2abca0,_0xea84ec){var _0x184ae3;return db[_0x43e7('0x38')][_0x43e7('0x52')]({'where':{'id':_0x5b4c76[_0x43e7('0x50')]['id']}})[_0x43e7('0x19')](handleEntityNotFound(_0x2abca0,null))[_0x43e7('0x19')](saveUpdates(_0x5b4c76['body'],null))['then'](function(_0x55990c){if(_0x55990c){_0x184ae3=_0x55990c;return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});}})['then'](function(_0x3fe23f){if(_0x3fe23f){var _0x39a787=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config['root'],'server/files/templates/trunk.ejs'),'utf8');var _0x177a7a=fs[_0x43e7('0x62')](path['join'](config['root'],_0x43e7('0x63')),_0x43e7('0x61'));var _0x3b7e5b=ejs['render'](_0x39a787,{'trunks':_0x3fe23f||[]});fs[_0x43e7('0x6a')](_0x43e7('0x65'),_0x3b7e5b);var _0x401654=ejs[_0x43e7('0x64')](_0x177a7a,{'trunks':_0x3fe23f||[]});fs['writeFileSync'](_0x43e7('0x67'),_0x401654);return respondWithRpcPromise('Reload',_0x43e7('0x2f'),{'module':_0x43e7('0x69')});}return null;})[_0x43e7('0x19')](function(_0x90667c){if(_0x90667c){return _0x184ae3;}})[_0x43e7('0x19')](respondWithResult(_0x2abca0,null))[_0x43e7('0x23')](handleError(_0x2abca0,null));};exports[_0x43e7('0x30')]=function(_0x5e8d4e,_0x109c86,_0x40257e){var _0x1aea4e;return db[_0x43e7('0x38')]['find']({'where':{'id':_0x5e8d4e['params']['id']}})['then'](handleEntityNotFound(_0x109c86,null))[_0x43e7('0x19')](removeEntity(_0x109c86,null))['then'](function(){return db[_0x43e7('0x38')][_0x43e7('0x4f')]({'raw':!![]});})[_0x43e7('0x19')](function(_0x7387f6){var _0xa75254=fs[_0x43e7('0x62')](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x60')),_0x43e7('0x61'));var _0x3de22e=fs['readFileSync'](path[_0x43e7('0x5e')](config[_0x43e7('0x5f')],_0x43e7('0x63')),_0x43e7('0x61'));var _0x206e54=ejs['render'](_0xa75254,{'trunks':_0x7387f6});var _0x5e04ec=ejs[_0x43e7('0x64')](_0x3de22e,{'trunks':_0x7387f6});fs[_0x43e7('0x6a')]('/etc/asterisk/sip_xcally_trunks.conf',_0x206e54);fs[_0x43e7('0x6a')](_0x43e7('0x67'),_0x5e04ec);return respondWithRpcPromise('Reload','destroy',{'module':_0x43e7('0x69')});})[_0x43e7('0x23')](handleError(_0x109c86,null));}; \ No newline at end of file +var _0x34e8=['limit','count','set','Content-Range','json','apply','save','update','destroy','get','Trunks','UserProfileResource','stack','name','index','map','Trunk','key','query','keys','intersection','model','attributes','hasOwnProperty','nolimit','order','sort','filters','pick','filter','where','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','fields','length','find','clone','rawAttributes','omit','createdAt','updatedAt','body','create','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','join','root','server/files/templates/trunk.ejs','utf8','readFileSync','writeFileSync','/etc/asterisk/sip_xcally_trunks.conf','render','Reload','chan_sip.so','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','/etc/asterisk/sip_xcally_registers.conf','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','jayson/promise','client','then','info','Trunk,\x20%s,\x20%s','debug','Trunk,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','sendStatus','status','end','offset','undefined'];(function(_0x4309d9,_0x5b0b57){var _0x1af166=function(_0x20d871){while(--_0x20d871){_0x4309d9['push'](_0x4309d9['shift']());}};_0x1af166(++_0x5b0b57);}(_0x34e8,0x12c));var _0x834e=function(_0x960e47,_0x8cb60a){_0x960e47=_0x960e47-0x0;var _0x395a22=_0x34e8[_0x960e47];return _0x395a22;};'use strict';var emlformat=require(_0x834e('0x0'));var rimraf=require(_0x834e('0x1'));var zipdir=require(_0x834e('0x2'));var jsonpatch=require(_0x834e('0x3'));var rp=require('request-promise');var moment=require(_0x834e('0x4'));var BPromise=require(_0x834e('0x5'));var Mustache=require(_0x834e('0x6'));var util=require(_0x834e('0x7'));var path=require(_0x834e('0x8'));var sox=require(_0x834e('0x9'));var csv=require(_0x834e('0xa'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x834e('0xb'));var _=require('lodash');var squel=require(_0x834e('0xc'));var crypto=require(_0x834e('0xd'));var jsforce=require(_0x834e('0xe'));var deskjs=require(_0x834e('0xf'));var toCsv=require(_0x834e('0xa'));var querystring=require(_0x834e('0x10'));var Papa=require(_0x834e('0x11'));var Redis=require(_0x834e('0x12'));var authService=require(_0x834e('0x13'));var qs=require(_0x834e('0x14'));var as=require(_0x834e('0x15'));var hardwareService=require(_0x834e('0x16'));var logger=require(_0x834e('0x17'))(_0x834e('0x18'));var utils=require(_0x834e('0x19'));var config=require(_0x834e('0x1a'));var licenseUtil=require(_0x834e('0x1b'));var db=require('../../mysqldb')['db'];var jayson=require(_0x834e('0x1c'));var client=jayson[_0x834e('0x1d')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23848e,_0x2d95f2,_0x28e659,_0x21cc0a){return new BPromise(function(_0x50e860,_0x43156c){var _0x302cbd=_0x21cc0a||client;return _0x302cbd['request'](_0x23848e,_0x28e659)[_0x834e('0x1e')](function(_0x4a9cdc){logger[_0x834e('0x1f')](_0x834e('0x20'),_0x2d95f2,'request\x20sent');logger[_0x834e('0x21')](_0x834e('0x22'),_0x2d95f2,_0x834e('0x23'),JSON['stringify'](_0x4a9cdc));if(_0x4a9cdc[_0x834e('0x24')]){if(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x25')]===0x1f4){logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);return _0x43156c(_0x4a9cdc['error'][_0x834e('0x26')]);}logger[_0x834e('0x24')](_0x834e('0x20'),_0x2d95f2,_0x4a9cdc[_0x834e('0x24')]['message']);return _0x50e860(_0x4a9cdc[_0x834e('0x24')][_0x834e('0x26')]);}else{logger['info'](_0x834e('0x20'),_0x2d95f2,_0x834e('0x23'));_0x50e860(_0x4a9cdc[_0x834e('0x27')]['message']);}})['catch'](function(_0x231619){logger[_0x834e('0x24')]('Trunk,\x20%s,\x20%s',_0x2d95f2,_0x231619);_0x43156c(_0x231619);});});}function respondWithStatusCode(_0x25ee1d,_0x1dc1e0){_0x1dc1e0=_0x1dc1e0||0xcc;return function(_0x58f4fd){if(_0x58f4fd){return _0x25ee1d[_0x834e('0x28')](_0x1dc1e0);}return _0x25ee1d[_0x834e('0x29')](_0x1dc1e0)[_0x834e('0x2a')]();};}function respondWithResult(_0x561cd2,_0x24fcf7){_0x24fcf7=_0x24fcf7||0xc8;return function(_0x3e310f){if(_0x3e310f){return _0x561cd2['status'](_0x24fcf7)['json'](_0x3e310f);}};}function respondWithFilteredResult(_0x1e713a,_0x508a1d){return function(_0x2826ec){if(_0x2826ec){var _0x3f1b0b=typeof _0x508a1d[_0x834e('0x2b')]===_0x834e('0x2c')&&typeof _0x508a1d[_0x834e('0x2d')]===_0x834e('0x2c');var _0x491919=_0x2826ec['count'];var _0x4dc64a=_0x3f1b0b?0x0:_0x508a1d['offset'];var _0x2c7a8d=_0x3f1b0b?_0x2826ec[_0x834e('0x2e')]:_0x508a1d[_0x834e('0x2b')]+_0x508a1d['limit'];var _0xb5bc06;if(_0x2c7a8d>=_0x491919){_0x2c7a8d=_0x491919;_0xb5bc06=0xc8;}else{_0xb5bc06=0xce;}_0x1e713a[_0x834e('0x29')](_0xb5bc06);return _0x1e713a[_0x834e('0x2f')](_0x834e('0x30'),_0x4dc64a+'-'+_0x2c7a8d+'/'+_0x491919)[_0x834e('0x31')](_0x2826ec);}return null;};}function patchUpdates(_0x390119){return function(_0x3d149d){try{jsonpatch[_0x834e('0x32')](_0x3d149d,_0x390119,!![]);}catch(_0x278db3){return BPromise['reject'](_0x278db3);}return _0x3d149d[_0x834e('0x33')]();};}function saveUpdates(_0x5cad11,_0x2c75c2){return function(_0x3787b0){if(_0x3787b0){return _0x3787b0[_0x834e('0x34')](_0x5cad11)[_0x834e('0x1e')](function(_0x444366){return _0x444366;});}return null;};}function removeEntity(_0x4689c2,_0x4696a1){return function(_0x38cd29){if(_0x38cd29){return _0x38cd29[_0x834e('0x35')]()[_0x834e('0x1e')](function(){var _0x5bd232=_0x38cd29[_0x834e('0x36')]({'plain':!![]});var _0x2f408a=_0x834e('0x37');return db[_0x834e('0x38')]['destroy']({'where':{'type':_0x2f408a,'resourceId':_0x5bd232['id']}})[_0x834e('0x1e')](function(){return _0x38cd29;});})[_0x834e('0x1e')](function(){_0x4689c2['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x59385a,_0x3e58fa){return function(_0x41bf4d){if(!_0x41bf4d){_0x59385a[_0x834e('0x28')](0x194);}return _0x41bf4d;};}function handleError(_0x34fefb,_0x339e28){_0x339e28=_0x339e28||0x1f4;return function(_0x1b76dd){logger['error'](_0x1b76dd[_0x834e('0x39')]);if(_0x1b76dd['name']){delete _0x1b76dd[_0x834e('0x3a')];}_0x34fefb[_0x834e('0x29')](_0x339e28)['send'](_0x1b76dd);};}exports[_0x834e('0x3b')]=function(_0x2f56c7,_0x491c28){var _0x481f70={},_0x388711={},_0xd0d43a={'count':0x0,'rows':[]};var _0x2e9383=_[_0x834e('0x3c')](db[_0x834e('0x3d')]['rawAttributes'],function(_0x1c5ed6){return{'name':_0x1c5ed6['fieldName'],'type':_0x1c5ed6['type'][_0x834e('0x3e')]};});_0x388711['model']=_[_0x834e('0x3c')](_0x2e9383,_0x834e('0x3a'));_0x388711[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x2f56c7[_0x834e('0x3f')]);_0x388711['filters']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],_0x388711[_0x834e('0x3f')]);_0x481f70['attributes']=_[_0x834e('0x41')](_0x388711[_0x834e('0x42')],qs['fields'](_0x2f56c7[_0x834e('0x3f')]['fields']));_0x481f70[_0x834e('0x43')]=_0x481f70[_0x834e('0x43')]['length']?_0x481f70['attributes']:_0x388711[_0x834e('0x42')];if(!_0x2f56c7[_0x834e('0x3f')][_0x834e('0x44')](_0x834e('0x45'))){_0x481f70[_0x834e('0x2d')]=qs[_0x834e('0x2d')](_0x2f56c7[_0x834e('0x3f')]['limit']);_0x481f70[_0x834e('0x2b')]=qs['offset'](_0x2f56c7[_0x834e('0x3f')]['offset']);}_0x481f70[_0x834e('0x46')]=qs['sort'](_0x2f56c7[_0x834e('0x3f')][_0x834e('0x47')]);_0x481f70['where']=qs[_0x834e('0x48')](_[_0x834e('0x49')](_0x2f56c7[_0x834e('0x3f')],_0x388711[_0x834e('0x48')]),_0x2e9383);if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]){_0x481f70[_0x834e('0x4b')]=_[_0x834e('0x4c')](_0x481f70[_0x834e('0x4b')],{'$or':_[_0x834e('0x3c')](_0x2e9383,function(_0x5f3943){if(_0x5f3943[_0x834e('0x4d')]!==_0x834e('0x4e')){var _0x47a8a9={};_0x47a8a9[_0x5f3943[_0x834e('0x3a')]]={'$like':'%'+_0x2f56c7[_0x834e('0x3f')][_0x834e('0x4a')]+'%'};return _0x47a8a9;}})});}_0x481f70=_[_0x834e('0x4c')]({},_0x481f70,_0x2f56c7[_0x834e('0x4f')]);var _0x4264b8={'where':_0x481f70['where']};return db['Trunk'][_0x834e('0x2e')](_0x4264b8)[_0x834e('0x1e')](function(_0x30568e){_0xd0d43a[_0x834e('0x2e')]=_0x30568e;if(_0x2f56c7[_0x834e('0x3f')][_0x834e('0x50')]){_0x481f70[_0x834e('0x51')]=[{'all':!![]}];}return db[_0x834e('0x3d')][_0x834e('0x52')](_0x481f70);})[_0x834e('0x1e')](function(_0xf02f0d){_0xd0d43a[_0x834e('0x53')]=_0xf02f0d;return _0xd0d43a;})[_0x834e('0x1e')](respondWithFilteredResult(_0x491c28,_0x481f70))[_0x834e('0x54')](handleError(_0x491c28,null));};exports[_0x834e('0x55')]=function(_0x1a3855,_0x3df078){var _0x32b8f7={'raw':![],'where':{'id':_0x1a3855[_0x834e('0x56')]['id']}},_0x420841={};_0x420841['model']=_[_0x834e('0x40')](db[_0x834e('0x3d')]['rawAttributes']);_0x420841[_0x834e('0x3f')]=_[_0x834e('0x40')](_0x1a3855['query']);_0x420841[_0x834e('0x48')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],_0x420841[_0x834e('0x3f')]);_0x32b8f7[_0x834e('0x43')]=_[_0x834e('0x41')](_0x420841[_0x834e('0x42')],qs['fields'](_0x1a3855[_0x834e('0x3f')][_0x834e('0x57')]));_0x32b8f7[_0x834e('0x43')]=_0x32b8f7[_0x834e('0x43')][_0x834e('0x58')]?_0x32b8f7[_0x834e('0x43')]:_0x420841[_0x834e('0x42')];if(_0x1a3855[_0x834e('0x3f')]['includeAll']){_0x32b8f7[_0x834e('0x51')]=[{'all':!![]}];}_0x32b8f7=_['merge']({},_0x32b8f7,_0x1a3855[_0x834e('0x4f')]);return db['Trunk'][_0x834e('0x59')](_0x32b8f7)['then'](handleEntityNotFound(_0x3df078,null))['then'](respondWithResult(_0x3df078,null))[_0x834e('0x54')](handleError(_0x3df078,null));};exports[_0x834e('0x5a')]=function(_0x5291ae,_0x5be43d){var _0x2c8155={'where':{'id':_0x5291ae[_0x834e('0x56')]['id']}},_0x2452b4={};_0x2452b4[_0x834e('0x42')]=_[_0x834e('0x40')](db[_0x834e('0x3d')][_0x834e('0x5b')]);_0x2c8155[_0x834e('0x43')]=_['intersection'](_0x2452b4[_0x834e('0x42')],qs[_0x834e('0x57')](_0x5291ae['query'][_0x834e('0x57')]));_0x2c8155['attributes']=_0x2c8155[_0x834e('0x43')][_0x834e('0x58')]?_0x2c8155['attributes']:_0x2452b4[_0x834e('0x42')];if(_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]){_0x2c8155[_0x834e('0x51')]=[{'all':!![]}];}_0x2c8155=_['merge']({},_0x2c8155,_0x5291ae[_0x834e('0x4f')]);return db[_0x834e('0x3d')][_0x834e('0x59')](_0x2c8155)['then'](handleEntityNotFound(_0x5be43d,null))[_0x834e('0x1e')](function(_0x1fcae9){if(_0x1fcae9){var _0x3a7683=_0x1fcae9[_0x834e('0x36')]({'plain':!![]});_0x3a7683=qs[_0x834e('0x5c')](_0x3a7683,['id',_0x834e('0x5d'),_0x834e('0x5e')]);_0x5291ae[_0x834e('0x5f')]=_[_0x834e('0x5c')](_0x5291ae[_0x834e('0x5f')],['id',_0x834e('0x5d'),_0x834e('0x5e')]);return db[_0x834e('0x3d')][_0x834e('0x60')](_[_0x834e('0x4c')](_0x3a7683,_0x5291ae[_0x834e('0x5f')]),{'include':_0x5291ae[_0x834e('0x3f')][_0x834e('0x50')]?[{'all':!![]}]:undefined})[_0x834e('0x1e')](function(_0x3e3467){var _0xed4081=_0x5291ae[_0x834e('0x61')]['get']({'plain':!![]});if(!_0xed4081)throw new Error(_0x834e('0x62'));if(_0xed4081[_0x834e('0x63')]===_0x834e('0x61')){var _0x36cc14=_0x3e3467['get']({'plain':!![]});var _0x30faa8='Trunks';return db['UserProfileSection'][_0x834e('0x59')]({'where':{'name':_0x30faa8,'userProfileId':_0xed4081[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0xe79465){if(_0xe79465&&_0xe79465[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x36cc14[_0x834e('0x3a')],'resourceId':_0x36cc14['id'],'type':_0xe79465['name'],'sectionId':_0xe79465['id']},{})[_0x834e('0x1e')](function(){return _0x3e3467;});}else{return _0x3e3467;}})['catch'](function(_0x17e223){logger[_0x834e('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x17e223);throw _0x17e223;});}return _0x3e3467;});}})['then'](respondWithResult(_0x5be43d,0xc9))[_0x834e('0x54')](handleError(_0x5be43d,null));};exports[_0x834e('0x60')]=function(_0x363cc2,_0x2cca07,_0x2c41bd){var _0x5a4854;return db[_0x834e('0x3d')][_0x834e('0x60')](_0x363cc2[_0x834e('0x5f')],{'raw':!![]})[_0x834e('0x1e')](function(_0x3181af){_0x5a4854=_0x3181af;return db[_0x834e('0x3d')][_0x834e('0x52')]({'raw':!![]});})[_0x834e('0x1e')](function(_0x376f72){var _0x324f67=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x51cfab=fs[_0x834e('0x6a')](path['join'](config['root'],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x332d8f=ejs['render'](_0x324f67,{'trunks':_0x376f72||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x332d8f);if(_0x5a4854['registry']){var _0x353246=ejs[_0x834e('0x6d')](_0x51cfab,{'trunks':_0x376f72||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x353246);}})[_0x834e('0x1e')](function(){return respondWithRpcPromise(_0x834e('0x6e'),_0x834e('0x60'),{'module':_0x834e('0x6f')});})[_0x834e('0x1e')](function(){var _0x493239=_0x363cc2[_0x834e('0x61')]['get']({'plain':!![]});if(!_0x493239)throw new Error(_0x834e('0x62'));if(_0x493239[_0x834e('0x63')]===_0x834e('0x61')){var _0x5afb41=_0x5a4854[_0x834e('0x36')]({'plain':!![]});return db[_0x834e('0x70')]['find']({'where':{'name':_0x834e('0x37'),'userProfileId':_0x493239[_0x834e('0x64')]},'raw':!![]})[_0x834e('0x1e')](function(_0x50d0a3){if(_0x50d0a3&&_0x50d0a3[_0x834e('0x65')]===0x0){return db[_0x834e('0x38')][_0x834e('0x60')]({'name':_0x5afb41[_0x834e('0x3a')],'resourceId':_0x5afb41['id'],'type':_0x50d0a3[_0x834e('0x3a')],'sectionId':_0x50d0a3['id']},{})[_0x834e('0x1e')](function(){return _0x5a4854;});}else{return _0x5a4854;}})[_0x834e('0x54')](function(_0x23b5d9){logger[_0x834e('0x24')](_0x834e('0x71'),_0x23b5d9);throw _0x23b5d9;});}return _0x5a4854;})['then'](respondWithResult(_0x2cca07,0xc9))['catch'](handleError(_0x2cca07,null));};exports['update']=function(_0x36ede9,_0x1135a5,_0x313c03){var _0x37fa2c;return db[_0x834e('0x3d')]['find']({'where':{'id':_0x36ede9['params']['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x1135a5,null))[_0x834e('0x1e')](saveUpdates(_0x36ede9[_0x834e('0x5f')],null))[_0x834e('0x1e')](function(_0x40a705){if(_0x40a705){_0x37fa2c=_0x40a705;return db['Trunk'][_0x834e('0x52')]({'raw':!![]});}})[_0x834e('0x1e')](function(_0x113714){if(_0x113714){var _0x4e1735=fs[_0x834e('0x6a')](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0x585d02=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),_0x834e('0x69'));var _0x509427=ejs[_0x834e('0x6d')](_0x4e1735,{'trunks':_0x113714||[]});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x509427);var _0x53012d=ejs[_0x834e('0x6d')](_0x585d02,{'trunks':_0x113714||[]});fs['writeFileSync']('/etc/asterisk/sip_xcally_registers.conf',_0x53012d);return respondWithRpcPromise('Reload',_0x834e('0x34'),{'module':_0x834e('0x6f')});}return null;})[_0x834e('0x1e')](function(_0x1d76c6){if(_0x1d76c6){return _0x37fa2c;}})[_0x834e('0x1e')](respondWithResult(_0x1135a5,null))[_0x834e('0x54')](handleError(_0x1135a5,null));};exports[_0x834e('0x35')]=function(_0x179892,_0x17e61a,_0x53f6e3){var _0x2f775a;return db['Trunk'][_0x834e('0x59')]({'where':{'id':_0x179892[_0x834e('0x56')]['id']}})[_0x834e('0x1e')](handleEntityNotFound(_0x17e61a,null))[_0x834e('0x1e')](removeEntity(_0x17e61a,null))[_0x834e('0x1e')](function(){return db[_0x834e('0x3d')]['findAll']({'raw':!![]});})['then'](function(_0xeb096d){var _0x2a854a=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],_0x834e('0x68')),_0x834e('0x69'));var _0xc75f5e=fs['readFileSync'](path[_0x834e('0x66')](config[_0x834e('0x67')],'server/files/templates/registry.ejs'),'utf8');var _0x5ede29=ejs[_0x834e('0x6d')](_0x2a854a,{'trunks':_0xeb096d});var _0x1f3e26=ejs['render'](_0xc75f5e,{'trunks':_0xeb096d});fs[_0x834e('0x6b')](_0x834e('0x6c'),_0x5ede29);fs['writeFileSync'](_0x834e('0x72'),_0x1f3e26);return respondWithRpcPromise('Reload','destroy',{'module':_0x834e('0x6f')});})[_0x834e('0x54')](handleError(_0x17e61a,null));}; \ No newline at end of file diff --git a/server/api/trunk/trunk.model.js b/server/api/trunk/trunk.model.js index 443ec54..32a55da 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 _0x35ae=['rimraf','exports','define','Trunk','tools_trunks','lodash','bluebird','request-promise','path'];(function(_0x204e52,_0x1d553a){var _0xe5dd25=function(_0x39302b){while(--_0x39302b){_0x204e52['push'](_0x204e52['shift']());}};_0xe5dd25(++_0x1d553a);}(_0x35ae,0xf8));var _0xe35a=function(_0x3856f5,_0x227675){_0x3856f5=_0x3856f5-0x0;var _0x2e8d1b=_0x35ae[_0x3856f5];return _0x2e8d1b;};'use strict';var _=require(_0xe35a('0x0'));var util=require('util');var logger=require('../../config/logger')('api');var moment=require('moment');var BPromise=require(_0xe35a('0x1'));var rp=require(_0xe35a('0x2'));var fs=require('fs');var path=require(_0xe35a('0x3'));var rimraf=require(_0xe35a('0x4'));var config=require('../../config/environment');var attributes=require('./trunk.attributes');module[_0xe35a('0x5')]=function(_0x4baed2,_0x1968ef){return _0x4baed2[_0xe35a('0x6')](_0xe35a('0x7'),attributes,{'tableName':_0xe35a('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc593=['path','rimraf','./trunk.attributes','exports','tools_trunks','lodash','util','../../config/logger','api','moment','bluebird'];(function(_0x5be1ac,_0x5ee1f4){var _0x21b996=function(_0x377104){while(--_0x377104){_0x5be1ac['push'](_0x5be1ac['shift']());}};_0x21b996(++_0x5ee1f4);}(_0xc593,0x17b));var _0x3c59=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0xc593[_0x4b369d];return _0x571a98;};'use strict';var _=require(_0x3c59('0x0'));var util=require(_0x3c59('0x1'));var logger=require(_0x3c59('0x2'))(_0x3c59('0x3'));var moment=require(_0x3c59('0x4'));var BPromise=require(_0x3c59('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x3c59('0x6'));var rimraf=require(_0x3c59('0x7'));var config=require('../../config/environment');var attributes=require(_0x3c59('0x8'));module[_0x3c59('0x9')]=function(_0x4fbbc6,_0x42165f){return _0x4fbbc6['define']('Trunk',attributes,{'tableName':_0x3c59('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/trunk/trunk.rpc.js b/server/api/trunk/trunk.rpc.js index 7e94557..3db3ea0 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 _0x8190=['findAll','options','raw','where','attributes','limit','include','map','model','ShowTrunk','debug','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','info','Trunk,\x20%s,\x20%s','request\x20sent','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','GetTrunk','Trunk'];(function(_0x1a0ef3,_0x535bbf){var _0x2b86da=function(_0x5d30f9){while(--_0x5d30f9){_0x1a0ef3['push'](_0x1a0ef3['shift']());}};_0x2b86da(++_0x535bbf);}(_0x8190,0x11b));var _0x0819=function(_0x1129c2,_0x279c66){_0x1129c2=_0x1129c2-0x0;var _0x57b617=_0x8190[_0x1129c2];return _0x57b617;};'use strict';var _=require(_0x0819('0x0'));var util=require(_0x0819('0x1'));var moment=require(_0x0819('0x2'));var BPromise=require(_0x0819('0x3'));var rs=require(_0x0819('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0819('0x5'))['db'];var utils=require(_0x0819('0x6'));var logger=require('../../config/logger')(_0x0819('0x7'));var config=require(_0x0819('0x8'));var jayson=require(_0x0819('0x9'));var client=jayson[_0x0819('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x488ee1,_0x14466f,_0x47aef2){return new BPromise(function(_0x8d306d,_0x161aa0){return client['request'](_0x488ee1,_0x47aef2)['then'](function(_0x126a93){logger[_0x0819('0xb')](_0x0819('0xc'),_0x14466f,_0x0819('0xd'));logger['debug'](_0x0819('0xe'),_0x14466f,'request\x20sent',JSON[_0x0819('0xf')](_0x126a93));if(_0x126a93[_0x0819('0x10')]){if(_0x126a93[_0x0819('0x10')][_0x0819('0x11')]===0x1f4){logger[_0x0819('0x10')](_0x0819('0xc'),_0x14466f,_0x126a93[_0x0819('0x10')][_0x0819('0x12')]);return _0x161aa0(_0x126a93[_0x0819('0x10')][_0x0819('0x12')]);}logger[_0x0819('0x10')](_0x0819('0xc'),_0x14466f,_0x126a93[_0x0819('0x10')][_0x0819('0x12')]);return _0x8d306d(_0x126a93[_0x0819('0x10')][_0x0819('0x12')]);}else{logger[_0x0819('0xb')](_0x0819('0xc'),_0x14466f,'request\x20sent');_0x8d306d(_0x126a93[_0x0819('0x13')][_0x0819('0x12')]);}})[_0x0819('0x14')](function(_0x25e68d){logger[_0x0819('0x10')](_0x0819('0xc'),_0x14466f,_0x25e68d);_0x161aa0(_0x25e68d);});});}exports[_0x0819('0x15')]=function(_0x434c50){var _0xc98dd8=this;return new Promise(function(_0xbdc51e,_0x503a3a){return db[_0x0819('0x16')][_0x0819('0x17')]({'raw':_0x434c50[_0x0819('0x18')]?_0x434c50[_0x0819('0x18')][_0x0819('0x19')]===undefined?!![]:![]:!![],'where':_0x434c50[_0x0819('0x18')]?_0x434c50[_0x0819('0x18')][_0x0819('0x1a')]||null:null,'attributes':_0x434c50[_0x0819('0x18')]?_0x434c50[_0x0819('0x18')][_0x0819('0x1b')]||null:null,'limit':_0x434c50[_0x0819('0x18')]?_0x434c50['options'][_0x0819('0x1c')]||null:null,'include':_0x434c50[_0x0819('0x18')]?_0x434c50[_0x0819('0x18')][_0x0819('0x1d')]?_[_0x0819('0x1e')](_0x434c50[_0x0819('0x18')][_0x0819('0x1d')],function(_0x40d576){return{'model':db[_0x40d576['model']],'as':_0x40d576['as'],'attributes':_0x40d576[_0x0819('0x1b')],'include':_0x40d576[_0x0819('0x1d')]?_[_0x0819('0x1e')](_0x40d576[_0x0819('0x1d')],function(_0x3e5b35){return{'model':db[_0x3e5b35[_0x0819('0x1f')]],'as':_0x3e5b35['as'],'attributes':_0x3e5b35[_0x0819('0x1b')],'include':_0x3e5b35['include']?_[_0x0819('0x1e')](_0x3e5b35['include'],function(_0x56f1f8){return{'model':db[_0x56f1f8[_0x0819('0x1f')]],'as':_0x56f1f8['as'],'attributes':_0x56f1f8[_0x0819('0x1b')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x506c9f){logger[_0x0819('0xb')](_0x0819('0x15'),_0x434c50);logger['debug'](_0x0819('0x15'),_0x434c50,JSON[_0x0819('0xf')](_0x506c9f));_0xbdc51e(_0x506c9f);})[_0x0819('0x14')](function(_0x2f29f2){logger[_0x0819('0x10')](_0x0819('0x15'),_0x2f29f2[_0x0819('0x12')],_0x434c50);_0x503a3a(_0xc98dd8[_0x0819('0x10')](0x1f4,_0x2f29f2['message']));});});};exports['ShowTrunk']=function(_0x5a88b8){var _0x4c5ef2=this;return new Promise(function(_0x4e0f4b,_0x54ea47){return db[_0x0819('0x16')]['find']({'raw':_0x5a88b8[_0x0819('0x18')]?_0x5a88b8['options'][_0x0819('0x19')]===undefined?!![]:![]:!![],'where':_0x5a88b8[_0x0819('0x18')]?_0x5a88b8[_0x0819('0x18')]['where']||null:null,'attributes':_0x5a88b8[_0x0819('0x18')]?_0x5a88b8[_0x0819('0x18')]['attributes']||null:null,'include':_0x5a88b8[_0x0819('0x18')]?_0x5a88b8[_0x0819('0x18')][_0x0819('0x1d')]?_['map'](_0x5a88b8[_0x0819('0x18')]['include'],function(_0x4850d6){return{'model':db[_0x4850d6['model']],'as':_0x4850d6['as'],'attributes':_0x4850d6[_0x0819('0x1b')],'include':_0x4850d6[_0x0819('0x1d')]?_['map'](_0x4850d6[_0x0819('0x1d')],function(_0x1405a8){return{'model':db[_0x1405a8[_0x0819('0x1f')]],'as':_0x1405a8['as'],'attributes':_0x1405a8['attributes'],'include':_0x1405a8[_0x0819('0x1d')]?_[_0x0819('0x1e')](_0x1405a8['include'],function(_0x5e0479){return{'model':db[_0x5e0479[_0x0819('0x1f')]],'as':_0x5e0479['as'],'attributes':_0x5e0479['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x58fa18){logger[_0x0819('0xb')](_0x0819('0x20'),_0x5a88b8);logger[_0x0819('0x21')](_0x0819('0x20'),_0x5a88b8,JSON['stringify'](_0x58fa18));_0x4e0f4b(_0x58fa18);})[_0x0819('0x14')](function(_0x5f57b5){logger[_0x0819('0x10')](_0x0819('0x20'),_0x5f57b5['message'],_0x5a88b8);_0x54ea47(_0x4c5ef2[_0x0819('0x10')](0x1f4,_0x5f57b5[_0x0819('0x12')]));});});}; \ No newline at end of file +var _0x88fa=['attributes','limit','include','map','model','GetTrunk','ShowTrunk','catch','util','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','debug','Trunk,\x20%s,\x20%s,\x20%s','stringify','error','message','Trunk,\x20%s,\x20%s','request\x20sent','result','Trunk','options','raw','where'];(function(_0x33ae25,_0x2316df){var _0x5d7a27=function(_0x319d7d){while(--_0x319d7d){_0x33ae25['push'](_0x33ae25['shift']());}};_0x5d7a27(++_0x2316df);}(_0x88fa,0x100));var _0xa88f=function(_0x1d046a,_0x30db41){_0x1d046a=_0x1d046a-0x0;var _0x2c0b0c=_0x88fa[_0x1d046a];return _0x2c0b0c;};'use strict';var _=require('lodash');var util=require(_0xa88f('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xa88f('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xa88f('0x2'))['db'];var utils=require('../../config/utils');var logger=require(_0xa88f('0x3'))(_0xa88f('0x4'));var config=require(_0xa88f('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xa88f('0x6')][_0xa88f('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x51c30c,_0x578f3c,_0x39b123){return new BPromise(function(_0x1d8d1f,_0x2c1ff1){return client[_0xa88f('0x8')](_0x51c30c,_0x39b123)[_0xa88f('0x9')](function(_0x3e6e86){logger[_0xa88f('0xa')]('Trunk,\x20%s,\x20%s',_0x578f3c,'request\x20sent');logger[_0xa88f('0xb')](_0xa88f('0xc'),_0x578f3c,'request\x20sent',JSON[_0xa88f('0xd')](_0x3e6e86));if(_0x3e6e86[_0xa88f('0xe')]){if(_0x3e6e86['error']['code']===0x1f4){logger[_0xa88f('0xe')]('Trunk,\x20%s,\x20%s',_0x578f3c,_0x3e6e86[_0xa88f('0xe')][_0xa88f('0xf')]);return _0x2c1ff1(_0x3e6e86[_0xa88f('0xe')][_0xa88f('0xf')]);}logger['error'](_0xa88f('0x10'),_0x578f3c,_0x3e6e86[_0xa88f('0xe')]['message']);return _0x1d8d1f(_0x3e6e86[_0xa88f('0xe')][_0xa88f('0xf')]);}else{logger[_0xa88f('0xa')](_0xa88f('0x10'),_0x578f3c,_0xa88f('0x11'));_0x1d8d1f(_0x3e6e86[_0xa88f('0x12')][_0xa88f('0xf')]);}})['catch'](function(_0x2ecb6e){logger[_0xa88f('0xe')](_0xa88f('0x10'),_0x578f3c,_0x2ecb6e);_0x2c1ff1(_0x2ecb6e);});});}exports['GetTrunk']=function(_0x222164){var _0x5792a6=this;return new Promise(function(_0x202f5c,_0xb22eb3){return db[_0xa88f('0x13')]['findAll']({'raw':_0x222164[_0xa88f('0x14')]?_0x222164[_0xa88f('0x14')][_0xa88f('0x15')]===undefined?!![]:![]:!![],'where':_0x222164[_0xa88f('0x14')]?_0x222164['options'][_0xa88f('0x16')]||null:null,'attributes':_0x222164['options']?_0x222164[_0xa88f('0x14')][_0xa88f('0x17')]||null:null,'limit':_0x222164[_0xa88f('0x14')]?_0x222164[_0xa88f('0x14')][_0xa88f('0x18')]||null:null,'include':_0x222164[_0xa88f('0x14')]?_0x222164[_0xa88f('0x14')][_0xa88f('0x19')]?_[_0xa88f('0x1a')](_0x222164[_0xa88f('0x14')]['include'],function(_0x84450){return{'model':db[_0x84450[_0xa88f('0x1b')]],'as':_0x84450['as'],'attributes':_0x84450[_0xa88f('0x17')],'include':_0x84450['include']?_['map'](_0x84450[_0xa88f('0x19')],function(_0x391330){return{'model':db[_0x391330['model']],'as':_0x391330['as'],'attributes':_0x391330[_0xa88f('0x17')],'include':_0x391330['include']?_[_0xa88f('0x1a')](_0x391330[_0xa88f('0x19')],function(_0x27790d){return{'model':db[_0x27790d[_0xa88f('0x1b')]],'as':_0x27790d['as'],'attributes':_0x27790d[_0xa88f('0x17')]};}):[]};}):[]};}):[]:[]})[_0xa88f('0x9')](function(_0x5a3e57){logger[_0xa88f('0xa')](_0xa88f('0x1c'),_0x222164);logger[_0xa88f('0xb')](_0xa88f('0x1c'),_0x222164,JSON[_0xa88f('0xd')](_0x5a3e57));_0x202f5c(_0x5a3e57);})['catch'](function(_0x5003ce){logger['error']('GetTrunk',_0x5003ce[_0xa88f('0xf')],_0x222164);_0xb22eb3(_0x5792a6[_0xa88f('0xe')](0x1f4,_0x5003ce['message']));});});};exports[_0xa88f('0x1d')]=function(_0xe297ac){var _0x410d2e=this;return new Promise(function(_0x305e78,_0x314302){return db['Trunk']['find']({'raw':_0xe297ac[_0xa88f('0x14')]?_0xe297ac[_0xa88f('0x14')][_0xa88f('0x15')]===undefined?!![]:![]:!![],'where':_0xe297ac[_0xa88f('0x14')]?_0xe297ac[_0xa88f('0x14')]['where']||null:null,'attributes':_0xe297ac[_0xa88f('0x14')]?_0xe297ac[_0xa88f('0x14')]['attributes']||null:null,'include':_0xe297ac[_0xa88f('0x14')]?_0xe297ac['options']['include']?_[_0xa88f('0x1a')](_0xe297ac[_0xa88f('0x14')][_0xa88f('0x19')],function(_0x2dc3ca){return{'model':db[_0x2dc3ca['model']],'as':_0x2dc3ca['as'],'attributes':_0x2dc3ca[_0xa88f('0x17')],'include':_0x2dc3ca[_0xa88f('0x19')]?_[_0xa88f('0x1a')](_0x2dc3ca[_0xa88f('0x19')],function(_0x396532){return{'model':db[_0x396532[_0xa88f('0x1b')]],'as':_0x396532['as'],'attributes':_0x396532[_0xa88f('0x17')],'include':_0x396532[_0xa88f('0x19')]?_[_0xa88f('0x1a')](_0x396532['include'],function(_0x8949ad){return{'model':db[_0x8949ad[_0xa88f('0x1b')]],'as':_0x8949ad['as'],'attributes':_0x8949ad[_0xa88f('0x17')]};}):[]};}):[]};}):[]:[]})[_0xa88f('0x9')](function(_0xf3d225){logger['info'](_0xa88f('0x1d'),_0xe297ac);logger[_0xa88f('0xb')](_0xa88f('0x1d'),_0xe297ac,JSON[_0xa88f('0xd')](_0xf3d225));_0x305e78(_0xf3d225);})[_0xa88f('0x1e')](function(_0x104213){logger[_0xa88f('0xe')]('ShowTrunk',_0x104213[_0xa88f('0xf')],_0xe297ac);_0x314302(_0x410d2e['error'](0x1f4,_0x104213[_0xa88f('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/user-setting/index.js b/server/api/user-setting/index.js index 09bd574..3a53e09 100644 --- a/server/api/user-setting/index.js +++ b/server/api/user-setting/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8d26=['express','Router','../../components/auth/service','put','/:id','isAuthenticated','update','exports'];(function(_0x149083,_0x4047b6){var _0x4dc74e=function(_0x1211f9){while(--_0x1211f9){_0x149083['push'](_0x149083['shift']());}};_0x4dc74e(++_0x4047b6);}(_0x8d26,0x150));var _0x68d2=function(_0x3a19d4,_0x3f19a4){_0x3a19d4=_0x3a19d4-0x0;var _0x5b858b=_0x8d26[_0x3a19d4];return _0x5b858b;};'use strict';var express=require(_0x68d2('0x0'));var router=express[_0x68d2('0x1')]();var auth=require(_0x68d2('0x2'));var controller=require('./user-setting.controller');router[_0x68d2('0x3')](_0x68d2('0x4'),auth[_0x68d2('0x5')](),controller[_0x68d2('0x6')]);module[_0x68d2('0x7')]=router; \ No newline at end of file +var _0xf6c9=['exports','express','Router','../../components/auth/service','./user-setting.controller','put','/:id','isAuthenticated','update'];(function(_0x4d4aa9,_0x64535){var _0x5e1d2c=function(_0x56c8fe){while(--_0x56c8fe){_0x4d4aa9['push'](_0x4d4aa9['shift']());}};_0x5e1d2c(++_0x64535);}(_0xf6c9,0x10f));var _0x9f6c=function(_0x1a8e71,_0x3c8579){_0x1a8e71=_0x1a8e71-0x0;var _0x448ea1=_0xf6c9[_0x1a8e71];return _0x448ea1;};'use strict';var express=require(_0x9f6c('0x0'));var router=express[_0x9f6c('0x1')]();var auth=require(_0x9f6c('0x2'));var controller=require(_0x9f6c('0x3'));router[_0x9f6c('0x4')](_0x9f6c('0x5'),auth[_0x9f6c('0x6')](),controller[_0x9f6c('0x7')]);module[_0x9f6c('0x8')]=router; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.attributes.js b/server/api/user-setting/user-setting.attributes.js index 64527c6..fd5ef07 100644 --- a/server/api/user-setting/user-setting.attributes.js +++ b/server/api/user-setting/user-setting.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf208=['error','BOOLEAN','TEXT','DATE','INTEGER','sequelize','info','debug','exports'];(function(_0x3b380d,_0x4bf247){var _0x54502b=function(_0x35d207){while(--_0x35d207){_0x3b380d['push'](_0x3b380d['shift']());}};_0x54502b(++_0x4bf247);}(_0xf208,0x10a));var _0x8f20=function(_0x7371f0,_0xb81970){_0x7371f0=_0x7371f0-0x0;var _0x401c4a=_0xf208[_0x7371f0];return _0x401c4a;};'use strict';var Sequelize=require(_0x8f20('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error','warning',_0x8f20('0x1'),_0x8f20('0x2')];module[_0x8f20('0x3')]={'clientSideLoggingLevel':{'type':Sequelize['ENUM'](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0x8f20('0x4'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0x8f20('0x5')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0x8f20('0x6')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0x8f20('0x7')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0x8f20('0x8')],'unique':'UserId'}}; \ No newline at end of file +var _0x722b=['debug','exports','ENUM','error','BOOLEAN','TEXT','DATE','INTEGER','UserId','sequelize','warning','info'];(function(_0x5eb39d,_0x210ac3){var _0x200a2e=function(_0x10893f){while(--_0x10893f){_0x5eb39d['push'](_0x5eb39d['shift']());}};_0x200a2e(++_0x210ac3);}(_0x722b,0xed));var _0xb722=function(_0x291964,_0x53a984){_0x291964=_0x291964-0x0;var _0x411e8b=_0x722b[_0x291964];return _0x411e8b;};'use strict';var Sequelize=require(_0xb722('0x0'));const CLIENT_SIDE_LOG_LEVELS=['error',_0xb722('0x1'),_0xb722('0x2'),_0xb722('0x3')];module[_0xb722('0x4')]={'clientSideLoggingLevel':{'type':Sequelize[_0xb722('0x5')](CLIENT_SIDE_LOG_LEVELS),'allowNull':![],'defaultValue':_0xb722('0x6'),'validate':{'isIn':[CLIENT_SIDE_LOG_LEVELS]}},'clientSideLoggingEnabled':{'type':Sequelize[_0xb722('0x7')],'defaultValue':![]},'clientSideLoggingScopes':{'type':Sequelize[_0xb722('0x8')],'allowNull':!![]},'clientSideLoggingEnabledSince':{'type':Sequelize[_0xb722('0x9')],'allowNull':!![],'defaultValue':null},'UserId':{'type':Sequelize[_0xb722('0xa')],'unique':_0xb722('0xb')}}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.controller.js b/server/api/user-setting/user-setting.controller.js index 2d79762..39e2b6d 100644 --- a/server/api/user-setting/user-setting.controller.js +++ b/server/api/user-setting/user-setting.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xac55=['lodash','ioredis','../../config/logger','api','../../mysqldb','socket.io-emitter','redis','./user-setting.socket','register','defaults','status','json','sendStatus','error','name','send','update','role','admin','params','UserSetting','find','then','body'];(function(_0x44a94,_0x39f323){var _0x31ef56=function(_0x54e098){while(--_0x54e098){_0x44a94['push'](_0x44a94['shift']());}};_0x31ef56(++_0x39f323);}(_0xac55,0x1c8));var _0x5ac5=function(_0x376e9c,_0x43fd){_0x376e9c=_0x376e9c-0x0;var _0x14b090=_0xac55[_0x376e9c];return _0x14b090;};'use strict';var _=require(_0x5ac5('0x0'));var Redis=require(_0x5ac5('0x1'));var logger=require(_0x5ac5('0x2'))(_0x5ac5('0x3'));var config=require('../../config/environment');var db=require(_0x5ac5('0x4'))['db'];var socket=require(_0x5ac5('0x5'))(new Redis(config[_0x5ac5('0x6')]));require(_0x5ac5('0x7'))[_0x5ac5('0x8')](socket);config[_0x5ac5('0x6')]=_[_0x5ac5('0x9')](config['redis'],{'host':'localhost','port':0x18eb});function respondWithResult(_0x34093b,_0x247752){_0x247752=_0x247752||0xc8;return function(_0x2bee03){if(_0x2bee03){return _0x34093b[_0x5ac5('0xa')](_0x247752)[_0x5ac5('0xb')](_0x2bee03);}};}function saveUpdates(_0x47a7b4){return function(_0x18f785){if(_0x18f785){return _0x18f785['update'](_0x47a7b4)['then'](function(_0x2414f9){return _0x2414f9;});}return null;};}function handleEntityNotFound(_0x13ef10){return function(_0x4ec845){if(!_0x4ec845){_0x13ef10[_0x5ac5('0xc')](0x194);}return _0x4ec845;};}function handleError(_0x294425,_0x5a2aaa){_0x5a2aaa=_0x5a2aaa||0x1f4;return function(_0x2b70ed){logger[_0x5ac5('0xd')](_0x2b70ed['stack']);if(_0x2b70ed[_0x5ac5('0xe')]){delete _0x2b70ed[_0x5ac5('0xe')];}_0x294425[_0x5ac5('0xa')](_0x5a2aaa)[_0x5ac5('0xf')](_0x2b70ed);};}exports[_0x5ac5('0x10')]=function(_0x4808ea,_0xe37d9a){if(_0x4808ea['user'][_0x5ac5('0x11')]!==_0x5ac5('0x12'))throw new Error('Unauthorized');if(isNaN(Number(_0x4808ea[_0x5ac5('0x13')]['id'])))throw new Error('Invalid\x20user\x20setting\x20id');return db[_0x5ac5('0x14')][_0x5ac5('0x15')]({'where':{'id':_0x4808ea[_0x5ac5('0x13')]['id']}})[_0x5ac5('0x16')](handleEntityNotFound(_0xe37d9a,null))[_0x5ac5('0x16')](saveUpdates(_0x4808ea[_0x5ac5('0x17')],null))[_0x5ac5('0x16')](respondWithResult(_0xe37d9a,null))['catch'](handleError(_0xe37d9a,null));}; \ No newline at end of file +var _0xe148=['../../config/environment','socket.io-emitter','redis','./user-setting.socket','register','localhost','status','json','then','error','stack','name','update','user','Unauthorized','params','Invalid\x20user\x20setting\x20id','UserSetting','find','catch','lodash','ioredis','api'];(function(_0x265ff5,_0xcbea65){var _0x5298fc=function(_0x192d46){while(--_0x192d46){_0x265ff5['push'](_0x265ff5['shift']());}};_0x5298fc(++_0xcbea65);}(_0xe148,0x9e));var _0x8e14=function(_0x397dd0,_0x58a7a8){_0x397dd0=_0x397dd0-0x0;var _0x4188b2=_0xe148[_0x397dd0];return _0x4188b2;};'use strict';var _=require(_0x8e14('0x0'));var Redis=require(_0x8e14('0x1'));var logger=require('../../config/logger')(_0x8e14('0x2'));var config=require(_0x8e14('0x3'));var db=require('../../mysqldb')['db'];var socket=require(_0x8e14('0x4'))(new Redis(config[_0x8e14('0x5')]));require(_0x8e14('0x6'))[_0x8e14('0x7')](socket);config['redis']=_['defaults'](config[_0x8e14('0x5')],{'host':_0x8e14('0x8'),'port':0x18eb});function respondWithResult(_0x5d5232,_0x1a8608){_0x1a8608=_0x1a8608||0xc8;return function(_0x231d97){if(_0x231d97){return _0x5d5232[_0x8e14('0x9')](_0x1a8608)[_0x8e14('0xa')](_0x231d97);}};}function saveUpdates(_0x57b082){return function(_0x1aaba9){if(_0x1aaba9){return _0x1aaba9['update'](_0x57b082)[_0x8e14('0xb')](function(_0x2587a1){return _0x2587a1;});}return null;};}function handleEntityNotFound(_0x491a46){return function(_0x9a0381){if(!_0x9a0381){_0x491a46['sendStatus'](0x194);}return _0x9a0381;};}function handleError(_0x4792a0,_0x197f35){_0x197f35=_0x197f35||0x1f4;return function(_0x48554a){logger[_0x8e14('0xc')](_0x48554a[_0x8e14('0xd')]);if(_0x48554a['name']){delete _0x48554a[_0x8e14('0xe')];}_0x4792a0['status'](_0x197f35)['send'](_0x48554a);};}exports[_0x8e14('0xf')]=function(_0x5d85ce,_0x29a2b4){if(_0x5d85ce[_0x8e14('0x10')]['role']!=='admin')throw new Error(_0x8e14('0x11'));if(isNaN(Number(_0x5d85ce[_0x8e14('0x12')]['id'])))throw new Error(_0x8e14('0x13'));return db[_0x8e14('0x14')][_0x8e14('0x15')]({'where':{'id':_0x5d85ce['params']['id']}})[_0x8e14('0xb')](handleEntityNotFound(_0x29a2b4,null))[_0x8e14('0xb')](saveUpdates(_0x5d85ce['body'],null))[_0x8e14('0xb')](respondWithResult(_0x29a2b4,null))[_0x8e14('0x16')](handleError(_0x29a2b4,null));}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.events.js b/server/api/user-setting/user-setting.events.js index 4690d11..13fdf2c 100644 --- a/server/api/user-setting/user-setting.events.js +++ b/server/api/user-setting/user-setting.events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe6d4=['update','remove','emit','hook','exports','events','../../mysqldb','setMaxListeners','save'];(function(_0x4e36a6,_0x387605){var _0xe78dd8=function(_0x1744a0){while(--_0x1744a0){_0x4e36a6['push'](_0x4e36a6['shift']());}};_0xe78dd8(++_0x387605);}(_0xe6d4,0x191));var _0x4e6d=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xe6d4[_0xa464c9];return _0x3d73c4;};'use strict';var EventEmitter=require(_0x4e6d('0x0'));var UserSetting=require(_0x4e6d('0x1'))['db']['UserSetting'];var UserSettingEvents=new EventEmitter();UserSettingEvents[_0x4e6d('0x2')](0x0);var events={'afterCreate':_0x4e6d('0x3'),'afterUpdate':_0x4e6d('0x4'),'afterDestroy':_0x4e6d('0x5')};function emitEvent(_0x566b83){return function(_0x1807e3,_0x282373,_0x147359){UserSettingEvents[_0x4e6d('0x6')](_0x566b83+':'+_0x1807e3['id'],_0x1807e3);UserSettingEvents[_0x4e6d('0x6')](_0x566b83,_0x1807e3);_0x147359(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserSetting[_0x4e6d('0x7')](e,emitEvent(event));}}module[_0x4e6d('0x8')]=UserSettingEvents; \ No newline at end of file +var _0xe677=['events','UserSetting','save','update','remove','emit','hasOwnProperty','hook'];(function(_0x332daa,_0x4b7075){var _0x2d3d7d=function(_0x4429ed){while(--_0x4429ed){_0x332daa['push'](_0x332daa['shift']());}};_0x2d3d7d(++_0x4b7075);}(_0xe677,0x1c0));var _0x7e67=function(_0x37e845,_0x219f9f){_0x37e845=_0x37e845-0x0;var _0x59e55b=_0xe677[_0x37e845];return _0x59e55b;};'use strict';var EventEmitter=require(_0x7e67('0x0'));var UserSetting=require('../../mysqldb')['db'][_0x7e67('0x1')];var UserSettingEvents=new EventEmitter();UserSettingEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x7e67('0x2'),'afterUpdate':_0x7e67('0x3'),'afterDestroy':_0x7e67('0x4')};function emitEvent(_0x4da510){return function(_0x2c3fd4,_0x2e6907,_0x3f9d3f){UserSettingEvents['emit'](_0x4da510+':'+_0x2c3fd4['id'],_0x2c3fd4);UserSettingEvents[_0x7e67('0x5')](_0x4da510,_0x2c3fd4);_0x3f9d3f(null);};}for(var e in events){if(events[_0x7e67('0x6')](e)){var event=events[e];UserSetting[_0x7e67('0x7')](e,emitEvent(event));}}module['exports']=UserSettingEvents; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.model.js b/server/api/user-setting/user-setting.model.js index f022cd5..aa5898f 100644 --- a/server/api/user-setting/user-setting.model.js +++ b/server/api/user-setting/user-setting.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x1beb=['./user-setting.attributes','exports','define','UserSetting','user_settings','clientSideLoggingEnabled','clientSideLoggingEnabledSince'];(function(_0x34f7d8,_0x1acc0f){var _0x5ed89a=function(_0x2fd026){while(--_0x2fd026){_0x34f7d8['push'](_0x34f7d8['shift']());}};_0x5ed89a(++_0x1acc0f);}(_0x1beb,0x165));var _0xb1be=function(_0x243a12,_0x21d93c){_0x243a12=_0x243a12-0x0;var _0x86c510=_0x1beb[_0x243a12];return _0x86c510;};'use strict';var attributes=require(_0xb1be('0x0'));module[_0xb1be('0x1')]=function(_0x56672f){return _0x56672f[_0xb1be('0x2')](_0xb1be('0x3'),attributes,{'tableName':_0xb1be('0x4'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x55259c){if(!_0x55259c[_0xb1be('0x5')])_0x55259c[_0xb1be('0x6')]=null;else if(_0x55259c['clientSideLoggingEnabledSince']===null)_0x55259c[_0xb1be('0x6')]=new Date();}}});}; \ No newline at end of file +var _0x7462=['clientSideLoggingEnabled','clientSideLoggingEnabledSince','./user-setting.attributes','exports','UserSetting'];(function(_0x1ccb95,_0x1b3be8){var _0x1a9725=function(_0x1a6bf7){while(--_0x1a6bf7){_0x1ccb95['push'](_0x1ccb95['shift']());}};_0x1a9725(++_0x1b3be8);}(_0x7462,0x165));var _0x2746=function(_0x2493f7,_0x49c670){_0x2493f7=_0x2493f7-0x0;var _0x594ab2=_0x7462[_0x2493f7];return _0x594ab2;};'use strict';var attributes=require(_0x2746('0x0'));module[_0x2746('0x1')]=function(_0x5666d5){return _0x5666d5['define'](_0x2746('0x2'),attributes,{'tableName':'user_settings','paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x497e67){if(!_0x497e67[_0x2746('0x3')])_0x497e67[_0x2746('0x4')]=null;else if(_0x497e67['clientSideLoggingEnabledSince']===null)_0x497e67[_0x2746('0x4')]=new Date();}}});}; \ No newline at end of file diff --git a/server/api/user-setting/user-setting.socket.js b/server/api/user-setting/user-setting.socket.js index c867c5d..14421d2 100644 --- a/server/api/user-setting/user-setting.socket.js +++ b/server/api/user-setting/user-setting.socket.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbed3=['register','length','./user-setting.events','save','remove','user-setting:update','emit','user-setting:update:user-','UserId'];(function(_0x10244a,_0x3e96f4){var _0x4daacd=function(_0x3ef358){while(--_0x3ef358){_0x10244a['push'](_0x10244a['shift']());}};_0x4daacd(++_0x3e96f4);}(_0xbed3,0x158));var _0x3bed=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xbed3[_0x3b380d];return _0x54502b;};'use strict';var UserSettingEvents=require(_0x3bed('0x0'));var events=[_0x3bed('0x1'),_0x3bed('0x2'),'update'];function createListener(_0x7c81e8,_0x10b285){return function(_0x138ee6){_0x10b285['emit'](_0x7c81e8,_0x138ee6);if(_0x7c81e8===_0x3bed('0x3')){_0x10b285[_0x3bed('0x4')](_0x3bed('0x5')+_0x138ee6[_0x3bed('0x6')],_0x138ee6);}};}exports[_0x3bed('0x7')]=function(_0x1b629c){for(var _0x547a89=0x0,_0x4a1f69=events[_0x3bed('0x8')];_0x547a89<_0x4a1f69;_0x547a89++){var _0xc89611=events[_0x547a89];var _0x1bd96f=createListener('user-setting:'+_0xc89611,_0x1b629c);UserSettingEvents['on'](_0xc89611,_0x1bd96f);}}; \ No newline at end of file +var _0x3f72=['emit','user-setting:update','user-setting:update:user-','UserId','register','length','user-setting:','./user-setting.events','remove','update'];(function(_0x526631,_0x36130d){var _0x3c0945=function(_0x4095a3){while(--_0x4095a3){_0x526631['push'](_0x526631['shift']());}};_0x3c0945(++_0x36130d);}(_0x3f72,0xf7));var _0x23f7=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x3f72[_0x14add3];return _0x4a174f;};'use strict';var UserSettingEvents=require(_0x23f7('0x0'));var events=['save',_0x23f7('0x1'),_0x23f7('0x2')];function createListener(_0x46a135,_0x4f87b1){return function(_0x450e33){_0x4f87b1[_0x23f7('0x3')](_0x46a135,_0x450e33);if(_0x46a135===_0x23f7('0x4')){_0x4f87b1[_0x23f7('0x3')](_0x23f7('0x5')+_0x450e33[_0x23f7('0x6')],_0x450e33);}};}exports[_0x23f7('0x7')]=function(_0xd80e34){for(var _0x2cbb21=0x0,_0x422838=events[_0x23f7('0x8')];_0x2cbb21<_0x422838;_0x2cbb21++){var _0x57dbd4=events[_0x2cbb21];var _0x44b42d=createListener(_0x23f7('0x9')+_0x57dbd4,_0xd80e34);UserSettingEvents['on'](_0x57dbd4,_0x44b42d);}}; \ No newline at end of file diff --git a/server/api/user/index.js b/server/api/user/index.js index c3812d1..78b7360 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 _0x85b5=['unpause','addTeams','addMailInteractions','/:id/fax_interactions','/:id/sms_interactions','addSmsInteractions','addOpenchannelInteractions','/:id/fax_accounts','addFaxAccounts','addMailAccounts','addOpenchannelAccounts','put','delete','removeTeams','destroy','/:id/chat_interactions','removeChatInteractions','/:id/mail_interactions','removeMailInteractions','removeFaxInteractions','removeOpenchannelInteractions','/:id/whatsapp_interactions','removeWhatsappInteractions','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeWhatsappAccounts','removeApiKey','multer','util','connect-timeout','Router','../../components/interaction/service','./user.controller','get','isAuthenticated','describe','/whoami','whoami','/presence','getPresence','/:id','show','/:id/avatar','/:id/open_tabs','/:id/contacts','getContacts','/:id/queues','/:id/queues_rt','getGroups','/:id/recordings','getRecordings','/:id/screen_recordings','/:id/chat/interactions','/:id/openchannel/interactions','/:id/mail/interactions','getMailInteractions','getSmsInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','getOpenchannelAccounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','getChatWebsites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','/:id/api_key','addContacts','post','/create_many','bulkCreate','diskStorage','join','root','server/files/images/','format','%s-%s','originalname','single','file','addAvatar','/:id/login','login','/:id/logout','logout','pause'];(function(_0x351e36,_0x34c9a0){var _0x4d0809=function(_0x5683d8){while(--_0x5683d8){_0x351e36['push'](_0x351e36['shift']());}};_0x4d0809(++_0x34c9a0);}(_0x85b5,0x7f));var _0x585b=function(_0x4876ae,_0x3f18ed){_0x4876ae=_0x4876ae-0x0;var _0x1c65cd=_0x85b5[_0x4876ae];return _0x1c65cd;};'use strict';var multer=require(_0x585b('0x0'));var util=require(_0x585b('0x1'));var path=require('path');var timeout=require(_0x585b('0x2'));var express=require('express');var router=express[_0x585b('0x3')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x585b('0x4'));var config=require('../../config/environment');var controller=require(_0x585b('0x5'));router[_0x585b('0x6')]('/',auth[_0x585b('0x7')](),controller['index']);router[_0x585b('0x6')]('/describe',auth[_0x585b('0x7')](),controller[_0x585b('0x8')]);router[_0x585b('0x6')](_0x585b('0x9'),auth['isAuthenticated'](),controller[_0x585b('0xa')]);router[_0x585b('0x6')](_0x585b('0xb'),auth[_0x585b('0x7')](),controller[_0x585b('0xc')]);router[_0x585b('0x6')](_0x585b('0xd'),auth['isAuthenticated'](),controller[_0x585b('0xe')]);router['get'](_0x585b('0xf'),controller['getAvatar']);router[_0x585b('0x6')](_0x585b('0x10'),auth[_0x585b('0x7')](),controller['getOpenTabs']);router[_0x585b('0x6')](_0x585b('0x11'),auth[_0x585b('0x7')](),controller[_0x585b('0x12')]);router[_0x585b('0x6')](_0x585b('0x13'),auth[_0x585b('0x7')](),controller['getQueues']);router[_0x585b('0x6')](_0x585b('0x14'),auth['isAuthenticated'](),controller['getVoiceQueuesRt']);router[_0x585b('0x6')]('/:id/groups',auth['isAuthenticated'](),controller[_0x585b('0x15')]);router[_0x585b('0x6')](_0x585b('0x16'),auth['isAuthenticated'](),controller[_0x585b('0x17')]);router[_0x585b('0x6')](_0x585b('0x18'),auth[_0x585b('0x7')](),controller['getScreenRecordings']);router[_0x585b('0x6')](_0x585b('0x19'),auth[_0x585b('0x7')](),controller['getChatInteractions']);router['get'](_0x585b('0x1a'),auth['isAuthenticated'](),controller['getOpenchannelInteractions']);router[_0x585b('0x6')](_0x585b('0x1b'),auth['isAuthenticated'](),controller[_0x585b('0x1c')]);router[_0x585b('0x6')]('/:id/sms/interactions',auth[_0x585b('0x7')](),controller[_0x585b('0x1d')]);router[_0x585b('0x6')]('/:id/fax/interactions',auth[_0x585b('0x7')](),controller['getFaxInteractions']);router[_0x585b('0x6')](_0x585b('0x1e'),auth[_0x585b('0x7')](),controller[_0x585b('0x1f')]);router[_0x585b('0x6')](_0x585b('0x20'),auth[_0x585b('0x7')](),controller[_0x585b('0x21')]);router[_0x585b('0x6')](_0x585b('0x22'),auth[_0x585b('0x7')](),controller[_0x585b('0x23')]);router[_0x585b('0x6')](_0x585b('0x24'),auth[_0x585b('0x7')](),controller['getAgents']);router[_0x585b('0x6')](_0x585b('0x25'),auth[_0x585b('0x7')](),controller[_0x585b('0x26')]);router['get']('/:id/fax_accounts',auth[_0x585b('0x7')](),controller[_0x585b('0x27')]);router['get'](_0x585b('0x28'),auth[_0x585b('0x7')](),controller['getMailAccounts']);router[_0x585b('0x6')](_0x585b('0x29'),auth[_0x585b('0x7')](),controller[_0x585b('0x2a')]);router[_0x585b('0x6')](_0x585b('0x2b'),auth[_0x585b('0x7')](),controller[_0x585b('0x2c')]);router[_0x585b('0x6')](_0x585b('0x2d'),auth['isAuthenticated'](),controller[_0x585b('0x2e')]);router[_0x585b('0x6')](_0x585b('0x2f'),auth['isAuthenticated'](),controller[_0x585b('0x30')]);router[_0x585b('0x6')](_0x585b('0x31'),auth['isAuthenticated'](),controller[_0x585b('0x32')]);router[_0x585b('0x6')](_0x585b('0x33'),auth[_0x585b('0x7')](),controller['getApiKey']);router['post'](_0x585b('0x11'),auth[_0x585b('0x7')](),controller[_0x585b('0x34')]);router[_0x585b('0x35')]('/',auth[_0x585b('0x7')](),controller['create']);router[_0x585b('0x35')](_0x585b('0x36'),auth[_0x585b('0x7')](),controller[_0x585b('0x37')]);router[_0x585b('0x35')]('/:id/queues',auth['isAuthenticated'](),controller['addQueues']);var upload=multer({'storage':multer[_0x585b('0x38')]({'destination':function(_0x199e54,_0x2c4b9f,_0x8ecc5f){_0x8ecc5f(null,path[_0x585b('0x39')](config[_0x585b('0x3a')],_0x585b('0x3b')));},'filename':function(_0x128a0a,_0x6cec28,_0x56c2ac){_0x56c2ac(null,util[_0x585b('0x3c')](_0x585b('0x3d'),Date['now'](),_0x6cec28[_0x585b('0x3e')]));}})});router[_0x585b('0x35')](_0x585b('0xf'),upload[_0x585b('0x3f')](_0x585b('0x40')),controller[_0x585b('0x41')]);router['post'](_0x585b('0x42'),auth[_0x585b('0x7')](),controller[_0x585b('0x43')]);router[_0x585b('0x35')](_0x585b('0x44'),auth[_0x585b('0x7')](),controller[_0x585b('0x45')]);router[_0x585b('0x35')]('/:id/pause',auth[_0x585b('0x7')](),controller[_0x585b('0x46')]);router[_0x585b('0x35')]('/:id/unpause',auth[_0x585b('0x7')](),controller[_0x585b('0x47')]);router[_0x585b('0x35')]('/:id/teams',auth[_0x585b('0x7')](),controller[_0x585b('0x48')]);router['post']('/:id/chat_interactions',auth[_0x585b('0x7')](),controller['addChatInteractions']);router[_0x585b('0x35')]('/:id/mail_interactions',auth[_0x585b('0x7')](),controller[_0x585b('0x49')]);router['post'](_0x585b('0x4a'),auth['isAuthenticated'](),controller['addFaxInteractions']);router['post'](_0x585b('0x4b'),auth['isAuthenticated'](),controller[_0x585b('0x4c')]);router[_0x585b('0x35')]('/:id/openchannel_interactions',auth[_0x585b('0x7')](),controller[_0x585b('0x4d')]);router[_0x585b('0x35')]('/:id/whatsapp_interactions',auth['isAuthenticated'](),controller['addWhatsappInteractions']);router[_0x585b('0x35')](_0x585b('0x4e'),auth[_0x585b('0x7')](),controller[_0x585b('0x4f')]);router['post'](_0x585b('0x28'),auth[_0x585b('0x7')](),controller[_0x585b('0x50')]);router[_0x585b('0x35')]('/:id/openchannel_accounts',auth[_0x585b('0x7')](),controller[_0x585b('0x51')]);router[_0x585b('0x35')](_0x585b('0x2b'),auth[_0x585b('0x7')](),controller['addSmsAccounts']);router['post']('/:id/chat_websites',auth[_0x585b('0x7')](),controller['addChatWebsites']);router[_0x585b('0x35')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['addWhatsappAccounts']);router[_0x585b('0x35')](_0x585b('0x33'),auth['isAuthenticated'](),controller['createApiKey']);router[_0x585b('0x52')](_0x585b('0xd'),auth[_0x585b('0x7')](),controller['update']);router[_0x585b('0x52')]('/:id/password',auth[_0x585b('0x7')](),controller['changePassword']);router[_0x585b('0x53')]('/:id/queues',auth[_0x585b('0x7')](),controller['removeQueues']);router[_0x585b('0x53')](_0x585b('0x20'),auth[_0x585b('0x7')](),controller[_0x585b('0x54')]);router[_0x585b('0x53')]('/:id',auth[_0x585b('0x7')](),controller[_0x585b('0x55')]);router[_0x585b('0x53')](_0x585b('0x56'),auth[_0x585b('0x7')](),controller[_0x585b('0x57')]);router['delete'](_0x585b('0x58'),auth[_0x585b('0x7')](),controller[_0x585b('0x59')]);router[_0x585b('0x53')]('/:id/fax_interactions',auth[_0x585b('0x7')](),controller[_0x585b('0x5a')]);router[_0x585b('0x53')]('/:id/sms_interactions',auth['isAuthenticated'](),controller['removeSmsInteractions']);router['delete']('/:id/openchannel_interactions',auth['isAuthenticated'](),controller[_0x585b('0x5b')]);router[_0x585b('0x53')](_0x585b('0x5c'),auth['isAuthenticated'](),controller[_0x585b('0x5d')]);router[_0x585b('0x53')](_0x585b('0x4e'),auth[_0x585b('0x7')](),controller['removeFaxAccounts']);router[_0x585b('0x53')](_0x585b('0x28'),auth[_0x585b('0x7')](),controller[_0x585b('0x5e')]);router[_0x585b('0x53')](_0x585b('0x29'),auth[_0x585b('0x7')](),controller['removeOpenchannelAccounts']);router[_0x585b('0x53')](_0x585b('0x2b'),auth[_0x585b('0x7')](),controller[_0x585b('0x5f')]);router[_0x585b('0x53')](_0x585b('0x2d'),auth[_0x585b('0x7')](),controller[_0x585b('0x60')]);router[_0x585b('0x53')](_0x585b('0x2f'),auth[_0x585b('0x7')](),controller[_0x585b('0x61')]);router[_0x585b('0x53')](_0x585b('0x33'),auth['isAuthenticated'](),controller[_0x585b('0x62')]);module['exports']=router; \ No newline at end of file +var _0x1a9e=['/:id/chat/interactions','getChatInteractions','getOpenchannelInteractions','/:id/mail/interactions','/:id/sms/interactions','/:id/fax/interactions','getFaxInteractions','/:id/whatsapp/interactions','getWhatsappInteractions','/:id/teams','getTeams','/:id/lists','getLists','/:id/agents','/:id/prefixes','getVoicePrefixes','/:id/fax_accounts','getFaxAccounts','/:id/mail_accounts','/:id/openchannel_accounts','/:id/sms_accounts','getSmsAccounts','/:id/chat_websites','/:id/whatsapp_accounts','getWhatsappAccounts','/:id/scheduled_calls','getScheduledCalls','getApiKey','post','/create_many','bulkCreate','diskStorage','join','root','server/files/images/','format','%s-%s','single','file','/:id/login','login','/:id/logout','/:id/pause','pause','/:id/unpause','addTeams','/:id/chat_interactions','addChatInteractions','/:id/mail_interactions','addMailInteractions','/:id/fax_interactions','addFaxInteractions','/:id/sms_interactions','addSmsInteractions','/:id/openchannel_interactions','addOpenchannelInteractions','/:id/whatsapp_interactions','addWhatsappInteractions','addMailAccounts','addOpenchannelAccounts','addChatWebsites','/:id/api_key','createApiKey','put','update','/:id/password','delete','removeQueues','removeTeams','destroy','removeChatInteractions','removeFaxInteractions','removeWhatsappInteractions','removeFaxAccounts','removeMailAccounts','removeSmsAccounts','removeChatWebsites','removeApiKey','multer','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./user.controller','get','isAuthenticated','index','/describe','describe','/whoami','whoami','/:id','show','/:id/avatar','getAvatar','/:id/open_tabs','/:id/contacts','/:id/queues','/:id/queues_rt','getVoiceQueuesRt','/:id/groups','/:id/recordings','getRecordings','getScreenRecordings'];(function(_0x1aae33,_0x110a80){var _0x2e91e9=function(_0x218767){while(--_0x218767){_0x1aae33['push'](_0x1aae33['shift']());}};_0x2e91e9(++_0x110a80);}(_0x1a9e,0x122));var _0xe1a9=function(_0x483713,_0x4972b5){_0x483713=_0x483713-0x0;var _0x30ad20=_0x1a9e[_0x483713];return _0x30ad20;};'use strict';var multer=require(_0xe1a9('0x0'));var util=require('util');var path=require(_0xe1a9('0x1'));var timeout=require('connect-timeout');var express=require(_0xe1a9('0x2'));var router=express[_0xe1a9('0x3')]();var fs_extra=require(_0xe1a9('0x4'));var auth=require(_0xe1a9('0x5'));var interaction=require(_0xe1a9('0x6'));var config=require('../../config/environment');var controller=require(_0xe1a9('0x7'));router[_0xe1a9('0x8')]('/',auth[_0xe1a9('0x9')](),controller[_0xe1a9('0xa')]);router[_0xe1a9('0x8')](_0xe1a9('0xb'),auth['isAuthenticated'](),controller[_0xe1a9('0xc')]);router[_0xe1a9('0x8')](_0xe1a9('0xd'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0xe')]);router[_0xe1a9('0x8')]('/presence',auth['isAuthenticated'](),controller['getPresence']);router['get'](_0xe1a9('0xf'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x10')]);router[_0xe1a9('0x8')](_0xe1a9('0x11'),controller[_0xe1a9('0x12')]);router[_0xe1a9('0x8')](_0xe1a9('0x13'),auth[_0xe1a9('0x9')](),controller['getOpenTabs']);router[_0xe1a9('0x8')](_0xe1a9('0x14'),auth[_0xe1a9('0x9')](),controller['getContacts']);router['get'](_0xe1a9('0x15'),auth['isAuthenticated'](),controller['getQueues']);router['get'](_0xe1a9('0x16'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x17')]);router[_0xe1a9('0x8')](_0xe1a9('0x18'),auth[_0xe1a9('0x9')](),controller['getGroups']);router[_0xe1a9('0x8')](_0xe1a9('0x19'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x1a')]);router[_0xe1a9('0x8')]('/:id/screen_recordings',auth['isAuthenticated'](),controller[_0xe1a9('0x1b')]);router[_0xe1a9('0x8')](_0xe1a9('0x1c'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x1d')]);router[_0xe1a9('0x8')]('/:id/openchannel/interactions',auth['isAuthenticated'](),controller[_0xe1a9('0x1e')]);router[_0xe1a9('0x8')](_0xe1a9('0x1f'),auth['isAuthenticated'](),controller['getMailInteractions']);router[_0xe1a9('0x8')](_0xe1a9('0x20'),auth['isAuthenticated'](),controller['getSmsInteractions']);router[_0xe1a9('0x8')](_0xe1a9('0x21'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x22')]);router[_0xe1a9('0x8')](_0xe1a9('0x23'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x24')]);router['get'](_0xe1a9('0x25'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x26')]);router['get'](_0xe1a9('0x27'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x28')]);router[_0xe1a9('0x8')](_0xe1a9('0x29'),auth['isAuthenticated'](),controller['getAgents']);router[_0xe1a9('0x8')](_0xe1a9('0x2a'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x2b')]);router['get'](_0xe1a9('0x2c'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x2d')]);router[_0xe1a9('0x8')](_0xe1a9('0x2e'),auth['isAuthenticated'](),controller['getMailAccounts']);router[_0xe1a9('0x8')](_0xe1a9('0x2f'),auth[_0xe1a9('0x9')](),controller['getOpenchannelAccounts']);router[_0xe1a9('0x8')](_0xe1a9('0x30'),auth['isAuthenticated'](),controller[_0xe1a9('0x31')]);router[_0xe1a9('0x8')](_0xe1a9('0x32'),auth[_0xe1a9('0x9')](),controller['getChatWebsites']);router['get'](_0xe1a9('0x33'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x34')]);router['get'](_0xe1a9('0x35'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x36')]);router[_0xe1a9('0x8')]('/:id/api_key',auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x37')]);router[_0xe1a9('0x38')]('/:id/contacts',auth[_0xe1a9('0x9')](),controller['addContacts']);router[_0xe1a9('0x38')]('/',auth[_0xe1a9('0x9')](),controller['create']);router['post'](_0xe1a9('0x39'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x3a')]);router[_0xe1a9('0x38')](_0xe1a9('0x15'),auth[_0xe1a9('0x9')](),controller['addQueues']);var upload=multer({'storage':multer[_0xe1a9('0x3b')]({'destination':function(_0xca09a3,_0x4e4260,_0x57cf96){_0x57cf96(null,path[_0xe1a9('0x3c')](config[_0xe1a9('0x3d')],_0xe1a9('0x3e')));},'filename':function(_0x1653d6,_0x41bf52,_0x40b4a4){_0x40b4a4(null,util[_0xe1a9('0x3f')](_0xe1a9('0x40'),Date['now'](),_0x41bf52['originalname']));}})});router[_0xe1a9('0x38')](_0xe1a9('0x11'),upload[_0xe1a9('0x41')](_0xe1a9('0x42')),controller['addAvatar']);router[_0xe1a9('0x38')](_0xe1a9('0x43'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x44')]);router[_0xe1a9('0x38')](_0xe1a9('0x45'),auth[_0xe1a9('0x9')](),controller['logout']);router['post'](_0xe1a9('0x46'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x47')]);router[_0xe1a9('0x38')](_0xe1a9('0x48'),auth[_0xe1a9('0x9')](),controller['unpause']);router[_0xe1a9('0x38')](_0xe1a9('0x25'),auth['isAuthenticated'](),controller[_0xe1a9('0x49')]);router[_0xe1a9('0x38')](_0xe1a9('0x4a'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x4b')]);router[_0xe1a9('0x38')](_0xe1a9('0x4c'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x4d')]);router[_0xe1a9('0x38')](_0xe1a9('0x4e'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x4f')]);router[_0xe1a9('0x38')](_0xe1a9('0x50'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x51')]);router[_0xe1a9('0x38')](_0xe1a9('0x52'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x53')]);router['post'](_0xe1a9('0x54'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x55')]);router[_0xe1a9('0x38')]('/:id/fax_accounts',auth[_0xe1a9('0x9')](),controller['addFaxAccounts']);router['post']('/:id/mail_accounts',auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x56')]);router[_0xe1a9('0x38')](_0xe1a9('0x2f'),auth['isAuthenticated'](),controller[_0xe1a9('0x57')]);router[_0xe1a9('0x38')](_0xe1a9('0x30'),auth['isAuthenticated'](),controller['addSmsAccounts']);router[_0xe1a9('0x38')](_0xe1a9('0x32'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x58')]);router[_0xe1a9('0x38')]('/:id/whatsapp_accounts',auth[_0xe1a9('0x9')](),controller['addWhatsappAccounts']);router[_0xe1a9('0x38')](_0xe1a9('0x59'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x5a')]);router[_0xe1a9('0x5b')](_0xe1a9('0xf'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x5c')]);router[_0xe1a9('0x5b')](_0xe1a9('0x5d'),auth[_0xe1a9('0x9')](),controller['changePassword']);router[_0xe1a9('0x5e')](_0xe1a9('0x15'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x5f')]);router[_0xe1a9('0x5e')]('/:id/teams',auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x60')]);router[_0xe1a9('0x5e')](_0xe1a9('0xf'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x61')]);router[_0xe1a9('0x5e')](_0xe1a9('0x4a'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x62')]);router[_0xe1a9('0x5e')](_0xe1a9('0x4c'),auth[_0xe1a9('0x9')](),controller['removeMailInteractions']);router[_0xe1a9('0x5e')](_0xe1a9('0x4e'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x63')]);router[_0xe1a9('0x5e')](_0xe1a9('0x50'),auth[_0xe1a9('0x9')](),controller['removeSmsInteractions']);router['delete'](_0xe1a9('0x52'),auth['isAuthenticated'](),controller['removeOpenchannelInteractions']);router[_0xe1a9('0x5e')](_0xe1a9('0x54'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x64')]);router[_0xe1a9('0x5e')]('/:id/fax_accounts',auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x65')]);router[_0xe1a9('0x5e')](_0xe1a9('0x2e'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x66')]);router[_0xe1a9('0x5e')](_0xe1a9('0x2f'),auth['isAuthenticated'](),controller['removeOpenchannelAccounts']);router[_0xe1a9('0x5e')](_0xe1a9('0x30'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x67')]);router[_0xe1a9('0x5e')](_0xe1a9('0x32'),auth[_0xe1a9('0x9')](),controller[_0xe1a9('0x68')]);router[_0xe1a9('0x5e')]('/:id/whatsapp_accounts',auth['isAuthenticated'](),controller['removeWhatsappAccounts']);router['delete']('/:id/api_key',auth['isAuthenticated'](),controller[_0xe1a9('0x69')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/user/user.attributes.js b/server/api/user/user.attributes.js index cad7fa3..cce59f8 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 _0xcb91=['toLowerCase','ENUM','admin','user','local','INTEGER','accountcode','\x22%s\x22\x20<%s>','getDataValue','BOOLEAN','DATE','DEFAULT\x20PAUSE','dynamic','friend','peer','from-sip','ALLOWED_NOT_SCREENED','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_PASSED_SCREEN','PROHIB','transport','join','split','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','nonat','force_rport,comedia','nat','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]','all','allow','ulaw;alaw;gsm','insecure','never','always','accept','originate','uac','uas','fingerprint','certificate','active','passive','update','showWebBar','get','isArray','encryption','avpf','icesupport','dtlsverify','dtlssetup','rtcp_mux','wss','force_avp','dtlscertfile','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','/etc/pki/tls/private/motion.key','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blockedAt','loginAttempts','UNSIGNED','util','lodash','exports','STRING','setDataValue','defaultuser','fullname','format','internal','email'];(function(_0x2201e0,_0x5de0df){var _0x37e9f5=function(_0x65a91d){while(--_0x65a91d){_0x2201e0['push'](_0x2201e0['shift']());}};_0x37e9f5(++_0x5de0df);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3861f7,_0x995b22){_0x3861f7=_0x3861f7-0x0;var _0x50879f=_0xcb91[_0x3861f7];return _0x50879f;};'use strict';var Sequelize=require('sequelize');var moment=require('moment');var util=require(_0x1cb9('0x0'));var _=require(_0x1cb9('0x1'));module[_0x1cb9('0x2')]={'name':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x8c392f){this[_0x1cb9('0x4')]('name',_0x8c392f);this[_0x1cb9('0x4')](_0x1cb9('0x5'),_0x8c392f);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'set':function(_0x3f7deb){this['setDataValue'](_0x1cb9('0x6'),_0x3f7deb);this[_0x1cb9('0x4')]('callerid',util[_0x1cb9('0x7')]('\x22%s\x22\x20<%s>',_0x3f7deb,this['getDataValue'](_0x1cb9('0x8'))));}},'alias':{'type':Sequelize[_0x1cb9('0x3')]},'email':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'unique':_0x1cb9('0x9'),'validate':{'isEmail':!![]},'set':function(_0x2fc627){if(_0x2fc627){this['setDataValue'](_0x1cb9('0x9'),_0x2fc627[_0x1cb9('0xa')]());}}},'role':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0xc'),_0x1cb9('0xd'),'agent','telephone'),'allowNull':![]},'password':{'type':Sequelize['STRING'],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0xe')},'internal':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':![],'unique':_0x1cb9('0x8'),'set':function(_0x56884d){this[_0x1cb9('0x4')](_0x1cb9('0x8'),_0x56884d);this[_0x1cb9('0x4')](_0x1cb9('0x10'),_0x56884d);this[_0x1cb9('0x4')]('callerid',util['format'](_0x1cb9('0x11'),this[_0x1cb9('0x12')](_0x1cb9('0x6')),_0x56884d));}},'salt':{'type':Sequelize[_0x1cb9('0x3')]},'phone':{'type':Sequelize[_0x1cb9('0x3')]},'mobile':{'type':Sequelize[_0x1cb9('0x3')]},'address':{'type':Sequelize[_0x1cb9('0x3')]},'zipcode':{'type':Sequelize['STRING']},'userpic':{'type':Sequelize['STRING']},'city':{'type':Sequelize[_0x1cb9('0x3')]},'country':{'type':Sequelize[_0x1cb9('0x3')]},'online':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x1cb9('0x14')]},'voicePause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'whatsappPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':_0x1cb9('0x15')},'lastPauseAt':{'type':Sequelize['DATE']},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize['INTEGER'](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x1cb9('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chanspy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'description':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'host':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x16')},'ipaddr':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'port':{'type':Sequelize['INTEGER'](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'useragent':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x17'),_0x1cb9('0xd'),_0x1cb9('0x18')),'allowNull':!![],'defaultValue':_0x1cb9('0x17')},'context':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':_0x1cb9('0x19')},'callingpres':{'type':Sequelize['ENUM'](_0x1cb9('0x1a'),'ALLOWED_PASSED_SCREEN',_0x1cb9('0x1b'),_0x1cb9('0x1c'),_0x1cb9('0x1d'),_0x1cb9('0x1e'),'PROHIB_FAILED_SCREEN',_0x1cb9('0x1f')),'allowNull':!![]},'deny':{'type':Sequelize['STRING'],'allowNull':!![]},'permit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize['STRING'],'allowNull':!![]},'transport':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':'udp','set':function(_0x3a3543){this['setDataValue'](_0x1cb9('0x20'),_0x3a3543?_0x3a3543[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x20'))?this['getDataValue'](_0x1cb9('0x20'))[_0x1cb9('0x22')](','):null;},'comment':_0x1cb9('0x23')},'dtmfmode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x24'),_0x1cb9('0x25'),_0x1cb9('0x26'),_0x1cb9('0x27'),_0x1cb9('0x28')),'allowNull':!![],'defaultValue':_0x1cb9('0x24')},'directmedia':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),'update','outgoing'),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'defaultValue':_0x1cb9('0x2b'),'set':function(_0x35f5e8){this[_0x1cb9('0x4')]('nat',_0x35f5e8?_0x35f5e8[_0x1cb9('0x21')](','):null);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2c'))?this['getDataValue'](_0x1cb9('0x2c'))['split'](','):null;},'comment':_0x1cb9('0x2d')},'callgroup':{'type':Sequelize['STRING']},'namedcallgroup':{'type':Sequelize[_0x1cb9('0x3')]},'pickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'namedpickupgroup':{'type':Sequelize[_0x1cb9('0x3')]},'language':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x1cb9('0x3')]},'disallow':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':![],'defaultValue':_0x1cb9('0x2e')},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':'ulaw;alaw;gsm','set':function(_0x4111b8){this[_0x1cb9('0x4')](_0x1cb9('0x2f'),_0x4111b8?_0x4111b8[_0x1cb9('0x21')](';'):_0x1cb9('0x30'));},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x2f'))?this['getDataValue'](_0x1cb9('0x2f'))['split'](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![],'set':function(_0x1bf51c){this[_0x1cb9('0x4')](_0x1cb9('0x31'),_0x1bf51c?_0x1bf51c['join'](','):null);},'get':function(){return this[_0x1cb9('0x12')]('insecure')?this[_0x1cb9('0x12')](_0x1cb9('0x31'))[_0x1cb9('0x22')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]'},'trustrpid':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x32')),'allowNull':!![]},'promiscredir':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'\x22\x22\x20<>'},'amaflags':{'type':Sequelize['STRING'],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'busylevel':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'template':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no',_0x1cb9('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize['ENUM'](_0x1cb9('0x34'),'refuse',_0x1cb9('0x35')),'allowNull':!![]},'session_expires':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x36'),_0x1cb9('0x37')),'allowNull':!![],'defaultValue':'uas'},'t38pt_usertpsource':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':_0x1cb9('0x29')},'keepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactdeny':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize['STRING'],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize['ENUM']('yes','no',_0x1cb9('0x38'),_0x1cb9('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x3a'),_0x1cb9('0x3b'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize[_0x1cb9('0xf')](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize['ENUM'](_0x1cb9('0x29'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize[_0x1cb9('0xb')](_0x1cb9('0x29'),'no',_0x1cb9('0x2a'),_0x1cb9('0x3c'),'update,nonat'),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x1cb9('0x3')]},'resetPasswordExpires':{'type':Sequelize[_0x1cb9('0x14')]},'passwordResetAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'previousPasswords':{'type':Sequelize['TEXT']},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x319358){this[_0x1cb9('0x4')](_0x1cb9('0x3d'),_0x319358);var _0x173db5=this[_0x1cb9('0x3e')]({'plain':!![]});switch(_0x319358){case 0x0:case 0x1:var _0x75c734=_0x173db5[_0x1cb9('0x20')]?_[_0x1cb9('0x3f')](_0x173db5['transport'])?_0x173db5['transport'][_0x1cb9('0x21')]():_0x173db5['transport']:'udp';if(_0x75c734==='wss'){_0x75c734='udp';}this['setDataValue'](_0x1cb9('0x20'),_0x75c734);this[_0x1cb9('0x4')](_0x1cb9('0x40'),'no');this[_0x1cb9('0x4')](_0x1cb9('0x41'),null);this[_0x1cb9('0x4')]('force_avp',null);this[_0x1cb9('0x4')](_0x1cb9('0x42'),null);this['setDataValue']('dtlsenable',null);this[_0x1cb9('0x4')](_0x1cb9('0x43'),null);this[_0x1cb9('0x4')](_0x1cb9('0x44'),null);this[_0x1cb9('0x4')]('dtlscertfile',null);this['setDataValue']('dtlsprivatekey',null);this[_0x1cb9('0x4')](_0x1cb9('0x45'),'no');break;case 0x2:this[_0x1cb9('0x4')](_0x1cb9('0x20'),_0x1cb9('0x46'));this['setDataValue'](_0x1cb9('0x40'),_0x1cb9('0x29'));this['setDataValue']('avpf',_0x1cb9('0x29'));this['setDataValue'](_0x1cb9('0x47'),_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x42'),_0x1cb9('0x29'));this[_0x1cb9('0x4')]('dtlsenable',_0x1cb9('0x29'));this[_0x1cb9('0x4')](_0x1cb9('0x43'),'no');this[_0x1cb9('0x4')]('dtlssetup','actpass');this[_0x1cb9('0x4')](_0x1cb9('0x48'),_0x173db5[_0x1cb9('0x48')]||_0x1cb9('0x49'));this[_0x1cb9('0x4')](_0x1cb9('0x4a'),_0x173db5['dtlsprivatekey']||_0x1cb9('0x4b'));this['setDataValue'](_0x1cb9('0x45'),_0x1cb9('0x29'));break;default:}}},'permissions':{'type':Sequelize['TEXT'],'set':function(_0xf5b006){this[_0x1cb9('0x4')](_0x1cb9('0x4c'),_0xf5b006?_0xf5b006['join'](','):[]);},'get':function(){return this[_0x1cb9('0x12')](_0x1cb9('0x4c'))?_[_0x1cb9('0x4d')](this[_0x1cb9('0x12')](_0x1cb9('0x4c'))[_0x1cb9('0x22')](','),function(_0x5a3f1d){return parseInt(_0x5a3f1d,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarBusyNumber':{'type':Sequelize[_0x1cb9('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize[_0x1cb9('0x3')],'defaultValue':''},'crudPermissions':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x1cb9('0xb')]('yes','no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x1cb9('0x4e')],'get':function(){return this['getDataValue'](_0x1cb9('0x4f'))?this['getDataValue'](_0x1cb9('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'hotdesk':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'interface':{'type':Sequelize['STRING'],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x1cb9('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![],'set':function(_0x4f8d74){if(typeof _0x4f8d74===_0x1cb9('0x50')){var _0x4cb014=_0x4f8d74==='1'?!![]:_0x4f8d74==='0'?![]:_0x4f8d74===_0x1cb9('0x51')?!![]:_0x4f8d74===_0x1cb9('0x52')?![]:![];this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4cb014);}else{this[_0x1cb9('0x4')](_0x1cb9('0x53'),_0x4f8d74);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0x3db146){this[_0x1cb9('0x4')]('blocked',_0x3db146);if(_0x3db146===!![]){this[_0x1cb9('0x4')](_0x1cb9('0x54'),moment());this[_0x1cb9('0x4')](_0x1cb9('0x55'),0x0);}else{this[_0x1cb9('0x4')](_0x1cb9('0x54'),null);}}},'blockedAt':{'type':Sequelize[_0x1cb9('0x14')],'defaultValue':null},'loginAttempts':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x1cb9('0xf')](0x5)[_0x1cb9('0x56')],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize[_0x1cb9('0xf')],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x1cb9('0x13')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0}}; \ No newline at end of file +var _0xa9e0=['certificate','passive','nonat','update,nonat','TEXT','showWebBar','wss','encryption','force_avp','icesupport','dtlsenable','dtlssetup','dtlscertfile','rtcp_mux','avpf','dtlsverify','actpass','/etc/pki/tls/certs/motion.crt','dtlsprivatekey','permissions','map','VIRTUAL','phoneBarEnableScreenRecordingByAgent','string','true','false','screenrecording','blocked','blockedAt','loginAttempts','sequelize','moment','util','STRING','setDataValue','name','defaultuser','callerid','getDataValue','internal','email','admin','user','agent','telephone','INTEGER','format','fullname','BOOLEAN','DATE','dynamic','ENUM','friend','peer','from-sip','ALLOWED_PASSED_SCREEN','ALLOWED_FAILED_SCREEN','ALLOWED','PROHIB_NOT_SCREENED','PROHIB_FAILED_SCREEN','PROHIB','udp','join','transport','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22udp\x22,\x20\x22tcp\x22]','rfc2833','info','shortinfo','inband','auto','yes','update','outgoing','force_rport,comedia','nat','split','ulaw;alaw;gsm','allow','insecure','String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22port\x22,\x20\x22invite\x22]','\x22\x22\x20<>','always','accept','refuse','originate','uac','uas'];(function(_0x2b9e8a,_0x7b21d4){var _0x520e67=function(_0x22bce8){while(--_0x22bce8){_0x2b9e8a['push'](_0x2b9e8a['shift']());}};_0x520e67(++_0x7b21d4);}(_0xa9e0,0x123));var _0x0a9e=function(_0x139a3c,_0x4fc883){_0x139a3c=_0x139a3c-0x0;var _0x2b375b=_0xa9e0[_0x139a3c];return _0x2b375b;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var util=require(_0x0a9e('0x2'));var _=require('lodash');module['exports']={'name':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':'name','validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i},'set':function(_0x333808){this[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x333808);this[_0x0a9e('0x4')](_0x0a9e('0x6'),_0x333808);},'comment':'The\x20name\x20of\x20the\x20user'},'fullname':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'set':function(_0x441e3a){this[_0x0a9e('0x4')]('fullname',_0x441e3a);this['setDataValue'](_0x0a9e('0x7'),util['format']('\x22%s\x22\x20<%s>',_0x441e3a,this[_0x0a9e('0x8')](_0x0a9e('0x9'))));}},'alias':{'type':Sequelize[_0x0a9e('0x3')]},'email':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'unique':_0x0a9e('0xa'),'validate':{'isEmail':!![]},'set':function(_0xbd1168){if(_0xbd1168){this['setDataValue']('email',_0xbd1168['toLowerCase']());}}},'role':{'type':Sequelize['ENUM'](_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe')),'allowNull':![]},'password':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'validate':{'notEmpty':!![]}},'provider':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'local'},'internal':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':![],'unique':_0x0a9e('0x9'),'set':function(_0x2b4227){this[_0x0a9e('0x4')](_0x0a9e('0x9'),_0x2b4227);this[_0x0a9e('0x4')]('accountcode',_0x2b4227);this[_0x0a9e('0x4')]('callerid',util[_0x0a9e('0x10')]('\x22%s\x22\x20<%s>',this[_0x0a9e('0x8')](_0x0a9e('0x11')),_0x2b4227));}},'salt':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x0a9e('0x3')]},'mobile':{'type':Sequelize['STRING']},'address':{'type':Sequelize[_0x0a9e('0x3')]},'zipcode':{'type':Sequelize[_0x0a9e('0x3')]},'userpic':{'type':Sequelize[_0x0a9e('0x3')]},'city':{'type':Sequelize[_0x0a9e('0x3')]},'country':{'type':Sequelize[_0x0a9e('0x3')]},'online':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'lastLoginAt':{'type':Sequelize[_0x0a9e('0x13')]},'voicePause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'mailPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'smsPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappPause':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'openchannelPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'pauseType':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'DEFAULT\x20PAUSE'},'lastPauseAt':{'type':Sequelize[_0x0a9e('0x13')]},'chatCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'mailCapacity':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'faxCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'whatsappCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelCapacity':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'phoneBarAutoAnswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarEnableSettings':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarListenPort':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x1428},'phoneBarExpires':{'type':Sequelize[_0x0a9e('0xf')](0x5),'defaultValue':0x78},'phoneBarRemoteControl':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRemoteControlPort':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x26a0},'phoneBarEnableRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarRingInUse':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chanspy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'description':{'type':Sequelize['STRING'],'allowNull':!![]},'host':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x14')},'ipaddr':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'port':{'type':Sequelize[_0x0a9e('0xf')](0x5),'allowNull':!![]},'regseconds':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'fullcontact':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regserver':{'type':Sequelize['STRING'],'allowNull':!![]},'useragent':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'lastms':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'type':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x16'),_0x0a9e('0xc'),_0x0a9e('0x17')),'allowNull':!![],'defaultValue':_0x0a9e('0x16')},'context':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x18')},'callingpres':{'type':Sequelize[_0x0a9e('0x15')]('ALLOWED_NOT_SCREENED',_0x0a9e('0x19'),_0x0a9e('0x1a'),_0x0a9e('0x1b'),_0x0a9e('0x1c'),'PROHIB_PASSED_SCREEN',_0x0a9e('0x1d'),_0x0a9e('0x1e')),'allowNull':!![]},'deny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'permit':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'md5secret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'remotesecret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'transport':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x1f'),'set':function(_0x540530){this[_0x0a9e('0x4')]('transport',_0x540530?_0x540530[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x21'))?this[_0x0a9e('0x8')](_0x0a9e('0x21'))['split'](','):null;},'comment':_0x0a9e('0x22')},'dtmfmode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x23'),_0x0a9e('0x24'),_0x0a9e('0x25'),_0x0a9e('0x26'),_0x0a9e('0x27')),'allowNull':!![],'defaultValue':_0x0a9e('0x23')},'directmedia':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no','nonat',_0x0a9e('0x29'),_0x0a9e('0x2a')),'allowNull':!![],'defaultValue':'no'},'directrtpsetup':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'directmediapermit':{'type':Sequelize['STRING'],'allowNull':!![]},'directmediadeny':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'nat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x2b'),'set':function(_0x15de0e){this['setDataValue']('nat',_0x15de0e?_0x15de0e[_0x0a9e('0x20')](','):null);},'get':function(){return this['getDataValue'](_0x0a9e('0x2c'))?this[_0x0a9e('0x8')](_0x0a9e('0x2c'))[_0x0a9e('0x2d')](','):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22force_rport\x22,\x20\x22comedia\x22]'},'callgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedcallgroup':{'type':Sequelize[_0x0a9e('0x3')]},'pickupgroup':{'type':Sequelize[_0x0a9e('0x3')]},'namedpickupgroup':{'type':Sequelize['STRING']},'language':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':'en'},'tonezone':{'type':Sequelize[_0x0a9e('0x3')]},'disallow':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':![],'defaultValue':'all'},'allow':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x0a9e('0x2e'),'set':function(_0x40d766){this['setDataValue'](_0x0a9e('0x2f'),_0x40d766?_0x40d766[_0x0a9e('0x20')](';'):_0x0a9e('0x2e'));},'get':function(){return this[_0x0a9e('0x8')]('allow')?this['getDataValue'](_0x0a9e('0x2f'))[_0x0a9e('0x2d')](';'):null;},'comment':'String\x20is\x20deprecated.\x20Please\x20use\x20an\x20Array\x20as\x20[\x22ulaw\x22,\x20\x22alaw\x22,\x20\x22gsm\x22]'},'autoframing':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'insecure':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'set':function(_0x5b4f5e){this[_0x0a9e('0x4')](_0x0a9e('0x30'),_0x5b4f5e?_0x5b4f5e[_0x0a9e('0x20')](','):null);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x30'))?this[_0x0a9e('0x8')](_0x0a9e('0x30'))[_0x0a9e('0x2d')](','):null;},'comment':_0x0a9e('0x31')},'trustrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'trust_id_outbound':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'progressinband':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','never'),'allowNull':!![]},'promiscredir':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'useclientcode':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'accountcode':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'setvar':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callerid':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![],'defaultValue':_0x0a9e('0x32')},'amaflags':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callcounter':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':_0x0a9e('0x28')},'busylevel':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'allowoverlap':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowsubscribe':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'allowtransfer':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'ignoresdpversion':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribecontext':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'template':{'type':Sequelize['STRING'],'allowNull':!![]},'videosupport':{'type':Sequelize[_0x0a9e('0x15')]('yes','no',_0x0a9e('0x33')),'allowNull':!![],'defaultValue':'no'},'maxcallbitrate':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'rfc2833compensate':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'session_timers':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x34'),_0x0a9e('0x35'),_0x0a9e('0x36')),'allowNull':!![]},'session_expires':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_minse':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'session_refresher':{'type':Sequelize['ENUM'](_0x0a9e('0x37'),_0x0a9e('0x38')),'allowNull':!![],'defaultValue':_0x0a9e('0x38')},'t38pt_usertpsource':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'regexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromdomain':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'fromuser':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'qualify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'yes'},'keepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'defaultip':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'defaultuser':{'type':Sequelize['STRING'],'allowNull':!![]},'rtptimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpholdtimeout':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![]},'rtpkeepalive':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'sendrpid':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'outboundproxy':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'callbackextension':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'timert1':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'timerb':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'qualifyfreq':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'contactpermit':{'type':Sequelize['STRING'],'allowNull':!![]},'contactdeny':{'type':Sequelize['STRING'],'allowNull':!![]},'contactacl':{'type':Sequelize['STRING'],'allowNull':!![]},'unsolicited_mailbox':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'use_q850_reason':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'maxforwards':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'encryption':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![],'defaultValue':'no'},'avpf':{'type':Sequelize[_0x0a9e('0x15')]('yes','no'),'allowNull':!![]},'force_avp':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'icesupport':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsenable':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no'),'allowNull':!![]},'dtlsverify':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no','fingerprint',_0x0a9e('0x39')),'allowNull':!![]},'dtlsrekey':{'type':Sequelize[_0x0a9e('0xf')](0xb),'allowNull':!![]},'dtlscertfile':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlsprivatekey':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlscipher':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscafile':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'dtlscapath':{'type':Sequelize['STRING'],'allowNull':!![]},'dtlssetup':{'type':Sequelize[_0x0a9e('0x15')]('active',_0x0a9e('0x3a'),'actpass'),'allowNull':!![]},'dtlsfingerprint':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'usereqphone':{'type':Sequelize['ENUM']('yes','no'),'allowNull':!![],'defaultValue':'no'},'recordonfeature':{'type':Sequelize['STRING'],'allowNull':!![]},'recordofffeature':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'call_limit':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0xa},'registertrying':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'subscribemwi':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'allowNull':!![]},'vmexten':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohinterpret':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'mohsuggest':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'parkinglot':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'canreinvite':{'type':Sequelize['ENUM'](_0x0a9e('0x28'),'no',_0x0a9e('0x3b'),_0x0a9e('0x29'),_0x0a9e('0x3c')),'allowNull':!![],'defaultValue':'no'},'loginInPause':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'resetPasswordToken':{'type':Sequelize[_0x0a9e('0x3')]},'resetPasswordExpires':{'type':Sequelize['DATE']},'passwordResetAt':{'type':Sequelize[_0x0a9e('0x13')],'defaultValue':null},'previousPasswords':{'type':Sequelize[_0x0a9e('0x3d')]},'showWebBar':{'type':Sequelize['INTEGER'],'defaultValue':0x0,'set':function(_0x3649cc){this['setDataValue'](_0x0a9e('0x3e'),_0x3649cc);var _0x5ba1f9=this['get']({'plain':!![]});switch(_0x3649cc){case 0x0:case 0x1:var _0x5674ee=_0x5ba1f9[_0x0a9e('0x21')]?_['isArray'](_0x5ba1f9[_0x0a9e('0x21')])?_0x5ba1f9[_0x0a9e('0x21')][_0x0a9e('0x20')]():_0x5ba1f9[_0x0a9e('0x21')]:_0x0a9e('0x1f');if(_0x5674ee===_0x0a9e('0x3f')){_0x5674ee='udp';}this[_0x0a9e('0x4')]('transport',_0x5674ee);this[_0x0a9e('0x4')](_0x0a9e('0x40'),'no');this[_0x0a9e('0x4')]('avpf',null);this[_0x0a9e('0x4')](_0x0a9e('0x41'),null);this[_0x0a9e('0x4')](_0x0a9e('0x42'),null);this['setDataValue'](_0x0a9e('0x43'),null);this[_0x0a9e('0x4')]('dtlsverify',null);this[_0x0a9e('0x4')](_0x0a9e('0x44'),null);this[_0x0a9e('0x4')](_0x0a9e('0x45'),null);this[_0x0a9e('0x4')]('dtlsprivatekey',null);this[_0x0a9e('0x4')](_0x0a9e('0x46'),'no');break;case 0x2:this[_0x0a9e('0x4')]('transport',_0x0a9e('0x3f'));this['setDataValue']('encryption',_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x47'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x41'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x42'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x43'),_0x0a9e('0x28'));this[_0x0a9e('0x4')](_0x0a9e('0x48'),'no');this[_0x0a9e('0x4')](_0x0a9e('0x44'),_0x0a9e('0x49'));this['setDataValue'](_0x0a9e('0x45'),_0x5ba1f9[_0x0a9e('0x45')]||_0x0a9e('0x4a'));this['setDataValue'](_0x0a9e('0x4b'),_0x5ba1f9[_0x0a9e('0x4b')]||'/etc/pki/tls/private/motion.key');this[_0x0a9e('0x4')](_0x0a9e('0x46'),_0x0a9e('0x28'));break;default:}}},'permissions':{'type':Sequelize[_0x0a9e('0x3d')],'set':function(_0x13b5c0){this['setDataValue']('permissions',_0x13b5c0?_0x13b5c0['join'](','):[]);},'get':function(){return this[_0x0a9e('0x8')](_0x0a9e('0x4c'))?_[_0x0a9e('0x4d')](this[_0x0a9e('0x8')](_0x0a9e('0x4c'))[_0x0a9e('0x2d')](','),function(_0xeef20){return parseInt(_0xeef20,0xa);}):[];}},'phoneBarUnconditionalNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarNoReplyNumber':{'type':Sequelize['STRING']},'phoneBarBusyNumber':{'type':Sequelize[_0x0a9e('0x3')]},'phoneBarUnconditional':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarNoReply':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarBusy':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'phoneBarDnd':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarUnansweredCallBadge':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'phoneBarEnableDtmfTone':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarAutoAnswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'extensionMonitor':{'type':Sequelize['STRING'],'defaultValue':''},'crudPermissions':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'rtcp_mux':{'type':Sequelize[_0x0a9e('0x15')](_0x0a9e('0x28'),'no'),'defaultValue':'no'},'allowmessenger':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'phoneBarOutboundProxy':{'type':Sequelize['STRING']},'phoneBarEnableJaws':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableScreenRecordingByAgent':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarEnableVideoRecording':{'type':Sequelize[_0x0a9e('0x4e')],'get':function(){return this[_0x0a9e('0x8')]('phoneBarEnableScreenRecordingByAgent')?this[_0x0a9e('0x8')](_0x0a9e('0x4f')):![];}},'phoneBarEnableAutomaticScreenRecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'phoneBarPrefixRequired':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'hotdesk':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'interface':{'type':Sequelize[_0x0a9e('0x3')],'defaultValue':null},'privacyEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'apiKeyNonce':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'apiKeyIat':{'type':Sequelize[_0x0a9e('0x3')],'allowNull':!![]},'screenrecording':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![],'set':function(_0xdb98ca){if(typeof _0xdb98ca===_0x0a9e('0x50')){var _0x3df0e3=_0xdb98ca==='1'?!![]:_0xdb98ca==='0'?![]:_0xdb98ca===_0x0a9e('0x51')?!![]:_0xdb98ca===_0x0a9e('0x52')?![]:![];this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0x3df0e3);}else{this[_0x0a9e('0x4')](_0x0a9e('0x53'),_0xdb98ca);}}},'blocked':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'set':function(_0xf4120f){this[_0x0a9e('0x4')](_0x0a9e('0x54'),_0xf4120f);if(_0xf4120f===!![]){this['setDataValue'](_0x0a9e('0x55'),moment());this[_0x0a9e('0x4')](_0x0a9e('0x56'),0x0);}else{this[_0x0a9e('0x4')]('blockedAt',null);}}},'blockedAt':{'type':Sequelize['DATE'],'defaultValue':null},'loginAttempts':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'disabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'settingsEnabled':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'wssPort':{'type':Sequelize[_0x0a9e('0xf')](0x5)['UNSIGNED'],'defaultValue':0x1f99},'downloadAttachments':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'ignorePauseForPreviewCalls':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'selectRecallMeCampaign':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'adSsoEnabled':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'chatAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'emailAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'emailAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'smsAutoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'smsAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'openchannelAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'openchannelAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0},'faxAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'faxAutoanswerDelay':{'type':Sequelize['INTEGER'],'defaultValue':0x0},'whatsappAutoanswer':{'type':Sequelize[_0x0a9e('0x12')],'defaultValue':![]},'whatsappAutoanswerDelay':{'type':Sequelize[_0x0a9e('0xf')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/user/user.controller.js b/server/api/user/user.controller.js index 3c95e0a..eb1239e 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 _0xf2a7=['idle','unavailable','voiceStatus','slice','charAt','toUpperCase','select','field','ui.createdAt','user_has_','ui.UserId\x20=\x20?','OpenTabs','moment','util','path','lodash','squel','jayson/promise','../../components/auth/service','../../config/logger','../../config/utils','../../config/license/util','APIBadRequestError','../../errors/api','handleError','../../mysqldb','socket.io-emitter','redis','./user.socket','defaults','localhost','client','request','then','User,\x20%s,\x20%s','request\x20sent','debug','User,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','sendStatus','status','json','offset','undefined','limit','count','Content-Range','role','emit','userNotification:recalc:','destroy','Users','user','agent','Telephones','filter','includes','find','value','name','UserProfileResource','stack','index','User','rawAttributes','fieldName','key','where','includeAll','include','query','userSetting','true','UserSetting','attributes','push','findAll','rows','length','dataValues','sms','fax','openchannel','whatsapp','all','show','params','keys','password','salt','filters','intersection','model','fields','merge','options','chat','mail','update','body','describe','addContacts','ids','internal','Setting','findById','securePassword','max','isNil','sequelize','QueryTypes','min_internal','from','voicemail','VoiceMail','fullname','email','permissions','101','102','103','113','104','105','106','107','108','109','100','111','115','create','Unauthorized','admin','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20another\x20administrator','checkUserLimits','settingsEnabled','userProfileId','UserProfileSection','autoAssociation','bulkCreate','some','Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20administrator','telephone','Agents','map','compact','changePassword','oldPassword','newPassword','Sequelize','ValidationError','Invalid\x20body\x20format.\x20Use\x20oldPassword\x20and\x20newPassword','authenticate','Wrong\x20credentials','New\x20password\x20must\x20be\x20different\x20from\x20old\x20password','Invalid\x20body\x20format.\x20Use\x20newPassword','findOne','enforcePasswordHistory','previousPasswords','validatePasswordHistory','passwordHistoryLimit','updatePasswordsHistory','addQueues','online','voicePause','isValidChannel','Unknown\x20channel','add','Queues','penalty','spread','capitalize','toLowerCase','QueueId','Queue:save','voice','get','format','SIP/%s','UserVoiceQueueRt','removeQueues','channel','remove','isArray','Queue:remove','addAvatar','userpic','filename','getAvatar','join','root','server/files/images/logos/default_profile.png','download','server/files/images/','getOpenTabs','ChatOpenTabs','CHAT','createdAt','FAX','OpenchannelOpenTabs','OPENCHANNEL','MailOpenTabs','MAIL','SmsOpenTabs','SMS','WhatsappOpenTabs','WHATSAPP','getContacts','User\x20with\x20id\x20%s\x20not\x20found','getOptions','hasOwnProperty','CmList','Tag','Tags','color','tag','Queue','order','sort','pick','Unknown\x20role','getVoiceQueuesRt','nolimit','getGroups','ChatGroup','getRecordings','VoiceRecording','UserId','getScreenRecordings','ScreenRecording','getChatInteractions','ChatInteraction','getOpenchannelInteractions','OpenchannelInteraction','getMailInteractions','MailInteraction','getSmsInteractions','getFaxInteractions','FaxInteraction','getWhatsappInteractions','WhatsappInteraction','login','mobile','loginInPause','interface','LOCAL/%s@from-sip/n','intrf','user:%s','user:forcelogout','headers','x-forwarded-for','connection','socket','User\x20not\x20found\x20or\x20not\x20allowed\x20to\x20perform\x20login\x20method','getVoiceQueues','UserVoiceQueue.penalty','MemberReport','forEach','YYYY-MM-DD\x20HH:mm:ss','getChannels','LOGIN','PAUSE','LOGININPAUSE','concat','resolve','pause','QueuePause','updateAttributes','type','DEFAULT\x20PAUSE','unpause','Channel\x20parameter\x20%s\x20is\x20invalid','mailPause','chatPause','faxPause','whatsappPause','pauseType','lastPauseAt','getTeams','addTeams','transaction','Team','getAssociatedQueues','getDataValue','Voice','upsert','TeamVoicePrefix','UserVoicePrefix','removeTeams','Query\x20parameter\x20\x27ids\x27\x20is\x20required','flattenDeep','removeAgent','VoicePrefixId','getLists','getAgents','values','You\x20can\x27t\x20delete\x20yourself','addChatInteractions','omit','user_has_chat_interactions:save','removeChatInteractions','user_has_chat_interactions:remove','addMailInteractions','user_has_mail_interactions:save','user_has_mail_interactions:remove','addFaxInteractions','user_has_fax_interactions:save','removeFaxInteractions','user_has_fax_interactions:remove','addSmsInteractions','user_has_sms_interactions:save','removeSmsInteractions','user_has_sms_interactions:remove','addOpenchannelInteractions','user_has_openchannel_interactions:save','user_has_openchannel_interactions:remove','addWhatsappInteractions','user_has_whatsapp_interactions:save','removeWhatsappInteractions','VoicePrefix','getVoicePrefixes','getFaxAccounts','FaxAccount','addFaxAccounts','removeFaxAccounts','getMailAccounts','addMailAccounts','removeMailAccounts','getOpenchannelAccounts','OpenchannelAccount','addOpenchannelAccounts','removeOpenchannelAccounts','getSmsAccounts','SmsAccount','removeSmsAccounts','getChatWebsites','addChatWebsites','removeChatWebsites','getWhatsappAccounts','WhatsappAccount','addWhatsappAccounts','removeWhatsappAccounts','getScheduledCalls','CmHopper','$and','$or','$lt','$ne','$eq','$not','$between','$like','$notLike','$iLike','$notILike','$overlap','$contains','$contained','$any','lastName','phone','CmContact','dialActive','getApiKey','retrieveApiKey','token','You\x20don\x27t\x20have\x20sufficient\x20privileges\x20to\x20access\x20this\x20resource.','createApiKey','iat','nonce','removeApiKey','apiKeyNonce','apiKeyIat','whoami','getUserSetting','getPresence','queues','isEmpty','teams','VoiceQueue','inbound','flatten','lower','col','toString','asc','uniqBy','orderBy','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)'];(function(_0x15604f,_0x53fb88){var _0x423e2f=function(_0x4edfa9){while(--_0x4edfa9){_0x15604f['push'](_0x15604f['shift']());}};_0x423e2f(++_0x53fb88);}(_0xf2a7,0x197));var _0x7f2a=function(_0x444848,_0x3ad816){_0x444848=_0x444848-0x0;var _0x50ac0d=_0xf2a7[_0x444848];return _0x50ac0d;};'use strict';var moment=require(_0x7f2a('0x0'));var util=require(_0x7f2a('0x1'));var path=require(_0x7f2a('0x2'));var fs=require('fs');var _=require(_0x7f2a('0x3'));var squel=require(_0x7f2a('0x4'));var jayson=require(_0x7f2a('0x5'));var Redis=require('ioredis');var authService=require(_0x7f2a('0x6'));var contacts=require('../../components/contacts');var qs=require('../../components/parsers/qs');var logger=require(_0x7f2a('0x7'))('api');var utils=require(_0x7f2a('0x8'));var config=require('../../config/environment');var licenseUtil=require(_0x7f2a('0x9'));var APIBadRequestError=require('../../errors/api')[_0x7f2a('0xa')];var APINotFoundError=require(_0x7f2a('0xb'))['APINotFoundError'];var APIHandleError=require(_0x7f2a('0xb'))[_0x7f2a('0xc')];var db=require(_0x7f2a('0xd'))['db'];var socket=require(_0x7f2a('0xe'))(new Redis(config[_0x7f2a('0xf')]));require(_0x7f2a('0x10'))['register'](socket);config[_0x7f2a('0xf')]=_[_0x7f2a('0x11')](config[_0x7f2a('0xf')],{'host':_0x7f2a('0x12'),'port':0x18eb});var amiClient=jayson[_0x7f2a('0x13')]['http']({'port':0x232a});var values;function respondWithRpcPromise(_0x407170,_0x5229c6,_0x218c52,_0x2d76ef){return new Promise(function(_0x1f178a,_0x462e40){var _0x30d14b=_0x2d76ef||amiClient;return _0x30d14b[_0x7f2a('0x14')](_0x407170,_0x218c52)[_0x7f2a('0x15')](function(_0x561dbb){logger['info'](_0x7f2a('0x16'),_0x5229c6,_0x7f2a('0x17'));logger[_0x7f2a('0x18')](_0x7f2a('0x19'),_0x5229c6,_0x7f2a('0x17'),JSON['stringify'](_0x561dbb));if(_0x561dbb[_0x7f2a('0x1a')]){if(_0x561dbb[_0x7f2a('0x1a')]['code']===0x1f4){logger[_0x7f2a('0x1a')](_0x7f2a('0x16'),_0x5229c6,_0x561dbb[_0x7f2a('0x1a')]['message']);return _0x462e40(_0x561dbb[_0x7f2a('0x1a')]['message']);}logger[_0x7f2a('0x1a')](_0x7f2a('0x16'),_0x5229c6,_0x561dbb['error'][_0x7f2a('0x1b')]);return _0x1f178a(_0x561dbb[_0x7f2a('0x1a')]['message']);}else{logger[_0x7f2a('0x1c')](_0x7f2a('0x16'),_0x5229c6,_0x7f2a('0x17'));_0x1f178a(_0x561dbb[_0x7f2a('0x1d')][_0x7f2a('0x1b')]);}})[_0x7f2a('0x1e')](function(_0x47ae7f){logger[_0x7f2a('0x1a')]('User,\x20%s,\x20%s',_0x5229c6,_0x47ae7f);_0x462e40(_0x47ae7f);});});}function respondWithStatusCode(_0x118c41,_0x5af2c0){_0x5af2c0=_0x5af2c0||0xcc;return function(_0x955ed9){if(_0x955ed9){return _0x118c41[_0x7f2a('0x1f')](_0x5af2c0);}return _0x118c41[_0x7f2a('0x20')](_0x5af2c0)['end']();};}function respondWithResult(_0x5ecb82,_0x263c35){_0x263c35=_0x263c35||0xc8;return function(_0x246c46){if(_0x246c46){return _0x5ecb82['status'](_0x263c35)[_0x7f2a('0x21')](_0x246c46);}};}function respondWithFilteredResult(_0x11a9e1,_0x347219){return function(_0x3c27ed){if(_0x3c27ed){var _0x48bd17=typeof _0x347219[_0x7f2a('0x22')]===_0x7f2a('0x23')&&typeof _0x347219[_0x7f2a('0x24')]===_0x7f2a('0x23');var _0x18c7cf=_0x3c27ed['count'];var _0x543b9d=_0x48bd17?0x0:_0x347219[_0x7f2a('0x22')];var _0x5578a3=_0x48bd17?_0x3c27ed[_0x7f2a('0x25')]:_0x347219['offset']+_0x347219['limit'];var _0x5061ee;if(_0x5578a3>=_0x18c7cf){_0x5578a3=_0x18c7cf;_0x5061ee=0xc8;}else{_0x5061ee=0xce;}_0x11a9e1[_0x7f2a('0x20')](_0x5061ee);return _0x11a9e1['set'](_0x7f2a('0x26'),_0x543b9d+'-'+_0x5578a3+'/'+_0x18c7cf)[_0x7f2a('0x21')](_0x3c27ed);}return null;};}function saveUpdates(_0x33f8dd){return function(_0x18be22){if(_0x18be22){return _0x18be22['update'](_0x33f8dd)[_0x7f2a('0x15')](function(_0x1c647c){if(_0x1c647c[_0x7f2a('0x27')]==='agent'){socket[_0x7f2a('0x28')](_0x7f2a('0x29')+_0x1c647c['id'],_0x1c647c);}return _0x1c647c;});}return null;};}function removeEntity(_0x44ebdd){return function(_0x13ed1e){if(_0x13ed1e){return _0x13ed1e[_0x7f2a('0x2a')]()[_0x7f2a('0x15')](function(){var _0x1a305d=_0x13ed1e['get']({'plain':!![]});if(_0x1a305d[_0x7f2a('0x27')]==='admin')return;var _0xfaa963=[{'name':_0x7f2a('0x2b'),'value':_0x7f2a('0x2c'),'ignore':!![]},{'name':'Agents','value':_0x7f2a('0x2d'),'ignore':![]},{'name':_0x7f2a('0x2e'),'value':'telephone','ignore':![]}];var _0x190799=_(_0xfaa963)[_0x7f2a('0x2f')]('ignore')['map']('value')['value']();if(_[_0x7f2a('0x30')](_0x190799,_0x1a305d['role'])){return;}var _0x475be5=_[_0x7f2a('0x31')](_0xfaa963,[_0x7f2a('0x32'),_0x1a305d[_0x7f2a('0x27')]])[_0x7f2a('0x33')];return db[_0x7f2a('0x34')][_0x7f2a('0x2a')]({'where':{'type':_0x475be5,'resourceId':_0x1a305d['id']}})[_0x7f2a('0x15')](function(){return _0x13ed1e;});})[_0x7f2a('0x15')](function(){_0x44ebdd['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x4ae23e){return function(_0x3f2589){if(!_0x3f2589){_0x4ae23e[_0x7f2a('0x1f')](0x194);}return _0x3f2589;};}function handleError(_0x31deb2,_0x2ac819){_0x2ac819=_0x2ac819||0x1f4;return function(_0x13bea0){logger['error'](_0x13bea0[_0x7f2a('0x35')]);if(_0x13bea0[_0x7f2a('0x33')]){delete _0x13bea0[_0x7f2a('0x33')];}_0x31deb2[_0x7f2a('0x20')](_0x2ac819)['send'](_0x13bea0);};}exports[_0x7f2a('0x36')]=function(_0x4c2732,_0x469b25){var _0x4c4f63={},_0x1a54c4={'count':0x0,'rows':[]};var _0x274e7d=_(db[_0x7f2a('0x37')][_0x7f2a('0x38')])['map'](function(_0x25c165){return{'name':_0x25c165[_0x7f2a('0x39')],'type':_0x25c165['type'][_0x7f2a('0x3a')]};})[_0x7f2a('0x2f')](function(_0x36de3a){return!_[_0x7f2a('0x30')](['password','salt'],_0x36de3a[_0x7f2a('0x33')]);})[_0x7f2a('0x32')]();_0x4c4f63=qs['getOptions'](_0x274e7d,_0x4c2732);var _0x1e88e7={'where':_0x4c4f63[_0x7f2a('0x3b')]};return db[_0x7f2a('0x37')][_0x7f2a('0x25')](_0x1e88e7)[_0x7f2a('0x15')](function(_0x270938){_0x1a54c4[_0x7f2a('0x25')]=_0x270938;if(_0x4c2732['query'][_0x7f2a('0x3c')]){_0x4c4f63[_0x7f2a('0x3d')]=[{'all':!![]}];}if(_0x4c2732[_0x7f2a('0x3e')][_0x7f2a('0x3f')]===_0x7f2a('0x40')){_0x4c4f63['include']=[{'model':db[_0x7f2a('0x41')],'as':'userSetting'}];}if(!_[_0x7f2a('0x30')](_0x4c4f63['attributes'],'id')){_0x4c4f63[_0x7f2a('0x42')][_0x7f2a('0x43')]('id');}return db['User'][_0x7f2a('0x44')](_0x4c4f63);})[_0x7f2a('0x15')](function(_0x156e81){_0x1a54c4[_0x7f2a('0x45')]=_0x156e81;if(_0x4c2732[_0x7f2a('0x3e')]['openTabs']==='true'){var _0xe047c8=[];for(var _0x5ca936=0x0;_0x5ca936<_0x1a54c4[_0x7f2a('0x45')][_0x7f2a('0x46')];_0x5ca936++){_0xe047c8[_0x7f2a('0x43')](get_open_tabs('chat',_0x1a54c4[_0x7f2a('0x45')][_0x5ca936][_0x7f2a('0x47')]));_0xe047c8[_0x7f2a('0x43')](get_open_tabs(_0x7f2a('0x48'),_0x1a54c4[_0x7f2a('0x45')][_0x5ca936]['dataValues']));_0xe047c8[_0x7f2a('0x43')](get_open_tabs(_0x7f2a('0x49'),_0x1a54c4['rows'][_0x5ca936][_0x7f2a('0x47')]));_0xe047c8[_0x7f2a('0x43')](get_open_tabs('mail',_0x1a54c4[_0x7f2a('0x45')][_0x5ca936][_0x7f2a('0x47')]));_0xe047c8[_0x7f2a('0x43')](get_open_tabs(_0x7f2a('0x4a'),_0x1a54c4[_0x7f2a('0x45')][_0x5ca936][_0x7f2a('0x47')]));_0xe047c8[_0x7f2a('0x43')](get_open_tabs(_0x7f2a('0x4b'),_0x1a54c4[_0x7f2a('0x45')][_0x5ca936][_0x7f2a('0x47')]));}return Promise[_0x7f2a('0x4c')](_0xe047c8)['then'](function(){return _0x1a54c4;});}else{return _0x1a54c4;}})['then'](respondWithFilteredResult(_0x469b25,_0x4c4f63))['catch'](handleError(_0x469b25,null));};exports[_0x7f2a('0x4d')]=function(_0x292a20,_0x1b8fbf){var _0x5cab97={'raw':![],'where':{'id':_0x292a20[_0x7f2a('0x4e')]['id']}},_0xa1581e={};_0xa1581e['model']=_['differenceBy'](_[_0x7f2a('0x4f')](db[_0x7f2a('0x37')][_0x7f2a('0x38')]),[_0x7f2a('0x50'),_0x7f2a('0x51')]);_0xa1581e['query']=_['keys'](_0x292a20[_0x7f2a('0x3e')]);_0xa1581e[_0x7f2a('0x52')]=_[_0x7f2a('0x53')](_0xa1581e[_0x7f2a('0x54')],_0xa1581e[_0x7f2a('0x3e')]);_0x5cab97[_0x7f2a('0x42')]=_[_0x7f2a('0x53')](_0xa1581e[_0x7f2a('0x54')],qs[_0x7f2a('0x55')](_0x292a20['query'][_0x7f2a('0x55')]));_0x5cab97[_0x7f2a('0x42')]=_0x5cab97[_0x7f2a('0x42')][_0x7f2a('0x46')]?_0x5cab97[_0x7f2a('0x42')]:_0xa1581e[_0x7f2a('0x54')];if(_0x292a20['query']['includeAll']){_0x5cab97[_0x7f2a('0x3d')]=[{'all':!![]}];}if(_0x292a20['query']['userSetting']===_0x7f2a('0x40')){_0x5cab97[_0x7f2a('0x3d')]=[{'model':db[_0x7f2a('0x41')],'as':'userSetting'}];}_0x5cab97=_[_0x7f2a('0x56')]({},_0x5cab97,_0x292a20[_0x7f2a('0x57')]);if(!_['includes'](_0x5cab97[_0x7f2a('0x42')],'id')){_0x5cab97[_0x7f2a('0x42')][_0x7f2a('0x43')]('id');}return db['User'][_0x7f2a('0x31')](_0x5cab97)[_0x7f2a('0x15')](handleEntityNotFound(_0x1b8fbf,null))[_0x7f2a('0x15')](function(_0x5ec2f5){var _0x6767b9=[];values=_0x5ec2f5;if(_0x292a20[_0x7f2a('0x3e')]['openTabs']===_0x7f2a('0x40')){_0x6767b9[_0x7f2a('0x43')](get_open_tabs(_0x7f2a('0x58'),_0x5ec2f5[_0x7f2a('0x47')]));_0x6767b9[_0x7f2a('0x43')](get_open_tabs('sms',_0x5ec2f5['dataValues']));_0x6767b9['push'](get_open_tabs(_0x7f2a('0x4a'),_0x5ec2f5['dataValues']));_0x6767b9['push'](get_open_tabs('whatsapp',_0x5ec2f5['dataValues']));_0x6767b9[_0x7f2a('0x43')](get_open_tabs(_0x7f2a('0x49'),_0x5ec2f5['dataValues']));_0x6767b9[_0x7f2a('0x43')](get_open_tabs(_0x7f2a('0x59'),_0x5ec2f5[_0x7f2a('0x47')]));return Promise[_0x7f2a('0x4c')](_0x6767b9);}else{return values;}})[_0x7f2a('0x15')](function(){return values;})[_0x7f2a('0x15')](respondWithResult(_0x1b8fbf,null))[_0x7f2a('0x1e')](handleError(_0x1b8fbf,null));};exports[_0x7f2a('0x5a')]=function(_0x5d62fc,_0x255e60){if(_0x5d62fc[_0x7f2a('0x5b')]['id']){delete _0x5d62fc[_0x7f2a('0x5b')]['id'];}delete _0x5d62fc[_0x7f2a('0x5b')][_0x7f2a('0x27')];return db[_0x7f2a('0x37')][_0x7f2a('0x31')]({'where':{'id':_0x5d62fc[_0x7f2a('0x4e')]['id']}})[_0x7f2a('0x15')](handleEntityNotFound(_0x255e60,null))['then'](saveUpdates(_0x5d62fc[_0x7f2a('0x5b')],null))[_0x7f2a('0x15')](respondWithResult(_0x255e60,null))[_0x7f2a('0x1e')](handleError(_0x255e60,null));};exports[_0x7f2a('0x5c')]=function(_0x1cd319,_0x47f8e2){return db[_0x7f2a('0x37')][_0x7f2a('0x5c')]()['then'](respondWithResult(_0x47f8e2,null))[_0x7f2a('0x1e')](handleError(_0x47f8e2,null));};exports[_0x7f2a('0x5d')]=function(_0x488176,_0x1476b2){return db[_0x7f2a('0x37')][_0x7f2a('0x31')]({'where':{'id':_0x488176[_0x7f2a('0x4e')]['id']}})[_0x7f2a('0x15')](handleEntityNotFound(_0x1476b2,null))[_0x7f2a('0x15')](function(_0x2dfabd){if(_0x2dfabd){return _0x2dfabd[_0x7f2a('0x5d')](_0x488176[_0x7f2a('0x5b')]['ids'],_['omit'](_0x488176['body'],[_0x7f2a('0x5e'),'id'])||{});}})[_0x7f2a('0x15')](respondWithResult(_0x1476b2,null))[_0x7f2a('0x1e')](handleError(_0x1476b2,null));};function validateUser(_0x3321e9){return new Promise(function(_0x2c69ed,_0x5f3745){if(_0x3321e9[_0x7f2a('0x5f')])return _0x2c69ed(_0x3321e9);return db[_0x7f2a('0x60')][_0x7f2a('0x61')](0x1)[_0x7f2a('0x15')](function(_0x5002f1){if(_0x5002f1[_0x7f2a('0x62')])authService['validatePasswordPattern'](_0x3321e9[_0x7f2a('0x50')]);db['User'][_0x7f2a('0x63')](_0x7f2a('0x5f'))[_0x7f2a('0x15')](function(_0x373b3e){if(_['isNil'](_0x373b3e)){_0x3321e9[_0x7f2a('0x5f')]=_0x5002f1['min_internal']||0x1;return;}if(_[_0x7f2a('0x64')](_0x5002f1['min_internal'])||_0x5002f1['min_internal']===_0x373b3e){_0x3321e9[_0x7f2a('0x5f')]=_0x373b3e+0x1;return;}if(_0x5002f1['min_internal']>_0x373b3e){_0x3321e9[_0x7f2a('0x5f')]=_0x5002f1['min_internal'];return;}return db['sequelize']['query']('select\x20(select\x20IFNULL(max(internal)+1,1)\x20from\x20users\x20where\x20internal\x20<\x20md.internal)\x20as\x20\x27from\x27,\x20md.internal\x20-\x201\x20as\x20\x27to\x27\x20from\x20users\x20md\x20where\x20md.internal\x20!=\x201\x20and\x20not\x20exists\x20(select\x201\x20from\x20users\x20md2\x20where\x20md2.internal\x20=\x20md.internal\x20-\x201)',{'type':db[_0x7f2a('0x65')][_0x7f2a('0x66')]['SELECT']})[_0x7f2a('0x15')](function(_0xf831df){if(_0xf831df&&_0xf831df[_0x7f2a('0x46')]){for(var _0x11e258=0x0,_0x42e842=_0xf831df['length'];_0x11e258<_0x42e842&&_[_0x7f2a('0x64')](_0x3321e9['internal']);_0x11e258++){if(_0x5002f1[_0x7f2a('0x67')]<=_0xf831df[_0x11e258][_0x7f2a('0x68')]){_0x3321e9[_0x7f2a('0x5f')]=_0xf831df[_0x11e258]['from'];}else if(_0x5002f1[_0x7f2a('0x67')]>_0xf831df[_0x11e258][_0x7f2a('0x68')]&&_0x5002f1[_0x7f2a('0x67')]<=_0xf831df[_0x11e258]['to']){_0x3321e9[_0x7f2a('0x5f')]=_0x5002f1[_0x7f2a('0x67')];}}}if(_[_0x7f2a('0x64')](_0x3321e9[_0x7f2a('0x5f')])){_0x3321e9[_0x7f2a('0x5f')]=_0x373b3e+0x1;}return _0x2c69ed(_0x3321e9);});});})['catch'](function(_0x5020e3){_0x5f3745(_0x5020e3);});});}function updateUser(_0x4dfa7){return new Promise(function(_0x18f546,_0x1eb277){try{if(_0x4dfa7[_0x7f2a('0x69')]){_0x4dfa7['mailbox']=_0x4dfa7['internal'];_0x4dfa7[_0x7f2a('0x6a')]={'mailbox':_0x4dfa7[_0x7f2a('0x5f')],'password':_0x4dfa7[_0x7f2a('0x50')],'fullname':_0x4dfa7[_0x7f2a('0x6b')],'email':_0x4dfa7[_0x7f2a('0x6c')]};}if(_0x4dfa7[_0x7f2a('0x27')]===_0x7f2a('0x2d')){if(!_0x4dfa7[_0x7f2a('0x6d')])_0x4dfa7[_0x7f2a('0x6d')]=[_0x7f2a('0x6e'),_0x7f2a('0x6f'),_0x7f2a('0x70'),_0x7f2a('0x71'),'110',_0x7f2a('0x72'),_0x7f2a('0x73'),_0x7f2a('0x74'),_0x7f2a('0x75'),_0x7f2a('0x76'),_0x7f2a('0x77'),_0x7f2a('0x78'),_0x7f2a('0x79'),'114',_0x7f2a('0x7a')];}_0x18f546(_0x4dfa7);}catch(_0x34e89e){_0x1eb277(_0x34e89e);}});}exports[_0x7f2a('0x7b')]=function(_0x3b2fdb,_0x74dbc8){if(_0x3b2fdb[_0x7f2a('0x2c')][_0x7f2a('0x27')]===_0x7f2a('0x2d'))throw new Error(_0x7f2a('0x7c'));if(_0x3b2fdb[_0x7f2a('0x5b')][_0x7f2a('0x27')]==='user'&&_0x3b2fdb['user'][_0x7f2a('0x27')]!==_0x7f2a('0x7d')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_0x3b2fdb[_0x7f2a('0x5b')][_0x7f2a('0x27')]===_0x7f2a('0x7d')&&_0x3b2fdb[_0x7f2a('0x2c')][_0x7f2a('0x27')]!==_0x7f2a('0x7d')){throw new Error(_0x7f2a('0x7e'));}return licenseUtil[_0x7f2a('0x7f')]([_0x3b2fdb[_0x7f2a('0x5b')]])[_0x7f2a('0x15')](function(){return validateUser(_0x3b2fdb[_0x7f2a('0x5b')]);})[_0x7f2a('0x15')](function(_0x552141){return updateUser(_0x552141)[_0x7f2a('0x15')](function(_0x5ba325){if(_0x5ba325['role']==='admin'){_0x5ba325[_0x7f2a('0x80')]=_0x3b2fdb['user'][_0x7f2a('0x80')];delete _0x5ba325[_0x7f2a('0x81')];}return _0x5ba325;});})[_0x7f2a('0x15')](function(_0x103eca){return db['User'][_0x7f2a('0x7b')](_0x103eca,{'include':[{'model':db[_0x7f2a('0x6a')],'as':_0x7f2a('0x6a')}]});})[_0x7f2a('0x15')](function(_0x4ce5f3){if(_0x3b2fdb[_0x7f2a('0x5b')][_0x7f2a('0x27')]===_0x7f2a('0x2c'))return _0x4ce5f3;if(_0x3b2fdb[_0x7f2a('0x2c')][_0x7f2a('0x27')]!==_0x7f2a('0x2c'))return _0x4ce5f3;return db[_0x7f2a('0x82')][_0x7f2a('0x31')]({'where':{'name':_0x4ce5f3[_0x7f2a('0x27')]===_0x7f2a('0x2d')?'Agents':'Telephones','userProfileId':_0x3b2fdb[_0x7f2a('0x2c')][_0x7f2a('0x81')]},'raw':!![]})[_0x7f2a('0x15')](function(_0x39d891){if(!_0x39d891||_0x39d891[_0x7f2a('0x83')]!=0x0)return _0x4ce5f3;return db['UserProfileResource'][_0x7f2a('0x7b')]({'name':_0x4ce5f3['name'],'resourceId':_0x4ce5f3['id'],'type':_0x39d891['name'],'sectionId':_0x39d891['id']},{})[_0x7f2a('0x15')](function(){return _0x4ce5f3;});})[_0x7f2a('0x1e')](function(_0x594ddb){logger[_0x7f2a('0x1a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x594ddb);throw _0x594ddb;});})[_0x7f2a('0x15')](respondWithResult(_0x74dbc8,0xc9))['catch'](handleError(_0x74dbc8,null));};exports[_0x7f2a('0x84')]=function(_0x441912,_0x14bacb){var _0x4f3ba2=_0x441912['body'];var _0x51a59c=[];if(_0x441912[_0x7f2a('0x2c')]['role']==='agent')throw new Error(_0x7f2a('0x7c'));if(_[_0x7f2a('0x85')](_0x4f3ba2,[_0x7f2a('0x27'),_0x7f2a('0x2c')])&&_0x441912[_0x7f2a('0x2c')][_0x7f2a('0x27')]!=='admin'){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_[_0x7f2a('0x85')](_0x4f3ba2,[_0x7f2a('0x27'),_0x7f2a('0x7d')])&&_0x441912[_0x7f2a('0x2c')][_0x7f2a('0x27')]!==_0x7f2a('0x7d')){throw new Error(_0x7f2a('0x86'));}return licenseUtil['checkUserLimits'](_0x4f3ba2)[_0x7f2a('0x15')](function(){return validateUser(_0x4f3ba2[0x0]);})[_0x7f2a('0x15')](function(){for(var _0x189522=0x1;_0x189522<_0x4f3ba2[_0x7f2a('0x46')];_0x189522++){var _0x4441ef=_0x4f3ba2[_0x189522-0x1][_0x7f2a('0x5f')];if(!_0x4f3ba2[_0x189522][_0x7f2a('0x5f')])_0x4f3ba2[_0x189522]['internal']=_0x4441ef+0x1;_0x51a59c[_0x7f2a('0x43')](validateUser(_0x4f3ba2[_0x189522]));}return Promise[_0x7f2a('0x4c')](_0x51a59c);})[_0x7f2a('0x15')](function(){_0x51a59c=[];for(var _0x540674=0x0;_0x540674<_0x4f3ba2[_0x7f2a('0x46')];_0x540674++){_0x51a59c['push'](updateUser(_0x4f3ba2[_0x540674]));}return Promise[_0x7f2a('0x4c')](_0x51a59c);})['then'](function(){_0x51a59c=_0x4f3ba2['map'](function(_0x2da589){return db[_0x7f2a('0x37')][_0x7f2a('0x7b')](_0x2da589,{'include':[{'model':db[_0x7f2a('0x6a')],'as':_0x7f2a('0x6a')}]})[_0x7f2a('0x15')](function(_0xf68984){_0x2da589['id']=_0xf68984['id'];return _0x2da589;});});return Promise[_0x7f2a('0x4c')](_0x51a59c);})['then'](function(_0x225b07){if(_0x441912[_0x7f2a('0x5b')][_0x7f2a('0x27')]===_0x7f2a('0x2c'))return _0x225b07;if(_0x441912[_0x7f2a('0x2c')][_0x7f2a('0x27')]!==_0x7f2a('0x2c'))return _0x225b07;var _0x32226f=_[_0x7f2a('0x85')](_0x225b07,function(_0x57c090){return _0x57c090['role']==='agent'||_0x57c090[_0x7f2a('0x27')]===_0x7f2a('0x87');});if(!_0x32226f)return _0x225b07;return db['UserProfileSection'][_0x7f2a('0x44')]({'where':{'name':{'$or':[_0x7f2a('0x88'),_0x7f2a('0x2e')]},'userProfileId':_0x441912[_0x7f2a('0x2c')][_0x7f2a('0x81')]},'raw':!![]})[_0x7f2a('0x15')](function(_0x4a6fa3){if(_['isEmpty'](_0x4a6fa3)||!_[_0x7f2a('0x85')](_0x4a6fa3,[_0x7f2a('0x83'),0x0]))return _0x225b07;_0x51a59c=[];var _0x3053cb=_(_0x4a6fa3)[_0x7f2a('0x89')](function(_0x3fe276){if(_0x3fe276[_0x7f2a('0x83')]===0x1)return;return _0x3fe276[_0x7f2a('0x33')]===_0x7f2a('0x88')?_0x7f2a('0x2d'):_0x7f2a('0x87');})[_0x7f2a('0x8a')]()[_0x7f2a('0x32')]();for(var _0x1d1384=0x0;_0x1d1384<_0x225b07[_0x7f2a('0x46')];_0x1d1384++){if(!_['includes'](_0x3053cb,_0x225b07[_0x1d1384][_0x7f2a('0x27')]))return;var _0x2ee66f=_0x225b07[_0x1d1384][_0x7f2a('0x27')]===_0x7f2a('0x2d')?_0x7f2a('0x88'):_0x7f2a('0x2e');_0x51a59c[_0x7f2a('0x43')](db['UserProfileResource']['create']({'name':_0x225b07[_0x1d1384][_0x7f2a('0x33')],'resourceId':_0x225b07[_0x1d1384]['id'],'type':_0x2ee66f,'sectionId':_[_0x7f2a('0x31')](_0x4a6fa3,['name',_0x2ee66f])['id']},{}));}return Promise['all'](_0x51a59c);});})[_0x7f2a('0x15')](respondWithResult(_0x14bacb,0xc9))[_0x7f2a('0x1e')](handleError(_0x14bacb,null));};exports[_0x7f2a('0x8b')]=function(_0x5e1000,_0x53d871){if(_0x5e1000[_0x7f2a('0x5b')]['id']){delete _0x5e1000[_0x7f2a('0x5b')]['id'];}return db['User'][_0x7f2a('0x31')]({'where':{'id':_0x5e1000['params']['id']}})['then'](function(_0xb81d08){if(!_0xb81d08)return null;if(_0xb81d08['id']===_0x5e1000['user']['id']){if(!_0x5e1000[_0x7f2a('0x5b')][_0x7f2a('0x8c')]||!_0x5e1000[_0x7f2a('0x5b')][_0x7f2a('0x8d')]){throw new db[(_0x7f2a('0x8e'))][(_0x7f2a('0x8f'))](_0x7f2a('0x90'));}if(!_0xb81d08[_0x7f2a('0x91')](_0x5e1000[_0x7f2a('0x5b')][_0x7f2a('0x8c')])){throw new db[(_0x7f2a('0x8e'))][(_0x7f2a('0x8f'))](_0x7f2a('0x92'));}if(_0x5e1000[_0x7f2a('0x5b')][_0x7f2a('0x8c')]===_0x5e1000['body']['newPassword']){throw new db[(_0x7f2a('0x8e'))][(_0x7f2a('0x8f'))](_0x7f2a('0x93'));}}else if(_0x5e1000[_0x7f2a('0x2c')][_0x7f2a('0x27')]==='admin'){if(!_0x5e1000['body'][_0x7f2a('0x8d')]){throw new db[(_0x7f2a('0x8e'))]['ValidationError'](_0x7f2a('0x94'));}}else if(_0x5e1000[_0x7f2a('0x2c')][_0x7f2a('0x27')]===_0x7f2a('0x2c')){if(!_0x5e1000[_0x7f2a('0x5b')]['newPassword']){throw new db[(_0x7f2a('0x8e'))]['ValidationError'](_0x7f2a('0x94'));}if(_0xb81d08[_0x7f2a('0x27')]!=='agent'){throw new db[(_0x7f2a('0x8e'))][(_0x7f2a('0x8f'))](_0x7f2a('0x7c'));}}else{throw new db[(_0x7f2a('0x8e'))][(_0x7f2a('0x8f'))](_0x7f2a('0x7c'));}return _0xb81d08;})[_0x7f2a('0x15')](handleEntityNotFound(_0x53d871,null))['then'](function(_0x407b35){return db[_0x7f2a('0x60')][_0x7f2a('0x95')]({'attributes':['id',_0x7f2a('0x62'),_0x7f2a('0x96'),'passwordHistoryLimit']})[_0x7f2a('0x15')](function(_0x24810e){if(_0x24810e['securePassword'])authService['validatePasswordPattern'](_0x5e1000[_0x7f2a('0x5b')][_0x7f2a('0x8d')]);if(!_0x24810e[_0x7f2a('0x96')]||!_0x407b35[_0x7f2a('0x97')])return _0x407b35;authService[_0x7f2a('0x98')](_0x5e1000[_0x7f2a('0x5b')][_0x7f2a('0x8d')],_0x407b35[_0x7f2a('0x97')],_0x24810e[_0x7f2a('0x99')]);return _0x407b35;})[_0x7f2a('0x15')](saveUpdates({'password':_0x5e1000[_0x7f2a('0x5b')]['newPassword'],'passwordResetAt':_0x5e1000['user']['id']==_0x5e1000['params']['id']?moment():null,'previousPasswords':authService[_0x7f2a('0x9a')](_0x5e1000[_0x7f2a('0x5b')][_0x7f2a('0x8d')],_0x407b35[_0x7f2a('0x97')])},null));})[_0x7f2a('0x15')](respondWithResult(_0x53d871,null))[_0x7f2a('0x1e')](handleError(_0x53d871,null));};exports[_0x7f2a('0x9b')]=function(_0x287aee,_0x2ec269){var _0x2b0db7=_0x287aee[_0x7f2a('0x5b')]['channel'];return db[_0x7f2a('0x37')]['find']({'where':{'id':_0x287aee[_0x7f2a('0x4e')]['id']},'attributes':['id',_0x7f2a('0x33'),_0x7f2a('0x27'),_0x7f2a('0x9c'),'loginInPause',_0x7f2a('0x9d'),'interface']})[_0x7f2a('0x15')](handleEntityNotFound(_0x2ec269,null))[_0x7f2a('0x15')](function(_0x2f1e63){if(_0x2f1e63){if(!utils[_0x7f2a('0x9e')](_0x2b0db7)){throw new db['Sequelize']['ValidationError'](_0x7f2a('0x9f'));}return _0x2f1e63[_0x7f2a('0xa0')+_['capitalize'](_0x2b0db7['toLowerCase']())+_0x7f2a('0xa1')](_0x287aee[_0x7f2a('0x5b')]['ids'],{'penalty':_0x287aee[_0x7f2a('0x5b')][_0x7f2a('0xa2')]||0x0})[_0x7f2a('0xa3')](function(_0x40476b){for(var _0x5a9ef4=0x0;_0x5a9ef4<_0x287aee[_0x7f2a('0x5b')][_0x7f2a('0x5e')]['length'];_0x5a9ef4+=0x1){var _0x23d6c3={'UserId':Number(_0x287aee['params']['id'])};_0x23d6c3[_[_0x7f2a('0xa4')](_0x2b0db7[_0x7f2a('0xa5')]())+_0x7f2a('0xa6')]=Number(_0x287aee[_0x7f2a('0x5b')]['ids'][_0x5a9ef4]);socket[_0x7f2a('0x28')]('user'+_['capitalize'](_0x2b0db7[_0x7f2a('0xa5')]())+_0x7f2a('0xa7'),_0x23d6c3);}return _0x40476b;})[_0x7f2a('0x15')](function(){if(_0x2b0db7===_0x7f2a('0xa8')){return db['VoiceQueue'][_0x7f2a('0x44')]({'where':{'id':_0x287aee['body'][_0x7f2a('0x5e')]||[]},'raw':!![],'attributes':['id','name']});}})['then'](function(_0x110a56){var _0x3bd20a=_0x2f1e63[_0x7f2a('0xa9')]({'plain':!![]});var _0x1ceffe=[];if(_0x2b0db7==='voice'&&_0x3bd20a['role']==='agent'&&_0x3bd20a[_0x7f2a('0x9c')]){for(let _0x15867c=0x0;_0x15867c<_0x110a56[_0x7f2a('0x46')];_0x15867c+=0x1){_0x1ceffe[_0x7f2a('0x43')]({'membername':_0x3bd20a[_0x7f2a('0x33')],'UserId':_0x3bd20a['id'],'queue_name':_0x110a56[_0x15867c][_0x7f2a('0x33')],'VoiceQueueId':_0x110a56[_0x15867c]['id'],'interface':_['isNil'](_0x3bd20a['interface'])?util[_0x7f2a('0xaa')](_0x7f2a('0xab'),_0x3bd20a[_0x7f2a('0x33')]):_0x3bd20a['interface'],'paused':_0x3bd20a[_0x7f2a('0x9d')]||![],'penalty':_0x287aee[_0x7f2a('0x5b')][_0x7f2a('0xa2')]||0x0});}return Promise[_0x7f2a('0x4c')](_0x1ceffe['map'](function(_0x4deaf4){return db[_0x7f2a('0xac')]['upsert'](_0x4deaf4);}));}return _0x2f1e63;});}})['then'](respondWithStatusCode(_0x2ec269,null))[_0x7f2a('0x1e')](handleError(_0x2ec269,null));};exports[_0x7f2a('0xad')]=function(_0x4e99c1,_0x1cf95b){var _0x4b9f65,_0x3b9984;return db['User']['find']({'where':{'id':_0x4e99c1[_0x7f2a('0x4e')]['id']},'attributes':['id',_0x7f2a('0x33'),_0x7f2a('0x27')]})[_0x7f2a('0x15')](handleEntityNotFound(_0x1cf95b,null))[_0x7f2a('0x15')](function(_0x3ca53c){if(_0x3ca53c){_0x4b9f65=_0x3ca53c;if(!_0x4e99c1[_0x7f2a('0x3e')][_0x7f2a('0xae')]||!utils[_0x7f2a('0x9e')](_0x4e99c1['query']['channel'])){throw new db[(_0x7f2a('0x8e'))][(_0x7f2a('0x8f'))]('Unknown\x20channel');}return _0x3ca53c[_0x7f2a('0xaf')+_[_0x7f2a('0xa4')](_0x4e99c1[_0x7f2a('0x3e')][_0x7f2a('0xae')][_0x7f2a('0xa5')]())+_0x7f2a('0xa1')](_0x4e99c1[_0x7f2a('0x3e')]['ids']);}})[_0x7f2a('0x15')](function(_0x524529){if(_[_0x7f2a('0xb0')](_0x4e99c1[_0x7f2a('0x3e')][_0x7f2a('0x5e')])){for(var _0x311b13=0x0;_0x311b13<_0x4e99c1[_0x7f2a('0x3e')][_0x7f2a('0x5e')]['length'];_0x311b13+=0x1){_0x3b9984={'UserId':Number(_0x4e99c1[_0x7f2a('0x4e')]['id'])};_0x3b9984[_[_0x7f2a('0xa4')](_0x4e99c1[_0x7f2a('0x3e')][_0x7f2a('0xae')][_0x7f2a('0xa5')]())+_0x7f2a('0xa6')]=Number(_0x4e99c1['query'][_0x7f2a('0x5e')][_0x311b13]);socket['emit'](_0x7f2a('0x2c')+_[_0x7f2a('0xa4')](_0x4e99c1[_0x7f2a('0x3e')][_0x7f2a('0xae')][_0x7f2a('0xa5')]())+'Queue:remove',_0x3b9984);}}else{_0x3b9984={'UserId':Number(_0x4e99c1[_0x7f2a('0x4e')]['id'])};_0x3b9984[_[_0x7f2a('0xa4')](_0x4e99c1['query'][_0x7f2a('0xae')][_0x7f2a('0xa5')]())+'QueueId']=Number(_0x4e99c1[_0x7f2a('0x3e')][_0x7f2a('0x5e')]);socket[_0x7f2a('0x28')]('user'+_['capitalize'](_0x4e99c1[_0x7f2a('0x3e')][_0x7f2a('0xae')][_0x7f2a('0xa5')]())+_0x7f2a('0xb1'),_0x3b9984);}return _0x524529;})[_0x7f2a('0x15')](function(){if(_0x4e99c1[_0x7f2a('0x3e')][_0x7f2a('0xae')]===_0x7f2a('0xa8')){return db['UserVoiceQueueRt']['destroy']({'where':{'UserId':_0x4e99c1[_0x7f2a('0x4e')]['id'],'VoiceQueueId':_0x4e99c1[_0x7f2a('0x3e')]['ids']},'individualHooks':!![]})[_0x7f2a('0x15')](function(){return _0x4b9f65;});}return _0x4b9f65;})[_0x7f2a('0x15')](respondWithStatusCode(_0x1cf95b,null))['catch'](handleError(_0x1cf95b,null));};exports[_0x7f2a('0xb2')]=function(_0xdbe8db,_0x4622bd){_0xdbe8db[_0x7f2a('0x5b')][_0x7f2a('0xb3')]=_0xdbe8db['file'][_0x7f2a('0xb4')];return db[_0x7f2a('0x37')][_0x7f2a('0x31')]({'where':{'id':_0xdbe8db[_0x7f2a('0x4e')]['id']}})[_0x7f2a('0x15')](handleEntityNotFound(_0x4622bd,null))['then'](saveUpdates(_0xdbe8db[_0x7f2a('0x5b')],null))[_0x7f2a('0x15')](respondWithResult(_0x4622bd,null))['catch'](handleError(_0x4622bd,null));};exports[_0x7f2a('0xb5')]=function(_0x45bb9f,_0x42d033){var _0xf6d28e=path[_0x7f2a('0xb6')](config[_0x7f2a('0xb7')],_0x7f2a('0xb8'));return db['User'][_0x7f2a('0x31')]({'where':{'id':_0x45bb9f[_0x7f2a('0x4e')]['id']},'attributes':['id',_0x7f2a('0xb3')],'raw':!![]})[_0x7f2a('0x15')](handleEntityNotFound(_0x42d033,null))['then'](function(_0x3aea0f){if(_0x3aea0f){if(_[_0x7f2a('0x64')](_0x3aea0f[_0x7f2a('0xb3')])){return _0x42d033[_0x7f2a('0xb9')](_0xf6d28e);}else{if(!fs['existsSync'](path[_0x7f2a('0xb6')](config[_0x7f2a('0xb7')],_0x7f2a('0xba'),_0x3aea0f[_0x7f2a('0xb3')]))){return _0x42d033['download'](_0xf6d28e);}return _0x42d033[_0x7f2a('0xb9')](path[_0x7f2a('0xb6')](config[_0x7f2a('0xb7')],_0x7f2a('0xba'),_0x3aea0f['userpic']));}}})[_0x7f2a('0x1e')](handleError(_0x42d033,null));};exports[_0x7f2a('0xbb')]=function(_0x140363,_0x1f3d38){return db['User'][_0x7f2a('0x31')]({'where':{'id':_0x140363[_0x7f2a('0x4e')]['id']},'attributes':['id']})[_0x7f2a('0x15')](handleEntityNotFound(_0x1f3d38,null))[_0x7f2a('0x15')](function(_0x418838){var _0x375838=[];values=_0x418838[_0x7f2a('0x47')];_0x375838[_0x7f2a('0x43')](get_open_tabs(_0x7f2a('0x58'),_0x418838[_0x7f2a('0x47')]));_0x375838[_0x7f2a('0x43')](get_open_tabs(_0x7f2a('0x48'),_0x418838[_0x7f2a('0x47')]));_0x375838[_0x7f2a('0x43')](get_open_tabs(_0x7f2a('0x4a'),_0x418838[_0x7f2a('0x47')]));_0x375838[_0x7f2a('0x43')](get_open_tabs(_0x7f2a('0x4b'),_0x418838[_0x7f2a('0x47')]));_0x375838['push'](get_open_tabs(_0x7f2a('0x49'),_0x418838[_0x7f2a('0x47')]));_0x375838[_0x7f2a('0x43')](get_open_tabs(_0x7f2a('0x59'),_0x418838['dataValues']));return Promise['all'](_0x375838);})[_0x7f2a('0x15')](function(_0x47c57d){if(_0x47c57d){var _0x186db9=_[_0x7f2a('0x89')](values[_0x7f2a('0xbc')],function(_0x49b62c){return{'channel':_0x7f2a('0xbd'),'id':_0x49b62c['id'],'createdAt':_0x49b62c[_0x7f2a('0xbe')]};});var _0x58823f=_[_0x7f2a('0x89')](values['FaxOpenTabs'],function(_0x158d8d){return{'channel':_0x7f2a('0xbf'),'id':_0x158d8d['id'],'createdAt':_0x158d8d[_0x7f2a('0xbe')]};});var _0x597a3c=_[_0x7f2a('0x89')](values[_0x7f2a('0xc0')],function(_0x20641b){return{'channel':_0x7f2a('0xc1'),'id':_0x20641b['id'],'createdAt':_0x20641b[_0x7f2a('0xbe')]};});var _0x274b3a=_[_0x7f2a('0x89')](values[_0x7f2a('0xc2')],function(_0x36d111){return{'channel':_0x7f2a('0xc3'),'id':_0x36d111['id'],'createdAt':_0x36d111[_0x7f2a('0xbe')]};});var _0x5d366e=_[_0x7f2a('0x89')](values[_0x7f2a('0xc4')],function(_0x3058d3){return{'channel':_0x7f2a('0xc5'),'id':_0x3058d3['id'],'createdAt':_0x3058d3['createdAt']};});var _0x1217be=_['map'](values[_0x7f2a('0xc6')],function(_0x332a4a){return{'channel':_0x7f2a('0xc7'),'id':_0x332a4a['id'],'createdAt':_0x332a4a['createdAt']};});var _0x3539b1=_['concat'](_0x186db9,_0x58823f,_0x597a3c,_0x274b3a,_0x5d366e,_0x1217be);var _0x4628ab={'count':_0x3539b1['length'],'rows':_0x3539b1};return _0x4628ab;}else return null;})[_0x7f2a('0x15')](respondWithResult(_0x1f3d38,null))['catch'](handleError(_0x1f3d38,null));};exports[_0x7f2a('0xc8')]=function(_0x5c8719,_0x248e69){var _0xf80641={};return db[_0x7f2a('0x37')]['findOne']({'where':{'id':_0x5c8719[_0x7f2a('0x4e')]['id']}})[_0x7f2a('0x15')](function(_0x5e3b9d){if(!_0x5e3b9d){throw new APINotFoundError(util[_0x7f2a('0xaa')](_0x7f2a('0xc9'),_0x5c8719['params']['id']));}return contacts[_0x7f2a('0x5c')]();})['then'](function(_0x5cee8e){_0x5c8719[_0x7f2a('0x3e')][_0x7f2a('0x37')]=_0x5c8719[_0x7f2a('0x4e')]['id'];_0xf80641=qs[_0x7f2a('0xca')](_0x5cee8e,_0x5c8719);if(_0x5c8719[_0x7f2a('0x3e')][_0x7f2a('0xcb')](_0x7f2a('0x3c'))){_0xf80641[_0x7f2a('0x3d')]=[{'model':db[_0x7f2a('0xcc')],'as':'List','required':![]},{'model':db[_0x7f2a('0xcd')],'as':_0x7f2a('0xce'),'attributes':['id',_0x7f2a('0x33'),_0x7f2a('0xcf')],'where':_0x5c8719[_0x7f2a('0x3e')][_0x7f2a('0xd0')]?{'id':_0x5c8719[_0x7f2a('0x3e')][_0x7f2a('0xd0')]}:undefined,'required':_0x5c8719[_0x7f2a('0x3e')][_0x7f2a('0xd0')]?!![]:![]}];}return contacts['findAll'](_0x5c8719[_0x7f2a('0x3e')],_0x5c8719[_0x7f2a('0x2c')],_0xf80641,_0x5cee8e);})[_0x7f2a('0x15')](respondWithFilteredResult(_0x248e69,_0xf80641))[_0x7f2a('0x1e')](APIHandleError(_0x248e69));};exports['getQueues']=function(_0x480079,_0x1eb372){var _0x132a8f;var _0x13f2f2={};var _0x439cb4;return db[_0x7f2a('0x37')][_0x7f2a('0x95')]({'where':{'id':_0x480079[_0x7f2a('0x4e')]['id']},'attributes':['id','name',_0x7f2a('0x27')]})['then'](handleEntityNotFound(_0x1eb372,null))['then'](function(_0x3a3010){if(!utils['isValidChannel'](_0x480079[_0x7f2a('0x3e')][_0x7f2a('0xae')])){throw new db['Sequelize'][(_0x7f2a('0x8f'))]('Unknown\x20channel');}_0x132a8f=_0x3a3010;var _0x2c1427={};_0x2c1427[_0x7f2a('0x54')]=_[_0x7f2a('0x4f')](db[_[_0x7f2a('0xa4')](_0x480079[_0x7f2a('0x3e')]['channel'])+_0x7f2a('0xd1')][_0x7f2a('0x38')]);_0x2c1427['query']=_[_0x7f2a('0x4f')](_0x480079[_0x7f2a('0x3e')]);_0x2c1427[_0x7f2a('0x52')]=_['intersection'](_0x2c1427[_0x7f2a('0x54')],_0x2c1427[_0x7f2a('0x3e')]);_0x13f2f2[_0x7f2a('0x42')]=_['intersection'](_0x2c1427[_0x7f2a('0x54')],qs[_0x7f2a('0x55')](_0x480079['query'][_0x7f2a('0x55')]));_0x13f2f2[_0x7f2a('0x42')]=_0x13f2f2['attributes'][_0x7f2a('0x46')]?_0x13f2f2[_0x7f2a('0x42')]:_0x2c1427[_0x7f2a('0x54')];_0x13f2f2[_0x7f2a('0xd2')]=qs[_0x7f2a('0xd3')](_0x480079[_0x7f2a('0x3e')]['sort']);_0x13f2f2['where']=qs[_0x7f2a('0x52')](_[_0x7f2a('0xd4')](_0x480079[_0x7f2a('0x3e')],_0x2c1427['filters']));if(_0x480079[_0x7f2a('0x3e')][_0x7f2a('0x2f')]){_0x13f2f2[_0x7f2a('0x3b')]=_[_0x7f2a('0x56')](_0x13f2f2[_0x7f2a('0x3b')],{'$or':_[_0x7f2a('0x89')](_0x13f2f2[_0x7f2a('0x42')],function(_0x4c042e){var _0x447bf8={};_0x447bf8[_0x4c042e]={'$like':'%'+_0x480079[_0x7f2a('0x3e')][_0x7f2a('0x2f')]+'%'};return _0x447bf8;})});}_0x13f2f2=_[_0x7f2a('0x56')]({},_0x13f2f2,_0x480079[_0x7f2a('0x57')]);switch(_0x132a8f[_0x7f2a('0x27')]){case _0x7f2a('0x7d'):return db[_[_0x7f2a('0xa4')](_0x480079[_0x7f2a('0x3e')][_0x7f2a('0xae')])+'Queue'][_0x7f2a('0x44')](_0x13f2f2);case _0x7f2a('0x2c'):case _0x7f2a('0x2d'):return _0x132a8f[_0x7f2a('0xa9')+_[_0x7f2a('0xa4')](_0x480079[_0x7f2a('0x3e')]['channel'])+'Queues'](_0x13f2f2);default:throw new db[(_0x7f2a('0x8e'))][(_0x7f2a('0x8f'))](_0x7f2a('0xd5'));}})[_0x7f2a('0x15')](function(_0x2ce4e4){_0x439cb4=_0x2ce4e4[_0x7f2a('0x46')];if(!_0x480079[_0x7f2a('0x3e')]['hasOwnProperty']('nolimit')){_0x13f2f2[_0x7f2a('0x24')]=qs[_0x7f2a('0x24')](_0x480079[_0x7f2a('0x3e')]['limit']);_0x13f2f2['offset']=qs[_0x7f2a('0x22')](_0x480079['query'][_0x7f2a('0x22')]);}switch(_0x132a8f[_0x7f2a('0x27')]){case _0x7f2a('0x7d'):return db[_['capitalize'](_0x480079['query'][_0x7f2a('0xae')])+'Queue'][_0x7f2a('0x44')](_0x13f2f2);case _0x7f2a('0x2c'):case _0x7f2a('0x2d'):return _0x132a8f[_0x7f2a('0xa9')+_[_0x7f2a('0xa4')](_0x480079['query'][_0x7f2a('0xae')])+_0x7f2a('0xa1')](_0x13f2f2);}})[_0x7f2a('0x15')](function(_0x30ce42){return{'count':_0x439cb4,'rows':_0x30ce42};})[_0x7f2a('0x15')](respondWithResult(_0x1eb372,null))[_0x7f2a('0x1e')](handleError(_0x1eb372,null));};exports[_0x7f2a('0xd6')]=function(_0x58f232,_0x50b8b9){var _0x18b0dd={};var _0x286d1c={};var _0x457039;var _0x41d2c0;return db['User'][_0x7f2a('0x95')]({'where':{'id':_0x58f232[_0x7f2a('0x4e')]['id']}})[_0x7f2a('0x15')](handleEntityNotFound(_0x50b8b9,null))['then'](function(_0xe24c7f){if(_0xe24c7f){_0x457039=_0xe24c7f;_0x286d1c[_0x7f2a('0x54')]=_['keys'](db['UserVoiceQueueRt'][_0x7f2a('0x38')]);_0x286d1c['query']=_['keys'](_0x58f232[_0x7f2a('0x3e')]);_0x286d1c['filters']=_[_0x7f2a('0x53')](_0x286d1c[_0x7f2a('0x54')],_0x286d1c[_0x7f2a('0x3e')]);_0x18b0dd['attributes']=_[_0x7f2a('0x53')](_0x286d1c[_0x7f2a('0x54')],qs[_0x7f2a('0x55')](_0x58f232[_0x7f2a('0x3e')][_0x7f2a('0x55')]));_0x18b0dd[_0x7f2a('0x42')]=_0x18b0dd[_0x7f2a('0x42')]['length']?_0x18b0dd[_0x7f2a('0x42')]:_0x286d1c[_0x7f2a('0x54')];_0x18b0dd['order']=qs['sort'](_0x58f232[_0x7f2a('0x3e')][_0x7f2a('0xd3')]);_0x18b0dd[_0x7f2a('0x3b')]=qs[_0x7f2a('0x52')](_['pick'](_0x58f232[_0x7f2a('0x3e')],_0x286d1c[_0x7f2a('0x52')]));if(_0x58f232[_0x7f2a('0x3e')][_0x7f2a('0x2f')]){_0x18b0dd['where']=_['merge'](_0x18b0dd['where'],{'$or':_['map'](_0x18b0dd['attributes'],function(_0x41372e){var _0x168808={};_0x168808[_0x41372e]={'$like':'%'+_0x58f232[_0x7f2a('0x3e')][_0x7f2a('0x2f')]+'%'};return _0x168808;})});}_0x18b0dd=_['merge']({},_0x18b0dd,_0x58f232[_0x7f2a('0x57')]);return _0x457039['getVoiceQueuesRt'](_0x18b0dd);}})['then'](function(_0x1fb2db){if(_0x1fb2db){_0x41d2c0=_0x1fb2db[_0x7f2a('0x46')];if(!_0x58f232[_0x7f2a('0x3e')][_0x7f2a('0xcb')](_0x7f2a('0xd7'))){_0x18b0dd[_0x7f2a('0x24')]=qs[_0x7f2a('0x24')](_0x58f232[_0x7f2a('0x3e')]['limit']);_0x18b0dd[_0x7f2a('0x22')]=qs[_0x7f2a('0x22')](_0x58f232[_0x7f2a('0x3e')][_0x7f2a('0x22')]);}return _0x457039[_0x7f2a('0xd6')](_0x18b0dd);}})[_0x7f2a('0x15')](function(_0x2c3ae9){if(_0x2c3ae9){return _0x2c3ae9?{'count':_0x41d2c0,'rows':_0x2c3ae9}:null;}})[_0x7f2a('0x15')](respondWithResult(_0x50b8b9,null))[_0x7f2a('0x1e')](handleError(_0x50b8b9,null));};exports[_0x7f2a('0xd8')]=function(_0x50c7ee,_0x1d7d5b){var _0x4d3f10={};var _0x3fa58c={};var _0x5dae2d;var _0xa03868;return db[_0x7f2a('0x37')][_0x7f2a('0x95')]({'where':{'id':_0x50c7ee[_0x7f2a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x1d7d5b,null))['then'](function(_0x516743){if(_0x516743){_0x5dae2d=_0x516743;_0x3fa58c['model']=_[_0x7f2a('0x4f')](db[_0x7f2a('0xd9')][_0x7f2a('0x38')]);_0x3fa58c['query']=_[_0x7f2a('0x4f')](_0x50c7ee['query']);_0x3fa58c[_0x7f2a('0x52')]=_[_0x7f2a('0x53')](_0x3fa58c[_0x7f2a('0x54')],_0x3fa58c[_0x7f2a('0x3e')]);_0x4d3f10[_0x7f2a('0x42')]=_[_0x7f2a('0x53')](_0x3fa58c[_0x7f2a('0x54')],qs[_0x7f2a('0x55')](_0x50c7ee['query'][_0x7f2a('0x55')]));_0x4d3f10[_0x7f2a('0x42')]=_0x4d3f10[_0x7f2a('0x42')]['length']?_0x4d3f10[_0x7f2a('0x42')]:_0x3fa58c[_0x7f2a('0x54')];_0x4d3f10[_0x7f2a('0xd2')]=qs[_0x7f2a('0xd3')](_0x50c7ee[_0x7f2a('0x3e')]['sort']);_0x4d3f10[_0x7f2a('0x3b')]=qs[_0x7f2a('0x52')](_['pick'](_0x50c7ee[_0x7f2a('0x3e')],_0x3fa58c['filters']));if(_0x50c7ee['query'][_0x7f2a('0x2f')]){_0x4d3f10['where']=_[_0x7f2a('0x56')](_0x4d3f10['where'],{'$or':_[_0x7f2a('0x89')](_0x4d3f10['attributes'],function(_0x39a4c7){var _0x1c7815={};_0x1c7815[_0x39a4c7]={'$like':'%'+_0x50c7ee[_0x7f2a('0x3e')]['filter']+'%'};return _0x1c7815;})});}_0x4d3f10=_[_0x7f2a('0x56')]({},_0x4d3f10,_0x50c7ee['options']);return _0x5dae2d[_0x7f2a('0xd8')](_0x4d3f10);}})[_0x7f2a('0x15')](function(_0x2a81fd){if(_0x2a81fd){_0xa03868=_0x2a81fd[_0x7f2a('0x46')];if(!_0x50c7ee[_0x7f2a('0x3e')][_0x7f2a('0xcb')]('nolimit')){_0x4d3f10['limit']=qs['limit'](_0x50c7ee[_0x7f2a('0x3e')][_0x7f2a('0x24')]);_0x4d3f10[_0x7f2a('0x22')]=qs[_0x7f2a('0x22')](_0x50c7ee[_0x7f2a('0x3e')][_0x7f2a('0x22')]);}return _0x5dae2d['getGroups'](_0x4d3f10);}})[_0x7f2a('0x15')](function(_0x3b06f8){if(_0x3b06f8){return _0x3b06f8?{'count':_0xa03868,'rows':_0x3b06f8}:null;}})['then'](respondWithResult(_0x1d7d5b,null))['catch'](handleError(_0x1d7d5b,null));};exports[_0x7f2a('0xda')]=function(_0x4324e5,_0x3cdcf2){var _0x4df6c2={'raw':!![],'where':{}};var _0x276923={};var _0x412aa7={'count':0x0,'rows':[]};return db[_0x7f2a('0x37')]['findOne']({'where':{'id':_0x4324e5[_0x7f2a('0x4e')]['id']}})[_0x7f2a('0x15')](handleEntityNotFound(_0x3cdcf2,null))[_0x7f2a('0x15')](function(_0xa5f3bd){if(_0xa5f3bd){_0x276923[_0x7f2a('0x54')]=_[_0x7f2a('0x4f')](db[_0x7f2a('0xdb')][_0x7f2a('0x38')]);_0x276923[_0x7f2a('0x3e')]=_['keys'](_0x4324e5['query']);_0x276923[_0x7f2a('0x52')]=_['intersection'](_0x276923['model'],_0x276923[_0x7f2a('0x3e')]);_0x4df6c2[_0x7f2a('0x42')]=_[_0x7f2a('0x53')](_0x276923['model'],qs[_0x7f2a('0x55')](_0x4324e5[_0x7f2a('0x3e')]['fields']));_0x4df6c2[_0x7f2a('0x42')]=_0x4df6c2[_0x7f2a('0x42')][_0x7f2a('0x46')]?_0x4df6c2[_0x7f2a('0x42')]:_0x276923[_0x7f2a('0x54')];if(!_0x4324e5['query'][_0x7f2a('0xcb')]('nolimit')){_0x4df6c2['limit']=qs[_0x7f2a('0x24')](_0x4324e5['query']['limit']);_0x4df6c2[_0x7f2a('0x22')]=qs[_0x7f2a('0x22')](_0x4324e5[_0x7f2a('0x3e')]['offset']);}_0x4df6c2['order']=qs[_0x7f2a('0xd3')](_0x4324e5['query'][_0x7f2a('0xd3')]);_0x4df6c2[_0x7f2a('0x3b')]=qs[_0x7f2a('0x52')](_[_0x7f2a('0xd4')](_0x4324e5[_0x7f2a('0x3e')],_0x276923['filters']));_0x4df6c2[_0x7f2a('0x3b')][_0x7f2a('0xdc')]=_0xa5f3bd['id'];if(_0x4324e5[_0x7f2a('0x3e')][_0x7f2a('0x2f')]){_0x4df6c2['where']=_[_0x7f2a('0x56')](_0x4df6c2[_0x7f2a('0x3b')],{'$or':_[_0x7f2a('0x89')](_0x4df6c2['attributes'],function(_0x3f6e1a){var _0x148111={};_0x148111[_0x3f6e1a]={'$like':'%'+_0x4324e5['query'][_0x7f2a('0x2f')]+'%'};return _0x148111;})});}_0x4df6c2=_[_0x7f2a('0x56')]({},_0x4df6c2,_0x4324e5[_0x7f2a('0x57')]);return db[_0x7f2a('0xdb')][_0x7f2a('0x25')]({'where':_0x4df6c2[_0x7f2a('0x3b')]})[_0x7f2a('0x15')](function(_0x3c20c1){_0x412aa7[_0x7f2a('0x25')]=_0x3c20c1;if(_0x4324e5[_0x7f2a('0x3e')][_0x7f2a('0x3c')]){_0x4df6c2[_0x7f2a('0x3d')]=[{'all':!![]}];}return db[_0x7f2a('0xdb')]['findAll'](_0x4df6c2);})[_0x7f2a('0x15')](function(_0x7db45d){_0x412aa7[_0x7f2a('0x45')]=_0x7db45d;return _0x412aa7;});}})['then'](respondWithFilteredResult(_0x3cdcf2,_0x4df6c2))[_0x7f2a('0x1e')](handleError(_0x3cdcf2,null));};exports[_0x7f2a('0xdd')]=function(_0x34565d,_0x3c163d){var _0x41c6fd={'raw':!![],'where':{}};var _0x48edd7={};var _0x381843={'count':0x0,'rows':[]};return db['User'][_0x7f2a('0x95')]({'where':{'id':_0x34565d['params']['id']}})['then'](handleEntityNotFound(_0x3c163d,null))['then'](function(_0x21b9a3){if(_0x21b9a3){_0x48edd7[_0x7f2a('0x54')]=_[_0x7f2a('0x4f')](db[_0x7f2a('0xde')][_0x7f2a('0x38')]);_0x48edd7[_0x7f2a('0x3e')]=_[_0x7f2a('0x4f')](_0x34565d['query']);_0x48edd7['filters']=_[_0x7f2a('0x53')](_0x48edd7[_0x7f2a('0x54')],_0x48edd7['query']);_0x41c6fd['attributes']=_[_0x7f2a('0x53')](_0x48edd7[_0x7f2a('0x54')],qs[_0x7f2a('0x55')](_0x34565d[_0x7f2a('0x3e')][_0x7f2a('0x55')]));_0x41c6fd[_0x7f2a('0x42')]=_0x41c6fd[_0x7f2a('0x42')][_0x7f2a('0x46')]?_0x41c6fd[_0x7f2a('0x42')]:_0x48edd7['model'];if(!_0x34565d['query'][_0x7f2a('0xcb')](_0x7f2a('0xd7'))){_0x41c6fd['limit']=qs[_0x7f2a('0x24')](_0x34565d[_0x7f2a('0x3e')][_0x7f2a('0x24')]);_0x41c6fd[_0x7f2a('0x22')]=qs[_0x7f2a('0x22')](_0x34565d[_0x7f2a('0x3e')][_0x7f2a('0x22')]);}_0x41c6fd[_0x7f2a('0xd2')]=qs['sort'](_0x34565d[_0x7f2a('0x3e')][_0x7f2a('0xd3')]);_0x41c6fd[_0x7f2a('0x3b')]=qs[_0x7f2a('0x52')](_['pick'](_0x34565d['query'],_0x48edd7['filters']));_0x41c6fd[_0x7f2a('0x3b')][_0x7f2a('0xdc')]=_0x21b9a3['id'];if(_0x34565d[_0x7f2a('0x3e')][_0x7f2a('0x2f')]){_0x41c6fd[_0x7f2a('0x3b')]=_[_0x7f2a('0x56')](_0x41c6fd['where'],{'$or':_[_0x7f2a('0x89')](_0x41c6fd['attributes'],function(_0x440876){var _0x4f6845={};_0x4f6845[_0x440876]={'$like':'%'+_0x34565d[_0x7f2a('0x3e')][_0x7f2a('0x2f')]+'%'};return _0x4f6845;})});}_0x41c6fd=_[_0x7f2a('0x56')]({},_0x41c6fd,_0x34565d['options']);return db['ScreenRecording']['count']({'where':_0x41c6fd[_0x7f2a('0x3b')]})[_0x7f2a('0x15')](function(_0x197505){_0x381843[_0x7f2a('0x25')]=_0x197505;if(_0x34565d['query'][_0x7f2a('0x3c')]){_0x41c6fd['include']=[{'all':!![]}];}return db['ScreenRecording'][_0x7f2a('0x44')](_0x41c6fd);})['then'](function(_0x5dc69d){_0x381843[_0x7f2a('0x45')]=_0x5dc69d;return _0x381843;});}})[_0x7f2a('0x15')](respondWithFilteredResult(_0x3c163d,_0x41c6fd))[_0x7f2a('0x1e')](handleError(_0x3c163d,null));};exports[_0x7f2a('0xdf')]=function(_0x288aba,_0x29ad14){var _0x57d367={};var _0x282ce3={};var _0x22476b;var _0x4233ae;return db['User'][_0x7f2a('0x95')]({'where':{'id':_0x288aba[_0x7f2a('0x4e')]['id']}})[_0x7f2a('0x15')](handleEntityNotFound(_0x29ad14,null))['then'](function(_0xb4bb54){if(_0xb4bb54){_0x22476b=_0xb4bb54;_0x282ce3['model']=_[_0x7f2a('0x4f')](db[_0x7f2a('0xe0')]['rawAttributes']);_0x282ce3[_0x7f2a('0x3e')]=_[_0x7f2a('0x4f')](_0x288aba[_0x7f2a('0x3e')]);_0x282ce3[_0x7f2a('0x52')]=_[_0x7f2a('0x53')](_0x282ce3[_0x7f2a('0x54')],_0x282ce3['query']);_0x57d367[_0x7f2a('0x42')]=_[_0x7f2a('0x53')](_0x282ce3['model'],qs[_0x7f2a('0x55')](_0x288aba[_0x7f2a('0x3e')][_0x7f2a('0x55')]));_0x57d367[_0x7f2a('0x42')]=_0x57d367['attributes'][_0x7f2a('0x46')]?_0x57d367['attributes']:_0x282ce3['model'];_0x57d367[_0x7f2a('0xd2')]=qs[_0x7f2a('0xd3')](_0x288aba[_0x7f2a('0x3e')]['sort']);_0x57d367[_0x7f2a('0x3b')]=qs[_0x7f2a('0x52')](_[_0x7f2a('0xd4')](_0x288aba[_0x7f2a('0x3e')],_0x282ce3['filters']));if(_0x288aba[_0x7f2a('0x3e')][_0x7f2a('0x2f')]){_0x57d367['where']=_[_0x7f2a('0x56')](_0x57d367[_0x7f2a('0x3b')],{'$or':_[_0x7f2a('0x89')](_0x57d367[_0x7f2a('0x42')],function(_0x3eca88){var _0x1b5254={};_0x1b5254[_0x3eca88]={'$like':'%'+_0x288aba[_0x7f2a('0x3e')]['filter']+'%'};return _0x1b5254;})});}_0x57d367=_[_0x7f2a('0x56')]({},_0x57d367,_0x288aba[_0x7f2a('0x57')]);return _0x22476b[_0x7f2a('0xdf')](_0x57d367);}})['then'](function(_0x2fae87){if(_0x2fae87){_0x4233ae=_0x2fae87['length'];if(!_0x288aba[_0x7f2a('0x3e')][_0x7f2a('0xcb')](_0x7f2a('0xd7'))){_0x57d367[_0x7f2a('0x24')]=qs['limit'](_0x288aba[_0x7f2a('0x3e')]['limit']);_0x57d367[_0x7f2a('0x22')]=qs[_0x7f2a('0x22')](_0x288aba[_0x7f2a('0x3e')][_0x7f2a('0x22')]);}return _0x22476b['getChatInteractions'](_0x57d367);}})[_0x7f2a('0x15')](function(_0x3b17b9){if(_0x3b17b9){return _0x3b17b9?{'count':_0x4233ae,'rows':_0x3b17b9}:null;}})['then'](respondWithResult(_0x29ad14,null))['catch'](handleError(_0x29ad14,null));};exports[_0x7f2a('0xe1')]=function(_0x483043,_0x283a11){var _0x529142={};var _0x42ef35={};var _0x2489e9;var _0x39a5b6;return db[_0x7f2a('0x37')]['findOne']({'where':{'id':_0x483043[_0x7f2a('0x4e')]['id']}})[_0x7f2a('0x15')](handleEntityNotFound(_0x283a11,null))[_0x7f2a('0x15')](function(_0x59d4c3){if(_0x59d4c3){_0x2489e9=_0x59d4c3;_0x42ef35[_0x7f2a('0x54')]=_[_0x7f2a('0x4f')](db[_0x7f2a('0xe2')][_0x7f2a('0x38')]);_0x42ef35[_0x7f2a('0x3e')]=_[_0x7f2a('0x4f')](_0x483043[_0x7f2a('0x3e')]);_0x42ef35[_0x7f2a('0x52')]=_[_0x7f2a('0x53')](_0x42ef35[_0x7f2a('0x54')],_0x42ef35[_0x7f2a('0x3e')]);_0x529142[_0x7f2a('0x42')]=_[_0x7f2a('0x53')](_0x42ef35[_0x7f2a('0x54')],qs[_0x7f2a('0x55')](_0x483043['query']['fields']));_0x529142['attributes']=_0x529142[_0x7f2a('0x42')][_0x7f2a('0x46')]?_0x529142[_0x7f2a('0x42')]:_0x42ef35[_0x7f2a('0x54')];_0x529142[_0x7f2a('0xd2')]=qs[_0x7f2a('0xd3')](_0x483043[_0x7f2a('0x3e')][_0x7f2a('0xd3')]);_0x529142['where']=qs[_0x7f2a('0x52')](_['pick'](_0x483043[_0x7f2a('0x3e')],_0x42ef35['filters']));if(_0x483043['query'][_0x7f2a('0x2f')]){_0x529142[_0x7f2a('0x3b')]=_[_0x7f2a('0x56')](_0x529142[_0x7f2a('0x3b')],{'$or':_[_0x7f2a('0x89')](_0x529142['attributes'],function(_0xd87ff4){var _0xa1cb90={};_0xa1cb90[_0xd87ff4]={'$like':'%'+_0x483043['query'][_0x7f2a('0x2f')]+'%'};return _0xa1cb90;})});}_0x529142=_[_0x7f2a('0x56')]({},_0x529142,_0x483043[_0x7f2a('0x57')]);return _0x2489e9[_0x7f2a('0xe1')](_0x529142);}})[_0x7f2a('0x15')](function(_0x101ed1){if(_0x101ed1){_0x39a5b6=_0x101ed1['length'];if(!_0x483043[_0x7f2a('0x3e')][_0x7f2a('0xcb')](_0x7f2a('0xd7'))){_0x529142[_0x7f2a('0x24')]=qs['limit'](_0x483043[_0x7f2a('0x3e')]['limit']);_0x529142[_0x7f2a('0x22')]=qs['offset'](_0x483043[_0x7f2a('0x3e')][_0x7f2a('0x22')]);}return _0x2489e9[_0x7f2a('0xe1')](_0x529142);}})[_0x7f2a('0x15')](function(_0x237c8e){if(_0x237c8e){return _0x237c8e?{'count':_0x39a5b6,'rows':_0x237c8e}:null;}})[_0x7f2a('0x15')](respondWithResult(_0x283a11,null))[_0x7f2a('0x1e')](handleError(_0x283a11,null));};exports[_0x7f2a('0xe3')]=function(_0x341bbc,_0x2812c1){var _0x4991c1={'raw':!![],'where':{}};var _0x43d636={};var _0x40d831={'count':0x0,'rows':[]};return db[_0x7f2a('0x37')]['findOne']({'where':{'id':_0x341bbc[_0x7f2a('0x4e')]['id']}})[_0x7f2a('0x15')](handleEntityNotFound(_0x2812c1,null))[_0x7f2a('0x15')](function(_0x1e8197){if(_0x1e8197){_0x43d636['model']=_[_0x7f2a('0x4f')](db[_0x7f2a('0xe4')][_0x7f2a('0x38')]);_0x43d636[_0x7f2a('0x3e')]=_[_0x7f2a('0x4f')](_0x341bbc['query']);_0x43d636[_0x7f2a('0x52')]=_['intersection'](_0x43d636[_0x7f2a('0x54')],_0x43d636['query']);_0x4991c1[_0x7f2a('0x42')]=_[_0x7f2a('0x53')](_0x43d636[_0x7f2a('0x54')],qs['fields'](_0x341bbc['query'][_0x7f2a('0x55')]));_0x4991c1['attributes']=_0x4991c1[_0x7f2a('0x42')][_0x7f2a('0x46')]?_0x4991c1[_0x7f2a('0x42')]:_0x43d636[_0x7f2a('0x54')];if(!_0x341bbc[_0x7f2a('0x3e')][_0x7f2a('0xcb')](_0x7f2a('0xd7'))){_0x4991c1[_0x7f2a('0x24')]=qs[_0x7f2a('0x24')](_0x341bbc['query'][_0x7f2a('0x24')]);_0x4991c1[_0x7f2a('0x22')]=qs[_0x7f2a('0x22')](_0x341bbc[_0x7f2a('0x3e')][_0x7f2a('0x22')]);}_0x4991c1['order']=qs[_0x7f2a('0xd3')](_0x341bbc[_0x7f2a('0x3e')]['sort']);_0x4991c1[_0x7f2a('0x3b')]=qs['filters'](_[_0x7f2a('0xd4')](_0x341bbc[_0x7f2a('0x3e')],_0x43d636[_0x7f2a('0x52')]));_0x4991c1[_0x7f2a('0x3b')][_0x7f2a('0xdc')]=_0x1e8197['id'];if(_0x341bbc[_0x7f2a('0x3e')]['filter']){_0x4991c1[_0x7f2a('0x3b')]=_['merge'](_0x4991c1[_0x7f2a('0x3b')],{'$or':_['map'](_0x4991c1[_0x7f2a('0x42')],function(_0x338025){var _0x40b96f={};_0x40b96f[_0x338025]={'$like':'%'+_0x341bbc[_0x7f2a('0x3e')][_0x7f2a('0x2f')]+'%'};return _0x40b96f;})});}_0x4991c1=_[_0x7f2a('0x56')]({},_0x4991c1,_0x341bbc[_0x7f2a('0x57')]);return db[_0x7f2a('0xe4')]['count']({'where':_0x4991c1[_0x7f2a('0x3b')]})[_0x7f2a('0x15')](function(_0x2ef207){_0x40d831['count']=_0x2ef207;if(_0x341bbc[_0x7f2a('0x3e')][_0x7f2a('0x3c')]){_0x4991c1['include']=[{'all':!![]}];}return db[_0x7f2a('0xe4')]['findAll'](_0x4991c1);})[_0x7f2a('0x15')](function(_0x45600d){_0x40d831[_0x7f2a('0x45')]=_0x45600d;return _0x40d831;});}})[_0x7f2a('0x15')](respondWithFilteredResult(_0x2812c1,_0x4991c1))[_0x7f2a('0x1e')](handleError(_0x2812c1,null));};exports[_0x7f2a('0xe5')]=function(_0x13c274,_0x193d04){var _0x5d4134={};var _0x1d1f1d={};var _0x6d4a2c;var _0x792bd7;return db['User'][_0x7f2a('0x95')]({'where':{'id':_0x13c274[_0x7f2a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x193d04,null))[_0x7f2a('0x15')](function(_0x3a904c){if(_0x3a904c){_0x6d4a2c=_0x3a904c;_0x1d1f1d[_0x7f2a('0x54')]=_[_0x7f2a('0x4f')](db['SmsInteraction'][_0x7f2a('0x38')]);_0x1d1f1d[_0x7f2a('0x3e')]=_[_0x7f2a('0x4f')](_0x13c274[_0x7f2a('0x3e')]);_0x1d1f1d[_0x7f2a('0x52')]=_[_0x7f2a('0x53')](_0x1d1f1d[_0x7f2a('0x54')],_0x1d1f1d['query']);_0x5d4134['attributes']=_[_0x7f2a('0x53')](_0x1d1f1d['model'],qs[_0x7f2a('0x55')](_0x13c274['query']['fields']));_0x5d4134['attributes']=_0x5d4134['attributes'][_0x7f2a('0x46')]?_0x5d4134[_0x7f2a('0x42')]:_0x1d1f1d[_0x7f2a('0x54')];_0x5d4134['order']=qs[_0x7f2a('0xd3')](_0x13c274[_0x7f2a('0x3e')][_0x7f2a('0xd3')]);_0x5d4134[_0x7f2a('0x3b')]=qs[_0x7f2a('0x52')](_['pick'](_0x13c274['query'],_0x1d1f1d['filters']));if(_0x13c274[_0x7f2a('0x3e')][_0x7f2a('0x2f')]){_0x5d4134[_0x7f2a('0x3b')]=_[_0x7f2a('0x56')](_0x5d4134[_0x7f2a('0x3b')],{'$or':_['map'](_0x5d4134[_0x7f2a('0x42')],function(_0x2f1c7d){var _0x470185={};_0x470185[_0x2f1c7d]={'$like':'%'+_0x13c274[_0x7f2a('0x3e')][_0x7f2a('0x2f')]+'%'};return _0x470185;})});}_0x5d4134=_[_0x7f2a('0x56')]({},_0x5d4134,_0x13c274['options']);return _0x6d4a2c[_0x7f2a('0xe5')](_0x5d4134);}})['then'](function(_0x397437){if(_0x397437){_0x792bd7=_0x397437[_0x7f2a('0x46')];if(!_0x13c274[_0x7f2a('0x3e')][_0x7f2a('0xcb')]('nolimit')){_0x5d4134['limit']=qs[_0x7f2a('0x24')](_0x13c274['query']['limit']);_0x5d4134[_0x7f2a('0x22')]=qs[_0x7f2a('0x22')](_0x13c274[_0x7f2a('0x3e')]['offset']);}return _0x6d4a2c[_0x7f2a('0xe5')](_0x5d4134);}})[_0x7f2a('0x15')](function(_0x2798d7){if(_0x2798d7){return _0x2798d7?{'count':_0x792bd7,'rows':_0x2798d7}:null;}})[_0x7f2a('0x15')](respondWithResult(_0x193d04,null))['catch'](handleError(_0x193d04,null));};exports[_0x7f2a('0xe6')]=function(_0x321cac,_0x4104da){var _0x5222d3={};var _0x24f038={};var _0x743efa;var _0x401155;return db[_0x7f2a('0x37')][_0x7f2a('0x95')]({'where':{'id':_0x321cac[_0x7f2a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x4104da,null))['then'](function(_0x1cc3a9){if(_0x1cc3a9){_0x743efa=_0x1cc3a9;_0x24f038[_0x7f2a('0x54')]=_[_0x7f2a('0x4f')](db[_0x7f2a('0xe7')][_0x7f2a('0x38')]);_0x24f038[_0x7f2a('0x3e')]=_[_0x7f2a('0x4f')](_0x321cac['query']);_0x24f038[_0x7f2a('0x52')]=_[_0x7f2a('0x53')](_0x24f038[_0x7f2a('0x54')],_0x24f038[_0x7f2a('0x3e')]);_0x5222d3[_0x7f2a('0x42')]=_[_0x7f2a('0x53')](_0x24f038[_0x7f2a('0x54')],qs[_0x7f2a('0x55')](_0x321cac[_0x7f2a('0x3e')][_0x7f2a('0x55')]));_0x5222d3[_0x7f2a('0x42')]=_0x5222d3[_0x7f2a('0x42')][_0x7f2a('0x46')]?_0x5222d3[_0x7f2a('0x42')]:_0x24f038[_0x7f2a('0x54')];_0x5222d3['order']=qs[_0x7f2a('0xd3')](_0x321cac[_0x7f2a('0x3e')]['sort']);_0x5222d3['where']=qs[_0x7f2a('0x52')](_[_0x7f2a('0xd4')](_0x321cac[_0x7f2a('0x3e')],_0x24f038[_0x7f2a('0x52')]));if(_0x321cac[_0x7f2a('0x3e')][_0x7f2a('0x2f')]){_0x5222d3[_0x7f2a('0x3b')]=_[_0x7f2a('0x56')](_0x5222d3[_0x7f2a('0x3b')],{'$or':_[_0x7f2a('0x89')](_0x5222d3[_0x7f2a('0x42')],function(_0x1a1a11){var _0x3b2004={};_0x3b2004[_0x1a1a11]={'$like':'%'+_0x321cac[_0x7f2a('0x3e')]['filter']+'%'};return _0x3b2004;})});}_0x5222d3=_['merge']({},_0x5222d3,_0x321cac['options']);return _0x743efa[_0x7f2a('0xe6')](_0x5222d3);}})[_0x7f2a('0x15')](function(_0x330bf3){if(_0x330bf3){_0x401155=_0x330bf3[_0x7f2a('0x46')];if(!_0x321cac['query'][_0x7f2a('0xcb')](_0x7f2a('0xd7'))){_0x5222d3[_0x7f2a('0x24')]=qs[_0x7f2a('0x24')](_0x321cac[_0x7f2a('0x3e')][_0x7f2a('0x24')]);_0x5222d3[_0x7f2a('0x22')]=qs[_0x7f2a('0x22')](_0x321cac[_0x7f2a('0x3e')][_0x7f2a('0x22')]);}return _0x743efa[_0x7f2a('0xe6')](_0x5222d3);}})[_0x7f2a('0x15')](function(_0x2ba4dd){if(_0x2ba4dd){return _0x2ba4dd?{'count':_0x401155,'rows':_0x2ba4dd}:null;}})[_0x7f2a('0x15')](respondWithResult(_0x4104da,null))[_0x7f2a('0x1e')](handleError(_0x4104da,null));};exports[_0x7f2a('0xe8')]=function(_0x4bc0df,_0x31d606){var _0x1f1ce8={};var _0x26a6e1={};var _0x3b6d48;var _0x2f7b41;return db[_0x7f2a('0x37')][_0x7f2a('0x95')]({'where':{'id':_0x4bc0df['params']['id']}})[_0x7f2a('0x15')](handleEntityNotFound(_0x31d606,null))[_0x7f2a('0x15')](function(_0x31e576){if(_0x31e576){_0x3b6d48=_0x31e576;_0x26a6e1[_0x7f2a('0x54')]=_[_0x7f2a('0x4f')](db[_0x7f2a('0xe9')]['rawAttributes']);_0x26a6e1[_0x7f2a('0x3e')]=_['keys'](_0x4bc0df[_0x7f2a('0x3e')]);_0x26a6e1[_0x7f2a('0x52')]=_[_0x7f2a('0x53')](_0x26a6e1['model'],_0x26a6e1[_0x7f2a('0x3e')]);_0x1f1ce8[_0x7f2a('0x42')]=_[_0x7f2a('0x53')](_0x26a6e1['model'],qs[_0x7f2a('0x55')](_0x4bc0df[_0x7f2a('0x3e')][_0x7f2a('0x55')]));_0x1f1ce8['attributes']=_0x1f1ce8['attributes'][_0x7f2a('0x46')]?_0x1f1ce8[_0x7f2a('0x42')]:_0x26a6e1[_0x7f2a('0x54')];_0x1f1ce8[_0x7f2a('0xd2')]=qs['sort'](_0x4bc0df[_0x7f2a('0x3e')]['sort']);_0x1f1ce8['where']=qs[_0x7f2a('0x52')](_['pick'](_0x4bc0df[_0x7f2a('0x3e')],_0x26a6e1[_0x7f2a('0x52')]));if(_0x4bc0df[_0x7f2a('0x3e')][_0x7f2a('0x2f')]){_0x1f1ce8[_0x7f2a('0x3b')]=_[_0x7f2a('0x56')](_0x1f1ce8[_0x7f2a('0x3b')],{'$or':_['map'](_0x1f1ce8[_0x7f2a('0x42')],function(_0x1f1164){var _0x438394={};_0x438394[_0x1f1164]={'$like':'%'+_0x4bc0df[_0x7f2a('0x3e')][_0x7f2a('0x2f')]+'%'};return _0x438394;})});}_0x1f1ce8=_[_0x7f2a('0x56')]({},_0x1f1ce8,_0x4bc0df[_0x7f2a('0x57')]);return _0x3b6d48[_0x7f2a('0xe8')](_0x1f1ce8);}})[_0x7f2a('0x15')](function(_0x19ded9){if(_0x19ded9){_0x2f7b41=_0x19ded9[_0x7f2a('0x46')];if(!_0x4bc0df[_0x7f2a('0x3e')][_0x7f2a('0xcb')]('nolimit')){_0x1f1ce8[_0x7f2a('0x24')]=qs[_0x7f2a('0x24')](_0x4bc0df[_0x7f2a('0x3e')][_0x7f2a('0x24')]);_0x1f1ce8[_0x7f2a('0x22')]=qs['offset'](_0x4bc0df[_0x7f2a('0x3e')][_0x7f2a('0x22')]);}return _0x3b6d48[_0x7f2a('0xe8')](_0x1f1ce8);}})[_0x7f2a('0x15')](function(_0x35d5d5){if(_0x35d5d5){return _0x35d5d5?{'count':_0x2f7b41,'rows':_0x35d5d5}:null;}})[_0x7f2a('0x15')](respondWithResult(_0x31d606,null))[_0x7f2a('0x1e')](handleError(_0x31d606,null));};exports[_0x7f2a('0xea')]=function(_0x7ce20f,_0x2bd88a,_0x4eefeb){var _0x70d355;var _0x3ec6f4;var _0xfaa64c;var _0x2e15de=!_['isNil'](_0x7ce20f['params']['id'])?_0x7ce20f[_0x7f2a('0x4e')]['id']:!_[_0x7f2a('0x64')](_0x7ce20f[_0x7f2a('0x2c')]['id'])?_0x7ce20f[_0x7f2a('0x2c')]['id']:null;return db['User'][_0x7f2a('0x31')]({'where':{'id':_0x2e15de,'role':{'$or':[_0x7f2a('0x7d'),_0x7f2a('0x2c'),'agent']}},'attributes':['id',_0x7f2a('0x33'),'phone',_0x7f2a('0xeb'),_0x7f2a('0x27'),_0x7f2a('0x5f'),_0x7f2a('0xec')]})[_0x7f2a('0x15')](function(_0x252af0){if(_0x252af0){if(_0x252af0[_0x7f2a('0x27')]==='agent'){_0x70d355=_0x252af0;if(_0x7ce20f['body'][_0x7f2a('0xed')]){_0xfaa64c=util[_0x7f2a('0xaa')](_0x7f2a('0xee'),_0x70d355[_0x7ce20f[_0x7f2a('0x5b')][_0x7f2a('0xed')]]);}else if(_0x7ce20f[_0x7f2a('0x5b')]['intrf']){_0xfaa64c=util[_0x7f2a('0xaa')](_0x7f2a('0xab'),_0x7ce20f['body'][_0x7f2a('0xef')]);}else{_0xfaa64c=util['format'](_0x7f2a('0xab'),_0x70d355[_0x7f2a('0x33')]);}socket['to'](util[_0x7f2a('0xaa')](_0x7f2a('0xf0'),_0x70d355[_0x7f2a('0x33')]))['emit'](_0x7f2a('0xf1'),{'user':{'id':_0x70d355['id'],'name':_0x70d355[_0x7f2a('0x33')]},'ip':_0x7ce20f[_0x7f2a('0xf2')][_0x7f2a('0xf3')]||_0x7ce20f[_0x7f2a('0xf4')]['remoteAddress']||_0x7ce20f['socket']['remoteAddress']||_0x7ce20f[_0x7f2a('0xf4')][_0x7f2a('0xf5')]['remoteAddress']});return db[_0x7f2a('0xac')][_0x7f2a('0x2a')]({'where':{'membername':_0x70d355['name']},'individualHooks':!![]});}}else{throw new db[(_0x7f2a('0x8e'))][(_0x7f2a('0x8f'))](_0x7f2a('0xf6'));}})[_0x7f2a('0x15')](function(){if(_0x70d355){return _0x70d355[_0x7f2a('0xf7')]({'raw':!![]});}})['then'](function(_0x4e55a5){if(_0x70d355){if(_0x4e55a5){_0x3ec6f4=_0x4e55a5;if(_0x3ec6f4[_0x7f2a('0x46')]){var _0x4b9a86=_0x3ec6f4[_0x7f2a('0x89')](function(_0x4c20d5){var _0x31786e={'membername':_0x70d355[_0x7f2a('0x33')],'UserId':_0x70d355['id'],'queue_name':_0x4c20d5[_0x7f2a('0x33')],'VoiceQueueId':_0x4c20d5['id'],'interface':_0xfaa64c,'paused':_0x70d355[_0x7f2a('0xec')]||![],'penalty':_0x4c20d5[_0x7f2a('0xf8')]||0x0};return db[_0x7f2a('0xac')]['upsert'](_0x31786e);});return Promise[_0x7f2a('0x4c')](_0x4b9a86);}}}})[_0x7f2a('0x15')](function(){if(_0x70d355){return db[_0x7f2a('0xf9')][_0x7f2a('0x44')]({'where':{'membername':_0x70d355[_0x7f2a('0x33')],'exitAt':null}});}})[_0x7f2a('0x15')](function(_0x3393f7){if(_0x70d355){var _0x26fb31=[];_0x3393f7[_0x7f2a('0xfa')](function(_0x2bd207){_0x26fb31[_0x7f2a('0x43')](_0x2bd207[_0x7f2a('0x5a')]({'exitAt':moment()[_0x7f2a('0xaa')](_0x7f2a('0xfb'))}));});return Promise[_0x7f2a('0x4c')](_0x26fb31);}})['then'](function(){if(_0x70d355){var _0x264469=[];var _0x3f6e44=[];var _0x1ae596=utils[_0x7f2a('0xfc')]();var _0x1c2b5e={'membername':_0x70d355['name'],'interface':_0xfaa64c,'enterAt':moment()[_0x7f2a('0xaa')](_0x7f2a('0xfb')),'role':_0x70d355[_0x7f2a('0x27')],'internal':_0x70d355[_0x7f2a('0x5f')]};_0x1ae596[_0x7f2a('0xfa')](function(_0x5c5c18){_0x264469['push'](_['merge']({'channel':_0x5c5c18,'type':_0x7f2a('0xfd'),'data1':_0x7ce20f[_0x7f2a('0x5b')]['device'],'data2':_0xfaa64c},_0x1c2b5e));if(_0x70d355[_0x7f2a('0xec')]){_0x3f6e44[_0x7f2a('0x43')](_[_0x7f2a('0x56')]({'channel':_0x5c5c18,'type':_0x7f2a('0xfe'),'data1':_0x7f2a('0xff')},_0x1c2b5e));}});return db[_0x7f2a('0xf9')][_0x7f2a('0x84')](_0x264469[_0x7f2a('0x100')](_0x3f6e44),{'individualHooks':!![]});}})[_0x7f2a('0x15')](function(){if(_0x70d355){return _0x70d355[_0x7f2a('0x5a')]({'online':!![],'lastLoginAt':moment()[_0x7f2a('0xaa')](_0x7f2a('0xfb')),'voicePause':_0x70d355['loginInPause']||![],'mailPause':_0x70d355['loginInPause']||![],'chatPause':_0x70d355[_0x7f2a('0xec')]||![],'faxPause':_0x70d355['loginInPause']||![],'smsPause':_0x70d355[_0x7f2a('0xec')]||![],'openchannelPause':_0x70d355['loginInPause']||![],'whatsappPause':_0x70d355['loginInPause']||![],'pauseType':_0x70d355['loginInPause']?'LOGININPAUSE':null,'interface':_0xfaa64c,'lastPauseAt':moment()['format'](_0x7f2a('0xfb'))});}})['then'](function(_0x5083c4){if(_0x7ce20f['isMiddleware']){return _0x4eefeb();}else{return Promise[_0x7f2a('0x101')](_0x5083c4)[_0x7f2a('0x15')](respondWithResult(_0x2bd88a,null));}})['catch'](handleError(_0x2bd88a,null));};exports['logout']=function(_0x62464d,_0x5eb091){var _0x484a06;return db[_0x7f2a('0x37')][_0x7f2a('0x31')]({'where':{'id':_0x62464d[_0x7f2a('0x4e')]['id'],'role':'agent'},'attributes':['id',_0x7f2a('0x33'),_0x7f2a('0x27')]})[_0x7f2a('0x15')](handleEntityNotFound(_0x5eb091,null))['then'](function(_0x13f619){if(_0x13f619){_0x484a06=_0x13f619;return db[_0x7f2a('0xac')][_0x7f2a('0x2a')]({'where':{'membername':_0x484a06[_0x7f2a('0x33')]},'individualHooks':!![]});}})[_0x7f2a('0x15')](function(){return db[_0x7f2a('0xf9')][_0x7f2a('0x44')]({'where':{'membername':_0x484a06[_0x7f2a('0x33')],'exitAt':null}});})['then'](function(_0x566e3e){var _0x143648=[];_0x566e3e[_0x7f2a('0xfa')](function(_0x415d25){_0x143648[_0x7f2a('0x43')](_0x415d25[_0x7f2a('0x5a')]({'exitAt':moment()[_0x7f2a('0xaa')]('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x7f2a('0x4c')](_0x143648);})[_0x7f2a('0x15')](function(){return _0x484a06[_0x7f2a('0x5a')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x7f2a('0x15')](respondWithResult(_0x5eb091,null))[_0x7f2a('0x1e')](handleError(_0x5eb091,null));};exports[_0x7f2a('0x102')]=function(_0x575e1f,_0x16cd07){var _0x47e943;return db[_0x7f2a('0xac')]['update']({'paused':0x1},{'where':{'UserId':_0x575e1f[_0x7f2a('0x4e')]['id']},'individualHooks':!![]})[_0x7f2a('0x15')](function(){return db[_0x7f2a('0x37')][_0x7f2a('0x31')]({'where':{'id':_0x575e1f['params']['id'],'role':'agent'},'attributes':['id',_0x7f2a('0x33'),_0x7f2a('0x27'),_0x7f2a('0x5f'),_0x7f2a('0xed'),_0x7f2a('0x9c')]});})[_0x7f2a('0x15')](handleEntityNotFound(_0x16cd07,null))['then'](function(_0x3c0ad9){if(_0x3c0ad9){_0x47e943=_0x3c0ad9;return respondWithRpcPromise(_0x7f2a('0x103'),_0x7f2a('0x102'),{'id':_0x47e943['id'],'name':_0x47e943[_0x7f2a('0x33')],'pause':!![]});}})['then'](function(){if(_0x47e943){return db['MemberReport'][_0x7f2a('0x44')]({'where':{'membername':_0x47e943['name'],'type':_0x7f2a('0xfe'),'exitAt':null}});}})[_0x7f2a('0x15')](function(_0x574a80){if(_0x574a80[_0x7f2a('0x46')]){var _0xe3dce6=moment()[_0x7f2a('0xaa')](_0x7f2a('0xfb'));for(var _0x5a3e18=0x0,_0x49dc46=_0x574a80[_0x7f2a('0x46')];_0x5a3e18<_0x49dc46;_0x5a3e18++){_0x574a80[_0x5a3e18][_0x7f2a('0x104')]({'exitAt':_0xe3dce6});}}})[_0x7f2a('0x15')](function(){var _0x20039f=[];var _0x18198d=utils[_0x7f2a('0xfc')]();_0x18198d[_0x7f2a('0xfa')](function(_0x4c0b1a){_0x20039f['push']({'channel':_0x4c0b1a,'membername':_0x47e943['name'],'interface':_[_0x7f2a('0x64')](_0x47e943[_0x7f2a('0xed')])?util[_0x7f2a('0xaa')](_0x7f2a('0xab'),_0x47e943['name']):_0x47e943[_0x7f2a('0xed')],'type':_0x7f2a('0xfe'),'enterAt':moment()['format'](_0x7f2a('0xfb')),'data1':_0x575e1f['body'][_0x7f2a('0x105')]||_0x7f2a('0x106'),'role':_0x47e943[_0x7f2a('0x27')],'internal':_0x47e943[_0x7f2a('0x5f')]});});return db[_0x7f2a('0xf9')][_0x7f2a('0x84')](_0x20039f,{'individualHooks':!![]});})[_0x7f2a('0x15')](function(){return _0x47e943[_0x7f2a('0x5a')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x575e1f['body'][_0x7f2a('0x105')]||'DEFAULT\x20PAUSE','lastPauseAt':moment()['format'](_0x7f2a('0xfb'))});})[_0x7f2a('0x15')](respondWithResult(_0x16cd07,null))['catch'](handleError(_0x16cd07,null));};exports[_0x7f2a('0x107')]=function(_0x391715,_0x310329){if(_0x391715[_0x7f2a('0x5b')][_0x7f2a('0xae')]&&!utils[_0x7f2a('0x9e')](_0x391715[_0x7f2a('0x5b')]['channel'])){throw new APIBadRequestError(util[_0x7f2a('0xaa')](_0x7f2a('0x108'),_0x391715[_0x7f2a('0x5b')][_0x7f2a('0xae')]));}return db[_0x7f2a('0x37')][_0x7f2a('0x31')]({'where':{'id':_0x391715['params']['id']},'attributes':['id',_0x7f2a('0x33'),'role','internal','interface',_0x7f2a('0x9c'),_0x7f2a('0x9d'),_0x7f2a('0x109'),_0x7f2a('0x10a'),_0x7f2a('0x10b'),'openchannelPause','smsPause',_0x7f2a('0x10c'),_0x7f2a('0x10d'),_0x7f2a('0x10e')]})['then'](function(_0x176ad9){if(!_0x176ad9){throw new APINotFoundError(util[_0x7f2a('0xaa')](_0x7f2a('0xc9'),_0x391715['params']['id']));}return _0x176ad9[_0x7f2a('0x107')](_0x391715[_0x7f2a('0x5b')]['channel']);})[_0x7f2a('0x15')](respondWithResult(_0x310329,null))[_0x7f2a('0x1e')](APIHandleError(_0x310329));};exports[_0x7f2a('0x10f')]=function(_0x54a573,_0x3ff5ab){var _0x24e006={};var _0x21641c={};var _0x349113;var _0x127d86;return db[_0x7f2a('0x37')][_0x7f2a('0x95')]({'where':{'id':_0x54a573[_0x7f2a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3ff5ab,null))[_0x7f2a('0x15')](function(_0x2b92e6){if(_0x2b92e6){_0x349113=_0x2b92e6;_0x21641c['model']=_[_0x7f2a('0x4f')](db['Team']['rawAttributes']);_0x21641c['query']=_[_0x7f2a('0x4f')](_0x54a573[_0x7f2a('0x3e')]);_0x21641c[_0x7f2a('0x52')]=_[_0x7f2a('0x53')](_0x21641c['model'],_0x21641c[_0x7f2a('0x3e')]);_0x24e006[_0x7f2a('0x42')]=_['intersection'](_0x21641c[_0x7f2a('0x54')],qs[_0x7f2a('0x55')](_0x54a573[_0x7f2a('0x3e')][_0x7f2a('0x55')]));_0x24e006['attributes']=_0x24e006[_0x7f2a('0x42')]['length']?_0x24e006[_0x7f2a('0x42')]:_0x21641c[_0x7f2a('0x54')];_0x24e006[_0x7f2a('0xd2')]=qs[_0x7f2a('0xd3')](_0x54a573[_0x7f2a('0x3e')][_0x7f2a('0xd3')]);_0x24e006[_0x7f2a('0x3b')]=qs[_0x7f2a('0x52')](_['pick'](_0x54a573[_0x7f2a('0x3e')],_0x21641c['filters']));if(_0x54a573[_0x7f2a('0x3e')][_0x7f2a('0x2f')]){_0x24e006[_0x7f2a('0x3b')]=_[_0x7f2a('0x56')](_0x24e006[_0x7f2a('0x3b')],{'$or':_[_0x7f2a('0x89')](_0x24e006[_0x7f2a('0x42')],function(_0x2cc68e){var _0x2d9ac0={};_0x2d9ac0[_0x2cc68e]={'$like':'%'+_0x54a573[_0x7f2a('0x3e')]['filter']+'%'};return _0x2d9ac0;})});}_0x24e006=_['merge']({},_0x24e006,_0x54a573[_0x7f2a('0x57')]);return _0x349113[_0x7f2a('0x10f')](_0x24e006);}})['then'](function(_0x25cbb2){if(_0x25cbb2){_0x127d86=_0x25cbb2[_0x7f2a('0x46')];if(!_0x54a573[_0x7f2a('0x3e')]['hasOwnProperty'](_0x7f2a('0xd7'))){_0x24e006[_0x7f2a('0x24')]=qs[_0x7f2a('0x24')](_0x54a573[_0x7f2a('0x3e')]['limit']);_0x24e006[_0x7f2a('0x22')]=qs[_0x7f2a('0x22')](_0x54a573[_0x7f2a('0x3e')][_0x7f2a('0x22')]);}return _0x349113[_0x7f2a('0x10f')](_0x24e006);}})['then'](function(_0x5b02e3){if(_0x5b02e3){return _0x5b02e3?{'count':_0x127d86,'rows':_0x5b02e3}:null;}})[_0x7f2a('0x15')](respondWithResult(_0x3ff5ab,null))[_0x7f2a('0x1e')](handleError(_0x3ff5ab,null));};exports[_0x7f2a('0x110')]=function(_0x71850b,_0x23e7e0){var _0x11a570=_0x71850b[_0x7f2a('0x4e')]['id'];var _0x16d07c=_0x71850b['body']?_0x71850b[_0x7f2a('0x5b')]['ids']:null;var _0x2125bd=[];return Promise['resolve']()[_0x7f2a('0x15')](function(){if(!_0x16d07c)throw new APIBadRequestError('Body\x20parameter\x20\x27ids\x27\x20is\x20required');})[_0x7f2a('0x15')](function(){return db[_0x7f2a('0x37')][_0x7f2a('0x95')]({'where':{'id':_0x11a570}});})[_0x7f2a('0x15')](function(_0x2573f0){if(!_0x2573f0)throw new APINotFoundError(util[_0x7f2a('0xaa')](_0x7f2a('0xc9'),_0x71850b[_0x7f2a('0x4e')]['id']));return db[_0x7f2a('0x65')][_0x7f2a('0x111')](function(_0x2afc02){return _0x2573f0[_0x7f2a('0x110')](_0x16d07c,{'transaction':_0x2afc02})[_0x7f2a('0x15')](function(){return db[_0x7f2a('0x112')]['findAll']({'where':{'id':{'$in':_0x16d07c}}});})[_0x7f2a('0x15')](function(_0x3a25ce){var _0x4711d9=_[_0x7f2a('0x89')](_0x3a25ce,function(_0x4d8999){return _0x4d8999[_0x7f2a('0x113')]();});return Promise[_0x7f2a('0x4c')](_0x4711d9);})[_0x7f2a('0x15')](function(_0x47b1a1){_0x2125bd=_['flattenDeep'](_0x47b1a1);var _0x30a00f=_[_0x7f2a('0x89')](_0x2125bd,function(_0x441afb){return _0x441afb['addAgent'](_0x2573f0['id'],{'transaction':_0x2afc02});});return Promise['all'](_0x30a00f);})[_0x7f2a('0x15')](function(){if(!_0x2573f0[_0x7f2a('0x9c')])return;var _0x1c67e9=_[_0x7f2a('0x2f')](_0x2125bd,function(_0x3efe72){return _0x3efe72[_0x7f2a('0x114')](_0x7f2a('0xae'))===_0x7f2a('0x115');});var _0x7ab930=_[_0x7f2a('0x89')](_0x1c67e9,function(_0xdf7541){return db[_0x7f2a('0xac')][_0x7f2a('0x116')]({'membername':_0x2573f0['name'],'UserId':_0x2573f0['id'],'queue_name':_0xdf7541[_0x7f2a('0x33')],'VoiceQueueId':_0xdf7541['id'],'interface':_[_0x7f2a('0x64')](_0x2573f0[_0x7f2a('0xed')])?util[_0x7f2a('0xaa')](_0x7f2a('0xab'),_0x2573f0['name']):_0x2573f0[_0x7f2a('0xed')],'paused':_0x2573f0[_0x7f2a('0x9d')]||![],'penalty':_0x2573f0[_0x7f2a('0xa2')]},{'transaction':_0x2afc02});});return Promise[_0x7f2a('0x4c')](_0x7ab930);})[_0x7f2a('0x15')](function(){return db[_0x7f2a('0x117')][_0x7f2a('0x44')]({'where':{'teamId':{'$in':_0x16d07c}}});})[_0x7f2a('0x15')](function(_0x593a4f){var _0x57af8d=_['map'](_0x593a4f,function(_0x2290ae){return db[_0x7f2a('0x118')][_0x7f2a('0x7b')]({'UserId':_0x2573f0['id'],'VoicePrefixId':_0x2290ae['VoicePrefixId']},{'transaction':_0x2afc02});});return Promise[_0x7f2a('0x4c')](_0x57af8d);});});})['then'](function(){for(var _0x9184f=0x0;_0x9184f<_0x2125bd['length'];_0x9184f++){var _0xc8e2e8=_0x2125bd[_0x9184f]['getDataValue'](_0x7f2a('0xae'));var _0x16c07f=_0xc8e2e8+_0x7f2a('0xa6');socket[_0x7f2a('0x28')](_0x7f2a('0x2c')+_0xc8e2e8+_0x7f2a('0xa7'),{'UserId':_0x11a570,['queueField']:_0x2125bd[_0x9184f]['id']});}})[_0x7f2a('0x15')](respondWithStatusCode(_0x23e7e0,null))[_0x7f2a('0x1e')](APIHandleError(_0x23e7e0));};exports[_0x7f2a('0x119')]=function(_0x464a7b,_0x595e41){var _0x430dac=_0x464a7b[_0x7f2a('0x4e')]['id'];var _0x5314e4=null;if(_0x464a7b[_0x7f2a('0x3e')][_0x7f2a('0x5e')]){_0x5314e4=_['isArray'](_0x464a7b[_0x7f2a('0x3e')][_0x7f2a('0x5e')])?_0x464a7b['query']['ids']:[_0x464a7b['query']['ids']];}var _0x32917f=[];return Promise['resolve']()[_0x7f2a('0x15')](function(){if(!_0x5314e4)throw new APIBadRequestError(_0x7f2a('0x11a'));})[_0x7f2a('0x15')](function(){return db[_0x7f2a('0x37')][_0x7f2a('0x95')]({'where':{'id':_0x430dac}});})[_0x7f2a('0x15')](function(_0xa380b6){if(!_0xa380b6)throw new APINotFoundError(util[_0x7f2a('0xaa')](_0x7f2a('0xc9'),_0x464a7b[_0x7f2a('0x4e')]['id']));return db['sequelize']['transaction'](function(_0x4e4608){return _0xa380b6['removeTeams'](_0x5314e4,{'transaction':_0x4e4608})[_0x7f2a('0x15')](function(){return db[_0x7f2a('0x112')][_0x7f2a('0x44')]({'where':{'id':{'$in':_0x5314e4}}});})[_0x7f2a('0x15')](function(_0x41b852){var _0x359c83=_[_0x7f2a('0x89')](_0x41b852,function(_0x2824b7){return _0x2824b7[_0x7f2a('0x113')]();});return Promise['all'](_0x359c83);})['then'](function(_0x7f2d8e){_0x32917f=_[_0x7f2a('0x11b')](_0x7f2d8e);var _0x4b16c5=_[_0x7f2a('0x89')](_0x32917f,function(_0x32427f){return _0x32427f[_0x7f2a('0x11c')](_0xa380b6['id'],{'transaction':_0x4e4608});});return Promise[_0x7f2a('0x4c')](_0x4b16c5);})[_0x7f2a('0x15')](function(){if(!_0xa380b6[_0x7f2a('0x9c')])return;var _0x26a423=_[_0x7f2a('0x2f')](_0x32917f,function(_0x23cb2e){return _0x23cb2e[_0x7f2a('0x114')](_0x7f2a('0xae'))===_0x7f2a('0x115');});var _0x12603e=_[_0x7f2a('0x89')](_0x26a423,function(_0x369b67){return db[_0x7f2a('0xac')]['destroy']({'where':{'VoiceQueueId':_0x369b67['id'],'UserId':_0xa380b6['id']},'transaction':_0x4e4608});});return Promise['all'](_0x12603e);})[_0x7f2a('0x15')](function(){return db[_0x7f2a('0x117')][_0x7f2a('0x44')]({'where':{'teamId':{'$in':_0x5314e4}}});})['then'](function(_0x912a15){var _0x4b1fe0=_[_0x7f2a('0x89')](_0x912a15,function(_0x2285bc){return db[_0x7f2a('0x118')][_0x7f2a('0x2a')]({'where':{'UserId':_0xa380b6['id'],'VoicePrefixId':_0x2285bc[_0x7f2a('0x11d')]}},{'transaction':_0x4e4608});});return Promise[_0x7f2a('0x4c')](_0x4b1fe0);});});})[_0x7f2a('0x15')](function(){for(var _0x26fd23=0x0;_0x26fd23<_0x32917f['length'];_0x26fd23++){var _0x1fe4c6=_0x32917f[_0x26fd23][_0x7f2a('0x114')]('channel');var _0x17f584=_0x1fe4c6+'QueueId';socket[_0x7f2a('0x28')](_0x7f2a('0x2c')+_0x1fe4c6+_0x7f2a('0xb1'),{'UserId':_0x430dac,['queueField']:_0x32917f[_0x26fd23]['id']});}})['then'](respondWithStatusCode(_0x595e41,null))[_0x7f2a('0x1e')](APIHandleError(_0x595e41));};exports[_0x7f2a('0x11e')]=function(_0x4ee461,_0x2b422d){var _0x16b1b6={};var _0x2e7cac={};var _0x4aa9cd;var _0x4ec5e6;return db[_0x7f2a('0x37')][_0x7f2a('0x95')]({'where':{'id':_0x4ee461[_0x7f2a('0x4e')]['id']}})[_0x7f2a('0x15')](handleEntityNotFound(_0x2b422d,null))[_0x7f2a('0x15')](function(_0x52ca95){if(_0x52ca95){_0x4aa9cd=_0x52ca95;_0x2e7cac[_0x7f2a('0x54')]=_[_0x7f2a('0x4f')](db[_0x7f2a('0xcc')][_0x7f2a('0x38')]);_0x2e7cac['query']=_[_0x7f2a('0x4f')](_0x4ee461[_0x7f2a('0x3e')]);_0x2e7cac['filters']=_[_0x7f2a('0x53')](_0x2e7cac[_0x7f2a('0x54')],_0x2e7cac[_0x7f2a('0x3e')]);_0x16b1b6[_0x7f2a('0x42')]=_['intersection'](_0x2e7cac['model'],qs['fields'](_0x4ee461[_0x7f2a('0x3e')][_0x7f2a('0x55')]));_0x16b1b6[_0x7f2a('0x42')]=_0x16b1b6[_0x7f2a('0x42')][_0x7f2a('0x46')]?_0x16b1b6[_0x7f2a('0x42')]:_0x2e7cac[_0x7f2a('0x54')];_0x16b1b6[_0x7f2a('0xd2')]=qs['sort'](_0x4ee461[_0x7f2a('0x3e')]['sort']);_0x16b1b6[_0x7f2a('0x3b')]=qs['filters'](_['pick'](_0x4ee461[_0x7f2a('0x3e')],_0x2e7cac['filters']));if(_0x4ee461['query'][_0x7f2a('0x2f')]){_0x16b1b6[_0x7f2a('0x3b')]=_[_0x7f2a('0x56')](_0x16b1b6[_0x7f2a('0x3b')],{'$or':_[_0x7f2a('0x89')](_0x16b1b6[_0x7f2a('0x42')],function(_0x569dee){var _0x523563={};_0x523563[_0x569dee]={'$like':'%'+_0x4ee461[_0x7f2a('0x3e')][_0x7f2a('0x2f')]+'%'};return _0x523563;})});}_0x16b1b6=_[_0x7f2a('0x56')]({},_0x16b1b6,_0x4ee461['options']);return _0x4aa9cd['getLists'](_0x16b1b6);}})['then'](function(_0x462834){if(_0x462834){_0x4ec5e6=_0x462834['length'];if(!_0x4ee461['query']['hasOwnProperty']('nolimit')){_0x16b1b6[_0x7f2a('0x24')]=qs['limit'](_0x4ee461['query'][_0x7f2a('0x24')]);_0x16b1b6[_0x7f2a('0x22')]=qs[_0x7f2a('0x22')](_0x4ee461[_0x7f2a('0x3e')][_0x7f2a('0x22')]);}return _0x4aa9cd[_0x7f2a('0x11e')](_0x16b1b6);}})[_0x7f2a('0x15')](function(_0x30a981){if(_0x30a981){return _0x30a981?{'count':_0x4ec5e6,'rows':_0x30a981}:null;}})[_0x7f2a('0x15')](respondWithResult(_0x2b422d,null))['catch'](handleError(_0x2b422d,null));};exports[_0x7f2a('0x11f')]=function(_0xe36f9e,_0x24b096){var _0x21bc07={};var _0x1132f8={};var _0x29030e;return db[_0x7f2a('0x37')][_0x7f2a('0x95')]({'where':{'id':_0xe36f9e[_0x7f2a('0x4e')]['id']}})['then'](handleEntityNotFound(_0x24b096,null))[_0x7f2a('0x15')](function(_0x461f88){if(_0x461f88){_0x29030e=_0x461f88;_0x1132f8['model']=_[_0x7f2a('0x4f')](db[_0x7f2a('0x37')][_0x7f2a('0x38')]);_0x1132f8['query']=_[_0x7f2a('0x4f')](_0xe36f9e['query']);_0x1132f8[_0x7f2a('0x52')]=_['intersection'](_0x1132f8[_0x7f2a('0x54')],_0x1132f8[_0x7f2a('0x3e')]);_0x21bc07['attributes']=_['intersection'](_0x1132f8[_0x7f2a('0x54')],qs['fields'](_0xe36f9e['query'][_0x7f2a('0x55')]));_0x21bc07[_0x7f2a('0x42')]=_0x21bc07[_0x7f2a('0x42')]['length']?_0x21bc07['attributes']:_0x1132f8[_0x7f2a('0x54')];_0x21bc07[_0x7f2a('0xd2')]=qs[_0x7f2a('0xd3')](_0xe36f9e[_0x7f2a('0x3e')][_0x7f2a('0xd3')]);_0x21bc07[_0x7f2a('0x3b')]=qs['filters'](_[_0x7f2a('0xd4')](_0xe36f9e[_0x7f2a('0x3e')],_0x1132f8[_0x7f2a('0x52')]));if(_0xe36f9e['query'][_0x7f2a('0x2f')]){_0x21bc07[_0x7f2a('0x3b')]=_['merge'](_0x21bc07[_0x7f2a('0x3b')],{'$or':_[_0x7f2a('0x89')](_0x21bc07[_0x7f2a('0x42')],function(_0xdb948f){var _0x4f3448={};_0x4f3448[_0xdb948f]={'$like':'%'+_0xe36f9e[_0x7f2a('0x3e')][_0x7f2a('0x2f')]+'%'};return _0x4f3448;})});}_0x21bc07[_0x7f2a('0x54')]=db['User'];_0x21bc07['as']=_0x7f2a('0x88');_0x21bc07=_[_0x7f2a('0x56')]({},_0x21bc07,_0xe36f9e[_0x7f2a('0x57')]);return _0x29030e['getVoiceQueues']({'include':[_0x21bc07]});}})[_0x7f2a('0x15')](function(_0x5af1c7){if(_0x5af1c7){var _0x14e221={},_0x24cca4=[];for(var _0x2e6315=0x0;_0x2e6315<_0x5af1c7['length'];_0x2e6315+=0x1){for(var _0x147a96=0x0,_0x467d93;_0x147a96<_0x5af1c7[_0x2e6315]['Agents'][_0x7f2a('0x46')];_0x147a96+=0x1){_0x467d93=_0x5af1c7[_0x2e6315]['Agents'][_0x147a96]['get']({'plain':!![]});_0x14e221[_0x467d93['id']]=_0x467d93;}}_0x14e221=_[_0x7f2a('0x120')](_0x14e221);for(var _0x4a3cae=qs[_0x7f2a('0x22')](_0xe36f9e['query'][_0x7f2a('0x22')]);_0x4a3cae<_0x14e221[_0x7f2a('0x46')]&&_0x24cca4[_0x7f2a('0x46')]=_0x288b96){_0x1aa368=_0x288b96;_0x130c86=0xc8;}else{_0x130c86=0xce;}_0x387f6b['status'](_0x130c86);return _0x387f6b[_0x297f('0x27')]('Content-Range',_0x5b9057+'-'+_0x1aa368+'/'+_0x288b96)[_0x297f('0x22')](_0x12263f);}return null;};}function saveUpdates(_0x3df68b){return function(_0x5c3038){if(_0x5c3038){return _0x5c3038[_0x297f('0x28')](_0x3df68b)[_0x297f('0x16')](function(_0x3bf053){if(_0x3bf053[_0x297f('0x29')]===_0x297f('0x2a')){socket[_0x297f('0x2b')](_0x297f('0x2c')+_0x3bf053['id'],_0x3bf053);}return _0x3bf053;});}return null;};}function removeEntity(_0xdf2103){return function(_0x2d8115){if(_0x2d8115){return _0x2d8115[_0x297f('0x2d')]()[_0x297f('0x16')](function(){var _0x2f4b17=_0x2d8115[_0x297f('0x2e')]({'plain':!![]});if(_0x2f4b17[_0x297f('0x29')]===_0x297f('0x2f'))return;var _0x48df48=[{'name':'Users','value':_0x297f('0x30'),'ignore':!![]},{'name':_0x297f('0x31'),'value':_0x297f('0x2a'),'ignore':![]},{'name':'Telephones','value':'telephone','ignore':![]}];var _0x1be662=_(_0x48df48)[_0x297f('0x32')](_0x297f('0x33'))[_0x297f('0x34')]('value')[_0x297f('0x35')]();if(_[_0x297f('0x36')](_0x1be662,_0x2f4b17['role'])){return;}var _0x3ebf0e=_['find'](_0x48df48,['value',_0x2f4b17[_0x297f('0x29')]])[_0x297f('0x37')];return db[_0x297f('0x38')][_0x297f('0x2d')]({'where':{'type':_0x3ebf0e,'resourceId':_0x2f4b17['id']}})[_0x297f('0x16')](function(){return _0x2d8115;});})['then'](function(){_0xdf2103[_0x297f('0x20')](0xcc)[_0x297f('0x21')]();});}};}function handleEntityNotFound(_0x17cc61){return function(_0x77c053){if(!_0x77c053){_0x17cc61[_0x297f('0x39')](0x194);}return _0x77c053;};}function handleError(_0x8b6d91,_0x1a63ce){_0x1a63ce=_0x1a63ce||0x1f4;return function(_0x43cf17){logger[_0x297f('0x1b')](_0x43cf17[_0x297f('0x3a')]);if(_0x43cf17[_0x297f('0x37')]){delete _0x43cf17[_0x297f('0x37')];}_0x8b6d91['status'](_0x1a63ce)[_0x297f('0x3b')](_0x43cf17);};}exports[_0x297f('0x3c')]=function(_0x3d968a,_0x265473){var _0x10bc57={},_0x58b41c={'count':0x0,'rows':[]};var _0x3bd453=_(db[_0x297f('0x3d')][_0x297f('0x3e')])['map'](function(_0x3b0eef){return{'name':_0x3b0eef[_0x297f('0x3f')],'type':_0x3b0eef[_0x297f('0x40')][_0x297f('0x41')]};})[_0x297f('0x32')](function(_0x4786b8){return!_['includes']([_0x297f('0x42'),_0x297f('0x43')],_0x4786b8['name']);})['value']();_0x10bc57=qs['getOptions'](_0x3bd453,_0x3d968a);var _0xa81860={'where':_0x10bc57[_0x297f('0x44')]};return db['User'][_0x297f('0x26')](_0xa81860)['then'](function(_0x328fc0){_0x58b41c[_0x297f('0x26')]=_0x328fc0;if(_0x3d968a[_0x297f('0x45')][_0x297f('0x46')]){_0x10bc57[_0x297f('0x47')]=[{'all':!![]}];}if(_0x3d968a[_0x297f('0x45')][_0x297f('0x48')]===_0x297f('0x49')){_0x10bc57['include']=[{'model':db[_0x297f('0x4a')],'as':_0x297f('0x48')}];}if(!_[_0x297f('0x36')](_0x10bc57[_0x297f('0x4b')],'id')){_0x10bc57[_0x297f('0x4b')][_0x297f('0x4c')]('id');}return db[_0x297f('0x3d')][_0x297f('0x4d')](_0x10bc57);})[_0x297f('0x16')](function(_0x199830){_0x58b41c['rows']=_0x199830;if(_0x3d968a[_0x297f('0x45')]['openTabs']===_0x297f('0x49')){var _0x5d06a8=[];for(var _0x5573d1=0x0;_0x5573d1<_0x58b41c[_0x297f('0x4e')][_0x297f('0x4f')];_0x5573d1++){_0x5d06a8['push'](get_open_tabs(_0x297f('0x50'),_0x58b41c[_0x297f('0x4e')][_0x5573d1][_0x297f('0x51')]));_0x5d06a8[_0x297f('0x4c')](get_open_tabs(_0x297f('0x52'),_0x58b41c[_0x297f('0x4e')][_0x5573d1][_0x297f('0x51')]));_0x5d06a8[_0x297f('0x4c')](get_open_tabs('fax',_0x58b41c['rows'][_0x5573d1][_0x297f('0x51')]));_0x5d06a8[_0x297f('0x4c')](get_open_tabs(_0x297f('0x53'),_0x58b41c[_0x297f('0x4e')][_0x5573d1]['dataValues']));_0x5d06a8[_0x297f('0x4c')](get_open_tabs(_0x297f('0x54'),_0x58b41c[_0x297f('0x4e')][_0x5573d1][_0x297f('0x51')]));_0x5d06a8[_0x297f('0x4c')](get_open_tabs(_0x297f('0x55'),_0x58b41c[_0x297f('0x4e')][_0x5573d1][_0x297f('0x51')]));}return Promise[_0x297f('0x56')](_0x5d06a8)[_0x297f('0x16')](function(){return _0x58b41c;});}else{return _0x58b41c;}})[_0x297f('0x16')](respondWithFilteredResult(_0x265473,_0x10bc57))[_0x297f('0x1f')](handleError(_0x265473,null));};exports['show']=function(_0x5bb5a8,_0x4a34e1){var _0x20b2d2={'raw':![],'where':{'id':_0x5bb5a8[_0x297f('0x57')]['id']}},_0x4ce90a={};_0x4ce90a['model']=_[_0x297f('0x58')](_[_0x297f('0x59')](db[_0x297f('0x3d')]['rawAttributes']),[_0x297f('0x42'),'salt']);_0x4ce90a[_0x297f('0x45')]=_[_0x297f('0x59')](_0x5bb5a8[_0x297f('0x45')]);_0x4ce90a[_0x297f('0x5a')]=_[_0x297f('0x5b')](_0x4ce90a[_0x297f('0x5c')],_0x4ce90a[_0x297f('0x45')]);_0x20b2d2[_0x297f('0x4b')]=_[_0x297f('0x5b')](_0x4ce90a[_0x297f('0x5c')],qs[_0x297f('0x5d')](_0x5bb5a8[_0x297f('0x45')][_0x297f('0x5d')]));_0x20b2d2[_0x297f('0x4b')]=_0x20b2d2[_0x297f('0x4b')][_0x297f('0x4f')]?_0x20b2d2[_0x297f('0x4b')]:_0x4ce90a['model'];if(_0x5bb5a8['query'][_0x297f('0x46')]){_0x20b2d2[_0x297f('0x47')]=[{'all':!![]}];}if(_0x5bb5a8[_0x297f('0x45')][_0x297f('0x48')]===_0x297f('0x49')){_0x20b2d2['include']=[{'model':db[_0x297f('0x4a')],'as':_0x297f('0x48')}];}_0x20b2d2=_[_0x297f('0x5e')]({},_0x20b2d2,_0x5bb5a8['options']);if(!_['includes'](_0x20b2d2[_0x297f('0x4b')],'id')){_0x20b2d2['attributes'][_0x297f('0x4c')]('id');}return db['User'][_0x297f('0x5f')](_0x20b2d2)[_0x297f('0x16')](handleEntityNotFound(_0x4a34e1,null))[_0x297f('0x16')](function(_0x5ed9cc){var _0x1e35e4=[];values=_0x5ed9cc;if(_0x5bb5a8[_0x297f('0x45')]['openTabs']===_0x297f('0x49')){_0x1e35e4[_0x297f('0x4c')](get_open_tabs('chat',_0x5ed9cc[_0x297f('0x51')]));_0x1e35e4[_0x297f('0x4c')](get_open_tabs(_0x297f('0x52'),_0x5ed9cc['dataValues']));_0x1e35e4[_0x297f('0x4c')](get_open_tabs(_0x297f('0x54'),_0x5ed9cc[_0x297f('0x51')]));_0x1e35e4[_0x297f('0x4c')](get_open_tabs(_0x297f('0x55'),_0x5ed9cc[_0x297f('0x51')]));_0x1e35e4[_0x297f('0x4c')](get_open_tabs('fax',_0x5ed9cc[_0x297f('0x51')]));_0x1e35e4[_0x297f('0x4c')](get_open_tabs('mail',_0x5ed9cc[_0x297f('0x51')]));return Promise[_0x297f('0x56')](_0x1e35e4);}else{return values;}})[_0x297f('0x16')](function(){return values;})[_0x297f('0x16')](respondWithResult(_0x4a34e1,null))[_0x297f('0x1f')](handleError(_0x4a34e1,null));};exports[_0x297f('0x28')]=function(_0x415f26,_0x2310a6){if(_0x415f26[_0x297f('0x60')]['id']){delete _0x415f26[_0x297f('0x60')]['id'];}delete _0x415f26['body'][_0x297f('0x29')];return db[_0x297f('0x3d')]['find']({'where':{'id':_0x415f26['params']['id']}})['then'](handleEntityNotFound(_0x2310a6,null))['then'](saveUpdates(_0x415f26[_0x297f('0x60')],null))[_0x297f('0x16')](respondWithResult(_0x2310a6,null))['catch'](handleError(_0x2310a6,null));};exports[_0x297f('0x61')]=function(_0x2bc6d3,_0x54f42b){return db['User'][_0x297f('0x61')]()['then'](respondWithResult(_0x54f42b,null))[_0x297f('0x1f')](handleError(_0x54f42b,null));};exports[_0x297f('0x62')]=function(_0x1512d3,_0x1a614b){return db[_0x297f('0x3d')]['find']({'where':{'id':_0x1512d3['params']['id']}})[_0x297f('0x16')](handleEntityNotFound(_0x1a614b,null))[_0x297f('0x16')](function(_0xe11e16){if(_0xe11e16){return _0xe11e16['addContacts'](_0x1512d3['body'][_0x297f('0x63')],_[_0x297f('0x64')](_0x1512d3[_0x297f('0x60')],[_0x297f('0x63'),'id'])||{});}})[_0x297f('0x16')](respondWithResult(_0x1a614b,null))[_0x297f('0x1f')](handleError(_0x1a614b,null));};function validateUser(_0x2fa4e0){return new Promise(function(_0x561f44,_0x1412d7){if(_0x2fa4e0[_0x297f('0x65')])return _0x561f44(_0x2fa4e0);return db[_0x297f('0x66')]['findById'](0x1)[_0x297f('0x16')](function(_0x94f1e2){if(_0x94f1e2[_0x297f('0x67')])authService[_0x297f('0x68')](_0x2fa4e0[_0x297f('0x42')]);db['User'][_0x297f('0x69')](_0x297f('0x65'))[_0x297f('0x16')](function(_0x526b85){if(_['isNil'](_0x526b85)){_0x2fa4e0[_0x297f('0x65')]=_0x94f1e2[_0x297f('0x6a')]||0x1;return;}if(_[_0x297f('0x6b')](_0x94f1e2[_0x297f('0x6a')])||_0x94f1e2['min_internal']===_0x526b85){_0x2fa4e0['internal']=_0x526b85+0x1;return;}if(_0x94f1e2['min_internal']>_0x526b85){_0x2fa4e0['internal']=_0x94f1e2[_0x297f('0x6a')];return;}return db[_0x297f('0x6c')][_0x297f('0x45')](_0x297f('0x6d'),{'type':db[_0x297f('0x6c')][_0x297f('0x6e')][_0x297f('0x6f')]})[_0x297f('0x16')](function(_0x4ab732){if(_0x4ab732&&_0x4ab732[_0x297f('0x4f')]){for(var _0x4ccbfd=0x0,_0x2a28d8=_0x4ab732['length'];_0x4ccbfd<_0x2a28d8&&_[_0x297f('0x6b')](_0x2fa4e0[_0x297f('0x65')]);_0x4ccbfd++){if(_0x94f1e2[_0x297f('0x6a')]<=_0x4ab732[_0x4ccbfd][_0x297f('0x70')]){_0x2fa4e0[_0x297f('0x65')]=_0x4ab732[_0x4ccbfd][_0x297f('0x70')];}else if(_0x94f1e2[_0x297f('0x6a')]>_0x4ab732[_0x4ccbfd][_0x297f('0x70')]&&_0x94f1e2[_0x297f('0x6a')]<=_0x4ab732[_0x4ccbfd]['to']){_0x2fa4e0['internal']=_0x94f1e2[_0x297f('0x6a')];}}}if(_[_0x297f('0x6b')](_0x2fa4e0[_0x297f('0x65')])){_0x2fa4e0[_0x297f('0x65')]=_0x526b85+0x1;}return _0x561f44(_0x2fa4e0);});});})['catch'](function(_0x584b1b){_0x1412d7(_0x584b1b);});});}function updateUser(_0x3ee188){return new Promise(function(_0x36c716,_0x5262c3){try{if(_0x3ee188[_0x297f('0x71')]){_0x3ee188[_0x297f('0x72')]=_0x3ee188[_0x297f('0x65')];_0x3ee188[_0x297f('0x73')]={'mailbox':_0x3ee188['internal'],'password':_0x3ee188[_0x297f('0x42')],'fullname':_0x3ee188[_0x297f('0x74')],'email':_0x3ee188[_0x297f('0x75')]};}if(_0x3ee188[_0x297f('0x29')]==='agent'){if(!_0x3ee188[_0x297f('0x76')])_0x3ee188[_0x297f('0x76')]=[_0x297f('0x77'),_0x297f('0x78'),'103',_0x297f('0x79'),_0x297f('0x7a'),_0x297f('0x7b'),'105',_0x297f('0x7c'),_0x297f('0x7d'),_0x297f('0x7e'),_0x297f('0x7f'),_0x297f('0x80'),_0x297f('0x81'),_0x297f('0x82'),'115'];}_0x36c716(_0x3ee188);}catch(_0x3ccb60){_0x5262c3(_0x3ccb60);}});}exports['create']=function(_0x20caea,_0x44479b){if(_0x20caea[_0x297f('0x30')][_0x297f('0x29')]===_0x297f('0x2a'))throw new Error('Unauthorized');if(_0x20caea['body']['role']==='user'&&_0x20caea[_0x297f('0x30')][_0x297f('0x29')]!==_0x297f('0x2f')){throw new Error(_0x297f('0x83'));}if(_0x20caea[_0x297f('0x60')][_0x297f('0x29')]===_0x297f('0x2f')&&_0x20caea['user'][_0x297f('0x29')]!==_0x297f('0x2f')){throw new Error(_0x297f('0x84'));}return licenseUtil['checkUserLimits']([_0x20caea[_0x297f('0x60')]])['then'](function(){return validateUser(_0x20caea[_0x297f('0x60')]);})[_0x297f('0x16')](function(_0x18cc56){return updateUser(_0x18cc56)[_0x297f('0x16')](function(_0xe4513b){if(_0xe4513b['role']==='admin'){_0xe4513b[_0x297f('0x85')]=_0x20caea[_0x297f('0x30')][_0x297f('0x85')];delete _0xe4513b['userProfileId'];}return _0xe4513b;});})[_0x297f('0x16')](function(_0x4ff21d){return db[_0x297f('0x3d')][_0x297f('0x86')](_0x4ff21d,{'include':[{'model':db[_0x297f('0x73')],'as':_0x297f('0x73')}]});})[_0x297f('0x16')](function(_0x326e17){if(_0x20caea['body'][_0x297f('0x29')]==='user')return _0x326e17;if(_0x20caea[_0x297f('0x30')][_0x297f('0x29')]!=='user')return _0x326e17;return db['UserProfileSection']['find']({'where':{'name':_0x326e17['role']===_0x297f('0x2a')?_0x297f('0x31'):_0x297f('0x87'),'userProfileId':_0x20caea[_0x297f('0x30')][_0x297f('0x88')]},'raw':!![]})[_0x297f('0x16')](function(_0x25ca18){if(!_0x25ca18||_0x25ca18[_0x297f('0x89')]!=0x0)return _0x326e17;return db[_0x297f('0x38')]['create']({'name':_0x326e17[_0x297f('0x37')],'resourceId':_0x326e17['id'],'type':_0x25ca18[_0x297f('0x37')],'sectionId':_0x25ca18['id']},{})[_0x297f('0x16')](function(){return _0x326e17;});})[_0x297f('0x1f')](function(_0x2a4e27){logger[_0x297f('0x1b')](_0x297f('0x8a'),_0x2a4e27);throw _0x2a4e27;});})[_0x297f('0x16')](respondWithResult(_0x44479b,0xc9))[_0x297f('0x1f')](handleError(_0x44479b,null));};exports[_0x297f('0x8b')]=function(_0xc77f2c,_0x57315d){var _0x42f521=_0xc77f2c[_0x297f('0x60')];var _0x443dc5=[];if(_0xc77f2c[_0x297f('0x30')][_0x297f('0x29')]===_0x297f('0x2a'))throw new Error(_0x297f('0x8c'));if(_[_0x297f('0x8d')](_0x42f521,[_0x297f('0x29'),_0x297f('0x30')])&&_0xc77f2c['user']['role']!==_0x297f('0x2f')){throw new Error('Unauthorized.\x20You\x20must\x20be\x20an\x20administrator\x20in\x20order\x20to\x20create\x20an\x20user');}if(_['some'](_0x42f521,[_0x297f('0x29'),_0x297f('0x2f')])&&_0xc77f2c[_0x297f('0x30')]['role']!==_0x297f('0x2f')){throw new Error(_0x297f('0x8e'));}return licenseUtil[_0x297f('0x8f')](_0x42f521)[_0x297f('0x16')](function(){return validateUser(_0x42f521[0x0]);})[_0x297f('0x16')](function(){for(var _0x5dd2da=0x1;_0x5dd2da<_0x42f521[_0x297f('0x4f')];_0x5dd2da++){var _0x36c5d8=_0x42f521[_0x5dd2da-0x1]['internal'];if(!_0x42f521[_0x5dd2da][_0x297f('0x65')])_0x42f521[_0x5dd2da][_0x297f('0x65')]=_0x36c5d8+0x1;_0x443dc5[_0x297f('0x4c')](validateUser(_0x42f521[_0x5dd2da]));}return Promise[_0x297f('0x56')](_0x443dc5);})[_0x297f('0x16')](function(){_0x443dc5=[];for(var _0x4daea5=0x0;_0x4daea5<_0x42f521[_0x297f('0x4f')];_0x4daea5++){_0x443dc5[_0x297f('0x4c')](updateUser(_0x42f521[_0x4daea5]));}return Promise[_0x297f('0x56')](_0x443dc5);})['then'](function(){_0x443dc5=_0x42f521[_0x297f('0x34')](function(_0x2cda98){return db['User'][_0x297f('0x86')](_0x2cda98,{'include':[{'model':db[_0x297f('0x73')],'as':'VoiceMail'}]})['then'](function(_0x164919){_0x2cda98['id']=_0x164919['id'];return _0x2cda98;});});return Promise[_0x297f('0x56')](_0x443dc5);})[_0x297f('0x16')](function(_0x324a17){if(_0xc77f2c['body']['role']===_0x297f('0x30'))return _0x324a17;if(_0xc77f2c[_0x297f('0x30')]['role']!=='user')return _0x324a17;var _0x2a28ba=_[_0x297f('0x8d')](_0x324a17,function(_0x5b791c){return _0x5b791c[_0x297f('0x29')]==='agent'||_0x5b791c[_0x297f('0x29')]===_0x297f('0x90');});if(!_0x2a28ba)return _0x324a17;return db[_0x297f('0x91')][_0x297f('0x4d')]({'where':{'name':{'$or':[_0x297f('0x31'),'Telephones']},'userProfileId':_0xc77f2c['user']['userProfileId']},'raw':!![]})[_0x297f('0x16')](function(_0x1a712c){if(_[_0x297f('0x92')](_0x1a712c)||!_[_0x297f('0x8d')](_0x1a712c,[_0x297f('0x89'),0x0]))return _0x324a17;_0x443dc5=[];var _0x23fd74=_(_0x1a712c)[_0x297f('0x34')](function(_0x79b42b){if(_0x79b42b[_0x297f('0x89')]===0x1)return;return _0x79b42b[_0x297f('0x37')]==='Agents'?_0x297f('0x2a'):'telephone';})[_0x297f('0x93')]()[_0x297f('0x35')]();for(var _0x41ce03=0x0;_0x41ce03<_0x324a17[_0x297f('0x4f')];_0x41ce03++){if(!_['includes'](_0x23fd74,_0x324a17[_0x41ce03][_0x297f('0x29')]))return;var _0x3ffc13=_0x324a17[_0x41ce03][_0x297f('0x29')]===_0x297f('0x2a')?_0x297f('0x31'):_0x297f('0x87');_0x443dc5[_0x297f('0x4c')](db['UserProfileResource'][_0x297f('0x86')]({'name':_0x324a17[_0x41ce03][_0x297f('0x37')],'resourceId':_0x324a17[_0x41ce03]['id'],'type':_0x3ffc13,'sectionId':_['find'](_0x1a712c,[_0x297f('0x37'),_0x3ffc13])['id']},{}));}return Promise[_0x297f('0x56')](_0x443dc5);});})[_0x297f('0x16')](respondWithResult(_0x57315d,0xc9))['catch'](handleError(_0x57315d,null));};exports['changePassword']=function(_0x1e516d,_0x8db100){if(_0x1e516d[_0x297f('0x60')]['id']){delete _0x1e516d[_0x297f('0x60')]['id'];}return db[_0x297f('0x3d')][_0x297f('0x5f')]({'where':{'id':_0x1e516d[_0x297f('0x57')]['id']}})[_0x297f('0x16')](function(_0x2ac7c9){if(!_0x2ac7c9)return null;if(_0x2ac7c9['id']===_0x1e516d[_0x297f('0x30')]['id']){if(!_0x1e516d[_0x297f('0x60')][_0x297f('0x94')]||!_0x1e516d[_0x297f('0x60')]['newPassword']){throw new db[(_0x297f('0x95'))][(_0x297f('0x96'))](_0x297f('0x97'));}if(!_0x2ac7c9['authenticate'](_0x1e516d[_0x297f('0x60')][_0x297f('0x94')])){throw new db[(_0x297f('0x95'))][(_0x297f('0x96'))](_0x297f('0x98'));}if(_0x1e516d[_0x297f('0x60')]['oldPassword']===_0x1e516d['body'][_0x297f('0x99')]){throw new db[(_0x297f('0x95'))][(_0x297f('0x96'))](_0x297f('0x9a'));}}else if(_0x1e516d['user'][_0x297f('0x29')]===_0x297f('0x2f')){if(!_0x1e516d[_0x297f('0x60')][_0x297f('0x99')]){throw new db[(_0x297f('0x95'))][(_0x297f('0x96'))](_0x297f('0x9b'));}}else if(_0x1e516d[_0x297f('0x30')][_0x297f('0x29')]===_0x297f('0x30')){if(!_0x1e516d['body'][_0x297f('0x99')]){throw new db[(_0x297f('0x95'))][(_0x297f('0x96'))](_0x297f('0x9b'));}if(_0x2ac7c9['role']!==_0x297f('0x2a')){throw new db['Sequelize'][(_0x297f('0x96'))](_0x297f('0x8c'));}}else{throw new db[(_0x297f('0x95'))][(_0x297f('0x96'))](_0x297f('0x8c'));}return _0x2ac7c9;})[_0x297f('0x16')](handleEntityNotFound(_0x8db100,null))[_0x297f('0x16')](function(_0x263bb0){return db[_0x297f('0x66')][_0x297f('0x9c')]({'attributes':['id',_0x297f('0x67'),_0x297f('0x9d'),'passwordHistoryLimit']})[_0x297f('0x16')](function(_0x26af33){if(_0x26af33[_0x297f('0x67')])authService['validatePasswordPattern'](_0x1e516d[_0x297f('0x60')]['newPassword']);if(!_0x26af33[_0x297f('0x9d')]||!_0x263bb0[_0x297f('0x9e')])return _0x263bb0;authService[_0x297f('0x9f')](_0x1e516d['body']['newPassword'],_0x263bb0[_0x297f('0x9e')],_0x26af33['passwordHistoryLimit']);return _0x263bb0;})[_0x297f('0x16')](saveUpdates({'password':_0x1e516d[_0x297f('0x60')][_0x297f('0x99')],'passwordResetAt':_0x1e516d[_0x297f('0x30')]['id']==_0x1e516d[_0x297f('0x57')]['id']?moment():null,'previousPasswords':authService['updatePasswordsHistory'](_0x1e516d[_0x297f('0x60')][_0x297f('0x99')],_0x263bb0[_0x297f('0x9e')])},null));})['then'](respondWithResult(_0x8db100,null))[_0x297f('0x1f')](handleError(_0x8db100,null));};exports[_0x297f('0xa0')]=function(_0x398b7b,_0x2d93dc){var _0x329469=_0x398b7b[_0x297f('0x60')][_0x297f('0xa1')];return db[_0x297f('0x3d')][_0x297f('0x5f')]({'where':{'id':_0x398b7b[_0x297f('0x57')]['id']},'attributes':['id',_0x297f('0x37'),_0x297f('0x29'),_0x297f('0xa2'),'loginInPause',_0x297f('0xa3'),_0x297f('0xa4')]})[_0x297f('0x16')](handleEntityNotFound(_0x2d93dc,null))['then'](function(_0x2fe93f){if(_0x2fe93f){if(!utils[_0x297f('0xa5')](_0x329469)){throw new db[(_0x297f('0x95'))][(_0x297f('0x96'))](_0x297f('0xa6'));}return _0x2fe93f['add'+_['capitalize'](_0x329469['toLowerCase']())+_0x297f('0xa7')](_0x398b7b['body'][_0x297f('0x63')],{'penalty':_0x398b7b['body']['penalty']||0x0})[_0x297f('0xa8')](function(_0x3592d7){for(var _0x15696b=0x0;_0x15696b<_0x398b7b['body'][_0x297f('0x63')][_0x297f('0x4f')];_0x15696b+=0x1){var _0x5967b5={'UserId':Number(_0x398b7b[_0x297f('0x57')]['id'])};_0x5967b5[_[_0x297f('0xa9')](_0x329469['toLowerCase']())+_0x297f('0xaa')]=Number(_0x398b7b[_0x297f('0x60')]['ids'][_0x15696b]);socket[_0x297f('0x2b')]('user'+_[_0x297f('0xa9')](_0x329469[_0x297f('0xab')]())+_0x297f('0xac'),_0x5967b5);}return _0x3592d7;})['then'](function(){if(_0x329469==='voice'){return db[_0x297f('0xad')][_0x297f('0x4d')]({'where':{'id':_0x398b7b[_0x297f('0x60')][_0x297f('0x63')]||[]},'raw':!![],'attributes':['id',_0x297f('0x37')]});}})[_0x297f('0x16')](function(_0x36873e){var _0x44f43f=_0x2fe93f[_0x297f('0x2e')]({'plain':!![]});var _0x5bc29e=[];if(_0x329469===_0x297f('0xae')&&_0x44f43f[_0x297f('0x29')]===_0x297f('0x2a')&&_0x44f43f['online']){for(let _0x53b2be=0x0;_0x53b2be<_0x36873e[_0x297f('0x4f')];_0x53b2be+=0x1){_0x5bc29e['push']({'membername':_0x44f43f[_0x297f('0x37')],'UserId':_0x44f43f['id'],'queue_name':_0x36873e[_0x53b2be][_0x297f('0x37')],'VoiceQueueId':_0x36873e[_0x53b2be]['id'],'interface':_[_0x297f('0x6b')](_0x44f43f['interface'])?util[_0x297f('0xaf')](_0x297f('0xb0'),_0x44f43f[_0x297f('0x37')]):_0x44f43f[_0x297f('0xa4')],'paused':_0x44f43f[_0x297f('0xa3')]||![],'penalty':_0x398b7b[_0x297f('0x60')][_0x297f('0xb1')]||0x0});}return Promise[_0x297f('0x56')](_0x5bc29e['map'](function(_0x3c85ee){return db[_0x297f('0xb2')][_0x297f('0xb3')](_0x3c85ee);}));}return _0x2fe93f;});}})[_0x297f('0x16')](respondWithStatusCode(_0x2d93dc,null))[_0x297f('0x1f')](handleError(_0x2d93dc,null));};exports[_0x297f('0xb4')]=function(_0x2a20bd,_0x526b7e){var _0x384522,_0x4dad19;return db['User'][_0x297f('0x5f')]({'where':{'id':_0x2a20bd[_0x297f('0x57')]['id']},'attributes':['id',_0x297f('0x37'),_0x297f('0x29')]})[_0x297f('0x16')](handleEntityNotFound(_0x526b7e,null))['then'](function(_0x10e3f5){if(_0x10e3f5){_0x384522=_0x10e3f5;if(!_0x2a20bd[_0x297f('0x45')]['channel']||!utils[_0x297f('0xa5')](_0x2a20bd[_0x297f('0x45')][_0x297f('0xa1')])){throw new db['Sequelize'][(_0x297f('0x96'))](_0x297f('0xa6'));}return _0x10e3f5[_0x297f('0xb5')+_[_0x297f('0xa9')](_0x2a20bd['query']['channel'][_0x297f('0xab')]())+'Queues'](_0x2a20bd['query'][_0x297f('0x63')]);}})[_0x297f('0x16')](function(_0x2cdeb9){if(_[_0x297f('0xb6')](_0x2a20bd[_0x297f('0x45')][_0x297f('0x63')])){for(var _0x25cdd0=0x0;_0x25cdd0<_0x2a20bd[_0x297f('0x45')]['ids']['length'];_0x25cdd0+=0x1){_0x4dad19={'UserId':Number(_0x2a20bd[_0x297f('0x57')]['id'])};_0x4dad19[_[_0x297f('0xa9')](_0x2a20bd['query'][_0x297f('0xa1')]['toLowerCase']())+_0x297f('0xaa')]=Number(_0x2a20bd[_0x297f('0x45')][_0x297f('0x63')][_0x25cdd0]);socket[_0x297f('0x2b')](_0x297f('0x30')+_['capitalize'](_0x2a20bd[_0x297f('0x45')][_0x297f('0xa1')]['toLowerCase']())+_0x297f('0xb7'),_0x4dad19);}}else{_0x4dad19={'UserId':Number(_0x2a20bd[_0x297f('0x57')]['id'])};_0x4dad19[_[_0x297f('0xa9')](_0x2a20bd[_0x297f('0x45')][_0x297f('0xa1')][_0x297f('0xab')]())+_0x297f('0xaa')]=Number(_0x2a20bd[_0x297f('0x45')][_0x297f('0x63')]);socket[_0x297f('0x2b')](_0x297f('0x30')+_[_0x297f('0xa9')](_0x2a20bd['query'][_0x297f('0xa1')][_0x297f('0xab')]())+'Queue:remove',_0x4dad19);}return _0x2cdeb9;})['then'](function(){if(_0x2a20bd['query']['channel']===_0x297f('0xae')){return db[_0x297f('0xb2')]['destroy']({'where':{'UserId':_0x2a20bd[_0x297f('0x57')]['id'],'VoiceQueueId':_0x2a20bd[_0x297f('0x45')][_0x297f('0x63')]},'individualHooks':!![]})[_0x297f('0x16')](function(){return _0x384522;});}return _0x384522;})['then'](respondWithStatusCode(_0x526b7e,null))[_0x297f('0x1f')](handleError(_0x526b7e,null));};exports[_0x297f('0xb8')]=function(_0x470e4a,_0x3df382){_0x470e4a[_0x297f('0x60')][_0x297f('0xb9')]=_0x470e4a[_0x297f('0xba')][_0x297f('0xbb')];return db[_0x297f('0x3d')]['find']({'where':{'id':_0x470e4a[_0x297f('0x57')]['id']}})[_0x297f('0x16')](handleEntityNotFound(_0x3df382,null))['then'](saveUpdates(_0x470e4a[_0x297f('0x60')],null))[_0x297f('0x16')](respondWithResult(_0x3df382,null))[_0x297f('0x1f')](handleError(_0x3df382,null));};exports['getAvatar']=function(_0x2a4736,_0x40b341){var _0xd8fab6=path['join'](config['root'],_0x297f('0xbc'));return db['User'][_0x297f('0x5f')]({'where':{'id':_0x2a4736[_0x297f('0x57')]['id']},'attributes':['id',_0x297f('0xb9')],'raw':!![]})[_0x297f('0x16')](handleEntityNotFound(_0x40b341,null))[_0x297f('0x16')](function(_0x2c6c2e){if(_0x2c6c2e){if(_[_0x297f('0x6b')](_0x2c6c2e[_0x297f('0xb9')])){return _0x40b341[_0x297f('0xbd')](_0xd8fab6);}else{if(!fs[_0x297f('0xbe')](path['join'](config['root'],'server/files/images/',_0x2c6c2e[_0x297f('0xb9')]))){return _0x40b341[_0x297f('0xbd')](_0xd8fab6);}return _0x40b341[_0x297f('0xbd')](path['join'](config[_0x297f('0xbf')],_0x297f('0xc0'),_0x2c6c2e['userpic']));}}})[_0x297f('0x1f')](handleError(_0x40b341,null));};exports[_0x297f('0xc1')]=function(_0x519088,_0x1712fe){return db[_0x297f('0x3d')][_0x297f('0x5f')]({'where':{'id':_0x519088[_0x297f('0x57')]['id']},'attributes':['id']})['then'](handleEntityNotFound(_0x1712fe,null))[_0x297f('0x16')](function(_0x1f1fe2){var _0x34c9f3=[];values=_0x1f1fe2[_0x297f('0x51')];_0x34c9f3[_0x297f('0x4c')](get_open_tabs(_0x297f('0x50'),_0x1f1fe2[_0x297f('0x51')]));_0x34c9f3[_0x297f('0x4c')](get_open_tabs(_0x297f('0x52'),_0x1f1fe2[_0x297f('0x51')]));_0x34c9f3[_0x297f('0x4c')](get_open_tabs(_0x297f('0x54'),_0x1f1fe2[_0x297f('0x51')]));_0x34c9f3['push'](get_open_tabs(_0x297f('0x55'),_0x1f1fe2[_0x297f('0x51')]));_0x34c9f3[_0x297f('0x4c')](get_open_tabs(_0x297f('0xc2'),_0x1f1fe2[_0x297f('0x51')]));_0x34c9f3[_0x297f('0x4c')](get_open_tabs(_0x297f('0x53'),_0x1f1fe2[_0x297f('0x51')]));return Promise['all'](_0x34c9f3);})[_0x297f('0x16')](function(_0x3f4d2d){if(_0x3f4d2d){var _0x10f5f8=_[_0x297f('0x34')](values[_0x297f('0xc3')],function(_0x12c09d){return{'channel':'CHAT','id':_0x12c09d['id'],'createdAt':_0x12c09d[_0x297f('0xc4')]};});var _0x4ab856=_['map'](values['FaxOpenTabs'],function(_0x85a90c){return{'channel':_0x297f('0xc5'),'id':_0x85a90c['id'],'createdAt':_0x85a90c['createdAt']};});var _0xacdf42=_[_0x297f('0x34')](values[_0x297f('0xc6')],function(_0x434556){return{'channel':'OPENCHANNEL','id':_0x434556['id'],'createdAt':_0x434556[_0x297f('0xc4')]};});var _0x4db2e5=_[_0x297f('0x34')](values['MailOpenTabs'],function(_0x4f22a3){return{'channel':'MAIL','id':_0x4f22a3['id'],'createdAt':_0x4f22a3[_0x297f('0xc4')]};});var _0x413c92=_[_0x297f('0x34')](values[_0x297f('0xc7')],function(_0x2ff687){return{'channel':_0x297f('0xc8'),'id':_0x2ff687['id'],'createdAt':_0x2ff687[_0x297f('0xc4')]};});var _0x5c31ab=_[_0x297f('0x34')](values[_0x297f('0xc9')],function(_0x396a73){return{'channel':'WHATSAPP','id':_0x396a73['id'],'createdAt':_0x396a73['createdAt']};});var _0x884136=_[_0x297f('0xca')](_0x10f5f8,_0x4ab856,_0xacdf42,_0x4db2e5,_0x413c92,_0x5c31ab);var _0x35fa80={'count':_0x884136['length'],'rows':_0x884136};return _0x35fa80;}else return null;})['then'](respondWithResult(_0x1712fe,null))[_0x297f('0x1f')](handleError(_0x1712fe,null));};exports[_0x297f('0xcb')]=function(_0x2cbc5e,_0x48ec41){var _0x3eac50={};return db[_0x297f('0x3d')][_0x297f('0x9c')]({'where':{'id':_0x2cbc5e[_0x297f('0x57')]['id']}})[_0x297f('0x16')](function(_0x320cc5){if(!_0x320cc5){throw new APINotFoundError(util[_0x297f('0xaf')](_0x297f('0xcc'),_0x2cbc5e[_0x297f('0x57')]['id']));}return contacts['describe']();})[_0x297f('0x16')](function(_0x109d59){_0x2cbc5e['query']['User']=_0x2cbc5e[_0x297f('0x57')]['id'];_0x3eac50=qs['getOptions'](_0x109d59,_0x2cbc5e);if(_0x2cbc5e['query'][_0x297f('0xcd')](_0x297f('0x46'))){_0x3eac50[_0x297f('0x47')]=[{'model':db[_0x297f('0xce')],'as':_0x297f('0xcf'),'required':![]},{'model':db[_0x297f('0xd0')],'as':_0x297f('0xd1'),'attributes':['id',_0x297f('0x37'),_0x297f('0xd2')],'where':_0x2cbc5e['query'][_0x297f('0xd3')]?{'id':_0x2cbc5e[_0x297f('0x45')]['tag']}:undefined,'required':_0x2cbc5e[_0x297f('0x45')][_0x297f('0xd3')]?!![]:![]}];}return contacts['findAll'](_0x2cbc5e[_0x297f('0x45')],_0x2cbc5e['user'],_0x3eac50,_0x109d59);})[_0x297f('0x16')](respondWithFilteredResult(_0x48ec41,_0x3eac50))[_0x297f('0x1f')](APIHandleError(_0x48ec41));};exports[_0x297f('0xd4')]=function(_0x4e28bf,_0xe51c33){var _0x54502e;var _0x3fd974={};var _0x43b219;return db[_0x297f('0x3d')][_0x297f('0x9c')]({'where':{'id':_0x4e28bf['params']['id']},'attributes':['id',_0x297f('0x37'),_0x297f('0x29')]})[_0x297f('0x16')](handleEntityNotFound(_0xe51c33,null))[_0x297f('0x16')](function(_0x42b62d){if(!utils[_0x297f('0xa5')](_0x4e28bf[_0x297f('0x45')][_0x297f('0xa1')])){throw new db[(_0x297f('0x95'))][(_0x297f('0x96'))](_0x297f('0xa6'));}_0x54502e=_0x42b62d;var _0x23a9b8={};_0x23a9b8[_0x297f('0x5c')]=_['keys'](db[_[_0x297f('0xa9')](_0x4e28bf[_0x297f('0x45')][_0x297f('0xa1')])+_0x297f('0xd5')][_0x297f('0x3e')]);_0x23a9b8[_0x297f('0x45')]=_[_0x297f('0x59')](_0x4e28bf[_0x297f('0x45')]);_0x23a9b8[_0x297f('0x5a')]=_['intersection'](_0x23a9b8['model'],_0x23a9b8[_0x297f('0x45')]);_0x3fd974[_0x297f('0x4b')]=_['intersection'](_0x23a9b8[_0x297f('0x5c')],qs['fields'](_0x4e28bf[_0x297f('0x45')][_0x297f('0x5d')]));_0x3fd974[_0x297f('0x4b')]=_0x3fd974['attributes']['length']?_0x3fd974['attributes']:_0x23a9b8['model'];_0x3fd974['order']=qs[_0x297f('0xd6')](_0x4e28bf[_0x297f('0x45')][_0x297f('0xd6')]);_0x3fd974[_0x297f('0x44')]=qs[_0x297f('0x5a')](_[_0x297f('0xd7')](_0x4e28bf[_0x297f('0x45')],_0x23a9b8[_0x297f('0x5a')]));if(_0x4e28bf[_0x297f('0x45')][_0x297f('0x32')]){_0x3fd974['where']=_[_0x297f('0x5e')](_0x3fd974[_0x297f('0x44')],{'$or':_[_0x297f('0x34')](_0x3fd974[_0x297f('0x4b')],function(_0x4759c8){var _0x107aac={};_0x107aac[_0x4759c8]={'$like':'%'+_0x4e28bf[_0x297f('0x45')][_0x297f('0x32')]+'%'};return _0x107aac;})});}_0x3fd974=_[_0x297f('0x5e')]({},_0x3fd974,_0x4e28bf['options']);switch(_0x54502e['role']){case _0x297f('0x2f'):return db[_[_0x297f('0xa9')](_0x4e28bf[_0x297f('0x45')]['channel'])+_0x297f('0xd5')][_0x297f('0x4d')](_0x3fd974);case _0x297f('0x30'):case _0x297f('0x2a'):return _0x54502e['get'+_[_0x297f('0xa9')](_0x4e28bf['query'][_0x297f('0xa1')])+_0x297f('0xa7')](_0x3fd974);default:throw new db[(_0x297f('0x95'))]['ValidationError'](_0x297f('0xd8'));}})[_0x297f('0x16')](function(_0x355a79){_0x43b219=_0x355a79[_0x297f('0x4f')];if(!_0x4e28bf[_0x297f('0x45')]['hasOwnProperty'](_0x297f('0xd9'))){_0x3fd974[_0x297f('0x25')]=qs['limit'](_0x4e28bf[_0x297f('0x45')]['limit']);_0x3fd974['offset']=qs['offset'](_0x4e28bf[_0x297f('0x45')][_0x297f('0x23')]);}switch(_0x54502e[_0x297f('0x29')]){case'admin':return db[_[_0x297f('0xa9')](_0x4e28bf['query']['channel'])+_0x297f('0xd5')][_0x297f('0x4d')](_0x3fd974);case _0x297f('0x30'):case _0x297f('0x2a'):return _0x54502e[_0x297f('0x2e')+_[_0x297f('0xa9')](_0x4e28bf['query'][_0x297f('0xa1')])+_0x297f('0xa7')](_0x3fd974);}})[_0x297f('0x16')](function(_0x1c11ce){return{'count':_0x43b219,'rows':_0x1c11ce};})['then'](respondWithResult(_0xe51c33,null))[_0x297f('0x1f')](handleError(_0xe51c33,null));};exports[_0x297f('0xda')]=function(_0x3cefc3,_0x595d81){var _0x503ce3={};var _0x6416b9={};var _0x30dbb3;var _0x18be0a;return db[_0x297f('0x3d')]['findOne']({'where':{'id':_0x3cefc3[_0x297f('0x57')]['id']}})[_0x297f('0x16')](handleEntityNotFound(_0x595d81,null))[_0x297f('0x16')](function(_0x269d91){if(_0x269d91){_0x30dbb3=_0x269d91;_0x6416b9[_0x297f('0x5c')]=_['keys'](db[_0x297f('0xb2')]['rawAttributes']);_0x6416b9[_0x297f('0x45')]=_[_0x297f('0x59')](_0x3cefc3['query']);_0x6416b9[_0x297f('0x5a')]=_[_0x297f('0x5b')](_0x6416b9[_0x297f('0x5c')],_0x6416b9[_0x297f('0x45')]);_0x503ce3[_0x297f('0x4b')]=_[_0x297f('0x5b')](_0x6416b9[_0x297f('0x5c')],qs[_0x297f('0x5d')](_0x3cefc3['query'][_0x297f('0x5d')]));_0x503ce3['attributes']=_0x503ce3[_0x297f('0x4b')][_0x297f('0x4f')]?_0x503ce3[_0x297f('0x4b')]:_0x6416b9[_0x297f('0x5c')];_0x503ce3[_0x297f('0xdb')]=qs[_0x297f('0xd6')](_0x3cefc3['query']['sort']);_0x503ce3[_0x297f('0x44')]=qs['filters'](_[_0x297f('0xd7')](_0x3cefc3['query'],_0x6416b9[_0x297f('0x5a')]));if(_0x3cefc3[_0x297f('0x45')]['filter']){_0x503ce3[_0x297f('0x44')]=_[_0x297f('0x5e')](_0x503ce3[_0x297f('0x44')],{'$or':_[_0x297f('0x34')](_0x503ce3['attributes'],function(_0x393d08){var _0x2fa73e={};_0x2fa73e[_0x393d08]={'$like':'%'+_0x3cefc3[_0x297f('0x45')][_0x297f('0x32')]+'%'};return _0x2fa73e;})});}_0x503ce3=_['merge']({},_0x503ce3,_0x3cefc3[_0x297f('0xdc')]);return _0x30dbb3[_0x297f('0xda')](_0x503ce3);}})[_0x297f('0x16')](function(_0x5654ab){if(_0x5654ab){_0x18be0a=_0x5654ab[_0x297f('0x4f')];if(!_0x3cefc3['query'][_0x297f('0xcd')]('nolimit')){_0x503ce3[_0x297f('0x25')]=qs[_0x297f('0x25')](_0x3cefc3[_0x297f('0x45')][_0x297f('0x25')]);_0x503ce3['offset']=qs[_0x297f('0x23')](_0x3cefc3['query'][_0x297f('0x23')]);}return _0x30dbb3[_0x297f('0xda')](_0x503ce3);}})[_0x297f('0x16')](function(_0x46dc05){if(_0x46dc05){return _0x46dc05?{'count':_0x18be0a,'rows':_0x46dc05}:null;}})[_0x297f('0x16')](respondWithResult(_0x595d81,null))['catch'](handleError(_0x595d81,null));};exports[_0x297f('0xdd')]=function(_0x2b36cf,_0x5d947e){var _0x152256={};var _0x139a4d={};var _0x3cee50;var _0x12b6c6;return db[_0x297f('0x3d')][_0x297f('0x9c')]({'where':{'id':_0x2b36cf[_0x297f('0x57')]['id']}})[_0x297f('0x16')](handleEntityNotFound(_0x5d947e,null))['then'](function(_0x5701ac){if(_0x5701ac){_0x3cee50=_0x5701ac;_0x139a4d[_0x297f('0x5c')]=_['keys'](db[_0x297f('0xde')][_0x297f('0x3e')]);_0x139a4d['query']=_[_0x297f('0x59')](_0x2b36cf['query']);_0x139a4d[_0x297f('0x5a')]=_[_0x297f('0x5b')](_0x139a4d[_0x297f('0x5c')],_0x139a4d[_0x297f('0x45')]);_0x152256[_0x297f('0x4b')]=_[_0x297f('0x5b')](_0x139a4d[_0x297f('0x5c')],qs[_0x297f('0x5d')](_0x2b36cf[_0x297f('0x45')][_0x297f('0x5d')]));_0x152256[_0x297f('0x4b')]=_0x152256[_0x297f('0x4b')][_0x297f('0x4f')]?_0x152256[_0x297f('0x4b')]:_0x139a4d[_0x297f('0x5c')];_0x152256[_0x297f('0xdb')]=qs['sort'](_0x2b36cf[_0x297f('0x45')][_0x297f('0xd6')]);_0x152256['where']=qs[_0x297f('0x5a')](_[_0x297f('0xd7')](_0x2b36cf['query'],_0x139a4d[_0x297f('0x5a')]));if(_0x2b36cf[_0x297f('0x45')][_0x297f('0x32')]){_0x152256[_0x297f('0x44')]=_[_0x297f('0x5e')](_0x152256['where'],{'$or':_['map'](_0x152256['attributes'],function(_0xb4dd44){var _0x63b6d={};_0x63b6d[_0xb4dd44]={'$like':'%'+_0x2b36cf[_0x297f('0x45')]['filter']+'%'};return _0x63b6d;})});}_0x152256=_[_0x297f('0x5e')]({},_0x152256,_0x2b36cf[_0x297f('0xdc')]);return _0x3cee50[_0x297f('0xdd')](_0x152256);}})['then'](function(_0x52ccc5){if(_0x52ccc5){_0x12b6c6=_0x52ccc5[_0x297f('0x4f')];if(!_0x2b36cf['query'][_0x297f('0xcd')]('nolimit')){_0x152256[_0x297f('0x25')]=qs[_0x297f('0x25')](_0x2b36cf[_0x297f('0x45')]['limit']);_0x152256[_0x297f('0x23')]=qs['offset'](_0x2b36cf[_0x297f('0x45')]['offset']);}return _0x3cee50['getGroups'](_0x152256);}})['then'](function(_0x15d8bd){if(_0x15d8bd){return _0x15d8bd?{'count':_0x12b6c6,'rows':_0x15d8bd}:null;}})[_0x297f('0x16')](respondWithResult(_0x5d947e,null))[_0x297f('0x1f')](handleError(_0x5d947e,null));};exports[_0x297f('0xdf')]=function(_0x333105,_0x49208c){var _0x51467e={'raw':!![],'where':{}};var _0x337c74={};var _0x11c5b8={'count':0x0,'rows':[]};return db[_0x297f('0x3d')][_0x297f('0x9c')]({'where':{'id':_0x333105['params']['id']}})[_0x297f('0x16')](handleEntityNotFound(_0x49208c,null))[_0x297f('0x16')](function(_0x57d50e){if(_0x57d50e){_0x337c74[_0x297f('0x5c')]=_[_0x297f('0x59')](db[_0x297f('0xe0')][_0x297f('0x3e')]);_0x337c74[_0x297f('0x45')]=_[_0x297f('0x59')](_0x333105[_0x297f('0x45')]);_0x337c74[_0x297f('0x5a')]=_[_0x297f('0x5b')](_0x337c74[_0x297f('0x5c')],_0x337c74[_0x297f('0x45')]);_0x51467e[_0x297f('0x4b')]=_[_0x297f('0x5b')](_0x337c74[_0x297f('0x5c')],qs[_0x297f('0x5d')](_0x333105[_0x297f('0x45')][_0x297f('0x5d')]));_0x51467e[_0x297f('0x4b')]=_0x51467e[_0x297f('0x4b')][_0x297f('0x4f')]?_0x51467e[_0x297f('0x4b')]:_0x337c74[_0x297f('0x5c')];if(!_0x333105['query'][_0x297f('0xcd')](_0x297f('0xd9'))){_0x51467e['limit']=qs['limit'](_0x333105[_0x297f('0x45')][_0x297f('0x25')]);_0x51467e[_0x297f('0x23')]=qs[_0x297f('0x23')](_0x333105[_0x297f('0x45')]['offset']);}_0x51467e[_0x297f('0xdb')]=qs['sort'](_0x333105[_0x297f('0x45')][_0x297f('0xd6')]);_0x51467e[_0x297f('0x44')]=qs['filters'](_[_0x297f('0xd7')](_0x333105[_0x297f('0x45')],_0x337c74['filters']));_0x51467e[_0x297f('0x44')][_0x297f('0xe1')]=_0x57d50e['id'];if(_0x333105[_0x297f('0x45')]['filter']){_0x51467e['where']=_[_0x297f('0x5e')](_0x51467e[_0x297f('0x44')],{'$or':_[_0x297f('0x34')](_0x51467e[_0x297f('0x4b')],function(_0x317fb9){var _0x2eda69={};_0x2eda69[_0x317fb9]={'$like':'%'+_0x333105['query'][_0x297f('0x32')]+'%'};return _0x2eda69;})});}_0x51467e=_[_0x297f('0x5e')]({},_0x51467e,_0x333105[_0x297f('0xdc')]);return db['VoiceRecording'][_0x297f('0x26')]({'where':_0x51467e[_0x297f('0x44')]})[_0x297f('0x16')](function(_0x528a0d){_0x11c5b8[_0x297f('0x26')]=_0x528a0d;if(_0x333105['query'][_0x297f('0x46')]){_0x51467e[_0x297f('0x47')]=[{'all':!![]}];}return db[_0x297f('0xe0')]['findAll'](_0x51467e);})[_0x297f('0x16')](function(_0x109bd8){_0x11c5b8[_0x297f('0x4e')]=_0x109bd8;return _0x11c5b8;});}})[_0x297f('0x16')](respondWithFilteredResult(_0x49208c,_0x51467e))[_0x297f('0x1f')](handleError(_0x49208c,null));};exports[_0x297f('0xe2')]=function(_0x1c4121,_0x2cf837){var _0x12e5b1={'raw':!![],'where':{}};var _0x34fd84={};var _0x2cf2b3={'count':0x0,'rows':[]};return db[_0x297f('0x3d')][_0x297f('0x9c')]({'where':{'id':_0x1c4121[_0x297f('0x57')]['id']}})[_0x297f('0x16')](handleEntityNotFound(_0x2cf837,null))['then'](function(_0x156654){if(_0x156654){_0x34fd84[_0x297f('0x5c')]=_['keys'](db[_0x297f('0xe3')][_0x297f('0x3e')]);_0x34fd84[_0x297f('0x45')]=_['keys'](_0x1c4121[_0x297f('0x45')]);_0x34fd84['filters']=_['intersection'](_0x34fd84[_0x297f('0x5c')],_0x34fd84[_0x297f('0x45')]);_0x12e5b1[_0x297f('0x4b')]=_[_0x297f('0x5b')](_0x34fd84[_0x297f('0x5c')],qs[_0x297f('0x5d')](_0x1c4121[_0x297f('0x45')][_0x297f('0x5d')]));_0x12e5b1['attributes']=_0x12e5b1[_0x297f('0x4b')][_0x297f('0x4f')]?_0x12e5b1['attributes']:_0x34fd84[_0x297f('0x5c')];if(!_0x1c4121[_0x297f('0x45')][_0x297f('0xcd')](_0x297f('0xd9'))){_0x12e5b1['limit']=qs[_0x297f('0x25')](_0x1c4121['query']['limit']);_0x12e5b1[_0x297f('0x23')]=qs[_0x297f('0x23')](_0x1c4121[_0x297f('0x45')][_0x297f('0x23')]);}_0x12e5b1[_0x297f('0xdb')]=qs[_0x297f('0xd6')](_0x1c4121['query'][_0x297f('0xd6')]);_0x12e5b1[_0x297f('0x44')]=qs[_0x297f('0x5a')](_['pick'](_0x1c4121['query'],_0x34fd84[_0x297f('0x5a')]));_0x12e5b1[_0x297f('0x44')][_0x297f('0xe1')]=_0x156654['id'];if(_0x1c4121[_0x297f('0x45')][_0x297f('0x32')]){_0x12e5b1[_0x297f('0x44')]=_[_0x297f('0x5e')](_0x12e5b1[_0x297f('0x44')],{'$or':_[_0x297f('0x34')](_0x12e5b1[_0x297f('0x4b')],function(_0x1ffc11){var _0x500769={};_0x500769[_0x1ffc11]={'$like':'%'+_0x1c4121[_0x297f('0x45')][_0x297f('0x32')]+'%'};return _0x500769;})});}_0x12e5b1=_[_0x297f('0x5e')]({},_0x12e5b1,_0x1c4121[_0x297f('0xdc')]);return db[_0x297f('0xe3')][_0x297f('0x26')]({'where':_0x12e5b1[_0x297f('0x44')]})[_0x297f('0x16')](function(_0x2565dd){_0x2cf2b3[_0x297f('0x26')]=_0x2565dd;if(_0x1c4121[_0x297f('0x45')]['includeAll']){_0x12e5b1['include']=[{'all':!![]}];}return db[_0x297f('0xe3')][_0x297f('0x4d')](_0x12e5b1);})[_0x297f('0x16')](function(_0x10b214){_0x2cf2b3[_0x297f('0x4e')]=_0x10b214;return _0x2cf2b3;});}})[_0x297f('0x16')](respondWithFilteredResult(_0x2cf837,_0x12e5b1))[_0x297f('0x1f')](handleError(_0x2cf837,null));};exports[_0x297f('0xe4')]=function(_0x2a17aa,_0x484fb1){var _0x492fa9={};var _0x20cad1={};var _0x5dc31b;var _0x10e73b;return db['User']['findOne']({'where':{'id':_0x2a17aa[_0x297f('0x57')]['id']}})[_0x297f('0x16')](handleEntityNotFound(_0x484fb1,null))[_0x297f('0x16')](function(_0x5bd77d){if(_0x5bd77d){_0x5dc31b=_0x5bd77d;_0x20cad1['model']=_[_0x297f('0x59')](db['ChatInteraction']['rawAttributes']);_0x20cad1[_0x297f('0x45')]=_[_0x297f('0x59')](_0x2a17aa[_0x297f('0x45')]);_0x20cad1[_0x297f('0x5a')]=_['intersection'](_0x20cad1[_0x297f('0x5c')],_0x20cad1[_0x297f('0x45')]);_0x492fa9['attributes']=_[_0x297f('0x5b')](_0x20cad1['model'],qs[_0x297f('0x5d')](_0x2a17aa[_0x297f('0x45')][_0x297f('0x5d')]));_0x492fa9[_0x297f('0x4b')]=_0x492fa9['attributes']['length']?_0x492fa9[_0x297f('0x4b')]:_0x20cad1[_0x297f('0x5c')];_0x492fa9[_0x297f('0xdb')]=qs[_0x297f('0xd6')](_0x2a17aa['query']['sort']);_0x492fa9['where']=qs[_0x297f('0x5a')](_[_0x297f('0xd7')](_0x2a17aa[_0x297f('0x45')],_0x20cad1[_0x297f('0x5a')]));if(_0x2a17aa[_0x297f('0x45')][_0x297f('0x32')]){_0x492fa9['where']=_[_0x297f('0x5e')](_0x492fa9[_0x297f('0x44')],{'$or':_[_0x297f('0x34')](_0x492fa9[_0x297f('0x4b')],function(_0x4670e0){var _0x38383b={};_0x38383b[_0x4670e0]={'$like':'%'+_0x2a17aa['query']['filter']+'%'};return _0x38383b;})});}_0x492fa9=_[_0x297f('0x5e')]({},_0x492fa9,_0x2a17aa[_0x297f('0xdc')]);return _0x5dc31b['getChatInteractions'](_0x492fa9);}})[_0x297f('0x16')](function(_0x4a64c7){if(_0x4a64c7){_0x10e73b=_0x4a64c7['length'];if(!_0x2a17aa[_0x297f('0x45')]['hasOwnProperty'](_0x297f('0xd9'))){_0x492fa9['limit']=qs[_0x297f('0x25')](_0x2a17aa[_0x297f('0x45')][_0x297f('0x25')]);_0x492fa9[_0x297f('0x23')]=qs[_0x297f('0x23')](_0x2a17aa[_0x297f('0x45')][_0x297f('0x23')]);}return _0x5dc31b[_0x297f('0xe4')](_0x492fa9);}})[_0x297f('0x16')](function(_0x193071){if(_0x193071){return _0x193071?{'count':_0x10e73b,'rows':_0x193071}:null;}})[_0x297f('0x16')](respondWithResult(_0x484fb1,null))[_0x297f('0x1f')](handleError(_0x484fb1,null));};exports['getOpenchannelInteractions']=function(_0x2ed24d,_0x2f68da){var _0x308bc5={};var _0x36080a={};var _0xbfa33c;var _0x2c5c27;return db[_0x297f('0x3d')][_0x297f('0x9c')]({'where':{'id':_0x2ed24d[_0x297f('0x57')]['id']}})[_0x297f('0x16')](handleEntityNotFound(_0x2f68da,null))['then'](function(_0x4c8250){if(_0x4c8250){_0xbfa33c=_0x4c8250;_0x36080a['model']=_['keys'](db['OpenchannelInteraction']['rawAttributes']);_0x36080a[_0x297f('0x45')]=_[_0x297f('0x59')](_0x2ed24d[_0x297f('0x45')]);_0x36080a[_0x297f('0x5a')]=_[_0x297f('0x5b')](_0x36080a[_0x297f('0x5c')],_0x36080a['query']);_0x308bc5[_0x297f('0x4b')]=_[_0x297f('0x5b')](_0x36080a['model'],qs[_0x297f('0x5d')](_0x2ed24d[_0x297f('0x45')][_0x297f('0x5d')]));_0x308bc5[_0x297f('0x4b')]=_0x308bc5['attributes'][_0x297f('0x4f')]?_0x308bc5[_0x297f('0x4b')]:_0x36080a['model'];_0x308bc5['order']=qs[_0x297f('0xd6')](_0x2ed24d[_0x297f('0x45')][_0x297f('0xd6')]);_0x308bc5['where']=qs[_0x297f('0x5a')](_[_0x297f('0xd7')](_0x2ed24d[_0x297f('0x45')],_0x36080a['filters']));if(_0x2ed24d[_0x297f('0x45')][_0x297f('0x32')]){_0x308bc5['where']=_[_0x297f('0x5e')](_0x308bc5[_0x297f('0x44')],{'$or':_[_0x297f('0x34')](_0x308bc5[_0x297f('0x4b')],function(_0x123670){var _0x911dc6={};_0x911dc6[_0x123670]={'$like':'%'+_0x2ed24d[_0x297f('0x45')]['filter']+'%'};return _0x911dc6;})});}_0x308bc5=_['merge']({},_0x308bc5,_0x2ed24d[_0x297f('0xdc')]);return _0xbfa33c[_0x297f('0xe5')](_0x308bc5);}})['then'](function(_0x447fc3){if(_0x447fc3){_0x2c5c27=_0x447fc3[_0x297f('0x4f')];if(!_0x2ed24d[_0x297f('0x45')][_0x297f('0xcd')](_0x297f('0xd9'))){_0x308bc5['limit']=qs[_0x297f('0x25')](_0x2ed24d['query']['limit']);_0x308bc5[_0x297f('0x23')]=qs[_0x297f('0x23')](_0x2ed24d[_0x297f('0x45')][_0x297f('0x23')]);}return _0xbfa33c[_0x297f('0xe5')](_0x308bc5);}})['then'](function(_0x9903c4){if(_0x9903c4){return _0x9903c4?{'count':_0x2c5c27,'rows':_0x9903c4}:null;}})[_0x297f('0x16')](respondWithResult(_0x2f68da,null))['catch'](handleError(_0x2f68da,null));};exports['getMailInteractions']=function(_0x1cf12a,_0x4e5346){var _0x215abe={'raw':!![],'where':{}};var _0x32ae6d={};var _0x38a195={'count':0x0,'rows':[]};return db[_0x297f('0x3d')]['findOne']({'where':{'id':_0x1cf12a[_0x297f('0x57')]['id']}})[_0x297f('0x16')](handleEntityNotFound(_0x4e5346,null))[_0x297f('0x16')](function(_0x4f91d7){if(_0x4f91d7){_0x32ae6d['model']=_[_0x297f('0x59')](db[_0x297f('0xe6')][_0x297f('0x3e')]);_0x32ae6d[_0x297f('0x45')]=_[_0x297f('0x59')](_0x1cf12a['query']);_0x32ae6d['filters']=_[_0x297f('0x5b')](_0x32ae6d[_0x297f('0x5c')],_0x32ae6d['query']);_0x215abe[_0x297f('0x4b')]=_[_0x297f('0x5b')](_0x32ae6d[_0x297f('0x5c')],qs[_0x297f('0x5d')](_0x1cf12a['query'][_0x297f('0x5d')]));_0x215abe[_0x297f('0x4b')]=_0x215abe[_0x297f('0x4b')][_0x297f('0x4f')]?_0x215abe[_0x297f('0x4b')]:_0x32ae6d[_0x297f('0x5c')];if(!_0x1cf12a[_0x297f('0x45')]['hasOwnProperty']('nolimit')){_0x215abe[_0x297f('0x25')]=qs[_0x297f('0x25')](_0x1cf12a[_0x297f('0x45')]['limit']);_0x215abe[_0x297f('0x23')]=qs[_0x297f('0x23')](_0x1cf12a[_0x297f('0x45')][_0x297f('0x23')]);}_0x215abe[_0x297f('0xdb')]=qs[_0x297f('0xd6')](_0x1cf12a[_0x297f('0x45')][_0x297f('0xd6')]);_0x215abe[_0x297f('0x44')]=qs[_0x297f('0x5a')](_['pick'](_0x1cf12a[_0x297f('0x45')],_0x32ae6d[_0x297f('0x5a')]));_0x215abe['where'][_0x297f('0xe1')]=_0x4f91d7['id'];if(_0x1cf12a['query'][_0x297f('0x32')]){_0x215abe[_0x297f('0x44')]=_[_0x297f('0x5e')](_0x215abe[_0x297f('0x44')],{'$or':_[_0x297f('0x34')](_0x215abe['attributes'],function(_0x560fcb){var _0x9c037={};_0x9c037[_0x560fcb]={'$like':'%'+_0x1cf12a[_0x297f('0x45')][_0x297f('0x32')]+'%'};return _0x9c037;})});}_0x215abe=_[_0x297f('0x5e')]({},_0x215abe,_0x1cf12a[_0x297f('0xdc')]);return db[_0x297f('0xe6')][_0x297f('0x26')]({'where':_0x215abe[_0x297f('0x44')]})[_0x297f('0x16')](function(_0x3b33ee){_0x38a195[_0x297f('0x26')]=_0x3b33ee;if(_0x1cf12a[_0x297f('0x45')][_0x297f('0x46')]){_0x215abe[_0x297f('0x47')]=[{'all':!![]}];}return db[_0x297f('0xe6')][_0x297f('0x4d')](_0x215abe);})[_0x297f('0x16')](function(_0x1d7c86){_0x38a195[_0x297f('0x4e')]=_0x1d7c86;return _0x38a195;});}})['then'](respondWithFilteredResult(_0x4e5346,_0x215abe))['catch'](handleError(_0x4e5346,null));};exports[_0x297f('0xe7')]=function(_0x50d505,_0x32a448){var _0x13faea={};var _0x4e6344={};var _0x182adc;var _0x48e2f3;return db['User']['findOne']({'where':{'id':_0x50d505[_0x297f('0x57')]['id']}})[_0x297f('0x16')](handleEntityNotFound(_0x32a448,null))['then'](function(_0x559c37){if(_0x559c37){_0x182adc=_0x559c37;_0x4e6344[_0x297f('0x5c')]=_[_0x297f('0x59')](db[_0x297f('0xe8')][_0x297f('0x3e')]);_0x4e6344[_0x297f('0x45')]=_[_0x297f('0x59')](_0x50d505['query']);_0x4e6344[_0x297f('0x5a')]=_['intersection'](_0x4e6344[_0x297f('0x5c')],_0x4e6344[_0x297f('0x45')]);_0x13faea[_0x297f('0x4b')]=_[_0x297f('0x5b')](_0x4e6344[_0x297f('0x5c')],qs[_0x297f('0x5d')](_0x50d505[_0x297f('0x45')][_0x297f('0x5d')]));_0x13faea[_0x297f('0x4b')]=_0x13faea[_0x297f('0x4b')]['length']?_0x13faea[_0x297f('0x4b')]:_0x4e6344[_0x297f('0x5c')];_0x13faea[_0x297f('0xdb')]=qs['sort'](_0x50d505[_0x297f('0x45')][_0x297f('0xd6')]);_0x13faea[_0x297f('0x44')]=qs[_0x297f('0x5a')](_['pick'](_0x50d505[_0x297f('0x45')],_0x4e6344['filters']));if(_0x50d505[_0x297f('0x45')][_0x297f('0x32')]){_0x13faea['where']=_[_0x297f('0x5e')](_0x13faea['where'],{'$or':_[_0x297f('0x34')](_0x13faea[_0x297f('0x4b')],function(_0x1f6f2a){var _0x422541={};_0x422541[_0x1f6f2a]={'$like':'%'+_0x50d505[_0x297f('0x45')]['filter']+'%'};return _0x422541;})});}_0x13faea=_[_0x297f('0x5e')]({},_0x13faea,_0x50d505[_0x297f('0xdc')]);return _0x182adc[_0x297f('0xe7')](_0x13faea);}})[_0x297f('0x16')](function(_0xeaa2fd){if(_0xeaa2fd){_0x48e2f3=_0xeaa2fd[_0x297f('0x4f')];if(!_0x50d505['query'][_0x297f('0xcd')](_0x297f('0xd9'))){_0x13faea[_0x297f('0x25')]=qs['limit'](_0x50d505['query'][_0x297f('0x25')]);_0x13faea[_0x297f('0x23')]=qs['offset'](_0x50d505[_0x297f('0x45')][_0x297f('0x23')]);}return _0x182adc[_0x297f('0xe7')](_0x13faea);}})[_0x297f('0x16')](function(_0x3a3e85){if(_0x3a3e85){return _0x3a3e85?{'count':_0x48e2f3,'rows':_0x3a3e85}:null;}})[_0x297f('0x16')](respondWithResult(_0x32a448,null))['catch'](handleError(_0x32a448,null));};exports[_0x297f('0xe9')]=function(_0x28ec67,_0x5e87a9){var _0x41c613={};var _0x309c9f={};var _0xb478fa;var _0x11b1c0;return db[_0x297f('0x3d')][_0x297f('0x9c')]({'where':{'id':_0x28ec67[_0x297f('0x57')]['id']}})[_0x297f('0x16')](handleEntityNotFound(_0x5e87a9,null))[_0x297f('0x16')](function(_0x381a85){if(_0x381a85){_0xb478fa=_0x381a85;_0x309c9f[_0x297f('0x5c')]=_[_0x297f('0x59')](db[_0x297f('0xea')][_0x297f('0x3e')]);_0x309c9f['query']=_[_0x297f('0x59')](_0x28ec67['query']);_0x309c9f[_0x297f('0x5a')]=_[_0x297f('0x5b')](_0x309c9f['model'],_0x309c9f[_0x297f('0x45')]);_0x41c613[_0x297f('0x4b')]=_['intersection'](_0x309c9f['model'],qs[_0x297f('0x5d')](_0x28ec67[_0x297f('0x45')][_0x297f('0x5d')]));_0x41c613[_0x297f('0x4b')]=_0x41c613['attributes'][_0x297f('0x4f')]?_0x41c613[_0x297f('0x4b')]:_0x309c9f[_0x297f('0x5c')];_0x41c613[_0x297f('0xdb')]=qs[_0x297f('0xd6')](_0x28ec67[_0x297f('0x45')][_0x297f('0xd6')]);_0x41c613[_0x297f('0x44')]=qs[_0x297f('0x5a')](_[_0x297f('0xd7')](_0x28ec67[_0x297f('0x45')],_0x309c9f[_0x297f('0x5a')]));if(_0x28ec67['query'][_0x297f('0x32')]){_0x41c613[_0x297f('0x44')]=_[_0x297f('0x5e')](_0x41c613[_0x297f('0x44')],{'$or':_['map'](_0x41c613[_0x297f('0x4b')],function(_0x3f986a){var _0x1d17d1={};_0x1d17d1[_0x3f986a]={'$like':'%'+_0x28ec67[_0x297f('0x45')]['filter']+'%'};return _0x1d17d1;})});}_0x41c613=_['merge']({},_0x41c613,_0x28ec67['options']);return _0xb478fa[_0x297f('0xe9')](_0x41c613);}})[_0x297f('0x16')](function(_0x24e614){if(_0x24e614){_0x11b1c0=_0x24e614[_0x297f('0x4f')];if(!_0x28ec67[_0x297f('0x45')][_0x297f('0xcd')](_0x297f('0xd9'))){_0x41c613['limit']=qs[_0x297f('0x25')](_0x28ec67['query'][_0x297f('0x25')]);_0x41c613[_0x297f('0x23')]=qs[_0x297f('0x23')](_0x28ec67[_0x297f('0x45')][_0x297f('0x23')]);}return _0xb478fa[_0x297f('0xe9')](_0x41c613);}})[_0x297f('0x16')](function(_0x507225){if(_0x507225){return _0x507225?{'count':_0x11b1c0,'rows':_0x507225}:null;}})[_0x297f('0x16')](respondWithResult(_0x5e87a9,null))['catch'](handleError(_0x5e87a9,null));};exports[_0x297f('0xeb')]=function(_0x5a245a,_0x4adef6){var _0x1ea176={};var _0xbb4179={};var _0xc380fb;var _0x23c639;return db[_0x297f('0x3d')]['findOne']({'where':{'id':_0x5a245a[_0x297f('0x57')]['id']}})[_0x297f('0x16')](handleEntityNotFound(_0x4adef6,null))[_0x297f('0x16')](function(_0x399c0d){if(_0x399c0d){_0xc380fb=_0x399c0d;_0xbb4179[_0x297f('0x5c')]=_['keys'](db[_0x297f('0xec')]['rawAttributes']);_0xbb4179[_0x297f('0x45')]=_[_0x297f('0x59')](_0x5a245a[_0x297f('0x45')]);_0xbb4179[_0x297f('0x5a')]=_[_0x297f('0x5b')](_0xbb4179[_0x297f('0x5c')],_0xbb4179['query']);_0x1ea176[_0x297f('0x4b')]=_['intersection'](_0xbb4179[_0x297f('0x5c')],qs[_0x297f('0x5d')](_0x5a245a[_0x297f('0x45')]['fields']));_0x1ea176[_0x297f('0x4b')]=_0x1ea176[_0x297f('0x4b')][_0x297f('0x4f')]?_0x1ea176[_0x297f('0x4b')]:_0xbb4179[_0x297f('0x5c')];_0x1ea176['order']=qs[_0x297f('0xd6')](_0x5a245a['query'][_0x297f('0xd6')]);_0x1ea176[_0x297f('0x44')]=qs['filters'](_[_0x297f('0xd7')](_0x5a245a[_0x297f('0x45')],_0xbb4179[_0x297f('0x5a')]));if(_0x5a245a[_0x297f('0x45')][_0x297f('0x32')]){_0x1ea176[_0x297f('0x44')]=_[_0x297f('0x5e')](_0x1ea176[_0x297f('0x44')],{'$or':_[_0x297f('0x34')](_0x1ea176[_0x297f('0x4b')],function(_0x13804f){var _0xe36ca={};_0xe36ca[_0x13804f]={'$like':'%'+_0x5a245a[_0x297f('0x45')][_0x297f('0x32')]+'%'};return _0xe36ca;})});}_0x1ea176=_['merge']({},_0x1ea176,_0x5a245a[_0x297f('0xdc')]);return _0xc380fb[_0x297f('0xeb')](_0x1ea176);}})[_0x297f('0x16')](function(_0x3115b8){if(_0x3115b8){_0x23c639=_0x3115b8[_0x297f('0x4f')];if(!_0x5a245a['query'][_0x297f('0xcd')](_0x297f('0xd9'))){_0x1ea176['limit']=qs['limit'](_0x5a245a[_0x297f('0x45')][_0x297f('0x25')]);_0x1ea176[_0x297f('0x23')]=qs[_0x297f('0x23')](_0x5a245a['query'][_0x297f('0x23')]);}return _0xc380fb[_0x297f('0xeb')](_0x1ea176);}})[_0x297f('0x16')](function(_0x3c4b38){if(_0x3c4b38){return _0x3c4b38?{'count':_0x23c639,'rows':_0x3c4b38}:null;}})[_0x297f('0x16')](respondWithResult(_0x4adef6,null))['catch'](handleError(_0x4adef6,null));};exports['login']=function(_0x17f1f7,_0x2fdda8,_0xb739af){var _0xd474ad;var _0x4f6c89;var _0x24812f;var _0x1560b6=!_[_0x297f('0x6b')](_0x17f1f7[_0x297f('0x57')]['id'])?_0x17f1f7[_0x297f('0x57')]['id']:!_[_0x297f('0x6b')](_0x17f1f7[_0x297f('0x30')]['id'])?_0x17f1f7['user']['id']:null;return db[_0x297f('0x3d')][_0x297f('0x5f')]({'where':{'id':_0x1560b6,'role':{'$or':[_0x297f('0x2f'),_0x297f('0x30'),_0x297f('0x2a')]}},'attributes':['id',_0x297f('0x37'),'phone','mobile',_0x297f('0x29'),_0x297f('0x65'),_0x297f('0xed')]})[_0x297f('0x16')](function(_0x433ff6){if(_0x433ff6){if(_0x433ff6[_0x297f('0x29')]==='agent'){_0xd474ad=_0x433ff6;if(_0x17f1f7['body'][_0x297f('0xa4')]){_0x24812f=util[_0x297f('0xaf')](_0x297f('0xee'),_0xd474ad[_0x17f1f7['body'][_0x297f('0xa4')]]);}else if(_0x17f1f7[_0x297f('0x60')]['intrf']){_0x24812f=util[_0x297f('0xaf')](_0x297f('0xb0'),_0x17f1f7[_0x297f('0x60')]['intrf']);}else{_0x24812f=util['format'](_0x297f('0xb0'),_0xd474ad[_0x297f('0x37')]);}socket['to'](util[_0x297f('0xaf')]('user:%s',_0xd474ad[_0x297f('0x37')]))[_0x297f('0x2b')](_0x297f('0xef'),{'user':{'id':_0xd474ad['id'],'name':_0xd474ad['name']},'ip':_0x17f1f7[_0x297f('0xf0')][_0x297f('0xf1')]||_0x17f1f7['connection']['remoteAddress']||_0x17f1f7[_0x297f('0xf2')][_0x297f('0xf3')]||_0x17f1f7['connection']['socket'][_0x297f('0xf3')]});return db[_0x297f('0xb2')][_0x297f('0x2d')]({'where':{'membername':_0xd474ad[_0x297f('0x37')]},'individualHooks':!![]});}}else{throw new db[(_0x297f('0x95'))][(_0x297f('0x96'))](_0x297f('0xf4'));}})[_0x297f('0x16')](function(){if(_0xd474ad){return _0xd474ad[_0x297f('0xf5')]({'raw':!![]});}})[_0x297f('0x16')](function(_0x56636d){if(_0xd474ad){if(_0x56636d){_0x4f6c89=_0x56636d;if(_0x4f6c89['length']){var _0x12cbe6=_0x4f6c89[_0x297f('0x34')](function(_0x1f48b5){var _0x35c442={'membername':_0xd474ad[_0x297f('0x37')],'UserId':_0xd474ad['id'],'queue_name':_0x1f48b5[_0x297f('0x37')],'VoiceQueueId':_0x1f48b5['id'],'interface':_0x24812f,'paused':_0xd474ad[_0x297f('0xed')]||![],'penalty':_0x1f48b5['UserVoiceQueue.penalty']||0x0};return db[_0x297f('0xb2')][_0x297f('0xb3')](_0x35c442);});return Promise[_0x297f('0x56')](_0x12cbe6);}}}})[_0x297f('0x16')](function(){if(_0xd474ad){return db[_0x297f('0xf6')][_0x297f('0x4d')]({'where':{'membername':_0xd474ad[_0x297f('0x37')],'exitAt':null}});}})[_0x297f('0x16')](function(_0x51247c){if(_0xd474ad){var _0x5752f0=[];_0x51247c['forEach'](function(_0x10848f){_0x5752f0[_0x297f('0x4c')](_0x10848f[_0x297f('0x28')]({'exitAt':moment()['format'](_0x297f('0xf7'))}));});return Promise['all'](_0x5752f0);}})[_0x297f('0x16')](function(){if(_0xd474ad){var _0x18f497=[];var _0x268215=[];var _0x46e2cb=utils[_0x297f('0xf8')]();var _0x5ab982={'membername':_0xd474ad[_0x297f('0x37')],'interface':_0x24812f,'enterAt':moment()[_0x297f('0xaf')](_0x297f('0xf7')),'role':_0xd474ad[_0x297f('0x29')],'internal':_0xd474ad[_0x297f('0x65')]};_0x46e2cb[_0x297f('0xf9')](function(_0x2e0a2f){_0x18f497[_0x297f('0x4c')](_[_0x297f('0x5e')]({'channel':_0x2e0a2f,'type':_0x297f('0xfa'),'data1':_0x17f1f7[_0x297f('0x60')][_0x297f('0xfb')],'data2':_0x24812f},_0x5ab982));if(_0xd474ad[_0x297f('0xed')]){_0x268215[_0x297f('0x4c')](_[_0x297f('0x5e')]({'channel':_0x2e0a2f,'type':_0x297f('0xfc'),'data1':_0x297f('0xfd')},_0x5ab982));}});return db[_0x297f('0xf6')][_0x297f('0x8b')](_0x18f497[_0x297f('0xca')](_0x268215),{'individualHooks':!![]});}})['then'](function(){if(_0xd474ad){return _0xd474ad[_0x297f('0x28')]({'online':!![],'lastLoginAt':moment()['format'](_0x297f('0xf7')),'voicePause':_0xd474ad[_0x297f('0xed')]||![],'mailPause':_0xd474ad[_0x297f('0xed')]||![],'chatPause':_0xd474ad[_0x297f('0xed')]||![],'faxPause':_0xd474ad['loginInPause']||![],'smsPause':_0xd474ad[_0x297f('0xed')]||![],'openchannelPause':_0xd474ad[_0x297f('0xed')]||![],'whatsappPause':_0xd474ad[_0x297f('0xed')]||![],'pauseType':_0xd474ad[_0x297f('0xed')]?_0x297f('0xfd'):null,'interface':_0x24812f,'lastPauseAt':moment()[_0x297f('0xaf')](_0x297f('0xf7'))});}})[_0x297f('0x16')](function(_0x2a73bf){if(_0x17f1f7[_0x297f('0xfe')]){return _0xb739af();}else{return Promise[_0x297f('0xff')](_0x2a73bf)[_0x297f('0x16')](respondWithResult(_0x2fdda8,null));}})[_0x297f('0x1f')](handleError(_0x2fdda8,null));};exports[_0x297f('0x100')]=function(_0x5b6084,_0x5434be){var _0x3cf7ea;return db[_0x297f('0x3d')][_0x297f('0x5f')]({'where':{'id':_0x5b6084[_0x297f('0x57')]['id'],'role':_0x297f('0x2a')},'attributes':['id',_0x297f('0x37'),_0x297f('0x29')]})[_0x297f('0x16')](handleEntityNotFound(_0x5434be,null))[_0x297f('0x16')](function(_0x283188){if(_0x283188){_0x3cf7ea=_0x283188;return db[_0x297f('0xb2')][_0x297f('0x2d')]({'where':{'membername':_0x3cf7ea[_0x297f('0x37')]},'individualHooks':!![]});}})['then'](function(){return db[_0x297f('0xf6')][_0x297f('0x4d')]({'where':{'membername':_0x3cf7ea[_0x297f('0x37')],'exitAt':null}});})[_0x297f('0x16')](function(_0xeac8c9){var _0x1686a5=[];_0xeac8c9[_0x297f('0xf9')](function(_0x31a8f1){_0x1686a5[_0x297f('0x4c')](_0x31a8f1[_0x297f('0x28')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return Promise[_0x297f('0x56')](_0x1686a5);})[_0x297f('0x16')](function(){return _0x3cf7ea[_0x297f('0x28')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![],'whatsappPause':![],'interface':null});})[_0x297f('0x16')](respondWithResult(_0x5434be,null))[_0x297f('0x1f')](handleError(_0x5434be,null));};exports[_0x297f('0x101')]=function(_0x44bdaa,_0x34036f){var _0x4f3e8c;return db[_0x297f('0xb2')][_0x297f('0x28')]({'paused':0x1},{'where':{'UserId':_0x44bdaa['params']['id']},'individualHooks':!![]})[_0x297f('0x16')](function(){return db[_0x297f('0x3d')][_0x297f('0x5f')]({'where':{'id':_0x44bdaa[_0x297f('0x57')]['id'],'role':_0x297f('0x2a')},'attributes':['id',_0x297f('0x37'),_0x297f('0x29'),_0x297f('0x65'),_0x297f('0xa4'),_0x297f('0xa2')]});})['then'](handleEntityNotFound(_0x34036f,null))[_0x297f('0x16')](function(_0x2ab1a8){if(_0x2ab1a8){_0x4f3e8c=_0x2ab1a8;return respondWithRpcPromise(_0x297f('0x102'),_0x297f('0x101'),{'id':_0x4f3e8c['id'],'name':_0x4f3e8c['name'],'pause':!![]});}})[_0x297f('0x16')](function(){if(_0x4f3e8c){return db['MemberReport'][_0x297f('0x4d')]({'where':{'membername':_0x4f3e8c[_0x297f('0x37')],'type':_0x297f('0xfc'),'exitAt':null}});}})[_0x297f('0x16')](function(_0x574ad3){if(_0x574ad3['length']){var _0x5b267a=moment()[_0x297f('0xaf')](_0x297f('0xf7'));for(var _0x339e13=0x0,_0x405478=_0x574ad3[_0x297f('0x4f')];_0x339e13<_0x405478;_0x339e13++){_0x574ad3[_0x339e13][_0x297f('0x103')]({'exitAt':_0x5b267a});}}})[_0x297f('0x16')](function(){var _0x4b4835=[];var _0x51a055=utils['getChannels']();_0x51a055[_0x297f('0xf9')](function(_0x1ea7e0){_0x4b4835[_0x297f('0x4c')]({'channel':_0x1ea7e0,'membername':_0x4f3e8c['name'],'interface':_[_0x297f('0x6b')](_0x4f3e8c[_0x297f('0xa4')])?util[_0x297f('0xaf')](_0x297f('0xb0'),_0x4f3e8c[_0x297f('0x37')]):_0x4f3e8c[_0x297f('0xa4')],'type':_0x297f('0xfc'),'enterAt':moment()[_0x297f('0xaf')]('YYYY-MM-DD\x20HH:mm:ss'),'data1':_0x44bdaa['body']['type']||_0x297f('0x104'),'role':_0x4f3e8c[_0x297f('0x29')],'internal':_0x4f3e8c[_0x297f('0x65')]});});return db['MemberReport'][_0x297f('0x8b')](_0x4b4835,{'individualHooks':!![]});})[_0x297f('0x16')](function(){return _0x4f3e8c[_0x297f('0x28')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'whatsappPause':!![],'openchannelPause':!![],'pauseType':_0x44bdaa[_0x297f('0x60')][_0x297f('0x40')]||_0x297f('0x104'),'lastPauseAt':moment()['format'](_0x297f('0xf7'))});})[_0x297f('0x16')](respondWithResult(_0x34036f,null))['catch'](handleError(_0x34036f,null));};exports[_0x297f('0x105')]=function(_0x20c951,_0x464234){if(_0x20c951[_0x297f('0x60')][_0x297f('0xa1')]&&!utils[_0x297f('0xa5')](_0x20c951[_0x297f('0x60')][_0x297f('0xa1')])){throw new APIBadRequestError(util['format'](_0x297f('0x106'),_0x20c951[_0x297f('0x60')]['channel']));}return db[_0x297f('0x3d')]['find']({'where':{'id':_0x20c951['params']['id']},'attributes':['id',_0x297f('0x37'),_0x297f('0x29'),'internal',_0x297f('0xa4'),_0x297f('0xa2'),_0x297f('0xa3'),_0x297f('0x107'),_0x297f('0x108'),_0x297f('0x109'),'openchannelPause','smsPause',_0x297f('0x10a'),_0x297f('0x10b'),_0x297f('0x10c')]})[_0x297f('0x16')](function(_0x1b030e){if(!_0x1b030e){throw new APINotFoundError(util[_0x297f('0xaf')](_0x297f('0xcc'),_0x20c951[_0x297f('0x57')]['id']));}return _0x1b030e[_0x297f('0x105')](_0x20c951[_0x297f('0x60')][_0x297f('0xa1')]);})['then'](respondWithResult(_0x464234,null))['catch'](APIHandleError(_0x464234));};exports[_0x297f('0x10d')]=function(_0x453298,_0x51ade7){var _0x5985d={};var _0x59ee11={};var _0x163e5d;var _0x27c358;return db[_0x297f('0x3d')]['findOne']({'where':{'id':_0x453298[_0x297f('0x57')]['id']}})[_0x297f('0x16')](handleEntityNotFound(_0x51ade7,null))['then'](function(_0x1ea5c4){if(_0x1ea5c4){_0x163e5d=_0x1ea5c4;_0x59ee11['model']=_[_0x297f('0x59')](db[_0x297f('0x10e')][_0x297f('0x3e')]);_0x59ee11['query']=_[_0x297f('0x59')](_0x453298[_0x297f('0x45')]);_0x59ee11[_0x297f('0x5a')]=_[_0x297f('0x5b')](_0x59ee11['model'],_0x59ee11['query']);_0x5985d[_0x297f('0x4b')]=_[_0x297f('0x5b')](_0x59ee11[_0x297f('0x5c')],qs[_0x297f('0x5d')](_0x453298[_0x297f('0x45')][_0x297f('0x5d')]));_0x5985d[_0x297f('0x4b')]=_0x5985d['attributes'][_0x297f('0x4f')]?_0x5985d[_0x297f('0x4b')]:_0x59ee11[_0x297f('0x5c')];_0x5985d[_0x297f('0xdb')]=qs['sort'](_0x453298[_0x297f('0x45')]['sort']);_0x5985d[_0x297f('0x44')]=qs[_0x297f('0x5a')](_[_0x297f('0xd7')](_0x453298[_0x297f('0x45')],_0x59ee11[_0x297f('0x5a')]));if(_0x453298['query']['filter']){_0x5985d[_0x297f('0x44')]=_[_0x297f('0x5e')](_0x5985d[_0x297f('0x44')],{'$or':_[_0x297f('0x34')](_0x5985d['attributes'],function(_0x9cd280){var _0x4232a9={};_0x4232a9[_0x9cd280]={'$like':'%'+_0x453298[_0x297f('0x45')]['filter']+'%'};return _0x4232a9;})});}_0x5985d=_[_0x297f('0x5e')]({},_0x5985d,_0x453298[_0x297f('0xdc')]);return _0x163e5d[_0x297f('0x10d')](_0x5985d);}})['then'](function(_0x5653d8){if(_0x5653d8){_0x27c358=_0x5653d8['length'];if(!_0x453298[_0x297f('0x45')]['hasOwnProperty']('nolimit')){_0x5985d['limit']=qs[_0x297f('0x25')](_0x453298[_0x297f('0x45')][_0x297f('0x25')]);_0x5985d[_0x297f('0x23')]=qs[_0x297f('0x23')](_0x453298[_0x297f('0x45')]['offset']);}return _0x163e5d[_0x297f('0x10d')](_0x5985d);}})[_0x297f('0x16')](function(_0x17224d){if(_0x17224d){return _0x17224d?{'count':_0x27c358,'rows':_0x17224d}:null;}})[_0x297f('0x16')](respondWithResult(_0x51ade7,null))[_0x297f('0x1f')](handleError(_0x51ade7,null));};exports[_0x297f('0x10f')]=function(_0x2ddf3a,_0x6a3625){var _0x183f80=_0x2ddf3a[_0x297f('0x57')]['id'];var _0x5bd68c=_0x2ddf3a[_0x297f('0x60')]?_0x2ddf3a['body'][_0x297f('0x63')]:null;var _0x349ab4=[];return Promise[_0x297f('0xff')]()[_0x297f('0x16')](function(){if(!_0x5bd68c)throw new APIBadRequestError(_0x297f('0x110'));})[_0x297f('0x16')](function(){return db[_0x297f('0x3d')][_0x297f('0x9c')]({'where':{'id':_0x183f80}});})['then'](function(_0x51996d){if(!_0x51996d)throw new APINotFoundError(util[_0x297f('0xaf')](_0x297f('0xcc'),_0x2ddf3a[_0x297f('0x57')]['id']));return db[_0x297f('0x6c')][_0x297f('0x111')](function(_0x397dc5){return _0x51996d[_0x297f('0x10f')](_0x5bd68c,{'transaction':_0x397dc5})[_0x297f('0x16')](function(){return db[_0x297f('0x10e')][_0x297f('0x4d')]({'where':{'id':{'$in':_0x5bd68c}}});})['then'](function(_0x46d99c){var _0x433bb3=_[_0x297f('0x34')](_0x46d99c,function(_0x403c50){return _0x403c50['getAssociatedQueues']();});return Promise[_0x297f('0x56')](_0x433bb3);})[_0x297f('0x16')](function(_0x33a599){_0x349ab4=_[_0x297f('0x112')](_0x33a599);var _0x1e78e8=_[_0x297f('0x34')](_0x349ab4,function(_0x2cc859){return _0x2cc859[_0x297f('0x113')](_0x51996d['id'],{'transaction':_0x397dc5});});return Promise[_0x297f('0x56')](_0x1e78e8);})[_0x297f('0x16')](function(){if(!_0x51996d[_0x297f('0xa2')])return;var _0x1b7954=_[_0x297f('0x32')](_0x349ab4,function(_0x291def){return _0x291def[_0x297f('0x114')](_0x297f('0xa1'))===_0x297f('0x115');});var _0x293971=_[_0x297f('0x34')](_0x1b7954,function(_0x59498f){return db['UserVoiceQueueRt']['upsert']({'membername':_0x51996d['name'],'UserId':_0x51996d['id'],'queue_name':_0x59498f[_0x297f('0x37')],'VoiceQueueId':_0x59498f['id'],'interface':_['isNil'](_0x51996d[_0x297f('0xa4')])?util[_0x297f('0xaf')](_0x297f('0xb0'),_0x51996d['name']):_0x51996d[_0x297f('0xa4')],'paused':_0x51996d[_0x297f('0xa3')]||![],'penalty':_0x51996d[_0x297f('0xb1')]},{'transaction':_0x397dc5});});return Promise[_0x297f('0x56')](_0x293971);})[_0x297f('0x16')](function(){return db[_0x297f('0x116')][_0x297f('0x4d')]({'where':{'teamId':{'$in':_0x5bd68c}}});})[_0x297f('0x16')](function(_0x270df9){var _0x187608=_[_0x297f('0x34')](_0x270df9,function(_0x2a0c60){return db[_0x297f('0x117')][_0x297f('0x86')]({'UserId':_0x51996d['id'],'VoicePrefixId':_0x2a0c60[_0x297f('0x118')]},{'transaction':_0x397dc5});});return Promise[_0x297f('0x56')](_0x187608);});});})[_0x297f('0x16')](function(){for(var _0x489a36=0x0;_0x489a36<_0x349ab4[_0x297f('0x4f')];_0x489a36++){var _0x187219=_0x349ab4[_0x489a36][_0x297f('0x114')](_0x297f('0xa1'));var _0x5a0893=_0x187219+_0x297f('0xaa');socket[_0x297f('0x2b')](_0x297f('0x30')+_0x187219+_0x297f('0xac'),{'UserId':_0x183f80,['queueField']:_0x349ab4[_0x489a36]['id']});}})['then'](respondWithStatusCode(_0x6a3625,null))[_0x297f('0x1f')](APIHandleError(_0x6a3625));};exports['removeTeams']=function(_0x277f7c,_0x2e69c8){var _0x55d8c5=_0x277f7c[_0x297f('0x57')]['id'];var _0x13bc63=null;if(_0x277f7c[_0x297f('0x45')][_0x297f('0x63')]){_0x13bc63=_[_0x297f('0xb6')](_0x277f7c[_0x297f('0x45')][_0x297f('0x63')])?_0x277f7c[_0x297f('0x45')][_0x297f('0x63')]:[_0x277f7c['query'][_0x297f('0x63')]];}var _0x492575=[];return Promise[_0x297f('0xff')]()[_0x297f('0x16')](function(){if(!_0x13bc63)throw new APIBadRequestError(_0x297f('0x119'));})[_0x297f('0x16')](function(){return db['User'][_0x297f('0x9c')]({'where':{'id':_0x55d8c5}});})[_0x297f('0x16')](function(_0x468c77){if(!_0x468c77)throw new APINotFoundError(util['format'](_0x297f('0xcc'),_0x277f7c[_0x297f('0x57')]['id']));return db[_0x297f('0x6c')][_0x297f('0x111')](function(_0x5cf3a0){return _0x468c77[_0x297f('0x11a')](_0x13bc63,{'transaction':_0x5cf3a0})[_0x297f('0x16')](function(){return db[_0x297f('0x10e')]['findAll']({'where':{'id':{'$in':_0x13bc63}}});})[_0x297f('0x16')](function(_0x58b780){var _0xf54232=_[_0x297f('0x34')](_0x58b780,function(_0x238d5a){return _0x238d5a['getAssociatedQueues']();});return Promise[_0x297f('0x56')](_0xf54232);})[_0x297f('0x16')](function(_0x2d9e9d){_0x492575=_[_0x297f('0x112')](_0x2d9e9d);var _0x1aba02=_[_0x297f('0x34')](_0x492575,function(_0x1058b2){return _0x1058b2[_0x297f('0x11b')](_0x468c77['id'],{'transaction':_0x5cf3a0});});return Promise[_0x297f('0x56')](_0x1aba02);})[_0x297f('0x16')](function(){if(!_0x468c77[_0x297f('0xa2')])return;var _0x5ebeab=_[_0x297f('0x32')](_0x492575,function(_0x157bc9){return _0x157bc9['getDataValue'](_0x297f('0xa1'))==='Voice';});var _0x5625ca=_['map'](_0x5ebeab,function(_0x35ce5c){return db[_0x297f('0xb2')][_0x297f('0x2d')]({'where':{'VoiceQueueId':_0x35ce5c['id'],'UserId':_0x468c77['id']},'transaction':_0x5cf3a0});});return Promise[_0x297f('0x56')](_0x5625ca);})[_0x297f('0x16')](function(){return db['TeamVoicePrefix'][_0x297f('0x4d')]({'where':{'teamId':{'$in':_0x13bc63}}});})[_0x297f('0x16')](function(_0x2d9aa1){var _0x461918=_[_0x297f('0x34')](_0x2d9aa1,function(_0x57972d){return db[_0x297f('0x117')][_0x297f('0x2d')]({'where':{'UserId':_0x468c77['id'],'VoicePrefixId':_0x57972d[_0x297f('0x118')]}},{'transaction':_0x5cf3a0});});return Promise[_0x297f('0x56')](_0x461918);});});})[_0x297f('0x16')](function(){for(var _0xe33a2d=0x0;_0xe33a2d<_0x492575[_0x297f('0x4f')];_0xe33a2d++){var _0x163789=_0x492575[_0xe33a2d]['getDataValue'](_0x297f('0xa1'));var _0x4031ee=_0x163789+_0x297f('0xaa');socket['emit'](_0x297f('0x30')+_0x163789+'Queue:remove',{'UserId':_0x55d8c5,['queueField']:_0x492575[_0xe33a2d]['id']});}})[_0x297f('0x16')](respondWithStatusCode(_0x2e69c8,null))[_0x297f('0x1f')](APIHandleError(_0x2e69c8));};exports[_0x297f('0x11c')]=function(_0x135e97,_0x55ea9e){var _0x14687f={};var _0x49f66a={};var _0x5b8a67;var _0x4d97fc;return db['User'][_0x297f('0x9c')]({'where':{'id':_0x135e97[_0x297f('0x57')]['id']}})[_0x297f('0x16')](handleEntityNotFound(_0x55ea9e,null))[_0x297f('0x16')](function(_0x27cc4c){if(_0x27cc4c){_0x5b8a67=_0x27cc4c;_0x49f66a[_0x297f('0x5c')]=_[_0x297f('0x59')](db[_0x297f('0xce')][_0x297f('0x3e')]);_0x49f66a[_0x297f('0x45')]=_[_0x297f('0x59')](_0x135e97['query']);_0x49f66a['filters']=_['intersection'](_0x49f66a[_0x297f('0x5c')],_0x49f66a['query']);_0x14687f['attributes']=_[_0x297f('0x5b')](_0x49f66a[_0x297f('0x5c')],qs[_0x297f('0x5d')](_0x135e97[_0x297f('0x45')][_0x297f('0x5d')]));_0x14687f[_0x297f('0x4b')]=_0x14687f['attributes']['length']?_0x14687f[_0x297f('0x4b')]:_0x49f66a['model'];_0x14687f[_0x297f('0xdb')]=qs['sort'](_0x135e97[_0x297f('0x45')][_0x297f('0xd6')]);_0x14687f['where']=qs[_0x297f('0x5a')](_[_0x297f('0xd7')](_0x135e97['query'],_0x49f66a['filters']));if(_0x135e97['query'][_0x297f('0x32')]){_0x14687f[_0x297f('0x44')]=_[_0x297f('0x5e')](_0x14687f[_0x297f('0x44')],{'$or':_[_0x297f('0x34')](_0x14687f['attributes'],function(_0x4072c5){var _0x117260={};_0x117260[_0x4072c5]={'$like':'%'+_0x135e97[_0x297f('0x45')][_0x297f('0x32')]+'%'};return _0x117260;})});}_0x14687f=_[_0x297f('0x5e')]({},_0x14687f,_0x135e97[_0x297f('0xdc')]);return _0x5b8a67['getLists'](_0x14687f);}})[_0x297f('0x16')](function(_0x5d8bc0){if(_0x5d8bc0){_0x4d97fc=_0x5d8bc0[_0x297f('0x4f')];if(!_0x135e97[_0x297f('0x45')]['hasOwnProperty']('nolimit')){_0x14687f[_0x297f('0x25')]=qs['limit'](_0x135e97['query'][_0x297f('0x25')]);_0x14687f['offset']=qs[_0x297f('0x23')](_0x135e97['query'][_0x297f('0x23')]);}return _0x5b8a67[_0x297f('0x11c')](_0x14687f);}})[_0x297f('0x16')](function(_0x38aa98){if(_0x38aa98){return _0x38aa98?{'count':_0x4d97fc,'rows':_0x38aa98}:null;}})[_0x297f('0x16')](respondWithResult(_0x55ea9e,null))[_0x297f('0x1f')](handleError(_0x55ea9e,null));};exports['getAgents']=function(_0x1f78ff,_0x2b6ba3){var _0x5bda8e={};var _0x3729b3={};var _0x4ea00f;return db[_0x297f('0x3d')][_0x297f('0x9c')]({'where':{'id':_0x1f78ff[_0x297f('0x57')]['id']}})['then'](handleEntityNotFound(_0x2b6ba3,null))[_0x297f('0x16')](function(_0x34fe65){if(_0x34fe65){_0x4ea00f=_0x34fe65;_0x3729b3[_0x297f('0x5c')]=_[_0x297f('0x59')](db[_0x297f('0x3d')]['rawAttributes']);_0x3729b3[_0x297f('0x45')]=_[_0x297f('0x59')](_0x1f78ff[_0x297f('0x45')]);_0x3729b3[_0x297f('0x5a')]=_[_0x297f('0x5b')](_0x3729b3['model'],_0x3729b3['query']);_0x5bda8e['attributes']=_[_0x297f('0x5b')](_0x3729b3[_0x297f('0x5c')],qs[_0x297f('0x5d')](_0x1f78ff[_0x297f('0x45')][_0x297f('0x5d')]));_0x5bda8e['attributes']=_0x5bda8e[_0x297f('0x4b')][_0x297f('0x4f')]?_0x5bda8e[_0x297f('0x4b')]:_0x3729b3[_0x297f('0x5c')];_0x5bda8e[_0x297f('0xdb')]=qs[_0x297f('0xd6')](_0x1f78ff[_0x297f('0x45')][_0x297f('0xd6')]);_0x5bda8e[_0x297f('0x44')]=qs[_0x297f('0x5a')](_[_0x297f('0xd7')](_0x1f78ff['query'],_0x3729b3[_0x297f('0x5a')]));if(_0x1f78ff['query'][_0x297f('0x32')]){_0x5bda8e['where']=_[_0x297f('0x5e')](_0x5bda8e[_0x297f('0x44')],{'$or':_['map'](_0x5bda8e[_0x297f('0x4b')],function(_0x78f180){var _0x7d9f39={};_0x7d9f39[_0x78f180]={'$like':'%'+_0x1f78ff['query']['filter']+'%'};return _0x7d9f39;})});}_0x5bda8e['model']=db[_0x297f('0x3d')];_0x5bda8e['as']=_0x297f('0x31');_0x5bda8e=_[_0x297f('0x5e')]({},_0x5bda8e,_0x1f78ff[_0x297f('0xdc')]);return _0x4ea00f[_0x297f('0xf5')]({'include':[_0x5bda8e]});}})[_0x297f('0x16')](function(_0x20994f){if(_0x20994f){var _0x5e7344={},_0x25177f=[];for(var _0x4869eb=0x0;_0x4869eb<_0x20994f['length'];_0x4869eb+=0x1){for(var _0x7f7891=0x0,_0xfc87b0;_0x7f7891<_0x20994f[_0x4869eb]['Agents']['length'];_0x7f7891+=0x1){_0xfc87b0=_0x20994f[_0x4869eb][_0x297f('0x31')][_0x7f7891]['get']({'plain':!![]});_0x5e7344[_0xfc87b0['id']]=_0xfc87b0;}}_0x5e7344=_[_0x297f('0x11d')](_0x5e7344);for(var _0x1c45f2=qs['offset'](_0x1f78ff[_0x297f('0x45')][_0x297f('0x23')]);_0x1c45f2<_0x5e7344['length']&&_0x25177f['length']=_0x237e07[_0xeb72('0x4b')]){throw new Error('Maximum\x20login\x20has\x20been\x20reached');}})[_0xeb72('0x17')](function(){if(_0x4d1434){return db[_0xeb72('0x26')][_0xeb72('0x43')]({'where':{'membername':_0x4d1434['name']},'individualHooks':!![]});}})[_0xeb72('0x17')](function(){if(_0x4d1434){return _0x4d1434[_0xeb72('0x4c')]({'raw':!![]});}})['then'](function(_0x57522b){if(_0x4d1434){if(_0x57522b){var _0x58392b=[];_0x277e4f=_0x57522b;if(_0x277e4f[_0xeb72('0x2c')]){for(var _0xc6e72f=0x0;_0xc6e72f<_0x277e4f['length'];_0xc6e72f++){_0x58392b['push'](db[_0xeb72('0x26')][_0xeb72('0x4d')]({'membername':_0x4d1434[_0xeb72('0x20')],'UserId':_0x4d1434['id'],'queue_name':_0x277e4f[_0xc6e72f][_0xeb72('0x20')],'VoiceQueueId':_0x277e4f[_0xc6e72f]['id'],'interface':_0x265fd8,'paused':_0x4d1434[_0xeb72('0x47')]||![],'penalty':_0x277e4f[_0xc6e72f]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0xeb72('0x44')](_0x58392b);}}}})[_0xeb72('0x17')](function(){if(_0x4d1434){return db['MemberReport'][_0xeb72('0x29')]({'where':{'membername':_0x4d1434[_0xeb72('0x20')],'exitAt':null}});}})[_0xeb72('0x17')](function(_0x3dc6e3){if(_0x4d1434){if(_0x3dc6e3&&_0x3dc6e3['length']){var _0x4dc59c=[];_0x3dc6e3['forEach'](function(_0x5d940e){_0x4dc59c[_0xeb72('0x2e')](_0x5d940e[_0xeb72('0x27')]({'exitAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss')}));});return BPromise[_0xeb72('0x44')](_0x4dc59c);}}})[_0xeb72('0x17')](function(){if(_0x4d1434){var _0x82384e=[];var _0x62eb29=[];var _0x1b5221=utils[_0xeb72('0x4e')]();var _0x12d9fe={'membername':_0x4d1434[_0xeb72('0x20')],'interface':_0x265fd8,'enterAt':moment()[_0xeb72('0x23')](_0xeb72('0x2b')),'role':_0x4d1434[_0xeb72('0x21')],'internal':_0x4d1434['internal']};_0x1b5221[_0xeb72('0x2d')](function(_0x173c77){_0x82384e['push'](_['merge']({'channel':_0x173c77,'type':'LOGIN','data1':_0xeb72('0x4f'),'data2':_0x265fd8},_0x12d9fe));if(_0x4d1434[_0xeb72('0x47')]){_0x62eb29['push'](_[_0xeb72('0x50')]({'channel':_0x173c77,'type':'PAUSE','data1':_0xeb72('0x51')},_0x12d9fe));}});return db[_0xeb72('0x28')]['bulkCreate'](_0x82384e[_0xeb72('0x52')](_0x62eb29),{'individualHooks':!![]});}})[_0xeb72('0x17')](function(){if(_0x4d1434){return _0x4d1434[_0xeb72('0x27')]({'online':!![],'lastLoginAt':moment()[_0xeb72('0x23')](_0xeb72('0x2b')),'voicePause':_0x4d1434[_0xeb72('0x47')]||![],'mailPause':_0x4d1434['loginInPause']||![],'chatPause':_0x4d1434['loginInPause']||![],'faxPause':_0x4d1434[_0xeb72('0x47')]||![],'smsPause':_0x4d1434[_0xeb72('0x47')]||![],'openchannelPause':_0x4d1434[_0xeb72('0x47')]||![],'pauseType':_0x4d1434[_0xeb72('0x47')]?_0xeb72('0x51'):null,'lastPauseAt':moment()['format'](_0xeb72('0x2b')),'interface':_0x265fd8});}})['then'](function(_0x3a9d03){_0x3e42cc(_0x3a9d03);})[_0xeb72('0x1b')](function(_0x347451){_0x3f6d29(_0x21f586[_0xeb72('0x1c')](0x1f4,_0x347451[_0xeb72('0x1d')]));});});}; \ No newline at end of file +var _0x0877=['uniqueid','bulkCreate','update','DEFAULT\x20PAUSE','resolve','channel','isValidChannel','findOne','online','voicePause','mailPause','chatPause','faxPause','openchannelPause','smsPause','whatsappPause','lastPauseAt','unpause','system','destroy','all','phone','loginInPause','agent','../../config/license/util','getLicense','agents','Maximum\x20login\x20has\x20been\x20reached','getVoiceQueues','upsert','getChannels','merge','LOGIN','callysquare','LOGININPAUSE','concat','lodash','util','moment','bluebird','ioredis','../../config/utils','../../config/logger','redis','defaults','localhost','socket.io-emitter','./user.socket','register','findAll','options','raw','where','limit','map','include','attributes','model','info','GetUser','debug','stringify','catch','error','ShowUser','User','then','message','PauseUser','find','name','role','interface','format','User\x20with\x20id\x20%s\x20not\x20found','params','UserVoiceQueueRt','MemberReport','PAUSE','length','YYYY-MM-DD\x20HH:mm:ss','forEach','push','SIP/%s','body','type','internal'];(function(_0x5d65c9,_0x3d59cd){var _0x25591c=function(_0x3bf315){while(--_0x3bf315){_0x5d65c9['push'](_0x5d65c9['shift']());}};_0x25591c(++_0x3d59cd);}(_0x0877,0x180));var _0x7087=function(_0x37ca5f,_0x7b93d4){_0x37ca5f=_0x37ca5f-0x0;var _0x4b0676=_0x0877[_0x37ca5f];return _0x4b0676;};'use strict';var _=require(_0x7087('0x0'));var util=require(_0x7087('0x1'));var moment=require(_0x7087('0x2'));var BPromise=require(_0x7087('0x3'));var Redis=require(_0x7087('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x7087('0x5'));var logger=require(_0x7087('0x6'))('rpc');var config=require('../../config/environment');config[_0x7087('0x7')]=_[_0x7087('0x8')](config[_0x7087('0x7')],{'host':_0x7087('0x9'),'port':0x18eb});var socket=require(_0x7087('0xa'))(new Redis(config[_0x7087('0x7')]));require(_0x7087('0xb'))[_0x7087('0xc')](socket);exports['GetUser']=function(_0x21979c){var _0x5bbbb8=this;return new Promise(function(_0x34c722,_0x3ba54f){return db['User'][_0x7087('0xd')]({'raw':_0x21979c[_0x7087('0xe')]?_0x21979c['options'][_0x7087('0xf')]===undefined?!![]:![]:!![],'where':_0x21979c['options']?_0x21979c[_0x7087('0xe')][_0x7087('0x10')]||null:null,'attributes':_0x21979c[_0x7087('0xe')]?_0x21979c[_0x7087('0xe')]['attributes']||null:null,'limit':_0x21979c[_0x7087('0xe')]?_0x21979c[_0x7087('0xe')][_0x7087('0x11')]||null:null,'include':_0x21979c[_0x7087('0xe')]?_0x21979c[_0x7087('0xe')]['include']?_[_0x7087('0x12')](_0x21979c[_0x7087('0xe')][_0x7087('0x13')],function(_0x54ca2b){return{'model':db[_0x54ca2b['model']],'as':_0x54ca2b['as'],'attributes':_0x54ca2b[_0x7087('0x14')],'include':_0x54ca2b[_0x7087('0x13')]?_[_0x7087('0x12')](_0x54ca2b['include'],function(_0x4bf53f){return{'model':db[_0x4bf53f['model']],'as':_0x4bf53f['as'],'attributes':_0x4bf53f['attributes'],'include':_0x4bf53f[_0x7087('0x13')]?_[_0x7087('0x12')](_0x4bf53f[_0x7087('0x13')],function(_0x13e1b5){return{'model':db[_0x13e1b5[_0x7087('0x15')]],'as':_0x13e1b5['as'],'attributes':_0x13e1b5[_0x7087('0x14')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x1649eb){logger[_0x7087('0x16')](_0x7087('0x17'),_0x21979c);logger[_0x7087('0x18')](_0x7087('0x17'),_0x21979c,JSON[_0x7087('0x19')](_0x1649eb));_0x34c722(_0x1649eb);})[_0x7087('0x1a')](function(_0x3e339e){logger['error']('GetUser',_0x3e339e['message'],_0x21979c);_0x3ba54f(_0x5bbbb8[_0x7087('0x1b')](0x1f4,_0x3e339e['message']));});});};exports[_0x7087('0x1c')]=function(_0x3f6056){var _0x5c4622=this;return new Promise(function(_0x5a9b4b,_0x140eea){return db[_0x7087('0x1d')]['find']({'raw':_0x3f6056['options']?_0x3f6056['options'][_0x7087('0xf')]===undefined?!![]:![]:!![],'where':_0x3f6056[_0x7087('0xe')]?_0x3f6056[_0x7087('0xe')]['where']||null:null,'attributes':_0x3f6056['options']?_0x3f6056[_0x7087('0xe')][_0x7087('0x14')]||null:null,'include':_0x3f6056[_0x7087('0xe')]?_0x3f6056[_0x7087('0xe')][_0x7087('0x13')]?_[_0x7087('0x12')](_0x3f6056[_0x7087('0xe')]['include'],function(_0x5c3a58){return{'model':db[_0x5c3a58['model']],'as':_0x5c3a58['as'],'attributes':_0x5c3a58[_0x7087('0x14')],'include':_0x5c3a58[_0x7087('0x13')]?_[_0x7087('0x12')](_0x5c3a58[_0x7087('0x13')],function(_0x2b8056){return{'model':db[_0x2b8056[_0x7087('0x15')]],'as':_0x2b8056['as'],'attributes':_0x2b8056['attributes'],'include':_0x2b8056[_0x7087('0x13')]?_[_0x7087('0x12')](_0x2b8056[_0x7087('0x13')],function(_0x3491f4){return{'model':db[_0x3491f4[_0x7087('0x15')]],'as':_0x3491f4['as'],'attributes':_0x3491f4[_0x7087('0x14')]};}):[]};}):[]};}):[]:[]})[_0x7087('0x1e')](function(_0x44a226){logger[_0x7087('0x16')](_0x7087('0x1c'),_0x3f6056);logger[_0x7087('0x18')]('ShowUser',_0x3f6056,JSON[_0x7087('0x19')](_0x44a226));_0x5a9b4b(_0x44a226);})[_0x7087('0x1a')](function(_0x333d46){logger[_0x7087('0x1b')](_0x7087('0x1c'),_0x333d46[_0x7087('0x1f')],_0x3f6056);_0x140eea(_0x5c4622[_0x7087('0x1b')](0x1f4,_0x333d46[_0x7087('0x1f')]));});});};exports[_0x7087('0x20')]=function(_0x5c2ef0){var _0x4b1752;return db[_0x7087('0x1d')][_0x7087('0x21')]({'where':_0x5c2ef0[_0x7087('0xe')]['where']||{},'attributes':['id',_0x7087('0x22'),_0x7087('0x23'),'internal',_0x7087('0x24')]})[_0x7087('0x1e')](function(_0x1a542e){if(!_0x1a542e){throw new Error(util[_0x7087('0x25')](_0x7087('0x26'),_0x5c2ef0[_0x7087('0x27')]['id']));}_0x4b1752=_0x1a542e;return db[_0x7087('0x28')]['update']({'paused':0x1},{'where':{'UserId':_0x4b1752['id']},'individualHooks':!![]});})[_0x7087('0x1e')](function(){return db[_0x7087('0x29')][_0x7087('0xd')]({'where':{'membername':_0x4b1752['name'],'type':_0x7087('0x2a'),'exitAt':null}});})[_0x7087('0x1e')](function(_0x59a9f1){if(_0x59a9f1&&_0x59a9f1[_0x7087('0x2b')]){var _0x149c5a=moment()['format'](_0x7087('0x2c'));for(var _0x4b1274=0x0,_0x1ad7f0=_0x59a9f1[_0x7087('0x2b')];_0x4b1274<_0x1ad7f0;_0x4b1274++){_0x59a9f1[_0x4b1274]['updateAttributes']({'exitAt':_0x149c5a});}}})[_0x7087('0x1e')](function(){var _0x3f7475=[];var _0x15e4b8=utils['getChannels']();_0x15e4b8[_0x7087('0x2d')](function(_0x34049a){_0x3f7475[_0x7087('0x2e')]({'channel':_0x34049a,'membername':_0x4b1752['name'],'interface':_['isNil'](_0x4b1752[_0x7087('0x24')])?util[_0x7087('0x25')](_0x7087('0x2f'),_0x4b1752[_0x7087('0x22')]):_0x4b1752[_0x7087('0x24')],'type':'PAUSE','enterAt':moment()[_0x7087('0x25')](_0x7087('0x2c')),'data1':_0x5c2ef0[_0x7087('0x30')][_0x7087('0x31')]||'DEFAULT\x20PAUSE','role':_0x4b1752[_0x7087('0x23')],'internal':_0x4b1752[_0x7087('0x32')],'uniqueid':_0x5c2ef0['body'][_0x7087('0x33')]||null});});return db['MemberReport'][_0x7087('0x34')](_0x3f7475,{'individualHooks':!![]});})[_0x7087('0x1e')](function(){return _0x4b1752[_0x7087('0x35')]({'voicePause':!![],'mailPause':!![],'chatPause':!![],'faxPause':!![],'smsPause':!![],'openchannelPause':!![],'whatsappPause':!![],'pauseType':_0x5c2ef0['body'][_0x7087('0x31')]||_0x7087('0x36'),'lastPauseAt':moment()[_0x7087('0x25')](_0x7087('0x2c'))});})['catch'](function(_0x10beab){throw _0x10beab;});};exports['UnpauseUser']=function(_0x8e2955){return Promise[_0x7087('0x37')]()[_0x7087('0x1e')](function(){if(_0x8e2955['body'][_0x7087('0x38')]&&!utils[_0x7087('0x39')](_0x8e2955[_0x7087('0x30')][_0x7087('0x38')])){throw new Error(util[_0x7087('0x25')]('Channel\x20parameter\x20%s\x20is\x20invalid',_0x8e2955['body'][_0x7087('0x38')]));}return db[_0x7087('0x1d')][_0x7087('0x3a')]({'where':_0x8e2955[_0x7087('0xe')][_0x7087('0x10')]||{},'attributes':['id',_0x7087('0x22'),_0x7087('0x23'),_0x7087('0x32'),_0x7087('0x24'),_0x7087('0x3b'),_0x7087('0x3c'),_0x7087('0x3d'),_0x7087('0x3e'),_0x7087('0x3f'),_0x7087('0x40'),_0x7087('0x41'),_0x7087('0x42'),'pauseType',_0x7087('0x43')]});})[_0x7087('0x1e')](function(_0xbd6499){if(!_0xbd6499){throw new Error(util['format'](_0x7087('0x26'),_0x8e2955[_0x7087('0x27')]['id']));}return _0xbd6499[_0x7087('0x44')](_0x8e2955['body'][_0x7087('0x38')],_0x7087('0x45'));})[_0x7087('0x1a')](function(_0x3c3164){throw _0x3c3164;});};exports['LogoutUser']=function(_0x3763b6){var _0x4b6a47=this;return new Promise(function(_0xae4efd,_0x55e4ad){var _0x3be419;return db['User'][_0x7087('0x3a')]({'where':_0x3763b6[_0x7087('0xe')][_0x7087('0x10')]||{},'attributes':['id','name']})['then'](function(_0x5e439b){if(_0x5e439b){_0x3be419=_0x5e439b;return db[_0x7087('0x28')][_0x7087('0x46')]({'where':{'membername':_0x3be419['name']},'individualHooks':!![]});}})[_0x7087('0x1e')](function(){if(_0x3be419){return db[_0x7087('0x29')][_0x7087('0xd')]({'where':{'membername':_0x3be419['name'],'exitAt':null}});}})[_0x7087('0x1e')](function(_0x2a8240){if(_0x3be419){if(_0x2a8240&&_0x2a8240[_0x7087('0x2b')]){var _0x3bcb41=[];_0x2a8240[_0x7087('0x2d')](function(_0x3bc16b){_0x3bcb41['push'](_0x3bc16b[_0x7087('0x35')]({'exitAt':moment()[_0x7087('0x25')](_0x7087('0x2c'))}));});return BPromise[_0x7087('0x47')](_0x3bcb41);}}})[_0x7087('0x1e')](function(){if(_0x3be419){return _0x3be419[_0x7087('0x35')]({'online':![],'voicePause':![],'mailPause':![],'chatPause':![],'faxPause':![],'smsPause':![],'openchannelPause':![]});}})[_0x7087('0x1e')](function(_0x32dccf){_0xae4efd(_0x32dccf);})['catch'](function(_0x4b6ddf){_0x55e4ad(_0x4b6a47[_0x7087('0x1b')](0x1f4,_0x4b6ddf[_0x7087('0x1f')]));});});};exports['LoginUser']=function(_0x5a42e8){var _0x4e536d=this;return new Promise(function(_0x449b63,_0x319804){var _0x17cbc8;var _0x1ccfbb;var _0x5188e8;var _0x24780d;return db[_0x7087('0x1d')][_0x7087('0x3a')]({'where':_0x5a42e8[_0x7087('0xe')][_0x7087('0x10')]||{},'attributes':['id',_0x7087('0x22'),_0x7087('0x23'),'mobile',_0x7087('0x48'),_0x7087('0x32'),_0x7087('0x49'),_0x7087('0x24')]})[_0x7087('0x1e')](function(_0x396014){if(_0x396014){_0x17cbc8=_0x396014;_0x24780d=_0x5a42e8[_0x7087('0x30')][_0x7087('0x24')]?_0x5a42e8[_0x7087('0x30')][_0x7087('0x24')]:util[_0x7087('0x25')](_0x7087('0x2f'),_0x17cbc8[_0x7087('0x22')]);return db[_0x7087('0x1d')]['count']({'where':{'role':_0x7087('0x4a'),'online':!![],'id':{'$ne':_0x17cbc8['id']}}});}})[_0x7087('0x1e')](function(_0x382918){if(_0x382918){_0x5188e8=_0x382918;return require(_0x7087('0x4b'))[_0x7087('0x4c')]();}})[_0x7087('0x1e')](function(_0x14247b){if(_0x14247b&&_0x14247b[_0x7087('0x4d')]&&_0x5188e8>=_0x14247b[_0x7087('0x4d')]){throw new Error(_0x7087('0x4e'));}})[_0x7087('0x1e')](function(){if(_0x17cbc8){return db['UserVoiceQueueRt'][_0x7087('0x46')]({'where':{'membername':_0x17cbc8['name']},'individualHooks':!![]});}})['then'](function(){if(_0x17cbc8){return _0x17cbc8[_0x7087('0x4f')]({'raw':!![]});}})['then'](function(_0x502c56){if(_0x17cbc8){if(_0x502c56){var _0x21b9a8=[];_0x1ccfbb=_0x502c56;if(_0x1ccfbb[_0x7087('0x2b')]){for(var _0x26b4c9=0x0;_0x26b4c9<_0x1ccfbb['length'];_0x26b4c9++){_0x21b9a8[_0x7087('0x2e')](db['UserVoiceQueueRt'][_0x7087('0x50')]({'membername':_0x17cbc8['name'],'UserId':_0x17cbc8['id'],'queue_name':_0x1ccfbb[_0x26b4c9]['name'],'VoiceQueueId':_0x1ccfbb[_0x26b4c9]['id'],'interface':_0x24780d,'paused':_0x17cbc8['loginInPause']||![],'penalty':_0x1ccfbb[_0x26b4c9]['UserVoiceQueue.penalty']||0x0}));}return BPromise[_0x7087('0x47')](_0x21b9a8);}}}})[_0x7087('0x1e')](function(){if(_0x17cbc8){return db[_0x7087('0x29')][_0x7087('0xd')]({'where':{'membername':_0x17cbc8[_0x7087('0x22')],'exitAt':null}});}})[_0x7087('0x1e')](function(_0x173626){if(_0x17cbc8){if(_0x173626&&_0x173626[_0x7087('0x2b')]){var _0x201469=[];_0x173626[_0x7087('0x2d')](function(_0x4b7af2){_0x201469[_0x7087('0x2e')](_0x4b7af2[_0x7087('0x35')]({'exitAt':moment()[_0x7087('0x25')](_0x7087('0x2c'))}));});return BPromise[_0x7087('0x47')](_0x201469);}}})[_0x7087('0x1e')](function(){if(_0x17cbc8){var _0xe6560b=[];var _0x9b67e1=[];var _0x21d8d7=utils[_0x7087('0x51')]();var _0x195823={'membername':_0x17cbc8[_0x7087('0x22')],'interface':_0x24780d,'enterAt':moment()[_0x7087('0x25')](_0x7087('0x2c')),'role':_0x17cbc8[_0x7087('0x23')],'internal':_0x17cbc8[_0x7087('0x32')]};_0x21d8d7[_0x7087('0x2d')](function(_0x35c85c){_0xe6560b[_0x7087('0x2e')](_[_0x7087('0x52')]({'channel':_0x35c85c,'type':_0x7087('0x53'),'data1':_0x7087('0x54'),'data2':_0x24780d},_0x195823));if(_0x17cbc8[_0x7087('0x49')]){_0x9b67e1[_0x7087('0x2e')](_[_0x7087('0x52')]({'channel':_0x35c85c,'type':'PAUSE','data1':_0x7087('0x55')},_0x195823));}});return db['MemberReport']['bulkCreate'](_0xe6560b[_0x7087('0x56')](_0x9b67e1),{'individualHooks':!![]});}})['then'](function(){if(_0x17cbc8){return _0x17cbc8[_0x7087('0x35')]({'online':!![],'lastLoginAt':moment()[_0x7087('0x25')](_0x7087('0x2c')),'voicePause':_0x17cbc8[_0x7087('0x49')]||![],'mailPause':_0x17cbc8[_0x7087('0x49')]||![],'chatPause':_0x17cbc8['loginInPause']||![],'faxPause':_0x17cbc8['loginInPause']||![],'smsPause':_0x17cbc8[_0x7087('0x49')]||![],'openchannelPause':_0x17cbc8[_0x7087('0x49')]||![],'pauseType':_0x17cbc8[_0x7087('0x49')]?_0x7087('0x55'):null,'lastPauseAt':moment()[_0x7087('0x25')](_0x7087('0x2c')),'interface':_0x24780d});}})[_0x7087('0x1e')](function(_0x491c52){_0x449b63(_0x491c52);})[_0x7087('0x1a')](function(_0x3d96bb){_0x319804(_0x4e536d[_0x7087('0x1b')](0x1f4,_0x3d96bb[_0x7087('0x1f')]));});});}; \ No newline at end of file diff --git a/server/api/user/user.socket.js b/server/api/user/user.socket.js index 31b7c6d..4f92171 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 _0xd54e=['./user.events','save','remove','update','emit','register','length','user:'];(function(_0x5401ad,_0x50d388){var _0x390fe4=function(_0x5a5de2){while(--_0x5a5de2){_0x5401ad['push'](_0x5401ad['shift']());}};_0x390fe4(++_0x50d388);}(_0xd54e,0x188));var _0xed54=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd54e[_0x14add3];return _0x4a174f;};'use strict';var UserEvents=require(_0xed54('0x0'));var events=[_0xed54('0x1'),_0xed54('0x2'),_0xed54('0x3')];function createListener(_0x39bfce,_0x1440d){return function(_0x5df219){_0x1440d[_0xed54('0x4')](_0x39bfce,_0x5df219);};}function removeListener(_0x1a44c7,_0x44c6f3){return function(){UserEvents['removeListener'](_0x1a44c7,_0x44c6f3);};}exports[_0xed54('0x5')]=function(_0x2ca761){for(var _0x99f4bd=0x0,_0x3b4e69=events[_0xed54('0x6')];_0x99f4bd<_0x3b4e69;_0x99f4bd++){var _0x4c5039=events[_0x99f4bd];var _0x2f524b=createListener(_0xed54('0x7')+_0x4c5039,_0x2ca761);UserEvents['on'](_0x4c5039,_0x2f524b);}}; \ No newline at end of file +var _0x650a=['./user.events','update','removeListener','register','user:'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x650a,0x1db));var _0xa650=function(_0x3cd44c,_0x5b7a14){_0x3cd44c=_0x3cd44c-0x0;var _0x4bafa8=_0x650a[_0x3cd44c];return _0x4bafa8;};'use strict';var UserEvents=require(_0xa650('0x0'));var events=['save','remove',_0xa650('0x1')];function createListener(_0xe44d04,_0x2ef56b){return function(_0x1e7829){_0x2ef56b['emit'](_0xe44d04,_0x1e7829);};}function removeListener(_0x386f1a,_0x8f32f5){return function(){UserEvents[_0xa650('0x2')](_0x386f1a,_0x8f32f5);};}exports[_0xa650('0x3')]=function(_0x2ad08f){for(var _0x15ef83=0x0,_0x1d5934=events['length'];_0x15ef83<_0x1d5934;_0x15ef83++){var _0x2e18f6=events[_0x15ef83];var _0x3286b5=createListener(_0xa650('0x4')+_0x2e18f6,_0x2ad08f);UserEvents['on'](_0x2e18f6,_0x3286b5);}}; \ No newline at end of file diff --git a/server/api/userChatQueue/index.js b/server/api/userChatQueue/index.js index cbda2b8..e456d76 100644 --- a/server/api/userChatQueue/index.js +++ b/server/api/userChatQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x1cb128,_0x2770eb){var _0x4843e2=function(_0xc5c6b3){while(--_0xc5c6b3){_0x1cb128['push'](_0x1cb128['shift']());}};_0x4843e2(++_0x2770eb);}(_0xa9e0,0x123));var _0x0a9e=function(_0x28947d,_0x4cc9c6){_0x28947d=_0x28947d-0x0;var _0x12d2ee=_0xa9e0[_0x28947d];return _0x12d2ee;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x260e07,_0x2ae072){var _0x259b76=function(_0x331484){while(--_0x331484){_0x260e07['push'](_0x260e07['shift']());}};_0x259b76(++_0x2ae072);}(_0xe706,0xa3));var _0x6e70=function(_0xc56c46,_0x3fc792){_0xc56c46=_0xc56c46-0x0;var _0x2055d6=_0xe706[_0xc56c46];return _0x2055d6;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.attributes.js b/server/api/userChatQueue/userChatQueue.attributes.js index d371a77..94781dc 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 _0x2f66=['INTEGER','sequelize','exports'];(function(_0x5528c3,_0x35a416){var _0x47ec1b=function(_0x54a18e){while(--_0x54a18e){_0x5528c3['push'](_0x5528c3['shift']());}};_0x47ec1b(++_0x35a416);}(_0x2f66,0x1ea));var _0x62f6=function(_0x30a956,_0x11222e){_0x30a956=_0x30a956-0x0;var _0x2ac17d=_0x2f66[_0x30a956];return _0x2ac17d;};'use strict';var Sequelize=require(_0x62f6('0x0'));module[_0x62f6('0x1')]={'penalty':{'type':Sequelize[_0x62f6('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0xedc4=['exports','INTEGER','sequelize'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xedc4,0x13a));var _0x4edc=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xedc4[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x4edc('0x0'));module[_0x4edc('0x1')]={'penalty':{'type':Sequelize[_0x4edc('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.model.js b/server/api/userChatQueue/userChatQueue.model.js index 5231ec8..f9132fb 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 _0x327f=['path','rimraf','../../config/environment','./userChatQueue.attributes','define','user_has_chat_queues','util','../../config/logger','api','moment','bluebird','request-promise'];(function(_0x4e6ae6,_0x49dba6){var _0x23c108=function(_0x1bc103){while(--_0x1bc103){_0x4e6ae6['push'](_0x4e6ae6['shift']());}};_0x23c108(++_0x49dba6);}(_0x327f,0x1da));var _0xf327=function(_0x4b369d,_0x265eb8){_0x4b369d=_0x4b369d-0x0;var _0x571a98=_0x327f[_0x4b369d];return _0x571a98;};'use strict';var _=require('lodash');var util=require(_0xf327('0x0'));var logger=require(_0xf327('0x1'))(_0xf327('0x2'));var moment=require(_0xf327('0x3'));var BPromise=require(_0xf327('0x4'));var rp=require(_0xf327('0x5'));var fs=require('fs');var path=require(_0xf327('0x6'));var rimraf=require(_0xf327('0x7'));var config=require(_0xf327('0x8'));var attributes=require(_0xf327('0x9'));module['exports']=function(_0x2d5dad,_0xdd8107){return _0x2d5dad[_0xf327('0xa')]('UserChatQueue',attributes,{'tableName':_0xf327('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x503e=['../../config/logger','api','moment','bluebird','path','../../config/environment','./userChatQueue.attributes','exports','define','lodash'];(function(_0x500419,_0x549162){var _0x241c1a=function(_0x3bea1a){while(--_0x3bea1a){_0x500419['push'](_0x500419['shift']());}};_0x241c1a(++_0x549162);}(_0x503e,0x185));var _0xe503=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0x503e[_0x47aa64];return _0x549c7a;};'use strict';var _=require(_0xe503('0x0'));var util=require('util');var logger=require(_0xe503('0x1'))(_0xe503('0x2'));var moment=require(_0xe503('0x3'));var BPromise=require(_0xe503('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xe503('0x5'));var rimraf=require('rimraf');var config=require(_0xe503('0x6'));var attributes=require(_0xe503('0x7'));module[_0xe503('0x8')]=function(_0x2c4fd5,_0x53c1c1){return _0x2c4fd5[_0xe503('0x9')]('UserChatQueue',attributes,{'tableName':'user_has_chat_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userChatQueue/userChatQueue.rpc.js b/server/api/userChatQueue/userChatQueue.rpc.js index 6dfa8db..2934a9a 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 _0xccbd=['result','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message'];(function(_0x49760b,_0x589d10){var _0x2c6c1b=function(_0x15f57d){while(--_0x15f57d){_0x49760b['push'](_0x49760b['shift']());}};_0x2c6c1b(++_0x589d10);}(_0xccbd,0x122));var _0xdccb=function(_0x543084,_0x4337f5){_0x543084=_0x543084-0x0;var _0x306a57=_0xccbd[_0x543084];return _0x306a57;};'use strict';var _=require('lodash');var util=require(_0xdccb('0x0'));var moment=require(_0xdccb('0x1'));var BPromise=require(_0xdccb('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdccb('0x3'));var db=require(_0xdccb('0x4'))['db'];var utils=require(_0xdccb('0x5'));var logger=require(_0xdccb('0x6'))(_0xdccb('0x7'));var config=require(_0xdccb('0x8'));var jayson=require(_0xdccb('0x9'));var client=jayson[_0xdccb('0xa')][_0xdccb('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1e9dc0,_0x356b33,_0x2ea642){return new BPromise(function(_0x2efabc,_0x1dbaf8){return client['request'](_0x1e9dc0,_0x2ea642)[_0xdccb('0xc')](function(_0x310ae0){logger[_0xdccb('0xd')](_0xdccb('0xe'),_0x356b33,_0xdccb('0xf'));logger[_0xdccb('0x10')](_0xdccb('0x11'),_0x356b33,'request\x20sent',JSON[_0xdccb('0x12')](_0x310ae0));if(_0x310ae0[_0xdccb('0x13')]){if(_0x310ae0[_0xdccb('0x13')][_0xdccb('0x14')]===0x1f4){logger['error'](_0xdccb('0xe'),_0x356b33,_0x310ae0[_0xdccb('0x13')][_0xdccb('0x15')]);return _0x1dbaf8(_0x310ae0['error']['message']);}logger['error'](_0xdccb('0xe'),_0x356b33,_0x310ae0[_0xdccb('0x13')]['message']);return _0x2efabc(_0x310ae0[_0xdccb('0x13')]['message']);}else{logger[_0xdccb('0xd')](_0xdccb('0xe'),_0x356b33,_0xdccb('0xf'));_0x2efabc(_0x310ae0[_0xdccb('0x16')][_0xdccb('0x15')]);}})[_0xdccb('0x17')](function(_0x3c1941){logger[_0xdccb('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x356b33,_0x3c1941);_0x1dbaf8(_0x3c1941);});});} \ No newline at end of file +var _0x8274=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash'];(function(_0x3b2325,_0x15cfe1){var _0xeaa3ed=function(_0x36e86d){while(--_0x36e86d){_0x3b2325['push'](_0x3b2325['shift']());}};_0xeaa3ed(++_0x15cfe1);}(_0x8274,0xd7));var _0x4827=function(_0x5c6580,_0xceb39){_0x5c6580=_0x5c6580-0x0;var _0x3d5d0b=_0x8274[_0x5c6580];return _0x3d5d0b;};'use strict';var _=require(_0x4827('0x0'));var util=require(_0x4827('0x1'));var moment=require(_0x4827('0x2'));var BPromise=require(_0x4827('0x3'));var rs=require(_0x4827('0x4'));var fs=require('fs');var Redis=require(_0x4827('0x5'));var db=require(_0x4827('0x6'))['db'];var utils=require(_0x4827('0x7'));var logger=require(_0x4827('0x8'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x4827('0x9')][_0x4827('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4e324a,_0x2b59b0,_0x4f67dc){return new BPromise(function(_0x1a18db,_0x4a8153){return client[_0x4827('0xb')](_0x4e324a,_0x4f67dc)[_0x4827('0xc')](function(_0x5161d5){logger[_0x4827('0xd')](_0x4827('0xe'),_0x2b59b0,_0x4827('0xf'));logger[_0x4827('0x10')](_0x4827('0x11'),_0x2b59b0,'request\x20sent',JSON[_0x4827('0x12')](_0x5161d5));if(_0x5161d5['error']){if(_0x5161d5[_0x4827('0x13')][_0x4827('0x14')]===0x1f4){logger[_0x4827('0x13')](_0x4827('0xe'),_0x2b59b0,_0x5161d5[_0x4827('0x13')][_0x4827('0x15')]);return _0x4a8153(_0x5161d5['error'][_0x4827('0x15')]);}logger[_0x4827('0x13')](_0x4827('0xe'),_0x2b59b0,_0x5161d5[_0x4827('0x13')]['message']);return _0x1a18db(_0x5161d5['error'][_0x4827('0x15')]);}else{logger[_0x4827('0xd')](_0x4827('0xe'),_0x2b59b0,_0x4827('0xf'));_0x1a18db(_0x5161d5[_0x4827('0x16')]['message']);}})[_0x4827('0x17')](function(_0x32219b){logger[_0x4827('0x13')](_0x4827('0xe'),_0x2b59b0,_0x32219b);_0x4a8153(_0x32219b);});});} \ No newline at end of file diff --git a/server/api/userFaxQueue/index.js b/server/api/userFaxQueue/index.js index 14bebfd..4b72d90 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0xd95aa2,_0x44cd89){var _0x1b23ca=function(_0xd5aed6){while(--_0xd5aed6){_0xd95aa2['push'](_0xd95aa2['shift']());}};_0x1b23ca(++_0x44cd89);}(_0x70e0,0x17b));var _0x070e=function(_0x57ba2a,_0x1c911c){_0x57ba2a=_0x57ba2a-0x0;var _0x1b1fcf=_0x70e0[_0x57ba2a];return _0x1b1fcf;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x446644,_0x1dd668){var _0x45fca7=function(_0x19312a){while(--_0x19312a){_0x446644['push'](_0x446644['shift']());}};_0x45fca7(++_0x1dd668);}(_0xedd9,0xfc));var _0x9edd=function(_0x52bc4c,_0x2c57f3){_0x52bc4c=_0x52bc4c-0x0;var _0x5bfdcd=_0xedd9[_0x52bc4c];return _0x5bfdcd;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.attributes.js b/server/api/userFaxQueue/userFaxQueue.attributes.js index 74a01cb..91d47d3 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 _0x541c=['exports','INTEGER','sequelize'];(function(_0x2e9b4b,_0x4f4d6a){var _0x398a99=function(_0x54339f){while(--_0x54339f){_0x2e9b4b['push'](_0x2e9b4b['shift']());}};_0x398a99(++_0x4f4d6a);}(_0x541c,0x18b));var _0xc541=function(_0x13c70c,_0x546b34){_0x13c70c=_0x13c70c-0x0;var _0x50f0f2=_0x541c[_0x13c70c];return _0x50f0f2;};'use strict';var Sequelize=require(_0xc541('0x0'));module[_0xc541('0x1')]={'penalty':{'type':Sequelize[_0xc541('0x2')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc541('0x2')],'defaultValue':0x0},'queue':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0x48e1=['INTEGER','STRING'];(function(_0x201fd2,_0x833435){var _0x11eb63=function(_0x493179){while(--_0x493179){_0x201fd2['push'](_0x201fd2['shift']());}};_0x11eb63(++_0x833435);}(_0x48e1,0x10e));var _0x148e=function(_0x30a6f8,_0x5c1729){_0x30a6f8=_0x30a6f8-0x0;var _0x73ae0=_0x48e1[_0x30a6f8];return _0x73ae0;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x148e('0x0')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x148e('0x0')],'defaultValue':0x0},'queue':{'type':Sequelize[_0x148e('0x1')]}}; \ No newline at end of file diff --git a/server/api/userFaxQueue/userFaxQueue.model.js b/server/api/userFaxQueue/userFaxQueue.model.js index 713fc2c..339aad7 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 _0x46f2=['lodash','util','api','moment','bluebird','request-promise','rimraf','./userFaxQueue.attributes','exports','define','UserFaxQueue'];(function(_0x345df8,_0x295e93){var _0x7a1545=function(_0x28fc9b){while(--_0x28fc9b){_0x345df8['push'](_0x345df8['shift']());}};_0x7a1545(++_0x295e93);}(_0x46f2,0x176));var _0x246f=function(_0x21ffea,_0x5618e2){_0x21ffea=_0x21ffea-0x0;var _0x371908=_0x46f2[_0x21ffea];return _0x371908;};'use strict';var _=require(_0x246f('0x0'));var util=require(_0x246f('0x1'));var logger=require('../../config/logger')(_0x246f('0x2'));var moment=require(_0x246f('0x3'));var BPromise=require(_0x246f('0x4'));var rp=require(_0x246f('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x246f('0x6'));var config=require('../../config/environment');var attributes=require(_0x246f('0x7'));module[_0x246f('0x8')]=function(_0x3b5daf,_0x5cd480){return _0x3b5daf[_0x246f('0x9')](_0x246f('0xa'),attributes,{'tableName':'user_has_fax_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xc7f6=['rimraf','../../config/environment','exports','define','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path'];(function(_0x26d44e,_0x4e283a){var _0x10ba9c=function(_0xa54bb2){while(--_0xa54bb2){_0x26d44e['push'](_0x26d44e['shift']());}};_0x10ba9c(++_0x4e283a);}(_0xc7f6,0x1c0));var _0x6c7f=function(_0x2fd881,_0x415ff){_0x2fd881=_0x2fd881-0x0;var _0x23786c=_0xc7f6[_0x2fd881];return _0x23786c;};'use strict';var _=require(_0x6c7f('0x0'));var util=require(_0x6c7f('0x1'));var logger=require(_0x6c7f('0x2'))(_0x6c7f('0x3'));var moment=require(_0x6c7f('0x4'));var BPromise=require(_0x6c7f('0x5'));var rp=require(_0x6c7f('0x6'));var fs=require('fs');var path=require(_0x6c7f('0x7'));var rimraf=require(_0x6c7f('0x8'));var config=require(_0x6c7f('0x9'));var attributes=require('./userFaxQueue.attributes');module[_0x6c7f('0xa')]=function(_0x362b72,_0x1e1bb7){return _0x362b72[_0x6c7f('0xb')]('UserFaxQueue',attributes,{'tableName':'user_has_fax_queues','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 0c48d9c..2a4f977 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 _0xc48f=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','UserFaxQueue,\x20%s,\x20%s','debug','UserFaxQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','result','catch','lodash'];(function(_0xcbbe45,_0xdb31db){var _0x4e7bc6=function(_0x55b34c){while(--_0x55b34c){_0xcbbe45['push'](_0xcbbe45['shift']());}};_0x4e7bc6(++_0xdb31db);}(_0xc48f,0x13a));var _0xfc48=function(_0x46e485,_0x43d1e7){_0x46e485=_0x46e485-0x0;var _0x536576=_0xc48f[_0x46e485];return _0x536576;};'use strict';var _=require(_0xfc48('0x0'));var util=require('util');var moment=require(_0xfc48('0x1'));var BPromise=require(_0xfc48('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xfc48('0x3'));var db=require(_0xfc48('0x4'))['db'];var utils=require(_0xfc48('0x5'));var logger=require('../../config/logger')(_0xfc48('0x6'));var config=require(_0xfc48('0x7'));var jayson=require(_0xfc48('0x8'));var client=jayson[_0xfc48('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x13d747,_0x1297a5,_0x5418ed){return new BPromise(function(_0x235a69,_0x522b59){return client['request'](_0x13d747,_0x5418ed)[_0xfc48('0xa')](function(_0x322f32){logger[_0xfc48('0xb')](_0xfc48('0xc'),_0x1297a5,'request\x20sent');logger[_0xfc48('0xd')](_0xfc48('0xe'),_0x1297a5,_0xfc48('0xf'),JSON[_0xfc48('0x10')](_0x322f32));if(_0x322f32['error']){if(_0x322f32[_0xfc48('0x11')]['code']===0x1f4){logger[_0xfc48('0x11')](_0xfc48('0xc'),_0x1297a5,_0x322f32[_0xfc48('0x11')][_0xfc48('0x12')]);return _0x522b59(_0x322f32[_0xfc48('0x11')][_0xfc48('0x12')]);}logger[_0xfc48('0x11')](_0xfc48('0xc'),_0x1297a5,_0x322f32[_0xfc48('0x11')][_0xfc48('0x12')]);return _0x235a69(_0x322f32[_0xfc48('0x11')][_0xfc48('0x12')]);}else{logger[_0xfc48('0xb')](_0xfc48('0xc'),_0x1297a5,_0xfc48('0xf'));_0x235a69(_0x322f32[_0xfc48('0x13')]['message']);}})[_0xfc48('0x14')](function(_0x410aa3){logger[_0xfc48('0x11')](_0xfc48('0xc'),_0x1297a5,_0x410aa3);_0x522b59(_0x410aa3);});});} \ No newline at end of file +var _0x1c61=['catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','UserFaxQueue,\x20%s,\x20%s','request\x20sent','stringify','error','message','info','result'];(function(_0x20310b,_0x28a114){var _0x5c97ca=function(_0x5b1225){while(--_0x5b1225){_0x20310b['push'](_0x20310b['shift']());}};_0x5c97ca(++_0x28a114);}(_0x1c61,0x17b));var _0x11c6=function(_0x459b74,_0x5773bd){_0x459b74=_0x459b74-0x0;var _0x46cb16=_0x1c61[_0x459b74];return _0x46cb16;};'use strict';var _=require(_0x11c6('0x0'));var util=require(_0x11c6('0x1'));var moment=require(_0x11c6('0x2'));var BPromise=require(_0x11c6('0x3'));var rs=require(_0x11c6('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x11c6('0x5'));var logger=require(_0x11c6('0x6'))(_0x11c6('0x7'));var config=require(_0x11c6('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x11c6('0x9')][_0x11c6('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2c12bd,_0x5145ee,_0x59eb49){return new BPromise(function(_0x37ae47,_0x40e603){return client[_0x11c6('0xb')](_0x2c12bd,_0x59eb49)[_0x11c6('0xc')](function(_0x355584){logger['info'](_0x11c6('0xd'),_0x5145ee,_0x11c6('0xe'));logger['debug']('UserFaxQueue,\x20%s,\x20%s,\x20%s',_0x5145ee,_0x11c6('0xe'),JSON[_0x11c6('0xf')](_0x355584));if(_0x355584['error']){if(_0x355584[_0x11c6('0x10')]['code']===0x1f4){logger[_0x11c6('0x10')](_0x11c6('0xd'),_0x5145ee,_0x355584[_0x11c6('0x10')][_0x11c6('0x11')]);return _0x40e603(_0x355584[_0x11c6('0x10')][_0x11c6('0x11')]);}logger['error']('UserFaxQueue,\x20%s,\x20%s',_0x5145ee,_0x355584[_0x11c6('0x10')][_0x11c6('0x11')]);return _0x37ae47(_0x355584['error']['message']);}else{logger[_0x11c6('0x12')](_0x11c6('0xd'),_0x5145ee,_0x11c6('0xe'));_0x37ae47(_0x355584[_0x11c6('0x13')][_0x11c6('0x11')]);}})[_0x11c6('0x14')](function(_0x1c49a3){logger['error'](_0x11c6('0xd'),_0x5145ee,_0x1c49a3);_0x40e603(_0x1c49a3);});});} \ No newline at end of file diff --git a/server/api/userMailQueue/index.js b/server/api/userMailQueue/index.js index f4e38f6..074229e 100644 --- a/server/api/userMailQueue/index.js +++ b/server/api/userMailQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x25c665,_0x492f44){var _0x2b6cda=function(_0x3c169e){while(--_0x3c169e){_0x25c665['push'](_0x25c665['shift']());}};_0x2b6cda(++_0x492f44);}(_0xe706,0xa3));var _0x6e70=function(_0x31a16a,_0x1d60e3){_0x31a16a=_0x31a16a-0x0;var _0x21c892=_0xe706[_0x31a16a];return _0x21c892;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x15f736,_0x2ea0a6){var _0x519ce6=function(_0xc76e46){while(--_0xc76e46){_0x15f736['push'](_0x15f736['shift']());}};_0x519ce6(++_0x2ea0a6);}(_0xedd9,0xfc));var _0x9edd=function(_0x51651e,_0x440bd8){_0x51651e=_0x51651e-0x0;var _0x410df6=_0xedd9[_0x51651e];return _0x410df6;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.attributes.js b/server/api/userMailQueue/userMailQueue.attributes.js index e764b3d..021259c 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 _0xfda0=['INTEGER','sequelize','exports'];(function(_0xd8aad0,_0x4da2cd){var _0x570860=function(_0x1acc03){while(--_0x1acc03){_0xd8aad0['push'](_0xd8aad0['shift']());}};_0x570860(++_0x4da2cd);}(_0xfda0,0x17b));var _0x0fda=function(_0x575bef,_0x3c9bdd){_0x575bef=_0x575bef-0x0;var _0x330072=_0xfda0[_0x575bef];return _0x330072;};'use strict';var Sequelize=require(_0x0fda('0x0'));module[_0x0fda('0x1')]={'penalty':{'type':Sequelize[_0x0fda('0x2')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7e57=['exports','INTEGER'];(function(_0x2e6dbf,_0x57dd06){var _0x2680e5=function(_0x4018f4){while(--_0x4018f4){_0x2e6dbf['push'](_0x2e6dbf['shift']());}};_0x2680e5(++_0x57dd06);}(_0x7e57,0xf6));var _0x77e5=function(_0x420ccc,_0x26959c){_0x420ccc=_0x420ccc-0x0;var _0x7ccd55=_0x7e57[_0x420ccc];return _0x7ccd55;};'use strict';var Sequelize=require('sequelize');module[_0x77e5('0x0')]={'penalty':{'type':Sequelize[_0x77e5('0x1')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.model.js b/server/api/userMailQueue/userMailQueue.model.js index 10d71b6..8a2b1ce 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 _0x5abf=['path','rimraf','../../config/environment','./userMailQueue.attributes','exports','api','bluebird','request-promise'];(function(_0x3e7243,_0x54780e){var _0x4b6c3c=function(_0x205049){while(--_0x205049){_0x3e7243['push'](_0x3e7243['shift']());}};_0x4b6c3c(++_0x54780e);}(_0x5abf,0x195));var _0xf5ab=function(_0x64b31d,_0x393b36){_0x64b31d=_0x64b31d-0x0;var _0x42c45b=_0x5abf[_0x64b31d];return _0x42c45b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0xf5ab('0x0'));var moment=require('moment');var BPromise=require(_0xf5ab('0x1'));var rp=require(_0xf5ab('0x2'));var fs=require('fs');var path=require(_0xf5ab('0x3'));var rimraf=require(_0xf5ab('0x4'));var config=require(_0xf5ab('0x5'));var attributes=require(_0xf5ab('0x6'));module[_0xf5ab('0x7')]=function(_0x1518d2,_0x12fcba){return _0x1518d2['define']('UserMailQueue',attributes,{'tableName':'user_has_mail_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xbfab=['exports','user_has_mail_queues','lodash','api','moment','bluebird','request-promise','path','rimraf','./userMailQueue.attributes'];(function(_0x42cae2,_0x284ef8){var _0x5f256f=function(_0x41abc8){while(--_0x41abc8){_0x42cae2['push'](_0x42cae2['shift']());}};_0x5f256f(++_0x284ef8);}(_0xbfab,0x1d8));var _0xbbfa=function(_0x2706da,_0x3856f5){_0x2706da=_0x2706da-0x0;var _0x3ba87e=_0xbfab[_0x2706da];return _0x3ba87e;};'use strict';var _=require(_0xbbfa('0x0'));var util=require('util');var logger=require('../../config/logger')(_0xbbfa('0x1'));var moment=require(_0xbbfa('0x2'));var BPromise=require(_0xbbfa('0x3'));var rp=require(_0xbbfa('0x4'));var fs=require('fs');var path=require(_0xbbfa('0x5'));var rimraf=require(_0xbbfa('0x6'));var config=require('../../config/environment');var attributes=require(_0xbbfa('0x7'));module[_0xbbfa('0x8')]=function(_0xcfff5e,_0x14df95){return _0xcfff5e['define']('UserMailQueue',attributes,{'tableName':_0xbbfa('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userMailQueue/userMailQueue.rpc.js b/server/api/userMailQueue/userMailQueue.rpc.js index a6b2c95..ed58f62 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 _0x008c=['../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','UserMailQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','UserMailQueue,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x008c,0x188));var _0xc008=function(_0x4665b8,_0x234a28){_0x4665b8=_0x4665b8-0x0;var _0x54ba4c=_0x008c[_0x4665b8];return _0x54ba4c;};'use strict';var _=require(_0xc008('0x0'));var util=require(_0xc008('0x1'));var moment=require(_0xc008('0x2'));var BPromise=require(_0xc008('0x3'));var rs=require(_0xc008('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xc008('0x5'))['db'];var utils=require(_0xc008('0x6'));var logger=require(_0xc008('0x7'))(_0xc008('0x8'));var config=require(_0xc008('0x9'));var jayson=require(_0xc008('0xa'));var client=jayson[_0xc008('0xb')][_0xc008('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x9c8cb2,_0x4af530,_0x428fa9){return new BPromise(function(_0x5aa09b,_0x30be38){return client['request'](_0x9c8cb2,_0x428fa9)['then'](function(_0x27830d){logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');logger['debug'](_0xc008('0xe'),_0x4af530,_0xc008('0xf'),JSON['stringify'](_0x27830d));if(_0x27830d[_0xc008('0x10')]){if(_0x27830d[_0xc008('0x10')][_0xc008('0x11')]===0x1f4){logger[_0xc008('0x10')](_0xc008('0x12'),_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x30be38(_0x27830d['error']['message']);}logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);return _0x5aa09b(_0x27830d[_0xc008('0x10')][_0xc008('0x13')]);}else{logger[_0xc008('0xd')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,'request\x20sent');_0x5aa09b(_0x27830d['result'][_0xc008('0x13')]);}})[_0xc008('0x14')](function(_0x3cafe3){logger[_0xc008('0x10')]('UserMailQueue,\x20%s,\x20%s',_0x4af530,_0x3cafe3);_0x30be38(_0x3cafe3);});});} \ No newline at end of file +var _0xf3cd=['catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','info','request\x20sent','debug','UserMailQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserMailQueue,\x20%s,\x20%s','message','result'];(function(_0x3c9e47,_0x5c1342){var _0x38f4df=function(_0x1bc10c){while(--_0x1bc10c){_0x3c9e47['push'](_0x3c9e47['shift']());}};_0x38f4df(++_0x5c1342);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x2b6600,_0x24c497){_0x2b6600=_0x2b6600-0x0;var _0x912ee2=_0xf3cd[_0x2b6600];return _0x912ee2;};'use strict';var _=require(_0xdf3c('0x0'));var util=require(_0xdf3c('0x1'));var moment=require(_0xdf3c('0x2'));var BPromise=require(_0xdf3c('0x3'));var rs=require(_0xdf3c('0x4'));var fs=require('fs');var Redis=require(_0xdf3c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xdf3c('0x6'));var logger=require(_0xdf3c('0x7'))(_0xdf3c('0x8'));var config=require('../../config/environment');var jayson=require(_0xdf3c('0x9'));var client=jayson[_0xdf3c('0xa')][_0xdf3c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1f0601,_0x106021,_0x28edae){return new BPromise(function(_0x52c073,_0x15705d){return client['request'](_0x1f0601,_0x28edae)['then'](function(_0x22d8ae){logger[_0xdf3c('0xc')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0xdf3c('0xd'));logger[_0xdf3c('0xe')](_0xdf3c('0xf'),_0x106021,_0xdf3c('0xd'),JSON[_0xdf3c('0x10')](_0x22d8ae));if(_0x22d8ae[_0xdf3c('0x11')]){if(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x12')]===0x1f4){logger['error'](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);return _0x15705d(_0x22d8ae[_0xdf3c('0x11')]['message']);}logger[_0xdf3c('0x11')](_0xdf3c('0x13'),_0x106021,_0x22d8ae[_0xdf3c('0x11')]['message']);return _0x52c073(_0x22d8ae[_0xdf3c('0x11')][_0xdf3c('0x14')]);}else{logger[_0xdf3c('0xc')](_0xdf3c('0x13'),_0x106021,_0xdf3c('0xd'));_0x52c073(_0x22d8ae[_0xdf3c('0x15')][_0xdf3c('0x14')]);}})[_0xdf3c('0x16')](function(_0x2986d0){logger[_0xdf3c('0x11')]('UserMailQueue,\x20%s,\x20%s',_0x106021,_0x2986d0);_0x15705d(_0x2986d0);});});} \ No newline at end of file diff --git a/server/api/userNotification/index.js b/server/api/userNotification/index.js index d5b1eb0..4cb4de4 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 _0x15d5=['./userNotification.controller','sendUserNotification','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/interaction/service','../../config/environment'];(function(_0x329e79,_0xac77d2){var _0x22a675=function(_0x556127){while(--_0x556127){_0x329e79['push'](_0x329e79['shift']());}};_0x22a675(++_0xac77d2);}(_0x15d5,0x153));var _0x515d=function(_0x21cc88,_0x150e10){_0x21cc88=_0x21cc88-0x0;var _0x34bdde=_0x15d5[_0x21cc88];return _0x34bdde;};'use strict';var multer=require(_0x515d('0x0'));var util=require(_0x515d('0x1'));var path=require(_0x515d('0x2'));var timeout=require(_0x515d('0x3'));var express=require(_0x515d('0x4'));var router=express[_0x515d('0x5')]();var fs_extra=require(_0x515d('0x6'));var auth=require('../../components/auth/service');var interaction=require(_0x515d('0x7'));var config=require(_0x515d('0x8'));var controller=require(_0x515d('0x9'));router['post']('/',auth['isAuthenticated'](),controller[_0x515d('0xa')]);module[_0x515d('0xb')]=router; \ No newline at end of file +var _0x858e=['../../components/auth/service','../../config/environment','./userNotification.controller','post','sendUserNotification','exports','multer','util','connect-timeout','express','Router','fs-extra'];(function(_0x1fcf51,_0x165fc7){var _0x579e45=function(_0x380792){while(--_0x380792){_0x1fcf51['push'](_0x1fcf51['shift']());}};_0x579e45(++_0x165fc7);}(_0x858e,0xea));var _0xe858=function(_0xbb98d2,_0x152fbf){_0xbb98d2=_0xbb98d2-0x0;var _0x279874=_0x858e[_0xbb98d2];return _0x279874;};'use strict';var multer=require(_0xe858('0x0'));var util=require(_0xe858('0x1'));var path=require('path');var timeout=require(_0xe858('0x2'));var express=require(_0xe858('0x3'));var router=express[_0xe858('0x4')]();var fs_extra=require(_0xe858('0x5'));var auth=require(_0xe858('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe858('0x7'));var controller=require(_0xe858('0x8'));router[_0xe858('0x9')]('/',auth['isAuthenticated'](),controller[_0xe858('0xa')]);module[_0xe858('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 32bf811..2217ae4 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 _0x4f17=['BOOLEAN','sequelize','exports','TEXT'];(function(_0x47ef18,_0x381ab1){var _0x3046f0=function(_0x5eefc0){while(--_0x5eefc0){_0x47ef18['push'](_0x47ef18['shift']());}};_0x3046f0(++_0x381ab1);}(_0x4f17,0xa1));var _0x74f1=function(_0x5e3b04,_0xbb6795){_0x5e3b04=_0x5e3b04-0x0;var _0x1fc44d=_0x4f17[_0x5e3b04];return _0x1fc44d;};'use strict';var Sequelize=require(_0x74f1('0x0'));module[_0x74f1('0x1')]={'body':{'type':Sequelize[_0x74f1('0x2')]},'senderName':{'type':Sequelize['STRING']},'recipientsId':{'type':Sequelize[_0x74f1('0x2')]},'recipientsDescription':{'type':Sequelize['STRING']},'beep':{'type':Sequelize[_0x74f1('0x3')]}}; \ No newline at end of file +var _0x48bc=['exports','TEXT','STRING'];(function(_0x307909,_0x1f5929){var _0x36f6b2=function(_0x222161){while(--_0x222161){_0x307909['push'](_0x307909['shift']());}};_0x36f6b2(++_0x1f5929);}(_0x48bc,0x1e0));var _0xc48b=function(_0x55a44e,_0x5f52f6){_0x55a44e=_0x55a44e-0x0;var _0x15d90f=_0x48bc[_0x55a44e];return _0x15d90f;};'use strict';var Sequelize=require('sequelize');module[_0xc48b('0x0')]={'body':{'type':Sequelize[_0xc48b('0x1')]},'senderName':{'type':Sequelize[_0xc48b('0x2')]},'recipientsId':{'type':Sequelize[_0xc48b('0x1')]},'recipientsDescription':{'type':Sequelize[_0xc48b('0x2')]},'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 3b10f79..b5d8ea4 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 _0x9f51=['union','ids','includes','queue','Queue','push','all','findOne','map','eml-format','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','sendStatus','status','end','json','undefined','limit','count','apply','reject','then','destroy','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','error','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','user','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','fullname','isEmpty','recipientsDescription','beep','SenderId','recipientsId','join','sequelize','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','Template','html','startCase','model','User'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x9f51,0x126));var _0x19f5=function(_0x48e86c,_0x9f034d){_0x48e86c=_0x48e86c-0x0;var _0x54fa11=_0x9f51[_0x48e86c];return _0x54fa11;};'use strict';var emlformat=require(_0x19f5('0x0'));var rimraf=require(_0x19f5('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x19f5('0x2'));var rp=require(_0x19f5('0x3'));var moment=require(_0x19f5('0x4'));var BPromise=require(_0x19f5('0x5'));var Mustache=require(_0x19f5('0x6'));var util=require(_0x19f5('0x7'));var path=require(_0x19f5('0x8'));var sox=require('sox');var csv=require(_0x19f5('0x9'));var ejs=require(_0x19f5('0xa'));var fs=require('fs');var fs_extra=require(_0x19f5('0xb'));var _=require(_0x19f5('0xc'));var squel=require('squel');var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x19f5('0xd'));var toCsv=require(_0x19f5('0x9'));var querystring=require(_0x19f5('0xe'));var Papa=require(_0x19f5('0xf'));var Redis=require(_0x19f5('0x10'));var authService=require('../../components/auth/service');var qs=require(_0x19f5('0x11'));var as=require(_0x19f5('0x12'));var hardwareService=require(_0x19f5('0x13'));var logger=require(_0x19f5('0x14'))(_0x19f5('0x15'));var utils=require('../../config/utils');var config=require(_0x19f5('0x16'));var licenseUtil=require(_0x19f5('0x17'));var db=require(_0x19f5('0x18'))['db'];config[_0x19f5('0x19')]=_[_0x19f5('0x1a')](config['redis'],{'host':_0x19f5('0x1b'),'port':0x18eb});var socket=require(_0x19f5('0x1c'))(new Redis(config[_0x19f5('0x19')]));require('./userNotification.socket')['register'](socket);function respondWithStatusCode(_0xdaf322,_0x1f95e1){_0x1f95e1=_0x1f95e1||0xcc;return function(_0x22e4ad){if(_0x22e4ad){return _0xdaf322[_0x19f5('0x1d')](_0x1f95e1);}return _0xdaf322[_0x19f5('0x1e')](_0x1f95e1)[_0x19f5('0x1f')]();};}function respondWithResult(_0x349e23,_0x59d788){_0x59d788=_0x59d788||0xc8;return function(_0x1e82bd){if(_0x1e82bd){return _0x349e23[_0x19f5('0x1e')](_0x59d788)[_0x19f5('0x20')](_0x1e82bd);}};}function respondWithFilteredResult(_0x194634,_0x43091a){return function(_0x4bee1c){if(_0x4bee1c){var _0x2c57e4=typeof _0x43091a['offset']===_0x19f5('0x21')&&typeof _0x43091a[_0x19f5('0x22')]===_0x19f5('0x21');var _0x39d562=_0x4bee1c[_0x19f5('0x23')];var _0x23d58f=_0x2c57e4?0x0:_0x43091a['offset'];var _0x8da8da=_0x2c57e4?_0x4bee1c[_0x19f5('0x23')]:_0x43091a['offset']+_0x43091a[_0x19f5('0x22')];var _0xe0a84d;if(_0x8da8da>=_0x39d562){_0x8da8da=_0x39d562;_0xe0a84d=0xc8;}else{_0xe0a84d=0xce;}_0x194634[_0x19f5('0x1e')](_0xe0a84d);return _0x194634['set']('Content-Range',_0x23d58f+'-'+_0x8da8da+'/'+_0x39d562)['json'](_0x4bee1c);}return null;};}function patchUpdates(_0x58d647){return function(_0x113b39){try{jsonpatch[_0x19f5('0x24')](_0x113b39,_0x58d647,!![]);}catch(_0x5c6211){return BPromise[_0x19f5('0x25')](_0x5c6211);}return _0x113b39['save']();};}function saveUpdates(_0x218c61,_0x1aa4f9){return function(_0x19a66c){if(_0x19a66c){return _0x19a66c['update'](_0x218c61)[_0x19f5('0x26')](function(_0x58cb09){return _0x58cb09;});}return null;};}function removeEntity(_0x593656,_0x5345e3){return function(_0x13002b){if(_0x13002b){return _0x13002b[_0x19f5('0x27')]()[_0x19f5('0x26')](function(){_0x593656[_0x19f5('0x1e')](0xcc)[_0x19f5('0x1f')]();});}};}function handleEntityNotFound(_0x5032bc,_0x31efcc){return function(_0x12c511){if(!_0x12c511){_0x5032bc[_0x19f5('0x1d')](0x194);}return _0x12c511;};}function handleError(_0x2290f5,_0x2d074e){_0x2d074e=_0x2d074e||0x1f4;return function(_0x4cbc3f){logger['error'](_0x4cbc3f[_0x19f5('0x28')]);if(_0x4cbc3f['name']){delete _0x4cbc3f[_0x19f5('0x29')];}_0x2290f5[_0x19f5('0x1e')](_0x2d074e)[_0x19f5('0x2a')](_0x4cbc3f);};}exports[_0x19f5('0x2b')]=function(_0x10ff7d,_0x3ee530,_0x463414){if(!_0x10ff7d[_0x19f5('0x2c')][_0x19f5('0x2d')](_0x19f5('0x2e'))&&!_0x10ff7d['body']['hasOwnProperty'](_0x19f5('0x2f'))){throw new db[(_0x19f5('0x30'))][(_0x19f5('0x31'))](_0x19f5('0x32'));}else{if(_0x10ff7d[_0x19f5('0x2c')][_0x19f5('0x2d')](_0x19f5('0x2f'))&&!_0x10ff7d[_0x19f5('0x2c')][_0x19f5('0x2d')](_0x19f5('0x33'))){throw new db['Sequelize'][(_0x19f5('0x31'))]('Missing\x20\x27view\x27\x20parameter');}if(!_0x10ff7d[_0x19f5('0x2c')]['hasOwnProperty'](_0x19f5('0x34'))){throw new db[(_0x19f5('0x30'))][(_0x19f5('0x31'))](_0x19f5('0x35'));}else{try{var _0x17c773=JSON[_0x19f5('0x36')](_0x10ff7d[_0x19f5('0x2c')][_0x19f5('0x34')]);}catch(_0x5755e3){logger[_0x19f5('0x37')](_0x5755e3);throw new db[(_0x19f5('0x30'))][(_0x19f5('0x31'))](_0x19f5('0x38'));}var _0x373be6=[_0x19f5('0x39'),_0x19f5('0x3a'),_0x19f5('0x3b'),'openchannelqueue',_0x19f5('0x3c'),_0x19f5('0x3d'),'whatsappqueue','team',_0x19f5('0x3e')];if(_['some'](_0x17c773,function(_0x20f510){return!_['includes'](_0x373be6,_0x20f510['model'][_0x19f5('0x3f')]());})){throw new db[(_0x19f5('0x30'))][(_0x19f5('0x31'))](_0x19f5('0x40'));}}}var _0x46a452={};_0x46a452[_0x19f5('0x41')]=_0x10ff7d[_0x19f5('0x2c')]['hasOwnProperty'](_0x19f5('0x41'))?_0x10ff7d[_0x19f5('0x2c')][_0x19f5('0x41')]:_0x10ff7d['user'][_0x19f5('0x42')];_0x46a452['recipientsDescription']=_[_0x19f5('0x43')](_0x10ff7d['body'][_0x19f5('0x44')])?null:_0x10ff7d[_0x19f5('0x2c')][_0x19f5('0x44')];_0x46a452[_0x19f5('0x45')]=_0x10ff7d[_0x19f5('0x2c')]['beep']||![];_0x46a452[_0x19f5('0x46')]=_0x10ff7d[_0x19f5('0x3e')]['id'];return getContent(_0x10ff7d[_0x19f5('0x2c')])[_0x19f5('0x26')](function(_0x21bfb5){_0x46a452[_0x19f5('0x2c')]=_0x21bfb5;return getRecipients(_0x17c773);})[_0x19f5('0x26')](function(_0x1ffb27){_0x46a452[_0x19f5('0x47')]=_['sortBy'](_0x1ffb27)[_0x19f5('0x48')](',');return db[_0x19f5('0x49')]['transaction'](function(_0x178fc0){return db[_0x19f5('0x4a')][_0x19f5('0x4b')](_0x46a452,{'raw':!![],'transaction':_0x178fc0})[_0x19f5('0x26')](function(_0x46bd76){var _0xf0d575={'sender':_0x46a452[_0x19f5('0x41')],'description':_0x46a452['recipientsDescription'],'content':_0x46a452[_0x19f5('0x2c')],'beep':_0x46a452['beep']};_0x1ffb27[_0x19f5('0x4c')](function(_0x284869){_0xf0d575[_0x19f5('0x4d')]=_0x284869;socket[_0x19f5('0x4e')](_0x19f5('0x4f'),_0xf0d575);});return _0x46bd76;});});})['then'](respondWithResult(_0x3ee530,0xc9))[_0x19f5('0x50')](handleError(_0x3ee530,null));};function getContent(_0x2e94ed){return new BPromise(function(_0x4801d9,_0x459e7e){if(_0x2e94ed[_0x19f5('0x2e')]){_0x4801d9(_0x2e94ed[_0x19f5('0x2e')]);return;}return db[_0x19f5('0x51')]['findOne']({'attributes':[_0x19f5('0x52')],'where':{'id':_0x2e94ed[_0x19f5('0x2f')]},'raw':!![]})[_0x19f5('0x26')](function(_0x5abd83){if(!_0x5abd83)throw new db['Sequelize'][(_0x19f5('0x31'))]('Invalid\x20\x27TemplateId\x27\x20parameter');var _0xf5c74f=Mustache['render'](_0x5abd83[_0x19f5('0x52')],_0x2e94ed['view']);_0x4801d9(_0xf5c74f);})[_0x19f5('0x50')](function(_0x1807ae){_0x459e7e(_0x1807ae);});});}function getRecipients(_0x21dbc2){return new BPromise(function(_0x2278da,_0x3a7928){var _0x353400=[];var _0x44a21d=[];_0x21dbc2[_0x19f5('0x4c')](function(_0x1e9611){var _0x53ae4d=_[_0x19f5('0x53')](_0x1e9611[_0x19f5('0x54')][_0x19f5('0x3f')]());if(_0x53ae4d===_0x19f5('0x55')){_0x353400=_[_0x19f5('0x56')](_0x353400,_0x1e9611[_0x19f5('0x57')]);}else{if(_[_0x19f5('0x58')](_0x53ae4d,_0x19f5('0x59')))_0x53ae4d=_0x53ae4d['replace'](_0x19f5('0x59'),_0x19f5('0x5a'));_0x1e9611[_0x19f5('0x57')][_0x19f5('0x4c')](function(_0x2141e7){_0x44a21d[_0x19f5('0x5b')](getAgents(_0x53ae4d,_0x2141e7));});}});return BPromise[_0x19f5('0x5c')](_0x44a21d)[_0x19f5('0x26')](function(_0x51c53a){_0x353400=_[_0x19f5('0x56')](_0x353400,_['flatten'](_0x51c53a));_0x2278da(_0x353400);})['catch'](function(_0x5bf844){_0x3a7928(_0x5bf844);});});}function getAgents(_0x36878c,_0x2703db){return new BPromise(function(_0x5df370,_0x2544a1){return db[_0x36878c][_0x19f5('0x5d')]({'where':{'id':_0x2703db}})['then'](function(_0x483f7c){return _0x483f7c['getAgents']({'attributes':['id'],'raw':!![]})[_0x19f5('0x26')](function(_0x1fa140){var _0x250eb1=_[_0x19f5('0x5e')](_0x1fa140,'id');_0x5df370(_0x250eb1);});})['catch'](function(_0x55f26a){_0x2544a1(_0x55f26a);});});} \ No newline at end of file +var _0x72ff=['papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','status','end','offset','undefined','limit','count','set','Content-Range','json','save','update','then','sendStatus','error','stack','name','send','sendUserNotification','body','hasOwnProperty','text','TemplateId','Sequelize','ValidationError','Must\x20specify\x20at\x20least\x20one\x20argument\x20for\x20\x27text\x27\x20or\x20\x27TemplateId\x27','view','Missing\x20\x27view\x27\x20parameter','recipients','Missing\x20\x27recipients\x27\x20parameter','parse','Invalid\x20\x27recipients\x27\x20object','chatqueue','faxqueue','mailqueue','smsqueue','voicequeue','user','model','toLowerCase','Invalid\x20model\x20in\x20\x27recipients\x27\x20object','senderName','recipientsDescription','isEmpty','beep','SenderId','recipientsId','sortBy','transaction','UserNotification','create','forEach','recipient','emit','userNotification:send','catch','html','startCase','ids','includes','queue','replace','Queue','all','union','getAgents','map','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','querystring'];(function(_0x2a674d,_0x218f91){var _0xf771e8=function(_0x2583c1){while(--_0x2583c1){_0x2a674d['push'](_0x2a674d['shift']());}};_0xf771e8(++_0x218f91);}(_0x72ff,0x1da));var _0xf72f=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x72ff[_0x50a0c2];return _0x5ebadd;};'use strict';var emlformat=require(_0xf72f('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xf72f('0x1'));var jsonpatch=require(_0xf72f('0x2'));var rp=require(_0xf72f('0x3'));var moment=require(_0xf72f('0x4'));var BPromise=require(_0xf72f('0x5'));var Mustache=require(_0xf72f('0x6'));var util=require(_0xf72f('0x7'));var path=require('path');var sox=require(_0xf72f('0x8'));var csv=require('to-csv');var ejs=require(_0xf72f('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xf72f('0xa'));var squel=require(_0xf72f('0xb'));var crypto=require('crypto');var jsforce=require(_0xf72f('0xc'));var deskjs=require(_0xf72f('0xd'));var toCsv=require(_0xf72f('0xe'));var querystring=require(_0xf72f('0xf'));var Papa=require(_0xf72f('0x10'));var Redis=require(_0xf72f('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xf72f('0x12'));var as=require(_0xf72f('0x13'));var hardwareService=require(_0xf72f('0x14'));var logger=require(_0xf72f('0x15'))(_0xf72f('0x16'));var utils=require(_0xf72f('0x17'));var config=require(_0xf72f('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xf72f('0x19'))['db'];config[_0xf72f('0x1a')]=_[_0xf72f('0x1b')](config[_0xf72f('0x1a')],{'host':_0xf72f('0x1c'),'port':0x18eb});var socket=require(_0xf72f('0x1d'))(new Redis(config[_0xf72f('0x1a')]));require(_0xf72f('0x1e'))[_0xf72f('0x1f')](socket);function respondWithStatusCode(_0x1593f7,_0x3ba10a){_0x3ba10a=_0x3ba10a||0xcc;return function(_0x20fc6b){if(_0x20fc6b){return _0x1593f7['sendStatus'](_0x3ba10a);}return _0x1593f7[_0xf72f('0x20')](_0x3ba10a)[_0xf72f('0x21')]();};}function respondWithResult(_0x129b69,_0x8bc24f){_0x8bc24f=_0x8bc24f||0xc8;return function(_0x3ce707){if(_0x3ce707){return _0x129b69['status'](_0x8bc24f)['json'](_0x3ce707);}};}function respondWithFilteredResult(_0x2435b3,_0x4b3530){return function(_0x1e10f0){if(_0x1e10f0){var _0x12c00e=typeof _0x4b3530[_0xf72f('0x22')]===_0xf72f('0x23')&&typeof _0x4b3530[_0xf72f('0x24')]===_0xf72f('0x23');var _0x4e8aa5=_0x1e10f0[_0xf72f('0x25')];var _0x5984bd=_0x12c00e?0x0:_0x4b3530[_0xf72f('0x22')];var _0x1e0e73=_0x12c00e?_0x1e10f0[_0xf72f('0x25')]:_0x4b3530[_0xf72f('0x22')]+_0x4b3530['limit'];var _0x518b10;if(_0x1e0e73>=_0x4e8aa5){_0x1e0e73=_0x4e8aa5;_0x518b10=0xc8;}else{_0x518b10=0xce;}_0x2435b3[_0xf72f('0x20')](_0x518b10);return _0x2435b3[_0xf72f('0x26')](_0xf72f('0x27'),_0x5984bd+'-'+_0x1e0e73+'/'+_0x4e8aa5)[_0xf72f('0x28')](_0x1e10f0);}return null;};}function patchUpdates(_0x440c89){return function(_0x2da167){try{jsonpatch['apply'](_0x2da167,_0x440c89,!![]);}catch(_0x2de037){return BPromise['reject'](_0x2de037);}return _0x2da167[_0xf72f('0x29')]();};}function saveUpdates(_0x5ae3db,_0x42899e){return function(_0x39526f){if(_0x39526f){return _0x39526f[_0xf72f('0x2a')](_0x5ae3db)[_0xf72f('0x2b')](function(_0x48d0a8){return _0x48d0a8;});}return null;};}function removeEntity(_0x5bc889,_0x5d9180){return function(_0x53be8e){if(_0x53be8e){return _0x53be8e['destroy']()[_0xf72f('0x2b')](function(){_0x5bc889[_0xf72f('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x555c72,_0x291bdb){return function(_0x26b6db){if(!_0x26b6db){_0x555c72[_0xf72f('0x2c')](0x194);}return _0x26b6db;};}function handleError(_0x2b2bfc,_0x15e9fc){_0x15e9fc=_0x15e9fc||0x1f4;return function(_0x3f85da){logger[_0xf72f('0x2d')](_0x3f85da[_0xf72f('0x2e')]);if(_0x3f85da[_0xf72f('0x2f')]){delete _0x3f85da[_0xf72f('0x2f')];}_0x2b2bfc[_0xf72f('0x20')](_0x15e9fc)[_0xf72f('0x30')](_0x3f85da);};}exports[_0xf72f('0x31')]=function(_0x47c493,_0x1eaf03,_0x4ab56c){if(!_0x47c493[_0xf72f('0x32')][_0xf72f('0x33')](_0xf72f('0x34'))&&!_0x47c493[_0xf72f('0x32')]['hasOwnProperty'](_0xf72f('0x35'))){throw new db[(_0xf72f('0x36'))][(_0xf72f('0x37'))](_0xf72f('0x38'));}else{if(_0x47c493[_0xf72f('0x32')][_0xf72f('0x33')](_0xf72f('0x35'))&&!_0x47c493['body'][_0xf72f('0x33')](_0xf72f('0x39'))){throw new db[(_0xf72f('0x36'))]['ValidationError'](_0xf72f('0x3a'));}if(!_0x47c493[_0xf72f('0x32')][_0xf72f('0x33')](_0xf72f('0x3b'))){throw new db[(_0xf72f('0x36'))][(_0xf72f('0x37'))](_0xf72f('0x3c'));}else{try{var _0x5e92e8=JSON[_0xf72f('0x3d')](_0x47c493[_0xf72f('0x32')]['recipients']);}catch(_0x3255c){logger[_0xf72f('0x2d')](_0x3255c);throw new db[(_0xf72f('0x36'))][(_0xf72f('0x37'))](_0xf72f('0x3e'));}var _0x428366=[_0xf72f('0x3f'),_0xf72f('0x40'),_0xf72f('0x41'),'openchannelqueue',_0xf72f('0x42'),_0xf72f('0x43'),'whatsappqueue','team',_0xf72f('0x44')];if(_['some'](_0x5e92e8,function(_0x477c98){return!_['includes'](_0x428366,_0x477c98[_0xf72f('0x45')][_0xf72f('0x46')]());})){throw new db['Sequelize'][(_0xf72f('0x37'))](_0xf72f('0x47'));}}}var _0xc6f451={};_0xc6f451['senderName']=_0x47c493[_0xf72f('0x32')][_0xf72f('0x33')](_0xf72f('0x48'))?_0x47c493['body'][_0xf72f('0x48')]:_0x47c493[_0xf72f('0x44')]['fullname'];_0xc6f451[_0xf72f('0x49')]=_[_0xf72f('0x4a')](_0x47c493[_0xf72f('0x32')][_0xf72f('0x49')])?null:_0x47c493[_0xf72f('0x32')]['recipientsDescription'];_0xc6f451[_0xf72f('0x4b')]=_0x47c493['body'][_0xf72f('0x4b')]||![];_0xc6f451[_0xf72f('0x4c')]=_0x47c493[_0xf72f('0x44')]['id'];return getContent(_0x47c493['body'])[_0xf72f('0x2b')](function(_0x32cb78){_0xc6f451[_0xf72f('0x32')]=_0x32cb78;return getRecipients(_0x5e92e8);})[_0xf72f('0x2b')](function(_0x364434){_0xc6f451[_0xf72f('0x4d')]=_[_0xf72f('0x4e')](_0x364434)['join'](',');return db['sequelize'][_0xf72f('0x4f')](function(_0x549c71){return db[_0xf72f('0x50')][_0xf72f('0x51')](_0xc6f451,{'raw':!![],'transaction':_0x549c71})[_0xf72f('0x2b')](function(_0x700fca){var _0x29205e={'sender':_0xc6f451[_0xf72f('0x48')],'description':_0xc6f451[_0xf72f('0x49')],'content':_0xc6f451['body'],'beep':_0xc6f451[_0xf72f('0x4b')]};_0x364434[_0xf72f('0x52')](function(_0xbcdc73){_0x29205e[_0xf72f('0x53')]=_0xbcdc73;socket[_0xf72f('0x54')](_0xf72f('0x55'),_0x29205e);});return _0x700fca;});});})[_0xf72f('0x2b')](respondWithResult(_0x1eaf03,0xc9))[_0xf72f('0x56')](handleError(_0x1eaf03,null));};function getContent(_0x375d8a){return new BPromise(function(_0x24f16f,_0x4f0307){if(_0x375d8a['text']){_0x24f16f(_0x375d8a[_0xf72f('0x34')]);return;}return db['Template']['findOne']({'attributes':[_0xf72f('0x57')],'where':{'id':_0x375d8a[_0xf72f('0x35')]},'raw':!![]})[_0xf72f('0x2b')](function(_0x4688ce){if(!_0x4688ce)throw new db[(_0xf72f('0x36'))]['ValidationError']('Invalid\x20\x27TemplateId\x27\x20parameter');var _0x10f4da=Mustache['render'](_0x4688ce[_0xf72f('0x57')],_0x375d8a[_0xf72f('0x39')]);_0x24f16f(_0x10f4da);})[_0xf72f('0x56')](function(_0x14bdb8){_0x4f0307(_0x14bdb8);});});}function getRecipients(_0x62d3a8){return new BPromise(function(_0x365dca,_0xdc4488){var _0x1dca26=[];var _0x33b23e=[];_0x62d3a8[_0xf72f('0x52')](function(_0x46827b){var _0x57afea=_[_0xf72f('0x58')](_0x46827b[_0xf72f('0x45')]['toLowerCase']());if(_0x57afea==='User'){_0x1dca26=_['union'](_0x1dca26,_0x46827b[_0xf72f('0x59')]);}else{if(_[_0xf72f('0x5a')](_0x57afea,_0xf72f('0x5b')))_0x57afea=_0x57afea[_0xf72f('0x5c')](_0xf72f('0x5b'),_0xf72f('0x5d'));_0x46827b['ids'][_0xf72f('0x52')](function(_0x3f6096){_0x33b23e['push'](getAgents(_0x57afea,_0x3f6096));});}});return BPromise[_0xf72f('0x5e')](_0x33b23e)[_0xf72f('0x2b')](function(_0x542a91){_0x1dca26=_[_0xf72f('0x5f')](_0x1dca26,_['flatten'](_0x542a91));_0x365dca(_0x1dca26);})[_0xf72f('0x56')](function(_0xf4705){_0xdc4488(_0xf4705);});});}function getAgents(_0x46b185,_0x45f762){return new BPromise(function(_0x230ebf,_0x108862){return db[_0x46b185]['findOne']({'where':{'id':_0x45f762}})[_0xf72f('0x2b')](function(_0x134910){return _0x134910[_0xf72f('0x60')]({'attributes':['id'],'raw':!![]})[_0xf72f('0x2b')](function(_0x3aecfa){var _0x27b29e=_[_0xf72f('0x61')](_0x3aecfa,'id');_0x230ebf(_0x27b29e);});})[_0xf72f('0x56')](function(_0x269165){_0x108862(_0x269165);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.events.js b/server/api/userNotification/userNotification.events.js index 8394060..ff71c7b 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 _0x2939=['emit','hook','exports','../../mysqldb','UserNotification','setMaxListeners','update','remove'];(function(_0x214437,_0x33bcaf){var _0x263a24=function(_0x4bd94b){while(--_0x4bd94b){_0x214437['push'](_0x214437['shift']());}};_0x263a24(++_0x33bcaf);}(_0x2939,0x7b));var _0x9293=function(_0x1a6e4e,_0x42d8f1){_0x1a6e4e=_0x1a6e4e-0x0;var _0x45bca1=_0x2939[_0x1a6e4e];return _0x45bca1;};'use strict';var EventEmitter=require('events');var UserNotification=require(_0x9293('0x0'))['db'][_0x9293('0x1')];var UserNotificationEvents=new EventEmitter();UserNotificationEvents[_0x9293('0x2')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9293('0x3'),'afterDestroy':_0x9293('0x4')};function emitEvent(_0x1c13eb){return function(_0x67c3f7,_0x1ec664,_0x271776){UserNotificationEvents[_0x9293('0x5')](_0x1c13eb+':'+_0x67c3f7['id'],_0x67c3f7);UserNotificationEvents[_0x9293('0x5')](_0x1c13eb,_0x67c3f7);_0x271776(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x9293('0x6')](e,emitEvent(event));}}module[_0x9293('0x7')]=UserNotificationEvents; \ No newline at end of file +var _0x2c35=['hook','events','remove','emit'];(function(_0x2786ea,_0x16c3c3){var _0x5c38e5=function(_0x5a53c5){while(--_0x5a53c5){_0x2786ea['push'](_0x2786ea['shift']());}};_0x5c38e5(++_0x16c3c3);}(_0x2c35,0x81));var _0x52c3=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2c35[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require(_0x52c3('0x0'));var UserNotification=require('../../mysqldb')['db']['UserNotification'];var UserNotificationEvents=new EventEmitter();UserNotificationEvents['setMaxListeners'](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x52c3('0x1')};function emitEvent(_0x5036d0){return function(_0x1de919,_0x403af7,_0x37615b){UserNotificationEvents[_0x52c3('0x2')](_0x5036d0+':'+_0x1de919['id'],_0x1de919);UserNotificationEvents[_0x52c3('0x2')](_0x5036d0,_0x1de919);_0x37615b(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];UserNotification[_0x52c3('0x3')](e,emitEvent(event));}}module['exports']=UserNotificationEvents; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.model.js b/server/api/userNotification/userNotification.model.js index 7af8e18..c0d19b7 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 _0x7403=['path','../../config/environment','./userNotification.attributes','define','utf8mb4','lodash','util','../../config/logger','moment','bluebird','request-promise'];(function(_0x397cb6,_0x50a0f1){var _0x52f7d1=function(_0x45bb0b){while(--_0x45bb0b){_0x397cb6['push'](_0x397cb6['shift']());}};_0x52f7d1(++_0x50a0f1);}(_0x7403,0xc0));var _0x3740=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x7403[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3740('0x0'));var util=require(_0x3740('0x1'));var logger=require(_0x3740('0x2'))('api');var moment=require(_0x3740('0x3'));var BPromise=require(_0x3740('0x4'));var rp=require(_0x3740('0x5'));var fs=require('fs');var path=require(_0x3740('0x6'));var rimraf=require('rimraf');var config=require(_0x3740('0x7'));var attributes=require(_0x3740('0x8'));module['exports']=function(_0x1748e9,_0x4855be){return _0x1748e9[_0x3740('0x9')]('UserNotification',attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':_0x3740('0xa'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x44d4=['../../config/environment','./userNotification.attributes','exports','define','UserNotification','utf8mb4_unicode_ci','lodash','../../config/logger','moment','bluebird','request-promise','path'];(function(_0x47182f,_0x377723){var _0x29e6b9=function(_0xf11d20){while(--_0xf11d20){_0x47182f['push'](_0x47182f['shift']());}};_0x29e6b9(++_0x377723);}(_0x44d4,0x102));var _0x444d=function(_0x3bb372,_0x4ce51e){_0x3bb372=_0x3bb372-0x0;var _0x59ab0e=_0x44d4[_0x3bb372];return _0x59ab0e;};'use strict';var _=require(_0x444d('0x0'));var util=require('util');var logger=require(_0x444d('0x1'))('api');var moment=require(_0x444d('0x2'));var BPromise=require(_0x444d('0x3'));var rp=require(_0x444d('0x4'));var fs=require('fs');var path=require(_0x444d('0x5'));var rimraf=require('rimraf');var config=require(_0x444d('0x6'));var attributes=require(_0x444d('0x7'));module[_0x444d('0x8')]=function(_0x3088fe,_0x5e4928){return _0x3088fe[_0x444d('0x9')](_0x444d('0xa'),attributes,{'tableName':'userNotifications','paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':_0x444d('0xb')});}; \ No newline at end of file diff --git a/server/api/userNotification/userNotification.rpc.js b/server/api/userNotification/userNotification.rpc.js index 9a307dd..44187a6 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 _0x51bd=['error','code','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x2dea24,_0x2fc021){var _0x309d58=function(_0x2eb89f){while(--_0x2eb89f){_0x2dea24['push'](_0x2dea24['shift']());}};_0x309d58(++_0x2fc021);}(_0x51bd,0x184));var _0xd51b=function(_0x27af45,_0x1b57aa){_0x27af45=_0x27af45-0x0;var _0x18df21=_0x51bd[_0x27af45];return _0x18df21;};'use strict';var _=require(_0xd51b('0x0'));var util=require('util');var moment=require(_0xd51b('0x1'));var BPromise=require(_0xd51b('0x2'));var rs=require(_0xd51b('0x3'));var fs=require('fs');var Redis=require(_0xd51b('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0xd51b('0x5'));var logger=require(_0xd51b('0x6'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0xd51b('0x7')]({'port':0x232a});config[_0xd51b('0x8')]=_[_0xd51b('0x9')](config[_0xd51b('0x8')],{'host':_0xd51b('0xa'),'port':0x18eb});var socket=require(_0xd51b('0xb'))(new Redis(config[_0xd51b('0x8')]));require(_0xd51b('0xc'))[_0xd51b('0xd')](socket);function respondWithRpcPromise(_0xbbd3dd,_0x257d57,_0x1d4f78){return new BPromise(function(_0x36036e,_0xe60f6f){return client['request'](_0xbbd3dd,_0x1d4f78)['then'](function(_0x3d41b1){logger[_0xd51b('0xe')](_0xd51b('0xf'),_0x257d57,_0xd51b('0x10'));logger[_0xd51b('0x11')](_0xd51b('0x12'),_0x257d57,_0xd51b('0x10'),JSON[_0xd51b('0x13')](_0x3d41b1));if(_0x3d41b1['error']){if(_0x3d41b1[_0xd51b('0x14')][_0xd51b('0x15')]===0x1f4){logger[_0xd51b('0x14')](_0xd51b('0xf'),_0x257d57,_0x3d41b1['error'][_0xd51b('0x16')]);return _0xe60f6f(_0x3d41b1[_0xd51b('0x14')][_0xd51b('0x16')]);}logger[_0xd51b('0x14')](_0xd51b('0xf'),_0x257d57,_0x3d41b1[_0xd51b('0x14')]['message']);return _0x36036e(_0x3d41b1[_0xd51b('0x14')]['message']);}else{logger[_0xd51b('0xe')](_0xd51b('0xf'),_0x257d57,_0xd51b('0x10'));_0x36036e(_0x3d41b1['result'][_0xd51b('0x16')]);}})[_0xd51b('0x17')](function(_0x19cce5){logger[_0xd51b('0x14')](_0xd51b('0xf'),_0x257d57,_0x19cce5);_0xe60f6f(_0x19cce5);});});} \ No newline at end of file +var _0xe20e=['code','message','result','catch','lodash','util','moment','ioredis','../../mysqldb','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','./userNotification.socket','register','then','info','UserNotification,\x20%s,\x20%s','request\x20sent','debug','UserNotification,\x20%s,\x20%s,\x20%s','stringify','error'];(function(_0xbb7cbb,_0x5a3761){var _0x50ffa2=function(_0x134790){while(--_0x134790){_0xbb7cbb['push'](_0xbb7cbb['shift']());}};_0x50ffa2(++_0x5a3761);}(_0xe20e,0x112));var _0xee20=function(_0x2a5a5a,_0x5a4047){_0x2a5a5a=_0x2a5a5a-0x0;var _0x2d6dc6=_0xe20e[_0x2a5a5a];return _0x2d6dc6;};'use strict';var _=require(_0xee20('0x0'));var util=require(_0xee20('0x1'));var moment=require(_0xee20('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xee20('0x3'));var db=require(_0xee20('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xee20('0x5'));var config=require(_0xee20('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xee20('0x7')][_0xee20('0x8')]({'port':0x232a});config[_0xee20('0x9')]=_[_0xee20('0xa')](config[_0xee20('0x9')],{'host':_0xee20('0xb'),'port':0x18eb});var socket=require(_0xee20('0xc'))(new Redis(config[_0xee20('0x9')]));require(_0xee20('0xd'))[_0xee20('0xe')](socket);function respondWithRpcPromise(_0x55c1ca,_0xadf780,_0x36280d){return new BPromise(function(_0x2682e7,_0x319be8){return client['request'](_0x55c1ca,_0x36280d)[_0xee20('0xf')](function(_0xc90df){logger[_0xee20('0x10')](_0xee20('0x11'),_0xadf780,_0xee20('0x12'));logger[_0xee20('0x13')](_0xee20('0x14'),_0xadf780,_0xee20('0x12'),JSON[_0xee20('0x15')](_0xc90df));if(_0xc90df[_0xee20('0x16')]){if(_0xc90df['error'][_0xee20('0x17')]===0x1f4){logger[_0xee20('0x16')](_0xee20('0x11'),_0xadf780,_0xc90df[_0xee20('0x16')][_0xee20('0x18')]);return _0x319be8(_0xc90df[_0xee20('0x16')][_0xee20('0x18')]);}logger['error']('UserNotification,\x20%s,\x20%s',_0xadf780,_0xc90df[_0xee20('0x16')][_0xee20('0x18')]);return _0x2682e7(_0xc90df['error'][_0xee20('0x18')]);}else{logger[_0xee20('0x10')](_0xee20('0x11'),_0xadf780,_0xee20('0x12'));_0x2682e7(_0xc90df[_0xee20('0x19')]['message']);}})[_0xee20('0x1a')](function(_0x553644){logger[_0xee20('0x16')](_0xee20('0x11'),_0xadf780,_0x553644);_0x319be8(_0x553644);});});} \ No newline at end of file diff --git a/server/api/userNotification/userNotification.socket.js b/server/api/userNotification/userNotification.socket.js index 9d54ece..98eaa6a 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 _0xf5a5=['update','emit','removeListener','register','length','./userNotification.events','save','remove'];(function(_0x4bfb2c,_0x45ea63){var _0x2abda4=function(_0x4f8ba6){while(--_0x4f8ba6){_0x4bfb2c['push'](_0x4bfb2c['shift']());}};_0x2abda4(++_0x45ea63);}(_0xf5a5,0xbd));var _0x5f5a=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0xf5a5[_0x3b380d];return _0x54502b;};'use strict';var UserNotificationEvents=require(_0x5f5a('0x0'));var events=[_0x5f5a('0x1'),_0x5f5a('0x2'),_0x5f5a('0x3')];function createListener(_0xd18208,_0x376f34){return function(_0x4ca6e4){_0x376f34[_0x5f5a('0x4')](_0xd18208,_0x4ca6e4);};}function removeListener(_0x429e26,_0x4646c2){return function(){UserNotificationEvents[_0x5f5a('0x5')](_0x429e26,_0x4646c2);};}exports[_0x5f5a('0x6')]=function(_0x5589d8){for(var _0x10693d=0x0,_0x51dd7d=events[_0x5f5a('0x7')];_0x10693d<_0x51dd7d;_0x10693d++){var _0x1b4dfb=events[_0x10693d];var _0x4e7a6d=createListener('userNotification:'+_0x1b4dfb,_0x5589d8);UserNotificationEvents['on'](_0x1b4dfb,_0x4e7a6d);}}; \ No newline at end of file +var _0xaf06=['length','userNotification:','./userNotification.events','save','remove','update','emit','removeListener','register'];(function(_0x2d9535,_0x4bc592){var _0xb4e710=function(_0x50b9a9){while(--_0x50b9a9){_0x2d9535['push'](_0x2d9535['shift']());}};_0xb4e710(++_0x4bc592);}(_0xaf06,0x1b2));var _0x6af0=function(_0x5245ec,_0x3ee565){_0x5245ec=_0x5245ec-0x0;var _0x1cefe6=_0xaf06[_0x5245ec];return _0x1cefe6;};'use strict';var UserNotificationEvents=require(_0x6af0('0x0'));var events=[_0x6af0('0x1'),_0x6af0('0x2'),_0x6af0('0x3')];function createListener(_0x33b08d,_0x1cd07e){return function(_0x1a8d61){_0x1cd07e[_0x6af0('0x4')](_0x33b08d,_0x1a8d61);};}function removeListener(_0x56b6c2,_0x31b75a){return function(){UserNotificationEvents[_0x6af0('0x5')](_0x56b6c2,_0x31b75a);};}exports[_0x6af0('0x6')]=function(_0x5df86f){for(var _0xc5315c=0x0,_0x1e4a25=events[_0x6af0('0x7')];_0xc5315c<_0x1e4a25;_0xc5315c++){var _0x1ccaad=events[_0xc5315c];var _0x938b5f=createListener(_0x6af0('0x8')+_0x1ccaad,_0x5df86f);UserNotificationEvents['on'](_0x1ccaad,_0x938b5f);}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/index.js b/server/api/userOpenchannelQueue/index.js index ae9c49e..d8ae8bb 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 _0xcb91=['express','Router','../../components/auth/service','../../components/interaction/service','exports','path','connect-timeout'];(function(_0x25f7d9,_0x5723fc){var _0x3763c2=function(_0x224f29){while(--_0x224f29){_0x25f7d9['push'](_0x25f7d9['shift']());}};_0x3763c2(++_0x5723fc);}(_0xcb91,0x1a9));var _0x1cb9=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcb91[_0x3dd15e];return _0x231fd0;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x1cb9('0x0'));var timeout=require(_0x1cb9('0x1'));var express=require(_0x1cb9('0x2'));var router=express[_0x1cb9('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x1cb9('0x4'));var interaction=require(_0x1cb9('0x5'));var config=require('../../config/environment');module[_0x1cb9('0x6')]=router; \ No newline at end of file +var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x3f9b36,_0x4d9731){var _0x7e68d5=function(_0x8f3b57){while(--_0x8f3b57){_0x3f9b36['push'](_0x3f9b36['shift']());}};_0x7e68d5(++_0x4d9731);}(_0xe706,0xa3));var _0x6e70=function(_0x171bef,_0x4cba08){_0x171bef=_0x171bef-0x0;var _0x28828a=_0xe706[_0x171bef];return _0x28828a;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.attributes.js index bfdb066..8e9339c 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 _0x2aaa=['INTEGER','exports'];(function(_0x3bb787,_0x484097){var _0x1c1428=function(_0xad3f70){while(--_0xad3f70){_0x3bb787['push'](_0x3bb787['shift']());}};_0x1c1428(++_0x484097);}(_0x2aaa,0x185));var _0xa2aa=function(_0x29deb7,_0x3218be){_0x29deb7=_0x29deb7-0x0;var _0x55def0=_0x2aaa[_0x29deb7];return _0x55def0;};'use strict';var Sequelize=require('sequelize');module[_0xa2aa('0x0')]={'penalty':{'type':Sequelize[_0xa2aa('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x2691=['sequelize','exports','INTEGER'];(function(_0x5c6e87,_0xf21991){var _0x13c76f=function(_0x16e9eb){while(--_0x16e9eb){_0x5c6e87['push'](_0x5c6e87['shift']());}};_0x13c76f(++_0xf21991);}(_0x2691,0x132));var _0x1269=function(_0x4dbe37,_0x4f9c0a){_0x4dbe37=_0x4dbe37-0x0;var _0x59f182=_0x2691[_0x4dbe37];return _0x59f182;};'use strict';var Sequelize=require(_0x1269('0x0'));module[_0x1269('0x1')]={'penalty':{'type':Sequelize[_0x1269('0x2')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.model.js index 350f8c0..69c5383 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 _0x78ec=['api','moment','bluebird','request-promise','rimraf','../../config/environment','./userOpenchannelQueue.attributes','define','UserOpenchannelQueue','util','../../config/logger'];(function(_0x5c3c0b,_0x4ee35e){var _0x52ecd2=function(_0x3cf575){while(--_0x3cf575){_0x5c3c0b['push'](_0x5c3c0b['shift']());}};_0x52ecd2(++_0x4ee35e);}(_0x78ec,0x1c1));var _0xc78e=function(_0x5ac2c7,_0x24898f){_0x5ac2c7=_0x5ac2c7-0x0;var _0x3ab066=_0x78ec[_0x5ac2c7];return _0x3ab066;};'use strict';var _=require('lodash');var util=require(_0xc78e('0x0'));var logger=require(_0xc78e('0x1'))(_0xc78e('0x2'));var moment=require(_0xc78e('0x3'));var BPromise=require(_0xc78e('0x4'));var rp=require(_0xc78e('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xc78e('0x6'));var config=require(_0xc78e('0x7'));var attributes=require(_0xc78e('0x8'));module['exports']=function(_0x47a937,_0x1aecde){return _0x47a937[_0xc78e('0x9')](_0xc78e('0xa'),attributes,{'tableName':'user_has_openchannel_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xf9e1=['request-promise','path','../../config/environment','./userOpenchannelQueue.attributes','UserOpenchannelQueue','user_has_openchannel_queues','lodash','api','moment','bluebird'];(function(_0x368670,_0x57abc5){var _0x8f1189=function(_0x2459a3){while(--_0x2459a3){_0x368670['push'](_0x368670['shift']());}};_0x8f1189(++_0x57abc5);}(_0xf9e1,0x196));var _0x1f9e=function(_0x4c286a,_0x32de4b){_0x4c286a=_0x4c286a-0x0;var _0x1d6b1a=_0xf9e1[_0x4c286a];return _0x1d6b1a;};'use strict';var _=require(_0x1f9e('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x1f9e('0x1'));var moment=require(_0x1f9e('0x2'));var BPromise=require(_0x1f9e('0x3'));var rp=require(_0x1f9e('0x4'));var fs=require('fs');var path=require(_0x1f9e('0x5'));var rimraf=require('rimraf');var config=require(_0x1f9e('0x6'));var attributes=require(_0x1f9e('0x7'));module['exports']=function(_0x31bb3e,_0x4a8451){return _0x31bb3e['define'](_0x1f9e('0x8'),attributes,{'tableName':_0x1f9e('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js b/server/api/userOpenchannelQueue/userOpenchannelQueue.rpc.js index dc317c8..a0227f8 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 _0x0694=['randomstring','../../mysqldb','../../config/logger','../../config/environment','http','then','request\x20sent','debug','error','code','UserOpenchannelQueue,\x20%s,\x20%s','message','result','catch','lodash','moment'];(function(_0x58afd5,_0x534a48){var _0x3e503b=function(_0x27ba44){while(--_0x27ba44){_0x58afd5['push'](_0x58afd5['shift']());}};_0x3e503b(++_0x534a48);}(_0x0694,0x11e));var _0x4069=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0x0694[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x4069('0x0'));var util=require('util');var moment=require(_0x4069('0x1'));var BPromise=require('bluebird');var rs=require(_0x4069('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4069('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x4069('0x4'))('rpc');var config=require(_0x4069('0x5'));var jayson=require('jayson/promise');var client=jayson['client'][_0x4069('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x2a177d,_0x30153e,_0x3545f2){return new BPromise(function(_0x59d31b,_0x310f24){return client['request'](_0x2a177d,_0x3545f2)[_0x4069('0x7')](function(_0x14bf47){logger['info']('UserOpenchannelQueue,\x20%s,\x20%s',_0x30153e,_0x4069('0x8'));logger[_0x4069('0x9')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x30153e,_0x4069('0x8'),JSON['stringify'](_0x14bf47));if(_0x14bf47[_0x4069('0xa')]){if(_0x14bf47[_0x4069('0xa')][_0x4069('0xb')]===0x1f4){logger[_0x4069('0xa')](_0x4069('0xc'),_0x30153e,_0x14bf47[_0x4069('0xa')][_0x4069('0xd')]);return _0x310f24(_0x14bf47[_0x4069('0xa')]['message']);}logger['error'](_0x4069('0xc'),_0x30153e,_0x14bf47['error'][_0x4069('0xd')]);return _0x59d31b(_0x14bf47[_0x4069('0xa')][_0x4069('0xd')]);}else{logger['info'](_0x4069('0xc'),_0x30153e,_0x4069('0x8'));_0x59d31b(_0x14bf47[_0x4069('0xe')][_0x4069('0xd')]);}})[_0x4069('0xf')](function(_0x552c5b){logger[_0x4069('0xa')](_0x4069('0xc'),_0x30153e,_0x552c5b);_0x310f24(_0x552c5b);});});} \ No newline at end of file +var _0x9cbe=['../../config/logger','../../config/environment','jayson/promise','http','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x25408e,_0x457e2d){var _0xd3099d=function(_0x44fe35){while(--_0x44fe35){_0x25408e['push'](_0x25408e['shift']());}};_0xd3099d(++_0x457e2d);}(_0x9cbe,0x6c));var _0xe9cb=function(_0x368fb9,_0x1a9895){_0x368fb9=_0x368fb9-0x0;var _0x4892fb=_0x9cbe[_0x368fb9];return _0x4892fb;};'use strict';var _=require(_0xe9cb('0x0'));var util=require('util');var moment=require(_0xe9cb('0x1'));var BPromise=require(_0xe9cb('0x2'));var rs=require(_0xe9cb('0x3'));var fs=require('fs');var Redis=require(_0xe9cb('0x4'));var db=require(_0xe9cb('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xe9cb('0x6'))('rpc');var config=require(_0xe9cb('0x7'));var jayson=require(_0xe9cb('0x8'));var client=jayson['client'][_0xe9cb('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x52ea65,_0x46f48f,_0x46f143){return new BPromise(function(_0x5da173,_0x5ee4fa){return client['request'](_0x52ea65,_0x46f143)[_0xe9cb('0xa')](function(_0x2c8e58){logger[_0xe9cb('0xb')](_0xe9cb('0xc'),_0x46f48f,_0xe9cb('0xd'));logger[_0xe9cb('0xe')]('UserOpenchannelQueue,\x20%s,\x20%s,\x20%s',_0x46f48f,_0xe9cb('0xd'),JSON[_0xe9cb('0xf')](_0x2c8e58));if(_0x2c8e58['error']){if(_0x2c8e58['error']['code']===0x1f4){logger[_0xe9cb('0x10')]('UserOpenchannelQueue,\x20%s,\x20%s',_0x46f48f,_0x2c8e58[_0xe9cb('0x10')][_0xe9cb('0x11')]);return _0x5ee4fa(_0x2c8e58[_0xe9cb('0x10')][_0xe9cb('0x11')]);}logger[_0xe9cb('0x10')](_0xe9cb('0xc'),_0x46f48f,_0x2c8e58[_0xe9cb('0x10')][_0xe9cb('0x11')]);return _0x5da173(_0x2c8e58[_0xe9cb('0x10')][_0xe9cb('0x11')]);}else{logger[_0xe9cb('0xb')](_0xe9cb('0xc'),_0x46f48f,_0xe9cb('0xd'));_0x5da173(_0x2c8e58[_0xe9cb('0x12')]['message']);}})['catch'](function(_0x51788e){logger[_0xe9cb('0x10')](_0xe9cb('0xc'),_0x46f48f,_0x51788e);_0x5ee4fa(_0x51788e);});});} \ No newline at end of file diff --git a/server/api/userProfile/index.js b/server/api/userProfile/index.js index 6cd908b..b9943bb 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 _0x1ecb=['index','get','/describe','describe','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addSections','put','/:id','delete','destroy','removeSections','removeResources','exports','multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','isAuthenticated'];(function(_0x139a79,_0x3ff73c){var _0x52809e=function(_0x42fb8a){while(--_0x42fb8a){_0x139a79['push'](_0x139a79['shift']());}};_0x52809e(++_0x3ff73c);}(_0x1ecb,0xb5));var _0xb1ec=function(_0x3454f0,_0xb225f4){_0x3454f0=_0x3454f0-0x0;var _0x5f2bc5=_0x1ecb[_0x3454f0];return _0x5f2bc5;};'use strict';var multer=require(_0xb1ec('0x0'));var util=require(_0xb1ec('0x1'));var path=require(_0xb1ec('0x2'));var timeout=require(_0xb1ec('0x3'));var express=require(_0xb1ec('0x4'));var router=express[_0xb1ec('0x5')]();var fs_extra=require(_0xb1ec('0x6'));var auth=require(_0xb1ec('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0xb1ec('0x8'));var controller=require(_0xb1ec('0x9'));router['get']('/',auth[_0xb1ec('0xa')](),controller[_0xb1ec('0xb')]);router[_0xb1ec('0xc')](_0xb1ec('0xd'),auth[_0xb1ec('0xa')](),controller[_0xb1ec('0xe')]);router[_0xb1ec('0xc')]('/:id',auth[_0xb1ec('0xa')](),controller[_0xb1ec('0xf')]);router[_0xb1ec('0xc')](_0xb1ec('0x10'),auth[_0xb1ec('0xa')](),controller[_0xb1ec('0x11')]);router[_0xb1ec('0xc')](_0xb1ec('0x12'),auth['isAuthenticated'](),controller[_0xb1ec('0x13')]);router[_0xb1ec('0x14')]('/',auth[_0xb1ec('0xa')](),controller[_0xb1ec('0x15')]);router[_0xb1ec('0x14')](_0xb1ec('0x16'),auth[_0xb1ec('0xa')](),controller[_0xb1ec('0x17')]);router['post'](_0xb1ec('0x10'),auth['isAuthenticated'](),controller[_0xb1ec('0x18')]);router[_0xb1ec('0x14')](_0xb1ec('0x12'),auth['isAuthenticated'](),controller['addResources']);router[_0xb1ec('0x19')](_0xb1ec('0x1a'),auth[_0xb1ec('0xa')](),controller['update']);router[_0xb1ec('0x1b')](_0xb1ec('0x1a'),auth['isAuthenticated'](),controller[_0xb1ec('0x1c')]);router[_0xb1ec('0x1b')](_0xb1ec('0x10'),auth['isAuthenticated'](),controller[_0xb1ec('0x1d')]);router[_0xb1ec('0x1b')]('/:id/resources',auth[_0xb1ec('0xa')](),controller[_0xb1ec('0x1e')]);module[_0xb1ec('0x1f')]=router; \ No newline at end of file +var _0x698e=['delete','destroy','removeResources','exports','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./userProfile.controller','get','isAuthenticated','index','/describe','describe','show','/:id/sections','getSections','/:id/resources','getResources','post','create','/:id/clone','clone','addResources','put','/:id'];(function(_0x39441a,_0x43f93b){var _0x30cbb2=function(_0x2e2664){while(--_0x2e2664){_0x39441a['push'](_0x39441a['shift']());}};_0x30cbb2(++_0x43f93b);}(_0x698e,0xac));var _0xe698=function(_0x2151c0,_0x1f7c3e){_0x2151c0=_0x2151c0-0x0;var _0x4e86a3=_0x698e[_0x2151c0];return _0x4e86a3;};'use strict';var multer=require('multer');var util=require('util');var path=require('path');var timeout=require(_0xe698('0x0'));var express=require(_0xe698('0x1'));var router=express[_0xe698('0x2')]();var fs_extra=require(_0xe698('0x3'));var auth=require(_0xe698('0x4'));var interaction=require('../../components/interaction/service');var config=require(_0xe698('0x5'));var controller=require(_0xe698('0x6'));router[_0xe698('0x7')]('/',auth[_0xe698('0x8')](),controller[_0xe698('0x9')]);router[_0xe698('0x7')](_0xe698('0xa'),auth['isAuthenticated'](),controller[_0xe698('0xb')]);router[_0xe698('0x7')]('/:id',auth[_0xe698('0x8')](),controller[_0xe698('0xc')]);router['get'](_0xe698('0xd'),auth['isAuthenticated'](),controller[_0xe698('0xe')]);router['get'](_0xe698('0xf'),auth[_0xe698('0x8')](),controller[_0xe698('0x10')]);router[_0xe698('0x11')]('/',auth['isAuthenticated'](),controller[_0xe698('0x12')]);router[_0xe698('0x11')](_0xe698('0x13'),auth[_0xe698('0x8')](),controller[_0xe698('0x14')]);router[_0xe698('0x11')](_0xe698('0xd'),auth[_0xe698('0x8')](),controller['addSections']);router[_0xe698('0x11')]('/:id/resources',auth[_0xe698('0x8')](),controller[_0xe698('0x15')]);router[_0xe698('0x16')](_0xe698('0x17'),auth[_0xe698('0x8')](),controller['update']);router[_0xe698('0x18')](_0xe698('0x17'),auth[_0xe698('0x8')](),controller[_0xe698('0x19')]);router['delete'](_0xe698('0xd'),auth[_0xe698('0x8')](),controller['removeSections']);router[_0xe698('0x18')]('/:id/resources',auth[_0xe698('0x8')](),controller[_0xe698('0x1a')]);module[_0xe698('0x1b')]=router; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.attributes.js b/server/api/userProfile/userProfile.attributes.js index 9c5f1c7..9794d8d 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 _0x9348=['crudPermissions','join','getDataValue','split','BOOLEAN','sequelize','exports','STRING','setDataValue'];(function(_0x3a6ed0,_0x4e216e){var _0x144bc4=function(_0x2ce965){while(--_0x2ce965){_0x3a6ed0['push'](_0x3a6ed0['shift']());}};_0x144bc4(++_0x4e216e);}(_0x9348,0x152));var _0x8934=function(_0x25ad29,_0x2e8ea8){_0x25ad29=_0x25ad29-0x0;var _0x5ad50b=_0x9348[_0x25ad29];return _0x5ad50b;};'use strict';var Sequelize=require(_0x8934('0x0'));module[_0x8934('0x1')]={'name':{'type':Sequelize[_0x8934('0x2')],'allowNull':![],'unique':'name'},'crudPermissions':{'type':Sequelize[_0x8934('0x2')],'set':function(_0x140cf5){this[_0x8934('0x3')](_0x8934('0x4'),_0x140cf5?_0x140cf5[_0x8934('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x8934('0x4'))?this[_0x8934('0x6')]('crudPermissions')[_0x8934('0x7')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x8934('0x2')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x8934('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize[_0x8934('0x8')],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize[_0x8934('0x8')],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x8934('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize[_0x8934('0x8')],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x8934('0x8')],'defaultValue':!![]}}; \ No newline at end of file +var _0x77b3=['join','split','STRING','BOOLEAN','sequelize','exports','name','setDataValue','crudPermissions'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x77b3,0xf7));var _0x377b=function(_0x221a1b,_0x4e5406){_0x221a1b=_0x221a1b-0x0;var _0x485f83=_0x77b3[_0x221a1b];return _0x485f83;};'use strict';var Sequelize=require(_0x377b('0x0'));module[_0x377b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x377b('0x2')},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x1002ae){this[_0x377b('0x3')](_0x377b('0x4'),_0x1002ae?_0x1002ae[_0x377b('0x5')](''):[]);},'get':function(){return this['getDataValue'](_0x377b('0x4'))?this['getDataValue'](_0x377b('0x4'))[_0x377b('0x6')](''):[];},'allowNull':![],'defaultValue':'r'},'description':{'type':Sequelize[_0x377b('0x7')],'allowNull':!![]},'privacyEnabled':{'type':Sequelize[_0x377b('0x8')],'defaultValue':![]},'downloadAttachments':{'type':Sequelize[_0x377b('0x8')],'defaultValue':!![]},'downloadCallySquareRecordings':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadContactManagerLists':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadJscriptySessions':{'type':Sequelize[_0x377b('0x8')],'defaultValue':!![]},'downloadOmnichannelInteractions':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'downloadScreenRecordings':{'type':Sequelize[_0x377b('0x8')],'defaultValue':!![]},'downloadVoiceRecordings':{'type':Sequelize[_0x377b('0x8')],'defaultValue':!![]}}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.controller.js b/server/api/userProfile/userProfile.controller.js index 5486551..c061cdd 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 _0xe49f=['updatedAt','crudPermissions','omit','sequelize','transaction','merge','UserProfileSection','findAll','autoAssociation','UserProfileResource','sectionId','userProfileId','Resources','describe','addSections','each','removeSections','getSections','enabled','includes','isEmpty','subsections','concat','findOne','forEach','push','resourceId','Plugin','addResources','bulkCreate','removeResources','getResources','section','Missing\x20section\x20parameter','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','ejs','fs-extra','lodash','crypto','jsforce','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/utils','../../config/license/util','redis','localhost','./userProfile.socket','register','sendStatus','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','destroy','end','stack','name','index','UserProfile','rawAttributes','fieldName','type','key','model','map','query','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','filter','VIRTUAL','includeAll','include','rows','catch','show','params','keys','options','find','create','body','get','createdAt'];(function(_0x49bfa6,_0x2eef6d){var _0x4cb572=function(_0x273db2){while(--_0x273db2){_0x49bfa6['push'](_0x49bfa6['shift']());}};_0x4cb572(++_0x2eef6d);}(_0xe49f,0x17b));var _0xfe49=function(_0x1a4455,_0x511d62){_0x1a4455=_0x1a4455-0x0;var _0x9b2c51=_0xe49f[_0x1a4455];return _0x9b2c51;};'use strict';var emlformat=require(_0xfe49('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xfe49('0x1'));var jsonpatch=require(_0xfe49('0x2'));var rp=require(_0xfe49('0x3'));var moment=require(_0xfe49('0x4'));var BPromise=require(_0xfe49('0x5'));var Mustache=require(_0xfe49('0x6'));var util=require(_0xfe49('0x7'));var path=require(_0xfe49('0x8'));var sox=require(_0xfe49('0x9'));var csv=require('to-csv');var ejs=require(_0xfe49('0xa'));var fs=require('fs');var fs_extra=require(_0xfe49('0xb'));var _=require(_0xfe49('0xc'));var squel=require('squel');var crypto=require(_0xfe49('0xd'));var jsforce=require(_0xfe49('0xe'));var deskjs=require(_0xfe49('0xf'));var toCsv=require(_0xfe49('0x10'));var querystring=require('querystring');var Papa=require(_0xfe49('0x11'));var Redis=require(_0xfe49('0x12'));var authService=require(_0xfe49('0x13'));var qs=require(_0xfe49('0x14'));var as=require(_0xfe49('0x15'));var hardwareService=require(_0xfe49('0x16'));var logger=require('../../config/logger')('api');var utils=require(_0xfe49('0x17'));var config=require('../../config/environment');var licenseUtil=require(_0xfe49('0x18'));var db=require('../../mysqldb')['db'];config[_0xfe49('0x19')]=_['defaults'](config[_0xfe49('0x19')],{'host':_0xfe49('0x1a'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xfe49('0x1b'))[_0xfe49('0x1c')](socket);function respondWithStatusCode(_0x2f1044,_0x1e7b20){_0x1e7b20=_0x1e7b20||0xcc;return function(_0x1d5eff){if(_0x1d5eff){return _0x2f1044[_0xfe49('0x1d')](_0x1e7b20);}return _0x2f1044[_0xfe49('0x1e')](_0x1e7b20)['end']();};}function respondWithResult(_0x404606,_0x2f6d4c){_0x2f6d4c=_0x2f6d4c||0xc8;return function(_0x92d4f0){if(_0x92d4f0){return _0x404606[_0xfe49('0x1e')](_0x2f6d4c)[_0xfe49('0x1f')](_0x92d4f0);}};}function respondWithFilteredResult(_0xa5dece,_0x260e8d){return function(_0x2056f5){if(_0x2056f5){var _0x5e68d0=typeof _0x260e8d['offset']===_0xfe49('0x20')&&typeof _0x260e8d[_0xfe49('0x21')]===_0xfe49('0x20');var _0xa6b42=_0x2056f5[_0xfe49('0x22')];var _0x1a5381=_0x5e68d0?0x0:_0x260e8d[_0xfe49('0x23')];var _0x4f0aed=_0x5e68d0?_0x2056f5[_0xfe49('0x22')]:_0x260e8d['offset']+_0x260e8d[_0xfe49('0x21')];var _0x3edb36;if(_0x4f0aed>=_0xa6b42){_0x4f0aed=_0xa6b42;_0x3edb36=0xc8;}else{_0x3edb36=0xce;}_0xa5dece[_0xfe49('0x1e')](_0x3edb36);return _0xa5dece[_0xfe49('0x24')](_0xfe49('0x25'),_0x1a5381+'-'+_0x4f0aed+'/'+_0xa6b42)['json'](_0x2056f5);}return null;};}function patchUpdates(_0x2139da){return function(_0x29cff5){try{jsonpatch[_0xfe49('0x26')](_0x29cff5,_0x2139da,!![]);}catch(_0xbb0a66){return BPromise[_0xfe49('0x27')](_0xbb0a66);}return _0x29cff5[_0xfe49('0x28')]();};}function saveUpdates(_0x1a9c47,_0x5d0e27){return function(_0x1c46a2){if(_0x1c46a2){return _0x1c46a2[_0xfe49('0x29')](_0x1a9c47)[_0xfe49('0x2a')](function(_0x870e23){return _0x870e23;});}return null;};}function removeEntity(_0x1a6621,_0x310aec){return function(_0x1a07b1){if(_0x1a07b1){return _0x1a07b1[_0xfe49('0x2b')]()[_0xfe49('0x2a')](function(){_0x1a6621[_0xfe49('0x1e')](0xcc)[_0xfe49('0x2c')]();});}};}function handleEntityNotFound(_0x1d5089,_0x5d828a){return function(_0x105537){if(!_0x105537){_0x1d5089[_0xfe49('0x1d')](0x194);}return _0x105537;};}function handleError(_0x4454e0,_0x5d218d){_0x5d218d=_0x5d218d||0x1f4;return function(_0xc083cf){logger['error'](_0xc083cf[_0xfe49('0x2d')]);if(_0xc083cf[_0xfe49('0x2e')]){delete _0xc083cf[_0xfe49('0x2e')];}_0x4454e0[_0xfe49('0x1e')](_0x5d218d)['send'](_0xc083cf);};}exports[_0xfe49('0x2f')]=function(_0x5dcb39,_0x6dda0e){var _0x598876={},_0x8abd24={},_0x2579ae={'count':0x0,'rows':[]};var _0x3b7ff2=_['map'](db[_0xfe49('0x30')][_0xfe49('0x31')],function(_0x1be917){return{'name':_0x1be917[_0xfe49('0x32')],'type':_0x1be917[_0xfe49('0x33')][_0xfe49('0x34')]};});_0x8abd24[_0xfe49('0x35')]=_[_0xfe49('0x36')](_0x3b7ff2,_0xfe49('0x2e'));_0x8abd24[_0xfe49('0x37')]=_['keys'](_0x5dcb39[_0xfe49('0x37')]);_0x8abd24['filters']=_['intersection'](_0x8abd24[_0xfe49('0x35')],_0x8abd24[_0xfe49('0x37')]);_0x598876[_0xfe49('0x38')]=_[_0xfe49('0x39')](_0x8abd24[_0xfe49('0x35')],qs[_0xfe49('0x3a')](_0x5dcb39['query'][_0xfe49('0x3a')]));_0x598876[_0xfe49('0x38')]=_0x598876[_0xfe49('0x38')][_0xfe49('0x3b')]?_0x598876[_0xfe49('0x38')]:_0x8abd24[_0xfe49('0x35')];if(!_0x5dcb39[_0xfe49('0x37')][_0xfe49('0x3c')](_0xfe49('0x3d'))){_0x598876[_0xfe49('0x21')]=qs[_0xfe49('0x21')](_0x5dcb39[_0xfe49('0x37')][_0xfe49('0x21')]);_0x598876[_0xfe49('0x23')]=qs[_0xfe49('0x23')](_0x5dcb39[_0xfe49('0x37')][_0xfe49('0x23')]);}_0x598876[_0xfe49('0x3e')]=qs[_0xfe49('0x3f')](_0x5dcb39[_0xfe49('0x37')]['sort']);_0x598876[_0xfe49('0x40')]=qs[_0xfe49('0x41')](_['pick'](_0x5dcb39['query'],_0x8abd24[_0xfe49('0x41')]),_0x3b7ff2);if(_0x5dcb39[_0xfe49('0x37')][_0xfe49('0x42')]){_0x598876[_0xfe49('0x40')]=_['merge'](_0x598876[_0xfe49('0x40')],{'$or':_['map'](_0x3b7ff2,function(_0x28ac3d){if(_0x28ac3d[_0xfe49('0x33')]!==_0xfe49('0x43')){var _0x5e6584={};_0x5e6584[_0x28ac3d[_0xfe49('0x2e')]]={'$like':'%'+_0x5dcb39[_0xfe49('0x37')][_0xfe49('0x42')]+'%'};return _0x5e6584;}})});}_0x598876=_['merge']({},_0x598876,_0x5dcb39['options']);var _0x208c93={'where':_0x598876[_0xfe49('0x40')]};return db[_0xfe49('0x30')][_0xfe49('0x22')](_0x208c93)[_0xfe49('0x2a')](function(_0x562751){_0x2579ae[_0xfe49('0x22')]=_0x562751;if(_0x5dcb39[_0xfe49('0x37')][_0xfe49('0x44')]){_0x598876[_0xfe49('0x45')]=[{'all':!![]}];}return db[_0xfe49('0x30')]['findAll'](_0x598876);})[_0xfe49('0x2a')](function(_0x207705){_0x2579ae[_0xfe49('0x46')]=_0x207705;return _0x2579ae;})['then'](respondWithFilteredResult(_0x6dda0e,_0x598876))[_0xfe49('0x47')](handleError(_0x6dda0e,null));};exports[_0xfe49('0x48')]=function(_0x581243,_0x1219a0){var _0x2fff6a={'raw':![],'where':{'id':_0x581243[_0xfe49('0x49')]['id']}},_0x1e45f7={};_0x1e45f7[_0xfe49('0x35')]=_[_0xfe49('0x4a')](db[_0xfe49('0x30')][_0xfe49('0x31')]);_0x1e45f7[_0xfe49('0x37')]=_[_0xfe49('0x4a')](_0x581243['query']);_0x1e45f7[_0xfe49('0x41')]=_[_0xfe49('0x39')](_0x1e45f7[_0xfe49('0x35')],_0x1e45f7[_0xfe49('0x37')]);_0x2fff6a['attributes']=_['intersection'](_0x1e45f7[_0xfe49('0x35')],qs['fields'](_0x581243[_0xfe49('0x37')][_0xfe49('0x3a')]));_0x2fff6a[_0xfe49('0x38')]=_0x2fff6a[_0xfe49('0x38')]['length']?_0x2fff6a[_0xfe49('0x38')]:_0x1e45f7['model'];if(_0x581243[_0xfe49('0x37')]['includeAll']){_0x2fff6a[_0xfe49('0x45')]=[{'all':!![]}];}_0x2fff6a=_['merge']({},_0x2fff6a,_0x581243[_0xfe49('0x4b')]);return db[_0xfe49('0x30')][_0xfe49('0x4c')](_0x2fff6a)[_0xfe49('0x2a')](handleEntityNotFound(_0x1219a0,null))[_0xfe49('0x2a')](respondWithResult(_0x1219a0,null))[_0xfe49('0x47')](handleError(_0x1219a0,null));};exports[_0xfe49('0x4d')]=function(_0x372f72,_0x1bc54c){return db[_0xfe49('0x30')][_0xfe49('0x4d')](_0x372f72[_0xfe49('0x4e')],{})[_0xfe49('0x2a')](respondWithResult(_0x1bc54c,0xc9))['catch'](handleError(_0x1bc54c,null));};exports['clone']=function(_0x12ca76,_0x5574c9){var _0xdb4779={'where':{'id':_0x12ca76[_0xfe49('0x49')]['id']}},_0x2f6448={};_0x2f6448[_0xfe49('0x35')]=_[_0xfe49('0x4a')](db[_0xfe49('0x30')]['rawAttributes']);_0xdb4779['attributes']=_[_0xfe49('0x39')](_0x2f6448[_0xfe49('0x35')],qs['fields'](_0x12ca76[_0xfe49('0x37')]['fields']));_0xdb4779[_0xfe49('0x38')]=_0xdb4779[_0xfe49('0x38')][_0xfe49('0x3b')]?_0xdb4779['attributes']:_0x2f6448[_0xfe49('0x35')];if(_0x12ca76[_0xfe49('0x37')][_0xfe49('0x44')]){_0xdb4779[_0xfe49('0x45')]=[{'all':!![]}];}_0xdb4779=_['merge']({},_0xdb4779,_0x12ca76[_0xfe49('0x4b')]);return db['UserProfile'][_0xfe49('0x4c')](_0xdb4779)['then'](handleEntityNotFound(_0x5574c9,null))['then'](function(_0x1d6a70){if(_0x1d6a70){var _0x3b6dd3=_0x1d6a70[_0xfe49('0x4f')]({'plain':!![]});_0x3b6dd3=qs['omit'](_0x3b6dd3,['id',_0xfe49('0x50'),_0xfe49('0x51'),_0xfe49('0x52')]);_0x12ca76[_0xfe49('0x4e')]=_[_0xfe49('0x53')](_0x12ca76[_0xfe49('0x4e')],['id',_0xfe49('0x50'),'updatedAt']);return db[_0xfe49('0x54')][_0xfe49('0x55')](function(_0x659c7c){return db[_0xfe49('0x30')][_0xfe49('0x4d')](_[_0xfe49('0x56')](_0x3b6dd3,_0x12ca76[_0xfe49('0x4e')]),{'include':_0x12ca76[_0xfe49('0x37')][_0xfe49('0x44')]?[{'all':!![]}]:undefined,'transaction':_0x659c7c})[_0xfe49('0x2a')](function(_0x5e0b8c){var _0x263314=_0x5e0b8c[_0xfe49('0x4f')]({'plain':!![]});return db[_0xfe49('0x57')][_0xfe49('0x58')]({'where':{'userProfileId':_0x12ca76['params']['id']},'raw':!![]})[_0xfe49('0x2a')](function(_0x41031f){if(_0x41031f){return BPromise['each'](_0x41031f,function(_0x31b6fa){return new BPromise(function(_0x56ab12,_0x105536){if(_0x31b6fa[_0xfe49('0x59')]===null||_0x31b6fa['autoAssociation']===0x1)_0x56ab12(null);return db[_0xfe49('0x5a')][_0xfe49('0x58')]({'where':{'sectionId':_0x31b6fa['id']},'raw':!![]})[_0xfe49('0x2a')](function(_0x227b6b){var _0x6d50c0=_[_0xfe49('0x36')](_0x227b6b,function(_0x27968d){return qs[_0xfe49('0x53')](_0x27968d,['id',_0xfe49('0x50'),_0xfe49('0x51'),_0xfe49('0x5b')]);});_0x56ab12(_0x6d50c0);})[_0xfe49('0x47')](function(_0x29024c){_0x105536(_0x29024c);});})[_0xfe49('0x2a')](function(_0x4f63a3){var _0x3905da=qs['omit'](_0x31b6fa,['id',_0xfe49('0x50'),_0xfe49('0x51')]);_0x3905da[_0xfe49('0x5c')]=_0x263314['id'];if(_0x4f63a3)_0x3905da['Resources']=_0x4f63a3;return _0x3905da;})[_0xfe49('0x2a')](function(_0x3bcf6d){return db['UserProfileSection'][_0xfe49('0x4d')](_0x3bcf6d,{'include':[{'model':db[_0xfe49('0x5a')],'as':_0xfe49('0x5d')}],'raw':!![],'transaction':_0x659c7c});});})[_0xfe49('0x2a')](function(){return _0x263314;});}});});});}})[_0xfe49('0x2a')](respondWithResult(_0x5574c9,0xc9))[_0xfe49('0x47')](handleError(_0x5574c9,null));};exports[_0xfe49('0x29')]=function(_0x5b0d8d,_0x2db596){if(_0x5b0d8d[_0xfe49('0x4e')]['id']){delete _0x5b0d8d[_0xfe49('0x4e')]['id'];}return db['UserProfile']['find']({'where':{'id':_0x5b0d8d['params']['id']}})[_0xfe49('0x2a')](handleEntityNotFound(_0x2db596,null))[_0xfe49('0x2a')](saveUpdates(_0x5b0d8d[_0xfe49('0x4e')],null))[_0xfe49('0x2a')](respondWithResult(_0x2db596,null))[_0xfe49('0x47')](handleError(_0x2db596,null));};exports[_0xfe49('0x2b')]=function(_0x210de8,_0x1752db){return db['UserProfile'][_0xfe49('0x4c')]({'where':{'id':_0x210de8[_0xfe49('0x49')]['id']}})[_0xfe49('0x2a')](handleEntityNotFound(_0x1752db,null))[_0xfe49('0x2a')](removeEntity(_0x1752db,null))[_0xfe49('0x47')](handleError(_0x1752db,null));};exports[_0xfe49('0x5e')]=function(_0x34dff0,_0x1050f8){return db[_0xfe49('0x30')][_0xfe49('0x5e')]()[_0xfe49('0x2a')](respondWithResult(_0x1050f8,null))[_0xfe49('0x47')](handleError(_0x1050f8,null));};exports[_0xfe49('0x5f')]=function(_0x25ba7a,_0x53f0d9){var _0x39e92e=_0x25ba7a[_0xfe49('0x4e')];return db['UserProfile'][_0xfe49('0x4c')]({'where':{'id':_0x25ba7a[_0xfe49('0x49')]['id']}})[_0xfe49('0x2a')](handleEntityNotFound(_0x53f0d9,null))[_0xfe49('0x2a')](function(_0x113d60){if(_0x113d60){return db[_0xfe49('0x54')][_0xfe49('0x55')](function(_0x3acced){return db[_0xfe49('0x57')][_0xfe49('0x2b')]({'where':{'userProfileId':_0x25ba7a[_0xfe49('0x49')]['id'],'sectionId':_[_0xfe49('0x36')](_0x39e92e,function(_0x5d9a46){return _0x5d9a46[_0xfe49('0x5b')];})},'transaction':_0x3acced})['then'](function(){var _0x3e6f0b=_['map'](_0x39e92e,function(_0x4111e7){_0x4111e7[_0xfe49('0x5c')]=_0x25ba7a['params']['id'];return _0x4111e7;});var _0x3153bd=[];return BPromise[_0xfe49('0x60')](_0x3e6f0b,function(_0x5a5b29){return db[_0xfe49('0x57')][_0xfe49('0x4d')](_0x5a5b29,{'include':[{'model':db[_0xfe49('0x5a')],'as':_0xfe49('0x5d')}],'raw':!![],'transaction':_0x3acced})[_0xfe49('0x2a')](function(_0x5cf617){_0x3153bd['push'](_0x5cf617[_0xfe49('0x4f')]({'plain':!![]}));});})[_0xfe49('0x2a')](function(){return _0x3153bd;});});});}})['then'](function(_0x32070b){return _0x32070b;})['then'](respondWithResult(_0x53f0d9,null))['catch'](handleError(_0x53f0d9,null));};exports[_0xfe49('0x61')]=function(_0x1508de,_0x47b05d){var _0x585c23;return db[_0xfe49('0x30')][_0xfe49('0x4c')]({'where':{'id':_0x1508de['params']['id']},'attributes':['id',_0xfe49('0x2e')]})['then'](handleEntityNotFound(_0x47b05d,null))[_0xfe49('0x2a')](function(_0xc9c096){if(_0xc9c096){_0x585c23=_0xc9c096;return db[_0xfe49('0x57')]['destroy']({'where':{'userProfileId':_0x1508de['params']['id'],'sectionId':_0x1508de[_0xfe49('0x37')]['ids']}});}})[_0xfe49('0x2a')](function(){return _0x585c23;})[_0xfe49('0x2a')](respondWithStatusCode(_0x47b05d,null))[_0xfe49('0x47')](handleError(_0x47b05d,null));};exports[_0xfe49('0x62')]=function(_0x31aa74,_0x3ee630){var _0x25d946=[];var _0x441f98=[];return db[_0xfe49('0x57')][_0xfe49('0x58')]({'where':{'userProfileId':_0x31aa74['params']['id']},'raw':!![]})[_0xfe49('0x2a')](function(_0x1c4beb){_0x25d946=_[_0xfe49('0x42')](_0x1c4beb,function(_0x3f6d18){return _0x3f6d18[_0xfe49('0x63')]===0x1||_[_0xfe49('0x64')]([0x3eb,0x709],_0x3f6d18[_0xfe49('0x5b')]);});if(!_[_0xfe49('0x65')](_0x25d946)){return _[_0xfe49('0x36')](_0x25d946,function(_0x295ca4){return _0x295ca4[_0xfe49('0x5b')];});}else{return;}})[_0xfe49('0x2a')](function(_0x523994){if(_0x523994)_0x441f98=_0x523994;if(_['includes'](_0x441f98,0x64)){var _0x851ced=_[_0xfe49('0x4c')](_0x25d946,{'sectionId':0x64});return hasDefaultDashboard(_0x851ced)[_0xfe49('0x2a')](function(_0x50b61f){return _[_0xfe49('0x36')](_0x25d946,function(_0xdab8bb){if(_0xdab8bb[_0xfe49('0x5b')]===0x64){_0xdab8bb['subsections']=_0x50b61f;}return _0xdab8bb;});});}else{return;}})[_0xfe49('0x2a')](function(_0x44393d){if(_0x44393d)_0x25d946=_0x44393d;if(_[_0xfe49('0x64')](_0x441f98,0x3eb)){var _0x2f24b8=_[_0xfe49('0x4c')](_0x25d946,{'sectionId':0x3eb});return getCustomDashboards(_0x2f24b8)['then'](function(_0xf91de5){return _[_0xfe49('0x36')](_0x25d946,function(_0x3a4d1c){if(_0x2f24b8[_0xfe49('0x63')]){if(_0x3a4d1c[_0xfe49('0x5b')]===0x3eb){_0x3a4d1c[_0xfe49('0x66')]=_0xf91de5;}}else{if(_0x3a4d1c[_0xfe49('0x5b')]===0x64){if(!_0x3a4d1c[_0xfe49('0x66')]){_0x3a4d1c[_0xfe49('0x66')]=[];}_0x3a4d1c['subsections']=_0x3a4d1c['subsections'][_0xfe49('0x67')](_0xf91de5);}}return _0x3a4d1c;});});}else{return;}})[_0xfe49('0x2a')](function(_0x453eca){if(_0x453eca)_0x25d946=_0x453eca;if(_[_0xfe49('0x64')](_0x441f98,0x709)){var _0x3224d0=_[_0xfe49('0x4c')](_0x25d946,{'sectionId':0x709});return getPlugins(_0x3224d0)[_0xfe49('0x2a')](function(_0x4774c4){if(_0x3224d0[_0xfe49('0x63')]){return _['map'](_0x25d946,function(_0x52654d){if(_0x52654d[_0xfe49('0x5b')]===0x709){_0x52654d['subsections']=_0x4774c4;}return _0x52654d;});}else{var _0xd94568={'sectionId':0x76c,'enabled':0x1,'subsections':_0x4774c4};var _0x49f24f=_[_0xfe49('0x36')](_0x25d946);_0x49f24f['push'](_0xd94568);return _0x49f24f;}});}else{return;}})[_0xfe49('0x2a')](function(_0x2ba7a2){if(_0x2ba7a2)_0x25d946=_0x2ba7a2;return _[_0xfe49('0x42')](_0x25d946,[_0xfe49('0x63'),0x1]);})[_0xfe49('0x2a')](respondWithResult(_0x3ee630,null))['catch'](handleError(_0x3ee630,null));};function hasDefaultDashboard(_0x3039a6){var _0x325a0f=[0x65];return new BPromise(function(_0x2aba32,_0x5a59f0){try{if(_0x3039a6[_0xfe49('0x59')]){_0x2aba32(_0x325a0f);}else{return db[_0xfe49('0x5a')][_0xfe49('0x68')]({'where':{'sectionId':_0x3039a6['id']},'raw':!![]})['then'](function(_0x2a7a71){_0x2a7a71?_0x2aba32(_0x325a0f):_0x2aba32();});}}catch(_0xf0d99f){_0x5a59f0(_0xf0d99f);}});}function getCustomDashboards(_0x184ab0){var _0x4640a2=[];return new BPromise(function(_0x2fb1cf,_0x304f2d){try{if(_0x184ab0[_0xfe49('0x59')]){return db['Dashboard'][_0xfe49('0x58')]({'raw':!![]})[_0xfe49('0x2a')](function(_0x191cbd){_0x191cbd[_0xfe49('0x69')](function(_0x2fec33){_0x4640a2['push'](_0x2fec33['id']+0x1869f);});_0x2fb1cf(_0x4640a2);});}else{return db[_0xfe49('0x5a')][_0xfe49('0x58')]({'where':{'sectionId':_0x184ab0['id']},'raw':!![]})[_0xfe49('0x2a')](function(_0x4141c8){_0x4141c8['forEach'](function(_0x2892a4){_0x4640a2[_0xfe49('0x6a')](_0x2892a4[_0xfe49('0x6b')]+0x1869f);});_0x2fb1cf(_0x4640a2);});}}catch(_0x4789a8){_0x304f2d(_0x4789a8);}});}function getPlugins(_0x1756c9){var _0x3cde02=[];return new BPromise(function(_0x5c20ac,_0x5587d5){try{if(_0x1756c9[_0xfe49('0x59')]){return db[_0xfe49('0x6c')][_0xfe49('0x58')]({'raw':!![]})['then'](function(_0x2eb95b){_0x2eb95b[_0xfe49('0x69')](function(_0x26e731){_0x3cde02[_0xfe49('0x6a')](_0x26e731['id']+0x15b38);});_0x5c20ac(_0x3cde02);});}else{return db['UserProfileResource'][_0xfe49('0x58')]({'where':{'sectionId':_0x1756c9['id']},'raw':!![]})[_0xfe49('0x2a')](function(_0x448a34){_0x448a34[_0xfe49('0x69')](function(_0x39d776){_0x3cde02[_0xfe49('0x6a')](_0x39d776['resourceId']+0x15b38);});_0x5c20ac(_0x3cde02);});}}catch(_0x209057){_0x5587d5(_0x209057);}});}exports[_0xfe49('0x6d')]=function(_0x56f409,_0x2fbcc7){return db[_0xfe49('0x30')][_0xfe49('0x4c')]({'where':{'id':_0x56f409[_0xfe49('0x49')]['id']}})[_0xfe49('0x2a')](handleEntityNotFound(_0x2fbcc7,null))[_0xfe49('0x2a')](function(_0x59e35a){if(_0x59e35a){return db[_0xfe49('0x54')][_0xfe49('0x55')](function(_0x42af32){return db[_0xfe49('0x57')][_0xfe49('0x58')]({'where':{'userProfileId':_0x56f409[_0xfe49('0x49')]['id']},'attributes':['id'],'raw':!![]})['then'](function(_0x31d570){if(_0x31d570){return db[_0xfe49('0x57')][_0xfe49('0x2b')]({'where':{'userProfileId':_0x56f409['params']['id'],'id':_[_0xfe49('0x36')](_0x31d570,function(_0x29e696){return _0x29e696['id'];})},'transaction':_0x42af32});}})[_0xfe49('0x2a')](function(_0xbbf2bc){var _0x560774=_['map'](_0x56f409[_0xfe49('0x4e')],function(_0x342af6){_0x342af6[_0xfe49('0x5c')]=_0x56f409['params']['id'];return _0x342af6;});return db[_0xfe49('0x57')][_0xfe49('0x6e')](_0x560774,{'raw':!![],'transaction':_0x42af32});})[_0xfe49('0x2a')](function(_0x4f7661){var _0x2659bd=_['filter'](_[_0xfe49('0x36')](_0x4f7661,function(_0x1fc7fd){return _0x1fc7fd['get']({'plain':!![]});}),{'includeAll':![]});if(_0x2659bd){return db[_0xfe49('0x57')][_0xfe49('0x58')]({'where':{'userProfileId':_0x56f409[_0xfe49('0x49')]['id'],'sectionId':_[_0xfe49('0x36')](_0x2659bd,function(_0x209451){return _0x209451[_0xfe49('0x5b')];})},'attributes':['id',_0xfe49('0x5b')],'raw':!![]})[_0xfe49('0x2a')](function(_0x415e48){var _0x1bb967=_[_0xfe49('0x36')](_0x56f409[_0xfe49('0x4e')],function(_0x4e2aac){_0x4e2aac[_0xfe49('0x5c')]=_0x56f409[_0xfe49('0x49')]['id'];return _0x4e2aac;});return db[_0xfe49('0x5a')][_0xfe49('0x6e')](_0x1bb967,{'raw':!![],'transaction':_0x42af32});});}})[_0xfe49('0x47')](handleError(_0x2fbcc7,null));});}})['then'](function(_0xe0edb){var _0x51c8f1=_[_0xfe49('0x36')](_0xe0edb,function(_0x83d28){return _0x83d28[_0xfe49('0x4f')]({'plain':!![]});});})[_0xfe49('0x2a')](respondWithResult(_0x2fbcc7,null))[_0xfe49('0x47')](handleError(_0x2fbcc7,null));};exports[_0xfe49('0x6f')]=function(_0x562cdb,_0x3e44f4,_0x314d50){return db[_0xfe49('0x30')][_0xfe49('0x4c')]({'where':{'id':_0x562cdb['params']['id']}})[_0xfe49('0x2a')](handleEntityNotFound(_0x3e44f4,null))[_0xfe49('0x2a')](function(_0xb84328){if(_0xb84328){return _0xb84328[_0xfe49('0x6f')](_0x562cdb[_0xfe49('0x37')]['ids']);}})['then'](respondWithStatusCode(_0x3e44f4,null))[_0xfe49('0x47')](handleError(_0x3e44f4,null));};exports[_0xfe49('0x70')]=function(_0x5077fd,_0x33f683){var _0x564a68={};if(!_0x5077fd[_0xfe49('0x37')][_0xfe49('0x71')])throw new Error(_0xfe49('0x72'));if(!_0x5077fd[_0xfe49('0x37')][_0xfe49('0x3c')](_0xfe49('0x3d'))){_0x564a68[_0xfe49('0x21')]=qs['limit'](_0x5077fd[_0xfe49('0x37')][_0xfe49('0x21')]);_0x564a68[_0xfe49('0x23')]=qs[_0xfe49('0x23')](_0x5077fd['query'][_0xfe49('0x23')]);}return db[_0xfe49('0x30')][_0xfe49('0x4c')]({'where':{'id':_0x5077fd[_0xfe49('0x49')]['id']}})[_0xfe49('0x2a')](function(_0x486ca4){if(!_0x486ca4)throw new Error('No\x20User\x20Profile\x20found\x20for\x20id\x20'+_0x5077fd[_0xfe49('0x49')]['id']);return db[_0xfe49('0x30')]['getResources'](_0x5077fd);})['then'](respondWithFilteredResult(_0x33f683,_0x564a68))[_0xfe49('0x47')](handleError(_0x33f683,null));}; \ No newline at end of file +var _0x2a11=['request-promise','moment','bluebird','mustache','util','path','to-csv','ejs','lodash','crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../mysqldb','defaults','redis','socket.io-emitter','sendStatus','status','end','json','undefined','count','offset','limit','set','Content-Range','reject','save','update','then','error','stack','index','map','UserProfile','fieldName','key','model','query','keys','fields','attributes','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','type','name','filter','includeAll','include','findAll','rawAttributes','intersection','length','options','find','create','catch','params','get','omit','createdAt','updatedAt','crudPermissions','body','sequelize','transaction','UserProfileSection','each','autoAssociation','sectionId','userProfileId','Resources','destroy','describe','addSections','UserProfileResource','push','removeSections','getSections','enabled','includes','isEmpty','subsections','concat','findOne','forEach','resourceId','Plugin','bulkCreate','removeResources','ids','section','Missing\x20section\x20parameter','No\x20User\x20Profile\x20found\x20for\x20id\x20','getResources','rimraf','zip-dir','fast-json-patch'];(function(_0x589825,_0x1ad36e){var _0xed7d60=function(_0x24dd51){while(--_0x24dd51){_0x589825['push'](_0x589825['shift']());}};_0xed7d60(++_0x1ad36e);}(_0x2a11,0x1b5));var _0x12a1=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x2a11[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x12a1('0x0'));var zipdir=require(_0x12a1('0x1'));var jsonpatch=require(_0x12a1('0x2'));var rp=require(_0x12a1('0x3'));var moment=require(_0x12a1('0x4'));var BPromise=require(_0x12a1('0x5'));var Mustache=require(_0x12a1('0x6'));var util=require(_0x12a1('0x7'));var path=require(_0x12a1('0x8'));var sox=require('sox');var csv=require(_0x12a1('0x9'));var ejs=require(_0x12a1('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x12a1('0xb'));var squel=require('squel');var crypto=require(_0x12a1('0xc'));var jsforce=require(_0x12a1('0xd'));var deskjs=require(_0x12a1('0xe'));var toCsv=require(_0x12a1('0x9'));var querystring=require(_0x12a1('0xf'));var Papa=require('papaparse');var Redis=require(_0x12a1('0x10'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x12a1('0x11'));var hardwareService=require(_0x12a1('0x12'));var logger=require(_0x12a1('0x13'))(_0x12a1('0x14'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0x12a1('0x15'))['db'];config['redis']=_[_0x12a1('0x16')](config[_0x12a1('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x12a1('0x18'))(new Redis(config[_0x12a1('0x17')]));require('./userProfile.socket')['register'](socket);function respondWithStatusCode(_0x2a9111,_0x5343b7){_0x5343b7=_0x5343b7||0xcc;return function(_0x7fbfe9){if(_0x7fbfe9){return _0x2a9111[_0x12a1('0x19')](_0x5343b7);}return _0x2a9111[_0x12a1('0x1a')](_0x5343b7)[_0x12a1('0x1b')]();};}function respondWithResult(_0x3833f8,_0x3938b6){_0x3938b6=_0x3938b6||0xc8;return function(_0x57d126){if(_0x57d126){return _0x3833f8['status'](_0x3938b6)[_0x12a1('0x1c')](_0x57d126);}};}function respondWithFilteredResult(_0x133fab,_0x45db40){return function(_0x2d7732){if(_0x2d7732){var _0x5e0e34=typeof _0x45db40['offset']===_0x12a1('0x1d')&&typeof _0x45db40['limit']==='undefined';var _0xa1e5ff=_0x2d7732[_0x12a1('0x1e')];var _0x386797=_0x5e0e34?0x0:_0x45db40['offset'];var _0xfc92d=_0x5e0e34?_0x2d7732[_0x12a1('0x1e')]:_0x45db40[_0x12a1('0x1f')]+_0x45db40[_0x12a1('0x20')];var _0x1d446f;if(_0xfc92d>=_0xa1e5ff){_0xfc92d=_0xa1e5ff;_0x1d446f=0xc8;}else{_0x1d446f=0xce;}_0x133fab['status'](_0x1d446f);return _0x133fab[_0x12a1('0x21')](_0x12a1('0x22'),_0x386797+'-'+_0xfc92d+'/'+_0xa1e5ff)[_0x12a1('0x1c')](_0x2d7732);}return null;};}function patchUpdates(_0x47a3d8){return function(_0x451868){try{jsonpatch['apply'](_0x451868,_0x47a3d8,!![]);}catch(_0xe169a0){return BPromise[_0x12a1('0x23')](_0xe169a0);}return _0x451868[_0x12a1('0x24')]();};}function saveUpdates(_0x38acdd,_0x5237c2){return function(_0x2533cc){if(_0x2533cc){return _0x2533cc[_0x12a1('0x25')](_0x38acdd)[_0x12a1('0x26')](function(_0x573ab8){return _0x573ab8;});}return null;};}function removeEntity(_0x504ede,_0x154edd){return function(_0x559b7a){if(_0x559b7a){return _0x559b7a['destroy']()[_0x12a1('0x26')](function(){_0x504ede[_0x12a1('0x1a')](0xcc)[_0x12a1('0x1b')]();});}};}function handleEntityNotFound(_0x5c5afd,_0x94f4e5){return function(_0x1068e1){if(!_0x1068e1){_0x5c5afd[_0x12a1('0x19')](0x194);}return _0x1068e1;};}function handleError(_0x4105b4,_0x434558){_0x434558=_0x434558||0x1f4;return function(_0x45b34d){logger[_0x12a1('0x27')](_0x45b34d[_0x12a1('0x28')]);if(_0x45b34d['name']){delete _0x45b34d['name'];}_0x4105b4[_0x12a1('0x1a')](_0x434558)['send'](_0x45b34d);};}exports[_0x12a1('0x29')]=function(_0x30b0a9,_0x4b2fb5){var _0x1ce417={},_0x1046d8={},_0x421195={'count':0x0,'rows':[]};var _0x2428a6=_[_0x12a1('0x2a')](db[_0x12a1('0x2b')]['rawAttributes'],function(_0x4b548f){return{'name':_0x4b548f[_0x12a1('0x2c')],'type':_0x4b548f['type'][_0x12a1('0x2d')]};});_0x1046d8[_0x12a1('0x2e')]=_[_0x12a1('0x2a')](_0x2428a6,'name');_0x1046d8[_0x12a1('0x2f')]=_[_0x12a1('0x30')](_0x30b0a9[_0x12a1('0x2f')]);_0x1046d8['filters']=_['intersection'](_0x1046d8[_0x12a1('0x2e')],_0x1046d8['query']);_0x1ce417['attributes']=_['intersection'](_0x1046d8[_0x12a1('0x2e')],qs[_0x12a1('0x31')](_0x30b0a9[_0x12a1('0x2f')][_0x12a1('0x31')]));_0x1ce417[_0x12a1('0x32')]=_0x1ce417['attributes']['length']?_0x1ce417['attributes']:_0x1046d8[_0x12a1('0x2e')];if(!_0x30b0a9[_0x12a1('0x2f')][_0x12a1('0x33')](_0x12a1('0x34'))){_0x1ce417[_0x12a1('0x20')]=qs['limit'](_0x30b0a9[_0x12a1('0x2f')][_0x12a1('0x20')]);_0x1ce417['offset']=qs['offset'](_0x30b0a9[_0x12a1('0x2f')][_0x12a1('0x1f')]);}_0x1ce417[_0x12a1('0x35')]=qs[_0x12a1('0x36')](_0x30b0a9[_0x12a1('0x2f')]['sort']);_0x1ce417[_0x12a1('0x37')]=qs['filters'](_[_0x12a1('0x38')](_0x30b0a9[_0x12a1('0x2f')],_0x1046d8[_0x12a1('0x39')]),_0x2428a6);if(_0x30b0a9[_0x12a1('0x2f')]['filter']){_0x1ce417[_0x12a1('0x37')]=_[_0x12a1('0x3a')](_0x1ce417[_0x12a1('0x37')],{'$or':_['map'](_0x2428a6,function(_0x42639f){if(_0x42639f[_0x12a1('0x3b')]!=='VIRTUAL'){var _0x360498={};_0x360498[_0x42639f[_0x12a1('0x3c')]]={'$like':'%'+_0x30b0a9[_0x12a1('0x2f')][_0x12a1('0x3d')]+'%'};return _0x360498;}})});}_0x1ce417=_[_0x12a1('0x3a')]({},_0x1ce417,_0x30b0a9['options']);var _0x2d79e8={'where':_0x1ce417['where']};return db[_0x12a1('0x2b')]['count'](_0x2d79e8)[_0x12a1('0x26')](function(_0x3ce18b){_0x421195[_0x12a1('0x1e')]=_0x3ce18b;if(_0x30b0a9[_0x12a1('0x2f')][_0x12a1('0x3e')]){_0x1ce417[_0x12a1('0x3f')]=[{'all':!![]}];}return db[_0x12a1('0x2b')][_0x12a1('0x40')](_0x1ce417);})['then'](function(_0x4591e7){_0x421195['rows']=_0x4591e7;return _0x421195;})['then'](respondWithFilteredResult(_0x4b2fb5,_0x1ce417))['catch'](handleError(_0x4b2fb5,null));};exports['show']=function(_0x55b188,_0x405134){var _0x14242d={'raw':![],'where':{'id':_0x55b188['params']['id']}},_0x15e51f={};_0x15e51f[_0x12a1('0x2e')]=_['keys'](db['UserProfile'][_0x12a1('0x41')]);_0x15e51f[_0x12a1('0x2f')]=_[_0x12a1('0x30')](_0x55b188[_0x12a1('0x2f')]);_0x15e51f[_0x12a1('0x39')]=_['intersection'](_0x15e51f[_0x12a1('0x2e')],_0x15e51f['query']);_0x14242d['attributes']=_[_0x12a1('0x42')](_0x15e51f[_0x12a1('0x2e')],qs[_0x12a1('0x31')](_0x55b188[_0x12a1('0x2f')][_0x12a1('0x31')]));_0x14242d['attributes']=_0x14242d[_0x12a1('0x32')][_0x12a1('0x43')]?_0x14242d['attributes']:_0x15e51f[_0x12a1('0x2e')];if(_0x55b188['query'][_0x12a1('0x3e')]){_0x14242d[_0x12a1('0x3f')]=[{'all':!![]}];}_0x14242d=_[_0x12a1('0x3a')]({},_0x14242d,_0x55b188[_0x12a1('0x44')]);return db[_0x12a1('0x2b')][_0x12a1('0x45')](_0x14242d)[_0x12a1('0x26')](handleEntityNotFound(_0x405134,null))[_0x12a1('0x26')](respondWithResult(_0x405134,null))['catch'](handleError(_0x405134,null));};exports[_0x12a1('0x46')]=function(_0x2b6495,_0x467307){return db[_0x12a1('0x2b')][_0x12a1('0x46')](_0x2b6495['body'],{})['then'](respondWithResult(_0x467307,0xc9))[_0x12a1('0x47')](handleError(_0x467307,null));};exports['clone']=function(_0x4cf7cd,_0x36cbd1){var _0x4a1826={'where':{'id':_0x4cf7cd[_0x12a1('0x48')]['id']}},_0x5e0645={};_0x5e0645['model']=_[_0x12a1('0x30')](db[_0x12a1('0x2b')][_0x12a1('0x41')]);_0x4a1826[_0x12a1('0x32')]=_[_0x12a1('0x42')](_0x5e0645['model'],qs[_0x12a1('0x31')](_0x4cf7cd[_0x12a1('0x2f')][_0x12a1('0x31')]));_0x4a1826[_0x12a1('0x32')]=_0x4a1826['attributes'][_0x12a1('0x43')]?_0x4a1826[_0x12a1('0x32')]:_0x5e0645[_0x12a1('0x2e')];if(_0x4cf7cd[_0x12a1('0x2f')][_0x12a1('0x3e')]){_0x4a1826[_0x12a1('0x3f')]=[{'all':!![]}];}_0x4a1826=_[_0x12a1('0x3a')]({},_0x4a1826,_0x4cf7cd[_0x12a1('0x44')]);return db['UserProfile']['find'](_0x4a1826)[_0x12a1('0x26')](handleEntityNotFound(_0x36cbd1,null))[_0x12a1('0x26')](function(_0x1d7eaf){if(_0x1d7eaf){var _0x5c5741=_0x1d7eaf[_0x12a1('0x49')]({'plain':!![]});_0x5c5741=qs[_0x12a1('0x4a')](_0x5c5741,['id',_0x12a1('0x4b'),_0x12a1('0x4c'),_0x12a1('0x4d')]);_0x4cf7cd['body']=_[_0x12a1('0x4a')](_0x4cf7cd[_0x12a1('0x4e')],['id',_0x12a1('0x4b'),_0x12a1('0x4c')]);return db[_0x12a1('0x4f')][_0x12a1('0x50')](function(_0x208b36){return db['UserProfile'][_0x12a1('0x46')](_[_0x12a1('0x3a')](_0x5c5741,_0x4cf7cd['body']),{'include':_0x4cf7cd['query'][_0x12a1('0x3e')]?[{'all':!![]}]:undefined,'transaction':_0x208b36})[_0x12a1('0x26')](function(_0x3a1c86){var _0x583d2d=_0x3a1c86[_0x12a1('0x49')]({'plain':!![]});return db[_0x12a1('0x51')][_0x12a1('0x40')]({'where':{'userProfileId':_0x4cf7cd[_0x12a1('0x48')]['id']},'raw':!![]})[_0x12a1('0x26')](function(_0x9faa3e){if(_0x9faa3e){return BPromise[_0x12a1('0x52')](_0x9faa3e,function(_0x2ee98e){return new BPromise(function(_0x57c82f,_0x46b6a0){if(_0x2ee98e[_0x12a1('0x53')]===null||_0x2ee98e[_0x12a1('0x53')]===0x1)_0x57c82f(null);return db['UserProfileResource'][_0x12a1('0x40')]({'where':{'sectionId':_0x2ee98e['id']},'raw':!![]})[_0x12a1('0x26')](function(_0x25f448){var _0x3a433b=_['map'](_0x25f448,function(_0x33714d){return qs[_0x12a1('0x4a')](_0x33714d,['id','createdAt','updatedAt',_0x12a1('0x54')]);});_0x57c82f(_0x3a433b);})[_0x12a1('0x47')](function(_0x497473){_0x46b6a0(_0x497473);});})[_0x12a1('0x26')](function(_0x36e3dd){var _0x1fe6b3=qs['omit'](_0x2ee98e,['id',_0x12a1('0x4b'),_0x12a1('0x4c')]);_0x1fe6b3[_0x12a1('0x55')]=_0x583d2d['id'];if(_0x36e3dd)_0x1fe6b3[_0x12a1('0x56')]=_0x36e3dd;return _0x1fe6b3;})['then'](function(_0x2e75bd){return db[_0x12a1('0x51')][_0x12a1('0x46')](_0x2e75bd,{'include':[{'model':db['UserProfileResource'],'as':_0x12a1('0x56')}],'raw':!![],'transaction':_0x208b36});});})[_0x12a1('0x26')](function(){return _0x583d2d;});}});});});}})[_0x12a1('0x26')](respondWithResult(_0x36cbd1,0xc9))[_0x12a1('0x47')](handleError(_0x36cbd1,null));};exports[_0x12a1('0x25')]=function(_0x15799b,_0x3b1f17){if(_0x15799b[_0x12a1('0x4e')]['id']){delete _0x15799b[_0x12a1('0x4e')]['id'];}return db['UserProfile'][_0x12a1('0x45')]({'where':{'id':_0x15799b[_0x12a1('0x48')]['id']}})[_0x12a1('0x26')](handleEntityNotFound(_0x3b1f17,null))[_0x12a1('0x26')](saveUpdates(_0x15799b[_0x12a1('0x4e')],null))['then'](respondWithResult(_0x3b1f17,null))[_0x12a1('0x47')](handleError(_0x3b1f17,null));};exports[_0x12a1('0x57')]=function(_0x5d3a9b,_0x4597ce){return db[_0x12a1('0x2b')]['find']({'where':{'id':_0x5d3a9b[_0x12a1('0x48')]['id']}})['then'](handleEntityNotFound(_0x4597ce,null))['then'](removeEntity(_0x4597ce,null))['catch'](handleError(_0x4597ce,null));};exports[_0x12a1('0x58')]=function(_0x3fd3ca,_0x47409e){return db[_0x12a1('0x2b')]['describe']()[_0x12a1('0x26')](respondWithResult(_0x47409e,null))[_0x12a1('0x47')](handleError(_0x47409e,null));};exports[_0x12a1('0x59')]=function(_0x5fb6e0,_0x48d589){var _0x3887de=_0x5fb6e0[_0x12a1('0x4e')];return db['UserProfile'][_0x12a1('0x45')]({'where':{'id':_0x5fb6e0['params']['id']}})['then'](handleEntityNotFound(_0x48d589,null))[_0x12a1('0x26')](function(_0x1e103d){if(_0x1e103d){return db[_0x12a1('0x4f')][_0x12a1('0x50')](function(_0x39bf74){return db[_0x12a1('0x51')][_0x12a1('0x57')]({'where':{'userProfileId':_0x5fb6e0[_0x12a1('0x48')]['id'],'sectionId':_['map'](_0x3887de,function(_0x2cf66d){return _0x2cf66d[_0x12a1('0x54')];})},'transaction':_0x39bf74})['then'](function(){var _0x44ad86=_[_0x12a1('0x2a')](_0x3887de,function(_0x529bd7){_0x529bd7[_0x12a1('0x55')]=_0x5fb6e0[_0x12a1('0x48')]['id'];return _0x529bd7;});var _0x2404a8=[];return BPromise[_0x12a1('0x52')](_0x44ad86,function(_0x5dbabd){return db[_0x12a1('0x51')]['create'](_0x5dbabd,{'include':[{'model':db[_0x12a1('0x5a')],'as':_0x12a1('0x56')}],'raw':!![],'transaction':_0x39bf74})['then'](function(_0x2f236d){_0x2404a8[_0x12a1('0x5b')](_0x2f236d['get']({'plain':!![]}));});})[_0x12a1('0x26')](function(){return _0x2404a8;});});});}})[_0x12a1('0x26')](function(_0x3279fb){return _0x3279fb;})[_0x12a1('0x26')](respondWithResult(_0x48d589,null))['catch'](handleError(_0x48d589,null));};exports[_0x12a1('0x5c')]=function(_0x36095d,_0x36968c){var _0x4f23cf;return db['UserProfile'][_0x12a1('0x45')]({'where':{'id':_0x36095d[_0x12a1('0x48')]['id']},'attributes':['id','name']})[_0x12a1('0x26')](handleEntityNotFound(_0x36968c,null))[_0x12a1('0x26')](function(_0x381931){if(_0x381931){_0x4f23cf=_0x381931;return db[_0x12a1('0x51')][_0x12a1('0x57')]({'where':{'userProfileId':_0x36095d['params']['id'],'sectionId':_0x36095d[_0x12a1('0x2f')]['ids']}});}})[_0x12a1('0x26')](function(){return _0x4f23cf;})[_0x12a1('0x26')](respondWithStatusCode(_0x36968c,null))[_0x12a1('0x47')](handleError(_0x36968c,null));};exports[_0x12a1('0x5d')]=function(_0x1f28aa,_0x19df22){var _0x346e77=[];var _0x374265=[];return db[_0x12a1('0x51')][_0x12a1('0x40')]({'where':{'userProfileId':_0x1f28aa[_0x12a1('0x48')]['id']},'raw':!![]})[_0x12a1('0x26')](function(_0x2782e4){_0x346e77=_['filter'](_0x2782e4,function(_0x52c3b7){return _0x52c3b7[_0x12a1('0x5e')]===0x1||_[_0x12a1('0x5f')]([0x3eb,0x709],_0x52c3b7['sectionId']);});if(!_[_0x12a1('0x60')](_0x346e77)){return _[_0x12a1('0x2a')](_0x346e77,function(_0x282478){return _0x282478[_0x12a1('0x54')];});}else{return;}})['then'](function(_0x4522e7){if(_0x4522e7)_0x374265=_0x4522e7;if(_['includes'](_0x374265,0x64)){var _0x5b6737=_[_0x12a1('0x45')](_0x346e77,{'sectionId':0x64});return hasDefaultDashboard(_0x5b6737)[_0x12a1('0x26')](function(_0x37db10){return _[_0x12a1('0x2a')](_0x346e77,function(_0x4e9ad3){if(_0x4e9ad3[_0x12a1('0x54')]===0x64){_0x4e9ad3['subsections']=_0x37db10;}return _0x4e9ad3;});});}else{return;}})[_0x12a1('0x26')](function(_0x56de64){if(_0x56de64)_0x346e77=_0x56de64;if(_[_0x12a1('0x5f')](_0x374265,0x3eb)){var _0x3e2b29=_['find'](_0x346e77,{'sectionId':0x3eb});return getCustomDashboards(_0x3e2b29)['then'](function(_0x2d3b5c){return _[_0x12a1('0x2a')](_0x346e77,function(_0x4775ce){if(_0x3e2b29[_0x12a1('0x5e')]){if(_0x4775ce[_0x12a1('0x54')]===0x3eb){_0x4775ce[_0x12a1('0x61')]=_0x2d3b5c;}}else{if(_0x4775ce[_0x12a1('0x54')]===0x64){if(!_0x4775ce[_0x12a1('0x61')]){_0x4775ce[_0x12a1('0x61')]=[];}_0x4775ce[_0x12a1('0x61')]=_0x4775ce[_0x12a1('0x61')][_0x12a1('0x62')](_0x2d3b5c);}}return _0x4775ce;});});}else{return;}})['then'](function(_0x1e862f){if(_0x1e862f)_0x346e77=_0x1e862f;if(_['includes'](_0x374265,0x709)){var _0x9101e4=_['find'](_0x346e77,{'sectionId':0x709});return getPlugins(_0x9101e4)['then'](function(_0x2b7428){if(_0x9101e4['enabled']){return _['map'](_0x346e77,function(_0x2d8d5a){if(_0x2d8d5a[_0x12a1('0x54')]===0x709){_0x2d8d5a['subsections']=_0x2b7428;}return _0x2d8d5a;});}else{var _0x3c1878={'sectionId':0x76c,'enabled':0x1,'subsections':_0x2b7428};var _0x25d787=_[_0x12a1('0x2a')](_0x346e77);_0x25d787[_0x12a1('0x5b')](_0x3c1878);return _0x25d787;}});}else{return;}})['then'](function(_0x315aaf){if(_0x315aaf)_0x346e77=_0x315aaf;return _[_0x12a1('0x3d')](_0x346e77,['enabled',0x1]);})[_0x12a1('0x26')](respondWithResult(_0x19df22,null))[_0x12a1('0x47')](handleError(_0x19df22,null));};function hasDefaultDashboard(_0x58a3d3){var _0x2ecfd3=[0x65];return new BPromise(function(_0x4aa403,_0x312f70){try{if(_0x58a3d3[_0x12a1('0x53')]){_0x4aa403(_0x2ecfd3);}else{return db['UserProfileResource'][_0x12a1('0x63')]({'where':{'sectionId':_0x58a3d3['id']},'raw':!![]})[_0x12a1('0x26')](function(_0x6be03f){_0x6be03f?_0x4aa403(_0x2ecfd3):_0x4aa403();});}}catch(_0x5c670b){_0x312f70(_0x5c670b);}});}function getCustomDashboards(_0x496ffb){var _0x390e99=[];return new BPromise(function(_0x377c76,_0x2774d3){try{if(_0x496ffb[_0x12a1('0x53')]){return db['Dashboard'][_0x12a1('0x40')]({'raw':!![]})[_0x12a1('0x26')](function(_0x24261a){_0x24261a['forEach'](function(_0x5129a6){_0x390e99[_0x12a1('0x5b')](_0x5129a6['id']+0x1869f);});_0x377c76(_0x390e99);});}else{return db[_0x12a1('0x5a')][_0x12a1('0x40')]({'where':{'sectionId':_0x496ffb['id']},'raw':!![]})[_0x12a1('0x26')](function(_0x4bbd1d){_0x4bbd1d[_0x12a1('0x64')](function(_0x4b87ee){_0x390e99['push'](_0x4b87ee[_0x12a1('0x65')]+0x1869f);});_0x377c76(_0x390e99);});}}catch(_0x1285c3){_0x2774d3(_0x1285c3);}});}function getPlugins(_0x14e27f){var _0x2ecac0=[];return new BPromise(function(_0x2c88be,_0x257b01){try{if(_0x14e27f[_0x12a1('0x53')]){return db[_0x12a1('0x66')][_0x12a1('0x40')]({'raw':!![]})[_0x12a1('0x26')](function(_0x2da030){_0x2da030['forEach'](function(_0x14fa0c){_0x2ecac0[_0x12a1('0x5b')](_0x14fa0c['id']+0x15b38);});_0x2c88be(_0x2ecac0);});}else{return db[_0x12a1('0x5a')]['findAll']({'where':{'sectionId':_0x14e27f['id']},'raw':!![]})[_0x12a1('0x26')](function(_0x25a981){_0x25a981[_0x12a1('0x64')](function(_0x32137e){_0x2ecac0['push'](_0x32137e[_0x12a1('0x65')]+0x15b38);});_0x2c88be(_0x2ecac0);});}}catch(_0x4247c5){_0x257b01(_0x4247c5);}});}exports['addResources']=function(_0x5bab2f,_0x2bd8b6){return db[_0x12a1('0x2b')][_0x12a1('0x45')]({'where':{'id':_0x5bab2f['params']['id']}})[_0x12a1('0x26')](handleEntityNotFound(_0x2bd8b6,null))[_0x12a1('0x26')](function(_0x5108fe){if(_0x5108fe){return db[_0x12a1('0x4f')][_0x12a1('0x50')](function(_0x1909d3){return db[_0x12a1('0x51')][_0x12a1('0x40')]({'where':{'userProfileId':_0x5bab2f[_0x12a1('0x48')]['id']},'attributes':['id'],'raw':!![]})[_0x12a1('0x26')](function(_0x46bb98){if(_0x46bb98){return db['UserProfileSection'][_0x12a1('0x57')]({'where':{'userProfileId':_0x5bab2f[_0x12a1('0x48')]['id'],'id':_['map'](_0x46bb98,function(_0x1c7ce6){return _0x1c7ce6['id'];})},'transaction':_0x1909d3});}})[_0x12a1('0x26')](function(_0x29ed13){var _0x590bd2=_['map'](_0x5bab2f[_0x12a1('0x4e')],function(_0x7796ed){_0x7796ed[_0x12a1('0x55')]=_0x5bab2f[_0x12a1('0x48')]['id'];return _0x7796ed;});return db['UserProfileSection'][_0x12a1('0x67')](_0x590bd2,{'raw':!![],'transaction':_0x1909d3});})[_0x12a1('0x26')](function(_0x265b57){var _0x21ba67=_[_0x12a1('0x3d')](_['map'](_0x265b57,function(_0x3167eb){return _0x3167eb[_0x12a1('0x49')]({'plain':!![]});}),{'includeAll':![]});if(_0x21ba67){return db[_0x12a1('0x51')][_0x12a1('0x40')]({'where':{'userProfileId':_0x5bab2f[_0x12a1('0x48')]['id'],'sectionId':_[_0x12a1('0x2a')](_0x21ba67,function(_0x158634){return _0x158634['sectionId'];})},'attributes':['id',_0x12a1('0x54')],'raw':!![]})[_0x12a1('0x26')](function(_0x2dcc16){var _0xea40f6=_[_0x12a1('0x2a')](_0x5bab2f['body'],function(_0x4a2652){_0x4a2652[_0x12a1('0x55')]=_0x5bab2f[_0x12a1('0x48')]['id'];return _0x4a2652;});return db['UserProfileResource'][_0x12a1('0x67')](_0xea40f6,{'raw':!![],'transaction':_0x1909d3});});}})['catch'](handleError(_0x2bd8b6,null));});}})[_0x12a1('0x26')](function(_0x2e2b6f){var _0x1bffab=_[_0x12a1('0x2a')](_0x2e2b6f,function(_0x5d82e8){return _0x5d82e8[_0x12a1('0x49')]({'plain':!![]});});})['then'](respondWithResult(_0x2bd8b6,null))[_0x12a1('0x47')](handleError(_0x2bd8b6,null));};exports[_0x12a1('0x68')]=function(_0x11eb27,_0x28395d,_0x35eea8){return db[_0x12a1('0x2b')][_0x12a1('0x45')]({'where':{'id':_0x11eb27[_0x12a1('0x48')]['id']}})[_0x12a1('0x26')](handleEntityNotFound(_0x28395d,null))[_0x12a1('0x26')](function(_0xf6d8d7){if(_0xf6d8d7){return _0xf6d8d7[_0x12a1('0x68')](_0x11eb27[_0x12a1('0x2f')][_0x12a1('0x69')]);}})[_0x12a1('0x26')](respondWithStatusCode(_0x28395d,null))[_0x12a1('0x47')](handleError(_0x28395d,null));};exports['getResources']=function(_0x480434,_0x5c8278){var _0x44434a={};if(!_0x480434[_0x12a1('0x2f')][_0x12a1('0x6a')])throw new Error(_0x12a1('0x6b'));if(!_0x480434[_0x12a1('0x2f')][_0x12a1('0x33')]('nolimit')){_0x44434a[_0x12a1('0x20')]=qs[_0x12a1('0x20')](_0x480434[_0x12a1('0x2f')][_0x12a1('0x20')]);_0x44434a['offset']=qs[_0x12a1('0x1f')](_0x480434['query'][_0x12a1('0x1f')]);}return db['UserProfile']['find']({'where':{'id':_0x480434[_0x12a1('0x48')]['id']}})[_0x12a1('0x26')](function(_0x45e63d){if(!_0x45e63d)throw new Error(_0x12a1('0x6c')+_0x480434[_0x12a1('0x48')]['id']);return db[_0x12a1('0x2b')][_0x12a1('0x6d')](_0x480434);})[_0x12a1('0x26')](respondWithFilteredResult(_0x5c8278,_0x44434a))['catch'](handleError(_0x5c8278,null));}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.events.js b/server/api/userProfile/userProfile.events.js index 01ba414..9e8b6ca 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 _0xd991=['UserProfile','setMaxListeners','save','remove','emit','hasOwnProperty','hook','events','../../mysqldb'];(function(_0x223d45,_0x3e2623){var _0x474bbf=function(_0x34aabd){while(--_0x34aabd){_0x223d45['push'](_0x223d45['shift']());}};_0x474bbf(++_0x3e2623);}(_0xd991,0x115));var _0x1d99=function(_0x598b88,_0x279358){_0x598b88=_0x598b88-0x0;var _0x17c299=_0xd991[_0x598b88];return _0x17c299;};'use strict';var EventEmitter=require(_0x1d99('0x0'));var UserProfile=require(_0x1d99('0x1'))['db'][_0x1d99('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0x1d99('0x3')](0x0);var events={'afterCreate':_0x1d99('0x4'),'afterUpdate':'update','afterDestroy':_0x1d99('0x5')};function emitEvent(_0xe9aefb){return function(_0xf03459,_0x1f6da3,_0x300c32){UserProfileEvents[_0x1d99('0x6')](_0xe9aefb+':'+_0xf03459['id'],_0xf03459);UserProfileEvents['emit'](_0xe9aefb,_0xf03459);_0x300c32(null);};}for(var e in events){if(events[_0x1d99('0x7')](e)){var event=events[e];UserProfile[_0x1d99('0x8')](e,emitEvent(event));}}module['exports']=UserProfileEvents; \ No newline at end of file +var _0xe3da=['../../mysqldb','UserProfile','setMaxListeners','save','update','remove','emit','hasOwnProperty','hook','exports','events'];(function(_0x445fc2,_0x5c49f3){var _0x131337=function(_0x3ad1d3){while(--_0x3ad1d3){_0x445fc2['push'](_0x445fc2['shift']());}};_0x131337(++_0x5c49f3);}(_0xe3da,0x1cd));var _0xae3d=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xe3da[_0x57b54c];return _0x59cc19;};'use strict';var EventEmitter=require(_0xae3d('0x0'));var UserProfile=require(_0xae3d('0x1'))['db'][_0xae3d('0x2')];var UserProfileEvents=new EventEmitter();UserProfileEvents[_0xae3d('0x3')](0x0);var events={'afterCreate':_0xae3d('0x4'),'afterUpdate':_0xae3d('0x5'),'afterDestroy':_0xae3d('0x6')};function emitEvent(_0x17952f){return function(_0xb2dfd3,_0x22bacf,_0x1b9397){UserProfileEvents[_0xae3d('0x7')](_0x17952f+':'+_0xb2dfd3['id'],_0xb2dfd3);UserProfileEvents[_0xae3d('0x7')](_0x17952f,_0xb2dfd3);_0x1b9397(null);};}for(var e in events){if(events[_0xae3d('0x8')](e)){var event=events[e];UserProfile[_0xae3d('0x9')](e,emitEvent(event));}}module[_0xae3d('0xa')]=UserProfileEvents; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.model.js b/server/api/userProfile/userProfile.model.js index 9a64ff3..535bc23 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 _0x996b=['./userProfile.attributes','../../components/parsers/qs','exports','models','filter','field','value','then','map','catch','model','findAll','associatedResources','name','resolve','UserProfileResource','AnalyticExtractedReport','resourceId','toLowerCase','squareprojects','odbc','childModel','SquareOdbc','squarerecordings','SquareRecording','parentSections','SquareProjects','projects','JscriptyProject','contacts','CmContact','Lists','lists','companies','CmCompany','globalcustomfields','CmCustomField','chatwebsites','FaxQueue','faxaccounts','inboundroutes','internalroutes','contexts','VoiceContext','VoiceMail','VoiceRecording','Agents','membername','User','Telephones','role','telephone','VoiceQueues','VoiceQueue','type','inbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','ivrcampaigns','mailqueues','MailQueue','mailaccounts','MailAccount','mailsubstatuses','MailSubstatus','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsqueues','SmsQueue','smsaccounts','SmsAccount','whatsappqueues','WhatsappQueue','whatsappaccounts','WhatsappAccount','teams','Team','queuecampaigns','users','telephones','Users','admin','zendeskaccounts','ZendeskAccount','salesforceaccounts','SalesforceAccount','freshdeskaccounts','FreshdeskAccount','sugarcrmaccounts','deskaccounts','DeskAccount','zohoaccounts','ZohoAccount','vtigeraccounts','cannedanswers','CannedAnswer','dispositions','Disposition','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','Sound','tags','Tag','Template','Trigger','trunks','variables','plugins','Plugin','Reports','toUpperCase','slice','Sequelize','QueryTypes','select','ui.createdAt','from','where','sequelize','query','toString','UserProfile','user_profiles','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','length','UserProfileSection','all','union','find','ignore','push','keys','intersection','attributes','fields','hasOwnProperty','limit','offset','order','sort','filters','pick','merge','key','VIRTUAL','foreignKey','options','autoAssociation','includeAll','include','forEach','reportType','default','reportId','CustomReports','count','rows','ids','extraQueryConditions','Tags','color','tag','ThroughTags','openTabs','true','dataValues','fax','mail','openchannel','whatsapp'];(function(_0x2d305b,_0x459d7c){var _0x52be39=function(_0x22496b){while(--_0x22496b){_0x2d305b['push'](_0x2d305b['shift']());}};_0x52be39(++_0x459d7c);}(_0x996b,0xb6));var _0xb996=function(_0x529e38,_0x39b919){_0x529e38=_0x529e38-0x0;var _0x15e70f=_0x996b[_0x529e38];return _0x15e70f;};'use strict';var _=require('lodash');var attributes=require(_0xb996('0x0'));var qs=require(_0xb996('0x1'));var squel=require('squel');module[_0xb996('0x2')]=function(_0x559216){var _0xb07dc8=_0x559216[_0xb996('0x3')];function _0x23a7d9(_0x1f6653,_0xffb58e){return new Promise(function(_0x2c34a4,_0x34549b){if(!_0xffb58e)return _0x2c34a4(null);var _0x3fb13f=_0xffb58e['filter']?{[_0xffb58e[_0xb996('0x4')][_0xb996('0x5')]]:_0xffb58e[_0xb996('0x4')][_0xb996('0x6')]}:undefined;return _0xb07dc8[_0x1f6653]['findAll']({'where':_0x3fb13f,'raw':!![]})[_0xb996('0x7')](function(_0x5493b2){_0xffb58e['associatedResources']=_[_0xb996('0x8')](_0x5493b2,'id');_0x2c34a4(_0xffb58e);})[_0xb996('0x9')](function(_0x20e645){_0x34549b(_0x20e645);});});}function _0xc4cf66(_0x39feb3,_0x1e9e59){return new Promise(function(_0x225fd8,_0x566cd9){var _0x8ba359=_0x39feb3['filter']?{[_0x39feb3[_0xb996('0x4')][_0xb996('0x5')]]:_0x39feb3[_0xb996('0x4')][_0xb996('0x6')]}:undefined;return _0xb07dc8[_0x39feb3[_0xb996('0xa')]][_0xb996('0xb')]({'where':_0x8ba359,'raw':!![]})['then'](function(_0x225512){_0x1e9e59[_0xb996('0xc')]=_[_0xb996('0x8')](_0x225512,function(_0x4856b1){return _0x4856b1[_0xb996('0xd')];});_0x225fd8(_0x1e9e59);})[_0xb996('0x9')](function(_0x589d77){_0x566cd9(_0x589d77);});});}function _0x3ff7fb(_0x373c0d,_0x2dfa8a,_0x5218fe){if(!_0x2dfa8a)return Promise[_0xb996('0xe')](null);return new Promise(function(_0x986b9c,_0x12e234){return _0xb07dc8[_0xb996('0xf')]['findAll']({'where':{'sectionId':_0x2dfa8a['id']},'raw':!![]})[_0xb996('0x7')](function(_0x3a7767){if(_0x373c0d[_0xb996('0x5')]&&_0x373c0d[_0xb996('0x5')]!=='id'){_0x2dfa8a[_0xb996('0xc')]=_[_0xb996('0x8')](_0x3a7767,function(_0xf6272f){return _0xf6272f[_0x373c0d['field']];});}else{if(_0x5218fe===_0xb996('0x10')){_0x2dfa8a['associatedResources']=_[_0xb996('0x8')](_0x3a7767,function(_0x2aa312){return{'id':_0x2aa312[_0xb996('0x11')],'type':_0x2aa312['type']};});}else{_0x2dfa8a[_0xb996('0xc')]=_[_0xb996('0x8')](_0x3a7767,function(_0x305802){return _0x305802['resourceId'];});}}_0x986b9c(_0x2dfa8a);})[_0xb996('0x9')](function(_0x21c65c){_0x12e234(_0x21c65c);});});}function _0x26e80d(_0x276a06,_0x32df09){var _0x335960={'parentSections':[]};switch(_0x276a06[_0xb996('0x12')]()){case _0xb996('0x13'):_0x335960['childModel']='SquareProject';break;case _0xb996('0x14'):_0x335960[_0xb996('0x15')]=_0xb996('0x16');break;case _0xb996('0x17'):_0x335960[_0xb996('0x15')]=_0xb996('0x18');_0x335960[_0xb996('0x19')]=[{'name':_0xb996('0x1a'),'field':_0xb996('0xd'),'foreignKey':'projectName'}];break;case _0xb996('0x1b'):_0x335960[_0xb996('0x15')]=_0xb996('0x1c');break;case _0xb996('0x1d'):_0x335960['childModel']=_0xb996('0x1e');_0x335960[_0xb996('0x19')]=[{'name':_0xb996('0x1f'),'field':'id','foreignKey':'ListId'}];break;case _0xb996('0x20'):_0x335960['childModel']='CmList';break;case _0xb996('0x21'):_0x335960['childModel']=_0xb996('0x22');break;case _0xb996('0x23'):_0x335960[_0xb996('0x15')]=_0xb996('0x24');break;case'chatqueues':_0x335960['childModel']='ChatQueue';break;case _0xb996('0x25'):_0x335960[_0xb996('0x15')]='ChatWebsite';break;case'faxqueues':_0x335960[_0xb996('0x15')]=_0xb996('0x26');break;case _0xb996('0x27'):_0x335960[_0xb996('0x15')]='FaxAccount';break;case _0xb996('0x28'):case _0xb996('0x29'):case'outboundroutes':_0x335960['childModel']='VoiceExtension';break;case _0xb996('0x2a'):_0x335960['childModel']=_0xb996('0x2b');break;case'voicemails':_0x335960[_0xb996('0x15')]=_0xb996('0x2c');break;case'voicerecordings':_0x335960['childModel']=_0xb996('0x2d');_0x335960[_0xb996('0x19')]=[{'name':_0xb996('0x2e'),'field':_0xb996('0xd'),'foreignKey':_0xb996('0x2f'),'model':_0xb996('0x30'),'filter':{'field':'role','value':['agent']}},{'name':_0xb996('0x31'),'field':_0xb996('0xd'),'foreignKey':_0xb996('0x2f'),'model':_0xb996('0x30'),'filter':{'field':_0xb996('0x32'),'value':[_0xb996('0x33')]}},{'name':_0xb996('0x34'),'field':_0xb996('0xd'),'foreignKey':'queue','model':_0xb996('0x35'),'filter':{'field':_0xb996('0x36'),'value':[_0xb996('0x37')]}},{'name':'QueueCampaigns','field':_0xb996('0xd'),'foreignKey':'queue','model':_0xb996('0x35'),'filter':{'field':'type','value':['outbound']}}];break;case _0xb996('0x38'):_0x335960[_0xb996('0x15')]=_0xb996('0x39');break;case _0xb996('0x3a'):_0x335960[_0xb996('0x15')]=_0xb996('0x3b');break;case _0xb996('0x3c'):_0x335960[_0xb996('0x15')]='VoicePrefix';break;case _0xb996('0x3d'):_0x335960[_0xb996('0x15')]='Campaign';break;case _0xb996('0x3e'):_0x335960['childModel']=_0xb996('0x3f');break;case _0xb996('0x40'):_0x335960[_0xb996('0x15')]=_0xb996('0x41');break;case _0xb996('0x42'):_0x335960['childModel']=_0xb996('0x43');break;case _0xb996('0x44'):_0x335960['childModel']=_0xb996('0x45');break;case _0xb996('0x46'):_0x335960[_0xb996('0x15')]='OpenchannelAccount';break;case _0xb996('0x47'):_0x335960[_0xb996('0x15')]=_0xb996('0x48');break;case _0xb996('0x49'):_0x335960['childModel']=_0xb996('0x4a');break;case _0xb996('0x4b'):_0x335960[_0xb996('0x15')]=_0xb996('0x4c');break;case _0xb996('0x4d'):_0x335960[_0xb996('0x15')]=_0xb996('0x4e');break;case _0xb996('0x4f'):_0x335960[_0xb996('0x15')]=_0xb996('0x50');break;case'voicequeues':case _0xb996('0x51'):_0x335960['childModel']=_0xb996('0x35');if(_0x32df09){_0x335960[_0xb996('0x19')]=[{'name':'VoiceQueues'},{'name':'QueueCampaigns'}];}break;case _0xb996('0x52'):case'agents':case _0xb996('0x53'):_0x335960['childModel']=_0xb996('0x30');if(_0x32df09){_0x335960['parentSections']=[{'name':_0xb996('0x54'),'filter':{'field':_0xb996('0x32'),'value':[_0xb996('0x55'),'user']},'ignore':!![]},{'name':'Agents'},{'name':_0xb996('0x31')}];}break;case _0xb996('0x56'):_0x335960[_0xb996('0x15')]=_0xb996('0x57');break;case _0xb996('0x58'):_0x335960[_0xb996('0x15')]=_0xb996('0x59');break;case _0xb996('0x5a'):_0x335960[_0xb996('0x15')]=_0xb996('0x5b');break;case _0xb996('0x5c'):_0x335960['childModel']='SugarcrmAccount';break;case _0xb996('0x5d'):_0x335960[_0xb996('0x15')]=_0xb996('0x5e');break;case _0xb996('0x5f'):_0x335960['childModel']=_0xb996('0x60');break;case _0xb996('0x61'):_0x335960[_0xb996('0x15')]=_0xb996('0x30');break;case _0xb996('0x62'):_0x335960[_0xb996('0x15')]=_0xb996('0x63');break;case _0xb996('0x64'):_0x335960[_0xb996('0x15')]=_0xb996('0x65');break;case'customdashboards':_0x335960['childModel']=_0xb996('0x66');break;case _0xb996('0x67'):_0x335960[_0xb996('0x15')]=_0xb996('0x68');break;case _0xb996('0x69'):_0x335960['childModel']='Pause';break;case _0xb996('0x6a'):_0x335960[_0xb996('0x15')]=_0xb996('0x6b');break;case _0xb996('0x6c'):_0x335960['childModel']=_0xb996('0x6d');break;case _0xb996('0x6e'):_0x335960[_0xb996('0x15')]=_0xb996('0x6f');break;case'templates':_0x335960[_0xb996('0x15')]=_0xb996('0x70');break;case'triggers':_0x335960[_0xb996('0x15')]=_0xb996('0x71');break;case _0xb996('0x72'):_0x335960['childModel']='Trunk';break;case _0xb996('0x73'):_0x335960[_0xb996('0x15')]='Variable';break;case _0xb996('0x74'):_0x335960[_0xb996('0x15')]=_0xb996('0x75');break;case'extractedreports':_0x335960[_0xb996('0x15')]=_0xb996('0x10');_0x335960['parentSections']=[{'name':_0xb996('0x76'),'field':'id','foreignKey':'reportId'}];break;case'metrics':_0x335960['childModel']='AnalyticMetric';break;}return _0x335960;}function _0x43cc9f(_0x419ebe,_0x529087){var _0x4a9136=_0x419ebe['charAt'](0x0)[_0xb996('0x77')]()+_0x419ebe[_0xb996('0x78')](0x1);var _0x9509ae={'type':_0xb07dc8[_0xb996('0x79')][_0xb996('0x7a')]['SELECT'],'raw':!![]};return new Promise(function(_0x4f2294,_0x4ca913){var _0xe88beb=squel[_0xb996('0x7b')]()['field']('ui.'+_0x4a9136+'InteractionId','id')['field'](_0xb996('0x7c'))[_0xb996('0x7d')]('user_has_'+_0x419ebe+'_interactions','ui')[_0xb996('0x7e')]('ui.UserId\x20=\x20?',_0x529087['id']);return _0xb07dc8[_0xb996('0x7f')][_0xb996('0x80')](_0xe88beb[_0xb996('0x81')](),_0x9509ae)[_0xb996('0x7')](function(_0x1cea4c){_0x529087[_0x4a9136+'OpenTabs']=_0x1cea4c;_0x4f2294(_0x1cea4c);})[_0xb996('0x9')](function(_0x36295b){_0x4ca913(_0x36295b);});});}return _0x559216['define'](_0xb996('0x82'),attributes,{'tableName':_0xb996('0x83'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x17339c){var _0x506a8f={'raw':_0x17339c['query']['raw'],'where':{}};var _0x551dd2={};var _0x17d1a5={'count':0x0,'rows':[]};var _0x50c754=_0x17339c[_0xb996('0x80')][_0xb996('0x84')];var _0x4dafc9=_0x17339c['query'][_0xb996('0x85')]||![];var _0xaca021=_0x26e80d(_0x50c754,_0x4dafc9);if(!_0xaca021['childModel'])throw new Error(_0xb996('0x86')+_0x50c754+'\x27');var _0xe87808=[{'name':_0x50c754}];if(!_[_0xb996('0x87')](_0xaca021[_0xb996('0x19')]))_0xe87808=_0xaca021[_0xb996('0x19')];var _0x5b5845=[];for(var _0x16f30f=0x0;_0x16f30f<_0xe87808[_0xb996('0x88')];_0x16f30f++){_0x5b5845['push'](_0xb07dc8[_0xb996('0x89')]['find']({'where':{'userProfileId':_0x17339c['params']['id'],'name':_0xe87808[_0x16f30f][_0xb996('0xd')]},'raw':!![]}));}return Promise[_0xb996('0x8a')](_0x5b5845)['then'](function(_0x4d3568){var _0x5b9d90=_[_0xb996('0x4')](_0x4d3568,function(_0x3fc466){return _0x3fc466?_0x3fc466:undefined;});var _0x30b9a8=_[_0xb996('0x4')](_0xe87808,['ignore',!![]]);var _0x11e383=_[_0xb996('0x87')](_0x5b9d90)&&_[_0xb996('0x87')](_0x30b9a8)?null:_[_0xb996('0x8b')](_0x30b9a8,_0x5b9d90);if(!_0x11e383)return null;var _0x6e7f3d=[];for(var _0xfbd600=0x0;_0xfbd600<_0x11e383[_0xb996('0x88')];_0xfbd600++){var _0x59dd74=_[_0xb996('0x8c')](_0xe87808,function(_0x5af5aa){return _0x11e383[_0xfbd600]?_0x5af5aa[_0xb996('0xd')]===_0x11e383[_0xfbd600]['name']:null;});if(_0x59dd74){if(_0x11e383[_0xfbd600][_0xb996('0x8d')]){_0x6e7f3d[_0xb996('0x8e')](_0x23a7d9(_0xaca021[_0xb996('0x15')],_0x11e383[_0xfbd600]));}else{if(!_0x11e383[_0xfbd600]['autoAssociation']){_0x6e7f3d['push'](_0x3ff7fb(_0x59dd74,_0x11e383[_0xfbd600],_0xaca021['childModel']));}else{if(_0x59dd74['model']){_0x6e7f3d[_0xb996('0x8e')](_0xc4cf66(_0x59dd74,_0x11e383[_0xfbd600]));}}}}}return Promise[_0xb996('0x8a')](_0x6e7f3d);})[_0xb996('0x7')](function(_0x585891){var _0x3daa2f=_0x585891;var _0x197f5d=null;if(_0x3daa2f){_0x197f5d=_0x3daa2f['length']===0x1?_0x3daa2f[0x0]:null;}if(!_0x197f5d&&!_0x3daa2f)return _0x17d1a5;var _0xd26e3f=_0xb07dc8[_0xaca021[_0xb996('0x15')]]['rawAttributes'];_0x551dd2[_0xb996('0xa')]=_[_0xb996('0x8f')](_0xd26e3f);_0x551dd2[_0xb996('0x80')]=_[_0xb996('0x8f')](_0x17339c['query']);_0x551dd2['filters']=_[_0xb996('0x90')](_0x551dd2[_0xb996('0xa')],_0x551dd2[_0xb996('0x80')]);_0x506a8f[_0xb996('0x91')]=_[_0xb996('0x90')](_0x551dd2[_0xb996('0xa')],qs['fields'](_0x17339c['query'][_0xb996('0x92')]));_0x506a8f[_0xb996('0x91')]=_0x506a8f[_0xb996('0x91')][_0xb996('0x88')]?_0x506a8f[_0xb996('0x91')]:_0x551dd2['model'];if(!_0x17339c['query'][_0xb996('0x93')]('nolimit')){_0x506a8f[_0xb996('0x94')]=qs[_0xb996('0x94')](_0x17339c['query'][_0xb996('0x94')]);_0x506a8f[_0xb996('0x95')]=qs['offset'](_0x17339c[_0xb996('0x80')][_0xb996('0x95')]);}_0x506a8f[_0xb996('0x96')]=qs[_0xb996('0x97')](_0x17339c[_0xb996('0x80')][_0xb996('0x97')]);_0x506a8f[_0xb996('0x7e')]=qs[_0xb996('0x98')](_[_0xb996('0x99')](_0x17339c['query'],_0x551dd2[_0xb996('0x98')]));if(_0x17339c[_0xb996('0x80')][_0xb996('0x4')]){_0x506a8f[_0xb996('0x7e')]=_[_0xb996('0x9a')](_0x506a8f[_0xb996('0x7e')],{'$or':_[_0xb996('0x8')](_0xd26e3f,function(_0x424a73){if(_0x424a73[_0xb996('0x36')][_0xb996('0x9b')]!==_0xb996('0x9c')){var _0x2e1f25={};_0x2e1f25[_0x424a73[_0xb996('0x5')]]={'$like':'%'+_0x17339c[_0xb996('0x80')][_0xb996('0x4')]+'%'};return _0x2e1f25;}})});}var _0x359575=[];var _0x1cc63c=null;var _0x397efa={};if(_0x197f5d){_0x1cc63c=_['find'](_0xe87808,['name',_0x197f5d['name']]);if(_0x1cc63c[_0xb996('0x5')]){_0x397efa={};if(_0xaca021['childModel']===_0xb996('0x10')){_0x397efa[_0x1cc63c['foreignKey']]=_[_0xb996('0x8')](_0x197f5d['associatedResources'],'id');}else{_0x397efa[_0x1cc63c[_0xb996('0x9d')]]=_0x197f5d['associatedResources'];}_0x359575[_0xb996('0x8e')](_0x397efa);}else{_0x506a8f[_0xb996('0x7e')]['id']=_0x197f5d['associatedResources'];}}else{for(var _0x197cc2=0x0;_0x197cc2<_0x3daa2f['length'];_0x197cc2++){_0x1cc63c=_[_0xb996('0x8c')](_0xe87808,['name',_0x3daa2f[_0x197cc2][_0xb996('0xd')]]);if(_0x1cc63c[_0xb996('0x5')]){_0x397efa={};_0x397efa[_0x1cc63c[_0xb996('0x9d')]]=_0x3daa2f[_0x197cc2][_0xb996('0xc')];_0x359575[_0xb996('0x8e')](_0x397efa);}else{if(!_0x506a8f[_0xb996('0x7e')]['id'])_0x506a8f[_0xb996('0x7e')]['id']=[];_0x3daa2f[_0x197cc2][_0xb996('0xc')]['forEach'](function(_0x4ee160){_0x506a8f[_0xb996('0x7e')]['id'][_0xb996('0x8e')](_0x4ee160);});}}}if(!_[_0xb996('0x87')](_0x359575)){_0x506a8f['where']=_[_0xb996('0x9a')](_0x506a8f[_0xb996('0x7e')],{'$and':{'$or':_0x359575}});}_0x506a8f=_[_0xb996('0x9a')]({},_0x506a8f,_0x17339c[_0xb996('0x9e')]);if(_0x197f5d&&!_0x197f5d[_0xb996('0x9f')]&&_0xaca021['childModel']===_0xb996('0x10')){if(_0x17339c[_0xb996('0x80')][_0xb996('0xa0')]){_0x506a8f[_0xb996('0xa1')]=[{'all':!![]}];}return _0xb07dc8[_0xaca021[_0xb996('0x15')]][_0xb996('0xb')](_0x506a8f)['then'](function(_0x2a80ac){var _0x23dd68=[];_0x2a80ac[_0xb996('0xa2')](function(_0x163f95){var _0x5d6127;switch(_0x163f95[_0xb996('0xa3')]){case _0xb996('0xa4'):_0x5d6127=_[_0xb996('0x8c')](_0x197f5d['associatedResources'],function(_0x3e4f1f){return _0x3e4f1f['id']===_0x163f95[_0xb996('0xa5')]&&_0x3e4f1f[_0xb996('0x36')]==='DefaultReports';});break;case'custom':_0x5d6127=_[_0xb996('0x8c')](_0x197f5d[_0xb996('0xc')],function(_0x1c1f41){return _0x1c1f41['id']===_0x163f95[_0xb996('0xa5')]&&_0x1c1f41[_0xb996('0x36')]===_0xb996('0xa6');});break;}if(_0x5d6127)_0x23dd68['push'](_0x163f95);});_0x17d1a5[_0xb996('0xa7')]=_0x23dd68[_0xb996('0x88')];_0x17d1a5[_0xb996('0xa8')]=_0x23dd68;return _0x17d1a5;});}else{if(!_[_0xb996('0x87')](_0x17339c[_0xb996('0x80')][_0xb996('0xa9')])){_0x506a8f[_0xb996('0x7e')]['id']=_0x506a8f[_0xb996('0x7e')]['id']?_[_0xb996('0x90')](_0x506a8f[_0xb996('0x7e')]['id'],_0x17339c[_0xb996('0x80')][_0xb996('0xa9')]):_0x17339c[_0xb996('0x80')]['ids'];if(_0x17339c[_0xb996('0x80')]['customSorting']){_0x506a8f[_0xb996('0x96')]=_0x17339c[_0xb996('0x80')]['customSorting'];}}if(_0x17339c['query']['extraQueryConditions']){_0x506a8f['where']=_[_0xb996('0x9a')](_0x506a8f[_0xb996('0x7e')],{'$and':_0x17339c[_0xb996('0x80')][_0xb996('0xaa')]});}return _0xb07dc8[_0xaca021[_0xb996('0x15')]][_0xb996('0xa7')]({'where':_0x506a8f[_0xb996('0x7e')]})[_0xb996('0x7')](function(_0x13a412){_0x17d1a5[_0xb996('0xa7')]=_0x13a412;if(_0x17339c[_0xb996('0x80')]['includeAll']){if(_0xaca021[_0xb996('0x15')]===_0xb996('0x1e')){_0x506a8f[_0xb996('0xa1')]=[{'model':_0xb07dc8[_0xb996('0x6f')],'as':_0xb996('0xab'),'attributes':['id',_0xb996('0xd'),_0xb996('0xac')],'required':_0x17339c[_0xb996('0x80')][_0xb996('0xad')]?!![]:![]},{'model':_0xb07dc8[_0xb996('0x6f')],'as':_0xb996('0xae'),'attributes':['id',_0xb996('0xd'),_0xb996('0xac')],'through':_0x17339c[_0xb996('0x80')][_0xb996('0xad')]?{'attributes':[],'where':{'TagId':_0x17339c['query']['tag']||undefined}}:{},'required':_0x17339c[_0xb996('0x80')][_0xb996('0xad')]?!![]:![]}];}else{_0x506a8f[_0xb996('0xa1')]=[{'all':!![]}];}}return _0xb07dc8[_0xaca021[_0xb996('0x15')]][_0xb996('0xb')](_0x506a8f);})[_0xb996('0x7')](function(_0x58eb43){_0x17d1a5[_0xb996('0xa8')]=_0x58eb43;if(_0x50c754===_0xb996('0x2e')&&_0x17339c[_0xb996('0x80')][_0xb996('0xaf')]===_0xb996('0xb0')){var _0x39f43e=[];for(var _0x46b8f8=0x0;_0x46b8f8<_0x17d1a5['rows'][_0xb996('0x88')];_0x46b8f8++){_0x39f43e['push'](_0x43cc9f('chat',_0x17d1a5[_0xb996('0xa8')][_0x46b8f8][_0xb996('0xb1')]));_0x39f43e['push'](_0x43cc9f('sms',_0x17d1a5[_0xb996('0xa8')][_0x46b8f8][_0xb996('0xb1')]));_0x39f43e['push'](_0x43cc9f(_0xb996('0xb2'),_0x17d1a5[_0xb996('0xa8')][_0x46b8f8]['dataValues']));_0x39f43e['push'](_0x43cc9f(_0xb996('0xb3'),_0x17d1a5[_0xb996('0xa8')][_0x46b8f8]['dataValues']));_0x39f43e['push'](_0x43cc9f(_0xb996('0xb4'),_0x17d1a5[_0xb996('0xa8')][_0x46b8f8][_0xb996('0xb1')]));_0x39f43e[_0xb996('0x8e')](_0x43cc9f(_0xb996('0xb5'),_0x17d1a5[_0xb996('0xa8')][_0x46b8f8][_0xb996('0xb1')]));}return Promise[_0xb996('0x8a')](_0x39f43e)['then'](function(){return _0x17d1a5;});}return _0x17d1a5;});}});}}});}; \ No newline at end of file +var _0x0109=['SalesforceAccount','FreshdeskAccount','deskaccounts','zohoaccounts','ZohoAccount','vtigeraccounts','CannedAnswer','dispositions','Disposition','customdashboards','Dashboard','intervals','Interval','pauses','scheduler','Schedule','sounds','tags','Tag','templates','Template','Trigger','trunks','Trunk','variables','plugins','Plugin','extractedreports','AnalyticExtractedReport','Reports','reportId','metrics','slice','Sequelize','QueryTypes','SELECT','ui.','InteractionId','ui.createdAt','from','where','ui.UserId\x20=\x20?','sequelize','toString','OpenTabs','define','UserProfile','user_profiles','query','section','mergeResources','Invalid\x20section\x20\x27','isEmpty','push','UserProfileSection','params','all','ignore','union','find','autoAssociation','length','rawAttributes','keys','fields','attributes','hasOwnProperty','limit','offset','sort','pick','filters','key','VIRTUAL','foreignKey','forEach','merge','options','includeAll','reportType','DefaultReports','custom','CustomReports','rows','ids','intersection','customSorting','order','extraQueryConditions','count','CmContact','include','Tags','color','tag','chat','dataValues','sms','openchannel','whatsapp','./userProfile.attributes','../../components/parsers/qs','exports','filter','field','value','findAll','then','associatedResources','map','catch','model','resolve','resourceId','toLowerCase','squareprojects','SquareProject','odbc','SquareOdbc','squarerecordings','childModel','name','projectName','JscriptyProject','contacts','parentSections','Lists','ListId','lists','CmCompany','globalcustomfields','CmCustomField','chatqueues','ChatQueue','chatwebsites','ChatWebsite','faxqueues','FaxAccount','internalroutes','VoiceExtension','contexts','VoiceContext','voicemails','VoiceMail','voicerecordings','VoiceRecording','Agents','membername','User','role','agent','VoiceQueues','queue','VoiceQueue','type','inbound','QueueCampaigns','outbound','musiconholds','VoiceMusicOnHold','chanspies','VoiceChanSpy','voiceprefixes','VoicePrefix','Campaign','mailqueues','mailaccounts','mailsubstatuses','openchannelqueues','OpenchannelQueue','openchannelaccounts','smsaccounts','whatsappqueues','WhatsappQueue','whatsappaccounts','teams','queuecampaigns','users','agents','telephones','Users','admin','user','Telephones','ZendeskAccount','salesforceaccounts'];(function(_0x171fdc,_0x16ae91){var _0x3782ea=function(_0x58b691){while(--_0x58b691){_0x171fdc['push'](_0x171fdc['shift']());}};_0x3782ea(++_0x16ae91);}(_0x0109,0x64));var _0x9010=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x0109[_0x1035c1];return _0x308d67;};'use strict';var _=require('lodash');var attributes=require(_0x9010('0x0'));var qs=require(_0x9010('0x1'));var squel=require('squel');module[_0x9010('0x2')]=function(_0x558360){var _0x2e97fb=_0x558360['models'];function _0x53d9ae(_0xbb66e7,_0x510673){return new Promise(function(_0xa7a7a3,_0x13f23e){if(!_0x510673)return _0xa7a7a3(null);var _0x47951b=_0x510673[_0x9010('0x3')]?{[_0x510673[_0x9010('0x3')][_0x9010('0x4')]]:_0x510673['filter'][_0x9010('0x5')]}:undefined;return _0x2e97fb[_0xbb66e7][_0x9010('0x6')]({'where':_0x47951b,'raw':!![]})[_0x9010('0x7')](function(_0x55afe6){_0x510673[_0x9010('0x8')]=_[_0x9010('0x9')](_0x55afe6,'id');_0xa7a7a3(_0x510673);})[_0x9010('0xa')](function(_0xaa17a){_0x13f23e(_0xaa17a);});});}function _0x48104c(_0x5a2282,_0x453044){return new Promise(function(_0x4d810b,_0x2061f1){var _0x1880e8=_0x5a2282['filter']?{[_0x5a2282[_0x9010('0x3')][_0x9010('0x4')]]:_0x5a2282[_0x9010('0x3')][_0x9010('0x5')]}:undefined;return _0x2e97fb[_0x5a2282[_0x9010('0xb')]][_0x9010('0x6')]({'where':_0x1880e8,'raw':!![]})[_0x9010('0x7')](function(_0x269652){_0x453044['associatedResources']=_[_0x9010('0x9')](_0x269652,function(_0x5cfec7){return _0x5cfec7['name'];});_0x4d810b(_0x453044);})[_0x9010('0xa')](function(_0x41542a){_0x2061f1(_0x41542a);});});}function _0x2f3745(_0x5246c5,_0x54b545,_0x16aa60){if(!_0x54b545)return Promise[_0x9010('0xc')](null);return new Promise(function(_0x582df1,_0x4fa859){return _0x2e97fb['UserProfileResource']['findAll']({'where':{'sectionId':_0x54b545['id']},'raw':!![]})[_0x9010('0x7')](function(_0x370104){if(_0x5246c5[_0x9010('0x4')]&&_0x5246c5['field']!=='id'){_0x54b545[_0x9010('0x8')]=_[_0x9010('0x9')](_0x370104,function(_0x4a4aaf){return _0x4a4aaf[_0x5246c5[_0x9010('0x4')]];});}else{if(_0x16aa60==='AnalyticExtractedReport'){_0x54b545[_0x9010('0x8')]=_['map'](_0x370104,function(_0x279627){return{'id':_0x279627[_0x9010('0xd')],'type':_0x279627['type']};});}else{_0x54b545[_0x9010('0x8')]=_[_0x9010('0x9')](_0x370104,function(_0x5682d8){return _0x5682d8[_0x9010('0xd')];});}}_0x582df1(_0x54b545);})[_0x9010('0xa')](function(_0x3ba9a2){_0x4fa859(_0x3ba9a2);});});}function _0x43206c(_0x459a62,_0x24de18){var _0x5f0da9={'parentSections':[]};switch(_0x459a62[_0x9010('0xe')]()){case _0x9010('0xf'):_0x5f0da9['childModel']=_0x9010('0x10');break;case _0x9010('0x11'):_0x5f0da9['childModel']=_0x9010('0x12');break;case _0x9010('0x13'):_0x5f0da9[_0x9010('0x14')]='SquareRecording';_0x5f0da9['parentSections']=[{'name':'SquareProjects','field':_0x9010('0x15'),'foreignKey':_0x9010('0x16')}];break;case'projects':_0x5f0da9[_0x9010('0x14')]=_0x9010('0x17');break;case _0x9010('0x18'):_0x5f0da9[_0x9010('0x14')]='CmContact';_0x5f0da9[_0x9010('0x19')]=[{'name':_0x9010('0x1a'),'field':'id','foreignKey':_0x9010('0x1b')}];break;case _0x9010('0x1c'):_0x5f0da9[_0x9010('0x14')]='CmList';break;case'companies':_0x5f0da9['childModel']=_0x9010('0x1d');break;case _0x9010('0x1e'):_0x5f0da9['childModel']=_0x9010('0x1f');break;case _0x9010('0x20'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x21');break;case _0x9010('0x22'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x23');break;case _0x9010('0x24'):_0x5f0da9['childModel']='FaxQueue';break;case'faxaccounts':_0x5f0da9[_0x9010('0x14')]=_0x9010('0x25');break;case'inboundroutes':case _0x9010('0x26'):case'outboundroutes':_0x5f0da9[_0x9010('0x14')]=_0x9010('0x27');break;case _0x9010('0x28'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x29');break;case _0x9010('0x2a'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x2b');break;case _0x9010('0x2c'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x2d');_0x5f0da9[_0x9010('0x19')]=[{'name':_0x9010('0x2e'),'field':_0x9010('0x15'),'foreignKey':_0x9010('0x2f'),'model':_0x9010('0x30'),'filter':{'field':_0x9010('0x31'),'value':[_0x9010('0x32')]}},{'name':'Telephones','field':_0x9010('0x15'),'foreignKey':_0x9010('0x2f'),'model':_0x9010('0x30'),'filter':{'field':_0x9010('0x31'),'value':['telephone']}},{'name':_0x9010('0x33'),'field':'name','foreignKey':_0x9010('0x34'),'model':_0x9010('0x35'),'filter':{'field':_0x9010('0x36'),'value':[_0x9010('0x37')]}},{'name':_0x9010('0x38'),'field':_0x9010('0x15'),'foreignKey':_0x9010('0x34'),'model':_0x9010('0x35'),'filter':{'field':_0x9010('0x36'),'value':[_0x9010('0x39')]}}];break;case _0x9010('0x3a'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x3b');break;case _0x9010('0x3c'):_0x5f0da9['childModel']=_0x9010('0x3d');break;case _0x9010('0x3e'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x3f');break;case'ivrcampaigns':_0x5f0da9['childModel']=_0x9010('0x40');break;case _0x9010('0x41'):_0x5f0da9[_0x9010('0x14')]='MailQueue';break;case _0x9010('0x42'):_0x5f0da9[_0x9010('0x14')]='MailAccount';break;case _0x9010('0x43'):_0x5f0da9[_0x9010('0x14')]='MailSubstatus';break;case _0x9010('0x44'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x45');break;case _0x9010('0x46'):_0x5f0da9[_0x9010('0x14')]='OpenchannelAccount';break;case'smsqueues':_0x5f0da9[_0x9010('0x14')]='SmsQueue';break;case _0x9010('0x47'):_0x5f0da9[_0x9010('0x14')]='SmsAccount';break;case _0x9010('0x48'):_0x5f0da9['childModel']=_0x9010('0x49');break;case _0x9010('0x4a'):_0x5f0da9['childModel']='WhatsappAccount';break;case _0x9010('0x4b'):_0x5f0da9[_0x9010('0x14')]='Team';break;case'voicequeues':case _0x9010('0x4c'):_0x5f0da9[_0x9010('0x14')]='VoiceQueue';if(_0x24de18){_0x5f0da9[_0x9010('0x19')]=[{'name':_0x9010('0x33')},{'name':_0x9010('0x38')}];}break;case _0x9010('0x4d'):case _0x9010('0x4e'):case _0x9010('0x4f'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x30');if(_0x24de18){_0x5f0da9[_0x9010('0x19')]=[{'name':_0x9010('0x50'),'filter':{'field':_0x9010('0x31'),'value':[_0x9010('0x51'),_0x9010('0x52')]},'ignore':!![]},{'name':_0x9010('0x2e')},{'name':_0x9010('0x53')}];}break;case'zendeskaccounts':_0x5f0da9['childModel']=_0x9010('0x54');break;case _0x9010('0x55'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x56');break;case'freshdeskaccounts':_0x5f0da9[_0x9010('0x14')]=_0x9010('0x57');break;case'sugarcrmaccounts':_0x5f0da9[_0x9010('0x14')]='SugarcrmAccount';break;case _0x9010('0x58'):_0x5f0da9[_0x9010('0x14')]='DeskAccount';break;case _0x9010('0x59'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x5a');break;case _0x9010('0x5b'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x30');break;case'cannedanswers':_0x5f0da9[_0x9010('0x14')]=_0x9010('0x5c');break;case _0x9010('0x5d'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x5e');break;case _0x9010('0x5f'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x60');break;case _0x9010('0x61'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x62');break;case _0x9010('0x63'):_0x5f0da9['childModel']='Pause';break;case _0x9010('0x64'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x65');break;case _0x9010('0x66'):_0x5f0da9['childModel']='Sound';break;case _0x9010('0x67'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x68');break;case _0x9010('0x69'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x6a');break;case'triggers':_0x5f0da9['childModel']=_0x9010('0x6b');break;case _0x9010('0x6c'):_0x5f0da9['childModel']=_0x9010('0x6d');break;case _0x9010('0x6e'):_0x5f0da9[_0x9010('0x14')]='Variable';break;case _0x9010('0x6f'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x70');break;case _0x9010('0x71'):_0x5f0da9[_0x9010('0x14')]=_0x9010('0x72');_0x5f0da9[_0x9010('0x19')]=[{'name':_0x9010('0x73'),'field':'id','foreignKey':_0x9010('0x74')}];break;case _0x9010('0x75'):_0x5f0da9[_0x9010('0x14')]='AnalyticMetric';break;}return _0x5f0da9;}function _0xc67e3e(_0x1fce14,_0xc6bca1){var _0xcdb2a8=_0x1fce14['charAt'](0x0)['toUpperCase']()+_0x1fce14[_0x9010('0x76')](0x1);var _0x1deb78={'type':_0x2e97fb[_0x9010('0x77')][_0x9010('0x78')][_0x9010('0x79')],'raw':!![]};return new Promise(function(_0x45b8ad,_0x64060e){var _0x19dd6e=squel['select']()['field'](_0x9010('0x7a')+_0xcdb2a8+_0x9010('0x7b'),'id')[_0x9010('0x4')](_0x9010('0x7c'))[_0x9010('0x7d')]('user_has_'+_0x1fce14+'_interactions','ui')[_0x9010('0x7e')](_0x9010('0x7f'),_0xc6bca1['id']);return _0x2e97fb[_0x9010('0x80')]['query'](_0x19dd6e[_0x9010('0x81')](),_0x1deb78)['then'](function(_0x24bb86){_0xc6bca1[_0xcdb2a8+_0x9010('0x82')]=_0x24bb86;_0x45b8ad(_0x24bb86);})[_0x9010('0xa')](function(_0x45c5cb){_0x64060e(_0x45c5cb);});});}return _0x558360[_0x9010('0x83')](_0x9010('0x84'),attributes,{'tableName':_0x9010('0x85'),'paranoid':![],'indexes':[],'timestamps':!![],'classMethods':{'getResources':function(_0x5237ee){var _0x3d27a9={'raw':_0x5237ee[_0x9010('0x86')]['raw'],'where':{}};var _0x2d1943={};var _0x76980c={'count':0x0,'rows':[]};var _0x57585c=_0x5237ee[_0x9010('0x86')][_0x9010('0x87')];var _0x3efec4=_0x5237ee[_0x9010('0x86')][_0x9010('0x88')]||![];var _0x48ea93=_0x43206c(_0x57585c,_0x3efec4);if(!_0x48ea93[_0x9010('0x14')])throw new Error(_0x9010('0x89')+_0x57585c+'\x27');var _0x7efb9=[{'name':_0x57585c}];if(!_[_0x9010('0x8a')](_0x48ea93[_0x9010('0x19')]))_0x7efb9=_0x48ea93[_0x9010('0x19')];var _0x1aee44=[];for(var _0x2da46c=0x0;_0x2da46c<_0x7efb9['length'];_0x2da46c++){_0x1aee44[_0x9010('0x8b')](_0x2e97fb[_0x9010('0x8c')]['find']({'where':{'userProfileId':_0x5237ee[_0x9010('0x8d')]['id'],'name':_0x7efb9[_0x2da46c]['name']},'raw':!![]}));}return Promise[_0x9010('0x8e')](_0x1aee44)['then'](function(_0x136bfe){var _0x56d66d=_[_0x9010('0x3')](_0x136bfe,function(_0x1d0d7c){return _0x1d0d7c?_0x1d0d7c:undefined;});var _0x9720cf=_['filter'](_0x7efb9,[_0x9010('0x8f'),!![]]);var _0x4fa746=_[_0x9010('0x8a')](_0x56d66d)&&_[_0x9010('0x8a')](_0x9720cf)?null:_[_0x9010('0x90')](_0x9720cf,_0x56d66d);if(!_0x4fa746)return null;var _0x170f72=[];for(var _0x39f3eb=0x0;_0x39f3eb<_0x4fa746['length'];_0x39f3eb++){var _0x136b59=_[_0x9010('0x91')](_0x7efb9,function(_0x54f12b){return _0x4fa746[_0x39f3eb]?_0x54f12b[_0x9010('0x15')]===_0x4fa746[_0x39f3eb]['name']:null;});if(_0x136b59){if(_0x4fa746[_0x39f3eb]['ignore']){_0x170f72[_0x9010('0x8b')](_0x53d9ae(_0x48ea93['childModel'],_0x4fa746[_0x39f3eb]));}else{if(!_0x4fa746[_0x39f3eb][_0x9010('0x92')]){_0x170f72[_0x9010('0x8b')](_0x2f3745(_0x136b59,_0x4fa746[_0x39f3eb],_0x48ea93[_0x9010('0x14')]));}else{if(_0x136b59['model']){_0x170f72[_0x9010('0x8b')](_0x48104c(_0x136b59,_0x4fa746[_0x39f3eb]));}}}}}return Promise[_0x9010('0x8e')](_0x170f72);})[_0x9010('0x7')](function(_0x132c53){var _0x1fd60f=_0x132c53;var _0x44a1ae=null;if(_0x1fd60f){_0x44a1ae=_0x1fd60f[_0x9010('0x93')]===0x1?_0x1fd60f[0x0]:null;}if(!_0x44a1ae&&!_0x1fd60f)return _0x76980c;var _0xb604a0=_0x2e97fb[_0x48ea93[_0x9010('0x14')]][_0x9010('0x94')];_0x2d1943[_0x9010('0xb')]=_[_0x9010('0x95')](_0xb604a0);_0x2d1943[_0x9010('0x86')]=_[_0x9010('0x95')](_0x5237ee[_0x9010('0x86')]);_0x2d1943['filters']=_['intersection'](_0x2d1943[_0x9010('0xb')],_0x2d1943['query']);_0x3d27a9['attributes']=_['intersection'](_0x2d1943['model'],qs[_0x9010('0x96')](_0x5237ee[_0x9010('0x86')][_0x9010('0x96')]));_0x3d27a9['attributes']=_0x3d27a9[_0x9010('0x97')]['length']?_0x3d27a9[_0x9010('0x97')]:_0x2d1943['model'];if(!_0x5237ee[_0x9010('0x86')][_0x9010('0x98')]('nolimit')){_0x3d27a9[_0x9010('0x99')]=qs[_0x9010('0x99')](_0x5237ee[_0x9010('0x86')][_0x9010('0x99')]);_0x3d27a9[_0x9010('0x9a')]=qs[_0x9010('0x9a')](_0x5237ee['query'][_0x9010('0x9a')]);}_0x3d27a9['order']=qs[_0x9010('0x9b')](_0x5237ee[_0x9010('0x86')][_0x9010('0x9b')]);_0x3d27a9[_0x9010('0x7e')]=qs['filters'](_[_0x9010('0x9c')](_0x5237ee[_0x9010('0x86')],_0x2d1943[_0x9010('0x9d')]));if(_0x5237ee['query']['filter']){_0x3d27a9['where']=_['merge'](_0x3d27a9[_0x9010('0x7e')],{'$or':_[_0x9010('0x9')](_0xb604a0,function(_0xe04411){if(_0xe04411[_0x9010('0x36')][_0x9010('0x9e')]!==_0x9010('0x9f')){var _0x14d8b2={};_0x14d8b2[_0xe04411[_0x9010('0x4')]]={'$like':'%'+_0x5237ee[_0x9010('0x86')][_0x9010('0x3')]+'%'};return _0x14d8b2;}})});}var _0x192516=[];var _0x4d74b5=null;var _0x2c5563={};if(_0x44a1ae){_0x4d74b5=_['find'](_0x7efb9,[_0x9010('0x15'),_0x44a1ae[_0x9010('0x15')]]);if(_0x4d74b5[_0x9010('0x4')]){_0x2c5563={};if(_0x48ea93[_0x9010('0x14')]===_0x9010('0x72')){_0x2c5563[_0x4d74b5[_0x9010('0xa0')]]=_[_0x9010('0x9')](_0x44a1ae[_0x9010('0x8')],'id');}else{_0x2c5563[_0x4d74b5[_0x9010('0xa0')]]=_0x44a1ae[_0x9010('0x8')];}_0x192516[_0x9010('0x8b')](_0x2c5563);}else{_0x3d27a9[_0x9010('0x7e')]['id']=_0x44a1ae[_0x9010('0x8')];}}else{for(var _0x59893d=0x0;_0x59893d<_0x1fd60f['length'];_0x59893d++){_0x4d74b5=_[_0x9010('0x91')](_0x7efb9,['name',_0x1fd60f[_0x59893d][_0x9010('0x15')]]);if(_0x4d74b5['field']){_0x2c5563={};_0x2c5563[_0x4d74b5[_0x9010('0xa0')]]=_0x1fd60f[_0x59893d][_0x9010('0x8')];_0x192516['push'](_0x2c5563);}else{if(!_0x3d27a9[_0x9010('0x7e')]['id'])_0x3d27a9['where']['id']=[];_0x1fd60f[_0x59893d]['associatedResources'][_0x9010('0xa1')](function(_0x4e0120){_0x3d27a9[_0x9010('0x7e')]['id'][_0x9010('0x8b')](_0x4e0120);});}}}if(!_[_0x9010('0x8a')](_0x192516)){_0x3d27a9[_0x9010('0x7e')]=_[_0x9010('0xa2')](_0x3d27a9[_0x9010('0x7e')],{'$and':{'$or':_0x192516}});}_0x3d27a9=_[_0x9010('0xa2')]({},_0x3d27a9,_0x5237ee[_0x9010('0xa3')]);if(_0x44a1ae&&!_0x44a1ae['autoAssociation']&&_0x48ea93[_0x9010('0x14')]===_0x9010('0x72')){if(_0x5237ee[_0x9010('0x86')][_0x9010('0xa4')]){_0x3d27a9['include']=[{'all':!![]}];}return _0x2e97fb[_0x48ea93[_0x9010('0x14')]][_0x9010('0x6')](_0x3d27a9)[_0x9010('0x7')](function(_0x38defc){var _0x170066=[];_0x38defc[_0x9010('0xa1')](function(_0x447b7d){var _0x40374b;switch(_0x447b7d[_0x9010('0xa5')]){case'default':_0x40374b=_[_0x9010('0x91')](_0x44a1ae[_0x9010('0x8')],function(_0x3e5652){return _0x3e5652['id']===_0x447b7d['reportId']&&_0x3e5652[_0x9010('0x36')]===_0x9010('0xa6');});break;case _0x9010('0xa7'):_0x40374b=_[_0x9010('0x91')](_0x44a1ae['associatedResources'],function(_0x40878a){return _0x40878a['id']===_0x447b7d[_0x9010('0x74')]&&_0x40878a[_0x9010('0x36')]===_0x9010('0xa8');});break;}if(_0x40374b)_0x170066[_0x9010('0x8b')](_0x447b7d);});_0x76980c['count']=_0x170066[_0x9010('0x93')];_0x76980c[_0x9010('0xa9')]=_0x170066;return _0x76980c;});}else{if(!_[_0x9010('0x8a')](_0x5237ee[_0x9010('0x86')][_0x9010('0xaa')])){_0x3d27a9['where']['id']=_0x3d27a9[_0x9010('0x7e')]['id']?_[_0x9010('0xab')](_0x3d27a9['where']['id'],_0x5237ee[_0x9010('0x86')][_0x9010('0xaa')]):_0x5237ee['query']['ids'];if(_0x5237ee[_0x9010('0x86')][_0x9010('0xac')]){_0x3d27a9[_0x9010('0xad')]=_0x5237ee[_0x9010('0x86')]['customSorting'];}}if(_0x5237ee[_0x9010('0x86')]['extraQueryConditions']){_0x3d27a9[_0x9010('0x7e')]=_['merge'](_0x3d27a9[_0x9010('0x7e')],{'$and':_0x5237ee[_0x9010('0x86')][_0x9010('0xae')]});}return _0x2e97fb[_0x48ea93[_0x9010('0x14')]][_0x9010('0xaf')]({'where':_0x3d27a9[_0x9010('0x7e')]})[_0x9010('0x7')](function(_0x413d72){_0x76980c['count']=_0x413d72;if(_0x5237ee[_0x9010('0x86')][_0x9010('0xa4')]){if(_0x48ea93['childModel']===_0x9010('0xb0')){_0x3d27a9[_0x9010('0xb1')]=[{'model':_0x2e97fb[_0x9010('0x68')],'as':_0x9010('0xb2'),'attributes':['id','name',_0x9010('0xb3')],'required':_0x5237ee['query'][_0x9010('0xb4')]?!![]:![]},{'model':_0x2e97fb['Tag'],'as':'ThroughTags','attributes':['id',_0x9010('0x15'),'color'],'through':_0x5237ee[_0x9010('0x86')]['tag']?{'attributes':[],'where':{'TagId':_0x5237ee['query']['tag']||undefined}}:{},'required':_0x5237ee[_0x9010('0x86')][_0x9010('0xb4')]?!![]:![]}];}else{_0x3d27a9['include']=[{'all':!![]}];}}return _0x2e97fb[_0x48ea93['childModel']][_0x9010('0x6')](_0x3d27a9);})['then'](function(_0x2e3710){_0x76980c[_0x9010('0xa9')]=_0x2e3710;if(_0x57585c===_0x9010('0x2e')&&_0x5237ee[_0x9010('0x86')]['openTabs']==='true'){var _0x63ad46=[];for(var _0x1c72de=0x0;_0x1c72de<_0x76980c[_0x9010('0xa9')][_0x9010('0x93')];_0x1c72de++){_0x63ad46[_0x9010('0x8b')](_0xc67e3e(_0x9010('0xb5'),_0x76980c[_0x9010('0xa9')][_0x1c72de][_0x9010('0xb6')]));_0x63ad46[_0x9010('0x8b')](_0xc67e3e(_0x9010('0xb7'),_0x76980c['rows'][_0x1c72de]['dataValues']));_0x63ad46[_0x9010('0x8b')](_0xc67e3e('fax',_0x76980c[_0x9010('0xa9')][_0x1c72de][_0x9010('0xb6')]));_0x63ad46[_0x9010('0x8b')](_0xc67e3e('mail',_0x76980c[_0x9010('0xa9')][_0x1c72de][_0x9010('0xb6')]));_0x63ad46[_0x9010('0x8b')](_0xc67e3e(_0x9010('0xb8'),_0x76980c[_0x9010('0xa9')][_0x1c72de][_0x9010('0xb6')]));_0x63ad46['push'](_0xc67e3e(_0x9010('0xb9'),_0x76980c[_0x9010('0xa9')][_0x1c72de][_0x9010('0xb6')]));}return Promise[_0x9010('0x8e')](_0x63ad46)[_0x9010('0x7')](function(){return _0x76980c;});}return _0x76980c;});}});}}});}; \ No newline at end of file diff --git a/server/api/userProfile/userProfile.rpc.js b/server/api/userProfile/userProfile.rpc.js index 0be0f5b..43ff885 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 _0x8561=['../../mysqldb','../../config/logger','../../config/environment','jayson/promise','redis','localhost','then','info','request\x20sent','debug','stringify','error','code','UserProfile,\x20%s,\x20%s','message','result','util','moment','randomstring'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x8561,0x1b2));var _0x1856=function(_0x74115b,_0x31f752){_0x74115b=_0x74115b-0x0;var _0x57ebbd=_0x8561[_0x74115b];return _0x57ebbd;};'use strict';var _=require('lodash');var util=require(_0x1856('0x0'));var moment=require(_0x1856('0x1'));var BPromise=require('bluebird');var rs=require(_0x1856('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1856('0x3'))['db'];var utils=require('../../config/utils');var logger=require(_0x1856('0x4'))('rpc');var config=require(_0x1856('0x5'));var jayson=require(_0x1856('0x6'));var client=jayson['client']['http']({'port':0x232a});config[_0x1856('0x7')]=_['defaults'](config['redis'],{'host':_0x1856('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./userProfile.socket')['register'](socket);function respondWithRpcPromise(_0x1bfad8,_0x3e47b3,_0x510505){return new BPromise(function(_0x55fe85,_0x97f276){return client['request'](_0x1bfad8,_0x510505)[_0x1856('0x9')](function(_0x584a8e){logger[_0x1856('0xa')]('UserProfile,\x20%s,\x20%s',_0x3e47b3,_0x1856('0xb'));logger[_0x1856('0xc')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x3e47b3,_0x1856('0xb'),JSON[_0x1856('0xd')](_0x584a8e));if(_0x584a8e[_0x1856('0xe')]){if(_0x584a8e['error'][_0x1856('0xf')]===0x1f4){logger[_0x1856('0xe')](_0x1856('0x10'),_0x3e47b3,_0x584a8e['error'][_0x1856('0x11')]);return _0x97f276(_0x584a8e[_0x1856('0xe')][_0x1856('0x11')]);}logger[_0x1856('0xe')](_0x1856('0x10'),_0x3e47b3,_0x584a8e[_0x1856('0xe')][_0x1856('0x11')]);return _0x55fe85(_0x584a8e['error']['message']);}else{logger[_0x1856('0xa')]('UserProfile,\x20%s,\x20%s',_0x3e47b3,'request\x20sent');_0x55fe85(_0x584a8e[_0x1856('0x12')][_0x1856('0x11')]);}})['catch'](function(_0x4f5381){logger[_0x1856('0xe')](_0x1856('0x10'),_0x3e47b3,_0x4f5381);_0x97f276(_0x4f5381);});});} \ No newline at end of file +var _0xb96d=['info','result','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','defaults','redis','socket.io-emitter','./userProfile.socket','register','request','then','UserProfile,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message'];(function(_0x1f227d,_0x25af09){var _0x3ca950=function(_0x410c6e){while(--_0x410c6e){_0x1f227d['push'](_0x1f227d['shift']());}};_0x3ca950(++_0x25af09);}(_0xb96d,0x9e));var _0xdb96=function(_0x56740a,_0x568894){_0x56740a=_0x56740a-0x0;var _0x257144=_0xb96d[_0x56740a];return _0x257144;};'use strict';var _=require('lodash');var util=require(_0xdb96('0x0'));var moment=require(_0xdb96('0x1'));var BPromise=require(_0xdb96('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xdb96('0x3'));var db=require(_0xdb96('0x4'))['db'];var utils=require(_0xdb96('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0xdb96('0x6'));var jayson=require(_0xdb96('0x7'));var client=jayson[_0xdb96('0x8')][_0xdb96('0x9')]({'port':0x232a});config['redis']=_[_0xdb96('0xa')](config[_0xdb96('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xdb96('0xc'))(new Redis(config['redis']));require(_0xdb96('0xd'))[_0xdb96('0xe')](socket);function respondWithRpcPromise(_0x4ba693,_0x251d13,_0x446431){return new BPromise(function(_0x58b9ce,_0x220777){return client[_0xdb96('0xf')](_0x4ba693,_0x446431)[_0xdb96('0x10')](function(_0x1d4c0c){logger['info'](_0xdb96('0x11'),_0x251d13,_0xdb96('0x12'));logger[_0xdb96('0x13')]('UserProfile,\x20%s,\x20%s,\x20%s',_0x251d13,_0xdb96('0x12'),JSON[_0xdb96('0x14')](_0x1d4c0c));if(_0x1d4c0c[_0xdb96('0x15')]){if(_0x1d4c0c[_0xdb96('0x15')][_0xdb96('0x16')]===0x1f4){logger[_0xdb96('0x15')](_0xdb96('0x11'),_0x251d13,_0x1d4c0c[_0xdb96('0x15')][_0xdb96('0x17')]);return _0x220777(_0x1d4c0c[_0xdb96('0x15')][_0xdb96('0x17')]);}logger[_0xdb96('0x15')](_0xdb96('0x11'),_0x251d13,_0x1d4c0c['error'][_0xdb96('0x17')]);return _0x58b9ce(_0x1d4c0c[_0xdb96('0x15')][_0xdb96('0x17')]);}else{logger[_0xdb96('0x18')]('UserProfile,\x20%s,\x20%s',_0x251d13,_0xdb96('0x12'));_0x58b9ce(_0x1d4c0c[_0xdb96('0x19')][_0xdb96('0x17')]);}})['catch'](function(_0x4a6747){logger[_0xdb96('0x15')]('UserProfile,\x20%s,\x20%s',_0x251d13,_0x4a6747);_0x220777(_0x4a6747);});});} \ No newline at end of file diff --git a/server/api/userProfile/userProfile.socket.js b/server/api/userProfile/userProfile.socket.js index e1a2ef4..91448de 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 _0x769f=['register','length','update'];(function(_0x366bc2,_0x5eba53){var _0x92310b=function(_0x2b4618){while(--_0x2b4618){_0x366bc2['push'](_0x366bc2['shift']());}};_0x92310b(++_0x5eba53);}(_0x769f,0x14f));var _0xf769=function(_0x2dc46b,_0x110ad5){_0x2dc46b=_0x2dc46b-0x0;var _0x2fae67=_0x769f[_0x2dc46b];return _0x2fae67;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=['save','remove',_0xf769('0x0')];function createListener(_0x5963f6,_0x344c55){return function(_0x21c180){_0x344c55['emit'](_0x5963f6,_0x21c180);};}function removeListener(_0x4e779e,_0x120baa){return function(){UserProfileEvents['removeListener'](_0x4e779e,_0x120baa);};}exports[_0xf769('0x1')]=function(_0x26a243){for(var _0x295b69=0x0,_0x3c65a7=events[_0xf769('0x2')];_0x295b69<_0x3c65a7;_0x295b69++){var _0x2d56e0=events[_0x295b69];var _0x306f56=createListener('userProfile:'+_0x2d56e0,_0x26a243);UserProfileEvents['on'](_0x2d56e0,_0x306f56);}}; \ No newline at end of file +var _0xfdda=['save','remove','update','emit','register','length','userProfile:'];(function(_0x28be21,_0x52b14d){var _0xd5a1f4=function(_0xe29521){while(--_0xe29521){_0x28be21['push'](_0x28be21['shift']());}};_0xd5a1f4(++_0x52b14d);}(_0xfdda,0x11f));var _0xafdd=function(_0x3713e2,_0x381fd6){_0x3713e2=_0x3713e2-0x0;var _0x4e81d8=_0xfdda[_0x3713e2];return _0x4e81d8;};'use strict';var UserProfileEvents=require('./userProfile.events');var events=[_0xafdd('0x0'),_0xafdd('0x1'),_0xafdd('0x2')];function createListener(_0x5c3f20,_0x367c38){return function(_0x16a24a){_0x367c38[_0xafdd('0x3')](_0x5c3f20,_0x16a24a);};}function removeListener(_0x12773b,_0x29fa19){return function(){UserProfileEvents['removeListener'](_0x12773b,_0x29fa19);};}exports[_0xafdd('0x4')]=function(_0x3ff1f){for(var _0x34c1d6=0x0,_0x5cb9ff=events[_0xafdd('0x5')];_0x34c1d6<_0x5cb9ff;_0x34c1d6++){var _0x6c3ec2=events[_0x34c1d6];var _0x29ddad=createListener(_0xafdd('0x6')+_0x6c3ec2,_0x3ff1f);UserProfileEvents['on'](_0x6c3ec2,_0x29ddad);}}; \ No newline at end of file diff --git a/server/api/userProfileResource/index.js b/server/api/userProfileResource/index.js index 69eff60..9103e2f 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 _0x465d=['isAuthenticated','index','/describe','/:id','post','create','update','delete','destroy','multer','util','path','express','fs-extra','../../config/environment','./userProfileResource.controller','get'];(function(_0x96d980,_0x25a9d0){var _0xe021ab=function(_0x55115a){while(--_0x55115a){_0x96d980['push'](_0x96d980['shift']());}};_0xe021ab(++_0x25a9d0);}(_0x465d,0x17f));var _0xd465=function(_0x245772,_0x2c0818){_0x245772=_0x245772-0x0;var _0x1a1c3b=_0x465d[_0x245772];return _0x1a1c3b;};'use strict';var multer=require(_0xd465('0x0'));var util=require(_0xd465('0x1'));var path=require(_0xd465('0x2'));var timeout=require('connect-timeout');var express=require(_0xd465('0x3'));var router=express['Router']();var fs_extra=require(_0xd465('0x4'));var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0xd465('0x5'));var controller=require(_0xd465('0x6'));router[_0xd465('0x7')]('/',auth[_0xd465('0x8')](),controller[_0xd465('0x9')]);router[_0xd465('0x7')](_0xd465('0xa'),auth[_0xd465('0x8')](),controller['describe']);router['get'](_0xd465('0xb'),auth[_0xd465('0x8')](),controller['show']);router[_0xd465('0xc')]('/',auth[_0xd465('0x8')](),controller[_0xd465('0xd')]);router['put'](_0xd465('0xb'),auth[_0xd465('0x8')](),controller[_0xd465('0xe')]);router[_0xd465('0xf')]('/:id',auth[_0xd465('0x8')](),controller[_0xd465('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9a4f=['exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','post','create','put','update','delete','destroy'];(function(_0xb0fe92,_0x147e42){var _0x41787f=function(_0x42ae35){while(--_0x42ae35){_0xb0fe92['push'](_0xb0fe92['shift']());}};_0x41787f(++_0x147e42);}(_0x9a4f,0xe8));var _0xf9a4=function(_0x268111,_0x31c1f9){_0x268111=_0x268111-0x0;var _0x54e72a=_0x9a4f[_0x268111];return _0x54e72a;};'use strict';var multer=require(_0xf9a4('0x0'));var util=require('util');var path=require(_0xf9a4('0x1'));var timeout=require(_0xf9a4('0x2'));var express=require(_0xf9a4('0x3'));var router=express[_0xf9a4('0x4')]();var fs_extra=require(_0xf9a4('0x5'));var auth=require(_0xf9a4('0x6'));var interaction=require(_0xf9a4('0x7'));var config=require(_0xf9a4('0x8'));var controller=require('./userProfileResource.controller');router[_0xf9a4('0x9')]('/',auth[_0xf9a4('0xa')](),controller['index']);router[_0xf9a4('0x9')](_0xf9a4('0xb'),auth[_0xf9a4('0xa')](),controller[_0xf9a4('0xc')]);router[_0xf9a4('0x9')](_0xf9a4('0xd'),auth[_0xf9a4('0xa')](),controller['show']);router[_0xf9a4('0xe')]('/',auth[_0xf9a4('0xa')](),controller[_0xf9a4('0xf')]);router[_0xf9a4('0x10')](_0xf9a4('0xd'),auth[_0xf9a4('0xa')](),controller[_0xf9a4('0x11')]);router[_0xf9a4('0x12')](_0xf9a4('0xd'),auth[_0xf9a4('0xa')](),controller[_0xf9a4('0x13')]);module[_0xf9a4('0x14')]=router; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.attributes.js b/server/api/userProfileResource/userProfileResource.attributes.js index d26ad70..a920d8b 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 _0x48fd=['STRING','sequelize','exports'];(function(_0x47e7cb,_0x4c1b8d){var _0x2a8874=function(_0x36498f){while(--_0x36498f){_0x47e7cb['push'](_0x47e7cb['shift']());}};_0x2a8874(++_0x4c1b8d);}(_0x48fd,0x79));var _0xd48f=function(_0x300975,_0x4a1b1d){_0x300975=_0x300975-0x0;var _0x4a3dc4=_0x48fd[_0x300975];return _0x4a3dc4;};'use strict';var Sequelize=require(_0xd48f('0x0'));module[_0xd48f('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'resourceId':{'type':Sequelize['INTEGER'],'allowNull':![]},'type':{'type':Sequelize[_0xd48f('0x2')],'allowNull':![]}}; \ No newline at end of file +var _0x6d40=['INTEGER','sequelize','exports','STRING'];(function(_0x3c2809,_0x1a285b){var _0x3fe79e=function(_0x51315d){while(--_0x51315d){_0x3c2809['push'](_0x3c2809['shift']());}};_0x3fe79e(++_0x1a285b);}(_0x6d40,0xa1));var _0x06d4=function(_0x70c6c1,_0x335032){_0x70c6c1=_0x70c6c1-0x0;var _0x7af6bc=_0x6d40[_0x70c6c1];return _0x7af6bc;};'use strict';var Sequelize=require(_0x06d4('0x0'));module[_0x06d4('0x1')]={'name':{'type':Sequelize[_0x06d4('0x2')],'allowNull':![]},'resourceId':{'type':Sequelize[_0x06d4('0x3')],'allowNull':![]},'type':{'type':Sequelize['STRING'],'allowNull':![]}}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.controller.js b/server/api/userProfileResource/userProfileResource.controller.js index 54ea76b..5cca698 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 _0x5f2f=['offset','undefined','limit','count','set','Content-Range','apply','reject','save','then','stack','name','send','index','UserProfileResource','rawAttributes','fieldName','type','map','query','filters','intersection','model','attributes','fields','length','hasOwnProperty','nolimit','sort','filter','merge','where','options','includeAll','include','findAll','rows','catch','keys','find','body','params','destroy','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status'];(function(_0x5b740b,_0x381833){var _0x6f8f4e=function(_0x86d068){while(--_0x86d068){_0x5b740b['push'](_0x5b740b['shift']());}};_0x6f8f4e(++_0x381833);}(_0x5f2f,0x73));var _0xf5f2=function(_0xdfdb30,_0x35dba3){_0xdfdb30=_0xdfdb30-0x0;var _0x1cd22d=_0x5f2f[_0xdfdb30];return _0x1cd22d;};'use strict';var emlformat=require(_0xf5f2('0x0'));var rimraf=require(_0xf5f2('0x1'));var zipdir=require(_0xf5f2('0x2'));var jsonpatch=require(_0xf5f2('0x3'));var rp=require(_0xf5f2('0x4'));var moment=require(_0xf5f2('0x5'));var BPromise=require(_0xf5f2('0x6'));var Mustache=require(_0xf5f2('0x7'));var util=require('util');var path=require('path');var sox=require(_0xf5f2('0x8'));var csv=require(_0xf5f2('0x9'));var ejs=require(_0xf5f2('0xa'));var fs=require('fs');var fs_extra=require(_0xf5f2('0xb'));var _=require(_0xf5f2('0xc'));var squel=require(_0xf5f2('0xd'));var crypto=require('crypto');var jsforce=require(_0xf5f2('0xe'));var deskjs=require(_0xf5f2('0xf'));var toCsv=require(_0xf5f2('0x9'));var querystring=require('querystring');var Papa=require(_0xf5f2('0x10'));var Redis=require(_0xf5f2('0x11'));var authService=require(_0xf5f2('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0xf5f2('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf5f2('0x14'));var utils=require(_0xf5f2('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0xf5f2('0x16'));var db=require(_0xf5f2('0x17'))['db'];function respondWithStatusCode(_0x331482,_0x3f2997){_0x3f2997=_0x3f2997||0xcc;return function(_0x59bb6c){if(_0x59bb6c){return _0x331482[_0xf5f2('0x18')](_0x3f2997);}return _0x331482['status'](_0x3f2997)[_0xf5f2('0x19')]();};}function respondWithResult(_0xea612c,_0x269909){_0x269909=_0x269909||0xc8;return function(_0x1c1a5c){if(_0x1c1a5c){return _0xea612c[_0xf5f2('0x1a')](_0x269909)['json'](_0x1c1a5c);}};}function respondWithFilteredResult(_0xafe430,_0x286197){return function(_0x17d656){if(_0x17d656){var _0x1b6dd2=typeof _0x286197[_0xf5f2('0x1b')]===_0xf5f2('0x1c')&&typeof _0x286197[_0xf5f2('0x1d')]===_0xf5f2('0x1c');var _0x11f702=_0x17d656[_0xf5f2('0x1e')];var _0x20fccd=_0x1b6dd2?0x0:_0x286197[_0xf5f2('0x1b')];var _0x4ff59b=_0x1b6dd2?_0x17d656[_0xf5f2('0x1e')]:_0x286197[_0xf5f2('0x1b')]+_0x286197[_0xf5f2('0x1d')];var _0x1bf655;if(_0x4ff59b>=_0x11f702){_0x4ff59b=_0x11f702;_0x1bf655=0xc8;}else{_0x1bf655=0xce;}_0xafe430['status'](_0x1bf655);return _0xafe430[_0xf5f2('0x1f')](_0xf5f2('0x20'),_0x20fccd+'-'+_0x4ff59b+'/'+_0x11f702)['json'](_0x17d656);}return null;};}function patchUpdates(_0x47acfc){return function(_0x2d2805){try{jsonpatch[_0xf5f2('0x21')](_0x2d2805,_0x47acfc,!![]);}catch(_0x4ae323){return BPromise[_0xf5f2('0x22')](_0x4ae323);}return _0x2d2805[_0xf5f2('0x23')]();};}function saveUpdates(_0x39e44a,_0x39c024){return function(_0x36f1cb){if(_0x36f1cb){return _0x36f1cb['update'](_0x39e44a)[_0xf5f2('0x24')](function(_0x4669a6){return _0x4669a6;});}return null;};}function removeEntity(_0x4e8bda,_0x2833fe){return function(_0x287ad5){if(_0x287ad5){return _0x287ad5['destroy']()['then'](function(){_0x4e8bda[_0xf5f2('0x1a')](0xcc)[_0xf5f2('0x19')]();});}};}function handleEntityNotFound(_0x13da6f,_0x1a5bb3){return function(_0xf6c58d){if(!_0xf6c58d){_0x13da6f[_0xf5f2('0x18')](0x194);}return _0xf6c58d;};}function handleError(_0x13a3be,_0x281ec8){_0x281ec8=_0x281ec8||0x1f4;return function(_0x294414){logger['error'](_0x294414[_0xf5f2('0x25')]);if(_0x294414[_0xf5f2('0x26')]){delete _0x294414[_0xf5f2('0x26')];}_0x13a3be[_0xf5f2('0x1a')](_0x281ec8)[_0xf5f2('0x27')](_0x294414);};}exports[_0xf5f2('0x28')]=function(_0x5b6672,_0x53cb96){var _0x22c826={},_0x14c829={},_0x11c771={'count':0x0,'rows':[]};var _0x5027ab=_['map'](db[_0xf5f2('0x29')][_0xf5f2('0x2a')],function(_0x17394a){return{'name':_0x17394a[_0xf5f2('0x2b')],'type':_0x17394a[_0xf5f2('0x2c')]['key']};});_0x14c829['model']=_[_0xf5f2('0x2d')](_0x5027ab,'name');_0x14c829[_0xf5f2('0x2e')]=_['keys'](_0x5b6672[_0xf5f2('0x2e')]);_0x14c829[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],_0x14c829[_0xf5f2('0x2e')]);_0x22c826[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x14c829[_0xf5f2('0x31')],qs['fields'](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x33')]));_0x22c826[_0xf5f2('0x32')]=_0x22c826[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x22c826[_0xf5f2('0x32')]:_0x14c829[_0xf5f2('0x31')];if(!_0x5b6672['query'][_0xf5f2('0x35')](_0xf5f2('0x36'))){_0x22c826['limit']=qs[_0xf5f2('0x1d')](_0x5b6672['query'][_0xf5f2('0x1d')]);_0x22c826[_0xf5f2('0x1b')]=qs[_0xf5f2('0x1b')](_0x5b6672[_0xf5f2('0x2e')]['offset']);}_0x22c826['order']=qs[_0xf5f2('0x37')](_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x37')]);_0x22c826['where']=qs[_0xf5f2('0x2f')](_['pick'](_0x5b6672[_0xf5f2('0x2e')],_0x14c829['filters']),_0x5027ab);if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]){_0x22c826['where']=_[_0xf5f2('0x39')](_0x22c826[_0xf5f2('0x3a')],{'$or':_[_0xf5f2('0x2d')](_0x5027ab,function(_0x35f738){if(_0x35f738['type']!=='VIRTUAL'){var _0x3d328f={};_0x3d328f[_0x35f738[_0xf5f2('0x26')]]={'$like':'%'+_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x38')]+'%'};return _0x3d328f;}})});}_0x22c826=_[_0xf5f2('0x39')]({},_0x22c826,_0x5b6672[_0xf5f2('0x3b')]);var _0x2bc20e={'where':_0x22c826['where']};return db[_0xf5f2('0x29')][_0xf5f2('0x1e')](_0x2bc20e)['then'](function(_0xc6a1ae){_0x11c771[_0xf5f2('0x1e')]=_0xc6a1ae;if(_0x5b6672[_0xf5f2('0x2e')][_0xf5f2('0x3c')]){_0x22c826[_0xf5f2('0x3d')]=[{'all':!![]}];}return db[_0xf5f2('0x29')][_0xf5f2('0x3e')](_0x22c826);})[_0xf5f2('0x24')](function(_0x574f24){_0x11c771[_0xf5f2('0x3f')]=_0x574f24;return _0x11c771;})[_0xf5f2('0x24')](respondWithFilteredResult(_0x53cb96,_0x22c826))[_0xf5f2('0x40')](handleError(_0x53cb96,null));};exports['show']=function(_0x509dbc,_0x59eb00){var _0x76d21b={'raw':![],'where':{'id':_0x509dbc['params']['id']}},_0x2ad13c={};_0x2ad13c[_0xf5f2('0x31')]=_[_0xf5f2('0x41')](db[_0xf5f2('0x29')][_0xf5f2('0x2a')]);_0x2ad13c[_0xf5f2('0x2e')]=_[_0xf5f2('0x41')](_0x509dbc[_0xf5f2('0x2e')]);_0x2ad13c[_0xf5f2('0x2f')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],_0x2ad13c[_0xf5f2('0x2e')]);_0x76d21b[_0xf5f2('0x32')]=_[_0xf5f2('0x30')](_0x2ad13c[_0xf5f2('0x31')],qs['fields'](_0x509dbc[_0xf5f2('0x2e')]['fields']));_0x76d21b[_0xf5f2('0x32')]=_0x76d21b[_0xf5f2('0x32')][_0xf5f2('0x34')]?_0x76d21b[_0xf5f2('0x32')]:_0x2ad13c[_0xf5f2('0x31')];if(_0x509dbc[_0xf5f2('0x2e')]['includeAll']){_0x76d21b[_0xf5f2('0x3d')]=[{'all':!![]}];}_0x76d21b=_[_0xf5f2('0x39')]({},_0x76d21b,_0x509dbc[_0xf5f2('0x3b')]);return db[_0xf5f2('0x29')][_0xf5f2('0x42')](_0x76d21b)[_0xf5f2('0x24')](handleEntityNotFound(_0x59eb00,null))[_0xf5f2('0x24')](respondWithResult(_0x59eb00,null))[_0xf5f2('0x40')](handleError(_0x59eb00,null));};exports['create']=function(_0x35dece,_0x33ec29){return db[_0xf5f2('0x29')]['create'](_0x35dece[_0xf5f2('0x43')],{})[_0xf5f2('0x24')](respondWithResult(_0x33ec29,0xc9))[_0xf5f2('0x40')](handleError(_0x33ec29,null));};exports['update']=function(_0x57a7cb,_0x7bb942){if(_0x57a7cb[_0xf5f2('0x43')]['id']){delete _0x57a7cb['body']['id'];}return db[_0xf5f2('0x29')]['find']({'where':{'id':_0x57a7cb[_0xf5f2('0x44')]['id']}})['then'](handleEntityNotFound(_0x7bb942,null))[_0xf5f2('0x24')](saveUpdates(_0x57a7cb['body'],null))[_0xf5f2('0x24')](respondWithResult(_0x7bb942,null))[_0xf5f2('0x40')](handleError(_0x7bb942,null));};exports[_0xf5f2('0x45')]=function(_0x11a083,_0x4fa738){return db[_0xf5f2('0x29')][_0xf5f2('0x42')]({'where':{'id':_0x11a083['params']['id']}})['then'](handleEntityNotFound(_0x4fa738,null))[_0xf5f2('0x24')](removeEntity(_0x4fa738,null))[_0xf5f2('0x40')](handleError(_0x4fa738,null));};exports['describe']=function(_0x22b645,_0xe0ce7f){return db[_0xf5f2('0x29')][_0xf5f2('0x46')]()['then'](respondWithResult(_0xe0ce7f,null))['catch'](handleError(_0xe0ce7f,null));}; \ No newline at end of file +var _0xadb5=['intersection','attributes','fields','hasOwnProperty','nolimit','sort','where','pick','filters','filter','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','create','body','find','describe','rimraf','fast-json-patch','request-promise','moment','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/utils','../../config/license/util','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','end','stack','name','send','index','map','UserProfileResource','fieldName','type','key','model','query','keys'];(function(_0x411c2e,_0x4ece66){var _0x5ed361=function(_0x193b6c){while(--_0x193b6c){_0x411c2e['push'](_0x411c2e['shift']());}};_0x5ed361(++_0x4ece66);}(_0xadb5,0xad));var _0x5adb=function(_0x4d9991,_0x4d1d14){_0x4d9991=_0x4d9991-0x0;var _0x40b17d=_0xadb5[_0x4d9991];return _0x40b17d;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x5adb('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x5adb('0x1'));var rp=require(_0x5adb('0x2'));var moment=require(_0x5adb('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x5adb('0x4'));var util=require(_0x5adb('0x5'));var path=require(_0x5adb('0x6'));var sox=require('sox');var csv=require(_0x5adb('0x7'));var ejs=require(_0x5adb('0x8'));var fs=require('fs');var fs_extra=require(_0x5adb('0x9'));var _=require(_0x5adb('0xa'));var squel=require(_0x5adb('0xb'));var crypto=require(_0x5adb('0xc'));var jsforce=require(_0x5adb('0xd'));var deskjs=require(_0x5adb('0xe'));var toCsv=require(_0x5adb('0x7'));var querystring=require(_0x5adb('0xf'));var Papa=require(_0x5adb('0x10'));var Redis=require(_0x5adb('0x11'));var authService=require(_0x5adb('0x12'));var qs=require(_0x5adb('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x5adb('0x14'))(_0x5adb('0x15'));var utils=require(_0x5adb('0x16'));var config=require('../../config/environment');var licenseUtil=require(_0x5adb('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2a0b70,_0x5433bf){_0x5433bf=_0x5433bf||0xcc;return function(_0x8cfcc6){if(_0x8cfcc6){return _0x2a0b70[_0x5adb('0x18')](_0x5433bf);}return _0x2a0b70[_0x5adb('0x19')](_0x5433bf)['end']();};}function respondWithResult(_0x2a545b,_0x34af2c){_0x34af2c=_0x34af2c||0xc8;return function(_0xf82f72){if(_0xf82f72){return _0x2a545b['status'](_0x34af2c)[_0x5adb('0x1a')](_0xf82f72);}};}function respondWithFilteredResult(_0x518823,_0x367d82){return function(_0x42a482){if(_0x42a482){var _0x30614e=typeof _0x367d82[_0x5adb('0x1b')]===_0x5adb('0x1c')&&typeof _0x367d82[_0x5adb('0x1d')]===_0x5adb('0x1c');var _0x42f4c6=_0x42a482[_0x5adb('0x1e')];var _0x529b65=_0x30614e?0x0:_0x367d82[_0x5adb('0x1b')];var _0x5de028=_0x30614e?_0x42a482[_0x5adb('0x1e')]:_0x367d82['offset']+_0x367d82[_0x5adb('0x1d')];var _0x50e84f;if(_0x5de028>=_0x42f4c6){_0x5de028=_0x42f4c6;_0x50e84f=0xc8;}else{_0x50e84f=0xce;}_0x518823['status'](_0x50e84f);return _0x518823[_0x5adb('0x1f')](_0x5adb('0x20'),_0x529b65+'-'+_0x5de028+'/'+_0x42f4c6)[_0x5adb('0x1a')](_0x42a482);}return null;};}function patchUpdates(_0x1fd4a7){return function(_0x99bc6c){try{jsonpatch['apply'](_0x99bc6c,_0x1fd4a7,!![]);}catch(_0x3255b3){return BPromise['reject'](_0x3255b3);}return _0x99bc6c['save']();};}function saveUpdates(_0x3754cc,_0x379b33){return function(_0x1a38d3){if(_0x1a38d3){return _0x1a38d3[_0x5adb('0x21')](_0x3754cc)[_0x5adb('0x22')](function(_0x413911){return _0x413911;});}return null;};}function removeEntity(_0xfd9bb9,_0x4ca150){return function(_0x4b1957){if(_0x4b1957){return _0x4b1957[_0x5adb('0x23')]()[_0x5adb('0x22')](function(){_0xfd9bb9[_0x5adb('0x19')](0xcc)[_0x5adb('0x24')]();});}};}function handleEntityNotFound(_0x49f203,_0x2fee18){return function(_0x2e1e63){if(!_0x2e1e63){_0x49f203['sendStatus'](0x194);}return _0x2e1e63;};}function handleError(_0x1feecf,_0x1ded9f){_0x1ded9f=_0x1ded9f||0x1f4;return function(_0x1a0acd){logger['error'](_0x1a0acd[_0x5adb('0x25')]);if(_0x1a0acd[_0x5adb('0x26')]){delete _0x1a0acd[_0x5adb('0x26')];}_0x1feecf[_0x5adb('0x19')](_0x1ded9f)[_0x5adb('0x27')](_0x1a0acd);};}exports[_0x5adb('0x28')]=function(_0x4a5d46,_0x49992e){var _0x5d457e={},_0x39bddd={},_0x1eac55={'count':0x0,'rows':[]};var _0x60a672=_[_0x5adb('0x29')](db[_0x5adb('0x2a')]['rawAttributes'],function(_0x11ec2a){return{'name':_0x11ec2a[_0x5adb('0x2b')],'type':_0x11ec2a[_0x5adb('0x2c')][_0x5adb('0x2d')]};});_0x39bddd[_0x5adb('0x2e')]=_[_0x5adb('0x29')](_0x60a672,_0x5adb('0x26'));_0x39bddd[_0x5adb('0x2f')]=_[_0x5adb('0x30')](_0x4a5d46[_0x5adb('0x2f')]);_0x39bddd['filters']=_[_0x5adb('0x31')](_0x39bddd['model'],_0x39bddd[_0x5adb('0x2f')]);_0x5d457e[_0x5adb('0x32')]=_['intersection'](_0x39bddd[_0x5adb('0x2e')],qs[_0x5adb('0x33')](_0x4a5d46[_0x5adb('0x2f')]['fields']));_0x5d457e[_0x5adb('0x32')]=_0x5d457e[_0x5adb('0x32')]['length']?_0x5d457e['attributes']:_0x39bddd[_0x5adb('0x2e')];if(!_0x4a5d46['query'][_0x5adb('0x34')](_0x5adb('0x35'))){_0x5d457e[_0x5adb('0x1d')]=qs[_0x5adb('0x1d')](_0x4a5d46[_0x5adb('0x2f')]['limit']);_0x5d457e[_0x5adb('0x1b')]=qs[_0x5adb('0x1b')](_0x4a5d46[_0x5adb('0x2f')]['offset']);}_0x5d457e['order']=qs[_0x5adb('0x36')](_0x4a5d46[_0x5adb('0x2f')]['sort']);_0x5d457e[_0x5adb('0x37')]=qs['filters'](_[_0x5adb('0x38')](_0x4a5d46['query'],_0x39bddd[_0x5adb('0x39')]),_0x60a672);if(_0x4a5d46['query'][_0x5adb('0x3a')]){_0x5d457e[_0x5adb('0x37')]=_['merge'](_0x5d457e[_0x5adb('0x37')],{'$or':_['map'](_0x60a672,function(_0xadbe37){if(_0xadbe37[_0x5adb('0x2c')]!==_0x5adb('0x3b')){var _0x50edd1={};_0x50edd1[_0xadbe37[_0x5adb('0x26')]]={'$like':'%'+_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3a')]+'%'};return _0x50edd1;}})});}_0x5d457e=_[_0x5adb('0x3c')]({},_0x5d457e,_0x4a5d46[_0x5adb('0x3d')]);var _0x52d74f={'where':_0x5d457e['where']};return db['UserProfileResource']['count'](_0x52d74f)[_0x5adb('0x22')](function(_0x2fbe14){_0x1eac55[_0x5adb('0x1e')]=_0x2fbe14;if(_0x4a5d46[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0x5d457e[_0x5adb('0x3f')]=[{'all':!![]}];}return db[_0x5adb('0x2a')][_0x5adb('0x40')](_0x5d457e);})['then'](function(_0x53f2c6){_0x1eac55[_0x5adb('0x41')]=_0x53f2c6;return _0x1eac55;})['then'](respondWithFilteredResult(_0x49992e,_0x5d457e))[_0x5adb('0x42')](handleError(_0x49992e,null));};exports[_0x5adb('0x43')]=function(_0x299746,_0x121714){var _0xdfecfd={'raw':![],'where':{'id':_0x299746[_0x5adb('0x44')]['id']}},_0x522ee5={};_0x522ee5[_0x5adb('0x2e')]=_['keys'](db[_0x5adb('0x2a')][_0x5adb('0x45')]);_0x522ee5['query']=_[_0x5adb('0x30')](_0x299746[_0x5adb('0x2f')]);_0x522ee5[_0x5adb('0x39')]=_[_0x5adb('0x31')](_0x522ee5[_0x5adb('0x2e')],_0x522ee5[_0x5adb('0x2f')]);_0xdfecfd[_0x5adb('0x32')]=_['intersection'](_0x522ee5['model'],qs[_0x5adb('0x33')](_0x299746[_0x5adb('0x2f')][_0x5adb('0x33')]));_0xdfecfd[_0x5adb('0x32')]=_0xdfecfd['attributes']['length']?_0xdfecfd[_0x5adb('0x32')]:_0x522ee5[_0x5adb('0x2e')];if(_0x299746[_0x5adb('0x2f')][_0x5adb('0x3e')]){_0xdfecfd[_0x5adb('0x3f')]=[{'all':!![]}];}_0xdfecfd=_['merge']({},_0xdfecfd,_0x299746[_0x5adb('0x3d')]);return db[_0x5adb('0x2a')]['find'](_0xdfecfd)[_0x5adb('0x22')](handleEntityNotFound(_0x121714,null))[_0x5adb('0x22')](respondWithResult(_0x121714,null))[_0x5adb('0x42')](handleError(_0x121714,null));};exports[_0x5adb('0x46')]=function(_0x186bd2,_0x3a5409){return db[_0x5adb('0x2a')][_0x5adb('0x46')](_0x186bd2['body'],{})[_0x5adb('0x22')](respondWithResult(_0x3a5409,0xc9))['catch'](handleError(_0x3a5409,null));};exports['update']=function(_0x5015ee,_0x3cd211){if(_0x5015ee[_0x5adb('0x47')]['id']){delete _0x5015ee[_0x5adb('0x47')]['id'];}return db['UserProfileResource'][_0x5adb('0x48')]({'where':{'id':_0x5015ee['params']['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x3cd211,null))[_0x5adb('0x22')](saveUpdates(_0x5015ee[_0x5adb('0x47')],null))['then'](respondWithResult(_0x3cd211,null))[_0x5adb('0x42')](handleError(_0x3cd211,null));};exports['destroy']=function(_0x22fa54,_0x6dc067){return db['UserProfileResource'][_0x5adb('0x48')]({'where':{'id':_0x22fa54[_0x5adb('0x44')]['id']}})[_0x5adb('0x22')](handleEntityNotFound(_0x6dc067,null))[_0x5adb('0x22')](removeEntity(_0x6dc067,null))[_0x5adb('0x42')](handleError(_0x6dc067,null));};exports['describe']=function(_0x36b847,_0x3a5703){return db[_0x5adb('0x2a')][_0x5adb('0x49')]()['then'](respondWithResult(_0x3a5703,null))[_0x5adb('0x42')](handleError(_0x3a5703,null));}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.model.js b/server/api/userProfileResource/userProfileResource.model.js index 0135d17..0783289 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 _0x083b=['UserProfileResource','user_profile_has_resources','compositeIndex','sectionId','util','moment','path','rimraf','../../config/environment','exports'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x083b,0x144));var _0xb083=function(_0x28d18d,_0x55896b){_0x28d18d=_0x28d18d-0x0;var _0x470640=_0x083b[_0x28d18d];return _0x470640;};'use strict';var _=require('lodash');var util=require(_0xb083('0x0'));var logger=require('../../config/logger')('api');var moment=require(_0xb083('0x1'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0xb083('0x2'));var rimraf=require(_0xb083('0x3'));var config=require(_0xb083('0x4'));var attributes=require('./userProfileResource.attributes');module[_0xb083('0x5')]=function(_0x10da1,_0x1461ad){return _0x10da1['define'](_0xb083('0x6'),attributes,{'tableName':_0xb083('0x7'),'paranoid':![],'indexes':[{'name':_0xb083('0x8'),'fields':['resourceId',_0xb083('0x9')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x3ff1=['../../config/logger','bluebird','request-promise','path','rimraf','./userProfileResource.attributes','exports','UserProfileResource','user_profile_has_resources','compositeIndex','resourceId','sectionId','lodash','util'];(function(_0x2dac0d,_0x3997eb){var _0x1fd306=function(_0x1b189a){while(--_0x1b189a){_0x2dac0d['push'](_0x2dac0d['shift']());}};_0x1fd306(++_0x3997eb);}(_0x3ff1,0xb4));var _0x13ff=function(_0x4cf823,_0x3470cf){_0x4cf823=_0x4cf823-0x0;var _0x2adc5e=_0x3ff1[_0x4cf823];return _0x2adc5e;};'use strict';var _=require(_0x13ff('0x0'));var util=require(_0x13ff('0x1'));var logger=require(_0x13ff('0x2'))('api');var moment=require('moment');var BPromise=require(_0x13ff('0x3'));var rp=require(_0x13ff('0x4'));var fs=require('fs');var path=require(_0x13ff('0x5'));var rimraf=require(_0x13ff('0x6'));var config=require('../../config/environment');var attributes=require(_0x13ff('0x7'));module[_0x13ff('0x8')]=function(_0x36f9c8,_0x18a166){return _0x36f9c8['define'](_0x13ff('0x9'),attributes,{'tableName':_0x13ff('0xa'),'paranoid':![],'indexes':[{'name':_0x13ff('0xb'),'fields':[_0x13ff('0xc'),_0x13ff('0xd')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userProfileResource/userProfileResource.rpc.js b/server/api/userProfileResource/userProfileResource.rpc.js index c26c547..a23ef05 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 _0x0042=['message','info','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','UserProfileResource,\x20%s,\x20%s','request\x20sent','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x55a496,_0x12a0a3){var _0x57fb12=function(_0x865aff){while(--_0x865aff){_0x55a496['push'](_0x55a496['shift']());}};_0x57fb12(++_0x12a0a3);}(_0x0042,0x18b));var _0x2004=function(_0x4dbaad,_0x730318){_0x4dbaad=_0x4dbaad-0x0;var _0x226c72=_0x0042[_0x4dbaad];return _0x226c72;};'use strict';var _=require(_0x2004('0x0'));var util=require(_0x2004('0x1'));var moment=require('moment');var BPromise=require(_0x2004('0x2'));var rs=require(_0x2004('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2004('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2004('0x5'))('rpc');var config=require(_0x2004('0x6'));var jayson=require(_0x2004('0x7'));var client=jayson[_0x2004('0x8')][_0x2004('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x256c8c,_0x1cd9af,_0x580c13){return new BPromise(function(_0x44c3c3,_0x19e601){return client[_0x2004('0xa')](_0x256c8c,_0x580c13)[_0x2004('0xb')](function(_0x428f40){logger['info'](_0x2004('0xc'),_0x1cd9af,_0x2004('0xd'));logger[_0x2004('0xe')](_0x2004('0xf'),_0x1cd9af,'request\x20sent',JSON[_0x2004('0x10')](_0x428f40));if(_0x428f40[_0x2004('0x11')]){if(_0x428f40[_0x2004('0x11')][_0x2004('0x12')]===0x1f4){logger['error'](_0x2004('0xc'),_0x1cd9af,_0x428f40[_0x2004('0x11')][_0x2004('0x13')]);return _0x19e601(_0x428f40[_0x2004('0x11')][_0x2004('0x13')]);}logger[_0x2004('0x11')]('UserProfileResource,\x20%s,\x20%s',_0x1cd9af,_0x428f40['error']['message']);return _0x44c3c3(_0x428f40['error']['message']);}else{logger[_0x2004('0x14')]('UserProfileResource,\x20%s,\x20%s',_0x1cd9af,'request\x20sent');_0x44c3c3(_0x428f40[_0x2004('0x15')][_0x2004('0x13')]);}})[_0x2004('0x16')](function(_0x1b0580){logger[_0x2004('0x11')](_0x2004('0xc'),_0x1cd9af,_0x1b0580);_0x19e601(_0x1b0580);});});} \ No newline at end of file +var _0x79d1=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','info','UserProfileResource,\x20%s,\x20%s','debug','UserProfileResource,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','moment','bluebird','randomstring','ioredis','../../config/utils'];(function(_0x433f54,_0x371b89){var _0x1010cb=function(_0x3f8d81){while(--_0x3f8d81){_0x433f54['push'](_0x433f54['shift']());}};_0x1010cb(++_0x371b89);}(_0x79d1,0x136));var _0x179d=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x79d1[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x179d('0x0'));var BPromise=require(_0x179d('0x1'));var rs=require(_0x179d('0x2'));var fs=require('fs');var Redis=require(_0x179d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x179d('0x4'));var logger=require(_0x179d('0x5'))(_0x179d('0x6'));var config=require(_0x179d('0x7'));var jayson=require(_0x179d('0x8'));var client=jayson['client'][_0x179d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x33982f,_0x3853c6,_0x1f0351){return new BPromise(function(_0x3b022e,_0x1f8b27){return client[_0x179d('0xa')](_0x33982f,_0x1f0351)['then'](function(_0x3bb590){logger[_0x179d('0xb')](_0x179d('0xc'),_0x3853c6,'request\x20sent');logger[_0x179d('0xd')](_0x179d('0xe'),_0x3853c6,_0x179d('0xf'),JSON[_0x179d('0x10')](_0x3bb590));if(_0x3bb590[_0x179d('0x11')]){if(_0x3bb590[_0x179d('0x11')][_0x179d('0x12')]===0x1f4){logger['error'](_0x179d('0xc'),_0x3853c6,_0x3bb590[_0x179d('0x11')][_0x179d('0x13')]);return _0x1f8b27(_0x3bb590[_0x179d('0x11')][_0x179d('0x13')]);}logger[_0x179d('0x11')](_0x179d('0xc'),_0x3853c6,_0x3bb590['error'][_0x179d('0x13')]);return _0x3b022e(_0x3bb590['error']['message']);}else{logger[_0x179d('0xb')]('UserProfileResource,\x20%s,\x20%s',_0x3853c6,_0x179d('0xf'));_0x3b022e(_0x3bb590[_0x179d('0x14')][_0x179d('0x13')]);}})['catch'](function(_0x1ecbaa){logger['error']('UserProfileResource,\x20%s,\x20%s',_0x3853c6,_0x1ecbaa);_0x1f8b27(_0x1ecbaa);});});} \ No newline at end of file diff --git a/server/api/userProfileSection/index.js b/server/api/userProfileSection/index.js index dfce396..17aa339 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 _0x431b=['show','create','update','delete','destroy','exports','multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./userProfileSection.controller','get','/describe','isAuthenticated','describe','/:id'];(function(_0x32f7d7,_0x54231b){var _0x133d09=function(_0x41a7ab){while(--_0x41a7ab){_0x32f7d7['push'](_0x32f7d7['shift']());}};_0x133d09(++_0x54231b);}(_0x431b,0x136));var _0xb431=function(_0x36a017,_0x2b889c){_0x36a017=_0x36a017-0x0;var _0x226857=_0x431b[_0x36a017];return _0x226857;};'use strict';var multer=require(_0xb431('0x0'));var util=require('util');var path=require(_0xb431('0x1'));var timeout=require(_0xb431('0x2'));var express=require(_0xb431('0x3'));var router=express['Router']();var fs_extra=require(_0xb431('0x4'));var auth=require(_0xb431('0x5'));var interaction=require(_0xb431('0x6'));var config=require('../../config/environment');var controller=require(_0xb431('0x7'));router['get']('/',auth['isAuthenticated'](),controller['index']);router[_0xb431('0x8')](_0xb431('0x9'),auth[_0xb431('0xa')](),controller[_0xb431('0xb')]);router[_0xb431('0x8')](_0xb431('0xc'),auth[_0xb431('0xa')](),controller[_0xb431('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0xb431('0xe')]);router['put'](_0xb431('0xc'),auth[_0xb431('0xa')](),controller[_0xb431('0xf')]);router[_0xb431('0x10')](_0xb431('0xc'),auth['isAuthenticated'](),controller[_0xb431('0x11')]);module[_0xb431('0x12')]=router; \ No newline at end of file +var _0xd60e=['index','/describe','describe','/:id','show','post','create','put','update','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./userProfileSection.controller','get','isAuthenticated'];(function(_0x40c1e2,_0xcbe6b4){var _0x544607=function(_0x5905e7){while(--_0x5905e7){_0x40c1e2['push'](_0x40c1e2['shift']());}};_0x544607(++_0xcbe6b4);}(_0xd60e,0x192));var _0xed60=function(_0x3f9a61,_0x2da3d0){_0x3f9a61=_0x3f9a61-0x0;var _0x55ef9c=_0xd60e[_0x3f9a61];return _0x55ef9c;};'use strict';var multer=require(_0xed60('0x0'));var util=require('util');var path=require(_0xed60('0x1'));var timeout=require(_0xed60('0x2'));var express=require(_0xed60('0x3'));var router=express[_0xed60('0x4')]();var fs_extra=require(_0xed60('0x5'));var auth=require(_0xed60('0x6'));var interaction=require(_0xed60('0x7'));var config=require(_0xed60('0x8'));var controller=require(_0xed60('0x9'));router[_0xed60('0xa')]('/',auth[_0xed60('0xb')](),controller[_0xed60('0xc')]);router['get'](_0xed60('0xd'),auth[_0xed60('0xb')](),controller[_0xed60('0xe')]);router[_0xed60('0xa')](_0xed60('0xf'),auth[_0xed60('0xb')](),controller[_0xed60('0x10')]);router[_0xed60('0x11')]('/',auth[_0xed60('0xb')](),controller[_0xed60('0x12')]);router[_0xed60('0x13')]('/:id',auth[_0xed60('0xb')](),controller[_0xed60('0x14')]);router['delete'](_0xed60('0xf'),auth[_0xed60('0xb')](),controller[_0xed60('0x15')]);module[_0xed60('0x16')]=router; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.attributes.js b/server/api/userProfileSection/userProfileSection.attributes.js index f71f820..b439689 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 _0x84a0=['STRING','BOOLEAN','setDataValue','crudPermissions','getDataValue','split','sequelize','exports'];(function(_0xcfeff4,_0x3f2e19){var _0xb2fadc=function(_0x4cd013){while(--_0x4cd013){_0xcfeff4['push'](_0xcfeff4['shift']());}};_0xb2fadc(++_0x3f2e19);}(_0x84a0,0x66));var _0x084a=function(_0x3e5b0d,_0x21e299){_0x3e5b0d=_0x3e5b0d-0x0;var _0x199c43=_0x84a0[_0x3e5b0d];return _0x199c43;};'use strict';var Sequelize=require(_0x084a('0x0'));module[_0x084a('0x1')]={'name':{'type':Sequelize[_0x084a('0x2')],'allowNull':![]},'category':{'type':Sequelize[_0x084a('0x2')],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x084a('0x3')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x084a('0x3')],'defaultValue':null},'crudPermissions':{'type':Sequelize['STRING'],'set':function(_0x58a814){this[_0x084a('0x4')](_0x084a('0x5'),_0x58a814?_0x58a814['join'](''):[]);},'get':function(){return this[_0x084a('0x6')](_0x084a('0x5'))?this[_0x084a('0x6')](_0x084a('0x5'))[_0x084a('0x7')](''):[];}}}; \ No newline at end of file +var _0xd8b0=['STRING','setDataValue','getDataValue','crudPermissions','split','sequelize','exports','BOOLEAN'];(function(_0x451dd2,_0x136575){var _0x548c61=function(_0x17942d){while(--_0x17942d){_0x451dd2['push'](_0x451dd2['shift']());}};_0x548c61(++_0x136575);}(_0xd8b0,0xad));var _0x0d8b=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0xd8b0[_0xa464c9];return _0x3d73c4;};'use strict';var Sequelize=require(_0x0d8b('0x0'));module[_0x0d8b('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![]},'category':{'type':Sequelize['STRING'],'allowNull':![]},'sectionId':{'type':Sequelize['INTEGER'],'allowNull':![]},'enabled':{'type':Sequelize[_0x0d8b('0x2')],'defaultValue':null},'autoAssociation':{'type':Sequelize[_0x0d8b('0x2')],'defaultValue':null},'crudPermissions':{'type':Sequelize[_0x0d8b('0x3')],'set':function(_0x364286){this[_0x0d8b('0x4')]('crudPermissions',_0x364286?_0x364286['join'](''):[]);},'get':function(){return this[_0x0d8b('0x5')](_0x0d8b('0x6'))?this[_0x0d8b('0x5')]('crudPermissions')[_0x0d8b('0x7')](''):[];}}}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.controller.js b/server/api/userProfileSection/userProfileSection.controller.js index 41404ae..d91ef51 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 _0xff7c=['../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','destroy','sendStatus','error','stack','name','index','map','UserProfileSection','rawAttributes','fieldName','type','query','keys','filters','model','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','merge','options','includeAll','include','findAll','catch','show','params','create','body','find','describe','eml-format','rimraf','zip-dir','request-promise','moment','mustache','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0x344545,_0x5c3da2){var _0x3c37ae=function(_0x16e1c4){while(--_0x16e1c4){_0x344545['push'](_0x344545['shift']());}};_0x3c37ae(++_0x5c3da2);}(_0xff7c,0x19f));var _0xcff7=function(_0x20589d,_0x55d5bf){_0x20589d=_0x20589d-0x0;var _0x422de9=_0xff7c[_0x20589d];return _0x422de9;};'use strict';var emlformat=require(_0xcff7('0x0'));var rimraf=require(_0xcff7('0x1'));var zipdir=require(_0xcff7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require(_0xcff7('0x3'));var moment=require(_0xcff7('0x4'));var BPromise=require('bluebird');var Mustache=require(_0xcff7('0x5'));var util=require('util');var path=require(_0xcff7('0x6'));var sox=require(_0xcff7('0x7'));var csv=require(_0xcff7('0x8'));var ejs=require(_0xcff7('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xcff7('0xa'));var squel=require(_0xcff7('0xb'));var crypto=require(_0xcff7('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xcff7('0xd'));var toCsv=require(_0xcff7('0x8'));var querystring=require(_0xcff7('0xe'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xcff7('0xf'));var qs=require(_0xcff7('0x10'));var as=require(_0xcff7('0x11'));var hardwareService=require(_0xcff7('0x12'));var logger=require(_0xcff7('0x13'))(_0xcff7('0x14'));var utils=require('../../config/utils');var config=require(_0xcff7('0x15'));var licenseUtil=require(_0xcff7('0x16'));var db=require(_0xcff7('0x17'))['db'];function respondWithStatusCode(_0x45854d,_0x238216){_0x238216=_0x238216||0xcc;return function(_0x5199dc){if(_0x5199dc){return _0x45854d['sendStatus'](_0x238216);}return _0x45854d[_0xcff7('0x18')](_0x238216)['end']();};}function respondWithResult(_0x59715e,_0x576056){_0x576056=_0x576056||0xc8;return function(_0x16dc49){if(_0x16dc49){return _0x59715e[_0xcff7('0x18')](_0x576056)[_0xcff7('0x19')](_0x16dc49);}};}function respondWithFilteredResult(_0x3bcd5d,_0x3c4569){return function(_0x865ccc){if(_0x865ccc){var _0x32b981=typeof _0x3c4569[_0xcff7('0x1a')]===_0xcff7('0x1b')&&typeof _0x3c4569[_0xcff7('0x1c')]===_0xcff7('0x1b');var _0x144094=_0x865ccc[_0xcff7('0x1d')];var _0x15a350=_0x32b981?0x0:_0x3c4569['offset'];var _0x5a101b=_0x32b981?_0x865ccc['count']:_0x3c4569[_0xcff7('0x1a')]+_0x3c4569[_0xcff7('0x1c')];var _0x457b13;if(_0x5a101b>=_0x144094){_0x5a101b=_0x144094;_0x457b13=0xc8;}else{_0x457b13=0xce;}_0x3bcd5d[_0xcff7('0x18')](_0x457b13);return _0x3bcd5d['set'](_0xcff7('0x1e'),_0x15a350+'-'+_0x5a101b+'/'+_0x144094)[_0xcff7('0x19')](_0x865ccc);}return null;};}function patchUpdates(_0xb048dc){return function(_0x4d63bc){try{jsonpatch[_0xcff7('0x1f')](_0x4d63bc,_0xb048dc,!![]);}catch(_0x1d75f9){return BPromise['reject'](_0x1d75f9);}return _0x4d63bc[_0xcff7('0x20')]();};}function saveUpdates(_0x175a42,_0x549088){return function(_0x2fdc39){if(_0x2fdc39){return _0x2fdc39[_0xcff7('0x21')](_0x175a42)[_0xcff7('0x22')](function(_0x45a894){return _0x45a894;});}return null;};}function removeEntity(_0x17955f,_0x5ac041){return function(_0x45df00){if(_0x45df00){return _0x45df00[_0xcff7('0x23')]()[_0xcff7('0x22')](function(){_0x17955f[_0xcff7('0x18')](0xcc)['end']();});}};}function handleEntityNotFound(_0x34c36a,_0xd3e25c){return function(_0x5c9e32){if(!_0x5c9e32){_0x34c36a[_0xcff7('0x24')](0x194);}return _0x5c9e32;};}function handleError(_0x1e847f,_0x50f1a4){_0x50f1a4=_0x50f1a4||0x1f4;return function(_0x254d4c){logger[_0xcff7('0x25')](_0x254d4c[_0xcff7('0x26')]);if(_0x254d4c[_0xcff7('0x27')]){delete _0x254d4c[_0xcff7('0x27')];}_0x1e847f[_0xcff7('0x18')](_0x50f1a4)['send'](_0x254d4c);};}exports[_0xcff7('0x28')]=function(_0x3b7287,_0x488233){var _0x1a2cda={},_0x91c893={},_0x4d5bbb={'count':0x0,'rows':[]};var _0x1b7a64=_[_0xcff7('0x29')](db[_0xcff7('0x2a')][_0xcff7('0x2b')],function(_0x133fd1){return{'name':_0x133fd1[_0xcff7('0x2c')],'type':_0x133fd1[_0xcff7('0x2d')]['key']};});_0x91c893['model']=_['map'](_0x1b7a64,'name');_0x91c893[_0xcff7('0x2e')]=_[_0xcff7('0x2f')](_0x3b7287[_0xcff7('0x2e')]);_0x91c893[_0xcff7('0x30')]=_['intersection'](_0x91c893[_0xcff7('0x31')],_0x91c893[_0xcff7('0x2e')]);_0x1a2cda['attributes']=_[_0xcff7('0x32')](_0x91c893['model'],qs[_0xcff7('0x33')](_0x3b7287[_0xcff7('0x2e')][_0xcff7('0x33')]));_0x1a2cda['attributes']=_0x1a2cda[_0xcff7('0x34')][_0xcff7('0x35')]?_0x1a2cda['attributes']:_0x91c893[_0xcff7('0x31')];if(!_0x3b7287[_0xcff7('0x2e')][_0xcff7('0x36')](_0xcff7('0x37'))){_0x1a2cda['limit']=qs['limit'](_0x3b7287[_0xcff7('0x2e')][_0xcff7('0x1c')]);_0x1a2cda['offset']=qs[_0xcff7('0x1a')](_0x3b7287['query'][_0xcff7('0x1a')]);}_0x1a2cda[_0xcff7('0x38')]=qs[_0xcff7('0x39')](_0x3b7287['query']['sort']);_0x1a2cda[_0xcff7('0x3a')]=qs['filters'](_[_0xcff7('0x3b')](_0x3b7287[_0xcff7('0x2e')],_0x91c893['filters']),_0x1b7a64);if(_0x3b7287[_0xcff7('0x2e')]['filter']){_0x1a2cda['where']=_[_0xcff7('0x3c')](_0x1a2cda[_0xcff7('0x3a')],{'$or':_[_0xcff7('0x29')](_0x1b7a64,function(_0x5597ff){if(_0x5597ff[_0xcff7('0x2d')]!=='VIRTUAL'){var _0x5ebd51={};_0x5ebd51[_0x5597ff['name']]={'$like':'%'+_0x3b7287[_0xcff7('0x2e')]['filter']+'%'};return _0x5ebd51;}})});}_0x1a2cda=_[_0xcff7('0x3c')]({},_0x1a2cda,_0x3b7287[_0xcff7('0x3d')]);var _0x409f9f={'where':_0x1a2cda['where']};return db['UserProfileSection'][_0xcff7('0x1d')](_0x409f9f)[_0xcff7('0x22')](function(_0x5e6928){_0x4d5bbb[_0xcff7('0x1d')]=_0x5e6928;if(_0x3b7287[_0xcff7('0x2e')][_0xcff7('0x3e')]){_0x1a2cda[_0xcff7('0x3f')]=[{'all':!![]}];}return db[_0xcff7('0x2a')][_0xcff7('0x40')](_0x1a2cda);})[_0xcff7('0x22')](function(_0x90dcad){_0x4d5bbb['rows']=_0x90dcad;return _0x4d5bbb;})[_0xcff7('0x22')](respondWithFilteredResult(_0x488233,_0x1a2cda))[_0xcff7('0x41')](handleError(_0x488233,null));};exports[_0xcff7('0x42')]=function(_0x2596d2,_0x5a9fed){var _0xa735f3={'raw':![],'where':{'id':_0x2596d2[_0xcff7('0x43')]['id']}},_0x409e66={};_0x409e66[_0xcff7('0x31')]=_[_0xcff7('0x2f')](db['UserProfileSection'][_0xcff7('0x2b')]);_0x409e66[_0xcff7('0x2e')]=_['keys'](_0x2596d2[_0xcff7('0x2e')]);_0x409e66[_0xcff7('0x30')]=_[_0xcff7('0x32')](_0x409e66[_0xcff7('0x31')],_0x409e66[_0xcff7('0x2e')]);_0xa735f3[_0xcff7('0x34')]=_[_0xcff7('0x32')](_0x409e66[_0xcff7('0x31')],qs['fields'](_0x2596d2[_0xcff7('0x2e')][_0xcff7('0x33')]));_0xa735f3['attributes']=_0xa735f3[_0xcff7('0x34')][_0xcff7('0x35')]?_0xa735f3[_0xcff7('0x34')]:_0x409e66[_0xcff7('0x31')];if(_0x2596d2[_0xcff7('0x2e')][_0xcff7('0x3e')]){_0xa735f3['include']=[{'all':!![]}];}_0xa735f3=_[_0xcff7('0x3c')]({},_0xa735f3,_0x2596d2[_0xcff7('0x3d')]);return db[_0xcff7('0x2a')]['find'](_0xa735f3)[_0xcff7('0x22')](handleEntityNotFound(_0x5a9fed,null))[_0xcff7('0x22')](respondWithResult(_0x5a9fed,null))[_0xcff7('0x41')](handleError(_0x5a9fed,null));};exports[_0xcff7('0x44')]=function(_0x433e6c,_0x5c8de2){return db[_0xcff7('0x2a')][_0xcff7('0x44')](_0x433e6c['body'],{})['then'](respondWithResult(_0x5c8de2,0xc9))[_0xcff7('0x41')](handleError(_0x5c8de2,null));};exports[_0xcff7('0x21')]=function(_0x38eb49,_0x2c39e5){if(_0x38eb49[_0xcff7('0x45')]['id']){delete _0x38eb49[_0xcff7('0x45')]['id'];}return db[_0xcff7('0x2a')][_0xcff7('0x46')]({'where':{'id':_0x38eb49[_0xcff7('0x43')]['id']}})[_0xcff7('0x22')](handleEntityNotFound(_0x2c39e5,null))[_0xcff7('0x22')](saveUpdates(_0x38eb49[_0xcff7('0x45')],null))[_0xcff7('0x22')](respondWithResult(_0x2c39e5,null))[_0xcff7('0x41')](handleError(_0x2c39e5,null));};exports[_0xcff7('0x23')]=function(_0x24c6b4,_0x3e66b0){return db[_0xcff7('0x2a')]['find']({'where':{'id':_0x24c6b4['params']['id']}})[_0xcff7('0x22')](handleEntityNotFound(_0x3e66b0,null))[_0xcff7('0x22')](removeEntity(_0x3e66b0,null))[_0xcff7('0x41')](handleError(_0x3e66b0,null));};exports[_0xcff7('0x47')]=function(_0x4420bb,_0x2bb40a){return db[_0xcff7('0x2a')][_0xcff7('0x47')]()['then'](respondWithResult(_0x2bb40a,null))[_0xcff7('0x41')](handleError(_0x2bb40a,null));}; \ No newline at end of file +var _0x1a93=['limit','count','set','Content-Range','json','apply','save','then','destroy','end','error','name','index','UserProfileSection','rawAttributes','fieldName','key','model','map','keys','filters','intersection','attributes','query','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','include','findAll','rows','params','fields','find','catch','create','body','update','describe','rimraf','zip-dir','request-promise','bluebird','util','path','sox','fs-extra','lodash','crypto','desk.js','to-csv','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','offset','undefined'];(function(_0x1340f5,_0x8f8361){var _0xf43a86=function(_0x3c6ac1){while(--_0x3c6ac1){_0x1340f5['push'](_0x1340f5['shift']());}};_0xf43a86(++_0x8f8361);}(_0x1a93,0x7a));var _0x31a9=function(_0x391b7d,_0x4b0246){_0x391b7d=_0x391b7d-0x0;var _0x5ddf5b=_0x1a93[_0x391b7d];return _0x5ddf5b;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x31a9('0x0'));var zipdir=require(_0x31a9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0x31a9('0x2'));var moment=require('moment');var BPromise=require(_0x31a9('0x3'));var Mustache=require('mustache');var util=require(_0x31a9('0x4'));var path=require(_0x31a9('0x5'));var sox=require(_0x31a9('0x6'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x31a9('0x7'));var _=require(_0x31a9('0x8'));var squel=require('squel');var crypto=require(_0x31a9('0x9'));var jsforce=require('jsforce');var deskjs=require(_0x31a9('0xa'));var toCsv=require(_0x31a9('0xb'));var querystring=require('querystring');var Papa=require(_0x31a9('0xc'));var Redis=require(_0x31a9('0xd'));var authService=require(_0x31a9('0xe'));var qs=require(_0x31a9('0xf'));var as=require(_0x31a9('0x10'));var hardwareService=require(_0x31a9('0x11'));var logger=require(_0x31a9('0x12'))(_0x31a9('0x13'));var utils=require(_0x31a9('0x14'));var config=require(_0x31a9('0x15'));var licenseUtil=require(_0x31a9('0x16'));var db=require(_0x31a9('0x17'))['db'];function respondWithStatusCode(_0x32b8e3,_0x61d79e){_0x61d79e=_0x61d79e||0xcc;return function(_0xff79d7){if(_0xff79d7){return _0x32b8e3[_0x31a9('0x18')](_0x61d79e);}return _0x32b8e3[_0x31a9('0x19')](_0x61d79e)['end']();};}function respondWithResult(_0x1a5fb5,_0x245c04){_0x245c04=_0x245c04||0xc8;return function(_0x42a425){if(_0x42a425){return _0x1a5fb5[_0x31a9('0x19')](_0x245c04)['json'](_0x42a425);}};}function respondWithFilteredResult(_0x2d3d36,_0x40bba0){return function(_0x4f43ae){if(_0x4f43ae){var _0x176ff1=typeof _0x40bba0[_0x31a9('0x1a')]===_0x31a9('0x1b')&&typeof _0x40bba0[_0x31a9('0x1c')]===_0x31a9('0x1b');var _0x45935c=_0x4f43ae[_0x31a9('0x1d')];var _0x3fbf37=_0x176ff1?0x0:_0x40bba0['offset'];var _0x181c80=_0x176ff1?_0x4f43ae[_0x31a9('0x1d')]:_0x40bba0['offset']+_0x40bba0[_0x31a9('0x1c')];var _0x1217fd;if(_0x181c80>=_0x45935c){_0x181c80=_0x45935c;_0x1217fd=0xc8;}else{_0x1217fd=0xce;}_0x2d3d36['status'](_0x1217fd);return _0x2d3d36[_0x31a9('0x1e')](_0x31a9('0x1f'),_0x3fbf37+'-'+_0x181c80+'/'+_0x45935c)[_0x31a9('0x20')](_0x4f43ae);}return null;};}function patchUpdates(_0x1acef3){return function(_0x428fc2){try{jsonpatch[_0x31a9('0x21')](_0x428fc2,_0x1acef3,!![]);}catch(_0x3c0b28){return BPromise['reject'](_0x3c0b28);}return _0x428fc2[_0x31a9('0x22')]();};}function saveUpdates(_0x3bed43,_0x2d3021){return function(_0xcb1e27){if(_0xcb1e27){return _0xcb1e27['update'](_0x3bed43)[_0x31a9('0x23')](function(_0x2ad4d2){return _0x2ad4d2;});}return null;};}function removeEntity(_0x427059,_0x38c845){return function(_0x20dd21){if(_0x20dd21){return _0x20dd21[_0x31a9('0x24')]()[_0x31a9('0x23')](function(){_0x427059[_0x31a9('0x19')](0xcc)[_0x31a9('0x25')]();});}};}function handleEntityNotFound(_0x5a9ca9,_0x20e69c){return function(_0x14c117){if(!_0x14c117){_0x5a9ca9['sendStatus'](0x194);}return _0x14c117;};}function handleError(_0x4bea81,_0x21df00){_0x21df00=_0x21df00||0x1f4;return function(_0x1b31c5){logger[_0x31a9('0x26')](_0x1b31c5['stack']);if(_0x1b31c5[_0x31a9('0x27')]){delete _0x1b31c5[_0x31a9('0x27')];}_0x4bea81[_0x31a9('0x19')](_0x21df00)['send'](_0x1b31c5);};}exports[_0x31a9('0x28')]=function(_0x4c2a09,_0x1e1990){var _0x83ef78={},_0x278db7={},_0x185cb7={'count':0x0,'rows':[]};var _0x20dbac=_['map'](db[_0x31a9('0x29')][_0x31a9('0x2a')],function(_0x537e01){return{'name':_0x537e01[_0x31a9('0x2b')],'type':_0x537e01['type'][_0x31a9('0x2c')]};});_0x278db7[_0x31a9('0x2d')]=_[_0x31a9('0x2e')](_0x20dbac,_0x31a9('0x27'));_0x278db7['query']=_[_0x31a9('0x2f')](_0x4c2a09['query']);_0x278db7[_0x31a9('0x30')]=_[_0x31a9('0x31')](_0x278db7[_0x31a9('0x2d')],_0x278db7['query']);_0x83ef78[_0x31a9('0x32')]=_[_0x31a9('0x31')](_0x278db7[_0x31a9('0x2d')],qs['fields'](_0x4c2a09[_0x31a9('0x33')]['fields']));_0x83ef78[_0x31a9('0x32')]=_0x83ef78[_0x31a9('0x32')][_0x31a9('0x34')]?_0x83ef78[_0x31a9('0x32')]:_0x278db7[_0x31a9('0x2d')];if(!_0x4c2a09[_0x31a9('0x33')][_0x31a9('0x35')](_0x31a9('0x36'))){_0x83ef78[_0x31a9('0x1c')]=qs[_0x31a9('0x1c')](_0x4c2a09['query'][_0x31a9('0x1c')]);_0x83ef78['offset']=qs[_0x31a9('0x1a')](_0x4c2a09[_0x31a9('0x33')][_0x31a9('0x1a')]);}_0x83ef78['order']=qs[_0x31a9('0x37')](_0x4c2a09[_0x31a9('0x33')]['sort']);_0x83ef78[_0x31a9('0x38')]=qs['filters'](_[_0x31a9('0x39')](_0x4c2a09['query'],_0x278db7[_0x31a9('0x30')]),_0x20dbac);if(_0x4c2a09[_0x31a9('0x33')][_0x31a9('0x3a')]){_0x83ef78[_0x31a9('0x38')]=_[_0x31a9('0x3b')](_0x83ef78[_0x31a9('0x38')],{'$or':_[_0x31a9('0x2e')](_0x20dbac,function(_0x29460f){if(_0x29460f[_0x31a9('0x3c')]!==_0x31a9('0x3d')){var _0x4a2c83={};_0x4a2c83[_0x29460f[_0x31a9('0x27')]]={'$like':'%'+_0x4c2a09[_0x31a9('0x33')]['filter']+'%'};return _0x4a2c83;}})});}_0x83ef78=_['merge']({},_0x83ef78,_0x4c2a09[_0x31a9('0x3e')]);var _0x269120={'where':_0x83ef78[_0x31a9('0x38')]};return db['UserProfileSection'][_0x31a9('0x1d')](_0x269120)[_0x31a9('0x23')](function(_0x3b172a){_0x185cb7[_0x31a9('0x1d')]=_0x3b172a;if(_0x4c2a09['query'][_0x31a9('0x3f')]){_0x83ef78[_0x31a9('0x40')]=[{'all':!![]}];}return db[_0x31a9('0x29')][_0x31a9('0x41')](_0x83ef78);})[_0x31a9('0x23')](function(_0x54d611){_0x185cb7[_0x31a9('0x42')]=_0x54d611;return _0x185cb7;})['then'](respondWithFilteredResult(_0x1e1990,_0x83ef78))['catch'](handleError(_0x1e1990,null));};exports['show']=function(_0x43b80e,_0x20f9c5){var _0x5ceb6f={'raw':![],'where':{'id':_0x43b80e[_0x31a9('0x43')]['id']}},_0xb642e3={};_0xb642e3[_0x31a9('0x2d')]=_[_0x31a9('0x2f')](db['UserProfileSection'][_0x31a9('0x2a')]);_0xb642e3['query']=_[_0x31a9('0x2f')](_0x43b80e['query']);_0xb642e3['filters']=_['intersection'](_0xb642e3[_0x31a9('0x2d')],_0xb642e3[_0x31a9('0x33')]);_0x5ceb6f['attributes']=_[_0x31a9('0x31')](_0xb642e3[_0x31a9('0x2d')],qs[_0x31a9('0x44')](_0x43b80e[_0x31a9('0x33')][_0x31a9('0x44')]));_0x5ceb6f[_0x31a9('0x32')]=_0x5ceb6f[_0x31a9('0x32')][_0x31a9('0x34')]?_0x5ceb6f['attributes']:_0xb642e3[_0x31a9('0x2d')];if(_0x43b80e['query'][_0x31a9('0x3f')]){_0x5ceb6f['include']=[{'all':!![]}];}_0x5ceb6f=_[_0x31a9('0x3b')]({},_0x5ceb6f,_0x43b80e[_0x31a9('0x3e')]);return db[_0x31a9('0x29')][_0x31a9('0x45')](_0x5ceb6f)[_0x31a9('0x23')](handleEntityNotFound(_0x20f9c5,null))['then'](respondWithResult(_0x20f9c5,null))[_0x31a9('0x46')](handleError(_0x20f9c5,null));};exports[_0x31a9('0x47')]=function(_0x5d9fb7,_0x4654cb){return db[_0x31a9('0x29')][_0x31a9('0x47')](_0x5d9fb7[_0x31a9('0x48')],{})['then'](respondWithResult(_0x4654cb,0xc9))[_0x31a9('0x46')](handleError(_0x4654cb,null));};exports[_0x31a9('0x49')]=function(_0x52b677,_0x38db67){if(_0x52b677[_0x31a9('0x48')]['id']){delete _0x52b677[_0x31a9('0x48')]['id'];}return db[_0x31a9('0x29')]['find']({'where':{'id':_0x52b677[_0x31a9('0x43')]['id']}})[_0x31a9('0x23')](handleEntityNotFound(_0x38db67,null))[_0x31a9('0x23')](saveUpdates(_0x52b677['body'],null))[_0x31a9('0x23')](respondWithResult(_0x38db67,null))[_0x31a9('0x46')](handleError(_0x38db67,null));};exports[_0x31a9('0x24')]=function(_0x22079c,_0x590851){return db[_0x31a9('0x29')][_0x31a9('0x45')]({'where':{'id':_0x22079c['params']['id']}})[_0x31a9('0x23')](handleEntityNotFound(_0x590851,null))['then'](removeEntity(_0x590851,null))['catch'](handleError(_0x590851,null));};exports[_0x31a9('0x4a')]=function(_0x17d81d,_0x189f73){return db[_0x31a9('0x29')][_0x31a9('0x4a')]()[_0x31a9('0x23')](respondWithResult(_0x189f73,null))[_0x31a9('0x46')](handleError(_0x189f73,null));}; \ No newline at end of file diff --git a/server/api/userProfileSection/userProfileSection.model.js b/server/api/userProfileSection/userProfileSection.model.js index 9d69305..eb657b8 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 _0x292c=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./userProfileSection.attributes','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex','sectionId','userProfileId'];(function(_0xed4f9e,_0x328fce){var _0x3f542b=function(_0x1054f0){while(--_0x1054f0){_0xed4f9e['push'](_0xed4f9e['shift']());}};_0x3f542b(++_0x328fce);}(_0x292c,0xbb));var _0xc292=function(_0x33032e,_0x31411a){_0x33032e=_0x33032e-0x0;var _0x13316b=_0x292c[_0x33032e];return _0x13316b;};'use strict';var _=require(_0xc292('0x0'));var util=require(_0xc292('0x1'));var logger=require(_0xc292('0x2'))(_0xc292('0x3'));var moment=require(_0xc292('0x4'));var BPromise=require(_0xc292('0x5'));var rp=require(_0xc292('0x6'));var fs=require('fs');var path=require(_0xc292('0x7'));var rimraf=require(_0xc292('0x8'));var config=require('../../config/environment');var attributes=require(_0xc292('0x9'));module[_0xc292('0xa')]=function(_0x37014f,_0x477b2e){return _0x37014f[_0xc292('0xb')](_0xc292('0xc'),attributes,{'tableName':_0xc292('0xd'),'paranoid':![],'indexes':[{'name':_0xc292('0xe'),'fields':[_0xc292('0xf'),_0xc292('0x10')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb022=['sectionId','userProfileId','lodash','util','../../config/logger','api','moment','request-promise','rimraf','../../config/environment','exports','define','UserProfileSection','user_profile_has_sections','compositeIndex'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0xb022,0x1e2));var _0x2b02=function(_0x297fd3,_0x115406){_0x297fd3=_0x297fd3-0x0;var _0x2af381=_0xb022[_0x297fd3];return _0x2af381;};'use strict';var _=require(_0x2b02('0x0'));var util=require(_0x2b02('0x1'));var logger=require(_0x2b02('0x2'))(_0x2b02('0x3'));var moment=require(_0x2b02('0x4'));var BPromise=require('bluebird');var rp=require(_0x2b02('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0x2b02('0x6'));var config=require(_0x2b02('0x7'));var attributes=require('./userProfileSection.attributes');module[_0x2b02('0x8')]=function(_0x37a3d9,_0x6211d5){return _0x37a3d9[_0x2b02('0x9')](_0x2b02('0xa'),attributes,{'tableName':_0x2b02('0xb'),'paranoid':![],'indexes':[{'name':_0x2b02('0xc'),'fields':[_0x2b02('0xd'),_0x2b02('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 3051a76..7f7ebc5 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 _0xc5bf=['ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','error','code','message','catch','util','bluebird','randomstring'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0xc5bf,0x1ad));var _0xfc5b=function(_0x963eda,_0x534f26){_0x963eda=_0x963eda-0x0;var _0x387dda=_0xc5bf[_0x963eda];return _0x387dda;};'use strict';var _=require('lodash');var util=require(_0xfc5b('0x0'));var moment=require('moment');var BPromise=require(_0xfc5b('0x1'));var rs=require(_0xfc5b('0x2'));var fs=require('fs');var Redis=require(_0xfc5b('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xfc5b('0x4'));var logger=require(_0xfc5b('0x5'))(_0xfc5b('0x6'));var config=require(_0xfc5b('0x7'));var jayson=require(_0xfc5b('0x8'));var client=jayson['client'][_0xfc5b('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c546d,_0x46a419,_0x1fde61){return new BPromise(function(_0x64d9f5,_0x1ab0d9){return client['request'](_0x4c546d,_0x1fde61)[_0xfc5b('0xa')](function(_0x28315f){logger[_0xfc5b('0xb')](_0xfc5b('0xc'),_0x46a419,_0xfc5b('0xd'));logger['debug']('UserProfileSection,\x20%s,\x20%s,\x20%s',_0x46a419,_0xfc5b('0xd'),JSON['stringify'](_0x28315f));if(_0x28315f[_0xfc5b('0xe')]){if(_0x28315f[_0xfc5b('0xe')][_0xfc5b('0xf')]===0x1f4){logger[_0xfc5b('0xe')](_0xfc5b('0xc'),_0x46a419,_0x28315f[_0xfc5b('0xe')][_0xfc5b('0x10')]);return _0x1ab0d9(_0x28315f[_0xfc5b('0xe')]['message']);}logger['error'](_0xfc5b('0xc'),_0x46a419,_0x28315f[_0xfc5b('0xe')]['message']);return _0x64d9f5(_0x28315f[_0xfc5b('0xe')][_0xfc5b('0x10')]);}else{logger['info'](_0xfc5b('0xc'),_0x46a419,_0xfc5b('0xd'));_0x64d9f5(_0x28315f['result'][_0xfc5b('0x10')]);}})[_0xfc5b('0x11')](function(_0x14cb0c){logger[_0xfc5b('0xe')](_0xfc5b('0xc'),_0x46a419,_0x14cb0c);_0x1ab0d9(_0x14cb0c);});});} \ No newline at end of file +var _0xbc4e=['client','http','then','info','UserProfileSection,\x20%s,\x20%s','request\x20sent','UserProfileSection,\x20%s,\x20%s,\x20%s','stringify','error','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise'];(function(_0x4444c1,_0x543d5c){var _0x4774ab=function(_0x562b97){while(--_0x562b97){_0x4444c1['push'](_0x4444c1['shift']());}};_0x4774ab(++_0x543d5c);}(_0xbc4e,0x1c4));var _0xebc4=function(_0x200d69,_0x430951){_0x200d69=_0x200d69-0x0;var _0x14fde8=_0xbc4e[_0x200d69];return _0x14fde8;};'use strict';var _=require(_0xebc4('0x0'));var util=require('util');var moment=require(_0xebc4('0x1'));var BPromise=require(_0xebc4('0x2'));var rs=require(_0xebc4('0x3'));var fs=require('fs');var Redis=require(_0xebc4('0x4'));var db=require(_0xebc4('0x5'))['db'];var utils=require(_0xebc4('0x6'));var logger=require(_0xebc4('0x7'))('rpc');var config=require(_0xebc4('0x8'));var jayson=require(_0xebc4('0x9'));var client=jayson[_0xebc4('0xa')][_0xebc4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3c9265,_0x10a1d2,_0x5821fd){return new BPromise(function(_0x23e829,_0x26e33a){return client['request'](_0x3c9265,_0x5821fd)[_0xebc4('0xc')](function(_0x14c4f1){logger[_0xebc4('0xd')](_0xebc4('0xe'),_0x10a1d2,_0xebc4('0xf'));logger['debug'](_0xebc4('0x10'),_0x10a1d2,_0xebc4('0xf'),JSON[_0xebc4('0x11')](_0x14c4f1));if(_0x14c4f1[_0xebc4('0x12')]){if(_0x14c4f1[_0xebc4('0x12')]['code']===0x1f4){logger[_0xebc4('0x12')](_0xebc4('0xe'),_0x10a1d2,_0x14c4f1[_0xebc4('0x12')][_0xebc4('0x13')]);return _0x26e33a(_0x14c4f1[_0xebc4('0x12')][_0xebc4('0x13')]);}logger[_0xebc4('0x12')](_0xebc4('0xe'),_0x10a1d2,_0x14c4f1[_0xebc4('0x12')]['message']);return _0x23e829(_0x14c4f1[_0xebc4('0x12')][_0xebc4('0x13')]);}else{logger['info'](_0xebc4('0xe'),_0x10a1d2,'request\x20sent');_0x23e829(_0x14c4f1['result'][_0xebc4('0x13')]);}})[_0xebc4('0x14')](function(_0x32ef7c){logger['error'](_0xebc4('0xe'),_0x10a1d2,_0x32ef7c);_0x26e33a(_0x32ef7c);});});} \ No newline at end of file diff --git a/server/api/userSmsQueue/index.js b/server/api/userSmsQueue/index.js index 125379e..3c55be7 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 _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x382e8e,_0x24caa0){var _0x3b56d7=function(_0x4913d6){while(--_0x4913d6){_0x382e8e['push'](_0x382e8e['shift']());}};_0x3b56d7(++_0x24caa0);}(_0xedd9,0xfc));var _0x9edd=function(_0x26b525,_0x3594da){_0x26b525=_0x26b525-0x0;var _0x38a0c6=_0xedd9[_0x26b525];return _0x38a0c6;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file +var _0xedd9=['util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','exports'];(function(_0x1aa890,_0x376e42){var _0x29c837=function(_0x4fe2f1){while(--_0x4fe2f1){_0x1aa890['push'](_0x1aa890['shift']());}};_0x29c837(++_0x376e42);}(_0xedd9,0xfc));var _0x9edd=function(_0x4f5f4a,_0x29fe3a){_0x4f5f4a=_0x4f5f4a-0x0;var _0x37010f=_0xedd9[_0x4f5f4a];return _0x37010f;};'use strict';var multer=require('multer');var util=require(_0x9edd('0x0'));var path=require(_0x9edd('0x1'));var timeout=require(_0x9edd('0x2'));var express=require(_0x9edd('0x3'));var router=express[_0x9edd('0x4')]();var fs_extra=require(_0x9edd('0x5'));var auth=require(_0x9edd('0x6'));var interaction=require(_0x9edd('0x7'));var config=require('../../config/environment');module[_0x9edd('0x8')]=router; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.attributes.js b/server/api/userSmsQueue/userSmsQueue.attributes.js index de8d70b..1dc7144 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 _0x9752=['exports','INTEGER'];(function(_0x544878,_0x391790){var _0x525c2c=function(_0x4cbcf5){while(--_0x4cbcf5){_0x544878['push'](_0x544878['shift']());}};_0x525c2c(++_0x391790);}(_0x9752,0x90));var _0x2975=function(_0x3d8573,_0x39e685){_0x3d8573=_0x3d8573-0x0;var _0x10a3fc=_0x9752[_0x3d8573];return _0x10a3fc;};'use strict';var Sequelize=require('sequelize');module[_0x2975('0x0')]={'penalty':{'type':Sequelize[_0x2975('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x1f28=['INTEGER'];(function(_0x3fd7ed,_0x55bb90){var _0x5e65e3=function(_0x181d16){while(--_0x181d16){_0x3fd7ed['push'](_0x3fd7ed['shift']());}};_0x5e65e3(++_0x55bb90);}(_0x1f28,0x1db));var _0x81f2=function(_0xfae23b,_0x2be4ba){_0xfae23b=_0xfae23b-0x0;var _0x200640=_0x1f28[_0xfae23b];return _0x200640;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x81f2('0x0')],'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 ac3a1b8..0c9e0be 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 _0xb4b6=['bluebird','request-promise','path','rimraf','../../config/environment','exports','define','UserSmsQueue','user_has_sms_queues','util','../../config/logger','api','moment'];(function(_0x27ab05,_0x57e5ce){var _0x458dc4=function(_0x27963f){while(--_0x27963f){_0x27ab05['push'](_0x27ab05['shift']());}};_0x458dc4(++_0x57e5ce);}(_0xb4b6,0x7e));var _0x6b4b=function(_0xb32218,_0x31efb8){_0xb32218=_0xb32218-0x0;var _0xc47604=_0xb4b6[_0xb32218];return _0xc47604;};'use strict';var _=require('lodash');var util=require(_0x6b4b('0x0'));var logger=require(_0x6b4b('0x1'))(_0x6b4b('0x2'));var moment=require(_0x6b4b('0x3'));var BPromise=require(_0x6b4b('0x4'));var rp=require(_0x6b4b('0x5'));var fs=require('fs');var path=require(_0x6b4b('0x6'));var rimraf=require(_0x6b4b('0x7'));var config=require(_0x6b4b('0x8'));var attributes=require('./userSmsQueue.attributes');module[_0x6b4b('0x9')]=function(_0x49e81c,_0x3915de){return _0x49e81c[_0x6b4b('0xa')](_0x6b4b('0xb'),attributes,{'tableName':_0x6b4b('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xaf1b=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./userSmsQueue.attributes','exports','UserSmsQueue','lodash','util','../../config/logger','api'];(function(_0x49b207,_0x408ade){var _0x2dc8fa=function(_0x150975){while(--_0x150975){_0x49b207['push'](_0x49b207['shift']());}};_0x2dc8fa(++_0x408ade);}(_0xaf1b,0x11a));var _0xbaf1=function(_0x5c7121,_0x48aad8){_0x5c7121=_0x5c7121-0x0;var _0xb8077a=_0xaf1b[_0x5c7121];return _0xb8077a;};'use strict';var _=require(_0xbaf1('0x0'));var util=require(_0xbaf1('0x1'));var logger=require(_0xbaf1('0x2'))(_0xbaf1('0x3'));var moment=require(_0xbaf1('0x4'));var BPromise=require(_0xbaf1('0x5'));var rp=require(_0xbaf1('0x6'));var fs=require('fs');var path=require(_0xbaf1('0x7'));var rimraf=require(_0xbaf1('0x8'));var config=require(_0xbaf1('0x9'));var attributes=require(_0xbaf1('0xa'));module[_0xbaf1('0xb')]=function(_0x7dd657,_0x2f05ad){return _0x7dd657['define'](_0xbaf1('0xc'),attributes,{'tableName':'user_has_sms_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userSmsQueue/userSmsQueue.rpc.js b/server/api/userSmsQueue/userSmsQueue.rpc.js index 095b5e2..0eb0bc0 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 _0x9453=['../../config/utils','../../config/logger','rpc','../../config/environment','client','request','then','info','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','error','UserSmsQueue,\x20%s,\x20%s','message','result','catch','util','moment','bluebird','ioredis'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0x9453,0xd8));var _0x3945=function(_0x1137da,_0x599da5){_0x1137da=_0x1137da-0x0;var _0x5088ee=_0x9453[_0x1137da];return _0x5088ee;};'use strict';var _=require('lodash');var util=require(_0x3945('0x0'));var moment=require(_0x3945('0x1'));var BPromise=require(_0x3945('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3945('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3945('0x4'));var logger=require(_0x3945('0x5'))(_0x3945('0x6'));var config=require(_0x3945('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x3945('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1c8fa6,_0x5d4e23,_0x22e1d3){return new BPromise(function(_0x4f6dde,_0x5c4054){return client[_0x3945('0x9')](_0x1c8fa6,_0x22e1d3)[_0x3945('0xa')](function(_0x2cc6b8){logger[_0x3945('0xb')]('UserSmsQueue,\x20%s,\x20%s',_0x5d4e23,_0x3945('0xc'));logger[_0x3945('0xd')](_0x3945('0xe'),_0x5d4e23,_0x3945('0xc'),JSON['stringify'](_0x2cc6b8));if(_0x2cc6b8[_0x3945('0xf')]){if(_0x2cc6b8[_0x3945('0xf')]['code']===0x1f4){logger['error'](_0x3945('0x10'),_0x5d4e23,_0x2cc6b8[_0x3945('0xf')]['message']);return _0x5c4054(_0x2cc6b8['error'][_0x3945('0x11')]);}logger[_0x3945('0xf')](_0x3945('0x10'),_0x5d4e23,_0x2cc6b8[_0x3945('0xf')]['message']);return _0x4f6dde(_0x2cc6b8[_0x3945('0xf')][_0x3945('0x11')]);}else{logger[_0x3945('0xb')](_0x3945('0x10'),_0x5d4e23,_0x3945('0xc'));_0x4f6dde(_0x2cc6b8[_0x3945('0x12')][_0x3945('0x11')]);}})[_0x3945('0x13')](function(_0x14e80d){logger[_0x3945('0xf')]('UserSmsQueue,\x20%s,\x20%s',_0x5d4e23,_0x14e80d);_0x5c4054(_0x14e80d);});});} \ No newline at end of file +var _0x3508=['message','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','client','http','request','info','UserSmsQueue,\x20%s,\x20%s','request\x20sent','debug','UserSmsQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x2a417f,_0x45b6cf){var _0xf1a226=function(_0x4aee69){while(--_0x4aee69){_0x2a417f['push'](_0x2a417f['shift']());}};_0xf1a226(++_0x45b6cf);}(_0x3508,0x120));var _0x8350=function(_0x35da10,_0x15f96c){_0x35da10=_0x35da10-0x0;var _0x5e8fb3=_0x3508[_0x35da10];return _0x5e8fb3;};'use strict';var _=require(_0x8350('0x0'));var util=require(_0x8350('0x1'));var moment=require('moment');var BPromise=require(_0x8350('0x2'));var rs=require(_0x8350('0x3'));var fs=require('fs');var Redis=require(_0x8350('0x4'));var db=require(_0x8350('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x8350('0x6'))('rpc');var config=require(_0x8350('0x7'));var jayson=require(_0x8350('0x8'));var client=jayson[_0x8350('0x9')][_0x8350('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x30a263,_0x45bd21,_0x2b24b5){return new BPromise(function(_0x543512,_0x5588bb){return client[_0x8350('0xb')](_0x30a263,_0x2b24b5)['then'](function(_0x153d9d){logger[_0x8350('0xc')](_0x8350('0xd'),_0x45bd21,_0x8350('0xe'));logger[_0x8350('0xf')](_0x8350('0x10'),_0x45bd21,'request\x20sent',JSON[_0x8350('0x11')](_0x153d9d));if(_0x153d9d[_0x8350('0x12')]){if(_0x153d9d['error'][_0x8350('0x13')]===0x1f4){logger[_0x8350('0x12')]('UserSmsQueue,\x20%s,\x20%s',_0x45bd21,_0x153d9d[_0x8350('0x12')][_0x8350('0x14')]);return _0x5588bb(_0x153d9d[_0x8350('0x12')][_0x8350('0x14')]);}logger[_0x8350('0x12')](_0x8350('0xd'),_0x45bd21,_0x153d9d['error'][_0x8350('0x14')]);return _0x543512(_0x153d9d['error'][_0x8350('0x14')]);}else{logger[_0x8350('0xc')]('UserSmsQueue,\x20%s,\x20%s',_0x45bd21,'request\x20sent');_0x543512(_0x153d9d[_0x8350('0x15')][_0x8350('0x14')]);}})['catch'](function(_0x4873ba){logger['error'](_0x8350('0xd'),_0x45bd21,_0x4873ba);_0x5588bb(_0x4873ba);});});} \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.attributes.js b/server/api/userVoicePrefix/userVoicePrefix.attributes.js index 295dd90..b6b3355 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.attributes.js +++ b/server/api/userVoicePrefix/userVoicePrefix.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5b68=['INTEGER','sequelize'];(function(_0x6c993a,_0x5ea3ab){var _0x27f547=function(_0x22df20){while(--_0x22df20){_0x6c993a['push'](_0x6c993a['shift']());}};_0x27f547(++_0x5ea3ab);}(_0x5b68,0xcd));var _0x85b6=function(_0x3955f0,_0x1b7306){_0x3955f0=_0x3955f0-0x0;var _0x36d5f4=_0x5b68[_0x3955f0];return _0x36d5f4;};'use strict';var Sequelize=require(_0x85b6('0x0'));module['exports']={'UserId':{'type':Sequelize[_0x85b6('0x1')]},'VoicePrefixId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x57dd=['exports','INTEGER','sequelize'];(function(_0x3959e4,_0x315e43){var _0x523e8d=function(_0x39943b){while(--_0x39943b){_0x3959e4['push'](_0x3959e4['shift']());}};_0x523e8d(++_0x315e43);}(_0x57dd,0x74));var _0xd57d=function(_0xf48244,_0x115cad){_0xf48244=_0xf48244-0x0;var _0x37d890=_0x57dd[_0xf48244];return _0x37d890;};'use strict';var Sequelize=require(_0xd57d('0x0'));module[_0xd57d('0x1')]={'UserId':{'type':Sequelize[_0xd57d('0x2')]},'VoicePrefixId':{'type':Sequelize[_0xd57d('0x2')]}}; \ No newline at end of file diff --git a/server/api/userVoicePrefix/userVoicePrefix.model.js b/server/api/userVoicePrefix/userVoicePrefix.model.js index 5ca0a75..a965199 100644 --- a/server/api/userVoicePrefix/userVoicePrefix.model.js +++ b/server/api/userVoicePrefix/userVoicePrefix.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x2fd390,_0x2a67b7){var _0x404642=function(_0x2d7f1e){while(--_0x2d7f1e){_0x2fd390['push'](_0x2fd390['shift']());}};_0x404642(++_0x2a67b7);}(_0xa9e0,0x123));var _0x0a9e=function(_0xc6be3a,_0x540e05){_0xc6be3a=_0xc6be3a-0x0;var _0x56a310=_0xa9e0[_0xc6be3a];return _0x56a310;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xa9e0=['../../config/environment','./userVoicePrefix.attributes','exports','define','UserVoicePrefix','lodash','util','../../config/logger','bluebird','path','rimraf'];(function(_0x30e8d3,_0x35a49e){var _0x244c25=function(_0x1f4ad7){while(--_0x1f4ad7){_0x30e8d3['push'](_0x30e8d3['shift']());}};_0x244c25(++_0x35a49e);}(_0xa9e0,0x123));var _0x0a9e=function(_0x373dee,_0x1a8c45){_0x373dee=_0x373dee-0x0;var _0x46798f=_0xa9e0[_0x373dee];return _0x46798f;};'use strict';var _=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('api');var moment=require('moment');var BPromise=require(_0x0a9e('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x0a9e('0x4'));var rimraf=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var attributes=require(_0x0a9e('0x7'));module[_0x0a9e('0x8')]=function(_0x57b080,_0x219af0){return _0x57b080[_0x0a9e('0x9')](_0x0a9e('0xa'),attributes,{'tableName':'user_has_voice_prefixes','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/userVoiceQueue/index.js b/server/api/userVoiceQueue/index.js index d702fad..671cd98 100644 --- a/server/api/userVoiceQueue/index.js +++ b/server/api/userVoiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x5e2a7b,_0x470500){var _0x42b751=function(_0x50790b){while(--_0x50790b){_0x5e2a7b['push'](_0x5e2a7b['shift']());}};_0x42b751(++_0x470500);}(_0x70e0,0x17b));var _0x070e=function(_0x5879dc,_0x2625d1){_0x5879dc=_0x5879dc-0x0;var _0xf53e9c=_0x70e0[_0x5879dc];return _0xf53e9c;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0xd8b0=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','multer','util'];(function(_0x1f50f3,_0x4d4ae9){var _0x33b87b=function(_0xa26fb5){while(--_0xa26fb5){_0x1f50f3['push'](_0x1f50f3['shift']());}};_0x33b87b(++_0x4d4ae9);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0x0d8b('0x0'));var util=require(_0x0d8b('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0d8b('0x2')]();var fs_extra=require(_0x0d8b('0x3'));var auth=require(_0x0d8b('0x4'));var interaction=require(_0x0d8b('0x5'));var config=require(_0x0d8b('0x6'));module['exports']=router; \ No newline at end of file diff --git a/server/api/userVoiceQueue/userVoiceQueue.attributes.js b/server/api/userVoiceQueue/userVoiceQueue.attributes.js index d8a1365..385af4d 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 _0xf3a7=['INTEGER','exports'];(function(_0x261d9e,_0x4f0942){var _0x3f8a2c=function(_0x28aaf8){while(--_0x28aaf8){_0x261d9e['push'](_0x261d9e['shift']());}};_0x3f8a2c(++_0x4f0942);}(_0xf3a7,0x99));var _0x7f3a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xf3a7[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');module[_0x7f3a('0x0')]={'penalty':{'type':Sequelize[_0x7f3a('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7906=['exports','INTEGER','sequelize'];(function(_0x33f3ea,_0x7d5d50){var _0x1e2f35=function(_0x285d73){while(--_0x285d73){_0x33f3ea['push'](_0x33f3ea['shift']());}};_0x1e2f35(++_0x7d5d50);}(_0x7906,0x176));var _0x6790=function(_0x596b41,_0x1fc715){_0x596b41=_0x596b41-0x0;var _0x210abe=_0x7906[_0x596b41];return _0x210abe;};'use strict';var Sequelize=require(_0x6790('0x0'));module[_0x6790('0x1')]={'penalty':{'type':Sequelize[_0x6790('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 2f2a122..dabb68b 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 _0xa53d=['lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','./userVoiceQueue.attributes','define','UserVoiceQueue','user_has_voice_queues'];(function(_0x3fd66d,_0x410d26){var _0x5a6464=function(_0x144918){while(--_0x144918){_0x3fd66d['push'](_0x3fd66d['shift']());}};_0x5a6464(++_0x410d26);}(_0xa53d,0x90));var _0xda53=function(_0x1818b4,_0x413b3a){_0x1818b4=_0x1818b4-0x0;var _0x214d1d=_0xa53d[_0x1818b4];return _0x214d1d;};'use strict';var _=require(_0xda53('0x0'));var util=require(_0xda53('0x1'));var logger=require(_0xda53('0x2'))(_0xda53('0x3'));var moment=require(_0xda53('0x4'));var BPromise=require(_0xda53('0x5'));var rp=require(_0xda53('0x6'));var fs=require('fs');var path=require(_0xda53('0x7'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xda53('0x8'));module['exports']=function(_0x229fe5,_0x443bbe){return _0x229fe5[_0xda53('0x9')](_0xda53('0xa'),attributes,{'tableName':_0xda53('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x5f79=['bluebird','request-promise','path','rimraf','../../config/environment','./userVoiceQueue.attributes','UserVoiceQueue','api','moment'];(function(_0x16ca4a,_0x1ed3e7){var _0x48f844=function(_0x161e91){while(--_0x161e91){_0x16ca4a['push'](_0x16ca4a['shift']());}};_0x48f844(++_0x1ed3e7);}(_0x5f79,0x1ae));var _0x95f7=function(_0x512973,_0x564e8b){_0x512973=_0x512973-0x0;var _0x32f2e1=_0x5f79[_0x512973];return _0x32f2e1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x95f7('0x0'));var moment=require(_0x95f7('0x1'));var BPromise=require(_0x95f7('0x2'));var rp=require(_0x95f7('0x3'));var fs=require('fs');var path=require(_0x95f7('0x4'));var rimraf=require(_0x95f7('0x5'));var config=require(_0x95f7('0x6'));var attributes=require(_0x95f7('0x7'));module['exports']=function(_0x7aa2c8,_0x3718a4){return _0x7aa2c8['define'](_0x95f7('0x8'),attributes,{'tableName':'user_has_voice_queues','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 1f03aa1..55029ef 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 _0xa673=['../../config/environment','client','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','error','code','message','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x56503e,_0x6983e4){var _0x1e007d=function(_0x511549){while(--_0x511549){_0x56503e['push'](_0x56503e['shift']());}};_0x1e007d(++_0x6983e4);}(_0xa673,0x114));var _0x3a67=function(_0xf1622,_0x91c2fb){_0xf1622=_0xf1622-0x0;var _0x8480ed=_0xa673[_0xf1622];return _0x8480ed;};'use strict';var _=require(_0x3a67('0x0'));var util=require(_0x3a67('0x1'));var moment=require(_0x3a67('0x2'));var BPromise=require(_0x3a67('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3a67('0x4'));var db=require(_0x3a67('0x5'))['db'];var utils=require(_0x3a67('0x6'));var logger=require(_0x3a67('0x7'))(_0x3a67('0x8'));var config=require(_0x3a67('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x3a67('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x51b85f,_0x140e51,_0x1a27cf){return new BPromise(function(_0x3303ec,_0x4ad27c){return client[_0x3a67('0xb')](_0x51b85f,_0x1a27cf)['then'](function(_0x4756b5){logger[_0x3a67('0xc')](_0x3a67('0xd'),_0x140e51,_0x3a67('0xe'));logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x140e51,_0x3a67('0xe'),JSON['stringify'](_0x4756b5));if(_0x4756b5[_0x3a67('0xf')]){if(_0x4756b5[_0x3a67('0xf')][_0x3a67('0x10')]===0x1f4){logger[_0x3a67('0xf')](_0x3a67('0xd'),_0x140e51,_0x4756b5['error'][_0x3a67('0x11')]);return _0x4ad27c(_0x4756b5[_0x3a67('0xf')][_0x3a67('0x11')]);}logger['error'](_0x3a67('0xd'),_0x140e51,_0x4756b5[_0x3a67('0xf')][_0x3a67('0x11')]);return _0x3303ec(_0x4756b5['error'][_0x3a67('0x11')]);}else{logger[_0x3a67('0xc')](_0x3a67('0xd'),_0x140e51,_0x3a67('0xe'));_0x3303ec(_0x4756b5['result'][_0x3a67('0x11')]);}})[_0x3a67('0x12')](function(_0x1eef77){logger['error'](_0x3a67('0xd'),_0x140e51,_0x1eef77);_0x4ad27c(_0x1eef77);});});} \ No newline at end of file +var _0x5c3c=['../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserVoiceQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x5c3c,0x11a));var _0xc5c3=function(_0x138f59,_0x1b53fb){_0x138f59=_0x138f59-0x0;var _0x3d114d=_0x5c3c[_0x138f59];return _0x3d114d;};'use strict';var _=require(_0xc5c3('0x0'));var util=require(_0xc5c3('0x1'));var moment=require(_0xc5c3('0x2'));var BPromise=require('bluebird');var rs=require(_0xc5c3('0x3'));var fs=require('fs');var Redis=require(_0xc5c3('0x4'));var db=require(_0xc5c3('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xc5c3('0x6'))(_0xc5c3('0x7'));var config=require(_0xc5c3('0x8'));var jayson=require(_0xc5c3('0x9'));var client=jayson['client'][_0xc5c3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1a2b5d,_0x587ff5,_0x260a0f){return new BPromise(function(_0x2fcb8b,_0xe19530){return client[_0xc5c3('0xb')](_0x1a2b5d,_0x260a0f)[_0xc5c3('0xc')](function(_0x4df523){logger[_0xc5c3('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x587ff5,_0xc5c3('0xe'));logger[_0xc5c3('0xf')](_0xc5c3('0x10'),_0x587ff5,_0xc5c3('0xe'),JSON[_0xc5c3('0x11')](_0x4df523));if(_0x4df523[_0xc5c3('0x12')]){if(_0x4df523[_0xc5c3('0x12')][_0xc5c3('0x13')]===0x1f4){logger[_0xc5c3('0x12')](_0xc5c3('0x14'),_0x587ff5,_0x4df523[_0xc5c3('0x12')][_0xc5c3('0x15')]);return _0xe19530(_0x4df523[_0xc5c3('0x12')][_0xc5c3('0x15')]);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x587ff5,_0x4df523['error'][_0xc5c3('0x15')]);return _0x2fcb8b(_0x4df523[_0xc5c3('0x12')][_0xc5c3('0x15')]);}else{logger['info'](_0xc5c3('0x14'),_0x587ff5,_0xc5c3('0xe'));_0x2fcb8b(_0x4df523[_0xc5c3('0x16')][_0xc5c3('0x15')]);}})[_0xc5c3('0x17')](function(_0x2dae94){logger[_0xc5c3('0x12')](_0xc5c3('0x14'),_0x587ff5,_0x2dae94);_0xe19530(_0x2dae94);});});} \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/index.js b/server/api/userVoiceQueueRt/index.js index f21eaf0..5159222 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 _0x70e0=['../../components/auth/service','../../components/interaction/service','exports','multer','util','path','Router','fs-extra'];(function(_0x55d9c7,_0x52e26e){var _0x582e5d=function(_0x5ab0a1){while(--_0x5ab0a1){_0x55d9c7['push'](_0x55d9c7['shift']());}};_0x582e5d(++_0x52e26e);}(_0x70e0,0x17b));var _0x070e=function(_0x54a0c0,_0x21c10f){_0x54a0c0=_0x54a0c0-0x0;var _0x4634fd=_0x70e0[_0x54a0c0];return _0x4634fd;};'use strict';var multer=require(_0x070e('0x0'));var util=require(_0x070e('0x1'));var path=require(_0x070e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x070e('0x3')]();var fs_extra=require(_0x070e('0x4'));var auth=require(_0x070e('0x5'));var interaction=require(_0x070e('0x6'));var config=require('../../config/environment');module[_0x070e('0x7')]=router; \ No newline at end of file +var _0x9c44=['express','Router','fs-extra','../../components/auth/service','exports','path','connect-timeout'];(function(_0x40e60f,_0x5365e1){var _0x35511f=function(_0x41df2d){while(--_0x41df2d){_0x40e60f['push'](_0x40e60f['shift']());}};_0x35511f(++_0x5365e1);}(_0x9c44,0x178));var _0x49c4=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0x9c44[_0x45d55e];return _0x29812a;};'use strict';var multer=require('multer');var util=require('util');var path=require(_0x49c4('0x0'));var timeout=require(_0x49c4('0x1'));var express=require(_0x49c4('0x2'));var router=express[_0x49c4('0x3')]();var fs_extra=require(_0x49c4('0x4'));var auth=require(_0x49c4('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');module[_0x49c4('0x6')]=router; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.attributes.js index 2994f35..7d5b7c3 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 _0x09b9=['Required\x20by\x20Asterisk','STRING','queue_interface','sequelize','exports','INTEGER'];(function(_0x40ec64,_0x2930cc){var _0x2f41b6=function(_0x2ae5ff){while(--_0x2ae5ff){_0x40ec64['push'](_0x40ec64['shift']());}};_0x2f41b6(++_0x2930cc);}(_0x09b9,0x17d));var _0x909b=function(_0x4656fc,_0x4aa793){_0x4656fc=_0x4656fc-0x0;var _0x388012=_0x09b9[_0x4656fc];return _0x388012;};'use strict';var Sequelize=require(_0x909b('0x0'));module[_0x909b('0x1')]={'uniqueid':{'type':Sequelize[_0x909b('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':_0x909b('0x3')},'membername':{'type':Sequelize[_0x909b('0x4')],'allowNull':![],'comment':_0x909b('0x3')},'UserId':{'type':Sequelize[_0x909b('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0x909b('0x4')],'allowNull':![],'unique':_0x909b('0x5'),'comment':_0x909b('0x3')},'VoiceQueueId':{'type':Sequelize[_0x909b('0x2')],'allowNull':![]},'interface':{'type':Sequelize[_0x909b('0x4')],'allowNull':![],'unique':_0x909b('0x5'),'comment':_0x909b('0x3')},'penalty':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'comment':_0x909b('0x3')},'paused':{'type':Sequelize[_0x909b('0x2')](0xb),'defaultValue':0x0,'comment':_0x909b('0x3')}}; \ No newline at end of file +var _0x9b5f=['STRING','queue_interface','sequelize','exports','INTEGER','Required\x20by\x20Asterisk'];(function(_0x2d08eb,_0x2865ab){var _0x5216d5=function(_0x5926d0){while(--_0x5926d0){_0x2d08eb['push'](_0x2d08eb['shift']());}};_0x5216d5(++_0x2865ab);}(_0x9b5f,0x7a));var _0xf9b5=function(_0x50faaa,_0x59d114){_0x50faaa=_0x50faaa-0x0;var _0x48300e=_0x9b5f[_0x50faaa];return _0x48300e;};'use strict';var Sequelize=require(_0xf9b5('0x0'));module[_0xf9b5('0x1')]={'uniqueid':{'type':Sequelize[_0xf9b5('0x2')],'primaryKey':!![],'autoIncrement':!![],'comment':'Required\x20by\x20Asterisk'},'membername':{'type':Sequelize['STRING'],'allowNull':![],'comment':_0xf9b5('0x3')},'UserId':{'type':Sequelize[_0xf9b5('0x2')],'allowNull':![]},'queue_name':{'type':Sequelize[_0xf9b5('0x4')],'allowNull':![],'unique':_0xf9b5('0x5'),'comment':_0xf9b5('0x3')},'VoiceQueueId':{'type':Sequelize['INTEGER'],'allowNull':![]},'interface':{'type':Sequelize[_0xf9b5('0x4')],'allowNull':![],'unique':_0xf9b5('0x5'),'comment':_0xf9b5('0x3')},'penalty':{'type':Sequelize[_0xf9b5('0x2')](0xb),'defaultValue':0x0,'comment':'Required\x20by\x20Asterisk'},'paused':{'type':Sequelize[_0xf9b5('0x2')](0xb),'defaultValue':0x0,'comment':_0xf9b5('0x3')}}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.events.js index a0aa397..2c50f4e 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 _0x0a84=['update','remove','emit','hasOwnProperty','exports','events','UserVoiceQueueRt','save'];(function(_0x29dda1,_0x508e13){var _0x21b0ef=function(_0x118906){while(--_0x118906){_0x29dda1['push'](_0x29dda1['shift']());}};_0x21b0ef(++_0x508e13);}(_0x0a84,0x185));var _0x40a8=function(_0x28ec6d,_0x295eb7){_0x28ec6d=_0x28ec6d-0x0;var _0x1f1762=_0x0a84[_0x28ec6d];return _0x1f1762;};'use strict';var EventEmitter=require(_0x40a8('0x0'));var UserVoiceQueueRt=require('../../mysqldb')['db'][_0x40a8('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x40a8('0x2'),'afterUpdate':_0x40a8('0x3'),'afterDestroy':_0x40a8('0x4')};function emitEvent(_0x51c3fe){return function(_0x4620b9,_0x353db1,_0xd230d4){UserVoiceQueueRtEvents['emit'](_0x51c3fe+':'+_0x4620b9['id'],_0x4620b9);UserVoiceQueueRtEvents[_0x40a8('0x5')](_0x51c3fe,_0x4620b9);_0xd230d4(null);};}for(var e in events){if(events[_0x40a8('0x6')](e)){var event=events[e];UserVoiceQueueRt['hook'](e,emitEvent(event));}}module[_0x40a8('0x7')]=UserVoiceQueueRtEvents; \ No newline at end of file +var _0xbbc3=['save','update','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','UserVoiceQueueRt'];(function(_0x233972,_0x562918){var _0x10181d=function(_0x55445c){while(--_0x55445c){_0x233972['push'](_0x233972['shift']());}};_0x10181d(++_0x562918);}(_0xbbc3,0x142));var _0x3bbc=function(_0x13ffb6,_0x7e4a2f){_0x13ffb6=_0x13ffb6-0x0;var _0x3c713d=_0xbbc3[_0x13ffb6];return _0x3c713d;};'use strict';var EventEmitter=require('events');var UserVoiceQueueRt=require(_0x3bbc('0x0'))['db'][_0x3bbc('0x1')];var UserVoiceQueueRtEvents=new EventEmitter();UserVoiceQueueRtEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x3bbc('0x2'),'afterUpdate':_0x3bbc('0x3'),'afterDestroy':_0x3bbc('0x4')};function emitEvent(_0xf6c5f3){return function(_0x599c31,_0x4dde47,_0x5677cb){UserVoiceQueueRtEvents['emit'](_0xf6c5f3+':'+_0x599c31['id'],_0x599c31);UserVoiceQueueRtEvents[_0x3bbc('0x5')](_0xf6c5f3,_0x599c31);_0x5677cb(null);};}for(var e in events){if(events[_0x3bbc('0x6')](e)){var event=events[e];UserVoiceQueueRt[_0x3bbc('0x7')](e,emitEvent(event));}}module[_0x3bbc('0x8')]=UserVoiceQueueRtEvents; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.model.js index 1ca909e..ba4f2ef 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 _0x2f6b=['rimraf','./userVoiceQueueRt.attributes','exports','define','UserVoiceQueueRt','user_has_voice_queues_rt','lodash','util','../../config/logger','api','moment','bluebird','path'];(function(_0x2306dc,_0x2d2ff2){var _0x3d2b36=function(_0x393307){while(--_0x393307){_0x2306dc['push'](_0x2306dc['shift']());}};_0x3d2b36(++_0x2d2ff2);}(_0x2f6b,0x6e));var _0xb2f6=function(_0x49fb1c,_0x113891){_0x49fb1c=_0x49fb1c-0x0;var _0x36cc02=_0x2f6b[_0x49fb1c];return _0x36cc02;};'use strict';var _=require(_0xb2f6('0x0'));var util=require(_0xb2f6('0x1'));var logger=require(_0xb2f6('0x2'))(_0xb2f6('0x3'));var moment=require(_0xb2f6('0x4'));var BPromise=require(_0xb2f6('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xb2f6('0x6'));var rimraf=require(_0xb2f6('0x7'));var config=require('../../config/environment');var attributes=require(_0xb2f6('0x8'));module[_0xb2f6('0x9')]=function(_0x10e7f1,_0x141578){return _0x10e7f1[_0xb2f6('0xa')](_0xb2f6('0xb'),attributes,{'tableName':_0xb2f6('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x2518=['../../config/logger','api','moment','bluebird','rimraf','../../config/environment','./userVoiceQueueRt.attributes','define','UserVoiceQueueRt','lodash','util'];(function(_0x32efc5,_0x3b8077){var _0x15ba41=function(_0x557447){while(--_0x557447){_0x32efc5['push'](_0x32efc5['shift']());}};_0x15ba41(++_0x3b8077);}(_0x2518,0xb9));var _0x8251=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x2518[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x8251('0x0'));var util=require(_0x8251('0x1'));var logger=require(_0x8251('0x2'))(_0x8251('0x3'));var moment=require(_0x8251('0x4'));var BPromise=require(_0x8251('0x5'));var rp=require('request-promise');var fs=require('fs');var path=require('path');var rimraf=require(_0x8251('0x6'));var config=require(_0x8251('0x7'));var attributes=require(_0x8251('0x8'));module['exports']=function(_0x59c898,_0x2f1eab){return _0x59c898[_0x8251('0x9')](_0x8251('0xa'),attributes,{'tableName':'user_has_voice_queues_rt','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 814f8ad..abfae7a 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 _0x6ff2=['`paused`\x20=\x201,\x201,\x20null','outboundQueuePauses','info','util','bluebird','ioredis','../../mysqldb','jayson/promise','http','redis','defaults','socket.io-emitter','register','request','then','UserVoiceQueueRt,\x20%s,\x20%s','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','catch','GetVoiceQueueRtPauses','findAll','options','where','sequelize','literal'];(function(_0x3e5ac1,_0x213ec1){var _0x5c9069=function(_0x2b8d6f){while(--_0x2b8d6f){_0x3e5ac1['push'](_0x3e5ac1['shift']());}};_0x5c9069(++_0x213ec1);}(_0x6ff2,0x1d3));var _0x26ff=function(_0x55c2fc,_0x300013){_0x55c2fc=_0x55c2fc-0x0;var _0x408247=_0x6ff2[_0x55c2fc];return _0x408247;};'use strict';var _=require('lodash');var util=require(_0x26ff('0x0'));var moment=require('moment');var BPromise=require(_0x26ff('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x26ff('0x2'));var db=require(_0x26ff('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x26ff('0x4'));var client=jayson['client'][_0x26ff('0x5')]({'port':0x232a});config[_0x26ff('0x6')]=_[_0x26ff('0x7')](config[_0x26ff('0x6')],{'host':'localhost','port':0x18eb});var socket=require(_0x26ff('0x8'))(new Redis(config[_0x26ff('0x6')]));require('./userVoiceQueueRt.socket')[_0x26ff('0x9')](socket);function respondWithRpcPromise(_0x370135,_0x34c51b,_0xbcab8d){return new BPromise(function(_0x6aea2a,_0x428436){return client[_0x26ff('0xa')](_0x370135,_0xbcab8d)[_0x26ff('0xb')](function(_0x4eb9d4){logger['info'](_0x26ff('0xc'),_0x34c51b,'request\x20sent');logger[_0x26ff('0xd')](_0x26ff('0xe'),_0x34c51b,_0x26ff('0xf'),JSON['stringify'](_0x4eb9d4));if(_0x4eb9d4['error']){if(_0x4eb9d4['error']['code']===0x1f4){logger[_0x26ff('0x10')](_0x26ff('0xc'),_0x34c51b,_0x4eb9d4[_0x26ff('0x10')]['message']);return _0x428436(_0x4eb9d4[_0x26ff('0x10')][_0x26ff('0x11')]);}logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x34c51b,_0x4eb9d4[_0x26ff('0x10')][_0x26ff('0x11')]);return _0x6aea2a(_0x4eb9d4[_0x26ff('0x10')]['message']);}else{logger['info']('UserVoiceQueueRt,\x20%s,\x20%s',_0x34c51b,'request\x20sent');_0x6aea2a(_0x4eb9d4[_0x26ff('0x12')]['message']);}})[_0x26ff('0x13')](function(_0x3a11fc){logger[_0x26ff('0x10')](_0x26ff('0xc'),_0x34c51b,_0x3a11fc);_0x428436(_0x3a11fc);});});}exports[_0x26ff('0x14')]=function(_0x330e42){var _0x2d971a=this;return new Promise(function(_0x2c34cb,_0x25f061){return db['UserVoiceQueueRt'][_0x26ff('0x15')]({'raw':_0x330e42[_0x26ff('0x16')]?_0x330e42['options']['raw']===undefined?!![]:![]:!![],'where':_0x330e42['options']?_0x330e42[_0x26ff('0x16')][_0x26ff('0x17')]||null:null,'attributes':[[db[_0x26ff('0x18')]['fn']('COUNT',db[_0x26ff('0x18')]['fn']('IF',db['sequelize'][_0x26ff('0x19')](_0x26ff('0x1a')))),_0x26ff('0x1b')]]})[_0x26ff('0xb')](function(_0x438245){logger[_0x26ff('0x1c')](_0x26ff('0x14'),_0x330e42);logger[_0x26ff('0xd')](_0x26ff('0x14'),_0x330e42,JSON['stringify'](_0x438245));_0x2c34cb(_0x438245);})[_0x26ff('0x13')](function(_0x4a7e2d){logger[_0x26ff('0x10')](_0x26ff('0x14'),_0x4a7e2d[_0x26ff('0x11')],_0x330e42);_0x25f061(_0x2d971a['error'](0x1f4,_0x4a7e2d['message']));});});}; \ No newline at end of file +var _0xfb81=['localhost','socket.io-emitter','./userVoiceQueueRt.socket','register','info','UserVoiceQueueRt,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueueRt,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','GetVoiceQueueRtPauses','UserVoiceQueueRt','findAll','options','where','COUNT','sequelize','literal','outboundQueuePauses','then','catch','lodash','util','moment','bluebird','ioredis','../../config/logger','../../config/environment','jayson/promise','client','http','redis'];(function(_0x1d57a2,_0x2f03ae){var _0x3377b1=function(_0x3621bb){while(--_0x3621bb){_0x1d57a2['push'](_0x1d57a2['shift']());}};_0x3377b1(++_0x2f03ae);}(_0xfb81,0x1a5));var _0x1fb8=function(_0x836bb4,_0x565f4b){_0x836bb4=_0x836bb4-0x0;var _0x4f5a56=_0xfb81[_0x836bb4];return _0x4f5a56;};'use strict';var _=require(_0x1fb8('0x0'));var util=require(_0x1fb8('0x1'));var moment=require(_0x1fb8('0x2'));var BPromise=require(_0x1fb8('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1fb8('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x1fb8('0x5'))('rpc');var config=require(_0x1fb8('0x6'));var jayson=require(_0x1fb8('0x7'));var client=jayson[_0x1fb8('0x8')][_0x1fb8('0x9')]({'port':0x232a});config['redis']=_['defaults'](config[_0x1fb8('0xa')],{'host':_0x1fb8('0xb'),'port':0x18eb});var socket=require(_0x1fb8('0xc'))(new Redis(config[_0x1fb8('0xa')]));require(_0x1fb8('0xd'))[_0x1fb8('0xe')](socket);function respondWithRpcPromise(_0x1441ab,_0x361548,_0xdc6b21){return new BPromise(function(_0x45546f,_0x397f0f){return client['request'](_0x1441ab,_0xdc6b21)['then'](function(_0x676cde){logger[_0x1fb8('0xf')](_0x1fb8('0x10'),_0x361548,_0x1fb8('0x11'));logger[_0x1fb8('0x12')](_0x1fb8('0x13'),_0x361548,_0x1fb8('0x11'),JSON[_0x1fb8('0x14')](_0x676cde));if(_0x676cde[_0x1fb8('0x15')]){if(_0x676cde[_0x1fb8('0x15')][_0x1fb8('0x16')]===0x1f4){logger['error']('UserVoiceQueueRt,\x20%s,\x20%s',_0x361548,_0x676cde['error']['message']);return _0x397f0f(_0x676cde['error'][_0x1fb8('0x17')]);}logger[_0x1fb8('0x15')](_0x1fb8('0x10'),_0x361548,_0x676cde[_0x1fb8('0x15')]['message']);return _0x45546f(_0x676cde['error'][_0x1fb8('0x17')]);}else{logger['info'](_0x1fb8('0x10'),_0x361548,'request\x20sent');_0x45546f(_0x676cde[_0x1fb8('0x18')]['message']);}})['catch'](function(_0x965a07){logger[_0x1fb8('0x15')]('UserVoiceQueueRt,\x20%s,\x20%s',_0x361548,_0x965a07);_0x397f0f(_0x965a07);});});}exports[_0x1fb8('0x19')]=function(_0x401b2d){var _0x1f2913=this;return new Promise(function(_0x8b5363,_0x23600c){return db[_0x1fb8('0x1a')][_0x1fb8('0x1b')]({'raw':_0x401b2d[_0x1fb8('0x1c')]?_0x401b2d[_0x1fb8('0x1c')]['raw']===undefined?!![]:![]:!![],'where':_0x401b2d[_0x1fb8('0x1c')]?_0x401b2d[_0x1fb8('0x1c')][_0x1fb8('0x1d')]||null:null,'attributes':[[db['sequelize']['fn'](_0x1fb8('0x1e'),db[_0x1fb8('0x1f')]['fn']('IF',db[_0x1fb8('0x1f')][_0x1fb8('0x20')]('`paused`\x20=\x201,\x201,\x20null'))),_0x1fb8('0x21')]]})[_0x1fb8('0x22')](function(_0x2fc51d){logger[_0x1fb8('0xf')](_0x1fb8('0x19'),_0x401b2d);logger[_0x1fb8('0x12')]('GetVoiceQueueRtPauses',_0x401b2d,JSON[_0x1fb8('0x14')](_0x2fc51d));_0x8b5363(_0x2fc51d);})[_0x1fb8('0x23')](function(_0x16db05){logger['error'](_0x1fb8('0x19'),_0x16db05[_0x1fb8('0x17')],_0x401b2d);_0x23600c(_0x1f2913['error'](0x1f4,_0x16db05[_0x1fb8('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js b/server/api/userVoiceQueueRt/userVoiceQueueRt.socket.js index e005cdd..79d7664 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 _0xe928=['register','length','userVoiceQueueRt:','./userVoiceQueueRt.events','save','remove','emit'];(function(_0x15858d,_0x1eec86){var _0x2fc45e=function(_0x5a8365){while(--_0x5a8365){_0x15858d['push'](_0x15858d['shift']());}};_0x2fc45e(++_0x1eec86);}(_0xe928,0x145));var _0x8e92=function(_0x89ea52,_0x43c3ae){_0x89ea52=_0x89ea52-0x0;var _0x10ce95=_0xe928[_0x89ea52];return _0x10ce95;};'use strict';var UserVoiceQueueRtEvents=require(_0x8e92('0x0'));var events=[_0x8e92('0x1'),_0x8e92('0x2'),'update'];function createListener(_0x226ab9,_0x577acb){return function(_0x939580){_0x577acb[_0x8e92('0x3')](_0x226ab9,_0x939580);};}function removeListener(_0x1b9cbe,_0x1f6ce2){return function(){UserVoiceQueueRtEvents['removeListener'](_0x1b9cbe,_0x1f6ce2);};}exports[_0x8e92('0x4')]=function(_0x50cf8a){for(var _0x2d938d=0x0,_0xe4eff3=events[_0x8e92('0x5')];_0x2d938d<_0xe4eff3;_0x2d938d++){var _0x76e11=events[_0x2d938d];var _0x59e109=createListener(_0x8e92('0x6')+_0x76e11,_0x50cf8a);UserVoiceQueueRtEvents['on'](_0x76e11,_0x59e109);}}; \ No newline at end of file +var _0x8f9d=['removeListener','length','userVoiceQueueRt:','./userVoiceQueueRt.events','remove','emit'];(function(_0x582176,_0x569896){var _0x3507fb=function(_0x1e7e52){while(--_0x1e7e52){_0x582176['push'](_0x582176['shift']());}};_0x3507fb(++_0x569896);}(_0x8f9d,0x93));var _0xd8f9=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8f9d[_0x57b54c];return _0x59cc19;};'use strict';var UserVoiceQueueRtEvents=require(_0xd8f9('0x0'));var events=['save',_0xd8f9('0x1'),'update'];function createListener(_0x682953,_0x421dcb){return function(_0x119296){_0x421dcb[_0xd8f9('0x2')](_0x682953,_0x119296);};}function removeListener(_0x1f9331,_0x1b82b8){return function(){UserVoiceQueueRtEvents[_0xd8f9('0x3')](_0x1f9331,_0x1b82b8);};}exports['register']=function(_0x1c37be){for(var _0x24dd1e=0x0,_0x25d417=events[_0xd8f9('0x4')];_0x24dd1e<_0x25d417;_0x24dd1e++){var _0xf6105=events[_0x24dd1e];var _0x5c410f=createListener(_0xd8f9('0x5')+_0xf6105,_0x1c37be);UserVoiceQueueRtEvents['on'](_0xf6105,_0x5c410f);}}; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/index.js b/server/api/userWhatsappQueue/index.js index 1655889..d3e7866 100644 --- a/server/api/userWhatsappQueue/index.js +++ b/server/api/userWhatsappQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['../../components/interaction/service','../../config/environment','exports','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x26369e,_0x32a254){var _0x309235=function(_0x4ff28b){while(--_0x4ff28b){_0x26369e['push'](_0x26369e['shift']());}};_0x309235(++_0x32a254);}(_0xe706,0xa3));var _0x6e70=function(_0x44b362,_0x1b5fd9){_0x44b362=_0x44b362-0x0;var _0x38b45c=_0xe706[_0x44b362];return _0x38b45c;};'use strict';var multer=require(_0x6e70('0x0'));var util=require(_0x6e70('0x1'));var path=require(_0x6e70('0x2'));var timeout=require('connect-timeout');var express=require(_0x6e70('0x3'));var router=express[_0x6e70('0x4')]();var fs_extra=require(_0x6e70('0x5'));var auth=require(_0x6e70('0x6'));var interaction=require(_0x6e70('0x7'));var config=require(_0x6e70('0x8'));module[_0x6e70('0x9')]=router; \ No newline at end of file +var _0xa9e0=['../../components/interaction/service','../../config/environment','exports','multer','util','path','Router','../../components/auth/service'];(function(_0x11141a,_0x669621){var _0x1c08c5=function(_0xc19bad){while(--_0xc19bad){_0x11141a['push'](_0x11141a['shift']());}};_0x1c08c5(++_0x669621);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));module[_0x0a9e('0x7')]=router; \ No newline at end of file diff --git a/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js b/server/api/userWhatsappQueue/userWhatsappQueue.attributes.js index e6d057a..1a0952a 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 _0xa73c=['sequelize','INTEGER'];(function(_0x54128a,_0x128d4d){var _0x6b9354=function(_0x21e0b8){while(--_0x21e0b8){_0x54128a['push'](_0x54128a['shift']());}};_0x6b9354(++_0x128d4d);}(_0xa73c,0x15e));var _0xca73=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xa73c[_0x14add3];return _0x4a174f;};'use strict';var Sequelize=require(_0xca73('0x0'));module['exports']={'penalty':{'type':Sequelize[_0xca73('0x1')],'defaultValue':0x0}}; \ No newline at end of file +var _0x09f4=['INTEGER'];(function(_0x55a5d4,_0x37fb90){var _0x83aff7=function(_0x50ebec){while(--_0x50ebec){_0x55a5d4['push'](_0x55a5d4['shift']());}};_0x83aff7(++_0x37fb90);}(_0x09f4,0xe4));var _0x409f=function(_0x296e4f,_0x1319bd){_0x296e4f=_0x296e4f-0x0;var _0x4484bd=_0x09f4[_0x296e4f];return _0x4484bd;};'use strict';var Sequelize=require('sequelize');module['exports']={'penalty':{'type':Sequelize[_0x409f('0x0')],'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 2549a9f..0ec96da 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 _0xdd7d=['rimraf','../../config/environment','./userWhatsappQueue.attributes','define','UserWhatsappQueue','user_has_whatsapp_queues','lodash','util','../../config/logger','moment','request-promise','path'];(function(_0x597bd7,_0x101b45){var _0xdb13b7=function(_0x4e1e76){while(--_0x4e1e76){_0x597bd7['push'](_0x597bd7['shift']());}};_0xdb13b7(++_0x101b45);}(_0xdd7d,0x162));var _0xddd7=function(_0x3d3b83,_0xcdf602){_0x3d3b83=_0x3d3b83-0x0;var _0x3d23f5=_0xdd7d[_0x3d3b83];return _0x3d23f5;};'use strict';var _=require(_0xddd7('0x0'));var util=require(_0xddd7('0x1'));var logger=require(_0xddd7('0x2'))('api');var moment=require(_0xddd7('0x3'));var BPromise=require('bluebird');var rp=require(_0xddd7('0x4'));var fs=require('fs');var path=require(_0xddd7('0x5'));var rimraf=require(_0xddd7('0x6'));var config=require(_0xddd7('0x7'));var attributes=require(_0xddd7('0x8'));module['exports']=function(_0x29fd3f,_0x18c6d8){return _0x29fd3f[_0xddd7('0x9')](_0xddd7('0xa'),attributes,{'tableName':_0xddd7('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x3a78=['../../config/environment','exports','define','UserWhatsappQueue','user_has_whatsapp_queues','api','request-promise','path'];(function(_0x2850e3,_0x2e3230){var _0x281c9a=function(_0x5ca9a1){while(--_0x5ca9a1){_0x2850e3['push'](_0x2850e3['shift']());}};_0x281c9a(++_0x2e3230);}(_0x3a78,0xcd));var _0x83a7=function(_0x429948,_0x1a6851){_0x429948=_0x429948-0x0;var _0x35d5d1=_0x3a78[_0x429948];return _0x35d5d1;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x83a7('0x0'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x83a7('0x1'));var fs=require('fs');var path=require(_0x83a7('0x2'));var rimraf=require('rimraf');var config=require(_0x83a7('0x3'));var attributes=require('./userWhatsappQueue.attributes');module[_0x83a7('0x4')]=function(_0x4d48fa,_0x20ca8d){return _0x4d48fa[_0x83a7('0x5')](_0x83a7('0x6'),attributes,{'tableName':_0x83a7('0x7'),'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 5cde2d3..56d653c 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 _0x4c73=['catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','then','info','UserWhatsappQueue,\x20%s,\x20%s','request\x20sent','UserWhatsappQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','result'];(function(_0x5b0294,_0x1a8555){var _0x1f20af=function(_0x519c69){while(--_0x519c69){_0x5b0294['push'](_0x5b0294['shift']());}};_0x1f20af(++_0x1a8555);}(_0x4c73,0x14b));var _0x34c7=function(_0x2e8800,_0x2e6b83){_0x2e8800=_0x2e8800-0x0;var _0x338ad3=_0x4c73[_0x2e8800];return _0x338ad3;};'use strict';var _=require('lodash');var util=require(_0x34c7('0x0'));var moment=require('moment');var BPromise=require(_0x34c7('0x1'));var rs=require(_0x34c7('0x2'));var fs=require('fs');var Redis=require(_0x34c7('0x3'));var db=require(_0x34c7('0x4'))['db'];var utils=require(_0x34c7('0x5'));var logger=require(_0x34c7('0x6'))(_0x34c7('0x7'));var config=require('../../config/environment');var jayson=require(_0x34c7('0x8'));var client=jayson[_0x34c7('0x9')][_0x34c7('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37483d,_0x10df80,_0xee2726){return new BPromise(function(_0x5c1355,_0x13735c){return client['request'](_0x37483d,_0xee2726)[_0x34c7('0xb')](function(_0x53c905){logger[_0x34c7('0xc')](_0x34c7('0xd'),_0x10df80,_0x34c7('0xe'));logger['debug'](_0x34c7('0xf'),_0x10df80,'request\x20sent',JSON[_0x34c7('0x10')](_0x53c905));if(_0x53c905['error']){if(_0x53c905['error'][_0x34c7('0x11')]===0x1f4){logger['error'](_0x34c7('0xd'),_0x10df80,_0x53c905[_0x34c7('0x12')][_0x34c7('0x13')]);return _0x13735c(_0x53c905[_0x34c7('0x12')][_0x34c7('0x13')]);}logger[_0x34c7('0x12')](_0x34c7('0xd'),_0x10df80,_0x53c905[_0x34c7('0x12')][_0x34c7('0x13')]);return _0x5c1355(_0x53c905[_0x34c7('0x12')][_0x34c7('0x13')]);}else{logger[_0x34c7('0xc')](_0x34c7('0xd'),_0x10df80,_0x34c7('0xe'));_0x5c1355(_0x53c905[_0x34c7('0x14')][_0x34c7('0x13')]);}})[_0x34c7('0x15')](function(_0x318dd8){logger[_0x34c7('0x12')](_0x34c7('0xd'),_0x10df80,_0x318dd8);_0x13735c(_0x318dd8);});});} \ No newline at end of file +var _0xbaa9=['request\x20sent','stringify','error','message','UserWhatsappQueue,\x20%s,\x20%s','result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','debug','UserWhatsappQueue,\x20%s,\x20%s,\x20%s'];(function(_0x37c22c,_0x28a70d){var _0x119d79=function(_0x243a13){while(--_0x243a13){_0x37c22c['push'](_0x37c22c['shift']());}};_0x119d79(++_0x28a70d);}(_0xbaa9,0x13a));var _0x9baa=function(_0x6139f4,_0x4f625e){_0x6139f4=_0x6139f4-0x0;var _0x49c372=_0xbaa9[_0x6139f4];return _0x49c372;};'use strict';var _=require('lodash');var util=require(_0x9baa('0x0'));var moment=require('moment');var BPromise=require(_0x9baa('0x1'));var rs=require(_0x9baa('0x2'));var fs=require('fs');var Redis=require(_0x9baa('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x9baa('0x4'));var logger=require(_0x9baa('0x5'))(_0x9baa('0x6'));var config=require(_0x9baa('0x7'));var jayson=require(_0x9baa('0x8'));var client=jayson[_0x9baa('0x9')][_0x9baa('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2fae75,_0x50b6fb,_0x48c580){return new BPromise(function(_0x2dc29e,_0x4ab700){return client[_0x9baa('0xb')](_0x2fae75,_0x48c580)[_0x9baa('0xc')](function(_0x43298c){logger[_0x9baa('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x50b6fb,'request\x20sent');logger[_0x9baa('0xe')](_0x9baa('0xf'),_0x50b6fb,_0x9baa('0x10'),JSON[_0x9baa('0x11')](_0x43298c));if(_0x43298c[_0x9baa('0x12')]){if(_0x43298c[_0x9baa('0x12')]['code']===0x1f4){logger['error']('UserWhatsappQueue,\x20%s,\x20%s',_0x50b6fb,_0x43298c[_0x9baa('0x12')][_0x9baa('0x13')]);return _0x4ab700(_0x43298c[_0x9baa('0x12')]['message']);}logger[_0x9baa('0x12')](_0x9baa('0x14'),_0x50b6fb,_0x43298c['error']['message']);return _0x2dc29e(_0x43298c[_0x9baa('0x12')][_0x9baa('0x13')]);}else{logger[_0x9baa('0xd')]('UserWhatsappQueue,\x20%s,\x20%s',_0x50b6fb,'request\x20sent');_0x2dc29e(_0x43298c[_0x9baa('0x15')]['message']);}})['catch'](function(_0x411e11){logger[_0x9baa('0x12')](_0x9baa('0x14'),_0x50b6fb,_0x411e11);_0x4ab700(_0x411e11);});});} \ No newline at end of file diff --git a/server/api/variable/index.js b/server/api/variable/index.js index c4c3154..4e425c6 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 _0x177a=['multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./variable.controller','get','isAuthenticated','index','/:id','show','put','update','delete','exports'];(function(_0x4a7db3,_0x57eb6c){var _0x1124d0=function(_0x460ecc){while(--_0x460ecc){_0x4a7db3['push'](_0x4a7db3['shift']());}};_0x1124d0(++_0x57eb6c);}(_0x177a,0xdd));var _0xa177=function(_0x3697ae,_0x3609f9){_0x3697ae=_0x3697ae-0x0;var _0x528378=_0x177a[_0x3697ae];return _0x528378;};'use strict';var multer=require(_0xa177('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xa177('0x1'));var express=require(_0xa177('0x2'));var router=express[_0xa177('0x3')]();var fs_extra=require(_0xa177('0x4'));var auth=require(_0xa177('0x5'));var interaction=require(_0xa177('0x6'));var config=require('../../config/environment');var controller=require(_0xa177('0x7'));router[_0xa177('0x8')]('/',auth[_0xa177('0x9')](),controller[_0xa177('0xa')]);router[_0xa177('0x8')](_0xa177('0xb'),auth[_0xa177('0x9')](),controller[_0xa177('0xc')]);router['post']('/',auth[_0xa177('0x9')](),controller['create']);router[_0xa177('0xd')](_0xa177('0xb'),auth[_0xa177('0x9')](),controller[_0xa177('0xe')]);router[_0xa177('0xf')](_0xa177('0xb'),auth[_0xa177('0x9')](),controller['destroy']);module[_0xa177('0x10')]=router; \ No newline at end of file +var _0xa2ab=['util','path','express','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./variable.controller','isAuthenticated','index','get','show','post','put','/:id','update','delete','destroy','exports','multer'];(function(_0x5b561d,_0x422b7c){var _0x431060=function(_0x401409){while(--_0x401409){_0x5b561d['push'](_0x5b561d['shift']());}};_0x431060(++_0x422b7c);}(_0xa2ab,0xa7));var _0xba2a=function(_0x213508,_0x5f3ff0){_0x213508=_0x213508-0x0;var _0x1b0363=_0xa2ab[_0x213508];return _0x1b0363;};'use strict';var multer=require(_0xba2a('0x0'));var util=require(_0xba2a('0x1'));var path=require(_0xba2a('0x2'));var timeout=require('connect-timeout');var express=require(_0xba2a('0x3'));var router=express[_0xba2a('0x4')]();var fs_extra=require(_0xba2a('0x5'));var auth=require(_0xba2a('0x6'));var interaction=require(_0xba2a('0x7'));var config=require(_0xba2a('0x8'));var controller=require(_0xba2a('0x9'));router['get']('/',auth[_0xba2a('0xa')](),controller[_0xba2a('0xb')]);router[_0xba2a('0xc')]('/:id',auth[_0xba2a('0xa')](),controller[_0xba2a('0xd')]);router[_0xba2a('0xe')]('/',auth[_0xba2a('0xa')](),controller['create']);router[_0xba2a('0xf')](_0xba2a('0x10'),auth[_0xba2a('0xa')](),controller[_0xba2a('0x11')]);router[_0xba2a('0x12')]('/:id',auth[_0xba2a('0xa')](),controller[_0xba2a('0x13')]);module[_0xba2a('0x14')]=router; \ No newline at end of file diff --git a/server/api/variable/variable.attributes.js b/server/api/variable/variable.attributes.js index e3e00b1..da2d4d5 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 _0xb9f7=['STRING','name','sequelize'];(function(_0x52e21c,_0x318a16){var _0x48879d=function(_0x14f720){while(--_0x14f720){_0x52e21c['push'](_0x52e21c['shift']());}};_0x48879d(++_0x318a16);}(_0xb9f7,0x1df));var _0x7b9f=function(_0x469a3c,_0x5ebc10){_0x469a3c=_0x469a3c-0x0;var _0x968f4=_0xb9f7[_0x469a3c];return _0x968f4;};'use strict';var Sequelize=require(_0x7b9f('0x0'));module['exports']={'name':{'type':Sequelize[_0x7b9f('0x1')],'unique':_0x7b9f('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file +var _0xd6b2=['sequelize','exports','name'];(function(_0x21374c,_0x808c3f){var _0x4c2a3e=function(_0x23af35){while(--_0x23af35){_0x21374c['push'](_0x21374c['shift']());}};_0x4c2a3e(++_0x808c3f);}(_0xd6b2,0x18f));var _0x2d6b=function(_0x258a29,_0x309152){_0x258a29=_0x258a29-0x0;var _0x49261b=_0xd6b2[_0x258a29];return _0x49261b;};'use strict';var Sequelize=require(_0x2d6b('0x0'));module[_0x2d6b('0x1')]={'name':{'type':Sequelize['STRING'],'unique':_0x2d6b('0x2'),'allowNull':![],'validate':{'notEmpty':!![]}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/variable/variable.controller.js b/server/api/variable/variable.controller.js index da13235..bc181cf 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 _0x918c=['json','reject','then','destroy','get','Variables','UserProfileResource','name','send','index','map','Variable','fieldName','model','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','limit','order','sort','where','pick','merge','type','VIRTUAL','filter','options','includeAll','include','findAll','rows','catch','show','params','rawAttributes','length','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','eml-format','rimraf','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','end','status','offset','undefined','count','Content-Range'];(function(_0x2b236b,_0x285b7f){var _0x2c24cb=function(_0x4b25a1){while(--_0x4b25a1){_0x2b236b['push'](_0x2b236b['shift']());}};_0x2c24cb(++_0x285b7f);}(_0x918c,0x1d2));var _0xc918=function(_0x307d86,_0x9264f2){_0x307d86=_0x307d86-0x0;var _0x361745=_0x918c[_0x307d86];return _0x361745;};'use strict';var emlformat=require(_0xc918('0x0'));var rimraf=require(_0xc918('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xc918('0x2'));var BPromise=require(_0xc918('0x3'));var Mustache=require(_0xc918('0x4'));var util=require(_0xc918('0x5'));var path=require(_0xc918('0x6'));var sox=require(_0xc918('0x7'));var csv=require(_0xc918('0x8'));var ejs=require(_0xc918('0x9'));var fs=require('fs');var fs_extra=require(_0xc918('0xa'));var _=require(_0xc918('0xb'));var squel=require(_0xc918('0xc'));var crypto=require('crypto');var jsforce=require(_0xc918('0xd'));var deskjs=require('desk.js');var toCsv=require(_0xc918('0x8'));var querystring=require(_0xc918('0xe'));var Papa=require(_0xc918('0xf'));var Redis=require(_0xc918('0x10'));var authService=require(_0xc918('0x11'));var qs=require(_0xc918('0x12'));var as=require(_0xc918('0x13'));var hardwareService=require(_0xc918('0x14'));var logger=require('../../config/logger')(_0xc918('0x15'));var utils=require(_0xc918('0x16'));var config=require(_0xc918('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0xc918('0x18'))['db'];function respondWithStatusCode(_0x2ac443,_0x292b6d){_0x292b6d=_0x292b6d||0xcc;return function(_0x56350c){if(_0x56350c){return _0x2ac443[_0xc918('0x19')](_0x292b6d);}return _0x2ac443['status'](_0x292b6d)[_0xc918('0x1a')]();};}function respondWithResult(_0x214e42,_0x4bb4bd){_0x4bb4bd=_0x4bb4bd||0xc8;return function(_0x502df3){if(_0x502df3){return _0x214e42[_0xc918('0x1b')](_0x4bb4bd)['json'](_0x502df3);}};}function respondWithFilteredResult(_0x414c70,_0x1b3cec){return function(_0x3101cd){if(_0x3101cd){var _0x50e86f=typeof _0x1b3cec[_0xc918('0x1c')]===_0xc918('0x1d')&&typeof _0x1b3cec['limit']===_0xc918('0x1d');var _0x547bff=_0x3101cd[_0xc918('0x1e')];var _0x12c81d=_0x50e86f?0x0:_0x1b3cec[_0xc918('0x1c')];var _0x355055=_0x50e86f?_0x3101cd[_0xc918('0x1e')]:_0x1b3cec['offset']+_0x1b3cec['limit'];var _0x274de9;if(_0x355055>=_0x547bff){_0x355055=_0x547bff;_0x274de9=0xc8;}else{_0x274de9=0xce;}_0x414c70[_0xc918('0x1b')](_0x274de9);return _0x414c70['set'](_0xc918('0x1f'),_0x12c81d+'-'+_0x355055+'/'+_0x547bff)[_0xc918('0x20')](_0x3101cd);}return null;};}function patchUpdates(_0x446ff2){return function(_0x22e47f){try{jsonpatch['apply'](_0x22e47f,_0x446ff2,!![]);}catch(_0x1edf11){return BPromise[_0xc918('0x21')](_0x1edf11);}return _0x22e47f['save']();};}function saveUpdates(_0x470ed0,_0xc76810){return function(_0x53fb73){if(_0x53fb73){return _0x53fb73['update'](_0x470ed0)[_0xc918('0x22')](function(_0x5e0285){return _0x5e0285;});}return null;};}function removeEntity(_0x180969,_0x524de4){return function(_0x3060ab){if(_0x3060ab){return _0x3060ab[_0xc918('0x23')]()['then'](function(){var _0x126a02=_0x3060ab[_0xc918('0x24')]({'plain':!![]});var _0x4752f7=_0xc918('0x25');return db[_0xc918('0x26')][_0xc918('0x23')]({'where':{'type':_0x4752f7,'resourceId':_0x126a02['id']}})[_0xc918('0x22')](function(){return _0x3060ab;});})[_0xc918('0x22')](function(){_0x180969[_0xc918('0x1b')](0xcc)[_0xc918('0x1a')]();});}};}function handleEntityNotFound(_0xf2712a,_0x6e3077){return function(_0x48e053){if(!_0x48e053){_0xf2712a[_0xc918('0x19')](0x194);}return _0x48e053;};}function handleError(_0x186ada,_0x314a1e){_0x314a1e=_0x314a1e||0x1f4;return function(_0x409ec3){logger['error'](_0x409ec3['stack']);if(_0x409ec3[_0xc918('0x27')]){delete _0x409ec3[_0xc918('0x27')];}_0x186ada[_0xc918('0x1b')](_0x314a1e)[_0xc918('0x28')](_0x409ec3);};}exports[_0xc918('0x29')]=function(_0x6245d4,_0x1a7e57){var _0x17817b={},_0x406419={},_0x377207={'count':0x0,'rows':[]};var _0x379050=_[_0xc918('0x2a')](db[_0xc918('0x2b')]['rawAttributes'],function(_0x19a8f9){return{'name':_0x19a8f9[_0xc918('0x2c')],'type':_0x19a8f9['type']['key']};});_0x406419[_0xc918('0x2d')]=_[_0xc918('0x2a')](_0x379050,_0xc918('0x27'));_0x406419[_0xc918('0x2e')]=_[_0xc918('0x2f')](_0x6245d4[_0xc918('0x2e')]);_0x406419[_0xc918('0x30')]=_['intersection'](_0x406419['model'],_0x406419[_0xc918('0x2e')]);_0x17817b['attributes']=_[_0xc918('0x31')](_0x406419[_0xc918('0x2d')],qs[_0xc918('0x32')](_0x6245d4[_0xc918('0x2e')][_0xc918('0x32')]));_0x17817b[_0xc918('0x33')]=_0x17817b['attributes']['length']?_0x17817b[_0xc918('0x33')]:_0x406419[_0xc918('0x2d')];if(!_0x6245d4['query'][_0xc918('0x34')](_0xc918('0x35'))){_0x17817b[_0xc918('0x36')]=qs[_0xc918('0x36')](_0x6245d4[_0xc918('0x2e')][_0xc918('0x36')]);_0x17817b['offset']=qs['offset'](_0x6245d4[_0xc918('0x2e')][_0xc918('0x1c')]);}_0x17817b[_0xc918('0x37')]=qs[_0xc918('0x38')](_0x6245d4[_0xc918('0x2e')][_0xc918('0x38')]);_0x17817b[_0xc918('0x39')]=qs[_0xc918('0x30')](_[_0xc918('0x3a')](_0x6245d4[_0xc918('0x2e')],_0x406419['filters']),_0x379050);if(_0x6245d4[_0xc918('0x2e')]['filter']){_0x17817b['where']=_[_0xc918('0x3b')](_0x17817b[_0xc918('0x39')],{'$or':_[_0xc918('0x2a')](_0x379050,function(_0x10aa5b){if(_0x10aa5b[_0xc918('0x3c')]!==_0xc918('0x3d')){var _0x6db494={};_0x6db494[_0x10aa5b[_0xc918('0x27')]]={'$like':'%'+_0x6245d4[_0xc918('0x2e')][_0xc918('0x3e')]+'%'};return _0x6db494;}})});}_0x17817b=_[_0xc918('0x3b')]({},_0x17817b,_0x6245d4[_0xc918('0x3f')]);var _0x5605d5={'where':_0x17817b[_0xc918('0x39')]};return db[_0xc918('0x2b')][_0xc918('0x1e')](_0x5605d5)['then'](function(_0x190547){_0x377207[_0xc918('0x1e')]=_0x190547;if(_0x6245d4[_0xc918('0x2e')][_0xc918('0x40')]){_0x17817b[_0xc918('0x41')]=[{'all':!![]}];}return db[_0xc918('0x2b')][_0xc918('0x42')](_0x17817b);})[_0xc918('0x22')](function(_0x1c19f4){_0x377207[_0xc918('0x43')]=_0x1c19f4;return _0x377207;})[_0xc918('0x22')](respondWithFilteredResult(_0x1a7e57,_0x17817b))[_0xc918('0x44')](handleError(_0x1a7e57,null));};exports[_0xc918('0x45')]=function(_0x16a11d,_0x3cf12a){var _0x4c607c={'raw':!![],'where':{'id':_0x16a11d[_0xc918('0x46')]['id']}},_0x3951b9={};_0x3951b9[_0xc918('0x2d')]=_[_0xc918('0x2f')](db['Variable'][_0xc918('0x47')]);_0x3951b9[_0xc918('0x2e')]=_[_0xc918('0x2f')](_0x16a11d[_0xc918('0x2e')]);_0x3951b9[_0xc918('0x30')]=_[_0xc918('0x31')](_0x3951b9[_0xc918('0x2d')],_0x3951b9[_0xc918('0x2e')]);_0x4c607c[_0xc918('0x33')]=_[_0xc918('0x31')](_0x3951b9[_0xc918('0x2d')],qs[_0xc918('0x32')](_0x16a11d['query'][_0xc918('0x32')]));_0x4c607c[_0xc918('0x33')]=_0x4c607c['attributes'][_0xc918('0x48')]?_0x4c607c[_0xc918('0x33')]:_0x3951b9['model'];if(_0x16a11d[_0xc918('0x2e')][_0xc918('0x40')]){_0x4c607c['include']=[{'all':!![]}];}_0x4c607c=_[_0xc918('0x3b')]({},_0x4c607c,_0x16a11d[_0xc918('0x3f')]);return db[_0xc918('0x2b')][_0xc918('0x49')](_0x4c607c)[_0xc918('0x22')](handleEntityNotFound(_0x3cf12a,null))[_0xc918('0x22')](respondWithResult(_0x3cf12a,null))['catch'](handleError(_0x3cf12a,null));};exports[_0xc918('0x4a')]=function(_0x3ea9e5,_0x4b71b5){return db['Variable'][_0xc918('0x4a')](_0x3ea9e5[_0xc918('0x4b')],{})['then'](function(_0x469299){var _0xb32f85=_0x3ea9e5[_0xc918('0x4c')][_0xc918('0x24')]({'plain':!![]});if(!_0xb32f85)throw new Error(_0xc918('0x4d'));if(_0xb32f85['role']==='user'){var _0x588af4=_0x469299[_0xc918('0x24')]({'plain':!![]});var _0x482625=_0xc918('0x25');return db[_0xc918('0x4e')][_0xc918('0x49')]({'where':{'name':_0x482625,'userProfileId':_0xb32f85[_0xc918('0x4f')]},'raw':!![]})[_0xc918('0x22')](function(_0x193532){if(_0x193532&&_0x193532['autoAssociation']===0x0){return db[_0xc918('0x26')]['create']({'name':_0x588af4[_0xc918('0x27')],'resourceId':_0x588af4['id'],'type':_0x193532[_0xc918('0x27')],'sectionId':_0x193532['id']},{})['then'](function(){return _0x469299;});}else{return _0x469299;}})['catch'](function(_0x4ea4fc){logger[_0xc918('0x50')](_0xc918('0x51'),_0x4ea4fc);throw _0x4ea4fc;});}return _0x469299;})[_0xc918('0x22')](respondWithResult(_0x4b71b5,0xc9))[_0xc918('0x44')](handleError(_0x4b71b5,null));};exports[_0xc918('0x52')]=function(_0x1cc2af,_0xa52744){if(_0x1cc2af['body']['id']){delete _0x1cc2af[_0xc918('0x4b')]['id'];}return db[_0xc918('0x2b')][_0xc918('0x49')]({'where':{'id':_0x1cc2af['params']['id']}})[_0xc918('0x22')](handleEntityNotFound(_0xa52744,null))[_0xc918('0x22')](saveUpdates(_0x1cc2af[_0xc918('0x4b')],null))[_0xc918('0x22')](respondWithResult(_0xa52744,null))[_0xc918('0x44')](handleError(_0xa52744,null));};exports[_0xc918('0x23')]=function(_0x92f8f,_0x298e50){return db[_0xc918('0x2b')]['find']({'where':{'id':_0x92f8f['params']['id']}})['then'](handleEntityNotFound(_0x298e50,null))['then'](removeEntity(_0x298e50,null))['catch'](handleError(_0x298e50,null));}; \ No newline at end of file +var _0x03db=['destroy','then','Variables','UserProfileResource','end','error','stack','name','send','index','map','Variable','type','key','query','keys','filters','intersection','fields','attributes','length','model','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','include','findAll','catch','show','params','rawAttributes','includeAll','create','body','user','get','UserProfileSection','find','autoAssociation','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','papaparse','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','json','offset','limit','undefined','count','set','apply','reject','update'];(function(_0xc6be3a,_0x540e05){var _0x56a310=function(_0x50a144){while(--_0x50a144){_0xc6be3a['push'](_0xc6be3a['shift']());}};_0x56a310(++_0x540e05);}(_0x03db,0x125));var _0xb03d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x03db[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb03d('0x0'));var zipdir=require(_0xb03d('0x1'));var jsonpatch=require(_0xb03d('0x2'));var rp=require(_0xb03d('0x3'));var moment=require(_0xb03d('0x4'));var BPromise=require(_0xb03d('0x5'));var Mustache=require(_0xb03d('0x6'));var util=require(_0xb03d('0x7'));var path=require(_0xb03d('0x8'));var sox=require(_0xb03d('0x9'));var csv=require(_0xb03d('0xa'));var ejs=require(_0xb03d('0xb'));var fs=require('fs');var fs_extra=require(_0xb03d('0xc'));var _=require('lodash');var squel=require(_0xb03d('0xd'));var crypto=require(_0xb03d('0xe'));var jsforce=require('jsforce');var deskjs=require(_0xb03d('0xf'));var toCsv=require(_0xb03d('0xa'));var querystring=require(_0xb03d('0x10'));var Papa=require(_0xb03d('0x11'));var Redis=require(_0xb03d('0x12'));var authService=require(_0xb03d('0x13'));var qs=require(_0xb03d('0x14'));var as=require(_0xb03d('0x15'));var hardwareService=require(_0xb03d('0x16'));var logger=require(_0xb03d('0x17'))('api');var utils=require(_0xb03d('0x18'));var config=require(_0xb03d('0x19'));var licenseUtil=require(_0xb03d('0x1a'));var db=require(_0xb03d('0x1b'))['db'];function respondWithStatusCode(_0x3baa0c,_0xa07703){_0xa07703=_0xa07703||0xcc;return function(_0x4c5f27){if(_0x4c5f27){return _0x3baa0c[_0xb03d('0x1c')](_0xa07703);}return _0x3baa0c[_0xb03d('0x1d')](_0xa07703)['end']();};}function respondWithResult(_0xbb1395,_0x34a71b){_0x34a71b=_0x34a71b||0xc8;return function(_0x52aa78){if(_0x52aa78){return _0xbb1395['status'](_0x34a71b)[_0xb03d('0x1e')](_0x52aa78);}};}function respondWithFilteredResult(_0x9dca02,_0x1443d4){return function(_0x238c9f){if(_0x238c9f){var _0x3caed2=typeof _0x1443d4[_0xb03d('0x1f')]==='undefined'&&typeof _0x1443d4[_0xb03d('0x20')]===_0xb03d('0x21');var _0x523578=_0x238c9f[_0xb03d('0x22')];var _0x3df6d8=_0x3caed2?0x0:_0x1443d4[_0xb03d('0x1f')];var _0x59bbda=_0x3caed2?_0x238c9f[_0xb03d('0x22')]:_0x1443d4[_0xb03d('0x1f')]+_0x1443d4[_0xb03d('0x20')];var _0x3a247f;if(_0x59bbda>=_0x523578){_0x59bbda=_0x523578;_0x3a247f=0xc8;}else{_0x3a247f=0xce;}_0x9dca02['status'](_0x3a247f);return _0x9dca02[_0xb03d('0x23')]('Content-Range',_0x3df6d8+'-'+_0x59bbda+'/'+_0x523578)[_0xb03d('0x1e')](_0x238c9f);}return null;};}function patchUpdates(_0x4b00ca){return function(_0x71b2d6){try{jsonpatch[_0xb03d('0x24')](_0x71b2d6,_0x4b00ca,!![]);}catch(_0x1438f3){return BPromise[_0xb03d('0x25')](_0x1438f3);}return _0x71b2d6['save']();};}function saveUpdates(_0x1cab16,_0x1b18e8){return function(_0x31e847){if(_0x31e847){return _0x31e847[_0xb03d('0x26')](_0x1cab16)['then'](function(_0x2d7ca3){return _0x2d7ca3;});}return null;};}function removeEntity(_0x439cc1,_0x3eaa58){return function(_0x36fc57){if(_0x36fc57){return _0x36fc57[_0xb03d('0x27')]()[_0xb03d('0x28')](function(){var _0x3027d5=_0x36fc57['get']({'plain':!![]});var _0x6f6a7d=_0xb03d('0x29');return db[_0xb03d('0x2a')][_0xb03d('0x27')]({'where':{'type':_0x6f6a7d,'resourceId':_0x3027d5['id']}})[_0xb03d('0x28')](function(){return _0x36fc57;});})['then'](function(){_0x439cc1[_0xb03d('0x1d')](0xcc)[_0xb03d('0x2b')]();});}};}function handleEntityNotFound(_0x4684dc,_0x386b51){return function(_0x6db069){if(!_0x6db069){_0x4684dc[_0xb03d('0x1c')](0x194);}return _0x6db069;};}function handleError(_0x272c26,_0x6c407a){_0x6c407a=_0x6c407a||0x1f4;return function(_0x14d763){logger[_0xb03d('0x2c')](_0x14d763[_0xb03d('0x2d')]);if(_0x14d763[_0xb03d('0x2e')]){delete _0x14d763[_0xb03d('0x2e')];}_0x272c26[_0xb03d('0x1d')](_0x6c407a)[_0xb03d('0x2f')](_0x14d763);};}exports[_0xb03d('0x30')]=function(_0x2e179a,_0x31bd87){var _0x1b53f8={},_0x4a6a5f={},_0x1eab52={'count':0x0,'rows':[]};var _0x15baf3=_[_0xb03d('0x31')](db[_0xb03d('0x32')]['rawAttributes'],function(_0x25a886){return{'name':_0x25a886['fieldName'],'type':_0x25a886[_0xb03d('0x33')][_0xb03d('0x34')]};});_0x4a6a5f['model']=_[_0xb03d('0x31')](_0x15baf3,_0xb03d('0x2e'));_0x4a6a5f[_0xb03d('0x35')]=_[_0xb03d('0x36')](_0x2e179a['query']);_0x4a6a5f[_0xb03d('0x37')]=_[_0xb03d('0x38')](_0x4a6a5f['model'],_0x4a6a5f[_0xb03d('0x35')]);_0x1b53f8['attributes']=_[_0xb03d('0x38')](_0x4a6a5f['model'],qs['fields'](_0x2e179a[_0xb03d('0x35')][_0xb03d('0x39')]));_0x1b53f8[_0xb03d('0x3a')]=_0x1b53f8['attributes'][_0xb03d('0x3b')]?_0x1b53f8[_0xb03d('0x3a')]:_0x4a6a5f[_0xb03d('0x3c')];if(!_0x2e179a[_0xb03d('0x35')][_0xb03d('0x3d')](_0xb03d('0x3e'))){_0x1b53f8[_0xb03d('0x20')]=qs['limit'](_0x2e179a[_0xb03d('0x35')][_0xb03d('0x20')]);_0x1b53f8[_0xb03d('0x1f')]=qs[_0xb03d('0x1f')](_0x2e179a['query']['offset']);}_0x1b53f8[_0xb03d('0x3f')]=qs[_0xb03d('0x40')](_0x2e179a[_0xb03d('0x35')][_0xb03d('0x40')]);_0x1b53f8[_0xb03d('0x41')]=qs[_0xb03d('0x37')](_[_0xb03d('0x42')](_0x2e179a[_0xb03d('0x35')],_0x4a6a5f[_0xb03d('0x37')]),_0x15baf3);if(_0x2e179a['query'][_0xb03d('0x43')]){_0x1b53f8[_0xb03d('0x41')]=_[_0xb03d('0x44')](_0x1b53f8[_0xb03d('0x41')],{'$or':_[_0xb03d('0x31')](_0x15baf3,function(_0x33891b){if(_0x33891b[_0xb03d('0x33')]!=='VIRTUAL'){var _0x45af25={};_0x45af25[_0x33891b[_0xb03d('0x2e')]]={'$like':'%'+_0x2e179a['query']['filter']+'%'};return _0x45af25;}})});}_0x1b53f8=_['merge']({},_0x1b53f8,_0x2e179a['options']);var _0x20801f={'where':_0x1b53f8[_0xb03d('0x41')]};return db['Variable'][_0xb03d('0x22')](_0x20801f)[_0xb03d('0x28')](function(_0x3813d0){_0x1eab52[_0xb03d('0x22')]=_0x3813d0;if(_0x2e179a['query']['includeAll']){_0x1b53f8[_0xb03d('0x45')]=[{'all':!![]}];}return db['Variable'][_0xb03d('0x46')](_0x1b53f8);})[_0xb03d('0x28')](function(_0x2dc294){_0x1eab52['rows']=_0x2dc294;return _0x1eab52;})[_0xb03d('0x28')](respondWithFilteredResult(_0x31bd87,_0x1b53f8))[_0xb03d('0x47')](handleError(_0x31bd87,null));};exports[_0xb03d('0x48')]=function(_0x3022b9,_0x5e951c){var _0x113a45={'raw':!![],'where':{'id':_0x3022b9[_0xb03d('0x49')]['id']}},_0x1ee812={};_0x1ee812[_0xb03d('0x3c')]=_['keys'](db[_0xb03d('0x32')][_0xb03d('0x4a')]);_0x1ee812['query']=_[_0xb03d('0x36')](_0x3022b9[_0xb03d('0x35')]);_0x1ee812['filters']=_['intersection'](_0x1ee812['model'],_0x1ee812[_0xb03d('0x35')]);_0x113a45[_0xb03d('0x3a')]=_[_0xb03d('0x38')](_0x1ee812['model'],qs['fields'](_0x3022b9[_0xb03d('0x35')]['fields']));_0x113a45[_0xb03d('0x3a')]=_0x113a45[_0xb03d('0x3a')][_0xb03d('0x3b')]?_0x113a45[_0xb03d('0x3a')]:_0x1ee812[_0xb03d('0x3c')];if(_0x3022b9[_0xb03d('0x35')][_0xb03d('0x4b')]){_0x113a45[_0xb03d('0x45')]=[{'all':!![]}];}_0x113a45=_['merge']({},_0x113a45,_0x3022b9['options']);return db['Variable']['find'](_0x113a45)[_0xb03d('0x28')](handleEntityNotFound(_0x5e951c,null))['then'](respondWithResult(_0x5e951c,null))['catch'](handleError(_0x5e951c,null));};exports[_0xb03d('0x4c')]=function(_0x4d490e,_0x4e0971){return db[_0xb03d('0x32')]['create'](_0x4d490e[_0xb03d('0x4d')],{})[_0xb03d('0x28')](function(_0x5483b6){var _0x1e89ca=_0x4d490e[_0xb03d('0x4e')][_0xb03d('0x4f')]({'plain':!![]});if(!_0x1e89ca)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1e89ca['role']==='user'){var _0x50fa1e=_0x5483b6[_0xb03d('0x4f')]({'plain':!![]});var _0xfee0eb=_0xb03d('0x29');return db[_0xb03d('0x50')][_0xb03d('0x51')]({'where':{'name':_0xfee0eb,'userProfileId':_0x1e89ca['userProfileId']},'raw':!![]})[_0xb03d('0x28')](function(_0x17ede1){if(_0x17ede1&&_0x17ede1[_0xb03d('0x52')]===0x0){return db[_0xb03d('0x2a')][_0xb03d('0x4c')]({'name':_0x50fa1e[_0xb03d('0x2e')],'resourceId':_0x50fa1e['id'],'type':_0x17ede1[_0xb03d('0x2e')],'sectionId':_0x17ede1['id']},{})[_0xb03d('0x28')](function(){return _0x5483b6;});}else{return _0x5483b6;}})['catch'](function(_0x3e1e61){logger[_0xb03d('0x2c')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x3e1e61);throw _0x3e1e61;});}return _0x5483b6;})[_0xb03d('0x28')](respondWithResult(_0x4e0971,0xc9))[_0xb03d('0x47')](handleError(_0x4e0971,null));};exports[_0xb03d('0x26')]=function(_0xa18205,_0x5b7881){if(_0xa18205[_0xb03d('0x4d')]['id']){delete _0xa18205['body']['id'];}return db[_0xb03d('0x32')][_0xb03d('0x51')]({'where':{'id':_0xa18205['params']['id']}})[_0xb03d('0x28')](handleEntityNotFound(_0x5b7881,null))['then'](saveUpdates(_0xa18205[_0xb03d('0x4d')],null))[_0xb03d('0x28')](respondWithResult(_0x5b7881,null))['catch'](handleError(_0x5b7881,null));};exports[_0xb03d('0x27')]=function(_0x398090,_0xb1658d){return db[_0xb03d('0x32')][_0xb03d('0x51')]({'where':{'id':_0x398090[_0xb03d('0x49')]['id']}})['then'](handleEntityNotFound(_0xb1658d,null))['then'](removeEntity(_0xb1658d,null))['catch'](handleError(_0xb1658d,null));}; \ No newline at end of file diff --git a/server/api/variable/variable.model.js b/server/api/variable/variable.model.js index 9366079..2438076 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 _0xffcb=['define','Variable','tools_variables','lodash','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports'];(function(_0x12c5c7,_0x1f6254){var _0x4a0294=function(_0x222cc1){while(--_0x222cc1){_0x12c5c7['push'](_0x12c5c7['shift']());}};_0x4a0294(++_0x1f6254);}(_0xffcb,0xff));var _0xbffc=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0xffcb[_0x1facfa];return _0x9ec701;};'use strict';var _=require(_0xbffc('0x0'));var util=require('util');var logger=require(_0xbffc('0x1'))(_0xbffc('0x2'));var moment=require(_0xbffc('0x3'));var BPromise=require(_0xbffc('0x4'));var rp=require(_0xbffc('0x5'));var fs=require('fs');var path=require(_0xbffc('0x6'));var rimraf=require(_0xbffc('0x7'));var config=require(_0xbffc('0x8'));var attributes=require(_0xbffc('0x9'));module[_0xbffc('0xa')]=function(_0x28f62a,_0x4ba001){return _0x28f62a[_0xbffc('0xb')](_0xbffc('0xc'),attributes,{'tableName':_0xbffc('0xd'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb856=['util','../../config/logger','moment','bluebird','request-promise','path','rimraf','../../config/environment','./variable.attributes','exports','define','lodash'];(function(_0x368542,_0x15a971){var _0x56cf8f=function(_0x2141dd){while(--_0x2141dd){_0x368542['push'](_0x368542['shift']());}};_0x56cf8f(++_0x15a971);}(_0xb856,0x197));var _0x6b85=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xb856[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0x6b85('0x0'));var util=require(_0x6b85('0x1'));var logger=require(_0x6b85('0x2'))('api');var moment=require(_0x6b85('0x3'));var BPromise=require(_0x6b85('0x4'));var rp=require(_0x6b85('0x5'));var fs=require('fs');var path=require(_0x6b85('0x6'));var rimraf=require(_0x6b85('0x7'));var config=require(_0x6b85('0x8'));var attributes=require(_0x6b85('0x9'));module[_0x6b85('0xa')]=function(_0x1f6755,_0x949e79){return _0x1f6755[_0x6b85('0xb')]('Variable',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 50b960c..f932cb6 100644 --- a/server/api/variable/variable.rpc.js +++ b/server/api/variable/variable.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3e74=['catch','Variable','find','options','raw','where','attributes','include','map','model','then','ShowVariable','stringify','lodash','moment','bluebird','randomstring','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','request\x20sent','debug','error','Variable,\x20%s,\x20%s','message','info'];(function(_0x4409e7,_0x307f17){var _0x24c751=function(_0x3a7d33){while(--_0x3a7d33){_0x4409e7['push'](_0x4409e7['shift']());}};_0x24c751(++_0x307f17);}(_0x3e74,0x175));var _0x43e7=function(_0x147ee7,_0x179745){_0x147ee7=_0x147ee7-0x0;var _0x6b281d=_0x3e74[_0x147ee7];return _0x6b281d;};'use strict';var _=require(_0x43e7('0x0'));var util=require('util');var moment=require(_0x43e7('0x1'));var BPromise=require(_0x43e7('0x2'));var rs=require(_0x43e7('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x43e7('0x4'));var logger=require('../../config/logger')(_0x43e7('0x5'));var config=require(_0x43e7('0x6'));var jayson=require(_0x43e7('0x7'));var client=jayson[_0x43e7('0x8')][_0x43e7('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x503698,_0x45a0d1,_0x3491d6){return new BPromise(function(_0x2ede2d,_0x8528fc){return client[_0x43e7('0xa')](_0x503698,_0x3491d6)['then'](function(_0x212c6c){logger['info']('Variable,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'));logger[_0x43e7('0xc')]('Variable,\x20%s,\x20%s,\x20%s',_0x45a0d1,_0x43e7('0xb'),JSON['stringify'](_0x212c6c));if(_0x212c6c[_0x43e7('0xd')]){if(_0x212c6c[_0x43e7('0xd')]['code']===0x1f4){logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')][_0x43e7('0xf')]);return _0x8528fc(_0x212c6c['error']['message']);}logger[_0x43e7('0xd')](_0x43e7('0xe'),_0x45a0d1,_0x212c6c[_0x43e7('0xd')]['message']);return _0x2ede2d(_0x212c6c['error'][_0x43e7('0xf')]);}else{logger[_0x43e7('0x10')](_0x43e7('0xe'),_0x45a0d1,_0x43e7('0xb'));_0x2ede2d(_0x212c6c['result']['message']);}})[_0x43e7('0x11')](function(_0x264575){logger[_0x43e7('0xd')]('Variable,\x20%s,\x20%s',_0x45a0d1,_0x264575);_0x8528fc(_0x264575);});});}exports['ShowVariable']=function(_0x446986){var _0x1ca758=this;return new Promise(function(_0x9037d3,_0x140657){return db[_0x43e7('0x12')][_0x43e7('0x13')]({'raw':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x15')]===undefined?!![]:![]:!![],'where':_0x446986[_0x43e7('0x14')]?_0x446986[_0x43e7('0x14')][_0x43e7('0x16')]||null:null,'attributes':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x17')]||null:null,'include':_0x446986['options']?_0x446986[_0x43e7('0x14')][_0x43e7('0x18')]?_[_0x43e7('0x19')](_0x446986[_0x43e7('0x14')][_0x43e7('0x18')],function(_0x2f4cb4){return{'model':db[_0x2f4cb4['model']],'as':_0x2f4cb4['as'],'attributes':_0x2f4cb4[_0x43e7('0x17')],'include':_0x2f4cb4['include']?_['map'](_0x2f4cb4[_0x43e7('0x18')],function(_0x43f4ff){return{'model':db[_0x43f4ff['model']],'as':_0x43f4ff['as'],'attributes':_0x43f4ff[_0x43e7('0x17')],'include':_0x43f4ff['include']?_[_0x43e7('0x19')](_0x43f4ff['include'],function(_0x1af208){return{'model':db[_0x1af208[_0x43e7('0x1a')]],'as':_0x1af208['as'],'attributes':_0x1af208[_0x43e7('0x17')]};}):[]};}):[]};}):[]:[]})[_0x43e7('0x1b')](function(_0x51f4d7){logger['info'](_0x43e7('0x1c'),_0x446986);logger['debug'](_0x43e7('0x1c'),_0x446986,JSON[_0x43e7('0x1d')](_0x51f4d7));_0x9037d3(_0x51f4d7);})[_0x43e7('0x11')](function(_0xb1fc63){logger['error'](_0x43e7('0x1c'),_0xb1fc63[_0x43e7('0xf')],_0x446986);_0x140657(_0x1ca758[_0x43e7('0xd')](0x1f4,_0xb1fc63[_0x43e7('0xf')]));});});}; \ No newline at end of file +var _0x6aa7=['include','model','attributes','map','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','client','request','then','info','Variable,\x20%s,\x20%s','request\x20sent','debug','Variable,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowVariable','find','options','raw','where'];(function(_0x48c10a,_0x1ecf7e){var _0xe9d84b=function(_0x5237af){while(--_0x5237af){_0x48c10a['push'](_0x48c10a['shift']());}};_0xe9d84b(++_0x1ecf7e);}(_0x6aa7,0x178));var _0x76aa=function(_0x646821,_0x2eaed1){_0x646821=_0x646821-0x0;var _0x20e6db=_0x6aa7[_0x646821];return _0x20e6db;};'use strict';var _=require(_0x76aa('0x0'));var util=require('util');var moment=require(_0x76aa('0x1'));var BPromise=require(_0x76aa('0x2'));var rs=require(_0x76aa('0x3'));var fs=require('fs');var Redis=require(_0x76aa('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x76aa('0x5'));var logger=require(_0x76aa('0x6'))(_0x76aa('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x76aa('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x32dee5,_0x36d12b,_0xa9b695){return new BPromise(function(_0x56d6bc,_0x3dae33){return client[_0x76aa('0x9')](_0x32dee5,_0xa9b695)[_0x76aa('0xa')](function(_0x557d69){logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,_0x76aa('0xd'));logger[_0x76aa('0xe')](_0x76aa('0xf'),_0x36d12b,_0x76aa('0xd'),JSON[_0x76aa('0x10')](_0x557d69));if(_0x557d69[_0x76aa('0x11')]){if(_0x557d69[_0x76aa('0x11')][_0x76aa('0x12')]===0x1f4){logger['error'](_0x76aa('0xc'),_0x36d12b,_0x557d69['error'][_0x76aa('0x13')]);return _0x3dae33(_0x557d69[_0x76aa('0x11')][_0x76aa('0x13')]);}logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x557d69['error']['message']);return _0x56d6bc(_0x557d69[_0x76aa('0x11')]['message']);}else{logger[_0x76aa('0xb')](_0x76aa('0xc'),_0x36d12b,'request\x20sent');_0x56d6bc(_0x557d69[_0x76aa('0x14')]['message']);}})[_0x76aa('0x15')](function(_0x5181d2){logger[_0x76aa('0x11')](_0x76aa('0xc'),_0x36d12b,_0x5181d2);_0x3dae33(_0x5181d2);});});}exports[_0x76aa('0x16')]=function(_0x21c16d){var _0xa1bc7=this;return new Promise(function(_0x3ead3f,_0x496902){return db['Variable'][_0x76aa('0x17')]({'raw':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x19')]===undefined?!![]:![]:!![],'where':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1a')]||null:null,'attributes':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')]['attributes']||null:null,'include':_0x21c16d[_0x76aa('0x18')]?_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')]?_['map'](_0x21c16d[_0x76aa('0x18')][_0x76aa('0x1b')],function(_0x31252f){return{'model':db[_0x31252f[_0x76aa('0x1c')]],'as':_0x31252f['as'],'attributes':_0x31252f[_0x76aa('0x1d')],'include':_0x31252f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x31252f[_0x76aa('0x1b')],function(_0x32bf9f){return{'model':db[_0x32bf9f[_0x76aa('0x1c')]],'as':_0x32bf9f['as'],'attributes':_0x32bf9f[_0x76aa('0x1d')],'include':_0x32bf9f[_0x76aa('0x1b')]?_[_0x76aa('0x1e')](_0x32bf9f['include'],function(_0xb5e8a9){return{'model':db[_0xb5e8a9[_0x76aa('0x1c')]],'as':_0xb5e8a9['as'],'attributes':_0xb5e8a9[_0x76aa('0x1d')]};}):[]};}):[]};}):[]:[]})[_0x76aa('0xa')](function(_0xa1e6){logger[_0x76aa('0xb')](_0x76aa('0x16'),_0x21c16d);logger[_0x76aa('0xe')](_0x76aa('0x16'),_0x21c16d,JSON[_0x76aa('0x10')](_0xa1e6));_0x3ead3f(_0xa1e6);})['catch'](function(_0x3fcb7f){logger['error'](_0x76aa('0x16'),_0x3fcb7f[_0x76aa('0x13')],_0x21c16d);_0x496902(_0xa1bc7[_0x76aa('0x11')](0x1f4,_0x3fcb7f[_0x76aa('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/version/index.js b/server/api/version/index.js index 9ff4d50..be7b670 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 _0x1f2d=['get','index','/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull','pull','/restart','restart','/migrations','migrations','exports','express','Router','../../components/auth/service','./version.controller'];(function(_0x297d05,_0x43f75e){var _0x15b65c=function(_0x42effb){while(--_0x42effb){_0x297d05['push'](_0x297d05['shift']());}};_0x15b65c(++_0x43f75e);}(_0x1f2d,0x7a));var _0xd1f2=function(_0x486ab6,_0x257c0a){_0x486ab6=_0x486ab6-0x0;var _0x1ce5ea=_0x1f2d[_0x486ab6];return _0x1ce5ea;};'use strict';var express=require(_0xd1f2('0x0'));var router=express[_0xd1f2('0x1')]();var auth=require(_0xd1f2('0x2'));var controller=require(_0xd1f2('0x3'));router[_0xd1f2('0x4')]('/',controller[_0xd1f2('0x5')]);router[_0xd1f2('0x4')](_0xd1f2('0x6'),auth[_0xd1f2('0x7')](),auth[_0xd1f2('0x8')](),controller[_0xd1f2('0x9')]);router[_0xd1f2('0x4')](_0xd1f2('0xa'),auth[_0xd1f2('0x7')](),auth['canUpdate'](),controller['reset']);router['get'](_0xd1f2('0xb'),auth[_0xd1f2('0x7')](),auth[_0xd1f2('0x8')](),controller[_0xd1f2('0xc')]);router['get'](_0xd1f2('0xd'),auth['isAuthenticated'](),controller[_0xd1f2('0xe')]);router[_0xd1f2('0x4')](_0xd1f2('0xf'),controller[_0xd1f2('0x10')]);module[_0xd1f2('0x11')]=router; \ No newline at end of file +var _0x60ad=['index','/fetch','isAuthenticated','canUpdate','fetch','/reset','/pull','pull','/restart','restart','exports','express','./version.controller','get'];(function(_0x82a05,_0x2cd146){var _0x29bc7c=function(_0x28455b){while(--_0x28455b){_0x82a05['push'](_0x82a05['shift']());}};_0x29bc7c(++_0x2cd146);}(_0x60ad,0x1af));var _0xd60a=function(_0x2f7524,_0x4aa73a){_0x2f7524=_0x2f7524-0x0;var _0x2ac2f1=_0x60ad[_0x2f7524];return _0x2ac2f1;};'use strict';var express=require(_0xd60a('0x0'));var router=express['Router']();var auth=require('../../components/auth/service');var controller=require(_0xd60a('0x1'));router[_0xd60a('0x2')]('/',controller[_0xd60a('0x3')]);router['get'](_0xd60a('0x4'),auth[_0xd60a('0x5')](),auth[_0xd60a('0x6')](),controller[_0xd60a('0x7')]);router['get'](_0xd60a('0x8'),auth[_0xd60a('0x5')](),auth[_0xd60a('0x6')](),controller['reset']);router[_0xd60a('0x2')](_0xd60a('0x9'),auth[_0xd60a('0x5')](),auth[_0xd60a('0x6')](),controller[_0xd60a('0xa')]);router['get'](_0xd60a('0xb'),auth[_0xd60a('0x5')](),controller[_0xd60a('0xc')]);router[_0xd60a('0x2')]('/migrations',controller['migrations']);module[_0xd60a('0xd')]=router; \ No newline at end of file diff --git a/server/api/version/version.controller.js b/server/api/version/version.controller.js index 500b9fe..e91d732 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 _0xf34e=['origin','master','error','git\x20fetch\x20origin\x20master','reset','--hard','FETCH_HEAD','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','npm\x20install\x20--production','restart','motion2','then','pm2\x20restart\x20motion\x20%s','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','server','length','replace','.js','push','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','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','umzug','path','lodash','compare-versions','../../config/pm2','../../config/logger','update','simple-git','root','exports','version','query','fetch','tags','latest','2.0.0','status','json'];(function(_0x178f9c,_0x9dc87a){var _0x413f4a=function(_0xfe1042){while(--_0xfe1042){_0x178f9c['push'](_0x178f9c['shift']());}};_0x413f4a(++_0x9dc87a);}(_0xf34e,0x1cb));var _0xef34=function(_0x170e1d,_0x2c0730){_0x170e1d=_0x170e1d-0x0;var _0xf6087e=_0xf34e[_0x170e1d];return _0xf6087e;};'use strict';var Umzug=require(_0xef34('0x0'));var path=require(_0xef34('0x1'));var fs=require('fs');var _=require(_0xef34('0x2'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0xef34('0x3'));var exec=require('child_process')['exec'];var db=require('../../mysqldb')['db'];var config=require('../../config/environment');var pm2=require(_0xef34('0x4'));var logger=require(_0xef34('0x5'))(_0xef34('0x6'));var git=require(_0xef34('0x7'))(config[_0xef34('0x8')]);exports['index']=function(_0x271a1a,_0x309e65){var _0x4be387={'current':module[_0xef34('0x9')][_0xef34('0xa')],'phonebar':0x2};if(_0x271a1a[_0xef34('0xb')]&&_0x271a1a[_0xef34('0xb')]['latest']){return git[_0xef34('0xc')]()[_0xef34('0xd')](function(_0x201fb2,_0x225eca){_0x4be387[_0xef34('0xe')]=(_0x201fb2?module['exports'][_0xef34('0xa')]:_0x225eca[_0xef34('0xe')])||_0xef34('0xf');return _0x309e65[_0xef34('0x10')](0xc8)['json'](_0x4be387);});}else{return _0x309e65[_0xef34('0x10')](0xc8)[_0xef34('0x11')](_0x4be387);}};exports[_0xef34('0xc')]=function(_0x591488,_0x6cd2f8){return git[_0xef34('0xc')]([_0xef34('0x12'),_0xef34('0x13')],function(_0xe8df84){if(_0xe8df84){logger[_0xef34('0x14')](_0xe8df84);return _0x6cd2f8[_0xef34('0x10')](0x1f4)['json'](_0xe8df84);}logger['info']('git\x20fetch');return _0x6cd2f8[_0xef34('0x10')](0xc8)[_0xef34('0x11')]({'output':_0xef34('0x15')});});};exports[_0xef34('0x16')]=function(_0x414c73,_0x4acfd1){return git[_0xef34('0x16')]([_0xef34('0x17'),_0xef34('0x18')],function(_0x10c044){if(_0x10c044){logger[_0xef34('0x14')](_0x10c044);return _0x4acfd1[_0xef34('0x10')](0x1f4)[_0xef34('0x11')](_0x10c044);}logger[_0xef34('0x19')](_0xef34('0x1a'));return _0x4acfd1['status'](0xc8)[_0xef34('0x11')]({'output':_0xef34('0x1b')});});};exports['pull']=function(_0x221c22,_0x464e88){exec(_0xef34('0x1c'),function(_0x555323,_0x27c52d,_0x5daa25){logger[_0xef34('0x19')](_0x27c52d);logger[_0xef34('0x19')](_0x5daa25);if(_0x555323){logger[_0xef34('0x14')](_0x555323);return _0x464e88['status'](0x1f4)[_0xef34('0x11')](_0x555323);}return _0x464e88['status'](0xc8)[_0xef34('0x11')]({'output':_0x27c52d});});};exports['restart']=function(_0x5402a7,_0x380e88){return pm2[_0xef34('0x1d')](_0xef34('0x1e'))[_0xef34('0x1f')](function(_0x19f95d){logger['info'](_0xef34('0x20'),_0x19f95d);return _0x380e88['status'](0xc8)['json']({'output':_0xef34('0x21')});})[_0xef34('0x22')](function(_0x18a4ae){logger[_0xef34('0x14')](_0x18a4ae);return _0x380e88[_0xef34('0x10')](0x1f4)[_0xef34('0x11')](_0x18a4ae);});};exports[_0xef34('0x23')]=function(_0x5c089f,_0x40dcfc){var _0x3789c6=fs[_0xef34('0x24')](path['join'](config['root'],_0xef34('0x25'),_0xef34('0x23')));var _0x40d096=[];for(var _0x436cbe=0x0;_0x436cbe<_0x3789c6[_0xef34('0x26')];_0x436cbe++){var _0x32f71c=_0x3789c6[_0x436cbe][_0xef34('0x27')](_0xef34('0x28'),'');if(compareVersions(module[_0xef34('0x9')][_0xef34('0xa')],_0x32f71c)===-0x1){_0x40d096[_0xef34('0x29')](_0x32f71c);}}if(_0x40d096[_0xef34('0x26')]){var _0xb5acb2=_0x40d096['sort'](compareVersions);var _0x1c4516=new Umzug({'storage':'sequelize','storageOptions':{'model':db['Migration'],'modelName':_0xef34('0x2a'),'columnName':'version'},'migrations':{'params':[db[_0xef34('0x2b')]['getQueryInterface'](),db['sequelize'][_0xef34('0x2c')],function(){throw new Error(_0xef34('0x2d'));}],'path':path[_0xef34('0x2e')](config['root'],_0xef34('0x25'),_0xef34('0x23')),'pattern':/\.js$/}});_0x1c4516['up']({'migrations':_[_0xef34('0x2f')](_0xb5acb2,function(_0x39cac6){return _0x39cac6+_0xef34('0x28');})})['then'](function(){return _0x40dcfc[_0xef34('0x10')](0xc8)[_0xef34('0x11')]({'output':_0xef34('0x30')+module[_0xef34('0x9')][_0xef34('0xa')]+_0xef34('0x31')+_[_0xef34('0x32')](_0xb5acb2),'migrations':_[_0xef34('0x2e')](_0xb5acb2)});})[_0xef34('0x22')](function(_0x1beecd){if(_0x1beecd instanceof db[_0xef34('0x2b')][_0xef34('0x33')]){return _0x40dcfc[_0xef34('0x10')](0xc8)[_0xef34('0x11')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x40dcfc[_0xef34('0x10')](0x1f4)[_0xef34('0x11')](_0x1beecd);}});}else{return _0x40dcfc[_0xef34('0x10')](0xc8)['json']({'output':_0xef34('0x34')});}}; \ No newline at end of file +var _0x77dd=['status','json','origin','master','git\x20fetch','git\x20fetch\x20origin\x20master','reset','--hard','error','info','git\x20reset\x20--hard\x20FETCH_HEAD','git\x20reset\x20--hard','pull','npm\x20install\x20--production','restart','motion2','then','Your\x20system\x20has\x20been\x20restart\x20successfully','catch','migrations','readdirSync','join','replace','.js','push','sort','sequelize','Migration','getQueryInterface','constructor','map','Database\x20migrated\x20successfully\x20from\x20version\x20','\x20to\x20','last','UniqueConstraintError','Database\x20already\x20up-to-date','path','lodash','compare-versions','exec','../../mysqldb','../../config/environment','update','root','exports','version','query','latest','fetch'];(function(_0x7c13ed,_0x4d9dd5){var _0x4cad66=function(_0x3db414){while(--_0x3db414){_0x7c13ed['push'](_0x7c13ed['shift']());}};_0x4cad66(++_0x4d9dd5);}(_0x77dd,0xb7));var _0xd77d=function(_0x5c3c0b,_0x4ee35e){_0x5c3c0b=_0x5c3c0b-0x0;var _0x52ecd2=_0x77dd[_0x5c3c0b];return _0x52ecd2;};'use strict';var Umzug=require('umzug');var path=require(_0xd77d('0x0'));var fs=require('fs');var _=require(_0xd77d('0x1'));var pkginfo=require('pkginfo')(module,'version');var compareVersions=require(_0xd77d('0x2'));var exec=require('child_process')[_0xd77d('0x3')];var db=require(_0xd77d('0x4'))['db'];var config=require(_0xd77d('0x5'));var pm2=require('../../config/pm2');var logger=require('../../config/logger')(_0xd77d('0x6'));var git=require('simple-git')(config[_0xd77d('0x7')]);exports['index']=function(_0x417891,_0x16f302){var _0x25eb70={'current':module[_0xd77d('0x8')][_0xd77d('0x9')],'phonebar':0x2};if(_0x417891[_0xd77d('0xa')]&&_0x417891[_0xd77d('0xa')][_0xd77d('0xb')]){return git[_0xd77d('0xc')]()['tags'](function(_0x2480f7,_0x1f0d1a){_0x25eb70[_0xd77d('0xb')]=(_0x2480f7?module[_0xd77d('0x8')][_0xd77d('0x9')]:_0x1f0d1a[_0xd77d('0xb')])||'2.0.0';return _0x16f302[_0xd77d('0xd')](0xc8)[_0xd77d('0xe')](_0x25eb70);});}else{return _0x16f302[_0xd77d('0xd')](0xc8)[_0xd77d('0xe')](_0x25eb70);}};exports[_0xd77d('0xc')]=function(_0x151a3d,_0x437490){return git['fetch']([_0xd77d('0xf'),_0xd77d('0x10')],function(_0x1e855a){if(_0x1e855a){logger['error'](_0x1e855a);return _0x437490['status'](0x1f4)[_0xd77d('0xe')](_0x1e855a);}logger['info'](_0xd77d('0x11'));return _0x437490[_0xd77d('0xd')](0xc8)['json']({'output':_0xd77d('0x12')});});};exports[_0xd77d('0x13')]=function(_0x4e61c9,_0x44cbd6){return git[_0xd77d('0x13')]([_0xd77d('0x14'),'FETCH_HEAD'],function(_0x1f1006){if(_0x1f1006){logger[_0xd77d('0x15')](_0x1f1006);return _0x44cbd6[_0xd77d('0xd')](0x1f4)[_0xd77d('0xe')](_0x1f1006);}logger[_0xd77d('0x16')](_0xd77d('0x17'));return _0x44cbd6['status'](0xc8)[_0xd77d('0xe')]({'output':_0xd77d('0x18')});});};exports[_0xd77d('0x19')]=function(_0x37b118,_0x51bd4e){exec(_0xd77d('0x1a'),function(_0x5a9a95,_0xbb6c8d,_0x2ecd96){logger[_0xd77d('0x16')](_0xbb6c8d);logger['info'](_0x2ecd96);if(_0x5a9a95){logger['error'](_0x5a9a95);return _0x51bd4e['status'](0x1f4)['json'](_0x5a9a95);}return _0x51bd4e[_0xd77d('0xd')](0xc8)[_0xd77d('0xe')]({'output':_0xbb6c8d});});};exports[_0xd77d('0x1b')]=function(_0x4835e1,_0x368a97){return pm2['restart'](_0xd77d('0x1c'))[_0xd77d('0x1d')](function(_0x1105ce){logger['info']('pm2\x20restart\x20motion\x20%s',_0x1105ce);return _0x368a97[_0xd77d('0xd')](0xc8)[_0xd77d('0xe')]({'output':_0xd77d('0x1e')});})[_0xd77d('0x1f')](function(_0x54028d){logger[_0xd77d('0x15')](_0x54028d);return _0x368a97[_0xd77d('0xd')](0x1f4)['json'](_0x54028d);});};exports[_0xd77d('0x20')]=function(_0x4e489a,_0x5a5bd4){var _0x5c49ad=fs[_0xd77d('0x21')](path[_0xd77d('0x22')](config['root'],'server',_0xd77d('0x20')));var _0x3474c6=[];for(var _0x325a2c=0x0;_0x325a2c<_0x5c49ad['length'];_0x325a2c++){var _0x11f7b5=_0x5c49ad[_0x325a2c][_0xd77d('0x23')](_0xd77d('0x24'),'');if(compareVersions(module[_0xd77d('0x8')][_0xd77d('0x9')],_0x11f7b5)===-0x1){_0x3474c6[_0xd77d('0x25')](_0x11f7b5);}}if(_0x3474c6['length']){var _0x4d0406=_0x3474c6[_0xd77d('0x26')](compareVersions);var _0x48b230=new Umzug({'storage':_0xd77d('0x27'),'storageOptions':{'model':db[_0xd77d('0x28')],'modelName':_0xd77d('0x28'),'columnName':_0xd77d('0x9')},'migrations':{'params':[db[_0xd77d('0x27')][_0xd77d('0x29')](),db[_0xd77d('0x27')][_0xd77d('0x2a')],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['join'](config['root'],'server',_0xd77d('0x20')),'pattern':/\.js$/}});_0x48b230['up']({'migrations':_[_0xd77d('0x2b')](_0x4d0406,function(_0x199147){return _0x199147+'.js';})})[_0xd77d('0x1d')](function(){return _0x5a5bd4[_0xd77d('0xd')](0xc8)[_0xd77d('0xe')]({'output':_0xd77d('0x2c')+module['exports'][_0xd77d('0x9')]+_0xd77d('0x2d')+_[_0xd77d('0x2e')](_0x4d0406),'migrations':_[_0xd77d('0x22')](_0x4d0406)});})[_0xd77d('0x1f')](function(_0x248822){if(_0x248822 instanceof db['sequelize'][_0xd77d('0x2f')]){return _0x5a5bd4[_0xd77d('0xd')](0xc8)[_0xd77d('0xe')]({'output':'Database\x20already\x20up-to-date'});}else{return _0x5a5bd4[_0xd77d('0xd')](0x1f4)[_0xd77d('0xe')](_0x248822);}});}else{return _0x5a5bd4['status'](0xc8)['json']({'output':_0xd77d('0x30')});}}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/index.js b/server/api/voiceAgentReport/index.js index 536ffab..3bfd5bc 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 _0x49f8=['create','put','/:id','update','delete','destroy','util','path','express','../../config/environment','./voiceAgentReport.controller','get','isAuthenticated','index','/describe','describe','show','post'];(function(_0xcce6cc,_0x30126f){var _0x4a0ca1=function(_0x1d635d){while(--_0x1d635d){_0xcce6cc['push'](_0xcce6cc['shift']());}};_0x4a0ca1(++_0x30126f);}(_0x49f8,0x114));var _0x849f=function(_0x4f4bb8,_0x32e15d){_0x4f4bb8=_0x4f4bb8-0x0;var _0xf6e91f=_0x49f8[_0x4f4bb8];return _0xf6e91f;};'use strict';var multer=require('multer');var util=require(_0x849f('0x0'));var path=require(_0x849f('0x1'));var timeout=require('connect-timeout');var express=require(_0x849f('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require('../../components/interaction/service');var config=require(_0x849f('0x3'));var controller=require(_0x849f('0x4'));router[_0x849f('0x5')]('/',auth[_0x849f('0x6')](),controller[_0x849f('0x7')]);router[_0x849f('0x5')](_0x849f('0x8'),auth[_0x849f('0x6')](),controller[_0x849f('0x9')]);router[_0x849f('0x5')]('/:id',auth[_0x849f('0x6')](),controller[_0x849f('0xa')]);router[_0x849f('0xb')]('/',auth[_0x849f('0x6')](),controller[_0x849f('0xc')]);router[_0x849f('0xd')](_0x849f('0xe'),auth[_0x849f('0x6')](),controller[_0x849f('0xf')]);router[_0x849f('0x10')](_0x849f('0xe'),auth['isAuthenticated'](),controller[_0x849f('0x11')]);module['exports']=router; \ No newline at end of file +var _0x8370=['update','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceAgentReport.controller','isAuthenticated','get','/describe','describe','/:id','show','post','create','put'];(function(_0x15bc81,_0x4d4f77){var _0x59440e=function(_0x1b60f2){while(--_0x1b60f2){_0x15bc81['push'](_0x15bc81['shift']());}};_0x59440e(++_0x4d4f77);}(_0x8370,0x1a2));var _0x0837=function(_0x57e5a3,_0x13a3b0){_0x57e5a3=_0x57e5a3-0x0;var _0x5666dc=_0x8370[_0x57e5a3];return _0x5666dc;};'use strict';var multer=require(_0x0837('0x0'));var util=require(_0x0837('0x1'));var path=require(_0x0837('0x2'));var timeout=require(_0x0837('0x3'));var express=require(_0x0837('0x4'));var router=express[_0x0837('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x0837('0x6'));var interaction=require(_0x0837('0x7'));var config=require(_0x0837('0x8'));var controller=require(_0x0837('0x9'));router['get']('/',auth[_0x0837('0xa')](),controller['index']);router[_0x0837('0xb')](_0x0837('0xc'),auth[_0x0837('0xa')](),controller[_0x0837('0xd')]);router[_0x0837('0xb')](_0x0837('0xe'),auth[_0x0837('0xa')](),controller[_0x0837('0xf')]);router[_0x0837('0x10')]('/',auth[_0x0837('0xa')](),controller[_0x0837('0x11')]);router[_0x0837('0x12')](_0x0837('0xe'),auth[_0x0837('0xa')](),controller[_0x0837('0x13')]);router[_0x0837('0x14')](_0x0837('0xe'),auth[_0x0837('0xa')](),controller[_0x0837('0x15')]);module[_0x0837('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.attributes.js b/server/api/voiceAgentReport/voiceAgentReport.attributes.js index e7d70cd..22e39e8 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 _0x659c=['sequelize','STRING','DATE','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED'];(function(_0x6d6a66,_0x2924af){var _0x11eb6e=function(_0x52e55a){while(--_0x52e55a){_0x6d6a66['push'](_0x6d6a66['shift']());}};_0x11eb6e(++_0x2924af);}(_0x659c,0x1aa));var _0xc659=function(_0x5cf99f,_0x450e05){_0x5cf99f=_0x5cf99f-0x0;var _0xeedf3a=_0x659c[_0x5cf99f];return _0xeedf3a;};'use strict';var Sequelize=require(_0xc659('0x0'));module['exports']={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0xc659('0x1')]},'calleridnum':{'type':Sequelize[_0xc659('0x1')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize[_0xc659('0x1')]},'interface':{'type':Sequelize[_0xc659('0x1')]},'membername':{'type':Sequelize['STRING']},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0xc659('0x2')]},'agentcompleteAt':{'type':Sequelize[_0xc659('0x2')]},'agentringnoanswerAt':{'type':Sequelize[_0xc659('0x2')]},'agentdumpAt':{'type':Sequelize[_0xc659('0x2')]},'holdtime':{'type':Sequelize[_0xc659('0x3')]},'agentcomplete':{'type':Sequelize[_0xc659('0x4')],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentdump':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'talktime':{'type':Sequelize[_0xc659('0x3')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize['STRING']},'lastevent':{'type':Sequelize[_0xc659('0x1')]},'channel':{'type':Sequelize[_0xc659('0x1')]},'channelstate':{'type':Sequelize[_0xc659('0x3')]},'channelstatedesc':{'type':Sequelize[_0xc659('0x1')]},'connectedlinenum':{'type':Sequelize[_0xc659('0x1')]},'connectedlinename':{'type':Sequelize[_0xc659('0x1')]},'language':{'type':Sequelize[_0xc659('0x1')]},'accountcode':{'type':Sequelize[_0xc659('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0xc659('0x1')]},'priority':{'type':Sequelize[_0xc659('0x1')]},'destchannel':{'type':Sequelize[_0xc659('0x1')]},'destchannelstate':{'type':Sequelize['INTEGER']},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0xc659('0x1')]},'destcalleridname':{'type':Sequelize[_0xc659('0x1')]},'destconnectedlinenum':{'type':Sequelize['STRING']},'destconnectedlinename':{'type':Sequelize[_0xc659('0x1')]},'destlanguage':{'type':Sequelize[_0xc659('0x1')]},'destaccountcode':{'type':Sequelize[_0xc659('0x1')]},'destcontext':{'type':Sequelize[_0xc659('0x1')]},'destexten':{'type':Sequelize[_0xc659('0x1')]},'destpriority':{'type':Sequelize[_0xc659('0x1')]},'destuniqueid':{'type':Sequelize[_0xc659('0x1')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0xc659('0x1')]},'answeredelsewheremembername':{'type':Sequelize[_0xc659('0x1')]},'transfer':{'type':Sequelize[_0xc659('0x4')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xc659('0x5')},'transferexten':{'type':Sequelize[_0xc659('0x1')]},'transferuniqueid':{'type':Sequelize[_0xc659('0x1')]},'agententerreason':{'type':Sequelize[_0xc659('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0x7a40=['exports','STRING','DATE','INTEGER','BOOLEAN','sequelize'];(function(_0x46f54b,_0xfab0ff){var _0x4ba18e=function(_0x197344){while(--_0x197344){_0x46f54b['push'](_0x46f54b['shift']());}};_0x4ba18e(++_0xfab0ff);}(_0x7a40,0x197));var _0x07a4=function(_0x2c82b3,_0x8f09c8){_0x2c82b3=_0x2c82b3-0x0;var _0x178b96=_0x7a40[_0x2c82b3];return _0x178b96;};'use strict';var Sequelize=require(_0x07a4('0x0'));module[_0x07a4('0x1')]={'type':{'type':Sequelize[_0x07a4('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'calleridnum':{'type':Sequelize[_0x07a4('0x2')]},'calleridname':{'type':Sequelize[_0x07a4('0x2')]},'queue':{'type':Sequelize[_0x07a4('0x2')]},'interface':{'type':Sequelize[_0x07a4('0x2')]},'membername':{'type':Sequelize[_0x07a4('0x2')]},'agentcalledAt':{'type':Sequelize['DATE']},'agentconnectAt':{'type':Sequelize[_0x07a4('0x3')]},'agentcompleteAt':{'type':Sequelize[_0x07a4('0x3')]},'agentringnoanswerAt':{'type':Sequelize[_0x07a4('0x3')]},'agentdumpAt':{'type':Sequelize[_0x07a4('0x3')]},'holdtime':{'type':Sequelize[_0x07a4('0x4')]},'agentcomplete':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentringnoanswer':{'type':Sequelize[_0x07a4('0x5')],'defaultValue':![]},'agentdump':{'type':Sequelize[_0x07a4('0x5')],'defaultValue':![]},'talktime':{'type':Sequelize[_0x07a4('0x4')]},'agentacw':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'acwtime':{'type':Sequelize['INTEGER']},'reason':{'type':Sequelize[_0x07a4('0x2')]},'lastevent':{'type':Sequelize[_0x07a4('0x2')]},'channel':{'type':Sequelize['STRING']},'channelstate':{'type':Sequelize['INTEGER']},'channelstatedesc':{'type':Sequelize[_0x07a4('0x2')]},'connectedlinenum':{'type':Sequelize['STRING']},'connectedlinename':{'type':Sequelize[_0x07a4('0x2')]},'language':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0x07a4('0x2')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x07a4('0x2')]},'priority':{'type':Sequelize[_0x07a4('0x2')]},'destchannel':{'type':Sequelize[_0x07a4('0x2')]},'destchannelstate':{'type':Sequelize[_0x07a4('0x4')]},'destchannelstatedesc':{'type':Sequelize['STRING']},'destcalleridnum':{'type':Sequelize[_0x07a4('0x2')]},'destcalleridname':{'type':Sequelize[_0x07a4('0x2')]},'destconnectedlinenum':{'type':Sequelize[_0x07a4('0x2')]},'destconnectedlinename':{'type':Sequelize['STRING']},'destlanguage':{'type':Sequelize[_0x07a4('0x2')]},'destaccountcode':{'type':Sequelize['STRING']},'destcontext':{'type':Sequelize[_0x07a4('0x2')]},'destexten':{'type':Sequelize[_0x07a4('0x2')]},'destpriority':{'type':Sequelize[_0x07a4('0x2')]},'destuniqueid':{'type':Sequelize[_0x07a4('0x2')]},'answeredelsewheredestinationuniqueid':{'type':Sequelize[_0x07a4('0x2')]},'answeredelsewheremembername':{'type':Sequelize[_0x07a4('0x2')]},'transfer':{'type':Sequelize[_0x07a4('0x5')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x07a4('0x2')],'comment':'FORWARD,\x20BLIND,\x20ATTENDED'},'transferexten':{'type':Sequelize[_0x07a4('0x2')]},'transferuniqueid':{'type':Sequelize[_0x07a4('0x2')]},'agententerreason':{'type':Sequelize[_0x07a4('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 03149de..03bb885 100644 --- a/server/api/voiceAgentReport/voiceAgentReport.controller.js +++ b/server/api/voiceAgentReport/voiceAgentReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x47fd36,_0x41535d){var _0x21a0fc=function(_0x44c07c){while(--_0x44c07c){_0x47fd36['push'](_0x47fd36['shift']());}};_0x21a0fc(++_0x41535d);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0xa9e0[_0x3947c9];return _0x2e7871;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file +var _0xa9e0=['type','options','includeAll','include','findAll','catch','show','params','find','body','describe','eml-format','rimraf','zip-dir','moment','mustache','util','path','sox','to-csv','fs-extra','lodash','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply','save','update','then','destroy','stack','name','send','index','VoiceAgentReport','rawAttributes','fieldName','key','model','map','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','sort','where','filter','merge'];(function(_0x9dfc10,_0x19c2d5){var _0x4f938a=function(_0x12b1e5){while(--_0x12b1e5){_0x9dfc10['push'](_0x9dfc10['shift']());}};_0x4f938a(++_0x19c2d5);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1ddedd,_0x485606){_0x1ddedd=_0x1ddedd-0x0;var _0xa3e1ac=_0xa9e0[_0x1ddedd];return _0xa3e1ac;};'use strict';var emlformat=require(_0x0a9e('0x0'));var rimraf=require(_0x0a9e('0x1'));var zipdir=require(_0x0a9e('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x0a9e('0x3'));var BPromise=require('bluebird');var Mustache=require(_0x0a9e('0x4'));var util=require(_0x0a9e('0x5'));var path=require(_0x0a9e('0x6'));var sox=require(_0x0a9e('0x7'));var csv=require(_0x0a9e('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a9e('0x9'));var _=require(_0x0a9e('0xa'));var squel=require(_0x0a9e('0xb'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x0a9e('0xc'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x0a9e('0xd'));var Redis=require(_0x0a9e('0xe'));var authService=require(_0x0a9e('0xf'));var qs=require(_0x0a9e('0x10'));var as=require(_0x0a9e('0x11'));var hardwareService=require(_0x0a9e('0x12'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x0a9e('0x13'));var db=require(_0x0a9e('0x14'))['db'];function respondWithStatusCode(_0xd5b662,_0x26d672){_0x26d672=_0x26d672||0xcc;return function(_0x32d742){if(_0x32d742){return _0xd5b662[_0x0a9e('0x15')](_0x26d672);}return _0xd5b662['status'](_0x26d672)[_0x0a9e('0x16')]();};}function respondWithResult(_0x239b12,_0x2b4227){_0x2b4227=_0x2b4227||0xc8;return function(_0x281129){if(_0x281129){return _0x239b12[_0x0a9e('0x17')](_0x2b4227)[_0x0a9e('0x18')](_0x281129);}};}function respondWithFilteredResult(_0x52a03d,_0x22dccb){return function(_0x5d0880){if(_0x5d0880){var _0x1985b6=typeof _0x22dccb['offset']===_0x0a9e('0x19')&&typeof _0x22dccb[_0x0a9e('0x1a')]==='undefined';var _0x225616=_0x5d0880['count'];var _0x459eb1=_0x1985b6?0x0:_0x22dccb[_0x0a9e('0x1b')];var _0x106033=_0x1985b6?_0x5d0880[_0x0a9e('0x1c')]:_0x22dccb[_0x0a9e('0x1b')]+_0x22dccb[_0x0a9e('0x1a')];var _0x530eb7;if(_0x106033>=_0x225616){_0x106033=_0x225616;_0x530eb7=0xc8;}else{_0x530eb7=0xce;}_0x52a03d[_0x0a9e('0x17')](_0x530eb7);return _0x52a03d[_0x0a9e('0x1d')](_0x0a9e('0x1e'),_0x459eb1+'-'+_0x106033+'/'+_0x225616)[_0x0a9e('0x18')](_0x5d0880);}return null;};}function patchUpdates(_0x105080){return function(_0x4bb1e3){try{jsonpatch[_0x0a9e('0x1f')](_0x4bb1e3,_0x105080,!![]);}catch(_0x155cce){return BPromise['reject'](_0x155cce);}return _0x4bb1e3[_0x0a9e('0x20')]();};}function saveUpdates(_0x5a09ef,_0x588269){return function(_0x3a02e1){if(_0x3a02e1){return _0x3a02e1[_0x0a9e('0x21')](_0x5a09ef)[_0x0a9e('0x22')](function(_0x30bae6){return _0x30bae6;});}return null;};}function removeEntity(_0x4abc77,_0xfb6e48){return function(_0x2fb0e4){if(_0x2fb0e4){return _0x2fb0e4[_0x0a9e('0x23')]()[_0x0a9e('0x22')](function(){_0x4abc77[_0x0a9e('0x17')](0xcc)[_0x0a9e('0x16')]();});}};}function handleEntityNotFound(_0x16b1ca,_0x5ea472){return function(_0x59181e){if(!_0x59181e){_0x16b1ca[_0x0a9e('0x15')](0x194);}return _0x59181e;};}function handleError(_0x3a8e58,_0x40c424){_0x40c424=_0x40c424||0x1f4;return function(_0x33161b){logger['error'](_0x33161b[_0x0a9e('0x24')]);if(_0x33161b['name']){delete _0x33161b[_0x0a9e('0x25')];}_0x3a8e58['status'](_0x40c424)[_0x0a9e('0x26')](_0x33161b);};}exports[_0x0a9e('0x27')]=function(_0x25fba9,_0x14433c){var _0x140511={},_0x1538a4={},_0x11c3b6={'count':0x0,'rows':[]};var _0x14de77=_['map'](db[_0x0a9e('0x28')][_0x0a9e('0x29')],function(_0x2b1f27){return{'name':_0x2b1f27[_0x0a9e('0x2a')],'type':_0x2b1f27['type'][_0x0a9e('0x2b')]};});_0x1538a4[_0x0a9e('0x2c')]=_[_0x0a9e('0x2d')](_0x14de77,_0x0a9e('0x25'));_0x1538a4[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x25fba9[_0x0a9e('0x2e')]);_0x1538a4[_0x0a9e('0x30')]=_[_0x0a9e('0x31')](_0x1538a4['model'],_0x1538a4[_0x0a9e('0x2e')]);_0x140511['attributes']=_[_0x0a9e('0x31')](_0x1538a4[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0x140511['attributes']=_0x140511[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0x140511[_0x0a9e('0x33')]:_0x1538a4[_0x0a9e('0x2c')];if(!_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x35')](_0x0a9e('0x36'))){_0x140511[_0x0a9e('0x1a')]=qs['limit'](_0x25fba9[_0x0a9e('0x2e')]['limit']);_0x140511[_0x0a9e('0x1b')]=qs[_0x0a9e('0x1b')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x1b')]);}_0x140511['order']=qs[_0x0a9e('0x37')](_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x37')]);_0x140511[_0x0a9e('0x38')]=qs['filters'](_['pick'](_0x25fba9[_0x0a9e('0x2e')],_0x1538a4['filters']),_0x14de77);if(_0x25fba9[_0x0a9e('0x2e')][_0x0a9e('0x39')]){_0x140511[_0x0a9e('0x38')]=_[_0x0a9e('0x3a')](_0x140511['where'],{'$or':_[_0x0a9e('0x2d')](_0x14de77,function(_0x3bfce8){if(_0x3bfce8[_0x0a9e('0x3b')]!=='VIRTUAL'){var _0x1dbf74={};_0x1dbf74[_0x3bfce8[_0x0a9e('0x25')]]={'$like':'%'+_0x25fba9[_0x0a9e('0x2e')]['filter']+'%'};return _0x1dbf74;}})});}_0x140511=_['merge']({},_0x140511,_0x25fba9[_0x0a9e('0x3c')]);var _0x40d766={'where':_0x140511['where']};return db[_0x0a9e('0x28')][_0x0a9e('0x1c')](_0x40d766)[_0x0a9e('0x22')](function(_0x148f55){_0x11c3b6['count']=_0x148f55;if(_0x25fba9['query'][_0x0a9e('0x3d')]){_0x140511[_0x0a9e('0x3e')]=[{'all':!![]}];}return db['VoiceAgentReport'][_0x0a9e('0x3f')](_0x140511);})[_0x0a9e('0x22')](function(_0x1459bb){_0x11c3b6['rows']=_0x1459bb;return _0x11c3b6;})[_0x0a9e('0x22')](respondWithFilteredResult(_0x14433c,_0x140511))[_0x0a9e('0x40')](handleError(_0x14433c,null));};exports[_0x0a9e('0x41')]=function(_0x43dd5b,_0x13cb1f){var _0xeaa5e5={'raw':![],'where':{'id':_0x43dd5b[_0x0a9e('0x42')]['id']}},_0x2881b3={};_0x2881b3[_0x0a9e('0x2c')]=_[_0x0a9e('0x2f')](db[_0x0a9e('0x28')][_0x0a9e('0x29')]);_0x2881b3[_0x0a9e('0x2e')]=_[_0x0a9e('0x2f')](_0x43dd5b[_0x0a9e('0x2e')]);_0x2881b3['filters']=_['intersection'](_0x2881b3[_0x0a9e('0x2c')],_0x2881b3[_0x0a9e('0x2e')]);_0xeaa5e5[_0x0a9e('0x33')]=_[_0x0a9e('0x31')](_0x2881b3[_0x0a9e('0x2c')],qs[_0x0a9e('0x32')](_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x32')]));_0xeaa5e5[_0x0a9e('0x33')]=_0xeaa5e5[_0x0a9e('0x33')][_0x0a9e('0x34')]?_0xeaa5e5[_0x0a9e('0x33')]:_0x2881b3['model'];if(_0x43dd5b[_0x0a9e('0x2e')][_0x0a9e('0x3d')]){_0xeaa5e5[_0x0a9e('0x3e')]=[{'all':!![]}];}_0xeaa5e5=_[_0x0a9e('0x3a')]({},_0xeaa5e5,_0x43dd5b[_0x0a9e('0x3c')]);return db[_0x0a9e('0x28')][_0x0a9e('0x43')](_0xeaa5e5)[_0x0a9e('0x22')](handleEntityNotFound(_0x13cb1f,null))['then'](respondWithResult(_0x13cb1f,null))[_0x0a9e('0x40')](handleError(_0x13cb1f,null));};exports['create']=function(_0x473dc8,_0x476688){return db[_0x0a9e('0x28')]['create'](_0x473dc8[_0x0a9e('0x44')],{})[_0x0a9e('0x22')](respondWithResult(_0x476688,0xc9))[_0x0a9e('0x40')](handleError(_0x476688,null));};exports[_0x0a9e('0x21')]=function(_0x45c845,_0x37be73){if(_0x45c845[_0x0a9e('0x44')]['id']){delete _0x45c845['body']['id'];}return db[_0x0a9e('0x28')][_0x0a9e('0x43')]({'where':{'id':_0x45c845[_0x0a9e('0x42')]['id']}})[_0x0a9e('0x22')](handleEntityNotFound(_0x37be73,null))[_0x0a9e('0x22')](saveUpdates(_0x45c845[_0x0a9e('0x44')],null))[_0x0a9e('0x22')](respondWithResult(_0x37be73,null))[_0x0a9e('0x40')](handleError(_0x37be73,null));};exports[_0x0a9e('0x23')]=function(_0x58a5c2,_0xe401a){return db[_0x0a9e('0x28')]['find']({'where':{'id':_0x58a5c2['params']['id']}})['then'](handleEntityNotFound(_0xe401a,null))[_0x0a9e('0x22')](removeEntity(_0xe401a,null))[_0x0a9e('0x40')](handleError(_0xe401a,null));};exports[_0x0a9e('0x45')]=function(_0x11545a,_0x61bb17){return db[_0x0a9e('0x28')][_0x0a9e('0x45')]()[_0x0a9e('0x22')](respondWithResult(_0x61bb17,null))['catch'](handleError(_0x61bb17,null));}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.model.js b/server/api/voiceAgentReport/voiceAgentReport.model.js index b7aae0d..fc6a5f9 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 _0x1c88=['define','VoiceAgentReport','report_agent','uniqueid','destuniqueid','lodash','../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceAgentReport.attributes','exports'];(function(_0x3ab46c,_0x4d26cc){var _0x2c7e90=function(_0x29e83d){while(--_0x29e83d){_0x3ab46c['push'](_0x3ab46c['shift']());}};_0x2c7e90(++_0x4d26cc);}(_0x1c88,0x1a9));var _0x81c8=function(_0x3b5ad9,_0x223867){_0x3b5ad9=_0x3b5ad9-0x0;var _0x611ae9=_0x1c88[_0x3b5ad9];return _0x611ae9;};'use strict';var _=require(_0x81c8('0x0'));var util=require('util');var logger=require(_0x81c8('0x1'))(_0x81c8('0x2'));var moment=require(_0x81c8('0x3'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x81c8('0x4'));var rimraf=require(_0x81c8('0x5'));var config=require(_0x81c8('0x6'));var attributes=require(_0x81c8('0x7'));module[_0x81c8('0x8')]=function(_0x3e5721,_0x3f4e27){return _0x3e5721[_0x81c8('0x9')](_0x81c8('0xa'),attributes,{'tableName':_0x81c8('0xb'),'paranoid':![],'indexes':[{'fields':[_0x81c8('0xc'),_0x81c8('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xf041=['bluebird','path','../../config/environment','define','VoiceAgentReport','report_agent','uniqueid','../../config/logger','api','moment'];(function(_0x2aaa60,_0x22258f){var _0x2e3fa5=function(_0x335589){while(--_0x335589){_0x2aaa60['push'](_0x2aaa60['shift']());}};_0x2e3fa5(++_0x22258f);}(_0xf041,0x15b));var _0x1f04=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf041[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x1f04('0x0'))(_0x1f04('0x1'));var moment=require(_0x1f04('0x2'));var BPromise=require(_0x1f04('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x1f04('0x4'));var rimraf=require('rimraf');var config=require(_0x1f04('0x5'));var attributes=require('./voiceAgentReport.attributes');module['exports']=function(_0x25d578,_0x504d71){return _0x25d578[_0x1f04('0x6')](_0x1f04('0x7'),attributes,{'tableName':_0x1f04('0x8'),'paranoid':![],'indexes':[{'fields':[_0x1f04('0x9'),'destuniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceAgentReport/voiceAgentReport.rpc.js b/server/api/voiceAgentReport/voiceAgentReport.rpc.js index 444fa31..b8286c5 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 _0x6f4e=['VoiceAgentReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateVoiceAgentReport','options','raw','stringify','catch','UpdateVoiceAgentReport','VoiceAgentReport','update','body','where','lodash','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','request','then','info','VoiceAgentReport,\x20%s,\x20%s','debug'];(function(_0x4af01e,_0x543f5c){var _0x178c11=function(_0x2c2f76){while(--_0x2c2f76){_0x4af01e['push'](_0x4af01e['shift']());}};_0x178c11(++_0x543f5c);}(_0x6f4e,0x84));var _0xe6f4=function(_0x1fe360,_0x402c12){_0x1fe360=_0x1fe360-0x0;var _0x41ac45=_0x6f4e[_0x1fe360];return _0x41ac45;};'use strict';var _=require(_0xe6f4('0x0'));var util=require('util');var moment=require(_0xe6f4('0x1'));var BPromise=require(_0xe6f4('0x2'));var rs=require(_0xe6f4('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xe6f4('0x4'));var logger=require(_0xe6f4('0x5'))(_0xe6f4('0x6'));var config=require(_0xe6f4('0x7'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x4228db,_0x51f149,_0x1a4dd1){return new BPromise(function(_0x589d75,_0x5c9709){return client[_0xe6f4('0x8')](_0x4228db,_0x1a4dd1)[_0xe6f4('0x9')](function(_0x541deb){logger[_0xe6f4('0xa')](_0xe6f4('0xb'),_0x51f149,'request\x20sent');logger[_0xe6f4('0xc')](_0xe6f4('0xd'),_0x51f149,_0xe6f4('0xe'),JSON['stringify'](_0x541deb));if(_0x541deb[_0xe6f4('0xf')]){if(_0x541deb[_0xe6f4('0xf')][_0xe6f4('0x10')]===0x1f4){logger['error'](_0xe6f4('0xb'),_0x51f149,_0x541deb[_0xe6f4('0xf')]['message']);return _0x5c9709(_0x541deb[_0xe6f4('0xf')][_0xe6f4('0x11')]);}logger[_0xe6f4('0xf')](_0xe6f4('0xb'),_0x51f149,_0x541deb['error'][_0xe6f4('0x11')]);return _0x589d75(_0x541deb[_0xe6f4('0xf')][_0xe6f4('0x11')]);}else{logger[_0xe6f4('0xa')](_0xe6f4('0xb'),_0x51f149,_0xe6f4('0xe'));_0x589d75(_0x541deb[_0xe6f4('0x12')]['message']);}})['catch'](function(_0x4e3fc6){logger[_0xe6f4('0xf')](_0xe6f4('0xb'),_0x51f149,_0x4e3fc6);_0x5c9709(_0x4e3fc6);});});}exports[_0xe6f4('0x13')]=function(_0x5f008b){var _0x4c8b36=this;return new Promise(function(_0x426369,_0x509841){return db['VoiceAgentReport']['create'](_0x5f008b['body'],{'raw':_0x5f008b[_0xe6f4('0x14')]?_0x5f008b[_0xe6f4('0x14')][_0xe6f4('0x15')]===undefined?!![]:![]:!![]})['then'](function(_0x30a913){logger[_0xe6f4('0xa')](_0xe6f4('0x13'),_0x5f008b);logger['debug']('CreateVoiceAgentReport',_0x5f008b,JSON[_0xe6f4('0x16')](_0x30a913));_0x426369(_0x30a913);})[_0xe6f4('0x17')](function(_0x433079){logger[_0xe6f4('0xf')](_0xe6f4('0x13'),_0x433079[_0xe6f4('0x11')],_0x5f008b);_0x509841(_0x4c8b36[_0xe6f4('0xf')](0x1f4,_0x433079[_0xe6f4('0x11')]));});});};exports[_0xe6f4('0x18')]=function(_0x11234a){var _0x54e1c0=this;return new Promise(function(_0x1957b1,_0x339978){return db[_0xe6f4('0x19')][_0xe6f4('0x1a')](_0x11234a[_0xe6f4('0x1b')],{'raw':_0x11234a[_0xe6f4('0x14')]?_0x11234a[_0xe6f4('0x14')][_0xe6f4('0x15')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x11234a[_0xe6f4('0x14')]?_0x11234a['options'][_0xe6f4('0x1c')]||null:null,'attributes':_0x11234a[_0xe6f4('0x14')]?_0x11234a[_0xe6f4('0x14')]['attributes']||null:null,'limit':_0x11234a[_0xe6f4('0x14')]?_0x11234a[_0xe6f4('0x14')]['limit']||null:null})['then'](function(_0x5d996b){logger[_0xe6f4('0xa')](_0xe6f4('0x18'),_0x11234a);logger['debug']('UpdateVoiceAgentReport',_0x11234a,JSON[_0xe6f4('0x16')](_0x5d996b));_0x1957b1(_0x5d996b);})[_0xe6f4('0x17')](function(_0x4b2746){logger[_0xe6f4('0xf')](_0xe6f4('0x18'),_0x4b2746[_0xe6f4('0x11')],_0x11234a);_0x339978(_0x54e1c0['error'](0x1f4,_0x4b2746[_0xe6f4('0x11')]));});});}; \ No newline at end of file +var _0xd46b=['result','catch','CreateVoiceAgentReport','VoiceAgentReport','options','raw','UpdateVoiceAgentReport','body','attributes','limit','lodash','bluebird','randomstring','rpc','../../config/environment','jayson/promise','http','request','then','VoiceAgentReport,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','info'];(function(_0x5de1dd,_0x270946){var _0x489868=function(_0x1b5b42){while(--_0x1b5b42){_0x5de1dd['push'](_0x5de1dd['shift']());}};_0x489868(++_0x270946);}(_0xd46b,0x118));var _0xbd46=function(_0x300c82,_0x2e94c0){_0x300c82=_0x300c82-0x0;var _0x1b47fa=_0xd46b[_0x300c82];return _0x1b47fa;};'use strict';var _=require(_0xbd46('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xbd46('0x1'));var rs=require(_0xbd46('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xbd46('0x3'));var config=require(_0xbd46('0x4'));var jayson=require(_0xbd46('0x5'));var client=jayson['client'][_0xbd46('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x39f1b5,_0x574a64,_0x121187){return new BPromise(function(_0x4e3d7d,_0x3c9a09){return client[_0xbd46('0x7')](_0x39f1b5,_0x121187)[_0xbd46('0x8')](function(_0x26b83a){logger['info'](_0xbd46('0x9'),_0x574a64,'request\x20sent');logger[_0xbd46('0xa')]('VoiceAgentReport,\x20%s,\x20%s,\x20%s',_0x574a64,_0xbd46('0xb'),JSON[_0xbd46('0xc')](_0x26b83a));if(_0x26b83a[_0xbd46('0xd')]){if(_0x26b83a[_0xbd46('0xd')][_0xbd46('0xe')]===0x1f4){logger[_0xbd46('0xd')](_0xbd46('0x9'),_0x574a64,_0x26b83a[_0xbd46('0xd')][_0xbd46('0xf')]);return _0x3c9a09(_0x26b83a['error'][_0xbd46('0xf')]);}logger[_0xbd46('0xd')]('VoiceAgentReport,\x20%s,\x20%s',_0x574a64,_0x26b83a[_0xbd46('0xd')][_0xbd46('0xf')]);return _0x4e3d7d(_0x26b83a['error'][_0xbd46('0xf')]);}else{logger[_0xbd46('0x10')](_0xbd46('0x9'),_0x574a64,_0xbd46('0xb'));_0x4e3d7d(_0x26b83a[_0xbd46('0x11')]['message']);}})[_0xbd46('0x12')](function(_0x331814){logger[_0xbd46('0xd')](_0xbd46('0x9'),_0x574a64,_0x331814);_0x3c9a09(_0x331814);});});}exports[_0xbd46('0x13')]=function(_0x10bac6){var _0x5e41dd=this;return new Promise(function(_0x45317c,_0x591b81){return db[_0xbd46('0x14')]['create'](_0x10bac6['body'],{'raw':_0x10bac6[_0xbd46('0x15')]?_0x10bac6['options'][_0xbd46('0x16')]===undefined?!![]:![]:!![]})[_0xbd46('0x8')](function(_0x21ea0b){logger[_0xbd46('0x10')](_0xbd46('0x13'),_0x10bac6);logger['debug'](_0xbd46('0x13'),_0x10bac6,JSON[_0xbd46('0xc')](_0x21ea0b));_0x45317c(_0x21ea0b);})[_0xbd46('0x12')](function(_0x321dd3){logger['error'](_0xbd46('0x13'),_0x321dd3['message'],_0x10bac6);_0x591b81(_0x5e41dd['error'](0x1f4,_0x321dd3[_0xbd46('0xf')]));});});};exports[_0xbd46('0x17')]=function(_0x26e744){var _0x187805=this;return new Promise(function(_0x1dcb6a,_0x22497f){return db['VoiceAgentReport']['update'](_0x26e744[_0xbd46('0x18')],{'raw':_0x26e744['options']?_0x26e744[_0xbd46('0x15')][_0xbd46('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x26e744[_0xbd46('0x15')]?_0x26e744[_0xbd46('0x15')]['where']||null:null,'attributes':_0x26e744[_0xbd46('0x15')]?_0x26e744[_0xbd46('0x15')][_0xbd46('0x19')]||null:null,'limit':_0x26e744[_0xbd46('0x15')]?_0x26e744[_0xbd46('0x15')][_0xbd46('0x1a')]||null:null})[_0xbd46('0x8')](function(_0x198398){logger['info'](_0xbd46('0x17'),_0x26e744);logger['debug'](_0xbd46('0x17'),_0x26e744,JSON[_0xbd46('0xc')](_0x198398));_0x1dcb6a(_0x198398);})[_0xbd46('0x12')](function(_0x3b5b18){logger[_0xbd46('0xd')](_0xbd46('0x17'),_0x3b5b18['message'],_0x26e744);_0x22497f(_0x187805[_0xbd46('0xd')](0x1f4,_0x3b5b18[_0xbd46('0xf')]));});});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/index.js b/server/api/voiceCallReport/index.js index 2aa9591..b262df5 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 _0x84e7=['destroy','exports','util','path','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','get','isAuthenticated','describe','/:id','show','post','put','update'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x84e7,0x122));var _0x784e=function(_0x56a2f6,_0x3f6d06){_0x56a2f6=_0x56a2f6-0x0;var _0x4f2b3c=_0x84e7[_0x56a2f6];return _0x4f2b3c;};'use strict';var multer=require('multer');var util=require(_0x784e('0x0'));var path=require(_0x784e('0x1'));var timeout=require('connect-timeout');var express=require(_0x784e('0x2'));var router=express[_0x784e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x784e('0x4'));var interaction=require(_0x784e('0x5'));var config=require(_0x784e('0x6'));var controller=require(_0x784e('0x7'));router[_0x784e('0x8')]('/',auth[_0x784e('0x9')](),controller['index']);router[_0x784e('0x8')]('/describe',auth[_0x784e('0x9')](),controller[_0x784e('0xa')]);router['get'](_0x784e('0xb'),auth[_0x784e('0x9')](),controller[_0x784e('0xc')]);router[_0x784e('0xd')]('/',auth['isAuthenticated'](),controller['create']);router[_0x784e('0xe')](_0x784e('0xb'),auth[_0x784e('0x9')](),controller[_0x784e('0xf')]);router['delete'](_0x784e('0xb'),auth[_0x784e('0x9')](),controller[_0x784e('0x10')]);module[_0x784e('0x11')]=router; \ No newline at end of file +var _0x0b78=['get','show','post','create','/:id','update','delete','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceCallReport.controller','index','/describe','isAuthenticated','describe'];(function(_0x7600b4,_0x249467){var _0x3bca17=function(_0x25f2ab){while(--_0x25f2ab){_0x7600b4['push'](_0x7600b4['shift']());}};_0x3bca17(++_0x249467);}(_0x0b78,0x1ad));var _0x80b7=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x0b78[_0x321bb2];return _0x9c12ed;};'use strict';var multer=require(_0x80b7('0x0'));var util=require(_0x80b7('0x1'));var path=require('path');var timeout=require(_0x80b7('0x2'));var express=require(_0x80b7('0x3'));var router=express['Router']();var fs_extra=require(_0x80b7('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x80b7('0x5'));var config=require(_0x80b7('0x6'));var controller=require(_0x80b7('0x7'));router['get']('/',auth['isAuthenticated'](),controller[_0x80b7('0x8')]);router['get'](_0x80b7('0x9'),auth[_0x80b7('0xa')](),controller[_0x80b7('0xb')]);router[_0x80b7('0xc')]('/:id',auth[_0x80b7('0xa')](),controller[_0x80b7('0xd')]);router[_0x80b7('0xe')]('/',auth['isAuthenticated'](),controller[_0x80b7('0xf')]);router['put'](_0x80b7('0x10'),auth[_0x80b7('0xa')](),controller[_0x80b7('0x11')]);router[_0x80b7('0x12')](_0x80b7('0x10'),auth[_0x80b7('0xa')](),controller[_0x80b7('0x13')]);module[_0x80b7('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.attributes.js b/server/api/voiceCallReport/voiceCallReport.attributes.js index 19fa3cf..6a1ffe4 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 _0x71af=['internal','outbound','inbound-fax','outbound-fax','STRING','TEXT','DATE','INTEGER','sequelize','exports','ENUM','inbound'];(function(_0x15d2b9,_0x2a02c6){var _0x39e569=function(_0x92f609){while(--_0x92f609){_0x15d2b9['push'](_0x15d2b9['shift']());}};_0x39e569(++_0x2a02c6);}(_0x71af,0x194));var _0xf71a=function(_0x2f50d7,_0x437f5b){_0x2f50d7=_0x2f50d7-0x0;var _0x24faf6=_0x71af[_0x2f50d7];return _0x24faf6;};'use strict';var Sequelize=require(_0xf71a('0x0'));module[_0xf71a('0x1')]={'uniqueid':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0xf71a('0x2')](_0xf71a('0x3'),_0xf71a('0x4'),_0xf71a('0x5'),_0xf71a('0x6'),_0xf71a('0x7'),'dialer')},'tag':{'type':Sequelize['STRING']},'accountcode':{'type':Sequelize[_0xf71a('0x8')]},'source':{'type':Sequelize[_0xf71a('0x8')]},'destination':{'type':Sequelize[_0xf71a('0x8')]},'destinationcontext':{'type':Sequelize[_0xf71a('0x8')]},'callerid':{'type':Sequelize[_0xf71a('0x8')]},'channel':{'type':Sequelize[_0xf71a('0x8')]},'destinationchannel':{'type':Sequelize[_0xf71a('0x8')]},'lastapplication':{'type':Sequelize[_0xf71a('0x8')]},'lastdata':{'type':Sequelize[_0xf71a('0x9')]},'starttime':{'type':Sequelize[_0xf71a('0xa')]},'systemanswertime':{'type':Sequelize['DATE']},'answertime':{'type':Sequelize[_0xf71a('0xa')]},'endtime':{'type':Sequelize[_0xf71a('0xa')]},'duration':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize[_0xf71a('0xb')]},'mohtime':{'type':Sequelize[_0xf71a('0xb')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xf71a('0x8')]},'amaflags':{'type':Sequelize[_0xf71a('0x8')]},'userfield':{'type':Sequelize[_0xf71a('0x8')]},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0xf71a('0x8')]},'userThirdDisposition':{'type':Sequelize[_0xf71a('0x8')]},'note':{'type':Sequelize[_0xf71a('0x8')]},'prefix':{'type':Sequelize[_0xf71a('0x8')]},'routeid':{'type':Sequelize[_0xf71a('0xb')]},'sipcallid':{'type':Sequelize[_0xf71a('0x8')]}}; \ No newline at end of file +var _0x8c9c=['STRING','ENUM','outbound','inbound-fax','outbound-fax','TEXT','DATE','INTEGER','exports'];(function(_0x55fe83,_0x19701e){var _0xdca799=function(_0x25bf38){while(--_0x25bf38){_0x55fe83['push'](_0x55fe83['shift']());}};_0xdca799(++_0x19701e);}(_0x8c9c,0x131));var _0xc8c9=function(_0x245c4f,_0x34b70f){_0x245c4f=_0x245c4f-0x0;var _0x3157a1=_0x8c9c[_0x245c4f];return _0x3157a1;};'use strict';var Sequelize=require('sequelize');module[_0xc8c9('0x0')]={'uniqueid':{'type':Sequelize[_0xc8c9('0x1')]},'type':{'type':Sequelize[_0xc8c9('0x2')]('inbound','internal',_0xc8c9('0x3'),_0xc8c9('0x4'),_0xc8c9('0x5'),'dialer')},'tag':{'type':Sequelize[_0xc8c9('0x1')]},'accountcode':{'type':Sequelize[_0xc8c9('0x1')]},'source':{'type':Sequelize['STRING']},'destination':{'type':Sequelize[_0xc8c9('0x1')]},'destinationcontext':{'type':Sequelize['STRING']},'callerid':{'type':Sequelize[_0xc8c9('0x1')]},'channel':{'type':Sequelize[_0xc8c9('0x1')]},'destinationchannel':{'type':Sequelize[_0xc8c9('0x1')]},'lastapplication':{'type':Sequelize[_0xc8c9('0x1')]},'lastdata':{'type':Sequelize[_0xc8c9('0x6')]},'starttime':{'type':Sequelize[_0xc8c9('0x7')]},'systemanswertime':{'type':Sequelize[_0xc8c9('0x7')]},'answertime':{'type':Sequelize[_0xc8c9('0x7')]},'endtime':{'type':Sequelize[_0xc8c9('0x7')]},'duration':{'type':Sequelize[_0xc8c9('0x8')]},'billableseconds':{'type':Sequelize[_0xc8c9('0x8')]},'mohtime':{'type':Sequelize[_0xc8c9('0x8')],'defaultValue':0x0},'disposition':{'type':Sequelize[_0xc8c9('0x1')]},'amaflags':{'type':Sequelize[_0xc8c9('0x1')]},'userfield':{'type':Sequelize[_0xc8c9('0x1')]},'userDisposition':{'type':Sequelize[_0xc8c9('0x1')]},'userSecondDisposition':{'type':Sequelize['STRING']},'userThirdDisposition':{'type':Sequelize[_0xc8c9('0x1')]},'note':{'type':Sequelize[_0xc8c9('0x1')]},'prefix':{'type':Sequelize[_0xc8c9('0x1')]},'routeid':{'type':Sequelize[_0xc8c9('0x8')]},'sipcallid':{'type':Sequelize[_0xc8c9('0x1')]}}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.controller.js b/server/api/voiceCallReport/voiceCallReport.controller.js index 40af4e9..7a36cc3 100644 --- a/server/api/voiceCallReport/voiceCallReport.controller.js +++ b/server/api/voiceCallReport/voiceCallReport.controller.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2032=['../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','end','status','json','offset','undefined','limit','count','set','Content-Range','apply','save','then','destroy','sendStatus','error','stack','name','send','index','map','VoiceCallReport','fieldName','type','key','query','model','attributes','intersection','fields','length','hasOwnProperty','nolimit','sort','pick','filters','filter','merge','where','options','alias','User','rows','catch','show','params','keys','rawAttributes','includeAll','include','create','body','find','describe','uniqueid','user','rimraf','zip-dir','fast-json-patch','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2032,0xd9));var _0x2203=function(_0x574019,_0x3c8054){_0x574019=_0x574019-0x0;var _0x2eceed=_0x2032[_0x574019];return _0x2eceed;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x2203('0x0'));var zipdir=require(_0x2203('0x1'));var jsonpatch=require(_0x2203('0x2'));var rp=require('request-promise');var moment=require(_0x2203('0x3'));var BPromise=require(_0x2203('0x4'));var Mustache=require('mustache');var util=require(_0x2203('0x5'));var path=require(_0x2203('0x6'));var sox=require(_0x2203('0x7'));var csv=require(_0x2203('0x8'));var ejs=require(_0x2203('0x9'));var fs=require('fs');var fs_extra=require(_0x2203('0xa'));var _=require(_0x2203('0xb'));var squel=require(_0x2203('0xc'));var crypto=require(_0x2203('0xd'));var jsforce=require(_0x2203('0xe'));var deskjs=require(_0x2203('0xf'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0x2203('0x10'));var Redis=require('ioredis');var authService=require(_0x2203('0x11'));var qs=require(_0x2203('0x12'));var as=require(_0x2203('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2203('0x14'))('api');var utils=require(_0x2203('0x15'));var config=require('../../config/environment');var licenseUtil=require(_0x2203('0x16'));var db=require(_0x2203('0x17'))['db'];function respondWithStatusCode(_0x4b9376,_0x583bc7){_0x583bc7=_0x583bc7||0xcc;return function(_0x585c76){if(_0x585c76){return _0x4b9376['sendStatus'](_0x583bc7);}return _0x4b9376['status'](_0x583bc7)[_0x2203('0x18')]();};}function respondWithResult(_0x538b30,_0x592e47){_0x592e47=_0x592e47||0xc8;return function(_0x21a3af){if(_0x21a3af){return _0x538b30[_0x2203('0x19')](_0x592e47)[_0x2203('0x1a')](_0x21a3af);}};}function respondWithFilteredResult(_0x41af85,_0x226209){return function(_0x3fe0a8){if(_0x3fe0a8){var _0x2c36e6=typeof _0x226209[_0x2203('0x1b')]===_0x2203('0x1c')&&typeof _0x226209[_0x2203('0x1d')]==='undefined';var _0x280eda=_0x3fe0a8[_0x2203('0x1e')];var _0x4893ff=_0x2c36e6?0x0:_0x226209[_0x2203('0x1b')];var _0x8906e1=_0x2c36e6?_0x3fe0a8['count']:_0x226209[_0x2203('0x1b')]+_0x226209['limit'];var _0x2904ba;if(_0x8906e1>=_0x280eda){_0x8906e1=_0x280eda;_0x2904ba=0xc8;}else{_0x2904ba=0xce;}_0x41af85[_0x2203('0x19')](_0x2904ba);return _0x41af85[_0x2203('0x1f')](_0x2203('0x20'),_0x4893ff+'-'+_0x8906e1+'/'+_0x280eda)[_0x2203('0x1a')](_0x3fe0a8);}return null;};}function patchUpdates(_0x449039){return function(_0x538c23){try{jsonpatch[_0x2203('0x21')](_0x538c23,_0x449039,!![]);}catch(_0x50822b){return BPromise['reject'](_0x50822b);}return _0x538c23[_0x2203('0x22')]();};}function saveUpdates(_0x496d82,_0x3b8ef9){return function(_0x5bfe61){if(_0x5bfe61){return _0x5bfe61['update'](_0x496d82)[_0x2203('0x23')](function(_0x5e29cd){return _0x5e29cd;});}return null;};}function removeEntity(_0x5c8da9,_0x226374){return function(_0x2718f5){if(_0x2718f5){return _0x2718f5[_0x2203('0x24')]()[_0x2203('0x23')](function(){_0x5c8da9[_0x2203('0x19')](0xcc)[_0x2203('0x18')]();});}};}function handleEntityNotFound(_0x49c12,_0x250349){return function(_0x576378){if(!_0x576378){_0x49c12[_0x2203('0x25')](0x194);}return _0x576378;};}function handleError(_0x36b958,_0x39a11a){_0x39a11a=_0x39a11a||0x1f4;return function(_0x5f11bf){logger[_0x2203('0x26')](_0x5f11bf[_0x2203('0x27')]);if(_0x5f11bf['name']){delete _0x5f11bf[_0x2203('0x28')];}_0x36b958[_0x2203('0x19')](_0x39a11a)[_0x2203('0x29')](_0x5f11bf);};}exports[_0x2203('0x2a')]=function(_0x28ae02,_0x1df508){var _0x9c53f={},_0x5a95c1={},_0x34b8ba={'count':0x0,'rows':[]};var _0x616ed8=_[_0x2203('0x2b')](db[_0x2203('0x2c')]['rawAttributes'],function(_0x3a8e23){return{'name':_0x3a8e23[_0x2203('0x2d')],'type':_0x3a8e23[_0x2203('0x2e')][_0x2203('0x2f')]};});_0x5a95c1['model']=_[_0x2203('0x2b')](_0x616ed8,_0x2203('0x28'));_0x5a95c1['query']=_['keys'](_0x28ae02[_0x2203('0x30')]);_0x5a95c1['filters']=_['intersection'](_0x5a95c1[_0x2203('0x31')],_0x5a95c1[_0x2203('0x30')]);_0x9c53f[_0x2203('0x32')]=_[_0x2203('0x33')](_0x5a95c1[_0x2203('0x31')],qs['fields'](_0x28ae02[_0x2203('0x30')][_0x2203('0x34')]));_0x9c53f['attributes']=_0x9c53f[_0x2203('0x32')][_0x2203('0x35')]?_0x9c53f[_0x2203('0x32')]:_0x5a95c1[_0x2203('0x31')];if(!_0x28ae02[_0x2203('0x30')][_0x2203('0x36')](_0x2203('0x37'))){_0x9c53f[_0x2203('0x1d')]=qs[_0x2203('0x1d')](_0x28ae02['query'][_0x2203('0x1d')]);_0x9c53f[_0x2203('0x1b')]=qs['offset'](_0x28ae02['query'][_0x2203('0x1b')]);}_0x9c53f['order']=qs[_0x2203('0x38')](_0x28ae02[_0x2203('0x30')][_0x2203('0x38')]);_0x9c53f['where']=qs['filters'](_[_0x2203('0x39')](_0x28ae02['query'],_0x5a95c1[_0x2203('0x3a')]),_0x616ed8);if(_0x28ae02['query'][_0x2203('0x3b')]){_0x9c53f['where']=_[_0x2203('0x3c')](_0x9c53f[_0x2203('0x3d')],{'$or':_[_0x2203('0x2b')](_0x616ed8,function(_0x40a793){if(_0x40a793[_0x2203('0x2e')]!=='VIRTUAL'){var _0x5f1561={};_0x5f1561[_0x40a793['name']]={'$like':'%'+_0x28ae02[_0x2203('0x30')][_0x2203('0x3b')]+'%'};return _0x5f1561;}})});}_0x9c53f=_[_0x2203('0x3c')]({},_0x9c53f,_0x28ae02[_0x2203('0x3e')]);var _0x3283fb={'where':_0x9c53f[_0x2203('0x3d')]};return db[_0x2203('0x2c')]['count'](_0x3283fb)[_0x2203('0x23')](function(_0x1b12c3){_0x34b8ba[_0x2203('0x1e')]=_0x1b12c3;if(_0x28ae02[_0x2203('0x30')]['includeAll']){_0x9c53f['include']=[{'attributes':['id',_0x2203('0x28'),'fullname',_0x2203('0x3f')],'model':db[_0x2203('0x40')],'as':_0x2203('0x40')}];}return db['VoiceCallReport']['findAll'](_0x9c53f);})[_0x2203('0x23')](function(_0x3739f6){_0x34b8ba[_0x2203('0x41')]=_0x3739f6;return _0x34b8ba;})[_0x2203('0x23')](respondWithFilteredResult(_0x1df508,_0x9c53f))[_0x2203('0x42')](handleError(_0x1df508,null));};exports[_0x2203('0x43')]=function(_0x5cd573,_0x15d3b6){var _0x165a3f={'raw':!![],'where':{'id':_0x5cd573[_0x2203('0x44')]['id']}},_0x3a866c={};_0x3a866c[_0x2203('0x31')]=_[_0x2203('0x45')](db[_0x2203('0x2c')][_0x2203('0x46')]);_0x3a866c[_0x2203('0x30')]=_[_0x2203('0x45')](_0x5cd573['query']);_0x3a866c[_0x2203('0x3a')]=_[_0x2203('0x33')](_0x3a866c[_0x2203('0x31')],_0x3a866c[_0x2203('0x30')]);_0x165a3f['attributes']=_['intersection'](_0x3a866c[_0x2203('0x31')],qs['fields'](_0x5cd573[_0x2203('0x30')][_0x2203('0x34')]));_0x165a3f[_0x2203('0x32')]=_0x165a3f[_0x2203('0x32')]['length']?_0x165a3f[_0x2203('0x32')]:_0x3a866c[_0x2203('0x31')];if(_0x5cd573['query'][_0x2203('0x47')]){_0x165a3f[_0x2203('0x48')]=[{'all':!![]}];}_0x165a3f=_[_0x2203('0x3c')]({},_0x165a3f,_0x5cd573[_0x2203('0x3e')]);return db['VoiceCallReport']['find'](_0x165a3f)[_0x2203('0x23')](handleEntityNotFound(_0x15d3b6,null))['then'](respondWithResult(_0x15d3b6,null))['catch'](handleError(_0x15d3b6,null));};exports[_0x2203('0x49')]=function(_0x33b7b5,_0x1a2665){return db['VoiceCallReport']['create'](_0x33b7b5[_0x2203('0x4a')],{})[_0x2203('0x23')](respondWithResult(_0x1a2665,0xc9))[_0x2203('0x42')](handleError(_0x1a2665,null));};exports[_0x2203('0x24')]=function(_0x225b0e,_0x21fd78){return db['VoiceCallReport'][_0x2203('0x4b')]({'where':{'id':_0x225b0e['params']['id']}})[_0x2203('0x23')](handleEntityNotFound(_0x21fd78,null))[_0x2203('0x23')](removeEntity(_0x21fd78,null))[_0x2203('0x42')](handleError(_0x21fd78,null));};exports[_0x2203('0x4c')]=function(_0x58b9bb,_0x506795){return db[_0x2203('0x2c')][_0x2203('0x4c')]()[_0x2203('0x23')](respondWithResult(_0x506795,null))[_0x2203('0x42')](handleError(_0x506795,null));};exports['update']=function(_0x4de47a,_0x49999a){if(_0x4de47a[_0x2203('0x4a')][_0x2203('0x4d')]){delete _0x4de47a['body'][_0x2203('0x4d')];}return db[_0x2203('0x2c')]['find']({'where':{'uniqueid':_0x4de47a[_0x2203('0x44')]['id'],'UserId':{'$or':[null,_0x4de47a[_0x2203('0x4e')]['id']]}}})[_0x2203('0x23')](handleEntityNotFound(_0x49999a,null))[_0x2203('0x23')](saveUpdates(_0x4de47a['body'],null))[_0x2203('0x23')](respondWithResult(_0x49999a,null))['catch'](handleError(_0x49999a,null));}; \ No newline at end of file +var _0x5f66=['../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/license/util','sendStatus','status','end','json','undefined','limit','count','offset','Content-Range','apply','reject','save','destroy','then','error','name','send','index','map','VoiceCallReport','rawAttributes','fieldName','model','keys','query','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','filter','merge','type','VIRTUAL','includeAll','include','fullname','alias','User','rows','catch','show','params','find','create','body','describe','uniqueid','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','path','to-csv','ejs','squel','crypto','jsforce','desk.js','querystring','../../components/auth/service','../../components/parsers/qs'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x5f66,0x1a0));var _0x65f6=function(_0x580576,_0x2f107d){_0x580576=_0x580576-0x0;var _0x3f55a0=_0x5f66[_0x580576];return _0x3f55a0;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x65f6('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x65f6('0x1'));var rp=require(_0x65f6('0x2'));var moment=require(_0x65f6('0x3'));var BPromise=require(_0x65f6('0x4'));var Mustache=require(_0x65f6('0x5'));var util=require('util');var path=require(_0x65f6('0x6'));var sox=require('sox');var csv=require(_0x65f6('0x7'));var ejs=require(_0x65f6('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x65f6('0x9'));var crypto=require(_0x65f6('0xa'));var jsforce=require(_0x65f6('0xb'));var deskjs=require(_0x65f6('0xc'));var toCsv=require(_0x65f6('0x7'));var querystring=require(_0x65f6('0xd'));var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0x65f6('0xe'));var qs=require(_0x65f6('0xf'));var as=require(_0x65f6('0x10'));var hardwareService=require(_0x65f6('0x11'));var logger=require('../../config/logger')(_0x65f6('0x12'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x65f6('0x13'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x419819,_0x4862a5){_0x4862a5=_0x4862a5||0xcc;return function(_0x2f964a){if(_0x2f964a){return _0x419819[_0x65f6('0x14')](_0x4862a5);}return _0x419819[_0x65f6('0x15')](_0x4862a5)[_0x65f6('0x16')]();};}function respondWithResult(_0x369f96,_0x1d29fd){_0x1d29fd=_0x1d29fd||0xc8;return function(_0x44144b){if(_0x44144b){return _0x369f96[_0x65f6('0x15')](_0x1d29fd)[_0x65f6('0x17')](_0x44144b);}};}function respondWithFilteredResult(_0x3440af,_0x59154e){return function(_0x19b9ff){if(_0x19b9ff){var _0x49a913=typeof _0x59154e['offset']===_0x65f6('0x18')&&typeof _0x59154e[_0x65f6('0x19')]===_0x65f6('0x18');var _0x1c955c=_0x19b9ff[_0x65f6('0x1a')];var _0x1f974c=_0x49a913?0x0:_0x59154e[_0x65f6('0x1b')];var _0x18380e=_0x49a913?_0x19b9ff['count']:_0x59154e['offset']+_0x59154e[_0x65f6('0x19')];var _0x5b4055;if(_0x18380e>=_0x1c955c){_0x18380e=_0x1c955c;_0x5b4055=0xc8;}else{_0x5b4055=0xce;}_0x3440af['status'](_0x5b4055);return _0x3440af['set'](_0x65f6('0x1c'),_0x1f974c+'-'+_0x18380e+'/'+_0x1c955c)[_0x65f6('0x17')](_0x19b9ff);}return null;};}function patchUpdates(_0x5114a4){return function(_0x39e19f){try{jsonpatch[_0x65f6('0x1d')](_0x39e19f,_0x5114a4,!![]);}catch(_0xbee6a4){return BPromise[_0x65f6('0x1e')](_0xbee6a4);}return _0x39e19f[_0x65f6('0x1f')]();};}function saveUpdates(_0xc139c2,_0x581374){return function(_0x197a49){if(_0x197a49){return _0x197a49['update'](_0xc139c2)['then'](function(_0x212247){return _0x212247;});}return null;};}function removeEntity(_0xd173f4,_0x524e42){return function(_0x1eeaaa){if(_0x1eeaaa){return _0x1eeaaa[_0x65f6('0x20')]()[_0x65f6('0x21')](function(){_0xd173f4[_0x65f6('0x15')](0xcc)['end']();});}};}function handleEntityNotFound(_0x9d7bb0,_0x59ea32){return function(_0x20a161){if(!_0x20a161){_0x9d7bb0['sendStatus'](0x194);}return _0x20a161;};}function handleError(_0x5cb131,_0x4fde2f){_0x4fde2f=_0x4fde2f||0x1f4;return function(_0x29abdb){logger[_0x65f6('0x22')](_0x29abdb['stack']);if(_0x29abdb[_0x65f6('0x23')]){delete _0x29abdb[_0x65f6('0x23')];}_0x5cb131['status'](_0x4fde2f)[_0x65f6('0x24')](_0x29abdb);};}exports[_0x65f6('0x25')]=function(_0x28d0df,_0x559330){var _0x4ac04b={},_0x488d36={},_0x266cfe={'count':0x0,'rows':[]};var _0x3c032f=_[_0x65f6('0x26')](db[_0x65f6('0x27')][_0x65f6('0x28')],function(_0x14a387){return{'name':_0x14a387[_0x65f6('0x29')],'type':_0x14a387['type']['key']};});_0x488d36[_0x65f6('0x2a')]=_[_0x65f6('0x26')](_0x3c032f,'name');_0x488d36['query']=_[_0x65f6('0x2b')](_0x28d0df[_0x65f6('0x2c')]);_0x488d36[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],_0x488d36[_0x65f6('0x2c')]);_0x4ac04b['attributes']=_[_0x65f6('0x2e')](_0x488d36[_0x65f6('0x2a')],qs[_0x65f6('0x2f')](_0x28d0df['query'][_0x65f6('0x2f')]));_0x4ac04b[_0x65f6('0x30')]=_0x4ac04b[_0x65f6('0x30')][_0x65f6('0x31')]?_0x4ac04b[_0x65f6('0x30')]:_0x488d36[_0x65f6('0x2a')];if(!_0x28d0df['query'][_0x65f6('0x32')](_0x65f6('0x33'))){_0x4ac04b['limit']=qs[_0x65f6('0x19')](_0x28d0df['query'][_0x65f6('0x19')]);_0x4ac04b['offset']=qs[_0x65f6('0x1b')](_0x28d0df[_0x65f6('0x2c')]['offset']);}_0x4ac04b[_0x65f6('0x34')]=qs[_0x65f6('0x35')](_0x28d0df[_0x65f6('0x2c')]['sort']);_0x4ac04b['where']=qs[_0x65f6('0x2d')](_['pick'](_0x28d0df[_0x65f6('0x2c')],_0x488d36['filters']),_0x3c032f);if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]){_0x4ac04b['where']=_[_0x65f6('0x37')](_0x4ac04b['where'],{'$or':_['map'](_0x3c032f,function(_0x71b16b){if(_0x71b16b[_0x65f6('0x38')]!==_0x65f6('0x39')){var _0x313be5={};_0x313be5[_0x71b16b[_0x65f6('0x23')]]={'$like':'%'+_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x36')]+'%'};return _0x313be5;}})});}_0x4ac04b=_[_0x65f6('0x37')]({},_0x4ac04b,_0x28d0df['options']);var _0x3aa254={'where':_0x4ac04b['where']};return db[_0x65f6('0x27')][_0x65f6('0x1a')](_0x3aa254)[_0x65f6('0x21')](function(_0x2ea7f7){_0x266cfe['count']=_0x2ea7f7;if(_0x28d0df[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x4ac04b[_0x65f6('0x3b')]=[{'attributes':['id',_0x65f6('0x23'),_0x65f6('0x3c'),_0x65f6('0x3d')],'model':db[_0x65f6('0x3e')],'as':_0x65f6('0x3e')}];}return db[_0x65f6('0x27')]['findAll'](_0x4ac04b);})[_0x65f6('0x21')](function(_0x400ed2){_0x266cfe[_0x65f6('0x3f')]=_0x400ed2;return _0x266cfe;})[_0x65f6('0x21')](respondWithFilteredResult(_0x559330,_0x4ac04b))[_0x65f6('0x40')](handleError(_0x559330,null));};exports[_0x65f6('0x41')]=function(_0xe0b72d,_0x2e91e8){var _0x461393={'raw':!![],'where':{'id':_0xe0b72d[_0x65f6('0x42')]['id']}},_0x2abbed={};_0x2abbed[_0x65f6('0x2a')]=_[_0x65f6('0x2b')](db[_0x65f6('0x27')][_0x65f6('0x28')]);_0x2abbed[_0x65f6('0x2c')]=_['keys'](_0xe0b72d[_0x65f6('0x2c')]);_0x2abbed[_0x65f6('0x2d')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],_0x2abbed['query']);_0x461393[_0x65f6('0x30')]=_[_0x65f6('0x2e')](_0x2abbed[_0x65f6('0x2a')],qs['fields'](_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x2f')]));_0x461393[_0x65f6('0x30')]=_0x461393[_0x65f6('0x30')]['length']?_0x461393[_0x65f6('0x30')]:_0x2abbed['model'];if(_0xe0b72d[_0x65f6('0x2c')][_0x65f6('0x3a')]){_0x461393['include']=[{'all':!![]}];}_0x461393=_[_0x65f6('0x37')]({},_0x461393,_0xe0b72d['options']);return db[_0x65f6('0x27')][_0x65f6('0x43')](_0x461393)[_0x65f6('0x21')](handleEntityNotFound(_0x2e91e8,null))[_0x65f6('0x21')](respondWithResult(_0x2e91e8,null))[_0x65f6('0x40')](handleError(_0x2e91e8,null));};exports[_0x65f6('0x44')]=function(_0x4d30c5,_0x51bf6c){return db[_0x65f6('0x27')][_0x65f6('0x44')](_0x4d30c5[_0x65f6('0x45')],{})[_0x65f6('0x21')](respondWithResult(_0x51bf6c,0xc9))[_0x65f6('0x40')](handleError(_0x51bf6c,null));};exports[_0x65f6('0x20')]=function(_0x149c28,_0x41690c){return db[_0x65f6('0x27')]['find']({'where':{'id':_0x149c28[_0x65f6('0x42')]['id']}})[_0x65f6('0x21')](handleEntityNotFound(_0x41690c,null))[_0x65f6('0x21')](removeEntity(_0x41690c,null))['catch'](handleError(_0x41690c,null));};exports[_0x65f6('0x46')]=function(_0x42d453,_0x49ba5a){return db[_0x65f6('0x27')][_0x65f6('0x46')]()['then'](respondWithResult(_0x49ba5a,null))[_0x65f6('0x40')](handleError(_0x49ba5a,null));};exports['update']=function(_0x247be3,_0x3b241f){if(_0x247be3[_0x65f6('0x45')]['uniqueid']){delete _0x247be3[_0x65f6('0x45')][_0x65f6('0x47')];}return db['VoiceCallReport'][_0x65f6('0x43')]({'where':{'uniqueid':_0x247be3[_0x65f6('0x42')]['id'],'UserId':{'$or':[null,_0x247be3['user']['id']]}}})[_0x65f6('0x21')](handleEntityNotFound(_0x3b241f,null))[_0x65f6('0x21')](saveUpdates(_0x247be3[_0x65f6('0x45')],null))[_0x65f6('0x21')](respondWithResult(_0x3b241f,null))[_0x65f6('0x40')](handleError(_0x3b241f,null));}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.model.js b/server/api/voiceCallReport/voiceCallReport.model.js index 7e66e84..1214d11 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 _0x8653=['api','moment','request-promise','../../config/environment','exports','define','uniqueid'];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0x8653,0x17a));var _0x3865=function(_0x33a29d,_0x331bbf){_0x33a29d=_0x33a29d-0x0;var _0xdbf71b=_0x8653[_0x33a29d];return _0xdbf71b;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x3865('0x0'));var moment=require(_0x3865('0x1'));var BPromise=require('bluebird');var rp=require(_0x3865('0x2'));var fs=require('fs');var path=require('path');var rimraf=require('rimraf');var config=require(_0x3865('0x3'));var attributes=require('./voiceCallReport.attributes');module[_0x3865('0x4')]=function(_0x4bf384,_0x141e71){return _0x4bf384[_0x3865('0x5')]('VoiceCallReport',attributes,{'tableName':'report_call','paranoid':![],'indexes':[{'fields':[_0x3865('0x6')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb97d=['moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceCallReport.attributes','exports','define','VoiceCallReport','report_call','util','../../config/logger','api'];(function(_0x237e5f,_0x14a8e8){var _0x320b57=function(_0x55132d){while(--_0x55132d){_0x237e5f['push'](_0x237e5f['shift']());}};_0x320b57(++_0x14a8e8);}(_0xb97d,0xb3));var _0xdb97=function(_0x3e112d,_0x2bb132){_0x3e112d=_0x3e112d-0x0;var _0x531c31=_0xb97d[_0x3e112d];return _0x531c31;};'use strict';var _=require('lodash');var util=require(_0xdb97('0x0'));var logger=require(_0xdb97('0x1'))(_0xdb97('0x2'));var moment=require(_0xdb97('0x3'));var BPromise=require(_0xdb97('0x4'));var rp=require(_0xdb97('0x5'));var fs=require('fs');var path=require(_0xdb97('0x6'));var rimraf=require(_0xdb97('0x7'));var config=require(_0xdb97('0x8'));var attributes=require(_0xdb97('0x9'));module[_0xdb97('0xa')]=function(_0x48231d,_0x3bee33){return _0x48231d[_0xdb97('0xb')](_0xdb97('0xc'),attributes,{'tableName':_0xdb97('0xd'),'paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceCallReport/voiceCallReport.rpc.js b/server/api/voiceCallReport/voiceCallReport.rpc.js index ab1876a..9e8f3b8 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 _0xc690=['info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceCallReport','VoiceCallReport','findAll','options','raw','limit','include','map','model','CreateVoiceCallReport','create','body','then','UpdateVoiceCallReport','update','where','attributes','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','http','request'];(function(_0x2c7c48,_0x12f0da){var _0x1711f6=function(_0x2201f8){while(--_0x2201f8){_0x2c7c48['push'](_0x2c7c48['shift']());}};_0x1711f6(++_0x12f0da);}(_0xc690,0x8a));var _0x0c69=function(_0x55b0a1,_0x1ee85c){_0x55b0a1=_0x55b0a1-0x0;var _0x2904e1=_0xc690[_0x55b0a1];return _0x2904e1;};'use strict';var _=require('lodash');var util=require(_0x0c69('0x0'));var moment=require(_0x0c69('0x1'));var BPromise=require(_0x0c69('0x2'));var rs=require(_0x0c69('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0c69('0x4'))['db'];var utils=require(_0x0c69('0x5'));var logger=require(_0x0c69('0x6'))(_0x0c69('0x7'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x0c69('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a63df,_0x7e9817,_0x2b7044){return new BPromise(function(_0x21f51b,_0x27bf27){return client[_0x0c69('0x9')](_0x4a63df,_0x2b7044)['then'](function(_0x454aea){logger[_0x0c69('0xa')](_0x0c69('0xb'),_0x7e9817,_0x0c69('0xc'));logger[_0x0c69('0xd')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x7e9817,_0x0c69('0xc'),JSON[_0x0c69('0xe')](_0x454aea));if(_0x454aea[_0x0c69('0xf')]){if(_0x454aea[_0x0c69('0xf')][_0x0c69('0x10')]===0x1f4){logger[_0x0c69('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x7e9817,_0x454aea[_0x0c69('0xf')][_0x0c69('0x11')]);return _0x27bf27(_0x454aea[_0x0c69('0xf')][_0x0c69('0x11')]);}logger[_0x0c69('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x7e9817,_0x454aea[_0x0c69('0xf')][_0x0c69('0x11')]);return _0x21f51b(_0x454aea[_0x0c69('0xf')][_0x0c69('0x11')]);}else{logger['info'](_0x0c69('0xb'),_0x7e9817,_0x0c69('0xc'));_0x21f51b(_0x454aea[_0x0c69('0x12')]['message']);}})[_0x0c69('0x13')](function(_0x224eea){logger[_0x0c69('0xf')](_0x0c69('0xb'),_0x7e9817,_0x224eea);_0x27bf27(_0x224eea);});});}exports[_0x0c69('0x14')]=function(_0x4b7677){var _0x4ff248=this;return new Promise(function(_0x2efe2a,_0x270138){return db[_0x0c69('0x15')][_0x0c69('0x16')]({'raw':_0x4b7677['options']?_0x4b7677[_0x0c69('0x17')][_0x0c69('0x18')]===undefined?!![]:![]:!![],'where':_0x4b7677[_0x0c69('0x17')]?_0x4b7677[_0x0c69('0x17')]['where']||null:null,'attributes':_0x4b7677['options']?_0x4b7677['options']['attributes']||null:null,'limit':_0x4b7677[_0x0c69('0x17')]?_0x4b7677[_0x0c69('0x17')][_0x0c69('0x19')]||null:null,'include':_0x4b7677[_0x0c69('0x17')]?_0x4b7677[_0x0c69('0x17')][_0x0c69('0x1a')]?_[_0x0c69('0x1b')](_0x4b7677[_0x0c69('0x17')][_0x0c69('0x1a')],function(_0x2fd6ed){return{'model':db[_0x2fd6ed['model']],'as':_0x2fd6ed['as'],'attributes':_0x2fd6ed['attributes'],'include':_0x2fd6ed['include']?_[_0x0c69('0x1b')](_0x2fd6ed[_0x0c69('0x1a')],function(_0x272d55){return{'model':db[_0x272d55[_0x0c69('0x1c')]],'as':_0x272d55['as'],'attributes':_0x272d55['attributes'],'include':_0x272d55[_0x0c69('0x1a')]?_[_0x0c69('0x1b')](_0x272d55[_0x0c69('0x1a')],function(_0x2b8d0c){return{'model':db[_0x2b8d0c['model']],'as':_0x2b8d0c['as'],'attributes':_0x2b8d0c['attributes']};}):[]};}):[]};}):[]:[]})['then'](function(_0x24c14f){logger[_0x0c69('0xa')]('GetVoiceCallReport',_0x4b7677);logger['debug'](_0x0c69('0x14'),_0x4b7677,JSON[_0x0c69('0xe')](_0x24c14f));_0x2efe2a(_0x24c14f);})[_0x0c69('0x13')](function(_0x101cb2){logger[_0x0c69('0xf')]('GetVoiceCallReport',_0x101cb2['message'],_0x4b7677);_0x270138(_0x4ff248['error'](0x1f4,_0x101cb2[_0x0c69('0x11')]));});});};exports[_0x0c69('0x1d')]=function(_0x2c19ec){var _0x28aef3=this;return new Promise(function(_0x2878c3,_0x40df24){return db[_0x0c69('0x15')][_0x0c69('0x1e')](_0x2c19ec[_0x0c69('0x1f')],{'raw':_0x2c19ec['options']?_0x2c19ec[_0x0c69('0x17')][_0x0c69('0x18')]===undefined?!![]:![]:!![]})[_0x0c69('0x20')](function(_0x9e633){logger['info'](_0x0c69('0x1d'),_0x2c19ec);logger[_0x0c69('0xd')](_0x0c69('0x1d'),_0x2c19ec,JSON['stringify'](_0x9e633));_0x2878c3(_0x9e633);})[_0x0c69('0x13')](function(_0x452e5b){logger[_0x0c69('0xf')](_0x0c69('0x1d'),_0x452e5b[_0x0c69('0x11')],_0x2c19ec);_0x40df24(_0x28aef3['error'](0x1f4,_0x452e5b[_0x0c69('0x11')]));});});};exports[_0x0c69('0x21')]=function(_0x4d7ea1){var _0x5917e2=this;return new Promise(function(_0x443c8d,_0x32c1aa){return db[_0x0c69('0x15')][_0x0c69('0x22')](_0x4d7ea1[_0x0c69('0x1f')],{'raw':_0x4d7ea1[_0x0c69('0x17')]?_0x4d7ea1[_0x0c69('0x17')][_0x0c69('0x18')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4d7ea1[_0x0c69('0x17')]?_0x4d7ea1[_0x0c69('0x17')][_0x0c69('0x23')]||null:null,'attributes':_0x4d7ea1[_0x0c69('0x17')]?_0x4d7ea1[_0x0c69('0x17')][_0x0c69('0x24')]||null:null,'limit':_0x4d7ea1[_0x0c69('0x17')]?_0x4d7ea1[_0x0c69('0x17')][_0x0c69('0x19')]||null:null})[_0x0c69('0x20')](function(_0x48d443){logger[_0x0c69('0xa')](_0x0c69('0x21'),_0x4d7ea1);logger[_0x0c69('0xd')]('UpdateVoiceCallReport',_0x4d7ea1,JSON[_0x0c69('0xe')](_0x48d443));_0x443c8d(_0x48d443);})[_0x0c69('0x13')](function(_0x4695aa){logger['error'](_0x0c69('0x21'),_0x4695aa[_0x0c69('0x11')],_0x4d7ea1);_0x32c1aa(_0x5917e2[_0x0c69('0xf')](0x1f4,_0x4695aa['message']));});});}; \ No newline at end of file +var _0x0009=['VoiceCallReport','create','body','raw','CreateVoiceCallReport','UpdateVoiceCallReport','update','util','moment','bluebird','randomstring','ioredis','rpc','../../config/environment','jayson/promise','http','request','info','VoiceCallReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','GetVoiceCallReport','findAll','options','where','attributes','limit','include','map','model','then'];(function(_0x45e875,_0x4f2ee6){var _0x127d46=function(_0x4666e7){while(--_0x4666e7){_0x45e875['push'](_0x45e875['shift']());}};_0x127d46(++_0x4f2ee6);}(_0x0009,0x1c3));var _0x9000=function(_0x1b9d97,_0x19159b){_0x1b9d97=_0x1b9d97-0x0;var _0x1d7a29=_0x0009[_0x1b9d97];return _0x1d7a29;};'use strict';var _=require('lodash');var util=require(_0x9000('0x0'));var moment=require(_0x9000('0x1'));var BPromise=require(_0x9000('0x2'));var rs=require(_0x9000('0x3'));var fs=require('fs');var Redis=require(_0x9000('0x4'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x9000('0x5'));var config=require(_0x9000('0x6'));var jayson=require(_0x9000('0x7'));var client=jayson['client'][_0x9000('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4bb909,_0x27fcf7,_0x57a99a){return new BPromise(function(_0x3d09cc,_0x5c8540){return client[_0x9000('0x9')](_0x4bb909,_0x57a99a)['then'](function(_0x370caa){logger[_0x9000('0xa')](_0x9000('0xb'),_0x27fcf7,_0x9000('0xc'));logger[_0x9000('0xd')]('VoiceCallReport,\x20%s,\x20%s,\x20%s',_0x27fcf7,'request\x20sent',JSON[_0x9000('0xe')](_0x370caa));if(_0x370caa[_0x9000('0xf')]){if(_0x370caa[_0x9000('0xf')][_0x9000('0x10')]===0x1f4){logger[_0x9000('0xf')]('VoiceCallReport,\x20%s,\x20%s',_0x27fcf7,_0x370caa[_0x9000('0xf')][_0x9000('0x11')]);return _0x5c8540(_0x370caa[_0x9000('0xf')][_0x9000('0x11')]);}logger['error'](_0x9000('0xb'),_0x27fcf7,_0x370caa['error'][_0x9000('0x11')]);return _0x3d09cc(_0x370caa[_0x9000('0xf')][_0x9000('0x11')]);}else{logger[_0x9000('0xa')]('VoiceCallReport,\x20%s,\x20%s',_0x27fcf7,_0x9000('0xc'));_0x3d09cc(_0x370caa[_0x9000('0x12')][_0x9000('0x11')]);}})[_0x9000('0x13')](function(_0x1799c2){logger[_0x9000('0xf')](_0x9000('0xb'),_0x27fcf7,_0x1799c2);_0x5c8540(_0x1799c2);});});}exports[_0x9000('0x14')]=function(_0x392f4c){var _0x118bec=this;return new Promise(function(_0x2ef76e,_0x24e538){return db['VoiceCallReport'][_0x9000('0x15')]({'raw':_0x392f4c[_0x9000('0x16')]?_0x392f4c[_0x9000('0x16')]['raw']===undefined?!![]:![]:!![],'where':_0x392f4c[_0x9000('0x16')]?_0x392f4c[_0x9000('0x16')][_0x9000('0x17')]||null:null,'attributes':_0x392f4c[_0x9000('0x16')]?_0x392f4c[_0x9000('0x16')][_0x9000('0x18')]||null:null,'limit':_0x392f4c[_0x9000('0x16')]?_0x392f4c[_0x9000('0x16')][_0x9000('0x19')]||null:null,'include':_0x392f4c['options']?_0x392f4c['options'][_0x9000('0x1a')]?_[_0x9000('0x1b')](_0x392f4c[_0x9000('0x16')]['include'],function(_0x2e38b0){return{'model':db[_0x2e38b0[_0x9000('0x1c')]],'as':_0x2e38b0['as'],'attributes':_0x2e38b0[_0x9000('0x18')],'include':_0x2e38b0['include']?_[_0x9000('0x1b')](_0x2e38b0[_0x9000('0x1a')],function(_0x1ec9b7){return{'model':db[_0x1ec9b7[_0x9000('0x1c')]],'as':_0x1ec9b7['as'],'attributes':_0x1ec9b7[_0x9000('0x18')],'include':_0x1ec9b7['include']?_[_0x9000('0x1b')](_0x1ec9b7[_0x9000('0x1a')],function(_0x42f383){return{'model':db[_0x42f383['model']],'as':_0x42f383['as'],'attributes':_0x42f383[_0x9000('0x18')]};}):[]};}):[]};}):[]:[]})[_0x9000('0x1d')](function(_0x909c58){logger['info'](_0x9000('0x14'),_0x392f4c);logger[_0x9000('0xd')]('GetVoiceCallReport',_0x392f4c,JSON[_0x9000('0xe')](_0x909c58));_0x2ef76e(_0x909c58);})[_0x9000('0x13')](function(_0x6d8286){logger['error'](_0x9000('0x14'),_0x6d8286[_0x9000('0x11')],_0x392f4c);_0x24e538(_0x118bec[_0x9000('0xf')](0x1f4,_0x6d8286[_0x9000('0x11')]));});});};exports['CreateVoiceCallReport']=function(_0x479c61){var _0x5159ec=this;return new Promise(function(_0x2ecbba,_0x5de1cc){return db[_0x9000('0x1e')][_0x9000('0x1f')](_0x479c61[_0x9000('0x20')],{'raw':_0x479c61[_0x9000('0x16')]?_0x479c61['options'][_0x9000('0x21')]===undefined?!![]:![]:!![]})[_0x9000('0x1d')](function(_0x1a1396){logger[_0x9000('0xa')](_0x9000('0x22'),_0x479c61);logger[_0x9000('0xd')](_0x9000('0x22'),_0x479c61,JSON['stringify'](_0x1a1396));_0x2ecbba(_0x1a1396);})[_0x9000('0x13')](function(_0x42a7f1){logger[_0x9000('0xf')](_0x9000('0x22'),_0x42a7f1[_0x9000('0x11')],_0x479c61);_0x5de1cc(_0x5159ec[_0x9000('0xf')](0x1f4,_0x42a7f1[_0x9000('0x11')]));});});};exports[_0x9000('0x23')]=function(_0x4b0b4c){var _0x30980b=this;return new Promise(function(_0x43a3a9,_0x238fec){return db['VoiceCallReport'][_0x9000('0x24')](_0x4b0b4c['body'],{'raw':_0x4b0b4c[_0x9000('0x16')]?_0x4b0b4c[_0x9000('0x16')][_0x9000('0x21')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4b0b4c[_0x9000('0x16')]?_0x4b0b4c[_0x9000('0x16')]['where']||null:null,'attributes':_0x4b0b4c[_0x9000('0x16')]?_0x4b0b4c[_0x9000('0x16')]['attributes']||null:null,'limit':_0x4b0b4c['options']?_0x4b0b4c['options'][_0x9000('0x19')]||null:null})['then'](function(_0xcef46){logger[_0x9000('0xa')](_0x9000('0x23'),_0x4b0b4c);logger[_0x9000('0xd')](_0x9000('0x23'),_0x4b0b4c,JSON[_0x9000('0xe')](_0xcef46));_0x43a3a9(_0xcef46);})[_0x9000('0x13')](function(_0x59b146){logger[_0x9000('0xf')]('UpdateVoiceCallReport',_0x59b146['message'],_0x4b0b4c);_0x238fec(_0x30980b[_0x9000('0xf')](0x1f4,_0x59b146[_0x9000('0x11')]));});});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/index.js b/server/api/voiceChanSpy/index.js index 575a4df..b1ecdf1 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 _0x12ce=['../../config/environment','get','isAuthenticated','/:id','show','post','create','put','update','delete','destroy','multer','util','path','express','Router','fs-extra','../../components/auth/service'];(function(_0x523fff,_0x24649c){var _0x3c7a34=function(_0x3c5621){while(--_0x3c5621){_0x523fff['push'](_0x523fff['shift']());}};_0x3c7a34(++_0x24649c);}(_0x12ce,0x12b));var _0xe12c=function(_0x2b10c6,_0x185590){_0x2b10c6=_0x2b10c6-0x0;var _0x3789d2=_0x12ce[_0x2b10c6];return _0x3789d2;};'use strict';var multer=require(_0xe12c('0x0'));var util=require(_0xe12c('0x1'));var path=require(_0xe12c('0x2'));var timeout=require('connect-timeout');var express=require(_0xe12c('0x3'));var router=express[_0xe12c('0x4')]();var fs_extra=require(_0xe12c('0x5'));var auth=require(_0xe12c('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe12c('0x7'));var controller=require('./voiceChanSpy.controller');router[_0xe12c('0x8')]('/',auth[_0xe12c('0x9')](),controller['index']);router[_0xe12c('0x8')](_0xe12c('0xa'),auth['isAuthenticated'](),controller[_0xe12c('0xb')]);router[_0xe12c('0xc')]('/',auth['isAuthenticated'](),controller[_0xe12c('0xd')]);router[_0xe12c('0xe')](_0xe12c('0xa'),auth['isAuthenticated'](),controller[_0xe12c('0xf')]);router[_0xe12c('0x10')](_0xe12c('0xa'),auth[_0xe12c('0x9')](),controller[_0xe12c('0x11')]);module['exports']=router; \ No newline at end of file +var _0x0576=['index','/:id','put','update','delete','exports','util','path','connect-timeout','fs-extra','../../components/interaction/service','../../config/environment','./voiceChanSpy.controller','isAuthenticated'];(function(_0x45a238,_0x16035b){var _0x300e9b=function(_0x52e74b){while(--_0x52e74b){_0x45a238['push'](_0x45a238['shift']());}};_0x300e9b(++_0x16035b);}(_0x0576,0xd8));var _0x6057=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x0576[_0x2dafbe];return _0x58a45a;};'use strict';var multer=require('multer');var util=require(_0x6057('0x0'));var path=require(_0x6057('0x1'));var timeout=require(_0x6057('0x2'));var express=require('express');var router=express['Router']();var fs_extra=require(_0x6057('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x6057('0x4'));var config=require(_0x6057('0x5'));var controller=require(_0x6057('0x6'));router['get']('/',auth[_0x6057('0x7')](),controller[_0x6057('0x8')]);router['get'](_0x6057('0x9'),auth[_0x6057('0x7')](),controller['show']);router['post']('/',auth[_0x6057('0x7')](),controller['create']);router[_0x6057('0xa')](_0x6057('0x9'),auth['isAuthenticated'](),controller[_0x6057('0xb')]);router[_0x6057('0xc')]('/:id',auth['isAuthenticated'](),controller['destroy']);module[_0x6057('0xd')]=router; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.attributes.js b/server/api/voiceChanSpy/voiceChanSpy.attributes.js index 7068d17..8bd5469 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 _0xd25b=['getDataValue','split','BOOLEAN','sequelize','exports','STRING','name','setDataValue','options','join'];(function(_0x2235bf,_0x3a06a7){var _0x4c3a64=function(_0x3b3bb6){while(--_0x3b3bb6){_0x2235bf['push'](_0x2235bf['shift']());}};_0x4c3a64(++_0x3a06a7);}(_0xd25b,0x8f));var _0xbd25=function(_0x21eefd,_0x3f409f){_0x21eefd=_0x21eefd-0x0;var _0xe6e978=_0xd25b[_0x21eefd];return _0xe6e978;};'use strict';var Sequelize=require(_0xbd25('0x0'));module[_0xbd25('0x1')]={'name':{'type':Sequelize[_0xbd25('0x2')]},'prefix':{'type':Sequelize[_0xbd25('0x2')],'unique':_0xbd25('0x3'),'allowNull':![]},'options':{'type':Sequelize['STRING'],'set':function(_0x2648b0){this[_0xbd25('0x4')](_0xbd25('0x5'),_0x2648b0?_0x2648b0[_0xbd25('0x6')](''):[]);},'get':function(){return this[_0xbd25('0x7')](_0xbd25('0x5'))?this[_0xbd25('0x7')](_0xbd25('0x5'))[_0xbd25('0x8')](''):[];}},'auth':{'type':Sequelize[_0xbd25('0x9')],'defaultValue':![]},'password':{'type':Sequelize[_0xbd25('0x2')]},'record':{'type':Sequelize[_0xbd25('0x9')],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0xbd25('0x2')]},'description':{'type':Sequelize[_0xbd25('0x2')]}}; \ No newline at end of file +var _0xf584=['exports','STRING','setDataValue','options','join','getDataValue','sequelize'];(function(_0x1ad82f,_0x37b630){var _0xe30d50=function(_0x40fb5a){while(--_0x40fb5a){_0x1ad82f['push'](_0x1ad82f['shift']());}};_0xe30d50(++_0x37b630);}(_0xf584,0x195));var _0x4f58=function(_0x34988b,_0x20cb3f){_0x34988b=_0x34988b-0x0;var _0x20486d=_0xf584[_0x34988b];return _0x20486d;};'use strict';var Sequelize=require(_0x4f58('0x0'));module[_0x4f58('0x1')]={'name':{'type':Sequelize['STRING']},'prefix':{'type':Sequelize[_0x4f58('0x2')],'unique':'name','allowNull':![]},'options':{'type':Sequelize[_0x4f58('0x2')],'set':function(_0x3da703){this[_0x4f58('0x3')](_0x4f58('0x4'),_0x3da703?_0x3da703[_0x4f58('0x5')](''):[]);},'get':function(){return this[_0x4f58('0x6')](_0x4f58('0x4'))?this[_0x4f58('0x6')]('options')['split'](''):[];}},'auth':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'password':{'type':Sequelize[_0x4f58('0x2')]},'record':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'recordingFormat':{'type':Sequelize[_0x4f58('0x2')]},'description':{'type':Sequelize[_0x4f58('0x2')]}}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.controller.js b/server/api/voiceChanSpy/voiceChanSpy.controller.js index 0e68ba4..a2729ba 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 _0x834d=['crypto','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','undefined','limit','offset','count','Content-Range','json','apply','reject','save','then','get','ChanSpies','destroy','error','stack','map','VoiceChanSpy','rawAttributes','fieldName','type','key','model','name','keys','query','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','filter','merge','includeAll','findAll','rows','show','include','options','create','user','UserProfileSection','find','userProfileId','autoAssociation','UserProfileResource','catch','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','body','params','eml-format','rimraf','fast-json-patch','bluebird','mustache','util','path','to-csv','ejs','fs-extra','lodash','squel'];(function(_0x52d0d3,_0x552ba6){var _0x1b4978=function(_0x15a2b1){while(--_0x15a2b1){_0x52d0d3['push'](_0x52d0d3['shift']());}};_0x1b4978(++_0x552ba6);}(_0x834d,0x140));var _0xd834=function(_0x801e52,_0x54cb6a){_0x801e52=_0x801e52-0x0;var _0x355633=_0x834d[_0x801e52];return _0x355633;};'use strict';var emlformat=require(_0xd834('0x0'));var rimraf=require(_0xd834('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd834('0x2'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0xd834('0x3'));var Mustache=require(_0xd834('0x4'));var util=require(_0xd834('0x5'));var path=require(_0xd834('0x6'));var sox=require('sox');var csv=require(_0xd834('0x7'));var ejs=require(_0xd834('0x8'));var fs=require('fs');var fs_extra=require(_0xd834('0x9'));var _=require(_0xd834('0xa'));var squel=require(_0xd834('0xb'));var crypto=require(_0xd834('0xc'));var jsforce=require(_0xd834('0xd'));var deskjs=require(_0xd834('0xe'));var toCsv=require(_0xd834('0x7'));var querystring=require(_0xd834('0xf'));var Papa=require('papaparse');var Redis=require(_0xd834('0x10'));var authService=require(_0xd834('0x11'));var qs=require('../../components/parsers/qs');var as=require(_0xd834('0x12'));var hardwareService=require(_0xd834('0x13'));var logger=require('../../config/logger')(_0xd834('0x14'));var utils=require(_0xd834('0x15'));var config=require(_0xd834('0x16'));var licenseUtil=require(_0xd834('0x17'));var db=require(_0xd834('0x18'))['db'];function respondWithStatusCode(_0xbcb6cc,_0x472126){_0x472126=_0x472126||0xcc;return function(_0x10f306){if(_0x10f306){return _0xbcb6cc[_0xd834('0x19')](_0x472126);}return _0xbcb6cc[_0xd834('0x1a')](_0x472126)[_0xd834('0x1b')]();};}function respondWithResult(_0x5d6c9a,_0x12d1d4){_0x12d1d4=_0x12d1d4||0xc8;return function(_0x138def){if(_0x138def){return _0x5d6c9a[_0xd834('0x1a')](_0x12d1d4)['json'](_0x138def);}};}function respondWithFilteredResult(_0xfbe0dd,_0x30315a){return function(_0x1aa77a){if(_0x1aa77a){var _0x3ddd9f=typeof _0x30315a['offset']===_0xd834('0x1c')&&typeof _0x30315a[_0xd834('0x1d')]===_0xd834('0x1c');var _0x4728f6=_0x1aa77a['count'];var _0x21ce1a=_0x3ddd9f?0x0:_0x30315a[_0xd834('0x1e')];var _0x530951=_0x3ddd9f?_0x1aa77a[_0xd834('0x1f')]:_0x30315a[_0xd834('0x1e')]+_0x30315a[_0xd834('0x1d')];var _0x536722;if(_0x530951>=_0x4728f6){_0x530951=_0x4728f6;_0x536722=0xc8;}else{_0x536722=0xce;}_0xfbe0dd[_0xd834('0x1a')](_0x536722);return _0xfbe0dd['set'](_0xd834('0x20'),_0x21ce1a+'-'+_0x530951+'/'+_0x4728f6)[_0xd834('0x21')](_0x1aa77a);}return null;};}function patchUpdates(_0x4b451e){return function(_0x40852a){try{jsonpatch[_0xd834('0x22')](_0x40852a,_0x4b451e,!![]);}catch(_0x32b86b){return BPromise[_0xd834('0x23')](_0x32b86b);}return _0x40852a[_0xd834('0x24')]();};}function saveUpdates(_0x45d83f,_0x59b604){return function(_0x6cec0d){if(_0x6cec0d){return _0x6cec0d['update'](_0x45d83f)[_0xd834('0x25')](function(_0x4c8a02){return _0x4c8a02;});}return null;};}function removeEntity(_0xb7e09f,_0x40874f){return function(_0xd1a893){if(_0xd1a893){return _0xd1a893['destroy']()['then'](function(){var _0x4b89b5=_0xd1a893[_0xd834('0x26')]({'plain':!![]});var _0x52e531=_0xd834('0x27');return db['UserProfileResource'][_0xd834('0x28')]({'where':{'type':_0x52e531,'resourceId':_0x4b89b5['id']}})['then'](function(){return _0xd1a893;});})[_0xd834('0x25')](function(){_0xb7e09f[_0xd834('0x1a')](0xcc)[_0xd834('0x1b')]();});}};}function handleEntityNotFound(_0x42cebf,_0x244e3f){return function(_0x570c95){if(!_0x570c95){_0x42cebf[_0xd834('0x19')](0x194);}return _0x570c95;};}function handleError(_0x557f7e,_0x3bbb02){_0x3bbb02=_0x3bbb02||0x1f4;return function(_0x42242a){logger[_0xd834('0x29')](_0x42242a[_0xd834('0x2a')]);if(_0x42242a['name']){delete _0x42242a['name'];}_0x557f7e[_0xd834('0x1a')](_0x3bbb02)['send'](_0x42242a);};}exports['index']=function(_0x58fb78,_0xc5b1a3){var _0x2737ac={},_0x3847c8={},_0x4f4602={'count':0x0,'rows':[]};var _0x562dee=_[_0xd834('0x2b')](db[_0xd834('0x2c')][_0xd834('0x2d')],function(_0x1f4e65){return{'name':_0x1f4e65[_0xd834('0x2e')],'type':_0x1f4e65[_0xd834('0x2f')][_0xd834('0x30')]};});_0x3847c8[_0xd834('0x31')]=_['map'](_0x562dee,_0xd834('0x32'));_0x3847c8['query']=_[_0xd834('0x33')](_0x58fb78[_0xd834('0x34')]);_0x3847c8['filters']=_[_0xd834('0x35')](_0x3847c8[_0xd834('0x31')],_0x3847c8['query']);_0x2737ac[_0xd834('0x36')]=_['intersection'](_0x3847c8[_0xd834('0x31')],qs[_0xd834('0x37')](_0x58fb78[_0xd834('0x34')]['fields']));_0x2737ac[_0xd834('0x36')]=_0x2737ac['attributes'][_0xd834('0x38')]?_0x2737ac[_0xd834('0x36')]:_0x3847c8['model'];if(!_0x58fb78[_0xd834('0x34')][_0xd834('0x39')]('nolimit')){_0x2737ac[_0xd834('0x1d')]=qs[_0xd834('0x1d')](_0x58fb78[_0xd834('0x34')]['limit']);_0x2737ac[_0xd834('0x1e')]=qs['offset'](_0x58fb78[_0xd834('0x34')]['offset']);}_0x2737ac[_0xd834('0x3a')]=qs[_0xd834('0x3b')](_0x58fb78[_0xd834('0x34')]['sort']);_0x2737ac[_0xd834('0x3c')]=qs[_0xd834('0x3d')](_[_0xd834('0x3e')](_0x58fb78[_0xd834('0x34')],_0x3847c8[_0xd834('0x3d')]),_0x562dee);if(_0x58fb78[_0xd834('0x34')][_0xd834('0x3f')]){_0x2737ac['where']=_[_0xd834('0x40')](_0x2737ac[_0xd834('0x3c')],{'$or':_[_0xd834('0x2b')](_0x562dee,function(_0x26c3e5){if(_0x26c3e5[_0xd834('0x2f')]!=='VIRTUAL'){var _0x1dcad6={};_0x1dcad6[_0x26c3e5[_0xd834('0x32')]]={'$like':'%'+_0x58fb78[_0xd834('0x34')]['filter']+'%'};return _0x1dcad6;}})});}_0x2737ac=_['merge']({},_0x2737ac,_0x58fb78['options']);var _0x347e56={'where':_0x2737ac[_0xd834('0x3c')]};return db[_0xd834('0x2c')]['count'](_0x347e56)[_0xd834('0x25')](function(_0x473260){_0x4f4602[_0xd834('0x1f')]=_0x473260;if(_0x58fb78[_0xd834('0x34')][_0xd834('0x41')]){_0x2737ac['include']=[{'all':!![]}];}return db[_0xd834('0x2c')][_0xd834('0x42')](_0x2737ac);})[_0xd834('0x25')](function(_0x28c4af){_0x4f4602[_0xd834('0x43')]=_0x28c4af;return _0x4f4602;})['then'](respondWithFilteredResult(_0xc5b1a3,_0x2737ac))['catch'](handleError(_0xc5b1a3,null));};exports[_0xd834('0x44')]=function(_0x19fbf5,_0x47cca6){var _0xd6fe69={'raw':![],'where':{'id':_0x19fbf5['params']['id']}},_0x5eb9c0={};_0x5eb9c0['model']=_[_0xd834('0x33')](db['VoiceChanSpy'][_0xd834('0x2d')]);_0x5eb9c0['query']=_['keys'](_0x19fbf5[_0xd834('0x34')]);_0x5eb9c0[_0xd834('0x3d')]=_['intersection'](_0x5eb9c0['model'],_0x5eb9c0[_0xd834('0x34')]);_0xd6fe69['attributes']=_[_0xd834('0x35')](_0x5eb9c0['model'],qs[_0xd834('0x37')](_0x19fbf5['query']['fields']));_0xd6fe69[_0xd834('0x36')]=_0xd6fe69[_0xd834('0x36')][_0xd834('0x38')]?_0xd6fe69[_0xd834('0x36')]:_0x5eb9c0['model'];if(_0x19fbf5[_0xd834('0x34')][_0xd834('0x41')]){_0xd6fe69[_0xd834('0x45')]=[{'all':!![]}];}_0xd6fe69=_[_0xd834('0x40')]({},_0xd6fe69,_0x19fbf5[_0xd834('0x46')]);return db[_0xd834('0x2c')]['find'](_0xd6fe69)[_0xd834('0x25')](handleEntityNotFound(_0x47cca6,null))[_0xd834('0x25')](respondWithResult(_0x47cca6,null))['catch'](handleError(_0x47cca6,null));};exports[_0xd834('0x47')]=function(_0x4bb603,_0x2cbb69){return db['VoiceChanSpy'][_0xd834('0x47')](_0x4bb603['body'],{})[_0xd834('0x25')](function(_0x3d5073){var _0x5c1c02=_0x4bb603[_0xd834('0x48')][_0xd834('0x26')]({'plain':!![]});if(!_0x5c1c02)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x5c1c02['role']===_0xd834('0x48')){var _0x3dc97d=_0x3d5073[_0xd834('0x26')]({'plain':!![]});var _0x59013d=_0xd834('0x27');return db[_0xd834('0x49')][_0xd834('0x4a')]({'where':{'name':_0x59013d,'userProfileId':_0x5c1c02[_0xd834('0x4b')]},'raw':!![]})[_0xd834('0x25')](function(_0x3c6eb4){if(_0x3c6eb4&&_0x3c6eb4[_0xd834('0x4c')]===0x0){return db[_0xd834('0x4d')][_0xd834('0x47')]({'name':_0x3dc97d[_0xd834('0x32')],'resourceId':_0x3dc97d['id'],'type':_0x3c6eb4['name'],'sectionId':_0x3c6eb4['id']},{})[_0xd834('0x25')](function(){return _0x3d5073;});}else{return _0x3d5073;}})[_0xd834('0x4e')](function(_0x5bcd52){logger[_0xd834('0x29')](_0xd834('0x4f'),_0x5bcd52);throw _0x5bcd52;});}return _0x3d5073;})[_0xd834('0x25')](respondWithResult(_0x2cbb69,0xc9))[_0xd834('0x4e')](handleError(_0x2cbb69,null));};exports[_0xd834('0x50')]=function(_0x5e393e,_0x755c3d){if(_0x5e393e[_0xd834('0x51')]['id']){delete _0x5e393e[_0xd834('0x51')]['id'];}return db[_0xd834('0x2c')]['find']({'where':{'id':_0x5e393e['params']['id']}})[_0xd834('0x25')](handleEntityNotFound(_0x755c3d,null))[_0xd834('0x25')](saveUpdates(_0x5e393e[_0xd834('0x51')],null))[_0xd834('0x25')](respondWithResult(_0x755c3d,null))[_0xd834('0x4e')](handleError(_0x755c3d,null));};exports[_0xd834('0x28')]=function(_0x301f8c,_0x54677a){return db[_0xd834('0x2c')][_0xd834('0x4a')]({'where':{'id':_0x301f8c[_0xd834('0x52')]['id']}})[_0xd834('0x25')](handleEntityNotFound(_0x54677a,null))[_0xd834('0x25')](removeEntity(_0x54677a,null))[_0xd834('0x4e')](handleError(_0x54677a,null));}; \ No newline at end of file +var _0x76bb=['nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','rawAttributes','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','autoAssociation','UserProfileResource','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','path','sox','ejs','fs-extra','lodash','squel','crypto','desk.js','to-csv','querystring','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','undefined','count','limit','Content-Range','apply','reject','update','destroy','get','ChanSpies','then','stack','send','map','VoiceChanSpy','fieldName','type','key','name','keys','filters','intersection','query','attributes','model','fields','length','hasOwnProperty'];(function(_0x1d2720,_0x234c8d){var _0x2b64b6=function(_0x1cf6ed){while(--_0x1cf6ed){_0x1d2720['push'](_0x1d2720['shift']());}};_0x2b64b6(++_0x234c8d);}(_0x76bb,0x16a));var _0xb76b=function(_0x19b3f9,_0xade753){_0x19b3f9=_0x19b3f9-0x0;var _0x18c3f6=_0x76bb[_0x19b3f9];return _0x18c3f6;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb76b('0x0'));var zipdir=require(_0xb76b('0x1'));var jsonpatch=require(_0xb76b('0x2'));var rp=require(_0xb76b('0x3'));var moment=require('moment');var BPromise=require(_0xb76b('0x4'));var Mustache=require(_0xb76b('0x5'));var util=require('util');var path=require(_0xb76b('0x6'));var sox=require(_0xb76b('0x7'));var csv=require('to-csv');var ejs=require(_0xb76b('0x8'));var fs=require('fs');var fs_extra=require(_0xb76b('0x9'));var _=require(_0xb76b('0xa'));var squel=require(_0xb76b('0xb'));var crypto=require(_0xb76b('0xc'));var jsforce=require('jsforce');var deskjs=require(_0xb76b('0xd'));var toCsv=require(_0xb76b('0xe'));var querystring=require(_0xb76b('0xf'));var Papa=require(_0xb76b('0x10'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0xb76b('0x11'));var as=require(_0xb76b('0x12'));var hardwareService=require(_0xb76b('0x13'));var logger=require(_0xb76b('0x14'))(_0xb76b('0x15'));var utils=require(_0xb76b('0x16'));var config=require(_0xb76b('0x17'));var licenseUtil=require(_0xb76b('0x18'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x2fd930,_0x53646c){_0x53646c=_0x53646c||0xcc;return function(_0x3c5fb3){if(_0x3c5fb3){return _0x2fd930[_0xb76b('0x19')](_0x53646c);}return _0x2fd930[_0xb76b('0x1a')](_0x53646c)[_0xb76b('0x1b')]();};}function respondWithResult(_0x4e715c,_0x10a6aa){_0x10a6aa=_0x10a6aa||0xc8;return function(_0x16d909){if(_0x16d909){return _0x4e715c['status'](_0x10a6aa)[_0xb76b('0x1c')](_0x16d909);}};}function respondWithFilteredResult(_0x4c642d,_0x2b4590){return function(_0x2d7495){if(_0x2d7495){var _0x15250f=typeof _0x2b4590[_0xb76b('0x1d')]==='undefined'&&typeof _0x2b4590['limit']===_0xb76b('0x1e');var _0x1a6b2f=_0x2d7495['count'];var _0x118056=_0x15250f?0x0:_0x2b4590[_0xb76b('0x1d')];var _0xe67ff4=_0x15250f?_0x2d7495[_0xb76b('0x1f')]:_0x2b4590[_0xb76b('0x1d')]+_0x2b4590[_0xb76b('0x20')];var _0x1c4d0a;if(_0xe67ff4>=_0x1a6b2f){_0xe67ff4=_0x1a6b2f;_0x1c4d0a=0xc8;}else{_0x1c4d0a=0xce;}_0x4c642d['status'](_0x1c4d0a);return _0x4c642d['set'](_0xb76b('0x21'),_0x118056+'-'+_0xe67ff4+'/'+_0x1a6b2f)[_0xb76b('0x1c')](_0x2d7495);}return null;};}function patchUpdates(_0x2470d7){return function(_0x27393f){try{jsonpatch[_0xb76b('0x22')](_0x27393f,_0x2470d7,!![]);}catch(_0x5c142d){return BPromise[_0xb76b('0x23')](_0x5c142d);}return _0x27393f['save']();};}function saveUpdates(_0x349507,_0x3f42e8){return function(_0x18dc90){if(_0x18dc90){return _0x18dc90[_0xb76b('0x24')](_0x349507)['then'](function(_0x4f5c2d){return _0x4f5c2d;});}return null;};}function removeEntity(_0x2b4f3f,_0x75cd9c){return function(_0x1c8a54){if(_0x1c8a54){return _0x1c8a54[_0xb76b('0x25')]()['then'](function(){var _0x2b7065=_0x1c8a54[_0xb76b('0x26')]({'plain':!![]});var _0x56704b=_0xb76b('0x27');return db['UserProfileResource']['destroy']({'where':{'type':_0x56704b,'resourceId':_0x2b7065['id']}})[_0xb76b('0x28')](function(){return _0x1c8a54;});})[_0xb76b('0x28')](function(){_0x2b4f3f[_0xb76b('0x1a')](0xcc)[_0xb76b('0x1b')]();});}};}function handleEntityNotFound(_0x49f53c,_0x43906f){return function(_0x3f1520){if(!_0x3f1520){_0x49f53c[_0xb76b('0x19')](0x194);}return _0x3f1520;};}function handleError(_0x3badb4,_0x10f976){_0x10f976=_0x10f976||0x1f4;return function(_0x1cf72b){logger['error'](_0x1cf72b[_0xb76b('0x29')]);if(_0x1cf72b['name']){delete _0x1cf72b['name'];}_0x3badb4[_0xb76b('0x1a')](_0x10f976)[_0xb76b('0x2a')](_0x1cf72b);};}exports['index']=function(_0x5b56e4,_0x18cdcd){var _0x244352={},_0x4e94af={},_0x2a60db={'count':0x0,'rows':[]};var _0x25189c=_[_0xb76b('0x2b')](db[_0xb76b('0x2c')]['rawAttributes'],function(_0x3425bd){return{'name':_0x3425bd[_0xb76b('0x2d')],'type':_0x3425bd[_0xb76b('0x2e')][_0xb76b('0x2f')]};});_0x4e94af['model']=_['map'](_0x25189c,_0xb76b('0x30'));_0x4e94af['query']=_[_0xb76b('0x31')](_0x5b56e4['query']);_0x4e94af[_0xb76b('0x32')]=_[_0xb76b('0x33')](_0x4e94af['model'],_0x4e94af[_0xb76b('0x34')]);_0x244352[_0xb76b('0x35')]=_[_0xb76b('0x33')](_0x4e94af[_0xb76b('0x36')],qs[_0xb76b('0x37')](_0x5b56e4[_0xb76b('0x34')][_0xb76b('0x37')]));_0x244352[_0xb76b('0x35')]=_0x244352[_0xb76b('0x35')][_0xb76b('0x38')]?_0x244352[_0xb76b('0x35')]:_0x4e94af['model'];if(!_0x5b56e4[_0xb76b('0x34')][_0xb76b('0x39')](_0xb76b('0x3a'))){_0x244352[_0xb76b('0x20')]=qs[_0xb76b('0x20')](_0x5b56e4[_0xb76b('0x34')][_0xb76b('0x20')]);_0x244352['offset']=qs[_0xb76b('0x1d')](_0x5b56e4[_0xb76b('0x34')][_0xb76b('0x1d')]);}_0x244352[_0xb76b('0x3b')]=qs['sort'](_0x5b56e4['query'][_0xb76b('0x3c')]);_0x244352[_0xb76b('0x3d')]=qs[_0xb76b('0x32')](_[_0xb76b('0x3e')](_0x5b56e4[_0xb76b('0x34')],_0x4e94af[_0xb76b('0x32')]),_0x25189c);if(_0x5b56e4[_0xb76b('0x34')][_0xb76b('0x3f')]){_0x244352[_0xb76b('0x3d')]=_[_0xb76b('0x40')](_0x244352[_0xb76b('0x3d')],{'$or':_[_0xb76b('0x2b')](_0x25189c,function(_0x30bd68){if(_0x30bd68['type']!==_0xb76b('0x41')){var _0x46b6d8={};_0x46b6d8[_0x30bd68[_0xb76b('0x30')]]={'$like':'%'+_0x5b56e4['query'][_0xb76b('0x3f')]+'%'};return _0x46b6d8;}})});}_0x244352=_['merge']({},_0x244352,_0x5b56e4[_0xb76b('0x42')]);var _0x4866c1={'where':_0x244352[_0xb76b('0x3d')]};return db[_0xb76b('0x2c')][_0xb76b('0x1f')](_0x4866c1)[_0xb76b('0x28')](function(_0x524672){_0x2a60db[_0xb76b('0x1f')]=_0x524672;if(_0x5b56e4[_0xb76b('0x34')][_0xb76b('0x43')]){_0x244352[_0xb76b('0x44')]=[{'all':!![]}];}return db[_0xb76b('0x2c')][_0xb76b('0x45')](_0x244352);})[_0xb76b('0x28')](function(_0x563960){_0x2a60db[_0xb76b('0x46')]=_0x563960;return _0x2a60db;})[_0xb76b('0x28')](respondWithFilteredResult(_0x18cdcd,_0x244352))['catch'](handleError(_0x18cdcd,null));};exports['show']=function(_0x1e7e62,_0x361fc6){var _0x2df6f0={'raw':![],'where':{'id':_0x1e7e62['params']['id']}},_0x36fa3b={};_0x36fa3b[_0xb76b('0x36')]=_[_0xb76b('0x31')](db[_0xb76b('0x2c')][_0xb76b('0x47')]);_0x36fa3b[_0xb76b('0x34')]=_['keys'](_0x1e7e62[_0xb76b('0x34')]);_0x36fa3b[_0xb76b('0x32')]=_[_0xb76b('0x33')](_0x36fa3b['model'],_0x36fa3b[_0xb76b('0x34')]);_0x2df6f0[_0xb76b('0x35')]=_[_0xb76b('0x33')](_0x36fa3b[_0xb76b('0x36')],qs[_0xb76b('0x37')](_0x1e7e62[_0xb76b('0x34')]['fields']));_0x2df6f0[_0xb76b('0x35')]=_0x2df6f0['attributes'][_0xb76b('0x38')]?_0x2df6f0[_0xb76b('0x35')]:_0x36fa3b[_0xb76b('0x36')];if(_0x1e7e62['query'][_0xb76b('0x43')]){_0x2df6f0[_0xb76b('0x44')]=[{'all':!![]}];}_0x2df6f0=_['merge']({},_0x2df6f0,_0x1e7e62[_0xb76b('0x42')]);return db[_0xb76b('0x2c')][_0xb76b('0x48')](_0x2df6f0)[_0xb76b('0x28')](handleEntityNotFound(_0x361fc6,null))[_0xb76b('0x28')](respondWithResult(_0x361fc6,null))[_0xb76b('0x49')](handleError(_0x361fc6,null));};exports[_0xb76b('0x4a')]=function(_0xb28a18,_0x192555){return db[_0xb76b('0x2c')][_0xb76b('0x4a')](_0xb28a18[_0xb76b('0x4b')],{})[_0xb76b('0x28')](function(_0x5af0b2){var _0x1748af=_0xb28a18[_0xb76b('0x4c')][_0xb76b('0x26')]({'plain':!![]});if(!_0x1748af)throw new Error(_0xb76b('0x4d'));if(_0x1748af['role']===_0xb76b('0x4c')){var _0xaeb3df=_0x5af0b2['get']({'plain':!![]});var _0x5ecd39=_0xb76b('0x27');return db[_0xb76b('0x4e')]['find']({'where':{'name':_0x5ecd39,'userProfileId':_0x1748af['userProfileId']},'raw':!![]})[_0xb76b('0x28')](function(_0x231639){if(_0x231639&&_0x231639[_0xb76b('0x4f')]===0x0){return db[_0xb76b('0x50')][_0xb76b('0x4a')]({'name':_0xaeb3df[_0xb76b('0x30')],'resourceId':_0xaeb3df['id'],'type':_0x231639[_0xb76b('0x30')],'sectionId':_0x231639['id']},{})['then'](function(){return _0x5af0b2;});}else{return _0x5af0b2;}})[_0xb76b('0x49')](function(_0x7a58bf){logger[_0xb76b('0x51')](_0xb76b('0x52'),_0x7a58bf);throw _0x7a58bf;});}return _0x5af0b2;})[_0xb76b('0x28')](respondWithResult(_0x192555,0xc9))[_0xb76b('0x49')](handleError(_0x192555,null));};exports['update']=function(_0x3a9588,_0xb2827b){if(_0x3a9588[_0xb76b('0x4b')]['id']){delete _0x3a9588['body']['id'];}return db[_0xb76b('0x2c')][_0xb76b('0x48')]({'where':{'id':_0x3a9588[_0xb76b('0x53')]['id']}})[_0xb76b('0x28')](handleEntityNotFound(_0xb2827b,null))[_0xb76b('0x28')](saveUpdates(_0x3a9588[_0xb76b('0x4b')],null))[_0xb76b('0x28')](respondWithResult(_0xb2827b,null))[_0xb76b('0x49')](handleError(_0xb2827b,null));};exports[_0xb76b('0x25')]=function(_0x45acf7,_0x30ac4d){return db[_0xb76b('0x2c')][_0xb76b('0x48')]({'where':{'id':_0x45acf7[_0xb76b('0x53')]['id']}})[_0xb76b('0x28')](handleEntityNotFound(_0x30ac4d,null))[_0xb76b('0x28')](removeEntity(_0x30ac4d,null))[_0xb76b('0x49')](handleError(_0x30ac4d,null));}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.model.js b/server/api/voiceChanSpy/voiceChanSpy.model.js index 5779221..9c2a941 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 _0x4283=['SIP/%s,%s','options','join','StopMixMonitor','concat','internal','name','findAll','catch','models','voice_chanspy','then','length','VoiceExtension','bulkCreate','destroy','lodash','./voiceChanSpy.attributes','%s%s','system','push','Set','format','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','Authenticate','password','ChanSpy'];(function(_0x255160,_0x28139a){var _0x1488f9=function(_0xa08e22){while(--_0xa08e22){_0x255160['push'](_0x255160['shift']());}};_0x1488f9(++_0x28139a);}(_0x4283,0xd6));var _0x3428=function(_0x6eddc1,_0x42a195){_0x6eddc1=_0x6eddc1-0x0;var _0x30c9aa=_0x4283[_0x6eddc1];return _0x30c9aa;};'use strict';var _=require(_0x3428('0x0'));var util=require('util');var BPromise=require('bluebird');var attributes=require(_0x3428('0x1'));var getUserApplications=function(_0x50a844,_0x1b86fa,_0x1b7e87){var _0x525e6b=0x1;var _0x52b8e7=[];var _0x43438f={'context':_0x1b86fa['context']||'from-sip','exten':util['format'](_0x3428('0x2'),_0x50a844['prefix'],_0x1b7e87),'type':_0x3428('0x3'),'isApp':![],'ChanSpyId':_0x50a844['id'],'UserId':_0x1b86fa['id']};_0x52b8e7[_0x3428('0x4')](_['merge']({'app':_0x3428('0x5'),'appdata':util[_0x3428('0x6')](_0x3428('0x7'),_0x3428('0x8')),'priority':_0x525e6b++},_0x43438f));if(_0x50a844[_0x3428('0x9')]){_0x52b8e7[_0x3428('0x4')](_['merge']({'app':_0x3428('0xa'),'appdata':util['format'](_0x3428('0xb'),_0x50a844[_0x3428('0xc')]),'priority':_0x525e6b++},_0x43438f));}if(_0x50a844[_0x3428('0xd')]){_0x52b8e7[_0x3428('0x4')](_['merge']({'app':_0x3428('0xe'),'appdata':_0x50a844[_0x3428('0xf')],'priority':_0x525e6b++},_0x43438f));}_0x52b8e7['push'](_['merge']({'app':_0x3428('0x10'),'appdata':util[_0x3428('0x6')](_0x3428('0x11'),_0x1b86fa['name'],_0x50a844[_0x3428('0x12')]?_0x50a844[_0x3428('0x12')][_0x3428('0x13')](''):''),'priority':_0x525e6b++},_0x43438f));if(_0x50a844[_0x3428('0x9')]){_0x52b8e7[_0x3428('0x4')](_['merge']({'app':_0x3428('0x14'),'priority':_0x525e6b++},_0x43438f));}return _0x52b8e7;};var getChanSpyApplications=function(_0x65cb3a,_0x3d9e91){var _0x276b5e=[];for(var _0x300934=0x0,_0x2ff028=0x1;_0x300934<_0x3d9e91['length'];_0x300934++,_0x2ff028=0x1){_0x276b5e=_0x276b5e[_0x3428('0x15')](getUserApplications(_0x65cb3a,_0x3d9e91[_0x300934],_0x3d9e91[_0x300934][_0x3428('0x16')]));if(_0x3d9e91[_0x300934][_0x3428('0x16')]!=_0x3d9e91[_0x300934][_0x3428('0x17')]){_0x276b5e=_0x276b5e['concat'](getUserApplications(_0x65cb3a,_0x3d9e91[_0x300934],_0x3d9e91[_0x300934][_0x3428('0x17')]));}}return _0x276b5e;};var getChanSpyPromise=function(_0x3c4067,_0xf64189){return new BPromise(function(_0x4bef7a,_0xebc618){return _0x3c4067['User'][_0x3428('0x18')]({'attributes':['id',_0x3428('0x17'),_0x3428('0x16')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})['then'](function(_0x51fd89){if(_0x51fd89){return _0x4bef7a(getChanSpyApplications(_0xf64189,_0x51fd89));}return _0x4bef7a([]);})[_0x3428('0x19')](function(_0x2e9b5c){_0xebc618(_0x2e9b5c);});});};module['exports']=function(_0x35d58c,_0x1cfe39){var _0x11d99d=_0x35d58c[_0x3428('0x1a')];return _0x35d58c['define']('VoiceChanSpy',attributes,{'tableName':_0x3428('0x1b'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x1f6c4a,_0x545327,_0x487145){return getChanSpyPromise(_0x11d99d,_0x1f6c4a)[_0x3428('0x1c')](function(_0x461181){if(_0x461181&&_0x461181[_0x3428('0x1d')]){return _0x11d99d[_0x3428('0x1e')][_0x3428('0x1f')](_0x461181);}})['then'](function(){_0x487145();})[_0x3428('0x19')](function(_0x3061d3){_0x487145(_0x3061d3);});},'afterUpdate':function(_0x18d7cc,_0x27a035,_0x33ce1e){return _0x11d99d[_0x3428('0x1e')][_0x3428('0x20')]({'where':{'ChanSpyId':_0x18d7cc['id']}})['then'](function(){return getChanSpyPromise(_0x11d99d,_0x18d7cc);})['then'](function(_0x339c00){if(_0x339c00&&_0x339c00[_0x3428('0x1d')]){return _0x11d99d['VoiceExtension'][_0x3428('0x1f')](_0x339c00);}})[_0x3428('0x1c')](function(){_0x33ce1e();})[_0x3428('0x19')](function(_0x3b4509){_0x33ce1e(_0x3b4509);});},'afterDestroy':function(_0x2a09f1,_0x1a583e,_0x4473c3){return _0x11d99d[_0x3428('0x1e')][_0x3428('0x20')]({'where':{'ChanSpyId':_0x2a09f1['id']}})[_0x3428('0x1c')](function(){_0x4473c3();})[_0x3428('0x19')](function(_0x5cb661){_0x4473c3(_0x5cb661);});}}});}; \ No newline at end of file +var _0xb9b7=['length','concat','internal','then','catch','exports','models','define','VoiceChanSpy','voice_chanspy','VoiceExtension','bulkCreate','destroy','lodash','util','bluebird','./voiceChanSpy.attributes','from-sip','format','prefix','system','push','CDR(type)=%s','chanspy','record','MixMonitor','${UNIQUEID}.%s,a','recordingFormat','auth','merge','Authenticate','password','ChanSpy','SIP/%s,%s','name','join','StopMixMonitor'];(function(_0x3a6c6d,_0x2dda5c){var _0x4868ed=function(_0x3f3682){while(--_0x3f3682){_0x3a6c6d['push'](_0x3a6c6d['shift']());}};_0x4868ed(++_0x2dda5c);}(_0xb9b7,0x135));var _0x7b9b=function(_0x80e6c6,_0x129adb){_0x80e6c6=_0x80e6c6-0x0;var _0x3e8dec=_0xb9b7[_0x80e6c6];return _0x3e8dec;};'use strict';var _=require(_0x7b9b('0x0'));var util=require(_0x7b9b('0x1'));var BPromise=require(_0x7b9b('0x2'));var attributes=require(_0x7b9b('0x3'));var getUserApplications=function(_0x22e1a2,_0x23500e,_0x640d40){var _0x5d9241=0x1;var _0x152e9e=[];var _0x150832={'context':_0x23500e['context']||_0x7b9b('0x4'),'exten':util[_0x7b9b('0x5')]('%s%s',_0x22e1a2[_0x7b9b('0x6')],_0x640d40),'type':_0x7b9b('0x7'),'isApp':![],'ChanSpyId':_0x22e1a2['id'],'UserId':_0x23500e['id']};_0x152e9e[_0x7b9b('0x8')](_['merge']({'app':'Set','appdata':util[_0x7b9b('0x5')](_0x7b9b('0x9'),_0x7b9b('0xa')),'priority':_0x5d9241++},_0x150832));if(_0x22e1a2[_0x7b9b('0xb')]){_0x152e9e[_0x7b9b('0x8')](_['merge']({'app':_0x7b9b('0xc'),'appdata':util['format'](_0x7b9b('0xd'),_0x22e1a2[_0x7b9b('0xe')]),'priority':_0x5d9241++},_0x150832));}if(_0x22e1a2[_0x7b9b('0xf')]){_0x152e9e[_0x7b9b('0x8')](_[_0x7b9b('0x10')]({'app':_0x7b9b('0x11'),'appdata':_0x22e1a2[_0x7b9b('0x12')],'priority':_0x5d9241++},_0x150832));}_0x152e9e[_0x7b9b('0x8')](_[_0x7b9b('0x10')]({'app':_0x7b9b('0x13'),'appdata':util[_0x7b9b('0x5')](_0x7b9b('0x14'),_0x23500e[_0x7b9b('0x15')],_0x22e1a2['options']?_0x22e1a2['options'][_0x7b9b('0x16')](''):''),'priority':_0x5d9241++},_0x150832));if(_0x22e1a2[_0x7b9b('0xb')]){_0x152e9e[_0x7b9b('0x8')](_['merge']({'app':_0x7b9b('0x17'),'priority':_0x5d9241++},_0x150832));}return _0x152e9e;};var getChanSpyApplications=function(_0x1a94cc,_0x34b4fb){var _0x16a51d=[];for(var _0x15dc31=0x0,_0x2ed921=0x1;_0x15dc31<_0x34b4fb[_0x7b9b('0x18')];_0x15dc31++,_0x2ed921=0x1){_0x16a51d=_0x16a51d[_0x7b9b('0x19')](getUserApplications(_0x1a94cc,_0x34b4fb[_0x15dc31],_0x34b4fb[_0x15dc31][_0x7b9b('0x1a')]));if(_0x34b4fb[_0x15dc31]['internal']!=_0x34b4fb[_0x15dc31]['name']){_0x16a51d=_0x16a51d['concat'](getUserApplications(_0x1a94cc,_0x34b4fb[_0x15dc31],_0x34b4fb[_0x15dc31]['name']));}}return _0x16a51d;};var getChanSpyPromise=function(_0xf533e8,_0x1f357d){return new BPromise(function(_0x3c2cc6,_0x2cbe6d){return _0xf533e8['User']['findAll']({'attributes':['id','name',_0x7b9b('0x1a')],'where':{'role':'agent','chanspy':!![]},'raw':!![]})[_0x7b9b('0x1b')](function(_0x5a5166){if(_0x5a5166){return _0x3c2cc6(getChanSpyApplications(_0x1f357d,_0x5a5166));}return _0x3c2cc6([]);})[_0x7b9b('0x1c')](function(_0xa75a4d){_0x2cbe6d(_0xa75a4d);});});};module[_0x7b9b('0x1d')]=function(_0x134720,_0x365695){var _0x77fa87=_0x134720[_0x7b9b('0x1e')];return _0x134720[_0x7b9b('0x1f')](_0x7b9b('0x20'),attributes,{'tableName':_0x7b9b('0x21'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'afterCreate':function(_0x2a54f8,_0x55a4d2,_0x3fc9c4){return getChanSpyPromise(_0x77fa87,_0x2a54f8)[_0x7b9b('0x1b')](function(_0x271c36){if(_0x271c36&&_0x271c36[_0x7b9b('0x18')]){return _0x77fa87[_0x7b9b('0x22')][_0x7b9b('0x23')](_0x271c36);}})['then'](function(){_0x3fc9c4();})[_0x7b9b('0x1c')](function(_0x50e60a){_0x3fc9c4(_0x50e60a);});},'afterUpdate':function(_0x252f9e,_0x2c1c3d,_0x4a23ae){return _0x77fa87['VoiceExtension']['destroy']({'where':{'ChanSpyId':_0x252f9e['id']}})[_0x7b9b('0x1b')](function(){return getChanSpyPromise(_0x77fa87,_0x252f9e);})[_0x7b9b('0x1b')](function(_0x5d6e98){if(_0x5d6e98&&_0x5d6e98['length']){return _0x77fa87[_0x7b9b('0x22')]['bulkCreate'](_0x5d6e98);}})[_0x7b9b('0x1b')](function(){_0x4a23ae();})[_0x7b9b('0x1c')](function(_0x39b4f9){_0x4a23ae(_0x39b4f9);});},'afterDestroy':function(_0x151ba5,_0x5d6ff7,_0x1ee1ba){return _0x77fa87['VoiceExtension'][_0x7b9b('0x24')]({'where':{'ChanSpyId':_0x151ba5['id']}})[_0x7b9b('0x1b')](function(){_0x1ee1ba();})[_0x7b9b('0x1c')](function(_0x3bb9ec){_0x1ee1ba(_0x3bb9ec);});}}});}; \ No newline at end of file diff --git a/server/api/voiceChanSpy/voiceChanSpy.rpc.js b/server/api/voiceChanSpy/voiceChanSpy.rpc.js index 4d51960..5ea38df 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 _0xa902=['message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error'];(function(_0x468b0f,_0x408566){var _0x3e74d9=function(_0x27a545){while(--_0x27a545){_0x468b0f['push'](_0x468b0f['shift']());}};_0x3e74d9(++_0x408566);}(_0xa902,0x8d));var _0x2a90=function(_0x31f364,_0x564cd6){_0x31f364=_0x31f364-0x0;var _0x2bacdc=_0xa902[_0x31f364];return _0x2bacdc;};'use strict';var _=require(_0x2a90('0x0'));var util=require(_0x2a90('0x1'));var moment=require(_0x2a90('0x2'));var BPromise=require(_0x2a90('0x3'));var rs=require(_0x2a90('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a90('0x5'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2a90('0x6'));var config=require(_0x2a90('0x7'));var jayson=require(_0x2a90('0x8'));var client=jayson[_0x2a90('0x9')][_0x2a90('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x25bcfc,_0x58369a,_0x4109e6){return new BPromise(function(_0x570659,_0x5ec2b9){return client[_0x2a90('0xb')](_0x25bcfc,_0x4109e6)[_0x2a90('0xc')](function(_0xe500bc){logger[_0x2a90('0xd')](_0x2a90('0xe'),_0x58369a,'request\x20sent');logger[_0x2a90('0xf')](_0x2a90('0x10'),_0x58369a,_0x2a90('0x11'),JSON[_0x2a90('0x12')](_0xe500bc));if(_0xe500bc['error']){if(_0xe500bc[_0x2a90('0x13')]['code']===0x1f4){logger[_0x2a90('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x58369a,_0xe500bc[_0x2a90('0x13')]['message']);return _0x5ec2b9(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}logger[_0x2a90('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x58369a,_0xe500bc['error']['message']);return _0x570659(_0xe500bc[_0x2a90('0x13')][_0x2a90('0x14')]);}else{logger['info'](_0x2a90('0xe'),_0x58369a,_0x2a90('0x11'));_0x570659(_0xe500bc[_0x2a90('0x15')][_0x2a90('0x14')]);}})[_0x2a90('0x16')](function(_0x37858e){logger[_0x2a90('0x13')](_0x2a90('0xe'),_0x58369a,_0x37858e);_0x5ec2b9(_0x37858e);});});} \ No newline at end of file +var _0x1be1=['stringify','error','code','message','result','catch','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request','then','info','VoiceChanSpy,\x20%s,\x20%s','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x51ac09,_0x383098){var _0x3f827d=function(_0x2d8d0f){while(--_0x2d8d0f){_0x51ac09['push'](_0x51ac09['shift']());}};_0x3f827d(++_0x383098);}(_0x1be1,0x192));var _0x11be=function(_0x10e00e,_0x2ef1f5){_0x10e00e=_0x10e00e-0x0;var _0x595b74=_0x1be1[_0x10e00e];return _0x595b74;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x11be('0x0'));var BPromise=require(_0x11be('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x11be('0x2'));var db=require(_0x11be('0x3'))['db'];var utils=require(_0x11be('0x4'));var logger=require(_0x11be('0x5'))('rpc');var config=require(_0x11be('0x6'));var jayson=require(_0x11be('0x7'));var client=jayson[_0x11be('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0xfe8c62,_0x497730,_0x18f661){return new BPromise(function(_0x11fc15,_0x246772){return client[_0x11be('0x9')](_0xfe8c62,_0x18f661)[_0x11be('0xa')](function(_0x5f3d04){logger[_0x11be('0xb')](_0x11be('0xc'),_0x497730,'request\x20sent');logger[_0x11be('0xd')](_0x11be('0xe'),_0x497730,_0x11be('0xf'),JSON[_0x11be('0x10')](_0x5f3d04));if(_0x5f3d04['error']){if(_0x5f3d04[_0x11be('0x11')][_0x11be('0x12')]===0x1f4){logger[_0x11be('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x497730,_0x5f3d04[_0x11be('0x11')][_0x11be('0x13')]);return _0x246772(_0x5f3d04['error'][_0x11be('0x13')]);}logger['error']('VoiceChanSpy,\x20%s,\x20%s',_0x497730,_0x5f3d04['error']['message']);return _0x11fc15(_0x5f3d04['error']['message']);}else{logger['info'](_0x11be('0xc'),_0x497730,'request\x20sent');_0x11fc15(_0x5f3d04[_0x11be('0x14')][_0x11be('0x13')]);}})[_0x11be('0x15')](function(_0x216b8c){logger['error'](_0x11be('0xc'),_0x497730,_0x216b8c);_0x246772(_0x216b8c);});});} \ No newline at end of file diff --git a/server/api/voiceContext/index.js b/server/api/voiceContext/index.js index 2bdaf3c..940004e 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 _0xe871=['connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','get','isAuthenticated','/:id','show','post','put','update','delete','destroy','exports','multer','util'];(function(_0x48dcca,_0x17dd90){var _0x111d82=function(_0x79dd0d){while(--_0x79dd0d){_0x48dcca['push'](_0x48dcca['shift']());}};_0x111d82(++_0x17dd90);}(_0xe871,0x154));var _0x1e87=function(_0x59e5bd,_0x19dedf){_0x59e5bd=_0x59e5bd-0x0;var _0x406e4a=_0xe871[_0x59e5bd];return _0x406e4a;};'use strict';var multer=require(_0x1e87('0x0'));var util=require(_0x1e87('0x1'));var path=require('path');var timeout=require(_0x1e87('0x2'));var express=require(_0x1e87('0x3'));var router=express[_0x1e87('0x4')]();var fs_extra=require(_0x1e87('0x5'));var auth=require(_0x1e87('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x1e87('0x7'));var controller=require('./voiceContext.controller');router[_0x1e87('0x8')]('/',auth[_0x1e87('0x9')](),controller['index']);router[_0x1e87('0x8')](_0x1e87('0xa'),auth['isAuthenticated'](),controller[_0x1e87('0xb')]);router[_0x1e87('0xc')]('/',auth[_0x1e87('0x9')](),controller['create']);router[_0x1e87('0xd')]('/:id',auth[_0x1e87('0x9')](),controller[_0x1e87('0xe')]);router[_0x1e87('0xf')]('/:id',auth[_0x1e87('0x9')](),controller[_0x1e87('0x10')]);module[_0x1e87('0x11')]=router; \ No newline at end of file +var _0xb0cd=['/:id','show','post','create','put','update','delete','destroy','multer','util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','get','isAuthenticated','index'];(function(_0x1d7037,_0x57dd95){var _0x4d6568=function(_0x5c64c5){while(--_0x5c64c5){_0x1d7037['push'](_0x1d7037['shift']());}};_0x4d6568(++_0x57dd95);}(_0xb0cd,0x138));var _0xdb0c=function(_0x54b675,_0x3be2ef){_0x54b675=_0x54b675-0x0;var _0x5b7d83=_0xb0cd[_0x54b675];return _0x5b7d83;};'use strict';var multer=require(_0xdb0c('0x0'));var util=require(_0xdb0c('0x1'));var path=require(_0xdb0c('0x2'));var timeout=require(_0xdb0c('0x3'));var express=require('express');var router=express[_0xdb0c('0x4')]();var fs_extra=require(_0xdb0c('0x5'));var auth=require('../../components/auth/service');var interaction=require(_0xdb0c('0x6'));var config=require(_0xdb0c('0x7'));var controller=require('./voiceContext.controller');router[_0xdb0c('0x8')]('/',auth[_0xdb0c('0x9')](),controller[_0xdb0c('0xa')]);router[_0xdb0c('0x8')](_0xdb0c('0xb'),auth['isAuthenticated'](),controller[_0xdb0c('0xc')]);router[_0xdb0c('0xd')]('/',auth[_0xdb0c('0x9')](),controller[_0xdb0c('0xe')]);router[_0xdb0c('0xf')](_0xdb0c('0xb'),auth['isAuthenticated'](),controller[_0xdb0c('0x10')]);router[_0xdb0c('0x11')](_0xdb0c('0xb'),auth[_0xdb0c('0x9')](),controller[_0xdb0c('0x12')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.attributes.js b/server/api/voiceContext/voiceContext.attributes.js index e132203..d88a3ef 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 _0x9635=['sequelize','STRING','name','BOOLEAN'];(function(_0x509614,_0x2d42b4){var _0x42b2f6=function(_0x8c7e05){while(--_0x8c7e05){_0x509614['push'](_0x509614['shift']());}};_0x42b2f6(++_0x2d42b4);}(_0x9635,0x1a0));var _0x5963=function(_0x27d52b,_0x12e957){_0x27d52b=_0x27d52b-0x0;var _0x136ec6=_0x9635[_0x27d52b];return _0x136ec6;};'use strict';var Sequelize=require(_0x5963('0x0'));module['exports']={'name':{'type':Sequelize[_0x5963('0x1')],'unique':_0x5963('0x2')},'description':{'type':Sequelize[_0x5963('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0x5963('0x3')],'defaultValue':0x0}}; \ No newline at end of file +var _0xf44b=['BOOLEAN','sequelize','STRING','name'];(function(_0x6069c5,_0x3b98e4){var _0x13c01e=function(_0x5276d9){while(--_0x5276d9){_0x6069c5['push'](_0x6069c5['shift']());}};_0x13c01e(++_0x3b98e4);}(_0xf44b,0x115));var _0xbf44=function(_0x13b8f3,_0x442821){_0x13b8f3=_0x13b8f3-0x0;var _0x1a6d06=_0xf44b[_0x13b8f3];return _0x1a6d06;};'use strict';var Sequelize=require(_0xbf44('0x0'));module['exports']={'name':{'type':Sequelize[_0xbf44('0x1')],'unique':_0xbf44('0x2')},'description':{'type':Sequelize[_0xbf44('0x1')],'allowNull':!![]},'defaultEntry':{'type':Sequelize[_0xbf44('0x3')],'defaultValue':0x0}}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.controller.js b/server/api/voiceContext/voiceContext.controller.js index 5f1ad40..89497c9 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 _0xe448=['error','code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','Contexts','UserProfileResource','name','send','index','map','VoiceContext','fieldName','key','model','query','filters','intersection','fields','attributes','length','hasOwnProperty','sort','where','filter','type','VIRTUAL','merge','options','includeAll','include','findAll','rows','show','params','keys','rawAttributes','create','body','readFileSync','join','root','server/files/templates/context.ejs','utf8','render','writeFileSync','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','find','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','mustache','util','path','lodash','squel','jsforce','to-csv','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','jayson/promise','client','http','VoiceContext,\x20%s,\x20%s','debug','VoiceContext,\x20%s,\x20%s,\x20%s','request\x20sent','stringify'];(function(_0x41288c,_0x4663f6){var _0x1f217b=function(_0x414f1f){while(--_0x414f1f){_0x41288c['push'](_0x41288c['shift']());}};_0x1f217b(++_0x4663f6);}(_0xe448,0x175));var _0x8e44=function(_0x4ccf1e,_0x124269){_0x4ccf1e=_0x4ccf1e-0x0;var _0xc0df7d=_0xe448[_0x4ccf1e];return _0xc0df7d;};'use strict';var emlformat=require(_0x8e44('0x0'));var rimraf=require(_0x8e44('0x1'));var zipdir=require(_0x8e44('0x2'));var jsonpatch=require(_0x8e44('0x3'));var rp=require(_0x8e44('0x4'));var moment=require(_0x8e44('0x5'));var BPromise=require('bluebird');var Mustache=require(_0x8e44('0x6'));var util=require(_0x8e44('0x7'));var path=require(_0x8e44('0x8'));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(_0x8e44('0x9'));var squel=require(_0x8e44('0xa'));var crypto=require('crypto');var jsforce=require(_0x8e44('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x8e44('0xc'));var querystring=require(_0x8e44('0xd'));var Papa=require('papaparse');var Redis=require(_0x8e44('0xe'));var authService=require('../../components/auth/service');var qs=require(_0x8e44('0xf'));var as=require(_0x8e44('0x10'));var hardwareService=require(_0x8e44('0x11'));var logger=require(_0x8e44('0x12'))('api');var utils=require(_0x8e44('0x13'));var config=require(_0x8e44('0x14'));var licenseUtil=require(_0x8e44('0x15'));var db=require(_0x8e44('0x16'))['db'];var jayson=require(_0x8e44('0x17'));var client=jayson[_0x8e44('0x18')][_0x8e44('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x98e475,_0x4e7d19,_0x29ce03,_0x20ca9f){return new BPromise(function(_0x24cf09,_0x1b058a){var _0x28cf5f=_0x20ca9f||client;return _0x28cf5f['request'](_0x98e475,_0x29ce03)['then'](function(_0x59006c){logger['info'](_0x8e44('0x1a'),_0x4e7d19,'request\x20sent');logger[_0x8e44('0x1b')](_0x8e44('0x1c'),_0x4e7d19,_0x8e44('0x1d'),JSON[_0x8e44('0x1e')](_0x59006c));if(_0x59006c[_0x8e44('0x1f')]){if(_0x59006c['error'][_0x8e44('0x20')]===0x1f4){logger['error'](_0x8e44('0x1a'),_0x4e7d19,_0x59006c['error'][_0x8e44('0x21')]);return _0x1b058a(_0x59006c['error'][_0x8e44('0x21')]);}logger[_0x8e44('0x1f')]('VoiceContext,\x20%s,\x20%s',_0x4e7d19,_0x59006c['error'][_0x8e44('0x21')]);return _0x24cf09(_0x59006c['error'][_0x8e44('0x21')]);}else{logger['info'](_0x8e44('0x1a'),_0x4e7d19,_0x8e44('0x1d'));_0x24cf09(_0x59006c['result'][_0x8e44('0x21')]);}})[_0x8e44('0x22')](function(_0x6bb9b6){logger['error'](_0x8e44('0x1a'),_0x4e7d19,_0x6bb9b6);_0x1b058a(_0x6bb9b6);});});}function respondWithStatusCode(_0x4d3499,_0x50af5a){_0x50af5a=_0x50af5a||0xcc;return function(_0x5dc10b){if(_0x5dc10b){return _0x4d3499[_0x8e44('0x23')](_0x50af5a);}return _0x4d3499[_0x8e44('0x24')](_0x50af5a)[_0x8e44('0x25')]();};}function respondWithResult(_0x283128,_0x572c46){_0x572c46=_0x572c46||0xc8;return function(_0x98dfbe){if(_0x98dfbe){return _0x283128['status'](_0x572c46)[_0x8e44('0x26')](_0x98dfbe);}};}function respondWithFilteredResult(_0x54fd73,_0x271f76){return function(_0x958310){if(_0x958310){var _0x59ce4b=typeof _0x271f76[_0x8e44('0x27')]===_0x8e44('0x28')&&typeof _0x271f76[_0x8e44('0x29')]===_0x8e44('0x28');var _0x363645=_0x958310[_0x8e44('0x2a')];var _0x517dfa=_0x59ce4b?0x0:_0x271f76[_0x8e44('0x27')];var _0x4cb1af=_0x59ce4b?_0x958310[_0x8e44('0x2a')]:_0x271f76[_0x8e44('0x27')]+_0x271f76[_0x8e44('0x29')];var _0x4bbd44;if(_0x4cb1af>=_0x363645){_0x4cb1af=_0x363645;_0x4bbd44=0xc8;}else{_0x4bbd44=0xce;}_0x54fd73[_0x8e44('0x24')](_0x4bbd44);return _0x54fd73[_0x8e44('0x2b')](_0x8e44('0x2c'),_0x517dfa+'-'+_0x4cb1af+'/'+_0x363645)[_0x8e44('0x26')](_0x958310);}return null;};}function patchUpdates(_0x653a8){return function(_0x23aced){try{jsonpatch[_0x8e44('0x2d')](_0x23aced,_0x653a8,!![]);}catch(_0x3c076e){return BPromise[_0x8e44('0x2e')](_0x3c076e);}return _0x23aced[_0x8e44('0x2f')]();};}function saveUpdates(_0x9b2ea2,_0x1e621d){return function(_0x2b2ec4){if(_0x2b2ec4){return _0x2b2ec4[_0x8e44('0x30')](_0x9b2ea2)['then'](function(_0x284164){return _0x284164;});}return null;};}function removeEntity(_0x36e1c9,_0x58d07a){return function(_0x2c7b76){if(_0x2c7b76){return _0x2c7b76[_0x8e44('0x31')]()[_0x8e44('0x32')](function(){var _0xfaad0e=_0x2c7b76[_0x8e44('0x33')]({'plain':!![]});var _0x4df719=_0x8e44('0x34');return db[_0x8e44('0x35')]['destroy']({'where':{'type':_0x4df719,'resourceId':_0xfaad0e['id']}})[_0x8e44('0x32')](function(){return _0x2c7b76;});})['then'](function(){_0x36e1c9['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x24b5d7,_0x5d27b3){return function(_0x13179b){if(!_0x13179b){_0x24b5d7['sendStatus'](0x194);}return _0x13179b;};}function handleError(_0x3a54ea,_0x3e9f64){_0x3e9f64=_0x3e9f64||0x1f4;return function(_0x1dea0c){logger[_0x8e44('0x1f')](_0x1dea0c['stack']);if(_0x1dea0c[_0x8e44('0x36')]){delete _0x1dea0c[_0x8e44('0x36')];}_0x3a54ea[_0x8e44('0x24')](_0x3e9f64)[_0x8e44('0x37')](_0x1dea0c);};}exports[_0x8e44('0x38')]=function(_0x2f421d,_0x311435){var _0x8b9cd3={},_0x655fcd={},_0x204c8b={'count':0x0,'rows':[]};var _0x14891b=_[_0x8e44('0x39')](db[_0x8e44('0x3a')]['rawAttributes'],function(_0x587497){return{'name':_0x587497[_0x8e44('0x3b')],'type':_0x587497['type'][_0x8e44('0x3c')]};});_0x655fcd[_0x8e44('0x3d')]=_[_0x8e44('0x39')](_0x14891b,_0x8e44('0x36'));_0x655fcd[_0x8e44('0x3e')]=_['keys'](_0x2f421d[_0x8e44('0x3e')]);_0x655fcd[_0x8e44('0x3f')]=_[_0x8e44('0x40')](_0x655fcd[_0x8e44('0x3d')],_0x655fcd[_0x8e44('0x3e')]);_0x8b9cd3['attributes']=_['intersection'](_0x655fcd['model'],qs[_0x8e44('0x41')](_0x2f421d[_0x8e44('0x3e')][_0x8e44('0x41')]));_0x8b9cd3['attributes']=_0x8b9cd3[_0x8e44('0x42')][_0x8e44('0x43')]?_0x8b9cd3[_0x8e44('0x42')]:_0x655fcd[_0x8e44('0x3d')];if(!_0x2f421d[_0x8e44('0x3e')][_0x8e44('0x44')]('nolimit')){_0x8b9cd3[_0x8e44('0x29')]=qs[_0x8e44('0x29')](_0x2f421d['query'][_0x8e44('0x29')]);_0x8b9cd3[_0x8e44('0x27')]=qs[_0x8e44('0x27')](_0x2f421d[_0x8e44('0x3e')][_0x8e44('0x27')]);}_0x8b9cd3['order']=qs[_0x8e44('0x45')](_0x2f421d[_0x8e44('0x3e')][_0x8e44('0x45')]);_0x8b9cd3[_0x8e44('0x46')]=qs[_0x8e44('0x3f')](_['pick'](_0x2f421d[_0x8e44('0x3e')],_0x655fcd[_0x8e44('0x3f')]),_0x14891b);if(_0x2f421d[_0x8e44('0x3e')][_0x8e44('0x47')]){_0x8b9cd3['where']=_['merge'](_0x8b9cd3['where'],{'$or':_[_0x8e44('0x39')](_0x14891b,function(_0x2b485d){if(_0x2b485d[_0x8e44('0x48')]!==_0x8e44('0x49')){var _0x1dea53={};_0x1dea53[_0x2b485d[_0x8e44('0x36')]]={'$like':'%'+_0x2f421d[_0x8e44('0x3e')][_0x8e44('0x47')]+'%'};return _0x1dea53;}})});}_0x8b9cd3=_[_0x8e44('0x4a')]({},_0x8b9cd3,_0x2f421d[_0x8e44('0x4b')]);var _0x124512={'where':_0x8b9cd3['where']};return db['VoiceContext']['count'](_0x124512)[_0x8e44('0x32')](function(_0x5356f0){_0x204c8b['count']=_0x5356f0;if(_0x2f421d['query'][_0x8e44('0x4c')]){_0x8b9cd3[_0x8e44('0x4d')]=[{'all':!![]}];}return db['VoiceContext'][_0x8e44('0x4e')](_0x8b9cd3);})['then'](function(_0x25c906){_0x204c8b[_0x8e44('0x4f')]=_0x25c906;return _0x204c8b;})[_0x8e44('0x32')](respondWithFilteredResult(_0x311435,_0x8b9cd3))['catch'](handleError(_0x311435,null));};exports[_0x8e44('0x50')]=function(_0x399946,_0x2414e9){var _0x2d0d0e={'raw':![],'where':{'id':_0x399946[_0x8e44('0x51')]['id']}},_0x287436={};_0x287436[_0x8e44('0x3d')]=_[_0x8e44('0x52')](db['VoiceContext'][_0x8e44('0x53')]);_0x287436['query']=_[_0x8e44('0x52')](_0x399946[_0x8e44('0x3e')]);_0x287436[_0x8e44('0x3f')]=_[_0x8e44('0x40')](_0x287436[_0x8e44('0x3d')],_0x287436[_0x8e44('0x3e')]);_0x2d0d0e[_0x8e44('0x42')]=_['intersection'](_0x287436[_0x8e44('0x3d')],qs[_0x8e44('0x41')](_0x399946[_0x8e44('0x3e')][_0x8e44('0x41')]));_0x2d0d0e[_0x8e44('0x42')]=_0x2d0d0e['attributes'][_0x8e44('0x43')]?_0x2d0d0e[_0x8e44('0x42')]:_0x287436[_0x8e44('0x3d')];if(_0x399946['query'][_0x8e44('0x4c')]){_0x2d0d0e['include']=[{'all':!![]}];}_0x2d0d0e=_[_0x8e44('0x4a')]({},_0x2d0d0e,_0x399946[_0x8e44('0x4b')]);return db[_0x8e44('0x3a')]['find'](_0x2d0d0e)['then'](handleEntityNotFound(_0x2414e9,null))[_0x8e44('0x32')](respondWithResult(_0x2414e9,null))[_0x8e44('0x22')](handleError(_0x2414e9,null));};exports[_0x8e44('0x54')]=function(_0xdee772,_0x1a6b13,_0x369cb1){var _0x3373cb;return db[_0x8e44('0x3a')][_0x8e44('0x54')](_0xdee772[_0x8e44('0x55')],{'raw':!![]})[_0x8e44('0x32')](function(_0x3842e1){_0x3373cb=_0x3842e1;return db[_0x8e44('0x3a')][_0x8e44('0x4e')]({'raw':!![]});})['then'](function(_0x4083e5){var _0xaa8a59=fs[_0x8e44('0x56')](path[_0x8e44('0x57')](config[_0x8e44('0x58')],_0x8e44('0x59')),_0x8e44('0x5a'));var _0x212591=ejs[_0x8e44('0x5b')](_0xaa8a59,{'contexts':_0x4083e5||[]});fs[_0x8e44('0x5c')](_0x8e44('0x5d'),_0x212591);})[_0x8e44('0x32')](function(){return respondWithRpcPromise(_0x8e44('0x5e'),'create',{'module':_0x8e44('0x5f')});})['then'](function(){var _0x1bfdba=_0xdee772[_0x8e44('0x60')][_0x8e44('0x33')]({'plain':!![]});if(!_0x1bfdba)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1bfdba['role']===_0x8e44('0x60')){var _0x2a96e5=_0x3373cb['get']({'plain':!![]});return db['UserProfileSection']['find']({'where':{'name':'Contexts','userProfileId':_0x1bfdba[_0x8e44('0x61')]},'raw':!![]})[_0x8e44('0x32')](function(_0x55bc0c){if(_0x55bc0c&&_0x55bc0c[_0x8e44('0x62')]===0x0){return db[_0x8e44('0x35')][_0x8e44('0x54')]({'name':_0x2a96e5['name'],'resourceId':_0x2a96e5['id'],'type':_0x55bc0c[_0x8e44('0x36')],'sectionId':_0x55bc0c['id']},{})[_0x8e44('0x32')](function(){return _0x3373cb;});}else{return _0x3373cb;}})['catch'](function(_0x5095ab){logger[_0x8e44('0x1f')](_0x8e44('0x63'),_0x5095ab);throw _0x5095ab;});}return _0x3373cb;})['then'](respondWithResult(_0x1a6b13,0xc9))['catch'](handleError(_0x1a6b13,null));};exports['update']=function(_0x377a90,_0x2ebc6e,_0x6ea851){var _0x473f9b;return db[_0x8e44('0x3a')][_0x8e44('0x64')]({'where':{'id':_0x377a90[_0x8e44('0x51')]['id']}})['then'](handleEntityNotFound(_0x2ebc6e,null))[_0x8e44('0x32')](saveUpdates(_0x377a90[_0x8e44('0x55')],null))[_0x8e44('0x32')](function(_0x1a31a0){if(_0x1a31a0){_0x473f9b=_0x1a31a0;return db[_0x8e44('0x3a')]['findAll']({'raw':!![]});}})[_0x8e44('0x32')](function(_0x1ff08e){var _0x34edf9=fs[_0x8e44('0x56')](path['join'](config[_0x8e44('0x58')],'server/files/templates/context.ejs'),'utf8');var _0x5b382a=ejs['render'](_0x34edf9,{'contexts':_0x1ff08e||[]});fs['writeFileSync'](_0x8e44('0x5d'),_0x5b382a);})['then'](function(){return respondWithRpcPromise(_0x8e44('0x5e'),'update',{'module':_0x8e44('0x5f')});})['then'](function(){return _0x473f9b;})['then'](respondWithResult(_0x2ebc6e,null))[_0x8e44('0x22')](handleError(_0x2ebc6e,null));};exports['destroy']=function(_0x685210,_0x571d78,_0x42ba46){var _0x29694f;return db[_0x8e44('0x3a')]['find']({'where':{'id':_0x685210['params']['id']}})['then'](handleEntityNotFound(_0x571d78,null))[_0x8e44('0x32')](removeEntity(_0x571d78,null))[_0x8e44('0x32')](function(){return db[_0x8e44('0x3a')]['findAll']({'raw':!![]});})['then'](function(_0x2f35aa){var _0x13d32e=fs[_0x8e44('0x56')](path[_0x8e44('0x57')](config[_0x8e44('0x58')],_0x8e44('0x59')),_0x8e44('0x5a'));var _0x351cf3=ejs[_0x8e44('0x5b')](_0x13d32e,{'contexts':_0x2f35aa});fs['writeFileSync'](_0x8e44('0x5d'),_0x351cf3);return respondWithRpcPromise('Reload',_0x8e44('0x31'),{'module':_0x8e44('0x5f')});})[_0x8e44('0x22')](handleError(_0x571d78,null));}; \ No newline at end of file +var _0x6ca2=['code','message','catch','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','destroy','get','UserProfileResource','stack','name','VoiceContext','rawAttributes','fieldName','type','key','model','map','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','where','VIRTUAL','filter','merge','includeAll','findAll','show','params','keys','include','find','create','readFileSync','root','server/files/templates/context.ejs','utf8','render','/etc/asterisk/extensions_xcally_contexts.conf','Reload','chan_sip.so','user','UserProfileSection','Contexts','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','join','writeFileSync','eml-format','zip-dir','fast-json-patch','request-promise','util','path','to-csv','ejs','fs-extra','lodash','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','client','http','request','then','info','VoiceContext,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1900bd,_0x3a5197){var _0x584215=function(_0x442f2f){while(--_0x442f2f){_0x1900bd['push'](_0x1900bd['shift']());}};_0x584215(++_0x3a5197);}(_0x6ca2,0x16a));var _0x26ca=function(_0xa464c9,_0x7c86d8){_0xa464c9=_0xa464c9-0x0;var _0x3d73c4=_0x6ca2[_0xa464c9];return _0x3d73c4;};'use strict';var emlformat=require(_0x26ca('0x0'));var rimraf=require('rimraf');var zipdir=require(_0x26ca('0x1'));var jsonpatch=require(_0x26ca('0x2'));var rp=require(_0x26ca('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0x26ca('0x4'));var path=require(_0x26ca('0x5'));var sox=require('sox');var csv=require(_0x26ca('0x6'));var ejs=require(_0x26ca('0x7'));var fs=require('fs');var fs_extra=require(_0x26ca('0x8'));var _=require(_0x26ca('0x9'));var squel=require('squel');var crypto=require(_0x26ca('0xa'));var jsforce=require(_0x26ca('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x26ca('0x6'));var querystring=require(_0x26ca('0xc'));var Papa=require(_0x26ca('0xd'));var Redis=require(_0x26ca('0xe'));var authService=require(_0x26ca('0xf'));var qs=require(_0x26ca('0x10'));var as=require(_0x26ca('0x11'));var hardwareService=require(_0x26ca('0x12'));var logger=require(_0x26ca('0x13'))(_0x26ca('0x14'));var utils=require(_0x26ca('0x15'));var config=require(_0x26ca('0x16'));var licenseUtil=require(_0x26ca('0x17'));var db=require('../../mysqldb')['db'];var jayson=require('jayson/promise');var client=jayson[_0x26ca('0x18')][_0x26ca('0x19')]({'port':0x232a});function respondWithRpcPromise(_0x46d96f,_0x41e423,_0x5b6bf9,_0x19808d){return new BPromise(function(_0x52fb56,_0x550278){var _0xe765ac=_0x19808d||client;return _0xe765ac[_0x26ca('0x1a')](_0x46d96f,_0x5b6bf9)[_0x26ca('0x1b')](function(_0x4d4923){logger[_0x26ca('0x1c')](_0x26ca('0x1d'),_0x41e423,_0x26ca('0x1e'));logger[_0x26ca('0x1f')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x41e423,_0x26ca('0x1e'),JSON[_0x26ca('0x20')](_0x4d4923));if(_0x4d4923[_0x26ca('0x21')]){if(_0x4d4923[_0x26ca('0x21')][_0x26ca('0x22')]===0x1f4){logger['error']('VoiceContext,\x20%s,\x20%s',_0x41e423,_0x4d4923[_0x26ca('0x21')][_0x26ca('0x23')]);return _0x550278(_0x4d4923[_0x26ca('0x21')][_0x26ca('0x23')]);}logger[_0x26ca('0x21')]('VoiceContext,\x20%s,\x20%s',_0x41e423,_0x4d4923['error']['message']);return _0x52fb56(_0x4d4923[_0x26ca('0x21')][_0x26ca('0x23')]);}else{logger[_0x26ca('0x1c')](_0x26ca('0x1d'),_0x41e423,'request\x20sent');_0x52fb56(_0x4d4923['result'][_0x26ca('0x23')]);}})[_0x26ca('0x24')](function(_0x5227d5){logger[_0x26ca('0x21')](_0x26ca('0x1d'),_0x41e423,_0x5227d5);_0x550278(_0x5227d5);});});}function respondWithStatusCode(_0x899814,_0x471180){_0x471180=_0x471180||0xcc;return function(_0x280fcd){if(_0x280fcd){return _0x899814[_0x26ca('0x25')](_0x471180);}return _0x899814[_0x26ca('0x26')](_0x471180)[_0x26ca('0x27')]();};}function respondWithResult(_0x41df99,_0x4dcef2){_0x4dcef2=_0x4dcef2||0xc8;return function(_0x39c296){if(_0x39c296){return _0x41df99[_0x26ca('0x26')](_0x4dcef2)[_0x26ca('0x28')](_0x39c296);}};}function respondWithFilteredResult(_0x5b4b2d,_0x53e772){return function(_0x1279ca){if(_0x1279ca){var _0x4a194e=typeof _0x53e772[_0x26ca('0x29')]===_0x26ca('0x2a')&&typeof _0x53e772[_0x26ca('0x2b')]===_0x26ca('0x2a');var _0x422613=_0x1279ca[_0x26ca('0x2c')];var _0x350aa4=_0x4a194e?0x0:_0x53e772['offset'];var _0x4c59de=_0x4a194e?_0x1279ca[_0x26ca('0x2c')]:_0x53e772[_0x26ca('0x29')]+_0x53e772[_0x26ca('0x2b')];var _0xb23750;if(_0x4c59de>=_0x422613){_0x4c59de=_0x422613;_0xb23750=0xc8;}else{_0xb23750=0xce;}_0x5b4b2d['status'](_0xb23750);return _0x5b4b2d[_0x26ca('0x2d')]('Content-Range',_0x350aa4+'-'+_0x4c59de+'/'+_0x422613)['json'](_0x1279ca);}return null;};}function patchUpdates(_0x471b0c){return function(_0x381bf9){try{jsonpatch[_0x26ca('0x2e')](_0x381bf9,_0x471b0c,!![]);}catch(_0x5c7905){return BPromise[_0x26ca('0x2f')](_0x5c7905);}return _0x381bf9[_0x26ca('0x30')]();};}function saveUpdates(_0x114a0a,_0x1a8af8){return function(_0xc27ea9){if(_0xc27ea9){return _0xc27ea9[_0x26ca('0x31')](_0x114a0a)[_0x26ca('0x1b')](function(_0x58bcdc){return _0x58bcdc;});}return null;};}function removeEntity(_0xe99681,_0xa1f347){return function(_0x384cb4){if(_0x384cb4){return _0x384cb4[_0x26ca('0x32')]()['then'](function(){var _0x4b0087=_0x384cb4[_0x26ca('0x33')]({'plain':!![]});var _0x233901='Contexts';return db[_0x26ca('0x34')]['destroy']({'where':{'type':_0x233901,'resourceId':_0x4b0087['id']}})['then'](function(){return _0x384cb4;});})[_0x26ca('0x1b')](function(){_0xe99681[_0x26ca('0x26')](0xcc)[_0x26ca('0x27')]();});}};}function handleEntityNotFound(_0x51b65c,_0x34cbaa){return function(_0x5f1506){if(!_0x5f1506){_0x51b65c[_0x26ca('0x25')](0x194);}return _0x5f1506;};}function handleError(_0xc4c622,_0x1113a5){_0x1113a5=_0x1113a5||0x1f4;return function(_0x231233){logger[_0x26ca('0x21')](_0x231233[_0x26ca('0x35')]);if(_0x231233[_0x26ca('0x36')]){delete _0x231233[_0x26ca('0x36')];}_0xc4c622['status'](_0x1113a5)['send'](_0x231233);};}exports['index']=function(_0x24f164,_0x506159){var _0x167722={},_0x12cab9={},_0x11a23e={'count':0x0,'rows':[]};var _0xe9f913=_['map'](db[_0x26ca('0x37')][_0x26ca('0x38')],function(_0x33ddc5){return{'name':_0x33ddc5[_0x26ca('0x39')],'type':_0x33ddc5[_0x26ca('0x3a')][_0x26ca('0x3b')]};});_0x12cab9[_0x26ca('0x3c')]=_[_0x26ca('0x3d')](_0xe9f913,'name');_0x12cab9[_0x26ca('0x3e')]=_['keys'](_0x24f164[_0x26ca('0x3e')]);_0x12cab9[_0x26ca('0x3f')]=_[_0x26ca('0x40')](_0x12cab9['model'],_0x12cab9['query']);_0x167722[_0x26ca('0x41')]=_[_0x26ca('0x40')](_0x12cab9[_0x26ca('0x3c')],qs[_0x26ca('0x42')](_0x24f164[_0x26ca('0x3e')]['fields']));_0x167722['attributes']=_0x167722[_0x26ca('0x41')][_0x26ca('0x43')]?_0x167722['attributes']:_0x12cab9[_0x26ca('0x3c')];if(!_0x24f164['query'][_0x26ca('0x44')](_0x26ca('0x45'))){_0x167722[_0x26ca('0x2b')]=qs[_0x26ca('0x2b')](_0x24f164['query'][_0x26ca('0x2b')]);_0x167722[_0x26ca('0x29')]=qs[_0x26ca('0x29')](_0x24f164['query'][_0x26ca('0x29')]);}_0x167722['order']=qs['sort'](_0x24f164[_0x26ca('0x3e')]['sort']);_0x167722[_0x26ca('0x46')]=qs[_0x26ca('0x3f')](_['pick'](_0x24f164['query'],_0x12cab9[_0x26ca('0x3f')]),_0xe9f913);if(_0x24f164[_0x26ca('0x3e')]['filter']){_0x167722['where']=_['merge'](_0x167722['where'],{'$or':_[_0x26ca('0x3d')](_0xe9f913,function(_0x4030e4){if(_0x4030e4[_0x26ca('0x3a')]!==_0x26ca('0x47')){var _0x59d809={};_0x59d809[_0x4030e4[_0x26ca('0x36')]]={'$like':'%'+_0x24f164['query'][_0x26ca('0x48')]+'%'};return _0x59d809;}})});}_0x167722=_[_0x26ca('0x49')]({},_0x167722,_0x24f164['options']);var _0x2f670a={'where':_0x167722[_0x26ca('0x46')]};return db['VoiceContext'][_0x26ca('0x2c')](_0x2f670a)['then'](function(_0x2d162c){_0x11a23e[_0x26ca('0x2c')]=_0x2d162c;if(_0x24f164[_0x26ca('0x3e')][_0x26ca('0x4a')]){_0x167722['include']=[{'all':!![]}];}return db[_0x26ca('0x37')][_0x26ca('0x4b')](_0x167722);})[_0x26ca('0x1b')](function(_0x3f1018){_0x11a23e['rows']=_0x3f1018;return _0x11a23e;})[_0x26ca('0x1b')](respondWithFilteredResult(_0x506159,_0x167722))[_0x26ca('0x24')](handleError(_0x506159,null));};exports[_0x26ca('0x4c')]=function(_0x47cbf6,_0x31f234){var _0x31ea69={'raw':![],'where':{'id':_0x47cbf6[_0x26ca('0x4d')]['id']}},_0x1b8d0f={};_0x1b8d0f[_0x26ca('0x3c')]=_[_0x26ca('0x4e')](db[_0x26ca('0x37')]['rawAttributes']);_0x1b8d0f[_0x26ca('0x3e')]=_['keys'](_0x47cbf6['query']);_0x1b8d0f[_0x26ca('0x3f')]=_[_0x26ca('0x40')](_0x1b8d0f[_0x26ca('0x3c')],_0x1b8d0f[_0x26ca('0x3e')]);_0x31ea69[_0x26ca('0x41')]=_['intersection'](_0x1b8d0f[_0x26ca('0x3c')],qs[_0x26ca('0x42')](_0x47cbf6['query']['fields']));_0x31ea69[_0x26ca('0x41')]=_0x31ea69[_0x26ca('0x41')][_0x26ca('0x43')]?_0x31ea69[_0x26ca('0x41')]:_0x1b8d0f[_0x26ca('0x3c')];if(_0x47cbf6[_0x26ca('0x3e')]['includeAll']){_0x31ea69[_0x26ca('0x4f')]=[{'all':!![]}];}_0x31ea69=_[_0x26ca('0x49')]({},_0x31ea69,_0x47cbf6['options']);return db[_0x26ca('0x37')][_0x26ca('0x50')](_0x31ea69)[_0x26ca('0x1b')](handleEntityNotFound(_0x31f234,null))[_0x26ca('0x1b')](respondWithResult(_0x31f234,null))[_0x26ca('0x24')](handleError(_0x31f234,null));};exports[_0x26ca('0x51')]=function(_0x37ce93,_0x487bf4,_0xd3e9db){var _0x41ad38;return db[_0x26ca('0x37')][_0x26ca('0x51')](_0x37ce93['body'],{'raw':!![]})[_0x26ca('0x1b')](function(_0x2d468c){_0x41ad38=_0x2d468c;return db[_0x26ca('0x37')]['findAll']({'raw':!![]});})[_0x26ca('0x1b')](function(_0x36edae){var _0x17610d=fs[_0x26ca('0x52')](path['join'](config[_0x26ca('0x53')],_0x26ca('0x54')),_0x26ca('0x55'));var _0x45fb61=ejs[_0x26ca('0x56')](_0x17610d,{'contexts':_0x36edae||[]});fs['writeFileSync'](_0x26ca('0x57'),_0x45fb61);})[_0x26ca('0x1b')](function(){return respondWithRpcPromise(_0x26ca('0x58'),_0x26ca('0x51'),{'module':_0x26ca('0x59')});})[_0x26ca('0x1b')](function(){var _0x17b54f=_0x37ce93[_0x26ca('0x5a')][_0x26ca('0x33')]({'plain':!![]});if(!_0x17b54f)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x17b54f['role']===_0x26ca('0x5a')){var _0x518280=_0x41ad38[_0x26ca('0x33')]({'plain':!![]});return db[_0x26ca('0x5b')]['find']({'where':{'name':_0x26ca('0x5c'),'userProfileId':_0x17b54f[_0x26ca('0x5d')]},'raw':!![]})['then'](function(_0x20ff03){if(_0x20ff03&&_0x20ff03[_0x26ca('0x5e')]===0x0){return db['UserProfileResource']['create']({'name':_0x518280[_0x26ca('0x36')],'resourceId':_0x518280['id'],'type':_0x20ff03[_0x26ca('0x36')],'sectionId':_0x20ff03['id']},{})['then'](function(){return _0x41ad38;});}else{return _0x41ad38;}})['catch'](function(_0x386eec){logger[_0x26ca('0x21')](_0x26ca('0x5f'),_0x386eec);throw _0x386eec;});}return _0x41ad38;})[_0x26ca('0x1b')](respondWithResult(_0x487bf4,0xc9))[_0x26ca('0x24')](handleError(_0x487bf4,null));};exports[_0x26ca('0x31')]=function(_0x1507a3,_0x466ef9,_0x4bd6d7){var _0x8e5302;return db[_0x26ca('0x37')][_0x26ca('0x50')]({'where':{'id':_0x1507a3[_0x26ca('0x4d')]['id']}})['then'](handleEntityNotFound(_0x466ef9,null))['then'](saveUpdates(_0x1507a3[_0x26ca('0x60')],null))[_0x26ca('0x1b')](function(_0x1489c6){if(_0x1489c6){_0x8e5302=_0x1489c6;return db[_0x26ca('0x37')][_0x26ca('0x4b')]({'raw':!![]});}})[_0x26ca('0x1b')](function(_0xb921c4){var _0x3be44b=fs[_0x26ca('0x52')](path[_0x26ca('0x61')](config[_0x26ca('0x53')],_0x26ca('0x54')),_0x26ca('0x55'));var _0x2877d4=ejs['render'](_0x3be44b,{'contexts':_0xb921c4||[]});fs['writeFileSync'](_0x26ca('0x57'),_0x2877d4);})['then'](function(){return respondWithRpcPromise(_0x26ca('0x58'),_0x26ca('0x31'),{'module':'chan_sip.so'});})[_0x26ca('0x1b')](function(){return _0x8e5302;})[_0x26ca('0x1b')](respondWithResult(_0x466ef9,null))[_0x26ca('0x24')](handleError(_0x466ef9,null));};exports['destroy']=function(_0x447fe4,_0x262759,_0x51cb8b){var _0x585207;return db[_0x26ca('0x37')][_0x26ca('0x50')]({'where':{'id':_0x447fe4[_0x26ca('0x4d')]['id']}})[_0x26ca('0x1b')](handleEntityNotFound(_0x262759,null))['then'](removeEntity(_0x262759,null))[_0x26ca('0x1b')](function(){return db[_0x26ca('0x37')]['findAll']({'raw':!![]});})[_0x26ca('0x1b')](function(_0x2ac552){var _0x2250dc=fs[_0x26ca('0x52')](path[_0x26ca('0x61')](config[_0x26ca('0x53')],_0x26ca('0x54')),_0x26ca('0x55'));var _0x102fa0=ejs[_0x26ca('0x56')](_0x2250dc,{'contexts':_0x2ac552});fs[_0x26ca('0x62')](_0x26ca('0x57'),_0x102fa0);return respondWithRpcPromise(_0x26ca('0x58'),_0x26ca('0x32'),{'module':'chan_sip.so'});})[_0x26ca('0x24')](handleError(_0x262759,null));}; \ No newline at end of file diff --git a/server/api/voiceContext/voiceContext.model.js b/server/api/voiceContext/voiceContext.model.js index ab6f818..3a9a984 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 _0x664d=['path','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts','lodash','../../config/logger','api','bluebird'];(function(_0x2b9078,_0x4aba49){var _0x4b5ec9=function(_0xb31b20){while(--_0xb31b20){_0x2b9078['push'](_0x2b9078['shift']());}};_0x4b5ec9(++_0x4aba49);}(_0x664d,0x8b));var _0xd664=function(_0x2b85d5,_0x3115b7){_0x2b85d5=_0x2b85d5-0x0;var _0xe8c96f=_0x664d[_0x2b85d5];return _0xe8c96f;};'use strict';var _=require(_0xd664('0x0'));var util=require('util');var logger=require(_0xd664('0x1'))(_0xd664('0x2'));var moment=require('moment');var BPromise=require(_0xd664('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd664('0x4'));var rimraf=require('rimraf');var config=require(_0xd664('0x5'));var attributes=require(_0xd664('0x6'));module[_0xd664('0x7')]=function(_0xdd214f,_0x286088){return _0xdd214f[_0xd664('0x8')](_0xd664('0x9'),attributes,{'tableName':_0xd664('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xde6f=['../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./voiceContext.attributes','exports','define','VoiceContext','voice_contexts'];(function(_0x58b1fe,_0x14831e){var _0x552550=function(_0x491ad6){while(--_0x491ad6){_0x58b1fe['push'](_0x58b1fe['shift']());}};_0x552550(++_0x14831e);}(_0xde6f,0x84));var _0xfde6=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xde6f[_0x20a584];return _0x4b41a8;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0xfde6('0x0'))(_0xfde6('0x1'));var moment=require(_0xfde6('0x2'));var BPromise=require('bluebird');var rp=require(_0xfde6('0x3'));var fs=require('fs');var path=require(_0xfde6('0x4'));var rimraf=require(_0xfde6('0x5'));var config=require(_0xfde6('0x6'));var attributes=require(_0xfde6('0x7'));module[_0xfde6('0x8')]=function(_0x50d21a,_0x5628ea){return _0x50d21a[_0xfde6('0x9')](_0xfde6('0xa'),attributes,{'tableName':_0xfde6('0xb'),'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 1082d42..1457f1e 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 _0x8383=['stringify','error','message','info','result','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceContext,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x6b2c5c,_0x3f6949){var _0x18e3ce=function(_0x1a143f){while(--_0x1a143f){_0x6b2c5c['push'](_0x6b2c5c['shift']());}};_0x18e3ce(++_0x3f6949);}(_0x8383,0x98));var _0x3838=function(_0x2373de,_0x57200f){_0x2373de=_0x2373de-0x0;var _0x435e4f=_0x8383[_0x2373de];return _0x435e4f;};'use strict';var _=require(_0x3838('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x3838('0x1'));var rs=require(_0x3838('0x2'));var fs=require('fs');var Redis=require(_0x3838('0x3'));var db=require(_0x3838('0x4'))['db'];var utils=require(_0x3838('0x5'));var logger=require(_0x3838('0x6'))(_0x3838('0x7'));var config=require(_0x3838('0x8'));var jayson=require(_0x3838('0x9'));var client=jayson[_0x3838('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x239750,_0x235001,_0x4cf52b){return new BPromise(function(_0x2abbda,_0x5e2e42){return client[_0x3838('0xb')](_0x239750,_0x4cf52b)[_0x3838('0xc')](function(_0x340c39){logger['info'](_0x3838('0xd'),_0x235001,_0x3838('0xe'));logger[_0x3838('0xf')]('VoiceContext,\x20%s,\x20%s,\x20%s',_0x235001,_0x3838('0xe'),JSON[_0x3838('0x10')](_0x340c39));if(_0x340c39[_0x3838('0x11')]){if(_0x340c39[_0x3838('0x11')]['code']===0x1f4){logger[_0x3838('0x11')](_0x3838('0xd'),_0x235001,_0x340c39[_0x3838('0x11')]['message']);return _0x5e2e42(_0x340c39[_0x3838('0x11')]['message']);}logger[_0x3838('0x11')](_0x3838('0xd'),_0x235001,_0x340c39[_0x3838('0x11')][_0x3838('0x12')]);return _0x2abbda(_0x340c39[_0x3838('0x11')]['message']);}else{logger[_0x3838('0x13')](_0x3838('0xd'),_0x235001,_0x3838('0xe'));_0x2abbda(_0x340c39[_0x3838('0x14')][_0x3838('0x12')]);}})['catch'](function(_0x464fd9){logger[_0x3838('0x11')](_0x3838('0xd'),_0x235001,_0x464fd9);_0x5e2e42(_0x464fd9);});});} \ No newline at end of file +var _0xefe2=['then','request\x20sent','stringify','error','code','VoiceContext,\x20%s,\x20%s','message','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xefe2,0xd9));var _0x2efe=function(_0x18146e,_0x48ab59){_0x18146e=_0x18146e-0x0;var _0x46919a=_0xefe2[_0x18146e];return _0x46919a;};'use strict';var _=require(_0x2efe('0x0'));var util=require(_0x2efe('0x1'));var moment=require('moment');var BPromise=require(_0x2efe('0x2'));var rs=require(_0x2efe('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2efe('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x2efe('0x5'))(_0x2efe('0x6'));var config=require(_0x2efe('0x7'));var jayson=require(_0x2efe('0x8'));var client=jayson[_0x2efe('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0xabb4e3,_0x4476cc,_0x2a2d22){return new BPromise(function(_0x14cd14,_0x5f0008){return client[_0x2efe('0xa')](_0xabb4e3,_0x2a2d22)[_0x2efe('0xb')](function(_0x3a8f02){logger['info']('VoiceContext,\x20%s,\x20%s',_0x4476cc,_0x2efe('0xc'));logger['debug']('VoiceContext,\x20%s,\x20%s,\x20%s',_0x4476cc,_0x2efe('0xc'),JSON[_0x2efe('0xd')](_0x3a8f02));if(_0x3a8f02[_0x2efe('0xe')]){if(_0x3a8f02[_0x2efe('0xe')][_0x2efe('0xf')]===0x1f4){logger[_0x2efe('0xe')](_0x2efe('0x10'),_0x4476cc,_0x3a8f02[_0x2efe('0xe')][_0x2efe('0x11')]);return _0x5f0008(_0x3a8f02[_0x2efe('0xe')]['message']);}logger['error'](_0x2efe('0x10'),_0x4476cc,_0x3a8f02[_0x2efe('0xe')]['message']);return _0x14cd14(_0x3a8f02['error'][_0x2efe('0x11')]);}else{logger['info'](_0x2efe('0x10'),_0x4476cc,_0x2efe('0xc'));_0x14cd14(_0x3a8f02['result'][_0x2efe('0x11')]);}})[_0x2efe('0x12')](function(_0x5e5a2c){logger[_0x2efe('0xe')]('VoiceContext,\x20%s,\x20%s',_0x4476cc,_0x5e5a2c);_0x5f0008(_0x5e5a2c);});});} \ No newline at end of file diff --git a/server/api/voiceDialReport/index.js b/server/api/voiceDialReport/index.js index a284f01..6d0fe60 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 _0x6e65=['../../config/environment','./voiceDialReport.controller','get','index','isAuthenticated','describe','post','create','put','update','delete','multer','path','connect-timeout','express','Router','../../components/interaction/service'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6e65,0x1c5));var _0x56e6=function(_0x28c4db,_0x2ccd05){_0x28c4db=_0x28c4db-0x0;var _0x5907ed=_0x6e65[_0x28c4db];return _0x5907ed;};'use strict';var multer=require(_0x56e6('0x0'));var util=require('util');var path=require(_0x56e6('0x1'));var timeout=require(_0x56e6('0x2'));var express=require(_0x56e6('0x3'));var router=express[_0x56e6('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0x56e6('0x5'));var config=require(_0x56e6('0x6'));var controller=require(_0x56e6('0x7'));router[_0x56e6('0x8')]('/',auth['isAuthenticated'](),controller[_0x56e6('0x9')]);router[_0x56e6('0x8')]('/describe',auth[_0x56e6('0xa')](),controller[_0x56e6('0xb')]);router['get']('/:id',auth[_0x56e6('0xa')](),controller['show']);router[_0x56e6('0xc')]('/',auth[_0x56e6('0xa')](),controller[_0x56e6('0xd')]);router[_0x56e6('0xe')]('/:id',auth['isAuthenticated'](),controller[_0x56e6('0xf')]);router[_0x56e6('0x10')]('/:id',auth[_0x56e6('0xa')](),controller['destroy']);module['exports']=router; \ No newline at end of file +var _0x124a=['destroy','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceDialReport.controller','get','isAuthenticated','/describe','describe','/:id','show','post','create','update','delete'];(function(_0x4ed1d4,_0x512d9a){var _0x28e363=function(_0x2bdfb7){while(--_0x2bdfb7){_0x4ed1d4['push'](_0x4ed1d4['shift']());}};_0x28e363(++_0x512d9a);}(_0x124a,0x1a6));var _0xa124=function(_0x4ffd20,_0x1e83b6){_0x4ffd20=_0x4ffd20-0x0;var _0x49b5e2=_0x124a[_0x4ffd20];return _0x49b5e2;};'use strict';var multer=require(_0xa124('0x0'));var util=require(_0xa124('0x1'));var path=require(_0xa124('0x2'));var timeout=require(_0xa124('0x3'));var express=require('express');var router=express[_0xa124('0x4')]();var fs_extra=require(_0xa124('0x5'));var auth=require(_0xa124('0x6'));var interaction=require(_0xa124('0x7'));var config=require('../../config/environment');var controller=require(_0xa124('0x8'));router[_0xa124('0x9')]('/',auth[_0xa124('0xa')](),controller['index']);router[_0xa124('0x9')](_0xa124('0xb'),auth[_0xa124('0xa')](),controller[_0xa124('0xc')]);router[_0xa124('0x9')](_0xa124('0xd'),auth[_0xa124('0xa')](),controller[_0xa124('0xe')]);router[_0xa124('0xf')]('/',auth['isAuthenticated'](),controller[_0xa124('0x10')]);router['put'](_0xa124('0xd'),auth[_0xa124('0xa')](),controller[_0xa124('0x11')]);router[_0xa124('0x12')](_0xa124('0xd'),auth[_0xa124('0xa')](),controller[_0xa124('0x13')]);module[_0xa124('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.attributes.js b/server/api/voiceDialReport/voiceDialReport.attributes.js index e6c5af8..faf358f 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 _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0x5a5936,_0x1fef78){var _0x2d9112=function(_0x479e74){while(--_0x479e74){_0x5a5936['push'](_0x5a5936['shift']());}};_0x2d9112(++_0x1fef78);}(_0xe5b3,0x133));var _0x3e5b=function(_0x2348b5,_0x454465){_0x2348b5=_0x2348b5-0x0;var _0x13dad3=_0xe5b3[_0x2348b5];return _0x13dad3;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'privilege':{'type':Sequelize[_0x3e5b('0x1')]},'channel':{'type':Sequelize[_0x3e5b('0x1')]},'channelstate':{'type':Sequelize[_0x3e5b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'calleridnum':{'type':Sequelize[_0x3e5b('0x1')]},'calleridname':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'language':{'type':Sequelize[_0x3e5b('0x1')]},'accountcode':{'type':Sequelize[_0x3e5b('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3e5b('0x1')]},'priority':{'type':Sequelize[_0x3e5b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3e5b('0x1')]},'destchannel':{'type':Sequelize[_0x3e5b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e5b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'destlanguage':{'type':Sequelize[_0x3e5b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e5b('0x1')]},'destcontext':{'type':Sequelize[_0x3e5b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3e5b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x3e5b('0x1')]},'dialstring':{'type':Sequelize[_0x3e5b('0x1')]},'dialstatus':{'type':Sequelize[_0x3e5b('0x1')]},'starttime':{'type':Sequelize[_0x3e5b('0x3')]},'answertime':{'type':Sequelize[_0x3e5b('0x3')]},'endtime':{'type':Sequelize[_0x3e5b('0x3')]},'lastevent':{'type':Sequelize[_0x3e5b('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x3e5b('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0xe5b3=['STRING','INTEGER','DATE','exports'];(function(_0xcb7bc6,_0x2bed38){var _0x1c678e=function(_0x65e4a0){while(--_0x65e4a0){_0xcb7bc6['push'](_0xcb7bc6['shift']());}};_0x1c678e(++_0x2bed38);}(_0xe5b3,0x133));var _0x3e5b=function(_0x327776,_0x409119){_0x327776=_0x327776-0x0;var _0x5a9cd7=_0xe5b3[_0x327776];return _0x5a9cd7;};'use strict';var Sequelize=require('sequelize');module[_0x3e5b('0x0')]={'privilege':{'type':Sequelize[_0x3e5b('0x1')]},'channel':{'type':Sequelize[_0x3e5b('0x1')]},'channelstate':{'type':Sequelize[_0x3e5b('0x2')]},'channelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'calleridnum':{'type':Sequelize[_0x3e5b('0x1')]},'calleridname':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'connectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'language':{'type':Sequelize[_0x3e5b('0x1')]},'accountcode':{'type':Sequelize[_0x3e5b('0x1')]},'context':{'type':Sequelize['STRING']},'exten':{'type':Sequelize[_0x3e5b('0x1')]},'priority':{'type':Sequelize[_0x3e5b('0x2')]},'uniqueid':{'type':Sequelize['STRING']},'linkedid':{'type':Sequelize[_0x3e5b('0x1')]},'destchannel':{'type':Sequelize[_0x3e5b('0x1')]},'destchannelstate':{'type':Sequelize[_0x3e5b('0x2')]},'destchannelstatedesc':{'type':Sequelize[_0x3e5b('0x1')]},'destcalleridnum':{'type':Sequelize['STRING']},'destcalleridname':{'type':Sequelize['STRING']},'destconnectedlinenum':{'type':Sequelize[_0x3e5b('0x1')]},'destconnectedlinename':{'type':Sequelize[_0x3e5b('0x1')]},'destlanguage':{'type':Sequelize[_0x3e5b('0x1')]},'destaccountcode':{'type':Sequelize[_0x3e5b('0x1')]},'destcontext':{'type':Sequelize[_0x3e5b('0x1')]},'destexten':{'type':Sequelize['STRING']},'destpriority':{'type':Sequelize[_0x3e5b('0x2')]},'destuniqueid':{'type':Sequelize['STRING']},'destlinkedid':{'type':Sequelize[_0x3e5b('0x1')]},'dialstring':{'type':Sequelize[_0x3e5b('0x1')]},'dialstatus':{'type':Sequelize[_0x3e5b('0x1')]},'starttime':{'type':Sequelize[_0x3e5b('0x3')]},'answertime':{'type':Sequelize[_0x3e5b('0x3')]},'endtime':{'type':Sequelize[_0x3e5b('0x3')]},'lastevent':{'type':Sequelize[_0x3e5b('0x1')],'comment':'called,connect,complete'},'routeId':{'type':Sequelize[_0x3e5b('0x2')]},'duration':{'type':Sequelize['INTEGER']},'holdtime':{'type':Sequelize['INTEGER']},'billableseconds':{'type':Sequelize['INTEGER']}}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.controller.js b/server/api/voiceDialReport/voiceDialReport.controller.js index 61c0216..99591d0 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 _0x075d=['../../mysqldb','status','end','json','undefined','count','offset','limit','set','apply','reject','save','then','error','name','index','map','VoiceDialReport','fieldName','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','pick','filter','merge','type','VIRTUAL','options','includeAll','rows','params','rawAttributes','filters','include','find','catch','create','body','destroy','describe','eml-format','rimraf','fast-json-patch','request-promise','bluebird','path','to-csv','ejs','fs-extra','lodash','squel','desk.js','querystring','papaparse','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/license/util'];(function(_0x205bea,_0x4695f2){var _0x59e5a3=function(_0x5d80f5){while(--_0x5d80f5){_0x205bea['push'](_0x205bea['shift']());}};_0x59e5a3(++_0x4695f2);}(_0x075d,0xfa));var _0xd075=function(_0x58273d,_0x2fefaf){_0x58273d=_0x58273d-0x0;var _0x8708b=_0x075d[_0x58273d];return _0x8708b;};'use strict';var emlformat=require(_0xd075('0x0'));var rimraf=require(_0xd075('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0xd075('0x2'));var rp=require(_0xd075('0x3'));var moment=require('moment');var BPromise=require(_0xd075('0x4'));var Mustache=require('mustache');var util=require('util');var path=require(_0xd075('0x5'));var sox=require('sox');var csv=require(_0xd075('0x6'));var ejs=require(_0xd075('0x7'));var fs=require('fs');var fs_extra=require(_0xd075('0x8'));var _=require(_0xd075('0x9'));var squel=require(_0xd075('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xd075('0xb'));var toCsv=require('to-csv');var querystring=require(_0xd075('0xc'));var Papa=require(_0xd075('0xd'));var Redis=require('ioredis');var authService=require(_0xd075('0xe'));var qs=require(_0xd075('0xf'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xd075('0x10'));var logger=require('../../config/logger')('api');var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0xd075('0x11'));var db=require(_0xd075('0x12'))['db'];function respondWithStatusCode(_0x1bdb1d,_0x3971da){_0x3971da=_0x3971da||0xcc;return function(_0x41178a){if(_0x41178a){return _0x1bdb1d['sendStatus'](_0x3971da);}return _0x1bdb1d[_0xd075('0x13')](_0x3971da)[_0xd075('0x14')]();};}function respondWithResult(_0x2a2f18,_0x353ad9){_0x353ad9=_0x353ad9||0xc8;return function(_0xa97668){if(_0xa97668){return _0x2a2f18[_0xd075('0x13')](_0x353ad9)[_0xd075('0x15')](_0xa97668);}};}function respondWithFilteredResult(_0x2a10a1,_0x5c1b39){return function(_0x2ade63){if(_0x2ade63){var _0x3a9fdf=typeof _0x5c1b39['offset']===_0xd075('0x16')&&typeof _0x5c1b39['limit']===_0xd075('0x16');var _0x11fae6=_0x2ade63[_0xd075('0x17')];var _0x163d74=_0x3a9fdf?0x0:_0x5c1b39[_0xd075('0x18')];var _0x446d8f=_0x3a9fdf?_0x2ade63[_0xd075('0x17')]:_0x5c1b39[_0xd075('0x18')]+_0x5c1b39[_0xd075('0x19')];var _0x49a12b;if(_0x446d8f>=_0x11fae6){_0x446d8f=_0x11fae6;_0x49a12b=0xc8;}else{_0x49a12b=0xce;}_0x2a10a1[_0xd075('0x13')](_0x49a12b);return _0x2a10a1[_0xd075('0x1a')]('Content-Range',_0x163d74+'-'+_0x446d8f+'/'+_0x11fae6)[_0xd075('0x15')](_0x2ade63);}return null;};}function patchUpdates(_0x2cf5f9){return function(_0xe1927b){try{jsonpatch[_0xd075('0x1b')](_0xe1927b,_0x2cf5f9,!![]);}catch(_0x2a363d){return BPromise[_0xd075('0x1c')](_0x2a363d);}return _0xe1927b[_0xd075('0x1d')]();};}function saveUpdates(_0x302ca3,_0x35c12d){return function(_0x34913b){if(_0x34913b){return _0x34913b['update'](_0x302ca3)[_0xd075('0x1e')](function(_0x2101e6){return _0x2101e6;});}return null;};}function removeEntity(_0x133f06,_0x31a2f6){return function(_0x35d600){if(_0x35d600){return _0x35d600['destroy']()[_0xd075('0x1e')](function(){_0x133f06[_0xd075('0x13')](0xcc)[_0xd075('0x14')]();});}};}function handleEntityNotFound(_0x436d8f,_0xeb23cb){return function(_0x55e4c2){if(!_0x55e4c2){_0x436d8f['sendStatus'](0x194);}return _0x55e4c2;};}function handleError(_0x3d77f3,_0x354b0b){_0x354b0b=_0x354b0b||0x1f4;return function(_0x156a7d){logger[_0xd075('0x1f')](_0x156a7d['stack']);if(_0x156a7d['name']){delete _0x156a7d[_0xd075('0x20')];}_0x3d77f3['status'](_0x354b0b)['send'](_0x156a7d);};}exports[_0xd075('0x21')]=function(_0x3241df,_0x23f0a5){var _0xb15711={},_0x32c527={},_0x5544d1={'count':0x0,'rows':[]};var _0x25a5eb=_[_0xd075('0x22')](db[_0xd075('0x23')]['rawAttributes'],function(_0x52d70a){return{'name':_0x52d70a[_0xd075('0x24')],'type':_0x52d70a['type'][_0xd075('0x25')]};});_0x32c527[_0xd075('0x26')]=_[_0xd075('0x22')](_0x25a5eb,_0xd075('0x20'));_0x32c527[_0xd075('0x27')]=_[_0xd075('0x28')](_0x3241df[_0xd075('0x27')]);_0x32c527['filters']=_[_0xd075('0x29')](_0x32c527[_0xd075('0x26')],_0x32c527[_0xd075('0x27')]);_0xb15711[_0xd075('0x2a')]=_[_0xd075('0x29')](_0x32c527[_0xd075('0x26')],qs[_0xd075('0x2b')](_0x3241df[_0xd075('0x27')]['fields']));_0xb15711[_0xd075('0x2a')]=_0xb15711[_0xd075('0x2a')][_0xd075('0x2c')]?_0xb15711[_0xd075('0x2a')]:_0x32c527['model'];if(!_0x3241df['query'][_0xd075('0x2d')](_0xd075('0x2e'))){_0xb15711[_0xd075('0x19')]=qs[_0xd075('0x19')](_0x3241df[_0xd075('0x27')][_0xd075('0x19')]);_0xb15711[_0xd075('0x18')]=qs['offset'](_0x3241df[_0xd075('0x27')][_0xd075('0x18')]);}_0xb15711['order']=qs[_0xd075('0x2f')](_0x3241df[_0xd075('0x27')][_0xd075('0x2f')]);_0xb15711[_0xd075('0x30')]=qs['filters'](_[_0xd075('0x31')](_0x3241df['query'],_0x32c527['filters']),_0x25a5eb);if(_0x3241df[_0xd075('0x27')][_0xd075('0x32')]){_0xb15711['where']=_[_0xd075('0x33')](_0xb15711[_0xd075('0x30')],{'$or':_['map'](_0x25a5eb,function(_0x130ebd){if(_0x130ebd[_0xd075('0x34')]!==_0xd075('0x35')){var _0x19743d={};_0x19743d[_0x130ebd['name']]={'$like':'%'+_0x3241df[_0xd075('0x27')][_0xd075('0x32')]+'%'};return _0x19743d;}})});}_0xb15711=_[_0xd075('0x33')]({},_0xb15711,_0x3241df[_0xd075('0x36')]);var _0x208190={'where':_0xb15711[_0xd075('0x30')]};return db[_0xd075('0x23')]['count'](_0x208190)['then'](function(_0x2b86d3){_0x5544d1[_0xd075('0x17')]=_0x2b86d3;if(_0x3241df['query'][_0xd075('0x37')]){_0xb15711['include']=[{'all':!![]}];}return db[_0xd075('0x23')]['findAll'](_0xb15711);})[_0xd075('0x1e')](function(_0x2233c8){_0x5544d1[_0xd075('0x38')]=_0x2233c8;return _0x5544d1;})[_0xd075('0x1e')](respondWithFilteredResult(_0x23f0a5,_0xb15711))['catch'](handleError(_0x23f0a5,null));};exports['show']=function(_0x3c693b,_0x30dc2f){var _0x256bd3={'raw':!![],'where':{'id':_0x3c693b[_0xd075('0x39')]['id']}},_0x4cbdeb={};_0x4cbdeb[_0xd075('0x26')]=_[_0xd075('0x28')](db[_0xd075('0x23')][_0xd075('0x3a')]);_0x4cbdeb[_0xd075('0x27')]=_[_0xd075('0x28')](_0x3c693b[_0xd075('0x27')]);_0x4cbdeb[_0xd075('0x3b')]=_[_0xd075('0x29')](_0x4cbdeb[_0xd075('0x26')],_0x4cbdeb[_0xd075('0x27')]);_0x256bd3[_0xd075('0x2a')]=_[_0xd075('0x29')](_0x4cbdeb['model'],qs[_0xd075('0x2b')](_0x3c693b[_0xd075('0x27')]['fields']));_0x256bd3[_0xd075('0x2a')]=_0x256bd3[_0xd075('0x2a')]['length']?_0x256bd3[_0xd075('0x2a')]:_0x4cbdeb[_0xd075('0x26')];if(_0x3c693b[_0xd075('0x27')][_0xd075('0x37')]){_0x256bd3[_0xd075('0x3c')]=[{'all':!![]}];}_0x256bd3=_[_0xd075('0x33')]({},_0x256bd3,_0x3c693b[_0xd075('0x36')]);return db['VoiceDialReport'][_0xd075('0x3d')](_0x256bd3)[_0xd075('0x1e')](handleEntityNotFound(_0x30dc2f,null))[_0xd075('0x1e')](respondWithResult(_0x30dc2f,null))[_0xd075('0x3e')](handleError(_0x30dc2f,null));};exports[_0xd075('0x3f')]=function(_0x2bc796,_0x307ec5){return db['VoiceDialReport'][_0xd075('0x3f')](_0x2bc796[_0xd075('0x40')],{})[_0xd075('0x1e')](respondWithResult(_0x307ec5,0xc9))[_0xd075('0x3e')](handleError(_0x307ec5,null));};exports['update']=function(_0x10e603,_0xbaffac){if(_0x10e603[_0xd075('0x40')]['id']){delete _0x10e603[_0xd075('0x40')]['id'];}return db['VoiceDialReport'][_0xd075('0x3d')]({'where':{'id':_0x10e603['params']['id']}})[_0xd075('0x1e')](handleEntityNotFound(_0xbaffac,null))[_0xd075('0x1e')](saveUpdates(_0x10e603['body'],null))[_0xd075('0x1e')](respondWithResult(_0xbaffac,null))[_0xd075('0x3e')](handleError(_0xbaffac,null));};exports[_0xd075('0x41')]=function(_0x19435d,_0x51bcf2){return db['VoiceDialReport'][_0xd075('0x3d')]({'where':{'id':_0x19435d[_0xd075('0x39')]['id']}})[_0xd075('0x1e')](handleEntityNotFound(_0x51bcf2,null))[_0xd075('0x1e')](removeEntity(_0x51bcf2,null))['catch'](handleError(_0x51bcf2,null));};exports['describe']=function(_0x419750,_0x2e9f51){return db[_0xd075('0x23')][_0xd075('0x42')]()[_0xd075('0x1e')](respondWithResult(_0x2e9f51,null))[_0xd075('0x3e')](handleError(_0x2e9f51,null));}; \ No newline at end of file +var _0x6f94=['reject','save','then','destroy','error','name','index','map','VoiceDialReport','rawAttributes','fieldName','type','key','model','query','keys','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','filter','merge','includeAll','include','findAll','rows','params','options','find','create','body','update','catch','describe','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','fs-extra','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','offset','count','set','Content-Range','apply'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6f94,0x10f));var _0x46f9=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0x6f94[_0x21a9d9];return _0x46adce;};'use strict';var emlformat=require(_0x46f9('0x0'));var rimraf=require(_0x46f9('0x1'));var zipdir=require(_0x46f9('0x2'));var jsonpatch=require(_0x46f9('0x3'));var rp=require(_0x46f9('0x4'));var moment=require(_0x46f9('0x5'));var BPromise=require(_0x46f9('0x6'));var Mustache=require(_0x46f9('0x7'));var util=require(_0x46f9('0x8'));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(_0x46f9('0x9'));var _=require(_0x46f9('0xa'));var squel=require(_0x46f9('0xb'));var crypto=require('crypto');var jsforce=require(_0x46f9('0xc'));var deskjs=require(_0x46f9('0xd'));var toCsv=require(_0x46f9('0xe'));var querystring=require('querystring');var Papa=require(_0x46f9('0xf'));var Redis=require('ioredis');var authService=require(_0x46f9('0x10'));var qs=require(_0x46f9('0x11'));var as=require(_0x46f9('0x12'));var hardwareService=require(_0x46f9('0x13'));var logger=require(_0x46f9('0x14'))(_0x46f9('0x15'));var utils=require(_0x46f9('0x16'));var config=require(_0x46f9('0x17'));var licenseUtil=require(_0x46f9('0x18'));var db=require(_0x46f9('0x19'))['db'];function respondWithStatusCode(_0x12bfdd,_0x2b4106){_0x2b4106=_0x2b4106||0xcc;return function(_0xc04fdd){if(_0xc04fdd){return _0x12bfdd[_0x46f9('0x1a')](_0x2b4106);}return _0x12bfdd['status'](_0x2b4106)[_0x46f9('0x1b')]();};}function respondWithResult(_0x24b961,_0x45c0c5){_0x45c0c5=_0x45c0c5||0xc8;return function(_0x15867b){if(_0x15867b){return _0x24b961[_0x46f9('0x1c')](_0x45c0c5)[_0x46f9('0x1d')](_0x15867b);}};}function respondWithFilteredResult(_0x80946b,_0x30d919){return function(_0x55671a){if(_0x55671a){var _0x223101=typeof _0x30d919['offset']===_0x46f9('0x1e')&&typeof _0x30d919[_0x46f9('0x1f')]===_0x46f9('0x1e');var _0x8ac7bc=_0x55671a['count'];var _0x57b982=_0x223101?0x0:_0x30d919[_0x46f9('0x20')];var _0x4f44a8=_0x223101?_0x55671a[_0x46f9('0x21')]:_0x30d919[_0x46f9('0x20')]+_0x30d919[_0x46f9('0x1f')];var _0x18aac6;if(_0x4f44a8>=_0x8ac7bc){_0x4f44a8=_0x8ac7bc;_0x18aac6=0xc8;}else{_0x18aac6=0xce;}_0x80946b[_0x46f9('0x1c')](_0x18aac6);return _0x80946b[_0x46f9('0x22')](_0x46f9('0x23'),_0x57b982+'-'+_0x4f44a8+'/'+_0x8ac7bc)[_0x46f9('0x1d')](_0x55671a);}return null;};}function patchUpdates(_0x5f1940){return function(_0x4bad5b){try{jsonpatch[_0x46f9('0x24')](_0x4bad5b,_0x5f1940,!![]);}catch(_0x49c1ee){return BPromise[_0x46f9('0x25')](_0x49c1ee);}return _0x4bad5b[_0x46f9('0x26')]();};}function saveUpdates(_0x37bfc5,_0x2d892a){return function(_0x4f464c){if(_0x4f464c){return _0x4f464c['update'](_0x37bfc5)[_0x46f9('0x27')](function(_0x405487){return _0x405487;});}return null;};}function removeEntity(_0x285750,_0x5af385){return function(_0x144927){if(_0x144927){return _0x144927[_0x46f9('0x28')]()[_0x46f9('0x27')](function(){_0x285750[_0x46f9('0x1c')](0xcc)[_0x46f9('0x1b')]();});}};}function handleEntityNotFound(_0x3521f4,_0x2d1768){return function(_0x4e2715){if(!_0x4e2715){_0x3521f4[_0x46f9('0x1a')](0x194);}return _0x4e2715;};}function handleError(_0x36b7b0,_0x318e2d){_0x318e2d=_0x318e2d||0x1f4;return function(_0x19ba69){logger[_0x46f9('0x29')](_0x19ba69['stack']);if(_0x19ba69[_0x46f9('0x2a')]){delete _0x19ba69[_0x46f9('0x2a')];}_0x36b7b0[_0x46f9('0x1c')](_0x318e2d)['send'](_0x19ba69);};}exports[_0x46f9('0x2b')]=function(_0x133090,_0x102aa9){var _0x1c53a0={},_0x340465={},_0x411987={'count':0x0,'rows':[]};var _0x190fe1=_[_0x46f9('0x2c')](db[_0x46f9('0x2d')][_0x46f9('0x2e')],function(_0x1e1221){return{'name':_0x1e1221[_0x46f9('0x2f')],'type':_0x1e1221[_0x46f9('0x30')][_0x46f9('0x31')]};});_0x340465[_0x46f9('0x32')]=_[_0x46f9('0x2c')](_0x190fe1,_0x46f9('0x2a'));_0x340465[_0x46f9('0x33')]=_[_0x46f9('0x34')](_0x133090[_0x46f9('0x33')]);_0x340465[_0x46f9('0x35')]=_['intersection'](_0x340465['model'],_0x340465[_0x46f9('0x33')]);_0x1c53a0[_0x46f9('0x36')]=_[_0x46f9('0x37')](_0x340465[_0x46f9('0x32')],qs[_0x46f9('0x38')](_0x133090[_0x46f9('0x33')][_0x46f9('0x38')]));_0x1c53a0[_0x46f9('0x36')]=_0x1c53a0[_0x46f9('0x36')][_0x46f9('0x39')]?_0x1c53a0[_0x46f9('0x36')]:_0x340465[_0x46f9('0x32')];if(!_0x133090[_0x46f9('0x33')][_0x46f9('0x3a')](_0x46f9('0x3b'))){_0x1c53a0[_0x46f9('0x1f')]=qs['limit'](_0x133090['query'][_0x46f9('0x1f')]);_0x1c53a0[_0x46f9('0x20')]=qs[_0x46f9('0x20')](_0x133090[_0x46f9('0x33')][_0x46f9('0x20')]);}_0x1c53a0[_0x46f9('0x3c')]=qs['sort'](_0x133090['query'][_0x46f9('0x3d')]);_0x1c53a0[_0x46f9('0x3e')]=qs[_0x46f9('0x35')](_['pick'](_0x133090[_0x46f9('0x33')],_0x340465[_0x46f9('0x35')]),_0x190fe1);if(_0x133090[_0x46f9('0x33')][_0x46f9('0x3f')]){_0x1c53a0[_0x46f9('0x3e')]=_['merge'](_0x1c53a0[_0x46f9('0x3e')],{'$or':_['map'](_0x190fe1,function(_0x1ec394){if(_0x1ec394[_0x46f9('0x30')]!=='VIRTUAL'){var _0x5b8532={};_0x5b8532[_0x1ec394['name']]={'$like':'%'+_0x133090[_0x46f9('0x33')][_0x46f9('0x3f')]+'%'};return _0x5b8532;}})});}_0x1c53a0=_[_0x46f9('0x40')]({},_0x1c53a0,_0x133090['options']);var _0x1bb4f4={'where':_0x1c53a0['where']};return db[_0x46f9('0x2d')][_0x46f9('0x21')](_0x1bb4f4)['then'](function(_0x224d93){_0x411987['count']=_0x224d93;if(_0x133090['query'][_0x46f9('0x41')]){_0x1c53a0[_0x46f9('0x42')]=[{'all':!![]}];}return db[_0x46f9('0x2d')][_0x46f9('0x43')](_0x1c53a0);})[_0x46f9('0x27')](function(_0x2767ed){_0x411987[_0x46f9('0x44')]=_0x2767ed;return _0x411987;})[_0x46f9('0x27')](respondWithFilteredResult(_0x102aa9,_0x1c53a0))['catch'](handleError(_0x102aa9,null));};exports['show']=function(_0x32fd5a,_0x148ef0){var _0x4fc6c8={'raw':!![],'where':{'id':_0x32fd5a[_0x46f9('0x45')]['id']}},_0x51b1d9={};_0x51b1d9[_0x46f9('0x32')]=_[_0x46f9('0x34')](db[_0x46f9('0x2d')][_0x46f9('0x2e')]);_0x51b1d9['query']=_[_0x46f9('0x34')](_0x32fd5a[_0x46f9('0x33')]);_0x51b1d9['filters']=_['intersection'](_0x51b1d9[_0x46f9('0x32')],_0x51b1d9[_0x46f9('0x33')]);_0x4fc6c8[_0x46f9('0x36')]=_['intersection'](_0x51b1d9[_0x46f9('0x32')],qs['fields'](_0x32fd5a[_0x46f9('0x33')][_0x46f9('0x38')]));_0x4fc6c8[_0x46f9('0x36')]=_0x4fc6c8['attributes']['length']?_0x4fc6c8[_0x46f9('0x36')]:_0x51b1d9[_0x46f9('0x32')];if(_0x32fd5a[_0x46f9('0x33')]['includeAll']){_0x4fc6c8['include']=[{'all':!![]}];}_0x4fc6c8=_[_0x46f9('0x40')]({},_0x4fc6c8,_0x32fd5a[_0x46f9('0x46')]);return db[_0x46f9('0x2d')][_0x46f9('0x47')](_0x4fc6c8)['then'](handleEntityNotFound(_0x148ef0,null))['then'](respondWithResult(_0x148ef0,null))['catch'](handleError(_0x148ef0,null));};exports['create']=function(_0x3b1494,_0x551bc8){return db[_0x46f9('0x2d')][_0x46f9('0x48')](_0x3b1494[_0x46f9('0x49')],{})[_0x46f9('0x27')](respondWithResult(_0x551bc8,0xc9))['catch'](handleError(_0x551bc8,null));};exports[_0x46f9('0x4a')]=function(_0x3e15cc,_0x25b6d4){if(_0x3e15cc[_0x46f9('0x49')]['id']){delete _0x3e15cc[_0x46f9('0x49')]['id'];}return db[_0x46f9('0x2d')][_0x46f9('0x47')]({'where':{'id':_0x3e15cc[_0x46f9('0x45')]['id']}})[_0x46f9('0x27')](handleEntityNotFound(_0x25b6d4,null))[_0x46f9('0x27')](saveUpdates(_0x3e15cc[_0x46f9('0x49')],null))['then'](respondWithResult(_0x25b6d4,null))['catch'](handleError(_0x25b6d4,null));};exports[_0x46f9('0x28')]=function(_0x39aff1,_0x45eb0c){return db[_0x46f9('0x2d')][_0x46f9('0x47')]({'where':{'id':_0x39aff1['params']['id']}})[_0x46f9('0x27')](handleEntityNotFound(_0x45eb0c,null))[_0x46f9('0x27')](removeEntity(_0x45eb0c,null))[_0x46f9('0x4b')](handleError(_0x45eb0c,null));};exports['describe']=function(_0x657f5c,_0x457dd1){return db[_0x46f9('0x2d')][_0x46f9('0x4c')]()[_0x46f9('0x27')](respondWithResult(_0x457dd1,null))[_0x46f9('0x4b')](handleError(_0x457dd1,null));}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.model.js b/server/api/voiceDialReport/voiceDialReport.model.js index fc8f151..c04f562 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 _0x7715=['api','moment','bluebird','request-promise','path','rimraf','../../config/environment','define','VoiceDialReport','report_dial','uniqueid','lodash','util'];(function(_0x88e9e,_0x3c052f){var _0x304fb4=function(_0x3513ef){while(--_0x3513ef){_0x88e9e['push'](_0x88e9e['shift']());}};_0x304fb4(++_0x3c052f);}(_0x7715,0x19e));var _0x5771=function(_0x5d86b2,_0x1a2a00){_0x5d86b2=_0x5d86b2-0x0;var _0x15563d=_0x7715[_0x5d86b2];return _0x15563d;};'use strict';var _=require(_0x5771('0x0'));var util=require(_0x5771('0x1'));var logger=require('../../config/logger')(_0x5771('0x2'));var moment=require(_0x5771('0x3'));var BPromise=require(_0x5771('0x4'));var rp=require(_0x5771('0x5'));var fs=require('fs');var path=require(_0x5771('0x6'));var rimraf=require(_0x5771('0x7'));var config=require(_0x5771('0x8'));var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x3920fa,_0x3471e6){return _0x3920fa[_0x5771('0x9')](_0x5771('0xa'),attributes,{'tableName':_0x5771('0xb'),'paranoid':![],'indexes':[{'fields':[_0x5771('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xefbb=['request-promise','path','rimraf','lodash','util','../../config/logger','api','moment'];(function(_0x53915d,_0x1daa70){var _0x11e040=function(_0x40e514){while(--_0x40e514){_0x53915d['push'](_0x53915d['shift']());}};_0x11e040(++_0x1daa70);}(_0xefbb,0x11b));var _0xbefb=function(_0x38cd70,_0x379300){_0x38cd70=_0x38cd70-0x0;var _0x28dff4=_0xefbb[_0x38cd70];return _0x28dff4;};'use strict';var _=require(_0xbefb('0x0'));var util=require(_0xbefb('0x1'));var logger=require(_0xbefb('0x2'))(_0xbefb('0x3'));var moment=require(_0xbefb('0x4'));var BPromise=require('bluebird');var rp=require(_0xbefb('0x5'));var fs=require('fs');var path=require(_0xbefb('0x6'));var rimraf=require(_0xbefb('0x7'));var config=require('../../config/environment');var attributes=require('./voiceDialReport.attributes');module['exports']=function(_0x48e358,_0x292420){return _0x48e358['define']('VoiceDialReport',attributes,{'tableName':'report_dial','paranoid':![],'indexes':[{'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceDialReport/voiceDialReport.rpc.js b/server/api/voiceDialReport/voiceDialReport.rpc.js index 1ecfa15..ee778e3 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 _0x9f96=['options','where','attributes','limit','util','moment','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','request','then','info','request\x20sent','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceDialReport,\x20%s,\x20%s','message','result','VoiceDialReport','create','raw','CreateVoiceDialReport','catch','UpdateVoiceDialReport','body'];(function(_0x4fc9e6,_0xc51915){var _0x551d28=function(_0x1a603b){while(--_0x1a603b){_0x4fc9e6['push'](_0x4fc9e6['shift']());}};_0x551d28(++_0xc51915);}(_0x9f96,0x13a));var _0x69f9=function(_0x498f66,_0x3055b0){_0x498f66=_0x498f66-0x0;var _0xc45c7c=_0x9f96[_0x498f66];return _0xc45c7c;};'use strict';var _=require('lodash');var util=require(_0x69f9('0x0'));var moment=require(_0x69f9('0x1'));var BPromise=require('bluebird');var rs=require(_0x69f9('0x2'));var fs=require('fs');var Redis=require(_0x69f9('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x69f9('0x4'));var logger=require(_0x69f9('0x5'))('rpc');var config=require(_0x69f9('0x6'));var jayson=require(_0x69f9('0x7'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x210f02,_0x2562fb,_0x7e8877){return new BPromise(function(_0x1c1fef,_0x3d7da3){return client[_0x69f9('0x8')](_0x210f02,_0x7e8877)[_0x69f9('0x9')](function(_0x110938){logger[_0x69f9('0xa')]('VoiceDialReport,\x20%s,\x20%s',_0x2562fb,_0x69f9('0xb'));logger[_0x69f9('0xc')](_0x69f9('0xd'),_0x2562fb,'request\x20sent',JSON[_0x69f9('0xe')](_0x110938));if(_0x110938[_0x69f9('0xf')]){if(_0x110938[_0x69f9('0xf')][_0x69f9('0x10')]===0x1f4){logger[_0x69f9('0xf')](_0x69f9('0x11'),_0x2562fb,_0x110938[_0x69f9('0xf')]['message']);return _0x3d7da3(_0x110938[_0x69f9('0xf')][_0x69f9('0x12')]);}logger['error']('VoiceDialReport,\x20%s,\x20%s',_0x2562fb,_0x110938[_0x69f9('0xf')]['message']);return _0x1c1fef(_0x110938['error']['message']);}else{logger[_0x69f9('0xa')](_0x69f9('0x11'),_0x2562fb,_0x69f9('0xb'));_0x1c1fef(_0x110938[_0x69f9('0x13')]['message']);}})['catch'](function(_0x2fe27d){logger['error'](_0x69f9('0x11'),_0x2562fb,_0x2fe27d);_0x3d7da3(_0x2fe27d);});});}exports['CreateVoiceDialReport']=function(_0x317ccd){var _0x5918c0=this;return new Promise(function(_0x473dde,_0x358cdf){return db[_0x69f9('0x14')][_0x69f9('0x15')](_0x317ccd['body'],{'raw':_0x317ccd['options']?_0x317ccd['options'][_0x69f9('0x16')]===undefined?!![]:![]:!![]})['then'](function(_0x3ab15e){logger[_0x69f9('0xa')](_0x69f9('0x17'),_0x317ccd);logger[_0x69f9('0xc')](_0x69f9('0x17'),_0x317ccd,JSON[_0x69f9('0xe')](_0x3ab15e));_0x473dde(_0x3ab15e);})[_0x69f9('0x18')](function(_0x5e665e){logger[_0x69f9('0xf')]('CreateVoiceDialReport',_0x5e665e[_0x69f9('0x12')],_0x317ccd);_0x358cdf(_0x5918c0[_0x69f9('0xf')](0x1f4,_0x5e665e[_0x69f9('0x12')]));});});};exports[_0x69f9('0x19')]=function(_0xedbcf2){var _0x4cec7b=this;return new Promise(function(_0x32e786,_0x3ed5be){return db['VoiceDialReport']['update'](_0xedbcf2[_0x69f9('0x1a')],{'raw':_0xedbcf2[_0x69f9('0x1b')]?_0xedbcf2[_0x69f9('0x1b')][_0x69f9('0x16')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0xedbcf2[_0x69f9('0x1b')]?_0xedbcf2[_0x69f9('0x1b')][_0x69f9('0x1c')]||null:null,'attributes':_0xedbcf2['options']?_0xedbcf2[_0x69f9('0x1b')][_0x69f9('0x1d')]||null:null,'limit':_0xedbcf2[_0x69f9('0x1b')]?_0xedbcf2[_0x69f9('0x1b')][_0x69f9('0x1e')]||null:null})['then'](function(_0x2255c1){logger[_0x69f9('0xa')](_0x69f9('0x19'),_0xedbcf2);logger['debug'](_0x69f9('0x19'),_0xedbcf2,JSON[_0x69f9('0xe')](_0x2255c1));_0x32e786(_0x2255c1);})[_0x69f9('0x18')](function(_0x5df473){logger[_0x69f9('0xf')](_0x69f9('0x19'),_0x5df473[_0x69f9('0x12')],_0xedbcf2);_0x3ed5be(_0x4cec7b[_0x69f9('0xf')](0x1f4,_0x5df473[_0x69f9('0x12')]));});});}; \ No newline at end of file +var _0xdee4=['rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceDialReport,\x20%s,\x20%s','debug','VoiceDialReport,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','CreateVoiceDialReport','VoiceDialReport','body','options','raw','UpdateVoiceDialReport','update','attributes','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x481ae1,_0x395790){var _0x497964=function(_0x145d66){while(--_0x145d66){_0x481ae1['push'](_0x481ae1['shift']());}};_0x497964(++_0x395790);}(_0xdee4,0x14c));var _0x4dee=function(_0x38ecda,_0x3b551e){_0x38ecda=_0x38ecda-0x0;var _0x3fa8f3=_0xdee4[_0x38ecda];return _0x3fa8f3;};'use strict';var _=require(_0x4dee('0x0'));var util=require('util');var moment=require(_0x4dee('0x1'));var BPromise=require(_0x4dee('0x2'));var rs=require(_0x4dee('0x3'));var fs=require('fs');var Redis=require(_0x4dee('0x4'));var db=require(_0x4dee('0x5'))['db'];var utils=require(_0x4dee('0x6'));var logger=require(_0x4dee('0x7'))(_0x4dee('0x8'));var config=require(_0x4dee('0x9'));var jayson=require(_0x4dee('0xa'));var client=jayson[_0x4dee('0xb')][_0x4dee('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x1cccda,_0x3c09cb,_0x464418){return new BPromise(function(_0x47902c,_0x6d47f4){return client[_0x4dee('0xd')](_0x1cccda,_0x464418)[_0x4dee('0xe')](function(_0x205651){logger[_0x4dee('0xf')](_0x4dee('0x10'),_0x3c09cb,'request\x20sent');logger[_0x4dee('0x11')](_0x4dee('0x12'),_0x3c09cb,_0x4dee('0x13'),JSON[_0x4dee('0x14')](_0x205651));if(_0x205651['error']){if(_0x205651[_0x4dee('0x15')][_0x4dee('0x16')]===0x1f4){logger[_0x4dee('0x15')]('VoiceDialReport,\x20%s,\x20%s',_0x3c09cb,_0x205651['error'][_0x4dee('0x17')]);return _0x6d47f4(_0x205651['error'][_0x4dee('0x17')]);}logger[_0x4dee('0x15')](_0x4dee('0x10'),_0x3c09cb,_0x205651[_0x4dee('0x15')][_0x4dee('0x17')]);return _0x47902c(_0x205651[_0x4dee('0x15')][_0x4dee('0x17')]);}else{logger[_0x4dee('0xf')](_0x4dee('0x10'),_0x3c09cb,_0x4dee('0x13'));_0x47902c(_0x205651[_0x4dee('0x18')][_0x4dee('0x17')]);}})[_0x4dee('0x19')](function(_0x2e0f06){logger['error'](_0x4dee('0x10'),_0x3c09cb,_0x2e0f06);_0x6d47f4(_0x2e0f06);});});}exports[_0x4dee('0x1a')]=function(_0x1f5fa4){var _0x548be5=this;return new Promise(function(_0x106ff8,_0x1bc8f5){return db[_0x4dee('0x1b')]['create'](_0x1f5fa4[_0x4dee('0x1c')],{'raw':_0x1f5fa4['options']?_0x1f5fa4[_0x4dee('0x1d')][_0x4dee('0x1e')]===undefined?!![]:![]:!![]})[_0x4dee('0xe')](function(_0x13c7cf){logger[_0x4dee('0xf')](_0x4dee('0x1a'),_0x1f5fa4);logger['debug'](_0x4dee('0x1a'),_0x1f5fa4,JSON[_0x4dee('0x14')](_0x13c7cf));_0x106ff8(_0x13c7cf);})['catch'](function(_0x3bcf80){logger['error'](_0x4dee('0x1a'),_0x3bcf80['message'],_0x1f5fa4);_0x1bc8f5(_0x548be5[_0x4dee('0x15')](0x1f4,_0x3bcf80['message']));});});};exports[_0x4dee('0x1f')]=function(_0x351419){var _0x504777=this;return new Promise(function(_0x2fe253,_0x570f1d){return db['VoiceDialReport'][_0x4dee('0x20')](_0x351419[_0x4dee('0x1c')],{'raw':_0x351419[_0x4dee('0x1d')]?_0x351419['options'][_0x4dee('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x351419[_0x4dee('0x1d')]?_0x351419[_0x4dee('0x1d')]['where']||null:null,'attributes':_0x351419[_0x4dee('0x1d')]?_0x351419[_0x4dee('0x1d')][_0x4dee('0x21')]||null:null,'limit':_0x351419[_0x4dee('0x1d')]?_0x351419[_0x4dee('0x1d')]['limit']||null:null})[_0x4dee('0xe')](function(_0x1ff261){logger[_0x4dee('0xf')](_0x4dee('0x1f'),_0x351419);logger['debug'](_0x4dee('0x1f'),_0x351419,JSON[_0x4dee('0x14')](_0x1ff261));_0x2fe253(_0x1ff261);})[_0x4dee('0x19')](function(_0x34f919){logger[_0x4dee('0x15')](_0x4dee('0x1f'),_0x34f919[_0x4dee('0x17')],_0x351419);_0x570f1d(_0x504777[_0x4dee('0x15')](0x1f4,_0x34f919[_0x4dee('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/index.js b/server/api/voiceExtension/index.js index fc5ab3e..2b2eac9 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 _0xf0ba=['exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','./voiceExtension.controller','get','isAuthenticated','index','/:id','show','post','create','/:id/applications','addApplications','put','update','delete','destroy'];(function(_0x33cb91,_0x28d39a){var _0x305239=function(_0x4a1c63){while(--_0x4a1c63){_0x33cb91['push'](_0x33cb91['shift']());}};_0x305239(++_0x28d39a);}(_0xf0ba,0x143));var _0xaf0b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xf0ba[_0x20a584];return _0x4b41a8;};'use strict';var multer=require(_0xaf0b('0x0'));var util=require(_0xaf0b('0x1'));var path=require(_0xaf0b('0x2'));var timeout=require(_0xaf0b('0x3'));var express=require(_0xaf0b('0x4'));var router=express[_0xaf0b('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xaf0b('0x6'));var interaction=require(_0xaf0b('0x7'));var config=require('../../config/environment');var controller=require(_0xaf0b('0x8'));router[_0xaf0b('0x9')]('/',auth[_0xaf0b('0xa')](),controller[_0xaf0b('0xb')]);router['get'](_0xaf0b('0xc'),auth[_0xaf0b('0xa')](),controller[_0xaf0b('0xd')]);router[_0xaf0b('0xe')]('/',auth[_0xaf0b('0xa')](),controller[_0xaf0b('0xf')]);router[_0xaf0b('0xe')](_0xaf0b('0x10'),auth['isAuthenticated'](),controller[_0xaf0b('0x11')]);router[_0xaf0b('0x12')](_0xaf0b('0xc'),auth['isAuthenticated'](),controller[_0xaf0b('0x13')]);router[_0xaf0b('0x14')](_0xaf0b('0xc'),auth[_0xaf0b('0xa')](),controller[_0xaf0b('0x15')]);module[_0xaf0b('0x16')]=router; \ No newline at end of file +var _0x2b1e=['../../components/interaction/service','./voiceExtension.controller','get','/:id','post','isAuthenticated','create','addApplications','put','delete','destroy','exports','util','connect-timeout','express','Router','../../components/auth/service'];(function(_0x10a31c,_0x173eea){var _0x4d5885=function(_0x199aa5){while(--_0x199aa5){_0x10a31c['push'](_0x10a31c['shift']());}};_0x4d5885(++_0x173eea);}(_0x2b1e,0x11c));var _0xe2b1=function(_0xf9a486,_0x5bb6c2){_0xf9a486=_0xf9a486-0x0;var _0x42e9ab=_0x2b1e[_0xf9a486];return _0x42e9ab;};'use strict';var multer=require('multer');var util=require(_0xe2b1('0x0'));var path=require('path');var timeout=require(_0xe2b1('0x1'));var express=require(_0xe2b1('0x2'));var router=express[_0xe2b1('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xe2b1('0x4'));var interaction=require(_0xe2b1('0x5'));var config=require('../../config/environment');var controller=require(_0xe2b1('0x6'));router[_0xe2b1('0x7')]('/',auth['isAuthenticated'](),controller['index']);router[_0xe2b1('0x7')](_0xe2b1('0x8'),auth['isAuthenticated'](),controller['show']);router[_0xe2b1('0x9')]('/',auth[_0xe2b1('0xa')](),controller[_0xe2b1('0xb')]);router[_0xe2b1('0x9')]('/:id/applications',auth[_0xe2b1('0xa')](),controller[_0xe2b1('0xc')]);router[_0xe2b1('0xd')](_0xe2b1('0x8'),auth[_0xe2b1('0xa')](),controller['update']);router[_0xe2b1('0xe')](_0xe2b1('0x8'),auth[_0xe2b1('0xa')](),controller[_0xe2b1('0xf')]);module[_0xe2b1('0x10')]=router; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.attributes.js b/server/api/voiceExtension/voiceExtension.attributes.js index 23df413..b70efec 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 _0x7cb0=['system','*,*,*,*','INTEGER','BOOLEAN','wav','getDataValue','sequelize','exports','STRING','compositeIndex','inbound','outbound','internal','inbound-fax'];(function(_0x1c9b48,_0x43ef3e){var _0x5636f1=function(_0x42ce50){while(--_0x42ce50){_0x1c9b48['push'](_0x1c9b48['shift']());}};_0x5636f1(++_0x43ef3e);}(_0x7cb0,0x1c6));var _0x07cb=function(_0x5f52e4,_0x5a69b3){_0x5f52e4=_0x5f52e4-0x0;var _0x25148b=_0x7cb0[_0x5f52e4];return _0x25148b;};'use strict';var Sequelize=require(_0x07cb('0x0'));module[_0x07cb('0x1')]={'context':{'type':Sequelize[_0x07cb('0x2')],'allowNull':![],'unique':_0x07cb('0x3'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0x07cb('0x2')],'allowNull':![],'unique':_0x07cb('0x3')},'priority':{'type':Sequelize[_0x07cb('0x2')],'allowNull':![],'defaultValue':'1','unique':_0x07cb('0x3')},'tag':{'type':Sequelize[_0x07cb('0x2')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize[_0x07cb('0x2')],'allowNull':![],'defaultValue':'NoOp'},'appdata':{'type':Sequelize[_0x07cb('0x2')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize['ENUM'](_0x07cb('0x4'),_0x07cb('0x5'),_0x07cb('0x6'),_0x07cb('0x7'),'outbound-fax',_0x07cb('0x8'),'any'),'allowNull':![]},'description':{'type':Sequelize[_0x07cb('0x2')]},'interval':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0x07cb('0x9')},'IntervalId':{'type':Sequelize[_0x07cb('0xa')]},'isApp':{'type':Sequelize[_0x07cb('0xb')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0x07cb('0x2')],'defaultValue':null},'callerID':{'type':Sequelize[_0x07cb('0x2')],'allowNull':!![]},'record':{'type':Sequelize[_0x07cb('0xb')],'defaultValue':![]},'cutdigits':{'type':Sequelize[_0x07cb('0xa')]},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0x07cb('0xc')},'answer':{'type':Sequelize[_0x07cb('0xb')],'defaultValue':!![]},'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x43693d){return this[_0x07cb('0xd')]('exten');}},'alias':{'type':Sequelize[_0x07cb('0x2')],'allowNull':!![]}}; \ No newline at end of file +var _0x9dcd=['system','any','INTEGER','BOOLEAN','wav','VIRTUAL','getDataValue','exten','exports','STRING','compositeIndex','NoOp','ENUM','inbound','outbound','inbound-fax','outbound-fax'];(function(_0x1e6988,_0x3b671a){var _0x3a7cb9=function(_0x3e2c8a){while(--_0x3e2c8a){_0x1e6988['push'](_0x1e6988['shift']());}};_0x3a7cb9(++_0x3b671a);}(_0x9dcd,0x17e));var _0xd9dc=function(_0x239b31,_0x44a64d){_0x239b31=_0x239b31-0x0;var _0x41c8be=_0x9dcd[_0x239b31];return _0x41c8be;};'use strict';var Sequelize=require('sequelize');module[_0xd9dc('0x0')]={'context':{'type':Sequelize[_0xd9dc('0x1')],'allowNull':![],'unique':_0xd9dc('0x2'),'validate':{'notEmpty':!![],'is':/[A-Za-z0-9._\+*!\-\[\]]+$/i}},'exten':{'type':Sequelize[_0xd9dc('0x1')],'allowNull':![],'unique':'compositeIndex'},'priority':{'type':Sequelize[_0xd9dc('0x1')],'allowNull':![],'defaultValue':'1','unique':_0xd9dc('0x2')},'tag':{'type':Sequelize[_0xd9dc('0x1')],'allowNull':![],'defaultValue':'--'},'app':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':_0xd9dc('0x3')},'appdata':{'type':Sequelize[_0xd9dc('0x1')](0x1000),'allowNull':!![],'defaultValue':''},'type':{'type':Sequelize[_0xd9dc('0x4')](_0xd9dc('0x5'),_0xd9dc('0x6'),'internal',_0xd9dc('0x7'),_0xd9dc('0x8'),_0xd9dc('0x9'),_0xd9dc('0xa')),'allowNull':![]},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0xd9dc('0x1')],'allowNull':![],'defaultValue':'*,*,*,*'},'IntervalId':{'type':Sequelize[_0xd9dc('0xb')]},'isApp':{'type':Sequelize[_0xd9dc('0xc')],'allowNull':![],'defaultValue':![]},'appType':{'type':Sequelize[_0xd9dc('0x1')],'defaultValue':null},'callerID':{'type':Sequelize[_0xd9dc('0x1')],'allowNull':!![]},'record':{'type':Sequelize[_0xd9dc('0xc')],'defaultValue':![]},'cutdigits':{'type':Sequelize['INTEGER']},'recordingFormat':{'type':Sequelize['STRING'],'defaultValue':_0xd9dc('0xd')},'answer':{'type':Sequelize['BOOLEAN'],'defaultValue':!![]},'name':{'type':Sequelize[_0xd9dc('0xe')],'get':function(_0x4b1277){return this[_0xd9dc('0xf')](_0xd9dc('0x10'));}},'alias':{'type':Sequelize[_0xd9dc('0x1')],'allowNull':!![]}}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.controller.js b/server/api/voiceExtension/voiceExtension.controller.js index 161667e..9a7bc4f 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 _0x978c=['../../components/parsers/qs','../../config/logger','api','../../config/environment','../../mysqldb','redis','localhost','register','sendStatus','status','end','json','offset','undefined','count','limit','set','then','get','inbound','OutboundRoutes','outbound','InternalRoutes','filter','ignore','map','value','includes','type','find','UserProfileResource','destroy','stack','name','send','index','VoiceExtension','rawAttributes','fieldName','key','keys','query','filters','intersection','model','attributes','fields','hasOwnProperty','nolimit','sort','pick','where','VIRTUAL','merge','options','includeAll','include','rows','show','params','catch','create','body','startsWith','exten','concat','InboundRoutes','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','description','recordingFormat','cutdigits','alias','context','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','findOne','VoiceExtensionId','createRouting','bulkCreate','findAndCountAll','cast(priority\x20as\x20unsigned)','finally'];(function(_0x21c098,_0x3720ed){var _0x1089cc=function(_0x1946c0){while(--_0x1946c0){_0x21c098['push'](_0x21c098['shift']());}};_0x1089cc(++_0x3720ed);}(_0x978c,0xb2));var _0xc978=function(_0x9cd4c3,_0x1c9b2c){_0x9cd4c3=_0x9cd4c3-0x0;var _0x4c9025=_0x978c[_0x9cd4c3];return _0x4c9025;};'use strict';var _=require('lodash');var Redis=require('ioredis');var qs=require(_0xc978('0x0'));var logger=require(_0xc978('0x1'))(_0xc978('0x2'));var config=require(_0xc978('0x3'));var db=require(_0xc978('0x4'))['db'];config['redis']=_['defaults'](config[_0xc978('0x5')],{'host':_0xc978('0x6'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xc978('0x5')]));require('./voiceExtension.socket')[_0xc978('0x7')](socket);function respondWithStatusCode(_0x4e2424,_0x2f2d68){_0x2f2d68=_0x2f2d68||0xcc;return function(_0x4eec0d){if(_0x4eec0d){return _0x4e2424[_0xc978('0x8')](_0x2f2d68);}return _0x4e2424[_0xc978('0x9')](_0x2f2d68)[_0xc978('0xa')]();};}function respondWithResult(_0x2b5edd,_0x344f5c){_0x344f5c=_0x344f5c||0xc8;return function(_0x1b6ff6){if(_0x1b6ff6){return _0x2b5edd[_0xc978('0x9')](_0x344f5c)[_0xc978('0xb')](_0x1b6ff6);}};}function respondWithFilteredResult(_0x5078ac,_0x52d696){return function(_0x18a00d){if(_0x18a00d){var _0x1359ec=typeof _0x52d696[_0xc978('0xc')]===_0xc978('0xd')&&typeof _0x52d696['limit']===_0xc978('0xd');var _0x7a5912=_0x18a00d['count'];var _0x4eea7c=_0x1359ec?0x0:_0x52d696['offset'];var _0x24e4a7=_0x1359ec?_0x18a00d[_0xc978('0xe')]:_0x52d696['offset']+_0x52d696[_0xc978('0xf')];var _0x37d0f0;if(_0x24e4a7>=_0x7a5912){_0x24e4a7=_0x7a5912;_0x37d0f0=0xc8;}else{_0x37d0f0=0xce;}_0x5078ac[_0xc978('0x9')](_0x37d0f0);return _0x5078ac[_0xc978('0x10')]('Content-Range',_0x4eea7c+'-'+_0x24e4a7+'/'+_0x7a5912)[_0xc978('0xb')](_0x18a00d);}return null;};}function removeEntity(_0x4fd0e4){return function(_0x25cacd){if(_0x25cacd){return _0x25cacd['destroy']()[_0xc978('0x11')](function(){var _0x15933f=_0x25cacd[_0xc978('0x12')]({'plain':!![]});var _0xeb7dd1=[{'name':'InboundRoutes','value':_0xc978('0x13'),'ignore':![]},{'name':_0xc978('0x14'),'value':_0xc978('0x15'),'ignore':![]},{'name':_0xc978('0x16'),'value':'internal','ignore':![]}];var _0x35a811=_(_0xeb7dd1)[_0xc978('0x17')](_0xc978('0x18'))[_0xc978('0x19')]('value')[_0xc978('0x1a')]();if(_[_0xc978('0x1b')](_0x35a811,_0x15933f[_0xc978('0x1c')])){return;}var _0x4d4325=_[_0xc978('0x1d')](_0xeb7dd1,[_0xc978('0x1a'),_0x15933f[_0xc978('0x1c')]])['name'];return db[_0xc978('0x1e')][_0xc978('0x1f')]({'where':{'type':_0x4d4325,'resourceId':_0x15933f['id']}})['then'](function(){return _0x25cacd;});})[_0xc978('0x11')](function(){_0x4fd0e4[_0xc978('0x9')](0xcc)[_0xc978('0xa')]();});}};}function handleEntityNotFound(_0x42d763){return function(_0x498767){if(!_0x498767){_0x42d763[_0xc978('0x8')](0x194);}return _0x498767;};}function handleError(_0x21b718,_0x1b1f29){_0x1b1f29=_0x1b1f29||0x1f4;return function(_0x16931a){logger['error'](_0x16931a[_0xc978('0x20')]);if(_0x16931a[_0xc978('0x21')]){delete _0x16931a['name'];}_0x21b718[_0xc978('0x9')](_0x1b1f29)[_0xc978('0x22')](_0x16931a);};}exports[_0xc978('0x23')]=function(_0x30e505,_0x3c7868){var _0x4c03f6={},_0x47dcb1={},_0x40a21a={'count':0x0,'rows':[]};var _0x21166f=_[_0xc978('0x19')](db[_0xc978('0x24')][_0xc978('0x25')],function(_0x788a7){return{'name':_0x788a7[_0xc978('0x26')],'type':_0x788a7[_0xc978('0x1c')][_0xc978('0x27')]};});_0x47dcb1['model']=_[_0xc978('0x19')](_0x21166f,_0xc978('0x21'));_0x47dcb1['query']=_[_0xc978('0x28')](_0x30e505[_0xc978('0x29')]);_0x47dcb1[_0xc978('0x2a')]=_[_0xc978('0x2b')](_0x47dcb1[_0xc978('0x2c')],_0x47dcb1[_0xc978('0x29')]);_0x4c03f6[_0xc978('0x2d')]=_[_0xc978('0x2b')](_0x47dcb1['model'],qs[_0xc978('0x2e')](_0x30e505['query'][_0xc978('0x2e')]));_0x4c03f6[_0xc978('0x2d')]=_0x4c03f6[_0xc978('0x2d')]['length']?_0x4c03f6[_0xc978('0x2d')]:_0x47dcb1[_0xc978('0x2c')];if(!_0x30e505[_0xc978('0x29')][_0xc978('0x2f')](_0xc978('0x30'))){_0x4c03f6[_0xc978('0xf')]=qs[_0xc978('0xf')](_0x30e505['query']['limit']);_0x4c03f6[_0xc978('0xc')]=qs[_0xc978('0xc')](_0x30e505[_0xc978('0x29')]['offset']);}_0x4c03f6['order']=qs[_0xc978('0x31')](_0x30e505[_0xc978('0x29')][_0xc978('0x31')]);_0x4c03f6['where']=qs[_0xc978('0x2a')](_[_0xc978('0x32')](_0x30e505[_0xc978('0x29')],_0x47dcb1[_0xc978('0x2a')]),_0x21166f);if(_0x30e505[_0xc978('0x29')][_0xc978('0x17')]){_0x4c03f6[_0xc978('0x33')]=_['merge'](_0x4c03f6[_0xc978('0x33')],{'$or':_[_0xc978('0x19')](_0x21166f,function(_0x26f3b9){if(_0x26f3b9[_0xc978('0x1c')]!==_0xc978('0x34')){var _0x4c8ed9={};_0x4c8ed9[_0x26f3b9[_0xc978('0x21')]]={'$like':'%'+_0x30e505[_0xc978('0x29')][_0xc978('0x17')]+'%'};return _0x4c8ed9;}})});}_0x4c03f6=_[_0xc978('0x35')]({},_0x4c03f6,_0x30e505[_0xc978('0x36')]);var _0x10ff5a={'where':_0x4c03f6[_0xc978('0x33')]};return db[_0xc978('0x24')][_0xc978('0xe')](_0x10ff5a)[_0xc978('0x11')](function(_0x4c1376){_0x40a21a[_0xc978('0xe')]=_0x4c1376;if(_0x30e505['query'][_0xc978('0x37')]){_0x4c03f6[_0xc978('0x38')]=[{'all':!![]}];}return db[_0xc978('0x24')]['findAll'](_0x4c03f6);})[_0xc978('0x11')](function(_0x2f4e7f){_0x40a21a[_0xc978('0x39')]=_0x2f4e7f;return _0x40a21a;})['then'](respondWithFilteredResult(_0x3c7868,_0x4c03f6))['catch'](handleError(_0x3c7868,null));};exports[_0xc978('0x3a')]=function(_0x32a040,_0x43908e){var _0x2c277f={'raw':![],'where':{'id':_0x32a040[_0xc978('0x3b')]['id']}},_0x136a92={};_0x136a92[_0xc978('0x2c')]=_[_0xc978('0x28')](db[_0xc978('0x24')]['rawAttributes']);_0x136a92[_0xc978('0x29')]=_['keys'](_0x32a040[_0xc978('0x29')]);_0x136a92[_0xc978('0x2a')]=_[_0xc978('0x2b')](_0x136a92[_0xc978('0x2c')],_0x136a92[_0xc978('0x29')]);_0x2c277f['attributes']=_[_0xc978('0x2b')](_0x136a92['model'],qs[_0xc978('0x2e')](_0x32a040[_0xc978('0x29')][_0xc978('0x2e')]));_0x2c277f[_0xc978('0x2d')]=_0x2c277f['attributes']['length']?_0x2c277f['attributes']:_0x136a92[_0xc978('0x2c')];if(_0x32a040['query'][_0xc978('0x37')]){_0x2c277f['include']=[{'all':!![]}];}_0x2c277f=_[_0xc978('0x35')]({},_0x2c277f,_0x32a040[_0xc978('0x36')]);return db['VoiceExtension'][_0xc978('0x1d')](_0x2c277f)[_0xc978('0x11')](handleEntityNotFound(_0x43908e,null))[_0xc978('0x11')](respondWithResult(_0x43908e,null))[_0xc978('0x3c')](handleError(_0x43908e,null));};exports[_0xc978('0x1f')]=function(_0x5ef9df,_0x24c2bd){return db[_0xc978('0x24')][_0xc978('0x1d')]({'where':{'id':_0x5ef9df['params']['id']}})[_0xc978('0x11')](handleEntityNotFound(_0x24c2bd,null))['then'](removeEntity(_0x24c2bd,null))['catch'](handleError(_0x24c2bd,null));};exports[_0xc978('0x3d')]=function(_0x30573e,_0x3f735f){if(_0x30573e[_0xc978('0x3e')][_0xc978('0x1c')]===_0xc978('0x15')&&!_[_0xc978('0x3f')](_0x30573e['body'][_0xc978('0x40')],'_')){_0x30573e[_0xc978('0x3e')][_0xc978('0x40')]='_'[_0xc978('0x41')](_0x30573e[_0xc978('0x3e')][_0xc978('0x40')]);}return db[_0xc978('0x24')][_0xc978('0x3d')](_0x30573e[_0xc978('0x3e')],{'raw':![]})[_0xc978('0x11')](function(_0x93a256){var _0x288b09=_0x30573e['user'][_0xc978('0x12')]({'plain':!![]});if(!_0x288b09)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x288b09['role']==='user'){var _0x145171=_0x93a256['get']({'plain':!![]});var _0x18f7a7=[{'name':_0xc978('0x42'),'value':_0xc978('0x13')},{'name':_0xc978('0x14'),'value':'outbound'},{'name':'InternalRoutes','value':'internal'}];var _0x515c30=_[_0xc978('0x1d')](_0x18f7a7,[_0xc978('0x1a'),_0x145171['type']])[_0xc978('0x21')];return db['UserProfileSection'][_0xc978('0x1d')]({'where':{'name':_0x515c30,'userProfileId':_0x288b09[_0xc978('0x43')]},'raw':!![]})[_0xc978('0x11')](function(_0x5614f3){if(_0x5614f3&&_0x5614f3['autoAssociation']===0x0){return db[_0xc978('0x1e')][_0xc978('0x3d')]({'name':_0x145171[_0xc978('0x21')],'resourceId':_0x145171['id'],'type':_0x5614f3[_0xc978('0x21')],'sectionId':_0x5614f3['id']},{})[_0xc978('0x11')](function(){return _0x93a256;});}else{return _0x93a256;}})[_0xc978('0x3c')](function(_0x5be34a){logger[_0xc978('0x44')](_0xc978('0x45'),_0x5be34a);throw _0x5be34a;});}return _0x93a256;})[_0xc978('0x11')](respondWithResult(_0x3f735f,0xc9))[_0xc978('0x3c')](handleError(_0x3f735f,null));};exports[_0xc978('0x46')]=function(_0x25b574,_0x21c8ab){if(_0x25b574['body']['id']){delete _0x25b574[_0xc978('0x3e')]['id'];}return db[_0xc978('0x24')][_0xc978('0x1d')]({'where':{'id':_0x25b574[_0xc978('0x3b')]['id']}})[_0xc978('0x11')](handleEntityNotFound(_0x21c8ab,null))[_0xc978('0x11')](function(_0x665cec){if(_0x665cec){return db[_0xc978('0x24')][_0xc978('0x46')](_[_0xc978('0x32')](_0x25b574[_0xc978('0x3e')],[_0xc978('0x40'),'context',_0xc978('0x47'),_0xc978('0x48'),_0xc978('0x49'),'mandatoryDisposition',_0xc978('0x4a')]),{'where':{'context':_0x665cec[_0xc978('0x4b')],'exten':_0x665cec[_0xc978('0x40')]},'individualHooks':!![]})[_0xc978('0x11')](function(_0x35d33c){return _0x35d33c;});}return null;})[_0xc978('0x11')](respondWithStatusCode(_0x21c8ab,null))[_0xc978('0x3c')](handleError(_0x21c8ab,null));};exports[_0xc978('0x4c')]=function(_0x2178f3,_0x19d1cd){var _0x5d1c2e=_0x2178f3[_0xc978('0x3b')]['id'];var _0x1ea2ad=_0x2178f3[_0xc978('0x3e')];var _0x432d4a=0xc8;var _0x519503=null;return db[_0xc978('0x4d')][_0xc978('0x4e')]({'isolationLevel':db[_0xc978('0x4d')][_0xc978('0x4f')][_0xc978('0x50')][_0xc978('0x51')]},function(_0xc8d1da){return db[_0xc978('0x24')][_0xc978('0x52')]({'where':{'id':_0x5d1c2e},'transaction':_0xc8d1da})[_0xc978('0x11')](function(_0x394697){if(_0x394697){return db[_0xc978('0x24')][_0xc978('0x1f')]({'where':{'VoiceExtensionId':_0x5d1c2e},'transaction':_0xc8d1da})[_0xc978('0x11')](function(){var _0x464aed=_[_0xc978('0x19')](_0x1ea2ad,function(_0x355523){_0x355523[_0xc978('0x53')]=_0x5d1c2e;_0x355523['isApp']=!![];return _0x355523;});return _0x394697[_0xc978('0x54')](_0x464aed);})[_0xc978('0x11')](function(_0x2530de){return db[_0xc978('0x24')][_0xc978('0x55')](_0x2530de,{'transaction':_0xc8d1da});});}else{_0x432d4a=0x194;_0x519503=[];}});})[_0xc978('0x11')](function(){if(_0x432d4a!==0x194){return db[_0xc978('0x24')][_0xc978('0x56')]({'where':{'isApp':!![],'VoiceExtensionId':_0x5d1c2e},'order':_0xc978('0x57')})[_0xc978('0x11')](function(_0x517fb8){_0x519503=_0x517fb8;});}})[_0xc978('0x3c')](function(_0x1b71fb){_0x432d4a=0x1f4;logger['error'](_0x1b71fb[_0xc978('0x20')]);if(_0x1b71fb[_0xc978('0x21')]){delete _0x1b71fb[_0xc978('0x21')];}_0x519503=_0x1b71fb;})[_0xc978('0x58')](function(){if(_0x519503===null){_0x19d1cd[_0xc978('0x8')](_0x432d4a);}else{if(_0x432d4a===0x1f4){_0x19d1cd[_0xc978('0x9')](_0x432d4a)[_0xc978('0x22')](_0x519503);}else{_0x19d1cd[_0xc978('0x9')](_0x432d4a)[_0xc978('0xb')](_0x519503);}}});}; \ No newline at end of file +var _0x2d9b=['outbound','startsWith','exten','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','UserProfileResource','update','description','recordingFormat','cutdigits','mandatoryDisposition','alias','context','sequelize','READ_COMMITTED','findOne','VoiceExtensionId','isApp','findAndCountAll','cast(priority\x20as\x20unsigned)','finally','lodash','ioredis','../../config/logger','api','../../config/environment','redis','defaults','localhost','socket.io-emitter','./voiceExtension.socket','register','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','destroy','then','get','InboundRoutes','inbound','OutboundRoutes','InternalRoutes','internal','filter','ignore','map','value','type','find','name','error','stack','send','index','VoiceExtension','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','order','sort','where','pick','merge','VIRTUAL','options','includeAll','rows','catch','show','params','include','create','body'];(function(_0x178856,_0x41f045){var _0x3c7fe7=function(_0x4d9ce4){while(--_0x4d9ce4){_0x178856['push'](_0x178856['shift']());}};_0x3c7fe7(++_0x41f045);}(_0x2d9b,0x73));var _0xb2d9=function(_0x2624f8,_0x129191){_0x2624f8=_0x2624f8-0x0;var _0x487272=_0x2d9b[_0x2624f8];return _0x487272;};'use strict';var _=require(_0xb2d9('0x0'));var Redis=require(_0xb2d9('0x1'));var qs=require('../../components/parsers/qs');var logger=require(_0xb2d9('0x2'))(_0xb2d9('0x3'));var config=require(_0xb2d9('0x4'));var db=require('../../mysqldb')['db'];config[_0xb2d9('0x5')]=_[_0xb2d9('0x6')](config['redis'],{'host':_0xb2d9('0x7'),'port':0x18eb});var socket=require(_0xb2d9('0x8'))(new Redis(config[_0xb2d9('0x5')]));require(_0xb2d9('0x9'))[_0xb2d9('0xa')](socket);function respondWithStatusCode(_0x589cf5,_0x4c9cac){_0x4c9cac=_0x4c9cac||0xcc;return function(_0x1cf7a5){if(_0x1cf7a5){return _0x589cf5[_0xb2d9('0xb')](_0x4c9cac);}return _0x589cf5[_0xb2d9('0xc')](_0x4c9cac)[_0xb2d9('0xd')]();};}function respondWithResult(_0x3ff157,_0x4725c8){_0x4725c8=_0x4725c8||0xc8;return function(_0x3f3538){if(_0x3f3538){return _0x3ff157[_0xb2d9('0xc')](_0x4725c8)['json'](_0x3f3538);}};}function respondWithFilteredResult(_0x5cc180,_0x343350){return function(_0x2be8d2){if(_0x2be8d2){var _0x1610e2=typeof _0x343350[_0xb2d9('0xe')]===_0xb2d9('0xf')&&typeof _0x343350[_0xb2d9('0x10')]===_0xb2d9('0xf');var _0x3ce08f=_0x2be8d2[_0xb2d9('0x11')];var _0x4e9055=_0x1610e2?0x0:_0x343350['offset'];var _0x269181=_0x1610e2?_0x2be8d2[_0xb2d9('0x11')]:_0x343350[_0xb2d9('0xe')]+_0x343350[_0xb2d9('0x10')];var _0x121dba;if(_0x269181>=_0x3ce08f){_0x269181=_0x3ce08f;_0x121dba=0xc8;}else{_0x121dba=0xce;}_0x5cc180[_0xb2d9('0xc')](_0x121dba);return _0x5cc180[_0xb2d9('0x12')](_0xb2d9('0x13'),_0x4e9055+'-'+_0x269181+'/'+_0x3ce08f)[_0xb2d9('0x14')](_0x2be8d2);}return null;};}function removeEntity(_0x29e9d0){return function(_0x1a0c2e){if(_0x1a0c2e){return _0x1a0c2e[_0xb2d9('0x15')]()[_0xb2d9('0x16')](function(){var _0x1ceca9=_0x1a0c2e[_0xb2d9('0x17')]({'plain':!![]});var _0xb55a9e=[{'name':_0xb2d9('0x18'),'value':_0xb2d9('0x19'),'ignore':![]},{'name':_0xb2d9('0x1a'),'value':'outbound','ignore':![]},{'name':_0xb2d9('0x1b'),'value':_0xb2d9('0x1c'),'ignore':![]}];var _0x2249f1=_(_0xb55a9e)[_0xb2d9('0x1d')](_0xb2d9('0x1e'))[_0xb2d9('0x1f')](_0xb2d9('0x20'))[_0xb2d9('0x20')]();if(_['includes'](_0x2249f1,_0x1ceca9[_0xb2d9('0x21')])){return;}var _0x31f6b5=_[_0xb2d9('0x22')](_0xb55a9e,[_0xb2d9('0x20'),_0x1ceca9[_0xb2d9('0x21')]])[_0xb2d9('0x23')];return db['UserProfileResource'][_0xb2d9('0x15')]({'where':{'type':_0x31f6b5,'resourceId':_0x1ceca9['id']}})[_0xb2d9('0x16')](function(){return _0x1a0c2e;});})[_0xb2d9('0x16')](function(){_0x29e9d0['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x15b3de){return function(_0x1179dc){if(!_0x1179dc){_0x15b3de[_0xb2d9('0xb')](0x194);}return _0x1179dc;};}function handleError(_0x4bcd53,_0x70dd2c){_0x70dd2c=_0x70dd2c||0x1f4;return function(_0xea3bd6){logger[_0xb2d9('0x24')](_0xea3bd6[_0xb2d9('0x25')]);if(_0xea3bd6['name']){delete _0xea3bd6[_0xb2d9('0x23')];}_0x4bcd53[_0xb2d9('0xc')](_0x70dd2c)[_0xb2d9('0x26')](_0xea3bd6);};}exports[_0xb2d9('0x27')]=function(_0x3fe87f,_0x1a14af){var _0x3a2a5c={},_0x27a02f={},_0x413616={'count':0x0,'rows':[]};var _0x10c549=_[_0xb2d9('0x1f')](db[_0xb2d9('0x28')][_0xb2d9('0x29')],function(_0x9dd889){return{'name':_0x9dd889[_0xb2d9('0x2a')],'type':_0x9dd889[_0xb2d9('0x21')][_0xb2d9('0x2b')]};});_0x27a02f[_0xb2d9('0x2c')]=_[_0xb2d9('0x1f')](_0x10c549,_0xb2d9('0x23'));_0x27a02f[_0xb2d9('0x2d')]=_[_0xb2d9('0x2e')](_0x3fe87f[_0xb2d9('0x2d')]);_0x27a02f[_0xb2d9('0x2f')]=_[_0xb2d9('0x30')](_0x27a02f[_0xb2d9('0x2c')],_0x27a02f[_0xb2d9('0x2d')]);_0x3a2a5c[_0xb2d9('0x31')]=_[_0xb2d9('0x30')](_0x27a02f[_0xb2d9('0x2c')],qs['fields'](_0x3fe87f[_0xb2d9('0x2d')][_0xb2d9('0x32')]));_0x3a2a5c[_0xb2d9('0x31')]=_0x3a2a5c[_0xb2d9('0x31')][_0xb2d9('0x33')]?_0x3a2a5c[_0xb2d9('0x31')]:_0x27a02f[_0xb2d9('0x2c')];if(!_0x3fe87f[_0xb2d9('0x2d')]['hasOwnProperty']('nolimit')){_0x3a2a5c[_0xb2d9('0x10')]=qs['limit'](_0x3fe87f[_0xb2d9('0x2d')][_0xb2d9('0x10')]);_0x3a2a5c[_0xb2d9('0xe')]=qs[_0xb2d9('0xe')](_0x3fe87f[_0xb2d9('0x2d')][_0xb2d9('0xe')]);}_0x3a2a5c[_0xb2d9('0x34')]=qs[_0xb2d9('0x35')](_0x3fe87f[_0xb2d9('0x2d')]['sort']);_0x3a2a5c[_0xb2d9('0x36')]=qs[_0xb2d9('0x2f')](_[_0xb2d9('0x37')](_0x3fe87f[_0xb2d9('0x2d')],_0x27a02f[_0xb2d9('0x2f')]),_0x10c549);if(_0x3fe87f[_0xb2d9('0x2d')][_0xb2d9('0x1d')]){_0x3a2a5c['where']=_[_0xb2d9('0x38')](_0x3a2a5c[_0xb2d9('0x36')],{'$or':_[_0xb2d9('0x1f')](_0x10c549,function(_0x2bb3ba){if(_0x2bb3ba['type']!==_0xb2d9('0x39')){var _0x24a235={};_0x24a235[_0x2bb3ba[_0xb2d9('0x23')]]={'$like':'%'+_0x3fe87f[_0xb2d9('0x2d')][_0xb2d9('0x1d')]+'%'};return _0x24a235;}})});}_0x3a2a5c=_[_0xb2d9('0x38')]({},_0x3a2a5c,_0x3fe87f[_0xb2d9('0x3a')]);var _0x5e4936={'where':_0x3a2a5c[_0xb2d9('0x36')]};return db[_0xb2d9('0x28')][_0xb2d9('0x11')](_0x5e4936)[_0xb2d9('0x16')](function(_0x6b334c){_0x413616[_0xb2d9('0x11')]=_0x6b334c;if(_0x3fe87f['query'][_0xb2d9('0x3b')]){_0x3a2a5c['include']=[{'all':!![]}];}return db['VoiceExtension']['findAll'](_0x3a2a5c);})[_0xb2d9('0x16')](function(_0x458921){_0x413616[_0xb2d9('0x3c')]=_0x458921;return _0x413616;})['then'](respondWithFilteredResult(_0x1a14af,_0x3a2a5c))[_0xb2d9('0x3d')](handleError(_0x1a14af,null));};exports[_0xb2d9('0x3e')]=function(_0x38b355,_0x364000){var _0xcb192a={'raw':![],'where':{'id':_0x38b355[_0xb2d9('0x3f')]['id']}},_0x1bbe02={};_0x1bbe02[_0xb2d9('0x2c')]=_[_0xb2d9('0x2e')](db[_0xb2d9('0x28')]['rawAttributes']);_0x1bbe02[_0xb2d9('0x2d')]=_[_0xb2d9('0x2e')](_0x38b355[_0xb2d9('0x2d')]);_0x1bbe02[_0xb2d9('0x2f')]=_[_0xb2d9('0x30')](_0x1bbe02[_0xb2d9('0x2c')],_0x1bbe02[_0xb2d9('0x2d')]);_0xcb192a[_0xb2d9('0x31')]=_[_0xb2d9('0x30')](_0x1bbe02[_0xb2d9('0x2c')],qs[_0xb2d9('0x32')](_0x38b355[_0xb2d9('0x2d')][_0xb2d9('0x32')]));_0xcb192a['attributes']=_0xcb192a[_0xb2d9('0x31')][_0xb2d9('0x33')]?_0xcb192a['attributes']:_0x1bbe02[_0xb2d9('0x2c')];if(_0x38b355[_0xb2d9('0x2d')][_0xb2d9('0x3b')]){_0xcb192a[_0xb2d9('0x40')]=[{'all':!![]}];}_0xcb192a=_[_0xb2d9('0x38')]({},_0xcb192a,_0x38b355[_0xb2d9('0x3a')]);return db[_0xb2d9('0x28')]['find'](_0xcb192a)[_0xb2d9('0x16')](handleEntityNotFound(_0x364000,null))[_0xb2d9('0x16')](respondWithResult(_0x364000,null))[_0xb2d9('0x3d')](handleError(_0x364000,null));};exports[_0xb2d9('0x15')]=function(_0x2fe362,_0x389e9b){return db['VoiceExtension']['find']({'where':{'id':_0x2fe362['params']['id']}})[_0xb2d9('0x16')](handleEntityNotFound(_0x389e9b,null))[_0xb2d9('0x16')](removeEntity(_0x389e9b,null))[_0xb2d9('0x3d')](handleError(_0x389e9b,null));};exports[_0xb2d9('0x41')]=function(_0x3138e1,_0x135758){if(_0x3138e1[_0xb2d9('0x42')][_0xb2d9('0x21')]===_0xb2d9('0x43')&&!_[_0xb2d9('0x44')](_0x3138e1[_0xb2d9('0x42')]['exten'],'_')){_0x3138e1[_0xb2d9('0x42')]['exten']='_'['concat'](_0x3138e1[_0xb2d9('0x42')][_0xb2d9('0x45')]);}return db[_0xb2d9('0x28')][_0xb2d9('0x41')](_0x3138e1['body'],{'raw':![]})[_0xb2d9('0x16')](function(_0x242f53){var _0x38d319=_0x3138e1[_0xb2d9('0x46')][_0xb2d9('0x17')]({'plain':!![]});if(!_0x38d319)throw new Error(_0xb2d9('0x47'));if(_0x38d319[_0xb2d9('0x48')]===_0xb2d9('0x46')){var _0x50e251=_0x242f53[_0xb2d9('0x17')]({'plain':!![]});var _0x37a422=[{'name':_0xb2d9('0x18'),'value':_0xb2d9('0x19')},{'name':_0xb2d9('0x1a'),'value':_0xb2d9('0x43')},{'name':_0xb2d9('0x1b'),'value':_0xb2d9('0x1c')}];var _0xfb44ed=_[_0xb2d9('0x22')](_0x37a422,[_0xb2d9('0x20'),_0x50e251['type']])[_0xb2d9('0x23')];return db[_0xb2d9('0x49')][_0xb2d9('0x22')]({'where':{'name':_0xfb44ed,'userProfileId':_0x38d319['userProfileId']},'raw':!![]})[_0xb2d9('0x16')](function(_0x3baf84){if(_0x3baf84&&_0x3baf84[_0xb2d9('0x4a')]===0x0){return db[_0xb2d9('0x4b')][_0xb2d9('0x41')]({'name':_0x50e251['name'],'resourceId':_0x50e251['id'],'type':_0x3baf84[_0xb2d9('0x23')],'sectionId':_0x3baf84['id']},{})[_0xb2d9('0x16')](function(){return _0x242f53;});}else{return _0x242f53;}})[_0xb2d9('0x3d')](function(_0x359822){logger[_0xb2d9('0x24')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x359822);throw _0x359822;});}return _0x242f53;})[_0xb2d9('0x16')](respondWithResult(_0x135758,0xc9))[_0xb2d9('0x3d')](handleError(_0x135758,null));};exports[_0xb2d9('0x4c')]=function(_0xf0979,_0x363783){if(_0xf0979[_0xb2d9('0x42')]['id']){delete _0xf0979[_0xb2d9('0x42')]['id'];}return db[_0xb2d9('0x28')][_0xb2d9('0x22')]({'where':{'id':_0xf0979['params']['id']}})['then'](handleEntityNotFound(_0x363783,null))[_0xb2d9('0x16')](function(_0x532857){if(_0x532857){return db['VoiceExtension'][_0xb2d9('0x4c')](_[_0xb2d9('0x37')](_0xf0979['body'],[_0xb2d9('0x45'),'context',_0xb2d9('0x4d'),_0xb2d9('0x4e'),_0xb2d9('0x4f'),_0xb2d9('0x50'),_0xb2d9('0x51')]),{'where':{'context':_0x532857[_0xb2d9('0x52')],'exten':_0x532857['exten']},'individualHooks':!![]})[_0xb2d9('0x16')](function(_0x2ba289){return _0x2ba289;});}return null;})[_0xb2d9('0x16')](respondWithStatusCode(_0x363783,null))[_0xb2d9('0x3d')](handleError(_0x363783,null));};exports['addApplications']=function(_0x45eeee,_0xcc6b41){var _0x2cbd93=_0x45eeee[_0xb2d9('0x3f')]['id'];var _0x3912de=_0x45eeee['body'];var _0x168934=0xc8;var _0x43b08a=null;return db[_0xb2d9('0x53')]['transaction']({'isolationLevel':db['sequelize']['Transaction']['ISOLATION_LEVELS'][_0xb2d9('0x54')]},function(_0x15ca9c){return db[_0xb2d9('0x28')][_0xb2d9('0x55')]({'where':{'id':_0x2cbd93},'transaction':_0x15ca9c})[_0xb2d9('0x16')](function(_0x280601){if(_0x280601){return db[_0xb2d9('0x28')][_0xb2d9('0x15')]({'where':{'VoiceExtensionId':_0x2cbd93},'transaction':_0x15ca9c})[_0xb2d9('0x16')](function(){var _0x2f1dd0=_['map'](_0x3912de,function(_0x497252){_0x497252[_0xb2d9('0x56')]=_0x2cbd93;_0x497252[_0xb2d9('0x57')]=!![];return _0x497252;});return _0x280601['createRouting'](_0x2f1dd0);})[_0xb2d9('0x16')](function(_0x5d2219){return db[_0xb2d9('0x28')]['bulkCreate'](_0x5d2219,{'transaction':_0x15ca9c});});}else{_0x168934=0x194;_0x43b08a=[];}});})[_0xb2d9('0x16')](function(){if(_0x168934!==0x194){return db['VoiceExtension'][_0xb2d9('0x58')]({'where':{'isApp':!![],'VoiceExtensionId':_0x2cbd93},'order':_0xb2d9('0x59')})[_0xb2d9('0x16')](function(_0x31e04d){_0x43b08a=_0x31e04d;});}})['catch'](function(_0x25f93c){_0x168934=0x1f4;logger['error'](_0x25f93c[_0xb2d9('0x25')]);if(_0x25f93c[_0xb2d9('0x23')]){delete _0x25f93c[_0xb2d9('0x23')];}_0x43b08a=_0x25f93c;})[_0xb2d9('0x5a')](function(){if(_0x43b08a===null){_0xcc6b41[_0xb2d9('0xb')](_0x168934);}else{if(_0x168934===0x1f4){_0xcc6b41['status'](_0x168934)[_0xb2d9('0x26')](_0x43b08a);}else{_0xcc6b41[_0xb2d9('0xc')](_0x168934)[_0xb2d9('0x14')](_0x43b08a);}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.events.js b/server/api/voiceExtension/voiceExtension.events.js index c02a528..0addd36 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 _0x32ea=['../../mysqldb','setMaxListeners','save','update','remove','emit','hasOwnProperty','events'];(function(_0x343e44,_0x519af9){var _0xa5130e=function(_0xae1fa0){while(--_0xae1fa0){_0x343e44['push'](_0x343e44['shift']());}};_0xa5130e(++_0x519af9);}(_0x32ea,0x18f));var _0xa32e=function(_0x3227c1,_0x4318c5){_0x3227c1=_0x3227c1-0x0;var _0x31fd48=_0x32ea[_0x3227c1];return _0x31fd48;};'use strict';var EventEmitter=require(_0xa32e('0x0'));var VoiceExtension=require(_0xa32e('0x1'))['db']['VoiceExtension'];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0xa32e('0x2')](0x0);var events={'afterCreate':_0xa32e('0x3'),'afterUpdate':_0xa32e('0x4'),'afterDestroy':_0xa32e('0x5')};function emitEvent(_0x1cb379){return function(_0x5d5dbf,_0xa01f54,_0x52c975){VoiceExtensionEvents[_0xa32e('0x6')](_0x1cb379+':'+_0x5d5dbf['id'],_0x5d5dbf);VoiceExtensionEvents['emit'](_0x1cb379,_0x5d5dbf);_0x52c975(null);};}for(var e in events){if(events[_0xa32e('0x7')](e)){var event=events[e];VoiceExtension['hook'](e,emitEvent(event));}}module['exports']=VoiceExtensionEvents; \ No newline at end of file +var _0x1637=['setMaxListeners','save','update','emit','hasOwnProperty','hook','exports','VoiceExtension'];(function(_0x37da86,_0x7e7973){var _0x229c20=function(_0x5f29da){while(--_0x5f29da){_0x37da86['push'](_0x37da86['shift']());}};_0x229c20(++_0x7e7973);}(_0x1637,0xa7));var _0x7163=function(_0x4a53d,_0x58a95e){_0x4a53d=_0x4a53d-0x0;var _0x27410e=_0x1637[_0x4a53d];return _0x27410e;};'use strict';var EventEmitter=require('events');var VoiceExtension=require('../../mysqldb')['db'][_0x7163('0x0')];var VoiceExtensionEvents=new EventEmitter();VoiceExtensionEvents[_0x7163('0x1')](0x0);var events={'afterCreate':_0x7163('0x2'),'afterUpdate':_0x7163('0x3'),'afterDestroy':'remove'};function emitEvent(_0x2b5d14){return function(_0x242c62,_0x368151,_0x10d9f1){VoiceExtensionEvents[_0x7163('0x4')](_0x2b5d14+':'+_0x242c62['id'],_0x242c62);VoiceExtensionEvents['emit'](_0x2b5d14,_0x242c62);_0x10d9f1(null);};}for(var e in events){if(events[_0x7163('0x5')](e)){var event=events[e];VoiceExtension[_0x7163('0x6')](e,emitEvent(event));}}module[_0x7163('0x7')]=VoiceExtensionEvents; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.model.js b/server/api/voiceExtension/voiceExtension.model.js index 25b7cd0..0f02712 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 _0xf0db=['CDR(routeid)=','exten','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outbound','CDR(type)=outbound','${EXTEN:','${EXTEN}','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','):Goto(','cutdigits','CDR(prefix)=${EXTEN:0:','XCALLY-MOTION-ANSWER=0','outboundrouteid=','hasOwnProperty','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','trunk','timeout','url','split','length','prefix','phone','param','SIP','join','options','indexOf','U(xcally-mixmonitor-context)','replace','Interval','findAll','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','tag','CDR(tag)=','callerID','queue','playback','app','appType','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1',',${EXTEN},','outboundDial','appdata','priority','last','catch','define','VoiceExtension','voice_extensions','get','lodash','./voiceExtension.attributes','models','Set','CDR(type)=','type','context','alias','NoOp','CDR(routeAlias)=','No\x20alias\x20set','inbound','push'];(function(_0x7a0cd3,_0x3b83f8){var _0x1eaa82=function(_0x2e924a){while(--_0x2e924a){_0x7a0cd3['push'](_0x7a0cd3['shift']());}};_0x1eaa82(++_0x3b83f8);}(_0xf0db,0x12b));var _0xbf0d=function(_0x4a2c5d,_0x1cfe0e){_0x4a2c5d=_0x4a2c5d-0x0;var _0x40bde1=_0xf0db[_0x4a2c5d];return _0x40bde1;};'use strict';var _=require(_0xbf0d('0x0'));var attributes=require(_0xbf0d('0x1'));module['exports']=function(_0x138814){var _0x1a6fea=_0x138814[_0xbf0d('0x2')];function _0x5db968(_0x47436c){var _0x2ccd6c=0x2;var _0x56f648=[{'type':_0x47436c['type'],'app':_0xbf0d('0x3'),'appdata':_0xbf0d('0x4')+_0x47436c[_0xbf0d('0x5')],'context':_0x47436c[_0xbf0d('0x6')],'exten':_0x47436c['exten'],'priority':_0x2ccd6c++,'VoiceExtensionId':_0x47436c['id']},{'type':_0x47436c[_0xbf0d('0x5')],'app':_0x47436c[_0xbf0d('0x7')]?_0xbf0d('0x3'):_0xbf0d('0x8'),'appdata':_0x47436c[_0xbf0d('0x7')]?_0xbf0d('0x9')+_0x47436c[_0xbf0d('0x7')]:_0xbf0d('0xa'),'context':_0x47436c['context'],'exten':_0x47436c['exten'],'priority':_0x2ccd6c++,'VoiceExtensionId':_0x47436c['id']}];if(_0x47436c[_0xbf0d('0x5')]===_0xbf0d('0xb')){_0x56f648[_0xbf0d('0xc')]({'type':_0xbf0d('0xb'),'app':_0xbf0d('0x3'),'appdata':_0xbf0d('0xd')+_0x47436c['id'],'context':_0x47436c[_0xbf0d('0x6')],'exten':_0x47436c[_0xbf0d('0xe')],'priority':_0x2ccd6c++,'VoiceExtensionId':_0x47436c['id']});}_0x56f648['push']({'type':_0x47436c[_0xbf0d('0x5')],'app':_0xbf0d('0x3'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x47436c[_0xbf0d('0x6')],'exten':_0x47436c[_0xbf0d('0xe')],'priority':_0x2ccd6c++,'VoiceExtensionId':_0x47436c['id']},{'type':_0x47436c[_0xbf0d('0x5')],'app':_0xbf0d('0x3'),'appdata':_0xbf0d('0xf'),'context':_0x47436c[_0xbf0d('0x6')],'exten':_0x47436c[_0xbf0d('0xe')],'priority':_0x2ccd6c++,'VoiceExtensionId':_0x47436c['id']},{'type':_0x47436c[_0xbf0d('0x5')],'app':_0xbf0d('0x3'),'appdata':_0xbf0d('0x10'),'context':_0x47436c[_0xbf0d('0x6')],'exten':_0x47436c[_0xbf0d('0xe')],'priority':_0x2ccd6c++,'VoiceExtensionId':_0x47436c['id']});return _0x56f648;}function _0x474ac2(_0x1d1eb4){var _0x523802=0x2;var _0x11a5f1=[{'type':_0xbf0d('0x11'),'app':_0xbf0d('0x3'),'appdata':_0xbf0d('0x12'),'context':_0x1d1eb4[_0xbf0d('0x6')],'exten':_0x1d1eb4[_0xbf0d('0xe')],'priority':_0x523802++,'VoiceExtensionId':_0x1d1eb4['id']},{'type':_0xbf0d('0x11'),'app':_0x1d1eb4['alias']?_0xbf0d('0x3'):'NoOp','appdata':_0x1d1eb4[_0xbf0d('0x7')]?_0xbf0d('0x9')+_0x1d1eb4[_0xbf0d('0x7')]:_0xbf0d('0xa'),'context':_0x1d1eb4['context'],'exten':_0x1d1eb4[_0xbf0d('0xe')],'priority':_0x523802++,'VoiceExtensionId':_0x1d1eb4['id']},{'type':_0xbf0d('0x11'),'app':_0xbf0d('0x3'),'appdata':'CDR(destination)='+(_0x1d1eb4['cutdigits']?_0xbf0d('0x13')+_0x1d1eb4['cutdigits']+'}':_0xbf0d('0x14')),'context':_0x1d1eb4[_0xbf0d('0x6')],'exten':_0x1d1eb4[_0xbf0d('0xe')],'priority':_0x523802++,'VoiceExtensionId':_0x1d1eb4['id']},{'type':_0xbf0d('0x11'),'app':_0xbf0d('0x3'),'appdata':_0xbf0d('0xd')+_0x1d1eb4['id'],'context':_0x1d1eb4[_0xbf0d('0x6')],'exten':_0x1d1eb4[_0xbf0d('0xe')],'priority':_0x523802++,'VoiceExtensionId':_0x1d1eb4['id']},{'type':_0xbf0d('0x11'),'app':_0xbf0d('0x15'),'appdata':_0xbf0d('0x16')+(_0x523802+0x2)+_0xbf0d('0x17')+(_0x523802+0x1)+')','context':_0x1d1eb4[_0xbf0d('0x6')],'exten':_0x1d1eb4[_0xbf0d('0xe')],'priority':_0x523802++,'VoiceExtensionId':_0x1d1eb4['id']},{'type':_0xbf0d('0x11'),'app':_0xbf0d('0x3'),'appdata':_0x1d1eb4[_0xbf0d('0x18')]?_0xbf0d('0x19')+_0x1d1eb4[_0xbf0d('0x18')]+'}':'CDR(prefix)=noprefix','context':_0x1d1eb4[_0xbf0d('0x6')],'exten':_0x1d1eb4['exten'],'priority':_0x523802++,'VoiceExtensionId':_0x1d1eb4['id']},{'type':_0xbf0d('0x11'),'app':_0xbf0d('0x3'),'appdata':_0xbf0d('0x1a'),'context':_0x1d1eb4[_0xbf0d('0x6')],'exten':_0x1d1eb4[_0xbf0d('0xe')],'priority':_0x523802++,'VoiceExtensionId':_0x1d1eb4['id']},{'type':_0xbf0d('0x11'),'app':_0xbf0d('0x3'),'appdata':_0xbf0d('0xf'),'context':_0x1d1eb4['context'],'exten':_0x1d1eb4['exten'],'priority':_0x523802++,'VoiceExtensionId':_0x1d1eb4['id']},{'type':_0xbf0d('0x11'),'app':_0xbf0d('0x3'),'appdata':'MONITOR_OPTIONS=ab','context':_0x1d1eb4[_0xbf0d('0x6')],'exten':_0x1d1eb4['exten'],'priority':_0x523802++,'VoiceExtensionId':_0x1d1eb4['id']},{'type':'outbound','app':_0xbf0d('0x3'),'appdata':_0xbf0d('0x1b')+_0x1d1eb4['id'],'context':_0x1d1eb4[_0xbf0d('0x6')],'exten':_0x1d1eb4['exten'],'priority':_0x523802++,'VoiceExtensionId':_0x1d1eb4['id']}];if(_0x1d1eb4[_0xbf0d('0x1c')](_0xbf0d('0x1d'))&&_0x1d1eb4[_0xbf0d('0x1d')]!==_0xbf0d('0x1e')){_0x11a5f1[_0xbf0d('0xc')]({'type':_0xbf0d('0x11'),'app':_0xbf0d('0x3'),'appdata':_0xbf0d('0x1f'),'context':_0x1d1eb4['context'],'exten':_0x1d1eb4['exten'],'priority':_0x523802++,'VoiceExtensionId':_0x1d1eb4['id']},{'type':_0xbf0d('0x11'),'app':'Set','appdata':_0xbf0d('0x20')+_0x1d1eb4[_0xbf0d('0x1d')]||_0xbf0d('0x21'),'context':_0x1d1eb4[_0xbf0d('0x6')],'exten':_0x1d1eb4[_0xbf0d('0xe')],'priority':_0x523802++,'VoiceExtensionId':_0x1d1eb4['id']});}return _0x11a5f1;}function _0x330b37(_0x549692,_0x24586e){var _0x2e5dcf=[{'name':_0xbf0d('0x22'),'param':0x0},{'name':_0xbf0d('0x23'),'param':0x1},{'name':'options','param':0x2},{'name':_0xbf0d('0x24'),'param':0x3}];var _0x4b0ee9={};var _0x3faf27=_0x24586e[_0xbf0d('0x25')](',');var _0x1ed208=[];for(var _0x20cd8c=0x0;_0x20cd8c<_0x2e5dcf[_0xbf0d('0x26')];_0x20cd8c++){switch(_0x2e5dcf[_0x20cd8c]['name']){case _0xbf0d('0x22'):_0x4b0ee9[_0xbf0d('0x22')]=_0x3faf27[_0x2e5dcf[_0x20cd8c]['param']][_0xbf0d('0x25')]('/')[0x1];_0x4b0ee9['phone']=_0x3faf27[_0x2e5dcf[_0x20cd8c]['param']][_0xbf0d('0x25')]('/')[0x2];_0x4b0ee9[_0xbf0d('0x27')]=_0x4b0ee9['phone']?_0x4b0ee9[_0xbf0d('0x28')]['split']('$')[0x0]:undefined;_0x4b0ee9[_0xbf0d('0x28')]=_0x549692['cutdigits']?(_0x4b0ee9[_0xbf0d('0x27')]||'')+_0xbf0d('0x13')+_0x549692[_0xbf0d('0x18')]+'}':(_0x4b0ee9[_0xbf0d('0x27')]||'')+'${EXTEN}';_0x1ed208[_0x2e5dcf[_0x20cd8c][_0xbf0d('0x29')]]=[_0xbf0d('0x2a'),_0x4b0ee9['trunk'],_0x4b0ee9[_0xbf0d('0x28')]][_0xbf0d('0x2b')]('/');break;case _0xbf0d('0x2c'):_0x4b0ee9[_0xbf0d('0x2c')]=_0x3faf27[_0x2e5dcf[_0x20cd8c]['param']];if(_0x549692[_0xbf0d('0x1d')]!==_0xbf0d('0x1e')){if(_0x4b0ee9[_0xbf0d('0x2c')][_0xbf0d('0x2d')](_0xbf0d('0x2e'))<0x0){_0x4b0ee9[_0xbf0d('0x2c')]+=_0xbf0d('0x2e');}}else{_0x4b0ee9[_0xbf0d('0x2c')]=_0x4b0ee9['options'][_0xbf0d('0x2f')](_0xbf0d('0x2e'),'');}_0x1ed208[_0x2e5dcf[_0x20cd8c][_0xbf0d('0x29')]]=_0x4b0ee9[_0xbf0d('0x2c')];break;default:_0x1ed208[_0x2e5dcf[_0x20cd8c]['param']]=_0x3faf27[_0x2e5dcf[_0x20cd8c][_0xbf0d('0x29')]];}}return _0x1ed208['join'](',');}function _0x271bcf(_0x1aade1,_0x30d96e,_0x2d5193){return new Promise(function(_0x13a39e,_0x55a8d7){var _0x10261a=[];if(_['isEmpty'](_0x30d96e))return _0x13a39e(_0x10261a);_0x1a6fea[_0xbf0d('0x30')][_0xbf0d('0x31')]({'attributes':['id',_0xbf0d('0x32'),_0xbf0d('0x33')],'raw':!![]})[_0xbf0d('0x34')](function(_0x4997b7){for(var _0x31b8d0=0x0,_0x19c446=0x0;_0x31b8d0<_0x30d96e['length'];_0x31b8d0++,_0x19c446=0x0){var _0x3aefd8=_0x30d96e[_0x31b8d0];var _0x530b2d=[];var _0x2bcbc9=[];delete _0x3aefd8['id'];if(_0x3aefd8['interval']!==_0xbf0d('0x35')){_0x3aefd8[_0xbf0d('0x36')]=[_0x3aefd8['interval']];}else{_0x3aefd8[_0xbf0d('0x36')]=_0x3aefd8[_0xbf0d('0x33')]?_[_0xbf0d('0x37')](_[_0xbf0d('0x38')](_0x4997b7,{'IntervalId':_0x3aefd8[_0xbf0d('0x33')]}),'interval'):[];}_0x3aefd8[_0xbf0d('0x6')]=_0x1aade1['context'];_0x3aefd8['exten']=_0x1aade1['exten'];if(_0x3aefd8[_0xbf0d('0x5')])_0x3aefd8['type']=_0x3aefd8[_0xbf0d('0x5')][_0xbf0d('0x39')]();if(_0x1aade1[_0xbf0d('0x5')]===_0xbf0d('0x11')){if(_0x3aefd8[_0xbf0d('0x1c')](_0xbf0d('0x3a'))&&_0x3aefd8[_0xbf0d('0x3a')]&&_0x3aefd8[_0xbf0d('0x3a')]!=='--'){_0x530b2d[_0xbf0d('0xc')]({'type':_0x3aefd8[_0xbf0d('0x5')][_0xbf0d('0x39')](),'app':_0xbf0d('0x3'),'appdata':_0xbf0d('0x3b')+_0x3aefd8[_0xbf0d('0x3a')],'context':_0x1aade1['context'],'exten':_0x1aade1[_0xbf0d('0xe')],'priority':_0x3aefd8[_0xbf0d('0x36')][_0xbf0d('0x26')]+_0x2d5193+_0x19c446++,'VoiceExtensionId':_0x1aade1['id']});}_0x530b2d[_0xbf0d('0xc')]({'type':_0x3aefd8['type'][_0xbf0d('0x39')](),'app':_0xbf0d('0x15'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x3aefd8[_0xbf0d('0x3c')]?'Set(CALLERID(all)='+_0x3aefd8[_0xbf0d('0x3c')]+')':'NoOp(No\x20number\x20available)'),'context':_0x1aade1['context'],'exten':_0x1aade1[_0xbf0d('0xe')],'priority':_0x3aefd8[_0xbf0d('0x36')]['length']+_0x2d5193+_0x19c446++,'VoiceExtensionId':_0x1aade1['id']});}else{if(_0x3aefd8[_0xbf0d('0x1c')]('answer')){if([_0xbf0d('0x3d'),_0xbf0d('0x3e')]['includes'](_0x3aefd8[_0xbf0d('0x3f')][_0xbf0d('0x39')]())&&_0x3aefd8[_0xbf0d('0x40')]!=='custom'){if(_0x3aefd8['answer']){_0x530b2d[_0xbf0d('0xc')]({'type':_0x3aefd8[_0xbf0d('0x5')][_0xbf0d('0x39')](),'app':'ExecIf','appdata':_0xbf0d('0x41'),'context':_0x1aade1[_0xbf0d('0x6')],'exten':_0x1aade1['exten'],'priority':_0x3aefd8[_0xbf0d('0x36')][_0xbf0d('0x26')]+_0x2d5193+_0x19c446++,'VoiceExtensionId':_0x1aade1['id']});_0x530b2d[_0xbf0d('0xc')]({'type':_0x3aefd8[_0xbf0d('0x5')]['toLowerCase'](),'app':'Set','appdata':_0xbf0d('0x42'),'context':_0x1aade1[_0xbf0d('0x6')],'exten':_0x1aade1[_0xbf0d('0xe')],'priority':_0x3aefd8[_0xbf0d('0x36')][_0xbf0d('0x26')]+_0x2d5193+_0x19c446++,'VoiceExtensionId':_0x1aade1['id']});}else{_0x530b2d['push']({'type':_0x3aefd8[_0xbf0d('0x5')][_0xbf0d('0x39')](),'app':'ExecIf','appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x1aade1['context'],'exten':_0x1aade1[_0xbf0d('0xe')],'priority':_0x3aefd8[_0xbf0d('0x36')][_0xbf0d('0x26')]+_0x2d5193+_0x19c446++,'VoiceExtensionId':_0x1aade1['id']});_0x530b2d[_0xbf0d('0xc')]({'type':_0x3aefd8['type'][_0xbf0d('0x39')](),'app':_0xbf0d('0x3'),'appdata':_0xbf0d('0x43'),'context':_0x1aade1[_0xbf0d('0x6')],'exten':_0x1aade1[_0xbf0d('0xe')],'priority':_0x3aefd8[_0xbf0d('0x36')]['length']+_0x2d5193+_0x19c446++,'VoiceExtensionId':_0x1aade1['id']});}}}}for(var _0x52f5ca=0x0;_0x52f5ca<_0x3aefd8['intervals'][_0xbf0d('0x26')];_0x52f5ca++){var _0x345cde=_0x2d5193+_0x3aefd8[_0xbf0d('0x36')][_0xbf0d('0x26')];var _0x4f1002=_0x52f5ca===_0x3aefd8[_0xbf0d('0x36')][_0xbf0d('0x26')]-0x1?_0x2d5193+_0x530b2d[_0xbf0d('0x26')]+_0x2bcbc9[_0xbf0d('0x26')]+0x2:_0x2d5193+_0x52f5ca+0x1;_0x530b2d['splice'](_0x52f5ca,0x0,{'type':_0x1aade1[_0xbf0d('0x5')],'app':'GotoIfTime','appdata':_0x3aefd8[_0xbf0d('0x36')][_0x52f5ca]+'?'+_0x1aade1['context']+_0xbf0d('0x44')+_0x345cde+':'+_0x1aade1[_0xbf0d('0x6')]+_0xbf0d('0x44')+_0x4f1002,'exten':_0x1aade1['exten'],'context':_0x1aade1[_0xbf0d('0x6')],'priority':_0x2d5193+_0x52f5ca,'VoiceExtensionId':_0x1aade1['id']});}if(_0x3aefd8[_0xbf0d('0x40')]===_0xbf0d('0x45'))_0x3aefd8[_0xbf0d('0x46')]=_0x330b37(_0x1aade1,_0x3aefd8['appdata']);_0x3aefd8[_0xbf0d('0x47')]=_0x530b2d[_0xbf0d('0x26')]?_[_0xbf0d('0x48')](_0x530b2d)[_0xbf0d('0x47')]+0x1:_0x2d5193;_0x10261a=_['concat'](_0x10261a,_0x530b2d,[_0x3aefd8],_0x2bcbc9);_0x2d5193=_[_0xbf0d('0x48')](_0x10261a)[_0xbf0d('0x47')]+0x1;}return _0x13a39e(_0x10261a);})[_0xbf0d('0x49')](function(_0x1128b9){_0x55a8d7(_0x1128b9);});});}return _0x138814[_0xbf0d('0x4a')](_0xbf0d('0x4b'),attributes,{'tableName':_0xbf0d('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0xbd0fd8){var _0x204570=this[_0xbf0d('0x4d')]({'plain':!![]});var _0x4e8da9=_0x204570[_0xbf0d('0x5')]===_0xbf0d('0x11')?_0x474ac2(_0x204570):_0x5db968(_0x204570);return _0x271bcf(_0x204570,_0xbd0fd8,_['last'](_0x4e8da9)[_0xbf0d('0x47')]+0x1)[_0xbf0d('0x34')](function(_0x277046){var _0x35f2af=_['concat'](_0x4e8da9,_0x277046);_0x35f2af[_0xbf0d('0xc')]({'type':_0x204570[_0xbf0d('0x5')],'app':'Hangup','exten':_0x204570[_0xbf0d('0xe')],'context':_0x204570[_0xbf0d('0x6')],'priority':_['last'](_0x35f2af)['priority']+0x1,'VoiceExtensionId':_0x204570['id']});return _0x35f2af;});}}});}; \ No newline at end of file +var _0x4ddd=['concat','last','define','voice_extensions','Hangup','lodash','Set','CDR(type)=','type','context','exten','alias','NoOp','No\x20alias\x20set','push','CDR(routeid)=','outbound','CDR(type)=outbound','CDR(routeAlias)=','CDR(destination)=','${EXTEN:','cutdigits','${EXTEN}','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','XCALLY-MOTION-PROGRESS=0','MONITOR_OPTIONS=ab','outboundrouteid=','hasOwnProperty','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','recordingFormat','wav','timeout','options','split','name','trunk','param','phone','prefix','join','indexOf','U(xcally-mixmonitor-context)','replace','interval','IntervalId','then','*,*,*,*','intervals','map','filter','toLowerCase','CDR(tag)=','tag','length','ExecIf','Set(CALLERID(all)=','callerID','NoOp(No\x20number\x20available)','queue','playback','includes','app','custom','answer','$[${XCALLY-MOTION-ANSWER}=0]?Answer','XCALLY-MOTION-ANSWER=1','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','appType','outboundDial','appdata','priority'];(function(_0x5633d5,_0xfeff9b){var _0x50946a=function(_0x5dfdd1){while(--_0x5dfdd1){_0x5633d5['push'](_0x5633d5['shift']());}};_0x50946a(++_0xfeff9b);}(_0x4ddd,0x18b));var _0xd4dd=function(_0xea8947,_0x1b573d){_0xea8947=_0xea8947-0x0;var _0x2455e9=_0x4ddd[_0xea8947];return _0x2455e9;};'use strict';var _=require(_0xd4dd('0x0'));var attributes=require('./voiceExtension.attributes');module['exports']=function(_0x525f35){var _0x4f93da=_0x525f35['models'];function _0x5d38a5(_0x46294b){var _0x3e1e87=0x2;var _0x21f85d=[{'type':_0x46294b['type'],'app':_0xd4dd('0x1'),'appdata':_0xd4dd('0x2')+_0x46294b[_0xd4dd('0x3')],'context':_0x46294b[_0xd4dd('0x4')],'exten':_0x46294b[_0xd4dd('0x5')],'priority':_0x3e1e87++,'VoiceExtensionId':_0x46294b['id']},{'type':_0x46294b[_0xd4dd('0x3')],'app':_0x46294b[_0xd4dd('0x6')]?'Set':_0xd4dd('0x7'),'appdata':_0x46294b[_0xd4dd('0x6')]?'CDR(routeAlias)='+_0x46294b[_0xd4dd('0x6')]:_0xd4dd('0x8'),'context':_0x46294b[_0xd4dd('0x4')],'exten':_0x46294b[_0xd4dd('0x5')],'priority':_0x3e1e87++,'VoiceExtensionId':_0x46294b['id']}];if(_0x46294b['type']==='inbound'){_0x21f85d[_0xd4dd('0x9')]({'type':'inbound','app':_0xd4dd('0x1'),'appdata':_0xd4dd('0xa')+_0x46294b['id'],'context':_0x46294b[_0xd4dd('0x4')],'exten':_0x46294b[_0xd4dd('0x5')],'priority':_0x3e1e87++,'VoiceExtensionId':_0x46294b['id']});}_0x21f85d[_0xd4dd('0x9')]({'type':_0x46294b[_0xd4dd('0x3')],'app':_0xd4dd('0x1'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x46294b[_0xd4dd('0x4')],'exten':_0x46294b[_0xd4dd('0x5')],'priority':_0x3e1e87++,'VoiceExtensionId':_0x46294b['id']},{'type':_0x46294b[_0xd4dd('0x3')],'app':_0xd4dd('0x1'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x46294b[_0xd4dd('0x4')],'exten':_0x46294b[_0xd4dd('0x5')],'priority':_0x3e1e87++,'VoiceExtensionId':_0x46294b['id']},{'type':_0x46294b[_0xd4dd('0x3')],'app':_0xd4dd('0x1'),'appdata':'MONITOR_OPTIONS=ab','context':_0x46294b[_0xd4dd('0x4')],'exten':_0x46294b[_0xd4dd('0x5')],'priority':_0x3e1e87++,'VoiceExtensionId':_0x46294b['id']});return _0x21f85d;}function _0x35b901(_0x26ff21){var _0x133b69=0x2;var _0xfaf9ce=[{'type':_0xd4dd('0xb'),'app':_0xd4dd('0x1'),'appdata':_0xd4dd('0xc'),'context':_0x26ff21['context'],'exten':_0x26ff21[_0xd4dd('0x5')],'priority':_0x133b69++,'VoiceExtensionId':_0x26ff21['id']},{'type':_0xd4dd('0xb'),'app':_0x26ff21[_0xd4dd('0x6')]?_0xd4dd('0x1'):_0xd4dd('0x7'),'appdata':_0x26ff21[_0xd4dd('0x6')]?_0xd4dd('0xd')+_0x26ff21['alias']:_0xd4dd('0x8'),'context':_0x26ff21[_0xd4dd('0x4')],'exten':_0x26ff21[_0xd4dd('0x5')],'priority':_0x133b69++,'VoiceExtensionId':_0x26ff21['id']},{'type':_0xd4dd('0xb'),'app':'Set','appdata':_0xd4dd('0xe')+(_0x26ff21['cutdigits']?_0xd4dd('0xf')+_0x26ff21[_0xd4dd('0x10')]+'}':_0xd4dd('0x11')),'context':_0x26ff21[_0xd4dd('0x4')],'exten':_0x26ff21[_0xd4dd('0x5')],'priority':_0x133b69++,'VoiceExtensionId':_0x26ff21['id']},{'type':'outbound','app':_0xd4dd('0x1'),'appdata':_0xd4dd('0xa')+_0x26ff21['id'],'context':_0x26ff21[_0xd4dd('0x4')],'exten':_0x26ff21[_0xd4dd('0x5')],'priority':_0x133b69++,'VoiceExtensionId':_0x26ff21['id']},{'type':_0xd4dd('0xb'),'app':'ExecIf','appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x133b69+0x2)+_0xd4dd('0x12')+(_0x133b69+0x1)+')','context':_0x26ff21[_0xd4dd('0x4')],'exten':_0x26ff21['exten'],'priority':_0x133b69++,'VoiceExtensionId':_0x26ff21['id']},{'type':_0xd4dd('0xb'),'app':_0xd4dd('0x1'),'appdata':_0x26ff21[_0xd4dd('0x10')]?_0xd4dd('0x13')+_0x26ff21['cutdigits']+'}':_0xd4dd('0x14'),'context':_0x26ff21[_0xd4dd('0x4')],'exten':_0x26ff21['exten'],'priority':_0x133b69++,'VoiceExtensionId':_0x26ff21['id']},{'type':_0xd4dd('0xb'),'app':_0xd4dd('0x1'),'appdata':'XCALLY-MOTION-ANSWER=0','context':_0x26ff21[_0xd4dd('0x4')],'exten':_0x26ff21[_0xd4dd('0x5')],'priority':_0x133b69++,'VoiceExtensionId':_0x26ff21['id']},{'type':_0xd4dd('0xb'),'app':_0xd4dd('0x1'),'appdata':_0xd4dd('0x15'),'context':_0x26ff21[_0xd4dd('0x4')],'exten':_0x26ff21[_0xd4dd('0x5')],'priority':_0x133b69++,'VoiceExtensionId':_0x26ff21['id']},{'type':_0xd4dd('0xb'),'app':_0xd4dd('0x1'),'appdata':_0xd4dd('0x16'),'context':_0x26ff21['context'],'exten':_0x26ff21[_0xd4dd('0x5')],'priority':_0x133b69++,'VoiceExtensionId':_0x26ff21['id']},{'type':'outbound','app':_0xd4dd('0x1'),'appdata':_0xd4dd('0x17')+_0x26ff21['id'],'context':_0x26ff21[_0xd4dd('0x4')],'exten':_0x26ff21[_0xd4dd('0x5')],'priority':_0x133b69++,'VoiceExtensionId':_0x26ff21['id']}];if(_0x26ff21[_0xd4dd('0x18')]('recordingFormat')&&_0x26ff21['recordingFormat']!==_0xd4dd('0x19')){_0xfaf9ce['push']({'type':'outbound','app':_0xd4dd('0x1'),'appdata':_0xd4dd('0x1a'),'context':_0x26ff21[_0xd4dd('0x4')],'exten':_0x26ff21[_0xd4dd('0x5')],'priority':_0x133b69++,'VoiceExtensionId':_0x26ff21['id']},{'type':'outbound','app':_0xd4dd('0x1'),'appdata':_0xd4dd('0x1b')+_0x26ff21[_0xd4dd('0x1c')]||_0xd4dd('0x1d'),'context':_0x26ff21[_0xd4dd('0x4')],'exten':_0x26ff21['exten'],'priority':_0x133b69++,'VoiceExtensionId':_0x26ff21['id']});}return _0xfaf9ce;}function _0x27f8f8(_0x11a8da,_0x2bc0c7){var _0xe4a810=[{'name':'trunk','param':0x0},{'name':_0xd4dd('0x1e'),'param':0x1},{'name':_0xd4dd('0x1f'),'param':0x2},{'name':'url','param':0x3}];var _0x10ec97={};var _0x205197=_0x2bc0c7[_0xd4dd('0x20')](',');var _0x1063a8=[];for(var _0x79ff1e=0x0;_0x79ff1e<_0xe4a810['length'];_0x79ff1e++){switch(_0xe4a810[_0x79ff1e][_0xd4dd('0x21')]){case _0xd4dd('0x22'):_0x10ec97[_0xd4dd('0x22')]=_0x205197[_0xe4a810[_0x79ff1e][_0xd4dd('0x23')]]['split']('/')[0x1];_0x10ec97[_0xd4dd('0x24')]=_0x205197[_0xe4a810[_0x79ff1e]['param']][_0xd4dd('0x20')]('/')[0x2];_0x10ec97[_0xd4dd('0x25')]=_0x10ec97[_0xd4dd('0x24')]?_0x10ec97['phone'][_0xd4dd('0x20')]('$')[0x0]:undefined;_0x10ec97['phone']=_0x11a8da['cutdigits']?(_0x10ec97['prefix']||'')+_0xd4dd('0xf')+_0x11a8da[_0xd4dd('0x10')]+'}':(_0x10ec97[_0xd4dd('0x25')]||'')+'${EXTEN}';_0x1063a8[_0xe4a810[_0x79ff1e]['param']]=['SIP',_0x10ec97[_0xd4dd('0x22')],_0x10ec97[_0xd4dd('0x24')]][_0xd4dd('0x26')]('/');break;case _0xd4dd('0x1f'):_0x10ec97[_0xd4dd('0x1f')]=_0x205197[_0xe4a810[_0x79ff1e][_0xd4dd('0x23')]];if(_0x11a8da[_0xd4dd('0x1c')]!==_0xd4dd('0x19')){if(_0x10ec97[_0xd4dd('0x1f')][_0xd4dd('0x27')](_0xd4dd('0x28'))<0x0){_0x10ec97[_0xd4dd('0x1f')]+=_0xd4dd('0x28');}}else{_0x10ec97[_0xd4dd('0x1f')]=_0x10ec97['options'][_0xd4dd('0x29')]('U(xcally-mixmonitor-context)','');}_0x1063a8[_0xe4a810[_0x79ff1e][_0xd4dd('0x23')]]=_0x10ec97[_0xd4dd('0x1f')];break;default:_0x1063a8[_0xe4a810[_0x79ff1e][_0xd4dd('0x23')]]=_0x205197[_0xe4a810[_0x79ff1e]['param']];}}return _0x1063a8[_0xd4dd('0x26')](',');}function _0x18e4fa(_0x292388,_0xc892c8,_0x36b70b){return new Promise(function(_0x1282c2,_0x4b559d){var _0x3e9ede=[];if(_['isEmpty'](_0xc892c8))return _0x1282c2(_0x3e9ede);_0x4f93da['Interval']['findAll']({'attributes':['id',_0xd4dd('0x2a'),_0xd4dd('0x2b')],'raw':!![]})[_0xd4dd('0x2c')](function(_0x4a7225){for(var _0x51a7ad=0x0,_0x2e8c73=0x0;_0x51a7ad<_0xc892c8['length'];_0x51a7ad++,_0x2e8c73=0x0){var _0x282b8f=_0xc892c8[_0x51a7ad];var _0x228b90=[];var _0x148d2b=[];delete _0x282b8f['id'];if(_0x282b8f[_0xd4dd('0x2a')]!==_0xd4dd('0x2d')){_0x282b8f[_0xd4dd('0x2e')]=[_0x282b8f[_0xd4dd('0x2a')]];}else{_0x282b8f['intervals']=_0x282b8f[_0xd4dd('0x2b')]?_[_0xd4dd('0x2f')](_[_0xd4dd('0x30')](_0x4a7225,{'IntervalId':_0x282b8f[_0xd4dd('0x2b')]}),'interval'):[];}_0x282b8f[_0xd4dd('0x4')]=_0x292388[_0xd4dd('0x4')];_0x282b8f[_0xd4dd('0x5')]=_0x292388[_0xd4dd('0x5')];if(_0x282b8f[_0xd4dd('0x3')])_0x282b8f[_0xd4dd('0x3')]=_0x282b8f[_0xd4dd('0x3')]['toLowerCase']();if(_0x292388[_0xd4dd('0x3')]===_0xd4dd('0xb')){if(_0x282b8f[_0xd4dd('0x18')]('tag')&&_0x282b8f['tag']&&_0x282b8f['tag']!=='--'){_0x228b90[_0xd4dd('0x9')]({'type':_0x282b8f[_0xd4dd('0x3')][_0xd4dd('0x31')](),'app':_0xd4dd('0x1'),'appdata':_0xd4dd('0x32')+_0x282b8f[_0xd4dd('0x33')],'context':_0x292388['context'],'exten':_0x292388[_0xd4dd('0x5')],'priority':_0x282b8f[_0xd4dd('0x2e')][_0xd4dd('0x34')]+_0x36b70b+_0x2e8c73++,'VoiceExtensionId':_0x292388['id']});}_0x228b90[_0xd4dd('0x9')]({'type':_0x282b8f[_0xd4dd('0x3')][_0xd4dd('0x31')](),'app':_0xd4dd('0x35'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):'+(_0x282b8f['callerID']?_0xd4dd('0x36')+_0x282b8f[_0xd4dd('0x37')]+')':_0xd4dd('0x38')),'context':_0x292388[_0xd4dd('0x4')],'exten':_0x292388[_0xd4dd('0x5')],'priority':_0x282b8f['intervals'][_0xd4dd('0x34')]+_0x36b70b+_0x2e8c73++,'VoiceExtensionId':_0x292388['id']});}else{if(_0x282b8f[_0xd4dd('0x18')]('answer')){if([_0xd4dd('0x39'),_0xd4dd('0x3a')][_0xd4dd('0x3b')](_0x282b8f[_0xd4dd('0x3c')][_0xd4dd('0x31')]())&&_0x282b8f['appType']!==_0xd4dd('0x3d')){if(_0x282b8f[_0xd4dd('0x3e')]){_0x228b90['push']({'type':_0x282b8f[_0xd4dd('0x3')][_0xd4dd('0x31')](),'app':_0xd4dd('0x35'),'appdata':_0xd4dd('0x3f'),'context':_0x292388['context'],'exten':_0x292388[_0xd4dd('0x5')],'priority':_0x282b8f[_0xd4dd('0x2e')]['length']+_0x36b70b+_0x2e8c73++,'VoiceExtensionId':_0x292388['id']});_0x228b90[_0xd4dd('0x9')]({'type':_0x282b8f[_0xd4dd('0x3')][_0xd4dd('0x31')](),'app':_0xd4dd('0x1'),'appdata':_0xd4dd('0x40'),'context':_0x292388['context'],'exten':_0x292388[_0xd4dd('0x5')],'priority':_0x282b8f[_0xd4dd('0x2e')][_0xd4dd('0x34')]+_0x36b70b+_0x2e8c73++,'VoiceExtensionId':_0x292388['id']});}else{_0x228b90[_0xd4dd('0x9')]({'type':_0x282b8f[_0xd4dd('0x3')][_0xd4dd('0x31')](),'app':_0xd4dd('0x35'),'appdata':'$[${XCALLY-MOTION-PROGRESS}=0]?Progress','context':_0x292388[_0xd4dd('0x4')],'exten':_0x292388[_0xd4dd('0x5')],'priority':_0x282b8f[_0xd4dd('0x2e')][_0xd4dd('0x34')]+_0x36b70b+_0x2e8c73++,'VoiceExtensionId':_0x292388['id']});_0x228b90['push']({'type':_0x282b8f[_0xd4dd('0x3')][_0xd4dd('0x31')](),'app':_0xd4dd('0x1'),'appdata':_0xd4dd('0x41'),'context':_0x292388[_0xd4dd('0x4')],'exten':_0x292388['exten'],'priority':_0x282b8f[_0xd4dd('0x2e')][_0xd4dd('0x34')]+_0x36b70b+_0x2e8c73++,'VoiceExtensionId':_0x292388['id']});}}}}for(var _0x48b894=0x0;_0x48b894<_0x282b8f[_0xd4dd('0x2e')][_0xd4dd('0x34')];_0x48b894++){var _0x49fed5=_0x36b70b+_0x282b8f[_0xd4dd('0x2e')][_0xd4dd('0x34')];var _0x5c8c38=_0x48b894===_0x282b8f[_0xd4dd('0x2e')]['length']-0x1?_0x36b70b+_0x228b90['length']+_0x148d2b['length']+0x2:_0x36b70b+_0x48b894+0x1;_0x228b90[_0xd4dd('0x42')](_0x48b894,0x0,{'type':_0x292388[_0xd4dd('0x3')],'app':_0xd4dd('0x43'),'appdata':_0x282b8f[_0xd4dd('0x2e')][_0x48b894]+'?'+_0x292388[_0xd4dd('0x4')]+_0xd4dd('0x44')+_0x49fed5+':'+_0x292388[_0xd4dd('0x4')]+_0xd4dd('0x44')+_0x5c8c38,'exten':_0x292388[_0xd4dd('0x5')],'context':_0x292388[_0xd4dd('0x4')],'priority':_0x36b70b+_0x48b894,'VoiceExtensionId':_0x292388['id']});}if(_0x282b8f[_0xd4dd('0x45')]===_0xd4dd('0x46'))_0x282b8f['appdata']=_0x27f8f8(_0x292388,_0x282b8f[_0xd4dd('0x47')]);_0x282b8f[_0xd4dd('0x48')]=_0x228b90['length']?_['last'](_0x228b90)[_0xd4dd('0x48')]+0x1:_0x36b70b;_0x3e9ede=_[_0xd4dd('0x49')](_0x3e9ede,_0x228b90,[_0x282b8f],_0x148d2b);_0x36b70b=_[_0xd4dd('0x4a')](_0x3e9ede)[_0xd4dd('0x48')]+0x1;}return _0x1282c2(_0x3e9ede);})['catch'](function(_0x2a2e4f){_0x4b559d(_0x2a2e4f);});});}return _0x525f35[_0xd4dd('0x4b')]('VoiceExtension',attributes,{'tableName':_0xd4dd('0x4c'),'paranoid':![],'indexes':[],'timestamps':!![],'instanceMethods':{'createRouting':function(_0x4377f9){var _0x4891a5=this['get']({'plain':!![]});var _0x57c913=_0x4891a5[_0xd4dd('0x3')]==='outbound'?_0x35b901(_0x4891a5):_0x5d38a5(_0x4891a5);return _0x18e4fa(_0x4891a5,_0x4377f9,_['last'](_0x57c913)['priority']+0x1)[_0xd4dd('0x2c')](function(_0x169c1a){var _0x1f0d1c=_[_0xd4dd('0x49')](_0x57c913,_0x169c1a);_0x1f0d1c['push']({'type':_0x4891a5['type'],'app':_0xd4dd('0x4d'),'exten':_0x4891a5['exten'],'context':_0x4891a5['context'],'priority':_[_0xd4dd('0x4a')](_0x1f0d1c)['priority']+0x1,'VoiceExtensionId':_0x4891a5['id']});return _0x1f0d1c;});}}});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.rpc.js b/server/api/voiceExtension/voiceExtension.rpc.js index f842b6e..b4009c6 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 _0xc677=['attributes','include','map','model','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','client','http','defaults','localhost','redis','./voiceExtension.socket','register','request','then','info','request\x20sent','debug','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','code','error','VoiceExtension,\x20%s,\x20%s','message','result','catch','GetVoiceExtension','VoiceExtension','options','raw','where'];(function(_0x5037ab,_0x43209e){var _0x512adb=function(_0x261783){while(--_0x261783){_0x5037ab['push'](_0x5037ab['shift']());}};_0x512adb(++_0x43209e);}(_0xc677,0x16c));var _0x7c67=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xc677[_0x321bb2];return _0x9c12ed;};'use strict';var _=require('lodash');var util=require(_0x7c67('0x0'));var moment=require(_0x7c67('0x1'));var BPromise=require(_0x7c67('0x2'));var rs=require(_0x7c67('0x3'));var fs=require('fs');var Redis=require(_0x7c67('0x4'));var db=require(_0x7c67('0x5'))['db'];var utils=require(_0x7c67('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x7c67('0x7')][_0x7c67('0x8')]({'port':0x232a});config['redis']=_[_0x7c67('0x9')](config['redis'],{'host':_0x7c67('0xa'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7c67('0xb')]));require(_0x7c67('0xc'))[_0x7c67('0xd')](socket);function respondWithRpcPromise(_0x390de9,_0xc2fc51,_0x12322a){return new BPromise(function(_0x31650d,_0x3e6821){return client[_0x7c67('0xe')](_0x390de9,_0x12322a)[_0x7c67('0xf')](function(_0x36f1d2){logger[_0x7c67('0x10')]('VoiceExtension,\x20%s,\x20%s',_0xc2fc51,_0x7c67('0x11'));logger[_0x7c67('0x12')](_0x7c67('0x13'),_0xc2fc51,'request\x20sent',JSON[_0x7c67('0x14')](_0x36f1d2));if(_0x36f1d2['error']){if(_0x36f1d2['error'][_0x7c67('0x15')]===0x1f4){logger[_0x7c67('0x16')](_0x7c67('0x17'),_0xc2fc51,_0x36f1d2[_0x7c67('0x16')][_0x7c67('0x18')]);return _0x3e6821(_0x36f1d2[_0x7c67('0x16')][_0x7c67('0x18')]);}logger[_0x7c67('0x16')](_0x7c67('0x17'),_0xc2fc51,_0x36f1d2[_0x7c67('0x16')]['message']);return _0x31650d(_0x36f1d2[_0x7c67('0x16')][_0x7c67('0x18')]);}else{logger[_0x7c67('0x10')](_0x7c67('0x17'),_0xc2fc51,_0x7c67('0x11'));_0x31650d(_0x36f1d2[_0x7c67('0x19')][_0x7c67('0x18')]);}})[_0x7c67('0x1a')](function(_0x2ca71e){logger[_0x7c67('0x16')](_0x7c67('0x17'),_0xc2fc51,_0x2ca71e);_0x3e6821(_0x2ca71e);});});}exports[_0x7c67('0x1b')]=function(_0x274a5e){var _0x33dd88=this;return new Promise(function(_0x13cf70,_0x271f4e){return db[_0x7c67('0x1c')]['findAll']({'raw':_0x274a5e[_0x7c67('0x1d')]?_0x274a5e['options'][_0x7c67('0x1e')]===undefined?!![]:![]:!![],'where':_0x274a5e[_0x7c67('0x1d')]?_0x274a5e[_0x7c67('0x1d')][_0x7c67('0x1f')]||null:null,'attributes':_0x274a5e['options']?_0x274a5e['options'][_0x7c67('0x20')]||null:null,'limit':_0x274a5e[_0x7c67('0x1d')]?_0x274a5e[_0x7c67('0x1d')]['limit']||null:null,'include':_0x274a5e['options']?_0x274a5e[_0x7c67('0x1d')][_0x7c67('0x21')]?_[_0x7c67('0x22')](_0x274a5e[_0x7c67('0x1d')][_0x7c67('0x21')],function(_0xf09e83){return{'model':db[_0xf09e83['model']],'as':_0xf09e83['as'],'attributes':_0xf09e83[_0x7c67('0x20')],'include':_0xf09e83[_0x7c67('0x21')]?_['map'](_0xf09e83['include'],function(_0x4c4b51){return{'model':db[_0x4c4b51['model']],'as':_0x4c4b51['as'],'attributes':_0x4c4b51[_0x7c67('0x20')],'include':_0x4c4b51['include']?_[_0x7c67('0x22')](_0x4c4b51[_0x7c67('0x21')],function(_0x2d67d5){return{'model':db[_0x2d67d5[_0x7c67('0x23')]],'as':_0x2d67d5['as'],'attributes':_0x2d67d5[_0x7c67('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x20e77c){logger[_0x7c67('0x10')](_0x7c67('0x1b'),_0x274a5e);logger['debug'](_0x7c67('0x1b'),_0x274a5e,JSON[_0x7c67('0x14')](_0x20e77c));_0x13cf70(_0x20e77c);})['catch'](function(_0x322d21){logger[_0x7c67('0x16')]('GetVoiceExtension',_0x322d21['message'],_0x274a5e);_0x271f4e(_0x33dd88[_0x7c67('0x16')](0x1f4,_0x322d21[_0x7c67('0x18')]));});});}; \ No newline at end of file +var _0x8403=['info','VoiceExtension,\x20%s,\x20%s','request\x20sent','VoiceExtension,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','GetVoiceExtension','VoiceExtension','findAll','options','raw','where','attributes','limit','include','map','model','debug','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','defaults','socket.io-emitter','./voiceExtension.socket','request','then'];(function(_0x28ef86,_0x27c6f1){var _0x48a4f6=function(_0x5a13ba){while(--_0x5a13ba){_0x28ef86['push'](_0x28ef86['shift']());}};_0x48a4f6(++_0x27c6f1);}(_0x8403,0x1a5));var _0x3840=function(_0x4ab1d7,_0x53cfef){_0x4ab1d7=_0x4ab1d7-0x0;var _0x501556=_0x8403[_0x4ab1d7];return _0x501556;};'use strict';var _=require(_0x3840('0x0'));var util=require(_0x3840('0x1'));var moment=require(_0x3840('0x2'));var BPromise=require(_0x3840('0x3'));var rs=require(_0x3840('0x4'));var fs=require('fs');var Redis=require(_0x3840('0x5'));var db=require(_0x3840('0x6'))['db'];var utils=require(_0x3840('0x7'));var logger=require(_0x3840('0x8'))('rpc');var config=require(_0x3840('0x9'));var jayson=require(_0x3840('0xa'));var client=jayson[_0x3840('0xb')][_0x3840('0xc')]({'port':0x232a});config[_0x3840('0xd')]=_[_0x3840('0xe')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x3840('0xf'))(new Redis(config[_0x3840('0xd')]));require(_0x3840('0x10'))['register'](socket);function respondWithRpcPromise(_0x485084,_0x30ba1a,_0x3d2002){return new BPromise(function(_0x24da73,_0x129b36){return client[_0x3840('0x11')](_0x485084,_0x3d2002)[_0x3840('0x12')](function(_0x11b330){logger[_0x3840('0x13')](_0x3840('0x14'),_0x30ba1a,_0x3840('0x15'));logger['debug'](_0x3840('0x16'),_0x30ba1a,_0x3840('0x15'),JSON[_0x3840('0x17')](_0x11b330));if(_0x11b330['error']){if(_0x11b330[_0x3840('0x18')][_0x3840('0x19')]===0x1f4){logger['error'](_0x3840('0x14'),_0x30ba1a,_0x11b330[_0x3840('0x18')][_0x3840('0x1a')]);return _0x129b36(_0x11b330[_0x3840('0x18')][_0x3840('0x1a')]);}logger[_0x3840('0x18')](_0x3840('0x14'),_0x30ba1a,_0x11b330[_0x3840('0x18')][_0x3840('0x1a')]);return _0x24da73(_0x11b330[_0x3840('0x18')][_0x3840('0x1a')]);}else{logger['info']('VoiceExtension,\x20%s,\x20%s',_0x30ba1a,_0x3840('0x15'));_0x24da73(_0x11b330['result'][_0x3840('0x1a')]);}})[_0x3840('0x1b')](function(_0x4a6f6e){logger['error'](_0x3840('0x14'),_0x30ba1a,_0x4a6f6e);_0x129b36(_0x4a6f6e);});});}exports[_0x3840('0x1c')]=function(_0x3933d8){var _0x58312e=this;return new Promise(function(_0xabe79d,_0xd03d51){return db[_0x3840('0x1d')][_0x3840('0x1e')]({'raw':_0x3933d8[_0x3840('0x1f')]?_0x3933d8['options'][_0x3840('0x20')]===undefined?!![]:![]:!![],'where':_0x3933d8[_0x3840('0x1f')]?_0x3933d8['options'][_0x3840('0x21')]||null:null,'attributes':_0x3933d8[_0x3840('0x1f')]?_0x3933d8[_0x3840('0x1f')][_0x3840('0x22')]||null:null,'limit':_0x3933d8[_0x3840('0x1f')]?_0x3933d8[_0x3840('0x1f')][_0x3840('0x23')]||null:null,'include':_0x3933d8['options']?_0x3933d8[_0x3840('0x1f')][_0x3840('0x24')]?_[_0x3840('0x25')](_0x3933d8[_0x3840('0x1f')]['include'],function(_0x54d1be){return{'model':db[_0x54d1be['model']],'as':_0x54d1be['as'],'attributes':_0x54d1be[_0x3840('0x22')],'include':_0x54d1be['include']?_['map'](_0x54d1be[_0x3840('0x24')],function(_0xa98f64){return{'model':db[_0xa98f64[_0x3840('0x26')]],'as':_0xa98f64['as'],'attributes':_0xa98f64['attributes'],'include':_0xa98f64[_0x3840('0x24')]?_[_0x3840('0x25')](_0xa98f64[_0x3840('0x24')],function(_0x344749){return{'model':db[_0x344749[_0x3840('0x26')]],'as':_0x344749['as'],'attributes':_0x344749[_0x3840('0x22')]};}):[]};}):[]};}):[]:[]})[_0x3840('0x12')](function(_0x10494c){logger[_0x3840('0x13')]('GetVoiceExtension',_0x3933d8);logger[_0x3840('0x27')](_0x3840('0x1c'),_0x3933d8,JSON[_0x3840('0x17')](_0x10494c));_0xabe79d(_0x10494c);})[_0x3840('0x1b')](function(_0x4ef1da){logger['error'](_0x3840('0x1c'),_0x4ef1da[_0x3840('0x1a')],_0x3933d8);_0xd03d51(_0x58312e[_0x3840('0x18')](0x1f4,_0x4ef1da[_0x3840('0x1a')]));});});}; \ No newline at end of file diff --git a/server/api/voiceExtension/voiceExtension.socket.js b/server/api/voiceExtension/voiceExtension.socket.js index 6473068..cd74e93 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 _0x2ef3=['update','emit','removeListener','register','length','voiceExtension:','./voiceExtension.events','save','remove'];(function(_0x49dd26,_0x9e5a5d){var _0x45f549=function(_0x8a8d93){while(--_0x8a8d93){_0x49dd26['push'](_0x49dd26['shift']());}};_0x45f549(++_0x9e5a5d);}(_0x2ef3,0xba));var _0x32ef=function(_0x8fd507,_0x50af00){_0x8fd507=_0x8fd507-0x0;var _0x34a76b=_0x2ef3[_0x8fd507];return _0x34a76b;};'use strict';var VoiceExtensionEvents=require(_0x32ef('0x0'));var events=[_0x32ef('0x1'),_0x32ef('0x2'),_0x32ef('0x3')];function createListener(_0x3944df,_0x38047b){return function(_0x48106c){_0x38047b[_0x32ef('0x4')](_0x3944df,_0x48106c);};}function removeListener(_0x38b7f3,_0x524ab6){return function(){VoiceExtensionEvents[_0x32ef('0x5')](_0x38b7f3,_0x524ab6);};}exports[_0x32ef('0x6')]=function(_0x4c8104){for(var _0x5dfa09=0x0,_0x2c0089=events[_0x32ef('0x7')];_0x5dfa09<_0x2c0089;_0x5dfa09++){var _0x367c39=events[_0x5dfa09];var _0x2fb8eb=createListener(_0x32ef('0x8')+_0x367c39,_0x4c8104);VoiceExtensionEvents['on'](_0x367c39,_0x2fb8eb);}}; \ No newline at end of file +var _0x4975=['length','./voiceExtension.events','remove','update','emit','removeListener','register'];(function(_0x7e8081,_0x1006eb){var _0x2605a2=function(_0x524ecc){while(--_0x524ecc){_0x7e8081['push'](_0x7e8081['shift']());}};_0x2605a2(++_0x1006eb);}(_0x4975,0x86));var _0x5497=function(_0x343879,_0x13f751){_0x343879=_0x343879-0x0;var _0x21134d=_0x4975[_0x343879];return _0x21134d;};'use strict';var VoiceExtensionEvents=require(_0x5497('0x0'));var events=['save',_0x5497('0x1'),_0x5497('0x2')];function createListener(_0xfc7927,_0x349f5f){return function(_0x135f6f){_0x349f5f[_0x5497('0x3')](_0xfc7927,_0x135f6f);};}function removeListener(_0x14cecb,_0xeb31af){return function(){VoiceExtensionEvents[_0x5497('0x4')](_0x14cecb,_0xeb31af);};}exports[_0x5497('0x5')]=function(_0x539a27){for(var _0x37e48d=0x0,_0x4f563d=events[_0x5497('0x6')];_0x37e48d<_0x4f563d;_0x37e48d++){var _0x674a2a=events[_0x37e48d];var _0x368e8b=createListener('voiceExtension:'+_0x674a2a,_0x539a27);VoiceExtensionEvents['on'](_0x674a2a,_0x368e8b);}}; \ No newline at end of file diff --git a/server/api/voiceMail/index.js b/server/api/voiceMail/index.js index 294eb15..30712cb 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 _0x1623=['/:id','show','get','/:id/messages','getMessages','post','put','update','delete','destroy','exports','multer','connect-timeout','express','Router','fs-extra','../../components/auth/service','./voiceMail.controller','isAuthenticated','index'];(function(_0x1912a4,_0x252423){var _0x136479=function(_0x1cc807){while(--_0x1cc807){_0x1912a4['push'](_0x1912a4['shift']());}};_0x136479(++_0x252423);}(_0x1623,0xab));var _0x3162=function(_0xd95b38,_0x4f2624){_0xd95b38=_0xd95b38-0x0;var _0x3208bf=_0x1623[_0xd95b38];return _0x3208bf;};'use strict';var multer=require(_0x3162('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3162('0x1'));var express=require(_0x3162('0x2'));var router=express[_0x3162('0x3')]();var fs_extra=require(_0x3162('0x4'));var auth=require(_0x3162('0x5'));var interaction=require('../../components/interaction/service');var config=require('../../config/environment');var controller=require(_0x3162('0x6'));router['get']('/',auth[_0x3162('0x7')](),controller[_0x3162('0x8')]);router['get'](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0xa')]);router[_0x3162('0xb')](_0x3162('0xc'),auth[_0x3162('0x7')](),controller[_0x3162('0xd')]);router[_0x3162('0xe')]('/',auth['isAuthenticated'](),controller['create']);router[_0x3162('0xf')](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0x10')]);router[_0x3162('0x11')](_0x3162('0x9'),auth[_0x3162('0x7')](),controller[_0x3162('0x12')]);module[_0x3162('0x13')]=router; \ No newline at end of file +var _0x7b84=['express','Router','fs-extra','../../components/interaction/service','../../config/environment','./voiceMail.controller','get','isAuthenticated','index','/:id','show','/:id/messages','getMessages','post','create','put','update','delete','destroy','exports','multer','util','path','connect-timeout'];(function(_0x2ac265,_0x1264de){var _0x2329a7=function(_0xab1161){while(--_0xab1161){_0x2ac265['push'](_0x2ac265['shift']());}};_0x2329a7(++_0x1264de);}(_0x7b84,0x17c));var _0x47b8=function(_0x4dd696,_0x4104f6){_0x4dd696=_0x4dd696-0x0;var _0x298ea1=_0x7b84[_0x4dd696];return _0x298ea1;};'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('0x11')]('/',auth[_0x47b8('0xb')](),controller[_0x47b8('0x12')]);router[_0x47b8('0x13')](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x14')]);router[_0x47b8('0x15')](_0x47b8('0xd'),auth[_0x47b8('0xb')](),controller[_0x47b8('0x16')]);module[_0x47b8('0x17')]=router; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.attributes.js b/server/api/voiceMail/voiceMail.attributes.js index e267b84..ad7dae4 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 _0xe1de=['ENUM','yes','TIMESTAMP','INTEGER','VIRTUAL','\x20-\x20','getDataValue','mailbox','STRING','contest_mailbox','email','trim','central'];(function(_0xde681d,_0x320776){var _0x58db6e=function(_0x3b33b2){while(--_0x3b33b2){_0xde681d['push'](_0xde681d['shift']());}};_0x58db6e(++_0x320776);}(_0xe1de,0xcb));var _0xee1d=function(_0x1d7300,_0x17f109){_0x1d7300=_0x1d7300-0x0;var _0x46ee98=_0xe1de[_0x1d7300];return _0x46ee98;};'use strict';var Sequelize=require('sequelize');module['exports']={'customer_id':{'type':Sequelize[_0xee1d('0x0')]},'context':{'type':Sequelize['STRING'],'defaultValue':'from-voicemail','unique':_0xee1d('0x1')},'mailbox':{'type':Sequelize[_0xee1d('0x0')],'defaultValue':'','allowNull':![],'unique':_0xee1d('0x1')},'password':{'type':Sequelize[_0xee1d('0x0')]},'fullname':{'type':Sequelize[_0xee1d('0x0')]},'email':{'type':Sequelize[_0xee1d('0x0')],'validate':{'isEmail':!![]},'set':function(_0xa53f82){this['setDataValue'](_0xee1d('0x2'),typeof _0xa53f82==='string'&&_0xa53f82[_0xee1d('0x3')]()?_0xa53f82[_0xee1d('0x3')]():null);}},'pager':{'type':Sequelize[_0xee1d('0x0')]},'tz':{'type':Sequelize[_0xee1d('0x0')],'defaultValue':_0xee1d('0x4')},'attach':{'type':Sequelize[_0xee1d('0x5')](_0xee1d('0x6'),'no'),'defaultValue':_0xee1d('0x6'),'allowNull':![]},'saycid':{'type':Sequelize[_0xee1d('0x5')](_0xee1d('0x6'),'no'),'defaultValue':_0xee1d('0x6'),'allowNull':![]},'dialout':{'type':Sequelize[_0xee1d('0x0')]},'callback':{'type':Sequelize[_0xee1d('0x0')]},'review':{'type':Sequelize[_0xee1d('0x5')](_0xee1d('0x6'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xee1d('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize[_0xee1d('0x5')](_0xee1d('0x6'),'no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xee1d('0x5')](_0xee1d('0x6'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':'TINYINT(4)','defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xee1d('0x5')](_0xee1d('0x6'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xee1d('0x5')](_0xee1d('0x6'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xee1d('0x5')](_0xee1d('0x6'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xee1d('0x5')]('yes','no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xee1d('0x6'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xee1d('0x5')](_0xee1d('0x6'),'no'),'defaultValue':_0xee1d('0x6'),'allowNull':![]},'stamp':{'type':_0xee1d('0x7')},'emailsubject':{'type':Sequelize[_0xee1d('0x0')]},'emailbody':{'type':Sequelize[_0xee1d('0x0')]},'maxsecs':{'type':Sequelize[_0xee1d('0x8')](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xee1d('0x8')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xee1d('0x9')],'get':function(){return this['getDataValue']('fullname')+_0xee1d('0xa')+this[_0xee1d('0xb')](_0xee1d('0xc'));}}}; \ No newline at end of file +var _0xfb0c=['from-voicemail','contest_mailbox','setDataValue','email','trim','central','ENUM','yes','TINYINT(4)','INTEGER','VIRTUAL','getDataValue','fullname','\x20-\x20','sequelize','exports','STRING'];(function(_0x5ede9a,_0x57282d){var _0x4b9986=function(_0x8bc1d4){while(--_0x8bc1d4){_0x5ede9a['push'](_0x5ede9a['shift']());}};_0x4b9986(++_0x57282d);}(_0xfb0c,0xa7));var _0xcfb0=function(_0x28f9a2,_0x34354b){_0x28f9a2=_0x28f9a2-0x0;var _0x3deb3a=_0xfb0c[_0x28f9a2];return _0x3deb3a;};'use strict';var Sequelize=require(_0xcfb0('0x0'));module[_0xcfb0('0x1')]={'customer_id':{'type':Sequelize[_0xcfb0('0x2')]},'context':{'type':Sequelize['STRING'],'defaultValue':_0xcfb0('0x3'),'unique':_0xcfb0('0x4')},'mailbox':{'type':Sequelize[_0xcfb0('0x2')],'defaultValue':'','allowNull':![],'unique':_0xcfb0('0x4')},'password':{'type':Sequelize['STRING']},'fullname':{'type':Sequelize[_0xcfb0('0x2')]},'email':{'type':Sequelize['STRING'],'validate':{'isEmail':!![]},'set':function(_0x31f4c3){this[_0xcfb0('0x5')](_0xcfb0('0x6'),typeof _0x31f4c3==='string'&&_0x31f4c3[_0xcfb0('0x7')]()?_0x31f4c3[_0xcfb0('0x7')]():null);}},'pager':{'type':Sequelize[_0xcfb0('0x2')]},'tz':{'type':Sequelize[_0xcfb0('0x2')],'defaultValue':_0xcfb0('0x8')},'attach':{'type':Sequelize[_0xcfb0('0x9')](_0xcfb0('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'saycid':{'type':Sequelize[_0xcfb0('0x9')](_0xcfb0('0xa'),'no'),'defaultValue':_0xcfb0('0xa'),'allowNull':![]},'dialout':{'type':Sequelize['STRING']},'callback':{'type':Sequelize['STRING']},'review':{'type':Sequelize[_0xcfb0('0x9')](_0xcfb0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'operator':{'type':Sequelize[_0xcfb0('0x9')](_0xcfb0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'envelope':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no','allowNull':![]},'sayduration':{'type':Sequelize[_0xcfb0('0x9')](_0xcfb0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'saydurationm':{'type':_0xcfb0('0xb'),'defaultValue':0x1,'allowNull':![]},'sendvoicemail':{'type':Sequelize[_0xcfb0('0x9')](_0xcfb0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'delete':{'type':Sequelize[_0xcfb0('0x9')](_0xcfb0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'nextaftercmd':{'type':Sequelize[_0xcfb0('0x9')](_0xcfb0('0xa'),'no'),'defaultValue':'yes','allowNull':![]},'forcename':{'type':Sequelize[_0xcfb0('0x9')](_0xcfb0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'forcegreetings':{'type':Sequelize['ENUM'](_0xcfb0('0xa'),'no'),'defaultValue':'no','allowNull':![]},'hidefromdir':{'type':Sequelize[_0xcfb0('0x9')]('yes','no'),'defaultValue':_0xcfb0('0xa'),'allowNull':![]},'stamp':{'type':'TIMESTAMP'},'emailsubject':{'type':Sequelize[_0xcfb0('0x2')]},'emailbody':{'type':Sequelize[_0xcfb0('0x2')]},'maxsecs':{'type':Sequelize['INTEGER'](0xff),'defaultValue':0xb4,'allowNull':![]},'maxmsg':{'type':Sequelize[_0xcfb0('0xc')](0xff),'defaultValue':0x64,'allowNull':![]},'name':{'type':Sequelize[_0xcfb0('0xd')],'get':function(){return this[_0xcfb0('0xe')](_0xcfb0('0xf'))+_0xcfb0('0x10')+this[_0xcfb0('0xe')]('mailbox');}}}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.controller.js b/server/api/voiceMail/voiceMail.controller.js index 2d4e016..9ae35e4 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 _0x04b8=['../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','end','json','offset','limit','undefined','count','Content-Range','apply','reject','save','then','destroy','Voicemails','error','stack','name','send','index','map','VoiceMail','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','get','userProfileId','autoAssociation','UserProfileResource','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getMessages','findOne','VoiceMailMessage','nolimit','mailbox','findAndCountAll','rimraf','fast-json-patch','request-promise','bluebird','mustache','path','sox','to-csv','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware'];(function(_0x114883,_0x46144c){var _0x2dca8c=function(_0x530acf){while(--_0x530acf){_0x114883['push'](_0x114883['shift']());}};_0x2dca8c(++_0x46144c);}(_0x04b8,0x159));var _0x804b=function(_0xaa8eb3,_0x43e80b){_0xaa8eb3=_0xaa8eb3-0x0;var _0x1e961e=_0x04b8[_0xaa8eb3];return _0x1e961e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x804b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x804b('0x1'));var rp=require(_0x804b('0x2'));var moment=require('moment');var BPromise=require(_0x804b('0x3'));var Mustache=require(_0x804b('0x4'));var util=require('util');var path=require(_0x804b('0x5'));var sox=require(_0x804b('0x6'));var csv=require(_0x804b('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x804b('0x8'));var _=require(_0x804b('0x9'));var squel=require(_0x804b('0xa'));var crypto=require('crypto');var jsforce=require(_0x804b('0xb'));var deskjs=require(_0x804b('0xc'));var toCsv=require('to-csv');var querystring=require(_0x804b('0xd'));var Papa=require(_0x804b('0xe'));var Redis=require(_0x804b('0xf'));var authService=require(_0x804b('0x10'));var qs=require(_0x804b('0x11'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x804b('0x12'));var logger=require(_0x804b('0x13'))(_0x804b('0x14'));var utils=require(_0x804b('0x15'));var config=require(_0x804b('0x16'));var licenseUtil=require(_0x804b('0x17'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x15a4eb,_0x5303cc){_0x5303cc=_0x5303cc||0xcc;return function(_0x23ee57){if(_0x23ee57){return _0x15a4eb[_0x804b('0x18')](_0x5303cc);}return _0x15a4eb[_0x804b('0x19')](_0x5303cc)[_0x804b('0x1a')]();};}function respondWithResult(_0x581fbf,_0x215825){_0x215825=_0x215825||0xc8;return function(_0x1b01a7){if(_0x1b01a7){return _0x581fbf[_0x804b('0x19')](_0x215825)[_0x804b('0x1b')](_0x1b01a7);}};}function respondWithFilteredResult(_0x4ff1be,_0x2fd593){return function(_0x8ccbe0){if(_0x8ccbe0){var _0x5e1cfe=typeof _0x2fd593[_0x804b('0x1c')]==='undefined'&&typeof _0x2fd593[_0x804b('0x1d')]===_0x804b('0x1e');var _0x13662e=_0x8ccbe0[_0x804b('0x1f')];var _0x3a05c0=_0x5e1cfe?0x0:_0x2fd593['offset'];var _0x871d6c=_0x5e1cfe?_0x8ccbe0['count']:_0x2fd593[_0x804b('0x1c')]+_0x2fd593[_0x804b('0x1d')];var _0x42cceb;if(_0x871d6c>=_0x13662e){_0x871d6c=_0x13662e;_0x42cceb=0xc8;}else{_0x42cceb=0xce;}_0x4ff1be[_0x804b('0x19')](_0x42cceb);return _0x4ff1be['set'](_0x804b('0x20'),_0x3a05c0+'-'+_0x871d6c+'/'+_0x13662e)[_0x804b('0x1b')](_0x8ccbe0);}return null;};}function patchUpdates(_0x427166){return function(_0x11eaf6){try{jsonpatch[_0x804b('0x21')](_0x11eaf6,_0x427166,!![]);}catch(_0x267878){return BPromise[_0x804b('0x22')](_0x267878);}return _0x11eaf6[_0x804b('0x23')]();};}function saveUpdates(_0xaa9521,_0x2b7271){return function(_0x1acc48){if(_0x1acc48){return _0x1acc48['update'](_0xaa9521)[_0x804b('0x24')](function(_0x5a77e0){return _0x5a77e0;});}return null;};}function removeEntity(_0x5585f8,_0x44a921){return function(_0x367024){if(_0x367024){return _0x367024[_0x804b('0x25')]()[_0x804b('0x24')](function(){var _0x9080c2=_0x367024['get']({'plain':!![]});var _0x2de812=_0x804b('0x26');return db['UserProfileResource'][_0x804b('0x25')]({'where':{'type':_0x2de812,'resourceId':_0x9080c2['id']}})[_0x804b('0x24')](function(){return _0x367024;});})[_0x804b('0x24')](function(){_0x5585f8[_0x804b('0x19')](0xcc)[_0x804b('0x1a')]();});}};}function handleEntityNotFound(_0x5cc1dd,_0x456580){return function(_0x22f822){if(!_0x22f822){_0x5cc1dd[_0x804b('0x18')](0x194);}return _0x22f822;};}function handleError(_0xe145e,_0x3d1ecc){_0x3d1ecc=_0x3d1ecc||0x1f4;return function(_0x4a6079){logger[_0x804b('0x27')](_0x4a6079[_0x804b('0x28')]);if(_0x4a6079[_0x804b('0x29')]){delete _0x4a6079['name'];}_0xe145e[_0x804b('0x19')](_0x3d1ecc)[_0x804b('0x2a')](_0x4a6079);};}exports[_0x804b('0x2b')]=function(_0x57b8da,_0x408857){var _0x471c04={},_0x5e8f85={},_0x391376={'count':0x0,'rows':[]};var _0x37dd3e=_[_0x804b('0x2c')](db[_0x804b('0x2d')][_0x804b('0x2e')],function(_0x241c96){return{'name':_0x241c96['fieldName'],'type':_0x241c96[_0x804b('0x2f')][_0x804b('0x30')]};});_0x5e8f85[_0x804b('0x31')]=_[_0x804b('0x2c')](_0x37dd3e,_0x804b('0x29'));_0x5e8f85[_0x804b('0x32')]=_[_0x804b('0x33')](_0x57b8da[_0x804b('0x32')]);_0x5e8f85[_0x804b('0x34')]=_[_0x804b('0x35')](_0x5e8f85[_0x804b('0x31')],_0x5e8f85[_0x804b('0x32')]);_0x471c04[_0x804b('0x36')]=_[_0x804b('0x35')](_0x5e8f85[_0x804b('0x31')],qs[_0x804b('0x37')](_0x57b8da[_0x804b('0x32')][_0x804b('0x37')]));_0x471c04[_0x804b('0x36')]=_0x471c04[_0x804b('0x36')][_0x804b('0x38')]?_0x471c04[_0x804b('0x36')]:_0x5e8f85[_0x804b('0x31')];if(!_0x57b8da[_0x804b('0x32')][_0x804b('0x39')]('nolimit')){_0x471c04['limit']=qs['limit'](_0x57b8da[_0x804b('0x32')][_0x804b('0x1d')]);_0x471c04[_0x804b('0x1c')]=qs['offset'](_0x57b8da['query']['offset']);}_0x471c04[_0x804b('0x3a')]=qs[_0x804b('0x3b')](_0x57b8da[_0x804b('0x32')][_0x804b('0x3b')]);_0x471c04[_0x804b('0x3c')]=qs[_0x804b('0x34')](_[_0x804b('0x3d')](_0x57b8da[_0x804b('0x32')],_0x5e8f85[_0x804b('0x34')]),_0x37dd3e);if(_0x57b8da[_0x804b('0x32')][_0x804b('0x3e')]){_0x471c04[_0x804b('0x3c')]=_[_0x804b('0x3f')](_0x471c04['where'],{'$or':_[_0x804b('0x2c')](_0x37dd3e,function(_0x4654f4){if(_0x4654f4[_0x804b('0x2f')]!==_0x804b('0x40')){var _0x62cfee={};_0x62cfee[_0x4654f4['name']]={'$like':'%'+_0x57b8da['query'][_0x804b('0x3e')]+'%'};return _0x62cfee;}})});}_0x471c04=_[_0x804b('0x3f')]({},_0x471c04,_0x57b8da[_0x804b('0x41')]);var _0x5206f9={'where':_0x471c04[_0x804b('0x3c')]};return db['VoiceMail'][_0x804b('0x1f')](_0x5206f9)[_0x804b('0x24')](function(_0x20ccc7){_0x391376[_0x804b('0x1f')]=_0x20ccc7;if(_0x57b8da[_0x804b('0x32')][_0x804b('0x42')]){_0x471c04[_0x804b('0x43')]=[{'all':!![]}];}return db['VoiceMail'][_0x804b('0x44')](_0x471c04);})[_0x804b('0x24')](function(_0x1dcec8){_0x391376[_0x804b('0x45')]=_0x1dcec8;return _0x391376;})['then'](respondWithFilteredResult(_0x408857,_0x471c04))[_0x804b('0x46')](handleError(_0x408857,null));};exports[_0x804b('0x47')]=function(_0x1df519,_0x1c3d93){var _0x320aeb={'raw':!![],'where':{'id':_0x1df519[_0x804b('0x48')]['id']}},_0xbca498={};_0xbca498[_0x804b('0x31')]=_['keys'](db[_0x804b('0x2d')]['rawAttributes']);_0xbca498['query']=_['keys'](_0x1df519[_0x804b('0x32')]);_0xbca498['filters']=_[_0x804b('0x35')](_0xbca498[_0x804b('0x31')],_0xbca498[_0x804b('0x32')]);_0x320aeb[_0x804b('0x36')]=_['intersection'](_0xbca498[_0x804b('0x31')],qs[_0x804b('0x37')](_0x1df519[_0x804b('0x32')]['fields']));_0x320aeb[_0x804b('0x36')]=_0x320aeb[_0x804b('0x36')][_0x804b('0x38')]?_0x320aeb['attributes']:_0xbca498[_0x804b('0x31')];if(_0x1df519[_0x804b('0x32')][_0x804b('0x42')]){_0x320aeb[_0x804b('0x43')]=[{'all':!![]}];}_0x320aeb=_[_0x804b('0x3f')]({},_0x320aeb,_0x1df519[_0x804b('0x41')]);return db[_0x804b('0x2d')][_0x804b('0x49')](_0x320aeb)[_0x804b('0x24')](handleEntityNotFound(_0x1c3d93,null))[_0x804b('0x24')](respondWithResult(_0x1c3d93,null))[_0x804b('0x46')](handleError(_0x1c3d93,null));};exports[_0x804b('0x4a')]=function(_0x20862f,_0x2c1796){return db['VoiceMail']['create'](_0x20862f[_0x804b('0x4b')],{})[_0x804b('0x24')](function(_0x82fc71){var _0x53124f=_0x20862f[_0x804b('0x4c')]['get']({'plain':!![]});if(!_0x53124f)throw new Error(_0x804b('0x4d'));if(_0x53124f[_0x804b('0x4e')]===_0x804b('0x4c')){var _0x3ca9ff=_0x82fc71[_0x804b('0x4f')]({'plain':!![]});var _0x111e3f='Voicemails';return db['UserProfileSection'][_0x804b('0x49')]({'where':{'name':_0x111e3f,'userProfileId':_0x53124f[_0x804b('0x50')]},'raw':!![]})['then'](function(_0x5103b7){if(_0x5103b7&&_0x5103b7[_0x804b('0x51')]===0x0){return db[_0x804b('0x52')][_0x804b('0x4a')]({'name':_0x3ca9ff['name'],'resourceId':_0x3ca9ff['id'],'type':_0x5103b7[_0x804b('0x29')],'sectionId':_0x5103b7['id']},{})[_0x804b('0x24')](function(){return _0x82fc71;});}else{return _0x82fc71;}})['catch'](function(_0x2756de){logger['error'](_0x804b('0x53'),_0x2756de);throw _0x2756de;});}return _0x82fc71;})['then'](respondWithResult(_0x2c1796,0xc9))[_0x804b('0x46')](handleError(_0x2c1796,null));};exports[_0x804b('0x54')]=function(_0x47c835,_0x2f9360){if(_0x47c835['body']['id']){delete _0x47c835[_0x804b('0x4b')]['id'];}return db[_0x804b('0x2d')][_0x804b('0x49')]({'where':{'id':_0x47c835[_0x804b('0x48')]['id']}})[_0x804b('0x24')](handleEntityNotFound(_0x2f9360,null))[_0x804b('0x24')](saveUpdates(_0x47c835[_0x804b('0x4b')],null))[_0x804b('0x24')](respondWithResult(_0x2f9360,null))[_0x804b('0x46')](handleError(_0x2f9360,null));};exports[_0x804b('0x25')]=function(_0x5d53f9,_0x53b91d){return db[_0x804b('0x2d')]['find']({'where':{'id':_0x5d53f9['params']['id']}})[_0x804b('0x24')](handleEntityNotFound(_0x53b91d,null))[_0x804b('0x24')](removeEntity(_0x53b91d,null))[_0x804b('0x46')](handleError(_0x53b91d,null));};exports[_0x804b('0x55')]=function(_0x5a549f,_0x4f7cc4,_0x13fa81){return db[_0x804b('0x2d')][_0x804b('0x56')]({'where':{'id':_0x5a549f[_0x804b('0x48')]['id']}})[_0x804b('0x24')](handleEntityNotFound(_0x4f7cc4,null))[_0x804b('0x24')](function(_0x24c9b0){var _0x3100aa;var _0x2c0ed4={},_0x3f0ca3={};_0x3f0ca3[_0x804b('0x31')]=_[_0x804b('0x33')](db[_0x804b('0x57')][_0x804b('0x2e')]);_0x3f0ca3[_0x804b('0x32')]=_[_0x804b('0x33')](_0x5a549f['query']);_0x3f0ca3[_0x804b('0x34')]=_[_0x804b('0x35')](_0x3f0ca3['model'],_0x3f0ca3[_0x804b('0x32')]);_0x2c0ed4[_0x804b('0x36')]=_[_0x804b('0x35')](_0x3f0ca3[_0x804b('0x31')],qs['fields'](_0x5a549f[_0x804b('0x32')][_0x804b('0x37')]));_0x2c0ed4['attributes']=_0x2c0ed4[_0x804b('0x36')][_0x804b('0x38')]?_0x2c0ed4[_0x804b('0x36')]:_0x3f0ca3['model'];if(!_0x5a549f[_0x804b('0x32')][_0x804b('0x39')](_0x804b('0x58'))){_0x2c0ed4[_0x804b('0x1d')]=qs[_0x804b('0x1d')](_0x5a549f['query'][_0x804b('0x1d')]);_0x2c0ed4[_0x804b('0x1c')]=qs[_0x804b('0x1c')](_0x5a549f[_0x804b('0x32')]['offset']);}_0x2c0ed4['order']=qs[_0x804b('0x3b')](_0x5a549f['query'][_0x804b('0x3b')]);_0x2c0ed4[_0x804b('0x3c')]=qs[_0x804b('0x34')](_[_0x804b('0x3d')](_0x5a549f[_0x804b('0x32')],_0x3f0ca3['filters']));if(_0x5a549f[_0x804b('0x32')][_0x804b('0x3e')]){_0x2c0ed4[_0x804b('0x3c')]=_['merge'](_0x2c0ed4[_0x804b('0x3c')],{'$or':_[_0x804b('0x2c')](_0x2c0ed4['attributes'],function(_0xb9deae){var _0x481bcd={};_0x481bcd[_0xb9deae]={'$like':'%'+_0x5a549f[_0x804b('0x32')][_0x804b('0x3e')]+'%'};return _0x481bcd;})});}_0x2c0ed4['where']=_[_0x804b('0x3f')](_0x2c0ed4[_0x804b('0x3c')],{'mailboxuser':_0x24c9b0[_0x804b('0x59')]});_0x2c0ed4=_['merge']({},_0x2c0ed4,_0x5a549f[_0x804b('0x41')]);return db['VoiceMailMessage'][_0x804b('0x5a')](_0x2c0ed4)[_0x804b('0x24')](respondWithFilteredResult(_0x4f7cc4,_0x2c0ed4));})[_0x804b('0x46')](handleError(_0x4f7cc4,null));}; \ No newline at end of file +var _0x0fd9=['ejs','squel','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','sendStatus','end','status','json','undefined','limit','count','offset','set','Content-Range','apply','reject','save','update','then','get','Voicemails','UserProfileResource','destroy','error','stack','name','send','index','map','VoiceMail','fieldName','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','catch','show','options','find','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','userProfileId','autoAssociation','params','findAndCountAll','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv'];(function(_0x20f858,_0x42b1b0){var _0x26fa0d=function(_0x2a91bb){while(--_0x2a91bb){_0x20f858['push'](_0x20f858['shift']());}};_0x26fa0d(++_0x42b1b0);}(_0x0fd9,0xa3));var _0x90fd=function(_0x54b283,_0x5eb8a6){_0x54b283=_0x54b283-0x0;var _0x2462b3=_0x0fd9[_0x54b283];return _0x2462b3;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x90fd('0x0'));var zipdir=require(_0x90fd('0x1'));var jsonpatch=require(_0x90fd('0x2'));var rp=require(_0x90fd('0x3'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x90fd('0x4'));var util=require(_0x90fd('0x5'));var path=require(_0x90fd('0x6'));var sox=require(_0x90fd('0x7'));var csv=require(_0x90fd('0x8'));var ejs=require(_0x90fd('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0x90fd('0xa'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0x90fd('0xb'));var toCsv=require(_0x90fd('0x8'));var querystring=require('querystring');var Papa=require(_0x90fd('0xc'));var Redis=require(_0x90fd('0xd'));var authService=require(_0x90fd('0xe'));var qs=require(_0x90fd('0xf'));var as=require(_0x90fd('0x10'));var hardwareService=require(_0x90fd('0x11'));var logger=require(_0x90fd('0x12'))(_0x90fd('0x13'));var utils=require(_0x90fd('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x90fd('0x15'));var db=require(_0x90fd('0x16'))['db'];function respondWithStatusCode(_0x4e8b99,_0x1439ed){_0x1439ed=_0x1439ed||0xcc;return function(_0x37a0f8){if(_0x37a0f8){return _0x4e8b99[_0x90fd('0x17')](_0x1439ed);}return _0x4e8b99['status'](_0x1439ed)[_0x90fd('0x18')]();};}function respondWithResult(_0x48e701,_0x1cae40){_0x1cae40=_0x1cae40||0xc8;return function(_0xb402d9){if(_0xb402d9){return _0x48e701[_0x90fd('0x19')](_0x1cae40)[_0x90fd('0x1a')](_0xb402d9);}};}function respondWithFilteredResult(_0x3c5da8,_0x442a19){return function(_0x296a64){if(_0x296a64){var _0x4eb953=typeof _0x442a19['offset']===_0x90fd('0x1b')&&typeof _0x442a19[_0x90fd('0x1c')]==='undefined';var _0x130489=_0x296a64[_0x90fd('0x1d')];var _0x1fcc87=_0x4eb953?0x0:_0x442a19['offset'];var _0x3f9c76=_0x4eb953?_0x296a64[_0x90fd('0x1d')]:_0x442a19[_0x90fd('0x1e')]+_0x442a19[_0x90fd('0x1c')];var _0x251957;if(_0x3f9c76>=_0x130489){_0x3f9c76=_0x130489;_0x251957=0xc8;}else{_0x251957=0xce;}_0x3c5da8[_0x90fd('0x19')](_0x251957);return _0x3c5da8[_0x90fd('0x1f')](_0x90fd('0x20'),_0x1fcc87+'-'+_0x3f9c76+'/'+_0x130489)[_0x90fd('0x1a')](_0x296a64);}return null;};}function patchUpdates(_0x90197e){return function(_0x19e79b){try{jsonpatch[_0x90fd('0x21')](_0x19e79b,_0x90197e,!![]);}catch(_0x1fb31a){return BPromise[_0x90fd('0x22')](_0x1fb31a);}return _0x19e79b[_0x90fd('0x23')]();};}function saveUpdates(_0x493c26,_0x35ce4e){return function(_0xc4e4e2){if(_0xc4e4e2){return _0xc4e4e2[_0x90fd('0x24')](_0x493c26)[_0x90fd('0x25')](function(_0x411a6a){return _0x411a6a;});}return null;};}function removeEntity(_0x3ad6c6,_0x30f67e){return function(_0x300262){if(_0x300262){return _0x300262['destroy']()[_0x90fd('0x25')](function(){var _0x52b066=_0x300262[_0x90fd('0x26')]({'plain':!![]});var _0x18d5b3=_0x90fd('0x27');return db[_0x90fd('0x28')][_0x90fd('0x29')]({'where':{'type':_0x18d5b3,'resourceId':_0x52b066['id']}})['then'](function(){return _0x300262;});})[_0x90fd('0x25')](function(){_0x3ad6c6[_0x90fd('0x19')](0xcc)[_0x90fd('0x18')]();});}};}function handleEntityNotFound(_0x1cdc38,_0x1c3805){return function(_0x428bc2){if(!_0x428bc2){_0x1cdc38['sendStatus'](0x194);}return _0x428bc2;};}function handleError(_0x5671fc,_0xbf1c9b){_0xbf1c9b=_0xbf1c9b||0x1f4;return function(_0x170cfb){logger[_0x90fd('0x2a')](_0x170cfb[_0x90fd('0x2b')]);if(_0x170cfb[_0x90fd('0x2c')]){delete _0x170cfb['name'];}_0x5671fc['status'](_0xbf1c9b)[_0x90fd('0x2d')](_0x170cfb);};}exports[_0x90fd('0x2e')]=function(_0x228fbc,_0x3a0102){var _0x4a3ae4={},_0x59aede={},_0x12dea4={'count':0x0,'rows':[]};var _0x21a9cf=_[_0x90fd('0x2f')](db[_0x90fd('0x30')]['rawAttributes'],function(_0x2c5204){return{'name':_0x2c5204[_0x90fd('0x31')],'type':_0x2c5204[_0x90fd('0x32')][_0x90fd('0x33')]};});_0x59aede[_0x90fd('0x34')]=_[_0x90fd('0x2f')](_0x21a9cf,_0x90fd('0x2c'));_0x59aede[_0x90fd('0x35')]=_[_0x90fd('0x36')](_0x228fbc[_0x90fd('0x35')]);_0x59aede[_0x90fd('0x37')]=_[_0x90fd('0x38')](_0x59aede[_0x90fd('0x34')],_0x59aede[_0x90fd('0x35')]);_0x4a3ae4[_0x90fd('0x39')]=_[_0x90fd('0x38')](_0x59aede['model'],qs[_0x90fd('0x3a')](_0x228fbc[_0x90fd('0x35')][_0x90fd('0x3a')]));_0x4a3ae4[_0x90fd('0x39')]=_0x4a3ae4[_0x90fd('0x39')][_0x90fd('0x3b')]?_0x4a3ae4[_0x90fd('0x39')]:_0x59aede[_0x90fd('0x34')];if(!_0x228fbc[_0x90fd('0x35')][_0x90fd('0x3c')](_0x90fd('0x3d'))){_0x4a3ae4[_0x90fd('0x1c')]=qs[_0x90fd('0x1c')](_0x228fbc['query'][_0x90fd('0x1c')]);_0x4a3ae4[_0x90fd('0x1e')]=qs[_0x90fd('0x1e')](_0x228fbc[_0x90fd('0x35')]['offset']);}_0x4a3ae4[_0x90fd('0x3e')]=qs[_0x90fd('0x3f')](_0x228fbc[_0x90fd('0x35')]['sort']);_0x4a3ae4['where']=qs[_0x90fd('0x37')](_[_0x90fd('0x40')](_0x228fbc[_0x90fd('0x35')],_0x59aede[_0x90fd('0x37')]),_0x21a9cf);if(_0x228fbc[_0x90fd('0x35')][_0x90fd('0x41')]){_0x4a3ae4[_0x90fd('0x42')]=_[_0x90fd('0x43')](_0x4a3ae4[_0x90fd('0x42')],{'$or':_[_0x90fd('0x2f')](_0x21a9cf,function(_0x3265c6){if(_0x3265c6[_0x90fd('0x32')]!==_0x90fd('0x44')){var _0x47856d={};_0x47856d[_0x3265c6[_0x90fd('0x2c')]]={'$like':'%'+_0x228fbc[_0x90fd('0x35')][_0x90fd('0x41')]+'%'};return _0x47856d;}})});}_0x4a3ae4=_[_0x90fd('0x43')]({},_0x4a3ae4,_0x228fbc['options']);var _0xa5f17={'where':_0x4a3ae4[_0x90fd('0x42')]};return db[_0x90fd('0x30')]['count'](_0xa5f17)['then'](function(_0x47b8c8){_0x12dea4[_0x90fd('0x1d')]=_0x47b8c8;if(_0x228fbc[_0x90fd('0x35')][_0x90fd('0x45')]){_0x4a3ae4[_0x90fd('0x46')]=[{'all':!![]}];}return db[_0x90fd('0x30')][_0x90fd('0x47')](_0x4a3ae4);})[_0x90fd('0x25')](function(_0x733d4d){_0x12dea4[_0x90fd('0x48')]=_0x733d4d;return _0x12dea4;})[_0x90fd('0x25')](respondWithFilteredResult(_0x3a0102,_0x4a3ae4))[_0x90fd('0x49')](handleError(_0x3a0102,null));};exports[_0x90fd('0x4a')]=function(_0x4cb682,_0x386a0e){var _0x311cbf={'raw':!![],'where':{'id':_0x4cb682['params']['id']}},_0x50b722={};_0x50b722[_0x90fd('0x34')]=_[_0x90fd('0x36')](db[_0x90fd('0x30')]['rawAttributes']);_0x50b722['query']=_[_0x90fd('0x36')](_0x4cb682[_0x90fd('0x35')]);_0x50b722['filters']=_['intersection'](_0x50b722[_0x90fd('0x34')],_0x50b722[_0x90fd('0x35')]);_0x311cbf['attributes']=_['intersection'](_0x50b722[_0x90fd('0x34')],qs[_0x90fd('0x3a')](_0x4cb682[_0x90fd('0x35')]['fields']));_0x311cbf[_0x90fd('0x39')]=_0x311cbf[_0x90fd('0x39')]['length']?_0x311cbf['attributes']:_0x50b722['model'];if(_0x4cb682[_0x90fd('0x35')][_0x90fd('0x45')]){_0x311cbf['include']=[{'all':!![]}];}_0x311cbf=_[_0x90fd('0x43')]({},_0x311cbf,_0x4cb682[_0x90fd('0x4b')]);return db[_0x90fd('0x30')][_0x90fd('0x4c')](_0x311cbf)[_0x90fd('0x25')](handleEntityNotFound(_0x386a0e,null))['then'](respondWithResult(_0x386a0e,null))['catch'](handleError(_0x386a0e,null));};exports[_0x90fd('0x4d')]=function(_0x326e4d,_0x125874){return db[_0x90fd('0x30')][_0x90fd('0x4d')](_0x326e4d[_0x90fd('0x4e')],{})[_0x90fd('0x25')](function(_0x277751){var _0x31b284=_0x326e4d[_0x90fd('0x4f')]['get']({'plain':!![]});if(!_0x31b284)throw new Error(_0x90fd('0x50'));if(_0x31b284[_0x90fd('0x51')]===_0x90fd('0x4f')){var _0x38021b=_0x277751['get']({'plain':!![]});var _0x4cf061=_0x90fd('0x27');return db['UserProfileSection']['find']({'where':{'name':_0x4cf061,'userProfileId':_0x31b284[_0x90fd('0x52')]},'raw':!![]})[_0x90fd('0x25')](function(_0x41f029){if(_0x41f029&&_0x41f029[_0x90fd('0x53')]===0x0){return db[_0x90fd('0x28')][_0x90fd('0x4d')]({'name':_0x38021b[_0x90fd('0x2c')],'resourceId':_0x38021b['id'],'type':_0x41f029['name'],'sectionId':_0x41f029['id']},{})['then'](function(){return _0x277751;});}else{return _0x277751;}})[_0x90fd('0x49')](function(_0x43d076){logger[_0x90fd('0x2a')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x43d076);throw _0x43d076;});}return _0x277751;})[_0x90fd('0x25')](respondWithResult(_0x125874,0xc9))[_0x90fd('0x49')](handleError(_0x125874,null));};exports[_0x90fd('0x24')]=function(_0x3494f7,_0x437abd){if(_0x3494f7[_0x90fd('0x4e')]['id']){delete _0x3494f7[_0x90fd('0x4e')]['id'];}return db[_0x90fd('0x30')]['find']({'where':{'id':_0x3494f7['params']['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x437abd,null))[_0x90fd('0x25')](saveUpdates(_0x3494f7[_0x90fd('0x4e')],null))['then'](respondWithResult(_0x437abd,null))[_0x90fd('0x49')](handleError(_0x437abd,null));};exports[_0x90fd('0x29')]=function(_0x29b880,_0x24229f){return db[_0x90fd('0x30')][_0x90fd('0x4c')]({'where':{'id':_0x29b880['params']['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x24229f,null))['then'](removeEntity(_0x24229f,null))[_0x90fd('0x49')](handleError(_0x24229f,null));};exports['getMessages']=function(_0x29b7ea,_0x461509,_0x2fb220){return db[_0x90fd('0x30')]['findOne']({'where':{'id':_0x29b7ea[_0x90fd('0x54')]['id']}})[_0x90fd('0x25')](handleEntityNotFound(_0x461509,null))[_0x90fd('0x25')](function(_0x40fea3){var _0x4586e9;var _0x15bca2={},_0x57acf6={};_0x57acf6['model']=_['keys'](db['VoiceMailMessage']['rawAttributes']);_0x57acf6[_0x90fd('0x35')]=_[_0x90fd('0x36')](_0x29b7ea[_0x90fd('0x35')]);_0x57acf6[_0x90fd('0x37')]=_[_0x90fd('0x38')](_0x57acf6['model'],_0x57acf6['query']);_0x15bca2['attributes']=_[_0x90fd('0x38')](_0x57acf6[_0x90fd('0x34')],qs['fields'](_0x29b7ea[_0x90fd('0x35')][_0x90fd('0x3a')]));_0x15bca2[_0x90fd('0x39')]=_0x15bca2[_0x90fd('0x39')][_0x90fd('0x3b')]?_0x15bca2[_0x90fd('0x39')]:_0x57acf6[_0x90fd('0x34')];if(!_0x29b7ea[_0x90fd('0x35')][_0x90fd('0x3c')]('nolimit')){_0x15bca2[_0x90fd('0x1c')]=qs[_0x90fd('0x1c')](_0x29b7ea[_0x90fd('0x35')]['limit']);_0x15bca2['offset']=qs[_0x90fd('0x1e')](_0x29b7ea[_0x90fd('0x35')]['offset']);}_0x15bca2[_0x90fd('0x3e')]=qs['sort'](_0x29b7ea['query'][_0x90fd('0x3f')]);_0x15bca2[_0x90fd('0x42')]=qs[_0x90fd('0x37')](_[_0x90fd('0x40')](_0x29b7ea[_0x90fd('0x35')],_0x57acf6[_0x90fd('0x37')]));if(_0x29b7ea[_0x90fd('0x35')][_0x90fd('0x41')]){_0x15bca2['where']=_[_0x90fd('0x43')](_0x15bca2[_0x90fd('0x42')],{'$or':_[_0x90fd('0x2f')](_0x15bca2['attributes'],function(_0x2d0f4b){var _0x4636d5={};_0x4636d5[_0x2d0f4b]={'$like':'%'+_0x29b7ea['query']['filter']+'%'};return _0x4636d5;})});}_0x15bca2[_0x90fd('0x42')]=_[_0x90fd('0x43')](_0x15bca2[_0x90fd('0x42')],{'mailboxuser':_0x40fea3['mailbox']});_0x15bca2=_[_0x90fd('0x43')]({},_0x15bca2,_0x29b7ea['options']);return db['VoiceMailMessage'][_0x90fd('0x55')](_0x15bca2)['then'](respondWithFilteredResult(_0x461509,_0x15bca2));})[_0x90fd('0x49')](handleError(_0x461509,null));}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.model.js b/server/api/voiceMail/voiceMail.model.js index e5b82aa..cbc7791 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 _0x4754=['lodash','util','../../config/logger','api','moment','path','rimraf','../../config/environment','./voiceMail.attributes','exports','define','VoiceMail','mailbox_context','context'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x4754,0x1a4));var _0x4475=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4754[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x4475('0x0'));var util=require(_0x4475('0x1'));var logger=require(_0x4475('0x2'))(_0x4475('0x3'));var moment=require(_0x4475('0x4'));var BPromise=require('bluebird');var rp=require('request-promise');var fs=require('fs');var path=require(_0x4475('0x5'));var rimraf=require(_0x4475('0x6'));var config=require(_0x4475('0x7'));var attributes=require(_0x4475('0x8'));module[_0x4475('0x9')]=function(_0x806104,_0x4439ae){return _0x806104[_0x4475('0xa')](_0x4475('0xb'),attributes,{'tableName':'voice_voicemail','paranoid':![],'indexes':[{'name':_0x4475('0xc'),'fields':['mailbox',_0x4475('0xd')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x84d7=['request-promise','path','rimraf','../../config/environment','./voiceMail.attributes','define','voice_voicemail','mailbox','lodash','util','../../config/logger','moment'];(function(_0x23a494,_0x59a33c){var _0xcd9f58=function(_0x46216b){while(--_0x46216b){_0x23a494['push'](_0x23a494['shift']());}};_0xcd9f58(++_0x59a33c);}(_0x84d7,0xc8));var _0x784d=function(_0x500419,_0x549162){_0x500419=_0x500419-0x0;var _0x241c1a=_0x84d7[_0x500419];return _0x241c1a;};'use strict';var _=require(_0x784d('0x0'));var util=require(_0x784d('0x1'));var logger=require(_0x784d('0x2'))('api');var moment=require(_0x784d('0x3'));var BPromise=require('bluebird');var rp=require(_0x784d('0x4'));var fs=require('fs');var path=require(_0x784d('0x5'));var rimraf=require(_0x784d('0x6'));var config=require(_0x784d('0x7'));var attributes=require(_0x784d('0x8'));module['exports']=function(_0x4a76db,_0x5771a9){return _0x4a76db[_0x784d('0x9')]('VoiceMail',attributes,{'tableName':_0x784d('0xa'),'paranoid':![],'indexes':[{'name':'mailbox_context','fields':[_0x784d('0xb'),'context']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMail/voiceMail.rpc.js b/server/api/voiceMail/voiceMail.rpc.js index 5453b7a..13c9b06 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 _0xc898=['stringify','error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','VoiceMail,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0xc898,0xeb));var _0x8c89=function(_0x527a9,_0x21f270){_0x527a9=_0x527a9-0x0;var _0x291317=_0xc898[_0x527a9];return _0x291317;};'use strict';var _=require(_0x8c89('0x0'));var util=require(_0x8c89('0x1'));var moment=require(_0x8c89('0x2'));var BPromise=require(_0x8c89('0x3'));var rs=require(_0x8c89('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x8c89('0x5'));var logger=require(_0x8c89('0x6'))(_0x8c89('0x7'));var config=require(_0x8c89('0x8'));var jayson=require(_0x8c89('0x9'));var client=jayson[_0x8c89('0xa')][_0x8c89('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x430a60,_0x55f07d,_0x2cbf93){return new BPromise(function(_0x4410b7,_0x46122a){return client[_0x8c89('0xc')](_0x430a60,_0x2cbf93)[_0x8c89('0xd')](function(_0x126d59){logger[_0x8c89('0xe')](_0x8c89('0xf'),_0x55f07d,_0x8c89('0x10'));logger[_0x8c89('0x11')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x55f07d,_0x8c89('0x10'),JSON[_0x8c89('0x12')](_0x126d59));if(_0x126d59[_0x8c89('0x13')]){if(_0x126d59['error']['code']===0x1f4){logger[_0x8c89('0x13')](_0x8c89('0xf'),_0x55f07d,_0x126d59[_0x8c89('0x13')][_0x8c89('0x14')]);return _0x46122a(_0x126d59['error'][_0x8c89('0x14')]);}logger[_0x8c89('0x13')]('VoiceMail,\x20%s,\x20%s',_0x55f07d,_0x126d59[_0x8c89('0x13')][_0x8c89('0x14')]);return _0x4410b7(_0x126d59[_0x8c89('0x13')][_0x8c89('0x14')]);}else{logger['info'](_0x8c89('0xf'),_0x55f07d,_0x8c89('0x10'));_0x4410b7(_0x126d59[_0x8c89('0x15')][_0x8c89('0x14')]);}})[_0x8c89('0x16')](function(_0x498ef7){logger[_0x8c89('0x13')](_0x8c89('0xf'),_0x55f07d,_0x498ef7);_0x46122a(_0x498ef7);});});} \ No newline at end of file +var _0x0f95=['message','result','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMail,\x20%s,\x20%s'];(function(_0x59bff3,_0xf837d7){var _0x1109fe=function(_0x9331dd){while(--_0x9331dd){_0x59bff3['push'](_0x59bff3['shift']());}};_0x1109fe(++_0xf837d7);}(_0x0f95,0x183));var _0x50f9=function(_0x1ab0e6,_0x17ba8d){_0x1ab0e6=_0x1ab0e6-0x0;var _0x248815=_0x0f95[_0x1ab0e6];return _0x248815;};'use strict';var _=require('lodash');var util=require(_0x50f9('0x0'));var moment=require(_0x50f9('0x1'));var BPromise=require(_0x50f9('0x2'));var rs=require(_0x50f9('0x3'));var fs=require('fs');var Redis=require(_0x50f9('0x4'));var db=require(_0x50f9('0x5'))['db'];var utils=require(_0x50f9('0x6'));var logger=require(_0x50f9('0x7'))(_0x50f9('0x8'));var config=require(_0x50f9('0x9'));var jayson=require(_0x50f9('0xa'));var client=jayson[_0x50f9('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3b58f1,_0x3a0f5,_0x55f165){return new BPromise(function(_0x5918ab,_0x4d6b78){return client[_0x50f9('0xc')](_0x3b58f1,_0x55f165)[_0x50f9('0xd')](function(_0x22b16d){logger[_0x50f9('0xe')]('VoiceMail,\x20%s,\x20%s',_0x3a0f5,_0x50f9('0xf'));logger[_0x50f9('0x10')]('VoiceMail,\x20%s,\x20%s,\x20%s',_0x3a0f5,_0x50f9('0xf'),JSON[_0x50f9('0x11')](_0x22b16d));if(_0x22b16d[_0x50f9('0x12')]){if(_0x22b16d[_0x50f9('0x12')][_0x50f9('0x13')]===0x1f4){logger[_0x50f9('0x12')](_0x50f9('0x14'),_0x3a0f5,_0x22b16d[_0x50f9('0x12')][_0x50f9('0x15')]);return _0x4d6b78(_0x22b16d[_0x50f9('0x12')][_0x50f9('0x15')]);}logger['error']('VoiceMail,\x20%s,\x20%s',_0x3a0f5,_0x22b16d[_0x50f9('0x12')][_0x50f9('0x15')]);return _0x5918ab(_0x22b16d[_0x50f9('0x12')][_0x50f9('0x15')]);}else{logger[_0x50f9('0xe')](_0x50f9('0x14'),_0x3a0f5,_0x50f9('0xf'));_0x5918ab(_0x22b16d[_0x50f9('0x16')][_0x50f9('0x15')]);}})[_0x50f9('0x17')](function(_0x28dad0){logger[_0x50f9('0x12')](_0x50f9('0x14'),_0x3a0f5,_0x28dad0);_0x4d6b78(_0x28dad0);});});} \ No newline at end of file diff --git a/server/api/voiceMailMessage/index.js b/server/api/voiceMailMessage/index.js index 7efc278..9ad6f95 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 _0xa947=['/:id','isAuthenticated','show','/:id/download','post','create','update','destroy','exports','util','path','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceMailMessage.controller','get','index'];(function(_0x3f301f,_0x45b30d){var _0xffb0cb=function(_0x18acbe){while(--_0x18acbe){_0x3f301f['push'](_0x3f301f['shift']());}};_0xffb0cb(++_0x45b30d);}(_0xa947,0xb4));var _0x7a94=function(_0x4fd413,_0x41eb7f){_0x4fd413=_0x4fd413-0x0;var _0x967f64=_0xa947[_0x4fd413];return _0x967f64;};'use strict';var multer=require('multer');var util=require(_0x7a94('0x0'));var path=require(_0x7a94('0x1'));var timeout=require('connect-timeout');var express=require(_0x7a94('0x2'));var router=express[_0x7a94('0x3')]();var fs_extra=require(_0x7a94('0x4'));var auth=require(_0x7a94('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x7a94('0x6'));var controller=require(_0x7a94('0x7'));router[_0x7a94('0x8')]('/',auth['isAuthenticated'](),controller[_0x7a94('0x9')]);router['get'](_0x7a94('0xa'),auth[_0x7a94('0xb')](),controller[_0x7a94('0xc')]);router['get'](_0x7a94('0xd'),auth[_0x7a94('0xb')](),controller['download']);router[_0x7a94('0xe')]('/',auth[_0x7a94('0xb')](),controller[_0x7a94('0xf')]);router['put'](_0x7a94('0xa'),auth[_0x7a94('0xb')](),controller[_0x7a94('0x10')]);router['delete']('/:id',auth[_0x7a94('0xb')](),controller[_0x7a94('0x11')]);module[_0x7a94('0x12')]=router; \ No newline at end of file +var _0x39af=['download','post','create','update','delete','destroy','multer','util','path','connect-timeout','Router','../../components/interaction/service','../../config/environment','./voiceMailMessage.controller','get','isAuthenticated','/:id','/:id/download'];(function(_0x3da383,_0x1ac8af){var _0x34adf1=function(_0x29a80a){while(--_0x29a80a){_0x3da383['push'](_0x3da383['shift']());}};_0x34adf1(++_0x1ac8af);}(_0x39af,0x114));var _0xf39a=function(_0x20d96f,_0x1daea5){_0x20d96f=_0x20d96f-0x0;var _0x4c8ed6=_0x39af[_0x20d96f];return _0x4c8ed6;};'use strict';var multer=require(_0xf39a('0x0'));var util=require(_0xf39a('0x1'));var path=require(_0xf39a('0x2'));var timeout=require(_0xf39a('0x3'));var express=require('express');var router=express[_0xf39a('0x4')]();var fs_extra=require('fs-extra');var auth=require('../../components/auth/service');var interaction=require(_0xf39a('0x5'));var config=require(_0xf39a('0x6'));var controller=require(_0xf39a('0x7'));router[_0xf39a('0x8')]('/',auth[_0xf39a('0x9')](),controller['index']);router['get'](_0xf39a('0xa'),auth[_0xf39a('0x9')](),controller['show']);router[_0xf39a('0x8')](_0xf39a('0xb'),auth[_0xf39a('0x9')](),controller[_0xf39a('0xc')]);router[_0xf39a('0xd')]('/',auth[_0xf39a('0x9')](),controller[_0xf39a('0xe')]);router['put'](_0xf39a('0xa'),auth['isAuthenticated'](),controller[_0xf39a('0xf')]);router[_0xf39a('0x10')]('/:id',auth[_0xf39a('0x9')](),controller[_0xf39a('0x11')]);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.attributes.js b/server/api/voiceMailMessage/voiceMailMessage.attributes.js index 960a9db..c1c1e8e 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 _0xff69=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','getDataValue','STRING','BLOB','long','TIMESTAMP'];(function(_0x4669d9,_0x41938b){var _0x2a5406=function(_0x5e3b26){while(--_0x5e3b26){_0x4669d9['push'](_0x4669d9['shift']());}};_0x2a5406(++_0x41938b);}(_0xff69,0x107));var _0x9ff6=function(_0x138adb,_0x193fee){_0x138adb=_0x138adb-0x0;var _0x1b27f2=_0xff69[_0x138adb];return _0x1b27f2;};'use strict';var Sequelize=require(_0x9ff6('0x0'));module[_0x9ff6('0x1')]={'name':{'type':Sequelize['VIRTUAL'],'get':function(_0x2e54fa){return this[_0x9ff6('0x2')]('id');}},'msgnum':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0x9ff6('0x3')],'defaultValue':''},'context':{'type':Sequelize[_0x9ff6('0x3')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0x9ff6('0x3')],'defaultValue':''},'callerid':{'type':Sequelize[_0x9ff6('0x3')],'defaultValue':''},'origtime':{'type':Sequelize[_0x9ff6('0x3')],'defaultValue':''},'duration':{'type':Sequelize[_0x9ff6('0x3')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0x9ff6('0x3')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0x9ff6('0x3')],'defaultValue':''},'recording':{'type':Sequelize[_0x9ff6('0x4')](_0x9ff6('0x5')),'defaultValue':null},'flag':{'type':Sequelize[_0x9ff6('0x3')],'defaultValue':''},'msg_id':{'type':Sequelize['STRING'],'defaultValue':''},'stamp':{'type':_0x9ff6('0x6'),'defaultValue':Sequelize[_0x9ff6('0x7')](_0x9ff6('0x8'))}}; \ No newline at end of file +var _0x4c7d=['literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize','exports','VIRTUAL','INTEGER','STRING','BLOB','long','TIMESTAMP'];(function(_0x124cb6,_0x1f7143){var _0x291dbe=function(_0x1f1f28){while(--_0x1f1f28){_0x124cb6['push'](_0x124cb6['shift']());}};_0x291dbe(++_0x1f7143);}(_0x4c7d,0x7a));var _0xd4c7=function(_0x36c970,_0x20a41d){_0x36c970=_0x36c970-0x0;var _0x4c98f9=_0x4c7d[_0x36c970];return _0x4c98f9;};'use strict';var Sequelize=require(_0xd4c7('0x0'));module[_0xd4c7('0x1')]={'name':{'type':Sequelize[_0xd4c7('0x2')],'get':function(_0x4e22b2){return this['getDataValue']('id');}},'msgnum':{'type':Sequelize[_0xd4c7('0x3')](0xb),'defaultValue':0x0,'allowNull':![]},'dir':{'type':Sequelize[_0xd4c7('0x4')],'defaultValue':''},'context':{'type':Sequelize[_0xd4c7('0x4')],'defaultValue':''},'macrocontext':{'type':Sequelize[_0xd4c7('0x4')],'defaultValue':''},'callerid':{'type':Sequelize[_0xd4c7('0x4')],'defaultValue':''},'origtime':{'type':Sequelize[_0xd4c7('0x4')],'defaultValue':''},'duration':{'type':Sequelize[_0xd4c7('0x4')],'defaultValue':''},'mailboxuser':{'type':Sequelize[_0xd4c7('0x4')],'defaultValue':''},'mailboxcontext':{'type':Sequelize[_0xd4c7('0x4')],'defaultValue':''},'recording':{'type':Sequelize[_0xd4c7('0x5')](_0xd4c7('0x6')),'defaultValue':null},'flag':{'type':Sequelize[_0xd4c7('0x4')],'defaultValue':''},'msg_id':{'type':Sequelize[_0xd4c7('0x4')],'defaultValue':''},'stamp':{'type':_0xd4c7('0x7'),'defaultValue':Sequelize[_0xd4c7('0x8')](_0xd4c7('0x9'))}}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.controller.js b/server/api/voiceMailMessage/voiceMailMessage.controller.js index 309ba98..dc67f3f 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 _0xded4=['../../mysqldb','sendStatus','status','end','json','undefined','limit','count','offset','set','Content-Range','then','destroy','send','index','map','VoiceMailMessage','rawAttributes','fieldName','type','model','name','keys','query','filters','intersection','attributes','fields','hasOwnProperty','nolimit','order','sort','filter','where','merge','VIRTUAL','options','includeAll','include','findAll','rows','params','length','catch','create','body','find','download','recording','Sequelize','VoiceMailMessage\x20not\x20found','audio/wav','msg_id','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','request-promise','moment','bluebird','mustache','util','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','papaparse','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util'];(function(_0x41c842,_0x3865f6){var _0x15ee6b=function(_0x2505f5){while(--_0x2505f5){_0x41c842['push'](_0x41c842['shift']());}};_0x15ee6b(++_0x3865f6);}(_0xded4,0x1c8));var _0x4ded=function(_0x56cf93,_0x3c55d5){_0x56cf93=_0x56cf93-0x0;var _0x22aa5b=_0xded4[_0x56cf93];return _0x22aa5b;};'use strict';var emlformat=require(_0x4ded('0x0'));var rimraf=require(_0x4ded('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0x4ded('0x2'));var moment=require(_0x4ded('0x3'));var BPromise=require(_0x4ded('0x4'));var Mustache=require(_0x4ded('0x5'));var util=require(_0x4ded('0x6'));var path=require('path');var sox=require(_0x4ded('0x7'));var csv=require(_0x4ded('0x8'));var ejs=require(_0x4ded('0x9'));var fs=require('fs');var fs_extra=require(_0x4ded('0xa'));var _=require(_0x4ded('0xb'));var squel=require(_0x4ded('0xc'));var crypto=require(_0x4ded('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x4ded('0xe'));var toCsv=require(_0x4ded('0x8'));var querystring=require('querystring');var Papa=require(_0x4ded('0xf'));var Redis=require('ioredis');var authService=require(_0x4ded('0x10'));var qs=require('../../components/parsers/qs');var as=require(_0x4ded('0x11'));var hardwareService=require(_0x4ded('0x12'));var logger=require(_0x4ded('0x13'))(_0x4ded('0x14'));var utils=require(_0x4ded('0x15'));var config=require(_0x4ded('0x16'));var licenseUtil=require(_0x4ded('0x17'));var db=require(_0x4ded('0x18'))['db'];function respondWithStatusCode(_0x4b09d9,_0x2b6266){_0x2b6266=_0x2b6266||0xcc;return function(_0x3980a4){if(_0x3980a4){return _0x4b09d9[_0x4ded('0x19')](_0x2b6266);}return _0x4b09d9[_0x4ded('0x1a')](_0x2b6266)[_0x4ded('0x1b')]();};}function respondWithResult(_0xa94873,_0x34b347){_0x34b347=_0x34b347||0xc8;return function(_0x14bc07){if(_0x14bc07){return _0xa94873[_0x4ded('0x1a')](_0x34b347)[_0x4ded('0x1c')](_0x14bc07);}};}function respondWithFilteredResult(_0x3b6fef,_0x468c27){return function(_0x5c2ce8){if(_0x5c2ce8){var _0x2e2392=typeof _0x468c27['offset']===_0x4ded('0x1d')&&typeof _0x468c27[_0x4ded('0x1e')]==='undefined';var _0x1c2224=_0x5c2ce8[_0x4ded('0x1f')];var _0x1be0f9=_0x2e2392?0x0:_0x468c27[_0x4ded('0x20')];var _0xd1ecd9=_0x2e2392?_0x5c2ce8[_0x4ded('0x1f')]:_0x468c27['offset']+_0x468c27[_0x4ded('0x1e')];var _0x332435;if(_0xd1ecd9>=_0x1c2224){_0xd1ecd9=_0x1c2224;_0x332435=0xc8;}else{_0x332435=0xce;}_0x3b6fef[_0x4ded('0x1a')](_0x332435);return _0x3b6fef[_0x4ded('0x21')](_0x4ded('0x22'),_0x1be0f9+'-'+_0xd1ecd9+'/'+_0x1c2224)[_0x4ded('0x1c')](_0x5c2ce8);}return null;};}function patchUpdates(_0xa2216d){return function(_0x58a8ee){try{jsonpatch['apply'](_0x58a8ee,_0xa2216d,!![]);}catch(_0x49b247){return BPromise['reject'](_0x49b247);}return _0x58a8ee['save']();};}function saveUpdates(_0x507988,_0x574efb){return function(_0x580435){if(_0x580435){return _0x580435['update'](_0x507988)[_0x4ded('0x23')](function(_0x18dab4){return _0x18dab4;});}return null;};}function removeEntity(_0x12be9b,_0x3afe6e){return function(_0x3900cb){if(_0x3900cb){return _0x3900cb[_0x4ded('0x24')]()['then'](function(){_0x12be9b['status'](0xcc)[_0x4ded('0x1b')]();});}};}function handleEntityNotFound(_0x2fa087,_0x4044e6){return function(_0x4026fc){if(!_0x4026fc){_0x2fa087[_0x4ded('0x19')](0x194);}return _0x4026fc;};}function handleError(_0x32fd76,_0x4d9c56){_0x4d9c56=_0x4d9c56||0x1f4;return function(_0x3d40dd){logger['error'](_0x3d40dd['stack']);if(_0x3d40dd['name']){delete _0x3d40dd['name'];}_0x32fd76[_0x4ded('0x1a')](_0x4d9c56)[_0x4ded('0x25')](_0x3d40dd);};}exports[_0x4ded('0x26')]=function(_0x58a827,_0x418048){var _0x392642={},_0x1514bf={},_0x25a742={'count':0x0,'rows':[]};var _0x3595d2=_[_0x4ded('0x27')](db[_0x4ded('0x28')][_0x4ded('0x29')],function(_0x295797){return{'name':_0x295797[_0x4ded('0x2a')],'type':_0x295797[_0x4ded('0x2b')]['key']};});_0x1514bf[_0x4ded('0x2c')]=_['differenceBy'](_[_0x4ded('0x27')](_0x3595d2,_0x4ded('0x2d')),[_0x4ded('0x2d')]);_0x1514bf['query']=_[_0x4ded('0x2e')](_0x58a827[_0x4ded('0x2f')]);_0x1514bf[_0x4ded('0x30')]=_[_0x4ded('0x31')](_0x1514bf[_0x4ded('0x2c')],_0x1514bf[_0x4ded('0x2f')]);_0x392642[_0x4ded('0x32')]=_[_0x4ded('0x31')](_0x1514bf[_0x4ded('0x2c')],qs[_0x4ded('0x33')](_0x58a827[_0x4ded('0x2f')][_0x4ded('0x33')]));_0x392642[_0x4ded('0x32')]=_0x392642[_0x4ded('0x32')]['length']?_0x392642[_0x4ded('0x32')]:_0x1514bf[_0x4ded('0x2c')];if(!_0x58a827[_0x4ded('0x2f')][_0x4ded('0x34')](_0x4ded('0x35'))){_0x392642[_0x4ded('0x1e')]=qs[_0x4ded('0x1e')](_0x58a827[_0x4ded('0x2f')][_0x4ded('0x1e')]);_0x392642[_0x4ded('0x20')]=qs[_0x4ded('0x20')](_0x58a827[_0x4ded('0x2f')][_0x4ded('0x20')]);}_0x392642[_0x4ded('0x36')]=qs[_0x4ded('0x37')](_0x58a827[_0x4ded('0x2f')][_0x4ded('0x37')]);_0x392642['where']=qs[_0x4ded('0x30')](_['pick'](_0x58a827[_0x4ded('0x2f')],_0x1514bf[_0x4ded('0x30')]),_0x3595d2);if(_0x58a827['query'][_0x4ded('0x38')]){_0x392642[_0x4ded('0x39')]=_[_0x4ded('0x3a')](_0x392642[_0x4ded('0x39')],{'$or':_[_0x4ded('0x27')](_0x3595d2,function(_0x185c07){if(_0x185c07[_0x4ded('0x2b')]!==_0x4ded('0x3b')){var _0x51826c={};_0x51826c[_0x185c07[_0x4ded('0x2d')]]={'$like':'%'+_0x58a827[_0x4ded('0x2f')][_0x4ded('0x38')]+'%'};return _0x51826c;}})});}_0x392642=_[_0x4ded('0x3a')]({},_0x392642,_0x58a827[_0x4ded('0x3c')]);var _0x1cef8b={'where':_0x392642[_0x4ded('0x39')]};return db[_0x4ded('0x28')][_0x4ded('0x1f')](_0x1cef8b)[_0x4ded('0x23')](function(_0x310423){_0x25a742['count']=_0x310423;if(_0x58a827[_0x4ded('0x2f')][_0x4ded('0x3d')]){_0x392642[_0x4ded('0x3e')]=[{'all':!![]}];}return db['VoiceMailMessage'][_0x4ded('0x3f')](_0x392642);})[_0x4ded('0x23')](function(_0x4ead33){_0x25a742[_0x4ded('0x40')]=_0x4ead33;return _0x25a742;})[_0x4ded('0x23')](respondWithFilteredResult(_0x418048,_0x392642))['catch'](handleError(_0x418048,null));};exports['show']=function(_0x58257c,_0x29eabb){var _0x33bf6c={'raw':!![],'where':{'id':_0x58257c[_0x4ded('0x41')]['id']}},_0x535118={};_0x535118['model']=_[_0x4ded('0x2e')](db[_0x4ded('0x28')][_0x4ded('0x29')]);_0x535118[_0x4ded('0x2f')]=_[_0x4ded('0x2e')](_0x58257c[_0x4ded('0x2f')]);_0x535118[_0x4ded('0x30')]=_[_0x4ded('0x31')](_0x535118[_0x4ded('0x2c')],_0x535118['query']);_0x33bf6c[_0x4ded('0x32')]=_[_0x4ded('0x31')](_0x535118['model'],qs[_0x4ded('0x33')](_0x58257c['query'][_0x4ded('0x33')]));_0x33bf6c[_0x4ded('0x32')]=_0x33bf6c[_0x4ded('0x32')][_0x4ded('0x42')]?_0x33bf6c[_0x4ded('0x32')]:_0x535118[_0x4ded('0x2c')];if(_0x58257c[_0x4ded('0x2f')][_0x4ded('0x3d')]){_0x33bf6c[_0x4ded('0x3e')]=[{'all':!![]}];}_0x33bf6c=_[_0x4ded('0x3a')]({},_0x33bf6c,_0x58257c[_0x4ded('0x3c')]);return db[_0x4ded('0x28')]['find'](_0x33bf6c)['then'](handleEntityNotFound(_0x29eabb,null))['then'](respondWithResult(_0x29eabb,null))[_0x4ded('0x43')](handleError(_0x29eabb,null));};exports[_0x4ded('0x44')]=function(_0x444237,_0x42fcc9){return db[_0x4ded('0x28')][_0x4ded('0x44')](_0x444237[_0x4ded('0x45')],{})[_0x4ded('0x23')](respondWithResult(_0x42fcc9,0xc9))[_0x4ded('0x43')](handleError(_0x42fcc9,null));};exports['update']=function(_0x2fc767,_0x2a9c84){if(_0x2fc767['body']['id']){delete _0x2fc767['body']['id'];}return db[_0x4ded('0x28')]['find']({'where':{'id':_0x2fc767['params']['id']}})[_0x4ded('0x23')](handleEntityNotFound(_0x2a9c84,null))[_0x4ded('0x23')](saveUpdates(_0x2fc767['body'],null))['then'](respondWithResult(_0x2a9c84,null))[_0x4ded('0x43')](handleError(_0x2a9c84,null));};exports[_0x4ded('0x24')]=function(_0x2280e2,_0x3bd790){return db[_0x4ded('0x28')][_0x4ded('0x46')]({'where':{'id':_0x2280e2[_0x4ded('0x41')]['id']}})['then'](handleEntityNotFound(_0x3bd790,null))[_0x4ded('0x23')](removeEntity(_0x3bd790,null))[_0x4ded('0x43')](handleError(_0x3bd790,null));};exports[_0x4ded('0x47')]=function(_0x136ee7,_0x50e938,_0x282d7c){return db[_0x4ded('0x28')][_0x4ded('0x46')]({'where':{'id':_0x136ee7[_0x4ded('0x41')]['id']},'attributes':['id',_0x4ded('0x48'),'msg_id']})[_0x4ded('0x23')](handleEntityNotFound(_0x50e938,null))['then'](function(_0x225088){if(_0x225088){if(!_0x225088[_0x4ded('0x48')]){throw new db[(_0x4ded('0x49'))]['ValidationError'](_0x4ded('0x4a'));}var _0x177ca8={'Content-Type':_0x4ded('0x4b'),'Content-Disposition':'attachment'};if(_0x225088[_0x4ded('0x4c')]){_0x177ca8[_0x4ded('0x4d')]=_0x4ded('0x4e')+_0x225088[_0x4ded('0x4c')]+_0x4ded('0x4f');}_0x50e938[_0x4ded('0x21')](_0x177ca8);return _0x50e938['send'](new Buffer(_0x225088[_0x4ded('0x48')]));}})[_0x4ded('0x43')](handleError(_0x50e938,null));}; \ No newline at end of file +var _0xf7a7=['download','msg_id','recording','Sequelize','ValidationError','VoiceMailMessage\x20not\x20found','Content-Disposition','attachment;\x20filename=\x22','.wav\x22','eml-format','rimraf','zip-dir','bluebird','mustache','path','to-csv','fs-extra','lodash','squel','crypto','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','error','name','send','index','map','VoiceMailMessage','fieldName','type','key','differenceBy','query','filters','model','attributes','intersection','fields','length','hasOwnProperty','order','sort','where','filter','merge','VIRTUAL','options','include','rows','catch','show','params','keys','find','create','body'];(function(_0x147c2b,_0x4bf85a){var _0x1ae2d9=function(_0x1e2fab){while(--_0x1e2fab){_0x147c2b['push'](_0x147c2b['shift']());}};_0x1ae2d9(++_0x4bf85a);}(_0xf7a7,0x199));var _0x7f7a=function(_0x5329d2,_0x268198){_0x5329d2=_0x5329d2-0x0;var _0x28218d=_0xf7a7[_0x5329d2];return _0x28218d;};'use strict';var emlformat=require(_0x7f7a('0x0'));var rimraf=require(_0x7f7a('0x1'));var zipdir=require(_0x7f7a('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x7f7a('0x3'));var Mustache=require(_0x7f7a('0x4'));var util=require('util');var path=require(_0x7f7a('0x5'));var sox=require('sox');var csv=require(_0x7f7a('0x6'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x7f7a('0x7'));var _=require(_0x7f7a('0x8'));var squel=require(_0x7f7a('0x9'));var crypto=require(_0x7f7a('0xa'));var jsforce=require('jsforce');var deskjs=require('desk.js');var toCsv=require('to-csv');var querystring=require(_0x7f7a('0xb'));var Papa=require(_0x7f7a('0xc'));var Redis=require(_0x7f7a('0xd'));var authService=require(_0x7f7a('0xe'));var qs=require(_0x7f7a('0xf'));var as=require(_0x7f7a('0x10'));var hardwareService=require(_0x7f7a('0x11'));var logger=require(_0x7f7a('0x12'))(_0x7f7a('0x13'));var utils=require('../../config/utils');var config=require('../../config/environment');var licenseUtil=require(_0x7f7a('0x14'));var db=require(_0x7f7a('0x15'))['db'];function respondWithStatusCode(_0x43b559,_0x5e2ed3){_0x5e2ed3=_0x5e2ed3||0xcc;return function(_0x1615d4){if(_0x1615d4){return _0x43b559[_0x7f7a('0x16')](_0x5e2ed3);}return _0x43b559[_0x7f7a('0x17')](_0x5e2ed3)['end']();};}function respondWithResult(_0xbf47a3,_0x5709f9){_0x5709f9=_0x5709f9||0xc8;return function(_0x36d5e6){if(_0x36d5e6){return _0xbf47a3[_0x7f7a('0x17')](_0x5709f9)[_0x7f7a('0x18')](_0x36d5e6);}};}function respondWithFilteredResult(_0x47f8f0,_0x29122e){return function(_0x21463b){if(_0x21463b){var _0x4847ab=typeof _0x29122e[_0x7f7a('0x19')]===_0x7f7a('0x1a')&&typeof _0x29122e[_0x7f7a('0x1b')]==='undefined';var _0x14c6f7=_0x21463b['count'];var _0x372d66=_0x4847ab?0x0:_0x29122e[_0x7f7a('0x19')];var _0x5d2e72=_0x4847ab?_0x21463b[_0x7f7a('0x1c')]:_0x29122e['offset']+_0x29122e[_0x7f7a('0x1b')];var _0x45192;if(_0x5d2e72>=_0x14c6f7){_0x5d2e72=_0x14c6f7;_0x45192=0xc8;}else{_0x45192=0xce;}_0x47f8f0[_0x7f7a('0x17')](_0x45192);return _0x47f8f0[_0x7f7a('0x1d')](_0x7f7a('0x1e'),_0x372d66+'-'+_0x5d2e72+'/'+_0x14c6f7)[_0x7f7a('0x18')](_0x21463b);}return null;};}function patchUpdates(_0x2ed291){return function(_0x5b84b2){try{jsonpatch[_0x7f7a('0x1f')](_0x5b84b2,_0x2ed291,!![]);}catch(_0x31bca2){return BPromise[_0x7f7a('0x20')](_0x31bca2);}return _0x5b84b2[_0x7f7a('0x21')]();};}function saveUpdates(_0x188612,_0x4b9302){return function(_0x4c2329){if(_0x4c2329){return _0x4c2329[_0x7f7a('0x22')](_0x188612)['then'](function(_0xa49f42){return _0xa49f42;});}return null;};}function removeEntity(_0x438ff1,_0x37e619){return function(_0x3ef1e4){if(_0x3ef1e4){return _0x3ef1e4[_0x7f7a('0x23')]()[_0x7f7a('0x24')](function(){_0x438ff1[_0x7f7a('0x17')](0xcc)['end']();});}};}function handleEntityNotFound(_0x36aadc,_0x50ef08){return function(_0x4fbdc7){if(!_0x4fbdc7){_0x36aadc[_0x7f7a('0x16')](0x194);}return _0x4fbdc7;};}function handleError(_0x52d3a0,_0x379170){_0x379170=_0x379170||0x1f4;return function(_0x137af5){logger[_0x7f7a('0x25')](_0x137af5['stack']);if(_0x137af5[_0x7f7a('0x26')]){delete _0x137af5[_0x7f7a('0x26')];}_0x52d3a0[_0x7f7a('0x17')](_0x379170)[_0x7f7a('0x27')](_0x137af5);};}exports[_0x7f7a('0x28')]=function(_0x55bbd6,_0x5ab85a){var _0x584e4d={},_0x14cc97={},_0x33371d={'count':0x0,'rows':[]};var _0x35381b=_[_0x7f7a('0x29')](db[_0x7f7a('0x2a')]['rawAttributes'],function(_0x2b7456){return{'name':_0x2b7456[_0x7f7a('0x2b')],'type':_0x2b7456[_0x7f7a('0x2c')][_0x7f7a('0x2d')]};});_0x14cc97['model']=_[_0x7f7a('0x2e')](_[_0x7f7a('0x29')](_0x35381b,_0x7f7a('0x26')),[_0x7f7a('0x26')]);_0x14cc97['query']=_['keys'](_0x55bbd6[_0x7f7a('0x2f')]);_0x14cc97[_0x7f7a('0x30')]=_['intersection'](_0x14cc97[_0x7f7a('0x31')],_0x14cc97[_0x7f7a('0x2f')]);_0x584e4d[_0x7f7a('0x32')]=_[_0x7f7a('0x33')](_0x14cc97[_0x7f7a('0x31')],qs[_0x7f7a('0x34')](_0x55bbd6[_0x7f7a('0x2f')][_0x7f7a('0x34')]));_0x584e4d[_0x7f7a('0x32')]=_0x584e4d['attributes'][_0x7f7a('0x35')]?_0x584e4d[_0x7f7a('0x32')]:_0x14cc97['model'];if(!_0x55bbd6[_0x7f7a('0x2f')][_0x7f7a('0x36')]('nolimit')){_0x584e4d[_0x7f7a('0x1b')]=qs[_0x7f7a('0x1b')](_0x55bbd6[_0x7f7a('0x2f')][_0x7f7a('0x1b')]);_0x584e4d[_0x7f7a('0x19')]=qs[_0x7f7a('0x19')](_0x55bbd6[_0x7f7a('0x2f')][_0x7f7a('0x19')]);}_0x584e4d[_0x7f7a('0x37')]=qs[_0x7f7a('0x38')](_0x55bbd6[_0x7f7a('0x2f')]['sort']);_0x584e4d[_0x7f7a('0x39')]=qs['filters'](_['pick'](_0x55bbd6[_0x7f7a('0x2f')],_0x14cc97[_0x7f7a('0x30')]),_0x35381b);if(_0x55bbd6['query'][_0x7f7a('0x3a')]){_0x584e4d[_0x7f7a('0x39')]=_[_0x7f7a('0x3b')](_0x584e4d['where'],{'$or':_[_0x7f7a('0x29')](_0x35381b,function(_0x5560a4){if(_0x5560a4['type']!==_0x7f7a('0x3c')){var _0x16736f={};_0x16736f[_0x5560a4['name']]={'$like':'%'+_0x55bbd6[_0x7f7a('0x2f')]['filter']+'%'};return _0x16736f;}})});}_0x584e4d=_[_0x7f7a('0x3b')]({},_0x584e4d,_0x55bbd6[_0x7f7a('0x3d')]);var _0x2e281c={'where':_0x584e4d[_0x7f7a('0x39')]};return db[_0x7f7a('0x2a')]['count'](_0x2e281c)[_0x7f7a('0x24')](function(_0x52a077){_0x33371d[_0x7f7a('0x1c')]=_0x52a077;if(_0x55bbd6['query']['includeAll']){_0x584e4d[_0x7f7a('0x3e')]=[{'all':!![]}];}return db[_0x7f7a('0x2a')]['findAll'](_0x584e4d);})[_0x7f7a('0x24')](function(_0x5395af){_0x33371d[_0x7f7a('0x3f')]=_0x5395af;return _0x33371d;})['then'](respondWithFilteredResult(_0x5ab85a,_0x584e4d))[_0x7f7a('0x40')](handleError(_0x5ab85a,null));};exports[_0x7f7a('0x41')]=function(_0x23dcab,_0x64b1ff){var _0x5ea134={'raw':!![],'where':{'id':_0x23dcab[_0x7f7a('0x42')]['id']}},_0x5663eb={};_0x5663eb[_0x7f7a('0x31')]=_[_0x7f7a('0x43')](db[_0x7f7a('0x2a')]['rawAttributes']);_0x5663eb['query']=_[_0x7f7a('0x43')](_0x23dcab[_0x7f7a('0x2f')]);_0x5663eb[_0x7f7a('0x30')]=_['intersection'](_0x5663eb[_0x7f7a('0x31')],_0x5663eb[_0x7f7a('0x2f')]);_0x5ea134['attributes']=_[_0x7f7a('0x33')](_0x5663eb[_0x7f7a('0x31')],qs['fields'](_0x23dcab[_0x7f7a('0x2f')][_0x7f7a('0x34')]));_0x5ea134[_0x7f7a('0x32')]=_0x5ea134[_0x7f7a('0x32')][_0x7f7a('0x35')]?_0x5ea134['attributes']:_0x5663eb[_0x7f7a('0x31')];if(_0x23dcab[_0x7f7a('0x2f')]['includeAll']){_0x5ea134[_0x7f7a('0x3e')]=[{'all':!![]}];}_0x5ea134=_[_0x7f7a('0x3b')]({},_0x5ea134,_0x23dcab[_0x7f7a('0x3d')]);return db[_0x7f7a('0x2a')][_0x7f7a('0x44')](_0x5ea134)[_0x7f7a('0x24')](handleEntityNotFound(_0x64b1ff,null))[_0x7f7a('0x24')](respondWithResult(_0x64b1ff,null))[_0x7f7a('0x40')](handleError(_0x64b1ff,null));};exports[_0x7f7a('0x45')]=function(_0x382cd1,_0x89ff71){return db['VoiceMailMessage'][_0x7f7a('0x45')](_0x382cd1[_0x7f7a('0x46')],{})['then'](respondWithResult(_0x89ff71,0xc9))[_0x7f7a('0x40')](handleError(_0x89ff71,null));};exports['update']=function(_0x53177d,_0x380664){if(_0x53177d['body']['id']){delete _0x53177d[_0x7f7a('0x46')]['id'];}return db[_0x7f7a('0x2a')][_0x7f7a('0x44')]({'where':{'id':_0x53177d[_0x7f7a('0x42')]['id']}})[_0x7f7a('0x24')](handleEntityNotFound(_0x380664,null))[_0x7f7a('0x24')](saveUpdates(_0x53177d[_0x7f7a('0x46')],null))[_0x7f7a('0x24')](respondWithResult(_0x380664,null))[_0x7f7a('0x40')](handleError(_0x380664,null));};exports[_0x7f7a('0x23')]=function(_0x48cefa,_0x333808){return db[_0x7f7a('0x2a')][_0x7f7a('0x44')]({'where':{'id':_0x48cefa[_0x7f7a('0x42')]['id']}})[_0x7f7a('0x24')](handleEntityNotFound(_0x333808,null))[_0x7f7a('0x24')](removeEntity(_0x333808,null))[_0x7f7a('0x40')](handleError(_0x333808,null));};exports[_0x7f7a('0x47')]=function(_0x436d7a,_0xd56a9f,_0x1863c4){return db['VoiceMailMessage']['find']({'where':{'id':_0x436d7a[_0x7f7a('0x42')]['id']},'attributes':['id','recording',_0x7f7a('0x48')]})[_0x7f7a('0x24')](handleEntityNotFound(_0xd56a9f,null))[_0x7f7a('0x24')](function(_0x2492af){if(_0x2492af){if(!_0x2492af[_0x7f7a('0x49')]){throw new db[(_0x7f7a('0x4a'))][(_0x7f7a('0x4b'))](_0x7f7a('0x4c'));}var _0x2049a0={'Content-Type':'audio/wav','Content-Disposition':'attachment'};if(_0x2492af['msg_id']){_0x2049a0[_0x7f7a('0x4d')]=_0x7f7a('0x4e')+_0x2492af[_0x7f7a('0x48')]+_0x7f7a('0x4f');}_0xd56a9f[_0x7f7a('0x1d')](_0x2049a0);return _0xd56a9f[_0x7f7a('0x27')](new Buffer(_0x2492af['recording']));}})['catch'](handleError(_0xd56a9f,null));}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.model.js b/server/api/voiceMailMessage/voiceMailMessage.model.js index df94342..29859fa 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 _0x4c42=['exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceMailMessage.attributes'];(function(_0x27cbbd,_0x308544){var _0x529b59=function(_0x54200f){while(--_0x54200f){_0x27cbbd['push'](_0x27cbbd['shift']());}};_0x529b59(++_0x308544);}(_0x4c42,0x10f));var _0x24c4=function(_0x21462d,_0x2ef078){_0x21462d=_0x21462d-0x0;var _0x552f7d=_0x4c42[_0x21462d];return _0x552f7d;};'use strict';var _=require(_0x24c4('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x24c4('0x1'));var moment=require(_0x24c4('0x2'));var BPromise=require(_0x24c4('0x3'));var rp=require(_0x24c4('0x4'));var fs=require('fs');var path=require(_0x24c4('0x5'));var rimraf=require(_0x24c4('0x6'));var config=require(_0x24c4('0x7'));var attributes=require(_0x24c4('0x8'));module[_0x24c4('0x9')]=function(_0x435fe0,_0x15e472){return _0x435fe0[_0x24c4('0xa')](_0x24c4('0xb'),attributes,{'tableName':_0x24c4('0xc'),'paranoid':![],'indexes':[{'name':_0x24c4('0xd'),'fields':[_0x24c4('0xd')]}],'timestamps':![]});}; \ No newline at end of file +var _0x1a74=['bluebird','path','../../config/environment','./voiceMailMessage.attributes','exports','define','VoiceMailMessage','voice_voicemail_messages','dir','lodash','util','api'];(function(_0x487fd5,_0x2390f0){var _0x12081d=function(_0x4a67be){while(--_0x4a67be){_0x487fd5['push'](_0x487fd5['shift']());}};_0x12081d(++_0x2390f0);}(_0x1a74,0x17d));var _0x41a7=function(_0x3c902d,_0x60924e){_0x3c902d=_0x3c902d-0x0;var _0x4fe3f9=_0x1a74[_0x3c902d];return _0x4fe3f9;};'use strict';var _=require(_0x41a7('0x0'));var util=require(_0x41a7('0x1'));var logger=require('../../config/logger')(_0x41a7('0x2'));var moment=require('moment');var BPromise=require(_0x41a7('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x41a7('0x4'));var rimraf=require('rimraf');var config=require(_0x41a7('0x5'));var attributes=require(_0x41a7('0x6'));module[_0x41a7('0x7')]=function(_0x120fc3,_0x59a54a){return _0x120fc3[_0x41a7('0x8')](_0x41a7('0x9'),attributes,{'tableName':_0x41a7('0xa'),'paranoid':![],'indexes':[{'name':_0x41a7('0xb'),'fields':['dir']}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceMailMessage/voiceMailMessage.rpc.js b/server/api/voiceMailMessage/voiceMailMessage.rpc.js index d9c8f35..586e641 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 _0xe3b6=['client','http','request','then','info','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x526df5,_0x2d707c){var _0x3eb67b=function(_0x43b1c7){while(--_0x43b1c7){_0x526df5['push'](_0x526df5['shift']());}};_0x3eb67b(++_0x2d707c);}(_0xe3b6,0x14f));var _0x6e3b=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0xe3b6[_0xae7c2f];return _0x5d7001;};'use strict';var _=require(_0x6e3b('0x0'));var util=require(_0x6e3b('0x1'));var moment=require(_0x6e3b('0x2'));var BPromise=require('bluebird');var rs=require(_0x6e3b('0x3'));var fs=require('fs');var Redis=require(_0x6e3b('0x4'));var db=require(_0x6e3b('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x6e3b('0x6'))(_0x6e3b('0x7'));var config=require(_0x6e3b('0x8'));var jayson=require(_0x6e3b('0x9'));var client=jayson[_0x6e3b('0xa')][_0x6e3b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2bb955,_0x54ac32,_0x1f68f9){return new BPromise(function(_0x52605d,_0x215d93){return client[_0x6e3b('0xc')](_0x2bb955,_0x1f68f9)[_0x6e3b('0xd')](function(_0xc83988){logger[_0x6e3b('0xe')](_0x6e3b('0xf'),_0x54ac32,_0x6e3b('0x10'));logger['debug'](_0x6e3b('0x11'),_0x54ac32,_0x6e3b('0x10'),JSON[_0x6e3b('0x12')](_0xc83988));if(_0xc83988[_0x6e3b('0x13')]){if(_0xc83988['error'][_0x6e3b('0x14')]===0x1f4){logger[_0x6e3b('0x13')](_0x6e3b('0xf'),_0x54ac32,_0xc83988[_0x6e3b('0x13')][_0x6e3b('0x15')]);return _0x215d93(_0xc83988[_0x6e3b('0x13')][_0x6e3b('0x15')]);}logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x54ac32,_0xc83988[_0x6e3b('0x13')]['message']);return _0x52605d(_0xc83988[_0x6e3b('0x13')][_0x6e3b('0x15')]);}else{logger[_0x6e3b('0xe')]('VoiceMailMessage,\x20%s,\x20%s',_0x54ac32,_0x6e3b('0x10'));_0x52605d(_0xc83988['result'][_0x6e3b('0x15')]);}})[_0x6e3b('0x16')](function(_0x58ec16){logger['error']('VoiceMailMessage,\x20%s,\x20%s',_0x54ac32,_0x58ec16);_0x215d93(_0x58ec16);});});} \ No newline at end of file +var _0x79a5=['client','request','then','VoiceMailMessage,\x20%s,\x20%s','request\x20sent','debug','VoiceMailMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x79a5,0xf3));var _0x579a=function(_0x1477ef,_0x54a5d6){_0x1477ef=_0x1477ef-0x0;var _0x164acd=_0x79a5[_0x1477ef];return _0x164acd;};'use strict';var _=require(_0x579a('0x0'));var util=require(_0x579a('0x1'));var moment=require(_0x579a('0x2'));var BPromise=require(_0x579a('0x3'));var rs=require(_0x579a('0x4'));var fs=require('fs');var Redis=require(_0x579a('0x5'));var db=require(_0x579a('0x6'))['db'];var utils=require(_0x579a('0x7'));var logger=require('../../config/logger')(_0x579a('0x8'));var config=require('../../config/environment');var jayson=require(_0x579a('0x9'));var client=jayson[_0x579a('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b4b73,_0x29a0ab,_0x828f3a){return new BPromise(function(_0x392414,_0xbce442){return client[_0x579a('0xb')](_0x1b4b73,_0x828f3a)[_0x579a('0xc')](function(_0x11cab7){logger['info'](_0x579a('0xd'),_0x29a0ab,_0x579a('0xe'));logger[_0x579a('0xf')](_0x579a('0x10'),_0x29a0ab,_0x579a('0xe'),JSON[_0x579a('0x11')](_0x11cab7));if(_0x11cab7['error']){if(_0x11cab7[_0x579a('0x12')][_0x579a('0x13')]===0x1f4){logger[_0x579a('0x12')](_0x579a('0xd'),_0x29a0ab,_0x11cab7[_0x579a('0x12')]['message']);return _0xbce442(_0x11cab7[_0x579a('0x12')][_0x579a('0x14')]);}logger[_0x579a('0x12')](_0x579a('0xd'),_0x29a0ab,_0x11cab7[_0x579a('0x12')][_0x579a('0x14')]);return _0x392414(_0x11cab7[_0x579a('0x12')][_0x579a('0x14')]);}else{logger[_0x579a('0x15')]('VoiceMailMessage,\x20%s,\x20%s',_0x29a0ab,_0x579a('0xe'));_0x392414(_0x11cab7[_0x579a('0x16')][_0x579a('0x14')]);}})['catch'](function(_0xb5d5c){logger['error'](_0x579a('0xd'),_0x29a0ab,_0xb5d5c);_0xbce442(_0xb5d5c);});});} \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/index.js b/server/api/voiceMusicOnHold/index.js index 9786bdf..44a822a 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 _0x4b12=['util','path','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','/:id/sounds','getSounds','create','post','put','delete','destroy','removeSound','exports'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x4b12,0x1e3));var _0x24b1=function(_0x393c0a,_0x419fb8){_0x393c0a=_0x393c0a-0x0;var _0x3dffed=_0x4b12[_0x393c0a];return _0x3dffed;};'use strict';var multer=require('multer');var util=require(_0x24b1('0x0'));var path=require(_0x24b1('0x1'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x24b1('0x2')]();var fs_extra=require(_0x24b1('0x3'));var auth=require(_0x24b1('0x4'));var interaction=require(_0x24b1('0x5'));var config=require(_0x24b1('0x6'));var controller=require(_0x24b1('0x7'));router[_0x24b1('0x8')]('/',auth['isAuthenticated'](),controller[_0x24b1('0x9')]);router['get'](_0x24b1('0xa'),auth[_0x24b1('0xb')](),controller['show']);router[_0x24b1('0x8')](_0x24b1('0xc'),auth[_0x24b1('0xb')](),controller[_0x24b1('0xd')]);router['post']('/',auth['isAuthenticated'](),controller[_0x24b1('0xe')]);router[_0x24b1('0xf')](_0x24b1('0xc'),auth[_0x24b1('0xb')](),controller['addSound']);router[_0x24b1('0x10')](_0x24b1('0xa'),auth[_0x24b1('0xb')](),controller['update']);router[_0x24b1('0x11')]('/:id',auth[_0x24b1('0xb')](),controller[_0x24b1('0x12')]);router[_0x24b1('0x11')]('/:id/sounds/:id2',auth[_0x24b1('0xb')](),controller[_0x24b1('0x13')]);module[_0x24b1('0x14')]=router; \ No newline at end of file +var _0x9c41=['destroy','/:id/sounds/:id2','multer','util','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceMusicOnHold.controller','get','index','/:id','isAuthenticated','show','/:id/sounds','getSounds','post','create','put','update','delete'];(function(_0x50abe3,_0x1dcac0){var _0x46a8b0=function(_0x5ee106){while(--_0x5ee106){_0x50abe3['push'](_0x50abe3['shift']());}};_0x46a8b0(++_0x1dcac0);}(_0x9c41,0xda));var _0x19c4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x9c41[_0x14add3];return _0x4a174f;};'use strict';var multer=require(_0x19c4('0x0'));var util=require(_0x19c4('0x1'));var path=require(_0x19c4('0x2'));var timeout=require(_0x19c4('0x3'));var express=require(_0x19c4('0x4'));var router=express['Router']();var fs_extra=require(_0x19c4('0x5'));var auth=require(_0x19c4('0x6'));var interaction=require(_0x19c4('0x7'));var config=require(_0x19c4('0x8'));var controller=require(_0x19c4('0x9'));router[_0x19c4('0xa')]('/',auth['isAuthenticated'](),controller[_0x19c4('0xb')]);router['get'](_0x19c4('0xc'),auth[_0x19c4('0xd')](),controller[_0x19c4('0xe')]);router[_0x19c4('0xa')](_0x19c4('0xf'),auth['isAuthenticated'](),controller[_0x19c4('0x10')]);router[_0x19c4('0x11')]('/',auth['isAuthenticated'](),controller[_0x19c4('0x12')]);router[_0x19c4('0x11')](_0x19c4('0xf'),auth[_0x19c4('0xd')](),controller['addSound']);router[_0x19c4('0x13')](_0x19c4('0xc'),auth['isAuthenticated'](),controller[_0x19c4('0x14')]);router[_0x19c4('0x15')](_0x19c4('0xc'),auth[_0x19c4('0xd')](),controller[_0x19c4('0x16')]);router[_0x19c4('0x15')](_0x19c4('0x17'),auth[_0x19c4('0xd')](),controller['removeSound']);module['exports']=router; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.attributes.js index 0e12b10..c3a4ff0 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 _0x9a62=['TIMESTAMP','BOOLEAN','sequelize','exports','STRING','name','ENUM','custom','files','quietmp3nb','quietmp3','mp3'];(function(_0x275dd9,_0x3465b7){var _0xb2c74b=function(_0x20cb00){while(--_0x20cb00){_0x275dd9['push'](_0x275dd9['shift']());}};_0xb2c74b(++_0x3465b7);}(_0x9a62,0x1be));var _0x29a6=function(_0x4a9fb1,_0x273043){_0x4a9fb1=_0x4a9fb1-0x0;var _0x348672=_0x9a62[_0x4a9fb1];return _0x348672;};'use strict';var Sequelize=require(_0x29a6('0x0'));module[_0x29a6('0x1')]={'name':{'type':Sequelize[_0x29a6('0x2')],'allowNull':![],'unique':_0x29a6('0x3')},'mode':{'type':Sequelize[_0x29a6('0x4')](_0x29a6('0x5'),_0x29a6('0x6'),'mp3nb',_0x29a6('0x7'),_0x29a6('0x8'),_0x29a6('0x9')),'allowNull':!![],'defaultValue':_0x29a6('0x6')},'directory':{'type':Sequelize[_0x29a6('0x2')],'allowNull':!![]},'application':{'type':Sequelize[_0x29a6('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0x29a6('0x2')],'allowNull':!![]},'sort':{'type':Sequelize['STRING'],'allowNull':!![],'defaultValue':'alpha'},'format':{'type':Sequelize[_0x29a6('0x2')],'allowNull':!![]},'stamp':{'type':_0x29a6('0xa')},'defaultEntry':{'type':Sequelize[_0x29a6('0xb')],'defaultValue':0x0}}; \ No newline at end of file +var _0x5e0a=['quietmp3','mp3','alpha','sequelize','exports','STRING','name','ENUM','custom','files','quietmp3nb'];(function(_0x32d457,_0x1a39c9){var _0x338386=function(_0x199d7a){while(--_0x199d7a){_0x32d457['push'](_0x32d457['shift']());}};_0x338386(++_0x1a39c9);}(_0x5e0a,0x1e7));var _0xa5e0=function(_0x142891,_0x4ab8b4){_0x142891=_0x142891-0x0;var _0x20a5e2=_0x5e0a[_0x142891];return _0x20a5e2;};'use strict';var Sequelize=require(_0xa5e0('0x0'));module[_0xa5e0('0x1')]={'name':{'type':Sequelize[_0xa5e0('0x2')],'allowNull':![],'unique':_0xa5e0('0x3')},'mode':{'type':Sequelize[_0xa5e0('0x4')](_0xa5e0('0x5'),_0xa5e0('0x6'),'mp3nb',_0xa5e0('0x7'),_0xa5e0('0x8'),_0xa5e0('0x9')),'allowNull':!![],'defaultValue':'files'},'directory':{'type':Sequelize['STRING'],'allowNull':!![]},'application':{'type':Sequelize[_0xa5e0('0x2')],'allowNull':!![]},'digit':{'type':Sequelize[_0xa5e0('0x2')],'allowNull':!![]},'sort':{'type':Sequelize[_0xa5e0('0x2')],'allowNull':!![],'defaultValue':_0xa5e0('0xa')},'format':{'type':Sequelize['STRING'],'allowNull':!![]},'stamp':{'type':'TIMESTAMP'},'defaultEntry':{'type':Sequelize['BOOLEAN'],'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 0841186..a4513c9 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 _0x2b7f=['createdAt','server/files/sounds/converted','format','%s.%s','basename','save_name','extname','symlinkSync','removeSound','id2','unlinkSync','getSounds','intersection','nolimit','eml-format','rimraf','zip-dir','moment','bluebird','util','to-csv','ejs','fs-extra','squel','crypto','desk.js','querystring','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','then','get','MusicOnHolds','UserProfileResource','status','stack','name','map','VoiceMusicOnHold','rawAttributes','type','model','query','filters','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','options','includeAll','include','findAll','catch','params','keys','find','body','create','sequelize','transaction','mode','files','directory','join','root','server/files/moh','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','forEach','rmdirSync','Sequelize','ValidationError','message','addSound','Sound','findOne','converted_format'];(function(_0x4994f8,_0x25ee28){var _0x22d2b2=function(_0x216878){while(--_0x216878){_0x4994f8['push'](_0x4994f8['shift']());}};_0x22d2b2(++_0x25ee28);}(_0x2b7f,0x1be));var _0xf2b7=function(_0x400506,_0x135f82){_0x400506=_0x400506-0x0;var _0x1cb903=_0x2b7f[_0x400506];return _0x1cb903;};'use strict';var emlformat=require(_0xf2b7('0x0'));var rimraf=require(_0xf2b7('0x1'));var zipdir=require(_0xf2b7('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0xf2b7('0x3'));var BPromise=require(_0xf2b7('0x4'));var Mustache=require('mustache');var util=require(_0xf2b7('0x5'));var path=require('path');var sox=require('sox');var csv=require(_0xf2b7('0x6'));var ejs=require(_0xf2b7('0x7'));var fs=require('fs');var fs_extra=require(_0xf2b7('0x8'));var _=require('lodash');var squel=require(_0xf2b7('0x9'));var crypto=require(_0xf2b7('0xa'));var jsforce=require('jsforce');var deskjs=require(_0xf2b7('0xb'));var toCsv=require(_0xf2b7('0x6'));var querystring=require(_0xf2b7('0xc'));var Papa=require('papaparse');var Redis=require(_0xf2b7('0xd'));var authService=require('../../components/auth/service');var qs=require(_0xf2b7('0xe'));var as=require(_0xf2b7('0xf'));var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0xf2b7('0x10'));var utils=require(_0xf2b7('0x11'));var config=require(_0xf2b7('0x12'));var licenseUtil=require(_0xf2b7('0x13'));var db=require(_0xf2b7('0x14'))['db'];function respondWithStatusCode(_0x594071,_0x4a5d35){_0x4a5d35=_0x4a5d35||0xcc;return function(_0x5c9a6a){if(_0x5c9a6a){return _0x594071[_0xf2b7('0x15')](_0x4a5d35);}return _0x594071['status'](_0x4a5d35)[_0xf2b7('0x16')]();};}function respondWithResult(_0x3c47cc,_0x3862b3){_0x3862b3=_0x3862b3||0xc8;return function(_0x5b26c5){if(_0x5b26c5){return _0x3c47cc['status'](_0x3862b3)[_0xf2b7('0x17')](_0x5b26c5);}};}function respondWithFilteredResult(_0x4ace09,_0xeb006a){return function(_0x2a4faf){if(_0x2a4faf){var _0x1aa579=typeof _0xeb006a[_0xf2b7('0x18')]===_0xf2b7('0x19')&&typeof _0xeb006a[_0xf2b7('0x1a')]===_0xf2b7('0x19');var _0xaa8970=_0x2a4faf[_0xf2b7('0x1b')];var _0x48553d=_0x1aa579?0x0:_0xeb006a['offset'];var _0x1326ee=_0x1aa579?_0x2a4faf[_0xf2b7('0x1b')]:_0xeb006a['offset']+_0xeb006a[_0xf2b7('0x1a')];var _0x1dd30c;if(_0x1326ee>=_0xaa8970){_0x1326ee=_0xaa8970;_0x1dd30c=0xc8;}else{_0x1dd30c=0xce;}_0x4ace09['status'](_0x1dd30c);return _0x4ace09[_0xf2b7('0x1c')](_0xf2b7('0x1d'),_0x48553d+'-'+_0x1326ee+'/'+_0xaa8970)[_0xf2b7('0x17')](_0x2a4faf);}return null;};}function patchUpdates(_0x2e9368){return function(_0x3b233b){try{jsonpatch[_0xf2b7('0x1e')](_0x3b233b,_0x2e9368,!![]);}catch(_0x2fdd57){return BPromise[_0xf2b7('0x1f')](_0x2fdd57);}return _0x3b233b[_0xf2b7('0x20')]();};}function saveUpdates(_0x4424e7,_0x4096db){return function(_0x2b8ac6){if(_0x2b8ac6){return _0x2b8ac6[_0xf2b7('0x21')](_0x4424e7)['then'](function(_0x447a0c){return _0x447a0c;});}return null;};}function removeEntity(_0x458822,_0x18df47){return function(_0x403ae8){if(_0x403ae8){return _0x403ae8[_0xf2b7('0x22')]()[_0xf2b7('0x23')](function(){var _0x33387c=_0x403ae8[_0xf2b7('0x24')]({'plain':!![]});var _0x443a8c=_0xf2b7('0x25');return db[_0xf2b7('0x26')][_0xf2b7('0x22')]({'where':{'type':_0x443a8c,'resourceId':_0x33387c['id']}})['then'](function(){return _0x403ae8;});})[_0xf2b7('0x23')](function(){_0x458822[_0xf2b7('0x27')](0xcc)[_0xf2b7('0x16')]();});}};}function handleEntityNotFound(_0x6b15eb,_0x3ffd63){return function(_0x37cffa){if(!_0x37cffa){_0x6b15eb[_0xf2b7('0x15')](0x194);}return _0x37cffa;};}function handleError(_0x3fcd4c,_0x523a18){_0x523a18=_0x523a18||0x1f4;return function(_0x17f3b8){logger['error'](_0x17f3b8[_0xf2b7('0x28')]);if(_0x17f3b8[_0xf2b7('0x29')]){delete _0x17f3b8[_0xf2b7('0x29')];}_0x3fcd4c[_0xf2b7('0x27')](_0x523a18)['send'](_0x17f3b8);};}exports['index']=function(_0x37de6d,_0xfc6bcd){var _0x1b679e={},_0x22fc2a={},_0x453a06={'count':0x0,'rows':[]};var _0xd963b8=_[_0xf2b7('0x2a')](db[_0xf2b7('0x2b')][_0xf2b7('0x2c')],function(_0x2a16e0){return{'name':_0x2a16e0['fieldName'],'type':_0x2a16e0[_0xf2b7('0x2d')]['key']};});_0x22fc2a[_0xf2b7('0x2e')]=_['map'](_0xd963b8,_0xf2b7('0x29'));_0x22fc2a[_0xf2b7('0x2f')]=_['keys'](_0x37de6d[_0xf2b7('0x2f')]);_0x22fc2a[_0xf2b7('0x30')]=_['intersection'](_0x22fc2a[_0xf2b7('0x2e')],_0x22fc2a[_0xf2b7('0x2f')]);_0x1b679e[_0xf2b7('0x31')]=_['intersection'](_0x22fc2a[_0xf2b7('0x2e')],qs[_0xf2b7('0x32')](_0x37de6d[_0xf2b7('0x2f')]['fields']));_0x1b679e[_0xf2b7('0x31')]=_0x1b679e[_0xf2b7('0x31')][_0xf2b7('0x33')]?_0x1b679e['attributes']:_0x22fc2a['model'];if(!_0x37de6d[_0xf2b7('0x2f')][_0xf2b7('0x34')]('nolimit')){_0x1b679e['limit']=qs[_0xf2b7('0x1a')](_0x37de6d[_0xf2b7('0x2f')]['limit']);_0x1b679e['offset']=qs[_0xf2b7('0x18')](_0x37de6d[_0xf2b7('0x2f')]['offset']);}_0x1b679e[_0xf2b7('0x35')]=qs[_0xf2b7('0x36')](_0x37de6d[_0xf2b7('0x2f')][_0xf2b7('0x36')]);delete _0x37de6d['query'][_0xf2b7('0x36')];_0x1b679e[_0xf2b7('0x37')]=qs[_0xf2b7('0x30')](_[_0xf2b7('0x38')](_0x37de6d['query'],_0x22fc2a[_0xf2b7('0x30')]),_0xd963b8);if(_0x37de6d[_0xf2b7('0x2f')][_0xf2b7('0x39')]){_0x1b679e['where']=_[_0xf2b7('0x3a')](_0x1b679e['where'],{'$or':_[_0xf2b7('0x2a')](_0xd963b8,function(_0x27a76e){if(_0x27a76e[_0xf2b7('0x2d')]!=='VIRTUAL'){var _0x38e11f={};_0x38e11f[_0x27a76e[_0xf2b7('0x29')]]={'$like':'%'+_0x37de6d['query'][_0xf2b7('0x39')]+'%'};return _0x38e11f;}})});}_0x1b679e=_[_0xf2b7('0x3a')]({},_0x1b679e,_0x37de6d[_0xf2b7('0x3b')]);var _0x23a153={'where':_0x1b679e[_0xf2b7('0x37')]};return db[_0xf2b7('0x2b')][_0xf2b7('0x1b')](_0x23a153)[_0xf2b7('0x23')](function(_0x381d74){_0x453a06[_0xf2b7('0x1b')]=_0x381d74;if(_0x37de6d['query'][_0xf2b7('0x3c')]){_0x1b679e[_0xf2b7('0x3d')]=[{'all':!![]}];}return db[_0xf2b7('0x2b')][_0xf2b7('0x3e')](_0x1b679e);})[_0xf2b7('0x23')](function(_0x178b36){_0x453a06['rows']=_0x178b36;return _0x453a06;})[_0xf2b7('0x23')](respondWithFilteredResult(_0xfc6bcd,_0x1b679e))[_0xf2b7('0x3f')](handleError(_0xfc6bcd,null));};exports['show']=function(_0x336be7,_0x2403d3){var _0x2641a1={'raw':![],'where':{'id':_0x336be7[_0xf2b7('0x40')]['id']}},_0x5cecee={};_0x5cecee[_0xf2b7('0x2e')]=_[_0xf2b7('0x41')](db[_0xf2b7('0x2b')][_0xf2b7('0x2c')]);_0x5cecee[_0xf2b7('0x2f')]=_[_0xf2b7('0x41')](_0x336be7['query']);_0x5cecee[_0xf2b7('0x30')]=_['intersection'](_0x5cecee['model'],_0x5cecee[_0xf2b7('0x2f')]);_0x2641a1[_0xf2b7('0x31')]=_['intersection'](_0x5cecee[_0xf2b7('0x2e')],qs[_0xf2b7('0x32')](_0x336be7[_0xf2b7('0x2f')]['fields']));_0x2641a1[_0xf2b7('0x31')]=_0x2641a1['attributes']['length']?_0x2641a1[_0xf2b7('0x31')]:_0x5cecee[_0xf2b7('0x2e')];if(_0x336be7[_0xf2b7('0x2f')][_0xf2b7('0x3c')]){_0x2641a1[_0xf2b7('0x3d')]=[{'all':!![]}];}_0x2641a1=_[_0xf2b7('0x3a')]({},_0x2641a1,_0x336be7[_0xf2b7('0x3b')]);return db[_0xf2b7('0x2b')][_0xf2b7('0x42')](_0x2641a1)[_0xf2b7('0x23')](handleEntityNotFound(_0x2403d3,null))['then'](respondWithResult(_0x2403d3,null))['catch'](handleError(_0x2403d3,null));};exports[_0xf2b7('0x21')]=function(_0x3259e2,_0x3defe4){if(_0x3259e2[_0xf2b7('0x43')]['id']){delete _0x3259e2[_0xf2b7('0x43')]['id'];}return db[_0xf2b7('0x2b')]['find']({'where':{'id':_0x3259e2[_0xf2b7('0x40')]['id']}})['then'](handleEntityNotFound(_0x3defe4,null))[_0xf2b7('0x23')](saveUpdates(_0x3259e2['body'],null))[_0xf2b7('0x23')](respondWithResult(_0x3defe4,null))[_0xf2b7('0x3f')](handleError(_0x3defe4,null));};exports[_0xf2b7('0x44')]=function(_0x321705,_0x1fe8a6,_0x2311db){return db[_0xf2b7('0x45')][_0xf2b7('0x46')](function(_0x4bd0fc){if(_0x321705[_0xf2b7('0x43')][_0xf2b7('0x47')]===_0xf2b7('0x48')){_0x321705[_0xf2b7('0x43')][_0xf2b7('0x49')]=path[_0xf2b7('0x4a')](config[_0xf2b7('0x4b')],_0xf2b7('0x4c'),_0x321705[_0xf2b7('0x43')]['name']);}return db[_0xf2b7('0x2b')][_0xf2b7('0x44')](_0x321705[_0xf2b7('0x43')],{'transaction':_0x4bd0fc})[_0xf2b7('0x23')](function(_0x3144f7){if(_0x321705[_0xf2b7('0x43')][_0xf2b7('0x47')]===_0xf2b7('0x48')){fs[_0xf2b7('0x4d')](_0x3144f7[_0xf2b7('0x49')],parseInt('0777',0x8));}var _0x30208e=_0x321705[_0xf2b7('0x4e')][_0xf2b7('0x24')]({'plain':!![]});if(!_0x30208e)throw new Error(_0xf2b7('0x4f'));if(_0x30208e[_0xf2b7('0x50')]==='user'){var _0x22c8b0=_0x3144f7[_0xf2b7('0x24')]({'plain':!![]});return db[_0xf2b7('0x51')][_0xf2b7('0x42')]({'where':{'name':'MusicOnHolds','userProfileId':_0x30208e['userProfileId']},'raw':!![]})[_0xf2b7('0x23')](function(_0x40ea83){if(_0x40ea83&&_0x40ea83[_0xf2b7('0x52')]===0x0){return db['UserProfileResource'][_0xf2b7('0x44')]({'name':_0x22c8b0['name'],'resourceId':_0x22c8b0['id'],'type':_0x40ea83[_0xf2b7('0x29')],'sectionId':_0x40ea83['id']},{})[_0xf2b7('0x23')](function(){return _0x3144f7;});}else{return _0x3144f7;}})[_0xf2b7('0x3f')](function(_0x2ddd60){logger[_0xf2b7('0x53')](_0xf2b7('0x54'),_0x2ddd60);});}return _0x3144f7;});})[_0xf2b7('0x23')](respondWithResult(_0x1fe8a6,0xc9))[_0xf2b7('0x3f')](handleError(_0x1fe8a6,null));};exports['destroy']=function(_0x47f81d,_0x3b6b21,_0xeef486){var _0x3ab56e;return db[_0xf2b7('0x2b')][_0xf2b7('0x42')]({'where':{'id':_0x47f81d['params']['id']}})[_0xf2b7('0x23')](function(_0x177f02){if(_0x177f02){return db[_0xf2b7('0x45')][_0xf2b7('0x46')](function(_0x4104fe){return _0x177f02[_0xf2b7('0x22')]({'transaction':_0x4104fe,'raw':!![]})[_0xf2b7('0x23')](function(_0x3a86eb){if(_0x3a86eb[_0xf2b7('0x49')]){fs['readdirSync'](_0x3a86eb[_0xf2b7('0x49')])[_0xf2b7('0x55')](function(_0x18b69c){fs['unlinkSync'](path[_0xf2b7('0x4a')](_0x3a86eb[_0xf2b7('0x49')],_0x18b69c));});fs[_0xf2b7('0x56')](_0x3a86eb[_0xf2b7('0x49')]);}return _0x3a86eb;});})[_0xf2b7('0x3f')](function(_0x2c68b8){throw new db[(_0xf2b7('0x57'))][(_0xf2b7('0x58'))](_0x2c68b8[_0xf2b7('0x59')]);});}})[_0xf2b7('0x23')](handleEntityNotFound(_0x3b6b21,null))[_0xf2b7('0x23')](removeEntity(_0x3b6b21,null))[_0xf2b7('0x3f')](handleError(_0x3b6b21,null));};exports[_0xf2b7('0x5a')]=function(_0x56f70f,_0x3bbd67,_0x108956){return db[_0xf2b7('0x45')]['transaction'](function(_0x5c2934){var _0x272a3a;return db[_0xf2b7('0x2b')][_0xf2b7('0x42')]({'where':{'id':_0x56f70f[_0xf2b7('0x40')]['id']}})[_0xf2b7('0x23')](function(_0x43fd87){if(_0x43fd87){_0x272a3a=_0x43fd87;return _0x43fd87[_0xf2b7('0x5a')](_0x56f70f[_0xf2b7('0x43')]['id'],{'transaction':_0x5c2934});}})['then'](function(_0x541a8d){if(_0x541a8d){return db[_0xf2b7('0x5b')][_0xf2b7('0x5c')]({'where':{'id':_0x56f70f[_0xf2b7('0x43')]['id']},'attributes':['id','name','save_name',_0xf2b7('0x5d'),_0xf2b7('0x5e')],'raw':!![]});}})[_0xf2b7('0x23')](function(_0x27abd6){if(_0x27abd6){var _0xd7239a=path[_0xf2b7('0x4a')](config[_0xf2b7('0x4b')],_0xf2b7('0x5f'),util[_0xf2b7('0x60')](_0xf2b7('0x61'),path[_0xf2b7('0x62')](_0x27abd6[_0xf2b7('0x63')],path[_0xf2b7('0x64')](_0x27abd6['save_name'])),_0x27abd6[_0xf2b7('0x5d')]));var _0x59c852=path['join'](config[_0xf2b7('0x4b')],'server/files/moh',_0x272a3a['name'],util[_0xf2b7('0x60')](_0xf2b7('0x61'),_0x27abd6[_0xf2b7('0x29')],_0x27abd6['converted_format']));fs[_0xf2b7('0x65')](_0xd7239a,_0x59c852);return _0x27abd6;}})[_0xf2b7('0x3f')](function(_0x30cb9b){throw new db['Sequelize'][(_0xf2b7('0x58'))](_0x30cb9b[_0xf2b7('0x59')]);});})[_0xf2b7('0x23')](handleEntityNotFound(_0x3bbd67,null))['then'](respondWithResult(_0x3bbd67,0xc9))[_0xf2b7('0x3f')](handleError(_0x3bbd67,null));};exports[_0xf2b7('0x66')]=function(_0xe62070,_0x358e41,_0x5895b8){return db[_0xf2b7('0x45')]['transaction'](function(_0x3dfb3b){var _0x446fb2;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0xe62070[_0xf2b7('0x40')]['id']}})[_0xf2b7('0x23')](handleEntityNotFound(_0x358e41,null))[_0xf2b7('0x23')](function(_0x5ec1c0){if(_0x5ec1c0){_0x446fb2=_0x5ec1c0;return _0x5ec1c0[_0xf2b7('0x66')](_0xe62070[_0xf2b7('0x40')][_0xf2b7('0x67')]);}})[_0xf2b7('0x23')](function(_0x3e6213){if(_0x3e6213){return db[_0xf2b7('0x5b')][_0xf2b7('0x5c')]({'where':{'id':_0xe62070[_0xf2b7('0x40')][_0xf2b7('0x67')]},'attributes':['id',_0xf2b7('0x29'),'save_name',_0xf2b7('0x5d'),_0xf2b7('0x5e')],'raw':!![]});}})['then'](function(_0x2fe4f2){if(_0x2fe4f2){fs[_0xf2b7('0x68')](path[_0xf2b7('0x4a')](_0x446fb2[_0xf2b7('0x49')],util[_0xf2b7('0x60')](_0xf2b7('0x61'),_0x2fe4f2[_0xf2b7('0x29')],_0x2fe4f2[_0xf2b7('0x5d')])));return _0x2fe4f2;}})['catch'](function(_0x134309){throw new db[(_0xf2b7('0x57'))][(_0xf2b7('0x58'))](_0x134309[_0xf2b7('0x59')]);});})['then'](handleEntityNotFound(_0x358e41,null))['then'](respondWithStatusCode(_0x358e41,0xcc))['catch'](handleError(_0x358e41,null));};exports[_0xf2b7('0x69')]=function(_0x23079a,_0x9975f0,_0x4af145){var _0x53cc84={};var _0x1af79d={};var _0x516e37;var _0x163b6f;return db[_0xf2b7('0x2b')]['findOne']({'where':{'id':_0x23079a[_0xf2b7('0x40')]['id']}})[_0xf2b7('0x23')](handleEntityNotFound(_0x9975f0,null))[_0xf2b7('0x23')](function(_0x1168f4){if(_0x1168f4){_0x516e37=_0x1168f4;_0x1af79d['model']=_[_0xf2b7('0x41')](db[_0xf2b7('0x5b')][_0xf2b7('0x2c')]);_0x1af79d[_0xf2b7('0x2f')]=_[_0xf2b7('0x41')](_0x23079a[_0xf2b7('0x2f')]);_0x1af79d[_0xf2b7('0x30')]=_[_0xf2b7('0x6a')](_0x1af79d[_0xf2b7('0x2e')],_0x1af79d['query']);_0x53cc84['attributes']=_[_0xf2b7('0x6a')](_0x1af79d[_0xf2b7('0x2e')],qs[_0xf2b7('0x32')](_0x23079a['query'][_0xf2b7('0x32')]));_0x53cc84['attributes']=_0x53cc84[_0xf2b7('0x31')][_0xf2b7('0x33')]?_0x53cc84[_0xf2b7('0x31')]:_0x1af79d[_0xf2b7('0x2e')];_0x53cc84[_0xf2b7('0x35')]=qs['sort'](_0x23079a[_0xf2b7('0x2f')][_0xf2b7('0x36')]);_0x53cc84[_0xf2b7('0x37')]=qs['filters'](_[_0xf2b7('0x38')](_0x23079a[_0xf2b7('0x2f')],_0x1af79d[_0xf2b7('0x30')]));if(_0x23079a[_0xf2b7('0x2f')][_0xf2b7('0x39')]){_0x53cc84[_0xf2b7('0x37')]=_[_0xf2b7('0x3a')](_0x53cc84['where'],{'$or':_['map'](_0x53cc84[_0xf2b7('0x31')],function(_0x5879d7){var _0x54ded1={};_0x54ded1[_0x5879d7]={'$like':'%'+_0x23079a[_0xf2b7('0x2f')][_0xf2b7('0x39')]+'%'};return _0x54ded1;})});}_0x53cc84=_[_0xf2b7('0x3a')]({},_0x53cc84,_0x23079a['options']);return _0x516e37['getSounds'](_0x53cc84);}})[_0xf2b7('0x23')](function(_0x4b6a98){if(_0x4b6a98){_0x163b6f=_0x4b6a98['length'];if(!_0x23079a[_0xf2b7('0x2f')][_0xf2b7('0x34')](_0xf2b7('0x6b'))){_0x53cc84[_0xf2b7('0x1a')]=qs[_0xf2b7('0x1a')](_0x23079a[_0xf2b7('0x2f')][_0xf2b7('0x1a')]);_0x53cc84[_0xf2b7('0x18')]=qs[_0xf2b7('0x18')](_0x23079a['query']['offset']);}return _0x516e37[_0xf2b7('0x69')](_0x53cc84);}})['then'](function(_0x5d7c18){if(_0x5d7c18){return _0x5d7c18?{'count':_0x163b6f,'rows':_0x5d7c18}:null;}})[_0xf2b7('0x23')](respondWithResult(_0x9975f0,null))[_0xf2b7('0x3f')](handleError(_0x9975f0,null));}; \ No newline at end of file +var _0x1e3c=['type','model','query','keys','intersection','fields','length','attributes','hasOwnProperty','order','sort','where','filters','pick','filter','merge','VIRTUAL','include','findAll','catch','show','params','options','find','body','sequelize','transaction','mode','files','directory','join','root','server/files/moh','create','mkdirSync','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','userProfileId','UserProfileResource','readdirSync','forEach','unlinkSync','rmdirSync','Sequelize','ValidationError','addSound','Sound','save_name','createdAt','server/files/sounds/converted','%s.%s','extname','converted_format','format','symlinkSync','removeSound','id2','findOne','message','nolimit','getSounds','rimraf','zip-dir','fast-json-patch','moment','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','destroy','get','MusicOnHolds','then','end','error','stack','name','index','map','VoiceMusicOnHold','rawAttributes','fieldName'];(function(_0x1e1993,_0x14fc47){var _0xfacd7e=function(_0x4513d7){while(--_0x4513d7){_0x1e1993['push'](_0x1e1993['shift']());}};_0xfacd7e(++_0x14fc47);}(_0x1e3c,0xb3));var _0xc1e3=function(_0xc79f2e,_0x594942){_0xc79f2e=_0xc79f2e-0x0;var _0x3219dc=_0x1e3c[_0xc79f2e];return _0x3219dc;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xc1e3('0x0'));var zipdir=require(_0xc1e3('0x1'));var jsonpatch=require(_0xc1e3('0x2'));var rp=require('request-promise');var moment=require(_0xc1e3('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xc1e3('0x4'));var util=require(_0xc1e3('0x5'));var path=require(_0xc1e3('0x6'));var sox=require(_0xc1e3('0x7'));var csv=require(_0xc1e3('0x8'));var ejs=require(_0xc1e3('0x9'));var fs=require('fs');var fs_extra=require(_0xc1e3('0xa'));var _=require(_0xc1e3('0xb'));var squel=require(_0xc1e3('0xc'));var crypto=require('crypto');var jsforce=require(_0xc1e3('0xd'));var deskjs=require(_0xc1e3('0xe'));var toCsv=require(_0xc1e3('0x8'));var querystring=require(_0xc1e3('0xf'));var Papa=require(_0xc1e3('0x10'));var Redis=require(_0xc1e3('0x11'));var authService=require('../../components/auth/service');var qs=require(_0xc1e3('0x12'));var as=require(_0xc1e3('0x13'));var hardwareService=require(_0xc1e3('0x14'));var logger=require(_0xc1e3('0x15'))(_0xc1e3('0x16'));var utils=require(_0xc1e3('0x17'));var config=require(_0xc1e3('0x18'));var licenseUtil=require(_0xc1e3('0x19'));var db=require(_0xc1e3('0x1a'))['db'];function respondWithStatusCode(_0x14344c,_0x2c04e8){_0x2c04e8=_0x2c04e8||0xcc;return function(_0x4cf334){if(_0x4cf334){return _0x14344c[_0xc1e3('0x1b')](_0x2c04e8);}return _0x14344c[_0xc1e3('0x1c')](_0x2c04e8)['end']();};}function respondWithResult(_0x221e19,_0x461324){_0x461324=_0x461324||0xc8;return function(_0x3c3eb4){if(_0x3c3eb4){return _0x221e19[_0xc1e3('0x1c')](_0x461324)[_0xc1e3('0x1d')](_0x3c3eb4);}};}function respondWithFilteredResult(_0x2813ac,_0x1fd867){return function(_0x321d46){if(_0x321d46){var _0x375ac=typeof _0x1fd867[_0xc1e3('0x1e')]===_0xc1e3('0x1f')&&typeof _0x1fd867[_0xc1e3('0x20')]===_0xc1e3('0x1f');var _0x43a545=_0x321d46[_0xc1e3('0x21')];var _0x325764=_0x375ac?0x0:_0x1fd867[_0xc1e3('0x1e')];var _0x53f849=_0x375ac?_0x321d46['count']:_0x1fd867[_0xc1e3('0x1e')]+_0x1fd867[_0xc1e3('0x20')];var _0x11ed88;if(_0x53f849>=_0x43a545){_0x53f849=_0x43a545;_0x11ed88=0xc8;}else{_0x11ed88=0xce;}_0x2813ac['status'](_0x11ed88);return _0x2813ac[_0xc1e3('0x22')](_0xc1e3('0x23'),_0x325764+'-'+_0x53f849+'/'+_0x43a545)[_0xc1e3('0x1d')](_0x321d46);}return null;};}function patchUpdates(_0x150ec7){return function(_0x32f642){try{jsonpatch[_0xc1e3('0x24')](_0x32f642,_0x150ec7,!![]);}catch(_0x48f4ed){return BPromise[_0xc1e3('0x25')](_0x48f4ed);}return _0x32f642[_0xc1e3('0x26')]();};}function saveUpdates(_0x445a7c,_0x23abbc){return function(_0x16d3cf){if(_0x16d3cf){return _0x16d3cf[_0xc1e3('0x27')](_0x445a7c)['then'](function(_0x188a71){return _0x188a71;});}return null;};}function removeEntity(_0x5d3e56,_0x884caa){return function(_0x3af5a2){if(_0x3af5a2){return _0x3af5a2[_0xc1e3('0x28')]()['then'](function(){var _0x1fe30a=_0x3af5a2[_0xc1e3('0x29')]({'plain':!![]});var _0x56536e=_0xc1e3('0x2a');return db['UserProfileResource'][_0xc1e3('0x28')]({'where':{'type':_0x56536e,'resourceId':_0x1fe30a['id']}})[_0xc1e3('0x2b')](function(){return _0x3af5a2;});})['then'](function(){_0x5d3e56[_0xc1e3('0x1c')](0xcc)[_0xc1e3('0x2c')]();});}};}function handleEntityNotFound(_0x42e9e9,_0x162453){return function(_0x1cb213){if(!_0x1cb213){_0x42e9e9[_0xc1e3('0x1b')](0x194);}return _0x1cb213;};}function handleError(_0x2676b7,_0x15ec5e){_0x15ec5e=_0x15ec5e||0x1f4;return function(_0x5726f6){logger[_0xc1e3('0x2d')](_0x5726f6[_0xc1e3('0x2e')]);if(_0x5726f6[_0xc1e3('0x2f')]){delete _0x5726f6[_0xc1e3('0x2f')];}_0x2676b7['status'](_0x15ec5e)['send'](_0x5726f6);};}exports[_0xc1e3('0x30')]=function(_0x612c1e,_0x247c2b){var _0x1780d6={},_0x2b67c6={},_0x3ba75e={'count':0x0,'rows':[]};var _0x41b594=_[_0xc1e3('0x31')](db[_0xc1e3('0x32')][_0xc1e3('0x33')],function(_0x36dc0f){return{'name':_0x36dc0f[_0xc1e3('0x34')],'type':_0x36dc0f[_0xc1e3('0x35')]['key']};});_0x2b67c6[_0xc1e3('0x36')]=_['map'](_0x41b594,_0xc1e3('0x2f'));_0x2b67c6[_0xc1e3('0x37')]=_[_0xc1e3('0x38')](_0x612c1e[_0xc1e3('0x37')]);_0x2b67c6['filters']=_[_0xc1e3('0x39')](_0x2b67c6['model'],_0x2b67c6['query']);_0x1780d6['attributes']=_[_0xc1e3('0x39')](_0x2b67c6[_0xc1e3('0x36')],qs[_0xc1e3('0x3a')](_0x612c1e[_0xc1e3('0x37')][_0xc1e3('0x3a')]));_0x1780d6['attributes']=_0x1780d6['attributes'][_0xc1e3('0x3b')]?_0x1780d6[_0xc1e3('0x3c')]:_0x2b67c6[_0xc1e3('0x36')];if(!_0x612c1e[_0xc1e3('0x37')][_0xc1e3('0x3d')]('nolimit')){_0x1780d6[_0xc1e3('0x20')]=qs[_0xc1e3('0x20')](_0x612c1e[_0xc1e3('0x37')][_0xc1e3('0x20')]);_0x1780d6[_0xc1e3('0x1e')]=qs[_0xc1e3('0x1e')](_0x612c1e[_0xc1e3('0x37')]['offset']);}_0x1780d6[_0xc1e3('0x3e')]=qs['sort'](_0x612c1e[_0xc1e3('0x37')]['sort']);delete _0x612c1e['query'][_0xc1e3('0x3f')];_0x1780d6[_0xc1e3('0x40')]=qs[_0xc1e3('0x41')](_[_0xc1e3('0x42')](_0x612c1e[_0xc1e3('0x37')],_0x2b67c6['filters']),_0x41b594);if(_0x612c1e[_0xc1e3('0x37')][_0xc1e3('0x43')]){_0x1780d6[_0xc1e3('0x40')]=_[_0xc1e3('0x44')](_0x1780d6[_0xc1e3('0x40')],{'$or':_['map'](_0x41b594,function(_0x5d0c40){if(_0x5d0c40[_0xc1e3('0x35')]!==_0xc1e3('0x45')){var _0x230753={};_0x230753[_0x5d0c40[_0xc1e3('0x2f')]]={'$like':'%'+_0x612c1e['query']['filter']+'%'};return _0x230753;}})});}_0x1780d6=_[_0xc1e3('0x44')]({},_0x1780d6,_0x612c1e['options']);var _0x3ce659={'where':_0x1780d6[_0xc1e3('0x40')]};return db[_0xc1e3('0x32')][_0xc1e3('0x21')](_0x3ce659)[_0xc1e3('0x2b')](function(_0x126b8f){_0x3ba75e[_0xc1e3('0x21')]=_0x126b8f;if(_0x612c1e[_0xc1e3('0x37')]['includeAll']){_0x1780d6[_0xc1e3('0x46')]=[{'all':!![]}];}return db['VoiceMusicOnHold'][_0xc1e3('0x47')](_0x1780d6);})[_0xc1e3('0x2b')](function(_0x38b215){_0x3ba75e['rows']=_0x38b215;return _0x3ba75e;})['then'](respondWithFilteredResult(_0x247c2b,_0x1780d6))[_0xc1e3('0x48')](handleError(_0x247c2b,null));};exports[_0xc1e3('0x49')]=function(_0x3a1293,_0x42a0f4){var _0x51ac4e={'raw':![],'where':{'id':_0x3a1293[_0xc1e3('0x4a')]['id']}},_0x2e3918={};_0x2e3918[_0xc1e3('0x36')]=_[_0xc1e3('0x38')](db[_0xc1e3('0x32')][_0xc1e3('0x33')]);_0x2e3918[_0xc1e3('0x37')]=_['keys'](_0x3a1293[_0xc1e3('0x37')]);_0x2e3918['filters']=_[_0xc1e3('0x39')](_0x2e3918[_0xc1e3('0x36')],_0x2e3918[_0xc1e3('0x37')]);_0x51ac4e['attributes']=_[_0xc1e3('0x39')](_0x2e3918['model'],qs[_0xc1e3('0x3a')](_0x3a1293[_0xc1e3('0x37')][_0xc1e3('0x3a')]));_0x51ac4e[_0xc1e3('0x3c')]=_0x51ac4e[_0xc1e3('0x3c')][_0xc1e3('0x3b')]?_0x51ac4e[_0xc1e3('0x3c')]:_0x2e3918[_0xc1e3('0x36')];if(_0x3a1293[_0xc1e3('0x37')]['includeAll']){_0x51ac4e[_0xc1e3('0x46')]=[{'all':!![]}];}_0x51ac4e=_[_0xc1e3('0x44')]({},_0x51ac4e,_0x3a1293[_0xc1e3('0x4b')]);return db[_0xc1e3('0x32')][_0xc1e3('0x4c')](_0x51ac4e)['then'](handleEntityNotFound(_0x42a0f4,null))[_0xc1e3('0x2b')](respondWithResult(_0x42a0f4,null))['catch'](handleError(_0x42a0f4,null));};exports[_0xc1e3('0x27')]=function(_0x226d8c,_0x54248d){if(_0x226d8c[_0xc1e3('0x4d')]['id']){delete _0x226d8c[_0xc1e3('0x4d')]['id'];}return db[_0xc1e3('0x32')]['find']({'where':{'id':_0x226d8c[_0xc1e3('0x4a')]['id']}})[_0xc1e3('0x2b')](handleEntityNotFound(_0x54248d,null))[_0xc1e3('0x2b')](saveUpdates(_0x226d8c[_0xc1e3('0x4d')],null))[_0xc1e3('0x2b')](respondWithResult(_0x54248d,null))['catch'](handleError(_0x54248d,null));};exports['create']=function(_0x21f9a9,_0x5cfe89,_0x432e43){return db[_0xc1e3('0x4e')][_0xc1e3('0x4f')](function(_0x406b80){if(_0x21f9a9[_0xc1e3('0x4d')][_0xc1e3('0x50')]===_0xc1e3('0x51')){_0x21f9a9['body'][_0xc1e3('0x52')]=path[_0xc1e3('0x53')](config[_0xc1e3('0x54')],_0xc1e3('0x55'),_0x21f9a9[_0xc1e3('0x4d')]['name']);}return db[_0xc1e3('0x32')][_0xc1e3('0x56')](_0x21f9a9[_0xc1e3('0x4d')],{'transaction':_0x406b80})[_0xc1e3('0x2b')](function(_0xd59499){if(_0x21f9a9['body'][_0xc1e3('0x50')]===_0xc1e3('0x51')){fs[_0xc1e3('0x57')](_0xd59499[_0xc1e3('0x52')],parseInt('0777',0x8));}var _0x5801d0=_0x21f9a9[_0xc1e3('0x58')]['get']({'plain':!![]});if(!_0x5801d0)throw new Error(_0xc1e3('0x59'));if(_0x5801d0[_0xc1e3('0x5a')]===_0xc1e3('0x58')){var _0x4ce87f=_0xd59499[_0xc1e3('0x29')]({'plain':!![]});return db[_0xc1e3('0x5b')][_0xc1e3('0x4c')]({'where':{'name':_0xc1e3('0x2a'),'userProfileId':_0x5801d0[_0xc1e3('0x5c')]},'raw':!![]})[_0xc1e3('0x2b')](function(_0x5565c3){if(_0x5565c3&&_0x5565c3['autoAssociation']===0x0){return db[_0xc1e3('0x5d')]['create']({'name':_0x4ce87f[_0xc1e3('0x2f')],'resourceId':_0x4ce87f['id'],'type':_0x5565c3[_0xc1e3('0x2f')],'sectionId':_0x5565c3['id']},{})[_0xc1e3('0x2b')](function(){return _0xd59499;});}else{return _0xd59499;}})[_0xc1e3('0x48')](function(_0x302f59){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x302f59);});}return _0xd59499;});})[_0xc1e3('0x2b')](respondWithResult(_0x5cfe89,0xc9))[_0xc1e3('0x48')](handleError(_0x5cfe89,null));};exports[_0xc1e3('0x28')]=function(_0x21fc79,_0x5025c3,_0x3a76a4){var _0x53fab9;return db[_0xc1e3('0x32')][_0xc1e3('0x4c')]({'where':{'id':_0x21fc79[_0xc1e3('0x4a')]['id']}})[_0xc1e3('0x2b')](function(_0x41f6e9){if(_0x41f6e9){return db['sequelize'][_0xc1e3('0x4f')](function(_0x801531){return _0x41f6e9[_0xc1e3('0x28')]({'transaction':_0x801531,'raw':!![]})['then'](function(_0x18130d){if(_0x18130d[_0xc1e3('0x52')]){fs[_0xc1e3('0x5e')](_0x18130d[_0xc1e3('0x52')])[_0xc1e3('0x5f')](function(_0x585fe0){fs[_0xc1e3('0x60')](path[_0xc1e3('0x53')](_0x18130d[_0xc1e3('0x52')],_0x585fe0));});fs[_0xc1e3('0x61')](_0x18130d[_0xc1e3('0x52')]);}return _0x18130d;});})[_0xc1e3('0x48')](function(_0x3698ba){throw new db[(_0xc1e3('0x62'))][(_0xc1e3('0x63'))](_0x3698ba['message']);});}})[_0xc1e3('0x2b')](handleEntityNotFound(_0x5025c3,null))[_0xc1e3('0x2b')](removeEntity(_0x5025c3,null))['catch'](handleError(_0x5025c3,null));};exports[_0xc1e3('0x64')]=function(_0x29052d,_0x389639,_0xf9462b){return db[_0xc1e3('0x4e')][_0xc1e3('0x4f')](function(_0x5a420c){var _0x4d8829;return db[_0xc1e3('0x32')][_0xc1e3('0x4c')]({'where':{'id':_0x29052d['params']['id']}})['then'](function(_0x2e5ffb){if(_0x2e5ffb){_0x4d8829=_0x2e5ffb;return _0x2e5ffb[_0xc1e3('0x64')](_0x29052d[_0xc1e3('0x4d')]['id'],{'transaction':_0x5a420c});}})[_0xc1e3('0x2b')](function(_0x329bc1){if(_0x329bc1){return db[_0xc1e3('0x65')]['findOne']({'where':{'id':_0x29052d['body']['id']},'attributes':['id','name',_0xc1e3('0x66'),'converted_format',_0xc1e3('0x67')],'raw':!![]});}})['then'](function(_0x5db0b8){if(_0x5db0b8){var _0x3ee2d8=path['join'](config[_0xc1e3('0x54')],_0xc1e3('0x68'),util['format'](_0xc1e3('0x69'),path['basename'](_0x5db0b8['save_name'],path[_0xc1e3('0x6a')](_0x5db0b8[_0xc1e3('0x66')])),_0x5db0b8[_0xc1e3('0x6b')]));var _0x2e29fe=path['join'](config[_0xc1e3('0x54')],_0xc1e3('0x55'),_0x4d8829[_0xc1e3('0x2f')],util[_0xc1e3('0x6c')](_0xc1e3('0x69'),_0x5db0b8['name'],_0x5db0b8[_0xc1e3('0x6b')]));fs[_0xc1e3('0x6d')](_0x3ee2d8,_0x2e29fe);return _0x5db0b8;}})[_0xc1e3('0x48')](function(_0x19b3d7){throw new db[(_0xc1e3('0x62'))][(_0xc1e3('0x63'))](_0x19b3d7['message']);});})[_0xc1e3('0x2b')](handleEntityNotFound(_0x389639,null))[_0xc1e3('0x2b')](respondWithResult(_0x389639,0xc9))[_0xc1e3('0x48')](handleError(_0x389639,null));};exports[_0xc1e3('0x6e')]=function(_0x1962c1,_0x1ce6fd,_0x5b7717){return db['sequelize'][_0xc1e3('0x4f')](function(_0x1d32eb){var _0xf64daa;return db['VoiceMusicOnHold']['findOne']({'where':{'id':_0x1962c1[_0xc1e3('0x4a')]['id']}})['then'](handleEntityNotFound(_0x1ce6fd,null))['then'](function(_0x2a561e){if(_0x2a561e){_0xf64daa=_0x2a561e;return _0x2a561e[_0xc1e3('0x6e')](_0x1962c1['params'][_0xc1e3('0x6f')]);}})[_0xc1e3('0x2b')](function(_0x55c0ae){if(_0x55c0ae){return db[_0xc1e3('0x65')][_0xc1e3('0x70')]({'where':{'id':_0x1962c1[_0xc1e3('0x4a')]['id2']},'attributes':['id',_0xc1e3('0x2f'),_0xc1e3('0x66'),'converted_format',_0xc1e3('0x67')],'raw':!![]});}})[_0xc1e3('0x2b')](function(_0x20bc32){if(_0x20bc32){fs['unlinkSync'](path[_0xc1e3('0x53')](_0xf64daa['directory'],util[_0xc1e3('0x6c')](_0xc1e3('0x69'),_0x20bc32[_0xc1e3('0x2f')],_0x20bc32[_0xc1e3('0x6b')])));return _0x20bc32;}})[_0xc1e3('0x48')](function(_0x4f4d75){throw new db[(_0xc1e3('0x62'))]['ValidationError'](_0x4f4d75[_0xc1e3('0x71')]);});})['then'](handleEntityNotFound(_0x1ce6fd,null))[_0xc1e3('0x2b')](respondWithStatusCode(_0x1ce6fd,0xcc))['catch'](handleError(_0x1ce6fd,null));};exports['getSounds']=function(_0x5e4d1f,_0x3a922c,_0x453241){var _0x414422={};var _0x278cec={};var _0x378904;var _0x324ea7;return db[_0xc1e3('0x32')][_0xc1e3('0x70')]({'where':{'id':_0x5e4d1f[_0xc1e3('0x4a')]['id']}})[_0xc1e3('0x2b')](handleEntityNotFound(_0x3a922c,null))[_0xc1e3('0x2b')](function(_0x36b664){if(_0x36b664){_0x378904=_0x36b664;_0x278cec['model']=_[_0xc1e3('0x38')](db[_0xc1e3('0x65')][_0xc1e3('0x33')]);_0x278cec[_0xc1e3('0x37')]=_[_0xc1e3('0x38')](_0x5e4d1f[_0xc1e3('0x37')]);_0x278cec[_0xc1e3('0x41')]=_['intersection'](_0x278cec['model'],_0x278cec[_0xc1e3('0x37')]);_0x414422[_0xc1e3('0x3c')]=_[_0xc1e3('0x39')](_0x278cec[_0xc1e3('0x36')],qs['fields'](_0x5e4d1f[_0xc1e3('0x37')][_0xc1e3('0x3a')]));_0x414422[_0xc1e3('0x3c')]=_0x414422[_0xc1e3('0x3c')]['length']?_0x414422[_0xc1e3('0x3c')]:_0x278cec[_0xc1e3('0x36')];_0x414422[_0xc1e3('0x3e')]=qs['sort'](_0x5e4d1f[_0xc1e3('0x37')][_0xc1e3('0x3f')]);_0x414422[_0xc1e3('0x40')]=qs[_0xc1e3('0x41')](_[_0xc1e3('0x42')](_0x5e4d1f[_0xc1e3('0x37')],_0x278cec[_0xc1e3('0x41')]));if(_0x5e4d1f[_0xc1e3('0x37')][_0xc1e3('0x43')]){_0x414422[_0xc1e3('0x40')]=_[_0xc1e3('0x44')](_0x414422[_0xc1e3('0x40')],{'$or':_[_0xc1e3('0x31')](_0x414422[_0xc1e3('0x3c')],function(_0x4c57b7){var _0x35339e={};_0x35339e[_0x4c57b7]={'$like':'%'+_0x5e4d1f[_0xc1e3('0x37')]['filter']+'%'};return _0x35339e;})});}_0x414422=_[_0xc1e3('0x44')]({},_0x414422,_0x5e4d1f[_0xc1e3('0x4b')]);return _0x378904['getSounds'](_0x414422);}})[_0xc1e3('0x2b')](function(_0x2d53a8){if(_0x2d53a8){_0x324ea7=_0x2d53a8[_0xc1e3('0x3b')];if(!_0x5e4d1f['query']['hasOwnProperty'](_0xc1e3('0x72'))){_0x414422[_0xc1e3('0x20')]=qs[_0xc1e3('0x20')](_0x5e4d1f[_0xc1e3('0x37')][_0xc1e3('0x20')]);_0x414422['offset']=qs[_0xc1e3('0x1e')](_0x5e4d1f[_0xc1e3('0x37')]['offset']);}return _0x378904[_0xc1e3('0x73')](_0x414422);}})[_0xc1e3('0x2b')](function(_0x145cc3){if(_0x145cc3){return _0x145cc3?{'count':_0x324ea7,'rows':_0x145cc3}:null;}})[_0xc1e3('0x2b')](respondWithResult(_0x3a922c,null))['catch'](handleError(_0x3a922c,null));}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.model.js index e299570..79e7ce2 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 _0x8f21=['path','rimraf','../../config/environment','./voiceMusicOnHold.attributes','VoiceMusicOnHold','lodash','util','../../config/logger','request-promise'];(function(_0x21e8bb,_0xeb600b){var _0x421ff2=function(_0x2ff739){while(--_0x2ff739){_0x21e8bb['push'](_0x21e8bb['shift']());}};_0x421ff2(++_0xeb600b);}(_0x8f21,0x1f4));var _0x18f2=function(_0x53e14d,_0x12ffaa){_0x53e14d=_0x53e14d-0x0;var _0x5d9088=_0x8f21[_0x53e14d];return _0x5d9088;};'use strict';var _=require(_0x18f2('0x0'));var util=require(_0x18f2('0x1'));var logger=require(_0x18f2('0x2'))('api');var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x18f2('0x3'));var fs=require('fs');var path=require(_0x18f2('0x4'));var rimraf=require(_0x18f2('0x5'));var config=require(_0x18f2('0x6'));var attributes=require(_0x18f2('0x7'));module['exports']=function(_0x49b898,_0x595ce){return _0x49b898['define'](_0x18f2('0x8'),attributes,{'tableName':'voice_musiconhold','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4883=['rimraf','../../config/environment','VoiceMusicOnHold','voice_musiconhold','lodash','util','api','moment','bluebird','request-promise','path'];(function(_0x119b3e,_0x588d50){var _0x1169ae=function(_0x377422){while(--_0x377422){_0x119b3e['push'](_0x119b3e['shift']());}};_0x1169ae(++_0x588d50);}(_0x4883,0x138));var _0x3488=function(_0x47839e,_0x11aff2){_0x47839e=_0x47839e-0x0;var _0x40d574=_0x4883[_0x47839e];return _0x40d574;};'use strict';var _=require(_0x3488('0x0'));var util=require(_0x3488('0x1'));var logger=require('../../config/logger')(_0x3488('0x2'));var moment=require(_0x3488('0x3'));var BPromise=require(_0x3488('0x4'));var rp=require(_0x3488('0x5'));var fs=require('fs');var path=require(_0x3488('0x6'));var rimraf=require(_0x3488('0x7'));var config=require(_0x3488('0x8'));var attributes=require('./voiceMusicOnHold.attributes');module['exports']=function(_0x215de2,_0xa4e6cb){return _0x215de2['define'](_0x3488('0x9'),attributes,{'tableName':_0x3488('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js index 80ad0f8..f4709d9 100644 --- a/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js +++ b/server/api/voiceMusicOnHold/voiceMusicOnHold.rpc.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','debug','stringify','error','code','VoiceMusicOnHold,\x20%s,\x20%s','message','catch','util'];(function(_0x505d96,_0x49b92b){var _0x1116d7=function(_0x56ce8b){while(--_0x56ce8b){_0x505d96['push'](_0x505d96['shift']());}};_0x1116d7(++_0x49b92b);}(_0xedd9,0xfc));var _0x9edd=function(_0x5be074,_0x4c34ef){_0x5be074=_0x5be074-0x0;var _0x5ba451=_0xedd9[_0x5be074];return _0x5ba451;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var moment=require(_0x9edd('0x1'));var BPromise=require(_0x9edd('0x2'));var rs=require(_0x9edd('0x3'));var fs=require('fs');var Redis=require(_0x9edd('0x4'));var db=require(_0x9edd('0x5'))['db'];var utils=require(_0x9edd('0x6'));var logger=require(_0x9edd('0x7'))('rpc');var config=require(_0x9edd('0x8'));var jayson=require(_0x9edd('0x9'));var client=jayson[_0x9edd('0xa')][_0x9edd('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5319f7,_0xf0b2d8,_0x571af9){return new BPromise(function(_0x172522,_0x190185){return client[_0x9edd('0xc')](_0x5319f7,_0x571af9)[_0x9edd('0xd')](function(_0x49d5e3){logger[_0x9edd('0xe')]('VoiceMusicOnHold,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'));logger[_0x9edd('0x10')]('VoiceMusicOnHold,\x20%s,\x20%s,\x20%s',_0xf0b2d8,_0x9edd('0xf'),JSON[_0x9edd('0x11')](_0x49d5e3));if(_0x49d5e3['error']){if(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x13')]===0x1f4){logger[_0x9edd('0x12')](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x190185(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);return _0x172522(_0x49d5e3[_0x9edd('0x12')][_0x9edd('0x15')]);}else{logger[_0x9edd('0xe')](_0x9edd('0x14'),_0xf0b2d8,_0x9edd('0xf'));_0x172522(_0x49d5e3['result'][_0x9edd('0x15')]);}})[_0x9edd('0x16')](function(_0x449cee){logger['error'](_0x9edd('0x14'),_0xf0b2d8,_0x449cee);_0x190185(_0x449cee);});});} \ No newline at end of file +var _0xa9e0=['http','info','VoiceMusicOnHold,\x20%s,\x20%s','request\x20sent','debug','VoiceMusicOnHold,\x20%s,\x20%s,\x20%s','code','error','message','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x1ff846,_0x496725){var _0x249068=function(_0x1de330){while(--_0x1de330){_0x1ff846['push'](_0x1ff846['shift']());}};_0x249068(++_0x496725);}(_0xa9e0,0x123));var _0x0a9e=function(_0x38a7ac,_0x45514b){_0x38a7ac=_0x38a7ac-0x0;var _0x53061a=_0xa9e0[_0x38a7ac];return _0x53061a;};'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/voicePrefix/index.js b/server/api/voicePrefix/index.js index 2a99231..d8990e1 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 _0x6921=['fs-extra','../../components/interaction/service','./voicePrefix.controller','get','isAuthenticated','index','/describe','describe','/:id','getAgents','/:id/teams','getTeams','create','post','/:id/users','addAgents','addTeams','put','update','delete','removeAgents','removeTeams','exports','util','connect-timeout','Router'];(function(_0x105a68,_0x186862){var _0x2ea65b=function(_0x2a4693){while(--_0x2a4693){_0x105a68['push'](_0x105a68['shift']());}};_0x2ea65b(++_0x186862);}(_0x6921,0x1d1));var _0x1692=function(_0xe75234,_0x4cb111){_0xe75234=_0xe75234-0x0;var _0x399551=_0x6921[_0xe75234];return _0x399551;};'use strict';var multer=require('multer');var util=require(_0x1692('0x0'));var path=require('path');var timeout=require(_0x1692('0x1'));var express=require('express');var router=express[_0x1692('0x2')]();var fs_extra=require(_0x1692('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x1692('0x4'));var config=require('../../config/environment');var controller=require(_0x1692('0x5'));router[_0x1692('0x6')]('/',auth[_0x1692('0x7')](),controller[_0x1692('0x8')]);router[_0x1692('0x6')](_0x1692('0x9'),auth[_0x1692('0x7')](),controller[_0x1692('0xa')]);router[_0x1692('0x6')](_0x1692('0xb'),auth[_0x1692('0x7')](),controller['show']);router[_0x1692('0x6')]('/:id/users',auth[_0x1692('0x7')](),controller[_0x1692('0xc')]);router[_0x1692('0x6')](_0x1692('0xd'),auth[_0x1692('0x7')](),controller[_0x1692('0xe')]);router['post']('/',auth[_0x1692('0x7')](),controller[_0x1692('0xf')]);router[_0x1692('0x10')](_0x1692('0x11'),auth[_0x1692('0x7')](),controller[_0x1692('0x12')]);router['post'](_0x1692('0xd'),auth[_0x1692('0x7')](),controller[_0x1692('0x13')]);router[_0x1692('0x14')](_0x1692('0xb'),auth[_0x1692('0x7')](),controller[_0x1692('0x15')]);router[_0x1692('0x16')]('/:id',auth[_0x1692('0x7')](),controller['destroy']);router[_0x1692('0x16')]('/:id/users',auth[_0x1692('0x7')](),controller[_0x1692('0x17')]);router[_0x1692('0x16')]('/:id/teams',auth['isAuthenticated'](),controller[_0x1692('0x18')]);module[_0x1692('0x19')]=router; \ No newline at end of file +var _0x1daf=['get','/:id/users','getAgents','/:id/teams','getTeams','post','create','addTeams','put','/:id','update','delete','destroy','removeAgents','removeTeams','exports','multer','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voicePrefix.controller','isAuthenticated','/describe','describe','show'];(function(_0x280a2e,_0x244c6f){var _0x286f67=function(_0xe4620b){while(--_0xe4620b){_0x280a2e['push'](_0x280a2e['shift']());}};_0x286f67(++_0x244c6f);}(_0x1daf,0x17c));var _0xf1da=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x1daf[_0x1facfa];return _0x9ec701;};'use strict';var multer=require(_0xf1da('0x0'));var util=require('util');var path=require('path');var timeout=require(_0xf1da('0x1'));var express=require(_0xf1da('0x2'));var router=express[_0xf1da('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0xf1da('0x4'));var interaction=require(_0xf1da('0x5'));var config=require(_0xf1da('0x6'));var controller=require(_0xf1da('0x7'));router['get']('/',auth[_0xf1da('0x8')](),controller['index']);router['get'](_0xf1da('0x9'),auth[_0xf1da('0x8')](),controller[_0xf1da('0xa')]);router['get']('/:id',auth[_0xf1da('0x8')](),controller[_0xf1da('0xb')]);router[_0xf1da('0xc')](_0xf1da('0xd'),auth[_0xf1da('0x8')](),controller[_0xf1da('0xe')]);router[_0xf1da('0xc')](_0xf1da('0xf'),auth[_0xf1da('0x8')](),controller[_0xf1da('0x10')]);router[_0xf1da('0x11')]('/',auth[_0xf1da('0x8')](),controller[_0xf1da('0x12')]);router[_0xf1da('0x11')](_0xf1da('0xd'),auth['isAuthenticated'](),controller['addAgents']);router[_0xf1da('0x11')](_0xf1da('0xf'),auth[_0xf1da('0x8')](),controller[_0xf1da('0x13')]);router[_0xf1da('0x14')](_0xf1da('0x15'),auth[_0xf1da('0x8')](),controller[_0xf1da('0x16')]);router[_0xf1da('0x17')](_0xf1da('0x15'),auth[_0xf1da('0x8')](),controller[_0xf1da('0x18')]);router[_0xf1da('0x17')](_0xf1da('0xd'),auth['isAuthenticated'](),controller[_0xf1da('0x19')]);router[_0xf1da('0x17')](_0xf1da('0xf'),auth[_0xf1da('0x8')](),controller[_0xf1da('0x1a')]);module[_0xf1da('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 ff02e74..b41432b 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 _0xa75f=['getDataValue','sequelize','exports','STRING','name','VIRTUAL','system-'];(function(_0x2bb762,_0x4c68c4){var _0x1d60e9=function(_0x48de40){while(--_0x48de40){_0x2bb762['push'](_0x2bb762['shift']());}};_0x1d60e9(++_0x4c68c4);}(_0xa75f,0x94));var _0xfa75=function(_0x22dcd8,_0x3024d7){_0x22dcd8=_0x22dcd8-0x0;var _0x5b8104=_0xa75f[_0x22dcd8];return _0x5b8104;};'use strict';var Sequelize=require(_0xfa75('0x0'));module[_0xfa75('0x1')]={'name':{'type':Sequelize[_0xfa75('0x2')],'allowNull':![],'unique':_0xfa75('0x3')},'prefix':{'type':Sequelize[_0xfa75('0x4')],'get':function(_0x224e3c){return _0xfa75('0x5')+this[_0xfa75('0x6')](_0xfa75('0x3'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0xfa75('0x2')]},'VoiceExtensionId':{'type':Sequelize['INTEGER']}}; \ No newline at end of file +var _0x6502=['VIRTUAL','getDataValue','STRING','INTEGER','sequelize','exports','name'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6502,0x10e));var _0x2650=function(_0x5e941f,_0x41d741){_0x5e941f=_0x5e941f-0x0;var _0x5b52c4=_0x6502[_0x5e941f];return _0x5b52c4;};'use strict';var Sequelize=require(_0x2650('0x0'));module[_0x2650('0x1')]={'name':{'type':Sequelize['STRING'],'allowNull':![],'unique':_0x2650('0x2')},'prefix':{'type':Sequelize[_0x2650('0x3')],'get':function(_0x5892fc){return'system-'+this[_0x2650('0x4')](_0x2650('0x2'))+'-';}},'description':{'type':Sequelize['STRING']},'callerIdAll':{'type':Sequelize[_0x2650('0x5')]},'VoiceExtensionId':{'type':Sequelize[_0x2650('0x6')]}}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.controller.js b/server/api/voicePrefix/voicePrefix.controller.js index 134b0f6..39e202d 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 _0x7880=['userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','getAgents','findOne','User','order','pick','nolimit','getTeams','Team','online','voicePause','flatMap','Agents','addTeams','each','upsert','UserVoicePrefix','findOrCreate','forEach','field','tq.TeamId','from','team_has_voice_prefixes','user_has_teams','clone','ut.UserId\x20=\x20?','QueryTypes','all','union','value','removeTeams','isEmpty','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','papaparse','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','./voicePrefix.socket','register','sendStatus','status','end','offset','undefined','limit','set','apply','destroy','then','get','VoicePrefixes','UserProfileResource','error','stack','name','send','index','map','VoicePrefix','rawAttributes','fieldName','type','query','filters','intersection','attributes','model','length','hasOwnProperty','sort','where','filter','merge','VIRTUAL','options','count','findAll','rows','catch','show','params','keys','fields','includeAll','include','find','describe','create','sequelize','transaction','VoiceExtension','VoiceExtensionId','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','context','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','bulkCreate','Extensions\x20creation\x20failed','push','Set','CDR(prefix)=','PREFIX-CALLERIDALL=','callerIdAll','${EXTEN:','charAt','update','body','system-','findById','addAgents','ids','omit','spread','emit'];(function(_0x1f16a6,_0x924e55){var _0x379023=function(_0xc2df77){while(--_0xc2df77){_0x1f16a6['push'](_0x1f16a6['shift']());}};_0x379023(++_0x924e55);}(_0x7880,0x1f4));var _0x0788=function(_0x2474ac,_0x335d3a){_0x2474ac=_0x2474ac-0x0;var _0x384a8f=_0x7880[_0x2474ac];return _0x384a8f;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x0788('0x0'));var zipdir=require(_0x0788('0x1'));var jsonpatch=require(_0x0788('0x2'));var rp=require(_0x0788('0x3'));var moment=require(_0x0788('0x4'));var BPromise=require(_0x0788('0x5'));var Mustache=require('mustache');var util=require(_0x0788('0x6'));var path=require(_0x0788('0x7'));var sox=require(_0x0788('0x8'));var csv=require(_0x0788('0x9'));var ejs=require(_0x0788('0xa'));var fs=require('fs');var fs_extra=require(_0x0788('0xb'));var _=require(_0x0788('0xc'));var squel=require(_0x0788('0xd'));var crypto=require(_0x0788('0xe'));var jsforce=require(_0x0788('0xf'));var deskjs=require('desk.js');var toCsv=require(_0x0788('0x9'));var querystring=require('querystring');var Papa=require(_0x0788('0x10'));var Redis=require('ioredis');var authService=require(_0x0788('0x11'));var qs=require(_0x0788('0x12'));var as=require(_0x0788('0x13'));var hardwareService=require(_0x0788('0x14'));var logger=require(_0x0788('0x15'))('api');var utils=require(_0x0788('0x16'));var config=require(_0x0788('0x17'));var licenseUtil=require(_0x0788('0x18'));var db=require(_0x0788('0x19'))['db'];config[_0x0788('0x1a')]=_[_0x0788('0x1b')](config[_0x0788('0x1a')],{'host':'localhost','port':0x18eb});var socket=require(_0x0788('0x1c'))(new Redis(config[_0x0788('0x1a')]));require(_0x0788('0x1d'))[_0x0788('0x1e')](socket);function respondWithStatusCode(_0x51e5d3,_0x43ca01){_0x43ca01=_0x43ca01||0xcc;return function(_0x4ed024){if(_0x4ed024){return _0x51e5d3[_0x0788('0x1f')](_0x43ca01);}return _0x51e5d3[_0x0788('0x20')](_0x43ca01)[_0x0788('0x21')]();};}function respondWithResult(_0xb406fb,_0x2ddd1a){_0x2ddd1a=_0x2ddd1a||0xc8;return function(_0x430e34){if(_0x430e34){return _0xb406fb['status'](_0x2ddd1a)['json'](_0x430e34);}};}function respondWithFilteredResult(_0x17d805,_0x461d9d){return function(_0x5b2bdc){if(_0x5b2bdc){var _0x654e4b=typeof _0x461d9d[_0x0788('0x22')]===_0x0788('0x23')&&typeof _0x461d9d['limit']===_0x0788('0x23');var _0x3fb723=_0x5b2bdc['count'];var _0x11ea01=_0x654e4b?0x0:_0x461d9d['offset'];var _0x7d0869=_0x654e4b?_0x5b2bdc['count']:_0x461d9d[_0x0788('0x22')]+_0x461d9d[_0x0788('0x24')];var _0x18ff22;if(_0x7d0869>=_0x3fb723){_0x7d0869=_0x3fb723;_0x18ff22=0xc8;}else{_0x18ff22=0xce;}_0x17d805[_0x0788('0x20')](_0x18ff22);return _0x17d805[_0x0788('0x25')]('Content-Range',_0x11ea01+'-'+_0x7d0869+'/'+_0x3fb723)['json'](_0x5b2bdc);}return null;};}function patchUpdates(_0x2270d4){return function(_0x2a1460){try{jsonpatch[_0x0788('0x26')](_0x2a1460,_0x2270d4,!![]);}catch(_0x7a99a1){return BPromise['reject'](_0x7a99a1);}return _0x2a1460['save']();};}function saveUpdates(_0x79204e,_0x18cc33){return function(_0x40309d){if(_0x40309d){return _0x40309d['update'](_0x79204e)['then'](function(_0x240459){return _0x240459;});}return null;};}function removeEntity(_0xa1f7dc,_0x5f2dda){return function(_0x48816a){if(_0x48816a){return _0x48816a[_0x0788('0x27')]()[_0x0788('0x28')](function(){var _0x57fda1=_0x48816a[_0x0788('0x29')]({'plain':!![]});var _0x40e7a6=_0x0788('0x2a');return db[_0x0788('0x2b')][_0x0788('0x27')]({'where':{'type':_0x40e7a6,'resourceId':_0x57fda1['id']}})[_0x0788('0x28')](function(){return _0x48816a;});})[_0x0788('0x28')](function(){_0xa1f7dc[_0x0788('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5a5178,_0x3c5246){return function(_0x40d345){if(!_0x40d345){_0x5a5178['sendStatus'](0x194);}return _0x40d345;};}function handleError(_0x4aa48b,_0x2e2ca8){_0x2e2ca8=_0x2e2ca8||0x1f4;return function(_0x68658a){logger[_0x0788('0x2c')](_0x68658a[_0x0788('0x2d')]);if(_0x68658a[_0x0788('0x2e')]){delete _0x68658a[_0x0788('0x2e')];}_0x4aa48b[_0x0788('0x20')](_0x2e2ca8)[_0x0788('0x2f')](_0x68658a);};}exports[_0x0788('0x30')]=function(_0x85e579,_0x5ec0ed){var _0x2a08b7={},_0x1aab6a={},_0x2db509={'count':0x0,'rows':[]};var _0x2a64e4=_[_0x0788('0x31')](db[_0x0788('0x32')][_0x0788('0x33')],function(_0x15d67a){return{'name':_0x15d67a[_0x0788('0x34')],'type':_0x15d67a[_0x0788('0x35')]['key']};});_0x1aab6a['model']=_['map'](_0x2a64e4,'name');_0x1aab6a['query']=_['keys'](_0x85e579[_0x0788('0x36')]);_0x1aab6a[_0x0788('0x37')]=_[_0x0788('0x38')](_0x1aab6a['model'],_0x1aab6a[_0x0788('0x36')]);_0x2a08b7[_0x0788('0x39')]=_[_0x0788('0x38')](_0x1aab6a[_0x0788('0x3a')],qs['fields'](_0x85e579[_0x0788('0x36')]['fields']));_0x2a08b7[_0x0788('0x39')]=_0x2a08b7['attributes'][_0x0788('0x3b')]?_0x2a08b7[_0x0788('0x39')]:_0x1aab6a['model'];if(!_0x85e579[_0x0788('0x36')][_0x0788('0x3c')]('nolimit')){_0x2a08b7[_0x0788('0x24')]=qs['limit'](_0x85e579[_0x0788('0x36')]['limit']);_0x2a08b7[_0x0788('0x22')]=qs['offset'](_0x85e579[_0x0788('0x36')]['offset']);}_0x2a08b7['order']=qs[_0x0788('0x3d')](_0x85e579[_0x0788('0x36')][_0x0788('0x3d')]);_0x2a08b7[_0x0788('0x3e')]=qs[_0x0788('0x37')](_['pick'](_0x85e579['query'],_0x1aab6a['filters']),_0x2a64e4);if(_0x85e579['query'][_0x0788('0x3f')]){_0x2a08b7[_0x0788('0x3e')]=_[_0x0788('0x40')](_0x2a08b7[_0x0788('0x3e')],{'$or':_[_0x0788('0x31')](_0x2a64e4,function(_0x5993ad){if(_0x5993ad['type']!==_0x0788('0x41')){var _0x6770a8={};_0x6770a8[_0x5993ad[_0x0788('0x2e')]]={'$like':'%'+_0x85e579[_0x0788('0x36')][_0x0788('0x3f')]+'%'};return _0x6770a8;}})});}_0x2a08b7=_[_0x0788('0x40')]({},_0x2a08b7,_0x85e579[_0x0788('0x42')]);var _0x38ca94={'where':_0x2a08b7[_0x0788('0x3e')]};return db['VoicePrefix']['count'](_0x38ca94)[_0x0788('0x28')](function(_0x1d579d){_0x2db509[_0x0788('0x43')]=_0x1d579d;if(_0x85e579['query']['includeAll']){_0x2a08b7['include']=[{'all':!![]}];}return db[_0x0788('0x32')][_0x0788('0x44')](_0x2a08b7);})[_0x0788('0x28')](function(_0x189d33){_0x2db509[_0x0788('0x45')]=_0x189d33;return _0x2db509;})[_0x0788('0x28')](respondWithFilteredResult(_0x5ec0ed,_0x2a08b7))[_0x0788('0x46')](handleError(_0x5ec0ed,null));};exports[_0x0788('0x47')]=function(_0x4bd0d9,_0x15c618){var _0x19d111={'raw':![],'where':{'id':_0x4bd0d9[_0x0788('0x48')]['id']}},_0x4281ef={};_0x4281ef['model']=_[_0x0788('0x49')](db[_0x0788('0x32')]['rawAttributes']);_0x4281ef['query']=_['keys'](_0x4bd0d9[_0x0788('0x36')]);_0x4281ef['filters']=_[_0x0788('0x38')](_0x4281ef[_0x0788('0x3a')],_0x4281ef[_0x0788('0x36')]);_0x19d111[_0x0788('0x39')]=_[_0x0788('0x38')](_0x4281ef[_0x0788('0x3a')],qs[_0x0788('0x4a')](_0x4bd0d9[_0x0788('0x36')]['fields']));_0x19d111['attributes']=_0x19d111[_0x0788('0x39')][_0x0788('0x3b')]?_0x19d111[_0x0788('0x39')]:_0x4281ef['model'];if(_0x4bd0d9[_0x0788('0x36')][_0x0788('0x4b')]){_0x19d111[_0x0788('0x4c')]=[{'all':!![]}];}_0x19d111=_[_0x0788('0x40')]({},_0x19d111,_0x4bd0d9[_0x0788('0x42')]);return db['VoicePrefix']['find'](_0x19d111)[_0x0788('0x28')](handleEntityNotFound(_0x15c618,null))[_0x0788('0x28')](respondWithResult(_0x15c618,null))['catch'](handleError(_0x15c618,null));};exports[_0x0788('0x27')]=function(_0x4a6cde,_0x2103aa){return db[_0x0788('0x32')][_0x0788('0x4d')]({'where':{'id':_0x4a6cde[_0x0788('0x48')]['id']}})[_0x0788('0x28')](handleEntityNotFound(_0x2103aa,null))[_0x0788('0x28')](removeEntity(_0x2103aa,null))[_0x0788('0x46')](handleError(_0x2103aa,null));};exports[_0x0788('0x4e')]=function(_0x5f3bda,_0x179c6e){return db[_0x0788('0x32')][_0x0788('0x4e')]()['then'](respondWithResult(_0x179c6e,null))[_0x0788('0x46')](handleError(_0x179c6e,null));};exports[_0x0788('0x4f')]=function(_0x59f00e,_0x18e55e){var _0x41110d;return db[_0x0788('0x50')][_0x0788('0x51')](function(_0x137e24){return db[_0x0788('0x32')]['create'](_0x59f00e['body'],{'transaction':_0x137e24})[_0x0788('0x28')](function(_0x36304b){_0x41110d=_0x36304b['get']({'plain':!![]});return db[_0x0788('0x52')][_0x0788('0x4d')]({'where':{'id':_0x41110d[_0x0788('0x53')]},'raw':!![]})[_0x0788('0x28')](function(_0xf543a8){return createVoicePrefixExtensions(_0x41110d,_0xf543a8,_0x137e24);});});})[_0x0788('0x28')](function(){var _0x112870=_0x59f00e[_0x0788('0x54')][_0x0788('0x29')]({'plain':!![]});if(!_0x112870)throw new Error(_0x0788('0x55'));if(_0x112870[_0x0788('0x56')]===_0x0788('0x54')){var _0x55481c=_0x41110d;return db[_0x0788('0x57')][_0x0788('0x4d')]({'where':{'name':_0x0788('0x2a'),'userProfileId':_0x112870['userProfileId']},'raw':!![]})[_0x0788('0x28')](function(_0x329d44){if(_0x329d44&&_0x329d44['autoAssociation']===0x0){return db['UserProfileResource'][_0x0788('0x4f')]({'name':_0x55481c[_0x0788('0x2e')],'resourceId':_0x55481c['id'],'type':_0x329d44[_0x0788('0x2e')],'sectionId':_0x329d44['id']},{})[_0x0788('0x28')](function(){return _0x41110d;});}else{return _0x41110d;}})[_0x0788('0x46')](function(_0x4c08f9){logger['error'](_0x0788('0x58'),_0x4c08f9);throw _0x4c08f9;});}return _0x41110d;})[_0x0788('0x28')](respondWithResult(_0x18e55e,null))[_0x0788('0x46')](handleError(_0x18e55e,null));};function Extension(_0x47be71,_0x533f71,_0x3a25d3,_0x5419d9){this[_0x0788('0x59')]=_0x0788('0x5a');this[_0x0788('0x5b')]=_0x47be71;this[_0x0788('0x5c')]=_0x3a25d3;this[_0x0788('0x35')]=_0x0788('0x5d');this[_0x0788('0x5e')]=_0x0788('0x5f');this[_0x0788('0x60')]=_0x533f71;this[_0x0788('0x61')]=_0x5419d9;}function createVoicePrefixExtensions(_0x59fcbc,_0xe1a934,_0x446170){return new BPromise(function(_0x602e3b,_0x2822aa){var _0x582fed=new Extension(formatPrefixName(_0x59fcbc[_0x0788('0x62')]),0x1,_0x0788('0x63'),_0x0788('0x64'));_0x582fed[_0x0788('0x65')]=_0x59fcbc['id'];return db[_0x0788('0x52')]['create'](_0x582fed,{'transaction':_0x446170})[_0x0788('0x28')](function(_0x4aa3af){var _0x439224=_0x4aa3af[_0x0788('0x29')]({'plain':!![]});var _0x184b66=_[_0x0788('0x31')](addVoicePrefixExtensions(_0x59fcbc,_0xe1a934),function(_0x3baf23){_0x3baf23[_0x0788('0x53')]=_0x439224['id'];_0x3baf23[_0x0788('0x65')]=_0x59fcbc['id'];return _0x3baf23;});return db[_0x0788('0x52')][_0x0788('0x66')](_0x184b66,{'transaction':_0x446170})['then'](function(_0x25201f){if(!_0x25201f){return _0x2822aa(_0x0788('0x67'));}else{return _0x602e3b(_0x25201f);}})[_0x0788('0x46')](function(_0x59a436){return _0x2822aa(_0x59a436);});});;});};function addVoicePrefixExtensions(_0x50eeae,_0x6d255b){var _0x1bb234=[];var _0x31ed44=formatPrefixName(_0x50eeae['prefix']);_0x1bb234[_0x0788('0x68')](new Extension(_0x31ed44,0x2,_0x0788('0x69'),_0x0788('0x6a')+_0x50eeae[_0x0788('0x2e')]));if(_0x50eeae['callerIdAll']){_0x1bb234['push'](new Extension(_0x31ed44,0x3,'Set',_0x0788('0x6b')+_0x50eeae[_0x0788('0x6c')]));}else{_0x1bb234[_0x0788('0x68')](new Extension(_0x31ed44,0x3,'NoOp','No\x20callerid\x20available'));}_0x1bb234[_0x0788('0x68')](new Extension(_0x31ed44,0x4,'goto',_0x6d255b[_0x0788('0x59')]+','+_0x0788('0x6d')+(0x8+_0x50eeae[_0x0788('0x2e')][_0x0788('0x3b')])+'}'+','+0x1));return _0x1bb234;}function formatPrefixName(_0x1834fb){var _0x345755='_';for(var _0x20b01a=0x0;_0x20b01a<_0x1834fb[_0x0788('0x3b')];_0x20b01a++){if(_0x1834fb[_0x0788('0x6e')](_0x20b01a)=='-'){_0x345755+=_0x1834fb[_0x0788('0x6e')](_0x20b01a);}else{_0x345755+='['+_0x1834fb['charAt'](_0x20b01a)+']';}}_0x345755+='.';return _0x345755;}exports[_0x0788('0x6f')]=function(_0x30248c,_0x52926f,_0x5ab357){var _0x3b053e=_0x30248c[_0x0788('0x70')];_0x3b053e[_0x0788('0x62')]=_0x0788('0x71')+_0x3b053e[_0x0788('0x2e')]+'-';return db[_0x0788('0x50')]['transaction'](function(_0x384401){return db[_0x0788('0x32')][_0x0788('0x6f')](_0x3b053e,{'where':{'id':_0x3b053e['id']},'transaction':_0x384401})[_0x0788('0x28')](function(){return db['VoiceExtension'][_0x0788('0x27')]({'where':{'VoicePrefixId':_0x3b053e['id']},'transaction':_0x384401})[_0x0788('0x28')](function(){return db[_0x0788('0x52')][_0x0788('0x4d')]({'where':{'id':_0x3b053e['VoiceExtensionId']},'raw':!![]})['then'](function(_0x7e11f){return createVoicePrefixExtensions(_0x3b053e,_0x7e11f,_0x384401);});});});})[_0x0788('0x28')](function(){return db[_0x0788('0x32')][_0x0788('0x72')](_0x3b053e['id']);})[_0x0788('0x28')](respondWithResult(_0x52926f,null))[_0x0788('0x46')](handleError(_0x52926f,null));};exports[_0x0788('0x73')]=function(_0x31b806,_0x1bd4ec,_0x4e6c4f){return db[_0x0788('0x32')][_0x0788('0x4d')]({'where':{'id':_0x31b806[_0x0788('0x48')]['id']}})['then'](handleEntityNotFound(_0x1bd4ec,null))['then'](function(_0x14fc12){if(_0x14fc12){return _0x14fc12['addAgents'](_0x31b806[_0x0788('0x70')][_0x0788('0x74')],_[_0x0788('0x75')](_0x31b806[_0x0788('0x70')],[_0x0788('0x74'),'id'])||{})[_0x0788('0x76')](function(_0xb944){for(var _0x216ea9=0x0;_0x216ea9<_0x31b806[_0x0788('0x70')]['ids'][_0x0788('0x3b')];_0x216ea9+=0x1){socket[_0x0788('0x77')](_0x0788('0x78'),{'UserId':Number(_0x31b806['body'][_0x0788('0x74')][_0x216ea9]),'VoicePrefixId':Number(_0x31b806[_0x0788('0x48')]['id'])});}return _0xb944;});}})[_0x0788('0x28')](respondWithResult(_0x1bd4ec,null))['catch'](handleError(_0x1bd4ec,null));};exports[_0x0788('0x79')]=function(_0x4486ee,_0x9b98bf,_0x33a2fb){return db[_0x0788('0x32')][_0x0788('0x4d')]({'where':{'id':_0x4486ee[_0x0788('0x48')]['id']}})[_0x0788('0x28')](handleEntityNotFound(_0x9b98bf,null))[_0x0788('0x28')](function(_0x5d8ddb){if(_0x5d8ddb){return _0x5d8ddb[_0x0788('0x79')](_0x4486ee[_0x0788('0x36')][_0x0788('0x74')])[_0x0788('0x28')](function(){if(_[_0x0788('0x7a')](_0x4486ee['query'][_0x0788('0x74')])){for(var _0x358048=0x0;_0x358048<_0x4486ee[_0x0788('0x36')]['ids'][_0x0788('0x3b')];_0x358048+=0x1){socket[_0x0788('0x77')](_0x0788('0x7b'),{'UserId':Number(_0x4486ee[_0x0788('0x36')][_0x0788('0x74')][_0x358048]),'VoicePrefixId':Number(_0x4486ee['params']['id'])});}}else{socket[_0x0788('0x77')](_0x0788('0x7b'),{'UserId':Number(_0x4486ee['query'][_0x0788('0x74')]),'VoicePrefixId':Number(_0x4486ee[_0x0788('0x48')]['id'])});}});}})['then'](respondWithStatusCode(_0x9b98bf,null))[_0x0788('0x46')](handleError(_0x9b98bf,null));};exports[_0x0788('0x7c')]=function(_0x9a0ef,_0x5c2d95,_0x28ad96){var _0x42c537={};var _0xbb5b1d={};var _0x53730a;var _0xddfb97;return db[_0x0788('0x32')][_0x0788('0x7d')]({'where':{'id':_0x9a0ef[_0x0788('0x48')]['id']}})[_0x0788('0x28')](handleEntityNotFound(_0x5c2d95,null))[_0x0788('0x28')](function(_0x2545a7){if(_0x2545a7){_0x53730a=_0x2545a7;_0xbb5b1d[_0x0788('0x3a')]=_['keys'](db[_0x0788('0x7e')][_0x0788('0x33')]);_0xbb5b1d[_0x0788('0x36')]=_[_0x0788('0x49')](_0x9a0ef['query']);_0xbb5b1d['filters']=_[_0x0788('0x38')](_0xbb5b1d[_0x0788('0x3a')],_0xbb5b1d['query']);_0x42c537[_0x0788('0x39')]=_[_0x0788('0x38')](_0xbb5b1d[_0x0788('0x3a')],qs['fields'](_0x9a0ef['query'][_0x0788('0x4a')]));_0x42c537[_0x0788('0x39')]=_0x42c537['attributes']['length']?_0x42c537['attributes']:_0xbb5b1d[_0x0788('0x3a')];_0x42c537[_0x0788('0x7f')]=qs['sort'](_0x9a0ef[_0x0788('0x36')][_0x0788('0x3d')]);_0x42c537[_0x0788('0x3e')]=qs[_0x0788('0x37')](_[_0x0788('0x80')](_0x9a0ef['query'],_0xbb5b1d[_0x0788('0x37')]));if(_0x9a0ef['query'][_0x0788('0x3f')]){_0x42c537['where']=_[_0x0788('0x40')](_0x42c537[_0x0788('0x3e')],{'$or':_[_0x0788('0x31')](_0x42c537[_0x0788('0x39')],function(_0x13f796){var _0x2238f6={};_0x2238f6[_0x13f796]={'$like':'%'+_0x9a0ef[_0x0788('0x36')][_0x0788('0x3f')]+'%'};return _0x2238f6;})});}_0x42c537=_[_0x0788('0x40')]({},_0x42c537,_0x9a0ef[_0x0788('0x42')]);return _0x53730a[_0x0788('0x7c')](_0x42c537);}})[_0x0788('0x28')](function(_0x1d0cb5){if(_0x1d0cb5){_0xddfb97=_0x1d0cb5['length'];if(!_0x9a0ef['query']['hasOwnProperty'](_0x0788('0x81'))){_0x42c537[_0x0788('0x24')]=qs[_0x0788('0x24')](_0x9a0ef[_0x0788('0x36')][_0x0788('0x24')]);_0x42c537[_0x0788('0x22')]=qs[_0x0788('0x22')](_0x9a0ef[_0x0788('0x36')][_0x0788('0x22')]);}return _0x53730a[_0x0788('0x7c')](_0x42c537);}})[_0x0788('0x28')](function(_0x4a4ad4){if(_0x4a4ad4){return _0x4a4ad4?{'count':_0xddfb97,'rows':_0x4a4ad4}:null;}})['then'](respondWithResult(_0x5c2d95,null))[_0x0788('0x46')](handleError(_0x5c2d95,null));};exports[_0x0788('0x82')]=function(_0x104a70,_0x1a3f4d,_0x45e33c){var _0x14ac26={};var _0x37d04b={};var _0x3c77f9;var _0x4e80d1;return db['VoicePrefix'][_0x0788('0x7d')]({'where':{'id':_0x104a70[_0x0788('0x48')]['id']}})[_0x0788('0x28')](handleEntityNotFound(_0x1a3f4d,null))[_0x0788('0x28')](function(_0x437086){if(_0x437086){_0x3c77f9=_0x437086;_0x37d04b[_0x0788('0x3a')]=_['keys'](db[_0x0788('0x83')][_0x0788('0x33')]);_0x37d04b[_0x0788('0x36')]=_[_0x0788('0x49')](_0x104a70[_0x0788('0x36')]);_0x37d04b[_0x0788('0x37')]=_[_0x0788('0x38')](_0x37d04b[_0x0788('0x3a')],_0x37d04b[_0x0788('0x36')]);_0x14ac26['attributes']=_[_0x0788('0x38')](_0x37d04b[_0x0788('0x3a')],qs[_0x0788('0x4a')](_0x104a70[_0x0788('0x36')][_0x0788('0x4a')]));_0x14ac26[_0x0788('0x39')]=_0x14ac26['attributes'][_0x0788('0x3b')]?_0x14ac26[_0x0788('0x39')]:_0x37d04b[_0x0788('0x3a')];_0x14ac26[_0x0788('0x7f')]=qs[_0x0788('0x3d')](_0x104a70[_0x0788('0x36')][_0x0788('0x3d')]);_0x14ac26[_0x0788('0x3e')]=qs[_0x0788('0x37')](_[_0x0788('0x80')](_0x104a70['query'],_0x37d04b[_0x0788('0x37')]));if(_0x104a70['query'][_0x0788('0x3f')]){_0x14ac26['where']=_[_0x0788('0x40')](_0x14ac26['where'],{'$or':_[_0x0788('0x31')](_0x14ac26[_0x0788('0x39')],function(_0x1f1f92){var _0xdfcfaf={};_0xdfcfaf[_0x1f1f92]={'$like':'%'+_0x104a70['query'][_0x0788('0x3f')]+'%'};return _0xdfcfaf;})});}_0x14ac26=_[_0x0788('0x40')]({},_0x14ac26,_0x104a70[_0x0788('0x42')]);return _0x3c77f9['getTeams'](_0x14ac26);}})[_0x0788('0x28')](function(_0x372c4f){if(_0x372c4f){_0x4e80d1=_0x372c4f['length'];if(!_0x104a70[_0x0788('0x36')][_0x0788('0x3c')](_0x0788('0x81'))){_0x14ac26[_0x0788('0x24')]=qs[_0x0788('0x24')](_0x104a70[_0x0788('0x36')][_0x0788('0x24')]);_0x14ac26['offset']=qs[_0x0788('0x22')](_0x104a70[_0x0788('0x36')][_0x0788('0x22')]);}return _0x3c77f9[_0x0788('0x82')](_0x14ac26);}})[_0x0788('0x28')](function(_0x374a10){if(_0x374a10){return _0x374a10?{'count':_0x4e80d1,'rows':_0x374a10}:null;}})[_0x0788('0x28')](respondWithResult(_0x1a3f4d,null))[_0x0788('0x46')](handleError(_0x1a3f4d,null));};exports['addTeams']=function(_0x5130c4,_0x26233b,_0x42f6df){var _0x198501=_0x5130c4[_0x0788('0x70')][_0x0788('0x74')];var _0xbedb18;return db[_0x0788('0x83')]['findAll']({'where':{'id':_0x198501},'attributes':['id'],'include':[{'model':db[_0x0788('0x7e')],'as':'Agents','attributes':['id','name',_0x0788('0x84'),_0x0788('0x85'),'interface'],'raw':!![]}]})[_0x0788('0x28')](function(_0x66474b){if(_0x66474b){_0xbedb18=_0x66474b;var _0x28d0f8=_[_0x0788('0x86')](_0x66474b,function(_0x3b7f9c){var _0x328606=_0x3b7f9c['get']({'plain':!![]});return _0x328606[_0x0788('0x87')];});return db[_0x0788('0x32')]['find']({'where':{'id':_0x5130c4[_0x0788('0x48')]['id']}})[_0x0788('0x28')](function(_0x4c59c4){return db[_0x0788('0x50')][_0x0788('0x51')](function(_0x28417e){return _0x4c59c4[_0x0788('0x88')](_0x198501,{'transaction':_0x28417e})[_0x0788('0x28')](function(){return BPromise[_0x0788('0x89')](_0xbedb18,function(_0x129506){return db['TeamVoicePrefix'][_0x0788('0x8a')]({'TeamId':_0x129506['id'],'VoicePrefixId':_0x5130c4[_0x0788('0x48')]['id']},{'transaction':_0x28417e});});})[_0x0788('0x28')](function(){return BPromise[_0x0788('0x89')](_0x28d0f8,function(_0x4c0f3d){return db[_0x0788('0x8b')][_0x0788('0x8c')]({'where':{'UserId':_0x4c0f3d['id'],'VoicePrefixId':_0x5130c4['params']['id']},'transaction':_0x28417e});});})['then'](function(){_0x28d0f8[_0x0788('0x8d')](function(_0x15a70b){socket[_0x0788('0x77')](_0x0788('0x78'),{'UserId':_0x15a70b['id'],'VoicePrefixId':_0x4c59c4['id']});});});});});}})[_0x0788('0x28')](respondWithStatusCode(_0x26233b,null))[_0x0788('0x46')](handleError(_0x26233b,null));};exports['removeTeams']=function(_0x3309e1,_0x38e809,_0x1d25bf){return db[_0x0788('0x83')][_0x0788('0x44')]({'where':{'id':_0x3309e1[_0x0788('0x36')][_0x0788('0x74')]},'attributes':['id'],'include':[{'model':db[_0x0788('0x7e')],'as':_0x0788('0x87'),'attributes':['id'],'raw':!![]}]})[_0x0788('0x28')](handleEntityNotFound(_0x38e809,null))[_0x0788('0x28')](function(_0x2297ab){var _0x235106=_[_0x0788('0x31')](_0x2297ab,'id');var _0x17da6a=[];var _0x150a05=[];var _0x1e0fb7=squel['select']();_0x1e0fb7[_0x0788('0x8e')](_0x0788('0x8f'))[_0x0788('0x90')](_0x0788('0x91'),'tq')['join'](_0x0788('0x92'),'ut','ut.TeamId\x20=\x20tq.TeamId')[_0x0788('0x3e')]('VoicePrefixId\x20=\x20?',_0x3309e1['params']['id']);for(var _0x34a12a=0x0;_0x34a12a<_0x2297ab[_0x0788('0x3b')];_0x34a12a+=0x1){let _0x552a5c=_0x2297ab[_0x34a12a];for(var _0x605f17=0x0;_0x605f17<_0x552a5c['Agents'][_0x0788('0x3b')];_0x605f17+=0x1){let _0x4c86ef=_0x552a5c[_0x0788('0x87')][_0x605f17];var _0x197568=_0x1e0fb7[_0x0788('0x93')]();_0x197568[_0x0788('0x3e')](_0x0788('0x94'),_0x4c86ef['id']);_0x150a05[_0x0788('0x68')](db['sequelize'][_0x0788('0x36')](_0x197568['toString'](),{'type':db[_0x0788('0x50')][_0x0788('0x95')]['SELECT']})['then'](function(_0x4c1ca6){if(_0x4c1ca6[_0x0788('0x3b')]===0x1){return _0x4c86ef['id'];}else{var _0x4b2ca7=_['every'](_['map'](_0x4c1ca6,'TeamId'),function(_0x4ce12d){return _['includes'](_0x235106,_0x4ce12d);});if(_0x4b2ca7){return _0x4c86ef['id'];}}}));}}return BPromise[_0x0788('0x96')](_0x150a05)[_0x0788('0x28')](function(_0x55e987){_0x17da6a=_(_0x17da6a)[_0x0788('0x97')](_0x55e987)['compact']()[_0x0788('0x98')]();return db['VoicePrefix'][_0x0788('0x4d')]({'where':{'id':_0x3309e1[_0x0788('0x48')]['id']}})[_0x0788('0x28')](function(_0x12448a){return db[_0x0788('0x50')][_0x0788('0x51')](function(_0x2e0714){return _0x12448a[_0x0788('0x99')](_0x3309e1[_0x0788('0x36')][_0x0788('0x74')],{'transaction':_0x2e0714})['then'](function(){if(!_[_0x0788('0x9a')](_0x17da6a)){return _0x12448a['removeAgents'](_0x17da6a,{'transaction':_0x2e0714});}})[_0x0788('0x28')](function(){_0x17da6a['forEach'](function(_0x58769c){socket[_0x0788('0x77')](_0x0788('0x7b'),{'UserId':_0x58769c,'VoicePrefixId':_0x12448a['id']});});});});});});})[_0x0788('0x28')](respondWithStatusCode(_0x38e809,null))['catch'](handleError(_0x38e809,null));}; \ No newline at end of file +var _0x1c9a=['sox','to-csv','fs-extra','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./voicePrefix.socket','sendStatus','status','end','offset','limit','undefined','set','Content-Range','apply','reject','update','then','destroy','VoicePrefixes','UserProfileResource','error','stack','send','index','map','VoicePrefix','rawAttributes','fieldName','type','model','name','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','merge','VIRTUAL','options','count','includeAll','include','findAll','rows','catch','find','params','describe','sequelize','create','get','role','UserProfileSection','userProfileId','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','from-sip','exten','app','system','description','Voice\x20Prefix\x20Extension','priority','appdata','prefix','NoOp','Voice\x20Prefix','VoicePrefixId','VoiceExtensionId','VoiceExtension','Extensions\x20creation\x20failed','push','CDR(prefix)=','callerIdAll','Set','PREFIX-CALLERIDALL=','No\x20callerid\x20available','context','${EXTEN:','charAt','body','system-','transaction','findById','addAgents','ids','omit','spread','emit','userVoicePrefix:save','removeAgents','isArray','userVoicePrefix:remove','User','filter','getAgents','getTeams','findOne','addTeams','Team','Agents','online','voicePause','flatMap','each','TeamVoicePrefix','UserVoicePrefix','findOrCreate','forEach','removeTeams','select','field','tq.TeamId','from','team_has_voice_prefixes','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoicePrefixId\x20=\x20?','clone','ut.UserId\x20=\x20?','toString','every','TeamId','includes','all','union','compact','isEmpty','eml-format','zip-dir','request-promise','moment','bluebird','util','path'];(function(_0x27af45,_0x1b57aa){var _0x18df21=function(_0x4b7679){while(--_0x4b7679){_0x27af45['push'](_0x27af45['shift']());}};_0x18df21(++_0x1b57aa);}(_0x1c9a,0x98));var _0xa1c9=function(_0x17f278,_0xf6e68c){_0x17f278=_0x17f278-0x0;var _0xa2ad8=_0x1c9a[_0x17f278];return _0xa2ad8;};'use strict';var emlformat=require(_0xa1c9('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xa1c9('0x1'));var jsonpatch=require('fast-json-patch');var rp=require(_0xa1c9('0x2'));var moment=require(_0xa1c9('0x3'));var BPromise=require(_0xa1c9('0x4'));var Mustache=require('mustache');var util=require(_0xa1c9('0x5'));var path=require(_0xa1c9('0x6'));var sox=require(_0xa1c9('0x7'));var csv=require(_0xa1c9('0x8'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xa1c9('0x9'));var _=require('lodash');var squel=require(_0xa1c9('0xa'));var crypto=require(_0xa1c9('0xb'));var jsforce=require(_0xa1c9('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xa1c9('0x8'));var querystring=require(_0xa1c9('0xd'));var Papa=require(_0xa1c9('0xe'));var Redis=require(_0xa1c9('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xa1c9('0x10'));var as=require(_0xa1c9('0x11'));var hardwareService=require(_0xa1c9('0x12'));var logger=require(_0xa1c9('0x13'))(_0xa1c9('0x14'));var utils=require(_0xa1c9('0x15'));var config=require(_0xa1c9('0x16'));var licenseUtil=require(_0xa1c9('0x17'));var db=require(_0xa1c9('0x18'))['db'];config[_0xa1c9('0x19')]=_['defaults'](config[_0xa1c9('0x19')],{'host':_0xa1c9('0x1a'),'port':0x18eb});var socket=require(_0xa1c9('0x1b'))(new Redis(config[_0xa1c9('0x19')]));require(_0xa1c9('0x1c'))['register'](socket);function respondWithStatusCode(_0x335dda,_0x4b2fa5){_0x4b2fa5=_0x4b2fa5||0xcc;return function(_0x2cba13){if(_0x2cba13){return _0x335dda[_0xa1c9('0x1d')](_0x4b2fa5);}return _0x335dda[_0xa1c9('0x1e')](_0x4b2fa5)[_0xa1c9('0x1f')]();};}function respondWithResult(_0x44ab5b,_0x3b51f5){_0x3b51f5=_0x3b51f5||0xc8;return function(_0x1f6d26){if(_0x1f6d26){return _0x44ab5b[_0xa1c9('0x1e')](_0x3b51f5)['json'](_0x1f6d26);}};}function respondWithFilteredResult(_0x11ca10,_0x1084d2){return function(_0x224ae4){if(_0x224ae4){var _0x50db9b=typeof _0x1084d2[_0xa1c9('0x20')]==='undefined'&&typeof _0x1084d2[_0xa1c9('0x21')]===_0xa1c9('0x22');var _0x204d54=_0x224ae4['count'];var _0x3a1110=_0x50db9b?0x0:_0x1084d2[_0xa1c9('0x20')];var _0x128732=_0x50db9b?_0x224ae4['count']:_0x1084d2[_0xa1c9('0x20')]+_0x1084d2[_0xa1c9('0x21')];var _0x4c6dbb;if(_0x128732>=_0x204d54){_0x128732=_0x204d54;_0x4c6dbb=0xc8;}else{_0x4c6dbb=0xce;}_0x11ca10[_0xa1c9('0x1e')](_0x4c6dbb);return _0x11ca10[_0xa1c9('0x23')](_0xa1c9('0x24'),_0x3a1110+'-'+_0x128732+'/'+_0x204d54)['json'](_0x224ae4);}return null;};}function patchUpdates(_0x29f1b1){return function(_0x3dcec5){try{jsonpatch[_0xa1c9('0x25')](_0x3dcec5,_0x29f1b1,!![]);}catch(_0x23a461){return BPromise[_0xa1c9('0x26')](_0x23a461);}return _0x3dcec5['save']();};}function saveUpdates(_0x50b16b,_0x200749){return function(_0x50b16d){if(_0x50b16d){return _0x50b16d[_0xa1c9('0x27')](_0x50b16b)[_0xa1c9('0x28')](function(_0x1c6f37){return _0x1c6f37;});}return null;};}function removeEntity(_0x3059eb,_0x339ed1){return function(_0x522dc0){if(_0x522dc0){return _0x522dc0[_0xa1c9('0x29')]()[_0xa1c9('0x28')](function(){var _0x20cbe1=_0x522dc0['get']({'plain':!![]});var _0x133f80=_0xa1c9('0x2a');return db[_0xa1c9('0x2b')]['destroy']({'where':{'type':_0x133f80,'resourceId':_0x20cbe1['id']}})[_0xa1c9('0x28')](function(){return _0x522dc0;});})[_0xa1c9('0x28')](function(){_0x3059eb['status'](0xcc)[_0xa1c9('0x1f')]();});}};}function handleEntityNotFound(_0x48ce34,_0xdf6d0c){return function(_0x2404c3){if(!_0x2404c3){_0x48ce34[_0xa1c9('0x1d')](0x194);}return _0x2404c3;};}function handleError(_0x254b13,_0x40b9d5){_0x40b9d5=_0x40b9d5||0x1f4;return function(_0xe8523b){logger[_0xa1c9('0x2c')](_0xe8523b[_0xa1c9('0x2d')]);if(_0xe8523b['name']){delete _0xe8523b['name'];}_0x254b13[_0xa1c9('0x1e')](_0x40b9d5)[_0xa1c9('0x2e')](_0xe8523b);};}exports[_0xa1c9('0x2f')]=function(_0xf419d0,_0x3161b0){var _0x5b67c3={},_0x53f325={},_0x5aecd7={'count':0x0,'rows':[]};var _0x259ac3=_[_0xa1c9('0x30')](db[_0xa1c9('0x31')][_0xa1c9('0x32')],function(_0x39cf81){return{'name':_0x39cf81[_0xa1c9('0x33')],'type':_0x39cf81[_0xa1c9('0x34')]['key']};});_0x53f325[_0xa1c9('0x35')]=_['map'](_0x259ac3,_0xa1c9('0x36'));_0x53f325['query']=_[_0xa1c9('0x37')](_0xf419d0[_0xa1c9('0x38')]);_0x53f325[_0xa1c9('0x39')]=_['intersection'](_0x53f325[_0xa1c9('0x35')],_0x53f325[_0xa1c9('0x38')]);_0x5b67c3[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x53f325['model'],qs['fields'](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x5b67c3[_0xa1c9('0x3a')]=_0x5b67c3[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x5b67c3[_0xa1c9('0x3a')]:_0x53f325[_0xa1c9('0x35')];if(!_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x5b67c3['limit']=qs[_0xa1c9('0x21')](_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x5b67c3[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0xf419d0[_0xa1c9('0x38')]['offset']);}_0x5b67c3[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0xf419d0[_0xa1c9('0x38')]['sort']);_0x5b67c3[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0xf419d0[_0xa1c9('0x38')],_0x53f325[_0xa1c9('0x39')]),_0x259ac3);if(_0xf419d0['query']['filter']){_0x5b67c3[_0xa1c9('0x42')]=_[_0xa1c9('0x43')](_0x5b67c3[_0xa1c9('0x42')],{'$or':_[_0xa1c9('0x30')](_0x259ac3,function(_0xd9e67){if(_0xd9e67[_0xa1c9('0x34')]!==_0xa1c9('0x44')){var _0x146e47={};_0x146e47[_0xd9e67[_0xa1c9('0x36')]]={'$like':'%'+_0xf419d0[_0xa1c9('0x38')]['filter']+'%'};return _0x146e47;}})});}_0x5b67c3=_['merge']({},_0x5b67c3,_0xf419d0[_0xa1c9('0x45')]);var _0x46920c={'where':_0x5b67c3['where']};return db[_0xa1c9('0x31')][_0xa1c9('0x46')](_0x46920c)[_0xa1c9('0x28')](function(_0x36c846){_0x5aecd7[_0xa1c9('0x46')]=_0x36c846;if(_0xf419d0[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x5b67c3[_0xa1c9('0x48')]=[{'all':!![]}];}return db[_0xa1c9('0x31')][_0xa1c9('0x49')](_0x5b67c3);})[_0xa1c9('0x28')](function(_0x50cc27){_0x5aecd7[_0xa1c9('0x4a')]=_0x50cc27;return _0x5aecd7;})['then'](respondWithFilteredResult(_0x3161b0,_0x5b67c3))[_0xa1c9('0x4b')](handleError(_0x3161b0,null));};exports['show']=function(_0x42be67,_0x4a9e02){var _0x43598b={'raw':![],'where':{'id':_0x42be67['params']['id']}},_0x18bb43={};_0x18bb43[_0xa1c9('0x35')]=_[_0xa1c9('0x37')](db['VoicePrefix'][_0xa1c9('0x32')]);_0x18bb43[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x42be67[_0xa1c9('0x38')]);_0x18bb43[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x18bb43['model'],_0x18bb43[_0xa1c9('0x38')]);_0x43598b[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x18bb43[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x42be67['query']['fields']));_0x43598b['attributes']=_0x43598b[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x43598b[_0xa1c9('0x3a')]:_0x18bb43['model'];if(_0x42be67[_0xa1c9('0x38')][_0xa1c9('0x47')]){_0x43598b['include']=[{'all':!![]}];}_0x43598b=_[_0xa1c9('0x43')]({},_0x43598b,_0x42be67['options']);return db['VoicePrefix'][_0xa1c9('0x4c')](_0x43598b)[_0xa1c9('0x28')](handleEntityNotFound(_0x4a9e02,null))[_0xa1c9('0x28')](respondWithResult(_0x4a9e02,null))[_0xa1c9('0x4b')](handleError(_0x4a9e02,null));};exports[_0xa1c9('0x29')]=function(_0x31fbb8,_0x18aa46){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x31fbb8[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x18aa46,null))[_0xa1c9('0x28')](removeEntity(_0x18aa46,null))[_0xa1c9('0x4b')](handleError(_0x18aa46,null));};exports[_0xa1c9('0x4e')]=function(_0x149450,_0x112f82){return db[_0xa1c9('0x31')][_0xa1c9('0x4e')]()[_0xa1c9('0x28')](respondWithResult(_0x112f82,null))['catch'](handleError(_0x112f82,null));};exports['create']=function(_0x12118e,_0x6160fc){var _0x66a5eb;return db[_0xa1c9('0x4f')]['transaction'](function(_0x449e85){return db[_0xa1c9('0x31')][_0xa1c9('0x50')](_0x12118e['body'],{'transaction':_0x449e85})[_0xa1c9('0x28')](function(_0x3f650a){_0x66a5eb=_0x3f650a['get']({'plain':!![]});return db['VoiceExtension'][_0xa1c9('0x4c')]({'where':{'id':_0x66a5eb['VoiceExtensionId']},'raw':!![]})[_0xa1c9('0x28')](function(_0x1bd5c7){return createVoicePrefixExtensions(_0x66a5eb,_0x1bd5c7,_0x449e85);});});})[_0xa1c9('0x28')](function(){var _0x4c1165=_0x12118e['user'][_0xa1c9('0x51')]({'plain':!![]});if(!_0x4c1165)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x4c1165[_0xa1c9('0x52')]==='user'){var _0x3334ad=_0x66a5eb;return db[_0xa1c9('0x53')][_0xa1c9('0x4c')]({'where':{'name':_0xa1c9('0x2a'),'userProfileId':_0x4c1165[_0xa1c9('0x54')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x3917ed){if(_0x3917ed&&_0x3917ed['autoAssociation']===0x0){return db[_0xa1c9('0x2b')][_0xa1c9('0x50')]({'name':_0x3334ad['name'],'resourceId':_0x3334ad['id'],'type':_0x3917ed['name'],'sectionId':_0x3917ed['id']},{})['then'](function(){return _0x66a5eb;});}else{return _0x66a5eb;}})[_0xa1c9('0x4b')](function(_0x55fe87){logger[_0xa1c9('0x2c')](_0xa1c9('0x55'),_0x55fe87);throw _0x55fe87;});}return _0x66a5eb;})[_0xa1c9('0x28')](respondWithResult(_0x6160fc,null))[_0xa1c9('0x4b')](handleError(_0x6160fc,null));};function Extension(_0x2f0c80,_0x5b81f4,_0x4bf711,_0x48950c){this['context']=_0xa1c9('0x56');this[_0xa1c9('0x57')]=_0x2f0c80;this[_0xa1c9('0x58')]=_0x4bf711;this[_0xa1c9('0x34')]=_0xa1c9('0x59');this[_0xa1c9('0x5a')]=_0xa1c9('0x5b');this[_0xa1c9('0x5c')]=_0x5b81f4;this[_0xa1c9('0x5d')]=_0x48950c;}function createVoicePrefixExtensions(_0x317799,_0x4639cf,_0xef5d24){return new BPromise(function(_0x288267,_0x29d833){var _0x51f675=new Extension(formatPrefixName(_0x317799[_0xa1c9('0x5e')]),0x1,_0xa1c9('0x5f'),_0xa1c9('0x60'));_0x51f675[_0xa1c9('0x61')]=_0x317799['id'];return db['VoiceExtension'][_0xa1c9('0x50')](_0x51f675,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x1b2cff){var _0x39ffed=_0x1b2cff['get']({'plain':!![]});var _0x4b9aa8=_[_0xa1c9('0x30')](addVoicePrefixExtensions(_0x317799,_0x4639cf),function(_0x2a89d2){_0x2a89d2[_0xa1c9('0x62')]=_0x39ffed['id'];_0x2a89d2[_0xa1c9('0x61')]=_0x317799['id'];return _0x2a89d2;});return db[_0xa1c9('0x63')]['bulkCreate'](_0x4b9aa8,{'transaction':_0xef5d24})[_0xa1c9('0x28')](function(_0x21abdf){if(!_0x21abdf){return _0x29d833(_0xa1c9('0x64'));}else{return _0x288267(_0x21abdf);}})[_0xa1c9('0x4b')](function(_0x5ba7aa){return _0x29d833(_0x5ba7aa);});});;});};function addVoicePrefixExtensions(_0x37613f,_0x17d848){var _0xa18fa4=[];var _0x5a5c65=formatPrefixName(_0x37613f[_0xa1c9('0x5e')]);_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x2,'Set',_0xa1c9('0x66')+_0x37613f[_0xa1c9('0x36')]));if(_0x37613f[_0xa1c9('0x67')]){_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x68'),_0xa1c9('0x69')+_0x37613f[_0xa1c9('0x67')]));}else{_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x3,_0xa1c9('0x5f'),_0xa1c9('0x6a')));}_0xa18fa4[_0xa1c9('0x65')](new Extension(_0x5a5c65,0x4,'goto',_0x17d848[_0xa1c9('0x6b')]+','+_0xa1c9('0x6c')+(0x8+_0x37613f[_0xa1c9('0x36')][_0xa1c9('0x3d')])+'}'+','+0x1));return _0xa18fa4;}function formatPrefixName(_0x5961aa){var _0x358481='_';for(var _0xdbc56a=0x0;_0xdbc56a<_0x5961aa[_0xa1c9('0x3d')];_0xdbc56a++){if(_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)=='-'){_0x358481+=_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a);}else{_0x358481+='['+_0x5961aa[_0xa1c9('0x6d')](_0xdbc56a)+']';}}_0x358481+='.';return _0x358481;}exports[_0xa1c9('0x27')]=function(_0x27048c,_0xb24e0b,_0x178e47){var _0x1fec82=_0x27048c[_0xa1c9('0x6e')];_0x1fec82[_0xa1c9('0x5e')]=_0xa1c9('0x6f')+_0x1fec82['name']+'-';return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x1f219d){return db[_0xa1c9('0x31')][_0xa1c9('0x27')](_0x1fec82,{'where':{'id':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['destroy']({'where':{'VoicePrefixId':_0x1fec82['id']},'transaction':_0x1f219d})[_0xa1c9('0x28')](function(){return db[_0xa1c9('0x63')]['find']({'where':{'id':_0x1fec82[_0xa1c9('0x62')]},'raw':!![]})[_0xa1c9('0x28')](function(_0x150d76){return createVoicePrefixExtensions(_0x1fec82,_0x150d76,_0x1f219d);});});});})[_0xa1c9('0x28')](function(){return db['VoicePrefix'][_0xa1c9('0x71')](_0x1fec82['id']);})['then'](respondWithResult(_0xb24e0b,null))['catch'](handleError(_0xb24e0b,null));};exports[_0xa1c9('0x72')]=function(_0x134d3f,_0x40f420,_0x423c58){return db['VoicePrefix'][_0xa1c9('0x4c')]({'where':{'id':_0x134d3f[_0xa1c9('0x4d')]['id']}})['then'](handleEntityNotFound(_0x40f420,null))[_0xa1c9('0x28')](function(_0x464da9){if(_0x464da9){return _0x464da9[_0xa1c9('0x72')](_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')],_[_0xa1c9('0x74')](_0x134d3f['body'],['ids','id'])||{})[_0xa1c9('0x75')](function(_0x52e78b){for(var _0x3de2c7=0x0;_0x3de2c7<_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3de2c7+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':Number(_0x134d3f[_0xa1c9('0x6e')][_0xa1c9('0x73')][_0x3de2c7]),'VoicePrefixId':Number(_0x134d3f[_0xa1c9('0x4d')]['id'])});}return _0x52e78b;});}})['then'](respondWithResult(_0x40f420,null))[_0xa1c9('0x4b')](handleError(_0x40f420,null));};exports['removeAgents']=function(_0x4a8841,_0x8bc83d,_0x518811){return db[_0xa1c9('0x31')][_0xa1c9('0x4c')]({'where':{'id':_0x4a8841[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x8bc83d,null))[_0xa1c9('0x28')](function(_0x2a17b7){if(_0x2a17b7){return _0x2a17b7[_0xa1c9('0x78')](_0x4a8841['query'][_0xa1c9('0x73')])[_0xa1c9('0x28')](function(){if(_[_0xa1c9('0x79')](_0x4a8841['query']['ids'])){for(var _0x3f4f76=0x0;_0x3f4f76<_0x4a8841['query'][_0xa1c9('0x73')][_0xa1c9('0x3d')];_0x3f4f76+=0x1){socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841['query'][_0xa1c9('0x73')][_0x3f4f76]),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}}else{socket[_0xa1c9('0x76')](_0xa1c9('0x7a'),{'UserId':Number(_0x4a8841[_0xa1c9('0x38')]['ids']),'VoicePrefixId':Number(_0x4a8841[_0xa1c9('0x4d')]['id'])});}});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x8bc83d,null))[_0xa1c9('0x4b')](handleError(_0x8bc83d,null));};exports['getAgents']=function(_0x3936cb,_0x175662,_0x134935){var _0x197721={};var _0x7281bd={};var _0x35a356;var _0x53ea3b;return db[_0xa1c9('0x31')]['findOne']({'where':{'id':_0x3936cb[_0xa1c9('0x4d')]['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x175662,null))['then'](function(_0x28d323){if(_0x28d323){_0x35a356=_0x28d323;_0x7281bd['model']=_[_0xa1c9('0x37')](db[_0xa1c9('0x7b')][_0xa1c9('0x32')]);_0x7281bd[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x3936cb[_0xa1c9('0x38')]);_0x7281bd[_0xa1c9('0x39')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],_0x7281bd[_0xa1c9('0x38')]);_0x197721[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x7281bd[_0xa1c9('0x35')],qs[_0xa1c9('0x3c')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x197721['attributes']=_0x197721['attributes'][_0xa1c9('0x3d')]?_0x197721[_0xa1c9('0x3a')]:_0x7281bd[_0xa1c9('0x35')];_0x197721['order']=qs[_0xa1c9('0x41')](_0x3936cb['query']['sort']);_0x197721[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x3936cb[_0xa1c9('0x38')],_0x7281bd['filters']));if(_0x3936cb['query'][_0xa1c9('0x7c')]){_0x197721['where']=_[_0xa1c9('0x43')](_0x197721[_0xa1c9('0x42')],{'$or':_['map'](_0x197721[_0xa1c9('0x3a')],function(_0x1277eb){var _0x88cb2c={};_0x88cb2c[_0x1277eb]={'$like':'%'+_0x3936cb[_0xa1c9('0x38')]['filter']+'%'};return _0x88cb2c;})});}_0x197721=_[_0xa1c9('0x43')]({},_0x197721,_0x3936cb[_0xa1c9('0x45')]);return _0x35a356[_0xa1c9('0x7d')](_0x197721);}})[_0xa1c9('0x28')](function(_0x465162){if(_0x465162){_0x53ea3b=_0x465162[_0xa1c9('0x3d')];if(!_0x3936cb['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x197721['limit']=qs['limit'](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x197721[_0xa1c9('0x20')]=qs[_0xa1c9('0x20')](_0x3936cb[_0xa1c9('0x38')][_0xa1c9('0x20')]);}return _0x35a356['getAgents'](_0x197721);}})[_0xa1c9('0x28')](function(_0x4deadc){if(_0x4deadc){return _0x4deadc?{'count':_0x53ea3b,'rows':_0x4deadc}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x175662,null))[_0xa1c9('0x4b')](handleError(_0x175662,null));};exports[_0xa1c9('0x7e')]=function(_0x59bc9f,_0x1c8a80,_0x2780b7){var _0x26f241={};var _0x537f48={};var _0x4e1e2f;var _0x46d8d1;return db['VoicePrefix'][_0xa1c9('0x7f')]({'where':{'id':_0x59bc9f['params']['id']}})[_0xa1c9('0x28')](handleEntityNotFound(_0x1c8a80,null))[_0xa1c9('0x28')](function(_0x2d2374){if(_0x2d2374){_0x4e1e2f=_0x2d2374;_0x537f48['model']=_['keys'](db['Team'][_0xa1c9('0x32')]);_0x537f48[_0xa1c9('0x38')]=_[_0xa1c9('0x37')](_0x59bc9f[_0xa1c9('0x38')]);_0x537f48['filters']=_['intersection'](_0x537f48[_0xa1c9('0x35')],_0x537f48['query']);_0x26f241[_0xa1c9('0x3a')]=_[_0xa1c9('0x3b')](_0x537f48[_0xa1c9('0x35')],qs['fields'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x3c')]));_0x26f241[_0xa1c9('0x3a')]=_0x26f241[_0xa1c9('0x3a')][_0xa1c9('0x3d')]?_0x26f241[_0xa1c9('0x3a')]:_0x537f48[_0xa1c9('0x35')];_0x26f241[_0xa1c9('0x40')]=qs[_0xa1c9('0x41')](_0x59bc9f[_0xa1c9('0x38')]['sort']);_0x26f241[_0xa1c9('0x42')]=qs[_0xa1c9('0x39')](_['pick'](_0x59bc9f[_0xa1c9('0x38')],_0x537f48[_0xa1c9('0x39')]));if(_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x7c')]){_0x26f241[_0xa1c9('0x42')]=_['merge'](_0x26f241[_0xa1c9('0x42')],{'$or':_['map'](_0x26f241[_0xa1c9('0x3a')],function(_0x2c04c5){var _0x137a58={};_0x137a58[_0x2c04c5]={'$like':'%'+_0x59bc9f['query'][_0xa1c9('0x7c')]+'%'};return _0x137a58;})});}_0x26f241=_[_0xa1c9('0x43')]({},_0x26f241,_0x59bc9f[_0xa1c9('0x45')]);return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x328fa7){if(_0x328fa7){_0x46d8d1=_0x328fa7[_0xa1c9('0x3d')];if(!_0x59bc9f['query'][_0xa1c9('0x3e')](_0xa1c9('0x3f'))){_0x26f241[_0xa1c9('0x21')]=qs['limit'](_0x59bc9f[_0xa1c9('0x38')][_0xa1c9('0x21')]);_0x26f241['offset']=qs[_0xa1c9('0x20')](_0x59bc9f['query'][_0xa1c9('0x20')]);}return _0x4e1e2f[_0xa1c9('0x7e')](_0x26f241);}})[_0xa1c9('0x28')](function(_0x3e5016){if(_0x3e5016){return _0x3e5016?{'count':_0x46d8d1,'rows':_0x3e5016}:null;}})[_0xa1c9('0x28')](respondWithResult(_0x1c8a80,null))['catch'](handleError(_0x1c8a80,null));};exports[_0xa1c9('0x80')]=function(_0xabacf1,_0x38a7fc,_0x2a3082){var _0x276c98=_0xabacf1[_0xa1c9('0x6e')][_0xa1c9('0x73')];var _0x48520d;return db[_0xa1c9('0x81')][_0xa1c9('0x49')]({'where':{'id':_0x276c98},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id','name',_0xa1c9('0x83'),_0xa1c9('0x84'),'interface'],'raw':!![]}]})[_0xa1c9('0x28')](function(_0x2a82fd){if(_0x2a82fd){_0x48520d=_0x2a82fd;var _0x419cf2=_[_0xa1c9('0x85')](_0x2a82fd,function(_0x51884d){var _0x52360b=_0x51884d[_0xa1c9('0x51')]({'plain':!![]});return _0x52360b['Agents'];});return db[_0xa1c9('0x31')]['find']({'where':{'id':_0xabacf1['params']['id']}})[_0xa1c9('0x28')](function(_0x507b2a){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x296607){return _0x507b2a[_0xa1c9('0x80')](_0x276c98,{'transaction':_0x296607})[_0xa1c9('0x28')](function(){return BPromise[_0xa1c9('0x86')](_0x48520d,function(_0x531c20){return db[_0xa1c9('0x87')]['upsert']({'TeamId':_0x531c20['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},{'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){return BPromise['each'](_0x419cf2,function(_0x110617){return db[_0xa1c9('0x88')][_0xa1c9('0x89')]({'where':{'UserId':_0x110617['id'],'VoicePrefixId':_0xabacf1[_0xa1c9('0x4d')]['id']},'transaction':_0x296607});});})[_0xa1c9('0x28')](function(){_0x419cf2[_0xa1c9('0x8a')](function(_0x5640bb){socket[_0xa1c9('0x76')](_0xa1c9('0x77'),{'UserId':_0x5640bb['id'],'VoicePrefixId':_0x507b2a['id']});});});});});}})[_0xa1c9('0x28')](respondWithStatusCode(_0x38a7fc,null))['catch'](handleError(_0x38a7fc,null));};exports[_0xa1c9('0x8b')]=function(_0x4c8c5e,_0x3cb7d4,_0x5c504c){return db['Team'][_0xa1c9('0x49')]({'where':{'id':_0x4c8c5e['query'][_0xa1c9('0x73')]},'attributes':['id'],'include':[{'model':db[_0xa1c9('0x7b')],'as':_0xa1c9('0x82'),'attributes':['id'],'raw':!![]}]})[_0xa1c9('0x28')](handleEntityNotFound(_0x3cb7d4,null))['then'](function(_0x4423e8){var _0x2c75e6=_['map'](_0x4423e8,'id');var _0x163589=[];var _0x5f3e31=[];var _0x6e0efe=squel[_0xa1c9('0x8c')]();_0x6e0efe[_0xa1c9('0x8d')](_0xa1c9('0x8e'))[_0xa1c9('0x8f')](_0xa1c9('0x90'),'tq')[_0xa1c9('0x91')](_0xa1c9('0x92'),'ut',_0xa1c9('0x93'))[_0xa1c9('0x42')](_0xa1c9('0x94'),_0x4c8c5e[_0xa1c9('0x4d')]['id']);for(var _0x2953bd=0x0;_0x2953bd<_0x4423e8['length'];_0x2953bd+=0x1){let _0x28050b=_0x4423e8[_0x2953bd];for(var _0x3f998a=0x0;_0x3f998a<_0x28050b['Agents'][_0xa1c9('0x3d')];_0x3f998a+=0x1){let _0x12cdd5=_0x28050b[_0xa1c9('0x82')][_0x3f998a];var _0x1c5baa=_0x6e0efe[_0xa1c9('0x95')]();_0x1c5baa[_0xa1c9('0x42')](_0xa1c9('0x96'),_0x12cdd5['id']);_0x5f3e31[_0xa1c9('0x65')](db['sequelize']['query'](_0x1c5baa[_0xa1c9('0x97')](),{'type':db[_0xa1c9('0x4f')]['QueryTypes']['SELECT']})['then'](function(_0x5c9f06){if(_0x5c9f06['length']===0x1){return _0x12cdd5['id'];}else{var _0x4d6b40=_[_0xa1c9('0x98')](_[_0xa1c9('0x30')](_0x5c9f06,_0xa1c9('0x99')),function(_0x20c454){return _[_0xa1c9('0x9a')](_0x2c75e6,_0x20c454);});if(_0x4d6b40){return _0x12cdd5['id'];}}}));}}return BPromise[_0xa1c9('0x9b')](_0x5f3e31)['then'](function(_0x22fde9){_0x163589=_(_0x163589)[_0xa1c9('0x9c')](_0x22fde9)[_0xa1c9('0x9d')]()['value']();return db[_0xa1c9('0x31')]['find']({'where':{'id':_0x4c8c5e['params']['id']}})[_0xa1c9('0x28')](function(_0x3e67f4){return db[_0xa1c9('0x4f')][_0xa1c9('0x70')](function(_0x52905a){return _0x3e67f4[_0xa1c9('0x8b')](_0x4c8c5e[_0xa1c9('0x38')][_0xa1c9('0x73')],{'transaction':_0x52905a})[_0xa1c9('0x28')](function(){if(!_[_0xa1c9('0x9e')](_0x163589)){return _0x3e67f4['removeAgents'](_0x163589,{'transaction':_0x52905a});}})[_0xa1c9('0x28')](function(){_0x163589['forEach'](function(_0x424be7){socket[_0xa1c9('0x76')]('userVoicePrefix:remove',{'UserId':_0x424be7,'VoicePrefixId':_0x3e67f4['id']});});});});});});})[_0xa1c9('0x28')](respondWithStatusCode(_0x3cb7d4,null))[_0xa1c9('0x4b')](handleError(_0x3cb7d4,null));}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.events.js b/server/api/voicePrefix/voicePrefix.events.js index 5c6b3aa..ade406f 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 _0x7169=['setMaxListeners','update','remove','emit','hasOwnProperty','hook','exports','events','../../mysqldb','VoicePrefix'];(function(_0x49abaf,_0x33b29a){var _0x3dd3b7=function(_0x3c3c42){while(--_0x3c3c42){_0x49abaf['push'](_0x49abaf['shift']());}};_0x3dd3b7(++_0x33b29a);}(_0x7169,0x75));var _0x9716=function(_0x49d41c,_0x2bdc35){_0x49d41c=_0x49d41c-0x0;var _0xb64c5f=_0x7169[_0x49d41c];return _0xb64c5f;};'use strict';var EventEmitter=require(_0x9716('0x0'));var VoicePrefix=require(_0x9716('0x1'))['db'][_0x9716('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x9716('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9716('0x4'),'afterDestroy':_0x9716('0x5')};function emitEvent(_0x3dbb38){return function(_0x47adcc,_0x451827,_0xe3d700){VoicePrefixEvents[_0x9716('0x6')](_0x3dbb38+':'+_0x47adcc['id'],_0x47adcc);VoicePrefixEvents[_0x9716('0x6')](_0x3dbb38,_0x47adcc);_0xe3d700(null);};}for(var e in events){if(events[_0x9716('0x7')](e)){var event=events[e];VoicePrefix[_0x9716('0x8')](e,emitEvent(event));}}module[_0x9716('0x9')]=VoicePrefixEvents; \ No newline at end of file +var _0x3ad4=['hook','exports','events','../../mysqldb','VoicePrefix','setMaxListeners','save','remove','emit','hasOwnProperty'];(function(_0x246de6,_0x29a141){var _0x57e5bc=function(_0xfcd511){while(--_0xfcd511){_0x246de6['push'](_0x246de6['shift']());}};_0x57e5bc(++_0x29a141);}(_0x3ad4,0x1b0));var _0x43ad=function(_0x549c39,_0x1f88de){_0x549c39=_0x549c39-0x0;var _0xb88b84=_0x3ad4[_0x549c39];return _0xb88b84;};'use strict';var EventEmitter=require(_0x43ad('0x0'));var VoicePrefix=require(_0x43ad('0x1'))['db'][_0x43ad('0x2')];var VoicePrefixEvents=new EventEmitter();VoicePrefixEvents[_0x43ad('0x3')](0x0);var events={'afterCreate':_0x43ad('0x4'),'afterUpdate':'update','afterDestroy':_0x43ad('0x5')};function emitEvent(_0x44d8da){return function(_0x5458d4,_0x3d062b,_0x5d6a16){VoicePrefixEvents[_0x43ad('0x6')](_0x44d8da+':'+_0x5458d4['id'],_0x5458d4);VoicePrefixEvents[_0x43ad('0x6')](_0x44d8da,_0x5458d4);_0x5d6a16(null);};}for(var e in events){if(events[_0x43ad('0x7')](e)){var event=events[e];VoicePrefix[_0x43ad('0x8')](e,emitEvent(event));}}module[_0x43ad('0x9')]=VoicePrefixEvents; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.model.js b/server/api/voicePrefix/voicePrefix.model.js index 5fb6429..cf26882 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 _0xd97a=['rimraf','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes','lodash','util','moment','bluebird','request-promise','path'];(function(_0x3aa05d,_0x505c45){var _0x1fa9f1=function(_0x4e1417){while(--_0x4e1417){_0x3aa05d['push'](_0x3aa05d['shift']());}};_0x1fa9f1(++_0x505c45);}(_0xd97a,0x1b6));var _0xad97=function(_0x132641,_0x153b24){_0x132641=_0x132641-0x0;var _0xc68b80=_0xd97a[_0x132641];return _0xc68b80;};'use strict';var _=require(_0xad97('0x0'));var util=require(_0xad97('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0xad97('0x2'));var BPromise=require(_0xad97('0x3'));var rp=require(_0xad97('0x4'));var fs=require('fs');var path=require(_0xad97('0x5'));var rimraf=require(_0xad97('0x6'));var config=require('../../config/environment');var attributes=require(_0xad97('0x7'));module[_0xad97('0x8')]=function(_0x5e73f5,_0x5ea33c){return _0x5e73f5[_0xad97('0x9')](_0xad97('0xa'),attributes,{'tableName':_0xad97('0xb'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x1738=['lodash','util','api','bluebird','request-promise','path','./voicePrefix.attributes','exports','define','VoicePrefix','voice_prefixes'];(function(_0x2d4421,_0x15a84f){var _0x2d3b01=function(_0xb9e94c){while(--_0xb9e94c){_0x2d4421['push'](_0x2d4421['shift']());}};_0x2d3b01(++_0x15a84f);}(_0x1738,0xc6));var _0x8173=function(_0x899e16,_0x7bb7c5){_0x899e16=_0x899e16-0x0;var _0x1a9533=_0x1738[_0x899e16];return _0x1a9533;};'use strict';var _=require(_0x8173('0x0'));var util=require(_0x8173('0x1'));var logger=require('../../config/logger')(_0x8173('0x2'));var moment=require('moment');var BPromise=require(_0x8173('0x3'));var rp=require(_0x8173('0x4'));var fs=require('fs');var path=require(_0x8173('0x5'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0x8173('0x6'));module[_0x8173('0x7')]=function(_0x2946ff,_0x427f30){return _0x2946ff[_0x8173('0x8')](_0x8173('0x9'),attributes,{'tableName':_0x8173('0xa'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.rpc.js b/server/api/voicePrefix/voicePrefix.rpc.js index 494b639..4124782 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 _0xbf13=['jayson/promise','client','http','redis','localhost','./voicePrefix.socket','register','request','then','info','request\x20sent','debug','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','VoicePrefix,\x20%s,\x20%s','message','catch','lodash','util','moment','bluebird','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0x253427,_0x4c7539){var _0x2a633c=function(_0x25c7b8){while(--_0x25c7b8){_0x253427['push'](_0x253427['shift']());}};_0x2a633c(++_0x4c7539);}(_0xbf13,0xe2));var _0x3bf1=function(_0x5229f9,_0x1da244){_0x5229f9=_0x5229f9-0x0;var _0x538ec7=_0xbf13[_0x5229f9];return _0x538ec7;};'use strict';var _=require(_0x3bf1('0x0'));var util=require(_0x3bf1('0x1'));var moment=require(_0x3bf1('0x2'));var BPromise=require(_0x3bf1('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x3bf1('0x4'))['db'];var utils=require(_0x3bf1('0x5'));var logger=require('../../config/logger')(_0x3bf1('0x6'));var config=require(_0x3bf1('0x7'));var jayson=require(_0x3bf1('0x8'));var client=jayson[_0x3bf1('0x9')][_0x3bf1('0xa')]({'port':0x232a});config['redis']=_['defaults'](config[_0x3bf1('0xb')],{'host':_0x3bf1('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x3bf1('0xb')]));require(_0x3bf1('0xd'))[_0x3bf1('0xe')](socket);function respondWithRpcPromise(_0x3bcda3,_0xdc68d1,_0xa1374a){return new BPromise(function(_0x48444a,_0x50bf27){return client[_0x3bf1('0xf')](_0x3bcda3,_0xa1374a)[_0x3bf1('0x10')](function(_0x4d8dbd){logger[_0x3bf1('0x11')]('VoicePrefix,\x20%s,\x20%s',_0xdc68d1,_0x3bf1('0x12'));logger[_0x3bf1('0x13')](_0x3bf1('0x14'),_0xdc68d1,_0x3bf1('0x12'),JSON[_0x3bf1('0x15')](_0x4d8dbd));if(_0x4d8dbd[_0x3bf1('0x16')]){if(_0x4d8dbd['error']['code']===0x1f4){logger[_0x3bf1('0x16')](_0x3bf1('0x17'),_0xdc68d1,_0x4d8dbd[_0x3bf1('0x16')][_0x3bf1('0x18')]);return _0x50bf27(_0x4d8dbd[_0x3bf1('0x16')][_0x3bf1('0x18')]);}logger[_0x3bf1('0x16')](_0x3bf1('0x17'),_0xdc68d1,_0x4d8dbd[_0x3bf1('0x16')][_0x3bf1('0x18')]);return _0x48444a(_0x4d8dbd[_0x3bf1('0x16')][_0x3bf1('0x18')]);}else{logger[_0x3bf1('0x11')](_0x3bf1('0x17'),_0xdc68d1,'request\x20sent');_0x48444a(_0x4d8dbd['result'][_0x3bf1('0x18')]);}})[_0x3bf1('0x19')](function(_0x140e51){logger['error']('VoicePrefix,\x20%s,\x20%s',_0xdc68d1,_0x140e51);_0x50bf27(_0x140e51);});});} \ No newline at end of file +var _0x8f9d=['request','then','info','request\x20sent','VoicePrefix,\x20%s,\x20%s,\x20%s','stringify','error','code','VoicePrefix,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','redis','defaults','socket.io-emitter','register'];(function(_0x1e8376,_0xe8f44f){var _0x16041=function(_0x55b643){while(--_0x55b643){_0x1e8376['push'](_0x1e8376['shift']());}};_0x16041(++_0xe8f44f);}(_0x8f9d,0x93));var _0xd8f9=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8f9d[_0x321bb2];return _0x9c12ed;};'use strict';var _=require(_0xd8f9('0x0'));var util=require('util');var moment=require(_0xd8f9('0x1'));var BPromise=require('bluebird');var rs=require(_0xd8f9('0x2'));var fs=require('fs');var Redis=require(_0xd8f9('0x3'));var db=require(_0xd8f9('0x4'))['db'];var utils=require(_0xd8f9('0x5'));var logger=require(_0xd8f9('0x6'))(_0xd8f9('0x7'));var config=require(_0xd8f9('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xd8f9('0x9')][_0xd8f9('0xa')]({'port':0x232a});config[_0xd8f9('0xb')]=_[_0xd8f9('0xc')](config[_0xd8f9('0xb')],{'host':'localhost','port':0x18eb});var socket=require(_0xd8f9('0xd'))(new Redis(config[_0xd8f9('0xb')]));require('./voicePrefix.socket')[_0xd8f9('0xe')](socket);function respondWithRpcPromise(_0x4ac0ea,_0x5caee9,_0x421aca){return new BPromise(function(_0x3d0bea,_0x32b880){return client[_0xd8f9('0xf')](_0x4ac0ea,_0x421aca)[_0xd8f9('0x10')](function(_0x3a1db8){logger[_0xd8f9('0x11')]('VoicePrefix,\x20%s,\x20%s',_0x5caee9,_0xd8f9('0x12'));logger['debug'](_0xd8f9('0x13'),_0x5caee9,_0xd8f9('0x12'),JSON[_0xd8f9('0x14')](_0x3a1db8));if(_0x3a1db8['error']){if(_0x3a1db8[_0xd8f9('0x15')][_0xd8f9('0x16')]===0x1f4){logger[_0xd8f9('0x15')](_0xd8f9('0x17'),_0x5caee9,_0x3a1db8['error'][_0xd8f9('0x18')]);return _0x32b880(_0x3a1db8[_0xd8f9('0x15')][_0xd8f9('0x18')]);}logger[_0xd8f9('0x15')](_0xd8f9('0x17'),_0x5caee9,_0x3a1db8[_0xd8f9('0x15')][_0xd8f9('0x18')]);return _0x3d0bea(_0x3a1db8['error']['message']);}else{logger[_0xd8f9('0x11')](_0xd8f9('0x17'),_0x5caee9,'request\x20sent');_0x3d0bea(_0x3a1db8[_0xd8f9('0x19')]['message']);}})[_0xd8f9('0x1a')](function(_0x49f2e7){logger['error']('VoicePrefix,\x20%s,\x20%s',_0x5caee9,_0x49f2e7);_0x32b880(_0x49f2e7);});});} \ No newline at end of file diff --git a/server/api/voicePrefix/voicePrefix.socket.js b/server/api/voicePrefix/voicePrefix.socket.js index 9b1714b..5970680 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 _0x175e=['emit','removeListener','register','length','voicePrefix:','./voicePrefix.events','save','remove','update'];(function(_0x20c8e7,_0x5e0dd6){var _0x32eba9=function(_0x486c2c){while(--_0x486c2c){_0x20c8e7['push'](_0x20c8e7['shift']());}};_0x32eba9(++_0x5e0dd6);}(_0x175e,0xe6));var _0xe175=function(_0xd6314a,_0x683bf1){_0xd6314a=_0xd6314a-0x0;var _0xc76b30=_0x175e[_0xd6314a];return _0xc76b30;};'use strict';var VoicePrefixEvents=require(_0xe175('0x0'));var events=[_0xe175('0x1'),_0xe175('0x2'),_0xe175('0x3')];function createListener(_0x449d97,_0x5bec43){return function(_0x4d2bfc){_0x5bec43[_0xe175('0x4')](_0x449d97,_0x4d2bfc);};}function removeListener(_0x3c493c,_0x3fd951){return function(){VoicePrefixEvents[_0xe175('0x5')](_0x3c493c,_0x3fd951);};}exports[_0xe175('0x6')]=function(_0x278a8d){for(var _0x7eba=0x0,_0xbe8cd=events[_0xe175('0x7')];_0x7eba<_0xbe8cd;_0x7eba++){var _0x2e1356=events[_0x7eba];var _0x345531=createListener(_0xe175('0x8')+_0x2e1356,_0x278a8d);VoicePrefixEvents['on'](_0x2e1356,_0x345531);}}; \ No newline at end of file +var _0x13f6=['./voicePrefix.events','save','removeListener','voicePrefix:'];(function(_0x508256,_0x13194c){var _0x4fd80d=function(_0x417089){while(--_0x417089){_0x508256['push'](_0x508256['shift']());}};_0x4fd80d(++_0x13194c);}(_0x13f6,0x124));var _0x613f=function(_0x4783a4,_0x5850ad){_0x4783a4=_0x4783a4-0x0;var _0x48be62=_0x13f6[_0x4783a4];return _0x48be62;};'use strict';var VoicePrefixEvents=require(_0x613f('0x0'));var events=[_0x613f('0x1'),'remove','update'];function createListener(_0xd04cfd,_0x13b50a){return function(_0x12dc5a){_0x13b50a['emit'](_0xd04cfd,_0x12dc5a);};}function removeListener(_0x179f6e,_0x1e01e3){return function(){VoicePrefixEvents[_0x613f('0x2')](_0x179f6e,_0x1e01e3);};}exports['register']=function(_0x3f3525){for(var _0x2367b3=0x0,_0x5618fa=events['length'];_0x2367b3<_0x5618fa;_0x2367b3++){var _0x5a84f2=events[_0x2367b3];var _0x5c93c0=createListener(_0x613f('0x3')+_0x5a84f2,_0x3f3525);VoicePrefixEvents['on'](_0x5a84f2,_0x5c93c0);}}; \ No newline at end of file diff --git a/server/api/voiceQueue/index.js b/server/api/voiceQueue/index.js index 9ea3778..72ac484 100644 --- a/server/api/voiceQueue/index.js +++ b/server/api/voiceQueue/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xb10b=['express','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','isAuthenticated','show','/:id/hoppers','getHoppers','/:id/hopper_histories','/:id/hopper_finals','getHopperBlacks','/:id/teams','getTeams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','/:id/blacklists','getBlackLists','post','create','/:id/clone','addTeams','addAgents','addLists','addBlackLists','put','/:id','update','delete','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','path','connect-timeout'];(function(_0x109dbd,_0x290d2b){var _0x395644=function(_0x5a8c2d){while(--_0x5a8c2d){_0x109dbd['push'](_0x109dbd['shift']());}};_0x395644(++_0x290d2b);}(_0xb10b,0x12a));var _0xbb10=function(_0x3b30be,_0x47bcd9){_0x3b30be=_0x3b30be-0x0;var _0x546361=_0xb10b[_0x3b30be];return _0x546361;};'use strict';var multer=require(_0xbb10('0x0'));var util=require('util');var path=require(_0xbb10('0x1'));var timeout=require(_0xbb10('0x2'));var express=require(_0xbb10('0x3'));var router=express['Router']();var fs_extra=require(_0xbb10('0x4'));var auth=require(_0xbb10('0x5'));var interaction=require(_0xbb10('0x6'));var config=require(_0xbb10('0x7'));var controller=require(_0xbb10('0x8'));router[_0xbb10('0x9')]('/',auth['isAuthenticated'](),controller[_0xbb10('0xa')]);router[_0xbb10('0x9')]('/:id',auth[_0xbb10('0xb')](),controller[_0xbb10('0xc')]);router[_0xbb10('0x9')](_0xbb10('0xd'),auth[_0xbb10('0xb')](),controller[_0xbb10('0xe')]);router[_0xbb10('0x9')](_0xbb10('0xf'),auth['isAuthenticated'](),controller['getHopperHistories']);router[_0xbb10('0x9')](_0xbb10('0x10'),auth[_0xbb10('0xb')](),controller['getHopperFinals']);router[_0xbb10('0x9')]('/:id/hopper_black',auth[_0xbb10('0xb')](),controller[_0xbb10('0x11')]);router[_0xbb10('0x9')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x13')]);router['get'](_0xbb10('0x14'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x15')]);router[_0xbb10('0x9')](_0xbb10('0x16'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x17')]);router[_0xbb10('0x9')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller['getLists']);router[_0xbb10('0x9')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1a')]);router[_0xbb10('0x1b')]('/',auth[_0xbb10('0xb')](),controller[_0xbb10('0x1c')]);router[_0xbb10('0x1b')](_0xbb10('0x1d'),auth[_0xbb10('0xb')](),controller['clone']);router[_0xbb10('0x1b')](_0xbb10('0x12'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x1e')]);router[_0xbb10('0x1b')](_0xbb10('0x14'),auth['isAuthenticated'](),controller[_0xbb10('0x1f')]);router[_0xbb10('0x1b')]('/:id/lists',auth['isAuthenticated'](),controller[_0xbb10('0x20')]);router[_0xbb10('0x1b')](_0xbb10('0x19'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x21')]);router[_0xbb10('0x22')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x24')]);router[_0xbb10('0x25')](_0xbb10('0x23'),auth[_0xbb10('0xb')](),controller['destroy']);router['delete']('/:id/teams',auth[_0xbb10('0xb')](),controller[_0xbb10('0x26')]);router[_0xbb10('0x25')]('/:id/users',auth[_0xbb10('0xb')](),controller[_0xbb10('0x27')]);router[_0xbb10('0x25')](_0xbb10('0x18'),auth[_0xbb10('0xb')](),controller[_0xbb10('0x28')]);router[_0xbb10('0x25')]('/:id/blacklists',auth[_0xbb10('0xb')](),controller[_0xbb10('0x29')]);module[_0xbb10('0x2a')]=router; \ No newline at end of file +var _0xa9e0=['addAgents','/:id/blacklists','addBlackLists','update','delete','destroy','removeTeams','removeAgents','removeLists','removeBlackLists','exports','multer','util','path','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueue.controller','get','index','/:id','getHoppers','/:id/hopper_histories','isAuthenticated','getHopperHistories','/:id/hopper_black','getHopperBlacks','/:id/teams','/:id/users','getAgents','/:id/members','getMembers','/:id/lists','getLists','post','create','/:id/clone','clone','addTeams'];(function(_0x184a6a,_0x4e992c){var _0x2ae8af=function(_0x2c6fa3){while(--_0x2c6fa3){_0x184a6a['push'](_0x184a6a['shift']());}};_0x2ae8af(++_0x4e992c);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf71120,_0x25b7f9){_0xf71120=_0xf71120-0x0;var _0xbe2fd3=_0xa9e0[_0xf71120];return _0xbe2fd3;};'use strict';var multer=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));var timeout=require('connect-timeout');var express=require('express');var router=express[_0x0a9e('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0a9e('0x4'));var interaction=require(_0x0a9e('0x5'));var config=require(_0x0a9e('0x6'));var controller=require(_0x0a9e('0x7'));router[_0x0a9e('0x8')]('/',auth['isAuthenticated'](),controller[_0x0a9e('0x9')]);router[_0x0a9e('0x8')](_0x0a9e('0xa'),auth['isAuthenticated'](),controller['show']);router[_0x0a9e('0x8')]('/:id/hoppers',auth['isAuthenticated'](),controller[_0x0a9e('0xb')]);router[_0x0a9e('0x8')](_0x0a9e('0xc'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0xe')]);router[_0x0a9e('0x8')]('/:id/hopper_finals',auth['isAuthenticated'](),controller['getHopperFinals']);router['get'](_0x0a9e('0xf'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x10')]);router[_0x0a9e('0x8')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller['getTeams']);router[_0x0a9e('0x8')](_0x0a9e('0x12'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x13')]);router[_0x0a9e('0x8')](_0x0a9e('0x14'),auth['isAuthenticated'](),controller[_0x0a9e('0x15')]);router['get'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x17')]);router[_0x0a9e('0x8')]('/:id/blacklists',auth[_0x0a9e('0xd')](),controller['getBlackLists']);router[_0x0a9e('0x18')]('/',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x19')]);router[_0x0a9e('0x18')](_0x0a9e('0x1a'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1b')]);router[_0x0a9e('0x18')](_0x0a9e('0x11'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1c')]);router[_0x0a9e('0x18')]('/:id/users',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1d')]);router['post'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller['addLists']);router[_0x0a9e('0x18')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x1f')]);router['put'](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x20')]);router[_0x0a9e('0x21')](_0x0a9e('0xa'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x22')]);router['delete']('/:id/teams',auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x23')]);router[_0x0a9e('0x21')](_0x0a9e('0x12'),auth['isAuthenticated'](),controller[_0x0a9e('0x24')]);router['delete'](_0x0a9e('0x16'),auth['isAuthenticated'](),controller[_0x0a9e('0x25')]);router[_0x0a9e('0x21')](_0x0a9e('0x1e'),auth[_0x0a9e('0xd')](),controller[_0x0a9e('0x26')]);module[_0x0a9e('0x27')]=router; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.attributes.js b/server/api/voiceQueue/voiceQueue.attributes.js index 5ba354e..d3ef07d 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 _0x1515=['AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Maximum\x20Number\x20Of\x20Words','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length','#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Drop\x20Retry\x20(min:1,\x20max:999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Abandoned\x20Retry\x20(min:1,\x20max:999)','#Machine\x20Retry\x20(min:1,\x20max:999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','exports','STRING','name','inbound','outbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','setDataValue','getDataValue','strategy','preview','roundrobin','includes','INTEGER','ENUM','yes','once','TEXT','periodic_announce','join','split','joinempty','leavewhenempty','BOOLEAN','acw','wrapuptime','Active/Disactive\x20Campaign','progressive','booked','Max\x209999\x20channels,\x200\x20means\x20unlimited.','UNSIGNED','Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','dropRate','Only\x20for\x20predictive\x20method.','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)'];(function(_0x28b666,_0x54bfaa){var _0x32e7c6=function(_0x4eced5){while(--_0x4eced5){_0x28b666['push'](_0x28b666['shift']());}};_0x32e7c6(++_0x54bfaa);}(_0x1515,0xbd));var _0x5151=function(_0x5d4269,_0x354dd0){_0x5d4269=_0x5d4269-0x0;var _0x4a4107=_0x1515[_0x5d4269];return _0x4a4107;};'use strict';var Sequelize=require(_0x5151('0x0'));module[_0x5151('0x1')]={'name':{'type':Sequelize[_0x5151('0x2')],'allowNull':![],'unique':_0x5151('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM'](_0x5151('0x4'),_0x5151('0x5')),'allowNull':![],'defaultValue':_0x5151('0x4')},'musiconhold':{'type':Sequelize['STRING'],'defaultValue':_0x5151('0x6')},'announce':{'type':Sequelize['STRING'],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x5151('0x7'),_0x5151('0x8'),_0x5151('0x9'),_0x5151('0xa'),_0x5151('0xb'),_0x5151('0xc'),_0x5151('0xd'),'rrordered'),'allowNull':![],'defaultValue':_0x5151('0x7'),'set':function(_0x2f256e){this[_0x5151('0xe')]('strategy',_0x2f256e?_0x2f256e:'rrmemory');},'get':function(){var _0x54fa42=this[_0x5151('0xf')]('type');var _0x3df085=this[_0x5151('0xf')]('dialMethod');var _0x3fa2b5=this[_0x5151('0xf')](_0x5151('0x10'));if(_0x54fa42===_0x5151('0x5')){if(_0x3df085===_0x5151('0x11')){return null;}if(_0x3df085==='booked'&&![_0x5151('0xb'),_0x5151('0x12')][_0x5151('0x13')](_0x3fa2b5)){this['setDataValue'](_0x5151('0x10'),_0x5151('0xb'));}}return _0x3fa2b5;}},'servicelevel':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'context':{'type':Sequelize['STRING'],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize[_0x5151('0x14')](0xb)},'timeout':{'type':Sequelize[_0x5151('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize[_0x5151('0x14')](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x5151('0x2')]},'weight':{'type':Sequelize['INTEGER'](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x5151('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x5151('0x15')](_0x5151('0x16'),'no'),'defaultValue':_0x5151('0x16')},'autopause':{'type':Sequelize[_0x5151('0x15')]('yes','no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x5151('0x14')](0xb)},'autopausebusy':{'type':Sequelize[_0x5151('0x15')]('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x5151('0x15')](_0x5151('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x5151('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x5151('0x15')](_0x5151('0x16'),'no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize[_0x5151('0x15')](_0x5151('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x5151('0x15')](_0x5151('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x5151('0x15')](_0x5151('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize[_0x5151('0x2')],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x5151('0x2')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x5151('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x5151('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x5151('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x5151('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x5151('0x15')](_0x5151('0x16'),'no'),'defaultValue':_0x5151('0x16')},'announce_holdtime':{'type':Sequelize[_0x5151('0x15')]('yes','no',_0x5151('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x5151('0x2')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize[_0x5151('0x15')](_0x5151('0x16'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x5151('0x15')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize['STRING'],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x5151('0x2')]},'queue_youarenext':{'type':Sequelize[_0x5151('0x2')],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x5151('0x2')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x5151('0x2')],'defaultValue':null},'queue_holdtime':{'type':Sequelize[_0x5151('0x2')],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x5151('0x2')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x5151('0x2')],'defaultValue':null},'queue_seconds':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x5151('0x2')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x5151('0x2')]},'queue_quantity1':{'type':Sequelize[_0x5151('0x2')]},'queue_quantity2':{'type':Sequelize[_0x5151('0x2')]},'queue_periodic_announce':{'type':Sequelize[_0x5151('0x2')]},'queue_less_than':{'type':Sequelize[_0x5151('0x2')]},'periodic_announce':{'type':Sequelize[_0x5151('0x18')],'set':function(_0x51f0bd){this[_0x5151('0xe')](_0x5151('0x19'),_0x51f0bd?_0x51f0bd[_0x5151('0x1a')](','):[]);},'get':function(){return this[_0x5151('0xf')](_0x5151('0x19'))?this[_0x5151('0xf')]('periodic_announce')[_0x5151('0x1b')](','):[];}},'joinempty':{'type':Sequelize[_0x5151('0x2')],'defaultValue':_0x5151('0x16'),'set':function(_0x1b1e2b){this[_0x5151('0xe')](_0x5151('0x1c'),_0x1b1e2b?_0x1b1e2b[_0x5151('0x1a')](','):undefined);},'get':function(){return this[_0x5151('0xf')](_0x5151('0x1c'))?this['getDataValue'](_0x5151('0x1c'))['split'](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x5151('0x2')],'defaultValue':'no','set':function(_0xad7edd){this[_0x5151('0xe')](_0x5151('0x1d'),_0xad7edd?_0xad7edd[_0x5151('0x1a')](','):undefined);},'get':function(){return this[_0x5151('0xf')](_0x5151('0x1d'))?this[_0x5151('0xf')](_0x5151('0x1d'))[_0x5151('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x5151('0x15')](_0x5151('0x16'),'no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x5151('0x15')](_0x5151('0x16'),'no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize[_0x5151('0x14')](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x5151('0x15')](_0x5151('0x16'),'no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x5151('0x2')]},'description':{'type':Sequelize[_0x5151('0x2')]},'acw':{'type':Sequelize[_0x5151('0x1e')],'defaultValue':0x0,'set':function(_0x3ce5be){this[_0x5151('0xe')](_0x5151('0x1f'),_0x3ce5be);if(_0x3ce5be){if(this[_0x5151('0xf')](_0x5151('0x20'))<0x2){this[_0x5151('0xe')]('wrapuptime',0x2);}}}},'acwTimeout':{'type':Sequelize[_0x5151('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x5151('0x1e')],'defaultValue':0x0,'comment':_0x5151('0x21')},'dialMethod':{'type':Sequelize[_0x5151('0x15')](_0x5151('0x11'),_0x5151('0x22'),'power','predictive',_0x5151('0x23')),'defaultValue':_0x5151('0x22'),'comment':'Dial\x20Method.'},'dialLimitChannel':{'type':Sequelize[_0x5151('0x14')](0x4)['UNSIGNED'],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5151('0x24')},'dialLimitQueue':{'type':Sequelize[_0x5151('0x14')](0x4)[_0x5151('0x25')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':_0x5151('0x26')},'dialPowerLevel':{'type':Sequelize[_0x5151('0x27')](0x2)[_0x5151('0x25')],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x5151('0x28')},'dialPredictiveOptimization':{'type':Sequelize[_0x5151('0x15')]('agentBusyFactor',_0x5151('0x29')),'defaultValue':'dropRate','comment':_0x5151('0x2a')},'dialPredictiveOptimizationPercentage':{'type':Sequelize['FLOAT'](0x2)[_0x5151('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x5151('0x2b')},'dialPredictiveInterval':{'type':Sequelize[_0x5151('0x14')](0x3)[_0x5151('0x25')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':_0x5151('0x2c')},'dialOriginateCallerIdName':{'type':Sequelize[_0x5151('0x2')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x5151('0x2')]},'dialOriginateTimeout':{'type':Sequelize[_0x5151('0x14')](0x3)['UNSIGNED'],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5151('0x2d')},'dialQueueOptions':{'type':Sequelize[_0x5151('0x2')],'defaultValue':_0x5151('0x2e'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x5151('0x14')](0x3)[_0x5151('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5151('0x2f')},'dialQueueProject':{'type':Sequelize[_0x5151('0x2')],'comment':_0x5151('0x30')},'dialCongestionMaxRetry':{'type':Sequelize[_0x5151('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Congestion\x20Retry\x20(min:1,\x20max:999)'},'dialCongestionRetryFrequency':{'type':Sequelize[_0x5151('0x14')](0x5)[_0x5151('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialBusyMaxRetry':{'type':Sequelize[_0x5151('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Busy\x20Retry\x20(min:1,\x20max:999)'},'dialBusyRetryFrequency':{'type':Sequelize[_0x5151('0x14')](0x5)[_0x5151('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x5151('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'comment':'#NoAnswer\x20Retry\x20(min:1,\x20max:999)'},'dialNoAnswerRetryFrequency':{'type':Sequelize[_0x5151('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5151('0x31')},'dialGlobalMaxRetry':{'type':Sequelize[_0x5151('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':'#Global\x20Max\x20Retry\x20(min:1,\x20max:999)'},'dialTimezone':{'type':Sequelize[_0x5151('0x2')],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize['STRING'],'defaultValue':_0x5151('0x32')},'dialPrefix':{'type':Sequelize[_0x5151('0x2')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x5151('0x15')](_0x5151('0x33'),_0x5151('0x34'),_0x5151('0x35')),'defaultValue':_0x5151('0x33')},'dialAMDActive':{'type':Sequelize[_0x5151('0x1e')],'defaultValue':0x0,'comment':_0x5151('0x36')},'dialAMDInitialSilence':{'type':Sequelize['INTEGER'](0x9)['UNSIGNED'],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x5151('0x37')},'dialAMDGreeting':{'type':Sequelize[_0x5151('0x14')](0x9)[_0x5151('0x25')],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x5151('0x38')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x5151('0x14')](0x9)[_0x5151('0x25')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x5151('0x39')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x5151('0x14')](0x9)['UNSIGNED'],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5151('0x3a')},'dialAMDMinWordLength':{'type':Sequelize[_0x5151('0x14')](0x9)['UNSIGNED'],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x5151('0x3b')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x5151('0x14')](0x9)[_0x5151('0x25')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x5151('0x3c')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x5151('0x14')](0x9)[_0x5151('0x25')],'defaultValue':0x3,'validate':{'min':0x0},'comment':_0x5151('0x3d')},'dialAMDSilenceThreshold':{'type':Sequelize[_0x5151('0x14')](0x5)[_0x5151('0x25')],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x5151('0x3e')},'dialAMDMaximumWordLength':{'type':Sequelize['INTEGER'](0x9)[_0x5151('0x25')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x5151('0x3f')},'dialRecallMeTimeout':{'type':Sequelize[_0x5151('0x14')](0x5)[_0x5151('0x25')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x5151('0x40')},'dialRecallInQueue':{'type':Sequelize[_0x5151('0x1e')],'defaultValue':0x0,'comment':_0x5151('0x41')},'dialOrderByScheduledAt':{'type':Sequelize[_0x5151('0x15')](_0x5151('0x42'),'ASC'),'defaultValue':_0x5151('0x42')},'dialQueueProject2':{'type':Sequelize[_0x5151('0x2')],'comment':_0x5151('0x30')},'dialAgiAfterHangupClient':{'type':Sequelize[_0x5151('0x1e')],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize[_0x5151('0x1e')],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x5151('0x14')](0x3)[_0x5151('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5151('0x43')},'dialCutDigit':{'type':Sequelize[_0x5151('0x14')](0x3)[_0x5151('0x25')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x5151('0x44')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x5151('0x14')](0x3)[_0x5151('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)'},'dialNoSuchNumberRetryFrequency':{'type':Sequelize[_0x5151('0x14')](0x5)[_0x5151('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5151('0x45')},'dialDropMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5151('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5151('0x46')},'dialDropRetryFrequency':{'type':Sequelize[_0x5151('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5151('0x47')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x5151('0x14')](0x3)[_0x5151('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5151('0x48')},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x5151('0x14')](0x5)[_0x5151('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x5151('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5151('0x49')},'dialMachineRetryFrequency':{'type':Sequelize[_0x5151('0x14')](0x5)[_0x5151('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialAgentRejectMaxRetry':{'type':Sequelize[_0x5151('0x14')](0x3)[_0x5151('0x25')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x5151('0x4a')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x5151('0x14')](0x5)[_0x5151('0x25')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x5151('0x4b')},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'allowNull':!![],'comment':'Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x5151('0x4c'),'set':function(_0x21844c){if(!_0x21844c)this[_0x5151('0xe')](_0x5151('0x4d'),null);this[_0x5151('0xe')](_0x5151('0x4e'),_0x21844c);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x5151('0x14')](0x3)[_0x5151('0x25')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize['INTEGER'](0x3)[_0x5151('0x25')],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x5151('0x1e')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x5151('0x14')](0x3)[_0x5151('0x25')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file +var _0x3423=['#RecallMe\x20Timeout\x20(min:1)','Active/Disactive\x20Recall\x20In\x20Queue','ASC','DESC','Random\x20Last\x20Digit\x20(min:1,\x20max:15)','Cut\x20Digit\x20(min:1,\x20max:15)','#NoSuchNumber\x20Retry\x20(min:1,\x20max:999)','NoSuchNumber\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Drop\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Machine\x20Retry\x20(min:1,\x20max:999)','Machine\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#AgentReject\x20Retry\x20(min:1,\x20max:999)','AgentReject\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','STRING','name','outbound','inbound','default','ringall','leastrecent','fewestcalls','random','rrmemory','linear','wrandom','rrordered','setDataValue','strategy','getDataValue','dialMethod','preview','booked','INTEGER','ENUM','yes','once','periodic_announce','joinempty','join','split','leavewhenempty','BOOLEAN','wrapuptime','Active/Disactive\x20Campaign','progressive','predictive','Dial\x20Method.','UNSIGNED','FLOAT','Power\x20Level:\x20Calls\x20for\x20agents\x20(min:1,\x20max:10).','agentBusyFactor','dropRate','Predictive\x20Optimization\x20Percentage\x20(min:\x201,\x20max:\x2095)','Originate\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','tTxX','Queue\x20Timeout\x20Seconds\x20(min:1,\x20max:999)','AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)','#Congestion\x20Retry\x20(min:1,\x20max:999)','Congestion\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Busy\x20Retry\x20(min:1,\x20max:999)','Busy\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#NoAnswer\x20Retry\x20(min:1,\x20max:999)','NoAnswer\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)','#Global\x20Max\x20Retry\x20(min:1,\x20max:999)','07:00-22:00,*,*,*','always','never','onlyIfOpen','Active/Disactive\x20AMD','#AMD\x20Initial\x20Silence','#AMD\x20Greeting','#AMD\x20After\x20Greeting\x20Silence','#AMD\x20Total\x20Analysis\x20Time','#AMD\x20Min\x20Word\x20Length','#AMD\x20Between\x20Words\x20Silence','#AMD\x20Silence\x20Threshold\x20(min:0,\x20max:32767)','#AMD\x20Maximum\x20Word\x20Length'];(function(_0xbca1b1,_0x33f0ce){var _0x4e1686=function(_0x58a80c){while(--_0x58a80c){_0xbca1b1['push'](_0xbca1b1['shift']());}};_0x4e1686(++_0x33f0ce);}(_0x3423,0xb5));var _0x3342=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x3423[_0x3dd15e];return _0x231fd0;};'use strict';var Sequelize=require(_0x3342('0x0'));module['exports']={'name':{'type':Sequelize[_0x3342('0x1')],'allowNull':![],'unique':_0x3342('0x2'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'type':{'type':Sequelize['ENUM']('inbound',_0x3342('0x3')),'allowNull':![],'defaultValue':_0x3342('0x4')},'musiconhold':{'type':Sequelize[_0x3342('0x1')],'defaultValue':_0x3342('0x5')},'announce':{'type':Sequelize[_0x3342('0x1')],'defaultValue':''},'strategy':{'type':Sequelize['ENUM']('rr',_0x3342('0x6'),_0x3342('0x7'),_0x3342('0x8'),_0x3342('0x9'),_0x3342('0xa'),_0x3342('0xb'),_0x3342('0xc'),_0x3342('0xd')),'allowNull':![],'defaultValue':_0x3342('0x6'),'set':function(_0x52c4d6){this[_0x3342('0xe')](_0x3342('0xf'),_0x52c4d6?_0x52c4d6:_0x3342('0xa'));},'get':function(){var _0x1148ae=this['getDataValue']('type');var _0x11e2c1=this[_0x3342('0x10')](_0x3342('0x11'));var _0x49148d=this[_0x3342('0x10')](_0x3342('0xf'));if(_0x1148ae===_0x3342('0x3')){if(_0x11e2c1===_0x3342('0x12')){return null;}if(_0x11e2c1===_0x3342('0x13')&&![_0x3342('0xa'),'roundrobin']['includes'](_0x49148d)){this[_0x3342('0xe')](_0x3342('0xf'),_0x3342('0xa'));}}return _0x49148d;}},'servicelevel':{'type':Sequelize[_0x3342('0x14')](0xb),'defaultValue':0x0},'context':{'type':Sequelize[_0x3342('0x1')],'defaultValue':null},'penaltymemberslimit':{'type':Sequelize['INTEGER'](0xb)},'timeout':{'type':Sequelize[_0x3342('0x14')](0xb),'defaultValue':0xf},'retry':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x2},'timeoutpriority':{'type':Sequelize[_0x3342('0x1')]},'weight':{'type':Sequelize[_0x3342('0x14')](0xb),'allowNull':!![],'defaultValue':0x0},'wrapuptime':{'type':Sequelize[_0x3342('0x14')](0xb),'defaultValue':0x0},'autofill':{'type':Sequelize[_0x3342('0x15')](_0x3342('0x16'),'no'),'defaultValue':'yes'},'autopause':{'type':Sequelize['ENUM'](_0x3342('0x16'),'no','all'),'defaultValue':'no'},'autopausedelay':{'type':Sequelize[_0x3342('0x14')](0xb)},'autopausebusy':{'type':Sequelize['ENUM']('yes','no'),'defaultValue':'no'},'autopauseunavail':{'type':Sequelize[_0x3342('0x15')](_0x3342('0x16'),'no'),'defaultValue':'no'},'maxlen':{'type':Sequelize[_0x3342('0x14')](0xb),'defaultValue':0x0},'setinterfacevar':{'type':Sequelize[_0x3342('0x15')]('yes','no'),'defaultValue':'no'},'setqueueentryvar':{'type':Sequelize['ENUM'](_0x3342('0x16'),'no'),'defautValue':'no'},'setqueuevar':{'type':Sequelize[_0x3342('0x15')](_0x3342('0x16'),'no'),'defaultValue':'no'},'eventmemberstatus':{'type':Sequelize[_0x3342('0x15')](_0x3342('0x16'),'no'),'defaultValue':'no'},'membermacro':{'type':Sequelize['STRING'],'allowNull':!![]},'membergosub':{'type':Sequelize[_0x3342('0x1')],'allowNull':!![]},'announce_frequency':{'type':Sequelize[_0x3342('0x14')](0xb),'defaultValue':0x0},'min_announce_frequency':{'type':Sequelize[_0x3342('0x14')](0xb),'defaultValue':0x0},'periodic_announce_frequency':{'type':Sequelize[_0x3342('0x14')](0xb),'defaultValue':0x0},'random_periodic_announce':{'type':Sequelize['ENUM'](_0x3342('0x16'),'no'),'defaultValue':'no'},'relative_periodic_announce':{'type':Sequelize[_0x3342('0x15')](_0x3342('0x16'),'no'),'defaultValue':_0x3342('0x16')},'announce_holdtime':{'type':Sequelize['ENUM']('yes','no',_0x3342('0x17')),'defaultValue':'no'},'announce_position':{'type':Sequelize[_0x3342('0x1')],'defaultValue':'no'},'announce_to_first_user':{'type':Sequelize['ENUM'](_0x3342('0x16'),'no')},'announce_position_limit':{'type':Sequelize['INTEGER'](0xb)},'announce_round_seconds':{'type':Sequelize[_0x3342('0x15')]('0','5','10','15','20','30'),'defaultValue':'0'},'monitor_format':{'type':Sequelize[_0x3342('0x1')],'defaultValue':''},'monitor_type':{'type':Sequelize[_0x3342('0x1')]},'queue_youarenext':{'type':Sequelize['STRING'],'defaultValue':null},'queue_thereare':{'type':Sequelize[_0x3342('0x1')],'defaultValue':null},'queue_callswaiting':{'type':Sequelize[_0x3342('0x1')],'defaultValue':null},'queue_holdtime':{'type':Sequelize['STRING'],'defaultValue':null},'queue_minute':{'type':Sequelize[_0x3342('0x1')],'allowNull':!![],'defaultValue':null},'queue_minutes':{'type':Sequelize[_0x3342('0x1')],'defaultValue':null},'queue_seconds':{'type':Sequelize[_0x3342('0x1')],'defaultValue':null},'queue_thankyou':{'type':Sequelize[_0x3342('0x1')],'defaultValue':null},'queue_reporthold':{'type':Sequelize[_0x3342('0x1')]},'queue_quantity1':{'type':Sequelize[_0x3342('0x1')]},'queue_quantity2':{'type':Sequelize[_0x3342('0x1')]},'queue_periodic_announce':{'type':Sequelize['STRING']},'queue_less_than':{'type':Sequelize['STRING']},'periodic_announce':{'type':Sequelize['TEXT'],'set':function(_0x3ed046){this[_0x3342('0xe')]('periodic_announce',_0x3ed046?_0x3ed046['join'](','):[]);},'get':function(){return this[_0x3342('0x10')](_0x3342('0x18'))?this['getDataValue'](_0x3342('0x18'))['split'](','):[];}},'joinempty':{'type':Sequelize['STRING'],'defaultValue':'yes','set':function(_0x4c0abb){this[_0x3342('0xe')](_0x3342('0x19'),_0x4c0abb?_0x4c0abb[_0x3342('0x1a')](','):undefined);},'get':function(){return this[_0x3342('0x10')]('joinempty')?this[_0x3342('0x10')](_0x3342('0x19'))[_0x3342('0x1b')](','):undefined;}},'leavewhenempty':{'type':Sequelize[_0x3342('0x1')],'defaultValue':'no','set':function(_0x22f6f3){this['setDataValue'](_0x3342('0x1c'),_0x22f6f3?_0x22f6f3[_0x3342('0x1a')](','):undefined);},'get':function(){return this[_0x3342('0x10')](_0x3342('0x1c'))?this[_0x3342('0x10')](_0x3342('0x1c'))[_0x3342('0x1b')](','):undefined;}},'reportholdtime':{'type':Sequelize[_0x3342('0x15')]('yes','no'),'defaultValue':'no'},'ringinuse':{'type':Sequelize[_0x3342('0x15')]('yes','no'),'defaultValue':'no'},'memberdelay':{'type':Sequelize['INTEGER'](0xb),'defaultValue':0x0},'timeoutrestart':{'type':Sequelize[_0x3342('0x15')]('yes','no'),'defaultValue':'no'},'defaultrule':{'type':Sequelize[_0x3342('0x1')]},'description':{'type':Sequelize['STRING']},'acw':{'type':Sequelize[_0x3342('0x1d')],'defaultValue':0x0,'set':function(_0x997b12){this[_0x3342('0xe')]('acw',_0x997b12);if(_0x997b12){if(this[_0x3342('0x10')]('wrapuptime')<0x2){this[_0x3342('0xe')](_0x3342('0x1e'),0x2);}}}},'acwTimeout':{'type':Sequelize[_0x3342('0x14')](0xb),'defaultValue':0xa},'dialActive':{'type':Sequelize[_0x3342('0x1d')],'defaultValue':0x0,'comment':_0x3342('0x1f')},'dialMethod':{'type':Sequelize[_0x3342('0x15')](_0x3342('0x12'),_0x3342('0x20'),'power',_0x3342('0x21'),_0x3342('0x13')),'defaultValue':_0x3342('0x20'),'comment':_0x3342('0x22')},'dialLimitChannel':{'type':Sequelize[_0x3342('0x14')](0x4)[_0x3342('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20channels,\x200\x20means\x20unlimited.'},'dialLimitQueue':{'type':Sequelize[_0x3342('0x14')](0x4)[_0x3342('0x23')],'defaultValue':0x0,'validate':{'min':0x0,'max':0x270f},'comment':'Max\x209999\x20member\x20in\x20queue(min:1,\x20max:9999),\x200\x20means\x20unlimited.'},'dialPowerLevel':{'type':Sequelize[_0x3342('0x24')](0x2)['UNSIGNED'],'defaultValue':0x1,'validate':{'min':0x1,'max':0xa},'comment':_0x3342('0x25')},'dialPredictiveOptimization':{'type':Sequelize[_0x3342('0x15')](_0x3342('0x26'),'dropRate'),'defaultValue':_0x3342('0x27'),'comment':'Only\x20for\x20predictive\x20method.'},'dialPredictiveOptimizationPercentage':{'type':Sequelize[_0x3342('0x24')](0x2)[_0x3342('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x5f},'comment':_0x3342('0x28')},'dialPredictiveInterval':{'type':Sequelize[_0x3342('0x14')](0x3)[_0x3342('0x23')],'defaultValue':0xa,'validate':{'min':0x5,'max':0x1e},'comment':'Interval\x20Predictive\x20Minutes\x20(min:5\x20max:30)'},'dialOriginateCallerIdName':{'type':Sequelize[_0x3342('0x1')]},'dialOriginateCallerIdNumber':{'type':Sequelize[_0x3342('0x1')]},'dialOriginateTimeout':{'type':Sequelize[_0x3342('0x14')](0x3)[_0x3342('0x23')],'defaultValue':0x1e,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3342('0x29')},'dialQueueOptions':{'type':Sequelize[_0x3342('0x1')],'defaultValue':_0x3342('0x2a'),'comment':'https://wiki.asterisk.org/wiki/display/AST/Asterisk+13+Application_Queue'},'dialQueueTimeout':{'type':Sequelize[_0x3342('0x14')](0x3)[_0x3342('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3342('0x2b')},'dialQueueProject':{'type':Sequelize[_0x3342('0x1')],'comment':_0x3342('0x2c')},'dialCongestionMaxRetry':{'type':Sequelize[_0x3342('0x14')](0x3)[_0x3342('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3342('0x2d')},'dialCongestionRetryFrequency':{'type':Sequelize[_0x3342('0x14')](0x5)[_0x3342('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3342('0x2e')},'dialBusyMaxRetry':{'type':Sequelize[_0x3342('0x14')](0x3)[_0x3342('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3342('0x2f')},'dialBusyRetryFrequency':{'type':Sequelize[_0x3342('0x14')](0x5)[_0x3342('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3342('0x30')},'dialNoAnswerMaxRetry':{'type':Sequelize[_0x3342('0x14')](0x3)[_0x3342('0x23')],'defaultValue':0x3,'comment':_0x3342('0x31')},'dialNoAnswerRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3342('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3342('0x32')},'dialGlobalMaxRetry':{'type':Sequelize[_0x3342('0x14')](0x3)['UNSIGNED'],'validate':{'min':0x1,'max':0x3e7},'defaultValue':0x4,'comment':_0x3342('0x33')},'dialTimezone':{'type':Sequelize['STRING'],'defaultValue':null},'dialGlobalInterval':{'type':Sequelize[_0x3342('0x1')],'defaultValue':_0x3342('0x34')},'dialPrefix':{'type':Sequelize[_0x3342('0x1')],'defaultValue':null},'dialCheckDuplicateType':{'type':Sequelize[_0x3342('0x15')](_0x3342('0x35'),_0x3342('0x36'),_0x3342('0x37')),'defaultValue':_0x3342('0x35')},'dialAMDActive':{'type':Sequelize[_0x3342('0x1d')],'defaultValue':0x0,'comment':_0x3342('0x38')},'dialAMDInitialSilence':{'type':Sequelize[_0x3342('0x14')](0x9)[_0x3342('0x23')],'defaultValue':0x9c4,'validate':{'min':0x0},'comment':_0x3342('0x39')},'dialAMDGreeting':{'type':Sequelize[_0x3342('0x14')](0x9)['UNSIGNED'],'defaultValue':0x5dc,'validate':{'min':0x0},'comment':_0x3342('0x3a')},'dialAMDAfterGreetingSilence':{'type':Sequelize[_0x3342('0x14')](0x9)[_0x3342('0x23')],'defaultValue':0x320,'validate':{'min':0x0},'comment':_0x3342('0x3b')},'dialAMDTotalAnalysisTime':{'type':Sequelize[_0x3342('0x14')](0x9)[_0x3342('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3342('0x3c')},'dialAMDMinWordLength':{'type':Sequelize[_0x3342('0x14')](0x9)[_0x3342('0x23')],'defaultValue':0x64,'validate':{'min':0x0},'comment':_0x3342('0x3d')},'dialAMDBetweenWordsSilence':{'type':Sequelize[_0x3342('0x14')](0x9)[_0x3342('0x23')],'defaultValue':0x32,'validate':{'min':0x0},'comment':_0x3342('0x3e')},'dialAMDMaximumNumberOfWords':{'type':Sequelize[_0x3342('0x14')](0x9)[_0x3342('0x23')],'defaultValue':0x3,'validate':{'min':0x0},'comment':'#AMD\x20Maximum\x20Number\x20Of\x20Words'},'dialAMDSilenceThreshold':{'type':Sequelize[_0x3342('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x0,'max':0x7fff},'defaultValue':0x100,'comment':_0x3342('0x3f')},'dialAMDMaximumWordLength':{'type':Sequelize[_0x3342('0x14')](0x9)[_0x3342('0x23')],'defaultValue':0x1388,'validate':{'min':0x0},'comment':_0x3342('0x40')},'dialRecallMeTimeout':{'type':Sequelize[_0x3342('0x14')](0x5)[_0x3342('0x23')],'validate':{'min':0x1},'defaultValue':0x1e,'comment':_0x3342('0x41')},'dialRecallInQueue':{'type':Sequelize[_0x3342('0x1d')],'defaultValue':0x0,'comment':_0x3342('0x42')},'dialOrderByScheduledAt':{'type':Sequelize[_0x3342('0x15')]('DESC',_0x3342('0x43')),'defaultValue':_0x3342('0x44')},'dialQueueProject2':{'type':Sequelize[_0x3342('0x1')],'comment':'AGI\x20queue\x20option\x20(use:\x20agi://127.0.0.1/square,)'},'dialAgiAfterHangupClient':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialAgiAfterHangupAgent':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'dialRandomLastDigitCallerIdNumber':{'type':Sequelize[_0x3342('0x14')](0x3)[_0x3342('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3342('0x45')},'dialCutDigit':{'type':Sequelize[_0x3342('0x14')](0x3)[_0x3342('0x23')],'validate':{'min':0x0,'max':0xf},'defaultValue':0x0,'comment':_0x3342('0x46')},'dialNoSuchNumberMaxRetry':{'type':Sequelize[_0x3342('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3342('0x47')},'dialNoSuchNumberRetryFrequency':{'type':Sequelize['INTEGER'](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3342('0x48')},'dialDropMaxRetry':{'type':Sequelize[_0x3342('0x14')](0x3)['UNSIGNED'],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Drop\x20Retry\x20(min:1,\x20max:999)'},'dialDropRetryFrequency':{'type':Sequelize[_0x3342('0x14')](0x5)[_0x3342('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3342('0x49')},'dialAbandonedMaxRetry':{'type':Sequelize[_0x3342('0x14')](0x3)[_0x3342('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':'#Abandoned\x20Retry\x20(min:1,\x20max:999)'},'dialAbandonedRetryFrequency':{'type':Sequelize[_0x3342('0x14')](0x5)[_0x3342('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':'Abandoned\x20Retry\x20Frequency\x20Minutes\x20(min:1,\x20max:99999)'},'dialMachineMaxRetry':{'type':Sequelize[_0x3342('0x14')](0x3)[_0x3342('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3342('0x4a')},'dialMachineRetryFrequency':{'type':Sequelize['INTEGER'](0x5)[_0x3342('0x23')],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3342('0x4b')},'dialAgentRejectMaxRetry':{'type':Sequelize['INTEGER'](0x3)[_0x3342('0x23')],'defaultValue':0x3,'validate':{'min':0x1,'max':0x3e7},'comment':_0x3342('0x4c')},'dialAgentRejectRetryFrequency':{'type':Sequelize[_0x3342('0x14')](0x5)['UNSIGNED'],'validate':{'min':0x1,'max':0x1869f},'defaultValue':0x96,'comment':_0x3342('0x4d')},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3342('0x14')],'allowNull':!![],'comment':_0x3342('0x4e')},'mandatoryDisposition':{'type':Sequelize[_0x3342('0x1d')],'defaultValue':![],'comment':_0x3342('0x4f'),'set':function(_0x3c4db7){if(!_0x3c4db7)this[_0x3342('0xe')](_0x3342('0x50'),null);this[_0x3342('0xe')](_0x3342('0x51'),_0x3c4db7);}},'dialPredictiveIntervalMaxThreshold':{'type':Sequelize[_0x3342('0x14')](0x3)[_0x3342('0x23')],'defaultValue':0x14,'validate':{'min':0x1,'max':0x64}},'dialPredictiveIntervalMinThreshold':{'type':Sequelize[_0x3342('0x14')](0x3)['UNSIGNED'],'defaultValue':0xa,'validate':{'min':0x1,'max':0x64}},'dialPreviewAutoRecallMe':{'type':Sequelize[_0x3342('0x1d')],'defaultValue':!![]},'callAdditionalPhoneAfterMin':{'type':Sequelize[_0x3342('0x14')](0x3)[_0x3342('0x23')],'defaultValue':0x4},'dialPreviewRecallmeReminder':{'type':Sequelize[_0x3342('0x1d')],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.controller.js b/server/api/voiceQueue/voiceQueue.controller.js index 97f9fca..cd3f595 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 _0xf69c=['name','UserProfileResource','destroy','sendStatus','error','stack','send','rawAttributes','fieldName','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','merge','map','options','VoiceQueue','include','findAll','catch','show','params','includeAll','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','UserProfileSection','userProfileId','autoAssociation','omit','createdAt','updatedAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','getHoppers','findOne','where','VoiceQueueId','CmHopper','rows','getHopperHistories','CmHopperHistory','getHopperFinals','CmHopperFinal','CmHopperBlack','getTeams','addTeams','teams','Team','User','Agents','voicePause','interface','flatMap','forEach','penalty','sequelize','transaction','upsert','each','UserVoiceQueue','findOrCreate','UserVoiceQueueRt','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','ids','select','tq.TeamId','from','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','toString','QueryTypes','SELECT','every','isEmpty','removeAgents','userVoiceQueue:remove','addAgents','spread','online','all','isArray','getAgents','getMembers','getLists','CmList','addLists','YYYY-MM-DD\x20HH:mm:ss','dialCheckDuplicateType','always','insert','into','cm_hopper','fromQuery','phone','scheduledAt','ContactId','ListId','field','CmListId','cm_contacts','deletedAt\x20IS\x20NULL','ListId\x20=\x20?','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','onlyIfOpen','phone\x20IS\x20NOT\x20NULL','push','cm_hopper_additional_phones','CmHopperId','h.id','ci.item','ci.OrderBy+1','cm_contact_has_items','join','h.ContactId=ci.CmContactId','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','removeBlackLists','eml-format','zip-dir','fast-json-patch','moment','mustache','path','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','status','end','json','offset','undefined','limit','count','set','Content-Range','apply','reject','save','update','then','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','value','includes','type','find'];(function(_0x57fd69,_0x19f758){var _0x6f744c=function(_0x1681ba){while(--_0x1681ba){_0x57fd69['push'](_0x57fd69['shift']());}};_0x6f744c(++_0x19f758);}(_0xf69c,0x151));var _0xcf69=function(_0x3212cc,_0x3bfe46){_0x3212cc=_0x3212cc-0x0;var _0x3ecd2c=_0xf69c[_0x3212cc];return _0x3ecd2c;};'use strict';var emlformat=require(_0xcf69('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xcf69('0x1'));var jsonpatch=require(_0xcf69('0x2'));var rp=require('request-promise');var moment=require(_0xcf69('0x3'));var BPromise=require('bluebird');var Mustache=require(_0xcf69('0x4'));var util=require('util');var path=require(_0xcf69('0x5'));var sox=require('sox');var csv=require(_0xcf69('0x6'));var ejs=require(_0xcf69('0x7'));var fs=require('fs');var fs_extra=require(_0xcf69('0x8'));var _=require(_0xcf69('0x9'));var squel=require(_0xcf69('0xa'));var crypto=require('crypto');var jsforce=require(_0xcf69('0xb'));var deskjs=require(_0xcf69('0xc'));var toCsv=require(_0xcf69('0x6'));var querystring=require(_0xcf69('0xd'));var Papa=require('papaparse');var Redis=require(_0xcf69('0xe'));var authService=require(_0xcf69('0xf'));var qs=require(_0xcf69('0x10'));var as=require(_0xcf69('0x11'));var hardwareService=require(_0xcf69('0x12'));var logger=require(_0xcf69('0x13'))('api');var utils=require(_0xcf69('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0xcf69('0x15'));var db=require(_0xcf69('0x16'))['db'];config[_0xcf69('0x17')]=_[_0xcf69('0x18')](config[_0xcf69('0x17')],{'host':_0xcf69('0x19'),'port':0x18eb});var socket=require(_0xcf69('0x1a'))(new Redis(config[_0xcf69('0x17')]));require('./voiceQueue.socket')['register'](socket);function respondWithStatusCode(_0x5c66b6,_0x525102){_0x525102=_0x525102||0xcc;return function(_0x41ff4a){if(_0x41ff4a){return _0x5c66b6['sendStatus'](_0x525102);}return _0x5c66b6[_0xcf69('0x1b')](_0x525102)[_0xcf69('0x1c')]();};}function respondWithResult(_0x2309f,_0x2ca371){_0x2ca371=_0x2ca371||0xc8;return function(_0x5691ec){if(_0x5691ec){return _0x2309f[_0xcf69('0x1b')](_0x2ca371)[_0xcf69('0x1d')](_0x5691ec);}};}function respondWithFilteredResult(_0x4e4055,_0x486e06){return function(_0x438700){if(_0x438700){var _0x3198a6=typeof _0x486e06[_0xcf69('0x1e')]===_0xcf69('0x1f')&&typeof _0x486e06[_0xcf69('0x20')]===_0xcf69('0x1f');var _0x120980=_0x438700[_0xcf69('0x21')];var _0x53666e=_0x3198a6?0x0:_0x486e06[_0xcf69('0x1e')];var _0x5c35e3=_0x3198a6?_0x438700[_0xcf69('0x21')]:_0x486e06[_0xcf69('0x1e')]+_0x486e06[_0xcf69('0x20')];var _0x3d02c6;if(_0x5c35e3>=_0x120980){_0x5c35e3=_0x120980;_0x3d02c6=0xc8;}else{_0x3d02c6=0xce;}_0x4e4055[_0xcf69('0x1b')](_0x3d02c6);return _0x4e4055[_0xcf69('0x22')](_0xcf69('0x23'),_0x53666e+'-'+_0x5c35e3+'/'+_0x120980)[_0xcf69('0x1d')](_0x438700);}return null;};}function patchUpdates(_0x3a159f){return function(_0x1061d4){try{jsonpatch[_0xcf69('0x24')](_0x1061d4,_0x3a159f,!![]);}catch(_0x7d86bc){return BPromise[_0xcf69('0x25')](_0x7d86bc);}return _0x1061d4[_0xcf69('0x26')]();};}function saveUpdates(_0x3ec2fb,_0x5d16ef){return function(_0x2b4c1b){if(_0x2b4c1b){return _0x2b4c1b[_0xcf69('0x27')](_0x3ec2fb)[_0xcf69('0x28')](function(_0x278ce3){return _0x278ce3;});}return null;};}function removeEntity(_0x9a006b,_0x1a0b33){return function(_0x5643b3){if(_0x5643b3){return _0x5643b3['destroy']()[_0xcf69('0x28')](function(){var _0x59de98=_0x5643b3[_0xcf69('0x29')]({'plain':!![]});var _0x81a49f=[{'name':_0xcf69('0x2a'),'value':_0xcf69('0x2b'),'ignore':![]},{'name':_0xcf69('0x2c'),'value':_0xcf69('0x2d'),'ignore':![]}];var _0x17d1e5=_(_0x81a49f)[_0xcf69('0x2e')]('ignore')['map'](_0xcf69('0x2f'))[_0xcf69('0x2f')]();if(_[_0xcf69('0x30')](_0x17d1e5,_0x59de98[_0xcf69('0x31')])){return;}var _0x539f6e=_[_0xcf69('0x32')](_0x81a49f,[_0xcf69('0x2f'),_0x59de98[_0xcf69('0x31')]])[_0xcf69('0x33')];return db[_0xcf69('0x34')][_0xcf69('0x35')]({'where':{'type':_0x539f6e,'resourceId':_0x59de98['id']}})[_0xcf69('0x28')](function(){return _0x5643b3;});})[_0xcf69('0x28')](function(){_0x9a006b[_0xcf69('0x1b')](0xcc)[_0xcf69('0x1c')]();});}};}function handleEntityNotFound(_0x4a5db6,_0x38753b){return function(_0x490c22){if(!_0x490c22){_0x4a5db6[_0xcf69('0x36')](0x194);}return _0x490c22;};}function handleError(_0x37d3e4,_0x3877c3){_0x3877c3=_0x3877c3||0x1f4;return function(_0x191699){logger[_0xcf69('0x37')](_0x191699[_0xcf69('0x38')]);if(_0x191699[_0xcf69('0x33')]){delete _0x191699[_0xcf69('0x33')];}_0x37d3e4[_0xcf69('0x1b')](_0x3877c3)[_0xcf69('0x39')](_0x191699);};}exports['index']=function(_0x2753fe,_0x10da39){var _0x58739d={},_0x171bd5={},_0x4962df={'count':0x0,'rows':[]};var _0x4018ac=_['map'](db['VoiceQueue'][_0xcf69('0x3a')],function(_0x33ec6c){return{'name':_0x33ec6c[_0xcf69('0x3b')],'type':_0x33ec6c[_0xcf69('0x31')][_0xcf69('0x3c')]};});_0x171bd5[_0xcf69('0x3d')]=_['map'](_0x4018ac,'name');_0x171bd5[_0xcf69('0x3e')]=_[_0xcf69('0x3f')](_0x2753fe[_0xcf69('0x3e')]);_0x171bd5[_0xcf69('0x40')]=_[_0xcf69('0x41')](_0x171bd5[_0xcf69('0x3d')],_0x171bd5[_0xcf69('0x3e')]);_0x58739d[_0xcf69('0x42')]=_[_0xcf69('0x41')](_0x171bd5[_0xcf69('0x3d')],qs[_0xcf69('0x43')](_0x2753fe[_0xcf69('0x3e')][_0xcf69('0x43')]));_0x58739d[_0xcf69('0x42')]=_0x58739d[_0xcf69('0x42')][_0xcf69('0x44')]?_0x58739d[_0xcf69('0x42')]:_0x171bd5[_0xcf69('0x3d')];if(!_0x2753fe[_0xcf69('0x3e')][_0xcf69('0x45')](_0xcf69('0x46'))){_0x58739d['limit']=qs['limit'](_0x2753fe[_0xcf69('0x3e')][_0xcf69('0x20')]);_0x58739d[_0xcf69('0x1e')]=qs[_0xcf69('0x1e')](_0x2753fe['query'][_0xcf69('0x1e')]);}_0x58739d[_0xcf69('0x47')]=qs[_0xcf69('0x48')](_0x2753fe[_0xcf69('0x3e')][_0xcf69('0x48')]);_0x58739d['where']=qs[_0xcf69('0x40')](_[_0xcf69('0x49')](_0x2753fe['query'],_0x171bd5[_0xcf69('0x40')]),_0x4018ac);if(_0x2753fe[_0xcf69('0x3e')][_0xcf69('0x2e')]){_0x58739d['where']=_[_0xcf69('0x4a')](_0x58739d['where'],{'$or':_[_0xcf69('0x4b')](_0x4018ac,function(_0x3b32bd){if(_0x3b32bd['type']!=='VIRTUAL'){var _0x8b01af={};_0x8b01af[_0x3b32bd[_0xcf69('0x33')]]={'$like':'%'+_0x2753fe[_0xcf69('0x3e')]['filter']+'%'};return _0x8b01af;}})});}_0x58739d=_['merge']({},_0x58739d,_0x2753fe[_0xcf69('0x4c')]);var _0x106284={'where':_0x58739d['where']};return db[_0xcf69('0x4d')][_0xcf69('0x21')](_0x106284)[_0xcf69('0x28')](function(_0x24128f){_0x4962df[_0xcf69('0x21')]=_0x24128f;if(_0x2753fe[_0xcf69('0x3e')]['includeAll']){_0x58739d[_0xcf69('0x4e')]=[{'all':!![]}];}return db[_0xcf69('0x4d')][_0xcf69('0x4f')](_0x58739d);})['then'](function(_0x1a1270){_0x4962df['rows']=_0x1a1270;return _0x4962df;})[_0xcf69('0x28')](respondWithFilteredResult(_0x10da39,_0x58739d))[_0xcf69('0x50')](handleError(_0x10da39,null));};exports[_0xcf69('0x51')]=function(_0x45c458,_0x3cc66c){var _0x57a296={'raw':![],'where':{'id':_0x45c458[_0xcf69('0x52')]['id']}},_0x57748d={};_0x57748d[_0xcf69('0x3d')]=_[_0xcf69('0x3f')](db['VoiceQueue']['rawAttributes']);_0x57748d['query']=_[_0xcf69('0x3f')](_0x45c458[_0xcf69('0x3e')]);_0x57748d[_0xcf69('0x40')]=_['intersection'](_0x57748d[_0xcf69('0x3d')],_0x57748d['query']);_0x57a296[_0xcf69('0x42')]=_['intersection'](_0x57748d[_0xcf69('0x3d')],qs[_0xcf69('0x43')](_0x45c458[_0xcf69('0x3e')][_0xcf69('0x43')]));_0x57a296[_0xcf69('0x42')]=_0x57a296[_0xcf69('0x42')][_0xcf69('0x44')]?_0x57a296[_0xcf69('0x42')]:_0x57748d[_0xcf69('0x3d')];if(_0x45c458[_0xcf69('0x3e')][_0xcf69('0x53')]){_0x57a296['include']=[{'all':!![]}];}_0x57a296=_[_0xcf69('0x4a')]({},_0x57a296,_0x45c458[_0xcf69('0x4c')]);return db[_0xcf69('0x4d')]['find'](_0x57a296)[_0xcf69('0x28')](handleEntityNotFound(_0x3cc66c,null))['then'](respondWithResult(_0x3cc66c,null))[_0xcf69('0x50')](handleError(_0x3cc66c,null));};exports[_0xcf69('0x54')]=function(_0x1c2491,_0x398b2e){return db[_0xcf69('0x4d')][_0xcf69('0x54')](_0x1c2491[_0xcf69('0x55')],{})[_0xcf69('0x28')](function(_0x196975){var _0x13740f=_0x1c2491[_0xcf69('0x56')][_0xcf69('0x29')]({'plain':!![]});if(!_0x13740f)throw new Error(_0xcf69('0x57'));if(_0x13740f['role']===_0xcf69('0x56')){var _0x2d5fb3=_0x196975[_0xcf69('0x29')]({'plain':!![]});var _0x4907b1=[{'name':'VoiceQueues','value':_0xcf69('0x2b')},{'name':'QueueCampaigns','value':_0xcf69('0x2d')}];var _0x212903=_['find'](_0x4907b1,[_0xcf69('0x2f'),_0x2d5fb3['type']])['name'];return db[_0xcf69('0x58')][_0xcf69('0x32')]({'where':{'name':_0x212903,'userProfileId':_0x13740f[_0xcf69('0x59')]},'raw':!![]})[_0xcf69('0x28')](function(_0x59294e){if(_0x59294e&&_0x59294e[_0xcf69('0x5a')]===0x0){return db[_0xcf69('0x34')][_0xcf69('0x54')]({'name':_0x2d5fb3['name'],'resourceId':_0x2d5fb3['id'],'type':_0x59294e['name'],'sectionId':_0x59294e['id']},{})[_0xcf69('0x28')](function(){return _0x196975;});}else{return _0x196975;}})[_0xcf69('0x50')](function(_0x1bb016){logger['error']('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0x1bb016);throw _0x1bb016;});}return _0x196975;})['then'](respondWithResult(_0x398b2e,0xc9))['catch'](handleError(_0x398b2e,null));};exports['clone']=function(_0x4bfd20,_0x1ace3c){var _0x3111db={'where':{'id':_0x4bfd20[_0xcf69('0x52')]['id']}},_0x4dcc73={};_0x4dcc73[_0xcf69('0x3d')]=_[_0xcf69('0x3f')](db[_0xcf69('0x4d')][_0xcf69('0x3a')]);_0x3111db[_0xcf69('0x42')]=_['intersection'](_0x4dcc73['model'],qs[_0xcf69('0x43')](_0x4bfd20[_0xcf69('0x3e')][_0xcf69('0x43')]));_0x3111db[_0xcf69('0x42')]=_0x3111db['attributes']['length']?_0x3111db['attributes']:_0x4dcc73['model'];if(_0x4bfd20[_0xcf69('0x3e')][_0xcf69('0x53')]){_0x3111db[_0xcf69('0x4e')]=[{'all':!![]}];}_0x3111db=_[_0xcf69('0x4a')]({},_0x3111db,_0x4bfd20[_0xcf69('0x4c')]);return db[_0xcf69('0x4d')]['find'](_0x3111db)[_0xcf69('0x28')](handleEntityNotFound(_0x1ace3c,null))[_0xcf69('0x28')](function(_0x111089){if(_0x111089){var _0x9ff2ea=_0x111089[_0xcf69('0x29')]({'plain':!![]});_0x9ff2ea=qs[_0xcf69('0x5b')](_0x9ff2ea,['id',_0xcf69('0x5c'),_0xcf69('0x5d')]);_0x4bfd20[_0xcf69('0x55')]=_[_0xcf69('0x5b')](_0x4bfd20[_0xcf69('0x55')],['id','createdAt',_0xcf69('0x5d')]);return db[_0xcf69('0x4d')][_0xcf69('0x54')](_['merge'](_0x9ff2ea,_0x4bfd20[_0xcf69('0x55')]),{'include':_0x4bfd20['query'][_0xcf69('0x53')]?[{'all':!![]}]:undefined})['then'](function(_0x4b3250){var _0x3bff41=_0x4bfd20[_0xcf69('0x56')][_0xcf69('0x29')]({'plain':!![]});if(!_0x3bff41)throw new Error(_0xcf69('0x57'));if(_0x3bff41[_0xcf69('0x5e')]==='user'){var _0x5d098a=_0x4b3250[_0xcf69('0x29')]({'plain':!![]});var _0x2e4014=[{'name':'VoiceQueues','value':'inbound'},{'name':'QueueCampaigns','value':_0xcf69('0x2d')}];var _0x27d946=_['find'](_0x2e4014,[_0xcf69('0x2f'),_0x5d098a['type']])[_0xcf69('0x33')];return db[_0xcf69('0x58')][_0xcf69('0x32')]({'where':{'name':_0x27d946,'userProfileId':_0x3bff41[_0xcf69('0x59')]},'raw':!![]})[_0xcf69('0x28')](function(_0x4c97ec){if(_0x4c97ec&&_0x4c97ec['autoAssociation']===0x0){return db[_0xcf69('0x34')]['create']({'name':_0x5d098a[_0xcf69('0x33')],'resourceId':_0x5d098a['id'],'type':_0x4c97ec['name'],'sectionId':_0x4c97ec['id']},{})['then'](function(){return _0x4b3250;});}else{return _0x4b3250;}})['catch'](function(_0x2abdbc){logger[_0xcf69('0x37')](_0xcf69('0x5f'),_0x2abdbc);throw _0x2abdbc;});}return _0x4b3250;});}})[_0xcf69('0x28')](respondWithResult(_0x1ace3c,0xc9))[_0xcf69('0x50')](handleError(_0x1ace3c,null));};exports[_0xcf69('0x27')]=function(_0x5658f4,_0x243fda){if(_0x5658f4['body']['id']){delete _0x5658f4[_0xcf69('0x55')]['id'];}return db[_0xcf69('0x4d')]['find']({'where':{'id':_0x5658f4[_0xcf69('0x52')]['id']}})[_0xcf69('0x28')](handleEntityNotFound(_0x243fda,null))[_0xcf69('0x28')](saveUpdates(_0x5658f4['body'],null))['then'](respondWithResult(_0x243fda,null))[_0xcf69('0x50')](handleError(_0x243fda,null));};exports[_0xcf69('0x35')]=function(_0x5b79f4,_0x21710b){return db[_0xcf69('0x4d')][_0xcf69('0x32')]({'where':{'id':_0x5b79f4['params']['id']}})['then'](handleEntityNotFound(_0x21710b,null))[_0xcf69('0x28')](removeEntity(_0x21710b,null))['catch'](handleError(_0x21710b,null));};exports[_0xcf69('0x60')]=function(_0x3269a5,_0x57eccf,_0x8bdaa5){var _0x2925c9={'raw':![],'where':{}};var _0x5b68b8={};var _0x222cdc={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xcf69('0x61')]({'where':{'id':_0x3269a5[_0xcf69('0x52')]['id']}})[_0xcf69('0x28')](handleEntityNotFound(_0x57eccf,null))[_0xcf69('0x28')](function(_0x340265){if(_0x340265){_0x5b68b8[_0xcf69('0x3d')]=_[_0xcf69('0x3f')](db['CmHopper'][_0xcf69('0x3a')]);_0x5b68b8[_0xcf69('0x3e')]=_[_0xcf69('0x3f')](_0x3269a5[_0xcf69('0x3e')]);_0x5b68b8['filters']=_['intersection'](_0x5b68b8[_0xcf69('0x3d')],_0x5b68b8[_0xcf69('0x3e')]);_0x2925c9[_0xcf69('0x42')]=_[_0xcf69('0x41')](_0x5b68b8[_0xcf69('0x3d')],qs[_0xcf69('0x43')](_0x3269a5['query'][_0xcf69('0x43')]));_0x2925c9[_0xcf69('0x42')]=_0x2925c9[_0xcf69('0x42')][_0xcf69('0x44')]?_0x2925c9[_0xcf69('0x42')]:_0x5b68b8['model'];if(!_0x3269a5[_0xcf69('0x3e')]['hasOwnProperty']('nolimit')){_0x2925c9[_0xcf69('0x20')]=qs[_0xcf69('0x20')](_0x3269a5['query']['limit']);_0x2925c9['offset']=qs[_0xcf69('0x1e')](_0x3269a5[_0xcf69('0x3e')][_0xcf69('0x1e')]);}_0x2925c9[_0xcf69('0x47')]=qs[_0xcf69('0x48')](_0x3269a5[_0xcf69('0x3e')]['sort']);_0x2925c9[_0xcf69('0x62')]=qs[_0xcf69('0x40')](_['pick'](_0x3269a5[_0xcf69('0x3e')],_0x5b68b8[_0xcf69('0x40')]));_0x2925c9[_0xcf69('0x62')][_0xcf69('0x63')]=_0x340265['id'];if(_0x3269a5[_0xcf69('0x3e')][_0xcf69('0x2e')]){_0x2925c9['where']=_[_0xcf69('0x4a')](_0x2925c9[_0xcf69('0x62')],{'$or':_[_0xcf69('0x4b')](_0x2925c9[_0xcf69('0x42')],function(_0x4ff433){var _0x208f96={};_0x208f96[_0x4ff433]={'$like':'%'+_0x3269a5[_0xcf69('0x3e')][_0xcf69('0x2e')]+'%'};return _0x208f96;})});}_0x2925c9=_[_0xcf69('0x4a')]({},_0x2925c9,_0x3269a5['options']);return db[_0xcf69('0x64')]['count']({'where':_0x2925c9[_0xcf69('0x62')]})[_0xcf69('0x28')](function(_0x4a3364){_0x222cdc['count']=_0x4a3364;if(_0x3269a5['query'][_0xcf69('0x53')]){_0x2925c9[_0xcf69('0x4e')]=[{'all':!![]}];}return db['CmHopper'][_0xcf69('0x4f')](_0x2925c9);})[_0xcf69('0x28')](function(_0x145bde){_0x222cdc[_0xcf69('0x65')]=_0x145bde;return _0x222cdc;});}})[_0xcf69('0x28')](respondWithFilteredResult(_0x57eccf,_0x2925c9))[_0xcf69('0x50')](handleError(_0x57eccf,null));};exports[_0xcf69('0x66')]=function(_0x2a17f6,_0x3f67d7,_0x4a7f65){var _0x455dd0={'raw':!![],'where':{}};var _0x2ca0d3={};var _0x7d4ae3={'count':0x0,'rows':[]};return db['VoiceQueue']['findOne']({'where':{'id':_0x2a17f6['params']['id']}})[_0xcf69('0x28')](handleEntityNotFound(_0x3f67d7,null))['then'](function(_0x5eabdb){if(_0x5eabdb){_0x2ca0d3[_0xcf69('0x3d')]=_[_0xcf69('0x3f')](db[_0xcf69('0x67')][_0xcf69('0x3a')]);_0x2ca0d3[_0xcf69('0x3e')]=_[_0xcf69('0x3f')](_0x2a17f6[_0xcf69('0x3e')]);_0x2ca0d3['filters']=_[_0xcf69('0x41')](_0x2ca0d3[_0xcf69('0x3d')],_0x2ca0d3[_0xcf69('0x3e')]);_0x455dd0[_0xcf69('0x42')]=_['intersection'](_0x2ca0d3[_0xcf69('0x3d')],qs[_0xcf69('0x43')](_0x2a17f6[_0xcf69('0x3e')][_0xcf69('0x43')]));_0x455dd0[_0xcf69('0x42')]=_0x455dd0['attributes']['length']?_0x455dd0[_0xcf69('0x42')]:_0x2ca0d3[_0xcf69('0x3d')];if(!_0x2a17f6['query'][_0xcf69('0x45')](_0xcf69('0x46'))){_0x455dd0['limit']=qs[_0xcf69('0x20')](_0x2a17f6['query'][_0xcf69('0x20')]);_0x455dd0[_0xcf69('0x1e')]=qs[_0xcf69('0x1e')](_0x2a17f6[_0xcf69('0x3e')][_0xcf69('0x1e')]);}_0x455dd0[_0xcf69('0x47')]=qs[_0xcf69('0x48')](_0x2a17f6[_0xcf69('0x3e')][_0xcf69('0x48')]);_0x455dd0[_0xcf69('0x62')]=qs[_0xcf69('0x40')](_['pick'](_0x2a17f6[_0xcf69('0x3e')],_0x2ca0d3[_0xcf69('0x40')]));_0x455dd0['where']['VoiceQueueId']=_0x5eabdb['id'];if(_0x2a17f6[_0xcf69('0x3e')][_0xcf69('0x2e')]){_0x455dd0[_0xcf69('0x62')]=_['merge'](_0x455dd0['where'],{'$or':_[_0xcf69('0x4b')](_0x455dd0[_0xcf69('0x42')],function(_0x8a4d91){var _0x47d3cb={};_0x47d3cb[_0x8a4d91]={'$like':'%'+_0x2a17f6[_0xcf69('0x3e')][_0xcf69('0x2e')]+'%'};return _0x47d3cb;})});}_0x455dd0=_[_0xcf69('0x4a')]({},_0x455dd0,_0x2a17f6['options']);return db[_0xcf69('0x67')][_0xcf69('0x21')]({'where':_0x455dd0[_0xcf69('0x62')]})[_0xcf69('0x28')](function(_0x1ce89d){_0x7d4ae3[_0xcf69('0x21')]=_0x1ce89d;if(_0x2a17f6[_0xcf69('0x3e')][_0xcf69('0x53')]){_0x455dd0[_0xcf69('0x4e')]=[{'all':!![]}];}return db[_0xcf69('0x67')]['findAll'](_0x455dd0);})[_0xcf69('0x28')](function(_0x17ef57){_0x7d4ae3[_0xcf69('0x65')]=_0x17ef57;return _0x7d4ae3;});}})[_0xcf69('0x28')](respondWithFilteredResult(_0x3f67d7,_0x455dd0))[_0xcf69('0x50')](handleError(_0x3f67d7,null));};exports[_0xcf69('0x68')]=function(_0x59afec,_0x1d7528,_0x333438){var _0x2a6fd9={'raw':!![],'where':{}};var _0x1c4364={};var _0x220220={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xcf69('0x61')]({'where':{'id':_0x59afec['params']['id']}})['then'](handleEntityNotFound(_0x1d7528,null))[_0xcf69('0x28')](function(_0x405576){if(_0x405576){_0x1c4364[_0xcf69('0x3d')]=_[_0xcf69('0x3f')](db[_0xcf69('0x69')][_0xcf69('0x3a')]);_0x1c4364['query']=_[_0xcf69('0x3f')](_0x59afec[_0xcf69('0x3e')]);_0x1c4364[_0xcf69('0x40')]=_['intersection'](_0x1c4364[_0xcf69('0x3d')],_0x1c4364[_0xcf69('0x3e')]);_0x2a6fd9[_0xcf69('0x42')]=_[_0xcf69('0x41')](_0x1c4364[_0xcf69('0x3d')],qs[_0xcf69('0x43')](_0x59afec[_0xcf69('0x3e')]['fields']));_0x2a6fd9[_0xcf69('0x42')]=_0x2a6fd9[_0xcf69('0x42')][_0xcf69('0x44')]?_0x2a6fd9['attributes']:_0x1c4364[_0xcf69('0x3d')];if(!_0x59afec[_0xcf69('0x3e')]['hasOwnProperty']('nolimit')){_0x2a6fd9[_0xcf69('0x20')]=qs[_0xcf69('0x20')](_0x59afec[_0xcf69('0x3e')][_0xcf69('0x20')]);_0x2a6fd9[_0xcf69('0x1e')]=qs[_0xcf69('0x1e')](_0x59afec[_0xcf69('0x3e')][_0xcf69('0x1e')]);}_0x2a6fd9[_0xcf69('0x47')]=qs[_0xcf69('0x48')](_0x59afec[_0xcf69('0x3e')][_0xcf69('0x48')]);_0x2a6fd9['where']=qs[_0xcf69('0x40')](_[_0xcf69('0x49')](_0x59afec[_0xcf69('0x3e')],_0x1c4364[_0xcf69('0x40')]));_0x2a6fd9[_0xcf69('0x62')]['VoiceQueueId']=_0x405576['id'];if(_0x59afec[_0xcf69('0x3e')][_0xcf69('0x2e')]){_0x2a6fd9[_0xcf69('0x62')]=_[_0xcf69('0x4a')](_0x2a6fd9[_0xcf69('0x62')],{'$or':_['map'](_0x2a6fd9[_0xcf69('0x42')],function(_0x30481a){var _0x229a9e={};_0x229a9e[_0x30481a]={'$like':'%'+_0x59afec[_0xcf69('0x3e')][_0xcf69('0x2e')]+'%'};return _0x229a9e;})});}_0x2a6fd9=_['merge']({},_0x2a6fd9,_0x59afec['options']);return db['CmHopperFinal'][_0xcf69('0x21')]({'where':_0x2a6fd9[_0xcf69('0x62')]})[_0xcf69('0x28')](function(_0x46d90a){_0x220220[_0xcf69('0x21')]=_0x46d90a;if(_0x59afec['query'][_0xcf69('0x53')]){_0x2a6fd9[_0xcf69('0x4e')]=[{'all':!![]}];}return db['CmHopperFinal']['findAll'](_0x2a6fd9);})[_0xcf69('0x28')](function(_0x2ca5e9){_0x220220[_0xcf69('0x65')]=_0x2ca5e9;return _0x220220;});}})[_0xcf69('0x28')](respondWithFilteredResult(_0x1d7528,_0x2a6fd9))['catch'](handleError(_0x1d7528,null));};exports['getHopperBlacks']=function(_0x275e4c,_0xaeed4b,_0x2bd6fd){var _0xf36300={'raw':!![],'where':{}};var _0x33548e={};var _0x4f2100={'count':0x0,'rows':[]};return db[_0xcf69('0x4d')][_0xcf69('0x61')]({'where':{'id':_0x275e4c[_0xcf69('0x52')]['id']}})[_0xcf69('0x28')](handleEntityNotFound(_0xaeed4b,null))[_0xcf69('0x28')](function(_0x5144af){if(_0x5144af){_0x33548e[_0xcf69('0x3d')]=_[_0xcf69('0x3f')](db[_0xcf69('0x6a')][_0xcf69('0x3a')]);_0x33548e[_0xcf69('0x3e')]=_['keys'](_0x275e4c[_0xcf69('0x3e')]);_0x33548e[_0xcf69('0x40')]=_['intersection'](_0x33548e[_0xcf69('0x3d')],_0x33548e[_0xcf69('0x3e')]);_0xf36300['attributes']=_[_0xcf69('0x41')](_0x33548e[_0xcf69('0x3d')],qs[_0xcf69('0x43')](_0x275e4c[_0xcf69('0x3e')]['fields']));_0xf36300[_0xcf69('0x42')]=_0xf36300[_0xcf69('0x42')][_0xcf69('0x44')]?_0xf36300[_0xcf69('0x42')]:_0x33548e['model'];if(!_0x275e4c[_0xcf69('0x3e')][_0xcf69('0x45')]('nolimit')){_0xf36300[_0xcf69('0x20')]=qs[_0xcf69('0x20')](_0x275e4c[_0xcf69('0x3e')]['limit']);_0xf36300[_0xcf69('0x1e')]=qs[_0xcf69('0x1e')](_0x275e4c[_0xcf69('0x3e')][_0xcf69('0x1e')]);}_0xf36300[_0xcf69('0x47')]=qs['sort'](_0x275e4c[_0xcf69('0x3e')]['sort']);_0xf36300[_0xcf69('0x62')]=qs[_0xcf69('0x40')](_[_0xcf69('0x49')](_0x275e4c[_0xcf69('0x3e')],_0x33548e['filters']));_0xf36300[_0xcf69('0x62')][_0xcf69('0x63')]=_0x5144af['id'];if(_0x275e4c[_0xcf69('0x3e')][_0xcf69('0x2e')]){_0xf36300[_0xcf69('0x62')]=_['merge'](_0xf36300['where'],{'$or':_[_0xcf69('0x4b')](_0xf36300[_0xcf69('0x42')],function(_0x3079fc){var _0x1e53aa={};_0x1e53aa[_0x3079fc]={'$like':'%'+_0x275e4c[_0xcf69('0x3e')][_0xcf69('0x2e')]+'%'};return _0x1e53aa;})});}_0xf36300=_[_0xcf69('0x4a')]({},_0xf36300,_0x275e4c[_0xcf69('0x4c')]);return db['CmHopperBlack']['count']({'where':_0xf36300[_0xcf69('0x62')]})['then'](function(_0x341ad3){_0x4f2100[_0xcf69('0x21')]=_0x341ad3;if(_0x275e4c['query'][_0xcf69('0x53')]){_0xf36300[_0xcf69('0x4e')]=[{'all':!![]}];}return db[_0xcf69('0x6a')][_0xcf69('0x4f')](_0xf36300);})['then'](function(_0x3684ef){_0x4f2100[_0xcf69('0x65')]=_0x3684ef;return _0x4f2100;});}})[_0xcf69('0x28')](respondWithFilteredResult(_0xaeed4b,_0xf36300))[_0xcf69('0x50')](handleError(_0xaeed4b,null));};exports[_0xcf69('0x6b')]=function(_0x163404,_0x3a023e,_0x5a2115){var _0x1ebc7f={};var _0x42dc8c={};var _0x1d0b18;var _0x5424b5;return db[_0xcf69('0x4d')]['findOne']({'where':{'id':_0x163404[_0xcf69('0x52')]['id']}})[_0xcf69('0x28')](handleEntityNotFound(_0x3a023e,null))[_0xcf69('0x28')](function(_0x331d10){if(_0x331d10){_0x1d0b18=_0x331d10;_0x42dc8c[_0xcf69('0x3d')]=_['keys'](db['Team'][_0xcf69('0x3a')]);_0x42dc8c[_0xcf69('0x3e')]=_[_0xcf69('0x3f')](_0x163404[_0xcf69('0x3e')]);_0x42dc8c['filters']=_[_0xcf69('0x41')](_0x42dc8c[_0xcf69('0x3d')],_0x42dc8c['query']);_0x1ebc7f['attributes']=_['intersection'](_0x42dc8c['model'],qs[_0xcf69('0x43')](_0x163404[_0xcf69('0x3e')]['fields']));_0x1ebc7f[_0xcf69('0x42')]=_0x1ebc7f['attributes'][_0xcf69('0x44')]?_0x1ebc7f[_0xcf69('0x42')]:_0x42dc8c[_0xcf69('0x3d')];_0x1ebc7f['order']=qs['sort'](_0x163404[_0xcf69('0x3e')][_0xcf69('0x48')]);_0x1ebc7f[_0xcf69('0x62')]=qs['filters'](_[_0xcf69('0x49')](_0x163404[_0xcf69('0x3e')],_0x42dc8c['filters']));if(_0x163404[_0xcf69('0x3e')][_0xcf69('0x2e')]){_0x1ebc7f['where']=_[_0xcf69('0x4a')](_0x1ebc7f['where'],{'$or':_[_0xcf69('0x4b')](_0x1ebc7f[_0xcf69('0x42')],function(_0x24fcbd){var _0x3a263e={};_0x3a263e[_0x24fcbd]={'$like':'%'+_0x163404[_0xcf69('0x3e')][_0xcf69('0x2e')]+'%'};return _0x3a263e;})});}_0x1ebc7f=_['merge']({},_0x1ebc7f,_0x163404[_0xcf69('0x4c')]);return _0x1d0b18[_0xcf69('0x6b')](_0x1ebc7f);}})[_0xcf69('0x28')](function(_0x3cef8c){if(_0x3cef8c){_0x5424b5=_0x3cef8c['length'];if(!_0x163404['query'][_0xcf69('0x45')](_0xcf69('0x46'))){_0x1ebc7f['limit']=qs[_0xcf69('0x20')](_0x163404['query'][_0xcf69('0x20')]);_0x1ebc7f[_0xcf69('0x1e')]=qs['offset'](_0x163404[_0xcf69('0x3e')]['offset']);}return _0x1d0b18[_0xcf69('0x6b')](_0x1ebc7f);}})['then'](function(_0x385ca2){if(_0x385ca2){return _0x385ca2?{'count':_0x5424b5,'rows':_0x385ca2}:null;}})[_0xcf69('0x28')](respondWithResult(_0x3a023e,null))[_0xcf69('0x50')](handleError(_0x3a023e,null));};exports[_0xcf69('0x6c')]=function(_0x14ba92,_0x511e49,_0x5842d4){var _0x3d1e04=_0x14ba92[_0xcf69('0x55')][_0xcf69('0x6d')];var _0x48f665=_[_0xcf69('0x4b')](_0x3d1e04,'id');return db[_0xcf69('0x6e')][_0xcf69('0x4f')]({'where':{'id':_0x48f665},'attributes':['id'],'include':[{'model':db[_0xcf69('0x6f')],'as':_0xcf69('0x70'),'attributes':['id',_0xcf69('0x33'),'online',_0xcf69('0x71'),_0xcf69('0x72')],'raw':!![]}]})['then'](function(_0x9e31ac){if(_0x9e31ac){var _0xc862a3=_[_0xcf69('0x73')](_0x9e31ac,function(_0x1fca30){var _0x5b58d8=_0x1fca30[_0xcf69('0x29')]({'plain':!![]});_0x5b58d8[_0xcf69('0x70')][_0xcf69('0x74')](function(_0x32f86c){_0x32f86c['penalty']=_['find'](_0x3d1e04,{'id':_0x5b58d8['id']})[_0xcf69('0x75')];});return _0x5b58d8[_0xcf69('0x70')];});return db[_0xcf69('0x4d')]['find']({'where':{'id':_0x14ba92[_0xcf69('0x52')]['id']}})[_0xcf69('0x28')](function(_0x6e99d0){return db[_0xcf69('0x76')][_0xcf69('0x77')](function(_0x3cefe5){return _0x6e99d0[_0xcf69('0x6c')](_0x48f665,{'transaction':_0x3cefe5})[_0xcf69('0x28')](function(){return BPromise['each'](_0x3d1e04,function(_0x53089b){return db['TeamVoiceQueue'][_0xcf69('0x78')]({'TeamId':_0x53089b['id'],'VoiceQueueId':_0x14ba92[_0xcf69('0x52')]['id'],'penalty':_0x53089b[_0xcf69('0x75')]},{'transaction':_0x3cefe5});});})[_0xcf69('0x28')](function(){return BPromise[_0xcf69('0x79')](_0xc862a3,function(_0x490c30){return db[_0xcf69('0x7a')][_0xcf69('0x7b')]({'where':{'UserId':_0x490c30['id'],'VoiceQueueId':_0x14ba92[_0xcf69('0x52')]['id']},'defaults':{'penalty':_0x490c30['penalty']},'transaction':_0x3cefe5});});})[_0xcf69('0x28')](function(){return BPromise[_0xcf69('0x79')](_[_0xcf69('0x2e')](_0xc862a3,{'online':!![]}),function(_0x298937){return db[_0xcf69('0x7c')][_0xcf69('0x78')]({'membername':_0x298937[_0xcf69('0x33')],'UserId':_0x298937['id'],'queue_name':_0x6e99d0[_0xcf69('0x33')],'VoiceQueueId':_0x6e99d0['id'],'interface':_[_0xcf69('0x7d')](_0x298937[_0xcf69('0x72')])?util[_0xcf69('0x7e')](_0xcf69('0x7f'),_0x298937[_0xcf69('0x33')]):_0x298937[_0xcf69('0x72')],'paused':_0x298937[_0xcf69('0x71')]||![],'penalty':_0x298937['penalty']},{'transaction':_0x3cefe5});});})[_0xcf69('0x28')](function(){_0xc862a3[_0xcf69('0x74')](function(_0x5b4fdb){socket[_0xcf69('0x80')](_0xcf69('0x81'),{'UserId':_0x5b4fdb['id'],'VoiceQueueId':_0x6e99d0['id']});});});});});}})['then'](respondWithStatusCode(_0x511e49,null))['catch'](handleError(_0x511e49,null));};exports[_0xcf69('0x82')]=function(_0x2a0a13,_0x570117,_0x330d02){return db[_0xcf69('0x6e')]['findAll']({'where':{'id':_0x2a0a13['query'][_0xcf69('0x83')]},'attributes':['id'],'include':[{'model':db['User'],'as':_0xcf69('0x70'),'attributes':['id'],'raw':!![]}]})[_0xcf69('0x28')](handleEntityNotFound(_0x570117,null))[_0xcf69('0x28')](function(_0xdaaba2){var _0x359a78=_['map'](_0xdaaba2,'id');var _0x1c06b8=[];var _0x5efc61=[];var _0xaea229=squel[_0xcf69('0x84')]();_0xaea229['field'](_0xcf69('0x85'))[_0xcf69('0x86')]('team_has_voice_queues','tq')['join'](_0xcf69('0x87'),'ut',_0xcf69('0x88'))['where'](_0xcf69('0x89'),_0x2a0a13[_0xcf69('0x52')]['id']);for(var _0x389501=0x0;_0x389501<_0xdaaba2[_0xcf69('0x44')];_0x389501+=0x1){let _0x30dfa9=_0xdaaba2[_0x389501];for(var _0xef7f73=0x0;_0xef7f73<_0x30dfa9['Agents'][_0xcf69('0x44')];_0xef7f73+=0x1){let _0x308fc8=_0x30dfa9['Agents'][_0xef7f73];var _0x8cb383=_0xaea229['clone']();_0x8cb383[_0xcf69('0x62')](_0xcf69('0x8a'),_0x308fc8['id']);_0x5efc61['push'](db[_0xcf69('0x76')][_0xcf69('0x3e')](_0x8cb383[_0xcf69('0x8b')](),{'type':db[_0xcf69('0x76')][_0xcf69('0x8c')][_0xcf69('0x8d')]})[_0xcf69('0x28')](function(_0x20f94c){if(_0x20f94c[_0xcf69('0x44')]===0x1){return _0x308fc8['id'];}else{var _0xc75f1d=_[_0xcf69('0x8e')](_[_0xcf69('0x4b')](_0x20f94c,'TeamId'),function(_0x359534){return _[_0xcf69('0x30')](_0x359a78,_0x359534);});if(_0xc75f1d){return _0x308fc8['id'];}}}));}}return BPromise['all'](_0x5efc61)['then'](function(_0x18d274){_0x1c06b8=_(_0x1c06b8)['union'](_0x18d274)['compact']()[_0xcf69('0x2f')]();return db[_0xcf69('0x4d')]['find']({'where':{'id':_0x2a0a13[_0xcf69('0x52')]['id']}})[_0xcf69('0x28')](function(_0x216e27){return db[_0xcf69('0x76')][_0xcf69('0x77')](function(_0x412f67){return _0x216e27[_0xcf69('0x82')](_0x2a0a13[_0xcf69('0x3e')][_0xcf69('0x83')],{'transaction':_0x412f67})[_0xcf69('0x28')](function(){if(!_[_0xcf69('0x8f')](_0x1c06b8)){return _0x216e27[_0xcf69('0x90')](_0x1c06b8,{'transaction':_0x412f67})[_0xcf69('0x28')](function(){return db[_0xcf69('0x7c')][_0xcf69('0x35')]({'where':{'VoiceQueueId':_0x2a0a13[_0xcf69('0x52')]['id'],'UserId':_0x1c06b8},'transaction':_0x412f67});});}})[_0xcf69('0x28')](function(){_0x1c06b8[_0xcf69('0x74')](function(_0x48ab26){socket['emit'](_0xcf69('0x91'),{'UserId':_0x48ab26,'VoiceQueueId':_0x216e27['id']});});});});});});})[_0xcf69('0x28')](respondWithStatusCode(_0x570117,null))['catch'](handleError(_0x570117,null));};exports['addAgents']=function(_0x18ee29,_0x153094,_0x5dfc90){var _0x4010bc,_0x36f78a;return db[_0xcf69('0x4d')][_0xcf69('0x32')]({'where':{'id':_0x18ee29['params']['id']}})[_0xcf69('0x28')](handleEntityNotFound(_0x153094,null))[_0xcf69('0x28')](function(_0x287c29){if(_0x287c29){_0x36f78a=_0x287c29;return _0x287c29[_0xcf69('0x92')](_0x18ee29[_0xcf69('0x55')][_0xcf69('0x83')],_[_0xcf69('0x5b')](_0x18ee29['body'],[_0xcf69('0x83'),'id'])||{})[_0xcf69('0x93')](function(_0x210e64){for(var _0x23d5cb=0x0;_0x23d5cb<_0x18ee29[_0xcf69('0x55')]['ids'][_0xcf69('0x44')];_0x23d5cb+=0x1){socket['emit'](_0xcf69('0x81'),{'UserId':Number(_0x18ee29[_0xcf69('0x55')][_0xcf69('0x83')][_0x23d5cb]),'VoiceQueueId':Number(_0x18ee29['params']['id'])});}return _0x210e64;});}})['then'](function(_0x3f07bb){_0x4010bc=_0x3f07bb||[];if(_0x36f78a){return db[_0xcf69('0x6f')][_0xcf69('0x4f')]({'where':{'id':_0x18ee29[_0xcf69('0x55')][_0xcf69('0x83')]},'attributes':['id','name',_0xcf69('0x94'),_0xcf69('0x71'),_0xcf69('0x72')],'raw':!![]});}})['then'](function(_0x2ae031){if(!_['isEmpty'](_0x2ae031)){var _0x4665ca=[];for(var _0xa51a2f=0x0;_0xa51a2f<_0x2ae031[_0xcf69('0x44')];_0xa51a2f++){if(_0x2ae031[_0xa51a2f]['online']){_0x4665ca['push'](db[_0xcf69('0x7c')][_0xcf69('0x78')]({'membername':_0x2ae031[_0xa51a2f][_0xcf69('0x33')],'UserId':_0x2ae031[_0xa51a2f]['id'],'queue_name':_0x36f78a[_0xcf69('0x33')],'VoiceQueueId':_0x36f78a['id'],'interface':_[_0xcf69('0x7d')](_0x2ae031[_0xa51a2f][_0xcf69('0x72')])?util[_0xcf69('0x7e')](_0xcf69('0x7f'),_0x2ae031[_0xa51a2f][_0xcf69('0x33')]):_0x2ae031[_0xa51a2f]['interface'],'paused':_0x2ae031[_0xa51a2f][_0xcf69('0x71')]||![],'penalty':_0x18ee29['body'][_0xcf69('0x75')]||0x0}));}}return BPromise[_0xcf69('0x95')](_0x4665ca);}})[_0xcf69('0x28')](function(){return _0x4010bc;})[_0xcf69('0x28')](respondWithResult(_0x153094,null))[_0xcf69('0x50')](handleError(_0x153094,null));};exports[_0xcf69('0x90')]=function(_0x443d9b,_0x384e28,_0x45e1ea){return db['VoiceQueue'][_0xcf69('0x32')]({'where':{'id':_0x443d9b[_0xcf69('0x52')]['id']}})[_0xcf69('0x28')](handleEntityNotFound(_0x384e28,null))[_0xcf69('0x28')](function(_0x119b15){if(_0x119b15){return _0x119b15[_0xcf69('0x90')](_0x443d9b['query']['ids'])[_0xcf69('0x28')](function(){if(_[_0xcf69('0x96')](_0x443d9b[_0xcf69('0x3e')][_0xcf69('0x83')])){for(var _0x1af27a=0x0;_0x1af27a<_0x443d9b['query'][_0xcf69('0x83')]['length'];_0x1af27a+=0x1){socket[_0xcf69('0x80')](_0xcf69('0x91'),{'UserId':Number(_0x443d9b['query'][_0xcf69('0x83')][_0x1af27a]),'VoiceQueueId':Number(_0x443d9b[_0xcf69('0x52')]['id'])});}}else{socket[_0xcf69('0x80')](_0xcf69('0x91'),{'UserId':Number(_0x443d9b['query'][_0xcf69('0x83')]),'VoiceQueueId':Number(_0x443d9b['params']['id'])});}});}})[_0xcf69('0x28')](function(_0x88003b){return db['UserVoiceQueueRt']['destroy']({'where':{'VoiceQueueId':_0x443d9b[_0xcf69('0x52')]['id'],'UserId':_0x443d9b[_0xcf69('0x3e')][_0xcf69('0x83')]}})[_0xcf69('0x28')](function(){return _0x88003b;});})[_0xcf69('0x28')](respondWithStatusCode(_0x384e28,null))['catch'](handleError(_0x384e28,null));};exports[_0xcf69('0x97')]=function(_0x246116,_0x212554,_0x3c0cc9){var _0xdc41cb={};var _0xcf60cf={};var _0x55c2e1;var _0x3095b1;return db['VoiceQueue'][_0xcf69('0x61')]({'where':{'id':_0x246116[_0xcf69('0x52')]['id']}})['then'](handleEntityNotFound(_0x212554,null))[_0xcf69('0x28')](function(_0x1eee0e){if(_0x1eee0e){_0x55c2e1=_0x1eee0e;_0xcf60cf[_0xcf69('0x3d')]=_['keys'](db[_0xcf69('0x6f')]['rawAttributes']);_0xcf60cf[_0xcf69('0x3e')]=_[_0xcf69('0x3f')](_0x246116[_0xcf69('0x3e')]);_0xcf60cf[_0xcf69('0x40')]=_[_0xcf69('0x41')](_0xcf60cf['model'],_0xcf60cf[_0xcf69('0x3e')]);_0xdc41cb[_0xcf69('0x42')]=_[_0xcf69('0x41')](_0xcf60cf[_0xcf69('0x3d')],qs[_0xcf69('0x43')](_0x246116['query'][_0xcf69('0x43')]));_0xdc41cb[_0xcf69('0x42')]=_0xdc41cb['attributes'][_0xcf69('0x44')]?_0xdc41cb['attributes']:_0xcf60cf[_0xcf69('0x3d')];_0xdc41cb[_0xcf69('0x47')]=qs[_0xcf69('0x48')](_0x246116[_0xcf69('0x3e')]['sort']);_0xdc41cb[_0xcf69('0x62')]=qs[_0xcf69('0x40')](_[_0xcf69('0x49')](_0x246116[_0xcf69('0x3e')],_0xcf60cf['filters']));if(_0x246116[_0xcf69('0x3e')][_0xcf69('0x2e')]){_0xdc41cb[_0xcf69('0x62')]=_[_0xcf69('0x4a')](_0xdc41cb[_0xcf69('0x62')],{'$or':_[_0xcf69('0x4b')](_0xdc41cb[_0xcf69('0x42')],function(_0x34c2fb){var _0xf4df04={};_0xf4df04[_0x34c2fb]={'$like':'%'+_0x246116[_0xcf69('0x3e')][_0xcf69('0x2e')]+'%'};return _0xf4df04;})});}_0xdc41cb=_[_0xcf69('0x4a')]({},_0xdc41cb,_0x246116[_0xcf69('0x4c')]);return _0x55c2e1[_0xcf69('0x97')](_0xdc41cb);}})[_0xcf69('0x28')](function(_0xdb04b1){if(_0xdb04b1){_0x3095b1=_0xdb04b1[_0xcf69('0x44')];if(!_0x246116[_0xcf69('0x3e')]['hasOwnProperty'](_0xcf69('0x46'))){_0xdc41cb[_0xcf69('0x20')]=qs[_0xcf69('0x20')](_0x246116[_0xcf69('0x3e')][_0xcf69('0x20')]);_0xdc41cb[_0xcf69('0x1e')]=qs['offset'](_0x246116[_0xcf69('0x3e')][_0xcf69('0x1e')]);}return _0x55c2e1[_0xcf69('0x97')](_0xdc41cb);}})[_0xcf69('0x28')](function(_0x58f49f){if(_0x58f49f){return _0x58f49f?{'count':_0x3095b1,'rows':_0x58f49f}:null;}})[_0xcf69('0x28')](respondWithResult(_0x212554,null))['catch'](handleError(_0x212554,null));};exports['getMembers']=function(_0x3155a7,_0x5634ea,_0x1e8b71){var _0x955ad7={};var _0x59a668={};var _0x3fe4a3;var _0x2d2ba3;return db['VoiceQueue'][_0xcf69('0x61')]({'where':{'id':_0x3155a7[_0xcf69('0x52')]['id']}})[_0xcf69('0x28')](handleEntityNotFound(_0x5634ea,null))[_0xcf69('0x28')](function(_0xbc12f1){if(_0xbc12f1){_0x3fe4a3=_0xbc12f1;_0x59a668[_0xcf69('0x3d')]=_[_0xcf69('0x3f')](db[_0xcf69('0x7c')][_0xcf69('0x3a')]);_0x59a668[_0xcf69('0x3e')]=_[_0xcf69('0x3f')](_0x3155a7[_0xcf69('0x3e')]);_0x59a668['filters']=_[_0xcf69('0x41')](_0x59a668[_0xcf69('0x3d')],_0x59a668['query']);_0x955ad7[_0xcf69('0x42')]=_[_0xcf69('0x41')](_0x59a668[_0xcf69('0x3d')],qs[_0xcf69('0x43')](_0x3155a7[_0xcf69('0x3e')][_0xcf69('0x43')]));_0x955ad7[_0xcf69('0x42')]=_0x955ad7['attributes'][_0xcf69('0x44')]?_0x955ad7['attributes']:_0x59a668[_0xcf69('0x3d')];_0x955ad7[_0xcf69('0x47')]=qs[_0xcf69('0x48')](_0x3155a7['query'][_0xcf69('0x48')]);_0x955ad7['where']=qs[_0xcf69('0x40')](_['pick'](_0x3155a7[_0xcf69('0x3e')],_0x59a668[_0xcf69('0x40')]));if(_0x3155a7[_0xcf69('0x3e')]['filter']){_0x955ad7[_0xcf69('0x62')]=_[_0xcf69('0x4a')](_0x955ad7[_0xcf69('0x62')],{'$or':_[_0xcf69('0x4b')](_0x955ad7[_0xcf69('0x42')],function(_0x5233f9){var _0x51fda6={};_0x51fda6[_0x5233f9]={'$like':'%'+_0x3155a7['query'][_0xcf69('0x2e')]+'%'};return _0x51fda6;})});}_0x955ad7=_['merge']({},_0x955ad7,_0x3155a7[_0xcf69('0x4c')]);return _0x3fe4a3[_0xcf69('0x98')](_0x955ad7);}})[_0xcf69('0x28')](function(_0xa3df44){if(_0xa3df44){_0x2d2ba3=_0xa3df44[_0xcf69('0x44')];if(!_0x3155a7[_0xcf69('0x3e')][_0xcf69('0x45')](_0xcf69('0x46'))){_0x955ad7['limit']=qs[_0xcf69('0x20')](_0x3155a7['query'][_0xcf69('0x20')]);_0x955ad7[_0xcf69('0x1e')]=qs[_0xcf69('0x1e')](_0x3155a7[_0xcf69('0x3e')]['offset']);}return _0x3fe4a3[_0xcf69('0x98')](_0x955ad7);}})['then'](function(_0x328e0b){return _0x328e0b?{'count':_0x2d2ba3,'rows':_0x328e0b}:null;})[_0xcf69('0x28')](respondWithResult(_0x5634ea,null))[_0xcf69('0x50')](handleError(_0x5634ea,null));};exports[_0xcf69('0x99')]=function(_0x334ea2,_0x2dd2de,_0x392f8d){var _0x4becf6={};var _0x5a5393={};var _0x306921;var _0x4c26b0;return db[_0xcf69('0x4d')]['findOne']({'where':{'id':_0x334ea2['params']['id']}})['then'](handleEntityNotFound(_0x2dd2de,null))[_0xcf69('0x28')](function(_0x2573e6){if(_0x2573e6){_0x306921=_0x2573e6;_0x5a5393['model']=_['keys'](db[_0xcf69('0x9a')][_0xcf69('0x3a')]);_0x5a5393[_0xcf69('0x3e')]=_['keys'](_0x334ea2[_0xcf69('0x3e')]);_0x5a5393[_0xcf69('0x40')]=_['intersection'](_0x5a5393[_0xcf69('0x3d')],_0x5a5393['query']);_0x4becf6[_0xcf69('0x42')]=_[_0xcf69('0x41')](_0x5a5393[_0xcf69('0x3d')],qs['fields'](_0x334ea2[_0xcf69('0x3e')][_0xcf69('0x43')]));_0x4becf6[_0xcf69('0x42')]=_0x4becf6['attributes'][_0xcf69('0x44')]?_0x4becf6[_0xcf69('0x42')]:_0x5a5393[_0xcf69('0x3d')];_0x4becf6[_0xcf69('0x47')]=qs['sort'](_0x334ea2[_0xcf69('0x3e')][_0xcf69('0x48')]);_0x4becf6[_0xcf69('0x62')]=qs[_0xcf69('0x40')](_[_0xcf69('0x49')](_0x334ea2[_0xcf69('0x3e')],_0x5a5393[_0xcf69('0x40')]));if(_0x334ea2[_0xcf69('0x3e')]['filter']){_0x4becf6[_0xcf69('0x62')]=_['merge'](_0x4becf6[_0xcf69('0x62')],{'$or':_['map'](_0x4becf6['attributes'],function(_0x4dcba8){var _0x344b53={};_0x344b53[_0x4dcba8]={'$like':'%'+_0x334ea2[_0xcf69('0x3e')][_0xcf69('0x2e')]+'%'};return _0x344b53;})});}_0x4becf6=_['merge']({},_0x4becf6,_0x334ea2[_0xcf69('0x4c')]);return _0x306921['getLists'](_0x4becf6);}})[_0xcf69('0x28')](function(_0x470ef7){if(_0x470ef7){_0x4c26b0=_0x470ef7['length'];if(!_0x334ea2[_0xcf69('0x3e')][_0xcf69('0x45')](_0xcf69('0x46'))){_0x4becf6[_0xcf69('0x20')]=qs['limit'](_0x334ea2['query']['limit']);_0x4becf6['offset']=qs[_0xcf69('0x1e')](_0x334ea2[_0xcf69('0x3e')][_0xcf69('0x1e')]);}return _0x306921[_0xcf69('0x99')](_0x4becf6);}})[_0xcf69('0x28')](function(_0x40f9c1){if(_0x40f9c1){return _0x40f9c1?{'count':_0x4c26b0,'rows':_0x40f9c1}:null;}})['then'](respondWithResult(_0x2dd2de,null))['catch'](handleError(_0x2dd2de,null));};exports[_0xcf69('0x9b')]=function(_0x5cbc98,_0x3cf596,_0x3f6385){var _0x15ed84=moment()[_0xcf69('0x7e')](_0xcf69('0x9c'));var _0x424c30,_0x46c16e;return db[_0xcf69('0x4d')][_0xcf69('0x32')]({'where':{'id':_0x5cbc98[_0xcf69('0x52')]['id']}})['then'](handleEntityNotFound(_0x3cf596,null))['then'](function(_0x17e769){if(_0x17e769){_0x46c16e=_0x17e769;return _0x17e769['addLists'](_0x5cbc98[_0xcf69('0x55')][_0xcf69('0x83')],_[_0xcf69('0x5b')](_0x5cbc98[_0xcf69('0x55')],['ids','id'])||{});}return null;})[_0xcf69('0x93')](function(_0x2c1206){var _0x523917;_0x424c30=_0x2c1206||[];var _0xea8927=[];if(_0x2c1206){for(var _0x68e42a=0x0;_0x68e42a<_0x2c1206['length'];_0x68e42a+=0x1){var _0xe539af=_0x2c1206[_0x68e42a][_0xcf69('0x29')]({'plain':!![]});_0x46c16e[_0xcf69('0x9d')]=_0x5cbc98[_0xcf69('0x55')][_0xcf69('0x9d')]?_0x5cbc98['body']['dialCheckDuplicateType']:_0x46c16e[_0xcf69('0x9d')];switch(_0x46c16e[_0xcf69('0x9d')]){case _0xcf69('0x9e'):_0x523917=squel[_0xcf69('0x9f')]()[_0xcf69('0xa0')](_0xcf69('0xa1'))[_0xcf69('0xa2')]([_0xcf69('0xa3'),_0xcf69('0xa4'),_0xcf69('0xa5'),_0xcf69('0xa6'),_0xcf69('0x63'),'createdAt','updatedAt'],squel[_0xcf69('0x84')]()[_0xcf69('0xa7')](_0xcf69('0xa3'),_0xcf69('0xa3'))[_0xcf69('0xa7')]('\x27'+_0x15ed84+'\x27','scheduledAt')[_0xcf69('0xa7')]('id',_0xcf69('0xa5'))['field'](_0xe539af[_0xcf69('0xa8')][_0xcf69('0x8b')](),_0xcf69('0xa6'))['field'](_0x5cbc98[_0xcf69('0x52')]['id'][_0xcf69('0x8b')](),_0xcf69('0x63'))[_0xcf69('0xa7')]('\x27'+_0x15ed84+'\x27',_0xcf69('0x5c'))[_0xcf69('0xa7')]('\x27'+_0x15ed84+'\x27',_0xcf69('0x5d'))[_0xcf69('0x86')](_0xcf69('0xa9'))['where'](_0xcf69('0xaa'))[_0xcf69('0x62')](_0xcf69('0xab'),_0xe539af[_0xcf69('0xa8')][_0xcf69('0x8b')]())[_0xcf69('0x62')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xcf69('0xac'),squel[_0xcf69('0x84')]()[_0xcf69('0xa7')](_0xcf69('0xad'))[_0xcf69('0x86')]('cm_hopper_final')[_0xcf69('0x62')](_0xcf69('0x89'),_0x5cbc98[_0xcf69('0x52')]['id']['toString']()))[_0xcf69('0x62')]('phone\x20NOT\x20IN\x20(?)',squel[_0xcf69('0x84')]()[_0xcf69('0xa7')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0xcf69('0x89'),_0x5cbc98['params']['id'][_0xcf69('0x8b')]())))[_0xcf69('0x8b')]();break;case _0xcf69('0xae'):_0x523917=squel[_0xcf69('0x9f')]()[_0xcf69('0xa0')]('cm_hopper')[_0xcf69('0xa2')](['phone',_0xcf69('0xa4'),_0xcf69('0xa5'),_0xcf69('0xa6'),_0xcf69('0x63'),_0xcf69('0x5c'),_0xcf69('0x5d')],squel[_0xcf69('0x84')]()[_0xcf69('0xa7')](_0xcf69('0xa3'),_0xcf69('0xa3'))[_0xcf69('0xa7')]('\x27'+_0x15ed84+'\x27',_0xcf69('0xa4'))[_0xcf69('0xa7')]('id','ContactId')[_0xcf69('0xa7')](_0xe539af[_0xcf69('0xa8')]['toString'](),'ListId')[_0xcf69('0xa7')](_0x5cbc98[_0xcf69('0x52')]['id'][_0xcf69('0x8b')](),_0xcf69('0x63'))['field']('\x27'+_0x15ed84+'\x27',_0xcf69('0x5c'))[_0xcf69('0xa7')]('\x27'+_0x15ed84+'\x27',_0xcf69('0x5d'))['from'](_0xcf69('0xa9'))[_0xcf69('0x62')](_0xcf69('0xaa'))[_0xcf69('0x62')](_0xcf69('0xab'),_0xe539af['CmListId'][_0xcf69('0x8b')]())[_0xcf69('0x62')](_0xcf69('0xaf'))[_0xcf69('0x62')](_0xcf69('0xac'),squel[_0xcf69('0x84')]()[_0xcf69('0xa7')]('COALESCE(phone,\x27\x27)')['from']('cm_hopper')['where'](_0xcf69('0x89'),_0x5cbc98['params']['id'][_0xcf69('0x8b')]())))[_0xcf69('0x8b')]();break;default:_0x523917=squel['insert']()[_0xcf69('0xa0')](_0xcf69('0xa1'))[_0xcf69('0xa2')]([_0xcf69('0xa3'),_0xcf69('0xa4'),_0xcf69('0xa5'),_0xcf69('0xa6'),_0xcf69('0x63'),_0xcf69('0x5c'),_0xcf69('0x5d')],squel[_0xcf69('0x84')]()[_0xcf69('0xa7')](_0xcf69('0xa3'),_0xcf69('0xa3'))[_0xcf69('0xa7')]('\x27'+_0x15ed84+'\x27','scheduledAt')['field']('id','ContactId')['field'](_0xe539af[_0xcf69('0xa8')]['toString'](),_0xcf69('0xa6'))[_0xcf69('0xa7')](_0x5cbc98['params']['id'][_0xcf69('0x8b')](),_0xcf69('0x63'))[_0xcf69('0xa7')]('\x27'+_0x15ed84+'\x27',_0xcf69('0x5c'))[_0xcf69('0xa7')]('\x27'+_0x15ed84+'\x27','updatedAt')[_0xcf69('0x86')](_0xcf69('0xa9'))[_0xcf69('0x62')](_0xcf69('0xaa'))['where'](_0xcf69('0xab'),_0xe539af[_0xcf69('0xa8')]['toString']())[_0xcf69('0x62')](_0xcf69('0xaf')))[_0xcf69('0x8b')]();}_0xea8927[_0xcf69('0xb0')](db[_0xcf69('0x76')][_0xcf69('0x3e')](_0x523917));}return BPromise[_0xcf69('0x95')](_0xea8927);}})[_0xcf69('0x28')](function(){var _0x54e6aa=[];var _0x4acd95=squel[_0xcf69('0x9f')]()[_0xcf69('0xa0')](_0xcf69('0xb1'))[_0xcf69('0xa2')]([_0xcf69('0xb2'),'phone','OrderBy',_0xcf69('0x5c'),_0xcf69('0x5d')],squel[_0xcf69('0x84')]()['field'](_0xcf69('0xb3'))[_0xcf69('0xa7')](_0xcf69('0xb4'))['field'](_0xcf69('0xb5'))['field']('\x27'+_0x15ed84+'\x27',_0xcf69('0x5c'))[_0xcf69('0xa7')]('\x27'+_0x15ed84+'\x27',_0xcf69('0x5d'))['from'](_0xcf69('0xb6'),'ci')[_0xcf69('0xb7')](_0xcf69('0xa1'),'h',_0xcf69('0xb8'))[_0xcf69('0x62')](_0xcf69('0xb9'),_0x15ed84)[_0xcf69('0x62')](_0xcf69('0xba'),_0xcf69('0xbb')))['toString']();_0x54e6aa[_0xcf69('0xb0')](db[_0xcf69('0x76')][_0xcf69('0x3e')](_0x4acd95));return BPromise['all'](_0x54e6aa);})[_0xcf69('0x28')](function(){return _0x424c30;})[_0xcf69('0x28')](respondWithResult(_0x3cf596,null))[_0xcf69('0x50')](handleError(_0x3cf596,null));};exports[_0xcf69('0xbc')]=function(_0x48690b,_0x4caf41,_0xff4405){return db[_0xcf69('0x4d')]['find']({'where':{'id':_0x48690b['params']['id']}})[_0xcf69('0x28')](handleEntityNotFound(_0x4caf41,null))['then'](function(_0x457bed){if(_0x457bed){return _0x457bed['removeLists'](_0x48690b[_0xcf69('0x3e')][_0xcf69('0x83')]);}})[_0xcf69('0x28')](function(_0x2a5029){if(_0x2a5029){return db[_0xcf69('0x64')][_0xcf69('0x35')]({'where':{'ListId':_0x48690b[_0xcf69('0x3e')]['ids'],'VoiceQueueId':_0x48690b[_0xcf69('0x52')]['id']}})['then'](function(){return _0x2a5029;});}})[_0xcf69('0x28')](respondWithStatusCode(_0x4caf41,null))[_0xcf69('0x50')](handleError(_0x4caf41,null));};exports[_0xcf69('0xbd')]=function(_0x3733e6,_0x2dfa1d,_0x55f204){var _0x2980cb={};var _0x57c68f={};var _0x4d554c;var _0x2d22e2;return db['VoiceQueue']['findOne']({'where':{'id':_0x3733e6['params']['id']}})[_0xcf69('0x28')](handleEntityNotFound(_0x2dfa1d,null))[_0xcf69('0x28')](function(_0x549d2f){if(_0x549d2f){_0x4d554c=_0x549d2f;_0x57c68f[_0xcf69('0x3d')]=_[_0xcf69('0x3f')](db[_0xcf69('0x9a')][_0xcf69('0x3a')]);_0x57c68f[_0xcf69('0x3e')]=_[_0xcf69('0x3f')](_0x3733e6[_0xcf69('0x3e')]);_0x57c68f[_0xcf69('0x40')]=_[_0xcf69('0x41')](_0x57c68f[_0xcf69('0x3d')],_0x57c68f[_0xcf69('0x3e')]);_0x2980cb['attributes']=_[_0xcf69('0x41')](_0x57c68f['model'],qs[_0xcf69('0x43')](_0x3733e6[_0xcf69('0x3e')][_0xcf69('0x43')]));_0x2980cb[_0xcf69('0x42')]=_0x2980cb[_0xcf69('0x42')][_0xcf69('0x44')]?_0x2980cb[_0xcf69('0x42')]:_0x57c68f[_0xcf69('0x3d')];_0x2980cb[_0xcf69('0x47')]=qs[_0xcf69('0x48')](_0x3733e6['query']['sort']);_0x2980cb[_0xcf69('0x62')]=qs[_0xcf69('0x40')](_[_0xcf69('0x49')](_0x3733e6[_0xcf69('0x3e')],_0x57c68f[_0xcf69('0x40')]));if(_0x3733e6[_0xcf69('0x3e')][_0xcf69('0x2e')]){_0x2980cb[_0xcf69('0x62')]=_[_0xcf69('0x4a')](_0x2980cb[_0xcf69('0x62')],{'$or':_[_0xcf69('0x4b')](_0x2980cb['attributes'],function(_0x5306da){var _0x3a5751={};_0x3a5751[_0x5306da]={'$like':'%'+_0x3733e6['query'][_0xcf69('0x2e')]+'%'};return _0x3a5751;})});}_0x2980cb=_[_0xcf69('0x4a')]({},_0x2980cb,_0x3733e6[_0xcf69('0x4c')]);return _0x4d554c[_0xcf69('0xbd')](_0x2980cb);}})[_0xcf69('0x28')](function(_0x14b13b){if(_0x14b13b){_0x2d22e2=_0x14b13b[_0xcf69('0x44')];if(!_0x3733e6[_0xcf69('0x3e')][_0xcf69('0x45')](_0xcf69('0x46'))){_0x2980cb[_0xcf69('0x20')]=qs[_0xcf69('0x20')](_0x3733e6[_0xcf69('0x3e')][_0xcf69('0x20')]);_0x2980cb['offset']=qs[_0xcf69('0x1e')](_0x3733e6[_0xcf69('0x3e')][_0xcf69('0x1e')]);}return _0x4d554c[_0xcf69('0xbd')](_0x2980cb);}})[_0xcf69('0x28')](function(_0x8a6fa4){if(_0x8a6fa4){return _0x8a6fa4?{'count':_0x2d22e2,'rows':_0x8a6fa4}:null;}})['then'](respondWithResult(_0x2dfa1d,null))[_0xcf69('0x50')](handleError(_0x2dfa1d,null));};exports[_0xcf69('0xbe')]=function(_0x5e3432,_0x3c21b9,_0x179e24){var _0x1f3770,_0x3a3d5d;return db['VoiceQueue'][_0xcf69('0x32')]({'where':{'id':_0x5e3432[_0xcf69('0x52')]['id']}})[_0xcf69('0x28')](handleEntityNotFound(_0x3c21b9,null))[_0xcf69('0x28')](function(_0x6455b3){if(_0x6455b3){_0x3a3d5d=_0x6455b3;return _0x6455b3[_0xcf69('0xbe')](_0x5e3432['body'][_0xcf69('0x83')],_['omit'](_0x5e3432['body'],[_0xcf69('0x83'),'id'])||{});}return null;})[_0xcf69('0x93')](function(_0x5bbc46){var _0xad2ff9;_0x1f3770=_0x5bbc46||[];var _0x3aa5ea=[];if(_0x5bbc46){for(var _0x49ab93=0x0;_0x49ab93<_0x5bbc46[_0xcf69('0x44')];_0x49ab93+=0x1){var _0x28cb77=_0x5bbc46[_0x49ab93][_0xcf69('0x29')]({'plain':!![]});_0xad2ff9=squel[_0xcf69('0x9f')]()['into'](_0xcf69('0xbf'))[_0xcf69('0xa2')]([_0xcf69('0xa3'),'ContactId','ListId',_0xcf69('0x63'),'createdAt','updatedAt'],squel[_0xcf69('0x84')]()[_0xcf69('0xa7')](_0xcf69('0xa3'),'phone')[_0xcf69('0xa7')]('id',_0xcf69('0xa5'))[_0xcf69('0xa7')](_0x28cb77[_0xcf69('0xa8')][_0xcf69('0x8b')](),_0xcf69('0xa6'))[_0xcf69('0xa7')](_0x5e3432[_0xcf69('0x52')]['id'][_0xcf69('0x8b')](),_0xcf69('0x63'))[_0xcf69('0xa7')](_0xcf69('0xc0'),'createdAt')[_0xcf69('0xa7')](_0xcf69('0xc0'),_0xcf69('0x5d'))[_0xcf69('0x86')](_0xcf69('0xa9'))[_0xcf69('0x62')](_0xcf69('0xaa'))[_0xcf69('0x62')](_0xcf69('0xab'),_0x28cb77[_0xcf69('0xa8')][_0xcf69('0x8b')]())[_0xcf69('0x62')](_0xcf69('0xaf')))[_0xcf69('0x8b')]();_0x3aa5ea[_0xcf69('0xb0')](db['sequelize'][_0xcf69('0x3e')](_0xad2ff9));}return BPromise[_0xcf69('0x95')](_0x3aa5ea);}})['then'](function(){return _0x1f3770;})[_0xcf69('0x28')](respondWithResult(_0x3c21b9,null))['catch'](handleError(_0x3c21b9,null));};exports[_0xcf69('0xc1')]=function(_0x345600,_0x49bcd1,_0x1a2717){return db[_0xcf69('0x4d')][_0xcf69('0x32')]({'where':{'id':_0x345600[_0xcf69('0x52')]['id']}})[_0xcf69('0x28')](handleEntityNotFound(_0x49bcd1,null))[_0xcf69('0x28')](function(_0x1737e3){if(_0x1737e3){return _0x1737e3['removeBlackLists'](_0x345600[_0xcf69('0x3e')]['ids']);}})[_0xcf69('0x28')](function(_0x20f235){if(_0x20f235){return db[_0xcf69('0x6a')]['destroy']({'where':{'ListId':_0x345600[_0xcf69('0x3e')]['ids'],'VoiceQueueId':_0x345600[_0xcf69('0x52')]['id']}})['then'](function(){return _0x20f235;});}})['then'](respondWithStatusCode(_0x49bcd1,null))[_0xcf69('0x50')](handleError(_0x49bcd1,null));}; \ No newline at end of file +var _0xa7ee=['Content-Range','json','reject','then','destroy','get','VoiceQueues','inbound','QueueCampaigns','outbound','filter','ignore','value','includes','type','UserProfileResource','end','sendStatus','error','stack','name','map','VoiceQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','length','nolimit','order','sort','where','filters','pick','merge','include','catch','params','fields','options','find','create','body','Unable\x20to\x20retrieve\x20the\x20current\x20user','user','UserProfileSection','userProfileId','autoAssociation','clone','includeAll','omit','updatedAt','createdAt','role','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','getHoppers','findOne','VoiceQueueId','CmHopper','getHopperHistories','hasOwnProperty','CmHopperHistory','rows','CmHopperFinal','findAll','getHopperBlacks','CmHopperBlack','getTeams','addTeams','User','online','voicePause','interface','flatMap','Agents','forEach','penalty','sequelize','transaction','each','UserVoiceQueue','findOrCreate','isNil','format','SIP/%s','emit','userVoiceQueue:save','removeTeams','Team','ids','field','tq.TeamId','from','team_has_voice_queues','join','VoiceQueueId\x20=\x20?','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','all','union','compact','isEmpty','removeAgents','UserVoiceQueueRt','addAgents','spread','upsert','isArray','userVoiceQueue:remove','getAgents','getMembers','CmList','getLists','addLists','dialCheckDuplicateType','insert','into','cm_hopper','scheduledAt','ContactId','ListId','select','CmListId','toString','cm_contacts','phone\x20IS\x20NOT\x20NULL','phone\x20NOT\x20IN\x20(?)','COALESCE(calleridnum,\x27\x27)','COALESCE(phone,\x27\x27)','onlyIfOpen','phone','ListId\x20=\x20?','cm_hopper_additional_phones','fromQuery','CmHopperId','OrderBy','ci.OrderBy+1','h.scheduledat=?','ci.ItemClass=?','PHONE','removeLists','getBlackLists','addBlackLists','cm_hopper_black','NOW()','deletedAt\x20IS\x20NULL','removeBlackLists','eml-format','zip-dir','fast-json-patch','request-promise','moment','util','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','register','status','offset','undefined','count','limit','set'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa7ee,0x159));var _0xea7e=function(_0xfec4f2,_0x27b2aa){_0xfec4f2=_0xfec4f2-0x0;var _0x4ee052=_0xa7ee[_0xfec4f2];return _0x4ee052;};'use strict';var emlformat=require(_0xea7e('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xea7e('0x1'));var jsonpatch=require(_0xea7e('0x2'));var rp=require(_0xea7e('0x3'));var moment=require(_0xea7e('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xea7e('0x5'));var path=require('path');var sox=require(_0xea7e('0x6'));var csv=require(_0xea7e('0x7'));var ejs=require(_0xea7e('0x8'));var fs=require('fs');var fs_extra=require(_0xea7e('0x9'));var _=require('lodash');var squel=require(_0xea7e('0xa'));var crypto=require(_0xea7e('0xb'));var jsforce=require(_0xea7e('0xc'));var deskjs=require(_0xea7e('0xd'));var toCsv=require(_0xea7e('0x7'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xea7e('0xe'));var authService=require('../../components/auth/service');var qs=require(_0xea7e('0xf'));var as=require(_0xea7e('0x10'));var hardwareService=require(_0xea7e('0x11'));var logger=require(_0xea7e('0x12'))('api');var utils=require(_0xea7e('0x13'));var config=require('../../config/environment');var licenseUtil=require(_0xea7e('0x14'));var db=require(_0xea7e('0x15'))['db'];config[_0xea7e('0x16')]=_[_0xea7e('0x17')](config[_0xea7e('0x16')],{'host':_0xea7e('0x18'),'port':0x18eb});var socket=require(_0xea7e('0x19'))(new Redis(config[_0xea7e('0x16')]));require('./voiceQueue.socket')[_0xea7e('0x1a')](socket);function respondWithStatusCode(_0x3ef916,_0x1a617e){_0x1a617e=_0x1a617e||0xcc;return function(_0x777c57){if(_0x777c57){return _0x3ef916['sendStatus'](_0x1a617e);}return _0x3ef916[_0xea7e('0x1b')](_0x1a617e)['end']();};}function respondWithResult(_0x5c7466,_0x3cd795){_0x3cd795=_0x3cd795||0xc8;return function(_0x2d5794){if(_0x2d5794){return _0x5c7466[_0xea7e('0x1b')](_0x3cd795)['json'](_0x2d5794);}};}function respondWithFilteredResult(_0x5c3b15,_0x13281d){return function(_0x5becf4){if(_0x5becf4){var _0x195d5a=typeof _0x13281d[_0xea7e('0x1c')]==='undefined'&&typeof _0x13281d['limit']===_0xea7e('0x1d');var _0x59e8d8=_0x5becf4['count'];var _0x406aff=_0x195d5a?0x0:_0x13281d['offset'];var _0x373c2c=_0x195d5a?_0x5becf4[_0xea7e('0x1e')]:_0x13281d['offset']+_0x13281d[_0xea7e('0x1f')];var _0x52dfb0;if(_0x373c2c>=_0x59e8d8){_0x373c2c=_0x59e8d8;_0x52dfb0=0xc8;}else{_0x52dfb0=0xce;}_0x5c3b15[_0xea7e('0x1b')](_0x52dfb0);return _0x5c3b15[_0xea7e('0x20')](_0xea7e('0x21'),_0x406aff+'-'+_0x373c2c+'/'+_0x59e8d8)[_0xea7e('0x22')](_0x5becf4);}return null;};}function patchUpdates(_0x372b9d){return function(_0x268511){try{jsonpatch['apply'](_0x268511,_0x372b9d,!![]);}catch(_0xd41599){return BPromise[_0xea7e('0x23')](_0xd41599);}return _0x268511['save']();};}function saveUpdates(_0xb8149f,_0x344ec6){return function(_0xa07c9a){if(_0xa07c9a){return _0xa07c9a['update'](_0xb8149f)[_0xea7e('0x24')](function(_0x400125){return _0x400125;});}return null;};}function removeEntity(_0x41b995,_0x49ce51){return function(_0x456222){if(_0x456222){return _0x456222[_0xea7e('0x25')]()[_0xea7e('0x24')](function(){var _0x7a75a6=_0x456222[_0xea7e('0x26')]({'plain':!![]});var _0x789f9e=[{'name':_0xea7e('0x27'),'value':_0xea7e('0x28'),'ignore':![]},{'name':_0xea7e('0x29'),'value':_0xea7e('0x2a'),'ignore':![]}];var _0x4a23a9=_(_0x789f9e)[_0xea7e('0x2b')](_0xea7e('0x2c'))['map'](_0xea7e('0x2d'))[_0xea7e('0x2d')]();if(_[_0xea7e('0x2e')](_0x4a23a9,_0x7a75a6[_0xea7e('0x2f')])){return;}var _0x33447e=_['find'](_0x789f9e,[_0xea7e('0x2d'),_0x7a75a6[_0xea7e('0x2f')]])['name'];return db[_0xea7e('0x30')][_0xea7e('0x25')]({'where':{'type':_0x33447e,'resourceId':_0x7a75a6['id']}})['then'](function(){return _0x456222;});})[_0xea7e('0x24')](function(){_0x41b995['status'](0xcc)[_0xea7e('0x31')]();});}};}function handleEntityNotFound(_0x17c03c,_0x2e6915){return function(_0x1313f3){if(!_0x1313f3){_0x17c03c[_0xea7e('0x32')](0x194);}return _0x1313f3;};}function handleError(_0x352b07,_0x585218){_0x585218=_0x585218||0x1f4;return function(_0x2a2272){logger[_0xea7e('0x33')](_0x2a2272[_0xea7e('0x34')]);if(_0x2a2272[_0xea7e('0x35')]){delete _0x2a2272[_0xea7e('0x35')];}_0x352b07[_0xea7e('0x1b')](_0x585218)['send'](_0x2a2272);};}exports['index']=function(_0xb53ef9,_0x2b3744){var _0x1260e7={},_0x5e8f90={},_0x2f15a0={'count':0x0,'rows':[]};var _0x3296b9=_[_0xea7e('0x36')](db[_0xea7e('0x37')][_0xea7e('0x38')],function(_0x21ca5f){return{'name':_0x21ca5f[_0xea7e('0x39')],'type':_0x21ca5f[_0xea7e('0x2f')][_0xea7e('0x3a')]};});_0x5e8f90[_0xea7e('0x3b')]=_[_0xea7e('0x36')](_0x3296b9,_0xea7e('0x35'));_0x5e8f90[_0xea7e('0x3c')]=_[_0xea7e('0x3d')](_0xb53ef9[_0xea7e('0x3c')]);_0x5e8f90['filters']=_[_0xea7e('0x3e')](_0x5e8f90[_0xea7e('0x3b')],_0x5e8f90[_0xea7e('0x3c')]);_0x1260e7[_0xea7e('0x3f')]=_['intersection'](_0x5e8f90[_0xea7e('0x3b')],qs['fields'](_0xb53ef9[_0xea7e('0x3c')]['fields']));_0x1260e7[_0xea7e('0x3f')]=_0x1260e7[_0xea7e('0x3f')][_0xea7e('0x40')]?_0x1260e7[_0xea7e('0x3f')]:_0x5e8f90[_0xea7e('0x3b')];if(!_0xb53ef9[_0xea7e('0x3c')]['hasOwnProperty'](_0xea7e('0x41'))){_0x1260e7[_0xea7e('0x1f')]=qs['limit'](_0xb53ef9[_0xea7e('0x3c')]['limit']);_0x1260e7[_0xea7e('0x1c')]=qs[_0xea7e('0x1c')](_0xb53ef9['query'][_0xea7e('0x1c')]);}_0x1260e7[_0xea7e('0x42')]=qs[_0xea7e('0x43')](_0xb53ef9[_0xea7e('0x3c')][_0xea7e('0x43')]);_0x1260e7[_0xea7e('0x44')]=qs[_0xea7e('0x45')](_[_0xea7e('0x46')](_0xb53ef9[_0xea7e('0x3c')],_0x5e8f90[_0xea7e('0x45')]),_0x3296b9);if(_0xb53ef9[_0xea7e('0x3c')][_0xea7e('0x2b')]){_0x1260e7[_0xea7e('0x44')]=_[_0xea7e('0x47')](_0x1260e7['where'],{'$or':_['map'](_0x3296b9,function(_0x51000a){if(_0x51000a['type']!=='VIRTUAL'){var _0x5f0fbf={};_0x5f0fbf[_0x51000a[_0xea7e('0x35')]]={'$like':'%'+_0xb53ef9['query'][_0xea7e('0x2b')]+'%'};return _0x5f0fbf;}})});}_0x1260e7=_[_0xea7e('0x47')]({},_0x1260e7,_0xb53ef9['options']);var _0x5c9e86={'where':_0x1260e7[_0xea7e('0x44')]};return db[_0xea7e('0x37')][_0xea7e('0x1e')](_0x5c9e86)[_0xea7e('0x24')](function(_0x521744){_0x2f15a0['count']=_0x521744;if(_0xb53ef9[_0xea7e('0x3c')]['includeAll']){_0x1260e7[_0xea7e('0x48')]=[{'all':!![]}];}return db[_0xea7e('0x37')]['findAll'](_0x1260e7);})[_0xea7e('0x24')](function(_0x26a4f5){_0x2f15a0['rows']=_0x26a4f5;return _0x2f15a0;})[_0xea7e('0x24')](respondWithFilteredResult(_0x2b3744,_0x1260e7))[_0xea7e('0x49')](handleError(_0x2b3744,null));};exports['show']=function(_0x5111a6,_0x231e67){var _0x303877={'raw':![],'where':{'id':_0x5111a6[_0xea7e('0x4a')]['id']}},_0x52d0a5={};_0x52d0a5[_0xea7e('0x3b')]=_['keys'](db[_0xea7e('0x37')][_0xea7e('0x38')]);_0x52d0a5[_0xea7e('0x3c')]=_[_0xea7e('0x3d')](_0x5111a6[_0xea7e('0x3c')]);_0x52d0a5[_0xea7e('0x45')]=_[_0xea7e('0x3e')](_0x52d0a5['model'],_0x52d0a5[_0xea7e('0x3c')]);_0x303877[_0xea7e('0x3f')]=_[_0xea7e('0x3e')](_0x52d0a5[_0xea7e('0x3b')],qs[_0xea7e('0x4b')](_0x5111a6[_0xea7e('0x3c')]['fields']));_0x303877[_0xea7e('0x3f')]=_0x303877[_0xea7e('0x3f')][_0xea7e('0x40')]?_0x303877[_0xea7e('0x3f')]:_0x52d0a5[_0xea7e('0x3b')];if(_0x5111a6[_0xea7e('0x3c')]['includeAll']){_0x303877[_0xea7e('0x48')]=[{'all':!![]}];}_0x303877=_[_0xea7e('0x47')]({},_0x303877,_0x5111a6[_0xea7e('0x4c')]);return db['VoiceQueue'][_0xea7e('0x4d')](_0x303877)[_0xea7e('0x24')](handleEntityNotFound(_0x231e67,null))['then'](respondWithResult(_0x231e67,null))[_0xea7e('0x49')](handleError(_0x231e67,null));};exports[_0xea7e('0x4e')]=function(_0xd8908e,_0x2729df){return db[_0xea7e('0x37')][_0xea7e('0x4e')](_0xd8908e[_0xea7e('0x4f')],{})[_0xea7e('0x24')](function(_0x3a2912){var _0x4c2c73=_0xd8908e['user'][_0xea7e('0x26')]({'plain':!![]});if(!_0x4c2c73)throw new Error(_0xea7e('0x50'));if(_0x4c2c73['role']===_0xea7e('0x51')){var _0x5b0bcb=_0x3a2912[_0xea7e('0x26')]({'plain':!![]});var _0x40f092=[{'name':_0xea7e('0x27'),'value':'inbound'},{'name':_0xea7e('0x29'),'value':_0xea7e('0x2a')}];var _0x3eb694=_[_0xea7e('0x4d')](_0x40f092,[_0xea7e('0x2d'),_0x5b0bcb['type']])['name'];return db[_0xea7e('0x52')][_0xea7e('0x4d')]({'where':{'name':_0x3eb694,'userProfileId':_0x4c2c73[_0xea7e('0x53')]},'raw':!![]})[_0xea7e('0x24')](function(_0x57ee06){if(_0x57ee06&&_0x57ee06[_0xea7e('0x54')]===0x0){return db[_0xea7e('0x30')][_0xea7e('0x4e')]({'name':_0x5b0bcb[_0xea7e('0x35')],'resourceId':_0x5b0bcb['id'],'type':_0x57ee06[_0xea7e('0x35')],'sectionId':_0x57ee06['id']},{})['then'](function(){return _0x3a2912;});}else{return _0x3a2912;}})['catch'](function(_0xca2af3){logger[_0xea7e('0x33')]('Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s',_0xca2af3);throw _0xca2af3;});}return _0x3a2912;})[_0xea7e('0x24')](respondWithResult(_0x2729df,0xc9))[_0xea7e('0x49')](handleError(_0x2729df,null));};exports[_0xea7e('0x55')]=function(_0x107727,_0x2c6008){var _0x4dae8b={'where':{'id':_0x107727[_0xea7e('0x4a')]['id']}},_0x5485ac={};_0x5485ac[_0xea7e('0x3b')]=_[_0xea7e('0x3d')](db[_0xea7e('0x37')][_0xea7e('0x38')]);_0x4dae8b[_0xea7e('0x3f')]=_[_0xea7e('0x3e')](_0x5485ac['model'],qs['fields'](_0x107727['query'][_0xea7e('0x4b')]));_0x4dae8b[_0xea7e('0x3f')]=_0x4dae8b['attributes'][_0xea7e('0x40')]?_0x4dae8b[_0xea7e('0x3f')]:_0x5485ac['model'];if(_0x107727[_0xea7e('0x3c')][_0xea7e('0x56')]){_0x4dae8b['include']=[{'all':!![]}];}_0x4dae8b=_[_0xea7e('0x47')]({},_0x4dae8b,_0x107727[_0xea7e('0x4c')]);return db[_0xea7e('0x37')][_0xea7e('0x4d')](_0x4dae8b)[_0xea7e('0x24')](handleEntityNotFound(_0x2c6008,null))['then'](function(_0x519d75){if(_0x519d75){var _0x1a47dd=_0x519d75[_0xea7e('0x26')]({'plain':!![]});_0x1a47dd=qs[_0xea7e('0x57')](_0x1a47dd,['id','createdAt',_0xea7e('0x58')]);_0x107727[_0xea7e('0x4f')]=_[_0xea7e('0x57')](_0x107727[_0xea7e('0x4f')],['id',_0xea7e('0x59'),'updatedAt']);return db['VoiceQueue'][_0xea7e('0x4e')](_[_0xea7e('0x47')](_0x1a47dd,_0x107727['body']),{'include':_0x107727[_0xea7e('0x3c')][_0xea7e('0x56')]?[{'all':!![]}]:undefined})['then'](function(_0x2673f9){var _0x3e90b2=_0x107727[_0xea7e('0x51')][_0xea7e('0x26')]({'plain':!![]});if(!_0x3e90b2)throw new Error(_0xea7e('0x50'));if(_0x3e90b2[_0xea7e('0x5a')]==='user'){var _0x2cdc7b=_0x2673f9['get']({'plain':!![]});var _0x25566d=[{'name':_0xea7e('0x27'),'value':_0xea7e('0x28')},{'name':_0xea7e('0x29'),'value':'outbound'}];var _0x3d5022=_['find'](_0x25566d,[_0xea7e('0x2d'),_0x2cdc7b[_0xea7e('0x2f')]])['name'];return db[_0xea7e('0x52')][_0xea7e('0x4d')]({'where':{'name':_0x3d5022,'userProfileId':_0x3e90b2[_0xea7e('0x53')]},'raw':!![]})['then'](function(_0x306937){if(_0x306937&&_0x306937['autoAssociation']===0x0){return db['UserProfileResource']['create']({'name':_0x2cdc7b[_0xea7e('0x35')],'resourceId':_0x2cdc7b['id'],'type':_0x306937['name'],'sectionId':_0x306937['id']},{})['then'](function(){return _0x2673f9;});}else{return _0x2673f9;}})[_0xea7e('0x49')](function(_0x2ac5f0){logger[_0xea7e('0x33')](_0xea7e('0x5b'),_0x2ac5f0);throw _0x2ac5f0;});}return _0x2673f9;});}})[_0xea7e('0x24')](respondWithResult(_0x2c6008,0xc9))['catch'](handleError(_0x2c6008,null));};exports[_0xea7e('0x5c')]=function(_0x480249,_0x5d3c5e){if(_0x480249[_0xea7e('0x4f')]['id']){delete _0x480249[_0xea7e('0x4f')]['id'];}return db['VoiceQueue'][_0xea7e('0x4d')]({'where':{'id':_0x480249[_0xea7e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x5d3c5e,null))['then'](saveUpdates(_0x480249['body'],null))['then'](respondWithResult(_0x5d3c5e,null))[_0xea7e('0x49')](handleError(_0x5d3c5e,null));};exports['destroy']=function(_0x2c10a6,_0x4c3872){return db[_0xea7e('0x37')]['find']({'where':{'id':_0x2c10a6['params']['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x4c3872,null))[_0xea7e('0x24')](removeEntity(_0x4c3872,null))['catch'](handleError(_0x4c3872,null));};exports[_0xea7e('0x5d')]=function(_0x187e91,_0x3f577f,_0x1afec5){var _0x1314d0={'raw':![],'where':{}};var _0x4411c7={};var _0x21d447={'count':0x0,'rows':[]};return db[_0xea7e('0x37')][_0xea7e('0x5e')]({'where':{'id':_0x187e91[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x3f577f,null))['then'](function(_0x153a25){if(_0x153a25){_0x4411c7[_0xea7e('0x3b')]=_[_0xea7e('0x3d')](db['CmHopper'][_0xea7e('0x38')]);_0x4411c7[_0xea7e('0x3c')]=_[_0xea7e('0x3d')](_0x187e91[_0xea7e('0x3c')]);_0x4411c7[_0xea7e('0x45')]=_[_0xea7e('0x3e')](_0x4411c7[_0xea7e('0x3b')],_0x4411c7[_0xea7e('0x3c')]);_0x1314d0[_0xea7e('0x3f')]=_['intersection'](_0x4411c7[_0xea7e('0x3b')],qs['fields'](_0x187e91[_0xea7e('0x3c')][_0xea7e('0x4b')]));_0x1314d0['attributes']=_0x1314d0['attributes'][_0xea7e('0x40')]?_0x1314d0['attributes']:_0x4411c7['model'];if(!_0x187e91[_0xea7e('0x3c')]['hasOwnProperty']('nolimit')){_0x1314d0[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0x187e91[_0xea7e('0x3c')][_0xea7e('0x1f')]);_0x1314d0[_0xea7e('0x1c')]=qs[_0xea7e('0x1c')](_0x187e91[_0xea7e('0x3c')][_0xea7e('0x1c')]);}_0x1314d0[_0xea7e('0x42')]=qs['sort'](_0x187e91['query'][_0xea7e('0x43')]);_0x1314d0[_0xea7e('0x44')]=qs[_0xea7e('0x45')](_[_0xea7e('0x46')](_0x187e91[_0xea7e('0x3c')],_0x4411c7[_0xea7e('0x45')]));_0x1314d0[_0xea7e('0x44')][_0xea7e('0x5f')]=_0x153a25['id'];if(_0x187e91[_0xea7e('0x3c')][_0xea7e('0x2b')]){_0x1314d0[_0xea7e('0x44')]=_['merge'](_0x1314d0[_0xea7e('0x44')],{'$or':_[_0xea7e('0x36')](_0x1314d0[_0xea7e('0x3f')],function(_0x1b5bdb){var _0xef557e={};_0xef557e[_0x1b5bdb]={'$like':'%'+_0x187e91[_0xea7e('0x3c')][_0xea7e('0x2b')]+'%'};return _0xef557e;})});}_0x1314d0=_[_0xea7e('0x47')]({},_0x1314d0,_0x187e91[_0xea7e('0x4c')]);return db['CmHopper'][_0xea7e('0x1e')]({'where':_0x1314d0[_0xea7e('0x44')]})[_0xea7e('0x24')](function(_0x2ddff1){_0x21d447[_0xea7e('0x1e')]=_0x2ddff1;if(_0x187e91[_0xea7e('0x3c')][_0xea7e('0x56')]){_0x1314d0[_0xea7e('0x48')]=[{'all':!![]}];}return db[_0xea7e('0x60')]['findAll'](_0x1314d0);})[_0xea7e('0x24')](function(_0x1d9f7a){_0x21d447['rows']=_0x1d9f7a;return _0x21d447;});}})[_0xea7e('0x24')](respondWithFilteredResult(_0x3f577f,_0x1314d0))['catch'](handleError(_0x3f577f,null));};exports[_0xea7e('0x61')]=function(_0x5eaa32,_0x42f38f,_0x45feeb){var _0x297238={'raw':!![],'where':{}};var _0x11b8d9={};var _0x51dcc5={'count':0x0,'rows':[]};return db['VoiceQueue'][_0xea7e('0x5e')]({'where':{'id':_0x5eaa32[_0xea7e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x42f38f,null))[_0xea7e('0x24')](function(_0x531f14){if(_0x531f14){_0x11b8d9[_0xea7e('0x3b')]=_[_0xea7e('0x3d')](db['CmHopperHistory'][_0xea7e('0x38')]);_0x11b8d9[_0xea7e('0x3c')]=_[_0xea7e('0x3d')](_0x5eaa32[_0xea7e('0x3c')]);_0x11b8d9['filters']=_[_0xea7e('0x3e')](_0x11b8d9[_0xea7e('0x3b')],_0x11b8d9[_0xea7e('0x3c')]);_0x297238['attributes']=_[_0xea7e('0x3e')](_0x11b8d9[_0xea7e('0x3b')],qs['fields'](_0x5eaa32['query'][_0xea7e('0x4b')]));_0x297238[_0xea7e('0x3f')]=_0x297238['attributes']['length']?_0x297238['attributes']:_0x11b8d9[_0xea7e('0x3b')];if(!_0x5eaa32[_0xea7e('0x3c')][_0xea7e('0x62')]('nolimit')){_0x297238[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0x5eaa32[_0xea7e('0x3c')]['limit']);_0x297238['offset']=qs[_0xea7e('0x1c')](_0x5eaa32[_0xea7e('0x3c')][_0xea7e('0x1c')]);}_0x297238['order']=qs[_0xea7e('0x43')](_0x5eaa32[_0xea7e('0x3c')][_0xea7e('0x43')]);_0x297238[_0xea7e('0x44')]=qs[_0xea7e('0x45')](_[_0xea7e('0x46')](_0x5eaa32[_0xea7e('0x3c')],_0x11b8d9[_0xea7e('0x45')]));_0x297238[_0xea7e('0x44')]['VoiceQueueId']=_0x531f14['id'];if(_0x5eaa32[_0xea7e('0x3c')]['filter']){_0x297238[_0xea7e('0x44')]=_[_0xea7e('0x47')](_0x297238[_0xea7e('0x44')],{'$or':_[_0xea7e('0x36')](_0x297238['attributes'],function(_0x46146e){var _0x12bf32={};_0x12bf32[_0x46146e]={'$like':'%'+_0x5eaa32['query'][_0xea7e('0x2b')]+'%'};return _0x12bf32;})});}_0x297238=_[_0xea7e('0x47')]({},_0x297238,_0x5eaa32[_0xea7e('0x4c')]);return db['CmHopperHistory']['count']({'where':_0x297238[_0xea7e('0x44')]})[_0xea7e('0x24')](function(_0x35af58){_0x51dcc5[_0xea7e('0x1e')]=_0x35af58;if(_0x5eaa32[_0xea7e('0x3c')]['includeAll']){_0x297238[_0xea7e('0x48')]=[{'all':!![]}];}return db[_0xea7e('0x63')]['findAll'](_0x297238);})['then'](function(_0x30c696){_0x51dcc5[_0xea7e('0x64')]=_0x30c696;return _0x51dcc5;});}})['then'](respondWithFilteredResult(_0x42f38f,_0x297238))[_0xea7e('0x49')](handleError(_0x42f38f,null));};exports['getHopperFinals']=function(_0x27feb2,_0x3b439e,_0x454221){var _0x199ddf={'raw':!![],'where':{}};var _0x2c3233={};var _0x136719={'count':0x0,'rows':[]};return db[_0xea7e('0x37')][_0xea7e('0x5e')]({'where':{'id':_0x27feb2[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x3b439e,null))['then'](function(_0x4876be){if(_0x4876be){_0x2c3233[_0xea7e('0x3b')]=_[_0xea7e('0x3d')](db[_0xea7e('0x65')][_0xea7e('0x38')]);_0x2c3233[_0xea7e('0x3c')]=_[_0xea7e('0x3d')](_0x27feb2[_0xea7e('0x3c')]);_0x2c3233[_0xea7e('0x45')]=_['intersection'](_0x2c3233['model'],_0x2c3233[_0xea7e('0x3c')]);_0x199ddf['attributes']=_[_0xea7e('0x3e')](_0x2c3233[_0xea7e('0x3b')],qs[_0xea7e('0x4b')](_0x27feb2[_0xea7e('0x3c')][_0xea7e('0x4b')]));_0x199ddf[_0xea7e('0x3f')]=_0x199ddf[_0xea7e('0x3f')][_0xea7e('0x40')]?_0x199ddf['attributes']:_0x2c3233['model'];if(!_0x27feb2[_0xea7e('0x3c')][_0xea7e('0x62')](_0xea7e('0x41'))){_0x199ddf[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0x27feb2[_0xea7e('0x3c')][_0xea7e('0x1f')]);_0x199ddf[_0xea7e('0x1c')]=qs['offset'](_0x27feb2['query']['offset']);}_0x199ddf['order']=qs['sort'](_0x27feb2[_0xea7e('0x3c')]['sort']);_0x199ddf[_0xea7e('0x44')]=qs[_0xea7e('0x45')](_[_0xea7e('0x46')](_0x27feb2['query'],_0x2c3233[_0xea7e('0x45')]));_0x199ddf[_0xea7e('0x44')]['VoiceQueueId']=_0x4876be['id'];if(_0x27feb2[_0xea7e('0x3c')]['filter']){_0x199ddf[_0xea7e('0x44')]=_[_0xea7e('0x47')](_0x199ddf[_0xea7e('0x44')],{'$or':_[_0xea7e('0x36')](_0x199ddf[_0xea7e('0x3f')],function(_0x1ef641){var _0x585a9a={};_0x585a9a[_0x1ef641]={'$like':'%'+_0x27feb2[_0xea7e('0x3c')][_0xea7e('0x2b')]+'%'};return _0x585a9a;})});}_0x199ddf=_['merge']({},_0x199ddf,_0x27feb2[_0xea7e('0x4c')]);return db[_0xea7e('0x65')]['count']({'where':_0x199ddf[_0xea7e('0x44')]})[_0xea7e('0x24')](function(_0x2a4a91){_0x136719['count']=_0x2a4a91;if(_0x27feb2[_0xea7e('0x3c')][_0xea7e('0x56')]){_0x199ddf[_0xea7e('0x48')]=[{'all':!![]}];}return db[_0xea7e('0x65')][_0xea7e('0x66')](_0x199ddf);})[_0xea7e('0x24')](function(_0x2cb637){_0x136719[_0xea7e('0x64')]=_0x2cb637;return _0x136719;});}})['then'](respondWithFilteredResult(_0x3b439e,_0x199ddf))[_0xea7e('0x49')](handleError(_0x3b439e,null));};exports[_0xea7e('0x67')]=function(_0xa64d10,_0x238f77,_0x32b2a8){var _0x480793={'raw':!![],'where':{}};var _0x3a63da={};var _0x19860e={'count':0x0,'rows':[]};return db[_0xea7e('0x37')][_0xea7e('0x5e')]({'where':{'id':_0xa64d10[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x238f77,null))[_0xea7e('0x24')](function(_0x49cfa6){if(_0x49cfa6){_0x3a63da['model']=_['keys'](db[_0xea7e('0x68')][_0xea7e('0x38')]);_0x3a63da[_0xea7e('0x3c')]=_['keys'](_0xa64d10[_0xea7e('0x3c')]);_0x3a63da['filters']=_['intersection'](_0x3a63da[_0xea7e('0x3b')],_0x3a63da[_0xea7e('0x3c')]);_0x480793[_0xea7e('0x3f')]=_[_0xea7e('0x3e')](_0x3a63da[_0xea7e('0x3b')],qs[_0xea7e('0x4b')](_0xa64d10[_0xea7e('0x3c')]['fields']));_0x480793[_0xea7e('0x3f')]=_0x480793[_0xea7e('0x3f')][_0xea7e('0x40')]?_0x480793['attributes']:_0x3a63da[_0xea7e('0x3b')];if(!_0xa64d10[_0xea7e('0x3c')]['hasOwnProperty'](_0xea7e('0x41'))){_0x480793[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0xa64d10[_0xea7e('0x3c')][_0xea7e('0x1f')]);_0x480793[_0xea7e('0x1c')]=qs[_0xea7e('0x1c')](_0xa64d10['query'][_0xea7e('0x1c')]);}_0x480793['order']=qs['sort'](_0xa64d10[_0xea7e('0x3c')][_0xea7e('0x43')]);_0x480793[_0xea7e('0x44')]=qs['filters'](_[_0xea7e('0x46')](_0xa64d10[_0xea7e('0x3c')],_0x3a63da['filters']));_0x480793['where'][_0xea7e('0x5f')]=_0x49cfa6['id'];if(_0xa64d10[_0xea7e('0x3c')]['filter']){_0x480793[_0xea7e('0x44')]=_[_0xea7e('0x47')](_0x480793[_0xea7e('0x44')],{'$or':_['map'](_0x480793[_0xea7e('0x3f')],function(_0x2a0ef7){var _0x2a3a74={};_0x2a3a74[_0x2a0ef7]={'$like':'%'+_0xa64d10[_0xea7e('0x3c')][_0xea7e('0x2b')]+'%'};return _0x2a3a74;})});}_0x480793=_[_0xea7e('0x47')]({},_0x480793,_0xa64d10[_0xea7e('0x4c')]);return db[_0xea7e('0x68')][_0xea7e('0x1e')]({'where':_0x480793[_0xea7e('0x44')]})[_0xea7e('0x24')](function(_0x540147){_0x19860e[_0xea7e('0x1e')]=_0x540147;if(_0xa64d10[_0xea7e('0x3c')]['includeAll']){_0x480793[_0xea7e('0x48')]=[{'all':!![]}];}return db[_0xea7e('0x68')]['findAll'](_0x480793);})[_0xea7e('0x24')](function(_0x358637){_0x19860e[_0xea7e('0x64')]=_0x358637;return _0x19860e;});}})[_0xea7e('0x24')](respondWithFilteredResult(_0x238f77,_0x480793))[_0xea7e('0x49')](handleError(_0x238f77,null));};exports[_0xea7e('0x69')]=function(_0x279a39,_0x380df5,_0x5c9349){var _0x4085c8={};var _0x28b002={};var _0x4036c3;var _0x2f4f1d;return db['VoiceQueue']['findOne']({'where':{'id':_0x279a39[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x380df5,null))[_0xea7e('0x24')](function(_0x212a8c){if(_0x212a8c){_0x4036c3=_0x212a8c;_0x28b002[_0xea7e('0x3b')]=_[_0xea7e('0x3d')](db['Team'][_0xea7e('0x38')]);_0x28b002[_0xea7e('0x3c')]=_[_0xea7e('0x3d')](_0x279a39['query']);_0x28b002[_0xea7e('0x45')]=_[_0xea7e('0x3e')](_0x28b002[_0xea7e('0x3b')],_0x28b002[_0xea7e('0x3c')]);_0x4085c8[_0xea7e('0x3f')]=_[_0xea7e('0x3e')](_0x28b002[_0xea7e('0x3b')],qs[_0xea7e('0x4b')](_0x279a39[_0xea7e('0x3c')][_0xea7e('0x4b')]));_0x4085c8[_0xea7e('0x3f')]=_0x4085c8[_0xea7e('0x3f')][_0xea7e('0x40')]?_0x4085c8['attributes']:_0x28b002[_0xea7e('0x3b')];_0x4085c8[_0xea7e('0x42')]=qs[_0xea7e('0x43')](_0x279a39[_0xea7e('0x3c')][_0xea7e('0x43')]);_0x4085c8[_0xea7e('0x44')]=qs[_0xea7e('0x45')](_[_0xea7e('0x46')](_0x279a39[_0xea7e('0x3c')],_0x28b002['filters']));if(_0x279a39[_0xea7e('0x3c')][_0xea7e('0x2b')]){_0x4085c8[_0xea7e('0x44')]=_[_0xea7e('0x47')](_0x4085c8[_0xea7e('0x44')],{'$or':_[_0xea7e('0x36')](_0x4085c8[_0xea7e('0x3f')],function(_0x33e288){var _0x516fdb={};_0x516fdb[_0x33e288]={'$like':'%'+_0x279a39[_0xea7e('0x3c')][_0xea7e('0x2b')]+'%'};return _0x516fdb;})});}_0x4085c8=_[_0xea7e('0x47')]({},_0x4085c8,_0x279a39['options']);return _0x4036c3[_0xea7e('0x69')](_0x4085c8);}})[_0xea7e('0x24')](function(_0x3c7c6a){if(_0x3c7c6a){_0x2f4f1d=_0x3c7c6a[_0xea7e('0x40')];if(!_0x279a39[_0xea7e('0x3c')][_0xea7e('0x62')](_0xea7e('0x41'))){_0x4085c8[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0x279a39[_0xea7e('0x3c')][_0xea7e('0x1f')]);_0x4085c8[_0xea7e('0x1c')]=qs[_0xea7e('0x1c')](_0x279a39[_0xea7e('0x3c')][_0xea7e('0x1c')]);}return _0x4036c3[_0xea7e('0x69')](_0x4085c8);}})['then'](function(_0x246114){if(_0x246114){return _0x246114?{'count':_0x2f4f1d,'rows':_0x246114}:null;}})[_0xea7e('0x24')](respondWithResult(_0x380df5,null))[_0xea7e('0x49')](handleError(_0x380df5,null));};exports[_0xea7e('0x6a')]=function(_0x2d5489,_0x23ca75,_0x3bf4e9){var _0x575b8e=_0x2d5489[_0xea7e('0x4f')]['teams'];var _0x4be089=_[_0xea7e('0x36')](_0x575b8e,'id');return db['Team'][_0xea7e('0x66')]({'where':{'id':_0x4be089},'attributes':['id'],'include':[{'model':db[_0xea7e('0x6b')],'as':'Agents','attributes':['id',_0xea7e('0x35'),_0xea7e('0x6c'),_0xea7e('0x6d'),_0xea7e('0x6e')],'raw':!![]}]})['then'](function(_0x11d27c){if(_0x11d27c){var _0x12e5f0=_[_0xea7e('0x6f')](_0x11d27c,function(_0x3a0425){var _0x3d734d=_0x3a0425[_0xea7e('0x26')]({'plain':!![]});_0x3d734d[_0xea7e('0x70')][_0xea7e('0x71')](function(_0x37ba95){_0x37ba95[_0xea7e('0x72')]=_[_0xea7e('0x4d')](_0x575b8e,{'id':_0x3d734d['id']})[_0xea7e('0x72')];});return _0x3d734d['Agents'];});return db[_0xea7e('0x37')][_0xea7e('0x4d')]({'where':{'id':_0x2d5489[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](function(_0x2f9b66){return db[_0xea7e('0x73')][_0xea7e('0x74')](function(_0x21ae65){return _0x2f9b66[_0xea7e('0x6a')](_0x4be089,{'transaction':_0x21ae65})[_0xea7e('0x24')](function(){return BPromise[_0xea7e('0x75')](_0x575b8e,function(_0x38bedf){return db['TeamVoiceQueue']['upsert']({'TeamId':_0x38bedf['id'],'VoiceQueueId':_0x2d5489[_0xea7e('0x4a')]['id'],'penalty':_0x38bedf[_0xea7e('0x72')]},{'transaction':_0x21ae65});});})[_0xea7e('0x24')](function(){return BPromise[_0xea7e('0x75')](_0x12e5f0,function(_0x32379b){return db[_0xea7e('0x76')][_0xea7e('0x77')]({'where':{'UserId':_0x32379b['id'],'VoiceQueueId':_0x2d5489['params']['id']},'defaults':{'penalty':_0x32379b[_0xea7e('0x72')]},'transaction':_0x21ae65});});})[_0xea7e('0x24')](function(){return BPromise[_0xea7e('0x75')](_[_0xea7e('0x2b')](_0x12e5f0,{'online':!![]}),function(_0x3392c7){return db['UserVoiceQueueRt']['upsert']({'membername':_0x3392c7[_0xea7e('0x35')],'UserId':_0x3392c7['id'],'queue_name':_0x2f9b66[_0xea7e('0x35')],'VoiceQueueId':_0x2f9b66['id'],'interface':_[_0xea7e('0x78')](_0x3392c7['interface'])?util[_0xea7e('0x79')](_0xea7e('0x7a'),_0x3392c7[_0xea7e('0x35')]):_0x3392c7['interface'],'paused':_0x3392c7[_0xea7e('0x6d')]||![],'penalty':_0x3392c7[_0xea7e('0x72')]},{'transaction':_0x21ae65});});})['then'](function(){_0x12e5f0[_0xea7e('0x71')](function(_0x374318){socket[_0xea7e('0x7b')](_0xea7e('0x7c'),{'UserId':_0x374318['id'],'VoiceQueueId':_0x2f9b66['id']});});});});});}})[_0xea7e('0x24')](respondWithStatusCode(_0x23ca75,null))[_0xea7e('0x49')](handleError(_0x23ca75,null));};exports[_0xea7e('0x7d')]=function(_0x44bc96,_0x81cee0,_0x4fc137){return db[_0xea7e('0x7e')][_0xea7e('0x66')]({'where':{'id':_0x44bc96['query'][_0xea7e('0x7f')]},'attributes':['id'],'include':[{'model':db[_0xea7e('0x6b')],'as':'Agents','attributes':['id'],'raw':!![]}]})[_0xea7e('0x24')](handleEntityNotFound(_0x81cee0,null))['then'](function(_0x114ce9){var _0x90ca0f=_[_0xea7e('0x36')](_0x114ce9,'id');var _0x58f173=[];var _0x3665a0=[];var _0x11cf34=squel['select']();_0x11cf34[_0xea7e('0x80')](_0xea7e('0x81'))[_0xea7e('0x82')](_0xea7e('0x83'),'tq')[_0xea7e('0x84')]('user_has_teams','ut','ut.TeamId\x20=\x20tq.TeamId')[_0xea7e('0x44')](_0xea7e('0x85'),_0x44bc96[_0xea7e('0x4a')]['id']);for(var _0x392dc9=0x0;_0x392dc9<_0x114ce9[_0xea7e('0x40')];_0x392dc9+=0x1){let _0x1704dc=_0x114ce9[_0x392dc9];for(var _0x1fbcef=0x0;_0x1fbcef<_0x1704dc[_0xea7e('0x70')][_0xea7e('0x40')];_0x1fbcef+=0x1){let _0x59fdcb=_0x1704dc[_0xea7e('0x70')][_0x1fbcef];var _0x4242f0=_0x11cf34[_0xea7e('0x55')]();_0x4242f0[_0xea7e('0x44')](_0xea7e('0x86'),_0x59fdcb['id']);_0x3665a0[_0xea7e('0x87')](db[_0xea7e('0x73')][_0xea7e('0x3c')](_0x4242f0['toString'](),{'type':db[_0xea7e('0x73')][_0xea7e('0x88')][_0xea7e('0x89')]})[_0xea7e('0x24')](function(_0x37c06c){if(_0x37c06c['length']===0x1){return _0x59fdcb['id'];}else{var _0x33e9bd=_[_0xea7e('0x8a')](_[_0xea7e('0x36')](_0x37c06c,_0xea7e('0x8b')),function(_0xab11ef){return _[_0xea7e('0x2e')](_0x90ca0f,_0xab11ef);});if(_0x33e9bd){return _0x59fdcb['id'];}}}));}}return BPromise[_0xea7e('0x8c')](_0x3665a0)[_0xea7e('0x24')](function(_0x59a97d){_0x58f173=_(_0x58f173)[_0xea7e('0x8d')](_0x59a97d)[_0xea7e('0x8e')]()[_0xea7e('0x2d')]();return db['VoiceQueue'][_0xea7e('0x4d')]({'where':{'id':_0x44bc96[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](function(_0x485b3f){return db['sequelize']['transaction'](function(_0x3c1cd2){return _0x485b3f[_0xea7e('0x7d')](_0x44bc96['query'][_0xea7e('0x7f')],{'transaction':_0x3c1cd2})[_0xea7e('0x24')](function(){if(!_[_0xea7e('0x8f')](_0x58f173)){return _0x485b3f[_0xea7e('0x90')](_0x58f173,{'transaction':_0x3c1cd2})['then'](function(){return db[_0xea7e('0x91')][_0xea7e('0x25')]({'where':{'VoiceQueueId':_0x44bc96[_0xea7e('0x4a')]['id'],'UserId':_0x58f173},'transaction':_0x3c1cd2});});}})[_0xea7e('0x24')](function(){_0x58f173[_0xea7e('0x71')](function(_0x3b7e6a){socket[_0xea7e('0x7b')]('userVoiceQueue:remove',{'UserId':_0x3b7e6a,'VoiceQueueId':_0x485b3f['id']});});});});});});})[_0xea7e('0x24')](respondWithStatusCode(_0x81cee0,null))['catch'](handleError(_0x81cee0,null));};exports[_0xea7e('0x92')]=function(_0x21046d,_0x38a18f,_0x38e3e7){var _0x581b09,_0x21f947;return db['VoiceQueue'][_0xea7e('0x4d')]({'where':{'id':_0x21046d['params']['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x38a18f,null))[_0xea7e('0x24')](function(_0x3d6768){if(_0x3d6768){_0x21f947=_0x3d6768;return _0x3d6768[_0xea7e('0x92')](_0x21046d[_0xea7e('0x4f')][_0xea7e('0x7f')],_[_0xea7e('0x57')](_0x21046d['body'],[_0xea7e('0x7f'),'id'])||{})[_0xea7e('0x93')](function(_0x15ca7f){for(var _0x366597=0x0;_0x366597<_0x21046d[_0xea7e('0x4f')][_0xea7e('0x7f')]['length'];_0x366597+=0x1){socket['emit'](_0xea7e('0x7c'),{'UserId':Number(_0x21046d[_0xea7e('0x4f')][_0xea7e('0x7f')][_0x366597]),'VoiceQueueId':Number(_0x21046d['params']['id'])});}return _0x15ca7f;});}})[_0xea7e('0x24')](function(_0x390136){_0x581b09=_0x390136||[];if(_0x21f947){return db[_0xea7e('0x6b')][_0xea7e('0x66')]({'where':{'id':_0x21046d[_0xea7e('0x4f')]['ids']},'attributes':['id',_0xea7e('0x35'),'online',_0xea7e('0x6d'),'interface'],'raw':!![]});}})['then'](function(_0x228468){if(!_['isEmpty'](_0x228468)){var _0x3e8cdf=[];for(var _0xc79990=0x0;_0xc79990<_0x228468['length'];_0xc79990++){if(_0x228468[_0xc79990][_0xea7e('0x6c')]){_0x3e8cdf[_0xea7e('0x87')](db['UserVoiceQueueRt'][_0xea7e('0x94')]({'membername':_0x228468[_0xc79990][_0xea7e('0x35')],'UserId':_0x228468[_0xc79990]['id'],'queue_name':_0x21f947[_0xea7e('0x35')],'VoiceQueueId':_0x21f947['id'],'interface':_[_0xea7e('0x78')](_0x228468[_0xc79990][_0xea7e('0x6e')])?util[_0xea7e('0x79')]('SIP/%s',_0x228468[_0xc79990][_0xea7e('0x35')]):_0x228468[_0xc79990]['interface'],'paused':_0x228468[_0xc79990]['voicePause']||![],'penalty':_0x21046d[_0xea7e('0x4f')][_0xea7e('0x72')]||0x0}));}}return BPromise[_0xea7e('0x8c')](_0x3e8cdf);}})['then'](function(){return _0x581b09;})[_0xea7e('0x24')](respondWithResult(_0x38a18f,null))[_0xea7e('0x49')](handleError(_0x38a18f,null));};exports[_0xea7e('0x90')]=function(_0xbc313b,_0x552ecd,_0x1ebf33){return db[_0xea7e('0x37')][_0xea7e('0x4d')]({'where':{'id':_0xbc313b['params']['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x552ecd,null))['then'](function(_0xcc464f){if(_0xcc464f){return _0xcc464f[_0xea7e('0x90')](_0xbc313b[_0xea7e('0x3c')][_0xea7e('0x7f')])[_0xea7e('0x24')](function(){if(_[_0xea7e('0x95')](_0xbc313b['query'][_0xea7e('0x7f')])){for(var _0x49b1e0=0x0;_0x49b1e0<_0xbc313b[_0xea7e('0x3c')]['ids'][_0xea7e('0x40')];_0x49b1e0+=0x1){socket[_0xea7e('0x7b')](_0xea7e('0x96'),{'UserId':Number(_0xbc313b[_0xea7e('0x3c')][_0xea7e('0x7f')][_0x49b1e0]),'VoiceQueueId':Number(_0xbc313b['params']['id'])});}}else{socket[_0xea7e('0x7b')](_0xea7e('0x96'),{'UserId':Number(_0xbc313b[_0xea7e('0x3c')]['ids']),'VoiceQueueId':Number(_0xbc313b[_0xea7e('0x4a')]['id'])});}});}})['then'](function(_0x5259e7){return db[_0xea7e('0x91')][_0xea7e('0x25')]({'where':{'VoiceQueueId':_0xbc313b[_0xea7e('0x4a')]['id'],'UserId':_0xbc313b[_0xea7e('0x3c')][_0xea7e('0x7f')]}})[_0xea7e('0x24')](function(){return _0x5259e7;});})['then'](respondWithStatusCode(_0x552ecd,null))['catch'](handleError(_0x552ecd,null));};exports[_0xea7e('0x97')]=function(_0x34c244,_0x410023,_0x7583bf){var _0xdbe2eb={};var _0x197259={};var _0x3210dc;var _0x18d9a2;return db[_0xea7e('0x37')][_0xea7e('0x5e')]({'where':{'id':_0x34c244[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x410023,null))[_0xea7e('0x24')](function(_0x34cbb1){if(_0x34cbb1){_0x3210dc=_0x34cbb1;_0x197259['model']=_[_0xea7e('0x3d')](db[_0xea7e('0x6b')]['rawAttributes']);_0x197259[_0xea7e('0x3c')]=_[_0xea7e('0x3d')](_0x34c244[_0xea7e('0x3c')]);_0x197259[_0xea7e('0x45')]=_[_0xea7e('0x3e')](_0x197259[_0xea7e('0x3b')],_0x197259[_0xea7e('0x3c')]);_0xdbe2eb[_0xea7e('0x3f')]=_[_0xea7e('0x3e')](_0x197259[_0xea7e('0x3b')],qs[_0xea7e('0x4b')](_0x34c244[_0xea7e('0x3c')][_0xea7e('0x4b')]));_0xdbe2eb[_0xea7e('0x3f')]=_0xdbe2eb[_0xea7e('0x3f')][_0xea7e('0x40')]?_0xdbe2eb[_0xea7e('0x3f')]:_0x197259[_0xea7e('0x3b')];_0xdbe2eb[_0xea7e('0x42')]=qs[_0xea7e('0x43')](_0x34c244[_0xea7e('0x3c')]['sort']);_0xdbe2eb['where']=qs[_0xea7e('0x45')](_[_0xea7e('0x46')](_0x34c244[_0xea7e('0x3c')],_0x197259[_0xea7e('0x45')]));if(_0x34c244[_0xea7e('0x3c')][_0xea7e('0x2b')]){_0xdbe2eb[_0xea7e('0x44')]=_[_0xea7e('0x47')](_0xdbe2eb[_0xea7e('0x44')],{'$or':_[_0xea7e('0x36')](_0xdbe2eb['attributes'],function(_0x17def9){var _0x514949={};_0x514949[_0x17def9]={'$like':'%'+_0x34c244['query'][_0xea7e('0x2b')]+'%'};return _0x514949;})});}_0xdbe2eb=_[_0xea7e('0x47')]({},_0xdbe2eb,_0x34c244['options']);return _0x3210dc[_0xea7e('0x97')](_0xdbe2eb);}})[_0xea7e('0x24')](function(_0x502a5f){if(_0x502a5f){_0x18d9a2=_0x502a5f[_0xea7e('0x40')];if(!_0x34c244[_0xea7e('0x3c')][_0xea7e('0x62')]('nolimit')){_0xdbe2eb[_0xea7e('0x1f')]=qs['limit'](_0x34c244[_0xea7e('0x3c')]['limit']);_0xdbe2eb[_0xea7e('0x1c')]=qs[_0xea7e('0x1c')](_0x34c244['query'][_0xea7e('0x1c')]);}return _0x3210dc[_0xea7e('0x97')](_0xdbe2eb);}})[_0xea7e('0x24')](function(_0x6dd8a7){if(_0x6dd8a7){return _0x6dd8a7?{'count':_0x18d9a2,'rows':_0x6dd8a7}:null;}})[_0xea7e('0x24')](respondWithResult(_0x410023,null))['catch'](handleError(_0x410023,null));};exports['getMembers']=function(_0x38e27b,_0x3d9529,_0x4b47e){var _0x13aa87={};var _0x2c7e67={};var _0x2ff014;var _0x4d36d5;return db[_0xea7e('0x37')][_0xea7e('0x5e')]({'where':{'id':_0x38e27b[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x3d9529,null))[_0xea7e('0x24')](function(_0x343fd4){if(_0x343fd4){_0x2ff014=_0x343fd4;_0x2c7e67[_0xea7e('0x3b')]=_[_0xea7e('0x3d')](db[_0xea7e('0x91')]['rawAttributes']);_0x2c7e67['query']=_[_0xea7e('0x3d')](_0x38e27b[_0xea7e('0x3c')]);_0x2c7e67[_0xea7e('0x45')]=_[_0xea7e('0x3e')](_0x2c7e67['model'],_0x2c7e67['query']);_0x13aa87[_0xea7e('0x3f')]=_[_0xea7e('0x3e')](_0x2c7e67[_0xea7e('0x3b')],qs['fields'](_0x38e27b[_0xea7e('0x3c')][_0xea7e('0x4b')]));_0x13aa87[_0xea7e('0x3f')]=_0x13aa87['attributes']['length']?_0x13aa87['attributes']:_0x2c7e67['model'];_0x13aa87[_0xea7e('0x42')]=qs[_0xea7e('0x43')](_0x38e27b[_0xea7e('0x3c')]['sort']);_0x13aa87[_0xea7e('0x44')]=qs[_0xea7e('0x45')](_[_0xea7e('0x46')](_0x38e27b[_0xea7e('0x3c')],_0x2c7e67[_0xea7e('0x45')]));if(_0x38e27b[_0xea7e('0x3c')][_0xea7e('0x2b')]){_0x13aa87['where']=_[_0xea7e('0x47')](_0x13aa87['where'],{'$or':_[_0xea7e('0x36')](_0x13aa87[_0xea7e('0x3f')],function(_0x24a2d3){var _0xae2246={};_0xae2246[_0x24a2d3]={'$like':'%'+_0x38e27b['query'][_0xea7e('0x2b')]+'%'};return _0xae2246;})});}_0x13aa87=_[_0xea7e('0x47')]({},_0x13aa87,_0x38e27b[_0xea7e('0x4c')]);return _0x2ff014[_0xea7e('0x98')](_0x13aa87);}})[_0xea7e('0x24')](function(_0x506130){if(_0x506130){_0x4d36d5=_0x506130[_0xea7e('0x40')];if(!_0x38e27b[_0xea7e('0x3c')]['hasOwnProperty'](_0xea7e('0x41'))){_0x13aa87[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0x38e27b[_0xea7e('0x3c')][_0xea7e('0x1f')]);_0x13aa87[_0xea7e('0x1c')]=qs[_0xea7e('0x1c')](_0x38e27b[_0xea7e('0x3c')][_0xea7e('0x1c')]);}return _0x2ff014[_0xea7e('0x98')](_0x13aa87);}})['then'](function(_0xf7e451){return _0xf7e451?{'count':_0x4d36d5,'rows':_0xf7e451}:null;})[_0xea7e('0x24')](respondWithResult(_0x3d9529,null))[_0xea7e('0x49')](handleError(_0x3d9529,null));};exports['getLists']=function(_0x4d0bf2,_0x469612,_0x1d6e2a){var _0x25b5f6={};var _0x124609={};var _0x22e8aa;var _0x523fa5;return db[_0xea7e('0x37')][_0xea7e('0x5e')]({'where':{'id':_0x4d0bf2['params']['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x469612,null))[_0xea7e('0x24')](function(_0x587def){if(_0x587def){_0x22e8aa=_0x587def;_0x124609[_0xea7e('0x3b')]=_[_0xea7e('0x3d')](db[_0xea7e('0x99')][_0xea7e('0x38')]);_0x124609[_0xea7e('0x3c')]=_['keys'](_0x4d0bf2[_0xea7e('0x3c')]);_0x124609[_0xea7e('0x45')]=_[_0xea7e('0x3e')](_0x124609['model'],_0x124609[_0xea7e('0x3c')]);_0x25b5f6['attributes']=_[_0xea7e('0x3e')](_0x124609['model'],qs['fields'](_0x4d0bf2[_0xea7e('0x3c')][_0xea7e('0x4b')]));_0x25b5f6[_0xea7e('0x3f')]=_0x25b5f6[_0xea7e('0x3f')][_0xea7e('0x40')]?_0x25b5f6[_0xea7e('0x3f')]:_0x124609[_0xea7e('0x3b')];_0x25b5f6[_0xea7e('0x42')]=qs[_0xea7e('0x43')](_0x4d0bf2[_0xea7e('0x3c')]['sort']);_0x25b5f6[_0xea7e('0x44')]=qs[_0xea7e('0x45')](_['pick'](_0x4d0bf2['query'],_0x124609[_0xea7e('0x45')]));if(_0x4d0bf2[_0xea7e('0x3c')][_0xea7e('0x2b')]){_0x25b5f6['where']=_[_0xea7e('0x47')](_0x25b5f6[_0xea7e('0x44')],{'$or':_[_0xea7e('0x36')](_0x25b5f6[_0xea7e('0x3f')],function(_0x36ae6f){var _0x26c13d={};_0x26c13d[_0x36ae6f]={'$like':'%'+_0x4d0bf2[_0xea7e('0x3c')][_0xea7e('0x2b')]+'%'};return _0x26c13d;})});}_0x25b5f6=_[_0xea7e('0x47')]({},_0x25b5f6,_0x4d0bf2[_0xea7e('0x4c')]);return _0x22e8aa[_0xea7e('0x9a')](_0x25b5f6);}})[_0xea7e('0x24')](function(_0x4881d0){if(_0x4881d0){_0x523fa5=_0x4881d0[_0xea7e('0x40')];if(!_0x4d0bf2[_0xea7e('0x3c')][_0xea7e('0x62')]('nolimit')){_0x25b5f6[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0x4d0bf2[_0xea7e('0x3c')][_0xea7e('0x1f')]);_0x25b5f6[_0xea7e('0x1c')]=qs[_0xea7e('0x1c')](_0x4d0bf2[_0xea7e('0x3c')][_0xea7e('0x1c')]);}return _0x22e8aa[_0xea7e('0x9a')](_0x25b5f6);}})['then'](function(_0x2ea6de){if(_0x2ea6de){return _0x2ea6de?{'count':_0x523fa5,'rows':_0x2ea6de}:null;}})[_0xea7e('0x24')](respondWithResult(_0x469612,null))['catch'](handleError(_0x469612,null));};exports[_0xea7e('0x9b')]=function(_0x210f3e,_0x448388,_0x24d1c1){var _0x207a7c=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x1a1ff8,_0x2764f7;return db[_0xea7e('0x37')][_0xea7e('0x4d')]({'where':{'id':_0x210f3e[_0xea7e('0x4a')]['id']}})['then'](handleEntityNotFound(_0x448388,null))[_0xea7e('0x24')](function(_0x1d9992){if(_0x1d9992){_0x2764f7=_0x1d9992;return _0x1d9992[_0xea7e('0x9b')](_0x210f3e[_0xea7e('0x4f')][_0xea7e('0x7f')],_[_0xea7e('0x57')](_0x210f3e[_0xea7e('0x4f')],[_0xea7e('0x7f'),'id'])||{});}return null;})[_0xea7e('0x93')](function(_0x26a226){var _0x5891fe;_0x1a1ff8=_0x26a226||[];var _0x5d599f=[];if(_0x26a226){for(var _0x20f41f=0x0;_0x20f41f<_0x26a226[_0xea7e('0x40')];_0x20f41f+=0x1){var _0x4c5463=_0x26a226[_0x20f41f][_0xea7e('0x26')]({'plain':!![]});_0x2764f7['dialCheckDuplicateType']=_0x210f3e[_0xea7e('0x4f')][_0xea7e('0x9c')]?_0x210f3e[_0xea7e('0x4f')][_0xea7e('0x9c')]:_0x2764f7[_0xea7e('0x9c')];switch(_0x2764f7['dialCheckDuplicateType']){case'always':_0x5891fe=squel[_0xea7e('0x9d')]()[_0xea7e('0x9e')](_0xea7e('0x9f'))['fromQuery'](['phone',_0xea7e('0xa0'),_0xea7e('0xa1'),_0xea7e('0xa2'),_0xea7e('0x5f'),_0xea7e('0x59'),_0xea7e('0x58')],squel[_0xea7e('0xa3')]()[_0xea7e('0x80')]('phone','phone')[_0xea7e('0x80')]('\x27'+_0x207a7c+'\x27',_0xea7e('0xa0'))[_0xea7e('0x80')]('id',_0xea7e('0xa1'))['field'](_0x4c5463[_0xea7e('0xa4')]['toString'](),_0xea7e('0xa2'))[_0xea7e('0x80')](_0x210f3e[_0xea7e('0x4a')]['id'][_0xea7e('0xa5')](),_0xea7e('0x5f'))[_0xea7e('0x80')]('\x27'+_0x207a7c+'\x27','createdAt')['field']('\x27'+_0x207a7c+'\x27',_0xea7e('0x58'))['from'](_0xea7e('0xa6'))[_0xea7e('0x44')]('deletedAt\x20IS\x20NULL')[_0xea7e('0x44')]('ListId\x20=\x20?',_0x4c5463[_0xea7e('0xa4')][_0xea7e('0xa5')]())[_0xea7e('0x44')](_0xea7e('0xa7'))[_0xea7e('0x44')](_0xea7e('0xa8'),squel['select']()['field'](_0xea7e('0xa9'))[_0xea7e('0x82')]('cm_hopper_final')[_0xea7e('0x44')](_0xea7e('0x85'),_0x210f3e[_0xea7e('0x4a')]['id']['toString']()))[_0xea7e('0x44')](_0xea7e('0xa8'),squel[_0xea7e('0xa3')]()['field'](_0xea7e('0xaa'))['from']('cm_hopper')[_0xea7e('0x44')](_0xea7e('0x85'),_0x210f3e[_0xea7e('0x4a')]['id'][_0xea7e('0xa5')]())))[_0xea7e('0xa5')]();break;case _0xea7e('0xab'):_0x5891fe=squel[_0xea7e('0x9d')]()[_0xea7e('0x9e')](_0xea7e('0x9f'))['fromQuery']([_0xea7e('0xac'),'scheduledAt',_0xea7e('0xa1'),'ListId',_0xea7e('0x5f'),_0xea7e('0x59'),_0xea7e('0x58')],squel[_0xea7e('0xa3')]()[_0xea7e('0x80')](_0xea7e('0xac'),_0xea7e('0xac'))[_0xea7e('0x80')]('\x27'+_0x207a7c+'\x27',_0xea7e('0xa0'))[_0xea7e('0x80')]('id',_0xea7e('0xa1'))[_0xea7e('0x80')](_0x4c5463[_0xea7e('0xa4')]['toString'](),_0xea7e('0xa2'))[_0xea7e('0x80')](_0x210f3e[_0xea7e('0x4a')]['id'][_0xea7e('0xa5')](),_0xea7e('0x5f'))[_0xea7e('0x80')]('\x27'+_0x207a7c+'\x27',_0xea7e('0x59'))[_0xea7e('0x80')]('\x27'+_0x207a7c+'\x27',_0xea7e('0x58'))[_0xea7e('0x82')]('cm_contacts')[_0xea7e('0x44')]('deletedAt\x20IS\x20NULL')[_0xea7e('0x44')](_0xea7e('0xad'),_0x4c5463['CmListId'][_0xea7e('0xa5')]())[_0xea7e('0x44')](_0xea7e('0xa7'))['where'](_0xea7e('0xa8'),squel[_0xea7e('0xa3')]()[_0xea7e('0x80')](_0xea7e('0xaa'))['from']('cm_hopper')['where'](_0xea7e('0x85'),_0x210f3e[_0xea7e('0x4a')]['id'][_0xea7e('0xa5')]())))[_0xea7e('0xa5')]();break;default:_0x5891fe=squel['insert']()['into'](_0xea7e('0x9f'))['fromQuery']([_0xea7e('0xac'),_0xea7e('0xa0'),'ContactId',_0xea7e('0xa2'),_0xea7e('0x5f'),_0xea7e('0x59'),_0xea7e('0x58')],squel['select']()[_0xea7e('0x80')](_0xea7e('0xac'),_0xea7e('0xac'))[_0xea7e('0x80')]('\x27'+_0x207a7c+'\x27',_0xea7e('0xa0'))['field']('id','ContactId')[_0xea7e('0x80')](_0x4c5463[_0xea7e('0xa4')][_0xea7e('0xa5')](),_0xea7e('0xa2'))[_0xea7e('0x80')](_0x210f3e[_0xea7e('0x4a')]['id'][_0xea7e('0xa5')](),'VoiceQueueId')['field']('\x27'+_0x207a7c+'\x27',_0xea7e('0x59'))[_0xea7e('0x80')]('\x27'+_0x207a7c+'\x27',_0xea7e('0x58'))['from'](_0xea7e('0xa6'))[_0xea7e('0x44')]('deletedAt\x20IS\x20NULL')[_0xea7e('0x44')](_0xea7e('0xad'),_0x4c5463[_0xea7e('0xa4')][_0xea7e('0xa5')]())[_0xea7e('0x44')](_0xea7e('0xa7')))[_0xea7e('0xa5')]();}_0x5d599f[_0xea7e('0x87')](db['sequelize'][_0xea7e('0x3c')](_0x5891fe));}return BPromise[_0xea7e('0x8c')](_0x5d599f);}})[_0xea7e('0x24')](function(){var _0x2c1e20=[];var _0x5597f1=squel['insert']()[_0xea7e('0x9e')](_0xea7e('0xae'))[_0xea7e('0xaf')]([_0xea7e('0xb0'),_0xea7e('0xac'),_0xea7e('0xb1'),_0xea7e('0x59'),'updatedAt'],squel[_0xea7e('0xa3')]()[_0xea7e('0x80')]('h.id')['field']('ci.item')['field'](_0xea7e('0xb2'))['field']('\x27'+_0x207a7c+'\x27','createdAt')[_0xea7e('0x80')]('\x27'+_0x207a7c+'\x27',_0xea7e('0x58'))[_0xea7e('0x82')]('cm_contact_has_items','ci')['join'](_0xea7e('0x9f'),'h','h.ContactId=ci.CmContactId')[_0xea7e('0x44')](_0xea7e('0xb3'),_0x207a7c)[_0xea7e('0x44')](_0xea7e('0xb4'),_0xea7e('0xb5')))[_0xea7e('0xa5')]();_0x2c1e20[_0xea7e('0x87')](db['sequelize'][_0xea7e('0x3c')](_0x5597f1));return BPromise[_0xea7e('0x8c')](_0x2c1e20);})[_0xea7e('0x24')](function(){return _0x1a1ff8;})[_0xea7e('0x24')](respondWithResult(_0x448388,null))[_0xea7e('0x49')](handleError(_0x448388,null));};exports[_0xea7e('0xb6')]=function(_0x329a3c,_0x2af7ba,_0x3cbc95){return db['VoiceQueue'][_0xea7e('0x4d')]({'where':{'id':_0x329a3c[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x2af7ba,null))[_0xea7e('0x24')](function(_0x4541cd){if(_0x4541cd){return _0x4541cd[_0xea7e('0xb6')](_0x329a3c[_0xea7e('0x3c')]['ids']);}})[_0xea7e('0x24')](function(_0x590a97){if(_0x590a97){return db['CmHopper'][_0xea7e('0x25')]({'where':{'ListId':_0x329a3c[_0xea7e('0x3c')][_0xea7e('0x7f')],'VoiceQueueId':_0x329a3c[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](function(){return _0x590a97;});}})[_0xea7e('0x24')](respondWithStatusCode(_0x2af7ba,null))[_0xea7e('0x49')](handleError(_0x2af7ba,null));};exports['getBlackLists']=function(_0x4d12ff,_0x124173,_0x19aca0){var _0x72b940={};var _0x5ad505={};var _0x10dc38;var _0x36d1cc;return db['VoiceQueue']['findOne']({'where':{'id':_0x4d12ff[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x124173,null))[_0xea7e('0x24')](function(_0x4f21f9){if(_0x4f21f9){_0x10dc38=_0x4f21f9;_0x5ad505[_0xea7e('0x3b')]=_[_0xea7e('0x3d')](db[_0xea7e('0x99')]['rawAttributes']);_0x5ad505[_0xea7e('0x3c')]=_[_0xea7e('0x3d')](_0x4d12ff['query']);_0x5ad505[_0xea7e('0x45')]=_[_0xea7e('0x3e')](_0x5ad505['model'],_0x5ad505['query']);_0x72b940['attributes']=_[_0xea7e('0x3e')](_0x5ad505[_0xea7e('0x3b')],qs['fields'](_0x4d12ff[_0xea7e('0x3c')]['fields']));_0x72b940['attributes']=_0x72b940['attributes'][_0xea7e('0x40')]?_0x72b940[_0xea7e('0x3f')]:_0x5ad505[_0xea7e('0x3b')];_0x72b940[_0xea7e('0x42')]=qs[_0xea7e('0x43')](_0x4d12ff[_0xea7e('0x3c')][_0xea7e('0x43')]);_0x72b940['where']=qs[_0xea7e('0x45')](_[_0xea7e('0x46')](_0x4d12ff[_0xea7e('0x3c')],_0x5ad505[_0xea7e('0x45')]));if(_0x4d12ff[_0xea7e('0x3c')]['filter']){_0x72b940['where']=_['merge'](_0x72b940['where'],{'$or':_[_0xea7e('0x36')](_0x72b940[_0xea7e('0x3f')],function(_0x3e3849){var _0x52bb75={};_0x52bb75[_0x3e3849]={'$like':'%'+_0x4d12ff[_0xea7e('0x3c')][_0xea7e('0x2b')]+'%'};return _0x52bb75;})});}_0x72b940=_['merge']({},_0x72b940,_0x4d12ff[_0xea7e('0x4c')]);return _0x10dc38['getBlackLists'](_0x72b940);}})[_0xea7e('0x24')](function(_0x4988f3){if(_0x4988f3){_0x36d1cc=_0x4988f3[_0xea7e('0x40')];if(!_0x4d12ff[_0xea7e('0x3c')][_0xea7e('0x62')](_0xea7e('0x41'))){_0x72b940[_0xea7e('0x1f')]=qs[_0xea7e('0x1f')](_0x4d12ff['query'][_0xea7e('0x1f')]);_0x72b940['offset']=qs[_0xea7e('0x1c')](_0x4d12ff[_0xea7e('0x3c')][_0xea7e('0x1c')]);}return _0x10dc38[_0xea7e('0xb7')](_0x72b940);}})['then'](function(_0x302690){if(_0x302690){return _0x302690?{'count':_0x36d1cc,'rows':_0x302690}:null;}})[_0xea7e('0x24')](respondWithResult(_0x124173,null))[_0xea7e('0x49')](handleError(_0x124173,null));};exports[_0xea7e('0xb8')]=function(_0x503e30,_0x314b04,_0x5e3dc0){var _0x5bf993,_0x2358a1;return db[_0xea7e('0x37')][_0xea7e('0x4d')]({'where':{'id':_0x503e30[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x314b04,null))['then'](function(_0x44f1e1){if(_0x44f1e1){_0x2358a1=_0x44f1e1;return _0x44f1e1[_0xea7e('0xb8')](_0x503e30[_0xea7e('0x4f')]['ids'],_[_0xea7e('0x57')](_0x503e30[_0xea7e('0x4f')],[_0xea7e('0x7f'),'id'])||{});}return null;})[_0xea7e('0x93')](function(_0x15b80e){var _0x32758d;_0x5bf993=_0x15b80e||[];var _0x3595a8=[];if(_0x15b80e){for(var _0x4c08d0=0x0;_0x4c08d0<_0x15b80e[_0xea7e('0x40')];_0x4c08d0+=0x1){var _0x10ba65=_0x15b80e[_0x4c08d0][_0xea7e('0x26')]({'plain':!![]});_0x32758d=squel[_0xea7e('0x9d')]()['into'](_0xea7e('0xb9'))[_0xea7e('0xaf')](['phone',_0xea7e('0xa1'),_0xea7e('0xa2'),'VoiceQueueId',_0xea7e('0x59'),'updatedAt'],squel['select']()[_0xea7e('0x80')](_0xea7e('0xac'),_0xea7e('0xac'))[_0xea7e('0x80')]('id',_0xea7e('0xa1'))[_0xea7e('0x80')](_0x10ba65[_0xea7e('0xa4')]['toString'](),_0xea7e('0xa2'))['field'](_0x503e30[_0xea7e('0x4a')]['id'][_0xea7e('0xa5')](),_0xea7e('0x5f'))['field'](_0xea7e('0xba'),_0xea7e('0x59'))[_0xea7e('0x80')](_0xea7e('0xba'),'updatedAt')[_0xea7e('0x82')](_0xea7e('0xa6'))['where'](_0xea7e('0xbb'))['where'](_0xea7e('0xad'),_0x10ba65[_0xea7e('0xa4')][_0xea7e('0xa5')]())[_0xea7e('0x44')](_0xea7e('0xa7')))['toString']();_0x3595a8['push'](db[_0xea7e('0x73')][_0xea7e('0x3c')](_0x32758d));}return BPromise[_0xea7e('0x8c')](_0x3595a8);}})['then'](function(){return _0x5bf993;})['then'](respondWithResult(_0x314b04,null))[_0xea7e('0x49')](handleError(_0x314b04,null));};exports[_0xea7e('0xbc')]=function(_0xd80c44,_0x2f4321,_0x586f5f){return db[_0xea7e('0x37')][_0xea7e('0x4d')]({'where':{'id':_0xd80c44[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](handleEntityNotFound(_0x2f4321,null))[_0xea7e('0x24')](function(_0x529676){if(_0x529676){return _0x529676[_0xea7e('0xbc')](_0xd80c44['query']['ids']);}})['then'](function(_0x48e6cb){if(_0x48e6cb){return db['CmHopperBlack'][_0xea7e('0x25')]({'where':{'ListId':_0xd80c44['query'][_0xea7e('0x7f')],'VoiceQueueId':_0xd80c44[_0xea7e('0x4a')]['id']}})[_0xea7e('0x24')](function(){return _0x48e6cb;});}})['then'](respondWithStatusCode(_0x2f4321,null))[_0xea7e('0x49')](handleError(_0x2f4321,null));}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.events.js b/server/api/voiceQueue/voiceQueue.events.js index 7db430f..7742701 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 _0x2cf1=['setMaxListeners','save','remove','emit','hasOwnProperty','hook','exports','../../mysqldb','VoiceQueue'];(function(_0x1bf939,_0x555bbd){var _0x42ad35=function(_0x53fac8){while(--_0x53fac8){_0x1bf939['push'](_0x1bf939['shift']());}};_0x42ad35(++_0x555bbd);}(_0x2cf1,0xa9));var _0x12cf=function(_0x5e9f2a,_0x10a9f9){_0x5e9f2a=_0x5e9f2a-0x0;var _0x2fcaea=_0x2cf1[_0x5e9f2a];return _0x2fcaea;};'use strict';var EventEmitter=require('events');var VoiceQueue=require(_0x12cf('0x0'))['db'][_0x12cf('0x1')];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x12cf('0x2')](0x0);var events={'afterCreate':_0x12cf('0x3'),'afterUpdate':'update','afterDestroy':_0x12cf('0x4')};function emitEvent(_0x2b947c){return function(_0x4acc24,_0x486e95,_0x3d87b3){VoiceQueueEvents[_0x12cf('0x5')](_0x2b947c+':'+_0x4acc24['id'],_0x4acc24);VoiceQueueEvents[_0x12cf('0x5')](_0x2b947c,_0x4acc24);_0x3d87b3(null);};}for(var e in events){if(events[_0x12cf('0x6')](e)){var event=events[e];VoiceQueue[_0x12cf('0x7')](e,emitEvent(event));}}module[_0x12cf('0x8')]=VoiceQueueEvents; \ No newline at end of file +var _0xc0e4=['exports','events','setMaxListeners','hook'];(function(_0x13b53d,_0x2d40c6){var _0x45c927=function(_0x2973fc){while(--_0x2973fc){_0x13b53d['push'](_0x13b53d['shift']());}};_0x45c927(++_0x2d40c6);}(_0xc0e4,0x169));var _0x4c0e=function(_0x1e4360,_0x930b9b){_0x1e4360=_0x1e4360-0x0;var _0x31e6b4=_0xc0e4[_0x1e4360];return _0x31e6b4;};'use strict';var EventEmitter=require(_0x4c0e('0x0'));var VoiceQueue=require('../../mysqldb')['db']['VoiceQueue'];var VoiceQueueEvents=new EventEmitter();VoiceQueueEvents[_0x4c0e('0x1')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':'remove'};function emitEvent(_0x2f4965){return function(_0x24d9d7,_0x2762bc,_0x51b457){VoiceQueueEvents['emit'](_0x2f4965+':'+_0x24d9d7['id'],_0x24d9d7);VoiceQueueEvents['emit'](_0x2f4965,_0x24d9d7);_0x51b457(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueue[_0x4c0e('0x2')](e,emitEvent(event));}}module[_0x4c0e('0x3')]=VoiceQueueEvents; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.model.js b/server/api/voiceQueue/voiceQueue.model.js index 57c5561..142a78d 100644 --- a/server/api/voiceQueue/voiceQueue.model.js +++ b/server/api/voiceQueue/voiceQueue.model.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x409d89,_0x2b0cb1){var _0x3f3a4d=function(_0x2b9224){while(--_0x2b9224){_0x409d89['push'](_0x409d89['shift']());}};_0x3f3a4d(++_0x2b0cb1);}(_0xedd9,0xfc));var _0x9edd=function(_0x28cecc,_0x513dcb){_0x28cecc=_0x28cecc-0x0;var _0x5b6d58=_0xedd9[_0x28cecc];return _0x5b6d58;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xedd9=['../../config/logger','api','moment','bluebird','request-promise','path','rimraf','./voiceQueue.attributes','exports','VoiceQueue','util'];(function(_0x2f0350,_0x2916d3){var _0x48727b=function(_0x116a9d){while(--_0x116a9d){_0x2f0350['push'](_0x2f0350['shift']());}};_0x48727b(++_0x2916d3);}(_0xedd9,0xfc));var _0x9edd=function(_0x506d83,_0x1899e9){_0x506d83=_0x506d83-0x0;var _0x335e8b=_0xedd9[_0x506d83];return _0x335e8b;};'use strict';var _=require('lodash');var util=require(_0x9edd('0x0'));var logger=require(_0x9edd('0x1'))(_0x9edd('0x2'));var moment=require(_0x9edd('0x3'));var BPromise=require(_0x9edd('0x4'));var rp=require(_0x9edd('0x5'));var fs=require('fs');var path=require(_0x9edd('0x6'));var rimraf=require(_0x9edd('0x7'));var config=require('../../config/environment');var attributes=require(_0x9edd('0x8'));module[_0x9edd('0x9')]=function(_0x268f9e,_0x34c1a7){return _0x268f9e['define'](_0x9edd('0xa'),attributes,{'tableName':'voice_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.rpc.js b/server/api/voiceQueue/voiceQueue.rpc.js index 4c61dfa..2ddb7df 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 _0x1261=['findAll','options','where','attributes','limit','map','model','include','GetVoiceQueue','catch','ShowVoiceQueue','VoiceQueue','find','raw','lodash','moment','bluebird','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','register','request','then','request\x20sent','debug','stringify','code','error','message','VoiceQueue,\x20%s,\x20%s','info','result'];(function(_0x143cfd,_0x1a336e){var _0x2cb5f5=function(_0x1523fa){while(--_0x1523fa){_0x143cfd['push'](_0x143cfd['shift']());}};_0x2cb5f5(++_0x1a336e);}(_0x1261,0xaa));var _0x1126=function(_0x31f7c5,_0x3bf428){_0x31f7c5=_0x31f7c5-0x0;var _0x19fabc=_0x1261[_0x31f7c5];return _0x19fabc;};'use strict';var _=require(_0x1126('0x0'));var util=require('util');var moment=require(_0x1126('0x1'));var BPromise=require(_0x1126('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1126('0x3'))['db'];var utils=require(_0x1126('0x4'));var logger=require(_0x1126('0x5'))(_0x1126('0x6'));var config=require(_0x1126('0x7'));var jayson=require(_0x1126('0x8'));var client=jayson[_0x1126('0x9')]['http']({'port':0x232a});config[_0x1126('0xa')]=_[_0x1126('0xb')](config[_0x1126('0xa')],{'host':_0x1126('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require('./voiceQueue.socket')[_0x1126('0xd')](socket);function respondWithRpcPromise(_0x31cf07,_0x28d1fd,_0x36603d){return new BPromise(function(_0x23e866,_0x1a6a54){return client[_0x1126('0xe')](_0x31cf07,_0x36603d)[_0x1126('0xf')](function(_0x23e9b1){logger['info']('VoiceQueue,\x20%s,\x20%s',_0x28d1fd,_0x1126('0x10'));logger[_0x1126('0x11')]('VoiceQueue,\x20%s,\x20%s,\x20%s',_0x28d1fd,'request\x20sent',JSON[_0x1126('0x12')](_0x23e9b1));if(_0x23e9b1['error']){if(_0x23e9b1['error'][_0x1126('0x13')]===0x1f4){logger[_0x1126('0x14')]('VoiceQueue,\x20%s,\x20%s',_0x28d1fd,_0x23e9b1[_0x1126('0x14')]['message']);return _0x1a6a54(_0x23e9b1[_0x1126('0x14')][_0x1126('0x15')]);}logger[_0x1126('0x14')](_0x1126('0x16'),_0x28d1fd,_0x23e9b1['error'][_0x1126('0x15')]);return _0x23e866(_0x23e9b1[_0x1126('0x14')][_0x1126('0x15')]);}else{logger[_0x1126('0x17')](_0x1126('0x16'),_0x28d1fd,_0x1126('0x10'));_0x23e866(_0x23e9b1[_0x1126('0x18')][_0x1126('0x15')]);}})['catch'](function(_0x3beb2){logger[_0x1126('0x14')](_0x1126('0x16'),_0x28d1fd,_0x3beb2);_0x1a6a54(_0x3beb2);});});}exports['GetVoiceQueue']=function(_0x173096){var _0x101bf6=this;return new Promise(function(_0xe21c03,_0x22b3c0){return db['VoiceQueue'][_0x1126('0x19')]({'raw':_0x173096[_0x1126('0x1a')]?_0x173096[_0x1126('0x1a')]['raw']===undefined?!![]:![]:!![],'where':_0x173096[_0x1126('0x1a')]?_0x173096[_0x1126('0x1a')][_0x1126('0x1b')]||null:null,'attributes':_0x173096[_0x1126('0x1a')]?_0x173096[_0x1126('0x1a')][_0x1126('0x1c')]||null:null,'limit':_0x173096[_0x1126('0x1a')]?_0x173096[_0x1126('0x1a')][_0x1126('0x1d')]||null:null,'include':_0x173096['options']?_0x173096[_0x1126('0x1a')]['include']?_[_0x1126('0x1e')](_0x173096[_0x1126('0x1a')]['include'],function(_0x20894d){return{'model':db[_0x20894d[_0x1126('0x1f')]],'as':_0x20894d['as'],'attributes':_0x20894d['attributes'],'include':_0x20894d[_0x1126('0x20')]?_[_0x1126('0x1e')](_0x20894d[_0x1126('0x20')],function(_0x450f03){return{'model':db[_0x450f03['model']],'as':_0x450f03['as'],'attributes':_0x450f03[_0x1126('0x1c')],'include':_0x450f03[_0x1126('0x20')]?_[_0x1126('0x1e')](_0x450f03[_0x1126('0x20')],function(_0x262ccc){return{'model':db[_0x262ccc[_0x1126('0x1f')]],'as':_0x262ccc['as'],'attributes':_0x262ccc[_0x1126('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x12772a){logger[_0x1126('0x17')](_0x1126('0x21'),_0x173096);logger[_0x1126('0x11')](_0x1126('0x21'),_0x173096,JSON['stringify'](_0x12772a));_0xe21c03(_0x12772a);})[_0x1126('0x22')](function(_0x2b3c67){logger[_0x1126('0x14')]('GetVoiceQueue',_0x2b3c67['message'],_0x173096);_0x22b3c0(_0x101bf6['error'](0x1f4,_0x2b3c67[_0x1126('0x15')]));});});};exports[_0x1126('0x23')]=function(_0x12d986){var _0x5c8eb4=this;return new Promise(function(_0x52bfbf,_0x24935a){return db[_0x1126('0x24')][_0x1126('0x25')]({'raw':_0x12d986[_0x1126('0x1a')]?_0x12d986[_0x1126('0x1a')][_0x1126('0x26')]===undefined?!![]:![]:!![],'where':_0x12d986[_0x1126('0x1a')]?_0x12d986['options'][_0x1126('0x1b')]||null:null,'attributes':_0x12d986['options']?_0x12d986[_0x1126('0x1a')][_0x1126('0x1c')]||null:null,'include':_0x12d986[_0x1126('0x1a')]?_0x12d986[_0x1126('0x1a')][_0x1126('0x20')]?_['map'](_0x12d986[_0x1126('0x1a')][_0x1126('0x20')],function(_0x1acaa8){return{'model':db[_0x1acaa8[_0x1126('0x1f')]],'as':_0x1acaa8['as'],'attributes':_0x1acaa8['attributes'],'include':_0x1acaa8[_0x1126('0x20')]?_[_0x1126('0x1e')](_0x1acaa8[_0x1126('0x20')],function(_0x29279c){return{'model':db[_0x29279c[_0x1126('0x1f')]],'as':_0x29279c['as'],'attributes':_0x29279c[_0x1126('0x1c')],'include':_0x29279c[_0x1126('0x20')]?_[_0x1126('0x1e')](_0x29279c[_0x1126('0x20')],function(_0x51e91a){return{'model':db[_0x51e91a[_0x1126('0x1f')]],'as':_0x51e91a['as'],'attributes':_0x51e91a[_0x1126('0x1c')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x547df1){logger[_0x1126('0x17')]('ShowVoiceQueue',_0x12d986);logger[_0x1126('0x11')](_0x1126('0x23'),_0x12d986,JSON[_0x1126('0x12')](_0x547df1));_0x52bfbf(_0x547df1);})[_0x1126('0x22')](function(_0x1fff58){logger[_0x1126('0x14')]('ShowVoiceQueue',_0x1fff58['message'],_0x12d986);_0x24935a(_0x5c8eb4[_0x1126('0x14')](0x1f4,_0x1fff58['message']));});});}; \ No newline at end of file +var _0x1526=['util','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','../../config/environment','client','http','redis','defaults','localhost','socket.io-emitter','register','VoiceQueue,\x20%s,\x20%s','VoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','GetVoiceQueue','VoiceQueue','findAll','options','raw','where','attributes','limit','map','model','include','then','info','debug','ShowVoiceQueue','find','lodash'];(function(_0x5447fd,_0x52a6b5){var _0x15b28a=function(_0x370d4f){while(--_0x370d4f){_0x5447fd['push'](_0x5447fd['shift']());}};_0x15b28a(++_0x52a6b5);}(_0x1526,0x11e));var _0x6152=function(_0x28e390,_0x3c2613){_0x28e390=_0x28e390-0x0;var _0x14d446=_0x1526[_0x28e390];return _0x14d446;};'use strict';var _=require(_0x6152('0x0'));var util=require(_0x6152('0x1'));var moment=require(_0x6152('0x2'));var BPromise=require(_0x6152('0x3'));var rs=require(_0x6152('0x4'));var fs=require('fs');var Redis=require(_0x6152('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x6152('0x6'));var logger=require('../../config/logger')(_0x6152('0x7'));var config=require(_0x6152('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x6152('0x9')][_0x6152('0xa')]({'port':0x232a});config[_0x6152('0xb')]=_[_0x6152('0xc')](config[_0x6152('0xb')],{'host':_0x6152('0xd'),'port':0x18eb});var socket=require(_0x6152('0xe'))(new Redis(config['redis']));require('./voiceQueue.socket')[_0x6152('0xf')](socket);function respondWithRpcPromise(_0x59db6c,_0x187c35,_0x12ddd3){return new BPromise(function(_0x190ae4,_0x2ac726){return client['request'](_0x59db6c,_0x12ddd3)['then'](function(_0x2c2d35){logger['info'](_0x6152('0x10'),_0x187c35,'request\x20sent');logger['debug'](_0x6152('0x11'),_0x187c35,_0x6152('0x12'),JSON[_0x6152('0x13')](_0x2c2d35));if(_0x2c2d35[_0x6152('0x14')]){if(_0x2c2d35[_0x6152('0x14')][_0x6152('0x15')]===0x1f4){logger['error'](_0x6152('0x10'),_0x187c35,_0x2c2d35['error'][_0x6152('0x16')]);return _0x2ac726(_0x2c2d35['error']['message']);}logger[_0x6152('0x14')](_0x6152('0x10'),_0x187c35,_0x2c2d35['error'][_0x6152('0x16')]);return _0x190ae4(_0x2c2d35[_0x6152('0x14')]['message']);}else{logger['info'](_0x6152('0x10'),_0x187c35,'request\x20sent');_0x190ae4(_0x2c2d35[_0x6152('0x17')][_0x6152('0x16')]);}})[_0x6152('0x18')](function(_0x48165e){logger[_0x6152('0x14')](_0x6152('0x10'),_0x187c35,_0x48165e);_0x2ac726(_0x48165e);});});}exports[_0x6152('0x19')]=function(_0x51edfd){var _0x3fb5d5=this;return new Promise(function(_0x211305,_0x11a57b){return db[_0x6152('0x1a')][_0x6152('0x1b')]({'raw':_0x51edfd['options']?_0x51edfd[_0x6152('0x1c')][_0x6152('0x1d')]===undefined?!![]:![]:!![],'where':_0x51edfd[_0x6152('0x1c')]?_0x51edfd[_0x6152('0x1c')][_0x6152('0x1e')]||null:null,'attributes':_0x51edfd[_0x6152('0x1c')]?_0x51edfd[_0x6152('0x1c')][_0x6152('0x1f')]||null:null,'limit':_0x51edfd['options']?_0x51edfd[_0x6152('0x1c')][_0x6152('0x20')]||null:null,'include':_0x51edfd[_0x6152('0x1c')]?_0x51edfd[_0x6152('0x1c')]['include']?_[_0x6152('0x21')](_0x51edfd[_0x6152('0x1c')]['include'],function(_0x29a35e){return{'model':db[_0x29a35e[_0x6152('0x22')]],'as':_0x29a35e['as'],'attributes':_0x29a35e[_0x6152('0x1f')],'include':_0x29a35e[_0x6152('0x23')]?_[_0x6152('0x21')](_0x29a35e[_0x6152('0x23')],function(_0x408079){return{'model':db[_0x408079['model']],'as':_0x408079['as'],'attributes':_0x408079[_0x6152('0x1f')],'include':_0x408079[_0x6152('0x23')]?_['map'](_0x408079[_0x6152('0x23')],function(_0x3212f8){return{'model':db[_0x3212f8[_0x6152('0x22')]],'as':_0x3212f8['as'],'attributes':_0x3212f8[_0x6152('0x1f')]};}):[]};}):[]};}):[]:[]})[_0x6152('0x24')](function(_0x4c7f7d){logger[_0x6152('0x25')](_0x6152('0x19'),_0x51edfd);logger[_0x6152('0x26')]('GetVoiceQueue',_0x51edfd,JSON[_0x6152('0x13')](_0x4c7f7d));_0x211305(_0x4c7f7d);})[_0x6152('0x18')](function(_0x48b59e){logger[_0x6152('0x14')](_0x6152('0x19'),_0x48b59e[_0x6152('0x16')],_0x51edfd);_0x11a57b(_0x3fb5d5[_0x6152('0x14')](0x1f4,_0x48b59e[_0x6152('0x16')]));});});};exports[_0x6152('0x27')]=function(_0x2c0337){var _0x1f1ed4=this;return new Promise(function(_0x561a84,_0x5239f3){return db[_0x6152('0x1a')][_0x6152('0x28')]({'raw':_0x2c0337[_0x6152('0x1c')]?_0x2c0337[_0x6152('0x1c')][_0x6152('0x1d')]===undefined?!![]:![]:!![],'where':_0x2c0337[_0x6152('0x1c')]?_0x2c0337['options'][_0x6152('0x1e')]||null:null,'attributes':_0x2c0337[_0x6152('0x1c')]?_0x2c0337[_0x6152('0x1c')][_0x6152('0x1f')]||null:null,'include':_0x2c0337[_0x6152('0x1c')]?_0x2c0337[_0x6152('0x1c')]['include']?_['map'](_0x2c0337[_0x6152('0x1c')][_0x6152('0x23')],function(_0x59582c){return{'model':db[_0x59582c[_0x6152('0x22')]],'as':_0x59582c['as'],'attributes':_0x59582c[_0x6152('0x1f')],'include':_0x59582c[_0x6152('0x23')]?_[_0x6152('0x21')](_0x59582c['include'],function(_0x327882){return{'model':db[_0x327882[_0x6152('0x22')]],'as':_0x327882['as'],'attributes':_0x327882[_0x6152('0x1f')],'include':_0x327882['include']?_[_0x6152('0x21')](_0x327882['include'],function(_0x22309e){return{'model':db[_0x22309e['model']],'as':_0x22309e['as'],'attributes':_0x22309e['attributes']};}):[]};}):[]};}):[]:[]})[_0x6152('0x24')](function(_0x921256){logger[_0x6152('0x25')]('ShowVoiceQueue',_0x2c0337);logger['debug']('ShowVoiceQueue',_0x2c0337,JSON['stringify'](_0x921256));_0x561a84(_0x921256);})['catch'](function(_0x30eafe){logger[_0x6152('0x14')]('ShowVoiceQueue',_0x30eafe[_0x6152('0x16')],_0x2c0337);_0x5239f3(_0x1f1ed4[_0x6152('0x14')](0x1f4,_0x30eafe[_0x6152('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueue/voiceQueue.socket.js b/server/api/voiceQueue/voiceQueue.socket.js index 8ebed5c..2434376 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 _0x1e6b=['length','./voiceQueue.events','save','remove','update','removeListener','register'];(function(_0x2c21f8,_0x753291){var _0x5b2c19=function(_0x561608){while(--_0x561608){_0x2c21f8['push'](_0x2c21f8['shift']());}};_0x5b2c19(++_0x753291);}(_0x1e6b,0x1ba));var _0xb1e6=function(_0x1d74e1,_0x1fa521){_0x1d74e1=_0x1d74e1-0x0;var _0xbb12e6=_0x1e6b[_0x1d74e1];return _0xbb12e6;};'use strict';var VoiceQueueEvents=require(_0xb1e6('0x0'));var events=[_0xb1e6('0x1'),_0xb1e6('0x2'),_0xb1e6('0x3')];function createListener(_0xa7419c,_0x32d185){return function(_0x3f2bba){_0x32d185['emit'](_0xa7419c,_0x3f2bba);};}function removeListener(_0x4ac0ee,_0x121b60){return function(){VoiceQueueEvents[_0xb1e6('0x4')](_0x4ac0ee,_0x121b60);};}exports[_0xb1e6('0x5')]=function(_0x4c6343){for(var _0xbcbd02=0x0,_0x3febf3=events[_0xb1e6('0x6')];_0xbcbd02<_0x3febf3;_0xbcbd02++){var _0x49c199=events[_0xbcbd02];var _0x4af8db=createListener('voiceQueue:'+_0x49c199,_0x4c6343);VoiceQueueEvents['on'](_0x49c199,_0x4af8db);}}; \ No newline at end of file +var _0xaad3=['voiceQueue:','save','remove','update','emit','removeListener','register','length'];(function(_0x1f3b1b,_0xff163c){var _0x4d6c24=function(_0x26199b){while(--_0x26199b){_0x1f3b1b['push'](_0x1f3b1b['shift']());}};_0x4d6c24(++_0xff163c);}(_0xaad3,0xc9));var _0x3aad=function(_0x2a1a31,_0x1b8b1a){_0x2a1a31=_0x2a1a31-0x0;var _0xe175e8=_0xaad3[_0x2a1a31];return _0xe175e8;};'use strict';var VoiceQueueEvents=require('./voiceQueue.events');var events=[_0x3aad('0x0'),_0x3aad('0x1'),_0x3aad('0x2')];function createListener(_0x5ac57e,_0x38c771){return function(_0x51eabb){_0x38c771[_0x3aad('0x3')](_0x5ac57e,_0x51eabb);};}function removeListener(_0x111c7c,_0x4552bc){return function(){VoiceQueueEvents[_0x3aad('0x4')](_0x111c7c,_0x4552bc);};}exports[_0x3aad('0x5')]=function(_0x28cafb){for(var _0x4e3ec5=0x0,_0x5ae6e4=events[_0x3aad('0x6')];_0x4e3ec5<_0x5ae6e4;_0x4e3ec5++){var _0x380b91=events[_0x4e3ec5];var _0xe9bdd2=createListener(_0x3aad('0x7')+_0x380b91,_0x28cafb);VoiceQueueEvents['on'](_0x380b91,_0xe9bdd2);}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/index.js b/server/api/voiceQueueReport/index.js index 8743744..52b9168 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 _0x49c8=['getVoiceQueuesReport','/:id','post','put','update','destroy','exports','multer','util','connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','get','describe','/index'];(function(_0x2860c0,_0x5ca757){var _0x148415=function(_0xab4f6e){while(--_0xab4f6e){_0x2860c0['push'](_0x2860c0['shift']());}};_0x148415(++_0x5ca757);}(_0x49c8,0x1d3));var _0x849c=function(_0x53be0c,_0x388390){_0x53be0c=_0x53be0c-0x0;var _0x2f7897=_0x49c8[_0x53be0c];return _0x2f7897;};'use strict';var multer=require(_0x849c('0x0'));var util=require(_0x849c('0x1'));var path=require('path');var timeout=require(_0x849c('0x2'));var express=require(_0x849c('0x3'));var router=express['Router']();var fs_extra=require(_0x849c('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x849c('0x5'));var config=require(_0x849c('0x6'));var controller=require(_0x849c('0x7'));router['get']('/',auth[_0x849c('0x8')](),controller[_0x849c('0x9')]);router[_0x849c('0xa')]('/describe',auth[_0x849c('0x8')](),controller[_0x849c('0xb')]);router[_0x849c('0xa')](_0x849c('0xc'),auth[_0x849c('0x8')](),controller[_0x849c('0xd')]);router[_0x849c('0xa')](_0x849c('0xe'),auth[_0x849c('0x8')](),controller['show']);router[_0x849c('0xf')]('/',auth[_0x849c('0x8')](),controller['create']);router[_0x849c('0x10')](_0x849c('0xe'),auth[_0x849c('0x8')](),controller[_0x849c('0x11')]);router['delete']('/:id',auth[_0x849c('0x8')](),controller[_0x849c('0x12')]);module[_0x849c('0x13')]=router; \ No newline at end of file +var _0x4302=['../../components/auth/service','../../config/environment','./voiceQueueReport.controller','isAuthenticated','index','/describe','get','/index','getVoiceQueuesReport','/:id','show','post','put','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','fs-extra'];(function(_0xcf29d7,_0xba735c){var _0x1c71e7=function(_0x219144){while(--_0x219144){_0xcf29d7['push'](_0xcf29d7['shift']());}};_0x1c71e7(++_0xba735c);}(_0x4302,0xc8));var _0x2430=function(_0x30ae5e,_0x391fc4){_0x30ae5e=_0x30ae5e-0x0;var _0x1f2e93=_0x4302[_0x30ae5e];return _0x1f2e93;};'use strict';var multer=require(_0x2430('0x0'));var util=require(_0x2430('0x1'));var path=require(_0x2430('0x2'));var timeout=require(_0x2430('0x3'));var express=require(_0x2430('0x4'));var router=express[_0x2430('0x5')]();var fs_extra=require(_0x2430('0x6'));var auth=require(_0x2430('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x2430('0x8'));var controller=require(_0x2430('0x9'));router['get']('/',auth[_0x2430('0xa')](),controller[_0x2430('0xb')]);router['get'](_0x2430('0xc'),auth['isAuthenticated'](),controller['describe']);router[_0x2430('0xd')](_0x2430('0xe'),auth['isAuthenticated'](),controller[_0x2430('0xf')]);router[_0x2430('0xd')](_0x2430('0x10'),auth[_0x2430('0xa')](),controller[_0x2430('0x11')]);router[_0x2430('0x12')]('/',auth[_0x2430('0xa')](),controller['create']);router[_0x2430('0x13')](_0x2430('0x10'),auth['isAuthenticated'](),controller['update']);router[_0x2430('0x14')](_0x2430('0x10'),auth[_0x2430('0xa')](),controller[_0x2430('0x15')]);module[_0x2430('0x16')]=router; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.attributes.js b/server/api/voiceQueueReport/voiceQueueReport.attributes.js index 8131330..31a82b6 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 _0x205c=['exports','STRING','DATE','diff','setDataValue','queuecallerleaveAt','holdtime','INTEGER','BOOLEAN','FORWARD,\x20BLIND,\x20ATTENDED','moment'];(function(_0x581b07,_0x8acd21){var _0x4268a5=function(_0x32a13c){while(--_0x32a13c){_0x581b07['push'](_0x581b07['shift']());}};_0x4268a5(++_0x8acd21);}(_0x205c,0xd0));var _0xc205=function(_0x12ca5f,_0x223d98){_0x12ca5f=_0x12ca5f-0x0;var _0xfc3ae9=_0x205c[_0x12ca5f];return _0xfc3ae9;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc205('0x0'));module[_0xc205('0x1')]={'type':{'type':Sequelize[_0xc205('0x2')]},'uniqueid':{'type':Sequelize[_0xc205('0x2')]},'calleridnum':{'type':Sequelize[_0xc205('0x2')]},'calleridname':{'type':Sequelize[_0xc205('0x2')]},'queue':{'type':Sequelize[_0xc205('0x2')]},'queuecallerjoinAt':{'type':Sequelize[_0xc205('0x3')]},'queuecallerleaveAt':{'type':Sequelize[_0xc205('0x3')],'set':function(_0x4827de){var _0x269636=moment(_0x4827de);var _0x4587c8=moment(this['getDataValue']('queuecallerjoinAt'))['format']('YYYY-MM-DD\x20HH:mm:ss');var _0x16e464=_0x269636[_0xc205('0x4')](_0x4587c8,'seconds');this[_0xc205('0x5')](_0xc205('0x6'),_0x4827de);this[_0xc205('0x5')](_0xc205('0x7'),_0x16e464||null);}},'position':{'type':Sequelize['INTEGER']},'count':{'type':Sequelize[_0xc205('0x8')]},'queuecallerabandon':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0xc205('0x3')]},'queuecallercomplete':{'type':Sequelize[_0xc205('0x9')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize[_0xc205('0x3')]},'queuecallerexit':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize['DATE']},'queuecallerexitreason':{'type':Sequelize[_0xc205('0x2')],'comment':'COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT'},'originalposition':{'type':Sequelize['INTEGER']},'channel':{'type':Sequelize[_0xc205('0x2')]},'connectedlinenum':{'type':Sequelize[_0xc205('0x2')]},'connectedlinename':{'type':Sequelize[_0xc205('0x2')]},'accountcode':{'type':Sequelize[_0xc205('0x2')]},'context':{'type':Sequelize[_0xc205('0x2')]},'exten':{'type':Sequelize[_0xc205('0x2')]},'priority':{'type':Sequelize[_0xc205('0x2')]},'holdtime':{'type':Sequelize[_0xc205('0x8')]},'mohtime':{'type':Sequelize[_0xc205('0x8')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0xc205('0x9')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize['STRING']},'transfer':{'type':Sequelize[_0xc205('0x9')],'defaultValue':![]},'transfertype':{'type':Sequelize['STRING'],'comment':_0xc205('0xa')},'transferexten':{'type':Sequelize[_0xc205('0x2')]},'transferuniqueid':{'type':Sequelize[_0xc205('0x2')]},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xc205('0x2')]},'thirdDisposition':{'type':Sequelize[_0xc205('0x2')]},'queuecallerenterreason':{'type':Sequelize[_0xc205('0x8')],'defaultValue':0x0},'note':{'type':Sequelize[_0xc205('0x2')]}}; \ No newline at end of file +var _0xeb62=['holdtime','INTEGER','BOOLEAN','COMPLETEDBYCALLER,\x20COMPLETEDBYAGENT,\x20FORWARDTRANFER,\x20BLINDTRANSFER,\x20ATTENDEDTRANSFER,\x20EXITWITHKEY,\x20TIMEOUT','FORWARD,\x20BLIND,\x20ATTENDED','sequelize','moment','exports','STRING','DATE','getDataValue','queuecallerjoinAt','format','YYYY-MM-DD\x20HH:mm:ss','seconds','queuecallerleaveAt','setDataValue'];(function(_0xa2c0a3,_0x5bbac0){var _0x52c618=function(_0x20f7fd){while(--_0x20f7fd){_0xa2c0a3['push'](_0xa2c0a3['shift']());}};_0x52c618(++_0x5bbac0);}(_0xeb62,0x8d));var _0x2eb6=function(_0x1b00cf,_0x13234d){_0x1b00cf=_0x1b00cf-0x0;var _0x27889c=_0xeb62[_0x1b00cf];return _0x27889c;};'use strict';var Sequelize=require(_0x2eb6('0x0'));var moment=require(_0x2eb6('0x1'));module[_0x2eb6('0x2')]={'type':{'type':Sequelize['STRING']},'uniqueid':{'type':Sequelize[_0x2eb6('0x3')]},'calleridnum':{'type':Sequelize[_0x2eb6('0x3')]},'calleridname':{'type':Sequelize['STRING']},'queue':{'type':Sequelize['STRING']},'queuecallerjoinAt':{'type':Sequelize[_0x2eb6('0x4')]},'queuecallerleaveAt':{'type':Sequelize[_0x2eb6('0x4')],'set':function(_0x1a961b){var _0x256362=moment(_0x1a961b);var _0x3fb380=moment(this[_0x2eb6('0x5')](_0x2eb6('0x6')))[_0x2eb6('0x7')](_0x2eb6('0x8'));var _0x2fd4fe=_0x256362['diff'](_0x3fb380,_0x2eb6('0x9'));this['setDataValue'](_0x2eb6('0xa'),_0x1a961b);this[_0x2eb6('0xb')](_0x2eb6('0xc'),_0x2fd4fe||null);}},'position':{'type':Sequelize[_0x2eb6('0xd')]},'count':{'type':Sequelize['INTEGER']},'queuecallerabandon':{'type':Sequelize[_0x2eb6('0xe')],'defaultValue':![]},'queuecallerabandonAt':{'type':Sequelize[_0x2eb6('0x4')]},'queuecallercomplete':{'type':Sequelize[_0x2eb6('0xe')],'defaultValue':![]},'queuecallercompleteAt':{'type':Sequelize['DATE']},'queuecallerexit':{'type':Sequelize[_0x2eb6('0xe')],'defaultValue':![]},'queuecallerexitAt':{'type':Sequelize[_0x2eb6('0x4')]},'queuecallerexitreason':{'type':Sequelize['STRING'],'comment':_0x2eb6('0xf')},'originalposition':{'type':Sequelize[_0x2eb6('0xd')]},'channel':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x2eb6('0x3')]},'connectedlinename':{'type':Sequelize[_0x2eb6('0x3')]},'accountcode':{'type':Sequelize['STRING']},'context':{'type':Sequelize[_0x2eb6('0x3')]},'exten':{'type':Sequelize[_0x2eb6('0x3')]},'priority':{'type':Sequelize[_0x2eb6('0x3')]},'holdtime':{'type':Sequelize[_0x2eb6('0xd')]},'mohtime':{'type':Sequelize[_0x2eb6('0xd')],'defaultValue':0x0},'assigned':{'type':Sequelize[_0x2eb6('0xe')],'defaultValue':![]},'lastAssignedTo':{'type':Sequelize[_0x2eb6('0x3')]},'transfer':{'type':Sequelize[_0x2eb6('0xe')],'defaultValue':![]},'transfertype':{'type':Sequelize[_0x2eb6('0x3')],'comment':_0x2eb6('0x10')},'transferexten':{'type':Sequelize[_0x2eb6('0x3')]},'transferuniqueid':{'type':Sequelize[_0x2eb6('0x3')]},'disposition':{'type':Sequelize[_0x2eb6('0x3')]},'secondDisposition':{'type':Sequelize[_0x2eb6('0x3')]},'thirdDisposition':{'type':Sequelize[_0x2eb6('0x3')]},'queuecallerenterreason':{'type':Sequelize[_0x2eb6('0xd')],'defaultValue':0x0},'note':{'type':Sequelize[_0x2eb6('0x3')]}}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.controller.js b/server/api/voiceQueueReport/voiceQueueReport.controller.js index 428f37d..3e102b8 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 _0x2446=['crypto','jsforce','desk.js','querystring','ioredis','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/license/util','../../mysqldb','redis','localhost','./voiceQueueReport.socket','register','sendStatus','status','json','offset','undefined','limit','count','Content-Range','apply','save','update','then','end','error','index','map','VoiceQueueReport','rawAttributes','fieldName','type','key','model','name','keys','query','filters','intersection','attributes','fields','nolimit','order','sort','where','pick','filter','VIRTUAL','merge','includeAll','include','findAll','catch','show','params','length','options','find','create','body','destroy','describe','getVoiceQueuesReport','hasOwnProperty','rows','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','path','sox','to-csv','ejs','fs-extra'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x2446,0x1d5));var _0x6244=function(_0x3f4fac,_0x2f3f0b){_0x3f4fac=_0x3f4fac-0x0;var _0xbb8141=_0x2446[_0x3f4fac];return _0xbb8141;};'use strict';var emlformat=require(_0x6244('0x0'));var rimraf=require(_0x6244('0x1'));var zipdir=require(_0x6244('0x2'));var jsonpatch=require(_0x6244('0x3'));var rp=require(_0x6244('0x4'));var moment=require('moment');var BPromise=require(_0x6244('0x5'));var Mustache=require('mustache');var util=require('util');var path=require(_0x6244('0x6'));var sox=require(_0x6244('0x7'));var csv=require(_0x6244('0x8'));var ejs=require(_0x6244('0x9'));var fs=require('fs');var fs_extra=require(_0x6244('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require(_0x6244('0xb'));var jsforce=require(_0x6244('0xc'));var deskjs=require(_0x6244('0xd'));var toCsv=require('to-csv');var querystring=require(_0x6244('0xe'));var Papa=require('papaparse');var Redis=require(_0x6244('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require(_0x6244('0x10'));var hardwareService=require(_0x6244('0x11'));var logger=require(_0x6244('0x12'))(_0x6244('0x13'));var utils=require(_0x6244('0x14'));var config=require('../../config/environment');var licenseUtil=require(_0x6244('0x15'));var db=require(_0x6244('0x16'))['db'];config[_0x6244('0x17')]=_['defaults'](config[_0x6244('0x17')],{'host':_0x6244('0x18'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x6244('0x19'))[_0x6244('0x1a')](socket);function respondWithStatusCode(_0xfafa24,_0x35222c){_0x35222c=_0x35222c||0xcc;return function(_0x25991e){if(_0x25991e){return _0xfafa24[_0x6244('0x1b')](_0x35222c);}return _0xfafa24['status'](_0x35222c)['end']();};}function respondWithResult(_0x5e3b49,_0x329df2){_0x329df2=_0x329df2||0xc8;return function(_0x24be5c){if(_0x24be5c){return _0x5e3b49[_0x6244('0x1c')](_0x329df2)[_0x6244('0x1d')](_0x24be5c);}};}function respondWithFilteredResult(_0x3dfa35,_0x399c96){return function(_0x4ccd0c){if(_0x4ccd0c){var _0x403a87=typeof _0x399c96[_0x6244('0x1e')]===_0x6244('0x1f')&&typeof _0x399c96[_0x6244('0x20')]===_0x6244('0x1f');var _0x1bcc84=_0x4ccd0c[_0x6244('0x21')];var _0x306a66=_0x403a87?0x0:_0x399c96[_0x6244('0x1e')];var _0x25b2b1=_0x403a87?_0x4ccd0c[_0x6244('0x21')]:_0x399c96[_0x6244('0x1e')]+_0x399c96[_0x6244('0x20')];var _0x1ac051;if(_0x25b2b1>=_0x1bcc84){_0x25b2b1=_0x1bcc84;_0x1ac051=0xc8;}else{_0x1ac051=0xce;}_0x3dfa35['status'](_0x1ac051);return _0x3dfa35['set'](_0x6244('0x22'),_0x306a66+'-'+_0x25b2b1+'/'+_0x1bcc84)[_0x6244('0x1d')](_0x4ccd0c);}return null;};}function patchUpdates(_0x257e0b){return function(_0x376518){try{jsonpatch[_0x6244('0x23')](_0x376518,_0x257e0b,!![]);}catch(_0x135e1a){return BPromise['reject'](_0x135e1a);}return _0x376518[_0x6244('0x24')]();};}function saveUpdates(_0x5508a1,_0x7dbb9c){return function(_0x3f98e3){if(_0x3f98e3){return _0x3f98e3[_0x6244('0x25')](_0x5508a1)['then'](function(_0x2980c8){return _0x2980c8;});}return null;};}function removeEntity(_0x4d647d,_0x525b6c){return function(_0x378759){if(_0x378759){return _0x378759['destroy']()[_0x6244('0x26')](function(){_0x4d647d[_0x6244('0x1c')](0xcc)[_0x6244('0x27')]();});}};}function handleEntityNotFound(_0x182507,_0x22e12f){return function(_0x95eaf4){if(!_0x95eaf4){_0x182507[_0x6244('0x1b')](0x194);}return _0x95eaf4;};}function handleError(_0x36ff8a,_0x1c5511){_0x1c5511=_0x1c5511||0x1f4;return function(_0x53703b){logger[_0x6244('0x28')](_0x53703b['stack']);if(_0x53703b['name']){delete _0x53703b['name'];}_0x36ff8a['status'](_0x1c5511)['send'](_0x53703b);};}exports[_0x6244('0x29')]=function(_0x4740fa,_0x3a07c7){var _0x3aecb2={},_0x250e55={},_0x27fb9b={'count':0x0,'rows':[]};var _0x27693d=_[_0x6244('0x2a')](db[_0x6244('0x2b')][_0x6244('0x2c')],function(_0x3be64d){return{'name':_0x3be64d[_0x6244('0x2d')],'type':_0x3be64d[_0x6244('0x2e')][_0x6244('0x2f')]};});_0x250e55[_0x6244('0x30')]=_[_0x6244('0x2a')](_0x27693d,_0x6244('0x31'));_0x250e55['query']=_[_0x6244('0x32')](_0x4740fa[_0x6244('0x33')]);_0x250e55[_0x6244('0x34')]=_[_0x6244('0x35')](_0x250e55[_0x6244('0x30')],_0x250e55[_0x6244('0x33')]);_0x3aecb2[_0x6244('0x36')]=_[_0x6244('0x35')](_0x250e55[_0x6244('0x30')],qs[_0x6244('0x37')](_0x4740fa[_0x6244('0x33')][_0x6244('0x37')]));_0x3aecb2['attributes']=_0x3aecb2[_0x6244('0x36')]['length']?_0x3aecb2['attributes']:_0x250e55[_0x6244('0x30')];if(!_0x4740fa[_0x6244('0x33')]['hasOwnProperty'](_0x6244('0x38'))){_0x3aecb2['limit']=qs[_0x6244('0x20')](_0x4740fa[_0x6244('0x33')]['limit']);_0x3aecb2[_0x6244('0x1e')]=qs[_0x6244('0x1e')](_0x4740fa[_0x6244('0x33')][_0x6244('0x1e')]);}_0x3aecb2[_0x6244('0x39')]=qs[_0x6244('0x3a')](_0x4740fa[_0x6244('0x33')][_0x6244('0x3a')]);_0x3aecb2[_0x6244('0x3b')]=qs['filters'](_[_0x6244('0x3c')](_0x4740fa[_0x6244('0x33')],_0x250e55['filters']),_0x27693d);if(_0x4740fa[_0x6244('0x33')][_0x6244('0x3d')]){_0x3aecb2[_0x6244('0x3b')]=_['merge'](_0x3aecb2[_0x6244('0x3b')],{'$or':_[_0x6244('0x2a')](_0x27693d,function(_0x29201b){if(_0x29201b[_0x6244('0x2e')]!==_0x6244('0x3e')){var _0xea0351={};_0xea0351[_0x29201b['name']]={'$like':'%'+_0x4740fa[_0x6244('0x33')][_0x6244('0x3d')]+'%'};return _0xea0351;}})});}_0x3aecb2=_[_0x6244('0x3f')]({},_0x3aecb2,_0x4740fa['options']);var _0x211e8a={'where':_0x3aecb2[_0x6244('0x3b')]};return db[_0x6244('0x2b')][_0x6244('0x21')](_0x211e8a)[_0x6244('0x26')](function(_0x400631){_0x27fb9b[_0x6244('0x21')]=_0x400631;if(_0x4740fa[_0x6244('0x33')][_0x6244('0x40')]){_0x3aecb2[_0x6244('0x41')]=[{'all':!![]}];}return db['VoiceQueueReport'][_0x6244('0x42')](_0x3aecb2);})[_0x6244('0x26')](function(_0xd7997d){_0x27fb9b['rows']=_0xd7997d;return _0x27fb9b;})['then'](respondWithFilteredResult(_0x3a07c7,_0x3aecb2))[_0x6244('0x43')](handleError(_0x3a07c7,null));};exports[_0x6244('0x44')]=function(_0x206eb3,_0x426ba2){var _0x3d940c={'raw':![],'where':{'id':_0x206eb3[_0x6244('0x45')]['id']}},_0x2fbee7={};_0x2fbee7['model']=_[_0x6244('0x32')](db[_0x6244('0x2b')]['rawAttributes']);_0x2fbee7[_0x6244('0x33')]=_[_0x6244('0x32')](_0x206eb3[_0x6244('0x33')]);_0x2fbee7['filters']=_[_0x6244('0x35')](_0x2fbee7['model'],_0x2fbee7[_0x6244('0x33')]);_0x3d940c['attributes']=_[_0x6244('0x35')](_0x2fbee7[_0x6244('0x30')],qs[_0x6244('0x37')](_0x206eb3[_0x6244('0x33')][_0x6244('0x37')]));_0x3d940c[_0x6244('0x36')]=_0x3d940c[_0x6244('0x36')][_0x6244('0x46')]?_0x3d940c[_0x6244('0x36')]:_0x2fbee7[_0x6244('0x30')];if(_0x206eb3[_0x6244('0x33')][_0x6244('0x40')]){_0x3d940c[_0x6244('0x41')]=[{'all':!![]}];}_0x3d940c=_[_0x6244('0x3f')]({},_0x3d940c,_0x206eb3[_0x6244('0x47')]);return db[_0x6244('0x2b')][_0x6244('0x48')](_0x3d940c)[_0x6244('0x26')](handleEntityNotFound(_0x426ba2,null))[_0x6244('0x26')](respondWithResult(_0x426ba2,null))[_0x6244('0x43')](handleError(_0x426ba2,null));};exports[_0x6244('0x49')]=function(_0x1be83a,_0x15c0e4){return db[_0x6244('0x2b')][_0x6244('0x49')](_0x1be83a[_0x6244('0x4a')],{})[_0x6244('0x26')](respondWithResult(_0x15c0e4,0xc9))[_0x6244('0x43')](handleError(_0x15c0e4,null));};exports[_0x6244('0x25')]=function(_0x48c7e7,_0x5828ed){if(_0x48c7e7['body']['id']){delete _0x48c7e7[_0x6244('0x4a')]['id'];}return db[_0x6244('0x2b')][_0x6244('0x48')]({'where':{'id':_0x48c7e7[_0x6244('0x45')]['id']}})['then'](handleEntityNotFound(_0x5828ed,null))[_0x6244('0x26')](saveUpdates(_0x48c7e7[_0x6244('0x4a')],null))['then'](respondWithResult(_0x5828ed,null))[_0x6244('0x43')](handleError(_0x5828ed,null));};exports[_0x6244('0x4b')]=function(_0xe5e3ad,_0x216074){return db['VoiceQueueReport']['find']({'where':{'id':_0xe5e3ad[_0x6244('0x45')]['id']}})[_0x6244('0x26')](handleEntityNotFound(_0x216074,null))[_0x6244('0x26')](removeEntity(_0x216074,null))['catch'](handleError(_0x216074,null));};exports[_0x6244('0x4c')]=function(_0x32effb,_0x4325f3){return db[_0x6244('0x2b')][_0x6244('0x4c')]()[_0x6244('0x26')](respondWithResult(_0x4325f3,null))['catch'](handleError(_0x4325f3,null));};exports[_0x6244('0x4d')]=function(_0x39d896,_0xdbf448){var _0x1ef22c={},_0x13c221={},_0x269d26={'count':0x0,'rows':[]};_0x13c221['model']=_[_0x6244('0x32')](db['VoiceQueueReport']['rawAttributes']);_0x13c221[_0x6244('0x33')]=_[_0x6244('0x32')](_0x39d896[_0x6244('0x33')]);_0x13c221[_0x6244('0x34')]=_['intersection'](_0x13c221['model'],_0x13c221[_0x6244('0x33')]);_0x1ef22c['attributes']=_['intersection'](_0x13c221[_0x6244('0x30')],qs['fields'](_0x39d896[_0x6244('0x33')][_0x6244('0x37')]));_0x1ef22c[_0x6244('0x36')]=_0x1ef22c['attributes']['length']?_0x1ef22c[_0x6244('0x36')]:_0x13c221[_0x6244('0x30')];if(!_0x39d896['query'][_0x6244('0x4e')](_0x6244('0x38'))){_0x1ef22c[_0x6244('0x20')]=qs['limit'](_0x39d896['query'][_0x6244('0x20')]);_0x1ef22c[_0x6244('0x1e')]=qs['offset'](_0x39d896['query'][_0x6244('0x1e')]);}_0x1ef22c['order']=qs[_0x6244('0x3a')](_0x39d896[_0x6244('0x33')]['sort']);_0x1ef22c[_0x6244('0x3b')]=qs['filters'](_[_0x6244('0x3c')](_0x39d896[_0x6244('0x33')],_0x13c221['filters']));if(_0x39d896[_0x6244('0x33')][_0x6244('0x3d')]){_0x1ef22c[_0x6244('0x3b')]=_[_0x6244('0x3f')](_0x1ef22c[_0x6244('0x3b')],{'$or':_[_0x6244('0x2a')](_0x1ef22c[_0x6244('0x36')],function(_0xa7700d){var _0x4acd16={};_0x4acd16[_0xa7700d]={'$like':'%'+_0x39d896[_0x6244('0x33')][_0x6244('0x3d')]+'%'};return _0x4acd16;})});}_0x1ef22c=_['merge']({},_0x1ef22c,_0x39d896['options']);var _0x85a28d={'where':_0x1ef22c[_0x6244('0x3b')]};return db['VoiceQueueReport'][_0x6244('0x21')](_0x85a28d)['then'](function(_0x2cedf3){_0x269d26[_0x6244('0x21')]=_0x2cedf3;if(_0x39d896[_0x6244('0x33')]['includeAll']){_0x1ef22c[_0x6244('0x41')]=[{'all':!![]}];}return db[_0x6244('0x2b')][_0x6244('0x42')](_0x1ef22c);})[_0x6244('0x26')](function(_0x2d7255){_0x269d26[_0x6244('0x4f')]=_0x2d7255;return _0x269d26;})[_0x6244('0x26')](respondWithFilteredResult(_0xdbf448,_0x1ef22c,'getVoiceQueuesReport'))[_0x6244('0x43')](handleError(_0xdbf448,null,_0x6244('0x4d')));}; \ No newline at end of file +var _0xc9b1=['query','filters','intersection','attributes','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','VoiceQueueReport','count','includeAll','include','findAll','rows','catch','show','params','find','create','body','destroy','describe','getVoiceQueuesReport','nolimit','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','mustache','util','path','sox','to-csv','fs-extra','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','redis','defaults','socket.io-emitter','sendStatus','status','end','json','offset','undefined','limit','Content-Range','apply','reject','save','update','then','error','stack','name','send','index','map','rawAttributes','fieldName','type','key','model','keys'];(function(_0x44acf9,_0xa532){var _0x216407=function(_0xef956){while(--_0xef956){_0x44acf9['push'](_0x44acf9['shift']());}};_0x216407(++_0xa532);}(_0xc9b1,0x1b3));var _0x1c9b=function(_0x4a7295,_0x56b54b){_0x4a7295=_0x4a7295-0x0;var _0x1e0d71=_0xc9b1[_0x4a7295];return _0x1e0d71;};'use strict';var emlformat=require(_0x1c9b('0x0'));var rimraf=require(_0x1c9b('0x1'));var zipdir=require(_0x1c9b('0x2'));var jsonpatch=require(_0x1c9b('0x3'));var rp=require(_0x1c9b('0x4'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require(_0x1c9b('0x5'));var util=require(_0x1c9b('0x6'));var path=require(_0x1c9b('0x7'));var sox=require(_0x1c9b('0x8'));var csv=require(_0x1c9b('0x9'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x1c9b('0xa'));var _=require('lodash');var squel=require('squel');var crypto=require('crypto');var jsforce=require(_0x1c9b('0xb'));var deskjs=require('desk.js');var toCsv=require(_0x1c9b('0x9'));var querystring=require(_0x1c9b('0xc'));var Papa=require(_0x1c9b('0xd'));var Redis=require(_0x1c9b('0xe'));var authService=require(_0x1c9b('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x1c9b('0x10'));var hardwareService=require(_0x1c9b('0x11'));var logger=require(_0x1c9b('0x12'))(_0x1c9b('0x13'));var utils=require(_0x1c9b('0x14'));var config=require(_0x1c9b('0x15'));var licenseUtil=require(_0x1c9b('0x16'));var db=require('../../mysqldb')['db'];config[_0x1c9b('0x17')]=_[_0x1c9b('0x18')](config[_0x1c9b('0x17')],{'host':'localhost','port':0x18eb});var socket=require(_0x1c9b('0x19'))(new Redis(config['redis']));require('./voiceQueueReport.socket')['register'](socket);function respondWithStatusCode(_0x43c9cd,_0x3ddeb0){_0x3ddeb0=_0x3ddeb0||0xcc;return function(_0x43dc07){if(_0x43dc07){return _0x43c9cd[_0x1c9b('0x1a')](_0x3ddeb0);}return _0x43c9cd[_0x1c9b('0x1b')](_0x3ddeb0)[_0x1c9b('0x1c')]();};}function respondWithResult(_0x39e671,_0x48d163){_0x48d163=_0x48d163||0xc8;return function(_0x2ddc5a){if(_0x2ddc5a){return _0x39e671['status'](_0x48d163)[_0x1c9b('0x1d')](_0x2ddc5a);}};}function respondWithFilteredResult(_0xe7fbc5,_0x7e3f5e){return function(_0x215e34){if(_0x215e34){var _0x24f43d=typeof _0x7e3f5e[_0x1c9b('0x1e')]===_0x1c9b('0x1f')&&typeof _0x7e3f5e[_0x1c9b('0x20')]==='undefined';var _0x17a326=_0x215e34['count'];var _0x5ab4d8=_0x24f43d?0x0:_0x7e3f5e[_0x1c9b('0x1e')];var _0x2b46a5=_0x24f43d?_0x215e34['count']:_0x7e3f5e[_0x1c9b('0x1e')]+_0x7e3f5e[_0x1c9b('0x20')];var _0x39f29d;if(_0x2b46a5>=_0x17a326){_0x2b46a5=_0x17a326;_0x39f29d=0xc8;}else{_0x39f29d=0xce;}_0xe7fbc5[_0x1c9b('0x1b')](_0x39f29d);return _0xe7fbc5['set'](_0x1c9b('0x21'),_0x5ab4d8+'-'+_0x2b46a5+'/'+_0x17a326)[_0x1c9b('0x1d')](_0x215e34);}return null;};}function patchUpdates(_0x15d4d6){return function(_0x1b7074){try{jsonpatch[_0x1c9b('0x22')](_0x1b7074,_0x15d4d6,!![]);}catch(_0x94a51a){return BPromise[_0x1c9b('0x23')](_0x94a51a);}return _0x1b7074[_0x1c9b('0x24')]();};}function saveUpdates(_0x5d4950,_0x2a911b){return function(_0x2f94b7){if(_0x2f94b7){return _0x2f94b7[_0x1c9b('0x25')](_0x5d4950)[_0x1c9b('0x26')](function(_0x16e660){return _0x16e660;});}return null;};}function removeEntity(_0x5ad448,_0x3bafb0){return function(_0x5c25a5){if(_0x5c25a5){return _0x5c25a5['destroy']()['then'](function(){_0x5ad448[_0x1c9b('0x1b')](0xcc)[_0x1c9b('0x1c')]();});}};}function handleEntityNotFound(_0xb69f30,_0x239677){return function(_0x318e4a){if(!_0x318e4a){_0xb69f30[_0x1c9b('0x1a')](0x194);}return _0x318e4a;};}function handleError(_0x408269,_0x389fd7){_0x389fd7=_0x389fd7||0x1f4;return function(_0xc7cbf2){logger[_0x1c9b('0x27')](_0xc7cbf2[_0x1c9b('0x28')]);if(_0xc7cbf2[_0x1c9b('0x29')]){delete _0xc7cbf2['name'];}_0x408269['status'](_0x389fd7)[_0x1c9b('0x2a')](_0xc7cbf2);};}exports[_0x1c9b('0x2b')]=function(_0x34e4a7,_0x3c70f5){var _0x32112d={},_0x552292={},_0xce37a0={'count':0x0,'rows':[]};var _0x1b03dc=_[_0x1c9b('0x2c')](db['VoiceQueueReport'][_0x1c9b('0x2d')],function(_0x4531a4){return{'name':_0x4531a4[_0x1c9b('0x2e')],'type':_0x4531a4[_0x1c9b('0x2f')][_0x1c9b('0x30')]};});_0x552292[_0x1c9b('0x31')]=_['map'](_0x1b03dc,'name');_0x552292['query']=_[_0x1c9b('0x32')](_0x34e4a7[_0x1c9b('0x33')]);_0x552292[_0x1c9b('0x34')]=_[_0x1c9b('0x35')](_0x552292['model'],_0x552292[_0x1c9b('0x33')]);_0x32112d[_0x1c9b('0x36')]=_['intersection'](_0x552292[_0x1c9b('0x31')],qs[_0x1c9b('0x37')](_0x34e4a7[_0x1c9b('0x33')][_0x1c9b('0x37')]));_0x32112d[_0x1c9b('0x36')]=_0x32112d[_0x1c9b('0x36')][_0x1c9b('0x38')]?_0x32112d[_0x1c9b('0x36')]:_0x552292[_0x1c9b('0x31')];if(!_0x34e4a7[_0x1c9b('0x33')]['hasOwnProperty']('nolimit')){_0x32112d[_0x1c9b('0x20')]=qs['limit'](_0x34e4a7[_0x1c9b('0x33')][_0x1c9b('0x20')]);_0x32112d['offset']=qs[_0x1c9b('0x1e')](_0x34e4a7[_0x1c9b('0x33')][_0x1c9b('0x1e')]);}_0x32112d[_0x1c9b('0x39')]=qs[_0x1c9b('0x3a')](_0x34e4a7['query'][_0x1c9b('0x3a')]);_0x32112d[_0x1c9b('0x3b')]=qs[_0x1c9b('0x34')](_[_0x1c9b('0x3c')](_0x34e4a7['query'],_0x552292[_0x1c9b('0x34')]),_0x1b03dc);if(_0x34e4a7[_0x1c9b('0x33')][_0x1c9b('0x3d')]){_0x32112d[_0x1c9b('0x3b')]=_[_0x1c9b('0x3e')](_0x32112d[_0x1c9b('0x3b')],{'$or':_[_0x1c9b('0x2c')](_0x1b03dc,function(_0x3a91b1){if(_0x3a91b1['type']!==_0x1c9b('0x3f')){var _0x5eb53d={};_0x5eb53d[_0x3a91b1[_0x1c9b('0x29')]]={'$like':'%'+_0x34e4a7[_0x1c9b('0x33')][_0x1c9b('0x3d')]+'%'};return _0x5eb53d;}})});}_0x32112d=_['merge']({},_0x32112d,_0x34e4a7[_0x1c9b('0x40')]);var _0x5f2753={'where':_0x32112d[_0x1c9b('0x3b')]};return db[_0x1c9b('0x41')][_0x1c9b('0x42')](_0x5f2753)[_0x1c9b('0x26')](function(_0x2d4b0d){_0xce37a0['count']=_0x2d4b0d;if(_0x34e4a7['query'][_0x1c9b('0x43')]){_0x32112d[_0x1c9b('0x44')]=[{'all':!![]}];}return db[_0x1c9b('0x41')][_0x1c9b('0x45')](_0x32112d);})[_0x1c9b('0x26')](function(_0x21211b){_0xce37a0[_0x1c9b('0x46')]=_0x21211b;return _0xce37a0;})['then'](respondWithFilteredResult(_0x3c70f5,_0x32112d))[_0x1c9b('0x47')](handleError(_0x3c70f5,null));};exports[_0x1c9b('0x48')]=function(_0x1ae39a,_0xf419ca){var _0x2606e3={'raw':![],'where':{'id':_0x1ae39a[_0x1c9b('0x49')]['id']}},_0x82c639={};_0x82c639['model']=_[_0x1c9b('0x32')](db[_0x1c9b('0x41')][_0x1c9b('0x2d')]);_0x82c639[_0x1c9b('0x33')]=_[_0x1c9b('0x32')](_0x1ae39a[_0x1c9b('0x33')]);_0x82c639[_0x1c9b('0x34')]=_[_0x1c9b('0x35')](_0x82c639[_0x1c9b('0x31')],_0x82c639[_0x1c9b('0x33')]);_0x2606e3['attributes']=_[_0x1c9b('0x35')](_0x82c639[_0x1c9b('0x31')],qs[_0x1c9b('0x37')](_0x1ae39a[_0x1c9b('0x33')][_0x1c9b('0x37')]));_0x2606e3['attributes']=_0x2606e3['attributes'][_0x1c9b('0x38')]?_0x2606e3[_0x1c9b('0x36')]:_0x82c639[_0x1c9b('0x31')];if(_0x1ae39a[_0x1c9b('0x33')][_0x1c9b('0x43')]){_0x2606e3[_0x1c9b('0x44')]=[{'all':!![]}];}_0x2606e3=_[_0x1c9b('0x3e')]({},_0x2606e3,_0x1ae39a[_0x1c9b('0x40')]);return db['VoiceQueueReport'][_0x1c9b('0x4a')](_0x2606e3)['then'](handleEntityNotFound(_0xf419ca,null))[_0x1c9b('0x26')](respondWithResult(_0xf419ca,null))[_0x1c9b('0x47')](handleError(_0xf419ca,null));};exports[_0x1c9b('0x4b')]=function(_0xec0613,_0x1aaf8c){return db[_0x1c9b('0x41')][_0x1c9b('0x4b')](_0xec0613['body'],{})[_0x1c9b('0x26')](respondWithResult(_0x1aaf8c,0xc9))[_0x1c9b('0x47')](handleError(_0x1aaf8c,null));};exports[_0x1c9b('0x25')]=function(_0x107810,_0x125c4f){if(_0x107810[_0x1c9b('0x4c')]['id']){delete _0x107810[_0x1c9b('0x4c')]['id'];}return db['VoiceQueueReport']['find']({'where':{'id':_0x107810[_0x1c9b('0x49')]['id']}})[_0x1c9b('0x26')](handleEntityNotFound(_0x125c4f,null))[_0x1c9b('0x26')](saveUpdates(_0x107810[_0x1c9b('0x4c')],null))[_0x1c9b('0x26')](respondWithResult(_0x125c4f,null))[_0x1c9b('0x47')](handleError(_0x125c4f,null));};exports[_0x1c9b('0x4d')]=function(_0x3489c,_0x2032ea){return db['VoiceQueueReport'][_0x1c9b('0x4a')]({'where':{'id':_0x3489c[_0x1c9b('0x49')]['id']}})['then'](handleEntityNotFound(_0x2032ea,null))[_0x1c9b('0x26')](removeEntity(_0x2032ea,null))[_0x1c9b('0x47')](handleError(_0x2032ea,null));};exports[_0x1c9b('0x4e')]=function(_0x23616b,_0x1ce792){return db['VoiceQueueReport'][_0x1c9b('0x4e')]()[_0x1c9b('0x26')](respondWithResult(_0x1ce792,null))[_0x1c9b('0x47')](handleError(_0x1ce792,null));};exports[_0x1c9b('0x4f')]=function(_0x1d5f53,_0x463c53){var _0x306053={},_0x1f1fb6={},_0x514e12={'count':0x0,'rows':[]};_0x1f1fb6['model']=_[_0x1c9b('0x32')](db[_0x1c9b('0x41')]['rawAttributes']);_0x1f1fb6[_0x1c9b('0x33')]=_[_0x1c9b('0x32')](_0x1d5f53[_0x1c9b('0x33')]);_0x1f1fb6['filters']=_['intersection'](_0x1f1fb6[_0x1c9b('0x31')],_0x1f1fb6[_0x1c9b('0x33')]);_0x306053['attributes']=_[_0x1c9b('0x35')](_0x1f1fb6[_0x1c9b('0x31')],qs[_0x1c9b('0x37')](_0x1d5f53['query']['fields']));_0x306053['attributes']=_0x306053[_0x1c9b('0x36')]['length']?_0x306053[_0x1c9b('0x36')]:_0x1f1fb6[_0x1c9b('0x31')];if(!_0x1d5f53[_0x1c9b('0x33')]['hasOwnProperty'](_0x1c9b('0x50'))){_0x306053[_0x1c9b('0x20')]=qs[_0x1c9b('0x20')](_0x1d5f53[_0x1c9b('0x33')]['limit']);_0x306053[_0x1c9b('0x1e')]=qs[_0x1c9b('0x1e')](_0x1d5f53[_0x1c9b('0x33')]['offset']);}_0x306053[_0x1c9b('0x39')]=qs[_0x1c9b('0x3a')](_0x1d5f53['query'][_0x1c9b('0x3a')]);_0x306053[_0x1c9b('0x3b')]=qs[_0x1c9b('0x34')](_[_0x1c9b('0x3c')](_0x1d5f53[_0x1c9b('0x33')],_0x1f1fb6[_0x1c9b('0x34')]));if(_0x1d5f53[_0x1c9b('0x33')][_0x1c9b('0x3d')]){_0x306053[_0x1c9b('0x3b')]=_[_0x1c9b('0x3e')](_0x306053[_0x1c9b('0x3b')],{'$or':_[_0x1c9b('0x2c')](_0x306053[_0x1c9b('0x36')],function(_0x209adc){var _0x5e78ca={};_0x5e78ca[_0x209adc]={'$like':'%'+_0x1d5f53[_0x1c9b('0x33')][_0x1c9b('0x3d')]+'%'};return _0x5e78ca;})});}_0x306053=_[_0x1c9b('0x3e')]({},_0x306053,_0x1d5f53[_0x1c9b('0x40')]);var _0xb2ef37={'where':_0x306053['where']};return db[_0x1c9b('0x41')][_0x1c9b('0x42')](_0xb2ef37)['then'](function(_0x28c940){_0x514e12['count']=_0x28c940;if(_0x1d5f53['query'][_0x1c9b('0x43')]){_0x306053[_0x1c9b('0x44')]=[{'all':!![]}];}return db[_0x1c9b('0x41')][_0x1c9b('0x45')](_0x306053);})['then'](function(_0x37a0e9){_0x514e12[_0x1c9b('0x46')]=_0x37a0e9;return _0x514e12;})[_0x1c9b('0x26')](respondWithFilteredResult(_0x463c53,_0x306053,_0x1c9b('0x4f')))['catch'](handleError(_0x463c53,null,'getVoiceQueuesReport'));}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.events.js b/server/api/voiceQueueReport/voiceQueueReport.events.js index 600423d..7b483bb 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 _0x8509=['events','../../mysqldb','VoiceQueueReport','setMaxListeners','update','remove','emit','hasOwnProperty','exports'];(function(_0x324cfb,_0x2385e4){var _0x471a8e=function(_0x585dbe){while(--_0x585dbe){_0x324cfb['push'](_0x324cfb['shift']());}};_0x471a8e(++_0x2385e4);}(_0x8509,0xb4));var _0x9850=function(_0x1e4c37,_0xdf253e){_0x1e4c37=_0x1e4c37-0x0;var _0xec3469=_0x8509[_0x1e4c37];return _0xec3469;};'use strict';var EventEmitter=require(_0x9850('0x0'));var VoiceQueueReport=require(_0x9850('0x1'))['db'][_0x9850('0x2')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents[_0x9850('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':_0x9850('0x4'),'afterDestroy':_0x9850('0x5')};function emitEvent(_0x57bb61){return function(_0x594df1,_0x4f57e3,_0x4f9173){VoiceQueueReportEvents[_0x9850('0x6')](_0x57bb61+':'+_0x594df1['id'],_0x594df1);VoiceQueueReportEvents[_0x9850('0x6')](_0x57bb61,_0x594df1);_0x4f9173(null);};}for(var e in events){if(events[_0x9850('0x7')](e)){var event=events[e];VoiceQueueReport['hook'](e,emitEvent(event));}}module[_0x9850('0x8')]=VoiceQueueReportEvents; \ No newline at end of file +var _0x8dab=['VoiceQueueReport','save','update','remove','emit','hook','exports'];(function(_0x29b0d8,_0x3a94e0){var _0x28d81e=function(_0x348e0f){while(--_0x348e0f){_0x29b0d8['push'](_0x29b0d8['shift']());}};_0x28d81e(++_0x3a94e0);}(_0x8dab,0xaf));var _0xb8da=function(_0x480eff,_0x541555){_0x480eff=_0x480eff-0x0;var _0x5c8aeb=_0x8dab[_0x480eff];return _0x5c8aeb;};'use strict';var EventEmitter=require('events');var VoiceQueueReport=require('../../mysqldb')['db'][_0xb8da('0x0')];var VoiceQueueReportEvents=new EventEmitter();VoiceQueueReportEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xb8da('0x1'),'afterUpdate':_0xb8da('0x2'),'afterDestroy':_0xb8da('0x3')};function emitEvent(_0x165d0f){return function(_0x2f7ae1,_0x310147,_0x1b5840){VoiceQueueReportEvents[_0xb8da('0x4')](_0x165d0f+':'+_0x2f7ae1['id'],_0x2f7ae1);VoiceQueueReportEvents['emit'](_0x165d0f,_0x2f7ae1);_0x1b5840(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];VoiceQueueReport[_0xb8da('0x5')](e,emitEvent(event));}}module[_0xb8da('0x6')]=VoiceQueueReportEvents; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.model.js b/server/api/voiceQueueReport/voiceQueueReport.model.js index 3ca3f48..13d993a 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 _0x0eb7=['path','rimraf','../../config/environment','./voiceQueueReport.attributes','exports','report_queue','calleridnum','lodash','util','moment','bluebird','request-promise'];(function(_0x1cb18a,_0x33167a){var _0x22442e=function(_0x46c611){while(--_0x46c611){_0x1cb18a['push'](_0x1cb18a['shift']());}};_0x22442e(++_0x33167a);}(_0x0eb7,0x1e7));var _0x70eb=function(_0x3e3280,_0x2e2c6e){_0x3e3280=_0x3e3280-0x0;var _0x45e1e5=_0x0eb7[_0x3e3280];return _0x45e1e5;};'use strict';var _=require(_0x70eb('0x0'));var util=require(_0x70eb('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x70eb('0x2'));var BPromise=require(_0x70eb('0x3'));var rp=require(_0x70eb('0x4'));var fs=require('fs');var path=require(_0x70eb('0x5'));var rimraf=require(_0x70eb('0x6'));var config=require(_0x70eb('0x7'));var attributes=require(_0x70eb('0x8'));module[_0x70eb('0x9')]=function(_0x2d1933,_0x367dd8){return _0x2d1933['define']('VoiceQueueReport',attributes,{'tableName':_0x70eb('0xa'),'paranoid':![],'indexes':[{'fields':['uniqueid']},{'fields':[_0x70eb('0xb')]}],'timestamps':!![]});}; \ No newline at end of file +var _0xb879=['uniqueid','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./voiceQueueReport.attributes','define','VoiceQueueReport','report_queue'];(function(_0x273c39,_0x1052e6){var _0x46d6b5=function(_0x44f1fb){while(--_0x44f1fb){_0x273c39['push'](_0x273c39['shift']());}};_0x46d6b5(++_0x1052e6);}(_0xb879,0x15d));var _0x9b87=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xb879[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x9b87('0x0'))(_0x9b87('0x1'));var moment=require(_0x9b87('0x2'));var BPromise=require(_0x9b87('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0x9b87('0x4'));var rimraf=require(_0x9b87('0x5'));var config=require(_0x9b87('0x6'));var attributes=require(_0x9b87('0x7'));module['exports']=function(_0x6eaae,_0x2a8b4d){return _0x6eaae[_0x9b87('0x8')](_0x9b87('0x9'),attributes,{'tableName':_0x9b87('0xa'),'paranoid':![],'indexes':[{'fields':[_0x9b87('0xb')]},{'fields':['calleridnum']}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.rpc.js b/server/api/voiceQueueReport/voiceQueueReport.rpc.js index d45d0da..183893e 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 _0x834b=['raw','where','attributes','limit','include','model','map','CreateVoiceQueueReport','create','body','UpdateVoiceQueueReport','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','redis','localhost','socket.io-emitter','./voiceQueueReport.socket','register','then','info','VoiceQueueReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','result','catch','GetVoiceQueueReport','VoiceQueueReport','options'];(function(_0x267c52,_0x3c0df3){var _0x46c47b=function(_0x3c3740){while(--_0x3c3740){_0x267c52['push'](_0x267c52['shift']());}};_0x46c47b(++_0x3c0df3);}(_0x834b,0xaf));var _0xb834=function(_0x3bf83f,_0x181cac){_0x3bf83f=_0x3bf83f-0x0;var _0x22c4a9=_0x834b[_0x3bf83f];return _0x22c4a9;};'use strict';var _=require(_0xb834('0x0'));var util=require('util');var moment=require(_0xb834('0x1'));var BPromise=require(_0xb834('0x2'));var rs=require(_0xb834('0x3'));var fs=require('fs');var Redis=require(_0xb834('0x4'));var db=require(_0xb834('0x5'))['db'];var utils=require(_0xb834('0x6'));var logger=require(_0xb834('0x7'))('rpc');var config=require(_0xb834('0x8'));var jayson=require(_0xb834('0x9'));var client=jayson[_0xb834('0xa')][_0xb834('0xb')]({'port':0x232a});config[_0xb834('0xc')]=_['defaults'](config[_0xb834('0xc')],{'host':_0xb834('0xd'),'port':0x18eb});var socket=require(_0xb834('0xe'))(new Redis(config[_0xb834('0xc')]));require(_0xb834('0xf'))[_0xb834('0x10')](socket);function respondWithRpcPromise(_0x440c20,_0x34d1a1,_0x1cab25){return new BPromise(function(_0x5bb21b,_0x1b4e56){return client['request'](_0x440c20,_0x1cab25)[_0xb834('0x11')](function(_0x191c74){logger[_0xb834('0x12')](_0xb834('0x13'),_0x34d1a1,_0xb834('0x14'));logger[_0xb834('0x15')]('VoiceQueueReport,\x20%s,\x20%s,\x20%s',_0x34d1a1,'request\x20sent',JSON[_0xb834('0x16')](_0x191c74));if(_0x191c74[_0xb834('0x17')]){if(_0x191c74['error']['code']===0x1f4){logger['error'](_0xb834('0x13'),_0x34d1a1,_0x191c74[_0xb834('0x17')]['message']);return _0x1b4e56(_0x191c74[_0xb834('0x17')][_0xb834('0x18')]);}logger[_0xb834('0x17')](_0xb834('0x13'),_0x34d1a1,_0x191c74[_0xb834('0x17')][_0xb834('0x18')]);return _0x5bb21b(_0x191c74['error'][_0xb834('0x18')]);}else{logger[_0xb834('0x12')](_0xb834('0x13'),_0x34d1a1,'request\x20sent');_0x5bb21b(_0x191c74[_0xb834('0x19')][_0xb834('0x18')]);}})[_0xb834('0x1a')](function(_0x23ac6d){logger[_0xb834('0x17')](_0xb834('0x13'),_0x34d1a1,_0x23ac6d);_0x1b4e56(_0x23ac6d);});});}exports[_0xb834('0x1b')]=function(_0xe5bf5d){var _0x594118=this;return new Promise(function(_0x3326a6,_0x5a3103){return db[_0xb834('0x1c')]['findAll']({'raw':_0xe5bf5d['options']?_0xe5bf5d[_0xb834('0x1d')][_0xb834('0x1e')]===undefined?!![]:![]:!![],'where':_0xe5bf5d['options']?_0xe5bf5d['options'][_0xb834('0x1f')]||null:null,'attributes':_0xe5bf5d[_0xb834('0x1d')]?_0xe5bf5d[_0xb834('0x1d')][_0xb834('0x20')]||null:null,'limit':_0xe5bf5d[_0xb834('0x1d')]?_0xe5bf5d[_0xb834('0x1d')][_0xb834('0x21')]||null:null,'include':_0xe5bf5d['options']?_0xe5bf5d[_0xb834('0x1d')]['include']?_['map'](_0xe5bf5d[_0xb834('0x1d')][_0xb834('0x22')],function(_0x50cf39){return{'model':db[_0x50cf39[_0xb834('0x23')]],'as':_0x50cf39['as'],'attributes':_0x50cf39[_0xb834('0x20')],'include':_0x50cf39[_0xb834('0x22')]?_[_0xb834('0x24')](_0x50cf39['include'],function(_0x123948){return{'model':db[_0x123948[_0xb834('0x23')]],'as':_0x123948['as'],'attributes':_0x123948[_0xb834('0x20')],'include':_0x123948[_0xb834('0x22')]?_[_0xb834('0x24')](_0x123948[_0xb834('0x22')],function(_0x4549e1){return{'model':db[_0x4549e1[_0xb834('0x23')]],'as':_0x4549e1['as'],'attributes':_0x4549e1[_0xb834('0x20')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x282edf){logger[_0xb834('0x12')](_0xb834('0x1b'),_0xe5bf5d);logger[_0xb834('0x15')](_0xb834('0x1b'),_0xe5bf5d,JSON[_0xb834('0x16')](_0x282edf));_0x3326a6(_0x282edf);})[_0xb834('0x1a')](function(_0x51fd59){logger[_0xb834('0x17')](_0xb834('0x1b'),_0x51fd59[_0xb834('0x18')],_0xe5bf5d);_0x5a3103(_0x594118[_0xb834('0x17')](0x1f4,_0x51fd59['message']));});});};exports[_0xb834('0x25')]=function(_0x3e13f2){var _0x551bbc=this;return new Promise(function(_0x5cd89a,_0x344277){return db['VoiceQueueReport'][_0xb834('0x26')](_0x3e13f2[_0xb834('0x27')],{'raw':_0x3e13f2[_0xb834('0x1d')]?_0x3e13f2[_0xb834('0x1d')][_0xb834('0x1e')]===undefined?!![]:![]:!![]})[_0xb834('0x11')](function(_0x220596){logger[_0xb834('0x12')](_0xb834('0x25'),_0x3e13f2);logger['debug'](_0xb834('0x25'),_0x3e13f2,JSON[_0xb834('0x16')](_0x220596));_0x5cd89a(_0x220596);})['catch'](function(_0x36026d){logger[_0xb834('0x17')](_0xb834('0x25'),_0x36026d[_0xb834('0x18')],_0x3e13f2);_0x344277(_0x551bbc[_0xb834('0x17')](0x1f4,_0x36026d['message']));});});};exports['UpdateVoiceQueueReport']=function(_0x2fcfec){var _0xb6267c=this;return new Promise(function(_0xc3469f,_0x3d160a){return db[_0xb834('0x1c')]['update'](_0x2fcfec[_0xb834('0x27')],{'raw':_0x2fcfec[_0xb834('0x1d')]?_0x2fcfec['options'][_0xb834('0x1e')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2fcfec[_0xb834('0x1d')]?_0x2fcfec[_0xb834('0x1d')]['where']||null:null,'attributes':_0x2fcfec[_0xb834('0x1d')]?_0x2fcfec[_0xb834('0x1d')][_0xb834('0x20')]||null:null,'limit':_0x2fcfec[_0xb834('0x1d')]?_0x2fcfec[_0xb834('0x1d')][_0xb834('0x21')]||null:null})[_0xb834('0x11')](function(_0xd17109){logger[_0xb834('0x12')]('UpdateVoiceQueueReport',_0x2fcfec);logger['debug'](_0xb834('0x28'),_0x2fcfec,JSON[_0xb834('0x16')](_0xd17109));_0xc3469f(_0xd17109);})[_0xb834('0x1a')](function(_0x1572fc){logger[_0xb834('0x17')](_0xb834('0x28'),_0x1572fc[_0xb834('0x18')],_0x2fcfec);_0x3d160a(_0xb6267c[_0xb834('0x17')](0x1f4,_0x1572fc[_0xb834('0x18')]));});});}; \ No newline at end of file +var _0x16af=['create','body','UpdateVoiceQueueReport','where','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','redis','socket.io-emitter','./voiceQueueReport.socket','register','request','info','VoiceQueueReport,\x20%s,\x20%s','debug','VoiceQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','GetVoiceQueueReport','VoiceQueueReport','findAll','options','raw','attributes','limit','include','map','model','then','catch','CreateVoiceQueueReport'];(function(_0x48a6be,_0x15f93f){var _0x511919=function(_0x1d402d){while(--_0x1d402d){_0x48a6be['push'](_0x48a6be['shift']());}};_0x511919(++_0x15f93f);}(_0x16af,0x7c));var _0xf16a=function(_0x440016,_0x54c63f){_0x440016=_0x440016-0x0;var _0x5b6037=_0x16af[_0x440016];return _0x5b6037;};'use strict';var _=require(_0xf16a('0x0'));var util=require('util');var moment=require(_0xf16a('0x1'));var BPromise=require(_0xf16a('0x2'));var rs=require(_0xf16a('0x3'));var fs=require('fs');var Redis=require(_0xf16a('0x4'));var db=require(_0xf16a('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0xf16a('0x6'))('rpc');var config=require(_0xf16a('0x7'));var jayson=require(_0xf16a('0x8'));var client=jayson['client']['http']({'port':0x232a});config[_0xf16a('0x9')]=_['defaults'](config[_0xf16a('0x9')],{'host':'localhost','port':0x18eb});var socket=require(_0xf16a('0xa'))(new Redis(config[_0xf16a('0x9')]));require(_0xf16a('0xb'))[_0xf16a('0xc')](socket);function respondWithRpcPromise(_0x16ca07,_0x2e3e30,_0x2919d5){return new BPromise(function(_0x503bd9,_0x3a0e3e){return client[_0xf16a('0xd')](_0x16ca07,_0x2919d5)['then'](function(_0x5e28e4){logger[_0xf16a('0xe')](_0xf16a('0xf'),_0x2e3e30,'request\x20sent');logger[_0xf16a('0x10')](_0xf16a('0x11'),_0x2e3e30,'request\x20sent',JSON[_0xf16a('0x12')](_0x5e28e4));if(_0x5e28e4['error']){if(_0x5e28e4[_0xf16a('0x13')][_0xf16a('0x14')]===0x1f4){logger['error'](_0xf16a('0xf'),_0x2e3e30,_0x5e28e4[_0xf16a('0x13')]['message']);return _0x3a0e3e(_0x5e28e4['error'][_0xf16a('0x15')]);}logger[_0xf16a('0x13')](_0xf16a('0xf'),_0x2e3e30,_0x5e28e4[_0xf16a('0x13')]['message']);return _0x503bd9(_0x5e28e4[_0xf16a('0x13')][_0xf16a('0x15')]);}else{logger['info'](_0xf16a('0xf'),_0x2e3e30,_0xf16a('0x16'));_0x503bd9(_0x5e28e4['result'][_0xf16a('0x15')]);}})['catch'](function(_0x35c115){logger[_0xf16a('0x13')](_0xf16a('0xf'),_0x2e3e30,_0x35c115);_0x3a0e3e(_0x35c115);});});}exports[_0xf16a('0x17')]=function(_0x584b22){var _0x48ae35=this;return new Promise(function(_0x12319e,_0x19f529){return db[_0xf16a('0x18')][_0xf16a('0x19')]({'raw':_0x584b22[_0xf16a('0x1a')]?_0x584b22[_0xf16a('0x1a')][_0xf16a('0x1b')]===undefined?!![]:![]:!![],'where':_0x584b22[_0xf16a('0x1a')]?_0x584b22[_0xf16a('0x1a')]['where']||null:null,'attributes':_0x584b22[_0xf16a('0x1a')]?_0x584b22[_0xf16a('0x1a')][_0xf16a('0x1c')]||null:null,'limit':_0x584b22[_0xf16a('0x1a')]?_0x584b22[_0xf16a('0x1a')][_0xf16a('0x1d')]||null:null,'include':_0x584b22[_0xf16a('0x1a')]?_0x584b22[_0xf16a('0x1a')][_0xf16a('0x1e')]?_[_0xf16a('0x1f')](_0x584b22[_0xf16a('0x1a')][_0xf16a('0x1e')],function(_0x1cbe08){return{'model':db[_0x1cbe08['model']],'as':_0x1cbe08['as'],'attributes':_0x1cbe08['attributes'],'include':_0x1cbe08[_0xf16a('0x1e')]?_[_0xf16a('0x1f')](_0x1cbe08[_0xf16a('0x1e')],function(_0x336e3b){return{'model':db[_0x336e3b[_0xf16a('0x20')]],'as':_0x336e3b['as'],'attributes':_0x336e3b[_0xf16a('0x1c')],'include':_0x336e3b['include']?_[_0xf16a('0x1f')](_0x336e3b[_0xf16a('0x1e')],function(_0x2df32b){return{'model':db[_0x2df32b[_0xf16a('0x20')]],'as':_0x2df32b['as'],'attributes':_0x2df32b['attributes']};}):[]};}):[]};}):[]:[]})[_0xf16a('0x21')](function(_0x3eb9f9){logger[_0xf16a('0xe')](_0xf16a('0x17'),_0x584b22);logger[_0xf16a('0x10')](_0xf16a('0x17'),_0x584b22,JSON[_0xf16a('0x12')](_0x3eb9f9));_0x12319e(_0x3eb9f9);})[_0xf16a('0x22')](function(_0x5b3bb4){logger[_0xf16a('0x13')](_0xf16a('0x17'),_0x5b3bb4[_0xf16a('0x15')],_0x584b22);_0x19f529(_0x48ae35['error'](0x1f4,_0x5b3bb4[_0xf16a('0x15')]));});});};exports[_0xf16a('0x23')]=function(_0x5aa382){var _0x5d37a7=this;return new Promise(function(_0x3f770a,_0x59b2c){return db['VoiceQueueReport'][_0xf16a('0x24')](_0x5aa382[_0xf16a('0x25')],{'raw':_0x5aa382['options']?_0x5aa382[_0xf16a('0x1a')][_0xf16a('0x1b')]===undefined?!![]:![]:!![]})[_0xf16a('0x21')](function(_0x35977f){logger[_0xf16a('0xe')](_0xf16a('0x23'),_0x5aa382);logger['debug'](_0xf16a('0x23'),_0x5aa382,JSON[_0xf16a('0x12')](_0x35977f));_0x3f770a(_0x35977f);})[_0xf16a('0x22')](function(_0x2821b8){logger[_0xf16a('0x13')]('CreateVoiceQueueReport',_0x2821b8[_0xf16a('0x15')],_0x5aa382);_0x59b2c(_0x5d37a7[_0xf16a('0x13')](0x1f4,_0x2821b8[_0xf16a('0x15')]));});});};exports[_0xf16a('0x26')]=function(_0x3c618b){var _0x482af8=this;return new Promise(function(_0x2e2013,_0x2fb66d){return db['VoiceQueueReport']['update'](_0x3c618b[_0xf16a('0x25')],{'raw':_0x3c618b['options']?_0x3c618b[_0xf16a('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x3c618b[_0xf16a('0x1a')]?_0x3c618b['options'][_0xf16a('0x27')]||null:null,'attributes':_0x3c618b[_0xf16a('0x1a')]?_0x3c618b[_0xf16a('0x1a')]['attributes']||null:null,'limit':_0x3c618b[_0xf16a('0x1a')]?_0x3c618b['options']['limit']||null:null})[_0xf16a('0x21')](function(_0x431a09){logger[_0xf16a('0xe')](_0xf16a('0x26'),_0x3c618b);logger[_0xf16a('0x10')](_0xf16a('0x26'),_0x3c618b,JSON[_0xf16a('0x12')](_0x431a09));_0x2e2013(_0x431a09);})[_0xf16a('0x22')](function(_0x499def){logger['error'](_0xf16a('0x26'),_0x499def[_0xf16a('0x15')],_0x3c618b);_0x2fb66d(_0x482af8[_0xf16a('0x13')](0x1f4,_0x499def[_0xf16a('0x15')]));});});}; \ No newline at end of file diff --git a/server/api/voiceQueueReport/voiceQueueReport.socket.js b/server/api/voiceQueueReport/voiceQueueReport.socket.js index a9ce9c9..252c52d 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 _0x85d3=['remove','update','emit','removeListener','voiceQueueReport:','save'];(function(_0x282580,_0x59b489){var _0x326a51=function(_0x4676aa){while(--_0x4676aa){_0x282580['push'](_0x282580['shift']());}};_0x326a51(++_0x59b489);}(_0x85d3,0x1a9));var _0x385d=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x85d3[_0x2dafbe];return _0x58a45a;};'use strict';var VoiceQueueReportEvents=require('./voiceQueueReport.events');var events=[_0x385d('0x0'),_0x385d('0x1'),_0x385d('0x2')];function createListener(_0x4a60cb,_0x5df85c){return function(_0x292155){_0x5df85c[_0x385d('0x3')](_0x4a60cb,_0x292155);};}function removeListener(_0x1c70e9,_0x586d7c){return function(){VoiceQueueReportEvents[_0x385d('0x4')](_0x1c70e9,_0x586d7c);};}exports['register']=function(_0x554c8d){for(var _0x59938d=0x0,_0x1b84d9=events['length'];_0x59938d<_0x1b84d9;_0x59938d++){var _0x2ea3b1=events[_0x59938d];var _0x5494d1=createListener(_0x385d('0x5')+_0x2ea3b1,_0x554c8d);VoiceQueueReportEvents['on'](_0x2ea3b1,_0x5494d1);}}; \ No newline at end of file +var _0xed1f=['register','length','./voiceQueueReport.events','save','remove','update','emit','removeListener'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xed1f,0x6a));var _0xfed1=function(_0x263a74,_0xc31414){_0x263a74=_0x263a74-0x0;var _0x2aa86c=_0xed1f[_0x263a74];return _0x2aa86c;};'use strict';var VoiceQueueReportEvents=require(_0xfed1('0x0'));var events=[_0xfed1('0x1'),_0xfed1('0x2'),_0xfed1('0x3')];function createListener(_0xa45937,_0x25f345){return function(_0x1dd614){_0x25f345[_0xfed1('0x4')](_0xa45937,_0x1dd614);};}function removeListener(_0x2209b3,_0x45c3c1){return function(){VoiceQueueReportEvents[_0xfed1('0x5')](_0x2209b3,_0x45c3c1);};}exports[_0xfed1('0x6')]=function(_0x3d6706){for(var _0x42751d=0x0,_0x380e18=events[_0xfed1('0x7')];_0x42751d<_0x380e18;_0x42751d++){var _0x2a6082=events[_0x42751d];var _0x2967ef=createListener('voiceQueueReport:'+_0x2a6082,_0x3d6706);VoiceQueueReportEvents['on'](_0x2a6082,_0x2967ef);}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/index.js b/server/api/voiceQueuesLog/index.js index 2137d4f..a960e23 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 _0xc192=['../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','show','post','create','put','/:id','update','delete','destroy','exports','multer','path','connect-timeout','express','Router','fs-extra'];(function(_0x625a73,_0x50ae08){var _0x3eceb5=function(_0x9e9500){while(--_0x9e9500){_0x625a73['push'](_0x625a73['shift']());}};_0x3eceb5(++_0x50ae08);}(_0xc192,0xd6));var _0x2c19=function(_0x4d4c2c,_0x4f8c0a){_0x4d4c2c=_0x4d4c2c-0x0;var _0x4c1e9f=_0xc192[_0x4d4c2c];return _0x4c1e9f;};'use strict';var multer=require(_0x2c19('0x0'));var util=require('util');var path=require(_0x2c19('0x1'));var timeout=require(_0x2c19('0x2'));var express=require(_0x2c19('0x3'));var router=express[_0x2c19('0x4')]();var fs_extra=require(_0x2c19('0x5'));var auth=require(_0x2c19('0x6'));var interaction=require(_0x2c19('0x7'));var config=require(_0x2c19('0x8'));var controller=require(_0x2c19('0x9'));router[_0x2c19('0xa')]('/',auth[_0x2c19('0xb')](),controller[_0x2c19('0xc')]);router[_0x2c19('0xa')]('/:id',auth[_0x2c19('0xb')](),controller[_0x2c19('0xd')]);router[_0x2c19('0xe')]('/',auth[_0x2c19('0xb')](),controller[_0x2c19('0xf')]);router[_0x2c19('0x10')](_0x2c19('0x11'),auth['isAuthenticated'](),controller[_0x2c19('0x12')]);router[_0x2c19('0x13')](_0x2c19('0x11'),auth[_0x2c19('0xb')](),controller[_0x2c19('0x14')]);module[_0x2c19('0x15')]=router; \ No newline at end of file +var _0x2ac4=['multer','util','path','connect-timeout','express','Router','fs-extra','../../components/auth/service','../../config/environment','./voiceQueuesLog.controller','get','isAuthenticated','index','/:id','put','update','delete','destroy','exports'];(function(_0x3b99e,_0x533a8d){var _0x3f353d=function(_0x112867){while(--_0x112867){_0x3b99e['push'](_0x3b99e['shift']());}};_0x3f353d(++_0x533a8d);}(_0x2ac4,0x130));var _0x42ac=function(_0x57eb2d,_0x5e4918){_0x57eb2d=_0x57eb2d-0x0;var _0xd8e18=_0x2ac4[_0x57eb2d];return _0xd8e18;};'use strict';var multer=require(_0x42ac('0x0'));var util=require(_0x42ac('0x1'));var path=require(_0x42ac('0x2'));var timeout=require(_0x42ac('0x3'));var express=require(_0x42ac('0x4'));var router=express[_0x42ac('0x5')]();var fs_extra=require(_0x42ac('0x6'));var auth=require(_0x42ac('0x7'));var interaction=require('../../components/interaction/service');var config=require(_0x42ac('0x8'));var controller=require(_0x42ac('0x9'));router[_0x42ac('0xa')]('/',auth[_0x42ac('0xb')](),controller[_0x42ac('0xc')]);router[_0x42ac('0xa')](_0x42ac('0xd'),auth[_0x42ac('0xb')](),controller['show']);router['post']('/',auth[_0x42ac('0xb')](),controller['create']);router[_0x42ac('0xe')]('/:id',auth[_0x42ac('0xb')](),controller[_0x42ac('0xf')]);router[_0x42ac('0x10')]('/:id',auth['isAuthenticated'](),controller[_0x42ac('0x11')]);module[_0x42ac('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 b148ceb..7ce1e17 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 _0x0304=['moment','exports','STRING','DATE','literal','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP','sequelize'];(function(_0x39ab2b,_0x3953cc){var _0x358dd9=function(_0x558477){while(--_0x558477){_0x39ab2b['push'](_0x39ab2b['shift']());}};_0x358dd9(++_0x3953cc);}(_0x0304,0x1d4));var _0x4030=function(_0x2641f9,_0x26715f){_0x2641f9=_0x2641f9-0x0;var _0x585741=_0x0304[_0x2641f9];return _0x585741;};'use strict';var Sequelize=require(_0x4030('0x0'));var moment=require(_0x4030('0x1'));module[_0x4030('0x2')]={'time':{'type':Sequelize[_0x4030('0x3')]},'callid':{'type':Sequelize[_0x4030('0x3')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x4030('0x3')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x4030('0x3')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x4030('0x3')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x4030('0x3')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize[_0x4030('0x3')],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x4030('0x3')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize[_0x4030('0x4')],'allowNull':![],'defaultValue':Sequelize[_0x4030('0x5')](_0x4030('0x6'))}}; \ No newline at end of file +var _0xb876=['moment','exports','STRING','CURRENT_TIMESTAMP\x20ON\x20UPDATE\x20CURRENT_TIMESTAMP'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xb876,0x138));var _0x6b87=function(_0x191999,_0x53d2ad){_0x191999=_0x191999-0x0;var _0xcc2c26=_0xb876[_0x191999];return _0xcc2c26;};'use strict';var Sequelize=require('sequelize');var moment=require(_0x6b87('0x0'));module[_0x6b87('0x1')]={'time':{'type':Sequelize[_0x6b87('0x2')]},'callid':{'type':Sequelize[_0x6b87('0x2')],'allowNull':![],'defaultValue':''},'queuename':{'type':Sequelize[_0x6b87('0x2')],'allowNull':![],'defaultValue':''},'agent':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'event':{'type':Sequelize[_0x6b87('0x2')],'allowNull':![],'defaultValue':''},'data':{'type':Sequelize[_0x6b87('0x2')],'allowNull':![],'defaultValue':''},'data1':{'type':Sequelize[_0x6b87('0x2')],'allowNull':![],'defaultValue':''},'data2':{'type':Sequelize[_0x6b87('0x2')],'allowNull':![],'defaultValue':''},'data3':{'type':Sequelize[_0x6b87('0x2')],'allowNull':![],'defaultValue':''},'data4':{'type':Sequelize['STRING'],'allowNull':![],'defaultValue':''},'data5':{'type':Sequelize[_0x6b87('0x2')],'allowNull':![],'defaultValue':''},'dtm':{'type':Sequelize['DATE'],'allowNull':![],'defaultValue':Sequelize['literal'](_0x6b87('0x3'))}}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.controller.js b/server/api/voiceQueuesLog/voiceQueuesLog.controller.js index 331c590..bf7a5e2 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 _0x1b40=['index','map','VoiceQueuesLog','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','order','sort','pick','filter','where','merge','VIRTUAL','includeAll','include','findAll','rows','show','params','options','find','catch','create','body','destroy','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','undefined','limit','count','offset','Content-Range','apply','then','error','name'];(function(_0x5d57fc,_0x49f7d6){var _0x2729c9=function(_0xb5463e){while(--_0xb5463e){_0x5d57fc['push'](_0x5d57fc['shift']());}};_0x2729c9(++_0x49f7d6);}(_0x1b40,0x6a));var _0x01b4=function(_0x3dda00,_0x392dca){_0x3dda00=_0x3dda00-0x0;var _0x2a6b26=_0x1b40[_0x3dda00];return _0x2a6b26;};'use strict';var emlformat=require(_0x01b4('0x0'));var rimraf=require(_0x01b4('0x1'));var zipdir=require(_0x01b4('0x2'));var jsonpatch=require(_0x01b4('0x3'));var rp=require(_0x01b4('0x4'));var moment=require('moment');var BPromise=require(_0x01b4('0x5'));var Mustache=require(_0x01b4('0x6'));var util=require(_0x01b4('0x7'));var path=require(_0x01b4('0x8'));var sox=require(_0x01b4('0x9'));var csv=require(_0x01b4('0xa'));var ejs=require(_0x01b4('0xb'));var fs=require('fs');var fs_extra=require(_0x01b4('0xc'));var _=require(_0x01b4('0xd'));var squel=require('squel');var crypto=require(_0x01b4('0xe'));var jsforce=require(_0x01b4('0xf'));var deskjs=require(_0x01b4('0x10'));var toCsv=require(_0x01b4('0xa'));var querystring=require('querystring');var Papa=require(_0x01b4('0x11'));var Redis=require(_0x01b4('0x12'));var authService=require(_0x01b4('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require('../../config/logger')(_0x01b4('0x14'));var utils=require('../../config/utils');var config=require(_0x01b4('0x15'));var licenseUtil=require(_0x01b4('0x16'));var db=require(_0x01b4('0x17'))['db'];function respondWithStatusCode(_0x2cb64b,_0x1c70f3){_0x1c70f3=_0x1c70f3||0xcc;return function(_0x1c6bb5){if(_0x1c6bb5){return _0x2cb64b[_0x01b4('0x18')](_0x1c70f3);}return _0x2cb64b[_0x01b4('0x19')](_0x1c70f3)['end']();};}function respondWithResult(_0x3db0c6,_0x5a0324){_0x5a0324=_0x5a0324||0xc8;return function(_0x342ec9){if(_0x342ec9){return _0x3db0c6[_0x01b4('0x19')](_0x5a0324)[_0x01b4('0x1a')](_0x342ec9);}};}function respondWithFilteredResult(_0x3a870e,_0x57391d){return function(_0x424913){if(_0x424913){var _0x5c222d=typeof _0x57391d['offset']===_0x01b4('0x1b')&&typeof _0x57391d[_0x01b4('0x1c')]===_0x01b4('0x1b');var _0x53745d=_0x424913[_0x01b4('0x1d')];var _0x17fbb1=_0x5c222d?0x0:_0x57391d[_0x01b4('0x1e')];var _0x3bf408=_0x5c222d?_0x424913[_0x01b4('0x1d')]:_0x57391d['offset']+_0x57391d[_0x01b4('0x1c')];var _0x59447d;if(_0x3bf408>=_0x53745d){_0x3bf408=_0x53745d;_0x59447d=0xc8;}else{_0x59447d=0xce;}_0x3a870e[_0x01b4('0x19')](_0x59447d);return _0x3a870e['set'](_0x01b4('0x1f'),_0x17fbb1+'-'+_0x3bf408+'/'+_0x53745d)[_0x01b4('0x1a')](_0x424913);}return null;};}function patchUpdates(_0x2a6cc8){return function(_0x578419){try{jsonpatch[_0x01b4('0x20')](_0x578419,_0x2a6cc8,!![]);}catch(_0x3be9e5){return BPromise['reject'](_0x3be9e5);}return _0x578419['save']();};}function saveUpdates(_0x29edf8,_0x3440c6){return function(_0x4d60e5){if(_0x4d60e5){return _0x4d60e5['update'](_0x29edf8)[_0x01b4('0x21')](function(_0x4d39c2){return _0x4d39c2;});}return null;};}function removeEntity(_0xe611c2,_0x27c343){return function(_0x30c81d){if(_0x30c81d){return _0x30c81d['destroy']()[_0x01b4('0x21')](function(){_0xe611c2[_0x01b4('0x19')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21b4cb,_0x2f5064){return function(_0x2d78e6){if(!_0x2d78e6){_0x21b4cb['sendStatus'](0x194);}return _0x2d78e6;};}function handleError(_0x26697c,_0x156105){_0x156105=_0x156105||0x1f4;return function(_0x3b1fc5){logger[_0x01b4('0x22')](_0x3b1fc5['stack']);if(_0x3b1fc5[_0x01b4('0x23')]){delete _0x3b1fc5[_0x01b4('0x23')];}_0x26697c[_0x01b4('0x19')](_0x156105)['send'](_0x3b1fc5);};}exports[_0x01b4('0x24')]=function(_0x3b5d42,_0x4e6779){var _0x464d27={},_0x1c9c13={},_0x5cd33a={'count':0x0,'rows':[]};var _0x59e260=_[_0x01b4('0x25')](db[_0x01b4('0x26')][_0x01b4('0x27')],function(_0x158dc2){return{'name':_0x158dc2['fieldName'],'type':_0x158dc2[_0x01b4('0x28')][_0x01b4('0x29')]};});_0x1c9c13[_0x01b4('0x2a')]=_['map'](_0x59e260,_0x01b4('0x23'));_0x1c9c13[_0x01b4('0x2b')]=_[_0x01b4('0x2c')](_0x3b5d42[_0x01b4('0x2b')]);_0x1c9c13[_0x01b4('0x2d')]=_[_0x01b4('0x2e')](_0x1c9c13['model'],_0x1c9c13[_0x01b4('0x2b')]);_0x464d27[_0x01b4('0x2f')]=_[_0x01b4('0x2e')](_0x1c9c13[_0x01b4('0x2a')],qs['fields'](_0x3b5d42[_0x01b4('0x2b')][_0x01b4('0x30')]));_0x464d27[_0x01b4('0x2f')]=_0x464d27[_0x01b4('0x2f')][_0x01b4('0x31')]?_0x464d27['attributes']:_0x1c9c13[_0x01b4('0x2a')];if(!_0x3b5d42[_0x01b4('0x2b')][_0x01b4('0x32')](_0x01b4('0x33'))){_0x464d27[_0x01b4('0x1c')]=qs[_0x01b4('0x1c')](_0x3b5d42[_0x01b4('0x2b')][_0x01b4('0x1c')]);_0x464d27[_0x01b4('0x1e')]=qs[_0x01b4('0x1e')](_0x3b5d42[_0x01b4('0x2b')]['offset']);}_0x464d27[_0x01b4('0x34')]=qs[_0x01b4('0x35')](_0x3b5d42['query'][_0x01b4('0x35')]);_0x464d27['where']=qs[_0x01b4('0x2d')](_[_0x01b4('0x36')](_0x3b5d42[_0x01b4('0x2b')],_0x1c9c13['filters']),_0x59e260);if(_0x3b5d42[_0x01b4('0x2b')][_0x01b4('0x37')]){_0x464d27[_0x01b4('0x38')]=_[_0x01b4('0x39')](_0x464d27[_0x01b4('0x38')],{'$or':_[_0x01b4('0x25')](_0x59e260,function(_0x29aa96){if(_0x29aa96['type']!==_0x01b4('0x3a')){var _0x48641f={};_0x48641f[_0x29aa96[_0x01b4('0x23')]]={'$like':'%'+_0x3b5d42[_0x01b4('0x2b')]['filter']+'%'};return _0x48641f;}})});}_0x464d27=_[_0x01b4('0x39')]({},_0x464d27,_0x3b5d42['options']);var _0x257345={'where':_0x464d27['where']};return db[_0x01b4('0x26')]['count'](_0x257345)[_0x01b4('0x21')](function(_0x4a2b0b){_0x5cd33a[_0x01b4('0x1d')]=_0x4a2b0b;if(_0x3b5d42[_0x01b4('0x2b')][_0x01b4('0x3b')]){_0x464d27[_0x01b4('0x3c')]=[{'all':!![]}];}return db[_0x01b4('0x26')][_0x01b4('0x3d')](_0x464d27);})[_0x01b4('0x21')](function(_0x2dd8fa){_0x5cd33a[_0x01b4('0x3e')]=_0x2dd8fa;return _0x5cd33a;})[_0x01b4('0x21')](respondWithFilteredResult(_0x4e6779,_0x464d27))['catch'](handleError(_0x4e6779,null));};exports[_0x01b4('0x3f')]=function(_0x2fca22,_0x332ead){var _0x21feee={'raw':!![],'where':{'id':_0x2fca22[_0x01b4('0x40')]['id']}},_0x54822b={};_0x54822b[_0x01b4('0x2a')]=_[_0x01b4('0x2c')](db['VoiceQueuesLog'][_0x01b4('0x27')]);_0x54822b[_0x01b4('0x2b')]=_[_0x01b4('0x2c')](_0x2fca22['query']);_0x54822b[_0x01b4('0x2d')]=_[_0x01b4('0x2e')](_0x54822b['model'],_0x54822b[_0x01b4('0x2b')]);_0x21feee['attributes']=_['intersection'](_0x54822b[_0x01b4('0x2a')],qs[_0x01b4('0x30')](_0x2fca22[_0x01b4('0x2b')][_0x01b4('0x30')]));_0x21feee[_0x01b4('0x2f')]=_0x21feee[_0x01b4('0x2f')]['length']?_0x21feee[_0x01b4('0x2f')]:_0x54822b[_0x01b4('0x2a')];if(_0x2fca22[_0x01b4('0x2b')]['includeAll']){_0x21feee[_0x01b4('0x3c')]=[{'all':!![]}];}_0x21feee=_[_0x01b4('0x39')]({},_0x21feee,_0x2fca22[_0x01b4('0x41')]);return db['VoiceQueuesLog'][_0x01b4('0x42')](_0x21feee)['then'](handleEntityNotFound(_0x332ead,null))['then'](respondWithResult(_0x332ead,null))[_0x01b4('0x43')](handleError(_0x332ead,null));};exports[_0x01b4('0x44')]=function(_0x1b7ecb,_0x34df47){return db['VoiceQueuesLog']['create'](_0x1b7ecb[_0x01b4('0x45')],{})['then'](respondWithResult(_0x34df47,0xc9))[_0x01b4('0x43')](handleError(_0x34df47,null));};exports['update']=function(_0x2f7c70,_0x56c526){if(_0x2f7c70[_0x01b4('0x45')]['id']){delete _0x2f7c70[_0x01b4('0x45')]['id'];}return db[_0x01b4('0x26')][_0x01b4('0x42')]({'where':{'id':_0x2f7c70[_0x01b4('0x40')]['id']}})['then'](handleEntityNotFound(_0x56c526,null))[_0x01b4('0x21')](saveUpdates(_0x2f7c70[_0x01b4('0x45')],null))[_0x01b4('0x21')](respondWithResult(_0x56c526,null))[_0x01b4('0x43')](handleError(_0x56c526,null));};exports[_0x01b4('0x46')]=function(_0x229251,_0x4b3a2a){return db[_0x01b4('0x26')]['find']({'where':{'id':_0x229251[_0x01b4('0x40')]['id']}})['then'](handleEntityNotFound(_0x4b3a2a,null))['then'](removeEntity(_0x4b3a2a,null))[_0x01b4('0x43')](handleError(_0x4b3a2a,null));}; \ No newline at end of file +var _0x7610=['catch','create','body','eml-format','rimraf','zip-dir','fast-json-patch','bluebird','mustache','path','sox','ejs','lodash','squel','jsforce','desk.js','to-csv','papaparse','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','set','Content-Range','json','apply','update','then','destroy','error','stack','name','send','index','map','VoiceQueuesLog','type','key','model','keys','query','filters','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','VIRTUAL','options','include','findAll','rows','show','rawAttributes','merge','find'];(function(_0x3d28af,_0x1ea2e6){var _0x1685c6=function(_0x30fd26){while(--_0x30fd26){_0x3d28af['push'](_0x3d28af['shift']());}};_0x1685c6(++_0x1ea2e6);}(_0x7610,0x123));var _0x0761=function(_0x1465c1,_0xa8fd77){_0x1465c1=_0x1465c1-0x0;var _0x104621=_0x7610[_0x1465c1];return _0x104621;};'use strict';var emlformat=require(_0x0761('0x0'));var rimraf=require(_0x0761('0x1'));var zipdir=require(_0x0761('0x2'));var jsonpatch=require(_0x0761('0x3'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0761('0x4'));var Mustache=require(_0x0761('0x5'));var util=require('util');var path=require(_0x0761('0x6'));var sox=require(_0x0761('0x7'));var csv=require('to-csv');var ejs=require(_0x0761('0x8'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x0761('0x9'));var squel=require(_0x0761('0xa'));var crypto=require('crypto');var jsforce=require(_0x0761('0xb'));var deskjs=require(_0x0761('0xc'));var toCsv=require(_0x0761('0xd'));var querystring=require('querystring');var Papa=require(_0x0761('0xe'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x0761('0xf'));var as=require(_0x0761('0x10'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0761('0x11'))('api');var utils=require(_0x0761('0x12'));var config=require(_0x0761('0x13'));var licenseUtil=require(_0x0761('0x14'));var db=require(_0x0761('0x15'))['db'];function respondWithStatusCode(_0x4f36c5,_0x138098){_0x138098=_0x138098||0xcc;return function(_0x4b501b){if(_0x4b501b){return _0x4f36c5[_0x0761('0x16')](_0x138098);}return _0x4f36c5[_0x0761('0x17')](_0x138098)[_0x0761('0x18')]();};}function respondWithResult(_0x24cd2a,_0x289005){_0x289005=_0x289005||0xc8;return function(_0x1e4865){if(_0x1e4865){return _0x24cd2a['status'](_0x289005)['json'](_0x1e4865);}};}function respondWithFilteredResult(_0x235983,_0x335bba){return function(_0x48c228){if(_0x48c228){var _0x1498a2=typeof _0x335bba[_0x0761('0x19')]===_0x0761('0x1a')&&typeof _0x335bba[_0x0761('0x1b')]===_0x0761('0x1a');var _0xd5b8b9=_0x48c228[_0x0761('0x1c')];var _0x35ebb9=_0x1498a2?0x0:_0x335bba[_0x0761('0x19')];var _0x4dcb59=_0x1498a2?_0x48c228['count']:_0x335bba[_0x0761('0x19')]+_0x335bba[_0x0761('0x1b')];var _0x2d4fb8;if(_0x4dcb59>=_0xd5b8b9){_0x4dcb59=_0xd5b8b9;_0x2d4fb8=0xc8;}else{_0x2d4fb8=0xce;}_0x235983[_0x0761('0x17')](_0x2d4fb8);return _0x235983[_0x0761('0x1d')](_0x0761('0x1e'),_0x35ebb9+'-'+_0x4dcb59+'/'+_0xd5b8b9)[_0x0761('0x1f')](_0x48c228);}return null;};}function patchUpdates(_0x5072b9){return function(_0x5c2a73){try{jsonpatch[_0x0761('0x20')](_0x5c2a73,_0x5072b9,!![]);}catch(_0xec931a){return BPromise['reject'](_0xec931a);}return _0x5c2a73['save']();};}function saveUpdates(_0x5922eb,_0x20834a){return function(_0x44ef5f){if(_0x44ef5f){return _0x44ef5f[_0x0761('0x21')](_0x5922eb)[_0x0761('0x22')](function(_0x3b14e4){return _0x3b14e4;});}return null;};}function removeEntity(_0x233d4b,_0x40bfc5){return function(_0x3bc231){if(_0x3bc231){return _0x3bc231[_0x0761('0x23')]()['then'](function(){_0x233d4b[_0x0761('0x17')](0xcc)[_0x0761('0x18')]();});}};}function handleEntityNotFound(_0x2f2d55,_0x5b6c46){return function(_0x4b5a47){if(!_0x4b5a47){_0x2f2d55['sendStatus'](0x194);}return _0x4b5a47;};}function handleError(_0x366b8b,_0x5e8532){_0x5e8532=_0x5e8532||0x1f4;return function(_0x166dc9){logger[_0x0761('0x24')](_0x166dc9[_0x0761('0x25')]);if(_0x166dc9[_0x0761('0x26')]){delete _0x166dc9[_0x0761('0x26')];}_0x366b8b[_0x0761('0x17')](_0x5e8532)[_0x0761('0x27')](_0x166dc9);};}exports[_0x0761('0x28')]=function(_0x5db5b3,_0x197f36){var _0x11362a={},_0xe29010={},_0x62cbd={'count':0x0,'rows':[]};var _0x4451ba=_[_0x0761('0x29')](db[_0x0761('0x2a')]['rawAttributes'],function(_0x12e490){return{'name':_0x12e490['fieldName'],'type':_0x12e490[_0x0761('0x2b')][_0x0761('0x2c')]};});_0xe29010[_0x0761('0x2d')]=_[_0x0761('0x29')](_0x4451ba,_0x0761('0x26'));_0xe29010['query']=_[_0x0761('0x2e')](_0x5db5b3[_0x0761('0x2f')]);_0xe29010[_0x0761('0x30')]=_['intersection'](_0xe29010[_0x0761('0x2d')],_0xe29010[_0x0761('0x2f')]);_0x11362a[_0x0761('0x31')]=_[_0x0761('0x32')](_0xe29010[_0x0761('0x2d')],qs[_0x0761('0x33')](_0x5db5b3[_0x0761('0x2f')]['fields']));_0x11362a[_0x0761('0x31')]=_0x11362a[_0x0761('0x31')][_0x0761('0x34')]?_0x11362a[_0x0761('0x31')]:_0xe29010[_0x0761('0x2d')];if(!_0x5db5b3[_0x0761('0x2f')][_0x0761('0x35')](_0x0761('0x36'))){_0x11362a['limit']=qs[_0x0761('0x1b')](_0x5db5b3[_0x0761('0x2f')]['limit']);_0x11362a['offset']=qs['offset'](_0x5db5b3[_0x0761('0x2f')][_0x0761('0x19')]);}_0x11362a[_0x0761('0x37')]=qs[_0x0761('0x38')](_0x5db5b3[_0x0761('0x2f')][_0x0761('0x38')]);_0x11362a[_0x0761('0x39')]=qs['filters'](_[_0x0761('0x3a')](_0x5db5b3[_0x0761('0x2f')],_0xe29010[_0x0761('0x30')]),_0x4451ba);if(_0x5db5b3['query'][_0x0761('0x3b')]){_0x11362a[_0x0761('0x39')]=_['merge'](_0x11362a[_0x0761('0x39')],{'$or':_[_0x0761('0x29')](_0x4451ba,function(_0x5bd787){if(_0x5bd787[_0x0761('0x2b')]!==_0x0761('0x3c')){var _0x5bc7be={};_0x5bc7be[_0x5bd787['name']]={'$like':'%'+_0x5db5b3[_0x0761('0x2f')][_0x0761('0x3b')]+'%'};return _0x5bc7be;}})});}_0x11362a=_['merge']({},_0x11362a,_0x5db5b3[_0x0761('0x3d')]);var _0x5f379c={'where':_0x11362a[_0x0761('0x39')]};return db[_0x0761('0x2a')][_0x0761('0x1c')](_0x5f379c)[_0x0761('0x22')](function(_0x1fb51a){_0x62cbd['count']=_0x1fb51a;if(_0x5db5b3[_0x0761('0x2f')]['includeAll']){_0x11362a[_0x0761('0x3e')]=[{'all':!![]}];}return db[_0x0761('0x2a')][_0x0761('0x3f')](_0x11362a);})[_0x0761('0x22')](function(_0x54d7c6){_0x62cbd[_0x0761('0x40')]=_0x54d7c6;return _0x62cbd;})[_0x0761('0x22')](respondWithFilteredResult(_0x197f36,_0x11362a))['catch'](handleError(_0x197f36,null));};exports[_0x0761('0x41')]=function(_0x54024d,_0x27426d){var _0x5a5cf3={'raw':!![],'where':{'id':_0x54024d['params']['id']}},_0x193023={};_0x193023[_0x0761('0x2d')]=_[_0x0761('0x2e')](db[_0x0761('0x2a')][_0x0761('0x42')]);_0x193023['query']=_[_0x0761('0x2e')](_0x54024d[_0x0761('0x2f')]);_0x193023[_0x0761('0x30')]=_[_0x0761('0x32')](_0x193023[_0x0761('0x2d')],_0x193023[_0x0761('0x2f')]);_0x5a5cf3[_0x0761('0x31')]=_[_0x0761('0x32')](_0x193023[_0x0761('0x2d')],qs[_0x0761('0x33')](_0x54024d['query'][_0x0761('0x33')]));_0x5a5cf3[_0x0761('0x31')]=_0x5a5cf3[_0x0761('0x31')][_0x0761('0x34')]?_0x5a5cf3[_0x0761('0x31')]:_0x193023['model'];if(_0x54024d['query']['includeAll']){_0x5a5cf3[_0x0761('0x3e')]=[{'all':!![]}];}_0x5a5cf3=_[_0x0761('0x43')]({},_0x5a5cf3,_0x54024d[_0x0761('0x3d')]);return db[_0x0761('0x2a')][_0x0761('0x44')](_0x5a5cf3)[_0x0761('0x22')](handleEntityNotFound(_0x27426d,null))[_0x0761('0x22')](respondWithResult(_0x27426d,null))[_0x0761('0x45')](handleError(_0x27426d,null));};exports['create']=function(_0x2d8271,_0x37003f){return db['VoiceQueuesLog'][_0x0761('0x46')](_0x2d8271[_0x0761('0x47')],{})['then'](respondWithResult(_0x37003f,0xc9))[_0x0761('0x45')](handleError(_0x37003f,null));};exports[_0x0761('0x21')]=function(_0xc83317,_0x5384eb){if(_0xc83317[_0x0761('0x47')]['id']){delete _0xc83317[_0x0761('0x47')]['id'];}return db[_0x0761('0x2a')][_0x0761('0x44')]({'where':{'id':_0xc83317['params']['id']}})[_0x0761('0x22')](handleEntityNotFound(_0x5384eb,null))['then'](saveUpdates(_0xc83317[_0x0761('0x47')],null))[_0x0761('0x22')](respondWithResult(_0x5384eb,null))[_0x0761('0x45')](handleError(_0x5384eb,null));};exports[_0x0761('0x23')]=function(_0x59d9a1,_0x6001de){return db[_0x0761('0x2a')][_0x0761('0x44')]({'where':{'id':_0x59d9a1['params']['id']}})[_0x0761('0x22')](handleEntityNotFound(_0x6001de,null))[_0x0761('0x22')](removeEntity(_0x6001de,null))[_0x0761('0x45')](handleError(_0x6001de,null));}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.model.js b/server/api/voiceQueuesLog/voiceQueuesLog.model.js index 3fb5d32..cce3535 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 _0x2035=['event_dtm','event','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog'];(function(_0x19e35c,_0x29cd1e){var _0x3e1fe8=function(_0x17258b){while(--_0x17258b){_0x19e35c['push'](_0x19e35c['shift']());}};_0x3e1fe8(++_0x29cd1e);}(_0x2035,0xb2));var _0x5203=function(_0x19a531,_0x3daec8){_0x19a531=_0x19a531-0x0;var _0x4caa1d=_0x2035[_0x19a531];return _0x4caa1d;};'use strict';var _=require(_0x5203('0x0'));var util=require(_0x5203('0x1'));var logger=require(_0x5203('0x2'))(_0x5203('0x3'));var moment=require(_0x5203('0x4'));var BPromise=require(_0x5203('0x5'));var rp=require(_0x5203('0x6'));var fs=require('fs');var path=require(_0x5203('0x7'));var rimraf=require(_0x5203('0x8'));var config=require(_0x5203('0x9'));var attributes=require(_0x5203('0xa'));module[_0x5203('0xb')]=function(_0x3f37a7,_0x63aca4){return _0x3f37a7[_0x5203('0xc')](_0x5203('0xd'),attributes,{'tableName':'voice_queues_log','paranoid':![],'indexes':[{'name':_0x5203('0xe'),'fields':[_0x5203('0xf'),'dtm']}],'timestamps':![]});}; \ No newline at end of file +var _0x3ee9=['event_dtm','event','dtm','lodash','api','bluebird','request-promise','path','rimraf','../../config/environment','./voiceQueuesLog.attributes','exports','define','VoiceQueuesLog','voice_queues_log'];(function(_0x51ab3e,_0x567f3e){var _0x338a44=function(_0x4bd944){while(--_0x4bd944){_0x51ab3e['push'](_0x51ab3e['shift']());}};_0x338a44(++_0x567f3e);}(_0x3ee9,0xd5));var _0x93ee=function(_0x51b28f,_0x20f46c){_0x51b28f=_0x51b28f-0x0;var _0x2c3885=_0x3ee9[_0x51b28f];return _0x2c3885;};'use strict';var _=require(_0x93ee('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x93ee('0x1'));var moment=require('moment');var BPromise=require(_0x93ee('0x2'));var rp=require(_0x93ee('0x3'));var fs=require('fs');var path=require(_0x93ee('0x4'));var rimraf=require(_0x93ee('0x5'));var config=require(_0x93ee('0x6'));var attributes=require(_0x93ee('0x7'));module[_0x93ee('0x8')]=function(_0x24002b,_0x144bd4){return _0x24002b[_0x93ee('0x9')](_0x93ee('0xa'),attributes,{'tableName':_0x93ee('0xb'),'paranoid':![],'indexes':[{'name':_0x93ee('0xc'),'fields':[_0x93ee('0xd'),_0x93ee('0xe')]}],'timestamps':![]});}; \ No newline at end of file diff --git a/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js b/server/api/voiceQueuesLog/voiceQueuesLog.rpc.js index fc2a93b..ed6e727 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 _0xe373=['VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify','error','code','message','request\x20sent','result','catch','lodash','util','moment','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','VoiceQueuesLog,\x20%s,\x20%s','debug'];(function(_0x356bb3,_0x23fdf6){var _0x3392f9=function(_0x4fd2d4){while(--_0x4fd2d4){_0x356bb3['push'](_0x356bb3['shift']());}};_0x3392f9(++_0x23fdf6);}(_0xe373,0x11c));var _0x3e37=function(_0x544f28,_0x12f685){_0x544f28=_0x544f28-0x0;var _0x1867bb=_0xe373[_0x544f28];return _0x1867bb;};'use strict';var _=require(_0x3e37('0x0'));var util=require(_0x3e37('0x1'));var moment=require(_0x3e37('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3e37('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x3e37('0x4'));var logger=require(_0x3e37('0x5'))(_0x3e37('0x6'));var config=require(_0x3e37('0x7'));var jayson=require(_0x3e37('0x8'));var client=jayson[_0x3e37('0x9')][_0x3e37('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x42d6e3,_0x2e8fc8,_0x563c98){return new BPromise(function(_0x5e2509,_0x435f3f){return client[_0x3e37('0xb')](_0x42d6e3,_0x563c98)['then'](function(_0x45c876){logger[_0x3e37('0xc')](_0x3e37('0xd'),_0x2e8fc8,'request\x20sent');logger[_0x3e37('0xe')](_0x3e37('0xf'),_0x2e8fc8,'request\x20sent',JSON[_0x3e37('0x10')](_0x45c876));if(_0x45c876['error']){if(_0x45c876[_0x3e37('0x11')][_0x3e37('0x12')]===0x1f4){logger[_0x3e37('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2e8fc8,_0x45c876['error']['message']);return _0x435f3f(_0x45c876[_0x3e37('0x11')][_0x3e37('0x13')]);}logger[_0x3e37('0x11')]('VoiceQueuesLog,\x20%s,\x20%s',_0x2e8fc8,_0x45c876['error'][_0x3e37('0x13')]);return _0x5e2509(_0x45c876[_0x3e37('0x11')][_0x3e37('0x13')]);}else{logger['info'](_0x3e37('0xd'),_0x2e8fc8,_0x3e37('0x14'));_0x5e2509(_0x45c876[_0x3e37('0x15')][_0x3e37('0x13')]);}})[_0x3e37('0x16')](function(_0x4d1794){logger['error'](_0x3e37('0xd'),_0x2e8fc8,_0x4d1794);_0x435f3f(_0x4d1794);});});} \ No newline at end of file +var _0x7701=['error','message','result','catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','jayson/promise','client','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x593acf,_0x2172be){var _0x247d38=function(_0x177d7e){while(--_0x177d7e){_0x593acf['push'](_0x593acf['shift']());}};_0x247d38(++_0x2172be);}(_0x7701,0xc2));var _0x1770=function(_0x3af4e5,_0x3009b0){_0x3af4e5=_0x3af4e5-0x0;var _0x31d2be=_0x7701[_0x3af4e5];return _0x31d2be;};'use strict';var _=require(_0x1770('0x0'));var util=require(_0x1770('0x1'));var moment=require(_0x1770('0x2'));var BPromise=require(_0x1770('0x3'));var rs=require(_0x1770('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1770('0x5'))['db'];var utils=require(_0x1770('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x1770('0x7'));var client=jayson[_0x1770('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1311c2,_0x18b2bb,_0x505bfa){return new BPromise(function(_0x433c9f,_0x442af9){return client['request'](_0x1311c2,_0x505bfa)['then'](function(_0x1641ef){logger[_0x1770('0x9')](_0x1770('0xa'),_0x18b2bb,_0x1770('0xb'));logger[_0x1770('0xc')](_0x1770('0xd'),_0x18b2bb,_0x1770('0xb'),JSON[_0x1770('0xe')](_0x1641ef));if(_0x1641ef[_0x1770('0xf')]){if(_0x1641ef[_0x1770('0xf')]['code']===0x1f4){logger[_0x1770('0xf')](_0x1770('0xa'),_0x18b2bb,_0x1641ef['error']['message']);return _0x442af9(_0x1641ef[_0x1770('0xf')][_0x1770('0x10')]);}logger[_0x1770('0xf')](_0x1770('0xa'),_0x18b2bb,_0x1641ef[_0x1770('0xf')]['message']);return _0x433c9f(_0x1641ef['error'][_0x1770('0x10')]);}else{logger[_0x1770('0x9')](_0x1770('0xa'),_0x18b2bb,_0x1770('0xb'));_0x433c9f(_0x1641ef[_0x1770('0x11')]['message']);}})[_0x1770('0x12')](function(_0x441705){logger[_0x1770('0xf')](_0x1770('0xa'),_0x18b2bb,_0x441705);_0x442af9(_0x441705);});});} \ No newline at end of file diff --git a/server/api/voiceRecording/index.js b/server/api/voiceRecording/index.js index b551504..e4772bd 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 _0x8233=['get','index','isAuthenticated','/:id','show','download','/:id/downloads','/:id/transcribe','post','create','runTranscribe','put','update','delete','destroy','multer','connect-timeout','express','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceRecording.controller'];(function(_0x56b6f4,_0x5ac889){var _0x51cca8=function(_0x471e68){while(--_0x471e68){_0x56b6f4['push'](_0x56b6f4['shift']());}};_0x51cca8(++_0x5ac889);}(_0x8233,0x1b1));var _0x3823=function(_0x359ad3,_0x1b636e){_0x359ad3=_0x359ad3-0x0;var _0x1c403e=_0x8233[_0x359ad3];return _0x1c403e;};'use strict';var multer=require(_0x3823('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x3823('0x1'));var express=require(_0x3823('0x2'));var router=express['Router']();var fs_extra=require('fs-extra');var auth=require(_0x3823('0x3'));var interaction=require(_0x3823('0x4'));var config=require(_0x3823('0x5'));var controller=require(_0x3823('0x6'));router[_0x3823('0x7')]('/',auth['isAuthenticated'](),controller[_0x3823('0x8')]);router[_0x3823('0x7')]('/describe',auth[_0x3823('0x9')](),controller['describe']);router[_0x3823('0x7')](_0x3823('0xa'),auth[_0x3823('0x9')](),controller[_0x3823('0xb')]);router[_0x3823('0x7')]('/:id/download',auth[_0x3823('0x9')](),controller[_0x3823('0xc')]);router[_0x3823('0x7')](_0x3823('0xd'),controller['downloads']);router[_0x3823('0x7')](_0x3823('0xe'),auth[_0x3823('0x9')](),controller['downloadTranscribe']);router[_0x3823('0xf')]('/',auth[_0x3823('0x9')](),controller[_0x3823('0x10')]);router[_0x3823('0xf')](_0x3823('0xe'),auth[_0x3823('0x9')](),controller[_0x3823('0x11')]);router[_0x3823('0x12')](_0x3823('0xa'),auth[_0x3823('0x9')](),controller[_0x3823('0x13')]);router[_0x3823('0x14')]('/:id',auth[_0x3823('0x9')](),controller[_0x3823('0x15')]);module['exports']=router; \ No newline at end of file +var _0x2f49=['connect-timeout','express','Router','../../components/auth/service','../../config/environment','get','isAuthenticated','index','/describe','describe','show','/:id/download','download','/:id/downloads','downloads','/:id/transcribe','downloadTranscribe','post','runTranscribe','delete','/:id','destroy','exports','multer','util','path'];(function(_0x6131cd,_0x4c26a1){var _0x47e916=function(_0x1f2bce){while(--_0x1f2bce){_0x6131cd['push'](_0x6131cd['shift']());}};_0x47e916(++_0x4c26a1);}(_0x2f49,0x1d1));var _0x92f4=function(_0x27153b,_0x32efeb){_0x27153b=_0x27153b-0x0;var _0x399933=_0x2f49[_0x27153b];return _0x399933;};'use strict';var multer=require(_0x92f4('0x0'));var util=require(_0x92f4('0x1'));var path=require(_0x92f4('0x2'));var timeout=require(_0x92f4('0x3'));var express=require(_0x92f4('0x4'));var router=express[_0x92f4('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0x92f4('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0x92f4('0x7'));var controller=require('./voiceRecording.controller');router[_0x92f4('0x8')]('/',auth[_0x92f4('0x9')](),controller[_0x92f4('0xa')]);router[_0x92f4('0x8')](_0x92f4('0xb'),auth['isAuthenticated'](),controller[_0x92f4('0xc')]);router['get']('/:id',auth[_0x92f4('0x9')](),controller[_0x92f4('0xd')]);router[_0x92f4('0x8')](_0x92f4('0xe'),auth[_0x92f4('0x9')](),controller[_0x92f4('0xf')]);router['get'](_0x92f4('0x10'),controller[_0x92f4('0x11')]);router[_0x92f4('0x8')](_0x92f4('0x12'),auth['isAuthenticated'](),controller[_0x92f4('0x13')]);router[_0x92f4('0x14')]('/',auth[_0x92f4('0x9')](),controller['create']);router[_0x92f4('0x14')](_0x92f4('0x12'),auth[_0x92f4('0x9')](),controller[_0x92f4('0x15')]);router['put']('/:id',auth['isAuthenticated'](),controller['update']);router[_0x92f4('0x16')](_0x92f4('0x17'),auth[_0x92f4('0x9')](),controller[_0x92f4('0x18')]);module[_0x92f4('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 2a6de43..8756218 100644 --- a/server/api/voiceRecording/voiceRecording.attributes.js +++ b/server/api/voiceRecording/voiceRecording.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x13d07a,_0x41efc3){var _0x5ee0ee=function(_0x4ca94a){while(--_0x4ca94a){_0x13d07a['push'](_0x13d07a['shift']());}};_0x5ee0ee(++_0x41efc3);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file +var _0xa9e0=['DATE','updatedAt','toString','sequelize','moment','path','getDataValue','extname','value','STRING','setDataValue','channel','TEXT','NEW','FLOAT','BOOLEAN','format','MM-DD-YYYY\x20HH:mm'];(function(_0x263a74,_0xc31414){var _0x2aa86c=function(_0x382896){while(--_0x382896){_0x263a74['push'](_0x263a74['shift']());}};_0x2aa86c(++_0xc31414);}(_0xa9e0,0x123));var _0x0a9e=function(_0x6131cd,_0x4c26a1){_0x6131cd=_0x6131cd-0x0;var _0x47e916=_0xa9e0[_0x6131cd];return _0x47e916;};'use strict';var Sequelize=require(_0x0a9e('0x0'));var moment=require(_0x0a9e('0x1'));var path=require(_0x0a9e('0x2'));module['exports']={'format':{'type':Sequelize['VIRTUAL'],'get':function(){return this[_0x0a9e('0x3')]('value')?path[_0x0a9e('0x4')](this[_0x0a9e('0x3')](_0x0a9e('0x5'))):undefined;}},'uniqueid':{'type':Sequelize[_0x0a9e('0x6')]},'channel':{'type':Sequelize[_0x0a9e('0x6')],'set':function(_0x57b080){if(_0x57b080){this[_0x0a9e('0x7')](_0x0a9e('0x8'),_0x57b080);this[_0x0a9e('0x7')]('membername',_0x57b080['split'](/\/|-/)[0x1]);}}},'membername':{'type':Sequelize[_0x0a9e('0x6')]},'calleridnum':{'type':Sequelize['STRING']},'calleridname':{'type':Sequelize['STRING']},'connectedlinenum':{'type':Sequelize[_0x0a9e('0x6')]},'connectedlinename':{'type':Sequelize[_0x0a9e('0x6')]},'accountcode':{'type':Sequelize[_0x0a9e('0x6')]},'context':{'type':Sequelize[_0x0a9e('0x6')]},'exten':{'type':Sequelize[_0x0a9e('0x6')]},'value':{'type':Sequelize[_0x0a9e('0x6')]},'type':{'type':Sequelize['STRING']},'rating':{'type':Sequelize['INTEGER'],'validate':{'max':0x5,'min':0x0}},'queue':{'type':Sequelize['STRING']},'userDisposition':{'type':Sequelize['STRING']},'userSecondDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'userThirdDisposition':{'type':Sequelize[_0x0a9e('0x6')]},'location':{'type':Sequelize[_0x0a9e('0x9')]},'transcribeName':{'type':Sequelize[_0x0a9e('0x6')]},'transcribeStatus':{'type':Sequelize[_0x0a9e('0x6')],'defaultValue':_0x0a9e('0xa')},'fileUri':{'type':Sequelize['TEXT']},'fileText':{'type':Sequelize[_0x0a9e('0x9')]},'failureReason':{'type':Sequelize[_0x0a9e('0x9')]},'sentiment':{'type':Sequelize[_0x0a9e('0x6')]},'sPositive':{'type':Sequelize[_0x0a9e('0xb')]},'sNegative':{'type':Sequelize[_0x0a9e('0xb')]},'sNeutral':{'type':Sequelize[_0x0a9e('0xb')]},'sMixed':{'type':Sequelize['FLOAT']},'tempSentiment':{'type':Sequelize[_0x0a9e('0xc')],'defaultValue':![]},'createdAt':{'type':Sequelize['DATE'],'get':function(){return moment(this[_0x0a9e('0x3')]('createdAt'))[_0x0a9e('0xd')](_0x0a9e('0xe'))['toString']();}},'updatedAt':{'type':Sequelize[_0x0a9e('0xf')],'get':function(){return moment(this['getDataValue'](_0x0a9e('0x10')))[_0x0a9e('0xd')](_0x0a9e('0xe'))[_0x0a9e('0x11')]();}}}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.controller.js b/server/api/voiceRecording/voiceRecording.controller.js index 99c3e14..09cc7a8 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 _0x1d71=['TranscriptionJobName','transcribeStatus','TranscriptionJobStatus','runTranscribe','findOne','Voice\x20Recording\x20not\x20found','transcribe','transcribeAccountId','language','runSentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','Cloud\x20Provider\x20not\x20available','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','Name','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','NEW','IN_PROGRESS','tempSentiment','updateAttributes','writeFile','downloadTranscribe','fileText','root','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','aws-sdk','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','update','then','stack','name','index','map','VoiceRecording','fieldName','type','key','model','differenceBy','format','query','keys','intersection','attributes','fields','length','hasOwnProperty','order','sort','where','filters','pick','merge','filter','options','includeAll','include','findAll','rows','catch','show','find','create','body','params','describe','download','../../components/encryptor','uniqueid','existsSync','decryptFile','recording','Sequelize','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','Not\x20found','downloads','sequelize','$and','value','%s.cypher','secrets','destroy','isNil','Entity\x20not\x20found','info','cancellazione\x20fisica\x20documento\x20%s','File:\x20\x22','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','unlinkSync','listBuckets','createBucket','upload','TranscribeService','basename','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','Location','bucket','Bucket','location','[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJob'];(function(_0x1214e4,_0x1cb35c){var _0x1250f6=function(_0x4e6d4a){while(--_0x4e6d4a){_0x1214e4['push'](_0x1214e4['shift']());}};_0x1250f6(++_0x1cb35c);}(_0x1d71,0xb8));var _0x11d7=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x1d71[_0x3dd15e];return _0x231fd0;};'use strict';var emlformat=require(_0x11d7('0x0'));var rimraf=require(_0x11d7('0x1'));var zipdir=require(_0x11d7('0x2'));var jsonpatch=require(_0x11d7('0x3'));var rp=require(_0x11d7('0x4'));var moment=require(_0x11d7('0x5'));var BPromise=require(_0x11d7('0x6'));var Mustache=require(_0x11d7('0x7'));var util=require(_0x11d7('0x8'));var path=require(_0x11d7('0x9'));var sox=require(_0x11d7('0xa'));var csv=require(_0x11d7('0xb'));var ejs=require(_0x11d7('0xc'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x11d7('0xd'));var squel=require(_0x11d7('0xe'));var crypto=require(_0x11d7('0xf'));var jsforce=require(_0x11d7('0x10'));var deskjs=require(_0x11d7('0x11'));var toCsv=require(_0x11d7('0xb'));var querystring=require(_0x11d7('0x12'));var Papa=require(_0x11d7('0x13'));var AWS=require(_0x11d7('0x14'));var uuidv4=require('uuid/v4');var Redis=require(_0x11d7('0x15'));var authService=require(_0x11d7('0x16'));var qs=require('../../components/parsers/qs');var as=require(_0x11d7('0x17'));var hardwareService=require(_0x11d7('0x18'));var logger=require(_0x11d7('0x19'))(_0x11d7('0x1a'));var utils=require(_0x11d7('0x1b'));var config=require(_0x11d7('0x1c'));var licenseUtil=require(_0x11d7('0x1d'));var db=require(_0x11d7('0x1e'))['db'];function respondWithStatusCode(_0x3ddaa5,_0x167211){_0x167211=_0x167211||0xcc;return function(_0x18d0c3){if(_0x18d0c3){return _0x3ddaa5[_0x11d7('0x1f')](_0x167211);}return _0x3ddaa5[_0x11d7('0x20')](_0x167211)[_0x11d7('0x21')]();};}function respondWithResult(_0x35429b,_0x1c9334){_0x1c9334=_0x1c9334||0xc8;return function(_0x58538a){if(_0x58538a){return _0x35429b[_0x11d7('0x20')](_0x1c9334)[_0x11d7('0x22')](_0x58538a);}};}function respondWithFilteredResult(_0x4e4886,_0x4aebe8){return function(_0x47bc85){if(_0x47bc85){var _0x1f620e=typeof _0x4aebe8[_0x11d7('0x23')]===_0x11d7('0x24')&&typeof _0x4aebe8[_0x11d7('0x25')]==='undefined';var _0x55ccd2=_0x47bc85['count'];var _0x3c8f57=_0x1f620e?0x0:_0x4aebe8['offset'];var _0x230010=_0x1f620e?_0x47bc85[_0x11d7('0x26')]:_0x4aebe8[_0x11d7('0x23')]+_0x4aebe8[_0x11d7('0x25')];var _0x460db2;if(_0x230010>=_0x55ccd2){_0x230010=_0x55ccd2;_0x460db2=0xc8;}else{_0x460db2=0xce;}_0x4e4886[_0x11d7('0x20')](_0x460db2);return _0x4e4886['set'](_0x11d7('0x27'),_0x3c8f57+'-'+_0x230010+'/'+_0x55ccd2)[_0x11d7('0x22')](_0x47bc85);}return null;};}function patchUpdates(_0x1bec34){return function(_0x26c0ab){try{jsonpatch['apply'](_0x26c0ab,_0x1bec34,!![]);}catch(_0x213e98){return BPromise[_0x11d7('0x28')](_0x213e98);}return _0x26c0ab['save']();};}function saveUpdates(_0x15dfe3,_0x43dc19){return function(_0x53e7f1){if(_0x53e7f1){return _0x53e7f1[_0x11d7('0x29')](_0x15dfe3)[_0x11d7('0x2a')](function(_0x1c4a46){return _0x1c4a46;});}return null;};}function removeEntity(_0x4963ab,_0x72829e){return function(_0xc648fd){if(_0xc648fd){return _0xc648fd['destroy']()[_0x11d7('0x2a')](function(){_0x4963ab[_0x11d7('0x20')](0xcc)['end']();});}};}function handleEntityNotFound(_0x52d5c7,_0x2d5cf8){return function(_0x2e17fd){if(!_0x2e17fd){_0x52d5c7['sendStatus'](0x194);}return _0x2e17fd;};}function handleError(_0x3d3928,_0x454981){_0x454981=_0x454981||0x1f4;return function(_0x970d16){logger['error'](_0x970d16[_0x11d7('0x2b')]);if(_0x970d16[_0x11d7('0x2c')]){delete _0x970d16['name'];}_0x3d3928[_0x11d7('0x20')](_0x454981)['send'](_0x970d16);};}exports[_0x11d7('0x2d')]=function(_0x105773,_0x52e1a4){var _0x4419b6={},_0x2066ad={},_0x474fbf={'count':0x0,'rows':[]};var _0x4adc19=_[_0x11d7('0x2e')](db[_0x11d7('0x2f')]['rawAttributes'],function(_0xcc98bf){return{'name':_0xcc98bf[_0x11d7('0x30')],'type':_0xcc98bf[_0x11d7('0x31')][_0x11d7('0x32')]};});_0x2066ad[_0x11d7('0x33')]=_[_0x11d7('0x34')](_[_0x11d7('0x2e')](_0x4adc19,_0x11d7('0x2c')),[_0x11d7('0x35')]);_0x2066ad[_0x11d7('0x36')]=_[_0x11d7('0x37')](_0x105773[_0x11d7('0x36')]);_0x2066ad['filters']=_[_0x11d7('0x38')](_0x2066ad[_0x11d7('0x33')],_0x2066ad[_0x11d7('0x36')]);_0x4419b6[_0x11d7('0x39')]=_[_0x11d7('0x38')](_0x2066ad[_0x11d7('0x33')],qs[_0x11d7('0x3a')](_0x105773['query'][_0x11d7('0x3a')]));_0x4419b6[_0x11d7('0x39')]=_0x4419b6[_0x11d7('0x39')][_0x11d7('0x3b')]?_0x4419b6['attributes']:_0x2066ad[_0x11d7('0x33')];if(!_0x105773[_0x11d7('0x36')][_0x11d7('0x3c')]('nolimit')){_0x4419b6[_0x11d7('0x25')]=qs['limit'](_0x105773[_0x11d7('0x36')][_0x11d7('0x25')]);_0x4419b6['offset']=qs[_0x11d7('0x23')](_0x105773[_0x11d7('0x36')][_0x11d7('0x23')]);}_0x4419b6[_0x11d7('0x3d')]=qs['sort'](_0x105773[_0x11d7('0x36')][_0x11d7('0x3e')]);_0x4419b6[_0x11d7('0x3f')]=qs[_0x11d7('0x40')](_[_0x11d7('0x41')](_0x105773[_0x11d7('0x36')],_0x2066ad['filters']),_0x4adc19);if(_0x105773[_0x11d7('0x36')]['filter']){_0x4419b6[_0x11d7('0x3f')]=_[_0x11d7('0x42')](_0x4419b6[_0x11d7('0x3f')],{'$or':_[_0x11d7('0x2e')](_0x4adc19,function(_0x55271d){if(_0x55271d[_0x11d7('0x31')]!=='VIRTUAL'){var _0x3607ee={};_0x3607ee[_0x55271d[_0x11d7('0x2c')]]={'$like':'%'+_0x105773[_0x11d7('0x36')][_0x11d7('0x43')]+'%'};return _0x3607ee;}})});}_0x4419b6=_[_0x11d7('0x42')]({},_0x4419b6,_0x105773[_0x11d7('0x44')]);var _0x85d094={'where':_0x4419b6[_0x11d7('0x3f')]};return db[_0x11d7('0x2f')][_0x11d7('0x26')](_0x85d094)[_0x11d7('0x2a')](function(_0x341c59){_0x474fbf[_0x11d7('0x26')]=_0x341c59;if(_0x105773[_0x11d7('0x36')][_0x11d7('0x45')]){_0x4419b6[_0x11d7('0x46')]=[{'all':!![]}];}return db[_0x11d7('0x2f')][_0x11d7('0x47')](_0x4419b6);})[_0x11d7('0x2a')](function(_0x52feef){_0x474fbf[_0x11d7('0x48')]=_0x52feef;return _0x474fbf;})['then'](respondWithFilteredResult(_0x52e1a4,_0x4419b6))[_0x11d7('0x49')](handleError(_0x52e1a4,null));};exports[_0x11d7('0x4a')]=function(_0x15a907,_0x524242){var _0x3aa63a={'raw':![],'where':{'id':_0x15a907['params']['id']}},_0x1eed86={};_0x1eed86['model']=_[_0x11d7('0x37')](db[_0x11d7('0x2f')]['rawAttributes']);_0x1eed86[_0x11d7('0x36')]=_[_0x11d7('0x37')](_0x15a907[_0x11d7('0x36')]);_0x1eed86[_0x11d7('0x40')]=_[_0x11d7('0x38')](_0x1eed86[_0x11d7('0x33')],_0x1eed86[_0x11d7('0x36')]);_0x3aa63a[_0x11d7('0x39')]=_[_0x11d7('0x38')](_0x1eed86['model'],qs[_0x11d7('0x3a')](_0x15a907[_0x11d7('0x36')][_0x11d7('0x3a')]));_0x3aa63a[_0x11d7('0x39')]=_0x3aa63a[_0x11d7('0x39')]['length']?_0x3aa63a[_0x11d7('0x39')]:_0x1eed86[_0x11d7('0x33')];if(_0x15a907[_0x11d7('0x36')][_0x11d7('0x45')]){_0x3aa63a[_0x11d7('0x46')]=[{'all':!![]}];}_0x3aa63a=_[_0x11d7('0x42')]({},_0x3aa63a,_0x15a907[_0x11d7('0x44')]);return db[_0x11d7('0x2f')][_0x11d7('0x4b')](_0x3aa63a)[_0x11d7('0x2a')](handleEntityNotFound(_0x524242,null))[_0x11d7('0x2a')](respondWithResult(_0x524242,null))['catch'](handleError(_0x524242,null));};exports[_0x11d7('0x4c')]=function(_0x5af27d,_0x98316f){return db[_0x11d7('0x2f')][_0x11d7('0x4c')](_0x5af27d[_0x11d7('0x4d')],{})[_0x11d7('0x2a')](respondWithResult(_0x98316f,0xc9))[_0x11d7('0x49')](handleError(_0x98316f,null));};exports[_0x11d7('0x29')]=function(_0x349f81,_0x444fdd){if(_0x349f81[_0x11d7('0x4d')]['id']){delete _0x349f81[_0x11d7('0x4d')]['id'];}return db[_0x11d7('0x2f')][_0x11d7('0x4b')]({'where':{'id':_0x349f81[_0x11d7('0x4e')]['id']}})['then'](handleEntityNotFound(_0x444fdd,null))[_0x11d7('0x2a')](saveUpdates(_0x349f81[_0x11d7('0x4d')],null))[_0x11d7('0x2a')](respondWithResult(_0x444fdd,null))['catch'](handleError(_0x444fdd,null));};exports[_0x11d7('0x4f')]=function(_0x270027,_0x34d057){return db[_0x11d7('0x2f')][_0x11d7('0x4f')]()['then'](respondWithResult(_0x34d057,null))[_0x11d7('0x49')](handleError(_0x34d057,null));};exports[_0x11d7('0x50')]=function(_0x22d8ed,_0x23ad34,_0x3c6eba){var _0x332c17=require(_0x11d7('0x51'));var _0x5b2fd4=![];var _0x5f1e91={};if(_0x22d8ed['query'][_0x11d7('0x31')]&&_0x22d8ed['query']['type']===_0x11d7('0x52')){_0x5f1e91['uniqueid']=_0x22d8ed[_0x11d7('0x4e')]['id'];}else{_0x5f1e91['id']=_0x22d8ed[_0x11d7('0x4e')]['id'];}return db['VoiceRecording'][_0x11d7('0x4b')]({'where':_0x5f1e91,'attributes':['id','value'],'raw':!![]})[_0x11d7('0x2a')](handleEntityNotFound(_0x23ad34,null))[_0x11d7('0x2a')](function(_0x2dec81){if(_0x2dec81){var _0x3a0c80=_0x2dec81['value'];var _0x396f90=util['format']('%s.cypher',_0x3a0c80);if(fs[_0x11d7('0x53')](_0x396f90)){_0x5b2fd4=!![];return _0x332c17[_0x11d7('0x54')](_0x396f90,_0x3a0c80,config['secrets'][_0x11d7('0x55')])[_0x11d7('0x2a')](function(){return _0x2dec81;});}return _0x2dec81;}})['then'](function(_0x19443f){if(_0x19443f){var _0x438a60=_0x19443f['value'];if(!fs[_0x11d7('0x53')](_0x438a60)){throw new db[(_0x11d7('0x56'))][(_0x11d7('0x57'))](_0x11d7('0x58'));}if(_0x19443f[_0x11d7('0x59')]){return _0x23ad34[_0x11d7('0x50')](_0x438a60,_0x19443f[_0x11d7('0x59')]+path[_0x11d7('0x5a')](_0x438a60),function(){if(_0x5b2fd4){fs['unlink'](_0x438a60);}});}else{return _0x23ad34[_0x11d7('0x50')](_0x438a60,function(_0x335129){if(_0x5b2fd4){fs[_0x11d7('0x5b')](_0x438a60);}});}}})[_0x11d7('0x49')](function(_0x1167b4){if(_0x1167b4[_0x11d7('0x5c')]===_0x11d7('0x58')){_0x23ad34[_0x11d7('0x20')](0x194)['send'](_0x11d7('0x5d'));}else{return handleError(_0x23ad34,null);}});};exports[_0x11d7('0x5e')]=function(_0x547958,_0x21f64e,_0x242dfa){var _0x1d1003=require(_0x11d7('0x51'));var _0x42aaec=![];var _0x538957={'$and':[db[_0x11d7('0x5f')]['where'](db['sequelize']['fn']('MD5',db[_0x11d7('0x5f')]['col']('uniqueid')),_0x547958[_0x11d7('0x36')]['token'])]};if(_0x547958[_0x11d7('0x36')]['type']&&_0x547958[_0x11d7('0x36')][_0x11d7('0x31')]===_0x11d7('0x52')){_0x538957[_0x11d7('0x60')]['push']({'uniqueid':_0x547958[_0x11d7('0x4e')]['id']});}else{_0x538957[_0x11d7('0x60')]['push']({'id':_0x547958[_0x11d7('0x4e')]['id']});}return db[_0x11d7('0x2f')][_0x11d7('0x4b')]({'where':_0x538957,'attributes':['id',_0x11d7('0x61')],'raw':!![]})[_0x11d7('0x2a')](handleEntityNotFound(_0x21f64e,null))[_0x11d7('0x2a')](function(_0x5a27dc){if(_0x5a27dc){var _0x3ac2b5=util[_0x11d7('0x35')](_0x11d7('0x62'),_0x5a27dc['value']);if(fs[_0x11d7('0x53')](_0x3ac2b5)){_0x42aaec=!![];return _0x1d1003['decryptFile'](_0x3ac2b5,_0x5a27dc[_0x11d7('0x61')],config[_0x11d7('0x63')][_0x11d7('0x55')])[_0x11d7('0x2a')](function(){return _0x5a27dc;});}return _0x5a27dc;}})[_0x11d7('0x2a')](function(_0x5e743e){if(_0x5e743e){if(!fs[_0x11d7('0x53')](_0x5e743e[_0x11d7('0x61')])){throw new db['Sequelize'][(_0x11d7('0x57'))](_0x11d7('0x58'));}if(_0x5e743e['filename']){return _0x21f64e[_0x11d7('0x50')](_0x5e743e[_0x11d7('0x61')],_0x5e743e[_0x11d7('0x59')]+path['extname'](_0x5e743e[_0x11d7('0x61')]),function(){if(_0x42aaec){fs[_0x11d7('0x5b')](_0x5e743e[_0x11d7('0x61')]);}});}else{return _0x21f64e[_0x11d7('0x50')](_0x5e743e['value'],function(_0x377496){if(_0x42aaec){fs[_0x11d7('0x5b')](_0x5e743e[_0x11d7('0x61')]);}});}}})[_0x11d7('0x49')](handleError(_0x21f64e,null));};exports[_0x11d7('0x64')]=function(_0x2bfafe,_0x1801ed){return db['VoiceRecording'][_0x11d7('0x4b')]({'where':{'id':_0x2bfafe['params']['id']}})[_0x11d7('0x2a')](function(_0xc0fa8b){if(_[_0x11d7('0x65')](_0xc0fa8b)){throw new ReferenceError(_0x11d7('0x66'));}return _0xc0fa8b;})[_0x11d7('0x2a')](function(_0x428ec6){var _0x4a776f=_0x428ec6[_0x11d7('0x61')];logger[_0x11d7('0x67')](_0x11d7('0x68'),_0x4a776f);if(!_[_0x11d7('0x65')](_0x428ec6['value'])&&fs[_0x11d7('0x53')](_0x4a776f)){logger[_0x11d7('0x67')](_0x11d7('0x69')+_0x4a776f+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs['unlinkSync'](_0x4a776f);}_0x4a776f=_0x4a776f+'.cypher';if(!_[_0x11d7('0x65')](_0x428ec6[_0x11d7('0x61')])&&fs['existsSync'](_0x4a776f)){logger['info']('File:\x20\x22'+_0x4a776f+_0x11d7('0x6a'));fs[_0x11d7('0x6b')](_0x4a776f);}return _0x428ec6;})[_0x11d7('0x2a')](function(_0x449821){if(!_0x449821)throw new InternalError();return _0x449821[_0x11d7('0x64')]();})[_0x11d7('0x2a')](function(){_0x1801ed['status'](0xcc)[_0x11d7('0x21')]();})[_0x11d7('0x49')](handleError(_0x1801ed,null));};function getBucketslist(_0xc1a8ae,_0x58e3af,_0x2192c0){return new Promise(function(_0x5df237,_0x2f6412){var _0x35dd47=new AWS['S3']({'accessKeyId':_0x58e3af,'secretAccessKey':_0xc1a8ae,'region':_0x2192c0});_0x35dd47[_0x11d7('0x6c')]({},function(_0x78db78,_0x56fb65){if(_0x78db78){return _0x2f6412(_0x78db78);}else{return _0x5df237(_0x56fb65);}});});}function createBucket(_0x4becf6,_0x52d0e2,_0x5ba4a0,_0x1d6b59){return new Promise(function(_0x1baa79,_0x14f12b){var _0x2973a2=new AWS['S3']({'accessKeyId':_0x52d0e2,'secretAccessKey':_0x4becf6,'region':_0x5ba4a0});_0x2973a2[_0x11d7('0x6d')]({'Bucket':_0x1d6b59},function(_0x5569ec,_0x3d8ac3){if(_0x5569ec){return _0x14f12b(_0x5569ec);}else{return _0x1baa79(_0x3d8ac3);}});});}function uploadFile(_0x2d48a8,_0x165863,_0x41089,_0x13248a,_0x2b7869,_0x4dee3f){return new Promise(function(_0x577f68,_0x54fb17){var _0x3ffdb3=new AWS['S3']({'accessKeyId':_0x165863,'secretAccessKey':_0x2d48a8,'region':_0x41089});_0x3ffdb3[_0x11d7('0x6e')]({'Bucket':_0x13248a,'Key':_0x2b7869,'Body':_0x4dee3f},function(_0x5e7d22,_0x4c25f6){if(_0x5e7d22){return _0x54fb17(_0x5e7d22);}else{return _0x577f68(_0x4c25f6);}});});}function startTranscribe(_0x26f82a,_0x5201cc,_0x528838,_0x41f7f0,_0x1d8c6c,_0x45de88){return new Promise(function(_0x514e40,_0x15063d){var _0x53d3ea=new AWS[(_0x11d7('0x6f'))]({'accessKeyId':_0x5201cc,'secretAccessKey':_0x26f82a,'region':_0x528838});_0x53d3ea['startTranscriptionJob']({'TranscriptionJobName':_0x41f7f0,'LanguageCode':_0x1d8c6c,'Media':{'MediaFileUri':_0x45de88}},function(_0x2454d0,_0x3aa03e){if(_0x2454d0){return _0x15063d(_0x2454d0);}else{return _0x514e40(_0x3aa03e);}});});}function transcribe(_0x1d3ade,_0x800af7,_0x224680,_0x50c7fb,_0x2c291b,_0x50445e,_0x46858f){return new Promise(function(_0x3721ce,_0x34b82e){var _0x70afbb={};logger[_0x11d7('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s',_0x1d3ade,_0x2c291b));return uploadFile(_0x800af7,_0x224680,_0x50c7fb,_0x2c291b,path[_0x11d7('0x70')](_0x50445e),fs[_0x11d7('0x71')](_0x50445e))[_0x11d7('0x2a')](function(_0x54088e){logger[_0x11d7('0x67')](util['format'](_0x11d7('0x72'),_0x1d3ade,_0x2c291b,_0x54088e[_0x11d7('0x73')]));_0x70afbb[_0x11d7('0x74')]=_0x54088e[_0x11d7('0x75')];_0x70afbb[_0x11d7('0x76')]=_0x54088e[_0x11d7('0x73')];logger[_0x11d7('0x67')](util['format'](_0x11d7('0x77'),_0x1d3ade));return startTranscribe(_0x800af7,_0x224680,_0x50c7fb,uuidv4(),_0x46858f,_0x54088e[_0x11d7('0x73')]);})['then'](function(_0x1d0405){logger[_0x11d7('0x67')](util[_0x11d7('0x35')](_0x11d7('0x78'),_0x1d3ade,_0x1d0405[_0x11d7('0x79')]['TranscriptionJobName']));_0x70afbb['transcribeName']=_0x1d0405[_0x11d7('0x79')][_0x11d7('0x7a')];_0x70afbb[_0x11d7('0x7b')]=_0x1d0405[_0x11d7('0x79')][_0x11d7('0x7c')];return _0x3721ce(_0x70afbb);})['catch'](function(_0x37a7e4){return _0x34b82e(_0x37a7e4);});});}exports[_0x11d7('0x7d')]=function(_0x6cfd95,_0x53731b,_0x1803a3){var _0x5d8e33;var _0xa14d65;var _0x4c14e6;var _0x3a1852=require(_0x11d7('0x51'));return db[_0x11d7('0x2f')][_0x11d7('0x7e')]({'where':{'id':_0x6cfd95[_0x11d7('0x4e')]['id']}})['then'](function(_0x5a0b1b){if(_0x5a0b1b){var _0x25fd19=util['format']('%s.cypher',_0x5a0b1b[_0x11d7('0x61')]);if(fs[_0x11d7('0x53')](_0x25fd19)){cypher=!![];return _0x3a1852[_0x11d7('0x54')](_0x25fd19,_0x5a0b1b['value'],config[_0x11d7('0x63')]['recording'])[_0x11d7('0x2a')](function(){return _0x5a0b1b;});}return _0x5a0b1b;}})[_0x11d7('0x2a')](function(_0x22dfd7){if(!_0x22dfd7){throw new db[(_0x11d7('0x56'))]['ValidationError'](_0x11d7('0x7f'));}_0xa14d65=_0x22dfd7;return db['Setting']['findOne']({'where':{'id':0x1}});})[_0x11d7('0x2a')](handleEntityNotFound(_0x53731b,null))[_0x11d7('0x2a')](function(_0x192bd0){if(_0x192bd0){_0x5d8e33=_0x192bd0;if(!_0x5d8e33[_0x11d7('0x80')]||!_0x5d8e33[_0x11d7('0x81')]||!_0x5d8e33['transcribeRegion']||!_0x5d8e33[_0x11d7('0x82')]||!_0x5d8e33[_0x11d7('0x74')]){throw new db[(_0x11d7('0x56'))]['ValidationError']('Transcribe\x20not\x20configured');}if(_0x6cfd95[_0x11d7('0x4d')][_0x11d7('0x83')]&&(!_0x5d8e33['sentiment']||!_0x5d8e33['sentimentAccountId']||!_0x5d8e33[_0x11d7('0x84')]||!_0x5d8e33['language']||!_0x5d8e33[_0x11d7('0x74')])){throw new db['Sequelize'][(_0x11d7('0x57'))](_0x11d7('0x85'));}return db['CloudProvider'][_0x11d7('0x7e')]({'where':{'id':_0x5d8e33[_0x11d7('0x81')]}});}})[_0x11d7('0x2a')](function(_0xcb6a3e){if(!_0xcb6a3e){throw new db[(_0x11d7('0x56'))]['ValidationError'](_0x11d7('0x86'));}if(!_0xcb6a3e[_0x11d7('0x87')]||!_0xcb6a3e[_0x11d7('0x88')]){throw new db[(_0x11d7('0x56'))][(_0x11d7('0x57'))](_0x11d7('0x89'));}_0x4c14e6=_0xcb6a3e;return getBucketslist(_0x4c14e6[_0x11d7('0x87')],_0x4c14e6[_0x11d7('0x88')],_0x5d8e33[_0x11d7('0x8a')]);})[_0x11d7('0x2a')](function(_0x1b4452){if(_0x1b4452&&_0x1b4452[_0x11d7('0x8b')]){var _0x4a3c61=_[_0x11d7('0x4b')](_0x1b4452['Buckets'],function(_0x2aeab9){return _0x2aeab9[_0x11d7('0x8c')]===_0x5d8e33['bucket'];});if(!_0x4a3c61){logger[_0x11d7('0x67')](util['format']('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x6cfd95[_0x11d7('0x4e')]['id'],_0x5d8e33[_0x11d7('0x74')]));return createBucket(_0x4c14e6[_0x11d7('0x87')],_0x4c14e6[_0x11d7('0x88')],_0x5d8e33[_0x11d7('0x8a')],_0x5d8e33[_0x11d7('0x74')]);}logger[_0x11d7('0x67')](util['format'](_0x11d7('0x8d'),_0x6cfd95[_0x11d7('0x4e')]['id'],_0x5d8e33[_0x11d7('0x74')]));return;}})[_0x11d7('0x2a')](function(_0x48c100){if(_0xa14d65[_0x11d7('0x7b')]===_0x11d7('0x8e')){return transcribe(_0x6cfd95[_0x11d7('0x4e')]['id'],_0x4c14e6[_0x11d7('0x87')],_0x4c14e6[_0x11d7('0x88')],_0x5d8e33[_0x11d7('0x8a')],_0x5d8e33[_0x11d7('0x74')],_0xa14d65[_0x11d7('0x61')],_0x5d8e33['language']);}else{logger[_0x11d7('0x67')](util[_0x11d7('0x35')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x6cfd95[_0x11d7('0x4e')]['id']));return{'transcribeStatus':_0x11d7('0x8f')};}})['then'](function(_0x2c4237){if(_0x2c4237){_0x2c4237[_0x11d7('0x90')]=_0x6cfd95[_0x11d7('0x4d')][_0x11d7('0x83')];return _0xa14d65[_0x11d7('0x91')](_0x2c4237);}})[_0x11d7('0x2a')](respondWithResult(_0x53731b,null))[_0x11d7('0x49')](handleError(_0x53731b,null));};function writeFile(_0x45c330,_0x403da4){return new Promise(function(_0x1028c9,_0x3d4295){fs[_0x11d7('0x92')](_0x403da4,_0x45c330,function(_0x1d9106,_0x30a070){if(_0x1d9106){return _0x3d4295(_0x1d9106);}else{return _0x1028c9(_0x30a070);}});});}exports[_0x11d7('0x93')]=function(_0x3fecb5,_0x5447c6,_0x111e99){return db[_0x11d7('0x2f')]['findOne']({'where':{'id':_0x3fecb5[_0x11d7('0x4e')]['id']}})[_0x11d7('0x2a')](handleEntityNotFound(_0x5447c6))[_0x11d7('0x2a')](function(_0xa80ce0){if(_0xa80ce0&&_0xa80ce0['fileText']){var _0x38e220=_0xa80ce0[_0x11d7('0x94')];var _0x2f5d27=config[_0x11d7('0x95')]+_0x11d7('0x96')+_0xa80ce0['id']+_0x11d7('0x97');if(fs['existsSync'](_0x2f5d27)){return _0x2f5d27;}return writeFile(_0x38e220,_0x2f5d27)['then'](function(){return _0x2f5d27;});}else{throw new db[(_0x11d7('0x56'))][(_0x11d7('0x57'))](_0x11d7('0x98'));}})[_0x11d7('0x2a')](function(_0x210056){return _0x5447c6['download'](_0x210056);})[_0x11d7('0x49')](handleError(_0x5447c6));}; \ No newline at end of file +var _0xedf2=['jsforce','desk.js','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','status','end','json','offset','undefined','limit','count','apply','save','update','destroy','then','sendStatus','stack','name','index','VoiceRecording','fieldName','type','key','model','map','format','keys','query','attributes','intersection','length','hasOwnProperty','nolimit','order','where','filters','pick','filter','options','includeAll','include','rows','catch','rawAttributes','fields','merge','create','body','params','download','../../components/encryptor','find','value','existsSync','secrets','recording','ValidationError','VoiceRecording\x20not\x20found','filename','extname','unlink','message','send','sequelize','MD5','uniqueid','push','%s.cypher','Sequelize','isNil','Entity\x20not\x20found','info','File:\x20\x22','unlinkSync','\x22\x20trovato\x20eseguo\x20la\x20cancellazione','listBuckets','createBucket','upload','startTranscriptionJob','[RUNTRANSCRIPT][%d]\x20Starting\x20voice\x20recording\x20upload\x20in\x20bucket\x20%s','readFileSync','[RUNTRANSCRIPT][%d]\x20Voice\x20recording\x20uploaded\x20in\x20bucket\x20%s\x20(%s)','bucket','Bucket','location','Location','[RUNTRANSCRIPT][%d]\x20Transcription\x20job\x20%s\x20created','TranscriptionJobName','transcribeName','TranscriptionJobStatus','findOne','decryptFile','Setting','transcribe','language','Transcribe\x20not\x20configured','runSentiment','sentiment','sentimentRegion','Sentiment\x20Analysis\x20not\x20configured','transcribeAccountId','data1','data2','Cloud\x20Provider\x20not\x20configured','transcribeRegion','Buckets','[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20available','transcribeStatus','IN_PROGRESS','tempSentiment','writeFile','fileText','/server/files/transcribes/transcribe_','.txt','Transcript\x20not\x20available','eml-format','rimraf','fast-json-patch','moment','bluebird','mustache','util','path','sox','ejs','lodash','squel'];(function(_0x57da0a,_0x284aed){var _0x3145d5=function(_0xfe7c3b){while(--_0xfe7c3b){_0x57da0a['push'](_0x57da0a['shift']());}};_0x3145d5(++_0x284aed);}(_0xedf2,0x7d));var _0x2edf=function(_0x10634b,_0x4e8e3a){_0x10634b=_0x10634b-0x0;var _0x3b4be2=_0xedf2[_0x10634b];return _0x3b4be2;};'use strict';var emlformat=require(_0x2edf('0x0'));var rimraf=require(_0x2edf('0x1'));var zipdir=require('zip-dir');var jsonpatch=require(_0x2edf('0x2'));var rp=require('request-promise');var moment=require(_0x2edf('0x3'));var BPromise=require(_0x2edf('0x4'));var Mustache=require(_0x2edf('0x5'));var util=require(_0x2edf('0x6'));var path=require(_0x2edf('0x7'));var sox=require(_0x2edf('0x8'));var csv=require('to-csv');var ejs=require(_0x2edf('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x2edf('0xa'));var squel=require(_0x2edf('0xb'));var crypto=require('crypto');var jsforce=require(_0x2edf('0xc'));var deskjs=require(_0x2edf('0xd'));var toCsv=require(_0x2edf('0xe'));var querystring=require(_0x2edf('0xf'));var Papa=require(_0x2edf('0x10'));var AWS=require('aws-sdk');var uuidv4=require('uuid/v4');var Redis=require(_0x2edf('0x11'));var authService=require(_0x2edf('0x12'));var qs=require('../../components/parsers/qs');var as=require(_0x2edf('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x2edf('0x14'))('api');var utils=require(_0x2edf('0x15'));var config=require(_0x2edf('0x16'));var licenseUtil=require(_0x2edf('0x17'));var db=require(_0x2edf('0x18'))['db'];function respondWithStatusCode(_0x2520fe,_0x1c1895){_0x1c1895=_0x1c1895||0xcc;return function(_0x3e012b){if(_0x3e012b){return _0x2520fe['sendStatus'](_0x1c1895);}return _0x2520fe[_0x2edf('0x19')](_0x1c1895)[_0x2edf('0x1a')]();};}function respondWithResult(_0x1f7884,_0x4a8394){_0x4a8394=_0x4a8394||0xc8;return function(_0x1ebc95){if(_0x1ebc95){return _0x1f7884['status'](_0x4a8394)[_0x2edf('0x1b')](_0x1ebc95);}};}function respondWithFilteredResult(_0x1cd9f8,_0x2408d9){return function(_0x55f60f){if(_0x55f60f){var _0xc876b5=typeof _0x2408d9[_0x2edf('0x1c')]===_0x2edf('0x1d')&&typeof _0x2408d9[_0x2edf('0x1e')]===_0x2edf('0x1d');var _0x2bf478=_0x55f60f[_0x2edf('0x1f')];var _0x1cc7c8=_0xc876b5?0x0:_0x2408d9[_0x2edf('0x1c')];var _0x4ba528=_0xc876b5?_0x55f60f[_0x2edf('0x1f')]:_0x2408d9[_0x2edf('0x1c')]+_0x2408d9['limit'];var _0x202b07;if(_0x4ba528>=_0x2bf478){_0x4ba528=_0x2bf478;_0x202b07=0xc8;}else{_0x202b07=0xce;}_0x1cd9f8['status'](_0x202b07);return _0x1cd9f8['set']('Content-Range',_0x1cc7c8+'-'+_0x4ba528+'/'+_0x2bf478)[_0x2edf('0x1b')](_0x55f60f);}return null;};}function patchUpdates(_0x21510d){return function(_0x46a39d){try{jsonpatch[_0x2edf('0x20')](_0x46a39d,_0x21510d,!![]);}catch(_0x3e8e6d){return BPromise['reject'](_0x3e8e6d);}return _0x46a39d[_0x2edf('0x21')]();};}function saveUpdates(_0x3ad153,_0x568f14){return function(_0x2c7ea7){if(_0x2c7ea7){return _0x2c7ea7[_0x2edf('0x22')](_0x3ad153)['then'](function(_0x164fe7){return _0x164fe7;});}return null;};}function removeEntity(_0x203fc2,_0x1668c8){return function(_0x58900a){if(_0x58900a){return _0x58900a[_0x2edf('0x23')]()[_0x2edf('0x24')](function(){_0x203fc2[_0x2edf('0x19')](0xcc)[_0x2edf('0x1a')]();});}};}function handleEntityNotFound(_0xf3b7b7,_0x3b2057){return function(_0x45f854){if(!_0x45f854){_0xf3b7b7[_0x2edf('0x25')](0x194);}return _0x45f854;};}function handleError(_0x4425f7,_0x4e025c){_0x4e025c=_0x4e025c||0x1f4;return function(_0x5f08b0){logger['error'](_0x5f08b0[_0x2edf('0x26')]);if(_0x5f08b0[_0x2edf('0x27')]){delete _0x5f08b0['name'];}_0x4425f7[_0x2edf('0x19')](_0x4e025c)['send'](_0x5f08b0);};}exports[_0x2edf('0x28')]=function(_0x482ae5,_0x2c0641){var _0x16edbd={},_0x31bb66={},_0x58e3bb={'count':0x0,'rows':[]};var _0x1ba8e6=_['map'](db[_0x2edf('0x29')]['rawAttributes'],function(_0x1d5062){return{'name':_0x1d5062[_0x2edf('0x2a')],'type':_0x1d5062[_0x2edf('0x2b')][_0x2edf('0x2c')]};});_0x31bb66[_0x2edf('0x2d')]=_['differenceBy'](_[_0x2edf('0x2e')](_0x1ba8e6,'name'),[_0x2edf('0x2f')]);_0x31bb66['query']=_[_0x2edf('0x30')](_0x482ae5[_0x2edf('0x31')]);_0x31bb66['filters']=_['intersection'](_0x31bb66[_0x2edf('0x2d')],_0x31bb66[_0x2edf('0x31')]);_0x16edbd[_0x2edf('0x32')]=_[_0x2edf('0x33')](_0x31bb66[_0x2edf('0x2d')],qs['fields'](_0x482ae5[_0x2edf('0x31')]['fields']));_0x16edbd[_0x2edf('0x32')]=_0x16edbd[_0x2edf('0x32')][_0x2edf('0x34')]?_0x16edbd[_0x2edf('0x32')]:_0x31bb66[_0x2edf('0x2d')];if(!_0x482ae5['query'][_0x2edf('0x35')](_0x2edf('0x36'))){_0x16edbd['limit']=qs['limit'](_0x482ae5[_0x2edf('0x31')][_0x2edf('0x1e')]);_0x16edbd['offset']=qs[_0x2edf('0x1c')](_0x482ae5['query'][_0x2edf('0x1c')]);}_0x16edbd[_0x2edf('0x37')]=qs['sort'](_0x482ae5[_0x2edf('0x31')]['sort']);_0x16edbd[_0x2edf('0x38')]=qs[_0x2edf('0x39')](_[_0x2edf('0x3a')](_0x482ae5[_0x2edf('0x31')],_0x31bb66['filters']),_0x1ba8e6);if(_0x482ae5[_0x2edf('0x31')]['filter']){_0x16edbd[_0x2edf('0x38')]=_['merge'](_0x16edbd[_0x2edf('0x38')],{'$or':_[_0x2edf('0x2e')](_0x1ba8e6,function(_0x7a16f6){if(_0x7a16f6[_0x2edf('0x2b')]!=='VIRTUAL'){var _0x550c97={};_0x550c97[_0x7a16f6['name']]={'$like':'%'+_0x482ae5['query'][_0x2edf('0x3b')]+'%'};return _0x550c97;}})});}_0x16edbd=_['merge']({},_0x16edbd,_0x482ae5[_0x2edf('0x3c')]);var _0x49c344={'where':_0x16edbd[_0x2edf('0x38')]};return db['VoiceRecording'][_0x2edf('0x1f')](_0x49c344)[_0x2edf('0x24')](function(_0x11c850){_0x58e3bb[_0x2edf('0x1f')]=_0x11c850;if(_0x482ae5[_0x2edf('0x31')][_0x2edf('0x3d')]){_0x16edbd[_0x2edf('0x3e')]=[{'all':!![]}];}return db[_0x2edf('0x29')]['findAll'](_0x16edbd);})['then'](function(_0x46fae9){_0x58e3bb[_0x2edf('0x3f')]=_0x46fae9;return _0x58e3bb;})[_0x2edf('0x24')](respondWithFilteredResult(_0x2c0641,_0x16edbd))[_0x2edf('0x40')](handleError(_0x2c0641,null));};exports['show']=function(_0x46a635,_0x3e2726){var _0x2e3216={'raw':![],'where':{'id':_0x46a635['params']['id']}},_0x5e4000={};_0x5e4000[_0x2edf('0x2d')]=_[_0x2edf('0x30')](db[_0x2edf('0x29')][_0x2edf('0x41')]);_0x5e4000[_0x2edf('0x31')]=_[_0x2edf('0x30')](_0x46a635[_0x2edf('0x31')]);_0x5e4000[_0x2edf('0x39')]=_[_0x2edf('0x33')](_0x5e4000[_0x2edf('0x2d')],_0x5e4000[_0x2edf('0x31')]);_0x2e3216['attributes']=_['intersection'](_0x5e4000[_0x2edf('0x2d')],qs[_0x2edf('0x42')](_0x46a635[_0x2edf('0x31')][_0x2edf('0x42')]));_0x2e3216[_0x2edf('0x32')]=_0x2e3216[_0x2edf('0x32')][_0x2edf('0x34')]?_0x2e3216['attributes']:_0x5e4000[_0x2edf('0x2d')];if(_0x46a635[_0x2edf('0x31')][_0x2edf('0x3d')]){_0x2e3216[_0x2edf('0x3e')]=[{'all':!![]}];}_0x2e3216=_[_0x2edf('0x43')]({},_0x2e3216,_0x46a635[_0x2edf('0x3c')]);return db['VoiceRecording']['find'](_0x2e3216)[_0x2edf('0x24')](handleEntityNotFound(_0x3e2726,null))[_0x2edf('0x24')](respondWithResult(_0x3e2726,null))['catch'](handleError(_0x3e2726,null));};exports[_0x2edf('0x44')]=function(_0x2c21a4,_0x4b2d97){return db[_0x2edf('0x29')][_0x2edf('0x44')](_0x2c21a4[_0x2edf('0x45')],{})[_0x2edf('0x24')](respondWithResult(_0x4b2d97,0xc9))[_0x2edf('0x40')](handleError(_0x4b2d97,null));};exports[_0x2edf('0x22')]=function(_0x2ef422,_0x100c5c){if(_0x2ef422[_0x2edf('0x45')]['id']){delete _0x2ef422[_0x2edf('0x45')]['id'];}return db[_0x2edf('0x29')]['find']({'where':{'id':_0x2ef422[_0x2edf('0x46')]['id']}})[_0x2edf('0x24')](handleEntityNotFound(_0x100c5c,null))[_0x2edf('0x24')](saveUpdates(_0x2ef422[_0x2edf('0x45')],null))[_0x2edf('0x24')](respondWithResult(_0x100c5c,null))[_0x2edf('0x40')](handleError(_0x100c5c,null));};exports['describe']=function(_0x5bf982,_0x1ff929){return db[_0x2edf('0x29')]['describe']()[_0x2edf('0x24')](respondWithResult(_0x1ff929,null))[_0x2edf('0x40')](handleError(_0x1ff929,null));};exports[_0x2edf('0x47')]=function(_0x13e637,_0x445983,_0x3640ac){var _0x449c01=require(_0x2edf('0x48'));var _0x3e3a3b=![];var _0x79099e={};if(_0x13e637[_0x2edf('0x31')]['type']&&_0x13e637[_0x2edf('0x31')][_0x2edf('0x2b')]==='uniqueid'){_0x79099e['uniqueid']=_0x13e637[_0x2edf('0x46')]['id'];}else{_0x79099e['id']=_0x13e637[_0x2edf('0x46')]['id'];}return db['VoiceRecording'][_0x2edf('0x49')]({'where':_0x79099e,'attributes':['id',_0x2edf('0x4a')],'raw':!![]})[_0x2edf('0x24')](handleEntityNotFound(_0x445983,null))[_0x2edf('0x24')](function(_0x4b25ce){if(_0x4b25ce){var _0xa88d62=_0x4b25ce[_0x2edf('0x4a')];var _0x521316=util[_0x2edf('0x2f')]('%s.cypher',_0xa88d62);if(fs[_0x2edf('0x4b')](_0x521316)){_0x3e3a3b=!![];return _0x449c01['decryptFile'](_0x521316,_0xa88d62,config[_0x2edf('0x4c')][_0x2edf('0x4d')])['then'](function(){return _0x4b25ce;});}return _0x4b25ce;}})['then'](function(_0x1c5edd){if(_0x1c5edd){var _0x16a8bc=_0x1c5edd['value'];if(!fs[_0x2edf('0x4b')](_0x16a8bc)){throw new db['Sequelize'][(_0x2edf('0x4e'))](_0x2edf('0x4f'));}if(_0x1c5edd[_0x2edf('0x50')]){return _0x445983['download'](_0x16a8bc,_0x1c5edd[_0x2edf('0x50')]+path[_0x2edf('0x51')](_0x16a8bc),function(){if(_0x3e3a3b){fs['unlink'](_0x16a8bc);}});}else{return _0x445983['download'](_0x16a8bc,function(_0x184023){if(_0x3e3a3b){fs[_0x2edf('0x52')](_0x16a8bc);}});}}})['catch'](function(_0x53aabc){if(_0x53aabc[_0x2edf('0x53')]===_0x2edf('0x4f')){_0x445983['status'](0x194)[_0x2edf('0x54')]('Not\x20found');}else{return handleError(_0x445983,null);}});};exports['downloads']=function(_0x4e2861,_0x2a5674,_0x563924){var _0x1128f7=require('../../components/encryptor');var _0x6b968f=![];var _0x103866={'$and':[db['sequelize'][_0x2edf('0x38')](db[_0x2edf('0x55')]['fn'](_0x2edf('0x56'),db[_0x2edf('0x55')]['col'](_0x2edf('0x57'))),_0x4e2861[_0x2edf('0x31')]['token'])]};if(_0x4e2861[_0x2edf('0x31')][_0x2edf('0x2b')]&&_0x4e2861[_0x2edf('0x31')][_0x2edf('0x2b')]===_0x2edf('0x57')){_0x103866['$and'][_0x2edf('0x58')]({'uniqueid':_0x4e2861[_0x2edf('0x46')]['id']});}else{_0x103866['$and'][_0x2edf('0x58')]({'id':_0x4e2861[_0x2edf('0x46')]['id']});}return db['VoiceRecording'][_0x2edf('0x49')]({'where':_0x103866,'attributes':['id','value'],'raw':!![]})[_0x2edf('0x24')](handleEntityNotFound(_0x2a5674,null))['then'](function(_0x18b2f7){if(_0x18b2f7){var _0x5a375a=util[_0x2edf('0x2f')](_0x2edf('0x59'),_0x18b2f7[_0x2edf('0x4a')]);if(fs[_0x2edf('0x4b')](_0x5a375a)){_0x6b968f=!![];return _0x1128f7['decryptFile'](_0x5a375a,_0x18b2f7[_0x2edf('0x4a')],config['secrets'][_0x2edf('0x4d')])['then'](function(){return _0x18b2f7;});}return _0x18b2f7;}})['then'](function(_0x500540){if(_0x500540){if(!fs[_0x2edf('0x4b')](_0x500540[_0x2edf('0x4a')])){throw new db[(_0x2edf('0x5a'))]['ValidationError'](_0x2edf('0x4f'));}if(_0x500540['filename']){return _0x2a5674[_0x2edf('0x47')](_0x500540['value'],_0x500540['filename']+path[_0x2edf('0x51')](_0x500540[_0x2edf('0x4a')]),function(){if(_0x6b968f){fs[_0x2edf('0x52')](_0x500540[_0x2edf('0x4a')]);}});}else{return _0x2a5674[_0x2edf('0x47')](_0x500540[_0x2edf('0x4a')],function(_0x42b395){if(_0x6b968f){fs['unlink'](_0x500540[_0x2edf('0x4a')]);}});}}})[_0x2edf('0x40')](handleError(_0x2a5674,null));};exports[_0x2edf('0x23')]=function(_0x126776,_0x1bf753){return db[_0x2edf('0x29')][_0x2edf('0x49')]({'where':{'id':_0x126776[_0x2edf('0x46')]['id']}})[_0x2edf('0x24')](function(_0x32d83d){if(_[_0x2edf('0x5b')](_0x32d83d)){throw new ReferenceError(_0x2edf('0x5c'));}return _0x32d83d;})[_0x2edf('0x24')](function(_0x5b7a4c){var _0x414d35=_0x5b7a4c[_0x2edf('0x4a')];logger[_0x2edf('0x5d')]('cancellazione\x20fisica\x20documento\x20%s',_0x414d35);if(!_[_0x2edf('0x5b')](_0x5b7a4c[_0x2edf('0x4a')])&&fs['existsSync'](_0x414d35)){logger['info'](_0x2edf('0x5e')+_0x414d35+'\x22\x20trovato\x20eseguo\x20la\x20cancellazione');fs[_0x2edf('0x5f')](_0x414d35);}_0x414d35=_0x414d35+'.cypher';if(!_[_0x2edf('0x5b')](_0x5b7a4c[_0x2edf('0x4a')])&&fs[_0x2edf('0x4b')](_0x414d35)){logger['info'](_0x2edf('0x5e')+_0x414d35+_0x2edf('0x60'));fs[_0x2edf('0x5f')](_0x414d35);}return _0x5b7a4c;})['then'](function(_0x554be5){if(!_0x554be5)throw new InternalError();return _0x554be5[_0x2edf('0x23')]();})[_0x2edf('0x24')](function(){_0x1bf753[_0x2edf('0x19')](0xcc)['end']();})['catch'](handleError(_0x1bf753,null));};function getBucketslist(_0x321820,_0x24c829,_0x390846){return new Promise(function(_0x50d6e1,_0x39b83f){var _0xc134d8=new AWS['S3']({'accessKeyId':_0x24c829,'secretAccessKey':_0x321820,'region':_0x390846});_0xc134d8[_0x2edf('0x61')]({},function(_0x2ce5bb,_0x2ee69d){if(_0x2ce5bb){return _0x39b83f(_0x2ce5bb);}else{return _0x50d6e1(_0x2ee69d);}});});}function createBucket(_0x24e975,_0xce91e7,_0x212dc2,_0x52d6d1){return new Promise(function(_0x144831,_0xe8d320){var _0x4685e8=new AWS['S3']({'accessKeyId':_0xce91e7,'secretAccessKey':_0x24e975,'region':_0x212dc2});_0x4685e8[_0x2edf('0x62')]({'Bucket':_0x52d6d1},function(_0x1727fd,_0x42ad51){if(_0x1727fd){return _0xe8d320(_0x1727fd);}else{return _0x144831(_0x42ad51);}});});}function uploadFile(_0x407b98,_0x374a51,_0x3731c4,_0x55a072,_0xe58ecf,_0x3490b2){return new Promise(function(_0x275f5b,_0x3c6ca6){var _0x21eca6=new AWS['S3']({'accessKeyId':_0x374a51,'secretAccessKey':_0x407b98,'region':_0x3731c4});_0x21eca6[_0x2edf('0x63')]({'Bucket':_0x55a072,'Key':_0xe58ecf,'Body':_0x3490b2},function(_0x918a43,_0x12a0c5){if(_0x918a43){return _0x3c6ca6(_0x918a43);}else{return _0x275f5b(_0x12a0c5);}});});}function startTranscribe(_0x119291,_0x281b96,_0x5d48ba,_0x3f4bf1,_0x100d61,_0x1c471a){return new Promise(function(_0x592dc8,_0x3a95da){var _0x354f92=new AWS['TranscribeService']({'accessKeyId':_0x281b96,'secretAccessKey':_0x119291,'region':_0x5d48ba});_0x354f92[_0x2edf('0x64')]({'TranscriptionJobName':_0x3f4bf1,'LanguageCode':_0x100d61,'Media':{'MediaFileUri':_0x1c471a}},function(_0x52ffcb,_0x359c66){if(_0x52ffcb){return _0x3a95da(_0x52ffcb);}else{return _0x592dc8(_0x359c66);}});});}function transcribe(_0x25ecf6,_0x1c5c3a,_0x404076,_0xca7666,_0x3a410f,_0x7b75e2,_0x1ac757){return new Promise(function(_0x478ee8,_0x346267){var _0x9b5097={};logger[_0x2edf('0x5d')](util['format'](_0x2edf('0x65'),_0x25ecf6,_0x3a410f));return uploadFile(_0x1c5c3a,_0x404076,_0xca7666,_0x3a410f,path['basename'](_0x7b75e2),fs[_0x2edf('0x66')](_0x7b75e2))[_0x2edf('0x24')](function(_0x53b546){logger['info'](util['format'](_0x2edf('0x67'),_0x25ecf6,_0x3a410f,_0x53b546['Location']));_0x9b5097[_0x2edf('0x68')]=_0x53b546[_0x2edf('0x69')];_0x9b5097[_0x2edf('0x6a')]=_0x53b546[_0x2edf('0x6b')];logger[_0x2edf('0x5d')](util[_0x2edf('0x2f')]('[RUNTRANSCRIPT][%d]\x20Sending\x20transcribe\x20request',_0x25ecf6));return startTranscribe(_0x1c5c3a,_0x404076,_0xca7666,uuidv4(),_0x1ac757,_0x53b546['Location']);})['then'](function(_0x4b7495){logger['info'](util[_0x2edf('0x2f')](_0x2edf('0x6c'),_0x25ecf6,_0x4b7495['TranscriptionJob'][_0x2edf('0x6d')]));_0x9b5097[_0x2edf('0x6e')]=_0x4b7495['TranscriptionJob'][_0x2edf('0x6d')];_0x9b5097['transcribeStatus']=_0x4b7495['TranscriptionJob'][_0x2edf('0x6f')];return _0x478ee8(_0x9b5097);})[_0x2edf('0x40')](function(_0x33930b){return _0x346267(_0x33930b);});});}exports['runTranscribe']=function(_0x368802,_0x3f9109,_0x4010af){var _0x56f1af;var _0x27d493;var _0xa9455;var _0x32d659=require(_0x2edf('0x48'));return db[_0x2edf('0x29')][_0x2edf('0x70')]({'where':{'id':_0x368802[_0x2edf('0x46')]['id']}})['then'](function(_0x383ae1){if(_0x383ae1){var _0x2ea721=util[_0x2edf('0x2f')](_0x2edf('0x59'),_0x383ae1['value']);if(fs[_0x2edf('0x4b')](_0x2ea721)){cypher=!![];return _0x32d659[_0x2edf('0x71')](_0x2ea721,_0x383ae1[_0x2edf('0x4a')],config[_0x2edf('0x4c')][_0x2edf('0x4d')])[_0x2edf('0x24')](function(){return _0x383ae1;});}return _0x383ae1;}})[_0x2edf('0x24')](function(_0x24fa53){if(!_0x24fa53){throw new db[(_0x2edf('0x5a'))]['ValidationError']('Voice\x20Recording\x20not\x20found');}_0x27d493=_0x24fa53;return db[_0x2edf('0x72')][_0x2edf('0x70')]({'where':{'id':0x1}});})[_0x2edf('0x24')](handleEntityNotFound(_0x3f9109,null))['then'](function(_0x453057){if(_0x453057){_0x56f1af=_0x453057;if(!_0x56f1af[_0x2edf('0x73')]||!_0x56f1af['transcribeAccountId']||!_0x56f1af['transcribeRegion']||!_0x56f1af[_0x2edf('0x74')]||!_0x56f1af[_0x2edf('0x68')]){throw new db[(_0x2edf('0x5a'))][(_0x2edf('0x4e'))](_0x2edf('0x75'));}if(_0x368802[_0x2edf('0x45')][_0x2edf('0x76')]&&(!_0x56f1af[_0x2edf('0x77')]||!_0x56f1af['sentimentAccountId']||!_0x56f1af[_0x2edf('0x78')]||!_0x56f1af[_0x2edf('0x74')]||!_0x56f1af[_0x2edf('0x68')])){throw new db[(_0x2edf('0x5a'))][(_0x2edf('0x4e'))](_0x2edf('0x79'));}return db['CloudProvider'][_0x2edf('0x70')]({'where':{'id':_0x56f1af[_0x2edf('0x7a')]}});}})[_0x2edf('0x24')](function(_0x445f37){if(!_0x445f37){throw new db['Sequelize']['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0x445f37[_0x2edf('0x7b')]||!_0x445f37[_0x2edf('0x7c')]){throw new db['Sequelize'][(_0x2edf('0x4e'))](_0x2edf('0x7d'));}_0xa9455=_0x445f37;return getBucketslist(_0xa9455[_0x2edf('0x7b')],_0xa9455[_0x2edf('0x7c')],_0x56f1af[_0x2edf('0x7e')]);})[_0x2edf('0x24')](function(_0x50be69){if(_0x50be69&&_0x50be69[_0x2edf('0x7f')]){var _0x3231ed=_[_0x2edf('0x49')](_0x50be69[_0x2edf('0x7f')],function(_0x3b00c8){return _0x3b00c8['Name']===_0x56f1af[_0x2edf('0x68')];});if(!_0x3231ed){logger[_0x2edf('0x5d')](util[_0x2edf('0x2f')]('[RUNTRANSCRIPT][%d]\x20Bucket\x20%s\x20not\x20available',_0x368802[_0x2edf('0x46')]['id'],_0x56f1af[_0x2edf('0x68')]));return createBucket(_0xa9455['data1'],_0xa9455['data2'],_0x56f1af[_0x2edf('0x7e')],_0x56f1af[_0x2edf('0x68')]);}logger[_0x2edf('0x5d')](util[_0x2edf('0x2f')](_0x2edf('0x80'),_0x368802[_0x2edf('0x46')]['id'],_0x56f1af[_0x2edf('0x68')]));return;}})['then'](function(_0x1a5705){if(_0x27d493[_0x2edf('0x81')]==='NEW'){return transcribe(_0x368802[_0x2edf('0x46')]['id'],_0xa9455[_0x2edf('0x7b')],_0xa9455[_0x2edf('0x7c')],_0x56f1af[_0x2edf('0x7e')],_0x56f1af[_0x2edf('0x68')],_0x27d493[_0x2edf('0x4a')],_0x56f1af[_0x2edf('0x74')]);}else{logger['info'](util[_0x2edf('0x2f')]('[RUNTRANSCRIPT][%d]\x20Transcript\x20action\x20already\x20requested',_0x368802[_0x2edf('0x46')]['id']));return{'transcribeStatus':_0x2edf('0x82')};}})[_0x2edf('0x24')](function(_0x579567){if(_0x579567){_0x579567[_0x2edf('0x83')]=_0x368802[_0x2edf('0x45')]['runSentiment'];return _0x27d493['updateAttributes'](_0x579567);}})[_0x2edf('0x24')](respondWithResult(_0x3f9109,null))['catch'](handleError(_0x3f9109,null));};function writeFile(_0x3515ac,_0x1cddbd){return new Promise(function(_0x55e9e5,_0x28a6d0){fs[_0x2edf('0x84')](_0x1cddbd,_0x3515ac,function(_0x2e7b09,_0x5a68eb){if(_0x2e7b09){return _0x28a6d0(_0x2e7b09);}else{return _0x55e9e5(_0x5a68eb);}});});}exports['downloadTranscribe']=function(_0x24954f,_0x11ec84,_0x4909da){return db[_0x2edf('0x29')][_0x2edf('0x70')]({'where':{'id':_0x24954f[_0x2edf('0x46')]['id']}})[_0x2edf('0x24')](handleEntityNotFound(_0x11ec84))[_0x2edf('0x24')](function(_0x512257){if(_0x512257&&_0x512257[_0x2edf('0x85')]){var _0x42a360=_0x512257[_0x2edf('0x85')];var _0x46abac=config['root']+_0x2edf('0x86')+_0x512257['id']+_0x2edf('0x87');if(fs[_0x2edf('0x4b')](_0x46abac)){return _0x46abac;}return writeFile(_0x42a360,_0x46abac)[_0x2edf('0x24')](function(){return _0x46abac;});}else{throw new db[(_0x2edf('0x5a'))][(_0x2edf('0x4e'))](_0x2edf('0x88'));}})[_0x2edf('0x24')](function(_0x51f8ce){return _0x11ec84[_0x2edf('0x47')](_0x51f8ce);})[_0x2edf('0x40')](handleError(_0x11ec84));}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.model.js b/server/api/voiceRecording/voiceRecording.model.js index 11bbcd2..7afac28 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 _0x1d5b=['define','voice_recordings','uniqueid','transcribeStatus','./voiceRecording.attributes','exports'];(function(_0x5e40e1,_0x439631){var _0x2a6579=function(_0x29f922){while(--_0x29f922){_0x5e40e1['push'](_0x5e40e1['shift']());}};_0x2a6579(++_0x439631);}(_0x1d5b,0x13c));var _0xb1d5=function(_0x32df95,_0x511441){_0x32df95=_0x32df95-0x0;var _0x2956c9=_0x1d5b[_0x32df95];return _0x2956c9;};'use strict';var attributes=require(_0xb1d5('0x0'));module[_0xb1d5('0x1')]=function(_0x1a1089,_0x4a5a6c){return _0x1a1089[_0xb1d5('0x2')]('VoiceRecording',attributes,{'tableName':_0xb1d5('0x3'),'paranoid':![],'indexes':[{'name':_0xb1d5('0x4'),'fields':[_0xb1d5('0x4')]},{'name':_0xb1d5('0x5'),'fields':['transcribeStatus']}],'timestamps':!![]});}; \ No newline at end of file +var _0x795a=['uniqueid','transcribeStatus','exports','define','voice_recordings'];(function(_0x1ca9e9,_0x1c4391){var _0x309f3c=function(_0x5ab318){while(--_0x5ab318){_0x1ca9e9['push'](_0x1ca9e9['shift']());}};_0x309f3c(++_0x1c4391);}(_0x795a,0xa2));var _0xa795=function(_0x1dc1e9,_0x1407fa){_0x1dc1e9=_0x1dc1e9-0x0;var _0x2eeb40=_0x795a[_0x1dc1e9];return _0x2eeb40;};'use strict';var attributes=require('./voiceRecording.attributes');module[_0xa795('0x0')]=function(_0x17afed,_0x4b93be){return _0x17afed[_0xa795('0x1')]('VoiceRecording',attributes,{'tableName':_0xa795('0x2'),'paranoid':![],'indexes':[{'name':_0xa795('0x3'),'fields':['uniqueid']},{'name':'transcribeStatus','fields':[_0xa795('0x4')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/voiceRecording/voiceRecording.rpc.js b/server/api/voiceRecording/voiceRecording.rpc.js index 5aa37d6..55c7fce 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 _0x958a=['unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','client','http','then','info','VoiceRecording,\x20%s,\x20%s','request\x20sent','debug','VoiceRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','%s.cypher'];(function(_0x4e25e0,_0x35409c){var _0x12013b=function(_0x426c0e){while(--_0x426c0e){_0x4e25e0['push'](_0x4e25e0['shift']());}};_0x12013b(++_0x35409c);}(_0x958a,0x128));var _0xa958=function(_0x1efec6,_0x98d5c7){_0x1efec6=_0x1efec6-0x0;var _0x1bb8f8=_0x958a[_0x1efec6];return _0x1bb8f8;};'use strict';var _=require(_0xa958('0x0'));var util=require(_0xa958('0x1'));var moment=require('moment');var BPromise=require(_0xa958('0x2'));var rs=require(_0xa958('0x3'));var fs=require('fs');var Redis=require(_0xa958('0x4'));var db=require(_0xa958('0x5'))['db'];var utils=require(_0xa958('0x6'));var logger=require('../../config/logger')(_0xa958('0x7'));var config=require('../../config/environment');var jayson=require(_0xa958('0x8'));var client=jayson[_0xa958('0x9')][_0xa958('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x3ddaa9,_0x3ca01f,_0x3b2693){return new BPromise(function(_0x1895da,_0x54c0e0){return client['request'](_0x3ddaa9,_0x3b2693)[_0xa958('0xb')](function(_0x249764){logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));logger[_0xa958('0xf')](_0xa958('0x10'),_0x3ca01f,_0xa958('0xe'),JSON[_0xa958('0x11')](_0x249764));if(_0x249764[_0xa958('0x12')]){if(_0x249764[_0xa958('0x12')][_0xa958('0x13')]===0x1f4){logger[_0xa958('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x3ca01f,_0x249764['error']['message']);return _0x54c0e0(_0x249764[_0xa958('0x12')][_0xa958('0x14')]);}logger[_0xa958('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x3ca01f,_0x249764[_0xa958('0x12')]['message']);return _0x1895da(_0x249764['error']['message']);}else{logger[_0xa958('0xc')](_0xa958('0xd'),_0x3ca01f,_0xa958('0xe'));_0x1895da(_0x249764[_0xa958('0x15')][_0xa958('0x14')]);}})[_0xa958('0x16')](function(_0x23736f){logger[_0xa958('0x12')]('VoiceRecording,\x20%s,\x20%s',_0x3ca01f,_0x23736f);_0x54c0e0(_0x23736f);});});}exports[_0xa958('0x17')]=function(_0x4eadc9){var _0x3a053f=this;return new Promise(function(_0x70d13e,_0x52a184){return db[_0xa958('0x18')][_0xa958('0x19')](_0x4eadc9[_0xa958('0x1a')],{'raw':_0x4eadc9[_0xa958('0x1b')]?_0x4eadc9[_0xa958('0x1b')][_0xa958('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x4eadc9['options']?_0x4eadc9['options'][_0xa958('0x1d')]||null:null,'attributes':_0x4eadc9[_0xa958('0x1b')]?_0x4eadc9[_0xa958('0x1b')]['attributes']||null:null,'limit':_0x4eadc9[_0xa958('0x1b')]?_0x4eadc9[_0xa958('0x1b')]['limit']||null:null})[_0xa958('0xb')](function(_0x401175){logger['info']('UpdateVoiceRecording',_0x4eadc9);logger[_0xa958('0xf')](_0xa958('0x17'),_0x4eadc9,JSON['stringify'](_0x401175));_0x70d13e(_0x401175);})[_0xa958('0x16')](function(_0x27097a){logger[_0xa958('0x12')](_0xa958('0x17'),_0x27097a[_0xa958('0x14')],_0x4eadc9);_0x52a184(_0x3a053f[_0xa958('0x12')](0x1f4,_0x27097a['message']));});});};exports[_0xa958('0x1e')]=function(_0x48ef34){var _0x43df63=this;return new Promise(function(_0x3c2ea3,_0x32ea36){var _0x18f600=require(_0xa958('0x1f'));var _0xddc7f6;return db[_0xa958('0x20')][_0xa958('0x21')]({'attributes':['id',_0xa958('0x22')],'where':{'id':0x1},'raw':!![]})[_0xa958('0xb')](function(_0x4c4c37){_0xddc7f6=_0x4c4c37;return db['VoiceRecording'][_0xa958('0x23')](_0x48ef34['body']);})[_0xa958('0xb')](function(_0x1b76de){if(_0xddc7f6['callRecordingEncryption']&&fs[_0xa958('0x24')](_0x1b76de[_0xa958('0x25')])){var _0x179bc2=util[_0xa958('0x26')](_0xa958('0x27'),_0x1b76de['value']);return _0x18f600['encryptFile'](_0x1b76de[_0xa958('0x25')],_0x179bc2,config['secrets']['recording'])[_0xa958('0xb')](function(){fs[_0xa958('0x28')](_0x1b76de[_0xa958('0x25')]);logger[_0xa958('0xc')](_0xa958('0x29'));return _0x1b76de;});}return _0x1b76de;})[_0xa958('0xb')](function(_0x516a2f){logger[_0xa958('0xc')]('CreateVoiceRecording',_0x48ef34);logger['debug'](_0xa958('0x1e'),_0x48ef34,JSON[_0xa958('0x11')](_0x516a2f));_0x3c2ea3(_0x516a2f);})[_0xa958('0x16')](function(_0x1cc55d){logger[_0xa958('0x12')](_0xa958('0x1e'),_0x1cc55d[_0xa958('0x14')],_0x48ef34);_0x32ea36(_0x43df63[_0xa958('0x12')](0x1f4,_0x1cc55d['message']));});});}; \ No newline at end of file +var _0x5f2f=['UpdateVoiceRecording','VoiceRecording','update','body','options','raw','where','attributes','limit','then','CreateVoiceRecording','../../components/encryptor','Setting','findOne','callRecordingEncryption','create','existsSync','value','format','encryptFile','secrets','unlink','CreateVoiceRecording\x20file\x20encrypted','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','request','info','VoiceRecording,\x20%s,\x20%s','debug','stringify','error','code','message','request\x20sent','result','catch'];(function(_0x3f0e58,_0x7aee1b){var _0xda331f=function(_0x582fd5){while(--_0x582fd5){_0x3f0e58['push'](_0x3f0e58['shift']());}};_0xda331f(++_0x7aee1b);}(_0x5f2f,0x73));var _0xf5f2=function(_0x2f16cf,_0x4edd3f){_0x2f16cf=_0x2f16cf-0x0;var _0x140968=_0x5f2f[_0x2f16cf];return _0x140968;};'use strict';var _=require(_0xf5f2('0x0'));var util=require(_0xf5f2('0x1'));var moment=require(_0xf5f2('0x2'));var BPromise=require(_0xf5f2('0x3'));var rs=require(_0xf5f2('0x4'));var fs=require('fs');var Redis=require(_0xf5f2('0x5'));var db=require(_0xf5f2('0x6'))['db'];var utils=require(_0xf5f2('0x7'));var logger=require('../../config/logger')('rpc');var config=require(_0xf5f2('0x8'));var jayson=require(_0xf5f2('0x9'));var client=jayson[_0xf5f2('0xa')][_0xf5f2('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x3133bc,_0x473100,_0x5907aa){return new BPromise(function(_0x466882,_0x46cd9c){return client[_0xf5f2('0xc')](_0x3133bc,_0x5907aa)['then'](function(_0x375da4){logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,'request\x20sent');logger[_0xf5f2('0xf')]('VoiceRecording,\x20%s,\x20%s,\x20%s',_0x473100,'request\x20sent',JSON[_0xf5f2('0x10')](_0x375da4));if(_0x375da4[_0xf5f2('0x11')]){if(_0x375da4['error'][_0xf5f2('0x12')]===0x1f4){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x46cd9c(_0x375da4[_0xf5f2('0x11')]['message']);}logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0x375da4[_0xf5f2('0x11')][_0xf5f2('0x13')]);return _0x466882(_0x375da4[_0xf5f2('0x11')]['message']);}else{logger[_0xf5f2('0xd')](_0xf5f2('0xe'),_0x473100,_0xf5f2('0x14'));_0x466882(_0x375da4[_0xf5f2('0x15')][_0xf5f2('0x13')]);}})[_0xf5f2('0x16')](function(_0xdb61b3){logger[_0xf5f2('0x11')](_0xf5f2('0xe'),_0x473100,_0xdb61b3);_0x46cd9c(_0xdb61b3);});});}exports[_0xf5f2('0x17')]=function(_0x20fccd){var _0x28e097=this;return new Promise(function(_0x4ff59b,_0x3ee69){return db[_0xf5f2('0x18')][_0xf5f2('0x19')](_0x20fccd[_0xf5f2('0x1a')],{'raw':_0x20fccd['options']?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1c')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x20fccd['options']?_0x20fccd['options'][_0xf5f2('0x1d')]||null:null,'attributes':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd['options'][_0xf5f2('0x1e')]||null:null,'limit':_0x20fccd[_0xf5f2('0x1b')]?_0x20fccd[_0xf5f2('0x1b')][_0xf5f2('0x1f')]||null:null})[_0xf5f2('0x20')](function(_0x4c691a){logger[_0xf5f2('0xd')](_0xf5f2('0x17'),_0x20fccd);logger[_0xf5f2('0xf')](_0xf5f2('0x17'),_0x20fccd,JSON[_0xf5f2('0x10')](_0x4c691a));_0x4ff59b(_0x4c691a);})['catch'](function(_0x529f07){logger[_0xf5f2('0x11')](_0xf5f2('0x17'),_0x529f07[_0xf5f2('0x13')],_0x20fccd);_0x3ee69(_0x28e097[_0xf5f2('0x11')](0x1f4,_0x529f07[_0xf5f2('0x13')]));});});};exports[_0xf5f2('0x21')]=function(_0x13a3be){var _0x281ec8=this;return new Promise(function(_0x294414,_0x4ab014){var _0xaa2602=require(_0xf5f2('0x22'));var _0x375ca8;return db[_0xf5f2('0x23')][_0xf5f2('0x24')]({'attributes':['id',_0xf5f2('0x25')],'where':{'id':0x1},'raw':!![]})['then'](function(_0x53cb96){_0x375ca8=_0x53cb96;return db[_0xf5f2('0x18')][_0xf5f2('0x26')](_0x13a3be[_0xf5f2('0x1a')]);})['then'](function(_0x5a2c7e){if(_0x375ca8[_0xf5f2('0x25')]&&fs[_0xf5f2('0x27')](_0x5a2c7e[_0xf5f2('0x28')])){var _0x153924=util[_0xf5f2('0x29')]('%s.cypher',_0x5a2c7e['value']);return _0xaa2602[_0xf5f2('0x2a')](_0x5a2c7e['value'],_0x153924,config[_0xf5f2('0x2b')]['recording'])[_0xf5f2('0x20')](function(){fs[_0xf5f2('0x2c')](_0x5a2c7e[_0xf5f2('0x28')]);logger[_0xf5f2('0xd')](_0xf5f2('0x2d'));return _0x5a2c7e;});}return _0x5a2c7e;})[_0xf5f2('0x20')](function(_0x2ac089){logger[_0xf5f2('0xd')]('CreateVoiceRecording',_0x13a3be);logger[_0xf5f2('0xf')](_0xf5f2('0x21'),_0x13a3be,JSON[_0xf5f2('0x10')](_0x2ac089));_0x294414(_0x2ac089);})[_0xf5f2('0x16')](function(_0x1408b9){logger[_0xf5f2('0x11')](_0xf5f2('0x21'),_0x1408b9['message'],_0x13a3be);_0x4ab014(_0x281ec8[_0xf5f2('0x11')](0x1f4,_0x1408b9[_0xf5f2('0x13')]));});});}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/index.js b/server/api/voiceTransferReport/index.js index de2f332..d76969f 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 _0xc1b9=['Router','fs-extra','../../components/auth/service','../../components/interaction/service','./voiceTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','update','delete','destroy','exports','multer','util','path','connect-timeout','express'];(function(_0x5bdb42,_0x77b4cd){var _0x46ea7f=function(_0x436af1){while(--_0x436af1){_0x5bdb42['push'](_0x5bdb42['shift']());}};_0x46ea7f(++_0x77b4cd);}(_0xc1b9,0x1de));var _0x9c1b=function(_0x22b68a,_0x2bffc3){_0x22b68a=_0x22b68a-0x0;var _0x1ac67a=_0xc1b9[_0x22b68a];return _0x1ac67a;};'use strict';var multer=require(_0x9c1b('0x0'));var util=require(_0x9c1b('0x1'));var path=require(_0x9c1b('0x2'));var timeout=require(_0x9c1b('0x3'));var express=require(_0x9c1b('0x4'));var router=express[_0x9c1b('0x5')]();var fs_extra=require(_0x9c1b('0x6'));var auth=require(_0x9c1b('0x7'));var interaction=require(_0x9c1b('0x8'));var config=require('../../config/environment');var controller=require(_0x9c1b('0x9'));router[_0x9c1b('0xa')]('/',auth[_0x9c1b('0xb')](),controller[_0x9c1b('0xc')]);router[_0x9c1b('0xa')](_0x9c1b('0xd'),auth[_0x9c1b('0xb')](),controller['describe']);router[_0x9c1b('0xa')](_0x9c1b('0xe'),auth[_0x9c1b('0xb')](),controller[_0x9c1b('0xf')]);router[_0x9c1b('0x10')]('/',auth[_0x9c1b('0xb')](),controller['create']);router['put'](_0x9c1b('0xe'),auth[_0x9c1b('0xb')](),controller[_0x9c1b('0x11')]);router[_0x9c1b('0x12')](_0x9c1b('0xe'),auth[_0x9c1b('0xb')](),controller[_0x9c1b('0x13')]);module[_0x9c1b('0x14')]=router; \ No newline at end of file +var _0xbd07=['destroy','exports','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./voiceTransferReport.controller','get','index','/describe','isAuthenticated','/:id','show','post','create','put','update'];(function(_0xd29917,_0x195c3a){var _0x1b03d0=function(_0x482ba8){while(--_0x482ba8){_0xd29917['push'](_0xd29917['shift']());}};_0x1b03d0(++_0x195c3a);}(_0xbd07,0x191));var _0x7bd0=function(_0x1caf6a,_0x26a5bf){_0x1caf6a=_0x1caf6a-0x0;var _0x1bf493=_0xbd07[_0x1caf6a];return _0x1bf493;};'use strict';var multer=require(_0x7bd0('0x0'));var util=require('util');var path=require(_0x7bd0('0x1'));var timeout=require(_0x7bd0('0x2'));var express=require('express');var router=express[_0x7bd0('0x3')]();var fs_extra=require(_0x7bd0('0x4'));var auth=require(_0x7bd0('0x5'));var interaction=require(_0x7bd0('0x6'));var config=require(_0x7bd0('0x7'));var controller=require(_0x7bd0('0x8'));router[_0x7bd0('0x9')]('/',auth['isAuthenticated'](),controller[_0x7bd0('0xa')]);router[_0x7bd0('0x9')](_0x7bd0('0xb'),auth[_0x7bd0('0xc')](),controller['describe']);router[_0x7bd0('0x9')](_0x7bd0('0xd'),auth[_0x7bd0('0xc')](),controller[_0x7bd0('0xe')]);router[_0x7bd0('0xf')]('/',auth[_0x7bd0('0xc')](),controller[_0x7bd0('0x10')]);router[_0x7bd0('0x11')](_0x7bd0('0xd'),auth[_0x7bd0('0xc')](),controller[_0x7bd0('0x12')]);router['delete']('/:id',auth[_0x7bd0('0xc')](),controller[_0x7bd0('0x13')]);module[_0x7bd0('0x14')]=router; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.attributes.js b/server/api/voiceTransferReport/voiceTransferReport.attributes.js index 99d8cfd..0556f9d 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 _0x03dc=['moment','ENUM','attended','STRING','Yes'];(function(_0x260adb,_0xd0e02d){var _0x2f1d1e=function(_0x1cb374){while(--_0x1cb374){_0x260adb['push'](_0x260adb['shift']());}};_0x2f1d1e(++_0xd0e02d);}(_0x03dc,0xf0));var _0xc03d=function(_0x501b53,_0x605c7e){_0x501b53=_0x501b53-0x0;var _0x2982de=_0x03dc[_0x501b53];return _0x2982de;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xc03d('0x0'));module['exports']={'type':{'type':Sequelize[_0xc03d('0x1')]('blind',_0xc03d('0x2'))},'result':{'type':Sequelize[_0xc03d('0x3')]},'transfererchannel':{'type':Sequelize['STRING']},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize[_0xc03d('0x3')]},'transfererconnectedlinenum':{'type':Sequelize[_0xc03d('0x3')]},'transfererconnectedlinename':{'type':Sequelize[_0xc03d('0x3')]},'transfereraccountcode':{'type':Sequelize['STRING']},'transferercontext':{'type':Sequelize[_0xc03d('0x3')]},'transfererexten':{'type':Sequelize[_0xc03d('0x3')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize['STRING']},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0xc03d('0x3')]},'transfereeconnectedlinenum':{'type':Sequelize[_0xc03d('0x3')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0xc03d('0x3')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0xc03d('0x3')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize[_0xc03d('0x1')](_0xc03d('0x4'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0xc03d('0x3')]}}; \ No newline at end of file +var _0xc404=['moment','exports','ENUM','attended','STRING','Yes','sequelize'];(function(_0x1aa6c1,_0x42c6cc){var _0x1deab9=function(_0x35db53){while(--_0x35db53){_0x1aa6c1['push'](_0x1aa6c1['shift']());}};_0x1deab9(++_0x42c6cc);}(_0xc404,0x14f));var _0x4c40=function(_0x403bbc,_0x141781){_0x403bbc=_0x403bbc-0x0;var _0x1511d3=_0xc404[_0x403bbc];return _0x1511d3;};'use strict';var Sequelize=require(_0x4c40('0x0'));var moment=require(_0x4c40('0x1'));module[_0x4c40('0x2')]={'type':{'type':Sequelize[_0x4c40('0x3')]('blind',_0x4c40('0x4'))},'result':{'type':Sequelize[_0x4c40('0x5')]},'transfererchannel':{'type':Sequelize[_0x4c40('0x5')]},'transferercalleridnum':{'type':Sequelize['STRING']},'transferercalleridname':{'type':Sequelize['STRING']},'transfererconnectedlinenum':{'type':Sequelize['STRING']},'transfererconnectedlinename':{'type':Sequelize[_0x4c40('0x5')]},'transfereraccountcode':{'type':Sequelize[_0x4c40('0x5')]},'transferercontext':{'type':Sequelize[_0x4c40('0x5')]},'transfererexten':{'type':Sequelize[_0x4c40('0x5')]},'transfererlinkedid':{'type':Sequelize['STRING']},'transfereechannel':{'type':Sequelize[_0x4c40('0x5')]},'transfereecalleridnum':{'type':Sequelize['STRING']},'transfereecalleridname':{'type':Sequelize[_0x4c40('0x5')]},'transfereeconnectedlinenum':{'type':Sequelize[_0x4c40('0x5')]},'transfereeconnectedlinename':{'type':Sequelize['STRING']},'transfereeaccountcode':{'type':Sequelize[_0x4c40('0x5')]},'transfereecontext':{'type':Sequelize['STRING']},'transfereeexten':{'type':Sequelize[_0x4c40('0x5')]},'transfereelinkedid':{'type':Sequelize['STRING']},'isexternal':{'type':Sequelize['ENUM'](_0x4c40('0x6'),'No')},'context':{'type':Sequelize['STRING']},'extension':{'type':Sequelize[_0x4c40('0x5')]}}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.controller.js b/server/api/voiceTransferReport/voiceTransferReport.controller.js index e34c688..670e381 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 _0x128e=['filters','filter','where','VIRTUAL','merge','includeAll','findAll','rows','show','params','fields','length','include','options','find','catch','create','body','describe','eml-format','rimraf','zip-dir','fast-json-patch','moment','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','save','update','then','destroy','error','stack','name','send','map','VoiceTransferReport','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','hasOwnProperty','sort'];(function(_0x324598,_0x330e8b){var _0x6865fa=function(_0x1af70f){while(--_0x1af70f){_0x324598['push'](_0x324598['shift']());}};_0x6865fa(++_0x330e8b);}(_0x128e,0x143));var _0xe128=function(_0xc7df63,_0x169409){_0xc7df63=_0xc7df63-0x0;var _0x9e769=_0x128e[_0xc7df63];return _0x9e769;};'use strict';var emlformat=require(_0xe128('0x0'));var rimraf=require(_0xe128('0x1'));var zipdir=require(_0xe128('0x2'));var jsonpatch=require(_0xe128('0x3'));var rp=require('request-promise');var moment=require(_0xe128('0x4'));var BPromise=require('bluebird');var Mustache=require('mustache');var util=require(_0xe128('0x5'));var path=require(_0xe128('0x6'));var sox=require(_0xe128('0x7'));var csv=require(_0xe128('0x8'));var ejs=require(_0xe128('0x9'));var fs=require('fs');var fs_extra=require(_0xe128('0xa'));var _=require(_0xe128('0xb'));var squel=require(_0xe128('0xc'));var crypto=require(_0xe128('0xd'));var jsforce=require(_0xe128('0xe'));var deskjs=require('desk.js');var toCsv=require(_0xe128('0x8'));var querystring=require(_0xe128('0xf'));var Papa=require(_0xe128('0x10'));var Redis=require(_0xe128('0x11'));var authService=require(_0xe128('0x12'));var qs=require(_0xe128('0x13'));var as=require(_0xe128('0x14'));var hardwareService=require('../../config/license/hardware');var logger=require(_0xe128('0x15'))(_0xe128('0x16'));var utils=require(_0xe128('0x17'));var config=require(_0xe128('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0xe128('0x19'))['db'];function respondWithStatusCode(_0xa2ba75,_0x42413e){_0x42413e=_0x42413e||0xcc;return function(_0x3953f7){if(_0x3953f7){return _0xa2ba75[_0xe128('0x1a')](_0x42413e);}return _0xa2ba75[_0xe128('0x1b')](_0x42413e)[_0xe128('0x1c')]();};}function respondWithResult(_0x3df5d9,_0x25c784){_0x25c784=_0x25c784||0xc8;return function(_0x415d5b){if(_0x415d5b){return _0x3df5d9[_0xe128('0x1b')](_0x25c784)[_0xe128('0x1d')](_0x415d5b);}};}function respondWithFilteredResult(_0x54accd,_0x59b66c){return function(_0x5546a6){if(_0x5546a6){var _0x9c78b=typeof _0x59b66c[_0xe128('0x1e')]===_0xe128('0x1f')&&typeof _0x59b66c[_0xe128('0x20')]==='undefined';var _0x3ea637=_0x5546a6[_0xe128('0x21')];var _0x2cbf2f=_0x9c78b?0x0:_0x59b66c[_0xe128('0x1e')];var _0x52461a=_0x9c78b?_0x5546a6[_0xe128('0x21')]:_0x59b66c['offset']+_0x59b66c[_0xe128('0x20')];var _0x6ce310;if(_0x52461a>=_0x3ea637){_0x52461a=_0x3ea637;_0x6ce310=0xc8;}else{_0x6ce310=0xce;}_0x54accd[_0xe128('0x1b')](_0x6ce310);return _0x54accd[_0xe128('0x22')](_0xe128('0x23'),_0x2cbf2f+'-'+_0x52461a+'/'+_0x3ea637)[_0xe128('0x1d')](_0x5546a6);}return null;};}function patchUpdates(_0x501883){return function(_0x63008b){try{jsonpatch['apply'](_0x63008b,_0x501883,!![]);}catch(_0xfe4257){return BPromise['reject'](_0xfe4257);}return _0x63008b[_0xe128('0x24')]();};}function saveUpdates(_0x198765,_0x8f736f){return function(_0x4df3ae){if(_0x4df3ae){return _0x4df3ae[_0xe128('0x25')](_0x198765)[_0xe128('0x26')](function(_0xec462c){return _0xec462c;});}return null;};}function removeEntity(_0x55776d,_0xd3818d){return function(_0x1e66b4){if(_0x1e66b4){return _0x1e66b4[_0xe128('0x27')]()[_0xe128('0x26')](function(){_0x55776d['status'](0xcc)['end']();});}};}function handleEntityNotFound(_0x5b40c9,_0x5acff8){return function(_0x43a1cd){if(!_0x43a1cd){_0x5b40c9[_0xe128('0x1a')](0x194);}return _0x43a1cd;};}function handleError(_0x362ac1,_0x4ee64d){_0x4ee64d=_0x4ee64d||0x1f4;return function(_0x5e445b){logger[_0xe128('0x28')](_0x5e445b[_0xe128('0x29')]);if(_0x5e445b['name']){delete _0x5e445b[_0xe128('0x2a')];}_0x362ac1['status'](_0x4ee64d)[_0xe128('0x2b')](_0x5e445b);};}exports['index']=function(_0x339bb4,_0x2a2808){var _0x4ed278={},_0x1fd1f1={},_0x2fba1c={'count':0x0,'rows':[]};var _0x544ae2=_[_0xe128('0x2c')](db[_0xe128('0x2d')][_0xe128('0x2e')],function(_0x595a4f){return{'name':_0x595a4f[_0xe128('0x2f')],'type':_0x595a4f[_0xe128('0x30')][_0xe128('0x31')]};});_0x1fd1f1[_0xe128('0x32')]=_[_0xe128('0x2c')](_0x544ae2,_0xe128('0x2a'));_0x1fd1f1[_0xe128('0x33')]=_[_0xe128('0x34')](_0x339bb4[_0xe128('0x33')]);_0x1fd1f1['filters']=_[_0xe128('0x35')](_0x1fd1f1[_0xe128('0x32')],_0x1fd1f1['query']);_0x4ed278[_0xe128('0x36')]=_[_0xe128('0x35')](_0x1fd1f1[_0xe128('0x32')],qs['fields'](_0x339bb4[_0xe128('0x33')]['fields']));_0x4ed278[_0xe128('0x36')]=_0x4ed278[_0xe128('0x36')]['length']?_0x4ed278['attributes']:_0x1fd1f1[_0xe128('0x32')];if(!_0x339bb4[_0xe128('0x33')][_0xe128('0x37')]('nolimit')){_0x4ed278[_0xe128('0x20')]=qs[_0xe128('0x20')](_0x339bb4['query'][_0xe128('0x20')]);_0x4ed278['offset']=qs['offset'](_0x339bb4[_0xe128('0x33')][_0xe128('0x1e')]);}_0x4ed278['order']=qs[_0xe128('0x38')](_0x339bb4[_0xe128('0x33')]['sort']);_0x4ed278['where']=qs[_0xe128('0x39')](_['pick'](_0x339bb4[_0xe128('0x33')],_0x1fd1f1[_0xe128('0x39')]),_0x544ae2);if(_0x339bb4[_0xe128('0x33')][_0xe128('0x3a')]){_0x4ed278[_0xe128('0x3b')]=_['merge'](_0x4ed278[_0xe128('0x3b')],{'$or':_[_0xe128('0x2c')](_0x544ae2,function(_0x1dc462){if(_0x1dc462['type']!==_0xe128('0x3c')){var _0x2381ac={};_0x2381ac[_0x1dc462['name']]={'$like':'%'+_0x339bb4[_0xe128('0x33')][_0xe128('0x3a')]+'%'};return _0x2381ac;}})});}_0x4ed278=_[_0xe128('0x3d')]({},_0x4ed278,_0x339bb4['options']);var _0x1738c9={'where':_0x4ed278[_0xe128('0x3b')]};return db[_0xe128('0x2d')]['count'](_0x1738c9)['then'](function(_0x5642da){_0x2fba1c['count']=_0x5642da;if(_0x339bb4[_0xe128('0x33')][_0xe128('0x3e')]){_0x4ed278['include']=[{'all':!![]}];}return db[_0xe128('0x2d')][_0xe128('0x3f')](_0x4ed278);})[_0xe128('0x26')](function(_0xdceb9d){_0x2fba1c[_0xe128('0x40')]=_0xdceb9d;return _0x2fba1c;})['then'](respondWithFilteredResult(_0x2a2808,_0x4ed278))['catch'](handleError(_0x2a2808,null));};exports[_0xe128('0x41')]=function(_0x3ca3bd,_0x42dee7){var _0x105387={'raw':!![],'where':{'id':_0x3ca3bd[_0xe128('0x42')]['id']}},_0x2df469={};_0x2df469[_0xe128('0x32')]=_[_0xe128('0x34')](db[_0xe128('0x2d')][_0xe128('0x2e')]);_0x2df469[_0xe128('0x33')]=_['keys'](_0x3ca3bd[_0xe128('0x33')]);_0x2df469[_0xe128('0x39')]=_[_0xe128('0x35')](_0x2df469['model'],_0x2df469[_0xe128('0x33')]);_0x105387[_0xe128('0x36')]=_[_0xe128('0x35')](_0x2df469[_0xe128('0x32')],qs['fields'](_0x3ca3bd[_0xe128('0x33')][_0xe128('0x43')]));_0x105387['attributes']=_0x105387[_0xe128('0x36')][_0xe128('0x44')]?_0x105387[_0xe128('0x36')]:_0x2df469[_0xe128('0x32')];if(_0x3ca3bd['query'][_0xe128('0x3e')]){_0x105387[_0xe128('0x45')]=[{'all':!![]}];}_0x105387=_['merge']({},_0x105387,_0x3ca3bd[_0xe128('0x46')]);return db['VoiceTransferReport'][_0xe128('0x47')](_0x105387)[_0xe128('0x26')](handleEntityNotFound(_0x42dee7,null))['then'](respondWithResult(_0x42dee7,null))[_0xe128('0x48')](handleError(_0x42dee7,null));};exports[_0xe128('0x49')]=function(_0x41e4e5,_0x261d59){return db[_0xe128('0x2d')][_0xe128('0x49')](_0x41e4e5[_0xe128('0x4a')],{})[_0xe128('0x26')](respondWithResult(_0x261d59,0xc9))['catch'](handleError(_0x261d59,null));};exports[_0xe128('0x25')]=function(_0x590798,_0x17d096){if(_0x590798[_0xe128('0x4a')]['id']){delete _0x590798['body']['id'];}return db['VoiceTransferReport'][_0xe128('0x47')]({'where':{'id':_0x590798[_0xe128('0x42')]['id']}})[_0xe128('0x26')](handleEntityNotFound(_0x17d096,null))[_0xe128('0x26')](saveUpdates(_0x590798['body'],null))[_0xe128('0x26')](respondWithResult(_0x17d096,null))[_0xe128('0x48')](handleError(_0x17d096,null));};exports['destroy']=function(_0x5a5bac,_0x888eba){return db[_0xe128('0x2d')][_0xe128('0x47')]({'where':{'id':_0x5a5bac[_0xe128('0x42')]['id']}})['then'](handleEntityNotFound(_0x888eba,null))['then'](removeEntity(_0x888eba,null))[_0xe128('0x48')](handleError(_0x888eba,null));};exports[_0xe128('0x4b')]=function(_0x3471df,_0x5795d2){return db[_0xe128('0x2d')]['describe']()[_0xe128('0x26')](respondWithResult(_0x5795d2,null))[_0xe128('0x48')](handleError(_0x5795d2,null));}; \ No newline at end of file +var _0x91fb=['describe','eml-format','fast-json-patch','request-promise','path','sox','ejs','fs-extra','lodash','squel','desk.js','to-csv','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','json','offset','limit','undefined','count','set','Content-Range','reject','save','update','destroy','then','error','stack','name','index','map','VoiceTransferReport','rawAttributes','fieldName','type','model','query','filters','attributes','intersection','fields','hasOwnProperty','nolimit','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','keys','length','create','body','catch','find'];(function(_0x1f2103,_0x2bbcc9){var _0x4ed8e4=function(_0x320a66){while(--_0x320a66){_0x1f2103['push'](_0x1f2103['shift']());}};_0x4ed8e4(++_0x2bbcc9);}(_0x91fb,0x121));var _0xb91f=function(_0x9c2427,_0x17c865){_0x9c2427=_0x9c2427-0x0;var _0x51984f=_0x91fb[_0x9c2427];return _0x51984f;};'use strict';var emlformat=require(_0xb91f('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xb91f('0x1'));var rp=require(_0xb91f('0x2'));var moment=require('moment');var BPromise=require('bluebird');var Mustache=require('mustache');var util=require('util');var path=require(_0xb91f('0x3'));var sox=require(_0xb91f('0x4'));var csv=require('to-csv');var ejs=require(_0xb91f('0x5'));var fs=require('fs');var fs_extra=require(_0xb91f('0x6'));var _=require(_0xb91f('0x7'));var squel=require(_0xb91f('0x8'));var crypto=require('crypto');var jsforce=require('jsforce');var deskjs=require(_0xb91f('0x9'));var toCsv=require(_0xb91f('0xa'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require(_0xb91f('0xb'));var authService=require(_0xb91f('0xc'));var qs=require(_0xb91f('0xd'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb91f('0xe'));var logger=require(_0xb91f('0xf'))(_0xb91f('0x10'));var utils=require(_0xb91f('0x11'));var config=require(_0xb91f('0x12'));var licenseUtil=require(_0xb91f('0x13'));var db=require(_0xb91f('0x14'))['db'];function respondWithStatusCode(_0x2beddb,_0x4083fd){_0x4083fd=_0x4083fd||0xcc;return function(_0x1fa6e2){if(_0x1fa6e2){return _0x2beddb[_0xb91f('0x15')](_0x4083fd);}return _0x2beddb['status'](_0x4083fd)['end']();};}function respondWithResult(_0x19af3d,_0x5a9594){_0x5a9594=_0x5a9594||0xc8;return function(_0x1ba2f2){if(_0x1ba2f2){return _0x19af3d[_0xb91f('0x16')](_0x5a9594)[_0xb91f('0x17')](_0x1ba2f2);}};}function respondWithFilteredResult(_0x4c1e12,_0x4c4dfc){return function(_0x2dab8d){if(_0x2dab8d){var _0xa9d56d=typeof _0x4c4dfc[_0xb91f('0x18')]==='undefined'&&typeof _0x4c4dfc[_0xb91f('0x19')]===_0xb91f('0x1a');var _0x1bde5a=_0x2dab8d[_0xb91f('0x1b')];var _0x1c31a1=_0xa9d56d?0x0:_0x4c4dfc[_0xb91f('0x18')];var _0x3761ee=_0xa9d56d?_0x2dab8d['count']:_0x4c4dfc['offset']+_0x4c4dfc[_0xb91f('0x19')];var _0x4bf7f0;if(_0x3761ee>=_0x1bde5a){_0x3761ee=_0x1bde5a;_0x4bf7f0=0xc8;}else{_0x4bf7f0=0xce;}_0x4c1e12[_0xb91f('0x16')](_0x4bf7f0);return _0x4c1e12[_0xb91f('0x1c')](_0xb91f('0x1d'),_0x1c31a1+'-'+_0x3761ee+'/'+_0x1bde5a)[_0xb91f('0x17')](_0x2dab8d);}return null;};}function patchUpdates(_0x491aae){return function(_0x25cb04){try{jsonpatch['apply'](_0x25cb04,_0x491aae,!![]);}catch(_0x3ca723){return BPromise[_0xb91f('0x1e')](_0x3ca723);}return _0x25cb04[_0xb91f('0x1f')]();};}function saveUpdates(_0x1948ad,_0xdc612e){return function(_0x4181ca){if(_0x4181ca){return _0x4181ca[_0xb91f('0x20')](_0x1948ad)['then'](function(_0x3cafbe){return _0x3cafbe;});}return null;};}function removeEntity(_0xb107ee,_0x2ebdfc){return function(_0x2d9da9){if(_0x2d9da9){return _0x2d9da9[_0xb91f('0x21')]()[_0xb91f('0x22')](function(){_0xb107ee[_0xb91f('0x16')](0xcc)['end']();});}};}function handleEntityNotFound(_0x396709,_0x4f912f){return function(_0x3a0944){if(!_0x3a0944){_0x396709[_0xb91f('0x15')](0x194);}return _0x3a0944;};}function handleError(_0x5288db,_0x4fdb5b){_0x4fdb5b=_0x4fdb5b||0x1f4;return function(_0x22eacb){logger[_0xb91f('0x23')](_0x22eacb[_0xb91f('0x24')]);if(_0x22eacb['name']){delete _0x22eacb[_0xb91f('0x25')];}_0x5288db[_0xb91f('0x16')](_0x4fdb5b)['send'](_0x22eacb);};}exports[_0xb91f('0x26')]=function(_0x4a5ba4,_0x4716e8){var _0x590ea5={},_0x3dfdfb={},_0x26d11b={'count':0x0,'rows':[]};var _0x4e771e=_[_0xb91f('0x27')](db[_0xb91f('0x28')][_0xb91f('0x29')],function(_0x4be540){return{'name':_0x4be540[_0xb91f('0x2a')],'type':_0x4be540[_0xb91f('0x2b')]['key']};});_0x3dfdfb[_0xb91f('0x2c')]=_['map'](_0x4e771e,_0xb91f('0x25'));_0x3dfdfb[_0xb91f('0x2d')]=_['keys'](_0x4a5ba4[_0xb91f('0x2d')]);_0x3dfdfb[_0xb91f('0x2e')]=_['intersection'](_0x3dfdfb[_0xb91f('0x2c')],_0x3dfdfb['query']);_0x590ea5[_0xb91f('0x2f')]=_[_0xb91f('0x30')](_0x3dfdfb[_0xb91f('0x2c')],qs['fields'](_0x4a5ba4['query'][_0xb91f('0x31')]));_0x590ea5['attributes']=_0x590ea5[_0xb91f('0x2f')]['length']?_0x590ea5[_0xb91f('0x2f')]:_0x3dfdfb[_0xb91f('0x2c')];if(!_0x4a5ba4[_0xb91f('0x2d')][_0xb91f('0x32')](_0xb91f('0x33'))){_0x590ea5['limit']=qs[_0xb91f('0x19')](_0x4a5ba4['query'][_0xb91f('0x19')]);_0x590ea5['offset']=qs[_0xb91f('0x18')](_0x4a5ba4[_0xb91f('0x2d')]['offset']);}_0x590ea5['order']=qs[_0xb91f('0x34')](_0x4a5ba4[_0xb91f('0x2d')][_0xb91f('0x34')]);_0x590ea5[_0xb91f('0x35')]=qs['filters'](_[_0xb91f('0x36')](_0x4a5ba4[_0xb91f('0x2d')],_0x3dfdfb[_0xb91f('0x2e')]),_0x4e771e);if(_0x4a5ba4['query'][_0xb91f('0x37')]){_0x590ea5[_0xb91f('0x35')]=_[_0xb91f('0x38')](_0x590ea5[_0xb91f('0x35')],{'$or':_[_0xb91f('0x27')](_0x4e771e,function(_0x2d0c50){if(_0x2d0c50[_0xb91f('0x2b')]!==_0xb91f('0x39')){var _0x3e7942={};_0x3e7942[_0x2d0c50['name']]={'$like':'%'+_0x4a5ba4[_0xb91f('0x2d')]['filter']+'%'};return _0x3e7942;}})});}_0x590ea5=_[_0xb91f('0x38')]({},_0x590ea5,_0x4a5ba4[_0xb91f('0x3a')]);var _0x50aeea={'where':_0x590ea5['where']};return db[_0xb91f('0x28')][_0xb91f('0x1b')](_0x50aeea)[_0xb91f('0x22')](function(_0x47e6fc){_0x26d11b[_0xb91f('0x1b')]=_0x47e6fc;if(_0x4a5ba4[_0xb91f('0x2d')][_0xb91f('0x3b')]){_0x590ea5[_0xb91f('0x3c')]=[{'all':!![]}];}return db['VoiceTransferReport'][_0xb91f('0x3d')](_0x590ea5);})[_0xb91f('0x22')](function(_0x38b21a){_0x26d11b[_0xb91f('0x3e')]=_0x38b21a;return _0x26d11b;})[_0xb91f('0x22')](respondWithFilteredResult(_0x4716e8,_0x590ea5))['catch'](handleError(_0x4716e8,null));};exports[_0xb91f('0x3f')]=function(_0x1958ab,_0x31b156){var _0x2af7b7={'raw':!![],'where':{'id':_0x1958ab[_0xb91f('0x40')]['id']}},_0x319fc8={};_0x319fc8[_0xb91f('0x2c')]=_[_0xb91f('0x41')](db[_0xb91f('0x28')][_0xb91f('0x29')]);_0x319fc8[_0xb91f('0x2d')]=_[_0xb91f('0x41')](_0x1958ab['query']);_0x319fc8[_0xb91f('0x2e')]=_[_0xb91f('0x30')](_0x319fc8[_0xb91f('0x2c')],_0x319fc8['query']);_0x2af7b7[_0xb91f('0x2f')]=_[_0xb91f('0x30')](_0x319fc8[_0xb91f('0x2c')],qs[_0xb91f('0x31')](_0x1958ab[_0xb91f('0x2d')][_0xb91f('0x31')]));_0x2af7b7[_0xb91f('0x2f')]=_0x2af7b7[_0xb91f('0x2f')][_0xb91f('0x42')]?_0x2af7b7[_0xb91f('0x2f')]:_0x319fc8[_0xb91f('0x2c')];if(_0x1958ab[_0xb91f('0x2d')][_0xb91f('0x3b')]){_0x2af7b7[_0xb91f('0x3c')]=[{'all':!![]}];}_0x2af7b7=_[_0xb91f('0x38')]({},_0x2af7b7,_0x1958ab[_0xb91f('0x3a')]);return db[_0xb91f('0x28')]['find'](_0x2af7b7)[_0xb91f('0x22')](handleEntityNotFound(_0x31b156,null))['then'](respondWithResult(_0x31b156,null))['catch'](handleError(_0x31b156,null));};exports[_0xb91f('0x43')]=function(_0x56a211,_0x2cd788){return db[_0xb91f('0x28')][_0xb91f('0x43')](_0x56a211[_0xb91f('0x44')],{})[_0xb91f('0x22')](respondWithResult(_0x2cd788,0xc9))[_0xb91f('0x45')](handleError(_0x2cd788,null));};exports[_0xb91f('0x20')]=function(_0x2e1f62,_0x37b2c5){if(_0x2e1f62[_0xb91f('0x44')]['id']){delete _0x2e1f62[_0xb91f('0x44')]['id'];}return db['VoiceTransferReport'][_0xb91f('0x46')]({'where':{'id':_0x2e1f62[_0xb91f('0x40')]['id']}})[_0xb91f('0x22')](handleEntityNotFound(_0x37b2c5,null))[_0xb91f('0x22')](saveUpdates(_0x2e1f62[_0xb91f('0x44')],null))[_0xb91f('0x22')](respondWithResult(_0x37b2c5,null))['catch'](handleError(_0x37b2c5,null));};exports[_0xb91f('0x21')]=function(_0x4c6491,_0x4ef5b9){return db['VoiceTransferReport'][_0xb91f('0x46')]({'where':{'id':_0x4c6491[_0xb91f('0x40')]['id']}})[_0xb91f('0x22')](handleEntityNotFound(_0x4ef5b9,null))[_0xb91f('0x22')](removeEntity(_0x4ef5b9,null))[_0xb91f('0x45')](handleError(_0x4ef5b9,null));};exports[_0xb91f('0x47')]=function(_0x517043,_0x4cffaa){return db[_0xb91f('0x28')][_0xb91f('0x47')]()[_0xb91f('0x22')](respondWithResult(_0x4cffaa,null))[_0xb91f('0x45')](handleError(_0x4cffaa,null));}; \ No newline at end of file diff --git a/server/api/voiceTransferReport/voiceTransferReport.model.js b/server/api/voiceTransferReport/voiceTransferReport.model.js index 916c4fb..cdfa141 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 _0x9238=['path','rimraf','../../config/environment','./voiceTransferReport.attributes','report_call_transfer','lodash','../../config/logger','api','bluebird','request-promise'];(function(_0x46773d,_0x1de999){var _0x28fd61=function(_0x18f642){while(--_0x18f642){_0x46773d['push'](_0x46773d['shift']());}};_0x28fd61(++_0x1de999);}(_0x9238,0xb9));var _0x8923=function(_0x16256b,_0x28af5f){_0x16256b=_0x16256b-0x0;var _0x5934e6=_0x9238[_0x16256b];return _0x5934e6;};'use strict';var _=require(_0x8923('0x0'));var util=require('util');var logger=require(_0x8923('0x1'))(_0x8923('0x2'));var moment=require('moment');var BPromise=require(_0x8923('0x3'));var rp=require(_0x8923('0x4'));var fs=require('fs');var path=require(_0x8923('0x5'));var rimraf=require(_0x8923('0x6'));var config=require(_0x8923('0x7'));var attributes=require(_0x8923('0x8'));module['exports']=function(_0x565ca8,_0x10f888){return _0x565ca8['define']('VoiceTransferReport',attributes,{'tableName':_0x8923('0x9'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x4dd2=['api','request-promise','path','rimraf','../../config/environment','./voiceTransferReport.attributes','exports','define','VoiceTransferReport','report_call_transfer','../../config/logger'];(function(_0x3583b2,_0x46409f){var _0x220430=function(_0x2c808e){while(--_0x2c808e){_0x3583b2['push'](_0x3583b2['shift']());}};_0x220430(++_0x46409f);}(_0x4dd2,0x11d));var _0x24dd=function(_0x590da5,_0x298084){_0x590da5=_0x590da5-0x0;var _0x54d4c4=_0x4dd2[_0x590da5];return _0x54d4c4;};'use strict';var _=require('lodash');var util=require('util');var logger=require(_0x24dd('0x0'))(_0x24dd('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0x24dd('0x2'));var fs=require('fs');var path=require(_0x24dd('0x3'));var rimraf=require(_0x24dd('0x4'));var config=require(_0x24dd('0x5'));var attributes=require(_0x24dd('0x6'));module[_0x24dd('0x7')]=function(_0x5c0d8d,_0x47559c){return _0x5c0d8d[_0x24dd('0x8')](_0x24dd('0x9'),attributes,{'tableName':_0x24dd('0xa'),'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 bc59455..f1d4884 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 _0x705e=['catch','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http','request','then','info','VoiceTransferReport,\x20%s,\x20%s','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','CreateVoiceTransferReport','options','raw','debug','stringify'];(function(_0x11f3c5,_0x4766a3){var _0xc0b593=function(_0x39fd07){while(--_0x39fd07){_0x11f3c5['push'](_0x11f3c5['shift']());}};_0xc0b593(++_0x4766a3);}(_0x705e,0x1cc));var _0xe705=function(_0x2b2230,_0xe48d8e){_0x2b2230=_0x2b2230-0x0;var _0x20cd54=_0x705e[_0x2b2230];return _0x20cd54;};'use strict';var _=require(_0xe705('0x0'));var util=require(_0xe705('0x1'));var moment=require(_0xe705('0x2'));var BPromise=require(_0xe705('0x3'));var rs=require(_0xe705('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xe705('0x5'))['db'];var utils=require(_0xe705('0x6'));var logger=require(_0xe705('0x7'))(_0xe705('0x8'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xe705('0x9')][_0xe705('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x19027a,_0x3cf93b,_0x429f32){return new BPromise(function(_0x58da7a,_0x1c7a8a){return client[_0xe705('0xb')](_0x19027a,_0x429f32)[_0xe705('0xc')](function(_0x52cce6){logger[_0xe705('0xd')](_0xe705('0xe'),_0x3cf93b,'request\x20sent');logger['debug'](_0xe705('0xf'),_0x3cf93b,_0xe705('0x10'),JSON['stringify'](_0x52cce6));if(_0x52cce6[_0xe705('0x11')]){if(_0x52cce6['error'][_0xe705('0x12')]===0x1f4){logger[_0xe705('0x11')](_0xe705('0xe'),_0x3cf93b,_0x52cce6[_0xe705('0x11')][_0xe705('0x13')]);return _0x1c7a8a(_0x52cce6[_0xe705('0x11')][_0xe705('0x13')]);}logger[_0xe705('0x11')](_0xe705('0xe'),_0x3cf93b,_0x52cce6[_0xe705('0x11')]['message']);return _0x58da7a(_0x52cce6[_0xe705('0x11')]['message']);}else{logger['info'](_0xe705('0xe'),_0x3cf93b,_0xe705('0x10'));_0x58da7a(_0x52cce6[_0xe705('0x14')]['message']);}})['catch'](function(_0x1cee3b){logger[_0xe705('0x11')](_0xe705('0xe'),_0x3cf93b,_0x1cee3b);_0x1c7a8a(_0x1cee3b);});});}exports[_0xe705('0x15')]=function(_0x14fd84){var _0x58e2bd=this;return new Promise(function(_0x10e650,_0x19cc4c){return db['VoiceTransferReport']['create'](_0x14fd84['body'],{'raw':_0x14fd84[_0xe705('0x16')]?_0x14fd84[_0xe705('0x16')][_0xe705('0x17')]===undefined?!![]:![]:!![]})[_0xe705('0xc')](function(_0x26da6a){logger['info']('CreateVoiceTransferReport',_0x14fd84);logger[_0xe705('0x18')](_0xe705('0x15'),_0x14fd84,JSON[_0xe705('0x19')](_0x26da6a));_0x10e650(_0x26da6a);})[_0xe705('0x1a')](function(_0x55f771){logger[_0xe705('0x11')](_0xe705('0x15'),_0x55f771[_0xe705('0x13')],_0x14fd84);_0x19cc4c(_0x58e2bd[_0xe705('0x11')](0x1f4,_0x55f771[_0xe705('0x13')]));});});}; \ No newline at end of file +var _0xf696=['raw','then','stringify','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','VoiceTransferReport,\x20%s,\x20%s','debug','VoiceTransferReport,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','catch','CreateVoiceTransferReport','VoiceTransferReport','create','options'];(function(_0x13283f,_0x34efb4){var _0x5ec63a=function(_0x48f499){while(--_0x48f499){_0x13283f['push'](_0x13283f['shift']());}};_0x5ec63a(++_0x34efb4);}(_0xf696,0x1c3));var _0x6f69=function(_0x2c7514,_0x4caeb9){_0x2c7514=_0x2c7514-0x0;var _0x182d8a=_0xf696[_0x2c7514];return _0x182d8a;};'use strict';var _=require(_0x6f69('0x0'));var util=require(_0x6f69('0x1'));var moment=require(_0x6f69('0x2'));var BPromise=require(_0x6f69('0x3'));var rs=require(_0x6f69('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x6f69('0x5'))['db'];var utils=require(_0x6f69('0x6'));var logger=require(_0x6f69('0x7'))(_0x6f69('0x8'));var config=require(_0x6f69('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x6f69('0xa')][_0x6f69('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x336c10,_0x2d0da7,_0x2d8f09){return new BPromise(function(_0x56e2cc,_0x22b838){return client[_0x6f69('0xc')](_0x336c10,_0x2d8f09)['then'](function(_0x271472){logger['info'](_0x6f69('0xd'),_0x2d0da7,'request\x20sent');logger[_0x6f69('0xe')](_0x6f69('0xf'),_0x2d0da7,_0x6f69('0x10'),JSON['stringify'](_0x271472));if(_0x271472['error']){if(_0x271472[_0x6f69('0x11')]['code']===0x1f4){logger[_0x6f69('0x11')]('VoiceTransferReport,\x20%s,\x20%s',_0x2d0da7,_0x271472[_0x6f69('0x11')][_0x6f69('0x12')]);return _0x22b838(_0x271472[_0x6f69('0x11')]['message']);}logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x2d0da7,_0x271472[_0x6f69('0x11')]['message']);return _0x56e2cc(_0x271472[_0x6f69('0x11')][_0x6f69('0x12')]);}else{logger[_0x6f69('0x13')](_0x6f69('0xd'),_0x2d0da7,'request\x20sent');_0x56e2cc(_0x271472['result']['message']);}})[_0x6f69('0x14')](function(_0x4f9f08){logger['error']('VoiceTransferReport,\x20%s,\x20%s',_0x2d0da7,_0x4f9f08);_0x22b838(_0x4f9f08);});});}exports[_0x6f69('0x15')]=function(_0x3624da){var _0x47b5ee=this;return new Promise(function(_0xee6b8d,_0x23ca35){return db[_0x6f69('0x16')][_0x6f69('0x17')](_0x3624da['body'],{'raw':_0x3624da[_0x6f69('0x18')]?_0x3624da[_0x6f69('0x18')][_0x6f69('0x19')]===undefined?!![]:![]:!![]})[_0x6f69('0x1a')](function(_0x337b0d){logger[_0x6f69('0x13')](_0x6f69('0x15'),_0x3624da);logger[_0x6f69('0xe')](_0x6f69('0x15'),_0x3624da,JSON[_0x6f69('0x1b')](_0x337b0d));_0xee6b8d(_0x337b0d);})[_0x6f69('0x14')](function(_0x406470){logger[_0x6f69('0x11')](_0x6f69('0x15'),_0x406470[_0x6f69('0x12')],_0x3624da);_0x23ca35(_0x47b5ee[_0x6f69('0x11')](0x1f4,_0x406470['message']));});});}; \ No newline at end of file diff --git a/server/api/webbar/index.js b/server/api/webbar/index.js index 1bfa61c..ebb6c29 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 _0x70e0=['unhold','/calls','calls','/transfer','transfer','express','Router','../../components/auth/service','/originate','isAuthenticated','isWebrtcLicence','originate','/hangup','answer','post','/hold','/unhold'];(function(_0x46698a,_0x8de1e4){var _0x356db0=function(_0x19e83c){while(--_0x19e83c){_0x46698a['push'](_0x46698a['shift']());}};_0x356db0(++_0x8de1e4);}(_0x70e0,0x17b));var _0x070e=function(_0x1df2e0,_0x12f970){_0x1df2e0=_0x1df2e0-0x0;var _0x3e601c=_0x70e0[_0x1df2e0];return _0x3e601c;};'use strict';var express=require(_0x070e('0x0'));var router=express[_0x070e('0x1')]();var auth=require(_0x070e('0x2'));var controller=require('./webbar.controller');router['post'](_0x070e('0x3'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x6')]);router['post'](_0x070e('0x7'),auth['isAuthenticated'](),auth[_0x070e('0x5')](),controller['hangup']);router['post']('/answer',auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0x8')]);router[_0x070e('0x9')](_0x070e('0xa'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller['hold']);router['post'](_0x070e('0xb'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xc')]);router[_0x070e('0x9')](_0x070e('0xd'),auth[_0x070e('0x4')](),auth[_0x070e('0x5')](),controller[_0x070e('0xe')]);router[_0x070e('0x9')](_0x070e('0xf'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x070e('0x10')]);module['exports']=router; \ No newline at end of file +var _0x9f62=['/hangup','isAuthenticated','hangup','/answer','isWebrtcLicence','hold','/calls','/transfer','transfer','exports','Router','./webbar.controller','post','/originate','originate'];(function(_0x5ac343,_0x156300){var _0x56f1ea=function(_0x150f8e){while(--_0x150f8e){_0x5ac343['push'](_0x5ac343['shift']());}};_0x56f1ea(++_0x156300);}(_0x9f62,0x154));var _0x29f6=function(_0x2dfa6b,_0x8ccaae){_0x2dfa6b=_0x2dfa6b-0x0;var _0x41b540=_0x9f62[_0x2dfa6b];return _0x41b540;};'use strict';var express=require('express');var router=express[_0x29f6('0x0')]();var auth=require('../../components/auth/service');var controller=require(_0x29f6('0x1'));router[_0x29f6('0x2')](_0x29f6('0x3'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller[_0x29f6('0x4')]);router[_0x29f6('0x2')](_0x29f6('0x5'),auth[_0x29f6('0x6')](),auth['isWebrtcLicence'](),controller[_0x29f6('0x7')]);router[_0x29f6('0x2')](_0x29f6('0x8'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['answer']);router['post']('/hold',auth['isAuthenticated'](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xa')]);router['post']('/unhold',auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller['unhold']);router[_0x29f6('0x2')](_0x29f6('0xb'),auth['isAuthenticated'](),auth['isWebrtcLicence'](),controller['calls']);router['post'](_0x29f6('0xc'),auth[_0x29f6('0x6')](),auth[_0x29f6('0x9')](),controller[_0x29f6('0xd')]);module[_0x29f6('0xe')]=router; \ No newline at end of file diff --git a/server/api/webbar/webbar.controller.js b/server/api/webbar/webbar.controller.js index 1654acf..2b4a875 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 _0xd87e=['transferNumber','webbar:transfer','transfer\x20executed!','path','lodash','../../config/environment','util','bluebird','client','../../config/logger','webbarapi','redis','localhost','socket.io-emitter','validate','userId\x20is\x20required','string','callNumber\x20is\x20required','number','transferNumber\x20is\x20required','info','emit','log','error','stack','name','status','send','then','code','message','result','catch','User','findOne','agent','all','rows','UserId','length','sessionId\x20','\x20not\x20found!','originate','originate\x20fired:','body','userId','callNumber','callerId','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','sessionId','hangup\x20executed!','answer','answer\x20fired:','webbar:answer','answer\x20executed!','hold\x20fired:','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','calls','calls\x20fired:','VoiceChannels','filter','conference','conference\x20fired:','conference\x20executed!','transfer\x20fired:'];(function(_0x22db94,_0x4c47c0){var _0x3be6ec=function(_0x497130){while(--_0x497130){_0x22db94['push'](_0x22db94['shift']());}};_0x3be6ec(++_0x4c47c0);}(_0xd87e,0x1bf));var _0xed87=function(_0x7d40bc,_0x5c9ee1){_0x7d40bc=_0x7d40bc-0x0;var _0x2e955a=_0xd87e[_0x7d40bc];return _0x2e955a;};'use strict';var path=require(_0xed87('0x0'));var fs=require('fs');var _=require(_0xed87('0x1'));var db=require('../../mysqldb')['db'];var config=require(_0xed87('0x2'));var util=require(_0xed87('0x3'));var BPromise=require(_0xed87('0x4'));var jayson=require('jayson/promise');var amiClient=jayson[_0xed87('0x5')]['http']({'port':0x232a});var logger=require(_0xed87('0x6'))(_0xed87('0x7'));var Redis=require('ioredis');config[_0xed87('0x8')]=_['defaults'](config['redis'],{'host':_0xed87('0x9'),'port':0x18eb});var io=require(_0xed87('0xa'))(new Redis(config[_0xed87('0x8')]));var Schema=require(_0xed87('0xb'));var originateValidation=new Schema({'userId':{'type':'number','required':[!![],_0xed87('0xc')]},'callNumber':{'type':_0xed87('0xd'),'required':[!![],_0xed87('0xe')]},'callerId':{'type':_0xed87('0xd')},'callbackUrl':{'type':_0xed87('0xd')}});var hangupValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]},'sessionId':{'type':'string','required':![]}});var answerValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]},'sessionId':{'type':'string','required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xed87('0xd'),'required':[!![],_0xed87('0x10')]}});var holdValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]},'sessionId':{'type':_0xed87('0xd'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xed87('0xd'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]}});var conferenceValidation=new Schema({'userId':{'type':_0xed87('0xf'),'required':[!![],_0xed87('0xc')]}});function emit(_0xd34e0e,_0x173413,_0x2563e4){logger[_0xed87('0x11')](_0xd34e0e,_0x173413,JSON['stringify'](_0x2563e4));io['to'](_0xd34e0e)[_0xed87('0x12')](_0x173413,_0x2563e4);}function handleError(_0x18ab7d){return function(_0x2c386a){console[_0xed87('0x13')]('handleError:',_0x2c386a,_0x2c386a instanceof RangeError);logger[_0xed87('0x14')](_0x2c386a[_0xed87('0x15')]);if(_0x2c386a instanceof RangeError){if(_0x2c386a[_0xed87('0x16')]){delete _0x2c386a[_0xed87('0x16')];}_0x18ab7d[_0xed87('0x17')](0x194)[_0xed87('0x18')](_0x2c386a);}else{if(_0x2c386a[_0xed87('0x16')]){delete _0x2c386a[_0xed87('0x16')];}_0x18ab7d[_0xed87('0x17')](0x1f4)['send'](_0x2c386a);}};}function checkError(){return function(_0x5a7329){if(!_0x5a7329){throw new RangeError('NotFound');}return _0x5a7329;};}function respondWithRpcPromise(_0x47c121,_0x42609e){return new BPromise(function(_0x5d3ec8,_0x4191a7){var _0x2b0b98=amiClient;return _0x2b0b98['request'](_0x47c121,_0x42609e)[_0xed87('0x19')](function(_0x505733){if(_0x505733[_0xed87('0x14')]){if(_0x505733[_0xed87('0x14')][_0xed87('0x1a')]===0x1f4){return _0x4191a7(_0x505733[_0xed87('0x14')][_0xed87('0x1b')]);}return _0x5d3ec8(_0x505733['error'][_0xed87('0x1b')]);}else{_0x5d3ec8(_0x505733[_0xed87('0x1c')]);}})[_0xed87('0x1d')](function(_0x320bcc){_0x4191a7(_0x320bcc);});});}function getAgent(_0x31c600){return db[_0xed87('0x1e')][_0xed87('0x1f')]({'where':{'id':_0x31c600,'role':_0xed87('0x20')}})[_0xed87('0x19')](checkError());}function getAgentCheckSession(_0x38f5c,_0x469181){return new BPromise(function(_0x341a35,_0x16a541){var _0x2b86e2=respondWithRpcPromise('VoiceChannels');var _0xb32b1c=getAgent(_0x38f5c);Promise[_0xed87('0x21')]([_0x2b86e2,_0xb32b1c])['then'](function(_0x3dff74){var _0x33c367=_0x3dff74[0x0];var _0x21c93b=_0x3dff74[0x1];var _0x4b259e=_['filter'](_0x33c367[_0xed87('0x22')],function(_0x428b75){return _0x428b75[_0xed87('0x23')]==_0x21c93b['id']&&_0x428b75['sessionId']==_0x469181;});if(_0x4b259e[_0xed87('0x24')]==0x1){_0x341a35(_0x21c93b);}else{_0x16a541(new RangeError(_0xed87('0x25')+_0x469181+_0xed87('0x26')));}});});}exports[_0xed87('0x27')]=function(_0x114e60,_0x46b9f9){logger[_0xed87('0x11')](_0xed87('0x28'),_0x114e60[_0xed87('0x29')]);var _0x4c0bc0=originateValidation[_0xed87('0xb')](_0x114e60[_0xed87('0x29')]);if(_0x4c0bc0['length']>0x0){return _0x46b9f9[_0xed87('0x17')](0x190)['json'](_0x4c0bc0);}var _0x4430aa=_0x114e60[_0xed87('0x29')][_0xed87('0x2a')];var _0x46b41b=_0x114e60[_0xed87('0x29')][_0xed87('0x2b')];var _0xbd7b69=_0x114e60[_0xed87('0x29')][_0xed87('0x2c')];var _0x6f7b23=_0x114e60[_0xed87('0x29')]['callbackUrl'];return getAgent(_0x4430aa)[_0xed87('0x19')](function(_0x167de8){logger['info'](_0xed87('0x2d'),_0x167de8['name']);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x167de8['name']),_0xed87('0x30'),{'callNumber':_0x46b41b,'callerId':_0xbd7b69,'callbackUrl':_0x6f7b23});return _0x46b9f9[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x32')});})[_0xed87('0x1d')](handleError(_0x46b9f9));};exports['hangup']=function(_0x1ca26d,_0x525a11){logger[_0xed87('0x11')]('hangup\x20fired:',_0x1ca26d[_0xed87('0x29')]);var _0xb6fe59=hangupValidation[_0xed87('0xb')](_0x1ca26d[_0xed87('0x29')]);if(_0xb6fe59[_0xed87('0x24')]>0x0){return _0x525a11[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0xb6fe59);}var _0x161491=_0x1ca26d[_0xed87('0x29')]['userId'];var _0x4b49f8=_0x1ca26d[_0xed87('0x29')][_0xed87('0x33')];return getAgent(_0x161491)[_0xed87('0x19')](function(_0x325112){logger[_0xed87('0x11')](_0xed87('0x2d'),_0x325112['name']);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x325112[_0xed87('0x16')]),'webbar:hangup',{'sessionId':_0x4b49f8});return _0x525a11[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x34')});})[_0xed87('0x1d')](handleError(_0x525a11));};exports[_0xed87('0x35')]=function(_0x151179,_0x315e13){logger[_0xed87('0x11')](_0xed87('0x36'),_0x151179[_0xed87('0x29')]);var _0x5c6925=answerValidation[_0xed87('0xb')](_0x151179[_0xed87('0x29')]);if(_0x5c6925[_0xed87('0x24')]>0x0){return _0x315e13['status'](0x190)['json'](_0x5c6925);}var _0xa31eec=_0x151179[_0xed87('0x29')][_0xed87('0x2a')];var _0x41a658=_0x151179['body'][_0xed87('0x33')];return getAgent(_0xa31eec)[_0xed87('0x19')](function(_0x57fa19){logger[_0xed87('0x11')](_0xed87('0x2d'),_0x57fa19[_0xed87('0x16')]);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x57fa19[_0xed87('0x16')]),_0xed87('0x37'),{'sessionId':_0x41a658});return _0x315e13[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x38')});})[_0xed87('0x1d')](handleError(_0x315e13));};exports['hold']=function(_0x168d7a,_0x122369){logger[_0xed87('0x11')](_0xed87('0x39'),_0x168d7a[_0xed87('0x29')]);var _0x1d3f37=holdValidation[_0xed87('0xb')](_0x168d7a[_0xed87('0x29')]);if(_0x1d3f37[_0xed87('0x24')]>0x0){return _0x122369[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0x1d3f37);}var _0x26c8f4=_0x168d7a[_0xed87('0x29')][_0xed87('0x2a')];var _0x2ed9c3=_0x168d7a[_0xed87('0x29')][_0xed87('0x33')];return getAgent(_0x26c8f4)['then'](function(_0x2c7bef){logger[_0xed87('0x11')](_0xed87('0x2d'),_0x2c7bef['name']);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x2c7bef['name']),_0xed87('0x3a'),{'sessionId':_0x2ed9c3});return _0x122369[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x3b')});})['catch'](handleError(_0x122369));};exports[_0xed87('0x3c')]=function(_0x436e15,_0x3ca34c){logger[_0xed87('0x11')](_0xed87('0x3d'),_0x436e15[_0xed87('0x29')]);var _0x242b57=unholdValidation[_0xed87('0xb')](_0x436e15[_0xed87('0x29')]);if(_0x242b57[_0xed87('0x24')]>0x0){return _0x3ca34c[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0x242b57);}var _0x2e5a9f=_0x436e15['body'][_0xed87('0x2a')];var _0x4ea4e3=_0x436e15[_0xed87('0x29')][_0xed87('0x33')];return getAgent(_0x2e5a9f)[_0xed87('0x19')](function(_0x27ad77){logger[_0xed87('0x11')](_0xed87('0x2d'),_0x27ad77[_0xed87('0x16')]);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x27ad77[_0xed87('0x16')]),'webbar:unhold',{'sessionId':_0x4ea4e3});return _0x3ca34c[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x3e')});})[_0xed87('0x1d')](handleError(_0x3ca34c));};exports[_0xed87('0x3f')]=function(_0x44b176,_0x1dbadc){logger[_0xed87('0x11')](_0xed87('0x40'),_0x1dbadc[_0xed87('0x29')]);var _0x32db1f=callsValidation['validate'](_0x44b176['body']);if(_0x32db1f[_0xed87('0x24')]>0x0){return _0x1dbadc[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0x32db1f);}var _0x2ef4a9=_0x44b176[_0xed87('0x29')]['userId'];var _0x7e6738=respondWithRpcPromise(_0xed87('0x41'));var _0x184e99=getAgent(_0x2ef4a9);return Promise[_0xed87('0x21')]([_0x7e6738,_0x184e99])[_0xed87('0x19')](function(_0x43034f){var _0x15e3bc=_0x43034f[0x0];var _0x1391a2=_0x43034f[0x1];var _0x2ffffa=_[_0xed87('0x42')](_0x15e3bc[_0xed87('0x22')],function(_0x227d19){return _0x227d19[_0xed87('0x23')]==_0x1391a2['id'];});return _0x1dbadc[_0xed87('0x17')](0xc8)['json']({'count':_0x2ffffa[_0xed87('0x24')],'rows':_0x2ffffa});})[_0xed87('0x1d')](handleError(_0x1dbadc));};exports[_0xed87('0x43')]=function(_0x423076,_0x1c6578){logger[_0xed87('0x11')](_0xed87('0x44'),_0x423076[_0xed87('0x29')]);var _0x4b1cc5=conferenceValidation[_0xed87('0xb')](_0x423076[_0xed87('0x29')]);if(_0x4b1cc5[_0xed87('0x24')]>0x0){return _0x1c6578[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0x4b1cc5);}var _0x306d9a=_0x423076['body']['userId'];return getAgent(_0x306d9a)[_0xed87('0x19')](function(_0x176bc4){logger[_0xed87('0x11')](_0xed87('0x2d'),_0x176bc4[_0xed87('0x16')]);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0x176bc4[_0xed87('0x16')]),'webbar:conference');return _0x1c6578[_0xed87('0x17')](0xc8)['json']({'error':![],'message':_0xed87('0x45')});})[_0xed87('0x1d')](handleError(_0x1c6578));};exports['transfer']=function(_0x11b3a8,_0x30f9d0){logger['info'](_0xed87('0x46'),_0x11b3a8[_0xed87('0x29')]);var _0x2dd1e8=transferValidation[_0xed87('0xb')](_0x11b3a8[_0xed87('0x29')]);if(_0x2dd1e8['length']>0x0){return _0x30f9d0[_0xed87('0x17')](0x190)[_0xed87('0x31')](_0x2dd1e8);}var _0x263810=_0x11b3a8[_0xed87('0x29')]['userId'];var _0x58279a=_0x11b3a8[_0xed87('0x29')][_0xed87('0x33')];var _0x52b53f=_0x11b3a8[_0xed87('0x29')][_0xed87('0x47')];return getAgent(_0x263810)[_0xed87('0x19')](function(_0xa1c262){logger[_0xed87('0x11')](_0xed87('0x2d'),_0xa1c262[_0xed87('0x16')]);emit(util[_0xed87('0x2e')](_0xed87('0x2f'),_0xa1c262[_0xed87('0x16')]),_0xed87('0x48'),{'sessionId':_0x58279a,'transferNumber':_0x52b53f});return _0x30f9d0[_0xed87('0x17')](0xc8)[_0xed87('0x31')]({'error':![],'message':_0xed87('0x49')});})['catch'](handleError(_0x30f9d0));}; \ No newline at end of file +var _0x702d=['message','result','catch','User','agent','then','VoiceChannels','filter','rows','UserId','sessionId','length','sessionId\x20','\x20not\x20found!','body','callNumber','callerId','callbackUrl','entityFound:','format','user:%s','webbar:originate','json','originate\x20executed!','userId','hangup\x20executed!','answer','answer\x20fired:','validate','webbar:answer','answer\x20executed!','webbar:hold','hold\x20executed!','unhold','unhold\x20fired:','unhold\x20executed!','all','conference\x20fired:','webbar:conference','conference\x20executed!','transfer\x20fired:','webbar:transfer','transfer\x20executed!','path','lodash','../../mysqldb','../../config/environment','util','jayson/promise','client','http','../../config/logger','ioredis','defaults','redis','localhost','number','userId\x20is\x20required','string','callNumber\x20is\x20required','transferNumber\x20is\x20required','info','stringify','emit','log','error','stack','name','status','send','NotFound'];(function(_0x4058ee,_0xf0029d){var _0x9f5d22=function(_0xaf9eda){while(--_0xaf9eda){_0x4058ee['push'](_0x4058ee['shift']());}};_0x9f5d22(++_0xf0029d);}(_0x702d,0x147));var _0xd702=function(_0x28d5fb,_0xfa116b){_0x28d5fb=_0x28d5fb-0x0;var _0x56f70f=_0x702d[_0x28d5fb];return _0x56f70f;};'use strict';var path=require(_0xd702('0x0'));var fs=require('fs');var _=require(_0xd702('0x1'));var db=require(_0xd702('0x2'))['db'];var config=require(_0xd702('0x3'));var util=require(_0xd702('0x4'));var BPromise=require('bluebird');var jayson=require(_0xd702('0x5'));var amiClient=jayson[_0xd702('0x6')][_0xd702('0x7')]({'port':0x232a});var logger=require(_0xd702('0x8'))('webbarapi');var Redis=require(_0xd702('0x9'));config['redis']=_[_0xd702('0xa')](config[_0xd702('0xb')],{'host':_0xd702('0xc'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xd702('0xb')]));var Schema=require('validate');var originateValidation=new Schema({'userId':{'type':_0xd702('0xd'),'required':[!![],_0xd702('0xe')]},'callNumber':{'type':_0xd702('0xf'),'required':[!![],_0xd702('0x10')]},'callerId':{'type':_0xd702('0xf')},'callbackUrl':{'type':_0xd702('0xf')}});var hangupValidation=new Schema({'userId':{'type':_0xd702('0xd'),'required':[!![],_0xd702('0xe')]},'sessionId':{'type':_0xd702('0xf'),'required':![]}});var answerValidation=new Schema({'userId':{'type':_0xd702('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':'string','required':![]}});var transferValidation=new Schema({'userId':{'type':_0xd702('0xd'),'required':[!![],_0xd702('0xe')]},'sessionId':{'type':_0xd702('0xf'),'required':[!![],'sessionId\x20is\x20required']},'transferNumber':{'type':_0xd702('0xf'),'required':[!![],_0xd702('0x11')]}});var holdValidation=new Schema({'userId':{'type':_0xd702('0xd'),'required':[!![],_0xd702('0xe')]},'sessionId':{'type':_0xd702('0xf'),'required':![]}});var unholdValidation=new Schema({'userId':{'type':_0xd702('0xd'),'required':[!![],'userId\x20is\x20required']},'sessionId':{'type':_0xd702('0xf'),'required':![]}});var callsValidation=new Schema({'userId':{'type':_0xd702('0xd'),'required':[!![],'userId\x20is\x20required']}});var conferenceValidation=new Schema({'userId':{'type':_0xd702('0xd'),'required':[!![],'userId\x20is\x20required']}});function emit(_0x268c66,_0x210c32,_0x55b93e){logger[_0xd702('0x12')](_0x268c66,_0x210c32,JSON[_0xd702('0x13')](_0x55b93e));io['to'](_0x268c66)[_0xd702('0x14')](_0x210c32,_0x55b93e);}function handleError(_0x4fdbbd){return function(_0x5b3b1d){console[_0xd702('0x15')]('handleError:',_0x5b3b1d,_0x5b3b1d instanceof RangeError);logger[_0xd702('0x16')](_0x5b3b1d[_0xd702('0x17')]);if(_0x5b3b1d instanceof RangeError){if(_0x5b3b1d[_0xd702('0x18')]){delete _0x5b3b1d[_0xd702('0x18')];}_0x4fdbbd[_0xd702('0x19')](0x194)[_0xd702('0x1a')](_0x5b3b1d);}else{if(_0x5b3b1d[_0xd702('0x18')]){delete _0x5b3b1d['name'];}_0x4fdbbd['status'](0x1f4)['send'](_0x5b3b1d);}};}function checkError(){return function(_0x55516e){if(!_0x55516e){throw new RangeError(_0xd702('0x1b'));}return _0x55516e;};}function respondWithRpcPromise(_0x5cbff4,_0x211200){return new BPromise(function(_0x5d91fd,_0xc4c246){var _0x5824ec=amiClient;return _0x5824ec['request'](_0x5cbff4,_0x211200)['then'](function(_0x21c00e){if(_0x21c00e[_0xd702('0x16')]){if(_0x21c00e[_0xd702('0x16')]['code']===0x1f4){return _0xc4c246(_0x21c00e[_0xd702('0x16')][_0xd702('0x1c')]);}return _0x5d91fd(_0x21c00e[_0xd702('0x16')][_0xd702('0x1c')]);}else{_0x5d91fd(_0x21c00e[_0xd702('0x1d')]);}})[_0xd702('0x1e')](function(_0x94c58d){_0xc4c246(_0x94c58d);});});}function getAgent(_0x45ca87){return db[_0xd702('0x1f')]['findOne']({'where':{'id':_0x45ca87,'role':_0xd702('0x20')}})[_0xd702('0x21')](checkError());}function getAgentCheckSession(_0x25e96a,_0x335202){return new BPromise(function(_0xbe4518,_0x38505d){var _0x797156=respondWithRpcPromise(_0xd702('0x22'));var _0x5f1084=getAgent(_0x25e96a);Promise['all']([_0x797156,_0x5f1084])[_0xd702('0x21')](function(_0x43cd38){var _0x56bc8d=_0x43cd38[0x0];var _0x45cd22=_0x43cd38[0x1];var _0xee8bf1=_[_0xd702('0x23')](_0x56bc8d[_0xd702('0x24')],function(_0x56e9cd){return _0x56e9cd[_0xd702('0x25')]==_0x45cd22['id']&&_0x56e9cd[_0xd702('0x26')]==_0x335202;});if(_0xee8bf1[_0xd702('0x27')]==0x1){_0xbe4518(_0x45cd22);}else{_0x38505d(new RangeError(_0xd702('0x28')+_0x335202+_0xd702('0x29')));}});});}exports['originate']=function(_0x1b1056,_0x219f41){logger[_0xd702('0x12')]('originate\x20fired:',_0x1b1056[_0xd702('0x2a')]);var _0x563103=originateValidation['validate'](_0x1b1056[_0xd702('0x2a')]);if(_0x563103[_0xd702('0x27')]>0x0){return _0x219f41[_0xd702('0x19')](0x190)['json'](_0x563103);}var _0x7b8af3=_0x1b1056[_0xd702('0x2a')]['userId'];var _0x208f50=_0x1b1056[_0xd702('0x2a')][_0xd702('0x2b')];var _0xd244cc=_0x1b1056[_0xd702('0x2a')][_0xd702('0x2c')];var _0x401f92=_0x1b1056[_0xd702('0x2a')][_0xd702('0x2d')];return getAgent(_0x7b8af3)[_0xd702('0x21')](function(_0x9f458b){logger[_0xd702('0x12')](_0xd702('0x2e'),_0x9f458b['name']);emit(util[_0xd702('0x2f')](_0xd702('0x30'),_0x9f458b[_0xd702('0x18')]),_0xd702('0x31'),{'callNumber':_0x208f50,'callerId':_0xd244cc,'callbackUrl':_0x401f92});return _0x219f41[_0xd702('0x19')](0xc8)[_0xd702('0x32')]({'error':![],'message':_0xd702('0x33')});})['catch'](handleError(_0x219f41));};exports['hangup']=function(_0x138d54,_0x1810ee){logger['info']('hangup\x20fired:',_0x138d54[_0xd702('0x2a')]);var _0x234795=hangupValidation['validate'](_0x138d54[_0xd702('0x2a')]);if(_0x234795[_0xd702('0x27')]>0x0){return _0x1810ee[_0xd702('0x19')](0x190)['json'](_0x234795);}var _0x3444c8=_0x138d54[_0xd702('0x2a')][_0xd702('0x34')];var _0x506c4a=_0x138d54[_0xd702('0x2a')]['sessionId'];return getAgent(_0x3444c8)[_0xd702('0x21')](function(_0x239bec){logger[_0xd702('0x12')](_0xd702('0x2e'),_0x239bec[_0xd702('0x18')]);emit(util[_0xd702('0x2f')](_0xd702('0x30'),_0x239bec[_0xd702('0x18')]),'webbar:hangup',{'sessionId':_0x506c4a});return _0x1810ee[_0xd702('0x19')](0xc8)[_0xd702('0x32')]({'error':![],'message':_0xd702('0x35')});})[_0xd702('0x1e')](handleError(_0x1810ee));};exports[_0xd702('0x36')]=function(_0x5ecb10,_0x203f5d){logger[_0xd702('0x12')](_0xd702('0x37'),_0x5ecb10['body']);var _0xd48ad0=answerValidation[_0xd702('0x38')](_0x5ecb10[_0xd702('0x2a')]);if(_0xd48ad0[_0xd702('0x27')]>0x0){return _0x203f5d['status'](0x190)[_0xd702('0x32')](_0xd48ad0);}var _0xfa5e9=_0x5ecb10[_0xd702('0x2a')][_0xd702('0x34')];var _0x185e4a=_0x5ecb10['body'][_0xd702('0x26')];return getAgent(_0xfa5e9)[_0xd702('0x21')](function(_0x5b1ab7){logger['info'](_0xd702('0x2e'),_0x5b1ab7[_0xd702('0x18')]);emit(util[_0xd702('0x2f')](_0xd702('0x30'),_0x5b1ab7[_0xd702('0x18')]),_0xd702('0x39'),{'sessionId':_0x185e4a});return _0x203f5d[_0xd702('0x19')](0xc8)[_0xd702('0x32')]({'error':![],'message':_0xd702('0x3a')});})['catch'](handleError(_0x203f5d));};exports['hold']=function(_0xbf6235,_0x58047c){logger[_0xd702('0x12')]('hold\x20fired:',_0xbf6235[_0xd702('0x2a')]);var _0x58a56f=holdValidation[_0xd702('0x38')](_0xbf6235['body']);if(_0x58a56f[_0xd702('0x27')]>0x0){return _0x58047c[_0xd702('0x19')](0x190)['json'](_0x58a56f);}var _0x160f5e=_0xbf6235[_0xd702('0x2a')][_0xd702('0x34')];var _0x18012d=_0xbf6235[_0xd702('0x2a')]['sessionId'];return getAgent(_0x160f5e)[_0xd702('0x21')](function(_0x14c1db){logger[_0xd702('0x12')]('entityFound:',_0x14c1db[_0xd702('0x18')]);emit(util['format'](_0xd702('0x30'),_0x14c1db[_0xd702('0x18')]),_0xd702('0x3b'),{'sessionId':_0x18012d});return _0x58047c['status'](0xc8)['json']({'error':![],'message':_0xd702('0x3c')});})[_0xd702('0x1e')](handleError(_0x58047c));};exports[_0xd702('0x3d')]=function(_0x397e91,_0x16e59b){logger[_0xd702('0x12')](_0xd702('0x3e'),_0x397e91[_0xd702('0x2a')]);var _0x7da555=unholdValidation[_0xd702('0x38')](_0x397e91['body']);if(_0x7da555['length']>0x0){return _0x16e59b[_0xd702('0x19')](0x190)[_0xd702('0x32')](_0x7da555);}var _0x229d47=_0x397e91['body']['userId'];var _0x831383=_0x397e91['body'][_0xd702('0x26')];return getAgent(_0x229d47)[_0xd702('0x21')](function(_0x18ef24){logger[_0xd702('0x12')](_0xd702('0x2e'),_0x18ef24[_0xd702('0x18')]);emit(util[_0xd702('0x2f')](_0xd702('0x30'),_0x18ef24[_0xd702('0x18')]),'webbar:unhold',{'sessionId':_0x831383});return _0x16e59b[_0xd702('0x19')](0xc8)[_0xd702('0x32')]({'error':![],'message':_0xd702('0x3f')});})[_0xd702('0x1e')](handleError(_0x16e59b));};exports['calls']=function(_0x3f3045,_0x4e542a){logger[_0xd702('0x12')]('calls\x20fired:',_0x4e542a['body']);var _0x2a31c0=callsValidation[_0xd702('0x38')](_0x3f3045[_0xd702('0x2a')]);if(_0x2a31c0[_0xd702('0x27')]>0x0){return _0x4e542a[_0xd702('0x19')](0x190)[_0xd702('0x32')](_0x2a31c0);}var _0x5db532=_0x3f3045[_0xd702('0x2a')][_0xd702('0x34')];var _0x55719b=respondWithRpcPromise(_0xd702('0x22'));var _0x316520=getAgent(_0x5db532);return Promise[_0xd702('0x40')]([_0x55719b,_0x316520])[_0xd702('0x21')](function(_0x34a194){var _0x27e588=_0x34a194[0x0];var _0x554ab8=_0x34a194[0x1];var _0x2186e7=_[_0xd702('0x23')](_0x27e588[_0xd702('0x24')],function(_0x2e536a){return _0x2e536a[_0xd702('0x25')]==_0x554ab8['id'];});return _0x4e542a['status'](0xc8)['json']({'count':_0x2186e7[_0xd702('0x27')],'rows':_0x2186e7});})['catch'](handleError(_0x4e542a));};exports['conference']=function(_0x2fa2c7,_0x48e348){logger[_0xd702('0x12')](_0xd702('0x41'),_0x2fa2c7[_0xd702('0x2a')]);var _0x1ea97e=conferenceValidation['validate'](_0x2fa2c7[_0xd702('0x2a')]);if(_0x1ea97e['length']>0x0){return _0x48e348[_0xd702('0x19')](0x190)['json'](_0x1ea97e);}var _0x4453c5=_0x2fa2c7[_0xd702('0x2a')][_0xd702('0x34')];return getAgent(_0x4453c5)[_0xd702('0x21')](function(_0x329642){logger[_0xd702('0x12')](_0xd702('0x2e'),_0x329642['name']);emit(util['format'](_0xd702('0x30'),_0x329642['name']),_0xd702('0x42'));return _0x48e348[_0xd702('0x19')](0xc8)['json']({'error':![],'message':_0xd702('0x43')});})[_0xd702('0x1e')](handleError(_0x48e348));};exports['transfer']=function(_0x1dbf12,_0x5e88cb){logger[_0xd702('0x12')](_0xd702('0x44'),_0x1dbf12[_0xd702('0x2a')]);var _0xc9611d=transferValidation['validate'](_0x1dbf12[_0xd702('0x2a')]);if(_0xc9611d[_0xd702('0x27')]>0x0){return _0x5e88cb[_0xd702('0x19')](0x190)[_0xd702('0x32')](_0xc9611d);}var _0x36a782=_0x1dbf12['body'][_0xd702('0x34')];var _0x1c514e=_0x1dbf12[_0xd702('0x2a')][_0xd702('0x26')];var _0x29fc86=_0x1dbf12[_0xd702('0x2a')]['transferNumber'];return getAgent(_0x36a782)[_0xd702('0x21')](function(_0x4f3e4f){logger[_0xd702('0x12')](_0xd702('0x2e'),_0x4f3e4f[_0xd702('0x18')]);emit(util[_0xd702('0x2f')]('user:%s',_0x4f3e4f[_0xd702('0x18')]),_0xd702('0x45'),{'sessionId':_0x1c514e,'transferNumber':_0x29fc86});return _0x5e88cb[_0xd702('0x19')](0xc8)[_0xd702('0x32')]({'error':![],'message':_0xd702('0x46')});})['catch'](handleError(_0x5e88cb));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/index.js b/server/api/whatsappAccount/index.js index 764bfc6..b1f2bf6 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 _0xef0f=['multer','path','connect-timeout','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappAccount.controller','get','isAuthenticated','index','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','getAnswers','/:id/users','/:id/applications','getApplications','post','create','addAnswer','addAgents','addApplications','/:id/notify','notify','/:id/send','send','put','update','delete','removeAnswers','exports'];(function(_0x2ec461,_0x5f588a){var _0x28603d=function(_0x21114b){while(--_0x21114b){_0x2ec461['push'](_0x2ec461['shift']());}};_0x28603d(++_0x5f588a);}(_0xef0f,0x168));var _0xfef0=function(_0x30f221,_0x37df21){_0x30f221=_0x30f221-0x0;var _0x23fbed=_0xef0f[_0x30f221];return _0x23fbed;};'use strict';var multer=require(_0xfef0('0x0'));var util=require('util');var path=require(_0xfef0('0x1'));var timeout=require(_0xfef0('0x2'));var express=require(_0xfef0('0x3'));var router=express['Router']();var fs_extra=require(_0xfef0('0x4'));var auth=require(_0xfef0('0x5'));var interaction=require(_0xfef0('0x6'));var config=require('../../config/environment');var controller=require(_0xfef0('0x7'));router[_0xfef0('0x8')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0xa')]);router[_0xfef0('0x8')](_0xfef0('0xb'),auth['isAuthenticated'](),controller[_0xfef0('0xc')]);router['get'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller[_0xfef0('0xe')]);router[_0xfef0('0x8')](_0xfef0('0xf'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x10')]);router[_0xfef0('0x8')](_0xfef0('0x11'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x12')]);router[_0xfef0('0x8')](_0xfef0('0x13'),auth[_0xfef0('0x9')](),controller['getAgents']);router[_0xfef0('0x8')](_0xfef0('0x14'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x15')]);router[_0xfef0('0x16')]('/',auth[_0xfef0('0x9')](),controller[_0xfef0('0x17')]);router['post'](_0xfef0('0xf'),auth['isAuthenticated'](),controller['addDisposition']);router['post'](_0xfef0('0x11'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x18')]);router[_0xfef0('0x16')](_0xfef0('0x13'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x19')]);router[_0xfef0('0x16')]('/:id/applications',auth[_0xfef0('0x9')](),controller[_0xfef0('0x1a')]);router[_0xfef0('0x16')](_0xfef0('0x1b'),controller[_0xfef0('0x1c')]);router['post'](_0xfef0('0x1d'),auth['isAuthenticated'](),controller[_0xfef0('0x1e')]);router[_0xfef0('0x1f')](_0xfef0('0xd'),auth['isAuthenticated'](),controller[_0xfef0('0x20')]);router['delete'](_0xfef0('0xd'),auth[_0xfef0('0x9')](),controller['destroy']);router['delete']('/:id/dispositions',auth[_0xfef0('0x9')](),controller['removeDispositions']);router[_0xfef0('0x21')](_0xfef0('0x11'),auth[_0xfef0('0x9')](),controller[_0xfef0('0x22')]);router[_0xfef0('0x21')](_0xfef0('0x13'),auth['isAuthenticated'](),controller['removeAgents']);module[_0xfef0('0x23')]=router; \ No newline at end of file +var _0xdb28=['removeDispositions','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','get','isAuthenticated','/describe','describe','/:id','show','/:id/dispositions','getDispositions','/:id/canned_answers','/:id/users','getAgents','getApplications','post','create','addDisposition','addAnswer','addAgents','/:id/applications','addApplications','notify','/:id/send','put','update','delete','destroy'];(function(_0x1df803,_0x3b2e44){var _0x40a2d1=function(_0x1e07db){while(--_0x1e07db){_0x1df803['push'](_0x1df803['shift']());}};_0x40a2d1(++_0x3b2e44);}(_0xdb28,0x106));var _0x8db2=function(_0x1a5728,_0x2ca21f){_0x1a5728=_0x1a5728-0x0;var _0x5efb34=_0xdb28[_0x1a5728];return _0x5efb34;};'use strict';var multer=require(_0x8db2('0x0'));var util=require(_0x8db2('0x1'));var path=require(_0x8db2('0x2'));var timeout=require(_0x8db2('0x3'));var express=require('express');var router=express[_0x8db2('0x4')]();var fs_extra=require(_0x8db2('0x5'));var auth=require(_0x8db2('0x6'));var interaction=require(_0x8db2('0x7'));var config=require(_0x8db2('0x8'));var controller=require('./whatsappAccount.controller');router[_0x8db2('0x9')]('/',auth[_0x8db2('0xa')](),controller['index']);router['get'](_0x8db2('0xb'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xc')]);router[_0x8db2('0x9')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0xe')]);router['get'](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x10')]);router['get'](_0x8db2('0x11'),auth[_0x8db2('0xa')](),controller['getAnswers']);router[_0x8db2('0x9')](_0x8db2('0x12'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x13')]);router[_0x8db2('0x9')]('/:id/applications',auth['isAuthenticated'](),controller[_0x8db2('0x14')]);router[_0x8db2('0x15')]('/',auth[_0x8db2('0xa')](),controller[_0x8db2('0x16')]);router[_0x8db2('0x15')](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x17')]);router[_0x8db2('0x15')](_0x8db2('0x11'),auth['isAuthenticated'](),controller[_0x8db2('0x18')]);router[_0x8db2('0x15')]('/:id/users',auth[_0x8db2('0xa')](),controller[_0x8db2('0x19')]);router[_0x8db2('0x15')](_0x8db2('0x1a'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1b')]);router['post']('/:id/notify',controller[_0x8db2('0x1c')]);router[_0x8db2('0x15')](_0x8db2('0x1d'),auth[_0x8db2('0xa')](),controller['send']);router[_0x8db2('0x1e')](_0x8db2('0xd'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x1f')]);router[_0x8db2('0x20')]('/:id',auth[_0x8db2('0xa')](),controller[_0x8db2('0x21')]);router[_0x8db2('0x20')](_0x8db2('0xf'),auth[_0x8db2('0xa')](),controller[_0x8db2('0x22')]);router[_0x8db2('0x20')]('/:id/canned_answers',auth[_0x8db2('0xa')](),controller['removeAnswers']);router['delete']('/:id/users',auth['isAuthenticated'](),controller[_0x8db2('0x23')]);module[_0x8db2('0x24')]=router; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.attributes.js b/server/api/whatsappAccount/whatsappAccount.attributes.js index 1472469..3049fa3 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 _0x5251=['Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','randomstring','exports','STRING','generate','ENUM','twilio','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}','BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled'];(function(_0x547555,_0x1a4db4){var _0x3b842d=function(_0x4502e5){while(--_0x4502e5){_0x547555['push'](_0x547555['shift']());}};_0x3b842d(++_0x1a4db4);}(_0x5251,0xc8));var _0x1525=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x5251[_0x20a584];return _0x4b41a8;};'use strict';var Sequelize=require('sequelize');var rs=require(_0x1525('0x0'));module[_0x1525('0x1')]={'name':{'type':Sequelize[_0x1525('0x2')],'unique':'name','allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize[_0x1525('0x2')],'allowNull':![]},'token':{'type':Sequelize[_0x1525('0x2')],'defaultValue':function(){return rs[_0x1525('0x3')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x1525('0x4')](_0x1525('0x5'),'sinch')},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x1525('0x2')]},'notificationTemplate':{'type':Sequelize['TEXT'],'defaultValue':function(){return _0x1525('0x6');}},'notificationSound':{'type':Sequelize[_0x1525('0x7')],'defaultValue':![]},'notificationShake':{'type':Sequelize[_0x1525('0x7')],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x1525('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x1525('0x7')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x1525('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize[_0x1525('0x7')],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x1525('0x8')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize['INTEGER'],'comment':_0x1525('0x9')},'mandatoryDisposition':{'type':Sequelize[_0x1525('0x7')],'defaultValue':![],'comment':_0x1525('0xa'),'set':function(_0x2e7fcb){if(!_0x2e7fcb){this[_0x1525('0xb')](_0x1525('0xc'),null);}this[_0x1525('0xb')](_0x1525('0xd'),_0x2e7fcb);}},'description':{'type':Sequelize[_0x1525('0x2')]}}; \ No newline at end of file +var _0x6623=['BOOLEAN','INTEGER','Status\x20to\x20put\x20when\x20mandatory\x20disposition\x20is\x20enabled','Enabled/disables\x20mandatory\x20dispo\x20on\x20a\x20queue','setDataValue','mandatoryDispositionPauseId','mandatoryDisposition','sequelize','randomstring','exports','name','generate','ENUM','twilio','sinch','STRING','TEXT','Account:\x20{{account.name}}
{{#queue}}Queue:\x20{{queue.name}}
{{/queue}}From\x20:\x20{{from}}'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6623,0x73));var _0x3662=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0x6623[_0x92c450];return _0x2a9599;};'use strict';var Sequelize=require(_0x3662('0x0'));var rs=require(_0x3662('0x1'));module[_0x3662('0x2')]={'name':{'type':Sequelize['STRING'],'unique':_0x3662('0x3'),'allowNull':![]},'key':{'type':Sequelize['STRING'],'allowNull':![]},'remote':{'type':Sequelize['STRING'],'allowNull':![]},'token':{'type':Sequelize['STRING'],'defaultValue':function(){return rs[_0x3662('0x4')]();}},'phone':{'type':Sequelize['STRING']},'type':{'type':Sequelize[_0x3662('0x5')](_0x3662('0x6'),_0x3662('0x7'))},'accountSid':{'type':Sequelize['STRING']},'baseUrl':{'type':Sequelize['STRING']},'authToken':{'type':Sequelize[_0x3662('0x8')]},'notificationTemplate':{'type':Sequelize[_0x3662('0x9')],'defaultValue':function(){return _0x3662('0xa');}},'notificationSound':{'type':Sequelize[_0x3662('0xb')],'defaultValue':![]},'notificationShake':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'waitForTheAssignedAgent':{'type':Sequelize[_0x3662('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0xa},'queueTransfer':{'type':Sequelize[_0x3662('0xb')],'defaultValue':![]},'queueTransferTimeout':{'type':Sequelize[_0x3662('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'agentTransfer':{'type':Sequelize['BOOLEAN'],'defaultValue':![]},'agentTransferTimeout':{'type':Sequelize[_0x3662('0xc')],'validate':{'min':0x1,'max':0x20c49b},'defaultValue':0x12c},'mandatoryDispositionPauseId':{'type':Sequelize[_0x3662('0xc')],'comment':_0x3662('0xd')},'mandatoryDisposition':{'type':Sequelize['BOOLEAN'],'defaultValue':![],'comment':_0x3662('0xe'),'set':function(_0x40e660){if(!_0x40e660){this[_0x3662('0xf')](_0x3662('0x10'),null);}this[_0x3662('0xf')](_0x3662('0x11'),_0x40e660);}},'description':{'type':Sequelize['STRING']}}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.controller.js b/server/api/whatsappAccount/whatsappAccount.controller.js index cd10080..f8ff485 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 _0x73eb=['no\x20available\x20attributes','createdAt','updatedAt','CompanyId','ListId','mobile','twilio','from','From','whatsapp:','Body','MessageSid','notifications','messageId','isNil','from\x20is\x20mandatory','mapKey','includes','mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20','CmContact','Contacts','DESC','defaults','contact','WhatsappInteraction','spread','interaction','created','push','close','unmanaged','ContactId','AttachmentId','UserId','unshift','agent','*,*,*,*','Start','startRouting','receiveMessage','info','WhatsappAccount,\x20%s,\x20%s,\x20%s','entity\x20found','stringify','Content-Type','text/xml','\x0a','body\x20is\x20mandatory\x20and\x20not\x20empty','to\x20is\x20mandatory','CmList','List','Messages','dataValues','rimraf','request-promise','bluebird','mustache','util','path','sox','to-csv','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../config/license/hardware','../../config/logger','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappAccount.socket','register','jayson/promise','client','WhatsappAccount,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch','status','end','json','undefined','limit','offset','count','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappAccounts','UserProfileResource','sendStatus','stack','name','mandatoryDispositionPause','map','WhatsappAccount','rawAttributes','fieldName','type','key','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','findAll','rows','show','params','Pause','find','create','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','user','UserProfileSection','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','body','describe','addDisposition','Disposition','WhatsappAccountId','removeDispositions','ids','addAnswer','getAnswers','CannedAnswer','removeAnswers','addAgents','omit','emit','userWhatsappAccount:save','removeAgents','userWhatsappAccount:remove','getAgents','findOne','User','nolimit','addApplications','sequelize','transaction','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','priority','finally','send','getApplications','notify','Applications','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','asc','account','Sequelize','ValidationError'];(function(_0x49bd2d,_0x4e7921){var _0x40012e=function(_0x1d2539){while(--_0x1d2539){_0x49bd2d['push'](_0x49bd2d['shift']());}};_0x40012e(++_0x4e7921);}(_0x73eb,0x1c5));var _0xb73e=function(_0x24d951,_0xc0fb73){_0x24d951=_0x24d951-0x0;var _0x5cfd1e=_0x73eb[_0x24d951];return _0x5cfd1e;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xb73e('0x0'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require(_0xb73e('0x1'));var moment=require('moment');var BPromise=require(_0xb73e('0x2'));var Mustache=require(_0xb73e('0x3'));var util=require(_0xb73e('0x4'));var path=require(_0xb73e('0x5'));var sox=require(_0xb73e('0x6'));var csv=require(_0xb73e('0x7'));var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0xb73e('0x8'));var _=require('lodash');var squel=require(_0xb73e('0x9'));var crypto=require(_0xb73e('0xa'));var jsforce=require(_0xb73e('0xb'));var deskjs=require(_0xb73e('0xc'));var toCsv=require(_0xb73e('0x7'));var querystring=require(_0xb73e('0xd'));var Papa=require(_0xb73e('0xe'));var Redis=require(_0xb73e('0xf'));var authService=require('../../components/auth/service');var qs=require(_0xb73e('0x10'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xb73e('0x11'));var logger=require(_0xb73e('0x12'))('api');var utils=require(_0xb73e('0x13'));var config=require(_0xb73e('0x14'));var licenseUtil=require(_0xb73e('0x15'));var db=require(_0xb73e('0x16'))['db'];config[_0xb73e('0x17')]=_['defaults'](config[_0xb73e('0x17')],{'host':_0xb73e('0x18'),'port':0x18eb});var socket=require(_0xb73e('0x19'))(new Redis(config['redis']));require(_0xb73e('0x1a'))[_0xb73e('0x1b')](socket);var jayson=require(_0xb73e('0x1c'));var client=jayson[_0xb73e('0x1d')]['http']({'port':0x232c});function respondWithRpcPromise(_0x506658,_0x2f963d,_0x2f0321,_0x480564){return new BPromise(function(_0x534af3,_0x5c3315){var _0x2509f2=_0x480564||client;return _0x2509f2['request'](_0x506658,_0x2f0321)['then'](function(_0xefa87){logger['info'](_0xb73e('0x1e'),_0x2f963d,'request\x20sent');logger[_0xb73e('0x1f')]('WhatsappAccount,\x20%s,\x20%s,\x20%s',_0x2f963d,_0xb73e('0x20'),JSON['stringify'](_0xefa87));if(_0xefa87[_0xb73e('0x21')]){if(_0xefa87['error'][_0xb73e('0x22')]===0x1f4){logger[_0xb73e('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x2f963d,_0xefa87['error'][_0xb73e('0x23')]);return _0x5c3315(_0xefa87[_0xb73e('0x21')][_0xb73e('0x23')]);}logger[_0xb73e('0x21')](_0xb73e('0x1e'),_0x2f963d,_0xefa87[_0xb73e('0x21')][_0xb73e('0x23')]);return _0x534af3(_0xefa87[_0xb73e('0x21')][_0xb73e('0x23')]);}else{logger['info'](_0xb73e('0x1e'),_0x2f963d,_0xb73e('0x20'));_0x534af3(_0xefa87[_0xb73e('0x24')][_0xb73e('0x23')]);}})[_0xb73e('0x25')](function(_0x2129d6){logger[_0xb73e('0x21')]('WhatsappAccount,\x20%s,\x20%s',_0x2f963d,_0x2129d6);_0x5c3315(_0x2129d6);});});}function respondWithStatusCode(_0x47ff57,_0x2cf692){_0x2cf692=_0x2cf692||0xcc;return function(_0x31c55e){if(_0x31c55e){return _0x47ff57['sendStatus'](_0x2cf692);}return _0x47ff57[_0xb73e('0x26')](_0x2cf692)[_0xb73e('0x27')]();};}function respondWithResult(_0x3e626b,_0x1ff773){_0x1ff773=_0x1ff773||0xc8;return function(_0x5af616){if(_0x5af616){return _0x3e626b[_0xb73e('0x26')](_0x1ff773)[_0xb73e('0x28')](_0x5af616);}};}function respondWithFilteredResult(_0x2d995a,_0x31cbf2){return function(_0x5713b8){if(_0x5713b8){var _0x2734d5=typeof _0x31cbf2['offset']===_0xb73e('0x29')&&typeof _0x31cbf2[_0xb73e('0x2a')]===_0xb73e('0x29');var _0x499c44=_0x5713b8['count'];var _0x1df2d9=_0x2734d5?0x0:_0x31cbf2[_0xb73e('0x2b')];var _0x2fef57=_0x2734d5?_0x5713b8[_0xb73e('0x2c')]:_0x31cbf2[_0xb73e('0x2b')]+_0x31cbf2['limit'];var _0x2e7896;if(_0x2fef57>=_0x499c44){_0x2fef57=_0x499c44;_0x2e7896=0xc8;}else{_0x2e7896=0xce;}_0x2d995a['status'](_0x2e7896);return _0x2d995a[_0xb73e('0x2d')](_0xb73e('0x2e'),_0x1df2d9+'-'+_0x2fef57+'/'+_0x499c44)[_0xb73e('0x28')](_0x5713b8);}return null;};}function patchUpdates(_0x5ba3d5){return function(_0x1bc634){try{jsonpatch[_0xb73e('0x2f')](_0x1bc634,_0x5ba3d5,!![]);}catch(_0x204c24){return BPromise[_0xb73e('0x30')](_0x204c24);}return _0x1bc634[_0xb73e('0x31')]();};}function saveUpdates(_0x40e412,_0x5ab277){return function(_0x13c25f){if(_0x13c25f){return _0x13c25f[_0xb73e('0x32')](_0x40e412)[_0xb73e('0x33')](function(_0x463e72){return _0x463e72;});}return null;};}function removeEntity(_0x196902,_0x46433a){return function(_0x15c576){if(_0x15c576){return _0x15c576[_0xb73e('0x34')]()[_0xb73e('0x33')](function(){var _0x44029f=_0x15c576[_0xb73e('0x35')]({'plain':!![]});var _0x52b011=_0xb73e('0x36');return db[_0xb73e('0x37')][_0xb73e('0x34')]({'where':{'type':_0x52b011,'resourceId':_0x44029f['id']}})['then'](function(){return _0x15c576;});})[_0xb73e('0x33')](function(){_0x196902[_0xb73e('0x26')](0xcc)['end']();});}};}function handleEntityNotFound(_0x2231eb,_0x1f4260){return function(_0x16b5a8){if(!_0x16b5a8){_0x2231eb[_0xb73e('0x38')](0x194);}return _0x16b5a8;};}function handleError(_0x1abbb2,_0x4731dd){_0x4731dd=_0x4731dd||0x1f4;return function(_0x2e95f8){logger[_0xb73e('0x21')](_0x2e95f8[_0xb73e('0x39')]);if(_0x2e95f8[_0xb73e('0x3a')]){delete _0x2e95f8[_0xb73e('0x3a')];}_0x1abbb2[_0xb73e('0x26')](_0x4731dd)['send'](_0x2e95f8);};}exports['index']=function(_0x589423,_0x3681ea){var _0x59fbc4={'include':[{'model':db['Pause'],'as':_0xb73e('0x3b')}]},_0x57ed7d={},_0x3d56ad={'count':0x0,'rows':[]};var _0x4e52b3=_[_0xb73e('0x3c')](db[_0xb73e('0x3d')][_0xb73e('0x3e')],function(_0x1aaf20){return{'name':_0x1aaf20[_0xb73e('0x3f')],'type':_0x1aaf20[_0xb73e('0x40')][_0xb73e('0x41')]};});_0x57ed7d[_0xb73e('0x42')]=_[_0xb73e('0x3c')](_0x4e52b3,_0xb73e('0x3a'));_0x57ed7d[_0xb73e('0x43')]=_[_0xb73e('0x44')](_0x589423[_0xb73e('0x43')]);_0x57ed7d[_0xb73e('0x45')]=_[_0xb73e('0x46')](_0x57ed7d['model'],_0x57ed7d[_0xb73e('0x43')]);_0x59fbc4['attributes']=_[_0xb73e('0x46')](_0x57ed7d['model'],qs['fields'](_0x589423['query'][_0xb73e('0x47')]));_0x59fbc4['attributes']=_0x59fbc4[_0xb73e('0x48')][_0xb73e('0x49')]?_0x59fbc4[_0xb73e('0x48')]:_0x57ed7d[_0xb73e('0x42')];if(!_0x589423[_0xb73e('0x43')][_0xb73e('0x4a')]('nolimit')){_0x59fbc4[_0xb73e('0x2a')]=qs[_0xb73e('0x2a')](_0x589423[_0xb73e('0x43')][_0xb73e('0x2a')]);_0x59fbc4[_0xb73e('0x2b')]=qs[_0xb73e('0x2b')](_0x589423[_0xb73e('0x43')][_0xb73e('0x2b')]);}_0x59fbc4[_0xb73e('0x4b')]=qs[_0xb73e('0x4c')](_0x589423[_0xb73e('0x43')][_0xb73e('0x4c')]);_0x59fbc4[_0xb73e('0x4d')]=qs[_0xb73e('0x45')](_[_0xb73e('0x4e')](_0x589423[_0xb73e('0x43')],_0x57ed7d[_0xb73e('0x45')]),_0x4e52b3);if(_0x589423[_0xb73e('0x43')][_0xb73e('0x4f')]){_0x59fbc4['where']=_[_0xb73e('0x50')](_0x59fbc4[_0xb73e('0x4d')],{'$or':_[_0xb73e('0x3c')](_0x4e52b3,function(_0x1859df){if(_0x1859df[_0xb73e('0x40')]!==_0xb73e('0x51')){var _0x307941={};_0x307941[_0x1859df['name']]={'$like':'%'+_0x589423[_0xb73e('0x43')][_0xb73e('0x4f')]+'%'};return _0x307941;}})});}_0x59fbc4=_[_0xb73e('0x50')]({},_0x59fbc4,_0x589423[_0xb73e('0x52')]);var _0x18a505={'where':_0x59fbc4[_0xb73e('0x4d')]};return db['WhatsappAccount'][_0xb73e('0x2c')](_0x18a505)['then'](function(_0x4bab20){_0x3d56ad[_0xb73e('0x2c')]=_0x4bab20;if(_0x589423[_0xb73e('0x43')][_0xb73e('0x53')]){_0x59fbc4[_0xb73e('0x54')]=[{'all':!![]}];}return db['WhatsappAccount'][_0xb73e('0x55')](_0x59fbc4);})['then'](function(_0x3f9e63){_0x3d56ad[_0xb73e('0x56')]=_0x3f9e63;return _0x3d56ad;})['then'](respondWithFilteredResult(_0x3681ea,_0x59fbc4))['catch'](handleError(_0x3681ea,null));};exports[_0xb73e('0x57')]=function(_0x2d7fa1,_0x94e8d4){var _0x313abb={'raw':![],'where':{'id':_0x2d7fa1[_0xb73e('0x58')]['id']},'include':[{'model':db[_0xb73e('0x59')],'as':'mandatoryDispositionPause'}]},_0x2106d2={};_0x2106d2[_0xb73e('0x42')]=_[_0xb73e('0x44')](db['WhatsappAccount'][_0xb73e('0x3e')]);_0x2106d2[_0xb73e('0x43')]=_['keys'](_0x2d7fa1['query']);_0x2106d2['filters']=_[_0xb73e('0x46')](_0x2106d2[_0xb73e('0x42')],_0x2106d2[_0xb73e('0x43')]);_0x313abb[_0xb73e('0x48')]=_[_0xb73e('0x46')](_0x2106d2[_0xb73e('0x42')],qs[_0xb73e('0x47')](_0x2d7fa1[_0xb73e('0x43')][_0xb73e('0x47')]));_0x313abb[_0xb73e('0x48')]=_0x313abb[_0xb73e('0x48')][_0xb73e('0x49')]?_0x313abb[_0xb73e('0x48')]:_0x2106d2[_0xb73e('0x42')];if(_0x2d7fa1[_0xb73e('0x43')]['includeAll']){_0x313abb['include']=[{'all':!![]}];}_0x313abb=_[_0xb73e('0x50')]({},_0x313abb,_0x2d7fa1[_0xb73e('0x52')]);return db[_0xb73e('0x3d')][_0xb73e('0x5a')](_0x313abb)['then'](handleEntityNotFound(_0x94e8d4,null))[_0xb73e('0x33')](respondWithResult(_0x94e8d4,null))['catch'](handleError(_0x94e8d4,null));};exports[_0xb73e('0x5b')]=function(_0x2ee96d,_0x19dc4c){return db['WhatsappAccount'][_0xb73e('0x5b')](_0x2ee96d['body'],{})[_0xb73e('0x33')](function(_0x191610){var _0x4d2cfe=_0x2ee96d['user'][_0xb73e('0x35')]({'plain':!![]});if(!_0x4d2cfe)throw new Error(_0xb73e('0x5c'));if(_0x4d2cfe[_0xb73e('0x5d')]===_0xb73e('0x5e')){var _0x49bd8d=_0x191610[_0xb73e('0x35')]({'plain':!![]});var _0x6bb067='WhatsappAccounts';return db[_0xb73e('0x5f')][_0xb73e('0x5a')]({'where':{'name':_0x6bb067,'userProfileId':_0x4d2cfe[_0xb73e('0x60')]},'raw':!![]})[_0xb73e('0x33')](function(_0x59a51e){if(_0x59a51e&&_0x59a51e[_0xb73e('0x61')]===0x0){return db[_0xb73e('0x37')]['create']({'name':_0x49bd8d[_0xb73e('0x3a')],'resourceId':_0x49bd8d['id'],'type':_0x59a51e['name'],'sectionId':_0x59a51e['id']},{})[_0xb73e('0x33')](function(){return _0x191610;});}else{return _0x191610;}})[_0xb73e('0x25')](function(_0x4d14ef){logger['error'](_0xb73e('0x62'),_0x4d14ef);throw _0x4d14ef;});}return _0x191610;})[_0xb73e('0x33')](respondWithResult(_0x19dc4c,0xc9))[_0xb73e('0x25')](handleError(_0x19dc4c,null));};exports[_0xb73e('0x32')]=function(_0x4e2297,_0x3a6ded){if(_0x4e2297['body']['id']){delete _0x4e2297['body']['id'];}return db['WhatsappAccount'][_0xb73e('0x5a')]({'where':{'id':_0x4e2297[_0xb73e('0x58')]['id']},'include':[{'model':db[_0xb73e('0x59')],'as':_0xb73e('0x3b')}]})[_0xb73e('0x33')](handleEntityNotFound(_0x3a6ded,null))[_0xb73e('0x33')](saveUpdates(_0x4e2297[_0xb73e('0x63')],null))['then'](respondWithResult(_0x3a6ded,null))[_0xb73e('0x25')](handleError(_0x3a6ded,null));};exports[_0xb73e('0x34')]=function(_0x2ba241,_0x236275){return db[_0xb73e('0x3d')]['find']({'where':{'id':_0x2ba241[_0xb73e('0x58')]['id']}})[_0xb73e('0x33')](handleEntityNotFound(_0x236275,null))[_0xb73e('0x33')](removeEntity(_0x236275,null))[_0xb73e('0x25')](handleError(_0x236275,null));};exports[_0xb73e('0x64')]=function(_0x36d858,_0x26bb6e){return db['WhatsappAccount'][_0xb73e('0x64')]()[_0xb73e('0x33')](respondWithResult(_0x26bb6e,null))[_0xb73e('0x25')](handleError(_0x26bb6e,null));};exports[_0xb73e('0x65')]=function(_0x20e65c,_0x1f14bd,_0xa440ed){if(_0x20e65c[_0xb73e('0x63')]['id']){delete _0x20e65c['body']['id'];}return db[_0xb73e('0x3d')]['find']({'where':{'id':_0x20e65c[_0xb73e('0x58')]['id']}})[_0xb73e('0x33')](handleEntityNotFound(_0x1f14bd,null))['then'](function(_0x1e04ee){if(_0x1e04ee){_0x20e65c[_0xb73e('0x63')]['WhatsappAccountId']=_0x1e04ee['id'];return db[_0xb73e('0x66')][_0xb73e('0x5b')](_0x20e65c['body']);}})[_0xb73e('0x33')](respondWithResult(_0x1f14bd,null))[_0xb73e('0x25')](handleError(_0x1f14bd,null));};exports['getDispositions']=function(_0x235cb8,_0x4591f1,_0x2c2baf){var _0x526d11={'raw':![],'where':{}};var _0x473dfc={};var _0x4f0538={'count':0x0,'rows':[]};return db[_0xb73e('0x3d')]['findOne']({'where':{'id':_0x235cb8[_0xb73e('0x58')]['id']}})[_0xb73e('0x33')](handleEntityNotFound(_0x4591f1,null))[_0xb73e('0x33')](function(_0x4b0ddb){if(_0x4b0ddb){_0x473dfc[_0xb73e('0x42')]=_[_0xb73e('0x44')](db[_0xb73e('0x66')][_0xb73e('0x3e')]);_0x473dfc[_0xb73e('0x43')]=_[_0xb73e('0x44')](_0x235cb8['query']);_0x473dfc[_0xb73e('0x45')]=_['intersection'](_0x473dfc[_0xb73e('0x42')],_0x473dfc[_0xb73e('0x43')]);_0x526d11[_0xb73e('0x48')]=_[_0xb73e('0x46')](_0x473dfc[_0xb73e('0x42')],qs[_0xb73e('0x47')](_0x235cb8[_0xb73e('0x43')][_0xb73e('0x47')]));_0x526d11[_0xb73e('0x48')]=_0x526d11['attributes'][_0xb73e('0x49')]?_0x526d11[_0xb73e('0x48')]:_0x473dfc[_0xb73e('0x42')];if(!_0x235cb8[_0xb73e('0x43')][_0xb73e('0x4a')]('nolimit')){_0x526d11['limit']=qs[_0xb73e('0x2a')](_0x235cb8[_0xb73e('0x43')][_0xb73e('0x2a')]);_0x526d11[_0xb73e('0x2b')]=qs[_0xb73e('0x2b')](_0x235cb8[_0xb73e('0x43')][_0xb73e('0x2b')]);}_0x526d11[_0xb73e('0x4b')]=qs['sort'](_0x235cb8[_0xb73e('0x43')][_0xb73e('0x4c')]);_0x526d11[_0xb73e('0x4d')]=qs[_0xb73e('0x45')](_[_0xb73e('0x4e')](_0x235cb8[_0xb73e('0x43')],_0x473dfc[_0xb73e('0x45')]));_0x526d11[_0xb73e('0x4d')][_0xb73e('0x67')]=_0x4b0ddb['id'];if(_0x235cb8['query'][_0xb73e('0x4f')]){_0x526d11['where']=_[_0xb73e('0x50')](_0x526d11[_0xb73e('0x4d')],{'$or':_['map'](_0x526d11[_0xb73e('0x48')],function(_0x47145b){var _0x5d0b52={};_0x5d0b52[_0x47145b]={'$like':'%'+_0x235cb8[_0xb73e('0x43')][_0xb73e('0x4f')]+'%'};return _0x5d0b52;})});}_0x526d11=_[_0xb73e('0x50')]({},_0x526d11,_0x235cb8[_0xb73e('0x52')]);return db['Disposition'][_0xb73e('0x2c')]({'where':_0x526d11[_0xb73e('0x4d')]})[_0xb73e('0x33')](function(_0x22d794){_0x4f0538[_0xb73e('0x2c')]=_0x22d794;if(_0x235cb8[_0xb73e('0x43')]['includeAll']){_0x526d11[_0xb73e('0x54')]=[{'all':!![]}];}return db['Disposition'][_0xb73e('0x55')](_0x526d11);})[_0xb73e('0x33')](function(_0x6c0a1e){_0x4f0538[_0xb73e('0x56')]=_0x6c0a1e;return _0x4f0538;});}})[_0xb73e('0x33')](respondWithFilteredResult(_0x4591f1,_0x526d11))['catch'](handleError(_0x4591f1,null));};exports[_0xb73e('0x68')]=function(_0x260dfe,_0x32beec,_0x3c3747){return db[_0xb73e('0x3d')][_0xb73e('0x5a')]({'where':{'id':_0x260dfe[_0xb73e('0x58')]['id']}})['then'](handleEntityNotFound(_0x32beec,null))['then'](function(_0x59613c){if(_0x59613c){return _0x59613c['removeDispositions'](_0x260dfe[_0xb73e('0x43')][_0xb73e('0x69')]);}})[_0xb73e('0x33')](respondWithStatusCode(_0x32beec,null))[_0xb73e('0x25')](handleError(_0x32beec,null));};exports[_0xb73e('0x6a')]=function(_0x587778,_0x258267,_0x1b7fbc){if(_0x587778['body']['id']){delete _0x587778[_0xb73e('0x63')]['id'];}return db[_0xb73e('0x3d')][_0xb73e('0x5a')]({'where':{'id':_0x587778['params']['id']}})[_0xb73e('0x33')](handleEntityNotFound(_0x258267,null))[_0xb73e('0x33')](function(_0x1636a5){if(_0x1636a5){_0x587778[_0xb73e('0x63')][_0xb73e('0x67')]=_0x1636a5['id'];return db['CannedAnswer']['create'](_0x587778[_0xb73e('0x63')]);}})['then'](respondWithResult(_0x258267,null))[_0xb73e('0x25')](handleError(_0x258267,null));};exports[_0xb73e('0x6b')]=function(_0x219447,_0x3fb7c0,_0x295922){var _0x519cd6={'raw':![],'where':{}};var _0x3cff33={};var _0x41d510={'count':0x0,'rows':[]};return db[_0xb73e('0x3d')]['findOne']({'where':{'id':_0x219447[_0xb73e('0x58')]['id']}})['then'](handleEntityNotFound(_0x3fb7c0,null))[_0xb73e('0x33')](function(_0x63565a){if(_0x63565a){_0x3cff33[_0xb73e('0x42')]=_[_0xb73e('0x44')](db['CannedAnswer'][_0xb73e('0x3e')]);_0x3cff33['query']=_['keys'](_0x219447[_0xb73e('0x43')]);_0x3cff33['filters']=_['intersection'](_0x3cff33[_0xb73e('0x42')],_0x3cff33[_0xb73e('0x43')]);_0x519cd6[_0xb73e('0x48')]=_['intersection'](_0x3cff33['model'],qs[_0xb73e('0x47')](_0x219447[_0xb73e('0x43')][_0xb73e('0x47')]));_0x519cd6[_0xb73e('0x48')]=_0x519cd6['attributes'][_0xb73e('0x49')]?_0x519cd6[_0xb73e('0x48')]:_0x3cff33['model'];if(!_0x219447['query'][_0xb73e('0x4a')]('nolimit')){_0x519cd6[_0xb73e('0x2a')]=qs[_0xb73e('0x2a')](_0x219447[_0xb73e('0x43')][_0xb73e('0x2a')]);_0x519cd6[_0xb73e('0x2b')]=qs[_0xb73e('0x2b')](_0x219447[_0xb73e('0x43')][_0xb73e('0x2b')]);}_0x519cd6[_0xb73e('0x4b')]=qs[_0xb73e('0x4c')](_0x219447[_0xb73e('0x43')]['sort']);_0x519cd6[_0xb73e('0x4d')]=qs[_0xb73e('0x45')](_[_0xb73e('0x4e')](_0x219447['query'],_0x3cff33[_0xb73e('0x45')]));_0x519cd6['where'][_0xb73e('0x67')]=_0x63565a['id'];if(_0x219447[_0xb73e('0x43')][_0xb73e('0x4f')]){_0x519cd6['where']=_[_0xb73e('0x50')](_0x519cd6[_0xb73e('0x4d')],{'$or':_['map'](_0x519cd6[_0xb73e('0x48')],function(_0x1dc39b){var _0x3a9f63={};_0x3a9f63[_0x1dc39b]={'$like':'%'+_0x219447['query'][_0xb73e('0x4f')]+'%'};return _0x3a9f63;})});}_0x519cd6=_[_0xb73e('0x50')]({},_0x519cd6,_0x219447[_0xb73e('0x52')]);return db[_0xb73e('0x6c')][_0xb73e('0x2c')]({'where':_0x519cd6['where']})[_0xb73e('0x33')](function(_0x2aec28){_0x41d510[_0xb73e('0x2c')]=_0x2aec28;if(_0x219447[_0xb73e('0x43')][_0xb73e('0x53')]){_0x519cd6['include']=[{'all':!![]}];}return db[_0xb73e('0x6c')][_0xb73e('0x55')](_0x519cd6);})[_0xb73e('0x33')](function(_0x486af6){_0x41d510[_0xb73e('0x56')]=_0x486af6;return _0x41d510;});}})['then'](respondWithFilteredResult(_0x3fb7c0,_0x519cd6))[_0xb73e('0x25')](handleError(_0x3fb7c0,null));};exports[_0xb73e('0x6d')]=function(_0x23cbd3,_0x58bf74,_0x571998){return db[_0xb73e('0x3d')][_0xb73e('0x5a')]({'where':{'id':_0x23cbd3[_0xb73e('0x58')]['id']}})[_0xb73e('0x33')](handleEntityNotFound(_0x58bf74,null))['then'](function(_0x110c8){if(_0x110c8){return _0x110c8[_0xb73e('0x6d')](_0x23cbd3['query']['ids']);}})['then'](respondWithStatusCode(_0x58bf74,null))[_0xb73e('0x25')](handleError(_0x58bf74,null));};exports[_0xb73e('0x6e')]=function(_0x43b538,_0x3e4676,_0x3dec45){return db['WhatsappAccount'][_0xb73e('0x5a')]({'where':{'id':_0x43b538[_0xb73e('0x58')]['id']}})[_0xb73e('0x33')](handleEntityNotFound(_0x3e4676,null))[_0xb73e('0x33')](function(_0x4e8351){if(_0x4e8351){return _0x4e8351[_0xb73e('0x6e')](_0x43b538[_0xb73e('0x63')][_0xb73e('0x69')],_[_0xb73e('0x6f')](_0x43b538[_0xb73e('0x63')],[_0xb73e('0x69'),'id'])||{})['spread'](function(_0x27d5e5){for(var _0x5a2e03=0x0;_0x5a2e03<_0x43b538[_0xb73e('0x63')][_0xb73e('0x69')][_0xb73e('0x49')];_0x5a2e03+=0x1){socket[_0xb73e('0x70')](_0xb73e('0x71'),{'UserId':Number(_0x43b538[_0xb73e('0x63')][_0xb73e('0x69')][_0x5a2e03]),'WhatsappAccountId':Number(_0x43b538[_0xb73e('0x58')]['id'])});}return _0x27d5e5;});}})[_0xb73e('0x33')](respondWithResult(_0x3e4676,null))[_0xb73e('0x25')](handleError(_0x3e4676,null));};exports[_0xb73e('0x72')]=function(_0x18baf4,_0x2e61d5,_0xa95098){return db['WhatsappAccount'][_0xb73e('0x5a')]({'where':{'id':_0x18baf4[_0xb73e('0x58')]['id']}})[_0xb73e('0x33')](handleEntityNotFound(_0x2e61d5,null))[_0xb73e('0x33')](function(_0x28ee5a){if(_0x28ee5a){return _0x28ee5a[_0xb73e('0x72')](_0x18baf4[_0xb73e('0x43')][_0xb73e('0x69')])['then'](function(){if(_['isArray'](_0x18baf4[_0xb73e('0x43')][_0xb73e('0x69')])){for(var _0x254e26=0x0;_0x254e26<_0x18baf4[_0xb73e('0x43')][_0xb73e('0x69')][_0xb73e('0x49')];_0x254e26+=0x1){socket[_0xb73e('0x70')](_0xb73e('0x73'),{'UserId':Number(_0x18baf4[_0xb73e('0x43')]['ids'][_0x254e26]),'WhatsappAccountId':Number(_0x18baf4[_0xb73e('0x58')]['id'])});}}else{socket[_0xb73e('0x70')]('userWhatsappAccount:remove',{'UserId':Number(_0x18baf4[_0xb73e('0x43')][_0xb73e('0x69')]),'WhatsappAccountId':Number(_0x18baf4[_0xb73e('0x58')]['id'])});}});}})[_0xb73e('0x33')](respondWithStatusCode(_0x2e61d5,null))['catch'](handleError(_0x2e61d5,null));};exports[_0xb73e('0x74')]=function(_0x2b6b66,_0x140bd6,_0x164e9b){var _0x28d716={};var _0x525c9c={};var _0x4fb408;var _0x369d0c;return db[_0xb73e('0x3d')][_0xb73e('0x75')]({'where':{'id':_0x2b6b66[_0xb73e('0x58')]['id']}})[_0xb73e('0x33')](handleEntityNotFound(_0x140bd6,null))[_0xb73e('0x33')](function(_0x36e3a2){if(_0x36e3a2){_0x4fb408=_0x36e3a2;_0x525c9c[_0xb73e('0x42')]=_[_0xb73e('0x44')](db[_0xb73e('0x76')]['rawAttributes']);_0x525c9c[_0xb73e('0x43')]=_[_0xb73e('0x44')](_0x2b6b66[_0xb73e('0x43')]);_0x525c9c[_0xb73e('0x45')]=_[_0xb73e('0x46')](_0x525c9c[_0xb73e('0x42')],_0x525c9c[_0xb73e('0x43')]);_0x28d716[_0xb73e('0x48')]=_['intersection'](_0x525c9c[_0xb73e('0x42')],qs[_0xb73e('0x47')](_0x2b6b66[_0xb73e('0x43')][_0xb73e('0x47')]));_0x28d716[_0xb73e('0x48')]=_0x28d716['attributes']['length']?_0x28d716[_0xb73e('0x48')]:_0x525c9c[_0xb73e('0x42')];_0x28d716[_0xb73e('0x4b')]=qs['sort'](_0x2b6b66[_0xb73e('0x43')][_0xb73e('0x4c')]);_0x28d716[_0xb73e('0x4d')]=qs[_0xb73e('0x45')](_[_0xb73e('0x4e')](_0x2b6b66['query'],_0x525c9c[_0xb73e('0x45')]));if(_0x2b6b66[_0xb73e('0x43')][_0xb73e('0x4f')]){_0x28d716[_0xb73e('0x4d')]=_['merge'](_0x28d716[_0xb73e('0x4d')],{'$or':_[_0xb73e('0x3c')](_0x28d716[_0xb73e('0x48')],function(_0x559bc5){var _0xf9c229={};_0xf9c229[_0x559bc5]={'$like':'%'+_0x2b6b66[_0xb73e('0x43')]['filter']+'%'};return _0xf9c229;})});}_0x28d716=_[_0xb73e('0x50')]({},_0x28d716,_0x2b6b66[_0xb73e('0x52')]);return _0x4fb408[_0xb73e('0x74')](_0x28d716);}})['then'](function(_0x943c9a){if(_0x943c9a){_0x369d0c=_0x943c9a[_0xb73e('0x49')];if(!_0x2b6b66['query'][_0xb73e('0x4a')](_0xb73e('0x77'))){_0x28d716[_0xb73e('0x2a')]=qs[_0xb73e('0x2a')](_0x2b6b66[_0xb73e('0x43')]['limit']);_0x28d716[_0xb73e('0x2b')]=qs[_0xb73e('0x2b')](_0x2b6b66[_0xb73e('0x43')][_0xb73e('0x2b')]);}return _0x4fb408['getAgents'](_0x28d716);}})[_0xb73e('0x33')](function(_0x54beec){if(_0x54beec){return _0x54beec?{'count':_0x369d0c,'rows':_0x54beec}:null;}})[_0xb73e('0x33')](respondWithResult(_0x140bd6,null))[_0xb73e('0x25')](handleError(_0x140bd6,null));};exports[_0xb73e('0x78')]=function(_0x1800cc,_0x11c27e){var _0x28f735=_0x1800cc['params']['id'];var _0x12d78f=_0x1800cc[_0xb73e('0x63')];var _0x2fa349=0xc8;var _0x2fb598=null;return db[_0xb73e('0x79')][_0xb73e('0x7a')]({'isolationLevel':db[_0xb73e('0x79')][_0xb73e('0x7b')][_0xb73e('0x7c')][_0xb73e('0x7d')]},function(_0x18a6a8){return db[_0xb73e('0x3d')][_0xb73e('0x75')]({'where':{'id':_0x28f735},'transaction':_0x18a6a8})[_0xb73e('0x33')](function(_0x46ccb6){if(_0x46ccb6){return db['WhatsappApplication'][_0xb73e('0x34')]({'where':{'WhatsappAccountId':_0x28f735},'transaction':_0x18a6a8})[_0xb73e('0x33')](function(){var _0x19f418=_[_0xb73e('0x3c')](_0x12d78f,function(_0x36fd62){_0x36fd62[_0xb73e('0x67')]=_0x28f735;return _0x36fd62;});return db[_0xb73e('0x7e')][_0xb73e('0x7f')](_0x19f418,{'transaction':_0x18a6a8});});}else{_0x2fa349=0x194;_0x2fb598=[];}});})[_0xb73e('0x33')](function(){if(_0x2fa349!==0x194){return db[_0xb73e('0x7e')]['findAndCountAll']({'where':{'WhatsappAccountId':_0x28f735},'order':_0xb73e('0x80')})[_0xb73e('0x33')](function(_0x441c33){_0x2fb598=_0x441c33;});}})['catch'](function(_0x3e0b2d){_0x2fa349=0x1f4;logger[_0xb73e('0x21')](_0x3e0b2d[_0xb73e('0x39')]);if(_0x3e0b2d[_0xb73e('0x3a')]){delete _0x3e0b2d[_0xb73e('0x3a')];}_0x2fb598=_0x3e0b2d;})[_0xb73e('0x81')](function(){if(_0x2fb598===null){_0x11c27e['sendStatus'](_0x2fa349);}else{if(_0x2fa349===0x1f4){_0x11c27e[_0xb73e('0x26')](_0x2fa349)[_0xb73e('0x82')](_0x2fb598);}else{_0x11c27e[_0xb73e('0x26')](_0x2fa349)[_0xb73e('0x28')](_0x2fb598);}}});};exports[_0xb73e('0x83')]=function(_0x5f5c2f,_0x5a49c3,_0x1ef9e5){var _0x5e0847={};var _0x1dd75c={};var _0x4cbb82;var _0x125c7b;return db['WhatsappAccount']['findOne']({'where':{'id':_0x5f5c2f[_0xb73e('0x58')]['id']}})[_0xb73e('0x33')](handleEntityNotFound(_0x5a49c3,null))['then'](function(_0xf86a6e){if(_0xf86a6e){_0x4cbb82=_0xf86a6e;_0x1dd75c['model']=_[_0xb73e('0x44')](db['WhatsappApplication'][_0xb73e('0x3e')]);_0x1dd75c[_0xb73e('0x43')]=_[_0xb73e('0x44')](_0x5f5c2f['query']);_0x1dd75c[_0xb73e('0x45')]=_[_0xb73e('0x46')](_0x1dd75c[_0xb73e('0x42')],_0x1dd75c[_0xb73e('0x43')]);_0x5e0847[_0xb73e('0x48')]=_[_0xb73e('0x46')](_0x1dd75c[_0xb73e('0x42')],qs['fields'](_0x5f5c2f['query'][_0xb73e('0x47')]));_0x5e0847[_0xb73e('0x48')]=_0x5e0847[_0xb73e('0x48')][_0xb73e('0x49')]?_0x5e0847[_0xb73e('0x48')]:_0x1dd75c[_0xb73e('0x42')];_0x5e0847[_0xb73e('0x4b')]=qs[_0xb73e('0x4c')](_0x5f5c2f[_0xb73e('0x43')]['sort']);_0x5e0847['where']=qs[_0xb73e('0x45')](_[_0xb73e('0x4e')](_0x5f5c2f[_0xb73e('0x43')],_0x1dd75c[_0xb73e('0x45')]));if(_0x5f5c2f['query']['filter']){_0x5e0847[_0xb73e('0x4d')]=_['merge'](_0x5e0847[_0xb73e('0x4d')],{'$or':_[_0xb73e('0x3c')](_0x5e0847[_0xb73e('0x48')],function(_0x2be178){var _0x36ca3d={};_0x36ca3d[_0x2be178]={'$like':'%'+_0x5f5c2f[_0xb73e('0x43')][_0xb73e('0x4f')]+'%'};return _0x36ca3d;})});}_0x5e0847=_['merge']({},_0x5e0847,_0x5f5c2f[_0xb73e('0x52')]);return _0x4cbb82['getApplications'](_0x5e0847);}})[_0xb73e('0x33')](function(_0x5714bb){if(_0x5714bb){_0x125c7b=_0x5714bb[_0xb73e('0x49')];if(!_0x5f5c2f[_0xb73e('0x43')][_0xb73e('0x4a')](_0xb73e('0x77'))){_0x5e0847['limit']=qs[_0xb73e('0x2a')](_0x5f5c2f[_0xb73e('0x43')]['limit']);_0x5e0847[_0xb73e('0x2b')]=qs[_0xb73e('0x2b')](_0x5f5c2f[_0xb73e('0x43')][_0xb73e('0x2b')]);}return _0x4cbb82[_0xb73e('0x83')](_0x5e0847);}})[_0xb73e('0x33')](function(_0x5e7ab3){if(_0x5e7ab3){return _0x5e7ab3?{'count':_0x125c7b,'rows':_0x5e7ab3}:null;}})[_0xb73e('0x33')](respondWithResult(_0x5a49c3,null))[_0xb73e('0x25')](handleError(_0x5a49c3,null));};exports[_0xb73e('0x84')]=function(_0x4a5ccd,_0x17b8d8,_0x2c6362){var _0x194e91={'channel':'whatsapp'};var _0xad55b8=[];var _0x22a856=[];var _0x5158de={};return db[_0xb73e('0x3d')][_0xb73e('0x5a')]({'where':{'id':_0x4a5ccd['params']['id']},'include':[{'model':db[_0xb73e('0x7e')],'as':_0xb73e('0x85')}]})[_0xb73e('0x33')](handleEntityNotFound(_0x17b8d8,null))[_0xb73e('0x33')](function(_0x336e9b){_0x194e91['account']=_0x336e9b;if(_0x194e91['account']&&_0x194e91['account'][_0xb73e('0x40')]===_0xb73e('0x86')&&_0x4a5ccd['body'][_0xb73e('0x87')]){if(_0x4a5ccd[_0xb73e('0x63')][_0xb73e('0x87')][_0xb73e('0x49')]===0x0)return;if(_0x4a5ccd[_0xb73e('0x63')][_0xb73e('0x87')][0x0][_0xb73e('0x88')]!==_0xb73e('0x89'))return;return db[_0xb73e('0x8a')][_0xb73e('0x32')]({'read':!![],'readAt':_0x4a5ccd[_0xb73e('0x63')][_0xb73e('0x87')][0x0][_0xb73e('0x8b')]},{'where':{'messageId':_0x4a5ccd['body'][_0xb73e('0x87')][0x0][_0xb73e('0x8c')]},'individualHooks':!![]})['then'](function(_0x16a030){return _0x17b8d8[_0xb73e('0x26')](0xc8)[_0xb73e('0x28')](_0x16a030);});}_0x194e91[_0xb73e('0x8d')]=_[_0xb73e('0x8e')](_0x336e9b[_0xb73e('0x85')],[_0xb73e('0x80')],[_0xb73e('0x8f')]);if(_0x194e91[_0xb73e('0x90')]['Applications']){delete _0x194e91[_0xb73e('0x90')]['Applications'];}return db['CmContact'][_0xb73e('0x64')]()['then'](function(_0x2638c5){if(!_0x2638c5){throw new db[(_0xb73e('0x91'))][(_0xb73e('0x92'))](_0xb73e('0x93'));}_0xad55b8=_['difference'](_[_0xb73e('0x44')](_0x2638c5),[_0xb73e('0x94'),_0xb73e('0x95')]);_0x22a856=_['difference'](_['keys'](_0x2638c5),[_0xb73e('0x94'),_0xb73e('0x95'),_0xb73e('0x96'),_0xb73e('0x97')]);_0x194e91['body']={'mapKey':_0xb73e('0x98')};if(_0x194e91[_0xb73e('0x90')]&&_0x194e91['account'][_0xb73e('0x40')]===_0xb73e('0x99')){_0x194e91[_0xb73e('0x63')][_0xb73e('0x9a')]=_0x4a5ccd[_0xb73e('0x63')][_0xb73e('0x9b')]['replace'](_0xb73e('0x9c'),'');_0x194e91['body']['body']=_0x4a5ccd['body'][_0xb73e('0x9d')];_0x194e91[_0xb73e('0x63')]['messageId']=_0x4a5ccd[_0xb73e('0x63')][_0xb73e('0x9e')];}if(_0x194e91['account']&&_0x194e91[_0xb73e('0x90')][_0xb73e('0x40')]===_0xb73e('0x86')){_0x194e91['body'][_0xb73e('0x9a')]=_0x4a5ccd[_0xb73e('0x63')][_0xb73e('0x9f')][0x0][_0xb73e('0x9a')];_0x194e91['body'][_0xb73e('0x63')]=_0x4a5ccd[_0xb73e('0x63')][_0xb73e('0x9f')][0x0][_0xb73e('0x23')]['body'];_0x194e91['body'][_0xb73e('0xa0')]=_0x4a5ccd[_0xb73e('0x63')][_0xb73e('0x9f')][0x0]['message_id'];}if(_0x194e91[_0xb73e('0x63')]['id']){delete _0x194e91[_0xb73e('0x63')]['id'];}if(_[_0xb73e('0xa1')](_0x194e91['body'][_0xb73e('0x9a')])){throw new db['Sequelize'][(_0xb73e('0x92'))](_0xb73e('0xa2'));}if(_[_0xb73e('0xa1')](_0x194e91[_0xb73e('0x63')][_0xb73e('0x63')])||_0x194e91[_0xb73e('0x63')][_0xb73e('0x63')]===''){throw new db[(_0xb73e('0x91'))][(_0xb73e('0x92'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0xb73e('0xa1')](_0x194e91[_0xb73e('0x63')][_0xb73e('0xa3')])){throw new db[(_0xb73e('0x91'))][(_0xb73e('0x92'))]('mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x22a856);}if(!_[_0xb73e('0xa4')](_0x22a856,_0x194e91[_0xb73e('0x63')]['mapKey'])){throw new db[(_0xb73e('0x91'))][(_0xb73e('0x92'))](_0xb73e('0xa5')+_0x22a856);}_0x5158de[_0x194e91[_0xb73e('0x63')][_0xb73e('0xa3')]]=_0x194e91[_0xb73e('0x63')][_0xb73e('0x9a')];return db['CmList'][_0xb73e('0x5a')]({'where':{'id':_0x194e91[_0xb73e('0x90')][_0xb73e('0x97')]},'include':[{'model':db[_0xb73e('0xa6')],'as':_0xb73e('0xa7'),'where':_0x5158de,'limit':0x1,'order':[[_0xb73e('0x95'),_0xb73e('0xa8')]]}]});})[_0xb73e('0x33')](handleEntityNotFound(_0x17b8d8,null))['then'](function(_0x4b2b8f){if(_0x4b2b8f){_0x194e91['list']=_['omit'](_0x4b2b8f,[_0xb73e('0xa7')]);if(_0x4b2b8f['Contacts'][_0xb73e('0x49')]){return _0x4b2b8f[_0xb73e('0xa7')][0x0];}var _0x2c5925=_[_0xb73e('0xa9')](_0x194e91['body'],{'firstName':_0x194e91[_0xb73e('0x63')][_0xb73e('0x9a')],'ListId':_0x4b2b8f['id']});_0x2c5925[_0x194e91[_0xb73e('0x63')][_0xb73e('0xa3')]]=_0x194e91[_0xb73e('0x63')][_0xb73e('0x9a')];return db['CmContact']['create'](_0x2c5925,{'fields':_0xad55b8,'raw':!![]});}})[_0xb73e('0x33')](handleEntityNotFound(_0x17b8d8,null))['then'](function(_0x44538a){if(_0x44538a){_0x194e91[_0xb73e('0xaa')]=_0x44538a;var _0x3e07c5={'ContactId':_0x44538a['id'],'phone':_0x194e91['body']['from'],'WhatsappAccountId':_0x4a5ccd[_0xb73e('0x58')]['id']};var _0x4fe987={'ContactId':_0x44538a['id'],'WhatsappAccountId':_0x4a5ccd['params']['id'],'closed':![]};return db[_0xb73e('0xab')][_0xb73e('0x5a')]({'where':_0x4fe987})[_0xb73e('0x33')](function(_0x6c60f3){if(_0x6c60f3){return[_0x6c60f3,![]];}return db[_0xb73e('0xab')][_0xb73e('0x5b')](_0x3e07c5)[_0xb73e('0x33')](function(_0x5227ec){return[_0x5227ec,!![]];});});}})[_0xb73e('0xac')](function(_0x48ca31,_0x5de390){_0x194e91[_0xb73e('0xad')]=_0x48ca31['get']({'plain':!![]});_0x194e91[_0xb73e('0xad')][_0xb73e('0xae')]=![];if(_0x5de390){if(_0x194e91[_0xb73e('0x90')]['autoclose']){_0x194e91[_0xb73e('0x8d')][_0xb73e('0xaf')]({'id':0x0,'priority':_0x194e91['applications'][_0xb73e('0x49')]+0x1,'app':_0xb73e('0xb0'),'appdata':_0xb73e('0xb1'),'interval':'*,*,*,*'});}_0x194e91[_0xb73e('0xad')][_0xb73e('0xae')]=!![];}return db[_0xb73e('0x8a')][_0xb73e('0x5b')]({'phone':_0x194e91[_0xb73e('0x63')][_0xb73e('0x9a')],'messageId':_0x194e91[_0xb73e('0x63')][_0xb73e('0xa0')],'body':_0x194e91['body'][_0xb73e('0x63')],'WhatsappAccountId':_0x4a5ccd[_0xb73e('0x58')]['id'],'WhatsappInteractionId':_0x48ca31['id'],'direction':'in','ContactId':_0x48ca31[_0xb73e('0xb2')],'AttachmentId':_0x194e91[_0xb73e('0x63')][_0xb73e('0xb3')]});})[_0xb73e('0x33')](function(_0x1eede2){_0x194e91[_0xb73e('0x23')]=_0x1eede2;if(_0x194e91[_0xb73e('0xad')][_0xb73e('0xb4')]){return db[_0xb73e('0x76')][_0xb73e('0x5a')]({'attributes':['id','name'],'where':{'id':_0x194e91[_0xb73e('0xad')][_0xb73e('0xb4')]}})['then'](function(_0x31501c){if(_0x31501c){_0x194e91[_0xb73e('0x8d')][_0xb73e('0xb5')]({'id':0x0,'priority':0x0,'app':_0xb73e('0xb6'),'appdata':_0x31501c[_0xb73e('0x3a')]+','+(_0x194e91[_0xb73e('0x90')]['waitForTheAssignedAgent']||0xa),'interval':_0xb73e('0xb7')});}return respondWithRpcPromise(_0xb73e('0xb8'),_0xb73e('0xb9'),_0x194e91);});}return respondWithRpcPromise(_0xb73e('0xb8'),'startRouting',_0x194e91);})['then'](function(_0x5a9a94){if(_0x5a9a94){var _0x332a5c=0xc8;var _0x230f08=_0xb73e('0xba');logger[_0xb73e('0xbb')](_0xb73e('0xbc'),_0x230f08,_0x332a5c,'entity\x20found');logger['debug']('WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s',_0x230f08,_0x332a5c,_0xb73e('0xbd'),JSON[_0xb73e('0xbe')](_0x5a9a94));if(_0x194e91[_0xb73e('0x90')][_0xb73e('0x40')]==='twilio'){return _0x17b8d8[_0xb73e('0x26')](_0x332a5c)['set'](_0xb73e('0xbf'),_0xb73e('0xc0'))[_0xb73e('0x82')](_0xb73e('0xc1'));}else{return _0x17b8d8[_0xb73e('0x26')](_0x332a5c)[_0xb73e('0x28')](_0x5a9a94);}}});})[_0xb73e('0x25')](handleError(_0x17b8d8,null));};exports[_0xb73e('0x82')]=function(_0x4775c6,_0x28e944,_0x5a7234){var _0x47b5a8,_0x2e2fdf,_0x1821f5;if(_[_0xb73e('0xa1')](_0x4775c6[_0xb73e('0x63')]['body'])||_0x4775c6[_0xb73e('0x63')][_0xb73e('0x63')]===''){throw new db['Sequelize'][(_0xb73e('0x92'))](_0xb73e('0xc2'));}if(_[_0xb73e('0xa1')](_0x4775c6[_0xb73e('0x63')]['to'])){throw new db[(_0xb73e('0x91'))][(_0xb73e('0x92'))](_0xb73e('0xc3'));}_0x47b5a8=_0x4775c6['body']['to'];return db[_0xb73e('0x3d')][_0xb73e('0x5a')]({'where':{'id':_0x4775c6[_0xb73e('0x58')]['id']},'include':[{'model':db[_0xb73e('0xc4')],'as':_0xb73e('0xc5'),'include':[{'model':db['CmContact'],'as':'Contacts','where':{'mobile':_0x47b5a8},'limit':0x1,'order':[[_0xb73e('0x95'),_0xb73e('0xa8')]]}]}]})[_0xb73e('0x33')](handleEntityNotFound(_0x28e944,null))[_0xb73e('0x33')](function(_0x200652){if(_0x200652&&_0x200652[_0xb73e('0xc5')]){_0x2e2fdf=_0x200652['get']({'plain':!![]});if(_0x2e2fdf[_0xb73e('0xc5')]&&_0x2e2fdf['List']['Contacts']['length']){return _0x2e2fdf[_0xb73e('0xc5')][_0xb73e('0xa7')][0x0];}return db['CmContact'][_0xb73e('0x5b')](_[_0xb73e('0xa9')](_0x4775c6['body'],{'firstName':_0x47b5a8,'mobile':_0x47b5a8,'phone':_0x47b5a8,'ListId':_0x2e2fdf['ListId']}));}})[_0xb73e('0x33')](handleEntityNotFound(_0x28e944,null))[_0xb73e('0x33')](function(_0x48a801){if(_0x48a801){_0x1821f5=_0x48a801;return db[_0xb73e('0xab')][_0xb73e('0x5a')]({'where':{'ContactId':_0x1821f5['id'],'closed':![],'WhatsappAccountId':_0x2e2fdf['id']}})[_0xb73e('0x33')](function(_0x1647c6){if(_0x1647c6){return[_0x1647c6,![]];}return db[_0xb73e('0xab')]['create']({'UserId':_0x4775c6[_0xb73e('0x5e')]['id'],'ContactId':_0x1821f5['id'],'WhatsappAccountId':_0x2e2fdf['id'],'phone':_0x47b5a8,'firstMsgDirection':'out','Messages':[_[_0xb73e('0x50')](_0x4775c6['body'],{'read':![],'body':_0x4775c6[_0xb73e('0x63')][_0xb73e('0x63')],'phone':_0x47b5a8,'WhatsappAccountId':_0x2e2fdf['id'],'UserId':_0x4775c6[_0xb73e('0x5e')]['id'],'ContactId':_0x1821f5['id']})]},{'include':[{'model':db[_0xb73e('0x8a')],'as':_0xb73e('0xc6')}]})[_0xb73e('0x33')](function(_0x4f59ac){return[_0x4f59ac,!![]];});});}})[_0xb73e('0xac')](function(_0x9d8aa5,_0x28d2c8){if(_0x28d2c8){return _0x9d8aa5;}return db[_0xb73e('0x8a')][_0xb73e('0x5b')](_[_0xb73e('0x50')](_0x4775c6['body'],{'read':![],'body':_0x4775c6[_0xb73e('0x63')][_0xb73e('0x63')],'phone':_0x47b5a8,'WhatsappAccountId':_0x2e2fdf['id'],'WhatsappInteractionId':_0x9d8aa5['id'],'UserId':_0x4775c6['user']['id'],'ContactId':_0x1821f5['id']}))[_0xb73e('0x33')](function(_0x1b0670){_0x9d8aa5[_0xb73e('0xc7')][_0xb73e('0xc6')]=[];_0x9d8aa5[_0xb73e('0xc7')][_0xb73e('0xc6')][_0xb73e('0xaf')](_0x1b0670['dataValues']);return _0x9d8aa5;});})[_0xb73e('0x33')](respondWithResult(_0x28e944,null))[_0xb73e('0x25')](handleError(_0x28e944,null));}; \ No newline at end of file +var _0x2a94=['stack','name','index','mandatoryDispositionPause','WhatsappAccount','rawAttributes','type','key','model','map','query','keys','filters','attributes','intersection','fields','length','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','findAll','show','params','include','find','catch','create','body','user','Unable\x20to\x20retrieve\x20the\x20current\x20user','role','UserProfileSection','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','Pause','describe','addDisposition','WhatsappAccountId','Disposition','getDispositions','findOne','hasOwnProperty','nolimit','rows','removeDispositions','getAnswers','CannedAnswer','removeAnswers','ids','addAgents','omit','spread','userWhatsappAccount:save','removeAgents','isArray','emit','userWhatsappAccount:remove','User','getAgents','addApplications','transaction','sequelize','Transaction','ISOLATION_LEVELS','READ_COMMITTED','WhatsappApplication','bulkCreate','send','getApplications','notify','Applications','account','sinch','statuses','state','read','WhatsappMessage','timestamp','message_id','applications','orderBy','priority','asc','CmContact','Sequelize','ValidationError','difference','createdAt','CompanyId','mobile','twilio','from','From','replace','Body','notifications','messageId','isNil','from\x20is\x20mandatory','body\x20is\x20mandatory\x20and\x20not\x20empty','mapKey','mapKey\x20is\x20mandatory,\x20please\x20use\x20one\x20of\x20these:\x20','includes','CmList','ListId','Contacts','updatedAt','interaction','created','autoclose','push','unmanaged','*,*,*,*','ContactId','AttachmentId','UserId','unshift','agent','Start','startRouting','receiveMessage','WhatsappAccount,\x20%s,\x20%s,\x20%s,\x20%s','entity\x20found','Content-Type','text/xml','\x0a','List','DESC','WhatsappInteraction','out','Messages','dataValues','eml-format','rimraf','moment','mustache','util','sox','ejs','lodash','squel','crypto','jsforce','to-csv','querystring','papaparse','ioredis','../../components/auth/service','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','defaults','socket.io-emitter','register','info','request\x20sent','WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappAccount,\x20%s,\x20%s','message','result','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','update','then','destroy','get','WhatsappAccounts','UserProfileResource','end'];(function(_0x36df8b,_0x3d4a51){var _0x32fa8d=function(_0x3e51c0){while(--_0x3e51c0){_0x36df8b['push'](_0x36df8b['shift']());}};_0x32fa8d(++_0x3d4a51);}(_0x2a94,0x8a));var _0x42a9=function(_0x4a5411,_0x4be2cf){_0x4a5411=_0x4a5411-0x0;var _0x254194=_0x2a94[_0x4a5411];return _0x254194;};'use strict';var emlformat=require(_0x42a9('0x0'));var rimraf=require(_0x42a9('0x1'));var zipdir=require('zip-dir');var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x42a9('0x2'));var BPromise=require('bluebird');var Mustache=require(_0x42a9('0x3'));var util=require(_0x42a9('0x4'));var path=require('path');var sox=require(_0x42a9('0x5'));var csv=require('to-csv');var ejs=require(_0x42a9('0x6'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x42a9('0x7'));var squel=require(_0x42a9('0x8'));var crypto=require(_0x42a9('0x9'));var jsforce=require(_0x42a9('0xa'));var deskjs=require('desk.js');var toCsv=require(_0x42a9('0xb'));var querystring=require(_0x42a9('0xc'));var Papa=require(_0x42a9('0xd'));var Redis=require(_0x42a9('0xe'));var authService=require(_0x42a9('0xf'));var qs=require('../../components/parsers/qs');var as=require(_0x42a9('0x10'));var hardwareService=require(_0x42a9('0x11'));var logger=require(_0x42a9('0x12'))(_0x42a9('0x13'));var utils=require(_0x42a9('0x14'));var config=require(_0x42a9('0x15'));var licenseUtil=require(_0x42a9('0x16'));var db=require(_0x42a9('0x17'))['db'];config[_0x42a9('0x18')]=_[_0x42a9('0x19')](config[_0x42a9('0x18')],{'host':'localhost','port':0x18eb});var socket=require(_0x42a9('0x1a'))(new Redis(config[_0x42a9('0x18')]));require('./whatsappAccount.socket')[_0x42a9('0x1b')](socket);var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232c});function respondWithRpcPromise(_0x10ab19,_0xedab8d,_0x7d286,_0x3a07e6){return new BPromise(function(_0x6aa8bb,_0x34e2e8){var _0x415b08=_0x3a07e6||client;return _0x415b08['request'](_0x10ab19,_0x7d286)['then'](function(_0x3c3865){logger[_0x42a9('0x1c')]('WhatsappAccount,\x20%s,\x20%s',_0xedab8d,_0x42a9('0x1d'));logger['debug'](_0x42a9('0x1e'),_0xedab8d,'request\x20sent',JSON[_0x42a9('0x1f')](_0x3c3865));if(_0x3c3865[_0x42a9('0x20')]){if(_0x3c3865[_0x42a9('0x20')][_0x42a9('0x21')]===0x1f4){logger['error'](_0x42a9('0x22'),_0xedab8d,_0x3c3865[_0x42a9('0x20')][_0x42a9('0x23')]);return _0x34e2e8(_0x3c3865[_0x42a9('0x20')][_0x42a9('0x23')]);}logger[_0x42a9('0x20')](_0x42a9('0x22'),_0xedab8d,_0x3c3865[_0x42a9('0x20')][_0x42a9('0x23')]);return _0x6aa8bb(_0x3c3865[_0x42a9('0x20')][_0x42a9('0x23')]);}else{logger[_0x42a9('0x1c')](_0x42a9('0x22'),_0xedab8d,_0x42a9('0x1d'));_0x6aa8bb(_0x3c3865[_0x42a9('0x24')][_0x42a9('0x23')]);}})['catch'](function(_0x1b757d){logger[_0x42a9('0x20')]('WhatsappAccount,\x20%s,\x20%s',_0xedab8d,_0x1b757d);_0x34e2e8(_0x1b757d);});});}function respondWithStatusCode(_0x2e12f1,_0x242412){_0x242412=_0x242412||0xcc;return function(_0x16b79e){if(_0x16b79e){return _0x2e12f1[_0x42a9('0x25')](_0x242412);}return _0x2e12f1[_0x42a9('0x26')](_0x242412)['end']();};}function respondWithResult(_0x2e17a2,_0x2c1081){_0x2c1081=_0x2c1081||0xc8;return function(_0x3571e8){if(_0x3571e8){return _0x2e17a2[_0x42a9('0x26')](_0x2c1081)[_0x42a9('0x27')](_0x3571e8);}};}function respondWithFilteredResult(_0x544d89,_0x5f33c3){return function(_0x3dceda){if(_0x3dceda){var _0x4a8b6c=typeof _0x5f33c3[_0x42a9('0x28')]===_0x42a9('0x29')&&typeof _0x5f33c3['limit']==='undefined';var _0x3d9ab6=_0x3dceda[_0x42a9('0x2a')];var _0x49c6ec=_0x4a8b6c?0x0:_0x5f33c3['offset'];var _0x4e67ab=_0x4a8b6c?_0x3dceda[_0x42a9('0x2a')]:_0x5f33c3[_0x42a9('0x28')]+_0x5f33c3[_0x42a9('0x2b')];var _0x4fc063;if(_0x4e67ab>=_0x3d9ab6){_0x4e67ab=_0x3d9ab6;_0x4fc063=0xc8;}else{_0x4fc063=0xce;}_0x544d89[_0x42a9('0x26')](_0x4fc063);return _0x544d89[_0x42a9('0x2c')](_0x42a9('0x2d'),_0x49c6ec+'-'+_0x4e67ab+'/'+_0x3d9ab6)[_0x42a9('0x27')](_0x3dceda);}return null;};}function patchUpdates(_0x4c813c){return function(_0x39b2b0){try{jsonpatch[_0x42a9('0x2e')](_0x39b2b0,_0x4c813c,!![]);}catch(_0x38f428){return BPromise[_0x42a9('0x2f')](_0x38f428);}return _0x39b2b0[_0x42a9('0x30')]();};}function saveUpdates(_0x102bb7,_0x5b5067){return function(_0x152fec){if(_0x152fec){return _0x152fec[_0x42a9('0x31')](_0x102bb7)[_0x42a9('0x32')](function(_0x2e34dd){return _0x2e34dd;});}return null;};}function removeEntity(_0xe88452,_0x5b846a){return function(_0x2515da){if(_0x2515da){return _0x2515da[_0x42a9('0x33')]()[_0x42a9('0x32')](function(){var _0x4bedf0=_0x2515da[_0x42a9('0x34')]({'plain':!![]});var _0x3dc8f9=_0x42a9('0x35');return db[_0x42a9('0x36')][_0x42a9('0x33')]({'where':{'type':_0x3dc8f9,'resourceId':_0x4bedf0['id']}})[_0x42a9('0x32')](function(){return _0x2515da;});})[_0x42a9('0x32')](function(){_0xe88452[_0x42a9('0x26')](0xcc)[_0x42a9('0x37')]();});}};}function handleEntityNotFound(_0x482400,_0x5d9920){return function(_0x40fb51){if(!_0x40fb51){_0x482400[_0x42a9('0x25')](0x194);}return _0x40fb51;};}function handleError(_0x1f47f4,_0x698956){_0x698956=_0x698956||0x1f4;return function(_0x3c4325){logger[_0x42a9('0x20')](_0x3c4325[_0x42a9('0x38')]);if(_0x3c4325[_0x42a9('0x39')]){delete _0x3c4325[_0x42a9('0x39')];}_0x1f47f4[_0x42a9('0x26')](_0x698956)['send'](_0x3c4325);};}exports[_0x42a9('0x3a')]=function(_0x14e5ba,_0x4067a0){var _0x4d6ce0={'include':[{'model':db['Pause'],'as':_0x42a9('0x3b')}]},_0x5a9b67={},_0x19f98c={'count':0x0,'rows':[]};var _0x45ae61=_['map'](db[_0x42a9('0x3c')][_0x42a9('0x3d')],function(_0x555fec){return{'name':_0x555fec['fieldName'],'type':_0x555fec[_0x42a9('0x3e')][_0x42a9('0x3f')]};});_0x5a9b67[_0x42a9('0x40')]=_[_0x42a9('0x41')](_0x45ae61,_0x42a9('0x39'));_0x5a9b67[_0x42a9('0x42')]=_[_0x42a9('0x43')](_0x14e5ba[_0x42a9('0x42')]);_0x5a9b67[_0x42a9('0x44')]=_['intersection'](_0x5a9b67[_0x42a9('0x40')],_0x5a9b67['query']);_0x4d6ce0[_0x42a9('0x45')]=_[_0x42a9('0x46')](_0x5a9b67[_0x42a9('0x40')],qs['fields'](_0x14e5ba[_0x42a9('0x42')][_0x42a9('0x47')]));_0x4d6ce0[_0x42a9('0x45')]=_0x4d6ce0[_0x42a9('0x45')][_0x42a9('0x48')]?_0x4d6ce0[_0x42a9('0x45')]:_0x5a9b67['model'];if(!_0x14e5ba[_0x42a9('0x42')]['hasOwnProperty']('nolimit')){_0x4d6ce0[_0x42a9('0x2b')]=qs[_0x42a9('0x2b')](_0x14e5ba[_0x42a9('0x42')][_0x42a9('0x2b')]);_0x4d6ce0[_0x42a9('0x28')]=qs[_0x42a9('0x28')](_0x14e5ba[_0x42a9('0x42')]['offset']);}_0x4d6ce0[_0x42a9('0x49')]=qs[_0x42a9('0x4a')](_0x14e5ba[_0x42a9('0x42')][_0x42a9('0x4a')]);_0x4d6ce0[_0x42a9('0x4b')]=qs[_0x42a9('0x44')](_[_0x42a9('0x4c')](_0x14e5ba['query'],_0x5a9b67[_0x42a9('0x44')]),_0x45ae61);if(_0x14e5ba[_0x42a9('0x42')][_0x42a9('0x4d')]){_0x4d6ce0['where']=_[_0x42a9('0x4e')](_0x4d6ce0[_0x42a9('0x4b')],{'$or':_[_0x42a9('0x41')](_0x45ae61,function(_0x4c15aa){if(_0x4c15aa[_0x42a9('0x3e')]!==_0x42a9('0x4f')){var _0xb21f68={};_0xb21f68[_0x4c15aa[_0x42a9('0x39')]]={'$like':'%'+_0x14e5ba[_0x42a9('0x42')]['filter']+'%'};return _0xb21f68;}})});}_0x4d6ce0=_[_0x42a9('0x4e')]({},_0x4d6ce0,_0x14e5ba[_0x42a9('0x50')]);var _0x5be1e0={'where':_0x4d6ce0[_0x42a9('0x4b')]};return db[_0x42a9('0x3c')][_0x42a9('0x2a')](_0x5be1e0)[_0x42a9('0x32')](function(_0x2ebb2e){_0x19f98c['count']=_0x2ebb2e;if(_0x14e5ba[_0x42a9('0x42')][_0x42a9('0x51')]){_0x4d6ce0['include']=[{'all':!![]}];}return db['WhatsappAccount'][_0x42a9('0x52')](_0x4d6ce0);})[_0x42a9('0x32')](function(_0x2b73f0){_0x19f98c['rows']=_0x2b73f0;return _0x19f98c;})[_0x42a9('0x32')](respondWithFilteredResult(_0x4067a0,_0x4d6ce0))['catch'](handleError(_0x4067a0,null));};exports[_0x42a9('0x53')]=function(_0x2fd915,_0x113c93){var _0x1c5a70={'raw':![],'where':{'id':_0x2fd915[_0x42a9('0x54')]['id']},'include':[{'model':db['Pause'],'as':_0x42a9('0x3b')}]},_0x3e0516={};_0x3e0516[_0x42a9('0x40')]=_['keys'](db[_0x42a9('0x3c')][_0x42a9('0x3d')]);_0x3e0516[_0x42a9('0x42')]=_[_0x42a9('0x43')](_0x2fd915[_0x42a9('0x42')]);_0x3e0516[_0x42a9('0x44')]=_[_0x42a9('0x46')](_0x3e0516[_0x42a9('0x40')],_0x3e0516[_0x42a9('0x42')]);_0x1c5a70[_0x42a9('0x45')]=_[_0x42a9('0x46')](_0x3e0516[_0x42a9('0x40')],qs[_0x42a9('0x47')](_0x2fd915['query'][_0x42a9('0x47')]));_0x1c5a70[_0x42a9('0x45')]=_0x1c5a70[_0x42a9('0x45')]['length']?_0x1c5a70[_0x42a9('0x45')]:_0x3e0516[_0x42a9('0x40')];if(_0x2fd915['query']['includeAll']){_0x1c5a70[_0x42a9('0x55')]=[{'all':!![]}];}_0x1c5a70=_[_0x42a9('0x4e')]({},_0x1c5a70,_0x2fd915[_0x42a9('0x50')]);return db[_0x42a9('0x3c')][_0x42a9('0x56')](_0x1c5a70)['then'](handleEntityNotFound(_0x113c93,null))[_0x42a9('0x32')](respondWithResult(_0x113c93,null))[_0x42a9('0x57')](handleError(_0x113c93,null));};exports[_0x42a9('0x58')]=function(_0x121ba2,_0x320c54){return db[_0x42a9('0x3c')][_0x42a9('0x58')](_0x121ba2[_0x42a9('0x59')],{})[_0x42a9('0x32')](function(_0x1f5da4){var _0x17dd78=_0x121ba2[_0x42a9('0x5a')][_0x42a9('0x34')]({'plain':!![]});if(!_0x17dd78)throw new Error(_0x42a9('0x5b'));if(_0x17dd78[_0x42a9('0x5c')]==='user'){var _0x2ff271=_0x1f5da4[_0x42a9('0x34')]({'plain':!![]});var _0x28a970=_0x42a9('0x35');return db[_0x42a9('0x5d')][_0x42a9('0x56')]({'where':{'name':_0x28a970,'userProfileId':_0x17dd78['userProfileId']},'raw':!![]})[_0x42a9('0x32')](function(_0x3b76f4){if(_0x3b76f4&&_0x3b76f4[_0x42a9('0x5e')]===0x0){return db[_0x42a9('0x36')][_0x42a9('0x58')]({'name':_0x2ff271[_0x42a9('0x39')],'resourceId':_0x2ff271['id'],'type':_0x3b76f4[_0x42a9('0x39')],'sectionId':_0x3b76f4['id']},{})['then'](function(){return _0x1f5da4;});}else{return _0x1f5da4;}})[_0x42a9('0x57')](function(_0x776b49){logger[_0x42a9('0x20')](_0x42a9('0x5f'),_0x776b49);throw _0x776b49;});}return _0x1f5da4;})['then'](respondWithResult(_0x320c54,0xc9))[_0x42a9('0x57')](handleError(_0x320c54,null));};exports['update']=function(_0x56ccb6,_0x1d7186){if(_0x56ccb6[_0x42a9('0x59')]['id']){delete _0x56ccb6[_0x42a9('0x59')]['id'];}return db[_0x42a9('0x3c')][_0x42a9('0x56')]({'where':{'id':_0x56ccb6[_0x42a9('0x54')]['id']},'include':[{'model':db[_0x42a9('0x60')],'as':_0x42a9('0x3b')}]})['then'](handleEntityNotFound(_0x1d7186,null))[_0x42a9('0x32')](saveUpdates(_0x56ccb6['body'],null))[_0x42a9('0x32')](respondWithResult(_0x1d7186,null))['catch'](handleError(_0x1d7186,null));};exports[_0x42a9('0x33')]=function(_0x15b13f,_0x2ed4ab){return db[_0x42a9('0x3c')][_0x42a9('0x56')]({'where':{'id':_0x15b13f[_0x42a9('0x54')]['id']}})[_0x42a9('0x32')](handleEntityNotFound(_0x2ed4ab,null))['then'](removeEntity(_0x2ed4ab,null))[_0x42a9('0x57')](handleError(_0x2ed4ab,null));};exports['describe']=function(_0x5c9c93,_0x5abfca){return db[_0x42a9('0x3c')][_0x42a9('0x61')]()[_0x42a9('0x32')](respondWithResult(_0x5abfca,null))[_0x42a9('0x57')](handleError(_0x5abfca,null));};exports[_0x42a9('0x62')]=function(_0x3fe38f,_0xc0c3d4,_0xf5d342){if(_0x3fe38f[_0x42a9('0x59')]['id']){delete _0x3fe38f['body']['id'];}return db[_0x42a9('0x3c')][_0x42a9('0x56')]({'where':{'id':_0x3fe38f[_0x42a9('0x54')]['id']}})[_0x42a9('0x32')](handleEntityNotFound(_0xc0c3d4,null))[_0x42a9('0x32')](function(_0x16202a){if(_0x16202a){_0x3fe38f[_0x42a9('0x59')][_0x42a9('0x63')]=_0x16202a['id'];return db[_0x42a9('0x64')][_0x42a9('0x58')](_0x3fe38f[_0x42a9('0x59')]);}})[_0x42a9('0x32')](respondWithResult(_0xc0c3d4,null))[_0x42a9('0x57')](handleError(_0xc0c3d4,null));};exports[_0x42a9('0x65')]=function(_0x125de6,_0x13ed01,_0x2210ff){var _0x4cb757={'raw':![],'where':{}};var _0x5b4816={};var _0x3c6ffd={'count':0x0,'rows':[]};return db['WhatsappAccount'][_0x42a9('0x66')]({'where':{'id':_0x125de6[_0x42a9('0x54')]['id']}})[_0x42a9('0x32')](handleEntityNotFound(_0x13ed01,null))[_0x42a9('0x32')](function(_0x2eb4e4){if(_0x2eb4e4){_0x5b4816[_0x42a9('0x40')]=_[_0x42a9('0x43')](db[_0x42a9('0x64')][_0x42a9('0x3d')]);_0x5b4816[_0x42a9('0x42')]=_[_0x42a9('0x43')](_0x125de6['query']);_0x5b4816[_0x42a9('0x44')]=_[_0x42a9('0x46')](_0x5b4816[_0x42a9('0x40')],_0x5b4816[_0x42a9('0x42')]);_0x4cb757[_0x42a9('0x45')]=_[_0x42a9('0x46')](_0x5b4816[_0x42a9('0x40')],qs[_0x42a9('0x47')](_0x125de6[_0x42a9('0x42')][_0x42a9('0x47')]));_0x4cb757[_0x42a9('0x45')]=_0x4cb757[_0x42a9('0x45')][_0x42a9('0x48')]?_0x4cb757[_0x42a9('0x45')]:_0x5b4816[_0x42a9('0x40')];if(!_0x125de6[_0x42a9('0x42')][_0x42a9('0x67')](_0x42a9('0x68'))){_0x4cb757['limit']=qs[_0x42a9('0x2b')](_0x125de6[_0x42a9('0x42')][_0x42a9('0x2b')]);_0x4cb757[_0x42a9('0x28')]=qs[_0x42a9('0x28')](_0x125de6['query']['offset']);}_0x4cb757[_0x42a9('0x49')]=qs[_0x42a9('0x4a')](_0x125de6[_0x42a9('0x42')][_0x42a9('0x4a')]);_0x4cb757[_0x42a9('0x4b')]=qs[_0x42a9('0x44')](_[_0x42a9('0x4c')](_0x125de6[_0x42a9('0x42')],_0x5b4816[_0x42a9('0x44')]));_0x4cb757[_0x42a9('0x4b')][_0x42a9('0x63')]=_0x2eb4e4['id'];if(_0x125de6[_0x42a9('0x42')][_0x42a9('0x4d')]){_0x4cb757['where']=_[_0x42a9('0x4e')](_0x4cb757[_0x42a9('0x4b')],{'$or':_[_0x42a9('0x41')](_0x4cb757[_0x42a9('0x45')],function(_0x502efc){var _0x36e83d={};_0x36e83d[_0x502efc]={'$like':'%'+_0x125de6[_0x42a9('0x42')]['filter']+'%'};return _0x36e83d;})});}_0x4cb757=_['merge']({},_0x4cb757,_0x125de6['options']);return db['Disposition'][_0x42a9('0x2a')]({'where':_0x4cb757[_0x42a9('0x4b')]})[_0x42a9('0x32')](function(_0x1a49d8){_0x3c6ffd['count']=_0x1a49d8;if(_0x125de6[_0x42a9('0x42')][_0x42a9('0x51')]){_0x4cb757[_0x42a9('0x55')]=[{'all':!![]}];}return db['Disposition'][_0x42a9('0x52')](_0x4cb757);})[_0x42a9('0x32')](function(_0x34879a){_0x3c6ffd[_0x42a9('0x69')]=_0x34879a;return _0x3c6ffd;});}})['then'](respondWithFilteredResult(_0x13ed01,_0x4cb757))['catch'](handleError(_0x13ed01,null));};exports[_0x42a9('0x6a')]=function(_0x59cb62,_0x33a9ca,_0x4c1bd5){return db[_0x42a9('0x3c')]['find']({'where':{'id':_0x59cb62[_0x42a9('0x54')]['id']}})[_0x42a9('0x32')](handleEntityNotFound(_0x33a9ca,null))[_0x42a9('0x32')](function(_0x5cf330){if(_0x5cf330){return _0x5cf330[_0x42a9('0x6a')](_0x59cb62[_0x42a9('0x42')]['ids']);}})[_0x42a9('0x32')](respondWithStatusCode(_0x33a9ca,null))[_0x42a9('0x57')](handleError(_0x33a9ca,null));};exports['addAnswer']=function(_0x524a0c,_0x56ae29,_0x14fe74){if(_0x524a0c[_0x42a9('0x59')]['id']){delete _0x524a0c[_0x42a9('0x59')]['id'];}return db[_0x42a9('0x3c')]['find']({'where':{'id':_0x524a0c[_0x42a9('0x54')]['id']}})[_0x42a9('0x32')](handleEntityNotFound(_0x56ae29,null))[_0x42a9('0x32')](function(_0x527d94){if(_0x527d94){_0x524a0c[_0x42a9('0x59')]['WhatsappAccountId']=_0x527d94['id'];return db['CannedAnswer'][_0x42a9('0x58')](_0x524a0c['body']);}})[_0x42a9('0x32')](respondWithResult(_0x56ae29,null))[_0x42a9('0x57')](handleError(_0x56ae29,null));};exports[_0x42a9('0x6b')]=function(_0x3c39e4,_0x3f3ef3,_0xa732cd){var _0x43d6ed={'raw':![],'where':{}};var _0x2c43ca={};var _0xbe724d={'count':0x0,'rows':[]};return db[_0x42a9('0x3c')][_0x42a9('0x66')]({'where':{'id':_0x3c39e4['params']['id']}})[_0x42a9('0x32')](handleEntityNotFound(_0x3f3ef3,null))[_0x42a9('0x32')](function(_0x20b795){if(_0x20b795){_0x2c43ca[_0x42a9('0x40')]=_['keys'](db['CannedAnswer'][_0x42a9('0x3d')]);_0x2c43ca[_0x42a9('0x42')]=_[_0x42a9('0x43')](_0x3c39e4['query']);_0x2c43ca[_0x42a9('0x44')]=_[_0x42a9('0x46')](_0x2c43ca[_0x42a9('0x40')],_0x2c43ca[_0x42a9('0x42')]);_0x43d6ed[_0x42a9('0x45')]=_[_0x42a9('0x46')](_0x2c43ca['model'],qs[_0x42a9('0x47')](_0x3c39e4[_0x42a9('0x42')]['fields']));_0x43d6ed[_0x42a9('0x45')]=_0x43d6ed['attributes'][_0x42a9('0x48')]?_0x43d6ed[_0x42a9('0x45')]:_0x2c43ca[_0x42a9('0x40')];if(!_0x3c39e4[_0x42a9('0x42')][_0x42a9('0x67')](_0x42a9('0x68'))){_0x43d6ed[_0x42a9('0x2b')]=qs[_0x42a9('0x2b')](_0x3c39e4['query']['limit']);_0x43d6ed['offset']=qs[_0x42a9('0x28')](_0x3c39e4['query']['offset']);}_0x43d6ed[_0x42a9('0x49')]=qs[_0x42a9('0x4a')](_0x3c39e4[_0x42a9('0x42')][_0x42a9('0x4a')]);_0x43d6ed[_0x42a9('0x4b')]=qs[_0x42a9('0x44')](_[_0x42a9('0x4c')](_0x3c39e4[_0x42a9('0x42')],_0x2c43ca[_0x42a9('0x44')]));_0x43d6ed[_0x42a9('0x4b')]['WhatsappAccountId']=_0x20b795['id'];if(_0x3c39e4[_0x42a9('0x42')]['filter']){_0x43d6ed['where']=_['merge'](_0x43d6ed[_0x42a9('0x4b')],{'$or':_[_0x42a9('0x41')](_0x43d6ed[_0x42a9('0x45')],function(_0x57e8bb){var _0x2cd880={};_0x2cd880[_0x57e8bb]={'$like':'%'+_0x3c39e4[_0x42a9('0x42')][_0x42a9('0x4d')]+'%'};return _0x2cd880;})});}_0x43d6ed=_[_0x42a9('0x4e')]({},_0x43d6ed,_0x3c39e4[_0x42a9('0x50')]);return db['CannedAnswer'][_0x42a9('0x2a')]({'where':_0x43d6ed[_0x42a9('0x4b')]})[_0x42a9('0x32')](function(_0x3df45e){_0xbe724d['count']=_0x3df45e;if(_0x3c39e4['query']['includeAll']){_0x43d6ed[_0x42a9('0x55')]=[{'all':!![]}];}return db[_0x42a9('0x6c')][_0x42a9('0x52')](_0x43d6ed);})[_0x42a9('0x32')](function(_0xda5380){_0xbe724d[_0x42a9('0x69')]=_0xda5380;return _0xbe724d;});}})[_0x42a9('0x32')](respondWithFilteredResult(_0x3f3ef3,_0x43d6ed))['catch'](handleError(_0x3f3ef3,null));};exports['removeAnswers']=function(_0x44aa35,_0x4c36e2,_0x4d9f3a){return db[_0x42a9('0x3c')][_0x42a9('0x56')]({'where':{'id':_0x44aa35[_0x42a9('0x54')]['id']}})[_0x42a9('0x32')](handleEntityNotFound(_0x4c36e2,null))[_0x42a9('0x32')](function(_0x17577c){if(_0x17577c){return _0x17577c[_0x42a9('0x6d')](_0x44aa35[_0x42a9('0x42')][_0x42a9('0x6e')]);}})[_0x42a9('0x32')](respondWithStatusCode(_0x4c36e2,null))['catch'](handleError(_0x4c36e2,null));};exports[_0x42a9('0x6f')]=function(_0x47d2b2,_0x16da25,_0x47526f){return db[_0x42a9('0x3c')]['find']({'where':{'id':_0x47d2b2[_0x42a9('0x54')]['id']}})[_0x42a9('0x32')](handleEntityNotFound(_0x16da25,null))['then'](function(_0x150a58){if(_0x150a58){return _0x150a58[_0x42a9('0x6f')](_0x47d2b2['body'][_0x42a9('0x6e')],_[_0x42a9('0x70')](_0x47d2b2[_0x42a9('0x59')],['ids','id'])||{})[_0x42a9('0x71')](function(_0x43e5f4){for(var _0x5026ae=0x0;_0x5026ae<_0x47d2b2[_0x42a9('0x59')][_0x42a9('0x6e')][_0x42a9('0x48')];_0x5026ae+=0x1){socket['emit'](_0x42a9('0x72'),{'UserId':Number(_0x47d2b2[_0x42a9('0x59')][_0x42a9('0x6e')][_0x5026ae]),'WhatsappAccountId':Number(_0x47d2b2['params']['id'])});}return _0x43e5f4;});}})[_0x42a9('0x32')](respondWithResult(_0x16da25,null))['catch'](handleError(_0x16da25,null));};exports['removeAgents']=function(_0x5beef0,_0x4d37de,_0x579e58){return db[_0x42a9('0x3c')][_0x42a9('0x56')]({'where':{'id':_0x5beef0[_0x42a9('0x54')]['id']}})[_0x42a9('0x32')](handleEntityNotFound(_0x4d37de,null))[_0x42a9('0x32')](function(_0x2f6822){if(_0x2f6822){return _0x2f6822[_0x42a9('0x73')](_0x5beef0['query'][_0x42a9('0x6e')])[_0x42a9('0x32')](function(){if(_[_0x42a9('0x74')](_0x5beef0[_0x42a9('0x42')][_0x42a9('0x6e')])){for(var _0x9790bc=0x0;_0x9790bc<_0x5beef0[_0x42a9('0x42')][_0x42a9('0x6e')][_0x42a9('0x48')];_0x9790bc+=0x1){socket[_0x42a9('0x75')]('userWhatsappAccount:remove',{'UserId':Number(_0x5beef0[_0x42a9('0x42')][_0x42a9('0x6e')][_0x9790bc]),'WhatsappAccountId':Number(_0x5beef0[_0x42a9('0x54')]['id'])});}}else{socket[_0x42a9('0x75')](_0x42a9('0x76'),{'UserId':Number(_0x5beef0[_0x42a9('0x42')]['ids']),'WhatsappAccountId':Number(_0x5beef0[_0x42a9('0x54')]['id'])});}});}})[_0x42a9('0x32')](respondWithStatusCode(_0x4d37de,null))[_0x42a9('0x57')](handleError(_0x4d37de,null));};exports['getAgents']=function(_0x36e91f,_0x1173a8,_0x401fda){var _0x54b1f6={};var _0x450d15={};var _0x5055f7;var _0x19b06d;return db[_0x42a9('0x3c')][_0x42a9('0x66')]({'where':{'id':_0x36e91f[_0x42a9('0x54')]['id']}})[_0x42a9('0x32')](handleEntityNotFound(_0x1173a8,null))[_0x42a9('0x32')](function(_0xc8b18f){if(_0xc8b18f){_0x5055f7=_0xc8b18f;_0x450d15[_0x42a9('0x40')]=_['keys'](db[_0x42a9('0x77')][_0x42a9('0x3d')]);_0x450d15[_0x42a9('0x42')]=_[_0x42a9('0x43')](_0x36e91f[_0x42a9('0x42')]);_0x450d15[_0x42a9('0x44')]=_[_0x42a9('0x46')](_0x450d15[_0x42a9('0x40')],_0x450d15[_0x42a9('0x42')]);_0x54b1f6[_0x42a9('0x45')]=_[_0x42a9('0x46')](_0x450d15[_0x42a9('0x40')],qs['fields'](_0x36e91f[_0x42a9('0x42')][_0x42a9('0x47')]));_0x54b1f6[_0x42a9('0x45')]=_0x54b1f6[_0x42a9('0x45')][_0x42a9('0x48')]?_0x54b1f6['attributes']:_0x450d15[_0x42a9('0x40')];_0x54b1f6[_0x42a9('0x49')]=qs[_0x42a9('0x4a')](_0x36e91f['query']['sort']);_0x54b1f6[_0x42a9('0x4b')]=qs['filters'](_['pick'](_0x36e91f['query'],_0x450d15['filters']));if(_0x36e91f[_0x42a9('0x42')][_0x42a9('0x4d')]){_0x54b1f6[_0x42a9('0x4b')]=_[_0x42a9('0x4e')](_0x54b1f6[_0x42a9('0x4b')],{'$or':_[_0x42a9('0x41')](_0x54b1f6[_0x42a9('0x45')],function(_0x1bb870){var _0x22f09b={};_0x22f09b[_0x1bb870]={'$like':'%'+_0x36e91f[_0x42a9('0x42')]['filter']+'%'};return _0x22f09b;})});}_0x54b1f6=_[_0x42a9('0x4e')]({},_0x54b1f6,_0x36e91f[_0x42a9('0x50')]);return _0x5055f7[_0x42a9('0x78')](_0x54b1f6);}})[_0x42a9('0x32')](function(_0x25e115){if(_0x25e115){_0x19b06d=_0x25e115[_0x42a9('0x48')];if(!_0x36e91f['query']['hasOwnProperty'](_0x42a9('0x68'))){_0x54b1f6[_0x42a9('0x2b')]=qs[_0x42a9('0x2b')](_0x36e91f[_0x42a9('0x42')][_0x42a9('0x2b')]);_0x54b1f6[_0x42a9('0x28')]=qs[_0x42a9('0x28')](_0x36e91f[_0x42a9('0x42')]['offset']);}return _0x5055f7['getAgents'](_0x54b1f6);}})[_0x42a9('0x32')](function(_0x3bdd7f){if(_0x3bdd7f){return _0x3bdd7f?{'count':_0x19b06d,'rows':_0x3bdd7f}:null;}})[_0x42a9('0x32')](respondWithResult(_0x1173a8,null))[_0x42a9('0x57')](handleError(_0x1173a8,null));};exports[_0x42a9('0x79')]=function(_0x3c0472,_0x163d03){var _0x1cb1df=_0x3c0472['params']['id'];var _0x59a93c=_0x3c0472[_0x42a9('0x59')];var _0x5998e6=0xc8;var _0x34d9bf=null;return db['sequelize'][_0x42a9('0x7a')]({'isolationLevel':db[_0x42a9('0x7b')][_0x42a9('0x7c')][_0x42a9('0x7d')][_0x42a9('0x7e')]},function(_0x33dd11){return db[_0x42a9('0x3c')]['findOne']({'where':{'id':_0x1cb1df},'transaction':_0x33dd11})[_0x42a9('0x32')](function(_0x47078a){if(_0x47078a){return db[_0x42a9('0x7f')][_0x42a9('0x33')]({'where':{'WhatsappAccountId':_0x1cb1df},'transaction':_0x33dd11})['then'](function(){var _0x16417e=_['map'](_0x59a93c,function(_0x23c936){_0x23c936[_0x42a9('0x63')]=_0x1cb1df;return _0x23c936;});return db[_0x42a9('0x7f')][_0x42a9('0x80')](_0x16417e,{'transaction':_0x33dd11});});}else{_0x5998e6=0x194;_0x34d9bf=[];}});})[_0x42a9('0x32')](function(){if(_0x5998e6!==0x194){return db['WhatsappApplication']['findAndCountAll']({'where':{'WhatsappAccountId':_0x1cb1df},'order':'priority'})[_0x42a9('0x32')](function(_0x56650b){_0x34d9bf=_0x56650b;});}})[_0x42a9('0x57')](function(_0x54706d){_0x5998e6=0x1f4;logger['error'](_0x54706d[_0x42a9('0x38')]);if(_0x54706d[_0x42a9('0x39')]){delete _0x54706d[_0x42a9('0x39')];}_0x34d9bf=_0x54706d;})['finally'](function(){if(_0x34d9bf===null){_0x163d03['sendStatus'](_0x5998e6);}else{if(_0x5998e6===0x1f4){_0x163d03['status'](_0x5998e6)[_0x42a9('0x81')](_0x34d9bf);}else{_0x163d03[_0x42a9('0x26')](_0x5998e6)[_0x42a9('0x27')](_0x34d9bf);}}});};exports[_0x42a9('0x82')]=function(_0x52e326,_0x1e28b1,_0x21faf9){var _0x983e89={};var _0x3ad357={};var _0x53a727;var _0x52a50c;return db[_0x42a9('0x3c')][_0x42a9('0x66')]({'where':{'id':_0x52e326['params']['id']}})[_0x42a9('0x32')](handleEntityNotFound(_0x1e28b1,null))[_0x42a9('0x32')](function(_0x3d1c4a){if(_0x3d1c4a){_0x53a727=_0x3d1c4a;_0x3ad357[_0x42a9('0x40')]=_['keys'](db[_0x42a9('0x7f')][_0x42a9('0x3d')]);_0x3ad357[_0x42a9('0x42')]=_[_0x42a9('0x43')](_0x52e326[_0x42a9('0x42')]);_0x3ad357[_0x42a9('0x44')]=_[_0x42a9('0x46')](_0x3ad357[_0x42a9('0x40')],_0x3ad357[_0x42a9('0x42')]);_0x983e89['attributes']=_[_0x42a9('0x46')](_0x3ad357[_0x42a9('0x40')],qs[_0x42a9('0x47')](_0x52e326[_0x42a9('0x42')][_0x42a9('0x47')]));_0x983e89[_0x42a9('0x45')]=_0x983e89['attributes'][_0x42a9('0x48')]?_0x983e89[_0x42a9('0x45')]:_0x3ad357[_0x42a9('0x40')];_0x983e89[_0x42a9('0x49')]=qs['sort'](_0x52e326[_0x42a9('0x42')][_0x42a9('0x4a')]);_0x983e89[_0x42a9('0x4b')]=qs[_0x42a9('0x44')](_[_0x42a9('0x4c')](_0x52e326['query'],_0x3ad357[_0x42a9('0x44')]));if(_0x52e326[_0x42a9('0x42')][_0x42a9('0x4d')]){_0x983e89[_0x42a9('0x4b')]=_[_0x42a9('0x4e')](_0x983e89['where'],{'$or':_[_0x42a9('0x41')](_0x983e89[_0x42a9('0x45')],function(_0xfb57d6){var _0x204736={};_0x204736[_0xfb57d6]={'$like':'%'+_0x52e326[_0x42a9('0x42')][_0x42a9('0x4d')]+'%'};return _0x204736;})});}_0x983e89=_['merge']({},_0x983e89,_0x52e326[_0x42a9('0x50')]);return _0x53a727[_0x42a9('0x82')](_0x983e89);}})['then'](function(_0x16805a){if(_0x16805a){_0x52a50c=_0x16805a[_0x42a9('0x48')];if(!_0x52e326[_0x42a9('0x42')][_0x42a9('0x67')](_0x42a9('0x68'))){_0x983e89[_0x42a9('0x2b')]=qs[_0x42a9('0x2b')](_0x52e326['query'][_0x42a9('0x2b')]);_0x983e89[_0x42a9('0x28')]=qs[_0x42a9('0x28')](_0x52e326['query']['offset']);}return _0x53a727['getApplications'](_0x983e89);}})[_0x42a9('0x32')](function(_0x17a4b6){if(_0x17a4b6){return _0x17a4b6?{'count':_0x52a50c,'rows':_0x17a4b6}:null;}})[_0x42a9('0x32')](respondWithResult(_0x1e28b1,null))[_0x42a9('0x57')](handleError(_0x1e28b1,null));};exports[_0x42a9('0x83')]=function(_0x46d750,_0x3eb12a,_0x589b83){var _0xd66a4f={'channel':'whatsapp'};var _0x516155=[];var _0x57158a=[];var _0x13dd3b={};return db[_0x42a9('0x3c')]['find']({'where':{'id':_0x46d750[_0x42a9('0x54')]['id']},'include':[{'model':db[_0x42a9('0x7f')],'as':_0x42a9('0x84')}]})[_0x42a9('0x32')](handleEntityNotFound(_0x3eb12a,null))['then'](function(_0x583bba){_0xd66a4f[_0x42a9('0x85')]=_0x583bba;if(_0xd66a4f['account']&&_0xd66a4f[_0x42a9('0x85')][_0x42a9('0x3e')]===_0x42a9('0x86')&&_0x46d750[_0x42a9('0x59')]['statuses']){if(_0x46d750[_0x42a9('0x59')][_0x42a9('0x87')]['length']===0x0)return;if(_0x46d750[_0x42a9('0x59')][_0x42a9('0x87')][0x0][_0x42a9('0x88')]!==_0x42a9('0x89'))return;return db[_0x42a9('0x8a')][_0x42a9('0x31')]({'read':!![],'readAt':_0x46d750[_0x42a9('0x59')][_0x42a9('0x87')][0x0][_0x42a9('0x8b')]},{'where':{'messageId':_0x46d750[_0x42a9('0x59')]['statuses'][0x0][_0x42a9('0x8c')]},'individualHooks':!![]})['then'](function(_0x152f90){return _0x3eb12a[_0x42a9('0x26')](0xc8)[_0x42a9('0x27')](_0x152f90);});}_0xd66a4f[_0x42a9('0x8d')]=_[_0x42a9('0x8e')](_0x583bba[_0x42a9('0x84')],[_0x42a9('0x8f')],[_0x42a9('0x90')]);if(_0xd66a4f[_0x42a9('0x85')][_0x42a9('0x84')]){delete _0xd66a4f[_0x42a9('0x85')][_0x42a9('0x84')];}return db[_0x42a9('0x91')][_0x42a9('0x61')]()[_0x42a9('0x32')](function(_0x1797dd){if(!_0x1797dd){throw new db[(_0x42a9('0x92'))][(_0x42a9('0x93'))]('no\x20available\x20attributes');}_0x516155=_[_0x42a9('0x94')](_[_0x42a9('0x43')](_0x1797dd),[_0x42a9('0x95'),'updatedAt']);_0x57158a=_['difference'](_[_0x42a9('0x43')](_0x1797dd),['createdAt','updatedAt',_0x42a9('0x96'),'ListId']);_0xd66a4f[_0x42a9('0x59')]={'mapKey':_0x42a9('0x97')};if(_0xd66a4f[_0x42a9('0x85')]&&_0xd66a4f[_0x42a9('0x85')][_0x42a9('0x3e')]===_0x42a9('0x98')){_0xd66a4f[_0x42a9('0x59')][_0x42a9('0x99')]=_0x46d750[_0x42a9('0x59')][_0x42a9('0x9a')][_0x42a9('0x9b')]('whatsapp:','');_0xd66a4f[_0x42a9('0x59')][_0x42a9('0x59')]=_0x46d750[_0x42a9('0x59')][_0x42a9('0x9c')];_0xd66a4f[_0x42a9('0x59')]['messageId']=_0x46d750['body']['MessageSid'];}if(_0xd66a4f[_0x42a9('0x85')]&&_0xd66a4f[_0x42a9('0x85')][_0x42a9('0x3e')]===_0x42a9('0x86')){_0xd66a4f[_0x42a9('0x59')][_0x42a9('0x99')]=_0x46d750[_0x42a9('0x59')]['notifications'][0x0][_0x42a9('0x99')];_0xd66a4f[_0x42a9('0x59')][_0x42a9('0x59')]=_0x46d750['body'][_0x42a9('0x9d')][0x0][_0x42a9('0x23')][_0x42a9('0x59')];_0xd66a4f[_0x42a9('0x59')][_0x42a9('0x9e')]=_0x46d750[_0x42a9('0x59')]['notifications'][0x0][_0x42a9('0x8c')];}if(_0xd66a4f[_0x42a9('0x59')]['id']){delete _0xd66a4f[_0x42a9('0x59')]['id'];}if(_[_0x42a9('0x9f')](_0xd66a4f['body'][_0x42a9('0x99')])){throw new db[(_0x42a9('0x92'))][(_0x42a9('0x93'))](_0x42a9('0xa0'));}if(_[_0x42a9('0x9f')](_0xd66a4f[_0x42a9('0x59')][_0x42a9('0x59')])||_0xd66a4f[_0x42a9('0x59')][_0x42a9('0x59')]===''){throw new db[(_0x42a9('0x92'))]['ValidationError'](_0x42a9('0xa1'));}if(_[_0x42a9('0x9f')](_0xd66a4f[_0x42a9('0x59')][_0x42a9('0xa2')])){throw new db['Sequelize'][(_0x42a9('0x93'))](_0x42a9('0xa3')+_0x57158a);}if(!_[_0x42a9('0xa4')](_0x57158a,_0xd66a4f[_0x42a9('0x59')][_0x42a9('0xa2')])){throw new db[(_0x42a9('0x92'))]['ValidationError']('mapKey\x20invalid,\x20please\x20use\x20one\x20of\x20these:\x20'+_0x57158a);}_0x13dd3b[_0xd66a4f[_0x42a9('0x59')][_0x42a9('0xa2')]]=_0xd66a4f[_0x42a9('0x59')][_0x42a9('0x99')];return db[_0x42a9('0xa5')][_0x42a9('0x56')]({'where':{'id':_0xd66a4f[_0x42a9('0x85')][_0x42a9('0xa6')]},'include':[{'model':db[_0x42a9('0x91')],'as':_0x42a9('0xa7'),'where':_0x13dd3b,'limit':0x1,'order':[[_0x42a9('0xa8'),'DESC']]}]});})[_0x42a9('0x32')](handleEntityNotFound(_0x3eb12a,null))['then'](function(_0x3b674a){if(_0x3b674a){_0xd66a4f['list']=_[_0x42a9('0x70')](_0x3b674a,[_0x42a9('0xa7')]);if(_0x3b674a[_0x42a9('0xa7')][_0x42a9('0x48')]){return _0x3b674a[_0x42a9('0xa7')][0x0];}var _0x3ac048=_['defaults'](_0xd66a4f[_0x42a9('0x59')],{'firstName':_0xd66a4f['body'][_0x42a9('0x99')],'ListId':_0x3b674a['id']});_0x3ac048[_0xd66a4f['body'][_0x42a9('0xa2')]]=_0xd66a4f[_0x42a9('0x59')][_0x42a9('0x99')];return db['CmContact'][_0x42a9('0x58')](_0x3ac048,{'fields':_0x516155,'raw':!![]});}})[_0x42a9('0x32')](handleEntityNotFound(_0x3eb12a,null))['then'](function(_0x243a39){if(_0x243a39){_0xd66a4f['contact']=_0x243a39;var _0xbec06e={'ContactId':_0x243a39['id'],'phone':_0xd66a4f['body'][_0x42a9('0x99')],'WhatsappAccountId':_0x46d750[_0x42a9('0x54')]['id']};var _0x1581e3={'ContactId':_0x243a39['id'],'WhatsappAccountId':_0x46d750[_0x42a9('0x54')]['id'],'closed':![]};return db['WhatsappInteraction'][_0x42a9('0x56')]({'where':_0x1581e3})['then'](function(_0x4ef950){if(_0x4ef950){return[_0x4ef950,![]];}return db['WhatsappInteraction'][_0x42a9('0x58')](_0xbec06e)[_0x42a9('0x32')](function(_0x29bfe8){return[_0x29bfe8,!![]];});});}})[_0x42a9('0x71')](function(_0x3ac983,_0x4a0dc6){_0xd66a4f[_0x42a9('0xa9')]=_0x3ac983['get']({'plain':!![]});_0xd66a4f['interaction'][_0x42a9('0xaa')]=![];if(_0x4a0dc6){if(_0xd66a4f[_0x42a9('0x85')][_0x42a9('0xab')]){_0xd66a4f['applications'][_0x42a9('0xac')]({'id':0x0,'priority':_0xd66a4f['applications'][_0x42a9('0x48')]+0x1,'app':'close','appdata':_0x42a9('0xad'),'interval':_0x42a9('0xae')});}_0xd66a4f[_0x42a9('0xa9')][_0x42a9('0xaa')]=!![];}return db[_0x42a9('0x8a')]['create']({'phone':_0xd66a4f[_0x42a9('0x59')]['from'],'messageId':_0xd66a4f['body']['messageId'],'body':_0xd66a4f[_0x42a9('0x59')][_0x42a9('0x59')],'WhatsappAccountId':_0x46d750[_0x42a9('0x54')]['id'],'WhatsappInteractionId':_0x3ac983['id'],'direction':'in','ContactId':_0x3ac983[_0x42a9('0xaf')],'AttachmentId':_0xd66a4f['body'][_0x42a9('0xb0')]});})['then'](function(_0x12f988){_0xd66a4f[_0x42a9('0x23')]=_0x12f988;if(_0xd66a4f[_0x42a9('0xa9')][_0x42a9('0xb1')]){return db[_0x42a9('0x77')][_0x42a9('0x56')]({'attributes':['id','name'],'where':{'id':_0xd66a4f['interaction'][_0x42a9('0xb1')]}})[_0x42a9('0x32')](function(_0x235211){if(_0x235211){_0xd66a4f[_0x42a9('0x8d')][_0x42a9('0xb2')]({'id':0x0,'priority':0x0,'app':_0x42a9('0xb3'),'appdata':_0x235211['name']+','+(_0xd66a4f['account']['waitForTheAssignedAgent']||0xa),'interval':_0x42a9('0xae')});}return respondWithRpcPromise(_0x42a9('0xb4'),'startRouting',_0xd66a4f);});}return respondWithRpcPromise('Start',_0x42a9('0xb5'),_0xd66a4f);})[_0x42a9('0x32')](function(_0x3e0211){if(_0x3e0211){var _0x3313d6=0xc8;var _0x53c29a=_0x42a9('0xb6');logger['info'](_0x42a9('0x1e'),_0x53c29a,_0x3313d6,'entity\x20found');logger['debug'](_0x42a9('0xb7'),_0x53c29a,_0x3313d6,_0x42a9('0xb8'),JSON[_0x42a9('0x1f')](_0x3e0211));if(_0xd66a4f['account'][_0x42a9('0x3e')]===_0x42a9('0x98')){return _0x3eb12a[_0x42a9('0x26')](_0x3313d6)[_0x42a9('0x2c')](_0x42a9('0xb9'),_0x42a9('0xba'))[_0x42a9('0x81')](_0x42a9('0xbb'));}else{return _0x3eb12a[_0x42a9('0x26')](_0x3313d6)['json'](_0x3e0211);}}});})[_0x42a9('0x57')](handleError(_0x3eb12a,null));};exports[_0x42a9('0x81')]=function(_0x43ac3d,_0x328567,_0x31960c){var _0x2d5ac4,_0x256089,_0x25e3f7;if(_[_0x42a9('0x9f')](_0x43ac3d[_0x42a9('0x59')][_0x42a9('0x59')])||_0x43ac3d[_0x42a9('0x59')][_0x42a9('0x59')]===''){throw new db[(_0x42a9('0x92'))][(_0x42a9('0x93'))]('body\x20is\x20mandatory\x20and\x20not\x20empty');}if(_[_0x42a9('0x9f')](_0x43ac3d[_0x42a9('0x59')]['to'])){throw new db[(_0x42a9('0x92'))]['ValidationError']('to\x20is\x20mandatory');}_0x2d5ac4=_0x43ac3d[_0x42a9('0x59')]['to'];return db['WhatsappAccount'][_0x42a9('0x56')]({'where':{'id':_0x43ac3d[_0x42a9('0x54')]['id']},'include':[{'model':db[_0x42a9('0xa5')],'as':_0x42a9('0xbc'),'include':[{'model':db[_0x42a9('0x91')],'as':_0x42a9('0xa7'),'where':{'mobile':_0x2d5ac4},'limit':0x1,'order':[[_0x42a9('0xa8'),_0x42a9('0xbd')]]}]}]})['then'](handleEntityNotFound(_0x328567,null))[_0x42a9('0x32')](function(_0x552706){if(_0x552706&&_0x552706[_0x42a9('0xbc')]){_0x256089=_0x552706[_0x42a9('0x34')]({'plain':!![]});if(_0x256089[_0x42a9('0xbc')]&&_0x256089[_0x42a9('0xbc')][_0x42a9('0xa7')][_0x42a9('0x48')]){return _0x256089['List'][_0x42a9('0xa7')][0x0];}return db[_0x42a9('0x91')][_0x42a9('0x58')](_['defaults'](_0x43ac3d[_0x42a9('0x59')],{'firstName':_0x2d5ac4,'mobile':_0x2d5ac4,'phone':_0x2d5ac4,'ListId':_0x256089[_0x42a9('0xa6')]}));}})[_0x42a9('0x32')](handleEntityNotFound(_0x328567,null))['then'](function(_0x53a2bd){if(_0x53a2bd){_0x25e3f7=_0x53a2bd;return db[_0x42a9('0xbe')][_0x42a9('0x56')]({'where':{'ContactId':_0x25e3f7['id'],'closed':![],'WhatsappAccountId':_0x256089['id']}})[_0x42a9('0x32')](function(_0x8333bd){if(_0x8333bd){return[_0x8333bd,![]];}return db[_0x42a9('0xbe')][_0x42a9('0x58')]({'UserId':_0x43ac3d[_0x42a9('0x5a')]['id'],'ContactId':_0x25e3f7['id'],'WhatsappAccountId':_0x256089['id'],'phone':_0x2d5ac4,'firstMsgDirection':_0x42a9('0xbf'),'Messages':[_['merge'](_0x43ac3d[_0x42a9('0x59')],{'read':![],'body':_0x43ac3d[_0x42a9('0x59')][_0x42a9('0x59')],'phone':_0x2d5ac4,'WhatsappAccountId':_0x256089['id'],'UserId':_0x43ac3d['user']['id'],'ContactId':_0x25e3f7['id']})]},{'include':[{'model':db['WhatsappMessage'],'as':_0x42a9('0xc0')}]})['then'](function(_0x19095b){return[_0x19095b,!![]];});});}})['spread'](function(_0x581645,_0x5dfcd9){if(_0x5dfcd9){return _0x581645;}return db['WhatsappMessage'][_0x42a9('0x58')](_['merge'](_0x43ac3d[_0x42a9('0x59')],{'read':![],'body':_0x43ac3d[_0x42a9('0x59')][_0x42a9('0x59')],'phone':_0x2d5ac4,'WhatsappAccountId':_0x256089['id'],'WhatsappInteractionId':_0x581645['id'],'UserId':_0x43ac3d['user']['id'],'ContactId':_0x25e3f7['id']}))['then'](function(_0x1e8086){_0x581645['dataValues'][_0x42a9('0xc0')]=[];_0x581645[_0x42a9('0xc1')]['Messages'][_0x42a9('0xac')](_0x1e8086['dataValues']);return _0x581645;});})['then'](respondWithResult(_0x328567,null))['catch'](handleError(_0x328567,null));}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.events.js b/server/api/whatsappAccount/whatsappAccount.events.js index 65427b7..2437049 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 _0xa5f6=['save','remove','emit','hook','exports','../../mysqldb','setMaxListeners'];(function(_0x11b6d1,_0x5afbad){var _0x388011=function(_0x2724da){while(--_0x2724da){_0x11b6d1['push'](_0x11b6d1['shift']());}};_0x388011(++_0x5afbad);}(_0xa5f6,0x171));var _0x6a5f=function(_0x27df48,_0x1595f4){_0x27df48=_0x27df48-0x0;var _0x2ececb=_0xa5f6[_0x27df48];return _0x2ececb;};'use strict';var EventEmitter=require('events');var WhatsappAccount=require(_0x6a5f('0x0'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x6a5f('0x1')](0x0);var events={'afterCreate':_0x6a5f('0x2'),'afterUpdate':'update','afterDestroy':_0x6a5f('0x3')};function emitEvent(_0x51fb4e){return function(_0x285100,_0xc470d6,_0x1b2398){WhatsappAccountEvents[_0x6a5f('0x4')](_0x51fb4e+':'+_0x285100['id'],_0x285100);WhatsappAccountEvents[_0x6a5f('0x4')](_0x51fb4e,_0x285100);_0x1b2398(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappAccount[_0x6a5f('0x5')](e,emitEvent(event));}}module[_0x6a5f('0x6')]=WhatsappAccountEvents; \ No newline at end of file +var _0xe075=['save','update','emit','hasOwnProperty','hook','exports','events','../../mysqldb','setMaxListeners'];(function(_0x4da3b6,_0x233aff){var _0x574d38=function(_0x4fa45b){while(--_0x4fa45b){_0x4da3b6['push'](_0x4da3b6['shift']());}};_0x574d38(++_0x233aff);}(_0xe075,0x12f));var _0x5e07=function(_0x39335d,_0x8d55b8){_0x39335d=_0x39335d-0x0;var _0x5c9ced=_0xe075[_0x39335d];return _0x5c9ced;};'use strict';var EventEmitter=require(_0x5e07('0x0'));var WhatsappAccount=require(_0x5e07('0x1'))['db']['WhatsappAccount'];var WhatsappAccountEvents=new EventEmitter();WhatsappAccountEvents[_0x5e07('0x2')](0x0);var events={'afterCreate':_0x5e07('0x3'),'afterUpdate':_0x5e07('0x4'),'afterDestroy':'remove'};function emitEvent(_0x312992){return function(_0x124c7e,_0x4a2c85,_0x278075){WhatsappAccountEvents['emit'](_0x312992+':'+_0x124c7e['id'],_0x124c7e);WhatsappAccountEvents[_0x5e07('0x5')](_0x312992,_0x124c7e);_0x278075(null);};}for(var e in events){if(events[_0x5e07('0x6')](e)){var event=events[e];WhatsappAccount[_0x5e07('0x7')](e,emitEvent(event));}}module[_0x5e07('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 bdda1be..9b2fc29 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 _0xedf0=['path','rimraf','exports','define','whatsapp_accounts','api','moment','bluebird','request-promise'];(function(_0xc67528,_0x24e2fb){var _0x38e26d=function(_0x1b0efe){while(--_0x1b0efe){_0xc67528['push'](_0xc67528['shift']());}};_0x38e26d(++_0x24e2fb);}(_0xedf0,0x15b));var _0x0edf=function(_0x1eb4e0,_0x4ebc2d){_0x1eb4e0=_0x1eb4e0-0x0;var _0x18ec21=_0xedf0[_0x1eb4e0];return _0x18ec21;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')(_0x0edf('0x0'));var moment=require(_0x0edf('0x1'));var BPromise=require(_0x0edf('0x2'));var rp=require(_0x0edf('0x3'));var fs=require('fs');var path=require(_0x0edf('0x4'));var rimraf=require(_0x0edf('0x5'));var config=require('../../config/environment');var attributes=require('./whatsappAccount.attributes');module[_0x0edf('0x6')]=function(_0x1da598,_0x3acd66){return _0x1da598[_0x0edf('0x7')]('WhatsappAccount',attributes,{'tableName':_0x0edf('0x8'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0x6a5d=['util','../../config/logger','api','moment','bluebird','path','rimraf','../../config/environment','./whatsappAccount.attributes','exports','define','WhatsappAccount','whatsapp_accounts'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x6a5d,0x1c7));var _0xd6a5=function(_0x237c03,_0xee5602){_0x237c03=_0x237c03-0x0;var _0x2763ee=_0x6a5d[_0x237c03];return _0x2763ee;};'use strict';var _=require('lodash');var util=require(_0xd6a5('0x0'));var logger=require(_0xd6a5('0x1'))(_0xd6a5('0x2'));var moment=require(_0xd6a5('0x3'));var BPromise=require(_0xd6a5('0x4'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xd6a5('0x5'));var rimraf=require(_0xd6a5('0x6'));var config=require(_0xd6a5('0x7'));var attributes=require(_0xd6a5('0x8'));module[_0xd6a5('0x9')]=function(_0x946764,_0x3a9f2c){return _0x946764[_0xd6a5('0xa')](_0xd6a5('0xb'),attributes,{'tableName':_0xd6a5('0xc'),'paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.rpc.js b/server/api/whatsappAccount/whatsappAccount.rpc.js index 7670ecb..64536c3 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 _0xed8f=['randomstring','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','redis','defaults','localhost','socket.io-emitter','./whatsappAccount.socket','request','then','WhatsappAccount,\x20%s,\x20%s','debug','WhatsappAccount,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','catch','ShowWhatsappAccount','WhatsappAccount','find','options','raw','where','attributes','include','model','map','lodash','util','moment','bluebird'];(function(_0x4aa828,_0x1ae629){var _0xd9f89b=function(_0x5e58da){while(--_0x5e58da){_0x4aa828['push'](_0x4aa828['shift']());}};_0xd9f89b(++_0x1ae629);}(_0xed8f,0x1a9));var _0xfed8=function(_0x276522,_0x3e88fd){_0x276522=_0x276522-0x0;var _0x1c48b6=_0xed8f[_0x276522];return _0x1c48b6;};'use strict';var _=require(_0xfed8('0x0'));var util=require(_0xfed8('0x1'));var moment=require(_0xfed8('0x2'));var BPromise=require(_0xfed8('0x3'));var rs=require(_0xfed8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0xfed8('0x5'));var logger=require(_0xfed8('0x6'))(_0xfed8('0x7'));var config=require('../../config/environment');var jayson=require(_0xfed8('0x8'));var client=jayson[_0xfed8('0x9')][_0xfed8('0xa')]({'port':0x232a});config[_0xfed8('0xb')]=_[_0xfed8('0xc')](config[_0xfed8('0xb')],{'host':_0xfed8('0xd'),'port':0x18eb});var socket=require(_0xfed8('0xe'))(new Redis(config['redis']));require(_0xfed8('0xf'))['register'](socket);function respondWithRpcPromise(_0x25e4b2,_0x14f9d7,_0x5e5f3c){return new BPromise(function(_0x5c48f7,_0x5b41e4){return client[_0xfed8('0x10')](_0x25e4b2,_0x5e5f3c)[_0xfed8('0x11')](function(_0x30f243){logger['info'](_0xfed8('0x12'),_0x14f9d7,'request\x20sent');logger[_0xfed8('0x13')](_0xfed8('0x14'),_0x14f9d7,_0xfed8('0x15'),JSON[_0xfed8('0x16')](_0x30f243));if(_0x30f243['error']){if(_0x30f243[_0xfed8('0x17')][_0xfed8('0x18')]===0x1f4){logger[_0xfed8('0x17')](_0xfed8('0x12'),_0x14f9d7,_0x30f243['error'][_0xfed8('0x19')]);return _0x5b41e4(_0x30f243[_0xfed8('0x17')][_0xfed8('0x19')]);}logger[_0xfed8('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x14f9d7,_0x30f243[_0xfed8('0x17')][_0xfed8('0x19')]);return _0x5c48f7(_0x30f243[_0xfed8('0x17')][_0xfed8('0x19')]);}else{logger[_0xfed8('0x1a')](_0xfed8('0x12'),_0x14f9d7,'request\x20sent');_0x5c48f7(_0x30f243[_0xfed8('0x1b')][_0xfed8('0x19')]);}})[_0xfed8('0x1c')](function(_0x5eda34){logger[_0xfed8('0x17')]('WhatsappAccount,\x20%s,\x20%s',_0x14f9d7,_0x5eda34);_0x5b41e4(_0x5eda34);});});}exports[_0xfed8('0x1d')]=function(_0x3e5d5a){var _0x5ce6ab=this;return new Promise(function(_0x5452d0,_0x28d523){return db[_0xfed8('0x1e')][_0xfed8('0x1f')]({'raw':_0x3e5d5a[_0xfed8('0x20')]?_0x3e5d5a[_0xfed8('0x20')][_0xfed8('0x21')]===undefined?!![]:![]:!![],'where':_0x3e5d5a['options']?_0x3e5d5a[_0xfed8('0x20')][_0xfed8('0x22')]||null:null,'attributes':_0x3e5d5a[_0xfed8('0x20')]?_0x3e5d5a[_0xfed8('0x20')][_0xfed8('0x23')]||null:null,'include':_0x3e5d5a[_0xfed8('0x20')]?_0x3e5d5a[_0xfed8('0x20')]['include']?_['map'](_0x3e5d5a[_0xfed8('0x20')][_0xfed8('0x24')],function(_0xd809f5){return{'model':db[_0xd809f5[_0xfed8('0x25')]],'as':_0xd809f5['as'],'attributes':_0xd809f5[_0xfed8('0x23')],'include':_0xd809f5[_0xfed8('0x24')]?_[_0xfed8('0x26')](_0xd809f5[_0xfed8('0x24')],function(_0x5cbab0){return{'model':db[_0x5cbab0['model']],'as':_0x5cbab0['as'],'attributes':_0x5cbab0['attributes'],'include':_0x5cbab0[_0xfed8('0x24')]?_[_0xfed8('0x26')](_0x5cbab0['include'],function(_0x3ccc66){return{'model':db[_0x3ccc66['model']],'as':_0x3ccc66['as'],'attributes':_0x3ccc66[_0xfed8('0x23')]};}):[]};}):[]};}):[]:[]})[_0xfed8('0x11')](function(_0xfb6c32){logger['info'](_0xfed8('0x1d'),_0x3e5d5a);logger[_0xfed8('0x13')](_0xfed8('0x1d'),_0x3e5d5a,JSON[_0xfed8('0x16')](_0xfb6c32));_0x5452d0(_0xfb6c32);})[_0xfed8('0x1c')](function(_0x344ef6){logger[_0xfed8('0x17')](_0xfed8('0x1d'),_0x344ef6[_0xfed8('0x19')],_0x3e5d5a);_0x28d523(_0x5ce6ab['error'](0x1f4,_0x344ef6[_0xfed8('0x19')]));});});}; \ No newline at end of file +var _0xa4b2=['WhatsappAccount,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','ShowWhatsappAccount','WhatsappAccount','find','raw','options','where','attributes','include','map','model','debug','lodash','moment','bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','http','redis','defaults','localhost','./whatsappAccount.socket','register','request','then','info','WhatsappAccount,\x20%s,\x20%s','request\x20sent'];(function(_0x3b5698,_0x421d20){var _0x2bd19f=function(_0x2d0729){while(--_0x2d0729){_0x3b5698['push'](_0x3b5698['shift']());}};_0x2bd19f(++_0x421d20);}(_0xa4b2,0x1da));var _0x2a4b=function(_0x1b7d4e,_0x434bc3){_0x1b7d4e=_0x1b7d4e-0x0;var _0x291425=_0xa4b2[_0x1b7d4e];return _0x291425;};'use strict';var _=require(_0x2a4b('0x0'));var util=require('util');var moment=require(_0x2a4b('0x1'));var BPromise=require(_0x2a4b('0x2'));var rs=require(_0x2a4b('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x2a4b('0x4'))['db'];var utils=require(_0x2a4b('0x5'));var logger=require('../../config/logger')(_0x2a4b('0x6'));var config=require(_0x2a4b('0x7'));var jayson=require(_0x2a4b('0x8'));var client=jayson['client'][_0x2a4b('0x9')]({'port':0x232a});config[_0x2a4b('0xa')]=_[_0x2a4b('0xb')](config[_0x2a4b('0xa')],{'host':_0x2a4b('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x2a4b('0xa')]));require(_0x2a4b('0xd'))[_0x2a4b('0xe')](socket);function respondWithRpcPromise(_0x4b9dad,_0x1412e0,_0x88196e){return new BPromise(function(_0x5b1f1f,_0x1db31b){return client[_0x2a4b('0xf')](_0x4b9dad,_0x88196e)[_0x2a4b('0x10')](function(_0x83f9a4){logger[_0x2a4b('0x11')](_0x2a4b('0x12'),_0x1412e0,_0x2a4b('0x13'));logger['debug'](_0x2a4b('0x14'),_0x1412e0,'request\x20sent',JSON[_0x2a4b('0x15')](_0x83f9a4));if(_0x83f9a4[_0x2a4b('0x16')]){if(_0x83f9a4['error'][_0x2a4b('0x17')]===0x1f4){logger['error']('WhatsappAccount,\x20%s,\x20%s',_0x1412e0,_0x83f9a4['error']['message']);return _0x1db31b(_0x83f9a4[_0x2a4b('0x16')][_0x2a4b('0x18')]);}logger[_0x2a4b('0x16')](_0x2a4b('0x12'),_0x1412e0,_0x83f9a4['error'][_0x2a4b('0x18')]);return _0x5b1f1f(_0x83f9a4['error'][_0x2a4b('0x18')]);}else{logger[_0x2a4b('0x11')](_0x2a4b('0x12'),_0x1412e0,_0x2a4b('0x13'));_0x5b1f1f(_0x83f9a4[_0x2a4b('0x19')][_0x2a4b('0x18')]);}})[_0x2a4b('0x1a')](function(_0x35c1ab){logger[_0x2a4b('0x16')]('WhatsappAccount,\x20%s,\x20%s',_0x1412e0,_0x35c1ab);_0x1db31b(_0x35c1ab);});});}exports[_0x2a4b('0x1b')]=function(_0x1c93f6){var _0x5224b4=this;return new Promise(function(_0x46fe04,_0x165e73){return db[_0x2a4b('0x1c')][_0x2a4b('0x1d')]({'raw':_0x1c93f6['options']?_0x1c93f6['options'][_0x2a4b('0x1e')]===undefined?!![]:![]:!![],'where':_0x1c93f6[_0x2a4b('0x1f')]?_0x1c93f6[_0x2a4b('0x1f')][_0x2a4b('0x20')]||null:null,'attributes':_0x1c93f6['options']?_0x1c93f6[_0x2a4b('0x1f')][_0x2a4b('0x21')]||null:null,'include':_0x1c93f6['options']?_0x1c93f6[_0x2a4b('0x1f')][_0x2a4b('0x22')]?_[_0x2a4b('0x23')](_0x1c93f6[_0x2a4b('0x1f')][_0x2a4b('0x22')],function(_0x4ee149){return{'model':db[_0x4ee149[_0x2a4b('0x24')]],'as':_0x4ee149['as'],'attributes':_0x4ee149[_0x2a4b('0x21')],'include':_0x4ee149['include']?_[_0x2a4b('0x23')](_0x4ee149[_0x2a4b('0x22')],function(_0x2ba066){return{'model':db[_0x2ba066[_0x2a4b('0x24')]],'as':_0x2ba066['as'],'attributes':_0x2ba066[_0x2a4b('0x21')],'include':_0x2ba066[_0x2a4b('0x22')]?_[_0x2a4b('0x23')](_0x2ba066[_0x2a4b('0x22')],function(_0x3e1063){return{'model':db[_0x3e1063['model']],'as':_0x3e1063['as'],'attributes':_0x3e1063[_0x2a4b('0x21')]};}):[]};}):[]};}):[]:[]})['then'](function(_0x107894){logger[_0x2a4b('0x11')](_0x2a4b('0x1b'),_0x1c93f6);logger[_0x2a4b('0x25')](_0x2a4b('0x1b'),_0x1c93f6,JSON[_0x2a4b('0x15')](_0x107894));_0x46fe04(_0x107894);})[_0x2a4b('0x1a')](function(_0x2bda1e){logger[_0x2a4b('0x16')](_0x2a4b('0x1b'),_0x2bda1e[_0x2a4b('0x18')],_0x1c93f6);_0x165e73(_0x5224b4[_0x2a4b('0x16')](0x1f4,_0x2bda1e[_0x2a4b('0x18')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappAccount/whatsappAccount.socket.js b/server/api/whatsappAccount/whatsappAccount.socket.js index 5d9b7a7..41a75f5 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 _0xcda2=['emit','removeListener','length','whatsappAccount:','./whatsappAccount.events','save'];(function(_0x354c31,_0x45c581){var _0x30c658=function(_0x38be4d){while(--_0x38be4d){_0x354c31['push'](_0x354c31['shift']());}};_0x30c658(++_0x45c581);}(_0xcda2,0xd0));var _0x2cda=function(_0x573c19,_0x5525bd){_0x573c19=_0x573c19-0x0;var _0x26df1d=_0xcda2[_0x573c19];return _0x26df1d;};'use strict';var WhatsappAccountEvents=require(_0x2cda('0x0'));var events=[_0x2cda('0x1'),'remove','update'];function createListener(_0x3cbdc8,_0x5cec0c){return function(_0x2fbcab){_0x5cec0c[_0x2cda('0x2')](_0x3cbdc8,_0x2fbcab);};}function removeListener(_0x1cc0b0,_0x1921d7){return function(){WhatsappAccountEvents[_0x2cda('0x3')](_0x1cc0b0,_0x1921d7);};}exports['register']=function(_0x28a233){for(var _0x3fc16d=0x0,_0x2ac67d=events[_0x2cda('0x4')];_0x3fc16d<_0x2ac67d;_0x3fc16d++){var _0x194bee=events[_0x3fc16d];var _0x42c9b4=createListener(_0x2cda('0x5')+_0x194bee,_0x28a233);WhatsappAccountEvents['on'](_0x194bee,_0x42c9b4);}}; \ No newline at end of file +var _0xa690=['save','remove','update','emit','length','./whatsappAccount.events'];(function(_0x58b1a3,_0x5a93e2){var _0x1e87b8=function(_0xa46bf1){while(--_0xa46bf1){_0x58b1a3['push'](_0x58b1a3['shift']());}};_0x1e87b8(++_0x5a93e2);}(_0xa690,0x1c1));var _0x0a69=function(_0x14e9f0,_0x287f90){_0x14e9f0=_0x14e9f0-0x0;var _0xa63f7e=_0xa690[_0x14e9f0];return _0xa63f7e;};'use strict';var WhatsappAccountEvents=require(_0x0a69('0x0'));var events=[_0x0a69('0x1'),_0x0a69('0x2'),_0x0a69('0x3')];function createListener(_0x4265a4,_0x2cd89c){return function(_0x4461f5){_0x2cd89c[_0x0a69('0x4')](_0x4265a4,_0x4461f5);};}function removeListener(_0x19e320,_0x197d93){return function(){WhatsappAccountEvents['removeListener'](_0x19e320,_0x197d93);};}exports['register']=function(_0x330ed3){for(var _0x2efedb=0x0,_0x54865d=events[_0x0a69('0x5')];_0x2efedb<_0x54865d;_0x2efedb++){var _0x181339=events[_0x2efedb];var _0x17bf17=createListener('whatsappAccount:'+_0x181339,_0x330ed3);WhatsappAccountEvents['on'](_0x181339,_0x17bf17);}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/index.js b/server/api/whatsappApplication/index.js index ba2ab3d..410c6c2 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 _0x9160=['express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','get','/:id','isAuthenticated','post','create','put','update','destroy','exports','multer','util'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0x9160,0x11e));var _0x0916=function(_0x40527a,_0xfeae45){_0x40527a=_0x40527a-0x0;var _0x299dfa=_0x9160[_0x40527a];return _0x299dfa;};'use strict';var multer=require(_0x0916('0x0'));var util=require(_0x0916('0x1'));var path=require('path');var timeout=require('connect-timeout');var express=require(_0x0916('0x2'));var router=express[_0x0916('0x3')]();var fs_extra=require('fs-extra');var auth=require(_0x0916('0x4'));var interaction=require(_0x0916('0x5'));var config=require(_0x0916('0x6'));var controller=require('./whatsappApplication.controller');router[_0x0916('0x7')]('/',auth['isAuthenticated'](),controller['index']);router['get'](_0x0916('0x8'),auth[_0x0916('0x9')](),controller['show']);router[_0x0916('0xa')]('/',auth[_0x0916('0x9')](),controller[_0x0916('0xb')]);router[_0x0916('0xc')]('/:id',auth[_0x0916('0x9')](),controller[_0x0916('0xd')]);router['delete']('/:id',auth[_0x0916('0x9')](),controller[_0x0916('0xe')]);module[_0x0916('0xf')]=router; \ No newline at end of file +var _0x1186=['update','delete','destroy','exports','multer','util','path','express','fs-extra','../../components/interaction/service','get','isAuthenticated','index','/:id','post','create','put'];(function(_0x3821d8,_0x10669d){var _0x4dfe90=function(_0x4b87b3){while(--_0x4b87b3){_0x3821d8['push'](_0x3821d8['shift']());}};_0x4dfe90(++_0x10669d);}(_0x1186,0x1be));var _0x6118=function(_0x1668e5,_0x5295dc){_0x1668e5=_0x1668e5-0x0;var _0xb8edf0=_0x1186[_0x1668e5];return _0xb8edf0;};'use strict';var multer=require(_0x6118('0x0'));var util=require(_0x6118('0x1'));var path=require(_0x6118('0x2'));var timeout=require('connect-timeout');var express=require(_0x6118('0x3'));var router=express['Router']();var fs_extra=require(_0x6118('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0x6118('0x5'));var config=require('../../config/environment');var controller=require('./whatsappApplication.controller');router[_0x6118('0x6')]('/',auth[_0x6118('0x7')](),controller[_0x6118('0x8')]);router[_0x6118('0x6')](_0x6118('0x9'),auth['isAuthenticated'](),controller['show']);router[_0x6118('0xa')]('/',auth['isAuthenticated'](),controller[_0x6118('0xb')]);router[_0x6118('0xc')](_0x6118('0x9'),auth['isAuthenticated'](),controller[_0x6118('0xd')]);router[_0x6118('0xe')]('/:id',auth[_0x6118('0x7')](),controller[_0x6118('0xf')]);module[_0x6118('0x10')]=router; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.attributes.js b/server/api/whatsappApplication/whatsappApplication.attributes.js index bb6ee7d..903fed0 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 _0x3e89=['STRING','noop','sequelize','INTEGER'];(function(_0x3414ca,_0xadf349){var _0x440a13=function(_0x29921b){while(--_0x29921b){_0x3414ca['push'](_0x3414ca['shift']());}};_0x440a13(++_0xadf349);}(_0x3e89,0x1aa));var _0x93e8=function(_0x447180,_0x274f49){_0x447180=_0x447180-0x0;var _0x4ceb25=_0x3e89[_0x447180];return _0x4ceb25;};'use strict';var Sequelize=require(_0x93e8('0x0'));module['exports']={'priority':{'type':Sequelize[_0x93e8('0x1')],'allowNull':![]},'app':{'type':Sequelize[_0x93e8('0x2')],'allowNull':![],'defaultValue':_0x93e8('0x3')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize['STRING']},'interval':{'type':Sequelize[_0x93e8('0x2')],'defaultValue':'*,*,*,*'}}; \ No newline at end of file +var _0x1836=['INTEGER','STRING','noop','*,*,*,*','sequelize','exports'];(function(_0x433a5a,_0x2486b4){var _0x115feb=function(_0x16fab5){while(--_0x16fab5){_0x433a5a['push'](_0x433a5a['shift']());}};_0x115feb(++_0x2486b4);}(_0x1836,0x70));var _0x6183=function(_0x3d5411,_0x14d521){_0x3d5411=_0x3d5411-0x0;var _0x3f51eb=_0x1836[_0x3d5411];return _0x3f51eb;};'use strict';var Sequelize=require(_0x6183('0x0'));module[_0x6183('0x1')]={'priority':{'type':Sequelize[_0x6183('0x2')],'allowNull':![]},'app':{'type':Sequelize[_0x6183('0x3')],'allowNull':![],'defaultValue':_0x6183('0x4')},'appdata':{'type':Sequelize['TEXT']()},'description':{'type':Sequelize[_0x6183('0x3')]},'interval':{'type':Sequelize[_0x6183('0x3')],'defaultValue':_0x6183('0x5')}}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.controller.js b/server/api/whatsappApplication/whatsappApplication.controller.js index e4d81f9..c80d26d 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 _0xd98a=['map','WhatsappApplication','rawAttributes','fieldName','type','key','model','query','keys','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','where','filters','pick','merge','VIRTUAL','filter','options','includeAll','findAll','rows','catch','params','include','find','create','body','destroy','eml-format','fast-json-patch','request-promise','moment','bluebird','mustache','util','to-csv','ejs','fs-extra','lodash','squel','jsforce','desk.js','querystring','ioredis','../../config/license/hardware','../../config/logger','api','../../config/utils','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','set','apply','reject','save','update','then','error','stack','name','send','index'];(function(_0x718493,_0x485616){var _0x59af54=function(_0x21268d){while(--_0x21268d){_0x718493['push'](_0x718493['shift']());}};_0x59af54(++_0x485616);}(_0xd98a,0xfc));var _0xad98=function(_0xf30eb6,_0xef6c9c){_0xf30eb6=_0xf30eb6-0x0;var _0x5e5eb3=_0xd98a[_0xf30eb6];return _0x5e5eb3;};'use strict';var emlformat=require(_0xad98('0x0'));var rimraf=require('rimraf');var zipdir=require('zip-dir');var jsonpatch=require(_0xad98('0x1'));var rp=require(_0xad98('0x2'));var moment=require(_0xad98('0x3'));var BPromise=require(_0xad98('0x4'));var Mustache=require(_0xad98('0x5'));var util=require(_0xad98('0x6'));var path=require('path');var sox=require('sox');var csv=require(_0xad98('0x7'));var ejs=require(_0xad98('0x8'));var fs=require('fs');var fs_extra=require(_0xad98('0x9'));var _=require(_0xad98('0xa'));var squel=require(_0xad98('0xb'));var crypto=require('crypto');var jsforce=require(_0xad98('0xc'));var deskjs=require(_0xad98('0xd'));var toCsv=require('to-csv');var querystring=require(_0xad98('0xe'));var Papa=require('papaparse');var Redis=require(_0xad98('0xf'));var authService=require('../../components/auth/service');var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0xad98('0x10'));var logger=require(_0xad98('0x11'))(_0xad98('0x12'));var utils=require(_0xad98('0x13'));var config=require('../../config/environment');var licenseUtil=require('../../config/license/util');var db=require(_0xad98('0x14'))['db'];function respondWithStatusCode(_0x1180d6,_0x1b430a){_0x1b430a=_0x1b430a||0xcc;return function(_0x1ba078){if(_0x1ba078){return _0x1180d6[_0xad98('0x15')](_0x1b430a);}return _0x1180d6[_0xad98('0x16')](_0x1b430a)[_0xad98('0x17')]();};}function respondWithResult(_0x1f033b,_0x308cf8){_0x308cf8=_0x308cf8||0xc8;return function(_0x5b2df6){if(_0x5b2df6){return _0x1f033b[_0xad98('0x16')](_0x308cf8)[_0xad98('0x18')](_0x5b2df6);}};}function respondWithFilteredResult(_0x338589,_0x354a4c){return function(_0x408e2a){if(_0x408e2a){var _0x2b3ee3=typeof _0x354a4c[_0xad98('0x19')]===_0xad98('0x1a')&&typeof _0x354a4c[_0xad98('0x1b')]==='undefined';var _0x533d76=_0x408e2a[_0xad98('0x1c')];var _0x5a3d09=_0x2b3ee3?0x0:_0x354a4c[_0xad98('0x19')];var _0x1df804=_0x2b3ee3?_0x408e2a[_0xad98('0x1c')]:_0x354a4c[_0xad98('0x19')]+_0x354a4c[_0xad98('0x1b')];var _0x17f502;if(_0x1df804>=_0x533d76){_0x1df804=_0x533d76;_0x17f502=0xc8;}else{_0x17f502=0xce;}_0x338589[_0xad98('0x16')](_0x17f502);return _0x338589[_0xad98('0x1d')]('Content-Range',_0x5a3d09+'-'+_0x1df804+'/'+_0x533d76)['json'](_0x408e2a);}return null;};}function patchUpdates(_0xa307d1){return function(_0x5d76e5){try{jsonpatch[_0xad98('0x1e')](_0x5d76e5,_0xa307d1,!![]);}catch(_0x2180dc){return BPromise[_0xad98('0x1f')](_0x2180dc);}return _0x5d76e5[_0xad98('0x20')]();};}function saveUpdates(_0x2a6aea,_0x2a286c){return function(_0x28ce36){if(_0x28ce36){return _0x28ce36[_0xad98('0x21')](_0x2a6aea)[_0xad98('0x22')](function(_0x46be4e){return _0x46be4e;});}return null;};}function removeEntity(_0xa04f8f,_0x1c8fd7){return function(_0x25c80f){if(_0x25c80f){return _0x25c80f['destroy']()[_0xad98('0x22')](function(){_0xa04f8f[_0xad98('0x16')](0xcc)[_0xad98('0x17')]();});}};}function handleEntityNotFound(_0xf48fe4,_0x536907){return function(_0x590b77){if(!_0x590b77){_0xf48fe4[_0xad98('0x15')](0x194);}return _0x590b77;};}function handleError(_0x3ff3b6,_0x383dba){_0x383dba=_0x383dba||0x1f4;return function(_0x135e6d){logger[_0xad98('0x23')](_0x135e6d[_0xad98('0x24')]);if(_0x135e6d[_0xad98('0x25')]){delete _0x135e6d['name'];}_0x3ff3b6[_0xad98('0x16')](_0x383dba)[_0xad98('0x26')](_0x135e6d);};}exports[_0xad98('0x27')]=function(_0x115d3f,_0x16eda0){var _0x341c16={},_0xc32be4={},_0x2ef98f={'count':0x0,'rows':[]};var _0x4c841f=_[_0xad98('0x28')](db[_0xad98('0x29')][_0xad98('0x2a')],function(_0x5a1a98){return{'name':_0x5a1a98[_0xad98('0x2b')],'type':_0x5a1a98[_0xad98('0x2c')][_0xad98('0x2d')]};});_0xc32be4[_0xad98('0x2e')]=_['map'](_0x4c841f,_0xad98('0x25'));_0xc32be4[_0xad98('0x2f')]=_[_0xad98('0x30')](_0x115d3f[_0xad98('0x2f')]);_0xc32be4['filters']=_[_0xad98('0x31')](_0xc32be4[_0xad98('0x2e')],_0xc32be4[_0xad98('0x2f')]);_0x341c16[_0xad98('0x32')]=_['intersection'](_0xc32be4[_0xad98('0x2e')],qs[_0xad98('0x33')](_0x115d3f[_0xad98('0x2f')]['fields']));_0x341c16[_0xad98('0x32')]=_0x341c16[_0xad98('0x32')][_0xad98('0x34')]?_0x341c16[_0xad98('0x32')]:_0xc32be4['model'];if(!_0x115d3f[_0xad98('0x2f')][_0xad98('0x35')](_0xad98('0x36'))){_0x341c16['limit']=qs[_0xad98('0x1b')](_0x115d3f[_0xad98('0x2f')][_0xad98('0x1b')]);_0x341c16['offset']=qs['offset'](_0x115d3f[_0xad98('0x2f')]['offset']);}_0x341c16['order']=qs[_0xad98('0x37')](_0x115d3f['query']['sort']);_0x341c16[_0xad98('0x38')]=qs[_0xad98('0x39')](_[_0xad98('0x3a')](_0x115d3f[_0xad98('0x2f')],_0xc32be4[_0xad98('0x39')]),_0x4c841f);if(_0x115d3f[_0xad98('0x2f')]['filter']){_0x341c16[_0xad98('0x38')]=_[_0xad98('0x3b')](_0x341c16[_0xad98('0x38')],{'$or':_[_0xad98('0x28')](_0x4c841f,function(_0x5d70d7){if(_0x5d70d7[_0xad98('0x2c')]!==_0xad98('0x3c')){var _0x264bf6={};_0x264bf6[_0x5d70d7[_0xad98('0x25')]]={'$like':'%'+_0x115d3f[_0xad98('0x2f')][_0xad98('0x3d')]+'%'};return _0x264bf6;}})});}_0x341c16=_[_0xad98('0x3b')]({},_0x341c16,_0x115d3f[_0xad98('0x3e')]);var _0xfdad30={'where':_0x341c16['where']};return db['WhatsappApplication']['count'](_0xfdad30)[_0xad98('0x22')](function(_0xab3182){_0x2ef98f[_0xad98('0x1c')]=_0xab3182;if(_0x115d3f[_0xad98('0x2f')][_0xad98('0x3f')]){_0x341c16['include']=[{'all':!![]}];}return db['WhatsappApplication'][_0xad98('0x40')](_0x341c16);})[_0xad98('0x22')](function(_0x1006d9){_0x2ef98f[_0xad98('0x41')]=_0x1006d9;return _0x2ef98f;})[_0xad98('0x22')](respondWithFilteredResult(_0x16eda0,_0x341c16))[_0xad98('0x42')](handleError(_0x16eda0,null));};exports['show']=function(_0x5e7afc,_0x2ee57d){var _0x308973={'raw':!![],'where':{'id':_0x5e7afc[_0xad98('0x43')]['id']}},_0x329e55={};_0x329e55['model']=_[_0xad98('0x30')](db['WhatsappApplication']['rawAttributes']);_0x329e55['query']=_[_0xad98('0x30')](_0x5e7afc[_0xad98('0x2f')]);_0x329e55[_0xad98('0x39')]=_[_0xad98('0x31')](_0x329e55[_0xad98('0x2e')],_0x329e55[_0xad98('0x2f')]);_0x308973[_0xad98('0x32')]=_['intersection'](_0x329e55['model'],qs[_0xad98('0x33')](_0x5e7afc['query'][_0xad98('0x33')]));_0x308973[_0xad98('0x32')]=_0x308973['attributes']['length']?_0x308973['attributes']:_0x329e55[_0xad98('0x2e')];if(_0x5e7afc[_0xad98('0x2f')]['includeAll']){_0x308973[_0xad98('0x44')]=[{'all':!![]}];}_0x308973=_['merge']({},_0x308973,_0x5e7afc[_0xad98('0x3e')]);return db['WhatsappApplication'][_0xad98('0x45')](_0x308973)[_0xad98('0x22')](handleEntityNotFound(_0x2ee57d,null))[_0xad98('0x22')](respondWithResult(_0x2ee57d,null))[_0xad98('0x42')](handleError(_0x2ee57d,null));};exports[_0xad98('0x46')]=function(_0x27b1d9,_0x4b5124){return db[_0xad98('0x29')][_0xad98('0x46')](_0x27b1d9[_0xad98('0x47')],{})[_0xad98('0x22')](respondWithResult(_0x4b5124,0xc9))[_0xad98('0x42')](handleError(_0x4b5124,null));};exports[_0xad98('0x21')]=function(_0x153312,_0x3c05dc){if(_0x153312['body']['id']){delete _0x153312[_0xad98('0x47')]['id'];}return db[_0xad98('0x29')][_0xad98('0x45')]({'where':{'id':_0x153312['params']['id']}})['then'](handleEntityNotFound(_0x3c05dc,null))['then'](saveUpdates(_0x153312[_0xad98('0x47')],null))[_0xad98('0x22')](respondWithResult(_0x3c05dc,null))[_0xad98('0x42')](handleError(_0x3c05dc,null));};exports[_0xad98('0x48')]=function(_0x433a12,_0x226c47){return db[_0xad98('0x29')]['find']({'where':{'id':_0x433a12[_0xad98('0x43')]['id']}})['then'](handleEntityNotFound(_0x226c47,null))[_0xad98('0x22')](removeEntity(_0x226c47,null))['catch'](handleError(_0x226c47,null));}; \ No newline at end of file +var _0xf811=['then','destroy','error','stack','name','index','map','WhatsappApplication','rawAttributes','type','key','model','query','keys','filters','intersection','attributes','fields','hasOwnProperty','order','sort','pick','filter','where','merge','includeAll','include','findAll','catch','show','length','options','find','create','body','params','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','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','offset','undefined','limit','count','Content-Range','json','apply','save'];(function(_0x56d9af,_0x1f2380){var _0x966903=function(_0x15e24a){while(--_0x15e24a){_0x56d9af['push'](_0x56d9af['shift']());}};_0x966903(++_0x1f2380);}(_0xf811,0x6f));var _0x1f81=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xf811[_0x167cc1];return _0x10bc4b;};'use strict';var emlformat=require(_0x1f81('0x0'));var rimraf=require(_0x1f81('0x1'));var zipdir=require(_0x1f81('0x2'));var jsonpatch=require(_0x1f81('0x3'));var rp=require(_0x1f81('0x4'));var moment=require(_0x1f81('0x5'));var BPromise=require(_0x1f81('0x6'));var Mustache=require(_0x1f81('0x7'));var util=require(_0x1f81('0x8'));var path=require(_0x1f81('0x9'));var sox=require(_0x1f81('0xa'));var csv=require(_0x1f81('0xb'));var ejs=require(_0x1f81('0xc'));var fs=require('fs');var fs_extra=require(_0x1f81('0xd'));var _=require('lodash');var squel=require(_0x1f81('0xe'));var crypto=require(_0x1f81('0xf'));var jsforce=require(_0x1f81('0x10'));var deskjs=require('desk.js');var toCsv=require(_0x1f81('0xb'));var querystring=require(_0x1f81('0x11'));var Papa=require('papaparse');var Redis=require(_0x1f81('0x12'));var authService=require('../../components/auth/service');var qs=require(_0x1f81('0x13'));var as=require(_0x1f81('0x14'));var hardwareService=require(_0x1f81('0x15'));var logger=require(_0x1f81('0x16'))(_0x1f81('0x17'));var utils=require(_0x1f81('0x18'));var config=require(_0x1f81('0x19'));var licenseUtil=require(_0x1f81('0x1a'));var db=require(_0x1f81('0x1b'))['db'];function respondWithStatusCode(_0x111c85,_0x14851a){_0x14851a=_0x14851a||0xcc;return function(_0x1d9ef5){if(_0x1d9ef5){return _0x111c85[_0x1f81('0x1c')](_0x14851a);}return _0x111c85[_0x1f81('0x1d')](_0x14851a)[_0x1f81('0x1e')]();};}function respondWithResult(_0x247b10,_0x5a4992){_0x5a4992=_0x5a4992||0xc8;return function(_0x29941f){if(_0x29941f){return _0x247b10[_0x1f81('0x1d')](_0x5a4992)['json'](_0x29941f);}};}function respondWithFilteredResult(_0x5e1036,_0x20cea6){return function(_0x1a781d){if(_0x1a781d){var _0x5da9d1=typeof _0x20cea6[_0x1f81('0x1f')]===_0x1f81('0x20')&&typeof _0x20cea6[_0x1f81('0x21')]===_0x1f81('0x20');var _0x4bdba8=_0x1a781d['count'];var _0x13bf61=_0x5da9d1?0x0:_0x20cea6[_0x1f81('0x1f')];var _0x579638=_0x5da9d1?_0x1a781d[_0x1f81('0x22')]:_0x20cea6['offset']+_0x20cea6[_0x1f81('0x21')];var _0x1f9813;if(_0x579638>=_0x4bdba8){_0x579638=_0x4bdba8;_0x1f9813=0xc8;}else{_0x1f9813=0xce;}_0x5e1036[_0x1f81('0x1d')](_0x1f9813);return _0x5e1036['set'](_0x1f81('0x23'),_0x13bf61+'-'+_0x579638+'/'+_0x4bdba8)[_0x1f81('0x24')](_0x1a781d);}return null;};}function patchUpdates(_0x2d9b8d){return function(_0x3d35bd){try{jsonpatch[_0x1f81('0x25')](_0x3d35bd,_0x2d9b8d,!![]);}catch(_0x20e351){return BPromise['reject'](_0x20e351);}return _0x3d35bd[_0x1f81('0x26')]();};}function saveUpdates(_0x37b6ff,_0x3751d4){return function(_0x4ecfa9){if(_0x4ecfa9){return _0x4ecfa9['update'](_0x37b6ff)[_0x1f81('0x27')](function(_0x4aaf6e){return _0x4aaf6e;});}return null;};}function removeEntity(_0x13e8c5,_0x4f714a){return function(_0x59c93a){if(_0x59c93a){return _0x59c93a[_0x1f81('0x28')]()['then'](function(){_0x13e8c5[_0x1f81('0x1d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x21caa5,_0xe95e9c){return function(_0x147695){if(!_0x147695){_0x21caa5[_0x1f81('0x1c')](0x194);}return _0x147695;};}function handleError(_0x19dab0,_0x3d9e7a){_0x3d9e7a=_0x3d9e7a||0x1f4;return function(_0x2ff623){logger[_0x1f81('0x29')](_0x2ff623[_0x1f81('0x2a')]);if(_0x2ff623[_0x1f81('0x2b')]){delete _0x2ff623['name'];}_0x19dab0[_0x1f81('0x1d')](_0x3d9e7a)['send'](_0x2ff623);};}exports[_0x1f81('0x2c')]=function(_0x197da5,_0x537166){var _0x3d547b={},_0x186e42={},_0x218040={'count':0x0,'rows':[]};var _0x232750=_[_0x1f81('0x2d')](db[_0x1f81('0x2e')][_0x1f81('0x2f')],function(_0x381b5c){return{'name':_0x381b5c['fieldName'],'type':_0x381b5c[_0x1f81('0x30')][_0x1f81('0x31')]};});_0x186e42[_0x1f81('0x32')]=_[_0x1f81('0x2d')](_0x232750,_0x1f81('0x2b'));_0x186e42[_0x1f81('0x33')]=_[_0x1f81('0x34')](_0x197da5[_0x1f81('0x33')]);_0x186e42[_0x1f81('0x35')]=_[_0x1f81('0x36')](_0x186e42[_0x1f81('0x32')],_0x186e42['query']);_0x3d547b[_0x1f81('0x37')]=_[_0x1f81('0x36')](_0x186e42[_0x1f81('0x32')],qs[_0x1f81('0x38')](_0x197da5['query'][_0x1f81('0x38')]));_0x3d547b[_0x1f81('0x37')]=_0x3d547b[_0x1f81('0x37')]['length']?_0x3d547b['attributes']:_0x186e42[_0x1f81('0x32')];if(!_0x197da5['query'][_0x1f81('0x39')]('nolimit')){_0x3d547b[_0x1f81('0x21')]=qs[_0x1f81('0x21')](_0x197da5[_0x1f81('0x33')][_0x1f81('0x21')]);_0x3d547b[_0x1f81('0x1f')]=qs[_0x1f81('0x1f')](_0x197da5[_0x1f81('0x33')]['offset']);}_0x3d547b[_0x1f81('0x3a')]=qs['sort'](_0x197da5[_0x1f81('0x33')][_0x1f81('0x3b')]);_0x3d547b['where']=qs[_0x1f81('0x35')](_[_0x1f81('0x3c')](_0x197da5[_0x1f81('0x33')],_0x186e42['filters']),_0x232750);if(_0x197da5[_0x1f81('0x33')][_0x1f81('0x3d')]){_0x3d547b[_0x1f81('0x3e')]=_[_0x1f81('0x3f')](_0x3d547b[_0x1f81('0x3e')],{'$or':_['map'](_0x232750,function(_0x1823ee){if(_0x1823ee[_0x1f81('0x30')]!=='VIRTUAL'){var _0x5a57d1={};_0x5a57d1[_0x1823ee['name']]={'$like':'%'+_0x197da5[_0x1f81('0x33')][_0x1f81('0x3d')]+'%'};return _0x5a57d1;}})});}_0x3d547b=_['merge']({},_0x3d547b,_0x197da5['options']);var _0x4ec05c={'where':_0x3d547b[_0x1f81('0x3e')]};return db[_0x1f81('0x2e')]['count'](_0x4ec05c)[_0x1f81('0x27')](function(_0x29b54f){_0x218040[_0x1f81('0x22')]=_0x29b54f;if(_0x197da5['query'][_0x1f81('0x40')]){_0x3d547b[_0x1f81('0x41')]=[{'all':!![]}];}return db[_0x1f81('0x2e')][_0x1f81('0x42')](_0x3d547b);})[_0x1f81('0x27')](function(_0xb0d536){_0x218040['rows']=_0xb0d536;return _0x218040;})[_0x1f81('0x27')](respondWithFilteredResult(_0x537166,_0x3d547b))[_0x1f81('0x43')](handleError(_0x537166,null));};exports[_0x1f81('0x44')]=function(_0x176884,_0x5a22a4){var _0x2c9c48={'raw':!![],'where':{'id':_0x176884['params']['id']}},_0x15c1b9={};_0x15c1b9[_0x1f81('0x32')]=_['keys'](db[_0x1f81('0x2e')]['rawAttributes']);_0x15c1b9[_0x1f81('0x33')]=_['keys'](_0x176884[_0x1f81('0x33')]);_0x15c1b9[_0x1f81('0x35')]=_[_0x1f81('0x36')](_0x15c1b9['model'],_0x15c1b9[_0x1f81('0x33')]);_0x2c9c48[_0x1f81('0x37')]=_['intersection'](_0x15c1b9[_0x1f81('0x32')],qs[_0x1f81('0x38')](_0x176884[_0x1f81('0x33')][_0x1f81('0x38')]));_0x2c9c48[_0x1f81('0x37')]=_0x2c9c48[_0x1f81('0x37')][_0x1f81('0x45')]?_0x2c9c48['attributes']:_0x15c1b9[_0x1f81('0x32')];if(_0x176884[_0x1f81('0x33')]['includeAll']){_0x2c9c48[_0x1f81('0x41')]=[{'all':!![]}];}_0x2c9c48=_[_0x1f81('0x3f')]({},_0x2c9c48,_0x176884[_0x1f81('0x46')]);return db['WhatsappApplication'][_0x1f81('0x47')](_0x2c9c48)[_0x1f81('0x27')](handleEntityNotFound(_0x5a22a4,null))['then'](respondWithResult(_0x5a22a4,null))[_0x1f81('0x43')](handleError(_0x5a22a4,null));};exports['create']=function(_0x51bd8d,_0x19f10d){return db[_0x1f81('0x2e')][_0x1f81('0x48')](_0x51bd8d['body'],{})['then'](respondWithResult(_0x19f10d,0xc9))[_0x1f81('0x43')](handleError(_0x19f10d,null));};exports['update']=function(_0x9a7ddb,_0x388936){if(_0x9a7ddb[_0x1f81('0x49')]['id']){delete _0x9a7ddb[_0x1f81('0x49')]['id'];}return db[_0x1f81('0x2e')]['find']({'where':{'id':_0x9a7ddb[_0x1f81('0x4a')]['id']}})[_0x1f81('0x27')](handleEntityNotFound(_0x388936,null))[_0x1f81('0x27')](saveUpdates(_0x9a7ddb[_0x1f81('0x49')],null))['then'](respondWithResult(_0x388936,null))['catch'](handleError(_0x388936,null));};exports[_0x1f81('0x28')]=function(_0x271570,_0x56beff){return db[_0x1f81('0x2e')]['find']({'where':{'id':_0x271570[_0x1f81('0x4a')]['id']}})['then'](handleEntityNotFound(_0x56beff,null))[_0x1f81('0x27')](removeEntity(_0x56beff,null))['catch'](handleError(_0x56beff,null));}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.model.js b/server/api/whatsappApplication/whatsappApplication.model.js index 48cee05..74e2615 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 _0x68fc=['./whatsappApplication.attributes','exports','whatsapp_applications','utf8mb4','utf8mb4_unicode_ci','lodash','util','../../config/logger','bluebird','path'];(function(_0x4471ff,_0x4bb7de){var _0xe723ca=function(_0xf3cc76){while(--_0xf3cc76){_0x4471ff['push'](_0x4471ff['shift']());}};_0xe723ca(++_0x4bb7de);}(_0x68fc,0xa5));var _0xc68f=function(_0x108bde,_0x49e09b){_0x108bde=_0x108bde-0x0;var _0x24c7a9=_0x68fc[_0x108bde];return _0x24c7a9;};'use strict';var _=require(_0xc68f('0x0'));var util=require(_0xc68f('0x1'));var logger=require(_0xc68f('0x2'))('api');var moment=require('moment');var BPromise=require(_0xc68f('0x3'));var rp=require('request-promise');var fs=require('fs');var path=require(_0xc68f('0x4'));var rimraf=require('rimraf');var config=require('../../config/environment');var attributes=require(_0xc68f('0x5'));module[_0xc68f('0x6')]=function(_0x1c6df9,_0x363cdf){return _0x1c6df9['define']('WhatsappApplication',attributes,{'tableName':_0xc68f('0x7'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':_0xc68f('0x8'),'collate':_0xc68f('0x9')});}; \ No newline at end of file +var _0x097c=['bluebird','request-promise','path','../../config/environment','exports','define','whatsapp_applications','lodash','util','../../config/logger','moment'];(function(_0x325153,_0x3c0839){var _0x4913f5=function(_0x1cb92c){while(--_0x1cb92c){_0x325153['push'](_0x325153['shift']());}};_0x4913f5(++_0x3c0839);}(_0x097c,0x1d5));var _0xc097=function(_0x80c475,_0x476c62){_0x80c475=_0x80c475-0x0;var _0xf7b7fd=_0x097c[_0x80c475];return _0xf7b7fd;};'use strict';var _=require(_0xc097('0x0'));var util=require(_0xc097('0x1'));var logger=require(_0xc097('0x2'))('api');var moment=require(_0xc097('0x3'));var BPromise=require(_0xc097('0x4'));var rp=require(_0xc097('0x5'));var fs=require('fs');var path=require(_0xc097('0x6'));var rimraf=require('rimraf');var config=require(_0xc097('0x7'));var attributes=require('./whatsappApplication.attributes');module[_0xc097('0x8')]=function(_0x3c9603,_0x31bc9a){return _0x3c9603[_0xc097('0x9')]('WhatsappApplication',attributes,{'tableName':_0xc097('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappApplication/whatsappApplication.rpc.js b/server/api/whatsappApplication/whatsappApplication.rpc.js index 140548f..470b6bc 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 _0xb903=['http','request','WhatsappApplication,\x20%s,\x20%s,\x20%s','request\x20sent','error','WhatsappApplication,\x20%s,\x20%s','message','info','result','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0xe39f11,_0x198367){var _0x15595c=function(_0x2b68bc){while(--_0x2b68bc){_0xe39f11['push'](_0xe39f11['shift']());}};_0x15595c(++_0x198367);}(_0xb903,0x185));var _0x3b90=function(_0x5bee96,_0x52cd81){_0x5bee96=_0x5bee96-0x0;var _0x52e45a=_0xb903[_0x5bee96];return _0x52e45a;};'use strict';var _=require(_0x3b90('0x0'));var util=require(_0x3b90('0x1'));var moment=require(_0x3b90('0x2'));var BPromise=require(_0x3b90('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3b90('0x4'));var db=require(_0x3b90('0x5'))['db'];var utils=require(_0x3b90('0x6'));var logger=require(_0x3b90('0x7'))(_0x3b90('0x8'));var config=require(_0x3b90('0x9'));var jayson=require(_0x3b90('0xa'));var client=jayson['client'][_0x3b90('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5e845a,_0x55792c,_0x153283){return new BPromise(function(_0x2e4c06,_0x42efe8){return client[_0x3b90('0xc')](_0x5e845a,_0x153283)['then'](function(_0x5cda1d){logger['info']('WhatsappApplication,\x20%s,\x20%s',_0x55792c,'request\x20sent');logger['debug'](_0x3b90('0xd'),_0x55792c,_0x3b90('0xe'),JSON['stringify'](_0x5cda1d));if(_0x5cda1d[_0x3b90('0xf')]){if(_0x5cda1d[_0x3b90('0xf')]['code']===0x1f4){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x5cda1d[_0x3b90('0xf')]['message']);return _0x42efe8(_0x5cda1d['error'][_0x3b90('0x11')]);}logger['error']('WhatsappApplication,\x20%s,\x20%s',_0x55792c,_0x5cda1d[_0x3b90('0xf')][_0x3b90('0x11')]);return _0x2e4c06(_0x5cda1d['error']['message']);}else{logger[_0x3b90('0x12')](_0x3b90('0x10'),_0x55792c,_0x3b90('0xe'));_0x2e4c06(_0x5cda1d[_0x3b90('0x13')][_0x3b90('0x11')]);}})['catch'](function(_0x494970){logger[_0x3b90('0xf')](_0x3b90('0x10'),_0x55792c,_0x494970);_0x42efe8(_0x494970);});});} \ No newline at end of file +var _0x668b=['bluebird','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','then','info','WhatsappApplication,\x20%s,\x20%s','request\x20sent','debug','WhatsappApplication,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x2418a2,_0x335e74){var _0xd8910=function(_0x393118){while(--_0x393118){_0x2418a2['push'](_0x2418a2['shift']());}};_0xd8910(++_0x335e74);}(_0x668b,0x140));var _0xb668=function(_0x20714a,_0x7de591){_0x20714a=_0x20714a-0x0;var _0x15e877=_0x668b[_0x20714a];return _0x15e877;};'use strict';var _=require(_0xb668('0x0'));var util=require(_0xb668('0x1'));var moment=require('moment');var BPromise=require(_0xb668('0x2'));var rs=require(_0xb668('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb668('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xb668('0x5'))(_0xb668('0x6'));var config=require(_0xb668('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xb668('0x8')][_0xb668('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x3be92e,_0x2778e9,_0x20b749){return new BPromise(function(_0x3f01bc,_0x517fc5){return client[_0xb668('0xa')](_0x3be92e,_0x20b749)[_0xb668('0xb')](function(_0x128cf5){logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));logger[_0xb668('0xf')](_0xb668('0x10'),_0x2778e9,'request\x20sent',JSON[_0xb668('0x11')](_0x128cf5));if(_0x128cf5[_0xb668('0x12')]){if(_0x128cf5[_0xb668('0x12')][_0xb668('0x13')]===0x1f4){logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x517fc5(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}logger[_0xb668('0x12')](_0xb668('0xd'),_0x2778e9,_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);return _0x3f01bc(_0x128cf5[_0xb668('0x12')][_0xb668('0x14')]);}else{logger[_0xb668('0xc')](_0xb668('0xd'),_0x2778e9,_0xb668('0xe'));_0x3f01bc(_0x128cf5[_0xb668('0x15')][_0xb668('0x14')]);}})[_0xb668('0x16')](function(_0x4ab137){logger[_0xb668('0x12')]('WhatsappApplication,\x20%s,\x20%s',_0x2778e9,_0x4ab137);_0x517fc5(_0x4ab137);});});} \ No newline at end of file diff --git a/server/api/whatsappInteraction/index.js b/server/api/whatsappInteraction/index.js index 6e7a5ac..89b68a0 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 _0xc1c6=['/describe','isAuthenticated','describe','show','/:id/messages','getMessages','download','post','create','addMessage','/:id/tags','tracked','whatsapp','whatsappinteraction:addtags','addTags','put','/:id','whatsappinteraction:update','delete','whatsappinteraction:destroy','destroy','removeTags','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../components/interaction/service','get','index'];(function(_0x42963c,_0x3c2b10){var _0xe4acd5=function(_0xa92fc0){while(--_0xa92fc0){_0x42963c['push'](_0x42963c['shift']());}};_0xe4acd5(++_0x3c2b10);}(_0xc1c6,0xf7));var _0x6c1c=function(_0x145ac1,_0x28a9ed){_0x145ac1=_0x145ac1-0x0;var _0xcd5e27=_0xc1c6[_0x145ac1];return _0xcd5e27;};'use strict';var multer=require(_0x6c1c('0x0'));var util=require(_0x6c1c('0x1'));var path=require(_0x6c1c('0x2'));var timeout=require('connect-timeout');var express=require(_0x6c1c('0x3'));var router=express['Router']();var fs_extra=require(_0x6c1c('0x4'));var auth=require(_0x6c1c('0x5'));var interaction=require(_0x6c1c('0x6'));var config=require('../../config/environment');var controller=require('./whatsappInteraction.controller');router[_0x6c1c('0x7')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x8')]);router['get'](_0x6c1c('0x9'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xb')]);router[_0x6c1c('0x7')]('/:id',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xc')]);router['get'](_0x6c1c('0xd'),auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xe')]);router[_0x6c1c('0x7')]('/:id/download',auth[_0x6c1c('0xa')](),controller[_0x6c1c('0xf')]);router[_0x6c1c('0x10')]('/',auth['isAuthenticated'](),controller[_0x6c1c('0x11')]);router[_0x6c1c('0x10')](_0x6c1c('0xd'),auth['isAuthenticated'](),controller[_0x6c1c('0x12')]);router['post'](_0x6c1c('0x13'),auth[_0x6c1c('0xa')](),interaction[_0x6c1c('0x14')](_0x6c1c('0x15'),_0x6c1c('0x16')),controller[_0x6c1c('0x17')]);router[_0x6c1c('0x18')](_0x6c1c('0x19'),auth[_0x6c1c('0xa')](),interaction['tracked'](_0x6c1c('0x15'),_0x6c1c('0x1a')),controller['update']);router[_0x6c1c('0x1b')](_0x6c1c('0x19'),auth['isAuthenticated'](),interaction[_0x6c1c('0x14')]('whatsapp',_0x6c1c('0x1c')),controller[_0x6c1c('0x1d')]);router['delete'](_0x6c1c('0x13'),auth['isAuthenticated'](),controller[_0x6c1c('0x1e')]);module[_0x6c1c('0x1f')]=router; \ No newline at end of file +var _0x6c7b=['/:id/download','download','post','create','addMessage','/:id/tags','tracked','whatsappinteraction:addtags','whatsapp','whatsappinteraction:update','update','delete','whatsappinteraction:destroy','destroy','exports','multer','express','fs-extra','../../components/auth/service','../../components/interaction/service','./whatsappInteraction.controller','get','isAuthenticated','index','describe','/:id','show','/:id/messages'];(function(_0x94c9dd,_0x5485e9){var _0x557316=function(_0x2baf3a){while(--_0x2baf3a){_0x94c9dd['push'](_0x94c9dd['shift']());}};_0x557316(++_0x5485e9);}(_0x6c7b,0x10b));var _0xb6c7=function(_0x3350d7,_0x55a17b){_0x3350d7=_0x3350d7-0x0;var _0x4ae916=_0x6c7b[_0x3350d7];return _0x4ae916;};'use strict';var multer=require(_0xb6c7('0x0'));var util=require('util');var path=require('path');var timeout=require('connect-timeout');var express=require(_0xb6c7('0x1'));var router=express['Router']();var fs_extra=require(_0xb6c7('0x2'));var auth=require(_0xb6c7('0x3'));var interaction=require(_0xb6c7('0x4'));var config=require('../../config/environment');var controller=require(_0xb6c7('0x5'));router[_0xb6c7('0x6')]('/',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x8')]);router[_0xb6c7('0x6')]('/describe',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x9')]);router[_0xb6c7('0x6')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xb')]);router[_0xb6c7('0x6')](_0xb6c7('0xc'),auth['isAuthenticated'](),controller['getMessages']);router[_0xb6c7('0x6')](_0xb6c7('0xd'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0xe')]);router[_0xb6c7('0xf')]('/',auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x10')]);router['post'](_0xb6c7('0xc'),auth[_0xb6c7('0x7')](),controller[_0xb6c7('0x11')]);router[_0xb6c7('0xf')](_0xb6c7('0x12'),auth[_0xb6c7('0x7')](),interaction[_0xb6c7('0x13')]('whatsapp',_0xb6c7('0x14')),controller['addTags']);router['put']('/:id',auth[_0xb6c7('0x7')](),interaction['tracked'](_0xb6c7('0x15'),_0xb6c7('0x16')),controller[_0xb6c7('0x17')]);router[_0xb6c7('0x18')](_0xb6c7('0xa'),auth[_0xb6c7('0x7')](),interaction[_0xb6c7('0x13')](_0xb6c7('0x15'),_0xb6c7('0x19')),controller[_0xb6c7('0x1a')]);router[_0xb6c7('0x18')](_0xb6c7('0x12'),auth[_0xb6c7('0x7')](),controller['removeTags']);module[_0xb6c7('0x1b')]=router; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.attributes.js b/server/api/whatsappInteraction/whatsappInteraction.attributes.js index 30e0764..e734bb2 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 _0x093a=['BOOLEAN','STRING','DATE','ENUM','out','moment','exports'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0x093a,0x16a));var _0xa093=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x093a[_0x321bb2];return _0x9c12ed;};'use strict';var Sequelize=require('sequelize');var moment=require(_0xa093('0x0'));module[_0xa093('0x1')]={'closed':{'type':Sequelize[_0xa093('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize['DATE']},'disposition':{'type':Sequelize['STRING']},'secondDisposition':{'type':Sequelize[_0xa093('0x3')]},'thirdDisposition':{'type':Sequelize[_0xa093('0x3')]},'note':{'type':Sequelize[_0xa093('0x3')]},'phone':{'type':Sequelize[_0xa093('0x3')]},'read1stAt':{'type':Sequelize[_0xa093('0x4')]},'firstMsgDirection':{'type':Sequelize[_0xa093('0x5')]('in',_0xa093('0x6')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize[_0xa093('0x4')]},'lastMsgDirection':{'type':Sequelize[_0xa093('0x5')]('in',_0xa093('0x6')),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize[_0xa093('0x2')],'defaultValue':![]}}; \ No newline at end of file +var _0xb234=['DATE','STRING','out','ENUM','sequelize','moment','BOOLEAN'];(function(_0x21d0c3,_0x16c71c){var _0x4df18e=function(_0x576bfe){while(--_0x576bfe){_0x21d0c3['push'](_0x21d0c3['shift']());}};_0x4df18e(++_0x16c71c);}(_0xb234,0x13f));var _0x4b23=function(_0x52b8da,_0x2c6c65){_0x52b8da=_0x52b8da-0x0;var _0x2ad110=_0xb234[_0x52b8da];return _0x2ad110;};'use strict';var Sequelize=require(_0x4b23('0x0'));var moment=require(_0x4b23('0x1'));module['exports']={'closed':{'type':Sequelize[_0x4b23('0x2')],'defaultValue':![]},'closedAt':{'type':Sequelize[_0x4b23('0x3')]},'disposition':{'type':Sequelize[_0x4b23('0x4')]},'secondDisposition':{'type':Sequelize[_0x4b23('0x4')]},'thirdDisposition':{'type':Sequelize['STRING']},'note':{'type':Sequelize['STRING']},'phone':{'type':Sequelize[_0x4b23('0x4')]},'read1stAt':{'type':Sequelize[_0x4b23('0x3')]},'firstMsgDirection':{'type':Sequelize['ENUM']('in',_0x4b23('0x5')),'defaultValue':'in','allowNull':![]},'lastMsgAt':{'type':Sequelize['DATE']},'lastMsgDirection':{'type':Sequelize[_0x4b23('0x6')]('in','out'),'defaultValue':'in','allowNull':![]},'autoreplyExecuted':{'type':Sequelize['BOOLEAN'],'defaultValue':![]}}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.controller.js b/server/api/whatsappInteraction/whatsappInteraction.controller.js index f319e5f..e73e31a 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 _0x228b=['zip-dir','moment','bluebird','path','ejs','ioredis','../../components/interaction/service','../../components/export/pdf','../../config/environment','redis','defaults','localhost','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','destroy','error','stack','name','send','map','WhatsappInteraction','rawAttributes','fieldName','type','key','getOptions','user','catch','show','params','model','keys','query','intersection','attributes','fields','length','includeAll','include','merge','find','create','body','describe','WhatsappMessage','ids','getMessages','findOne','filters','hasOwnProperty','nolimit','order','sort','where','WhatsappInteractionId','filter','$gte','split','format','options','rows','addTags','omit','findAll','color','emit','whatsappInteractionTags:save','removeTags','toString','root','files','tmp','join','server','transcript-%d-%s.zip','User','fullname','CmContact','Contact','lastName','push','Attachment','direction','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','N.A.','YYYY-MM-DD\x20HH:mm:ss','closedAt','disposition','basename','existsSync','pipe','createdAt','out','System','firstName','value','downloadInteraction.ejs','transcript-','.pdf','Whatsapp','createPdfFromHTML','log','unlinkSync','rimraf'];(function(_0x535c9e,_0x1344b0){var _0x2f426e=function(_0x42b816){while(--_0x42b816){_0x535c9e['push'](_0x535c9e['shift']());}};_0x2f426e(++_0x1344b0);}(_0x228b,0x1e7));var _0xb228=function(_0x466e6c,_0x4f9d78){_0x466e6c=_0x466e6c-0x0;var _0x2b478a=_0x228b[_0x466e6c];return _0x2b478a;};'use strict';var rimraf=require(_0xb228('0x0'));var zipdir=require(_0xb228('0x1'));var moment=require(_0xb228('0x2'));var BPromise=require(_0xb228('0x3'));var util=require('util');var path=require(_0xb228('0x4'));var ejs=require(_0xb228('0x5'));var fs=require('fs');var _=require('lodash');var Redis=require(_0xb228('0x6'));var interaction=require(_0xb228('0x7'));var qs=require('../../components/parsers/qs');var pdf=require(_0xb228('0x8'));var logger=require('../../config/logger')('api');var config=require(_0xb228('0x9'));var db=require('../../mysqldb')['db'];config[_0xb228('0xa')]=_[_0xb228('0xb')](config['redis'],{'host':_0xb228('0xc'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0xb228('0xd'))[_0xb228('0xe')](socket);function respondWithStatusCode(_0x4fe3e3,_0x51a3df){_0x51a3df=_0x51a3df||0xcc;return function(_0x25c240){if(_0x25c240){return _0x4fe3e3[_0xb228('0xf')](_0x51a3df);}return _0x4fe3e3[_0xb228('0x10')](_0x51a3df)[_0xb228('0x11')]();};}function respondWithResult(_0x374cc9,_0x55e2df){_0x55e2df=_0x55e2df||0xc8;return function(_0x3c3280){if(_0x3c3280){return _0x374cc9[_0xb228('0x10')](_0x55e2df)[_0xb228('0x12')](_0x3c3280);}};}function respondWithFilteredResult(_0x1dfaf9,_0x289760){return function(_0x2d1123){if(_0x2d1123){var _0x276262=typeof _0x289760[_0xb228('0x13')]===_0xb228('0x14')&&typeof _0x289760[_0xb228('0x15')]==='undefined';var _0x378821=_0x2d1123[_0xb228('0x16')];var _0x5cc9b1=_0x276262?0x0:_0x289760[_0xb228('0x13')];var _0x143ebe=_0x276262?_0x2d1123[_0xb228('0x16')]:_0x289760[_0xb228('0x13')]+_0x289760['limit'];var _0x35416a;if(_0x143ebe>=_0x378821){_0x143ebe=_0x378821;_0x35416a=0xc8;}else{_0x35416a=0xce;}_0x1dfaf9[_0xb228('0x10')](_0x35416a);return _0x1dfaf9[_0xb228('0x17')](_0xb228('0x18'),_0x5cc9b1+'-'+_0x143ebe+'/'+_0x378821)['json'](_0x2d1123);}return null;};}function saveUpdates(_0x35fc55){return function(_0x264747){if(_0x264747){return _0x264747[_0xb228('0x19')](_0x35fc55)[_0xb228('0x1a')](function(_0xf118e9){return _0xf118e9;});}return null;};}function removeEntity(_0x2d8bf0){return function(_0x4b5dab){if(_0x4b5dab){return _0x4b5dab[_0xb228('0x1b')]()['then'](function(){_0x2d8bf0['status'](0xcc)[_0xb228('0x11')]();});}};}function handleEntityNotFound(_0x50203d){return function(_0x428327){if(!_0x428327){_0x50203d[_0xb228('0xf')](0x194);}return _0x428327;};}function handleError(_0x5a1004,_0x257b31){_0x257b31=_0x257b31||0x1f4;return function(_0x1ff4d9){logger[_0xb228('0x1c')](_0x1ff4d9[_0xb228('0x1d')]);if(_0x1ff4d9[_0xb228('0x1e')]){delete _0x1ff4d9['name'];}_0x5a1004['status'](_0x257b31)[_0xb228('0x1f')](_0x1ff4d9);};}exports['index']=function(_0x174b85,_0x8167f5){var _0x5f15fe={};var _0xf89bff=_[_0xb228('0x20')](db[_0xb228('0x21')][_0xb228('0x22')],function(_0x5f3cc2){return{'name':_0x5f3cc2[_0xb228('0x23')],'type':_0x5f3cc2[_0xb228('0x24')][_0xb228('0x25')]};});_0x5f15fe=qs[_0xb228('0x26')](_0xf89bff,_0x174b85);return interaction['findAll']('whatsapp',_0x174b85['query'],_0x174b85[_0xb228('0x27')],_0x5f15fe,_0xf89bff)[_0xb228('0x1a')](respondWithFilteredResult(_0x8167f5,_0x5f15fe))[_0xb228('0x28')](handleError(_0x8167f5,null));};exports[_0xb228('0x29')]=function(_0x3102ae,_0x21be18){var _0x2f78e6={'raw':![],'where':{'id':_0x3102ae[_0xb228('0x2a')]['id']}},_0x40464b={};_0x40464b[_0xb228('0x2b')]=_[_0xb228('0x2c')](db[_0xb228('0x21')][_0xb228('0x22')]);_0x40464b['query']=_[_0xb228('0x2c')](_0x3102ae[_0xb228('0x2d')]);_0x40464b['filters']=_[_0xb228('0x2e')](_0x40464b[_0xb228('0x2b')],_0x40464b[_0xb228('0x2d')]);_0x2f78e6[_0xb228('0x2f')]=_[_0xb228('0x2e')](_0x40464b[_0xb228('0x2b')],qs[_0xb228('0x30')](_0x3102ae['query']['fields']));_0x2f78e6[_0xb228('0x2f')]=_0x2f78e6[_0xb228('0x2f')][_0xb228('0x31')]?_0x2f78e6[_0xb228('0x2f')]:_0x40464b[_0xb228('0x2b')];if(_0x3102ae[_0xb228('0x2d')][_0xb228('0x32')]){_0x2f78e6[_0xb228('0x33')]=[{'all':!![]}];}_0x2f78e6=_[_0xb228('0x34')]({},_0x2f78e6,_0x3102ae['options']);return db[_0xb228('0x21')][_0xb228('0x35')](_0x2f78e6)[_0xb228('0x1a')](handleEntityNotFound(_0x21be18,null))[_0xb228('0x1a')](respondWithResult(_0x21be18,null))['catch'](handleError(_0x21be18,null));};exports[_0xb228('0x36')]=function(_0x1761a0,_0x43639d){return db['WhatsappInteraction'][_0xb228('0x36')](_0x1761a0[_0xb228('0x37')],{})[_0xb228('0x1a')](respondWithResult(_0x43639d,0xc9))['catch'](handleError(_0x43639d,null));};exports['update']=function(_0x82204a,_0x130cc0){if(_0x82204a['body']['id']){delete _0x82204a[_0xb228('0x37')]['id'];}return db[_0xb228('0x21')][_0xb228('0x35')]({'where':{'id':_0x82204a[_0xb228('0x2a')]['id']}})[_0xb228('0x1a')](handleEntityNotFound(_0x130cc0,null))['then'](saveUpdates(_0x82204a[_0xb228('0x37')],null))[_0xb228('0x1a')](respondWithResult(_0x130cc0,null))[_0xb228('0x28')](handleError(_0x130cc0,null));};exports[_0xb228('0x1b')]=function(_0x4974ac,_0x164147){return db['WhatsappInteraction'][_0xb228('0x35')]({'where':{'id':_0x4974ac[_0xb228('0x2a')]['id']}})[_0xb228('0x1a')](handleEntityNotFound(_0x164147,null))[_0xb228('0x1a')](removeEntity(_0x164147,null))[_0xb228('0x28')](handleError(_0x164147,null));};exports[_0xb228('0x38')]=function(_0x48c2c2,_0x2e5531){return db['WhatsappInteraction']['describe']()[_0xb228('0x1a')](respondWithResult(_0x2e5531,null))[_0xb228('0x28')](handleError(_0x2e5531,null));};exports['addMessage']=function(_0x188764,_0x1ffff7){return db[_0xb228('0x39')][_0xb228('0x35')]({'where':{'id':_0x188764[_0xb228('0x2a')]['id']}})[_0xb228('0x1a')](handleEntityNotFound(_0x1ffff7,null))[_0xb228('0x1a')](function(_0xe9094c){if(_0xe9094c){return _0xe9094c['addMessage'](_0x188764[_0xb228('0x37')]['ids'],_['omit'](_0x188764['body'],[_0xb228('0x3a'),'id'])||{});}})[_0xb228('0x1a')](respondWithResult(_0x1ffff7,null))[_0xb228('0x28')](handleError(_0x1ffff7,null));};exports[_0xb228('0x3b')]=function(_0x48ee57,_0xafa0a3){var _0x452391={'raw':![],'where':{}};var _0x2c1302={};var _0xe7400a={'count':0x0,'rows':[]};return db[_0xb228('0x21')][_0xb228('0x3c')]({'where':{'id':_0x48ee57['params']['id']}})[_0xb228('0x1a')](handleEntityNotFound(_0xafa0a3,null))[_0xb228('0x1a')](function(_0x18810c){if(_0x18810c){_0x2c1302[_0xb228('0x2b')]=_[_0xb228('0x2c')](db['WhatsappMessage'][_0xb228('0x22')]);_0x2c1302[_0xb228('0x2d')]=_[_0xb228('0x2c')](_0x48ee57[_0xb228('0x2d')]);_0x2c1302[_0xb228('0x3d')]=_[_0xb228('0x2e')](_0x2c1302[_0xb228('0x2b')],_0x2c1302['query']);_0x452391[_0xb228('0x2f')]=_[_0xb228('0x2e')](_0x2c1302[_0xb228('0x2b')],qs[_0xb228('0x30')](_0x48ee57[_0xb228('0x2d')][_0xb228('0x30')]));_0x452391[_0xb228('0x2f')]=_0x452391[_0xb228('0x2f')][_0xb228('0x31')]?_0x452391[_0xb228('0x2f')]:_0x2c1302['model'];if(!_0x48ee57[_0xb228('0x2d')][_0xb228('0x3e')](_0xb228('0x3f'))){_0x452391[_0xb228('0x15')]=qs[_0xb228('0x15')](_0x48ee57[_0xb228('0x2d')][_0xb228('0x15')]);_0x452391['offset']=qs[_0xb228('0x13')](_0x48ee57[_0xb228('0x2d')]['offset']);}_0x452391[_0xb228('0x40')]=qs[_0xb228('0x41')](_0x48ee57['query']['sort']);_0x452391[_0xb228('0x42')]=qs[_0xb228('0x3d')](_['pick'](_0x48ee57[_0xb228('0x2d')],_0x2c1302[_0xb228('0x3d')]));_0x452391[_0xb228('0x42')][_0xb228('0x43')]=_0x18810c['id'];if(_0x48ee57['query'][_0xb228('0x44')]){_0x452391['where']=_[_0xb228('0x34')](_0x452391[_0xb228('0x42')],{'$or':_[_0xb228('0x20')](_0x452391[_0xb228('0x2f')],function(_0x5e0d40){var _0xe55295={};_0xe55295[_0x5e0d40]={'$like':'%'+_0x48ee57[_0xb228('0x2d')][_0xb228('0x44')]+'%'};return _0xe55295;})});}if(_0x48ee57[_0xb228('0x2d')][_0xb228('0x45')]){var _0x469305=_0x48ee57['query'][_0xb228('0x45')][_0xb228('0x46')](',');var _0x428fab={};_0x428fab[_0x469305[0x0]]={'$gte':moment(_0x469305[0x1])[_0xb228('0x47')]('YYYY-MM-DD\x20HH:mm:ss')};_0x452391[_0xb228('0x42')]=_[_0xb228('0x34')](_0x452391['where'],_0x428fab);}_0x452391=_['merge']({},_0x452391,_0x48ee57[_0xb228('0x48')]);return db[_0xb228('0x39')]['count']({'where':_0x452391[_0xb228('0x42')]})[_0xb228('0x1a')](function(_0xfcde59){_0xe7400a[_0xb228('0x16')]=_0xfcde59;if(_0x48ee57[_0xb228('0x2d')]['includeAll']){_0x452391[_0xb228('0x33')]=[{'all':!![]}];}return db[_0xb228('0x39')]['findAll'](_0x452391);})['then'](function(_0x185799){_0xe7400a[_0xb228('0x49')]=_0x185799;return _0xe7400a;});}})['then'](respondWithFilteredResult(_0xafa0a3,_0x452391))[_0xb228('0x28')](handleError(_0xafa0a3,null));};exports[_0xb228('0x4a')]=function(_0x479afc,_0x1255a4){return db['WhatsappInteraction'][_0xb228('0x35')]({'where':{'id':_0x479afc['params']['id']}})[_0xb228('0x1a')](handleEntityNotFound(_0x1255a4,null))[_0xb228('0x1a')](function(_0x1b9c48){if(_0x1b9c48){return _0x1b9c48['setTags'](_0x479afc[_0xb228('0x37')][_0xb228('0x3a')],_[_0xb228('0x4b')](_0x479afc[_0xb228('0x37')],[_0xb228('0x3a'),'id'])||{})['spread'](function(){return db['Tag'][_0xb228('0x4c')]({'attributes':['id',_0xb228('0x1e'),_0xb228('0x4d')],'where':{'id':_0x479afc[_0xb228('0x37')]['ids']}});})['then'](function(_0x4cc582){socket[_0xb228('0x4e')](_0xb228('0x4f'),{'id':Number(_0x479afc[_0xb228('0x2a')]['id']),'tags':_0x4cc582||[]});return{'id':Number(_0x479afc[_0xb228('0x2a')]['id']),'tags':_0x4cc582||[]};});}})['then'](respondWithResult(_0x1255a4,null))[_0xb228('0x28')](handleError(_0x1255a4,null));};exports[_0xb228('0x50')]=function(_0x82e56d,_0x5f3439){return db[_0xb228('0x21')][_0xb228('0x35')]({'where':{'id':_0x82e56d['params']['id']}})['then'](handleEntityNotFound(_0x5f3439,null))['then'](function(_0x207498){if(_0x207498){return _0x207498['removeTags'](_0x82e56d['query']['ids']);}})[_0xb228('0x1a')](respondWithStatusCode(_0x5f3439,null))[_0xb228('0x28')](handleError(_0x5f3439,null));};exports['download']=function(_0x2acc76,_0x2abdbe){var _0x381996=moment()['unix']()[_0xb228('0x51')]();var _0x1b73d8=path['join'](config[_0xb228('0x52')],'server',_0xb228('0x53'),_0xb228('0x54'));var _0x57b59b=path[_0xb228('0x55')](config[_0xb228('0x52')],_0xb228('0x56'),'files','attachments');var _0x45fead=path[_0xb228('0x55')](_0x1b73d8,_0x381996);var _0xc44439=util[_0xb228('0x47')](_0xb228('0x57'),_0x2acc76['params']['id'],_0x381996);var _0x5b25bb=path[_0xb228('0x55')](_0x1b73d8,_0xc44439);var _0x2865db=[];_0x2865db['push']({'model':db[_0xb228('0x58')],'as':_0xb228('0x58'),'attributes':['id',_0xb228('0x59')],'raw':!![]});_0x2865db['push']({'model':db[_0xb228('0x5a')],'as':_0xb228('0x5b'),'attributes':['id','firstName',_0xb228('0x5c')],'raw':!![]});if(_0x2acc76['query']['attachments']){_0x2865db[_0xb228('0x5d')]({'model':db[_0xb228('0x5e')],'as':_0xb228('0x5e'),'raw':!![]});}var _0x137e66=[{'model':db['WhatsappMessage'],'as':'Messages','attributes':['id',_0xb228('0x37'),'createdAt',_0xb228('0x5f'),_0xb228('0x60'),_0xb228('0x61')],'include':_0x2865db}];_0x137e66[_0xb228('0x5d')]({'model':db[_0xb228('0x62')],'as':_0xb228('0x63'),'attributes':['id',_0xb228('0x1e')]});_0x137e66[_0xb228('0x5d')]({'model':db['User'],'as':_0xb228('0x64'),'attributes':['id',_0xb228('0x59')]});return db['WhatsappInteraction'][_0xb228('0x35')]({'where':{'id':_0x2acc76[_0xb228('0x2a')]['id']},'include':_0x137e66})[_0xb228('0x1a')](handleEntityNotFound(_0x2abdbe,null))['then'](function(_0x42af6a){if(_0x42af6a){var _0x69fb40=_0x42af6a[_0xb228('0x65')]({'plain':!![]});fs[_0xb228('0x66')](_0x45fead);var _0x1e3d96={'channel':'Whatsapp','account':_0x69fb40[_0xb228('0x63')][_0xb228('0x1e')],'agent':_0x69fb40[_0xb228('0x64')]?_0x69fb40[_0xb228('0x64')][_0xb228('0x59')]:_0xb228('0x67'),'createdAt':moment(_0x69fb40['createdAt'])[_0xb228('0x47')](_0xb228('0x68'))[_0xb228('0x51')](),'closedAt':_0x69fb40['closed']?moment(_0x69fb40[_0xb228('0x69')])['format'](_0xb228('0x68'))['toString']():'','disposition':_0x69fb40[_0xb228('0x6a')],'messages':_(_0x69fb40['Messages'])['filter']({'secret':![]})[_0xb228('0x20')](function(_0x689a1a){if(_0x689a1a[_0xb228('0x5e')]){var _0x5b9b5e=path['join'](_0x57b59b,_0x689a1a['Attachment'][_0xb228('0x6b')]);if(fs[_0xb228('0x6c')](_0x5b9b5e)){fs['createReadStream'](_0x5b9b5e)[_0xb228('0x6d')](fs['createWriteStream'](path[_0xb228('0x55')](_0x45fead,_0x689a1a[_0xb228('0x5e')]['basename'])));}}return{'date':moment(_0x689a1a[_0xb228('0x6e')])[_0xb228('0x47')]('YYYY-MM-DD\x20HH:mm:ss')[_0xb228('0x51')](),'sender':_0x689a1a[_0xb228('0x5f')]===_0xb228('0x6f')?_0x689a1a[_0xb228('0x58')]?_0x689a1a[_0xb228('0x58')][_0xb228('0x59')]:_0xb228('0x70'):_0x689a1a['Contact'][_0xb228('0x71')]+(_0x689a1a[_0xb228('0x5b')][_0xb228('0x5c')]?'\x20'+_0x689a1a['Contact']['lastName']:''),'body':_0x689a1a[_0xb228('0x5e')]?_0x689a1a['Attachment'][_0xb228('0x6b')]:_0x689a1a[_0xb228('0x37')],'direction':_0x689a1a[_0xb228('0x5f')]===_0xb228('0x6f')?'A':'C','secret':_0x689a1a[_0xb228('0x60')],'read':_0x689a1a[_0xb228('0x61')],'attachment':_0x689a1a[_0xb228('0x5e')]};})[_0xb228('0x72')]()};return ejs['renderFile'](path[_0xb228('0x55')](config[_0xb228('0x52')],_0xb228('0x56'),'views',_0xb228('0x73')),{'interaction':_0x1e3d96})['then'](function(_0x22f6a4){var _0x4ba9f=path[_0xb228('0x55')](_0x45fead,_0xb228('0x74')+_0x69fb40['id']+'-'+_0x381996+_0xb228('0x75'));var _0x30b9c9={'path':_0x4ba9f,'channel':_0xb228('0x76'),'interactionId':_0x69fb40['id']};return pdf[_0xb228('0x77')](_0x22f6a4,_0x30b9c9);})['then'](function(){return new BPromise(function(_0x4bd739,_0x9ef659){zipdir(_0x45fead,{'saveTo':_0x5b25bb},function(_0xe753a,_0x226b6b){if(_0xe753a)return _0x9ef659(_0xe753a);return _0x4bd739(_0x226b6b);});})[_0xb228('0x1a')](function(){return new BPromise(function(_0x5b1eff,_0xd36771){rimraf(_0x45fead,function(_0x1bc348){if(_0x1bc348)_0xd36771(_0x1bc348);return _0x5b1eff();});});})[_0xb228('0x1a')](function(){return _0x2abdbe['download'](_0x5b25bb,_0xc44439,function(_0x3cec57){if(_0x3cec57){console[_0xb228('0x78')]('err',_0x3cec57);}else{fs[_0xb228('0x79')](_0x5b25bb);}});});});}else{return _0x2abdbe[_0xb228('0xf')](0xc8);}})[_0xb228('0x28')](handleError(_0x2abdbe,null));}; \ No newline at end of file +var _0xfb9d=['length','includeAll','merge','options','find','create','body','params','describe','addMessage','WhatsappMessage','ids','omit','getMessages','findOne','rawAttributes','hasOwnProperty','order','sort','where','pick','WhatsappInteractionId','filter','$gte','format','rows','setTags','spread','Tag','color','whatsappInteractionTags:save','removeTags','download','unix','toString','join','root','server','files','attachments','transcript-%d-%s.zip','push','User','fullname','CmContact','Contact','firstName','lastName','Attachment','createdAt','secret','read','WhatsappAccount','Account','Owner','get','mkdirSync','Whatsapp','N.A.','YYYY-MM-DD\x20HH:mm:ss','closed','closedAt','Messages','createReadStream','createWriteStream','basename','out','System','direction','value','renderFile','views','downloadInteraction.ejs','transcript-','.pdf','log','err','rimraf','moment','bluebird','util','path','ejs','lodash','../../components/interaction/service','../../components/parsers/qs','../../components/export/pdf','api','../../config/environment','../../mysqldb','redis','./whatsappInteraction.socket','register','sendStatus','status','end','json','offset','undefined','limit','count','set','Content-Range','update','then','stack','name','send','index','map','WhatsappInteraction','fieldName','type','key','getOptions','findAll','whatsapp','query','catch','show','model','keys','filters','intersection','attributes','fields'];(function(_0x3f87ce,_0x4abd6c){var _0x8d7035=function(_0x5aa071){while(--_0x5aa071){_0x3f87ce['push'](_0x3f87ce['shift']());}};_0x8d7035(++_0x4abd6c);}(_0xfb9d,0xcb));var _0xdfb9=function(_0x54aa32,_0x386555){_0x54aa32=_0x54aa32-0x0;var _0x495907=_0xfb9d[_0x54aa32];return _0x495907;};'use strict';var rimraf=require(_0xdfb9('0x0'));var zipdir=require('zip-dir');var moment=require(_0xdfb9('0x1'));var BPromise=require(_0xdfb9('0x2'));var util=require(_0xdfb9('0x3'));var path=require(_0xdfb9('0x4'));var ejs=require(_0xdfb9('0x5'));var fs=require('fs');var _=require(_0xdfb9('0x6'));var Redis=require('ioredis');var interaction=require(_0xdfb9('0x7'));var qs=require(_0xdfb9('0x8'));var pdf=require(_0xdfb9('0x9'));var logger=require('../../config/logger')(_0xdfb9('0xa'));var config=require(_0xdfb9('0xb'));var db=require(_0xdfb9('0xc'))['db'];config[_0xdfb9('0xd')]=_['defaults'](config[_0xdfb9('0xd')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xdfb9('0xd')]));require(_0xdfb9('0xe'))[_0xdfb9('0xf')](socket);function respondWithStatusCode(_0x4ecf61,_0x1e9080){_0x1e9080=_0x1e9080||0xcc;return function(_0x3e6eac){if(_0x3e6eac){return _0x4ecf61[_0xdfb9('0x10')](_0x1e9080);}return _0x4ecf61[_0xdfb9('0x11')](_0x1e9080)[_0xdfb9('0x12')]();};}function respondWithResult(_0x279f36,_0x5b7b44){_0x5b7b44=_0x5b7b44||0xc8;return function(_0x26b3a3){if(_0x26b3a3){return _0x279f36[_0xdfb9('0x11')](_0x5b7b44)[_0xdfb9('0x13')](_0x26b3a3);}};}function respondWithFilteredResult(_0x115c07,_0x31e54b){return function(_0x5dc294){if(_0x5dc294){var _0x588231=typeof _0x31e54b[_0xdfb9('0x14')]===_0xdfb9('0x15')&&typeof _0x31e54b[_0xdfb9('0x16')]===_0xdfb9('0x15');var _0x3a1dd7=_0x5dc294[_0xdfb9('0x17')];var _0xb00eb4=_0x588231?0x0:_0x31e54b[_0xdfb9('0x14')];var _0x2d46a5=_0x588231?_0x5dc294[_0xdfb9('0x17')]:_0x31e54b['offset']+_0x31e54b[_0xdfb9('0x16')];var _0x15d56a;if(_0x2d46a5>=_0x3a1dd7){_0x2d46a5=_0x3a1dd7;_0x15d56a=0xc8;}else{_0x15d56a=0xce;}_0x115c07[_0xdfb9('0x11')](_0x15d56a);return _0x115c07[_0xdfb9('0x18')](_0xdfb9('0x19'),_0xb00eb4+'-'+_0x2d46a5+'/'+_0x3a1dd7)['json'](_0x5dc294);}return null;};}function saveUpdates(_0x5787c5){return function(_0xfaa9e6){if(_0xfaa9e6){return _0xfaa9e6[_0xdfb9('0x1a')](_0x5787c5)[_0xdfb9('0x1b')](function(_0x292227){return _0x292227;});}return null;};}function removeEntity(_0x407f45){return function(_0x2871e9){if(_0x2871e9){return _0x2871e9['destroy']()[_0xdfb9('0x1b')](function(){_0x407f45[_0xdfb9('0x11')](0xcc)[_0xdfb9('0x12')]();});}};}function handleEntityNotFound(_0x3f7826){return function(_0x286e7f){if(!_0x286e7f){_0x3f7826['sendStatus'](0x194);}return _0x286e7f;};}function handleError(_0x259e2e,_0x5ab92a){_0x5ab92a=_0x5ab92a||0x1f4;return function(_0x505f59){logger['error'](_0x505f59[_0xdfb9('0x1c')]);if(_0x505f59[_0xdfb9('0x1d')]){delete _0x505f59[_0xdfb9('0x1d')];}_0x259e2e[_0xdfb9('0x11')](_0x5ab92a)[_0xdfb9('0x1e')](_0x505f59);};}exports[_0xdfb9('0x1f')]=function(_0x491473,_0x10b714){var _0x2c0a73={};var _0x15c8f5=_[_0xdfb9('0x20')](db[_0xdfb9('0x21')]['rawAttributes'],function(_0x2b41c0){return{'name':_0x2b41c0[_0xdfb9('0x22')],'type':_0x2b41c0[_0xdfb9('0x23')][_0xdfb9('0x24')]};});_0x2c0a73=qs[_0xdfb9('0x25')](_0x15c8f5,_0x491473);return interaction[_0xdfb9('0x26')](_0xdfb9('0x27'),_0x491473[_0xdfb9('0x28')],_0x491473['user'],_0x2c0a73,_0x15c8f5)[_0xdfb9('0x1b')](respondWithFilteredResult(_0x10b714,_0x2c0a73))[_0xdfb9('0x29')](handleError(_0x10b714,null));};exports[_0xdfb9('0x2a')]=function(_0x226903,_0x462bfa){var _0x31f900={'raw':![],'where':{'id':_0x226903['params']['id']}},_0x27f569={};_0x27f569[_0xdfb9('0x2b')]=_[_0xdfb9('0x2c')](db[_0xdfb9('0x21')]['rawAttributes']);_0x27f569[_0xdfb9('0x28')]=_[_0xdfb9('0x2c')](_0x226903[_0xdfb9('0x28')]);_0x27f569[_0xdfb9('0x2d')]=_[_0xdfb9('0x2e')](_0x27f569[_0xdfb9('0x2b')],_0x27f569[_0xdfb9('0x28')]);_0x31f900[_0xdfb9('0x2f')]=_['intersection'](_0x27f569[_0xdfb9('0x2b')],qs[_0xdfb9('0x30')](_0x226903[_0xdfb9('0x28')][_0xdfb9('0x30')]));_0x31f900['attributes']=_0x31f900[_0xdfb9('0x2f')][_0xdfb9('0x31')]?_0x31f900['attributes']:_0x27f569[_0xdfb9('0x2b')];if(_0x226903[_0xdfb9('0x28')][_0xdfb9('0x32')]){_0x31f900['include']=[{'all':!![]}];}_0x31f900=_[_0xdfb9('0x33')]({},_0x31f900,_0x226903[_0xdfb9('0x34')]);return db[_0xdfb9('0x21')][_0xdfb9('0x35')](_0x31f900)[_0xdfb9('0x1b')](handleEntityNotFound(_0x462bfa,null))[_0xdfb9('0x1b')](respondWithResult(_0x462bfa,null))[_0xdfb9('0x29')](handleError(_0x462bfa,null));};exports[_0xdfb9('0x36')]=function(_0x12e4aa,_0x4d8f58){return db[_0xdfb9('0x21')][_0xdfb9('0x36')](_0x12e4aa[_0xdfb9('0x37')],{})[_0xdfb9('0x1b')](respondWithResult(_0x4d8f58,0xc9))[_0xdfb9('0x29')](handleError(_0x4d8f58,null));};exports[_0xdfb9('0x1a')]=function(_0x306a96,_0x4bc90a){if(_0x306a96[_0xdfb9('0x37')]['id']){delete _0x306a96[_0xdfb9('0x37')]['id'];}return db['WhatsappInteraction'][_0xdfb9('0x35')]({'where':{'id':_0x306a96[_0xdfb9('0x38')]['id']}})[_0xdfb9('0x1b')](handleEntityNotFound(_0x4bc90a,null))[_0xdfb9('0x1b')](saveUpdates(_0x306a96[_0xdfb9('0x37')],null))['then'](respondWithResult(_0x4bc90a,null))[_0xdfb9('0x29')](handleError(_0x4bc90a,null));};exports['destroy']=function(_0x573156,_0x1522aa){return db[_0xdfb9('0x21')][_0xdfb9('0x35')]({'where':{'id':_0x573156[_0xdfb9('0x38')]['id']}})[_0xdfb9('0x1b')](handleEntityNotFound(_0x1522aa,null))[_0xdfb9('0x1b')](removeEntity(_0x1522aa,null))[_0xdfb9('0x29')](handleError(_0x1522aa,null));};exports[_0xdfb9('0x39')]=function(_0x4bc331,_0x5ce48d){return db[_0xdfb9('0x21')][_0xdfb9('0x39')]()[_0xdfb9('0x1b')](respondWithResult(_0x5ce48d,null))['catch'](handleError(_0x5ce48d,null));};exports[_0xdfb9('0x3a')]=function(_0x2ed028,_0x102b3d){return db[_0xdfb9('0x3b')]['find']({'where':{'id':_0x2ed028['params']['id']}})[_0xdfb9('0x1b')](handleEntityNotFound(_0x102b3d,null))['then'](function(_0xf92cdc){if(_0xf92cdc){return _0xf92cdc[_0xdfb9('0x3a')](_0x2ed028['body'][_0xdfb9('0x3c')],_[_0xdfb9('0x3d')](_0x2ed028['body'],['ids','id'])||{});}})['then'](respondWithResult(_0x102b3d,null))['catch'](handleError(_0x102b3d,null));};exports[_0xdfb9('0x3e')]=function(_0x1c5898,_0x24bc0d){var _0x549587={'raw':![],'where':{}};var _0x20a7c9={};var _0x3cd54d={'count':0x0,'rows':[]};return db[_0xdfb9('0x21')][_0xdfb9('0x3f')]({'where':{'id':_0x1c5898[_0xdfb9('0x38')]['id']}})[_0xdfb9('0x1b')](handleEntityNotFound(_0x24bc0d,null))[_0xdfb9('0x1b')](function(_0x22166b){if(_0x22166b){_0x20a7c9[_0xdfb9('0x2b')]=_[_0xdfb9('0x2c')](db[_0xdfb9('0x3b')][_0xdfb9('0x40')]);_0x20a7c9['query']=_[_0xdfb9('0x2c')](_0x1c5898[_0xdfb9('0x28')]);_0x20a7c9[_0xdfb9('0x2d')]=_[_0xdfb9('0x2e')](_0x20a7c9[_0xdfb9('0x2b')],_0x20a7c9[_0xdfb9('0x28')]);_0x549587['attributes']=_['intersection'](_0x20a7c9[_0xdfb9('0x2b')],qs[_0xdfb9('0x30')](_0x1c5898['query'][_0xdfb9('0x30')]));_0x549587['attributes']=_0x549587['attributes'][_0xdfb9('0x31')]?_0x549587[_0xdfb9('0x2f')]:_0x20a7c9[_0xdfb9('0x2b')];if(!_0x1c5898[_0xdfb9('0x28')][_0xdfb9('0x41')]('nolimit')){_0x549587[_0xdfb9('0x16')]=qs[_0xdfb9('0x16')](_0x1c5898[_0xdfb9('0x28')][_0xdfb9('0x16')]);_0x549587[_0xdfb9('0x14')]=qs[_0xdfb9('0x14')](_0x1c5898['query']['offset']);}_0x549587[_0xdfb9('0x42')]=qs[_0xdfb9('0x43')](_0x1c5898[_0xdfb9('0x28')][_0xdfb9('0x43')]);_0x549587[_0xdfb9('0x44')]=qs['filters'](_[_0xdfb9('0x45')](_0x1c5898[_0xdfb9('0x28')],_0x20a7c9[_0xdfb9('0x2d')]));_0x549587[_0xdfb9('0x44')][_0xdfb9('0x46')]=_0x22166b['id'];if(_0x1c5898[_0xdfb9('0x28')][_0xdfb9('0x47')]){_0x549587[_0xdfb9('0x44')]=_[_0xdfb9('0x33')](_0x549587[_0xdfb9('0x44')],{'$or':_[_0xdfb9('0x20')](_0x549587[_0xdfb9('0x2f')],function(_0x4d7c52){var _0x2d9b9e={};_0x2d9b9e[_0x4d7c52]={'$like':'%'+_0x1c5898[_0xdfb9('0x28')][_0xdfb9('0x47')]+'%'};return _0x2d9b9e;})});}if(_0x1c5898[_0xdfb9('0x28')][_0xdfb9('0x48')]){var _0x36c4c0=_0x1c5898[_0xdfb9('0x28')][_0xdfb9('0x48')]['split'](',');var _0x24c648={};_0x24c648[_0x36c4c0[0x0]]={'$gte':moment(_0x36c4c0[0x1])[_0xdfb9('0x49')]('YYYY-MM-DD\x20HH:mm:ss')};_0x549587[_0xdfb9('0x44')]=_[_0xdfb9('0x33')](_0x549587[_0xdfb9('0x44')],_0x24c648);}_0x549587=_[_0xdfb9('0x33')]({},_0x549587,_0x1c5898[_0xdfb9('0x34')]);return db['WhatsappMessage']['count']({'where':_0x549587['where']})[_0xdfb9('0x1b')](function(_0x787e99){_0x3cd54d[_0xdfb9('0x17')]=_0x787e99;if(_0x1c5898['query'][_0xdfb9('0x32')]){_0x549587['include']=[{'all':!![]}];}return db[_0xdfb9('0x3b')]['findAll'](_0x549587);})[_0xdfb9('0x1b')](function(_0x3d4eba){_0x3cd54d[_0xdfb9('0x4a')]=_0x3d4eba;return _0x3cd54d;});}})[_0xdfb9('0x1b')](respondWithFilteredResult(_0x24bc0d,_0x549587))['catch'](handleError(_0x24bc0d,null));};exports['addTags']=function(_0x447bb7,_0x27722b){return db[_0xdfb9('0x21')][_0xdfb9('0x35')]({'where':{'id':_0x447bb7[_0xdfb9('0x38')]['id']}})['then'](handleEntityNotFound(_0x27722b,null))[_0xdfb9('0x1b')](function(_0x4421e3){if(_0x4421e3){return _0x4421e3[_0xdfb9('0x4b')](_0x447bb7['body'][_0xdfb9('0x3c')],_[_0xdfb9('0x3d')](_0x447bb7['body'],[_0xdfb9('0x3c'),'id'])||{})[_0xdfb9('0x4c')](function(){return db[_0xdfb9('0x4d')][_0xdfb9('0x26')]({'attributes':['id','name',_0xdfb9('0x4e')],'where':{'id':_0x447bb7[_0xdfb9('0x37')]['ids']}});})[_0xdfb9('0x1b')](function(_0x5e0351){socket['emit'](_0xdfb9('0x4f'),{'id':Number(_0x447bb7[_0xdfb9('0x38')]['id']),'tags':_0x5e0351||[]});return{'id':Number(_0x447bb7['params']['id']),'tags':_0x5e0351||[]};});}})[_0xdfb9('0x1b')](respondWithResult(_0x27722b,null))[_0xdfb9('0x29')](handleError(_0x27722b,null));};exports[_0xdfb9('0x50')]=function(_0x5012e0,_0x4580ae){return db[_0xdfb9('0x21')][_0xdfb9('0x35')]({'where':{'id':_0x5012e0[_0xdfb9('0x38')]['id']}})[_0xdfb9('0x1b')](handleEntityNotFound(_0x4580ae,null))[_0xdfb9('0x1b')](function(_0x21637d){if(_0x21637d){return _0x21637d[_0xdfb9('0x50')](_0x5012e0[_0xdfb9('0x28')]['ids']);}})[_0xdfb9('0x1b')](respondWithStatusCode(_0x4580ae,null))[_0xdfb9('0x29')](handleError(_0x4580ae,null));};exports[_0xdfb9('0x51')]=function(_0x1ac397,_0x11df66){var _0x102324=moment()[_0xdfb9('0x52')]()[_0xdfb9('0x53')]();var _0x15a797=path[_0xdfb9('0x54')](config[_0xdfb9('0x55')],_0xdfb9('0x56'),_0xdfb9('0x57'),'tmp');var _0x4caf5a=path[_0xdfb9('0x54')](config[_0xdfb9('0x55')],_0xdfb9('0x56'),_0xdfb9('0x57'),_0xdfb9('0x58'));var _0x2a7836=path[_0xdfb9('0x54')](_0x15a797,_0x102324);var _0x7bfd8f=util[_0xdfb9('0x49')](_0xdfb9('0x59'),_0x1ac397[_0xdfb9('0x38')]['id'],_0x102324);var _0x414f2b=path[_0xdfb9('0x54')](_0x15a797,_0x7bfd8f);var _0x3525a7=[];_0x3525a7[_0xdfb9('0x5a')]({'model':db[_0xdfb9('0x5b')],'as':'User','attributes':['id',_0xdfb9('0x5c')],'raw':!![]});_0x3525a7['push']({'model':db[_0xdfb9('0x5d')],'as':_0xdfb9('0x5e'),'attributes':['id',_0xdfb9('0x5f'),_0xdfb9('0x60')],'raw':!![]});if(_0x1ac397['query'][_0xdfb9('0x58')]){_0x3525a7['push']({'model':db[_0xdfb9('0x61')],'as':_0xdfb9('0x61'),'raw':!![]});}var _0x13f214=[{'model':db[_0xdfb9('0x3b')],'as':'Messages','attributes':['id',_0xdfb9('0x37'),_0xdfb9('0x62'),'direction',_0xdfb9('0x63'),_0xdfb9('0x64')],'include':_0x3525a7}];_0x13f214[_0xdfb9('0x5a')]({'model':db[_0xdfb9('0x65')],'as':_0xdfb9('0x66'),'attributes':['id','name']});_0x13f214[_0xdfb9('0x5a')]({'model':db[_0xdfb9('0x5b')],'as':_0xdfb9('0x67'),'attributes':['id',_0xdfb9('0x5c')]});return db[_0xdfb9('0x21')][_0xdfb9('0x35')]({'where':{'id':_0x1ac397[_0xdfb9('0x38')]['id']},'include':_0x13f214})[_0xdfb9('0x1b')](handleEntityNotFound(_0x11df66,null))[_0xdfb9('0x1b')](function(_0x9bf0ae){if(_0x9bf0ae){var _0x3b96ce=_0x9bf0ae[_0xdfb9('0x68')]({'plain':!![]});fs[_0xdfb9('0x69')](_0x2a7836);var _0xc6bfdf={'channel':_0xdfb9('0x6a'),'account':_0x3b96ce['Account']['name'],'agent':_0x3b96ce[_0xdfb9('0x67')]?_0x3b96ce[_0xdfb9('0x67')]['fullname']:_0xdfb9('0x6b'),'createdAt':moment(_0x3b96ce[_0xdfb9('0x62')])['format'](_0xdfb9('0x6c'))[_0xdfb9('0x53')](),'closedAt':_0x3b96ce[_0xdfb9('0x6d')]?moment(_0x3b96ce[_0xdfb9('0x6e')])[_0xdfb9('0x49')]('YYYY-MM-DD\x20HH:mm:ss')[_0xdfb9('0x53')]():'','disposition':_0x3b96ce['disposition'],'messages':_(_0x3b96ce[_0xdfb9('0x6f')])[_0xdfb9('0x47')]({'secret':![]})[_0xdfb9('0x20')](function(_0x8156ed){if(_0x8156ed['Attachment']){var _0x9ef7e8=path[_0xdfb9('0x54')](_0x4caf5a,_0x8156ed[_0xdfb9('0x61')]['basename']);if(fs['existsSync'](_0x9ef7e8)){fs[_0xdfb9('0x70')](_0x9ef7e8)['pipe'](fs[_0xdfb9('0x71')](path[_0xdfb9('0x54')](_0x2a7836,_0x8156ed[_0xdfb9('0x61')][_0xdfb9('0x72')])));}}return{'date':moment(_0x8156ed['createdAt'])[_0xdfb9('0x49')](_0xdfb9('0x6c'))[_0xdfb9('0x53')](),'sender':_0x8156ed['direction']===_0xdfb9('0x73')?_0x8156ed[_0xdfb9('0x5b')]?_0x8156ed[_0xdfb9('0x5b')]['fullname']:_0xdfb9('0x74'):_0x8156ed[_0xdfb9('0x5e')][_0xdfb9('0x5f')]+(_0x8156ed[_0xdfb9('0x5e')][_0xdfb9('0x60')]?'\x20'+_0x8156ed[_0xdfb9('0x5e')][_0xdfb9('0x60')]:''),'body':_0x8156ed[_0xdfb9('0x61')]?_0x8156ed[_0xdfb9('0x61')][_0xdfb9('0x72')]:_0x8156ed[_0xdfb9('0x37')],'direction':_0x8156ed[_0xdfb9('0x75')]==='out'?'A':'C','secret':_0x8156ed[_0xdfb9('0x63')],'read':_0x8156ed[_0xdfb9('0x64')],'attachment':_0x8156ed[_0xdfb9('0x61')]};})[_0xdfb9('0x76')]()};return ejs[_0xdfb9('0x77')](path[_0xdfb9('0x54')](config['root'],'server',_0xdfb9('0x78'),_0xdfb9('0x79')),{'interaction':_0xc6bfdf})[_0xdfb9('0x1b')](function(_0x3513ed){var _0x31ee80=path[_0xdfb9('0x54')](_0x2a7836,_0xdfb9('0x7a')+_0x3b96ce['id']+'-'+_0x102324+_0xdfb9('0x7b'));var _0x23993a={'path':_0x31ee80,'channel':_0xdfb9('0x6a'),'interactionId':_0x3b96ce['id']};return pdf['createPdfFromHTML'](_0x3513ed,_0x23993a);})[_0xdfb9('0x1b')](function(){return new BPromise(function(_0x685d2f,_0x9d5316){zipdir(_0x2a7836,{'saveTo':_0x414f2b},function(_0x591516,_0x2251c4){if(_0x591516)return _0x9d5316(_0x591516);return _0x685d2f(_0x2251c4);});})['then'](function(){return new BPromise(function(_0x1b2f63,_0x407590){rimraf(_0x2a7836,function(_0x1bea4e){if(_0x1bea4e)_0x407590(_0x1bea4e);return _0x1b2f63();});});})[_0xdfb9('0x1b')](function(){return _0x11df66[_0xdfb9('0x51')](_0x414f2b,_0x7bfd8f,function(_0x2e2b12){if(_0x2e2b12){console[_0xdfb9('0x7c')](_0xdfb9('0x7d'),_0x2e2b12);}else{fs['unlinkSync'](_0x414f2b);}});});});}else{return _0x11df66[_0xdfb9('0x10')](0xc8);}})['catch'](handleError(_0x11df66,null));}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.events.js b/server/api/whatsappInteraction/whatsappInteraction.events.js index f0c0ba8..68523b6 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 _0x7070=['emit','hasOwnProperty','exports','../../mysqldb','save','update','remove','map','findAll','then','setDataValue','unreadMessages','length'];(function(_0x44f5c5,_0x4b4eb6){var _0x589904=function(_0x2a06bb){while(--_0x2a06bb){_0x44f5c5['push'](_0x44f5c5['shift']());}};_0x589904(++_0x4b4eb6);}(_0x7070,0x1d7));var _0x0707=function(_0x2f610b,_0x405c00){_0x2f610b=_0x2f610b-0x0;var _0x7b9c95=_0x7070[_0x2f610b];return _0x7b9c95;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0x0707('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0x0707('0x0'))['db']['WhatsappMessage'];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents['setMaxListeners'](0x0);var events={'afterCreate':_0x0707('0x1'),'afterUpdate':_0x0707('0x2'),'afterDestroy':_0x0707('0x3')};function emitEvent(_0x878573){return function(_0x4b333a,_0x210102,_0x138a4){_0x4b333a['getUsers']({'attributes':['id'],'raw':!![]})['then'](function(_0x2e2dc0){_0x4b333a['setDataValue']('Users',_0x2e2dc0[_0x0707('0x4')](function(_0xacf92){return{'id':_0xacf92['id']};}));return WhatsappMessage[_0x0707('0x5')]({'where':{'WhatsappInteractionId':_0x4b333a['id'],'direction':'in','read':![]},'raw':!![]});})[_0x0707('0x6')](function(_0x8aa149){_0x4b333a[_0x0707('0x7')](_0x0707('0x8'),_0x8aa149[_0x0707('0x9')]);WhatsappInteractionEvents[_0x0707('0xa')](_0x878573+':'+_0x4b333a['id'],_0x4b333a);WhatsappInteractionEvents[_0x0707('0xa')](_0x878573,_0x4b333a);_0x138a4(null);})['catch'](_0x138a4(null));};}for(var e in events){if(events[_0x0707('0xb')](e)){var event=events[e];WhatsappInteraction['hook'](e,emitEvent(event));}}module[_0x0707('0xc')]=WhatsappInteractionEvents; \ No newline at end of file +var _0x4b8a=['remove','getUsers','then','setDataValue','map','findAll','unreadMessages','length','emit','catch','hasOwnProperty','hook','exports','../../mysqldb','WhatsappMessage','setMaxListeners','save','update'];(function(_0x7f9e2a,_0x356709){var _0x20af94=function(_0x2762ea){while(--_0x2762ea){_0x7f9e2a['push'](_0x7f9e2a['shift']());}};_0x20af94(++_0x356709);}(_0x4b8a,0xd3));var _0xa4b8=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x4b8a[_0x3dd15e];return _0x231fd0;};'use strict';var EventEmitter=require('events');var WhatsappInteraction=require(_0xa4b8('0x0'))['db']['WhatsappInteraction'];var WhatsappMessage=require(_0xa4b8('0x0'))['db'][_0xa4b8('0x1')];var WhatsappInteractionEvents=new EventEmitter();WhatsappInteractionEvents[_0xa4b8('0x2')](0x0);var events={'afterCreate':_0xa4b8('0x3'),'afterUpdate':_0xa4b8('0x4'),'afterDestroy':_0xa4b8('0x5')};function emitEvent(_0xb147cb){return function(_0x197758,_0x3691fc,_0x719605){_0x197758[_0xa4b8('0x6')]({'attributes':['id'],'raw':!![]})[_0xa4b8('0x7')](function(_0x455722){_0x197758[_0xa4b8('0x8')]('Users',_0x455722[_0xa4b8('0x9')](function(_0x2d96e9){return{'id':_0x2d96e9['id']};}));return WhatsappMessage[_0xa4b8('0xa')]({'where':{'WhatsappInteractionId':_0x197758['id'],'direction':'in','read':![]},'raw':!![]});})[_0xa4b8('0x7')](function(_0x1820e6){_0x197758[_0xa4b8('0x8')](_0xa4b8('0xb'),_0x1820e6[_0xa4b8('0xc')]);WhatsappInteractionEvents[_0xa4b8('0xd')](_0xb147cb+':'+_0x197758['id'],_0x197758);WhatsappInteractionEvents[_0xa4b8('0xd')](_0xb147cb,_0x197758);_0x719605(null);})[_0xa4b8('0xe')](_0x719605(null));};}for(var e in events){if(events[_0xa4b8('0xf')](e)){var event=events[e];WhatsappInteraction[_0xa4b8('0x10')](e,emitEvent(event));}}module[_0xa4b8('0x11')]=WhatsappInteractionEvents; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.model.js b/server/api/whatsappInteraction/whatsappInteraction.model.js index bc77d03..ce56698 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 _0x5063=['whatsapp_interactions','changed','closed','closedAt','YYYY-MM-DD\x20HH:mm:ss','lodash','api','moment','bluebird','request-promise','path','rimraf','exports','define'];(function(_0x199572,_0x33e667){var _0x13cfa3=function(_0x53c075){while(--_0x53c075){_0x199572['push'](_0x199572['shift']());}};_0x13cfa3(++_0x33e667);}(_0x5063,0xad));var _0x3506=function(_0x5b4640,_0x146a6d){_0x5b4640=_0x5b4640-0x0;var _0x1dbbe8=_0x5063[_0x5b4640];return _0x1dbbe8;};'use strict';var _=require(_0x3506('0x0'));var util=require('util');var logger=require('../../config/logger')(_0x3506('0x1'));var moment=require(_0x3506('0x2'));var BPromise=require(_0x3506('0x3'));var rp=require(_0x3506('0x4'));var fs=require('fs');var path=require(_0x3506('0x5'));var rimraf=require(_0x3506('0x6'));var config=require('../../config/environment');var attributes=require('./whatsappInteraction.attributes');module[_0x3506('0x7')]=function(_0x10e28e,_0x3c7343){return _0x10e28e[_0x3506('0x8')]('WhatsappInteraction',attributes,{'tableName':_0x3506('0x9'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x494146,_0x277e73,_0x374e24){if(_0x494146[_0x3506('0xa')](_0x3506('0xb'))){_0x494146[_0x3506('0xc')]=moment()['format'](_0x3506('0xd'));}_0x374e24(null,_0x494146);}}});}; \ No newline at end of file +var _0x266a=['moment','bluebird','request-promise','rimraf','./whatsappInteraction.attributes','exports','WhatsappInteraction','whatsapp_interactions','changed','closed','format','YYYY-MM-DD\x20HH:mm:ss','lodash','util','api'];(function(_0x64b09e,_0x20ddf4){var _0x3a64c3=function(_0x5295a7){while(--_0x5295a7){_0x64b09e['push'](_0x64b09e['shift']());}};_0x3a64c3(++_0x20ddf4);}(_0x266a,0x75));var _0xa266=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x266a[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xa266('0x0'));var util=require(_0xa266('0x1'));var logger=require('../../config/logger')(_0xa266('0x2'));var moment=require(_0xa266('0x3'));var BPromise=require(_0xa266('0x4'));var rp=require(_0xa266('0x5'));var fs=require('fs');var path=require('path');var rimraf=require(_0xa266('0x6'));var config=require('../../config/environment');var attributes=require(_0xa266('0x7'));module[_0xa266('0x8')]=function(_0x242f18,_0x498256){return _0x242f18['define'](_0xa266('0x9'),attributes,{'tableName':_0xa266('0xa'),'paranoid':![],'indexes':[],'timestamps':!![],'hooks':{'beforeUpdate':function(_0x3b6065,_0x4daa72,_0x12563c){if(_0x3b6065[_0xa266('0xb')](_0xa266('0xc'))){_0x3b6065['closedAt']=moment()[_0xa266('0xd')](_0xa266('0xe'));}_0x12563c(null,_0x3b6065);}}});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.rpc.js b/server/api/whatsappInteraction/whatsappInteraction.rpc.js index 4fb0525..66da203 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 _0x8edc=['AddTagsToWhatsappInteraction','addTags','omit','ids','spread','AddTags','lodash','util','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client','redis','defaults','localhost','socket.io-emitter','./whatsappInteraction.socket','request','then','info','request\x20sent','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappInteraction,\x20%s,\x20%s','message','result','catch','UpdateWhatsappInteraction','WhatsappInteraction','update','body','options','raw','where','attributes','limit','debug'];(function(_0x3de89b,_0x43abaa){var _0x1caad0=function(_0x450524){while(--_0x450524){_0x3de89b['push'](_0x3de89b['shift']());}};_0x1caad0(++_0x43abaa);}(_0x8edc,0x102));var _0xc8ed=function(_0x2b5eae,_0x55010d){_0x2b5eae=_0x2b5eae-0x0;var _0x5f3ac9=_0x8edc[_0x2b5eae];return _0x5f3ac9;};'use strict';var _=require(_0xc8ed('0x0'));var util=require(_0xc8ed('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0xc8ed('0x2'));var fs=require('fs');var Redis=require(_0xc8ed('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xc8ed('0x4'))(_0xc8ed('0x5'));var config=require(_0xc8ed('0x6'));var jayson=require(_0xc8ed('0x7'));var client=jayson[_0xc8ed('0x8')]['http']({'port':0x232a});config[_0xc8ed('0x9')]=_[_0xc8ed('0xa')](config['redis'],{'host':_0xc8ed('0xb'),'port':0x18eb});var socket=require(_0xc8ed('0xc'))(new Redis(config[_0xc8ed('0x9')]));require(_0xc8ed('0xd'))['register'](socket);function respondWithRpcPromise(_0x11b7a7,_0x4b5a7b,_0x4d74cd){return new BPromise(function(_0x3f15cc,_0x1b15dd){return client[_0xc8ed('0xe')](_0x11b7a7,_0x4d74cd)[_0xc8ed('0xf')](function(_0x30905a){logger[_0xc8ed('0x10')]('WhatsappInteraction,\x20%s,\x20%s',_0x4b5a7b,_0xc8ed('0x11'));logger['debug'](_0xc8ed('0x12'),_0x4b5a7b,_0xc8ed('0x11'),JSON[_0xc8ed('0x13')](_0x30905a));if(_0x30905a[_0xc8ed('0x14')]){if(_0x30905a[_0xc8ed('0x14')][_0xc8ed('0x15')]===0x1f4){logger['error'](_0xc8ed('0x16'),_0x4b5a7b,_0x30905a[_0xc8ed('0x14')][_0xc8ed('0x17')]);return _0x1b15dd(_0x30905a[_0xc8ed('0x14')]['message']);}logger[_0xc8ed('0x14')](_0xc8ed('0x16'),_0x4b5a7b,_0x30905a['error'][_0xc8ed('0x17')]);return _0x3f15cc(_0x30905a[_0xc8ed('0x14')]['message']);}else{logger[_0xc8ed('0x10')](_0xc8ed('0x16'),_0x4b5a7b,_0xc8ed('0x11'));_0x3f15cc(_0x30905a[_0xc8ed('0x18')][_0xc8ed('0x17')]);}})[_0xc8ed('0x19')](function(_0x418831){logger[_0xc8ed('0x14')](_0xc8ed('0x16'),_0x4b5a7b,_0x418831);_0x1b15dd(_0x418831);});});}exports[_0xc8ed('0x1a')]=function(_0x159132){var _0x5c3b1c=this;return new Promise(function(_0x3a0b38,_0x3808c0){return db[_0xc8ed('0x1b')][_0xc8ed('0x1c')](_0x159132[_0xc8ed('0x1d')],{'raw':_0x159132['options']?_0x159132[_0xc8ed('0x1e')][_0xc8ed('0x1f')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x159132['options']?_0x159132[_0xc8ed('0x1e')][_0xc8ed('0x20')]||null:null,'attributes':_0x159132[_0xc8ed('0x1e')]?_0x159132[_0xc8ed('0x1e')][_0xc8ed('0x21')]||null:null,'limit':_0x159132[_0xc8ed('0x1e')]?_0x159132[_0xc8ed('0x1e')][_0xc8ed('0x22')]||null:null})[_0xc8ed('0xf')](function(_0x406375){logger[_0xc8ed('0x10')](_0xc8ed('0x1a'),_0x159132);logger[_0xc8ed('0x23')]('UpdateWhatsappInteraction',_0x159132,JSON[_0xc8ed('0x13')](_0x406375));_0x3a0b38(_0x406375);})['catch'](function(_0x286431){logger[_0xc8ed('0x14')]('UpdateWhatsappInteraction',_0x286431[_0xc8ed('0x17')],_0x159132);_0x3808c0(_0x5c3b1c[_0xc8ed('0x14')](0x1f4,_0x286431[_0xc8ed('0x17')]));});});};exports[_0xc8ed('0x24')]=function(_0x3c0cd2){return new Promise(function(_0x44700e,_0x53186f){return db[_0xc8ed('0x1b')]['find']({'where':_0x3c0cd2['options']?_0x3c0cd2[_0xc8ed('0x1e')]['where']||null:null})[_0xc8ed('0xf')](function(_0x95149a){if(_0x95149a){return _0x95149a[_0xc8ed('0x25')](_0x3c0cd2[_0xc8ed('0x1d')]['ids'],_[_0xc8ed('0x26')](_0x3c0cd2[_0xc8ed('0x1d')],[_0xc8ed('0x27'),'id'])||{});}})[_0xc8ed('0x28')](function(_0x4c6c11){logger['info'](_0xc8ed('0x29'),_0x3c0cd2);logger[_0xc8ed('0x23')](_0xc8ed('0x29'),_0x3c0cd2,JSON[_0xc8ed('0x13')](_0x4c6c11));_0x44700e(_0x4c6c11);})[_0xc8ed('0x19')](function(_0x4142e1){logger[_0xc8ed('0x14')](_0xc8ed('0x29'),_0x4142e1[_0xc8ed('0x17')],_0x3c0cd2);_0x53186f(_this[_0xc8ed('0x14')](0x1f4,_0x4142e1[_0xc8ed('0x17')]));});});}; \ No newline at end of file +var _0x9ea5=['options','where','attributes','limit','catch','AddTagsToWhatsappInteraction','WhatsappInteraction','find','addTags','omit','body','ids','spread','AddTags','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','redis','./whatsappInteraction.socket','request','then','WhatsappInteraction,\x20%s,\x20%s','request\x20sent','debug','WhatsappInteraction,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','UpdateWhatsappInteraction','update'];(function(_0x384b00,_0x54a577){var _0x557c57=function(_0x244c28){while(--_0x244c28){_0x384b00['push'](_0x384b00['shift']());}};_0x557c57(++_0x54a577);}(_0x9ea5,0x1ee));var _0x59ea=function(_0x448760,_0x5a7ecb){_0x448760=_0x448760-0x0;var _0xf5ad39=_0x9ea5[_0x448760];return _0xf5ad39;};'use strict';var _=require(_0x59ea('0x0'));var util=require(_0x59ea('0x1'));var moment=require('moment');var BPromise=require(_0x59ea('0x2'));var rs=require(_0x59ea('0x3'));var fs=require('fs');var Redis=require(_0x59ea('0x4'));var db=require(_0x59ea('0x5'))['db'];var utils=require(_0x59ea('0x6'));var logger=require(_0x59ea('0x7'))(_0x59ea('0x8'));var config=require('../../config/environment');var jayson=require(_0x59ea('0x9'));var client=jayson[_0x59ea('0xa')]['http']({'port':0x232a});config[_0x59ea('0xb')]=_['defaults'](config[_0x59ea('0xb')],{'host':'localhost','port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));require(_0x59ea('0xc'))['register'](socket);function respondWithRpcPromise(_0x5a3db9,_0x37684a,_0x1e3e69){return new BPromise(function(_0x313ec2,_0x2c4dff){return client[_0x59ea('0xd')](_0x5a3db9,_0x1e3e69)[_0x59ea('0xe')](function(_0x1f2696){logger['info'](_0x59ea('0xf'),_0x37684a,_0x59ea('0x10'));logger[_0x59ea('0x11')](_0x59ea('0x12'),_0x37684a,_0x59ea('0x10'),JSON[_0x59ea('0x13')](_0x1f2696));if(_0x1f2696[_0x59ea('0x14')]){if(_0x1f2696[_0x59ea('0x14')][_0x59ea('0x15')]===0x1f4){logger[_0x59ea('0x14')](_0x59ea('0xf'),_0x37684a,_0x1f2696['error']['message']);return _0x2c4dff(_0x1f2696['error']['message']);}logger[_0x59ea('0x14')](_0x59ea('0xf'),_0x37684a,_0x1f2696['error'][_0x59ea('0x16')]);return _0x313ec2(_0x1f2696[_0x59ea('0x14')][_0x59ea('0x16')]);}else{logger[_0x59ea('0x17')](_0x59ea('0xf'),_0x37684a,_0x59ea('0x10'));_0x313ec2(_0x1f2696['result'][_0x59ea('0x16')]);}})['catch'](function(_0x5a4b09){logger[_0x59ea('0x14')](_0x59ea('0xf'),_0x37684a,_0x5a4b09);_0x2c4dff(_0x5a4b09);});});}exports[_0x59ea('0x18')]=function(_0x57fb94){var _0x320609=this;return new Promise(function(_0xdf86a0,_0x10273b){return db['WhatsappInteraction'][_0x59ea('0x19')](_0x57fb94['body'],{'raw':_0x57fb94[_0x59ea('0x1a')]?_0x57fb94[_0x59ea('0x1a')]['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x57fb94[_0x59ea('0x1a')]?_0x57fb94[_0x59ea('0x1a')][_0x59ea('0x1b')]||null:null,'attributes':_0x57fb94[_0x59ea('0x1a')]?_0x57fb94[_0x59ea('0x1a')][_0x59ea('0x1c')]||null:null,'limit':_0x57fb94[_0x59ea('0x1a')]?_0x57fb94['options'][_0x59ea('0x1d')]||null:null})[_0x59ea('0xe')](function(_0x120cff){logger[_0x59ea('0x17')](_0x59ea('0x18'),_0x57fb94);logger[_0x59ea('0x11')]('UpdateWhatsappInteraction',_0x57fb94,JSON['stringify'](_0x120cff));_0xdf86a0(_0x120cff);})[_0x59ea('0x1e')](function(_0x5c5011){logger[_0x59ea('0x14')](_0x59ea('0x18'),_0x5c5011[_0x59ea('0x16')],_0x57fb94);_0x10273b(_0x320609['error'](0x1f4,_0x5c5011[_0x59ea('0x16')]));});});};exports[_0x59ea('0x1f')]=function(_0x184814){return new Promise(function(_0x3ac069,_0x2515f2){return db[_0x59ea('0x20')][_0x59ea('0x21')]({'where':_0x184814[_0x59ea('0x1a')]?_0x184814[_0x59ea('0x1a')][_0x59ea('0x1b')]||null:null})[_0x59ea('0xe')](function(_0x1a0b77){if(_0x1a0b77){return _0x1a0b77[_0x59ea('0x22')](_0x184814['body']['ids'],_[_0x59ea('0x23')](_0x184814[_0x59ea('0x24')],[_0x59ea('0x25'),'id'])||{});}})[_0x59ea('0x26')](function(_0x5ceac9){logger['info'](_0x59ea('0x27'),_0x184814);logger[_0x59ea('0x11')](_0x59ea('0x27'),_0x184814,JSON[_0x59ea('0x13')](_0x5ceac9));_0x3ac069(_0x5ceac9);})['catch'](function(_0x57443f){logger[_0x59ea('0x14')](_0x59ea('0x27'),_0x57443f['message'],_0x184814);_0x2515f2(_this[_0x59ea('0x14')](0x1f4,_0x57443f[_0x59ea('0x16')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappInteraction/whatsappInteraction.socket.js b/server/api/whatsappInteraction/whatsappInteraction.socket.js index f145f66..b9579fb 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 _0x5579=['register','length','whatsappInteraction:','./whatsappInteraction.events','save','remove','update','emit','removeListener'];(function(_0x1ddedd,_0x485606){var _0xa3e1ac=function(_0x580444){while(--_0x580444){_0x1ddedd['push'](_0x1ddedd['shift']());}};_0xa3e1ac(++_0x485606);}(_0x5579,0x147));var _0x9557=function(_0x3d9f36,_0x3fdfbf){_0x3d9f36=_0x3d9f36-0x0;var _0x4a22ca=_0x5579[_0x3d9f36];return _0x4a22ca;};'use strict';var WhatsappInteractionEvents=require(_0x9557('0x0'));var events=[_0x9557('0x1'),_0x9557('0x2'),_0x9557('0x3')];function createListener(_0x211487,_0x255768){return function(_0x458959){_0x255768[_0x9557('0x4')](_0x211487,_0x458959);};}function removeListener(_0x587c4e,_0xb09018){return function(){WhatsappInteractionEvents[_0x9557('0x5')](_0x587c4e,_0xb09018);};}exports[_0x9557('0x6')]=function(_0x3a6a9c){for(var _0x36d708=0x0,_0x5ed2a8=events[_0x9557('0x7')];_0x36d708<_0x5ed2a8;_0x36d708++){var _0x15fc35=events[_0x36d708];var _0x3f11ce=createListener(_0x9557('0x8')+_0x15fc35,_0x3a6a9c);WhatsappInteractionEvents['on'](_0x15fc35,_0x3f11ce);}}; \ No newline at end of file +var _0x9953=['length','remove','update','emit','removeListener','register'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x9953,0x7f));var _0x3995=function(_0x2aee2f,_0xad9887){_0x2aee2f=_0x2aee2f-0x0;var _0x19337f=_0x9953[_0x2aee2f];return _0x19337f;};'use strict';var WhatsappInteractionEvents=require('./whatsappInteraction.events');var events=['save',_0x3995('0x0'),_0x3995('0x1')];function createListener(_0x582f3a,_0x565fee){return function(_0x3222f0){_0x565fee[_0x3995('0x2')](_0x582f3a,_0x3222f0);};}function removeListener(_0x3837ac,_0x5de987){return function(){WhatsappInteractionEvents[_0x3995('0x3')](_0x3837ac,_0x5de987);};}exports[_0x3995('0x4')]=function(_0x14369d){for(var _0x4caea1=0x0,_0x57c637=events[_0x3995('0x5')];_0x4caea1<_0x57c637;_0x4caea1++){var _0x12a188=events[_0x4caea1];var _0x169771=createListener('whatsappInteraction:'+_0x12a188,_0x14369d);WhatsappInteractionEvents['on'](_0x12a188,_0x169771);}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/index.js b/server/api/whatsappMessage/index.js index fc2d439..fe38aaa 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 _0x489f=['post','tracked','whatsapp','whatsappmessage:create','create','/:id/status','put','/:id/accept','accept','/:id/reject','reject','delete','destroy','multer','util','connect-timeout','express','Router','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappMessage.controller','get','isAuthenticated'];(function(_0x2c7dc6,_0x3c4ce0){var _0x10002b=function(_0x26f390){while(--_0x26f390){_0x2c7dc6['push'](_0x2c7dc6['shift']());}};_0x10002b(++_0x3c4ce0);}(_0x489f,0x18d));var _0xf489=function(_0x2e8776,_0x495c1){_0x2e8776=_0x2e8776-0x0;var _0x3e5b0b=_0x489f[_0x2e8776];return _0x3e5b0b;};'use strict';var multer=require(_0xf489('0x0'));var util=require(_0xf489('0x1'));var path=require('path');var timeout=require(_0xf489('0x2'));var express=require(_0xf489('0x3'));var router=express[_0xf489('0x4')]();var fs_extra=require('fs-extra');var auth=require(_0xf489('0x5'));var interaction=require(_0xf489('0x6'));var config=require(_0xf489('0x7'));var controller=require(_0xf489('0x8'));router[_0xf489('0x9')]('/',auth[_0xf489('0xa')](),controller['index']);router[_0xf489('0x9')]('/describe',auth[_0xf489('0xa')](),controller['describe']);router[_0xf489('0x9')]('/:id',auth[_0xf489('0xa')](),controller['show']);router[_0xf489('0xb')]('/',auth[_0xf489('0xa')](),interaction[_0xf489('0xc')](_0xf489('0xd'),_0xf489('0xe')),controller[_0xf489('0xf')]);router[_0xf489('0xb')](_0xf489('0x10'),controller['status']);router[_0xf489('0x11')]('/:id',auth[_0xf489('0xa')](),controller['update']);router[_0xf489('0x11')](_0xf489('0x12'),auth['isAuthenticated'](),controller[_0xf489('0x13')]);router[_0xf489('0x11')](_0xf489('0x14'),auth[_0xf489('0xa')](),controller[_0xf489('0x15')]);router[_0xf489('0x16')]('/:id',auth[_0xf489('0xa')](),controller[_0xf489('0x17')]);module['exports']=router; \ No newline at end of file +var _0x992e=['/:id/reject','reject','delete','destroy','exports','multer','util','path','connect-timeout','express','Router','../../components/auth/service','../../config/environment','./whatsappMessage.controller','isAuthenticated','index','get','/describe','describe','show','tracked','whatsapp','whatsappmessage:create','post','status','put','/:id','update','/:id/accept','accept'];(function(_0x215991,_0x1d3392){var _0x1ee492=function(_0x596514){while(--_0x596514){_0x215991['push'](_0x215991['shift']());}};_0x1ee492(++_0x1d3392);}(_0x992e,0x1c7));var _0xe992=function(_0x33c603,_0x6d0ce4){_0x33c603=_0x33c603-0x0;var _0xae96f4=_0x992e[_0x33c603];return _0xae96f4;};'use strict';var multer=require(_0xe992('0x0'));var util=require(_0xe992('0x1'));var path=require(_0xe992('0x2'));var timeout=require(_0xe992('0x3'));var express=require(_0xe992('0x4'));var router=express[_0xe992('0x5')]();var fs_extra=require('fs-extra');var auth=require(_0xe992('0x6'));var interaction=require('../../components/interaction/service');var config=require(_0xe992('0x7'));var controller=require(_0xe992('0x8'));router['get']('/',auth[_0xe992('0x9')](),controller[_0xe992('0xa')]);router[_0xe992('0xb')](_0xe992('0xc'),auth['isAuthenticated'](),controller[_0xe992('0xd')]);router[_0xe992('0xb')]('/:id',auth['isAuthenticated'](),controller[_0xe992('0xe')]);router['post']('/',auth[_0xe992('0x9')](),interaction[_0xe992('0xf')](_0xe992('0x10'),_0xe992('0x11')),controller['create']);router[_0xe992('0x12')]('/:id/status',controller[_0xe992('0x13')]);router[_0xe992('0x14')](_0xe992('0x15'),auth[_0xe992('0x9')](),controller[_0xe992('0x16')]);router[_0xe992('0x14')](_0xe992('0x17'),auth[_0xe992('0x9')](),controller[_0xe992('0x18')]);router[_0xe992('0x14')](_0xe992('0x19'),auth[_0xe992('0x9')](),controller[_0xe992('0x1a')]);router[_0xe992('0x1b')](_0xe992('0x15'),auth['isAuthenticated'](),controller[_0xe992('0x1c')]);module[_0xe992('0x1d')]=router; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.attributes.js b/server/api/whatsappMessage/whatsappMessage.attributes.js index ce5209e..f5498de 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 _0x9ee5=['medium','BOOLEAN','STRING','DATE','sequelize','exports','TEXT'];(function(_0x327473,_0x26d1cc){var _0x594ce7=function(_0x1fddf8){while(--_0x1fddf8){_0x327473['push'](_0x327473['shift']());}};_0x594ce7(++_0x26d1cc);}(_0x9ee5,0x123));var _0x59ee=function(_0x3899bd,_0x5159f5){_0x3899bd=_0x3899bd-0x0;var _0x46e569=_0x9ee5[_0x3899bd];return _0x46e569;};'use strict';var Sequelize=require(_0x59ee('0x0'));module[_0x59ee('0x1')]={'body':{'type':Sequelize[_0x59ee('0x2')](_0x59ee('0x3')),'allowNull':![]},'read':{'type':Sequelize[_0x59ee('0x4')],'defaultValue':![]},'direction':{'type':Sequelize['ENUM']('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize[_0x59ee('0x5')](0xbe)},'phone':{'type':Sequelize[_0x59ee('0x5')]},'readAt':{'type':Sequelize[_0x59ee('0x6')]},'secret':{'type':Sequelize[_0x59ee('0x4')],'defaultValue':![]},'providerName':{'type':Sequelize[_0x59ee('0x5')]},'providerResponse':{'type':Sequelize[_0x59ee('0x2')]}}; \ No newline at end of file +var _0x779e=['ENUM','STRING','DATE','sequelize','exports','TEXT','BOOLEAN'];(function(_0x45b829,_0x38277d){var _0x18d649=function(_0x414180){while(--_0x414180){_0x45b829['push'](_0x45b829['shift']());}};_0x18d649(++_0x38277d);}(_0x779e,0x137));var _0xe779=function(_0x4f9522,_0x399e9f){_0x4f9522=_0x4f9522-0x0;var _0x5a89a7=_0x779e[_0x4f9522];return _0x5a89a7;};'use strict';var Sequelize=require(_0xe779('0x0'));module[_0xe779('0x1')]={'body':{'type':Sequelize[_0xe779('0x2')]('medium'),'allowNull':![]},'read':{'type':Sequelize[_0xe779('0x3')],'defaultValue':![]},'direction':{'type':Sequelize[_0xe779('0x4')]('in','out'),'defaultValue':'out','allowNull':![]},'messageId':{'type':Sequelize['STRING'](0xbe)},'phone':{'type':Sequelize[_0xe779('0x5')]},'readAt':{'type':Sequelize[_0xe779('0x6')]},'secret':{'type':Sequelize[_0xe779('0x3')],'defaultValue':![]},'providerName':{'type':Sequelize[_0xe779('0x5')]},'providerResponse':{'type':Sequelize[_0xe779('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.controller.js b/server/api/whatsappMessage/whatsappMessage.controller.js index 5a1182a..8670e91 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 _0x71b2=['../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','client','http','then','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','sendStatus','status','end','json','offset','limit','undefined','count','reject','save','update','destroy','stack','name','index','map','WhatsappMessage','rawAttributes','fieldName','type','key','query','keys','filters','intersection','model','attributes','fields','length','hasOwnProperty','order','sort','where','pick','filter','merge','VIRTUAL','options','includeAll','include','catch','show','params','find','create','body','describe','whatsapp-interactions','whatsapp','read','format','YYYY-MM-DD\x20HH:mm:ss','UserId','user','agent','get','WhatsappInteraction','WhatsappInteractionId','isNil','read1stAt','interaction','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','role','null','AcceptMessage','acceptMessage','Sequelize','SELECT','contact','fullname','email','internal','interface','SIP/%s','channel','event','accept','EventManager','acceptmessage','RejectMessage','rejectMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','ContactId','sequelize','QueryTypes','User','WhatsppMessage,\x20%s,\x20%s,\x20%s','MessageSid','MessageStatus','WhatsappAccount,\x20%s,\x20%s,\x20%s','rimraf','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/license/hardware','../../config/logger'];(function(_0x264545,_0x214037){var _0x114d10=function(_0x9e3461){while(--_0x9e3461){_0x264545['push'](_0x264545['shift']());}};_0x114d10(++_0x214037);}(_0x71b2,0x17d));var _0x271b=function(_0x453704,_0xcf42a8){_0x453704=_0x453704-0x0;var _0x1d1ba5=_0x71b2[_0x453704];return _0x1d1ba5;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x271b('0x0'));var zipdir=require('zip-dir');var jsonpatch=require(_0x271b('0x1'));var rp=require(_0x271b('0x2'));var moment=require(_0x271b('0x3'));var BPromise=require(_0x271b('0x4'));var Mustache=require(_0x271b('0x5'));var util=require(_0x271b('0x6'));var path=require(_0x271b('0x7'));var sox=require(_0x271b('0x8'));var csv=require(_0x271b('0x9'));var ejs=require(_0x271b('0xa'));var fs=require('fs');var fs_extra=require(_0x271b('0xb'));var _=require(_0x271b('0xc'));var squel=require('squel');var crypto=require(_0x271b('0xd'));var jsforce=require('jsforce');var deskjs=require(_0x271b('0xe'));var toCsv=require(_0x271b('0x9'));var querystring=require(_0x271b('0xf'));var Papa=require(_0x271b('0x10'));var Redis=require(_0x271b('0x11'));var authService=require(_0x271b('0x12'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x271b('0x13'));var logger=require(_0x271b('0x14'))('api');var utils=require(_0x271b('0x15'));var config=require(_0x271b('0x16'));var licenseUtil=require(_0x271b('0x17'));var db=require(_0x271b('0x18'))['db'];config[_0x271b('0x19')]=_['defaults'](config[_0x271b('0x19')],{'host':_0x271b('0x1a'),'port':0x18eb});var socket=require(_0x271b('0x1b'))(new Redis(config['redis']));require(_0x271b('0x1c'))[_0x271b('0x1d')](socket);var jayson=require(_0x271b('0x1e'));var client=jayson[_0x271b('0x1f')]['http']({'port':0x232c});var client9002=jayson[_0x271b('0x1f')][_0x271b('0x20')]({'port':0x232a});function respondWithRpcPromise(_0x136cdc,_0x331b9c,_0x170bb6,_0x3250e4){return new BPromise(function(_0x9d3952,_0x3f07af){var _0x1cb31e=_0x3250e4||client;return _0x1cb31e['request'](_0x136cdc,_0x170bb6)[_0x271b('0x21')](function(_0x4417d1){logger['info'](_0x271b('0x22'),_0x331b9c,_0x271b('0x23'));logger[_0x271b('0x24')](_0x271b('0x25'),_0x331b9c,_0x271b('0x23'),JSON[_0x271b('0x26')](_0x4417d1));if(_0x4417d1[_0x271b('0x27')]){if(_0x4417d1[_0x271b('0x27')][_0x271b('0x28')]===0x1f4){logger['error'](_0x271b('0x22'),_0x331b9c,_0x4417d1[_0x271b('0x27')]['message']);return _0x3f07af(_0x4417d1['error'][_0x271b('0x29')]);}logger[_0x271b('0x27')](_0x271b('0x22'),_0x331b9c,_0x4417d1[_0x271b('0x27')][_0x271b('0x29')]);return _0x9d3952(_0x4417d1[_0x271b('0x27')][_0x271b('0x29')]);}else{logger[_0x271b('0x2a')](_0x271b('0x22'),_0x331b9c,'request\x20sent');_0x9d3952(_0x4417d1[_0x271b('0x2b')][_0x271b('0x29')]);}})['catch'](function(_0x286280){logger[_0x271b('0x27')](_0x271b('0x22'),_0x331b9c,_0x286280);_0x3f07af(_0x286280);});});}function respondWithStatusCode(_0x310bc5,_0x28c539){_0x28c539=_0x28c539||0xcc;return function(_0x11cb46){if(_0x11cb46){return _0x310bc5[_0x271b('0x2c')](_0x28c539);}return _0x310bc5[_0x271b('0x2d')](_0x28c539)[_0x271b('0x2e')]();};}function respondWithResult(_0x117db2,_0x470f05){_0x470f05=_0x470f05||0xc8;return function(_0x153986){if(_0x153986){return _0x117db2[_0x271b('0x2d')](_0x470f05)[_0x271b('0x2f')](_0x153986);}};}function respondWithFilteredResult(_0x40136f,_0x64b106){return function(_0x4b6f55){if(_0x4b6f55){var _0x896ad=typeof _0x64b106[_0x271b('0x30')]==='undefined'&&typeof _0x64b106[_0x271b('0x31')]===_0x271b('0x32');var _0xbd9554=_0x4b6f55[_0x271b('0x33')];var _0x33bff1=_0x896ad?0x0:_0x64b106[_0x271b('0x30')];var _0x2a7c7a=_0x896ad?_0x4b6f55['count']:_0x64b106[_0x271b('0x30')]+_0x64b106['limit'];var _0xc826e5;if(_0x2a7c7a>=_0xbd9554){_0x2a7c7a=_0xbd9554;_0xc826e5=0xc8;}else{_0xc826e5=0xce;}_0x40136f[_0x271b('0x2d')](_0xc826e5);return _0x40136f['set']('Content-Range',_0x33bff1+'-'+_0x2a7c7a+'/'+_0xbd9554)[_0x271b('0x2f')](_0x4b6f55);}return null;};}function patchUpdates(_0x32c920){return function(_0x1be269){try{jsonpatch['apply'](_0x1be269,_0x32c920,!![]);}catch(_0x1e1caf){return BPromise[_0x271b('0x34')](_0x1e1caf);}return _0x1be269[_0x271b('0x35')]();};}function saveUpdates(_0x4a104e,_0x4a647c){return function(_0x266f2f){if(_0x266f2f){return _0x266f2f[_0x271b('0x36')](_0x4a104e)['then'](function(_0x4b490b){return _0x4b490b;});}return null;};}function removeEntity(_0x34d4d4,_0x589468){return function(_0x3fe2b0){if(_0x3fe2b0){return _0x3fe2b0[_0x271b('0x37')]()[_0x271b('0x21')](function(){_0x34d4d4[_0x271b('0x2d')](0xcc)['end']();});}};}function handleEntityNotFound(_0x12b841,_0xfb7b35){return function(_0x29c7e0){if(!_0x29c7e0){_0x12b841['sendStatus'](0x194);}return _0x29c7e0;};}function handleError(_0x5ad867,_0x1c95df){_0x1c95df=_0x1c95df||0x1f4;return function(_0x369cf9){logger[_0x271b('0x27')](_0x369cf9[_0x271b('0x38')]);if(_0x369cf9[_0x271b('0x39')]){delete _0x369cf9[_0x271b('0x39')];}_0x5ad867[_0x271b('0x2d')](_0x1c95df)['send'](_0x369cf9);};}exports[_0x271b('0x3a')]=function(_0x973c44,_0x3a0e5b){var _0x1d136f={},_0x868954={},_0x9edd13={'count':0x0,'rows':[]};var _0x503458=_[_0x271b('0x3b')](db[_0x271b('0x3c')][_0x271b('0x3d')],function(_0x2b4f18){return{'name':_0x2b4f18[_0x271b('0x3e')],'type':_0x2b4f18[_0x271b('0x3f')][_0x271b('0x40')]};});_0x868954['model']=_[_0x271b('0x3b')](_0x503458,'name');_0x868954[_0x271b('0x41')]=_[_0x271b('0x42')](_0x973c44[_0x271b('0x41')]);_0x868954[_0x271b('0x43')]=_[_0x271b('0x44')](_0x868954[_0x271b('0x45')],_0x868954[_0x271b('0x41')]);_0x1d136f[_0x271b('0x46')]=_[_0x271b('0x44')](_0x868954[_0x271b('0x45')],qs[_0x271b('0x47')](_0x973c44[_0x271b('0x41')][_0x271b('0x47')]));_0x1d136f[_0x271b('0x46')]=_0x1d136f[_0x271b('0x46')][_0x271b('0x48')]?_0x1d136f[_0x271b('0x46')]:_0x868954[_0x271b('0x45')];if(!_0x973c44[_0x271b('0x41')][_0x271b('0x49')]('nolimit')){_0x1d136f[_0x271b('0x31')]=qs[_0x271b('0x31')](_0x973c44['query'][_0x271b('0x31')]);_0x1d136f[_0x271b('0x30')]=qs[_0x271b('0x30')](_0x973c44[_0x271b('0x41')]['offset']);}_0x1d136f[_0x271b('0x4a')]=qs[_0x271b('0x4b')](_0x973c44['query'][_0x271b('0x4b')]);_0x1d136f[_0x271b('0x4c')]=qs['filters'](_[_0x271b('0x4d')](_0x973c44['query'],_0x868954['filters']),_0x503458);if(_0x973c44['query'][_0x271b('0x4e')]){_0x1d136f[_0x271b('0x4c')]=_[_0x271b('0x4f')](_0x1d136f[_0x271b('0x4c')],{'$or':_[_0x271b('0x3b')](_0x503458,function(_0xa345dc){if(_0xa345dc['type']!==_0x271b('0x50')){var _0x2f4193={};_0x2f4193[_0xa345dc[_0x271b('0x39')]]={'$like':'%'+_0x973c44[_0x271b('0x41')]['filter']+'%'};return _0x2f4193;}})});}_0x1d136f=_[_0x271b('0x4f')]({},_0x1d136f,_0x973c44[_0x271b('0x51')]);var _0x59f6da={'where':_0x1d136f[_0x271b('0x4c')]};return db[_0x271b('0x3c')][_0x271b('0x33')](_0x59f6da)[_0x271b('0x21')](function(_0xfa7779){_0x9edd13[_0x271b('0x33')]=_0xfa7779;if(_0x973c44['query'][_0x271b('0x52')]){_0x1d136f[_0x271b('0x53')]=[{'all':!![]}];}return db['WhatsappMessage']['findAll'](_0x1d136f);})['then'](function(_0x46bcff){_0x9edd13['rows']=_0x46bcff;return _0x9edd13;})[_0x271b('0x21')](respondWithFilteredResult(_0x3a0e5b,_0x1d136f))[_0x271b('0x54')](handleError(_0x3a0e5b,null));};exports[_0x271b('0x55')]=function(_0x14ec2c,_0x5356eb){var _0x1c6b6={'raw':!![],'where':{'id':_0x14ec2c[_0x271b('0x56')]['id']}},_0x2c4fb7={};_0x2c4fb7[_0x271b('0x45')]=_[_0x271b('0x42')](db[_0x271b('0x3c')][_0x271b('0x3d')]);_0x2c4fb7[_0x271b('0x41')]=_['keys'](_0x14ec2c[_0x271b('0x41')]);_0x2c4fb7[_0x271b('0x43')]=_[_0x271b('0x44')](_0x2c4fb7[_0x271b('0x45')],_0x2c4fb7[_0x271b('0x41')]);_0x1c6b6[_0x271b('0x46')]=_['intersection'](_0x2c4fb7['model'],qs['fields'](_0x14ec2c[_0x271b('0x41')][_0x271b('0x47')]));_0x1c6b6[_0x271b('0x46')]=_0x1c6b6[_0x271b('0x46')][_0x271b('0x48')]?_0x1c6b6[_0x271b('0x46')]:_0x2c4fb7[_0x271b('0x45')];if(_0x14ec2c['query'][_0x271b('0x52')]){_0x1c6b6[_0x271b('0x53')]=[{'all':!![]}];}_0x1c6b6=_[_0x271b('0x4f')]({},_0x1c6b6,_0x14ec2c['options']);return db['WhatsappMessage'][_0x271b('0x57')](_0x1c6b6)['then'](handleEntityNotFound(_0x5356eb,null))[_0x271b('0x21')](respondWithResult(_0x5356eb,null))[_0x271b('0x54')](handleError(_0x5356eb,null));};exports[_0x271b('0x58')]=function(_0x3b840f,_0x3cc835){return db[_0x271b('0x3c')][_0x271b('0x58')](_0x3b840f[_0x271b('0x59')],{})['then'](respondWithResult(_0x3cc835,0xc9))[_0x271b('0x54')](handleError(_0x3cc835,null));};exports[_0x271b('0x36')]=function(_0xcf2b04,_0x9b0292){if(_0xcf2b04[_0x271b('0x59')]['id']){delete _0xcf2b04[_0x271b('0x59')]['id'];}return db['WhatsappMessage'][_0x271b('0x57')]({'where':{'id':_0xcf2b04[_0x271b('0x56')]['id']}})[_0x271b('0x21')](handleEntityNotFound(_0x9b0292,null))[_0x271b('0x21')](saveUpdates(_0xcf2b04[_0x271b('0x59')],null))[_0x271b('0x21')](respondWithResult(_0x9b0292,null))[_0x271b('0x54')](handleError(_0x9b0292,null));};exports[_0x271b('0x37')]=function(_0x3f9113,_0x32180c){return db['WhatsappMessage'][_0x271b('0x57')]({'where':{'id':_0x3f9113[_0x271b('0x56')]['id']}})[_0x271b('0x21')](handleEntityNotFound(_0x32180c,null))[_0x271b('0x21')](removeEntity(_0x32180c,null))[_0x271b('0x54')](handleError(_0x32180c,null));};exports[_0x271b('0x5a')]=function(_0x428163,_0x42f18d){return db[_0x271b('0x3c')][_0x271b('0x5a')]()['then'](respondWithResult(_0x42f18d,null))[_0x271b('0x54')](handleError(_0x42f18d,null));};var interaction_log=require(_0x271b('0x14'))(_0x271b('0x5b'));exports['accept']=function(_0x2e99ef,_0x5dc43f,_0x4adae1){var _0x5f1df6={'agent':{},'channel':_0x271b('0x5c')};if(_0x2e99ef[_0x271b('0x59')]['id']){delete _0x2e99ef[_0x271b('0x59')]['id'];}_0x2e99ef['body'][_0x271b('0x5d')]=!![];_0x2e99ef[_0x271b('0x59')]['readAt']=moment()[_0x271b('0x5e')](_0x271b('0x5f'));_0x2e99ef[_0x271b('0x59')]['UserId']=_0x2e99ef[_0x271b('0x59')][_0x271b('0x60')]||_0x2e99ef[_0x271b('0x61')]['id'];_0x5f1df6[_0x271b('0x62')]['id']=_0x2e99ef[_0x271b('0x59')][_0x271b('0x60')];return db[_0x271b('0x3c')][_0x271b('0x57')]({'where':{'id':_0x2e99ef[_0x271b('0x56')]['id'],'UserId':null}})[_0x271b('0x21')](handleEntityNotFound(_0x5dc43f,null))[_0x271b('0x21')](saveUpdates(_0x2e99ef[_0x271b('0x59')],null))[_0x271b('0x21')](function(_0x5778ee){if(_0x5778ee){_0x5f1df6[_0x271b('0x29')]=_0x5778ee[_0x271b('0x63')]({'plain':!![]});return db[_0x271b('0x64')][_0x271b('0x57')]({'where':{'id':_0x5778ee[_0x271b('0x65')]}});}return null;})[_0x271b('0x21')](handleEntityNotFound(_0x5dc43f,null))[_0x271b('0x21')](function(_0x39a6d1){if(_0x39a6d1){return _0x39a6d1['update']({'UserId':_0x2e99ef[_0x271b('0x59')][_0x271b('0x60')],'read1stAt':_[_0x271b('0x66')](_0x39a6d1[_0x271b('0x67')])?moment()[_0x271b('0x5e')]('YYYY-MM-DD\x20HH:mm:ss'):undefined});}return null;})[_0x271b('0x21')](function(_0x576e29){if(_0x576e29){_0x5f1df6[_0x271b('0x68')]=_0x576e29['get']({'plain':!![]});interaction_log[_0x271b('0x2a')](_0x271b('0x69'),_0x2e99ef[_0x271b('0x61')]['id'],_0x2e99ef[_0x271b('0x61')][_0x271b('0x39')],_0x2e99ef[_0x271b('0x61')][_0x271b('0x6a')],_0x5f1df6[_0x271b('0x68')]['id'],_0x2e99ef[_0x271b('0x59')]?JSON['stringify'](_0x2e99ef[_0x271b('0x59')]):_0x271b('0x6b'));return respondWithRpcPromise(_0x271b('0x6c'),_0x271b('0x6d'),_0x5f1df6);}return null;})[_0x271b('0x21')](function(_0x37e6ae){var _0x3b9ded='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x37e6ae[_0x271b('0x29')]['ContactId'];return db['sequelize'][_0x271b('0x41')](_0x3b9ded,{'type':db[_0x271b('0x6e')]['QueryTypes'][_0x271b('0x6f')],'raw':!![]})[_0x271b('0x21')](function(_0x259ef0){return _0x259ef0;});})[_0x271b('0x21')](function(_0x29efe7){if(_0x29efe7){_0x5f1df6[_0x271b('0x29')][_0x271b('0x70')]=_0x29efe7[0x0];if(!_0x2e99ef[_0x271b('0x59')][_0x271b('0x60')])return;return db['User'][_0x271b('0x57')]({'where':{'id':_0x2e99ef[_0x271b('0x59')]['UserId'],'role':_0x271b('0x62')},'attributes':['id',_0x271b('0x39'),_0x271b('0x71'),_0x271b('0x72'),_0x271b('0x73')],'raw':!![]});}return null;})[_0x271b('0x21')](function(_0x34795e){if(!_0x34795e)return null;_0x5f1df6[_0x271b('0x29')]['agent']=_0x34795e;return _0x5f1df6;})[_0x271b('0x21')](function(_0x556812){if(_0x556812){if(_0x2e99ef[_0x271b('0x59')]['manual']){_0x5f1df6[_0x271b('0x29')][_0x271b('0x74')]=util['format'](_0x271b('0x75'),_0x2e99ef[_0x271b('0x61')][_0x271b('0x39')]);_0x5f1df6[_0x271b('0x29')][_0x271b('0x76')]=_0x5f1df6['channel'];_0x5f1df6['message']['motionChannel']=_0x5f1df6[_0x271b('0x76')];_0x5f1df6['message'][_0x271b('0x77')]=_0x271b('0x78');return respondWithRpcPromise(_0x271b('0x79'),_0x271b('0x79'),{'event':_0x271b('0x7a'),'message':_0x5f1df6['message']},client9002)[_0x271b('0x21')](function(){return _0x5f1df6;});}return _0x5f1df6;}return null;})[_0x271b('0x21')](respondWithResult(_0x5dc43f,null))['catch'](handleError(_0x5dc43f,null));};var interaction_log=require(_0x271b('0x14'))(_0x271b('0x5b'));exports[_0x271b('0x34')]=function(_0x3aa17a,_0x1b6b76,_0x4975a0){var _0x2d5b7e={'agent':{},'channel':_0x271b('0x5c')};if(_0x3aa17a[_0x271b('0x59')]['id']){delete _0x3aa17a[_0x271b('0x59')]['id'];}_0x3aa17a[_0x271b('0x59')][_0x271b('0x60')]=_0x3aa17a['body'][_0x271b('0x60')]||_0x3aa17a[_0x271b('0x61')]['id'];_0x2d5b7e['agent']['id']=_0x3aa17a[_0x271b('0x59')][_0x271b('0x60')];return db[_0x271b('0x3c')][_0x271b('0x57')]({'where':{'id':_0x3aa17a[_0x271b('0x56')]['id'],'UserId':null}})[_0x271b('0x21')](handleEntityNotFound(_0x1b6b76,null))['then'](function(_0x244a8a){if(_0x244a8a){_0x2d5b7e['message']=_0x244a8a['get']({'plain':!![]});return db[_0x271b('0x64')]['find']({'where':{'id':_0x244a8a[_0x271b('0x65')]}});}return null;})[_0x271b('0x21')](handleEntityNotFound(_0x1b6b76,null))[_0x271b('0x21')](function(_0x330674){if(_0x330674){_0x2d5b7e[_0x271b('0x68')]=_0x330674[_0x271b('0x63')]({'plain':!![]});interaction_log[_0x271b('0x2a')]('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x3aa17a[_0x271b('0x61')]['id'],_0x3aa17a[_0x271b('0x61')][_0x271b('0x39')],_0x3aa17a['user'][_0x271b('0x6a')],_0x2d5b7e['interaction']['id'],_0x3aa17a[_0x271b('0x59')]?JSON['stringify'](_0x3aa17a[_0x271b('0x59')]):'null');return respondWithRpcPromise(_0x271b('0x7b'),_0x271b('0x7c'),_0x2d5b7e);}return null;})[_0x271b('0x21')](function(_0x560a88){var _0x4aa501=_0x271b('0x7d')+_0x560a88[_0x271b('0x29')][_0x271b('0x7e')];return db[_0x271b('0x7f')]['query'](_0x4aa501,{'type':db['Sequelize'][_0x271b('0x80')]['SELECT'],'raw':!![]})['then'](function(_0x3452fd){return _0x3452fd;});})['then'](function(_0x260884){if(_0x260884){_0x2d5b7e[_0x271b('0x29')][_0x271b('0x70')]=_0x260884[0x0];if(!_0x3aa17a['body'][_0x271b('0x60')])return;return db[_0x271b('0x81')]['find']({'where':{'id':_0x3aa17a[_0x271b('0x59')][_0x271b('0x60')],'role':_0x271b('0x62')},'attributes':['id',_0x271b('0x39'),_0x271b('0x71'),_0x271b('0x72'),_0x271b('0x73')],'raw':!![]});}return null;})[_0x271b('0x21')](function(_0x141242){if(!_0x141242)return null;_0x2d5b7e[_0x271b('0x29')]['agent']=_0x141242;return _0x2d5b7e;})[_0x271b('0x21')](function(_0x384a25){if(_0x384a25){_0x384a25['message'][_0x271b('0x74')]=util[_0x271b('0x5e')](_0x271b('0x75'),_0x3aa17a[_0x271b('0x61')]['name']);_0x384a25[_0x271b('0x29')][_0x271b('0x76')]=_0x2d5b7e[_0x271b('0x76')];_0x384a25[_0x271b('0x29')]['motionChannel']=_0x2d5b7e[_0x271b('0x76')];_0x384a25['message'][_0x271b('0x77')]='reject';respondWithRpcPromise(_0x271b('0x79'),'EventManager',{'event':'rejectmessage','message':_0x384a25[_0x271b('0x29')]},client9002);return _0x2d5b7e;}return null;})[_0x271b('0x21')](respondWithResult(_0x1b6b76,null))[_0x271b('0x54')](handleError(_0x1b6b76,null));};exports[_0x271b('0x2d')]=function(_0x287c0f,_0x4d8f0a,_0x3a3a7b){if(_0x287c0f[_0x271b('0x59')]['id']){delete _0x287c0f[_0x271b('0x59')]['id'];}var _0x7d1903;return db[_0x271b('0x3c')]['find']({'where':{'id':_0x287c0f[_0x271b('0x56')]['id']}})['then'](handleEntityNotFound(_0x4d8f0a,null))[_0x271b('0x21')](function(_0x52d63a){if(_0x52d63a){_0x7d1903=_0x52d63a;return db['WhatsappAccount']['find']({'where':{'id':_0x52d63a['WhatsappAccountId']}});}})[_0x271b('0x21')](handleEntityNotFound(_0x4d8f0a,null))[_0x271b('0x21')](function(_0x29bea1){if(_0x29bea1){logger[_0x271b('0x24')](_0x271b('0x82'),_0x271b('0x2d'),'received\x20delivery\x20report\x20from',_0x29bea1['type'],util['inspect'](_0x287c0f[_0x271b('0x59')],{'showHidden':![],'depth':null}));switch(_0x29bea1['type']){case'twilio':if(_0x287c0f[_0x271b('0x59')][_0x271b('0x83')]&&_0x287c0f[_0x271b('0x59')][_0x271b('0x83')]===_0x7d1903['messageId']&&_0x287c0f[_0x271b('0x59')][_0x271b('0x84')]&&_0x287c0f[_0x271b('0x59')][_0x271b('0x84')]===_0x271b('0x5d')){return _0x7d1903[_0x271b('0x36')]({'read':!![]});}else{logger[_0x271b('0x27')](_0x271b('0x85'),_0x271b('0x2d'),'twilio',util['inspect'](_0x287c0f['body'],{'showHidden':![],'depth':null}));}break;}return _0x7d1903;}})['then'](respondWithResult(_0x4d8f0a,null))[_0x271b('0x54')](handleError(_0x4d8f0a,null));}; \ No newline at end of file +var _0x4399=['json','undefined','count','offset','limit','status','reject','save','update','end','sendStatus','stack','name','send','index','WhatsappMessage','rawAttributes','fieldName','type','model','map','query','keys','filters','intersection','fields','attributes','hasOwnProperty','nolimit','order','where','pick','filter','merge','VIRTUAL','options','include','findAll','rows','show','params','length','includeAll','find','create','body','whatsapp-interactions','accept','format','YYYY-MM-DD\x20HH:mm:ss','UserId','get','WhatsappInteraction','WhatsappInteractionId','read1stAt','[WHATSAPPMESSAGE:ACCEPT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','user','role','interaction','null','AcceptMessage','acceptMessage','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','QueryTypes','SELECT','agent','fullname','manual','interface','SIP/%s','channel','motionChannel','event','EventManager','acceptmessage','RejectMessage','rejectMessage','ContactId','sequelize','Sequelize','contact','User','internal','rejectmessage','WhatsappAccount','WhatsappAccountId','WhatsppMessage,\x20%s,\x20%s,\x20%s','received\x20delivery\x20report\x20from','twilio','MessageSid','messageId','WhatsappAccount,\x20%s,\x20%s,\x20%s','inspect','eml-format','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','squel','crypto','jsforce','desk.js','querystring','papaparse','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappMessage.socket','register','jayson/promise','http','client','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch'];(function(_0x5aa339,_0x51c6a0){var _0x186950=function(_0x5df664){while(--_0x5df664){_0x5aa339['push'](_0x5aa339['shift']());}};_0x186950(++_0x51c6a0);}(_0x4399,0x175));var _0x9439=function(_0x486c6f,_0x4450fd){_0x486c6f=_0x486c6f-0x0;var _0x3e2bed=_0x4399[_0x486c6f];return _0x3e2bed;};'use strict';var emlformat=require(_0x9439('0x0'));var rimraf=require(_0x9439('0x1'));var zipdir=require(_0x9439('0x2'));var jsonpatch=require(_0x9439('0x3'));var rp=require('request-promise');var moment=require(_0x9439('0x4'));var BPromise=require(_0x9439('0x5'));var Mustache=require(_0x9439('0x6'));var util=require(_0x9439('0x7'));var path=require(_0x9439('0x8'));var sox=require(_0x9439('0x9'));var csv=require(_0x9439('0xa'));var ejs=require(_0x9439('0xb'));var fs=require('fs');var fs_extra=require(_0x9439('0xc'));var _=require('lodash');var squel=require(_0x9439('0xd'));var crypto=require(_0x9439('0xe'));var jsforce=require(_0x9439('0xf'));var deskjs=require(_0x9439('0x10'));var toCsv=require(_0x9439('0xa'));var querystring=require(_0x9439('0x11'));var Papa=require(_0x9439('0x12'));var Redis=require('ioredis');var authService=require('../../components/auth/service');var qs=require(_0x9439('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x9439('0x14'));var logger=require(_0x9439('0x15'))(_0x9439('0x16'));var utils=require(_0x9439('0x17'));var config=require(_0x9439('0x18'));var licenseUtil=require('../../config/license/util');var db=require(_0x9439('0x19'))['db'];config[_0x9439('0x1a')]=_[_0x9439('0x1b')](config['redis'],{'host':_0x9439('0x1c'),'port':0x18eb});var socket=require(_0x9439('0x1d'))(new Redis(config[_0x9439('0x1a')]));require(_0x9439('0x1e'))[_0x9439('0x1f')](socket);var jayson=require(_0x9439('0x20'));var client=jayson['client'][_0x9439('0x21')]({'port':0x232c});var client9002=jayson[_0x9439('0x22')]['http']({'port':0x232a});function respondWithRpcPromise(_0x53d575,_0x531bfc,_0x5081ef,_0x593e46){return new BPromise(function(_0x5a2add,_0x27b223){var _0x2701d8=_0x593e46||client;return _0x2701d8[_0x9439('0x23')](_0x53d575,_0x5081ef)[_0x9439('0x24')](function(_0x5a2a9d){logger[_0x9439('0x25')](_0x9439('0x26'),_0x531bfc,_0x9439('0x27'));logger[_0x9439('0x28')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0x531bfc,_0x9439('0x27'),JSON[_0x9439('0x29')](_0x5a2a9d));if(_0x5a2a9d['error']){if(_0x5a2a9d[_0x9439('0x2a')][_0x9439('0x2b')]===0x1f4){logger['error'](_0x9439('0x26'),_0x531bfc,_0x5a2a9d[_0x9439('0x2a')]['message']);return _0x27b223(_0x5a2a9d[_0x9439('0x2a')][_0x9439('0x2c')]);}logger[_0x9439('0x2a')](_0x9439('0x26'),_0x531bfc,_0x5a2a9d['error']['message']);return _0x5a2add(_0x5a2a9d[_0x9439('0x2a')]['message']);}else{logger['info'](_0x9439('0x26'),_0x531bfc,_0x9439('0x27'));_0x5a2add(_0x5a2a9d[_0x9439('0x2d')][_0x9439('0x2c')]);}})[_0x9439('0x2e')](function(_0x1c93fc){logger[_0x9439('0x2a')](_0x9439('0x26'),_0x531bfc,_0x1c93fc);_0x27b223(_0x1c93fc);});});}function respondWithStatusCode(_0x4ff1a2,_0x38a09c){_0x38a09c=_0x38a09c||0xcc;return function(_0x560781){if(_0x560781){return _0x4ff1a2['sendStatus'](_0x38a09c);}return _0x4ff1a2['status'](_0x38a09c)['end']();};}function respondWithResult(_0x2c40d4,_0x281b80){_0x281b80=_0x281b80||0xc8;return function(_0x56d2c8){if(_0x56d2c8){return _0x2c40d4['status'](_0x281b80)[_0x9439('0x2f')](_0x56d2c8);}};}function respondWithFilteredResult(_0x186eb7,_0x4f82bb){return function(_0x164461){if(_0x164461){var _0x36f016=typeof _0x4f82bb['offset']===_0x9439('0x30')&&typeof _0x4f82bb['limit']==='undefined';var _0x21c2b8=_0x164461[_0x9439('0x31')];var _0x591165=_0x36f016?0x0:_0x4f82bb[_0x9439('0x32')];var _0x72c0c2=_0x36f016?_0x164461['count']:_0x4f82bb[_0x9439('0x32')]+_0x4f82bb[_0x9439('0x33')];var _0x364069;if(_0x72c0c2>=_0x21c2b8){_0x72c0c2=_0x21c2b8;_0x364069=0xc8;}else{_0x364069=0xce;}_0x186eb7[_0x9439('0x34')](_0x364069);return _0x186eb7['set']('Content-Range',_0x591165+'-'+_0x72c0c2+'/'+_0x21c2b8)[_0x9439('0x2f')](_0x164461);}return null;};}function patchUpdates(_0x4795c4){return function(_0x56ae28){try{jsonpatch['apply'](_0x56ae28,_0x4795c4,!![]);}catch(_0x367192){return BPromise[_0x9439('0x35')](_0x367192);}return _0x56ae28[_0x9439('0x36')]();};}function saveUpdates(_0x4a7ec6,_0x1b3627){return function(_0x5c0659){if(_0x5c0659){return _0x5c0659[_0x9439('0x37')](_0x4a7ec6)[_0x9439('0x24')](function(_0x16ca7a){return _0x16ca7a;});}return null;};}function removeEntity(_0x34cc09,_0x206589){return function(_0x2d4ede){if(_0x2d4ede){return _0x2d4ede['destroy']()['then'](function(){_0x34cc09[_0x9439('0x34')](0xcc)[_0x9439('0x38')]();});}};}function handleEntityNotFound(_0x3cb6c3,_0xa29046){return function(_0xfe86b6){if(!_0xfe86b6){_0x3cb6c3[_0x9439('0x39')](0x194);}return _0xfe86b6;};}function handleError(_0x2acb99,_0x5db6ce){_0x5db6ce=_0x5db6ce||0x1f4;return function(_0x23ae65){logger[_0x9439('0x2a')](_0x23ae65[_0x9439('0x3a')]);if(_0x23ae65[_0x9439('0x3b')]){delete _0x23ae65['name'];}_0x2acb99[_0x9439('0x34')](_0x5db6ce)[_0x9439('0x3c')](_0x23ae65);};}exports[_0x9439('0x3d')]=function(_0x593c1d,_0x20fdee){var _0x1589fb={},_0x123004={},_0x2c13c5={'count':0x0,'rows':[]};var _0x22aed1=_['map'](db[_0x9439('0x3e')][_0x9439('0x3f')],function(_0x38f271){return{'name':_0x38f271[_0x9439('0x40')],'type':_0x38f271[_0x9439('0x41')]['key']};});_0x123004[_0x9439('0x42')]=_[_0x9439('0x43')](_0x22aed1,_0x9439('0x3b'));_0x123004[_0x9439('0x44')]=_[_0x9439('0x45')](_0x593c1d[_0x9439('0x44')]);_0x123004[_0x9439('0x46')]=_['intersection'](_0x123004[_0x9439('0x42')],_0x123004[_0x9439('0x44')]);_0x1589fb['attributes']=_[_0x9439('0x47')](_0x123004[_0x9439('0x42')],qs['fields'](_0x593c1d[_0x9439('0x44')][_0x9439('0x48')]));_0x1589fb[_0x9439('0x49')]=_0x1589fb[_0x9439('0x49')]['length']?_0x1589fb[_0x9439('0x49')]:_0x123004[_0x9439('0x42')];if(!_0x593c1d[_0x9439('0x44')][_0x9439('0x4a')](_0x9439('0x4b'))){_0x1589fb[_0x9439('0x33')]=qs['limit'](_0x593c1d[_0x9439('0x44')][_0x9439('0x33')]);_0x1589fb[_0x9439('0x32')]=qs[_0x9439('0x32')](_0x593c1d['query']['offset']);}_0x1589fb[_0x9439('0x4c')]=qs['sort'](_0x593c1d[_0x9439('0x44')]['sort']);_0x1589fb[_0x9439('0x4d')]=qs['filters'](_[_0x9439('0x4e')](_0x593c1d[_0x9439('0x44')],_0x123004['filters']),_0x22aed1);if(_0x593c1d[_0x9439('0x44')][_0x9439('0x4f')]){_0x1589fb[_0x9439('0x4d')]=_[_0x9439('0x50')](_0x1589fb[_0x9439('0x4d')],{'$or':_[_0x9439('0x43')](_0x22aed1,function(_0x364dbf){if(_0x364dbf[_0x9439('0x41')]!==_0x9439('0x51')){var _0x4f81e6={};_0x4f81e6[_0x364dbf[_0x9439('0x3b')]]={'$like':'%'+_0x593c1d[_0x9439('0x44')][_0x9439('0x4f')]+'%'};return _0x4f81e6;}})});}_0x1589fb=_[_0x9439('0x50')]({},_0x1589fb,_0x593c1d[_0x9439('0x52')]);var _0x545561={'where':_0x1589fb[_0x9439('0x4d')]};return db[_0x9439('0x3e')][_0x9439('0x31')](_0x545561)['then'](function(_0x4c9759){_0x2c13c5['count']=_0x4c9759;if(_0x593c1d['query']['includeAll']){_0x1589fb[_0x9439('0x53')]=[{'all':!![]}];}return db[_0x9439('0x3e')][_0x9439('0x54')](_0x1589fb);})[_0x9439('0x24')](function(_0x52372b){_0x2c13c5[_0x9439('0x55')]=_0x52372b;return _0x2c13c5;})[_0x9439('0x24')](respondWithFilteredResult(_0x20fdee,_0x1589fb))[_0x9439('0x2e')](handleError(_0x20fdee,null));};exports[_0x9439('0x56')]=function(_0x2a69ff,_0x35b880){var _0x4b196e={'raw':!![],'where':{'id':_0x2a69ff[_0x9439('0x57')]['id']}},_0x4039bd={};_0x4039bd[_0x9439('0x42')]=_[_0x9439('0x45')](db['WhatsappMessage']['rawAttributes']);_0x4039bd[_0x9439('0x44')]=_['keys'](_0x2a69ff[_0x9439('0x44')]);_0x4039bd[_0x9439('0x46')]=_[_0x9439('0x47')](_0x4039bd[_0x9439('0x42')],_0x4039bd[_0x9439('0x44')]);_0x4b196e[_0x9439('0x49')]=_[_0x9439('0x47')](_0x4039bd[_0x9439('0x42')],qs[_0x9439('0x48')](_0x2a69ff['query']['fields']));_0x4b196e[_0x9439('0x49')]=_0x4b196e[_0x9439('0x49')][_0x9439('0x58')]?_0x4b196e[_0x9439('0x49')]:_0x4039bd[_0x9439('0x42')];if(_0x2a69ff['query'][_0x9439('0x59')]){_0x4b196e[_0x9439('0x53')]=[{'all':!![]}];}_0x4b196e=_['merge']({},_0x4b196e,_0x2a69ff[_0x9439('0x52')]);return db[_0x9439('0x3e')][_0x9439('0x5a')](_0x4b196e)['then'](handleEntityNotFound(_0x35b880,null))[_0x9439('0x24')](respondWithResult(_0x35b880,null))[_0x9439('0x2e')](handleError(_0x35b880,null));};exports[_0x9439('0x5b')]=function(_0x47829a,_0x6d5703){return db[_0x9439('0x3e')]['create'](_0x47829a[_0x9439('0x5c')],{})[_0x9439('0x24')](respondWithResult(_0x6d5703,0xc9))[_0x9439('0x2e')](handleError(_0x6d5703,null));};exports['update']=function(_0xdbf710,_0xc84b2b){if(_0xdbf710[_0x9439('0x5c')]['id']){delete _0xdbf710[_0x9439('0x5c')]['id'];}return db[_0x9439('0x3e')][_0x9439('0x5a')]({'where':{'id':_0xdbf710['params']['id']}})[_0x9439('0x24')](handleEntityNotFound(_0xc84b2b,null))['then'](saveUpdates(_0xdbf710[_0x9439('0x5c')],null))[_0x9439('0x24')](respondWithResult(_0xc84b2b,null))['catch'](handleError(_0xc84b2b,null));};exports['destroy']=function(_0x15ebbd,_0xf710f5){return db['WhatsappMessage']['find']({'where':{'id':_0x15ebbd[_0x9439('0x57')]['id']}})['then'](handleEntityNotFound(_0xf710f5,null))[_0x9439('0x24')](removeEntity(_0xf710f5,null))[_0x9439('0x2e')](handleError(_0xf710f5,null));};exports['describe']=function(_0x25c638,_0x216fb9){return db[_0x9439('0x3e')]['describe']()[_0x9439('0x24')](respondWithResult(_0x216fb9,null))['catch'](handleError(_0x216fb9,null));};var interaction_log=require(_0x9439('0x15'))(_0x9439('0x5d'));exports[_0x9439('0x5e')]=function(_0x8cef8c,_0xf910d9,_0x36bee3){var _0x228d13={'agent':{},'channel':'whatsapp'};if(_0x8cef8c['body']['id']){delete _0x8cef8c[_0x9439('0x5c')]['id'];}_0x8cef8c[_0x9439('0x5c')]['read']=!![];_0x8cef8c[_0x9439('0x5c')]['readAt']=moment()[_0x9439('0x5f')](_0x9439('0x60'));_0x8cef8c[_0x9439('0x5c')][_0x9439('0x61')]=_0x8cef8c['body'][_0x9439('0x61')]||_0x8cef8c['user']['id'];_0x228d13['agent']['id']=_0x8cef8c[_0x9439('0x5c')][_0x9439('0x61')];return db['WhatsappMessage'][_0x9439('0x5a')]({'where':{'id':_0x8cef8c[_0x9439('0x57')]['id'],'UserId':null}})[_0x9439('0x24')](handleEntityNotFound(_0xf910d9,null))[_0x9439('0x24')](saveUpdates(_0x8cef8c[_0x9439('0x5c')],null))['then'](function(_0x1950bb){if(_0x1950bb){_0x228d13[_0x9439('0x2c')]=_0x1950bb[_0x9439('0x62')]({'plain':!![]});return db[_0x9439('0x63')][_0x9439('0x5a')]({'where':{'id':_0x1950bb[_0x9439('0x64')]}});}return null;})[_0x9439('0x24')](handleEntityNotFound(_0xf910d9,null))[_0x9439('0x24')](function(_0x219e5d){if(_0x219e5d){return _0x219e5d[_0x9439('0x37')]({'UserId':_0x8cef8c['body'][_0x9439('0x61')],'read1stAt':_['isNil'](_0x219e5d[_0x9439('0x65')])?moment()['format'](_0x9439('0x60')):undefined});}return null;})[_0x9439('0x24')](function(_0x50e03b){if(_0x50e03b){_0x228d13['interaction']=_0x50e03b[_0x9439('0x62')]({'plain':!![]});interaction_log[_0x9439('0x25')](_0x9439('0x66'),_0x8cef8c['user']['id'],_0x8cef8c['user']['name'],_0x8cef8c[_0x9439('0x67')][_0x9439('0x68')],_0x228d13[_0x9439('0x69')]['id'],_0x8cef8c[_0x9439('0x5c')]?JSON['stringify'](_0x8cef8c['body']):_0x9439('0x6a'));return respondWithRpcPromise(_0x9439('0x6b'),_0x9439('0x6c'),_0x228d13);}return null;})['then'](function(_0x582f53){var _0x33aa5c=_0x9439('0x6d')+_0x582f53['message']['ContactId'];return db['sequelize'][_0x9439('0x44')](_0x33aa5c,{'type':db['Sequelize'][_0x9439('0x6e')][_0x9439('0x6f')],'raw':!![]})[_0x9439('0x24')](function(_0x2ad0c4){return _0x2ad0c4;});})['then'](function(_0x483ae4){if(_0x483ae4){_0x228d13[_0x9439('0x2c')]['contact']=_0x483ae4[0x0];if(!_0x8cef8c[_0x9439('0x5c')]['UserId'])return;return db['User'][_0x9439('0x5a')]({'where':{'id':_0x8cef8c[_0x9439('0x5c')][_0x9439('0x61')],'role':_0x9439('0x70')},'attributes':['id',_0x9439('0x3b'),_0x9439('0x71'),'email','internal'],'raw':!![]});}return null;})[_0x9439('0x24')](function(_0x1fc31c){if(!_0x1fc31c)return null;_0x228d13['message'][_0x9439('0x70')]=_0x1fc31c;return _0x228d13;})[_0x9439('0x24')](function(_0x97c3a1){if(_0x97c3a1){if(_0x8cef8c[_0x9439('0x5c')][_0x9439('0x72')]){_0x228d13[_0x9439('0x2c')][_0x9439('0x73')]=util['format'](_0x9439('0x74'),_0x8cef8c[_0x9439('0x67')][_0x9439('0x3b')]);_0x228d13[_0x9439('0x2c')][_0x9439('0x75')]=_0x228d13[_0x9439('0x75')];_0x228d13[_0x9439('0x2c')][_0x9439('0x76')]=_0x228d13[_0x9439('0x75')];_0x228d13[_0x9439('0x2c')][_0x9439('0x77')]=_0x9439('0x5e');return respondWithRpcPromise(_0x9439('0x78'),_0x9439('0x78'),{'event':_0x9439('0x79'),'message':_0x228d13[_0x9439('0x2c')]},client9002)[_0x9439('0x24')](function(){return _0x228d13;});}return _0x228d13;}return null;})[_0x9439('0x24')](respondWithResult(_0xf910d9,null))[_0x9439('0x2e')](handleError(_0xf910d9,null));};var interaction_log=require(_0x9439('0x15'))('whatsapp-interactions');exports['reject']=function(_0x58c7ea,_0x4a678a,_0x1d4d82){var _0x492bb0={'agent':{},'channel':'whatsapp'};if(_0x58c7ea['body']['id']){delete _0x58c7ea[_0x9439('0x5c')]['id'];}_0x58c7ea[_0x9439('0x5c')][_0x9439('0x61')]=_0x58c7ea[_0x9439('0x5c')]['UserId']||_0x58c7ea['user']['id'];_0x492bb0[_0x9439('0x70')]['id']=_0x58c7ea[_0x9439('0x5c')][_0x9439('0x61')];return db[_0x9439('0x3e')][_0x9439('0x5a')]({'where':{'id':_0x58c7ea[_0x9439('0x57')]['id'],'UserId':null}})[_0x9439('0x24')](handleEntityNotFound(_0x4a678a,null))[_0x9439('0x24')](function(_0x495215){if(_0x495215){_0x492bb0['message']=_0x495215[_0x9439('0x62')]({'plain':!![]});return db[_0x9439('0x63')][_0x9439('0x5a')]({'where':{'id':_0x495215[_0x9439('0x64')]}});}return null;})['then'](handleEntityNotFound(_0x4a678a,null))[_0x9439('0x24')](function(_0x2204b5){if(_0x2204b5){_0x492bb0[_0x9439('0x69')]=_0x2204b5['get']({'plain':!![]});interaction_log['info']('[WHATSAPPMESSAGE:REJECT]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s',_0x58c7ea['user']['id'],_0x58c7ea[_0x9439('0x67')][_0x9439('0x3b')],_0x58c7ea[_0x9439('0x67')]['role'],_0x492bb0['interaction']['id'],_0x58c7ea[_0x9439('0x5c')]?JSON['stringify'](_0x58c7ea[_0x9439('0x5c')]):_0x9439('0x6a'));return respondWithRpcPromise(_0x9439('0x7a'),_0x9439('0x7b'),_0x492bb0);}return null;})[_0x9439('0x24')](function(_0x31369a){var _0x55b933=_0x9439('0x6d')+_0x31369a[_0x9439('0x2c')][_0x9439('0x7c')];return db[_0x9439('0x7d')][_0x9439('0x44')](_0x55b933,{'type':db[_0x9439('0x7e')][_0x9439('0x6e')][_0x9439('0x6f')],'raw':!![]})['then'](function(_0x2f9bc9){return _0x2f9bc9;});})['then'](function(_0x29c0bd){if(_0x29c0bd){_0x492bb0[_0x9439('0x2c')][_0x9439('0x7f')]=_0x29c0bd[0x0];if(!_0x58c7ea[_0x9439('0x5c')][_0x9439('0x61')])return;return db[_0x9439('0x80')][_0x9439('0x5a')]({'where':{'id':_0x58c7ea[_0x9439('0x5c')][_0x9439('0x61')],'role':'agent'},'attributes':['id',_0x9439('0x3b'),_0x9439('0x71'),'email',_0x9439('0x81')],'raw':!![]});}return null;})[_0x9439('0x24')](function(_0x13cace){if(!_0x13cace)return null;_0x492bb0[_0x9439('0x2c')]['agent']=_0x13cace;return _0x492bb0;})[_0x9439('0x24')](function(_0x1cdda1){if(_0x1cdda1){_0x1cdda1[_0x9439('0x2c')]['interface']=util[_0x9439('0x5f')](_0x9439('0x74'),_0x58c7ea[_0x9439('0x67')][_0x9439('0x3b')]);_0x1cdda1[_0x9439('0x2c')][_0x9439('0x75')]=_0x492bb0[_0x9439('0x75')];_0x1cdda1[_0x9439('0x2c')]['motionChannel']=_0x492bb0[_0x9439('0x75')];_0x1cdda1[_0x9439('0x2c')][_0x9439('0x77')]=_0x9439('0x35');respondWithRpcPromise('EventManager','EventManager',{'event':_0x9439('0x82'),'message':_0x1cdda1['message']},client9002);return _0x492bb0;}return null;})[_0x9439('0x24')](respondWithResult(_0x4a678a,null))['catch'](handleError(_0x4a678a,null));};exports[_0x9439('0x34')]=function(_0x50b98c,_0x345403,_0x5d475d){if(_0x50b98c[_0x9439('0x5c')]['id']){delete _0x50b98c['body']['id'];}var _0x11f2bd;return db[_0x9439('0x3e')][_0x9439('0x5a')]({'where':{'id':_0x50b98c[_0x9439('0x57')]['id']}})[_0x9439('0x24')](handleEntityNotFound(_0x345403,null))['then'](function(_0x4cfc58){if(_0x4cfc58){_0x11f2bd=_0x4cfc58;return db[_0x9439('0x83')][_0x9439('0x5a')]({'where':{'id':_0x4cfc58[_0x9439('0x84')]}});}})['then'](handleEntityNotFound(_0x345403,null))[_0x9439('0x24')](function(_0x17d7d4){if(_0x17d7d4){logger['debug'](_0x9439('0x85'),_0x9439('0x34'),_0x9439('0x86'),_0x17d7d4[_0x9439('0x41')],util['inspect'](_0x50b98c[_0x9439('0x5c')],{'showHidden':![],'depth':null}));switch(_0x17d7d4[_0x9439('0x41')]){case _0x9439('0x87'):if(_0x50b98c['body'][_0x9439('0x88')]&&_0x50b98c[_0x9439('0x5c')][_0x9439('0x88')]===_0x11f2bd[_0x9439('0x89')]&&_0x50b98c['body']['MessageStatus']&&_0x50b98c[_0x9439('0x5c')]['MessageStatus']==='read'){return _0x11f2bd[_0x9439('0x37')]({'read':!![]});}else{logger[_0x9439('0x2a')](_0x9439('0x8a'),_0x9439('0x34'),'twilio',util[_0x9439('0x8b')](_0x50b98c[_0x9439('0x5c')],{'showHidden':![],'depth':null}));}break;}return _0x11f2bd;}})['then'](respondWithResult(_0x345403,null))['catch'](handleError(_0x345403,null));}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.events.js b/server/api/whatsappMessage/whatsappMessage.events.js index 04a5c85..c8aeaa2 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 _0xd757=['setMaxListeners','remove','emit','hook','exports','events','../../mysqldb','WhatsappMessage'];(function(_0x321077,_0x59935a){var _0x121987=function(_0x489ac3){while(--_0x489ac3){_0x321077['push'](_0x321077['shift']());}};_0x121987(++_0x59935a);}(_0xd757,0x1e5));var _0x7d75=function(_0x5273d8,_0xce5fe3){_0x5273d8=_0x5273d8-0x0;var _0x56be6e=_0xd757[_0x5273d8];return _0x56be6e;};'use strict';var EventEmitter=require(_0x7d75('0x0'));var WhatsappMessage=require(_0x7d75('0x1'))['db'][_0x7d75('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents[_0x7d75('0x3')](0x0);var events={'afterCreate':'save','afterUpdate':'update','afterDestroy':_0x7d75('0x4')};function emitEvent(_0x2772a3){return function(_0x5e4a4c,_0xa7df66,_0x10d11a){WhatsappMessageEvents[_0x7d75('0x5')](_0x2772a3+':'+_0x5e4a4c['id'],_0x5e4a4c);WhatsappMessageEvents['emit'](_0x2772a3,_0x5e4a4c);_0x10d11a(null);};}for(var e in events){if(events['hasOwnProperty'](e)){var event=events[e];WhatsappMessage[_0x7d75('0x6')](e,emitEvent(event));}}module[_0x7d75('0x7')]=WhatsappMessageEvents; \ No newline at end of file +var _0xc29b=['emit','hasOwnProperty','hook','exports','events','../../mysqldb','WhatsappMessage','save','update'];(function(_0x6a7421,_0x20b4f5){var _0x33f5d1=function(_0x2714a4){while(--_0x2714a4){_0x6a7421['push'](_0x6a7421['shift']());}};_0x33f5d1(++_0x20b4f5);}(_0xc29b,0x12d));var _0xbc29=function(_0x5652,_0x2ab355){_0x5652=_0x5652-0x0;var _0x21eb42=_0xc29b[_0x5652];return _0x21eb42;};'use strict';var EventEmitter=require(_0xbc29('0x0'));var WhatsappMessage=require(_0xbc29('0x1'))['db'][_0xbc29('0x2')];var WhatsappMessageEvents=new EventEmitter();WhatsappMessageEvents['setMaxListeners'](0x0);var events={'afterCreate':_0xbc29('0x3'),'afterUpdate':_0xbc29('0x4'),'afterDestroy':'remove'};function emitEvent(_0x3032cb){return function(_0x294a45,_0x217922,_0xa365e8){WhatsappMessageEvents[_0xbc29('0x5')](_0x3032cb+':'+_0x294a45['id'],_0x294a45);WhatsappMessageEvents[_0xbc29('0x5')](_0x3032cb,_0x294a45);_0xa365e8(null);};}for(var e in events){if(events[_0xbc29('0x6')](e)){var event=events[e];WhatsappMessage[_0xbc29('0x7')](e,emitEvent(event));}}module[_0xbc29('0x8')]=WhatsappMessageEvents; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.model.js b/server/api/whatsappMessage/whatsappMessage.model.js index a74bcdb..d1c32b3 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 _0xa27f=['/whatsapp/v1/','/messages/','POST','application/json','message_id','statuses','err','WhatsappMessage,\x20%s','lodash','util','api','bluebird','request-promise','rimraf','../../config/environment','./whatsappMessage.attributes','exports','define','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','direction','toLowerCase','secret','isNil','WhatsappInteraction','findOne','then','update','createdAt','catch','error','WhatsappAccount','WhatsappAccountId','type','twilio','accountSid','authToken','phone','messages','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','sid','WhatsappMessage,\x20%s,\x20%s,\x20%s','afterCreate','inspect','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','sinch','baseUrl'];(function(_0x40a6af,_0x6714bf){var _0x5314a5=function(_0x3f1cf8){while(--_0x3f1cf8){_0x40a6af['push'](_0x40a6af['shift']());}};_0x5314a5(++_0x6714bf);}(_0xa27f,0x76));var _0xfa27=function(_0xcaf028,_0x27002a){_0xcaf028=_0xcaf028-0x0;var _0x1fa0f7=_0xa27f[_0xcaf028];return _0x1fa0f7;};'use strict';var _=require(_0xfa27('0x0'));var util=require(_0xfa27('0x1'));var logger=require('../../config/logger')(_0xfa27('0x2'));var moment=require('moment');var BPromise=require(_0xfa27('0x3'));var rp=require(_0xfa27('0x4'));var fetch=require('node-fetch');var fs=require('fs');var path=require('path');var rimraf=require(_0xfa27('0x5'));var config=require(_0xfa27('0x6'));var attributes=require(_0xfa27('0x7'));module[_0xfa27('0x8')]=function(_0x40e570,_0x212696){return _0x40e570[_0xfa27('0x9')]('WhatsappMessage',attributes,{'tableName':_0xfa27('0xa'),'paranoid':![],'indexes':[{'name':_0xfa27('0xb'),'fields':[_0xfa27('0xb')]},{'name':_0xfa27('0xc'),'fields':[_0xfa27('0xd')],'type':_0xfa27('0xe')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x4b099c,_0x53d9bb,_0x200ab8){var _0x2fab36=_0x40e570[_0xfa27('0xf')];var _0x2fedfc=_0x4b099c['get']({'plain':!![]});if(_0x2fedfc[_0xfa27('0x10')][_0xfa27('0x11')]()==='in'||_0x2fedfc[_0xfa27('0x10')][_0xfa27('0x11')]()==='out'&&!_0x2fedfc[_0xfa27('0x12')]&&!_[_0xfa27('0x13')](_0x2fedfc['UserId'])){_0x2fab36[_0xfa27('0x14')][_0xfa27('0x15')]({'where':{'id':_0x2fedfc['WhatsappInteractionId']}})[_0xfa27('0x16')](function(_0x404ca0){if(_0x404ca0){_0x404ca0[_0xfa27('0x17')]({'lastMsgAt':_0x2fedfc[_0xfa27('0x18')],'lastMsgDirection':_0x2fedfc[_0xfa27('0x10')][_0xfa27('0x11')]()});}})[_0xfa27('0x19')](function(_0x25f821){console[_0xfa27('0x1a')](_0x25f821);});}if(_0x2fedfc[_0xfa27('0x10')]==='out'&&!_0x2fedfc[_0xfa27('0x12')]){var _0x435f1b;_0x2fab36[_0xfa27('0x1b')]['find']({'where':{'id':_0x2fedfc[_0xfa27('0x1c')]},'raw':!![]})[_0xfa27('0x16')](function(_0x4e2812){_0x435f1b=_0x4e2812;if(_0x435f1b&&_0x435f1b[_0xfa27('0x1d')]){switch(_0x435f1b[_0xfa27('0x1d')]){case _0xfa27('0x1e'):var _0x5c5b38=require(_0xfa27('0x1e'));if(_0x435f1b[_0xfa27('0x1f')]&&_0x435f1b[_0xfa27('0x20')]&&_0x435f1b[_0xfa27('0x21')]){var _0x4ac256=new _0x5c5b38(_0x435f1b[_0xfa27('0x1f')],_0x435f1b[_0xfa27('0x20')]);_0x4ac256[_0xfa27('0x22')]['create']({'body':_0x2fedfc['body'],'to':_0xfa27('0x23')+_0x2fedfc[_0xfa27('0x21')],'from':_0xfa27('0x23')+_0x435f1b[_0xfa27('0x21')],'statusCallback':_0x435f1b[_0xfa27('0x24')]+_0xfa27('0x25')+_0x2fedfc['id']+_0xfa27('0x26')+_0x435f1b[_0xfa27('0x27')]})[_0xfa27('0x16')](function(_0x3ec3b8){if(_0x3ec3b8[_0xfa27('0x28')]){return _0x4b099c['update']({'messageId':_0x3ec3b8[_0xfa27('0x28')]});}})[_0xfa27('0x19')](function(_0xff67d8){logger[_0xfa27('0x1a')](_0xfa27('0x29'),_0xfa27('0x2a'),_0xfa27('0x1e'),util[_0xfa27('0x2b')](_0xff67d8,{'showHidden':![],'depth':null}));});}else{logger[_0xfa27('0x1a')]('WhatsappMessage,\x20%s,\x20%s,\x20%s',_0xfa27('0x2a'),_0xfa27('0x1e'),_0xfa27('0x2c'));}break;case _0xfa27('0x2d'):var _0x41f52c=_0x435f1b['accountSid'];var _0x2ca72e=_0x435f1b[_0xfa27('0x20')];var _0xfe87c9=_0x435f1b[_0xfa27('0x2e')]+_0xfa27('0x2f')+_0x41f52c+_0xfa27('0x30');var _0x666cee={'to':[_0x2fedfc[_0xfa27('0x21')]],'message':{'type':'text','text':_0x2fedfc[_0xfa27('0xd')]}};var _0x2e0c62={'method':_0xfa27('0x31'),'uri':_0xfe87c9,'headers':{'Authorization':'Bearer\x20'+_0x2ca72e,'Content-Type':_0xfa27('0x32')},'body':_0x666cee,'json':!![]};rp(_0x2e0c62)['then'](function(_0x48b321){if(_0x48b321['statuses'][0x0][_0xfa27('0x33')]){return _0x4b099c['update']({'messageId':_0x48b321[_0xfa27('0x34')][0x0][_0xfa27('0x33')]});}})[_0xfa27('0x19')](function(_0x45d0ff){logger[_0xfa27('0x35')](_0xfa27('0x36'),_0x45d0ff);});break;}}})['finally'](function(){_0x200ab8();});}else{_0x200ab8();}}},'charset':'utf8mb4','collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file +var _0x521b=['message_id','err','WhatsappMessage,\x20%s','finally','utf8mb4','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappMessage.attributes','exports','WhatsappMessage','whatsapp_messages','messageId','fti_whatsapp_messages','body','FULLTEXT','models','get','direction','toLowerCase','out','isNil','WhatsappInteraction','findOne','update','createdAt','error','secret','type','twilio','authToken','phone','accountSid','messages','create','whatsapp:','remote','/api/whatsapp/messages/','/status?token=','token','then','catch','WhatsappMessage,\x20%s,\x20%s,\x20%s','inspect','afterCreate','Missing\x20parameters:\x20phone,\x20accountSid\x20or\x20authToken','baseUrl','/whatsapp/v1/','text','POST','application/json','statuses'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x521b,0x1a2));var _0xb521=function(_0x867b0a,_0x587ccf){_0x867b0a=_0x867b0a-0x0;var _0x137438=_0x521b[_0x867b0a];return _0x137438;};'use strict';var _=require(_0xb521('0x0'));var util=require(_0xb521('0x1'));var logger=require(_0xb521('0x2'))(_0xb521('0x3'));var moment=require(_0xb521('0x4'));var BPromise=require(_0xb521('0x5'));var rp=require(_0xb521('0x6'));var fetch=require('node-fetch');var fs=require('fs');var path=require(_0xb521('0x7'));var rimraf=require(_0xb521('0x8'));var config=require(_0xb521('0x9'));var attributes=require(_0xb521('0xa'));module[_0xb521('0xb')]=function(_0x8a9b26,_0x1ee4b2){return _0x8a9b26['define'](_0xb521('0xc'),attributes,{'tableName':_0xb521('0xd'),'paranoid':![],'indexes':[{'name':_0xb521('0xe'),'fields':[_0xb521('0xe')]},{'name':_0xb521('0xf'),'fields':[_0xb521('0x10')],'type':_0xb521('0x11')}],'timestamps':!![],'hooks':{'afterCreate':function(_0x23eb7d,_0x3ca76a,_0x2036e9){var _0x56480a=_0x8a9b26[_0xb521('0x12')];var _0x585b50=_0x23eb7d[_0xb521('0x13')]({'plain':!![]});if(_0x585b50[_0xb521('0x14')][_0xb521('0x15')]()==='in'||_0x585b50[_0xb521('0x14')]['toLowerCase']()===_0xb521('0x16')&&!_0x585b50['secret']&&!_[_0xb521('0x17')](_0x585b50['UserId'])){_0x56480a[_0xb521('0x18')][_0xb521('0x19')]({'where':{'id':_0x585b50['WhatsappInteractionId']}})['then'](function(_0x417d56){if(_0x417d56){_0x417d56[_0xb521('0x1a')]({'lastMsgAt':_0x585b50[_0xb521('0x1b')],'lastMsgDirection':_0x585b50[_0xb521('0x14')][_0xb521('0x15')]()});}})['catch'](function(_0xcf399){console[_0xb521('0x1c')](_0xcf399);});}if(_0x585b50[_0xb521('0x14')]===_0xb521('0x16')&&!_0x585b50[_0xb521('0x1d')]){var _0x15326b;_0x56480a['WhatsappAccount']['find']({'where':{'id':_0x585b50['WhatsappAccountId']},'raw':!![]})['then'](function(_0x547977){_0x15326b=_0x547977;if(_0x15326b&&_0x15326b['type']){switch(_0x15326b[_0xb521('0x1e')]){case _0xb521('0x1f'):var _0x297b17=require(_0xb521('0x1f'));if(_0x15326b['accountSid']&&_0x15326b[_0xb521('0x20')]&&_0x15326b[_0xb521('0x21')]){var _0x3421e2=new _0x297b17(_0x15326b[_0xb521('0x22')],_0x15326b['authToken']);_0x3421e2[_0xb521('0x23')][_0xb521('0x24')]({'body':_0x585b50['body'],'to':_0xb521('0x25')+_0x585b50[_0xb521('0x21')],'from':'whatsapp:'+_0x15326b[_0xb521('0x21')],'statusCallback':_0x15326b[_0xb521('0x26')]+_0xb521('0x27')+_0x585b50['id']+_0xb521('0x28')+_0x15326b[_0xb521('0x29')]})[_0xb521('0x2a')](function(_0x359136){if(_0x359136['sid']){return _0x23eb7d[_0xb521('0x1a')]({'messageId':_0x359136['sid']});}})[_0xb521('0x2b')](function(_0x22db56){logger[_0xb521('0x1c')](_0xb521('0x2c'),'afterCreate',_0xb521('0x1f'),util[_0xb521('0x2d')](_0x22db56,{'showHidden':![],'depth':null}));});}else{logger['error'](_0xb521('0x2c'),_0xb521('0x2e'),_0xb521('0x1f'),_0xb521('0x2f'));}break;case'sinch':var _0x160fcf=_0x15326b[_0xb521('0x22')];var _0x22c3db=_0x15326b[_0xb521('0x20')];var _0x46c1ca=_0x15326b[_0xb521('0x30')]+_0xb521('0x31')+_0x160fcf+'/messages/';var _0x560df1={'to':[_0x585b50[_0xb521('0x21')]],'message':{'type':_0xb521('0x32'),'text':_0x585b50[_0xb521('0x10')]}};var _0x42e437={'method':_0xb521('0x33'),'uri':_0x46c1ca,'headers':{'Authorization':'Bearer\x20'+_0x22c3db,'Content-Type':_0xb521('0x34')},'body':_0x560df1,'json':!![]};rp(_0x42e437)[_0xb521('0x2a')](function(_0xb861e6){if(_0xb861e6[_0xb521('0x35')][0x0][_0xb521('0x36')]){return _0x23eb7d['update']({'messageId':_0xb861e6[_0xb521('0x35')][0x0][_0xb521('0x36')]});}})[_0xb521('0x2b')](function(_0x3b2f5b){logger[_0xb521('0x37')](_0xb521('0x38'),_0x3b2f5b);});break;}}})[_0xb521('0x39')](function(){_0x2036e9();});}else{_0x2036e9();}}},'charset':_0xb521('0x3a'),'collate':'utf8mb4_unicode_ci'});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.rpc.js b/server/api/whatsappMessage/whatsappMessage.rpc.js index ca99020..0ad0a36 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 _0x6066=['request','then','info','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','code','WhatsappMessage,\x20%s,\x20%s','message','catch','options','CreateWhatsappMessage','util','moment','bluebird','../../config/utils','jayson/promise','client','http','redis','localhost','socket.io-emitter','./whatsappMessage.socket','register'];(function(_0x15fa77,_0x93eaff){var _0x1385ff=function(_0x165e02){while(--_0x165e02){_0x15fa77['push'](_0x15fa77['shift']());}};_0x1385ff(++_0x93eaff);}(_0x6066,0x90));var _0x6606=function(_0x390733,_0x1e3d32){_0x390733=_0x390733-0x0;var _0x33beb9=_0x6066[_0x390733];return _0x33beb9;};'use strict';var _=require('lodash');var util=require(_0x6606('0x0'));var moment=require(_0x6606('0x1'));var BPromise=require(_0x6606('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x6606('0x3'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x6606('0x4'));var client=jayson[_0x6606('0x5')][_0x6606('0x6')]({'port':0x232a});config[_0x6606('0x7')]=_['defaults'](config[_0x6606('0x7')],{'host':_0x6606('0x8'),'port':0x18eb});var socket=require(_0x6606('0x9'))(new Redis(config[_0x6606('0x7')]));require(_0x6606('0xa'))[_0x6606('0xb')](socket);function respondWithRpcPromise(_0x2d4f0b,_0x48551f,_0x5008e9){return new BPromise(function(_0x4119b5,_0x2854e7){return client[_0x6606('0xc')](_0x2d4f0b,_0x5008e9)[_0x6606('0xd')](function(_0x3e0593){logger[_0x6606('0xe')]('WhatsappMessage,\x20%s,\x20%s',_0x48551f,_0x6606('0xf'));logger[_0x6606('0x10')](_0x6606('0x11'),_0x48551f,_0x6606('0xf'),JSON[_0x6606('0x12')](_0x3e0593));if(_0x3e0593[_0x6606('0x13')]){if(_0x3e0593[_0x6606('0x13')][_0x6606('0x14')]===0x1f4){logger[_0x6606('0x13')](_0x6606('0x15'),_0x48551f,_0x3e0593[_0x6606('0x13')][_0x6606('0x16')]);return _0x2854e7(_0x3e0593[_0x6606('0x13')][_0x6606('0x16')]);}logger['error'](_0x6606('0x15'),_0x48551f,_0x3e0593[_0x6606('0x13')][_0x6606('0x16')]);return _0x4119b5(_0x3e0593[_0x6606('0x13')][_0x6606('0x16')]);}else{logger['info']('WhatsappMessage,\x20%s,\x20%s',_0x48551f,_0x6606('0xf'));_0x4119b5(_0x3e0593['result'][_0x6606('0x16')]);}})[_0x6606('0x17')](function(_0x283a45){logger[_0x6606('0x13')]('WhatsappMessage,\x20%s,\x20%s',_0x48551f,_0x283a45);_0x2854e7(_0x283a45);});});}exports['CreateWhatsappMessage']=function(_0x1584dd){var _0x1692e9=this;return new Promise(function(_0x195fe7,_0x387c13){return db['WhatsappMessage']['create'](_0x1584dd['body'],{'raw':_0x1584dd[_0x6606('0x18')]?_0x1584dd[_0x6606('0x18')]['raw']===undefined?!![]:![]:!![]})[_0x6606('0xd')](function(_0x318d86){logger[_0x6606('0xe')](_0x6606('0x19'),_0x1584dd);logger[_0x6606('0x10')](_0x6606('0x19'),_0x1584dd,JSON['stringify'](_0x318d86));_0x195fe7(_0x318d86);})[_0x6606('0x17')](function(_0xc550a3){logger[_0x6606('0x13')](_0x6606('0x19'),_0xc550a3[_0x6606('0x16')],_0x1584dd);_0x387c13(_0x1692e9[_0x6606('0x13')](0x1f4,_0xc550a3[_0x6606('0x16')]));});});}; \ No newline at end of file +var _0xc425=['defaults','localhost','socket.io-emitter','./whatsappMessage.socket','request','then','info','WhatsappMessage,\x20%s,\x20%s','request\x20sent','debug','WhatsappMessage,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','CreateWhatsappMessage','WhatsappMessage','create','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','redis'];(function(_0x19567d,_0x5cbbd9){var _0x400d68=function(_0x47cf7f){while(--_0x47cf7f){_0x19567d['push'](_0x19567d['shift']());}};_0x400d68(++_0x5cbbd9);}(_0xc425,0x72));var _0x5c42=function(_0x56fce0,_0x443295){_0x56fce0=_0x56fce0-0x0;var _0x5256c8=_0xc425[_0x56fce0];return _0x5256c8;};'use strict';var _=require(_0x5c42('0x0'));var util=require('util');var moment=require(_0x5c42('0x1'));var BPromise=require(_0x5c42('0x2'));var rs=require(_0x5c42('0x3'));var fs=require('fs');var Redis=require(_0x5c42('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x5c42('0x5'));var logger=require('../../config/logger')(_0x5c42('0x6'));var config=require('../../config/environment');var jayson=require(_0x5c42('0x7'));var client=jayson[_0x5c42('0x8')]['http']({'port':0x232a});config[_0x5c42('0x9')]=_[_0x5c42('0xa')](config[_0x5c42('0x9')],{'host':_0x5c42('0xb'),'port':0x18eb});var socket=require(_0x5c42('0xc'))(new Redis(config[_0x5c42('0x9')]));require(_0x5c42('0xd'))['register'](socket);function respondWithRpcPromise(_0x827839,_0x13e025,_0x703d25){return new BPromise(function(_0x17782f,_0x115d58){return client[_0x5c42('0xe')](_0x827839,_0x703d25)[_0x5c42('0xf')](function(_0x39116d){logger[_0x5c42('0x10')](_0x5c42('0x11'),_0x13e025,_0x5c42('0x12'));logger[_0x5c42('0x13')](_0x5c42('0x14'),_0x13e025,_0x5c42('0x12'),JSON[_0x5c42('0x15')](_0x39116d));if(_0x39116d['error']){if(_0x39116d[_0x5c42('0x16')]['code']===0x1f4){logger[_0x5c42('0x16')](_0x5c42('0x11'),_0x13e025,_0x39116d[_0x5c42('0x16')][_0x5c42('0x17')]);return _0x115d58(_0x39116d[_0x5c42('0x16')][_0x5c42('0x17')]);}logger[_0x5c42('0x16')](_0x5c42('0x11'),_0x13e025,_0x39116d[_0x5c42('0x16')]['message']);return _0x17782f(_0x39116d[_0x5c42('0x16')][_0x5c42('0x17')]);}else{logger[_0x5c42('0x10')](_0x5c42('0x11'),_0x13e025,'request\x20sent');_0x17782f(_0x39116d[_0x5c42('0x18')][_0x5c42('0x17')]);}})[_0x5c42('0x19')](function(_0x2d131f){logger[_0x5c42('0x16')](_0x5c42('0x11'),_0x13e025,_0x2d131f);_0x115d58(_0x2d131f);});});}exports[_0x5c42('0x1a')]=function(_0x17c7dd){var _0x34de7f=this;return new Promise(function(_0x3fafca,_0x2d7c06){return db[_0x5c42('0x1b')][_0x5c42('0x1c')](_0x17c7dd['body'],{'raw':_0x17c7dd[_0x5c42('0x1d')]?_0x17c7dd[_0x5c42('0x1d')][_0x5c42('0x1e')]===undefined?!![]:![]:!![]})[_0x5c42('0xf')](function(_0x3b497b){logger[_0x5c42('0x10')](_0x5c42('0x1a'),_0x17c7dd);logger[_0x5c42('0x13')](_0x5c42('0x1a'),_0x17c7dd,JSON[_0x5c42('0x15')](_0x3b497b));_0x3fafca(_0x3b497b);})[_0x5c42('0x19')](function(_0x1f4dcd){logger[_0x5c42('0x16')](_0x5c42('0x1a'),_0x1f4dcd[_0x5c42('0x17')],_0x17c7dd);_0x2d7c06(_0x34de7f[_0x5c42('0x16')](0x1f4,_0x1f4dcd[_0x5c42('0x17')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappMessage/whatsappMessage.socket.js b/server/api/whatsappMessage/whatsappMessage.socket.js index cb4f933..666b0a3 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 _0xcf65=['./whatsappMessage.events','save','update','emit','removeListener','register','length','whatsappMessage:'];(function(_0x5307f1,_0x66442d){var _0x212ae1=function(_0x471731){while(--_0x471731){_0x5307f1['push'](_0x5307f1['shift']());}};_0x212ae1(++_0x66442d);}(_0xcf65,0x70));var _0x5cf6=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xcf65[_0x3dd15e];return _0x231fd0;};'use strict';var WhatsappMessageEvents=require(_0x5cf6('0x0'));var events=[_0x5cf6('0x1'),'remove',_0x5cf6('0x2')];function createListener(_0x5b1d82,_0x1c379c){return function(_0x5667a4){_0x1c379c[_0x5cf6('0x3')](_0x5b1d82,_0x5667a4);};}function removeListener(_0x8de153,_0xdf5ba0){return function(){WhatsappMessageEvents[_0x5cf6('0x4')](_0x8de153,_0xdf5ba0);};}exports[_0x5cf6('0x5')]=function(_0x448a63){for(var _0xd5ed4c=0x0,_0x46af66=events[_0x5cf6('0x6')];_0xd5ed4c<_0x46af66;_0xd5ed4c++){var _0x55e5f4=events[_0xd5ed4c];var _0xde6cc7=createListener(_0x5cf6('0x7')+_0x55e5f4,_0x448a63);WhatsappMessageEvents['on'](_0x55e5f4,_0xde6cc7);}}; \ No newline at end of file +var _0x28b6=['length','./whatsappMessage.events','save','remove','update','register'];(function(_0x12f4af,_0x4a2bb9){var _0x4c4d50=function(_0x25a7f7){while(--_0x25a7f7){_0x12f4af['push'](_0x12f4af['shift']());}};_0x4c4d50(++_0x4a2bb9);}(_0x28b6,0x1ed));var _0x628b=function(_0x38d2d0,_0x11195d){_0x38d2d0=_0x38d2d0-0x0;var _0x1b2b51=_0x28b6[_0x38d2d0];return _0x1b2b51;};'use strict';var WhatsappMessageEvents=require(_0x628b('0x0'));var events=[_0x628b('0x1'),_0x628b('0x2'),_0x628b('0x3')];function createListener(_0x434355,_0x484f4d){return function(_0x408a9e){_0x484f4d['emit'](_0x434355,_0x408a9e);};}function removeListener(_0x376f58,_0x19f48d){return function(){WhatsappMessageEvents['removeListener'](_0x376f58,_0x19f48d);};}exports[_0x628b('0x4')]=function(_0x24e12e){for(var _0x15e14c=0x0,_0x4ca7a=events[_0x628b('0x5')];_0x15e14c<_0x4ca7a;_0x15e14c++){var _0x9ecde0=events[_0x15e14c];var _0x50ae6b=createListener('whatsappMessage:'+_0x9ecde0,_0x24e12e);WhatsappMessageEvents['on'](_0x9ecde0,_0x50ae6b);}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/index.js b/server/api/whatsappQueue/index.js index 5f65091..02a78ef 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 _0xa3bb=['/:id/members','getTeams','post','create','/:id/teams','addTeams','addAgents','put','delete','destroy','removeTeams','/:id/users','removeAgents','exports','multer','util','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','get','isAuthenticated','index','/:id'];(function(_0x2817d9,_0x3e1a8d){var _0x3e942a=function(_0x4bc5b6){while(--_0x4bc5b6){_0x2817d9['push'](_0x2817d9['shift']());}};_0x3e942a(++_0x3e1a8d);}(_0xa3bb,0x1c8));var _0xba3b=function(_0x3cb599,_0x455abb){_0x3cb599=_0x3cb599-0x0;var _0x44d643=_0xa3bb[_0x3cb599];return _0x44d643;};'use strict';var multer=require(_0xba3b('0x0'));var util=require(_0xba3b('0x1'));var path=require(_0xba3b('0x2'));var timeout=require(_0xba3b('0x3'));var express=require('express');var router=express[_0xba3b('0x4')]();var fs_extra=require(_0xba3b('0x5'));var auth=require(_0xba3b('0x6'));var interaction=require(_0xba3b('0x7'));var config=require('../../config/environment');var controller=require('./whatsappQueue.controller');router[_0xba3b('0x8')]('/',auth[_0xba3b('0x9')](),controller[_0xba3b('0xa')]);router[_0xba3b('0x8')]('/describe',auth['isAuthenticated'](),controller['describe']);router[_0xba3b('0x8')](_0xba3b('0xb'),auth[_0xba3b('0x9')](),controller['show']);router[_0xba3b('0x8')](_0xba3b('0xc'),auth[_0xba3b('0x9')](),controller['getMembers']);router[_0xba3b('0x8')]('/:id/teams',auth[_0xba3b('0x9')](),controller[_0xba3b('0xd')]);router[_0xba3b('0x8')]('/:id/users',auth[_0xba3b('0x9')](),controller['getAgents']);router[_0xba3b('0xe')]('/',auth[_0xba3b('0x9')](),controller[_0xba3b('0xf')]);router[_0xba3b('0xe')](_0xba3b('0x10'),auth['isAuthenticated'](),controller[_0xba3b('0x11')]);router[_0xba3b('0xe')]('/:id/users',auth[_0xba3b('0x9')](),controller[_0xba3b('0x12')]);router[_0xba3b('0x13')](_0xba3b('0xb'),auth[_0xba3b('0x9')](),controller['update']);router[_0xba3b('0x14')](_0xba3b('0xb'),auth[_0xba3b('0x9')](),controller[_0xba3b('0x15')]);router[_0xba3b('0x14')](_0xba3b('0x10'),auth[_0xba3b('0x9')](),controller[_0xba3b('0x16')]);router[_0xba3b('0x14')](_0xba3b('0x17'),auth[_0xba3b('0x9')](),controller[_0xba3b('0x18')]);module[_0xba3b('0x19')]=router; \ No newline at end of file +var _0xc1f2=['removeTeams','removeAgents','exports','multer','util','path','express','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueue.controller','isAuthenticated','index','describe','/:id','show','get','/:id/members','getMembers','/:id/teams','getTeams','getAgents','create','post','/:id/users','addAgents','put','update','delete','destroy'];(function(_0x29d915,_0x54a040){var _0x160f86=function(_0x237dfa){while(--_0x237dfa){_0x29d915['push'](_0x29d915['shift']());}};_0x160f86(++_0x54a040);}(_0xc1f2,0xb7));var _0x2c1f=function(_0x305594,_0x3fa34c){_0x305594=_0x305594-0x0;var _0xf426af=_0xc1f2[_0x305594];return _0xf426af;};'use strict';var multer=require(_0x2c1f('0x0'));var util=require(_0x2c1f('0x1'));var path=require(_0x2c1f('0x2'));var timeout=require('connect-timeout');var express=require(_0x2c1f('0x3'));var router=express['Router']();var fs_extra=require(_0x2c1f('0x4'));var auth=require(_0x2c1f('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x2c1f('0x6'));var controller=require(_0x2c1f('0x7'));router['get']('/',auth[_0x2c1f('0x8')](),controller[_0x2c1f('0x9')]);router['get']('/describe',auth[_0x2c1f('0x8')](),controller[_0x2c1f('0xa')]);router['get'](_0x2c1f('0xb'),auth[_0x2c1f('0x8')](),controller[_0x2c1f('0xc')]);router[_0x2c1f('0xd')](_0x2c1f('0xe'),auth['isAuthenticated'](),controller[_0x2c1f('0xf')]);router[_0x2c1f('0xd')](_0x2c1f('0x10'),auth[_0x2c1f('0x8')](),controller[_0x2c1f('0x11')]);router[_0x2c1f('0xd')]('/:id/users',auth['isAuthenticated'](),controller[_0x2c1f('0x12')]);router['post']('/',auth[_0x2c1f('0x8')](),controller[_0x2c1f('0x13')]);router[_0x2c1f('0x14')]('/:id/teams',auth[_0x2c1f('0x8')](),controller['addTeams']);router[_0x2c1f('0x14')](_0x2c1f('0x15'),auth[_0x2c1f('0x8')](),controller[_0x2c1f('0x16')]);router[_0x2c1f('0x17')](_0x2c1f('0xb'),auth[_0x2c1f('0x8')](),controller[_0x2c1f('0x18')]);router[_0x2c1f('0x19')](_0x2c1f('0xb'),auth['isAuthenticated'](),controller[_0x2c1f('0x1a')]);router['delete'](_0x2c1f('0x10'),auth['isAuthenticated'](),controller[_0x2c1f('0x1b')]);router['delete']('/:id/users',auth[_0x2c1f('0x8')](),controller[_0x2c1f('0x1c')]);module[_0x2c1f('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 6a97762..53846ca 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 _0x949d=['sequelize','exports','STRING','name','rrmemory','beepall'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0x949d,0x162));var _0xd949=function(_0x124604,_0x30a681){_0x124604=_0x124604-0x0;var _0x2e4a9a=_0x949d[_0x124604];return _0x2e4a9a;};'use strict';var Sequelize=require(_0xd949('0x0'));module[_0xd949('0x1')]={'name':{'type':Sequelize[_0xd949('0x2')],'unique':_0xd949('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize['INTEGER'],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize['ENUM'](_0xd949('0x4'),_0xd949('0x5'),'roundrobin')},'description':{'type':Sequelize[_0xd949('0x2')]}}; \ No newline at end of file +var _0xff96=['exports','STRING','name','INTEGER','ENUM','rrmemory','beepall','roundrobin','sequelize'];(function(_0x17b488,_0x14e5d5){var _0x53c3b3=function(_0x23e29b){while(--_0x23e29b){_0x17b488['push'](_0x17b488['shift']());}};_0x53c3b3(++_0x14e5d5);}(_0xff96,0x179));var _0x6ff9=function(_0x58b301,_0x45e991){_0x58b301=_0x58b301-0x0;var _0x2171b3=_0xff96[_0x58b301];return _0x2171b3;};'use strict';var Sequelize=require(_0x6ff9('0x0'));module[_0x6ff9('0x1')]={'name':{'type':Sequelize[_0x6ff9('0x2')],'unique':_0x6ff9('0x3'),'validate':{'notEmpty':!![],'is':/^[A-Za-z0-9\.\_]+$/i}},'timeout':{'type':Sequelize[_0x6ff9('0x4')],'validate':{'min':0x1,'max':0x20c49b}},'strategy':{'type':Sequelize[_0x6ff9('0x5')](_0x6ff9('0x6'),_0x6ff9('0x7'),_0x6ff9('0x8'))},'description':{'type':Sequelize[_0x6ff9('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.controller.js b/server/api/whatsappQueue/whatsappQueue.controller.js index 444f1d6..2806310 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 _0xfeee=['options','includeAll','findAll','rows','catch','show','filters','fields','include','create','body','user','get','role','UserProfileSection','find','userProfileId','autoAssociation','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','params','describe','getMembers','nolimit','WhatsappQueueId','UserWhatsappQueue','User','UserId','agent','whatsappPause','updatedAt','createdAt','format','findOne','Team','getTeams','ids','online','voicePause','interface','Agents','transaction','each','forEach','userWhatsappQueue:save','field','from','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','clone','ut.UserId\x20=\x20?','push','toString','sequelize','QueryTypes','every','TeamId','includes','all','compact','value','removeTeams','removeAgents','emit','addAgents','omit','spread','isArray','userWhatsappQueue:remove','getAgents','rimraf','zip-dir','fast-json-patch','moment','bluebird','mustache','path','sox','to-csv','ejs','lodash','squel','jsforce','../../components/auth/service','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','../../config/utils','../../config/license/util','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','limit','count','apply','reject','save','update','then','destroy','WhatsappQueues','UserProfileResource','end','error','name','send','index','map','WhatsappQueue','rawAttributes','fieldName','key','model','query','keys','intersection','attributes','length','hasOwnProperty','order','sort','where','pick','filter','merge','type'];(function(_0x57c13e,_0x3b4360){var _0x4eba44=function(_0x4d0d15){while(--_0x4d0d15){_0x57c13e['push'](_0x57c13e['shift']());}};_0x4eba44(++_0x3b4360);}(_0xfeee,0xd0));var _0xefee=function(_0x3f1305,_0x9ade43){_0x3f1305=_0x3f1305-0x0;var _0x1e79ef=_0xfeee[_0x3f1305];return _0x1e79ef;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0xefee('0x0'));var zipdir=require(_0xefee('0x1'));var jsonpatch=require(_0xefee('0x2'));var rp=require('request-promise');var moment=require(_0xefee('0x3'));var BPromise=require(_0xefee('0x4'));var Mustache=require(_0xefee('0x5'));var util=require('util');var path=require(_0xefee('0x6'));var sox=require(_0xefee('0x7'));var csv=require(_0xefee('0x8'));var ejs=require(_0xefee('0x9'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0xefee('0xa'));var squel=require(_0xefee('0xb'));var crypto=require('crypto');var jsforce=require(_0xefee('0xc'));var deskjs=require('desk.js');var toCsv=require(_0xefee('0x8'));var querystring=require('querystring');var Papa=require('papaparse');var Redis=require('ioredis');var authService=require(_0xefee('0xd'));var qs=require(_0xefee('0xe'));var as=require(_0xefee('0xf'));var hardwareService=require(_0xefee('0x10'));var logger=require(_0xefee('0x11'))('api');var utils=require(_0xefee('0x12'));var config=require('../../config/environment');var licenseUtil=require(_0xefee('0x13'));var db=require(_0xefee('0x14'))['db'];config[_0xefee('0x15')]=_[_0xefee('0x16')](config['redis'],{'host':_0xefee('0x17'),'port':0x18eb});var socket=require(_0xefee('0x18'))(new Redis(config[_0xefee('0x15')]));require(_0xefee('0x19'))[_0xefee('0x1a')](socket);function respondWithStatusCode(_0x2abdc7,_0x4ee0d9){_0x4ee0d9=_0x4ee0d9||0xcc;return function(_0x546ae6){if(_0x546ae6){return _0x2abdc7[_0xefee('0x1b')](_0x4ee0d9);}return _0x2abdc7[_0xefee('0x1c')](_0x4ee0d9)['end']();};}function respondWithResult(_0xbddc3b,_0x2f7301){_0x2f7301=_0x2f7301||0xc8;return function(_0x2f9a97){if(_0x2f9a97){return _0xbddc3b[_0xefee('0x1c')](_0x2f7301)[_0xefee('0x1d')](_0x2f9a97);}};}function respondWithFilteredResult(_0x271191,_0x46a167){return function(_0x304784){if(_0x304784){var _0x1c6d3f=typeof _0x46a167[_0xefee('0x1e')]===_0xefee('0x1f')&&typeof _0x46a167[_0xefee('0x20')]==='undefined';var _0x342cae=_0x304784[_0xefee('0x21')];var _0x1a0638=_0x1c6d3f?0x0:_0x46a167[_0xefee('0x1e')];var _0x5e699f=_0x1c6d3f?_0x304784['count']:_0x46a167[_0xefee('0x1e')]+_0x46a167['limit'];var _0x20e997;if(_0x5e699f>=_0x342cae){_0x5e699f=_0x342cae;_0x20e997=0xc8;}else{_0x20e997=0xce;}_0x271191[_0xefee('0x1c')](_0x20e997);return _0x271191['set']('Content-Range',_0x1a0638+'-'+_0x5e699f+'/'+_0x342cae)[_0xefee('0x1d')](_0x304784);}return null;};}function patchUpdates(_0x519279){return function(_0x11f66e){try{jsonpatch[_0xefee('0x22')](_0x11f66e,_0x519279,!![]);}catch(_0x4bbbf0){return BPromise[_0xefee('0x23')](_0x4bbbf0);}return _0x11f66e[_0xefee('0x24')]();};}function saveUpdates(_0x2bae26,_0x3c7e78){return function(_0x319d58){if(_0x319d58){return _0x319d58[_0xefee('0x25')](_0x2bae26)[_0xefee('0x26')](function(_0x119518){return _0x119518;});}return null;};}function removeEntity(_0x264f65,_0xa30c4d){return function(_0x560e6a){if(_0x560e6a){return _0x560e6a[_0xefee('0x27')]()[_0xefee('0x26')](function(){var _0x12f59d=_0x560e6a['get']({'plain':!![]});var _0x497408=_0xefee('0x28');return db[_0xefee('0x29')][_0xefee('0x27')]({'where':{'type':_0x497408,'resourceId':_0x12f59d['id']}})['then'](function(){return _0x560e6a;});})['then'](function(){_0x264f65[_0xefee('0x1c')](0xcc)[_0xefee('0x2a')]();});}};}function handleEntityNotFound(_0x50fd66,_0x4b47db){return function(_0x3039ab){if(!_0x3039ab){_0x50fd66[_0xefee('0x1b')](0x194);}return _0x3039ab;};}function handleError(_0x4dc891,_0x3e587e){_0x3e587e=_0x3e587e||0x1f4;return function(_0x3c65a4){logger[_0xefee('0x2b')](_0x3c65a4['stack']);if(_0x3c65a4[_0xefee('0x2c')]){delete _0x3c65a4[_0xefee('0x2c')];}_0x4dc891[_0xefee('0x1c')](_0x3e587e)[_0xefee('0x2d')](_0x3c65a4);};}exports[_0xefee('0x2e')]=function(_0x2c2e7d,_0xfb758b){var _0x43578b={},_0x58dbbc={},_0x14e311={'count':0x0,'rows':[]};var _0x451aa4=_[_0xefee('0x2f')](db[_0xefee('0x30')][_0xefee('0x31')],function(_0x318771){return{'name':_0x318771[_0xefee('0x32')],'type':_0x318771['type'][_0xefee('0x33')]};});_0x58dbbc[_0xefee('0x34')]=_[_0xefee('0x2f')](_0x451aa4,_0xefee('0x2c'));_0x58dbbc[_0xefee('0x35')]=_[_0xefee('0x36')](_0x2c2e7d['query']);_0x58dbbc['filters']=_[_0xefee('0x37')](_0x58dbbc['model'],_0x58dbbc[_0xefee('0x35')]);_0x43578b[_0xefee('0x38')]=_['intersection'](_0x58dbbc['model'],qs['fields'](_0x2c2e7d[_0xefee('0x35')]['fields']));_0x43578b['attributes']=_0x43578b[_0xefee('0x38')][_0xefee('0x39')]?_0x43578b[_0xefee('0x38')]:_0x58dbbc[_0xefee('0x34')];if(!_0x2c2e7d[_0xefee('0x35')][_0xefee('0x3a')]('nolimit')){_0x43578b[_0xefee('0x20')]=qs['limit'](_0x2c2e7d['query']['limit']);_0x43578b[_0xefee('0x1e')]=qs[_0xefee('0x1e')](_0x2c2e7d[_0xefee('0x35')][_0xefee('0x1e')]);}_0x43578b[_0xefee('0x3b')]=qs['sort'](_0x2c2e7d[_0xefee('0x35')][_0xefee('0x3c')]);_0x43578b[_0xefee('0x3d')]=qs['filters'](_[_0xefee('0x3e')](_0x2c2e7d[_0xefee('0x35')],_0x58dbbc['filters']),_0x451aa4);if(_0x2c2e7d[_0xefee('0x35')][_0xefee('0x3f')]){_0x43578b['where']=_[_0xefee('0x40')](_0x43578b['where'],{'$or':_['map'](_0x451aa4,function(_0x4ec30f){if(_0x4ec30f[_0xefee('0x41')]!=='VIRTUAL'){var _0x1e8cde={};_0x1e8cde[_0x4ec30f[_0xefee('0x2c')]]={'$like':'%'+_0x2c2e7d[_0xefee('0x35')][_0xefee('0x3f')]+'%'};return _0x1e8cde;}})});}_0x43578b=_[_0xefee('0x40')]({},_0x43578b,_0x2c2e7d[_0xefee('0x42')]);var _0xb1bf2={'where':_0x43578b[_0xefee('0x3d')]};return db['WhatsappQueue'][_0xefee('0x21')](_0xb1bf2)[_0xefee('0x26')](function(_0x404b90){_0x14e311[_0xefee('0x21')]=_0x404b90;if(_0x2c2e7d[_0xefee('0x35')][_0xefee('0x43')]){_0x43578b['include']=[{'all':!![]}];}return db[_0xefee('0x30')][_0xefee('0x44')](_0x43578b);})[_0xefee('0x26')](function(_0x1152a6){_0x14e311[_0xefee('0x45')]=_0x1152a6;return _0x14e311;})['then'](respondWithFilteredResult(_0xfb758b,_0x43578b))[_0xefee('0x46')](handleError(_0xfb758b,null));};exports[_0xefee('0x47')]=function(_0x422a27,_0x278c91){var _0x15b50b={'raw':!![],'where':{'id':_0x422a27['params']['id']}},_0x33ec6c={};_0x33ec6c['model']=_[_0xefee('0x36')](db['WhatsappQueue']['rawAttributes']);_0x33ec6c[_0xefee('0x35')]=_[_0xefee('0x36')](_0x422a27[_0xefee('0x35')]);_0x33ec6c[_0xefee('0x48')]=_[_0xefee('0x37')](_0x33ec6c[_0xefee('0x34')],_0x33ec6c[_0xefee('0x35')]);_0x15b50b[_0xefee('0x38')]=_[_0xefee('0x37')](_0x33ec6c['model'],qs[_0xefee('0x49')](_0x422a27[_0xefee('0x35')]['fields']));_0x15b50b['attributes']=_0x15b50b['attributes']['length']?_0x15b50b[_0xefee('0x38')]:_0x33ec6c['model'];if(_0x422a27[_0xefee('0x35')]['includeAll']){_0x15b50b[_0xefee('0x4a')]=[{'all':!![]}];}_0x15b50b=_[_0xefee('0x40')]({},_0x15b50b,_0x422a27[_0xefee('0x42')]);return db[_0xefee('0x30')]['find'](_0x15b50b)[_0xefee('0x26')](handleEntityNotFound(_0x278c91,null))[_0xefee('0x26')](respondWithResult(_0x278c91,null))['catch'](handleError(_0x278c91,null));};exports[_0xefee('0x4b')]=function(_0x4a00f1,_0x2a7c93){return db['WhatsappQueue'][_0xefee('0x4b')](_0x4a00f1[_0xefee('0x4c')],{})[_0xefee('0x26')](function(_0xb8bf){var _0x395233=_0x4a00f1[_0xefee('0x4d')][_0xefee('0x4e')]({'plain':!![]});if(!_0x395233)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x395233[_0xefee('0x4f')]==='user'){var _0x243f81=_0xb8bf[_0xefee('0x4e')]({'plain':!![]});var _0x124bc8=_0xefee('0x28');return db[_0xefee('0x50')][_0xefee('0x51')]({'where':{'name':_0x124bc8,'userProfileId':_0x395233[_0xefee('0x52')]},'raw':!![]})['then'](function(_0x4ee365){if(_0x4ee365&&_0x4ee365[_0xefee('0x53')]===0x0){return db['UserProfileResource'][_0xefee('0x4b')]({'name':_0x243f81['name'],'resourceId':_0x243f81['id'],'type':_0x4ee365[_0xefee('0x2c')],'sectionId':_0x4ee365['id']},{})[_0xefee('0x26')](function(){return _0xb8bf;});}else{return _0xb8bf;}})['catch'](function(_0x3bd4e8){logger['error'](_0xefee('0x54'),_0x3bd4e8);throw _0x3bd4e8;});}return _0xb8bf;})[_0xefee('0x26')](respondWithResult(_0x2a7c93,0xc9))[_0xefee('0x46')](handleError(_0x2a7c93,null));};exports[_0xefee('0x25')]=function(_0x5278cd,_0x399193){if(_0x5278cd[_0xefee('0x4c')]['id']){delete _0x5278cd[_0xefee('0x4c')]['id'];}return db[_0xefee('0x30')][_0xefee('0x51')]({'where':{'id':_0x5278cd[_0xefee('0x55')]['id']}})['then'](handleEntityNotFound(_0x399193,null))[_0xefee('0x26')](saveUpdates(_0x5278cd[_0xefee('0x4c')],null))[_0xefee('0x26')](respondWithResult(_0x399193,null))[_0xefee('0x46')](handleError(_0x399193,null));};exports['destroy']=function(_0x251f65,_0x46639f){return db[_0xefee('0x30')][_0xefee('0x51')]({'where':{'id':_0x251f65[_0xefee('0x55')]['id']}})[_0xefee('0x26')](handleEntityNotFound(_0x46639f,null))[_0xefee('0x26')](removeEntity(_0x46639f,null))['catch'](handleError(_0x46639f,null));};exports[_0xefee('0x56')]=function(_0x358e42,_0x222e81){return db[_0xefee('0x30')][_0xefee('0x56')]()['then'](respondWithResult(_0x222e81,null))['catch'](handleError(_0x222e81,null));};exports[_0xefee('0x57')]=function(_0x5e2d5a,_0x40406e,_0x46d02a){var _0xbd5dcd={'raw':!![],'where':{}},_0x4ed027={},_0x363f48;return db['WhatsappQueue']['findOne']({'where':{'id':_0x5e2d5a[_0xefee('0x55')]['id']}})[_0xefee('0x26')](handleEntityNotFound(_0x40406e,null))['then'](function(_0x29e2d6){if(_0x29e2d6){_0x363f48=_0x29e2d6[_0xefee('0x4e')]({'plain':!![]});_0x4ed027['model']=_['keys'](db['UserWhatsappQueue'][_0xefee('0x31')]);_0x4ed027[_0xefee('0x35')]=_[_0xefee('0x36')](_0x5e2d5a[_0xefee('0x35')]);_0x4ed027['filters']=_[_0xefee('0x37')](_0x4ed027[_0xefee('0x34')],_0x4ed027[_0xefee('0x35')]);_0xbd5dcd[_0xefee('0x38')]=_['intersection'](_0x4ed027[_0xefee('0x34')],qs['fields'](_0x5e2d5a[_0xefee('0x35')][_0xefee('0x49')]));_0xbd5dcd['attributes']=_0xbd5dcd['attributes'][_0xefee('0x39')]?_0xbd5dcd[_0xefee('0x38')]:_0x4ed027[_0xefee('0x34')];if(!_0x5e2d5a[_0xefee('0x35')][_0xefee('0x3a')](_0xefee('0x58'))){_0xbd5dcd[_0xefee('0x20')]=qs[_0xefee('0x20')](_0x5e2d5a['query'][_0xefee('0x20')]);_0xbd5dcd[_0xefee('0x1e')]=qs[_0xefee('0x1e')](_0x5e2d5a[_0xefee('0x35')][_0xefee('0x1e')]);}_0xbd5dcd[_0xefee('0x3b')]=qs['sort'](_0x5e2d5a[_0xefee('0x35')][_0xefee('0x3c')]);_0xbd5dcd['where']=qs[_0xefee('0x48')](_[_0xefee('0x3e')](_0x5e2d5a[_0xefee('0x35')],_0x4ed027['filters']));_0xbd5dcd['where'][_0xefee('0x59')]=_0x29e2d6['id'];if(_0x5e2d5a[_0xefee('0x35')][_0xefee('0x3f')]){_0xbd5dcd[_0xefee('0x3d')]=_['merge'](_0xbd5dcd[_0xefee('0x3d')],{'$or':_['map'](_0xbd5dcd['attributes'],function(_0x105179){var _0x4d13ab={};_0x4d13ab[_0x105179]={'$like':'%'+_0x5e2d5a[_0xefee('0x35')][_0xefee('0x3f')]+'%'};return _0x4d13ab;})});}_0xbd5dcd=_[_0xefee('0x40')]({},_0xbd5dcd,_0x5e2d5a[_0xefee('0x42')]);return db[_0xefee('0x5a')][_0xefee('0x44')](_0xbd5dcd);}})[_0xefee('0x26')](function(_0x4e429e){if(_0x4e429e){return db[_0xefee('0x5b')]['findAndCountAll']({'where':{'id':_[_0xefee('0x2f')](_0x4e429e,_0xefee('0x5c')),'role':_0xefee('0x5d')},'attributes':['id',_0xefee('0x2c'),_0xefee('0x5e'),_0xefee('0x5f'),_0xefee('0x60')]});}})['then'](function(_0x4c2fe1){if(_0x4c2fe1){return{'count':_0x4c2fe1[_0xefee('0x21')],'rows':_[_0xefee('0x2f')](_0x4c2fe1[_0xefee('0x45')],function(_0x5e8ef4){return{'membername':_0x5e8ef4[_0xefee('0x2c')],'UserId':_0x5e8ef4['id'],'queue_name':_0x363f48[_0xefee('0x2c')],'WhatsappQueueId':_0x363f48['id'],'interface':util[_0xefee('0x61')]('%s/%s','SIP',_0x5e8ef4[_0xefee('0x2c')]),'penalty':0x0,'paused':_0x5e8ef4[_0xefee('0x5e')],'createdAt':_0x5e8ef4[_0xefee('0x60')],'updatedAt':_0x5e8ef4['updatedAt']};})};}else{return{'count':0x0,'rows':[]};}})[_0xefee('0x26')](respondWithFilteredResult(_0x40406e,_0xbd5dcd))['catch'](handleError(_0x40406e,null));};exports['getTeams']=function(_0x101c56,_0x28a82b,_0x2d87b5){var _0x3080e7={};var _0x40b469={};var _0x212685;var _0x43db1c;return db[_0xefee('0x30')][_0xefee('0x62')]({'where':{'id':_0x101c56['params']['id']}})['then'](handleEntityNotFound(_0x28a82b,null))[_0xefee('0x26')](function(_0x428615){if(_0x428615){_0x212685=_0x428615;_0x40b469[_0xefee('0x34')]=_[_0xefee('0x36')](db[_0xefee('0x63')][_0xefee('0x31')]);_0x40b469['query']=_[_0xefee('0x36')](_0x101c56[_0xefee('0x35')]);_0x40b469['filters']=_[_0xefee('0x37')](_0x40b469[_0xefee('0x34')],_0x40b469[_0xefee('0x35')]);_0x3080e7[_0xefee('0x38')]=_[_0xefee('0x37')](_0x40b469[_0xefee('0x34')],qs['fields'](_0x101c56[_0xefee('0x35')][_0xefee('0x49')]));_0x3080e7[_0xefee('0x38')]=_0x3080e7[_0xefee('0x38')][_0xefee('0x39')]?_0x3080e7[_0xefee('0x38')]:_0x40b469[_0xefee('0x34')];_0x3080e7[_0xefee('0x3b')]=qs[_0xefee('0x3c')](_0x101c56[_0xefee('0x35')][_0xefee('0x3c')]);_0x3080e7['where']=qs[_0xefee('0x48')](_[_0xefee('0x3e')](_0x101c56['query'],_0x40b469[_0xefee('0x48')]));if(_0x101c56[_0xefee('0x35')]['filter']){_0x3080e7['where']=_[_0xefee('0x40')](_0x3080e7[_0xefee('0x3d')],{'$or':_[_0xefee('0x2f')](_0x3080e7[_0xefee('0x38')],function(_0x7fe668){var _0x166036={};_0x166036[_0x7fe668]={'$like':'%'+_0x101c56[_0xefee('0x35')][_0xefee('0x3f')]+'%'};return _0x166036;})});}_0x3080e7=_[_0xefee('0x40')]({},_0x3080e7,_0x101c56['options']);return _0x212685[_0xefee('0x64')](_0x3080e7);}})['then'](function(_0x3b1d36){if(_0x3b1d36){_0x43db1c=_0x3b1d36[_0xefee('0x39')];if(!_0x101c56[_0xefee('0x35')][_0xefee('0x3a')](_0xefee('0x58'))){_0x3080e7[_0xefee('0x20')]=qs[_0xefee('0x20')](_0x101c56[_0xefee('0x35')][_0xefee('0x20')]);_0x3080e7['offset']=qs[_0xefee('0x1e')](_0x101c56[_0xefee('0x35')]['offset']);}return _0x212685[_0xefee('0x64')](_0x3080e7);}})[_0xefee('0x26')](function(_0x2ef8f3){if(_0x2ef8f3){return _0x2ef8f3?{'count':_0x43db1c,'rows':_0x2ef8f3}:null;}})[_0xefee('0x26')](respondWithResult(_0x28a82b,null))['catch'](handleError(_0x28a82b,null));};exports['addTeams']=function(_0x56468a,_0x220ec4,_0x4dd743){var _0xfb1f5c=_0x56468a[_0xefee('0x4c')][_0xefee('0x65')];return db[_0xefee('0x63')][_0xefee('0x44')]({'where':{'id':_0xfb1f5c},'attributes':['id'],'include':[{'model':db[_0xefee('0x5b')],'as':'Agents','attributes':['id',_0xefee('0x2c'),_0xefee('0x66'),_0xefee('0x67'),_0xefee('0x68')],'raw':!![]}]})['then'](function(_0x44f275){if(_0x44f275){var _0x17cd38=_['flatMap'](_0x44f275,function(_0x52bbac){var _0x7f3ceb=_0x52bbac['get']({'plain':!![]});return _0x7f3ceb[_0xefee('0x69')];});return db[_0xefee('0x30')]['find']({'where':{'id':_0x56468a[_0xefee('0x55')]['id']}})['then'](function(_0x2e8f96){return db['sequelize'][_0xefee('0x6a')](function(_0x5c63a1){return _0x2e8f96['addTeams'](_0xfb1f5c,{'transaction':_0x5c63a1})[_0xefee('0x26')](function(){return BPromise[_0xefee('0x6b')](_0x17cd38,function(_0x229eaa){return db[_0xefee('0x5a')]['findOrCreate']({'where':{'UserId':_0x229eaa['id'],'WhatsappQueueId':_0x56468a[_0xefee('0x55')]['id']},'transaction':_0x5c63a1});});})['then'](function(){_0x17cd38[_0xefee('0x6c')](function(_0x1aa83a){socket['emit'](_0xefee('0x6d'),{'UserId':_0x1aa83a['id'],'WhatsappQueueId':_0x2e8f96['id']});});});});});}})[_0xefee('0x26')](respondWithStatusCode(_0x220ec4,null))['catch'](handleError(_0x220ec4,null));};exports['removeTeams']=function(_0x63951d,_0x6d1ec1,_0x34e477){return db['Team'][_0xefee('0x44')]({'where':{'id':_0x63951d[_0xefee('0x35')][_0xefee('0x65')]},'attributes':['id'],'include':[{'model':db[_0xefee('0x5b')],'as':_0xefee('0x69'),'attributes':['id'],'raw':!![]}]})[_0xefee('0x26')](handleEntityNotFound(_0x6d1ec1,null))[_0xefee('0x26')](function(_0x3601bb){var _0x33cd68=_[_0xefee('0x2f')](_0x3601bb,'id');var _0x535563=[];var _0x43afd3=[];var _0x133f37=squel['select']();_0x133f37[_0xefee('0x6e')]('tq.TeamId')[_0xefee('0x6f')](_0xefee('0x70'),'tq')[_0xefee('0x71')](_0xefee('0x72'),'ut',_0xefee('0x73'))[_0xefee('0x3d')]('WhatsappQueueId\x20=\x20?',_0x63951d['params']['id']);for(var _0x30e143=0x0;_0x30e143<_0x3601bb[_0xefee('0x39')];_0x30e143+=0x1){let _0x4f15ad=_0x3601bb[_0x30e143];for(var _0x3148f8=0x0;_0x3148f8<_0x4f15ad[_0xefee('0x69')][_0xefee('0x39')];_0x3148f8+=0x1){let _0x425da0=_0x4f15ad[_0xefee('0x69')][_0x3148f8];var _0x52035f=_0x133f37[_0xefee('0x74')]();_0x52035f[_0xefee('0x3d')](_0xefee('0x75'),_0x425da0['id']);_0x43afd3[_0xefee('0x76')](db['sequelize'][_0xefee('0x35')](_0x52035f[_0xefee('0x77')](),{'type':db[_0xefee('0x78')][_0xefee('0x79')]['SELECT']})[_0xefee('0x26')](function(_0x1ae0d0){if(_0x1ae0d0[_0xefee('0x39')]===0x1){return _0x425da0['id'];}else{var _0x5414b2=_[_0xefee('0x7a')](_[_0xefee('0x2f')](_0x1ae0d0,_0xefee('0x7b')),function(_0x26c6ba){return _[_0xefee('0x7c')](_0x33cd68,_0x26c6ba);});if(_0x5414b2){return _0x425da0['id'];}}}));}}return BPromise[_0xefee('0x7d')](_0x43afd3)['then'](function(_0x457683){_0x535563=_(_0x535563)['union'](_0x457683)[_0xefee('0x7e')]()[_0xefee('0x7f')]();return db[_0xefee('0x30')][_0xefee('0x51')]({'where':{'id':_0x63951d[_0xefee('0x55')]['id']}})['then'](function(_0x1b7fe7){return db['sequelize'][_0xefee('0x6a')](function(_0x58e0f2){return _0x1b7fe7[_0xefee('0x80')](_0x63951d['query'][_0xefee('0x65')],{'transaction':_0x58e0f2})['then'](function(){if(!_['isEmpty'](_0x535563)){return _0x1b7fe7[_0xefee('0x81')](_0x535563,{'transaction':_0x58e0f2});}})[_0xefee('0x26')](function(){_0x535563['forEach'](function(_0x4c7b95){socket[_0xefee('0x82')]('userWhatsappQueue:remove',{'UserId':_0x4c7b95,'WhatsappQueueId':_0x1b7fe7['id']});});});});});});})[_0xefee('0x26')](respondWithStatusCode(_0x6d1ec1,null))[_0xefee('0x46')](handleError(_0x6d1ec1,null));};exports['addAgents']=function(_0x128583,_0x986b46,_0x3e8313){return db[_0xefee('0x30')][_0xefee('0x51')]({'where':{'id':_0x128583[_0xefee('0x55')]['id']}})[_0xefee('0x26')](handleEntityNotFound(_0x986b46,null))[_0xefee('0x26')](function(_0x479758){if(_0x479758){return _0x479758[_0xefee('0x83')](_0x128583['body'][_0xefee('0x65')],_[_0xefee('0x84')](_0x128583[_0xefee('0x4c')],[_0xefee('0x65'),'id'])||{})[_0xefee('0x85')](function(_0x3470b8){for(var _0xb100c0=0x0;_0xb100c0<_0x128583[_0xefee('0x4c')][_0xefee('0x65')][_0xefee('0x39')];_0xb100c0+=0x1){socket[_0xefee('0x82')](_0xefee('0x6d'),{'UserId':Number(_0x128583[_0xefee('0x4c')]['ids'][_0xb100c0]),'WhatsappQueueId':Number(_0x128583['params']['id'])});}return _0x3470b8;});}})[_0xefee('0x26')](respondWithResult(_0x986b46,null))[_0xefee('0x46')](handleError(_0x986b46,null));};exports['removeAgents']=function(_0x195b18,_0x4f7aa5,_0x569a7f){return db['WhatsappQueue']['find']({'where':{'id':_0x195b18[_0xefee('0x55')]['id']}})[_0xefee('0x26')](handleEntityNotFound(_0x4f7aa5,null))[_0xefee('0x26')](function(_0x32db81){if(_0x32db81){return _0x32db81[_0xefee('0x81')](_0x195b18[_0xefee('0x35')]['ids'])[_0xefee('0x26')](function(){if(_[_0xefee('0x86')](_0x195b18[_0xefee('0x35')][_0xefee('0x65')])){for(var _0x4aa6cb=0x0;_0x4aa6cb<_0x195b18[_0xefee('0x35')][_0xefee('0x65')]['length'];_0x4aa6cb+=0x1){socket['emit']('userWhatsappQueue:remove',{'UserId':Number(_0x195b18[_0xefee('0x35')][_0xefee('0x65')][_0x4aa6cb]),'WhatsappQueueId':Number(_0x195b18[_0xefee('0x55')]['id'])});}}else{socket['emit'](_0xefee('0x87'),{'UserId':Number(_0x195b18[_0xefee('0x35')]['ids']),'WhatsappQueueId':Number(_0x195b18[_0xefee('0x55')]['id'])});}});}})[_0xefee('0x26')](respondWithStatusCode(_0x4f7aa5,null))[_0xefee('0x46')](handleError(_0x4f7aa5,null));};exports[_0xefee('0x88')]=function(_0x912fa4,_0x1894ef,_0x11f1e7){var _0x5204df={};var _0x4f2b38={};var _0xdc599f;var _0x136973;return db['WhatsappQueue']['findOne']({'where':{'id':_0x912fa4['params']['id']}})[_0xefee('0x26')](handleEntityNotFound(_0x1894ef,null))[_0xefee('0x26')](function(_0x454616){if(_0x454616){_0xdc599f=_0x454616;_0x4f2b38[_0xefee('0x34')]=_[_0xefee('0x36')](db[_0xefee('0x5b')][_0xefee('0x31')]);_0x4f2b38[_0xefee('0x35')]=_[_0xefee('0x36')](_0x912fa4[_0xefee('0x35')]);_0x4f2b38[_0xefee('0x48')]=_[_0xefee('0x37')](_0x4f2b38['model'],_0x4f2b38[_0xefee('0x35')]);_0x5204df[_0xefee('0x38')]=_[_0xefee('0x37')](_0x4f2b38['model'],qs[_0xefee('0x49')](_0x912fa4[_0xefee('0x35')][_0xefee('0x49')]));_0x5204df[_0xefee('0x38')]=_0x5204df[_0xefee('0x38')]['length']?_0x5204df[_0xefee('0x38')]:_0x4f2b38[_0xefee('0x34')];_0x5204df[_0xefee('0x3b')]=qs[_0xefee('0x3c')](_0x912fa4[_0xefee('0x35')][_0xefee('0x3c')]);_0x5204df[_0xefee('0x3d')]=qs['filters'](_[_0xefee('0x3e')](_0x912fa4[_0xefee('0x35')],_0x4f2b38[_0xefee('0x48')]));if(_0x912fa4['query'][_0xefee('0x3f')]){_0x5204df[_0xefee('0x3d')]=_[_0xefee('0x40')](_0x5204df[_0xefee('0x3d')],{'$or':_['map'](_0x5204df['attributes'],function(_0x223034){var _0x595768={};_0x595768[_0x223034]={'$like':'%'+_0x912fa4[_0xefee('0x35')][_0xefee('0x3f')]+'%'};return _0x595768;})});}_0x5204df=_[_0xefee('0x40')]({},_0x5204df,_0x912fa4[_0xefee('0x42')]);return _0xdc599f[_0xefee('0x88')](_0x5204df);}})['then'](function(_0x41fc55){if(_0x41fc55){_0x136973=_0x41fc55[_0xefee('0x39')];if(!_0x912fa4[_0xefee('0x35')][_0xefee('0x3a')](_0xefee('0x58'))){_0x5204df[_0xefee('0x20')]=qs['limit'](_0x912fa4[_0xefee('0x35')][_0xefee('0x20')]);_0x5204df[_0xefee('0x1e')]=qs[_0xefee('0x1e')](_0x912fa4[_0xefee('0x35')][_0xefee('0x1e')]);}return _0xdc599f['getAgents'](_0x5204df);}})[_0xefee('0x26')](function(_0x32c396){if(_0x32c396){return _0x32c396?{'count':_0x136973,'rows':_0x32c396}:null;}})[_0xefee('0x26')](respondWithResult(_0x1894ef,null))[_0xefee('0x46')](handleError(_0x1894ef,null));}; \ No newline at end of file +var _0x38b0=['destroy','get','WhatsappQueues','UserProfileResource','end','stack','name','send','index','map','fieldName','type','model','query','keys','filters','intersection','fields','attributes','length','hasOwnProperty','nolimit','order','sort','where','pick','filter','merge','VIRTUAL','options','WhatsappQueue','includeAll','include','rows','catch','params','find','create','body','user','role','userProfileId','error','Unable\x20to\x20associate\x20the\x20resource\x20to\x20the\x20User\x20Profile:\x20%s','update','describe','UserWhatsappQueue','rawAttributes','WhatsappQueueId','findAndCountAll','UserId','agent','whatsappPause','updatedAt','createdAt','format','%s/%s','SIP','getTeams','findOne','Team','addTeams','ids','findAll','Agents','voicePause','interface','flatMap','sequelize','transaction','each','findOrCreate','emit','userWhatsappQueue:save','removeTeams','User','select','field','tq.TeamId','team_has_whatsapp_queues','join','user_has_teams','ut.TeamId\x20=\x20tq.TeamId','WhatsappQueueId\x20=\x20?','clone','ut.UserId\x20=\x20?','push','QueryTypes','SELECT','every','TeamId','includes','all','union','compact','value','isEmpty','removeAgents','forEach','userWhatsappQueue:remove','addAgents','omit','spread','isArray','getAgents','eml-format','rimraf','zip-dir','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','desk.js','querystring','papaparse','ioredis','../../components/auth/service','../../config/logger','../../config/utils','../../config/environment','../../mysqldb','redis','defaults','localhost','socket.io-emitter','./whatsappQueue.socket','register','sendStatus','status','json','offset','undefined','count','limit','set','Content-Range','apply','reject','save','then'];(function(_0x30d79a,_0x59840a){var _0x2dfa19=function(_0x504acf){while(--_0x504acf){_0x30d79a['push'](_0x30d79a['shift']());}};_0x2dfa19(++_0x59840a);}(_0x38b0,0x191));var _0x038b=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x38b0[_0x1facfa];return _0x9ec701;};'use strict';var emlformat=require(_0x038b('0x0'));var rimraf=require(_0x038b('0x1'));var zipdir=require(_0x038b('0x2'));var jsonpatch=require('fast-json-patch');var rp=require('request-promise');var moment=require(_0x038b('0x3'));var BPromise=require(_0x038b('0x4'));var Mustache=require(_0x038b('0x5'));var util=require(_0x038b('0x6'));var path=require(_0x038b('0x7'));var sox=require(_0x038b('0x8'));var csv=require(_0x038b('0x9'));var ejs=require(_0x038b('0xa'));var fs=require('fs');var fs_extra=require(_0x038b('0xb'));var _=require(_0x038b('0xc'));var squel=require(_0x038b('0xd'));var crypto=require(_0x038b('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x038b('0xf'));var toCsv=require(_0x038b('0x9'));var querystring=require(_0x038b('0x10'));var Papa=require(_0x038b('0x11'));var Redis=require(_0x038b('0x12'));var authService=require(_0x038b('0x13'));var qs=require('../../components/parsers/qs');var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0x038b('0x14'))('api');var utils=require(_0x038b('0x15'));var config=require(_0x038b('0x16'));var licenseUtil=require('../../config/license/util');var db=require(_0x038b('0x17'))['db'];config[_0x038b('0x18')]=_[_0x038b('0x19')](config[_0x038b('0x18')],{'host':_0x038b('0x1a'),'port':0x18eb});var socket=require(_0x038b('0x1b'))(new Redis(config['redis']));require(_0x038b('0x1c'))[_0x038b('0x1d')](socket);function respondWithStatusCode(_0x4f8eea,_0x448983){_0x448983=_0x448983||0xcc;return function(_0x1b9d0c){if(_0x1b9d0c){return _0x4f8eea[_0x038b('0x1e')](_0x448983);}return _0x4f8eea[_0x038b('0x1f')](_0x448983)['end']();};}function respondWithResult(_0x37b007,_0x419e84){_0x419e84=_0x419e84||0xc8;return function(_0x51a78b){if(_0x51a78b){return _0x37b007['status'](_0x419e84)[_0x038b('0x20')](_0x51a78b);}};}function respondWithFilteredResult(_0x4f974e,_0x12cddf){return function(_0x4e99c5){if(_0x4e99c5){var _0x34f508=typeof _0x12cddf[_0x038b('0x21')]===_0x038b('0x22')&&typeof _0x12cddf['limit']===_0x038b('0x22');var _0x4b0db4=_0x4e99c5[_0x038b('0x23')];var _0x91dd70=_0x34f508?0x0:_0x12cddf[_0x038b('0x21')];var _0x2573dd=_0x34f508?_0x4e99c5['count']:_0x12cddf[_0x038b('0x21')]+_0x12cddf[_0x038b('0x24')];var _0x4568a9;if(_0x2573dd>=_0x4b0db4){_0x2573dd=_0x4b0db4;_0x4568a9=0xc8;}else{_0x4568a9=0xce;}_0x4f974e[_0x038b('0x1f')](_0x4568a9);return _0x4f974e[_0x038b('0x25')](_0x038b('0x26'),_0x91dd70+'-'+_0x2573dd+'/'+_0x4b0db4)[_0x038b('0x20')](_0x4e99c5);}return null;};}function patchUpdates(_0x4dca68){return function(_0x4376c3){try{jsonpatch[_0x038b('0x27')](_0x4376c3,_0x4dca68,!![]);}catch(_0x2782a2){return BPromise[_0x038b('0x28')](_0x2782a2);}return _0x4376c3[_0x038b('0x29')]();};}function saveUpdates(_0x56296b,_0x26aa5d){return function(_0x32f51d){if(_0x32f51d){return _0x32f51d['update'](_0x56296b)[_0x038b('0x2a')](function(_0x16f64f){return _0x16f64f;});}return null;};}function removeEntity(_0x5a630d,_0x1573e4){return function(_0x353b1f){if(_0x353b1f){return _0x353b1f[_0x038b('0x2b')]()['then'](function(){var _0x28a72a=_0x353b1f[_0x038b('0x2c')]({'plain':!![]});var _0x253dbd=_0x038b('0x2d');return db[_0x038b('0x2e')][_0x038b('0x2b')]({'where':{'type':_0x253dbd,'resourceId':_0x28a72a['id']}})[_0x038b('0x2a')](function(){return _0x353b1f;});})[_0x038b('0x2a')](function(){_0x5a630d[_0x038b('0x1f')](0xcc)[_0x038b('0x2f')]();});}};}function handleEntityNotFound(_0x21450f,_0x7a67ea){return function(_0x5a7418){if(!_0x5a7418){_0x21450f[_0x038b('0x1e')](0x194);}return _0x5a7418;};}function handleError(_0x530eba,_0x4db521){_0x4db521=_0x4db521||0x1f4;return function(_0x3a38f2){logger['error'](_0x3a38f2[_0x038b('0x30')]);if(_0x3a38f2['name']){delete _0x3a38f2[_0x038b('0x31')];}_0x530eba['status'](_0x4db521)[_0x038b('0x32')](_0x3a38f2);};}exports[_0x038b('0x33')]=function(_0xeab22e,_0x27f412){var _0x352406={},_0x474f47={},_0x877cc1={'count':0x0,'rows':[]};var _0x3befe3=_[_0x038b('0x34')](db['WhatsappQueue']['rawAttributes'],function(_0x4ce2dd){return{'name':_0x4ce2dd[_0x038b('0x35')],'type':_0x4ce2dd[_0x038b('0x36')]['key']};});_0x474f47[_0x038b('0x37')]=_[_0x038b('0x34')](_0x3befe3,'name');_0x474f47[_0x038b('0x38')]=_[_0x038b('0x39')](_0xeab22e[_0x038b('0x38')]);_0x474f47[_0x038b('0x3a')]=_['intersection'](_0x474f47[_0x038b('0x37')],_0x474f47[_0x038b('0x38')]);_0x352406['attributes']=_[_0x038b('0x3b')](_0x474f47[_0x038b('0x37')],qs[_0x038b('0x3c')](_0xeab22e[_0x038b('0x38')]['fields']));_0x352406[_0x038b('0x3d')]=_0x352406['attributes'][_0x038b('0x3e')]?_0x352406[_0x038b('0x3d')]:_0x474f47[_0x038b('0x37')];if(!_0xeab22e['query'][_0x038b('0x3f')](_0x038b('0x40'))){_0x352406[_0x038b('0x24')]=qs['limit'](_0xeab22e[_0x038b('0x38')][_0x038b('0x24')]);_0x352406[_0x038b('0x21')]=qs[_0x038b('0x21')](_0xeab22e[_0x038b('0x38')][_0x038b('0x21')]);}_0x352406[_0x038b('0x41')]=qs['sort'](_0xeab22e[_0x038b('0x38')][_0x038b('0x42')]);_0x352406[_0x038b('0x43')]=qs[_0x038b('0x3a')](_[_0x038b('0x44')](_0xeab22e['query'],_0x474f47[_0x038b('0x3a')]),_0x3befe3);if(_0xeab22e[_0x038b('0x38')][_0x038b('0x45')]){_0x352406[_0x038b('0x43')]=_[_0x038b('0x46')](_0x352406[_0x038b('0x43')],{'$or':_['map'](_0x3befe3,function(_0x26d6d9){if(_0x26d6d9['type']!==_0x038b('0x47')){var _0xb31083={};_0xb31083[_0x26d6d9[_0x038b('0x31')]]={'$like':'%'+_0xeab22e['query'][_0x038b('0x45')]+'%'};return _0xb31083;}})});}_0x352406=_[_0x038b('0x46')]({},_0x352406,_0xeab22e[_0x038b('0x48')]);var _0x21a97f={'where':_0x352406['where']};return db[_0x038b('0x49')][_0x038b('0x23')](_0x21a97f)['then'](function(_0x4a9770){_0x877cc1[_0x038b('0x23')]=_0x4a9770;if(_0xeab22e[_0x038b('0x38')][_0x038b('0x4a')]){_0x352406[_0x038b('0x4b')]=[{'all':!![]}];}return db[_0x038b('0x49')]['findAll'](_0x352406);})['then'](function(_0x4c85ce){_0x877cc1[_0x038b('0x4c')]=_0x4c85ce;return _0x877cc1;})[_0x038b('0x2a')](respondWithFilteredResult(_0x27f412,_0x352406))[_0x038b('0x4d')](handleError(_0x27f412,null));};exports['show']=function(_0xa2b99b,_0x199214){var _0x329eb9={'raw':!![],'where':{'id':_0xa2b99b[_0x038b('0x4e')]['id']}},_0x4368f1={};_0x4368f1[_0x038b('0x37')]=_[_0x038b('0x39')](db['WhatsappQueue']['rawAttributes']);_0x4368f1['query']=_[_0x038b('0x39')](_0xa2b99b[_0x038b('0x38')]);_0x4368f1['filters']=_[_0x038b('0x3b')](_0x4368f1['model'],_0x4368f1[_0x038b('0x38')]);_0x329eb9[_0x038b('0x3d')]=_['intersection'](_0x4368f1[_0x038b('0x37')],qs[_0x038b('0x3c')](_0xa2b99b['query'][_0x038b('0x3c')]));_0x329eb9[_0x038b('0x3d')]=_0x329eb9[_0x038b('0x3d')][_0x038b('0x3e')]?_0x329eb9[_0x038b('0x3d')]:_0x4368f1[_0x038b('0x37')];if(_0xa2b99b['query'][_0x038b('0x4a')]){_0x329eb9[_0x038b('0x4b')]=[{'all':!![]}];}_0x329eb9=_['merge']({},_0x329eb9,_0xa2b99b[_0x038b('0x48')]);return db[_0x038b('0x49')][_0x038b('0x4f')](_0x329eb9)['then'](handleEntityNotFound(_0x199214,null))['then'](respondWithResult(_0x199214,null))['catch'](handleError(_0x199214,null));};exports[_0x038b('0x50')]=function(_0x3e3e1f,_0x19030b){return db[_0x038b('0x49')][_0x038b('0x50')](_0x3e3e1f[_0x038b('0x51')],{})['then'](function(_0x2c3af0){var _0x1ab732=_0x3e3e1f[_0x038b('0x52')]['get']({'plain':!![]});if(!_0x1ab732)throw new Error('Unable\x20to\x20retrieve\x20the\x20current\x20user');if(_0x1ab732[_0x038b('0x53')]===_0x038b('0x52')){var _0xe2bdf1=_0x2c3af0[_0x038b('0x2c')]({'plain':!![]});var _0x549734=_0x038b('0x2d');return db['UserProfileSection']['find']({'where':{'name':_0x549734,'userProfileId':_0x1ab732[_0x038b('0x54')]},'raw':!![]})['then'](function(_0x136552){if(_0x136552&&_0x136552['autoAssociation']===0x0){return db[_0x038b('0x2e')]['create']({'name':_0xe2bdf1[_0x038b('0x31')],'resourceId':_0xe2bdf1['id'],'type':_0x136552[_0x038b('0x31')],'sectionId':_0x136552['id']},{})['then'](function(){return _0x2c3af0;});}else{return _0x2c3af0;}})['catch'](function(_0xded6f6){logger[_0x038b('0x55')](_0x038b('0x56'),_0xded6f6);throw _0xded6f6;});}return _0x2c3af0;})[_0x038b('0x2a')](respondWithResult(_0x19030b,0xc9))['catch'](handleError(_0x19030b,null));};exports[_0x038b('0x57')]=function(_0x275fd8,_0x3780c8){if(_0x275fd8[_0x038b('0x51')]['id']){delete _0x275fd8[_0x038b('0x51')]['id'];}return db[_0x038b('0x49')][_0x038b('0x4f')]({'where':{'id':_0x275fd8['params']['id']}})[_0x038b('0x2a')](handleEntityNotFound(_0x3780c8,null))[_0x038b('0x2a')](saveUpdates(_0x275fd8[_0x038b('0x51')],null))[_0x038b('0x2a')](respondWithResult(_0x3780c8,null))[_0x038b('0x4d')](handleError(_0x3780c8,null));};exports['destroy']=function(_0x72c069,_0x5adc22){return db[_0x038b('0x49')][_0x038b('0x4f')]({'where':{'id':_0x72c069[_0x038b('0x4e')]['id']}})[_0x038b('0x2a')](handleEntityNotFound(_0x5adc22,null))[_0x038b('0x2a')](removeEntity(_0x5adc22,null))[_0x038b('0x4d')](handleError(_0x5adc22,null));};exports['describe']=function(_0x596656,_0x4304fd){return db[_0x038b('0x49')][_0x038b('0x58')]()[_0x038b('0x2a')](respondWithResult(_0x4304fd,null))[_0x038b('0x4d')](handleError(_0x4304fd,null));};exports['getMembers']=function(_0x304caf,_0x2263c6,_0x5de77e){var _0x1822bb={'raw':!![],'where':{}},_0xf32a08={},_0x343fd5;return db[_0x038b('0x49')]['findOne']({'where':{'id':_0x304caf[_0x038b('0x4e')]['id']}})[_0x038b('0x2a')](handleEntityNotFound(_0x2263c6,null))[_0x038b('0x2a')](function(_0x572cc8){if(_0x572cc8){_0x343fd5=_0x572cc8['get']({'plain':!![]});_0xf32a08[_0x038b('0x37')]=_['keys'](db[_0x038b('0x59')][_0x038b('0x5a')]);_0xf32a08[_0x038b('0x38')]=_['keys'](_0x304caf['query']);_0xf32a08[_0x038b('0x3a')]=_[_0x038b('0x3b')](_0xf32a08[_0x038b('0x37')],_0xf32a08['query']);_0x1822bb['attributes']=_[_0x038b('0x3b')](_0xf32a08['model'],qs[_0x038b('0x3c')](_0x304caf[_0x038b('0x38')]['fields']));_0x1822bb[_0x038b('0x3d')]=_0x1822bb[_0x038b('0x3d')][_0x038b('0x3e')]?_0x1822bb['attributes']:_0xf32a08[_0x038b('0x37')];if(!_0x304caf[_0x038b('0x38')]['hasOwnProperty']('nolimit')){_0x1822bb[_0x038b('0x24')]=qs[_0x038b('0x24')](_0x304caf[_0x038b('0x38')][_0x038b('0x24')]);_0x1822bb[_0x038b('0x21')]=qs[_0x038b('0x21')](_0x304caf[_0x038b('0x38')][_0x038b('0x21')]);}_0x1822bb[_0x038b('0x41')]=qs[_0x038b('0x42')](_0x304caf['query'][_0x038b('0x42')]);_0x1822bb[_0x038b('0x43')]=qs[_0x038b('0x3a')](_[_0x038b('0x44')](_0x304caf['query'],_0xf32a08[_0x038b('0x3a')]));_0x1822bb['where'][_0x038b('0x5b')]=_0x572cc8['id'];if(_0x304caf['query'][_0x038b('0x45')]){_0x1822bb[_0x038b('0x43')]=_['merge'](_0x1822bb['where'],{'$or':_[_0x038b('0x34')](_0x1822bb[_0x038b('0x3d')],function(_0x127e55){var _0x4e0d06={};_0x4e0d06[_0x127e55]={'$like':'%'+_0x304caf[_0x038b('0x38')][_0x038b('0x45')]+'%'};return _0x4e0d06;})});}_0x1822bb=_[_0x038b('0x46')]({},_0x1822bb,_0x304caf[_0x038b('0x48')]);return db[_0x038b('0x59')]['findAll'](_0x1822bb);}})[_0x038b('0x2a')](function(_0x43b824){if(_0x43b824){return db['User'][_0x038b('0x5c')]({'where':{'id':_[_0x038b('0x34')](_0x43b824,_0x038b('0x5d')),'role':_0x038b('0x5e')},'attributes':['id',_0x038b('0x31'),_0x038b('0x5f'),_0x038b('0x60'),_0x038b('0x61')]});}})['then'](function(_0x1f3670){if(_0x1f3670){return{'count':_0x1f3670[_0x038b('0x23')],'rows':_[_0x038b('0x34')](_0x1f3670[_0x038b('0x4c')],function(_0x39b9ee){return{'membername':_0x39b9ee['name'],'UserId':_0x39b9ee['id'],'queue_name':_0x343fd5[_0x038b('0x31')],'WhatsappQueueId':_0x343fd5['id'],'interface':util[_0x038b('0x62')](_0x038b('0x63'),_0x038b('0x64'),_0x39b9ee[_0x038b('0x31')]),'penalty':0x0,'paused':_0x39b9ee[_0x038b('0x5f')],'createdAt':_0x39b9ee[_0x038b('0x61')],'updatedAt':_0x39b9ee[_0x038b('0x60')]};})};}else{return{'count':0x0,'rows':[]};}})['then'](respondWithFilteredResult(_0x2263c6,_0x1822bb))['catch'](handleError(_0x2263c6,null));};exports[_0x038b('0x65')]=function(_0x57030a,_0x499874,_0x2cd564){var _0x5799f0={};var _0x24a805={};var _0xeea83e;var _0x700079;return db[_0x038b('0x49')][_0x038b('0x66')]({'where':{'id':_0x57030a[_0x038b('0x4e')]['id']}})[_0x038b('0x2a')](handleEntityNotFound(_0x499874,null))['then'](function(_0x32c68b){if(_0x32c68b){_0xeea83e=_0x32c68b;_0x24a805[_0x038b('0x37')]=_[_0x038b('0x39')](db[_0x038b('0x67')][_0x038b('0x5a')]);_0x24a805[_0x038b('0x38')]=_[_0x038b('0x39')](_0x57030a['query']);_0x24a805[_0x038b('0x3a')]=_['intersection'](_0x24a805[_0x038b('0x37')],_0x24a805[_0x038b('0x38')]);_0x5799f0[_0x038b('0x3d')]=_[_0x038b('0x3b')](_0x24a805['model'],qs[_0x038b('0x3c')](_0x57030a['query'][_0x038b('0x3c')]));_0x5799f0[_0x038b('0x3d')]=_0x5799f0[_0x038b('0x3d')][_0x038b('0x3e')]?_0x5799f0[_0x038b('0x3d')]:_0x24a805[_0x038b('0x37')];_0x5799f0[_0x038b('0x41')]=qs['sort'](_0x57030a[_0x038b('0x38')][_0x038b('0x42')]);_0x5799f0['where']=qs[_0x038b('0x3a')](_[_0x038b('0x44')](_0x57030a[_0x038b('0x38')],_0x24a805[_0x038b('0x3a')]));if(_0x57030a[_0x038b('0x38')][_0x038b('0x45')]){_0x5799f0['where']=_[_0x038b('0x46')](_0x5799f0['where'],{'$or':_[_0x038b('0x34')](_0x5799f0[_0x038b('0x3d')],function(_0x12a504){var _0x4ffe5d={};_0x4ffe5d[_0x12a504]={'$like':'%'+_0x57030a['query'][_0x038b('0x45')]+'%'};return _0x4ffe5d;})});}_0x5799f0=_[_0x038b('0x46')]({},_0x5799f0,_0x57030a[_0x038b('0x48')]);return _0xeea83e[_0x038b('0x65')](_0x5799f0);}})[_0x038b('0x2a')](function(_0x1d6c24){if(_0x1d6c24){_0x700079=_0x1d6c24[_0x038b('0x3e')];if(!_0x57030a['query'][_0x038b('0x3f')](_0x038b('0x40'))){_0x5799f0[_0x038b('0x24')]=qs[_0x038b('0x24')](_0x57030a['query'][_0x038b('0x24')]);_0x5799f0[_0x038b('0x21')]=qs[_0x038b('0x21')](_0x57030a[_0x038b('0x38')]['offset']);}return _0xeea83e[_0x038b('0x65')](_0x5799f0);}})['then'](function(_0x194ff9){if(_0x194ff9){return _0x194ff9?{'count':_0x700079,'rows':_0x194ff9}:null;}})[_0x038b('0x2a')](respondWithResult(_0x499874,null))[_0x038b('0x4d')](handleError(_0x499874,null));};exports[_0x038b('0x68')]=function(_0x2d0160,_0x48b010,_0x1fa933){var _0x48acb1=_0x2d0160[_0x038b('0x51')][_0x038b('0x69')];return db[_0x038b('0x67')][_0x038b('0x6a')]({'where':{'id':_0x48acb1},'attributes':['id'],'include':[{'model':db['User'],'as':_0x038b('0x6b'),'attributes':['id',_0x038b('0x31'),'online',_0x038b('0x6c'),_0x038b('0x6d')],'raw':!![]}]})[_0x038b('0x2a')](function(_0x862731){if(_0x862731){var _0x31eb63=_[_0x038b('0x6e')](_0x862731,function(_0x58a11b){var _0x596ca1=_0x58a11b[_0x038b('0x2c')]({'plain':!![]});return _0x596ca1[_0x038b('0x6b')];});return db[_0x038b('0x49')]['find']({'where':{'id':_0x2d0160[_0x038b('0x4e')]['id']}})['then'](function(_0x58e80e){return db[_0x038b('0x6f')][_0x038b('0x70')](function(_0x59675a){return _0x58e80e['addTeams'](_0x48acb1,{'transaction':_0x59675a})[_0x038b('0x2a')](function(){return BPromise[_0x038b('0x71')](_0x31eb63,function(_0x27c5d7){return db[_0x038b('0x59')][_0x038b('0x72')]({'where':{'UserId':_0x27c5d7['id'],'WhatsappQueueId':_0x2d0160[_0x038b('0x4e')]['id']},'transaction':_0x59675a});});})[_0x038b('0x2a')](function(){_0x31eb63['forEach'](function(_0x108b81){socket[_0x038b('0x73')](_0x038b('0x74'),{'UserId':_0x108b81['id'],'WhatsappQueueId':_0x58e80e['id']});});});});});}})[_0x038b('0x2a')](respondWithStatusCode(_0x48b010,null))[_0x038b('0x4d')](handleError(_0x48b010,null));};exports[_0x038b('0x75')]=function(_0x1d4f60,_0x117284,_0x5edb56){return db['Team'][_0x038b('0x6a')]({'where':{'id':_0x1d4f60[_0x038b('0x38')][_0x038b('0x69')]},'attributes':['id'],'include':[{'model':db[_0x038b('0x76')],'as':_0x038b('0x6b'),'attributes':['id'],'raw':!![]}]})[_0x038b('0x2a')](handleEntityNotFound(_0x117284,null))[_0x038b('0x2a')](function(_0x1ebfe2){var _0x93a87d=_[_0x038b('0x34')](_0x1ebfe2,'id');var _0x41f146=[];var _0xa74ffb=[];var _0x5e85d8=squel[_0x038b('0x77')]();_0x5e85d8[_0x038b('0x78')](_0x038b('0x79'))['from'](_0x038b('0x7a'),'tq')[_0x038b('0x7b')](_0x038b('0x7c'),'ut',_0x038b('0x7d'))[_0x038b('0x43')](_0x038b('0x7e'),_0x1d4f60[_0x038b('0x4e')]['id']);for(var _0x5a15ce=0x0;_0x5a15ce<_0x1ebfe2[_0x038b('0x3e')];_0x5a15ce+=0x1){let _0x268805=_0x1ebfe2[_0x5a15ce];for(var _0x569d52=0x0;_0x569d52<_0x268805[_0x038b('0x6b')][_0x038b('0x3e')];_0x569d52+=0x1){let _0x38278d=_0x268805['Agents'][_0x569d52];var _0x4c1aa1=_0x5e85d8[_0x038b('0x7f')]();_0x4c1aa1[_0x038b('0x43')](_0x038b('0x80'),_0x38278d['id']);_0xa74ffb[_0x038b('0x81')](db[_0x038b('0x6f')]['query'](_0x4c1aa1['toString'](),{'type':db['sequelize'][_0x038b('0x82')][_0x038b('0x83')]})['then'](function(_0x42fbca){if(_0x42fbca['length']===0x1){return _0x38278d['id'];}else{var _0x574511=_[_0x038b('0x84')](_['map'](_0x42fbca,_0x038b('0x85')),function(_0x59ce23){return _[_0x038b('0x86')](_0x93a87d,_0x59ce23);});if(_0x574511){return _0x38278d['id'];}}}));}}return BPromise[_0x038b('0x87')](_0xa74ffb)['then'](function(_0x101b0d){_0x41f146=_(_0x41f146)[_0x038b('0x88')](_0x101b0d)[_0x038b('0x89')]()[_0x038b('0x8a')]();return db[_0x038b('0x49')][_0x038b('0x4f')]({'where':{'id':_0x1d4f60['params']['id']}})['then'](function(_0x6017cf){return db[_0x038b('0x6f')][_0x038b('0x70')](function(_0x18a746){return _0x6017cf[_0x038b('0x75')](_0x1d4f60[_0x038b('0x38')][_0x038b('0x69')],{'transaction':_0x18a746})['then'](function(){if(!_[_0x038b('0x8b')](_0x41f146)){return _0x6017cf[_0x038b('0x8c')](_0x41f146,{'transaction':_0x18a746});}})[_0x038b('0x2a')](function(){_0x41f146[_0x038b('0x8d')](function(_0x5a5493){socket[_0x038b('0x73')](_0x038b('0x8e'),{'UserId':_0x5a5493,'WhatsappQueueId':_0x6017cf['id']});});});});});});})[_0x038b('0x2a')](respondWithStatusCode(_0x117284,null))[_0x038b('0x4d')](handleError(_0x117284,null));};exports['addAgents']=function(_0x17b0af,_0x409eeb,_0x205b70){return db[_0x038b('0x49')][_0x038b('0x4f')]({'where':{'id':_0x17b0af[_0x038b('0x4e')]['id']}})[_0x038b('0x2a')](handleEntityNotFound(_0x409eeb,null))[_0x038b('0x2a')](function(_0x2a343c){if(_0x2a343c){return _0x2a343c[_0x038b('0x8f')](_0x17b0af[_0x038b('0x51')][_0x038b('0x69')],_[_0x038b('0x90')](_0x17b0af['body'],[_0x038b('0x69'),'id'])||{})[_0x038b('0x91')](function(_0x5afb8f){for(var _0x16e45a=0x0;_0x16e45a<_0x17b0af[_0x038b('0x51')][_0x038b('0x69')][_0x038b('0x3e')];_0x16e45a+=0x1){socket[_0x038b('0x73')](_0x038b('0x74'),{'UserId':Number(_0x17b0af[_0x038b('0x51')][_0x038b('0x69')][_0x16e45a]),'WhatsappQueueId':Number(_0x17b0af['params']['id'])});}return _0x5afb8f;});}})[_0x038b('0x2a')](respondWithResult(_0x409eeb,null))[_0x038b('0x4d')](handleError(_0x409eeb,null));};exports[_0x038b('0x8c')]=function(_0x1cdcd7,_0x3a1a8b,_0x48b85e){return db['WhatsappQueue'][_0x038b('0x4f')]({'where':{'id':_0x1cdcd7[_0x038b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3a1a8b,null))[_0x038b('0x2a')](function(_0x305a02){if(_0x305a02){return _0x305a02[_0x038b('0x8c')](_0x1cdcd7[_0x038b('0x38')]['ids'])[_0x038b('0x2a')](function(){if(_[_0x038b('0x92')](_0x1cdcd7[_0x038b('0x38')][_0x038b('0x69')])){for(var _0x30a7ce=0x0;_0x30a7ce<_0x1cdcd7[_0x038b('0x38')][_0x038b('0x69')][_0x038b('0x3e')];_0x30a7ce+=0x1){socket['emit'](_0x038b('0x8e'),{'UserId':Number(_0x1cdcd7[_0x038b('0x38')][_0x038b('0x69')][_0x30a7ce]),'WhatsappQueueId':Number(_0x1cdcd7[_0x038b('0x4e')]['id'])});}}else{socket[_0x038b('0x73')]('userWhatsappQueue:remove',{'UserId':Number(_0x1cdcd7[_0x038b('0x38')][_0x038b('0x69')]),'WhatsappQueueId':Number(_0x1cdcd7[_0x038b('0x4e')]['id'])});}});}})['then'](respondWithStatusCode(_0x3a1a8b,null))[_0x038b('0x4d')](handleError(_0x3a1a8b,null));};exports[_0x038b('0x93')]=function(_0x5b310d,_0x3bbcab,_0x183205){var _0x4d1352={};var _0x481840={};var _0x36846c;var _0x3d3fd0;return db[_0x038b('0x49')][_0x038b('0x66')]({'where':{'id':_0x5b310d[_0x038b('0x4e')]['id']}})['then'](handleEntityNotFound(_0x3bbcab,null))[_0x038b('0x2a')](function(_0x44a399){if(_0x44a399){_0x36846c=_0x44a399;_0x481840[_0x038b('0x37')]=_[_0x038b('0x39')](db[_0x038b('0x76')][_0x038b('0x5a')]);_0x481840[_0x038b('0x38')]=_[_0x038b('0x39')](_0x5b310d['query']);_0x481840[_0x038b('0x3a')]=_[_0x038b('0x3b')](_0x481840[_0x038b('0x37')],_0x481840[_0x038b('0x38')]);_0x4d1352[_0x038b('0x3d')]=_[_0x038b('0x3b')](_0x481840['model'],qs['fields'](_0x5b310d[_0x038b('0x38')]['fields']));_0x4d1352[_0x038b('0x3d')]=_0x4d1352[_0x038b('0x3d')][_0x038b('0x3e')]?_0x4d1352[_0x038b('0x3d')]:_0x481840[_0x038b('0x37')];_0x4d1352[_0x038b('0x41')]=qs[_0x038b('0x42')](_0x5b310d[_0x038b('0x38')]['sort']);_0x4d1352['where']=qs[_0x038b('0x3a')](_[_0x038b('0x44')](_0x5b310d['query'],_0x481840[_0x038b('0x3a')]));if(_0x5b310d[_0x038b('0x38')][_0x038b('0x45')]){_0x4d1352['where']=_[_0x038b('0x46')](_0x4d1352[_0x038b('0x43')],{'$or':_[_0x038b('0x34')](_0x4d1352['attributes'],function(_0x28f28e){var _0x36f942={};_0x36f942[_0x28f28e]={'$like':'%'+_0x5b310d[_0x038b('0x38')][_0x038b('0x45')]+'%'};return _0x36f942;})});}_0x4d1352=_['merge']({},_0x4d1352,_0x5b310d['options']);return _0x36846c[_0x038b('0x93')](_0x4d1352);}})['then'](function(_0x176446){if(_0x176446){_0x3d3fd0=_0x176446[_0x038b('0x3e')];if(!_0x5b310d[_0x038b('0x38')][_0x038b('0x3f')](_0x038b('0x40'))){_0x4d1352[_0x038b('0x24')]=qs[_0x038b('0x24')](_0x5b310d[_0x038b('0x38')][_0x038b('0x24')]);_0x4d1352[_0x038b('0x21')]=qs['offset'](_0x5b310d['query'][_0x038b('0x21')]);}return _0x36846c[_0x038b('0x93')](_0x4d1352);}})[_0x038b('0x2a')](function(_0x1cc3ca){if(_0x1cc3ca){return _0x1cc3ca?{'count':_0x3d3fd0,'rows':_0x1cc3ca}:null;}})[_0x038b('0x2a')](respondWithResult(_0x3bbcab,null))[_0x038b('0x4d')](handleError(_0x3bbcab,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.events.js b/server/api/whatsappQueue/whatsappQueue.events.js index 03189c5..45a126f 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 _0x9b9d=['hook','exports','events','../../mysqldb','setMaxListeners','save','update','emit','hasOwnProperty'];(function(_0x4a6b92,_0x53929c){var _0x303f17=function(_0x30a218){while(--_0x30a218){_0x4a6b92['push'](_0x4a6b92['shift']());}};_0x303f17(++_0x53929c);}(_0x9b9d,0x18e));var _0xd9b9=function(_0x456f08,_0x150572){_0x456f08=_0x456f08-0x0;var _0x4a10bc=_0x9b9d[_0x456f08];return _0x4a10bc;};'use strict';var EventEmitter=require(_0xd9b9('0x0'));var WhatsappQueue=require(_0xd9b9('0x1'))['db']['WhatsappQueue'];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xd9b9('0x2')](0x0);var events={'afterCreate':_0xd9b9('0x3'),'afterUpdate':_0xd9b9('0x4'),'afterDestroy':'remove'};function emitEvent(_0x56170a){return function(_0x22dbc1,_0x1fd7e8,_0x54e4ab){WhatsappQueueEvents[_0xd9b9('0x5')](_0x56170a+':'+_0x22dbc1['id'],_0x22dbc1);WhatsappQueueEvents[_0xd9b9('0x5')](_0x56170a,_0x22dbc1);_0x54e4ab(null);};}for(var e in events){if(events[_0xd9b9('0x6')](e)){var event=events[e];WhatsappQueue[_0xd9b9('0x7')](e,emitEvent(event));}}module[_0xd9b9('0x8')]=WhatsappQueueEvents; \ No newline at end of file +var _0xa27a=['hasOwnProperty','hook','events','../../mysqldb','WhatsappQueue','setMaxListeners','save','remove','emit'];(function(_0x210d1a,_0x44dd0f){var _0x22fa29=function(_0x56289d){while(--_0x56289d){_0x210d1a['push'](_0x210d1a['shift']());}};_0x22fa29(++_0x44dd0f);}(_0xa27a,0x12b));var _0xaa27=function(_0x222df7,_0x3e073f){_0x222df7=_0x222df7-0x0;var _0x2cceae=_0xa27a[_0x222df7];return _0x2cceae;};'use strict';var EventEmitter=require(_0xaa27('0x0'));var WhatsappQueue=require(_0xaa27('0x1'))['db'][_0xaa27('0x2')];var WhatsappQueueEvents=new EventEmitter();WhatsappQueueEvents[_0xaa27('0x3')](0x0);var events={'afterCreate':_0xaa27('0x4'),'afterUpdate':'update','afterDestroy':_0xaa27('0x5')};function emitEvent(_0x42cf34){return function(_0x5a67fc,_0x4b2c98,_0x4816b8){WhatsappQueueEvents[_0xaa27('0x6')](_0x42cf34+':'+_0x5a67fc['id'],_0x5a67fc);WhatsappQueueEvents[_0xaa27('0x6')](_0x42cf34,_0x5a67fc);_0x4816b8(null);};}for(var e in events){if(events[_0xaa27('0x7')](e)){var event=events[e];WhatsappQueue[_0xaa27('0x8')](e,emitEvent(event));}}module['exports']=WhatsappQueueEvents; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.model.js b/server/api/whatsappQueue/whatsappQueue.model.js index a231647..c7fb98d 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 _0xc088=['../../config/environment','./whatsappQueue.attributes','exports','WhatsappQueue','moment','bluebird','request-promise','rimraf'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0xc088,0xec));var _0x8c08=function(_0x5148d2,_0x3dada8){_0x5148d2=_0x5148d2-0x0;var _0x5d7cd3=_0xc088[_0x5148d2];return _0x5d7cd3;};'use strict';var _=require('lodash');var util=require('util');var logger=require('../../config/logger')('api');var moment=require(_0x8c08('0x0'));var BPromise=require(_0x8c08('0x1'));var rp=require(_0x8c08('0x2'));var fs=require('fs');var path=require('path');var rimraf=require(_0x8c08('0x3'));var config=require(_0x8c08('0x4'));var attributes=require(_0x8c08('0x5'));module[_0x8c08('0x6')]=function(_0x611750,_0x296c50){return _0x611750['define'](_0x8c08('0x7'),attributes,{'tableName':'whatsapp_queues','paranoid':![],'indexes':[],'timestamps':!![]});}; \ No newline at end of file +var _0xb7fa=['whatsapp_queues','lodash','util','../../config/logger','api','moment','bluebird','request-promise','path','rimraf','../../config/environment','./whatsappQueue.attributes','define'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xb7fa,0x112));var _0xab7f=function(_0x5e9d35,_0x382c91){_0x5e9d35=_0x5e9d35-0x0;var _0x3beb2e=_0xb7fa[_0x5e9d35];return _0x3beb2e;};'use strict';var _=require(_0xab7f('0x0'));var util=require(_0xab7f('0x1'));var logger=require(_0xab7f('0x2'))(_0xab7f('0x3'));var moment=require(_0xab7f('0x4'));var BPromise=require(_0xab7f('0x5'));var rp=require(_0xab7f('0x6'));var fs=require('fs');var path=require(_0xab7f('0x7'));var rimraf=require(_0xab7f('0x8'));var config=require(_0xab7f('0x9'));var attributes=require(_0xab7f('0xa'));module['exports']=function(_0x24058f,_0x540f4b){return _0x24058f[_0xab7f('0xb')]('WhatsappQueue',attributes,{'tableName':_0xab7f('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 2bb12de..db14501 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 _0xcc4e=['client','http','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','request','then','info','WhatsappQueue,\x20%s,\x20%s','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','WhatsappQueue','options','raw','attributes','limit','include','map','model','GetWhatsappQueue','catch','ShowWhatsappQueue','where','debug','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise'];(function(_0x4a5452,_0xa31da4){var _0x209900=function(_0x15b396){while(--_0x15b396){_0x4a5452['push'](_0x4a5452['shift']());}};_0x209900(++_0xa31da4);}(_0xcc4e,0x1d7));var _0xecc4=function(_0x2bfc42,_0x5a9e74){_0x2bfc42=_0x2bfc42-0x0;var _0x1630ef=_0xcc4e[_0x2bfc42];return _0x1630ef;};'use strict';var _=require('lodash');var util=require(_0xecc4('0x0'));var moment=require('moment');var BPromise=require(_0xecc4('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xecc4('0x2'));var db=require(_0xecc4('0x3'))['db'];var utils=require(_0xecc4('0x4'));var logger=require(_0xecc4('0x5'))(_0xecc4('0x6'));var config=require(_0xecc4('0x7'));var jayson=require(_0xecc4('0x8'));var client=jayson[_0xecc4('0x9')][_0xecc4('0xa')]({'port':0x232a});config[_0xecc4('0xb')]=_['defaults'](config[_0xecc4('0xb')],{'host':_0xecc4('0xc'),'port':0x18eb});var socket=require(_0xecc4('0xd'))(new Redis(config['redis']));require(_0xecc4('0xe'))[_0xecc4('0xf')](socket);function respondWithRpcPromise(_0x4444ab,_0x2b3038,_0x3bcb14){return new BPromise(function(_0x13bbfa,_0x3abb3d){return client[_0xecc4('0x10')](_0x4444ab,_0x3bcb14)[_0xecc4('0x11')](function(_0x1f634d){logger[_0xecc4('0x12')](_0xecc4('0x13'),_0x2b3038,'request\x20sent');logger['debug'](_0xecc4('0x14'),_0x2b3038,_0xecc4('0x15'),JSON[_0xecc4('0x16')](_0x1f634d));if(_0x1f634d['error']){if(_0x1f634d[_0xecc4('0x17')][_0xecc4('0x18')]===0x1f4){logger['error'](_0xecc4('0x13'),_0x2b3038,_0x1f634d[_0xecc4('0x17')][_0xecc4('0x19')]);return _0x3abb3d(_0x1f634d[_0xecc4('0x17')][_0xecc4('0x19')]);}logger['error'](_0xecc4('0x13'),_0x2b3038,_0x1f634d['error'][_0xecc4('0x19')]);return _0x13bbfa(_0x1f634d[_0xecc4('0x17')][_0xecc4('0x19')]);}else{logger[_0xecc4('0x12')]('WhatsappQueue,\x20%s,\x20%s',_0x2b3038,'request\x20sent');_0x13bbfa(_0x1f634d[_0xecc4('0x1a')]['message']);}})['catch'](function(_0xd64d99){logger[_0xecc4('0x17')](_0xecc4('0x13'),_0x2b3038,_0xd64d99);_0x3abb3d(_0xd64d99);});});}exports['GetWhatsappQueue']=function(_0x55f54c){var _0x2c1e1d=this;return new Promise(function(_0x11a63d,_0x3bfa76){return db[_0xecc4('0x1b')]['findAll']({'raw':_0x55f54c[_0xecc4('0x1c')]?_0x55f54c['options'][_0xecc4('0x1d')]===undefined?!![]:![]:!![],'where':_0x55f54c[_0xecc4('0x1c')]?_0x55f54c['options']['where']||null:null,'attributes':_0x55f54c[_0xecc4('0x1c')]?_0x55f54c[_0xecc4('0x1c')][_0xecc4('0x1e')]||null:null,'limit':_0x55f54c[_0xecc4('0x1c')]?_0x55f54c[_0xecc4('0x1c')][_0xecc4('0x1f')]||null:null,'include':_0x55f54c[_0xecc4('0x1c')]?_0x55f54c[_0xecc4('0x1c')][_0xecc4('0x20')]?_[_0xecc4('0x21')](_0x55f54c[_0xecc4('0x1c')]['include'],function(_0x85f2ed){return{'model':db[_0x85f2ed[_0xecc4('0x22')]],'as':_0x85f2ed['as'],'attributes':_0x85f2ed[_0xecc4('0x1e')],'include':_0x85f2ed[_0xecc4('0x20')]?_[_0xecc4('0x21')](_0x85f2ed[_0xecc4('0x20')],function(_0x404a03){return{'model':db[_0x404a03['model']],'as':_0x404a03['as'],'attributes':_0x404a03[_0xecc4('0x1e')],'include':_0x404a03[_0xecc4('0x20')]?_[_0xecc4('0x21')](_0x404a03[_0xecc4('0x20')],function(_0x7cc9f){return{'model':db[_0x7cc9f[_0xecc4('0x22')]],'as':_0x7cc9f['as'],'attributes':_0x7cc9f[_0xecc4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xecc4('0x11')](function(_0x3d41c5){logger[_0xecc4('0x12')](_0xecc4('0x23'),_0x55f54c);logger['debug'](_0xecc4('0x23'),_0x55f54c,JSON[_0xecc4('0x16')](_0x3d41c5));_0x11a63d(_0x3d41c5);})[_0xecc4('0x24')](function(_0x1c3868){logger[_0xecc4('0x17')](_0xecc4('0x23'),_0x1c3868[_0xecc4('0x19')],_0x55f54c);_0x3bfa76(_0x2c1e1d[_0xecc4('0x17')](0x1f4,_0x1c3868['message']));});});};exports[_0xecc4('0x25')]=function(_0x24cb24){var _0x3dfb5e=this;return new Promise(function(_0x4df855,_0x51f9a6){return db[_0xecc4('0x1b')]['find']({'raw':_0x24cb24['options']?_0x24cb24[_0xecc4('0x1c')][_0xecc4('0x1d')]===undefined?!![]:![]:!![],'where':_0x24cb24[_0xecc4('0x1c')]?_0x24cb24[_0xecc4('0x1c')][_0xecc4('0x26')]||null:null,'attributes':_0x24cb24[_0xecc4('0x1c')]?_0x24cb24[_0xecc4('0x1c')][_0xecc4('0x1e')]||null:null,'include':_0x24cb24[_0xecc4('0x1c')]?_0x24cb24[_0xecc4('0x1c')]['include']?_[_0xecc4('0x21')](_0x24cb24[_0xecc4('0x1c')][_0xecc4('0x20')],function(_0x18d193){return{'model':db[_0x18d193[_0xecc4('0x22')]],'as':_0x18d193['as'],'attributes':_0x18d193['attributes'],'include':_0x18d193[_0xecc4('0x20')]?_['map'](_0x18d193[_0xecc4('0x20')],function(_0x215c34){return{'model':db[_0x215c34[_0xecc4('0x22')]],'as':_0x215c34['as'],'attributes':_0x215c34[_0xecc4('0x1e')],'include':_0x215c34[_0xecc4('0x20')]?_[_0xecc4('0x21')](_0x215c34['include'],function(_0x449ec1){return{'model':db[_0x449ec1[_0xecc4('0x22')]],'as':_0x449ec1['as'],'attributes':_0x449ec1[_0xecc4('0x1e')]};}):[]};}):[]};}):[]:[]})[_0xecc4('0x11')](function(_0x1cf640){logger[_0xecc4('0x12')]('ShowWhatsappQueue',_0x24cb24);logger[_0xecc4('0x27')](_0xecc4('0x25'),_0x24cb24,JSON[_0xecc4('0x16')](_0x1cf640));_0x4df855(_0x1cf640);})[_0xecc4('0x24')](function(_0x553901){logger[_0xecc4('0x17')](_0xecc4('0x25'),_0x553901['message'],_0x24cb24);_0x51f9a6(_0x3dfb5e[_0xecc4('0x17')](0x1f4,_0x553901[_0xecc4('0x19')]));});});}; \ No newline at end of file +var _0xc506=['info','WhatsappQueue,\x20%s,\x20%s','debug','WhatsappQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','catch','GetWhatsappQueue','findAll','raw','options','where','attributes','limit','include','model','map','stringify','ShowWhatsappQueue','WhatsappQueue','find','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','defaults','redis','localhost','socket.io-emitter','./whatsappQueue.socket','register','then'];(function(_0x209d2a,_0x59a302){var _0x2d2a4a=function(_0x4d5084){while(--_0x4d5084){_0x209d2a['push'](_0x209d2a['shift']());}};_0x2d2a4a(++_0x59a302);}(_0xc506,0x1da));var _0x6c50=function(_0x5bb310,_0xea5f70){_0x5bb310=_0x5bb310-0x0;var _0x5710a0=_0xc506[_0x5bb310];return _0x5710a0;};'use strict';var _=require(_0x6c50('0x0'));var util=require('util');var moment=require(_0x6c50('0x1'));var BPromise=require(_0x6c50('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6c50('0x3'));var db=require(_0x6c50('0x4'))['db'];var utils=require(_0x6c50('0x5'));var logger=require(_0x6c50('0x6'))(_0x6c50('0x7'));var config=require(_0x6c50('0x8'));var jayson=require(_0x6c50('0x9'));var client=jayson[_0x6c50('0xa')]['http']({'port':0x232a});config['redis']=_[_0x6c50('0xb')](config[_0x6c50('0xc')],{'host':_0x6c50('0xd'),'port':0x18eb});var socket=require(_0x6c50('0xe'))(new Redis(config['redis']));require(_0x6c50('0xf'))[_0x6c50('0x10')](socket);function respondWithRpcPromise(_0x21c177,_0x4056ae,_0x17fb1e){return new BPromise(function(_0x2a84e7,_0x27125d){return client['request'](_0x21c177,_0x17fb1e)[_0x6c50('0x11')](function(_0x14179b){logger[_0x6c50('0x12')](_0x6c50('0x13'),_0x4056ae,'request\x20sent');logger[_0x6c50('0x14')](_0x6c50('0x15'),_0x4056ae,_0x6c50('0x16'),JSON['stringify'](_0x14179b));if(_0x14179b[_0x6c50('0x17')]){if(_0x14179b[_0x6c50('0x17')][_0x6c50('0x18')]===0x1f4){logger[_0x6c50('0x17')]('WhatsappQueue,\x20%s,\x20%s',_0x4056ae,_0x14179b[_0x6c50('0x17')][_0x6c50('0x19')]);return _0x27125d(_0x14179b[_0x6c50('0x17')][_0x6c50('0x19')]);}logger[_0x6c50('0x17')](_0x6c50('0x13'),_0x4056ae,_0x14179b[_0x6c50('0x17')]['message']);return _0x2a84e7(_0x14179b[_0x6c50('0x17')]['message']);}else{logger['info'](_0x6c50('0x13'),_0x4056ae,_0x6c50('0x16'));_0x2a84e7(_0x14179b['result'][_0x6c50('0x19')]);}})[_0x6c50('0x1a')](function(_0x37b28b){logger[_0x6c50('0x17')](_0x6c50('0x13'),_0x4056ae,_0x37b28b);_0x27125d(_0x37b28b);});});}exports[_0x6c50('0x1b')]=function(_0x3bd752){var _0x164ae1=this;return new Promise(function(_0x1d74ae,_0x401917){return db['WhatsappQueue'][_0x6c50('0x1c')]({'raw':_0x3bd752['options']?_0x3bd752['options'][_0x6c50('0x1d')]===undefined?!![]:![]:!![],'where':_0x3bd752[_0x6c50('0x1e')]?_0x3bd752[_0x6c50('0x1e')][_0x6c50('0x1f')]||null:null,'attributes':_0x3bd752['options']?_0x3bd752[_0x6c50('0x1e')][_0x6c50('0x20')]||null:null,'limit':_0x3bd752[_0x6c50('0x1e')]?_0x3bd752[_0x6c50('0x1e')][_0x6c50('0x21')]||null:null,'include':_0x3bd752['options']?_0x3bd752[_0x6c50('0x1e')][_0x6c50('0x22')]?_['map'](_0x3bd752[_0x6c50('0x1e')][_0x6c50('0x22')],function(_0x138dd1){return{'model':db[_0x138dd1[_0x6c50('0x23')]],'as':_0x138dd1['as'],'attributes':_0x138dd1[_0x6c50('0x20')],'include':_0x138dd1[_0x6c50('0x22')]?_[_0x6c50('0x24')](_0x138dd1[_0x6c50('0x22')],function(_0x239a9e){return{'model':db[_0x239a9e[_0x6c50('0x23')]],'as':_0x239a9e['as'],'attributes':_0x239a9e[_0x6c50('0x20')],'include':_0x239a9e['include']?_[_0x6c50('0x24')](_0x239a9e['include'],function(_0x30eb4c){return{'model':db[_0x30eb4c[_0x6c50('0x23')]],'as':_0x30eb4c['as'],'attributes':_0x30eb4c[_0x6c50('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6c50('0x11')](function(_0x1c2df9){logger[_0x6c50('0x12')](_0x6c50('0x1b'),_0x3bd752);logger[_0x6c50('0x14')]('GetWhatsappQueue',_0x3bd752,JSON[_0x6c50('0x25')](_0x1c2df9));_0x1d74ae(_0x1c2df9);})[_0x6c50('0x1a')](function(_0x520cf2){logger[_0x6c50('0x17')]('GetWhatsappQueue',_0x520cf2[_0x6c50('0x19')],_0x3bd752);_0x401917(_0x164ae1[_0x6c50('0x17')](0x1f4,_0x520cf2['message']));});});};exports[_0x6c50('0x26')]=function(_0x75d504){var _0x55c1db=this;return new Promise(function(_0x161f83,_0x2e13e6){return db[_0x6c50('0x27')][_0x6c50('0x28')]({'raw':_0x75d504[_0x6c50('0x1e')]?_0x75d504['options']['raw']===undefined?!![]:![]:!![],'where':_0x75d504['options']?_0x75d504[_0x6c50('0x1e')][_0x6c50('0x1f')]||null:null,'attributes':_0x75d504['options']?_0x75d504['options']['attributes']||null:null,'include':_0x75d504[_0x6c50('0x1e')]?_0x75d504['options'][_0x6c50('0x22')]?_[_0x6c50('0x24')](_0x75d504[_0x6c50('0x1e')][_0x6c50('0x22')],function(_0x192cb9){return{'model':db[_0x192cb9['model']],'as':_0x192cb9['as'],'attributes':_0x192cb9[_0x6c50('0x20')],'include':_0x192cb9[_0x6c50('0x22')]?_[_0x6c50('0x24')](_0x192cb9[_0x6c50('0x22')],function(_0x470a95){return{'model':db[_0x470a95[_0x6c50('0x23')]],'as':_0x470a95['as'],'attributes':_0x470a95[_0x6c50('0x20')],'include':_0x470a95[_0x6c50('0x22')]?_[_0x6c50('0x24')](_0x470a95[_0x6c50('0x22')],function(_0x41aa5b){return{'model':db[_0x41aa5b['model']],'as':_0x41aa5b['as'],'attributes':_0x41aa5b[_0x6c50('0x20')]};}):[]};}):[]};}):[]:[]})[_0x6c50('0x11')](function(_0x3bd355){logger[_0x6c50('0x12')](_0x6c50('0x26'),_0x75d504);logger[_0x6c50('0x14')](_0x6c50('0x26'),_0x75d504,JSON[_0x6c50('0x25')](_0x3bd355));_0x161f83(_0x3bd355);})['catch'](function(_0x3d5a08){logger[_0x6c50('0x17')]('ShowWhatsappQueue',_0x3d5a08[_0x6c50('0x19')],_0x75d504);_0x2e13e6(_0x55c1db[_0x6c50('0x17')](0x1f4,_0x3d5a08[_0x6c50('0x19')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappQueue/whatsappQueue.socket.js b/server/api/whatsappQueue/whatsappQueue.socket.js index e656514..25eb801 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 _0x2000=['update','removeListener','whatsappQueue:','./whatsappQueue.events','save'];(function(_0x455bdd,_0x420ec5){var _0x473945=function(_0x4d47fe){while(--_0x4d47fe){_0x455bdd['push'](_0x455bdd['shift']());}};_0x473945(++_0x420ec5);}(_0x2000,0xd0));var _0x0200=function(_0x1418b3,_0x1f5bf3){_0x1418b3=_0x1418b3-0x0;var _0x2e38d3=_0x2000[_0x1418b3];return _0x2e38d3;};'use strict';var WhatsappQueueEvents=require(_0x0200('0x0'));var events=[_0x0200('0x1'),'remove',_0x0200('0x2')];function createListener(_0x31c3ce,_0x41b243){return function(_0x5a3679){_0x41b243['emit'](_0x31c3ce,_0x5a3679);};}function removeListener(_0x520e1f,_0x41314b){return function(){WhatsappQueueEvents[_0x0200('0x3')](_0x520e1f,_0x41314b);};}exports['register']=function(_0x236dee){for(var _0x46ff53=0x0,_0x40e546=events['length'];_0x46ff53<_0x40e546;_0x46ff53++){var _0x768745=events[_0x46ff53];var _0x3c6f4f=createListener(_0x0200('0x4')+_0x768745,_0x236dee);WhatsappQueueEvents['on'](_0x768745,_0x3c6f4f);}}; \ No newline at end of file +var _0xf2b1=['removeListener','whatsappQueue:','./whatsappQueue.events','remove','update','emit'];(function(_0x155c64,_0x26ff95){var _0x1f154a=function(_0xbc46e4){while(--_0xbc46e4){_0x155c64['push'](_0x155c64['shift']());}};_0x1f154a(++_0x26ff95);}(_0xf2b1,0x128));var _0x1f2b=function(_0x27c69b,_0x4cbe55){_0x27c69b=_0x27c69b-0x0;var _0x198ac4=_0xf2b1[_0x27c69b];return _0x198ac4;};'use strict';var WhatsappQueueEvents=require(_0x1f2b('0x0'));var events=['save',_0x1f2b('0x1'),_0x1f2b('0x2')];function createListener(_0x1e3eae,_0x548be){return function(_0x298ead){_0x548be[_0x1f2b('0x3')](_0x1e3eae,_0x298ead);};}function removeListener(_0x5affae,_0x1ff8f8){return function(){WhatsappQueueEvents[_0x1f2b('0x4')](_0x5affae,_0x1ff8f8);};}exports['register']=function(_0x588eb7){for(var _0x53c553=0x0,_0x33b102=events['length'];_0x53c553<_0x33b102;_0x53c553++){var _0x586593=events[_0x53c553];var _0x15ed22=createListener(_0x1f2b('0x5')+_0x586593,_0x588eb7);WhatsappQueueEvents['on'](_0x586593,_0x15ed22);}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/index.js b/server/api/whatsappQueueReport/index.js index 17eb7a9..80a67ec 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 _0x08c7=['isAuthenticated','describe','/:id','show','post','put','update','delete','destroy','multer','util','connect-timeout','Router','fs-extra','../../components/auth/service','../../config/environment','./whatsappQueueReport.controller','get','/describe'];(function(_0x8dc04d,_0xaa7559){var _0x2f5f28=function(_0xdd2d1d){while(--_0xdd2d1d){_0x8dc04d['push'](_0x8dc04d['shift']());}};_0x2f5f28(++_0xaa7559);}(_0x08c7,0x1e4));var _0x708c=function(_0x5b951c,_0x2088be){_0x5b951c=_0x5b951c-0x0;var _0x3e8e64=_0x08c7[_0x5b951c];return _0x3e8e64;};'use strict';var multer=require(_0x708c('0x0'));var util=require(_0x708c('0x1'));var path=require('path');var timeout=require(_0x708c('0x2'));var express=require('express');var router=express[_0x708c('0x3')]();var fs_extra=require(_0x708c('0x4'));var auth=require(_0x708c('0x5'));var interaction=require('../../components/interaction/service');var config=require(_0x708c('0x6'));var controller=require(_0x708c('0x7'));router[_0x708c('0x8')]('/',auth['isAuthenticated'](),controller['index']);router[_0x708c('0x8')](_0x708c('0x9'),auth[_0x708c('0xa')](),controller[_0x708c('0xb')]);router[_0x708c('0x8')](_0x708c('0xc'),auth['isAuthenticated'](),controller[_0x708c('0xd')]);router[_0x708c('0xe')]('/',auth[_0x708c('0xa')](),controller['create']);router[_0x708c('0xf')](_0x708c('0xc'),auth[_0x708c('0xa')](),controller[_0x708c('0x10')]);router[_0x708c('0x11')](_0x708c('0xc'),auth[_0x708c('0xa')](),controller[_0x708c('0x12')]);module['exports']=router; \ No newline at end of file +var _0x8140=['connect-timeout','express','fs-extra','../../components/interaction/service','../../config/environment','./whatsappQueueReport.controller','get','isAuthenticated','index','/describe','describe','/:id','post','create','multer'];(function(_0x679ca0,_0x3c992e){var _0x1fe6c1=function(_0x36dab0){while(--_0x36dab0){_0x679ca0['push'](_0x679ca0['shift']());}};_0x1fe6c1(++_0x3c992e);}(_0x8140,0x13a));var _0x0814=function(_0x45684d,_0x11c959){_0x45684d=_0x45684d-0x0;var _0x200c7c=_0x8140[_0x45684d];return _0x200c7c;};'use strict';var multer=require(_0x0814('0x0'));var util=require('util');var path=require('path');var timeout=require(_0x0814('0x1'));var express=require(_0x0814('0x2'));var router=express['Router']();var fs_extra=require(_0x0814('0x3'));var auth=require('../../components/auth/service');var interaction=require(_0x0814('0x4'));var config=require(_0x0814('0x5'));var controller=require(_0x0814('0x6'));router[_0x0814('0x7')]('/',auth[_0x0814('0x8')](),controller[_0x0814('0x9')]);router['get'](_0x0814('0xa'),auth[_0x0814('0x8')](),controller[_0x0814('0xb')]);router[_0x0814('0x7')](_0x0814('0xc'),auth['isAuthenticated'](),controller['show']);router[_0x0814('0xd')]('/',auth['isAuthenticated'](),controller[_0x0814('0xe')]);router['put'](_0x0814('0xc'),auth['isAuthenticated'](),controller['update']);router['delete'](_0x0814('0xc'),auth[_0x0814('0x8')](),controller['destroy']);module['exports']=router; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js index dc45baf..0c89eb4 100644 --- a/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js +++ b/server/api/whatsappQueueReport/whatsappQueueReport.attributes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x157ae1,_0x4c74cf){var _0x54d53c=function(_0x157682){while(--_0x157682){_0x157ae1['push'](_0x157ae1['shift']());}};_0x54d53c(++_0x4c74cf);}(_0x9957,0x93));var _0x7995=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x9957[_0x5b644e];return _0x49c6bf;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file +var _0x9957=['exports','STRING','DATE','sequelize'];(function(_0x50fee5,_0x39208b){var _0x25b10b=function(_0x5dee7f){while(--_0x5dee7f){_0x50fee5['push'](_0x50fee5['shift']());}};_0x25b10b(++_0x39208b);}(_0x9957,0x93));var _0x7995=function(_0x3b380d,_0x4bf247){_0x3b380d=_0x3b380d-0x0;var _0x54502b=_0x9957[_0x3b380d];return _0x54502b;};'use strict';var Sequelize=require(_0x7995('0x0'));module[_0x7995('0x1')]={'uniqueid':{'type':Sequelize[_0x7995('0x2')],'allowNull':![]},'from':{'type':Sequelize[_0x7995('0x2')]},'joinAt':{'type':Sequelize['DATE']},'leaveAt':{'type':Sequelize[_0x7995('0x3')]},'acceptAt':{'type':Sequelize[_0x7995('0x3')]},'exitAt':{'type':Sequelize[_0x7995('0x3')]},'reason':{'type':Sequelize[_0x7995('0x2')]}}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.controller.js b/server/api/whatsappQueueReport/whatsappQueueReport.controller.js index 98c644c..7f72ade 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 _0xeffd=['model','keys','intersection','query','attributes','fields','length','hasOwnProperty','nolimit','order','sort','where','filters','pick','merge','VIRTUAL','filter','options','count','includeAll','include','findAll','catch','show','find','create','body','params','describe','eml-format','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','sendStatus','status','offset','undefined','limit','set','Content-Range','json','reject','update','then','destroy','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','type'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xeffd,0x6b));var _0xdeff=function(_0x15f234,_0x51af00){_0x15f234=_0x15f234-0x0;var _0x15e30f=_0xeffd[_0x15f234];return _0x15e30f;};'use strict';var emlformat=require(_0xdeff('0x0'));var rimraf=require('rimraf');var zipdir=require(_0xdeff('0x1'));var jsonpatch=require(_0xdeff('0x2'));var rp=require(_0xdeff('0x3'));var moment=require(_0xdeff('0x4'));var BPromise=require(_0xdeff('0x5'));var Mustache=require(_0xdeff('0x6'));var util=require(_0xdeff('0x7'));var path=require(_0xdeff('0x8'));var sox=require(_0xdeff('0x9'));var csv=require(_0xdeff('0xa'));var ejs=require(_0xdeff('0xb'));var fs=require('fs');var fs_extra=require(_0xdeff('0xc'));var _=require(_0xdeff('0xd'));var squel=require(_0xdeff('0xe'));var crypto=require(_0xdeff('0xf'));var jsforce=require(_0xdeff('0x10'));var deskjs=require(_0xdeff('0x11'));var toCsv=require('to-csv');var querystring=require(_0xdeff('0x12'));var Papa=require(_0xdeff('0x13'));var Redis=require(_0xdeff('0x14'));var authService=require('../../components/auth/service');var qs=require(_0xdeff('0x15'));var as=require(_0xdeff('0x16'));var hardwareService=require(_0xdeff('0x17'));var logger=require(_0xdeff('0x18'))(_0xdeff('0x19'));var utils=require(_0xdeff('0x1a'));var config=require(_0xdeff('0x1b'));var licenseUtil=require(_0xdeff('0x1c'));var db=require('../../mysqldb')['db'];function respondWithStatusCode(_0x461699,_0x116bf9){_0x116bf9=_0x116bf9||0xcc;return function(_0x4952f2){if(_0x4952f2){return _0x461699[_0xdeff('0x1d')](_0x116bf9);}return _0x461699['status'](_0x116bf9)['end']();};}function respondWithResult(_0x3e56a1,_0x47410f){_0x47410f=_0x47410f||0xc8;return function(_0x1585e8){if(_0x1585e8){return _0x3e56a1[_0xdeff('0x1e')](_0x47410f)['json'](_0x1585e8);}};}function respondWithFilteredResult(_0x826132,_0x314ded){return function(_0xea6c4){if(_0xea6c4){var _0x391633=typeof _0x314ded[_0xdeff('0x1f')]===_0xdeff('0x20')&&typeof _0x314ded['limit']==='undefined';var _0x7440af=_0xea6c4['count'];var _0x5c9837=_0x391633?0x0:_0x314ded[_0xdeff('0x1f')];var _0x369e13=_0x391633?_0xea6c4['count']:_0x314ded[_0xdeff('0x1f')]+_0x314ded[_0xdeff('0x21')];var _0x1ab1fa;if(_0x369e13>=_0x7440af){_0x369e13=_0x7440af;_0x1ab1fa=0xc8;}else{_0x1ab1fa=0xce;}_0x826132[_0xdeff('0x1e')](_0x1ab1fa);return _0x826132[_0xdeff('0x22')](_0xdeff('0x23'),_0x5c9837+'-'+_0x369e13+'/'+_0x7440af)[_0xdeff('0x24')](_0xea6c4);}return null;};}function patchUpdates(_0x919c93){return function(_0x488faa){try{jsonpatch['apply'](_0x488faa,_0x919c93,!![]);}catch(_0x56cb84){return BPromise[_0xdeff('0x25')](_0x56cb84);}return _0x488faa['save']();};}function saveUpdates(_0x189627,_0x91c0b4){return function(_0x543653){if(_0x543653){return _0x543653[_0xdeff('0x26')](_0x189627)[_0xdeff('0x27')](function(_0x4eb2a8){return _0x4eb2a8;});}return null;};}function removeEntity(_0x5dbe96,_0x3b2554){return function(_0x15c425){if(_0x15c425){return _0x15c425[_0xdeff('0x28')]()[_0xdeff('0x27')](function(){_0x5dbe96[_0xdeff('0x1e')](0xcc)['end']();});}};}function handleEntityNotFound(_0xb08f19,_0x412db3){return function(_0x3741fb){if(!_0x3741fb){_0xb08f19[_0xdeff('0x1d')](0x194);}return _0x3741fb;};}function handleError(_0x16974b,_0x35823c){_0x35823c=_0x35823c||0x1f4;return function(_0x3d0111){logger['error'](_0x3d0111[_0xdeff('0x29')]);if(_0x3d0111[_0xdeff('0x2a')]){delete _0x3d0111['name'];}_0x16974b['status'](_0x35823c)[_0xdeff('0x2b')](_0x3d0111);};}exports[_0xdeff('0x2c')]=function(_0x16b2d0,_0xcb819c){var _0x533069={},_0xf9b278={},_0xbc75ee={'count':0x0,'rows':[]};var _0x4e0ff2=_[_0xdeff('0x2d')](db[_0xdeff('0x2e')][_0xdeff('0x2f')],function(_0x5045b8){return{'name':_0x5045b8['fieldName'],'type':_0x5045b8[_0xdeff('0x30')]['key']};});_0xf9b278[_0xdeff('0x31')]=_[_0xdeff('0x2d')](_0x4e0ff2,_0xdeff('0x2a'));_0xf9b278['query']=_[_0xdeff('0x32')](_0x16b2d0['query']);_0xf9b278['filters']=_[_0xdeff('0x33')](_0xf9b278[_0xdeff('0x31')],_0xf9b278[_0xdeff('0x34')]);_0x533069[_0xdeff('0x35')]=_['intersection'](_0xf9b278[_0xdeff('0x31')],qs[_0xdeff('0x36')](_0x16b2d0[_0xdeff('0x34')][_0xdeff('0x36')]));_0x533069[_0xdeff('0x35')]=_0x533069[_0xdeff('0x35')][_0xdeff('0x37')]?_0x533069['attributes']:_0xf9b278[_0xdeff('0x31')];if(!_0x16b2d0['query'][_0xdeff('0x38')](_0xdeff('0x39'))){_0x533069[_0xdeff('0x21')]=qs[_0xdeff('0x21')](_0x16b2d0[_0xdeff('0x34')][_0xdeff('0x21')]);_0x533069['offset']=qs[_0xdeff('0x1f')](_0x16b2d0[_0xdeff('0x34')]['offset']);}_0x533069[_0xdeff('0x3a')]=qs[_0xdeff('0x3b')](_0x16b2d0[_0xdeff('0x34')][_0xdeff('0x3b')]);_0x533069[_0xdeff('0x3c')]=qs[_0xdeff('0x3d')](_[_0xdeff('0x3e')](_0x16b2d0[_0xdeff('0x34')],_0xf9b278['filters']),_0x4e0ff2);if(_0x16b2d0[_0xdeff('0x34')]['filter']){_0x533069[_0xdeff('0x3c')]=_[_0xdeff('0x3f')](_0x533069[_0xdeff('0x3c')],{'$or':_['map'](_0x4e0ff2,function(_0x443550){if(_0x443550[_0xdeff('0x30')]!==_0xdeff('0x40')){var _0x467ce0={};_0x467ce0[_0x443550[_0xdeff('0x2a')]]={'$like':'%'+_0x16b2d0['query'][_0xdeff('0x41')]+'%'};return _0x467ce0;}})});}_0x533069=_['merge']({},_0x533069,_0x16b2d0[_0xdeff('0x42')]);var _0x14f1d0={'where':_0x533069['where']};return db[_0xdeff('0x2e')][_0xdeff('0x43')](_0x14f1d0)[_0xdeff('0x27')](function(_0x2e9dcd){_0xbc75ee[_0xdeff('0x43')]=_0x2e9dcd;if(_0x16b2d0['query'][_0xdeff('0x44')]){_0x533069[_0xdeff('0x45')]=[{'all':!![]}];}return db[_0xdeff('0x2e')][_0xdeff('0x46')](_0x533069);})[_0xdeff('0x27')](function(_0x5dfbb3){_0xbc75ee['rows']=_0x5dfbb3;return _0xbc75ee;})[_0xdeff('0x27')](respondWithFilteredResult(_0xcb819c,_0x533069))[_0xdeff('0x47')](handleError(_0xcb819c,null));};exports[_0xdeff('0x48')]=function(_0x318e77,_0x3c4fd2){var _0x289f70={'raw':!![],'where':{'id':_0x318e77['params']['id']}},_0x2cd68a={};_0x2cd68a[_0xdeff('0x31')]=_[_0xdeff('0x32')](db[_0xdeff('0x2e')]['rawAttributes']);_0x2cd68a[_0xdeff('0x34')]=_[_0xdeff('0x32')](_0x318e77[_0xdeff('0x34')]);_0x2cd68a[_0xdeff('0x3d')]=_['intersection'](_0x2cd68a[_0xdeff('0x31')],_0x2cd68a[_0xdeff('0x34')]);_0x289f70[_0xdeff('0x35')]=_[_0xdeff('0x33')](_0x2cd68a[_0xdeff('0x31')],qs[_0xdeff('0x36')](_0x318e77[_0xdeff('0x34')][_0xdeff('0x36')]));_0x289f70['attributes']=_0x289f70[_0xdeff('0x35')][_0xdeff('0x37')]?_0x289f70[_0xdeff('0x35')]:_0x2cd68a[_0xdeff('0x31')];if(_0x318e77[_0xdeff('0x34')]['includeAll']){_0x289f70[_0xdeff('0x45')]=[{'all':!![]}];}_0x289f70=_[_0xdeff('0x3f')]({},_0x289f70,_0x318e77[_0xdeff('0x42')]);return db[_0xdeff('0x2e')][_0xdeff('0x49')](_0x289f70)['then'](handleEntityNotFound(_0x3c4fd2,null))[_0xdeff('0x27')](respondWithResult(_0x3c4fd2,null))['catch'](handleError(_0x3c4fd2,null));};exports[_0xdeff('0x4a')]=function(_0x10e4ba,_0x1bf17c){return db[_0xdeff('0x2e')][_0xdeff('0x4a')](_0x10e4ba[_0xdeff('0x4b')],{})['then'](respondWithResult(_0x1bf17c,0xc9))['catch'](handleError(_0x1bf17c,null));};exports[_0xdeff('0x26')]=function(_0xf91a72,_0x3dc206){if(_0xf91a72['body']['id']){delete _0xf91a72['body']['id'];}return db[_0xdeff('0x2e')][_0xdeff('0x49')]({'where':{'id':_0xf91a72['params']['id']}})[_0xdeff('0x27')](handleEntityNotFound(_0x3dc206,null))[_0xdeff('0x27')](saveUpdates(_0xf91a72[_0xdeff('0x4b')],null))['then'](respondWithResult(_0x3dc206,null))[_0xdeff('0x47')](handleError(_0x3dc206,null));};exports[_0xdeff('0x28')]=function(_0x1ca376,_0x59ae32){return db[_0xdeff('0x2e')][_0xdeff('0x49')]({'where':{'id':_0x1ca376[_0xdeff('0x4c')]['id']}})[_0xdeff('0x27')](handleEntityNotFound(_0x59ae32,null))[_0xdeff('0x27')](removeEntity(_0x59ae32,null))[_0xdeff('0x47')](handleError(_0x59ae32,null));};exports[_0xdeff('0x4d')]=function(_0x578185,_0x4517d1){return db[_0xdeff('0x2e')]['describe']()[_0xdeff('0x27')](respondWithResult(_0x4517d1,null))[_0xdeff('0x47')](handleError(_0x4517d1,null));}; \ No newline at end of file +var _0x57f8=['filters','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','describe','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','lodash','squel','crypto','desk.js','querystring','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/license/hardware','../../config/logger','api','../../config/utils','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','status','end','json','offset','undefined','limit','count','Content-Range','reject','save','update','destroy','then','error','stack','name','send','index','map','WhatsappQueueReport','rawAttributes','fieldName','type','key','model','keys','query','intersection','attributes','fields','hasOwnProperty','sort'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x57f8,0x198));var _0x857f=function(_0x137d1d,_0x35c663){_0x137d1d=_0x137d1d-0x0;var _0x485108=_0x57f8[_0x137d1d];return _0x485108;};'use strict';var emlformat=require('eml-format');var rimraf=require(_0x857f('0x0'));var zipdir=require(_0x857f('0x1'));var jsonpatch=require(_0x857f('0x2'));var rp=require(_0x857f('0x3'));var moment=require(_0x857f('0x4'));var BPromise=require(_0x857f('0x5'));var Mustache=require(_0x857f('0x6'));var util=require(_0x857f('0x7'));var path=require(_0x857f('0x8'));var sox=require(_0x857f('0x9'));var csv=require(_0x857f('0xa'));var ejs=require(_0x857f('0xb'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require(_0x857f('0xc'));var squel=require(_0x857f('0xd'));var crypto=require(_0x857f('0xe'));var jsforce=require('jsforce');var deskjs=require(_0x857f('0xf'));var toCsv=require(_0x857f('0xa'));var querystring=require(_0x857f('0x10'));var Papa=require('papaparse');var Redis=require(_0x857f('0x11'));var authService=require(_0x857f('0x12'));var qs=require(_0x857f('0x13'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require(_0x857f('0x14'));var logger=require(_0x857f('0x15'))(_0x857f('0x16'));var utils=require(_0x857f('0x17'));var config=require(_0x857f('0x18'));var licenseUtil=require(_0x857f('0x19'));var db=require(_0x857f('0x1a'))['db'];function respondWithStatusCode(_0x533631,_0x2e1eda){_0x2e1eda=_0x2e1eda||0xcc;return function(_0x2d5e26){if(_0x2d5e26){return _0x533631[_0x857f('0x1b')](_0x2e1eda);}return _0x533631[_0x857f('0x1c')](_0x2e1eda)[_0x857f('0x1d')]();};}function respondWithResult(_0x4a25ec,_0x4bc590){_0x4bc590=_0x4bc590||0xc8;return function(_0x3b09d9){if(_0x3b09d9){return _0x4a25ec['status'](_0x4bc590)[_0x857f('0x1e')](_0x3b09d9);}};}function respondWithFilteredResult(_0x4ac81f,_0x1d47bf){return function(_0x134a4f){if(_0x134a4f){var _0x5c3a69=typeof _0x1d47bf[_0x857f('0x1f')]===_0x857f('0x20')&&typeof _0x1d47bf[_0x857f('0x21')]===_0x857f('0x20');var _0x279e74=_0x134a4f[_0x857f('0x22')];var _0x1a9ef8=_0x5c3a69?0x0:_0x1d47bf[_0x857f('0x1f')];var _0x1014ca=_0x5c3a69?_0x134a4f[_0x857f('0x22')]:_0x1d47bf[_0x857f('0x1f')]+_0x1d47bf['limit'];var _0x1729d8;if(_0x1014ca>=_0x279e74){_0x1014ca=_0x279e74;_0x1729d8=0xc8;}else{_0x1729d8=0xce;}_0x4ac81f[_0x857f('0x1c')](_0x1729d8);return _0x4ac81f['set'](_0x857f('0x23'),_0x1a9ef8+'-'+_0x1014ca+'/'+_0x279e74)[_0x857f('0x1e')](_0x134a4f);}return null;};}function patchUpdates(_0x377587){return function(_0x484035){try{jsonpatch['apply'](_0x484035,_0x377587,!![]);}catch(_0x12ee77){return BPromise[_0x857f('0x24')](_0x12ee77);}return _0x484035[_0x857f('0x25')]();};}function saveUpdates(_0x4fa031,_0x118237){return function(_0x17a98e){if(_0x17a98e){return _0x17a98e[_0x857f('0x26')](_0x4fa031)['then'](function(_0x1961ea){return _0x1961ea;});}return null;};}function removeEntity(_0x14a8ce,_0x50bfb7){return function(_0x3bc543){if(_0x3bc543){return _0x3bc543[_0x857f('0x27')]()[_0x857f('0x28')](function(){_0x14a8ce[_0x857f('0x1c')](0xcc)[_0x857f('0x1d')]();});}};}function handleEntityNotFound(_0x3b23a7,_0x233a68){return function(_0x2a89ba){if(!_0x2a89ba){_0x3b23a7[_0x857f('0x1b')](0x194);}return _0x2a89ba;};}function handleError(_0xcd1ee9,_0x72f0aa){_0x72f0aa=_0x72f0aa||0x1f4;return function(_0x4782ab){logger[_0x857f('0x29')](_0x4782ab[_0x857f('0x2a')]);if(_0x4782ab['name']){delete _0x4782ab[_0x857f('0x2b')];}_0xcd1ee9[_0x857f('0x1c')](_0x72f0aa)[_0x857f('0x2c')](_0x4782ab);};}exports[_0x857f('0x2d')]=function(_0x58c2de,_0x40c306){var _0x57ceaa={},_0x1b405a={},_0x234048={'count':0x0,'rows':[]};var _0x45a37f=_[_0x857f('0x2e')](db[_0x857f('0x2f')][_0x857f('0x30')],function(_0x1c4fff){return{'name':_0x1c4fff[_0x857f('0x31')],'type':_0x1c4fff[_0x857f('0x32')][_0x857f('0x33')]};});_0x1b405a[_0x857f('0x34')]=_[_0x857f('0x2e')](_0x45a37f,_0x857f('0x2b'));_0x1b405a['query']=_[_0x857f('0x35')](_0x58c2de[_0x857f('0x36')]);_0x1b405a['filters']=_[_0x857f('0x37')](_0x1b405a[_0x857f('0x34')],_0x1b405a['query']);_0x57ceaa[_0x857f('0x38')]=_[_0x857f('0x37')](_0x1b405a['model'],qs[_0x857f('0x39')](_0x58c2de[_0x857f('0x36')][_0x857f('0x39')]));_0x57ceaa[_0x857f('0x38')]=_0x57ceaa['attributes']['length']?_0x57ceaa[_0x857f('0x38')]:_0x1b405a[_0x857f('0x34')];if(!_0x58c2de['query'][_0x857f('0x3a')]('nolimit')){_0x57ceaa[_0x857f('0x21')]=qs[_0x857f('0x21')](_0x58c2de[_0x857f('0x36')][_0x857f('0x21')]);_0x57ceaa[_0x857f('0x1f')]=qs['offset'](_0x58c2de['query'][_0x857f('0x1f')]);}_0x57ceaa['order']=qs[_0x857f('0x3b')](_0x58c2de[_0x857f('0x36')][_0x857f('0x3b')]);_0x57ceaa['where']=qs[_0x857f('0x3c')](_[_0x857f('0x3d')](_0x58c2de[_0x857f('0x36')],_0x1b405a[_0x857f('0x3c')]),_0x45a37f);if(_0x58c2de[_0x857f('0x36')][_0x857f('0x3e')]){_0x57ceaa[_0x857f('0x3f')]=_['merge'](_0x57ceaa[_0x857f('0x3f')],{'$or':_[_0x857f('0x2e')](_0x45a37f,function(_0x1f285c){if(_0x1f285c[_0x857f('0x32')]!==_0x857f('0x40')){var _0x2356fb={};_0x2356fb[_0x1f285c[_0x857f('0x2b')]]={'$like':'%'+_0x58c2de['query'][_0x857f('0x3e')]+'%'};return _0x2356fb;}})});}_0x57ceaa=_[_0x857f('0x41')]({},_0x57ceaa,_0x58c2de[_0x857f('0x42')]);var _0xc2ac41={'where':_0x57ceaa[_0x857f('0x3f')]};return db[_0x857f('0x2f')]['count'](_0xc2ac41)[_0x857f('0x28')](function(_0x354678){_0x234048[_0x857f('0x22')]=_0x354678;if(_0x58c2de[_0x857f('0x36')][_0x857f('0x43')]){_0x57ceaa[_0x857f('0x44')]=[{'all':!![]}];}return db[_0x857f('0x2f')][_0x857f('0x45')](_0x57ceaa);})['then'](function(_0x40fb37){_0x234048[_0x857f('0x46')]=_0x40fb37;return _0x234048;})[_0x857f('0x28')](respondWithFilteredResult(_0x40c306,_0x57ceaa))[_0x857f('0x47')](handleError(_0x40c306,null));};exports[_0x857f('0x48')]=function(_0x1bbf9f,_0x374b9f){var _0x42d922={'raw':!![],'where':{'id':_0x1bbf9f[_0x857f('0x49')]['id']}},_0xb4d7c2={};_0xb4d7c2[_0x857f('0x34')]=_[_0x857f('0x35')](db[_0x857f('0x2f')][_0x857f('0x30')]);_0xb4d7c2['query']=_[_0x857f('0x35')](_0x1bbf9f['query']);_0xb4d7c2[_0x857f('0x3c')]=_[_0x857f('0x37')](_0xb4d7c2[_0x857f('0x34')],_0xb4d7c2[_0x857f('0x36')]);_0x42d922[_0x857f('0x38')]=_[_0x857f('0x37')](_0xb4d7c2[_0x857f('0x34')],qs[_0x857f('0x39')](_0x1bbf9f[_0x857f('0x36')][_0x857f('0x39')]));_0x42d922[_0x857f('0x38')]=_0x42d922['attributes']['length']?_0x42d922[_0x857f('0x38')]:_0xb4d7c2['model'];if(_0x1bbf9f[_0x857f('0x36')]['includeAll']){_0x42d922[_0x857f('0x44')]=[{'all':!![]}];}_0x42d922=_[_0x857f('0x41')]({},_0x42d922,_0x1bbf9f[_0x857f('0x42')]);return db[_0x857f('0x2f')][_0x857f('0x4a')](_0x42d922)[_0x857f('0x28')](handleEntityNotFound(_0x374b9f,null))[_0x857f('0x28')](respondWithResult(_0x374b9f,null))[_0x857f('0x47')](handleError(_0x374b9f,null));};exports['create']=function(_0x42cf05,_0x3b431d){return db[_0x857f('0x2f')][_0x857f('0x4b')](_0x42cf05['body'],{})[_0x857f('0x28')](respondWithResult(_0x3b431d,0xc9))[_0x857f('0x47')](handleError(_0x3b431d,null));};exports[_0x857f('0x26')]=function(_0x736ef6,_0x67563){if(_0x736ef6['body']['id']){delete _0x736ef6[_0x857f('0x4c')]['id'];}return db[_0x857f('0x2f')]['find']({'where':{'id':_0x736ef6[_0x857f('0x49')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x67563,null))['then'](saveUpdates(_0x736ef6[_0x857f('0x4c')],null))['then'](respondWithResult(_0x67563,null))[_0x857f('0x47')](handleError(_0x67563,null));};exports[_0x857f('0x27')]=function(_0x446fe9,_0x2008d5){return db[_0x857f('0x2f')][_0x857f('0x4a')]({'where':{'id':_0x446fe9[_0x857f('0x49')]['id']}})[_0x857f('0x28')](handleEntityNotFound(_0x2008d5,null))[_0x857f('0x28')](removeEntity(_0x2008d5,null))[_0x857f('0x47')](handleError(_0x2008d5,null));};exports['describe']=function(_0x5464f4,_0x13ef75){return db[_0x857f('0x2f')][_0x857f('0x4d')]()[_0x857f('0x28')](respondWithResult(_0x13ef75,null))[_0x857f('0x47')](handleError(_0x13ef75,null));}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.model.js b/server/api/whatsappQueueReport/whatsappQueueReport.model.js index 1c42a46..78092ac 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 _0xd01d=['../../config/logger','api','bluebird','request-promise','rimraf','../../config/environment','define','WhatsappQueueReport','report_whatsapp_queue','uniqueid','util'];(function(_0x16da8f,_0x4ddb80){var _0xd5dca8=function(_0x3b7cb6){while(--_0x3b7cb6){_0x16da8f['push'](_0x16da8f['shift']());}};_0xd5dca8(++_0x4ddb80);}(_0xd01d,0x133));var _0xdd01=function(_0x166935,_0x107459){_0x166935=_0x166935-0x0;var _0x24f9bb=_0xd01d[_0x166935];return _0x24f9bb;};'use strict';var _=require('lodash');var util=require(_0xdd01('0x0'));var logger=require(_0xdd01('0x1'))(_0xdd01('0x2'));var moment=require('moment');var BPromise=require(_0xdd01('0x3'));var rp=require(_0xdd01('0x4'));var fs=require('fs');var path=require('path');var rimraf=require(_0xdd01('0x5'));var config=require(_0xdd01('0x6'));var attributes=require('./whatsappQueueReport.attributes');module['exports']=function(_0x5e0101,_0x4afdfb){return _0x5e0101[_0xdd01('0x7')](_0xdd01('0x8'),attributes,{'tableName':_0xdd01('0x9'),'paranoid':![],'indexes':[{'name':_0xdd01('0xa'),'fields':['uniqueid']}],'timestamps':!![]});}; \ No newline at end of file +var _0x6ee8=['uniqueid','lodash','util','../../config/logger','api','moment','request-promise','path','rimraf','../../config/environment','./whatsappQueueReport.attributes','define','WhatsappQueueReport'];(function(_0x237f59,_0x3ea9ea){var _0x2f1f44=function(_0x43456f){while(--_0x43456f){_0x237f59['push'](_0x237f59['shift']());}};_0x2f1f44(++_0x3ea9ea);}(_0x6ee8,0x146));var _0x86ee=function(_0x2e422a,_0x1bb5f8){_0x2e422a=_0x2e422a-0x0;var _0x2b6fbe=_0x6ee8[_0x2e422a];return _0x2b6fbe;};'use strict';var _=require(_0x86ee('0x0'));var util=require(_0x86ee('0x1'));var logger=require(_0x86ee('0x2'))(_0x86ee('0x3'));var moment=require(_0x86ee('0x4'));var BPromise=require('bluebird');var rp=require(_0x86ee('0x5'));var fs=require('fs');var path=require(_0x86ee('0x6'));var rimraf=require(_0x86ee('0x7'));var config=require(_0x86ee('0x8'));var attributes=require(_0x86ee('0x9'));module['exports']=function(_0x20c314,_0xa63861){return _0x20c314[_0x86ee('0xa')](_0x86ee('0xb'),attributes,{'tableName':'report_whatsapp_queue','paranoid':![],'indexes':[{'name':_0x86ee('0xc'),'fields':[_0x86ee('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js b/server/api/whatsappQueueReport/whatsappQueueReport.rpc.js index f512b4c..24051cd 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 _0x5653=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateWhatsappQueueReport','WhatsappQueueReport','create','body','options','raw','update','attributes','limit','UpdateWhatsappQueueReport','lodash','moment','randomstring'];(function(_0x3a664e,_0x31b92a){var _0x57940f=function(_0x50ef92){while(--_0x50ef92){_0x3a664e['push'](_0x3a664e['shift']());}};_0x57940f(++_0x31b92a);}(_0x5653,0x171));var _0x3565=function(_0x1ec2a1,_0x20ac0c){_0x1ec2a1=_0x1ec2a1-0x0;var _0x30227d=_0x5653[_0x1ec2a1];return _0x30227d;};'use strict';var _=require(_0x3565('0x0'));var util=require('util');var moment=require(_0x3565('0x1'));var BPromise=require('bluebird');var rs=require(_0x3565('0x2'));var fs=require('fs');var Redis=require(_0x3565('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3565('0x4'))(_0x3565('0x5'));var config=require(_0x3565('0x6'));var jayson=require(_0x3565('0x7'));var client=jayson['client'][_0x3565('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x31e2d4,_0x332715,_0x31f48c){return new BPromise(function(_0x4d76f3,_0x1bd323){return client[_0x3565('0x9')](_0x31e2d4,_0x31f48c)[_0x3565('0xa')](function(_0x214e14){logger[_0x3565('0xb')](_0x3565('0xc'),_0x332715,_0x3565('0xd'));logger[_0x3565('0xe')](_0x3565('0xf'),_0x332715,_0x3565('0xd'),JSON[_0x3565('0x10')](_0x214e14));if(_0x214e14[_0x3565('0x11')]){if(_0x214e14['error'][_0x3565('0x12')]===0x1f4){logger[_0x3565('0x11')](_0x3565('0xc'),_0x332715,_0x214e14['error'][_0x3565('0x13')]);return _0x1bd323(_0x214e14[_0x3565('0x11')][_0x3565('0x13')]);}logger[_0x3565('0x11')](_0x3565('0xc'),_0x332715,_0x214e14[_0x3565('0x11')][_0x3565('0x13')]);return _0x4d76f3(_0x214e14[_0x3565('0x11')]['message']);}else{logger[_0x3565('0xb')](_0x3565('0xc'),_0x332715,_0x3565('0xd'));_0x4d76f3(_0x214e14['result'][_0x3565('0x13')]);}})[_0x3565('0x14')](function(_0x1ada03){logger[_0x3565('0x11')](_0x3565('0xc'),_0x332715,_0x1ada03);_0x1bd323(_0x1ada03);});});}exports[_0x3565('0x15')]=function(_0x25b17d){var _0x476b37=this;return new Promise(function(_0xcdf950,_0x23fb5f){return db[_0x3565('0x16')][_0x3565('0x17')](_0x25b17d[_0x3565('0x18')],{'raw':_0x25b17d['options']?_0x25b17d[_0x3565('0x19')][_0x3565('0x1a')]===undefined?!![]:![]:!![]})[_0x3565('0xa')](function(_0x4869d1){logger[_0x3565('0xb')](_0x3565('0x15'),_0x25b17d);logger[_0x3565('0xe')](_0x3565('0x15'),_0x25b17d,JSON[_0x3565('0x10')](_0x4869d1));_0xcdf950(_0x4869d1);})[_0x3565('0x14')](function(_0x333cca){logger[_0x3565('0x11')]('CreateWhatsappQueueReport',_0x333cca[_0x3565('0x13')],_0x25b17d);_0x23fb5f(_0x476b37[_0x3565('0x11')](0x1f4,_0x333cca[_0x3565('0x13')]));});});};exports['UpdateWhatsappQueueReport']=function(_0x34eef3){var _0x5f0b4a=this;return new Promise(function(_0x17bb53,_0x5171ce){return db[_0x3565('0x16')][_0x3565('0x1b')](_0x34eef3['body'],{'raw':_0x34eef3['options']?_0x34eef3[_0x3565('0x19')][_0x3565('0x1a')]===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x34eef3[_0x3565('0x19')]?_0x34eef3['options']['where']||null:null,'attributes':_0x34eef3[_0x3565('0x19')]?_0x34eef3[_0x3565('0x19')][_0x3565('0x1c')]||null:null,'limit':_0x34eef3[_0x3565('0x19')]?_0x34eef3[_0x3565('0x19')][_0x3565('0x1d')]||null:null})[_0x3565('0xa')](function(_0x4430c0){logger[_0x3565('0xb')](_0x3565('0x1e'),_0x34eef3);logger['debug'](_0x3565('0x1e'),_0x34eef3,JSON[_0x3565('0x10')](_0x4430c0));_0x17bb53(_0x4430c0);})[_0x3565('0x14')](function(_0x4d5654){logger[_0x3565('0x11')](_0x3565('0x1e'),_0x4d5654[_0x3565('0x13')],_0x34eef3);_0x5171ce(_0x5f0b4a[_0x3565('0x11')](0x1f4,_0x4d5654[_0x3565('0x13')]));});});}; \ No newline at end of file +var _0x9dc3=['CreateWhatsappQueueReport','UpdateWhatsappQueueReport','update','where','attributes','limit','then','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','info','WhatsappQueueReport,\x20%s,\x20%s','request\x20sent','debug','WhatsappQueueReport,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','WhatsappQueueReport','create','body','options','raw'];(function(_0x228061,_0x376725){var _0x419a7e=function(_0x13668c){while(--_0x13668c){_0x228061['push'](_0x228061['shift']());}};_0x419a7e(++_0x376725);}(_0x9dc3,0x93));var _0x39dc=function(_0x40063e,_0x542fae){_0x40063e=_0x40063e-0x0;var _0x2b6c67=_0x9dc3[_0x40063e];return _0x2b6c67;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x39dc('0x0'));var BPromise=require(_0x39dc('0x1'));var rs=require(_0x39dc('0x2'));var fs=require('fs');var Redis=require(_0x39dc('0x3'));var db=require(_0x39dc('0x4'))['db'];var utils=require(_0x39dc('0x5'));var logger=require(_0x39dc('0x6'))(_0x39dc('0x7'));var config=require('../../config/environment');var jayson=require(_0x39dc('0x8'));var client=jayson[_0x39dc('0x9')][_0x39dc('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x4087a2,_0x131683,_0xf87f56){return new BPromise(function(_0x4fe9f8,_0x2a79b3){return client[_0x39dc('0xb')](_0x4087a2,_0xf87f56)['then'](function(_0xacb1ef){logger[_0x39dc('0xc')](_0x39dc('0xd'),_0x131683,_0x39dc('0xe'));logger[_0x39dc('0xf')](_0x39dc('0x10'),_0x131683,_0x39dc('0xe'),JSON[_0x39dc('0x11')](_0xacb1ef));if(_0xacb1ef[_0x39dc('0x12')]){if(_0xacb1ef[_0x39dc('0x12')][_0x39dc('0x13')]===0x1f4){logger[_0x39dc('0x12')](_0x39dc('0xd'),_0x131683,_0xacb1ef[_0x39dc('0x12')][_0x39dc('0x14')]);return _0x2a79b3(_0xacb1ef[_0x39dc('0x12')][_0x39dc('0x14')]);}logger[_0x39dc('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x131683,_0xacb1ef[_0x39dc('0x12')][_0x39dc('0x14')]);return _0x4fe9f8(_0xacb1ef['error'][_0x39dc('0x14')]);}else{logger[_0x39dc('0xc')](_0x39dc('0xd'),_0x131683,_0x39dc('0xe'));_0x4fe9f8(_0xacb1ef[_0x39dc('0x15')]['message']);}})[_0x39dc('0x16')](function(_0x49efc8){logger[_0x39dc('0x12')]('WhatsappQueueReport,\x20%s,\x20%s',_0x131683,_0x49efc8);_0x2a79b3(_0x49efc8);});});}exports['CreateWhatsappQueueReport']=function(_0x502d93){var _0x5bbcfb=this;return new Promise(function(_0x33d3ad,_0x4c3928){return db[_0x39dc('0x17')][_0x39dc('0x18')](_0x502d93[_0x39dc('0x19')],{'raw':_0x502d93['options']?_0x502d93[_0x39dc('0x1a')][_0x39dc('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x4be48a){logger[_0x39dc('0xc')]('CreateWhatsappQueueReport',_0x502d93);logger[_0x39dc('0xf')](_0x39dc('0x1c'),_0x502d93,JSON[_0x39dc('0x11')](_0x4be48a));_0x33d3ad(_0x4be48a);})[_0x39dc('0x16')](function(_0x3974d6){logger['error']('CreateWhatsappQueueReport',_0x3974d6[_0x39dc('0x14')],_0x502d93);_0x4c3928(_0x5bbcfb[_0x39dc('0x12')](0x1f4,_0x3974d6['message']));});});};exports[_0x39dc('0x1d')]=function(_0x2c6466){var _0x48aa87=this;return new Promise(function(_0x4c61e3,_0x16cad1){return db[_0x39dc('0x17')][_0x39dc('0x1e')](_0x2c6466[_0x39dc('0x19')],{'raw':_0x2c6466[_0x39dc('0x1a')]?_0x2c6466['options']['raw']===undefined?!![]:![]:!![],'individualHooks':!![],'where':_0x2c6466[_0x39dc('0x1a')]?_0x2c6466[_0x39dc('0x1a')][_0x39dc('0x1f')]||null:null,'attributes':_0x2c6466['options']?_0x2c6466[_0x39dc('0x1a')][_0x39dc('0x20')]||null:null,'limit':_0x2c6466[_0x39dc('0x1a')]?_0x2c6466[_0x39dc('0x1a')][_0x39dc('0x21')]||null:null})[_0x39dc('0x22')](function(_0x149867){logger[_0x39dc('0xc')](_0x39dc('0x1d'),_0x2c6466);logger['debug'](_0x39dc('0x1d'),_0x2c6466,JSON[_0x39dc('0x11')](_0x149867));_0x4c61e3(_0x149867);})[_0x39dc('0x16')](function(_0x324f5b){logger[_0x39dc('0x12')](_0x39dc('0x1d'),_0x324f5b[_0x39dc('0x14')],_0x2c6466);_0x16cad1(_0x48aa87[_0x39dc('0x12')](0x1f4,_0x324f5b[_0x39dc('0x14')]));});});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/index.js b/server/api/whatsappTransferReport/index.js index 2d91038..21a01d6 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 _0xaba6=['show','post','create','put','/:id','update','delete','destroy','multer','path','connect-timeout','Router','fs-extra','../../components/auth/service','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','describe'];(function(_0x2d3cf2,_0x5282a6){var _0x339acf=function(_0x1c0447){while(--_0x1c0447){_0x2d3cf2['push'](_0x2d3cf2['shift']());}};_0x339acf(++_0x5282a6);}(_0xaba6,0x1ec));var _0x6aba=function(_0x26158a,_0x35e5ab){_0x26158a=_0x26158a-0x0;var _0x1cf4ac=_0xaba6[_0x26158a];return _0x1cf4ac;};'use strict';var multer=require(_0x6aba('0x0'));var util=require('util');var path=require(_0x6aba('0x1'));var timeout=require(_0x6aba('0x2'));var express=require('express');var router=express[_0x6aba('0x3')]();var fs_extra=require(_0x6aba('0x4'));var auth=require(_0x6aba('0x5'));var interaction=require(_0x6aba('0x6'));var config=require(_0x6aba('0x7'));var controller=require(_0x6aba('0x8'));router[_0x6aba('0x9')]('/',auth[_0x6aba('0xa')](),controller[_0x6aba('0xb')]);router['get'](_0x6aba('0xc'),auth[_0x6aba('0xa')](),controller[_0x6aba('0xd')]);router['get']('/:id',auth['isAuthenticated'](),controller[_0x6aba('0xe')]);router[_0x6aba('0xf')]('/',auth[_0x6aba('0xa')](),controller[_0x6aba('0x10')]);router[_0x6aba('0x11')](_0x6aba('0x12'),auth['isAuthenticated'](),controller[_0x6aba('0x13')]);router[_0x6aba('0x14')](_0x6aba('0x12'),auth[_0x6aba('0xa')](),controller[_0x6aba('0x15')]);module['exports']=router; \ No newline at end of file +var _0xe11d=['util','path','connect-timeout','Router','fs-extra','../../components/interaction/service','../../config/environment','./whatsappTransferReport.controller','get','isAuthenticated','index','/describe','/:id','show','post','create','put','update','delete','destroy','exports'];(function(_0x4465d2,_0x27b96e){var _0x4e13a2=function(_0x2661f8){while(--_0x2661f8){_0x4465d2['push'](_0x4465d2['shift']());}};_0x4e13a2(++_0x27b96e);}(_0xe11d,0x126));var _0xde11=function(_0x2da029,_0x8cb136){_0x2da029=_0x2da029-0x0;var _0x5134ff=_0xe11d[_0x2da029];return _0x5134ff;};'use strict';var multer=require('multer');var util=require(_0xde11('0x0'));var path=require(_0xde11('0x1'));var timeout=require(_0xde11('0x2'));var express=require('express');var router=express[_0xde11('0x3')]();var fs_extra=require(_0xde11('0x4'));var auth=require('../../components/auth/service');var interaction=require(_0xde11('0x5'));var config=require(_0xde11('0x6'));var controller=require(_0xde11('0x7'));router[_0xde11('0x8')]('/',auth[_0xde11('0x9')](),controller[_0xde11('0xa')]);router[_0xde11('0x8')](_0xde11('0xb'),auth[_0xde11('0x9')](),controller['describe']);router[_0xde11('0x8')](_0xde11('0xc'),auth[_0xde11('0x9')](),controller[_0xde11('0xd')]);router[_0xde11('0xe')]('/',auth[_0xde11('0x9')](),controller[_0xde11('0xf')]);router[_0xde11('0x10')]('/:id',auth[_0xde11('0x9')](),controller[_0xde11('0x11')]);router[_0xde11('0x12')]('/:id',auth[_0xde11('0x9')](),controller[_0xde11('0x13')]);module[_0xde11('0x14')]=router; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js b/server/api/whatsappTransferReport/whatsappTransferReport.attributes.js index e5a22d3..74a9f1a 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 _0x4f7b=['agent','queue','DATE','sequelize','exports','STRING','ENUM'];(function(_0x92521c,_0x1a7e36){var _0x98678d=function(_0x380bb6){while(--_0x380bb6){_0x92521c['push'](_0x92521c['shift']());}};_0x98678d(++_0x1a7e36);}(_0x4f7b,0x13e));var _0xb4f7=function(_0x29f7e6,_0x4df4e4){_0x29f7e6=_0x29f7e6-0x0;var _0x262c0f=_0x4f7b[_0x29f7e6];return _0x262c0f;};'use strict';var Sequelize=require(_0xb4f7('0x0'));module[_0xb4f7('0x1')]={'uniqueid':{'type':Sequelize[_0xb4f7('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0xb4f7('0x3')]('account',_0xb4f7('0x4'),_0xb4f7('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize[_0xb4f7('0x6')]}}; \ No newline at end of file +var _0x01d3=['sequelize','exports','STRING','ENUM','agent','queue'];(function(_0x1b241a,_0x30793c){var _0x4325aa=function(_0x543f57){while(--_0x543f57){_0x1b241a['push'](_0x1b241a['shift']());}};_0x4325aa(++_0x30793c);}(_0x01d3,0xa2));var _0x301d=function(_0x239ebd,_0x1ce664){_0x239ebd=_0x239ebd-0x0;var _0x25c9c7=_0x01d3[_0x239ebd];return _0x25c9c7;};'use strict';var Sequelize=require(_0x301d('0x0'));module[_0x301d('0x1')]={'uniqueid':{'type':Sequelize[_0x301d('0x2')],'allowNull':![]},'type':{'type':Sequelize[_0x301d('0x3')]('account',_0x301d('0x4'),_0x301d('0x5')),'allowNull':![]},'transferredAt':{'type':Sequelize['DATE']}}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.controller.js b/server/api/whatsappTransferReport/whatsappTransferReport.controller.js index 1cce076..e9f035f 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 _0xad3a=['VIRTUAL','filter','options','include','rows','show','params','includeAll','create','catch','update','body','find','zip-dir','fast-json-patch','request-promise','moment','bluebird','mustache','util','path','sox','to-csv','ejs','squel','crypto','jsforce','desk.js','papaparse','ioredis','../../components/auth/service','../../components/parsers/qs','../../config/logger','api','../../config/environment','../../config/license/util','../../mysqldb','sendStatus','end','json','offset','undefined','limit','count','status','set','Content-Range','apply','reject','save','then','destroy','error','name','send','index','WhatsappTransferReport','fieldName','key','model','map','query','keys','attributes','intersection','fields','length','hasOwnProperty','nolimit','order','sort','where','pick','filters','merge','type'];(function(_0x349c32,_0x128d37){var _0x9bd759=function(_0x10eea6){while(--_0x10eea6){_0x349c32['push'](_0x349c32['shift']());}};_0x9bd759(++_0x128d37);}(_0xad3a,0x13d));var _0xaad3=function(_0x2e4aa2,_0x11956a){_0x2e4aa2=_0x2e4aa2-0x0;var _0x5e6092=_0xad3a[_0x2e4aa2];return _0x5e6092;};'use strict';var emlformat=require('eml-format');var rimraf=require('rimraf');var zipdir=require(_0xaad3('0x0'));var jsonpatch=require(_0xaad3('0x1'));var rp=require(_0xaad3('0x2'));var moment=require(_0xaad3('0x3'));var BPromise=require(_0xaad3('0x4'));var Mustache=require(_0xaad3('0x5'));var util=require(_0xaad3('0x6'));var path=require(_0xaad3('0x7'));var sox=require(_0xaad3('0x8'));var csv=require(_0xaad3('0x9'));var ejs=require(_0xaad3('0xa'));var fs=require('fs');var fs_extra=require('fs-extra');var _=require('lodash');var squel=require(_0xaad3('0xb'));var crypto=require(_0xaad3('0xc'));var jsforce=require(_0xaad3('0xd'));var deskjs=require(_0xaad3('0xe'));var toCsv=require('to-csv');var querystring=require('querystring');var Papa=require(_0xaad3('0xf'));var Redis=require(_0xaad3('0x10'));var authService=require(_0xaad3('0x11'));var qs=require(_0xaad3('0x12'));var as=require('../../components/parsers/advancedSearch');var hardwareService=require('../../config/license/hardware');var logger=require(_0xaad3('0x13'))(_0xaad3('0x14'));var utils=require('../../config/utils');var config=require(_0xaad3('0x15'));var licenseUtil=require(_0xaad3('0x16'));var db=require(_0xaad3('0x17'))['db'];function respondWithStatusCode(_0x580439,_0x2497dd){_0x2497dd=_0x2497dd||0xcc;return function(_0x3bd4b3){if(_0x3bd4b3){return _0x580439[_0xaad3('0x18')](_0x2497dd);}return _0x580439['status'](_0x2497dd)[_0xaad3('0x19')]();};}function respondWithResult(_0x7357a3,_0x21cd5d){_0x21cd5d=_0x21cd5d||0xc8;return function(_0x562b5f){if(_0x562b5f){return _0x7357a3['status'](_0x21cd5d)[_0xaad3('0x1a')](_0x562b5f);}};}function respondWithFilteredResult(_0x9633a8,_0x50837f){return function(_0x115173){if(_0x115173){var _0x22fa15=typeof _0x50837f[_0xaad3('0x1b')]===_0xaad3('0x1c')&&typeof _0x50837f[_0xaad3('0x1d')]===_0xaad3('0x1c');var _0x36f4f2=_0x115173[_0xaad3('0x1e')];var _0x2bb688=_0x22fa15?0x0:_0x50837f[_0xaad3('0x1b')];var _0x3c2a95=_0x22fa15?_0x115173[_0xaad3('0x1e')]:_0x50837f[_0xaad3('0x1b')]+_0x50837f['limit'];var _0x583a35;if(_0x3c2a95>=_0x36f4f2){_0x3c2a95=_0x36f4f2;_0x583a35=0xc8;}else{_0x583a35=0xce;}_0x9633a8[_0xaad3('0x1f')](_0x583a35);return _0x9633a8[_0xaad3('0x20')](_0xaad3('0x21'),_0x2bb688+'-'+_0x3c2a95+'/'+_0x36f4f2)[_0xaad3('0x1a')](_0x115173);}return null;};}function patchUpdates(_0xa669df){return function(_0x5cfa2c){try{jsonpatch[_0xaad3('0x22')](_0x5cfa2c,_0xa669df,!![]);}catch(_0x2fe14c){return BPromise[_0xaad3('0x23')](_0x2fe14c);}return _0x5cfa2c[_0xaad3('0x24')]();};}function saveUpdates(_0x26e33d,_0x2233ea){return function(_0x28b685){if(_0x28b685){return _0x28b685['update'](_0x26e33d)[_0xaad3('0x25')](function(_0xbcf297){return _0xbcf297;});}return null;};}function removeEntity(_0x46f4aa,_0x318bad){return function(_0x348df8){if(_0x348df8){return _0x348df8[_0xaad3('0x26')]()['then'](function(){_0x46f4aa[_0xaad3('0x1f')](0xcc)['end']();});}};}function handleEntityNotFound(_0x56255d,_0x463c1f){return function(_0x152f12){if(!_0x152f12){_0x56255d[_0xaad3('0x18')](0x194);}return _0x152f12;};}function handleError(_0x531424,_0x2dfeaa){_0x2dfeaa=_0x2dfeaa||0x1f4;return function(_0x1865d6){logger[_0xaad3('0x27')](_0x1865d6['stack']);if(_0x1865d6[_0xaad3('0x28')]){delete _0x1865d6[_0xaad3('0x28')];}_0x531424[_0xaad3('0x1f')](_0x2dfeaa)[_0xaad3('0x29')](_0x1865d6);};}exports[_0xaad3('0x2a')]=function(_0x49a968,_0x1ea29f){var _0x383f76={},_0xdb26f={},_0x1440b9={'count':0x0,'rows':[]};var _0x25b88b=_['map'](db[_0xaad3('0x2b')]['rawAttributes'],function(_0x476e67){return{'name':_0x476e67[_0xaad3('0x2c')],'type':_0x476e67['type'][_0xaad3('0x2d')]};});_0xdb26f[_0xaad3('0x2e')]=_[_0xaad3('0x2f')](_0x25b88b,_0xaad3('0x28'));_0xdb26f[_0xaad3('0x30')]=_[_0xaad3('0x31')](_0x49a968['query']);_0xdb26f['filters']=_['intersection'](_0xdb26f[_0xaad3('0x2e')],_0xdb26f[_0xaad3('0x30')]);_0x383f76[_0xaad3('0x32')]=_[_0xaad3('0x33')](_0xdb26f[_0xaad3('0x2e')],qs[_0xaad3('0x34')](_0x49a968[_0xaad3('0x30')][_0xaad3('0x34')]));_0x383f76[_0xaad3('0x32')]=_0x383f76[_0xaad3('0x32')][_0xaad3('0x35')]?_0x383f76['attributes']:_0xdb26f[_0xaad3('0x2e')];if(!_0x49a968['query'][_0xaad3('0x36')](_0xaad3('0x37'))){_0x383f76[_0xaad3('0x1d')]=qs[_0xaad3('0x1d')](_0x49a968[_0xaad3('0x30')][_0xaad3('0x1d')]);_0x383f76[_0xaad3('0x1b')]=qs[_0xaad3('0x1b')](_0x49a968[_0xaad3('0x30')][_0xaad3('0x1b')]);}_0x383f76[_0xaad3('0x38')]=qs[_0xaad3('0x39')](_0x49a968[_0xaad3('0x30')]['sort']);_0x383f76[_0xaad3('0x3a')]=qs['filters'](_[_0xaad3('0x3b')](_0x49a968[_0xaad3('0x30')],_0xdb26f[_0xaad3('0x3c')]),_0x25b88b);if(_0x49a968[_0xaad3('0x30')]['filter']){_0x383f76[_0xaad3('0x3a')]=_[_0xaad3('0x3d')](_0x383f76[_0xaad3('0x3a')],{'$or':_[_0xaad3('0x2f')](_0x25b88b,function(_0x464634){if(_0x464634[_0xaad3('0x3e')]!==_0xaad3('0x3f')){var _0x164c95={};_0x164c95[_0x464634['name']]={'$like':'%'+_0x49a968[_0xaad3('0x30')][_0xaad3('0x40')]+'%'};return _0x164c95;}})});}_0x383f76=_[_0xaad3('0x3d')]({},_0x383f76,_0x49a968[_0xaad3('0x41')]);var _0x4e1afe={'where':_0x383f76['where']};return db[_0xaad3('0x2b')][_0xaad3('0x1e')](_0x4e1afe)[_0xaad3('0x25')](function(_0x410764){_0x1440b9['count']=_0x410764;if(_0x49a968[_0xaad3('0x30')]['includeAll']){_0x383f76[_0xaad3('0x42')]=[{'all':!![]}];}return db[_0xaad3('0x2b')]['findAll'](_0x383f76);})['then'](function(_0x2c0010){_0x1440b9[_0xaad3('0x43')]=_0x2c0010;return _0x1440b9;})[_0xaad3('0x25')](respondWithFilteredResult(_0x1ea29f,_0x383f76))['catch'](handleError(_0x1ea29f,null));};exports[_0xaad3('0x44')]=function(_0x3d3215,_0x1bf767){var _0x26a42a={'raw':!![],'where':{'id':_0x3d3215[_0xaad3('0x45')]['id']}},_0x320148={};_0x320148[_0xaad3('0x2e')]=_[_0xaad3('0x31')](db[_0xaad3('0x2b')]['rawAttributes']);_0x320148[_0xaad3('0x30')]=_[_0xaad3('0x31')](_0x3d3215['query']);_0x320148[_0xaad3('0x3c')]=_[_0xaad3('0x33')](_0x320148['model'],_0x320148['query']);_0x26a42a[_0xaad3('0x32')]=_[_0xaad3('0x33')](_0x320148[_0xaad3('0x2e')],qs[_0xaad3('0x34')](_0x3d3215['query']['fields']));_0x26a42a['attributes']=_0x26a42a['attributes'][_0xaad3('0x35')]?_0x26a42a[_0xaad3('0x32')]:_0x320148[_0xaad3('0x2e')];if(_0x3d3215['query'][_0xaad3('0x46')]){_0x26a42a[_0xaad3('0x42')]=[{'all':!![]}];}_0x26a42a=_[_0xaad3('0x3d')]({},_0x26a42a,_0x3d3215['options']);return db[_0xaad3('0x2b')]['find'](_0x26a42a)[_0xaad3('0x25')](handleEntityNotFound(_0x1bf767,null))[_0xaad3('0x25')](respondWithResult(_0x1bf767,null))['catch'](handleError(_0x1bf767,null));};exports[_0xaad3('0x47')]=function(_0x4f5547,_0x1428eb){return db[_0xaad3('0x2b')][_0xaad3('0x47')](_0x4f5547['body'],{})[_0xaad3('0x25')](respondWithResult(_0x1428eb,0xc9))[_0xaad3('0x48')](handleError(_0x1428eb,null));};exports[_0xaad3('0x49')]=function(_0x12a6d4,_0xa8b7a2){if(_0x12a6d4[_0xaad3('0x4a')]['id']){delete _0x12a6d4['body']['id'];}return db[_0xaad3('0x2b')]['find']({'where':{'id':_0x12a6d4[_0xaad3('0x45')]['id']}})['then'](handleEntityNotFound(_0xa8b7a2,null))[_0xaad3('0x25')](saveUpdates(_0x12a6d4[_0xaad3('0x4a')],null))['then'](respondWithResult(_0xa8b7a2,null))['catch'](handleError(_0xa8b7a2,null));};exports[_0xaad3('0x26')]=function(_0x17a1e9,_0x139738){return db[_0xaad3('0x2b')][_0xaad3('0x4b')]({'where':{'id':_0x17a1e9[_0xaad3('0x45')]['id']}})[_0xaad3('0x25')](handleEntityNotFound(_0x139738,null))[_0xaad3('0x25')](removeEntity(_0x139738,null))[_0xaad3('0x48')](handleError(_0x139738,null));};exports['describe']=function(_0x1ac6de,_0x3fda25){return db['WhatsappTransferReport']['describe']()[_0xaad3('0x25')](respondWithResult(_0x3fda25,null))[_0xaad3('0x48')](handleError(_0x3fda25,null));}; \ No newline at end of file +var _0xa7b0=['end','json','offset','limit','count','set','Content-Range','apply','reject','save','update','then','destroy','error','stack','name','send','map','WhatsappTransferReport','rawAttributes','fieldName','type','model','keys','query','filters','intersection','attributes','fields','length','hasOwnProperty','nolimit','sort','pick','filter','where','VIRTUAL','merge','options','includeAll','include','findAll','rows','catch','show','params','find','create','body','eml-format','rimraf','zip-dir','fast-json-patch','request-promise','moment','bluebird','path','sox','fs-extra','lodash','squel','crypto','jsforce','desk.js','querystring','papaparse','ioredis','../../components/parsers/qs','../../components/parsers/advancedSearch','../../config/logger','api','../../config/utils','../../config/environment','../../mysqldb','sendStatus','status'];(function(_0x77a933,_0x1cdd24){var _0x9df572=function(_0x3e3c6a){while(--_0x3e3c6a){_0x77a933['push'](_0x77a933['shift']());}};_0x9df572(++_0x1cdd24);}(_0xa7b0,0x1ad));var _0x0a7b=function(_0x3cafb8,_0x32860e){_0x3cafb8=_0x3cafb8-0x0;var _0x4b7f85=_0xa7b0[_0x3cafb8];return _0x4b7f85;};'use strict';var emlformat=require(_0x0a7b('0x0'));var rimraf=require(_0x0a7b('0x1'));var zipdir=require(_0x0a7b('0x2'));var jsonpatch=require(_0x0a7b('0x3'));var rp=require(_0x0a7b('0x4'));var moment=require(_0x0a7b('0x5'));var BPromise=require(_0x0a7b('0x6'));var Mustache=require('mustache');var util=require('util');var path=require(_0x0a7b('0x7'));var sox=require(_0x0a7b('0x8'));var csv=require('to-csv');var ejs=require('ejs');var fs=require('fs');var fs_extra=require(_0x0a7b('0x9'));var _=require(_0x0a7b('0xa'));var squel=require(_0x0a7b('0xb'));var crypto=require(_0x0a7b('0xc'));var jsforce=require(_0x0a7b('0xd'));var deskjs=require(_0x0a7b('0xe'));var toCsv=require('to-csv');var querystring=require(_0x0a7b('0xf'));var Papa=require(_0x0a7b('0x10'));var Redis=require(_0x0a7b('0x11'));var authService=require('../../components/auth/service');var qs=require(_0x0a7b('0x12'));var as=require(_0x0a7b('0x13'));var hardwareService=require('../../config/license/hardware');var logger=require(_0x0a7b('0x14'))(_0x0a7b('0x15'));var utils=require(_0x0a7b('0x16'));var config=require(_0x0a7b('0x17'));var licenseUtil=require('../../config/license/util');var db=require(_0x0a7b('0x18'))['db'];function respondWithStatusCode(_0x198214,_0x1683a4){_0x1683a4=_0x1683a4||0xcc;return function(_0x286dc0){if(_0x286dc0){return _0x198214[_0x0a7b('0x19')](_0x1683a4);}return _0x198214[_0x0a7b('0x1a')](_0x1683a4)[_0x0a7b('0x1b')]();};}function respondWithResult(_0x2da37d,_0x277b1d){_0x277b1d=_0x277b1d||0xc8;return function(_0x12ea19){if(_0x12ea19){return _0x2da37d[_0x0a7b('0x1a')](_0x277b1d)[_0x0a7b('0x1c')](_0x12ea19);}};}function respondWithFilteredResult(_0x5e4638,_0x182fa9){return function(_0x11ccca){if(_0x11ccca){var _0x58a3f9=typeof _0x182fa9[_0x0a7b('0x1d')]==='undefined'&&typeof _0x182fa9[_0x0a7b('0x1e')]==='undefined';var _0x2ebfec=_0x11ccca['count'];var _0x10afcf=_0x58a3f9?0x0:_0x182fa9['offset'];var _0x55aec2=_0x58a3f9?_0x11ccca[_0x0a7b('0x1f')]:_0x182fa9[_0x0a7b('0x1d')]+_0x182fa9[_0x0a7b('0x1e')];var _0x4c3bd8;if(_0x55aec2>=_0x2ebfec){_0x55aec2=_0x2ebfec;_0x4c3bd8=0xc8;}else{_0x4c3bd8=0xce;}_0x5e4638[_0x0a7b('0x1a')](_0x4c3bd8);return _0x5e4638[_0x0a7b('0x20')](_0x0a7b('0x21'),_0x10afcf+'-'+_0x55aec2+'/'+_0x2ebfec)[_0x0a7b('0x1c')](_0x11ccca);}return null;};}function patchUpdates(_0x10b85f){return function(_0x553fc8){try{jsonpatch[_0x0a7b('0x22')](_0x553fc8,_0x10b85f,!![]);}catch(_0x1731f7){return BPromise[_0x0a7b('0x23')](_0x1731f7);}return _0x553fc8[_0x0a7b('0x24')]();};}function saveUpdates(_0x3981d4,_0x462310){return function(_0x2beda6){if(_0x2beda6){return _0x2beda6[_0x0a7b('0x25')](_0x3981d4)[_0x0a7b('0x26')](function(_0x1f388d){return _0x1f388d;});}return null;};}function removeEntity(_0x106d90,_0x153758){return function(_0x178ee6){if(_0x178ee6){return _0x178ee6[_0x0a7b('0x27')]()[_0x0a7b('0x26')](function(){_0x106d90[_0x0a7b('0x1a')](0xcc)['end']();});}};}function handleEntityNotFound(_0x5768a9,_0x38e8fd){return function(_0x441889){if(!_0x441889){_0x5768a9['sendStatus'](0x194);}return _0x441889;};}function handleError(_0x84418f,_0x35700c){_0x35700c=_0x35700c||0x1f4;return function(_0x2c2371){logger[_0x0a7b('0x28')](_0x2c2371[_0x0a7b('0x29')]);if(_0x2c2371[_0x0a7b('0x2a')]){delete _0x2c2371[_0x0a7b('0x2a')];}_0x84418f[_0x0a7b('0x1a')](_0x35700c)[_0x0a7b('0x2b')](_0x2c2371);};}exports['index']=function(_0x520578,_0x251ffc){var _0x258661={},_0x352731={},_0x4b0730={'count':0x0,'rows':[]};var _0x3c7561=_[_0x0a7b('0x2c')](db[_0x0a7b('0x2d')][_0x0a7b('0x2e')],function(_0x51718c){return{'name':_0x51718c[_0x0a7b('0x2f')],'type':_0x51718c[_0x0a7b('0x30')]['key']};});_0x352731[_0x0a7b('0x31')]=_[_0x0a7b('0x2c')](_0x3c7561,_0x0a7b('0x2a'));_0x352731['query']=_[_0x0a7b('0x32')](_0x520578[_0x0a7b('0x33')]);_0x352731[_0x0a7b('0x34')]=_[_0x0a7b('0x35')](_0x352731['model'],_0x352731[_0x0a7b('0x33')]);_0x258661[_0x0a7b('0x36')]=_[_0x0a7b('0x35')](_0x352731[_0x0a7b('0x31')],qs[_0x0a7b('0x37')](_0x520578[_0x0a7b('0x33')][_0x0a7b('0x37')]));_0x258661[_0x0a7b('0x36')]=_0x258661[_0x0a7b('0x36')][_0x0a7b('0x38')]?_0x258661['attributes']:_0x352731[_0x0a7b('0x31')];if(!_0x520578[_0x0a7b('0x33')][_0x0a7b('0x39')](_0x0a7b('0x3a'))){_0x258661[_0x0a7b('0x1e')]=qs[_0x0a7b('0x1e')](_0x520578[_0x0a7b('0x33')]['limit']);_0x258661[_0x0a7b('0x1d')]=qs[_0x0a7b('0x1d')](_0x520578[_0x0a7b('0x33')][_0x0a7b('0x1d')]);}_0x258661['order']=qs[_0x0a7b('0x3b')](_0x520578[_0x0a7b('0x33')]['sort']);_0x258661['where']=qs[_0x0a7b('0x34')](_[_0x0a7b('0x3c')](_0x520578[_0x0a7b('0x33')],_0x352731[_0x0a7b('0x34')]),_0x3c7561);if(_0x520578['query'][_0x0a7b('0x3d')]){_0x258661[_0x0a7b('0x3e')]=_['merge'](_0x258661['where'],{'$or':_['map'](_0x3c7561,function(_0x613985){if(_0x613985[_0x0a7b('0x30')]!==_0x0a7b('0x3f')){var _0x36ee07={};_0x36ee07[_0x613985['name']]={'$like':'%'+_0x520578['query'][_0x0a7b('0x3d')]+'%'};return _0x36ee07;}})});}_0x258661=_[_0x0a7b('0x40')]({},_0x258661,_0x520578[_0x0a7b('0x41')]);var _0x2bece9={'where':_0x258661[_0x0a7b('0x3e')]};return db[_0x0a7b('0x2d')][_0x0a7b('0x1f')](_0x2bece9)['then'](function(_0x3823c5){_0x4b0730[_0x0a7b('0x1f')]=_0x3823c5;if(_0x520578[_0x0a7b('0x33')][_0x0a7b('0x42')]){_0x258661[_0x0a7b('0x43')]=[{'all':!![]}];}return db[_0x0a7b('0x2d')][_0x0a7b('0x44')](_0x258661);})[_0x0a7b('0x26')](function(_0x5f9244){_0x4b0730[_0x0a7b('0x45')]=_0x5f9244;return _0x4b0730;})['then'](respondWithFilteredResult(_0x251ffc,_0x258661))[_0x0a7b('0x46')](handleError(_0x251ffc,null));};exports[_0x0a7b('0x47')]=function(_0x440d2b,_0x2f3e00){var _0x1646df={'raw':!![],'where':{'id':_0x440d2b[_0x0a7b('0x48')]['id']}},_0x305b91={};_0x305b91['model']=_[_0x0a7b('0x32')](db[_0x0a7b('0x2d')]['rawAttributes']);_0x305b91['query']=_[_0x0a7b('0x32')](_0x440d2b[_0x0a7b('0x33')]);_0x305b91[_0x0a7b('0x34')]=_[_0x0a7b('0x35')](_0x305b91['model'],_0x305b91[_0x0a7b('0x33')]);_0x1646df[_0x0a7b('0x36')]=_[_0x0a7b('0x35')](_0x305b91['model'],qs['fields'](_0x440d2b[_0x0a7b('0x33')]['fields']));_0x1646df[_0x0a7b('0x36')]=_0x1646df['attributes'][_0x0a7b('0x38')]?_0x1646df[_0x0a7b('0x36')]:_0x305b91[_0x0a7b('0x31')];if(_0x440d2b['query'][_0x0a7b('0x42')]){_0x1646df[_0x0a7b('0x43')]=[{'all':!![]}];}_0x1646df=_[_0x0a7b('0x40')]({},_0x1646df,_0x440d2b['options']);return db[_0x0a7b('0x2d')][_0x0a7b('0x49')](_0x1646df)[_0x0a7b('0x26')](handleEntityNotFound(_0x2f3e00,null))[_0x0a7b('0x26')](respondWithResult(_0x2f3e00,null))[_0x0a7b('0x46')](handleError(_0x2f3e00,null));};exports[_0x0a7b('0x4a')]=function(_0x1d41cf,_0x50bf48){return db[_0x0a7b('0x2d')][_0x0a7b('0x4a')](_0x1d41cf[_0x0a7b('0x4b')],{})[_0x0a7b('0x26')](respondWithResult(_0x50bf48,0xc9))[_0x0a7b('0x46')](handleError(_0x50bf48,null));};exports['update']=function(_0xa453d7,_0x26a47e){if(_0xa453d7[_0x0a7b('0x4b')]['id']){delete _0xa453d7['body']['id'];}return db[_0x0a7b('0x2d')]['find']({'where':{'id':_0xa453d7['params']['id']}})[_0x0a7b('0x26')](handleEntityNotFound(_0x26a47e,null))[_0x0a7b('0x26')](saveUpdates(_0xa453d7[_0x0a7b('0x4b')],null))[_0x0a7b('0x26')](respondWithResult(_0x26a47e,null))[_0x0a7b('0x46')](handleError(_0x26a47e,null));};exports[_0x0a7b('0x27')]=function(_0x8bb64f,_0x1b04d1){return db[_0x0a7b('0x2d')]['find']({'where':{'id':_0x8bb64f[_0x0a7b('0x48')]['id']}})[_0x0a7b('0x26')](handleEntityNotFound(_0x1b04d1,null))[_0x0a7b('0x26')](removeEntity(_0x1b04d1,null))[_0x0a7b('0x46')](handleError(_0x1b04d1,null));};exports['describe']=function(_0x985082,_0x2970d5){return db[_0x0a7b('0x2d')]['describe']()['then'](respondWithResult(_0x2970d5,null))[_0x0a7b('0x46')](handleError(_0x2970d5,null));}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.model.js b/server/api/whatsappTransferReport/whatsappTransferReport.model.js index 3be45b8..5734f63 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 _0x637d=['./whatsappTransferReport.attributes','define','WhatsappTransferReport','report_whatsapp_transfer','uniqueid','lodash','util','../../config/logger','api','request-promise','path','rimraf','../../config/environment'];(function(_0x8f0542,_0x5a0282){var _0x290ab7=function(_0x19ade8){while(--_0x19ade8){_0x8f0542['push'](_0x8f0542['shift']());}};_0x290ab7(++_0x5a0282);}(_0x637d,0x109));var _0xd637=function(_0x2d7966,_0x53fb36){_0x2d7966=_0x2d7966-0x0;var _0x22a950=_0x637d[_0x2d7966];return _0x22a950;};'use strict';var _=require(_0xd637('0x0'));var util=require(_0xd637('0x1'));var logger=require(_0xd637('0x2'))(_0xd637('0x3'));var moment=require('moment');var BPromise=require('bluebird');var rp=require(_0xd637('0x4'));var fs=require('fs');var path=require(_0xd637('0x5'));var rimraf=require(_0xd637('0x6'));var config=require(_0xd637('0x7'));var attributes=require(_0xd637('0x8'));module['exports']=function(_0x1b5d40,_0x79a117){return _0x1b5d40[_0xd637('0x9')](_0xd637('0xa'),attributes,{'tableName':_0xd637('0xb'),'paranoid':![],'indexes':[{'name':_0xd637('0xc'),'fields':[_0xd637('0xc')]}],'timestamps':!![]});}; \ No newline at end of file +var _0x4c46=['report_whatsapp_transfer','uniqueid','lodash','util','moment','request-promise','path','rimraf','../../config/environment','./whatsappTransferReport.attributes','exports','define','WhatsappTransferReport'];(function(_0x422d6a,_0x20d24f){var _0x3bff4b=function(_0x3789a8){while(--_0x3789a8){_0x422d6a['push'](_0x422d6a['shift']());}};_0x3bff4b(++_0x20d24f);}(_0x4c46,0x17b));var _0x64c4=function(_0x1602c8,_0x59189d){_0x1602c8=_0x1602c8-0x0;var _0x47bf32=_0x4c46[_0x1602c8];return _0x47bf32;};'use strict';var _=require(_0x64c4('0x0'));var util=require(_0x64c4('0x1'));var logger=require('../../config/logger')('api');var moment=require(_0x64c4('0x2'));var BPromise=require('bluebird');var rp=require(_0x64c4('0x3'));var fs=require('fs');var path=require(_0x64c4('0x4'));var rimraf=require(_0x64c4('0x5'));var config=require(_0x64c4('0x6'));var attributes=require(_0x64c4('0x7'));module[_0x64c4('0x8')]=function(_0x535c29,_0x589321){return _0x535c29[_0x64c4('0x9')](_0x64c4('0xa'),attributes,{'tableName':_0x64c4('0xb'),'paranoid':![],'indexes':[{'name':_0x64c4('0xc'),'fields':[_0x64c4('0xc')]}],'timestamps':!![]});}; \ No newline at end of file diff --git a/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js b/server/api/whatsappTransferReport/whatsappTransferReport.rpc.js index e78b739..880b718 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 _0x00bc=['request\x20sent','debug','stringify','error','message','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','client','request','then','info','WhatsappTransferReport,\x20%s,\x20%s'];(function(_0x35dab2,_0xa93213){var _0x237b23=function(_0x1f6907){while(--_0x1f6907){_0x35dab2['push'](_0x35dab2['shift']());}};_0x237b23(++_0xa93213);}(_0x00bc,0x18d));var _0xc00b=function(_0x1152c1,_0x5d31cb){_0x1152c1=_0x1152c1-0x0;var _0x997148=_0x00bc[_0x1152c1];return _0x997148;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xc00b('0x0'));var rs=require(_0xc00b('0x1'));var fs=require('fs');var Redis=require(_0xc00b('0x2'));var db=require(_0xc00b('0x3'))['db'];var utils=require(_0xc00b('0x4'));var logger=require('../../config/logger')(_0xc00b('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xc00b('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x422a2b,_0x28ef4c,_0x523152){return new BPromise(function(_0x11e6ff,_0x54c19b){return client[_0xc00b('0x7')](_0x422a2b,_0x523152)[_0xc00b('0x8')](function(_0x2ad3b0){logger[_0xc00b('0x9')](_0xc00b('0xa'),_0x28ef4c,_0xc00b('0xb'));logger[_0xc00b('0xc')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x28ef4c,_0xc00b('0xb'),JSON[_0xc00b('0xd')](_0x2ad3b0));if(_0x2ad3b0['error']){if(_0x2ad3b0[_0xc00b('0xe')]['code']===0x1f4){logger[_0xc00b('0xe')](_0xc00b('0xa'),_0x28ef4c,_0x2ad3b0[_0xc00b('0xe')][_0xc00b('0xf')]);return _0x54c19b(_0x2ad3b0['error'][_0xc00b('0xf')]);}logger[_0xc00b('0xe')](_0xc00b('0xa'),_0x28ef4c,_0x2ad3b0['error'][_0xc00b('0xf')]);return _0x11e6ff(_0x2ad3b0[_0xc00b('0xe')][_0xc00b('0xf')]);}else{logger[_0xc00b('0x9')](_0xc00b('0xa'),_0x28ef4c,_0xc00b('0xb'));_0x11e6ff(_0x2ad3b0['result']['message']);}})[_0xc00b('0x10')](function(_0x1f7e9f){logger[_0xc00b('0xe')](_0xc00b('0xa'),_0x28ef4c,_0x1f7e9f);_0x54c19b(_0x1f7e9f);});});} \ No newline at end of file +var _0x98df=['code','message','result','util','bluebird','randomstring','ioredis','../../config/utils','../../config/environment','client','http','request','then','info','WhatsappTransferReport,\x20%s,\x20%s','request\x20sent','debug','stringify','error'];(function(_0x1261ac,_0x1ce73e){var _0xab044f=function(_0x3d533d){while(--_0x3d533d){_0x1261ac['push'](_0x1261ac['shift']());}};_0xab044f(++_0x1ce73e);}(_0x98df,0x159));var _0xf98d=function(_0x533cfc,_0xaea06f){_0x533cfc=_0x533cfc-0x0;var _0x3206de=_0x98df[_0x533cfc];return _0x3206de;};'use strict';var _=require('lodash');var util=require(_0xf98d('0x0'));var moment=require('moment');var BPromise=require(_0xf98d('0x1'));var rs=require(_0xf98d('0x2'));var fs=require('fs');var Redis=require(_0xf98d('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xf98d('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0xf98d('0x5'));var jayson=require('jayson/promise');var client=jayson[_0xf98d('0x6')][_0xf98d('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x4bc0fb,_0x57f3e5,_0x1baad3){return new BPromise(function(_0x25932e,_0x40399f){return client[_0xf98d('0x8')](_0x4bc0fb,_0x1baad3)[_0xf98d('0x9')](function(_0x525318){logger[_0xf98d('0xa')](_0xf98d('0xb'),_0x57f3e5,_0xf98d('0xc'));logger[_0xf98d('0xd')]('WhatsappTransferReport,\x20%s,\x20%s,\x20%s',_0x57f3e5,'request\x20sent',JSON[_0xf98d('0xe')](_0x525318));if(_0x525318['error']){if(_0x525318[_0xf98d('0xf')][_0xf98d('0x10')]===0x1f4){logger[_0xf98d('0xf')](_0xf98d('0xb'),_0x57f3e5,_0x525318[_0xf98d('0xf')][_0xf98d('0x11')]);return _0x40399f(_0x525318[_0xf98d('0xf')]['message']);}logger[_0xf98d('0xf')](_0xf98d('0xb'),_0x57f3e5,_0x525318[_0xf98d('0xf')][_0xf98d('0x11')]);return _0x25932e(_0x525318[_0xf98d('0xf')][_0xf98d('0x11')]);}else{logger[_0xf98d('0xa')](_0xf98d('0xb'),_0x57f3e5,_0xf98d('0xc'));_0x25932e(_0x525318[_0xf98d('0x12')][_0xf98d('0x11')]);}})['catch'](function(_0x305cea){logger['error']('WhatsappTransferReport,\x20%s,\x20%s',_0x57f3e5,_0x305cea);_0x40399f(_0x305cea);});});} \ No newline at end of file diff --git a/server/app.js b/server/app.js index 3c2a95a..a292e1e 100644 --- a/server/app.js +++ b/server/app.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x81bd=['join','Offline\x20apps:','status','None','log','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','error','Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s','exit','lodash','./mysqldb','./config/seedDB','./config/license','./rpc','./config/environment','./config/logger','./config/pm2','./config/pm2/config','./config/schedule','./config/schedule/whatsapp','./config/schedule/transcribe','./config/schedule/cloud-provider','then','default','listen','info','start','filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','online'];(function(_0x486c22,_0x306c6d){var _0xbad918=function(_0x419503){while(--_0x419503){_0x486c22['push'](_0x486c22['shift']());}};_0xbad918(++_0x306c6d);}(_0x81bd,0x7c));var _0xd81b=function(_0x378fc7,_0x5181a3){_0x378fc7=_0x378fc7-0x0;var _0x44dfec=_0x81bd[_0x378fc7];return _0x44dfec;};'use strict';var _=require(_0xd81b('0x0'));var db=require(_0xd81b('0x1'))['db'];var seedDb=require(_0xd81b('0x2'));var checkLicense=require(_0xd81b('0x3'));var rpc=require(_0xd81b('0x4'));var config=require(_0xd81b('0x5'));var logger=require(_0xd81b('0x6'))('app');var pm2=require(_0xd81b('0x7'));var pm2Config=require(_0xd81b('0x8'));var schedule=require(_0xd81b('0x9'));var chat=require('./config/schedule/chat');var whatsapp=require(_0xd81b('0xa'));var transcribe=require(_0xd81b('0xb'));var provider=require(_0xd81b('0xc'));function main(){return db['sequelize']['sync']()[_0xd81b('0xd')](function(){if(config['seedDB']){return seedDb[_0xd81b('0xe')]();}})[_0xd81b('0xd')](function(){return checkLicense[_0xd81b('0xe')]();})[_0xd81b('0xd')](function(){return rpc[_0xd81b('0xf')]();})[_0xd81b('0xd')](function(_0x4391be){logger[_0xd81b('0x10')](_0x4391be);return chat[_0xd81b('0x11')]();})[_0xd81b('0xd')](function(){return whatsapp[_0xd81b('0x11')]();})[_0xd81b('0xd')](function(){return schedule[_0xd81b('0x11')]();})['then'](function(){return transcribe[_0xd81b('0x11')]();})['then'](function(){return provider[_0xd81b('0x11')]();})[_0xd81b('0xd')](function(_0x5f0b6b){logger[_0xd81b('0x10')](_0x5f0b6b);return pm2['start'](pm2Config);})[_0xd81b('0xd')](function(_0x41bf7a){var _0x6c6041=_0x41bf7a[_0xd81b('0x12')](function(_0x128162){return typeof _0x128162['exitCode']===_0xd81b('0x13')&&_0x128162[_0xd81b('0x14')]>=0x0;});if(_0x6c6041['length']>0x0){throw new Error(_0x6c6041[_0xd81b('0x15')]+_0xd81b('0x16')+_[_0xd81b('0x17')](_0x6c6041,function(_0x15e860){return'\x22'+_0x15e860[_0xd81b('0x18')][_0xd81b('0x19')]+'\x22';}));}logger[_0xd81b('0x10')](_0xd81b('0x1a'),_[_0xd81b('0x17')](_[_0xd81b('0x12')](_0x41bf7a,{'status':_0xd81b('0x1b')}),_0xd81b('0x19'))[_0xd81b('0x1c')]());logger[_0xd81b('0x10')](_0xd81b('0x1d'),_[_0xd81b('0x17')](_['filter'](_0x41bf7a,function(_0x4d566e){return _0x4d566e[_0xd81b('0x1e')]!==_0xd81b('0x1b');}),_0xd81b('0x19'))['join']()||_0xd81b('0x1f'));console[_0xd81b('0x20')]('App\x20Ready!');})[_0xd81b('0x21')](function(_0x13d687){console[_0xd81b('0x20')](_0xd81b('0x22'),_0x13d687);logger[_0xd81b('0x23')](_0xd81b('0x24'),_0x13d687);process[_0xd81b('0x25')](0x1);});}main(); \ No newline at end of file +var _0x88b0=['filter','number','exitCode','length','\x20processes\x20failed\x20at\x20startup:\x20','map','pm2_env','name','Online\x20apps:','join','Offline\x20apps:','status','online','log','App\x20Ready!','catch','Server\x20failed\x20to\x20start\x20due\x20to\x20error!','lodash','./mysqldb','./rpc','./config/environment','./config/logger','app','./config/pm2/config','./config/schedule','./config/schedule/chat','./config/schedule/cloud-provider','sequelize','sync','then','seedDB','default','info','start'];(function(_0xfb0cfd,_0x500179){var _0x2fd8aa=function(_0xccb501){while(--_0xccb501){_0xfb0cfd['push'](_0xfb0cfd['shift']());}};_0x2fd8aa(++_0x500179);}(_0x88b0,0x1cb));var _0x088b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x88b0[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0x088b('0x0'));var db=require(_0x088b('0x1'))['db'];var seedDb=require('./config/seedDB');var checkLicense=require('./config/license');var rpc=require(_0x088b('0x2'));var config=require(_0x088b('0x3'));var logger=require(_0x088b('0x4'))(_0x088b('0x5'));var pm2=require('./config/pm2');var pm2Config=require(_0x088b('0x6'));var schedule=require(_0x088b('0x7'));var chat=require(_0x088b('0x8'));var whatsapp=require('./config/schedule/whatsapp');var transcribe=require('./config/schedule/transcribe');var provider=require(_0x088b('0x9'));function main(){return db[_0x088b('0xa')][_0x088b('0xb')]()[_0x088b('0xc')](function(){if(config[_0x088b('0xd')]){return seedDb[_0x088b('0xe')]();}})[_0x088b('0xc')](function(){return checkLicense['default']();})[_0x088b('0xc')](function(){return rpc['listen']();})[_0x088b('0xc')](function(_0x4c50a6){logger[_0x088b('0xf')](_0x4c50a6);return chat[_0x088b('0x10')]();})['then'](function(){return whatsapp['start']();})[_0x088b('0xc')](function(){return schedule[_0x088b('0x10')]();})[_0x088b('0xc')](function(){return transcribe['start']();})[_0x088b('0xc')](function(){return provider[_0x088b('0x10')]();})[_0x088b('0xc')](function(_0x4fa81a){logger[_0x088b('0xf')](_0x4fa81a);return pm2[_0x088b('0x10')](pm2Config);})[_0x088b('0xc')](function(_0xf6bd53){var _0x1ec5e5=_0xf6bd53[_0x088b('0x11')](function(_0x462392){return typeof _0x462392['exitCode']===_0x088b('0x12')&&_0x462392[_0x088b('0x13')]>=0x0;});if(_0x1ec5e5[_0x088b('0x14')]>0x0){throw new Error(_0x1ec5e5[_0x088b('0x14')]+_0x088b('0x15')+_[_0x088b('0x16')](_0x1ec5e5,function(_0x54a27e){return'\x22'+_0x54a27e[_0x088b('0x17')][_0x088b('0x18')]+'\x22';}));}logger[_0x088b('0xf')](_0x088b('0x19'),_[_0x088b('0x16')](_['filter'](_0xf6bd53,{'status':'online'}),_0x088b('0x18'))[_0x088b('0x1a')]());logger[_0x088b('0xf')](_0x088b('0x1b'),_[_0x088b('0x16')](_[_0x088b('0x11')](_0xf6bd53,function(_0x565220){return _0x565220[_0x088b('0x1c')]!==_0x088b('0x1d');}),_0x088b('0x18'))['join']()||'None');console[_0x088b('0x1e')](_0x088b('0x1f'));})[_0x088b('0x20')](function(_0x556006){console[_0x088b('0x1e')](_0x088b('0x21'),_0x556006);logger['error']('Server\x20failed\x20to\x20start\x20due\x20to\x20error:\x20%s',_0x556006);process['exit'](0x1);});}main(); \ No newline at end of file diff --git a/server/components/auth/service.js b/server/components/auth/service.js index d4c4a5e..cddaf47 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 _0xf3cd=['role','name','userpic','permissions','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','allowmessenger','passwordResetAt','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarDnd','phoneBarEnableDtmfTone','phoneBarEnableSettings','phoneBarExpires','phoneBarPrefixRequired','phoneBarRemoteControl','phoneBarRemoteControlPort','hotdesk','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','chatAutoanswerDelay','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswer','faxAutoanswerDelay','whatsappAutoanswerDelay','isChatInteractionAuthorized','isAuthenticated','use','user','ChatInteraction','findOne','params','closed','disposition','then','status','unmanaged','json','authorization','startsWith','Basic','User','authenticate','catch','Bearer','query','apikey','getUuid','find','sub','allowedLoginAttempts','isEqual','apiKeyNonce','nonce','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','blockDuration','add','minutes','Invalid\x20API\x20access\x20key','User\x20not\x20found.','User\x20object\x20not\x20found.','canUpdate','getLicense','Forbidden','isWebrtcLicence','webrtc','isMiddleware','cookie','motion.token','send','retrieveApiKey','isNil','apiKeyIat','regenerateApiKey','test','Sequelize','The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.','ValidationError','updatePasswordsHistory','length','splice','encryptString','promisify','sign','secret','payload','options','verify','randomBytes','toString','hex','floor','now','HS512','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','../encryptor','lodash','express-jwt','composable-middleware','basic-auth','bluebird','util','moment','secrets','session'];(function(_0x23f5f5,_0x4717d9){var _0x16d61f=function(_0x5e5410){while(--_0x5e5410){_0x23f5f5['push'](_0x23f5f5['shift']());}};_0x16d61f(++_0x4717d9);}(_0xf3cd,0xfe));var _0xdf3c=function(_0x582274,_0x2cbd9c){_0x582274=_0x582274-0x0;var _0x8f14d3=_0xf3cd[_0x582274];return _0x8f14d3;};'use strict';var db=require(_0xdf3c('0x0'))['db'];var config=require(_0xdf3c('0x1'));var hardwareConf=require(_0xdf3c('0x2'));var licenseUtil=require(_0xdf3c('0x3'));var encryptor=require(_0xdf3c('0x4'));var _=require(_0xdf3c('0x5'));var jwt=require('jsonwebtoken');var expressJwt=require(_0xdf3c('0x6'));var compose=require(_0xdf3c('0x7'));var basicAuth=require(_0xdf3c('0x8'));var crypto=require('crypto');var BPromise=require(_0xdf3c('0x9'));var util=require(_0xdf3c('0xa'));var moment=require(_0xdf3c('0xb'));var validateJwt=expressJwt({'secret':config[_0xdf3c('0xc')][_0xdf3c('0xd')]});var userAttributes=['id',_0xdf3c('0xe'),'fullname',_0xdf3c('0xf'),'internal','email',_0xdf3c('0x10'),_0xdf3c('0x11'),'md5secret',_0xdf3c('0x12'),_0xdf3c('0x13'),_0xdf3c('0x14'),_0xdf3c('0x15'),_0xdf3c('0x16'),_0xdf3c('0x17'),_0xdf3c('0x18'),_0xdf3c('0x19'),'lastLoginAt',_0xdf3c('0x1a'),_0xdf3c('0x1b'),_0xdf3c('0x1c'),_0xdf3c('0x1d'),'alias',_0xdf3c('0x1e'),_0xdf3c('0x1f'),_0xdf3c('0x20'),'phoneBarEnableRecording',_0xdf3c('0x21'),_0xdf3c('0x22'),_0xdf3c('0x23'),_0xdf3c('0x24'),_0xdf3c('0x25'),_0xdf3c('0x26'),_0xdf3c('0x27'),_0xdf3c('0x28'),_0xdf3c('0x29'),_0xdf3c('0x2a'),'settingsEnabled',_0xdf3c('0x2b'),_0xdf3c('0x2c'),_0xdf3c('0x2d'),_0xdf3c('0x2e'),_0xdf3c('0x2f'),_0xdf3c('0x30'),_0xdf3c('0x31'),_0xdf3c('0x32'),_0xdf3c('0x33'),_0xdf3c('0x34'),_0xdf3c('0x35'),_0xdf3c('0x36'),_0xdf3c('0x37'),'openchannelAutoanswerDelay','faxAutoanswer',_0xdf3c('0x38'),'whatsappAutoanswer',_0xdf3c('0x39')];exports[_0xdf3c('0x3a')]=function(){return this[_0xdf3c('0x3b')](!![])[_0xdf3c('0x3c')](function(_0x33652f,_0x36ba1c,_0x50d8ca){if(_0x33652f[_0xdf3c('0x3d')]){_0x50d8ca();}else{return db[_0xdf3c('0x3e')][_0xdf3c('0x3f')]({'where':{'id':_0x33652f[_0xdf3c('0x40')]['id']},'attributes':['id',_0xdf3c('0x41'),_0xdf3c('0x42')],'raw':!![]})[_0xdf3c('0x43')](function(_0x155f54){if(_0x155f54&&_0x155f54[_0xdf3c('0x41')]){return _0x36ba1c[_0xdf3c('0x44')](_0x155f54['disposition']===_0xdf3c('0x45')?0x195:0x193)[_0xdf3c('0x46')]({'message':_0x155f54['disposition']===_0xdf3c('0x45')?'Unmanaged.':'Forbidden.'});}else{_0x50d8ca();}})['catch'](function(_0x14aac9){_0x50d8ca(_0x14aac9);});}});};exports[_0xdf3c('0x3b')]=function isAuthenticated(_0x52b8f6){return compose()['use'](function(_0x37ecfd,_0x1f2ce4,_0xd3cfcb){var _0x1ccdd4;if(_0x37ecfd['headers'][_0xdf3c('0x47')]){if(_[_0xdf3c('0x48')](_0x37ecfd['headers']['authorization'],_0xdf3c('0x49'))){var _0x46f0e3=basicAuth(_0x37ecfd);db[_0xdf3c('0x4a')]['find']({'where':{'name':_0x46f0e3[_0xdf3c('0xf')]}})[_0xdf3c('0x43')](function(_0x21e7b8){if(!_0x21e7b8||!_0x21e7b8[_0xdf3c('0x4b')](_0x46f0e3['pass'])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':'Wrong\x20credentials.'});}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x21e7b8['id']};_0xd3cfcb();})[_0xdf3c('0x4c')](function(_0x217a65){_0xd3cfcb(_0x217a65);});}else if(_[_0xdf3c('0x48')](_0x37ecfd['headers'][_0xdf3c('0x47')],_0xdf3c('0x4d'))){validateJwt(_0x37ecfd,_0x1f2ce4,_0xd3cfcb);}else{if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4[_0xdf3c('0x44')](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}}}else if(_0x37ecfd[_0xdf3c('0x4e')][_0xdf3c('0x4f')]){try{var _0x5ddd21={'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};verifyJwt(_0x37ecfd['query'][_0xdf3c('0x4f')],_0x5ddd21)['then'](function(_0x57faba){return db['User'][_0xdf3c('0x51')]({'where':{'id':_0x57faba[_0xdf3c('0x52')]}})[_0xdf3c('0x43')](function(_0x29b5b7){_0x1ccdd4=_0x29b5b7;return db['Setting']['findOne']({'where':{'id':0x1},'attributes':[_0xdf3c('0x53'),'blockDuration'],'raw':!![]});})[_0xdf3c('0x43')](function(_0x17b502){if(!_0x1ccdd4||!_[_0xdf3c('0x54')](_0x1ccdd4[_0xdf3c('0x55')],_0x57faba[_0xdf3c('0x56')])){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x57')});}if(_0x1ccdd4[_0xdf3c('0x58')]){return _0x1f2ce4['status'](0x191)[_0xdf3c('0x46')]({'message':'Invalid\x20API\x20access\x20key'});}if(_0x1ccdd4['blocked']){if(_0x17b502[_0xdf3c('0x59')]>0x0){if(moment(_0x1ccdd4['blockedAt'])[_0xdf3c('0x5a')](_0x17b502['blockDuration'],_0xdf3c('0x5b'))>moment()){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}else{return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});}}_0x37ecfd[_0xdf3c('0x3d')]={'id':_0x1ccdd4['id']};_0xd3cfcb();});})[_0xdf3c('0x4c')](function(){return _0x1f2ce4[_0xdf3c('0x44')](0x191)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5c')});});}catch(_0x57e0ab){_0xd3cfcb(_0x57e0ab);}}else if(_0x52b8f6){_0xd3cfcb();}else{return _0x1f2ce4['status'](0x193)[_0xdf3c('0x46')]({'message':'Unknown\x20authorization\x20format'});}})[_0xdf3c('0x3c')](function(_0x14d8e1,_0x46194d,_0x328b18){if(_0x14d8e1['user']){db['User'][_0xdf3c('0x51')]({'where':{'id':_0x14d8e1[_0xdf3c('0x3d')]['id']},'attributes':userAttributes})[_0xdf3c('0x43')](function(_0x4c59ef){if(!_0x4c59ef){return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5d')});}_0x14d8e1[_0xdf3c('0x3d')]=_0x4c59ef;_0x328b18();})['catch'](function(_0x127685){_0x328b18(_0x127685);});}else if(_0x52b8f6){_0x328b18();}else{return _0x46194d[_0xdf3c('0x44')](0x194)[_0xdf3c('0x46')]({'message':_0xdf3c('0x5e')});}});};exports[_0xdf3c('0x5f')]=function canUpdate(){return compose()['use'](function(_0x410aaf,_0x286b72,_0x437443){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x344f1e){if(_0x344f1e['update']){_0x437443();}else{return _0x286b72['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})['catch'](function(_0x5c9885){_0x437443(_0x5c9885);});});};exports[_0xdf3c('0x62')]=function isWebrtcLicence(){return compose()[_0xdf3c('0x3c')](function(_0x46b2bd,_0x2aeb29,_0xaae4bc){return licenseUtil[_0xdf3c('0x60')]()[_0xdf3c('0x43')](function(_0x84c5c2){if(_0x84c5c2[_0xdf3c('0x63')]){_0xaae4bc();}else{return _0x2aeb29['status'](0x193)[_0xdf3c('0x46')]({'message':_0xdf3c('0x61')});}})[_0xdf3c('0x4c')](function(_0xe760dd){_0xaae4bc(_0xe760dd);});});};exports[_0xdf3c('0x64')]=function(_0x385824,_0x28a468,_0x553f70){_0x385824[_0xdf3c('0x64')]=!![];return _0x553f70();};exports['signToken']=function signToken(_0xa4e137){return signJwt(_0xa4e137);};exports['setTokenCookie']=function(_0x41b78c,_0x28144f){if(!_0x41b78c[_0xdf3c('0x3d')]){return _0x28144f[_0xdf3c('0x44')](0x194)['json']({'message':'It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.'});}var _0x4a068a={'payload':{'id':_0x41b78c[_0xdf3c('0x3d')]['id'],'role':_0x41b78c['user'][_0xdf3c('0xe')]},'options':{'expiresIn':0x15180}};return signJwt(_0x4a068a)[_0xdf3c('0x43')](function(_0x446713){_0x28144f[_0xdf3c('0x65')](_0xdf3c('0x66'),_0x446713);_0x28144f['redirect']('/dashboards/general');})[_0xdf3c('0x4c')](function(_0x27a541){return _0x28144f['status'](0x1f4)[_0xdf3c('0x67')](_0x27a541);});};exports[_0xdf3c('0x68')]=function(_0x168eaf){if(_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x55')])||_[_0xdf3c('0x69')](_0x168eaf[_0xdf3c('0x6a')])){return null;}else{return createJwt(_0x168eaf);}};exports['generateApiKey']=function(_0x4c98dc){_0x4c98dc[_0xdf3c('0x55')]=generateNonce();_0x4c98dc[_0xdf3c('0x6a')]=generateIssuedAt();return createJwt(_0x4c98dc);};exports[_0xdf3c('0x6b')]=function(_0x1ad771,_0x22de6c){var _0x39f38f=_0x1ad771[_0xdf3c('0x4e')][_0xdf3c('0x4f')];if(_0x39f38f){var _0x143d01={'nonce':_0x22de6c[_0xdf3c('0x55')],'iat':_0x22de6c[_0xdf3c('0x6a')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf[_0xdf3c('0x50')]()};return verifyJwt(_0x39f38f,_0x143d01)['then'](function(){return generateApiKey(_0x22de6c);});}else{throw{'message':'Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'};}};exports['validatePasswordPattern']=function(_0x58fcbf){var _0x541c57=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x541c57[_0xdf3c('0x6c')](_0x58fcbf))throw new db[(_0xdf3c('0x6d'))]['ValidationError'](_0xdf3c('0x6e'));return;};exports[_0xdf3c('0x6f')]=function(_0x51f8dd,_0xa8dddb,_0x28f935){var _0x10e9d5=encryptor[_0xdf3c('0x70')](_0xa8dddb)[_0xdf3c('0x71')](',');for(var _0x28f387=0x0;_0x28f387<_0x28f935;_0x28f387++){if(!_0x10e9d5[_0x28f387])break;if(_0x51f8dd[_0xdf3c('0x72')]()===_0x10e9d5[_0x28f387][_0xdf3c('0x72')]()){var _0x42efa2=util[_0xdf3c('0x73')](_0xdf3c('0x74'),_0x28f935);if(_0x28f935===0x1){_0x42efa2='The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.';}throw new db[(_0xdf3c('0x6d'))][(_0xdf3c('0x75'))](_0x42efa2);}}return;};exports[_0xdf3c('0x76')]=function(_0x5a3d63,_0x245c68){var _0x3e327e=_0x245c68?encryptor[_0xdf3c('0x70')](_0x245c68)['split'](','):[];if(_0x3e327e[_0xdf3c('0x77')]===0x5){_0x3e327e[_0xdf3c('0x78')](-0x1,0x1);}_0x3e327e['unshift'](_0x5a3d63);return encryptor[_0xdf3c('0x79')](_0x3e327e['join'](','));};function signJwt(_0x28c296){var _0x1b03e7=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7b')],{'context':jwt});var _0xed2a78=_0x28c296[_0xdf3c('0x7c')]||config[_0xdf3c('0xc')][_0xdf3c('0xd')];return new BPromise(function(_0x2922d8,_0x330730){_0x1b03e7(_0x28c296[_0xdf3c('0x7d')],_0xed2a78,_0x28c296[_0xdf3c('0x7e')])[_0xdf3c('0x43')](function(_0x206a18){_0x2922d8(_0x206a18);})[_0xdf3c('0x4c')](function(_0xe42432){_0x330730(_0xe42432);});});}function verifyJwt(_0xd7fb2d,_0x510538,_0x4dade5){var _0x2e8511=BPromise[_0xdf3c('0x7a')](jwt[_0xdf3c('0x7f')],{'context':jwt});var _0x596282=_0x4dade5||config[_0xdf3c('0xc')]['session'];return new BPromise(function(_0x574852,_0x184952){_0x2e8511(_0xd7fb2d,_0x596282,_0x510538)[_0xdf3c('0x43')](function(_0x1121b9){_0x574852(_0x1121b9);})[_0xdf3c('0x4c')](function(_0x68f487){_0x184952(_0x68f487);});});}function generateNonce(){return crypto[_0xdf3c('0x80')](0x10)[_0xdf3c('0x81')](_0xdf3c('0x82'));}function generateIssuedAt(){return Math[_0xdf3c('0x83')](Date[_0xdf3c('0x84')]()/0x3e8)[_0xdf3c('0x81')]();}function createJwt(_0x5a2dad){var _0x34000c={'payload':{'iat':_0x5a2dad['apiKeyIat'],'nonce':_0x5a2dad[_0xdf3c('0x55')]},'options':{'algorithm':_0xdf3c('0x85'),'subject':_0x5a2dad['id'][_0xdf3c('0x81')](),'issuer':hardwareConf[_0xdf3c('0x50')](),'audience':hardwareConf[_0xdf3c('0x50')]()}};return signJwt(_0x34000c)['then'](function(_0x18bf4f){return{'iat':_0x5a2dad[_0xdf3c('0x6a')],'nonce':_0x5a2dad[_0xdf3c('0x55')],'token':_0x18bf4f};});} \ No newline at end of file +var _0x34e8=['validatePasswordPattern','test','Sequelize','ValidationError','validatePasswordHistory','decryptString','split','toLowerCase','format','The\x20password\x20must\x20be\x20different\x20from\x20the\x20last\x20one.\x20Please\x20choose\x20another\x20one.','length','splice','unshift','encryptString','join','promisify','sign','secret','secrets','payload','options','verify','toString','hex','../../mysqldb','../../config/environment','../../config/license/hardware','../../config/license/util','lodash','jsonwebtoken','express-jwt','composable-middleware','basic-auth','crypto','bluebird','moment','session','role','fullname','name','internal','email','userpic','permissions','md5secret','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','pauseType','showWebBar','lastPauseAt','crudPermissions','passwordResetAt','alias','phoneBarAutoAnswer','phoneBarAutoAnswerDelay','phoneBarEnableRecording','phoneBarEnableDtmfTone','phoneBarExpires','phoneBarRemoteControl','phoneBarRemoteControlPort','interface','userProfileId','privacyEnabled','wssPort','downloadVoiceRecordings','downloadOmnichannelInteractions','downloadAttachments','ignorePauseForPreviewCalls','selectRecallMeCampaign','chatAutoanswer','emailAutoanswer','emailAutoanswerDelay','smsAutoanswer','smsAutoanswerDelay','openchannelAutoanswerDelay','faxAutoanswer','whatsappAutoanswer','whatsappAutoanswerDelay','isChatInteractionAuthorized','user','ChatInteraction','params','closed','disposition','unmanaged','Unmanaged.','Forbidden.','catch','authorization','startsWith','headers','Basic','User','find','pass','status','json','Wrong\x20credentials.','Unknown\x20authorization\x20format','query','getUuid','then','sub','Setting','allowedLoginAttempts','blockDuration','isEqual','API\x20access\x20key\x20is\x20not\x20valid\x20anymore','disabled','Invalid\x20API\x20access\x20key','blockedAt','minutes','User\x20not\x20found.','canUpdate','use','getLicense','update','Forbidden','isWebrtcLicence','webrtc','isMiddleware','signToken','setTokenCookie','It\x20looks\x20like\x20you\x20aren\x27t\x20logged\x20in,\x20please\x20try\x20again.','motion.token','redirect','/dashboards/general','send','isNil','apiKeyNonce','apiKeyIat','generateApiKey','regenerateApiKey','Please\x20use\x20the\x20previous\x20API\x20access\x20key\x20to\x20generate\x20a\x20new\x20one'];(function(_0xfa31,_0x179ca1){var _0x43b283=function(_0x7e9f06){while(--_0x7e9f06){_0xfa31['push'](_0xfa31['shift']());}};_0x43b283(++_0x179ca1);}(_0x34e8,0x12c));var _0x834e=function(_0x4eb276,_0xb4f759){_0x4eb276=_0x4eb276-0x0;var _0x191f25=_0x34e8[_0x4eb276];return _0x191f25;};'use strict';var db=require(_0x834e('0x0'))['db'];var config=require(_0x834e('0x1'));var hardwareConf=require(_0x834e('0x2'));var licenseUtil=require(_0x834e('0x3'));var encryptor=require('../encryptor');var _=require(_0x834e('0x4'));var jwt=require(_0x834e('0x5'));var expressJwt=require(_0x834e('0x6'));var compose=require(_0x834e('0x7'));var basicAuth=require(_0x834e('0x8'));var crypto=require(_0x834e('0x9'));var BPromise=require(_0x834e('0xa'));var util=require('util');var moment=require(_0x834e('0xb'));var validateJwt=expressJwt({'secret':config['secrets'][_0x834e('0xc')]});var userAttributes=['id',_0x834e('0xd'),_0x834e('0xe'),_0x834e('0xf'),_0x834e('0x10'),_0x834e('0x11'),_0x834e('0x12'),_0x834e('0x13'),_0x834e('0x14'),_0x834e('0x15'),_0x834e('0x16'),_0x834e('0x17'),_0x834e('0x18'),_0x834e('0x19'),_0x834e('0x1a'),_0x834e('0x1b'),_0x834e('0x1c'),'lastLoginAt',_0x834e('0x1d'),_0x834e('0x1e'),'allowmessenger',_0x834e('0x1f'),_0x834e('0x20'),_0x834e('0x21'),_0x834e('0x22'),'phoneBarDnd',_0x834e('0x23'),_0x834e('0x24'),'phoneBarEnableSettings',_0x834e('0x25'),'phoneBarPrefixRequired',_0x834e('0x26'),_0x834e('0x27'),'hotdesk',_0x834e('0x28'),_0x834e('0x29'),_0x834e('0x2a'),'settingsEnabled',_0x834e('0x2b'),_0x834e('0x2c'),_0x834e('0x2d'),_0x834e('0x2e'),_0x834e('0x2f'),_0x834e('0x30'),_0x834e('0x31'),'chatAutoanswerDelay',_0x834e('0x32'),_0x834e('0x33'),_0x834e('0x34'),_0x834e('0x35'),'openchannelAutoanswer',_0x834e('0x36'),_0x834e('0x37'),'faxAutoanswerDelay',_0x834e('0x38'),_0x834e('0x39')];exports[_0x834e('0x3a')]=function(){return this['isAuthenticated'](!![])['use'](function(_0x231619,_0x34563b,_0x589dde){if(_0x231619[_0x834e('0x3b')]){_0x589dde();}else{return db[_0x834e('0x3c')]['findOne']({'where':{'id':_0x231619[_0x834e('0x3d')]['id']},'attributes':['id',_0x834e('0x3e'),_0x834e('0x3f')],'raw':!![]})['then'](function(_0x24fcf7){if(_0x24fcf7&&_0x24fcf7[_0x834e('0x3e')]){return _0x34563b['status'](_0x24fcf7['disposition']===_0x834e('0x40')?0x195:0x193)['json']({'message':_0x24fcf7[_0x834e('0x3f')]===_0x834e('0x40')?_0x834e('0x41'):_0x834e('0x42')});}else{_0x589dde();}})[_0x834e('0x43')](function(_0x130cc5){_0x589dde(_0x130cc5);});}});};exports['isAuthenticated']=function isAuthenticated(_0x510780){return compose()['use'](function(_0x58c1d7,_0x2c7a8d,_0x567cea){var _0x106d6a;if(_0x58c1d7['headers'][_0x834e('0x44')]){if(_[_0x834e('0x45')](_0x58c1d7[_0x834e('0x46')][_0x834e('0x44')],_0x834e('0x47'))){var _0x390119=basicAuth(_0x58c1d7);db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'name':_0x390119[_0x834e('0xf')]}})['then'](function(_0xef9ec2){if(!_0xef9ec2||!_0xef9ec2['authenticate'](_0x390119[_0x834e('0x4a')])){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x4d')});}_0x58c1d7[_0x834e('0x3b')]={'id':_0xef9ec2['id']};_0x567cea();})[_0x834e('0x43')](function(_0x4696a1){_0x567cea(_0x4696a1);});}else if(_[_0x834e('0x45')](_0x58c1d7[_0x834e('0x46')][_0x834e('0x44')],'Bearer')){validateJwt(_0x58c1d7,_0x2c7a8d,_0x567cea);}else{if(_0x510780){_0x567cea();}else{return _0x2c7a8d[_0x834e('0x4b')](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x4e')});}}}else if(_0x58c1d7[_0x834e('0x4f')]['apikey']){try{var _0x3f88ad={'audience':hardwareConf[_0x834e('0x50')](),'issuer':hardwareConf['getUuid']()};verifyJwt(_0x58c1d7['query']['apikey'],_0x3f88ad)[_0x834e('0x51')](function(_0x41bf4d){return db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'id':_0x41bf4d[_0x834e('0x52')]}})[_0x834e('0x51')](function(_0x4c2ef6){_0x106d6a=_0x4c2ef6;return db[_0x834e('0x53')]['findOne']({'where':{'id':0x1},'attributes':[_0x834e('0x54'),_0x834e('0x55')],'raw':!![]});})['then'](function(_0x18ac3b){if(!_0x106d6a||!_[_0x834e('0x56')](_0x106d6a['apiKeyNonce'],_0x41bf4d['nonce'])){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x57')});}if(_0x106d6a[_0x834e('0x58')]){return _0x2c7a8d[_0x834e('0x4b')](0x191)['json']({'message':_0x834e('0x59')});}if(_0x106d6a['blocked']){if(_0x18ac3b['blockDuration']>0x0){if(moment(_0x106d6a[_0x834e('0x5a')])['add'](_0x18ac3b[_0x834e('0x55')],_0x834e('0x5b'))>moment()){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x59')});}}else{return _0x2c7a8d['status'](0x191)[_0x834e('0x4c')]({'message':_0x834e('0x59')});}}_0x58c1d7[_0x834e('0x3b')]={'id':_0x106d6a['id']};_0x567cea();});})['catch'](function(){return _0x2c7a8d[_0x834e('0x4b')](0x191)[_0x834e('0x4c')]({'message':'Invalid\x20API\x20access\x20key'});});}catch(_0x1e3e71){_0x567cea(_0x1e3e71);}}else if(_0x510780){_0x567cea();}else{return _0x2c7a8d['status'](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x4e')});}})['use'](function(_0x4a6942,_0x22ea21,_0x16969b){if(_0x4a6942[_0x834e('0x3b')]){db[_0x834e('0x48')][_0x834e('0x49')]({'where':{'id':_0x4a6942[_0x834e('0x3b')]['id']},'attributes':userAttributes})[_0x834e('0x51')](function(_0x4a3381){if(!_0x4a3381){return _0x22ea21[_0x834e('0x4b')](0x194)['json']({'message':_0x834e('0x5c')});}_0x4a6942['user']=_0x4a3381;_0x16969b();})[_0x834e('0x43')](function(_0x5a5807){_0x16969b(_0x5a5807);});}else if(_0x510780){_0x16969b();}else{return _0x22ea21[_0x834e('0x4b')](0x194)[_0x834e('0x4c')]({'message':'User\x20object\x20not\x20found.'});}});};exports[_0x834e('0x5d')]=function canUpdate(){return compose()[_0x834e('0x5e')](function(_0xa880cb,_0xd55cc3,_0x252ea0){return licenseUtil[_0x834e('0x5f')]()[_0x834e('0x51')](function(_0x3ccd8e){if(_0x3ccd8e[_0x834e('0x60')]){_0x252ea0();}else{return _0xd55cc3[_0x834e('0x4b')](0x193)['json']({'message':_0x834e('0x61')});}})[_0x834e('0x43')](function(_0x47a8a9){_0x252ea0(_0x47a8a9);});});};exports[_0x834e('0x62')]=function isWebrtcLicence(){return compose()[_0x834e('0x5e')](function(_0x25b035,_0x2112d5,_0x19b5ef){return licenseUtil[_0x834e('0x5f')]()['then'](function(_0x59c855){if(_0x59c855[_0x834e('0x63')]){_0x19b5ef();}else{return _0x2112d5[_0x834e('0x4b')](0x193)[_0x834e('0x4c')]({'message':_0x834e('0x61')});}})[_0x834e('0x43')](function(_0xd1d83b){_0x19b5ef(_0xd1d83b);});});};exports[_0x834e('0x64')]=function(_0x43f599,_0x1419eb,_0x390c45){_0x43f599[_0x834e('0x64')]=!![];return _0x390c45();};exports[_0x834e('0x65')]=function signToken(_0x1a28f6){return signJwt(_0x1a28f6);};exports[_0x834e('0x66')]=function(_0x2aa072,_0x1a3855){if(!_0x2aa072[_0x834e('0x3b')]){return _0x1a3855[_0x834e('0x4b')](0x194)[_0x834e('0x4c')]({'message':_0x834e('0x67')});}var _0x4cfacd={'payload':{'id':_0x2aa072[_0x834e('0x3b')]['id'],'role':_0x2aa072[_0x834e('0x3b')]['role']},'options':{'expiresIn':0x15180}};return signJwt(_0x4cfacd)[_0x834e('0x51')](function(_0x3b0988){_0x1a3855['cookie'](_0x834e('0x68'),_0x3b0988);_0x1a3855[_0x834e('0x69')](_0x834e('0x6a'));})[_0x834e('0x43')](function(_0x4288e4){return _0x1a3855[_0x834e('0x4b')](0x1f4)[_0x834e('0x6b')](_0x4288e4);});};exports['retrieveApiKey']=function(_0x1ad7fe){if(_[_0x834e('0x6c')](_0x1ad7fe[_0x834e('0x6d')])||_[_0x834e('0x6c')](_0x1ad7fe[_0x834e('0x6e')])){return null;}else{return createJwt(_0x1ad7fe);}};exports[_0x834e('0x6f')]=function(_0x344b51){_0x344b51[_0x834e('0x6d')]=generateNonce();_0x344b51['apiKeyIat']=generateIssuedAt();return createJwt(_0x344b51);};exports[_0x834e('0x70')]=function(_0x4dc104,_0x2f4bde){var _0x53a9ee=_0x4dc104[_0x834e('0x4f')]['apikey'];if(_0x53a9ee){var _0x527eef={'nonce':_0x2f4bde[_0x834e('0x6d')],'iat':_0x2f4bde[_0x834e('0x6e')],'audience':hardwareConf['getUuid'](),'issuer':hardwareConf['getUuid']()};return verifyJwt(_0x53a9ee,_0x527eef)[_0x834e('0x51')](function(){return generateApiKey(_0x2f4bde);});}else{throw{'message':_0x834e('0x71')};}};exports[_0x834e('0x72')]=function(_0x387365){var _0x21c417=new RegExp(/(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9])(?=.*[?!@#\$%\^&\*~\-_=+[{\]\}])(?=.{8,})/);if(!_0x21c417[_0x834e('0x73')](_0x387365))throw new db[(_0x834e('0x74'))][(_0x834e('0x75'))]('The\x20password\x20must\x20be\x20at\x20least\x208\x20characters\x20long\x20and\x20have\x201\x20lowercase\x20character,\x201\x20uppercase\x20character,\x201\x20number\x20and\x201\x20special\x20character\x20~!@#$%^&-_=+[{]}.');return;};exports[_0x834e('0x76')]=function(_0x3c70bf,_0x5d5ac2,_0x281342){var _0x4e2b22=encryptor[_0x834e('0x77')](_0x5d5ac2)[_0x834e('0x78')](',');for(var _0x5160c4=0x0;_0x5160c4<_0x281342;_0x5160c4++){if(!_0x4e2b22[_0x5160c4])break;if(_0x3c70bf[_0x834e('0x79')]()===_0x4e2b22[_0x5160c4][_0x834e('0x79')]()){var _0x2de29a=util[_0x834e('0x7a')]('The\x20password\x20must\x20be\x20different\x20from\x20the\x20previous\x20%d\x20passwords.\x20Please\x20choose\x20another\x20one.',_0x281342);if(_0x281342===0x1){_0x2de29a=_0x834e('0x7b');}throw new db[(_0x834e('0x74'))][(_0x834e('0x75'))](_0x2de29a);}}return;};exports['updatePasswordsHistory']=function(_0x246b8e,_0x1fcae9){var _0x3a7683=_0x1fcae9?encryptor[_0x834e('0x77')](_0x1fcae9)[_0x834e('0x78')](','):[];if(_0x3a7683[_0x834e('0x7c')]===0x5){_0x3a7683[_0x834e('0x7d')](-0x1,0x1);}_0x3a7683[_0x834e('0x7e')](_0x246b8e);return encryptor[_0x834e('0x7f')](_0x3a7683[_0x834e('0x80')](','));};function signJwt(_0x1e4310){var _0x1dfa95=BPromise[_0x834e('0x81')](jwt[_0x834e('0x82')],{'context':jwt});var _0x460a7a=_0x1e4310[_0x834e('0x83')]||config[_0x834e('0x84')][_0x834e('0xc')];return new BPromise(function(_0x193a15,_0x3e3467){_0x1dfa95(_0x1e4310[_0x834e('0x85')],_0x460a7a,_0x1e4310[_0x834e('0x86')])['then'](function(_0x2145cf){_0x193a15(_0x2145cf);})[_0x834e('0x43')](function(_0x45bcc2){_0x3e3467(_0x45bcc2);});});}function verifyJwt(_0x36cc14,_0x4ca099,_0x30faa8){var _0x5a9c70=BPromise['promisify'](jwt[_0x834e('0x87')],{'context':jwt});var _0x2b1ec7=_0x30faa8||config[_0x834e('0x84')][_0x834e('0xc')];return new BPromise(function(_0x216105,_0x3821ad){_0x5a9c70(_0x36cc14,_0x2b1ec7,_0x4ca099)[_0x834e('0x51')](function(_0xe5c8f6){_0x216105(_0xe5c8f6);})['catch'](function(_0xdef8c4){_0x3821ad(_0xdef8c4);});});}function generateNonce(){return crypto['randomBytes'](0x10)[_0x834e('0x88')](_0x834e('0x89'));}function generateIssuedAt(){return Math['floor'](Date['now']()/0x3e8)[_0x834e('0x88')]();}function createJwt(_0x82f2a7){var _0x363cc2={'payload':{'iat':_0x82f2a7[_0x834e('0x6e')],'nonce':_0x82f2a7[_0x834e('0x6d')]},'options':{'algorithm':'HS512','subject':_0x82f2a7['id'][_0x834e('0x88')](),'issuer':hardwareConf[_0x834e('0x50')](),'audience':hardwareConf[_0x834e('0x50')]()}};return signJwt(_0x363cc2)[_0x834e('0x51')](function(_0x3181af){return{'iat':_0x82f2a7[_0x834e('0x6e')],'nonce':_0x82f2a7[_0x834e('0x6d')],'token':_0x3181af};});} \ No newline at end of file diff --git a/server/components/contacts/index.js b/server/components/contacts/index.js index 0606a34..a53a754 100644 --- a/server/components/contacts/index.js +++ b/server/components/contacts/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4d06=['catch','describe','CmContact','keys','startsWith','CmCustomField','findOne','all','length','cf_','fieldType','type','map','lodash','findAll','skipContactsQuery','getContactsSubquery','resolve','search','parseAdvancedSearchFilter','parseQueryParameters','then','where','default','fields','filter','user','clause','tags','skip','tag','count','buildContactsQuery','getFilteredContacts','rows'];(function(_0x47f7ec,_0x369f9d){var _0x415101=function(_0x41317a){while(--_0x41317a){_0x47f7ec['push'](_0x47f7ec['shift']());}};_0x415101(++_0x369f9d);}(_0x4d06,0x1b1));var _0x64d0=function(_0x2ca616,_0x384ec8){_0x2ca616=_0x2ca616-0x0;var _0x53155f=_0x4d06[_0x2ca616];return _0x53155f;};'use strict';var _=require(_0x64d0('0x0'));var sqlUtils=require('./sql-utils');var db=require('../../mysqldb')['db'];exports[_0x64d0('0x1')]=function(_0x503ebd,_0x3b4ac7,_0x1720e3,_0x2b5eef){var _0x5826e8={'count':0x0,'rows':[]};var _0x16244d=sqlUtils[_0x64d0('0x2')](_0x3b4ac7,_0x503ebd);if(_0x16244d){return Promise['resolve'](_0x5826e8);}var _0x2d018d=sqlUtils[_0x64d0('0x3')]();var _0x1b016e={};var _0x578d87=![];var _0x4d66e1=![];return Promise[_0x64d0('0x4')]()['then'](function(){if(_0x503ebd[_0x64d0('0x5')]){return sqlUtils[_0x64d0('0x6')](_0x503ebd[_0x64d0('0x5')],_0x2b5eef);}else{return sqlUtils[_0x64d0('0x7')](_0x503ebd,_0x2b5eef);}})[_0x64d0('0x8')](function(_0x4f9d72){_0x2d018d[_0x64d0('0x9')](_0x4f9d72[_0x64d0('0xa')]);_0x2d018d[_0x64d0('0x9')](_0x4f9d72[_0x64d0('0xb')]);_0x2d018d['where'](_0x4f9d72[_0x64d0('0xc')]);_0x2d018d['where'](_0x4f9d72[_0x64d0('0xd')][_0x64d0('0xe')]);_0x1b016e=_0x4f9d72[_0x64d0('0xf')];_0x4d66e1=_0x4f9d72[_0x64d0('0xd')][_0x64d0('0x10')];return sqlUtils['checkListsRestrictions'](_0x3b4ac7,_0x503ebd,_0x4d66e1);})[_0x64d0('0x8')](function(_0x440330){_0x2d018d[_0x64d0('0x9')](_0x440330);var _0x5a7a72=_0x503ebd['search']?_0x1b016e['ids']:_0x503ebd[_0x64d0('0x11')];_0x578d87=_0x5a7a72?!![]:![];return sqlUtils['countFilteredContacts'](_0x2d018d,_0x5a7a72);})[_0x64d0('0x8')](function(_0x594dc2){_0x5826e8[_0x64d0('0x12')]=_0x594dc2;if(_0x5826e8[_0x64d0('0x12')]===0x0){return;}if(_0x503ebd['User']){_0x4d66e1=!![];}return sqlUtils[_0x64d0('0x13')](_0x2d018d,_0x503ebd[_0x64d0('0xb')],_0x1720e3,_0x578d87,_0x1b016e['clause'],_0x4d66e1);})[_0x64d0('0x8')](function(_0x424ebe){if(!_0x424ebe){return[];}return sqlUtils[_0x64d0('0x14')](_0x424ebe,_0x503ebd,_0x1720e3);})[_0x64d0('0x8')](function(_0x306629){_0x5826e8[_0x64d0('0x15')]=_0x306629;return _0x5826e8;})[_0x64d0('0x16')](function(_0xe8968d){throw _0xe8968d;});};exports[_0x64d0('0x17')]=function(){var _0x3cccd9={};var _0x396ffd=[];return db[_0x64d0('0x18')][_0x64d0('0x17')]()[_0x64d0('0x8')](function(_0x395813){_0x3cccd9=_0x395813;var _0x3339ad=Object[_0x64d0('0x19')](_0x3cccd9)[_0x64d0('0xc')](function(_0x2fb270){return _[_0x64d0('0x1a')](_0x2fb270,'cf_')?_0x2fb270:undefined;});var _0x115581=_0x3339ad['map'](function(_0x15b9a5){return db[_0x64d0('0x1b')][_0x64d0('0x1c')]({'where':{'id':_0x15b9a5['slice'](0x3)},'raw':!![]});});return Promise[_0x64d0('0x1d')](_0x115581);})[_0x64d0('0x8')](function(_0x77c43e){for(var _0x7bda81=0x0;_0x7bda81<_0x77c43e[_0x64d0('0x1e')];_0x7bda81++){if(_0x77c43e[_0x7bda81]){var _0x12e84f=_0x64d0('0x1f')+_0x77c43e[_0x7bda81]['id'];_0x3cccd9[_0x12e84f][_0x64d0('0x20')]=_0x77c43e[_0x7bda81][_0x64d0('0x21')];}}_0x396ffd=_[_0x64d0('0x22')](Object[_0x64d0('0x19')](_0x3cccd9),function(_0x50e268){return{'name':_0x50e268,'type':_0x3cccd9[_0x50e268][_0x64d0('0x21')]};});return _0x396ffd;})['catch'](function(_0x4d722f){throw _0x4d722f;});}; \ No newline at end of file +var _0x361d=['skipContactsQuery','resolve','getContactsSubquery','then','search','parseAdvancedSearchFilter','parseQueryParameters','where','default','fields','filter','user','clause','checkListsRestrictions','ids','countFilteredContacts','count','buildContactsQuery','rows','catch','describe','CmContact','keys','startsWith','cf_','CmCustomField','findOne','slice','all','fieldType','type','map','../../mysqldb','findAll'];(function(_0x8eebde,_0x9ca350){var _0x4b0e55=function(_0x2e1add){while(--_0x2e1add){_0x8eebde['push'](_0x8eebde['shift']());}};_0x4b0e55(++_0x9ca350);}(_0x361d,0xec));var _0xd361=function(_0x5b8fb6,_0x6849e7){_0x5b8fb6=_0x5b8fb6-0x0;var _0x40df6f=_0x361d[_0x5b8fb6];return _0x40df6f;};'use strict';var _=require('lodash');var sqlUtils=require('./sql-utils');var db=require(_0xd361('0x0'))['db'];exports[_0xd361('0x1')]=function(_0xd1c4cf,_0x527ddb,_0x38c03d,_0x53abe7){var _0x612d00={'count':0x0,'rows':[]};var _0x500462=sqlUtils[_0xd361('0x2')](_0x527ddb,_0xd1c4cf);if(_0x500462){return Promise[_0xd361('0x3')](_0x612d00);}var _0x4991ea=sqlUtils[_0xd361('0x4')]();var _0x1cb660={};var _0xf1ad08=![];var _0x20d287=![];return Promise['resolve']()[_0xd361('0x5')](function(){if(_0xd1c4cf[_0xd361('0x6')]){return sqlUtils[_0xd361('0x7')](_0xd1c4cf['search'],_0x53abe7);}else{return sqlUtils[_0xd361('0x8')](_0xd1c4cf,_0x53abe7);}})[_0xd361('0x5')](function(_0x21df97){_0x4991ea[_0xd361('0x9')](_0x21df97[_0xd361('0xa')]);_0x4991ea['where'](_0x21df97[_0xd361('0xb')]);_0x4991ea[_0xd361('0x9')](_0x21df97[_0xd361('0xc')]);_0x4991ea[_0xd361('0x9')](_0x21df97[_0xd361('0xd')][_0xd361('0xe')]);_0x1cb660=_0x21df97['tags'];_0x20d287=_0x21df97[_0xd361('0xd')]['skip'];return sqlUtils[_0xd361('0xf')](_0x527ddb,_0xd1c4cf,_0x20d287);})[_0xd361('0x5')](function(_0x5b390f){_0x4991ea['where'](_0x5b390f);var _0x3b9b67=_0xd1c4cf[_0xd361('0x6')]?_0x1cb660[_0xd361('0x10')]:_0xd1c4cf['tag'];_0xf1ad08=_0x3b9b67?!![]:![];return sqlUtils[_0xd361('0x11')](_0x4991ea,_0x3b9b67);})[_0xd361('0x5')](function(_0x195b2e){_0x612d00['count']=_0x195b2e;if(_0x612d00[_0xd361('0x12')]===0x0){return;}if(_0xd1c4cf['User']){_0x20d287=!![];}return sqlUtils[_0xd361('0x13')](_0x4991ea,_0xd1c4cf[_0xd361('0xb')],_0x38c03d,_0xf1ad08,_0x1cb660[_0xd361('0xe')],_0x20d287);})[_0xd361('0x5')](function(_0x24881d){if(!_0x24881d){return[];}return sqlUtils['getFilteredContacts'](_0x24881d,_0xd1c4cf,_0x38c03d);})[_0xd361('0x5')](function(_0x26c8a6){_0x612d00[_0xd361('0x14')]=_0x26c8a6;return _0x612d00;})[_0xd361('0x15')](function(_0x2c43e2){throw _0x2c43e2;});};exports[_0xd361('0x16')]=function(){var _0x10e074={};var _0x301e2b=[];return db[_0xd361('0x17')][_0xd361('0x16')]()[_0xd361('0x5')](function(_0x333a55){_0x10e074=_0x333a55;var _0x1ac1f1=Object[_0xd361('0x18')](_0x10e074)[_0xd361('0xc')](function(_0xb80583){return _[_0xd361('0x19')](_0xb80583,_0xd361('0x1a'))?_0xb80583:undefined;});var _0xdab551=_0x1ac1f1['map'](function(_0x4e50b3){return db[_0xd361('0x1b')][_0xd361('0x1c')]({'where':{'id':_0x4e50b3[_0xd361('0x1d')](0x3)},'raw':!![]});});return Promise[_0xd361('0x1e')](_0xdab551);})[_0xd361('0x5')](function(_0x5d3e99){for(var _0x47398a=0x0;_0x47398a<_0x5d3e99['length'];_0x47398a++){if(_0x5d3e99[_0x47398a]){var _0x5e2274=_0xd361('0x1a')+_0x5d3e99[_0x47398a]['id'];_0x10e074[_0x5e2274][_0xd361('0x1f')]=_0x5d3e99[_0x47398a][_0xd361('0x20')];}}_0x301e2b=_[_0xd361('0x21')](Object[_0xd361('0x18')](_0x10e074),function(_0x5b5b2b){return{'name':_0x5b5b2b,'type':_0x10e074[_0x5b5b2b][_0xd361('0x20')]};});return _0x301e2b;})[_0xd361('0x15')](function(_0x4b6238){throw _0x4b6238;});}; \ No newline at end of file diff --git a/server/components/contacts/sql-utils.js b/server/components/contacts/sql-utils.js index d1ed127..477644e 100644 --- a/server/components/contacts/sql-utils.js +++ b/server/components/contacts/sql-utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x15aa=['t.id\x20IN\x20?','lodash','squel','../parsers/advancedSearch','../parsers/qs','../../mysqldb','role','agent','ListId','autocomplete','true','select','from','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','left_join','cm_user_has_contacts','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','lastName','phone','fax','email','CompanyId','updatedAt','deletedAt','TagIds','includes','push','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','isNumeric','c.phone\x20LIKE\x20?','c.mobile\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.firstName\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','find','name','dateOfBirth','fieldType','datetime','DATE','buildExpression','type','default','text','value','start','end','Tag','and','tags','ids','User','user','clause','uc.UserId\x20=\x20?','skip','keys','some','compact','Contact','CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?','\x20=\x20?','then','fields','filter','resolve','search','getLists','c.ListId\x20IS\x20NULL','c.ListId\x20IN\x20?','map','attributes','group','limit','offset','subqry.id','having','order','DESC','subqry.','findAll','color','Sequelize','QueryTypes','SELECT','CmContact','sequelize','query','toString','Tags','split','clone','COUNT(*)','c.id','isEmpty'];(function(_0xc8adab,_0x5ff7dd){var _0x266a25=function(_0x37b277){while(--_0x37b277){_0xc8adab['push'](_0xc8adab['shift']());}};_0x266a25(++_0x5ff7dd);}(_0x15aa,0xdd));var _0xa15a=function(_0x47a1da,_0x517938){_0x47a1da=_0x47a1da-0x0;var _0x2c4480=_0x15aa[_0x47a1da];return _0x2c4480;};'use strict';var _=require(_0xa15a('0x0'));var squel=require(_0xa15a('0x1'));var as=require(_0xa15a('0x2'));var qs=require(_0xa15a('0x3'));var utils=require('../interaction/utils');var db=require(_0xa15a('0x4'))['db'];function skipContactsQuery(_0x3685fa,_0x359d6d){var _0x2495d2=![];if(_0x3685fa[_0xa15a('0x5')]===_0xa15a('0x6')&&!_0x359d6d['search']&&!_0x359d6d[_0xa15a('0x7')]&&_0x359d6d[_0xa15a('0x8')]!==_0xa15a('0x9')){_0x2495d2=!![];}return _0x2495d2;}function getContactsSubquery(){return squel[_0xa15a('0xa')]()[_0xa15a('0xb')](_0xa15a('0xc'),'c')[_0xa15a('0xd')](_0xa15a('0xe'));}function applyJoinClauses(_0x38a456,_0x3f8381){var _0xaf9847=_0x3f8381?'c':_0xa15a('0xf');_0x38a456[_0xa15a('0x10')](_0xa15a('0x11'),'uc',_0xa15a('0x12')+_0xaf9847+_0xa15a('0x13'))[_0xa15a('0x10')](_0xa15a('0x14'),'ct','ct.CmContactId\x20=\x20'+_0xaf9847+'.id')[_0xa15a('0x10')]('tools_tags','t','t.id\x20=\x20ct.TagId');return _0x38a456;}function addFieldsToQuery(_0x5e229f,_0x4f4220,_0x55fecd,_0x3bdd30,_0x320f7c){var _0x5154b5=_0x320f7c?'c':_0xa15a('0xf');if(!_0x4f4220){_0x4f4220=['id','firstName',_0xa15a('0x15'),_0xa15a('0x16'),'mobile',_0xa15a('0x17'),_0xa15a('0x18'),_0xa15a('0x7'),_0xa15a('0x19'),'createdAt',_0xa15a('0x1a'),_0xa15a('0x1b'),_0xa15a('0x1c')];}else if(!_0x4f4220[_0xa15a('0x1d')]('id')){_0x4f4220[_0xa15a('0x1e')]('id');}var _0x5e9ede=_0x55fecd&&_0x320f7c||!_0x55fecd&&!_0x320f7c;if(_0x3bdd30){_0x5e9ede=_0x3bdd30&&_0x320f7c||!_0x3bdd30&&!_0x320f7c;}_0x4f4220[_0xa15a('0x1f')](function(_0x3c35f1){if(_0x3c35f1===_0xa15a('0x1c')){if(_0x5e9ede){_0x5e229f[_0xa15a('0x20')](_0xa15a('0x21'),_0x3c35f1);}else if(_0x55fecd||_0x3bdd30){_0x5e229f[_0xa15a('0x20')](_0x5154b5+'.'+_0x3c35f1);}}else{_0x5e229f[_0xa15a('0x20')](_0x5154b5+'.'+_0x3c35f1);}});return _0x5e229f;}function getSqlClauses(){var _0x4d7b64={'default':squel['expr'](),'fields':squel[_0xa15a('0x22')](),'filter':squel[_0xa15a('0x22')](),'tags':{'clause':squel[_0xa15a('0x22')](),'ids':null},'user':{'clause':squel[_0xa15a('0x22')](),'skip':![]}};return _0x4d7b64;}function parseTagParameter(_0x1dbccb){var _0x55cf9e=squel[_0xa15a('0x22')]();if(_0x1dbccb){var _0x4463c3=utils[_0xa15a('0x23')](_0x1dbccb);_0x4463c3['forEach'](function(_0x1017f4){_0x55cf9e['or']('CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','%,'+_0x1017f4+',%');});}return _0x55cf9e;}function parseSearchFilter(_0x16bd5b){var _0x551191=squel['expr']();if(_0x16bd5b){var _0xc0c550=_0x16bd5b[_0xa15a('0x24')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0xc0c550['split']('\x20')[_0xa15a('0x25')]>0x1){_0x551191['or'](_0xa15a('0x26'),qs['getFullTextValue'](_0xc0c550,!![]),null);}else{if(qs[_0xa15a('0x27')](_0xc0c550)){_0x551191['or']('c.id\x20LIKE\x20?',_0xc0c550+'%');_0x551191['or'](_0xa15a('0x28'),_0xc0c550+'%');_0x551191['or'](_0xa15a('0x29'),_0xc0c550+'%');_0x551191['or'](_0xa15a('0x2a'),_0xc0c550+'%');}else if(qs['isEmail'](_0xc0c550)){_0x551191['or'](_0xa15a('0x2b'),_0xc0c550+'%');}else{_0x551191['or'](_0xa15a('0x2c'),'%'+_0xc0c550+'%');_0x551191['or'](_0xa15a('0x2d'),'%'+_0xc0c550+'%');_0x551191['or'](_0xa15a('0x2b'),'%'+_0xc0c550+'%');}}}return _0x551191;}function parseAdvancedSearchFilter(_0x3ab987,_0x324d00){var _0x4defd6=getSqlClauses();var _0x5a6346=as['parseSearch'](_0x3ab987);var _0x435aae=_0x5a6346[_0xa15a('0x2e')];for(var _0x5c2d7b=0x0;_0x5c2d7b<_0x5a6346['conditions']['length'];_0x5c2d7b++){var _0x32f343=_0x5a6346[_0xa15a('0x2f')][_0x5c2d7b];var _0x57106c='c';var _0x4b42d8=_[_0xa15a('0x30')](_0x324d00,[_0xa15a('0x31'),_0x32f343[_0xa15a('0x20')]]);if(_0x4b42d8){if(_0x32f343[_0xa15a('0x20')]===_0xa15a('0x32')||_0x4b42d8[_0xa15a('0x33')]===_0xa15a('0x34')){_0x32f343['castTo']=_0xa15a('0x35');}var _0x1f8c50=as[_0xa15a('0x36')](_0x57106c,_0x4b42d8[_0xa15a('0x37')],_0x32f343);_0x4defd6[_0xa15a('0x38')][_0x435aae](_0x1f8c50[_0xa15a('0x39')],_0x1f8c50[_0xa15a('0x3a')][_0xa15a('0x3b')],_0x1f8c50[_0xa15a('0x3a')][_0xa15a('0x3c')]);}else{if(_0x32f343[_0xa15a('0x20')]===_0xa15a('0x3d')){var _0x3b87fc=_0x32f343['value']['split'](',')['map'](function(_0x215bf7){return Number(_0x215bf7);});var _0x40d7c0=parseTagParameter(_0x3b87fc);_0x4defd6['tags']['clause'][_0xa15a('0x3e')](_0x40d7c0);_0x4defd6[_0xa15a('0x3f')][_0xa15a('0x40')]=_0x3b87fc;}else if(_0x32f343[_0xa15a('0x20')]===_0xa15a('0x41')){_0x4defd6[_0xa15a('0x42')][_0xa15a('0x43')][_0xa15a('0x3e')](_0xa15a('0x44'),_0x32f343[_0xa15a('0x3a')]);_0x4defd6[_0xa15a('0x42')][_0xa15a('0x45')]=!![];}}}return _0x4defd6;}function parseModelFields(_0x1fc9ae,_0x2089a2){var _0x3a6c65=squel['expr']();var _0x5c60ca=_(_0x1fc9ae)[_0xa15a('0x46')]()['map'](function(_0x34398d){return _[_0xa15a('0x47')](_0x2089a2,[_0xa15a('0x31'),_0x34398d])?_0x34398d:undefined;})[_0xa15a('0x48')]()['value']();if(_0x1fc9ae[_0xa15a('0x49')]){_0x5c60ca[_0xa15a('0x1e')](_0xa15a('0x49'));}if(_0x1fc9ae[_0xa15a('0x41')]){_0x5c60ca[_0xa15a('0x1e')](_0xa15a('0x41'));}if(_0x5c60ca['length']>0x0){_0x5c60ca[_0xa15a('0x1f')](function(_0x44cc89){if(_0x44cc89===_0xa15a('0x7')){_0x3a6c65[_0xa15a('0x3e')]('c.ListId\x20IN\x20?',[]['concat'](_0x1fc9ae[_0x44cc89]));}else if(_0x44cc89===_0xa15a('0x49')){var _0xf56b39='%'+_0x1fc9ae[_0x44cc89]+'%';_0x3a6c65[_0xa15a('0x3e')](_0xa15a('0x4a'),_0xf56b39);}else if(_0x44cc89==='User'){_0x3a6c65[_0xa15a('0x3e')]('uc.UserId\x20=\x20?',_0x1fc9ae[_0x44cc89]);}else{_0x3a6c65[_0xa15a('0x3e')]('c.'+_0x44cc89+_0xa15a('0x4b'),_0x1fc9ae[_0x44cc89]);}});}return _0x3a6c65;}function parseQueryParameters(_0x9b25fc,_0x4a7588){var _0xb6a4bd=getSqlClauses();return Promise['resolve']()[_0xa15a('0x4c')](function(){return parseModelFields(_0x9b25fc,_0x4a7588);})[_0xa15a('0x4c')](function(_0x655cb2){_0xb6a4bd[_0xa15a('0x4d')]['and'](_0x655cb2);return parseTagParameter(_0x9b25fc['tag']);})['then'](function(_0x43cfb1){_0xb6a4bd[_0xa15a('0x3f')][_0xa15a('0x43')][_0xa15a('0x3e')](_0x43cfb1);return parseSearchFilter(_0x9b25fc[_0xa15a('0x4e')]);})['then'](function(_0x16e159){_0xb6a4bd[_0xa15a('0x4e')]=_0x16e159;return _0xb6a4bd;});}function checkListsRestrictions(_0x395956,_0x316118,_0x39cde8){var _0x20f486=squel[_0xa15a('0x22')]();return Promise[_0xa15a('0x4f')]()['then'](function(){if(_0x316118[_0xa15a('0x50')]&&_0x395956[_0xa15a('0x5')]===_0xa15a('0x6')&&!_0x39cde8){return _0x395956[_0xa15a('0x51')]({'attributes':['id'],'raw':!![]});}})[_0xa15a('0x4c')](function(_0x59379a){if(_0x59379a){if(_0x59379a['length']===0x0){_0x20f486[_0xa15a('0x3e')](_0xa15a('0x52'));}else{_0x20f486[_0xa15a('0x3e')](_0xa15a('0x53'),_[_0xa15a('0x54')](_0x59379a,'id'));}}})[_0xa15a('0x4c')](function(){return _0x20f486;});}function buildContactsQuery(_0xc925eb,_0x1f126f,_0x795582,_0x220b29,_0x3442b2,_0x390ded){if(_0x1f126f){_0x1f126f=_0x795582[_0xa15a('0x55')];}_0xc925eb=addFieldsToQuery(_0xc925eb,_0x1f126f,_0x220b29,_0x390ded,!![]);var _0x58c9b8=squel[_0xa15a('0xa')]();_0x58c9b8=addFieldsToQuery(_0x58c9b8,_0x1f126f,_0x220b29,_0x390ded,![]);if(_0x220b29||_0x390ded){_0xc925eb=applyJoinClauses(_0xc925eb,!![]);_0xc925eb[_0xa15a('0x56')]('c.id');if(_0x795582[_0xa15a('0x57')]){_0x58c9b8[_0xa15a('0x57')](_0x795582[_0xa15a('0x57')]);}if(_0x795582[_0xa15a('0x58')]){_0x58c9b8[_0xa15a('0x58')](_0x795582['offset']);}}else{_0x58c9b8=applyJoinClauses(_0x58c9b8,![]);_0x58c9b8[_0xa15a('0x56')](_0xa15a('0x59'));if(_0x795582['limit']){_0xc925eb[_0xa15a('0x57')](_0x795582[_0xa15a('0x57')]);}if(_0x795582['offset']){_0xc925eb['offset'](_0x795582[_0xa15a('0x58')]);}}_0x58c9b8[_0xa15a('0x5a')](_0x3442b2);if(_0x795582[_0xa15a('0x5b')]){_0x795582[_0xa15a('0x5b')][_0xa15a('0x1f')](function(_0x18774b){_0xc925eb[_0xa15a('0x5b')]('c.'+_0x18774b[0x0],_0x18774b[0x1]===_0xa15a('0x5c')?![]:!![]);_0x58c9b8[_0xa15a('0x5b')](_0xa15a('0x5d')+_0x18774b[0x0],_0x18774b[0x1]==='DESC'?![]:!![]);});}_0x58c9b8[_0xa15a('0xb')](_0xc925eb,_0xa15a('0xf'));return _0x58c9b8;}function getFilteredContacts(_0x144148){var _0x33c1c4=[];return db['Tag'][_0xa15a('0x5e')]({'attributes':['id',_0xa15a('0x31'),_0xa15a('0x5f')],'raw':!![]})[_0xa15a('0x4c')](function(_0x319b74){_0x33c1c4=_['keyBy'](_0x319b74,'id');var _0x4d2105={'type':db[_0xa15a('0x60')][_0xa15a('0x61')][_0xa15a('0x62')],'model':db[_0xa15a('0x63')],'mapToModel':!![],'nest':!![],'raw':!![]};return db[_0xa15a('0x64')][_0xa15a('0x65')](_0x144148[_0xa15a('0x66')](),_0x4d2105);})[_0xa15a('0x4c')](function(_0x2dfddf){_0x2dfddf[_0xa15a('0x1f')](function(_0x8fe2dd){if(_0x8fe2dd[_0xa15a('0x1c')]){_0x8fe2dd[_0xa15a('0x67')]=[];_0x8fe2dd[_0xa15a('0x1c')][_0xa15a('0x68')](',')[_0xa15a('0x1f')](function(_0x4b7b23){_0x8fe2dd['Tags']['push'](_0x33c1c4[_0x4b7b23]);});}delete _0x8fe2dd['TagIds'];});return _0x2dfddf;});}function countFilteredContacts(_0x56fc0f,_0x564df0){var _0x566c44=_0x56fc0f[_0xa15a('0x69')]();_0x566c44['field'](_0xa15a('0x6a'));_0x566c44=applyJoinClauses(_0x566c44,!![]);_0x56fc0f[_0xa15a('0x56')](_0xa15a('0x6b'));var _0x3094c7=utils[_0xa15a('0x23')](_0x564df0);if(!_[_0xa15a('0x6c')](_0x3094c7)){_0x566c44[_0xa15a('0xd')](_0xa15a('0x6d'),_0x3094c7);}var _0x319a0a={'type':db[_0xa15a('0x60')][_0xa15a('0x61')][_0xa15a('0x62')],'raw':!![]};return db[_0xa15a('0x64')][_0xa15a('0x65')](_0x566c44[_0xa15a('0x66')](),_0x319a0a)['then'](function(_0x50c2ad){return _0x50c2ad[0x0][_0xa15a('0x6a')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file +var _0x5392=['keyBy','QueryTypes','SELECT','CmContact','query','toString','Tags','clone','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','sequelize','lodash','squel','../parsers/advancedSearch','../parsers/qs','../interaction/utils','../../mysqldb','agent','ListId','true','cm_contacts','where','c.deletedAt\x20IS\x20NULL','subqry','uc.CmContactId\x20=\x20','.id','cm_contact_has_tags','ct.CmContactId\x20=\x20','t.id\x20=\x20ct.TagId','firstName','lastName','phone','mobile','email','CompanyId','createdAt','updatedAt','TagIds','includes','forEach','field','GROUP_CONCAT(DISTINCT\x20t.id)','expr','getSelectedTags','CONCAT(\x27,\x27,\x20subqry.TagIds,\x20\x27,\x27)\x20LIKE\x20?','replace','length','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','getFullTextValue','isNumeric','c.id\x20LIKE\x20?','c.fax\x20LIKE\x20?','c.email\x20LIKE\x20?','c.lastName\x20LIKE\x20?','sqlOperator','conditions','name','dateOfBirth','fieldType','castTo','DATE','buildExpression','default','value','start','end','Tag','split','map','tags','and','ids','User','uc.UserId\x20=\x20?','skip','compact','Contact','push','c.ListId\x20IN\x20?','\x20=\x20?','resolve','then','fields','tag','clause','filter','role','getLists','c.ListId\x20IS\x20NULL','attributes','select','c.id','limit','offset','group','subqry.id','having','order','subqry.','findAll','color'];(function(_0x4d180c,_0x45c68e){var _0x49b57e=function(_0x264741){while(--_0x264741){_0x4d180c['push'](_0x4d180c['shift']());}};_0x49b57e(++_0x45c68e);}(_0x5392,0xdb));var _0x2539=function(_0x25f1db,_0x31d090){_0x25f1db=_0x25f1db-0x0;var _0x5edaa2=_0x5392[_0x25f1db];return _0x5edaa2;};'use strict';var _=require(_0x2539('0x0'));var squel=require(_0x2539('0x1'));var as=require(_0x2539('0x2'));var qs=require(_0x2539('0x3'));var utils=require(_0x2539('0x4'));var db=require(_0x2539('0x5'))['db'];function skipContactsQuery(_0x4bc823,_0x33f0e7){var _0xeca8f0=![];if(_0x4bc823['role']===_0x2539('0x6')&&!_0x33f0e7['search']&&!_0x33f0e7[_0x2539('0x7')]&&_0x33f0e7['autocomplete']!==_0x2539('0x8')){_0xeca8f0=!![];}return _0xeca8f0;}function getContactsSubquery(){return squel['select']()['from'](_0x2539('0x9'),'c')[_0x2539('0xa')](_0x2539('0xb'));}function applyJoinClauses(_0x5795bb,_0x2e3414){var _0x454c2d=_0x2e3414?'c':_0x2539('0xc');_0x5795bb['left_join']('cm_user_has_contacts','uc',_0x2539('0xd')+_0x454c2d+_0x2539('0xe'))['left_join'](_0x2539('0xf'),'ct',_0x2539('0x10')+_0x454c2d+_0x2539('0xe'))['left_join']('tools_tags','t',_0x2539('0x11'));return _0x5795bb;}function addFieldsToQuery(_0xc848fa,_0x822f46,_0x4485fb,_0x29d492,_0x3d0961){var _0x1d57e8=_0x3d0961?'c':_0x2539('0xc');if(!_0x822f46){_0x822f46=['id',_0x2539('0x12'),_0x2539('0x13'),_0x2539('0x14'),_0x2539('0x15'),'fax',_0x2539('0x16'),'ListId',_0x2539('0x17'),_0x2539('0x18'),_0x2539('0x19'),'deletedAt',_0x2539('0x1a')];}else if(!_0x822f46[_0x2539('0x1b')]('id')){_0x822f46['push']('id');}var _0x5a0e07=_0x4485fb&&_0x3d0961||!_0x4485fb&&!_0x3d0961;if(_0x29d492){_0x5a0e07=_0x29d492&&_0x3d0961||!_0x29d492&&!_0x3d0961;}_0x822f46[_0x2539('0x1c')](function(_0x180cf7){if(_0x180cf7===_0x2539('0x1a')){if(_0x5a0e07){_0xc848fa[_0x2539('0x1d')](_0x2539('0x1e'),_0x180cf7);}else if(_0x4485fb||_0x29d492){_0xc848fa[_0x2539('0x1d')](_0x1d57e8+'.'+_0x180cf7);}}else{_0xc848fa[_0x2539('0x1d')](_0x1d57e8+'.'+_0x180cf7);}});return _0xc848fa;}function getSqlClauses(){var _0x4a3215={'default':squel[_0x2539('0x1f')](),'fields':squel[_0x2539('0x1f')](),'filter':squel[_0x2539('0x1f')](),'tags':{'clause':squel[_0x2539('0x1f')](),'ids':null},'user':{'clause':squel[_0x2539('0x1f')](),'skip':![]}};return _0x4a3215;}function parseTagParameter(_0x5eac23){var _0x251b83=squel['expr']();if(_0x5eac23){var _0xa2349e=utils[_0x2539('0x20')](_0x5eac23);_0xa2349e[_0x2539('0x1c')](function(_0x26b9af){_0x251b83['or'](_0x2539('0x21'),'%,'+_0x26b9af+',%');});}return _0x251b83;}function parseSearchFilter(_0x12175d){var _0x12a0ba=squel['expr']();if(_0x12175d){var _0x3357e0=_0x12175d[_0x2539('0x22')]('\x5c','\x5c\x5c')['replace'](/'/g,'\x27\x27');if(_0x3357e0['split']('\x20')[_0x2539('0x23')]>0x1){_0x12a0ba['or'](_0x2539('0x24'),qs[_0x2539('0x25')](_0x3357e0,!![]),null);}else{if(qs[_0x2539('0x26')](_0x3357e0)){_0x12a0ba['or'](_0x2539('0x27'),_0x3357e0+'%');_0x12a0ba['or']('c.phone\x20LIKE\x20?',_0x3357e0+'%');_0x12a0ba['or']('c.mobile\x20LIKE\x20?',_0x3357e0+'%');_0x12a0ba['or'](_0x2539('0x28'),_0x3357e0+'%');}else if(qs['isEmail'](_0x3357e0)){_0x12a0ba['or'](_0x2539('0x29'),_0x3357e0+'%');}else{_0x12a0ba['or']('c.firstName\x20LIKE\x20?','%'+_0x3357e0+'%');_0x12a0ba['or'](_0x2539('0x2a'),'%'+_0x3357e0+'%');_0x12a0ba['or'](_0x2539('0x29'),'%'+_0x3357e0+'%');}}}return _0x12a0ba;}function parseAdvancedSearchFilter(_0x4bf112,_0x451edd){var _0xc9aa38=getSqlClauses();var _0x88b650=as['parseSearch'](_0x4bf112);var _0x4e360a=_0x88b650[_0x2539('0x2b')];for(var _0x3ba364=0x0;_0x3ba364<_0x88b650['conditions'][_0x2539('0x23')];_0x3ba364++){var _0x1d2afb=_0x88b650[_0x2539('0x2c')][_0x3ba364];var _0x2f3653='c';var _0x3463fd=_['find'](_0x451edd,[_0x2539('0x2d'),_0x1d2afb['field']]);if(_0x3463fd){if(_0x1d2afb[_0x2539('0x1d')]===_0x2539('0x2e')||_0x3463fd[_0x2539('0x2f')]==='datetime'){_0x1d2afb[_0x2539('0x30')]=_0x2539('0x31');}var _0x2c42fa=as[_0x2539('0x32')](_0x2f3653,_0x3463fd['type'],_0x1d2afb);_0xc9aa38[_0x2539('0x33')][_0x4e360a](_0x2c42fa['text'],_0x2c42fa[_0x2539('0x34')][_0x2539('0x35')],_0x2c42fa[_0x2539('0x34')][_0x2539('0x36')]);}else{if(_0x1d2afb[_0x2539('0x1d')]===_0x2539('0x37')){var _0x2c8493=_0x1d2afb[_0x2539('0x34')][_0x2539('0x38')](',')[_0x2539('0x39')](function(_0x1d82f6){return Number(_0x1d82f6);});var _0x1c9ca6=parseTagParameter(_0x2c8493);_0xc9aa38[_0x2539('0x3a')]['clause'][_0x2539('0x3b')](_0x1c9ca6);_0xc9aa38['tags'][_0x2539('0x3c')]=_0x2c8493;}else if(_0x1d2afb[_0x2539('0x1d')]===_0x2539('0x3d')){_0xc9aa38['user']['clause'][_0x2539('0x3b')](_0x2539('0x3e'),_0x1d2afb[_0x2539('0x34')]);_0xc9aa38['user'][_0x2539('0x3f')]=!![];}}}return _0xc9aa38;}function parseModelFields(_0x1b20fa,_0x54b8e9){var _0x22548d=squel[_0x2539('0x1f')]();var _0x12be6f=_(_0x1b20fa)['keys']()['map'](function(_0x3258f5){return _['some'](_0x54b8e9,[_0x2539('0x2d'),_0x3258f5])?_0x3258f5:undefined;})[_0x2539('0x40')]()[_0x2539('0x34')]();if(_0x1b20fa[_0x2539('0x41')]){_0x12be6f['push'](_0x2539('0x41'));}if(_0x1b20fa['User']){_0x12be6f[_0x2539('0x42')]('User');}if(_0x12be6f[_0x2539('0x23')]>0x0){_0x12be6f[_0x2539('0x1c')](function(_0x474a25){if(_0x474a25===_0x2539('0x7')){_0x22548d[_0x2539('0x3b')](_0x2539('0x43'),[]['concat'](_0x1b20fa[_0x474a25]));}else if(_0x474a25==='Contact'){var _0xc83f64='%'+_0x1b20fa[_0x474a25]+'%';_0x22548d[_0x2539('0x3b')]('CONCAT_WS(\x27\x20\x27,\x20c.firstName,\x20c.lastName,\x20c.email)\x20LIKE\x20?',_0xc83f64);}else if(_0x474a25===_0x2539('0x3d')){_0x22548d['and'](_0x2539('0x3e'),_0x1b20fa[_0x474a25]);}else{_0x22548d[_0x2539('0x3b')]('c.'+_0x474a25+_0x2539('0x44'),_0x1b20fa[_0x474a25]);}});}return _0x22548d;}function parseQueryParameters(_0x33c342,_0x46cc01){var _0x5241c2=getSqlClauses();return Promise[_0x2539('0x45')]()['then'](function(){return parseModelFields(_0x33c342,_0x46cc01);})[_0x2539('0x46')](function(_0x2fcecc){_0x5241c2[_0x2539('0x47')]['and'](_0x2fcecc);return parseTagParameter(_0x33c342[_0x2539('0x48')]);})[_0x2539('0x46')](function(_0x595bd9){_0x5241c2[_0x2539('0x3a')][_0x2539('0x49')][_0x2539('0x3b')](_0x595bd9);return parseSearchFilter(_0x33c342[_0x2539('0x4a')]);})[_0x2539('0x46')](function(_0x494866){_0x5241c2[_0x2539('0x4a')]=_0x494866;return _0x5241c2;});}function checkListsRestrictions(_0x4b3521,_0xb18604,_0x586d53){var _0x460171=squel[_0x2539('0x1f')]();return Promise[_0x2539('0x45')]()[_0x2539('0x46')](function(){if(_0xb18604['search']&&_0x4b3521[_0x2539('0x4b')]==='agent'&&!_0x586d53){return _0x4b3521[_0x2539('0x4c')]({'attributes':['id'],'raw':!![]});}})[_0x2539('0x46')](function(_0x24ad8e){if(_0x24ad8e){if(_0x24ad8e[_0x2539('0x23')]===0x0){_0x460171[_0x2539('0x3b')](_0x2539('0x4d'));}else{_0x460171['and'](_0x2539('0x43'),_[_0x2539('0x39')](_0x24ad8e,'id'));}}})[_0x2539('0x46')](function(){return _0x460171;});}function buildContactsQuery(_0x307efa,_0x18acce,_0x19f324,_0xb1ef47,_0x4fb83f,_0x3c0c2a){if(_0x18acce){_0x18acce=_0x19f324[_0x2539('0x4e')];}_0x307efa=addFieldsToQuery(_0x307efa,_0x18acce,_0xb1ef47,_0x3c0c2a,!![]);var _0x1cf604=squel[_0x2539('0x4f')]();_0x1cf604=addFieldsToQuery(_0x1cf604,_0x18acce,_0xb1ef47,_0x3c0c2a,![]);if(_0xb1ef47||_0x3c0c2a){_0x307efa=applyJoinClauses(_0x307efa,!![]);_0x307efa['group'](_0x2539('0x50'));if(_0x19f324[_0x2539('0x51')]){_0x1cf604[_0x2539('0x51')](_0x19f324[_0x2539('0x51')]);}if(_0x19f324['offset']){_0x1cf604[_0x2539('0x52')](_0x19f324['offset']);}}else{_0x1cf604=applyJoinClauses(_0x1cf604,![]);_0x1cf604[_0x2539('0x53')](_0x2539('0x54'));if(_0x19f324[_0x2539('0x51')]){_0x307efa[_0x2539('0x51')](_0x19f324[_0x2539('0x51')]);}if(_0x19f324[_0x2539('0x52')]){_0x307efa[_0x2539('0x52')](_0x19f324[_0x2539('0x52')]);}}_0x1cf604[_0x2539('0x55')](_0x4fb83f);if(_0x19f324[_0x2539('0x56')]){_0x19f324[_0x2539('0x56')]['forEach'](function(_0x40d9cd){_0x307efa[_0x2539('0x56')]('c.'+_0x40d9cd[0x0],_0x40d9cd[0x1]==='DESC'?![]:!![]);_0x1cf604[_0x2539('0x56')](_0x2539('0x57')+_0x40d9cd[0x0],_0x40d9cd[0x1]==='DESC'?![]:!![]);});}_0x1cf604['from'](_0x307efa,_0x2539('0xc'));return _0x1cf604;}function getFilteredContacts(_0x3e890b){var _0x24df07=[];return db[_0x2539('0x37')][_0x2539('0x58')]({'attributes':['id',_0x2539('0x2d'),_0x2539('0x59')],'raw':!![]})[_0x2539('0x46')](function(_0x11c320){_0x24df07=_[_0x2539('0x5a')](_0x11c320,'id');var _0xb951d6={'type':db['Sequelize'][_0x2539('0x5b')][_0x2539('0x5c')],'model':db[_0x2539('0x5d')],'mapToModel':!![],'nest':!![],'raw':!![]};return db['sequelize'][_0x2539('0x5e')](_0x3e890b[_0x2539('0x5f')](),_0xb951d6);})[_0x2539('0x46')](function(_0x314f0e){_0x314f0e[_0x2539('0x1c')](function(_0x1301cb){if(_0x1301cb[_0x2539('0x1a')]){_0x1301cb[_0x2539('0x60')]=[];_0x1301cb[_0x2539('0x1a')][_0x2539('0x38')](',')[_0x2539('0x1c')](function(_0x282283){_0x1301cb[_0x2539('0x60')][_0x2539('0x42')](_0x24df07[_0x282283]);});}delete _0x1301cb['TagIds'];});return _0x314f0e;});}function countFilteredContacts(_0x535eb,_0x48ca48){var _0x32daef=_0x535eb[_0x2539('0x61')]();_0x32daef['field'](_0x2539('0x62'));_0x32daef=applyJoinClauses(_0x32daef,!![]);_0x535eb['group'](_0x2539('0x50'));var _0x1c43ff=utils[_0x2539('0x20')](_0x48ca48);if(!_[_0x2539('0x63')](_0x1c43ff)){_0x32daef[_0x2539('0xa')](_0x2539('0x64'),_0x1c43ff);}var _0x1d6635={'type':db[_0x2539('0x65')]['QueryTypes']['SELECT'],'raw':!![]};return db[_0x2539('0x66')][_0x2539('0x5e')](_0x32daef[_0x2539('0x5f')](),_0x1d6635)['then'](function(_0xccadea){return _0xccadea[0x0][_0x2539('0x62')];});}module['exports']={'buildContactsQuery':buildContactsQuery,'checkListsRestrictions':checkListsRestrictions,'countFilteredContacts':countFilteredContacts,'getContactsSubquery':getContactsSubquery,'getFilteredContacts':getFilteredContacts,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipContactsQuery':skipContactsQuery}; \ No newline at end of file diff --git a/server/components/encryptor/index.js b/server/components/encryptor/index.js index 7b39021..ee84fc6 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 _0x8c6c=['bluebird','lodash','secrets','session','aes-256-ctr','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','filter','hasOwnProperty','encryptFile','createReadStream','createCipher','data','update','binary','write','end','close','createWriteStream','unlink','secret','utf8','final','base64','createDecipher','crypto'];(function(_0x23552b,_0x5b042e){var _0x4c338d=function(_0x452bf5){while(--_0x452bf5){_0x23552b['push'](_0x23552b['shift']());}};_0x4c338d(++_0x5b042e);}(_0x8c6c,0x77));var _0xc8c6=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x8c6c[_0x321bb2];return _0x9c12ed;};'use strict';var crypto=require(_0xc8c6('0x0'));var fs=require('fs');var BPromise=require(_0xc8c6('0x1'));var _=require(_0xc8c6('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')('app');const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0xc8c6('0x3')][_0xc8c6('0x4')],'algorithm':_0xc8c6('0x5')};const fileOptions={'algorithm':_0xc8c6('0x6')};if(config[_0xc8c6('0x7')]&&config['encrypt'][_0xc8c6('0x8')]){var isSupported=isAlgorithmSupported(config[_0xc8c6('0x7')][_0xc8c6('0x8')]);if(isSupported){fileOptions[_0xc8c6('0x8')]=config[_0xc8c6('0x7')][_0xc8c6('0x8')];}else{var supportedAlgorithms=getSupportedCiphers()[_0xc8c6('0x9')](',\x20');logger['error'](config[_0xc8c6('0x7')][_0xc8c6('0x8')],_0xc8c6('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0x20c075){return AES_SUPPORTED_RX[_0xc8c6('0xb')](_0x20c075);}function getSupportedCiphers(){return crypto['getCiphers']()[_0xc8c6('0xc')](isASupportedCipher);}function isAlgorithmSupported(_0x4f5786){return getSupportedCiphers()['indexOf'](_0x4f5786)>-0x1;}function combineOptions(_0x43ff1f){var _0x6ef154={};for(var _0x58cf2b in fileOptions){if(fileOptions[_0xc8c6('0xd')](_0x58cf2b)){_0x6ef154[_0x58cf2b]=fileOptions[_0x58cf2b];}}if(_0x43ff1f){for(var _0x130c7e in _0x43ff1f){if(_0x43ff1f[_0xc8c6('0xd')](_0x130c7e)){_0x6ef154[_0x130c7e]=_0x43ff1f[_0x130c7e];}}}return _0x6ef154;}exports[_0xc8c6('0xe')]=function(_0x2dcf23,_0x253a43,_0x303aba,_0x536e47){return new BPromise(function(_0x4ec3c6,_0x44c411){_0x536e47=combineOptions(_0x536e47);var _0x1a4a8f=new Buffer(_0x303aba);var _0x4667cf=fs[_0xc8c6('0xf')](_0x2dcf23);var _0x3a5078=fs['createWriteStream'](_0x253a43);var _0x4aec0d=crypto[_0xc8c6('0x10')](_0x536e47[_0xc8c6('0x8')],_0x1a4a8f);_0x4667cf['on'](_0xc8c6('0x11'),function(_0x1b6ac4){var _0x21c9a9=new Buffer(_0x4aec0d[_0xc8c6('0x12')](_0x1b6ac4),_0xc8c6('0x13'));_0x3a5078[_0xc8c6('0x14')](_0x21c9a9);});_0x4667cf['on'](_0xc8c6('0x15'),function(){try{var _0x1ada1f=new Buffer(_0x4aec0d['final'](_0xc8c6('0x13')),_0xc8c6('0x13'));_0x3a5078[_0xc8c6('0x14')](_0x1ada1f);_0x3a5078[_0xc8c6('0x15')]();_0x3a5078['on'](_0xc8c6('0x16'),function(){return _0x4ec3c6(_0x253a43);});}catch(_0x1f1d63){fs['unlink'](_0x253a43);return _0x44c411(_0x1f1d63);}});});};exports['decryptFile']=function(_0x72cef9,_0x5e8974,_0x217fab,_0x34fbb8){return new BPromise(function(_0x136f18,_0x2e6b30){_0x34fbb8=combineOptions(_0x34fbb8);var _0x34c638=new Buffer(_0x217fab);var _0x5a50a2=fs['createReadStream'](_0x72cef9);var _0x3f5c3c=fs[_0xc8c6('0x17')](_0x5e8974);var _0x3e3bc5=crypto['createDecipher'](_0x34fbb8[_0xc8c6('0x8')],_0x34c638);_0x5a50a2['on'](_0xc8c6('0x11'),function(_0x50a303){var _0x23f23d=new Buffer(_0x3e3bc5[_0xc8c6('0x12')](_0x50a303),_0xc8c6('0x13'));_0x3f5c3c['write'](_0x23f23d);});_0x5a50a2['on'](_0xc8c6('0x15'),function(){try{var _0x1be8e2=new Buffer(_0x3e3bc5['final'](_0xc8c6('0x13')),_0xc8c6('0x13'));_0x3f5c3c[_0xc8c6('0x14')](_0x1be8e2);_0x3f5c3c[_0xc8c6('0x15')]();_0x3f5c3c['on'](_0xc8c6('0x16'),function(){return _0x136f18(_0x5e8974);});}catch(_0x55c6e8){fs[_0xc8c6('0x18')](_0x5e8974);return _0x2e6b30(_0x55c6e8);}});});};exports['encryptString']=function(_0xfa33d6,_0x4ca891,_0xe2e5e){var _0x49d678=_0xe2e5e||stringOptions[_0xc8c6('0x8')];var _0xc0c2f=_0x4ca891||stringOptions[_0xc8c6('0x19')];var _0x1b12b4=crypto[_0xc8c6('0x10')](_0x49d678,_0xc0c2f);var _0x434801=_0x1b12b4['update'](_0xfa33d6,_0xc8c6('0x1a'),'base64');_0x434801+=_0x1b12b4[_0xc8c6('0x1b')](_0xc8c6('0x1c'));return _0x434801;};exports['decryptString']=function(_0x3ff1c6,_0xa7b58e,_0x43fa5a){var _0x485c0a=_0x43fa5a||stringOptions[_0xc8c6('0x8')];var _0xde488e=_0xa7b58e||stringOptions[_0xc8c6('0x19')];var _0x2f8d8f=crypto[_0xc8c6('0x1d')](_0x485c0a,_0xde488e);var _0x32ec60=_0x2f8d8f[_0xc8c6('0x12')](_0x3ff1c6,_0xc8c6('0x1c'),_0xc8c6('0x1a'));_0x32ec60+=_0x2f8d8f[_0xc8c6('0x1b')](_0xc8c6('0x1a'));return _0x32ec60;}; \ No newline at end of file +var _0xba51=['session','aes192','encrypt','algorithm','join','is\x20not\x20a\x20supported\x20algorithm.\x20Your\x20system\x20supports\x20the\x20following\x20algorithms:','test','getCiphers','filter','indexOf','hasOwnProperty','encryptFile','createReadStream','createWriteStream','data','update','write','end','final','close','unlink','decryptFile','binary','encryptString','createCipher','utf8','base64','secret','crypto','bluebird','lodash','app','secrets'];(function(_0x5a0fd6,_0x3acc0d){var _0x38d2f0=function(_0x3a2b84){while(--_0x3a2b84){_0x5a0fd6['push'](_0x5a0fd6['shift']());}};_0x38d2f0(++_0x3acc0d);}(_0xba51,0x7f));var _0x1ba5=function(_0x5ca296,_0x256cea){_0x5ca296=_0x5ca296-0x0;var _0x28560d=_0xba51[_0x5ca296];return _0x28560d;};'use strict';var crypto=require(_0x1ba5('0x0'));var fs=require('fs');var BPromise=require(_0x1ba5('0x1'));var _=require(_0x1ba5('0x2'));var config=require('../../config/environment');var logger=require('../../config/logger')(_0x1ba5('0x3'));const AES_SUPPORTED_RX=/^aes(-)?\d{3}(-(cbc|cfb|ctr)(1|8)?){0,1}$/;const stringOptions={'secret':config[_0x1ba5('0x4')][_0x1ba5('0x5')],'algorithm':'aes-256-ctr'};const fileOptions={'algorithm':_0x1ba5('0x6')};if(config['encrypt']&&config[_0x1ba5('0x7')][_0x1ba5('0x8')]){var isSupported=isAlgorithmSupported(config[_0x1ba5('0x7')][_0x1ba5('0x8')]);if(isSupported){fileOptions['algorithm']=config[_0x1ba5('0x7')]['algorithm'];}else{var supportedAlgorithms=getSupportedCiphers()[_0x1ba5('0x9')](',\x20');logger['error'](config[_0x1ba5('0x7')][_0x1ba5('0x8')],_0x1ba5('0xa'),supportedAlgorithms);}}function isASupportedCipher(_0xcb8ea4){return AES_SUPPORTED_RX[_0x1ba5('0xb')](_0xcb8ea4);}function getSupportedCiphers(){return crypto[_0x1ba5('0xc')]()[_0x1ba5('0xd')](isASupportedCipher);}function isAlgorithmSupported(_0x47838f){return getSupportedCiphers()[_0x1ba5('0xe')](_0x47838f)>-0x1;}function combineOptions(_0x3b2c39){var _0x40d777={};for(var _0x6b8f44 in fileOptions){if(fileOptions[_0x1ba5('0xf')](_0x6b8f44)){_0x40d777[_0x6b8f44]=fileOptions[_0x6b8f44];}}if(_0x3b2c39){for(var _0x21e516 in _0x3b2c39){if(_0x3b2c39[_0x1ba5('0xf')](_0x21e516)){_0x40d777[_0x21e516]=_0x3b2c39[_0x21e516];}}}return _0x40d777;}exports[_0x1ba5('0x10')]=function(_0x16a0f7,_0x72ad56,_0x210031,_0x1c4c17){return new BPromise(function(_0x283bc6,_0x354f62){_0x1c4c17=combineOptions(_0x1c4c17);var _0x244f15=new Buffer(_0x210031);var _0x335b2a=fs[_0x1ba5('0x11')](_0x16a0f7);var _0x4d66c0=fs[_0x1ba5('0x12')](_0x72ad56);var _0x301a36=crypto['createCipher'](_0x1c4c17[_0x1ba5('0x8')],_0x244f15);_0x335b2a['on'](_0x1ba5('0x13'),function(_0x5c2b00){var _0x173bdf=new Buffer(_0x301a36[_0x1ba5('0x14')](_0x5c2b00),'binary');_0x4d66c0[_0x1ba5('0x15')](_0x173bdf);});_0x335b2a['on'](_0x1ba5('0x16'),function(){try{var _0xce6db2=new Buffer(_0x301a36[_0x1ba5('0x17')]('binary'),'binary');_0x4d66c0['write'](_0xce6db2);_0x4d66c0[_0x1ba5('0x16')]();_0x4d66c0['on'](_0x1ba5('0x18'),function(){return _0x283bc6(_0x72ad56);});}catch(_0x5206dc){fs[_0x1ba5('0x19')](_0x72ad56);return _0x354f62(_0x5206dc);}});});};exports[_0x1ba5('0x1a')]=function(_0x313407,_0x1d0672,_0x3dbc42,_0x126214){return new BPromise(function(_0x43a6a8,_0x1b7ead){_0x126214=combineOptions(_0x126214);var _0x32737c=new Buffer(_0x3dbc42);var _0x3b7fd8=fs[_0x1ba5('0x11')](_0x313407);var _0x10790c=fs['createWriteStream'](_0x1d0672);var _0x43ce9e=crypto['createDecipher'](_0x126214[_0x1ba5('0x8')],_0x32737c);_0x3b7fd8['on']('data',function(_0x5afc4b){var _0x40016c=new Buffer(_0x43ce9e['update'](_0x5afc4b),'binary');_0x10790c['write'](_0x40016c);});_0x3b7fd8['on']('end',function(){try{var _0x466a7a=new Buffer(_0x43ce9e[_0x1ba5('0x17')]('binary'),_0x1ba5('0x1b'));_0x10790c[_0x1ba5('0x15')](_0x466a7a);_0x10790c[_0x1ba5('0x16')]();_0x10790c['on'](_0x1ba5('0x18'),function(){return _0x43a6a8(_0x1d0672);});}catch(_0x353be9){fs[_0x1ba5('0x19')](_0x1d0672);return _0x1b7ead(_0x353be9);}});});};exports[_0x1ba5('0x1c')]=function(_0x34d567,_0x3eaa8b,_0x19343e){var _0x221735=_0x19343e||stringOptions[_0x1ba5('0x8')];var _0x4dac8d=_0x3eaa8b||stringOptions['secret'];var _0x1e3659=crypto[_0x1ba5('0x1d')](_0x221735,_0x4dac8d);var _0x105d56=_0x1e3659[_0x1ba5('0x14')](_0x34d567,_0x1ba5('0x1e'),_0x1ba5('0x1f'));_0x105d56+=_0x1e3659[_0x1ba5('0x17')](_0x1ba5('0x1f'));return _0x105d56;};exports['decryptString']=function(_0x17cdd9,_0x316a8c,_0xaae3eb){var _0x3178d7=_0xaae3eb||stringOptions[_0x1ba5('0x8')];var _0x4ac8d1=_0x316a8c||stringOptions[_0x1ba5('0x20')];var _0x31057a=crypto['createDecipher'](_0x3178d7,_0x4ac8d1);var _0x5ad685=_0x31057a[_0x1ba5('0x14')](_0x17cdd9,_0x1ba5('0x1f'),_0x1ba5('0x1e'));_0x5ad685+=_0x31057a[_0x1ba5('0x17')](_0x1ba5('0x1e'));return _0x5ad685;}; \ No newline at end of file diff --git a/server/components/export/csv.js b/server/components/export/csv.js index 42c20a4..eefeeae 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 _0xb752=['forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','basename','.csv','join','mkdirSync','each','length','%s.%s','csv','writeFileSync','zip\x20finished','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','inspect','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb','dbH','../../config/logger','analytics','argv','savename','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','split','splitSizeCsv','then','sequelize','query','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','SELECT','num','Empty','isInteger'];(function(_0xac151d,_0x4ea1d2){var _0x111dba=function(_0x13d7f4){while(--_0x13d7f4){_0xac151d['push'](_0xac151d['shift']());}};_0x111dba(++_0x4ea1d2);}(_0xb752,0x114));var _0x2b75=function(_0x2d1cad,_0x24a9bc){_0x2d1cad=_0x2d1cad-0x0;var _0x449809=_0xb752[_0x2d1cad];return _0x449809;};'use strict';var util=require(_0x2b75('0x0'));var path=require(_0x2b75('0x1'));var _=require(_0x2b75('0x2'));var csv=require(_0x2b75('0x3'));var fs=require('fs');var BPromise=require(_0x2b75('0x4'));var zipdir=require(_0x2b75('0x5'));var rimraf=require(_0x2b75('0x6'));var db=require(_0x2b75('0x7'))['db'];var dbH=require(_0x2b75('0x7'))[_0x2b75('0x8')];var logger=require(_0x2b75('0x9'))(_0x2b75('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x2b75('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x2b75('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x2dbd78,_0x462a48){var _0x34ed77={'status':_0x2dbd78};var _0x116e7d={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x462a48){_0x34ed77[_0x2b75('0xc')]=_0x462a48;}return db[_0x2b75('0xd')][_0x2b75('0xe')](_0x34ed77,_0x116e7d);}function main(){var _0x58d1ea=0x1388;var _0x43ee44;logger[_0x2b75('0xf')](util[_0x2b75('0x10')](_0x2b75('0x11'),EXTRACTED_REPORT_ID,_0x2b75('0x12')));return db[_0x2b75('0x13')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x2b75('0x14'),_0x2b75('0x15')]})[_0x2b75('0x16')](function(_0x1744db){if(_0x1744db){_0x43ee44=_0x1744db;_0x58d1ea=_0x43ee44['splitSizeCsv']||0x1388;}})[_0x2b75('0x16')](function(){return dbH[_0x2b75('0x17')][_0x2b75('0x18')](util[_0x2b75('0x10')](_0x2b75('0x19'),QUERY),{'type':dbH[_0x2b75('0x17')]['QueryTypes'][_0x2b75('0x1a')]});})[_0x2b75('0x16')](function(_0x13a1ac){if(!_0x13a1ac[0x0][_0x2b75('0x1b')]){return analyticExtractedReport(_0x2b75('0x1c'));}var _0x142a37=[];var _0x2678af=0x0;if(_0x43ee44[_0x2b75('0x14')]){if(_0x13a1ac&&_0x13a1ac['length']){var _0x54d63a=_['range'](_0x13a1ac[0x0][_0x2b75('0x1b')]/_0x58d1ea);var _0x11d701=Number[_0x2b75('0x1d')](_0x13a1ac[0x0][_0x2b75('0x1b')]/_0x58d1ea)?_0x13a1ac[0x0][_0x2b75('0x1b')]%_0x58d1ea:0x0;_0x54d63a[_0x2b75('0x1e')](function(_0x15149f){if(_0x15149f>0x0){_0x2678af+=_0x58d1ea;}_0x142a37[_0x2b75('0x1f')](dbH[_0x2b75('0x17')]['query'](util[_0x2b75('0x10')](_0x2b75('0x20'),QUERY,_0x58d1ea,_0x2678af),{'type':dbH[_0x2b75('0x17')][_0x2b75('0x21')]['SELECT']}));});if(_0x11d701>0x0){_0x2678af+=_0x58d1ea;_0x142a37[_0x2b75('0x1f')](dbH[_0x2b75('0x17')][_0x2b75('0x18')](util[_0x2b75('0x10')](_0x2b75('0x20'),QUERY,_0x11d701,_0x2678af),{'type':dbH[_0x2b75('0x17')][_0x2b75('0x21')][_0x2b75('0x1a')]}));}}}else{_0x142a37['push'](dbH['sequelize'][_0x2b75('0x18')](QUERY,{'type':dbH[_0x2b75('0x17')][_0x2b75('0x21')]['SELECT']}));}var _0x560bf3=path['dirname'](PATH);var _0x2fc95e=path[_0x2b75('0x22')](PATH,_0x2b75('0x23'));var _0x214ed0=_0x43ee44[_0x2b75('0x14')]&&_0x142a37['length']>0x1;var _0x4351ca=[];if(!fs['existsSync'](path[_0x2b75('0x24')](_0x560bf3,_0x2fc95e))&&_0x214ed0){fs[_0x2b75('0x25')](path[_0x2b75('0x24')](_0x560bf3,_0x2fc95e));}return BPromise[_0x2b75('0x26')](_0x142a37,function(_0x2c6f37){_0x4351ca[_0x2b75('0x1f')](_0x2c6f37);})[_0x2b75('0x16')](function(){for(var _0x5bc5a6=0x0;_0x5bc5a6<_0x4351ca[_0x2b75('0x27')];_0x5bc5a6+=0x1){var _0x9beef4;var _0x37cf4f=_0x4351ca[_0x5bc5a6];if(_0x214ed0){_0x9beef4=path[_0x2b75('0x24')](_0x560bf3,_0x2fc95e,util['format']('%s%d.%s',_0x2fc95e,_0x5bc5a6,'csv'));}else{_0x9beef4=path[_0x2b75('0x24')](_0x560bf3,util[_0x2b75('0x10')](_0x2b75('0x28'),_0x2fc95e,_0x2b75('0x29')));}fs[_0x2b75('0x2a')](_0x9beef4,csv(_0x37cf4f));}})[_0x2b75('0x16')](function(){if(_0x214ed0){return new Promise(function(_0x1ea612){zipdir(path[_0x2b75('0x24')](_0x560bf3,_0x2fc95e),{'saveTo':path['join'](_0x560bf3,util[_0x2b75('0x10')](_0x2b75('0x28'),_0x2fc95e,'zip'))},function(_0x3a14fb,_0x504ed3){rimraf(path[_0x2b75('0x24')](_0x560bf3,_0x2fc95e),function(){});_0x1ea612(_0x2b75('0x2b'));});});}})[_0x2b75('0x16')](function(){logger[_0x2b75('0xf')](util['format'](_0x2b75('0x2c'),EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x2b75('0x2d'),_0x214ed0?util[_0x2b75('0x10')]('%s.%s',_0x2fc95e,_0x214ed0?_0x2b75('0x2e'):_0x2b75('0x29')):null);});})[_0x2b75('0x2f')](function(_0x27fe3b){logger[_0x2b75('0xf')](util[_0x2b75('0x10')](_0x2b75('0x30'),EXTRACTED_REPORT_ID,'CSV'),util[_0x2b75('0x31')](_0x27fe3b,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport('Failed');})['finally'](function(){process[_0x2b75('0x32')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x7838=['dbH','../../config/logger','analytics','argv','AnalyticExtractedReport','update','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','CSV','Setting','find','splitSizeCsv','then','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','sequelize','QueryTypes','SELECT','num','split','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','query','dirname','.csv','length','existsSync','join','mkdirSync','each','%s%d.%s','%s.%s','csv','writeFileSync','zip','zip\x20finished','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','to-csv','bluebird','zip-dir','rimraf','../../mysqldb'];(function(_0x39e84d,_0x11931d){var _0x1991bc=function(_0xc81e32){while(--_0xc81e32){_0x39e84d['push'](_0x39e84d['shift']());}};_0x1991bc(++_0x11931d);}(_0x7838,0x1a8));var _0x8783=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x7838[_0x1facfa];return _0x9ec701;};'use strict';var util=require(_0x8783('0x0'));var path=require(_0x8783('0x1'));var _=require(_0x8783('0x2'));var csv=require(_0x8783('0x3'));var fs=require('fs');var BPromise=require(_0x8783('0x4'));var zipdir=require(_0x8783('0x5'));var rimraf=require(_0x8783('0x6'));var db=require('../../mysqldb')['db'];var dbH=require(_0x8783('0x7'))[_0x8783('0x8')];var logger=require(_0x8783('0x9'))(_0x8783('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x8783('0xb')][0x2]);var QUERY=process['argv'][0x3];var PATH=process[_0x8783('0xb')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x472ae7,_0x27f6fa){var _0x31b047={'status':_0x472ae7};var _0x100cd0={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x27f6fa){_0x31b047['savename']=_0x27f6fa;}return db[_0x8783('0xc')][_0x8783('0xd')](_0x31b047,_0x100cd0);}function main(){var _0x3b97fc=0x1388;var _0x5c2308;logger[_0x8783('0xe')](util[_0x8783('0xf')](_0x8783('0x10'),EXTRACTED_REPORT_ID,_0x8783('0x11')));return db[_0x8783('0x12')][_0x8783('0x13')]({'where':{'id':0x1},'raw':!![],'attributes':['id','split',_0x8783('0x14')]})[_0x8783('0x15')](function(_0x3dc524){if(_0x3dc524){_0x5c2308=_0x3dc524;_0x3b97fc=_0x5c2308[_0x8783('0x14')]||0x1388;}})[_0x8783('0x15')](function(){return dbH['sequelize']['query'](util[_0x8783('0xf')](_0x8783('0x16'),QUERY),{'type':dbH[_0x8783('0x17')][_0x8783('0x18')][_0x8783('0x19')]});})[_0x8783('0x15')](function(_0x575a66){if(!_0x575a66[0x0][_0x8783('0x1a')]){return analyticExtractedReport('Empty');}var _0x4c57bc=[];var _0x2c1f4b=0x0;if(_0x5c2308[_0x8783('0x1b')]){if(_0x575a66&&_0x575a66['length']){var _0x3a778f=_[_0x8783('0x1c')](_0x575a66[0x0][_0x8783('0x1a')]/_0x3b97fc);var _0x161174=Number[_0x8783('0x1d')](_0x575a66[0x0][_0x8783('0x1a')]/_0x3b97fc)?_0x575a66[0x0]['num']%_0x3b97fc:0x0;_0x3a778f[_0x8783('0x1e')](function(_0x26bde0){if(_0x26bde0>0x0){_0x2c1f4b+=_0x3b97fc;}_0x4c57bc[_0x8783('0x1f')](dbH[_0x8783('0x17')]['query'](util['format'](_0x8783('0x20'),QUERY,_0x3b97fc,_0x2c1f4b),{'type':dbH['sequelize'][_0x8783('0x18')][_0x8783('0x19')]}));});if(_0x161174>0x0){_0x2c1f4b+=_0x3b97fc;_0x4c57bc[_0x8783('0x1f')](dbH[_0x8783('0x17')][_0x8783('0x21')](util[_0x8783('0xf')](_0x8783('0x20'),QUERY,_0x161174,_0x2c1f4b),{'type':dbH[_0x8783('0x17')]['QueryTypes'][_0x8783('0x19')]}));}}}else{_0x4c57bc[_0x8783('0x1f')](dbH[_0x8783('0x17')][_0x8783('0x21')](QUERY,{'type':dbH[_0x8783('0x17')][_0x8783('0x18')][_0x8783('0x19')]}));}var _0xb42d6=path[_0x8783('0x22')](PATH);var _0x4caf4d=path['basename'](PATH,_0x8783('0x23'));var _0x4cd6e8=_0x5c2308[_0x8783('0x1b')]&&_0x4c57bc[_0x8783('0x24')]>0x1;var _0x334b7f=[];if(!fs[_0x8783('0x25')](path[_0x8783('0x26')](_0xb42d6,_0x4caf4d))&&_0x4cd6e8){fs[_0x8783('0x27')](path[_0x8783('0x26')](_0xb42d6,_0x4caf4d));}return BPromise[_0x8783('0x28')](_0x4c57bc,function(_0x49bbd2){_0x334b7f['push'](_0x49bbd2);})['then'](function(){for(var _0x196fee=0x0;_0x196fee<_0x334b7f[_0x8783('0x24')];_0x196fee+=0x1){var _0x3fceb2;var _0x1fba57=_0x334b7f[_0x196fee];if(_0x4cd6e8){_0x3fceb2=path[_0x8783('0x26')](_0xb42d6,_0x4caf4d,util[_0x8783('0xf')](_0x8783('0x29'),_0x4caf4d,_0x196fee,'csv'));}else{_0x3fceb2=path['join'](_0xb42d6,util['format'](_0x8783('0x2a'),_0x4caf4d,_0x8783('0x2b')));}fs[_0x8783('0x2c')](_0x3fceb2,csv(_0x1fba57));}})[_0x8783('0x15')](function(){if(_0x4cd6e8){return new Promise(function(_0x5be0d7){zipdir(path[_0x8783('0x26')](_0xb42d6,_0x4caf4d),{'saveTo':path[_0x8783('0x26')](_0xb42d6,util[_0x8783('0xf')]('%s.%s',_0x4caf4d,_0x8783('0x2d')))},function(_0x267e77,_0x24faf4){rimraf(path[_0x8783('0x26')](_0xb42d6,_0x4caf4d),function(){});_0x5be0d7(_0x8783('0x2e'));});});}})[_0x8783('0x15')](function(){logger[_0x8783('0xe')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'CSV'));return analyticExtractedReport(_0x8783('0x2f'),_0x4cd6e8?util[_0x8783('0xf')](_0x8783('0x2a'),_0x4caf4d,_0x4cd6e8?_0x8783('0x2d'):'csv'):null);});})[_0x8783('0x30')](function(_0x21d525){logger[_0x8783('0xe')](util['format'](_0x8783('0x31'),EXTRACTED_REPORT_ID,'CSV'),util[_0x8783('0x32')](_0x21d525,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x8783('0x33'));})[_0x8783('0x34')](function(){process[_0x8783('0x35')](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/export/pdf.js b/server/components/export/pdf.js index a40e55a..4859f26 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 _0x8cb9=['name','startDate','endDate','header','pageBreak','before','margin','toString','\x20/\x20','footer','Arial','black','right','num','Empty','Setting','split','splitSizePdf','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','basename','.pdf','existsSync','join','each','flatten','createPdfKitDocument','%s%d.%s','pdf','%s.%s','all','zip','info','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','inspect','Failed','exit','/fonts/arial-regular.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','YYYY-MM-DD','center','Interaction\x20Transcript','\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s','pipe','createWriteStream','finish','error','end','path','moment','pdfmake/src/printer','zip-dir','rimraf','JSDOM','bluebird','../../mysqldb','dbH','../../config/logger','analytics','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','savename','AnalyticExtractedReport','update','map','tableHeader','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s'];(function(_0x33d1e4,_0x42afe7){var _0x3bf601=function(_0x50e9a5){while(--_0x50e9a5){_0x33d1e4['push'](_0x33d1e4['shift']());}};_0x3bf601(++_0x42afe7);}(_0x8cb9,0xf2));var _0x98cb=function(_0x50bb0e,_0x449299){_0x50bb0e=_0x50bb0e-0x0;var _0xecd389=_0x8cb9[_0x50bb0e];return _0xecd389;};'use strict';var _=require('lodash');var fs=require('fs');var util=require('util');var path=require(_0x98cb('0x0'));var moment=require(_0x98cb('0x1'));var htmlToPdfmake=require('html-to-pdfmake');var PdfPrinter=require(_0x98cb('0x2'));var zipdir=require(_0x98cb('0x3'));var rimraf=require(_0x98cb('0x4'));var JSDOM=require('jsdom')[_0x98cb('0x5')];var window=new JSDOM('')['window'];var BPromise=require(_0x98cb('0x6'));var db=require(_0x98cb('0x7'))['db'];var dbH=require('../../mysqldb')[_0x98cb('0x8')];var logger=require(_0x98cb('0x9'))(_0x98cb('0xa'));var EXTRACTED_REPORT_ID=Number(process[_0x98cb('0xb')][0x2]);var QUERY=process[_0x98cb('0xb')][0x3];var PATH=process[_0x98cb('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x98cb('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x1bd572,_0x3c990a){var _0x4b303a={'status':_0x1bd572};var _0x535f05={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x3c990a){_0x4b303a[_0x98cb('0xd')]=_0x3c990a;}return db[_0x98cb('0xe')][_0x98cb('0xf')](_0x4b303a,_0x535f05);}function getHeaders(_0x56df3e){return _[_0x98cb('0x10')](_0x56df3e,function(_0xfb4038){return{'text':_0xfb4038,'style':_0x98cb('0x11')};});}function getRows(_0x26bad7,_0x2887c5){return _[_0x98cb('0x10')](_0x2887c5,function(_0x4aa0ef){return _(_0x4aa0ef)['pick'](_0x26bad7)[_0x98cb('0x10')](function(_0x3756eb){return _0x3756eb?_['toString'](_0x3756eb):'';})['value']();});}function createTable(_0x55ed0b,_0x1417e4){var _0x5eb14e={'widths':_['fill'](Array(_0x55ed0b[_0x98cb('0x12')]),0x91),'heights':function(_0x34e11e){return _0x34e11e===0x0?_0x98cb('0x13'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0xf525d1=getHeaders(_0x55ed0b);_0x5eb14e[_0x98cb('0x14')][_0x98cb('0x15')](_0xf525d1);var _0x49dcf8=getRows(_0x55ed0b,_0x1417e4);_0x5eb14e['body']=_0x5eb14e[_0x98cb('0x14')][_0x98cb('0x16')](_0x49dcf8);return _0x5eb14e;}function createTables(_0x25c170){var _0x22f50b=[];var _0x410fa6=_[_0x98cb('0x17')](Object[_0x98cb('0x18')](_0x25c170[0x0]),0x5);_0x410fa6[_0x98cb('0x19')](function(_0x2358f6){_0x22f50b['push'](createTable(_0x2358f6,_0x25c170));});return _0x22f50b;}function getPDFDocDefinition(_0x4b549f){var _0x2af99b=util[_0x98cb('0x1a')](_0x98cb('0x1b'),NAME,EXTRACTED_REPORT[_0x98cb('0x1c')],moment(EXTRACTED_REPORT[_0x98cb('0x1d')])[_0x98cb('0x1a')](FORMAT),moment(EXTRACTED_REPORT[_0x98cb('0x1e')])[_0x98cb('0x1a')](FORMAT));var _0x5657dd=[];for(var _0x393e49=0x0;_0x393e49<_0x4b549f[_0x98cb('0x12')];_0x393e49++){var _0x19aa4d=[];if(_0x393e49===0x0){_0x19aa4d[_0x98cb('0x15')]({'text':_0x2af99b,'style':_0x98cb('0x1f')});}var _0xcd6410={'table':_0x4b549f[_0x393e49]};if(_0x393e49>0x0){_0xcd6410[_0x98cb('0x20')]=_0x98cb('0x21');_0xcd6410[_0x98cb('0x22')]=[0x0,0x46,0x0,0x0];}_0x19aa4d[_0x98cb('0x15')](_0xcd6410);_0x5657dd[_0x98cb('0x15')](_0x19aa4d);}return{'pageSize':'A4','pageOrientation':'landscape','content':_0x5657dd,'footer':function(_0x1698fe,_0x2ddd3c){return{'text':_0x1698fe[_0x98cb('0x23')]()+_0x98cb('0x24')+_0x2ddd3c,'style':_0x98cb('0x25')};},'defaultStyle':{'font':_0x98cb('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x98cb('0x27')},'footer':{'alignment':_0x98cb('0x28'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x5648ea){var _0x469435=0x1388;var _0x5791e7;if(!_0x5648ea[0x0][_0x98cb('0x29')]){return analyticExtractedReport(_0x98cb('0x2a'));}return db[_0x98cb('0x2b')]['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x98cb('0x2c'),_0x98cb('0x2d')]})[_0x98cb('0x2e')](function(_0x3970ff){if(_0x3970ff){_0x5791e7=_0x3970ff;_0x469435=_0x5791e7['splitSizePdf']||0x3e8;}})['then'](function(){var _0x331f41=[];var _0x1ebbc4=0x0;if(_0x5791e7['split']){if(_0x5648ea&&_0x5648ea[_0x98cb('0x12')]){var _0x3d2ebe=_[_0x98cb('0x2f')](_0x5648ea[0x0][_0x98cb('0x29')]/_0x469435);var _0x378003=Number[_0x98cb('0x30')](_0x5648ea[0x0][_0x98cb('0x29')]/_0x469435)?_0x5648ea[0x0][_0x98cb('0x29')]%_0x469435:0x0;_0x3d2ebe['forEach'](function(_0x34d70d){if(_0x34d70d>0x0){_0x1ebbc4+=_0x469435;}_0x331f41['push'](dbH[_0x98cb('0x31')][_0x98cb('0x32')](util[_0x98cb('0x1a')](_0x98cb('0x33'),QUERY,_0x469435,_0x1ebbc4),{'type':dbH[_0x98cb('0x31')][_0x98cb('0x34')][_0x98cb('0x35')]}));});if(_0x378003>0x0){_0x1ebbc4+=_0x469435;_0x331f41[_0x98cb('0x15')](dbH[_0x98cb('0x31')][_0x98cb('0x32')](util[_0x98cb('0x1a')](_0x98cb('0x33'),QUERY,_0x378003,_0x1ebbc4),{'type':dbH[_0x98cb('0x31')][_0x98cb('0x34')]['SELECT']}));}}}else{_0x331f41['push'](dbH[_0x98cb('0x31')]['query'](QUERY,{'type':dbH[_0x98cb('0x31')][_0x98cb('0x34')][_0x98cb('0x35')]}));}var _0x3eb36f=path[_0x98cb('0x36')](PATH);var _0x3481a7=path[_0x98cb('0x37')](PATH,_0x98cb('0x38'));var _0x1dc1c4=_0x5791e7[_0x98cb('0x2c')]&&_0x331f41[_0x98cb('0x12')]>0x1;var _0x2a0937=[];if(!fs[_0x98cb('0x39')](path[_0x98cb('0x3a')](_0x3eb36f,_0x3481a7))&&_0x1dc1c4){fs['mkdirSync'](path[_0x98cb('0x3a')](_0x3eb36f,_0x3481a7));}return BPromise[_0x98cb('0x3b')](_0x331f41,function(_0x158778){_0x2a0937[_0x98cb('0x15')](_0x158778);})['then'](function(){var _0x1dcdde=[];for(var _0x1f7893=0x0;_0x1f7893<_0x2a0937[_0x98cb('0x12')];_0x1f7893+=0x1){var _0x2f2c98=_0x2a0937[_0x1f7893];var _0x4f563f=createTables(_[_0x98cb('0x3c')](_0x2f2c98));var _0x2c2148;var _0x3aefa9=getPDFDocDefinition(_0x4f563f);var _0xd353c5=getPDFPrinter();var _0x2642a6=_0xd353c5[_0x98cb('0x3d')](_0x3aefa9);if(_0x1dc1c4){_0x2c2148=path[_0x98cb('0x3a')](_0x3eb36f,_0x3481a7,util['format'](_0x98cb('0x3e'),_0x3481a7,_0x1f7893,_0x98cb('0x3f')));}else{_0x2c2148=path[_0x98cb('0x3a')](_0x3eb36f,util[_0x98cb('0x1a')](_0x98cb('0x40'),_0x3481a7,_0x98cb('0x3f')));}_0x1dcdde[_0x98cb('0x15')](writePDFDocument(_0x2642a6,_0x2c2148));}return Promise[_0x98cb('0x41')](_0x1dcdde);})['then'](function(){if(_0x1dc1c4){return new Promise(function(_0x4694e4){zipdir(path['join'](_0x3eb36f,_0x3481a7),{'saveTo':path[_0x98cb('0x3a')](_0x3eb36f,util[_0x98cb('0x1a')](_0x98cb('0x40'),_0x3481a7,_0x98cb('0x42')))},function(){rimraf(path[_0x98cb('0x3a')](_0x3eb36f,_0x3481a7),function(){});_0x4694e4('zip\x20finished');});});}})['then'](function(){if(!_0x1dc1c4)return;rimraf(path[_0x98cb('0x3a')](_0x3eb36f,_0x3481a7),function(){});})[_0x98cb('0x2e')](function(){logger[_0x98cb('0x43')](util['format']('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x98cb('0x44')));return analyticExtractedReport(_0x98cb('0x45'),_0x1dc1c4?util[_0x98cb('0x1a')]('%s.%s',_0x3481a7,_0x1dc1c4?_0x98cb('0x42'):_0x98cb('0x3f')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x98cb('0x43')](util[_0x98cb('0x1a')](_0x98cb('0x46'),EXTRACTED_REPORT_ID,'PDF'));return db['AnalyticExtractedReport']['findOne']({'where':{'id':EXTRACTED_REPORT_ID}})[_0x98cb('0x2e')](function(_0x473cb9){EXTRACTED_REPORT=_0x473cb9;return dbH[_0x98cb('0x31')][_0x98cb('0x32')](util[_0x98cb('0x1a')](_0x98cb('0x47'),QUERY),{'type':dbH['sequelize'][_0x98cb('0x34')][_0x98cb('0x35')]});})[_0x98cb('0x2e')](extractReport)[_0x98cb('0x48')](function(_0x151ce8){logger['info'](util['format']('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,'PDF'),util[_0x98cb('0x49')](_0x151ce8,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x98cb('0x4a'));})['finally'](function(){process[_0x98cb('0x4b')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x428139=new PdfPrinter({'Arial':{'normal':__dirname+_0x98cb('0x4c'),'bold':__dirname+'/fonts/arial-bold.ttf','italics':__dirname+'/fonts/arial-italic.ttf','bolditalics':__dirname+_0x98cb('0x4d')}});return _0x428139;}function getPDFDocDefinitionFromHTML(_0x17128a,_0x2f5604){var _0x1181b8=util[_0x98cb('0x1a')](_0x98cb('0x4e'),_0x2f5604[_0x98cb('0x4f')],_0x2f5604[_0x98cb('0x50')]);var _0x56d674=moment()[_0x98cb('0x1a')](_0x98cb('0x51'))[_0x98cb('0x23')]();var _0x347966=htmlToPdfmake(_0x17128a,{'window':window,'tableAutoSize':!![]});return{'content':[_0x347966],'defaultStyle':{'font':_0x98cb('0x26')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x98cb('0x52'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x98cb('0x52'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x98cb('0x52')}},'header':function(){return[{'text':_0x98cb('0x53'),'style':_0x98cb('0x1f')}];},'footer':function(_0x4404ec,_0x23df65){return[{'text':util[_0x98cb('0x1a')](_0x98cb('0x54'),_0x1181b8,_0x4404ec,_0x23df65,_0x56d674),'style':_0x98cb('0x25')}];}};}function writePDFDocument(_0x328ec4,_0x3703f9){return new Promise(function(_0x25060e,_0x52927f){var _0x551184=_0x328ec4[_0x98cb('0x55')](fs[_0x98cb('0x56')](_0x3703f9));_0x551184['on']('finish',function(){_0x25060e(_0x98cb('0x57'));});_0x551184['on'](_0x98cb('0x58'),function(_0x1107f1){_0x52927f(_0x1107f1);});_0x328ec4[_0x98cb('0x59')]();});}exports['createPdfFromHTML']=function(_0x24ab29,_0x49df55){var _0xcce678=getPDFPrinter();var _0x515a60=getPDFDocDefinitionFromHTML(_0x24ab29,_0x49df55);var _0x111351=_0xcce678['createPdfKitDocument'](_0x515a60);return writePDFDocument(_0x111351,_0x49df55['path'])[_0x98cb('0x48')](function(_0x5e3f48){throw _0x5e3f48;});}; \ No newline at end of file +var _0x7056=['Arial','black','right','num','Empty','then','range','isInteger','sequelize','query','%s\x20limit\x20%d\x20OFFSET\x20%d','QueryTypes','SELECT','dirname','.pdf','split','join','each','createPdfKitDocument','%s.%s','pdf','all','zip','zip\x20finished','info','Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed','PDF','Completed','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','AnalyticExtractedReport','findOne','SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Failed','finally','exit','/fonts/arial-bold.ttf','/fonts/arial-italic.ttf','/fonts/arial-bold-italic.ttf','%s\x20#%d','channel','interactionId','center','Interaction\x20Transcript','footer','createWriteStream','finish','error','end','createPdfFromHTML','lodash','util','html-to-pdfmake','pdfmake/src/printer','zip-dir','jsdom','JSDOM','window','bluebird','../../mysqldb','../../config/logger','argv','MMMM\x20Do\x20YYYY,\x20h:mm:ss\x20a','update','map','toString','value','length','auto','body','push','concat','chunk','keys','forEach','format','Name:\x20%s\x0aReport:\x20%s\x0aFrom:\x20%s\x20To:\x20%s','name','startDate','endDate','header','pageBreak','before','margin','landscape','\x20/\x20'];(function(_0x334d06,_0x35d6f5){var _0xce23fe=function(_0xdca3ad){while(--_0xdca3ad){_0x334d06['push'](_0x334d06['shift']());}};_0xce23fe(++_0x35d6f5);}(_0x7056,0x8a));var _0x6705=function(_0x46f777,_0x555d2f){_0x46f777=_0x46f777-0x0;var _0x22f986=_0x7056[_0x46f777];return _0x22f986;};'use strict';var _=require(_0x6705('0x0'));var fs=require('fs');var util=require(_0x6705('0x1'));var path=require('path');var moment=require('moment');var htmlToPdfmake=require(_0x6705('0x2'));var PdfPrinter=require(_0x6705('0x3'));var zipdir=require(_0x6705('0x4'));var rimraf=require('rimraf');var JSDOM=require(_0x6705('0x5'))[_0x6705('0x6')];var window=new JSDOM('')[_0x6705('0x7')];var BPromise=require(_0x6705('0x8'));var db=require(_0x6705('0x9'))['db'];var dbH=require(_0x6705('0x9'))['dbH'];var logger=require(_0x6705('0xa'))('analytics');var EXTRACTED_REPORT_ID=Number(process[_0x6705('0xb')][0x2]);var QUERY=process[_0x6705('0xb')][0x3];var PATH=process[_0x6705('0xb')][0x4];var NAME=process['argv'][0x5];var FORMAT=_0x6705('0xc');var EXTRACTED_REPORT;var EXIT_CODE=0x0;function analyticExtractedReport(_0x53b9ff,_0x4678b9){var _0x2845a3={'status':_0x53b9ff};var _0x5a4c43={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x4678b9){_0x2845a3['savename']=_0x4678b9;}return db['AnalyticExtractedReport'][_0x6705('0xd')](_0x2845a3,_0x5a4c43);}function getHeaders(_0x301ada){return _['map'](_0x301ada,function(_0x47d147){return{'text':_0x47d147,'style':'tableHeader'};});}function getRows(_0x4f93ee,_0x4b659c){return _[_0x6705('0xe')](_0x4b659c,function(_0x482fb1){return _(_0x482fb1)['pick'](_0x4f93ee)[_0x6705('0xe')](function(_0x265556){return _0x265556?_[_0x6705('0xf')](_0x265556):'';})[_0x6705('0x10')]();});}function createTable(_0x5c8b2d,_0x4d695f){var _0x134886={'widths':_['fill'](Array(_0x5c8b2d[_0x6705('0x11')]),0x91),'heights':function(_0x30a79e){return _0x30a79e===0x0?_0x6705('0x12'):0x32;},'dontBreakRows':!![],'headerRows':0x1,'body':[]};var _0x3542ed=getHeaders(_0x5c8b2d);_0x134886[_0x6705('0x13')][_0x6705('0x14')](_0x3542ed);var _0x4b2a4a=getRows(_0x5c8b2d,_0x4d695f);_0x134886[_0x6705('0x13')]=_0x134886[_0x6705('0x13')][_0x6705('0x15')](_0x4b2a4a);return _0x134886;}function createTables(_0x382878){var _0x142174=[];var _0x4f68a4=_[_0x6705('0x16')](Object[_0x6705('0x17')](_0x382878[0x0]),0x5);_0x4f68a4[_0x6705('0x18')](function(_0x24fe06){_0x142174['push'](createTable(_0x24fe06,_0x382878));});return _0x142174;}function getPDFDocDefinition(_0x41f6cb){var _0x4d1047=util[_0x6705('0x19')](_0x6705('0x1a'),NAME,EXTRACTED_REPORT[_0x6705('0x1b')],moment(EXTRACTED_REPORT[_0x6705('0x1c')])['format'](FORMAT),moment(EXTRACTED_REPORT[_0x6705('0x1d')])[_0x6705('0x19')](FORMAT));var _0x12bc8e=[];for(var _0xdb6786=0x0;_0xdb6786<_0x41f6cb[_0x6705('0x11')];_0xdb6786++){var _0x3f19ee=[];if(_0xdb6786===0x0){_0x3f19ee['push']({'text':_0x4d1047,'style':_0x6705('0x1e')});}var _0x4fd2c1={'table':_0x41f6cb[_0xdb6786]};if(_0xdb6786>0x0){_0x4fd2c1[_0x6705('0x1f')]=_0x6705('0x20');_0x4fd2c1[_0x6705('0x21')]=[0x0,0x46,0x0,0x0];}_0x3f19ee[_0x6705('0x14')](_0x4fd2c1);_0x12bc8e[_0x6705('0x14')](_0x3f19ee);}return{'pageSize':'A4','pageOrientation':_0x6705('0x22'),'content':_0x12bc8e,'footer':function(_0x4249ac,_0x599b6f){return{'text':_0x4249ac[_0x6705('0xf')]()+_0x6705('0x23')+_0x599b6f,'style':'footer'};},'defaultStyle':{'font':_0x6705('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'margin':[0x0,0x0,0x0,0xa]},'tableHeader':{'bold':!![],'fontSize':0xd,'color':_0x6705('0x25')},'footer':{'alignment':_0x6705('0x26'),'margin':[0x0,0x0,0x28,0x0]}}};}function extractReport(_0x31c0a2){var _0x2bbaf4=0x1388;var _0x2bd3f2;if(!_0x31c0a2[0x0][_0x6705('0x27')]){return analyticExtractedReport(_0x6705('0x28'));}return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id','split','splitSizePdf']})[_0x6705('0x29')](function(_0x4895db){if(_0x4895db){_0x2bd3f2=_0x4895db;_0x2bbaf4=_0x2bd3f2['splitSizePdf']||0x3e8;}})[_0x6705('0x29')](function(){var _0x47ee9e=[];var _0x33da6b=0x0;if(_0x2bd3f2['split']){if(_0x31c0a2&&_0x31c0a2[_0x6705('0x11')]){var _0x4cdeff=_[_0x6705('0x2a')](_0x31c0a2[0x0]['num']/_0x2bbaf4);var _0x340093=Number[_0x6705('0x2b')](_0x31c0a2[0x0][_0x6705('0x27')]/_0x2bbaf4)?_0x31c0a2[0x0][_0x6705('0x27')]%_0x2bbaf4:0x0;_0x4cdeff[_0x6705('0x18')](function(_0x2b5774){if(_0x2b5774>0x0){_0x33da6b+=_0x2bbaf4;}_0x47ee9e[_0x6705('0x14')](dbH[_0x6705('0x2c')][_0x6705('0x2d')](util['format'](_0x6705('0x2e'),QUERY,_0x2bbaf4,_0x33da6b),{'type':dbH['sequelize'][_0x6705('0x2f')]['SELECT']}));});if(_0x340093>0x0){_0x33da6b+=_0x2bbaf4;_0x47ee9e[_0x6705('0x14')](dbH[_0x6705('0x2c')][_0x6705('0x2d')](util['format'](_0x6705('0x2e'),QUERY,_0x340093,_0x33da6b),{'type':dbH['sequelize'][_0x6705('0x2f')][_0x6705('0x30')]}));}}}else{_0x47ee9e[_0x6705('0x14')](dbH[_0x6705('0x2c')]['query'](QUERY,{'type':dbH[_0x6705('0x2c')][_0x6705('0x2f')][_0x6705('0x30')]}));}var _0x273092=path[_0x6705('0x31')](PATH);var _0x13a17a=path['basename'](PATH,_0x6705('0x32'));var _0x4e698b=_0x2bd3f2[_0x6705('0x33')]&&_0x47ee9e['length']>0x1;var _0x2b74ca=[];if(!fs['existsSync'](path[_0x6705('0x34')](_0x273092,_0x13a17a))&&_0x4e698b){fs['mkdirSync'](path[_0x6705('0x34')](_0x273092,_0x13a17a));}return BPromise[_0x6705('0x35')](_0x47ee9e,function(_0x47d48d){_0x2b74ca['push'](_0x47d48d);})['then'](function(){var _0x4f3c59=[];for(var _0x27ac9a=0x0;_0x27ac9a<_0x2b74ca[_0x6705('0x11')];_0x27ac9a+=0x1){var _0x7e6904=_0x2b74ca[_0x27ac9a];var _0x22fcf6=createTables(_['flatten'](_0x7e6904));var _0x264602;var _0x5e35e5=getPDFDocDefinition(_0x22fcf6);var _0x4b619e=getPDFPrinter();var _0x273894=_0x4b619e[_0x6705('0x36')](_0x5e35e5);if(_0x4e698b){_0x264602=path[_0x6705('0x34')](_0x273092,_0x13a17a,util[_0x6705('0x19')]('%s%d.%s',_0x13a17a,_0x27ac9a,'pdf'));}else{_0x264602=path[_0x6705('0x34')](_0x273092,util[_0x6705('0x19')](_0x6705('0x37'),_0x13a17a,_0x6705('0x38')));}_0x4f3c59[_0x6705('0x14')](writePDFDocument(_0x273894,_0x264602));}return Promise[_0x6705('0x39')](_0x4f3c59);})['then'](function(){if(_0x4e698b){return new Promise(function(_0x4c974c){zipdir(path[_0x6705('0x34')](_0x273092,_0x13a17a),{'saveTo':path[_0x6705('0x34')](_0x273092,util[_0x6705('0x19')](_0x6705('0x37'),_0x13a17a,_0x6705('0x3a')))},function(){rimraf(path[_0x6705('0x34')](_0x273092,_0x13a17a),function(){});_0x4c974c(_0x6705('0x3b'));});});}})[_0x6705('0x29')](function(){if(!_0x4e698b)return;rimraf(path[_0x6705('0x34')](_0x273092,_0x13a17a),function(){});})[_0x6705('0x29')](function(){logger[_0x6705('0x3c')](util['format'](_0x6705('0x3d'),EXTRACTED_REPORT_ID,_0x6705('0x3e')));return analyticExtractedReport(_0x6705('0x3f'),_0x4e698b?util['format']('%s.%s',_0x13a17a,_0x4e698b?_0x6705('0x3a'):_0x6705('0x38')):null);});});}function main(){if(!EXTRACTED_REPORT_ID)return;logger[_0x6705('0x3c')](util[_0x6705('0x19')](_0x6705('0x40'),EXTRACTED_REPORT_ID,_0x6705('0x3e')));return db[_0x6705('0x41')][_0x6705('0x42')]({'where':{'id':EXTRACTED_REPORT_ID}})[_0x6705('0x29')](function(_0x339530){EXTRACTED_REPORT=_0x339530;return dbH[_0x6705('0x2c')][_0x6705('0x2d')](util['format'](_0x6705('0x43'),QUERY),{'type':dbH['sequelize'][_0x6705('0x2f')][_0x6705('0x30')]});})[_0x6705('0x29')](extractReport)[_0x6705('0x44')](function(_0x13437f){logger[_0x6705('0x3c')](util[_0x6705('0x19')](_0x6705('0x45'),EXTRACTED_REPORT_ID,_0x6705('0x3e')),util['inspect'](_0x13437f,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x6705('0x46'));})[_0x6705('0x47')](function(){process[_0x6705('0x48')](EXIT_CODE);});}main();function getPDFPrinter(){var _0x4647d4=new PdfPrinter({'Arial':{'normal':__dirname+'/fonts/arial-regular.ttf','bold':__dirname+_0x6705('0x49'),'italics':__dirname+_0x6705('0x4a'),'bolditalics':__dirname+_0x6705('0x4b')}});return _0x4647d4;}function getPDFDocDefinitionFromHTML(_0x591370,_0x532b31){var _0x352424=util[_0x6705('0x19')](_0x6705('0x4c'),_0x532b31[_0x6705('0x4d')],_0x532b31[_0x6705('0x4e')]);var _0xf6a22=moment()[_0x6705('0x19')]('YYYY-MM-DD')['toString']();var _0x4afaed=htmlToPdfmake(_0x591370,{'window':window,'tableAutoSize':!![]});return{'content':[_0x4afaed],'defaultStyle':{'font':_0x6705('0x24')},'styles':{'header':{'fontSize':0x12,'bold':!![],'alignment':_0x6705('0x4f'),'margin':[0xa,0xa,0xa,0xa]},'footer':{'fontSize':0x9,'alignment':_0x6705('0x4f'),'margin':[0xa,0x14,0xa,0xa]},'textblock':{'fontSize':0xb},'textfield':{'bold':!![]},'messageContainer':{'fontSize':0xa},'messageInfo':{'bold':!![]},'interactionData':{'alignment':_0x6705('0x4f')}},'header':function(){return[{'text':_0x6705('0x50'),'style':_0x6705('0x1e')}];},'footer':function(_0x38bf27,_0x529a70){return[{'text':util[_0x6705('0x19')]('\x09\x09XCALLY\x20Motion\x20-\x20%s\x09\x09\x09\x09%d/%d\x09\x09\x09\x09%s',_0x352424,_0x38bf27,_0x529a70,_0xf6a22),'style':_0x6705('0x51')}];}};}function writePDFDocument(_0x5129e3,_0x57b07d){return new Promise(function(_0x282ac4,_0x4c9157){var _0x513be8=_0x5129e3['pipe'](fs[_0x6705('0x52')](_0x57b07d));_0x513be8['on'](_0x6705('0x53'),function(){_0x282ac4(_0x6705('0x53'));});_0x513be8['on'](_0x6705('0x54'),function(_0x5d5ae5){_0x4c9157(_0x5d5ae5);});_0x5129e3[_0x6705('0x55')]();});}exports[_0x6705('0x56')]=function(_0x44486f,_0x1921bb){var _0xdf8c13=getPDFPrinter();var _0x12651b=getPDFDocDefinitionFromHTML(_0x44486f,_0x1921bb);var _0x399d1b=_0xdf8c13[_0x6705('0x36')](_0x12651b);return writePDFDocument(_0x399d1b,_0x1921bb['path'])[_0x6705('0x44')](function(_0x32d2d3){throw _0x32d2d3;});}; \ No newline at end of file diff --git a/server/components/export/xlsx.js b/server/components/export/xlsx.js index c86c2c5..e60117d 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 _0x6301=['join','each','%s%d.%s','xlsx','binary','%s.%s','XLSX','Completed','catch','Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','inspect','Failed','finally','exit','util','path','lodash','json2xls','bluebird','rimraf','../../mysqldb','dbH','../../config/logger','argv','AnalyticExtractedReport','info','format','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','Setting','find','split','splitSizeXlsx','then','query','sequelize','QueryTypes','SELECT','Empty','length','range','num','isInteger','forEach','%s\x20limit\x20%d\x20OFFSET\x20%d','push','dirname','basename','existsSync'];(function(_0x4f06b,_0x56c71d){var _0x3d6745=function(_0x976207){while(--_0x976207){_0x4f06b['push'](_0x4f06b['shift']());}};_0x3d6745(++_0x56c71d);}(_0x6301,0x9e));var _0x1630=function(_0x3fa479,_0x222259){_0x3fa479=_0x3fa479-0x0;var _0x23feb5=_0x6301[_0x3fa479];return _0x23feb5;};'use strict';var util=require(_0x1630('0x0'));var path=require(_0x1630('0x1'));var _=require(_0x1630('0x2'));var fs=require('fs');var json2xls=require(_0x1630('0x3'));var BPromise=require(_0x1630('0x4'));var zipdir=require('zip-dir');var rimraf=require(_0x1630('0x5'));var db=require('../../mysqldb')['db'];var dbH=require(_0x1630('0x6'))[_0x1630('0x7')];var logger=require(_0x1630('0x8'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x1630('0x9')][0x3];var PATH=process[_0x1630('0x9')][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x1916cc,_0x496099){var _0x374c93={'status':_0x1916cc};var _0x3800b9={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x496099){_0x374c93['savename']=_0x496099;}return db[_0x1630('0xa')]['update'](_0x374c93,_0x3800b9);}function main(){var _0x4eebd5=0x1388;var _0x445d83;logger[_0x1630('0xb')](util[_0x1630('0xc')](_0x1630('0xd'),EXTRACTED_REPORT_ID,'XLSX'));return db[_0x1630('0xe')][_0x1630('0xf')]({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x1630('0x10'),_0x1630('0x11')]})[_0x1630('0x12')](function(_0x4001ba){if(_0x4001ba){_0x445d83=_0x4001ba;_0x4eebd5=_0x445d83[_0x1630('0x11')]||0x1388;}})[_0x1630('0x12')](function(){return dbH['sequelize'][_0x1630('0x13')](util[_0x1630('0xc')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x1630('0x14')][_0x1630('0x15')][_0x1630('0x16')]});})[_0x1630('0x12')](function(_0x17d944){if(!_0x17d944[0x0]['num']){return analyticExtractedReport(_0x1630('0x17'));}var _0x1bb023=[];var _0xd75d92=0x0;if(_0x445d83[_0x1630('0x10')]){if(_0x17d944&&_0x17d944[_0x1630('0x18')]){var _0x3c9008=_[_0x1630('0x19')](_0x17d944[0x0][_0x1630('0x1a')]/_0x4eebd5);var _0x4a7cae=Number[_0x1630('0x1b')](_0x17d944[0x0]['num']/_0x4eebd5)?_0x17d944[0x0][_0x1630('0x1a')]%_0x4eebd5:0x0;_0x3c9008[_0x1630('0x1c')](function(_0x2c6c81){if(_0x2c6c81>0x0){_0xd75d92+=_0x4eebd5;}_0x1bb023['push'](dbH[_0x1630('0x14')][_0x1630('0x13')](util[_0x1630('0xc')](_0x1630('0x1d'),QUERY,_0x4eebd5,_0xd75d92),{'type':dbH[_0x1630('0x14')][_0x1630('0x15')][_0x1630('0x16')]}));});if(_0x4a7cae>0x0){_0xd75d92+=_0x4eebd5;_0x1bb023['push'](dbH['sequelize'][_0x1630('0x13')](util['format'](_0x1630('0x1d'),QUERY,_0x4a7cae,_0xd75d92),{'type':dbH[_0x1630('0x14')][_0x1630('0x15')][_0x1630('0x16')]}));}}}else{_0x1bb023[_0x1630('0x1e')](dbH['sequelize'][_0x1630('0x13')](QUERY,{'type':dbH[_0x1630('0x14')][_0x1630('0x15')][_0x1630('0x16')]}));}var _0x149647=path[_0x1630('0x1f')](PATH);var _0x33cdb2=path[_0x1630('0x20')](PATH,'.xlsx');var _0x380d6e=_0x445d83[_0x1630('0x10')]&&_0x1bb023[_0x1630('0x18')]>0x1;var _0x381db1=[];if(!fs[_0x1630('0x21')](path['join'](_0x149647,_0x33cdb2))&&_0x380d6e){fs['mkdirSync'](path[_0x1630('0x22')](_0x149647,_0x33cdb2));}return BPromise[_0x1630('0x23')](_0x1bb023,function(_0x188399){_0x381db1[_0x1630('0x1e')](_0x188399);})[_0x1630('0x12')](function(){for(var _0xb17c1e=0x0;_0xb17c1e<_0x381db1[_0x1630('0x18')];_0xb17c1e+=0x1){var _0x1490ce;var _0x32a73d=_0x381db1[_0xb17c1e];if(_0x380d6e){_0x1490ce=path[_0x1630('0x22')](_0x149647,_0x33cdb2,util[_0x1630('0xc')](_0x1630('0x24'),_0x33cdb2,_0xb17c1e,_0x1630('0x25')));}else{_0x1490ce=path[_0x1630('0x22')](_0x149647,util[_0x1630('0xc')]('%s.%s',_0x33cdb2,_0x1630('0x25')));}fs['writeFileSync'](_0x1490ce,json2xls(_0x32a73d),_0x1630('0x26'));}})[_0x1630('0x12')](function(){if(_0x380d6e){return new Promise(function(_0xe0a657){zipdir(path[_0x1630('0x22')](_0x149647,_0x33cdb2),{'saveTo':path[_0x1630('0x22')](_0x149647,util[_0x1630('0xc')](_0x1630('0x27'),_0x33cdb2,'zip'))},function(_0x5d3019,_0x57192e){rimraf(path['join'](_0x149647,_0x33cdb2),function(){});_0xe0a657('zip\x20finished');});});}})[_0x1630('0x12')](function(){logger[_0x1630('0xb')](util[_0x1630('0xc')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,_0x1630('0x28')));return analyticExtractedReport(_0x1630('0x29'),_0x380d6e?util[_0x1630('0xc')](_0x1630('0x27'),_0x33cdb2,_0x380d6e?'zip':_0x1630('0x25')):null);});})[_0x1630('0x2a')](function(_0x407910){logger['info'](util[_0x1630('0xc')](_0x1630('0x2b'),EXTRACTED_REPORT_ID,_0x1630('0x28')),util[_0x1630('0x2c')](_0x407910,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x1630('0x2d'));})[_0x1630('0x2e')](function(){process[_0x1630('0x2f')](EXIT_CODE);});}main(); \ No newline at end of file +var _0x72c9=['splitSizeXlsx','then','query','format','sequelize','QueryTypes','SELECT','num','Empty','length','range','isInteger','forEach','push','%s\x20limit\x20%d\x20OFFSET\x20%d','dirname','basename','.xlsx','existsSync','join','each','xlsx','%s.%s','writeFileSync','binary','zip','zip\x20finished','info','Completed','catch','Failed','finally','util','path','json2xls','bluebird','rimraf','../../mysqldb','../../config/logger','argv','Start\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format','XLSX','split'];(function(_0x4da662,_0x323c4b){var _0x590522=function(_0x387267){while(--_0x387267){_0x4da662['push'](_0x4da662['shift']());}};_0x590522(++_0x323c4b);}(_0x72c9,0xcc));var _0x972c=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x72c9[_0x3dd15e];return _0x231fd0;};'use strict';var util=require(_0x972c('0x0'));var path=require(_0x972c('0x1'));var _=require('lodash');var fs=require('fs');var json2xls=require(_0x972c('0x2'));var BPromise=require(_0x972c('0x3'));var zipdir=require('zip-dir');var rimraf=require(_0x972c('0x4'));var db=require(_0x972c('0x5'))['db'];var dbH=require(_0x972c('0x5'))['dbH'];var logger=require(_0x972c('0x6'))('analytics');var EXTRACTED_REPORT_ID=Number(process['argv'][0x2]);var QUERY=process[_0x972c('0x7')][0x3];var PATH=process['argv'][0x4];var EXIT_CODE=0x0;function analyticExtractedReport(_0x48afd7,_0x7de477){var _0x4e679c={'status':_0x48afd7};var _0x47a163={'where':{'id':EXTRACTED_REPORT_ID}};if(_0x7de477){_0x4e679c['savename']=_0x7de477;}return db['AnalyticExtractedReport']['update'](_0x4e679c,_0x47a163);}function main(){var _0x728231=0x1388;var _0x75d2c8;logger['info'](util['format'](_0x972c('0x8'),EXTRACTED_REPORT_ID,_0x972c('0x9')));return db['Setting']['find']({'where':{'id':0x1},'raw':!![],'attributes':['id',_0x972c('0xa'),'splitSizeXlsx']})['then'](function(_0x22e6f8){if(_0x22e6f8){_0x75d2c8=_0x22e6f8;_0x728231=_0x75d2c8[_0x972c('0xb')]||0x1388;}})[_0x972c('0xc')](function(){return dbH['sequelize'][_0x972c('0xd')](util[_0x972c('0xe')]('SELECT\x20count(*)\x20as\x20num\x20FROM\x20(%s)\x20t',QUERY),{'type':dbH[_0x972c('0xf')][_0x972c('0x10')][_0x972c('0x11')]});})[_0x972c('0xc')](function(_0x29cc34){if(!_0x29cc34[0x0][_0x972c('0x12')]){return analyticExtractedReport(_0x972c('0x13'));}var _0x3e3d11=[];var _0x3b685f=0x0;if(_0x75d2c8['split']){if(_0x29cc34&&_0x29cc34[_0x972c('0x14')]){var _0x83f53b=_[_0x972c('0x15')](_0x29cc34[0x0][_0x972c('0x12')]/_0x728231);var _0x5e8fba=Number[_0x972c('0x16')](_0x29cc34[0x0][_0x972c('0x12')]/_0x728231)?_0x29cc34[0x0][_0x972c('0x12')]%_0x728231:0x0;_0x83f53b[_0x972c('0x17')](function(_0x16af55){if(_0x16af55>0x0){_0x3b685f+=_0x728231;}_0x3e3d11[_0x972c('0x18')](dbH[_0x972c('0xf')][_0x972c('0xd')](util[_0x972c('0xe')](_0x972c('0x19'),QUERY,_0x728231,_0x3b685f),{'type':dbH[_0x972c('0xf')]['QueryTypes']['SELECT']}));});if(_0x5e8fba>0x0){_0x3b685f+=_0x728231;_0x3e3d11[_0x972c('0x18')](dbH[_0x972c('0xf')]['query'](util['format'](_0x972c('0x19'),QUERY,_0x5e8fba,_0x3b685f),{'type':dbH[_0x972c('0xf')][_0x972c('0x10')][_0x972c('0x11')]}));}}}else{_0x3e3d11[_0x972c('0x18')](dbH[_0x972c('0xf')][_0x972c('0xd')](QUERY,{'type':dbH['sequelize']['QueryTypes']['SELECT']}));}var _0x1650ff=path[_0x972c('0x1a')](PATH);var _0x4f3b8c=path[_0x972c('0x1b')](PATH,_0x972c('0x1c'));var _0x668c7c=_0x75d2c8[_0x972c('0xa')]&&_0x3e3d11[_0x972c('0x14')]>0x1;var _0x4df20f=[];if(!fs[_0x972c('0x1d')](path['join'](_0x1650ff,_0x4f3b8c))&&_0x668c7c){fs['mkdirSync'](path[_0x972c('0x1e')](_0x1650ff,_0x4f3b8c));}return BPromise[_0x972c('0x1f')](_0x3e3d11,function(_0x435ade){_0x4df20f[_0x972c('0x18')](_0x435ade);})['then'](function(){for(var _0x2a5dc6=0x0;_0x2a5dc6<_0x4df20f[_0x972c('0x14')];_0x2a5dc6+=0x1){var _0x129af8;var _0x17cbb6=_0x4df20f[_0x2a5dc6];if(_0x668c7c){_0x129af8=path[_0x972c('0x1e')](_0x1650ff,_0x4f3b8c,util[_0x972c('0xe')]('%s%d.%s',_0x4f3b8c,_0x2a5dc6,_0x972c('0x20')));}else{_0x129af8=path[_0x972c('0x1e')](_0x1650ff,util['format'](_0x972c('0x21'),_0x4f3b8c,_0x972c('0x20')));}fs[_0x972c('0x22')](_0x129af8,json2xls(_0x17cbb6),_0x972c('0x23'));}})[_0x972c('0xc')](function(){if(_0x668c7c){return new Promise(function(_0x3496f7){zipdir(path[_0x972c('0x1e')](_0x1650ff,_0x4f3b8c),{'saveTo':path[_0x972c('0x1e')](_0x1650ff,util[_0x972c('0xe')](_0x972c('0x21'),_0x4f3b8c,_0x972c('0x24')))},function(_0x1d273a,_0x3cfcb5){rimraf(path[_0x972c('0x1e')](_0x1650ff,_0x4f3b8c),function(){});_0x3496f7(_0x972c('0x25'));});});}})[_0x972c('0xc')](function(){logger[_0x972c('0x26')](util[_0x972c('0xe')]('Extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format\x20completed',EXTRACTED_REPORT_ID,'XLSX'));return analyticExtractedReport(_0x972c('0x27'),_0x668c7c?util[_0x972c('0xe')](_0x972c('0x21'),_0x4f3b8c,_0x668c7c?_0x972c('0x24'):_0x972c('0x20')):null);});})[_0x972c('0x28')](function(_0x23aa85){logger[_0x972c('0x26')](util[_0x972c('0xe')]('Error\x20during\x20extraction\x20report\x20with\x20id\x20%d\x20in\x20%s\x20format',EXTRACTED_REPORT_ID,_0x972c('0x9')),util['inspect'](_0x23aa85,{'showHidden':![],'depth':null}));EXIT_CODE=0x1;return analyticExtractedReport(_0x972c('0x29'));})[_0x972c('0x2a')](function(){process['exit'](EXIT_CODE);});}main(); \ No newline at end of file diff --git a/server/components/extensions/rewrite.js b/server/components/extensions/rewrite.js index 895365e..37eeba7 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 _0xc865=['util','models','Interval','findAll','then','intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','priority','extensions','find','push','format','type','VoiceExtensionId','inbound','CDR(routeid)=','context','outbound','CDR(destination)=','extension','cutdigits','${EXTEN:','${EXTEN}','Set','ExecIf','$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto(','CDR(prefix)=noprefix','outboundrouteid=','hasOwnProperty','recordingFormat','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','_XCALLY_MIXMONITOR_FORMAT=','wav','XCALLY-MOTION-ANSWER=0','XCALLY-MOTION-PROGRESS=0','toLowerCase','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','length','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','app','appType','custom','XCALLY-MOTION-ANSWER=1','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','Hangup','concat','destroy','bulkCreate','sortBy','catch','rewrite','lodash'];(function(_0x20a646,_0x486fc0){var _0x4bb624=function(_0xc2fa5f){while(--_0xc2fa5f){_0x20a646['push'](_0x20a646['shift']());}};_0x4bb624(++_0x486fc0);}(_0xc865,0x16c));var _0x5c86=function(_0x1a0bd1,_0x53ded9){_0x1a0bd1=_0x1a0bd1-0x0;var _0xb94bd6=_0xc865[_0x1a0bd1];return _0xb94bd6;};'use strict';var _=require(_0x5c86('0x0'));var util=require(_0x5c86('0x1'));function rewrite(_0x2de65a,_0x21ef59){var _0x53f26b=this;return _0x2de65a[_0x5c86('0x2')][_0x5c86('0x3')][_0x5c86('0x4')]({'raw':!![]})[_0x5c86('0x5')](function(_0xb1757d){_0x53f26b[_0x5c86('0x6')]=_0xb1757d;return _0x2de65a[_0x5c86('0x2')][_0x5c86('0x7')][_0x5c86('0x4')]({'where':{'IntervalId':_0x21ef59[_0x5c86('0x8')]},'raw':!![]});})[_0x5c86('0x5')](function(_0x4a81d4){return _0x2de65a[_0x5c86('0x2')][_0x5c86('0x7')][_0x5c86('0x4')]({'where':{'exten':{'$in':_[_0x5c86('0x9')](_[_0x5c86('0xa')](_0x4a81d4,_0x5c86('0xb')))}},'order':[{'raw':_0x5c86('0xc')}],'raw':!![]});})[_0x5c86('0x5')](function(_0x3d66b3){var _0x2a64f3=_[_0x5c86('0xd')](_0x3d66b3,{'priority':'1'});var _0x224de8=_[_0x5c86('0xd')](_0x3d66b3,{'isApp':0x1});var _0x53f894=_[_0x5c86('0xe')](_0x224de8,_0x5c86('0xb'));var _0x5eddce=[_0x5c86('0xf'),_0x5c86('0x10')];var _0x1e5510=[];var _0x1ef694=[];for(var _0xa70d3d in _0x53f894){if(_0x53f894['hasOwnProperty'](_0xa70d3d)){_0x53f26b[_0x5c86('0x11')]=0x2;_0x53f26b[_0x5c86('0x12')]=[];_0x53f26b['extension']=_[_0x5c86('0x13')](_0x2a64f3,{'exten':_0x53f894[_0xa70d3d][0x0][_0x5c86('0xb')]});_0x53f26b['extensions'][_0x5c86('0x14')]({'type':_0x53f894[_0xa70d3d][0x0]['type'],'app':'Set','appdata':util[_0x5c86('0x15')]('CDR(type)=%s',_0x53f894[_0xa70d3d][0x0][_0x5c86('0x16')]),'context':_0x53f894[_0xa70d3d][0x0]['context'],'exten':_0x53f894[_0xa70d3d][0x0]['exten'],'priority':_0x53f26b[_0x5c86('0x11')]++,'VoiceExtensionId':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x17')]});if(_0x53f894[_0xa70d3d][0x0]['type']===_0x5c86('0x18')){_0x53f26b[_0x5c86('0x12')][_0x5c86('0x14')]({'type':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x16')],'app':'Set','appdata':_0x5c86('0x19')+_0x53f894[_0xa70d3d][0x0][_0x5c86('0x17')],'context':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x1a')],'exten':_0x53f894[_0xa70d3d][0x0][_0x5c86('0xb')],'priority':_0x53f26b[_0x5c86('0x11')]++,'VoiceExtensionId':_0x53f894[_0xa70d3d][0x0]['VoiceExtensionId']});}else if(_0x53f894[_0xa70d3d][0x0][_0x5c86('0x16')]===_0x5c86('0x1b')){if(_0x53f26b['extension']){_0x53f26b[_0x5c86('0x12')][_0x5c86('0x14')]({'type':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x16')],'app':'Set','appdata':_0x5c86('0x1c')+(_0x53f26b[_0x5c86('0x1d')][_0x5c86('0x1e')]?_0x5c86('0x1f')+_0x53f26b[_0x5c86('0x1d')][_0x5c86('0x1e')]+'}':_0x5c86('0x20')),'context':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x1a')],'exten':_0x53f894[_0xa70d3d][0x0]['exten'],'priority':_0x53f26b[_0x5c86('0x11')]++,'VoiceExtensionId':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x17')]});}_0x53f26b['extensions'][_0x5c86('0x14')]({'type':_0x53f894[_0xa70d3d][0x0]['type'],'app':_0x5c86('0x21'),'appdata':'CDR(routeid)='+_0x53f894[_0xa70d3d][0x0][_0x5c86('0x17')],'context':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x1a')],'exten':_0x53f894[_0xa70d3d][0x0]['exten'],'priority':_0x53f26b[_0x5c86('0x11')]++,'VoiceExtensionId':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x17')]});var _0x4b21fd=_0x53f26b['priority']++;_0x53f26b[_0x5c86('0x12')][_0x5c86('0x14')]({'type':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x16')],'app':_0x5c86('0x22'),'appdata':_0x5c86('0x23')+(_0x4b21fd+0x2)+'):Goto('+(_0x4b21fd+0x1)+')','context':_0x53f894[_0xa70d3d][0x0]['context'],'exten':_0x53f894[_0xa70d3d][0x0][_0x5c86('0xb')],'priority':_0x4b21fd,'VoiceExtensionId':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x17')]});if(_0x53f26b[_0x5c86('0x1d')]){_0x53f26b[_0x5c86('0x12')][_0x5c86('0x14')]({'type':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x16')],'app':_0x5c86('0x21'),'appdata':_0x53f26b[_0x5c86('0x1d')][_0x5c86('0x1e')]?'CDR(prefix)=${EXTEN:0:'+_0x53f26b['extension'][_0x5c86('0x1e')]+'}':_0x5c86('0x24'),'context':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x1a')],'exten':_0x53f894[_0xa70d3d][0x0][_0x5c86('0xb')],'priority':_0x53f26b['priority']++,'VoiceExtensionId':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x17')]});}_0x53f26b[_0x5c86('0x12')]['push']({'type':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x16')],'app':_0x5c86('0x21'),'appdata':_0x5c86('0x25')+_0x53f894[_0xa70d3d][0x0][_0x5c86('0x17')],'context':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x1a')],'exten':_0x53f894[_0xa70d3d][0x0][_0x5c86('0xb')],'priority':_0x53f26b['priority']++,'VoiceExtensionId':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x17')]});if(_0x53f26b[_0x5c86('0x1d')]&&_0x53f26b[_0x5c86('0x1d')][_0x5c86('0x26')](_0x5c86('0x27'))&&_0x53f26b[_0x5c86('0x1d')]['recordingFormat']!=='none'){_0x53f26b[_0x5c86('0x12')][_0x5c86('0x14')]({'type':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x16')],'app':'Set','appdata':_0x5c86('0x28'),'context':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x1a')],'exten':_0x53f894[_0xa70d3d][0x0][_0x5c86('0xb')],'priority':_0x53f26b[_0x5c86('0x11')]++,'VoiceExtensionId':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x17')]});_0x53f26b['extensions'][_0x5c86('0x14')]({'type':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x16')],'app':'Set','appdata':_0x5c86('0x29')+_0x53f26b[_0x5c86('0x1d')]['recordingFormat']||_0x5c86('0x2a'),'context':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x1a')],'exten':_0x53f894[_0xa70d3d][0x0]['exten'],'priority':_0x53f26b['priority']++,'VoiceExtensionId':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x17')]});}}_0x53f26b[_0x5c86('0x12')]['push']({'type':_0x53f894[_0xa70d3d][0x0]['type'],'app':_0x5c86('0x21'),'appdata':_0x5c86('0x2b'),'context':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x1a')],'exten':_0x53f894[_0xa70d3d][0x0][_0x5c86('0xb')],'priority':_0x53f26b[_0x5c86('0x11')]++,'VoiceExtensionId':_0x53f894[_0xa70d3d][0x0]['VoiceExtensionId']});_0x53f26b['extensions'][_0x5c86('0x14')]({'type':_0x53f894[_0xa70d3d][0x0]['type'],'app':'Set','appdata':_0x5c86('0x2c'),'context':_0x53f894[_0xa70d3d][0x0]['context'],'exten':_0x53f894[_0xa70d3d][0x0][_0x5c86('0xb')],'priority':_0x53f26b[_0x5c86('0x11')]++,'VoiceExtensionId':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x17')]});_0x53f26b[_0x5c86('0x12')][_0x5c86('0x14')]({'type':_0x53f894[_0xa70d3d][0x0]['type'],'app':_0x5c86('0x21'),'appdata':'MONITOR_OPTIONS=ab','context':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x1a')],'exten':_0x53f894[_0xa70d3d][0x0][_0x5c86('0xb')],'priority':_0x53f26b[_0x5c86('0x11')]++,'VoiceExtensionId':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x17')]});for(var _0x49f22a=0x0,_0x580e47=0x0;_0x49f22a<_0x53f894[_0xa70d3d]['length'];_0x49f22a+=0x1,_0x580e47=0x0){var _0x5101b3=_0x53f894[_0xa70d3d][_0x49f22a];if(_0x5101b3[_0x5c86('0x16')]){_0x5101b3[_0x5c86('0x16')]=_0x5101b3[_0x5c86('0x16')][_0x5c86('0x2d')]();}var _0x3ae429=[];var _0x34812a=[];delete _0x5101b3['id'];delete _0x5101b3[_0x5c86('0x2e')];delete _0x5101b3[_0x5c86('0x2f')];var _0x4d0572=_0x5101b3[_0x5c86('0x30')]!==_0x5c86('0x31')?[_0x5101b3[_0x5c86('0x30')]]:_0x5101b3[_0x5c86('0x8')]?_['map'](_[_0x5c86('0xd')](_0x53f26b[_0x5c86('0x6')],{'IntervalId':_0x5101b3[_0x5c86('0x8')]}),'interval'):[];if(_0x5101b3['hasOwnProperty'](_0x5c86('0x32'))){if(_0x5101b3['tag']&&_0x5101b3[_0x5c86('0x32')]!=='--'){_0x3ae429['push']({'type':_0x5101b3[_0x5c86('0x16')],'app':_0x5c86('0x21'),'appdata':_0x5c86('0x33')+_0x5101b3[_0x5c86('0x32')],'context':_0x5101b3[_0x5c86('0x1a')],'exten':_0x5101b3['exten'],'priority':_0x4d0572[_0x5c86('0x34')]+_0x53f26b[_0x5c86('0x11')]+_0x580e47++,'VoiceExtensionId':_0x5101b3[_0x5c86('0x17')]});}}if(_0x5101b3[_0x5c86('0x16')]===_0x5c86('0x1b')&&_0x5101b3[_0x5c86('0x26')](_0x5c86('0x35'))){if(_0x5101b3[_0x5c86('0x35')]){_0x3ae429[_0x5c86('0x14')]({'type':_0x5101b3[_0x5c86('0x16')],'app':_0x5c86('0x22'),'appdata':'$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)='+_0x5101b3[_0x5c86('0x35')]+')','context':_0x5101b3[_0x5c86('0x1a')],'exten':_0x5101b3[_0x5c86('0xb')],'priority':_0x4d0572[_0x5c86('0x34')]+_0x53f26b[_0x5c86('0x11')]+_0x580e47++,'VoiceExtensionId':_0x5101b3[_0x5c86('0x17')]});}else{_0x3ae429[_0x5c86('0x14')]({'type':_0x5101b3[_0x5c86('0x16')],'app':_0x5c86('0x22'),'appdata':_0x5c86('0x36'),'context':_0x5101b3[_0x5c86('0x1a')],'exten':_0x5101b3[_0x5c86('0xb')],'priority':_0x4d0572['length']+_0x53f26b['priority']+_0x580e47++,'VoiceExtensionId':_0x5101b3[_0x5c86('0x17')]});}}if(_0x5101b3['hasOwnProperty'](_0x5c86('0x37'))){if(_0x5eddce['indexOf'](_0x5101b3[_0x5c86('0x38')][_0x5c86('0x2d')]())>=0x0&&_0x5101b3[_0x5c86('0x39')]!==_0x5c86('0x3a')){if(_0x5101b3[_0x5c86('0x37')]){_0x3ae429[_0x5c86('0x14')]({'type':_0x5101b3[_0x5c86('0x16')],'app':_0x5c86('0x22'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0x5101b3[_0x5c86('0x1a')],'exten':_0x5101b3['exten'],'priority':_0x4d0572[_0x5c86('0x34')]+_0x53f26b[_0x5c86('0x11')]+_0x580e47++,'VoiceExtensionId':_0x5101b3[_0x5c86('0x17')]});_0x3ae429[_0x5c86('0x14')]({'type':_0x5101b3[_0x5c86('0x16')],'app':_0x5c86('0x21'),'appdata':_0x5c86('0x3b'),'context':_0x5101b3[_0x5c86('0x1a')],'exten':_0x5101b3[_0x5c86('0xb')],'priority':_0x4d0572[_0x5c86('0x34')]+_0x53f26b[_0x5c86('0x11')]+_0x580e47++,'VoiceExtensionId':_0x5101b3[_0x5c86('0x17')]});}else{_0x3ae429['push']({'type':_0x5101b3[_0x5c86('0x16')],'app':'ExecIf','appdata':_0x5c86('0x3c'),'context':_0x5101b3[_0x5c86('0x1a')],'exten':_0x5101b3[_0x5c86('0xb')],'priority':_0x4d0572['length']+_0x53f26b[_0x5c86('0x11')]+_0x580e47++,'VoiceExtensionId':_0x5101b3['VoiceExtensionId']});_0x3ae429[_0x5c86('0x14')]({'type':_0x5101b3['type'],'app':_0x5c86('0x21'),'appdata':_0x5c86('0x3d'),'context':_0x5101b3[_0x5c86('0x1a')],'exten':_0x5101b3[_0x5c86('0xb')],'priority':_0x4d0572['length']+_0x53f26b[_0x5c86('0x11')]+_0x580e47++,'VoiceExtensionId':_0x5101b3[_0x5c86('0x17')]});}}}for(var _0x4fae70=0x0;_0x4fae70<_0x4d0572[_0x5c86('0x34')];_0x4fae70+=0x1){var _0x296486=_0x53f26b[_0x5c86('0x11')]+_0x4d0572[_0x5c86('0x34')];var _0x142255=_0x4fae70===_0x4d0572[_0x5c86('0x34')]-0x1?_0x53f26b['priority']+_0x3ae429[_0x5c86('0x34')]+_0x34812a[_0x5c86('0x34')]+0x2:_0x53f26b[_0x5c86('0x11')]+_0x4fae70+0x1;_0x3ae429[_0x5c86('0x3e')](_0x4fae70,0x0,{'type':_0x5101b3['type'],'app':_0x5c86('0x3f'),'appdata':_0x4d0572[_0x4fae70]+'?'+_0x5101b3[_0x5c86('0x1a')]+_0x5c86('0x40')+_0x296486+':'+_0x5101b3[_0x5c86('0x1a')]+_0x5c86('0x40')+_0x142255,'exten':_0x5101b3[_0x5c86('0xb')],'context':_0x5101b3[_0x5c86('0x1a')],'priority':_0x53f26b[_0x5c86('0x11')]+_0x4fae70,'VoiceExtensionId':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x17')]});}_0x5101b3[_0x5c86('0x11')]=_0x3ae429[_0x5c86('0x34')]?_['last'](_0x3ae429)[_0x5c86('0x11')]+0x1:_0x53f26b[_0x5c86('0x11')];_0x53f26b[_0x5c86('0x11')]=(_0x34812a['length']?_[_0x5c86('0x41')](_0x34812a)[_0x5c86('0x11')]:_0x5101b3[_0x5c86('0x11')])+0x1;_0x53f26b[_0x5c86('0x12')]=_['concat'](_0x53f26b[_0x5c86('0x12')],_0x3ae429,[_0x5101b3],_0x34812a);}_0x53f26b[_0x5c86('0x12')][_0x5c86('0x14')]({'type':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x16')],'app':_0x5c86('0x42'),'exten':_0x53f894[_0xa70d3d][0x0][_0x5c86('0xb')],'context':_0x53f894[_0xa70d3d][0x0][_0x5c86('0x1a')],'priority':_0x53f26b[_0x5c86('0x11')],'VoiceExtensionId':_0x53f894[_0xa70d3d][0x0]['VoiceExtensionId']});_0x1e5510['push'](_0x53f894[_0xa70d3d][0x0][_0x5c86('0x17')]);_0x1ef694=_[_0x5c86('0x43')](_0x1ef694,_0x53f26b[_0x5c86('0x12')]);}}return _0x2de65a['transaction'](function(_0x11c9dd){return _0x2de65a[_0x5c86('0x2')]['VoiceExtension'][_0x5c86('0x44')]({'where':{'VoiceExtensionId':{'$in':_0x1e5510}},'transaction':_0x11c9dd})['then'](function(_0x5a3b60){return _0x2de65a[_0x5c86('0x2')][_0x5c86('0x7')][_0x5c86('0x45')](_[_0x5c86('0x46')](_0x1ef694,_0x5c86('0x11')),{'transaction':_0x11c9dd});});});})[_0x5c86('0x47')](function(_0x18ad29){console['error'](_0x18ad29);});}exports[_0x5c86('0x48')]=rewrite; \ No newline at end of file +var _0x8ae3=['intervals','VoiceExtension','IntervalId','uniq','map','exten','CAST(priority\x20AS\x20UNSIGNED)','filter','groupBy','queue','playback','hasOwnProperty','priority','extensions','push','type','Set','format','CDR(type)=%s','context','inbound','CDR(routeid)=','VoiceExtensionId','outbound','CDR(destination)=','extension','cutdigits','ExecIf','):Goto(','CDR(prefix)=${EXTEN:0:','CDR(prefix)=noprefix','outboundrouteid=','recordingFormat','none','_XCALLY_MIXMONITOR_UNIQUEID=${UNIQUEID}','wav','XCALLY-MOTION-ANSWER=0','MONITOR_OPTIONS=ab','length','createdAt','updatedAt','interval','*,*,*,*','tag','CDR(tag)=','callerID','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):Set(CALLERID(all)=','$[${LEN(${PREFIX-CALLERIDALL})}\x20>\x200]?Set(CALLERID(all)=${PREFIX-CALLERIDALL}):NoOp(No\x20number\x20available)','answer','indexOf','app','toLowerCase','custom','$[${XCALLY-MOTION-PROGRESS}=0]?Progress','XCALLY-MOTION-PROGRESS=1','splice','GotoIfTime',',${EXTEN},','last','concat','Hangup','destroy','bulkCreate','sortBy','catch','error','rewrite','lodash','util','models','Interval','findAll','then'];(function(_0x4d394d,_0x40e7b3){var _0x4f0003=function(_0x56d25d){while(--_0x56d25d){_0x4d394d['push'](_0x4d394d['shift']());}};_0x4f0003(++_0x40e7b3);}(_0x8ae3,0xd5));var _0x38ae=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x8ae3[_0x20a584];return _0x4b41a8;};'use strict';var _=require(_0x38ae('0x0'));var util=require(_0x38ae('0x1'));function rewrite(_0x355044,_0x2bff52){var _0x5ceaca=this;return _0x355044[_0x38ae('0x2')][_0x38ae('0x3')][_0x38ae('0x4')]({'raw':!![]})[_0x38ae('0x5')](function(_0x11e2a5){_0x5ceaca[_0x38ae('0x6')]=_0x11e2a5;return _0x355044[_0x38ae('0x2')][_0x38ae('0x7')]['findAll']({'where':{'IntervalId':_0x2bff52[_0x38ae('0x8')]},'raw':!![]});})[_0x38ae('0x5')](function(_0x5f15a2){return _0x355044[_0x38ae('0x2')][_0x38ae('0x7')]['findAll']({'where':{'exten':{'$in':_[_0x38ae('0x9')](_[_0x38ae('0xa')](_0x5f15a2,_0x38ae('0xb')))}},'order':[{'raw':_0x38ae('0xc')}],'raw':!![]});})[_0x38ae('0x5')](function(_0x4ece5b){var _0x249921=_[_0x38ae('0xd')](_0x4ece5b,{'priority':'1'});var _0x329998=_[_0x38ae('0xd')](_0x4ece5b,{'isApp':0x1});var _0x1abefe=_[_0x38ae('0xe')](_0x329998,_0x38ae('0xb'));var _0x4538f3=[_0x38ae('0xf'),_0x38ae('0x10')];var _0x2fae0f=[];var _0x2d62bd=[];for(var _0x42f5f9 in _0x1abefe){if(_0x1abefe[_0x38ae('0x11')](_0x42f5f9)){_0x5ceaca[_0x38ae('0x12')]=0x2;_0x5ceaca['extensions']=[];_0x5ceaca['extension']=_['find'](_0x249921,{'exten':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0xb')]});_0x5ceaca[_0x38ae('0x13')][_0x38ae('0x14')]({'type':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x15')],'app':_0x38ae('0x16'),'appdata':util[_0x38ae('0x17')](_0x38ae('0x18'),_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x15')]),'context':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x19')],'exten':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0xb')],'priority':_0x5ceaca[_0x38ae('0x12')]++,'VoiceExtensionId':_0x1abefe[_0x42f5f9][0x0]['VoiceExtensionId']});if(_0x1abefe[_0x42f5f9][0x0]['type']===_0x38ae('0x1a')){_0x5ceaca[_0x38ae('0x13')][_0x38ae('0x14')]({'type':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x15')],'app':_0x38ae('0x16'),'appdata':_0x38ae('0x1b')+_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x1c')],'context':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x19')],'exten':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0xb')],'priority':_0x5ceaca[_0x38ae('0x12')]++,'VoiceExtensionId':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x1c')]});}else if(_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x15')]===_0x38ae('0x1d')){if(_0x5ceaca['extension']){_0x5ceaca[_0x38ae('0x13')]['push']({'type':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x15')],'app':_0x38ae('0x16'),'appdata':_0x38ae('0x1e')+(_0x5ceaca[_0x38ae('0x1f')][_0x38ae('0x20')]?'${EXTEN:'+_0x5ceaca[_0x38ae('0x1f')][_0x38ae('0x20')]+'}':'${EXTEN}'),'context':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x19')],'exten':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0xb')],'priority':_0x5ceaca[_0x38ae('0x12')]++,'VoiceExtensionId':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x1c')]});}_0x5ceaca[_0x38ae('0x13')]['push']({'type':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x15')],'app':_0x38ae('0x16'),'appdata':_0x38ae('0x1b')+_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x1c')],'context':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x19')],'exten':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0xb')],'priority':_0x5ceaca[_0x38ae('0x12')]++,'VoiceExtensionId':_0x1abefe[_0x42f5f9][0x0]['VoiceExtensionId']});var _0x37379c=_0x5ceaca[_0x38ae('0x12')]++;_0x5ceaca[_0x38ae('0x13')][_0x38ae('0x14')]({'type':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x15')],'app':_0x38ae('0x21'),'appdata':'$[${LEN(${CDR(prefix)})}\x20>\x200]?Goto('+(_0x37379c+0x2)+_0x38ae('0x22')+(_0x37379c+0x1)+')','context':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x19')],'exten':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0xb')],'priority':_0x37379c,'VoiceExtensionId':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x1c')]});if(_0x5ceaca[_0x38ae('0x1f')]){_0x5ceaca[_0x38ae('0x13')][_0x38ae('0x14')]({'type':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x15')],'app':_0x38ae('0x16'),'appdata':_0x5ceaca[_0x38ae('0x1f')][_0x38ae('0x20')]?_0x38ae('0x23')+_0x5ceaca[_0x38ae('0x1f')][_0x38ae('0x20')]+'}':_0x38ae('0x24'),'context':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x19')],'exten':_0x1abefe[_0x42f5f9][0x0]['exten'],'priority':_0x5ceaca[_0x38ae('0x12')]++,'VoiceExtensionId':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x1c')]});}_0x5ceaca[_0x38ae('0x13')][_0x38ae('0x14')]({'type':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x15')],'app':_0x38ae('0x16'),'appdata':_0x38ae('0x25')+_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x1c')],'context':_0x1abefe[_0x42f5f9][0x0]['context'],'exten':_0x1abefe[_0x42f5f9][0x0]['exten'],'priority':_0x5ceaca['priority']++,'VoiceExtensionId':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x1c')]});if(_0x5ceaca['extension']&&_0x5ceaca[_0x38ae('0x1f')]['hasOwnProperty'](_0x38ae('0x26'))&&_0x5ceaca[_0x38ae('0x1f')][_0x38ae('0x26')]!==_0x38ae('0x27')){_0x5ceaca[_0x38ae('0x13')][_0x38ae('0x14')]({'type':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x15')],'app':_0x38ae('0x16'),'appdata':_0x38ae('0x28'),'context':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x19')],'exten':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0xb')],'priority':_0x5ceaca[_0x38ae('0x12')]++,'VoiceExtensionId':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x1c')]});_0x5ceaca[_0x38ae('0x13')][_0x38ae('0x14')]({'type':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x15')],'app':'Set','appdata':'_XCALLY_MIXMONITOR_FORMAT='+_0x5ceaca[_0x38ae('0x1f')]['recordingFormat']||_0x38ae('0x29'),'context':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x19')],'exten':_0x1abefe[_0x42f5f9][0x0]['exten'],'priority':_0x5ceaca['priority']++,'VoiceExtensionId':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x1c')]});}}_0x5ceaca['extensions'][_0x38ae('0x14')]({'type':_0x1abefe[_0x42f5f9][0x0]['type'],'app':_0x38ae('0x16'),'appdata':_0x38ae('0x2a'),'context':_0x1abefe[_0x42f5f9][0x0]['context'],'exten':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0xb')],'priority':_0x5ceaca[_0x38ae('0x12')]++,'VoiceExtensionId':_0x1abefe[_0x42f5f9][0x0]['VoiceExtensionId']});_0x5ceaca[_0x38ae('0x13')]['push']({'type':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x15')],'app':_0x38ae('0x16'),'appdata':'XCALLY-MOTION-PROGRESS=0','context':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x19')],'exten':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0xb')],'priority':_0x5ceaca[_0x38ae('0x12')]++,'VoiceExtensionId':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x1c')]});_0x5ceaca[_0x38ae('0x13')][_0x38ae('0x14')]({'type':_0x1abefe[_0x42f5f9][0x0]['type'],'app':'Set','appdata':_0x38ae('0x2b'),'context':_0x1abefe[_0x42f5f9][0x0]['context'],'exten':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0xb')],'priority':_0x5ceaca['priority']++,'VoiceExtensionId':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x1c')]});for(var _0x5db4f6=0x0,_0x41b7ce=0x0;_0x5db4f6<_0x1abefe[_0x42f5f9][_0x38ae('0x2c')];_0x5db4f6+=0x1,_0x41b7ce=0x0){var _0xf149c3=_0x1abefe[_0x42f5f9][_0x5db4f6];if(_0xf149c3[_0x38ae('0x15')]){_0xf149c3[_0x38ae('0x15')]=_0xf149c3[_0x38ae('0x15')]['toLowerCase']();}var _0x1d1316=[];var _0x53e463=[];delete _0xf149c3['id'];delete _0xf149c3[_0x38ae('0x2d')];delete _0xf149c3[_0x38ae('0x2e')];var _0x19830c=_0xf149c3[_0x38ae('0x2f')]!==_0x38ae('0x30')?[_0xf149c3[_0x38ae('0x2f')]]:_0xf149c3[_0x38ae('0x8')]?_['map'](_[_0x38ae('0xd')](_0x5ceaca[_0x38ae('0x6')],{'IntervalId':_0xf149c3[_0x38ae('0x8')]}),_0x38ae('0x2f')):[];if(_0xf149c3[_0x38ae('0x11')](_0x38ae('0x31'))){if(_0xf149c3[_0x38ae('0x31')]&&_0xf149c3['tag']!=='--'){_0x1d1316[_0x38ae('0x14')]({'type':_0xf149c3['type'],'app':_0x38ae('0x16'),'appdata':_0x38ae('0x32')+_0xf149c3['tag'],'context':_0xf149c3['context'],'exten':_0xf149c3[_0x38ae('0xb')],'priority':_0x19830c[_0x38ae('0x2c')]+_0x5ceaca['priority']+_0x41b7ce++,'VoiceExtensionId':_0xf149c3[_0x38ae('0x1c')]});}}if(_0xf149c3[_0x38ae('0x15')]==='outbound'&&_0xf149c3[_0x38ae('0x11')]('callerID')){if(_0xf149c3[_0x38ae('0x33')]){_0x1d1316[_0x38ae('0x14')]({'type':_0xf149c3[_0x38ae('0x15')],'app':_0x38ae('0x21'),'appdata':_0x38ae('0x34')+_0xf149c3[_0x38ae('0x33')]+')','context':_0xf149c3[_0x38ae('0x19')],'exten':_0xf149c3[_0x38ae('0xb')],'priority':_0x19830c[_0x38ae('0x2c')]+_0x5ceaca[_0x38ae('0x12')]+_0x41b7ce++,'VoiceExtensionId':_0xf149c3['VoiceExtensionId']});}else{_0x1d1316['push']({'type':_0xf149c3['type'],'app':_0x38ae('0x21'),'appdata':_0x38ae('0x35'),'context':_0xf149c3[_0x38ae('0x19')],'exten':_0xf149c3['exten'],'priority':_0x19830c[_0x38ae('0x2c')]+_0x5ceaca[_0x38ae('0x12')]+_0x41b7ce++,'VoiceExtensionId':_0xf149c3[_0x38ae('0x1c')]});}}if(_0xf149c3[_0x38ae('0x11')](_0x38ae('0x36'))){if(_0x4538f3[_0x38ae('0x37')](_0xf149c3[_0x38ae('0x38')][_0x38ae('0x39')]())>=0x0&&_0xf149c3['appType']!==_0x38ae('0x3a')){if(_0xf149c3[_0x38ae('0x36')]){_0x1d1316[_0x38ae('0x14')]({'type':_0xf149c3[_0x38ae('0x15')],'app':_0x38ae('0x21'),'appdata':'$[${XCALLY-MOTION-ANSWER}=0]?Answer','context':_0xf149c3[_0x38ae('0x19')],'exten':_0xf149c3[_0x38ae('0xb')],'priority':_0x19830c[_0x38ae('0x2c')]+_0x5ceaca[_0x38ae('0x12')]+_0x41b7ce++,'VoiceExtensionId':_0xf149c3['VoiceExtensionId']});_0x1d1316['push']({'type':_0xf149c3['type'],'app':_0x38ae('0x16'),'appdata':'XCALLY-MOTION-ANSWER=1','context':_0xf149c3['context'],'exten':_0xf149c3['exten'],'priority':_0x19830c['length']+_0x5ceaca[_0x38ae('0x12')]+_0x41b7ce++,'VoiceExtensionId':_0xf149c3[_0x38ae('0x1c')]});}else{_0x1d1316[_0x38ae('0x14')]({'type':_0xf149c3[_0x38ae('0x15')],'app':_0x38ae('0x21'),'appdata':_0x38ae('0x3b'),'context':_0xf149c3[_0x38ae('0x19')],'exten':_0xf149c3[_0x38ae('0xb')],'priority':_0x19830c[_0x38ae('0x2c')]+_0x5ceaca[_0x38ae('0x12')]+_0x41b7ce++,'VoiceExtensionId':_0xf149c3['VoiceExtensionId']});_0x1d1316[_0x38ae('0x14')]({'type':_0xf149c3[_0x38ae('0x15')],'app':_0x38ae('0x16'),'appdata':_0x38ae('0x3c'),'context':_0xf149c3[_0x38ae('0x19')],'exten':_0xf149c3[_0x38ae('0xb')],'priority':_0x19830c[_0x38ae('0x2c')]+_0x5ceaca[_0x38ae('0x12')]+_0x41b7ce++,'VoiceExtensionId':_0xf149c3[_0x38ae('0x1c')]});}}}for(var _0x4ea3fe=0x0;_0x4ea3fe<_0x19830c[_0x38ae('0x2c')];_0x4ea3fe+=0x1){var _0x2d280d=_0x5ceaca[_0x38ae('0x12')]+_0x19830c[_0x38ae('0x2c')];var _0x2cd2c1=_0x4ea3fe===_0x19830c[_0x38ae('0x2c')]-0x1?_0x5ceaca['priority']+_0x1d1316[_0x38ae('0x2c')]+_0x53e463[_0x38ae('0x2c')]+0x2:_0x5ceaca[_0x38ae('0x12')]+_0x4ea3fe+0x1;_0x1d1316[_0x38ae('0x3d')](_0x4ea3fe,0x0,{'type':_0xf149c3[_0x38ae('0x15')],'app':_0x38ae('0x3e'),'appdata':_0x19830c[_0x4ea3fe]+'?'+_0xf149c3[_0x38ae('0x19')]+',${EXTEN},'+_0x2d280d+':'+_0xf149c3[_0x38ae('0x19')]+_0x38ae('0x3f')+_0x2cd2c1,'exten':_0xf149c3[_0x38ae('0xb')],'context':_0xf149c3['context'],'priority':_0x5ceaca['priority']+_0x4ea3fe,'VoiceExtensionId':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x1c')]});}_0xf149c3[_0x38ae('0x12')]=_0x1d1316[_0x38ae('0x2c')]?_['last'](_0x1d1316)['priority']+0x1:_0x5ceaca[_0x38ae('0x12')];_0x5ceaca[_0x38ae('0x12')]=(_0x53e463[_0x38ae('0x2c')]?_[_0x38ae('0x40')](_0x53e463)['priority']:_0xf149c3['priority'])+0x1;_0x5ceaca[_0x38ae('0x13')]=_[_0x38ae('0x41')](_0x5ceaca[_0x38ae('0x13')],_0x1d1316,[_0xf149c3],_0x53e463);}_0x5ceaca['extensions']['push']({'type':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x15')],'app':_0x38ae('0x42'),'exten':_0x1abefe[_0x42f5f9][0x0][_0x38ae('0xb')],'context':_0x1abefe[_0x42f5f9][0x0]['context'],'priority':_0x5ceaca['priority'],'VoiceExtensionId':_0x1abefe[_0x42f5f9][0x0]['VoiceExtensionId']});_0x2fae0f[_0x38ae('0x14')](_0x1abefe[_0x42f5f9][0x0][_0x38ae('0x1c')]);_0x2d62bd=_[_0x38ae('0x41')](_0x2d62bd,_0x5ceaca[_0x38ae('0x13')]);}}return _0x355044['transaction'](function(_0x3f9db5){return _0x355044[_0x38ae('0x2')][_0x38ae('0x7')][_0x38ae('0x43')]({'where':{'VoiceExtensionId':{'$in':_0x2fae0f}},'transaction':_0x3f9db5})[_0x38ae('0x5')](function(_0x23d541){return _0x355044[_0x38ae('0x2')]['VoiceExtension'][_0x38ae('0x44')](_[_0x38ae('0x45')](_0x2d62bd,_0x38ae('0x12')),{'transaction':_0x3f9db5});});});})[_0x38ae('0x46')](function(_0x415e58){console[_0x38ae('0x47')](_0x415e58);});}exports[_0x38ae('0x48')]=rewrite; \ No newline at end of file diff --git a/server/components/import/cm/csv.js b/server/components/import/cm/csv.js index ef81cf4..235209a 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 _0xd357=['ContactId','updatedAt','select','field','NOW()','toString','from','cm_contacts','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','createdAt','ListId\x20=\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','\x20=\x20?','id\x20IN\x20?','cm_hopper_black','VoiceQueue','outbound','dialCheckDuplicateType','sequelize','query','VoiceQueueId','all','get','Campaign','findAll','CmList','Lists','CampaignId','onlyIfOpen','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','finally','emit','contact:csv_','resume','unlinkSync','exit','info','resolve','CmContact','createReadStream','duplicate','pause','CSV\x20parsed\x20correctly!','CSV\x20parse\x20error','bluebird','lodash','squel','ioredis','../../../mysqldb','../../../config/logger','api','redis','localhost','../../../api/cmContact/cmContact.socket','register','argv','undefined','null','zipObject','split','Missing\x20ListId\x20parameter!','Missing\x20socket_timestamp\x20parameter!','error','contact','index','test','isNil','The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!','message','join','hasOwnProperty','data','firstName','firstName\x20not\x20specified!','phone','YYYY-MM-DD','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','length','find','Duplicate\x20Contact','keys','then','push','pick','catch','Error\x20while\x20creating\x20contact:\x20','stringify','checkHopper','insert','into','cm_hopper','fromQuery','scheduledAt'];(function(_0x263f4c,_0x438626){var _0x3a78d3=function(_0xbdb00f){while(--_0xbdb00f){_0x263f4c['push'](_0x263f4c['shift']());}};_0x3a78d3(++_0x438626);}(_0xd357,0x9c));var _0x7d35=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0xd357[_0x57b54c];return _0x59cc19;};'use strict';var BPromise=require(_0x7d35('0x0'));var util=require('util');var _=require(_0x7d35('0x1'));var fs=require('fs');var squel=require(_0x7d35('0x2'));var Papa=require('papaparse');var Redis=require(_0x7d35('0x3'));var db=require(_0x7d35('0x4'))['db'];var config=require('../../../config/environment');var logger=require(_0x7d35('0x5'))(_0x7d35('0x6'));config['redis']=_['defaults'](config[_0x7d35('0x7')],{'host':_0x7d35('0x8'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0x7d35('0x7')]));require(_0x7d35('0x9'))[_0x7d35('0xa')](socket);try{if(!process['argv'][0x2]||process[_0x7d35('0xb')][0x2]===_0x7d35('0xc')||process[_0x7d35('0xb')][0x2]===_0x7d35('0xd')){throw new Error('Missing\x20filepath\x20parameter!');}var FILEPATH=process[_0x7d35('0xb')][0x2];if(!process[_0x7d35('0xb')][0x3]||process[_0x7d35('0xb')][0x3]===_0x7d35('0xc')||process[_0x7d35('0xb')][0x3]===_0x7d35('0xd')||!process[_0x7d35('0xb')][0x4]||process[_0x7d35('0xb')][0x4]===_0x7d35('0xc')||process[_0x7d35('0xb')][0x4]===_0x7d35('0xd')){throw new Error('Missing\x20binding\x20parameters!');}var FIELDS=_[_0x7d35('0xe')](process['argv'][0x3]['split'](','),process['argv'][0x4][_0x7d35('0xf')](','));if(!process[_0x7d35('0xb')][0x5]||process['argv'][0x5]===_0x7d35('0xc')||process['argv'][0x5]==='null'){throw new Error(_0x7d35('0x10'));}var LISTID=process['argv'][0x5];var COMPANYID=process[_0x7d35('0xb')][0x6]&&process[_0x7d35('0xb')][0x6]!=='undefined'&&process[_0x7d35('0xb')][0x6]!==_0x7d35('0xd')?process[_0x7d35('0xb')][0x6]:null;var DUPLICATES=process[_0x7d35('0xb')][0x7]&&process[_0x7d35('0xb')][0x7]!=='undefined'&&process['argv'][0x7]!=='null'?process[_0x7d35('0xb')][0x7]:null;if(!process[_0x7d35('0xb')][0x8]||process['argv'][0x8]===_0x7d35('0xc')||process['argv'][0x8]===_0x7d35('0xd')){throw new Error(_0x7d35('0x11'));}var SOCKET_TIMESTAMP=process[_0x7d35('0xb')][0x8];}catch(_0x449653){logger[_0x7d35('0x12')](_0x449653);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(_0x4b75da,_0x285aa6,_0x4f0bc1,_0x58da0b){var _0x12c8f2={'message':_0x285aa6};_0x12c8f2[_0x4b75da]=!![];if(_0x4f0bc1){_0x12c8f2[_0x7d35('0x13')]=_0x4f0bc1;}if(_0x58da0b){_0x12c8f2[_0x7d35('0x14')]=_0x58da0b;}return _0x12c8f2;}function isEmail(_0x8d7e61){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))*$/[_0x7d35('0x15')](_0x8d7e61);}function checkRow(_0x3bdde8,_0x1e074b,_0x1a6e6c){return new BPromise(function(_0x49c529,_0x1134a9){if(_[_0x7d35('0x16')](_0x3bdde8)){return _0x1134a9(handleCheckRowError(_0x7d35('0x12'),_0x7d35('0x17'),null,_0x1a6e6c));}if(_0x3bdde8['errors']&&_0x3bdde8['errors']['length']){var _0x3a1fc6=_['map'](_0x3bdde8['errors'],_0x7d35('0x18'))[_0x7d35('0x19')](';');return _0x1134a9(handleCheckRowError(_0x7d35('0x12'),_0x3a1fc6,null,_0x1a6e6c));}var _0x5c2f0a={};for(var _0x144d2c in FIELDS){if(FIELDS[_0x7d35('0x1a')](_0x144d2c)&&FIELDS[_0x144d2c]){_0x5c2f0a[_0x144d2c]=_0x3bdde8[_0x7d35('0x1b')][0x0][FIELDS[_0x144d2c]]||_0x3bdde8[_0x7d35('0x1b')][0x0]['\ufeff'+FIELDS[_0x144d2c]];}}if(!_0x5c2f0a[_0x7d35('0x1c')]){return _0x1134a9(handleCheckRowError(_0x7d35('0x12'),_0x7d35('0x1d'),null,_0x1a6e6c));}if(!_0x5c2f0a[_0x7d35('0x1e')]){return _0x1134a9(handleCheckRowError('error','phone\x20not\x20specified!',null,_0x1a6e6c));}if(_0x5c2f0a['birthDate']){var _0x3c45e3=moment(_0x5c2f0a['birthDate'],_0x7d35('0x1f'));if(!_0x3c45e3[_0x7d35('0x20')]()){return _0x1134a9(handleCheckRowError(_0x7d35('0x12'),_0x7d35('0x21'),null,_0x1a6e6c));}}if(_0x5c2f0a[_0x7d35('0x22')]){if(!isEmail(_0x5c2f0a[_0x7d35('0x22')])){return _0x1134a9(handleCheckRowError(_0x7d35('0x12'),_0x7d35('0x23'),null,_0x1a6e6c));}}_0x5c2f0a[_0x7d35('0x24')]=LISTID;_0x5c2f0a[_0x7d35('0x25')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x1e074b){var _0x5eaf81={};for(var _0x52f469=0x0,_0x2e13b4=DUPLICATES[_0x7d35('0x26')];_0x52f469<_0x2e13b4;_0x52f469+=0x1){_0x5eaf81[DUPLICATES[_0x52f469]]=_0x5c2f0a[DUPLICATES[_0x52f469]];}var _0x11f238=_[_0x7d35('0x27')](_0x1e074b,_0x5eaf81);if(_0x11f238){return _0x1134a9(handleCheckRowError('duplicate',_0x7d35('0x28'),_0x11f238,_0x1a6e6c));}}return db['CmContact']['create'](_0x5c2f0a,{'raw':!![],'hooks':![],'fields':_[_0x7d35('0x29')](_0x5c2f0a)})[_0x7d35('0x2a')](function(_0x1494bd){if(DUPLICATES&&DUPLICATES[_0x7d35('0x26')]&&_0x1e074b){_0x1e074b[_0x7d35('0x2b')](_[_0x7d35('0x2c')](_0x5c2f0a,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1494bd['id'];return _0x49c529();})[_0x7d35('0x2d')](function(_0x233e0e){return _0x1134a9(handleCheckRowError(_0x7d35('0x12'),_0x7d35('0x2e')+(_0x233e0e[_0x7d35('0x18')]||JSON[_0x7d35('0x2f')](_0x233e0e)),null,_0x1a6e6c));});});}function checkHopper(){function _0x30dfcc(){return function(_0x5f39c9){logger['error']('cmContact',_0x7d35('0x30'),util['inspect'](_0x5f39c9,{'showHidden':![],'depth':null}));};}var _0x45d493=function(_0x298d2e,_0xc134ff){var _0x5ef814=squel[_0x7d35('0x31')]()[_0x7d35('0x32')](_0x7d35('0x33'))[_0x7d35('0x34')]([_0x7d35('0x1e'),_0x7d35('0x35'),_0x7d35('0x36'),_0x7d35('0x24'),_0xc134ff,'createdAt',_0x7d35('0x37')],squel[_0x7d35('0x38')]()[_0x7d35('0x39')](_0x7d35('0x1e'),_0x7d35('0x1e'))['field'](_0x7d35('0x3a'),_0x7d35('0x35'))[_0x7d35('0x39')]('id',_0x7d35('0x36'))[_0x7d35('0x39')](LISTID[_0x7d35('0x3b')](),_0x7d35('0x24'))['field'](_0x298d2e['id'][_0x7d35('0x3b')](),_0xc134ff)[_0x7d35('0x39')](_0x7d35('0x3a'),'createdAt')['field']('NOW()',_0x7d35('0x37'))[_0x7d35('0x3c')](_0x7d35('0x3d'))[_0x7d35('0x3e')](_0x7d35('0x3f'))['where']('ListId\x20=\x20?',LISTID[_0x7d35('0x3b')]())[_0x7d35('0x3e')]('phone\x20IS\x20NOT\x20NULL')['where'](_0x7d35('0x40'),squel[_0x7d35('0x38')]()[_0x7d35('0x39')](_0x7d35('0x1e'))['from'](_0x7d35('0x33'))[_0x7d35('0x3e')](_0xc134ff+'\x20=\x20?',_0x298d2e['id']['toString']())))[_0x7d35('0x3b')]();return _0x5ef814;};var _0x36fb67=function(_0x6ae50a,_0x25a00f){var _0x10cd61=squel[_0x7d35('0x31')]()[_0x7d35('0x32')](_0x7d35('0x33'))['fromQuery']([_0x7d35('0x1e'),_0x7d35('0x35'),_0x7d35('0x36'),'ListId',_0x25a00f,_0x7d35('0x41'),'updatedAt'],squel[_0x7d35('0x38')]()[_0x7d35('0x39')](_0x7d35('0x1e'),_0x7d35('0x1e'))[_0x7d35('0x39')]('NOW()',_0x7d35('0x35'))[_0x7d35('0x39')]('id',_0x7d35('0x36'))[_0x7d35('0x39')](LISTID['toString'](),'ListId')[_0x7d35('0x39')](_0x6ae50a['id'][_0x7d35('0x3b')](),_0x25a00f)[_0x7d35('0x39')](_0x7d35('0x3a'),_0x7d35('0x41'))[_0x7d35('0x39')](_0x7d35('0x3a'),_0x7d35('0x37'))[_0x7d35('0x3c')]('cm_contacts')[_0x7d35('0x3e')](_0x7d35('0x3f'))[_0x7d35('0x3e')](_0x7d35('0x42'),LISTID[_0x7d35('0x3b')]())[_0x7d35('0x3e')]('id\x20IN\x20?',squel[_0x7d35('0x43')](hopperContacts))[_0x7d35('0x3e')](_0x7d35('0x44'))[_0x7d35('0x3e')]('phone\x20NOT\x20IN\x20(?)',squel[_0x7d35('0x38')]()[_0x7d35('0x39')](_0x7d35('0x45'))['from'](_0x7d35('0x46'))[_0x7d35('0x3e')](_0x25a00f+_0x7d35('0x47'),_0x6ae50a['id'][_0x7d35('0x3b')]()))[_0x7d35('0x3e')](_0x7d35('0x40'),squel[_0x7d35('0x38')]()[_0x7d35('0x39')](_0x7d35('0x1e'))[_0x7d35('0x3c')]('cm_hopper')['where'](_0x25a00f+_0x7d35('0x47'),_0x6ae50a['id'][_0x7d35('0x3b')]())))[_0x7d35('0x3b')]();return _0x10cd61;};function _0x1d1dd1(_0x5f113f,_0x4adb40){var _0x1e0092=squel[_0x7d35('0x31')]()['into'](_0x7d35('0x33'))[_0x7d35('0x34')]([_0x7d35('0x1e'),_0x7d35('0x35'),_0x7d35('0x36'),_0x7d35('0x24'),_0x4adb40,_0x7d35('0x41'),_0x7d35('0x37')],squel[_0x7d35('0x38')]()[_0x7d35('0x39')](_0x7d35('0x1e'),_0x7d35('0x1e'))[_0x7d35('0x39')](_0x7d35('0x3a'),_0x7d35('0x35'))[_0x7d35('0x39')]('id','ContactId')[_0x7d35('0x39')](LISTID[_0x7d35('0x3b')](),_0x7d35('0x24'))['field'](_0x5f113f['id'][_0x7d35('0x3b')](),_0x4adb40)[_0x7d35('0x39')]('NOW()','createdAt')[_0x7d35('0x39')](_0x7d35('0x3a'),_0x7d35('0x37'))['from'](_0x7d35('0x3d'))[_0x7d35('0x3e')]('deletedAt\x20IS\x20NULL')[_0x7d35('0x3e')](_0x7d35('0x42'),LISTID[_0x7d35('0x3b')]())[_0x7d35('0x3e')](_0x7d35('0x48'),squel[_0x7d35('0x43')](hopperContacts))['where'](_0x7d35('0x44')))[_0x7d35('0x3b')]();return _0x1e0092;}function _0x53f86d(_0x16def6,_0x31b885){var _0x1c5df0=squel['insert']()[_0x7d35('0x32')](_0x7d35('0x49'))['fromQuery'](['phone',_0x7d35('0x36'),_0x7d35('0x24'),_0x31b885,_0x7d35('0x41'),_0x7d35('0x37')],squel[_0x7d35('0x38')]()[_0x7d35('0x39')](_0x7d35('0x1e'),'phone')['field']('id','ContactId')[_0x7d35('0x39')](LISTID[_0x7d35('0x3b')](),_0x7d35('0x24'))[_0x7d35('0x39')](_0x16def6['id'][_0x7d35('0x3b')](),_0x31b885)['field'](_0x7d35('0x3a'),_0x7d35('0x41'))[_0x7d35('0x39')](_0x7d35('0x3a'),_0x7d35('0x37'))[_0x7d35('0x3c')](_0x7d35('0x3d'))[_0x7d35('0x3e')]('deletedAt\x20IS\x20NULL')[_0x7d35('0x3e')]('ListId\x20=\x20?',LISTID[_0x7d35('0x3b')]())[_0x7d35('0x3e')](_0x7d35('0x48'),squel['str'](hopperContacts))['where'](_0x7d35('0x44')))[_0x7d35('0x3b')]();return _0x1c5df0;}return db[_0x7d35('0x4a')]['findAll']({'where':{'type':_0x7d35('0x4b')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db['CmList'],'as':'Lists','where':{'id':LISTID}}]})[_0x7d35('0x2a')](function(_0x34876d){var _0x41ddef=[];if(_0x34876d){var _0x29fa26;for(var _0x2ce346=0x0,_0x220b78;_0x2ce346<_0x34876d[_0x7d35('0x26')];_0x2ce346+=0x1){_0x220b78=_0x34876d[_0x2ce346]['get']({'plain':!![]});switch(_0x220b78[_0x7d35('0x4c')]){case'always':_0x41ddef[_0x7d35('0x2b')](db[_0x7d35('0x4d')][_0x7d35('0x4e')](_0x36fb67(_0x220b78,'VoiceQueueId'))[_0x7d35('0x2a')](function(){})[_0x7d35('0x2d')](_0x30dfcc()));break;case'onlyIfOpen':_0x41ddef['push'](db[_0x7d35('0x4d')]['query'](_0x45d493(_0x220b78,_0x7d35('0x4f')))[_0x7d35('0x2a')](function(){})['catch'](_0x30dfcc()));break;default:_0x41ddef['push'](db[_0x7d35('0x4d')]['query'](_0x1d1dd1(_0x220b78,_0x7d35('0x4f')))[_0x7d35('0x2a')](function(){})[_0x7d35('0x2d')](_0x30dfcc()));}}}return _0x41ddef;})[_0x7d35('0x50')]()[_0x7d35('0x2a')](function(){return db[_0x7d35('0x4a')]['findAll']({'where':{'type':_0x7d35('0x4b')},'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})['then'](function(_0x33df22){var _0xe6556d=[];if(_0x33df22){var _0x465878;for(var _0x20d380=0x0,_0x1cf127;_0x20d380<_0x33df22[_0x7d35('0x26')];_0x20d380+=0x1){_0x1cf127=_0x33df22[_0x20d380][_0x7d35('0x51')]({'plain':!![]});_0xe6556d[_0x7d35('0x2b')](db[_0x7d35('0x4d')][_0x7d35('0x4e')](_0x53f86d(_0x1cf127,_0x7d35('0x4f')))['then'](function(){})[_0x7d35('0x2d')](_0x30dfcc()));}}return _0xe6556d;})[_0x7d35('0x50')]();})[_0x7d35('0x2a')](function(){return db[_0x7d35('0x52')][_0x7d35('0x53')]({'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0x7d35('0x54')],'as':_0x7d35('0x55'),'where':{'id':LISTID}}]})[_0x7d35('0x2a')](function(_0x48a9cf){var _0x1a6d82=[];if(_0x48a9cf){for(var _0x3396a8=0x0,_0x1434fc;_0x3396a8<_0x48a9cf[_0x7d35('0x26')];_0x3396a8+=0x1){_0x1434fc=_0x48a9cf[_0x3396a8]['get']({'plain':!![]});switch(_0x1434fc[_0x7d35('0x4c')]){case'always':_0x1a6d82[_0x7d35('0x2b')](db[_0x7d35('0x4d')][_0x7d35('0x4e')](_0x36fb67(_0x1434fc,_0x7d35('0x56')))[_0x7d35('0x2a')](function(){})['catch'](_0x30dfcc()));break;case _0x7d35('0x57'):_0x1a6d82[_0x7d35('0x2b')](db[_0x7d35('0x4d')]['query'](_0x45d493(_0x1434fc,_0x7d35('0x56')))['then'](function(){})[_0x7d35('0x2d')](_0x30dfcc()));break;default:_0x1a6d82['push'](db[_0x7d35('0x4d')][_0x7d35('0x4e')](_0x1d1dd1(_0x1434fc,_0x7d35('0x56')))[_0x7d35('0x2a')](function(){})[_0x7d35('0x2d')](_0x30dfcc()));}}}return _0x1a6d82;})[_0x7d35('0x50')]();})[_0x7d35('0x2a')](function(){return db[_0x7d35('0x52')]['findAll']({'attributes':['id'],'include':[{'model':db['CmList'],'as':'BlackLists','where':{'id':LISTID}}]})[_0x7d35('0x2a')](function(_0x5c398e){var _0x53b9e8=[];if(_0x5c398e){for(var _0x34c484=0x0,_0x3d83e8;_0x34c484<_0x5c398e[_0x7d35('0x26')];_0x34c484+=0x1){_0x3d83e8=_0x5c398e[_0x34c484]['get']({'plain':!![]});_0x53b9e8[_0x7d35('0x2b')](db[_0x7d35('0x4d')][_0x7d35('0x4e')](_0x53f86d(_0x3d83e8,'CampaignId'))[_0x7d35('0x2a')](function(){})[_0x7d35('0x2d')](_0x30dfcc()));}}return _0x53b9e8;})[_0x7d35('0x50')]();})[_0x7d35('0x2d')](function(_0x5b2544){logger[_0x7d35('0x12')](_0x7d35('0x58'),_0x7d35('0x59'),_0x5b2544[_0x7d35('0x18')]);});}var processPromises=function(_0x4956e9){return BPromise[_0x7d35('0x50')](promises)[_0x7d35('0x2a')](function(_0x301e54){})[_0x7d35('0x2d')](function(_0x4873f6){logger['error'](_0x7d35('0x5a'),JSON[_0x7d35('0x2f')](_0x4873f6));})[_0x7d35('0x5b')](function(){socket[_0x7d35('0x5c')](_0x7d35('0x5d')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x4956e9){return _0x4956e9[_0x7d35('0x5e')]();}});};var endCsv=function(){return BPromise['resolve']()[_0x7d35('0x2a')](function(){if(hopperContacts){return checkHopper();}})[_0x7d35('0x2a')](function(){socket['emit'](_0x7d35('0x5d')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs[_0x7d35('0x5f')](FILEPATH);}catch(_0x19fda9){logger[_0x7d35('0x12')]('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x19fda9));}finally{process[_0x7d35('0x60')](0x0);}});};process['on']('SIGINT',function(){logger[_0x7d35('0x61')]('CSV\x20import\x20process\x20stopped!');endCsv();});function main(){return BPromise[_0x7d35('0x62')]()[_0x7d35('0x2a')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0x7d35('0x63')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0x7d35('0x2a')](function(_0x4ed843){var _0x4155a4=fs[_0x7d35('0x64')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa['parse'](_0x4155a4,{'header':!![],'skipEmptyLines':!![],'step':function(_0x2a6258,_0x4a7614){total+=0x1;var _0x3941fe=total;promises[_0x7d35('0x2b')](checkRow(_0x2a6258,_0x4ed843,_0x3941fe)['then'](function(){success+=0x1;})[_0x7d35('0x2d')](function(_0x409a8e){if(_0x409a8e[_0x7d35('0x12')]){errors+=0x1;delete _0x409a8e[_0x7d35('0x12')];}else if(_0x409a8e[_0x7d35('0x65')]){duplicates+=0x1;delete _0x409a8e['duplicate'];}rows[_0x7d35('0x2b')](_0x409a8e);}));if(total%0xc8===0x0){_0x4a7614[_0x7d35('0x66')]();return processPromises(_0x4a7614);}},'complete':function(){return processPromises()['then'](function(){logger[_0x7d35('0x61')](_0x7d35('0x67'));endCsv();});},'error':function(_0x12d3e2,_0x43837d){logger[_0x7d35('0x61')](_0x7d35('0x68'),JSON['stringify'](_0x12d3e2));endCsv();}});})[_0x7d35('0x2d')](function(_0x35c2b1){logger[_0x7d35('0x12')]('Error\x20executing\x20contact\x20csv\x20import:',JSON[_0x7d35('0x2f')](_0x35c2b1));});}main(); \ No newline at end of file +var _0xcb3f=['Missing\x20filepath\x20parameter!','Missing\x20binding\x20parameters!','zipObject','split','Missing\x20ListId\x20parameter!','contact','index','test','isNil','error','length','errors','message','data','firstName\x20not\x20specified!','phone','birthDate','isValid','birthDate\x20format\x20is\x20invalid,\x20YYYY-MM-DD\x20format\x20is\x20supported!','email','email\x20format\x20is\x20not\x20valid!','ListId','CompanyId','find','duplicate','keys','then','push','pick','Error\x20while\x20creating\x20contact:\x20','cmContact','checkHopper','insert','into','cm_hopper','scheduledAt','ContactId','createdAt','updatedAt','select','field','NOW()','toString','from','where','deletedAt\x20IS\x20NULL','phone\x20NOT\x20IN\x20(?)','\x20=\x20?','fromQuery','cm_contacts','ListId\x20=\x20?','id\x20IN\x20?','str','phone\x20IS\x20NOT\x20NULL','calleridnum','cm_hopper_final','findAll','outbound','CmList','Lists','get','dialCheckDuplicateType','sequelize','query','VoiceQueueId','catch','onlyIfOpen','all','VoiceQueue','BlackLists','Campaign','always','CampaignId','cmContact,\x20%s,\x20%s','generalCheckHopper','Error\x20processing\x20rows\x20block:','stringify','emit','contact:csv_','resume','resolve','exit','SIGINT','info','CSV\x20import\x20process\x20stopped!','CmContact','createReadStream','parse','CSV\x20parse\x20error','Error\x20executing\x20contact\x20csv\x20import:','bluebird','util','lodash','squel','papaparse','ioredis','../../../config/environment','api','redis','socket.io-emitter','../../../api/cmContact/cmContact.socket','undefined','argv','null'];(function(_0xaa1b3e,_0x47d976){var _0x454d7d=function(_0x575b32){while(--_0x575b32){_0xaa1b3e['push'](_0xaa1b3e['shift']());}};_0x454d7d(++_0x47d976);}(_0xcb3f,0xc2));var _0xfcb3=function(_0x160c73,_0x2ee678){_0x160c73=_0x160c73-0x0;var _0xd9302=_0xcb3f[_0x160c73];return _0xd9302;};'use strict';var BPromise=require(_0xfcb3('0x0'));var util=require(_0xfcb3('0x1'));var _=require(_0xfcb3('0x2'));var fs=require('fs');var squel=require(_0xfcb3('0x3'));var Papa=require(_0xfcb3('0x4'));var Redis=require(_0xfcb3('0x5'));var db=require('../../../mysqldb')['db'];var config=require(_0xfcb3('0x6'));var logger=require('../../../config/logger')(_0xfcb3('0x7'));config[_0xfcb3('0x8')]=_['defaults'](config[_0xfcb3('0x8')],{'host':'localhost','port':0x18eb});var socket=require(_0xfcb3('0x9'))(new Redis(config[_0xfcb3('0x8')]));require(_0xfcb3('0xa'))['register'](socket);try{if(!process['argv'][0x2]||process['argv'][0x2]===_0xfcb3('0xb')||process[_0xfcb3('0xc')][0x2]===_0xfcb3('0xd')){throw new Error(_0xfcb3('0xe'));}var FILEPATH=process[_0xfcb3('0xc')][0x2];if(!process[_0xfcb3('0xc')][0x3]||process[_0xfcb3('0xc')][0x3]===_0xfcb3('0xb')||process[_0xfcb3('0xc')][0x3]===_0xfcb3('0xd')||!process[_0xfcb3('0xc')][0x4]||process[_0xfcb3('0xc')][0x4]==='undefined'||process['argv'][0x4]==='null'){throw new Error(_0xfcb3('0xf'));}var FIELDS=_[_0xfcb3('0x10')](process[_0xfcb3('0xc')][0x3][_0xfcb3('0x11')](','),process[_0xfcb3('0xc')][0x4][_0xfcb3('0x11')](','));if(!process['argv'][0x5]||process[_0xfcb3('0xc')][0x5]===_0xfcb3('0xb')||process[_0xfcb3('0xc')][0x5]===_0xfcb3('0xd')){throw new Error(_0xfcb3('0x12'));}var LISTID=process[_0xfcb3('0xc')][0x5];var COMPANYID=process[_0xfcb3('0xc')][0x6]&&process[_0xfcb3('0xc')][0x6]!==_0xfcb3('0xb')&&process[_0xfcb3('0xc')][0x6]!==_0xfcb3('0xd')?process[_0xfcb3('0xc')][0x6]:null;var DUPLICATES=process['argv'][0x7]&&process[_0xfcb3('0xc')][0x7]!==_0xfcb3('0xb')&&process[_0xfcb3('0xc')][0x7]!==_0xfcb3('0xd')?process[_0xfcb3('0xc')][0x7]:null;if(!process[_0xfcb3('0xc')][0x8]||process[_0xfcb3('0xc')][0x8]===_0xfcb3('0xb')||process[_0xfcb3('0xc')][0x8]===_0xfcb3('0xd')){throw new Error('Missing\x20socket_timestamp\x20parameter!');}var SOCKET_TIMESTAMP=process['argv'][0x8];}catch(_0x134f4a){logger['error'](_0x134f4a);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(_0x225f52,_0x8a9141,_0x1e059,_0x41d4a1){var _0x22689c={'message':_0x8a9141};_0x22689c[_0x225f52]=!![];if(_0x1e059){_0x22689c[_0xfcb3('0x13')]=_0x1e059;}if(_0x41d4a1){_0x22689c[_0xfcb3('0x14')]=_0x41d4a1;}return _0x22689c;}function isEmail(_0x201048){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))*$/[_0xfcb3('0x15')](_0x201048);}function checkRow(_0x1ad1ca,_0x38bd63,_0xc9aca9){return new BPromise(function(_0xcc0139,_0x425a09){if(_[_0xfcb3('0x16')](_0x1ad1ca)){return _0x425a09(handleCheckRowError(_0xfcb3('0x17'),'The\x20row\x20is\x20empty\x20or\x20the\x20number\x20of\x20parameters\x20does\x20not\x20match\x20the\x20columns!',null,_0xc9aca9));}if(_0x1ad1ca['errors']&&_0x1ad1ca['errors'][_0xfcb3('0x18')]){var _0x301157=_['map'](_0x1ad1ca[_0xfcb3('0x19')],_0xfcb3('0x1a'))['join'](';');return _0x425a09(handleCheckRowError(_0xfcb3('0x17'),_0x301157,null,_0xc9aca9));}var _0x360a1c={};for(var _0x485866 in FIELDS){if(FIELDS['hasOwnProperty'](_0x485866)&&FIELDS[_0x485866]){_0x360a1c[_0x485866]=_0x1ad1ca[_0xfcb3('0x1b')][0x0][FIELDS[_0x485866]]||_0x1ad1ca[_0xfcb3('0x1b')][0x0]['\ufeff'+FIELDS[_0x485866]];}}if(!_0x360a1c['firstName']){return _0x425a09(handleCheckRowError('error',_0xfcb3('0x1c'),null,_0xc9aca9));}if(!_0x360a1c[_0xfcb3('0x1d')]){return _0x425a09(handleCheckRowError(_0xfcb3('0x17'),'phone\x20not\x20specified!',null,_0xc9aca9));}if(_0x360a1c[_0xfcb3('0x1e')]){var _0x205fd=moment(_0x360a1c['birthDate'],'YYYY-MM-DD');if(!_0x205fd[_0xfcb3('0x1f')]()){return _0x425a09(handleCheckRowError(_0xfcb3('0x17'),_0xfcb3('0x20'),null,_0xc9aca9));}}if(_0x360a1c[_0xfcb3('0x21')]){if(!isEmail(_0x360a1c[_0xfcb3('0x21')])){return _0x425a09(handleCheckRowError(_0xfcb3('0x17'),_0xfcb3('0x22'),null,_0xc9aca9));}}_0x360a1c[_0xfcb3('0x23')]=LISTID;_0x360a1c[_0xfcb3('0x24')]=COMPANYID||undefined;if(DUPLICATES&&DUPLICATES['length']&&_0x38bd63){var _0x25d417={};for(var _0xb528c0=0x0,_0x19c590=DUPLICATES[_0xfcb3('0x18')];_0xb528c0<_0x19c590;_0xb528c0+=0x1){_0x25d417[DUPLICATES[_0xb528c0]]=_0x360a1c[DUPLICATES[_0xb528c0]];}var _0xbf678e=_[_0xfcb3('0x25')](_0x38bd63,_0x25d417);if(_0xbf678e){return _0x425a09(handleCheckRowError(_0xfcb3('0x26'),'Duplicate\x20Contact',_0xbf678e,_0xc9aca9));}}return db['CmContact']['create'](_0x360a1c,{'raw':!![],'hooks':![],'fields':_[_0xfcb3('0x27')](_0x360a1c)})[_0xfcb3('0x28')](function(_0x1eda6d){if(DUPLICATES&&DUPLICATES['length']&&_0x38bd63){_0x38bd63[_0xfcb3('0x29')](_[_0xfcb3('0x2a')](_0x360a1c,DUPLICATES));}hopperContacts+=(hopperContacts?',':'')+_0x1eda6d['id'];return _0xcc0139();})['catch'](function(_0x199c46){return _0x425a09(handleCheckRowError('error',_0xfcb3('0x2b')+(_0x199c46[_0xfcb3('0x1a')]||JSON['stringify'](_0x199c46)),null,_0xc9aca9));});});}function checkHopper(){function _0x3b789b(){return function(_0xf0ce28){logger[_0xfcb3('0x17')](_0xfcb3('0x2c'),_0xfcb3('0x2d'),util['inspect'](_0xf0ce28,{'showHidden':![],'depth':null}));};}var _0x3554d7=function(_0x5b0754,_0x460042){var _0x4803e2=squel[_0xfcb3('0x2e')]()[_0xfcb3('0x2f')](_0xfcb3('0x30'))['fromQuery']([_0xfcb3('0x1d'),_0xfcb3('0x31'),_0xfcb3('0x32'),_0xfcb3('0x23'),_0x460042,_0xfcb3('0x33'),_0xfcb3('0x34')],squel[_0xfcb3('0x35')]()[_0xfcb3('0x36')](_0xfcb3('0x1d'),_0xfcb3('0x1d'))[_0xfcb3('0x36')](_0xfcb3('0x37'),_0xfcb3('0x31'))[_0xfcb3('0x36')]('id','ContactId')[_0xfcb3('0x36')](LISTID[_0xfcb3('0x38')](),_0xfcb3('0x23'))[_0xfcb3('0x36')](_0x5b0754['id'][_0xfcb3('0x38')](),_0x460042)[_0xfcb3('0x36')](_0xfcb3('0x37'),'createdAt')[_0xfcb3('0x36')]('NOW()',_0xfcb3('0x34'))[_0xfcb3('0x39')]('cm_contacts')[_0xfcb3('0x3a')](_0xfcb3('0x3b'))[_0xfcb3('0x3a')]('ListId\x20=\x20?',LISTID[_0xfcb3('0x38')]())[_0xfcb3('0x3a')]('phone\x20IS\x20NOT\x20NULL')['where'](_0xfcb3('0x3c'),squel[_0xfcb3('0x35')]()[_0xfcb3('0x36')](_0xfcb3('0x1d'))[_0xfcb3('0x39')]('cm_hopper')[_0xfcb3('0x3a')](_0x460042+_0xfcb3('0x3d'),_0x5b0754['id'][_0xfcb3('0x38')]())))[_0xfcb3('0x38')]();return _0x4803e2;};var _0x5b2831=function(_0x5aeb3d,_0x1db676){var _0x40ee61=squel['insert']()['into'](_0xfcb3('0x30'))[_0xfcb3('0x3e')]([_0xfcb3('0x1d'),_0xfcb3('0x31'),_0xfcb3('0x32'),_0xfcb3('0x23'),_0x1db676,_0xfcb3('0x33'),_0xfcb3('0x34')],squel[_0xfcb3('0x35')]()[_0xfcb3('0x36')](_0xfcb3('0x1d'),_0xfcb3('0x1d'))[_0xfcb3('0x36')](_0xfcb3('0x37'),_0xfcb3('0x31'))[_0xfcb3('0x36')]('id',_0xfcb3('0x32'))[_0xfcb3('0x36')](LISTID['toString'](),_0xfcb3('0x23'))[_0xfcb3('0x36')](_0x5aeb3d['id'][_0xfcb3('0x38')](),_0x1db676)[_0xfcb3('0x36')](_0xfcb3('0x37'),'createdAt')[_0xfcb3('0x36')]('NOW()','updatedAt')[_0xfcb3('0x39')](_0xfcb3('0x3f'))[_0xfcb3('0x3a')](_0xfcb3('0x3b'))[_0xfcb3('0x3a')](_0xfcb3('0x40'),LISTID[_0xfcb3('0x38')]())[_0xfcb3('0x3a')](_0xfcb3('0x41'),squel[_0xfcb3('0x42')](hopperContacts))[_0xfcb3('0x3a')](_0xfcb3('0x43'))[_0xfcb3('0x3a')]('phone\x20NOT\x20IN\x20(?)',squel[_0xfcb3('0x35')]()[_0xfcb3('0x36')](_0xfcb3('0x44'))[_0xfcb3('0x39')](_0xfcb3('0x45'))['where'](_0x1db676+'\x20=\x20?',_0x5aeb3d['id'][_0xfcb3('0x38')]()))[_0xfcb3('0x3a')](_0xfcb3('0x3c'),squel[_0xfcb3('0x35')]()[_0xfcb3('0x36')]('phone')['from']('cm_hopper')[_0xfcb3('0x3a')](_0x1db676+_0xfcb3('0x3d'),_0x5aeb3d['id'][_0xfcb3('0x38')]())))[_0xfcb3('0x38')]();return _0x40ee61;};function _0x3f8fe4(_0x2236dd,_0xecddd2){var _0x1e86d2=squel[_0xfcb3('0x2e')]()['into'](_0xfcb3('0x30'))[_0xfcb3('0x3e')](['phone',_0xfcb3('0x31'),_0xfcb3('0x32'),'ListId',_0xecddd2,'createdAt',_0xfcb3('0x34')],squel[_0xfcb3('0x35')]()[_0xfcb3('0x36')](_0xfcb3('0x1d'),_0xfcb3('0x1d'))[_0xfcb3('0x36')](_0xfcb3('0x37'),'scheduledAt')['field']('id',_0xfcb3('0x32'))[_0xfcb3('0x36')](LISTID[_0xfcb3('0x38')](),_0xfcb3('0x23'))[_0xfcb3('0x36')](_0x2236dd['id'][_0xfcb3('0x38')](),_0xecddd2)[_0xfcb3('0x36')](_0xfcb3('0x37'),'createdAt')[_0xfcb3('0x36')](_0xfcb3('0x37'),_0xfcb3('0x34'))[_0xfcb3('0x39')](_0xfcb3('0x3f'))[_0xfcb3('0x3a')](_0xfcb3('0x3b'))[_0xfcb3('0x3a')](_0xfcb3('0x40'),LISTID[_0xfcb3('0x38')]())['where']('id\x20IN\x20?',squel[_0xfcb3('0x42')](hopperContacts))['where'](_0xfcb3('0x43')))[_0xfcb3('0x38')]();return _0x1e86d2;}function _0x2f2e36(_0x31ef0b,_0x24c097){var _0x3c285b=squel['insert']()[_0xfcb3('0x2f')]('cm_hopper_black')['fromQuery'](['phone',_0xfcb3('0x32'),_0xfcb3('0x23'),_0x24c097,_0xfcb3('0x33'),_0xfcb3('0x34')],squel[_0xfcb3('0x35')]()[_0xfcb3('0x36')](_0xfcb3('0x1d'),_0xfcb3('0x1d'))[_0xfcb3('0x36')]('id',_0xfcb3('0x32'))['field'](LISTID[_0xfcb3('0x38')](),_0xfcb3('0x23'))['field'](_0x31ef0b['id'][_0xfcb3('0x38')](),_0x24c097)[_0xfcb3('0x36')](_0xfcb3('0x37'),_0xfcb3('0x33'))[_0xfcb3('0x36')]('NOW()','updatedAt')[_0xfcb3('0x39')](_0xfcb3('0x3f'))['where'](_0xfcb3('0x3b'))['where']('ListId\x20=\x20?',LISTID[_0xfcb3('0x38')]())[_0xfcb3('0x3a')](_0xfcb3('0x41'),squel[_0xfcb3('0x42')](hopperContacts))[_0xfcb3('0x3a')](_0xfcb3('0x43')))[_0xfcb3('0x38')]();return _0x3c285b;}return db['VoiceQueue'][_0xfcb3('0x46')]({'where':{'type':_0xfcb3('0x47')},'attributes':['id','dialCheckDuplicateType'],'include':[{'model':db[_0xfcb3('0x48')],'as':_0xfcb3('0x49'),'where':{'id':LISTID}}]})[_0xfcb3('0x28')](function(_0x2a31bd){var _0x1849f0=[];if(_0x2a31bd){var _0x23157d;for(var _0x5e4f7a=0x0,_0xf9f649;_0x5e4f7a<_0x2a31bd[_0xfcb3('0x18')];_0x5e4f7a+=0x1){_0xf9f649=_0x2a31bd[_0x5e4f7a][_0xfcb3('0x4a')]({'plain':!![]});switch(_0xf9f649[_0xfcb3('0x4b')]){case'always':_0x1849f0[_0xfcb3('0x29')](db[_0xfcb3('0x4c')][_0xfcb3('0x4d')](_0x5b2831(_0xf9f649,_0xfcb3('0x4e')))['then'](function(){})[_0xfcb3('0x4f')](_0x3b789b()));break;case _0xfcb3('0x50'):_0x1849f0[_0xfcb3('0x29')](db[_0xfcb3('0x4c')]['query'](_0x3554d7(_0xf9f649,'VoiceQueueId'))[_0xfcb3('0x28')](function(){})[_0xfcb3('0x4f')](_0x3b789b()));break;default:_0x1849f0[_0xfcb3('0x29')](db['sequelize'][_0xfcb3('0x4d')](_0x3f8fe4(_0xf9f649,_0xfcb3('0x4e')))[_0xfcb3('0x28')](function(){})[_0xfcb3('0x4f')](_0x3b789b()));}}}return _0x1849f0;})[_0xfcb3('0x51')]()['then'](function(){return db[_0xfcb3('0x52')][_0xfcb3('0x46')]({'where':{'type':'outbound'},'attributes':['id'],'include':[{'model':db[_0xfcb3('0x48')],'as':_0xfcb3('0x53'),'where':{'id':LISTID}}]})[_0xfcb3('0x28')](function(_0x3036ce){var _0xa73eca=[];if(_0x3036ce){var _0xa76d33;for(var _0x42be91=0x0,_0x229155;_0x42be91<_0x3036ce['length'];_0x42be91+=0x1){_0x229155=_0x3036ce[_0x42be91][_0xfcb3('0x4a')]({'plain':!![]});_0xa73eca['push'](db['sequelize'][_0xfcb3('0x4d')](_0x2f2e36(_0x229155,_0xfcb3('0x4e')))['then'](function(){})[_0xfcb3('0x4f')](_0x3b789b()));}}return _0xa73eca;})['all']();})[_0xfcb3('0x28')](function(){return db[_0xfcb3('0x54')][_0xfcb3('0x46')]({'attributes':['id',_0xfcb3('0x4b')],'include':[{'model':db[_0xfcb3('0x48')],'as':_0xfcb3('0x49'),'where':{'id':LISTID}}]})[_0xfcb3('0x28')](function(_0x291dbe){var _0x27d185=[];if(_0x291dbe){for(var _0x118102=0x0,_0x4f4aba;_0x118102<_0x291dbe[_0xfcb3('0x18')];_0x118102+=0x1){_0x4f4aba=_0x291dbe[_0x118102]['get']({'plain':!![]});switch(_0x4f4aba[_0xfcb3('0x4b')]){case _0xfcb3('0x55'):_0x27d185[_0xfcb3('0x29')](db[_0xfcb3('0x4c')][_0xfcb3('0x4d')](_0x5b2831(_0x4f4aba,_0xfcb3('0x56')))[_0xfcb3('0x28')](function(){})['catch'](_0x3b789b()));break;case _0xfcb3('0x50'):_0x27d185[_0xfcb3('0x29')](db['sequelize'][_0xfcb3('0x4d')](_0x3554d7(_0x4f4aba,'CampaignId'))[_0xfcb3('0x28')](function(){})['catch'](_0x3b789b()));break;default:_0x27d185['push'](db[_0xfcb3('0x4c')][_0xfcb3('0x4d')](_0x3f8fe4(_0x4f4aba,_0xfcb3('0x56')))[_0xfcb3('0x28')](function(){})[_0xfcb3('0x4f')](_0x3b789b()));}}}return _0x27d185;})[_0xfcb3('0x51')]();})['then'](function(){return db[_0xfcb3('0x54')][_0xfcb3('0x46')]({'attributes':['id'],'include':[{'model':db[_0xfcb3('0x48')],'as':_0xfcb3('0x53'),'where':{'id':LISTID}}]})['then'](function(_0x33c470){var _0x3b573d=[];if(_0x33c470){for(var _0x4d2140=0x0,_0x2b203b;_0x4d2140<_0x33c470[_0xfcb3('0x18')];_0x4d2140+=0x1){_0x2b203b=_0x33c470[_0x4d2140][_0xfcb3('0x4a')]({'plain':!![]});_0x3b573d[_0xfcb3('0x29')](db['sequelize'][_0xfcb3('0x4d')](_0x2f2e36(_0x2b203b,_0xfcb3('0x56')))['then'](function(){})[_0xfcb3('0x4f')](_0x3b789b()));}}return _0x3b573d;})[_0xfcb3('0x51')]();})['catch'](function(_0x14032b){logger['error'](_0xfcb3('0x57'),_0xfcb3('0x58'),_0x14032b[_0xfcb3('0x1a')]);});}var processPromises=function(_0x44158b){return BPromise[_0xfcb3('0x51')](promises)['then'](function(_0x8fafc1){})['catch'](function(_0x556eb1){logger[_0xfcb3('0x17')](_0xfcb3('0x59'),JSON[_0xfcb3('0x5a')](_0x556eb1));})['finally'](function(){socket[_0xfcb3('0x5b')](_0xfcb3('0x5c')+SOCKET_TIMESTAMP,{'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});promises=[];success=0x0;errors=0x0;duplicates=0x0;rows=[];if(_0x44158b){return _0x44158b[_0xfcb3('0x5d')]();}});};var endCsv=function(){return BPromise[_0xfcb3('0x5e')]()[_0xfcb3('0x28')](function(){if(hopperContacts){return checkHopper();}})['then'](function(){socket[_0xfcb3('0x5b')](_0xfcb3('0x5c')+SOCKET_TIMESTAMP,{'finished':!![],'success':success,'errors':errors,'duplicates':duplicates,'rows':rows});try{fs['unlinkSync'](FILEPATH);}catch(_0x4716f2){logger['error']('Unable\x20to\x20delete\x20temp\x20file:',JSON['stringify'](_0x4716f2));}finally{process[_0xfcb3('0x5f')](0x0);}});};process['on'](_0xfcb3('0x60'),function(){logger[_0xfcb3('0x61')](_0xfcb3('0x62'));endCsv();});function main(){return BPromise[_0xfcb3('0x5e')]()[_0xfcb3('0x28')](function(){if(DUPLICATES){DUPLICATES=DUPLICATES['split'](',');return db[_0xfcb3('0x63')]['findAll']({'where':{'ListId':LISTID},'attributes':DUPLICATES,'raw':!![]});}})[_0xfcb3('0x28')](function(_0x42c292){var _0x28e868=fs[_0xfcb3('0x64')](FILEPATH,{'highWaterMark':0xf*0x400*0x400});Papa[_0xfcb3('0x65')](_0x28e868,{'header':!![],'skipEmptyLines':!![],'step':function(_0x47de3e,_0x4af59b){total+=0x1;var _0x45ca5d=total;promises[_0xfcb3('0x29')](checkRow(_0x47de3e,_0x42c292,_0x45ca5d)[_0xfcb3('0x28')](function(){success+=0x1;})[_0xfcb3('0x4f')](function(_0x1ce0bd){if(_0x1ce0bd[_0xfcb3('0x17')]){errors+=0x1;delete _0x1ce0bd['error'];}else if(_0x1ce0bd['duplicate']){duplicates+=0x1;delete _0x1ce0bd[_0xfcb3('0x26')];}rows[_0xfcb3('0x29')](_0x1ce0bd);}));if(total%0xc8===0x0){_0x4af59b['pause']();return processPromises(_0x4af59b);}},'complete':function(){return processPromises()[_0xfcb3('0x28')](function(){logger[_0xfcb3('0x61')]('CSV\x20parsed\x20correctly!');endCsv();});},'error':function(_0x49460a,_0x2e3256){logger[_0xfcb3('0x61')](_0xfcb3('0x66'),JSON[_0xfcb3('0x5a')](_0x49460a));endCsv();}});})[_0xfcb3('0x4f')](function(_0x3b99c0){logger[_0xfcb3('0x17')](_0xfcb3('0x67'),JSON[_0xfcb3('0x5a')](_0x3b99c0));});}main(); \ No newline at end of file diff --git a/server/components/import/cm/csv2.js b/server/components/import/cm/csv2.js index 3e6e541..37aff1d 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 _0xed65=['phone','join','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','CmContact','findAll','AdditionalPhones','then','push','all','split','length','isNil','filter','CmContactHasItem','update','cm_contacts.phone','cm_contacts.id','cm_contacts.ListId','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','cm_hopper','fromQuery','scheduledat','ListId','createdAt','updatedAt','priority','UserId','recallme','from','cm_contacts','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','\x22onlyIfOpen\x22','toString','into','cm_hopper_black','ContactId','fields','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','ListId\x20=\x20?','.offset-cm_contacts.utcOffset\x20minute)','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','keys','CompanyId',')\x20NOT\x20IN\x20?','deletedAt\x20IS\x20NULL','id\x20IN\x20?','min_id','info','Received\x20SIGINT','error','message','exit','errors','code','sequelize','spread','catch','campaigns.id','campaigns.dialTimezone','campaigns','campaigns_has_cm_lists','campaigns_has_cm_lists.CmListId=','voice_queues.id','voice_queues.dialTimezone','voice_queues','voice_queues_has_cm_lists','voice_queues_has_cm_lists.CmListId=','query','dialTimezone','utcOffset','set','offset','main','send','start','binding','clone','root','server/files/tmp','header','ContactItemType','name','_description','parse','data','find','hasOwnProperty','trim','replace','isValid','scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)','isNumber','includes','email','email\x20wrong\x20format','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','timezones','firstName','itemTypeId','description','appendFileSync','rows','emit','Abort\x20parser','abort','step','duplicates','CREATE\x20TABLE\x20','\x20LIKE\x20cm_contacts;','campaigns_','voice_queues_','(id\x20int,dialTimezone\x20varchar(255),offset\x20int);','LOAD\x20DATA\x20LOCAL\x20INFILE\x20\x27%s\x27\x20INTO\x20TABLE\x20%s\x20CHARACTER\x20SET\x20UTF8\x20FIELDS\x20TERMINATED\x20BY\x20\x27,\x27\x20ENCLOSED\x20BY\x20\x27\x22\x27\x20LINES\x20TERMINATED\x20BY\x20\x27\x0a\x27\x20IGNORE\x201\x20ROWS\x20(%s)\x20SET\x20id\x20=\x20NULL,\x20ListId\x20=\x20%s,\x20CompanyId\x20=\x20%s,\x20createdAt\x20=\x20\x27%s\x27,\x20updatedAt\x20=\x20\x27%s\x27',',\x20scheduledAt\x20=\x20NOW()','DROP\x20TABLE\x20','contactId','contactTypeId','orderBy','VoiceQueueId','voice_queues_has_cm_blacklists','CampaignId','campaigns_has_cm_blacklists','finish','affectedRows','unlink','complete','argv','arguments\x20\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding\x20doesn\x27t\x20exists','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','body\x20id\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','moment','ioredis','../../../config/environment/shared','import','redis','defaults','localhost','socket.io-emitter','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field'];(function(_0x35b9e6,_0x55f654){var _0x55e8cd=function(_0x4fd81c){while(--_0x4fd81c){_0x35b9e6['push'](_0x35b9e6['shift']());}};_0x55e8cd(++_0x55f654);}(_0xed65,0xa1));var _0x5ed6=function(_0x381a28,_0x4eb359){_0x381a28=_0x381a28-0x0;var _0x5e572d=_0xed65[_0x381a28];return _0x5e572d;};'use strict';var fs=require('fs');var path=require(_0x5ed6('0x0'));var _=require(_0x5ed6('0x1'));var Papa=require(_0x5ed6('0x2'));var util=require(_0x5ed6('0x3'));var BPromise=require('bluebird');var moment=require(_0x5ed6('0x4'));var squel=require('squel');var Redis=require(_0x5ed6('0x5'));var db=require('../../../mysqldb')['db'];var config=require('../../../config/environment');var shared=require(_0x5ed6('0x6'));var logger=require('../../../config/logger')(_0x5ed6('0x7'));config[_0x5ed6('0x8')]=_[_0x5ed6('0x9')](config[_0x5ed6('0x8')],{'host':_0x5ed6('0xa'),'port':0x18eb});var socket=require(_0x5ed6('0xb'))(new Redis(config[_0x5ed6('0x8')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x5ed6('0xc')]('YYYY-MM-DD\x20HH:mm:ss');var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x5ed6('0xc')](_0x5ed6('0xd'));function isEmail(_0x202071){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))*$/[_0x5ed6('0xe')](_0x202071);}function selectNotIn(_0x29963c,_0x37466f,_0x2101ed,_0x34e2d6,_0x2a88d4){return squel[_0x5ed6('0xf')]()[_0x5ed6('0x10')](_0x5ed6('0x11'))['from'](_0x34e2d6)[_0x5ed6('0x12')](_0x37466f,null,_0x37466f+_0x5ed6('0x13')+_0x34e2d6+'.'+_0x2101ed)[_0x5ed6('0x14')](_0x34e2d6+'.'+_0x2101ed+_0x5ed6('0x15')+_0x29963c+'.'+_0x2101ed)[_0x5ed6('0x14')](_0x37466f+_0x5ed6('0x16')+_0x2a88d4[_0x5ed6('0x12')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x31e43f,_0x37eee4){promisesAdditionalPhones=[];return db[_0x5ed6('0x17')][_0x5ed6('0x18')]({'raw':!![],'attributes':['id',_0x5ed6('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x5ed6('0x1a')](function(_0x3637e7){if(_0x3637e7!==null){var _0x385ac4=[];for(var _0x25cdcc=0x0;_0x25cdcc<_0x3637e7['length'];_0x25cdcc++){var _0x676869=_0x3637e7[_0x25cdcc];_0x385ac4[_0x5ed6('0x1b')](insertAdditionalPhones(_0x676869));}}Promise[_0x5ed6('0x1c')](_0x385ac4)[_0x5ed6('0x1a')](function(){_0x31e43f({'val':0x1});});});});}function insertAdditionalPhones(_0x22d7d2){return new Promise(function(_0x369299,_0x442513){var _0x474bd8=_0x22d7d2['AdditionalPhones'];var _0x4219c9=_0x474bd8[_0x5ed6('0x1d')](';');var _0x1bbad6=[];orderBy=0x0;for(var _0xe4a883=0x0;_0xe4a883<_0x4219c9[_0x5ed6('0x1e')];_0xe4a883++){_0x1bbad6[_0x5ed6('0x1b')](splitAdditionalPhone(_0x22d7d2['id'],_0x4219c9[_0xe4a883]));}Promise[_0x5ed6('0x1c')](_0x1bbad6)['then'](function(){_0x369299({'val':_0x4219c9[_0x5ed6('0x1e')]});});});}function splitAdditionalPhone(_0x40a2f2,_0x3330c9){return new Promise(function(_0x183a4,_0xe62ffb){var _0x11e2ae=_0x3330c9[_0x5ed6('0x1d')](':');var _0x24ad7f=_0x11e2ae[0x0];var _0x4077c5=_0x11e2ae[0x1];if(!_[_0x5ed6('0x1f')](_0x4077c5)){var _0x4f0a01=_0x4077c5[_0x5ed6('0x1d')]('|');var _0x4ecc04=[];for(var _0x1ff651=0x0;_0x1ff651<_0x4f0a01[_0x5ed6('0x1e')];_0x1ff651++){if(_0x4f0a01[_0x1ff651]!==''){var _0x42c53a=_[_0x5ed6('0x20')](promisesAdditionalPhones,{'contactId':_0x40a2f2,'phone':_0x4f0a01[_0x1ff651]});if(_0x42c53a['length']==0x0){orderBy++;promisesAdditionalPhones['push']({'contactId':_0x40a2f2,'contactTypeId':_0x24ad7f,'phone':_0x4f0a01[_0x1ff651],'orderBy':orderBy});}}}_0x183a4({'ok':0x1});}else _0x183a4({'res':0x0});});}function createAdditionalPhone(_0x300d07,_0x59028a,_0x4b1dc2,_0x4d3a88){var _0x40b18f='';var _0x56de18='';var _0x5ca7c9=_0x4b1dc2[_0x5ed6('0x1d')]('§');_0x40b18f=_0x5ca7c9[0x0];if(_0x5ca7c9[_0x5ed6('0x1e')]==0x2)_0x56de18=_0x5ca7c9[0x1];return new Promise(function(_0xaeb439,_0x33bf07){return db[_0x5ed6('0x21')]['findOne']({'where':{'CmContactId':_0x300d07,'item':_0x40b18f}})[_0x5ed6('0x1a')](function(_0x1dd2f5){if(_0x1dd2f5){return db[_0x5ed6('0x21')][_0x5ed6('0x22')]({'ItemTypeId':_0x59028a,'description':_0x56de18,'OrderBy':_0x4d3a88},{'where':{'CmContactId':_0x300d07,'item':_0x40b18f}})[_0x5ed6('0x1a')](function(_0x1be45a){_0xaeb439({'res':'updated'});});}else{return db[_0x5ed6('0x21')]['create']({'CmContactId':_0x300d07,'item':_0x40b18f,'description':_0x56de18,'ItemTypeId':_0x59028a,'OrderBy':_0x4d3a88,'ItemClass':'PHONE'})[_0x5ed6('0x1a')](function(_0xb9b7ea){_0xaeb439({'res':'inserted'});});}});});}function insertCmHopper(_0x380280,_0x46ee1a,_0x1b03d0,_0x4054fc,_0x1ee865){var _0x1c1048=[_0x5ed6('0x23'),'cm_contacts.scheduledat',_0x5ed6('0x24'),_0x5ed6('0x25'),_0x46ee1a+'.'+_0x4054fc,_0x5ed6('0x26'),_0x5ed6('0x27'),_0x5ed6('0x28'),_0x5ed6('0x29'),'\x22'+_0x1ee865+'\x22'];return squel[_0x5ed6('0x2a')]()['into'](_0x5ed6('0x2b'))[_0x5ed6('0x2c')]([_0x5ed6('0x11'),_0x5ed6('0x2d'),'ContactId',_0x5ed6('0x2e'),_0x4054fc,_0x5ed6('0x2f'),_0x5ed6('0x30'),_0x5ed6('0x31'),_0x5ed6('0x32'),_0x5ed6('0x33')],squel[_0x5ed6('0xf')]()['fields'](_0x1c1048)[_0x5ed6('0x34')](_0x46ee1a)['join'](_0x5ed6('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x46ee1a+'.CmListId')[_0x5ed6('0x12')](_0x1b03d0,null,_0x1b03d0+'.id\x20=\x20'+_0x46ee1a+'.'+_0x4054fc)[_0x5ed6('0x14')](_0x46ee1a+'.CmListId\x20=\x20?',_0x380280)[_0x5ed6('0x14')](_0x5ed6('0x36'),NOW)['where'](_0x5ed6('0x37'),selectNotIn(_0x46ee1a,_0x1b03d0,_0x4054fc,_0x5ed6('0x2b'),[_0x5ed6('0x38'),_0x5ed6('0x39')]))[_0x5ed6('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x46ee1a,_0x1b03d0,_0x4054fc,_0x5ed6('0x2b'),[_0x5ed6('0x38')])))[_0x5ed6('0x3a')]();}function insertCmHopperBlack(_0x438668,_0x2e0c38,_0x56a224,_0x286357){var _0xef94b0=['cm_contacts.phone',_0x5ed6('0x24'),_0x5ed6('0x25'),_0x2e0c38+'.'+_0x286357,'cm_contacts.createdAt',_0x5ed6('0x27')];return squel['insert']()[_0x5ed6('0x3b')](_0x5ed6('0x3c'))[_0x5ed6('0x2c')]([_0x5ed6('0x11'),_0x5ed6('0x3d'),_0x5ed6('0x2e'),_0x286357,'createdAt',_0x5ed6('0x30')],squel[_0x5ed6('0xf')]()[_0x5ed6('0x3e')](_0xef94b0)['from'](_0x2e0c38)[_0x5ed6('0x12')]('cm_contacts',null,_0x5ed6('0x3f')+_0x2e0c38+_0x5ed6('0x40'))[_0x5ed6('0x12')](_0x56a224,null,_0x56a224+_0x5ed6('0x13')+_0x2e0c38+'.'+_0x286357)[_0x5ed6('0x14')](_0x2e0c38+_0x5ed6('0x41'),_0x438668)[_0x5ed6('0x14')](_0x5ed6('0x36'),NOW)[_0x5ed6('0x14')](_0x5ed6('0x37'),squel['select']()[_0x5ed6('0x10')](_0x5ed6('0x11'))['from'](_0x5ed6('0x3c'))[_0x5ed6('0x14')](_0x5ed6('0x42'),_0x438668)[_0x5ed6('0x14')](_0x286357+_0x5ed6('0x15')+_0x2e0c38+'.'+_0x286357)))[_0x5ed6('0x3a')]();}function insertTzCmHopper(_0xe5e88d,_0x2d54a1,_0x882eda,_0x403e26,_0x22f622,_0x3050ce){var _0x1d620c=[_0x5ed6('0x23'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x3050ce+_0x5ed6('0x43'),'cm_contacts.id',_0x5ed6('0x25'),_0x2d54a1+'.'+_0x403e26,'cm_contacts.createdAt',_0x5ed6('0x27'),_0x5ed6('0x28'),_0x5ed6('0x29'),'\x22'+_0x22f622+'\x22'];var _0x3624d2=squel[_0x5ed6('0x2a')]()[_0x5ed6('0x3b')](_0x5ed6('0x2b'))['fromQuery']([_0x5ed6('0x11'),_0x5ed6('0x2d'),'ContactId','ListId',_0x403e26,_0x5ed6('0x2f'),_0x5ed6('0x30'),_0x5ed6('0x31'),_0x5ed6('0x32'),'recallme'],squel[_0x5ed6('0xf')]()['fields'](_0x1d620c)[_0x5ed6('0x34')](_0x2d54a1)['join'](_0x5ed6('0x35'),null,'cm_contacts.ListId\x20=\x20'+_0x2d54a1+_0x5ed6('0x40'))[_0x5ed6('0x12')](_0x882eda,null,_0x882eda+'.id\x20=\x20'+_0x2d54a1+'.'+_0x403e26)[_0x5ed6('0x12')](_0x3050ce,null,_0x3050ce+'.id\x20=\x20'+_0x2d54a1+'.'+_0x403e26)[_0x5ed6('0x14')](_0x2d54a1+_0x5ed6('0x41'),_0xe5e88d)[_0x5ed6('0x14')]('cm_contacts.createdAt\x20=\x20?',NOW)['where'](_0x5ed6('0x37'),selectNotIn(_0x2d54a1,_0x882eda,_0x403e26,_0x5ed6('0x2b'),[_0x5ed6('0x38'),'\x22onlyIfOpen\x22']))[_0x5ed6('0x14')](_0x5ed6('0x37'),selectNotIn(_0x2d54a1,_0x882eda,_0x403e26,'cm_hopper',['\x22always\x22'])))[_0x5ed6('0x3a')]();return _0x3624d2;}function insertTzCmHopperBlack(_0x5e5352,_0x50d458,_0x407400,_0x37ba4f){var _0x586e22=['cm_contacts.phone',_0x5ed6('0x24'),_0x5ed6('0x25'),_0x50d458+'.'+_0x37ba4f,_0x5ed6('0x26'),_0x5ed6('0x27')];return squel[_0x5ed6('0x2a')]()['into'](_0x5ed6('0x3c'))[_0x5ed6('0x2c')]([_0x5ed6('0x11'),_0x5ed6('0x3d'),_0x5ed6('0x2e'),_0x37ba4f,_0x5ed6('0x2f'),_0x5ed6('0x30')],squel[_0x5ed6('0xf')]()[_0x5ed6('0x3e')](_0x586e22)['from'](_0x50d458)[_0x5ed6('0x12')](_0x5ed6('0x35'),null,_0x5ed6('0x3f')+_0x50d458+_0x5ed6('0x40'))[_0x5ed6('0x12')](_0x407400,null,_0x407400+_0x5ed6('0x13')+_0x50d458+'.'+_0x37ba4f)[_0x5ed6('0x14')](_0x50d458+_0x5ed6('0x41'),_0x5e5352)[_0x5ed6('0x14')](_0x5ed6('0x36'),NOW)[_0x5ed6('0x14')](_0x5ed6('0x37'),squel[_0x5ed6('0xf')]()[_0x5ed6('0x10')]('phone')[_0x5ed6('0x34')](_0x5ed6('0x3c'))['where']('ListId\x20=\x20?',_0x5e5352)[_0x5ed6('0x14')](_0x37ba4f+_0x5ed6('0x15')+_0x50d458+'.'+_0x37ba4f)))[_0x5ed6('0x3a')]();}function insertCmHopperAdditionalPhones(_0x566feb){var _0x12558e=[_0x5ed6('0x44'),_0x5ed6('0x45'),_0x5ed6('0x46'),_0x5ed6('0x47'),'cm_contact_has_items.updatedAt'];return squel[_0x5ed6('0x2a')]()['into'](_0x5ed6('0x48'))['fromQuery']([_0x5ed6('0x49'),_0x5ed6('0x11'),_0x5ed6('0x4a'),_0x5ed6('0x2f'),_0x5ed6('0x30')],squel['select']()[_0x5ed6('0x3e')](_0x12558e)['from'](_0x5ed6('0x2b'))[_0x5ed6('0x12')](_0x5ed6('0x35'),null,_0x5ed6('0x4b'))[_0x5ed6('0x12')](_0x5ed6('0x4c'),null,_0x5ed6('0x4d'))[_0x5ed6('0x14')](_0x5ed6('0x4e'),_0x566feb)[_0x5ed6('0x14')](_0x5ed6('0x36'),NOW))[_0x5ed6('0x3a')]();}function insertCmContact(_0x2da011,_0x18098c,_0xe07220,_0x54f147){var _0x4851dc=_[_0x5ed6('0x4f')](_[_0x5ed6('0x50')](_0x54f147),[_0x5ed6('0x2e'),_0x5ed6('0x51'),_0x5ed6('0x2f'),_0x5ed6('0x30')]);return squel['insert']()[_0x5ed6('0x3b')]('cm_contacts')[_0x5ed6('0x2c')](_0x4851dc,squel['select']()[_0x5ed6('0x3e')](_0x4851dc)['from'](_0x18098c)[_0x5ed6('0x14')]('('+_0xe07220['join'](',')+_0x5ed6('0x52'),squel[_0x5ed6('0xf')]()[_0x5ed6('0x3e')](_0xe07220)[_0x5ed6('0x34')](_0x5ed6('0x35'))[_0x5ed6('0x14')](_0x5ed6('0x42'),_0x2da011)[_0x5ed6('0x14')](_0x5ed6('0x53')))[_0x5ed6('0x14')](_0x5ed6('0x54'),squel[_0x5ed6('0xf')]()[_0x5ed6('0x10')]('MIN(id)',_0x5ed6('0x55'))[_0x5ed6('0x34')](_0x18098c)['group'](_0xe07220[_0x5ed6('0x12')](','))))['toString']();}function handleStop(){logger[_0x5ed6('0x56')](_0x5ed6('0x57'));stopped=!![];}function handleUncaughtException(_0x500d8a){logger[_0x5ed6('0x58')](_0x500d8a[_0x5ed6('0x59')]);process[_0x5ed6('0x5a')](0x1);}function handleError(_0x10fe80,_0x40256c){stats[_0x5ed6('0x5b')]['push']({'name':_0x40256c[_0x5ed6('0x5c')],'message':_0x40256c['message'],'row':_0x10fe80});}function handleQuery(_0xd0355b){logger[_0x5ed6('0x56')](_0xd0355b);return db[_0x5ed6('0x5d')]['query'](_0xd0355b)[_0x5ed6('0x5e')](function(_0x467836){results['push'](_0x467836);})[_0x5ed6('0x5f')](function(_0x1e867d){logger['error'](_0x1e867d[_0x5ed6('0x59')]);});}function updateTzCampaigns(_0x35a240){return new Promise(function(_0x534b4b,_0x51dbdb){var _0x8f8707=squel['select']()[_0x5ed6('0x3e')]([_0x5ed6('0x60'),_0x5ed6('0x61')])['from'](_0x5ed6('0x62'))[_0x5ed6('0x12')](_0x5ed6('0x63'),null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x5ed6('0x14')](_0x5ed6('0x64')+_0x35a240);db[_0x5ed6('0x5d')]['query'](_0x8f8707[_0x5ed6('0x3a')]())['spread'](function(_0x13f462){var _0x43f9ce=[];for(var _0x26fff2=0x0;_0x26fff2<_0x13f462[_0x5ed6('0x1e')];_0x26fff2++){_0x43f9ce['push'](getTimezoneData(_0x13f462[_0x26fff2],tmp_campaigns));}BPromise['all'](_0x43f9ce)[_0x5ed6('0x1a')](function(){_0x534b4b({'val':0x1});});})['catch'](function(_0x401403){logger[_0x5ed6('0x58')](_0x401403['message']);_0x534b4b({'val':0x0});});});}function updateTzVoiceQueues(_0x22ebb5){return new Promise(function(_0x56650c,_0x49d4ab){var _0x13e611=squel[_0x5ed6('0xf')]()[_0x5ed6('0x3e')]([_0x5ed6('0x65'),_0x5ed6('0x66')])[_0x5ed6('0x34')](_0x5ed6('0x67'))['join'](_0x5ed6('0x68'),null,'voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId')[_0x5ed6('0x14')](_0x5ed6('0x69')+_0x22ebb5);db[_0x5ed6('0x5d')][_0x5ed6('0x6a')](_0x13e611[_0x5ed6('0x3a')]())['spread'](function(_0x48861b){var _0x5454da=[];for(var _0x31348c=0x0;_0x31348c<_0x48861b['length'];_0x31348c++){_0x5454da[_0x5ed6('0x1b')](getTimezoneData(_0x48861b[_0x31348c],tmp_voice_queues));}BPromise[_0x5ed6('0x1c')](_0x5454da)[_0x5ed6('0x1a')](function(){_0x56650c({'val':0x1});});})[_0x5ed6('0x5f')](function(_0x23e43a){logger['error'](_0x23e43a[_0x5ed6('0x59')]);_0x56650c({'val':0x0});});});}function getTimezoneData(_0x5d5c85,_0x184551){return new Promise(function(_0x33c5b9,_0x325b6b){var _0x5a4642=shared['timezones'];var _0xff090a=_0x5a4642[_0x5d5c85[_0x5ed6('0x6b')]];if(_[_0x5ed6('0x1f')](_0xff090a)){_0x33c5b9({'ret':0x1});}else{var _0x5f35ce=_0xff090a[_0x5ed6('0x6c')];var _0x356fc8=squel['insert']()['into'](_0x184551)[_0x5ed6('0x6d')]('id',_0x5d5c85['id'])['set'](_0x5ed6('0x6e'),_0x5f35ce)[_0x5ed6('0x6d')](_0x5ed6('0x6b'),_0x5d5c85[_0x5ed6('0x6b')])['toString']();return db[_0x5ed6('0x5d')][_0x5ed6('0x6a')](_0x356fc8)[_0x5ed6('0x5e')](function(_0x273160){_0x33c5b9({'ret':0x1});})[_0x5ed6('0x5f')](function(_0x162267){logger[_0x5ed6('0x58')](_0x162267['message']);_0x325b6b({'ret':0x1});});}});}function handleTZQuery(_0x4f32b0){logger[_0x5ed6('0x56')](_0x4f32b0);return db[_0x5ed6('0x5d')][_0x5ed6('0x6a')](_0x4f32b0)[_0x5ed6('0x5e')](function(_0x286266){})[_0x5ed6('0x5f')](function(_0x462b07){logger[_0x5ed6('0x58')](_0x462b07['message']);});}function main(_0x47c7df,_0x242174,_0x120ec4,_0xe91467){logger[_0x5ed6('0x56')](_0x5ed6('0x6f'),_0x47c7df,JSON['stringify'](_0x242174));process[_0x5ed6('0x70')](_0x5ed6('0x71'));var _0x1566eb=_0x242174[_0x5ed6('0x72')];var _0x42891f=_[_0x5ed6('0x73')](_0x1566eb);var _0x3485ca=_0x242174['socket_timestamp'];var _0x5e724f=path[_0x5ed6('0x12')](config[_0x5ed6('0x74')],_0x5ed6('0x75'),_0x3485ca+'.csv');hasTZ=_[_0x5ed6('0x50')](_0x1566eb)['includes'](_0x5ed6('0x6b'));var _0x1e5077=_[_0x5ed6('0x50')](_0x1566eb)[_0x5ed6('0x12')]();logger[_0x5ed6('0x56')](_0x5ed6('0x76'),_0x1e5077);db[_0x5ed6('0x77')]['findAll']({'raw':!![],'attributes':['id',_0x5ed6('0x78')]})['then'](function(_0x351400){for(var _0x2a2922=0x0;_0x2a2922<_0x351400['length'];_0x2a2922++){if(_0x351400[_0x2a2922]['name']in _0x1566eb){contactItemTypes[_0x5ed6('0x1b')](_0x351400[_0x2a2922]);delete _0x42891f[_0x351400[_0x2a2922]['name']];hasAdditionalPhones=!![];}for(var _0x5d657a in _0x1566eb){if(_0x351400[_0x2a2922][_0x5ed6('0x78')]+_0x5ed6('0x79')===_0x5d657a){phoneDescriptions[_0x5ed6('0x1b')]({'itemTypeId':_0x351400[_0x2a2922]['id'],'description':_0x5d657a});delete _0x42891f[_0x5d657a];}}}if(hasAdditionalPhones)_0x42891f[_0x5ed6('0x19')]='';var _0x3361d9=_[_0x5ed6('0x50')](_0x42891f)[_0x5ed6('0x12')]();logger['info'](_0x5ed6('0x76'),_0x3361d9);fs['writeFileSync'](_0x5e724f,_0x3361d9+'\x0a');Papa[_0x5ed6('0x7a')](fs['createReadStream'](_0x47c7df),{'header':!![],'skipEmptyLines':!![],'step':function(_0x4f64c0,_0x4905a1){try{for(var _0x2621c2=0x0,_0x5db3b7=[];_0x2621c2<_0x4f64c0[_0x5ed6('0x7b')][_0x5ed6('0x1e')];_0x2621c2++){stats['rows']+=0x1;if(_0x4f64c0['errors'][_0x2621c2]){handleError(_0x4f64c0[_0x5ed6('0x7b')][_0x2621c2],_0x4f64c0[_0x5ed6('0x5b')][_0x2621c2]);}else{var _0x1ad6e3=[];var _0xa1cacc=[];var _0x3e2c6f={};for(var _0x30d4d1 in _0x1566eb){let _0x3333d5=contactItemTypes[_0x5ed6('0x7c')](_0xfee13c=>_0xfee13c[_0x5ed6('0x78')]===_0x30d4d1);let _0x36eb7b=contactItemTypes[_0x5ed6('0x7c')](_0x598c43=>_0x598c43[_0x5ed6('0x78')]+_0x5ed6('0x79')===_0x30d4d1);if(_[_0x5ed6('0x1f')](_0x3333d5)&&_[_0x5ed6('0x1f')](_0x36eb7b)){if(_0x1566eb[_0x5ed6('0x7d')](_0x30d4d1)){if(_0x4f64c0[_0x5ed6('0x7b')][_0x2621c2][_0x1566eb[_0x30d4d1]]){var _0x5354f8=_[_0x5ed6('0x7e')](_0x4f64c0['data'][_0x2621c2][_0x1566eb[_0x30d4d1]][_0x5ed6('0x7f')](/"/g,'\x27'));switch(_0x30d4d1){case'scheduledat':var _0x58b2f8=moment(_0x5354f8,_0x5ed6('0xd'),!![]);if(_0x58b2f8[_0x5ed6('0x80')]()){_0x5db3b7[_0x5ed6('0x1b')]('\x22'+_0x5354f8+'\x22');}else{_0x1ad6e3[_0x5ed6('0x1b')](_0x5ed6('0x81'));}break;case _0x5ed6('0x31'):var _0x348f4e=parseInt(_0x5354f8);_0x5354f8=_['isNaN'](_0x348f4e)||_0x348f4e<0x0||_0x348f4e>0x4?_0xe91467?0x3:0x2:_0x348f4e;_0x5db3b7[_0x5ed6('0x1b')]('\x22'+_0x5354f8+'\x22');break;case _0x5ed6('0x32'):var _0x3ab42f=parseInt(_0x5354f8);if(_[_0x5ed6('0x82')](_0x3ab42f)&&_[_0x5ed6('0x83')](_0x120ec4,_0x3ab42f)){_0x5db3b7[_0x5ed6('0x1b')]('\x22'+_0x3ab42f+'\x22');}else{_0x1ad6e3[_0x5ed6('0x1b')]('agent\x20not\x20exists');}break;case _0x5ed6('0x84'):if(isEmail(_0x5354f8)){_0x5db3b7['push']('\x22'+_0x5354f8+'\x22');}else{_0x1ad6e3['push'](_0x5ed6('0x85'));}break;case'dateOfBirth':var _0x1412b0=moment(_0x5354f8,_0x5ed6('0x86'),!![]);if(_0x1412b0[_0x5ed6('0x80')]()){_0x5db3b7[_0x5ed6('0x1b')]('\x22'+_0x5354f8+'\x22');}else{_0x1ad6e3[_0x5ed6('0x1b')](_0x5ed6('0x87'));}break;case _0x5ed6('0x6b'):var _0x11223b=shared[_0x5ed6('0x88')];var _0x471479=_0x11223b[_0x5354f8];if(!_[_0x5ed6('0x1f')](_0x471479)){var _0x5b6445=_0x471479[_0x5ed6('0x6c')];_0x5db3b7[_0x5ed6('0x1b')]('\x22'+_0x5354f8+'\x22');_0x5db3b7[_0x5ed6('0x1b')]('\x22'+_0x5b6445+'\x22');}break;default:_0x5db3b7['push']('\x22'+_0x5354f8+'\x22');}}else{switch(_0x30d4d1){case _0x5ed6('0x89'):case _0x5ed6('0x11'):_0x1ad6e3[_0x5ed6('0x1b')](_0x30d4d1+'\x20not\x20specified');break;default:_0x5db3b7[_0x5ed6('0x1b')]('\x22\x22');}}}}else{var _0x4b11dd='';if(!_[_0x5ed6('0x1f')](_0x3333d5)){if(!_0x3e2c6f[_0x5ed6('0x7d')](_0x3333d5['id'])){if(!_[_0x5ed6('0x1f')](_0x4f64c0['data'][_0x2621c2][_0x1566eb[_0x30d4d1]])){var _0x5354f8=_[_0x5ed6('0x7e')](_0x4f64c0[_0x5ed6('0x7b')][_0x2621c2][_0x1566eb[_0x30d4d1]][_0x5ed6('0x7f')](/"/g,'\x27'));var _0x478245=phoneDescriptions[_0x5ed6('0x7c')](_0x56c6e9=>_0x56c6e9[_0x5ed6('0x8a')]===_0x3333d5['id']);if(!_['isNil'](_0x478245)){var _0x423ebf=_[_0x5ed6('0x7e')](_0x4f64c0['data'][_0x2621c2][_0x1566eb[_0x478245[_0x5ed6('0x8b')]]]['replace'](/"/g,'\x27'));if(!_[_0x5ed6('0x1f')](_0x423ebf))_0x5354f8=_0x5354f8+'§'+_0x423ebf;}if(_0x4b11dd=='')_0x4b11dd=_0x5354f8;else _0x4b11dd+='|'+_0x5354f8;}_0xa1cacc['push'](_0x3333d5['id']+':'+_0x4b11dd);_0x3e2c6f[_0x3333d5['id']]=0x1;}}}}if(hasAdditionalPhones){_0x5db3b7[_0x5ed6('0x1b')]('\x22'+_0xa1cacc[_0x5ed6('0x12')](';')+'\x22');}if(_0x1ad6e3[_0x5ed6('0x1e')]){handleError(_0x4f64c0['data'][_0x2621c2],{'code':'SystemRow','message':_0x1ad6e3[_0x5ed6('0x12')]()});}else{fs[_0x5ed6('0x8c')](_0x5e724f,_0x5db3b7[_0x5ed6('0x12')]()+'\x0a');}_0x5db3b7=[];}if(!(stats[_0x5ed6('0x8d')]%0xc8)){socket[_0x5ed6('0x8e')]('contact:import:'+_0x3485ca,stats);stats[_0x5ed6('0x5b')]=[];}}if(stopped){logger[_0x5ed6('0x56')](_0x5ed6('0x8f'));_0x4905a1[_0x5ed6('0x90')]();}}catch(_0x3b1bf1){handleError(_0x4f64c0[_0x5ed6('0x7b')][_0x2621c2],{'code':'SystemError','message':_0x3b1bf1[_0x5ed6('0x59')]});logger[_0x5ed6('0x58')](_0x5ed6('0x91'),_0x3b1bf1['message']);}},'complete':function(){try{var _0x20c00e=[];var _0x12798e=[];var _0x4b8645=_0x5ed6('0x35');if(_0x242174[_0x5ed6('0x92')]&&_0x242174[_0x5ed6('0x92')]['length']){_0x4b8645='cm_contacts_'+_0x3485ca;_0x20c00e[_0x5ed6('0x1b')](_0x5ed6('0x93')+_0x4b8645+_0x5ed6('0x94'));}tmp_campaigns=_0x5ed6('0x95')+_0x3485ca;tmp_voice_queues=_0x5ed6('0x96')+_0x3485ca;_0x12798e[_0x5ed6('0x1b')](_0x5ed6('0x93')+tmp_campaigns+_0x5ed6('0x97'));_0x12798e['push'](_0x5ed6('0x93')+tmp_voice_queues+'(id\x20int,dialTimezone\x20varchar(255),offset\x20int);');BPromise['each'](_0x12798e,handleTZQuery)['then'](function(_0x360a9b){updateTzCampaigns(_0x242174[_0x5ed6('0x2e')])[_0x5ed6('0x1a')](function(_0x1433a4){updateTzVoiceQueues(_0x242174[_0x5ed6('0x2e')])[_0x5ed6('0x1a')](function(_0xec5827){if(hasTZ)_0x3361d9=_0x3361d9[_0x5ed6('0x7f')](_0x5ed6('0x6b'),'dialTimezone,utcOffset');var _0x58e90a=util[_0x5ed6('0xc')](_0x5ed6('0x98'),_0x5e724f,_0x4b8645,_0x3361d9,_0x242174['ListId'],_0x242174['CompanyId']||null,NOW,NOW);if(_[_0x5ed6('0x1f')](_0x1566eb['scheduledat'])){_0x58e90a+=_0x5ed6('0x99');}_0x20c00e[_0x5ed6('0x1b')](_0x58e90a);if(_0x242174[_0x5ed6('0x92')]&&_0x242174['duplicates']['length']){_0x20c00e[_0x5ed6('0x1b')](insertCmContact(_0x242174[_0x5ed6('0x2e')],_0x4b8645,_0x242174[_0x5ed6('0x92')],_0x1566eb));_0x20c00e[_0x5ed6('0x1b')](_0x5ed6('0x9a')+_0x4b8645+';');}BPromise['each'](_0x20c00e,handleQuery)[_0x5ed6('0x1a')](function(_0x4978b6){BPromise[_0x5ed6('0x1c')]([handleAdditionalPhones()])[_0x5ed6('0x1a')](function(){_0x20c00e=[];for(var _0x42b6f4=0x0;_0x42b6f4\x20\x20','existsSync','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','phone\x20is\x20mandatory','firstName\x20is\x20mandatory','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','moment','ioredis','../../../mysqldb','../../../config/logger','import','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','test','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','.dialCheckDuplicateType\x20IN\x20(','join','findAll','AdditionalPhones','then','length','push','all','split','isNil','filter','CmContactHasItem','updated','create','PHONE','cm_contacts.phone','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','cm_contacts.UserId','insert','into','cm_hopper','scheduledat','ListId','priority','fields','cm_contacts','cm_contacts.createdAt\x20=\x20?','cm_contacts.phone\x20NOT\x20IN\x20(?)','\x22always\x22','toString','cm_contacts.ListId','cm_hopper_black','createdAt','cm_contacts.ListId\x20=\x20','.CmListId','.CmListId\x20=\x20?','ListId\x20=\x20?','updatedAt','UserId','\x22onlyIfOpen\x22','ContactId','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','fromQuery','CmHopperId','cm_contact_has_items','cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId','cm_hopper.ListId\x20=\x20?','concat','CompanyId','scheduledAt',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','Received\x20SIGINT','message','exit','code','sequelize','catch','error','campaigns.id','campaigns.dialTimezone','campaigns_has_cm_lists.CmListId=','query','spread','voice_queues.dialTimezone','voice_queues','voice_queues.id\x20=\x20voice_queues_has_cm_lists.VoiceQueueId','timezones','dialTimezone','utcOffset','set','offset','main','stringify','send','start','binding','clone','socket_timestamp','root','server/files/tmp','includes','ContactItemType','name','keys','header','createReadStream','data','rows','errors','find','_description','hasOwnProperty','trim','replace','isValid','isNaN','isNumber','email','dateOfBirth','YYYY-MM-DD','dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)','firstName','\x20not\x20specified','itemTypeId','description','appendFileSync','emit','contact:import:','abort','SystemError'];(function(_0x4571b1,_0x1d7ce0){var _0x27dc91=function(_0x5d53ea){while(--_0x5d53ea){_0x4571b1['push'](_0x4571b1['shift']());}};_0x27dc91(++_0x1d7ce0);}(_0x8ad5,0xda));var _0x58ad=function(_0xae7c2f,_0xf31e04){_0xae7c2f=_0xae7c2f-0x0;var _0x5d7001=_0x8ad5[_0xae7c2f];return _0x5d7001;};'use strict';var fs=require('fs');var path=require(_0x58ad('0x0'));var _=require(_0x58ad('0x1'));var Papa=require(_0x58ad('0x2'));var util=require(_0x58ad('0x3'));var BPromise=require(_0x58ad('0x4'));var moment=require(_0x58ad('0x5'));var squel=require('squel');var Redis=require(_0x58ad('0x6'));var db=require(_0x58ad('0x7'))['db'];var config=require('../../../config/environment');var shared=require('../../../config/environment/shared');var logger=require(_0x58ad('0x8'))(_0x58ad('0x9'));config[_0x58ad('0xa')]=_['defaults'](config[_0x58ad('0xa')],{'host':_0x58ad('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config['redis']));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var orderBy=0x0;var stopped=![];var NOW=moment()[_0x58ad('0xc')](_0x58ad('0xd'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];var tmp_voice_queues;var tmp_campaigns;var tzOffset=0x0;var hasTZ;var NOW=moment()[_0x58ad('0xc')](_0x58ad('0xd'));function isEmail(_0x577a65){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))*$/[_0x58ad('0xe')](_0x577a65);}function selectNotIn(_0xa25161,_0x58a9cc,_0xc0bc1c,_0x337c7a,_0x39a378){return squel[_0x58ad('0xf')]()[_0x58ad('0x10')](_0x58ad('0x11'))[_0x58ad('0x12')](_0x337c7a)['join'](_0x58a9cc,null,_0x58a9cc+_0x58ad('0x13')+_0x337c7a+'.'+_0xc0bc1c)[_0x58ad('0x14')](_0x337c7a+'.'+_0xc0bc1c+_0x58ad('0x15')+_0xa25161+'.'+_0xc0bc1c)[_0x58ad('0x14')](_0x58a9cc+_0x58ad('0x16')+_0x39a378[_0x58ad('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x448887,_0x93734b){promisesAdditionalPhones=[];return db['CmContact'][_0x58ad('0x18')]({'raw':!![],'attributes':['id',_0x58ad('0x19')],'where':{'createdAt':NOW,'AdditionalPhones':{'$ne':null}}})[_0x58ad('0x1a')](function(_0x378f20){if(_0x378f20!==null){var _0x1a8606=[];for(var _0x51a181=0x0;_0x51a181<_0x378f20[_0x58ad('0x1b')];_0x51a181++){var _0x5b2a11=_0x378f20[_0x51a181];_0x1a8606[_0x58ad('0x1c')](insertAdditionalPhones(_0x5b2a11));}}Promise[_0x58ad('0x1d')](_0x1a8606)[_0x58ad('0x1a')](function(){_0x448887({'val':0x1});});});});}function insertAdditionalPhones(_0x2fdd9b){return new Promise(function(_0xf75ff6,_0x12faa7){var _0x534554=_0x2fdd9b[_0x58ad('0x19')];var _0x3fbf7e=_0x534554[_0x58ad('0x1e')](';');var _0x265266=[];orderBy=0x0;for(var _0x3acbac=0x0;_0x3acbac<_0x3fbf7e[_0x58ad('0x1b')];_0x3acbac++){_0x265266[_0x58ad('0x1c')](splitAdditionalPhone(_0x2fdd9b['id'],_0x3fbf7e[_0x3acbac]));}Promise['all'](_0x265266)[_0x58ad('0x1a')](function(){_0xf75ff6({'val':_0x3fbf7e[_0x58ad('0x1b')]});});});}function splitAdditionalPhone(_0x4a8948,_0x415dbf){return new Promise(function(_0x4af672,_0x10d936){var _0x10aa46=_0x415dbf[_0x58ad('0x1e')](':');var _0x21dc0d=_0x10aa46[0x0];var _0x322686=_0x10aa46[0x1];if(!_[_0x58ad('0x1f')](_0x322686)){var _0x4edec7=_0x322686['split']('|');var _0x286240=[];for(var _0x500263=0x0;_0x500263<_0x4edec7[_0x58ad('0x1b')];_0x500263++){if(_0x4edec7[_0x500263]!==''){var _0x39efd9=_[_0x58ad('0x20')](promisesAdditionalPhones,{'contactId':_0x4a8948,'phone':_0x4edec7[_0x500263]});if(_0x39efd9['length']==0x0){orderBy++;promisesAdditionalPhones[_0x58ad('0x1c')]({'contactId':_0x4a8948,'contactTypeId':_0x21dc0d,'phone':_0x4edec7[_0x500263],'orderBy':orderBy});}}}_0x4af672({'ok':0x1});}else _0x4af672({'res':0x0});});}function createAdditionalPhone(_0x5d6146,_0x10a80b,_0x3073a1,_0x290d98){var _0x12ff5c='';var _0x44b195='';var _0x10ed2c=_0x3073a1['split']('§');_0x12ff5c=_0x10ed2c[0x0];if(_0x10ed2c[_0x58ad('0x1b')]==0x2)_0x44b195=_0x10ed2c[0x1];return new Promise(function(_0x330c6b,_0x5c5d6f){return db['CmContactHasItem']['findOne']({'where':{'CmContactId':_0x5d6146,'item':_0x12ff5c}})[_0x58ad('0x1a')](function(_0x2ab8ff){if(_0x2ab8ff){return db[_0x58ad('0x21')]['update']({'ItemTypeId':_0x10a80b,'description':_0x44b195,'OrderBy':_0x290d98},{'where':{'CmContactId':_0x5d6146,'item':_0x12ff5c}})['then'](function(_0x42dead){_0x330c6b({'res':_0x58ad('0x22')});});}else{return db[_0x58ad('0x21')][_0x58ad('0x23')]({'CmContactId':_0x5d6146,'item':_0x12ff5c,'description':_0x44b195,'ItemTypeId':_0x10a80b,'OrderBy':_0x290d98,'ItemClass':_0x58ad('0x24')})['then'](function(_0xafc429){_0x330c6b({'res':'inserted'});});}});});}function insertCmHopper(_0x5801cf,_0x25c96c,_0x15340c,_0x58902a,_0x3d9496){var _0x29a595=[_0x58ad('0x25'),_0x58ad('0x26'),_0x58ad('0x27'),'cm_contacts.ListId',_0x25c96c+'.'+_0x58902a,_0x58ad('0x28'),_0x58ad('0x29'),_0x58ad('0x2a'),_0x58ad('0x2b'),'\x22'+_0x3d9496+'\x22'];return squel[_0x58ad('0x2c')]()[_0x58ad('0x2d')](_0x58ad('0x2e'))['fromQuery']([_0x58ad('0x11'),_0x58ad('0x2f'),'ContactId',_0x58ad('0x30'),_0x58902a,'createdAt','updatedAt',_0x58ad('0x31'),'UserId','recallme'],squel[_0x58ad('0xf')]()[_0x58ad('0x32')](_0x29a595)['from'](_0x25c96c)[_0x58ad('0x17')](_0x58ad('0x33'),null,'cm_contacts.ListId\x20=\x20'+_0x25c96c+'.CmListId')[_0x58ad('0x17')](_0x15340c,null,_0x15340c+'.id\x20=\x20'+_0x25c96c+'.'+_0x58902a)[_0x58ad('0x14')](_0x25c96c+'.CmListId\x20=\x20?',_0x5801cf)[_0x58ad('0x14')](_0x58ad('0x34'),NOW)[_0x58ad('0x14')](_0x58ad('0x35'),selectNotIn(_0x25c96c,_0x15340c,_0x58902a,_0x58ad('0x2e'),[_0x58ad('0x36'),'\x22onlyIfOpen\x22']))[_0x58ad('0x14')](_0x58ad('0x35'),selectNotIn(_0x25c96c,_0x15340c,_0x58902a,_0x58ad('0x2e'),[_0x58ad('0x36')])))[_0x58ad('0x37')]();}function insertCmHopperBlack(_0x58e9cb,_0x547c47,_0xfeaf4,_0x3b39d5){var _0x40bbe5=['cm_contacts.phone',_0x58ad('0x27'),_0x58ad('0x38'),_0x547c47+'.'+_0x3b39d5,_0x58ad('0x28'),_0x58ad('0x29')];return squel['insert']()[_0x58ad('0x2d')](_0x58ad('0x39'))['fromQuery']([_0x58ad('0x11'),'ContactId',_0x58ad('0x30'),_0x3b39d5,_0x58ad('0x3a'),'updatedAt'],squel[_0x58ad('0xf')]()[_0x58ad('0x32')](_0x40bbe5)['from'](_0x547c47)['join'](_0x58ad('0x33'),null,_0x58ad('0x3b')+_0x547c47+_0x58ad('0x3c'))[_0x58ad('0x17')](_0xfeaf4,null,_0xfeaf4+_0x58ad('0x13')+_0x547c47+'.'+_0x3b39d5)[_0x58ad('0x14')](_0x547c47+_0x58ad('0x3d'),_0x58e9cb)[_0x58ad('0x14')](_0x58ad('0x34'),NOW)[_0x58ad('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',squel['select']()[_0x58ad('0x10')](_0x58ad('0x11'))[_0x58ad('0x12')](_0x58ad('0x39'))[_0x58ad('0x14')](_0x58ad('0x3e'),_0x58e9cb)[_0x58ad('0x14')](_0x3b39d5+'\x20=\x20'+_0x547c47+'.'+_0x3b39d5)))['toString']();}function insertTzCmHopper(_0x58fa4b,_0x130561,_0x3e692b,_0x2aeead,_0x51adb9,_0x4dba76){var _0x1eb050=[_0x58ad('0x25'),'date_add(cm_contacts.scheduledat,interval\x20'+_0x4dba76+'.offset-cm_contacts.utcOffset\x20minute)',_0x58ad('0x27'),_0x58ad('0x38'),_0x130561+'.'+_0x2aeead,'cm_contacts.createdAt',_0x58ad('0x29'),'cm_contacts.priority','cm_contacts.UserId','\x22'+_0x51adb9+'\x22'];var _0x4e8c8a=squel[_0x58ad('0x2c')]()[_0x58ad('0x2d')](_0x58ad('0x2e'))['fromQuery']([_0x58ad('0x11'),_0x58ad('0x2f'),'ContactId',_0x58ad('0x30'),_0x2aeead,_0x58ad('0x3a'),_0x58ad('0x3f'),_0x58ad('0x31'),_0x58ad('0x40'),'recallme'],squel['select']()[_0x58ad('0x32')](_0x1eb050)[_0x58ad('0x12')](_0x130561)[_0x58ad('0x17')](_0x58ad('0x33'),null,_0x58ad('0x3b')+_0x130561+_0x58ad('0x3c'))['join'](_0x3e692b,null,_0x3e692b+'.id\x20=\x20'+_0x130561+'.'+_0x2aeead)['join'](_0x4dba76,null,_0x4dba76+_0x58ad('0x13')+_0x130561+'.'+_0x2aeead)[_0x58ad('0x14')](_0x130561+_0x58ad('0x3d'),_0x58fa4b)[_0x58ad('0x14')](_0x58ad('0x34'),NOW)[_0x58ad('0x14')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x130561,_0x3e692b,_0x2aeead,_0x58ad('0x2e'),[_0x58ad('0x36'),_0x58ad('0x41')]))[_0x58ad('0x14')](_0x58ad('0x35'),selectNotIn(_0x130561,_0x3e692b,_0x2aeead,'cm_hopper',[_0x58ad('0x36')])))[_0x58ad('0x37')]();return _0x4e8c8a;}function insertTzCmHopperBlack(_0x44e073,_0x515d23,_0x365ae9,_0x3c8d8e){var _0x38bb71=[_0x58ad('0x25'),_0x58ad('0x27'),_0x58ad('0x38'),_0x515d23+'.'+_0x3c8d8e,'cm_contacts.createdAt',_0x58ad('0x29')];return squel['insert']()[_0x58ad('0x2d')]('cm_hopper_black')['fromQuery']([_0x58ad('0x11'),_0x58ad('0x42'),'ListId',_0x3c8d8e,_0x58ad('0x3a'),_0x58ad('0x3f')],squel[_0x58ad('0xf')]()[_0x58ad('0x32')](_0x38bb71)['from'](_0x515d23)[_0x58ad('0x17')](_0x58ad('0x33'),null,_0x58ad('0x3b')+_0x515d23+_0x58ad('0x3c'))[_0x58ad('0x17')](_0x365ae9,null,_0x365ae9+'.id\x20=\x20'+_0x515d23+'.'+_0x3c8d8e)[_0x58ad('0x14')](_0x515d23+_0x58ad('0x3d'),_0x44e073)[_0x58ad('0x14')](_0x58ad('0x34'),NOW)[_0x58ad('0x14')](_0x58ad('0x35'),squel[_0x58ad('0xf')]()['field'](_0x58ad('0x11'))[_0x58ad('0x12')](_0x58ad('0x39'))['where']('ListId\x20=\x20?',_0x44e073)['where'](_0x3c8d8e+_0x58ad('0x15')+_0x515d23+'.'+_0x3c8d8e)))[_0x58ad('0x37')]();}function insertCmHopperAdditionalPhones(_0x5de9bc){var _0x43e933=[_0x58ad('0x43'),_0x58ad('0x44'),_0x58ad('0x45'),_0x58ad('0x46'),'cm_contact_has_items.updatedAt'];return squel[_0x58ad('0x2c')]()['into'](_0x58ad('0x47'))[_0x58ad('0x48')]([_0x58ad('0x49'),'phone','OrderBy',_0x58ad('0x3a'),_0x58ad('0x3f')],squel[_0x58ad('0xf')]()[_0x58ad('0x32')](_0x43e933)['from'](_0x58ad('0x2e'))['join'](_0x58ad('0x33'),null,'cm_contacts.id\x20=\x20cm_hopper.ContactId')[_0x58ad('0x17')](_0x58ad('0x4a'),null,_0x58ad('0x4b'))[_0x58ad('0x14')](_0x58ad('0x4c'),_0x5de9bc)['where']('cm_contacts.createdAt\x20=\x20?',NOW))[_0x58ad('0x37')]();}function insertCmContact(_0x498e16,_0x31d1c0,_0x4e741a,_0x1938cc){var _0x61152c=_[_0x58ad('0x4d')](_['keys'](_0x1938cc),['ListId',_0x58ad('0x4e'),_0x58ad('0x3a'),_0x58ad('0x3f'),_0x58ad('0x4f')]);return squel['insert']()[_0x58ad('0x2d')](_0x58ad('0x33'))['fromQuery'](_0x61152c,squel['select']()[_0x58ad('0x32')](_0x61152c)['from'](_0x31d1c0)[_0x58ad('0x14')]('('+_0x4e741a[_0x58ad('0x17')](',')+_0x58ad('0x50'),squel[_0x58ad('0xf')]()[_0x58ad('0x32')](_0x4e741a)[_0x58ad('0x12')](_0x58ad('0x33'))[_0x58ad('0x14')](_0x58ad('0x3e'),_0x498e16)['where']('deletedAt\x20IS\x20NULL'))[_0x58ad('0x14')]('id\x20IN\x20?',squel['select']()[_0x58ad('0x10')](_0x58ad('0x51'),_0x58ad('0x52'))[_0x58ad('0x12')](_0x31d1c0)[_0x58ad('0x53')](_0x4e741a[_0x58ad('0x17')](','))))['toString']();}function handleStop(){logger[_0x58ad('0x54')](_0x58ad('0x55'));stopped=!![];}function handleUncaughtException(_0x139ae8){logger['error'](_0x139ae8[_0x58ad('0x56')]);process[_0x58ad('0x57')](0x1);}function handleError(_0x199ee1,_0x2ac61a){stats['errors'][_0x58ad('0x1c')]({'name':_0x2ac61a[_0x58ad('0x58')],'message':_0x2ac61a[_0x58ad('0x56')],'row':_0x199ee1});}function handleQuery(_0x1c356c){logger[_0x58ad('0x54')](_0x1c356c);return db[_0x58ad('0x59')]['query'](_0x1c356c)['spread'](function(_0x1d893b){results['push'](_0x1d893b);})[_0x58ad('0x5a')](function(_0x3d3d5f){logger[_0x58ad('0x5b')](_0x3d3d5f['message']);});}function updateTzCampaigns(_0x17264d){return new Promise(function(_0x3a181c,_0x585cd0){var _0x398d2c=squel[_0x58ad('0xf')]()['fields']([_0x58ad('0x5c'),_0x58ad('0x5d')])[_0x58ad('0x12')]('campaigns')[_0x58ad('0x17')]('campaigns_has_cm_lists',null,'campaigns.id\x20=\x20campaigns_has_cm_lists.CampaignId')[_0x58ad('0x14')](_0x58ad('0x5e')+_0x17264d);db['sequelize'][_0x58ad('0x5f')](_0x398d2c['toString']())[_0x58ad('0x60')](function(_0x1a3533){var _0x1d86cb=[];for(var _0x291342=0x0;_0x291342<_0x1a3533[_0x58ad('0x1b')];_0x291342++){_0x1d86cb[_0x58ad('0x1c')](getTimezoneData(_0x1a3533[_0x291342],tmp_campaigns));}BPromise['all'](_0x1d86cb)['then'](function(){_0x3a181c({'val':0x1});});})[_0x58ad('0x5a')](function(_0x472f69){logger[_0x58ad('0x5b')](_0x472f69[_0x58ad('0x56')]);_0x3a181c({'val':0x0});});});}function updateTzVoiceQueues(_0x14ce30){return new Promise(function(_0x507299,_0x2d8c8a){var _0x24e8b0=squel['select']()['fields'](['voice_queues.id',_0x58ad('0x61')])[_0x58ad('0x12')](_0x58ad('0x62'))[_0x58ad('0x17')]('voice_queues_has_cm_lists',null,_0x58ad('0x63'))[_0x58ad('0x14')]('voice_queues_has_cm_lists.CmListId='+_0x14ce30);db[_0x58ad('0x59')][_0x58ad('0x5f')](_0x24e8b0[_0x58ad('0x37')]())['spread'](function(_0x275cc3){var _0x2336c1=[];for(var _0x2e300d=0x0;_0x2e300d<_0x275cc3[_0x58ad('0x1b')];_0x2e300d++){_0x2336c1[_0x58ad('0x1c')](getTimezoneData(_0x275cc3[_0x2e300d],tmp_voice_queues));}BPromise[_0x58ad('0x1d')](_0x2336c1)['then'](function(){_0x507299({'val':0x1});});})[_0x58ad('0x5a')](function(_0x572719){logger[_0x58ad('0x5b')](_0x572719[_0x58ad('0x56')]);_0x507299({'val':0x0});});});}function getTimezoneData(_0x4f86b2,_0x353e1e){return new Promise(function(_0x1c1b6a,_0x59752f){var _0x1622f6=shared[_0x58ad('0x64')];var _0x554983=_0x1622f6[_0x4f86b2[_0x58ad('0x65')]];if(_[_0x58ad('0x1f')](_0x554983)){_0x1c1b6a({'ret':0x1});}else{var _0x242422=_0x554983[_0x58ad('0x66')];var _0x341155=squel[_0x58ad('0x2c')]()[_0x58ad('0x2d')](_0x353e1e)[_0x58ad('0x67')]('id',_0x4f86b2['id'])[_0x58ad('0x67')](_0x58ad('0x68'),_0x242422)['set'](_0x58ad('0x65'),_0x4f86b2[_0x58ad('0x65')])[_0x58ad('0x37')]();return db['sequelize']['query'](_0x341155)['spread'](function(_0x5ebceb){_0x1c1b6a({'ret':0x1});})['catch'](function(_0x5cb787){logger[_0x58ad('0x5b')](_0x5cb787['message']);_0x59752f({'ret':0x1});});}});}function handleTZQuery(_0x22d8fd){logger[_0x58ad('0x54')](_0x22d8fd);return db[_0x58ad('0x59')][_0x58ad('0x5f')](_0x22d8fd)[_0x58ad('0x60')](function(_0x1c0528){})['catch'](function(_0x24900b){logger[_0x58ad('0x5b')](_0x24900b[_0x58ad('0x56')]);});}function main(_0x549fb4,_0x4624b9,_0x43a3f5,_0x1cc48d){logger[_0x58ad('0x54')](_0x58ad('0x69'),_0x549fb4,JSON[_0x58ad('0x6a')](_0x4624b9));process[_0x58ad('0x6b')](_0x58ad('0x6c'));var _0x11389a=_0x4624b9[_0x58ad('0x6d')];var _0x8abdb8=_[_0x58ad('0x6e')](_0x11389a);var _0x4577e3=_0x4624b9[_0x58ad('0x6f')];var _0x48ba5d=path[_0x58ad('0x17')](config[_0x58ad('0x70')],_0x58ad('0x71'),_0x4577e3+'.csv');hasTZ=_['keys'](_0x11389a)[_0x58ad('0x72')](_0x58ad('0x65'));var _0x19831b=_['keys'](_0x11389a)['join']();logger[_0x58ad('0x54')]('header',_0x19831b);db[_0x58ad('0x73')]['findAll']({'raw':!![],'attributes':['id',_0x58ad('0x74')]})[_0x58ad('0x1a')](function(_0x135094){for(var _0x2c012d=0x0;_0x2c012d<_0x135094[_0x58ad('0x1b')];_0x2c012d++){if(_0x135094[_0x2c012d][_0x58ad('0x74')]in _0x11389a){contactItemTypes['push'](_0x135094[_0x2c012d]);delete _0x8abdb8[_0x135094[_0x2c012d][_0x58ad('0x74')]];hasAdditionalPhones=!![];}for(var _0x509271 in _0x11389a){if(_0x135094[_0x2c012d][_0x58ad('0x74')]+'_description'===_0x509271){phoneDescriptions[_0x58ad('0x1c')]({'itemTypeId':_0x135094[_0x2c012d]['id'],'description':_0x509271});delete _0x8abdb8[_0x509271];}}}if(hasAdditionalPhones)_0x8abdb8['AdditionalPhones']='';var _0x1f3f4b=_[_0x58ad('0x75')](_0x8abdb8)[_0x58ad('0x17')]();logger[_0x58ad('0x54')](_0x58ad('0x76'),_0x1f3f4b);fs['writeFileSync'](_0x48ba5d,_0x1f3f4b+'\x0a');Papa['parse'](fs[_0x58ad('0x77')](_0x549fb4),{'header':!![],'skipEmptyLines':!![],'step':function(_0x507869,_0x252b15){try{for(var _0x447665=0x0,_0xa3f24=[];_0x447665<_0x507869[_0x58ad('0x78')][_0x58ad('0x1b')];_0x447665++){stats[_0x58ad('0x79')]+=0x1;if(_0x507869['errors'][_0x447665]){handleError(_0x507869[_0x58ad('0x78')][_0x447665],_0x507869[_0x58ad('0x7a')][_0x447665]);}else{var _0xbdca75=[];var _0x1e192d=[];var _0x54300f={};for(var _0x317503 in _0x11389a){let _0x28c6de=contactItemTypes[_0x58ad('0x7b')](_0x54cef4=>_0x54cef4[_0x58ad('0x74')]===_0x317503);let _0x43260a=contactItemTypes[_0x58ad('0x7b')](_0x5b59d3=>_0x5b59d3['name']+_0x58ad('0x7c')===_0x317503);if(_[_0x58ad('0x1f')](_0x28c6de)&&_[_0x58ad('0x1f')](_0x43260a)){if(_0x11389a[_0x58ad('0x7d')](_0x317503)){if(_0x507869[_0x58ad('0x78')][_0x447665][_0x11389a[_0x317503]]){var _0x22c70d=_[_0x58ad('0x7e')](_0x507869[_0x58ad('0x78')][_0x447665][_0x11389a[_0x317503]][_0x58ad('0x7f')](/"/g,'\x27'));switch(_0x317503){case _0x58ad('0x2f'):var _0x185fbd=moment(_0x22c70d,_0x58ad('0xd'),!![]);if(_0x185fbd[_0x58ad('0x80')]()){_0xa3f24[_0x58ad('0x1c')]('\x22'+_0x22c70d+'\x22');}else{_0xbdca75[_0x58ad('0x1c')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x58ad('0x31'):var _0x459304=parseInt(_0x22c70d);_0x22c70d=_[_0x58ad('0x81')](_0x459304)||_0x459304<0x0||_0x459304>0x4?_0x1cc48d?0x3:0x2:_0x459304;_0xa3f24['push']('\x22'+_0x22c70d+'\x22');break;case _0x58ad('0x40'):var _0x4dc4f5=parseInt(_0x22c70d);if(_[_0x58ad('0x82')](_0x4dc4f5)&&_['includes'](_0x43a3f5,_0x4dc4f5)){_0xa3f24[_0x58ad('0x1c')]('\x22'+_0x4dc4f5+'\x22');}else{_0xbdca75[_0x58ad('0x1c')]('agent\x20not\x20exists');}break;case _0x58ad('0x83'):if(isEmail(_0x22c70d)){_0xa3f24[_0x58ad('0x1c')]('\x22'+_0x22c70d+'\x22');}else{_0xbdca75[_0x58ad('0x1c')]('email\x20wrong\x20format');}break;case _0x58ad('0x84'):var _0x1ae713=moment(_0x22c70d,_0x58ad('0x85'),!![]);if(_0x1ae713[_0x58ad('0x80')]()){_0xa3f24[_0x58ad('0x1c')]('\x22'+_0x22c70d+'\x22');}else{_0xbdca75['push'](_0x58ad('0x86'));}break;case _0x58ad('0x65'):var _0x4ff8d2=shared[_0x58ad('0x64')];var _0x436a9b=_0x4ff8d2[_0x22c70d];if(!_['isNil'](_0x436a9b)){var _0x510433=_0x436a9b[_0x58ad('0x66')];_0xa3f24[_0x58ad('0x1c')]('\x22'+_0x22c70d+'\x22');_0xa3f24[_0x58ad('0x1c')]('\x22'+_0x510433+'\x22');}break;default:_0xa3f24['push']('\x22'+_0x22c70d+'\x22');}}else{switch(_0x317503){case _0x58ad('0x87'):case'phone':_0xbdca75[_0x58ad('0x1c')](_0x317503+_0x58ad('0x88'));break;default:_0xa3f24['push']('\x22\x22');}}}}else{var _0x12f232='';if(!_[_0x58ad('0x1f')](_0x28c6de)){if(!_0x54300f[_0x58ad('0x7d')](_0x28c6de['id'])){if(!_['isNil'](_0x507869[_0x58ad('0x78')][_0x447665][_0x11389a[_0x317503]])){var _0x22c70d=_[_0x58ad('0x7e')](_0x507869['data'][_0x447665][_0x11389a[_0x317503]]['replace'](/"/g,'\x27'));var _0x371920=phoneDescriptions['find'](_0x40f93c=>_0x40f93c[_0x58ad('0x89')]===_0x28c6de['id']);if(!_[_0x58ad('0x1f')](_0x371920)){var _0x12d8c3=_[_0x58ad('0x7e')](_0x507869[_0x58ad('0x78')][_0x447665][_0x11389a[_0x371920[_0x58ad('0x8a')]]][_0x58ad('0x7f')](/"/g,'\x27'));if(!_[_0x58ad('0x1f')](_0x12d8c3))_0x22c70d=_0x22c70d+'§'+_0x12d8c3;}if(_0x12f232=='')_0x12f232=_0x22c70d;else _0x12f232+='|'+_0x22c70d;}_0x1e192d['push'](_0x28c6de['id']+':'+_0x12f232);_0x54300f[_0x28c6de['id']]=0x1;}}}}if(hasAdditionalPhones){_0xa3f24[_0x58ad('0x1c')]('\x22'+_0x1e192d['join'](';')+'\x22');}if(_0xbdca75[_0x58ad('0x1b')]){handleError(_0x507869['data'][_0x447665],{'code':'SystemRow','message':_0xbdca75[_0x58ad('0x17')]()});}else{fs[_0x58ad('0x8b')](_0x48ba5d,_0xa3f24[_0x58ad('0x17')]()+'\x0a');}_0xa3f24=[];}if(!(stats[_0x58ad('0x79')]%0xc8)){socket[_0x58ad('0x8c')](_0x58ad('0x8d')+_0x4577e3,stats);stats['errors']=[];}}if(stopped){logger[_0x58ad('0x54')]('Abort\x20parser');_0x252b15[_0x58ad('0x8e')]();}}catch(_0x33077b){handleError(_0x507869[_0x58ad('0x78')][_0x447665],{'code':_0x58ad('0x8f'),'message':_0x33077b[_0x58ad('0x56')]});logger[_0x58ad('0x5b')](_0x58ad('0x90'),_0x33077b[_0x58ad('0x56')]);}},'complete':function(){try{var _0x51d6bb=[];var _0x4be613=[];var _0x504a76=_0x58ad('0x33');if(_0x4624b9['duplicates']&&_0x4624b9[_0x58ad('0x91')][_0x58ad('0x1b')]){_0x504a76=_0x58ad('0x92')+_0x4577e3;_0x51d6bb[_0x58ad('0x1c')](_0x58ad('0x93')+_0x504a76+_0x58ad('0x94'));}tmp_campaigns=_0x58ad('0x95')+_0x4577e3;tmp_voice_queues='voice_queues_'+_0x4577e3;_0x4be613[_0x58ad('0x1c')](_0x58ad('0x93')+tmp_campaigns+_0x58ad('0x96'));_0x4be613[_0x58ad('0x1c')](_0x58ad('0x93')+tmp_voice_queues+_0x58ad('0x96'));BPromise[_0x58ad('0x97')](_0x4be613,handleTZQuery)['then'](function(_0x3d9d29){updateTzCampaigns(_0x4624b9['ListId'])[_0x58ad('0x1a')](function(_0x548b9d){updateTzVoiceQueues(_0x4624b9[_0x58ad('0x30')])['then'](function(_0x4e2004){if(hasTZ)_0x1f3f4b=_0x1f3f4b[_0x58ad('0x7f')]('dialTimezone',_0x58ad('0x98'));var _0x2357dd=util[_0x58ad('0xc')](_0x58ad('0x99'),_0x48ba5d,_0x504a76,_0x1f3f4b,_0x4624b9[_0x58ad('0x30')],_0x4624b9[_0x58ad('0x4e')]||null,NOW,NOW);if(_[_0x58ad('0x1f')](_0x11389a[_0x58ad('0x2f')])){_0x2357dd+=_0x58ad('0x9a');}_0x51d6bb[_0x58ad('0x1c')](_0x2357dd);if(_0x4624b9['duplicates']&&_0x4624b9[_0x58ad('0x91')][_0x58ad('0x1b')]){_0x51d6bb['push'](insertCmContact(_0x4624b9[_0x58ad('0x30')],_0x504a76,_0x4624b9[_0x58ad('0x91')],_0x11389a));_0x51d6bb[_0x58ad('0x1c')](_0x58ad('0x9b')+_0x504a76+';');}BPromise[_0x58ad('0x97')](_0x51d6bb,handleQuery)[_0x58ad('0x1a')](function(_0xb56191){BPromise[_0x58ad('0x1d')]([handleAdditionalPhones()])['then'](function(){_0x51d6bb=[];for(var _0x19f4a0=0x0;_0x19f4a0\x20\x20','existsSync','file\x20doesn\x27t\x20exists','binding','body\x20id\x20mandatory','map','No\x20agent\x20available','uncaughtException','lodash','util','bluebird','moment','squel','ioredis','../../../mysqldb','../../../config/environment','import','redis','defaults','socket.io-emitter','format'];(function(_0x2fd02e,_0x8ebcc5){var _0x4d7f54=function(_0x1437c0){while(--_0x1437c0){_0x2fd02e['push'](_0x2fd02e['shift']());}};_0x4d7f54(++_0x8ebcc5);}(_0xffc0,0x1a0));var _0x0ffc=function(_0x48873f,_0x29c1d7){_0x48873f=_0x48873f-0x0;var _0x154ad4=_0xffc0[_0x48873f];return _0x154ad4;};'use strict';var fs=require('fs');var path=require('path');var _=require(_0x0ffc('0x0'));var Papa=require('papaparse');var util=require(_0x0ffc('0x1'));var BPromise=require(_0x0ffc('0x2'));var moment=require(_0x0ffc('0x3'));var squel=require(_0x0ffc('0x4'));var Redis=require(_0x0ffc('0x5'));var db=require(_0x0ffc('0x6'))['db'];var config=require(_0x0ffc('0x7'));var logger=require('../../../config/logger')(_0x0ffc('0x8'));config[_0x0ffc('0x9')]=_[_0x0ffc('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var socket=require(_0x0ffc('0xb'))(new Redis(config[_0x0ffc('0x9')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0x0ffc('0xc')](_0x0ffc('0xd'));var tempTableName='cm_contacts_temp_'+moment()[_0x0ffc('0xc')](_0x0ffc('0xe'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x234549){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))*$/[_0x0ffc('0xf')](_0x234549);}function selectNotIn(_0x20bfe1,_0x1ca057,_0x252444,_0x3547c0,_0x481a0f){return squel[_0x0ffc('0x10')]()[_0x0ffc('0x11')]('phone')[_0x0ffc('0x12')](_0x3547c0)[_0x0ffc('0x13')](_0x1ca057,null,_0x1ca057+_0x0ffc('0x14')+_0x3547c0+'.'+_0x252444)['where'](_0x3547c0+'.'+_0x252444+_0x0ffc('0x15')+_0x20bfe1+'.'+_0x252444)[_0x0ffc('0x16')](_0x1ca057+'.dialCheckDuplicateType\x20IN\x20('+_0x481a0f[_0x0ffc('0x13')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x137908,_0x1e32b4){promisesAdditionalPhones=[];promisesContact=[];return db[_0x0ffc('0x17')][_0x0ffc('0x18')]('select\x20*\x20from\x20'+tempTableName)[_0x0ffc('0x19')](function(_0x565921){if(_0x565921!==null){var _0x7f401=[];for(var _0xc2bb7e=0x0;_0xc2bb7e<_0x565921['length'];_0xc2bb7e++){var _0x4803b4=_0x565921[_0xc2bb7e];if(!_['isNil'](_0x4803b4['phone'])){if(!_['isNil'](_0x4803b4['AdditionalPhones']))_0x7f401[_0x0ffc('0x1a')](insertAdditionalPhones(_0x4803b4));promisesContact[_0x0ffc('0x1a')]({'contact':_0x4803b4});}}}Promise[_0x0ffc('0x1b')](_0x7f401)[_0x0ffc('0x1c')](function(){_0x137908({'val':0x1});});})[_0x0ffc('0x1d')](function(_0x480931){logger['error'](_0x480931[_0x0ffc('0x1e')]);});});}function insertAdditionalPhones(_0x5e5256){return new Promise(function(_0x49e690,_0x60ac9d){var _0x126f09=_0x5e5256['AdditionalPhones'];if(_[_0x0ffc('0x1f')](_0x126f09))_0x60ac9d({'val':0x0});else{var _0x18bc34=_0x126f09[_0x0ffc('0x20')](';');var _0x527fd4=[];orderBy=0x0;for(var _0x4ffd80=0x0;_0x4ffd80<_0x18bc34[_0x0ffc('0x21')];_0x4ffd80++){_0x527fd4[_0x0ffc('0x1a')](splitAdditionalPhone(_0x5e5256['id'],_0x18bc34[_0x4ffd80]));}Promise[_0x0ffc('0x1b')](_0x527fd4)[_0x0ffc('0x1c')](function(){_0x49e690({'val':_0x18bc34[_0x0ffc('0x21')]});});}});}function splitAdditionalPhone(_0x4d4294,_0x501c0c){return new Promise(function(_0x3e1180,_0x529415){var _0x154ffe=_0x501c0c['split'](':');var _0x25e3c0=_0x154ffe[0x0];var _0x136b0a=_0x154ffe[0x1];if(_0x136b0a!==''){var _0x23b14e=_0x136b0a[_0x0ffc('0x20')]('|');var _0x3968cc=[];for(var _0x34bce1=0x0;_0x34bce1<_0x23b14e[_0x0ffc('0x21')];_0x34bce1++){if(_0x23b14e[_0x34bce1]!==''){var _0x4a2794=_['filter'](promisesAdditionalPhones,{'contactId':_0x4d4294,'phone':_0x23b14e[_0x34bce1]});if(_0x4a2794[_0x0ffc('0x21')]==0x0){orderBy++;promisesAdditionalPhones[_0x0ffc('0x1a')]({'contactId':_0x4d4294,'contactTypeId':_0x25e3c0,'phone':_0x23b14e[_0x34bce1],'orderBy':orderBy});}}}_0x3e1180({'ok':0x1});}else _0x3e1180({'res':0x0});});}function createAdditionalPhone(_0x59afc9,_0x5bb1d5,_0x40166f,_0x5f3a01){var _0x13c425='';var _0x5d3cff='';var _0x4ece4f=_0x40166f[_0x0ffc('0x20')]('§');_0x13c425=_0x4ece4f[0x0];if(_0x4ece4f['length']==0x2)_0x5d3cff=_0x4ece4f[0x1];return new Promise(function(_0x467905,_0x18dc67){return db[_0x0ffc('0x22')]['findOne']({'where':{'CmContactId':_0x59afc9,'item':_0x13c425}})[_0x0ffc('0x1c')](function(_0x2c87d0){if(_0x2c87d0){return db[_0x0ffc('0x22')][_0x0ffc('0x23')]({'ItemTypeId':_0x5bb1d5,'description':_0x5d3cff,'OrderBy':_0x5f3a01},{'where':{'CmContactId':_0x59afc9,'item':_0x13c425}})['then'](function(_0x170390){_0x467905({'res':_0x0ffc('0x24')});});}else{return db[_0x0ffc('0x22')]['create']({'CmContactId':_0x59afc9,'item':_0x13c425,'ItemTypeId':_0x5bb1d5,'description':_0x5d3cff,'OrderBy':_0x5f3a01,'ItemClass':_0x0ffc('0x25')})['then'](function(_0x321fa9){_0x467905({'res':'inserted'});});}});});}function updateContact(_0x214faf){return new Promise(function(_0x103bb3,_0x48fdca){var _0x473d6c=_0x214faf['id'];delete _0x214faf['id'];return db[_0x0ffc('0x26')][_0x0ffc('0x23')](_0x214faf,{'where':{'id':_0x473d6c}})[_0x0ffc('0x1c')](function(_0x581c42){updatedRows+=0x1;return db[_0x0ffc('0x27')][_0x0ffc('0x23')]({'phone':_0x214faf[_0x0ffc('0x28')]},{'where':{'ContactId':_0x473d6c}})[_0x0ffc('0x1c')](function(_0x1edd2c){_0x103bb3({'ret':'OK'});});});});}function insertCmHopper(_0x6f3091,_0x1ba0b6,_0x597d9a,_0x482372,_0x3e3c5f){var _0x329a64=[_0x0ffc('0x29'),'cm_contacts.scheduledat',_0x0ffc('0x2a'),_0x0ffc('0x2b'),_0x1ba0b6+'.'+_0x482372,_0x0ffc('0x2c'),_0x0ffc('0x2d'),'cm_contacts.priority',_0x0ffc('0x2e'),'\x22'+_0x3e3c5f+'\x22'];return squel[_0x0ffc('0x2f')]()[_0x0ffc('0x30')](_0x0ffc('0x31'))[_0x0ffc('0x32')]([_0x0ffc('0x28'),_0x0ffc('0x33'),_0x0ffc('0x34'),_0x0ffc('0x35'),_0x482372,'createdAt',_0x0ffc('0x36'),_0x0ffc('0x37'),_0x0ffc('0x38'),_0x0ffc('0x39')],squel['select']()[_0x0ffc('0x3a')](_0x329a64)[_0x0ffc('0x12')](_0x1ba0b6)[_0x0ffc('0x13')](_0x0ffc('0x3b'),null,_0x0ffc('0x3c')+_0x1ba0b6+_0x0ffc('0x3d'))[_0x0ffc('0x13')](_0x597d9a,null,_0x597d9a+_0x0ffc('0x14')+_0x1ba0b6+'.'+_0x482372)[_0x0ffc('0x16')](_0x1ba0b6+'.CmListId\x20=\x20?',_0x6f3091)[_0x0ffc('0x16')](_0x0ffc('0x3e'),NOW)[_0x0ffc('0x16')](_0x0ffc('0x3f'),selectNotIn(_0x1ba0b6,_0x597d9a,_0x482372,'cm_hopper',['\x22always\x22','\x22onlyIfOpen\x22']))[_0x0ffc('0x16')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x1ba0b6,_0x597d9a,_0x482372,_0x0ffc('0x31'),['\x22always\x22'])))[_0x0ffc('0x40')]();}function insertCmHopperBlack(_0x1cb958,_0x50c005,_0x54070c,_0x1bf431){var _0x46b411=['cm_contacts.phone',_0x0ffc('0x2a'),_0x0ffc('0x2b'),_0x50c005+'.'+_0x1bf431,'cm_contacts.createdAt','cm_contacts.updatedAt'];return squel[_0x0ffc('0x2f')]()['into'](_0x0ffc('0x41'))['fromQuery'](['phone','ContactId',_0x0ffc('0x35'),_0x1bf431,'createdAt',_0x0ffc('0x36')],squel[_0x0ffc('0x10')]()[_0x0ffc('0x3a')](_0x46b411)['from'](_0x50c005)[_0x0ffc('0x13')](_0x0ffc('0x3b'),null,_0x0ffc('0x3c')+_0x50c005+_0x0ffc('0x3d'))[_0x0ffc('0x13')](_0x54070c,null,_0x54070c+_0x0ffc('0x14')+_0x50c005+'.'+_0x1bf431)[_0x0ffc('0x16')](_0x50c005+_0x0ffc('0x42'),_0x1cb958)['where'](_0x0ffc('0x3e'),NOW)[_0x0ffc('0x16')](_0x0ffc('0x3f'),squel['select']()[_0x0ffc('0x11')](_0x0ffc('0x28'))[_0x0ffc('0x12')](_0x0ffc('0x41'))['where'](_0x0ffc('0x43'),_0x1cb958)[_0x0ffc('0x16')](_0x1bf431+'\x20=\x20?',_0x50c005+'.'+_0x1bf431)))[_0x0ffc('0x40')]();}function insertCmHopperAdditionalPhones(_0x5f6aad){var _0x5cd99e=['cm_hopper.id',_0x0ffc('0x44'),_0x0ffc('0x45'),_0x0ffc('0x46'),'cm_contact_has_items.updatedAt'];return squel['insert']()[_0x0ffc('0x30')]('cm_hopper_additional_phones')[_0x0ffc('0x32')]([_0x0ffc('0x47'),_0x0ffc('0x28'),_0x0ffc('0x48'),_0x0ffc('0x49'),'updatedAt'],squel[_0x0ffc('0x10')]()[_0x0ffc('0x3a')](_0x5cd99e)[_0x0ffc('0x12')](_0x0ffc('0x31'))['join']('cm_contacts',null,_0x0ffc('0x4a'))['join'](_0x0ffc('0x4b'),null,_0x0ffc('0x4c'))['where']('cm_hopper.ListId\x20=\x20?',_0x5f6aad)[_0x0ffc('0x16')](_0x0ffc('0x3e'),NOW))['toString']();}function insertCmContact(_0x3394a9,_0x14d785,_0x265b8d,_0x38aa4b){var _0x18b55b=_[_0x0ffc('0x4d')](_[_0x0ffc('0x4e')](_0x38aa4b),['ListId','CompanyId',_0x0ffc('0x49'),_0x0ffc('0x36')]);return squel['insert']()[_0x0ffc('0x30')](_0x0ffc('0x3b'))[_0x0ffc('0x32')](_0x18b55b,squel['select']()[_0x0ffc('0x3a')](_0x18b55b)['from'](_0x14d785)['where']('('+_0x265b8d[_0x0ffc('0x13')](',')+')\x20NOT\x20IN\x20?',squel['select']()[_0x0ffc('0x3a')](_0x265b8d)[_0x0ffc('0x12')](_0x0ffc('0x3b'))['where'](_0x0ffc('0x43'),_0x3394a9))[_0x0ffc('0x16')]('id\x20IN\x20?',squel['select']()[_0x0ffc('0x11')](_0x0ffc('0x4f'),_0x0ffc('0x50'))[_0x0ffc('0x12')](_0x14d785)[_0x0ffc('0x51')](_0x265b8d['join'](','))))[_0x0ffc('0x40')]();}function handleStop(){logger['info']('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0x28ec97){logger[_0x0ffc('0x52')](_0x28ec97[_0x0ffc('0x1e')]);process['exit'](0x1);}function handleError(_0x5c83d3,_0x4aa514){stats[_0x0ffc('0x53')][_0x0ffc('0x1a')]({'name':_0x4aa514['code'],'message':_0x4aa514[_0x0ffc('0x1e')],'row':_0x5c83d3});}function handleQuery(_0x455e96){logger['info'](_0x455e96);return db[_0x0ffc('0x17')][_0x0ffc('0x18')](_0x455e96)[_0x0ffc('0x19')](function(_0x4a510b){results[_0x0ffc('0x1a')](_0x4a510b);})[_0x0ffc('0x1d')](function(_0x42372d){logger[_0x0ffc('0x52')](_0x42372d['message']);});}function main(_0x55b47d,_0x13a739,_0x59bb1e,_0x32ce17){logger[_0x0ffc('0x54')]('main',_0x55b47d,JSON[_0x0ffc('0x55')](_0x13a739));process['send'](_0x0ffc('0x56'));var _0x44397e=_0x13a739['binding'];var _0x5d515c=_[_0x0ffc('0x57')](_0x44397e);var _0x314da1=_0x13a739[_0x0ffc('0x58')];var _0x26f3d8=path[_0x0ffc('0x13')](config[_0x0ffc('0x59')],'server/files/tmp',_0x314da1+'.csv');logger[_0x0ffc('0x54')](_0x0ffc('0x5a'),_0x13a739);db[_0x0ffc('0x5b')][_0x0ffc('0x5c')]({'raw':!![],'attributes':['id',_0x0ffc('0x5d')]})['then'](function(_0x576442){for(var _0x12fd65=0x0;_0x12fd65<_0x576442[_0x0ffc('0x21')];_0x12fd65++){if(_0x576442[_0x12fd65][_0x0ffc('0x5d')]in _0x44397e){contactItemTypes['push'](_0x576442[_0x12fd65]);delete _0x5d515c[_0x576442[_0x12fd65][_0x0ffc('0x5d')]];hasAdditionalPhones=!![];}for(var _0x10107d in _0x44397e){if(_0x576442[_0x12fd65][_0x0ffc('0x5d')]+_0x0ffc('0x5e')===_0x10107d){phoneDescriptions[_0x0ffc('0x1a')]({'itemTypeId':_0x576442[_0x12fd65]['id'],'description':_0x10107d});delete _0x5d515c[_0x10107d];}}}if(hasAdditionalPhones)_0x5d515c['AdditionalPhones']='';var _0x2f4ae6=_[_0x0ffc('0x4e')](_0x5d515c)[_0x0ffc('0x13')]();logger[_0x0ffc('0x54')]('header',_0x2f4ae6);fs[_0x0ffc('0x5f')](_0x26f3d8,_0x2f4ae6+'\x0a');Papa[_0x0ffc('0x60')](fs[_0x0ffc('0x61')](_0x55b47d),{'header':!![],'skipEmptyLines':!![],'step':function(_0x24dd64,_0x589e42){try{for(var _0xc8e26d=0x0,_0x416aad=[];_0xc8e26d<_0x24dd64[_0x0ffc('0x62')][_0x0ffc('0x21')];_0xc8e26d++){stats[_0x0ffc('0x63')]+=0x1;if(_0x24dd64[_0x0ffc('0x53')][_0xc8e26d]){handleError(_0x24dd64[_0x0ffc('0x62')][_0xc8e26d],_0x24dd64['errors'][_0xc8e26d]);}else{var _0x8162a5=[];var _0x59901f=[];var _0x3bde31={};for(var _0x1d7b1e in _0x44397e){let _0x577890=contactItemTypes[_0x0ffc('0x64')](_0x44f708=>_0x44f708[_0x0ffc('0x5d')]===_0x1d7b1e);let _0xb98f11=contactItemTypes[_0x0ffc('0x64')](_0x313e9b=>_0x313e9b[_0x0ffc('0x5d')]+_0x0ffc('0x5e')===_0x1d7b1e);if(_['isNil'](_0x577890)&&_[_0x0ffc('0x1f')](_0xb98f11)){if(_0x44397e[_0x0ffc('0x65')](_0x1d7b1e)){if(_0x24dd64[_0x0ffc('0x62')][_0xc8e26d][_0x44397e[_0x1d7b1e]]){var _0x100d6c=_[_0x0ffc('0x66')](_0x24dd64[_0x0ffc('0x62')][_0xc8e26d][_0x44397e[_0x1d7b1e]][_0x0ffc('0x67')](/"/g,'\x27'));switch(_0x1d7b1e){case _0x0ffc('0x33'):var _0x53e2f2=moment(_0x100d6c,_0x0ffc('0xd'),!![]);if(_0x53e2f2[_0x0ffc('0x68')]()){_0x416aad['push']('\x22'+_0x100d6c+'\x22');}else{_0x8162a5[_0x0ffc('0x1a')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0x0ffc('0x37'):var _0x4cbb97=parseInt(_0x100d6c);_0x100d6c=_[_0x0ffc('0x69')](_0x4cbb97)||_0x4cbb97<0x0||_0x4cbb97>0x4?_0x32ce17?0x3:0x2:_0x4cbb97;_0x416aad['push']('\x22'+_0x100d6c+'\x22');break;case _0x0ffc('0x38'):var _0x1b0cd2=parseInt(_0x100d6c);if(_[_0x0ffc('0x6a')](_0x1b0cd2)&&_['includes'](_0x59bb1e,_0x1b0cd2)){_0x416aad['push']('\x22'+_0x1b0cd2+'\x22');}else{_0x8162a5[_0x0ffc('0x1a')]('agent\x20not\x20exists');}break;case'email':if(isEmail(_0x100d6c)){_0x416aad[_0x0ffc('0x1a')]('\x22'+_0x100d6c+'\x22');}else{_0x8162a5[_0x0ffc('0x1a')]('email\x20wrong\x20format');}break;case _0x0ffc('0x6b'):var _0x489c4a=moment(_0x100d6c,_0x0ffc('0x6c'),!![]);if(_0x489c4a[_0x0ffc('0x68')]()){_0x416aad[_0x0ffc('0x1a')]('\x22'+_0x100d6c+'\x22');}else{_0x8162a5['push'](_0x0ffc('0x6d'));}break;default:_0x416aad[_0x0ffc('0x1a')]('\x22'+_0x100d6c+'\x22');}}else{switch(_0x1d7b1e){case _0x0ffc('0x6e'):case _0x0ffc('0x28'):_0x8162a5[_0x0ffc('0x1a')](_0x1d7b1e+'\x20not\x20specified');break;default:_0x416aad[_0x0ffc('0x1a')]('\x22\x22');}}}}else{var _0x250eb7='';if(!_['isNil'](_0x577890)){if(!_0x3bde31[_0x0ffc('0x65')](_0x577890['id'])){for(var _0x5be92d=0x0;_0x5be92d<_0x44397e[_0x1d7b1e][_0x0ffc('0x21')];_0x5be92d++){var _0x100d6c=_[_0x0ffc('0x66')](_0x24dd64[_0x0ffc('0x62')][_0xc8e26d][_0x44397e[_0x1d7b1e][_0x5be92d]][_0x0ffc('0x67')](/"/g,'\x27'));var _0x3314be=phoneDescriptions['find'](_0x355a70=>_0x355a70[_0x0ffc('0x6f')]===_0x577890['id']);if(!_['isNil'](_0x3314be)){var _0x7789d4=_[_0x0ffc('0x66')](_0x24dd64[_0x0ffc('0x62')][_0xc8e26d][_0x44397e[_0x3314be[_0x0ffc('0x70')]][0x0]][_0x0ffc('0x67')](/"/g,'\x27'));if(!_[_0x0ffc('0x1f')](_0x7789d4))_0x100d6c=_0x100d6c+'§'+_0x7789d4;}if(_0x250eb7=='')_0x250eb7=_0x100d6c;else _0x250eb7+='|'+_0x100d6c;}_0x59901f[_0x0ffc('0x1a')](_0x577890['id']+':'+_0x250eb7);_0x3bde31[_0x577890['id']]=0x1;}}}}if(hasAdditionalPhones){_0x416aad[_0x0ffc('0x1a')]('\x22'+_0x59901f[_0x0ffc('0x13')](';')+'\x22');}if(_0x8162a5[_0x0ffc('0x21')]){handleError(_0x24dd64['data'][_0xc8e26d],{'code':'SystemRow','message':_0x8162a5['join']()});}else{fs[_0x0ffc('0x71')](_0x26f3d8,_0x416aad[_0x0ffc('0x13')]()+'\x0a');}_0x416aad=[];}if(!(stats[_0x0ffc('0x63')]%0xc8)){socket[_0x0ffc('0x72')](_0x0ffc('0x73')+_0x314da1,stats);stats['errors']=[];}}if(stopped){logger[_0x0ffc('0x54')](_0x0ffc('0x74'));_0x589e42[_0x0ffc('0x75')]();}}catch(_0x3c5583){handleError(_0x24dd64['data'][_0xc8e26d],{'code':_0x0ffc('0x76'),'message':_0x3c5583[_0x0ffc('0x1e')]});logger[_0x0ffc('0x52')](_0x0ffc('0x77'),_0x3c5583[_0x0ffc('0x1e')]);}},'complete':function(){try{var _0xc6ffb6=[];var _0x2e3f2b=tempTableName;_0xc6ffb6[_0x0ffc('0x1a')](_0x0ffc('0x78')+_0x2e3f2b+'\x20LIKE\x20cm_contacts;');logger[_0x0ffc('0x54')](_0x0ffc('0x79'),contactItemTypes['length']);var _0x2eb982=util[_0x0ffc('0xc')](_0x0ffc('0x7a'),_0x26f3d8,_0x2e3f2b,_0x2f4ae6,_0x13a739[_0x0ffc('0x35')],_0x13a739[_0x0ffc('0x7b')]||null,NOW,NOW);if(_['isNil'](_0x44397e[_0x0ffc('0x33')])){_0x2eb982+=_0x0ffc('0x7c');}_0xc6ffb6['push'](_0x2eb982);BPromise['each'](_0xc6ffb6,handleQuery)[_0x0ffc('0x1c')](function(_0x3bf2d8){BPromise['all']([handleAdditionalPhones()])['then'](function(){_0xc6ffb6=[];for(var _0x44c882=0x0;_0x44c882\x20\x20','file\x20doesn\x27t\x20exists','parse','binding\x20doesn\x27t\x20exists','ListId\x20is\x20mandatory','map','No\x20agent\x20available','SIGINT','uncaughtException','path','lodash','papaparse','util','bluebird','squel','ioredis','../../../mysqldb','../../../config/logger','defaults','redis','localhost','format','YYYY-MM-DD\x20HH:mm:ss','cm_contacts_temp_','YYYYMMDDHHmmss','select','field','phone','from','.id\x20=\x20','where','\x20=\x20','join','sequelize','query','select\x20*\x20from\x20','spread','isNil','push','all','then','catch','message','AdditionalPhones','split','length','filter','findOne','CmContactHasItem','update','create','PHONE','inserted','CmContact','cm_contacts.scheduledat','cm_contacts.id','cm_contacts.createdAt','cm_contacts.updatedAt','cm_contacts.priority','insert','into','cm_hopper','updatedAt','priority','UserId','recallme','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(?)','cm_contacts.phone','cm_contacts.ListId','cm_hopper_black','fromQuery','ContactId','createdAt','ListId\x20=\x20?','\x20=\x20?','toString','cm_hopper.id','cm_contact_has_items.item','cm_contact_has_items.OrderBy','cm_contact_has_items.createdAt','cm_hopper_additional_phones','CmHopperId','OrderBy','fields','cm_contacts.id\x20=\x20cm_hopper.ContactId','cm_hopper.ListId\x20=\x20?','concat','keys','ListId','CompanyId',')\x20NOT\x20IN\x20?','MIN(id)','min_id','group','info','errors','code','error','main','stringify','start','binding','clone','root','.csv','body','ContactItemType','findAll','name','_description','header','writeFileSync','createReadStream','data','rows'];(function(_0x44edc8,_0x41e0a7){var _0x214264=function(_0x59f6a0){while(--_0x59f6a0){_0x44edc8['push'](_0x44edc8['shift']());}};_0x214264(++_0x41e0a7);}(_0x49db,0xc5));var _0xb49d=function(_0x275f36,_0x31cde2){_0x275f36=_0x275f36-0x0;var _0x479ba9=_0x49db[_0x275f36];return _0x479ba9;};'use strict';var fs=require('fs');var path=require(_0xb49d('0x0'));var _=require(_0xb49d('0x1'));var Papa=require(_0xb49d('0x2'));var util=require(_0xb49d('0x3'));var BPromise=require(_0xb49d('0x4'));var moment=require('moment');var squel=require(_0xb49d('0x5'));var Redis=require(_0xb49d('0x6'));var db=require(_0xb49d('0x7'))['db'];var config=require('../../../config/environment');var logger=require(_0xb49d('0x8'))('import');config['redis']=_[_0xb49d('0x9')](config[_0xb49d('0xa')],{'host':_0xb49d('0xb'),'port':0x18eb});var socket=require('socket.io-emitter')(new Redis(config[_0xb49d('0xa')]));var stats={'finish':![],'errors':[],'rows':0x0,'affectedRows':0x0};var results=[];var promisesAdditionalPhones=[];var promisesContact=[];var orderBy=0x0;var updatedRows=0x0;var stopped=![];var NOW=moment()[_0xb49d('0xc')](_0xb49d('0xd'));var tempTableName=_0xb49d('0xe')+moment()[_0xb49d('0xc')](_0xb49d('0xf'));var contactItemTypes=[];var phoneDescriptions=[];var hasAdditionalPhones=![];function isEmail(_0x54f285){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'](_0x54f285);}function selectNotIn(_0x3f21e3,_0x3422e0,_0x3e9e6d,_0x3259e5,_0x2c9c16){return squel[_0xb49d('0x10')]()[_0xb49d('0x11')](_0xb49d('0x12'))[_0xb49d('0x13')](_0x3259e5)['join'](_0x3422e0,null,_0x3422e0+_0xb49d('0x14')+_0x3259e5+'.'+_0x3e9e6d)[_0xb49d('0x15')](_0x3259e5+'.'+_0x3e9e6d+_0xb49d('0x16')+_0x3f21e3+'.'+_0x3e9e6d)[_0xb49d('0x15')](_0x3422e0+'.dialCheckDuplicateType\x20IN\x20('+_0x2c9c16[_0xb49d('0x17')]()+')');}function handleAdditionalPhones(){return new Promise(function(_0x2c0b41,_0x4ddeb5){promisesAdditionalPhones=[];promisesContact=[];return db[_0xb49d('0x18')][_0xb49d('0x19')](_0xb49d('0x1a')+tempTableName)[_0xb49d('0x1b')](function(_0x1491fb){if(_0x1491fb!==null){var _0x270298=[];for(var _0x1dba19=0x0;_0x1dba19<_0x1491fb['length'];_0x1dba19++){var _0x1da77c=_0x1491fb[_0x1dba19];if(!_[_0xb49d('0x1c')](_0x1da77c[_0xb49d('0x12')])){if(!_[_0xb49d('0x1c')](_0x1da77c['AdditionalPhones']))_0x270298['push'](insertAdditionalPhones(_0x1da77c));promisesContact[_0xb49d('0x1d')]({'contact':_0x1da77c});}}}Promise[_0xb49d('0x1e')](_0x270298)[_0xb49d('0x1f')](function(){_0x2c0b41({'val':0x1});});})[_0xb49d('0x20')](function(_0x5b24b9){logger['error'](_0x5b24b9[_0xb49d('0x21')]);});});}function insertAdditionalPhones(_0x47626f){return new Promise(function(_0x3bf7a2,_0x263c62){var _0x22ad15=_0x47626f[_0xb49d('0x22')];if(_[_0xb49d('0x1c')](_0x22ad15))_0x263c62({'val':0x0});else{var _0x35f82b=_0x22ad15[_0xb49d('0x23')](';');var _0x38be04=[];orderBy=0x0;for(var _0x19ead9=0x0;_0x19ead9<_0x35f82b[_0xb49d('0x24')];_0x19ead9++){_0x38be04[_0xb49d('0x1d')](splitAdditionalPhone(_0x47626f['id'],_0x35f82b[_0x19ead9]));}Promise[_0xb49d('0x1e')](_0x38be04)[_0xb49d('0x1f')](function(){_0x3bf7a2({'val':_0x35f82b[_0xb49d('0x24')]});});}});}function splitAdditionalPhone(_0x26db55,_0x21c0e1){return new Promise(function(_0x165ec2,_0x1ae086){var _0xb3d5=_0x21c0e1[_0xb49d('0x23')](':');var _0x5a6cbe=_0xb3d5[0x0];var _0x227305=_0xb3d5[0x1];if(_0x227305!==''){var _0x4b7134=_0x227305[_0xb49d('0x23')]('|');var _0x3b7fee=[];for(var _0x56163c=0x0;_0x56163c<_0x4b7134[_0xb49d('0x24')];_0x56163c++){if(_0x4b7134[_0x56163c]!==''){var _0x1cd841=_[_0xb49d('0x25')](promisesAdditionalPhones,{'contactId':_0x26db55,'phone':_0x4b7134[_0x56163c]});if(_0x1cd841[_0xb49d('0x24')]==0x0){orderBy++;promisesAdditionalPhones[_0xb49d('0x1d')]({'contactId':_0x26db55,'contactTypeId':_0x5a6cbe,'phone':_0x4b7134[_0x56163c],'orderBy':orderBy});}}}_0x165ec2({'ok':0x1});}else _0x165ec2({'res':0x0});});}function createAdditionalPhone(_0x2276ba,_0x5d7323,_0x3930fe,_0xf734e1){var _0x2b5e5d='';var _0x37901b='';var _0x420e63=_0x3930fe[_0xb49d('0x23')]('§');_0x2b5e5d=_0x420e63[0x0];if(_0x420e63[_0xb49d('0x24')]==0x2)_0x37901b=_0x420e63[0x1];return new Promise(function(_0x588529,_0x3f1796){return db['CmContactHasItem'][_0xb49d('0x26')]({'where':{'CmContactId':_0x2276ba,'item':_0x2b5e5d}})[_0xb49d('0x1f')](function(_0x978e19){if(_0x978e19){return db[_0xb49d('0x27')][_0xb49d('0x28')]({'ItemTypeId':_0x5d7323,'description':_0x37901b,'OrderBy':_0xf734e1},{'where':{'CmContactId':_0x2276ba,'item':_0x2b5e5d}})[_0xb49d('0x1f')](function(_0xd6d0b){_0x588529({'res':'updated'});});}else{return db[_0xb49d('0x27')][_0xb49d('0x29')]({'CmContactId':_0x2276ba,'item':_0x2b5e5d,'ItemTypeId':_0x5d7323,'description':_0x37901b,'OrderBy':_0xf734e1,'ItemClass':_0xb49d('0x2a')})['then'](function(_0x5cc4e5){_0x588529({'res':_0xb49d('0x2b')});});}});});}function updateContact(_0x12abb6){return new Promise(function(_0x208967,_0xbb8e0f){var _0x3fd75e=_0x12abb6['id'];delete _0x12abb6['id'];return db[_0xb49d('0x2c')][_0xb49d('0x28')](_0x12abb6,{'where':{'id':_0x3fd75e}})[_0xb49d('0x1f')](function(_0x594dcb){updatedRows+=0x1;return db['CmHopper'][_0xb49d('0x28')]({'phone':_0x12abb6['phone']},{'where':{'ContactId':_0x3fd75e}})['then'](function(_0x4b790e){_0x208967({'ret':'OK'});});});});}function insertCmHopper(_0x423399,_0x4235ad,_0x3964ec,_0x33f922,_0x1e90a7){var _0x2a90ee=['cm_contacts.phone',_0xb49d('0x2d'),_0xb49d('0x2e'),'cm_contacts.ListId',_0x4235ad+'.'+_0x33f922,_0xb49d('0x2f'),_0xb49d('0x30'),_0xb49d('0x31'),'cm_contacts.UserId','\x22'+_0x1e90a7+'\x22'];return squel[_0xb49d('0x32')]()[_0xb49d('0x33')](_0xb49d('0x34'))['fromQuery']([_0xb49d('0x12'),'scheduledat','ContactId','ListId',_0x33f922,'createdAt',_0xb49d('0x35'),_0xb49d('0x36'),_0xb49d('0x37'),_0xb49d('0x38')],squel['select']()['fields'](_0x2a90ee)[_0xb49d('0x13')](_0x4235ad)[_0xb49d('0x17')](_0xb49d('0x39'),null,_0xb49d('0x3a')+_0x4235ad+_0xb49d('0x3b'))['join'](_0x3964ec,null,_0x3964ec+'.id\x20=\x20'+_0x4235ad+'.'+_0x33f922)[_0xb49d('0x15')](_0x4235ad+_0xb49d('0x3c'),_0x423399)[_0xb49d('0x15')](_0xb49d('0x3d'),NOW)[_0xb49d('0x15')]('cm_contacts.phone\x20NOT\x20IN\x20(?)',selectNotIn(_0x4235ad,_0x3964ec,_0x33f922,_0xb49d('0x34'),[_0xb49d('0x3e'),_0xb49d('0x3f')]))[_0xb49d('0x15')](_0xb49d('0x40'),selectNotIn(_0x4235ad,_0x3964ec,_0x33f922,_0xb49d('0x34'),[_0xb49d('0x3e')])))['toString']();}function insertCmHopperBlack(_0x2f9481,_0x586968,_0x5db393,_0x3f394f){var _0x308407=[_0xb49d('0x41'),'cm_contacts.id',_0xb49d('0x42'),_0x586968+'.'+_0x3f394f,_0xb49d('0x2f'),_0xb49d('0x30')];return squel['insert']()['into'](_0xb49d('0x43'))[_0xb49d('0x44')]([_0xb49d('0x12'),_0xb49d('0x45'),'ListId',_0x3f394f,_0xb49d('0x46'),_0xb49d('0x35')],squel[_0xb49d('0x10')]()['fields'](_0x308407)[_0xb49d('0x13')](_0x586968)[_0xb49d('0x17')](_0xb49d('0x39'),null,_0xb49d('0x3a')+_0x586968+_0xb49d('0x3b'))[_0xb49d('0x17')](_0x5db393,null,_0x5db393+_0xb49d('0x14')+_0x586968+'.'+_0x3f394f)[_0xb49d('0x15')](_0x586968+'.CmListId\x20=\x20?',_0x2f9481)['where']('cm_contacts.createdAt\x20=\x20?',NOW)[_0xb49d('0x15')](_0xb49d('0x40'),squel[_0xb49d('0x10')]()[_0xb49d('0x11')]('phone')['from']('cm_hopper_black')[_0xb49d('0x15')](_0xb49d('0x47'),_0x2f9481)[_0xb49d('0x15')](_0x3f394f+_0xb49d('0x48'),_0x586968+'.'+_0x3f394f)))[_0xb49d('0x49')]();}function insertCmHopperAdditionalPhones(_0x4f58fa){var _0x2de03d=[_0xb49d('0x4a'),_0xb49d('0x4b'),_0xb49d('0x4c'),_0xb49d('0x4d'),'cm_contact_has_items.updatedAt'];return squel[_0xb49d('0x32')]()[_0xb49d('0x33')](_0xb49d('0x4e'))[_0xb49d('0x44')]([_0xb49d('0x4f'),_0xb49d('0x12'),_0xb49d('0x50'),'createdAt',_0xb49d('0x35')],squel['select']()[_0xb49d('0x51')](_0x2de03d)[_0xb49d('0x13')](_0xb49d('0x34'))[_0xb49d('0x17')](_0xb49d('0x39'),null,_0xb49d('0x52'))[_0xb49d('0x17')]('cm_contact_has_items',null,'cm_contacts.id\x20=\x20cm_contact_has_items.CmContactId')['where'](_0xb49d('0x53'),_0x4f58fa)[_0xb49d('0x15')]('cm_contacts.createdAt\x20=\x20?',NOW))[_0xb49d('0x49')]();}function insertCmContact(_0x14624f,_0x1cfc5a,_0x4057b7,_0x33ba3e){var _0x3ae388=_[_0xb49d('0x54')](_[_0xb49d('0x55')](_0x33ba3e),[_0xb49d('0x56'),_0xb49d('0x57'),'createdAt',_0xb49d('0x35')]);return squel[_0xb49d('0x32')]()[_0xb49d('0x33')](_0xb49d('0x39'))[_0xb49d('0x44')](_0x3ae388,squel[_0xb49d('0x10')]()[_0xb49d('0x51')](_0x3ae388)[_0xb49d('0x13')](_0x1cfc5a)[_0xb49d('0x15')]('('+_0x4057b7[_0xb49d('0x17')](',')+_0xb49d('0x58'),squel[_0xb49d('0x10')]()[_0xb49d('0x51')](_0x4057b7)['from'](_0xb49d('0x39'))[_0xb49d('0x15')](_0xb49d('0x47'),_0x14624f))[_0xb49d('0x15')]('id\x20IN\x20?',squel[_0xb49d('0x10')]()[_0xb49d('0x11')](_0xb49d('0x59'),_0xb49d('0x5a'))[_0xb49d('0x13')](_0x1cfc5a)[_0xb49d('0x5b')](_0x4057b7[_0xb49d('0x17')](','))))['toString']();}function handleStop(){logger[_0xb49d('0x5c')]('Received\x20SIGINT');stopped=!![];}function handleUncaughtException(_0xe81ea2){logger['error'](_0xe81ea2[_0xb49d('0x21')]);process['exit'](0x1);}function handleError(_0x916de2,_0x2da6a1){stats[_0xb49d('0x5d')]['push']({'name':_0x2da6a1[_0xb49d('0x5e')],'message':_0x2da6a1['message'],'row':_0x916de2});}function handleQuery(_0x53c6c4){logger[_0xb49d('0x5c')](_0x53c6c4);return db[_0xb49d('0x18')][_0xb49d('0x19')](_0x53c6c4)[_0xb49d('0x1b')](function(_0x15e06d){results[_0xb49d('0x1d')](_0x15e06d);})['catch'](function(_0x5ac526){logger[_0xb49d('0x5f')](_0x5ac526[_0xb49d('0x21')]);});}function main(_0x16b956,_0x55c75a,_0x280689,_0x314c5d){logger['info'](_0xb49d('0x60'),_0x16b956,JSON[_0xb49d('0x61')](_0x55c75a));process['send'](_0xb49d('0x62'));var _0x2d8271=_0x55c75a[_0xb49d('0x63')];var _0x1201b1=_[_0xb49d('0x64')](_0x2d8271);var _0x264605=_0x55c75a['socket_timestamp'];var _0x24884d=path[_0xb49d('0x17')](config[_0xb49d('0x65')],'server/files/tmp',_0x264605+_0xb49d('0x66'));logger[_0xb49d('0x5c')](_0xb49d('0x67'),_0x55c75a);db[_0xb49d('0x68')][_0xb49d('0x69')]({'raw':!![],'attributes':['id',_0xb49d('0x6a')]})['then'](function(_0x8a266c){for(var _0x10d3cf=0x0;_0x10d3cf<_0x8a266c[_0xb49d('0x24')];_0x10d3cf++){if(_0x8a266c[_0x10d3cf][_0xb49d('0x6a')]in _0x2d8271){contactItemTypes[_0xb49d('0x1d')](_0x8a266c[_0x10d3cf]);delete _0x1201b1[_0x8a266c[_0x10d3cf][_0xb49d('0x6a')]];hasAdditionalPhones=!![];}for(var _0x11934a in _0x2d8271){if(_0x8a266c[_0x10d3cf][_0xb49d('0x6a')]+_0xb49d('0x6b')===_0x11934a){phoneDescriptions[_0xb49d('0x1d')]({'itemTypeId':_0x8a266c[_0x10d3cf]['id'],'description':_0x11934a});delete _0x1201b1[_0x11934a];}}}if(hasAdditionalPhones)_0x1201b1[_0xb49d('0x22')]='';var _0x162c46=_['keys'](_0x1201b1)[_0xb49d('0x17')]();logger['info'](_0xb49d('0x6c'),_0x162c46);fs[_0xb49d('0x6d')](_0x24884d,_0x162c46+'\x0a');Papa['parse'](fs[_0xb49d('0x6e')](_0x16b956),{'header':!![],'skipEmptyLines':!![],'step':function(_0x55603f,_0x2cdcc2){try{for(var _0x595052=0x0,_0x2d2d9c=[];_0x595052<_0x55603f[_0xb49d('0x6f')][_0xb49d('0x24')];_0x595052++){stats[_0xb49d('0x70')]+=0x1;if(_0x55603f[_0xb49d('0x5d')][_0x595052]){handleError(_0x55603f['data'][_0x595052],_0x55603f[_0xb49d('0x5d')][_0x595052]);}else{var _0x5adf36=[];var _0x2d7f16=[];var _0xf0a753={};for(var _0x3ded9a in _0x2d8271){let _0x44f848=contactItemTypes[_0xb49d('0x71')](_0x1c1175=>_0x1c1175[_0xb49d('0x6a')]===_0x3ded9a);let _0x35aa38=contactItemTypes['find'](_0x258ce9=>_0x258ce9[_0xb49d('0x6a')]+'_description'===_0x3ded9a);if(_[_0xb49d('0x1c')](_0x44f848)&&_['isNil'](_0x35aa38)){if(_0x2d8271['hasOwnProperty'](_0x3ded9a)){if(_0x55603f['data'][_0x595052][_0x2d8271[_0x3ded9a]]){var _0x50bb6c=_[_0xb49d('0x72')](_0x55603f[_0xb49d('0x6f')][_0x595052][_0x2d8271[_0x3ded9a]][_0xb49d('0x73')](/"/g,'\x27'));switch(_0x3ded9a){case _0xb49d('0x74'):var _0x59a570=moment(_0x50bb6c,_0xb49d('0xd'),!![]);if(_0x59a570[_0xb49d('0x75')]()){_0x2d2d9c[_0xb49d('0x1d')]('\x22'+_0x50bb6c+'\x22');}else{_0x5adf36[_0xb49d('0x1d')]('scheduledat\x20wrong\x20format\x20(YYYY-MM-DD\x20HH:mm:ss)');}break;case _0xb49d('0x36'):var _0x1463e4=parseInt(_0x50bb6c);_0x50bb6c=_['isNaN'](_0x1463e4)||_0x1463e4<0x0||_0x1463e4>0x4?_0x314c5d?0x3:0x2:_0x1463e4;_0x2d2d9c[_0xb49d('0x1d')]('\x22'+_0x50bb6c+'\x22');break;case _0xb49d('0x37'):var _0x48accb=parseInt(_0x50bb6c);if(_[_0xb49d('0x76')](_0x48accb)&&_[_0xb49d('0x77')](_0x280689,_0x48accb)){_0x2d2d9c['push']('\x22'+_0x48accb+'\x22');}else{_0x5adf36['push'](_0xb49d('0x78'));}break;case _0xb49d('0x79'):if(isEmail(_0x50bb6c)){_0x2d2d9c[_0xb49d('0x1d')]('\x22'+_0x50bb6c+'\x22');}else{_0x5adf36[_0xb49d('0x1d')](_0xb49d('0x7a'));}break;case'dateOfBirth':var _0x1ab7e7=moment(_0x50bb6c,_0xb49d('0x7b'),!![]);if(_0x1ab7e7[_0xb49d('0x75')]()){_0x2d2d9c['push']('\x22'+_0x50bb6c+'\x22');}else{_0x5adf36[_0xb49d('0x1d')]('dateOfBirth\x20wrong\x20format\x20(YYYY-MM-DD)');}break;default:_0x2d2d9c[_0xb49d('0x1d')]('\x22'+_0x50bb6c+'\x22');}}else{switch(_0x3ded9a){case'firstName':case _0xb49d('0x12'):_0x5adf36[_0xb49d('0x1d')](_0x3ded9a+_0xb49d('0x7c'));break;default:_0x2d2d9c[_0xb49d('0x1d')]('\x22\x22');}}}}else{var _0x214078='';if(!_['isNil'](_0x44f848)){if(!_0xf0a753[_0xb49d('0x7d')](_0x44f848['id'])){for(var _0x5b98a4=0x0;_0x5b98a4<_0x2d8271[_0x3ded9a][_0xb49d('0x24')];_0x5b98a4++){var _0x50bb6c=_[_0xb49d('0x72')](_0x55603f[_0xb49d('0x6f')][_0x595052][_0x2d8271[_0x3ded9a][_0x5b98a4]][_0xb49d('0x73')](/"/g,'\x27'));var _0x3619e3=phoneDescriptions[_0xb49d('0x71')](_0x39a8ef=>_0x39a8ef[_0xb49d('0x7e')]===_0x44f848['id']);if(!_['isNil'](_0x3619e3)){var _0x4c1dc6=_['trim'](_0x55603f[_0xb49d('0x6f')][_0x595052][_0x2d8271[_0x3619e3[_0xb49d('0x7f')]][0x0]][_0xb49d('0x73')](/"/g,'\x27'));if(!_[_0xb49d('0x1c')](_0x4c1dc6))_0x50bb6c=_0x50bb6c+'§'+_0x4c1dc6;}if(_0x214078=='')_0x214078=_0x50bb6c;else _0x214078+='|'+_0x50bb6c;}_0x2d7f16[_0xb49d('0x1d')](_0x44f848['id']+':'+_0x214078);_0xf0a753[_0x44f848['id']]=0x1;}}}}if(hasAdditionalPhones){_0x2d2d9c[_0xb49d('0x1d')]('\x22'+_0x2d7f16[_0xb49d('0x17')](';')+'\x22');}if(_0x5adf36[_0xb49d('0x24')]){handleError(_0x55603f[_0xb49d('0x6f')][_0x595052],{'code':_0xb49d('0x80'),'message':_0x5adf36[_0xb49d('0x17')]()});}else{fs[_0xb49d('0x81')](_0x24884d,_0x2d2d9c[_0xb49d('0x17')]()+'\x0a');}_0x2d2d9c=[];}if(!(stats[_0xb49d('0x70')]%0xc8)){socket['emit'](_0xb49d('0x82')+_0x264605,stats);stats['errors']=[];}}if(stopped){logger[_0xb49d('0x5c')]('Abort\x20parser');_0x2cdcc2['abort']();}}catch(_0x2c29ba){handleError(_0x55603f[_0xb49d('0x6f')][_0x595052],{'code':_0xb49d('0x83'),'message':_0x2c29ba['message']});logger['error'](_0xb49d('0x84'),_0x2c29ba[_0xb49d('0x21')]);}},'complete':function(){try{var _0x212ad0=[];var _0x453694=tempTableName;_0x212ad0[_0xb49d('0x1d')]('CREATE\x20TABLE\x20'+_0x453694+'\x20LIKE\x20cm_contacts;');logger['info'](_0xb49d('0x85'),contactItemTypes[_0xb49d('0x24')]);var _0x70cf7b=util['format'](_0xb49d('0x86'),_0x24884d,_0x453694,_0x162c46,_0x55c75a[_0xb49d('0x56')],_0x55c75a[_0xb49d('0x57')]||null,NOW,NOW);if(_[_0xb49d('0x1c')](_0x2d8271[_0xb49d('0x74')])){_0x70cf7b+=_0xb49d('0x87');}_0x212ad0['push'](_0x70cf7b);BPromise[_0xb49d('0x88')](_0x212ad0,handleQuery)[_0xb49d('0x1f')](function(_0x221092){BPromise[_0xb49d('0x1e')]([handleAdditionalPhones()])['then'](function(){_0x212ad0=[];for(var _0x15cf10=0x0;_0x15cf10\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName','i.id','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.subject','i.to','i.MailAccountId','openchannel','CASE\x20WHEN\x20i.from\x20IS\x20NOT\x20NULL\x20AND\x20i.from\x20<>\x20\x27\x27\x20THEN\x20i.from\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','c.firstName','Contact.firstName','c.lastName','Contact.lastName','c.phone','Contact.fax','o.fullname','Owner.fullname','o.internal','GROUP_CONCAT(DISTINCT\x20t.id)','limit','offset','groupBy','Setting','findOne','enableEmailPreview','all','COUNT(*)','isEmpty','t.id\x20IN\x20?','Sequelize','SELECT','lodash','squel','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','field','name','from','tools_tags','user_has_','_interactions','select','u.id','u.fullname','where','ui.','map','getInteractionsTables','getInteractionFK','left_join','cm_contacts','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL','o.id\x20=\x20i.UserId','accounts','a.id\x20=\x20i.','messages','me.','\x20=\x20i.id'];(function(_0x58a551,_0x61dbd6){var _0x4162b0=function(_0x58732b){while(--_0x58732b){_0x58a551['push'](_0x58a551['shift']());}};_0x4162b0(++_0x61dbd6);}(_0x38c7,0x11a));var _0x738c=function(_0x49a168,_0x3bddfa){_0x49a168=_0x49a168-0x0;var _0x5ef4d8=_0x38c7[_0x49a168];return _0x5ef4d8;};'use strict';var _=require(_0x738c('0x0'));var squel=require(_0x738c('0x1'));var as=require('../parsers/advancedSearch');var qs=require(_0x738c('0x2'));var updateInteraction=require(_0x738c('0x3'))[_0x738c('0x4')];var utils=require(_0x738c('0x5'));var db=require(_0x738c('0x6'))['db'];function skipInteractionsQuery(_0x2f3ea5,_0x4608a8,_0x1cde83){var _0x1ced31=![];var _0x46d7ab=utils[_0x738c('0x7')](_0x2f3ea5);if(_0x4608a8[_0x738c('0x8')]===_0x738c('0x9')&&!_0x1cde83[_0x738c('0xa')]&&!_0x1cde83[_0x46d7ab]){_0x1ced31=!![];}return _0x1ced31;}function getTagsQuery(){return squel['select']()[_0x738c('0xb')]('id')['field'](_0x738c('0xc'))['field']('color')[_0x738c('0xd')](_0x738c('0xe'));}function getUsersQuery(_0x37fdcf,_0x39cecf){var _0x21f23c=utils['getInteractionFK'](_0x37fdcf);var _0x3548b1=_0x738c('0xf')+_0x37fdcf+_0x738c('0x10');var _0x6a5d53=squel[_0x738c('0x11')]()['field'](_0x738c('0x12'))[_0x738c('0xb')](_0x738c('0x13'))[_0x738c('0xb')]('ui.'+_0x21f23c)[_0x738c('0xd')](_0x3548b1,'ui')['left_join']('users','u','u.id\x20=\x20ui.UserId');if(_0x39cecf['length']>0x0){_0x6a5d53[_0x738c('0x14')](_0x738c('0x15')+_0x21f23c+'\x20IN\x20?',_[_0x738c('0x16')](_0x39cecf,'id'));}return _0x6a5d53;}function getInteractionsQuery(_0x1d865a){var _0x50c5ec=utils[_0x738c('0x17')](_0x1d865a);var _0x595d70=utils[_0x738c('0x7')](_0x1d865a);var _0x154400=utils[_0x738c('0x18')](_0x1d865a);return squel[_0x738c('0x11')]()[_0x738c('0xd')](_0x50c5ec['interactions'],'i')[_0x738c('0x19')](_0x738c('0x1a'),'c',_0x738c('0x1b'))[_0x738c('0x19')]('users','o',_0x738c('0x1c'))[_0x738c('0x19')](_0x50c5ec[_0x738c('0x1d')],'a',_0x738c('0x1e')+_0x595d70)['left_join'](_0x50c5ec[_0x738c('0x1f')],'me',_0x738c('0x20')+_0x154400+_0x738c('0x21'))[_0x738c('0x19')](_0x50c5ec[_0x738c('0x22')],'it','it.'+_0x154400+_0x738c('0x21'))[_0x738c('0x19')](_0x738c('0xe'),'t','t.id\x20=\x20it.TagId');}function getSqlClauses(){var _0x3936f4={'body':squel[_0x738c('0x23')](),'contact':squel[_0x738c('0x23')](),'default':squel[_0x738c('0x23')](),'fields':squel['expr'](),'filter':squel[_0x738c('0x23')](),'read':squel[_0x738c('0x23')](),'tags':{'clause':squel[_0x738c('0x23')](),'ids':null},'user':squel[_0x738c('0x23')]()};return _0x3936f4;}function parseTagParameter(_0x1db222){var _0x1ac4fc=squel[_0x738c('0x23')]();if(_0x1db222){var _0x9a53aa=utils[_0x738c('0x24')](_0x1db222);_0x9a53aa['forEach'](function(_0x116dfd){_0x1ac4fc['or'](_0x738c('0x25'),'%,'+_0x116dfd+',%');});}return _0x1ac4fc;}function parseReadParameter(_0x328f16){var _0x5cf900='';if(_0x328f16){_0x5cf900=_0x738c('0x26');if(_0x328f16==='1'){_0x5cf900=_0x5cf900[_0x738c('0x27')](_0x738c('0x28'),'=');}else{_0x5cf900=_0x5cf900[_0x738c('0x27')](_0x738c('0x28'),'>');}}return _0x5cf900;}function parseSearchFilter(_0x10c052,_0xc633d5){var _0x3429be=squel[_0x738c('0x23')]();if(_0xc633d5){var _0x53a3c4=_0xc633d5['replace']('\x5c','\x5c\x5c')[_0x738c('0x27')](/'/g,'\x27\x27');if(qs[_0x738c('0x29')](_0x53a3c4)){_0x3429be['or'](_0x738c('0x2a'),_0x53a3c4+'%');if([_0x738c('0x2b'),_0x738c('0x2c')]['includes'](_0x10c052)){_0x3429be['or'](_0x738c('0x2d'),_0x53a3c4+'%');}else if(_0x10c052==='fax'){_0x3429be['or'](_0x738c('0x2e'),_0x53a3c4+'%');}else if(_0x10c052==='openchannel'){_0x3429be['or']('i.from\x20LIKE\x20?',_0x53a3c4+'%');}}else if(_0x10c052===_0x738c('0x2f')&&qs[_0x738c('0x30')](_0x53a3c4)){_0x3429be['or'](_0x738c('0x31'),_0x53a3c4+'%');}else{if(_0x10c052===_0x738c('0x2f')){_0x3429be['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x738c('0x32')](_0x53a3c4,!![]))['or']('MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x738c('0x32')](_0x53a3c4));}else if(_0x10c052!==_0x738c('0x33')){_0x3429be['or'](_0x738c('0x34'),qs[_0x738c('0x32')](_0x53a3c4));}_0x3429be['or']('MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x738c('0x32')](_0x53a3c4,!![]),null);}}return _0x3429be;}function parseAdvancedSearchFilter(_0x19ca7c,_0x508e47){var _0x36a58f=getSqlClauses();var _0x4f5f9e=as[_0x738c('0x35')](_0x19ca7c);var _0x3be2af=_0x4f5f9e[_0x738c('0x36')];for(var _0x2bc801=0x0;_0x2bc801<_0x4f5f9e[_0x738c('0x37')][_0x738c('0x38')];_0x2bc801++){var _0x2be196=_0x4f5f9e[_0x738c('0x37')][_0x2bc801];var _0x2d827b='i';var _0x20a22f=_[_0x738c('0x39')](_0x508e47,[_0x738c('0xc'),_0x2be196['field']]);if(_0x20a22f){var _0x1f93f8=as[_0x738c('0x3a')](_0x2d827b,_0x20a22f[_0x738c('0x3b')],_0x2be196);_0x36a58f[_0x738c('0x3c')][_0x3be2af](_0x1f93f8['text'],_0x1f93f8['value']['start'],_0x1f93f8[_0x738c('0x3d')][_0x738c('0x3e')]);}else{switch(_0x2be196[_0x738c('0xb')]){case _0x738c('0x3f'):var _0x11f873=parseReadParameter(_0x2be196[_0x738c('0x3d')]);_0x36a58f['read'][_0x738c('0x40')](_0x11f873);break;case _0x738c('0x41'):if(_0x2be196['operator']===_0x738c('0x42')){if(_0x2be196[_0x738c('0x3d')][_0x738c('0x43')]('\x20')['length']>0x1){_0x36a58f[_0x738c('0x44')][_0x3be2af](_0x738c('0x45'),qs[_0x738c('0x32')](_0x2be196[_0x738c('0x3d')],!![]),null);}else{var _0x42020c='%'+_0x2be196[_0x738c('0x3d')]+'%';_0x36a58f[_0x738c('0x44')][_0x3be2af](_0x738c('0x46'),_0x42020c,_0x42020c,_0x42020c);}}else{_0x20a22f=_[_0x738c('0x39')](_0x508e47,[_0x738c('0xc'),_0x738c('0x47')]);_0x2be196[_0x738c('0xb')]=_0x738c('0x47');_0x1f93f8=as[_0x738c('0x3a')](_0x2d827b,_0x20a22f[_0x738c('0x3b')],_0x2be196);_0x36a58f['contact'][_0x3be2af](_0x1f93f8[_0x738c('0x48')],_0x1f93f8[_0x738c('0x3d')][_0x738c('0x49')],_0x1f93f8[_0x738c('0x3d')][_0x738c('0x3e')]);}break;case'Tag':var _0x56e392=_0x2be196[_0x738c('0x3d')][_0x738c('0x43')](',')[_0x738c('0x16')](function(_0xf9fd86){return Number(_0xf9fd86);});var _0x4753b2=parseTagParameter(_0x56e392);_0x36a58f[_0x738c('0x4a')][_0x738c('0x4b')][_0x738c('0x40')](_0x4753b2);_0x36a58f[_0x738c('0x4a')][_0x738c('0x4c')]=_0x56e392;break;case _0x738c('0x4d'):if(_0x2be196[_0x738c('0x4e')]===_0x738c('0x42')){_0x36a58f[_0x738c('0x4f')][_0x3be2af](_0x738c('0x50'),'%'+_0x2be196[_0x738c('0x3d')]+'%',null);}else{_0x20a22f=_[_0x738c('0x39')](_0x508e47,[_0x738c('0xc'),_0x738c('0x51')]);_0x2be196[_0x738c('0xb')]=_0x738c('0x51');_0x1f93f8=as[_0x738c('0x3a')](_0x2d827b,_0x20a22f[_0x738c('0x3b')],_0x2be196);_0x36a58f[_0x738c('0x4f')][_0x3be2af](_0x1f93f8[_0x738c('0x48')],_0x1f93f8[_0x738c('0x3d')][_0x738c('0x49')],_0x1f93f8[_0x738c('0x3d')][_0x738c('0x3e')]);}break;case _0x738c('0x52'):case'plainBody':_0x1f93f8=as[_0x738c('0x3a')]('me',null,_0x2be196);_0x36a58f[_0x738c('0x52')][_0x3be2af](_0x1f93f8[_0x738c('0x48')],_0x1f93f8[_0x738c('0x3d')][_0x738c('0x49')],_0x1f93f8[_0x738c('0x3d')]['end']);break;}}}return _0x36a58f;}function parseModelFields(_0x4ce910,_0x2b02d6,_0x5b18a6){var _0x5ab6a0=utils[_0x738c('0x7')](_0x4ce910);var _0x5b6e9e=squel['expr']();var _0x8d2a7f=_(_0x2b02d6)[_0x738c('0x53')]()['map'](function(_0x15e419){return _['some'](_0x5b18a6,[_0x738c('0xc'),_0x15e419])?_0x15e419:undefined;})['compact']()[_0x738c('0x3d')]();if(_0x8d2a7f[_0x738c('0x38')]>0x0){_0x8d2a7f[_0x738c('0x54')](function(_0x26c656){if(_0x26c656===_0x5ab6a0){_0x5b6e9e['and']('i.'+_0x5ab6a0+_0x738c('0x55'),[][_0x738c('0x56')](_0x2b02d6[_0x26c656]));}else if(_0x26c656==='createdAt'){var _0x4e5501=JSON['parse'](_0x2b02d6[_0x26c656])[_0x738c('0x57')];var _0x3ff3cb=JSON['parse'](_0x2b02d6[_0x26c656])[_0x738c('0x58')];_0x5b6e9e[_0x738c('0x40')]('i.createdAt\x20BETWEEN\x20?\x20AND\x20?',_0x4e5501,_0x3ff3cb);}else{if(_0x2b02d6[_0x26c656]===_0x738c('0x59')){_0x5b6e9e['and']('i.'+_0x26c656+_0x738c('0x5a'));}else{_0x5b6e9e['and']('i.'+_0x26c656+_0x738c('0x5b'),_0x2b02d6[_0x26c656]);}}});}return _0x5b6e9e;}function parseQueryParameters(_0x24a4e5,_0x23ffca,_0x1c8ceb){var _0x1b8a52=getSqlClauses();return Promise[_0x738c('0x5c')]()[_0x738c('0x5d')](function(){return parseModelFields(_0x24a4e5,_0x23ffca,_0x1c8ceb);})[_0x738c('0x5d')](function(_0x15bb0a){_0x1b8a52[_0x738c('0x5e')][_0x738c('0x40')](_0x15bb0a);return parseReadParameter(_0x23ffca[_0x738c('0x5f')]);})[_0x738c('0x5d')](function(_0x2ffb73){_0x1b8a52['read'][_0x738c('0x40')](_0x2ffb73);return parseTagParameter(_0x23ffca['tag']);})['then'](function(_0x5a68c1){_0x1b8a52[_0x738c('0x4a')]['clause']['and'](_0x5a68c1);return parseSearchFilter(_0x24a4e5,_0x23ffca[_0x738c('0x60')]);})[_0x738c('0x5d')](function(_0x218e58){_0x1b8a52[_0x738c('0x60')]=_0x218e58;return _0x1b8a52;});}function checkAccountsRestrictions(_0x311170,_0x578d26,_0x2514ca){var _0x4e680c=utils[_0x738c('0x7')](_0x311170);var _0x16fd48=_0x738c('0x61')+_[_0x738c('0x62')](_0x311170)+(_0x311170==='chat'?_0x738c('0x63'):_0x738c('0x64'));var _0x5a12ac=squel[_0x738c('0x23')]();return Promise[_0x738c('0x5c')]()[_0x738c('0x5d')](function(){if(_0x2514ca[_0x738c('0xa')]&&_0x578d26[_0x738c('0x8')]===_0x738c('0x9')){return _0x578d26[_0x16fd48]({'attributes':['id'],'raw':!![]});}})['then'](function(_0x4fa9ee){if(_0x4fa9ee){if(_0x4fa9ee[_0x738c('0x38')]===0x0){_0x5a12ac[_0x738c('0x40')]('i.'+_0x4e680c+'\x20IS\x20NULL');}else{_0x5a12ac[_0x738c('0x40')]('i.'+_0x4e680c+_0x738c('0x55'),_[_0x738c('0x16')](_0x4fa9ee,'id'));}}else if(!_0x2514ca[_0x4e680c]){_0x5a12ac[_0x738c('0x40')]('i.'+_0x4e680c+_0x738c('0x65'));}})[_0x738c('0x5d')](function(){return _0x5a12ac;});}function getClosedOrderClause(_0xb77ede,_0x2cdc31){var _0x2ba8c4='';var _0x26d18c=[_0x738c('0x66'),_0x738c('0x67'),_0x738c('0x68')];if(_0xb77ede==='mail'){_0x26d18c[_0x738c('0x69')](_0x738c('0x6a'));}if(_0x2cdc31['closed']==='0'&&_0xb77ede===_0x738c('0x2f')){_0x2ba8c4='i.substatus';}else{if(_0x2cdc31[_0x738c('0x6b')]==='1'){_0x26d18c['shift']();}_0x2ba8c4=_0x738c('0x6c')+_0x26d18c['join'](',\x20')+')';}return _0x2ba8c4;}function getFilteredInteractions(_0x85927c,_0x7dffc7,_0x4d07f9,_0x2b8c88){var _0x4d3c17=utils['getInteractionFK'](_0x85927c);var _0x28a60b=_[_0x738c('0x62')](_0x85927c)+_0x738c('0x6d');var _0x29ea5b=[];var _0x2f8785=getTagsQuery();var _0x456206={'type':db['Sequelize'][_0x738c('0x6e')]['SELECT'],'raw':!![]};var _0x8cf392=[];var _0x56a0a6=[];return db[_0x738c('0x6f')][_0x738c('0x70')](_0x2f8785[_0x738c('0x71')](),_0x456206)[_0x738c('0x5d')](function(_0x5efa48){_0x29ea5b=_['keyBy'](_0x5efa48,'id');_0x456206=_[_0x738c('0x72')](_0x456206,{'model':db[_0x28a60b],'mapToModel':!![],'nest':!![]});if(_0x4d07f9[_0x738c('0x5e')]){_0x2b8c88[_0x738c('0x73')][_0x738c('0x54')](function(_0xf21d2a){_0x7dffc7['field']('i.'+_0xf21d2a);});}else{_0x7dffc7[_0x738c('0xb')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x738c('0x3f'));_0x7dffc7[_0x738c('0xb')](_0x738c('0x74'),_0x738c('0x75'));_0x7dffc7[_0x738c('0xb')](_0x738c('0x76'),_0x738c('0x77'));if(_0x85927c===_0x738c('0x2f')){_0x7dffc7['field']('a.email',_0x738c('0x78'));_0x7dffc7[_0x738c('0xb')](_0x738c('0x79'),_0x738c('0x7a'));_0x7dffc7[_0x738c('0xb')](_0x738c('0x7b'));_0x7dffc7[_0x738c('0xb')](_0x738c('0x7c'));_0x7dffc7[_0x738c('0xb')]('i.updatedAt');_0x7dffc7['field'](_0x738c('0x7d'));_0x7dffc7[_0x738c('0xb')](_0x738c('0x7e'));_0x7dffc7[_0x738c('0xb')](_0x738c('0x7f'));_0x7dffc7[_0x738c('0xb')](_0x738c('0x80'));_0x7dffc7['field'](_0x738c('0x81'));_0x7dffc7[_0x738c('0xb')](_0x738c('0x82'));_0x7dffc7[_0x738c('0xb')](_0x738c('0x68'));_0x7dffc7[_0x738c('0xb')]('i.secondDisposition');_0x7dffc7[_0x738c('0xb')](_0x738c('0x66'));_0x7dffc7[_0x738c('0xb')](_0x738c('0x6a'));_0x7dffc7[_0x738c('0xb')](_0x738c('0x83'));_0x7dffc7[_0x738c('0xb')]('i.ContactId');_0x7dffc7['field'](_0x738c('0x84'));_0x7dffc7[_0x738c('0xb')]('i.UserId');}else if(_0x85927c===_0x738c('0x85')){_0x7dffc7['field'](_0x738c('0x86'),_0x738c('0x7a'));}else{_0x7dffc7[_0x738c('0xb')](_0x738c('0x87'),_0x738c('0x7a'));}if(_0x85927c!=='mail'){_0x7dffc7['field']('i.*');}_0x7dffc7[_0x738c('0xb')](_0x738c('0x88'),_0x738c('0x89'));_0x7dffc7[_0x738c('0xb')](_0x738c('0x8a'),_0x738c('0x8b'));_0x7dffc7[_0x738c('0xb')]('c.email','Contact.email');_0x7dffc7['field'](_0x738c('0x8c'),'Contact.phone');_0x7dffc7[_0x738c('0xb')]('c.mobile','Contact.mobile');_0x7dffc7[_0x738c('0xb')]('c.fax',_0x738c('0x8d'));_0x7dffc7[_0x738c('0xb')](_0x738c('0x8e'),_0x738c('0x8f'));_0x7dffc7[_0x738c('0xb')](_0x738c('0x90'),'Owner.internal');_0x7dffc7['field'](_0x738c('0x91'),'TagIds');}if(_0x2b8c88[_0x738c('0x92')]){_0x7dffc7[_0x738c('0x92')](_0x2b8c88['limit']);}if(_0x2b8c88[_0x738c('0x93')]){_0x7dffc7[_0x738c('0x93')](_0x2b8c88[_0x738c('0x93')]);}return db[_0x738c('0x6f')]['query'](_0x7dffc7[_0x738c('0x71')](),_0x456206);})[_0x738c('0x5d')](function(_0x6f81ff){_0x8cf392=_0x6f81ff;var _0x3097f8=getUsersQuery(_0x85927c,_0x8cf392);return db[_0x738c('0x6f')]['query'](_0x3097f8[_0x738c('0x71')](),_0x456206);})[_0x738c('0x5d')](function(_0x5b8f90){_0x56a0a6=_[_0x738c('0x94')](_0x5b8f90,_0x4d3c17);if(_0x85927c===_0x738c('0x2f')){return db[_0x738c('0x95')][_0x738c('0x96')]({'attributes':[_0x738c('0x97')],'raw':!![]});}})[_0x738c('0x5d')](function(_0x1a8073){var _0x4bd5b7=_0x1a8073?_0x1a8073[_0x738c('0x97')]:undefined;var _0x291836=_0x8cf392['map'](function(_0x5844b6){return updateInteraction(_0x5844b6,_0x29ea5b,_0x56a0a6,_0x4bd5b7);});return Promise[_0x738c('0x98')](_0x291836);});}function countFilteredInteractions(_0x10281d,_0x48665c){var _0x4c79ca=_0x10281d['clone']();_0x4c79ca[_0x738c('0xb')](_0x738c('0x99'));_0x4c79ca[_0x738c('0xb')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x738c('0x3f'));var _0x4b29dc=utils['getSelectedTags'](_0x48665c);if(!_[_0x738c('0x9a')](_0x4b29dc)){_0x4c79ca[_0x738c('0x14')](_0x738c('0x9b'),_0x4b29dc);}var _0x5474a9={'type':db[_0x738c('0x9c')][_0x738c('0x6e')][_0x738c('0x9d')],'raw':!![]};return db[_0x738c('0x6f')]['query'](_0x4c79ca['toString'](),_0x5474a9);}module['exports']={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file +var _0xd5c8=['read','and','Contact','operator','$substring','split','contact','c.firstName\x20LIKE\x20?\x20OR\x20c.lastName\x20LIKE\x20?\x20OR\x20c.email\x20LIKE\x20?','ContactId','Tag','map','tags','ids','user','CONCAT_WS(\x27\x20\x27,\x20o.name,\x20o.fullname)\x20LIKE\x20?','UserId','text','body','plainBody','keys','some','compact','concat','createdAt','$gte','i.createdAt\x20BETWEEN\x20?\x20AND\x20?','null','\x20IS\x20NULL','\x20=\x20?','resolve','then','fields','tag','clause','filter','get','capitalize','Websites','Accounts','\x20IS\x20NOT\x20NULL','i.thirdDisposition','i.secondDisposition','i.disposition','unshift','i.substatus','closed','CONCAT_WS(\x27\x27,\x20','join','Interaction','Sequelize','QueryTypes','SELECT','sequelize','query','merge','attributes','a.key','Account.key','a.mandatoryDisposition','Account.email','CASE\x20WHEN\x20i.to\x20IS\x20NOT\x20NULL\x20AND\x20i.to\x20<>\x20\x27\x27\x20AND\x20i.to\x20NOT\x20LIKE\x20CONCAT(\x27%\x27,\x20a.email,\x20\x27%\x27)\x20THEN\x20TRIM(SUBSTRING_INDEX(i.to,\x20\x27<\x27,\x201))\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','i.id','i.createdAt','i.closed','i.closedAt','i.attach','i.lastMsgAt','i.lastMsgDirection','i.to','i.ContactId','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.*','c.firstName','Contact.firstName','Contact.email','Contact.phone','c.mobile','Contact.fax','o.fullname','Owner.fullname','TagIds','limit','offset','toString','Setting','findOne','enableEmailPreview','all','clone','COUNT(*)','SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)','isEmpty','t.id\x20IN\x20?','exports','lodash','../parsers/advancedSearch','../parsers/qs','./update-interaction','updateInteraction','./utils','../../mysqldb','getAccountFK','role','agent','search','select','field','name','from','tools_tags','getInteractionFK','user_has_','ui.','left_join','users','length','where','\x20IN\x20?','getInteractionsTables','interactions','cm_contacts','o.id\x20=\x20i.UserId','accounts','me.','\x20=\x20i.id','interactionsTags','t.id\x20=\x20it.TagId','expr','getSelectedTags','forEach','CONCAT(\x27,\x27,\x20`TagIds`,\x20\x27,\x27)\x20LIKE\x20?','replace','{OPERATOR}','isNumeric','sms','whatsapp','includes','fax','i.fax\x20LIKE\x20?','openchannel','i.from\x20LIKE\x20?','mail','isEmail','getFullTextValue','MATCH\x20(me.plainBody,\x20me.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(me.body)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','MATCH\x20(c.firstName,\x20c.lastName,\x20c.phone,\x20c.mobile,\x20c.fax,\x20c.email)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)','sqlOperator','conditions','find','buildExpression','type','default','start','value','end','unreadMessages'];(function(_0xb875ee,_0x583042){var _0x4c7f3a=function(_0x1f6661){while(--_0x1f6661){_0xb875ee['push'](_0xb875ee['shift']());}};_0x4c7f3a(++_0x583042);}(_0xd5c8,0x19b));var _0x8d5c=function(_0xc69530,_0x57c174){_0xc69530=_0xc69530-0x0;var _0x148a92=_0xd5c8[_0xc69530];return _0x148a92;};'use strict';var _=require(_0x8d5c('0x0'));var squel=require('squel');var as=require(_0x8d5c('0x1'));var qs=require(_0x8d5c('0x2'));var updateInteraction=require(_0x8d5c('0x3'))[_0x8d5c('0x4')];var utils=require(_0x8d5c('0x5'));var db=require(_0x8d5c('0x6'))['db'];function skipInteractionsQuery(_0x3d8f4f,_0x5a609a,_0x5675cb){var _0x24b0e9=![];var _0x26a900=utils[_0x8d5c('0x7')](_0x3d8f4f);if(_0x5a609a[_0x8d5c('0x8')]===_0x8d5c('0x9')&&!_0x5675cb[_0x8d5c('0xa')]&&!_0x5675cb[_0x26a900]){_0x24b0e9=!![];}return _0x24b0e9;}function getTagsQuery(){return squel[_0x8d5c('0xb')]()['field']('id')[_0x8d5c('0xc')](_0x8d5c('0xd'))[_0x8d5c('0xc')]('color')[_0x8d5c('0xe')](_0x8d5c('0xf'));}function getUsersQuery(_0x1c90ba,_0x286838){var _0x31c86c=utils[_0x8d5c('0x10')](_0x1c90ba);var _0x4619cb=_0x8d5c('0x11')+_0x1c90ba+'_interactions';var _0x4083d6=squel[_0x8d5c('0xb')]()[_0x8d5c('0xc')]('u.id')[_0x8d5c('0xc')]('u.fullname')['field'](_0x8d5c('0x12')+_0x31c86c)[_0x8d5c('0xe')](_0x4619cb,'ui')[_0x8d5c('0x13')](_0x8d5c('0x14'),'u','u.id\x20=\x20ui.UserId');if(_0x286838[_0x8d5c('0x15')]>0x0){_0x4083d6[_0x8d5c('0x16')](_0x8d5c('0x12')+_0x31c86c+_0x8d5c('0x17'),_['map'](_0x286838,'id'));}return _0x4083d6;}function getInteractionsQuery(_0x23cd86){var _0x2768b3=utils[_0x8d5c('0x18')](_0x23cd86);var _0x59ebaf=utils[_0x8d5c('0x7')](_0x23cd86);var _0x299e5a=utils[_0x8d5c('0x10')](_0x23cd86);return squel[_0x8d5c('0xb')]()[_0x8d5c('0xe')](_0x2768b3[_0x8d5c('0x19')],'i')[_0x8d5c('0x13')](_0x8d5c('0x1a'),'c','c.id\x20=\x20i.ContactId\x20AND\x20c.deletedAt\x20IS\x20NULL')[_0x8d5c('0x13')](_0x8d5c('0x14'),'o',_0x8d5c('0x1b'))[_0x8d5c('0x13')](_0x2768b3[_0x8d5c('0x1c')],'a','a.id\x20=\x20i.'+_0x59ebaf)[_0x8d5c('0x13')](_0x2768b3['messages'],'me',_0x8d5c('0x1d')+_0x299e5a+_0x8d5c('0x1e'))[_0x8d5c('0x13')](_0x2768b3[_0x8d5c('0x1f')],'it','it.'+_0x299e5a+_0x8d5c('0x1e'))[_0x8d5c('0x13')](_0x8d5c('0xf'),'t',_0x8d5c('0x20'));}function getSqlClauses(){var _0x2696f2={'body':squel[_0x8d5c('0x21')](),'contact':squel[_0x8d5c('0x21')](),'default':squel[_0x8d5c('0x21')](),'fields':squel['expr'](),'filter':squel['expr'](),'read':squel[_0x8d5c('0x21')](),'tags':{'clause':squel[_0x8d5c('0x21')](),'ids':null},'user':squel[_0x8d5c('0x21')]()};return _0x2696f2;}function parseTagParameter(_0xf2ba26){var _0x2dde91=squel[_0x8d5c('0x21')]();if(_0xf2ba26){var _0x23caf1=utils[_0x8d5c('0x22')](_0xf2ba26);_0x23caf1[_0x8d5c('0x23')](function(_0x42cb0b){_0x2dde91['or'](_0x8d5c('0x24'),'%,'+_0x42cb0b+',%');});}return _0x2dde91;}function parseReadParameter(_0x1a4c62){var _0x5925a1='';if(_0x1a4c62){_0x5925a1='unreadMessages\x20{OPERATOR}\x200';if(_0x1a4c62==='1'){_0x5925a1=_0x5925a1[_0x8d5c('0x25')](_0x8d5c('0x26'),'=');}else{_0x5925a1=_0x5925a1[_0x8d5c('0x25')]('{OPERATOR}','>');}}return _0x5925a1;}function parseSearchFilter(_0x523b3c,_0x56a7bd){var _0x2da74a=squel[_0x8d5c('0x21')]();if(_0x56a7bd){var _0x3cd4e4=_0x56a7bd[_0x8d5c('0x25')]('\x5c','\x5c\x5c')[_0x8d5c('0x25')](/'/g,'\x27\x27');if(qs[_0x8d5c('0x27')](_0x3cd4e4)){_0x2da74a['or']('i.id\x20LIKE\x20?',_0x3cd4e4+'%');if([_0x8d5c('0x28'),_0x8d5c('0x29')][_0x8d5c('0x2a')](_0x523b3c)){_0x2da74a['or']('i.phone\x20LIKE\x20?',_0x3cd4e4+'%');}else if(_0x523b3c===_0x8d5c('0x2b')){_0x2da74a['or'](_0x8d5c('0x2c'),_0x3cd4e4+'%');}else if(_0x523b3c===_0x8d5c('0x2d')){_0x2da74a['or'](_0x8d5c('0x2e'),_0x3cd4e4+'%');}}else if(_0x523b3c===_0x8d5c('0x2f')&&qs[_0x8d5c('0x30')](_0x3cd4e4)){_0x2da74a['or']('c.email\x20LIKE\x20?',_0x3cd4e4+'%');}else{if(_0x523b3c===_0x8d5c('0x2f')){_0x2da74a['or']('MATCH\x20(i.to,\x20i.subject)\x20AGAINST\x20(?\x20IN\x20BOOLEAN\x20MODE)',qs[_0x8d5c('0x31')](_0x3cd4e4,!![]))['or'](_0x8d5c('0x32'),qs[_0x8d5c('0x31')](_0x3cd4e4));}else if(_0x523b3c!==_0x8d5c('0x2b')){_0x2da74a['or'](_0x8d5c('0x33'),qs['getFullTextValue'](_0x3cd4e4));}_0x2da74a['or'](_0x8d5c('0x34'),qs[_0x8d5c('0x31')](_0x3cd4e4,!![]),null);}}return _0x2da74a;}function parseAdvancedSearchFilter(_0x3730b1,_0x24e7f5){var _0x4ed8c2=getSqlClauses();var _0x11bd88=as['parseSearch'](_0x3730b1);var _0x551b8a=_0x11bd88[_0x8d5c('0x35')];for(var _0x55d920=0x0;_0x55d920<_0x11bd88['conditions'][_0x8d5c('0x15')];_0x55d920++){var _0x5111b0=_0x11bd88[_0x8d5c('0x36')][_0x55d920];var _0x2c6241='i';var _0x1f8735=_[_0x8d5c('0x37')](_0x24e7f5,[_0x8d5c('0xd'),_0x5111b0[_0x8d5c('0xc')]]);if(_0x1f8735){var _0x195148=as[_0x8d5c('0x38')](_0x2c6241,_0x1f8735[_0x8d5c('0x39')],_0x5111b0);_0x4ed8c2[_0x8d5c('0x3a')][_0x551b8a](_0x195148['text'],_0x195148['value'][_0x8d5c('0x3b')],_0x195148[_0x8d5c('0x3c')][_0x8d5c('0x3d')]);}else{switch(_0x5111b0['field']){case _0x8d5c('0x3e'):var _0x8c152=parseReadParameter(_0x5111b0['value']);_0x4ed8c2[_0x8d5c('0x3f')][_0x8d5c('0x40')](_0x8c152);break;case _0x8d5c('0x41'):if(_0x5111b0[_0x8d5c('0x42')]===_0x8d5c('0x43')){if(_0x5111b0['value'][_0x8d5c('0x44')]('\x20')[_0x8d5c('0x15')]>0x1){_0x4ed8c2[_0x8d5c('0x45')][_0x551b8a](_0x8d5c('0x34'),qs[_0x8d5c('0x31')](_0x5111b0[_0x8d5c('0x3c')],!![]),null);}else{var _0x874de1='%'+_0x5111b0[_0x8d5c('0x3c')]+'%';_0x4ed8c2[_0x8d5c('0x45')][_0x551b8a](_0x8d5c('0x46'),_0x874de1,_0x874de1,_0x874de1);}}else{_0x1f8735=_[_0x8d5c('0x37')](_0x24e7f5,[_0x8d5c('0xd'),_0x8d5c('0x47')]);_0x5111b0[_0x8d5c('0xc')]=_0x8d5c('0x47');_0x195148=as[_0x8d5c('0x38')](_0x2c6241,_0x1f8735['type'],_0x5111b0);_0x4ed8c2[_0x8d5c('0x45')][_0x551b8a](_0x195148['text'],_0x195148[_0x8d5c('0x3c')]['start'],_0x195148[_0x8d5c('0x3c')]['end']);}break;case _0x8d5c('0x48'):var _0x2355b1=_0x5111b0[_0x8d5c('0x3c')][_0x8d5c('0x44')](',')[_0x8d5c('0x49')](function(_0x491d49){return Number(_0x491d49);});var _0x2642dc=parseTagParameter(_0x2355b1);_0x4ed8c2[_0x8d5c('0x4a')]['clause'][_0x8d5c('0x40')](_0x2642dc);_0x4ed8c2[_0x8d5c('0x4a')][_0x8d5c('0x4b')]=_0x2355b1;break;case'User':if(_0x5111b0[_0x8d5c('0x42')]==='$substring'){_0x4ed8c2[_0x8d5c('0x4c')][_0x551b8a](_0x8d5c('0x4d'),'%'+_0x5111b0['value']+'%',null);}else{_0x1f8735=_[_0x8d5c('0x37')](_0x24e7f5,[_0x8d5c('0xd'),_0x8d5c('0x4e')]);_0x5111b0['field']=_0x8d5c('0x4e');_0x195148=as[_0x8d5c('0x38')](_0x2c6241,_0x1f8735[_0x8d5c('0x39')],_0x5111b0);_0x4ed8c2[_0x8d5c('0x4c')][_0x551b8a](_0x195148[_0x8d5c('0x4f')],_0x195148[_0x8d5c('0x3c')][_0x8d5c('0x3b')],_0x195148[_0x8d5c('0x3c')][_0x8d5c('0x3d')]);}break;case _0x8d5c('0x50'):case _0x8d5c('0x51'):_0x195148=as[_0x8d5c('0x38')]('me',null,_0x5111b0);_0x4ed8c2[_0x8d5c('0x50')][_0x551b8a](_0x195148[_0x8d5c('0x4f')],_0x195148['value'][_0x8d5c('0x3b')],_0x195148['value'][_0x8d5c('0x3d')]);break;}}}return _0x4ed8c2;}function parseModelFields(_0x11863f,_0x55524d,_0x24fc9a){var _0x5a81b5=utils[_0x8d5c('0x7')](_0x11863f);var _0x356309=squel['expr']();var _0x196d4e=_(_0x55524d)[_0x8d5c('0x52')]()[_0x8d5c('0x49')](function(_0x4dcff5){return _[_0x8d5c('0x53')](_0x24fc9a,[_0x8d5c('0xd'),_0x4dcff5])?_0x4dcff5:undefined;})[_0x8d5c('0x54')]()[_0x8d5c('0x3c')]();if(_0x196d4e['length']>0x0){_0x196d4e[_0x8d5c('0x23')](function(_0x592c3c){if(_0x592c3c===_0x5a81b5){_0x356309[_0x8d5c('0x40')]('i.'+_0x5a81b5+_0x8d5c('0x17'),[][_0x8d5c('0x55')](_0x55524d[_0x592c3c]));}else if(_0x592c3c===_0x8d5c('0x56')){var _0x1cb540=JSON['parse'](_0x55524d[_0x592c3c])[_0x8d5c('0x57')];var _0xd3d069=JSON['parse'](_0x55524d[_0x592c3c])['$lte'];_0x356309[_0x8d5c('0x40')](_0x8d5c('0x58'),_0x1cb540,_0xd3d069);}else{if(_0x55524d[_0x592c3c]===_0x8d5c('0x59')){_0x356309['and']('i.'+_0x592c3c+_0x8d5c('0x5a'));}else{_0x356309['and']('i.'+_0x592c3c+_0x8d5c('0x5b'),_0x55524d[_0x592c3c]);}}});}return _0x356309;}function parseQueryParameters(_0x4f5ac0,_0x5381de,_0x1af023){var _0x4ed231=getSqlClauses();return Promise[_0x8d5c('0x5c')]()[_0x8d5c('0x5d')](function(){return parseModelFields(_0x4f5ac0,_0x5381de,_0x1af023);})[_0x8d5c('0x5d')](function(_0x738ccb){_0x4ed231[_0x8d5c('0x5e')]['and'](_0x738ccb);return parseReadParameter(_0x5381de['read']);})[_0x8d5c('0x5d')](function(_0x265e57){_0x4ed231[_0x8d5c('0x3f')][_0x8d5c('0x40')](_0x265e57);return parseTagParameter(_0x5381de[_0x8d5c('0x5f')]);})[_0x8d5c('0x5d')](function(_0x104c6f){_0x4ed231[_0x8d5c('0x4a')][_0x8d5c('0x60')][_0x8d5c('0x40')](_0x104c6f);return parseSearchFilter(_0x4f5ac0,_0x5381de[_0x8d5c('0x61')]);})[_0x8d5c('0x5d')](function(_0x4dd13d){_0x4ed231['filter']=_0x4dd13d;return _0x4ed231;});}function checkAccountsRestrictions(_0x1261fd,_0x12cfc3,_0x143881){var _0x4fd44e=utils[_0x8d5c('0x7')](_0x1261fd);var _0xb2034d=_0x8d5c('0x62')+_[_0x8d5c('0x63')](_0x1261fd)+(_0x1261fd==='chat'?_0x8d5c('0x64'):_0x8d5c('0x65'));var _0xa92b8b=squel[_0x8d5c('0x21')]();return Promise[_0x8d5c('0x5c')]()[_0x8d5c('0x5d')](function(){if(_0x143881[_0x8d5c('0xa')]&&_0x12cfc3[_0x8d5c('0x8')]==='agent'){return _0x12cfc3[_0xb2034d]({'attributes':['id'],'raw':!![]});}})[_0x8d5c('0x5d')](function(_0x3ca865){if(_0x3ca865){if(_0x3ca865[_0x8d5c('0x15')]===0x0){_0xa92b8b[_0x8d5c('0x40')]('i.'+_0x4fd44e+_0x8d5c('0x5a'));}else{_0xa92b8b[_0x8d5c('0x40')]('i.'+_0x4fd44e+_0x8d5c('0x17'),_[_0x8d5c('0x49')](_0x3ca865,'id'));}}else if(!_0x143881[_0x4fd44e]){_0xa92b8b['and']('i.'+_0x4fd44e+_0x8d5c('0x66'));}})[_0x8d5c('0x5d')](function(){return _0xa92b8b;});}function getClosedOrderClause(_0x47f511,_0x4477f2){var _0x527a32='';var _0x1d69ae=[_0x8d5c('0x67'),_0x8d5c('0x68'),_0x8d5c('0x69')];if(_0x47f511===_0x8d5c('0x2f')){_0x1d69ae[_0x8d5c('0x6a')](_0x8d5c('0x6b'));}if(_0x4477f2['closed']==='0'&&_0x47f511==='mail'){_0x527a32=_0x8d5c('0x6b');}else{if(_0x4477f2[_0x8d5c('0x6c')]==='1'){_0x1d69ae['shift']();}_0x527a32=_0x8d5c('0x6d')+_0x1d69ae[_0x8d5c('0x6e')](',\x20')+')';}return _0x527a32;}function getFilteredInteractions(_0x3a42b0,_0x1411f2,_0x46d0e5,_0x44c104){var _0x577595=utils[_0x8d5c('0x10')](_0x3a42b0);var _0x50dd6b=_['capitalize'](_0x3a42b0)+_0x8d5c('0x6f');var _0x25729c=[];var _0x246737=getTagsQuery();var _0x4bde7a={'type':db[_0x8d5c('0x70')][_0x8d5c('0x71')][_0x8d5c('0x72')],'raw':!![]};var _0x312462=[];var _0x114d3d=[];return db[_0x8d5c('0x73')][_0x8d5c('0x74')](_0x246737['toString'](),_0x4bde7a)['then'](function(_0x38c3ba){_0x25729c=_['keyBy'](_0x38c3ba,'id');_0x4bde7a=_[_0x8d5c('0x75')](_0x4bde7a,{'model':db[_0x50dd6b],'mapToModel':!![],'nest':!![]});if(_0x46d0e5['fields']){_0x44c104[_0x8d5c('0x76')]['forEach'](function(_0x49659f){_0x1411f2[_0x8d5c('0xc')]('i.'+_0x49659f);});}else{_0x1411f2[_0x8d5c('0xc')]('SUM(me.read\x20=\x200\x20AND\x20me.direction\x20=\x20\x27in\x27)',_0x8d5c('0x3e'));_0x1411f2[_0x8d5c('0xc')](_0x8d5c('0x77'),_0x8d5c('0x78'));_0x1411f2['field'](_0x8d5c('0x79'),'Account.mandatoryDisposition');if(_0x3a42b0===_0x8d5c('0x2f')){_0x1411f2[_0x8d5c('0xc')]('a.email',_0x8d5c('0x7a'));_0x1411f2[_0x8d5c('0xc')](_0x8d5c('0x7b'),'contactName');_0x1411f2[_0x8d5c('0xc')](_0x8d5c('0x7c'));_0x1411f2['field'](_0x8d5c('0x7d'));_0x1411f2[_0x8d5c('0xc')]('i.updatedAt');_0x1411f2[_0x8d5c('0xc')](_0x8d5c('0x7e'));_0x1411f2['field'](_0x8d5c('0x7f'));_0x1411f2['field'](_0x8d5c('0x80'));_0x1411f2[_0x8d5c('0xc')](_0x8d5c('0x81'));_0x1411f2[_0x8d5c('0xc')](_0x8d5c('0x82'));_0x1411f2[_0x8d5c('0xc')]('i.subject');_0x1411f2['field'](_0x8d5c('0x69'));_0x1411f2[_0x8d5c('0xc')]('i.secondDisposition');_0x1411f2['field']('i.thirdDisposition');_0x1411f2[_0x8d5c('0xc')](_0x8d5c('0x6b'));_0x1411f2['field'](_0x8d5c('0x83'));_0x1411f2['field'](_0x8d5c('0x84'));_0x1411f2[_0x8d5c('0xc')]('i.MailAccountId');_0x1411f2[_0x8d5c('0xc')]('i.UserId');}else if(_0x3a42b0===_0x8d5c('0x2d')){_0x1411f2[_0x8d5c('0xc')](_0x8d5c('0x85'),_0x8d5c('0x86'));}else{_0x1411f2[_0x8d5c('0xc')]('CASE\x20WHEN\x20(c.firstName\x20IS\x20NOT\x20NULL\x20AND\x20c.firstName\x20<>\x20\x27\x27)\x20OR\x20(c.lastName\x20IS\x20NOT\x20NULL\x20AND\x20c.lastName\x20<>\x20\x27\x27)\x20THEN\x20CONCAT(IFNULL(c.firstName,\x20\x27\x27),\x20\x27\x20\x27,\x20IFNULL(c.lastName,\x20\x27\x27))\x20ELSE\x20\x27Unknown\x27\x20END','contactName');}if(_0x3a42b0!=='mail'){_0x1411f2[_0x8d5c('0xc')](_0x8d5c('0x87'));}_0x1411f2[_0x8d5c('0xc')](_0x8d5c('0x88'),_0x8d5c('0x89'));_0x1411f2['field']('c.lastName','Contact.lastName');_0x1411f2['field']('c.email',_0x8d5c('0x8a'));_0x1411f2[_0x8d5c('0xc')]('c.phone',_0x8d5c('0x8b'));_0x1411f2[_0x8d5c('0xc')](_0x8d5c('0x8c'),'Contact.mobile');_0x1411f2[_0x8d5c('0xc')]('c.fax',_0x8d5c('0x8d'));_0x1411f2['field'](_0x8d5c('0x8e'),_0x8d5c('0x8f'));_0x1411f2['field']('o.internal','Owner.internal');_0x1411f2[_0x8d5c('0xc')]('GROUP_CONCAT(DISTINCT\x20t.id)',_0x8d5c('0x90'));}if(_0x44c104[_0x8d5c('0x91')]){_0x1411f2['limit'](_0x44c104['limit']);}if(_0x44c104[_0x8d5c('0x92')]){_0x1411f2[_0x8d5c('0x92')](_0x44c104[_0x8d5c('0x92')]);}return db[_0x8d5c('0x73')][_0x8d5c('0x74')](_0x1411f2[_0x8d5c('0x93')](),_0x4bde7a);})['then'](function(_0x33922e){_0x312462=_0x33922e;var _0x5eb2b5=getUsersQuery(_0x3a42b0,_0x312462);return db[_0x8d5c('0x73')][_0x8d5c('0x74')](_0x5eb2b5[_0x8d5c('0x93')](),_0x4bde7a);})[_0x8d5c('0x5d')](function(_0x11aa3a){_0x114d3d=_['groupBy'](_0x11aa3a,_0x577595);if(_0x3a42b0===_0x8d5c('0x2f')){return db[_0x8d5c('0x94')][_0x8d5c('0x95')]({'attributes':[_0x8d5c('0x96')],'raw':!![]});}})[_0x8d5c('0x5d')](function(_0x56f972){var _0x3c73e1=_0x56f972?_0x56f972[_0x8d5c('0x96')]:undefined;var _0x4019cf=_0x312462[_0x8d5c('0x49')](function(_0x3495d0){return updateInteraction(_0x3495d0,_0x25729c,_0x114d3d,_0x3c73e1);});return Promise[_0x8d5c('0x97')](_0x4019cf);});}function countFilteredInteractions(_0x57cab6,_0x485fc2){var _0x3277e1=_0x57cab6[_0x8d5c('0x98')]();_0x3277e1[_0x8d5c('0xc')](_0x8d5c('0x99'));_0x3277e1[_0x8d5c('0xc')](_0x8d5c('0x9a'),_0x8d5c('0x3e'));var _0x5461bf=utils[_0x8d5c('0x22')](_0x485fc2);if(!_[_0x8d5c('0x9b')](_0x5461bf)){_0x3277e1[_0x8d5c('0x16')](_0x8d5c('0x9c'),_0x5461bf);}var _0x23da04={'type':db[_0x8d5c('0x70')][_0x8d5c('0x71')][_0x8d5c('0x72')],'raw':!![]};return db[_0x8d5c('0x73')][_0x8d5c('0x74')](_0x3277e1[_0x8d5c('0x93')](),_0x23da04);}module[_0x8d5c('0x9d')]={'checkAccountsRestrictions':checkAccountsRestrictions,'countFilteredInteractions':countFilteredInteractions,'getClosedOrderClause':getClosedOrderClause,'getFilteredInteractions':getFilteredInteractions,'getInteractionsQuery':getInteractionsQuery,'parseAdvancedSearchFilter':parseAdvancedSearchFilter,'parseQueryParameters':parseQueryParameters,'skipInteractionsQuery':skipInteractionsQuery}; \ No newline at end of file diff --git a/server/components/interaction/update-interaction.js b/server/components/interaction/update-interaction.js index f2b7605..782f7e5 100644 --- a/server/components/interaction/update-interaction.js +++ b/server/components/interaction/update-interaction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc1ab=['TagIds','lodash','map','push','waiting','talking','unmanaged','total','closed','disposition','abandoned','UserId','MailMessage','out','plainBody','-id','then','lastMsgText','trimStart','catch','updateInteraction','Users'];(function(_0x50a0b7,_0x5a25f6){var _0x1a7e9a=function(_0xad49b2){while(--_0xad49b2){_0x50a0b7['push'](_0x50a0b7['shift']());}};_0x1a7e9a(++_0x5a25f6);}(_0xc1ab,0x11f));var _0xbc1a=function(_0x223603,_0x29fff3){_0x223603=_0x223603-0x0;var _0x416d6e=_0xc1ab[_0x223603];return _0x416d6e;};'use strict';var _=require(_0xbc1a('0x0'));var db=require('../../mysqldb')['db'];function getInteractionUsers(_0x7c399b,_0xcc30ac){return new Promise(function(_0x53959f,_0x514456){try{var _0x422e22=[];if(_0xcc30ac[_0x7c399b]){_0x422e22=_0xcc30ac[_0x7c399b][_0xbc1a('0x1')](function(_0xb06ef){return{'id':_0xb06ef['id'],'fullname':_0xb06ef['fullname']};});}return _0x53959f(_0x422e22);}catch(_0x2037d6){_0x514456(_0x2037d6);}});}function getInteractionTags(_0x4e0c64,_0xabc176){var _0x599dea=[];if(_0x4e0c64){_0x4e0c64['split'](',')['forEach'](function(_0xdae03b){_0x599dea[_0xbc1a('0x2')](_0xabc176[_0xdae03b]);});}return _0x599dea;}function updateWaitingCounter(_0x3269cd){if(_0x3269cd[_0xbc1a('0x3')]){_0x3269cd[_0xbc1a('0x3')]-=0x1;}}function updateInteractionCounters(_0x2bef66){_0x2bef66[_0xbc1a('0x3')]=0x0;_0x2bef66[_0xbc1a('0x4')]=0x0;_0x2bef66['answered']=0x0;_0x2bef66[_0xbc1a('0x5')]=0x0;_0x2bef66['abandoned']=0x0;_0x2bef66[_0xbc1a('0x6')]=0x0;if(_0x2bef66[_0xbc1a('0x7')]){if(_0x2bef66[_0xbc1a('0x8')]===_0xbc1a('0x9')){_0x2bef66[_0xbc1a('0x9')]+=0x1;updateWaitingCounter(_0x2bef66);}if(_0x2bef66['UserId']){_0x2bef66['answered']+=0x1;if(_0x2bef66[_0xbc1a('0x4')]){_0x2bef66[_0xbc1a('0x4')]-=0x1;}}else{if(_0x2bef66[_0xbc1a('0x8')]){_0x2bef66[_0xbc1a('0x5')]+=0x1;updateWaitingCounter(_0x2bef66);}}}else{if(!_0x2bef66[_0xbc1a('0xa')]){_0x2bef66['waiting']+=0x1;}if(_0x2bef66[_0xbc1a('0xa')]){_0x2bef66['talking']+=0x1;updateWaitingCounter(_0x2bef66);}}_0x2bef66[_0xbc1a('0x6')]+=0x1;return _0x2bef66;}function getLastMessageText(_0x3c58d5){return db[_0xbc1a('0xb')]['findOne']({'where':{'$and':[{'MailInteractionId':_0x3c58d5['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0xbc1a('0xc')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0xbc1a('0xd')],'order':_0xbc1a('0xe'),'raw':!![]})[_0xbc1a('0xf')](function(_0x196afa){if(_0x196afa&&_0x196afa[_0xbc1a('0xd')]){_0x3c58d5[_0xbc1a('0x10')]=_[_0xbc1a('0x11')](_0x196afa[_0xbc1a('0xd')]);}return _0x3c58d5;})[_0xbc1a('0x12')](function(_0x5d5328){throw _0x5d5328;});}exports[_0xbc1a('0x13')]=function(_0x29ff69,_0xabc65c,_0x295116,_0x4d8d5f){return new Promise(function(_0x4b116e,_0x168379){return getInteractionUsers(_0x29ff69['id'],_0x295116)[_0xbc1a('0xf')](function(_0x4f814f){_0x29ff69[_0xbc1a('0x14')]=_0x4f814f;return getInteractionTags(_0x29ff69[_0xbc1a('0x15')],_0xabc65c);})['then'](function(_0x5e3b4a){_0x29ff69['Tags']=_0x5e3b4a;delete _0x29ff69[_0xbc1a('0x15')];return updateInteractionCounters(_0x29ff69);})[_0xbc1a('0xf')](function(_0x305109){if(_0x4d8d5f){return getLastMessageText(_0x305109);}else{return _0x305109;}})[_0xbc1a('0xf')](function(_0x2d3b14){_0x4b116e(_0x2d3b14);})['catch'](function(_0x4f7525){_0x168379(_0x4f7525);});});}; \ No newline at end of file +var _0x8490=['push','waiting','talking','abandoned','total','closed','disposition','UserId','answered','MailMessage','findOne','out','plainBody','-id','then','lastMsgText','catch','updateInteraction','Users','Tags','TagIds','lodash','../../mysqldb','fullname','split'];(function(_0x4efb56,_0x1ef9b0){var _0x4daf4e=function(_0x34681f){while(--_0x34681f){_0x4efb56['push'](_0x4efb56['shift']());}};_0x4daf4e(++_0x1ef9b0);}(_0x8490,0x1d7));var _0x0849=function(_0x1589dd,_0x2b9d22){_0x1589dd=_0x1589dd-0x0;var _0x1bddd1=_0x8490[_0x1589dd];return _0x1bddd1;};'use strict';var _=require(_0x0849('0x0'));var db=require(_0x0849('0x1'))['db'];function getInteractionUsers(_0x859ed9,_0x317af7){return new Promise(function(_0x3a3d2a,_0x2a4085){try{var _0x43a7d5=[];if(_0x317af7[_0x859ed9]){_0x43a7d5=_0x317af7[_0x859ed9]['map'](function(_0x3c01f0){return{'id':_0x3c01f0['id'],'fullname':_0x3c01f0[_0x0849('0x2')]};});}return _0x3a3d2a(_0x43a7d5);}catch(_0x5f083d){_0x2a4085(_0x5f083d);}});}function getInteractionTags(_0x2f9291,_0x26e392){var _0x2a43ed=[];if(_0x2f9291){_0x2f9291[_0x0849('0x3')](',')['forEach'](function(_0x49a590){_0x2a43ed[_0x0849('0x4')](_0x26e392[_0x49a590]);});}return _0x2a43ed;}function updateWaitingCounter(_0x57de1e){if(_0x57de1e[_0x0849('0x5')]){_0x57de1e[_0x0849('0x5')]-=0x1;}}function updateInteractionCounters(_0x4fac3c){_0x4fac3c[_0x0849('0x5')]=0x0;_0x4fac3c[_0x0849('0x6')]=0x0;_0x4fac3c['answered']=0x0;_0x4fac3c['unmanaged']=0x0;_0x4fac3c[_0x0849('0x7')]=0x0;_0x4fac3c[_0x0849('0x8')]=0x0;if(_0x4fac3c[_0x0849('0x9')]){if(_0x4fac3c[_0x0849('0xa')]==='abandoned'){_0x4fac3c[_0x0849('0x7')]+=0x1;updateWaitingCounter(_0x4fac3c);}if(_0x4fac3c[_0x0849('0xb')]){_0x4fac3c[_0x0849('0xc')]+=0x1;if(_0x4fac3c[_0x0849('0x6')]){_0x4fac3c[_0x0849('0x6')]-=0x1;}}else{if(_0x4fac3c[_0x0849('0xa')]){_0x4fac3c['unmanaged']+=0x1;updateWaitingCounter(_0x4fac3c);}}}else{if(!_0x4fac3c[_0x0849('0xb')]){_0x4fac3c['waiting']+=0x1;}if(_0x4fac3c[_0x0849('0xb')]){_0x4fac3c[_0x0849('0x6')]+=0x1;updateWaitingCounter(_0x4fac3c);}}_0x4fac3c[_0x0849('0x8')]+=0x1;return _0x4fac3c;}function getLastMessageText(_0x2fe435){return db[_0x0849('0xd')][_0x0849('0xe')]({'where':{'$and':[{'MailInteractionId':_0x2fe435['id']},{'$or':[{'direction':'in'},{'$and':[{'direction':_0x0849('0xf')},{'secret':![]},{'UserId':{'$ne':null}}]}]}]},'attributes':[_0x0849('0x10')],'order':_0x0849('0x11'),'raw':!![]})[_0x0849('0x12')](function(_0x2e67b8){if(_0x2e67b8&&_0x2e67b8[_0x0849('0x10')]){_0x2fe435[_0x0849('0x13')]=_['trimStart'](_0x2e67b8[_0x0849('0x10')]);}return _0x2fe435;})[_0x0849('0x14')](function(_0x3ccac3){throw _0x3ccac3;});}exports[_0x0849('0x15')]=function(_0x5a57e0,_0x32095e,_0x155ce2,_0x17c9ee){return new Promise(function(_0xa54298,_0x4dd6c3){return getInteractionUsers(_0x5a57e0['id'],_0x155ce2)[_0x0849('0x12')](function(_0x212e92){_0x5a57e0[_0x0849('0x16')]=_0x212e92;return getInteractionTags(_0x5a57e0['TagIds'],_0x32095e);})[_0x0849('0x12')](function(_0x5ebcf7){_0x5a57e0[_0x0849('0x17')]=_0x5ebcf7;delete _0x5a57e0[_0x0849('0x18')];return updateInteractionCounters(_0x5a57e0);})[_0x0849('0x12')](function(_0x426fbe){if(_0x17c9ee){return getLastMessageText(_0x426fbe);}else{return _0x426fbe;}})[_0x0849('0x12')](function(_0xa5962f){_0xa54298(_0xa5962f);})[_0x0849('0x14')](function(_0x45cfe2){_0x4dd6c3(_0x45cfe2);});});}; \ No newline at end of file diff --git a/server/components/interaction/utils.js b/server/components/interaction/utils.js index d53a392..e455fee 100644 --- a/server/components/interaction/utils.js +++ b/server/components/interaction/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x943c=['info','catch','error','exports','../../mysqldb','../../config/logger','openchannel-interactions','mail-interactions','sms-interactions','chat-interactions','whatsapp-interactions','capitalize','chat','Website','Account','InteractionId','upperFirst','unknown','accounts','_interactions','_interaction_has_tags','_messages','user_has_','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','role','stringify','null','findOne','then','update'];(function(_0x216d45,_0x4989fe){var _0xbaac0b=function(_0x308a41){while(--_0x308a41){_0x216d45['push'](_0x216d45['shift']());}};_0xbaac0b(++_0x4989fe);}(_0x943c,0xd0));var _0xc943=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x943c[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var db=require(_0xc943('0x0'))['db'];var loggers={'openchannel':require(_0xc943('0x1'))(_0xc943('0x2')),'mail':require(_0xc943('0x1'))(_0xc943('0x3')),'fax':require(_0xc943('0x1'))('fax-interactions'),'sms':require('../../config/logger')(_0xc943('0x4')),'chat':require(_0xc943('0x1'))(_0xc943('0x5')),'whatsapp':require('../../config/logger')(_0xc943('0x6'))};function getAccountFK(_0x345879){return _[_0xc943('0x7')](_0x345879)+(_0x345879===_0xc943('0x8')?_0xc943('0x9'):_0xc943('0xa'))+'Id';}function getInteractionFK(_0x230f88){return _[_0xc943('0x7')](_0x230f88)+_0xc943('0xb');}function getInteractionId(_0x3fa421,_0x3d8896,_0x41c4f3){if(_0x3fa421&&_0x3fa421[_[_0xc943('0xc')](_0x41c4f3)+_0xc943('0xb')]){return _0x3fa421[_[_0xc943('0xc')](_0x41c4f3)+_0xc943('0xb')];}else if(_0x3fa421&&_0x3fa421['id']){return _0x3fa421['id'];}else if(_0x3d8896&&_0x3d8896['id']){return _0x3d8896['id'];}else{return _0xc943('0xd');}}function getInteractionsTables(_0x55583b){return{'accounts':_0x55583b+'_'+(_0x55583b==='chat'?'websites':_0xc943('0xe')),'interactions':_0x55583b+_0xc943('0xf'),'interactionsTags':_0x55583b+_0xc943('0x10'),'messages':_0x55583b+_0xc943('0x11'),'userInteractions':_0xc943('0x12')+_0x55583b+_0xc943('0xf')};}function getSelectedTags(_0x32b45b){var _0x21f707=[];if(_0x32b45b){_0x21f707=Array[_0xc943('0x13')](_0x32b45b)?_0x32b45b:[_0x32b45b];}return _0x21f707;}function log(_0x19d41a,_0x27c3cb,_0x3b1cbb,_0x5be78b,_0x132fe5,_0x4ade72){loggers[_0x132fe5[_0xc943('0x14')]()][_0x19d41a](_0xc943('0x15'),_0x4ade72[_0xc943('0x16')](),_0x27c3cb?_0x27c3cb['id']:null,_0x27c3cb?_0x27c3cb[_0xc943('0x17')]:null,_0x27c3cb?_0x27c3cb[_0xc943('0x18')]:null,getInteractionId(_0x3b1cbb,_0x5be78b,_0x132fe5),_0x3b1cbb?JSON[_0xc943('0x19')](_0x3b1cbb):_0xc943('0x1a'));}function updateUser(_0x40741f,_0x14c8e4,_0xb04669,_0x56532f,_0x1b1dc1){db[_['upperFirst'](_0x56532f)+'Interaction'][_0xc943('0x1b')]({'where':{'id':getInteractionId(_0x14c8e4,_0xb04669,_0x56532f)}})[_0xc943('0x1c')](function(_0x283cc8){if(_0x283cc8){return _0x283cc8[_0xc943('0x1d')]({'UserId':_0x40741f?_0x40741f['id']:null});}})[_0xc943('0x1c')](function(_0x4ff440){if(_0x4ff440){log(_0xc943('0x1e'),_0x40741f,_0x14c8e4,_0xb04669,_0x56532f,_0x1b1dc1);}})[_0xc943('0x1f')](function(){log(_0xc943('0x20'),_0x40741f,_0x14c8e4,_0xb04669,_0x56532f,_0x1b1dc1);});}module[_0xc943('0x21')]={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file +var _0xd0fd=['findOne','then','update','catch','error','lodash','../../mysqldb','openchannel-interactions','../../config/logger','fax-interactions','sms-interactions','chat-interactions','whatsapp-interactions','chat','capitalize','InteractionId','upperFirst','unknown','websites','accounts','_interaction_has_tags','_messages','user_has_','_interactions','isArray','toLowerCase','[%s]\x20id=%s\x20name=%s\x20role=%s\x20interaction=%s\x20body=%s','toUpperCase','name','stringify','null','Interaction'];(function(_0xc8939d,_0x5d77c8){var _0x46f913=function(_0x874ee4){while(--_0x874ee4){_0xc8939d['push'](_0xc8939d['shift']());}};_0x46f913(++_0x5d77c8);}(_0xd0fd,0x1e5));var _0xdd0f=function(_0x596354,_0x240a2a){_0x596354=_0x596354-0x0;var _0x5a1131=_0xd0fd[_0x596354];return _0x5a1131;};'use strict';var _=require(_0xdd0f('0x0'));var db=require(_0xdd0f('0x1'))['db'];var loggers={'openchannel':require('../../config/logger')(_0xdd0f('0x2')),'mail':require(_0xdd0f('0x3'))('mail-interactions'),'fax':require(_0xdd0f('0x3'))(_0xdd0f('0x4')),'sms':require(_0xdd0f('0x3'))(_0xdd0f('0x5')),'chat':require(_0xdd0f('0x3'))(_0xdd0f('0x6')),'whatsapp':require(_0xdd0f('0x3'))(_0xdd0f('0x7'))};function getAccountFK(_0x2bef0c){return _['capitalize'](_0x2bef0c)+(_0x2bef0c===_0xdd0f('0x8')?'Website':'Account')+'Id';}function getInteractionFK(_0x19bf22){return _[_0xdd0f('0x9')](_0x19bf22)+_0xdd0f('0xa');}function getInteractionId(_0x3255d3,_0x18dcb7,_0x14345c){if(_0x3255d3&&_0x3255d3[_[_0xdd0f('0xb')](_0x14345c)+_0xdd0f('0xa')]){return _0x3255d3[_['upperFirst'](_0x14345c)+'InteractionId'];}else if(_0x3255d3&&_0x3255d3['id']){return _0x3255d3['id'];}else if(_0x18dcb7&&_0x18dcb7['id']){return _0x18dcb7['id'];}else{return _0xdd0f('0xc');}}function getInteractionsTables(_0x3e0e57){return{'accounts':_0x3e0e57+'_'+(_0x3e0e57===_0xdd0f('0x8')?_0xdd0f('0xd'):_0xdd0f('0xe')),'interactions':_0x3e0e57+'_interactions','interactionsTags':_0x3e0e57+_0xdd0f('0xf'),'messages':_0x3e0e57+_0xdd0f('0x10'),'userInteractions':_0xdd0f('0x11')+_0x3e0e57+_0xdd0f('0x12')};}function getSelectedTags(_0xb2ef10){var _0x39d7c6=[];if(_0xb2ef10){_0x39d7c6=Array[_0xdd0f('0x13')](_0xb2ef10)?_0xb2ef10:[_0xb2ef10];}return _0x39d7c6;}function log(_0x47a9fc,_0x3b0d3c,_0x396541,_0x540af9,_0xed90ae,_0x96961d){loggers[_0xed90ae[_0xdd0f('0x14')]()][_0x47a9fc](_0xdd0f('0x15'),_0x96961d[_0xdd0f('0x16')](),_0x3b0d3c?_0x3b0d3c['id']:null,_0x3b0d3c?_0x3b0d3c[_0xdd0f('0x17')]:null,_0x3b0d3c?_0x3b0d3c['role']:null,getInteractionId(_0x396541,_0x540af9,_0xed90ae),_0x396541?JSON[_0xdd0f('0x18')](_0x396541):_0xdd0f('0x19'));}function updateUser(_0xb445be,_0x2eb41f,_0x5c4b99,_0x3688ba,_0x5190f2){db[_[_0xdd0f('0xb')](_0x3688ba)+_0xdd0f('0x1a')][_0xdd0f('0x1b')]({'where':{'id':getInteractionId(_0x2eb41f,_0x5c4b99,_0x3688ba)}})[_0xdd0f('0x1c')](function(_0x9c752a){if(_0x9c752a){return _0x9c752a[_0xdd0f('0x1d')]({'UserId':_0xb445be?_0xb445be['id']:null});}})[_0xdd0f('0x1c')](function(_0x1664d8){if(_0x1664d8){log('info',_0xb445be,_0x2eb41f,_0x5c4b99,_0x3688ba,_0x5190f2);}})[_0xdd0f('0x1e')](function(){log(_0xdd0f('0x1f'),_0xb445be,_0x2eb41f,_0x5c4b99,_0x3688ba,_0x5190f2);});}module['exports']={'getAccountFK':getAccountFK,'getInteractionFK':getInteractionFK,'getInteractionsTables':getInteractionsTables,'getSelectedTags':getSelectedTags,'updateUser':updateUser}; \ No newline at end of file diff --git a/server/components/license/service.js b/server/components/license/service.js index 2f72b03..a8e50a7 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 _0xfadd=['parse','hasOwnProperty','use','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','admin','user','crypto','composable-middleware','../../mysqldb','../../config/environment','data1','split','aes-256-ctr','format','%s:%s:%s','utf8','final'];(function(_0x21246d,_0x24d050){var _0x2dadff=function(_0x445e9e){while(--_0x445e9e){_0x21246d['push'](_0x21246d['shift']());}};_0x2dadff(++_0x24d050);}(_0xfadd,0x12d));var _0xdfad=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xfadd[_0x20a584];return _0x4b41a8;};'use strict';var crypto=require(_0xdfad('0x0'));var util=require('util');var compose=require(_0xdfad('0x1'));var db=require(_0xdfad('0x2'))['db'];var config=require(_0xdfad('0x3'));function getValueFromLicense(_0x2fc64a,_0x21f0fd){if(_0x2fc64a&&_0x21f0fd){if(_0x21f0fd[_0xdfad('0x4')]&&_0x21f0fd['license']){var _0x54d599=_0x21f0fd[_0xdfad('0x4')];var _0x1cec3a=_0x21f0fd['license'];var _0x23a830=_0x54d599[_0xdfad('0x5')]('-')[0x4];var _0x3f5309=_0x54d599[_0xdfad('0x5')]('-')[0x0];var _0x320eb6=crypto['createDecipher'](_0xdfad('0x6'),util[_0xdfad('0x7')](_0xdfad('0x8'),_0x23a830,_0x54d599,_0x3f5309));var _0x5c258d=_0x320eb6['update'](_0x1cec3a,'base64',_0xdfad('0x9'));_0x5c258d+=_0x320eb6[_0xdfad('0xa')]('utf8');var _0x4afc0d=JSON[_0xdfad('0xb')](_0x5c258d);return _0x4afc0d[_0xdfad('0xc')](_0x2fc64a)?_0x4afc0d[_0x2fc64a]:null;}}return null;}function isLimit(_0x5e253d,_0x3c8323,_0x5637f3,_0x5af864){var _0xa450c6=_0x3c8323;return compose()[_0xdfad('0xd')](function(_0x3f299e,_0x569556,_0x7ee147){return db['License'][_0xdfad('0xe')]({'where':{'id':0x1},'raw':!![]})[_0xdfad('0xf')](function(_0x319614){var _0x30d259=getValueFromLicense(_0x5e253d,_0x319614);return _0x30d259?_0x30d259:_0xa450c6;})[_0xdfad('0xf')](function(_0x1cccbc){_0xa450c6=_0x1cccbc;return _0x5637f3[_0xdfad('0x10')](_0x5af864);})[_0xdfad('0xf')](function(_0x4116cf){if(_0x4116cf>=_0xa450c6){return _0x569556[_0xdfad('0x11')](0x193)[_0xdfad('0x12')]({'message':util['format'](_0xdfad('0x13'),_0x5e253d)});}_0x7ee147();})[_0xdfad('0x14')](function(_0x4d960d){_0x7ee147(_0x4d960d);});});}function isUserLimit(){return isLimit(_0xdfad('0x15'),0x1,db['User'],{'where':{'$or':[{'role':_0xdfad('0x16')},{'role':_0xdfad('0x17')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file +var _0x4181=['admin','user','crypto','util','../../mysqldb','data1','license','split','aes-256-ctr','format','%s:%s:%s','update','base64','final','utf8','parse','hasOwnProperty','use','findOne','then','count','status','json','Maximum\x20%s\x20limit\x20have\x20been\x20reached','catch','users','User'];(function(_0x569a28,_0x183b7a){var _0x4110c5=function(_0x90a903){while(--_0x90a903){_0x569a28['push'](_0x569a28['shift']());}};_0x4110c5(++_0x183b7a);}(_0x4181,0x197));var _0x1418=function(_0x6cf8e,_0x508a04){_0x6cf8e=_0x6cf8e-0x0;var _0x472932=_0x4181[_0x6cf8e];return _0x472932;};'use strict';var crypto=require(_0x1418('0x0'));var util=require(_0x1418('0x1'));var compose=require('composable-middleware');var db=require(_0x1418('0x2'))['db'];var config=require('../../config/environment');function getValueFromLicense(_0x429d37,_0x1f37f0){if(_0x429d37&&_0x1f37f0){if(_0x1f37f0[_0x1418('0x3')]&&_0x1f37f0[_0x1418('0x4')]){var _0x1d46be=_0x1f37f0['data1'];var _0x55c2ef=_0x1f37f0[_0x1418('0x4')];var _0x3bdb2f=_0x1d46be[_0x1418('0x5')]('-')[0x4];var _0x13b7d6=_0x1d46be['split']('-')[0x0];var _0x158b3a=crypto['createDecipher'](_0x1418('0x6'),util[_0x1418('0x7')](_0x1418('0x8'),_0x3bdb2f,_0x1d46be,_0x13b7d6));var _0x3470c1=_0x158b3a[_0x1418('0x9')](_0x55c2ef,_0x1418('0xa'),'utf8');_0x3470c1+=_0x158b3a[_0x1418('0xb')](_0x1418('0xc'));var _0x3872c2=JSON[_0x1418('0xd')](_0x3470c1);return _0x3872c2[_0x1418('0xe')](_0x429d37)?_0x3872c2[_0x429d37]:null;}}return null;}function isLimit(_0x5f418e,_0x27bcdb,_0x446dc5,_0x4b069f){var _0x1f7b95=_0x27bcdb;return compose()[_0x1418('0xf')](function(_0x4c141f,_0x29bda,_0xb3cfae){return db['License'][_0x1418('0x10')]({'where':{'id':0x1},'raw':!![]})[_0x1418('0x11')](function(_0x3133df){var _0x4765fb=getValueFromLicense(_0x5f418e,_0x3133df);return _0x4765fb?_0x4765fb:_0x1f7b95;})['then'](function(_0x47e5e1){_0x1f7b95=_0x47e5e1;return _0x446dc5[_0x1418('0x12')](_0x4b069f);})[_0x1418('0x11')](function(_0x485c2e){if(_0x485c2e>=_0x1f7b95){return _0x29bda[_0x1418('0x13')](0x193)[_0x1418('0x14')]({'message':util[_0x1418('0x7')](_0x1418('0x15'),_0x5f418e)});}_0xb3cfae();})[_0x1418('0x16')](function(_0x235abd){_0xb3cfae(_0x235abd);});});}function isUserLimit(){return isLimit(_0x1418('0x17'),0x1,db[_0x1418('0x18')],{'where':{'$or':[{'role':_0x1418('0x19')},{'role':_0x1418('0x1a')}]}});}exports['isUserLimit']=isUserLimit; \ No newline at end of file diff --git a/server/components/parsers/advancedSearch.js b/server/components/parsers/advancedSearch.js index 3c19a1b..d0aaafb 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 _0x2d1d=['[$and]','[$or]','split','length','slice','forEach','filter','map','conditions','DATE','operator','$eq','value','includes','$gt','$lte','add','days','YYYY-MM-DD','castTo','text','\x20AS\x20','field','$ne','\x20OR\x20','\x20IS\x20NULL)','$in','IN\x20?','$notIn','NOT\x20IN\x20?','=\x20?','$substring','$startsWith','$endsWith','LIKE\x20?','<\x20?','>\x20?','<=\x20?','$gte','$between','start','pop','utcOffset','format','hours','minutes','seconds','lodash','moment','sqlOperator','and','replace'];(function(_0x4a60c1,_0x3cec26){var _0x2b4f8e=function(_0x3c3e27){while(--_0x3c3e27){_0x4a60c1['push'](_0x4a60c1['shift']());}};_0x2b4f8e(++_0x3cec26);}(_0x2d1d,0xcb));var _0xd2d1=function(_0xbdc8ec,_0x439316){_0xbdc8ec=_0xbdc8ec-0x0;var _0x5543f1=_0x2d1d[_0xbdc8ec];return _0x5543f1;};'use strict';var _=require(_0xd2d1('0x0'));var moment=require(_0xd2d1('0x1'));exports['parseSearch']=function(_0x1df1e3){var _0x10a227={'conditions':[]};_0x10a227[_0xd2d1('0x2')]=_['startsWith'](_0x1df1e3,'[$or]')?'or':_0xd2d1('0x3');var _0x565fc7=_0x1df1e3[_0xd2d1('0x4')](_0xd2d1('0x5'),'')[_0xd2d1('0x4')](_0xd2d1('0x6'),'')[_0xd2d1('0x7')]('||');for(var _0x2158bf=0x0;_0x2158bf<_0x565fc7[_0xd2d1('0x8')];_0x2158bf++){var _0x15bacd=_0x565fc7[_0x2158bf][_0xd2d1('0x7')](':=');var _0x719ffb=_0x15bacd[0x0];var _0x2c948f=_0x15bacd[_0xd2d1('0x9')](0x1);_0x2c948f['forEach'](function(_0xde2626){var _0x341998=_0xde2626[_0xd2d1('0x7')]('[')['shift']();var _0x4eb918=_0xde2626['match'](/\[(.*?)\]/g);_0x4eb918[_0xd2d1('0xa')](function(_0x2432d1){var _0x572703=_0x2432d1[_0xd2d1('0x7')]('[')[_0xd2d1('0xb')](function(_0x1bf7cf){return _0x1bf7cf['indexOf'](']')>-0x1;})[_0xd2d1('0xc')](function(_0x224fb3){return _0x224fb3['split'](']')[0x0];})[0x0];_0x10a227[_0xd2d1('0xd')]['push']({'field':_0x719ffb,'operator':_0x341998,'value':_0x572703});});});}return _0x10a227;};exports['buildExpression']=function(_0x1af80e,_0x2e091f,_0x14a662){var _0x5c34b1={};if(_0x2e091f===_0xd2d1('0xe')){if(_0x14a662[_0xd2d1('0xf')]===_0xd2d1('0x10')){_0x14a662[_0xd2d1('0xf')]='$between';_0x14a662[_0xd2d1('0x11')]+=','+_0x14a662[_0xd2d1('0x11')];}else if(_[_0xd2d1('0x12')]([_0xd2d1('0x13'),_0xd2d1('0x14')],_0x14a662['operator'])){_0x14a662['value']=moment(_0x14a662[_0xd2d1('0x11')])[_0xd2d1('0x15')](0x1,_0xd2d1('0x16'))['format'](_0xd2d1('0x17'));}}if(_0x14a662[_0xd2d1('0x18')]){_0x2e091f=_0x14a662[_0xd2d1('0x18')];_0x5c34b1[_0xd2d1('0x19')]='CAST('+_0x1af80e+'.'+_0x14a662['field']+_0xd2d1('0x1a')+_0x14a662[_0xd2d1('0x18')]+')\x20'+parseOperator(_0x14a662[_0xd2d1('0xf')]);}else{_0x5c34b1[_0xd2d1('0x19')]=_0x1af80e+'.'+_0x14a662[_0xd2d1('0x1b')]+'\x20'+parseOperator(_0x14a662[_0xd2d1('0xf')]);}if(_[_0xd2d1('0x12')]([_0xd2d1('0x1c'),'$notIn'],_0x14a662[_0xd2d1('0xf')]))_0x5c34b1['text']='('+_0x5c34b1[_0xd2d1('0x19')]+_0xd2d1('0x1d')+_0x1af80e+'.'+_0x14a662[_0xd2d1('0x1b')]+_0xd2d1('0x1e');_0x5c34b1[_0xd2d1('0x11')]=parseValue(_0x2e091f,_0x14a662[_0xd2d1('0xf')],_0x14a662[_0xd2d1('0x11')]);return _0x5c34b1;};function parseOperator(_0x4dad9c){var _0x255072;switch(_0x4dad9c){case _0xd2d1('0x1f'):_0x255072=_0xd2d1('0x20');break;case _0xd2d1('0x21'):_0x255072=_0xd2d1('0x22');break;case _0xd2d1('0x10'):_0x255072=_0xd2d1('0x23');break;case'$ne':_0x255072='<>\x20?';break;case _0xd2d1('0x24'):case _0xd2d1('0x25'):case _0xd2d1('0x26'):_0x255072=_0xd2d1('0x27');break;case'$lt':_0x255072=_0xd2d1('0x28');break;case'$gt':_0x255072=_0xd2d1('0x29');break;case _0xd2d1('0x14'):_0x255072=_0xd2d1('0x2a');break;case _0xd2d1('0x2b'):_0x255072='>=\x20?';break;case _0xd2d1('0x2c'):_0x255072='BETWEEN\x20?\x20AND\x20?';break;}return _0x255072;}function parseValue(_0x53d9ce,_0xeb5558,_0x4caa50){var _0x30f781={'start':undefined,'end':undefined};switch(_0xeb5558){case _0xd2d1('0x1f'):case _0xd2d1('0x21'):_0x30f781[_0xd2d1('0x2d')]=_0x4caa50['split'](',');break;case'$substring':_0x30f781[_0xd2d1('0x2d')]='%'+_0x4caa50+'%';break;case _0xd2d1('0x25'):_0x30f781['start']=_0x4caa50+'%';break;case _0xd2d1('0x26'):_0x30f781[_0xd2d1('0x2d')]='%'+_0x4caa50;break;case _0xd2d1('0x2c'):var _0x516191=_0x4caa50[_0xd2d1('0x7')](',');var _0x4caa50=_0x516191['shift']();var _0x1f1924=_0x516191[_0xd2d1('0x2e')]();if(_0x53d9ce===_0xd2d1('0xe')){_0x4caa50=moment(_0x4caa50)[_0xd2d1('0x2f')](0x0,!![])[_0xd2d1('0x30')]();_0x1f1924=moment(_0x1f1924)[_0xd2d1('0x2f')](0x0,!![])[_0xd2d1('0x15')](0x17,_0xd2d1('0x31'))[_0xd2d1('0x15')](0x3b,_0xd2d1('0x32'))[_0xd2d1('0x15')](0x3b,_0xd2d1('0x33'))[_0xd2d1('0x30')]();}_0x30f781={'start':_0x4caa50,'end':_0x1f1924};break;default:_0x30f781[_0xd2d1('0x2d')]=_0x4caa50;break;}return _0x30f781;} \ No newline at end of file +var _0xa64a=['\x20OR\x20','$in','IN\x20?','NOT\x20IN\x20?','=\x20?','$ne','<>\x20?','$startsWith','$endsWith','$lt','<\x20?','>\x20?','<=\x20?','$gte','>=\x20?','BETWEEN\x20?\x20AND\x20?','start','$substring','pop','utcOffset','minutes','seconds','lodash','parseSearch','sqlOperator','[$or]','[$and]','replace','split','length','forEach','shift','match','filter','map','conditions','push','DATE','operator','$eq','$between','value','includes','$gt','$lte','add','YYYY-MM-DD','castTo','CAST(','field','\x20AS\x20','$notIn','text'];(function(_0x237f8b,_0xc5eddb){var _0x423f94=function(_0x1f18f9){while(--_0x1f18f9){_0x237f8b['push'](_0x237f8b['shift']());}};_0x423f94(++_0xc5eddb);}(_0xa64a,0x154));var _0xaa64=function(_0x1bb5b5,_0x21e900){_0x1bb5b5=_0x1bb5b5-0x0;var _0x15c338=_0xa64a[_0x1bb5b5];return _0x15c338;};'use strict';var _=require(_0xaa64('0x0'));var moment=require('moment');exports[_0xaa64('0x1')]=function(_0x24fb4a){var _0x433d25={'conditions':[]};_0x433d25[_0xaa64('0x2')]=_['startsWith'](_0x24fb4a,_0xaa64('0x3'))?'or':'and';var _0x324bd9=_0x24fb4a['replace'](_0xaa64('0x4'),'')[_0xaa64('0x5')](_0xaa64('0x3'),'')[_0xaa64('0x6')]('||');for(var _0x5eb61d=0x0;_0x5eb61d<_0x324bd9[_0xaa64('0x7')];_0x5eb61d++){var _0xe9ee5f=_0x324bd9[_0x5eb61d][_0xaa64('0x6')](':=');var _0x4607ac=_0xe9ee5f[0x0];var _0x3efaf6=_0xe9ee5f['slice'](0x1);_0x3efaf6[_0xaa64('0x8')](function(_0x6a8af8){var _0x22874a=_0x6a8af8[_0xaa64('0x6')]('[')[_0xaa64('0x9')]();var _0x3fc68f=_0x6a8af8[_0xaa64('0xa')](/\[(.*?)\]/g);_0x3fc68f['forEach'](function(_0x1c406d){var _0x1e1452=_0x1c406d[_0xaa64('0x6')]('[')[_0xaa64('0xb')](function(_0x1ca5e0){return _0x1ca5e0['indexOf'](']')>-0x1;})[_0xaa64('0xc')](function(_0x38f620){return _0x38f620[_0xaa64('0x6')](']')[0x0];})[0x0];_0x433d25[_0xaa64('0xd')][_0xaa64('0xe')]({'field':_0x4607ac,'operator':_0x22874a,'value':_0x1e1452});});});}return _0x433d25;};exports['buildExpression']=function(_0x3175af,_0x481d9d,_0x3b735d){var _0x209682={};if(_0x481d9d===_0xaa64('0xf')){if(_0x3b735d[_0xaa64('0x10')]===_0xaa64('0x11')){_0x3b735d['operator']=_0xaa64('0x12');_0x3b735d[_0xaa64('0x13')]+=','+_0x3b735d[_0xaa64('0x13')];}else if(_[_0xaa64('0x14')]([_0xaa64('0x15'),_0xaa64('0x16')],_0x3b735d[_0xaa64('0x10')])){_0x3b735d[_0xaa64('0x13')]=moment(_0x3b735d['value'])[_0xaa64('0x17')](0x1,'days')['format'](_0xaa64('0x18'));}}if(_0x3b735d['castTo']){_0x481d9d=_0x3b735d[_0xaa64('0x19')];_0x209682['text']=_0xaa64('0x1a')+_0x3175af+'.'+_0x3b735d[_0xaa64('0x1b')]+_0xaa64('0x1c')+_0x3b735d[_0xaa64('0x19')]+')\x20'+parseOperator(_0x3b735d[_0xaa64('0x10')]);}else{_0x209682['text']=_0x3175af+'.'+_0x3b735d[_0xaa64('0x1b')]+'\x20'+parseOperator(_0x3b735d[_0xaa64('0x10')]);}if(_[_0xaa64('0x14')](['$ne',_0xaa64('0x1d')],_0x3b735d['operator']))_0x209682[_0xaa64('0x1e')]='('+_0x209682[_0xaa64('0x1e')]+_0xaa64('0x1f')+_0x3175af+'.'+_0x3b735d['field']+'\x20IS\x20NULL)';_0x209682['value']=parseValue(_0x481d9d,_0x3b735d['operator'],_0x3b735d[_0xaa64('0x13')]);return _0x209682;};function parseOperator(_0x41dfbc){var _0x3f6c9e;switch(_0x41dfbc){case _0xaa64('0x20'):_0x3f6c9e=_0xaa64('0x21');break;case _0xaa64('0x1d'):_0x3f6c9e=_0xaa64('0x22');break;case _0xaa64('0x11'):_0x3f6c9e=_0xaa64('0x23');break;case _0xaa64('0x24'):_0x3f6c9e=_0xaa64('0x25');break;case'$substring':case _0xaa64('0x26'):case _0xaa64('0x27'):_0x3f6c9e='LIKE\x20?';break;case _0xaa64('0x28'):_0x3f6c9e=_0xaa64('0x29');break;case _0xaa64('0x15'):_0x3f6c9e=_0xaa64('0x2a');break;case _0xaa64('0x16'):_0x3f6c9e=_0xaa64('0x2b');break;case _0xaa64('0x2c'):_0x3f6c9e=_0xaa64('0x2d');break;case _0xaa64('0x12'):_0x3f6c9e=_0xaa64('0x2e');break;}return _0x3f6c9e;}function parseValue(_0x1c8574,_0x5eb61f,_0x4c6272){var _0x2fe9e6={'start':undefined,'end':undefined};switch(_0x5eb61f){case'$in':case'$notIn':_0x2fe9e6[_0xaa64('0x2f')]=_0x4c6272[_0xaa64('0x6')](',');break;case _0xaa64('0x30'):_0x2fe9e6[_0xaa64('0x2f')]='%'+_0x4c6272+'%';break;case _0xaa64('0x26'):_0x2fe9e6[_0xaa64('0x2f')]=_0x4c6272+'%';break;case'$endsWith':_0x2fe9e6[_0xaa64('0x2f')]='%'+_0x4c6272;break;case _0xaa64('0x12'):var _0x22327f=_0x4c6272[_0xaa64('0x6')](',');var _0x4c6272=_0x22327f[_0xaa64('0x9')]();var _0x3182b4=_0x22327f[_0xaa64('0x31')]();if(_0x1c8574===_0xaa64('0xf')){_0x4c6272=moment(_0x4c6272)[_0xaa64('0x32')](0x0,!![])['format']();_0x3182b4=moment(_0x3182b4)[_0xaa64('0x32')](0x0,!![])[_0xaa64('0x17')](0x17,'hours')[_0xaa64('0x17')](0x3b,_0xaa64('0x33'))[_0xaa64('0x17')](0x3b,_0xaa64('0x34'))['format']();}_0x2fe9e6={'start':_0x4c6272,'end':_0x3182b4};break;default:_0x2fe9e6['start']=_0x4c6272;break;}return _0x2fe9e6;} \ No newline at end of file diff --git a/server/components/parsers/qs.js b/server/components/parsers/qs.js index 6dd563b..e662ac6 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 _0x4c4f=['includes','parse','keys','fields','split','filters','forOwn','type','DATE','isPlainObject','format','utc','$lte','YYYY-MM-DD','name','uniqueid','isArray','limit','offset','sort','map','indexOf','priority','cast','col','substr','omit','isEmpty','length','isObject','unset','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','forEach','replace','push','{EXPR}','join','getOptions','query','$id','model','intersection','attributes','nolimit','where','pick','filter','object','value','merge','lower','lodash','sequelize'];(function(_0x3a026b,_0x42af55){var _0x4a3dec=function(_0xcfea52){while(--_0xcfea52){_0x3a026b['push'](_0x3a026b['shift']());}};_0x4a3dec(++_0x42af55);}(_0x4c4f,0x18d));var _0xf4c4=function(_0x234bb5,_0x9068d9){_0x234bb5=_0x234bb5-0x0;var _0x18de11=_0x4c4f[_0x234bb5];return _0x18de11;};'use strict';var _=require(_0xf4c4('0x0'));var sequelize=require(_0xf4c4('0x1'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x277ca2){var _0x1f8ac6=['ne'];try{var _0xdb7613=JSON['parse'](_0x277ca2);var _0x2e6fd1=Object['keys'](_0xdb7613)[0x0];return _0x1f8ac6[_0xf4c4('0x2')](_0x2e6fd1);}catch(_0x794a75){return![];}}function getOperatorValue(_0x5d6328){var _0x3b574d=JSON[_0xf4c4('0x3')](_0x5d6328);var _0x430f16=Object[_0xf4c4('0x4')](_0x3b574d)[0x0];var _0x27fc0e=_0x3b574d[_0x430f16];return{['$'+_0x430f16]:_0x27fc0e};}exports[_0xf4c4('0x5')]=function(_0x2470a5){var _0x24ccd1=null;if(_0x2470a5){_0x24ccd1=_0x2470a5[_0xf4c4('0x6')](',');}return _0x24ccd1;};exports[_0xf4c4('0x7')]=function(_0x48f39c,_0x14805c){var _0xf1d2cd={};if(!_['isEmpty'](_0x48f39c)){_[_0xf4c4('0x8')](_0x48f39c,function(_0x11f26e,_0x4aa3f3){try{if(_0x14805c){var _0x1343ab=_['find'](_0x14805c,{'name':_0x4aa3f3})||{};if(hasSequelizeOperator(_0x11f26e)){_0xf1d2cd[_0x4aa3f3]=getOperatorValue(_0x11f26e);}else if(_0x1343ab[_0xf4c4('0x9')]===_0xf4c4('0xa')&&_[_0xf4c4('0xb')](_0x11f26e)){var _0x4d7075=JSON[_0xf4c4('0x3')](_0x11f26e);var _0x4cc0ee={'$gte':moment(moment(_0x4d7075['$gte'])[_0xf4c4('0xc')]('YYYY-MM-DD'))[_0xf4c4('0xd')]()['format'](),'$lte':moment(moment(_0x4d7075[_0xf4c4('0xe')])['format'](_0xf4c4('0xf')))[_0xf4c4('0xd')]()['subtract'](0x1,'s')[_0xf4c4('0xc')]()};_0xf1d2cd[_0x4aa3f3]=_0x4cc0ee;}else if(_0x1343ab[_0xf4c4('0x10')]===_0xf4c4('0x11')){_0xf1d2cd[_0x4aa3f3]=_0x11f26e;}else{_0xf1d2cd[_0x4aa3f3]=_[_0xf4c4('0x12')](_0x11f26e)?_0x11f26e:JSON[_0xf4c4('0x3')](_0x11f26e);}}else{_0xf1d2cd[_0x4aa3f3]=_[_0xf4c4('0x12')](_0x11f26e)?_0x11f26e:JSON[_0xf4c4('0x3')](_0x11f26e);}}catch(_0x2a6fda){_0xf1d2cd[_0x4aa3f3]=_0x11f26e[_0xf4c4('0x6')](',');}});}return _0xf1d2cd;};exports[_0xf4c4('0x13')]=function(_0x557ee3){_0x557ee3=parseInt(_0x557ee3,0xa);if(!_0x557ee3||_0x557ee3<0x0){_0x557ee3=LIMIT_VALUE;}return _0x557ee3;};exports[_0xf4c4('0x14')]=function(_0x2b723a){_0x2b723a=parseInt(_0x2b723a,0xa);if(!_0x2b723a||_0x2b723a<0x0){_0x2b723a=0x0;}return _0x2b723a;};exports[_0xf4c4('0x15')]=function(_0x255e51){var _0x537514,_0x38202c=null;if(_0x255e51){_0x537514=_0x255e51['split'](',');_0x38202c=_[_0xf4c4('0x16')](_0x537514,function(_0x5a0bf2){if(_0x5a0bf2[_0xf4c4('0x17')]('-')===0x0){return[_0x5a0bf2===_0xf4c4('0x18')?sequelize[_0xf4c4('0x19')](sequelize[_0xf4c4('0x1a')](_0xf4c4('0x18')),'unsigned'):_0x5a0bf2[_0xf4c4('0x1b')](0x1),'DESC'];}else{return[_0x5a0bf2===_0xf4c4('0x18')?sequelize['cast'](sequelize['col'](_0xf4c4('0x18')),'unsigned'):_0x5a0bf2,'ASC'];}});}return _0x38202c;};exports[_0xf4c4('0x1c')]=function(_0x316657,_0x5be6c4){if(_[_0xf4c4('0x1d')](_0x316657)){return _0x316657;}if(_[_0xf4c4('0x12')](_0x316657)){for(var _0x5342f4=0x0;_0x5342f4<_0x316657[_0xf4c4('0x1e')];_0x5342f4+=0x1){_0x316657[_0x5342f4]=this[_0xf4c4('0x1c')](_0x316657[_0x5342f4],_0x5be6c4);}return _0x316657;}if(!_[_0xf4c4('0x1f')](_0x316657)){return _0x316657;}if(_['isString'](_0x5be6c4)){_0x5be6c4=[_0x5be6c4];}if(!_[_0xf4c4('0x12')](_0x5be6c4)){return _0x316657;}for(var _0x35addf=0x0;_0x35addf<_0x5be6c4[_0xf4c4('0x1e')];_0x35addf+=0x1){_[_0xf4c4('0x20')](_0x316657,_0x5be6c4[_0x35addf]);}for(var _0xcf99e3 in _0x316657){if(_0x316657['hasOwnProperty'](_0xcf99e3)){_0x316657[_0xcf99e3]=this[_0xf4c4('0x1c')](_0x316657[_0xcf99e3],_0x5be6c4);}}return _0x316657;};exports['isNumeric']=function(_0x24eb8e){return _0x24eb8e[_0xf4c4('0x21')](RegExp(_0xf4c4('0x22')))?!![]:![];};exports[_0xf4c4('0x23')]=function(_0x44ce8d){return _0x44ce8d[_0xf4c4('0x21')](/^\S+@\S+$/)?!![]:![];};exports[_0xf4c4('0x24')]=function(_0x451ca9,_0x4bfcbe){var _0x45c1b9=[];var _0x228932=/[ `!@#$%^&*()_\-?~]/;var _0x5e37a5=_0x4bfcbe?_0xf4c4('0x25'):'{EXPR}';_0x451ca9['split'](/[ ,]+/)[_0xf4c4('0x26')](function(_0x16aa42){_0x16aa42=_0x16aa42[_0xf4c4('0x27')](/([^:]")"+/g,'$1');_0x16aa42='+'+_0x16aa42+'*';var _0x12d823=_0x16aa42[_0xf4c4('0x21')](_0x228932);if(_0x12d823){_0x16aa42='\x22'+_0x16aa42+'\x22';}_0x45c1b9[_0xf4c4('0x28')](_0x16aa42);});_0x5e37a5=_0x5e37a5['replace'](_0xf4c4('0x29'),_0x45c1b9[_0xf4c4('0x2a')]('\x20'));return _0x5e37a5;};exports[_0xf4c4('0x2b')]=function(_0x20f4a5,_0x5cd078,_0x37bce3){var _0x4d2448={},_0xc77b12={};if(_0x5cd078[_0xf4c4('0x2c')]['$id']){_0x5cd078[_0xf4c4('0x2c')]['id']=_0x5cd078[_0xf4c4('0x2c')][_0xf4c4('0x2d')];delete _0x5cd078[_0xf4c4('0x2c')]['$id'];}_0x4d2448[_0xf4c4('0x2e')]=_[_0xf4c4('0x16')](_0x20f4a5,_0xf4c4('0x10'));_0x4d2448[_0xf4c4('0x2c')]=_[_0xf4c4('0x4')](_0x5cd078[_0xf4c4('0x2c')]);_0x4d2448[_0xf4c4('0x7')]=_[_0xf4c4('0x2f')](_0x4d2448[_0xf4c4('0x2e')],_0x4d2448[_0xf4c4('0x2c')]);_0xc77b12[_0xf4c4('0x30')]=_['intersection'](_0x4d2448[_0xf4c4('0x2e')],this['fields'](_0x5cd078['query'][_0xf4c4('0x5')]));_0xc77b12[_0xf4c4('0x30')]=_0xc77b12[_0xf4c4('0x30')]['length']?_0xc77b12[_0xf4c4('0x30')]:_0x4d2448['model'];if(!_0x5cd078[_0xf4c4('0x2c')]['hasOwnProperty'](_0xf4c4('0x31'))){_0xc77b12[_0xf4c4('0x13')]=this[_0xf4c4('0x13')](_0x5cd078[_0xf4c4('0x2c')][_0xf4c4('0x13')]);_0xc77b12[_0xf4c4('0x14')]=this[_0xf4c4('0x14')](_0x5cd078['query'][_0xf4c4('0x14')]);}_0xc77b12['order']=this['sort'](_0x5cd078['query'][_0xf4c4('0x15')]);_0xc77b12[_0xf4c4('0x32')]=this[_0xf4c4('0x7')](_[_0xf4c4('0x33')](_0x5cd078[_0xf4c4('0x2c')],_0x4d2448[_0xf4c4('0x7')]),_0x20f4a5);if(_0x5cd078[_0xf4c4('0x2c')][_0xf4c4('0x34')]){var _0x488a2d=_0x20f4a5;var _0x4b9c48=_0x5cd078['query'][_0xf4c4('0x34')];if(typeof _0x4b9c48===_0xf4c4('0x35')){_0x488a2d=_['filter'](_0x20f4a5,function(_0x10da0b){return _[_0xf4c4('0x2')](_0x4b9c48['columns'],_0x10da0b['name']);});_0x4b9c48=_0x4b9c48[_0xf4c4('0x36')];}_0xc77b12[_0xf4c4('0x32')]=_[_0xf4c4('0x37')](_0xc77b12[_0xf4c4('0x32')],{'$or':_[_0xf4c4('0x16')](_0x488a2d,function(_0x47bd8e){if(_0x47bd8e['type']!=='VIRTUAL'){if(_0x37bce3){return sequelize[_0xf4c4('0x32')](sequelize['fn'](_0xf4c4('0x38'),sequelize[_0xf4c4('0x1a')](_0x47bd8e[_0xf4c4('0x10')])),{'$like':sequelize['fn'](_0xf4c4('0x38'),'%'+_0x5cd078[_0xf4c4('0x2c')][_0xf4c4('0x34')]+'%')});}else{var _0x4345bc={};_0x4345bc[_0x47bd8e[_0xf4c4('0x10')]]={'$like':'%'+_0x5cd078[_0xf4c4('0x2c')][_0xf4c4('0x34')]+'%'};return _0x4345bc;}}})});}_0xc77b12=_[_0xf4c4('0x37')]({},_0xc77b12,_0x5cd078['options']);return _0xc77b12;}; \ No newline at end of file +var _0xa283=['VIRTUAL','lower','col','merge','sequelize','keys','includes','fields','filters','isEmpty','forOwn','find','type','DATE','isPlainObject','parse','$gte','format','YYYY-MM-DD','utc','$lte','subtract','name','isArray','split','offset','sort','map','priority','cast','substr','DESC','unsigned','omit','isObject','isString','unset','hasOwnProperty','isNumeric','match','^[+]?[0-9]*$','isEmail','getFullTextValue','\x22{EXPR}\x22','{EXPR}','replace','push','getOptions','query','model','intersection','attributes','nolimit','limit','where','pick','filter','object','columns','value'];(function(_0x13376b,_0x44fd91){var _0x38759c=function(_0x3782eb){while(--_0x3782eb){_0x13376b['push'](_0x13376b['shift']());}};_0x38759c(++_0x44fd91);}(_0xa283,0x1a8));var _0x3a28=function(_0x244483,_0x50118d){_0x244483=_0x244483-0x0;var _0x5a9d39=_0xa283[_0x244483];return _0x5a9d39;};'use strict';var _=require('lodash');var sequelize=require(_0x3a28('0x0'));var moment=require('moment');var LIMIT_VALUE=0xfa;function hasSequelizeOperator(_0x4a8480){var _0x241f84=['ne'];try{var _0x5e72de=JSON['parse'](_0x4a8480);var _0x120f31=Object[_0x3a28('0x1')](_0x5e72de)[0x0];return _0x241f84[_0x3a28('0x2')](_0x120f31);}catch(_0x3aa6f9){return![];}}function getOperatorValue(_0x1bc677){var _0x3a9c46=JSON['parse'](_0x1bc677);var _0x1b12de=Object[_0x3a28('0x1')](_0x3a9c46)[0x0];var _0x2ce103=_0x3a9c46[_0x1b12de];return{['$'+_0x1b12de]:_0x2ce103};}exports[_0x3a28('0x3')]=function(_0x9b6410){var _0x1bb807=null;if(_0x9b6410){_0x1bb807=_0x9b6410['split'](',');}return _0x1bb807;};exports[_0x3a28('0x4')]=function(_0x308759,_0x581275){var _0x55ffec={};if(!_[_0x3a28('0x5')](_0x308759)){_[_0x3a28('0x6')](_0x308759,function(_0x4747d5,_0x52061b){try{if(_0x581275){var _0x33aa87=_[_0x3a28('0x7')](_0x581275,{'name':_0x52061b})||{};if(hasSequelizeOperator(_0x4747d5)){_0x55ffec[_0x52061b]=getOperatorValue(_0x4747d5);}else if(_0x33aa87[_0x3a28('0x8')]===_0x3a28('0x9')&&_[_0x3a28('0xa')](_0x4747d5)){var _0x2f8521=JSON[_0x3a28('0xb')](_0x4747d5);var _0x1b16f3={'$gte':moment(moment(_0x2f8521[_0x3a28('0xc')])[_0x3a28('0xd')](_0x3a28('0xe')))[_0x3a28('0xf')]()[_0x3a28('0xd')](),'$lte':moment(moment(_0x2f8521[_0x3a28('0x10')])[_0x3a28('0xd')]('YYYY-MM-DD'))[_0x3a28('0xf')]()[_0x3a28('0x11')](0x1,'s')[_0x3a28('0xd')]()};_0x55ffec[_0x52061b]=_0x1b16f3;}else if(_0x33aa87[_0x3a28('0x12')]==='uniqueid'){_0x55ffec[_0x52061b]=_0x4747d5;}else{_0x55ffec[_0x52061b]=_[_0x3a28('0x13')](_0x4747d5)?_0x4747d5:JSON['parse'](_0x4747d5);}}else{_0x55ffec[_0x52061b]=_[_0x3a28('0x13')](_0x4747d5)?_0x4747d5:JSON['parse'](_0x4747d5);}}catch(_0x18a800){_0x55ffec[_0x52061b]=_0x4747d5[_0x3a28('0x14')](',');}});}return _0x55ffec;};exports['limit']=function(_0x473ce8){_0x473ce8=parseInt(_0x473ce8,0xa);if(!_0x473ce8||_0x473ce8<0x0){_0x473ce8=LIMIT_VALUE;}return _0x473ce8;};exports[_0x3a28('0x15')]=function(_0xc698a2){_0xc698a2=parseInt(_0xc698a2,0xa);if(!_0xc698a2||_0xc698a2<0x0){_0xc698a2=0x0;}return _0xc698a2;};exports[_0x3a28('0x16')]=function(_0x49d0cf){var _0x317685,_0x45e423=null;if(_0x49d0cf){_0x317685=_0x49d0cf[_0x3a28('0x14')](',');_0x45e423=_[_0x3a28('0x17')](_0x317685,function(_0x281e43){if(_0x281e43['indexOf']('-')===0x0){return[_0x281e43===_0x3a28('0x18')?sequelize[_0x3a28('0x19')](sequelize['col'](_0x3a28('0x18')),'unsigned'):_0x281e43[_0x3a28('0x1a')](0x1),_0x3a28('0x1b')];}else{return[_0x281e43===_0x3a28('0x18')?sequelize[_0x3a28('0x19')](sequelize['col'](_0x3a28('0x18')),_0x3a28('0x1c')):_0x281e43,'ASC'];}});}return _0x45e423;};exports[_0x3a28('0x1d')]=function(_0x211f50,_0x23cda4){if(_[_0x3a28('0x5')](_0x211f50)){return _0x211f50;}if(_['isArray'](_0x211f50)){for(var _0x31ee6d=0x0;_0x31ee6d<_0x211f50['length'];_0x31ee6d+=0x1){_0x211f50[_0x31ee6d]=this[_0x3a28('0x1d')](_0x211f50[_0x31ee6d],_0x23cda4);}return _0x211f50;}if(!_[_0x3a28('0x1e')](_0x211f50)){return _0x211f50;}if(_[_0x3a28('0x1f')](_0x23cda4)){_0x23cda4=[_0x23cda4];}if(!_[_0x3a28('0x13')](_0x23cda4)){return _0x211f50;}for(var _0x23f808=0x0;_0x23f808<_0x23cda4['length'];_0x23f808+=0x1){_[_0x3a28('0x20')](_0x211f50,_0x23cda4[_0x23f808]);}for(var _0x28ce3d in _0x211f50){if(_0x211f50[_0x3a28('0x21')](_0x28ce3d)){_0x211f50[_0x28ce3d]=this[_0x3a28('0x1d')](_0x211f50[_0x28ce3d],_0x23cda4);}}return _0x211f50;};exports[_0x3a28('0x22')]=function(_0x1347c9){return _0x1347c9[_0x3a28('0x23')](RegExp(_0x3a28('0x24')))?!![]:![];};exports[_0x3a28('0x25')]=function(_0x58ef57){return _0x58ef57['match'](/^\S+@\S+$/)?!![]:![];};exports[_0x3a28('0x26')]=function(_0x4aabc,_0x5d3e6){var _0x26d78e=[];var _0x3b41db=/[ `!@#$%^&*()_\-?~]/;var _0x51fc72=_0x5d3e6?_0x3a28('0x27'):_0x3a28('0x28');_0x4aabc[_0x3a28('0x14')](/[ ,]+/)['forEach'](function(_0x2fed6e){_0x2fed6e=_0x2fed6e[_0x3a28('0x29')](/([^:]")"+/g,'$1');_0x2fed6e='+'+_0x2fed6e+'*';var _0x357f45=_0x2fed6e['match'](_0x3b41db);if(_0x357f45){_0x2fed6e='\x22'+_0x2fed6e+'\x22';}_0x26d78e[_0x3a28('0x2a')](_0x2fed6e);});_0x51fc72=_0x51fc72['replace'](_0x3a28('0x28'),_0x26d78e['join']('\x20'));return _0x51fc72;};exports[_0x3a28('0x2b')]=function(_0x550296,_0x48d2dc,_0x1832ae){var _0x218868={},_0x41dc16={};if(_0x48d2dc[_0x3a28('0x2c')]['$id']){_0x48d2dc['query']['id']=_0x48d2dc['query']['$id'];delete _0x48d2dc[_0x3a28('0x2c')]['$id'];}_0x218868[_0x3a28('0x2d')]=_[_0x3a28('0x17')](_0x550296,_0x3a28('0x12'));_0x218868[_0x3a28('0x2c')]=_['keys'](_0x48d2dc[_0x3a28('0x2c')]);_0x218868[_0x3a28('0x4')]=_[_0x3a28('0x2e')](_0x218868['model'],_0x218868['query']);_0x41dc16[_0x3a28('0x2f')]=_[_0x3a28('0x2e')](_0x218868[_0x3a28('0x2d')],this['fields'](_0x48d2dc['query'][_0x3a28('0x3')]));_0x41dc16['attributes']=_0x41dc16[_0x3a28('0x2f')]['length']?_0x41dc16[_0x3a28('0x2f')]:_0x218868['model'];if(!_0x48d2dc[_0x3a28('0x2c')]['hasOwnProperty'](_0x3a28('0x30'))){_0x41dc16[_0x3a28('0x31')]=this[_0x3a28('0x31')](_0x48d2dc['query'][_0x3a28('0x31')]);_0x41dc16[_0x3a28('0x15')]=this[_0x3a28('0x15')](_0x48d2dc['query'][_0x3a28('0x15')]);}_0x41dc16['order']=this['sort'](_0x48d2dc[_0x3a28('0x2c')][_0x3a28('0x16')]);_0x41dc16[_0x3a28('0x32')]=this[_0x3a28('0x4')](_[_0x3a28('0x33')](_0x48d2dc['query'],_0x218868[_0x3a28('0x4')]),_0x550296);if(_0x48d2dc[_0x3a28('0x2c')][_0x3a28('0x34')]){var _0x271093=_0x550296;var _0x62af0d=_0x48d2dc[_0x3a28('0x2c')][_0x3a28('0x34')];if(typeof _0x62af0d===_0x3a28('0x35')){_0x271093=_[_0x3a28('0x34')](_0x550296,function(_0x5ab87d){return _['includes'](_0x62af0d[_0x3a28('0x36')],_0x5ab87d[_0x3a28('0x12')]);});_0x62af0d=_0x62af0d[_0x3a28('0x37')];}_0x41dc16[_0x3a28('0x32')]=_['merge'](_0x41dc16[_0x3a28('0x32')],{'$or':_[_0x3a28('0x17')](_0x271093,function(_0x48f46c){if(_0x48f46c[_0x3a28('0x8')]!==_0x3a28('0x38')){if(_0x1832ae){return sequelize[_0x3a28('0x32')](sequelize['fn'](_0x3a28('0x39'),sequelize[_0x3a28('0x3a')](_0x48f46c['name'])),{'$like':sequelize['fn'](_0x3a28('0x39'),'%'+_0x48d2dc[_0x3a28('0x2c')]['filter']+'%')});}else{var _0x1d455d={};_0x1d455d[_0x48f46c[_0x3a28('0x12')]]={'$like':'%'+_0x48d2dc[_0x3a28('0x2c')][_0x3a28('0x34')]+'%'};return _0x1d455d;}}})});}_0x41dc16=_[_0x3a28('0x3b')]({},_0x41dc16,_0x48d2dc['options']);return _0x41dc16;}; \ No newline at end of file diff --git a/server/components/realtime/agents.js b/server/components/realtime/agents.js index 3e99fe9..117f0b6 100644 --- a/server/components/realtime/agents.js +++ b/server/components/realtime/agents.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0fa4=['lastPauseAt','chatPause','chatCapacity','openchannelCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','mailCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','chatStatusTime','openchannelStatusTime','mailStatusTime','smsStatusTime','whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','screenrecording','phoneBarEnableScreenRecordingByAgent','phoneBarEnableAutomaticScreenRecording','routealias','omit','pick','filterAgentAttributes','jayson/promise','../../mysqldb','client','http','faxPause','mailPause','openchannelPause','voicePause','every','filter','length','unknown','unavailable','ringing','voiceStatus','idle','pause','chatStatus','faxStatus','mailStatus','openchannelStatus','smsStatus','then','result','request','Agents','Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)','merge','catch','*pause','busy','getAgentStatus','isArray','startCase','findOne','all','flatten','map','uniq','value','getAgentIdsByQueues','getAgentIdsByStatus','resolve','includes','User','findAll','name','smsPause','whatsappPause','pauseType','find','getSortedAgentsIdsByStatus','split','globalStatus','startsWith','DESC','ASC','getUpdatedSortOptions','fullname','internal','substring','validateSortParameter','sort','toLowerCase','userpic','online','lastLoginAt'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0x0fa4,0x12d));var _0x40fa=function(_0x16af89,_0x1155e5){_0x16af89=_0x16af89-0x0;var _0x13931a=_0x0fa4[_0x16af89];return _0x13931a;};'use strict';var _=require('lodash');var jayson=require(_0x40fa('0x0'));var db=require(_0x40fa('0x1'))['db'];var amiClient=jayson[_0x40fa('0x2')][_0x40fa('0x3')]({'port':0x232a});var routingClient=jayson[_0x40fa('0x2')][_0x40fa('0x3')]({'port':0x232c});function isAgentPaused(_0x571b12,_0x369831){var _0x3456a5=[_0x571b12['chatPause'],_0x571b12[_0x40fa('0x4')],_0x571b12[_0x40fa('0x5')],_0x571b12[_0x40fa('0x6')],_0x571b12['smsPause'],_0x571b12[_0x40fa('0x7')],_0x571b12['whatsappPause']];if(!_0x369831)return _[_0x40fa('0x8')](_0x3456a5);var _0x10e5d8=_[_0x40fa('0x9')](_0x3456a5);return _0x10e5d8[_0x40fa('0xa')]>0x0&&_0x10e5d8[_0x40fa('0xa')]<_0x3456a5[_0x40fa('0xa')]?!![]:![];}function isIdle(_0x42a791){return _0x42a791==='idle'||_0x42a791===_0x40fa('0xb')||_0x42a791===_0x40fa('0xc')||_0x42a791===_0x40fa('0xd')||_['isNil'](_0x42a791);}function isAgentIdle(_0x5e7257){if(_0x5e7257[_0x40fa('0xe')]!==_0x40fa('0xf')&&_0x5e7257[_0x40fa('0x7')]){_0x5e7257['voiceStatus']=_0x40fa('0x10');return![];}return _[_0x40fa('0x8')]([_0x5e7257[_0x40fa('0x11')],_0x5e7257[_0x40fa('0x12')],_0x5e7257[_0x40fa('0x13')],_0x5e7257[_0x40fa('0x14')],_0x5e7257[_0x40fa('0x15')],_0x5e7257[_0x40fa('0xe')],_0x5e7257['whatsappStatus']],isIdle);}function getRealtimeAgents(){return amiClient['request']('Agents',{})[_0x40fa('0x16')](function(_0x3ceb32){if(_0x3ceb32['error']){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x1d79ea=_0x3ceb32[_0x40fa('0x17')];return routingClient[_0x40fa('0x18')](_0x40fa('0x19'),{})[_0x40fa('0x16')](function(_0x4025d5){if(_0x4025d5['error']){throw new Error(_0x40fa('0x1a'));}var _0x2b7461=_0x4025d5['result'];return _[_0x40fa('0x1b')]({},_0x1d79ea,_0x2b7461);});})[_0x40fa('0x1c')](function(_0x4b7c1d){throw _0x4b7c1d;});}exports['getRealtimeAgents']=getRealtimeAgents;function getAgentStatus(_0x26ba27){var _0x230bb5='unknown';if(isAgentPaused(_0x26ba27))_0x230bb5=_0x40fa('0x10');else if(isAgentPaused(_0x26ba27,!![]))_0x230bb5=_0x40fa('0x1d');else if(isAgentIdle(_0x26ba27))_0x230bb5=_0x40fa('0xf');else _0x230bb5=_0x40fa('0x1e');return _0x230bb5;}exports[_0x40fa('0x1f')]=getAgentStatus;function getAgentIdsByQueues(_0x169eaa,_0x287041){var _0xd210cd=_[_0x40fa('0x20')](_0x169eaa)?_0x169eaa:[_0x169eaa];var _0x1c11d2=_[_0x40fa('0x21')](_0x287041)+'Queue';var _0x4b6324=_['map'](_0xd210cd,function(_0xf26292){return db[_0x1c11d2][_0x40fa('0x22')]({'where':{'id':_0xf26292}})['then'](function(_0x2e7e7a){if(!_0x2e7e7a)return[];return _0x2e7e7a['getAgents']({'attributes':['id'],'raw':!![]});});});return Promise[_0x40fa('0x23')](_0x4b6324)[_0x40fa('0x16')](function(_0x3c8eaf){var _0x7c08b8=_(_0x3c8eaf)[_0x40fa('0x24')]()[_0x40fa('0x25')]('id')[_0x40fa('0x26')]()[_0x40fa('0x27')]();return _0x7c08b8;});}exports[_0x40fa('0x28')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x3db1d6,_0x30b088,_0x7ee4b9){try{if(_0x30b088['length']>0x0){_0x3db1d6=_0x3db1d6['filter'](function(_0x40b9a0){return _0x30b088['includes'](_0x40b9a0['id']);});}var _0x3301e2=_0x3db1d6['filter'](function(_0x1b4ad1){var _0x3c5be4=_0x40fa('0x1e');if(isAgentIdle(_0x1b4ad1)){_0x3c5be4=_0x40fa('0xf');}return _0x3c5be4===_0x7ee4b9;});return _['map'](_0x3301e2,'id');}catch(_0x4bbb22){throw _0x4bbb22;}}exports[_0x40fa('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x3e375e,_0xacd971,_0x294d8e){return Promise[_0x40fa('0x2a')]()['then'](function(){if(_0xacd971[_0x40fa('0xa')]>0x0){_0x3e375e=_0x3e375e['filter'](function(_0x2b1690){return _0xacd971[_0x40fa('0x2b')](_0x2b1690['id']);});}return _0x3e375e;})['then'](function(){return db[_0x40fa('0x2c')][_0x40fa('0x2d')]({'attributes':['id',_0x40fa('0x2e'),'fullname','chatPause',_0x40fa('0x4'),'mailPause',_0x40fa('0x6'),_0x40fa('0x2f'),'voicePause',_0x40fa('0x30'),_0x40fa('0x31')],'where':{'id':{'$in':_[_0x40fa('0x25')](_0x3e375e,'id')}},'raw':!![]});})['then'](function(_0x6af8b2){return _0x6af8b2[_0x40fa('0x25')](function(_0x332a8b){var _0x328647=_[_0x40fa('0x32')](_0x3e375e,['id',_0x332a8b['id']]);var _0x1848de=filterAgentAttributes(_0x328647);_['merge'](_0x332a8b,_0x1848de);_0x332a8b['globalStatus']=getAgentStatus(_0x332a8b);return _0x332a8b;});})['then'](function(_0x3a08d1){var _0x4f18b6=sortAgentsByStatus(_0x3a08d1,_0x294d8e);return _[_0x40fa('0x25')](_0x4f18b6,'id');})[_0x40fa('0x1c')](function(_0x390c42){throw _0x390c42;});}exports[_0x40fa('0x33')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x485994){var _0xa061b4={'fields':[],'order':null};var _0x3ad4ce=_0x485994[_0x40fa('0x34')](',');_0xa061b4['fields']=_['filter'](_0x3ad4ce,function(_0x5f0ebe){if(!_0x5f0ebe[_0x40fa('0x2b')](_0x40fa('0x35'))){return!![];}_0xa061b4['order']=_[_0x40fa('0x36')](_0x5f0ebe,'-')?_0x40fa('0x37'):_0x40fa('0x38');return![];});return _0xa061b4;}exports[_0x40fa('0x39')]=getUpdatedSortOptions;function validateSortParameter(_0x128520){if(_0x128520[_0x40fa('0x2b')](_0x40fa('0x3a'))&&!_0x128520[_0x40fa('0x2b')](_0x40fa('0x3b'))){var _0x4d0b11=_0x128520[_0x40fa('0x3c')](0x0,_0x128520['indexOf'](_0x40fa('0x3a')));_0x128520+=','+_0x4d0b11+'internal';}return _0x128520;}exports[_0x40fa('0x3d')]=validateSortParameter;function sortAgentsByStatus(_0x291252,_0x29eb11){var _0x2528b1=_0x291252[_0x40fa('0x3e')](function(_0x486f2a,_0x3cd779){if(_0x486f2a[_0x40fa('0x35')]===_0x3cd779[_0x40fa('0x35')]){if(_0x486f2a[_0x40fa('0x35')]===_0x40fa('0x10')){if(_0x29eb11===_0x40fa('0x37')){return(_0x486f2a['pauseType']||'')<(_0x3cd779[_0x40fa('0x31')]||'')||_0x486f2a[_0x40fa('0x3a')][_0x40fa('0x3f')]()>_0x3cd779[_0x40fa('0x3a')]['toLowerCase']()?0x1:-0x1;}else{return(_0x486f2a[_0x40fa('0x31')]||'')<(_0x3cd779[_0x40fa('0x31')]||'')||_0x486f2a[_0x40fa('0x3a')][_0x40fa('0x3f')]()>_0x3cd779[_0x40fa('0x3a')][_0x40fa('0x3f')]()?-0x1:0x1;}}else{if(_0x29eb11===_0x40fa('0x37')){return _0x486f2a[_0x40fa('0x3a')][_0x40fa('0x3f')]()<_0x3cd779['fullname']['toLowerCase']()?0x1:-0x1;}else{return _0x486f2a['fullname'][_0x40fa('0x3f')]()<_0x3cd779['fullname']['toLowerCase']()?-0x1:0x1;}}}else{if(_0x29eb11==='DESC'){return _0x486f2a[_0x40fa('0x35')]<_0x3cd779['globalStatus']?0x1:-0x1;}else{return _0x486f2a[_0x40fa('0x35')]<_0x3cd779[_0x40fa('0x35')]?-0x1:0x1;}}});return _0x2528b1;}exports['sortAgentsByStatus']=sortAgentsByStatus;function filterAgentAttributes(_0x3f6789){var _0x5c6138=[_0x40fa('0x40'),_0x40fa('0x41'),_0x40fa('0x42'),_0x40fa('0x43'),_0x40fa('0x31'),'lastPauseAt','internal','address',_0x40fa('0x44'),_0x40fa('0x6'),_0x40fa('0x5'),_0x40fa('0x2f'),_0x40fa('0x30'),_0x40fa('0x4'),'voicePause',_0x40fa('0x45'),_0x40fa('0x46'),'mailCapacity','smsCapacity','whatsappCapacity',_0x40fa('0x47'),_0x40fa('0x48'),_0x40fa('0x49'),_0x40fa('0x4a'),_0x40fa('0x4b'),_0x40fa('0x4c'),'faxCurrentCapacity','chatStatus',_0x40fa('0x14'),_0x40fa('0x13'),'smsStatus','whatsappStatus','faxStatus',_0x40fa('0xe'),_0x40fa('0x4d'),_0x40fa('0x4e'),_0x40fa('0x4f'),_0x40fa('0x50'),_0x40fa('0x51'),_0x40fa('0x52'),_0x40fa('0x53'),_0x40fa('0x54'),'destconnectedlinenum',_0x40fa('0x55'),_0x40fa('0x56'),_0x40fa('0x57'),_0x40fa('0x58')];var _0x3ae805=[_0x40fa('0x44'),_0x40fa('0x6'),_0x40fa('0x5'),_0x40fa('0x2f'),_0x40fa('0x30'),'faxPause',_0x40fa('0x7'),'online'];var _0xaea46d=_(_0x3f6789)[_0x40fa('0x59')](_0x3ae805)[_0x40fa('0x5a')](_0x5c6138)[_0x40fa('0x27')]();return _0xaea46d;}exports[_0x40fa('0x5b')]=filterAgentAttributes; \ No newline at end of file +var _0x4dab=['getAgentIdsByStatus','resolve','User','name','whatsappPause','pauseType','find','globalStatus','getSortedAgentsIdsByStatus','split','fields','order','startsWith','DESC','ASC','getUpdatedSortOptions','fullname','internal','substring','sort','toLowerCase','sortAgentsByStatus','userpic','lastLoginAt','lastPauseAt','address','openchannelPause','chatCapacity','openchannelCapacity','smsCapacity','whatsappCapacity','faxCapacity','chatCurrentCapacity','openchannelCurrentCapacity','smsCurrentCapacity','whatsappCurrentCapacity','faxCurrentCapacity','chatStatus','smsStatus','chatStatusTime','mailStatusTime','smsStatusTime','screenrecording','phoneBarEnableAutomaticScreenRecording','online','omit','value','lodash','jayson/promise','../../mysqldb','client','http','chatPause','faxPause','mailPause','smsPause','every','filter','length','idle','unknown','ringing','isNil','voicePause','voiceStatus','mailStatus','whatsappStatus','request','Agents','then','error','result','merge','catch','getRealtimeAgents','pause','*pause','busy','isArray','startCase','Queue','map','findOne','getAgents','flatten','uniq','getAgentIdsByQueues','includes'];(function(_0x5d4f22,_0x3b3bf6){var _0x3b87cb=function(_0x303b8c){while(--_0x303b8c){_0x5d4f22['push'](_0x5d4f22['shift']());}};_0x3b87cb(++_0x3b3bf6);}(_0x4dab,0x137));var _0xb4da=function(_0x55c2a5,_0x3ab35b){_0x55c2a5=_0x55c2a5-0x0;var _0x177d1d=_0x4dab[_0x55c2a5];return _0x177d1d;};'use strict';var _=require(_0xb4da('0x0'));var jayson=require(_0xb4da('0x1'));var db=require(_0xb4da('0x2'))['db'];var amiClient=jayson[_0xb4da('0x3')][_0xb4da('0x4')]({'port':0x232a});var routingClient=jayson[_0xb4da('0x3')][_0xb4da('0x4')]({'port':0x232c});function isAgentPaused(_0x2a3c9a,_0x13caf5){var _0x443538=[_0x2a3c9a[_0xb4da('0x5')],_0x2a3c9a[_0xb4da('0x6')],_0x2a3c9a[_0xb4da('0x7')],_0x2a3c9a['openchannelPause'],_0x2a3c9a[_0xb4da('0x8')],_0x2a3c9a['voicePause'],_0x2a3c9a['whatsappPause']];if(!_0x13caf5)return _[_0xb4da('0x9')](_0x443538);var _0x369066=_[_0xb4da('0xa')](_0x443538);return _0x369066[_0xb4da('0xb')]>0x0&&_0x369066[_0xb4da('0xb')]<_0x443538[_0xb4da('0xb')]?!![]:![];}function isIdle(_0x3fd4d5){return _0x3fd4d5===_0xb4da('0xc')||_0x3fd4d5===_0xb4da('0xd')||_0x3fd4d5==='unavailable'||_0x3fd4d5===_0xb4da('0xe')||_[_0xb4da('0xf')](_0x3fd4d5);}function isAgentIdle(_0x3602cc){if(_0x3602cc['voiceStatus']!==_0xb4da('0xc')&&_0x3602cc[_0xb4da('0x10')]){_0x3602cc[_0xb4da('0x11')]='pause';return![];}return _[_0xb4da('0x9')]([_0x3602cc['chatStatus'],_0x3602cc['faxStatus'],_0x3602cc[_0xb4da('0x12')],_0x3602cc['openchannelStatus'],_0x3602cc['smsStatus'],_0x3602cc[_0xb4da('0x11')],_0x3602cc[_0xb4da('0x13')]],isIdle);}function getRealtimeAgents(){return amiClient[_0xb4da('0x14')](_0xb4da('0x15'),{})[_0xb4da('0x16')](function(_0x5e4cc8){if(_0x5e4cc8[_0xb4da('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(AMI)');}var _0x351830=_0x5e4cc8[_0xb4da('0x18')];return routingClient[_0xb4da('0x14')](_0xb4da('0x15'),{})[_0xb4da('0x16')](function(_0x587abb){if(_0x587abb[_0xb4da('0x17')]){throw new Error('Unable\x20to\x20retrieve\x20RPC\x20agents\x20(Routing)');}var _0x75f042=_0x587abb[_0xb4da('0x18')];return _[_0xb4da('0x19')]({},_0x351830,_0x75f042);});})[_0xb4da('0x1a')](function(_0xe8e469){throw _0xe8e469;});}exports[_0xb4da('0x1b')]=getRealtimeAgents;function getAgentStatus(_0xc0cc9e){var _0x98699=_0xb4da('0xd');if(isAgentPaused(_0xc0cc9e))_0x98699=_0xb4da('0x1c');else if(isAgentPaused(_0xc0cc9e,!![]))_0x98699=_0xb4da('0x1d');else if(isAgentIdle(_0xc0cc9e))_0x98699=_0xb4da('0xc');else _0x98699=_0xb4da('0x1e');return _0x98699;}exports['getAgentStatus']=getAgentStatus;function getAgentIdsByQueues(_0x3fbb9d,_0x2df4b5){var _0x44ceec=_[_0xb4da('0x1f')](_0x3fbb9d)?_0x3fbb9d:[_0x3fbb9d];var _0x8d35ef=_[_0xb4da('0x20')](_0x2df4b5)+_0xb4da('0x21');var _0x52cf97=_[_0xb4da('0x22')](_0x44ceec,function(_0x2f1103){return db[_0x8d35ef][_0xb4da('0x23')]({'where':{'id':_0x2f1103}})[_0xb4da('0x16')](function(_0x145a51){if(!_0x145a51)return[];return _0x145a51[_0xb4da('0x24')]({'attributes':['id'],'raw':!![]});});});return Promise['all'](_0x52cf97)['then'](function(_0x5df5db){var _0x43a1ae=_(_0x5df5db)[_0xb4da('0x25')]()[_0xb4da('0x22')]('id')[_0xb4da('0x26')]()['value']();return _0x43a1ae;});}exports[_0xb4da('0x27')]=getAgentIdsByQueues;function getAgentIdsByStatus(_0x1bb3bc,_0x4929e4,_0x2d5ea0){try{if(_0x4929e4['length']>0x0){_0x1bb3bc=_0x1bb3bc[_0xb4da('0xa')](function(_0x5cb94d){return _0x4929e4[_0xb4da('0x28')](_0x5cb94d['id']);});}var _0x11581c=_0x1bb3bc[_0xb4da('0xa')](function(_0x416e98){var _0x5c18f8=_0xb4da('0x1e');if(isAgentIdle(_0x416e98)){_0x5c18f8=_0xb4da('0xc');}return _0x5c18f8===_0x2d5ea0;});return _['map'](_0x11581c,'id');}catch(_0x4d1b86){throw _0x4d1b86;}}exports[_0xb4da('0x29')]=getAgentIdsByStatus;function getSortedAgentsIdsByStatus(_0x4c1699,_0x3783ae,_0x1a414d){return Promise[_0xb4da('0x2a')]()[_0xb4da('0x16')](function(){if(_0x3783ae[_0xb4da('0xb')]>0x0){_0x4c1699=_0x4c1699[_0xb4da('0xa')](function(_0x49ce9f){return _0x3783ae['includes'](_0x49ce9f['id']);});}return _0x4c1699;})[_0xb4da('0x16')](function(){return db[_0xb4da('0x2b')]['findAll']({'attributes':['id',_0xb4da('0x2c'),'fullname','chatPause','faxPause','mailPause','openchannelPause',_0xb4da('0x8'),_0xb4da('0x10'),_0xb4da('0x2d'),_0xb4da('0x2e')],'where':{'id':{'$in':_[_0xb4da('0x22')](_0x4c1699,'id')}},'raw':!![]});})['then'](function(_0xd91e94){return _0xd91e94[_0xb4da('0x22')](function(_0xda2c9e){var _0xa7c64f=_[_0xb4da('0x2f')](_0x4c1699,['id',_0xda2c9e['id']]);var _0x275e20=filterAgentAttributes(_0xa7c64f);_['merge'](_0xda2c9e,_0x275e20);_0xda2c9e[_0xb4da('0x30')]=getAgentStatus(_0xda2c9e);return _0xda2c9e;});})[_0xb4da('0x16')](function(_0x1c1161){var _0x274c08=sortAgentsByStatus(_0x1c1161,_0x1a414d);return _[_0xb4da('0x22')](_0x274c08,'id');})[_0xb4da('0x1a')](function(_0x2d81db){throw _0x2d81db;});}exports[_0xb4da('0x31')]=getSortedAgentsIdsByStatus;function getUpdatedSortOptions(_0x2c4a2a){var _0x450811={'fields':[],'order':null};var _0x424c3b=_0x2c4a2a[_0xb4da('0x32')](',');_0x450811[_0xb4da('0x33')]=_['filter'](_0x424c3b,function(_0x2f8189){if(!_0x2f8189['includes'](_0xb4da('0x30'))){return!![];}_0x450811[_0xb4da('0x34')]=_[_0xb4da('0x35')](_0x2f8189,'-')?_0xb4da('0x36'):_0xb4da('0x37');return![];});return _0x450811;}exports[_0xb4da('0x38')]=getUpdatedSortOptions;function validateSortParameter(_0x83793f){if(_0x83793f['includes'](_0xb4da('0x39'))&&!_0x83793f['includes'](_0xb4da('0x3a'))){var _0x219501=_0x83793f[_0xb4da('0x3b')](0x0,_0x83793f['indexOf'](_0xb4da('0x39')));_0x83793f+=','+_0x219501+_0xb4da('0x3a');}return _0x83793f;}exports['validateSortParameter']=validateSortParameter;function sortAgentsByStatus(_0xb507c8,_0xd81eb){var _0x13d4db=_0xb507c8[_0xb4da('0x3c')](function(_0x2dd2ae,_0x2b1d7c){if(_0x2dd2ae[_0xb4da('0x30')]===_0x2b1d7c['globalStatus']){if(_0x2dd2ae[_0xb4da('0x30')]==='pause'){if(_0xd81eb==='DESC'){return(_0x2dd2ae[_0xb4da('0x2e')]||'')<(_0x2b1d7c[_0xb4da('0x2e')]||'')||_0x2dd2ae['fullname'][_0xb4da('0x3d')]()>_0x2b1d7c[_0xb4da('0x39')][_0xb4da('0x3d')]()?0x1:-0x1;}else{return(_0x2dd2ae[_0xb4da('0x2e')]||'')<(_0x2b1d7c['pauseType']||'')||_0x2dd2ae[_0xb4da('0x39')][_0xb4da('0x3d')]()>_0x2b1d7c[_0xb4da('0x39')][_0xb4da('0x3d')]()?-0x1:0x1;}}else{if(_0xd81eb==='DESC'){return _0x2dd2ae[_0xb4da('0x39')][_0xb4da('0x3d')]()<_0x2b1d7c[_0xb4da('0x39')]['toLowerCase']()?0x1:-0x1;}else{return _0x2dd2ae[_0xb4da('0x39')]['toLowerCase']()<_0x2b1d7c['fullname'][_0xb4da('0x3d')]()?-0x1:0x1;}}}else{if(_0xd81eb===_0xb4da('0x36')){return _0x2dd2ae[_0xb4da('0x30')]<_0x2b1d7c[_0xb4da('0x30')]?0x1:-0x1;}else{return _0x2dd2ae[_0xb4da('0x30')]<_0x2b1d7c[_0xb4da('0x30')]?-0x1:0x1;}}});return _0x13d4db;}exports[_0xb4da('0x3e')]=sortAgentsByStatus;function filterAgentAttributes(_0xa43cf0){var _0x3efe22=[_0xb4da('0x3f'),'online',_0xb4da('0x40'),_0xb4da('0x41'),_0xb4da('0x2e'),_0xb4da('0x41'),_0xb4da('0x3a'),_0xb4da('0x42'),_0xb4da('0x5'),_0xb4da('0x43'),_0xb4da('0x7'),'smsPause',_0xb4da('0x2d'),_0xb4da('0x6'),_0xb4da('0x10'),_0xb4da('0x44'),_0xb4da('0x45'),'mailCapacity',_0xb4da('0x46'),_0xb4da('0x47'),_0xb4da('0x48'),_0xb4da('0x49'),_0xb4da('0x4a'),'mailCurrentCapacity',_0xb4da('0x4b'),_0xb4da('0x4c'),_0xb4da('0x4d'),_0xb4da('0x4e'),'openchannelStatus','mailStatus',_0xb4da('0x4f'),_0xb4da('0x13'),'faxStatus',_0xb4da('0x11'),_0xb4da('0x50'),'openchannelStatusTime',_0xb4da('0x51'),_0xb4da('0x52'),'whatsappStatusTime','faxStatusTime','voiceStatusTime','queue','destconnectedlinenum',_0xb4da('0x53'),'phoneBarEnableScreenRecordingByAgent',_0xb4da('0x54'),'routealias'];var _0x3294f6=['chatPause','openchannelPause',_0xb4da('0x7'),_0xb4da('0x8'),_0xb4da('0x2d'),'faxPause',_0xb4da('0x10'),_0xb4da('0x55')];var _0xfc488d=_(_0xa43cf0)[_0xb4da('0x56')](_0x3294f6)['pick'](_0x3efe22)[_0xb4da('0x57')]();return _0xfc488d;}exports['filterAgentAttributes']=filterAgentAttributes; \ No newline at end of file diff --git a/server/components/realtime/queues.js b/server/components/realtime/queues.js index 10a95ca..38522cb 100644 --- a/server/components/realtime/queues.js +++ b/server/components/realtime/queues.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x375f=['loggedInDb','onHold','ringing','ringInUse','talking','unavailable','unknown','statusMessage','dialActive','dialMethod','Trunk','startPredictive','startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalAvgTalktime','request','startCase','then','error','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','voice','inbound','outbound','concat','map','paused','loggedIn','pTalking','originated','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','waiting','busy','inUse','invalid'];(function(_0x153f07,_0xceb2eb){var _0x563003=function(_0x47fa2a){while(--_0x47fa2a){_0x153f07['push'](_0x153f07['shift']());}};_0x563003(++_0xceb2eb);}(_0x375f,0x12f));var _0xf375=function(_0x4abfbc,_0xc04dee){_0x4abfbc=_0x4abfbc-0x0;var _0x32cc91=_0x375f[_0x4abfbc];return _0x32cc91;};'use strict';var _=require(_0xf375('0x0'));var jayson=require(_0xf375('0x1'));var util=require(_0xf375('0x2'));var amiClient=jayson[_0xf375('0x3')][_0xf375('0x4')]({'port':0x232a});var routingClient=jayson[_0xf375('0x3')]['http']({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=['available','loggedIn','paused',_0xf375('0x5')];var VOICE_QUEUE_ATTRIBUTES=[_0xf375('0x6'),_0xf375('0x7'),_0xf375('0x8'),_0xf375('0x9'),'notInUse',_0xf375('0xa'),_0xf375('0xb'),_0xf375('0xc'),_0xf375('0xd'),_0xf375('0xe'),_0xf375('0xf')];var OUTBOUND_QUEUE_ATTRIBUTES=['pTalking','originated','message',_0xf375('0x10'),_0xf375('0x11'),_0xf375('0x12'),_0xf375('0x13'),_0xf375('0x14'),_0xf375('0x15'),_0xf375('0x16'),_0xf375('0x17'),_0xf375('0x18'),_0xf375('0x19'),'dialPredictiveInterval',_0xf375('0x1a'),_0xf375('0x1b'),_0xf375('0x1c'),_0xf375('0x1d'),_0xf375('0x1e'),_0xf375('0x1f'),_0xf375('0x20'),'predictiveIntervalAvgHoldtime',_0xf375('0x21')];function getRealtimeQueues(_0x528a1f,_0x1b65a3){var _0x2ee132=_0x1b65a3==='voice'?amiClient:routingClient;return _0x2ee132[_0xf375('0x22')](_[_0xf375('0x23')](_0x1b65a3)+'Queues',_0x528a1f)[_0xf375('0x24')](function(_0x594fe8){if(_0x594fe8[_0xf375('0x25')])throw new Error(util['format'](_0xf375('0x26'),_0x1b65a3));return _0x594fe8[_0xf375('0x27')];})['catch'](function(_0x3027d6){throw _0x3027d6;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0xba02ea,_0x10f67e,_0x1b252d,_0x438708){var _0x5995e9=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1b252d===_0xf375('0x28')){if(_0x438708===_0xf375('0x29')){_0x5995e9=_0x5995e9['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x438708===_0xf375('0x2a')){_0x5995e9=_0x5995e9[_0xf375('0x2b')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0xba02ea[_0xf375('0x2c')](function(_0x1ef80f){var _0x217587=_0x1ef80f['get']({'plain':!![]});_0x217587[_0xf375('0x2d')]=0x0;_0x217587[_0xf375('0x9')]=0x0;_0x217587[_0xf375('0x2e')]=0x0;_0x217587['available']=0x0;_0x217587['waiting']=0x0;if(_0x1b252d===_0xf375('0x28')){_0x217587['talking']=0x0;_0x217587['busy']=0x0;if(_0x438708==='outbound'){_0x217587[_0xf375('0x2f')]=0x0;_0x217587[_0xf375('0x30')]=0x0;}}var _0x27ffcd=_['find'](_0x10f67e,['id',_0x217587['id']]);if(_0x27ffcd){_[_0xf375('0x31')](_0x217587,_[_0xf375('0x32')](_0x27ffcd,_0x5995e9));}return _0x217587;});}exports[_0xf375('0x33')]=initializeQueues; \ No newline at end of file +var _0x8109=['startProgressive','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','dialPredictiveInterval','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','voice','request','startCase','Queues','then','error','format','Unable\x20to\x20retrieve\x20RPC\x20%s\x20queues','result','catch','inbound','outbound','concat','map','get','merge','pick','initializeQueues','lodash','jayson/promise','util','client','http','available','loggedIn','paused','waiting','busy','invalid','loggedInDb','notInUse','onHold','ringing','ringInUse','unavailable','unknown','pTalking','originated','message','statusMessage','dialMethod','Trunk','startPredictive'];(function(_0x3ac173,_0x208130){var _0x30e23a=function(_0x4dbcda){while(--_0x4dbcda){_0x3ac173['push'](_0x3ac173['shift']());}};_0x30e23a(++_0x208130);}(_0x8109,0xf5));var _0x9810=function(_0x321e25,_0x3d3186){_0x321e25=_0x321e25-0x0;var _0x5112ef=_0x8109[_0x321e25];return _0x5112ef;};'use strict';var _=require(_0x9810('0x0'));var jayson=require(_0x9810('0x1'));var util=require(_0x9810('0x2'));var amiClient=jayson[_0x9810('0x3')][_0x9810('0x4')]({'port':0x232a});var routingClient=jayson[_0x9810('0x3')][_0x9810('0x4')]({'port':0x232c});var DEFAULT_QUEUE_ATTRIBUTES=[_0x9810('0x5'),_0x9810('0x6'),_0x9810('0x7'),_0x9810('0x8')];var VOICE_QUEUE_ATTRIBUTES=[_0x9810('0x9'),'inUse',_0x9810('0xa'),_0x9810('0xb'),_0x9810('0xc'),_0x9810('0xd'),_0x9810('0xe'),_0x9810('0xf'),'talking',_0x9810('0x10'),_0x9810('0x11')];var OUTBOUND_QUEUE_ATTRIBUTES=[_0x9810('0x12'),_0x9810('0x13'),_0x9810('0x14'),_0x9810('0x15'),'dialActive',_0x9810('0x16'),_0x9810('0x17'),_0x9810('0x18'),_0x9810('0x19'),_0x9810('0x1a'),_0x9810('0x1b'),_0x9810('0x1c'),_0x9810('0x1d'),_0x9810('0x1e'),_0x9810('0x1f'),_0x9810('0x20'),'predictiveIntervalAvailable','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls',_0x9810('0x21'),'predictiveIntervalDroppedCallsCallersExit',_0x9810('0x22'),_0x9810('0x23')];function getRealtimeQueues(_0xeee2ad,_0x50dff0){var _0x390705=_0x50dff0===_0x9810('0x24')?amiClient:routingClient;return _0x390705[_0x9810('0x25')](_[_0x9810('0x26')](_0x50dff0)+_0x9810('0x27'),_0xeee2ad)[_0x9810('0x28')](function(_0x23c2a8){if(_0x23c2a8[_0x9810('0x29')])throw new Error(util[_0x9810('0x2a')](_0x9810('0x2b'),_0x50dff0));return _0x23c2a8[_0x9810('0x2c')];})[_0x9810('0x2d')](function(_0x3f3194){throw _0x3f3194;});}exports['getRealtimeQueues']=getRealtimeQueues;function initializeQueues(_0x500494,_0x41303c,_0x1c213e,_0x3aee3f){var _0x4f526b=DEFAULT_QUEUE_ATTRIBUTES;if(_0x1c213e==='voice'){if(_0x3aee3f===_0x9810('0x2e')){_0x4f526b=_0x4f526b['concat'](VOICE_QUEUE_ATTRIBUTES);}else if(_0x3aee3f===_0x9810('0x2f')){_0x4f526b=_0x4f526b[_0x9810('0x30')](VOICE_QUEUE_ATTRIBUTES,OUTBOUND_QUEUE_ATTRIBUTES);}}return _0x500494[_0x9810('0x31')](function(_0x1b1d4e){var _0x458ebc=_0x1b1d4e[_0x9810('0x32')]({'plain':!![]});_0x458ebc['paused']=0x0;_0x458ebc[_0x9810('0xb')]=0x0;_0x458ebc['loggedIn']=0x0;_0x458ebc[_0x9810('0x5')]=0x0;_0x458ebc[_0x9810('0x8')]=0x0;if(_0x1c213e==='voice'){_0x458ebc['talking']=0x0;_0x458ebc[_0x9810('0x9')]=0x0;if(_0x3aee3f===_0x9810('0x2f')){_0x458ebc[_0x9810('0x12')]=0x0;_0x458ebc[_0x9810('0x13')]=0x0;}}var _0x428969=_['find'](_0x41303c,['id',_0x458ebc['id']]);if(_0x428969){_[_0x9810('0x33')](_0x458ebc,_[_0x9810('0x34')](_0x428969,_0x4f526b));}return _0x458ebc;});}exports[_0x9810('0x35')]=initializeQueues; \ No newline at end of file diff --git a/server/config/express.js b/server/config/express.js index 5773bc5..ea5d1c3 100644 --- a/server/config/express.js +++ b/server/config/express.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x53dd9b,_0x24d9e9){var _0x42f82b=function(_0x1adbbc){while(--_0x1adbbc){_0x53dd9b['push'](_0x53dd9b['shift']());}};_0x42f82b(++_0x24d9e9);}(_0x9957,0x93));var _0x7995=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0x9957[_0x4cf98e];return _0x1623ac;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file +var _0x9957=['root','public','test','join','client','use','json\x20replacer','toISOString','split','static','/server/views','engine','html','ejs','renderFile','view\x20engine','urlencoded','json','50mb','express','method-override','cookie-parser','errorhandler','passport','cors','./environment','default','get','env','production','set','appPath'];(function(_0x47e7d0,_0x36c59d){var _0x24995f=function(_0x36b084){while(--_0x36b084){_0x47e7d0['push'](_0x47e7d0['shift']());}};_0x24995f(++_0x36c59d);}(_0x9957,0x93));var _0x7995=function(_0x19e35c,_0x29cd1e){_0x19e35c=_0x19e35c-0x0;var _0x3e1fe8=_0x9957[_0x19e35c];return _0x3e1fe8;};'use strict';var express=require(_0x7995('0x0'));var methodOverride=require(_0x7995('0x1'));var cookieParser=require(_0x7995('0x2'));var errorHandler=require(_0x7995('0x3'));var path=require('path');var passport=require(_0x7995('0x4'));var cors=require(_0x7995('0x5'));var config=require(_0x7995('0x6'));exports[_0x7995('0x7')]=function(_0x576d89){var _0x744bea=_0x576d89[_0x7995('0x8')](_0x7995('0x9'));if(_0x744bea===_0x7995('0xa')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path['join'](config[_0x7995('0xd')],_0x7995('0xe')));}if(_0x744bea==='development'||_0x744bea===_0x7995('0xf')){_0x576d89[_0x7995('0xb')](_0x7995('0xc'),path[_0x7995('0x10')](config[_0x7995('0xd')],_0x7995('0x11')));_0x576d89[_0x7995('0x12')](errorHandler());}_0x576d89['set'](_0x7995('0x13'),function(_0x41c652,_0x581f22){if(this[_0x41c652]instanceof Date){_0x581f22=this[_0x41c652][_0x7995('0x14')]()[_0x7995('0x15')]('.')[0x0]+'Z';}return _0x581f22;});_0x576d89[_0x7995('0x12')](express[_0x7995('0x16')](_0x576d89[_0x7995('0x8')](_0x7995('0xc'))));_0x576d89[_0x7995('0xb')]('views',config['root']+_0x7995('0x17'));_0x576d89[_0x7995('0x18')](_0x7995('0x19'),require(_0x7995('0x1a'))[_0x7995('0x1b')]);_0x576d89[_0x7995('0xb')](_0x7995('0x1c'),_0x7995('0x19'));_0x576d89['use'](express[_0x7995('0x1d')]({'limit':'50mb','extended':!![]}));_0x576d89[_0x7995('0x12')](express[_0x7995('0x1e')]({'limit':_0x7995('0x1f')}));_0x576d89[_0x7995('0x12')](cors());_0x576d89[_0x7995('0x12')](methodOverride());_0x576d89[_0x7995('0x12')](cookieParser());_0x576d89['use'](passport['initialize']());}; \ No newline at end of file diff --git a/server/config/license/hardware.js b/server/config/license/hardware.js index 7da18b8..f5c57f6 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 _0x2326=['licenseToken','test','win32','utf8','replace','hostname','md5','substring','lodash','bimedia-machine-uuid','execSync','../environment','networkInterfaces','orderBy','keys','filter','IPv4','internal','concat','head','mac','00:00:00:00:00:00','address','127.0.0.1','getFirstInterface','cpus','map','model','createHash','update','digest','hex','getUuid','platform'];(function(_0x1a497a,_0x27d40b){var _0x21ef9a=function(_0xa4cbf5){while(--_0xa4cbf5){_0x1a497a['push'](_0x1a497a['shift']());}};_0x21ef9a(++_0x27d40b);}(_0x2326,0x1a0));var _0x6232=function(_0x4e52d3,_0x8b1936){_0x4e52d3=_0x4e52d3-0x0;var _0x593c39=_0x2326[_0x4e52d3];return _0x593c39;};'use strict';var _=require(_0x6232('0x0'));var os=require('os');var crypto=require('crypto');var machine=require(_0x6232('0x1'));var exec=require('child_process')[_0x6232('0x2')];var config=require(_0x6232('0x3'));function getInterfaces(){var _0x4247c3=[];var _0x56f1e2=os[_0x6232('0x4')]();var _0x268efa=_[_0x6232('0x5')](_[_0x6232('0x6')](_0x56f1e2));for(var _0x1e3d63=0x0;_0x1e3d63<_0x268efa['length'];_0x1e3d63++){var _0x134be1=_0x56f1e2[_0x268efa[_0x1e3d63]][_0x6232('0x7')](function(_0x56759a){return _0x56759a['family']===_0x6232('0x8')&&_0x56759a[_0x6232('0x9')]===![];});_0x4247c3=_0x4247c3[_0x6232('0xa')](_0x134be1);}return _0x4247c3;}function getFirstInterface(){var _0x2433ce=_[_0x6232('0xb')](getInterfaces());return{'macAddress':_0x2433ce&&_0x2433ce[_0x6232('0xc')]?_0x2433ce[_0x6232('0xc')]:_0x6232('0xd'),'ipAddress':_0x2433ce&&_0x2433ce[_0x6232('0xe')]?_0x2433ce[_0x6232('0xe')]:_0x6232('0xf')};}exports[_0x6232('0x10')]=getFirstInterface;function getCPUhash(){var _0x159791=_['orderBy'](os[_0x6232('0x11')]()[_0x6232('0x12')](function(_0x556659){return _0x556659[_0x6232('0x13')];}))['join'](':');return crypto[_0x6232('0x14')]('md5')[_0x6232('0x15')](_0x159791)[_0x6232('0x16')](_0x6232('0x17'));}exports[_0x6232('0x18')]=function(){var _0x3fac79=os[_0x6232('0x19')]();var _0x5274b8=/[0-9a-f-]{36}/;if(config[_0x6232('0x1a')]&&_0x5274b8[_0x6232('0x1b')](config[_0x6232('0x1a')])){return config[_0x6232('0x1a')];}else if(_0x3fac79===_0x6232('0x1c')){return exec('dmidecode\x20--string\x20system-uuid',{'encoding':_0x6232('0x1d')})[_0x6232('0x1e')]('\x0d\x0a','');}else{var _0x547f20=getFirstInterface();var _0x4892d0=getCPUhash();var _0xe6f9ff=_0x4892d0+'|'+os[_0x6232('0x1f')]()+'|'+_0x547f20['macAddress']+'|'+_0x547f20['ipAddress'];var _0x28338a=crypto[_0x6232('0x14')](_0x6232('0x20'))[_0x6232('0x15')](_0xe6f9ff)[_0x6232('0x16')](_0x6232('0x17'));return _0x28338a[_0x6232('0x21')](0x0,0x8)+'-'+_0x28338a['substring'](0x8,0xc)+'-'+_0x28338a[_0x6232('0x21')](0xc,0x10)+'-'+_0x28338a[_0x6232('0x21')](0x10,0x14)+'-'+_0x28338a[_0x6232('0x21')](0x14);}}; \ No newline at end of file +var _0x4e1f=['internal','concat','head','mac','00:00:00:00:00:00','127.0.0.1','getFirstInterface','model','join','md5','update','digest','hex','getUuid','licenseToken','test','win32','dmidecode\x20--string\x20system-uuid','utf8','replace','hostname','macAddress','substring','lodash','crypto','bimedia-machine-uuid','../environment','networkInterfaces','orderBy','length','filter','family','IPv4'];(function(_0x2d1068,_0x2e03bd){var _0x5b6eb2=function(_0x445357){while(--_0x445357){_0x2d1068['push'](_0x2d1068['shift']());}};_0x5b6eb2(++_0x2e03bd);}(_0x4e1f,0x1a3));var _0xf4e1=function(_0x35c2f6,_0x53ca58){_0x35c2f6=_0x35c2f6-0x0;var _0x435de7=_0x4e1f[_0x35c2f6];return _0x435de7;};'use strict';var _=require(_0xf4e1('0x0'));var os=require('os');var crypto=require(_0xf4e1('0x1'));var machine=require(_0xf4e1('0x2'));var exec=require('child_process')['execSync'];var config=require(_0xf4e1('0x3'));function getInterfaces(){var _0xed6f2e=[];var _0x1c6ab8=os[_0xf4e1('0x4')]();var _0x27d58f=_[_0xf4e1('0x5')](_['keys'](_0x1c6ab8));for(var _0x56581d=0x0;_0x56581d<_0x27d58f[_0xf4e1('0x6')];_0x56581d++){var _0xe4c6fc=_0x1c6ab8[_0x27d58f[_0x56581d]][_0xf4e1('0x7')](function(_0x19f1cb){return _0x19f1cb[_0xf4e1('0x8')]===_0xf4e1('0x9')&&_0x19f1cb[_0xf4e1('0xa')]===![];});_0xed6f2e=_0xed6f2e[_0xf4e1('0xb')](_0xe4c6fc);}return _0xed6f2e;}function getFirstInterface(){var _0x18589f=_[_0xf4e1('0xc')](getInterfaces());return{'macAddress':_0x18589f&&_0x18589f[_0xf4e1('0xd')]?_0x18589f[_0xf4e1('0xd')]:_0xf4e1('0xe'),'ipAddress':_0x18589f&&_0x18589f['address']?_0x18589f['address']:_0xf4e1('0xf')};}exports[_0xf4e1('0x10')]=getFirstInterface;function getCPUhash(){var _0x54532d=_[_0xf4e1('0x5')](os['cpus']()['map'](function(_0x2e0919){return _0x2e0919[_0xf4e1('0x11')];}))[_0xf4e1('0x12')](':');return crypto['createHash'](_0xf4e1('0x13'))[_0xf4e1('0x14')](_0x54532d)[_0xf4e1('0x15')](_0xf4e1('0x16'));}exports[_0xf4e1('0x17')]=function(){var _0x4e599=os['platform']();var _0x3bc29c=/[0-9a-f-]{36}/;if(config[_0xf4e1('0x18')]&&_0x3bc29c[_0xf4e1('0x19')](config[_0xf4e1('0x18')])){return config[_0xf4e1('0x18')];}else if(_0x4e599===_0xf4e1('0x1a')){return exec(_0xf4e1('0x1b'),{'encoding':_0xf4e1('0x1c')})[_0xf4e1('0x1d')]('\x0d\x0a','');}else{var _0x4e04a3=getFirstInterface();var _0x315ce1=getCPUhash();var _0x4b4a59=_0x315ce1+'|'+os[_0xf4e1('0x1e')]()+'|'+_0x4e04a3[_0xf4e1('0x1f')]+'|'+_0x4e04a3['ipAddress'];var _0x53c948=crypto['createHash'](_0xf4e1('0x13'))[_0xf4e1('0x14')](_0x4b4a59)[_0xf4e1('0x15')](_0xf4e1('0x16'));return _0x53c948[_0xf4e1('0x20')](0x0,0x8)+'-'+_0x53c948['substring'](0x8,0xc)+'-'+_0x53c948['substring'](0xc,0x10)+'-'+_0x53c948['substring'](0x10,0x14)+'-'+_0x53c948[_0xf4e1('0x20')](0x14);}}; \ No newline at end of file diff --git a/server/config/license/index.js b/server/config/license/index.js index c299488..d74731b 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 _0x6555=['get','data1','license','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','update','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','toUpperCase','YYYY-MM-DD\x20HH:mm','diff','days','DEMO\x20START\x20AT\x20%s','error','message','finally','getUuid','License','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','default','util','moment','bluebird','pkginfo','../../components/encryptor','./hardware','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','version','format','%s/api/servers/%s/check?version=%s&oldtoken=%s','GET','then','catch'];(function(_0x4c0998,_0x165050){var _0x1110e2=function(_0x7cb8c3){while(--_0x7cb8c3){_0x4c0998['push'](_0x4c0998['shift']());}};_0x1110e2(++_0x165050);}(_0x6555,0x1df));var _0x5655=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6555[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x5655('0x0'));var moment=require(_0x5655('0x1'));var rp=require('request-promise');var BPromise=require(_0x5655('0x2'));var pkginfo=require(_0x5655('0x3'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0x5655('0x4'));var hardware=require(_0x5655('0x5'));var logger=require('../logger')('license');var HOST=_0x5655('0x6');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x5a6521){return new BPromise(function(_0x388e2a,_0x4a0cc8){var _0x4b858a=util['format'](_0x5655('0x7'),HOST,_0x5a6521,module[_0x5655('0x8')][_0x5655('0x9')]);if(oldToken){_0x4b858a=util[_0x5655('0xa')](_0x5655('0xb'),HOST,_0x5a6521,module[_0x5655('0x8')][_0x5655('0x9')],oldToken);}var _0x2fbe3c={'uri':_0x4b858a,'method':_0x5655('0xc'),'timeout':0xea60,'json':!![]};return rp(_0x2fbe3c)[_0x5655('0xd')](function(_0x575420){_0x388e2a(_0x575420);})[_0x5655('0xe')](function(_0x17507){_0x4a0cc8(_0x17507);});});}function manageLicense(_0x4eef58,_0x5a1b4b){var _0x4bae6c=_0x5a1b4b[_0x5655('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x4bae6c[_0x5655('0x10')]!==_0x4eef58&&!_0x4bae6c['data2']){oldToken=_0x4bae6c[_0x5655('0x10')];}httpRequest(_0x4eef58)[_0x5655('0xd')](function(_0x25f698){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x25f698['active']){isOldTokenSent=![];if(!_0x4bae6c[_0x5655('0x11')]&&_0x4bae6c[_0x5655('0x11')]!=_0x25f698[_0x5655('0x11')]||_0x4bae6c[_0x5655('0x11')]&&_0x4bae6c[_0x5655('0x12')]){logger[_0x5655('0x13')](_0x5655('0x14'));}if(_0x4bae6c[_0x5655('0x11')]&&!_0x4bae6c[_0x5655('0x12')]&&_0x4bae6c[_0x5655('0x11')]!=_0x25f698[_0x5655('0x11')]){logger['info'](_0x5655('0x15'));}if(_0x4bae6c['license']&&!_0x4bae6c[_0x5655('0x12')]&&_0x4bae6c['license']==_0x25f698[_0x5655('0x11')]){return _0x5a1b4b;}return _0x5a1b4b[_0x5655('0x16')]({'data1':_0x4eef58,'data2':null,'license':_0x25f698[_0x5655('0x11')]});}else{if(_0x25f698[_0x5655('0x11')]||_0x4bae6c['license']){if(!_0x4bae6c['data2']){if(_0x4bae6c[_0x5655('0x10')]==_0x4eef58){GRAY_PERIOD_REASON='Disabled';logger[_0x5655('0x13')]('THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED');}else{GRAY_PERIOD_REASON='Changed';logger[_0x5655('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4bae6c[_0x5655('0x10')],_0x4eef58);}logger[_0x5655('0x13')](_0x5655('0x17'),GRAY_PERIOD_REASON[_0x5655('0x18')](),moment()[_0x5655('0xa')](_0x5655('0x19')));return _0x5a1b4b[_0x5655('0x16')]({'data2':encryptor['encryptString'](moment()['format'](_0x5655('0x19')))});}else{if(moment()[_0x5655('0x1a')](encryptor['decryptString'](_0x4bae6c['data2']),_0x5655('0x1b'))>DAYS){logger[_0x5655('0x13')](_0x5655('0x1c'),moment()['format'](_0x5655('0x19')));isOldTokenSent=![];return _0x5a1b4b[_0x5655('0x16')]({'data1':_0x4eef58,'data2':null,'license':null});}}}else{if(_0x4bae6c['data1']!=_0x4eef58){logger[_0x5655('0x13')]('NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s',_0x4bae6c['data1'],_0x4eef58);return _0x5a1b4b[_0x5655('0x16')]({'data1':_0x4eef58,'data2':null,'license':null});}}}return _0x5a1b4b;})[_0x5655('0xd')](function(_0x14548f){_0x5a1b4b=_0x14548f;})[_0x5655('0xe')](function(_0x3d0e91){logger[_0x5655('0x1d')](_0x3d0e91[_0x5655('0x1e')]);})[_0x5655('0x1f')](function(){setTimeout(function(){manageLicense(hardware[_0x5655('0x20')](),_0x5a1b4b);},TIME);});}function defaultLicense(){var _0x28963e=hardware['getUuid']();if(_0x28963e){return db[_0x5655('0x21')][_0x5655('0x22')]({'where':{'id':0x1},'defaults':{'data1':_0x28963e}})[_0x5655('0x23')](function(_0x287706,_0x3a9f53){logger['info'](_0x5655('0x24'),_0x28963e);manageLicense(_0x28963e,_0x287706);})[_0x5655('0xe')](function(_0x156732){logger[_0x5655('0x1d')](_0x156732[_0x5655('0x1e')]);});}}exports[_0x5655('0x25')]=defaultLicense; \ No newline at end of file +var _0x00ad=['../logger','license','https://www.xcallymotion.com','%s/api/servers/%s/check?version=%s','exports','version','%s/api/servers/%s/check?version=%s&oldtoken=%s','then','catch','get','data1','active','data2','info','THE\x20LICENSE\x20HAS\x20BEEN\x20ENABLED','THE\x20LICENSE\x20HAS\x20BEEN\x20UPDATED','Disabled','THE\x20LICENSE\x20HAS\x20BEEN\x20DISABLED','Changed','NEW\x20UUID\x20DETECTED:\x20FROM\x20%s\x20TO\x20%s','%s\x20-\x20GRAY\x20PERIOD\x20STARTED\x20AT\x20%s','update','encryptString','format','YYYY-MM-DD\x20HH:mm','diff','decryptString','days','DEMO\x20START\x20AT\x20%s','error','finally','getUuid','findOrCreate','spread','SERVICE\x20LICENSE\x20STARTED\x20%s','message','util','moment','request-promise','bluebird','pkginfo','../../components/encryptor'];(function(_0x39ff5c,_0x3de001){var _0x1eba54=function(_0x1fcfaa){while(--_0x1fcfaa){_0x39ff5c['push'](_0x39ff5c['shift']());}};_0x1eba54(++_0x3de001);}(_0x00ad,0x1c8));var _0xd00a=function(_0x5b561d,_0x422b7c){_0x5b561d=_0x5b561d-0x0;var _0x431060=_0x00ad[_0x5b561d];return _0x431060;};'use strict';var util=require(_0xd00a('0x0'));var moment=require(_0xd00a('0x1'));var rp=require(_0xd00a('0x2'));var BPromise=require(_0xd00a('0x3'));var pkginfo=require(_0xd00a('0x4'))(module,'version');var db=require('../../mysqldb')['db'];var encryptor=require(_0xd00a('0x5'));var hardware=require('./hardware');var logger=require(_0xd00a('0x6'))(_0xd00a('0x7'));var HOST=_0xd00a('0x8');var TIME=0x3c*0x1388;var DAYS=0x7;var GRAY_PERIOD_REASON;var oldToken;var isOldTokenSent=![];function httpRequest(_0x1abf05){return new BPromise(function(_0x15886f,_0x447267){var _0x1e1bf9=util['format'](_0xd00a('0x9'),HOST,_0x1abf05,module[_0xd00a('0xa')][_0xd00a('0xb')]);if(oldToken){_0x1e1bf9=util['format'](_0xd00a('0xc'),HOST,_0x1abf05,module[_0xd00a('0xa')]['version'],oldToken);}var _0x3b8a19={'uri':_0x1e1bf9,'method':'GET','timeout':0xea60,'json':!![]};return rp(_0x3b8a19)[_0xd00a('0xd')](function(_0xb6801e){_0x15886f(_0xb6801e);})[_0xd00a('0xe')](function(_0x3c4d0b){_0x447267(_0x3c4d0b);});});}function manageLicense(_0x1d176c,_0x28e5e9){var _0x5eaad1=_0x28e5e9[_0xd00a('0xf')]({'plain':!![]});if(!isOldTokenSent&&_0x5eaad1[_0xd00a('0x10')]!==_0x1d176c&&!_0x5eaad1['data2']){oldToken=_0x5eaad1[_0xd00a('0x10')];}httpRequest(_0x1d176c)[_0xd00a('0xd')](function(_0x11bfb2){if(oldToken){oldToken=undefined;isOldTokenSent=!![];}if(_0x11bfb2[_0xd00a('0x11')]){isOldTokenSent=![];if(!_0x5eaad1['license']&&_0x5eaad1['license']!=_0x11bfb2[_0xd00a('0x7')]||_0x5eaad1[_0xd00a('0x7')]&&_0x5eaad1[_0xd00a('0x12')]){logger[_0xd00a('0x13')](_0xd00a('0x14'));}if(_0x5eaad1[_0xd00a('0x7')]&&!_0x5eaad1['data2']&&_0x5eaad1[_0xd00a('0x7')]!=_0x11bfb2[_0xd00a('0x7')]){logger[_0xd00a('0x13')](_0xd00a('0x15'));}if(_0x5eaad1['license']&&!_0x5eaad1[_0xd00a('0x12')]&&_0x5eaad1['license']==_0x11bfb2[_0xd00a('0x7')]){return _0x28e5e9;}return _0x28e5e9['update']({'data1':_0x1d176c,'data2':null,'license':_0x11bfb2['license']});}else{if(_0x11bfb2[_0xd00a('0x7')]||_0x5eaad1[_0xd00a('0x7')]){if(!_0x5eaad1['data2']){if(_0x5eaad1[_0xd00a('0x10')]==_0x1d176c){GRAY_PERIOD_REASON=_0xd00a('0x16');logger[_0xd00a('0x13')](_0xd00a('0x17'));}else{GRAY_PERIOD_REASON=_0xd00a('0x18');logger[_0xd00a('0x13')](_0xd00a('0x19'),_0x5eaad1['data1'],_0x1d176c);}logger[_0xd00a('0x13')](_0xd00a('0x1a'),GRAY_PERIOD_REASON['toUpperCase'](),moment()['format']('YYYY-MM-DD\x20HH:mm'));return _0x28e5e9[_0xd00a('0x1b')]({'data2':encryptor[_0xd00a('0x1c')](moment()[_0xd00a('0x1d')](_0xd00a('0x1e')))});}else{if(moment()[_0xd00a('0x1f')](encryptor[_0xd00a('0x20')](_0x5eaad1[_0xd00a('0x12')]),_0xd00a('0x21'))>DAYS){logger[_0xd00a('0x13')](_0xd00a('0x22'),moment()[_0xd00a('0x1d')](_0xd00a('0x1e')));isOldTokenSent=![];return _0x28e5e9[_0xd00a('0x1b')]({'data1':_0x1d176c,'data2':null,'license':null});}}}else{if(_0x5eaad1[_0xd00a('0x10')]!=_0x1d176c){logger[_0xd00a('0x13')](_0xd00a('0x19'),_0x5eaad1[_0xd00a('0x10')],_0x1d176c);return _0x28e5e9[_0xd00a('0x1b')]({'data1':_0x1d176c,'data2':null,'license':null});}}}return _0x28e5e9;})['then'](function(_0x2e8b71){_0x28e5e9=_0x2e8b71;})[_0xd00a('0xe')](function(_0x587939){logger[_0xd00a('0x23')](_0x587939['message']);})[_0xd00a('0x24')](function(){setTimeout(function(){manageLicense(hardware[_0xd00a('0x25')](),_0x28e5e9);},TIME);});}function defaultLicense(){var _0x2a7e4a=hardware[_0xd00a('0x25')]();if(_0x2a7e4a){return db['License'][_0xd00a('0x26')]({'where':{'id':0x1},'defaults':{'data1':_0x2a7e4a}})[_0xd00a('0x27')](function(_0x8c677,_0x3681cc){logger[_0xd00a('0x13')](_0xd00a('0x28'),_0x2a7e4a);manageLicense(_0x2a7e4a,_0x8c677);})['catch'](function(_0x50b4dc){logger[_0xd00a('0x23')](_0x50b4dc[_0xd00a('0x29')]);});}}exports['default']=defaultLicense; \ No newline at end of file diff --git a/server/config/license/util.js b/server/config/license/util.js index 3a508b0..6420910 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 _0x7103=['count','admin','user','telephone','users','telephones','forEach','countBy','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','../../components/encryptor','../../mysqldb','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','split','decryptString','format','parse','demo','machineUuid','gray','add','days','grayReason','disabled','User','role','COUNT','sequelize','col'];(function(_0x5b701c,_0x23458a){var _0x580ad3=function(_0x102a06){while(--_0x102a06){_0x5b701c['push'](_0x5b701c['shift']());}};_0x580ad3(++_0x23458a);}(_0x7103,0xb6));var _0x3710=function(_0x6d79da,_0x274df3){_0x6d79da=_0x6d79da-0x0;var _0x17e3ae=_0x7103[_0x6d79da];return _0x17e3ae;};'use strict';var util=require(_0x3710('0x0'));var _=require(_0x3710('0x1'));var moment=require(_0x3710('0x2'));var BPromise=require(_0x3710('0x3'));var hardware=require('./hardware');var encryptor=require(_0x3710('0x4'));var db=require(_0x3710('0x5'))['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0x3710('0x6'),'machineUuid':hardware[_0x3710('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':'2027-01-01T00:00:00.000Z','chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0x3710('0x8'),'machineUuid':hardware[_0x3710('0x7')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x54fb6c){return new BPromise(function(_0xa3f883,_0x5450b9){return db[_0x3710('0x9')][_0x3710('0xa')](_[_0x3710('0xb')](_0x54fb6c,{'raw':!![],'where':{'id':0x1}}))[_0x3710('0xc')](function(_0x3fe79c){return checkLicense(_0x3fe79c,null);})[_0x3710('0xc')](function(_0x58d914){_0xa3f883(_0x58d914);return;})[_0x3710('0xd')](function(_0x2a4f99){_0x5450b9(_0x2a4f99);});});}function checkLicense(_0x560568,_0x44972d){if(!_0x560568){demoLicense[_0x3710('0xe')]=_0x560568[_0x3710('0xf')];return demoLicense;}try{var _0x333937=_0x44972d||_0x560568[_0x3710('0x10')];if(_['isEmpty'](_0x333937)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x40b219=_0x560568[_0x3710('0xf')];var _0x3c653c=_0x560568['data2'];var _0xdf8acb=_0x40b219[_0x3710('0x11')]('-')[0x4];var _0x5a5315=_0x40b219['split']('-')[0x0];var _0x2e6f12=encryptor[_0x3710('0x12')](_0x333937,util[_0x3710('0x13')]('%s:%s:%s',_0xdf8acb,_0x40b219,_0x5a5315));var _0x3d81d5=JSON[_0x3710('0x14')](_0x2e6f12);_0x3d81d5[_0x3710('0x15')]=![];_0x3d81d5[_0x3710('0xe')]=_0x40b219;_0x3d81d5[_0x3710('0x16')]=hardware['getUuid']();if(_0x3c653c){var _0x377a74=encryptor[_0x3710('0x12')](_0x3c653c);_0x3d81d5[_0x3710('0x17')]=_0x377a74;_0x3d81d5['deadline']=moment(_0x377a74)[_0x3710('0x18')](0x7,_0x3710('0x19'))['format']();_0x3d81d5[_0x3710('0x1a')]=_0x3d81d5[_0x3710('0xe')]!=_0x3d81d5[_0x3710('0x16')]?'changed':_0x3710('0x1b');}return _0x3d81d5;}catch(_0x12d615){breakingLicense[_0x3710('0xe')]=_0x560568[_0x3710('0xf')];breakingLicense['message']=_0x12d615['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x2f77fd,_0x59177f){getLicense()[_0x3710('0xc')](function(_0x3c8fb4){return db[_0x3710('0x1c')]['findAll']({'attributes':[_0x3710('0x1d'),[db['sequelize']['fn'](_0x3710('0x1e'),db[_0x3710('0x1f')][_0x3710('0x20')]('role')),_0x3710('0x21')]],'group':_0x3710('0x1d'),'where':{'role':{'$or':[_0x3710('0x22'),_0x3710('0x23'),_0x3710('0x24')]}},'raw':!![]})['then'](function(_0x1430d6){var _0x44a9cf={'user':_0x3c8fb4[_0x3710('0x25')]||0x0,'telephone':_0x3c8fb4[_0x3710('0x26')]||0x0};_0x1430d6[_0x3710('0x27')](function(_0x411dca){var _0x55a11d=_0x411dca[_0x3710('0x1d')]===_0x3710('0x22')?_0x3710('0x23'):_0x411dca['role'];_0x44a9cf[_0x55a11d]-=_0x411dca['count'];if(_0x44a9cf[_0x55a11d]<0x0)_0x44a9cf[_0x55a11d]=0x0;});_0x2f77fd(_0x44a9cf);return;});})[_0x3710('0xd')](function(_0x39e511){_0x59177f(_0x39e511);});});}function checkUserLimits(_0x1c4395){return new BPromise(function(_0x3afe62,_0x2f8b7d){getLimits()[_0x3710('0xc')](function(_0x2f38d5){var _0x5c5405=_['pick'](_[_0x3710('0x28')](_0x1c4395,_0x3710('0x1d')),[_0x3710('0x22'),_0x3710('0x23'),'telephone']);var _0x5b6352=(_0x5c5405[_0x3710('0x22')]||0x0)+(_0x5c5405['user']||0x0);var _0xf9f1a8=_0x5c5405[_0x3710('0x24')]||0x0;if(_0x5b6352>_0x2f38d5['user'])return _0x2f8b7d('License\x20limit\x20reached\x20for\x20users');if(_0xf9f1a8>_0x2f38d5['telephone'])return _0x2f8b7d(_0x3710('0x29'));return _0x3afe62();})['catch'](function(_0x26580c){_0x2f8b7d(_0x26580c);});});}module[_0x3710('0x2a')]={'checkLicense':checkLicense,'checkUserLimits':checkUserLimits,'getLicense':getLicense}; \ No newline at end of file +var _0x08fe=['admin','count','pick','telephone','License\x20limit\x20reached\x20for\x20telephones','exports','util','lodash','moment','bluebird','./hardware','../../components/encryptor','2027-01-01T00:00:00.000Z','Demo\x20license','getUuid','Breaking\x20license','License','find','defaults','then','catch','uuid','data1','license','data2','split','decryptString','format','%s:%s:%s','parse','demo','machineUuid','gray','deadline','days','grayReason','changed','User','role','sequelize','COUNT','col','user','users','telephones','forEach'];(function(_0x19950b,_0x53d0d7){var _0x3c6b41=function(_0x3924ad){while(--_0x3924ad){_0x19950b['push'](_0x19950b['shift']());}};_0x3c6b41(++_0x53d0d7);}(_0x08fe,0xec));var _0xe08f=function(_0x251e8c,_0x277c33){_0x251e8c=_0x251e8c-0x0;var _0x1e0c1d=_0x08fe[_0x251e8c];return _0x1e0c1d;};'use strict';var util=require(_0xe08f('0x0'));var _=require(_0xe08f('0x1'));var moment=require(_0xe08f('0x2'));var BPromise=require(_0xe08f('0x3'));var hardware=require(_0xe08f('0x4'));var encryptor=require(_0xe08f('0x5'));var db=require('../../mysqldb')['db'];const demoLicense={'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe08f('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'description':_0xe08f('0x7'),'machineUuid':hardware[_0xe08f('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};const breakingLicense={'breaking':!![],'demo':!![],'agents':0x2,'telephones':0x0,'users':0x1,'expiration':_0xe08f('0x6'),'chat':![],'mail':![],'fax':![],'messaging':![],'whatsapp':![],'cm':![],'dialer':![],'jscripty':![],'openchannel':![],'callysquare':0x2,'webrtc':![],'jaws':![],'custom':![],'update':![],'description':_0xe08f('0x9'),'machineUuid':hardware[_0xe08f('0x8')](),'virtual':0x0,'voice':!![],'screenrecording':![],'preferred':![],'ai':![]};function getLicense(_0x44a5f8){return new BPromise(function(_0x46fc3a,_0x39bd01){return db[_0xe08f('0xa')][_0xe08f('0xb')](_[_0xe08f('0xc')](_0x44a5f8,{'raw':!![],'where':{'id':0x1}}))[_0xe08f('0xd')](function(_0x29f048){return checkLicense(_0x29f048,null);})[_0xe08f('0xd')](function(_0x1478f0){_0x46fc3a(_0x1478f0);return;})[_0xe08f('0xe')](function(_0x379fdd){_0x39bd01(_0x379fdd);});});}function checkLicense(_0x49dda2,_0x373a3a){if(!_0x49dda2){demoLicense[_0xe08f('0xf')]=_0x49dda2[_0xe08f('0x10')];return demoLicense;}try{var _0x18b82a=_0x373a3a||_0x49dda2[_0xe08f('0x11')];if(_['isEmpty'](_0x18b82a)){throw new Error('License\x20key\x20value\x20not\x20found');}var _0x19f9db=_0x49dda2[_0xe08f('0x10')];var _0x2f3b51=_0x49dda2[_0xe08f('0x12')];var _0x43898c=_0x19f9db[_0xe08f('0x13')]('-')[0x4];var _0x2a4860=_0x19f9db['split']('-')[0x0];var _0x5f3dca=encryptor[_0xe08f('0x14')](_0x18b82a,util[_0xe08f('0x15')](_0xe08f('0x16'),_0x43898c,_0x19f9db,_0x2a4860));var _0x1e0a7c=JSON[_0xe08f('0x17')](_0x5f3dca);_0x1e0a7c[_0xe08f('0x18')]=![];_0x1e0a7c[_0xe08f('0xf')]=_0x19f9db;_0x1e0a7c[_0xe08f('0x19')]=hardware['getUuid']();if(_0x2f3b51){var _0x4524a9=encryptor[_0xe08f('0x14')](_0x2f3b51);_0x1e0a7c[_0xe08f('0x1a')]=_0x4524a9;_0x1e0a7c[_0xe08f('0x1b')]=moment(_0x4524a9)['add'](0x7,_0xe08f('0x1c'))[_0xe08f('0x15')]();_0x1e0a7c[_0xe08f('0x1d')]=_0x1e0a7c[_0xe08f('0xf')]!=_0x1e0a7c[_0xe08f('0x19')]?_0xe08f('0x1e'):'disabled';}return _0x1e0a7c;}catch(_0x2eba9c){breakingLicense[_0xe08f('0xf')]=_0x49dda2['data1'];breakingLicense['message']=_0x2eba9c['message'];return breakingLicense;}}function getLimits(){return new BPromise(function(_0x566d1f,_0x316338){getLicense()[_0xe08f('0xd')](function(_0x69540f){return db[_0xe08f('0x1f')]['findAll']({'attributes':[_0xe08f('0x20'),[db[_0xe08f('0x21')]['fn'](_0xe08f('0x22'),db[_0xe08f('0x21')][_0xe08f('0x23')](_0xe08f('0x20'))),'count']],'group':'role','where':{'role':{'$or':['admin',_0xe08f('0x24'),'telephone']}},'raw':!![]})[_0xe08f('0xd')](function(_0xe7a681){var _0x5f5bc8={'user':_0x69540f[_0xe08f('0x25')]||0x0,'telephone':_0x69540f[_0xe08f('0x26')]||0x0};_0xe7a681[_0xe08f('0x27')](function(_0x44535f){var _0x1faa5a=_0x44535f[_0xe08f('0x20')]===_0xe08f('0x28')?_0xe08f('0x24'):_0x44535f[_0xe08f('0x20')];_0x5f5bc8[_0x1faa5a]-=_0x44535f[_0xe08f('0x29')];if(_0x5f5bc8[_0x1faa5a]<0x0)_0x5f5bc8[_0x1faa5a]=0x0;});_0x566d1f(_0x5f5bc8);return;});})[_0xe08f('0xe')](function(_0x536a0d){_0x316338(_0x536a0d);});});}function checkUserLimits(_0x466bd5){return new BPromise(function(_0x2d2bdc,_0x320d7f){getLimits()[_0xe08f('0xd')](function(_0x402137){var _0xb6df9b=_[_0xe08f('0x2a')](_['countBy'](_0x466bd5,'role'),[_0xe08f('0x28'),_0xe08f('0x24'),_0xe08f('0x2b')]);var _0x2cebad=(_0xb6df9b[_0xe08f('0x28')]||0x0)+(_0xb6df9b[_0xe08f('0x24')]||0x0);var _0x5d276c=_0xb6df9b[_0xe08f('0x2b')]||0x0;if(_0x2cebad>_0x402137[_0xe08f('0x24')])return _0x320d7f('License\x20limit\x20reached\x20for\x20users');if(_0x5d276c>_0x402137['telephone'])return _0x320d7f(_0xe08f('0x2c'));return _0x2d2bdc();})[_0xe08f('0xe')](function(_0x437cf8){_0x320d7f(_0x437cf8);});});}module[_0xe08f('0x2d')]={'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 9d1d227..99dd7e1 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 _0x0120=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x560557,_0x9c8ce){var _0x5f4caa=function(_0x438a3b){while(--_0x438a3b){_0x560557['push'](_0x560557['shift']());}};_0x5f4caa(++_0x9c8ce);}(_0x0120,0x6f));var _0x0012=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0x0120[_0x2f5ac5];return _0x37c9a8;};'use strict';module[_0x0012('0x0')]={'DOMAIN':_0x0012('0x1'),'SESSION_SECRET':_0x0012('0x2'),'GOOGLE_ID':_0x0012('0x3'),'GOOGLE_SECRET':_0x0012('0x4'),'DEBUG':''}; \ No newline at end of file +var _0x0120=['secret','exports','http://localhost:9000','myappanuglar-secret','app-id'];(function(_0x16da71,_0x206088){var _0x20f244=function(_0x16a069){while(--_0x16a069){_0x16da71['push'](_0x16da71['shift']());}};_0x20f244(++_0x206088);}(_0x0120,0x6f));var _0x0012=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0x0120[_0x5ddb1c];return _0x354adc;};'use strict';module[_0x0012('0x0')]={'DOMAIN':_0x0012('0x1'),'SESSION_SECRET':_0x0012('0x2'),'GOOGLE_ID':_0x0012('0x3'),'GOOGLE_SECRET':_0x0012('0x4'),'DEBUG':''}; \ No newline at end of file diff --git a/server/config/logger.js b/server/config/logger.js index 2f0f9fd..c8ba151 100644 --- a/server/config/logger.js +++ b/server/config/logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7f46=['fileLogger','../utils/loggers'];(function(_0x419550,_0x15cdf1){var _0x55f9ef=function(_0x44f707){while(--_0x44f707){_0x419550['push'](_0x419550['shift']());}};_0x55f9ef(++_0x15cdf1);}(_0x7f46,0xad));var _0x67f4=function(_0x4591ee,_0x3a1daf){_0x4591ee=_0x4591ee-0x0;var _0x4cdb81=_0x7f46[_0x4591ee];return _0x4cdb81;};'use strict';var fileLogger=require(_0x67f4('0x0'))[_0x67f4('0x1')];module['exports']=fileLogger; \ No newline at end of file +var _0x16c4=['../utils/loggers','exports'];(function(_0x33032e,_0x31411a){var _0x13316b=function(_0x2fb049){while(--_0x2fb049){_0x33032e['push'](_0x33032e['shift']());}};_0x13316b(++_0x31411a);}(_0x16c4,0x72));var _0x416c=function(_0x2ca9d4,_0x51d5c6){_0x2ca9d4=_0x2ca9d4-0x0;var _0x258956=_0x16c4[_0x2ca9d4];return _0x258956;};'use strict';var fileLogger=require(_0x416c('0x0'))['fileLogger'];module[_0x416c('0x1')]=fileLogger; \ No newline at end of file diff --git a/server/config/pm2/config.js b/server/config/pm2/config.js index 702555f..bd7bfd3 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 _0xea4b=['../../services/agi/index.js','email','../../services/email/index.js','../../services/routing/index.js','xdr','../../services/xdr/index.js','path','../../config/environment','resolve','join','root','legacy-libs','express','ami','agi'];(function(_0x1f58a6,_0x48a33a){var _0x1f320e=function(_0x1abd7d){while(--_0x1abd7d){_0x1f58a6['push'](_0x1f58a6['shift']());}};_0x1f320e(++_0x48a33a);}(_0xea4b,0xe7));var _0xbea4=function(_0x698e19,_0x37fd58){_0x698e19=_0x698e19-0x0;var _0x3db5bf=_0xea4b[_0x698e19];return _0x3db5bf;};'use strict';var path=require(_0xbea4('0x0'));var cfg=require(_0xbea4('0x1'));var env={'NODE_PATH':path[_0xbea4('0x2')](path[_0xbea4('0x3')](cfg[_0xbea4('0x4')],_0xbea4('0x5')))};var pm2config={'apps':[{'name':_0xbea4('0x6'),'script':path[_0xbea4('0x3')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0xbea4('0x7'),'script':path[_0xbea4('0x3')](__dirname,'../../services/ami/index.js'),'env':env},{'name':_0xbea4('0x8'),'script':path[_0xbea4('0x3')](__dirname,_0xbea4('0x9')),'env':env},{'name':_0xbea4('0xa'),'script':path[_0xbea4('0x3')](__dirname,_0xbea4('0xb')),'env':env},{'name':'routing','script':path[_0xbea4('0x3')](__dirname,_0xbea4('0xc')),'env':env},{'name':_0xbea4('0xd'),'script':path[_0xbea4('0x3')](__dirname,_0xbea4('0xe')),'env':env}]};module['exports']=pm2config; \ No newline at end of file +var _0xbf21=['../../services/ami/index.js','agi','../../services/agi/index.js','email','../../services/email/index.js','routing','../../services/routing/index.js','xdr','../../services/xdr/index.js','exports','path','../../config/environment','resolve','root','legacy-libs','express','join','ami'];(function(_0x476ea3,_0x239d39){var _0xe3e2a=function(_0x35b20d){while(--_0x35b20d){_0x476ea3['push'](_0x476ea3['shift']());}};_0xe3e2a(++_0x239d39);}(_0xbf21,0x14e));var _0x1bf2=function(_0x23b4e1,_0x197f7f){_0x23b4e1=_0x23b4e1-0x0;var _0x20d391=_0xbf21[_0x23b4e1];return _0x20d391;};'use strict';var path=require(_0x1bf2('0x0'));var cfg=require(_0x1bf2('0x1'));var env={'NODE_PATH':path[_0x1bf2('0x2')](path['join'](cfg[_0x1bf2('0x3')],_0x1bf2('0x4')))};var pm2config={'apps':[{'name':_0x1bf2('0x5'),'script':path[_0x1bf2('0x6')](__dirname,'../../services/express/index.js'),'env':env},{'name':_0x1bf2('0x7'),'script':path['join'](__dirname,_0x1bf2('0x8')),'env':env},{'name':_0x1bf2('0x9'),'script':path['join'](__dirname,_0x1bf2('0xa')),'env':env},{'name':_0x1bf2('0xb'),'script':path[_0x1bf2('0x6')](__dirname,_0x1bf2('0xc')),'env':env},{'name':_0x1bf2('0xd'),'script':path[_0x1bf2('0x6')](__dirname,_0x1bf2('0xe')),'env':env},{'name':_0x1bf2('0xf'),'script':path[_0x1bf2('0x6')](__dirname,_0x1bf2('0x10')),'env':env}]};module[_0x1bf2('0x11')]=pm2config; \ No newline at end of file diff --git a/server/config/pm2/index.js b/server/config/pm2/index.js index ad018f9..84aace5 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 _0x15c3=['delete','dump','saved','pm2','./config','connect','then','start','disconnect','stop','restart','list','describe'];(function(_0x11c065,_0x41f17b){var _0x27b50f=function(_0x47a43d){while(--_0x47a43d){_0x11c065['push'](_0x11c065['shift']());}};_0x27b50f(++_0x41f17b);}(_0x15c3,0x114));var _0x315c=function(_0x2794e4,_0x9147ec){_0x2794e4=_0x2794e4-0x0;var _0x5ebd69=_0x15c3[_0x2794e4];return _0x5ebd69;};'use strict';var pm2=require(_0x315c('0x0'));var BPromise=require('bluebird');var config=require(_0x315c('0x1'));function connect(){return new BPromise(function(_0x186ac7,_0x6c8551){return pm2[_0x315c('0x2')](function(_0x5f01cb){if(_0x5f01cb){return _0x6c8551(_0x5f01cb);}return _0x186ac7('connected');});});};exports['start']=function(_0x53ad0f){return connect()[_0x315c('0x3')](function(){return new BPromise(function(_0x247443,_0x1152d4){return pm2[_0x315c('0x4')](_0x53ad0f,function(_0x53835e,_0xb200f9){if(_0x53835e){return _0x1152d4(_0x53835e);}pm2[_0x315c('0x5')]();return _0x247443(_0xb200f9);});});});};exports['stop']=function(_0x387806){return connect()[_0x315c('0x3')](function(){return new BPromise(function(_0x13ddd5,_0x238f90){return pm2[_0x315c('0x6')](_0x387806,function(_0x4fe991,_0x5706e0){if(_0x4fe991){return _0x238f90(_0x4fe991);}pm2[_0x315c('0x5')]();return _0x13ddd5(_0x5706e0);});});});};exports[_0x315c('0x7')]=function(_0x22a71b){return connect()[_0x315c('0x3')](function(){return new BPromise(function(_0x4e9b3c,_0x58afe5){return pm2[_0x315c('0x7')](_0x22a71b,function(_0x1724b3,_0x918d8){if(_0x1724b3){return _0x58afe5(_0x1724b3);}pm2[_0x315c('0x5')]();return _0x4e9b3c(_0x918d8);});});});};exports[_0x315c('0x8')]=function(){return connect()[_0x315c('0x3')](function(){return new BPromise(function(_0x107138,_0x976833){return pm2[_0x315c('0x8')](function(_0x21059b,_0x497555){if(_0x21059b){return _0x976833(_0x21059b);}pm2[_0x315c('0x5')]();return _0x107138(_0x497555);});});});};exports[_0x315c('0x9')]=function(_0x23376a){return connect()[_0x315c('0x3')](function(){return new BPromise(function(_0x1ccf2d,_0x360f93){return pm2[_0x315c('0x9')](_0x23376a,function(_0x4dc8d0,_0x2905fc){if(_0x4dc8d0){return _0x360f93(_0x4dc8d0);}pm2['disconnect']();return _0x1ccf2d(_0x2905fc);});});});};exports[_0x315c('0xa')]=function(_0x541cd7){return connect()['then'](function(){return new BPromise(function(_0x443731,_0x2ae7ec){return pm2[_0x315c('0xa')](_0x541cd7,function(_0x422a31,_0x24f03f){if(_0x422a31){return _0x2ae7ec(_0x422a31);}pm2['disconnect']();return _0x443731(_0x24f03f);});});});};exports[_0x315c('0xb')]=function(){return connect()['then'](function(){return new BPromise(function(_0x54dd39,_0x2096a9){return pm2[_0x315c('0xb')](function(_0x2a48c6){if(_0x2a48c6){return _0x2096a9(_0x2a48c6);}return _0x54dd39(_0x315c('0xc'));});});});}; \ No newline at end of file +var _0xc676=['list','describe','delete','dump','pm2','bluebird','./config','start','disconnect','stop','then','restart'];(function(_0x49ebb4,_0x56551d){var _0x3368da=function(_0x2b0914){while(--_0x2b0914){_0x49ebb4['push'](_0x49ebb4['shift']());}};_0x3368da(++_0x56551d);}(_0xc676,0x124));var _0x6c67=function(_0x479636,_0x187370){_0x479636=_0x479636-0x0;var _0x581660=_0xc676[_0x479636];return _0x581660;};'use strict';var pm2=require(_0x6c67('0x0'));var BPromise=require(_0x6c67('0x1'));var config=require(_0x6c67('0x2'));function connect(){return new BPromise(function(_0x28eaa8,_0x5e8bef){return pm2['connect'](function(_0x56e633){if(_0x56e633){return _0x5e8bef(_0x56e633);}return _0x28eaa8('connected');});});};exports[_0x6c67('0x3')]=function(_0x2abe70){return connect()['then'](function(){return new BPromise(function(_0x1accd9,_0x15a6dd){return pm2[_0x6c67('0x3')](_0x2abe70,function(_0x72d4dd,_0x2cb002){if(_0x72d4dd){return _0x15a6dd(_0x72d4dd);}pm2[_0x6c67('0x4')]();return _0x1accd9(_0x2cb002);});});});};exports[_0x6c67('0x5')]=function(_0x312dfb){return connect()[_0x6c67('0x6')](function(){return new BPromise(function(_0x16db74,_0x44f425){return pm2[_0x6c67('0x5')](_0x312dfb,function(_0x2c4ef5,_0x30239f){if(_0x2c4ef5){return _0x44f425(_0x2c4ef5);}pm2[_0x6c67('0x4')]();return _0x16db74(_0x30239f);});});});};exports[_0x6c67('0x7')]=function(_0x5ab534){return connect()[_0x6c67('0x6')](function(){return new BPromise(function(_0x3a320d,_0x5a862a){return pm2[_0x6c67('0x7')](_0x5ab534,function(_0x1e02ea,_0x353045){if(_0x1e02ea){return _0x5a862a(_0x1e02ea);}pm2[_0x6c67('0x4')]();return _0x3a320d(_0x353045);});});});};exports[_0x6c67('0x8')]=function(){return connect()[_0x6c67('0x6')](function(){return new BPromise(function(_0x145c1f,_0x2b1554){return pm2[_0x6c67('0x8')](function(_0xd592af,_0x341391){if(_0xd592af){return _0x2b1554(_0xd592af);}pm2[_0x6c67('0x4')]();return _0x145c1f(_0x341391);});});});};exports[_0x6c67('0x9')]=function(_0x52f459){return connect()[_0x6c67('0x6')](function(){return new BPromise(function(_0x46635c,_0x53a919){return pm2['describe'](_0x52f459,function(_0x2cf08d,_0x43e27a){if(_0x2cf08d){return _0x53a919(_0x2cf08d);}pm2[_0x6c67('0x4')]();return _0x46635c(_0x43e27a);});});});};exports[_0x6c67('0xa')]=function(_0x4bb867){return connect()[_0x6c67('0x6')](function(){return new BPromise(function(_0x2fc389,_0x33e9a8){return pm2[_0x6c67('0xa')](_0x4bb867,function(_0x4f1908,_0x217355){if(_0x4f1908){return _0x33e9a8(_0x4f1908);}pm2['disconnect']();return _0x2fc389(_0x217355);});});});};exports[_0x6c67('0xb')]=function(){return connect()[_0x6c67('0x6')](function(){return new BPromise(function(_0x3eeaab,_0x9fd32f){return pm2[_0x6c67('0xb')](function(_0x1e0ebf){if(_0x1e0ebf){return _0x9fd32f(_0x1e0ebf);}return _0x3eeaab('saved');});});});}; \ No newline at end of file diff --git a/server/config/schedule/chat.js b/server/config/schedule/chat.js index e17058e..c738c8a 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 _0x0115=['socket.io-emitter','Setting','find','then','chatTimeout','ChatInteraction','findAll','lastMsgAt','minutes','map','info','join','update','system','YYYY-MM-DD\x20HH:mm:ss','length','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','util','../../config/environment','../../mysqldb','redis','defaults','localhost'];(function(_0x3c2a69,_0x4c8b41){var _0x596bc8=function(_0x1b4b7c){while(--_0x1b4b7c){_0x3c2a69['push'](_0x3c2a69['shift']());}};_0x596bc8(++_0x4c8b41);}(_0x0115,0x156));var _0x5011=function(_0x31b323,_0x4d1cfe){_0x31b323=_0x31b323-0x0;var _0x557071=_0x0115[_0x31b323];return _0x557071;};'use strict';var _=require('lodash');var moment=require('moment');var Redis=require('ioredis');var util=require(_0x5011('0x0'));var config=require(_0x5011('0x1'));var db=require(_0x5011('0x2'))['db'];var logger=require('../logger')('schedule');config[_0x5011('0x3')]=_[_0x5011('0x4')](config[_0x5011('0x3')],{'host':_0x5011('0x5'),'port':0x18eb});var io=require(_0x5011('0x6'))(new Redis(config[_0x5011('0x3')]));function closeInteractions(){var _0x2c75f0=0x0;var _0x103cee=[];return db[_0x5011('0x7')][_0x5011('0x8')]({'raw':!![],'attributes':['id','chatTimeout'],'where':{'id':0x1}})[_0x5011('0x9')](function(_0x2a6295){_0x2c75f0=_0x2a6295[_0x5011('0xa')];if(_0x2c75f0){return db[_0x5011('0xb')][_0x5011('0xc')]({'raw':!![],'attributes':['id',_0x5011('0xd')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()['subtract'](_0x2a6295[_0x5011('0xa')],_0x5011('0xe'))}}});}else{return[];}})[_0x5011('0x9')](function(_0x508074){if(_0x508074&&_0x508074['length']){_0x103cee=_[_0x5011('0xf')](_0x508074||[],'id');logger[_0x5011('0x10')]('[CHAT]\x20Interactions\x20to\x20close:',_0x103cee[_0x5011('0x11')]());return db[_0x5011('0xb')][_0x5011('0x12')]({'closeReason':_0x5011('0x13'),'disposition':'timeout','closed':!![],'closedAt':moment()['format'](_0x5011('0x14'))},{'where':{'id':_0x103cee}});}})[_0x5011('0x9')](function(){if(_0x103cee&&_0x103cee[_0x5011('0x15')]){logger[_0x5011('0x10')](_0x5011('0x16'),_0x103cee[_0x5011('0x11')]());for(var _0x407681=0x0;_0x407681<_0x103cee['length'];_0x407681++){io[_0x5011('0x17')](_0x5011('0x18'),{'id':_0x103cee[_0x407681],'closed':!![]});}}})['catch'](function(_0x460e8c){logger[_0x5011('0x19')](_0x5011('0x1a'),_0x460e8c?util[_0x5011('0x1b')](_0x460e8c,{'showHidden':![],'depth':null}):'');});}exports[_0x5011('0x1c')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x346d=['../../mysqldb','defaults','localhost','socket.io-emitter','Setting','chatTimeout','then','findAll','lastMsgAt','subtract','minutes','length','info','[CHAT]\x20Interactions\x20to\x20close:','update','system','timeout','format','YYYY-MM-DD\x20HH:mm:ss','[CHAT]\x20Sending\x20updates\x20for\x20interactions:','emit','chatInteraction:update','error','[CHAT]\x20Error\x20closing\x20interactions','inspect','start','moment','ioredis','util','../../config/environment'];(function(_0x934425,_0x5af72f){var _0x31d596=function(_0x219869){while(--_0x219869){_0x934425['push'](_0x934425['shift']());}};_0x31d596(++_0x5af72f);}(_0x346d,0x164));var _0xd346=function(_0x25cd2c,_0x57498e){_0x25cd2c=_0x25cd2c-0x0;var _0x1e364c=_0x346d[_0x25cd2c];return _0x1e364c;};'use strict';var _=require('lodash');var moment=require(_0xd346('0x0'));var Redis=require(_0xd346('0x1'));var util=require(_0xd346('0x2'));var config=require(_0xd346('0x3'));var db=require(_0xd346('0x4'))['db'];var logger=require('../logger')('schedule');config['redis']=_[_0xd346('0x5')](config['redis'],{'host':_0xd346('0x6'),'port':0x18eb});var io=require(_0xd346('0x7'))(new Redis(config['redis']));function closeInteractions(){var _0x365a83=0x0;var _0xd9fdf6=[];return db[_0xd346('0x8')]['find']({'raw':!![],'attributes':['id',_0xd346('0x9')],'where':{'id':0x1}})[_0xd346('0xa')](function(_0x2d9d18){_0x365a83=_0x2d9d18[_0xd346('0x9')];if(_0x365a83){return db['ChatInteraction'][_0xd346('0xb')]({'raw':!![],'attributes':['id',_0xd346('0xc')],'where':{'closed':![],'lastMsgAt':{'$lt':moment()[_0xd346('0xd')](_0x2d9d18[_0xd346('0x9')],_0xd346('0xe'))}}});}else{return[];}})[_0xd346('0xa')](function(_0x57ee78){if(_0x57ee78&&_0x57ee78[_0xd346('0xf')]){_0xd9fdf6=_['map'](_0x57ee78||[],'id');logger[_0xd346('0x10')](_0xd346('0x11'),_0xd9fdf6['join']());return db['ChatInteraction'][_0xd346('0x12')]({'closeReason':_0xd346('0x13'),'disposition':_0xd346('0x14'),'closed':!![],'closedAt':moment()[_0xd346('0x15')](_0xd346('0x16'))},{'where':{'id':_0xd9fdf6}});}})['then'](function(){if(_0xd9fdf6&&_0xd9fdf6[_0xd346('0xf')]){logger[_0xd346('0x10')](_0xd346('0x17'),_0xd9fdf6['join']());for(var _0x32802c=0x0;_0x32802c<_0xd9fdf6[_0xd346('0xf')];_0x32802c++){io[_0xd346('0x18')](_0xd346('0x19'),{'id':_0xd9fdf6[_0x32802c],'closed':!![]});}}})['catch'](function(_0x56af32){logger[_0xd346('0x1a')](_0xd346('0x1b'),_0x56af32?util[_0xd346('0x1c')](_0x56af32,{'showHidden':![],'depth':null}):'');});}exports[_0xd346('0x1d')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file diff --git a/server/config/schedule/cloud-provider.js b/server/config/schedule/cloud-provider.js index 7d79813..d26c8e7 100644 --- a/server/config/schedule/cloud-provider.js +++ b/server/config/schedule/cloud-provider.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xedf6=['startAllRefreshIntervals','exports'];(function(_0x50e351,_0x35608c){var _0x418d06=function(_0x26145a){while(--_0x26145a){_0x50e351['push'](_0x50e351['shift']());}};_0x418d06(++_0x35608c);}(_0xedf6,0x1f2));var _0x6edf=function(_0x53a7a8,_0xed2bff){_0x53a7a8=_0x53a7a8-0x0;var _0x555f71=_0xedf6[_0x53a7a8];return _0x555f71;};'use strict';function start(){var _0x1677fb=require('../../api/cloudProvider/cloudProvider.oauth.js');return _0x1677fb[_0x6edf('0x0')]();}module[_0x6edf('0x1')]={'intervals':{},'start':start}; \ No newline at end of file +var _0xa6c3=['exports','../../api/cloudProvider/cloudProvider.oauth.js','startAllRefreshIntervals'];(function(_0x44e65f,_0x3280a3){var _0x38a0cf=function(_0x314d50){while(--_0x314d50){_0x44e65f['push'](_0x44e65f['shift']());}};_0x38a0cf(++_0x3280a3);}(_0xa6c3,0x1d2));var _0x3a6c=function(_0x2e04ef,_0x31a596){_0x2e04ef=_0x2e04ef-0x0;var _0x5722b0=_0xa6c3[_0x2e04ef];return _0x5722b0;};'use strict';function start(){var _0x2c52c1=require(_0x3a6c('0x0'));return _0x2c52c1[_0x3a6c('0x1')]();}module[_0x3a6c('0x2')]={'intervals':{},'start':start}; \ No newline at end of file diff --git a/server/config/schedule/index.js b/server/config/schedule/index.js index a7dcc76..276614e 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 _0xec9a=['MailAccount','name','Smtp','user','bcc','format','join','../../files/reports','savename','%s.%s','basename','extname','zip','status','Sent','message','text','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','attachments','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','request','SendMail','error','error\x20mail','stringify','email\x20sent','catch','isNil','subtractNumber','subtractUnit','subtract','YYYY-MM-DD\x20HH:mm:ss','output','DefaultReportId','runReport','then','exec\x20custom\x20report\x20id:%s','CustomReportId','no\x20report\x20id','Schedule','findAll','MailServerOut','CloudProvider','keys','jobs','map','toString','keyBy','intersection','difference','length','exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','run\x20job','cron','active','isBetween','add','start','add\x20cron','stop\x20cron','startAt','endAt','update','update\x20cron','util','lodash','moment','jayson/promise','bluebird','../logger','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','email','getSmtpOptions','\x22%s\x22\x20<%s>'];(function(_0x20c4ea,_0x40edad){var _0x38f70d=function(_0x37fe1b){while(--_0x37fe1b){_0x20c4ea['push'](_0x20c4ea['shift']());}};_0x38f70d(++_0x40edad);}(_0xec9a,0xf7));var _0xaec9=function(_0x239a41,_0x3d82df){_0x239a41=_0x239a41-0x0;var _0xe6228d=_0xec9a[_0x239a41];return _0xe6228d;};'use strict';var fs=require('fs');var util=require(_0xaec9('0x0'));var path=require('path');var _=require(_0xaec9('0x1'));var moment=require(_0xaec9('0x2'));var CronJobManager=require('cron-job-manager');var jayson=require(_0xaec9('0x3'));var BPromise=require(_0xaec9('0x4'));var logger=require(_0xaec9('0x5'))(_0xaec9('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0xaec9('0x7'));var analyticDefaultReportController=require(_0xaec9('0x8'));var client=jayson[_0xaec9('0x9')][_0xaec9('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x4e0d60,_0x259baf){return function(){logger['info']('Try\x20to\x20send\x20a\x20mail\x20to',_0x4e0d60[_0xaec9('0xb')]);var _0x12b0ef=!![];var _0x14be15=_0x4e0d60['MailAccount'][_0xaec9('0xc')]();var _0x2577bb={'account':_0x14be15,'message':{'from':util['format'](_0xaec9('0xd'),_0x4e0d60[_0xaec9('0xe')][_0xaec9('0xf')],_0x4e0d60[_0xaec9('0xe')][_0xaec9('0xb')]||_0x4e0d60[_0xaec9('0xe')][_0xaec9('0x10')][_0xaec9('0x11')]),'to':_0x4e0d60[_0xaec9('0xb')],'cc':_0x4e0d60['cc'],'bcc':_0x4e0d60[_0xaec9('0x12')],'subject':util[_0xaec9('0x13')]('Report\x20%s\x20last\x20%s\x20%s',_0x259baf[_0xaec9('0xf')],_0x4e0d60['subtractNumber'],_0x4e0d60['subtractUnit'])}};var _0x471288=path[_0xaec9('0x14')](__dirname,_0xaec9('0x15'));var _0xa29807=_0x259baf[_0xaec9('0x16')];var _0xea0447=util[_0xaec9('0x13')](_0xaec9('0x17'),path[_0xaec9('0x18')](_0x259baf['savename'],path[_0xaec9('0x19')](_0x259baf['savename'])),_0xaec9('0x1a'));var _0x16b7c2=path[_0xaec9('0x14')](_0x471288,_0xa29807);var _0x651d5c=path['join'](_0x471288,_0xea0447);if(fs['existsSync'](_0x16b7c2)){_0x259baf[_0xaec9('0x1b')]=_0xaec9('0x1c');_0x2577bb[_0xaec9('0x1d')]['attachments']=[{'filename':_0xa29807,'path':_0x16b7c2}];_0x2577bb['message'][_0xaec9('0x1e')]=util['format'](_0xaec9('0x1f'),JSON['stringify'](_0x259baf,null,0x2));}else if(fs['existsSync'](_0x651d5c)){_0x259baf[_0xaec9('0x1b')]=_0xaec9('0x1c');_0x2577bb[_0xaec9('0x1d')][_0xaec9('0x20')]=[{'filename':_0xea0447,'path':_0x651d5c}];}else{_0x2577bb[_0xaec9('0x1d')]['text']=_0xaec9('0x21');if(!_0x4e0d60[_0xaec9('0x22')]){_0x12b0ef=![];logger[_0xaec9('0x23')](_0xaec9('0x24'));}}if(_0x12b0ef){return client[_0xaec9('0x25')](_0xaec9('0x26'),_0x2577bb)['then'](function(_0x41a353){if(_0x41a353['error']){return logger[_0xaec9('0x27')](_0xaec9('0x28'),JSON[_0xaec9('0x29')](_0x41a353));}return logger[_0xaec9('0x23')](_0xaec9('0x2a'));})[_0xaec9('0x2b')](function(_0x4566e9){return logger[_0xaec9('0x27')]('error\x20mail',JSON['stringify'](_0x4566e9));});}};}function handleError(){return function(_0x1fb927){return logger['error'](JSON['stringify'](_0x1fb927));};}function handleResult(_0x58a35d){return function(_0x26b940){logger[_0xaec9('0x23')]('data',JSON[_0xaec9('0x29')](_0x26b940));if(_0x58a35d[_0xaec9('0xe')]&&_0x58a35d[_0xaec9('0xe')]['Smtp']&&!_[_0xaec9('0x2c')](_0x58a35d[_0xaec9('0xb')])){setTimeout(handleSendEmail(_0x58a35d,_0x26b940),0x3c*0x3e8);}};}function handleJob(_0x59d82f){return function(){try{if(_['isNil'](_0x59d82f[_0xaec9('0x2d')])){return logger['info']('subtractNumber\x20null\x20or\x20undefined');}if(_[_0xaec9('0x2c')](_0x59d82f[_0xaec9('0x2e')])){return logger[_0xaec9('0x23')]('subtractUnit\x20null\x20or\x20undefined');}var _0x49c1d4={'startDate':moment()[_0xaec9('0x2f')](_0x59d82f[_0xaec9('0x2d')],_0x59d82f[_0xaec9('0x2e')])[_0xaec9('0x13')](_0xaec9('0x30')),'endDate':moment()[_0xaec9('0x13')](_0xaec9('0x30')),'type':'scheduled','output':_0x59d82f[_0xaec9('0x31')],'name':_0x59d82f[_0xaec9('0xf')]};if(!_[_0xaec9('0x2c')](_0x59d82f[_0xaec9('0x32')])){logger['info']('exec\x20defaul\x20report\x20id:%s',_0x59d82f['DefaultReportId']);return analyticDefaultReportController[_0xaec9('0x33')]({'id':_0x59d82f[_0xaec9('0x32')]},_0x49c1d4)[_0xaec9('0x34')](handleResult(_0x59d82f))[_0xaec9('0x2b')](handleError());}if(!_[_0xaec9('0x2c')](_0x59d82f['CustomReportId'])){logger[_0xaec9('0x23')](_0xaec9('0x35'),_0x59d82f['CustomReportId']);return analyticCustomReportController[_0xaec9('0x33')]({'id':_0x59d82f[_0xaec9('0x36')]},_0x49c1d4)[_0xaec9('0x34')](handleResult(_0x59d82f))[_0xaec9('0x2b')](handleError());}}catch(_0x1bc113){logger[_0xaec9('0x27')](JSON[_0xaec9('0x29')](_0x1bc113));}return logger[_0xaec9('0x23')](_0xaec9('0x37'));};}function getJobs(_0x54064d){var _0x245bdb={};if(_0x54064d){_0x245bdb['id']=_0x54064d;}return db[_0xaec9('0x38')][_0xaec9('0x39')]({'where':_0x245bdb,'include':[{'model':db[_0xaec9('0xe')],'attributes':['id','name',_0xaec9('0xb')],'include':[{'model':db[_0xaec9('0x3a')],'as':_0xaec9('0x10'),'include':[{'model':db[_0xaec9('0x3b')],'as':_0xaec9('0x3b')}]}]}]})[_0xaec9('0x34')](function(_0x449a54){var _0x28a0cc=_[_0xaec9('0x3c')](manager[_0xaec9('0x3d')]);var _0x27cbab=_[_0xaec9('0x3e')](_0x449a54,function(_0x19bd8c){return _0x19bd8c['id'][_0xaec9('0x3f')]();});var _0x5893cc=_[_0xaec9('0x40')](_0x449a54,function(_0x138a8d){return _0x138a8d['id'][_0xaec9('0x3f')]();});var _0x537386=_0x54064d?_0x27cbab:_['difference'](_0x27cbab,_0x28a0cc);var _0x36e0c5=_[_0xaec9('0x41')](_0x27cbab,_0x28a0cc);var _0x50129b=_[_0xaec9('0x42')](_0x28a0cc,_0x27cbab);var _0x40ec90;var _0x427ce5;for(_0x40ec90=0x0;_0x40ec90<_0x50129b[_0xaec9('0x43')]&&!_0x54064d;_0x40ec90+=0x1){_0x427ce5=_0x50129b[_0x40ec90]['toString']();if(manager[_0xaec9('0x44')](_0x427ce5)){manager[_0xaec9('0x45')](_0x427ce5);manager[_0xaec9('0x46')](_0x427ce5);logger['info'](_0xaec9('0x47'),_0x427ce5);}}logger[_0xaec9('0x23')](_0xaec9('0x48'),JSON[_0xaec9('0x29')](_0x537386));for(_0x40ec90=0x0;_0x40ec90<_0x537386[_0xaec9('0x43')];_0x40ec90+=0x1){_0x427ce5=_0x537386[_0x40ec90][_0xaec9('0x3f')]();logger['info'](_0xaec9('0x49'),_0x427ce5);if(_0x54064d){logger['info'](_0xaec9('0x4a'),_0x54064d);logger[_0xaec9('0x23')](JSON[_0xaec9('0x29')](_0x5893cc[_0x427ce5]));BPromise['resolve']()[_0xaec9('0x34')](handleJob(_0x5893cc[_0x427ce5]));logger[_0xaec9('0x23')](_0xaec9('0x4b'),_0x5893cc[_0x427ce5]['name'],_0x5893cc[_0x427ce5][_0xaec9('0x4c')]);}else if(_0x5893cc[_0x427ce5]['cron']&&_0x5893cc[_0x427ce5][_0xaec9('0x4d')]&&moment()[_0xaec9('0x4e')](_0x5893cc[_0x427ce5]['startAt'],_0x5893cc[_0x427ce5]['endAt'])){manager[_0xaec9('0x4f')](_0x427ce5,_0x5893cc[_0x427ce5]['cron'],handleJob(_0x5893cc[_0x427ce5]));manager[_0xaec9('0x50')](_0x427ce5);logger[_0xaec9('0x23')](_0xaec9('0x51'),_0x5893cc[_0x427ce5][_0xaec9('0xf')],_0x5893cc[_0x427ce5][_0xaec9('0x4c')]);}else if(manager[_0xaec9('0x44')](_0x427ce5)){manager[_0xaec9('0x45')](_0x427ce5);manager['deleteJob'](_0x427ce5);logger[_0xaec9('0x23')](_0xaec9('0x52'),_0x5893cc[_0x427ce5][_0xaec9('0xf')],_0x5893cc[_0x427ce5]['cron']);}}for(_0x40ec90=0x0,_0x427ce5;_0x40ec90<_0x36e0c5[_0xaec9('0x43')]&&!_0x54064d;_0x40ec90+=0x1){_0x427ce5=_0x36e0c5[_0x40ec90][_0xaec9('0x3f')]();if(manager[_0xaec9('0x44')](_0x427ce5)){if(_0x5893cc[_0x427ce5][_0xaec9('0x4c')]&&_0x5893cc[_0x427ce5][_0xaec9('0x4d')]&&moment()[_0xaec9('0x4e')](_0x5893cc[_0x427ce5][_0xaec9('0x53')],_0x5893cc[_0x427ce5][_0xaec9('0x54')])){manager[_0xaec9('0x55')](_0x427ce5,_0x5893cc[_0x427ce5][_0xaec9('0x4c')],handleJob(_0x5893cc[_0x427ce5]));logger[_0xaec9('0x23')](_0xaec9('0x56'),_0x5893cc[_0x427ce5][_0xaec9('0xf')],_0x5893cc[_0x427ce5][_0xaec9('0x4c')]);}else{manager[_0xaec9('0x45')](_0x427ce5);manager['deleteJob'](_0x427ce5);logger[_0xaec9('0x23')](_0xaec9('0x52'),_0x5893cc[_0x427ce5][_0xaec9('0xf')],_0x5893cc[_0x427ce5]['cron']);}}}})['catch'](function(_0x3ad052){logger[_0xaec9('0x27')](JSON['stringify'](_0x3ad052));});}exports['run']=function(_0x222494){return getJobs(_0x222494);};exports[_0xaec9('0x50')]=function(){setInterval(function(){return getJobs();},0x3c*0x3e8);return getJobs();}; \ No newline at end of file +var _0x6bc9=['exists','stop','deleteJob','delete\x20cron','toRun','index','my\x20id','resolve','run\x20job','cron','isBetween','startAt','endAt','add','start','add\x20cron','stop\x20cron','active','update','update\x20cron','run','util','path','lodash','moment','jayson/promise','bluebird','schedule','../../api/analyticCustomReport/analyticCustomReport.controller','../../api/analyticDefaultReport/analyticDefaultReport.controller','client','http','Try\x20to\x20send\x20a\x20mail\x20to','email','MailAccount','getSmtpOptions','format','\x22%s\x22\x20<%s>','name','Smtp','user','bcc','Report\x20%s\x20last\x20%s\x20%s','subtractNumber','subtractUnit','join','../../files/reports','savename','%s.%s','basename','extname','zip','existsSync','status','message','Info\x20report:\x0a%s\x0aPlease\x20see\x20the\x20attachments\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20it.\x0a\x0a','stringify','attachments','text','Report\x20empty\x0aThis\x20is\x20an\x20automatically\x20generated\x20email\x20–\x20please\x20do\x20not\x20reply\x20to\x20this\x20email.\x0a\x0a','sendIfEmpty','info','empty\x20file,\x20email\x20not\x20sent','SendMail','error','error\x20mail','email\x20sent','isNil','subtractUnit\x20null\x20or\x20undefined','subtract','YYYY-MM-DD\x20HH:mm:ss','scheduled','output','exec\x20defaul\x20report\x20id:%s','DefaultReportId','then','catch','CustomReportId','exec\x20custom\x20report\x20id:%s','runReport','Schedule','findAll','CloudProvider','keys','jobs','toString','keyBy','intersection','difference','length'];(function(_0x2261ce,_0x9ed8b6){var _0x524640=function(_0x3cbb90){while(--_0x3cbb90){_0x2261ce['push'](_0x2261ce['shift']());}};_0x524640(++_0x9ed8b6);}(_0x6bc9,0x6f));var _0x96bc=function(_0x1b1948,_0x49f451){_0x1b1948=_0x1b1948-0x0;var _0x3cbd38=_0x6bc9[_0x1b1948];return _0x3cbd38;};'use strict';var fs=require('fs');var util=require(_0x96bc('0x0'));var path=require(_0x96bc('0x1'));var _=require(_0x96bc('0x2'));var moment=require(_0x96bc('0x3'));var CronJobManager=require('cron-job-manager');var jayson=require(_0x96bc('0x4'));var BPromise=require(_0x96bc('0x5'));var logger=require('../logger')(_0x96bc('0x6'));var db=require('../../mysqldb')['db'];var analyticCustomReportController=require(_0x96bc('0x7'));var analyticDefaultReportController=require(_0x96bc('0x8'));var client=jayson[_0x96bc('0x9')][_0x96bc('0xa')]({'port':0x232b});var manager=new CronJobManager();function handleSendEmail(_0x816680,_0x1ccad5){return function(){logger['info'](_0x96bc('0xb'),_0x816680[_0x96bc('0xc')]);var _0x535203=!![];var _0x19ff9c=_0x816680[_0x96bc('0xd')][_0x96bc('0xe')]();var _0x484d92={'account':_0x19ff9c,'message':{'from':util[_0x96bc('0xf')](_0x96bc('0x10'),_0x816680['MailAccount'][_0x96bc('0x11')],_0x816680[_0x96bc('0xd')][_0x96bc('0xc')]||_0x816680[_0x96bc('0xd')][_0x96bc('0x12')][_0x96bc('0x13')]),'to':_0x816680[_0x96bc('0xc')],'cc':_0x816680['cc'],'bcc':_0x816680[_0x96bc('0x14')],'subject':util[_0x96bc('0xf')](_0x96bc('0x15'),_0x1ccad5[_0x96bc('0x11')],_0x816680[_0x96bc('0x16')],_0x816680[_0x96bc('0x17')])}};var _0x4b6d70=path[_0x96bc('0x18')](__dirname,_0x96bc('0x19'));var _0x4500c4=_0x1ccad5[_0x96bc('0x1a')];var _0x5e97e8=util['format'](_0x96bc('0x1b'),path[_0x96bc('0x1c')](_0x1ccad5[_0x96bc('0x1a')],path[_0x96bc('0x1d')](_0x1ccad5['savename'])),_0x96bc('0x1e'));var _0xd92a4f=path[_0x96bc('0x18')](_0x4b6d70,_0x4500c4);var _0x1a341a=path[_0x96bc('0x18')](_0x4b6d70,_0x5e97e8);if(fs[_0x96bc('0x1f')](_0xd92a4f)){_0x1ccad5[_0x96bc('0x20')]='Sent';_0x484d92[_0x96bc('0x21')]['attachments']=[{'filename':_0x4500c4,'path':_0xd92a4f}];_0x484d92[_0x96bc('0x21')]['text']=util[_0x96bc('0xf')](_0x96bc('0x22'),JSON[_0x96bc('0x23')](_0x1ccad5,null,0x2));}else if(fs['existsSync'](_0x1a341a)){_0x1ccad5['status']='Sent';_0x484d92[_0x96bc('0x21')][_0x96bc('0x24')]=[{'filename':_0x5e97e8,'path':_0x1a341a}];}else{_0x484d92[_0x96bc('0x21')][_0x96bc('0x25')]=_0x96bc('0x26');if(!_0x816680[_0x96bc('0x27')]){_0x535203=![];logger[_0x96bc('0x28')](_0x96bc('0x29'));}}if(_0x535203){return client['request'](_0x96bc('0x2a'),_0x484d92)['then'](function(_0x528d69){if(_0x528d69[_0x96bc('0x2b')]){return logger[_0x96bc('0x2b')](_0x96bc('0x2c'),JSON['stringify'](_0x528d69));}return logger[_0x96bc('0x28')](_0x96bc('0x2d'));})['catch'](function(_0x2e6ddc){return logger['error']('error\x20mail',JSON[_0x96bc('0x23')](_0x2e6ddc));});}};}function handleError(){return function(_0x2eb19d){return logger['error'](JSON[_0x96bc('0x23')](_0x2eb19d));};}function handleResult(_0x41ca74){return function(_0x183996){logger['info']('data',JSON[_0x96bc('0x23')](_0x183996));if(_0x41ca74['MailAccount']&&_0x41ca74[_0x96bc('0xd')]['Smtp']&&!_[_0x96bc('0x2e')](_0x41ca74['email'])){setTimeout(handleSendEmail(_0x41ca74,_0x183996),0x3c*0x3e8);}};}function handleJob(_0xbbaa3c){return function(){try{if(_[_0x96bc('0x2e')](_0xbbaa3c[_0x96bc('0x16')])){return logger[_0x96bc('0x28')]('subtractNumber\x20null\x20or\x20undefined');}if(_[_0x96bc('0x2e')](_0xbbaa3c[_0x96bc('0x17')])){return logger['info'](_0x96bc('0x2f'));}var _0x1c9f87={'startDate':moment()[_0x96bc('0x30')](_0xbbaa3c[_0x96bc('0x16')],_0xbbaa3c[_0x96bc('0x17')])[_0x96bc('0xf')](_0x96bc('0x31')),'endDate':moment()[_0x96bc('0xf')](_0x96bc('0x31')),'type':_0x96bc('0x32'),'output':_0xbbaa3c[_0x96bc('0x33')],'name':_0xbbaa3c[_0x96bc('0x11')]};if(!_[_0x96bc('0x2e')](_0xbbaa3c['DefaultReportId'])){logger['info'](_0x96bc('0x34'),_0xbbaa3c[_0x96bc('0x35')]);return analyticDefaultReportController['runReport']({'id':_0xbbaa3c[_0x96bc('0x35')]},_0x1c9f87)[_0x96bc('0x36')](handleResult(_0xbbaa3c))[_0x96bc('0x37')](handleError());}if(!_[_0x96bc('0x2e')](_0xbbaa3c[_0x96bc('0x38')])){logger['info'](_0x96bc('0x39'),_0xbbaa3c[_0x96bc('0x38')]);return analyticCustomReportController[_0x96bc('0x3a')]({'id':_0xbbaa3c[_0x96bc('0x38')]},_0x1c9f87)['then'](handleResult(_0xbbaa3c))[_0x96bc('0x37')](handleError());}}catch(_0x2d2a0f){logger[_0x96bc('0x2b')](JSON[_0x96bc('0x23')](_0x2d2a0f));}return logger[_0x96bc('0x28')]('no\x20report\x20id');};}function getJobs(_0x3f8540){var _0x14883d={};if(_0x3f8540){_0x14883d['id']=_0x3f8540;}return db[_0x96bc('0x3b')][_0x96bc('0x3c')]({'where':_0x14883d,'include':[{'model':db[_0x96bc('0xd')],'attributes':['id',_0x96bc('0x11'),'email'],'include':[{'model':db['MailServerOut'],'as':'Smtp','include':[{'model':db[_0x96bc('0x3d')],'as':'CloudProvider'}]}]}]})[_0x96bc('0x36')](function(_0x46b30b){var _0x52a3cf=_[_0x96bc('0x3e')](manager[_0x96bc('0x3f')]);var _0x27e0ba=_['map'](_0x46b30b,function(_0x3fdba2){return _0x3fdba2['id'][_0x96bc('0x40')]();});var _0x21d2f3=_[_0x96bc('0x41')](_0x46b30b,function(_0x4e6bd2){return _0x4e6bd2['id'][_0x96bc('0x40')]();});var _0xec2e75=_0x3f8540?_0x27e0ba:_['difference'](_0x27e0ba,_0x52a3cf);var _0x22a03b=_[_0x96bc('0x42')](_0x27e0ba,_0x52a3cf);var _0x5244d4=_[_0x96bc('0x43')](_0x52a3cf,_0x27e0ba);var _0x53081d;var _0x5acfeb;for(_0x53081d=0x0;_0x53081d<_0x5244d4[_0x96bc('0x44')]&&!_0x3f8540;_0x53081d+=0x1){_0x5acfeb=_0x5244d4[_0x53081d]['toString']();if(manager[_0x96bc('0x45')](_0x5acfeb)){manager[_0x96bc('0x46')](_0x5acfeb);manager[_0x96bc('0x47')](_0x5acfeb);logger[_0x96bc('0x28')](_0x96bc('0x48'),_0x5acfeb);}}logger[_0x96bc('0x28')](_0x96bc('0x49'),JSON[_0x96bc('0x23')](_0xec2e75));for(_0x53081d=0x0;_0x53081d<_0xec2e75[_0x96bc('0x44')];_0x53081d+=0x1){_0x5acfeb=_0xec2e75[_0x53081d][_0x96bc('0x40')]();logger['info'](_0x96bc('0x4a'),_0x5acfeb);if(_0x3f8540){logger[_0x96bc('0x28')](_0x96bc('0x4b'),_0x3f8540);logger[_0x96bc('0x28')](JSON[_0x96bc('0x23')](_0x21d2f3[_0x5acfeb]));BPromise[_0x96bc('0x4c')]()[_0x96bc('0x36')](handleJob(_0x21d2f3[_0x5acfeb]));logger[_0x96bc('0x28')](_0x96bc('0x4d'),_0x21d2f3[_0x5acfeb]['name'],_0x21d2f3[_0x5acfeb][_0x96bc('0x4e')]);}else if(_0x21d2f3[_0x5acfeb][_0x96bc('0x4e')]&&_0x21d2f3[_0x5acfeb]['active']&&moment()[_0x96bc('0x4f')](_0x21d2f3[_0x5acfeb][_0x96bc('0x50')],_0x21d2f3[_0x5acfeb][_0x96bc('0x51')])){manager[_0x96bc('0x52')](_0x5acfeb,_0x21d2f3[_0x5acfeb][_0x96bc('0x4e')],handleJob(_0x21d2f3[_0x5acfeb]));manager[_0x96bc('0x53')](_0x5acfeb);logger['info'](_0x96bc('0x54'),_0x21d2f3[_0x5acfeb][_0x96bc('0x11')],_0x21d2f3[_0x5acfeb][_0x96bc('0x4e')]);}else if(manager['exists'](_0x5acfeb)){manager['stop'](_0x5acfeb);manager['deleteJob'](_0x5acfeb);logger[_0x96bc('0x28')](_0x96bc('0x55'),_0x21d2f3[_0x5acfeb][_0x96bc('0x11')],_0x21d2f3[_0x5acfeb][_0x96bc('0x4e')]);}}for(_0x53081d=0x0,_0x5acfeb;_0x53081d<_0x22a03b[_0x96bc('0x44')]&&!_0x3f8540;_0x53081d+=0x1){_0x5acfeb=_0x22a03b[_0x53081d]['toString']();if(manager[_0x96bc('0x45')](_0x5acfeb)){if(_0x21d2f3[_0x5acfeb][_0x96bc('0x4e')]&&_0x21d2f3[_0x5acfeb][_0x96bc('0x56')]&&moment()[_0x96bc('0x4f')](_0x21d2f3[_0x5acfeb][_0x96bc('0x50')],_0x21d2f3[_0x5acfeb][_0x96bc('0x51')])){manager[_0x96bc('0x57')](_0x5acfeb,_0x21d2f3[_0x5acfeb][_0x96bc('0x4e')],handleJob(_0x21d2f3[_0x5acfeb]));logger['info'](_0x96bc('0x58'),_0x21d2f3[_0x5acfeb][_0x96bc('0x11')],_0x21d2f3[_0x5acfeb][_0x96bc('0x4e')]);}else{manager[_0x96bc('0x46')](_0x5acfeb);manager[_0x96bc('0x47')](_0x5acfeb);logger[_0x96bc('0x28')](_0x96bc('0x55'),_0x21d2f3[_0x5acfeb]['name'],_0x21d2f3[_0x5acfeb][_0x96bc('0x4e')]);}}}})[_0x96bc('0x37')](function(_0x25414a){logger[_0x96bc('0x2b')](JSON['stringify'](_0x25414a));});}exports[_0x96bc('0x59')]=function(_0xd8186a){return getJobs(_0xd8186a);};exports[_0x96bc('0x53')]=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 70e1fd4..54c40e2 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 _0xfbb4=['[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','Sentiment\x20Analysis\x20not\x20configured','name','error','[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis','inspect','VoiceRecording','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','transcribeRegion','Transcribe\x20not\x20configured','forEach','push','all','SequelizeValidationError','start','lodash','aws-sdk','request-promise','util','bluebird','../../mysqldb','../../config/logger','transcribe','Comprehend','detectSentiment','info','format','[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)','data1','transcribeName','then','TranscriptionJob','TranscriptionJobStatus','fileText','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','transcript','update','[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','sentiment','sentimentAccountId','sentimentRegion','language','bucket','Transcript\x20not\x20available','CloudProvider','Cloud\x20Provider\x20not\x20available','Sequelize','Cloud\x20Provider\x20not\x20configured','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','data2','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason'];(function(_0x4db2d9,_0x3e2c08){var _0x285c8d=function(_0x3b0e60){while(--_0x3b0e60){_0x4db2d9['push'](_0x4db2d9['shift']());}};_0x285c8d(++_0x3e2c08);}(_0xfbb4,0x186));var _0x4fbb=function(_0x520bb3,_0x982fce){_0x520bb3=_0x520bb3-0x0;var _0x5d646c=_0xfbb4[_0x520bb3];return _0x5d646c;};var _=require(_0x4fbb('0x0'));var AWS=require(_0x4fbb('0x1'));var rp=require(_0x4fbb('0x2'));var util=require(_0x4fbb('0x3'));var BPromise=require(_0x4fbb('0x4'));var db=require(_0x4fbb('0x5'))['db'];var logger=require(_0x4fbb('0x6'))(_0x4fbb('0x7'));function getTranscriptionJob(_0x5c67e4,_0x514d23,_0x16c6f2,_0xba265e){return new Promise(function(_0x2b5756,_0x306f07){var _0x5f0b6b=new AWS['TranscribeService']({'accessKeyId':_0x514d23,'secretAccessKey':_0x5c67e4,'region':_0x16c6f2});_0x5f0b6b['getTranscriptionJob']({'TranscriptionJobName':_0xba265e},function(_0x4e57d7,_0xa17d45){if(_0x4e57d7){return _0x306f07(_0x4e57d7);}else{return _0x2b5756(_0xa17d45);}});});}function sentiment(_0x45ac3e,_0x5574b4,_0xc9ddea,_0xc3ed78,_0x4cac34){return new Promise(function(_0x360c27,_0x208526){var _0x1ecd42=new AWS[(_0x4fbb('0x8'))]({'accessKeyId':_0x5574b4,'secretAccessKey':_0x45ac3e,'region':_0xc9ddea});_0x1ecd42[_0x4fbb('0x9')]({'Text':_0xc3ed78,'LanguageCode':_0x4cac34['substring'](0x0,0x2)},function(_0xa148,_0x3e349){if(_0xa148){return _0x208526(_0xa148);}else{return _0x360c27(_0x3e349);}});});}function checkTranscribeJob(_0x3b94dc,_0x2aec34,_0x340523){var _0x486020;return new BPromise(function(_0x5f2a54,_0x19dd5e){logger[_0x4fbb('0xa')](util[_0x4fbb('0xb')](_0x4fbb('0xc'),_0x3b94dc['id'],_0x3b94dc['transcribeName']));return getTranscriptionJob(_0x340523[_0x4fbb('0xd')],_0x340523['data2'],_0x2aec34['transcribeRegion'],_0x3b94dc[_0x4fbb('0xe')])[_0x4fbb('0xf')](function(_0x4c47ff){logger[_0x4fbb('0xa')](util[_0x4fbb('0xb')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x3b94dc['id'],_0x3b94dc['transcribeName'],_0x4c47ff[_0x4fbb('0x10')][_0x4fbb('0x11')]));if(!_0x3b94dc[_0x4fbb('0x12')]){switch(_0x4c47ff[_0x4fbb('0x10')][_0x4fbb('0x11')]){case _0x4fbb('0x13'):var _0x91e29f={'transcribeStatus':_0x4c47ff[_0x4fbb('0x10')][_0x4fbb('0x11')],'fileUri':_0x4c47ff[_0x4fbb('0x10')][_0x4fbb('0x14')][_0x4fbb('0x15')]};logger[_0x4fbb('0xa')](util[_0x4fbb('0xb')](_0x4fbb('0x16'),_0x3b94dc['id']));return rp({'uri':_0x4c47ff[_0x4fbb('0x10')][_0x4fbb('0x14')][_0x4fbb('0x15')],'json':!![]})[_0x4fbb('0xf')](function(_0x2db786){logger[_0x4fbb('0xa')](util[_0x4fbb('0xb')](_0x4fbb('0x17'),_0x3b94dc['id']));if(_0x2db786&&_0x2db786[_0x4fbb('0x18')]&&_0x2db786['results']['transcripts']&&_0x2db786[_0x4fbb('0x18')][_0x4fbb('0x19')][_0x4fbb('0x1a')]){_0x91e29f[_0x4fbb('0x12')]='';for(var _0x505c9d=0x0;_0x505c9d<_0x2db786[_0x4fbb('0x18')][_0x4fbb('0x19')]['length'];_0x505c9d++){_0x91e29f['fileText']+=_0x2db786['results'][_0x4fbb('0x19')][_0x505c9d][_0x4fbb('0x1b')]+'';}}return _0x3b94dc[_0x4fbb('0x1c')](_0x91e29f);})[_0x4fbb('0xf')](function(){logger['info'](util[_0x4fbb('0xb')](_0x4fbb('0x1d'),_0x3b94dc['id']));if(!_0x3b94dc[_0x4fbb('0x1e')]){throw new db['Sequelize'][(_0x4fbb('0x1f'))](_0x4fbb('0x20'));}if(!_0x2aec34[_0x4fbb('0x21')]||!_0x2aec34[_0x4fbb('0x22')]||!_0x2aec34[_0x4fbb('0x23')]||!_0x2aec34[_0x4fbb('0x24')]||!_0x2aec34[_0x4fbb('0x25')]){throw new db['Sequelize'][(_0x4fbb('0x1f'))]('Sentiment\x20Analysis\x20not\x20configured');}if(!_0x91e29f[_0x4fbb('0x12')]){throw new Error(_0x4fbb('0x26'));}if(_0x2aec34[_0x4fbb('0x22')]===_0x340523['id']){return _0x340523;}else{return db[_0x4fbb('0x27')]['findOne']({'where':{'id':_settings[_0x4fbb('0x22')]}});}})[_0x4fbb('0xf')](function(_0x4f112c){if(!_0x4f112c){throw new db['Sequelize'][(_0x4fbb('0x1f'))](_0x4fbb('0x28'));}if(!_0x4f112c[_0x4fbb('0xd')]||!_0x4f112c['data2']){throw new db[(_0x4fbb('0x29'))]['ValidationError'](_0x4fbb('0x2a'));}_0x486020=_0x4f112c;logger[_0x4fbb('0xa')](util[_0x4fbb('0xb')](_0x4fbb('0x2b'),_0x3b94dc['id']));return sentiment(_0x486020['data1'],_0x486020[_0x4fbb('0x2c')],_0x2aec34['sentimentRegion'],_0x91e29f['fileText'],_0x2aec34[_0x4fbb('0x24')]);})['then'](function(_0x3c2be1){logger[_0x4fbb('0xa')](util['format'](_0x4fbb('0x2d'),_0x3b94dc['id']));return _0x3b94dc[_0x4fbb('0x1c')]({'sentiment':_0x3c2be1[_0x4fbb('0x2e')],'sPositive':_0x3c2be1[_0x4fbb('0x2f')][_0x4fbb('0x30')],'sNegative':_0x3c2be1[_0x4fbb('0x2f')][_0x4fbb('0x31')],'sMixed':_0x3c2be1[_0x4fbb('0x2f')][_0x4fbb('0x32')],'sNeutral':_0x3c2be1[_0x4fbb('0x2f')][_0x4fbb('0x33')]});})[_0x4fbb('0xf')](function(){logger['info'](util[_0x4fbb('0xb')]('[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated',_0x3b94dc['id']));_0x5f2a54();});case _0x4fbb('0x34'):return _0x3b94dc[_0x4fbb('0x1c')]({'transcribeStatus':'FAILED','failureReason':_0x4c47ff[_0x4fbb('0x10')][_0x4fbb('0x35')]})[_0x4fbb('0xf')](function(){logger['info'](util['format'](_0x4fbb('0x1d'),_0x3b94dc['id']));_0x5f2a54();});default:logger[_0x4fbb('0xa')](util[_0x4fbb('0xb')](_0x4fbb('0x36'),_0x3b94dc['id']));break;}}else{return BPromise[_0x4fbb('0x37')]()[_0x4fbb('0xf')](function(){if(!_0x3b94dc['tempSentiment']){throw new db[(_0x4fbb('0x29'))]['ValidationError'](_0x4fbb('0x20'));}if(!_0x2aec34['sentiment']||!_0x2aec34[_0x4fbb('0x22')]||!_0x2aec34[_0x4fbb('0x23')]||!_0x2aec34['language']||!_0x2aec34['bucket']){throw new db['Sequelize'][(_0x4fbb('0x1f'))](_0x4fbb('0x38'));}if(!_0x3b94dc[_0x4fbb('0x12')]){throw new Error(_0x4fbb('0x26'));}if(_0x2aec34[_0x4fbb('0x22')]===_0x340523['id']){return _0x340523;}else{return db[_0x4fbb('0x27')]['findOne']({'where':{'id':_settings[_0x4fbb('0x22')]}});}})[_0x4fbb('0xf')](function(_0x19ea9d){if(!_0x19ea9d){throw new db[(_0x4fbb('0x29'))][(_0x4fbb('0x1f'))](_0x4fbb('0x28'));}if(!_0x19ea9d[_0x4fbb('0xd')]||!_0x19ea9d[_0x4fbb('0x2c')]){throw new db[(_0x4fbb('0x29'))][(_0x4fbb('0x1f'))](_0x4fbb('0x2a'));}_0x486020=_0x19ea9d;logger[_0x4fbb('0xa')](util[_0x4fbb('0xb')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3b94dc['id']));return sentiment(_0x486020[_0x4fbb('0xd')],_0x486020[_0x4fbb('0x2c')],_0x2aec34[_0x4fbb('0x23')],_0x3b94dc[_0x4fbb('0x12')],_0x2aec34[_0x4fbb('0x24')]);})[_0x4fbb('0xf')](function(_0x5bbd77){logger[_0x4fbb('0xa')](util[_0x4fbb('0xb')]('[RECORDING:%d]\x20Sentiment\x20Analysis\x20available',_0x3b94dc['id']));return _0x3b94dc[_0x4fbb('0x1c')]({'sentiment':_0x5bbd77[_0x4fbb('0x2e')],'sPositive':_0x5bbd77['SentimentScore'][_0x4fbb('0x30')],'sNegative':_0x5bbd77[_0x4fbb('0x2f')]['Negative'],'sMixed':_0x5bbd77[_0x4fbb('0x2f')][_0x4fbb('0x32')],'sNeutral':_0x5bbd77[_0x4fbb('0x2f')][_0x4fbb('0x33')],'transcribeStatus':_0x4fbb('0x13')});})[_0x4fbb('0xf')](function(){logger['info'](util['format'](_0x4fbb('0x1d'),_0x3b94dc['id']));_0x5f2a54();});}})['catch'](function(_0x574d10){if(_0x574d10){if(!_0x574d10[_0x4fbb('0x39')]||_0x574d10[_0x4fbb('0x39')]!=='SequelizeValidationError'){logger[_0x4fbb('0x3a')](util[_0x4fbb('0xb')](_0x4fbb('0x3b'),_0x3b94dc['id']),util[_0x4fbb('0x3c')](_0x574d10,{'showHidden':![],'depth':null}));}}_0x5f2a54();});});}function checkTranscribe(){var _0x38c149;var _0x143883;var _0x1b736d;return db[_0x4fbb('0x3d')]['findAll']({'where':{'transcribeStatus':_0x4fbb('0x3e')}})[_0x4fbb('0xf')](function(_0x12d624){if(!_0x12d624||!_0x12d624[_0x4fbb('0x1a')]){throw new db['Sequelize'][(_0x4fbb('0x1f'))](_0x4fbb('0x3f'));}_0x38c149=_0x12d624;return db[_0x4fbb('0x40')]['findOne']({'where':{'id':0x1}});})[_0x4fbb('0xf')](function(_0x236bea){if(!_0x236bea){throw new db['Sequelize'][(_0x4fbb('0x1f'))](_0x4fbb('0x41'));}_0x143883=_0x236bea;if(!_0x143883[_0x4fbb('0x7')]||!_0x143883[_0x4fbb('0x42')]||!_0x143883[_0x4fbb('0x43')]||!_0x143883[_0x4fbb('0x24')]||!_0x143883['bucket']){throw new db[(_0x4fbb('0x29'))]['ValidationError'](_0x4fbb('0x44'));}return db[_0x4fbb('0x27')]['findOne']({'where':{'id':_0x143883[_0x4fbb('0x42')]}});})[_0x4fbb('0xf')](function(_0x2030b5){if(!_0x2030b5){throw new db['Sequelize'][(_0x4fbb('0x1f'))](_0x4fbb('0x28'));}if(!_0x2030b5['data1']||!_0x2030b5[_0x4fbb('0x2c')]){throw new db[(_0x4fbb('0x29'))]['ValidationError'](_0x4fbb('0x2a'));}_0x1b736d=_0x2030b5;var _0x588f86=[];_0x38c149[_0x4fbb('0x45')](function(_0x12e00f){_0x588f86[_0x4fbb('0x46')](checkTranscribeJob(_0x12e00f,_0x143883,_0x1b736d));});return BPromise[_0x4fbb('0x47')](_0x588f86);})['catch'](function(_0x5a655c){if(_0x5a655c){if(!_0x5a655c['name']||_0x5a655c['name']!==_0x4fbb('0x48')){logger['error'](util['inspect'](_0x5a655c,{'showHidden':![],'depth':null}));}}});}exports[_0x4fbb('0x49')]=function(){setInterval(function(){return checkTranscribe();},0x3c*0x3e8);return checkTranscribe();}; \ No newline at end of file +var _0x3d45=['[RECORDING:%d]\x20Voice\x20Recording\x20entry\x20updated','tempSentiment','ValidationError','Sentiment\x20Analysis\x20not\x20requested','language','bucket','Sequelize','Sentiment\x20Analysis\x20not\x20configured','Transcript\x20not\x20available','CloudProvider','findOne','sentimentAccountId','Cloud\x20Provider\x20not\x20configured','sentimentRegion','[RECORDING:%d]\x20Sentiment\x20Analysis\x20available','Sentiment','SentimentScore','Positive','Negative','Mixed','Neutral','FAILED','FailureReason','[RECORDING:%d]\x20Transcript\x20Job\x20status\x20not\x20managed','resolve','sentiment','Cloud\x20Provider\x20not\x20available','[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis','name','SequelizeValidationError','error','inspect','findAll','IN_PROGRESS','No\x20transcribe\x20job\x20to\x20check','Setting','Settings\x20not\x20available','transcribeAccountId','forEach','catch','lodash','aws-sdk','request-promise','util','bluebird','../../config/logger','transcribe','TranscribeService','getTranscriptionJob','Comprehend','detectSentiment','substring','format','transcribeName','data1','data2','then','info','TranscriptionJob','TranscriptionJobStatus','COMPLETED','Transcript','TranscriptFileUri','[RECORDING:%d]\x20Get\x20transcript','[RECORDING:%d]\x20Transcript\x20downloaded','results','transcripts','length','fileText','transcript','update'];(function(_0x4d1a40,_0x20d5c6){var _0x54512b=function(_0x5df1f8){while(--_0x5df1f8){_0x4d1a40['push'](_0x4d1a40['shift']());}};_0x54512b(++_0x20d5c6);}(_0x3d45,0x1d2));var _0x53d4=function(_0x29b609,_0x19d388){_0x29b609=_0x29b609-0x0;var _0x54c952=_0x3d45[_0x29b609];return _0x54c952;};var _=require(_0x53d4('0x0'));var AWS=require(_0x53d4('0x1'));var rp=require(_0x53d4('0x2'));var util=require(_0x53d4('0x3'));var BPromise=require(_0x53d4('0x4'));var db=require('../../mysqldb')['db'];var logger=require(_0x53d4('0x5'))(_0x53d4('0x6'));function getTranscriptionJob(_0x47c835,_0x3ba5fb,_0x4b12c0,_0x4ed167){return new Promise(function(_0x4cfea8,_0x54b0a4){var _0x235ee0=new AWS[(_0x53d4('0x7'))]({'accessKeyId':_0x3ba5fb,'secretAccessKey':_0x47c835,'region':_0x4b12c0});_0x235ee0[_0x53d4('0x8')]({'TranscriptionJobName':_0x4ed167},function(_0xdbf204,_0x39ff2a){if(_0xdbf204){return _0x54b0a4(_0xdbf204);}else{return _0x4cfea8(_0x39ff2a);}});});}function sentiment(_0x488c2e,_0x3b19f6,_0x20b209,_0x449c1c,_0x4e8993){return new Promise(function(_0x1abe33,_0x523abb){var _0x2c4975=new AWS[(_0x53d4('0x9'))]({'accessKeyId':_0x3b19f6,'secretAccessKey':_0x488c2e,'region':_0x20b209});_0x2c4975[_0x53d4('0xa')]({'Text':_0x449c1c,'LanguageCode':_0x4e8993[_0x53d4('0xb')](0x0,0x2)},function(_0x1d9496,_0x525931){if(_0x1d9496){return _0x523abb(_0x1d9496);}else{return _0x1abe33(_0x525931);}});});}function checkTranscribeJob(_0x3ad057,_0x11afa8,_0x445c6e){var _0x4cd884;return new BPromise(function(_0x410072,_0x7867fc){logger['info'](util[_0x53d4('0xc')]('[RECORDING:%d]\x20Get\x20status\x20for\x20transcript\x20job\x20(%s)',_0x3ad057['id'],_0x3ad057[_0x53d4('0xd')]));return getTranscriptionJob(_0x445c6e[_0x53d4('0xe')],_0x445c6e[_0x53d4('0xf')],_0x11afa8['transcribeRegion'],_0x3ad057[_0x53d4('0xd')])[_0x53d4('0x10')](function(_0x1b2e0b){logger[_0x53d4('0x11')](util[_0x53d4('0xc')]('[RECORDING:%d]\x20Status\x20of\x20transcript\x20job\x20(%s):\x20%s',_0x3ad057['id'],_0x3ad057[_0x53d4('0xd')],_0x1b2e0b[_0x53d4('0x12')]['TranscriptionJobStatus']));if(!_0x3ad057['fileText']){switch(_0x1b2e0b[_0x53d4('0x12')][_0x53d4('0x13')]){case _0x53d4('0x14'):var _0x56015f={'transcribeStatus':_0x1b2e0b[_0x53d4('0x12')][_0x53d4('0x13')],'fileUri':_0x1b2e0b[_0x53d4('0x12')][_0x53d4('0x15')][_0x53d4('0x16')]};logger[_0x53d4('0x11')](util[_0x53d4('0xc')](_0x53d4('0x17'),_0x3ad057['id']));return rp({'uri':_0x1b2e0b['TranscriptionJob']['Transcript']['TranscriptFileUri'],'json':!![]})[_0x53d4('0x10')](function(_0x557c63){logger[_0x53d4('0x11')](util[_0x53d4('0xc')](_0x53d4('0x18'),_0x3ad057['id']));if(_0x557c63&&_0x557c63[_0x53d4('0x19')]&&_0x557c63[_0x53d4('0x19')][_0x53d4('0x1a')]&&_0x557c63[_0x53d4('0x19')][_0x53d4('0x1a')][_0x53d4('0x1b')]){_0x56015f[_0x53d4('0x1c')]='';for(var _0x3b2b2e=0x0;_0x3b2b2e<_0x557c63[_0x53d4('0x19')][_0x53d4('0x1a')][_0x53d4('0x1b')];_0x3b2b2e++){_0x56015f[_0x53d4('0x1c')]+=_0x557c63[_0x53d4('0x19')][_0x53d4('0x1a')][_0x3b2b2e][_0x53d4('0x1d')]+'';}}return _0x3ad057[_0x53d4('0x1e')](_0x56015f);})['then'](function(){logger[_0x53d4('0x11')](util[_0x53d4('0xc')](_0x53d4('0x1f'),_0x3ad057['id']));if(!_0x3ad057[_0x53d4('0x20')]){throw new db['Sequelize'][(_0x53d4('0x21'))](_0x53d4('0x22'));}if(!_0x11afa8['sentiment']||!_0x11afa8['sentimentAccountId']||!_0x11afa8['sentimentRegion']||!_0x11afa8[_0x53d4('0x23')]||!_0x11afa8[_0x53d4('0x24')]){throw new db[(_0x53d4('0x25'))][(_0x53d4('0x21'))](_0x53d4('0x26'));}if(!_0x56015f['fileText']){throw new Error(_0x53d4('0x27'));}if(_0x11afa8['sentimentAccountId']===_0x445c6e['id']){return _0x445c6e;}else{return db[_0x53d4('0x28')][_0x53d4('0x29')]({'where':{'id':_settings[_0x53d4('0x2a')]}});}})[_0x53d4('0x10')](function(_0xb65448){if(!_0xb65448){throw new db[(_0x53d4('0x25'))]['ValidationError']('Cloud\x20Provider\x20not\x20available');}if(!_0xb65448[_0x53d4('0xe')]||!_0xb65448['data2']){throw new db['Sequelize'][(_0x53d4('0x21'))](_0x53d4('0x2b'));}_0x4cd884=_0xb65448;logger[_0x53d4('0x11')](util[_0x53d4('0xc')]('[RECORDING:%d]\x20Requesting\x20sentiment\x20analysis',_0x3ad057['id']));return sentiment(_0x4cd884['data1'],_0x4cd884[_0x53d4('0xf')],_0x11afa8[_0x53d4('0x2c')],_0x56015f[_0x53d4('0x1c')],_0x11afa8[_0x53d4('0x23')]);})[_0x53d4('0x10')](function(_0x3c3158){logger[_0x53d4('0x11')](util[_0x53d4('0xc')](_0x53d4('0x2d'),_0x3ad057['id']));return _0x3ad057[_0x53d4('0x1e')]({'sentiment':_0x3c3158[_0x53d4('0x2e')],'sPositive':_0x3c3158[_0x53d4('0x2f')][_0x53d4('0x30')],'sNegative':_0x3c3158['SentimentScore'][_0x53d4('0x31')],'sMixed':_0x3c3158[_0x53d4('0x2f')][_0x53d4('0x32')],'sNeutral':_0x3c3158[_0x53d4('0x2f')][_0x53d4('0x33')]});})[_0x53d4('0x10')](function(){logger[_0x53d4('0x11')](util[_0x53d4('0xc')](_0x53d4('0x1f'),_0x3ad057['id']));_0x410072();});case _0x53d4('0x34'):return _0x3ad057['update']({'transcribeStatus':'FAILED','failureReason':_0x1b2e0b[_0x53d4('0x12')][_0x53d4('0x35')]})['then'](function(){logger[_0x53d4('0x11')](util['format'](_0x53d4('0x1f'),_0x3ad057['id']));_0x410072();});default:logger['info'](util[_0x53d4('0xc')](_0x53d4('0x36'),_0x3ad057['id']));break;}}else{return BPromise[_0x53d4('0x37')]()[_0x53d4('0x10')](function(){if(!_0x3ad057[_0x53d4('0x20')]){throw new db['Sequelize'][(_0x53d4('0x21'))](_0x53d4('0x22'));}if(!_0x11afa8[_0x53d4('0x38')]||!_0x11afa8[_0x53d4('0x2a')]||!_0x11afa8[_0x53d4('0x2c')]||!_0x11afa8[_0x53d4('0x23')]||!_0x11afa8[_0x53d4('0x24')]){throw new db['Sequelize'][(_0x53d4('0x21'))](_0x53d4('0x26'));}if(!_0x3ad057[_0x53d4('0x1c')]){throw new Error('Transcript\x20not\x20available');}if(_0x11afa8['sentimentAccountId']===_0x445c6e['id']){return _0x445c6e;}else{return db[_0x53d4('0x28')][_0x53d4('0x29')]({'where':{'id':_settings[_0x53d4('0x2a')]}});}})[_0x53d4('0x10')](function(_0x10b867){if(!_0x10b867){throw new db['Sequelize']['ValidationError'](_0x53d4('0x39'));}if(!_0x10b867[_0x53d4('0xe')]||!_0x10b867[_0x53d4('0xf')]){throw new db[(_0x53d4('0x25'))][(_0x53d4('0x21'))]('Cloud\x20Provider\x20not\x20configured');}_0x4cd884=_0x10b867;logger[_0x53d4('0x11')](util[_0x53d4('0xc')](_0x53d4('0x3a'),_0x3ad057['id']));return sentiment(_0x4cd884[_0x53d4('0xe')],_0x4cd884['data2'],_0x11afa8[_0x53d4('0x2c')],_0x3ad057[_0x53d4('0x1c')],_0x11afa8[_0x53d4('0x23')]);})['then'](function(_0x2badc5){logger[_0x53d4('0x11')](util[_0x53d4('0xc')](_0x53d4('0x2d'),_0x3ad057['id']));return _0x3ad057[_0x53d4('0x1e')]({'sentiment':_0x2badc5[_0x53d4('0x2e')],'sPositive':_0x2badc5[_0x53d4('0x2f')][_0x53d4('0x30')],'sNegative':_0x2badc5[_0x53d4('0x2f')][_0x53d4('0x31')],'sMixed':_0x2badc5[_0x53d4('0x2f')][_0x53d4('0x32')],'sNeutral':_0x2badc5['SentimentScore'][_0x53d4('0x33')],'transcribeStatus':_0x53d4('0x14')});})['then'](function(){logger[_0x53d4('0x11')](util[_0x53d4('0xc')](_0x53d4('0x1f'),_0x3ad057['id']));_0x410072();});}})['catch'](function(_0x14fea9){if(_0x14fea9){if(!_0x14fea9[_0x53d4('0x3b')]||_0x14fea9[_0x53d4('0x3b')]!==_0x53d4('0x3c')){logger[_0x53d4('0x3d')](util[_0x53d4('0xc')]('[RECORDING:%d]\x20Error\x20running\x20Transcribe\x20&\x20Sentiment\x20Analysis',_0x3ad057['id']),util[_0x53d4('0x3e')](_0x14fea9,{'showHidden':![],'depth':null}));}}_0x410072();});});}function checkTranscribe(){var _0x3df96b;var _0x55eb08;var _0x42395f;return db['VoiceRecording'][_0x53d4('0x3f')]({'where':{'transcribeStatus':_0x53d4('0x40')}})['then'](function(_0x40d757){if(!_0x40d757||!_0x40d757[_0x53d4('0x1b')]){throw new db[(_0x53d4('0x25'))][(_0x53d4('0x21'))](_0x53d4('0x41'));}_0x3df96b=_0x40d757;return db[_0x53d4('0x42')][_0x53d4('0x29')]({'where':{'id':0x1}});})[_0x53d4('0x10')](function(_0x1457ce){if(!_0x1457ce){throw new db[(_0x53d4('0x25'))][(_0x53d4('0x21'))](_0x53d4('0x43'));}_0x55eb08=_0x1457ce;if(!_0x55eb08[_0x53d4('0x6')]||!_0x55eb08[_0x53d4('0x44')]||!_0x55eb08['transcribeRegion']||!_0x55eb08[_0x53d4('0x23')]||!_0x55eb08[_0x53d4('0x24')]){throw new db[(_0x53d4('0x25'))][(_0x53d4('0x21'))]('Transcribe\x20not\x20configured');}return db[_0x53d4('0x28')][_0x53d4('0x29')]({'where':{'id':_0x55eb08[_0x53d4('0x44')]}});})[_0x53d4('0x10')](function(_0x5f5533){if(!_0x5f5533){throw new db[(_0x53d4('0x25'))][(_0x53d4('0x21'))](_0x53d4('0x39'));}if(!_0x5f5533[_0x53d4('0xe')]||!_0x5f5533[_0x53d4('0xf')]){throw new db[(_0x53d4('0x25'))]['ValidationError'](_0x53d4('0x2b'));}_0x42395f=_0x5f5533;var _0x19b147=[];_0x3df96b[_0x53d4('0x45')](function(_0x4c7aca){_0x19b147['push'](checkTranscribeJob(_0x4c7aca,_0x55eb08,_0x42395f));});return BPromise['all'](_0x19b147);})[_0x53d4('0x46')](function(_0x1dccfa){if(_0x1dccfa){if(!_0x1dccfa[_0x53d4('0x3b')]||_0x1dccfa[_0x53d4('0x3b')]!==_0x53d4('0x3c')){logger[_0x53d4('0x3d')](util['inspect'](_0x1dccfa,{'showHidden':![],'depth':null}));}}});}exports['start']=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 6ff306c..d062c62 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 _0xd5f8=['lodash','moment','ioredis','util','../../config/environment','../../mysqldb','schedule','redis','localhost','socket.io-emitter','WhatsappInteraction','findAll','lastMsgAt','subtract','hours','then','length','join','update','system','timeout','format','info','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','emit','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start'];(function(_0x1904bd,_0x136af4){var _0x207b38=function(_0x21a4a0){while(--_0x21a4a0){_0x1904bd['push'](_0x1904bd['shift']());}};_0x207b38(++_0x136af4);}(_0xd5f8,0x1d1));var _0x8d5f=function(_0x557ad4,_0x5005ba){_0x557ad4=_0x557ad4-0x0;var _0x452a84=_0xd5f8[_0x557ad4];return _0x452a84;};'use strict';var _=require(_0x8d5f('0x0'));var moment=require(_0x8d5f('0x1'));var Redis=require(_0x8d5f('0x2'));var util=require(_0x8d5f('0x3'));var config=require(_0x8d5f('0x4'));var db=require(_0x8d5f('0x5'))['db'];var logger=require('../logger')(_0x8d5f('0x6'));config['redis']=_['defaults'](config[_0x8d5f('0x7')],{'host':_0x8d5f('0x8'),'port':0x18eb});var io=require(_0x8d5f('0x9'))(new Redis(config['redis']));function closeInteractions(){var _0x2b8ac6=[];return db[_0x8d5f('0xa')][_0x8d5f('0xb')]({'raw':!![],'attributes':['id',_0x8d5f('0xc')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0x8d5f('0xd')](0x18,_0x8d5f('0xe'))}}})[_0x8d5f('0xf')](function(_0x1b2999){if(_0x1b2999&&_0x1b2999[_0x8d5f('0x10')]){_0x2b8ac6=_['map'](_0x1b2999||[],'id');logger['info']('[WHATSAPP]\x20Interactions\x20to\x20close:',_0x2b8ac6[_0x8d5f('0x11')]());return db[_0x8d5f('0xa')][_0x8d5f('0x12')]({'closeReason':_0x8d5f('0x13'),'disposition':_0x8d5f('0x14'),'closed':!![],'closedAt':moment()[_0x8d5f('0x15')]('YYYY-MM-DD\x20HH:mm:ss')},{'where':{'id':_0x2b8ac6}});}})[_0x8d5f('0xf')](function(){if(_0x2b8ac6&&_0x2b8ac6[_0x8d5f('0x10')]){logger[_0x8d5f('0x16')](_0x8d5f('0x17'),_0x2b8ac6['join']());for(var _0x340a3b=0x0;_0x340a3b<_0x2b8ac6[_0x8d5f('0x10')];_0x340a3b++){io[_0x8d5f('0x18')](_0x8d5f('0x19'),{'id':_0x2b8ac6[_0x340a3b],'closed':!![]});}}})[_0x8d5f('0x1a')](function(_0x1c50e0){logger[_0x8d5f('0x1b')](_0x8d5f('0x1c'),_0x1c50e0?util[_0x8d5f('0x1d')](_0x1c50e0,{'showHidden':![],'depth':null}):'');});}exports[_0x8d5f('0x1e')]=function(){setInterval(function(){return closeInteractions();},0x3c*0x3e8);return closeInteractions();}; \ No newline at end of file +var _0x9f5a=['lastMsgAt','subtract','then','length','info','[WHATSAPP]\x20Interactions\x20to\x20close:','join','update','system','timeout','YYYY-MM-DD\x20HH:mm:ss','[WHATSAPP]\x20Sending\x20updates\x20for\x20interactions:','whatsappInteraction:update','catch','error','[WHATSAPP]\x20Error\x20closing\x20interactions','inspect','start','moment','../logger','schedule','redis','WhatsappInteraction'];(function(_0x25e2ea,_0x3026ec){var _0x55c108=function(_0xbceee2){while(--_0xbceee2){_0x25e2ea['push'](_0x25e2ea['shift']());}};_0x55c108(++_0x3026ec);}(_0x9f5a,0xf8));var _0xa9f5=function(_0x45a90c,_0x3a01c3){_0x45a90c=_0x45a90c-0x0;var _0x526616=_0x9f5a[_0x45a90c];return _0x526616;};'use strict';var _=require('lodash');var moment=require(_0xa9f5('0x0'));var Redis=require('ioredis');var util=require('util');var config=require('../../config/environment');var db=require('../../mysqldb')['db'];var logger=require(_0xa9f5('0x1'))(_0xa9f5('0x2'));config[_0xa9f5('0x3')]=_['defaults'](config[_0xa9f5('0x3')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function closeInteractions(){var _0x16b685=[];return db[_0xa9f5('0x4')]['findAll']({'raw':!![],'attributes':['id',_0xa9f5('0x5')],'where':{'closed':![],'lastMsgDirection':'in','lastMsgAt':{'$lt':moment()[_0xa9f5('0x6')](0x18,'hours')}}})[_0xa9f5('0x7')](function(_0x211bf5){if(_0x211bf5&&_0x211bf5[_0xa9f5('0x8')]){_0x16b685=_['map'](_0x211bf5||[],'id');logger[_0xa9f5('0x9')](_0xa9f5('0xa'),_0x16b685[_0xa9f5('0xb')]());return db[_0xa9f5('0x4')][_0xa9f5('0xc')]({'closeReason':_0xa9f5('0xd'),'disposition':_0xa9f5('0xe'),'closed':!![],'closedAt':moment()['format'](_0xa9f5('0xf'))},{'where':{'id':_0x16b685}});}})[_0xa9f5('0x7')](function(){if(_0x16b685&&_0x16b685[_0xa9f5('0x8')]){logger[_0xa9f5('0x9')](_0xa9f5('0x10'),_0x16b685[_0xa9f5('0xb')]());for(var _0x7026ee=0x0;_0x7026ee<_0x16b685['length'];_0x7026ee++){io['emit'](_0xa9f5('0x11'),{'id':_0x16b685[_0x7026ee],'closed':!![]});}}})[_0xa9f5('0x12')](function(_0x219531){logger[_0xa9f5('0x13')](_0xa9f5('0x14'),_0x219531?util[_0xa9f5('0x15')](_0x219531,{'showHidden':![],'depth':null}):'');});}exports[_0xa9f5('0x16')]=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 638721b..f8b7e90 100644 --- a/server/config/seedContact.js +++ b/server/config/seedContact.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x911f=['Innocenzo','Biondo','innocenzo.biondo','@xcally.com','now','CmContact','destroy','bulkCreate','then','log','contacts1','CmHopper','finished\x20populating','contacts2','hopper2','catch','util','../mysqldb','push'];(function(_0x2534d0,_0x392d71){var _0x3928ac=function(_0x23a44a){while(--_0x23a44a){_0x2534d0['push'](_0x2534d0['shift']());}};_0x3928ac(++_0x392d71);}(_0x911f,0x12d));var _0xf911=function(_0x221a26,_0x1325d1){_0x221a26=_0x221a26-0x0;var _0x184ec7=_0x911f[_0x221a26];return _0x184ec7;};'use strict';var util=require(_0xf911('0x0'));var db=require(_0xf911('0x1'))['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts[_0xf911('0x2')]({'id':i,'firstName':_0xf911('0x3')+i,'lastName':_0xf911('0x4')+i,'phone':0xf879fb460+i,'email':_0xf911('0x5')+i+_0xf911('0x6')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xf911('0x2')]({'id':i,'active':![],'scheduledat':Date[_0xf911('0x7')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xf911('0x7')](),'updatedAt':Date[_0xf911('0x7')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xf911('0x2')]({'id':i,'firstName':'Innocenzo'+i,'lastName':_0xf911('0x4')+i,'phone':0xf879fb460+i,'email':_0xf911('0x5')+i+'@xcally.com'});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xf911('0x2')]({'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['now']()});}db[_0xf911('0x8')][_0xf911('0x9')]({'where':{}})['then'](function(){return db[_0xf911('0x8')][_0xf911('0xa')](contacts);})[_0xf911('0xb')](function(){console[_0xf911('0xc')]('finished\x20populating',_0xf911('0xd'));return db['CmHopper']['destroy']({'where':{}});})[_0xf911('0xb')](function(){return db[_0xf911('0xe')][_0xf911('0xa')](hopper);})[_0xf911('0xb')](function(){console[_0xf911('0xc')](_0xf911('0xf'),'hopper1');return db[_0xf911('0x8')][_0xf911('0xa')](contacts2);})[_0xf911('0xb')](function(){console[_0xf911('0xc')](_0xf911('0xf'),_0xf911('0x10'));return db[_0xf911('0xe')]['bulkCreate'](hopper2);})[_0xf911('0xb')](function(){console[_0xf911('0xc')](_0xf911('0xf'),_0xf911('0x11'));})[_0xf911('0x12')](function(_0x68c43f){console['log'](_0x68c43f);}); \ No newline at end of file +var _0x1cdd=['Innocenzo','Biondo','innocenzo.biondo','@xcally.com','push','now','CmContact','destroy','then','log','finished\x20populating','contacts1','CmHopper','bulkCreate','hopper1','contacts2','hopper2','catch','util'];(function(_0x190500,_0x3513b4){var _0x228240=function(_0x40318e){while(--_0x40318e){_0x190500['push'](_0x190500['shift']());}};_0x228240(++_0x3513b4);}(_0x1cdd,0x1a1));var _0xd1cd=function(_0x44d947,_0x164eb9){_0x44d947=_0x44d947-0x0;var _0x12c945=_0x1cdd[_0x44d947];return _0x12c945;};'use strict';var util=require(_0xd1cd('0x0'));var db=require('../mysqldb')['db'];var contacts=[];var hopper=[];var contacts2=[];var hopper2=[];for(var i=0x1;i<=0x4b0;i+=0x1){contacts['push']({'id':i,'firstName':_0xd1cd('0x1')+i,'lastName':_0xd1cd('0x2')+i,'phone':0xf879fb460+i,'email':_0xd1cd('0x3')+i+_0xd1cd('0x4')});}for(var i=0x1;i<=0x4b0;i+=0x1){hopper[_0xd1cd('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xd1cd('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd1cd('0x6')](),'updatedAt':Date[_0xd1cd('0x6')]()});}for(var i=0x4b1;i<=0x960;i+=0x1){contacts2[_0xd1cd('0x5')]({'id':i,'firstName':_0xd1cd('0x1')+i,'lastName':_0xd1cd('0x2')+i,'phone':0xf879fb460+i,'email':_0xd1cd('0x3')+i+_0xd1cd('0x4')});}for(var i=0x4b1;i<=0x960;i+=0x1){hopper2[_0xd1cd('0x5')]({'id':i,'active':![],'scheduledat':Date[_0xd1cd('0x6')](),'countbusyretry':0x0,'countcongestionretry':0x0,'countnoanswerretry':0x0,'ContactId':i,'ListId':0x1,'UserId':0x1,'VoiceQueueId':0x3fd,'createdAt':Date[_0xd1cd('0x6')](),'updatedAt':Date[_0xd1cd('0x6')]()});}db[_0xd1cd('0x7')][_0xd1cd('0x8')]({'where':{}})[_0xd1cd('0x9')](function(){return db['CmContact']['bulkCreate'](contacts);})[_0xd1cd('0x9')](function(){console[_0xd1cd('0xa')](_0xd1cd('0xb'),_0xd1cd('0xc'));return db[_0xd1cd('0xd')]['destroy']({'where':{}});})[_0xd1cd('0x9')](function(){return db[_0xd1cd('0xd')][_0xd1cd('0xe')](hopper);})[_0xd1cd('0x9')](function(){console['log'](_0xd1cd('0xb'),_0xd1cd('0xf'));return db['CmContact'][_0xd1cd('0xe')](contacts2);})[_0xd1cd('0x9')](function(){console['log']('finished\x20populating',_0xd1cd('0x10'));return db['CmHopper']['bulkCreate'](hopper2);})[_0xd1cd('0x9')](function(){console['log'](_0xd1cd('0xb'),_0xd1cd('0x11'));})[_0xd1cd('0x12')](function(_0x4650ef){console[_0xd1cd('0xa')](_0x4650ef);}); \ No newline at end of file diff --git a/server/config/seedUsers.js b/server/config/seedUsers.js index 532a459..a502ff6 100644 --- a/server/config/seedUsers.js +++ b/server/config/seedUsers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x079f=['User','bulkCreate','log','add\x20user','catch','util','../mysqldb','agent','%s%s','%s%s@xcally.com','udp','all','ulaw','format','yes','/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','\x22%s\x22\x20<%s>'];(function(_0x3fc8a5,_0x2c9129){var _0x132208=function(_0x2a1272){while(--_0x2a1272){_0x3fc8a5['push'](_0x3fc8a5['shift']());}};_0x132208(++_0x2c9129);}(_0x079f,0x113));var _0xf079=function(_0x12af74,_0x4fb5c2){_0x12af74=_0x12af74-0x0;var _0x41277b=_0x079f[_0x12af74];return _0x41277b;};'use strict';var util=require(_0xf079('0x0'));var db=require(_0xf079('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users['push']({'name':util['format']('%s%s',_0xf079('0x2'),i),'fullname':util['format'](_0xf079('0x3'),'agent',i),'email':util['format'](_0xf079('0x4'),_0xf079('0x2'),i),'role':_0xf079('0x2'),'password':'password','internal':0xfa0+i,'type':'friend','transport':[_0xf079('0x5'),'ws','wss'],'disallow':[_0xf079('0x6')],'allow':[_0xf079('0x7')],'defaultuser':util[_0xf079('0x8')](_0xf079('0x3'),_0xf079('0x2'),i),'encryption':_0xf079('0x9'),'avpf':_0xf079('0x9'),'force_avp':'yes','icesupport':'yes','dtlsenable':_0xf079('0x9'),'dtlsverify':'no','dtlscertfile':_0xf079('0xa'),'dtlsprivatekey':_0xf079('0xb'),'dtlssetup':'actpass','callerid':util[_0xf079('0x8')](_0xf079('0xc'),util['format'](_0xf079('0x3'),_0xf079('0x2'),i),0xfa0+i)});}db[_0xf079('0xd')][_0xf079('0xe')](users)['then'](function(){console[_0xf079('0xf')](_0xf079('0x10'));})[_0xf079('0x11')](function(_0x6a271d){console[_0xf079('0xf')](_0x6a271d);}); \ No newline at end of file +var _0x4d96=['/etc/pki/tls/certs/motion.crt','/etc/pki/tls/private/motion.key','actpass','User','bulkCreate','then','log','add\x20user','catch','util','../mysqldb','push','format','%s%s','agent','%s%s@xcally.com','password','friend','udp','wss','all','ulaw','yes'];(function(_0x19ff82,_0x4b3ca6){var _0x4979ee=function(_0x3b3d34){while(--_0x3b3d34){_0x19ff82['push'](_0x19ff82['shift']());}};_0x4979ee(++_0x4b3ca6);}(_0x4d96,0x93));var _0x64d9=function(_0x4f7521,_0x361976){_0x4f7521=_0x4f7521-0x0;var _0x59a337=_0x4d96[_0x4f7521];return _0x59a337;};'use strict';var util=require(_0x64d9('0x0'));var db=require(_0x64d9('0x1'))['db'];var users=[];for(var i=0x1;i<=0xc8;i+=0x1){users[_0x64d9('0x2')]({'name':util[_0x64d9('0x3')](_0x64d9('0x4'),_0x64d9('0x5'),i),'fullname':util[_0x64d9('0x3')]('%s%s',_0x64d9('0x5'),i),'email':util['format'](_0x64d9('0x6'),'agent',i),'role':_0x64d9('0x5'),'password':_0x64d9('0x7'),'internal':0xfa0+i,'type':_0x64d9('0x8'),'transport':[_0x64d9('0x9'),'ws',_0x64d9('0xa')],'disallow':[_0x64d9('0xb')],'allow':[_0x64d9('0xc')],'defaultuser':util[_0x64d9('0x3')]('%s%s','agent',i),'encryption':_0x64d9('0xd'),'avpf':_0x64d9('0xd'),'force_avp':_0x64d9('0xd'),'icesupport':_0x64d9('0xd'),'dtlsenable':'yes','dtlsverify':'no','dtlscertfile':_0x64d9('0xe'),'dtlsprivatekey':_0x64d9('0xf'),'dtlssetup':_0x64d9('0x10'),'callerid':util[_0x64d9('0x3')]('\x22%s\x22\x20<%s>',util['format'](_0x64d9('0x4'),'agent',i),0xfa0+i)});}db[_0x64d9('0x11')][_0x64d9('0x12')](users)[_0x64d9('0x13')](function(){console[_0x64d9('0x14')](_0x64d9('0x15'));})[_0x64d9('0x16')](function(_0x44fbc7){console[_0x64d9('0x14')](_0x44fbc7);}); \ No newline at end of file diff --git a/server/config/socketio.js b/server/config/socketio.js index 40199ab..4926ed7 100644 --- a/server/config/socketio.js +++ b/server/config/socketio.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xf1d6=['MailInteractions','removeMailInteractions','removeFaxInteractions','removeSmsInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','join','default','setMaxListeners','address','request','connection','remoteAddress','remotePort','connectedAt','log','SocketIO\x20','nsp','disconnect','CONNECTED','lodash','util','bluebird','../mysqldb','./environment','Agents','User','name','telephone','agent','autoAssociation','ChatQueues','FaxQueues','SmsQueues','MailQueues','WhatsappQueues','findAll','Telephones','Trunks','IvrCampaigns','UserProfileResource','resourceId','then','map','where','role','Campaign','type','format','%s:queue:%s','length','handshake','query','userProfileId','ChatInteraction','ChatInteractions','MailInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteractions','WhatsappInteractions','admin','voice:inbound','voice:outbound','include','VoiceQueue','push','SmsQueue','MailQueue','WhatsappQueue','Trunk','user','ChatQueue','FaxQueue','OpenchannelQueues','OpenchannelQueue','getVoiceQueues','getChatQueues','getFaxQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','voice','chat','fax','sms','mail','whatsapp','telephone:%s','trunk:%s','user:%s','removeChatInteractions','emit','leave'];(function(_0x3b5edd,_0x28d04c){var _0x5ece68=function(_0x446045){while(--_0x446045){_0x3b5edd['push'](_0x3b5edd['shift']());}};_0x5ece68(++_0x28d04c);}(_0xf1d6,0x195));var _0x6f1d=function(_0x534682,_0x46fa1c){_0x534682=_0x534682-0x0;var _0xd06232=_0xf1d6[_0x534682];return _0xd06232;};'use strict';var _=require(_0x6f1d('0x0'));var util=require(_0x6f1d('0x1'));var BPromise=require(_0x6f1d('0x2'));var db=require(_0x6f1d('0x3'))['db'];var config=require(_0x6f1d('0x4'));var queryQueues={'attributes':['id','name'],'include':[{'as':_0x6f1d('0x5'),'model':db[_0x6f1d('0x6')],'attributes':['id',_0x6f1d('0x7'),'role'],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id','name'],'where':{'role':_0x6f1d('0x8')}};var queryTrunks={'raw':!![],'attributes':['id',_0x6f1d('0x7')]};var queryAgents={'raw':!![],'attributes':['id',_0x6f1d('0x7')],'where':{'role':_0x6f1d('0x9')}};var queryCampaigns={'raw':!![],'attributes':['id',_0x6f1d('0x7'),'type'],'where':{'type':'ivr'}};function getAssociatedResources(_0x57dc9a,_0x38e88c,_0x58ffb5){return db['UserProfileSection']['findOne']({'where':{'name':_0x57dc9a,'userProfileId':_0x38e88c},'raw':!![]})['then'](function(_0x51811d){if(_0x51811d){if(_0x51811d[_0x6f1d('0xa')]){switch(_0x57dc9a){case'VoiceQueues':case _0x6f1d('0xb'):case _0x6f1d('0xc'):case _0x6f1d('0xd'):case _0x6f1d('0xe'):case'OpenchannelQueues':case _0x6f1d('0xf'):return db[_0x58ffb5][_0x6f1d('0x10')](queryQueues);case _0x6f1d('0x11'):return db[_0x58ffb5][_0x6f1d('0x10')](queryTelephones);case _0x6f1d('0x12'):return db[_0x58ffb5][_0x6f1d('0x10')](queryTrunks);case _0x6f1d('0x13'):return db[_0x58ffb5][_0x6f1d('0x10')](queryCampaigns);}}else{return db[_0x6f1d('0x14')]['findAll']({'attributes':[_0x6f1d('0x15')],'where':{'sectionId':_0x51811d['id']},'raw':!![]})[_0x6f1d('0x16')](function(_0x217086){if(_0x217086){var _0x495a14={'where':{'id':_[_0x6f1d('0x17')](_0x217086,_0x6f1d('0x15'))},'raw':!![]};switch(_0x58ffb5){case _0x6f1d('0x6'):_0x495a14[_0x6f1d('0x18')][_0x6f1d('0x19')]=_0x6f1d('0x8');break;case _0x6f1d('0x1a'):_0x495a14[_0x6f1d('0x18')][_0x6f1d('0x1b')]='ivr';break;}return db[_0x58ffb5]['findAll'](_0x495a14);}else{return[];}});}}else{return[];}})[_0x6f1d('0x16')](function(_0x50cba3){return _0x50cba3;});}function joinOrLeaveQueues(_0x44d805,_0x53693f,_0x31a935,_0xec7d0f){_0x44d805[_0x53693f](util[_0x6f1d('0x1c')](_0x6f1d('0x1d'),_0x31a935,_0xec7d0f['name']));if(_0xec7d0f[_0x6f1d('0x5')]){for(var _0x120fff=0x0;_0x120fff<_0xec7d0f[_0x6f1d('0x5')][_0x6f1d('0x1e')];_0x120fff+=0x1){_0x44d805[_0x53693f](util[_0x6f1d('0x1c')]('user:%s',_0xec7d0f['Agents'][_0x120fff][_0x6f1d('0x7')]));}}}function joinOrLeave(_0x239ff7,_0x2fbd59,_0x19338f){var _0x4265b3;if(_0x239ff7[_0x6f1d('0x1f')][_0x6f1d('0x20')]['id']){db[_0x6f1d('0x6')]['find']({'attributes':['id',_0x6f1d('0x7'),_0x6f1d('0x19'),_0x6f1d('0x21')],'where':{'id':_0x239ff7[_0x6f1d('0x1f')][_0x6f1d('0x20')]['id']},'include':[{'model':db[_0x6f1d('0x22')],'as':_0x6f1d('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x6f1d('0x24')],'as':'MailInteractions','attributes':['id'],'raw':!![]},{'model':db['FaxInteraction'],'as':_0x6f1d('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x6f1d('0x26')],'as':_0x6f1d('0x27'),'attributes':['id'],'raw':!![]},{'model':db['OpenchannelInteraction'],'as':_0x6f1d('0x28'),'attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x6f1d('0x29'),'attributes':['id'],'raw':!![]}]})['then'](function(_0x2cad3c){if(_0x2cad3c){_0x4265b3=_0x2cad3c;_0x239ff7[_0x2fbd59](util[_0x6f1d('0x1c')]('user:%s',_0x2cad3c[_0x6f1d('0x7')]));var _0x5ac4e6=[];switch(_0x2cad3c[_0x6f1d('0x19')]){case _0x6f1d('0x2a'):_0x239ff7[_0x2fbd59](_0x6f1d('0x2b'));_0x239ff7[_0x2fbd59](_0x6f1d('0x2c'));if(queryQueues['hasOwnProperty'](_0x6f1d('0x2d'))){delete queryQueues['include'];}_0x5ac4e6['push'](db[_0x6f1d('0x2e')][_0x6f1d('0x10')](queryQueues));_0x5ac4e6['push'](db['ChatQueue']['findAll'](queryQueues));_0x5ac4e6[_0x6f1d('0x2f')](db['FaxQueue'][_0x6f1d('0x10')](queryQueues));_0x5ac4e6['push'](db[_0x6f1d('0x30')][_0x6f1d('0x10')](queryQueues));_0x5ac4e6[_0x6f1d('0x2f')](db[_0x6f1d('0x31')][_0x6f1d('0x10')](queryQueues));_0x5ac4e6['push'](db['OpenchannelQueue'][_0x6f1d('0x10')](queryQueues));_0x5ac4e6[_0x6f1d('0x2f')](db[_0x6f1d('0x32')]['findAll'](queryQueues));_0x5ac4e6[_0x6f1d('0x2f')](db[_0x6f1d('0x6')][_0x6f1d('0x10')](queryTelephones));_0x5ac4e6[_0x6f1d('0x2f')](db[_0x6f1d('0x33')][_0x6f1d('0x10')](queryTrunks));_0x5ac4e6[_0x6f1d('0x2f')](db[_0x6f1d('0x1a')]['findAll'](queryCampaigns));_0x5ac4e6[_0x6f1d('0x2f')](db[_0x6f1d('0x6')][_0x6f1d('0x10')](queryAgents));break;case _0x6f1d('0x34'):_0x239ff7[_0x2fbd59](_0x6f1d('0x2b'));_0x239ff7[_0x2fbd59]('voice:outbound');_0x5ac4e6[_0x6f1d('0x2f')](getAssociatedResources('VoiceQueues',_0x2cad3c['userProfileId'],_0x6f1d('0x2e')));_0x5ac4e6['push'](getAssociatedResources(_0x6f1d('0xb'),_0x2cad3c[_0x6f1d('0x21')],_0x6f1d('0x35')));_0x5ac4e6[_0x6f1d('0x2f')](getAssociatedResources(_0x6f1d('0xc'),_0x2cad3c[_0x6f1d('0x21')],_0x6f1d('0x36')));_0x5ac4e6[_0x6f1d('0x2f')](getAssociatedResources('SmsQueues',_0x2cad3c['userProfileId'],_0x6f1d('0x30')));_0x5ac4e6[_0x6f1d('0x2f')](getAssociatedResources(_0x6f1d('0xe'),_0x2cad3c['userProfileId'],_0x6f1d('0x31')));_0x5ac4e6['push'](getAssociatedResources(_0x6f1d('0x37'),_0x2cad3c[_0x6f1d('0x21')],_0x6f1d('0x38')));_0x5ac4e6['push'](getAssociatedResources(_0x6f1d('0xf'),_0x2cad3c['userProfileId'],_0x6f1d('0x32')));_0x5ac4e6[_0x6f1d('0x2f')](getAssociatedResources(_0x6f1d('0x11'),_0x2cad3c[_0x6f1d('0x21')],_0x6f1d('0x6')));_0x5ac4e6[_0x6f1d('0x2f')](getAssociatedResources(_0x6f1d('0x12'),_0x2cad3c[_0x6f1d('0x21')],_0x6f1d('0x33')));_0x5ac4e6[_0x6f1d('0x2f')](getAssociatedResources(_0x6f1d('0x13'),_0x2cad3c['userProfileId'],_0x6f1d('0x1a')));_0x5ac4e6[_0x6f1d('0x2f')](db[_0x6f1d('0x6')][_0x6f1d('0x10')](queryAgents));break;case _0x6f1d('0x9'):_0x239ff7[_0x2fbd59]('voice:inbound');_0x239ff7[_0x2fbd59]('voice:outbound');_0x5ac4e6[_0x6f1d('0x2f')](_0x2cad3c[_0x6f1d('0x39')]({'attributes':['id',_0x6f1d('0x7')]}));_0x5ac4e6[_0x6f1d('0x2f')](_0x2cad3c[_0x6f1d('0x3a')]({'attributes':['id',_0x6f1d('0x7')]}));_0x5ac4e6[_0x6f1d('0x2f')](_0x2cad3c[_0x6f1d('0x3b')]({'attributes':['id',_0x6f1d('0x7')]}));_0x5ac4e6['push'](_0x2cad3c['getSmsQueues']({'attributes':['id',_0x6f1d('0x7')]}));_0x5ac4e6[_0x6f1d('0x2f')](_0x2cad3c[_0x6f1d('0x3c')]({'attributes':['id',_0x6f1d('0x7')]}));_0x5ac4e6[_0x6f1d('0x2f')](_0x2cad3c[_0x6f1d('0x3d')]({'attributes':['id','name']}));_0x5ac4e6[_0x6f1d('0x2f')](_0x2cad3c[_0x6f1d('0x3e')]({'attributes':['id',_0x6f1d('0x7')]}));break;}return BPromise['all'](_0x5ac4e6);}})[_0x6f1d('0x16')](function(_0xe31571){if(_0xe31571&&_0xe31571['length']){for(var _0x419d6b=0x0;_0x419d6b<_0xe31571[_0x6f1d('0x1e')];_0x419d6b+=0x1){for(var _0x412318=0x0;_0x412318<_0xe31571[_0x419d6b]['length'];_0x412318+=0x1){switch(_0x419d6b){case 0x0:joinOrLeaveQueues(_0x239ff7,_0x2fbd59,_0x6f1d('0x3f'),_0xe31571[_0x419d6b][_0x412318]);break;case 0x1:joinOrLeaveQueues(_0x239ff7,_0x2fbd59,_0x6f1d('0x40'),_0xe31571[_0x419d6b][_0x412318]);break;case 0x2:joinOrLeaveQueues(_0x239ff7,_0x2fbd59,_0x6f1d('0x41'),_0xe31571[_0x419d6b][_0x412318]);break;case 0x3:joinOrLeaveQueues(_0x239ff7,_0x2fbd59,_0x6f1d('0x42'),_0xe31571[_0x419d6b][_0x412318]);break;case 0x4:joinOrLeaveQueues(_0x239ff7,_0x2fbd59,_0x6f1d('0x43'),_0xe31571[_0x419d6b][_0x412318]);break;case 0x5:joinOrLeaveQueues(_0x239ff7,_0x2fbd59,'openchannel',_0xe31571[_0x419d6b][_0x412318]);break;case 0x6:joinOrLeaveQueues(_0x239ff7,_0x2fbd59,_0x6f1d('0x44'),_0xe31571[_0x419d6b][_0x412318]);break;case 0x7:if(_0x4265b3[_0x6f1d('0x19')]!==_0x6f1d('0x9'))_0x239ff7[_0x2fbd59](util[_0x6f1d('0x1c')](_0x6f1d('0x45'),_0xe31571[_0x419d6b][_0x412318]['name']));break;case 0x8:if(_0x4265b3['role']!==_0x6f1d('0x9'))_0x239ff7[_0x2fbd59](util[_0x6f1d('0x1c')](_0x6f1d('0x46'),_0xe31571[_0x419d6b][_0x412318]['name']));break;case 0x9:if(_0x4265b3['role']!==_0x6f1d('0x9'))_0x239ff7[_0x2fbd59](util[_0x6f1d('0x1c')]('campaign:%s:%s',_0xe31571[_0x419d6b][_0x412318][_0x6f1d('0x1b')],_0xe31571[_0x419d6b][_0x412318][_0x6f1d('0x7')]));break;case 0xa:_0x239ff7[_0x2fbd59](util[_0x6f1d('0x1c')](_0x6f1d('0x47'),_0xe31571[_0x419d6b][_0x412318]['name']));break;}}}}})['then'](function(){if(_0x2fbd59==='leave'){var _0x43b039=_[_0x6f1d('0x17')](_0x4265b3['ChatInteractions'],'id');return _0x4265b3[_0x6f1d('0x48')](_0x43b039)['then'](function(){for(var _0x3d1849=0x0;_0x3d1849<_0x43b039[_0x6f1d('0x1e')];_0x3d1849+=0x1){_0x19338f[_0x6f1d('0x49')]('user_has_chat_interactions:remove',{'ChatInteractionId':Number(_0x43b039[_0x3d1849]),'UserId':Number(_0x4265b3['id'])});}});}})[_0x6f1d('0x16')](function(){if(_0x2fbd59===_0x6f1d('0x4a')){var _0x4d2562=_[_0x6f1d('0x17')](_0x4265b3[_0x6f1d('0x4b')],'id');return _0x4265b3[_0x6f1d('0x4c')](_0x4d2562)[_0x6f1d('0x16')](function(){for(var _0x4d9b1b=0x0;_0x4d9b1b<_0x4d2562[_0x6f1d('0x1e')];_0x4d9b1b+=0x1){_0x19338f['emit']('user_has_mail_interactions:remove',{'MailInteractionId':Number(_0x4d2562[_0x4d9b1b]),'UserId':Number(_0x4265b3['id'])});}});}})['then'](function(){if(_0x2fbd59===_0x6f1d('0x4a')){var _0x468796=_[_0x6f1d('0x17')](_0x4265b3[_0x6f1d('0x25')],'id');return _0x4265b3[_0x6f1d('0x4d')](_0x468796)['then'](function(){for(var _0x489018=0x0;_0x489018<_0x468796[_0x6f1d('0x1e')];_0x489018+=0x1){_0x19338f[_0x6f1d('0x49')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x468796[_0x489018]),'UserId':Number(_0x4265b3['id'])});}});}})[_0x6f1d('0x16')](function(){if(_0x2fbd59===_0x6f1d('0x4a')){var _0xfa908a=_['map'](_0x4265b3['SmsInteractions'],'id');return _0x4265b3[_0x6f1d('0x4e')](_0xfa908a)[_0x6f1d('0x16')](function(){for(var _0x2bc824=0x0;_0x2bc824<_0xfa908a['length'];_0x2bc824+=0x1){_0x19338f[_0x6f1d('0x49')]('user_has_sms_interactions:remove',{'SmsInteractionId':Number(_0xfa908a[_0x2bc824]),'UserId':Number(_0x4265b3['id'])});}});}})[_0x6f1d('0x16')](function(){if(_0x2fbd59===_0x6f1d('0x4a')){var _0x17ce84=_[_0x6f1d('0x17')](_0x4265b3['OpenchannelInteractions'],'id');return _0x4265b3['removeOpenchannelInteractions'](_0x17ce84)[_0x6f1d('0x16')](function(){for(var _0xff0e29=0x0;_0xff0e29<_0x17ce84[_0x6f1d('0x1e')];_0xff0e29+=0x1){_0x19338f['emit'](_0x6f1d('0x4f'),{'OpenchannelInteractionId':Number(_0x17ce84[_0xff0e29]),'UserId':Number(_0x4265b3['id'])});}});}})[_0x6f1d('0x16')](function(){if(_0x2fbd59===_0x6f1d('0x4a')){var _0x275d5f=_[_0x6f1d('0x17')](_0x4265b3[_0x6f1d('0x29')],'id');return _0x4265b3[_0x6f1d('0x50')](_0x275d5f)[_0x6f1d('0x16')](function(){for(var _0x46411e=0x0;_0x46411e<_0x275d5f['length'];_0x46411e+=0x1){_0x19338f[_0x6f1d('0x49')](_0x6f1d('0x51'),{'WhatsappInteractionId':Number(_0x275d5f[_0x46411e]),'UserId':Number(_0x4265b3['id'])});}});}})['catch'](function(_0xe34457){_0x239ff7['log'](_0xe34457);});}}function onDisconnect(_0xac2013,_0x224c2b){joinOrLeave(_0xac2013,_0x6f1d('0x4a'),_0x224c2b);}function onConnect(_0x15016b){joinOrLeave(_0x15016b,_0x6f1d('0x52'));}exports[_0x6f1d('0x53')]=function(_0x5450a1){_0x5450a1['on']('connection',function(_0x41b413){_0x41b413[_0x6f1d('0x54')](0x0);_0x41b413[_0x6f1d('0x55')]=_0x41b413[_0x6f1d('0x56')][_0x6f1d('0x57')][_0x6f1d('0x58')]+':'+_0x41b413['request']['connection'][_0x6f1d('0x59')];_0x41b413[_0x6f1d('0x5a')]=new Date();_0x41b413[_0x6f1d('0x5b')]=function(_0x1eda71){console[_0x6f1d('0x5b')](_0x6f1d('0x5c')+_0x41b413[_0x6f1d('0x5d')][_0x6f1d('0x7')]+'['+_0x41b413[_0x6f1d('0x55')]+']',_0x1eda71);};_0x41b413['on'](_0x6f1d('0x5e'),function(){onDisconnect(_0x41b413,_0x5450a1);_0x41b413[_0x6f1d('0x5b')]('DISCONNECTED');});onConnect(_0x41b413);_0x41b413[_0x6f1d('0x5b')](_0x6f1d('0x5f'));});}; \ No newline at end of file +var _0xad07=['mail','openchannel','whatsapp','trunk:%s','campaign:%s:%s','leave','removeChatInteractions','emit','user_has_chat_interactions:remove','removeMailInteractions','user_has_mail_interactions:remove','user_has_sms_interactions:remove','OpenchannelInteractions','removeOpenchannelInteractions','user_has_openchannel_interactions:remove','removeWhatsappInteractions','user_has_whatsapp_interactions:remove','catch','join','connection','address','request','remoteAddress','remotePort','log','SocketIO\x20','nsp','disconnect','DISCONNECTED','lodash','util','../mysqldb','./environment','User','name','role','agent','ivr','UserProfileSection','findOne','then','autoAssociation','VoiceQueues','ChatQueues','FaxQueues','SmsQueues','MailQueues','OpenchannelQueues','WhatsappQueues','findAll','Trunks','IvrCampaigns','resourceId','map','telephone','type','format','%s:queue:%s','Agents','user:%s','query','find','userProfileId','handshake','ChatInteractions','MailInteraction','MailInteractions','FaxInteraction','FaxInteractions','SmsInteraction','SmsInteractions','OpenchannelInteraction','WhatsappInteractions','admin','voice:inbound','voice:outbound','hasOwnProperty','include','push','VoiceQueue','FaxQueue','SmsQueue','MailQueue','OpenchannelQueue','WhatsappQueue','Trunk','Campaign','user','getVoiceQueues','getSmsQueues','getMailQueues','getOpenchannelQueues','getWhatsappQueues','all','length','voice','chat','fax','sms'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xad07,0xe3));var _0x7ad0=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xad07[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x7ad0('0x0'));var util=require(_0x7ad0('0x1'));var BPromise=require('bluebird');var db=require(_0x7ad0('0x2'))['db'];var config=require(_0x7ad0('0x3'));var queryQueues={'attributes':['id','name'],'include':[{'as':'Agents','model':db[_0x7ad0('0x4')],'attributes':['id',_0x7ad0('0x5'),_0x7ad0('0x6')],'raw':!![],'where':{'role':'agent'},'required':![]}]};var queryTelephones={'raw':!![],'attributes':['id',_0x7ad0('0x5')],'where':{'role':'telephone'}};var queryTrunks={'raw':!![],'attributes':['id','name']};var queryAgents={'raw':!![],'attributes':['id',_0x7ad0('0x5')],'where':{'role':_0x7ad0('0x7')}};var queryCampaigns={'raw':!![],'attributes':['id','name','type'],'where':{'type':_0x7ad0('0x8')}};function getAssociatedResources(_0x301979,_0x4f9ee2,_0x5afa7c){return db[_0x7ad0('0x9')][_0x7ad0('0xa')]({'where':{'name':_0x301979,'userProfileId':_0x4f9ee2},'raw':!![]})[_0x7ad0('0xb')](function(_0x52c277){if(_0x52c277){if(_0x52c277[_0x7ad0('0xc')]){switch(_0x301979){case _0x7ad0('0xd'):case _0x7ad0('0xe'):case _0x7ad0('0xf'):case _0x7ad0('0x10'):case _0x7ad0('0x11'):case _0x7ad0('0x12'):case _0x7ad0('0x13'):return db[_0x5afa7c][_0x7ad0('0x14')](queryQueues);case'Telephones':return db[_0x5afa7c][_0x7ad0('0x14')](queryTelephones);case _0x7ad0('0x15'):return db[_0x5afa7c][_0x7ad0('0x14')](queryTrunks);case _0x7ad0('0x16'):return db[_0x5afa7c]['findAll'](queryCampaigns);}}else{return db['UserProfileResource'][_0x7ad0('0x14')]({'attributes':[_0x7ad0('0x17')],'where':{'sectionId':_0x52c277['id']},'raw':!![]})[_0x7ad0('0xb')](function(_0xcecbc1){if(_0xcecbc1){var _0xebb4da={'where':{'id':_[_0x7ad0('0x18')](_0xcecbc1,_0x7ad0('0x17'))},'raw':!![]};switch(_0x5afa7c){case _0x7ad0('0x4'):_0xebb4da['where'][_0x7ad0('0x6')]=_0x7ad0('0x19');break;case'Campaign':_0xebb4da['where'][_0x7ad0('0x1a')]='ivr';break;}return db[_0x5afa7c][_0x7ad0('0x14')](_0xebb4da);}else{return[];}});}}else{return[];}})[_0x7ad0('0xb')](function(_0x499b95){return _0x499b95;});}function joinOrLeaveQueues(_0x126454,_0x514841,_0x11f83a,_0x538f9b){_0x126454[_0x514841](util[_0x7ad0('0x1b')](_0x7ad0('0x1c'),_0x11f83a,_0x538f9b[_0x7ad0('0x5')]));if(_0x538f9b[_0x7ad0('0x1d')]){for(var _0x481eeb=0x0;_0x481eeb<_0x538f9b[_0x7ad0('0x1d')]['length'];_0x481eeb+=0x1){_0x126454[_0x514841](util[_0x7ad0('0x1b')](_0x7ad0('0x1e'),_0x538f9b['Agents'][_0x481eeb][_0x7ad0('0x5')]));}}}function joinOrLeave(_0x4f2e9b,_0x5edbdf,_0x4be2a0){var _0x1d9a26;if(_0x4f2e9b['handshake'][_0x7ad0('0x1f')]['id']){db['User'][_0x7ad0('0x20')]({'attributes':['id',_0x7ad0('0x5'),_0x7ad0('0x6'),_0x7ad0('0x21')],'where':{'id':_0x4f2e9b[_0x7ad0('0x22')][_0x7ad0('0x1f')]['id']},'include':[{'model':db['ChatInteraction'],'as':_0x7ad0('0x23'),'attributes':['id'],'raw':!![]},{'model':db[_0x7ad0('0x24')],'as':_0x7ad0('0x25'),'attributes':['id'],'raw':!![]},{'model':db[_0x7ad0('0x26')],'as':_0x7ad0('0x27'),'attributes':['id'],'raw':!![]},{'model':db[_0x7ad0('0x28')],'as':_0x7ad0('0x29'),'attributes':['id'],'raw':!![]},{'model':db[_0x7ad0('0x2a')],'as':'OpenchannelInteractions','attributes':['id'],'raw':!![]},{'model':db['WhatsappInteraction'],'as':_0x7ad0('0x2b'),'attributes':['id'],'raw':!![]}]})[_0x7ad0('0xb')](function(_0x8150f5){if(_0x8150f5){_0x1d9a26=_0x8150f5;_0x4f2e9b[_0x5edbdf](util[_0x7ad0('0x1b')](_0x7ad0('0x1e'),_0x8150f5['name']));var _0x508c31=[];switch(_0x8150f5[_0x7ad0('0x6')]){case _0x7ad0('0x2c'):_0x4f2e9b[_0x5edbdf](_0x7ad0('0x2d'));_0x4f2e9b[_0x5edbdf](_0x7ad0('0x2e'));if(queryQueues[_0x7ad0('0x2f')](_0x7ad0('0x30'))){delete queryQueues[_0x7ad0('0x30')];}_0x508c31[_0x7ad0('0x31')](db[_0x7ad0('0x32')][_0x7ad0('0x14')](queryQueues));_0x508c31['push'](db['ChatQueue'][_0x7ad0('0x14')](queryQueues));_0x508c31[_0x7ad0('0x31')](db[_0x7ad0('0x33')][_0x7ad0('0x14')](queryQueues));_0x508c31[_0x7ad0('0x31')](db[_0x7ad0('0x34')][_0x7ad0('0x14')](queryQueues));_0x508c31[_0x7ad0('0x31')](db[_0x7ad0('0x35')][_0x7ad0('0x14')](queryQueues));_0x508c31[_0x7ad0('0x31')](db[_0x7ad0('0x36')][_0x7ad0('0x14')](queryQueues));_0x508c31['push'](db[_0x7ad0('0x37')][_0x7ad0('0x14')](queryQueues));_0x508c31[_0x7ad0('0x31')](db[_0x7ad0('0x4')][_0x7ad0('0x14')](queryTelephones));_0x508c31[_0x7ad0('0x31')](db[_0x7ad0('0x38')][_0x7ad0('0x14')](queryTrunks));_0x508c31[_0x7ad0('0x31')](db[_0x7ad0('0x39')]['findAll'](queryCampaigns));_0x508c31[_0x7ad0('0x31')](db['User'][_0x7ad0('0x14')](queryAgents));break;case _0x7ad0('0x3a'):_0x4f2e9b[_0x5edbdf](_0x7ad0('0x2d'));_0x4f2e9b[_0x5edbdf]('voice:outbound');_0x508c31[_0x7ad0('0x31')](getAssociatedResources(_0x7ad0('0xd'),_0x8150f5[_0x7ad0('0x21')],_0x7ad0('0x32')));_0x508c31['push'](getAssociatedResources(_0x7ad0('0xe'),_0x8150f5['userProfileId'],'ChatQueue'));_0x508c31[_0x7ad0('0x31')](getAssociatedResources('FaxQueues',_0x8150f5['userProfileId'],_0x7ad0('0x33')));_0x508c31[_0x7ad0('0x31')](getAssociatedResources(_0x7ad0('0x10'),_0x8150f5[_0x7ad0('0x21')],_0x7ad0('0x34')));_0x508c31[_0x7ad0('0x31')](getAssociatedResources('MailQueues',_0x8150f5[_0x7ad0('0x21')],_0x7ad0('0x35')));_0x508c31[_0x7ad0('0x31')](getAssociatedResources('OpenchannelQueues',_0x8150f5[_0x7ad0('0x21')],_0x7ad0('0x36')));_0x508c31[_0x7ad0('0x31')](getAssociatedResources('WhatsappQueues',_0x8150f5[_0x7ad0('0x21')],_0x7ad0('0x37')));_0x508c31[_0x7ad0('0x31')](getAssociatedResources('Telephones',_0x8150f5['userProfileId'],_0x7ad0('0x4')));_0x508c31[_0x7ad0('0x31')](getAssociatedResources('Trunks',_0x8150f5['userProfileId'],_0x7ad0('0x38')));_0x508c31[_0x7ad0('0x31')](getAssociatedResources(_0x7ad0('0x16'),_0x8150f5[_0x7ad0('0x21')],'Campaign'));_0x508c31['push'](db['User'][_0x7ad0('0x14')](queryAgents));break;case _0x7ad0('0x7'):_0x4f2e9b[_0x5edbdf](_0x7ad0('0x2d'));_0x4f2e9b[_0x5edbdf](_0x7ad0('0x2e'));_0x508c31['push'](_0x8150f5[_0x7ad0('0x3b')]({'attributes':['id',_0x7ad0('0x5')]}));_0x508c31['push'](_0x8150f5['getChatQueues']({'attributes':['id',_0x7ad0('0x5')]}));_0x508c31['push'](_0x8150f5['getFaxQueues']({'attributes':['id',_0x7ad0('0x5')]}));_0x508c31[_0x7ad0('0x31')](_0x8150f5[_0x7ad0('0x3c')]({'attributes':['id',_0x7ad0('0x5')]}));_0x508c31[_0x7ad0('0x31')](_0x8150f5[_0x7ad0('0x3d')]({'attributes':['id',_0x7ad0('0x5')]}));_0x508c31['push'](_0x8150f5[_0x7ad0('0x3e')]({'attributes':['id','name']}));_0x508c31['push'](_0x8150f5[_0x7ad0('0x3f')]({'attributes':['id',_0x7ad0('0x5')]}));break;}return BPromise[_0x7ad0('0x40')](_0x508c31);}})[_0x7ad0('0xb')](function(_0xb32be5){if(_0xb32be5&&_0xb32be5[_0x7ad0('0x41')]){for(var _0x77b74d=0x0;_0x77b74d<_0xb32be5[_0x7ad0('0x41')];_0x77b74d+=0x1){for(var _0x4c7153=0x0;_0x4c7153<_0xb32be5[_0x77b74d][_0x7ad0('0x41')];_0x4c7153+=0x1){switch(_0x77b74d){case 0x0:joinOrLeaveQueues(_0x4f2e9b,_0x5edbdf,_0x7ad0('0x42'),_0xb32be5[_0x77b74d][_0x4c7153]);break;case 0x1:joinOrLeaveQueues(_0x4f2e9b,_0x5edbdf,_0x7ad0('0x43'),_0xb32be5[_0x77b74d][_0x4c7153]);break;case 0x2:joinOrLeaveQueues(_0x4f2e9b,_0x5edbdf,_0x7ad0('0x44'),_0xb32be5[_0x77b74d][_0x4c7153]);break;case 0x3:joinOrLeaveQueues(_0x4f2e9b,_0x5edbdf,_0x7ad0('0x45'),_0xb32be5[_0x77b74d][_0x4c7153]);break;case 0x4:joinOrLeaveQueues(_0x4f2e9b,_0x5edbdf,_0x7ad0('0x46'),_0xb32be5[_0x77b74d][_0x4c7153]);break;case 0x5:joinOrLeaveQueues(_0x4f2e9b,_0x5edbdf,_0x7ad0('0x47'),_0xb32be5[_0x77b74d][_0x4c7153]);break;case 0x6:joinOrLeaveQueues(_0x4f2e9b,_0x5edbdf,_0x7ad0('0x48'),_0xb32be5[_0x77b74d][_0x4c7153]);break;case 0x7:if(_0x1d9a26[_0x7ad0('0x6')]!==_0x7ad0('0x7'))_0x4f2e9b[_0x5edbdf](util['format']('telephone:%s',_0xb32be5[_0x77b74d][_0x4c7153][_0x7ad0('0x5')]));break;case 0x8:if(_0x1d9a26[_0x7ad0('0x6')]!==_0x7ad0('0x7'))_0x4f2e9b[_0x5edbdf](util[_0x7ad0('0x1b')](_0x7ad0('0x49'),_0xb32be5[_0x77b74d][_0x4c7153][_0x7ad0('0x5')]));break;case 0x9:if(_0x1d9a26[_0x7ad0('0x6')]!==_0x7ad0('0x7'))_0x4f2e9b[_0x5edbdf](util[_0x7ad0('0x1b')](_0x7ad0('0x4a'),_0xb32be5[_0x77b74d][_0x4c7153]['type'],_0xb32be5[_0x77b74d][_0x4c7153][_0x7ad0('0x5')]));break;case 0xa:_0x4f2e9b[_0x5edbdf](util[_0x7ad0('0x1b')](_0x7ad0('0x1e'),_0xb32be5[_0x77b74d][_0x4c7153]['name']));break;}}}}})[_0x7ad0('0xb')](function(){if(_0x5edbdf===_0x7ad0('0x4b')){var _0x696768=_[_0x7ad0('0x18')](_0x1d9a26[_0x7ad0('0x23')],'id');return _0x1d9a26[_0x7ad0('0x4c')](_0x696768)[_0x7ad0('0xb')](function(){for(var _0x5b7430=0x0;_0x5b7430<_0x696768[_0x7ad0('0x41')];_0x5b7430+=0x1){_0x4be2a0[_0x7ad0('0x4d')](_0x7ad0('0x4e'),{'ChatInteractionId':Number(_0x696768[_0x5b7430]),'UserId':Number(_0x1d9a26['id'])});}});}})['then'](function(){if(_0x5edbdf==='leave'){var _0x40d533=_[_0x7ad0('0x18')](_0x1d9a26[_0x7ad0('0x25')],'id');return _0x1d9a26[_0x7ad0('0x4f')](_0x40d533)[_0x7ad0('0xb')](function(){for(var _0x36418a=0x0;_0x36418a<_0x40d533[_0x7ad0('0x41')];_0x36418a+=0x1){_0x4be2a0[_0x7ad0('0x4d')](_0x7ad0('0x50'),{'MailInteractionId':Number(_0x40d533[_0x36418a]),'UserId':Number(_0x1d9a26['id'])});}});}})[_0x7ad0('0xb')](function(){if(_0x5edbdf==='leave'){var _0x35aa6c=_[_0x7ad0('0x18')](_0x1d9a26[_0x7ad0('0x27')],'id');return _0x1d9a26['removeFaxInteractions'](_0x35aa6c)[_0x7ad0('0xb')](function(){for(var _0x5545fc=0x0;_0x5545fc<_0x35aa6c['length'];_0x5545fc+=0x1){_0x4be2a0[_0x7ad0('0x4d')]('user_has_fax_interactions:remove',{'FaxInteractionId':Number(_0x35aa6c[_0x5545fc]),'UserId':Number(_0x1d9a26['id'])});}});}})['then'](function(){if(_0x5edbdf===_0x7ad0('0x4b')){var _0x284d5a=_[_0x7ad0('0x18')](_0x1d9a26[_0x7ad0('0x29')],'id');return _0x1d9a26['removeSmsInteractions'](_0x284d5a)[_0x7ad0('0xb')](function(){for(var _0x2b10df=0x0;_0x2b10df<_0x284d5a[_0x7ad0('0x41')];_0x2b10df+=0x1){_0x4be2a0[_0x7ad0('0x4d')](_0x7ad0('0x51'),{'SmsInteractionId':Number(_0x284d5a[_0x2b10df]),'UserId':Number(_0x1d9a26['id'])});}});}})[_0x7ad0('0xb')](function(){if(_0x5edbdf===_0x7ad0('0x4b')){var _0x527bb2=_['map'](_0x1d9a26[_0x7ad0('0x52')],'id');return _0x1d9a26[_0x7ad0('0x53')](_0x527bb2)[_0x7ad0('0xb')](function(){for(var _0x51329d=0x0;_0x51329d<_0x527bb2['length'];_0x51329d+=0x1){_0x4be2a0[_0x7ad0('0x4d')](_0x7ad0('0x54'),{'OpenchannelInteractionId':Number(_0x527bb2[_0x51329d]),'UserId':Number(_0x1d9a26['id'])});}});}})[_0x7ad0('0xb')](function(){if(_0x5edbdf==='leave'){var _0x54afe3=_[_0x7ad0('0x18')](_0x1d9a26[_0x7ad0('0x2b')],'id');return _0x1d9a26[_0x7ad0('0x55')](_0x54afe3)[_0x7ad0('0xb')](function(){for(var _0x2c657e=0x0;_0x2c657e<_0x54afe3['length'];_0x2c657e+=0x1){_0x4be2a0[_0x7ad0('0x4d')](_0x7ad0('0x56'),{'WhatsappInteractionId':Number(_0x54afe3[_0x2c657e]),'UserId':Number(_0x1d9a26['id'])});}});}})[_0x7ad0('0x57')](function(_0x189cdb){_0x4f2e9b['log'](_0x189cdb);});}}function onDisconnect(_0x234f99,_0x1b2609){joinOrLeave(_0x234f99,_0x7ad0('0x4b'),_0x1b2609);}function onConnect(_0x17f26a){joinOrLeave(_0x17f26a,_0x7ad0('0x58'));}exports['default']=function(_0x587e83){_0x587e83['on'](_0x7ad0('0x59'),function(_0xb90052){_0xb90052['setMaxListeners'](0x0);_0xb90052[_0x7ad0('0x5a')]=_0xb90052[_0x7ad0('0x5b')][_0x7ad0('0x59')][_0x7ad0('0x5c')]+':'+_0xb90052[_0x7ad0('0x5b')]['connection'][_0x7ad0('0x5d')];_0xb90052['connectedAt']=new Date();_0xb90052[_0x7ad0('0x5e')]=function(_0x31ac67){console[_0x7ad0('0x5e')](_0x7ad0('0x5f')+_0xb90052[_0x7ad0('0x60')][_0x7ad0('0x5')]+'['+_0xb90052[_0x7ad0('0x5a')]+']',_0x31ac67);};_0xb90052['on'](_0x7ad0('0x61'),function(){onDisconnect(_0xb90052,_0x587e83);_0xb90052['log'](_0x7ad0('0x62'));});onConnect(_0xb90052);_0xb90052[_0x7ad0('0x5e')]('CONNECTED');});}; \ No newline at end of file diff --git a/server/config/triggers/index.js b/server/config/triggers/index.js index afd5cce..b6d9480 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 _0xcd1a=['format','agent','AfterCreate','closed','changed','substatus','SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20','AfterUpdate','find','fullname','email','default','length','model','hook','condition','../../mysqldb','jayson/promise','../logger','triggers','Chat','ChatInteraction','afterCreate','newinteraction','afterUpdate','closedinteraction','ChatMessage','newmessage','ChatOfflineMessage','Sms','SmsInteraction','SmsMessage','Whatsapp','WhatsappInteraction','WhatsappMessage','Fax','FaxInteraction','FaxMessage','Mail','MailInteraction','OpenchannelInteraction','Openchannel','OpenchannelMessage','request','then','info','Trigger,\x20%s','EventManager','error','catch','get','channel','motionChannel','event','direction','resolve','ContactId','undefined','sequelize','query','Sequelize','QueryTypes','SELECT','contact','UserId','interface','SIP/%s','name','incomingmessage','outgoingmessage','AfterCreateMessage','offlineMessage','opened'];(function(_0x280438,_0x1a2b94){var _0x26c9d6=function(_0x1d369a){while(--_0x1d369a){_0x280438['push'](_0x280438['shift']());}};_0x26c9d6(++_0x1a2b94);}(_0xcd1a,0xeb));var _0xacd1=function(_0x599f41,_0x4db732){_0x599f41=_0x599f41-0x0;var _0x2e4d58=_0xcd1a[_0x599f41];return _0x2e4d58;};'use strict';var util=require('util');var db=require(_0xacd1('0x0'))['db'];var jayson=require(_0xacd1('0x1'));var logger=require(_0xacd1('0x2'))(_0xacd1('0x3'));var client=jayson['client']['http']({'port':0x232a});var triggers=[{'channel':_0xacd1('0x4'),'model':_0xacd1('0x5'),'event':_0xacd1('0x6'),'condition':_0xacd1('0x7'),'callback':afterCreate},{'channel':'Chat','model':_0xacd1('0x5'),'event':_0xacd1('0x8'),'condition':_0xacd1('0x9'),'callback':afterUpdate},{'channel':_0xacd1('0x4'),'model':_0xacd1('0xa'),'event':'afterCreate','condition':_0xacd1('0xb'),'callback':afterCreateMessage},{'channel':_0xacd1('0x4'),'model':_0xacd1('0xc'),'event':_0xacd1('0x6'),'condition':'newmessage','callback':afterCreateOfflineMessage},{'channel':_0xacd1('0xd'),'model':_0xacd1('0xe'),'event':_0xacd1('0x6'),'condition':_0xacd1('0x7'),'callback':afterCreate},{'channel':_0xacd1('0xd'),'model':_0xacd1('0xe'),'event':_0xacd1('0x8'),'condition':_0xacd1('0x9'),'callback':afterUpdate},{'channel':_0xacd1('0xd'),'model':_0xacd1('0xf'),'event':_0xacd1('0x6'),'condition':_0xacd1('0xb'),'callback':afterCreateMessage},{'channel':_0xacd1('0x10'),'model':_0xacd1('0x11'),'event':'afterCreate','condition':_0xacd1('0x7'),'callback':afterCreate},{'channel':_0xacd1('0x10'),'model':_0xacd1('0x11'),'event':'afterUpdate','condition':_0xacd1('0x9'),'callback':afterUpdate},{'channel':'Whatsapp','model':_0xacd1('0x12'),'event':_0xacd1('0x6'),'condition':_0xacd1('0xb'),'callback':afterCreateMessage},{'channel':_0xacd1('0x13'),'model':_0xacd1('0x14'),'event':_0xacd1('0x6'),'condition':'newinteraction','callback':afterCreate},{'channel':_0xacd1('0x13'),'model':_0xacd1('0x14'),'event':_0xacd1('0x8'),'condition':_0xacd1('0x9'),'callback':afterUpdate},{'channel':_0xacd1('0x13'),'model':_0xacd1('0x15'),'event':'afterCreate','condition':'newmessage','callback':afterCreateMessage},{'channel':_0xacd1('0x16'),'model':_0xacd1('0x17'),'event':_0xacd1('0x6'),'condition':_0xacd1('0x7'),'callback':afterCreate},{'channel':_0xacd1('0x16'),'model':_0xacd1('0x17'),'event':'afterUpdate','condition':_0xacd1('0x9'),'callback':afterUpdate},{'channel':_0xacd1('0x16'),'model':'MailMessage','event':_0xacd1('0x6'),'condition':_0xacd1('0xb'),'callback':afterCreateMessage},{'channel':'Openchannel','model':_0xacd1('0x18'),'event':_0xacd1('0x6'),'condition':_0xacd1('0x7'),'callback':afterCreate},{'channel':'Openchannel','model':_0xacd1('0x18'),'event':_0xacd1('0x8'),'condition':_0xacd1('0x9'),'callback':afterUpdate},{'channel':_0xacd1('0x19'),'model':_0xacd1('0x1a'),'event':_0xacd1('0x6'),'condition':_0xacd1('0xb'),'callback':afterCreateMessage}];function request(_0x1bebd3){return client[_0xacd1('0x1b')]('EventManager',_0x1bebd3)[_0xacd1('0x1c')](function(_0x18c068){logger[_0xacd1('0x1d')](_0xacd1('0x1e'),_0xacd1('0x1f'),_0x18c068);if(_0x18c068[_0xacd1('0x20')]){if(_0x18c068[_0xacd1('0x20')]['code']===0x1f4){logger[_0xacd1('0x20')](_0xacd1('0x1e'),_0xacd1('0x1f'),_0x18c068[_0xacd1('0x20')]);}}})[_0xacd1('0x21')](function(_0x22aff4){logger[_0xacd1('0x20')](_0xacd1('0x1e'),_0xacd1('0x1f'),_0x22aff4);});}function afterCreateMessage(_0x4e62ae){return function(_0x38585c){_0x38585c=_0x38585c[_0xacd1('0x22')]({'plain':!![]});_0x38585c[_0xacd1('0x23')]=_0x4e62ae;_0x38585c[_0xacd1('0x24')]=_0x4e62ae;_0x38585c[_0xacd1('0x25')]=_0x38585c[_0xacd1('0x26')];Promise[_0xacd1('0x27')]()[_0xacd1('0x1c')](function(){if(typeof _0x38585c[_0xacd1('0x28')]===_0xacd1('0x29'))return null;var _0x2df061='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x38585c[_0xacd1('0x28')];return db[_0xacd1('0x2a')][_0xacd1('0x2b')](_0x2df061,{'type':db[_0xacd1('0x2c')][_0xacd1('0x2d')][_0xacd1('0x2e')],'raw':!![]});})['then'](function(_0x422045){if(_0x422045){_0x38585c[_0xacd1('0x2f')]=_0x422045[0x0];}if(typeof _0x38585c['UserId']===_0xacd1('0x29'))return;return getAgent(_0x38585c[_0xacd1('0x30')]);})[_0xacd1('0x1c')](function(_0x53e18e){if(_0x53e18e){_0x38585c[_0xacd1('0x31')]=util['format'](_0xacd1('0x32'),_0x53e18e[_0xacd1('0x33')]);_0x38585c['agent']=_0x53e18e;_0x38585c[_0xacd1('0x23')]=_0x4e62ae;return request({'event':_0xacd1('0x34'),'message':_0x38585c});}else{return request({'event':_0xacd1('0x35'),'message':_0x38585c});}})['catch'](function(_0x4bb1a5){logger[_0xacd1('0x20')]('Trigger,\x20%s',_0xacd1('0x36'),_0x4bb1a5);});};}function afterCreateOfflineMessage(_0x127eed){return function(_0xf598be){_0xf598be=_0xf598be['get']({'plain':!![]});_0xf598be[_0xacd1('0x23')]=_0x127eed;_0xf598be[_0xacd1('0x24')]=_0x127eed;_0xf598be[_0xacd1('0x25')]=_0xacd1('0x37');return request({'event':_0xf598be[_0xacd1('0x25')],'message':_0xf598be});};}function afterCreate(_0x423306,_0x256c8c){return function(_0x370191){_0x370191=_0x370191[_0xacd1('0x22')]({'plain':!![]});_0x370191[_0xacd1('0x23')]=_0x423306;_0x370191[_0xacd1('0x24')]=_0x423306;_0x370191[_0xacd1('0x25')]=_0xacd1('0x38');Promise[_0xacd1('0x27')]()[_0xacd1('0x1c')](function(){var _0x4a074d='SELECT\x20*\x20FROM\x20cm_contacts\x20WHERE\x20id\x20=\x20'+_0x370191['ContactId'];return db[_0xacd1('0x2a')][_0xacd1('0x2b')](_0x4a074d,{'type':db[_0xacd1('0x2c')]['QueryTypes'][_0xacd1('0x2e')],'raw':!![]});})[_0xacd1('0x1c')](function(_0x44f24a){if(_0x44f24a){_0x370191[_0xacd1('0x2f')]=_0x44f24a[0x0];}if(typeof _0x370191[_0xacd1('0x30')]==='undefined')return;return getAgent(_0x370191[_0xacd1('0x30')]);})['then'](function(_0x2b9b92){if(_0x2b9b92){_0x370191['interface']=util[_0xacd1('0x39')](_0xacd1('0x32'),_0x2b9b92['name']);_0x370191[_0xacd1('0x3a')]=_0x2b9b92;}return request({'event':_0x256c8c,'message':_0x370191});})[_0xacd1('0x21')](function(_0x497c7c){logger[_0xacd1('0x20')](_0xacd1('0x1e'),_0xacd1('0x3b'),_0x497c7c);});};}function afterUpdate(_0x2c83ea){return function(_0x3e2255){var _0x5b3513=_0x3e2255['changed']('closed')&&_0x3e2255[_0xacd1('0x3c')];var _0x229cef=_0x3e2255[_0xacd1('0x3d')](_0xacd1('0x3e'));if(_0x5b3513||_0x229cef){var _0x419610=_0x5b3513?_0xacd1('0x9'):_0xacd1('0x3e');var _0x568dc1=_0x3e2255[_0xacd1('0x22')]({'plain':!![]});_0x568dc1[_0xacd1('0x23')]=_0x2c83ea;_0x568dc1[_0xacd1('0x24')]=_0x2c83ea;_0x568dc1['event']=_0x5b3513?_0xacd1('0x3c'):_0xacd1('0x3e');var _0x511b1d=_0xacd1('0x3f')+_0x568dc1['ContactId'];return db[_0xacd1('0x2a')]['query'](_0x511b1d,{'type':db[_0xacd1('0x2c')][_0xacd1('0x2d')]['SELECT'],'raw':!![]})[_0xacd1('0x1c')](function(_0x1630a9){if(_0x1630a9){_0x568dc1['contact']=_0x1630a9[0x0];}if(typeof _0x568dc1[_0xacd1('0x30')]===_0xacd1('0x29'))return;return getAgent(_0x568dc1[_0xacd1('0x30')]);})[_0xacd1('0x1c')](function(_0x58b8a7){if(_0x58b8a7){_0x568dc1['interface']=util['format']('SIP/%s',_0x58b8a7[_0xacd1('0x33')]);_0x568dc1['agent']=_0x58b8a7;}return request({'event':_0x419610,'message':_0x568dc1});})['catch'](function(_0x289ed6){logger[_0xacd1('0x20')]('Trigger,\x20%s',_0xacd1('0x40'),_0x289ed6);});}};}function getAgent(_0x367803){return db['User'][_0xacd1('0x41')]({'where':{'id':_0x367803},'attributes':['id',_0xacd1('0x33'),_0xacd1('0x42'),_0xacd1('0x43'),'internal'],'raw':!![]})['then'](function(_0x114e93){return _0x114e93;});}exports[_0xacd1('0x44')]=function(){for(var _0x2af150=0x0;_0x2af150=_0x39f597['agents']){throw Error('Maximum\x20login\x20has\x20been\x20reached');}_0x3b5170(_0x401836);})['catch'](function(_0x3f3440){_0x10c084(_0x3f3440);});});}; \ No newline at end of file +var _0x5092=['toLowerCase','includes','isUndefined','blockedAt','updateAttributes','getLicense','role','agent','User','count','then','agents','Maximum\x20login\x20has\x20been\x20reached','catch','lodash','../mysqldb','voice','chat','fax','sms','whatsapp','openchannel','getChannels','isValidChannel'];(function(_0x40be9d,_0x9294ce){var _0x4fb656=function(_0x4cd05e){while(--_0x4cd05e){_0x40be9d['push'](_0x40be9d['shift']());}};_0x4fb656(++_0x9294ce);}(_0x5092,0x18e));var _0x2509=function(_0x1df477,_0x5363e1){_0x1df477=_0x1df477-0x0;var _0x302bff=_0x5092[_0x1df477];return _0x302bff;};'use strict';var _=require(_0x2509('0x0'));var BPromise=require('bluebird');var db=require(_0x2509('0x1'))['db'];var util=require('./license/util');var channels=[_0x2509('0x2'),'mail',_0x2509('0x3'),_0x2509('0x4'),_0x2509('0x5'),_0x2509('0x6'),_0x2509('0x7')];exports[_0x2509('0x8')]=function(){return channels;};exports[_0x2509('0x9')]=function(_0x368883){_0x368883=_0x368883[_0x2509('0xa')]();return _[_0x2509('0xb')](channels,_0x368883);};exports['clearBlockUser']=function(_0x9cbf25,_0x98cd82,_0x6276b5,_0x12a867){var _0x362fd7={'loginAttempts':_0x98cd82,'blocked':_0x6276b5};if(!_[_0x2509('0xc')](_0x12a867)){_0x362fd7[_0x2509('0xd')]=_0x12a867;}return _0x9cbf25[_0x2509('0xe')](_0x362fd7);};exports[_0x2509('0xf')]=function(_0xcdd53f){return new BPromise(function(_0x229e16,_0xf53cfc){var _0x283f7b=0x0;if(_0xcdd53f[_0x2509('0x10')]!==_0x2509('0x11')){_0x229e16(_0xcdd53f);}db[_0x2509('0x12')][_0x2509('0x13')]({'where':{'role':_0x2509('0x11'),'online':!![],'id':{'$ne':_0xcdd53f['id']}}})[_0x2509('0x14')](function(_0x5b35b3){_0x283f7b=_0x5b35b3;return util[_0x2509('0xf')]();})[_0x2509('0x14')](function(_0x1543f1){if(_0x1543f1&&_0x1543f1[_0x2509('0x15')]&&_0x283f7b>=_0x1543f1[_0x2509('0x15')]){throw Error(_0x2509('0x16'));}_0x229e16(_0xcdd53f);})[_0x2509('0x17')](function(_0x860b7e){_0xf53cfc(_0x860b7e);});});}; \ No newline at end of file diff --git a/server/errors/api.js b/server/errors/api.js index 03a708f..e38114f 100644 --- a/server/errors/api.js +++ b/server/errors/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['message','name','Error','inherits','Bad\x20Request','Entity\x20not\x20found','Forbidden','OutOfInterval','Not\x20Found','status','send','util','../config/logger','api'];(function(_0x41e0a3,_0x1d6101){var _0x31afca=function(_0x2e7f26){while(--_0x2e7f26){_0x41e0a3['push'](_0x41e0a3['shift']());}};_0x31afca(++_0x1d6101);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2576d7,_0x167624){_0x2576d7=_0x2576d7-0x0;var _0x16a08c=_0xa9e0[_0x2576d7];return _0x16a08c;};'use strict';var util=require(_0x0a9e('0x0'));var logger=require(_0x0a9e('0x1'))(_0x0a9e('0x2'));var APIError=function(_0x5dd881,_0x550fbc){this[_0x0a9e('0x3')]=_0x5dd881||'Internal\x20Server\x20Error';this[_0x0a9e('0x4')]=_0x550fbc||_0x0a9e('0x5');util[_0x0a9e('0x6')](APIError,Error);};var APIBadRequestError=function(_0x991246){this[_0x0a9e('0x3')]=_0x991246||'Bad\x20Request';this[_0x0a9e('0x4')]=_0x0a9e('0x7');util[_0x0a9e('0x6')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x5f41ea){this['message']=_0x5f41ea||_0x0a9e('0x8');this['name']='Not\x20Found';util[_0x0a9e('0x6')](APINotFoundError,APIError);};function getStatusCode(_0xf81284){switch(_0xf81284){case _0x0a9e('0x7'):return 0x190;case _0x0a9e('0x9'),_0x0a9e('0xa'):return 0x193;case _0x0a9e('0xb'):return 0x194;default:return 0x1f4;}}function handleError(_0x4a4c56){return function(_0x50dfb2){logger['error'](_0x50dfb2['stack']);var _0x273d4d=getStatusCode(_0x50dfb2[_0x0a9e('0x4')]);if(_0x50dfb2[_0x0a9e('0x4')])delete _0x50dfb2[_0x0a9e('0x4')];return _0x4a4c56[_0x0a9e('0xc')](_0x273d4d)[_0x0a9e('0xd')](_0x50dfb2);};}module['exports']={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file +var _0xda3f=['inherits','message','Bad\x20Request','Entity\x20not\x20found','name','Not\x20Found','Forbidden','OutOfInterval','error','stack','send','exports','../config/logger','api','Internal\x20Server\x20Error','Error'];(function(_0x41179d,_0xafc087){var _0xb4d26c=function(_0x419fbf){while(--_0x419fbf){_0x41179d['push'](_0x41179d['shift']());}};_0xb4d26c(++_0xafc087);}(_0xda3f,0xec));var _0xfda3=function(_0x2d4185,_0xcaf731){_0x2d4185=_0x2d4185-0x0;var _0x23f544=_0xda3f[_0x2d4185];return _0x23f544;};'use strict';var util=require('util');var logger=require(_0xfda3('0x0'))(_0xfda3('0x1'));var APIError=function(_0x534697,_0x5299b0){this['message']=_0x534697||_0xfda3('0x2');this['name']=_0x5299b0||_0xfda3('0x3');util[_0xfda3('0x4')](APIError,Error);};var APIBadRequestError=function(_0x516500){this[_0xfda3('0x5')]=_0x516500||_0xfda3('0x6');this['name']='Bad\x20Request';util[_0xfda3('0x4')](APIBadRequestError,APIError);};var APINotFoundError=function(_0x42476a){this[_0xfda3('0x5')]=_0x42476a||_0xfda3('0x7');this[_0xfda3('0x8')]=_0xfda3('0x9');util[_0xfda3('0x4')](APINotFoundError,APIError);};function getStatusCode(_0x1b1ea6){switch(_0x1b1ea6){case _0xfda3('0x6'):return 0x190;case _0xfda3('0xa'),_0xfda3('0xb'):return 0x193;case _0xfda3('0x9'):return 0x194;default:return 0x1f4;}}function handleError(_0x4d7841){return function(_0xe933f5){logger[_0xfda3('0xc')](_0xe933f5[_0xfda3('0xd')]);var _0x11afc1=getStatusCode(_0xe933f5[_0xfda3('0x8')]);if(_0xe933f5['name'])delete _0xe933f5[_0xfda3('0x8')];return _0x4d7841['status'](_0x11afc1)[_0xfda3('0xe')](_0xe933f5);};}module[_0xfda3('0xf')]={'APIError':APIError,'APIBadRequestError':APIBadRequestError,'APINotFoundError':APINotFoundError,'handleError':handleError}; \ No newline at end of file diff --git a/server/errors/index.js b/server/errors/index.js index 001da9f..3b29e3b 100644 --- a/server/errors/index.js +++ b/server/errors/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd20f=['json','send','status','render'];(function(_0xe4c521,_0x20a061){var _0x3cafa0=function(_0x25711a){while(--_0x25711a){_0xe4c521['push'](_0xe4c521['shift']());}};_0x3cafa0(++_0x20a061);}(_0xd20f,0x172));var _0xfd20=function(_0x4fa745,_0x25d32e){_0x4fa745=_0x4fa745-0x0;var _0x1243e0=_0xd20f[_0x4fa745];return _0x1243e0;};'use strict';module['exports'][0x194]=function pageNotFound(_0x1d2553,_0x2f5d3d){var _0x1e91cc='404';var _0x54e8ab=0x194;var _0x29ad21={'status':_0x54e8ab};_0x2f5d3d[_0xfd20('0x0')](_0x29ad21[_0xfd20('0x0')]);_0x2f5d3d[_0xfd20('0x1')](_0x1e91cc,{},function(_0x444b32,_0x8db5a8){if(_0x444b32){return _0x2f5d3d[_0xfd20('0x0')](_0x29ad21[_0xfd20('0x0')])[_0xfd20('0x2')](_0x29ad21);}_0x2f5d3d[_0xfd20('0x3')](_0x8db5a8);});}; \ No newline at end of file +var _0x62e4=['404','status','render','json','send','exports'];(function(_0x46bb99,_0x589545){var _0x575ff8=function(_0x2f75d0){while(--_0x2f75d0){_0x46bb99['push'](_0x46bb99['shift']());}};_0x575ff8(++_0x589545);}(_0x62e4,0x12b));var _0x462e=function(_0x44955b,_0x577032){_0x44955b=_0x44955b-0x0;var _0x562312=_0x62e4[_0x44955b];return _0x562312;};'use strict';module[_0x462e('0x0')][0x194]=function pageNotFound(_0x39be6e,_0x1a138f){var _0x5eb559=_0x462e('0x1');var _0x2fc60d=0x194;var _0x2618c5={'status':_0x2fc60d};_0x1a138f[_0x462e('0x2')](_0x2618c5[_0x462e('0x2')]);_0x1a138f[_0x462e('0x3')](_0x5eb559,{},function(_0x1d95f9,_0x3d42){if(_0x1d95f9){return _0x1a138f['status'](_0x2618c5['status'])[_0x462e('0x4')](_0x2618c5);}_0x1a138f[_0x462e('0x5')](_0x3d42);});}; \ No newline at end of file diff --git a/server/mysqldb/index.js b/server/mysqldb/index.js index 63c4216..78dc651 100644 --- a/server/mysqldb/index.js +++ b/server/mysqldb/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x3dc68d,_0x1c1951){var _0xdf7f94=function(_0x339428){while(--_0x339428){_0x3dc68d['push'](_0x3dc68d['shift']());}};_0xdf7f94(++_0x1c1951);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2763f2,_0x416af8){_0x2763f2=_0x2763f2-0x0;var _0x3ef471=_0xa9e0[_0x2763f2];return _0x3ef471;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file +var _0xa9e0=['SquareRecording','../api/squareRecording/squareRecording.model','SquareMessage','../api/squareMessage/squareMessage.model','License','Migration','../api/migration/migration.model','Attachment','../api/attachment/attachment.model','Plugin','../api/plugin/plugin.model','ChatTransferReport','../api/chatTransferReport/chatTransferReport.model','FaxTransferReport','../api/faxTransferReport/faxTransferReport.model','OpenchannelTransferReport','../api/openchannelTransferReport/openchannelTransferReport.model','SmsTransferReport','../api/smsTransferReport/smsTransferReport.model','../api/cmList/cmList.model','VoicePrefix','UserProfile','UserProfileSection','UserProfileResource','UserNotification','../api/userNotification/userNotification.model','WhatsappAccount','../api/whatsappAccount/whatsappAccount.model','WhatsappApplication','../api/whatsappApplication/whatsappApplication.model','WhatsappInteraction','../api/whatsappInteraction/whatsappInteraction.model','WhatsappMessage','WhatsappQueueReport','../api/whatsappQueueReport/whatsappQueueReport.model','../api/whatsappTransferReport/whatsappTransferReport.model','WhatsappQueue','../api/whatsappQueue/whatsappQueue.model','CloudProvider','../api/cloudProvider/cloudProvider.model','TeamVoiceQueue','../api/teamVoiceQueue/teamVoiceQueue.model','TeamVoicePrefix','../api/teamVoicePrefix/teamVoicePrefix.model','UserVoicePrefix','../api/userVoicePrefix/userVoicePrefix.model','hasOne','VoiceMail','userSetting','cascade','UserId','hasMany','VoiceRecording','Recordings','VoiceQueuesRt','Extensions','HopperFinals','CmHopperHistory','HopperHistory','OpenchannelInteractions','ChatInteractions','SmsInteractions','FaxInteraction','MailInteraction','MailInteractions','WhatsappInteractions','UserNotifications','SenderId','belongsToMany','Groups','chat_group_has_users','CmContact','Contacts','cm_user_has_contacts','Lists','cm_user_has_lists','Team','user_has_teams','user_has_mail_interactions','FaxInteractions','user_has_fax_interactions','user_has_sms_interactions','user_has_openchannel_interactions','user_has_whatsapp_interactions','VoiceQueues','VoicePrefixes','ChatQueues','UserChatQueue','FaxQueues','SmsQueues','OpenchannelQueue','WhatsappQueues','CmList','ChatWebsites','user_has_chat_websites','user_has_fax_accounts','MailAccounts','user_has_mail_accounts','OpenchannelAccounts','user_has_openchannel_accounts','SmsAccounts','user_has_sms_accounts','WhatsappAccounts','user_has_whatsapp_accounts','ChanSpyId','VoiceContext','Applications','Sounds','moh_has_sounds','Members','VoiceQueueId','Hoppers','HopperBlacks','JscriptySessions','TrunkId','belongsTo','TrunkBackup','TrunkBackupId','IntervalId','mandatoryDispositionPauseId','Teams','BlackLists','voice_queues_has_cm_blacklists','Messages','mailbox','mailboxuser','VoiceCallReport','QueueCalls','uniqueid','VoiceAgentReport','AgentReports','Contact','MailAccountId','CloudProviderId','MailServerOut','restrict','Imap','Smtp','Disposition','Dispositions','Answers','Interactions','MailApplication','List','ListId','TemplateId','mandatoryDispositionPause','Agents','team_has_mail_queues','ContactId','mail_interaction_has_tags','Tags','ThroughTags','Users','MailInteractionId','Attachments','Interaction','ChatWebsiteId','Interval','MailQueueReport','Dashboard','CannedAnswer','FaxAccountId','Exntensions','TagId','FaxInteractionId','Account','Owner','fax_interaction_has_tags','AttachmentId','team_has_fax_queues','SmsAccountId','SmsInteractionId','sms_interaction_has_tags','SmsQueueId','team_has_sms_queues','OpenchannelAccountId','OpenchannelQueueId','OpenchannelInteractionId','team_has_openchannel_queues','ChatProactiveAction','ProactiveActions','Agent','Queue','ChatQueueId','Website','ChatInteractionId','chat_interaction_has_tags','user_has_chat_interactions','ChatOfflineMessageId','team_has_chat_queues','ChatGroupId','CmContactId','HopperHistories','CmCompany','Company','cm_contact_has_tags','CmHopperAdditionalPhone','AdditionalPhones','CmHopperId','Campaign','OwnerId','CampaignId','All','OneAll','OneAny','Actions','ParentId','Intervals','MailApplications','ChatApplications','FaxApplications','SmsApplications','DefaultReportId','CustomReportId','openchannel_interaction_has_tags','whatsapp_interaction_has_tags','CmContactHasItem','ItemType','ItemTypeId','Hopper','AllConditions','AllCondition','TriggerAllId','AnyConditions','AnyCondition','TriggerAnyId','AnalyticCustomReport','Fields','MetricId','Configurations','Subjects','DescriptionId','FieldId','AccountId','Subject','SubjectId','Description','Field','SugarcrmField','Descriptions','VariableId','DeskAccount','ZendeskConfiguration','int_zendesk_configuration_has_tags','FreshdeskAccount','FreshdeskConfiguration','int_freshdesk_configuration_has_tags','VtigerAccount','ServicenowField','ToId','JscriptyQuestionReport','JscriptyProject','ProjectId','MailQueues','OpenchannelQueues','team_has_whatsapp_queues','SquareProjectId','campaigns_has_cm_lists','campaigns_has_cm_blacklists','MailTransferReport','FromMailAccountId','FromAccount','FromAgent','ToUserId','ToAgent','ToMailAccountId','ToAccount','FromChatWebsiteId','FromUserId','ToChatQueueId','ToChatWebsiteId','FromFaxAccountId','ToFaxQueueId','ToQueue','FromSmsAccountId','CmCustomField','CustomFields','voice_queues_has_cm_lists','userProfileId','UserProfileSections','Resources','sectionId','WhatsappAccountId','WhatsappInteractionId','WhatsappTransferReport','FromWhatsappAccountId','ToWhatsappAccountId','ToQueueId','UserSetting','user','../config/environment','sequelize','lodash','motion2','xcall','xC@LL1234','127.0.0.1','utf8mb4','name','utf8','defaultsDeep','mysql','username','password','options','database','sequelizeHistory','User','import','VoiceChanSpy','../api/voiceChanSpy/voiceChanSpy.model','../api/voiceContext/voiceContext.model','VoiceExtension','../api/voiceExtension/voiceExtension.model','VoiceMusicOnHold','../api/voiceMusicOnHold/voiceMusicOnHold.model','VoiceQueue','../api/voiceQueue/voiceQueue.model','ScreenRecording','../api/screenRecording/screenRecording.model','../api/voiceMail/voiceMail.model','VoiceMailMessage','../api/voiceMailMessage/voiceMailMessage.model','../api/voiceCallReport/voiceCallReport.model','VoiceDialReport','../api/voiceDialReport/voiceDialReport.model','../api/voiceAgentReport/voiceAgentReport.model','VoiceQueueReport','../api/voiceQueueReport/voiceQueueReport.model','MemberReport','Trunk','../api/trunk/trunk.model','../api/voiceTransferReport/voiceTransferReport.model','UserVoiceQueueRt','../api/userVoiceQueueRt/userVoiceQueueRt.model','UserVoiceQueue','../api/userVoiceQueue/userVoiceQueue.model','../api/userChatQueue/userChatQueue.model','UserMailQueue','../api/userMailQueue/userMailQueue.model','UserFaxQueue','../api/userFaxQueue/userFaxQueue.model','UserSmsQueue','UserOpenchannelQueue','../api/userOpenchannelQueue/userOpenchannelQueue.model','UserWhatsappQueue','../api/userWhatsappQueue/userWhatsappQueue.model','MailServerIn','../api/mailServerOut/mailServerOut.model','MailAccount','MailQueue','MailSubstatus','MailMessage','../api/mailMessage/mailMessage.model','../api/mailApplication/mailApplication.model','../api/mailQueueReport/mailQueueReport.model','../api/dashboard/dashboard.model','DashboardItem','../api/dashboardItem/dashboardItem.model','FaxAccount','../api/faxAccount/faxAccount.model','FaxApplication','../api/faxApplication/faxApplication.model','../api/faxInteraction/faxInteraction.model','FaxMessage','../api/faxMessage/faxMessage.model','FaxQueue','../api/faxQueue/faxQueue.model','FaxQueueReport','../api/faxQueueReport/faxQueueReport.model','SmsAccount','../api/smsAccount/smsAccount.model','SmsApplication','SmsInteraction','../api/smsInteraction/smsInteraction.model','SmsMessage','../api/smsMessage/smsMessage.model','SmsQueue','../api/smsQueue/smsQueue.model','OpenchannelAccount','../api/openchannelAccount/openchannelAccount.model','OpenchannelApplication','../api/openchannelApplication/openchannelApplication.model','OpenchannelInteraction','OpenchannelMessage','../api/openchannelQueue/openchannelQueue.model','ChatWebsite','../api/chatWebsite/chatWebsite.model','OpenchannelQueueReport','ChatApplication','ChatInteraction','ChatMessage','ChatOfflineMessage','ChatQueue','ChatGroup','../api/chatGroup/chatGroup.model','../api/chatProactiveAction/chatProactiveAction.model','../api/cmCompany/cmCompany.model','../api/cmContact/cmContact.model','CmHopper','../api/cmHopper/cmHopper.model','CmHopperBlack','../api/cmHopperBlack/cmHopperBlack.model','CmHopperFinal','../api/cmHopperFinal/cmHopperFinal.model','ReportAgentPreview','Action','../api/action/action.model','Automation','../api/automation/automation.model','../api/cannedAnswer/cannedAnswer.model','../api/disposition/disposition.model','Condition','../api/condition/condition.model','../api/interval/interval.model','Pause','../api/pause/pause.model','Cdr','../api/cdr/cdr.model','../api/voiceQueuesLog/voiceQueuesLog.model','Schedule','../api/schedule/schedule.model','Sound','../api/sound/sound.model','Tag','../api/tag/tag.model','ContactItemType','../api/contactItemType/contactItemType.model','../api/cmContactHasItem/cmContactHasItem.model','Template','../api/template/template.model','Trigger','Variable','../api/variable/variable.model','Integration','../api/integration/integration.model','../api/integrationReport/integrationReport.model','../api/analyticCustomReport/analyticCustomReport.model','AnalyticDefaultReport','../api/analyticDefaultReport/analyticDefaultReport.model','AnalyticExtractedReport','../api/analyticExtractedReport/analyticExtractedReport.model','AnalyticMetric','AnalyticFieldReport','../api/analyticFieldReport/analyticFieldReport.model','../api/analyticTreeReport/analyticTreeReport.model','SalesforceAccount','../api/intSalesforceAccount/intSalesforceAccount.model','SalesforceConfiguration','../api/intSalesforceConfiguration/intSalesforceConfiguration.model','SalesforceField','SugarcrmAccount','SugarcrmConfiguration','../api/intSugarcrmConfiguration/intSugarcrmConfiguration.model','../api/intSugarcrmField/intSugarcrmField.model','../api/intDeskAccount/intDeskAccount.model','DeskConfiguration','../api/intDeskConfiguration/intDeskConfiguration.model','DeskField','../api/intDeskField/intDeskField.model','ZohoAccount','../api/intZohoAccount/intZohoAccount.model','ZohoConfiguration','../api/intZohoConfiguration/intZohoConfiguration.model','ZohoField','ZendeskAccount','../api/intZendeskAccount/intZendeskAccount.model','../api/intZendeskConfiguration/intZendeskConfiguration.model','ZendeskField','../api/intZendeskField/intZendeskField.model','../api/intFreshdeskConfiguration/intFreshdeskConfiguration.model','FreshdeskField','../api/intFreshdeskField/intFreshdeskField.model','../api/intVtigerAccount/intVtigerAccount.model','VtigerConfiguration','VtigerField','ServicenowAccount','../api/intServicenowAccount/intServicenowAccount.model','ServicenowConfiguration','../api/intServicenowConfiguration/intServicenowConfiguration.model','Dynamics365Account','Dynamics365Configuration','../api/intDynamics365Configuration/intDynamics365Configuration.model','Dynamics365Field','../api/intDynamics365Field/intDynamics365Field.model','FreshsalesAccount','../api/intFreshsalesAccount/intFreshsalesAccount.model','FreshsalesConfiguration','../api/intFreshsalesConfiguration/intFreshsalesConfiguration.model','FreshsalesField','../api/intFreshsalesField/intFreshsalesField.model','../api/network/network.model','ChatQueueReport','../api/chatQueueReport/chatQueueReport.model','ChatInternalMessage','JscriptyAnswerReport','../api/jscriptyAnswerReport/jscriptyAnswerReport.model','../api/jscriptyQuestionReport/jscriptyQuestionReport.model','JscriptySessionReport','../api/jscriptySessionReport/jscriptySessionReport.model','SmsQueueReport','../api/smsQueueReport/smsQueueReport.model','SquareReport','../api/squareReport/squareReport.model','SquareDetailsReport','../api/squareReportDetail/squareReportDetail.model','../api/jscriptyProject/jscriptyProject.model','Setting','../api/setting/setting.model','../api/squareOdbc/squareOdbc.model','SquareProject'];(function(_0x5a79e2,_0x319b1a){var _0x266c45=function(_0x172478){while(--_0x172478){_0x5a79e2['push'](_0x5a79e2['shift']());}};_0x266c45(++_0x319b1a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xa9e0[_0x298ed3];return _0x5aad28;};'use strict';var config=require(_0x0a9e('0x0'));var Sequelize=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var jstz=require('jstz');var timezone=jstz['determine']();config[_0x0a9e('0x1')]=_['defaultsDeep'](config[_0x0a9e('0x1')],{'database':_0x0a9e('0x3'),'username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':'mysql','dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':_0x0a9e('0x9'),'collate':'utf8_general_ci'}}});config['sequelizeHistory']=_[_0x0a9e('0xa')](config['sequelizeHistory'],{'database':'motion2','username':_0x0a9e('0x4'),'password':_0x0a9e('0x5'),'options':{'host':_0x0a9e('0x6'),'port':0xcea,'dialect':_0x0a9e('0xb'),'dialectOptions':{'charset':_0x0a9e('0x7')},'logging':![],'timezone':timezone[_0x0a9e('0x8')](),'define':{'charset':'utf8','collate':'utf8_general_ci'}}});var db={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelize']['database'],config[_0x0a9e('0x1')][_0x0a9e('0xc')],config[_0x0a9e('0x1')][_0x0a9e('0xd')],config[_0x0a9e('0x1')][_0x0a9e('0xe')])};var dbH={'Sequelize':Sequelize,'sequelize':new Sequelize(config['sequelizeHistory'][_0x0a9e('0xf')],config[_0x0a9e('0x10')][_0x0a9e('0xc')],config[_0x0a9e('0x10')][_0x0a9e('0xd')],config[_0x0a9e('0x10')]['options'])};db[_0x0a9e('0x11')]=db['sequelize'][_0x0a9e('0x12')]('../api/user/user.model');db[_0x0a9e('0x13')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x14'));db['VoiceContext']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x15'));db[_0x0a9e('0x16')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x17'));db[_0x0a9e('0x18')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x19'));db[_0x0a9e('0x1a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x1b'));db['VoiceRecording']=db[_0x0a9e('0x1')]['import']('../api/voiceRecording/voiceRecording.model');db[_0x0a9e('0x1c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1d'));db['VoiceMail']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x1e'));db[_0x0a9e('0x1f')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x20'));db['VoiceCallReport']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x21'));db[_0x0a9e('0x22')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x23'));db['VoiceAgentReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x24'));db[_0x0a9e('0x25')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x26'));db[_0x0a9e('0x27')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/memberReport/memberReport.model');db[_0x0a9e('0x28')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x29'));db['VoiceTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2a'));db[_0x0a9e('0x2b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2c'));db[_0x0a9e('0x2d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x2e'));db['UserChatQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x2f'));db[_0x0a9e('0x30')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x31'));db[_0x0a9e('0x32')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x33'));db[_0x0a9e('0x34')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userSmsQueue/userSmsQueue.model');db[_0x0a9e('0x35')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x36'));db[_0x0a9e('0x37')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x38'));db[_0x0a9e('0x39')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailServerIn/mailServerIn.model');db['MailServerOut']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x3a'));db[_0x0a9e('0x3b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailAccount/mailAccount.model');db[_0x0a9e('0x3c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailQueue/mailQueue.model');db[_0x0a9e('0x3d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailSubstatus/mailSubstatus.model');db['MailInteraction']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailInteraction/mailInteraction.model');db[_0x0a9e('0x3e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x3f'));db['MailApplication']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x40'));db['MailQueueReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x41'));db['Dashboard']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x42'));db[_0x0a9e('0x43')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x44'));db[_0x0a9e('0x45')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x46'));db[_0x0a9e('0x47')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x48'));db['FaxInteraction']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x49'));db[_0x0a9e('0x4a')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4b'));db[_0x0a9e('0x4c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x4d'));db[_0x0a9e('0x4e')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x4f'));db[_0x0a9e('0x50')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x51'));db[_0x0a9e('0x52')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/smsApplication/smsApplication.model');db[_0x0a9e('0x53')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x54'));db[_0x0a9e('0x55')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x56'));db[_0x0a9e('0x57')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x58'));db[_0x0a9e('0x59')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x5a'));db[_0x0a9e('0x5b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5c'));db[_0x0a9e('0x5d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/openchannelInteraction/openchannelInteraction.model');db[_0x0a9e('0x5e')]=db[_0x0a9e('0x1')]['import']('../api/openchannelMessage/openchannelMessage.model');db['OpenchannelQueue']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x5f'));db[_0x0a9e('0x60')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x61'));db[_0x0a9e('0x62')]=db['sequelize']['import']('../api/openchannelQueueReport/openchannelQueueReport.model');db[_0x0a9e('0x63')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatApplication/chatApplication.model');db[_0x0a9e('0x64')]=db[_0x0a9e('0x1')]['import']('../api/chatInteraction/chatInteraction.model');db[_0x0a9e('0x65')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatMessage/chatMessage.model');db[_0x0a9e('0x66')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/chatOfflineMessage/chatOfflineMessage.model');db[_0x0a9e('0x67')]=db[_0x0a9e('0x1')]['import']('../api/chatQueue/chatQueue.model');db[_0x0a9e('0x68')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x69'));db['ChatProactiveAction']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x6a'));db['CmCompany']=db['sequelize']['import'](_0x0a9e('0x6b'));db['CmContact']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6c'));db[_0x0a9e('0x6d')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x6e'));db[_0x0a9e('0x6f')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x70'));db[_0x0a9e('0x71')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x72'));db['CmHopperHistory']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperHistory/cmHopperHistory.model');db[_0x0a9e('0x73')]=db['sequelize'][_0x0a9e('0x12')]('../api/reportAgentPreview/reportAgentPreview.model');db['CmCustomField']=db['sequelize'][_0x0a9e('0x12')]('../api/cmCustomField/cmCustomField.model');db[_0x0a9e('0x74')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x75'));db[_0x0a9e('0x76')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x77'));db['CannedAnswer']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x78'));db['Disposition']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x79'));db[_0x0a9e('0x7a')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x7b'));db['Interval']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x7c'));db[_0x0a9e('0x7d')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x7e'));db[_0x0a9e('0x7f')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x80'));db['VoiceQueuesLog']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x81'));db[_0x0a9e('0x82')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x83'));db[_0x0a9e('0x84')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x85'));db[_0x0a9e('0x86')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x87'));db[_0x0a9e('0x88')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x89'));db['CmContactHasItem']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8a'));db['CmHopperAdditionalPhone']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.model');db[_0x0a9e('0x8b')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8c'));db[_0x0a9e('0x8d')]=db['sequelize']['import']('../api/trigger/trigger.model');db[_0x0a9e('0x8e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x8f'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['IntegrationReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x92'));db['AnalyticCustomReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x93'));db[_0x0a9e('0x94')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x95'));db[_0x0a9e('0x96')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x97'));db[_0x0a9e('0x98')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/analyticMetric/analyticMetric.model');db[_0x0a9e('0x99')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9a'));db['AnalyticTreeReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9b'));db[_0x0a9e('0x9c')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9d'));db[_0x0a9e('0x9e')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x9f'));db[_0x0a9e('0xa0')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSalesforceField/intSalesforceField.model');db[_0x0a9e('0xa1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intSugarcrmAccount/intSugarcrmAccount.model');db[_0x0a9e('0xa2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa3'));db['SugarcrmField']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa4'));db['DeskAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xa5'));db[_0x0a9e('0xa6')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xa7'));db[_0x0a9e('0xa8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xa9'));db[_0x0a9e('0xaa')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xab'));db[_0x0a9e('0xac')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xad'));db[_0x0a9e('0xae')]=db['sequelize'][_0x0a9e('0x12')]('../api/intZohoField/intZohoField.model');db[_0x0a9e('0xaf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb0'));db['ZendeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb1'));db[_0x0a9e('0xb2')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb3'));db['FreshdeskAccount']=db['sequelize'][_0x0a9e('0x12')]('../api/intFreshdeskAccount/intFreshdeskAccount.model');db['FreshdeskConfiguration']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xb4'));db[_0x0a9e('0xb5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xb6'));db['VtigerAccount']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xb7'));db[_0x0a9e('0xb8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerConfiguration/intVtigerConfiguration.model');db[_0x0a9e('0xb9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intVtigerField/intVtigerField.model');db[_0x0a9e('0xba')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbb'));db[_0x0a9e('0xbc')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xbd'));db['ServicenowField']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intServicenowField/intServicenowField.model');db[_0x0a9e('0xbe')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/intDynamics365Account/intDynamics365Account.model');db[_0x0a9e('0xbf')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xc0'));db[_0x0a9e('0xc1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc2'));db[_0x0a9e('0xc3')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xc4'));db[_0x0a9e('0xc5')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc6'));db[_0x0a9e('0xc7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc8'));db[_0x0a9e('0x90')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x91'));db['Network']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xc9'));db[_0x0a9e('0xca')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcb'));db[_0x0a9e('0xcc')]=db['sequelize'][_0x0a9e('0x12')]('../api/chatInternalMessage/chatInternalMessage.model');db[_0x0a9e('0xcd')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xce'));db['JscriptyQuestionReport']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xcf'));db[_0x0a9e('0xd0')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xd1'));db[_0x0a9e('0xd2')]=db['sequelize']['import'](_0x0a9e('0xd3'));db[_0x0a9e('0xd4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd5'));db[_0x0a9e('0xd6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xd7'));db['JscriptyProject']=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xd8'));db[_0x0a9e('0xd9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xda'));db['SquareOdbc']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xdb'));db[_0x0a9e('0xdc')]=db[_0x0a9e('0x1')]['import']('../api/squareProject/squareProject.model');db[_0x0a9e('0xdd')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xde'));db[_0x0a9e('0xdf')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe0'));db['Team']=db['sequelize'][_0x0a9e('0x12')]('../api/team/team.model');db[_0x0a9e('0xe1')]=db['sequelize'][_0x0a9e('0x12')]('../api/license/license.model');db['Campaign']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/campaign/campaign.model');db[_0x0a9e('0xe2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe3'));db[_0x0a9e('0xe4')]=db['sequelize']['import'](_0x0a9e('0xe5'));db[_0x0a9e('0xe6')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe7'));db['MailTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/mailTransferReport/mailTransferReport.model');db[_0x0a9e('0xe8')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xe9'));db[_0x0a9e('0xea')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xeb'));db[_0x0a9e('0xec')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0xed'));db[_0x0a9e('0xee')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xef'));db['CmList']=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf0'));db[_0x0a9e('0xf1')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/voicePrefix/voicePrefix.model');db[_0x0a9e('0xf2')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfile/userProfile.model');db[_0x0a9e('0xf3')]=db['sequelize'][_0x0a9e('0x12')]('../api/userProfileSection/userProfileSection.model');db[_0x0a9e('0xf4')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/userProfileResource/userProfileResource.model');db[_0x0a9e('0xf5')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xf6'));db[_0x0a9e('0xf7')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xf8'));db[_0x0a9e('0xf9')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfa'));db[_0x0a9e('0xfb')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0xfc'));db[_0x0a9e('0xfd')]=db[_0x0a9e('0x1')]['import']('../api/whatsappMessage/whatsappMessage.model');db[_0x0a9e('0xfe')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0xff'));db['WhatsappTransferReport']=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x100'));db[_0x0a9e('0x101')]=db['sequelize'][_0x0a9e('0x12')](_0x0a9e('0x102'));db[_0x0a9e('0x103')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x104'));db[_0x0a9e('0x105')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x106'));db[_0x0a9e('0x107')]=db[_0x0a9e('0x1')]['import'](_0x0a9e('0x108'));db[_0x0a9e('0x109')]=db[_0x0a9e('0x1')][_0x0a9e('0x12')](_0x0a9e('0x10a'));db['UserSetting']=db[_0x0a9e('0x1')][_0x0a9e('0x12')]('../api/user-setting/user-setting.model');db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db[_0x0a9e('0x10c')],{'as':'VoiceMail','onDelete':'cascade','foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x10b')](db['UserSetting'],{'as':_0x0a9e('0x10d'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x111')],{'as':_0x0a9e('0x112'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x113'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x117'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x118'),'foreignKey':_0x0a9e('0x10f')});db['User'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x11a'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xfb')],{'as':_0x0a9e('0x11e'),'foreignKey':'UserId'});db[_0x0a9e('0x11')][_0x0a9e('0x110')](db[_0x0a9e('0xf5')],{'as':_0x0a9e('0x11f'),'foreignKey':_0x0a9e('0x120')});db[_0x0a9e('0x11')]['belongsTo'](db[_0x0a9e('0xf2')],{'as':'UserProfile','foreignKey':'userProfileId'});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x68')],{'as':_0x0a9e('0x122'),'through':_0x0a9e('0x123')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x125'),'through':_0x0a9e('0x126')});db[_0x0a9e('0x11')]['belongsToMany'](db['CmList'],{'as':_0x0a9e('0x127'),'through':_0x0a9e('0x128')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x12a')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x11d'),'through':_0x0a9e('0x12b')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'through':'user_has_chat_interactions'});db['User']['belongsToMany'](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x12c'),'through':_0x0a9e('0x12d')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x53')],{'as':'SmsInteractions','through':_0x0a9e('0x12e')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'as':_0x0a9e('0x118'),'through':_0x0a9e('0x12f')});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0xfb')],{'as':'WhatsappInteractions','through':_0x0a9e('0x130')});db['User'][_0x0a9e('0x121')](db['VoiceQueue'],{'as':_0x0a9e('0x131'),'through':_0x0a9e('0x2d'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0xf1')],{'as':_0x0a9e('0x132'),'through':_0x0a9e('0x109'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x3c')],{'as':'MailQueues','through':_0x0a9e('0x30'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x133'),'through':_0x0a9e('0x134'),'required':![],'hooks':!![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x4c')],{'as':_0x0a9e('0x135'),'through':_0x0a9e('0x32'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'as':_0x0a9e('0x136'),'through':_0x0a9e('0x34'),'required':![]});db[_0x0a9e('0x11')]['belongsToMany'](db[_0x0a9e('0x137')],{'as':'OpenchannelQueues','through':_0x0a9e('0x35'),'required':![]});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'as':_0x0a9e('0x138'),'through':_0x0a9e('0x37'),'required':![]});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'through':_0x0a9e('0x128')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x13a'),'through':_0x0a9e('0x13b')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x45')],{'as':'FaxAccounts','through':_0x0a9e('0x13c')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x13d'),'through':_0x0a9e('0x13e')});db[_0x0a9e('0x11')]['belongsToMany'](db['OpenchannelAccount'],{'as':_0x0a9e('0x13f'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x11')][_0x0a9e('0x121')](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x141'),'through':_0x0a9e('0x142')});db['User'][_0x0a9e('0x121')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x143'),'through':_0x0a9e('0x144')});db[_0x0a9e('0x13')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':'SpiedAgents','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x145')});db[_0x0a9e('0x146')]['hasMany'](db[_0x0a9e('0x16')],{'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x16')][_0x0a9e('0x110')](db['VoiceExtension'],{'as':_0x0a9e('0x147'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x18')][_0x0a9e('0x121')](db[_0x0a9e('0x84')],{'as':_0x0a9e('0x148'),'through':_0x0a9e('0x149')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x2b')],{'as':_0x0a9e('0x14a'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db['CmHopper'],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':'VoiceQueueId'});db[_0x0a9e('0x1a')]['hasMany'](db[_0x0a9e('0x116')],{'as':'HopperHistories','foreignKey':'VoiceQueueId'});db['VoiceQueue'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db['CmHopperBlack'],{'as':_0x0a9e('0x14d'),'foreignKey':_0x0a9e('0x14b')});db[_0x0a9e('0x1a')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':_0x0a9e('0x14e'),'foreignKey':_0x0a9e('0x14b')});db['VoiceQueue']['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a')][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':_0x0a9e('0x151'),'foreignKey':_0x0a9e('0x152')});db['VoiceQueue'][_0x0a9e('0x150')](db['Interval'],{'as':'Interval','foreignKey':_0x0a9e('0x153')});db['VoiceQueue'][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db['VoiceQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x127'),'through':'voice_queues_has_cm_lists'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':'UserVoiceQueue'});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'as':_0x0a9e('0x155'),'through':_0x0a9e('0x105')});db[_0x0a9e('0x1a')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x157')});db['VoiceRecording']['belongsTo'](db['User'],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x1c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x10c')]['hasMany'](db['VoiceMailMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'mailboxuser','sourceKey':_0x0a9e('0x159')});db[_0x0a9e('0x1f')][_0x0a9e('0x150')](db[_0x0a9e('0x10c')],{'foreignKey':_0x0a9e('0x15a'),'targetKey':_0x0a9e('0x159')});db[_0x0a9e('0x15b')][_0x0a9e('0x110')](db[_0x0a9e('0x25')],{'as':_0x0a9e('0x15c'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')]['hasMany'](db[_0x0a9e('0x15e')],{'as':_0x0a9e('0x15f'),'foreignKey':_0x0a9e('0x15d'),'constraints':![]});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x15b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db['MailServerIn'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x39')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':'CloudProvider','foreignKey':_0x0a9e('0x162'),'onDelete':'restrict'});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x163')][_0x0a9e('0x150')](db[_0x0a9e('0x103')],{'as':_0x0a9e('0x103'),'foreignKey':_0x0a9e('0x162'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x3b')][_0x0a9e('0x10b')](db[_0x0a9e('0x39')],{'as':_0x0a9e('0x165'),'onDelete':_0x0a9e('0x10e')});db['MailAccount']['hasOne'](db[_0x0a9e('0x163')],{'as':_0x0a9e('0x166'),'onDelete':'cascade'});db['MailAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'MailAccountId','onDelete':_0x0a9e('0x10e')});db['MailAccount'][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':'MailAccountId'});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x3e')],{'as':'Messages','foreignKey':_0x0a9e('0x161')});db['MailAccount']['hasMany'](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x3b')][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x161'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x3b')][_0x0a9e('0x150')](db[_0x0a9e('0x8b')],{'as':_0x0a9e('0x8b'),'foreignKey':_0x0a9e('0x16e')});db[_0x0a9e('0x3b')]['belongsTo'](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x3b')]['belongsToMany'](db['User'],{'as':'Agents','through':_0x0a9e('0x13e')});db['MailQueue'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x30')});db[_0x0a9e('0x3c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x11c')]['hasMany'](db[_0x0a9e('0x3e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':'MailInteractionId'});db[_0x0a9e('0x11c')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x11c')]['belongsTo'](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11c')]['belongsTo'](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x173'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x11c')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12b'),'foreignKey':_0x0a9e('0x177')});db[_0x0a9e('0x3e')]['hasMany'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0x178'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':'User'});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x3e')][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{'as':_0x0a9e('0x179'),'foreignKey':'MailInteractionId'});db['MailMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'as':'Account','foreignKey':_0x0a9e('0x161')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x60')],{'as':'ChatWebsite','foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x3e')]['belongsTo'](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':'ChatOfflineMessageId'});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x16b')]['belongsTo'](db[_0x0a9e('0x3b')],{'onDelete':_0x0a9e('0x164')});db['MailApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x16b')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':'TagId'});db['MailQueueReport']['belongsTo'](db['MailAccount'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':_0x0a9e('0x16d')});db['MailQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailInteraction'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db['MailMessage'],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x17c')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{});db[_0x0a9e('0x17d')]['hasMany'](db[_0x0a9e('0x43')],{'as':'Items','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')]['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':'Answers','foreignKey':_0x0a9e('0x17f')});db['FaxAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x147'),'foreignKey':'FaxAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x45')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x180'),'onDelete':'cascade'});db[_0x0a9e('0x45')]['hasMany'](db['FaxMessage'],{'as':_0x0a9e('0x158')});db['FaxAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x28')],{'as':'Trunk'});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x45')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':'mandatoryDispositionPauseId'});db[_0x0a9e('0x45')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_fax_accounts'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'restrict'});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x4c')],{'onDelete':'restrict'});db[_0x0a9e('0x47')]['belongsTo'](db[_0x0a9e('0x45')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x47')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['FaxInteraction'][_0x0a9e('0x110')](db[_0x0a9e('0x4a')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x11b')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':'fax_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x185'),'as':'ThroughTags'});db[_0x0a9e('0x11b')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x12d'),'foreignKey':_0x0a9e('0x182')});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x11')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{'as':_0x0a9e('0x179'),'foreignKey':'FaxInteractionId'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':'Contact'});db[_0x0a9e('0x4a')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['FaxMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'as':'Account','foreignKey':_0x0a9e('0x17f')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db['User'],{'as':'Agents','through':_0x0a9e('0x32')});db[_0x0a9e('0x4c')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x187'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['FaxAccount'],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxInteraction'],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x4a')],{});db[_0x0a9e('0x4e')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['FaxQueueReport'][_0x0a9e('0x150')](db['FaxQueue'],{});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x188'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db['SmsMessage'],{'as':_0x0a9e('0x158'),'foreignKey':_0x0a9e('0x188')});db['SmsAccount']['hasMany'](db[_0x0a9e('0x53')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x50')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x147'),'foreignKey':'SmsAccountId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x50')][_0x0a9e('0x150')](db['Pause'],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x50')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x142')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db['User'],{'onDelete':_0x0a9e('0x164')});db['SmsApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{'onDelete':_0x0a9e('0x164')});db['SmsApplication']['belongsTo'](db[_0x0a9e('0x50')],{'onDelete':'restrict'});db[_0x0a9e('0x52')]['belongsTo'](db['Interval'],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x52')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x53')][_0x0a9e('0x110')](db[_0x0a9e('0x55')],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x189')});db['SmsInteraction']['belongsTo'](db[_0x0a9e('0x50')],{'as':'Account','foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x53')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'sms_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x53')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x18a'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x53')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Users','through':_0x0a9e('0x12e'),'foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x55')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{'onDelete':'cascade','as':'Interaction','foreignKey':_0x0a9e('0x189')});db[_0x0a9e('0x55')]['belongsTo'](db[_0x0a9e('0x50')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x188')});db[_0x0a9e('0x57')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x34'),'foreignKey':_0x0a9e('0x18b')});db[_0x0a9e('0x57')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x155')});db[_0x0a9e('0x59')]['hasMany'](db['Disposition'],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x59')][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':_0x0a9e('0x16a'),'foreignKey':'OpenchannelAccountId'});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','foreignKey':_0x0a9e('0x18d')});db['OpenchannelAccount'][_0x0a9e('0x110')](db[_0x0a9e('0x5b')],{'as':'Applications','foreignKey':_0x0a9e('0x18d'),'onDelete':_0x0a9e('0x10e')});db['OpenchannelAccount'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x59')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0x59')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x140')});db[_0x0a9e('0x5b')]['belongsTo'](db['User'],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db['OpenchannelQueue'],{'onDelete':'restrict','foreignKey':_0x0a9e('0x18e')});db['OpenchannelApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x5b')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x153')});db['OpenchannelApplication']['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x5d')][_0x0a9e('0x110')](db[_0x0a9e('0x5e')],{'as':'Messages','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x18f')});db[_0x0a9e('0x5d')]['belongsTo'](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db['OpenchannelInteraction'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x5d')][_0x0a9e('0x150')](db['User'],{'as':'Owner','foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x174')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db['Tag'],{'through':'openchannel_interaction_has_tags','as':_0x0a9e('0x175')});db[_0x0a9e('0x5d')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':'user_has_openchannel_interactions','foreignKey':_0x0a9e('0x18f')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160')});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0x5d')],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x179'),'foreignKey':'OpenchannelInteractionId'});db[_0x0a9e('0x5e')]['belongsTo'](db[_0x0a9e('0xe4')],{'as':_0x0a9e('0xe4'),'foreignKey':_0x0a9e('0x186')});db['OpenchannelMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x18d')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x35'),'foreignKey':_0x0a9e('0x18e')});db[_0x0a9e('0x137')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x155')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x17e')],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x17a')});db['ChatWebsite'][_0x0a9e('0x110')](db[_0x0a9e('0x191')],{'as':_0x0a9e('0x192')});db[_0x0a9e('0x60')]['hasMany'](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x16a')});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x63')],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x17a'),'onDelete':'cascade'});db[_0x0a9e('0x60')][_0x0a9e('0x110')](db[_0x0a9e('0x65')],{'as':_0x0a9e('0x158')});db['ChatWebsite'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x60')][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db['ChatWebsite'][_0x0a9e('0x150')](db['MailAccount'],{'as':_0x0a9e('0x3b'),'foreignKey':_0x0a9e('0x161')});db['ChatWebsite'][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':_0x0a9e('0x16f'),'foreignKey':_0x0a9e('0x154')});db['ChatWebsite'][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x13b')});db['OpenchannelQueueReport']['belongsTo'](db['OpenchannelAccount'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x5d')],{});db['OpenchannelQueueReport'][_0x0a9e('0x150')](db['OpenchannelMessage'],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0x62')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{});db['ChatApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x193'),'foreignKey':'UserId','onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{'as':_0x0a9e('0x194'),'foreignKey':_0x0a9e('0x195'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':_0x0a9e('0x17a'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x63')][_0x0a9e('0x150')](db[_0x0a9e('0x86')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x181')});db[_0x0a9e('0x64')][_0x0a9e('0x110')](db['ChatMessage'],{'as':_0x0a9e('0x158'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x64')]['belongsTo'](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x64')]['belongsTo'](db['User'],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x174')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x198'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x64')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x199'),'foreignKey':_0x0a9e('0x197')});db['ChatMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':'cascade','as':_0x0a9e('0x11')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':'Contact','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x197')});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0xe4')],{'as':'Attachment','foreignKey':'AttachmentId'});db[_0x0a9e('0x65')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x17a')});db[_0x0a9e('0x66')][_0x0a9e('0x110')](db['Attachment'],{'as':_0x0a9e('0x178'),'foreignKey':_0x0a9e('0x19a'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['ChatOfflineMessage']['belongsTo'](db['CmContact'],{'onDelete':_0x0a9e('0x10e'),'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0x66')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':'Account','foreignKey':'ChatWebsiteId'});db[_0x0a9e('0x67')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserChatQueue','hooks':!![]});db[_0x0a9e('0x67')]['belongsToMany'](db['Team'],{'through':_0x0a9e('0x19b'),'as':'Teams'});db[_0x0a9e('0x68')][_0x0a9e('0x110')](db[_0x0a9e('0xcc')],{'as':'Messages','foreignKey':_0x0a9e('0x19c'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x68')]['belongsToMany'](db['User'],{'as':_0x0a9e('0x14a'),'through':_0x0a9e('0x123')});db[_0x0a9e('0x191')][_0x0a9e('0x150')](db[_0x0a9e('0x60')],{'as':_0x0a9e('0x196'),'foreignKey':'ChatWebsiteId'});db['CmCompany'][_0x0a9e('0x110')](db[_0x0a9e('0x124')],{'as':'Contacts','foreignKey':'CompanyId'});db['CmContact']['hasMany'](db['CmContactHasItem'],{'as':'Phones','foreignKey':_0x0a9e('0x19d')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':'HopperFinals','foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'as':'JscriptySessions','foreignKey':_0x0a9e('0x172')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x5d')],{'as':'OpenchannelInteractions','foreignKey':'ContactId','onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db[_0x0a9e('0x64')],{'as':_0x0a9e('0x119'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db['CmContact'][_0x0a9e('0x110')](db['SmsInteraction'],{'as':'SmsInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db[_0x0a9e('0x11b')],{'as':'FaxInteractions','foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x124')][_0x0a9e('0x110')](db['MailInteraction'],{'as':_0x0a9e('0x11d'),'foreignKey':_0x0a9e('0x172'),'onDelete':'restrict'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x19f')],{'as':_0x0a9e('0x1a0'),'foreignKey':'CompanyId'});db[_0x0a9e('0x124')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':'cascade'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db['User'],{'as':_0x0a9e('0x176'),'through':'cm_user_has_contacts'});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'as':_0x0a9e('0x174'),'through':_0x0a9e('0x1a1')});db[_0x0a9e('0x124')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1a1'),'as':_0x0a9e('0x175')});db[_0x0a9e('0x6d')][_0x0a9e('0x110')](db[_0x0a9e('0x1a2')],{'as':_0x0a9e('0x1a3'),'foreignKey':_0x0a9e('0x1a4')});db['CmHopper'][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':'List','foreignKey':'ListId','onDelete':'cascade'});db['CmHopper'][_0x0a9e('0x150')](db['User'],{'as':'Agent','foreignKey':'UserId'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':_0x0a9e('0x194'),'foreignKey':'VoiceQueueId','onDelete':'cascade'});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':'CampaignId','onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6d')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x1a6')});db['CmHopperBlack'][_0x0a9e('0x150')](db['CmContact'],{'as':'Contact','foreignKey':_0x0a9e('0x172'),'onDelete':'cascade'});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x6f')][_0x0a9e('0x150')](db[_0x0a9e('0x1a')],{'as':'Queue','foreignKey':_0x0a9e('0x14b'),'onDelete':_0x0a9e('0x10e')});db['CmHopperBlack'][_0x0a9e('0x150')](db[_0x0a9e('0x1a5')],{'as':_0x0a9e('0x1a5'),'foreignKey':_0x0a9e('0x1a7'),'onDelete':'cascade'});db[_0x0a9e('0x76')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1a8'),'singular':_0x0a9e('0x1a9')},'foreignKey':'AutomationAllId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x76')]['hasMany'](db[_0x0a9e('0x7a')],{'as':{'plural':'Any','singular':_0x0a9e('0x1aa')},'foreignKey':'AutomationAnyId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db['Automation'][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'AutomationId','onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x167')]['hasMany'](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1ac'),'onDelete':'cascade'});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db['Interval'],{'as':_0x0a9e('0x1ad'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x10e'),'hooks':!![],'required':![]});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'foreignKey':_0x0a9e('0x153'),'onDelete':_0x0a9e('0x164')});db['Interval'][_0x0a9e('0x110')](db[_0x0a9e('0x16b')],{'as':_0x0a9e('0x1ae'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')]['hasMany'](db['ChatApplication'],{'as':_0x0a9e('0x1af'),'foreignKey':'IntervalId'});db[_0x0a9e('0x17b')]['hasMany'](db[_0x0a9e('0x47')],{'as':_0x0a9e('0x1b0'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x17b')][_0x0a9e('0x110')](db[_0x0a9e('0x52')],{'as':_0x0a9e('0x1b1'),'foreignKey':'IntervalId'});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{});db['Schedule'][_0x0a9e('0x150')](db[_0x0a9e('0x94')],{'foreignKey':_0x0a9e('0x1b2')});db['Schedule']['belongsTo'](db['AnalyticCustomReport'],{'foreignKey':_0x0a9e('0x1b3')});db[_0x0a9e('0x84')][_0x0a9e('0x121')](db[_0x0a9e('0x18')],{'as':'Mohs','through':_0x0a9e('0x149'),'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0x124')],{'through':'cm_contact_has_tags'});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x64')],{'through':'chat_interaction_has_tags'});db['Tag'][_0x0a9e('0x121')](db['MailInteraction'],{'through':_0x0a9e('0x173')});db['Tag'][_0x0a9e('0x121')](db[_0x0a9e('0x53')],{'through':_0x0a9e('0x18a')});db['Tag']['belongsToMany'](db[_0x0a9e('0x11b')],{'through':_0x0a9e('0x185')});db[_0x0a9e('0x86')][_0x0a9e('0x121')](db['OpenchannelInteraction'],{'through':_0x0a9e('0x1b4')});db[_0x0a9e('0x86')]['belongsToMany'](db[_0x0a9e('0xfb')],{'through':_0x0a9e('0x1b5')});db[_0x0a9e('0x1b6')]['belongsTo'](db[_0x0a9e('0x88')],{'as':_0x0a9e('0x1b7'),'foreignKey':_0x0a9e('0x1b8')});db[_0x0a9e('0x1a2')][_0x0a9e('0x150')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x1b9'),'foreignKey':_0x0a9e('0x1a4')});db[_0x0a9e('0x1b6')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x19d')});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x7a')],{'as':{'plural':_0x0a9e('0x1ba'),'singular':_0x0a9e('0x1bb')},'foreignKey':_0x0a9e('0x1bc'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db['Condition'],{'as':{'plural':_0x0a9e('0x1bd'),'singular':_0x0a9e('0x1be')},'foreignKey':_0x0a9e('0x1bf'),'onDelete':'cascade','hooks':!![]});db[_0x0a9e('0x8d')][_0x0a9e('0x110')](db[_0x0a9e('0x74')],{'as':_0x0a9e('0x1ab'),'foreignKey':'TriggerId','onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x1c0')]['hasMany'](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'CustomReportId','hooks':!![]});db['AnalyticDefaultReport'][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':'DefaultReportId'});db[_0x0a9e('0x98')][_0x0a9e('0x110')](db[_0x0a9e('0x99')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c2')});db['AnalyticFieldReport']['belongsTo'](db[_0x0a9e('0x98')],{'foreignKey':_0x0a9e('0x1c2')});db[_0x0a9e('0x9c')]['hasMany'](db[_0x0a9e('0x9e')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['SalesforceConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c4'),'onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0x9e')]['hasMany'](db['SalesforceField'],{'as':'Descriptions','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x9e')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db['SalesforceConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x9c')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa0')][_0x0a9e('0x110')](db['SalesforceField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa0')]['hasMany'](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['SalesforceField'][_0x0a9e('0x110')](db[_0x0a9e('0xa0')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa0')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xa1')][_0x0a9e('0x110')](db[_0x0a9e('0xa2')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa2')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa2')][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['SugarcrmConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0xa1')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['SugarcrmField']['hasMany'](db['SugarcrmField'],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db['SugarcrmField'][_0x0a9e('0x110')](db[_0x0a9e('0x1cc')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1cc')]['hasMany'](db[_0x0a9e('0x1cc')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['SugarcrmField'][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1cf')]['hasMany'](db[_0x0a9e('0xa6')],{'as':'Configurations','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xa6')]['hasMany'](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'DescriptionId'});db['DeskConfiguration']['hasMany'](db['DeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':'FieldId'});db[_0x0a9e('0xa6')][_0x0a9e('0x150')](db[_0x0a9e('0x1cf')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xa6')]['belongsToMany'](db[_0x0a9e('0x86')],{'through':'int_desk_configuration_has_tags'});db['DeskField'][_0x0a9e('0x110')](db['DeskField'],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xa8')][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['DeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xa8')],{'as':'Field','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xa8')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xaa')][_0x0a9e('0x110')](db[_0x0a9e('0xac')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Subjects','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xac')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cd'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c5')});db['ZohoConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c1'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xac')][_0x0a9e('0x150')](db[_0x0a9e('0xaa')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1c8'),'foreignKey':'SubjectId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':'Description','foreignKey':'DescriptionId'});db[_0x0a9e('0xae')][_0x0a9e('0x110')](db[_0x0a9e('0xae')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xae')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xaf')][_0x0a9e('0x110')](db['ZendeskConfiguration'],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':'AccountId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d0')]['hasMany'](db[_0x0a9e('0xb2')],{'as':'Descriptions','foreignKey':'DescriptionId'});db['ZendeskConfiguration'][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Fields','foreignKey':'FieldId'});db[_0x0a9e('0x1d0')][_0x0a9e('0x150')](db[_0x0a9e('0xaf')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0x1d0')]['belongsToMany'](db['Tag'],{'through':_0x0a9e('0x1d1')});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db['ZendeskField'],{'as':'Subject','foreignKey':'SubjectId'});db[_0x0a9e('0xb2')][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['ZendeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb2')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb2')][_0x0a9e('0x150')](db['Variable'],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d2')][_0x0a9e('0x110')](db[_0x0a9e('0x1d3')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1c4'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d3')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d3')]['hasMany'](db['FreshdeskField'],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db['FreshdeskConfiguration'][_0x0a9e('0x150')](db[_0x0a9e('0x1d2')],{'as':'Account','foreignKey':_0x0a9e('0x1c7')});db['FreshdeskConfiguration'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1d4')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xb5')][_0x0a9e('0x110')](db['FreshdeskField'],{'as':'Description','foreignKey':'DescriptionId'});db['FreshdeskField'][_0x0a9e('0x110')](db[_0x0a9e('0xb5')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb5')]['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0x1d5')]['hasMany'](db[_0x0a9e('0xb8')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xb8')]['hasMany'](db[_0x0a9e('0xb9')],{'as':_0x0a9e('0x1c4'),'foreignKey':_0x0a9e('0x1c9')});db['VtigerConfiguration'][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb8')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Fields','foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb8')][_0x0a9e('0x150')](db[_0x0a9e('0x1d5')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db[_0x0a9e('0xb9')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db['VtigerField']['hasMany'](db[_0x0a9e('0xb9')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xb9')][_0x0a9e('0x110')](db['VtigerField'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xb9')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db[_0x0a9e('0xba')]['hasMany'](db[_0x0a9e('0xbc')],{'as':_0x0a9e('0x1c3'),'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbc')]['hasMany'](db['ServicenowField'],{'as':_0x0a9e('0x1c4'),'foreignKey':'SubjectId'});db[_0x0a9e('0xbc')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cd'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xbc')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c1'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbc')][_0x0a9e('0x150')](db[_0x0a9e('0xba')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['ServicenowField'][_0x0a9e('0x110')](db[_0x0a9e('0x1d6')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0x1d6')]['hasMany'](db[_0x0a9e('0x1d6')],{'as':'Description','foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0x1d6')][_0x0a9e('0x110')](db['ServicenowField'],{'as':_0x0a9e('0x1cb'),'foreignKey':'FieldId'});db[_0x0a9e('0x1d6')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':'VariableId'});db[_0x0a9e('0xbe')]['hasMany'](db[_0x0a9e('0xbf')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xbe')][_0x0a9e('0x150')](db['CloudProvider'],{'as':_0x0a9e('0x103'),'foreignKey':'CloudProviderId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':'Subjects','onDelete':'cascade','foreignKey':'SubjectId'});db[_0x0a9e('0xbf')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1cd'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c5')});db['Dynamics365Configuration'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':'Fields','onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xbf')][_0x0a9e('0x150')](db[_0x0a9e('0xbe')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1c7')});db['Dynamics365Field'][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1c8'),'foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db[_0x0a9e('0xc1')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db[_0x0a9e('0xc1')][_0x0a9e('0x110')](db['Dynamics365Field'],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db[_0x0a9e('0xc1')][_0x0a9e('0x150')](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['FreshsalesAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xc5')],{'as':_0x0a9e('0x1c3'),'onDelete':'cascade','foreignKey':_0x0a9e('0x1c7')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db['FreshsalesField'],{'as':'Subjects','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc5')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cd'),'foreignKey':'DescriptionId'});db[_0x0a9e('0xc5')]['hasMany'](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1c1'),'foreignKey':'FieldId'});db[_0x0a9e('0xc5')]['belongsTo'](db[_0x0a9e('0xc3')],{'as':_0x0a9e('0x183'),'foreignKey':'AccountId'});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':'Subject','foreignKey':_0x0a9e('0x1c9')});db[_0x0a9e('0xc7')][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1ca'),'foreignKey':_0x0a9e('0x1c5')});db['FreshsalesField'][_0x0a9e('0x110')](db[_0x0a9e('0xc7')],{'as':_0x0a9e('0x1cb'),'foreignKey':_0x0a9e('0x1c6')});db['FreshsalesField']['belongsTo'](db[_0x0a9e('0x8e')],{'as':_0x0a9e('0x8e'),'foreignKey':_0x0a9e('0x1ce')});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x60')],{});db['ChatQueueReport']['belongsTo'](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':'ListId'});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x64')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xca')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db['ChatQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x67')],{});db['ChatInternalMessage']['belongsTo'](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':'FromId'});db['ChatInternalMessage'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x10e'),'foreignKey':_0x0a9e('0x1d7')});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0x1d8')],{'foreignKey':'SessionId','onDelete':'cascade'});db[_0x0a9e('0xd0')]['hasMany'](db[_0x0a9e('0xcd')],{'foreignKey':'SessionId','onDelete':_0x0a9e('0x10e')});db['SmsQueueReport']['belongsTo'](db[_0x0a9e('0x50')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmList'],{'as':'List','foreignKey':'ListId'});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db['CmContact'],{'as':_0x0a9e('0x160'),'foreignKey':'ContactId'});db[_0x0a9e('0xd2')]['belongsTo'](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xd2')]['belongsTo'](db['SmsMessage'],{});db['SmsQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{});db[_0x0a9e('0xd2')][_0x0a9e('0x150')](db[_0x0a9e('0x57')],{});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0xd0')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db[_0x0a9e('0x1d8')],{'foreignKey':_0x0a9e('0x1da')});db[_0x0a9e('0x1d9')][_0x0a9e('0x110')](db['JscriptyAnswerReport'],{'foreignKey':'ProjectId'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'user_has_teams'});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0x1a')],{'through':'TeamVoiceQueue','as':_0x0a9e('0x131')});db['Team']['belongsToMany'](db[_0x0a9e('0x3c')],{'through':_0x0a9e('0x171'),'as':_0x0a9e('0x1db')});db[_0x0a9e('0x129')]['belongsToMany'](db['ChatQueue'],{'through':_0x0a9e('0x19b'),'as':'ChatQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db['FaxQueue'],{'through':_0x0a9e('0x187'),'as':'FaxQueues'});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x57')],{'through':_0x0a9e('0x18c'),'as':_0x0a9e('0x136')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x137')],{'through':_0x0a9e('0x190'),'as':_0x0a9e('0x1dc')});db[_0x0a9e('0x129')][_0x0a9e('0x121')](db[_0x0a9e('0x101')],{'through':_0x0a9e('0x1dd'),'as':_0x0a9e('0x138')});db[_0x0a9e('0x129')]['belongsToMany'](db[_0x0a9e('0xf1')],{'through':_0x0a9e('0x107'),'as':_0x0a9e('0x132')});db['Campaign'][_0x0a9e('0x110')](db[_0x0a9e('0x6d')],{'as':_0x0a9e('0x14c'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')][_0x0a9e('0x110')](db['CmHopperHistory'],{'as':_0x0a9e('0x19e'),'foreignKey':_0x0a9e('0x1a7')});db[_0x0a9e('0x1a5')]['hasMany'](db[_0x0a9e('0x6f')],{'as':'HopperBlacks','foreignKey':'CampaignId'});db[_0x0a9e('0x1a5')]['belongsTo'](db[_0x0a9e('0x28')],{'as':'Trunk','foreignKey':_0x0a9e('0x14f')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['Trunk'],{'as':_0x0a9e('0x151'),'foreignKey':'TrunkBackupId'});db['Campaign'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'as':_0x0a9e('0x17b'),'foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0x1a5')][_0x0a9e('0x150')](db['SquareProject'],{'as':_0x0a9e('0xdc'),'foreignKey':_0x0a9e('0x1de')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':'Lists','through':_0x0a9e('0x1df')});db[_0x0a9e('0x1a5')][_0x0a9e('0x121')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x156'),'through':_0x0a9e('0x1e0')});db[_0x0a9e('0xe4')][_0x0a9e('0x150')](db[_0x0a9e('0x66')],{'as':_0x0a9e('0x66'),'foreignKey':_0x0a9e('0x19a')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db['MailMessage'],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x11c')],{});db['MailTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e2'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0x1e1')]['belongsTo'](db['User'],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3c')],{'foreignKey':'ToMailQueueId','as':'ToQueue'});db[_0x0a9e('0x1e1')][_0x0a9e('0x150')](db[_0x0a9e('0x3b')],{'foreignKey':_0x0a9e('0x1e7'),'as':_0x0a9e('0x1e8')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x65')],{});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['ChatInteraction'],{});db[_0x0a9e('0xe8')]['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1e9'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xe8')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xe8')]['belongsTo'](db[_0x0a9e('0x67')],{'foreignKey':_0x0a9e('0x1eb'),'as':'ToQueue'});db['ChatTransferReport']['belongsTo'](db['ChatWebsite'],{'foreignKey':_0x0a9e('0x1ec'),'as':_0x0a9e('0x1e8')});db['FaxTransferReport'][_0x0a9e('0x150')](db['FaxMessage'],{});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11b')],{});db['FaxTransferReport']['belongsTo'](db[_0x0a9e('0x45')],{'foreignKey':_0x0a9e('0x1ed'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xea')]['belongsTo'](db['FaxQueue'],{'foreignKey':_0x0a9e('0x1ee'),'as':_0x0a9e('0x1ef')});db[_0x0a9e('0xea')][_0x0a9e('0x150')](db[_0x0a9e('0x45')],{'foreignKey':'ToFaxAccountId','as':_0x0a9e('0x1e8')});db[_0x0a9e('0xec')]['belongsTo'](db[_0x0a9e('0x5e')],{});db['OpenchannelTransferReport']['belongsTo'](db['OpenchannelInteraction'],{});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['OpenchannelAccount'],{'foreignKey':'FromOpenchannelAccountId','as':_0x0a9e('0x1e3')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'FromUserId','as':_0x0a9e('0x1e4')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1e5'),'as':_0x0a9e('0x1e6')});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x137')],{'foreignKey':'ToOpenchannelQueueId','as':'ToQueue'});db[_0x0a9e('0xec')][_0x0a9e('0x150')](db[_0x0a9e('0x59')],{'foreignKey':'ToOpenchannelAccountId','as':'ToAccount'});db['SmsTransferReport']['belongsTo'](db[_0x0a9e('0x55')],{});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x53')],{});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':_0x0a9e('0x1f0'),'as':_0x0a9e('0x1e3')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':_0x0a9e('0x1e4')});db[_0x0a9e('0xee')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0xee')]['belongsTo'](db['SmsQueue'],{'foreignKey':'ToSmsQueueId','as':_0x0a9e('0x1ef')});db[_0x0a9e('0xee')]['belongsTo'](db[_0x0a9e('0x50')],{'foreignKey':'ToSmsAccountId','as':'ToAccount'});db['CmList']['hasMany'](db[_0x0a9e('0x167')],{'as':_0x0a9e('0x168'),'foreignKey':_0x0a9e('0x16d'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x1f1')],{'as':_0x0a9e('0x1f2'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db['CmContact'],{'as':_0x0a9e('0x125'),'onDelete':'cascade','foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x71')],{'as':_0x0a9e('0x115'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0x139')][_0x0a9e('0x110')](db[_0x0a9e('0x116')],{'as':'HopperHistory','foreignKey':'ListId'});db['CmList'][_0x0a9e('0x110')](db[_0x0a9e('0x73')],{'as':_0x0a9e('0x73'),'foreignKey':'ListId'});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x1a')],{'as':'Queues','through':_0x0a9e('0x1f3')});db[_0x0a9e('0x139')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':'Agents','through':_0x0a9e('0x128')});db[_0x0a9e('0xf1')][_0x0a9e('0x110')](db[_0x0a9e('0x16')],{'as':_0x0a9e('0x114'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf1')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':'UserVoicePrefix'});db[_0x0a9e('0xf1')]['belongsToMany'](db[_0x0a9e('0x129')],{'through':'TeamVoicePrefix','as':_0x0a9e('0x155')});db[_0x0a9e('0xf2')][_0x0a9e('0x110')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'foreignKey':_0x0a9e('0x1f4')});db['UserProfile'][_0x0a9e('0x110')](db['UserProfileSection'],{'as':_0x0a9e('0x1f5'),'foreignKey':_0x0a9e('0x1f4'),'onDelete':_0x0a9e('0x10e')});db['UserProfileSection']['hasMany'](db['UserProfileResource'],{'as':_0x0a9e('0x1f6'),'foreignKey':_0x0a9e('0x1f7'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db[_0x0a9e('0x167')],{'as':'Dispositions','foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['CannedAnswer'],{'as':_0x0a9e('0x169'),'foreignKey':_0x0a9e('0x1f8')});db['WhatsappAccount'][_0x0a9e('0x110')](db[_0x0a9e('0xfd')],{'as':_0x0a9e('0x158'),'foreignKey':'WhatsappAccountId'});db[_0x0a9e('0xf7')]['hasMany'](db[_0x0a9e('0xfb')],{'as':'Interactions'});db[_0x0a9e('0xf7')][_0x0a9e('0x110')](db['WhatsappApplication'],{'as':_0x0a9e('0x147'),'foreignKey':_0x0a9e('0x1f8'),'onDelete':_0x0a9e('0x10e')});db['WhatsappAccount'][_0x0a9e('0x150')](db['CmList'],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xf7')][_0x0a9e('0x150')](db[_0x0a9e('0x7d')],{'as':'mandatoryDispositionPause','foreignKey':_0x0a9e('0x154')});db[_0x0a9e('0xf7')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x144')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db[_0x0a9e('0x101')],{'onDelete':_0x0a9e('0x164')});db[_0x0a9e('0xf9')][_0x0a9e('0x150')](db['WhatsappAccount'],{'onDelete':_0x0a9e('0x164')});db['WhatsappApplication'][_0x0a9e('0x150')](db[_0x0a9e('0x17b')],{'onDelete':'restrict','foreignKey':_0x0a9e('0x153')});db[_0x0a9e('0xf9')]['belongsTo'](db[_0x0a9e('0x86')],{'onDelete':_0x0a9e('0x164'),'foreignKey':_0x0a9e('0x181')});db['WhatsappInteraction'][_0x0a9e('0x110')](db['WhatsappMessage'],{'as':'Messages','onDelete':'cascade','foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfb')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x184'),'foreignKey':_0x0a9e('0x10f')});db[_0x0a9e('0xfb')][_0x0a9e('0x121')](db[_0x0a9e('0x86')],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x174')});db['WhatsappInteraction'][_0x0a9e('0x121')](db['Tag'],{'through':_0x0a9e('0x1b5'),'as':_0x0a9e('0x175')});db[_0x0a9e('0xfb')]['belongsToMany'](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x176'),'through':_0x0a9e('0x130'),'foreignKey':'WhatsappInteractionId'});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x11')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'onDelete':'cascade','as':_0x0a9e('0x160')});db[_0x0a9e('0xfd')][_0x0a9e('0x150')](db['WhatsappInteraction'],{'onDelete':'cascade','as':_0x0a9e('0x179'),'foreignKey':_0x0a9e('0x1f9')});db[_0x0a9e('0xfd')]['belongsTo'](db[_0x0a9e('0xf7')],{'as':_0x0a9e('0x183'),'foreignKey':_0x0a9e('0x1f8')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0xf7')],{});db['WhatsappQueueReport'][_0x0a9e('0x150')](db[_0x0a9e('0x139')],{'as':_0x0a9e('0x16c'),'foreignKey':_0x0a9e('0x16d')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db[_0x0a9e('0x124')],{'as':_0x0a9e('0x160'),'foreignKey':_0x0a9e('0x172')});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['WhatsappInteraction'],{});db['WhatsappQueueReport']['belongsTo'](db[_0x0a9e('0x101')],{});db[_0x0a9e('0xfe')]['belongsTo'](db['WhatsappMessage'],{});db[_0x0a9e('0xfe')][_0x0a9e('0x150')](db['User'],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfd')],{});db['WhatsappTransferReport'][_0x0a9e('0x150')](db[_0x0a9e('0xfb')],{});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappAccount'],{'foreignKey':_0x0a9e('0x1fb'),'as':_0x0a9e('0x1e3')});db['WhatsappTransferReport']['belongsTo'](db[_0x0a9e('0xf7')],{'foreignKey':_0x0a9e('0x1fc'),'as':'ToAccount'});db[_0x0a9e('0x1fa')]['belongsTo'](db['WhatsappQueue'],{'foreignKey':_0x0a9e('0x1fd'),'as':_0x0a9e('0x1ef')});db['WhatsappTransferReport']['belongsTo'](db['User'],{'foreignKey':_0x0a9e('0x1ea'),'as':'FromAgent'});db[_0x0a9e('0x1fa')][_0x0a9e('0x150')](db['User'],{'foreignKey':'ToUserId','as':_0x0a9e('0x1e6')});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x170'),'through':_0x0a9e('0x37'),'foreignKey':'WhatsappQueueId'});db[_0x0a9e('0x101')][_0x0a9e('0x121')](db[_0x0a9e('0x129')],{'through':_0x0a9e('0x1dd'),'as':'Teams'});db[_0x0a9e('0x1fe')][_0x0a9e('0x150')](db[_0x0a9e('0x11')],{'as':_0x0a9e('0x1ff'),'foreignKey':_0x0a9e('0x10f'),'onDelete':_0x0a9e('0x10e'),'hooks':!![]});db[_0x0a9e('0x103')][_0x0a9e('0x10b')](db['Dynamics365Account'],{'as':_0x0a9e('0xbe'),'onDelete':_0x0a9e('0x164')});db['CloudProvider'][_0x0a9e('0x10b')](db['MailServerIn'],{'as':'Imap','onDelete':_0x0a9e('0x164')});db['CloudProvider']['hasOne'](db['MailServerOut'],{'as':'Smtp','onDelete':_0x0a9e('0x164')});module['exports']={'db':db,'dbH':dbH}; \ No newline at end of file diff --git a/server/routes.js b/server/routes.js index b839b2a..cd18d29 100644 --- a/server/routes.js +++ b/server/routes.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xea1f=['./api/cmHopper','/api/cm/hopper_black','./api/cmHopperBlack','./api/cmHopperFinal','/api/cm/hopper_history','./api/cmHopperHistory','/api/cm/custom_fields','./api/cmCustomField','/api/actions','./api/action','./api/automation','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/condition','./api/interval','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','./api/schedule','./api/sound','/api/tags','/api/contact_item_types','./api/contactItemType','/api/cm_contact_has_items','/api/cm_hopper_additional_phones','/api/templates','./api/template','./api/trigger','/api/variables','./api/variable','/api/integrations','./api/integration','./api/integrationReport','/api/analytics/custom_reports','/api/analytics/default_reports','/api/analytics/extracted_reports','./api/analyticExtractedReport','/api/analytics/metrics','./api/analyticMetric','./api/analyticFieldReport','./api/analyticTreeReport','/api/integrations/salesforce/accounts','./api/intSalesforceAccount','/api/integrations/salesforce/configurations','/api/integrations/salesforce/fields','./api/intSalesforceField','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intSugarcrmConfiguration','./api/intSugarcrmField','/api/integrations/desk/accounts','./api/intDeskConfiguration','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','/api/integrations/zoho/fields','/api/integrations/zendesk/accounts','./api/intZendeskAccount','./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/integrations/vtiger/configurations','./api/intVtigerConfiguration','/api/integrations/vtiger/fields','/api/integrations/servicenow/accounts','./api/intServicenowAccount','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','./api/intServicenowField','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','/api/integrations/dynamics365/configurations','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','/api/integrations/freshsales/configurations','./api/intFreshsalesConfiguration','/api/integrations/freshsales/fields','/api/networks','./api/network','/api/chat/reports/queue','/api/chat/internal/messages','./api/chatInternalMessage','/api/jscripty/answers/reports','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','./api/jscriptyProject','/api/settings','./api/setting','./api/squareOdbc','./api/squareProject','./api/squareRecording','./api/team','/api/license','/api/campaigns','./api/migration','/api/attachments','./api/attachment','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','/api/sms/reports/transfer','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','./api/userProfileResource','/api/userNotifications','./api/userNotification','/api/whatsapp/accounts','./api/whatsappAccount','/api/whatsapp/applications','./api/whatsappApplication','./api/whatsappInteraction','/api/whatsapp/messages','./api/whatsappMessage','./api/whatsappQueueReport','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','/api/whatsapp/queues','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','/api/user-settings','./api/user-setting','./api/authLocal','/api/auth/google','./api/authGoogle','/api/auth/activedirectory','./api/authActiveDirectory','/api/jira','./api/jira','./api/rpc','/api/version','./api/version','/api/system','./api/system','/api/pm2','./api/pm2','/api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','snippet','3.1.0','/plugins','route','get','/index.html','path','./errors','./config/environment','./utils/client-side-logger','./api/client-side-logs','then','use','/api/users','./api/user','/api/voice/chanspy','./api/voiceChanSpy','/api/voice/extensions','./api/voiceExtension','/api/voice/queues','./api/voiceQueue','/api/voice/recordings','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','/api/voice/agents/reports','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/out_servers','/api/mail/accounts','./api/mailAccount','/api/mail/queues','/api/mail/substatuses','./api/mailSubstatus','./api/mailInteraction','./api/mailMessage','./api/mailApplication','/api/mail/reports/queue','./api/mailQueueReport','/api/dashboards','./api/dashboard','/api/dashboards/items','./api/dashboardItem','/api/fax/accounts','/api/fax/applications','./api/faxApplication','/api/fax/interactions','/api/fax/messages','./api/faxMessage','/api/fax/queues','/api/sms/accounts','/api/sms/applications','./api/smsApplication','/api/sms/interactions','./api/smsInteraction','./api/smsMessage','/api/sms/queues','./api/smsQueue','./api/openchannelAccount','./api/openchannelApplication','/api/openchannel/interactions','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','./api/openchannelQueue','/api/chat/websites','./api/chatWebsite','/api/openchannel/reports/queue','./api/openchannelQueueReport','/api/chat/applications','./api/chatInteraction','/api/chat/messages','/api/chat/offline_messages','./api/chatOfflineMessage','/api/chat/queues','./api/chatQueue','/api/chat/groups','/api/chat/proactive_actions','./api/cmCompany','/api/cm/contacts','./api/cmContact','/api/cm/hopper'];(function(_0x2a478e,_0x404251){var _0x51322c=function(_0x2e547e){while(--_0x2e547e){_0x2a478e['push'](_0x2a478e['shift']());}};_0x51322c(++_0x404251);}(_0xea1f,0x1ce));var _0xfea1=function(_0x176213,_0x5d59c8){_0x176213=_0x176213-0x0;var _0x2b290c=_0xea1f[_0x176213];return _0x2b290c;};'use strict';var path=require(_0xfea1('0x0'));var express=require('express');var errors=require(_0xfea1('0x1'));var config=require(_0xfea1('0x2'));var setupLoggers=require(_0xfea1('0x3'))['setupLoggers'];var clientSideLogs=require(_0xfea1('0x4'));exports['default']=function(_0x14c219){return setupLoggers(_0x14c219)[_0xfea1('0x5')](function(){_0x14c219[_0xfea1('0x6')](_0xfea1('0x7'),require(_0xfea1('0x8')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x9'),require(_0xfea1('0xa')));_0x14c219[_0xfea1('0x6')]('/api/voice/contexts',require('./api/voiceContext'));_0x14c219['use'](_0xfea1('0xb'),require(_0xfea1('0xc')));_0x14c219[_0xfea1('0x6')]('/api/voice/mohs',require('./api/voiceMusicOnHold'));_0x14c219[_0xfea1('0x6')](_0xfea1('0xd'),require(_0xfea1('0xe')));_0x14c219['use'](_0xfea1('0xf'),require(_0xfea1('0x10')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x11'),require(_0xfea1('0x12')));_0x14c219[_0xfea1('0x6')]('/api/voice/mails',require(_0xfea1('0x13')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x14'),require(_0xfea1('0x15')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x16'),require(_0xfea1('0x17')));_0x14c219['use'](_0xfea1('0x18'),require(_0xfea1('0x19')));_0x14c219['use'](_0xfea1('0x1a'),require('./api/voiceAgentReport'));_0x14c219[_0xfea1('0x6')](_0xfea1('0x1b'),require(_0xfea1('0x1c')));_0x14c219['use']('/api/members/reports',require(_0xfea1('0x1d')));_0x14c219[_0xfea1('0x6')]('/api/trunks',require(_0xfea1('0x1e')));_0x14c219['use'](_0xfea1('0x1f'),require(_0xfea1('0x20')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x21'),require('./api/mailServerOut'));_0x14c219[_0xfea1('0x6')](_0xfea1('0x22'),require(_0xfea1('0x23')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x24'),require('./api/mailQueue'));_0x14c219['use'](_0xfea1('0x25'),require(_0xfea1('0x26')));_0x14c219[_0xfea1('0x6')]('/api/mail/interactions',require(_0xfea1('0x27')));_0x14c219[_0xfea1('0x6')]('/api/mail/messages',require(_0xfea1('0x28')));_0x14c219[_0xfea1('0x6')]('/api/mail/applications',require(_0xfea1('0x29')));_0x14c219['use'](_0xfea1('0x2a'),require(_0xfea1('0x2b')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x2c'),require(_0xfea1('0x2d')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x2e'),require(_0xfea1('0x2f')));_0x14c219['use'](_0xfea1('0x30'),require('./api/faxAccount'));_0x14c219[_0xfea1('0x6')](_0xfea1('0x31'),require(_0xfea1('0x32')));_0x14c219['use'](_0xfea1('0x33'),require('./api/faxInteraction'));_0x14c219[_0xfea1('0x6')](_0xfea1('0x34'),require(_0xfea1('0x35')));_0x14c219['use'](_0xfea1('0x36'),require('./api/faxQueue'));_0x14c219['use']('/api/fax/reports/queue',require('./api/faxQueueReport'));_0x14c219[_0xfea1('0x6')](_0xfea1('0x37'),require('./api/smsAccount'));_0x14c219[_0xfea1('0x6')](_0xfea1('0x38'),require(_0xfea1('0x39')));_0x14c219['use'](_0xfea1('0x3a'),require(_0xfea1('0x3b')));_0x14c219[_0xfea1('0x6')]('/api/sms/messages',require(_0xfea1('0x3c')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x3d'),require(_0xfea1('0x3e')));_0x14c219[_0xfea1('0x6')]('/api/openchannel/accounts',require(_0xfea1('0x3f')));_0x14c219[_0xfea1('0x6')]('/api/openchannel/applications',require(_0xfea1('0x40')));_0x14c219['use'](_0xfea1('0x41'),require(_0xfea1('0x42')));_0x14c219['use'](_0xfea1('0x43'),require(_0xfea1('0x44')));_0x14c219['use'](_0xfea1('0x45'),require(_0xfea1('0x46')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x47'),require(_0xfea1('0x48')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x49'),require(_0xfea1('0x4a')));_0x14c219['use'](_0xfea1('0x4b'),require('./api/chatApplication'));_0x14c219[_0xfea1('0x6')]('/api/chat/interactions',require(_0xfea1('0x4c')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x4d'),require('./api/chatMessage'));_0x14c219[_0xfea1('0x6')](_0xfea1('0x4e'),require(_0xfea1('0x4f')));_0x14c219['use'](_0xfea1('0x50'),require(_0xfea1('0x51')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x52'),require('./api/chatGroup'));_0x14c219[_0xfea1('0x6')](_0xfea1('0x53'),require('./api/chatProactiveAction'));_0x14c219[_0xfea1('0x6')]('/api/cm/companies',require(_0xfea1('0x54')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x55'),require(_0xfea1('0x56')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x57'),require(_0xfea1('0x58')));_0x14c219['use'](_0xfea1('0x59'),require(_0xfea1('0x5a')));_0x14c219[_0xfea1('0x6')]('/api/cm/hopper_final',require(_0xfea1('0x5b')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x5c'),require(_0xfea1('0x5d')));_0x14c219['use'](_0xfea1('0x5e'),require(_0xfea1('0x5f')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x60'),require(_0xfea1('0x61')));_0x14c219[_0xfea1('0x6')]('/api/automations',require(_0xfea1('0x62')));_0x14c219['use'](_0xfea1('0x63'),require(_0xfea1('0x64')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x65'),require(_0xfea1('0x66')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x67'),require(_0xfea1('0x68')));_0x14c219['use']('/api/intervals',require(_0xfea1('0x69')));_0x14c219[_0xfea1('0x6')]('/api/pauses',require(_0xfea1('0x6a')));_0x14c219[_0xfea1('0x6')]('/api/cdr',require(_0xfea1('0x6b')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x6c'),require(_0xfea1('0x6d')));_0x14c219[_0xfea1('0x6')]('/api/schedules',require(_0xfea1('0x6e')));_0x14c219[_0xfea1('0x6')]('/api/sounds',require(_0xfea1('0x6f')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x70'),require('./api/tag'));_0x14c219['use'](_0xfea1('0x71'),require(_0xfea1('0x72')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x73'),require('./api/cmContactHasItem'));_0x14c219[_0xfea1('0x6')](_0xfea1('0x74'),require('./api/cmHopperAdditionalPhone'));_0x14c219[_0xfea1('0x6')](_0xfea1('0x75'),require(_0xfea1('0x76')));_0x14c219[_0xfea1('0x6')]('/api/triggers',require(_0xfea1('0x77')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x78'),require(_0xfea1('0x79')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x7a'),require(_0xfea1('0x7b')));_0x14c219[_0xfea1('0x6')]('/api/integrations/reports',require(_0xfea1('0x7c')));_0x14c219['use'](_0xfea1('0x7d'),require('./api/analyticCustomReport'));_0x14c219[_0xfea1('0x6')](_0xfea1('0x7e'),require('./api/analyticDefaultReport'));_0x14c219[_0xfea1('0x6')](_0xfea1('0x7f'),require(_0xfea1('0x80')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x81'),require(_0xfea1('0x82')));_0x14c219[_0xfea1('0x6')]('/api/analytics/field_reports',require(_0xfea1('0x83')));_0x14c219[_0xfea1('0x6')]('/api/analytics/tree_reports',require(_0xfea1('0x84')));_0x14c219['use'](_0xfea1('0x85'),require(_0xfea1('0x86')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x87'),require('./api/intSalesforceConfiguration'));_0x14c219[_0xfea1('0x6')](_0xfea1('0x88'),require(_0xfea1('0x89')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x8a'),require(_0xfea1('0x8b')));_0x14c219['use'](_0xfea1('0x8c'),require(_0xfea1('0x8d')));_0x14c219[_0xfea1('0x6')]('/api/integrations/sugarcrm/fields',require(_0xfea1('0x8e')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x8f'),require('./api/intDeskAccount'));_0x14c219[_0xfea1('0x6')]('/api/integrations/desk/configurations',require(_0xfea1('0x90')));_0x14c219[_0xfea1('0x6')]('/api/integrations/desk/fields',require(_0xfea1('0x91')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x92'),require(_0xfea1('0x93')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x94'),require('./api/intZohoConfiguration'));_0x14c219[_0xfea1('0x6')](_0xfea1('0x95'),require('./api/intZohoField'));_0x14c219[_0xfea1('0x6')](_0xfea1('0x96'),require(_0xfea1('0x97')));_0x14c219[_0xfea1('0x6')]('/api/integrations/zendesk/configurations',require(_0xfea1('0x98')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x99'),require(_0xfea1('0x9a')));_0x14c219[_0xfea1('0x6')]('/api/integrations/freshdesk/accounts',require(_0xfea1('0x9b')));_0x14c219[_0xfea1('0x6')]('/api/integrations/freshdesk/configurations',require(_0xfea1('0x9c')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x9d'),require(_0xfea1('0x9e')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x9f'),require(_0xfea1('0xa0')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xa1'),require(_0xfea1('0xa2')));_0x14c219['use'](_0xfea1('0xa3'),require('./api/intVtigerField'));_0x14c219[_0xfea1('0x6')](_0xfea1('0xa4'),require(_0xfea1('0xa5')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xa6'),require(_0xfea1('0xa7')));_0x14c219[_0xfea1('0x6')]('/api/integrations/servicenow/fields',require(_0xfea1('0xa8')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xa9'),require(_0xfea1('0xaa')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xab'),require(_0xfea1('0xac')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xad'),require('./api/intDynamics365Field'));_0x14c219['use'](_0xfea1('0xae'),require(_0xfea1('0xaf')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xb0'),require(_0xfea1('0xb1')));_0x14c219['use'](_0xfea1('0xb2'),require('./api/intFreshsalesField'));_0x14c219[_0xfea1('0x6')](_0xfea1('0xb3'),require(_0xfea1('0xb4')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xb5'),require('./api/chatQueueReport'));_0x14c219['use'](_0xfea1('0xb6'),require(_0xfea1('0xb7')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xb8'),require(_0xfea1('0xb9')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xba'),require(_0xfea1('0xbb')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xbc'),require(_0xfea1('0xbd')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xbe'),require(_0xfea1('0xbf')));_0x14c219['use'](_0xfea1('0xc0'),require(_0xfea1('0xc1')));_0x14c219['use'](_0xfea1('0xc2'),require(_0xfea1('0xc3')));_0x14c219['use'](_0xfea1('0xc4'),require(_0xfea1('0xc5')));_0x14c219['use'](_0xfea1('0xc6'),require(_0xfea1('0xc7')));_0x14c219[_0xfea1('0x6')]('/api/square/odbc',require(_0xfea1('0xc8')));_0x14c219[_0xfea1('0x6')]('/api/square/projects',require(_0xfea1('0xc9')));_0x14c219[_0xfea1('0x6')]('/api/square/recordings',require(_0xfea1('0xca')));_0x14c219[_0xfea1('0x6')]('/api/square/messages',require('./api/squareMessage'));_0x14c219[_0xfea1('0x6')]('/api/teams',require(_0xfea1('0xcb')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xcc'),require('./api/license'));_0x14c219[_0xfea1('0x6')](_0xfea1('0xcd'),require('./api/campaign'));_0x14c219[_0xfea1('0x6')]('/api/migrations',require(_0xfea1('0xce')));_0x14c219['use'](_0xfea1('0xcf'),require(_0xfea1('0xd0')));_0x14c219[_0xfea1('0x6')]('/api/plugins',require(_0xfea1('0xd1')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xd2'),require(_0xfea1('0xd3')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xd4'),require('./api/chatTransferReport'));_0x14c219[_0xfea1('0x6')](_0xfea1('0xd5'),require(_0xfea1('0xd6')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xd7'),require('./api/openchannelTransferReport'));_0x14c219[_0xfea1('0x6')](_0xfea1('0xd8'),require(_0xfea1('0xd9')));_0x14c219['use'](_0xfea1('0xda'),require(_0xfea1('0xdb')));_0x14c219['use'](_0xfea1('0xdc'),require(_0xfea1('0xdd')));_0x14c219['use'](_0xfea1('0xde'),require(_0xfea1('0xdf')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xe0'),require(_0xfea1('0xe1')));_0x14c219[_0xfea1('0x6')]('/api/userProfile/resources',require(_0xfea1('0xe2')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xe3'),require(_0xfea1('0xe4')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xe5'),require(_0xfea1('0xe6')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xe7'),require(_0xfea1('0xe8')));_0x14c219[_0xfea1('0x6')]('/api/whatsapp/interactions',require(_0xfea1('0xe9')));_0x14c219['use'](_0xfea1('0xea'),require(_0xfea1('0xeb')));_0x14c219[_0xfea1('0x6')]('/api/whatsapp/reports/queue',require(_0xfea1('0xec')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xed'),require(_0xfea1('0xee')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xef'),require(_0xfea1('0xf0')));_0x14c219['use'](_0xfea1('0xf1'),require(_0xfea1('0xf2')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xf3'),require(_0xfea1('0xf4')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xf5'),require(_0xfea1('0xf6')));_0x14c219[_0xfea1('0x6')]('/api/auth/local',require(_0xfea1('0xf7')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xf8'),require(_0xfea1('0xf9')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xfa'),require(_0xfea1('0xfb')));_0x14c219['use'](_0xfea1('0xfc'),require(_0xfea1('0xfd')));_0x14c219[_0xfea1('0x6')]('/api/rpc',require(_0xfea1('0xfe')));_0x14c219[_0xfea1('0x6')](_0xfea1('0xff'),require(_0xfea1('0x100')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x101'),require(_0xfea1('0x102')));_0x14c219['use'](_0xfea1('0x103'),require(_0xfea1('0x104')));_0x14c219[_0xfea1('0x6')](_0xfea1('0x105'),require('./api/webbar'));_0x14c219[_0xfea1('0x6')](_0xfea1('0x106'),clientSideLogs);_0x14c219[_0xfea1('0x6')](_0xfea1('0x107'),express[_0xfea1('0x108')](path[_0xfea1('0x109')](config[_0xfea1('0x10a')],_0xfea1('0x107'))));_0x14c219['use']('/www',express[_0xfea1('0x108')](path[_0xfea1('0x109')](config[_0xfea1('0x10a')],_0xfea1('0x10b'))));_0x14c219[_0xfea1('0x6')](_0xfea1('0x10c'),express[_0xfea1('0x108')](path[_0xfea1('0x109')](config['root'],_0xfea1('0x10c'))));_0x14c219['use']('/snippet',express['static'](path[_0xfea1('0x109')](config['root'],_0xfea1('0x10d'),_0xfea1('0x10e'))));_0x14c219[_0xfea1('0x6')](_0xfea1('0x10f'),express['static'](path['join'](config[_0xfea1('0x10a')],'/server/files/plugins')));_0x14c219[_0xfea1('0x110')]('/:url(api|auth|components|app|bower_components|assets)/*')[_0xfea1('0x111')](errors[0x194]);_0x14c219[_0xfea1('0x110')]('/*')[_0xfea1('0x111')](function(_0x2a229a,_0xfdb54f){_0xfdb54f['sendFile'](path['resolve'](_0x14c219[_0xfea1('0x111')]('appPath')+_0xfea1('0x112')));});return _0x14c219;});}; \ No newline at end of file +var _0xc0b6=['./api/chatGroup','/api/chat/proactive_actions','./api/chatProactiveAction','./api/cmCompany','/api/cm/contacts','/api/cm/hopper','./api/cmHopper','/api/cm/hopper_black','./api/cmHopperFinal','/api/cm/hopper_history','/api/cm/custom_fields','./api/cmCustomField','./api/action','/api/automations','/api/canned_answers','./api/cannedAnswer','/api/dispositions','./api/disposition','/api/conditions','./api/interval','./api/pause','./api/cdr','/api/voiceQueuesLog','./api/voiceQueuesLog','/api/schedules','/api/sounds','./api/sound','/api/tags','./api/tag','/api/contact_item_types','/api/cm_contact_has_items','./api/cmContactHasItem','/api/cm_hopper_additional_phones','./api/cmHopperAdditionalPhone','./api/template','/api/triggers','./api/trigger','./api/variable','/api/integrations','./api/integration','/api/integrations/reports','./api/integrationReport','/api/analytics/custom_reports','/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/intSalesforceAccount','/api/integrations/salesforce/configurations','./api/intSalesforceConfiguration','/api/integrations/salesforce/fields','/api/integrations/sugarcrm/accounts','./api/intSugarcrmAccount','/api/integrations/sugarcrm/configurations','./api/intDeskAccount','./api/intDeskField','/api/integrations/zoho/accounts','./api/intZohoAccount','/api/integrations/zoho/configurations','./api/intZohoConfiguration','/api/integrations/zoho/fields','./api/intZohoField','./api/intZendeskAccount','/api/integrations/zendesk/configurations','./api/intZendeskConfiguration','./api/intZendeskField','/api/integrations/freshdesk/accounts','/api/integrations/freshdesk/configurations','./api/intFreshdeskConfiguration','/api/integrations/freshdesk/fields','./api/intFreshdeskField','./api/intVtigerAccount','/api/integrations/vtiger/configurations','/api/integrations/servicenow/accounts','/api/integrations/servicenow/configurations','./api/intServicenowConfiguration','/api/integrations/servicenow/fields','/api/integrations/dynamics365/accounts','./api/intDynamics365Account','./api/intDynamics365Configuration','/api/integrations/dynamics365/fields','/api/integrations/freshsales/accounts','./api/intFreshsalesAccount','./api/intFreshsalesConfiguration','./api/intFreshsalesField','/api/chat/reports/queue','./api/chatQueueReport','/api/chat/internal/messages','./api/chatInternalMessage','./api/jscriptyAnswerReport','/api/jscripty/questions/reports','./api/jscriptyQuestionReport','/api/jscripty/sessions/reports','./api/jscriptySessionReport','/api/sms/reports/queue','./api/smsQueueReport','/api/square/reports','./api/squareReport','/api/square/details/reports','./api/squareReportDetail','/api/jscripty/projects','/api/square/odbc','./api/squareOdbc','/api/square/projects','./api/squareProject','/api/square/messages','./api/squareMessage','/api/teams','./api/team','./api/license','/api/campaigns','./api/campaign','/api/migrations','./api/migration','/api/attachments','./api/attachment','/api/plugins','./api/plugin','/api/mail/reports/transfer','./api/mailTransferReport','/api/chat/reports/transfer','./api/chatTransferReport','/api/fax/reports/transfer','./api/faxTransferReport','/api/openchannel/reports/transfer','./api/openchannelTransferReport','./api/smsTransferReport','/api/cm/lists','./api/cmList','/api/voice/prefixes','./api/voicePrefix','/api/userProfiles','./api/userProfile','/api/userProfile/sections','./api/userProfileSection','/api/userProfile/resources','./api/userProfileResource','/api/whatsapp/accounts','/api/whatsapp/applications','/api/whatsapp/interactions','/api/whatsapp/messages','./api/whatsappMessage','/api/whatsapp/reports/queue','/api/whatsapp/reports/transfer','./api/whatsappTransferReport','./api/whatsappQueue','/api/cloudProviders','./api/cloudProvider','/api/realtime','./api/realtime','./api/user-setting','/api/auth/local','./api/authLocal','./api/authGoogle','./api/authActiveDirectory','/api/jira','./api/jira','/api/rpc','/api/version','./api/version','/api/system','/api/pm2','./api/pm2','/api/webbar','./api/webbar','/api/logs','/apidoc','static','join','root','/www','/demo','snippet','3.1.0','/plugins','/server/files/plugins','route','/:url(api|auth|components|app|bower_components|assets)/*','get','sendFile','resolve','path','express','./errors','./config/environment','./utils/client-side-logger','setupLoggers','./api/client-side-logs','default','then','/api/users','use','./api/voiceChanSpy','/api/voice/contexts','./api/voiceContext','/api/voice/mohs','./api/voiceMusicOnHold','/api/voice/queues','./api/voiceQueue','./api/voiceRecording','/api/screen/recordings','./api/screenRecording','/api/voice/mails','./api/voiceMail','/api/voice/mails/messages','./api/voiceMailMessage','/api/voice/calls/reports','./api/voiceCallReport','/api/voice/dials/reports','./api/voiceDialReport','./api/voiceAgentReport','/api/voice/queues/reports','./api/voiceQueueReport','./api/memberReport','/api/trunks','./api/trunk','/api/voice/transfers/reports','./api/voiceTransferReport','/api/mail/accounts','./api/mailAccount','/api/mail/queues','./api/mailQueue','./api/mailInteraction','./api/mailMessage','/api/mail/applications','./api/mailApplication','./api/mailQueueReport','/api/dashboards','/api/dashboards/items','./api/faxAccount','/api/fax/applications','./api/faxApplication','/api/fax/interactions','./api/faxInteraction','/api/fax/messages','./api/faxMessage','/api/fax/queues','./api/faxQueue','/api/fax/reports/queue','./api/faxQueueReport','./api/smsAccount','/api/sms/applications','./api/smsApplication','/api/sms/interactions','/api/sms/messages','./api/smsMessage','/api/sms/queues','./api/smsQueue','/api/openchannel/accounts','./api/openchannelAccount','/api/openchannel/applications','./api/openchannelApplication','./api/openchannelInteraction','/api/openchannel/messages','./api/openchannelMessage','/api/openchannel/queues','/api/chat/websites','./api/openchannelQueueReport','/api/chat/applications','./api/chatApplication','/api/chat/interactions','./api/chatInteraction','/api/chat/messages','./api/chatMessage','/api/chat/offline_messages','/api/chat/queues','./api/chatQueue','/api/chat/groups'];(function(_0xfcc55f,_0x8739c6){var _0x4a13fb=function(_0x179f86){while(--_0x179f86){_0xfcc55f['push'](_0xfcc55f['shift']());}};_0x4a13fb(++_0x8739c6);}(_0xc0b6,0x1cd));var _0x6c0b=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xc0b6[_0x14add3];return _0x4a174f;};'use strict';var path=require(_0x6c0b('0x0'));var express=require(_0x6c0b('0x1'));var errors=require(_0x6c0b('0x2'));var config=require(_0x6c0b('0x3'));var setupLoggers=require(_0x6c0b('0x4'))[_0x6c0b('0x5')];var clientSideLogs=require(_0x6c0b('0x6'));exports[_0x6c0b('0x7')]=function(_0x4a55a2){return setupLoggers(_0x4a55a2)[_0x6c0b('0x8')](function(){_0x4a55a2['use'](_0x6c0b('0x9'),require('./api/user'));_0x4a55a2[_0x6c0b('0xa')]('/api/voice/chanspy',require(_0x6c0b('0xb')));_0x4a55a2['use'](_0x6c0b('0xc'),require(_0x6c0b('0xd')));_0x4a55a2['use']('/api/voice/extensions',require('./api/voiceExtension'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xe'),require(_0x6c0b('0xf')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x10'),require(_0x6c0b('0x11')));_0x4a55a2[_0x6c0b('0xa')]('/api/voice/recordings',require(_0x6c0b('0x12')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x13'),require(_0x6c0b('0x14')));_0x4a55a2['use'](_0x6c0b('0x15'),require(_0x6c0b('0x16')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x17'),require(_0x6c0b('0x18')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x19'),require(_0x6c0b('0x1a')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x1b'),require(_0x6c0b('0x1c')));_0x4a55a2[_0x6c0b('0xa')]('/api/voice/agents/reports',require(_0x6c0b('0x1d')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x1e'),require(_0x6c0b('0x1f')));_0x4a55a2[_0x6c0b('0xa')]('/api/members/reports',require(_0x6c0b('0x20')));_0x4a55a2['use'](_0x6c0b('0x21'),require(_0x6c0b('0x22')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x23'),require(_0x6c0b('0x24')));_0x4a55a2[_0x6c0b('0xa')]('/api/mail/out_servers',require('./api/mailServerOut'));_0x4a55a2['use'](_0x6c0b('0x25'),require(_0x6c0b('0x26')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x27'),require(_0x6c0b('0x28')));_0x4a55a2['use']('/api/mail/substatuses',require('./api/mailSubstatus'));_0x4a55a2['use']('/api/mail/interactions',require(_0x6c0b('0x29')));_0x4a55a2[_0x6c0b('0xa')]('/api/mail/messages',require(_0x6c0b('0x2a')));_0x4a55a2['use'](_0x6c0b('0x2b'),require(_0x6c0b('0x2c')));_0x4a55a2[_0x6c0b('0xa')]('/api/mail/reports/queue',require(_0x6c0b('0x2d')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x2e'),require('./api/dashboard'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x2f'),require('./api/dashboardItem'));_0x4a55a2['use']('/api/fax/accounts',require(_0x6c0b('0x30')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x31'),require(_0x6c0b('0x32')));_0x4a55a2['use'](_0x6c0b('0x33'),require(_0x6c0b('0x34')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x35'),require(_0x6c0b('0x36')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x37'),require(_0x6c0b('0x38')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x39'),require(_0x6c0b('0x3a')));_0x4a55a2['use']('/api/sms/accounts',require(_0x6c0b('0x3b')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x3c'),require(_0x6c0b('0x3d')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x3e'),require('./api/smsInteraction'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x3f'),require(_0x6c0b('0x40')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x41'),require(_0x6c0b('0x42')));_0x4a55a2['use'](_0x6c0b('0x43'),require(_0x6c0b('0x44')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x45'),require(_0x6c0b('0x46')));_0x4a55a2[_0x6c0b('0xa')]('/api/openchannel/interactions',require(_0x6c0b('0x47')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x48'),require(_0x6c0b('0x49')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x4a'),require('./api/openchannelQueue'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x4b'),require('./api/chatWebsite'));_0x4a55a2[_0x6c0b('0xa')]('/api/openchannel/reports/queue',require(_0x6c0b('0x4c')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x4d'),require(_0x6c0b('0x4e')));_0x4a55a2['use'](_0x6c0b('0x4f'),require(_0x6c0b('0x50')));_0x4a55a2['use'](_0x6c0b('0x51'),require(_0x6c0b('0x52')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x53'),require('./api/chatOfflineMessage'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x54'),require(_0x6c0b('0x55')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x56'),require(_0x6c0b('0x57')));_0x4a55a2['use'](_0x6c0b('0x58'),require(_0x6c0b('0x59')));_0x4a55a2[_0x6c0b('0xa')]('/api/cm/companies',require(_0x6c0b('0x5a')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x5b'),require('./api/cmContact'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x5c'),require(_0x6c0b('0x5d')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x5e'),require('./api/cmHopperBlack'));_0x4a55a2[_0x6c0b('0xa')]('/api/cm/hopper_final',require(_0x6c0b('0x5f')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x60'),require('./api/cmHopperHistory'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x61'),require(_0x6c0b('0x62')));_0x4a55a2[_0x6c0b('0xa')]('/api/actions',require(_0x6c0b('0x63')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x64'),require('./api/automation'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x65'),require(_0x6c0b('0x66')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x67'),require(_0x6c0b('0x68')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x69'),require('./api/condition'));_0x4a55a2[_0x6c0b('0xa')]('/api/intervals',require(_0x6c0b('0x6a')));_0x4a55a2[_0x6c0b('0xa')]('/api/pauses',require(_0x6c0b('0x6b')));_0x4a55a2[_0x6c0b('0xa')]('/api/cdr',require(_0x6c0b('0x6c')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x6d'),require(_0x6c0b('0x6e')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x6f'),require('./api/schedule'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x70'),require(_0x6c0b('0x71')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x72'),require(_0x6c0b('0x73')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x74'),require('./api/contactItemType'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x75'),require(_0x6c0b('0x76')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x77'),require(_0x6c0b('0x78')));_0x4a55a2['use']('/api/templates',require(_0x6c0b('0x79')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x7a'),require(_0x6c0b('0x7b')));_0x4a55a2[_0x6c0b('0xa')]('/api/variables',require(_0x6c0b('0x7c')));_0x4a55a2['use'](_0x6c0b('0x7d'),require(_0x6c0b('0x7e')));_0x4a55a2['use'](_0x6c0b('0x7f'),require(_0x6c0b('0x80')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x81'),require('./api/analyticCustomReport'));_0x4a55a2['use'](_0x6c0b('0x82'),require(_0x6c0b('0x83')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x84'),require(_0x6c0b('0x85')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x86'),require(_0x6c0b('0x87')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x88'),require(_0x6c0b('0x89')));_0x4a55a2['use'](_0x6c0b('0x8a'),require(_0x6c0b('0x8b')));_0x4a55a2[_0x6c0b('0xa')]('/api/integrations/salesforce/accounts',require(_0x6c0b('0x8c')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x8d'),require(_0x6c0b('0x8e')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x8f'),require('./api/intSalesforceField'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x90'),require(_0x6c0b('0x91')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x92'),require('./api/intSugarcrmConfiguration'));_0x4a55a2[_0x6c0b('0xa')]('/api/integrations/sugarcrm/fields',require('./api/intSugarcrmField'));_0x4a55a2[_0x6c0b('0xa')]('/api/integrations/desk/accounts',require(_0x6c0b('0x93')));_0x4a55a2[_0x6c0b('0xa')]('/api/integrations/desk/configurations',require('./api/intDeskConfiguration'));_0x4a55a2[_0x6c0b('0xa')]('/api/integrations/desk/fields',require(_0x6c0b('0x94')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x95'),require(_0x6c0b('0x96')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x97'),require(_0x6c0b('0x98')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x99'),require(_0x6c0b('0x9a')));_0x4a55a2[_0x6c0b('0xa')]('/api/integrations/zendesk/accounts',require(_0x6c0b('0x9b')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x9c'),require(_0x6c0b('0x9d')));_0x4a55a2[_0x6c0b('0xa')]('/api/integrations/zendesk/fields',require(_0x6c0b('0x9e')));_0x4a55a2['use'](_0x6c0b('0x9f'),require('./api/intFreshdeskAccount'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xa0'),require(_0x6c0b('0xa1')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xa2'),require(_0x6c0b('0xa3')));_0x4a55a2['use']('/api/integrations/vtiger/accounts',require(_0x6c0b('0xa4')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xa5'),require('./api/intVtigerConfiguration'));_0x4a55a2[_0x6c0b('0xa')]('/api/integrations/vtiger/fields',require('./api/intVtigerField'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xa6'),require('./api/intServicenowAccount'));_0x4a55a2['use'](_0x6c0b('0xa7'),require(_0x6c0b('0xa8')));_0x4a55a2['use'](_0x6c0b('0xa9'),require('./api/intServicenowField'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xaa'),require(_0x6c0b('0xab')));_0x4a55a2['use']('/api/integrations/dynamics365/configurations',require(_0x6c0b('0xac')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xad'),require('./api/intDynamics365Field'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xae'),require(_0x6c0b('0xaf')));_0x4a55a2['use']('/api/integrations/freshsales/configurations',require(_0x6c0b('0xb0')));_0x4a55a2[_0x6c0b('0xa')]('/api/integrations/freshsales/fields',require(_0x6c0b('0xb1')));_0x4a55a2[_0x6c0b('0xa')]('/api/networks',require('./api/network'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xb2'),require(_0x6c0b('0xb3')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xb4'),require(_0x6c0b('0xb5')));_0x4a55a2[_0x6c0b('0xa')]('/api/jscripty/answers/reports',require(_0x6c0b('0xb6')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xb7'),require(_0x6c0b('0xb8')));_0x4a55a2['use'](_0x6c0b('0xb9'),require(_0x6c0b('0xba')));_0x4a55a2['use'](_0x6c0b('0xbb'),require(_0x6c0b('0xbc')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xbd'),require(_0x6c0b('0xbe')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xbf'),require(_0x6c0b('0xc0')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xc1'),require('./api/jscriptyProject'));_0x4a55a2[_0x6c0b('0xa')]('/api/settings',require('./api/setting'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xc2'),require(_0x6c0b('0xc3')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xc4'),require(_0x6c0b('0xc5')));_0x4a55a2[_0x6c0b('0xa')]('/api/square/recordings',require('./api/squareRecording'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xc6'),require(_0x6c0b('0xc7')));_0x4a55a2['use'](_0x6c0b('0xc8'),require(_0x6c0b('0xc9')));_0x4a55a2[_0x6c0b('0xa')]('/api/license',require(_0x6c0b('0xca')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xcb'),require(_0x6c0b('0xcc')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xcd'),require(_0x6c0b('0xce')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xcf'),require(_0x6c0b('0xd0')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xd1'),require(_0x6c0b('0xd2')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xd3'),require(_0x6c0b('0xd4')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xd5'),require(_0x6c0b('0xd6')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xd7'),require(_0x6c0b('0xd8')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xd9'),require(_0x6c0b('0xda')));_0x4a55a2['use']('/api/sms/reports/transfer',require(_0x6c0b('0xdb')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xdc'),require(_0x6c0b('0xdd')));_0x4a55a2['use'](_0x6c0b('0xde'),require(_0x6c0b('0xdf')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xe0'),require(_0x6c0b('0xe1')));_0x4a55a2['use'](_0x6c0b('0xe2'),require(_0x6c0b('0xe3')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xe4'),require(_0x6c0b('0xe5')));_0x4a55a2[_0x6c0b('0xa')]('/api/userNotifications',require('./api/userNotification'));_0x4a55a2['use'](_0x6c0b('0xe6'),require('./api/whatsappAccount'));_0x4a55a2['use'](_0x6c0b('0xe7'),require('./api/whatsappApplication'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xe8'),require('./api/whatsappInteraction'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xe9'),require(_0x6c0b('0xea')));_0x4a55a2['use'](_0x6c0b('0xeb'),require('./api/whatsappQueueReport'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xec'),require(_0x6c0b('0xed')));_0x4a55a2[_0x6c0b('0xa')]('/api/whatsapp/queues',require(_0x6c0b('0xee')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xef'),require(_0x6c0b('0xf0')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xf1'),require(_0x6c0b('0xf2')));_0x4a55a2[_0x6c0b('0xa')]('/api/user-settings',require(_0x6c0b('0xf3')));_0x4a55a2['use'](_0x6c0b('0xf4'),require(_0x6c0b('0xf5')));_0x4a55a2['use']('/api/auth/google',require(_0x6c0b('0xf6')));_0x4a55a2[_0x6c0b('0xa')]('/api/auth/activedirectory',require(_0x6c0b('0xf7')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xf8'),require(_0x6c0b('0xf9')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xfa'),require('./api/rpc'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xfb'),require(_0x6c0b('0xfc')));_0x4a55a2['use'](_0x6c0b('0xfd'),require('./api/system'));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0xfe'),require(_0x6c0b('0xff')));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x100'),require(_0x6c0b('0x101')));_0x4a55a2['use'](_0x6c0b('0x102'),clientSideLogs);_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x103'),express[_0x6c0b('0x104')](path[_0x6c0b('0x105')](config[_0x6c0b('0x106')],_0x6c0b('0x103'))));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x107'),express[_0x6c0b('0x104')](path[_0x6c0b('0x105')](config[_0x6c0b('0x106')],_0x6c0b('0x107'))));_0x4a55a2[_0x6c0b('0xa')]('/demo',express[_0x6c0b('0x104')](path[_0x6c0b('0x105')](config['root'],_0x6c0b('0x108'))));_0x4a55a2[_0x6c0b('0xa')]('/snippet',express[_0x6c0b('0x104')](path[_0x6c0b('0x105')](config[_0x6c0b('0x106')],_0x6c0b('0x109'),_0x6c0b('0x10a'))));_0x4a55a2[_0x6c0b('0xa')](_0x6c0b('0x10b'),express[_0x6c0b('0x104')](path[_0x6c0b('0x105')](config['root'],_0x6c0b('0x10c'))));_0x4a55a2[_0x6c0b('0x10d')](_0x6c0b('0x10e'))[_0x6c0b('0x10f')](errors[0x194]);_0x4a55a2[_0x6c0b('0x10d')]('/*')[_0x6c0b('0x10f')](function(_0x59dacb,_0x61246c){_0x61246c[_0x6c0b('0x110')](path[_0x6c0b('0x111')](_0x4a55a2[_0x6c0b('0x10f')]('appPath')+'/index.html'));});return _0x4a55a2;});}; \ No newline at end of file diff --git a/server/rpc/index.js b/server/rpc/index.js index ddb4b4f..695c593 100644 --- a/server/rpc/index.js +++ b/server/rpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc918=['../api/chatMessage/chatMessage.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/sound/sound.rpc','../api/template/template.rpc','../api/trigger/trigger.rpc','../api/variable/variable.rpc','../api/intSalesforceAccount/intSalesforceAccount.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intZohoAccount/intZohoAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/intDynamics365Account/intDynamics365Account.rpc','../api/intFreshsalesAccount/intFreshsalesAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareProject/squareProject.rpc','../api/campaign/campaign.rpc','../api/attachment/attachment.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','server','http','rpc','port','localhost','error','log','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','RPC\x20listening\x20on\x20','jayson/promise','lodash','listen','merge','../api/voiceQueue/voiceQueue.rpc','../api/voiceAgentReport/voiceAgentReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailAccount/mailAccount.rpc','../api/mailQueue/mailQueue.rpc','../api/mailInteraction/mailInteraction.rpc','../api/mailMessage/mailMessage.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxAccount/faxAccount.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsMessage/smsMessage.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/openchannelQueue/openchannelQueue.rpc'];(function(_0x485195,_0x4fde33){var _0x744caf=function(_0x4e6b74){while(--_0x4e6b74){_0x485195['push'](_0x485195['shift']());}};_0x744caf(++_0x4fde33);}(_0xc918,0xb9));var _0x8c91=function(_0x982b9,_0x25d03e){_0x982b9=_0x982b9-0x0;var _0xdc4c90=_0xc918[_0x982b9];return _0xdc4c90;};'use strict';var jayson=require(_0x8c91('0x0'));var _=require(_0x8c91('0x1'));var config=require('../config/environment');exports[_0x8c91('0x2')]=function(){return new Promise(function(_0x5b204b,_0x9f4503){var _0x41f065={};_0x41f065=_[_0x8c91('0x3')](_0x41f065,require('../api/user/user.rpc'));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require('../api/voiceExtension/voiceExtension.rpc'));_0x41f065=_['merge'](_0x41f065,require(_0x8c91('0x4')));_0x41f065=_['merge'](_0x41f065,require('../api/voiceRecording/voiceRecording.rpc'));_0x41f065=_['merge'](_0x41f065,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x41f065=_['merge'](_0x41f065,require('../api/voiceDialReport/voiceDialReport.rpc'));_0x41f065=_['merge'](_0x41f065,require(_0x8c91('0x5')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x6')));_0x41f065=_['merge'](_0x41f065,require('../api/memberReport/memberReport.rpc'));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x7')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require('../api/voiceTransferReport/voiceTransferReport.rpc'));_0x41f065=_['merge'](_0x41f065,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x8')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x9')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0xa')));_0x41f065=_['merge'](_0x41f065,require(_0x8c91('0xb')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0xc')));_0x41f065=_['merge'](_0x41f065,require(_0x8c91('0xd')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0xe')));_0x41f065=_['merge'](_0x41f065,require(_0x8c91('0xf')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x10')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x11')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x12')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x13')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x14')));_0x41f065=_['merge'](_0x41f065,require(_0x8c91('0x15')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x16')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x17')));_0x41f065=_['merge'](_0x41f065,require('../api/smsQueue/smsQueue.rpc'));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x18')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x19')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x1a')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x1b')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require('../api/chatInteraction/chatInteraction.rpc'));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x1c')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require('../api/chatQueue/chatQueue.rpc'));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x1d')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x1e')));_0x41f065=_['merge'](_0x41f065,require('../api/cmHopperBlack/cmHopperBlack.rpc'));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require('../api/cmHopperFinal/cmHopperFinal.rpc'));_0x41f065=_['merge'](_0x41f065,require('../api/cmHopperHistory/cmHopperHistory.rpc'));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x1f')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x20')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require('../api/pause/pause.rpc'));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x21')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require('../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc'));_0x41f065=_['merge'](_0x41f065,require(_0x8c91('0x22')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x23')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x24')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x25')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x26')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x27')));_0x41f065=_['merge'](_0x41f065,require(_0x8c91('0x28')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x29')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x2a')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x2b')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x2c')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x2d')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x2e')));_0x41f065=_['merge'](_0x41f065,require(_0x8c91('0x2f')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x30')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x31')));_0x41f065=_['merge'](_0x41f065,require(_0x8c91('0x32')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x33')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x34')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require('../api/squareRecording/squareRecording.rpc'));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require('../api/squareMessage/squareMessage.rpc'));_0x41f065=_['merge'](_0x41f065,require(_0x8c91('0x35')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x36')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x37')));_0x41f065=_['merge'](_0x41f065,require(_0x8c91('0x38')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x39')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require('../api/whatsappMessage/whatsappMessage.rpc'));_0x41f065=_['merge'](_0x41f065,require(_0x8c91('0x3a')));_0x41f065=_[_0x8c91('0x3')](_0x41f065,require(_0x8c91('0x3b')));var _0x1ecbd6=jayson[_0x8c91('0x3c')](_0x41f065)[_0x8c91('0x3d')]();var _0x4c88ba=config[_0x8c91('0x3e')][_0x8c91('0x3f')]||config['port']+0x1;var _0x30d742=config['rpc']['ip']||_0x8c91('0x40');_0x1ecbd6['on'](_0x8c91('0x41'),function(_0xc1c556){return _0x9f4503(_0xc1c556);});_0x1ecbd6['listen'](_0x4c88ba,_0x30d742,function(){console[_0x8c91('0x42')](_0x8c91('0x43'),_0x30d742,_0x4c88ba);require(_0x8c91('0x44'))[_0x8c91('0x45')]();return _0x5b204b(_0x8c91('0x46')+_0x30d742+':'+_0x4c88ba);});});}; \ No newline at end of file +var _0x88c6=['localhost','error','Express\x20RPC\x20server\x20listening\x20on\x20%s:%d!','../config/triggers','default','jayson/promise','lodash','../config/environment','listen','merge','../api/user/user.rpc','../api/voiceExtension/voiceExtension.rpc','../api/voiceQueue/voiceQueue.rpc','../api/voiceRecording/voiceRecording.rpc','../api/voiceDialReport/voiceDialReport.rpc','../api/voiceQueueReport/voiceQueueReport.rpc','../api/trunk/trunk.rpc','../api/voiceTransferReport/voiceTransferReport.rpc','../api/mailServerIn/mailServerIn.rpc','../api/mailQueue/mailQueue.rpc','../api/mailApplication/mailApplication.rpc','../api/mailQueueReport/mailQueueReport.rpc','../api/faxApplication/faxApplication.rpc','../api/faxInteraction/faxInteraction.rpc','../api/faxMessage/faxMessage.rpc','../api/faxQueue/faxQueue.rpc','../api/faxQueueReport/faxQueueReport.rpc','../api/smsAccount/smsAccount.rpc','../api/smsInteraction/smsInteraction.rpc','../api/smsQueue/smsQueue.rpc','../api/openchannelApplication/openchannelApplication.rpc','../api/openchannelInteraction/openchannelInteraction.rpc','../api/openchannelMessage/openchannelMessage.rpc','../api/chatInteraction/chatInteraction.rpc','../api/chatMessage/chatMessage.rpc','../api/chatQueue/chatQueue.rpc','../api/cmContact/cmContact.rpc','../api/cmHopper/cmHopper.rpc','../api/cmHopperBlack/cmHopperBlack.rpc','../api/cmHopperFinal/cmHopperFinal.rpc','../api/cmHopperHistory/cmHopperHistory.rpc','../api/reportAgentPreview/reportAgentPreview.rpc','../api/interval/interval.rpc','../api/pause/pause.rpc','../api/sound/sound.rpc','../api/cmHopperAdditionalPhone/cmHopperAdditionalPhone.rpc','../api/variable/variable.rpc','../api/intSugarcrmAccount/intSugarcrmAccount.rpc','../api/intDeskAccount/intDeskAccount.rpc','../api/intFreshdeskAccount/intFreshdeskAccount.rpc','../api/intVtigerAccount/intVtigerAccount.rpc','../api/intServicenowAccount/intServicenowAccount.rpc','../api/chatQueueReport/chatQueueReport.rpc','../api/smsQueueReport/smsQueueReport.rpc','../api/squareReport/squareReport.rpc','../api/squareReportDetail/squareReportDetail.rpc','../api/setting/setting.rpc','../api/squareOdbc/squareOdbc.rpc','../api/squareRecording/squareRecording.rpc','../api/squareMessage/squareMessage.rpc','../api/campaign/campaign.rpc','../api/plugin/plugin.rpc','../api/whatsappAccount/whatsappAccount.rpc','../api/whatsappInteraction/whatsappInteraction.rpc','../api/whatsappMessage/whatsappMessage.rpc','../api/whatsappQueueReport/whatsappQueueReport.rpc','../api/whatsappQueue/whatsappQueue.rpc','http','rpc','port'];(function(_0x215e65,_0x183f97){var _0xa85842=function(_0x43bf45){while(--_0x43bf45){_0x215e65['push'](_0x215e65['shift']());}};_0xa85842(++_0x183f97);}(_0x88c6,0x163));var _0x688c=function(_0xe7d561,_0x146cef){_0xe7d561=_0xe7d561-0x0;var _0x4c27f0=_0x88c6[_0xe7d561];return _0x4c27f0;};'use strict';var jayson=require(_0x688c('0x0'));var _=require(_0x688c('0x1'));var config=require(_0x688c('0x2'));exports[_0x688c('0x3')]=function(){return new Promise(function(_0x5f1da0,_0x5e79e1){var _0x343bdd={};_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x5')));_0x343bdd=_['merge'](_0x343bdd,require(_0x688c('0x6')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x7')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x8')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/voiceCallReport/voiceCallReport.rpc'));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x9')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/voiceAgentReport/voiceAgentReport.rpc'));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0xa')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/memberReport/memberReport.rpc'));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0xb')));_0x343bdd=_['merge'](_0x343bdd,require(_0x688c('0xc')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/userVoiceQueueRt/userVoiceQueueRt.rpc'));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0xd')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/mailAccount/mailAccount.rpc'));_0x343bdd=_['merge'](_0x343bdd,require(_0x688c('0xe')));_0x343bdd=_['merge'](_0x343bdd,require('../api/mailInteraction/mailInteraction.rpc'));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/mailMessage/mailMessage.rpc'));_0x343bdd=_['merge'](_0x343bdd,require(_0x688c('0xf')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x10')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/faxAccount/faxAccount.rpc'));_0x343bdd=_['merge'](_0x343bdd,require(_0x688c('0x11')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x12')));_0x343bdd=_['merge'](_0x343bdd,require(_0x688c('0x13')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x14')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x15')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x16')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x17')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/smsMessage/smsMessage.rpc'));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x18')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x19')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x1a')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x1b')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/openchannelQueue/openchannelQueue.rpc'));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/openchannelQueueReport/openchannelQueueReport.rpc'));_0x343bdd=_['merge'](_0x343bdd,require(_0x688c('0x1c')));_0x343bdd=_['merge'](_0x343bdd,require(_0x688c('0x1d')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x1e')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x1f')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x20')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x21')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x22')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x23')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x24')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x25')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x26')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x27')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x28')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/template/template.rpc'));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/trigger/trigger.rpc'));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x29')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/intSalesforceAccount/intSalesforceAccount.rpc'));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x2a')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x2b')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/intZohoAccount/intZohoAccount.rpc'));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/intZendeskAccount/intZendeskAccount.rpc'));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x2c')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x2d')));_0x343bdd=_['merge'](_0x343bdd,require(_0x688c('0x2e')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/intDynamics365Account/intDynamics365Account.rpc'));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/intFreshsalesAccount/intFreshsalesAccount.rpc'));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x2f')));_0x343bdd=_['merge'](_0x343bdd,require(_0x688c('0x30')));_0x343bdd=_['merge'](_0x343bdd,require(_0x688c('0x31')));_0x343bdd=_['merge'](_0x343bdd,require(_0x688c('0x32')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x33')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x34')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/squareProject/squareProject.rpc'));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x35')));_0x343bdd=_['merge'](_0x343bdd,require(_0x688c('0x36')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x37')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require('../api/attachment/attachment.rpc'));_0x343bdd=_['merge'](_0x343bdd,require(_0x688c('0x38')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x39')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x3a')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x3b')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x3c')));_0x343bdd=_[_0x688c('0x4')](_0x343bdd,require(_0x688c('0x3d')));var _0xd8ce59=jayson['server'](_0x343bdd)[_0x688c('0x3e')]();var _0x9ad29c=config[_0x688c('0x3f')]['port']||config[_0x688c('0x40')]+0x1;var _0x4a78be=config[_0x688c('0x3f')]['ip']||_0x688c('0x41');_0xd8ce59['on'](_0x688c('0x42'),function(_0x458643){return _0x5e79e1(_0x458643);});_0xd8ce59['listen'](_0x9ad29c,_0x4a78be,function(){console['log'](_0x688c('0x43'),_0x4a78be,_0x9ad29c);require(_0x688c('0x44'))[_0x688c('0x45')]();return _0x5f1da0('RPC\x20listening\x20on\x20'+_0x4a78be+':'+_0x9ad29c);});});}; \ No newline at end of file diff --git a/server/services/agi/channel.js b/server/services/agi/channel.js index 44a0ef8..7ea3ca7 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 _0x3be6=['toString','SET\x20VARIABLE\x20%s\x20\x22%s\x22','sayNumber','sayDigits','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','extension','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','BEEP','RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s','streamFile','STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22','wait','ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','exports','util','lodash','EventEmitter','./reply','./error','setEncoding','utf8','emit','ready','line','toLowerCase','hangup','substring','520-Invalid','search','function','replace','result=','substr','indexOf','startsWith','length','match','error','code','close','E_AGI_SOCKET_CLOSE','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','inherits','prototype','sendRequest','sync','answer','ANSWER','getData','beep','format','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','VERBOSE\x20\x22%s\x22','exec','isArray','EXEC\x20%s\x20%s','setContext','setExtension','SET\x20EXTENSION\x20%s','setPriority','SET\x20PRIORITY\x20%s','HANGUP','setVariable','isBoolean','isNumber'];(function(_0xeec781,_0xe1f5f4){var _0x1e1efc=function(_0x25839c){while(--_0x25839c){_0xeec781['push'](_0xeec781['shift']());}};_0x1e1efc(++_0xe1f5f4);}(_0x3be6,0x13a));var _0x63be=function(_0x108db1,_0x89896d){_0x108db1=_0x108db1-0x0;var _0x16848d=_0x3be6[_0x108db1];return _0x16848d;};'use strict';var util=require(_0x63be('0x0'));var _=require(_0x63be('0x1'));var EventEmitter=require('events')[_0x63be('0x2')];var AGIReply=require(_0x63be('0x3'));var AGIError=require(_0x63be('0x4'));function AGIChannel(_0x1871e9){var _0x46c71b=this,_0x16e9eb=new AGIReply(),_0x16b348=![],_0x43f34a={};EventEmitter['call'](_0x46c71b);_0x1871e9[_0x63be('0x5')](_0x63be('0x6'));_0x1871e9['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x16e9eb[_0x63be('0x5')](_0x63be('0x6'));_0x16e9eb['on']('headers',function(_0x1b65bb){for(var _0x3a257a in _0x1b65bb){_0x46c71b[_0x3a257a]=_0x1b65bb[_0x3a257a];}_0x46c71b[_0x63be('0x7')](_0x63be('0x8'));});_0x16e9eb['on'](_0x63be('0x9'),function(_0x46c770){if(_0x46c770[_0x63be('0xa')]()==_0x63be('0xb')){_0x46c71b[_0x63be('0x7')](_0x63be('0xb'));return;}if(_0x46c770[_0x63be('0xc')](0x0,0xb)==_0x63be('0xd')){_0x16b348=!![];}if(_0x16b348){_0x43f34a['rx']+=_0x46c770+'\x0a';if(_0x46c770[_0x63be('0xe')]('520\x20End\x20of\x20proper')!=-0x1){_0x16b348=![];}}else{_0x43f34a['rx']=_0x46c770;}if(_0x16b348){return;}if(typeof _0x43f34a['cb']==_0x63be('0xf')){var _0x5c9a24=_0x43f34a['rx'][_0x63be('0xc')](0x0,0x3),_0x3eae71=null,_0x40929b=null;_0x5c9a24=parseInt(_0x5c9a24);if(isNaN(_0x5c9a24)){_0x43f34a['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x5c9a24!=0xc8){_0x43f34a['cb'](null,{'code':_0x5c9a24,'result':-0x1,'extra':'KO'});return;}_0x3eae71=_0x43f34a['rx']['substring'](0x4)[_0x63be('0x10')](_0x63be('0x11'),'');if(_0x3eae71['indexOf']('\x20')!=-0x1){_0x3eae71=_0x3eae71[_0x63be('0x12')](0x0,_0x3eae71[_0x63be('0x13')]('\x20'));}if(_[_0x63be('0x14')](_0x3eae71,'-1')){_0x3eae71=parseInt(_0x3eae71);}_0x40929b=_0x43f34a['rx']['split']('\x20');if(_0x40929b['length']==0x3){_0x40929b=_0x40929b[0x2][_0x63be('0xc')](0x1,_0x40929b[0x2][_0x63be('0x15')]-0x1);}else if(_0x40929b[_0x63be('0x15')]>0x3){var _0x75efdb=/\((.+)\)/;var _0x5cdb91=_0x43f34a['rx'][_0x63be('0x16')](_0x75efdb);if(_0x5cdb91){_0x40929b=_0x5cdb91[0x1];}else{_0x40929b=null;}}else{_0x40929b=null;}_0x43f34a['cb'](null,{'code':_0x5c9a24,'result':_0x3eae71,'extra':_0x40929b});}});_0x1871e9['on'](_0x63be('0x17'),function(_0x501c76){_0x46c71b['emit'](_0x63be('0x17'),new AGIError('E_AGI_SOCKET_ERROR',_0x501c76[_0x63be('0x18')]));});_0x1871e9['on'](_0x63be('0x19'),function(){_0x46c71b[_0x63be('0x7')](_0x63be('0x19'),new AGIError(_0x63be('0x1a')));});_0x1871e9['on']('timeout',function(){_0x46c71b['emit']('timeout',new AGIError(_0x63be('0x1b')));_0x1871e9[_0x63be('0x1c')]();});_0x1871e9[_0x63be('0x1d')](_0x16e9eb);this[_0x63be('0x1e')]=function(_0x237837,_0x299033){var _0x237837=_0x237837||'',_0x299033=typeof _0x299033=='function'?_0x299033:new Function();_0x43f34a={'tx':_0x237837,'rx':'','cb':_0x299033};_0x1871e9['write'](_0x237837+'\x0a');},this[_0x63be('0x19')]=function(){_0x1871e9[_0x63be('0x1c')]();};}util[_0x63be('0x1f')](AGIChannel,EventEmitter);AGIChannel[_0x63be('0x20')][_0x63be('0x21')]=function(_0x50c4f5){return this['command'][_0x63be('0x22')](this,_0x50c4f5);};AGIChannel[_0x63be('0x20')][_0x63be('0x23')]=function(){return this[_0x63be('0x21')](_0x63be('0x24'));};AGIChannel[_0x63be('0x20')][_0x63be('0x25')]=function(_0x5e7ccb,_0x481699,_0x24b7ce){_0x5e7ccb=_0x5e7ccb===undefined?_0x63be('0x26'):_0x5e7ccb;_0x481699=_0x481699===undefined?'5':_0x481699;_0x24b7ce=_0x24b7ce===undefined?'1':_0x24b7ce;return this[_0x63be('0x21')](util[_0x63be('0x27')](_0x63be('0x28'),_0x5e7ccb,_0x481699*0x3e8,_0x24b7ce));};AGIChannel[_0x63be('0x20')][_0x63be('0x29')]=function(_0x2d4e58){_0x2d4e58=_0x2d4e58||_0x63be('0x2a');return this['sendRequest'](util['format'](_0x63be('0x2b'),_0x2d4e58));};AGIChannel[_0x63be('0x20')][_0x63be('0x2c')]=function(_0x1c7756,_0x31a7cb){if(_[_0x63be('0x2d')](_0x31a7cb)){return this[_0x63be('0x21')](util[_0x63be('0x27')](_0x63be('0x2e'),_0x1c7756,_0x31a7cb['join'](',')));}return this[_0x63be('0x21')](util['format'](_0x63be('0x2e'),_0x1c7756,_0x31a7cb));};AGIChannel[_0x63be('0x20')][_0x63be('0x2f')]=function(_0x3ea472){return this[_0x63be('0x21')](util[_0x63be('0x27')]('SET\x20CONTEXT\x20%s',_0x3ea472));};AGIChannel[_0x63be('0x20')][_0x63be('0x30')]=function(_0x4d5215){return this['sendRequest'](util['format'](_0x63be('0x31'),_0x4d5215));};AGIChannel['prototype'][_0x63be('0x32')]=function(_0x4da53c){return this[_0x63be('0x21')](util['format'](_0x63be('0x33'),_0x4da53c));};AGIChannel[_0x63be('0x20')][_0x63be('0xb')]=function(){return this['sendRequest'](_0x63be('0x34'));};AGIChannel[_0x63be('0x20')][_0x63be('0x35')]=function(_0x3bf08c,_0x327312){var _0x46e54f=_[_0x63be('0x36')](_0x327312)||_[_0x63be('0x37')](_0x327312)?_0x327312[_0x63be('0x38')]():_0x327312;return this['sendRequest'](util['format'](_0x63be('0x39'),_0x3bf08c,_0x46e54f?_0x46e54f[_0x63be('0x38')]()[_0x63be('0x10')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel[_0x63be('0x20')][_0x63be('0x3a')]=function(_0x111337,_0x639481){return this[_0x63be('0x21')](util[_0x63be('0x27')]('SAY\x20NUMBER\x20%s\x20%s',_0x111337,_0x639481));};AGIChannel['prototype'][_0x63be('0x3b')]=function(_0x10d42e,_0x4b773c){return this[_0x63be('0x21')](util[_0x63be('0x27')]('SAY\x20DIGITS\x20%s\x20%s',_0x10d42e,_0x4b773c));};AGIChannel[_0x63be('0x20')]['sayPhonetic']=function(_0x1102a0,_0x7605cf){return this[_0x63be('0x21')](util['format'](_0x63be('0x3c'),_0x1102a0,_0x7605cf));};AGIChannel[_0x63be('0x20')]['continueAt']=function(_0x55b7c4,_0x38154a,_0x354ba9){_0x38154a=_0x38154a||this[_0x63be('0x3d')];_0x354ba9=_0x354ba9||0x1;this[_0x63be('0x2f')](_0x55b7c4);this['setExtension'](_0x38154a);this[_0x63be('0x32')](_0x354ba9);return this[_0x63be('0x29')](util[_0x63be('0x27')]('GOTO\x20%s\x20%s\x20%s',_0x55b7c4,_0x38154a,_0x354ba9));};AGIChannel[_0x63be('0x20')][_0x63be('0x3e')]=function(_0x3b05cb){return this['sendRequest'](util[_0x63be('0x27')](_0x63be('0x3f'),_0x3b05cb));};AGIChannel[_0x63be('0x20')][_0x63be('0x40')]=function(_0x2e95c9,_0x5128ee,_0x1d8efa,_0x252c04,_0x2e5995,_0x2df8f9){_0x5128ee=_0x5128ee||_0x63be('0x41');_0x1d8efa=_0x1d8efa||'';_0x252c04=_0x252c04===undefined?-0x1:_0x252c04==='-1'?-0x1:_0x252c04*0x3e8;_0x2e5995=_0x2e5995===undefined?'':'s='+_0x2e5995;_0x2df8f9=_0x2df8f9?_0x63be('0x42'):'';return this[_0x63be('0x21')](util[_0x63be('0x27')](_0x63be('0x43'),_0x2e95c9,_0x5128ee,_0x1d8efa,_0x252c04,_0x2df8f9,_0x2e5995));};AGIChannel[_0x63be('0x20')][_0x63be('0x44')]=function(_0x80b320,_0x2bb4cb){_0x2bb4cb=_0x2bb4cb||'';return this[_0x63be('0x21')](util['format'](_0x63be('0x45'),_0x80b320,_0x2bb4cb));};AGIChannel[_0x63be('0x20')]['agi']=function(_0x210784){return this[_0x63be('0x2c')]('AGI',_0x210784);};AGIChannel[_0x63be('0x20')][_0x63be('0x46')]=function(_0x389450){return this[_0x63be('0x2c')]('WAIT',_0x389450);};AGIChannel['prototype'][_0x63be('0x17')]=function(_0x140741,_0x371ce6){this['noop'](util[_0x63be('0x27')](_0x63be('0x47'),_0x140741['id'],_0x140741[_0x63be('0x48')],_0x371ce6));return{'code':0x1f4,'result':'-1','extra':''};};module[_0x63be('0x49')]=AGIChannel; \ No newline at end of file +var _0xf4f3=['ID:%s\x20-\x20LABEL:\x20%s\x20-\x20MSG:\x20%s','label','events','EventEmitter','./reply','./error','call','setEncoding','utf8','headers','toLowerCase','hangup','emit','substring','520-Invalid','search','replace','result=','indexOf','substr','split','length','match','error','E_AGI_SOCKET_ERROR','code','close','E_AGI_SOCKET_CLOSE','timeout','E_AGI_SOCKET_TIMEOUT','destroy','pipe','command','function','inherits','prototype','sendRequest','answer','ANSWER','getData','GET\x20DATA\x20\x22%s\x22\x20%s\x20%s','noop','NO\x20MESSAGE','format','exec','isArray','EXEC\x20%s\x20%s','join','SET\x20CONTEXT\x20%s','setExtension','setPriority','SET\x20PRIORITY\x20%s','HANGUP','isBoolean','isNumber','SET\x20VARIABLE\x20%s\x20\x22%s\x22','toString','sayNumber','SAY\x20NUMBER\x20%s\x20%s','sayDigits','sayPhonetic','SAY\x20PHONETIC\x20\x22%s\x22\x20%s','continueAt','GOTO\x20%s\x20%s\x20%s','getVariable','GET\x20VARIABLE\x20\x22%s\x22','recordFile','wav','streamFile','agi','AGI','WAIT'];(function(_0x457385,_0x97b8c9){var _0x2b4057=function(_0x443cef){while(--_0x443cef){_0x457385['push'](_0x457385['shift']());}};_0x2b4057(++_0x97b8c9);}(_0xf4f3,0x1b2));var _0x3f4f=function(_0x9c27f4,_0x18796b){_0x9c27f4=_0x9c27f4-0x0;var _0x455e06=_0xf4f3[_0x9c27f4];return _0x455e06;};'use strict';var util=require('util');var _=require('lodash');var EventEmitter=require(_0x3f4f('0x0'))[_0x3f4f('0x1')];var AGIReply=require(_0x3f4f('0x2'));var AGIError=require(_0x3f4f('0x3'));function AGIChannel(_0x529fea){var _0x2bad6a=this,_0x5864bf=new AGIReply(),_0x11893f=![],_0x38eb2d={};EventEmitter[_0x3f4f('0x4')](_0x2bad6a);_0x529fea[_0x3f4f('0x5')]('utf8');_0x529fea['setTimeout'](0x8*0x3c*0x3c*0x3e8);_0x5864bf[_0x3f4f('0x5')](_0x3f4f('0x6'));_0x5864bf['on'](_0x3f4f('0x7'),function(_0x4a1c6d){for(var _0x4e85d6 in _0x4a1c6d){_0x2bad6a[_0x4e85d6]=_0x4a1c6d[_0x4e85d6];}_0x2bad6a['emit']('ready');});_0x5864bf['on']('line',function(_0x30eec5){if(_0x30eec5[_0x3f4f('0x8')]()==_0x3f4f('0x9')){_0x2bad6a[_0x3f4f('0xa')]('hangup');return;}if(_0x30eec5[_0x3f4f('0xb')](0x0,0xb)==_0x3f4f('0xc')){_0x11893f=!![];}if(_0x11893f){_0x38eb2d['rx']+=_0x30eec5+'\x0a';if(_0x30eec5[_0x3f4f('0xd')]('520\x20End\x20of\x20proper')!=-0x1){_0x11893f=![];}}else{_0x38eb2d['rx']=_0x30eec5;}if(_0x11893f){return;}if(typeof _0x38eb2d['cb']=='function'){var _0x48941f=_0x38eb2d['rx'][_0x3f4f('0xb')](0x0,0x3),_0x39b039=null,_0x596161=null;_0x48941f=parseInt(_0x48941f);if(isNaN(_0x48941f)){_0x38eb2d['cb'](null,{'code':0x1f4,'result':-0x1,'extra':'no\x20code'});return;}if(_0x48941f!=0xc8){_0x38eb2d['cb'](null,{'code':_0x48941f,'result':-0x1,'extra':'KO'});return;}_0x39b039=_0x38eb2d['rx'][_0x3f4f('0xb')](0x4)[_0x3f4f('0xe')](_0x3f4f('0xf'),'');if(_0x39b039[_0x3f4f('0x10')]('\x20')!=-0x1){_0x39b039=_0x39b039[_0x3f4f('0x11')](0x0,_0x39b039[_0x3f4f('0x10')]('\x20'));}if(_['startsWith'](_0x39b039,'-1')){_0x39b039=parseInt(_0x39b039);}_0x596161=_0x38eb2d['rx'][_0x3f4f('0x12')]('\x20');if(_0x596161['length']==0x3){_0x596161=_0x596161[0x2][_0x3f4f('0xb')](0x1,_0x596161[0x2][_0x3f4f('0x13')]-0x1);}else if(_0x596161['length']>0x3){var _0x258220=/\((.+)\)/;var _0x289d94=_0x38eb2d['rx'][_0x3f4f('0x14')](_0x258220);if(_0x289d94){_0x596161=_0x289d94[0x1];}else{_0x596161=null;}}else{_0x596161=null;}_0x38eb2d['cb'](null,{'code':_0x48941f,'result':_0x39b039,'extra':_0x596161});}});_0x529fea['on'](_0x3f4f('0x15'),function(_0x2b406c){_0x2bad6a['emit'](_0x3f4f('0x15'),new AGIError(_0x3f4f('0x16'),_0x2b406c[_0x3f4f('0x17')]));});_0x529fea['on'](_0x3f4f('0x18'),function(){_0x2bad6a[_0x3f4f('0xa')](_0x3f4f('0x18'),new AGIError(_0x3f4f('0x19')));});_0x529fea['on'](_0x3f4f('0x1a'),function(){_0x2bad6a['emit'](_0x3f4f('0x1a'),new AGIError(_0x3f4f('0x1b')));_0x529fea[_0x3f4f('0x1c')]();});_0x529fea[_0x3f4f('0x1d')](_0x5864bf);this[_0x3f4f('0x1e')]=function(_0x2745af,_0x4933d2){var _0x2745af=_0x2745af||'',_0x4933d2=typeof _0x4933d2==_0x3f4f('0x1f')?_0x4933d2:new Function();_0x38eb2d={'tx':_0x2745af,'rx':'','cb':_0x4933d2};_0x529fea['write'](_0x2745af+'\x0a');},this[_0x3f4f('0x18')]=function(){_0x529fea[_0x3f4f('0x1c')]();};}util[_0x3f4f('0x20')](AGIChannel,EventEmitter);AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x22')]=function(_0x28a7ec){return this[_0x3f4f('0x1e')]['sync'](this,_0x28a7ec);};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x23')]=function(){return this[_0x3f4f('0x22')](_0x3f4f('0x24'));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x25')]=function(_0x48e3b5,_0x57d3ae,_0x3fb7d9){_0x48e3b5=_0x48e3b5===undefined?'beep':_0x48e3b5;_0x57d3ae=_0x57d3ae===undefined?'5':_0x57d3ae;_0x3fb7d9=_0x3fb7d9===undefined?'1':_0x3fb7d9;return this[_0x3f4f('0x22')](util['format'](_0x3f4f('0x26'),_0x48e3b5,_0x57d3ae*0x3e8,_0x3fb7d9));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x27')]=function(_0x2e40ad){_0x2e40ad=_0x2e40ad||_0x3f4f('0x28');return this[_0x3f4f('0x22')](util[_0x3f4f('0x29')]('VERBOSE\x20\x22%s\x22',_0x2e40ad));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x2a')]=function(_0x221f70,_0x1d28c0){if(_[_0x3f4f('0x2b')](_0x1d28c0)){return this['sendRequest'](util[_0x3f4f('0x29')](_0x3f4f('0x2c'),_0x221f70,_0x1d28c0[_0x3f4f('0x2d')](',')));}return this['sendRequest'](util[_0x3f4f('0x29')](_0x3f4f('0x2c'),_0x221f70,_0x1d28c0));};AGIChannel[_0x3f4f('0x21')]['setContext']=function(_0x3eba08){return this[_0x3f4f('0x22')](util[_0x3f4f('0x29')](_0x3f4f('0x2e'),_0x3eba08));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x2f')]=function(_0x54ca1a){return this[_0x3f4f('0x22')](util[_0x3f4f('0x29')]('SET\x20EXTENSION\x20%s',_0x54ca1a));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x30')]=function(_0x3dd795){return this['sendRequest'](util[_0x3f4f('0x29')](_0x3f4f('0x31'),_0x3dd795));};AGIChannel['prototype']['hangup']=function(){return this[_0x3f4f('0x22')](_0x3f4f('0x32'));};AGIChannel['prototype']['setVariable']=function(_0xcec8e3,_0x5a3027){var _0x424817=_[_0x3f4f('0x33')](_0x5a3027)||_[_0x3f4f('0x34')](_0x5a3027)?_0x5a3027['toString']():_0x5a3027;return this[_0x3f4f('0x22')](util['format'](_0x3f4f('0x35'),_0xcec8e3,_0x424817?_0x424817[_0x3f4f('0x36')]()[_0x3f4f('0xe')](/(\r\n|\n|\r)/gm,'\x20'):''));};AGIChannel['prototype'][_0x3f4f('0x37')]=function(_0x3869aa,_0x1118d0){return this[_0x3f4f('0x22')](util['format'](_0x3f4f('0x38'),_0x3869aa,_0x1118d0));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x39')]=function(_0x507f51,_0x559fd0){return this[_0x3f4f('0x22')](util[_0x3f4f('0x29')]('SAY\x20DIGITS\x20%s\x20%s',_0x507f51,_0x559fd0));};AGIChannel['prototype'][_0x3f4f('0x3a')]=function(_0x2678b4,_0x39463d){return this[_0x3f4f('0x22')](util[_0x3f4f('0x29')](_0x3f4f('0x3b'),_0x2678b4,_0x39463d));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x3c')]=function(_0x364ee4,_0x1532d4,_0x31fa20){_0x1532d4=_0x1532d4||this['extension'];_0x31fa20=_0x31fa20||0x1;this['setContext'](_0x364ee4);this[_0x3f4f('0x2f')](_0x1532d4);this['setPriority'](_0x31fa20);return this['noop'](util[_0x3f4f('0x29')](_0x3f4f('0x3d'),_0x364ee4,_0x1532d4,_0x31fa20));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x3e')]=function(_0x395f6e){return this[_0x3f4f('0x22')](util['format'](_0x3f4f('0x3f'),_0x395f6e));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x40')]=function(_0x1bc510,_0x21bdd5,_0x3a5dcf,_0x6049a4,_0x3fd82a,_0x11308a){_0x21bdd5=_0x21bdd5||_0x3f4f('0x41');_0x3a5dcf=_0x3a5dcf||'';_0x6049a4=_0x6049a4===undefined?-0x1:_0x6049a4==='-1'?-0x1:_0x6049a4*0x3e8;_0x3fd82a=_0x3fd82a===undefined?'':'s='+_0x3fd82a;_0x11308a=_0x11308a?'BEEP':'';return this[_0x3f4f('0x22')](util[_0x3f4f('0x29')]('RECORD\x20FILE\x20\x22%s\x22\x20\x22%s\x22\x20\x22%s\x22\x20%s\x20%s\x20%s',_0x1bc510,_0x21bdd5,_0x3a5dcf,_0x6049a4,_0x11308a,_0x3fd82a));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x42')]=function(_0x10394c,_0x32bbdf){_0x32bbdf=_0x32bbdf||'';return this[_0x3f4f('0x22')](util[_0x3f4f('0x29')]('STREAM\x20FILE\x20\x22%s\x22\x20\x22%s\x22',_0x10394c,_0x32bbdf));};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x43')]=function(_0x2ce0b7){return this[_0x3f4f('0x2a')](_0x3f4f('0x44'),_0x2ce0b7);};AGIChannel[_0x3f4f('0x21')]['wait']=function(_0x56a951){return this[_0x3f4f('0x2a')](_0x3f4f('0x45'),_0x56a951);};AGIChannel[_0x3f4f('0x21')][_0x3f4f('0x15')]=function(_0x448eb4,_0x4d7949){this[_0x3f4f('0x27')](util['format'](_0x3f4f('0x46'),_0x448eb4['id'],_0x448eb4[_0x3f4f('0x47')],_0x4d7949));return{'code':0x1f4,'result':'-1','extra':''};};module['exports']=AGIChannel; \ No newline at end of file diff --git a/server/services/agi/error.js b/server/services/agi/error.js index 73d12af..e5fdca5 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 _0xc07d=['Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','Server\x20closed.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Socket\x20timeout.','Empty\x20command.','Missing\x20\x27ivr.agi_network_script\x27.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push','apply','message','name','exports','util'];(function(_0x4671bf,_0x3fafb2){var _0x189511=function(_0x409823){while(--_0x409823){_0x4671bf['push'](_0x4671bf['shift']());}};_0x189511(++_0x3fafb2);}(_0xc07d,0x19d));var _0xdc07=function(_0x491b1a,_0x1f2d5d){_0x491b1a=_0x491b1a-0x0;var _0x10da68=_0xc07d[_0x491b1a];return _0x10da68;};'use strict';var util=require(_0xdc07('0x0'));var error={'E_AGI_UNDEFINED':_0xdc07('0x1'),'E_AGI_ARGUMENT_PORT':_0xdc07('0x2'),'E_AGI_SERVER_ERROR':_0xdc07('0x3'),'E_AGI_SERVER_CLOSE':_0xdc07('0x4'),'E_AGI_SERVER_MAXCONNECTION':_0xdc07('0x5'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0xdc07('0x6'),'E_AGI_SOCKET_CLOSE':_0xdc07('0x7'),'E_AGI_SOCKET_TIMEOUT':_0xdc07('0x8'),'E_AGI_COMMAND_EMPTY':_0xdc07('0x9'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':_0xdc07('0xa'),'E_AGI_IVR_ENTRY':_0xdc07('0xb')};function AGIError(_0x23fad2){var _0x23fad2=_0x23fad2||null,_0x1d0fe8=_0x1d0fe8||[],_0x564fe=0x1,_0x41aba1='';if(!error[_0x23fad2]){_0x23fad2=_0xdc07('0xc');}_0x1d0fe8['push'](error[_0x23fad2]);while(arguments[_0x564fe]){_0x1d0fe8[_0xdc07('0xd')](arguments[_0x564fe]);_0x564fe++;}_0x41aba1=util['format'][_0xdc07('0xe')](util,_0x1d0fe8);this[_0xdc07('0xf')]=_0x41aba1;this[_0xdc07('0x10')]=_0x23fad2;}module[_0xdc07('0x11')]=AGIError; \ No newline at end of file +var _0x85c4=['apply','message','name','util','Undefined\x20error.','Argument\x20\x27port\x27\x20missing\x20in\x20function\x20call.','Server\x20error.\x20Code:\x20%s.','[LICENSE]\x20Server\x20max\x20connection.\x20Count:\x20%s.','Socket\x20error.\x20Code:\x20%s.','Socket\x20closed.','Empty\x20command.','Missing\x20\x27ivr.entry\x27\x20menu.','E_AGI_UNDEFINED','push'];(function(_0x4b0290,_0x188c34){var _0x4bd9f4=function(_0x357f3f){while(--_0x357f3f){_0x4b0290['push'](_0x4b0290['shift']());}};_0x4bd9f4(++_0x188c34);}(_0x85c4,0x10d));var _0x485c=function(_0x193ddf,_0x6f30bb){_0x193ddf=_0x193ddf-0x0;var _0x5bc6df=_0x85c4[_0x193ddf];return _0x5bc6df;};'use strict';var util=require(_0x485c('0x0'));var error={'E_AGI_UNDEFINED':_0x485c('0x1'),'E_AGI_ARGUMENT_PORT':_0x485c('0x2'),'E_AGI_SERVER_ERROR':_0x485c('0x3'),'E_AGI_SERVER_CLOSE':'Server\x20closed.','E_AGI_SERVER_MAXCONNECTION':_0x485c('0x4'),'E_AGI_SERVER_VOICE_DISABLED':'[LICENSE\x20VOICE]\x20Server\x20license\x20voice\x20disabled.','E_AGI_SOCKET_ERROR':_0x485c('0x5'),'E_AGI_SOCKET_CLOSE':_0x485c('0x6'),'E_AGI_SOCKET_TIMEOUT':'Socket\x20timeout.','E_AGI_COMMAND_EMPTY':_0x485c('0x7'),'E_AGI_IVR_AGI_NETWORK_SCRIPT':'Missing\x20\x27ivr.agi_network_script\x27.','E_AGI_IVR_ENTRY':_0x485c('0x8')};function AGIError(_0x554e82){var _0x554e82=_0x554e82||null,_0x9d40b6=_0x9d40b6||[],_0x3c4ab6=0x1,_0x1f5053='';if(!error[_0x554e82]){_0x554e82=_0x485c('0x9');}_0x9d40b6[_0x485c('0xa')](error[_0x554e82]);while(arguments[_0x3c4ab6]){_0x9d40b6[_0x485c('0xa')](arguments[_0x3c4ab6]);_0x3c4ab6++;}_0x1f5053=util['format'][_0x485c('0xb')](util,_0x9d40b6);this[_0x485c('0xc')]=_0x1f5053;this[_0x485c('0xd')]=_0x554e82;}module['exports']=AGIError; \ No newline at end of file diff --git a/server/services/agi/events.js b/server/services/agi/events.js index 86b5e96..84103b0 100644 --- a/server/services/agi/events.js +++ b/server/services/agi/events.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9aca=['projectUpdate','exports','lodash','events','EventEmitter','ioredis','./error','redis','localhost','subscribe','agi','emit','error','E_AGI_SERVER_ERROR','message','parse'];(function(_0x2c4832,_0x23b1f2){var _0xa91472=function(_0x2b9413){while(--_0x2b9413){_0x2c4832['push'](_0x2c4832['shift']());}};_0xa91472(++_0x23b1f2);}(_0x9aca,0xf2));var _0xa9ac=function(_0x3d9564,_0x3031d2){_0x3d9564=_0x3d9564-0x0;var _0x571ff3=_0x9aca[_0x3d9564];return _0x571ff3;};'use strict';var _=require(_0xa9ac('0x0'));var EventEmitter=require(_0xa9ac('0x1'))[_0xa9ac('0x2')];var Redis=require(_0xa9ac('0x3'));var AGIError=require(_0xa9ac('0x4'));var config=require('../../config/environment');config[_0xa9ac('0x5')]=_['defaults'](config[_0xa9ac('0x5')],{'host':_0xa9ac('0x6'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0xa9ac('0x5')]);sub[_0xa9ac('0x7')](_0xa9ac('0x8'),function(_0x4014f0){if(_0x4014f0)return eventEmitter[_0xa9ac('0x9')](_0xa9ac('0xa'),new AGIError(_0xa9ac('0xb'),_0x4014f0));});sub['on'](_0xa9ac('0xc'),function(_0x27814b,_0x80946a){if(_0x27814b!==_0xa9ac('0x8'))return;try{var _0xdd3df8=JSON[_0xa9ac('0xd')](_0x80946a);eventEmitter['emit'](_0xa9ac('0xe'),_0xdd3df8);}catch(_0x3808a9){eventEmitter[_0xa9ac('0x9')](_0xa9ac('0xa'),new AGIError(_0xa9ac('0xb'),_0x3808a9));}});module[_0xa9ac('0xf')]={'EventEmitter':eventEmitter}; \ No newline at end of file +var _0x88a7=['parse','projectUpdate','exports','lodash','events','ioredis','./error','localhost','redis','subscribe','emit','error','E_AGI_SERVER_ERROR','message','agi'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x88a7,0x198));var _0x788a=function(_0x44c742,_0x5d69a4){_0x44c742=_0x44c742-0x0;var _0x40fcf0=_0x88a7[_0x44c742];return _0x40fcf0;};'use strict';var _=require(_0x788a('0x0'));var EventEmitter=require(_0x788a('0x1'))['EventEmitter'];var Redis=require(_0x788a('0x2'));var AGIError=require(_0x788a('0x3'));var config=require('../../config/environment');config['redis']=_['defaults'](config['redis'],{'host':_0x788a('0x4'),'port':0x18eb});var eventEmitter=new EventEmitter();var sub=new Redis(config[_0x788a('0x5')]);sub[_0x788a('0x6')]('agi',function(_0x5a3e99){if(_0x5a3e99)return eventEmitter[_0x788a('0x7')](_0x788a('0x8'),new AGIError(_0x788a('0x9'),_0x5a3e99));});sub['on'](_0x788a('0xa'),function(_0x388de6,_0x23ee2d){if(_0x388de6!==_0x788a('0xb'))return;try{var _0x433938=JSON[_0x788a('0xc')](_0x23ee2d);eventEmitter[_0x788a('0x7')](_0x788a('0xd'),_0x433938);}catch(_0x591e0d){eventEmitter[_0x788a('0x7')]('error',new AGIError(_0x788a('0x9'),_0x591e0d));}});module[_0x788a('0xe')]={'EventEmitter':eventEmitter}; \ No newline at end of file diff --git a/server/services/agi/graph/index.js b/server/services/agi/graph/index.js index 42e6ab2..f5f790d 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 _0xb4b4=['default','traverseBFS','max\x20retry\x20reach','condition\x20not\x20found','../../../config/logger','agi','menu','getdigits','getsecretdigits','vertices','numberOfEdges','prototype','edges','addEdge','push','size','relations','getVertex','no\x20vertex\x20found','info','stop\x20traverse','length','condition','split','agicommand','vswitch','target'];(function(_0x55f3ec,_0x1d947b){var _0x338075=function(_0x2ce4cc){while(--_0x2ce4cc){_0x55f3ec['push'](_0x55f3ec['shift']());}};_0x338075(++_0x1d947b);}(_0xb4b4,0x163));var _0x4b4b=function(_0x3d42d8,_0x4cffaa){_0x3d42d8=_0x3d42d8-0x0;var _0x27fc41=_0xb4b4[_0x3d42d8];return _0x27fc41;};'use strict';var _=require('lodash');var logger=require(_0x4b4b('0x0'))(_0x4b4b('0x1'));var verticesWithRetry=[_0x4b4b('0x2'),_0x4b4b('0x3'),_0x4b4b('0x4')];var Graph=function(){this[_0x4b4b('0x5')]={};this['edges']={};this[_0x4b4b('0x6')]=0x0;};Graph[_0x4b4b('0x7')]['addVertex']=function(_0x21d489){this[_0x4b4b('0x5')][_0x21d489['id']]=_0x21d489;this[_0x4b4b('0x8')][_0x21d489['id']]=[];};Graph['prototype'][_0x4b4b('0x9')]=function(_0x45daf0,_0x2630f9,_0x48842f){this[_0x4b4b('0x8')][_0x45daf0][_0x4b4b('0xa')]({'target':_0x2630f9,'condition':_0x48842f});this['numberOfEdges']+=0x1;};Graph[_0x4b4b('0x7')][_0x4b4b('0xb')]=function(){return _[_0x4b4b('0xb')](this[_0x4b4b('0x5')]);};Graph[_0x4b4b('0x7')][_0x4b4b('0xc')]=function(){return this[_0x4b4b('0x6')];};Graph[_0x4b4b('0x7')][_0x4b4b('0xd')]=function(_0x3719c0){return this[_0x4b4b('0x5')][_0x3719c0];};Graph[_0x4b4b('0x7')]['traverseBFS']=function(_0x18ee49,_0x35c05e){if(!this['vertices'][_0x18ee49]){return logger['info'](_0x4b4b('0xe'));}var _0x1ea966=_0x35c05e(this[_0x4b4b('0x5')][_0x18ee49]);if(!_0x1ea966){return logger[_0x4b4b('0xf')](_0x4b4b('0x10'));}if(this[_0x4b4b('0x8')][_0x18ee49][_0x4b4b('0x11')]===0x0){return logger[_0x4b4b('0xf')]('no\x20edge/s\x20available');}for(var _0x6e4eae=0x0,_0x26cc07=[],_0x517a1a=![];_0x6e4eae\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','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','evtHangup','createSquareReport','then','agi_','debug','variables','stringify','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','find','handleNotFound','handleUnpublished','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20CHANNELS:\x20UNLIMITED','[LICENSE]\x20VOICE\x20IS\x20DISABLED','catch','[LICENSE]','finally','./server','listening','connection','lodash','syncho','util','../../config/environment','../../config/logger','agi','../../config/license/util','./events','EventEmitter','127.0.0.1','projectUpdate','nextTick','error','stack','findIndex','deleted','splice','push','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','port','info'];(function(_0x368f74,_0x545cf8){var _0x1c2f02=function(_0x35c2e8){while(--_0x35c2e8){_0x368f74['push'](_0x368f74['shift']());}};_0x1c2f02(++_0x545cf8);}(_0x872b,0x1c2));var _0xb872=function(_0x58f36a,_0x152045){_0x58f36a=_0x58f36a-0x0;var _0x1ed996=_0x872b[_0x58f36a];return _0x1ed996;};'use strict';var _=require(_0xb872('0x0'));var syncho=require(_0xb872('0x1'));var util=require(_0xb872('0x2'));var config=require(_0xb872('0x3'));var logger=require(_0xb872('0x4'))(_0xb872('0x5'));var utilLicense=require(_0xb872('0x6'));var rpc=require('./rpc');var Project=require('./project');var AGIEmitter=require(_0xb872('0x7'))[_0xb872('0x8')];var projects=[];config[_0xb872('0x5')]=_['defaults'](config[_0xb872('0x5')],{'ip':_0xb872('0x9'),'port':0x11dd});AGIEmitter['on'](_0xb872('0xa'),projectUpdateHandler);function connectionHandler(_0x8019dd){process[_0xb872('0xb')](function(){syncho(function(){try{setChannelVariables(_0x8019dd);agiHandler(_0x8019dd);}catch(_0x4fcb1c){logger[_0xb872('0xc')](_0x4fcb1c[_0xb872('0xd')]);}});});}function projectUpdateHandler(_0x4592a8){try{var _0x553d65=_[_0xb872('0xe')](projects,['id',_0x4592a8['id']]);if(_0x553d65>-0x1){if(_0x4592a8[_0xb872('0xf')]===!![]){projects[_0xb872('0x10')](_0x553d65,0x1);}else{projects[_0x553d65]=_0x4592a8;}}else{projects[_0xb872('0x11')](_0x4592a8);}}catch(_0x208a6c){logger['error'](_0x208a6c['stack']);}}function listeningHandler(){console[_0xb872('0x12')](_0xb872('0x13'),config[_0xb872('0x5')][_0xb872('0x14')]);logger[_0xb872('0x15')](util[_0xb872('0x16')](_0xb872('0x17'),config[_0xb872('0x5')]['ip'],config[_0xb872('0x5')][_0xb872('0x14')]));}function errorHandler(_0x13f11f){if(_0x13f11f&&_0x13f11f[_0xb872('0x18')]&&_0x13f11f[_0xb872('0x19')]){logger[_0xb872('0xc')](util[_0xb872('0x16')](_0xb872('0x1a'),_0x13f11f[_0xb872('0x18')],_0x13f11f[_0xb872('0x19')]));}else{logger[_0xb872('0xc')](util[_0xb872('0x16')](_0xb872('0x1b'),_0x13f11f['stack']));}}function closeHandler(){logger[_0xb872('0x15')](util['format'](_0xb872('0x1c'),this[_0xb872('0x1d')],this[_0xb872('0x1e')],this[_0xb872('0x1f')],this['dnid'],this[_0xb872('0x20')]));try{createSquareReport(this);}catch(_0x5650e2){logger['error'](_0x5650e2[_0xb872('0xd')]);}}function timeoutHandler(){logger[_0xb872('0x15')](util[_0xb872('0x16')](_0xb872('0x21'),this[_0xb872('0x1d')],this[_0xb872('0x1e')],this['callerid'],this[_0xb872('0x22')],this['uniqueid']));}function hangupHandler(){logger['info'](util[_0xb872('0x16')](_0xb872('0x23'),this['arg_1'],this[_0xb872('0x1e')],this[_0xb872('0x1f')],this[_0xb872('0x22')],this[_0xb872('0x20')]));this[_0xb872('0x24')]=!![];}function createSquareReport(_0x12aefa,_0x9c42d6){rpc[_0xb872('0x25')](_0x12aefa)[_0xb872('0x26')](function(_0x516438){if(_0x9c42d6){_0x9c42d6(null,_0x516438);}})['catch'](function(_0x327a96){if(_0x9c42d6){_0x9c42d6(null,_0x327a96);}});}function setChannelVariables(_0x44be3f){for(var _0x230c3e in _0x44be3f){if(_0x44be3f['hasOwnProperty'](_0x230c3e)){if(_0x230c3e['indexOf'](_0xb872('0x27'))===0x0){_0x44be3f[_0x230c3e['substring'](0x4)]=_0x44be3f[_0x230c3e];delete _0x44be3f[_0x230c3e];}}}}function agiHandler(_0x5da38f){logger[_0xb872('0x28')](_0xb872('0x29'),JSON[_0xb872('0x2a')](_0x5da38f,null,0x2));logger[_0xb872('0x15')](util['format'](_0xb872('0x2b'),_0x5da38f[_0xb872('0x1d')],_0x5da38f[_0xb872('0x1e')],_0x5da38f[_0xb872('0x1f')],_0x5da38f['dnid'],_0x5da38f['uniqueid']));_0x5da38f['on'](_0xb872('0xc'),errorHandler);_0x5da38f['on'](_0xb872('0x2c'),closeHandler);_0x5da38f['on']('timeout',timeoutHandler);_0x5da38f[_0xb872('0x24')]=![];_0x5da38f['on']('hangup',hangupHandler);var _0x19d331=_[_0xb872('0x2d')](projects,[_0xb872('0x18'),_0x5da38f[_0xb872('0x1d')]]);if(!_0x19d331)return Project[_0xb872('0x2e')](_0x5da38f);if(!_0x19d331['production'])return Project[_0xb872('0x2f')](_0x5da38f);return Project['initialize'](_0x19d331,_0x5da38f);}function main(){var _0x23cd09;return utilLicense['getLicense']()['then'](function(_0x561722){if(!_0x561722)return;if(_0x561722[_0xb872('0x30')]){if(_0x561722[_0xb872('0x31')]&&_0x561722['callysquare']>0x0){logger['info'](util[_0xb872('0x16')](_0xb872('0x32'),_0x561722['callysquare']));_0x23cd09=_0x561722[_0xb872('0x31')];}else{logger['info'](_0xb872('0x33'));}}else{logger[_0xb872('0x15')](_0xb872('0x34'));_0x23cd09=-0x1;}})[_0xb872('0x26')](function(){return Project['getAll']();})[_0xb872('0x26')](function(_0x4e404e){projects=_0x4e404e;return;})[_0xb872('0x35')](function(_0x3b1c0a){logger[_0xb872('0xc')](_0xb872('0x36'),_0x3b1c0a[_0xb872('0xd')]);})[_0xb872('0x37')](function(){var _0x5b4353=require(_0xb872('0x38'))(config[_0xb872('0x5')][_0xb872('0x14')],config[_0xb872('0x5')]['ip'],_0x23cd09);_0x5b4353['on'](_0xb872('0xc'),errorHandler);_0x5b4353['on'](_0xb872('0x39'),listeningHandler);_0x5b4353['on'](_0xb872('0x3a'),connectionHandler);_0x5b4353['on'](_0xb872('0x2c'),closeHandler);});}main(); \ No newline at end of file +var _0x6b4a=['nextTick','error','stack','deleted','log','Cally\x20Square\x20server\x20listening\x20on\x20port\x20%d!','info','port','name','message','[%s]\x20%s','format','[ERROR]\x20%s','[CLOSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','callerid','calleridname','uniqueid','[HANGUP]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','evtHangup','createSquareReport','then','catch','indexOf','substring','variables','[START]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','close','timeout','hangup','find','handleNotFound','production','initialize','getLicense','voice','callysquare','[LICENSE]\x20CHANNELS:\x20%s','[LICENSE]\x20VOICE\x20IS\x20DISABLED','getAll','finally','./server','connection','lodash','syncho','util','../../config/environment','../../config/logger','../../config/license/util','./project','./events','EventEmitter','agi','defaults','127.0.0.1','projectUpdate'];(function(_0x2558ee,_0x2a2574){var _0x431306=function(_0x32cb67){while(--_0x32cb67){_0x2558ee['push'](_0x2558ee['shift']());}};_0x431306(++_0x2a2574);}(_0x6b4a,0x65));var _0xa6b4=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x6b4a[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xa6b4('0x0'));var syncho=require(_0xa6b4('0x1'));var util=require(_0xa6b4('0x2'));var config=require(_0xa6b4('0x3'));var logger=require(_0xa6b4('0x4'))('agi');var utilLicense=require(_0xa6b4('0x5'));var rpc=require('./rpc');var Project=require(_0xa6b4('0x6'));var AGIEmitter=require(_0xa6b4('0x7'))[_0xa6b4('0x8')];var projects=[];config[_0xa6b4('0x9')]=_[_0xa6b4('0xa')](config['agi'],{'ip':_0xa6b4('0xb'),'port':0x11dd});AGIEmitter['on'](_0xa6b4('0xc'),projectUpdateHandler);function connectionHandler(_0x1a4906){process[_0xa6b4('0xd')](function(){syncho(function(){try{setChannelVariables(_0x1a4906);agiHandler(_0x1a4906);}catch(_0x63def8){logger[_0xa6b4('0xe')](_0x63def8[_0xa6b4('0xf')]);}});});}function projectUpdateHandler(_0x51ef4b){try{var _0x5e6001=_['findIndex'](projects,['id',_0x51ef4b['id']]);if(_0x5e6001>-0x1){if(_0x51ef4b[_0xa6b4('0x10')]===!![]){projects['splice'](_0x5e6001,0x1);}else{projects[_0x5e6001]=_0x51ef4b;}}else{projects['push'](_0x51ef4b);}}catch(_0x4b10fe){logger[_0xa6b4('0xe')](_0x4b10fe['stack']);}}function listeningHandler(){console[_0xa6b4('0x11')](_0xa6b4('0x12'),config['agi']['port']);logger[_0xa6b4('0x13')](util['format']('[LISTENING]\x20Cally\x20Square\x20listening\x20%s:%d',config[_0xa6b4('0x9')]['ip'],config[_0xa6b4('0x9')][_0xa6b4('0x14')]));}function errorHandler(_0x410e2b){if(_0x410e2b&&_0x410e2b[_0xa6b4('0x15')]&&_0x410e2b[_0xa6b4('0x16')]){logger[_0xa6b4('0xe')](util['format'](_0xa6b4('0x17'),_0x410e2b[_0xa6b4('0x15')],_0x410e2b[_0xa6b4('0x16')]));}else{logger['error'](util[_0xa6b4('0x18')](_0xa6b4('0x19'),_0x410e2b[_0xa6b4('0xf')]));}}function closeHandler(){logger[_0xa6b4('0x13')](util['format'](_0xa6b4('0x1a'),this[_0xa6b4('0x1b')],this['calleridname'],this[_0xa6b4('0x1c')],this['dnid'],this['uniqueid']));try{createSquareReport(this);}catch(_0x2fb9a8){logger[_0xa6b4('0xe')](_0x2fb9a8[_0xa6b4('0xf')]);}}function timeoutHandler(){logger[_0xa6b4('0x13')](util[_0xa6b4('0x18')]('[TIMEOUT]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s',this[_0xa6b4('0x1b')],this[_0xa6b4('0x1d')],this[_0xa6b4('0x1c')],this['dnid'],this[_0xa6b4('0x1e')]));}function hangupHandler(){logger[_0xa6b4('0x13')](util[_0xa6b4('0x18')](_0xa6b4('0x1f'),this[_0xa6b4('0x1b')],this[_0xa6b4('0x1d')],this[_0xa6b4('0x1c')],this[_0xa6b4('0x20')],this[_0xa6b4('0x1e')]));this[_0xa6b4('0x21')]=!![];}function createSquareReport(_0x24fae9,_0xa6add1){rpc[_0xa6b4('0x22')](_0x24fae9)[_0xa6b4('0x23')](function(_0x517578){if(_0xa6add1){_0xa6add1(null,_0x517578);}})[_0xa6b4('0x24')](function(_0x5dcde5){if(_0xa6add1){_0xa6add1(null,_0x5dcde5);}});}function setChannelVariables(_0x251609){for(var _0x1cf8d6 in _0x251609){if(_0x251609['hasOwnProperty'](_0x1cf8d6)){if(_0x1cf8d6[_0xa6b4('0x25')]('agi_')===0x0){_0x251609[_0x1cf8d6[_0xa6b4('0x26')](0x4)]=_0x251609[_0x1cf8d6];delete _0x251609[_0x1cf8d6];}}}}function agiHandler(_0xd40e4d){logger['debug'](_0xa6b4('0x27'),JSON['stringify'](_0xd40e4d,null,0x2));logger[_0xa6b4('0x13')](util[_0xa6b4('0x18')](_0xa6b4('0x28'),_0xd40e4d['arg_1'],_0xd40e4d[_0xa6b4('0x1d')],_0xd40e4d['callerid'],_0xd40e4d[_0xa6b4('0x20')],_0xd40e4d[_0xa6b4('0x1e')]));_0xd40e4d['on'](_0xa6b4('0xe'),errorHandler);_0xd40e4d['on'](_0xa6b4('0x29'),closeHandler);_0xd40e4d['on'](_0xa6b4('0x2a'),timeoutHandler);_0xd40e4d[_0xa6b4('0x21')]=![];_0xd40e4d['on'](_0xa6b4('0x2b'),hangupHandler);var _0x7bac55=_[_0xa6b4('0x2c')](projects,[_0xa6b4('0x15'),_0xd40e4d['arg_1']]);if(!_0x7bac55)return Project[_0xa6b4('0x2d')](_0xd40e4d);if(!_0x7bac55[_0xa6b4('0x2e')])return Project['handleUnpublished'](_0xd40e4d);return Project[_0xa6b4('0x2f')](_0x7bac55,_0xd40e4d);}function main(){var _0x144a7d;return utilLicense[_0xa6b4('0x30')]()[_0xa6b4('0x23')](function(_0x5a4442){if(!_0x5a4442)return;if(_0x5a4442[_0xa6b4('0x31')]){if(_0x5a4442[_0xa6b4('0x32')]&&_0x5a4442[_0xa6b4('0x32')]>0x0){logger[_0xa6b4('0x13')](util[_0xa6b4('0x18')](_0xa6b4('0x33'),_0x5a4442[_0xa6b4('0x32')]));_0x144a7d=_0x5a4442[_0xa6b4('0x32')];}else{logger[_0xa6b4('0x13')]('[LICENSE]\x20CHANNELS:\x20UNLIMITED');}}else{logger[_0xa6b4('0x13')](_0xa6b4('0x34'));_0x144a7d=-0x1;}})[_0xa6b4('0x23')](function(){return Project[_0xa6b4('0x35')]();})['then'](function(_0x1ac47d){projects=_0x1ac47d;return;})[_0xa6b4('0x24')](function(_0x3ed881){logger[_0xa6b4('0xe')]('[LICENSE]',_0x3ed881[_0xa6b4('0xf')]);})[_0xa6b4('0x36')](function(){var _0x3b2a31=require(_0xa6b4('0x37'))(config[_0xa6b4('0x9')]['port'],config[_0xa6b4('0x9')]['ip'],_0x144a7d);_0x3b2a31['on']('error',errorHandler);_0x3b2a31['on']('listening',listeningHandler);_0x3b2a31['on'](_0xa6b4('0x38'),connectionHandler);_0x3b2a31['on'](_0xa6b4('0x29'),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 a0cd31d..24cddf4 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 _0x29b8=['catch','sendMailMessage','SendMail','bluebird','jayson/promise','request','then','error','message','result'];(function(_0x60fcc3,_0x54f061){var _0x24b1db=function(_0x17fddd){while(--_0x17fddd){_0x60fcc3['push'](_0x60fcc3['shift']());}};_0x24b1db(++_0x54f061);}(_0x29b8,0x143));var _0x829b=function(_0x413b4d,_0xa3459c){_0x413b4d=_0x413b4d-0x0;var _0x8b810a=_0x29b8[_0x413b4d];return _0x8b810a;};'use strict';var BPromise=require(_0x829b('0x0'));var jayson=require(_0x829b('0x1'));var client=jayson['client']['http']({'port':0x232b});function request(_0x3b95b7,_0x44990d){return new BPromise(function(_0x56068d,_0x3cff41){return client[_0x829b('0x2')](_0x3b95b7,_0x44990d)[_0x829b('0x3')](function(_0x2f8b6a){if(_0x2f8b6a['error']){return _0x3cff41(_0x2f8b6a[_0x829b('0x4')][_0x829b('0x5')]);}else{return _0x56068d(_0x2f8b6a[_0x829b('0x6')]);}})[_0x829b('0x7')](function(_0x119fa6){return _0x3cff41(_0x119fa6);});});}exports[_0x829b('0x8')]=function(_0x5518fe,_0x29e3e9){return request(_0x829b('0x9'),{'account':_0x5518fe,'message':_0x29e3e9});}; \ No newline at end of file +var _0xfd95=['request','then','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client','http'];(function(_0x4278d8,_0x21eb0d){var _0x47e77e=function(_0x5b4cab){while(--_0x5b4cab){_0x4278d8['push'](_0x4278d8['shift']());}};_0x47e77e(++_0x21eb0d);}(_0xfd95,0x134));var _0x5fd9=function(_0xddad70,_0x3284aa){_0xddad70=_0xddad70-0x0;var _0x17cf7f=_0xfd95[_0xddad70];return _0x17cf7f;};'use strict';var BPromise=require(_0x5fd9('0x0'));var jayson=require(_0x5fd9('0x1'));var client=jayson[_0x5fd9('0x2')][_0x5fd9('0x3')]({'port':0x232b});function request(_0x2e761a,_0x29d584){return new BPromise(function(_0x18ab74,_0x355cae){return client[_0x5fd9('0x4')](_0x2e761a,_0x29d584)[_0x5fd9('0x5')](function(_0x97259){if(_0x97259[_0x5fd9('0x6')]){return _0x355cae(_0x97259[_0x5fd9('0x6')][_0x5fd9('0x7')]);}else{return _0x18ab74(_0x97259[_0x5fd9('0x8')]);}})[_0x5fd9('0x9')](function(_0xdc9e20){return _0x355cae(_0xdc9e20);});});}exports[_0x5fd9('0xa')]=function(_0x184e9f,_0x4302d6){return request(_0x5fd9('0xb'),{'account':_0x184e9f,'message':_0x4302d6});}; \ No newline at end of file diff --git a/server/services/agi/project.js b/server/services/agi/project.js index 0844e3c..8c18a34 100644 --- a/server/services/agi/project.js +++ b/server/services/agi/project.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfe51=['./rpc','./mailRpc','./vertices','getSquareProjects','error','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','target','addEdge','source','value','toJson','root','inspect','production','start','joinAt','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','uniqueid','clear','debug','vertex','gotoc','gotoc\x20block\x20stop\x20traverse\x20BFS','context','extension','priority','response','stringify','code','result','evtHangup','isUndefined','toString','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','dnid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','continueAt','close','Project\x20%s\x20not\x20published','exports','lodash','moment','xml2json','util','../../config/logger'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xfe51,0x77));var _0x1fe5=function(_0x31c08c,_0x4250fa){_0x31c08c=_0x31c08c-0x0;var _0x2c76d4=_0xfe51[_0x31c08c];return _0x2c76d4;};'use strict';var _=require(_0x1fe5('0x0'));var moment=require(_0x1fe5('0x1'));var parser=require(_0x1fe5('0x2'));var util=require(_0x1fe5('0x3'));var logger=require(_0x1fe5('0x4'))('agi');var rpc=require(_0x1fe5('0x5'));var mailRpc=require(_0x1fe5('0x6'));var Graph=require('./graph');var Vertices=require(_0x1fe5('0x7'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x1fe5('0x8')]()['catch'](function(_0x25c86f){logger[_0x1fe5('0x9')](_0x1fe5('0xa'),_0x25c86f[_0x1fe5('0xb')]);return[];});}function addVertex(_0x51126c,_0x3c967f,_0x1ce6f0){_0x3c967f[_0x1fe5('0xc')]=_0x1ce6f0;if(_0x3c967f[_0x1fe5('0xd')](_0x1fe5('0xe'))){_0x3c967f[_0x1fe5('0xf')]=parseInt(_0x3c967f[_0x1fe5('0xe')],0xa);}_0x51126c[_0x1fe5('0x10')](_[_0x1fe5('0x11')](_0x3c967f,_0x1fe5('0x12')));}function initGraph(_0x107316,_0x1e1b7e){var _0xfff909=new Graph();for(var _0x212685 in _0x107316){if(_0x107316[_0x1fe5('0xd')](_0x212685)){if(_[_0x1fe5('0x13')](_0x107316[_0x212685])){for(var _0x102c99=0x0;_0x102c99<_0x107316[_0x212685]['length'];_0x102c99+=0x1){addVertex(_0xfff909,_0x107316[_0x212685][_0x102c99],_0x212685);}}else{addVertex(_0xfff909,_0x107316[_0x212685],_0x212685);}}}for(var _0x43832a=0x0;_0x43832a<_0x1e1b7e['length'];_0x43832a+=0x1){if(_0x1e1b7e[_0x43832a]['source']&&_0x1e1b7e[_0x43832a][_0x1fe5('0x14')]){_0xfff909[_0x1fe5('0x15')](_0x1e1b7e[_0x43832a][_0x1fe5('0x16')],_0x1e1b7e[_0x43832a]['target'],_0x1e1b7e[_0x43832a][_0x1fe5('0x17')]);}}return _0xfff909;}function getRoot(_0x34013d){return parser[_0x1fe5('0x18')](_0x34013d,{'object':!![]})['mxGraphModel'][_0x1fe5('0x19')];}function inspect(_0x4d55ba){return util[_0x1fe5('0x1a')](_0x4d55ba,{'showHidden':![],'depth':null});}function initialize(_0x50c4f7,_0x268f49){var _0x28c3dc=getRoot(_0x50c4f7[_0x1fe5('0x1b')]);if(!_0x28c3dc||!_0x28c3dc[_0x1fe5('0x1c')])return;var _0xba56c8,_0x7b3d93,_0x43152f;logger['debug']('root',JSON['stringify'](_0x28c3dc,null,0x2));_0x268f49[_0x1fe5('0x1d')]=moment()[_0x1fe5('0x1e')](_0x1fe5('0x1f'));_0xba56c8=initGraph(_[_0x1fe5('0x11')](_0x28c3dc,_0x1fe5('0x12')),_0x28c3dc['mxCell']);_0x7b3d93=new Vertices(_0x268f49,rpc,mailRpc);logger[_0x1fe5('0x20')](util[_0x1fe5('0x1e')](_0x1fe5('0x21'),_0x268f49[_0x1fe5('0x22')],_0x268f49[_0x1fe5('0x23')],_0x268f49[_0x1fe5('0x24')],_0x268f49['dnid'],_0x268f49[_0x1fe5('0x25')]));_0xba56c8['traverseBFS'](_0x28c3dc[_0x1fe5('0x1c')]['id'],function(_0xdf4824){try{_0xdf4824=_0x7b3d93[_0x1fe5('0x26')](_0xdf4824);logger[_0x1fe5('0x27')](_0x1fe5('0x28'),JSON['stringify'](_0xdf4824,null,0x2));if(_0xdf4824[_0x1fe5('0xc')]===_0x1fe5('0x29')){logger[_0x1fe5('0x20')](_0x1fe5('0x2a'));_0x268f49['context']=_0xdf4824[_0x1fe5('0x2b')]||_0x268f49[_0x1fe5('0x2b')];_0x268f49['extension']=_0xdf4824[_0x1fe5('0x2c')];_0x268f49[_0x1fe5('0x2d')]=_0xdf4824[_0x1fe5('0x2d')]?_0xdf4824[_0x1fe5('0x2d')]-0x1:0x1;return null;}else if(_0xdf4824&&_0x7b3d93[_0xdf4824[_0x1fe5('0xc')]]){_0x43152f=_0x7b3d93[_0xdf4824['agicommand']](_0xdf4824);logger[_0x1fe5('0x20')](_0x1fe5('0x2e'),JSON[_0x1fe5('0x2f')](_0x43152f,null,0x2));if(_0x43152f&&_0x43152f[_0x1fe5('0x30')]===AGI_CODE_SUCCESS&&_0x43152f[_0x1fe5('0x31')]!==AGI_RESULT_ERROR&&!_0x268f49[_0x1fe5('0x32')]){logger['debug'](_0x1fe5('0x2e'),inspect(_0x43152f));return _[_0x1fe5('0x33')](_0x43152f['result'])?null:_0x43152f[_0x1fe5('0x31')][_0x1fe5('0x34')]();}else{logger[_0x1fe5('0x9')]('response',inspect(_0x43152f));return null;}}else{logger[_0x1fe5('0x9')](_0x1fe5('0x35'));return null;}}catch(_0x38ff09){logger[_0x1fe5('0x9')](_0x38ff09[_0x1fe5('0xb')]);return null;}});if(_0x28c3dc[_0x1fe5('0x36')]){logger['info'](util[_0x1fe5('0x1e')](_0x1fe5('0x37'),_0x268f49[_0x1fe5('0x22')],_0x268f49[_0x1fe5('0x23')],_0x268f49[_0x1fe5('0x24')],_0x268f49[_0x1fe5('0x38')],_0x268f49[_0x1fe5('0x25')]));_0xba56c8['traverseBFS'](_0x28c3dc[_0x1fe5('0x36')]['id'],function(_0x4e7dff){try{_0x4e7dff=_0x7b3d93['clear'](_0x4e7dff);logger[_0x1fe5('0x27')](_0x1fe5('0x28'),JSON[_0x1fe5('0x2f')](_0x4e7dff,null,0x2));if(_0x4e7dff&&_0x7b3d93[_0x4e7dff[_0x1fe5('0xc')]]){_0x43152f=_0x7b3d93[_0x4e7dff[_0x1fe5('0xc')]](_0x4e7dff);if(_0x43152f){logger[_0x1fe5('0x27')](_0x1fe5('0x2e'),inspect(_0x43152f));return _['isUndefined'](_0x43152f[_0x1fe5('0x31')])?null:_0x43152f[_0x1fe5('0x31')][_0x1fe5('0x34')]();}else{logger[_0x1fe5('0x9')](_0x1fe5('0x2e'),inspect(_0x43152f));return null;}}else{logger['error'](_0x1fe5('0x35'));return null;}}catch(_0x161445){logger['error'](_0x161445[_0x1fe5('0xb')]);return null;}});}logger[_0x1fe5('0x20')](util[_0x1fe5('0x1e')](_0x1fe5('0x39'),_0x268f49['arg_1'],_0x268f49[_0x1fe5('0x23')],_0x268f49[_0x1fe5('0x24')],_0x268f49['dnid'],_0x268f49[_0x1fe5('0x25')]));logger[_0x1fe5('0x20')](util[_0x1fe5('0x1e')]('[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s',_0x268f49['context'],_0x268f49[_0x1fe5('0x2c')],parseInt(_0x268f49[_0x1fe5('0x2d')],0xa)+0x1));_0x268f49[_0x1fe5('0x3a')](_0x268f49['context'],_0x268f49[_0x1fe5('0x2c')],parseInt(_0x268f49[_0x1fe5('0x2d')],0xa)+0x1);_0x268f49[_0x1fe5('0x3b')]();}function handleNotFound(_0x3053ac){logger[_0x1fe5('0x9')](util[_0x1fe5('0x1e')]('Project\x20%s\x20not\x20found',_0x3053ac[_0x1fe5('0x22')]));_0x3053ac['continueAt'](_0x3053ac[_0x1fe5('0x2b')],_0x3053ac['extension'],parseInt(_0x3053ac['priority'],0xa)+0x1);_0x3053ac[_0x1fe5('0x3b')]();}function handleUnpublished(_0x476382){logger[_0x1fe5('0x9')](util[_0x1fe5('0x1e')](_0x1fe5('0x3c'),_0x476382[_0x1fe5('0x22')]));_0x476382[_0x1fe5('0x3a')](_0x476382[_0x1fe5('0x2b')],_0x476382[_0x1fe5('0x2c')],parseInt(_0x476382[_0x1fe5('0x2d')],0xa)+0x1);_0x476382[_0x1fe5('0x3b')]();}module[_0x1fe5('0x3d')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file +var _0x7518=['context','extension','priority','code','result','evtHangup','isUndefined','toString','response','error','agicommand\x20not\x20found','finally','[FINALLY\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','uniqueid','[END]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','[GOTO]\x20context:\x20%s\x20extension:\x20%s\x20priority:\x20%s','continueAt','close','Project\x20%s\x20not\x20found','Project\x20%s\x20not\x20published','exports','moment','../../config/logger','./rpc','./mailRpc','./graph','./vertices','getSquareProjects','catch','Unable\x20to\x20download\x20CallySquare\x20projects','stack','agicommand','hasOwnProperty','retry','maxRetry','addVertex','omit','mxCell','isArray','target','addEdge','value','toJson','mxGraphModel','root','inspect','production','stringify','format','YYYY-MM-DD\x20HH:mm:ss','info','[START\x20TRAVERSE]\x20%s\x20project:\x20from\x20\x22%s\x22\x20<%s>\x20to\x20extension\x20%s\x20with\x20uniqueid\x20%s','arg_1','calleridname','callerid','dnid','traverseBFS','start','clear','debug','gotoc\x20block\x20stop\x20traverse\x20BFS'];(function(_0x2b7a02,_0x162333){var _0x1a21fe=function(_0x547c1c){while(--_0x547c1c){_0x2b7a02['push'](_0x2b7a02['shift']());}};_0x1a21fe(++_0x162333);}(_0x7518,0x109));var _0x8751=function(_0x15ea09,_0x2f30ab){_0x15ea09=_0x15ea09-0x0;var _0x3e9c78=_0x7518[_0x15ea09];return _0x3e9c78;};'use strict';var _=require('lodash');var moment=require(_0x8751('0x0'));var parser=require('xml2json');var util=require('util');var logger=require(_0x8751('0x1'))('agi');var rpc=require(_0x8751('0x2'));var mailRpc=require(_0x8751('0x3'));var Graph=require(_0x8751('0x4'));var Vertices=require(_0x8751('0x5'));var AGI_CODE_SUCCESS=0xc8;var AGI_RESULT_ERROR=-0x1;function getAll(){return rpc[_0x8751('0x6')]()[_0x8751('0x7')](function(_0x41eb41){logger['error'](_0x8751('0x8'),_0x41eb41[_0x8751('0x9')]);return[];});}function addVertex(_0x20c0db,_0x14b95b,_0x220860){_0x14b95b[_0x8751('0xa')]=_0x220860;if(_0x14b95b[_0x8751('0xb')](_0x8751('0xc'))){_0x14b95b[_0x8751('0xd')]=parseInt(_0x14b95b[_0x8751('0xc')],0xa);}_0x20c0db[_0x8751('0xe')](_[_0x8751('0xf')](_0x14b95b,_0x8751('0x10')));}function initGraph(_0x418516,_0x2465f0){var _0x5ac0e7=new Graph();for(var _0x333f41 in _0x418516){if(_0x418516[_0x8751('0xb')](_0x333f41)){if(_[_0x8751('0x11')](_0x418516[_0x333f41])){for(var _0x5524a2=0x0;_0x5524a2<_0x418516[_0x333f41]['length'];_0x5524a2+=0x1){addVertex(_0x5ac0e7,_0x418516[_0x333f41][_0x5524a2],_0x333f41);}}else{addVertex(_0x5ac0e7,_0x418516[_0x333f41],_0x333f41);}}}for(var _0x5c7fbd=0x0;_0x5c7fbd<_0x2465f0['length'];_0x5c7fbd+=0x1){if(_0x2465f0[_0x5c7fbd]['source']&&_0x2465f0[_0x5c7fbd][_0x8751('0x12')]){_0x5ac0e7[_0x8751('0x13')](_0x2465f0[_0x5c7fbd]['source'],_0x2465f0[_0x5c7fbd][_0x8751('0x12')],_0x2465f0[_0x5c7fbd][_0x8751('0x14')]);}}return _0x5ac0e7;}function getRoot(_0xe4bb12){return parser[_0x8751('0x15')](_0xe4bb12,{'object':!![]})[_0x8751('0x16')][_0x8751('0x17')];}function inspect(_0x148129){return util[_0x8751('0x18')](_0x148129,{'showHidden':![],'depth':null});}function initialize(_0x6ce7d3,_0xdd7b7d){var _0x53abdd=getRoot(_0x6ce7d3[_0x8751('0x19')]);if(!_0x53abdd||!_0x53abdd['start'])return;var _0x1345f3,_0x1f516c,_0x1f6c71;logger['debug']('root',JSON[_0x8751('0x1a')](_0x53abdd,null,0x2));_0xdd7b7d['joinAt']=moment()[_0x8751('0x1b')](_0x8751('0x1c'));_0x1345f3=initGraph(_['omit'](_0x53abdd,_0x8751('0x10')),_0x53abdd[_0x8751('0x10')]);_0x1f516c=new Vertices(_0xdd7b7d,rpc,mailRpc);logger[_0x8751('0x1d')](util['format'](_0x8751('0x1e'),_0xdd7b7d[_0x8751('0x1f')],_0xdd7b7d[_0x8751('0x20')],_0xdd7b7d[_0x8751('0x21')],_0xdd7b7d[_0x8751('0x22')],_0xdd7b7d['uniqueid']));_0x1345f3[_0x8751('0x23')](_0x53abdd[_0x8751('0x24')]['id'],function(_0x1a59a3){try{_0x1a59a3=_0x1f516c[_0x8751('0x25')](_0x1a59a3);logger[_0x8751('0x26')]('vertex',JSON[_0x8751('0x1a')](_0x1a59a3,null,0x2));if(_0x1a59a3[_0x8751('0xa')]==='gotoc'){logger['info'](_0x8751('0x27'));_0xdd7b7d[_0x8751('0x28')]=_0x1a59a3['context']||_0xdd7b7d[_0x8751('0x28')];_0xdd7b7d[_0x8751('0x29')]=_0x1a59a3[_0x8751('0x29')];_0xdd7b7d[_0x8751('0x2a')]=_0x1a59a3['priority']?_0x1a59a3[_0x8751('0x2a')]-0x1:0x1;return null;}else if(_0x1a59a3&&_0x1f516c[_0x1a59a3[_0x8751('0xa')]]){_0x1f6c71=_0x1f516c[_0x1a59a3[_0x8751('0xa')]](_0x1a59a3);logger['info']('response',JSON[_0x8751('0x1a')](_0x1f6c71,null,0x2));if(_0x1f6c71&&_0x1f6c71[_0x8751('0x2b')]===AGI_CODE_SUCCESS&&_0x1f6c71[_0x8751('0x2c')]!==AGI_RESULT_ERROR&&!_0xdd7b7d[_0x8751('0x2d')]){logger['debug']('response',inspect(_0x1f6c71));return _[_0x8751('0x2e')](_0x1f6c71[_0x8751('0x2c')])?null:_0x1f6c71['result'][_0x8751('0x2f')]();}else{logger['error'](_0x8751('0x30'),inspect(_0x1f6c71));return null;}}else{logger[_0x8751('0x31')](_0x8751('0x32'));return null;}}catch(_0x217766){logger['error'](_0x217766[_0x8751('0x9')]);return null;}});if(_0x53abdd[_0x8751('0x33')]){logger[_0x8751('0x1d')](util['format'](_0x8751('0x34'),_0xdd7b7d['arg_1'],_0xdd7b7d['calleridname'],_0xdd7b7d[_0x8751('0x21')],_0xdd7b7d[_0x8751('0x22')],_0xdd7b7d[_0x8751('0x35')]));_0x1345f3['traverseBFS'](_0x53abdd[_0x8751('0x33')]['id'],function(_0x210ec7){try{_0x210ec7=_0x1f516c['clear'](_0x210ec7);logger[_0x8751('0x26')]('vertex',JSON[_0x8751('0x1a')](_0x210ec7,null,0x2));if(_0x210ec7&&_0x1f516c[_0x210ec7[_0x8751('0xa')]]){_0x1f6c71=_0x1f516c[_0x210ec7['agicommand']](_0x210ec7);if(_0x1f6c71){logger['debug'](_0x8751('0x30'),inspect(_0x1f6c71));return _[_0x8751('0x2e')](_0x1f6c71[_0x8751('0x2c')])?null:_0x1f6c71[_0x8751('0x2c')][_0x8751('0x2f')]();}else{logger[_0x8751('0x31')]('response',inspect(_0x1f6c71));return null;}}else{logger[_0x8751('0x31')](_0x8751('0x32'));return null;}}catch(_0x29fc22){logger[_0x8751('0x31')](_0x29fc22[_0x8751('0x9')]);return null;}});}logger[_0x8751('0x1d')](util['format'](_0x8751('0x36'),_0xdd7b7d[_0x8751('0x1f')],_0xdd7b7d[_0x8751('0x20')],_0xdd7b7d[_0x8751('0x21')],_0xdd7b7d[_0x8751('0x22')],_0xdd7b7d['uniqueid']));logger[_0x8751('0x1d')](util[_0x8751('0x1b')](_0x8751('0x37'),_0xdd7b7d[_0x8751('0x28')],_0xdd7b7d[_0x8751('0x29')],parseInt(_0xdd7b7d[_0x8751('0x2a')],0xa)+0x1));_0xdd7b7d[_0x8751('0x38')](_0xdd7b7d['context'],_0xdd7b7d[_0x8751('0x29')],parseInt(_0xdd7b7d[_0x8751('0x2a')],0xa)+0x1);_0xdd7b7d[_0x8751('0x39')]();}function handleNotFound(_0x428b46){logger[_0x8751('0x31')](util[_0x8751('0x1b')](_0x8751('0x3a'),_0x428b46[_0x8751('0x1f')]));_0x428b46[_0x8751('0x38')](_0x428b46['context'],_0x428b46[_0x8751('0x29')],parseInt(_0x428b46[_0x8751('0x2a')],0xa)+0x1);_0x428b46['close']();}function handleUnpublished(_0xb4890b){logger['error'](util[_0x8751('0x1b')](_0x8751('0x3b'),_0xb4890b['arg_1']));_0xb4890b[_0x8751('0x38')](_0xb4890b[_0x8751('0x28')],_0xb4890b[_0x8751('0x29')],parseInt(_0xb4890b[_0x8751('0x2a')],0xa)+0x1);_0xb4890b[_0x8751('0x39')]();}module[_0x8751('0x3c')]={'getAll':getAll,'handleNotFound':handleNotFound,'handleUnpublished':handleUnpublished,'initialize':initialize}; \ No newline at end of file diff --git a/server/services/agi/reply.js b/server/services/agi/reply.js index 426caf1..646b8fd 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 _0x8f94=['_transform','_localBuffer','indexOf','substring','length','split','slice','trim','headers','emit','line','util','stream','Transform','call','_inBody','inherits'];(function(_0x316100,_0x40076d){var _0x2e1935=function(_0x2dacf){while(--_0x2dacf){_0x316100['push'](_0x316100['shift']());}};_0x2e1935(++_0x40076d);}(_0x8f94,0xd7));var _0x48f9=function(_0x5b644e,_0x2e5e07){_0x5b644e=_0x5b644e-0x0;var _0x49c6bf=_0x8f94[_0x5b644e];return _0x49c6bf;};'use strict';var util=require(_0x48f9('0x0'));var Transform=require(_0x48f9('0x1'))[_0x48f9('0x2')];function AGIReply(_0x3cdb59){Transform[_0x48f9('0x3')](this,_0x3cdb59);this['_localBuffer']='';this[_0x48f9('0x4')]=![];}util[_0x48f9('0x5')](AGIReply,Transform);AGIReply['prototype'][_0x48f9('0x6')]=function(_0x53ecc4,_0x2f6a18,_0x5d427f){var _0x38c652='\x0a',_0x45cdf7=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x48e93f=-0x1,_0x2fe384=-0x1,_0x28704d='',_0x24bc0f=0x0,_0x1fde15='',_0x1ec24c='';this[_0x48f9('0x7')]+=_0x53ecc4['toString']();_0x1fde15=this[_0x48f9('0x7')];if(!this[_0x48f9('0x4')]){_0x24bc0f=0x0;while(_0x45cdf7[_0x24bc0f]){while((_0x2fe384=_0x1fde15[_0x48f9('0x8')](_0x45cdf7[_0x24bc0f]))!=-0x1){_0x28704d=_0x45cdf7[_0x24bc0f];_0x1ec24c=_0x1fde15['substring'](0x0,_0x2fe384);_0x1fde15=_0x1fde15[_0x48f9('0x9')](_0x2fe384+_0x28704d[_0x48f9('0xa')]);var _0x4839ad=_0x1ec24c[_0x48f9('0xb')](_0x38c652),_0x18c127=0x0,_0x12cdfb={},_0xe9eceb='',_0x5249c3='',_0x28d8e9=-0x1;while(_0x4839ad[_0x18c127]){_0x28d8e9=_0x4839ad[_0x18c127]['indexOf'](':');if(_0x28d8e9!=-0x1){_0xe9eceb=_0x4839ad[_0x18c127][_0x48f9('0xc')](0x0,_0x28d8e9)[_0x48f9('0xd')]();_0x5249c3=_0x4839ad[_0x18c127][_0x48f9('0xc')](_0x28d8e9+0x1)['trim']();if(_0xe9eceb[_0x48f9('0xa')]>0x0){_0x12cdfb[_0xe9eceb]=_0x5249c3;}}else{}_0x18c127++;}this['emit'](_0x48f9('0xe'),_0x12cdfb);this[_0x48f9('0x4')]=!![];}_0x24bc0f++;}this[_0x48f9('0x7')]=_0x1fde15;}else{while((_0x48e93f=_0x1fde15[_0x48f9('0x8')](_0x38c652))!=-0x1){_0x1ec24c=_0x1fde15[_0x48f9('0x9')](0x0,_0x48e93f);this[_0x48f9('0xf')](_0x48f9('0x10'),_0x1ec24c);_0x1fde15=_0x1fde15[_0x48f9('0x9')](_0x48e93f+_0x38c652[_0x48f9('0xa')]);}this['_localBuffer']=_0x1fde15;}_0x5d427f();};module['exports']=AGIReply; \ No newline at end of file +var _0x8db0=['inherits','toString','_inBody','indexOf','substring','length','split','slice','emit','headers','exports','util','stream','call','_localBuffer'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x8db0,0x65));var _0x08db=function(_0x5da27f,_0x504b76){_0x5da27f=_0x5da27f-0x0;var _0x54a3fb=_0x8db0[_0x5da27f];return _0x54a3fb;};'use strict';var util=require(_0x08db('0x0'));var Transform=require(_0x08db('0x1'))['Transform'];function AGIReply(_0x6e32bb){Transform[_0x08db('0x2')](this,_0x6e32bb);this[_0x08db('0x3')]='';this['_inBody']=![];}util[_0x08db('0x4')](AGIReply,Transform);AGIReply['prototype']['_transform']=function(_0x5a7ee4,_0x218333,_0x55af6b){var _0x14b0e6='\x0a',_0x528139=['\x0a\x0a','\x0d\x0a\x0d\x0a'],_0x41b4bf=-0x1,_0x1ca3d1=-0x1,_0x16bcc0='',_0x338674=0x0,_0x2168a8='',_0x5ec76d='';this[_0x08db('0x3')]+=_0x5a7ee4[_0x08db('0x5')]();_0x2168a8=this[_0x08db('0x3')];if(!this[_0x08db('0x6')]){_0x338674=0x0;while(_0x528139[_0x338674]){while((_0x1ca3d1=_0x2168a8[_0x08db('0x7')](_0x528139[_0x338674]))!=-0x1){_0x16bcc0=_0x528139[_0x338674];_0x5ec76d=_0x2168a8[_0x08db('0x8')](0x0,_0x1ca3d1);_0x2168a8=_0x2168a8[_0x08db('0x8')](_0x1ca3d1+_0x16bcc0[_0x08db('0x9')]);var _0x3e9a3a=_0x5ec76d[_0x08db('0xa')](_0x14b0e6),_0x1b2ed2=0x0,_0x1a1b17={},_0x1bff91='',_0x2bdc07='',_0xabd571=-0x1;while(_0x3e9a3a[_0x1b2ed2]){_0xabd571=_0x3e9a3a[_0x1b2ed2][_0x08db('0x7')](':');if(_0xabd571!=-0x1){_0x1bff91=_0x3e9a3a[_0x1b2ed2][_0x08db('0xb')](0x0,_0xabd571)['trim']();_0x2bdc07=_0x3e9a3a[_0x1b2ed2]['slice'](_0xabd571+0x1)['trim']();if(_0x1bff91[_0x08db('0x9')]>0x0){_0x1a1b17[_0x1bff91]=_0x2bdc07;}}else{}_0x1b2ed2++;}this[_0x08db('0xc')](_0x08db('0xd'),_0x1a1b17);this[_0x08db('0x6')]=!![];}_0x338674++;}this['_localBuffer']=_0x2168a8;}else{while((_0x41b4bf=_0x2168a8[_0x08db('0x7')](_0x14b0e6))!=-0x1){_0x5ec76d=_0x2168a8['substring'](0x0,_0x41b4bf);this[_0x08db('0xc')]('line',_0x5ec76d);_0x2168a8=_0x2168a8[_0x08db('0x8')](_0x41b4bf+_0x14b0e6[_0x08db('0x9')]);}this['_localBuffer']=_0x2168a8;}_0x55af6b();};module[_0x08db('0xe')]=AGIReply; \ No newline at end of file diff --git a/server/services/agi/rpc/index.js b/server/services/agi/rpc/index.js index 3bee34b..5e9c59e 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 _0x47c7=['ShowSound','save_name','getIntervalById','ShowInterval','Interval','Intervals','getSmsAccountById','CreateSmsMessage','createSquareDetailsReport','CreateSquareReport','merge','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','CreateSquareMessage','createCmContact','ShowCmHopper','ListId','getPauseById','ShowPause','agentLogin','LoginUser','agentPause','PauseUser','LogoutUser','lodash','jayson/promise','client','request','then','error','result','catch','getSquareProjects','GetSquareProjects','getSquareProject','ShowSquareProject','getMailAccountById','ShowMailAccount','Smtp','name','email','getSquareProjectById','getVoiceQueueById','ShowVoiceQueue','ShowVariable','getSquareOdbcById','ShowSquareOdbc','dsn','getUserById','ShowUser','phone','getTrunkById','getSoundById'];(function(_0x391fec,_0x30feb9){var _0x4c71f8=function(_0x3d9ec8){while(--_0x3d9ec8){_0x391fec['push'](_0x391fec['shift']());}};_0x4c71f8(++_0x30feb9);}(_0x47c7,0x1ab));var _0x747c=function(_0x2235bf,_0x3a06a7){_0x2235bf=_0x2235bf-0x0;var _0x4c3a64=_0x47c7[_0x2235bf];return _0x4c3a64;};'use strict';var _=require(_0x747c('0x0'));var moment=require('moment');var jayson=require(_0x747c('0x1'));var client=jayson[_0x747c('0x2')]['http']({'port':0x2329});function request(_0xbe1d88,_0x2af847){return new Promise(function(_0x51f4bc,_0x3313cd){return client[_0x747c('0x3')](_0xbe1d88,_0x2af847)[_0x747c('0x4')](function(_0x259638){if(_0x259638['error']){return _0x3313cd(_0x259638[_0x747c('0x5')]['message']);}else{return _0x51f4bc(_0x259638[_0x747c('0x6')]);}})[_0x747c('0x7')](function(_0x10b9f0){return _0x3313cd(_0x10b9f0);});});}exports[_0x747c('0x8')]=function(){return request(_0x747c('0x9'),{'options':{'raw':![],'attributes':['id','name','production']}});};exports[_0x747c('0xa')]=function(_0x3b5d7c){return request(_0x747c('0xb'),{'options':{'raw':![],'where':{'name':_0x3b5d7c},'attributes':['production']}});};exports[_0x747c('0xc')]=function(_0x28b782){return request(_0x747c('0xd'),{'options':{'raw':![],'where':{'id':_0x28b782},'include':[{'model':'MailServerOut','as':_0x747c('0xe'),'include':[{'model':'CloudProvider','as':'CloudProvider'}]}],'attributes':['id',_0x747c('0xf'),_0x747c('0x10')],'smtp':!![]}});};exports[_0x747c('0x11')]=function(_0x25e1b6){return request(_0x747c('0xb'),{'options':{'where':{'id':_0x25e1b6},'attributes':[_0x747c('0xf')]}});};exports[_0x747c('0x12')]=function(_0x323c4e){return request(_0x747c('0x13'),{'options':{'where':{'id':_0x323c4e},'attributes':[_0x747c('0xf')]}});};exports['getVariableById']=function(_0x54a895){return request(_0x747c('0x14'),{'options':{'where':{'id':_0x54a895},'attributes':[_0x747c('0xf')]}});};exports[_0x747c('0x15')]=function(_0x5caaad){return request(_0x747c('0x16'),{'options':{'where':{'id':_0x5caaad},'attributes':[_0x747c('0x17')]}});};exports[_0x747c('0x18')]=function(_0x2fa7a8){return request(_0x747c('0x19'),{'options':{'where':{'id':_0x2fa7a8},'attributes':[_0x747c('0xf')]}});};exports['getContactByPhone']=function(_0x19080b){return request('GetContactByPhone',{'options':{'where':{'phone':_0x19080b[_0x747c('0x1a')]},'attributes':['id']}});};exports[_0x747c('0x1b')]=function(_0x328e47){return request('ShowTrunk',{'options':{'where':{'id':_0x328e47},'attributes':[_0x747c('0xf')]}});};exports[_0x747c('0x1c')]=function(_0x85e468){return request(_0x747c('0x1d'),{'options':{'where':{'id':_0x85e468},'attributes':[_0x747c('0x1e')]}});};exports[_0x747c('0x1f')]=function(_0x378df8){return request(_0x747c('0x20'),{'options':{'raw':![],'where':{'id':_0x378df8},'include':[{'model':_0x747c('0x21'),'as':_0x747c('0x22')}]}});};exports[_0x747c('0x23')]=function(_0x2a1233){return request('ShowSmsAccount',{'options':{'where':{'id':_0x2a1233},'attributes':['id',_0x747c('0xf')]}});};exports['createSmsMessage']=function(_0x2e76dc){return request(_0x747c('0x24'),{'body':_0x2e76dc});};exports[_0x747c('0x25')]=function(_0x23a458){return request('CreateSquareDetailsReport',{'body':_0x23a458});};exports['createSquareReport']=function(_0xb20a10){return request(_0x747c('0x26'),{'body':_[_0x747c('0x27')](_0xb20a10,{'project_name':_0xb20a10[_0x747c('0x28')],'prev_project_name':_0xb20a10[_0x747c('0x29')]||'','is_subproject':_0xb20a10['arg_2']?!![]:![],'leaveAt':moment()[_0x747c('0x2a')](_0x747c('0x2b'))})});};exports[_0x747c('0x2c')]=function(_0x5d4d37){return request(_0x747c('0x2d'),{'body':_0x5d4d37});};exports['createSquareMessage']=function(_0x12fb80){return request(_0x747c('0x2e'),{'body':_0x12fb80});};exports[_0x747c('0x2f')]=function(_0xec4098){return request(_0x747c('0x30'),{'options':{'raw':![],'where':{'phone':_0xec4098[_0x747c('0x1a')],'ListId':_0xec4098[_0x747c('0x31')]}}})[_0x747c('0x4')](function(_0x41b26e){if(_0x41b26e){return _0x41b26e;}return request('CreateCmContact',{'body':_0xec4098});});};exports[_0x747c('0x32')]=function(_0x1d04f1){return request(_0x747c('0x33'),{'options':{'where':{'id':_0x1d04f1},'attributes':[_0x747c('0xf')]}});};exports[_0x747c('0x34')]=function(_0x3e0c6f,_0x2e1d27){return request(_0x747c('0x35'),{'body':{'interface':_0x2e1d27},'options':{'where':_0x3e0c6f}});};exports[_0x747c('0x36')]=function(_0x2cda4e,_0x4a2682,_0x58e566){return request(_0x747c('0x37'),{'body':{'type':_0x4a2682,'uniqueid':_0x58e566},'options':{'where':_0x2cda4e}});};exports['agentUnpause']=function(_0x55e762){return request('UnpauseUser',{'body':{},'options':{'where':_0x55e762}});};exports['agentLogout']=function(_0x26abf1){return request(_0x747c('0x38'),{'body':{},'options':{'where':_0x26abf1}});}; \ No newline at end of file +var _0xc770=['dsn','getUserById','getContactByPhone','GetContactByPhone','getTrunkById','ShowTrunk','getSoundById','ShowInterval','Interval','Intervals','getSmsAccountById','ShowSmsAccount','createSmsMessage','CreateSmsMessage','createSquareDetailsReport','CreateSquareDetailsReport','createSquareReport','CreateSquareReport','arg_1','arg_2','format','YYYY-MM-DD\x20HH:mm:ss','createSquareRecording','CreateSquareRecording','createSquareMessage','createCmContact','ShowCmHopper','phone','ListId','CreateCmContact','agentLogin','LoginUser','agentPause','PauseUser','UnpauseUser','agentLogout','LogoutUser','lodash','moment','http','request','then','error','message','catch','getSquareProjects','GetSquareProjects','name','getSquareProject','getMailAccountById','ShowMailAccount','MailServerOut','CloudProvider','email','getVoiceQueueById','ShowVoiceQueue','getVariableById','getSquareOdbcById'];(function(_0x2c91e9,_0x2fb965){var _0x13f0ff=function(_0xb39edf){while(--_0xb39edf){_0x2c91e9['push'](_0x2c91e9['shift']());}};_0x13f0ff(++_0x2fb965);}(_0xc770,0xd3));var _0x0c77=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xc770[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x0c77('0x0'));var moment=require(_0x0c77('0x1'));var jayson=require('jayson/promise');var client=jayson['client'][_0x0c77('0x2')]({'port':0x2329});function request(_0x1866bd,_0x3eaca5){return new Promise(function(_0x23ae87,_0xdcfb07){return client[_0x0c77('0x3')](_0x1866bd,_0x3eaca5)[_0x0c77('0x4')](function(_0x263599){if(_0x263599['error']){return _0xdcfb07(_0x263599[_0x0c77('0x5')][_0x0c77('0x6')]);}else{return _0x23ae87(_0x263599['result']);}})[_0x0c77('0x7')](function(_0x4aec3c){return _0xdcfb07(_0x4aec3c);});});}exports[_0x0c77('0x8')]=function(){return request(_0x0c77('0x9'),{'options':{'raw':![],'attributes':['id',_0x0c77('0xa'),'production']}});};exports[_0x0c77('0xb')]=function(_0x194f36){return request('ShowSquareProject',{'options':{'raw':![],'where':{'name':_0x194f36},'attributes':['production']}});};exports[_0x0c77('0xc')]=function(_0x4fe5cf){return request(_0x0c77('0xd'),{'options':{'raw':![],'where':{'id':_0x4fe5cf},'include':[{'model':_0x0c77('0xe'),'as':'Smtp','include':[{'model':_0x0c77('0xf'),'as':_0x0c77('0xf')}]}],'attributes':['id',_0x0c77('0xa'),_0x0c77('0x10')],'smtp':!![]}});};exports['getSquareProjectById']=function(_0x52eec1){return request('ShowSquareProject',{'options':{'where':{'id':_0x52eec1},'attributes':[_0x0c77('0xa')]}});};exports[_0x0c77('0x11')]=function(_0x11a7ad){return request(_0x0c77('0x12'),{'options':{'where':{'id':_0x11a7ad},'attributes':['name']}});};exports[_0x0c77('0x13')]=function(_0x1a56a5){return request('ShowVariable',{'options':{'where':{'id':_0x1a56a5},'attributes':[_0x0c77('0xa')]}});};exports[_0x0c77('0x14')]=function(_0x4acb12){return request('ShowSquareOdbc',{'options':{'where':{'id':_0x4acb12},'attributes':[_0x0c77('0x15')]}});};exports[_0x0c77('0x16')]=function(_0x5aba1e){return request('ShowUser',{'options':{'where':{'id':_0x5aba1e},'attributes':[_0x0c77('0xa')]}});};exports[_0x0c77('0x17')]=function(_0x2dc707){return request(_0x0c77('0x18'),{'options':{'where':{'phone':_0x2dc707['phone']},'attributes':['id']}});};exports[_0x0c77('0x19')]=function(_0xef65a){return request(_0x0c77('0x1a'),{'options':{'where':{'id':_0xef65a},'attributes':['name']}});};exports[_0x0c77('0x1b')]=function(_0x2519d3){return request('ShowSound',{'options':{'where':{'id':_0x2519d3},'attributes':['save_name']}});};exports['getIntervalById']=function(_0x4029c6){return request(_0x0c77('0x1c'),{'options':{'raw':![],'where':{'id':_0x4029c6},'include':[{'model':_0x0c77('0x1d'),'as':_0x0c77('0x1e')}]}});};exports[_0x0c77('0x1f')]=function(_0x147ff1){return request(_0x0c77('0x20'),{'options':{'where':{'id':_0x147ff1},'attributes':['id','name']}});};exports[_0x0c77('0x21')]=function(_0x51097c){return request(_0x0c77('0x22'),{'body':_0x51097c});};exports[_0x0c77('0x23')]=function(_0x1278dc){return request(_0x0c77('0x24'),{'body':_0x1278dc});};exports[_0x0c77('0x25')]=function(_0x2802d1){return request(_0x0c77('0x26'),{'body':_['merge'](_0x2802d1,{'project_name':_0x2802d1[_0x0c77('0x27')],'prev_project_name':_0x2802d1[_0x0c77('0x28')]||'','is_subproject':_0x2802d1[_0x0c77('0x28')]?!![]:![],'leaveAt':moment()[_0x0c77('0x29')](_0x0c77('0x2a'))})});};exports[_0x0c77('0x2b')]=function(_0xbb897a){return request(_0x0c77('0x2c'),{'body':_0xbb897a});};exports[_0x0c77('0x2d')]=function(_0x53f82d){return request('CreateSquareMessage',{'body':_0x53f82d});};exports[_0x0c77('0x2e')]=function(_0x549c06){return request(_0x0c77('0x2f'),{'options':{'raw':![],'where':{'phone':_0x549c06[_0x0c77('0x30')],'ListId':_0x549c06[_0x0c77('0x31')]}}})[_0x0c77('0x4')](function(_0x511df4){if(_0x511df4){return _0x511df4;}return request(_0x0c77('0x32'),{'body':_0x549c06});});};exports['getPauseById']=function(_0x1995e4){return request('ShowPause',{'options':{'where':{'id':_0x1995e4},'attributes':['name']}});};exports[_0x0c77('0x33')]=function(_0x184f73,_0x3ba5ee){return request(_0x0c77('0x34'),{'body':{'interface':_0x3ba5ee},'options':{'where':_0x184f73}});};exports[_0x0c77('0x35')]=function(_0x5f1a6e,_0x53a034,_0x57295e){return request(_0x0c77('0x36'),{'body':{'type':_0x53a034,'uniqueid':_0x57295e},'options':{'where':_0x5f1a6e}});};exports['agentUnpause']=function(_0x2bd706){return request(_0x0c77('0x37'),{'body':{},'options':{'where':_0x2bd706}});};exports[_0x0c77('0x38')]=function(_0x4e3b52){return request(_0x0c77('0x39'),{'body':{},'options':{'where':_0x4e3b52}});}; \ 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 b5f78fa..636dc0c 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 _0x2070=['exports'];(function(_0x30b159,_0x3fbb50){var _0x23c3f9=function(_0xa21305){while(--_0xa21305){_0x30b159['push'](_0x30b159['shift']());}};_0x23c3f9(++_0x3fbb50);}(_0x2070,0x1a2));var _0x0207=function(_0x486747,_0x438892){_0x486747=_0x486747-0x0;var _0x37bd0d=_0x2070[_0x486747];return _0x37bd0d;};var polly=require('./polly');var lex=require('./lex');module[_0x0207('0x0')]={'polly':polly,'lex':lex}; \ No newline at end of file +var _0xd9ef=['./lex','./polly'];(function(_0x4c0511,_0x23721f){var _0xd4e76b=function(_0x48fa57){while(--_0x48fa57){_0x4c0511['push'](_0x4c0511['shift']());}};_0xd4e76b(++_0x23721f);}(_0xd9ef,0x95));var _0xfd9e=function(_0x1b15e7,_0x282279){_0x1b15e7=_0x1b15e7-0x0;var _0x4542f5=_0xd9ef[_0x1b15e7];return _0x4542f5;};var polly=require(_0xfd9e('0x0'));var lex=require(_0xfd9e('0x1'));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 f741200..e57bf17 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 _0xb58b=['exports'];(function(_0x4e3c56,_0x33dd5d){var _0x2a5451=function(_0x27998f){while(--_0x27998f){_0x4e3c56['push'](_0x4e3c56['shift']());}};_0x2a5451(++_0x33dd5d);}(_0xb58b,0x1f1));var _0xbb58=function(_0x380e21,_0x3782a7){_0x380e21=_0x380e21-0x0;var _0x46b982=_0xb58b[_0x380e21];return _0x46b982;};'use strict';var lex=require('./lib/api');module[_0xbb58('0x0')]=function(_0x3de0dd,_0x3fb85a,_0x4f5d42,_0x340c23,_0x4e6d6c,_0x5c9ec5){return lex(_0x3de0dd,_0x3fb85a,_0x4f5d42,_0x340c23,_0x4e6d6c,_0x5c9ec5);}; \ No newline at end of file +var _0x750a=['exports'];(function(_0x3bc14f,_0x1428fd){var _0x290573=function(_0x1ef862){while(--_0x1ef862){_0x3bc14f['push'](_0x3bc14f['shift']());}};_0x290573(++_0x1428fd);}(_0x750a,0x140));var _0xa750=function(_0x45df64,_0x537b7f){_0x45df64=_0x45df64-0x0;var _0x4a0c99=_0x750a[_0x45df64];return _0x4a0c99;};'use strict';var lex=require('./lib/api');module[_0xa750('0x0')]=function(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f){return lex(_0x5368b2,_0x499583,_0x139fa5,_0xeb020d,_0x1b459c,_0x19bd5f);}; \ 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 1ac9b9f..a7120f5 100644 --- a/server/services/agi/scripts/aws/lex/lib/api.js +++ b/server/services/agi/scripts/aws/lex/lib/api.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x1faaa1,_0x13d548){var _0x13e58f=function(_0x4fbbb8){while(--_0x4fbbb8){_0x1faaa1['push'](_0x1faaa1['shift']());}};_0x13e58f(++_0x13d548);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbca1b1,_0x33f0ce){_0xbca1b1=_0xbca1b1-0x0;var _0x4e1686=_0xa9e0[_0xbca1b1];return _0x4e1686;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file +var _0xa9e0=['LexRuntime','bluebird','aws-sdk','slots','hasOwnProperty'];(function(_0x5de559,_0x40fab7){var _0x3b4020=function(_0x5c21dc){while(--_0x5c21dc){_0x5de559['push'](_0x5de559['shift']());}};_0x3b4020(++_0x40fab7);}(_0xa9e0,0x123));var _0x0a9e=function(_0x2bf141,_0x31eac7){_0x2bf141=_0x2bf141-0x0;var _0x48277b=_0xa9e0[_0x2bf141];return _0x48277b;};'use strict';var BPromise=require(_0x0a9e('0x0'));var AWS=require(_0x0a9e('0x1'));function lexResult(_0x29929c,_0x5dd881){return new BPromise(function(_0x550fbc,_0x18d5c9){_0x29929c['postText'](_0x5dd881,function(_0x333808,_0x432180){if(_0x333808){_0x18d5c9(_0x333808);}if(_0x432180[_0x0a9e('0x2')]){for(const _0x991246 in _0x432180[_0x0a9e('0x2')]){if(_0x432180['slots'][_0x0a9e('0x3')](_0x991246)){var _0x441e3a=_0x432180[_0x0a9e('0x2')][_0x991246];_0x432180['slot_'+_0x991246]=_0x441e3a;}}}_0x550fbc(_0x432180);});});}module['exports']=function(_0xe42b77,_0x56465b,_0x52cace,_0x39753a,_0xf81284,_0x307b3e){var _0x3ab53f=new AWS[(_0x0a9e('0x4'))]({'accessKeyId':_0x56465b,'secretAccessKey':_0x52cace,'region':_0x39753a});var _0xbd1168={'botAlias':'$LATEST','botName':_0x307b3e,'inputText':_0xf81284,'userId':_0xe42b77};return lexResult(_0x3ab53f,_0xbd1168);}; \ No newline at end of file diff --git a/server/services/agi/scripts/aws/polly/index.js b/server/services/agi/scripts/aws/polly/index.js index 54109a5..4a6a740 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 _0x6990=['exports'];(function(_0x103411,_0x401c53){var _0x153774=function(_0x501e4d){while(--_0x501e4d){_0x103411['push'](_0x103411['shift']());}};_0x153774(++_0x401c53);}(_0x6990,0x124));var _0x0699=function(_0x1fd053,_0x309b86){_0x1fd053=_0x1fd053-0x0;var _0x33b6d2=_0x6990[_0x1fd053];return _0x33b6d2;};'use strict';var polly=require('./lib/api');module[_0x0699('0x0')]=function(_0x26c4b6,_0x1d3b36,_0x16b000,_0x139051,_0x3e9650,_0x16412f,_0x28b915){return polly(_0x26c4b6,_0x1d3b36,_0x16b000,_0x139051,_0x3e9650,_0x16412f,_0x28b915);}; \ No newline at end of file +var _0x5f5b=['exports','./lib/api'];(function(_0x518519,_0xaff150){var _0x1b4ccd=function(_0x422abb){while(--_0x422abb){_0x518519['push'](_0x518519['shift']());}};_0x1b4ccd(++_0xaff150);}(_0x5f5b,0xb7));var _0xb5f5=function(_0x23f95d,_0x8e41f0){_0x23f95d=_0x23f95d-0x0;var _0x518acd=_0x5f5b[_0x23f95d];return _0x518acd;};'use strict';var polly=require(_0xb5f5('0x0'));module[_0xb5f5('0x1')]=function(_0x10cce6,_0x40513b,_0x1896b3,_0x4aa9d6,_0x2061d6,_0x55cc3e,_0x9593be){return polly(_0x10cce6,_0x40513b,_0x1896b3,_0x4aa9d6,_0x2061d6,_0x55cc3e,_0x9593be);}; \ 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 a7f6a0b..1b34158 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 _0x7e77=['AudioStream','writeFile','No\x20data\x20response\x20from\x20aws\x20Polly!','exports','text','mp3','path','bluebird'];(function(_0x177b4b,_0x5b0f28){var _0x2ead42=function(_0x1d0393){while(--_0x1d0393){_0x177b4b['push'](_0x177b4b['shift']());}};_0x2ead42(++_0x5b0f28);}(_0x7e77,0xae));var _0x77e7=function(_0x2d34d6,_0x397ff9){_0x2d34d6=_0x2d34d6-0x0;var _0x1d3d12=_0x7e77[_0x2d34d6];return _0x1d3d12;};'use strict';var fs=require('fs');var path=require(_0x77e7('0x0'));var BPromise=require(_0x77e7('0x1'));var rs=require('randomstring');var AWS=require('aws-sdk');function pollyResult(_0x3fb0e1,_0x5de2e5,_0x57fe8a){return new BPromise(function(_0x16ab17,_0x5ee17e){_0x3fb0e1['synthesizeSpeech'](_0x5de2e5,function(_0x2071bd,_0x3acdf7){if(_0x2071bd){_0x5ee17e(_0x2071bd);}else if(_0x3acdf7){if(_0x3acdf7[_0x77e7('0x2')]instanceof Buffer){fs[_0x77e7('0x3')](_0x57fe8a,_0x3acdf7[_0x77e7('0x2')],function(_0x3bbcd5){if(_0x3bbcd5){_0x5ee17e(_0x3bbcd5);}else{_0x16ab17();}});}else{_0x5ee17e(new Error('Invalid\x20data\x20response\x20from\x20aws\x20Polly!'));}}else{_0x5ee17e(new Error(_0x77e7('0x4')));}});});}module[_0x77e7('0x5')]=function(_0x10500d,_0x5cf6d5,_0xb11a9,_0x56b5ba,_0x1331e9,_0x5e0650,_0x46e3a3){var _0x20f2e4=new AWS['Polly']({'accessKeyId':_0x10500d,'secretAccessKey':_0x5cf6d5,'region':_0xb11a9});var _0x1b1b8e={'Text':_0x1331e9,'TextType':_0x5e0650||_0x77e7('0x6'),'OutputFormat':_0x77e7('0x7'),'VoiceId':_0x56b5ba};return pollyResult(_0x20f2e4,_0x1b1b8e,_0x46e3a3);}; \ No newline at end of file +var _0x2f42=['synthesizeSpeech','writeFile','Invalid\x20data\x20response\x20from\x20aws\x20Polly!','text','path','randomstring','aws-sdk'];(function(_0x3d648b,_0x10389d){var _0x5a8614=function(_0x2a9686){while(--_0x2a9686){_0x3d648b['push'](_0x3d648b['shift']());}};_0x5a8614(++_0x10389d);}(_0x2f42,0xf9));var _0x22f4=function(_0x18b3be,_0x4723ad){_0x18b3be=_0x18b3be-0x0;var _0x584a93=_0x2f42[_0x18b3be];return _0x584a93;};'use strict';var fs=require('fs');var path=require(_0x22f4('0x0'));var BPromise=require('bluebird');var rs=require(_0x22f4('0x1'));var AWS=require(_0x22f4('0x2'));function pollyResult(_0x1153d7,_0x1870cb,_0x56eeb5){return new BPromise(function(_0x40a584,_0x1faba3){_0x1153d7[_0x22f4('0x3')](_0x1870cb,function(_0x1a5483,_0x16475d){if(_0x1a5483){_0x1faba3(_0x1a5483);}else if(_0x16475d){if(_0x16475d['AudioStream']instanceof Buffer){fs[_0x22f4('0x4')](_0x56eeb5,_0x16475d['AudioStream'],function(_0x15abc7){if(_0x15abc7){_0x1faba3(_0x15abc7);}else{_0x40a584();}});}else{_0x1faba3(new Error(_0x22f4('0x5')));}}else{_0x1faba3(new Error('No\x20data\x20response\x20from\x20aws\x20Polly!'));}});});}module['exports']=function(_0xdb760e,_0x4b256d,_0x59a590,_0x5289de,_0x556b03,_0x1c3563,_0x4e63f3){var _0x103f49=new AWS['Polly']({'accessKeyId':_0xdb760e,'secretAccessKey':_0x4b256d,'region':_0x59a590});var _0x525e45={'Text':_0x556b03,'TextType':_0x1c3563||_0x22f4('0x6'),'OutputFormat':'mp3','VoiceId':_0x5289de};return pollyResult(_0x103f49,_0x525e45,_0x4e63f3);}; \ 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 fe23b29..1c0a161 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 _0xaa61=['./lib/api','exports'];(function(_0x26b317,_0xb6e378){var _0x3ff485=function(_0x28087a){while(--_0x28087a){_0x26b317['push'](_0x26b317['shift']());}};_0x3ff485(++_0xb6e378);}(_0xaa61,0xce));var _0x1aa6=function(_0xca9bcd,_0x54e883){_0xca9bcd=_0xca9bcd-0x0;var _0x521e98=_0xaa61[_0xca9bcd];return _0x521e98;};'use strict';var asr=require(_0x1aa6('0x0'));module[_0x1aa6('0x1')]=function(_0x1e7fad,_0x1d8d46,_0x11100a,_0x499809){return asr(_0x1e7fad,_0x1d8d46,_0x11100a);}; \ No newline at end of file +var _0x1121=['exports','./lib/api'];(function(_0x1e0fb8,_0x3146e7){var _0x337c2f=function(_0x41a3b9){while(--_0x41a3b9){_0x1e0fb8['push'](_0x1e0fb8['shift']());}};_0x337c2f(++_0x3146e7);}(_0x1121,0x1b1));var _0x1112=function(_0x369cd3,_0x519609){_0x369cd3=_0x369cd3-0x0;var _0x5ea056=_0x1121[_0x369cd3];return _0x5ea056;};'use strict';var asr=require(_0x1112('0x0'));module[_0x1112('0x1')]=function(_0x30c565,_0x12f963,_0x12961a,_0x24d672){return asr(_0x30c565,_0x12f963,_0x12961a);}; \ 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 95a44d4..ccca43a 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 _0x4746=['POST','/v1/speech:recognize?key=','8000','url','bluebird','exports','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','undefined','string','lang\x20should\x20be\x20a\x20string','toString'];(function(_0x5cbace,_0x33943c){var _0x6de5b8=function(_0x5aae38){while(--_0x5aae38){_0x5cbace['push'](_0x5cbace['shift']());}};_0x6de5b8(++_0x33943c);}(_0x4746,0xc6));var _0x6474=function(_0x243ad5,_0x34c387){_0x243ad5=_0x243ad5-0x0;var _0x1a072a=_0x4746[_0x243ad5];return _0x1a072a;};'use strict';var url=require(_0x6474('0x0'));var BPromise=require(_0x6474('0x1'));var fs=require('fs');var host='https://speech.googleapis.com';module[_0x6474('0x2')]=function(_0x59b95a,_0xd115f7,_0x244bc5){return new BPromise(function(_0x863c56,_0x156374){var _0x1314f4;if(typeof _0x59b95a!=='string'||_0x59b95a[_0x6474('0x3')]===0x0){return _0x156374(_0x6474('0x4'));}if(typeof _0xd115f7!=='string'||_0xd115f7[_0x6474('0x3')]===0x0){return _0x156374(_0x6474('0x5'));}if(typeof _0x244bc5!==_0x6474('0x6')&&(typeof _0x244bc5!==_0x6474('0x7')||_0x244bc5[_0x6474('0x3')]===0x0)){return _0x156374(_0x6474('0x8'));}try{_0x1314f4=fs['readFileSync'](_0x59b95a)[_0x6474('0x9')]('base64');}catch(_0x5335ac){return _0x156374(_0x5335ac);}return _0x863c56({'method':_0x6474('0xa'),'uri':host+_0x6474('0xb')+_0xd115f7,'body':{'config':{'encoding':'LINEAR16','sampleRateHertz':_0x6474('0xc'),'languageCode':_0x244bc5},'audio':{'content':_0x1314f4}},'json':!![]});});}; \ No newline at end of file +var _0xda65=['LINEAR16','8000','url','bluebird','https://speech.googleapis.com','string','length','filepath\x20should\x20be\x20a\x20string','key\x20should\x20be\x20a\x20string','readFileSync','toString','base64','POST','/v1/speech:recognize?key='];(function(_0x17d9e3,_0x1f969c){var _0x14192d=function(_0x159745){while(--_0x159745){_0x17d9e3['push'](_0x17d9e3['shift']());}};_0x14192d(++_0x1f969c);}(_0xda65,0x1d0));var _0x5da6=function(_0x5dcc99,_0x59ff2b){_0x5dcc99=_0x5dcc99-0x0;var _0x12f157=_0xda65[_0x5dcc99];return _0x12f157;};'use strict';var url=require(_0x5da6('0x0'));var BPromise=require(_0x5da6('0x1'));var fs=require('fs');var host=_0x5da6('0x2');module['exports']=function(_0x377db8,_0x20415b,_0xd35866){return new BPromise(function(_0x487700,_0x5c80b4){var _0x73d407;if(typeof _0x377db8!==_0x5da6('0x3')||_0x377db8[_0x5da6('0x4')]===0x0){return _0x5c80b4(_0x5da6('0x5'));}if(typeof _0x20415b!==_0x5da6('0x3')||_0x20415b['length']===0x0){return _0x5c80b4(_0x5da6('0x6'));}if(typeof _0xd35866!=='undefined'&&(typeof _0xd35866!=='string'||_0xd35866[_0x5da6('0x4')]===0x0)){return _0x5c80b4('lang\x20should\x20be\x20a\x20string');}try{_0x73d407=fs[_0x5da6('0x7')](_0x377db8)[_0x5da6('0x8')](_0x5da6('0x9'));}catch(_0x28d332){return _0x5c80b4(_0x28d332);}return _0x487700({'method':_0x5da6('0xa'),'uri':host+_0x5da6('0xb')+_0x20415b,'body':{'config':{'encoding':_0x5da6('0xc'),'sampleRateHertz':_0x5da6('0xd'),'languageCode':_0xd35866},'audio':{'content':_0x73d407}},'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 5f30fbe..932b813 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 _0x854a=['exports','./asr'];(function(_0x42245d,_0x51758f){var _0x4b211a=function(_0x2634e){while(--_0x2634e){_0x42245d['push'](_0x42245d['shift']());}};_0x4b211a(++_0x51758f);}(_0x854a,0x1c3));var _0xa854=function(_0x4788c2,_0x50a78b){_0x4788c2=_0x4788c2-0x0;var _0x50a1fe=_0x854a[_0x4788c2];return _0x50a1fe;};var asr=require(_0xa854('0x0'));module[_0xa854('0x1')]={'asr':asr}; \ No newline at end of file +var _0x3b06=['exports','./asr'];(function(_0x5c3a51,_0x182151){var _0x2815c3=function(_0x5a94f7){while(--_0x5a94f7){_0x5c3a51['push'](_0x5c3a51['shift']());}};_0x2815c3(++_0x182151);}(_0x3b06,0x93));var _0x63b0=function(_0x2f71f6,_0x3a1f4d){_0x2f71f6=_0x2f71f6-0x0;var _0x2b23ea=_0x3b06[_0x2f71f6];return _0x2b23ea;};var asr=require(_0x63b0('0x0'));module[_0x63b0('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 1d09515..1b067fe 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 _0x01e0=['googleTTS','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','text\x20length\x20limit\x20reached','lang\x20\x22','\x22\x20might\x20not\x20exist','writeFileSync','goggleTTS\x20path','googleASR','uri','results','map','transcript','join','alternatives','confidence','googleASR\x20confidence','[%s]\x20%s:%s','name','message','googleDialogflow','textRequest','result','source','actionIncomplete','speech','metadata','endConversation','isFallbackIntent','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','length','Dialogflow\x20V2\x20response:','queryResult','action','allRequiredParamsPresent','diagnosticInfo','fields','boolValue','intent','displayName','isFallback','queryText','fulfillmentText','tildeASR','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','format','model=%s','freeform=3','parse','sestekNDA','nda','CustomAction','channelData','AudioFromTts','Data','audiofile','apiai-promise','bluebird','dialogflow','path','querystring','request-promise','sox','google-tts-api','url','util','./aws','./google','./sestek','./tilde','../../../config/logger','agi','protocol','WHAT_EVER','get','statusCode','request\x20to\x20','statusMessage','\x20failed,\x20status\x20code\x20=\x20','createWriteStream','finish','info','close','error','unlink','download\x20error','end','https:','host','data','transcode','finish\x20to\x20convert','start','tmp','.wav','base64','then','777','readFileSync','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','?key=','input','audioConfig','MP3','text:synthesize','POST','resolve','generate','.mp3','from','chmodSync','googleCloudTTS\x20path','split'];(function(_0x3f5f9a,_0x567b5c){var _0x34f86b=function(_0x33cff0){while(--_0x33cff0){_0x3f5f9a['push'](_0x3f5f9a['shift']());}};_0x34f86b(++_0x567b5c);}(_0x01e0,0x1cd));var _0x001e=function(_0x230949,_0x790da6){_0x230949=_0x230949-0x0;var _0x54a3dd=_0x01e0[_0x230949];return _0x54a3dd;};'use strict';var apiai=require(_0x001e('0x0'));var BPromise=require(_0x001e('0x1'));var dialogflow=require(_0x001e('0x2'));var fs=require('fs');var http=require('http');var https=require('https');var md5=require('md5');var path=require(_0x001e('0x3'));var querystring=require(_0x001e('0x4'));var rp=require(_0x001e('0x5'));var rs=require('randomstring');var sox=require(_0x001e('0x6'));var tts=require(_0x001e('0x7'));var urlParse=require(_0x001e('0x8'))['parse'];var util=require(_0x001e('0x9'));var aws=require(_0x001e('0xa'));var google=require(_0x001e('0xb'));var sestek=require(_0x001e('0xc'));var tilde=require(_0x001e('0xd'));var logger=require(_0x001e('0xe'))(_0x001e('0xf'));var ISPEECH_API='https://api.ispeech.org/api/rest';function downloadFile(_0x33073b,_0x454ec0){return new BPromise(function(_0x53bcd7,_0x16288e){var _0x430825=urlParse(_0x33073b);var _0x329aca=_0x430825[_0x001e('0x10')]==='https:'?https:http;var _0x1b5a75={'host':_0x430825['host'],'path':_0x430825[_0x001e('0x3')],'headers':{'user-agent':_0x001e('0x11')}};_0x329aca[_0x001e('0x12')](_0x1b5a75,function(_0x14cde2){if(_0x14cde2[_0x001e('0x13')]!==0xc8){logger['error'](_0x001e('0x14')+_0x33073b+'\x20failed,\x20status\x20code\x20=\x20'+_0x14cde2[_0x001e('0x13')]+'\x20('+_0x14cde2[_0x001e('0x15')]+')');_0x16288e(new Error(_0x001e('0x14')+_0x33073b+_0x001e('0x16')+_0x14cde2[_0x001e('0x13')]+'\x20('+_0x14cde2['statusMessage']+')'));return;}var _0x39a877=fs[_0x001e('0x17')](_0x454ec0);_0x39a877['on'](_0x001e('0x18'),function(){logger[_0x001e('0x19')]('finish\x20download\x20file');_0x39a877[_0x001e('0x1a')](_0x53bcd7);});_0x39a877['on'](_0x001e('0x1b'),function(_0x47d22e){fs[_0x001e('0x1c')](_0x454ec0);logger[_0x001e('0x1b')](_0x001e('0x1d'),_0x47d22e);_0x16288e(_0x47d22e);});_0x14cde2['pipe'](_0x39a877);})['on']('error',function(_0x486f2a){logger[_0x001e('0x1b')](_0x486f2a);_0x16288e(_0x486f2a);})[_0x001e('0x1e')]();});}function uploadFile(_0x11a0a2){return new BPromise(function(_0x2ae67c,_0x3ef911){var _0x548706=urlParse(_0x11a0a2);var _0x347e7c=_0x548706[_0x001e('0x10')]===_0x001e('0x1f')?https:http;var _0x1f7ced={'host':_0x548706[_0x001e('0x20')],'path':_0x548706[_0x001e('0x3')],'headers':{'user-agent':_0x001e('0x11')}};_0x347e7c[_0x001e('0x12')](_0x1f7ced,function(_0x59e0ae){if(_0x59e0ae[_0x001e('0x13')]!==0xc8){_0x3ef911(new Error(_0x001e('0x14')+_0x11a0a2+'\x20failed,\x20status\x20code\x20=\x20'+_0x59e0ae[_0x001e('0x13')]+'\x20('+_0x59e0ae[_0x001e('0x15')]+')'));return;}var _0x4f9c5a='';_0x59e0ae['on'](_0x001e('0x21'),function(_0x5d9899){_0x4f9c5a+=_0x5d9899;});_0x59e0ae['on'](_0x001e('0x1e'),function(){_0x2ae67c(_0x4f9c5a);});})['on']('error',function(_0x3c6412){_0x3ef911(_0x3c6412);})[_0x001e('0x1e')]();});}function convertFile(_0x572daf,_0x1117a4){return new BPromise(function(_0x306733,_0x771a6e){var _0x36e8e6=sox[_0x001e('0x22')](_0x572daf,_0x1117a4,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x36e8e6['on']('error',function(_0x4b8729){logger[_0x001e('0x1b')]('error\x20convert',_0x4b8729);_0x771a6e(_0x4b8729);});_0x36e8e6['on'](_0x001e('0x1e'),function(){logger[_0x001e('0x19')](_0x001e('0x23'));_0x306733();});_0x36e8e6[_0x001e('0x24')]();});}function base64Decode(_0x351fe1,_0x46e94c){var _0x242921=path['resolve'](__dirname,_0x001e('0x25'),rs['generate'](0x4)+_0x001e('0x26'));fs['writeFileSync'](_0x242921,_0x351fe1,_0x001e('0x27'));return convertFile(_0x242921,_0x46e94c)[_0x001e('0x28')](function(){try{fs[_0x001e('0x1c')](_0x242921);fs['chmodSync'](_0x46e94c,_0x001e('0x29'));}catch(_0x4f2398){logger[_0x001e('0x1b')](_0x4f2398);}return _0x46e94c['split']('.')[0x0];});}function base64Encode(_0x351235){var _0x1ee0ba=fs[_0x001e('0x2a')](_0x351235);return new Buffer(_0x1ee0ba)[_0x001e('0x2b')](_0x001e('0x27'));}exports[_0x001e('0x2c')]=function(_0x43344a,_0x377811,_0x294038,_0x25565c,_0x28bd16,_0x25cf49){var _0x3d53aa,_0x52a851;var _0x336b76=_0x001e('0x2d');var _0x3aaa01=_0x001e('0x2e')+_0x43344a;var _0x16d5a2={};if(_0x377811==='ssml'){_0x16d5a2['input']={'ssml':_0x294038};}else{_0x16d5a2[_0x001e('0x2f')]={'text':_0x294038};};_0x16d5a2['voice']={'languageCode':_0x25565c,'ssmlGender':_0x28bd16};_0x16d5a2[_0x001e('0x30')]={'audioEncoding':_0x001e('0x31'),'sampleRateHertz':0x1f40};var _0x404e2e={'url':_0x336b76+_0x001e('0x32')+_0x3aaa01,'method':_0x001e('0x33'),'json':!![],'body':_0x16d5a2};return rp(_0x404e2e)[_0x001e('0x28')](function(_0x549110){return new BPromise(function(_0x56a91f,_0x424a2f){_0x3d53aa=path[_0x001e('0x34')](__dirname,_0x001e('0x25'),rs[_0x001e('0x35')](0x4)+_0x001e('0x36'));var _0x2a64df=Buffer[_0x001e('0x37')](_0x549110['audioContent'],_0x001e('0x27'));return fs['writeFile'](_0x3d53aa,_0x2a64df,function(_0x5119dd){_0x424a2f(_0x5119dd);},function(_0x4f9b98){fs['chmodSync'](_0x3d53aa,_0x001e('0x29'));_0x56a91f(_0x4f9b98);});});})[_0x001e('0x28')](function(_0x3d79f8){_0x52a851=path[_0x001e('0x34')](__dirname,'tmp',rs[_0x001e('0x35')](0x4)+_0x001e('0x26'));return convertFile(_0x3d53aa,_0x52a851);})[_0x001e('0x28')](function(){try{fs[_0x001e('0x1c')](_0x3d53aa);fs[_0x001e('0x38')](_0x52a851,_0x001e('0x29'));}catch(_0x52bb07){logger[_0x001e('0x1b')](_0x52bb07);}logger[_0x001e('0x19')](_0x001e('0x39'),_0x52a851[_0x001e('0x3a')]('.')[0x0]);return _0x52a851['split']('.')[0x0];});};exports[_0x001e('0x3b')]=function(_0x187de9,_0x250be5){var _0x56e01b='https://translate.google.com/_/TranslateWebserverUi/data/batchexecute';var _0x39e83f,_0x4ed9b7;var _0x177ad8;var _0xd38cd5={'encoding':_0x001e('0x3c'),'method':_0x001e('0x33'),'timeout':0x2710,'url':_0x56e01b,'headers':{'Content-Type':_0x001e('0x3d')},'body':_0x001e('0x3e')+encodeURIComponent(JSON[_0x001e('0x3f')]([[[_0x001e('0x40'),JSON['stringify']([_0x187de9,_0x250be5||'en',![],_0x001e('0x41')]),null,'generic']]]))};return rp(_0xd38cd5)[_0x001e('0x28')](function(_0x291dc8){try{_0x177ad8=eval(_0x291dc8[_0x001e('0x42')](0x5))[0x0][0x2];}catch(_0x1f3aad){throw new Error(_0x001e('0x43')+_0x291dc8['data']);}if(!_0x177ad8){if(_0x187de9['length']>0xc8){throw new Error(_0x001e('0x44'));}else{throw new Error(_0x001e('0x45')+_0x250be5+_0x001e('0x46'));}}try{_0x177ad8=eval(_0x177ad8)[0x0];}catch(_0x42d955){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x001e('0x21')]);}const _0x1b1710=_0x177ad8;_0x39e83f=path[_0x001e('0x34')](__dirname,_0x001e('0x25'),rs[_0x001e('0x35')](0x4)+_0x001e('0x36'));fs[_0x001e('0x47')](_0x39e83f,_0x177ad8,{'encoding':_0x001e('0x27')});_0x4ed9b7=path[_0x001e('0x34')](__dirname,_0x001e('0x25'),rs[_0x001e('0x35')](0x4)+'.wav');return convertFile(_0x39e83f,_0x4ed9b7);})['then'](function(){try{fs[_0x001e('0x1c')](_0x39e83f);fs[_0x001e('0x38')](_0x4ed9b7,'777');}catch(_0x5267a9){logger[_0x001e('0x1b')](_0x5267a9);}logger[_0x001e('0x19')](_0x001e('0x48'),_0x4ed9b7[_0x001e('0x3a')]('.')[0x0]);return _0x4ed9b7[_0x001e('0x3a')]('.')[0x0];});};exports[_0x001e('0x49')]=function(_0x4ebc84,_0x1cca1c,_0x259d65){return google['asr'](_0x4ebc84,_0x1cca1c,_0x259d65)[_0x001e('0x28')](function(_0x11e105){logger[_0x001e('0x19')](_0x11e105[_0x001e('0x4a')]);return rp(_0x11e105);})[_0x001e('0x28')](function(_0x1d3b8a){var _0x80af31='';var _0x228a02=0x0;try{fs[_0x001e('0x1c')](_0x4ebc84);}catch(_0x242798){logger['error'](_0x242798);}if(_0x1d3b8a&&_0x1d3b8a[_0x001e('0x4b')]){_0x80af31=_0x1d3b8a[_0x001e('0x4b')][_0x001e('0x4c')](function(_0x29f777){return _0x29f777&&_0x29f777['alternatives'][0x0]&&_0x29f777['alternatives'][0x0][_0x001e('0x4d')]?_0x29f777['alternatives'][0x0][_0x001e('0x4d')]:'';})[_0x001e('0x4e')]('\x0a');_0x228a02=_0x1d3b8a[_0x001e('0x4b')][_0x001e('0x4c')](function(_0x3aaaa8){return _0x3aaaa8&&_0x3aaaa8[_0x001e('0x4f')][0x0]&&_0x3aaaa8['alternatives'][0x0][_0x001e('0x50')]?_0x3aaaa8[_0x001e('0x4f')][0x0][_0x001e('0x50')]:0x0;})[_0x001e('0x4e')]('\x0a');}logger[_0x001e('0x19')]('googleASR\x20transcription',_0x80af31);logger[_0x001e('0x19')](_0x001e('0x51'),_0x228a02);return{'transcript':_0x80af31,'confidence':_0x228a02};})['catch'](function(_0x32cd3c){logger[_0x001e('0x1b')](_0x001e('0x52'),_0x32cd3c[_0x001e('0x13')],_0x32cd3c[_0x001e('0x53')],_0x32cd3c[_0x001e('0x54')]);});};exports[_0x001e('0x55')]=function(_0x52fe8a,_0x24b144,_0x543b79,_0xc1ca62){var _0x3994c5=apiai(_0x24b144,{'language':_0xc1ca62||'en'});return _0x3994c5[_0x001e('0x56')](_0x543b79,{'sessionId':md5(_0x52fe8a)})[_0x001e('0x28')](function(_0x8d86a1){logger[_0x001e('0x19')](JSON['stringify'](_0x8d86a1));return{'source':_0x8d86a1[_0x001e('0x57')][_0x001e('0x58')],'resolvedQuery':_0x8d86a1['result']['resolvedQuery'],'action':_0x8d86a1['result']['action'],'actionIncomplete':_0x8d86a1[_0x001e('0x57')][_0x001e('0x59')],'speech':_0x8d86a1[_0x001e('0x57')]['fulfillment'][_0x001e('0x5a')],'score':_0x8d86a1['result']['score'],'statusCode':_0x8d86a1['status']['code'],'endConversation':_0x8d86a1[_0x001e('0x57')][_0x001e('0x5b')][_0x001e('0x5c')]||![],'isFallbackIntent':_0x8d86a1[_0x001e('0x57')][_0x001e('0x5b')][_0x001e('0x5d')]};});};exports[_0x001e('0x5e')]=function(_0x512df9,_0x255e01,_0x3871e7,_0x4fdb68,_0x53e248,_0x38cdaa){var _0x4e45e2=_0x4fdb68[_0x001e('0x5f')](/\\n/g,'\x0a');var _0x30dc53={'credentials':{'private_key':_0x4e45e2,'client_email':_0x3871e7}};var _0x3576c3=new dialogflow[(_0x001e('0x60'))](_0x30dc53);var _0x4e2b4c=_0x3576c3[_0x001e('0x61')](_0x255e01,md5(_0x512df9));var _0x44a1c9={'session':_0x4e2b4c,'queryInput':{'text':{'text':_0x53e248,'languageCode':_0x38cdaa}}};return _0x3576c3[_0x001e('0x62')](_0x44a1c9)['then'](function(_0x3a502d){if(_0x3a502d&&_0x3a502d[_0x001e('0x63')]){logger['info'](_0x001e('0x64'),JSON[_0x001e('0x3f')](_0x3a502d));var _0x4be256=_0x3a502d[0x0];if(_0x4be256){var _0xd0b87e={'action':_0x4be256[_0x001e('0x65')][_0x001e('0x66')],'allRequiredParamsPresent':_0x4be256['queryResult'][_0x001e('0x67')],'endConversation':_0x4be256[_0x001e('0x65')][_0x001e('0x68')]&&_0x4be256['queryResult'][_0x001e('0x68')][_0x001e('0x69')]?_0x4be256[_0x001e('0x65')]['diagnosticInfo'][_0x001e('0x69')]['end_conversation'][_0x001e('0x6a')]:![],'fulfillmentText':_0x4be256[_0x001e('0x65')]['fulfillmentText'],'intentName':_0x4be256['queryResult'][_0x001e('0x6b')][_0x001e('0x53')],'intentDisplayName':_0x4be256[_0x001e('0x65')][_0x001e('0x6b')][_0x001e('0x6c')],'isFallbackIntent':_0x4be256[_0x001e('0x65')]['intent'][_0x001e('0x6d')],'languageCode':_0x4be256['queryResult']['languageCode'],'queryText':_0x4be256['queryResult'][_0x001e('0x6e')],'responseId':_0x4be256['responseId'],'score':_0x4be256[_0x001e('0x65')]['intentDetectionConfidence'],'speech':_0x4be256[_0x001e('0x65')][_0x001e('0x6f')],'providerResponse':JSON['stringify'](_0x3a502d)};return _0xd0b87e;}}});};exports[_0x001e('0x70')]=function(_0x4ea546,_0x23d809,_0x163b97,_0x9eef52){return tilde[_0x001e('0x71')](_0x4ea546,_0x23d809,_0x163b97,_0x9eef52)['then'](function(_0x39c8cb){try{fs[_0x001e('0x1c')](_0x4ea546);}catch(_0x5d5996){logger[_0x001e('0x1b')](_0x5d5996);}logger[_0x001e('0x19')](_0x001e('0x72'),_0x39c8cb[_0x001e('0x4d')]);logger[_0x001e('0x19')](_0x001e('0x73'),_0x39c8cb['confidence']);return _0x39c8cb;});};exports[_0x001e('0x74')]=function(_0x13c687,_0x338420,_0x4769e4,_0x17e6f9,_0x184433,_0x26653e){var _0x3b3b46=path[_0x001e('0x34')](__dirname,_0x001e('0x25'),rs[_0x001e('0x35')](0x4)+_0x001e('0x36'));var _0x17d2df;return aws[_0x001e('0x75')](_0x13c687,_0x338420,_0x4769e4,_0x17e6f9,_0x184433,_0x26653e,_0x3b3b46)[_0x001e('0x28')](function(){_0x17d2df=path['resolve'](__dirname,_0x001e('0x25'),rs[_0x001e('0x35')](0x4)+_0x001e('0x26'));return convertFile(_0x3b3b46,_0x17d2df);})[_0x001e('0x28')](function(){try{fs[_0x001e('0x1c')](_0x3b3b46);fs['chmodSync'](_0x17d2df,_0x001e('0x29'));}catch(_0x4c448c){logger[_0x001e('0x1b')](_0x4c448c);}return _0x17d2df['split']('.')[0x0];});};exports[_0x001e('0x76')]=function(_0x3d959f,_0x59f0b,_0x183bd2,_0x117b93,_0x2ef176,_0x27898c){return aws['lex'](_0x3d959f,_0x59f0b,_0x183bd2,_0x117b93,_0x2ef176,_0x27898c)[_0x001e('0x28')](function(_0x3fa7d2){logger[_0x001e('0x19')](JSON[_0x001e('0x3f')](_0x3fa7d2));return _0x3fa7d2;});};exports['ispeechTTS']=function(_0x129453,_0x545f0e,_0x3edf82,_0x551ec1){var _0x229632=util[_0x001e('0x77')]('%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3',ISPEECH_API,_0x129453,encodeURIComponent(_0x545f0e),_0x3edf82,_0x551ec1);var _0xd4199a=path[_0x001e('0x34')](__dirname,_0x001e('0x25'),rs['generate'](0x4)+_0x001e('0x36'));var _0x327bfa;return downloadFile(_0x229632,_0xd4199a)[_0x001e('0x28')](function(){_0x327bfa=path[_0x001e('0x34')](__dirname,_0x001e('0x25'),rs['generate'](0x4)+_0x001e('0x26'));return convertFile(_0xd4199a,_0x327bfa);})[_0x001e('0x28')](function(){try{fs[_0x001e('0x1c')](_0xd4199a);fs['chmodSync'](_0x327bfa,'777');}catch(_0x78b0cc){logger[_0x001e('0x1b')](_0x78b0cc);}return _0x327bfa['split']('.')[0x0];});};exports['ispeechASR']=function(_0x4c18a3,_0x3f07de,_0xdbb52f,_0x43bc14){var _0x1472fb=util[_0x001e('0x77')]('%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s',ISPEECH_API,_0x3f07de,_0xdbb52f,base64Encode(_0x4c18a3),_0x43bc14?util[_0x001e('0x77')](_0x001e('0x78'),encodeURIComponent(_0x43bc14)):_0x001e('0x79'));return uploadFile(_0x1472fb)['then'](function(_0x5a8d8f){return querystring[_0x001e('0x7a')](_0x5a8d8f);});};exports[_0x001e('0x7b')]=function(_0x2aa1ec,_0x176fef){return sestek[_0x001e('0x7c')](_0x2aa1ec,_0x176fef)[_0x001e('0x28')](function(_0x1830dc){logger[_0x001e('0x19')](JSON[_0x001e('0x3f')](_0x1830dc));var _0x5df524={'speech':_0x1830dc['text'],'action':_0x1830dc['channelData']?_0x1830dc['channelData'][_0x001e('0x7d')]:undefined,'actiondata':_0x1830dc[_0x001e('0x7e')]?_0x1830dc[_0x001e('0x7e')]['CustomActionData']:undefined};if(_0x1830dc[_0x001e('0x7e')]&&_0x1830dc['channelData'][_0x001e('0x7f')]){return base64Decode(_0x1830dc[_0x001e('0x7e')][_0x001e('0x7f')][_0x001e('0x80')],path['resolve'](__dirname,_0x001e('0x25'),rs['generate'](0x4)+_0x001e('0x26')))[_0x001e('0x28')](function(_0x52de23){_0x5df524[_0x001e('0x81')]=_0x52de23;return _0x5df524;});}return _0x5df524;});};exports['dirName']=function(){return __dirname;}; \ No newline at end of file +var _0xbc79=['googleASR\x20confidence','message','googleDialogflow','textRequest','result','action','actionIncomplete','fulfillment','speech','score','status','metadata','endConversation','googleDialogflowV2','replace','SessionsClient','sessionPath','detectIntent','Dialogflow\x20V2\x20response:','queryResult','allRequiredParamsPresent','fulfillmentText','intent','displayName','languageCode','queryText','responseId','intentDetectionConfidence','asr','Tilde\x20ASR\x20transcription','Tilde\x20ASR\x20confidence','awsPolly','polly','awsLex','lex','ispeechTTS','format','%s?apikey=%s&action=convert&text=%s&voice=%s&speed=%s&format=mp3','ispeechASR','%s?apikey=%s&action=recognize&locale=%s&content-type=audio/x-wav&audio=%s&%s','freeform=3','nda','channelData','CustomAction','CustomActionData','AudioFromTts','audiofile','dirName','apiai-promise','bluebird','dialogflow','https','md5','path','querystring','request-promise','randomstring','sox','url','parse','./aws','./google','./tilde','../../../config/logger','agi','https://api.ispeech.org/api/rest','https:','host','get','error','\x20failed,\x20status\x20code\x20=\x20','statusCode','request\x20to\x20','statusMessage','createWriteStream','finish\x20download\x20file','unlink','download\x20error','end','protocol','WHAT_EVER','data','error\x20convert','info','finish\x20to\x20convert','start','generate','.wav','writeFileSync','base64','then','chmodSync','777','split','toString','googleCloudTTS','https://texttospeech.googleapis.com/v1/','ssml','input','audioConfig','MP3','text:synthesize','POST','resolve','tmp','.mp3','from','audioContent','writeFile','googleCloudTTS\x20path','https://translate.google.com/_/TranslateWebserverUi/data/batchexecute','utf8','application/x-www-form-urlencoded','f.req=','stringify','jQ1olc','null','slice','parse\x20response\x20failed:\x0a','length','text\x20length\x20limit\x20reached','\x22\x20might\x20not\x20exist','goggleTTS\x20path','googleASR','uri','results','map','alternatives','transcript','join','confidence'];(function(_0x128561,_0x3f5e94){var _0x58efaa=function(_0x135b10){while(--_0x135b10){_0x128561['push'](_0x128561['shift']());}};_0x58efaa(++_0x3f5e94);}(_0xbc79,0xb3));var _0x9bc7=function(_0x431dcd,_0x1afefb){_0x431dcd=_0x431dcd-0x0;var _0x489573=_0xbc79[_0x431dcd];return _0x489573;};'use strict';var apiai=require(_0x9bc7('0x0'));var BPromise=require(_0x9bc7('0x1'));var dialogflow=require(_0x9bc7('0x2'));var fs=require('fs');var http=require('http');var https=require(_0x9bc7('0x3'));var md5=require(_0x9bc7('0x4'));var path=require(_0x9bc7('0x5'));var querystring=require(_0x9bc7('0x6'));var rp=require(_0x9bc7('0x7'));var rs=require(_0x9bc7('0x8'));var sox=require(_0x9bc7('0x9'));var tts=require('google-tts-api');var urlParse=require(_0x9bc7('0xa'))[_0x9bc7('0xb')];var util=require('util');var aws=require(_0x9bc7('0xc'));var google=require(_0x9bc7('0xd'));var sestek=require('./sestek');var tilde=require(_0x9bc7('0xe'));var logger=require(_0x9bc7('0xf'))(_0x9bc7('0x10'));var ISPEECH_API=_0x9bc7('0x11');function downloadFile(_0x328379,_0x5a939e){return new BPromise(function(_0x39dff9,_0x3b9664){var _0xb1fbd2=urlParse(_0x328379);var _0x3f30de=_0xb1fbd2['protocol']===_0x9bc7('0x12')?https:http;var _0x3fdac6={'host':_0xb1fbd2[_0x9bc7('0x13')],'path':_0xb1fbd2[_0x9bc7('0x5')],'headers':{'user-agent':'WHAT_EVER'}};_0x3f30de[_0x9bc7('0x14')](_0x3fdac6,function(_0x88455a){if(_0x88455a['statusCode']!==0xc8){logger[_0x9bc7('0x15')]('request\x20to\x20'+_0x328379+_0x9bc7('0x16')+_0x88455a[_0x9bc7('0x17')]+'\x20('+_0x88455a['statusMessage']+')');_0x3b9664(new Error(_0x9bc7('0x18')+_0x328379+_0x9bc7('0x16')+_0x88455a[_0x9bc7('0x17')]+'\x20('+_0x88455a[_0x9bc7('0x19')]+')'));return;}var _0x72ac6=fs[_0x9bc7('0x1a')](_0x5a939e);_0x72ac6['on']('finish',function(){logger['info'](_0x9bc7('0x1b'));_0x72ac6['close'](_0x39dff9);});_0x72ac6['on'](_0x9bc7('0x15'),function(_0x34e408){fs[_0x9bc7('0x1c')](_0x5a939e);logger[_0x9bc7('0x15')](_0x9bc7('0x1d'),_0x34e408);_0x3b9664(_0x34e408);});_0x88455a['pipe'](_0x72ac6);})['on'](_0x9bc7('0x15'),function(_0x383383){logger[_0x9bc7('0x15')](_0x383383);_0x3b9664(_0x383383);})[_0x9bc7('0x1e')]();});}function uploadFile(_0x29c284){return new BPromise(function(_0x27c6ea,_0x42e1b5){var _0xf9becb=urlParse(_0x29c284);var _0x200abe=_0xf9becb[_0x9bc7('0x1f')]==='https:'?https:http;var _0x5f558a={'host':_0xf9becb[_0x9bc7('0x13')],'path':_0xf9becb[_0x9bc7('0x5')],'headers':{'user-agent':_0x9bc7('0x20')}};_0x200abe[_0x9bc7('0x14')](_0x5f558a,function(_0x2f2d27){if(_0x2f2d27[_0x9bc7('0x17')]!==0xc8){_0x42e1b5(new Error(_0x9bc7('0x18')+_0x29c284+_0x9bc7('0x16')+_0x2f2d27['statusCode']+'\x20('+_0x2f2d27['statusMessage']+')'));return;}var _0x4a8ee8='';_0x2f2d27['on'](_0x9bc7('0x21'),function(_0x54a8f2){_0x4a8ee8+=_0x54a8f2;});_0x2f2d27['on'](_0x9bc7('0x1e'),function(){_0x27c6ea(_0x4a8ee8);});})['on'](_0x9bc7('0x15'),function(_0x4e9080){_0x42e1b5(_0x4e9080);})['end']();});}function convertFile(_0x4c0fed,_0x532e08){return new BPromise(function(_0x377d76,_0x55988e){var _0x1f4266=sox['transcode'](_0x4c0fed,_0x532e08,{'sampleRate':0x1f40,'format':'wav','channelCount':0x1,'bitRate':0xc0*0x400,'compressionQuality':0x5});_0x1f4266['on'](_0x9bc7('0x15'),function(_0x6eb797){logger[_0x9bc7('0x15')](_0x9bc7('0x22'),_0x6eb797);_0x55988e(_0x6eb797);});_0x1f4266['on'](_0x9bc7('0x1e'),function(){logger[_0x9bc7('0x23')](_0x9bc7('0x24'));_0x377d76();});_0x1f4266[_0x9bc7('0x25')]();});}function base64Decode(_0x278021,_0x48635b){var _0x5539d9=path['resolve'](__dirname,'tmp',rs[_0x9bc7('0x26')](0x4)+_0x9bc7('0x27'));fs[_0x9bc7('0x28')](_0x5539d9,_0x278021,_0x9bc7('0x29'));return convertFile(_0x5539d9,_0x48635b)[_0x9bc7('0x2a')](function(){try{fs[_0x9bc7('0x1c')](_0x5539d9);fs[_0x9bc7('0x2b')](_0x48635b,_0x9bc7('0x2c'));}catch(_0x4def0d){logger[_0x9bc7('0x15')](_0x4def0d);}return _0x48635b[_0x9bc7('0x2d')]('.')[0x0];});}function base64Encode(_0x4ec969){var _0x9e970=fs['readFileSync'](_0x4ec969);return new Buffer(_0x9e970)[_0x9bc7('0x2e')](_0x9bc7('0x29'));}exports[_0x9bc7('0x2f')]=function(_0x4c9afa,_0x2e83a5,_0x37989e,_0xa32960,_0x256637,_0xe3d4f6){var _0x175e63,_0x3f2ae9;var _0x3f3521=_0x9bc7('0x30');var _0x3793c3='?key='+_0x4c9afa;var _0x5171c1={};if(_0x2e83a5===_0x9bc7('0x31')){_0x5171c1[_0x9bc7('0x32')]={'ssml':_0x37989e};}else{_0x5171c1[_0x9bc7('0x32')]={'text':_0x37989e};};_0x5171c1['voice']={'languageCode':_0xa32960,'ssmlGender':_0x256637};_0x5171c1[_0x9bc7('0x33')]={'audioEncoding':_0x9bc7('0x34'),'sampleRateHertz':0x1f40};var _0x37501a={'url':_0x3f3521+_0x9bc7('0x35')+_0x3793c3,'method':_0x9bc7('0x36'),'json':!![],'body':_0x5171c1};return rp(_0x37501a)[_0x9bc7('0x2a')](function(_0x1599b0){return new BPromise(function(_0x56eaac,_0x2169e9){_0x175e63=path[_0x9bc7('0x37')](__dirname,_0x9bc7('0x38'),rs[_0x9bc7('0x26')](0x4)+_0x9bc7('0x39'));var _0x3ff8e8=Buffer[_0x9bc7('0x3a')](_0x1599b0[_0x9bc7('0x3b')],_0x9bc7('0x29'));return fs[_0x9bc7('0x3c')](_0x175e63,_0x3ff8e8,function(_0x10b7eb){_0x2169e9(_0x10b7eb);},function(_0x32176b){fs[_0x9bc7('0x2b')](_0x175e63,'777');_0x56eaac(_0x32176b);});});})[_0x9bc7('0x2a')](function(_0x25b5ed){_0x3f2ae9=path[_0x9bc7('0x37')](__dirname,'tmp',rs[_0x9bc7('0x26')](0x4)+_0x9bc7('0x27'));return convertFile(_0x175e63,_0x3f2ae9);})[_0x9bc7('0x2a')](function(){try{fs[_0x9bc7('0x1c')](_0x175e63);fs[_0x9bc7('0x2b')](_0x3f2ae9,_0x9bc7('0x2c'));}catch(_0x18f80d){logger[_0x9bc7('0x15')](_0x18f80d);}logger[_0x9bc7('0x23')](_0x9bc7('0x3d'),_0x3f2ae9[_0x9bc7('0x2d')]('.')[0x0]);return _0x3f2ae9[_0x9bc7('0x2d')]('.')[0x0];});};exports['googleTTS']=function(_0x1c136c,_0x170e67){var _0x13e16f=_0x9bc7('0x3e');var _0x355f3f,_0x15b611;var _0x3c5c76;var _0x41cbd8={'encoding':_0x9bc7('0x3f'),'method':'POST','timeout':0x2710,'url':_0x13e16f,'headers':{'Content-Type':_0x9bc7('0x40')},'body':_0x9bc7('0x41')+encodeURIComponent(JSON[_0x9bc7('0x42')]([[[_0x9bc7('0x43'),JSON[_0x9bc7('0x42')]([_0x1c136c,_0x170e67||'en',![],_0x9bc7('0x44')]),null,'generic']]]))};return rp(_0x41cbd8)[_0x9bc7('0x2a')](function(_0xb3b9d1){try{_0x3c5c76=eval(_0xb3b9d1[_0x9bc7('0x45')](0x5))[0x0][0x2];}catch(_0x3cf253){throw new Error(_0x9bc7('0x46')+_0xb3b9d1[_0x9bc7('0x21')]);}if(!_0x3c5c76){if(_0x1c136c[_0x9bc7('0x47')]>0xc8){throw new Error(_0x9bc7('0x48'));}else{throw new Error('lang\x20\x22'+_0x170e67+_0x9bc7('0x49'));}}try{_0x3c5c76=eval(_0x3c5c76)[0x0];}catch(_0x1df636){throw new Error('parse\x20response\x20failed:\x0a'+res[_0x9bc7('0x21')]);}const _0x1cb14b=_0x3c5c76;_0x355f3f=path[_0x9bc7('0x37')](__dirname,'tmp',rs[_0x9bc7('0x26')](0x4)+_0x9bc7('0x39'));fs[_0x9bc7('0x28')](_0x355f3f,_0x3c5c76,{'encoding':_0x9bc7('0x29')});_0x15b611=path[_0x9bc7('0x37')](__dirname,_0x9bc7('0x38'),rs['generate'](0x4)+'.wav');return convertFile(_0x355f3f,_0x15b611);})[_0x9bc7('0x2a')](function(){try{fs[_0x9bc7('0x1c')](_0x355f3f);fs[_0x9bc7('0x2b')](_0x15b611,'777');}catch(_0x1af475){logger[_0x9bc7('0x15')](_0x1af475);}logger[_0x9bc7('0x23')](_0x9bc7('0x4a'),_0x15b611[_0x9bc7('0x2d')]('.')[0x0]);return _0x15b611[_0x9bc7('0x2d')]('.')[0x0];});};exports[_0x9bc7('0x4b')]=function(_0x46d7c4,_0x1d9c56,_0x22f33f){return google['asr'](_0x46d7c4,_0x1d9c56,_0x22f33f)[_0x9bc7('0x2a')](function(_0xd6e14e){logger['info'](_0xd6e14e[_0x9bc7('0x4c')]);return rp(_0xd6e14e);})['then'](function(_0x18e729){var _0x484e55='';var _0x3dbf75=0x0;try{fs[_0x9bc7('0x1c')](_0x46d7c4);}catch(_0xaed94d){logger['error'](_0xaed94d);}if(_0x18e729&&_0x18e729[_0x9bc7('0x4d')]){_0x484e55=_0x18e729[_0x9bc7('0x4d')][_0x9bc7('0x4e')](function(_0x490392){return _0x490392&&_0x490392['alternatives'][0x0]&&_0x490392[_0x9bc7('0x4f')][0x0]['transcript']?_0x490392['alternatives'][0x0][_0x9bc7('0x50')]:'';})[_0x9bc7('0x51')]('\x0a');_0x3dbf75=_0x18e729['results'][_0x9bc7('0x4e')](function(_0x495c29){return _0x495c29&&_0x495c29['alternatives'][0x0]&&_0x495c29[_0x9bc7('0x4f')][0x0][_0x9bc7('0x52')]?_0x495c29[_0x9bc7('0x4f')][0x0][_0x9bc7('0x52')]:0x0;})[_0x9bc7('0x51')]('\x0a');}logger['info']('googleASR\x20transcription',_0x484e55);logger[_0x9bc7('0x23')](_0x9bc7('0x53'),_0x3dbf75);return{'transcript':_0x484e55,'confidence':_0x3dbf75};})['catch'](function(_0x45cdcd){logger[_0x9bc7('0x15')]('[%s]\x20%s:%s',_0x45cdcd[_0x9bc7('0x17')],_0x45cdcd['name'],_0x45cdcd[_0x9bc7('0x54')]);});};exports[_0x9bc7('0x55')]=function(_0x2dc896,_0x564bd0,_0x314966,_0x4673f6){var _0xd79c3=apiai(_0x564bd0,{'language':_0x4673f6||'en'});return _0xd79c3[_0x9bc7('0x56')](_0x314966,{'sessionId':md5(_0x2dc896)})[_0x9bc7('0x2a')](function(_0x8840d5){logger[_0x9bc7('0x23')](JSON[_0x9bc7('0x42')](_0x8840d5));return{'source':_0x8840d5[_0x9bc7('0x57')]['source'],'resolvedQuery':_0x8840d5[_0x9bc7('0x57')]['resolvedQuery'],'action':_0x8840d5['result'][_0x9bc7('0x58')],'actionIncomplete':_0x8840d5[_0x9bc7('0x57')][_0x9bc7('0x59')],'speech':_0x8840d5['result'][_0x9bc7('0x5a')][_0x9bc7('0x5b')],'score':_0x8840d5[_0x9bc7('0x57')][_0x9bc7('0x5c')],'statusCode':_0x8840d5[_0x9bc7('0x5d')]['code'],'endConversation':_0x8840d5[_0x9bc7('0x57')][_0x9bc7('0x5e')][_0x9bc7('0x5f')]||![],'isFallbackIntent':_0x8840d5[_0x9bc7('0x57')][_0x9bc7('0x5e')]['isFallbackIntent']};});};exports[_0x9bc7('0x60')]=function(_0x300f56,_0x1ec3df,_0xc7e1e1,_0x49ea53,_0x625ffa,_0x55a349){var _0x1b04c3=_0x49ea53[_0x9bc7('0x61')](/\\n/g,'\x0a');var _0x2898ee={'credentials':{'private_key':_0x1b04c3,'client_email':_0xc7e1e1}};var _0x1bf548=new dialogflow[(_0x9bc7('0x62'))](_0x2898ee);var _0x1cf997=_0x1bf548[_0x9bc7('0x63')](_0x1ec3df,md5(_0x300f56));var _0x16f52a={'session':_0x1cf997,'queryInput':{'text':{'text':_0x625ffa,'languageCode':_0x55a349}}};return _0x1bf548[_0x9bc7('0x64')](_0x16f52a)[_0x9bc7('0x2a')](function(_0x1916d1){if(_0x1916d1&&_0x1916d1[_0x9bc7('0x47')]){logger['info'](_0x9bc7('0x65'),JSON[_0x9bc7('0x42')](_0x1916d1));var _0x12b9e3=_0x1916d1[0x0];if(_0x12b9e3){var _0x1361aa={'action':_0x12b9e3['queryResult'][_0x9bc7('0x58')],'allRequiredParamsPresent':_0x12b9e3[_0x9bc7('0x66')][_0x9bc7('0x67')],'endConversation':_0x12b9e3[_0x9bc7('0x66')]['diagnosticInfo']&&_0x12b9e3[_0x9bc7('0x66')]['diagnosticInfo']['fields']?_0x12b9e3['queryResult']['diagnosticInfo']['fields']['end_conversation']['boolValue']:![],'fulfillmentText':_0x12b9e3[_0x9bc7('0x66')][_0x9bc7('0x68')],'intentName':_0x12b9e3[_0x9bc7('0x66')][_0x9bc7('0x69')]['name'],'intentDisplayName':_0x12b9e3[_0x9bc7('0x66')][_0x9bc7('0x69')][_0x9bc7('0x6a')],'isFallbackIntent':_0x12b9e3[_0x9bc7('0x66')]['intent']['isFallback'],'languageCode':_0x12b9e3[_0x9bc7('0x66')][_0x9bc7('0x6b')],'queryText':_0x12b9e3['queryResult'][_0x9bc7('0x6c')],'responseId':_0x12b9e3[_0x9bc7('0x6d')],'score':_0x12b9e3[_0x9bc7('0x66')][_0x9bc7('0x6e')],'speech':_0x12b9e3[_0x9bc7('0x66')]['fulfillmentText'],'providerResponse':JSON[_0x9bc7('0x42')](_0x1916d1)};return _0x1361aa;}}});};exports['tildeASR']=function(_0x37862d,_0x1bdf99,_0x5e3ec8,_0x2961bc){return tilde[_0x9bc7('0x6f')](_0x37862d,_0x1bdf99,_0x5e3ec8,_0x2961bc)['then'](function(_0xf05ce6){try{fs[_0x9bc7('0x1c')](_0x37862d);}catch(_0x37d8e3){logger[_0x9bc7('0x15')](_0x37d8e3);}logger[_0x9bc7('0x23')](_0x9bc7('0x70'),_0xf05ce6['transcript']);logger[_0x9bc7('0x23')](_0x9bc7('0x71'),_0xf05ce6[_0x9bc7('0x52')]);return _0xf05ce6;});};exports[_0x9bc7('0x72')]=function(_0x18d64e,_0x32def7,_0x562231,_0xf6c895,_0x5e1f2f,_0x202a72){var _0x517661=path[_0x9bc7('0x37')](__dirname,_0x9bc7('0x38'),rs[_0x9bc7('0x26')](0x4)+_0x9bc7('0x39'));var _0x50714d;return aws[_0x9bc7('0x73')](_0x18d64e,_0x32def7,_0x562231,_0xf6c895,_0x5e1f2f,_0x202a72,_0x517661)[_0x9bc7('0x2a')](function(){_0x50714d=path[_0x9bc7('0x37')](__dirname,_0x9bc7('0x38'),rs[_0x9bc7('0x26')](0x4)+_0x9bc7('0x27'));return convertFile(_0x517661,_0x50714d);})[_0x9bc7('0x2a')](function(){try{fs['unlink'](_0x517661);fs[_0x9bc7('0x2b')](_0x50714d,_0x9bc7('0x2c'));}catch(_0x450a83){logger[_0x9bc7('0x15')](_0x450a83);}return _0x50714d['split']('.')[0x0];});};exports[_0x9bc7('0x74')]=function(_0x25d01b,_0x41fd1f,_0x445a73,_0x29fb72,_0x37728a,_0x20ea47){return aws[_0x9bc7('0x75')](_0x25d01b,_0x41fd1f,_0x445a73,_0x29fb72,_0x37728a,_0x20ea47)[_0x9bc7('0x2a')](function(_0x189503){logger[_0x9bc7('0x23')](JSON[_0x9bc7('0x42')](_0x189503));return _0x189503;});};exports[_0x9bc7('0x76')]=function(_0x55d838,_0x4dd845,_0x1af4ef,_0x2d82c4){var _0x557e5f=util[_0x9bc7('0x77')](_0x9bc7('0x78'),ISPEECH_API,_0x55d838,encodeURIComponent(_0x4dd845),_0x1af4ef,_0x2d82c4);var _0x43012f=path[_0x9bc7('0x37')](__dirname,_0x9bc7('0x38'),rs[_0x9bc7('0x26')](0x4)+_0x9bc7('0x39'));var _0x34030b;return downloadFile(_0x557e5f,_0x43012f)[_0x9bc7('0x2a')](function(){_0x34030b=path[_0x9bc7('0x37')](__dirname,_0x9bc7('0x38'),rs[_0x9bc7('0x26')](0x4)+_0x9bc7('0x27'));return convertFile(_0x43012f,_0x34030b);})['then'](function(){try{fs[_0x9bc7('0x1c')](_0x43012f);fs[_0x9bc7('0x2b')](_0x34030b,_0x9bc7('0x2c'));}catch(_0x27f201){logger[_0x9bc7('0x15')](_0x27f201);}return _0x34030b['split']('.')[0x0];});};exports[_0x9bc7('0x79')]=function(_0x3e888e,_0x5a2b06,_0x49691d,_0x65a4ed){var _0x1d0d03=util[_0x9bc7('0x77')](_0x9bc7('0x7a'),ISPEECH_API,_0x5a2b06,_0x49691d,base64Encode(_0x3e888e),_0x65a4ed?util[_0x9bc7('0x77')]('model=%s',encodeURIComponent(_0x65a4ed)):_0x9bc7('0x7b'));return uploadFile(_0x1d0d03)['then'](function(_0x4d5fba){return querystring['parse'](_0x4d5fba);});};exports['sestekNDA']=function(_0x454bf5,_0x27b4dd){return sestek[_0x9bc7('0x7c')](_0x454bf5,_0x27b4dd)[_0x9bc7('0x2a')](function(_0x41ea54){logger['info'](JSON[_0x9bc7('0x42')](_0x41ea54));var _0x5ec01e={'speech':_0x41ea54['text'],'action':_0x41ea54['channelData']?_0x41ea54[_0x9bc7('0x7d')][_0x9bc7('0x7e')]:undefined,'actiondata':_0x41ea54[_0x9bc7('0x7d')]?_0x41ea54[_0x9bc7('0x7d')][_0x9bc7('0x7f')]:undefined};if(_0x41ea54[_0x9bc7('0x7d')]&&_0x41ea54[_0x9bc7('0x7d')]['AudioFromTts']){return base64Decode(_0x41ea54['channelData'][_0x9bc7('0x80')]['Data'],path[_0x9bc7('0x37')](__dirname,_0x9bc7('0x38'),rs[_0x9bc7('0x26')](0x4)+_0x9bc7('0x27')))['then'](function(_0x5c881c){_0x5ec01e[_0x9bc7('0x81')]=_0x5c881c;return _0x5ec01e;});}return _0x5ec01e;});};exports[_0x9bc7('0x82')]=function(){return __dirname;}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/index.js b/server/services/agi/scripts/sestek/index.js index 31b744b..0b7bc7d 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 _0x4fde=['./nda','exports'];(function(_0xa41df9,_0x20fed0){var _0x342a45=function(_0x5832c5){while(--_0x5832c5){_0xa41df9['push'](_0xa41df9['shift']());}};_0x342a45(++_0x20fed0);}(_0x4fde,0x170));var _0xe4fd=function(_0x406696,_0x39f9b1){_0x406696=_0x406696-0x0;var _0x10e35c=_0x4fde[_0x406696];return _0x10e35c;};var nda=require(_0xe4fd('0x0'));module[_0xe4fd('0x1')]={'nda':nda}; \ No newline at end of file +var _0xc76b=['./nda','exports'];(function(_0x2865df,_0x1556d2){var _0x51c8af=function(_0x33d0dd){while(--_0x33d0dd){_0x2865df['push'](_0x2865df['shift']());}};_0x51c8af(++_0x1556d2);}(_0xc76b,0x1f0));var _0xbc76=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xc76b[_0x2dafbe];return _0x58a45a;};var nda=require(_0xbc76('0x0'));module[_0xbc76('0x1')]={'nda':nda}; \ No newline at end of file diff --git a/server/services/agi/scripts/sestek/nda/index.js b/server/services/agi/scripts/sestek/nda/index.js index 8519ad7..3d40d9c 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 _0x0f88=['agi','exports','resolve','/token','password','username','then','POST','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','calleridname','dnid','extension','text','access_token','project','body','ProjectName','ndagenerate_audio','custom_action','channelData','CustomAction','custom_action_data','CustomActionData','info','stringify','request-promise','url','../../../../../config/logger'];(function(_0x3d1f8e,_0x279486){var _0x3ebcb3=function(_0x544b2e){while(--_0x544b2e){_0x3d1f8e['push'](_0x3d1f8e['shift']());}};_0x3ebcb3(++_0x279486);}(_0x0f88,0x1d9));var _0x80f8=function(_0x428f80,_0x307620){_0x428f80=_0x428f80-0x0;var _0x2f4273=_0x0f88[_0x428f80];return _0x2f4273;};'use strict';var rp=require(_0x80f8('0x0'));var url=require(_0x80f8('0x1'));var logger=require(_0x80f8('0x2'))(_0x80f8('0x3'));module[_0x80f8('0x4')]=function(_0x236dde,_0x362cbf){var _0x27306a={'method':'POST','uri':url[_0x80f8('0x5')](_0x362cbf['ndauth_url'],_0x80f8('0x6')),'form':{'grant_type':_0x80f8('0x7'),'username':_0x362cbf[_0x80f8('0x8')],'password':_0x362cbf[_0x80f8('0x7')]},'json':!![]};return rp(_0x27306a)[_0x80f8('0x9')](function(_0x279479){var _0x3d6ad3={'method':_0x80f8('0xa'),'uri':url[_0x80f8('0x5')](_0x362cbf[_0x80f8('0xb')],_0x80f8('0xc')),'body':{'type':_0x362cbf[_0x80f8('0xd')]||_0x80f8('0xe'),'channelId':_0x80f8('0xf'),'conversation':{'id':_0x236dde[_0x80f8('0x10')]},'from':{'id':_0x236dde[_0x80f8('0x11')],'name':_0x236dde[_0x80f8('0x12')]},'recipient':{'id':_0x236dde[_0x80f8('0x13')],'name':_0x236dde[_0x80f8('0x14')]},'text':_0x362cbf[_0x80f8('0x15')],'channelData':{}},'headers':{'Authorization':'Bearer\x20'+_0x279479[_0x80f8('0x16')]},'json':!![]};if(_0x362cbf[_0x80f8('0x17')]){_0x3d6ad3[_0x80f8('0x18')]['channelData'][_0x80f8('0x19')]=_0x362cbf[_0x80f8('0x17')];}if(_0x362cbf[_0x80f8('0x1a')]=='1'){_0x3d6ad3['body']['channelData']['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':'audio/wav'};}if(_0x362cbf[_0x80f8('0x1b')]){_0x3d6ad3['body'][_0x80f8('0x1c')][_0x80f8('0x1d')]=_0x362cbf[_0x80f8('0x1b')];if(_0x362cbf[_0x80f8('0x1e')]){_0x3d6ad3[_0x80f8('0x18')][_0x80f8('0x1c')][_0x80f8('0x1f')]=_0x362cbf[_0x80f8('0x1e')];}}logger[_0x80f8('0x20')](JSON[_0x80f8('0x21')](_0x3d6ad3));return rp(_0x3d6ad3);});}; \ No newline at end of file +var _0xb4e6=['ProjectName','audio/wav','CustomAction','custom_action','custom_action_data','info','stringify','request-promise','../../../../../config/logger','agi','exports','POST','ndauth_url','/token','password','ndassistant_url','/api/NaturalDialogAssistant/v1/Run','ndaactivity_type','message','Nda','uniqueid','callerid','dnid','extension','Bearer\x20','access_token','project','body','channelData'];(function(_0x21f576,_0x42f1f4){var _0x49cf0c=function(_0x1f4896){while(--_0x1f4896){_0x21f576['push'](_0x21f576['shift']());}};_0x49cf0c(++_0x42f1f4);}(_0xb4e6,0x1f4));var _0x6b4e=function(_0x58c851,_0x1f3d96){_0x58c851=_0x58c851-0x0;var _0x534d8a=_0xb4e6[_0x58c851];return _0x534d8a;};'use strict';var rp=require(_0x6b4e('0x0'));var url=require('url');var logger=require(_0x6b4e('0x1'))(_0x6b4e('0x2'));module[_0x6b4e('0x3')]=function(_0x25ffcb,_0x44e781){var _0x31e8ad={'method':_0x6b4e('0x4'),'uri':url['resolve'](_0x44e781[_0x6b4e('0x5')],_0x6b4e('0x6')),'form':{'grant_type':_0x6b4e('0x7'),'username':_0x44e781['username'],'password':_0x44e781[_0x6b4e('0x7')]},'json':!![]};return rp(_0x31e8ad)['then'](function(_0x4f00be){var _0x2311d9={'method':'POST','uri':url['resolve'](_0x44e781[_0x6b4e('0x8')],_0x6b4e('0x9')),'body':{'type':_0x44e781[_0x6b4e('0xa')]||_0x6b4e('0xb'),'channelId':_0x6b4e('0xc'),'conversation':{'id':_0x25ffcb[_0x6b4e('0xd')]},'from':{'id':_0x25ffcb[_0x6b4e('0xe')],'name':_0x25ffcb['calleridname']},'recipient':{'id':_0x25ffcb[_0x6b4e('0xf')],'name':_0x25ffcb[_0x6b4e('0x10')]},'text':_0x44e781['text'],'channelData':{}},'headers':{'Authorization':_0x6b4e('0x11')+_0x4f00be[_0x6b4e('0x12')]},'json':!![]};if(_0x44e781[_0x6b4e('0x13')]){_0x2311d9[_0x6b4e('0x14')][_0x6b4e('0x15')][_0x6b4e('0x16')]=_0x44e781[_0x6b4e('0x13')];}if(_0x44e781['ndagenerate_audio']=='1'){_0x2311d9[_0x6b4e('0x14')][_0x6b4e('0x15')]['AudioOutputSettings']={'Generate':!![],'PutInStructuredPart':![],'ExpectedFormat':_0x6b4e('0x17')};}if(_0x44e781['custom_action']){_0x2311d9[_0x6b4e('0x14')][_0x6b4e('0x15')][_0x6b4e('0x18')]=_0x44e781[_0x6b4e('0x19')];if(_0x44e781[_0x6b4e('0x1a')]){_0x2311d9[_0x6b4e('0x14')]['channelData']['CustomActionData']=_0x44e781[_0x6b4e('0x1a')];}}logger[_0x6b4e('0x1b')](JSON[_0x6b4e('0x1c')](_0x2311d9));return rp(_0x2311d9);});}; \ 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 a25526f..46f59a5 100644 --- a/server/services/agi/scripts/tilde/asr/index.js +++ b/server/services/agi/scripts/tilde/asr/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xfb17=['./lib/api'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xfb17,0x13f));var _0x7fb1=function(_0x2faddb,_0xc18b78){_0x2faddb=_0x2faddb-0x0;var _0x273c05=_0xfb17[_0x2faddb];return _0x273c05;};'use strict';var asr=require(_0x7fb1('0x0'));module['exports']=function(_0x43d5fa,_0x273de6,_0x5d4963,_0x112559){return asr(_0x43d5fa,_0x273de6,_0x5d4963,_0x112559);}; \ No newline at end of file +var _0x65ed=['./lib/api','exports'];(function(_0x59b9a0,_0x1de165){var _0x63159a=function(_0x5e8532){while(--_0x5e8532){_0x59b9a0['push'](_0x59b9a0['shift']());}};_0x63159a(++_0x1de165);}(_0x65ed,0x106));var _0xd65e=function(_0x3ace0e,_0x2b70fd){_0x3ace0e=_0x3ace0e-0x0;var _0x4b91c6=_0x65ed[_0x3ace0e];return _0x4b91c6;};'use strict';var asr=require(_0xd65e('0x0'));module[_0xd65e('0x1')]=function(_0x3a856e,_0x4404f3,_0x3d0839,_0x67d18d){return asr(_0x3a856e,_0x4404f3,_0x3d0839,_0x67d18d);}; \ 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 50a7710..d7b5389 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 _0xfa91=['lodash','moment','../../../../../../config/logger','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','createHash','sha1','digest','hex','unix','send','stringify','createReadStream','data','close','EOS','error','Tilde\x20ASR\x20send\x20error','terminate','parse','status','result','final','hypotheses','likelihood','Success.','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Error\x20Tilde\x20ASR\x20socket','isNil','isObject','open','message','bluebird'];(function(_0x743701,_0x3e67bb){var _0x5a141d=function(_0x4b198d){while(--_0x4b198d){_0x743701['push'](_0x743701['shift']());}};_0x5a141d(++_0x3e67bb);}(_0xfa91,0x77));var _0x1fa9=function(_0x256b72,_0x340985){_0x256b72=_0x256b72-0x0;var _0x2183e3=_0xfa91[_0x256b72];return _0x2183e3;};'use strict';var BPromise=require(_0x1fa9('0x0'));var _=require(_0x1fa9('0x1'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0x1fa9('0x2'));var crypto=require('crypto');var logger=require(_0x1fa9('0x3'))('agi');module[_0x1fa9('0x4')]=function(_0x510c8c,_0x5015ec,_0x589531,_0x3240eb){return new BPromise(function(_0x6ca24,_0x53c424){logger[_0x1fa9('0x5')](_0x1fa9('0x6'),_0x3240eb||_0x1fa9('0x7'));var _0x1b5e06=new WebSocket(_0x3240eb||_0x1fa9('0x7'),{'perMessageDeflate':![]});var _0x1610d7='';var _0x3a17dd='0';var _0x740bff='1';var _0x5baa58='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';function _0x160c9b(_0x4ef4c3){var _0x4ca3d7=crypto[_0x1fa9('0x8')](_0x1fa9('0x9'));_0x4ca3d7['update'](_0x4ef4c3);return _0x4ca3d7[_0x1fa9('0xa')](_0x1fa9('0xb'));}function _0x3f873b(){try{logger[_0x1fa9('0x5')]('Open\x20Tilde\x20ASR\x20socket');var _0x162ec6=moment()[_0x1fa9('0xc')]();var _0x2fa135=_0x160c9b(_0x162ec6+_0x5015ec+_0x589531);_0x1b5e06[_0x1fa9('0xd')](JSON[_0x1fa9('0xe')]({'appID':_0x5015ec,'timestamp':_0x162ec6,'appKey':_0x2fa135}));var _0x7156c9=fs[_0x1fa9('0xf')](_0x510c8c);_0x7156c9['on'](_0x1fa9('0x10'),function(_0xbc58c9){_0x1b5e06[_0x1fa9('0xd')](_0xbc58c9);});_0x7156c9['on'](_0x1fa9('0x11'),function(){_0x1b5e06['send'](_0x1fa9('0x12'));});}catch(_0x50d100){logger[_0x1fa9('0x13')](_0x1fa9('0x14'),JSON[_0x1fa9('0xe')](_0x50d100));_0x1b5e06[_0x1fa9('0x15')]();}}function _0xad9d3(_0x9f0939){try{if(_0x9f0939){var _0x2577d9=JSON[_0x1fa9('0x16')](_0x9f0939);switch(_0x2577d9[_0x1fa9('0x17')]){case 0x0:if(_0x2577d9['result']){if(_0x2577d9[_0x1fa9('0x18')][_0x1fa9('0x19')]){logger[_0x1fa9('0x5')]('Tilde\x20ASR\x20hypoteses',JSON[_0x1fa9('0xe')](_0x2577d9[_0x1fa9('0x18')][_0x1fa9('0x1a')]));_0x1610d7=_0x2577d9[_0x1fa9('0x18')][_0x1fa9('0x1a')][0x0]['transcript'];_0x3a17dd=_0x2577d9[_0x1fa9('0x18')][_0x1fa9('0x1a')][0x0][_0x1fa9('0x1b')];_0x740bff='0';_0x5baa58=_0x1fa9('0x1c');_0x1b5e06['terminate']();}}break;case 0x1:logger[_0x1fa9('0x5')](_0x1fa9('0x1d'));_0x740bff='1';_0x5baa58=_0x1fa9('0x1d');break;case 0x2:logger[_0x1fa9('0x5')](_0x1fa9('0x1e'));_0x740bff='2';_0x5baa58=_0x1fa9('0x1e');break;case 0x9:logger[_0x1fa9('0x5')](_0x1fa9('0x1f'));_0x740bff='9';_0x5baa58=_0x1fa9('0x1f');break;case 0xa:logger[_0x1fa9('0x5')](_0x1fa9('0x20'));_0x740bff='10';_0x5baa58='Authentication\x20failed.';break;case 0xb:logger[_0x1fa9('0x5')](_0x1fa9('0x21'));_0x740bff='11';_0x5baa58=_0x1fa9('0x21');}}}catch(_0x27b91d){logger[_0x1fa9('0x13')](_0x1fa9('0x22'),JSON[_0x1fa9('0xe')](_0x27b91d));_0x1b5e06[_0x1fa9('0x15')]();}}function _0x3ba643(){logger[_0x1fa9('0x5')]('Close\x20Tilde\x20ASR\x20socket');_0x6ca24({'transcript':_0x1610d7,'confidence':_0x3a17dd,'status':_0x740bff,'status_message':_0x5baa58});}function _0x2a93cf(_0x11d3a0){logger['error'](_0x1fa9('0x23'));if(!_[_0x1fa9('0x24')](_0x11d3a0)){logger[_0x1fa9('0x13')](_[_0x1fa9('0x25')](_0x11d3a0)?JSON[_0x1fa9('0xe')](_0x11d3a0):_0x11d3a0);}}_0x1b5e06['on'](_0x1fa9('0x26'),_0x3f873b);_0x1b5e06['on'](_0x1fa9('0x27'),_0xad9d3);_0x1b5e06['on'](_0x1fa9('0x11'),_0x3ba643);_0x1b5e06['on']('error',_0x2a93cf);});}; \ No newline at end of file +var _0x620b=['result','final','hypotheses','transcript','likelihood','Aborted.\x20Recognition\x20was\x20aborted\x20for\x20some\x20reason.','Not\x20available.\x20Max\x20load\x20limit\x20reached.','Authentication\x20failed.','All\x20recognition\x20workers\x20are\x20currently\x20in\x20use\x20and\x20real-time\x20recognition\x20is\x20not\x20possible.','Tilde\x20ASR\x20parse\x20error','Close\x20Tilde\x20ASR\x20socket','isNil','isObject','open','lodash','moment','crypto','../../../../../../config/logger','agi','exports','info','Tilde\x20URI','wss://runa.tilde.lv/client/ws/speech/LVASR-ONLINE','No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech','createHash','Open\x20Tilde\x20ASR\x20socket','unix','send','stringify','close','error','Tilde\x20ASR\x20send\x20error','terminate','status'];(function(_0x2489de,_0x1e1ad2){var _0x36c6a3=function(_0x3ccdc9){while(--_0x3ccdc9){_0x2489de['push'](_0x2489de['shift']());}};_0x36c6a3(++_0x1e1ad2);}(_0x620b,0x74));var _0xb620=function(_0x5a8241,_0x102d3d){_0x5a8241=_0x5a8241-0x0;var _0x449492=_0x620b[_0x5a8241];return _0x449492;};'use strict';var BPromise=require('bluebird');var _=require(_0xb620('0x0'));var fs=require('fs');var WebSocket=require('ws');var moment=require(_0xb620('0x1'));var crypto=require(_0xb620('0x2'));var logger=require(_0xb620('0x3'))(_0xb620('0x4'));module[_0xb620('0x5')]=function(_0x580315,_0x1bd20a,_0x58ec44,_0x2af976){return new BPromise(function(_0x28d53b,_0x305de6){logger[_0xb620('0x6')](_0xb620('0x7'),_0x2af976||_0xb620('0x8'));var _0x3afd89=new WebSocket(_0x2af976||_0xb620('0x8'),{'perMessageDeflate':![]});var _0x1bebac='';var _0x42c2b0='0';var _0x161056='1';var _0x574695=_0xb620('0x9');function _0x903366(_0xd62b9e){var _0x11ce07=crypto[_0xb620('0xa')]('sha1');_0x11ce07['update'](_0xd62b9e);return _0x11ce07['digest']('hex');}function _0x1e1c55(){try{logger[_0xb620('0x6')](_0xb620('0xb'));var _0x5c90a5=moment()[_0xb620('0xc')]();var _0x436a1b=_0x903366(_0x5c90a5+_0x1bd20a+_0x58ec44);_0x3afd89[_0xb620('0xd')](JSON[_0xb620('0xe')]({'appID':_0x1bd20a,'timestamp':_0x5c90a5,'appKey':_0x436a1b}));var _0x1ea3c2=fs['createReadStream'](_0x580315);_0x1ea3c2['on']('data',function(_0x142d8f){_0x3afd89['send'](_0x142d8f);});_0x1ea3c2['on'](_0xb620('0xf'),function(){_0x3afd89[_0xb620('0xd')]('EOS');});}catch(_0x1e4f0f){logger[_0xb620('0x10')](_0xb620('0x11'),JSON[_0xb620('0xe')](_0x1e4f0f));_0x3afd89[_0xb620('0x12')]();}}function _0x5baa35(_0x275daf){try{if(_0x275daf){var _0x2e947b=JSON['parse'](_0x275daf);switch(_0x2e947b[_0xb620('0x13')]){case 0x0:if(_0x2e947b['result']){if(_0x2e947b[_0xb620('0x14')][_0xb620('0x15')]){logger[_0xb620('0x6')]('Tilde\x20ASR\x20hypoteses',JSON['stringify'](_0x2e947b[_0xb620('0x14')][_0xb620('0x16')]));_0x1bebac=_0x2e947b[_0xb620('0x14')][_0xb620('0x16')][0x0][_0xb620('0x17')];_0x42c2b0=_0x2e947b[_0xb620('0x14')][_0xb620('0x16')][0x0][_0xb620('0x18')];_0x161056='0';_0x574695='Success.';_0x3afd89[_0xb620('0x12')]();}}break;case 0x1:logger[_0xb620('0x6')](_0xb620('0x9'));_0x161056='1';_0x574695='No\x20speech.\x20Sent\x20when\x20the\x20incoming\x20audio\x20contains\x20a\x20large\x20portion\x20of\x20silence\x20or\x20non-speech';break;case 0x2:logger[_0xb620('0x6')](_0xb620('0x19'));_0x161056='2';_0x574695=_0xb620('0x19');break;case 0x9:logger['info'](_0xb620('0x1a'));_0x161056='9';_0x574695=_0xb620('0x1a');break;case 0xa:logger[_0xb620('0x6')](_0xb620('0x1b'));_0x161056='10';_0x574695=_0xb620('0x1b');break;case 0xb:logger['info'](_0xb620('0x1c'));_0x161056='11';_0x574695=_0xb620('0x1c');}}}catch(_0x20f3a6){logger[_0xb620('0x10')](_0xb620('0x1d'),JSON[_0xb620('0xe')](_0x20f3a6));_0x3afd89[_0xb620('0x12')]();}}function _0xf92523(){logger[_0xb620('0x6')](_0xb620('0x1e'));_0x28d53b({'transcript':_0x1bebac,'confidence':_0x42c2b0,'status':_0x161056,'status_message':_0x574695});}function _0x474655(_0x24713e){logger[_0xb620('0x10')]('Error\x20Tilde\x20ASR\x20socket');if(!_[_0xb620('0x1f')](_0x24713e)){logger[_0xb620('0x10')](_[_0xb620('0x20')](_0x24713e)?JSON[_0xb620('0xe')](_0x24713e):_0x24713e);}}_0x3afd89['on'](_0xb620('0x21'),_0x1e1c55);_0x3afd89['on']('message',_0x5baa35);_0x3afd89['on'](_0xb620('0xf'),_0xf92523);_0x3afd89['on'](_0xb620('0x10'),_0x474655);});}; \ 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 9826401..c80d28c 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 _0xb42e=['./asr'];(function(_0x4f3060,_0x123a95){var _0x197fc6=function(_0x192a23){while(--_0x192a23){_0x4f3060['push'](_0x4f3060['shift']());}};_0x197fc6(++_0x123a95);}(_0xb42e,0x1ae));var _0xeb42=function(_0x5b740b,_0x381833){_0x5b740b=_0x5b740b-0x0;var _0x6f8f4e=_0xb42e[_0x5b740b];return _0x6f8f4e;};var asr=require(_0xeb42('0x0'));module['exports']={'asr':asr}; \ No newline at end of file +var _0x2f89=['exports'];(function(_0x438d1d,_0x171dfa){var _0x2fa1fe=function(_0xd45ff3){while(--_0xd45ff3){_0x438d1d['push'](_0x438d1d['shift']());}};_0x2fa1fe(++_0x171dfa);}(_0x2f89,0x65));var _0x92f8=function(_0x202e06,_0x577357){_0x202e06=_0x202e06-0x0;var _0x4ce440=_0x2f89[_0x202e06];return _0x4ce440;};var asr=require('./asr');module[_0x92f8('0x0')]={'asr':asr}; \ No newline at end of file diff --git a/server/services/agi/server.js b/server/services/agi/server.js index 191495c..e5922ca 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 _0x9c44=['./error','./channel','127.0.0.1','call','emit','error','createServer','listen','listening','getConnections','destroy','E_AGI_SERVER_MAXCONNECTION','ready','connection','E_AGI_SERVER_ERROR','code','close','E_AGI_SERVER_CLOSE','nextTick','events','EventEmitter'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x9c44,0x178));var _0x49c4=function(_0x1969a7,_0x5a133a){_0x1969a7=_0x1969a7-0x0;var _0x3d665f=_0x9c44[_0x1969a7];return _0x3d665f;};'use strict';var util=require('util');var net=require('net');var EventEmitter=require(_0x49c4('0x0'))[_0x49c4('0x1')];var AGIError=require(_0x49c4('0x2'));var AGIChannel=require(_0x49c4('0x3'));var AGIServer=function(_0x455700,_0x2ad237,_0x4e0313){var _0x4941f1=this;var _0x41a183=null;var _0x57effd=0x0;if(!_0x455700)_0x455700=0x11dd;if(!_0x2ad237)_0x2ad237=_0x49c4('0x4');EventEmitter[_0x49c4('0x5')](_0x4941f1);function _0x69bc41(){if(!_0x455700){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_ARGUMENT_PORT'));return![];}_0x41a183=net[_0x49c4('0x8')]();_0x41a183[_0x49c4('0x9')](_0x455700,_0x2ad237);_0x41a183['on'](_0x49c4('0xa'),function(){_0x4941f1[_0x49c4('0x6')]('listening');});_0x41a183['on']('connection',function(_0x451ea6){_0x41a183[_0x49c4('0xb')](function(_0x58cad7,_0xb611a1){if(_0x58cad7){_0x4941f1[_0x49c4('0x6')]('error',new AGIError('E_AGI_SERVER_ERROR',_0x58cad7));}else if(_0x4e0313&&_0x4e0313<0x0){_0x4941f1[_0x49c4('0x6')](_0x49c4('0x7'),new AGIError('E_AGI_SERVER_VOICE_DISABLED'));_0x451ea6[_0x49c4('0xc')]();}else if(_0x4e0313&&_0x4e0313>0x0&&_0x4e0313<_0xb611a1){_0x57effd+=0x1;_0x4941f1[_0x49c4('0x6')]('error',new AGIError(_0x49c4('0xd'),_0x57effd));_0x451ea6[_0x49c4('0xc')]();}else{var _0x21f15a=new AGIChannel(_0x451ea6);_0x21f15a['on'](_0x49c4('0xe'),function(){_0x4941f1[_0x49c4('0x6')](_0x49c4('0xf'),_0x21f15a);});}});});_0x41a183['on'](_0x49c4('0x7'),function(_0x3de397){_0x4941f1['emit'](_0x49c4('0x7'),new AGIError(_0x49c4('0x10'),_0x3de397[_0x49c4('0x11')]));});_0x41a183['on'](_0x49c4('0x12'),function(){_0x4941f1[_0x49c4('0x6')]('close',new AGIError(_0x49c4('0x13')));});}process[_0x49c4('0x14')](function(){_0x69bc41();});};util['inherits'](AGIServer,EventEmitter);module['exports']=function(_0x3c782d,_0x2f82d5,_0x3addb2){return new AGIServer(_0x3c782d,_0x2f82d5,_0x3addb2);}; \ No newline at end of file +var _0x34e8=['E_AGI_ARGUMENT_PORT','createServer','listen','listening','connection','getConnections','E_AGI_SERVER_ERROR','E_AGI_SERVER_VOICE_DISABLED','destroy','E_AGI_SERVER_MAXCONNECTION','close','nextTick','inherits','exports','util','net','events','EventEmitter','./channel','call','emit','error'];(function(_0x447db1,_0x11030d){var _0x4269d5=function(_0x217501){while(--_0x217501){_0x447db1['push'](_0x447db1['shift']());}};_0x4269d5(++_0x11030d);}(_0x34e8,0x12c));var _0x834e=function(_0x329e5c,_0x49a8c4){_0x329e5c=_0x329e5c-0x0;var _0x2d16c2=_0x34e8[_0x329e5c];return _0x2d16c2;};'use strict';var util=require(_0x834e('0x0'));var net=require(_0x834e('0x1'));var EventEmitter=require(_0x834e('0x2'))[_0x834e('0x3')];var AGIError=require('./error');var AGIChannel=require(_0x834e('0x4'));var AGIServer=function(_0x21e2e0,_0x472111,_0x31bf20){var _0x289ef2=this;var _0x19a3e0=null;var _0x398bee=0x0;if(!_0x21e2e0)_0x21e2e0=0x11dd;if(!_0x472111)_0x472111='127.0.0.1';EventEmitter[_0x834e('0x5')](_0x289ef2);function _0x52056d(){if(!_0x21e2e0){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0x8')));return![];}_0x19a3e0=net[_0x834e('0x9')]();_0x19a3e0[_0x834e('0xa')](_0x21e2e0,_0x472111);_0x19a3e0['on'](_0x834e('0xb'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xb'));});_0x19a3e0['on'](_0x834e('0xc'),function(_0x186b3b){_0x19a3e0[_0x834e('0xd')](function(_0x36e124,_0x14038b){if(_0x36e124){_0x289ef2[_0x834e('0x6')](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x36e124));}else if(_0x31bf20&&_0x31bf20<0x0){_0x289ef2[_0x834e('0x6')]('error',new AGIError(_0x834e('0xf')));_0x186b3b[_0x834e('0x10')]();}else if(_0x31bf20&&_0x31bf20>0x0&&_0x31bf20<_0x14038b){_0x398bee+=0x1;_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0x11'),_0x398bee));_0x186b3b[_0x834e('0x10')]();}else{var _0x21cc0a=new AGIChannel(_0x186b3b);_0x21cc0a['on']('ready',function(){_0x289ef2[_0x834e('0x6')](_0x834e('0xc'),_0x21cc0a);});}});});_0x19a3e0['on']('error',function(_0x316205){_0x289ef2['emit'](_0x834e('0x7'),new AGIError(_0x834e('0xe'),_0x316205['code']));});_0x19a3e0['on'](_0x834e('0x12'),function(){_0x289ef2[_0x834e('0x6')](_0x834e('0x12'),new AGIError('E_AGI_SERVER_CLOSE'));});}process[_0x834e('0x13')](function(){_0x52056d();});};util[_0x834e('0x14')](AGIServer,EventEmitter);module[_0x834e('0x15')]=function(_0xb993a1,_0x237947,_0x254677){return new AGIServer(_0xb993a1,_0x237947,_0x254677);}; \ No newline at end of file diff --git a/server/services/agi/vertices.js b/server/services/agi/vertices.js index d31ccd6..022b49a 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 _0xe0dd=['google_tts_language','url','timeout','includes','POST','PUT','toUpperCase','body','An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','sync','render','parse','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','500\x20-\x20Internal\x20Server\x20Error','options','googleDialogflow','key','dialogflow_language','dialogflowV2_project_id','client_email','private_key','dialogflowV2_language','sestekNDA','ispeechTTS','ispeech_tts_language','speed','ispeechASR','ispeech_asr_language','isConfigured','awsPolly','aws_secret_access_key','Amy','aws_text_type','awsLex','aws_access_key_id','aws_lex_region','googleASR','google_asr_language','tildeASR','appid','appsecret','uri','clear','clone','hasOwnProperty','isString','replaceObjectAllVariables','replaceAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','getAndSetVariable','result','maxRetry','retry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','label','no\x20text\x20configured','MRCPSynth','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','noop','no\x20grammar\x20configured','MRCPRecog','MRCP_RECOG_CONFIDENCE','RECOG_INPUT()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','agi','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','list_id','no\x20list\x20selected','minutes','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','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','Enter\x20in\x20SESTEKTTS\x20(%s)\x20block','Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block','LUMENVOX_ASR_CONFIDENCE','sestekasr','Enter\x20in\x20SESTEKASR\x20(%s)\x20block','RECOG_CONFIDENCE()','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','no\x20database\x20selected','odbc_id','no\x20odbc\x20database\x20found','query','replace','query:\x20%s','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','getVariable','no\x20variable\x20found','forEach','keys','%s[%s][%s]','%s_ROWS_COUNT','variable\x20%s\x20set','dial','debug','sip_id','no\x20user\x20found','DIAL','opts','Executed\x20command\x20%s','dialogflow','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','DIALOGFLOW_%s','speech','Dialogflow\x20Result\x20%s','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20project_id\x20configured','no\x20client_email\x20configured','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','googleDialogflowV2','providerResponse','out','DialogflowV2\x20Result\x20%s','DialogflowV2\x20is\x20unreachable','sesteknda','Enter\x20in\x20SESTEKNDA\x20(%s)\x20block','ndauth_url','no\x20ndauth\x20url\x20configured','username','password','no\x20password\x20configured','ndassistant_url','Trying\x20SestekNDA:\x20%s','SESTEK_NDA_%s','audiofile','Sestek\x20NDA\x20%s\x20file\x20created','SestekNDA\x20is\x20unreachable','end','ext_dial','trunk_id','no\x20trunk\x20selected','no\x20trunk\x20found','trunk_name','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','no\x20file\x20audio\x20selected','file_id','no\x20file\x20audio\x20found','getData','maxdigit','mindigit','hiddendigitsnum','generate','hiddendigitspos','first','substr','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','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','.wav','aws\x20Polly\x20is\x20unreachable','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','AWS_LEX_%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','amazonlex','Amazon\x20Lex\x20Result\x20%s','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','NOBEEP','recordFile','google\x20%s\x20file\x20created','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','%s/recordings/%s','beep','TILDE_ASR_%s','TildeASR\x20Result\x20%s','gotoc','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','false','EVAL\x20CONDITION\x20%s\x20%s','gotoiftime','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','no\x20intervals\x20found','IFTIME(%s?true:false)','true','IFTIME\x20%s\x20%s','hangup','ispeechasr','intKey','ispeech\x20%s\x20file\x20created','IspeechASR\x20Result\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','no\x20find\x20by\x20configured','findBy','AGENT\x20%s\x20FOUND\x20BY','AGENT\x20%s\x20NOT\x20FOUND\x20BY','logout','Enter\x20in\x20LOGOUT\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','success','failure','math','operation','no\x20operation\x20configured','math\x20%s','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','Enter\x20in\x20PAUSE\x20(%s)\x20block','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','queue','Enter\x20in\x20QUEUE\x20(%s)\x20block','queue_id','no\x20queue\x20found','indexOf','XMCS-QUEUE','QUEUE','gosub','position','record','recordingFormat','%s_%s','%s/recordings/%s.%s','Recording\x20%s\x20%s\x20%s\x20%s','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','no\x20url\x20configured','restAPI','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','%s_STATUS_MESSAGE','saydigits','sayDigits','digits','saynumber','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','no\x20mail\x20account\x20configured','getMailAccount','account_id','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','subject','template_id','sendFax','Enter\x20in\x20SENDFAX\x20(%s)\x20block','Enter\x20in\x20SENDSMS\x20(%s)\x20block','sms_account_id','no\x20sms\x20account\x20found','sms_text','Trying\x20SendSMS\x20with\x20account\x20%s','set','Enter\x20in\x20SET\x20(%s)\x20block','no\x20variable\x20selected','start','START\x20CALLY\x20SQUARE','yes','Answer','Skipped\x20Answer','subproject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','Enter\x20in\x20SYSTEM\x20(%s)\x20block','command','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','sh\x20command:\x20%s\x20result\x20no\x20stored','google_cloud_tts','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','Enter\x20in\x20GOOGLETTS\x20(%s)\x20block','Trying\x20Google\x20TTS\x20%s','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','voicemail','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','VOICEMAIL','mailbox','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','join','exports','util','lodash','odbc','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment/shared','./scripts','rawHeaders','rawBody','menu','getsecretdigits','channel','rpc','mailRpc','getVariableById','name','prototype','getVoiceQueue','getVoiceQueueById','catch','getSquareProject','getSquareProjectById','then','getSquareOdbc','getSquareOdbcById','dsn','getUser','getUserById','getTrunk','getSound','getSoundById','getSoundPath','save_name','sendMailMessage','getIntervals','getIntervalById','IntervalId','interval','map','Intervals','format','%s/sounds/converted/%s','getQueryOdbc','open','info','ODBC\x20connection\x20successfully','Error\x20closing\x20connection\x20to\x20odbc\x20%s','getSmsAccount','getSmsAccountById','createSmsMessage','createSquareDetailsReport','agicommand','arg_1','callerid','createSquareRecording','uniqueid','calleridname','context','extension','priority','accountcode','dnid','createSquareMessage','createCmContact','isEmpty','isNil','callback_','random','lastName','phone','scheduledAt','callback','Callback\x20scheduled\x20at\x20','toString','callback_priority','getPause','agentPause','agent','agentUnpause','error','agentLogout','agentLogin','internal','LOCAL','exec','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','ssmlGender','audioEncoding','MP3','googleTTS'];(function(_0x599a0f,_0x4ce2d9){var _0x392039=function(_0x190ff7){while(--_0x190ff7){_0x599a0f['push'](_0x599a0f['shift']());}};_0x392039(++_0x4ce2d9);}(_0xe0dd,0x163));var _0xde0d=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0xe0dd[_0x3b0731];return _0x4204d7;};'use strict';var fs=require('fs');var util=require(_0xde0d('0x0'));var _=require(_0xde0d('0x1'));var sh=require('shelljs');var odbc=require(_0xde0d('0x2'))();var rs=require(_0xde0d('0x3'));var moment=require(_0xde0d('0x4'));var Mustache=require(_0xde0d('0x5'));var rp=require(_0xde0d('0x6'));var logger=require(_0xde0d('0x7'))('agi');var config=require('../../config/environment');var shared=require(_0xde0d('0x8'));var scripts=require(_0xde0d('0x9'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xde0d('0xa'),_0xde0d('0xb')];var verticesWithRetry=[_0xde0d('0xc'),'getdigits',_0xde0d('0xd')];var AGIVertices=function(_0x492a1f,_0x295d54,_0x5e6588){this[_0xde0d('0xe')]=_0x492a1f;this[_0xde0d('0xf')]=_0x295d54;this[_0xde0d('0x10')]=_0x5e6588;};AGIVertices['prototype']['getVariable']=function(_0x56391c,_0x42026a){this[_0xde0d('0xf')][_0xde0d('0x11')](_0x56391c)['then'](function(_0x1557ce){_0x42026a(null,_0x1557ce?_0x1557ce[_0xde0d('0x12')]:![]);})['catch'](function(_0x413c76){_0x42026a(_0x413c76);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x14')]=function(_0x2ca416,_0x13e887){this['rpc'][_0xde0d('0x15')](_0x2ca416)['then'](function(_0xf267c){_0x13e887(null,_0xf267c?_0xf267c['name']:![]);})[_0xde0d('0x16')](function(_0x578a3c){_0x13e887(_0x578a3c);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x17')]=function(_0x116bb2,_0x228666){this[_0xde0d('0xf')][_0xde0d('0x18')](_0x116bb2)[_0xde0d('0x19')](function(_0x5ee4f9){_0x228666(null,_0x5ee4f9?_0x5ee4f9[_0xde0d('0x12')]:![]);})[_0xde0d('0x16')](function(_0x1b6266){_0x228666(_0x1b6266);});};AGIVertices['prototype'][_0xde0d('0x1a')]=function(_0x3c9639,_0x59cd34){this['rpc'][_0xde0d('0x1b')](_0x3c9639)[_0xde0d('0x19')](function(_0x11437e){_0x59cd34(null,_0x11437e?_0x11437e[_0xde0d('0x1c')]:![]);})[_0xde0d('0x16')](function(_0x5ec167){_0x59cd34(_0x5ec167);});};AGIVertices['prototype'][_0xde0d('0x1d')]=function(_0x5ef8fa,_0x2e52aa){this[_0xde0d('0xf')][_0xde0d('0x1e')](_0x5ef8fa)['then'](function(_0x47d3f4){_0x2e52aa(null,_0x47d3f4?_0x47d3f4['name']:![]);})[_0xde0d('0x16')](function(_0x3b11e9){_0x2e52aa(_0x3b11e9);});};AGIVertices['prototype'][_0xde0d('0x1f')]=function(_0x1ccb8d,_0x39ca31){this[_0xde0d('0xf')]['getTrunkById'](_0x1ccb8d)[_0xde0d('0x19')](function(_0x392185){_0x39ca31(null,_0x392185?_0x392185[_0xde0d('0x12')]:![]);})[_0xde0d('0x16')](function(_0x33aa43){_0x39ca31(_0x33aa43);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x20')]=function(_0xf081af,_0x26e30b){var _0x525221=this;this[_0xde0d('0xf')][_0xde0d('0x21')](_0xf081af)[_0xde0d('0x19')](function(_0x188a7a){_0x26e30b(null,_0x188a7a?_0x525221[_0xde0d('0x22')](_0x188a7a[_0xde0d('0x23')]):![]);})[_0xde0d('0x16')](function(_0x4786c1){_0x26e30b(_0x4786c1);});};AGIVertices[_0xde0d('0x13')]['getMailAccount']=function(_0x5d6a16,_0x486914){this['rpc']['getMailAccountById'](_0x5d6a16)[_0xde0d('0x19')](function(_0x272230){_0x486914(null,_0x272230?_0x272230:![]);})[_0xde0d('0x16')](function(_0x16a360){_0x486914(_0x16a360);});};AGIVertices['prototype'][_0xde0d('0x24')]=function(_0x1a7fe3,_0x3aa9a6,_0x5d5cb1){this[_0xde0d('0x10')][_0xde0d('0x24')](_0x1a7fe3,_0x3aa9a6)['then'](function(){_0x5d5cb1(null);})[_0xde0d('0x16')](function(_0x426a23){_0x5d5cb1(_0x426a23);});};AGIVertices['prototype'][_0xde0d('0x25')]=function(_0x4bf68a,_0x1213b1){this[_0xde0d('0xf')][_0xde0d('0x26')](_0x4bf68a)[_0xde0d('0x19')](function(_0x216348){if(_0x216348){if(_0x216348[_0xde0d('0x27')]){_0x1213b1(null,[_0x216348[_0xde0d('0x28')]]);}else{_0x1213b1(null,_[_0xde0d('0x29')](_0x216348[_0xde0d('0x2a')],_0xde0d('0x28')));}}else{_0x1213b1(null,![]);}})[_0xde0d('0x16')](function(_0x2957c6){_0x1213b1(_0x2957c6);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x22')]=function(_0x231164){return util[_0xde0d('0x2b')](_0xde0d('0x2c'),FILES_PATH,_0x231164);};AGIVertices[_0xde0d('0x13')][_0xde0d('0x2d')]=function(_0x522fa0,_0x516ef2,_0xf47f46){odbc[_0xde0d('0x2e')](_0x522fa0,function(_0x5ec787){if(_0x5ec787){logger['error']('Error\x20getting\x20ODBC\x20connection\x20%s',_0x5ec787);_0xf47f46(_0x5ec787);}else{logger[_0xde0d('0x2f')](_0xde0d('0x30'));odbc['query'](_0x516ef2,function(_0x3f1c77,_0x4999d9){if(_0x3f1c77){logger[_0xde0d('0x2f')]('Error\x20executing\x20query\x20%s',_0x516ef2);_0xf47f46(_0x3f1c77);}else{logger[_0xde0d('0x2f')]('Query\x20executed\x20correctly\x20%s',_0x516ef2);odbc['close'](function(_0x279c73){if(_0x279c73){logger['error'](_0xde0d('0x31'),_0x279c73);}_0xf47f46(null,_0x4999d9);});}});}});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x32')]=function(_0xdb345c,_0x3403e8){this[_0xde0d('0xf')][_0xde0d('0x33')](_0xdb345c)['then'](function(_0xea8c9b){_0x3403e8(null,_0xea8c9b?_0xea8c9b:![]);})[_0xde0d('0x16')](function(_0x2f0065){_0x3403e8(_0x2f0065);});};AGIVertices['prototype'][_0xde0d('0x34')]=function(_0x742f9d,_0xac6340){this[_0xde0d('0xf')][_0xde0d('0x34')](_0x742f9d)[_0xde0d('0x19')](function(_0x3728d7){_0xac6340(null,_0x3728d7);})[_0xde0d('0x16')](function(_0x261226){_0xac6340(_0x261226);});};AGIVertices[_0xde0d('0x13')]['createSquareDetailsReport']=function(_0x1d95e1,_0x1f187c,_0x50c6b5){this['rpc'][_0xde0d('0x35')]({'uniqueid':this[_0xde0d('0xe')]['uniqueid'],'node':_0x1d95e1['label'],'application':_0x1d95e1[_0xde0d('0x36')],'data':_0x1f187c||null,'project_name':this[_0xde0d('0xe')][_0xde0d('0x37')],'callerid':this['channel'][_0xde0d('0x38')]})[_0xde0d('0x19')](function(_0x101c38){if(_0x50c6b5){_0x50c6b5(null,_0x101c38);}})[_0xde0d('0x16')](function(_0x1cc025){if(_0x50c6b5){_0x50c6b5(_0x1cc025);}});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x39')]=function(_0x2979ce,_0x527f0d,_0x4ee04e,_0x4d959b){this[_0xde0d('0xf')][_0xde0d('0x39')]({'uniqueid':this[_0xde0d('0xe')][_0xde0d('0x3a')],'callerid':this[_0xde0d('0xe')]['callerid'],'calleridname':this['channel'][_0xde0d('0x3b')],'context':this[_0xde0d('0xe')][_0xde0d('0x3c')],'extension':this['channel'][_0xde0d('0x3d')],'priority':this['channel'][_0xde0d('0x3e')],'accountcode':this['channel'][_0xde0d('0x3f')],'dnid':this[_0xde0d('0xe')][_0xde0d('0x40')],'projectName':this['channel'][_0xde0d('0x37')],'saveName':_0x527f0d,'filename':_0x2979ce['file']||_0x527f0d,'savePath':_0x4ee04e})['then'](function(_0x236ce6){_0x4d959b(null,_0x236ce6);})[_0xde0d('0x16')](function(_0x2f00f7){_0x4d959b(_0x2f00f7);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x41')]=function(_0x2f5777,_0x15b24f,_0x1c9479,_0x387096,_0x358e55){this[_0xde0d('0xf')][_0xde0d('0x41')]({'uniqueid':this[_0xde0d('0xe')][_0xde0d('0x3a')],'body':_0x2f5777,'direction':_0x15b24f,'providerName':_0x1c9479,'providerResponse':_0x387096})['then'](function(_0x574268){if(_0x358e55){_0x358e55(null,_0x574268);}})[_0xde0d('0x16')](function(_0x2644bd){if(_0x358e55){_0x358e55(_0x2644bd);}});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x42')]=function(_0x16f45a,_0x40a282){this[_0xde0d('0xf')][_0xde0d('0x42')]({'firstName':_[_0xde0d('0x43')](_0x16f45a['name'])||_[_0xde0d('0x44')](_0x16f45a[_0xde0d('0x12')])?_0xde0d('0x45')+Math[_0xde0d('0x46')]():_0x16f45a[_0xde0d('0x12')],'lastName':_['isEmpty'](_0x16f45a[_0xde0d('0x47')])||_['isNil'](_0x16f45a['lastName'])?null:_0x16f45a[_0xde0d('0x47')],'phone':_0x16f45a[_0xde0d('0x48')],'ListId':_0x16f45a['list_id'],'scheduledat':_0x16f45a[_0xde0d('0x49')],'callbackUniqueid':this['channel']['uniqueid'],'tags':_0xde0d('0x4a'),'description':_0xde0d('0x4b')+_0x16f45a[_0xde0d('0x49')][_0xde0d('0x4c')](),'priority':_0x16f45a[_0xde0d('0x4d')]})['then'](function(_0x3c3c82){_0x40a282(null,_0x3c3c82);})['catch'](function(_0x5bdc08){_0x40a282(_0x5bdc08);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x4e')]=function(_0x1f0e01,_0x3e6ab6){this[_0xde0d('0xf')]['getPauseById'](_0x1f0e01)[_0xde0d('0x19')](function(_0x3eb0ee){_0x3e6ab6(null,_0x3eb0ee?_0x3eb0ee[_0xde0d('0x12')]:![]);})[_0xde0d('0x16')](function(_0x529ba3){_0x3e6ab6(_0x529ba3);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x4f')]=function(_0x2d5ff8,_0x25f1e1,_0x268e34){var _0x1e5604={'role':_0xde0d('0x50')};_0x1e5604[_0x2d5ff8]=this['channel'][_0xde0d('0x38')];this['rpc']['agentPause'](_0x1e5604,_0x25f1e1,this[_0xde0d('0xe')]['uniqueid'])[_0xde0d('0x19')](function(_0x2b14c4){_0x268e34(null,_[_0xde0d('0x44')](_0x2b14c4)?![]:!![]);})[_0xde0d('0x16')](function(_0x634111){logger['error'](_0x634111);_0x268e34(null,![]);});};AGIVertices['prototype']['agentUnpause']=function(_0x4e59c7,_0x451a37){var _0x2e14f7={'role':_0xde0d('0x50')};_0x2e14f7[_0x4e59c7]=this[_0xde0d('0xe')]['callerid'];this[_0xde0d('0xf')][_0xde0d('0x51')](_0x2e14f7)[_0xde0d('0x19')](function(_0x12568a){_0x451a37(null,_[_0xde0d('0x44')](_0x12568a)?![]:!![]);})[_0xde0d('0x16')](function(_0x30db75){logger[_0xde0d('0x52')](_0x30db75);_0x451a37(null,![]);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x53')]=function(_0x2edb54,_0x8ddf54){var _0x24919f={'role':_0xde0d('0x50')};_0x24919f[_0x2edb54]=this[_0xde0d('0xe')]['callerid'];this[_0xde0d('0xf')][_0xde0d('0x53')](_0x24919f)['then'](function(_0x29bb6f){_0x8ddf54(null,_[_0xde0d('0x44')](_0x29bb6f)?![]:!![]);})[_0xde0d('0x16')](function(_0x8e6a63){logger[_0xde0d('0x52')](_0x8e6a63);_0x8ddf54(null,![]);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x54')]=function(_0x5d3aec,_0x2e2d0f){var _0x12d82e={'role':_0xde0d('0x50')};_0x12d82e[_0x5d3aec]=this[_0xde0d('0xe')][_0xde0d('0x38')];var _0x5c2b3f=_0x5d3aec!=_0xde0d('0x55')?util[_0xde0d('0x2b')]('%s/%s@from-sip/n',_0xde0d('0x56'),this[_0xde0d('0xe')][_0xde0d('0x38')]):undefined;this[_0xde0d('0xf')]['agentLogin'](_0x12d82e,_0x5c2b3f)[_0xde0d('0x19')](function(_0xcea254){_0x2e2d0f(null,_[_0xde0d('0x44')](_0xcea254)?![]:!![]);})[_0xde0d('0x16')](function(_0x1e2c4c){logger[_0xde0d('0x52')](_0x1e2c4c);_0x2e2d0f(null,![]);});};AGIVertices[_0xde0d('0x13')]['shellCommand']=function(_0x239992,_0x9575e8){sh[_0xde0d('0x57')](_['trim'](_0x239992),function(_0x4bb7ea,_0x17ae5c){var _0x1fba27=_0x17ae5c['replace'](/(\r\n|\n|\r)/gm,'');_0x9575e8(null,_0x1fba27);});};AGIVertices[_0xde0d('0x13')]['googleCloudTTS']=function(_0x3dc038,_0x18e3f7){scripts[_0xde0d('0x58')](_0x3dc038[_0xde0d('0x59')],_0x3dc038[_0xde0d('0x5a')]||'text',_0x3dc038[_0xde0d('0x5b')],_0x3dc038[_0xde0d('0x5c')]||_0xde0d('0x5d'),_0x3dc038[_0xde0d('0x5e')]||'MALE',_0x3dc038[_0xde0d('0x5f')]||_0xde0d('0x60'))[_0xde0d('0x19')](function(_0x414ea7){_0x18e3f7(null,_0x414ea7);})[_0xde0d('0x16')](function(_0x253533){_0x18e3f7(_0x253533);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x61')]=function(_0x369751,_0x4d2853){scripts['googleTTS'](_0x369751['text'],_0x369751[_0xde0d('0x62')]||'en',0x1)[_0xde0d('0x19')](function(_0x57f3d8){_0x4d2853(null,_0x57f3d8);})[_0xde0d('0x16')](function(_0x36344d){_0x4d2853(_0x36344d);});};AGIVertices[_0xde0d('0x13')]['restAPI']=function(_0x2abb12,_0x3f8a8f){var _0x4c7b67={'uri':_0x2abb12[_0xde0d('0x63')],'method':_0x2abb12['method'],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x2abb12[_0xde0d('0x64')])==='number'&&parseInt(_0x2abb12[_0xde0d('0x64')])>=0x1?parseInt(_0x2abb12[_0xde0d('0x64')])*0x3e8:0x5*0x3e8};if(_[_0xde0d('0x65')]([_0xde0d('0x66'),_0xde0d('0x67')],_0x4c7b67['method'][_0xde0d('0x68')]())){try{_0x4c7b67[_0xde0d('0x69')]=_0x2abb12[_0xde0d('0xb')]?JSON['parse'](_0x2abb12['rawBody']):{};}catch(_0x19b866){logger[_0xde0d('0x52')](_0xde0d('0x6a'),_0x19b866);}}try{_0x4c7b67[_0xde0d('0x6b')]=_0x2abb12[_0xde0d('0xa')]?JSON['parse'](_0x2abb12['rawHeaders']):{};}catch(_0x2fd75d){logger[_0xde0d('0x52')](_0xde0d('0x6c'),_0x2fd75d);}if(_0x2abb12['computedVariables']){try{var _0x42b45f=require(_0x2abb12['computedVariables'])[_0xde0d('0x6d')](this,_0x4c7b67);_0x4c7b67['uri']=Mustache[_0xde0d('0x6e')](_0x2abb12[_0xde0d('0x63')],_0x42b45f,{},['$$','$$']);if(_0x4c7b67['headers']){_0x4c7b67[_0xde0d('0x6b')]=JSON[_0xde0d('0x6f')](Mustache['render'](JSON[_0xde0d('0x70')](_0x4c7b67[_0xde0d('0x6b')]),_0x42b45f,{},['$$','$$']));}if(_0x4c7b67[_0xde0d('0x69')]){_0x4c7b67[_0xde0d('0x69')]=JSON[_0xde0d('0x6f')](Mustache['render'](JSON[_0xde0d('0x70')](_0x4c7b67['body']),_0x42b45f,{},['$$','$$']));}}catch(_0x2b0b47){logger[_0xde0d('0x52')](_0xde0d('0x71'),_0x2b0b47);}}rp(_0x4c7b67)[_0xde0d('0x19')](function(_0x1b4d09){var _0x2fb5b2={'statusCode':_0x1b4d09[_0xde0d('0x72')]||0xc8,'statusMessage':_0x1b4d09[_0xde0d('0x73')]||'OK','headers':_0x1b4d09['headers']||{},'body':_0x1b4d09['body']||{}};_0x3f8a8f(null,_0x2fb5b2);})[_0xde0d('0x16')](function(_0x16fe97){var _0x433640={'statusCode':_0x16fe97['statusCode']||0x1f4,'statusMessage':_0x16fe97[_0xde0d('0x74')]||_0xde0d('0x75'),'headers':_0x16fe97[_0xde0d('0x76')]['headers']||{},'body':_0x16fe97[_0xde0d('0x76')]['body']||{}};_0x3f8a8f(null,_0x433640);});};AGIVertices['prototype'][_0xde0d('0x77')]=function(_0x5d9fa2,_0x8ec885){scripts[_0xde0d('0x77')](this[_0xde0d('0xe')][_0xde0d('0x3a')],_0x5d9fa2[_0xde0d('0x78')],_0x5d9fa2[_0xde0d('0x5b')],_0x5d9fa2[_0xde0d('0x79')]||'en')['then'](function(_0x246fd7){_0x8ec885(null,_0x246fd7);})[_0xde0d('0x16')](function(_0x54dafd){_0x8ec885(_0x54dafd);});};AGIVertices[_0xde0d('0x13')]['googleDialogflowV2']=function(_0x1e1ba9,_0x252dce){scripts['googleDialogflowV2'](this[_0xde0d('0xe')][_0xde0d('0x3a')],_0x1e1ba9[_0xde0d('0x7a')],_0x1e1ba9[_0xde0d('0x7b')],_0x1e1ba9[_0xde0d('0x7c')],_0x1e1ba9[_0xde0d('0x5b')],_0x1e1ba9[_0xde0d('0x7d')]||'en')[_0xde0d('0x19')](function(_0x38eb77){_0x252dce(null,_0x38eb77);})[_0xde0d('0x16')](function(_0x2c9072){_0x252dce(_0x2c9072);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x7e')]=function(_0x69bc4e,_0x17e06f){scripts['sestekNDA'](this[_0xde0d('0xe')],_0x69bc4e)[_0xde0d('0x19')](function(_0x162cba){_0x17e06f(null,_0x162cba);})[_0xde0d('0x16')](function(_0x4dd6bd){_0x17e06f(_0x4dd6bd);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x7f')]=function(_0x3f0e72,_0x276d00){scripts[_0xde0d('0x7f')](_0x3f0e72[_0xde0d('0x78')],_0x3f0e72[_0xde0d('0x5b')],_0x3f0e72[_0xde0d('0x80')]||_0xde0d('0x5d'),_0x3f0e72[_0xde0d('0x81')])[_0xde0d('0x19')](function(_0x40a75e){_0x276d00(null,_0x40a75e);})[_0xde0d('0x16')](function(_0x42af22){_0x276d00(_0x42af22);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x82')]=function(_0xfb656,_0x11c964,_0x78a827){scripts[_0xde0d('0x82')](_0x11c964,_0xfb656[_0xde0d('0x78')],_0xfb656[_0xde0d('0x83')]||'en-US',this[_0xde0d('0x84')](_0xfb656['model'])?_0xfb656['model']:undefined)['then'](function(_0x407dbc){_0x78a827(null,_0x407dbc);})[_0xde0d('0x16')](function(_0x37c060){_0x78a827(_0x37c060);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x85')]=function(_0xdf40fc,_0x2f696b){scripts[_0xde0d('0x85')](_0xdf40fc['aws_access_key_id'],_0xdf40fc[_0xde0d('0x86')],_0xdf40fc['aws_polly_region'],_0xdf40fc['aws_polly_voice']||_0xde0d('0x87'),_0xdf40fc[_0xde0d('0x5b')],_0xdf40fc[_0xde0d('0x88')]||'text')[_0xde0d('0x19')](function(_0x6c872d){_0x2f696b(null,_0x6c872d);})['catch'](function(_0x3127e6){_0x2f696b(_0x3127e6);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x89')]=function(_0x44f348,_0x1b1f81){scripts[_0xde0d('0x89')](this['channel'][_0xde0d('0x3a')],_0x44f348[_0xde0d('0x8a')],_0x44f348[_0xde0d('0x86')],_0x44f348[_0xde0d('0x8b')],_0x44f348['text'],_0x44f348['aws_bot_name'])[_0xde0d('0x19')](function(_0x49c022){_0x1b1f81(null,_0x49c022);})[_0xde0d('0x16')](function(_0x35b979){_0x1b1f81(_0x35b979);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x8c')]=function(_0x52e7f8,_0x16cc23,_0x4391c3){scripts[_0xde0d('0x8c')](_0x16cc23,_0x52e7f8[_0xde0d('0x78')],_0x52e7f8[_0xde0d('0x8d')]||_0xde0d('0x5d'))[_0xde0d('0x19')](function(_0x4bb3a3){_0x4391c3(null,_0x4bb3a3);})[_0xde0d('0x16')](function(_0x590099){_0x4391c3(_0x590099);});};AGIVertices[_0xde0d('0x13')]['tildeASR']=function(_0x1a06ca,_0x547982,_0xebfc40){scripts[_0xde0d('0x8e')](_0x547982,_0x1a06ca[_0xde0d('0x8f')],_0x1a06ca[_0xde0d('0x90')],_0x1a06ca[_0xde0d('0x91')])[_0xde0d('0x19')](function(_0xd0852){_0xebfc40(null,_0xd0852);})['catch'](function(_0x2646cb){_0xebfc40(_0x2646cb);});};AGIVertices[_0xde0d('0x13')][_0xde0d('0x92')]=function(_0x287b96){var _0x33c833=_['includes'](verticesWithRetry,_0x287b96['agicommand'])?_0x287b96:_[_0xde0d('0x93')](_0x287b96);for(var _0x5754a7 in _0x33c833){if(_0x33c833[_0xde0d('0x94')](_0x5754a7)){if(_0x33c833[_0x5754a7]&&_[_0xde0d('0x95')](_0x33c833[_0x5754a7])){if(_[_0xde0d('0x65')](recursiveMapAttributes,_0x5754a7)){_0x33c833[_0x5754a7]=this[_0xde0d('0x96')](_0x33c833[_0x5754a7]);}else{_0x33c833[_0x5754a7]=this[_0xde0d('0x97')](_0x33c833[_0x5754a7]);}}}}return _0x33c833;};AGIVertices[_0xde0d('0x13')][_0xde0d('0x98')]=function(_0x40f980){for(var _0x2776aa in _0x40f980){if(_0x40f980[_0xde0d('0x94')](_0x2776aa)){if(_[_0xde0d('0x99')](_0x40f980[_0x2776aa])){this[_0xde0d('0x98')](_0x40f980[_0x2776aa]);}else if(_[_0xde0d('0x9a')](_0x40f980[_0x2776aa])){for(var _0x1be377=0x0;_0x1be377<_0x40f980[_0x2776aa][_0xde0d('0x9b')];_0x1be377++){this[_0xde0d('0x98')](_0x40f980[_0x2776aa][_0x1be377]);}}else if(_['isString'](_0x40f980[_0x2776aa])){_0x40f980[_0x2776aa]=this[_0xde0d('0x97')](_0x40f980[_0x2776aa]);}}}};AGIVertices[_0xde0d('0x13')][_0xde0d('0x9c')]=function(_0x1444c0,_0x3a238c){for(var _0x4b113a in _0x1444c0){if(_0x1444c0['hasOwnProperty'](_0x4b113a)){if(_[_0xde0d('0x99')](_0x1444c0[_0x4b113a])){if(!_[_0xde0d('0x43')](_0x1444c0[_0x4b113a])){this['saveRestApiResult'](_0x1444c0[_0x4b113a],util[_0xde0d('0x2b')](_0xde0d('0x9d'),_0x3a238c,_0x4b113a));}}else if(_[_0xde0d('0x9a')](_0x1444c0[_0x4b113a])){for(var _0x1cad92=0x0;_0x1cad92<_0x1444c0[_0x4b113a][_0xde0d('0x9b')];_0x1cad92++){this[_0xde0d('0x9c')](_0x1444c0[_0x4b113a][_0x1cad92],util[_0xde0d('0x2b')](_0xde0d('0x9d'),_0x3a238c,_0x4b113a+'['+_0x1cad92+']'));}}else{if(!_[_0xde0d('0x44')](_0x1444c0[_0x4b113a])){this[_0xde0d('0xe')][_0xde0d('0x9e')](util[_0xde0d('0x2b')](_0xde0d('0x9d'),_0x3a238c,_0x4b113a),_0x1444c0[_0x4b113a]);}}}}};AGIVertices[_0xde0d('0x13')][_0xde0d('0x96')]=function(_0x2868e7){try{var _0x1b62d0=JSON[_0xde0d('0x6f')](_0x2868e7);this['recursiveNodeIndex'](_0x1b62d0);return JSON[_0xde0d('0x70')](_0x1b62d0);}catch(_0x4b0471){return this[_0xde0d('0x97')](_0x2868e7);}};AGIVertices['prototype'][_0xde0d('0x97')]=function(_0x384776){var _0x5f192d=_0x384776[_0xde0d('0x9f')]('{');for(var _0x3b2356=0x1;_0x3b2356<_0x5f192d[_0xde0d('0x9b')];_0x3b2356+=0x1){var _0x4fb0d6=_0x5f192d[_0x3b2356]['split']('}');if(_0x4fb0d6['length']>0x1){_0x384776=_0x384776[_0xde0d('0xa0')]('{'+_0x4fb0d6[0x0]+'}',this[_0xde0d('0xe')]['getVariable'](_0x4fb0d6[0x0])[_0xde0d('0xa1')]||_0x4fb0d6[0x0]);}}if(_0x5f192d[_0xde0d('0x9b')]===0x1){return _0x384776['toString']();}return this[_0xde0d('0x97')](_0x384776);};AGIVertices[_0xde0d('0x13')][_0xde0d('0xa2')]=function(_0x3fcd35,_0x34ea0e){var _0x312dba=this[_0xde0d('0xe')]['getVariable'](_0x3fcd35);if(_0x312dba[_0xde0d('0xa3')]===-0x1){return _0x312dba;}logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x34ea0e,_0x312dba[_0xde0d('0xa1')]));return this[_0xde0d('0xe')][_0xde0d('0x9e')](_0x34ea0e,_0x312dba['extra']);};AGIVertices[_0xde0d('0x13')][_0xde0d('0x84')]=function(_0x34674f){return _0x34674f&&_0x34674f!=='0'&&_0x34674f!=='-1'&&_0x34674f!=='';};AGIVertices[_0xde0d('0x13')][_0xde0d('0xa4')]=function(_0x3a933b){this['createSquareDetailsReport'][_0xde0d('0x6d')](this,_0x3a933b,'-');_0x3a933b[_0xde0d('0xa5')]=_0x3a933b['maxRetry'];return{'code':0xc8,'result':'-'};};AGIVertices['prototype'][_0xde0d('0xa6')]=function(_0x4a380b){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0xa7'),_0x4a380b[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0x4a380b[_0xde0d('0x5b')])){return this[_0xde0d('0xe')]['noop'](_0xde0d('0xa9'));}var _0x414184='\x22'+_0x4a380b['text']+'\x22';if(this['isConfigured'](_0x4a380b[_0xde0d('0x76')])){_0x414184+=','+_0x4a380b['options'];}var _0x5f08de=this[_0xde0d('0xe')][_0xde0d('0x57')](_0xde0d('0xaa'),_0x414184);if(_0x5f08de['result']===-0x1){return _0x5f08de;}return this[_0xde0d('0xe')]['noop'](util[_0xde0d('0x2b')](_0xde0d('0xab'),_0x414184));};AGIVertices[_0xde0d('0x13')][_0xde0d('0xac')]=function(_0x2dc174){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0xad'),_0x2dc174[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0x2dc174[_0xde0d('0xae')])){return this['channel'][_0xde0d('0xaf')](_0xde0d('0xb0'));}var _0x5dfa0b=_0x2dc174[_0xde0d('0xae')];if(this[_0xde0d('0x84')](_0x2dc174['options'])){_0x5dfa0b+=','+_0x2dc174[_0xde0d('0x76')];}var _0x5177a4=this['channel'][_0xde0d('0x57')](_0xde0d('0xb1'),_0x5dfa0b);if(_0x5177a4[_0xde0d('0xa3')]===-0x1){return _0x5177a4;}var _0x1276b7=this['getAndSetVariable']('RECOG_CONFIDENCE()',_0xde0d('0xb2'));if(_0x1276b7[_0xde0d('0xa3')]===-0x1){return _0x1276b7;}var _0x3f8ef2=this['getAndSetVariable'](_0xde0d('0xb3'),_0xde0d('0xb4'));if(_0x3f8ef2[_0xde0d('0xa3')]===-0x1){return _0x3f8ef2;}var _0x1c3260=this[_0xde0d('0xa2')](_0xde0d('0xb5'),_0xde0d('0xb6'));if(_0x1c3260[_0xde0d('0xa3')]===-0x1){return _0x1c3260;}return this['channel'][_0xde0d('0xaf')](util['format'](_0xde0d('0xb7'),_0x5dfa0b));};AGIVertices['prototype'][_0xde0d('0xb8')]=function(_0x24ca93){logger['info'](util[_0xde0d('0x2b')]('Enter\x20in\x20AGI\x20(%s)\x20block',_0x24ca93[_0xde0d('0xa8')]));return this[_0xde0d('0xe')][_0xde0d('0xb8')]([_0x24ca93['command'],_0x24ca93['args']]);};AGIVertices[_0xde0d('0x13')][_0xde0d('0xb9')]=function(_0x28b73d){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0xba'),_0x28b73d[_0xde0d('0xa8')]));if(this[_0xde0d('0x84')](_0x28b73d[_0xde0d('0x64')])){logger[_0xde0d('0x2f')](util['format'](_0xde0d('0xbb'),_0x28b73d[_0xde0d('0x64')]));var _0x2cfa6f=this[_0xde0d('0xe')][_0xde0d('0xbc')](_0x28b73d[_0xde0d('0x64')]);if(_0x2cfa6f['result']===-0x1){return _0x2cfa6f;}}return this[_0xde0d('0xe')][_0xde0d('0xb9')]();};AGIVertices[_0xde0d('0x13')][_0xde0d('0x4a')]=function(_0x55d8df){logger[_0xde0d('0x2f')](util['format'](_0xde0d('0xbd'),_0x55d8df[_0xde0d('0xa8')]));if(!this['isConfigured'](_0x55d8df[_0xde0d('0xbe')])){return this[_0xde0d('0xe')]['error'](_0x55d8df,_0xde0d('0xbf'));}_0x55d8df[_0xde0d('0x49')]=moment();if(this[_0xde0d('0x84')](_0x55d8df['delay'])){_0x55d8df['scheduledAt']=moment()['add'](_0x55d8df['delay'],_0xde0d('0xc0'));}if(!this[_0xde0d('0x84')](_0x55d8df[_0xde0d('0x4d')])){_0x55d8df['callback_priority']=0x2;}this['createCmContact']['sync'](this,_0x55d8df);return this[_0xde0d('0xe')]['noop'](util[_0xde0d('0x2b')](_0xde0d('0xc1'),_0x55d8df[_0xde0d('0x48')],_0x55d8df['list_id'],_0x55d8df[_0xde0d('0x49')]));};AGIVertices[_0xde0d('0x13')][_0xde0d('0xc2')]=function(_0x14b834){logger['info'](util[_0xde0d('0x2b')](_0xde0d('0xc3'),_0x14b834['label']));var _0x3627dd=this[_0xde0d('0xe')][_0xde0d('0x57')](_0x14b834['application'],_0x14b834[_0xde0d('0x76')]);if(_0x3627dd[_0xde0d('0xa3')]===-0x1){return _0x3627dd;}return this[_0xde0d('0xe')]['noop'](util['format'](_0xde0d('0xc4'),_0x14b834[_0xde0d('0xc5')],_0x14b834[_0xde0d('0x76')]));};AGIVertices[_0xde0d('0x13')][_0xde0d('0xc6')]=function(_0x2d3be9){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0xc7'),_0x2d3be9[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0x2d3be9[_0xde0d('0x5b')])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0xa9'));}var _0x4a2b94='\x22'+_0x2d3be9[_0xde0d('0x5b')]+'\x22';if(this['isConfigured'](_0x2d3be9[_0xde0d('0x76')])){_0x4a2b94+=','+_0x2d3be9[_0xde0d('0x76')];}var _0x12074f=this[_0xde0d('0xe')][_0xde0d('0x57')]('MRCPSynth',_0x4a2b94);if(_0x12074f[_0xde0d('0xa3')]===-0x1){return _0x12074f;}return this[_0xde0d('0xe')]['noop'](util[_0xde0d('0x2b')](_0xde0d('0xab'),_0x4a2b94));};AGIVertices['prototype'][_0xde0d('0xc8')]=function(_0x58130b){logger[_0xde0d('0x2f')](util['format'](_0xde0d('0xc9'),_0x58130b[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0x58130b[_0xde0d('0x5b')])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0xa9'));}var _0x16240c='\x22'+_0x58130b[_0xde0d('0x5b')]+'\x22';if(this[_0xde0d('0x84')](_0x58130b[_0xde0d('0x76')])){_0x16240c+=','+_0x58130b[_0xde0d('0x76')];}var _0x522a6d=this['channel'][_0xde0d('0x57')](_0xde0d('0xaa'),_0x16240c);if(_0x522a6d[_0xde0d('0xa3')]===-0x1){return _0x522a6d;}return this['channel'][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0xab'),_0x16240c));};AGIVertices['prototype']['lumenvoxasr']=function(_0x4c5cc9){logger[_0xde0d('0x2f')](util['format'](_0xde0d('0xca'),_0x4c5cc9[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0x4c5cc9[_0xde0d('0xae')])){return this[_0xde0d('0xe')][_0xde0d('0xaf')]('no\x20grammar\x20configured');}var _0x242bf8=_0x4c5cc9[_0xde0d('0xae')];if(this['isConfigured'](_0x4c5cc9[_0xde0d('0x76')])){_0x242bf8+=','+_0x4c5cc9[_0xde0d('0x76')];}var _0x1ab45c=this[_0xde0d('0xe')]['exec'](_0xde0d('0xb1'),_0x242bf8);if(_0x1ab45c[_0xde0d('0xa3')]===-0x1){return _0x1ab45c;}var _0x255afe=this[_0xde0d('0xa2')]('RECOG_CONFIDENCE()',_0xde0d('0xcb'));if(_0x255afe['result']===-0x1){return _0x255afe;}var _0x1a3497=this[_0xde0d('0xa2')]('RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT');if(_0x1a3497[_0xde0d('0xa3')]===-0x1){return _0x1a3497;}var _0x4532ac=this[_0xde0d('0xa2')](_0xde0d('0xb5'),'LUMENVOX_ASR_INSTANCE');if(_0x4532ac[_0xde0d('0xa3')]===-0x1){return _0x4532ac;}return this[_0xde0d('0xe')][_0xde0d('0xaf')](util['format'](_0xde0d('0xb7'),_0x242bf8));};AGIVertices[_0xde0d('0x13')][_0xde0d('0xcc')]=function(_0x7e268b){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0xcd'),_0x7e268b['label']));if(!this[_0xde0d('0x84')](_0x7e268b[_0xde0d('0xae')])){return this['channel']['noop']('no\x20grammar\x20configured');}var _0x4c98fb=_0x7e268b[_0xde0d('0xae')];if(this[_0xde0d('0x84')](_0x7e268b['options'])){_0x4c98fb+=','+_0x7e268b[_0xde0d('0x76')];}var _0x35a104=this[_0xde0d('0xe')]['exec'](_0xde0d('0xb1'),_0x4c98fb);if(_0x35a104[_0xde0d('0xa3')]===-0x1){return _0x35a104;}var _0x25ccae=this[_0xde0d('0xa2')](_0xde0d('0xce'),'SESTEK_ASR_CONFIDENCE');if(_0x25ccae['result']===-0x1){return _0x25ccae;}var _0x379443=this['getAndSetVariable'](_0xde0d('0xb3'),_0xde0d('0xcf'));if(_0x379443[_0xde0d('0xa3')]===-0x1){return _0x379443;}var _0x299dd8=this[_0xde0d('0xa2')]('RECOG_INSTANCE()',_0xde0d('0xd0'));if(_0x299dd8[_0xde0d('0xa3')]===-0x1){return _0x299dd8;}return this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0xb7'),_0x4c98fb));};AGIVertices['prototype'][_0xde0d('0xd1')]=function(_0x449d11){logger['info'](util['format'](_0xde0d('0xd2'),_0x449d11[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0x449d11['odbc_id'])){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x449d11,_0xde0d('0xd3'));}var _0x572aa4=this['getSquareOdbc'][_0xde0d('0x6d')](this,_0x449d11[_0xde0d('0xd4')]);if(!_0x572aa4){return this[_0xde0d('0xe')]['error'](_0x449d11,_0xde0d('0xd5'));}if(!this[_0xde0d('0x84')](_0x449d11[_0xde0d('0xd6')])){return this[_0xde0d('0xe')]['error'](_0x449d11,'no\x20query\x20configured');}var _0xd08bd0=_0x449d11[_0xde0d('0xd6')][_0xde0d('0xd7')](/(\r\n|\n|\r)/gm,'\x20');this['channel'][_0xde0d('0xaf')](util['format'](_0xde0d('0xd8'),_0xd08bd0));var _0x422a03=this['getQueryOdbc']['sync'](this,_0x572aa4,_0xd08bd0);this['createSquareDetailsReport'][_0xde0d('0x6d')](this,_0x449d11,_0xd08bd0);if(!this[_0xde0d('0x84')](_0x449d11[_0xde0d('0xd9')])){return this['channel'][_0xde0d('0xaf')](_0xde0d('0xda'));}var _0x1f4c1f=this[_0xde0d('0xdb')]['sync'](this,_0x449d11[_0xde0d('0xd9')]);if(!_0x1f4c1f){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x449d11,_0xde0d('0xdc'));}var _0x2b2592=this;_0x422a03[_0xde0d('0xdd')](function(_0xc3382,_0x3b75a0){Object[_0xde0d('0xde')](_0xc3382)['forEach'](function(_0x32deeb){_0x2b2592[_0xde0d('0xe')][_0xde0d('0x9e')](util[_0xde0d('0x2b')](_0xde0d('0xdf'),_0x1f4c1f,_0x3b75a0,_0x32deeb),_0xc3382[_0x32deeb]);});});this[_0xde0d('0xe')]['setVariable'](util['format'](_0xde0d('0xe0'),_0x1f4c1f),_0x422a03[_0xde0d('0x9b')]);return this['channel'][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0xe1'),_0x1f4c1f));};AGIVertices[_0xde0d('0x13')][_0xde0d('0xe2')]=function(_0xa081e0){logger[_0xde0d('0xe3')](util['format']('Enter\x20in\x20DIAL\x20(%s)\x20block',_0xa081e0[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0xa081e0['sip_id'])){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0xa081e0,'no\x20user\x20selected');}var _0x271d92=this[_0xde0d('0x1d')]['sync'](this,_0xa081e0[_0xde0d('0xe4')]);if(!_0x271d92){return this['channel'][_0xde0d('0x52')](_0xa081e0,_0xde0d('0xe5'));}var _0x27ba07=this[_0xde0d('0xe')][_0xde0d('0x57')](_0xde0d('0xe6'),[util[_0xde0d('0x2b')]('SIP/%s',_0x271d92),_0xa081e0[_0xde0d('0x64')],_0xa081e0[_0xde0d('0xe7')],_0xa081e0[_0xde0d('0x63')]]);if(_0x27ba07[_0xde0d('0xa3')]===-0x1){return _0x27ba07;}return this['channel'][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0xe8'),_0xde0d('0xe6')));};AGIVertices[_0xde0d('0x13')][_0xde0d('0xe9')]=function(_0x5e7513){logger['info'](util['format']('Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block',_0x5e7513[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0x5e7513['key'])){return this[_0xde0d('0xe')]['noop'](_0xde0d('0xea'));}if(!this[_0xde0d('0x84')](_0x5e7513[_0xde0d('0x5b')])){return this['channel'][_0xde0d('0xaf')](_0xde0d('0xa9'));}this['channel'][_0xde0d('0xeb')]=!![];this[_0xde0d('0x35')](_0x5e7513);this[_0xde0d('0x41')](_0x5e7513['text'],'in','','');this['channel'][_0xde0d('0xaf')](util['format'](_0xde0d('0xec'),_0x5e7513[_0xde0d('0x5b')]));var _0x2e3b0e=this[_0xde0d('0x77')][_0xde0d('0x6d')](this,_0x5e7513);if(_0x2e3b0e){for(var _0x46cfff in _0x2e3b0e){if(_0x2e3b0e['hasOwnProperty'](_0x46cfff)){this[_0xde0d('0xe')][_0xde0d('0x9e')](util[_0xde0d('0x2b')](_0xde0d('0xed'),_0x46cfff[_0xde0d('0x68')]()),_0x2e3b0e[_0x46cfff]);}}this[_0xde0d('0x41')](_0x2e3b0e[_0xde0d('0xee')],'out',_0xde0d('0xe9'),'');return this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0xef'),_0x2e3b0e['speech']));}return this['channel'][_0xde0d('0x52')](_0x5e7513,_0xde0d('0xf0'));};AGIVertices[_0xde0d('0x13')][_0xde0d('0xf1')]=function(_0x21d928){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0xf2'),_0x21d928[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0x21d928[_0xde0d('0x7a')])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0xf3'));}if(!this[_0xde0d('0x84')](_0x21d928[_0xde0d('0x7b')])){return this[_0xde0d('0xe')]['noop'](_0xde0d('0xf4'));}if(!this[_0xde0d('0x84')](_0x21d928[_0xde0d('0x7c')])){return this[_0xde0d('0xe')]['noop'](_0xde0d('0xf5'));}if(!this[_0xde0d('0x84')](_0x21d928['dialogflowV2_language'])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0xf6'));}if(!this[_0xde0d('0x84')](_0x21d928[_0xde0d('0x5b')])){return this[_0xde0d('0xe')][_0xde0d('0xaf')]('no\x20text\x20configured');}this[_0xde0d('0xe')][_0xde0d('0xeb')]=!![];this[_0xde0d('0x35')](_0x21d928);this[_0xde0d('0x41')](_0x21d928['text'],'in','','');this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0xf7'),_0x21d928['text']));var _0x1665cc=this[_0xde0d('0xf8')][_0xde0d('0x6d')](this,_0x21d928);if(_0x1665cc){for(var _0x5da006 in _0x1665cc){if(_0x1665cc[_0xde0d('0x94')](_0x5da006)){if(_0x5da006!==_0xde0d('0xf9')){this[_0xde0d('0xe')][_0xde0d('0x9e')](util[_0xde0d('0x2b')](_0xde0d('0xed'),_0x5da006[_0xde0d('0x68')]()),_0x1665cc[_0x5da006]);}}}this[_0xde0d('0x41')](_0x1665cc[_0xde0d('0xee')],_0xde0d('0xfa'),_0xde0d('0xf1'),_0x1665cc[_0xde0d('0xf9')]);return this['channel']['noop'](util['format'](_0xde0d('0xfb'),_0x1665cc[_0xde0d('0xee')]));}return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x21d928,_0xde0d('0xfc'));};AGIVertices[_0xde0d('0x13')][_0xde0d('0xfd')]=function(_0xf75e4a){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0xfe'),_0xf75e4a[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0xf75e4a[_0xde0d('0xff')])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0x100'));}if(!this[_0xde0d('0x84')](_0xf75e4a[_0xde0d('0x101')])){return this[_0xde0d('0xe')][_0xde0d('0xaf')]('no\x20username\x20configured');}if(!this[_0xde0d('0x84')](_0xf75e4a[_0xde0d('0x102')])){return this[_0xde0d('0xe')]['noop'](_0xde0d('0x103'));}if(!this[_0xde0d('0x84')](_0xf75e4a[_0xde0d('0x104')])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0xa9'));}this['channel'][_0xde0d('0xeb')]=!![];this['createSquareDetailsReport'](_0xf75e4a);this[_0xde0d('0x41')](_0xf75e4a['text'],'in','','');this[_0xde0d('0xe')]['noop'](util[_0xde0d('0x2b')](_0xde0d('0x105'),_0xf75e4a[_0xde0d('0x5b')]));var _0x67b274=this[_0xde0d('0x7e')][_0xde0d('0x6d')](this,_0xf75e4a);if(_0x67b274){for(var _0x3f0c8f in _0x67b274){if(_0x67b274[_0xde0d('0x94')](_0x3f0c8f)){this[_0xde0d('0xe')][_0xde0d('0x9e')](util[_0xde0d('0x2b')](_0xde0d('0x106'),_0x3f0c8f[_0xde0d('0x68')]()),_0x67b274[_0x3f0c8f]);}}this[_0xde0d('0x41')](_0x67b274[_0xde0d('0xee')],_0xde0d('0xfa'),_0xde0d('0xfd'),'');if(_0x67b274[_0xde0d('0x107')]){this[_0xde0d('0xe')][_0xde0d('0xaf')](util['format'](_0xde0d('0x108'),_0x67b274[_0xde0d('0x107')]));var _0x506236=this[_0xde0d('0xe')]['streamFile'](_0x67b274[_0xde0d('0x107')]);try{fs['unlink'](_0x67b274[_0xde0d('0x107')]+'.wav');}catch(_0x2ab8f7){logger[_0xde0d('0x52')](_0x2ab8f7);}return _0x506236;}else{return this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')]('SestekNDA\x20Result\x20%s',_0x67b274[_0xde0d('0xee')]));}}return this[_0xde0d('0xe')][_0xde0d('0x52')](_0xf75e4a,_0xde0d('0x109'));};AGIVertices[_0xde0d('0x13')][_0xde0d('0x10a')]=function(_0x32144f){logger['info'](util[_0xde0d('0x2b')]('Enter\x20in\x20END\x20(%s)\x20block',_0x32144f[_0xde0d('0xa8')]));return this['channel']['noop'](_0xde0d('0x10a'));};AGIVertices['prototype'][_0xde0d('0x10b')]=function(_0x4b0030){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')]('Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block',_0x4b0030[_0xde0d('0xa8')]));var _0x1c7e88='';if(_0x4b0030[_0xde0d('0x10c')]){if(!this['isConfigured'](_0x4b0030[_0xde0d('0x10c')])){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x4b0030,_0xde0d('0x10d'));}else{var _0x57ab3d=parseInt(_0x4b0030[_0xde0d('0x10c')],0xa);if(isNaN(_0x57ab3d)){_0x1c7e88=_0x4b0030[_0xde0d('0x10c')];}else{_0x1c7e88=this[_0xde0d('0x1f')][_0xde0d('0x6d')](this,_0x4b0030[_0xde0d('0x10c')]);if(!_0x1c7e88){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x4b0030,_0xde0d('0x10e'));}}}}else if(_0x4b0030[_0xde0d('0x10f')]){_0x1c7e88=_0x4b0030[_0xde0d('0x10f')];}else{return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x4b0030,_0xde0d('0x10d'));}var _0x117cd7=this[_0xde0d('0xe')][_0xde0d('0x57')]('DIAL',[util[_0xde0d('0x2b')](_0xde0d('0x110'),_0x1c7e88,_0x4b0030['phone']),_0x4b0030[_0xde0d('0x64')],_0x4b0030[_0xde0d('0xe7')],_0x4b0030[_0xde0d('0x63')]]);if(_0x117cd7[_0xde0d('0xa3')]===-0x1){return _0x117cd7;}return this[_0xde0d('0xe')]['noop'](util['format'](_0xde0d('0xe8'),_0xde0d('0xe6')));};AGIVertices['prototype'][_0xde0d('0x111')]=function(_0x3f58c8){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x112'),_0x3f58c8[_0xde0d('0xa8')]));return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0x111'));};AGIVertices[_0xde0d('0x13')][_0xde0d('0x113')]=function(_0x4af955){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x114'),_0x4af955['label']));if(_0x4af955[_0xde0d('0xa5')]===0x0){return this['maxRetry'](_0x4af955);}_0x4af955['retry']-=0x1;if(!this[_0xde0d('0x84')](_0x4af955['file_id'])){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x4af955,_0xde0d('0x115'));}var _0x595da7=this[_0xde0d('0x20')]['sync'](this,_0x4af955[_0xde0d('0x116')]);if(!_0x595da7){return this[_0xde0d('0xe')]['error'](_0x4af955,_0xde0d('0x117'));}if(!this['isConfigured'](_0x4af955['variable_id'])){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0xde0d('0xda'));}var _0x56293f=this[_0xde0d('0xe')][_0xde0d('0x118')](_0x595da7,_0x4af955['response'],_0x4af955[_0xde0d('0x119')]);var _0x201fdd=_0x56293f[_0xde0d('0xa3')]?_0x56293f[_0xde0d('0xa3')][_0xde0d('0x4c')]():'';logger['info']('test',JSON[_0xde0d('0x70')](_0x56293f));if(_0x56293f[_0xde0d('0xa3')]===-0x1){this['createSquareDetailsReport'][_0xde0d('0x6d')](this,_0x4af955,_0x201fdd);return _0x56293f;}else if(_0x56293f[_0xde0d('0xa1')]===_0xde0d('0x64')){_0x56293f[_0xde0d('0xa3')]=_0x201fdd[_0xde0d('0x9b')]>=parseInt(_0x4af955[_0xde0d('0x11a')])?'x':'i';}else{_0x56293f[_0xde0d('0xa3')]=_0x201fdd['length']>=parseInt(_0x4af955[_0xde0d('0x11a')])&&_0x201fdd['length']<=parseInt(_0x4af955[_0xde0d('0x119')])?'x':'i';}var _0x2b13e8=this[_0xde0d('0xdb')][_0xde0d('0x6d')](this,_0x4af955['variable_id']);if(!_0x2b13e8){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x4af955,_0xde0d('0xdc'));}this[_0xde0d('0xe')]['setVariable'](_0x2b13e8,_0x201fdd);if(this[_0xde0d('0x84')](_0x4af955[_0xde0d('0x11b')])){var _0x2eab48=parseInt(_0x4af955[_0xde0d('0x11b')],0xa);var _0x5766f6=rs[_0xde0d('0x11c')]({'charset':'*','length':_0x2eab48});var _0x2d247e=_0x201fdd[_0xde0d('0x9b')];if(_0x2d247e>0x0){if(_0x2d247e>_0x2eab48){this['createSquareDetailsReport'][_0xde0d('0x6d')](this,_0x4af955,_0x4af955[_0xde0d('0x11d')]===_0xde0d('0x11e')?_0x5766f6+_0x201fdd[_0xde0d('0x11f')](_0x2eab48):_0x201fdd[_0xde0d('0x11f')](0x0,_0x2d247e-_0x2eab48)+_0x5766f6);}else{this[_0xde0d('0x35')][_0xde0d('0x6d')](this,_0x4af955,rs[_0xde0d('0x11c')]({'charset':'*','length':_0x2d247e}));}}else{this[_0xde0d('0x35')][_0xde0d('0x6d')](this,_0x4af955,'');}}else{this[_0xde0d('0x35')][_0xde0d('0x6d')](this,_0x4af955,_0x201fdd);}return _0x56293f;};AGIVertices['prototype'][_0xde0d('0xd')]=function(_0x21be26){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x120'),_0x21be26[_0xde0d('0xa8')]));return this[_0xde0d('0x113')](_0x21be26);};AGIVertices[_0xde0d('0x13')]['goal']=function(_0x303ed6){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x121'),_0x303ed6[_0xde0d('0xa8')]));this['createSquareDetailsReport'][_0xde0d('0x6d')](this,_0x303ed6,_0x303ed6['goalname']);return this['channel'][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0x122'),_0x303ed6[_0xde0d('0x123')]));};AGIVertices[_0xde0d('0x13')]['awspolly']=function(_0x5e7468){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x124'),_0x5e7468['label']));if(!this[_0xde0d('0x84')](_0x5e7468['aws_access_key_id'])||!this['isConfigured'](_0x5e7468['aws_secret_access_key'])){return this[_0xde0d('0xe')]['noop'](_0xde0d('0x125'));}if(!this['isConfigured'](_0x5e7468[_0xde0d('0x5b')])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0xa9'));}this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0x126'),_0x5e7468[_0xde0d('0x5b')]));var _0x191eab=this[_0xde0d('0x85')][_0xde0d('0x6d')](this,_0x5e7468);if(_0x191eab){this[_0xde0d('0xe')]['noop'](util[_0xde0d('0x2b')]('aws\x20Polly\x20%s\x20file\x20created',_0x191eab));var _0x19b723=this[_0xde0d('0xe')][_0xde0d('0x127')](_0x191eab);try{fs[_0xde0d('0x128')](_0x191eab+_0xde0d('0x129'));}catch(_0x968392){logger[_0xde0d('0x52')](_0x968392);}return _0x19b723;}return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x5e7468,_0xde0d('0x12a'));};AGIVertices[_0xde0d('0x13')]['awslex']=function(_0x27fd16){logger['info'](util['format'](_0xde0d('0x12b'),_0x27fd16[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0x27fd16[_0xde0d('0x8a')])||!this[_0xde0d('0x84')](_0x27fd16[_0xde0d('0x86')])){return this['channel'][_0xde0d('0xaf')](_0xde0d('0x125'));}if(!this[_0xde0d('0x84')](_0x27fd16[_0xde0d('0x12c')])){return this['channel'][_0xde0d('0xaf')](_0xde0d('0x12d'));}if(!this[_0xde0d('0x84')](_0x27fd16['text'])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0xa9'));}this[_0xde0d('0xe')][_0xde0d('0xeb')]=!![];this[_0xde0d('0x35')](_0x27fd16);this[_0xde0d('0x41')](_0x27fd16[_0xde0d('0x5b')],'in','','');this['channel'][_0xde0d('0xaf')](util['format'](_0xde0d('0x12e'),_0x27fd16[_0xde0d('0x5b')]));var _0x291d8e=this[_0xde0d('0x89')][_0xde0d('0x6d')](this,_0x27fd16);if(_0x291d8e){for(var _0x3b1c6f in _0x291d8e){if(_0x291d8e[_0xde0d('0x94')](_0x3b1c6f)&&_[_0xde0d('0x95')](_0x291d8e[_0x3b1c6f])){this[_0xde0d('0xe')][_0xde0d('0x9e')](util[_0xde0d('0x2b')](_0xde0d('0x12f'),_0x3b1c6f[_0xde0d('0x68')]()),_0x291d8e[_0x3b1c6f]);}}if(_['isNil'](_0x291d8e['message'])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0x130'));}else{this[_0xde0d('0x41')](_0x291d8e[_0xde0d('0x74')],_0xde0d('0xfa'),_0xde0d('0x131'),'');return this[_0xde0d('0xe')]['noop'](util['format'](_0xde0d('0x132'),_0x291d8e[_0xde0d('0x74')]));}}return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x27fd16,_0xde0d('0x133'));};AGIVertices[_0xde0d('0x13')][_0xde0d('0x134')]=function(_0x4a98fe){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x135'),_0x4a98fe[_0xde0d('0xa8')],_0x4a98fe[_0xde0d('0x64')]));if(!this[_0xde0d('0x84')](_0x4a98fe[_0xde0d('0x78')])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0xea'));}var _0x4fca48=_0xde0d('0x136');var _0x5f3294=util[_0xde0d('0x2b')]('%s/recordings/%s',FILES_PATH,rs[_0xde0d('0x11c')](0x4));var _0x5e014b=util[_0xde0d('0x2b')](_0xde0d('0x9d'),_0x5f3294,_0x4fca48);var _0x4b8cec=!![];if(_0x4a98fe['beep']===_0xde0d('0x137')){_0x4b8cec=![];}var _0x3f42ae=this['channel'][_0xde0d('0x138')](_0x5f3294,_0x4fca48,_0x4a98fe['intKey'],_0x4a98fe[_0xde0d('0x64')],undefined,_0x4b8cec);if(_0x3f42ae[_0xde0d('0xa3')]!==-0x1){this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0x139'),_0x5e014b));var _0x9eba3d=this['googleASR'][_0xde0d('0x6d')](this,_0x4a98fe,_0x5e014b);if(_0x9eba3d){for(var _0x5c4f85 in _0x9eba3d){if(_0x9eba3d[_0xde0d('0x94')](_0x5c4f85)){this[_0xde0d('0xe')][_0xde0d('0x9e')](util['format']('GOOGLE_ASR_%s',_0x5c4f85[_0xde0d('0x68')]()),_0x9eba3d[_0x5c4f85]);}}return this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')]('GoogleASR\x20Result\x20%s',JSON[_0xde0d('0x70')](_0x9eba3d)));}}return _0x3f42ae;};AGIVertices[_0xde0d('0x13')][_0xde0d('0x13a')]=function(_0x34a41a){logger['info'](util[_0xde0d('0x2b')](_0xde0d('0x13b'),_0x34a41a[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0x34a41a[_0xde0d('0x8f')])){return this['channel'][_0xde0d('0xaf')](_0xde0d('0x13c'));}if(!this[_0xde0d('0x84')](_0x34a41a[_0xde0d('0x90')])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0x13d'));}var _0x582db8=_0xde0d('0x136');var _0x13539e=util['format'](_0xde0d('0x13e'),FILES_PATH,rs['generate'](0x4));var _0x390856=util[_0xde0d('0x2b')](_0xde0d('0x9d'),_0x13539e,_0x582db8);var _0x5e957f=!![];if(_0x34a41a[_0xde0d('0x13f')]===_0xde0d('0x137')){_0x5e957f=![];}var _0x5f2d64=this[_0xde0d('0xe')][_0xde0d('0x138')](_0x13539e,_0x582db8,_0x34a41a['intKey'],_0x34a41a[_0xde0d('0x64')],undefined,_0x5e957f);if(_0x5f2d64[_0xde0d('0xa3')]!==-0x1){this[_0xde0d('0xe')]['noop'](util[_0xde0d('0x2b')]('tilde\x20%s\x20file\x20created',_0x390856));var _0x33d638=this['tildeASR']['sync'](this,_0x34a41a,_0x390856);if(_0x33d638){for(var _0x262f3d in _0x33d638){if(_0x33d638[_0xde0d('0x94')](_0x262f3d)){this[_0xde0d('0xe')]['setVariable'](util[_0xde0d('0x2b')](_0xde0d('0x140'),_0x262f3d['toUpperCase']()),_0x33d638[_0x262f3d]);}}return this[_0xde0d('0xe')]['noop'](util[_0xde0d('0x2b')](_0xde0d('0x141'),JSON['stringify'](_0x33d638)));}}return _0x5f2d64;};AGIVertices[_0xde0d('0x13')][_0xde0d('0x142')]=function(_0x6117af){logger['info'](util[_0xde0d('0x2b')](_0xde0d('0x143'),_0x6117af['label']));return this[_0xde0d('0xe')][_0xde0d('0x144')](_0x6117af[_0xde0d('0x3c')],_0x6117af['extension'],_0x6117af[_0xde0d('0x3e')]);};AGIVertices[_0xde0d('0x13')][_0xde0d('0x145')]=function(_0x2a0d73){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x146'),_0x2a0d73[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0x2a0d73[_0xde0d('0x147')])){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x2a0d73,_0xde0d('0x148'));}try{var _0x14ebfa=eval(_0x2a0d73[_0xde0d('0x147')])?'true':_0xde0d('0x149');this['channel'][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0x14a'),_0x2a0d73[_0xde0d('0x147')],_0x14ebfa));return{'code':0xc8,'result':_0x14ebfa};}catch(_0x155447){return{'code':0xc8,'result':_0xde0d('0x149')};}};AGIVertices[_0xde0d('0x13')][_0xde0d('0x14b')]=function(_0x30f8f8){logger[_0xde0d('0x2f')](util['format'](_0xde0d('0x14c'),_0x30f8f8['label']));if(!this['isConfigured'](_0x30f8f8[_0xde0d('0x14d')])){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x30f8f8,_0xde0d('0x14e'));}var _0xd2d13b=this[_0xde0d('0x25')][_0xde0d('0x6d')](this,_0x30f8f8[_0xde0d('0x14d')]);if(!_0xd2d13b){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x30f8f8,_0xde0d('0x14f'));}for(var _0x2fff4b=0x0;_0x2fff4b<_0xd2d13b[_0xde0d('0x9b')];_0x2fff4b+=0x1){var _0x4bff7d=this[_0xde0d('0xe')][_0xde0d('0xdb')](util[_0xde0d('0x2b')](_0xde0d('0x150'),_0xd2d13b[_0x2fff4b]));if(_0x4bff7d['result']===-0x1){return _0x4bff7d;}logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')]('IFTIME\x20%s\x20%s',_0xd2d13b[_0x2fff4b],_0x4bff7d[_0xde0d('0xa1')]));if(_0x4bff7d[_0xde0d('0xa1')]===_0xde0d('0x151')){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x152'),_0xd2d13b[_0x2fff4b],_0xde0d('0x151')));this[_0xde0d('0xe')][_0xde0d('0xaf')](util['format'](_0xde0d('0x152'),_0xd2d13b[_0x2fff4b],_0xde0d('0x151')));return{'code':0xc8,'result':'true'};}else{logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x152'),_0xd2d13b[_0x2fff4b],_0xde0d('0x149')));this[_0xde0d('0xe')]['noop'](util[_0xde0d('0x2b')](_0xde0d('0x152'),_0xd2d13b[_0x2fff4b],'false'));}}return{'code':0xc8,'result':_0xde0d('0x149')};};AGIVertices['prototype'][_0xde0d('0x153')]=function(_0x7c8ac4){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')]('Enter\x20in\x20HANGUP\x20(%s)\x20block',_0x7c8ac4[_0xde0d('0xa8')]));return this['channel'][_0xde0d('0x153')]();};AGIVertices[_0xde0d('0x13')][_0xde0d('0x154')]=function(_0x28ec3f){logger[_0xde0d('0x2f')](util['format']('Enter\x20in\x20ISPEECHASR\x20(%s)\x20block',_0x28ec3f['label']));if(!this[_0xde0d('0x84')](_0x28ec3f[_0xde0d('0x78')])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0xea'));}var _0x3a4355=_0xde0d('0x136');var _0x1e789b=util['format']('%s/recordings/%s',FILES_PATH,rs[_0xde0d('0x11c')](0x4));var _0x34ad5e=util[_0xde0d('0x2b')]('%s.%s',_0x1e789b,_0x3a4355);var _0x3bb46d=!![];if(_0x28ec3f['beep']===_0xde0d('0x137')){_0x3bb46d=![];}var _0x21d0e4=this[_0xde0d('0xe')][_0xde0d('0x138')](_0x1e789b,_0x3a4355,_0x28ec3f[_0xde0d('0x155')],_0x28ec3f[_0xde0d('0x64')],undefined,_0x3bb46d);if(_0x21d0e4[_0xde0d('0xa3')]!==-0x1){this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0x156'),_0x34ad5e));var _0x3026c3=this[_0xde0d('0x82')][_0xde0d('0x6d')](this,_0x28ec3f,_0x34ad5e);if(_0x3026c3){for(var _0x2e5694 in _0x3026c3){if(_0x3026c3[_0xde0d('0x94')](_0x2e5694)){this[_0xde0d('0xe')]['setVariable'](util[_0xde0d('0x2b')]('ISPEECH_ASR_%s',_0x2e5694[_0xde0d('0x68')]()),_0x3026c3[_0x2e5694]);}}return this['channel'][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0x157'),JSON['stringify'](_0x3026c3)));}}return _0x21d0e4;};AGIVertices[_0xde0d('0x13')]['ispeechtts']=function(_0x3e56c5){logger[_0xde0d('0x2f')](util['format']('Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block',_0x3e56c5[_0xde0d('0xa8')]));if(!this['isConfigured'](_0x3e56c5[_0xde0d('0x78')])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0xea'));}if(!this[_0xde0d('0x84')](_0x3e56c5[_0xde0d('0x5b')])){return this[_0xde0d('0xe')][_0xde0d('0xaf')]('no\x20text\x20configured');}this[_0xde0d('0xe')][_0xde0d('0xaf')](util['format']('Trying\x20ispeech\x20TTS\x20%s',_0x3e56c5['text']));var _0x1191b4=this[_0xde0d('0x7f')][_0xde0d('0x6d')](this,_0x3e56c5);if(_0x1191b4){this[_0xde0d('0xe')][_0xde0d('0xaf')](util['format'](_0xde0d('0x156'),_0x1191b4));var _0x3fc0c7=this[_0xde0d('0xe')][_0xde0d('0x127')](_0x1191b4,_0x3e56c5[_0xde0d('0x155')]);try{fs[_0xde0d('0x128')](_0x1191b4+'.wav');}catch(_0x3a2718){logger[_0xde0d('0x52')](_0x3a2718);}return _0x3fc0c7;}return this['channel'][_0xde0d('0x52')](_0x3e56c5,_0xde0d('0x158'));};AGIVertices['prototype'][_0xde0d('0x159')]=function(_0x1f533e){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x15a'),_0x1f533e['label']));if(!this['isConfigured'](_0x1f533e['findBy'])){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x1f533e,_0xde0d('0x15b'));}logger['info'](util['format']('FIND\x20AGENT\x20%s\x20BY\x20%s',this[_0xde0d('0xe')][_0xde0d('0x38')],_0x1f533e[_0xde0d('0x15c')]));var _0x4e8d2a=this['agentLogin'][_0xde0d('0x6d')](this,_0x1f533e['findBy']);if(_0x4e8d2a){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this['channel'][_0xde0d('0x38')],_0x1f533e[_0xde0d('0x15c')]));this['channel'][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0x15d'),this[_0xde0d('0xe')]['callerid'],_0x1f533e[_0xde0d('0x15c')]));return{'code':0xc8,'result':'success'};}else{logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x15e'),this[_0xde0d('0xe')][_0xde0d('0x38')],_0x1f533e[_0xde0d('0x15c')]));this['channel'][_0xde0d('0xaf')](util[_0xde0d('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this['channel'][_0xde0d('0x38')],_0x1f533e['findBy']));return{'code':0xc8,'result':'failure'};}};AGIVertices[_0xde0d('0x13')][_0xde0d('0x15f')]=function(_0x4152fc){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x160'),_0x4152fc[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0x4152fc[_0xde0d('0x15c')])){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x4152fc,_0xde0d('0x15b'));}logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x161'),this[_0xde0d('0xe')][_0xde0d('0x38')],_0x4152fc[_0xde0d('0x15c')]));var _0x5a48ab=this['agentLogout'][_0xde0d('0x6d')](this,_0x4152fc[_0xde0d('0x15c')]);if(_0x5a48ab){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x15d'),this['channel'][_0xde0d('0x38')],_0x4152fc[_0xde0d('0x15c')]));this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0x15d'),this[_0xde0d('0xe')][_0xde0d('0x38')],_0x4152fc[_0xde0d('0x15c')]));return{'code':0xc8,'result':_0xde0d('0x162')};}else{logger[_0xde0d('0x2f')](util['format'](_0xde0d('0x15e'),this[_0xde0d('0xe')][_0xde0d('0x38')],_0x4152fc[_0xde0d('0x15c')]));this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')]('AGENT\x20%s\x20NOT\x20FOUND\x20BY',this[_0xde0d('0xe')][_0xde0d('0x38')],_0x4152fc[_0xde0d('0x15c')]));return{'code':0xc8,'result':_0xde0d('0x163')};}};AGIVertices[_0xde0d('0x13')][_0xde0d('0x164')]=function(_0x41a902){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')]('Enter\x20in\x20MATH\x20(%s)\x20block',_0x41a902['label']));if(!this[_0xde0d('0x84')](_0x41a902[_0xde0d('0x165')])){return this['channel'][_0xde0d('0x52')](_0x41a902,_0xde0d('0x166'));}this[_0xde0d('0xe')][_0xde0d('0xaf')](util['format'](_0xde0d('0x167'),_0x41a902[_0xde0d('0x165')]));var _0x20481b=eval(_0x41a902['operation']);if(!this[_0xde0d('0x84')](_0x41a902['variable_id'])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0xda'));}var _0x2ae44b=this[_0xde0d('0xdb')][_0xde0d('0x6d')](this,_0x41a902['variable_id']);if(!_0x2ae44b){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x41a902,_0xde0d('0xdc'));}if(_[_0xde0d('0x9a')](_0x20481b)){var _0x5387b6=this;_0x20481b[_0xde0d('0xdd')](function(_0x6195f4,_0x58bea6){_0x5387b6[_0xde0d('0xe')][_0xde0d('0x9e')](util[_0xde0d('0x2b')](_0xde0d('0x168'),_0x2ae44b,_0x58bea6),_0x6195f4);});return this[_0xde0d('0xe')]['noop'](util['format'](_0xde0d('0x169'),_0x2ae44b));}else{return this['channel'][_0xde0d('0x9e')](_0x2ae44b,_0x20481b);}};AGIVertices['prototype']['menu']=function(_0x1c0bfc){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x16a'),_0x1c0bfc[_0xde0d('0xa8')]));if(_0x1c0bfc[_0xde0d('0xa5')]===0x0){return this[_0xde0d('0xa4')](_0x1c0bfc);}_0x1c0bfc['retry']-=0x1;if(!this[_0xde0d('0x84')](_0x1c0bfc[_0xde0d('0x116')])){return this['channel']['error'](_0x1c0bfc,_0xde0d('0x115'));}var _0x424339=this['getSound'][_0xde0d('0x6d')](this,_0x1c0bfc[_0xde0d('0x116')]);if(!_0x424339){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x1c0bfc,_0xde0d('0x117'));}var _0x1369ef=this['channel']['getData'](_0x424339,_0x1c0bfc['response'],_0x1c0bfc[_0xde0d('0x16b')]);var _0x2a0795=_0x1369ef['result'];if(_0x1369ef[_0xde0d('0xa3')]===-0x1){this[_0xde0d('0x35')][_0xde0d('0x6d')](this,_0x1c0bfc,'-1');return _0x1369ef;}else if(_0x1369ef['extra']===_0xde0d('0x64')){_0x1369ef[_0xde0d('0xa3')]=_0x1369ef['result']['length']>0x0?_0x1369ef['result']:'t';}else if(_[_0xde0d('0x43')](_0x1369ef['result'])){_0x1369ef[_0xde0d('0xa3')]='#';_0x2a0795='#';}if(!this[_0xde0d('0x84')](_0x1c0bfc[_0xde0d('0xd9')])){this['channel'][_0xde0d('0xaf')](_0xde0d('0xda'));}else{var _0x24576a=this[_0xde0d('0xdb')][_0xde0d('0x6d')](this,_0x1c0bfc[_0xde0d('0xd9')]);if(!_0x24576a){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x1c0bfc,_0xde0d('0xdc'));}this[_0xde0d('0xe')][_0xde0d('0x9e')](_0x24576a,_0x2a0795);}this[_0xde0d('0x35')]['sync'](this,_0x1c0bfc,_0x2a0795);return _0x1369ef;};AGIVertices[_0xde0d('0x13')]['noop']=function(_0x2db383){logger['info'](util[_0xde0d('0x2b')](_0xde0d('0x16c'),_0x2db383['label']));return this['channel'][_0xde0d('0xaf')](_0x2db383[_0xde0d('0x16d')]||_0x2db383[_0xde0d('0xa8')]);};AGIVertices[_0xde0d('0x13')]['pause']=function(_0x413d8c){logger['info'](util[_0xde0d('0x2b')](_0xde0d('0x16e'),_0x413d8c['label']));if(!this[_0xde0d('0x84')](_0x413d8c[_0xde0d('0x15c')])){return this['channel'][_0xde0d('0x52')](_0x413d8c,_0xde0d('0x15b'));}logger['info'](util[_0xde0d('0x2b')](_0xde0d('0x161'),this[_0xde0d('0xe')][_0xde0d('0x38')],_0x413d8c['findBy']));var _0x11b313=this[_0xde0d('0x4e')][_0xde0d('0x6d')](this,_0x413d8c['pause_id']);var _0x36d5b8=this[_0xde0d('0x4f')][_0xde0d('0x6d')](this,_0x413d8c[_0xde0d('0x15c')],_0x11b313);if(_0x36d5b8){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xde0d('0xe')]['callerid'],_0x413d8c[_0xde0d('0x15c')]));this[_0xde0d('0xe')]['noop'](util['format'](_0xde0d('0x15d'),this['channel']['callerid'],_0x413d8c[_0xde0d('0x15c')]));return{'code':0xc8,'result':'success'};}else{logger[_0xde0d('0x2f')](util['format'](_0xde0d('0x15e'),this['channel'][_0xde0d('0x38')],_0x413d8c[_0xde0d('0x15c')]));this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0x15d'),this['channel'][_0xde0d('0x38')],_0x413d8c['findBy']));return{'code':0xc8,'result':_0xde0d('0x163')};}};AGIVertices['prototype']['playback']=function(_0x1949c5){logger[_0xde0d('0x2f')](util['format'](_0xde0d('0x16f'),_0x1949c5[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0x1949c5[_0xde0d('0x116')])){return this[_0xde0d('0xe')]['error'](_0x1949c5,_0xde0d('0x115'));}var _0x1ca7ec=this[_0xde0d('0x20')]['sync'](this,_0x1949c5[_0xde0d('0x116')]);if(!_0x1ca7ec){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x1949c5,_0xde0d('0x117'));}var _0x52c30f=this[_0xde0d('0xe')][_0xde0d('0x57')](_0xde0d('0x170'),[_0x1ca7ec,_0x1949c5[_0xde0d('0xe7')]]);if(_0x52c30f[_0xde0d('0xa3')]===-0x1){return _0x52c30f;}return this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0xc4'),'PLAYBACK',_0x1ca7ec));};AGIVertices['prototype'][_0xde0d('0x171')]=function(_0x42f107){logger[_0xde0d('0x2f')](util['format'](_0xde0d('0x172'),_0x42f107[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0x42f107[_0xde0d('0x173')])){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x42f107,'no\x20queue\x20selected');}var _0x3f3d0b='';var _0x2adebd=parseInt(_0x42f107[_0xde0d('0x173')],0xa);if(isNaN(_0x2adebd)){_0x3f3d0b=_0x42f107['queue_id'];}else{_0x3f3d0b=this['getVoiceQueue']['sync'](this,_0x42f107[_0xde0d('0x173')]);if(!_0x3f3d0b){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x42f107,_0xde0d('0x174'));}}var _0x3cafc5='';if(this[_0xde0d('0x84')](_0x42f107[_0xde0d('0x116')])){var _0x247f5f=this[_0xde0d('0x20')][_0xde0d('0x6d')](this,_0x42f107[_0xde0d('0x116')]);if(_0x247f5f){_0x3cafc5=_0x247f5f;}}this['createSquareDetailsReport']['sync'](this,_0x42f107,_0x3f3d0b);if(_0x42f107[_0xde0d('0xe7')][_0xde0d('0x175')]('x')<0x0){_0x42f107[_0xde0d('0xe7')]+='x';}if(_0x42f107[_0xde0d('0xe7')][_0xde0d('0x175')]('X')<0x0){_0x42f107[_0xde0d('0xe7')]+='X';}this[_0xde0d('0xe')]['setVariable'](_0xde0d('0x176'),_0x3f3d0b?_0x3f3d0b['toLowerCase']():'');var _0x35b7ba=this[_0xde0d('0xe')][_0xde0d('0x57')](_0xde0d('0x177'),[_0x3f3d0b,_0x42f107[_0xde0d('0xe7')],_0x42f107[_0xde0d('0x63')],_0x3cafc5,_0x42f107['timeout'],_0x42f107[_0xde0d('0xb8')],_0x42f107['macro'],_0x42f107[_0xde0d('0x178')],'',_0x42f107[_0xde0d('0x179')]]);if(_0x35b7ba['result']===-0x1){return _0x35b7ba;}return this[_0xde0d('0xe')][_0xde0d('0xaf')](util['format'](_0xde0d('0xc4'),_0xde0d('0x177'),_0x3f3d0b));};AGIVertices[_0xde0d('0x13')][_0xde0d('0x17a')]=function(_0x1e41f2){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')]('Enter\x20in\x20RECORD\x20(%s)\x20block',_0x1e41f2[_0xde0d('0xa8')]));var _0x1470ac=_0x1e41f2[_0xde0d('0x17b')]||_0xde0d('0x136');var _0x4c9fd9=util[_0xde0d('0x2b')](_0xde0d('0x17c'),this[_0xde0d('0xe')][_0xde0d('0x3a')],rs[_0xde0d('0x11c')](0x5));var _0x15478f=util[_0xde0d('0x2b')](_0xde0d('0x17d'),FILES_PATH,_0x4c9fd9,_0x1470ac);var _0x233bfc=util[_0xde0d('0x2b')]('%s/recordings/%s',FILES_PATH,_0x4c9fd9);this[_0xde0d('0x39')][_0xde0d('0x6d')](this,_0x1e41f2,_0x4c9fd9,_0x15478f);this[_0xde0d('0xe')][_0xde0d('0x9e')]('RECORDING_SAVENAME',_0x4c9fd9);logger['info'](_0xde0d('0x17e'),_0x233bfc,_0x1470ac,_0x1e41f2['escape_digits'],_0x1e41f2[_0xde0d('0x64')]);return this['channel'][_0xde0d('0x138')](_0x233bfc,_0x1470ac,_0x1e41f2[_0xde0d('0x17f')],_0x1e41f2[_0xde0d('0x64')],undefined,!![]);};AGIVertices[_0xde0d('0x13')][_0xde0d('0x180')]=function(_0x25563b){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x181'),_0x25563b[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0x25563b[_0xde0d('0x63')])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0x182'));}var _0x22abbf=this[_0xde0d('0x183')]['sync'](this,_0x25563b);logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')]('Response:',util['inspect'](_0x22abbf,{'showHidden':![],'depth':null})));if(!this[_0xde0d('0x84')](_0x25563b['variable_id'])){return this[_0xde0d('0xe')]['noop'](_0xde0d('0x184'));}var _0xe49e18=this[_0xde0d('0xdb')][_0xde0d('0x6d')](this,_0x25563b[_0xde0d('0xd9')]);if(!_0xe49e18){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x25563b,_0xde0d('0xdc'));}this[_0xde0d('0xe')][_0xde0d('0x9e')](util[_0xde0d('0x2b')](_0xde0d('0x185'),_0xe49e18),_0x22abbf[_0xde0d('0x72')]?_0x22abbf['statusCode']:'200');this['channel'][_0xde0d('0x9e')](util[_0xde0d('0x2b')](_0xde0d('0x186'),_0xe49e18),_0x22abbf['statusMessage']?_0x22abbf[_0xde0d('0x73')]:'OK');if(_0x22abbf[_0xde0d('0x69')]){try{this[_0xde0d('0x9c')](_0x22abbf['body'],_0xe49e18);}catch(_0x726d87){logger[_0xde0d('0x52')](util['format']('Unable\x20to\x20set\x20result\x20in\x20variable\x20%s',_0xe49e18));}}return this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0xe1'),_0xe49e18));};AGIVertices[_0xde0d('0x13')][_0xde0d('0x187')]=function(_0x5cf92e){logger[_0xde0d('0x2f')](util['format']('Enter\x20in\x20SAYDIGITS\x20(%s)\x20block',_0x5cf92e[_0xde0d('0xa8')]));return this[_0xde0d('0xe')][_0xde0d('0x188')](_0x5cf92e[_0xde0d('0x189')]['replace'](/\s+/g,''),_0x5cf92e['escape_digits']);};AGIVertices[_0xde0d('0x13')][_0xde0d('0x18a')]=function(_0x1411fa){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')]('Enter\x20in\x20SAYNUMBER\x20(%s)\x20block',_0x1411fa[_0xde0d('0xa8')]));return this['channel'][_0xde0d('0x18b')](_0x1411fa['number'][_0xde0d('0xd7')](/\s+/g,''),_0x1411fa[_0xde0d('0x17f')]);};AGIVertices[_0xde0d('0x13')][_0xde0d('0x18c')]=function(_0x45c42a){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x18d'),_0x45c42a[_0xde0d('0xa8')]));return this[_0xde0d('0xe')][_0xde0d('0x18e')](_0x45c42a[_0xde0d('0x5b')],_0x45c42a[_0xde0d('0x17f')]);};AGIVertices[_0xde0d('0x13')]['sendMail']=function(_0x519a1f){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x18f'),_0x519a1f['label']));if(!this['isConfigured'](_0x519a1f['account_id'])){return this[_0xde0d('0xe')]['noop'](_0xde0d('0x190'));}var _0x1b68d2=this[_0xde0d('0x191')]['sync'](this,_0x519a1f[_0xde0d('0x192')]);if(!_0x1b68d2||!_0x1b68d2[_0xde0d('0x193')]){return this['channel'][_0xde0d('0x52')](_0x519a1f,'no\x20mail\x20account\x20found');}var _0x6e6649={'from':util[_0xde0d('0x2b')](_0xde0d('0x194'),_0x1b68d2[_0xde0d('0x12')],_0x1b68d2[_0xde0d('0x195')]||_0x1b68d2[_0xde0d('0x193')][_0xde0d('0x196')]),'to':_0x519a1f['to']||'','cc':_0x519a1f['cc']||'','bcc':_0x519a1f[_0xde0d('0x197')]||'','subject':_0x519a1f[_0xde0d('0x198')],'html':_0x519a1f[_0xde0d('0x5b')],'text':_0x519a1f['text']};if(this['isConfigured'](_0x519a1f[_0xde0d('0x199')])){}logger['debug']('sendMail\x20message',JSON[_0xde0d('0x70')](_0x6e6649));this[_0xde0d('0x35')]['sync'](this,_0x519a1f,_0x519a1f[_0xde0d('0x192')]);this['channel'][_0xde0d('0xaf')](util[_0xde0d('0x2b')]('Trying\x20SendMail\x20with\x20account\x20%s',_0x1b68d2[_0xde0d('0x12')]));this['sendMailMessage']['sync'](this,_0x1b68d2['smtpOptions'],_0x6e6649);return this['channel'][_0xde0d('0xaf')]('Mail\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xde0d('0x13')][_0xde0d('0x19a')]=function(_0x368d68){logger['info'](util[_0xde0d('0x2b')](_0xde0d('0x19b'),_0x368d68[_0xde0d('0xa8')]));return this[_0xde0d('0xe')][_0xde0d('0xaf')]('SENDFAX\x20block\x20not\x20implemented');};AGIVertices['prototype']['sendSMS']=function(_0x5f2b4f){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x19c'),_0x5f2b4f[_0xde0d('0xa8')]));if(!this[_0xde0d('0x84')](_0x5f2b4f[_0xde0d('0x19d')])){return this[_0xde0d('0xe')][_0xde0d('0xaf')]('no\x20sms\x20account\x20configured');}var _0x4d5b61=this[_0xde0d('0x32')]['sync'](this,_0x5f2b4f['sms_account_id']);if(!_0x4d5b61){return this[_0xde0d('0xe')]['error'](_0x5f2b4f,_0xde0d('0x19e'));}var _0x250b49={'body':_0x5f2b4f[_0xde0d('0x19f')],'phone':_0x5f2b4f['to']||'','SmsAccountId':_0x4d5b61['id']};logger['debug']('sendSMS\x20message',JSON[_0xde0d('0x70')](_0x250b49));this[_0xde0d('0x35')][_0xde0d('0x6d')](this,_0x5f2b4f,_0x5f2b4f['sms_account_id']);this[_0xde0d('0xe')][_0xde0d('0xaf')](util['format'](_0xde0d('0x1a0'),_0x4d5b61[_0xde0d('0x12')]));this[_0xde0d('0x34')][_0xde0d('0x6d')](this,_0x250b49);return this[_0xde0d('0xe')][_0xde0d('0xaf')]('Sms\x20message\x20added\x20to\x20outgoing\x20process');};AGIVertices[_0xde0d('0x13')][_0xde0d('0x1a1')]=function(_0x46f35c){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x1a2'),_0x46f35c[_0xde0d('0xa8')]));if(!this['isConfigured'](_0x46f35c['variable_id'])){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x46f35c,_0xde0d('0x1a3'));}var _0xc2c475=this[_0xde0d('0xdb')][_0xde0d('0x6d')](this,_0x46f35c[_0xde0d('0xd9')]);if(!_0xc2c475){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x46f35c,_0xde0d('0xdc'));}return this[_0xde0d('0xe')][_0xde0d('0x9e')](_0xc2c475,_0x46f35c['variable_value']);};AGIVertices[_0xde0d('0x13')][_0xde0d('0x1a4')]=function(_0x36c136){logger['info'](util[_0xde0d('0x2b')]('Enter\x20in\x20START\x20(%s)\x20block',_0x36c136[_0xde0d('0xa8')]));this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0x1a5'));if(_0x36c136['answer']===_0xde0d('0x1a6')){this['channel'][_0xde0d('0xaf')](_0xde0d('0x1a7'));return this[_0xde0d('0xe')]['answer']();}return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0x1a8'));};AGIVertices[_0xde0d('0x13')][_0xde0d('0x1a9')]=function(_0x317935){logger['info'](util['format']('Enter\x20in\x20SUBPROJECT\x20(%s)\x20block',_0x317935[_0xde0d('0xa8')]));if(!this['isConfigured'](_0x317935[_0xde0d('0x1aa')])){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x317935,'no\x20subproject\x20selected');}var _0x12efb0=this['getSquareProject'][_0xde0d('0x6d')](this,_0x317935[_0xde0d('0x1aa')]);if(!this[_0xde0d('0x84')](_0x12efb0)){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x317935,util[_0xde0d('0x2b')](_0xde0d('0x1ab'),_0x317935[_0xde0d('0x1aa')]));}if(_0x12efb0===this[_0xde0d('0xe')][_0xde0d('0x37')]){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x317935,_0xde0d('0x1ac'));}this['createSquareDetailsReport'][_0xde0d('0x6d')](this,_0x317935,_0x12efb0);var _0x3de9b7=this[_0xde0d('0xe')][_0xde0d('0x57')](_0xde0d('0x1ad'),util['format'](_0xde0d('0x1ae'),config[_0xde0d('0xb8')][_0xde0d('0x1af')]||'127.0.0.1',_0x12efb0,this[_0xde0d('0xe')][_0xde0d('0x37')]));if(_0x3de9b7[_0xde0d('0xa3')]===-0x1){return _0x3de9b7;}return this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0xc4'),_0xde0d('0x1ad'),_0x12efb0));};AGIVertices[_0xde0d('0x13')][_0xde0d('0x1b0')]=function(_0x20fd6b){logger[_0xde0d('0x2f')](util['format'](_0xde0d('0x1b1'),_0x20fd6b[_0xde0d('0xa8')]));var _0x1d071b=this['shellCommand'][_0xde0d('0x6d')](this,_0x20fd6b[_0xde0d('0x1b2')]);this[_0xde0d('0x35')][_0xde0d('0x6d')](this,_0x20fd6b,_0x20fd6b[_0xde0d('0x1b2')]);if(this['isConfigured'](_0x20fd6b[_0xde0d('0xd9')])){var _0x32a92c=this[_0xde0d('0xdb')][_0xde0d('0x6d')](this,_0x20fd6b[_0xde0d('0xd9')]);if(_0x32a92c){this['channel'][_0xde0d('0x9e')](_0x32a92c,_0x1d071b);return this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0x1b3'),_0x20fd6b[_0xde0d('0x1b2')],_0x32a92c));}}return this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0x1b4'),_0x20fd6b[_0xde0d('0x1b2')]));};AGIVertices[_0xde0d('0x13')][_0xde0d('0x1b5')]=function(_0x4feadc){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')]('Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block',_0x4feadc[_0xde0d('0xa8')]));_0x4feadc[_0xde0d('0x5b')]=_0x4feadc[_0xde0d('0x5b')][_0xde0d('0xd7')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xde0d('0x84')](_0x4feadc['apiKey'])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0x1b6'));}if(!this[_0xde0d('0x84')](_0x4feadc['text'])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0xa9'));}this[_0xde0d('0xe')]['noop'](util[_0xde0d('0x2b')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x4feadc[_0xde0d('0x5b')]));var _0x1fb938=this[_0xde0d('0x58')]['sync'](this,_0x4feadc);if(_0x1fb938){this['channel'][_0xde0d('0xaf')](util['format'](_0xde0d('0x1b7'),_0x1fb938));var _0x27bafd=this[_0xde0d('0xe')][_0xde0d('0x127')](_0x1fb938);try{fs['unlink'](_0x1fb938+_0xde0d('0x129'));}catch(_0x2b26e8){logger[_0xde0d('0x52')](_0x2b26e8);}return _0x27bafd;}return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x4feadc,_0xde0d('0x1b8'));};AGIVertices[_0xde0d('0x13')]['tts']=function(_0x42591e){logger['info'](util[_0xde0d('0x2b')](_0xde0d('0x1b9'),_0x42591e[_0xde0d('0xa8')]));_0x42591e['text']=_0x42591e[_0xde0d('0x5b')]['replace'](/(\r\n|\n|\r)/gm,'\x20');if(!this['isConfigured'](_0x42591e['text'])){return this[_0xde0d('0xe')][_0xde0d('0xaf')](_0xde0d('0xa9'));}this[_0xde0d('0xe')][_0xde0d('0xaf')](util[_0xde0d('0x2b')](_0xde0d('0x1ba'),_0x42591e[_0xde0d('0x5b')]));var _0x2ae97d=this['googleTTS']['sync'](this,_0x42591e);if(_0x2ae97d){this['channel'][_0xde0d('0xaf')](util[_0xde0d('0x2b')]('Google\x20TTS\x20%s\x20file\x20created',_0x2ae97d));var _0x584ef7=this[_0xde0d('0xe')][_0xde0d('0x127')](_0x2ae97d);try{fs[_0xde0d('0x128')](_0x2ae97d+_0xde0d('0x129'));}catch(_0x5914a3){logger[_0xde0d('0x52')](_0x5914a3);}return _0x584ef7;}return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x42591e,'Google\x20TTS\x20is\x20unreachable');};AGIVertices['prototype'][_0xde0d('0x1bb')]=function(_0x2cb65d){logger['info'](util[_0xde0d('0x2b')](_0xde0d('0x1bc'),_0x2cb65d['label']));if(!this['isConfigured'](_0x2cb65d['findBy'])){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x2cb65d,'no\x20find\x20by\x20configured');}logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x161'),this['channel'][_0xde0d('0x38')],_0x2cb65d['findBy']));var _0x360003=this[_0xde0d('0x51')]['sync'](this,_0x2cb65d[_0xde0d('0x15c')]);if(_0x360003){logger[_0xde0d('0x2f')](util['format']('AGENT\x20%s\x20FOUND\x20BY',this['channel']['callerid'],_0x2cb65d['findBy']));this[_0xde0d('0xe')][_0xde0d('0xaf')](util['format'](_0xde0d('0x15d'),this['channel'][_0xde0d('0x38')],_0x2cb65d[_0xde0d('0x15c')]));return{'code':0xc8,'result':_0xde0d('0x162')};}else{logger[_0xde0d('0x2f')](util['format'](_0xde0d('0x15e'),this['channel']['callerid'],_0x2cb65d['findBy']));this[_0xde0d('0xe')]['noop'](util[_0xde0d('0x2b')](_0xde0d('0x15e'),this['channel'][_0xde0d('0x38')],_0x2cb65d[_0xde0d('0x15c')]));return{'code':0xc8,'result':_0xde0d('0x163')};}};AGIVertices[_0xde0d('0x13')][_0xde0d('0x1bd')]=function(_0x3c7006){logger[_0xde0d('0x2f')](util[_0xde0d('0x2b')](_0xde0d('0x1be'),_0x3c7006[_0xde0d('0xa8')]));var _0x17332f=this[_0xde0d('0xe')][_0xde0d('0x57')](_0xde0d('0x1bf'),[_0x3c7006[_0xde0d('0x1c0')],_0x3c7006[_0xde0d('0x76')]]);if(_0x17332f['result']===-0x1){return _0x17332f;}return this[_0xde0d('0xe')]['noop'](util[_0xde0d('0x2b')](_0xde0d('0xc4'),_0xde0d('0x1bf'),_0x3c7006['mailbox']));};AGIVertices[_0xde0d('0x13')][_0xde0d('0x1c1')]=function(_0x1809ad){logger['info'](util[_0xde0d('0x2b')](_0xde0d('0x1c2'),_0x1809ad['label']));if(!this[_0xde0d('0x84')](_0x1809ad[_0xde0d('0xd9')])){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x1809ad,_0xde0d('0x1a3'));}var _0x24363c=this[_0xde0d('0xdb')][_0xde0d('0x6d')](this,_0x1809ad[_0xde0d('0xd9')]);if(!_0x24363c){return this[_0xde0d('0xe')][_0xde0d('0x52')](_0x1809ad,_0xde0d('0xdc'));}var _0x473049=this[_0xde0d('0xe')][_0xde0d('0xdb')](_0x24363c);return{'code':0xc8,'result':_0x473049[_0xde0d('0xa1')]?_0x473049['extra']:'-'};};String[_0xde0d('0x13')]['replaceAll']=function(_0x288dbf,_0x2269b3){return this['split'](_0x288dbf)[_0xde0d('0x1c3')](_0x2269b3);};module[_0xde0d('0x1c4')]=AGIVertices; \ No newline at end of file +var _0x138d=['getTrunk','getTrunkById','getSoundPath','save_name','sendMailMessage','mailRpc','IntervalId','map','interval','format','%s/sounds/converted/%s','error','Error\x20getting\x20ODBC\x20connection\x20%s','info','ODBC\x20connection\x20successfully','query','Query\x20executed\x20correctly\x20%s','close','getSmsAccountById','createSmsMessage','createSquareDetailsReport','channel','uniqueid','label','agicommand','arg_1','callerid','createSquareRecording','context','extension','dnid','createSquareMessage','createCmContact','isEmpty','callback_','random','isNil','lastName','phone','list_id','scheduledAt','callback','getPause','getPauseById','agentPause','agent','agentUnpause','agentLogin','internal','LOCAL','shellCommand','exec','trim','googleCloudTTS','apiKey','google_cloud_tts_text_type','text','languageCode','en-US','audioEncoding','MP3','google_tts_language','restAPI','url','method','number','timeout','includes','POST','body','parse','headers','An\x20incorrect\x20formatted\x20json\x20headers\x20has\x20been\x20passed\x20to\x20the\x20function','computedVariables','sync','uri','render','stringify','An\x20incorrect\x20formatted\x20json\x20has\x20been\x20passed\x20to\x20the\x20function','statusCode','statusMessage','message','options','googleDialogflow','dialogflow_language','googleDialogflowV2','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_region','Amy','aws_text_type','awsLex','googleASR','google_asr_language','tildeASR','appid','appsecret','clear','clone','hasOwnProperty','replaceObjectAllVariables','recursiveNodeIndex','isPlainObject','isArray','length','isString','replaceAllVariables','saveRestApiResult','%s.%s','setVariable','split','replaceAll','extra','toString','getAndSetVariable','result','maxRetry','mrcpsynth','Enter\x20in\x20MRCPSynth\x20(%s)\x20block','no\x20text\x20configured','MRCPSynth','noop','Executed\x20command\x20MRCPSynth\x20%s','mrcprecog','Enter\x20in\x20MRCPRecog\x20(%s)\x20block','grammar','no\x20grammar\x20configured','RECOG_CONFIDENCE()','MRCP_RECOG_TRANSCRIPT','RECOG_INSTANCE()','MRCP_RECOG_INSTANCE','Executed\x20command\x20MRCPRecog\x20%s','Enter\x20in\x20AGI\x20(%s)\x20block','agi','command','answer','Enter\x20in\x20ANSWER\x20(%s)\x20block','Wait\x20%s\x20seconds\x20before\x20answer','wait','Enter\x20in\x20CALLBACK\x20(%s)\x20block','no\x20list\x20selected','delay','add','callback_priority','CALLBACK\x20added\x20phone:\x20%s\x20on\x20list:\x20%s\x20at\x20%s','application','Executed\x20command\x20%s\x20%s','lumenvoxtts','Enter\x20in\x20LUMENVOXTTS\x20(%s)\x20block','sestektts','lumenvoxasr','MRCPRecog','RECOG_INPUT()','LUMENVOX_ASR_TRANSCRIPT','LUMENVOX_ASR_INSTANCE','sestekasr','SESTEK_ASR_CONFIDENCE','SESTEK_ASR_TRANSCRIPT','SESTEK_ASR_INSTANCE','database','Enter\x20in\x20DATABASE\x20(%s)\x20block','odbc_id','no\x20database\x20selected','no\x20query\x20configured','replace','query:\x20%s','getQueryOdbc','variable_id','no\x20variable\x20selected\x20for\x20the\x20result','no\x20variable\x20found','forEach','%s[%s][%s]','%s_ROWS_COUNT','Enter\x20in\x20DIAL\x20(%s)\x20block','sip_id','getUser','no\x20user\x20found','SIP/%s','opts','Executed\x20command\x20%s','DIAL','Enter\x20in\x20DIALOGFLOW\x20(%s)\x20block','no\x20key\x20configured','bot','Trying\x20Dialogflow:\x20%s','speech','out','dialogflow','Dialogflow\x20is\x20unreachable','dialogflowV2','Enter\x20in\x20DIALOGFLOW\x20V2\x20(%s)\x20block','no\x20private_key\x20configured','no\x20anguage\x20configured','Trying\x20DialogflowV2:\x20%s','DIALOGFLOW_%s','toUpperCase','providerResponse','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','audiofile','unlink','.wav','SestekNDA\x20Result\x20%s','SestekNDA\x20is\x20unreachable','Enter\x20in\x20END\x20(%s)\x20block','end','ext_dial','Enter\x20in\x20EXTERNAL\x20DIAL\x20(%s)\x20block','trunk_id','no\x20trunk\x20found','trunk_name','no\x20trunk\x20selected','SIP/%s/%s','finally','Enter\x20in\x20FINALLY\x20(%s)\x20block','getdigits','Enter\x20in\x20GETDIGITS\x20(%s)\x20block','retry','no\x20file\x20audio\x20selected','getSound','file_id','no\x20file\x20audio\x20found','getData','response','test','mindigit','hiddendigitsnum','hiddendigitspos','first','substr','generate','Enter\x20in\x20GETSECRETDIGITS\x20(%s)\x20block','goal','goalname','GOAL\x20%s','no\x20valid\x20credentials\x20configured','Trying\x20aws\x20Polly\x20%s','aws\x20Polly\x20%s\x20file\x20created','streamFile','aws\x20Polly\x20is\x20unreachable','awslex','Enter\x20in\x20Amazon\x20Lex\x20(%s)\x20block','aws_bot_name','no\x20bot\x20name\x20configured','Trying\x20Amazon\x20Lex:\x20%s','Amazon\x20Lex\x20ready\x20for\x20fulfillment','Amazon\x20Lex\x20is\x20unreachable','googleasr','Enter\x20in\x20GOOGLEASR\x20(%s)\x20block\x20%s','wav','%s/recordings/%s','NOBEEP','recordFile','GOOGLE_ASR_%s','GoogleASR\x20Result\x20%s','tildeasr','Enter\x20in\x20TILDEASR\x20(%s)\x20block','no\x20appid\x20configured','no\x20appsecret\x20configured','beep','intKey','tilde\x20%s\x20file\x20created','TildeASR\x20Result\x20%s','Enter\x20in\x20GOTO\x20(%s)\x20block','continueAt','priority','gotoif','Enter\x20in\x20GOTOIF\x20(%s)\x20block','condition','no\x20condition\x20configured','true','EVAL\x20CONDITION\x20%s\x20%s','false','Enter\x20in\x20GOTOIFTIME\x20(%s)\x20block','interval_id','no\x20interval\x20configured','getIntervals','no\x20intervals\x20found','IFTIME\x20%s\x20%s','Enter\x20in\x20HANGUP\x20(%s)\x20block','hangup','ispeechasr','Enter\x20in\x20ISPEECHASR\x20(%s)\x20block','ispeech\x20%s\x20file\x20created','ISPEECH_ASR_%s','IspeechASR\x20Result\x20%s','ispeechtts','Enter\x20in\x20ISPEECHTTS\x20(%s)\x20block','Trying\x20ispeech\x20TTS\x20%s','ispeech\x20TTS\x20is\x20unreachable','login','Enter\x20in\x20LOGIN\x20(%s)\x20block','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','Enter\x20in\x20MATH\x20(%s)\x20block','no\x20operation\x20configured','math\x20%s','operation','%s[%s]','variable\x20%s[key]\x20set','Enter\x20in\x20MENU\x20(%s)\x20block','digit','Enter\x20in\x20NOOP\x20(%s)\x20block','output','pause','Enter\x20in\x20PAUSE\x20(%s)\x20block','FIND\x20AGENT\x20%s\x20BY\x20%s','pause_id','Enter\x20in\x20PLAYBACK\x20(%s)\x20block','PLAYBACK','Enter\x20in\x20QUEUE\x20(%s)\x20block','no\x20queue\x20selected','queue_id','no\x20queue\x20found','indexOf','toLowerCase','macro','gosub','QUEUE','record','Enter\x20in\x20RECORD\x20(%s)\x20block','recordingFormat','%s_%s','RECORDING_SAVENAME','escape_digits','restapi','Enter\x20in\x20RESTAPI\x20(%s)\x20block','Response:','inspect','no\x20variable\x20selected\x20for\x20the\x20response','%s_STATUS_CODE','200','%s_STATUS_MESSAGE','Unable\x20to\x20set\x20result\x20in\x20variable\x20%s','variable\x20%s\x20set','saydigits','Enter\x20in\x20SAYDIGITS\x20(%s)\x20block','sayDigits','digits','saynumber','Enter\x20in\x20SAYNUMBER\x20(%s)\x20block','sayNumber','sayphonetic','Enter\x20in\x20SAYPHONETIC\x20(%s)\x20block','sayPhonetic','Enter\x20in\x20SENDMAIL\x20(%s)\x20block','account_id','no\x20mail\x20account\x20configured','Smtp','\x22%s\x22\x20<%s>','email','user','bcc','debug','sendMail\x20message','smtpOptions','Mail\x20message\x20added\x20to\x20outgoing\x20process','Enter\x20in\x20SENDFAX\x20(%s)\x20block','SENDFAX\x20block\x20not\x20implemented','Enter\x20in\x20SENDSMS\x20(%s)\x20block','no\x20sms\x20account\x20configured','getSmsAccount','sms_account_id','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','Enter\x20in\x20START\x20(%s)\x20block','yes','Answer','Skipped\x20Answer','subproject','Enter\x20in\x20SUBPROJECT\x20(%s)\x20block','no\x20subproject\x20selected','getSquareProject','project_id','no\x20subproject\x20found\x20with\x20id\x20%d','project\x20in\x20subproject\x20must\x20be\x20different\x20from\x20the\x20called\x20project','AGI','agi://%s/square,\x22%s\x22,\x22%s\x22','host','system','sh\x20command:\x20%s\x20result\x20on\x20variable:\x20%s','Enter\x20in\x20Google\x20Cloud\x20TTS\x20(%s)\x20block','no\x20apiKey\x20configured','Google\x20Cloud\x20TTS\x20%s\x20file\x20created','Google\x20Cloud\x20TTS\x20is\x20unreachable','tts','googleTTS','Google\x20TTS\x20%s\x20file\x20created','unpause','Enter\x20in\x20UNPAUSE\x20(%s)\x20block','Enter\x20in\x20VOICEMAIL\x20(%s)\x20block','mailbox','VOICEMAIL','vswitch','Enter\x20in\x20SWITCH\x20(%s)\x20block','exports','util','lodash','odbc','randomstring','moment','mustache','request-promise','../../config/logger','../../config/environment','../../config/environment/shared','./scripts','rawHeaders','rawBody','menu','rpc','getVariable','then','name','catch','prototype','getVoiceQueue','getVoiceQueueById','getSquareProjectById','getSquareOdbc','getSquareOdbcById'];(function(_0x3050ca,_0x3e36b0){var _0x1eed1d=function(_0x195e8f){while(--_0x195e8f){_0x3050ca['push'](_0x3050ca['shift']());}};_0x1eed1d(++_0x3e36b0);}(_0x138d,0x1ab));var _0xd138=function(_0x42c118,_0x197006){_0x42c118=_0x42c118-0x0;var _0x112ebd=_0x138d[_0x42c118];return _0x112ebd;};'use strict';var fs=require('fs');var util=require(_0xd138('0x0'));var _=require(_0xd138('0x1'));var sh=require('shelljs');var odbc=require(_0xd138('0x2'))();var rs=require(_0xd138('0x3'));var moment=require(_0xd138('0x4'));var Mustache=require(_0xd138('0x5'));var rp=require(_0xd138('0x6'));var logger=require(_0xd138('0x7'))('agi');var config=require(_0xd138('0x8'));var shared=require(_0xd138('0x9'));var scripts=require(_0xd138('0xa'));var FILES_PATH='/var/opt/motion2/server/files';var recursiveMapAttributes=[_0xd138('0xb'),_0xd138('0xc')];var verticesWithRetry=[_0xd138('0xd'),'getdigits','getsecretdigits'];var AGIVertices=function(_0x10bdf3,_0x2137eb,_0x121cce){this['channel']=_0x10bdf3;this[_0xd138('0xe')]=_0x2137eb;this['mailRpc']=_0x121cce;};AGIVertices['prototype'][_0xd138('0xf')]=function(_0x765b1,_0x438504){this[_0xd138('0xe')]['getVariableById'](_0x765b1)[_0xd138('0x10')](function(_0x5361ec){_0x438504(null,_0x5361ec?_0x5361ec[_0xd138('0x11')]:![]);})[_0xd138('0x12')](function(_0x11ed68){_0x438504(_0x11ed68);});};AGIVertices[_0xd138('0x13')][_0xd138('0x14')]=function(_0x4339f0,_0x24f99){this[_0xd138('0xe')][_0xd138('0x15')](_0x4339f0)[_0xd138('0x10')](function(_0x44b99a){_0x24f99(null,_0x44b99a?_0x44b99a[_0xd138('0x11')]:![]);})['catch'](function(_0x1526e9){_0x24f99(_0x1526e9);});};AGIVertices[_0xd138('0x13')]['getSquareProject']=function(_0x5b67bf,_0x502d3b){this[_0xd138('0xe')][_0xd138('0x16')](_0x5b67bf)['then'](function(_0x43a67d){_0x502d3b(null,_0x43a67d?_0x43a67d[_0xd138('0x11')]:![]);})[_0xd138('0x12')](function(_0x4056d4){_0x502d3b(_0x4056d4);});};AGIVertices['prototype'][_0xd138('0x17')]=function(_0x36f021,_0x247254){this[_0xd138('0xe')][_0xd138('0x18')](_0x36f021)[_0xd138('0x10')](function(_0x1755e5){_0x247254(null,_0x1755e5?_0x1755e5['dsn']:![]);})[_0xd138('0x12')](function(_0x2a5bfb){_0x247254(_0x2a5bfb);});};AGIVertices['prototype']['getUser']=function(_0x20c57a,_0x5e0f89){this['rpc']['getUserById'](_0x20c57a)[_0xd138('0x10')](function(_0x1bc6ef){_0x5e0f89(null,_0x1bc6ef?_0x1bc6ef[_0xd138('0x11')]:![]);})[_0xd138('0x12')](function(_0x5bd0eb){_0x5e0f89(_0x5bd0eb);});};AGIVertices[_0xd138('0x13')][_0xd138('0x19')]=function(_0x3ed87c,_0x22afdc){this[_0xd138('0xe')][_0xd138('0x1a')](_0x3ed87c)[_0xd138('0x10')](function(_0x2dd210){_0x22afdc(null,_0x2dd210?_0x2dd210[_0xd138('0x11')]:![]);})[_0xd138('0x12')](function(_0x1d45b7){_0x22afdc(_0x1d45b7);});};AGIVertices[_0xd138('0x13')]['getSound']=function(_0x41370f,_0x550979){var _0x3003bb=this;this['rpc']['getSoundById'](_0x41370f)['then'](function(_0x15c73e){_0x550979(null,_0x15c73e?_0x3003bb[_0xd138('0x1b')](_0x15c73e[_0xd138('0x1c')]):![]);})[_0xd138('0x12')](function(_0x5d66e1){_0x550979(_0x5d66e1);});};AGIVertices[_0xd138('0x13')]['getMailAccount']=function(_0x355085,_0x2d60f4){this[_0xd138('0xe')]['getMailAccountById'](_0x355085)[_0xd138('0x10')](function(_0x219d07){_0x2d60f4(null,_0x219d07?_0x219d07:![]);})['catch'](function(_0x2dffcc){_0x2d60f4(_0x2dffcc);});};AGIVertices['prototype'][_0xd138('0x1d')]=function(_0x14e599,_0x896ee3,_0x108567){this[_0xd138('0x1e')][_0xd138('0x1d')](_0x14e599,_0x896ee3)['then'](function(){_0x108567(null);})[_0xd138('0x12')](function(_0x35cb59){_0x108567(_0x35cb59);});};AGIVertices[_0xd138('0x13')]['getIntervals']=function(_0x9bd5c,_0x5798f3){this[_0xd138('0xe')]['getIntervalById'](_0x9bd5c)[_0xd138('0x10')](function(_0xde9b2f){if(_0xde9b2f){if(_0xde9b2f[_0xd138('0x1f')]){_0x5798f3(null,[_0xde9b2f['interval']]);}else{_0x5798f3(null,_[_0xd138('0x20')](_0xde9b2f['Intervals'],_0xd138('0x21')));}}else{_0x5798f3(null,![]);}})[_0xd138('0x12')](function(_0x5a0b21){_0x5798f3(_0x5a0b21);});};AGIVertices['prototype'][_0xd138('0x1b')]=function(_0x584929){return util[_0xd138('0x22')](_0xd138('0x23'),FILES_PATH,_0x584929);};AGIVertices['prototype']['getQueryOdbc']=function(_0x47f545,_0x544cc9,_0x13f9fc){odbc['open'](_0x47f545,function(_0x1a3c43){if(_0x1a3c43){logger[_0xd138('0x24')](_0xd138('0x25'),_0x1a3c43);_0x13f9fc(_0x1a3c43);}else{logger[_0xd138('0x26')](_0xd138('0x27'));odbc[_0xd138('0x28')](_0x544cc9,function(_0x2372f9,_0x2da48f){if(_0x2372f9){logger['info']('Error\x20executing\x20query\x20%s',_0x544cc9);_0x13f9fc(_0x2372f9);}else{logger['info'](_0xd138('0x29'),_0x544cc9);odbc[_0xd138('0x2a')](function(_0x99a40e){if(_0x99a40e){logger[_0xd138('0x24')]('Error\x20closing\x20connection\x20to\x20odbc\x20%s',_0x99a40e);}_0x13f9fc(null,_0x2da48f);});}});}});};AGIVertices[_0xd138('0x13')]['getSmsAccount']=function(_0x16680b,_0x4758ff){this[_0xd138('0xe')][_0xd138('0x2b')](_0x16680b)[_0xd138('0x10')](function(_0x429823){_0x4758ff(null,_0x429823?_0x429823:![]);})[_0xd138('0x12')](function(_0x346eeb){_0x4758ff(_0x346eeb);});};AGIVertices[_0xd138('0x13')]['createSmsMessage']=function(_0x2f7e05,_0x273136){this[_0xd138('0xe')][_0xd138('0x2c')](_0x2f7e05)[_0xd138('0x10')](function(_0x5d6eb9){_0x273136(null,_0x5d6eb9);})['catch'](function(_0x16c7e6){_0x273136(_0x16c7e6);});};AGIVertices[_0xd138('0x13')][_0xd138('0x2d')]=function(_0x95282e,_0xac08ed,_0x2ec5a0){this[_0xd138('0xe')][_0xd138('0x2d')]({'uniqueid':this[_0xd138('0x2e')][_0xd138('0x2f')],'node':_0x95282e[_0xd138('0x30')],'application':_0x95282e[_0xd138('0x31')],'data':_0xac08ed||null,'project_name':this['channel'][_0xd138('0x32')],'callerid':this[_0xd138('0x2e')][_0xd138('0x33')]})['then'](function(_0x19d804){if(_0x2ec5a0){_0x2ec5a0(null,_0x19d804);}})[_0xd138('0x12')](function(_0x2be7cf){if(_0x2ec5a0){_0x2ec5a0(_0x2be7cf);}});};AGIVertices[_0xd138('0x13')][_0xd138('0x34')]=function(_0x25430a,_0x4fae45,_0x54a80d,_0x275ed6){this['rpc'][_0xd138('0x34')]({'uniqueid':this['channel'][_0xd138('0x2f')],'callerid':this[_0xd138('0x2e')][_0xd138('0x33')],'calleridname':this['channel']['calleridname'],'context':this[_0xd138('0x2e')][_0xd138('0x35')],'extension':this[_0xd138('0x2e')][_0xd138('0x36')],'priority':this[_0xd138('0x2e')]['priority'],'accountcode':this['channel']['accountcode'],'dnid':this[_0xd138('0x2e')][_0xd138('0x37')],'projectName':this[_0xd138('0x2e')][_0xd138('0x32')],'saveName':_0x4fae45,'filename':_0x25430a['file']||_0x4fae45,'savePath':_0x54a80d})['then'](function(_0xd20679){_0x275ed6(null,_0xd20679);})[_0xd138('0x12')](function(_0x2ac4c5){_0x275ed6(_0x2ac4c5);});};AGIVertices[_0xd138('0x13')]['createSquareMessage']=function(_0x358b46,_0x1b63ea,_0x148299,_0x5a3327,_0x131df5){this[_0xd138('0xe')][_0xd138('0x38')]({'uniqueid':this['channel']['uniqueid'],'body':_0x358b46,'direction':_0x1b63ea,'providerName':_0x148299,'providerResponse':_0x5a3327})['then'](function(_0x295cfc){if(_0x131df5){_0x131df5(null,_0x295cfc);}})[_0xd138('0x12')](function(_0x41b163){if(_0x131df5){_0x131df5(_0x41b163);}});};AGIVertices[_0xd138('0x13')]['createCmContact']=function(_0x293baf,_0x15201a){this[_0xd138('0xe')][_0xd138('0x39')]({'firstName':_[_0xd138('0x3a')](_0x293baf['name'])||_['isNil'](_0x293baf[_0xd138('0x11')])?_0xd138('0x3b')+Math[_0xd138('0x3c')]():_0x293baf[_0xd138('0x11')],'lastName':_[_0xd138('0x3a')](_0x293baf['lastName'])||_[_0xd138('0x3d')](_0x293baf[_0xd138('0x3e')])?null:_0x293baf[_0xd138('0x3e')],'phone':_0x293baf[_0xd138('0x3f')],'ListId':_0x293baf[_0xd138('0x40')],'scheduledat':_0x293baf[_0xd138('0x41')],'callbackUniqueid':this[_0xd138('0x2e')][_0xd138('0x2f')],'tags':_0xd138('0x42'),'description':'Callback\x20scheduled\x20at\x20'+_0x293baf[_0xd138('0x41')]['toString'](),'priority':_0x293baf['callback_priority']})[_0xd138('0x10')](function(_0x594cc6){_0x15201a(null,_0x594cc6);})['catch'](function(_0x4f2c2a){_0x15201a(_0x4f2c2a);});};AGIVertices[_0xd138('0x13')][_0xd138('0x43')]=function(_0x5b752a,_0x815b0d){this[_0xd138('0xe')][_0xd138('0x44')](_0x5b752a)[_0xd138('0x10')](function(_0x11f66b){_0x815b0d(null,_0x11f66b?_0x11f66b[_0xd138('0x11')]:![]);})[_0xd138('0x12')](function(_0x33166d){_0x815b0d(_0x33166d);});};AGIVertices[_0xd138('0x13')][_0xd138('0x45')]=function(_0x547a08,_0xb43f59,_0x567f95){var _0x56f7f1={'role':_0xd138('0x46')};_0x56f7f1[_0x547a08]=this[_0xd138('0x2e')][_0xd138('0x33')];this[_0xd138('0xe')]['agentPause'](_0x56f7f1,_0xb43f59,this[_0xd138('0x2e')][_0xd138('0x2f')])['then'](function(_0x7bcbdd){_0x567f95(null,_['isNil'](_0x7bcbdd)?![]:!![]);})[_0xd138('0x12')](function(_0x4f18dc){logger[_0xd138('0x24')](_0x4f18dc);_0x567f95(null,![]);});};AGIVertices[_0xd138('0x13')][_0xd138('0x47')]=function(_0x1f9ca5,_0x3e23f1){var _0x1c7cf3={'role':_0xd138('0x46')};_0x1c7cf3[_0x1f9ca5]=this['channel'][_0xd138('0x33')];this[_0xd138('0xe')][_0xd138('0x47')](_0x1c7cf3)[_0xd138('0x10')](function(_0x11f7b0){_0x3e23f1(null,_[_0xd138('0x3d')](_0x11f7b0)?![]:!![]);})['catch'](function(_0x4a2e9d){logger['error'](_0x4a2e9d);_0x3e23f1(null,![]);});};AGIVertices[_0xd138('0x13')]['agentLogout']=function(_0x2bc85c,_0x22446b){var _0x472acb={'role':'agent'};_0x472acb[_0x2bc85c]=this[_0xd138('0x2e')]['callerid'];this[_0xd138('0xe')]['agentLogout'](_0x472acb)[_0xd138('0x10')](function(_0x15899f){_0x22446b(null,_[_0xd138('0x3d')](_0x15899f)?![]:!![]);})[_0xd138('0x12')](function(_0x42fc07){logger['error'](_0x42fc07);_0x22446b(null,![]);});};AGIVertices[_0xd138('0x13')][_0xd138('0x48')]=function(_0x55c768,_0x42b483){var _0x197fd4={'role':'agent'};_0x197fd4[_0x55c768]=this[_0xd138('0x2e')]['callerid'];var _0x41948f=_0x55c768!=_0xd138('0x49')?util[_0xd138('0x22')]('%s/%s@from-sip/n',_0xd138('0x4a'),this[_0xd138('0x2e')][_0xd138('0x33')]):undefined;this[_0xd138('0xe')][_0xd138('0x48')](_0x197fd4,_0x41948f)[_0xd138('0x10')](function(_0x37efce){_0x42b483(null,_[_0xd138('0x3d')](_0x37efce)?![]:!![]);})[_0xd138('0x12')](function(_0x447d84){logger[_0xd138('0x24')](_0x447d84);_0x42b483(null,![]);});};AGIVertices[_0xd138('0x13')][_0xd138('0x4b')]=function(_0x263208,_0xb549cf){sh[_0xd138('0x4c')](_[_0xd138('0x4d')](_0x263208),function(_0x4a16ab,_0x5bfe1d){var _0x1864bd=_0x5bfe1d['replace'](/(\r\n|\n|\r)/gm,'');_0xb549cf(null,_0x1864bd);});};AGIVertices[_0xd138('0x13')][_0xd138('0x4e')]=function(_0x15fc60,_0x2735dd){scripts[_0xd138('0x4e')](_0x15fc60[_0xd138('0x4f')],_0x15fc60[_0xd138('0x50')]||_0xd138('0x51'),_0x15fc60[_0xd138('0x51')],_0x15fc60[_0xd138('0x52')]||_0xd138('0x53'),_0x15fc60['ssmlGender']||'MALE',_0x15fc60[_0xd138('0x54')]||_0xd138('0x55'))[_0xd138('0x10')](function(_0x1e4ac2){_0x2735dd(null,_0x1e4ac2);})[_0xd138('0x12')](function(_0x3d3a47){_0x2735dd(_0x3d3a47);});};AGIVertices['prototype']['googleTTS']=function(_0x5d418f,_0x332cd6){scripts['googleTTS'](_0x5d418f[_0xd138('0x51')],_0x5d418f[_0xd138('0x56')]||'en',0x1)[_0xd138('0x10')](function(_0x27d24f){_0x332cd6(null,_0x27d24f);})[_0xd138('0x12')](function(_0x5e5c80){_0x332cd6(_0x5e5c80);});};AGIVertices[_0xd138('0x13')][_0xd138('0x57')]=function(_0x61ce05,_0x232c43){var _0x517da1={'uri':_0x61ce05[_0xd138('0x58')],'method':_0x61ce05[_0xd138('0x59')],'json':!![],'resolveWithFullResponse':!![],'strictSSL':![],'timeout':typeof parseInt(_0x61ce05['timeout'])===_0xd138('0x5a')&&parseInt(_0x61ce05[_0xd138('0x5b')])>=0x1?parseInt(_0x61ce05[_0xd138('0x5b')])*0x3e8:0x5*0x3e8};if(_[_0xd138('0x5c')]([_0xd138('0x5d'),'PUT'],_0x517da1[_0xd138('0x59')]['toUpperCase']())){try{_0x517da1[_0xd138('0x5e')]=_0x61ce05['rawBody']?JSON[_0xd138('0x5f')](_0x61ce05[_0xd138('0xc')]):{};}catch(_0x5e43c9){logger[_0xd138('0x24')]('An\x20incorrect\x20formatted\x20json\x20body\x20has\x20been\x20passed\x20to\x20the\x20function',_0x5e43c9);}}try{_0x517da1[_0xd138('0x60')]=_0x61ce05[_0xd138('0xb')]?JSON[_0xd138('0x5f')](_0x61ce05[_0xd138('0xb')]):{};}catch(_0x1f2ca1){logger[_0xd138('0x24')](_0xd138('0x61'),_0x1f2ca1);}if(_0x61ce05[_0xd138('0x62')]){try{var _0x8fa43a=require(_0x61ce05[_0xd138('0x62')])[_0xd138('0x63')](this,_0x517da1);_0x517da1[_0xd138('0x64')]=Mustache[_0xd138('0x65')](_0x61ce05['url'],_0x8fa43a,{},['$$','$$']);if(_0x517da1[_0xd138('0x60')]){_0x517da1[_0xd138('0x60')]=JSON[_0xd138('0x5f')](Mustache[_0xd138('0x65')](JSON[_0xd138('0x66')](_0x517da1['headers']),_0x8fa43a,{},['$$','$$']));}if(_0x517da1[_0xd138('0x5e')]){_0x517da1['body']=JSON['parse'](Mustache['render'](JSON['stringify'](_0x517da1['body']),_0x8fa43a,{},['$$','$$']));}}catch(_0x1c5878){logger[_0xd138('0x24')](_0xd138('0x67'),_0x1c5878);}}rp(_0x517da1)['then'](function(_0x2a7d40){var _0x393bb2={'statusCode':_0x2a7d40[_0xd138('0x68')]||0xc8,'statusMessage':_0x2a7d40[_0xd138('0x69')]||'OK','headers':_0x2a7d40[_0xd138('0x60')]||{},'body':_0x2a7d40[_0xd138('0x5e')]||{}};_0x232c43(null,_0x393bb2);})[_0xd138('0x12')](function(_0x5807e7){var _0xaffe24={'statusCode':_0x5807e7['statusCode']||0x1f4,'statusMessage':_0x5807e7[_0xd138('0x6a')]||'500\x20-\x20Internal\x20Server\x20Error','headers':_0x5807e7[_0xd138('0x6b')]['headers']||{},'body':_0x5807e7[_0xd138('0x6b')][_0xd138('0x5e')]||{}};_0x232c43(null,_0xaffe24);});};AGIVertices[_0xd138('0x13')][_0xd138('0x6c')]=function(_0x1b5b6b,_0x220eee){scripts[_0xd138('0x6c')](this['channel']['uniqueid'],_0x1b5b6b['key'],_0x1b5b6b[_0xd138('0x51')],_0x1b5b6b[_0xd138('0x6d')]||'en')[_0xd138('0x10')](function(_0x3ee0f9){_0x220eee(null,_0x3ee0f9);})[_0xd138('0x12')](function(_0x5caabe){_0x220eee(_0x5caabe);});};AGIVertices[_0xd138('0x13')]['googleDialogflowV2']=function(_0x11d725,_0x181bf9){scripts[_0xd138('0x6e')](this['channel'][_0xd138('0x2f')],_0x11d725['dialogflowV2_project_id'],_0x11d725[_0xd138('0x6f')],_0x11d725[_0xd138('0x70')],_0x11d725[_0xd138('0x51')],_0x11d725[_0xd138('0x71')]||'en')[_0xd138('0x10')](function(_0x771e6b){_0x181bf9(null,_0x771e6b);})[_0xd138('0x12')](function(_0x1fe7eb){_0x181bf9(_0x1fe7eb);});};AGIVertices[_0xd138('0x13')]['sestekNDA']=function(_0x53a4e6,_0x491600){scripts[_0xd138('0x72')](this[_0xd138('0x2e')],_0x53a4e6)[_0xd138('0x10')](function(_0x3fbbe9){_0x491600(null,_0x3fbbe9);})[_0xd138('0x12')](function(_0x411cd7){_0x491600(_0x411cd7);});};AGIVertices[_0xd138('0x13')][_0xd138('0x73')]=function(_0x19490a,_0x1e9c02){scripts['ispeechTTS'](_0x19490a[_0xd138('0x74')],_0x19490a[_0xd138('0x51')],_0x19490a[_0xd138('0x75')]||'en-US',_0x19490a[_0xd138('0x76')])[_0xd138('0x10')](function(_0x193cc5){_0x1e9c02(null,_0x193cc5);})['catch'](function(_0x575323){_0x1e9c02(_0x575323);});};AGIVertices[_0xd138('0x13')][_0xd138('0x77')]=function(_0x2987e1,_0x930852,_0x2d8084){scripts['ispeechASR'](_0x930852,_0x2987e1[_0xd138('0x74')],_0x2987e1[_0xd138('0x78')]||_0xd138('0x53'),this[_0xd138('0x79')](_0x2987e1[_0xd138('0x7a')])?_0x2987e1[_0xd138('0x7a')]:undefined)[_0xd138('0x10')](function(_0x2c27af){_0x2d8084(null,_0x2c27af);})[_0xd138('0x12')](function(_0x2706a4){_0x2d8084(_0x2706a4);});};AGIVertices[_0xd138('0x13')][_0xd138('0x7b')]=function(_0x398b2e,_0x41dc75){scripts[_0xd138('0x7b')](_0x398b2e[_0xd138('0x7c')],_0x398b2e[_0xd138('0x7d')],_0x398b2e[_0xd138('0x7e')],_0x398b2e['aws_polly_voice']||_0xd138('0x7f'),_0x398b2e[_0xd138('0x51')],_0x398b2e[_0xd138('0x80')]||_0xd138('0x51'))[_0xd138('0x10')](function(_0x3c9e5f){_0x41dc75(null,_0x3c9e5f);})[_0xd138('0x12')](function(_0x449608){_0x41dc75(_0x449608);});};AGIVertices[_0xd138('0x13')][_0xd138('0x81')]=function(_0xdbde9c,_0x46e67d){scripts[_0xd138('0x81')](this[_0xd138('0x2e')][_0xd138('0x2f')],_0xdbde9c[_0xd138('0x7c')],_0xdbde9c['aws_secret_access_key'],_0xdbde9c['aws_lex_region'],_0xdbde9c[_0xd138('0x51')],_0xdbde9c['aws_bot_name'])[_0xd138('0x10')](function(_0x244284){_0x46e67d(null,_0x244284);})[_0xd138('0x12')](function(_0x9b0a4b){_0x46e67d(_0x9b0a4b);});};AGIVertices['prototype'][_0xd138('0x82')]=function(_0x524ef6,_0x190576,_0x3944f5){scripts[_0xd138('0x82')](_0x190576,_0x524ef6[_0xd138('0x74')],_0x524ef6[_0xd138('0x83')]||'en-US')[_0xd138('0x10')](function(_0xdd9b49){_0x3944f5(null,_0xdd9b49);})[_0xd138('0x12')](function(_0x17a8c4){_0x3944f5(_0x17a8c4);});};AGIVertices[_0xd138('0x13')][_0xd138('0x84')]=function(_0x3e595a,_0x140fa1,_0x4b3117){scripts['tildeASR'](_0x140fa1,_0x3e595a[_0xd138('0x85')],_0x3e595a[_0xd138('0x86')],_0x3e595a[_0xd138('0x64')])[_0xd138('0x10')](function(_0x168222){_0x4b3117(null,_0x168222);})[_0xd138('0x12')](function(_0x2e42c0){_0x4b3117(_0x2e42c0);});};AGIVertices[_0xd138('0x13')][_0xd138('0x87')]=function(_0x23dbe5){var _0x136b65=_['includes'](verticesWithRetry,_0x23dbe5['agicommand'])?_0x23dbe5:_[_0xd138('0x88')](_0x23dbe5);for(var _0x18a5cd in _0x136b65){if(_0x136b65[_0xd138('0x89')](_0x18a5cd)){if(_0x136b65[_0x18a5cd]&&_['isString'](_0x136b65[_0x18a5cd])){if(_[_0xd138('0x5c')](recursiveMapAttributes,_0x18a5cd)){_0x136b65[_0x18a5cd]=this[_0xd138('0x8a')](_0x136b65[_0x18a5cd]);}else{_0x136b65[_0x18a5cd]=this['replaceAllVariables'](_0x136b65[_0x18a5cd]);}}}}return _0x136b65;};AGIVertices[_0xd138('0x13')][_0xd138('0x8b')]=function(_0x256e7d){for(var _0x482bb3 in _0x256e7d){if(_0x256e7d['hasOwnProperty'](_0x482bb3)){if(_[_0xd138('0x8c')](_0x256e7d[_0x482bb3])){this['recursiveNodeIndex'](_0x256e7d[_0x482bb3]);}else if(_[_0xd138('0x8d')](_0x256e7d[_0x482bb3])){for(var _0x4632da=0x0;_0x4632da<_0x256e7d[_0x482bb3][_0xd138('0x8e')];_0x4632da++){this[_0xd138('0x8b')](_0x256e7d[_0x482bb3][_0x4632da]);}}else if(_[_0xd138('0x8f')](_0x256e7d[_0x482bb3])){_0x256e7d[_0x482bb3]=this[_0xd138('0x90')](_0x256e7d[_0x482bb3]);}}}};AGIVertices['prototype']['saveRestApiResult']=function(_0x159517,_0x5a8b10){for(var _0x4fe803 in _0x159517){if(_0x159517[_0xd138('0x89')](_0x4fe803)){if(_[_0xd138('0x8c')](_0x159517[_0x4fe803])){if(!_[_0xd138('0x3a')](_0x159517[_0x4fe803])){this[_0xd138('0x91')](_0x159517[_0x4fe803],util[_0xd138('0x22')](_0xd138('0x92'),_0x5a8b10,_0x4fe803));}}else if(_[_0xd138('0x8d')](_0x159517[_0x4fe803])){for(var _0x2727b7=0x0;_0x2727b7<_0x159517[_0x4fe803][_0xd138('0x8e')];_0x2727b7++){this[_0xd138('0x91')](_0x159517[_0x4fe803][_0x2727b7],util[_0xd138('0x22')](_0xd138('0x92'),_0x5a8b10,_0x4fe803+'['+_0x2727b7+']'));}}else{if(!_[_0xd138('0x3d')](_0x159517[_0x4fe803])){this[_0xd138('0x2e')][_0xd138('0x93')](util[_0xd138('0x22')]('%s.%s',_0x5a8b10,_0x4fe803),_0x159517[_0x4fe803]);}}}}};AGIVertices[_0xd138('0x13')][_0xd138('0x8a')]=function(_0x352457){try{var _0x110d65=JSON[_0xd138('0x5f')](_0x352457);this['recursiveNodeIndex'](_0x110d65);return JSON[_0xd138('0x66')](_0x110d65);}catch(_0x586d9c){return this['replaceAllVariables'](_0x352457);}};AGIVertices[_0xd138('0x13')][_0xd138('0x90')]=function(_0x5e33af){var _0x196472=_0x5e33af[_0xd138('0x94')]('{');for(var _0x1d9b1e=0x1;_0x1d9b1e<_0x196472[_0xd138('0x8e')];_0x1d9b1e+=0x1){var _0x54236e=_0x196472[_0x1d9b1e]['split']('}');if(_0x54236e[_0xd138('0x8e')]>0x1){_0x5e33af=_0x5e33af[_0xd138('0x95')]('{'+_0x54236e[0x0]+'}',this[_0xd138('0x2e')][_0xd138('0xf')](_0x54236e[0x0])[_0xd138('0x96')]||_0x54236e[0x0]);}}if(_0x196472[_0xd138('0x8e')]===0x1){return _0x5e33af[_0xd138('0x97')]();}return this[_0xd138('0x90')](_0x5e33af);};AGIVertices[_0xd138('0x13')][_0xd138('0x98')]=function(_0x392951,_0x1c54fd){var _0x48a1d6=this[_0xd138('0x2e')]['getVariable'](_0x392951);if(_0x48a1d6[_0xd138('0x99')]===-0x1){return _0x48a1d6;}logger[_0xd138('0x26')](util[_0xd138('0x22')]('The\x20\x22%s\x22\x20variable\x20value\x20is:\x20%s',_0x1c54fd,_0x48a1d6['extra']));return this['channel']['setVariable'](_0x1c54fd,_0x48a1d6['extra']);};AGIVertices[_0xd138('0x13')][_0xd138('0x79')]=function(_0x286600){return _0x286600&&_0x286600!=='0'&&_0x286600!=='-1'&&_0x286600!=='';};AGIVertices[_0xd138('0x13')][_0xd138('0x9a')]=function(_0x339041){this[_0xd138('0x2d')][_0xd138('0x63')](this,_0x339041,'-');_0x339041['retry']=_0x339041[_0xd138('0x9a')];return{'code':0xc8,'result':'-'};};AGIVertices[_0xd138('0x13')][_0xd138('0x9b')]=function(_0x59f833){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x9c'),_0x59f833[_0xd138('0x30')]));if(!this['isConfigured'](_0x59f833[_0xd138('0x51')])){return this[_0xd138('0x2e')]['noop'](_0xd138('0x9d'));}var _0x102c0d='\x22'+_0x59f833[_0xd138('0x51')]+'\x22';if(this[_0xd138('0x79')](_0x59f833[_0xd138('0x6b')])){_0x102c0d+=','+_0x59f833['options'];}var _0x2f89eb=this[_0xd138('0x2e')][_0xd138('0x4c')](_0xd138('0x9e'),_0x102c0d);if(_0x2f89eb[_0xd138('0x99')]===-0x1){return _0x2f89eb;}return this[_0xd138('0x2e')][_0xd138('0x9f')](util['format'](_0xd138('0xa0'),_0x102c0d));};AGIVertices['prototype'][_0xd138('0xa1')]=function(_0x542881){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xa2'),_0x542881[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x542881[_0xd138('0xa3')])){return this['channel'][_0xd138('0x9f')](_0xd138('0xa4'));}var _0x32d0fe=_0x542881[_0xd138('0xa3')];if(this['isConfigured'](_0x542881[_0xd138('0x6b')])){_0x32d0fe+=','+_0x542881['options'];}var _0x1f4e4b=this[_0xd138('0x2e')][_0xd138('0x4c')]('MRCPRecog',_0x32d0fe);if(_0x1f4e4b[_0xd138('0x99')]===-0x1){return _0x1f4e4b;}var _0x344ef0=this[_0xd138('0x98')](_0xd138('0xa5'),'MRCP_RECOG_CONFIDENCE');if(_0x344ef0['result']===-0x1){return _0x344ef0;}var _0x549cfd=this[_0xd138('0x98')]('RECOG_INPUT()',_0xd138('0xa6'));if(_0x549cfd[_0xd138('0x99')]===-0x1){return _0x549cfd;}var _0x1b8cf2=this[_0xd138('0x98')](_0xd138('0xa7'),_0xd138('0xa8'));if(_0x1b8cf2[_0xd138('0x99')]===-0x1){return _0x1b8cf2;}return this['channel']['noop'](util[_0xd138('0x22')](_0xd138('0xa9'),_0x32d0fe));};AGIVertices[_0xd138('0x13')]['agi']=function(_0x4aa362){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xaa'),_0x4aa362[_0xd138('0x30')]));return this[_0xd138('0x2e')][_0xd138('0xab')]([_0x4aa362[_0xd138('0xac')],_0x4aa362['args']]);};AGIVertices[_0xd138('0x13')][_0xd138('0xad')]=function(_0x324238){logger[_0xd138('0x26')](util['format'](_0xd138('0xae'),_0x324238[_0xd138('0x30')]));if(this['isConfigured'](_0x324238[_0xd138('0x5b')])){logger['info'](util[_0xd138('0x22')](_0xd138('0xaf'),_0x324238[_0xd138('0x5b')]));var _0x67c832=this[_0xd138('0x2e')][_0xd138('0xb0')](_0x324238[_0xd138('0x5b')]);if(_0x67c832[_0xd138('0x99')]===-0x1){return _0x67c832;}}return this[_0xd138('0x2e')][_0xd138('0xad')]();};AGIVertices[_0xd138('0x13')][_0xd138('0x42')]=function(_0x170394){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xb1'),_0x170394[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x170394[_0xd138('0x40')])){return this['channel'][_0xd138('0x24')](_0x170394,_0xd138('0xb2'));}_0x170394['scheduledAt']=moment();if(this[_0xd138('0x79')](_0x170394[_0xd138('0xb3')])){_0x170394['scheduledAt']=moment()[_0xd138('0xb4')](_0x170394[_0xd138('0xb3')],'minutes');}if(!this[_0xd138('0x79')](_0x170394[_0xd138('0xb5')])){_0x170394[_0xd138('0xb5')]=0x2;}this['createCmContact'][_0xd138('0x63')](this,_0x170394);return this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')](_0xd138('0xb6'),_0x170394[_0xd138('0x3f')],_0x170394[_0xd138('0x40')],_0x170394[_0xd138('0x41')]));};AGIVertices[_0xd138('0x13')]['custom_app']=function(_0x268efe){logger[_0xd138('0x26')](util['format']('Enter\x20in\x20CUSTOM\x20APP\x20(%s)\x20block',_0x268efe['label']));var _0x585d5c=this[_0xd138('0x2e')]['exec'](_0x268efe[_0xd138('0xb7')],_0x268efe[_0xd138('0x6b')]);if(_0x585d5c[_0xd138('0x99')]===-0x1){return _0x585d5c;}return this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')](_0xd138('0xb8'),_0x268efe['application'],_0x268efe[_0xd138('0x6b')]));};AGIVertices[_0xd138('0x13')][_0xd138('0xb9')]=function(_0x185719){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xba'),_0x185719[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x185719[_0xd138('0x51')])){return this[_0xd138('0x2e')][_0xd138('0x9f')]('no\x20text\x20configured');}var _0x4e2b7c='\x22'+_0x185719[_0xd138('0x51')]+'\x22';if(this[_0xd138('0x79')](_0x185719[_0xd138('0x6b')])){_0x4e2b7c+=','+_0x185719['options'];}var _0x14fdd3=this[_0xd138('0x2e')][_0xd138('0x4c')]('MRCPSynth',_0x4e2b7c);if(_0x14fdd3['result']===-0x1){return _0x14fdd3;}return this[_0xd138('0x2e')][_0xd138('0x9f')](util['format'](_0xd138('0xa0'),_0x4e2b7c));};AGIVertices[_0xd138('0x13')][_0xd138('0xbb')]=function(_0x5b848a){logger[_0xd138('0x26')](util[_0xd138('0x22')]('Enter\x20in\x20SESTEKTTS\x20(%s)\x20block',_0x5b848a[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x5b848a[_0xd138('0x51')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x9d'));}var _0x2bf712='\x22'+_0x5b848a['text']+'\x22';if(this[_0xd138('0x79')](_0x5b848a[_0xd138('0x6b')])){_0x2bf712+=','+_0x5b848a[_0xd138('0x6b')];}var _0x5f4495=this['channel'][_0xd138('0x4c')](_0xd138('0x9e'),_0x2bf712);if(_0x5f4495['result']===-0x1){return _0x5f4495;}return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0xa0'),_0x2bf712));};AGIVertices[_0xd138('0x13')][_0xd138('0xbc')]=function(_0x345a7e){logger['info'](util[_0xd138('0x22')]('Enter\x20in\x20LUMENVOXASR\x20(%s)\x20block',_0x345a7e['label']));if(!this[_0xd138('0x79')](_0x345a7e[_0xd138('0xa3')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xa4'));}var _0x1a17e2=_0x345a7e[_0xd138('0xa3')];if(this['isConfigured'](_0x345a7e['options'])){_0x1a17e2+=','+_0x345a7e[_0xd138('0x6b')];}var _0x43c934=this[_0xd138('0x2e')][_0xd138('0x4c')](_0xd138('0xbd'),_0x1a17e2);if(_0x43c934[_0xd138('0x99')]===-0x1){return _0x43c934;}var _0x2abfb0=this[_0xd138('0x98')]('RECOG_CONFIDENCE()','LUMENVOX_ASR_CONFIDENCE');if(_0x2abfb0['result']===-0x1){return _0x2abfb0;}var _0x58829f=this[_0xd138('0x98')](_0xd138('0xbe'),_0xd138('0xbf'));if(_0x58829f[_0xd138('0x99')]===-0x1){return _0x58829f;}var _0x57bad0=this['getAndSetVariable']('RECOG_INSTANCE()',_0xd138('0xc0'));if(_0x57bad0[_0xd138('0x99')]===-0x1){return _0x57bad0;}return this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')](_0xd138('0xa9'),_0x1a17e2));};AGIVertices[_0xd138('0x13')][_0xd138('0xc1')]=function(_0x8483b2){logger[_0xd138('0x26')](util['format']('Enter\x20in\x20SESTEKASR\x20(%s)\x20block',_0x8483b2[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x8483b2[_0xd138('0xa3')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xa4'));}var _0x510614=_0x8483b2[_0xd138('0xa3')];if(this[_0xd138('0x79')](_0x8483b2['options'])){_0x510614+=','+_0x8483b2[_0xd138('0x6b')];}var _0xe42fad=this['channel'][_0xd138('0x4c')](_0xd138('0xbd'),_0x510614);if(_0xe42fad['result']===-0x1){return _0xe42fad;}var _0x47f056=this[_0xd138('0x98')]('RECOG_CONFIDENCE()',_0xd138('0xc2'));if(_0x47f056[_0xd138('0x99')]===-0x1){return _0x47f056;}var _0x152abe=this['getAndSetVariable']('RECOG_INPUT()',_0xd138('0xc3'));if(_0x152abe['result']===-0x1){return _0x152abe;}var _0x3e7d1b=this['getAndSetVariable'](_0xd138('0xa7'),_0xd138('0xc4'));if(_0x3e7d1b[_0xd138('0x99')]===-0x1){return _0x3e7d1b;}return this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')]('Executed\x20command\x20MRCPRecog\x20%s',_0x510614));};AGIVertices[_0xd138('0x13')][_0xd138('0xc5')]=function(_0x4d84d9){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xc6'),_0x4d84d9[_0xd138('0x30')]));if(!this['isConfigured'](_0x4d84d9[_0xd138('0xc7')])){return this[_0xd138('0x2e')]['error'](_0x4d84d9,_0xd138('0xc8'));}var _0x227ff3=this['getSquareOdbc'][_0xd138('0x63')](this,_0x4d84d9['odbc_id']);if(!_0x227ff3){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x4d84d9,'no\x20odbc\x20database\x20found');}if(!this[_0xd138('0x79')](_0x4d84d9[_0xd138('0x28')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x4d84d9,_0xd138('0xc9'));}var _0x3cccf1=_0x4d84d9[_0xd138('0x28')][_0xd138('0xca')](/(\r\n|\n|\r)/gm,'\x20');this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0xcb'),_0x3cccf1));var _0xab98ad=this[_0xd138('0xcc')][_0xd138('0x63')](this,_0x227ff3,_0x3cccf1);this[_0xd138('0x2d')][_0xd138('0x63')](this,_0x4d84d9,_0x3cccf1);if(!this[_0xd138('0x79')](_0x4d84d9[_0xd138('0xcd')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xce'));}var _0x5c16dc=this[_0xd138('0xf')][_0xd138('0x63')](this,_0x4d84d9[_0xd138('0xcd')]);if(!_0x5c16dc){return this['channel']['error'](_0x4d84d9,_0xd138('0xcf'));}var _0xceb2a8=this;_0xab98ad['forEach'](function(_0x1d6414,_0x1fcee8){Object['keys'](_0x1d6414)[_0xd138('0xd0')](function(_0x3b1ce1){_0xceb2a8[_0xd138('0x2e')][_0xd138('0x93')](util['format'](_0xd138('0xd1'),_0x5c16dc,_0x1fcee8,_0x3b1ce1),_0x1d6414[_0x3b1ce1]);});});this[_0xd138('0x2e')]['setVariable'](util[_0xd138('0x22')](_0xd138('0xd2'),_0x5c16dc),_0xab98ad[_0xd138('0x8e')]);return this['channel'][_0xd138('0x9f')](util[_0xd138('0x22')]('variable\x20%s\x20set',_0x5c16dc));};AGIVertices[_0xd138('0x13')]['dial']=function(_0x452626){logger['debug'](util['format'](_0xd138('0xd3'),_0x452626['label']));if(!this[_0xd138('0x79')](_0x452626[_0xd138('0xd4')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x452626,'no\x20user\x20selected');}var _0x31b439=this[_0xd138('0xd5')][_0xd138('0x63')](this,_0x452626['sip_id']);if(!_0x31b439){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x452626,_0xd138('0xd6'));}var _0x355fd5=this[_0xd138('0x2e')][_0xd138('0x4c')]('DIAL',[util[_0xd138('0x22')](_0xd138('0xd7'),_0x31b439),_0x452626[_0xd138('0x5b')],_0x452626[_0xd138('0xd8')],_0x452626[_0xd138('0x58')]]);if(_0x355fd5[_0xd138('0x99')]===-0x1){return _0x355fd5;}return this[_0xd138('0x2e')][_0xd138('0x9f')](util['format'](_0xd138('0xd9'),_0xd138('0xda')));};AGIVertices[_0xd138('0x13')]['dialogflow']=function(_0x463032){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xdb'),_0x463032[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x463032[_0xd138('0x74')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xdc'));}if(!this[_0xd138('0x79')](_0x463032[_0xd138('0x51')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x9d'));}this[_0xd138('0x2e')][_0xd138('0xdd')]=!![];this['createSquareDetailsReport'](_0x463032);this[_0xd138('0x38')](_0x463032[_0xd138('0x51')],'in','','');this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0xde'),_0x463032[_0xd138('0x51')]));var _0x54b777=this[_0xd138('0x6c')][_0xd138('0x63')](this,_0x463032);if(_0x54b777){for(var _0x198baf in _0x54b777){if(_0x54b777[_0xd138('0x89')](_0x198baf)){this[_0xd138('0x2e')]['setVariable'](util[_0xd138('0x22')]('DIALOGFLOW_%s',_0x198baf['toUpperCase']()),_0x54b777[_0x198baf]);}}this[_0xd138('0x38')](_0x54b777[_0xd138('0xdf')],_0xd138('0xe0'),_0xd138('0xe1'),'');return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')]('Dialogflow\x20Result\x20%s',_0x54b777[_0xd138('0xdf')]));}return this[_0xd138('0x2e')][_0xd138('0x24')](_0x463032,_0xd138('0xe2'));};AGIVertices['prototype'][_0xd138('0xe3')]=function(_0x4ca290){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xe4'),_0x4ca290[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x4ca290['dialogflowV2_project_id'])){return this['channel'][_0xd138('0x9f')]('no\x20project_id\x20configured');}if(!this[_0xd138('0x79')](_0x4ca290['client_email'])){return this['channel'][_0xd138('0x9f')]('no\x20client_email\x20configured');}if(!this[_0xd138('0x79')](_0x4ca290[_0xd138('0x70')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xe5'));}if(!this[_0xd138('0x79')](_0x4ca290[_0xd138('0x71')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xe6'));}if(!this['isConfigured'](_0x4ca290[_0xd138('0x51')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x9d'));}this[_0xd138('0x2e')][_0xd138('0xdd')]=!![];this[_0xd138('0x2d')](_0x4ca290);this[_0xd138('0x38')](_0x4ca290[_0xd138('0x51')],'in','','');this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')](_0xd138('0xe7'),_0x4ca290[_0xd138('0x51')]));var _0x214720=this['googleDialogflowV2'][_0xd138('0x63')](this,_0x4ca290);if(_0x214720){for(var _0x29c649 in _0x214720){if(_0x214720[_0xd138('0x89')](_0x29c649)){if(_0x29c649!=='providerResponse'){this[_0xd138('0x2e')][_0xd138('0x93')](util[_0xd138('0x22')](_0xd138('0xe8'),_0x29c649[_0xd138('0xe9')]()),_0x214720[_0x29c649]);}}}this['createSquareMessage'](_0x214720[_0xd138('0xdf')],_0xd138('0xe0'),_0xd138('0xe3'),_0x214720[_0xd138('0xea')]);return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0xeb'),_0x214720[_0xd138('0xdf')]));}return this[_0xd138('0x2e')][_0xd138('0x24')](_0x4ca290,_0xd138('0xec'));};AGIVertices['prototype'][_0xd138('0xed')]=function(_0x5af16d){logger[_0xd138('0x26')](util['format'](_0xd138('0xee'),_0x5af16d[_0xd138('0x30')]));if(!this['isConfigured'](_0x5af16d[_0xd138('0xef')])){return this['channel'][_0xd138('0x9f')](_0xd138('0xf0'));}if(!this[_0xd138('0x79')](_0x5af16d['username'])){return this[_0xd138('0x2e')]['noop']('no\x20username\x20configured');}if(!this[_0xd138('0x79')](_0x5af16d[_0xd138('0xf1')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xf2'));}if(!this['isConfigured'](_0x5af16d[_0xd138('0xf3')])){return this[_0xd138('0x2e')]['noop'](_0xd138('0x9d'));}this[_0xd138('0x2e')][_0xd138('0xdd')]=!![];this[_0xd138('0x2d')](_0x5af16d);this['createSquareMessage'](_0x5af16d['text'],'in','','');this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')]('Trying\x20SestekNDA:\x20%s',_0x5af16d[_0xd138('0x51')]));var _0x48ca9c=this[_0xd138('0x72')]['sync'](this,_0x5af16d);if(_0x48ca9c){for(var _0x11fe66 in _0x48ca9c){if(_0x48ca9c[_0xd138('0x89')](_0x11fe66)){this[_0xd138('0x2e')][_0xd138('0x93')](util['format'](_0xd138('0xf4'),_0x11fe66[_0xd138('0xe9')]()),_0x48ca9c[_0x11fe66]);}}this[_0xd138('0x38')](_0x48ca9c[_0xd138('0xdf')],_0xd138('0xe0'),_0xd138('0xed'),'');if(_0x48ca9c['audiofile']){this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')]('Sestek\x20NDA\x20%s\x20file\x20created',_0x48ca9c[_0xd138('0xf5')]));var _0x1d39f1=this[_0xd138('0x2e')]['streamFile'](_0x48ca9c['audiofile']);try{fs[_0xd138('0xf6')](_0x48ca9c[_0xd138('0xf5')]+_0xd138('0xf7'));}catch(_0x40489f){logger['error'](_0x40489f);}return _0x1d39f1;}else{return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0xf8'),_0x48ca9c['speech']));}}return this[_0xd138('0x2e')]['error'](_0x5af16d,_0xd138('0xf9'));};AGIVertices[_0xd138('0x13')]['end']=function(_0x5dad5a){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xfa'),_0x5dad5a[_0xd138('0x30')]));return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xfb'));};AGIVertices[_0xd138('0x13')][_0xd138('0xfc')]=function(_0x20ba68){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0xfd'),_0x20ba68[_0xd138('0x30')]));var _0x9032fc='';if(_0x20ba68[_0xd138('0xfe')]){if(!this[_0xd138('0x79')](_0x20ba68[_0xd138('0xfe')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x20ba68,'no\x20trunk\x20selected');}else{var _0x5efefc=parseInt(_0x20ba68[_0xd138('0xfe')],0xa);if(isNaN(_0x5efefc)){_0x9032fc=_0x20ba68[_0xd138('0xfe')];}else{_0x9032fc=this[_0xd138('0x19')][_0xd138('0x63')](this,_0x20ba68[_0xd138('0xfe')]);if(!_0x9032fc){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x20ba68,_0xd138('0xff'));}}}}else if(_0x20ba68[_0xd138('0x100')]){_0x9032fc=_0x20ba68['trunk_name'];}else{return this[_0xd138('0x2e')][_0xd138('0x24')](_0x20ba68,_0xd138('0x101'));}var _0x511815=this[_0xd138('0x2e')]['exec'](_0xd138('0xda'),[util[_0xd138('0x22')](_0xd138('0x102'),_0x9032fc,_0x20ba68[_0xd138('0x3f')]),_0x20ba68[_0xd138('0x5b')],_0x20ba68[_0xd138('0xd8')],_0x20ba68[_0xd138('0x58')]]);if(_0x511815[_0xd138('0x99')]===-0x1){return _0x511815;}return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0xd9'),_0xd138('0xda')));};AGIVertices[_0xd138('0x13')][_0xd138('0x103')]=function(_0xac712d){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x104'),_0xac712d[_0xd138('0x30')]));return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x103'));};AGIVertices['prototype'][_0xd138('0x105')]=function(_0x101407){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x106'),_0x101407[_0xd138('0x30')]));if(_0x101407[_0xd138('0x107')]===0x0){return this[_0xd138('0x9a')](_0x101407);}_0x101407[_0xd138('0x107')]-=0x1;if(!this[_0xd138('0x79')](_0x101407['file_id'])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x101407,_0xd138('0x108'));}var _0x52f7be=this[_0xd138('0x109')][_0xd138('0x63')](this,_0x101407[_0xd138('0x10a')]);if(!_0x52f7be){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x101407,_0xd138('0x10b'));}if(!this[_0xd138('0x79')](_0x101407[_0xd138('0xcd')])){return this['channel'][_0xd138('0x24')]('no\x20variable\x20selected\x20for\x20the\x20result');}var _0x393222=this[_0xd138('0x2e')][_0xd138('0x10c')](_0x52f7be,_0x101407[_0xd138('0x10d')],_0x101407['maxdigit']);var _0x471225=_0x393222[_0xd138('0x99')]?_0x393222['result'][_0xd138('0x97')]():'';logger[_0xd138('0x26')](_0xd138('0x10e'),JSON[_0xd138('0x66')](_0x393222));if(_0x393222[_0xd138('0x99')]===-0x1){this['createSquareDetailsReport'][_0xd138('0x63')](this,_0x101407,_0x471225);return _0x393222;}else if(_0x393222[_0xd138('0x96')]===_0xd138('0x5b')){_0x393222[_0xd138('0x99')]=_0x471225[_0xd138('0x8e')]>=parseInt(_0x101407[_0xd138('0x10f')])?'x':'i';}else{_0x393222[_0xd138('0x99')]=_0x471225[_0xd138('0x8e')]>=parseInt(_0x101407[_0xd138('0x10f')])&&_0x471225[_0xd138('0x8e')]<=parseInt(_0x101407['maxdigit'])?'x':'i';}var _0x223127=this[_0xd138('0xf')][_0xd138('0x63')](this,_0x101407[_0xd138('0xcd')]);if(!_0x223127){return this['channel']['error'](_0x101407,_0xd138('0xcf'));}this[_0xd138('0x2e')][_0xd138('0x93')](_0x223127,_0x471225);if(this[_0xd138('0x79')](_0x101407[_0xd138('0x110')])){var _0x575ccf=parseInt(_0x101407[_0xd138('0x110')],0xa);var _0xcb7826=rs['generate']({'charset':'*','length':_0x575ccf});var _0x230b98=_0x471225[_0xd138('0x8e')];if(_0x230b98>0x0){if(_0x230b98>_0x575ccf){this[_0xd138('0x2d')][_0xd138('0x63')](this,_0x101407,_0x101407[_0xd138('0x111')]===_0xd138('0x112')?_0xcb7826+_0x471225['substr'](_0x575ccf):_0x471225[_0xd138('0x113')](0x0,_0x230b98-_0x575ccf)+_0xcb7826);}else{this['createSquareDetailsReport'][_0xd138('0x63')](this,_0x101407,rs[_0xd138('0x114')]({'charset':'*','length':_0x230b98}));}}else{this['createSquareDetailsReport'][_0xd138('0x63')](this,_0x101407,'');}}else{this['createSquareDetailsReport'][_0xd138('0x63')](this,_0x101407,_0x471225);}return _0x393222;};AGIVertices[_0xd138('0x13')]['getsecretdigits']=function(_0xd6e13a){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x115'),_0xd6e13a['label']));return this[_0xd138('0x105')](_0xd6e13a);};AGIVertices['prototype'][_0xd138('0x116')]=function(_0xb6a0f0){logger[_0xd138('0x26')](util[_0xd138('0x22')]('Enter\x20in\x20GOAL\x20(%s)\x20block',_0xb6a0f0[_0xd138('0x30')]));this[_0xd138('0x2d')][_0xd138('0x63')](this,_0xb6a0f0,_0xb6a0f0[_0xd138('0x117')]);return this[_0xd138('0x2e')][_0xd138('0x9f')](util['format'](_0xd138('0x118'),_0xb6a0f0[_0xd138('0x117')]));};AGIVertices[_0xd138('0x13')]['awspolly']=function(_0x40311b){logger[_0xd138('0x26')](util[_0xd138('0x22')]('[AGI]\x20Enter\x20in\x20AWSPOLLY\x20(%s)\x20block',_0x40311b[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x40311b[_0xd138('0x7c')])||!this[_0xd138('0x79')](_0x40311b['aws_secret_access_key'])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x119'));}if(!this[_0xd138('0x79')](_0x40311b[_0xd138('0x51')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x9d'));}this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x11a'),_0x40311b[_0xd138('0x51')]));var _0x22b147=this[_0xd138('0x7b')][_0xd138('0x63')](this,_0x40311b);if(_0x22b147){this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')](_0xd138('0x11b'),_0x22b147));var _0x9b1041=this['channel'][_0xd138('0x11c')](_0x22b147);try{fs[_0xd138('0xf6')](_0x22b147+_0xd138('0xf7'));}catch(_0x5a6727){logger[_0xd138('0x24')](_0x5a6727);}return _0x9b1041;}return this['channel']['error'](_0x40311b,_0xd138('0x11d'));};AGIVertices[_0xd138('0x13')][_0xd138('0x11e')]=function(_0x208390){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x11f'),_0x208390[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x208390[_0xd138('0x7c')])||!this[_0xd138('0x79')](_0x208390[_0xd138('0x7d')])){return this[_0xd138('0x2e')]['noop'](_0xd138('0x119'));}if(!this[_0xd138('0x79')](_0x208390[_0xd138('0x120')])){return this['channel'][_0xd138('0x9f')](_0xd138('0x121'));}if(!this[_0xd138('0x79')](_0x208390[_0xd138('0x51')])){return this[_0xd138('0x2e')][_0xd138('0x9f')]('no\x20text\x20configured');}this['channel']['bot']=!![];this[_0xd138('0x2d')](_0x208390);this[_0xd138('0x38')](_0x208390['text'],'in','','');this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')](_0xd138('0x122'),_0x208390[_0xd138('0x51')]));var _0x5d2064=this['awsLex'][_0xd138('0x63')](this,_0x208390);if(_0x5d2064){for(var _0x46a657 in _0x5d2064){if(_0x5d2064['hasOwnProperty'](_0x46a657)&&_['isString'](_0x5d2064[_0x46a657])){this['channel']['setVariable'](util[_0xd138('0x22')]('AWS_LEX_%s',_0x46a657[_0xd138('0xe9')]()),_0x5d2064[_0x46a657]);}}if(_['isNil'](_0x5d2064['message'])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x123'));}else{this[_0xd138('0x38')](_0x5d2064[_0xd138('0x6a')],_0xd138('0xe0'),'amazonlex','');return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')]('Amazon\x20Lex\x20Result\x20%s',_0x5d2064[_0xd138('0x6a')]));}}return this[_0xd138('0x2e')][_0xd138('0x24')](_0x208390,_0xd138('0x124'));};AGIVertices[_0xd138('0x13')][_0xd138('0x125')]=function(_0x409de3){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x126'),_0x409de3[_0xd138('0x30')],_0x409de3['timeout']));if(!this['isConfigured'](_0x409de3['key'])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xdc'));}var _0x58b73e=_0xd138('0x127');var _0x1e0e87=util[_0xd138('0x22')](_0xd138('0x128'),FILES_PATH,rs['generate'](0x4));var _0x2670de=util['format']('%s.%s',_0x1e0e87,_0x58b73e);var _0x2bd0ac=!![];if(_0x409de3['beep']===_0xd138('0x129')){_0x2bd0ac=![];}var _0xdb93f5=this[_0xd138('0x2e')][_0xd138('0x12a')](_0x1e0e87,_0x58b73e,_0x409de3['intKey'],_0x409de3[_0xd138('0x5b')],undefined,_0x2bd0ac);if(_0xdb93f5[_0xd138('0x99')]!==-0x1){this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')]('google\x20%s\x20file\x20created',_0x2670de));var _0xe4e811=this[_0xd138('0x82')]['sync'](this,_0x409de3,_0x2670de);if(_0xe4e811){for(var _0x595d30 in _0xe4e811){if(_0xe4e811[_0xd138('0x89')](_0x595d30)){this[_0xd138('0x2e')][_0xd138('0x93')](util['format'](_0xd138('0x12b'),_0x595d30[_0xd138('0xe9')]()),_0xe4e811[_0x595d30]);}}return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x12c'),JSON[_0xd138('0x66')](_0xe4e811)));}}return _0xdb93f5;};AGIVertices[_0xd138('0x13')][_0xd138('0x12d')]=function(_0x496703){logger['info'](util[_0xd138('0x22')](_0xd138('0x12e'),_0x496703[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x496703[_0xd138('0x85')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x12f'));}if(!this[_0xd138('0x79')](_0x496703[_0xd138('0x86')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x130'));}var _0x152e9c=_0xd138('0x127');var _0x32e04d=util[_0xd138('0x22')]('%s/recordings/%s',FILES_PATH,rs[_0xd138('0x114')](0x4));var _0x2eaf70=util[_0xd138('0x22')](_0xd138('0x92'),_0x32e04d,_0x152e9c);var _0x3986f5=!![];if(_0x496703[_0xd138('0x131')]===_0xd138('0x129')){_0x3986f5=![];}var _0x1aa62a=this[_0xd138('0x2e')][_0xd138('0x12a')](_0x32e04d,_0x152e9c,_0x496703[_0xd138('0x132')],_0x496703['timeout'],undefined,_0x3986f5);if(_0x1aa62a['result']!==-0x1){this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x133'),_0x2eaf70));var _0x4bf1b5=this[_0xd138('0x84')][_0xd138('0x63')](this,_0x496703,_0x2eaf70);if(_0x4bf1b5){for(var _0x189ade in _0x4bf1b5){if(_0x4bf1b5[_0xd138('0x89')](_0x189ade)){this[_0xd138('0x2e')][_0xd138('0x93')](util[_0xd138('0x22')]('TILDE_ASR_%s',_0x189ade[_0xd138('0xe9')]()),_0x4bf1b5[_0x189ade]);}}return this['channel'][_0xd138('0x9f')](util['format'](_0xd138('0x134'),JSON['stringify'](_0x4bf1b5)));}}return _0x1aa62a;};AGIVertices[_0xd138('0x13')]['gotoc']=function(_0x12816b){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x135'),_0x12816b[_0xd138('0x30')]));return this[_0xd138('0x2e')][_0xd138('0x136')](_0x12816b[_0xd138('0x35')],_0x12816b[_0xd138('0x36')],_0x12816b[_0xd138('0x137')]);};AGIVertices[_0xd138('0x13')][_0xd138('0x138')]=function(_0x22b5b4){logger['info'](util[_0xd138('0x22')](_0xd138('0x139'),_0x22b5b4[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x22b5b4[_0xd138('0x13a')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x22b5b4,_0xd138('0x13b'));}try{var _0x44f177=eval(_0x22b5b4[_0xd138('0x13a')])?_0xd138('0x13c'):'false';this[_0xd138('0x2e')][_0xd138('0x9f')](util['format'](_0xd138('0x13d'),_0x22b5b4[_0xd138('0x13a')],_0x44f177));return{'code':0xc8,'result':_0x44f177};}catch(_0x3d33f3){return{'code':0xc8,'result':_0xd138('0x13e')};}};AGIVertices[_0xd138('0x13')]['gotoiftime']=function(_0x2dda1c){logger['info'](util['format'](_0xd138('0x13f'),_0x2dda1c['label']));if(!this[_0xd138('0x79')](_0x2dda1c[_0xd138('0x140')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x2dda1c,_0xd138('0x141'));}var _0x19e8dc=this[_0xd138('0x142')][_0xd138('0x63')](this,_0x2dda1c['interval_id']);if(!_0x19e8dc){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x2dda1c,_0xd138('0x143'));}for(var _0x57e478=0x0;_0x57e478<_0x19e8dc['length'];_0x57e478+=0x1){var _0x3cf435=this[_0xd138('0x2e')][_0xd138('0xf')](util[_0xd138('0x22')]('IFTIME(%s?true:false)',_0x19e8dc[_0x57e478]));if(_0x3cf435[_0xd138('0x99')]===-0x1){return _0x3cf435;}logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x144'),_0x19e8dc[_0x57e478],_0x3cf435['extra']));if(_0x3cf435[_0xd138('0x96')]===_0xd138('0x13c')){logger['info'](util[_0xd138('0x22')](_0xd138('0x144'),_0x19e8dc[_0x57e478],_0xd138('0x13c')));this[_0xd138('0x2e')][_0xd138('0x9f')](util['format'](_0xd138('0x144'),_0x19e8dc[_0x57e478],_0xd138('0x13c')));return{'code':0xc8,'result':_0xd138('0x13c')};}else{logger['info'](util[_0xd138('0x22')](_0xd138('0x144'),_0x19e8dc[_0x57e478],'false'));this[_0xd138('0x2e')]['noop'](util['format'](_0xd138('0x144'),_0x19e8dc[_0x57e478],'false'));}}return{'code':0xc8,'result':_0xd138('0x13e')};};AGIVertices[_0xd138('0x13')]['hangup']=function(_0x51b1c6){logger[_0xd138('0x26')](util['format'](_0xd138('0x145'),_0x51b1c6[_0xd138('0x30')]));return this['channel'][_0xd138('0x146')]();};AGIVertices['prototype'][_0xd138('0x147')]=function(_0x51bc2d){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x148'),_0x51bc2d[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x51bc2d[_0xd138('0x74')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xdc'));}var _0x5dcd1f=_0xd138('0x127');var _0xe02b1=util[_0xd138('0x22')](_0xd138('0x128'),FILES_PATH,rs['generate'](0x4));var _0x4989e4=util[_0xd138('0x22')](_0xd138('0x92'),_0xe02b1,_0x5dcd1f);var _0x5d948c=!![];if(_0x51bc2d['beep']===_0xd138('0x129')){_0x5d948c=![];}var _0x349612=this['channel'][_0xd138('0x12a')](_0xe02b1,_0x5dcd1f,_0x51bc2d['intKey'],_0x51bc2d[_0xd138('0x5b')],undefined,_0x5d948c);if(_0x349612[_0xd138('0x99')]!==-0x1){this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x149'),_0x4989e4));var _0x5083dc=this[_0xd138('0x77')][_0xd138('0x63')](this,_0x51bc2d,_0x4989e4);if(_0x5083dc){for(var _0x1c463e in _0x5083dc){if(_0x5083dc['hasOwnProperty'](_0x1c463e)){this[_0xd138('0x2e')][_0xd138('0x93')](util[_0xd138('0x22')](_0xd138('0x14a'),_0x1c463e[_0xd138('0xe9')]()),_0x5083dc[_0x1c463e]);}}return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x14b'),JSON[_0xd138('0x66')](_0x5083dc)));}}return _0x349612;};AGIVertices[_0xd138('0x13')][_0xd138('0x14c')]=function(_0xe9b161){logger[_0xd138('0x26')](util['format'](_0xd138('0x14d'),_0xe9b161['label']));if(!this['isConfigured'](_0xe9b161[_0xd138('0x74')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xdc'));}if(!this[_0xd138('0x79')](_0xe9b161['text'])){return this['channel'][_0xd138('0x9f')](_0xd138('0x9d'));}this['channel'][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x14e'),_0xe9b161[_0xd138('0x51')]));var _0x4f4a73=this[_0xd138('0x73')][_0xd138('0x63')](this,_0xe9b161);if(_0x4f4a73){this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x149'),_0x4f4a73));var _0x4ad507=this[_0xd138('0x2e')][_0xd138('0x11c')](_0x4f4a73,_0xe9b161[_0xd138('0x132')]);try{fs[_0xd138('0xf6')](_0x4f4a73+'.wav');}catch(_0x58f778){logger['error'](_0x58f778);}return _0x4ad507;}return this[_0xd138('0x2e')][_0xd138('0x24')](_0xe9b161,_0xd138('0x14f'));};AGIVertices[_0xd138('0x13')][_0xd138('0x150')]=function(_0x10c6be){logger[_0xd138('0x26')](util['format'](_0xd138('0x151'),_0x10c6be[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x10c6be['findBy'])){return this['channel'][_0xd138('0x24')](_0x10c6be,'no\x20find\x20by\x20configured');}logger['info'](util[_0xd138('0x22')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel'][_0xd138('0x33')],_0x10c6be[_0xd138('0x152')]));var _0x459905=this[_0xd138('0x48')]['sync'](this,_0x10c6be[_0xd138('0x152')]);if(_0x459905){logger['info'](util[_0xd138('0x22')](_0xd138('0x153'),this['channel'][_0xd138('0x33')],_0x10c6be['findBy']));this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')](_0xd138('0x153'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x10c6be[_0xd138('0x152')]));return{'code':0xc8,'result':_0xd138('0x154')};}else{logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x155'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x10c6be[_0xd138('0x152')]));this[_0xd138('0x2e')]['noop'](util['format'](_0xd138('0x155'),this[_0xd138('0x2e')]['callerid'],_0x10c6be['findBy']));return{'code':0xc8,'result':_0xd138('0x156')};}};AGIVertices[_0xd138('0x13')][_0xd138('0x157')]=function(_0x24d862){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x158'),_0x24d862[_0xd138('0x30')]));if(!this['isConfigured'](_0x24d862['findBy'])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x24d862,_0xd138('0x159'));}logger[_0xd138('0x26')](util[_0xd138('0x22')]('FIND\x20AGENT\x20%s\x20BY\x20%s',this['channel']['callerid'],_0x24d862[_0xd138('0x152')]));var _0x335aa9=this['agentLogout'][_0xd138('0x63')](this,_0x24d862[_0xd138('0x152')]);if(_0x335aa9){logger[_0xd138('0x26')](util['format'](_0xd138('0x153'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x24d862[_0xd138('0x152')]));this['channel'][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x153'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x24d862[_0xd138('0x152')]));return{'code':0xc8,'result':_0xd138('0x154')};}else{logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x155'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x24d862[_0xd138('0x152')]));this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x155'),this['channel']['callerid'],_0x24d862[_0xd138('0x152')]));return{'code':0xc8,'result':_0xd138('0x156')};}};AGIVertices[_0xd138('0x13')]['math']=function(_0x20f261){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x15a'),_0x20f261['label']));if(!this['isConfigured'](_0x20f261['operation'])){return this[_0xd138('0x2e')]['error'](_0x20f261,_0xd138('0x15b'));}this['channel'][_0xd138('0x9f')](util['format'](_0xd138('0x15c'),_0x20f261[_0xd138('0x15d')]));var _0x49e3ce=eval(_0x20f261[_0xd138('0x15d')]);if(!this[_0xd138('0x79')](_0x20f261[_0xd138('0xcd')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0xce'));}var _0x434680=this[_0xd138('0xf')][_0xd138('0x63')](this,_0x20f261[_0xd138('0xcd')]);if(!_0x434680){return this[_0xd138('0x2e')]['error'](_0x20f261,_0xd138('0xcf'));}if(_[_0xd138('0x8d')](_0x49e3ce)){var _0x51db0f=this;_0x49e3ce[_0xd138('0xd0')](function(_0x191c46,_0x1d5e14){_0x51db0f[_0xd138('0x2e')][_0xd138('0x93')](util[_0xd138('0x22')](_0xd138('0x15e'),_0x434680,_0x1d5e14),_0x191c46);});return this[_0xd138('0x2e')]['noop'](util[_0xd138('0x22')](_0xd138('0x15f'),_0x434680));}else{return this[_0xd138('0x2e')][_0xd138('0x93')](_0x434680,_0x49e3ce);}};AGIVertices[_0xd138('0x13')]['menu']=function(_0x1b2bd2){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x160'),_0x1b2bd2[_0xd138('0x30')]));if(_0x1b2bd2[_0xd138('0x107')]===0x0){return this[_0xd138('0x9a')](_0x1b2bd2);}_0x1b2bd2[_0xd138('0x107')]-=0x1;if(!this[_0xd138('0x79')](_0x1b2bd2[_0xd138('0x10a')])){return this[_0xd138('0x2e')]['error'](_0x1b2bd2,_0xd138('0x108'));}var _0x4526fc=this['getSound'][_0xd138('0x63')](this,_0x1b2bd2['file_id']);if(!_0x4526fc){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x1b2bd2,_0xd138('0x10b'));}var _0x1075df=this[_0xd138('0x2e')][_0xd138('0x10c')](_0x4526fc,_0x1b2bd2[_0xd138('0x10d')],_0x1b2bd2[_0xd138('0x161')]);var _0x1f4ebe=_0x1075df[_0xd138('0x99')];if(_0x1075df[_0xd138('0x99')]===-0x1){this[_0xd138('0x2d')][_0xd138('0x63')](this,_0x1b2bd2,'-1');return _0x1075df;}else if(_0x1075df[_0xd138('0x96')]===_0xd138('0x5b')){_0x1075df[_0xd138('0x99')]=_0x1075df[_0xd138('0x99')][_0xd138('0x8e')]>0x0?_0x1075df[_0xd138('0x99')]:'t';}else if(_[_0xd138('0x3a')](_0x1075df[_0xd138('0x99')])){_0x1075df['result']='#';_0x1f4ebe='#';}if(!this[_0xd138('0x79')](_0x1b2bd2[_0xd138('0xcd')])){this['channel'][_0xd138('0x9f')](_0xd138('0xce'));}else{var _0x56d906=this[_0xd138('0xf')][_0xd138('0x63')](this,_0x1b2bd2[_0xd138('0xcd')]);if(!_0x56d906){return this['channel'][_0xd138('0x24')](_0x1b2bd2,_0xd138('0xcf'));}this[_0xd138('0x2e')][_0xd138('0x93')](_0x56d906,_0x1f4ebe);}this[_0xd138('0x2d')][_0xd138('0x63')](this,_0x1b2bd2,_0x1f4ebe);return _0x1075df;};AGIVertices['prototype']['noop']=function(_0xe9076c){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x162'),_0xe9076c[_0xd138('0x30')]));return this[_0xd138('0x2e')]['noop'](_0xe9076c[_0xd138('0x163')]||_0xe9076c[_0xd138('0x30')]);};AGIVertices[_0xd138('0x13')][_0xd138('0x164')]=function(_0x4d1704){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x165'),_0x4d1704['label']));if(!this[_0xd138('0x79')](_0x4d1704[_0xd138('0x152')])){return this[_0xd138('0x2e')]['error'](_0x4d1704,'no\x20find\x20by\x20configured');}logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x166'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x4d1704[_0xd138('0x152')]));var _0x3ad11f=this[_0xd138('0x43')][_0xd138('0x63')](this,_0x4d1704[_0xd138('0x167')]);var _0x279dc3=this[_0xd138('0x45')][_0xd138('0x63')](this,_0x4d1704[_0xd138('0x152')],_0x3ad11f);if(_0x279dc3){logger[_0xd138('0x26')](util[_0xd138('0x22')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd138('0x2e')][_0xd138('0x33')],_0x4d1704[_0xd138('0x152')]));this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x153'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x4d1704[_0xd138('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x155'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x4d1704[_0xd138('0x152')]));this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x153'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x4d1704[_0xd138('0x152')]));return{'code':0xc8,'result':_0xd138('0x156')};}};AGIVertices[_0xd138('0x13')]['playback']=function(_0x1040ba){logger[_0xd138('0x26')](util['format'](_0xd138('0x168'),_0x1040ba['label']));if(!this[_0xd138('0x79')](_0x1040ba[_0xd138('0x10a')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x1040ba,'no\x20file\x20audio\x20selected');}var _0x5be05a=this[_0xd138('0x109')]['sync'](this,_0x1040ba[_0xd138('0x10a')]);if(!_0x5be05a){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x1040ba,_0xd138('0x10b'));}var _0x47845c=this['channel'][_0xd138('0x4c')](_0xd138('0x169'),[_0x5be05a,_0x1040ba[_0xd138('0xd8')]]);if(_0x47845c['result']===-0x1){return _0x47845c;}return this[_0xd138('0x2e')][_0xd138('0x9f')](util['format'](_0xd138('0xb8'),_0xd138('0x169'),_0x5be05a));};AGIVertices[_0xd138('0x13')]['queue']=function(_0x436cda){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x16a'),_0x436cda['label']));if(!this[_0xd138('0x79')](_0x436cda['queue_id'])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x436cda,_0xd138('0x16b'));}var _0x449dc7='';var _0x2fed8e=parseInt(_0x436cda[_0xd138('0x16c')],0xa);if(isNaN(_0x2fed8e)){_0x449dc7=_0x436cda[_0xd138('0x16c')];}else{_0x449dc7=this[_0xd138('0x14')][_0xd138('0x63')](this,_0x436cda['queue_id']);if(!_0x449dc7){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x436cda,_0xd138('0x16d'));}}var _0x5cf006='';if(this[_0xd138('0x79')](_0x436cda[_0xd138('0x10a')])){var _0x72ed74=this[_0xd138('0x109')][_0xd138('0x63')](this,_0x436cda[_0xd138('0x10a')]);if(_0x72ed74){_0x5cf006=_0x72ed74;}}this['createSquareDetailsReport'][_0xd138('0x63')](this,_0x436cda,_0x449dc7);if(_0x436cda[_0xd138('0xd8')]['indexOf']('x')<0x0){_0x436cda['opts']+='x';}if(_0x436cda[_0xd138('0xd8')][_0xd138('0x16e')]('X')<0x0){_0x436cda['opts']+='X';}this[_0xd138('0x2e')][_0xd138('0x93')]('XMCS-QUEUE',_0x449dc7?_0x449dc7[_0xd138('0x16f')]():'');var _0x466c27=this[_0xd138('0x2e')]['exec']('QUEUE',[_0x449dc7,_0x436cda['opts'],_0x436cda[_0xd138('0x58')],_0x5cf006,_0x436cda[_0xd138('0x5b')],_0x436cda[_0xd138('0xab')],_0x436cda[_0xd138('0x170')],_0x436cda[_0xd138('0x171')],'',_0x436cda['position']]);if(_0x466c27[_0xd138('0x99')]===-0x1){return _0x466c27;}return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0xb8'),_0xd138('0x172'),_0x449dc7));};AGIVertices[_0xd138('0x13')][_0xd138('0x173')]=function(_0x3306be){logger[_0xd138('0x26')](util['format'](_0xd138('0x174'),_0x3306be['label']));var _0x45189f=_0x3306be[_0xd138('0x175')]||_0xd138('0x127');var _0x54ad48=util[_0xd138('0x22')](_0xd138('0x176'),this['channel'][_0xd138('0x2f')],rs[_0xd138('0x114')](0x5));var _0x1445a0=util[_0xd138('0x22')]('%s/recordings/%s.%s',FILES_PATH,_0x54ad48,_0x45189f);var _0x14fac3=util[_0xd138('0x22')]('%s/recordings/%s',FILES_PATH,_0x54ad48);this[_0xd138('0x34')][_0xd138('0x63')](this,_0x3306be,_0x54ad48,_0x1445a0);this['channel']['setVariable'](_0xd138('0x177'),_0x54ad48);logger['info']('Recording\x20%s\x20%s\x20%s\x20%s',_0x14fac3,_0x45189f,_0x3306be[_0xd138('0x178')],_0x3306be['timeout']);return this[_0xd138('0x2e')][_0xd138('0x12a')](_0x14fac3,_0x45189f,_0x3306be[_0xd138('0x178')],_0x3306be[_0xd138('0x5b')],undefined,!![]);};AGIVertices[_0xd138('0x13')][_0xd138('0x179')]=function(_0x5dabac){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x17a'),_0x5dabac[_0xd138('0x30')]));if(!this['isConfigured'](_0x5dabac[_0xd138('0x58')])){return this[_0xd138('0x2e')]['noop']('no\x20url\x20configured');}var _0x20a239=this[_0xd138('0x57')]['sync'](this,_0x5dabac);logger[_0xd138('0x26')](util['format'](_0xd138('0x17b'),util[_0xd138('0x17c')](_0x20a239,{'showHidden':![],'depth':null})));if(!this[_0xd138('0x79')](_0x5dabac[_0xd138('0xcd')])){return this[_0xd138('0x2e')]['noop'](_0xd138('0x17d'));}var _0x1944a5=this['getVariable'][_0xd138('0x63')](this,_0x5dabac['variable_id']);if(!_0x1944a5){return this[_0xd138('0x2e')]['error'](_0x5dabac,_0xd138('0xcf'));}this[_0xd138('0x2e')][_0xd138('0x93')](util[_0xd138('0x22')](_0xd138('0x17e'),_0x1944a5),_0x20a239['statusCode']?_0x20a239[_0xd138('0x68')]:_0xd138('0x17f'));this[_0xd138('0x2e')]['setVariable'](util['format'](_0xd138('0x180'),_0x1944a5),_0x20a239[_0xd138('0x69')]?_0x20a239[_0xd138('0x69')]:'OK');if(_0x20a239[_0xd138('0x5e')]){try{this[_0xd138('0x91')](_0x20a239[_0xd138('0x5e')],_0x1944a5);}catch(_0x47e690){logger['error'](util[_0xd138('0x22')](_0xd138('0x181'),_0x1944a5));}}return this[_0xd138('0x2e')][_0xd138('0x9f')](util['format'](_0xd138('0x182'),_0x1944a5));};AGIVertices[_0xd138('0x13')][_0xd138('0x183')]=function(_0x40902a){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x184'),_0x40902a['label']));return this['channel'][_0xd138('0x185')](_0x40902a[_0xd138('0x186')][_0xd138('0xca')](/\s+/g,''),_0x40902a['escape_digits']);};AGIVertices['prototype'][_0xd138('0x187')]=function(_0x70209e){logger['info'](util[_0xd138('0x22')](_0xd138('0x188'),_0x70209e[_0xd138('0x30')]));return this[_0xd138('0x2e')][_0xd138('0x189')](_0x70209e['number'][_0xd138('0xca')](/\s+/g,''),_0x70209e[_0xd138('0x178')]);};AGIVertices[_0xd138('0x13')][_0xd138('0x18a')]=function(_0x341433){logger[_0xd138('0x26')](util['format'](_0xd138('0x18b'),_0x341433[_0xd138('0x30')]));return this[_0xd138('0x2e')][_0xd138('0x18c')](_0x341433[_0xd138('0x51')],_0x341433[_0xd138('0x178')]);};AGIVertices[_0xd138('0x13')]['sendMail']=function(_0x13709f){logger['info'](util['format'](_0xd138('0x18d'),_0x13709f[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x13709f[_0xd138('0x18e')])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x18f'));}var _0x36d0eb=this['getMailAccount']['sync'](this,_0x13709f[_0xd138('0x18e')]);if(!_0x36d0eb||!_0x36d0eb[_0xd138('0x190')]){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x13709f,'no\x20mail\x20account\x20found');}var _0x17b4fe={'from':util['format'](_0xd138('0x191'),_0x36d0eb[_0xd138('0x11')],_0x36d0eb[_0xd138('0x192')]||_0x36d0eb['Smtp'][_0xd138('0x193')]),'to':_0x13709f['to']||'','cc':_0x13709f['cc']||'','bcc':_0x13709f[_0xd138('0x194')]||'','subject':_0x13709f['subject'],'html':_0x13709f['text'],'text':_0x13709f[_0xd138('0x51')]};if(this['isConfigured'](_0x13709f['template_id'])){}logger[_0xd138('0x195')](_0xd138('0x196'),JSON['stringify'](_0x17b4fe));this[_0xd138('0x2d')]['sync'](this,_0x13709f,_0x13709f[_0xd138('0x18e')]);this[_0xd138('0x2e')][_0xd138('0x9f')](util['format']('Trying\x20SendMail\x20with\x20account\x20%s',_0x36d0eb[_0xd138('0x11')]));this[_0xd138('0x1d')]['sync'](this,_0x36d0eb[_0xd138('0x197')],_0x17b4fe);return this['channel'][_0xd138('0x9f')](_0xd138('0x198'));};AGIVertices[_0xd138('0x13')]['sendFax']=function(_0x5f008a){logger['info'](util[_0xd138('0x22')](_0xd138('0x199'),_0x5f008a['label']));return this[_0xd138('0x2e')]['noop'](_0xd138('0x19a'));};AGIVertices[_0xd138('0x13')]['sendSMS']=function(_0x104685){logger['info'](util[_0xd138('0x22')](_0xd138('0x19b'),_0x104685[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x104685['sms_account_id'])){return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x19c'));}var _0x32d046=this[_0xd138('0x19d')]['sync'](this,_0x104685[_0xd138('0x19e')]);if(!_0x32d046){return this['channel'][_0xd138('0x24')](_0x104685,'no\x20sms\x20account\x20found');}var _0x36feff={'body':_0x104685['sms_text'],'phone':_0x104685['to']||'','SmsAccountId':_0x32d046['id']};logger[_0xd138('0x195')](_0xd138('0x19f'),JSON[_0xd138('0x66')](_0x36feff));this['createSquareDetailsReport']['sync'](this,_0x104685,_0x104685['sms_account_id']);this['channel'][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x1a0'),_0x32d046[_0xd138('0x11')]));this[_0xd138('0x2c')][_0xd138('0x63')](this,_0x36feff);return this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x1a1'));};AGIVertices[_0xd138('0x13')]['set']=function(_0x3c078d){logger[_0xd138('0x26')](util['format'](_0xd138('0x1a2'),_0x3c078d[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x3c078d[_0xd138('0xcd')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x3c078d,_0xd138('0x1a3'));}var _0x1524b3=this['getVariable']['sync'](this,_0x3c078d[_0xd138('0xcd')]);if(!_0x1524b3){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x3c078d,'no\x20variable\x20found');}return this[_0xd138('0x2e')]['setVariable'](_0x1524b3,_0x3c078d[_0xd138('0x1a4')]);};AGIVertices[_0xd138('0x13')]['start']=function(_0x2219d4){logger['info'](util[_0xd138('0x22')](_0xd138('0x1a5'),_0x2219d4['label']));this[_0xd138('0x2e')][_0xd138('0x9f')]('START\x20CALLY\x20SQUARE');if(_0x2219d4[_0xd138('0xad')]===_0xd138('0x1a6')){this[_0xd138('0x2e')][_0xd138('0x9f')](_0xd138('0x1a7'));return this[_0xd138('0x2e')][_0xd138('0xad')]();}return this[_0xd138('0x2e')]['noop'](_0xd138('0x1a8'));};AGIVertices[_0xd138('0x13')][_0xd138('0x1a9')]=function(_0x2115e9){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x1aa'),_0x2115e9[_0xd138('0x30')]));if(!this['isConfigured'](_0x2115e9['project_id'])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x2115e9,_0xd138('0x1ab'));}var _0x406f48=this[_0xd138('0x1ac')][_0xd138('0x63')](this,_0x2115e9[_0xd138('0x1ad')]);if(!this[_0xd138('0x79')](_0x406f48)){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x2115e9,util[_0xd138('0x22')](_0xd138('0x1ae'),_0x2115e9['project_id']));}if(_0x406f48===this[_0xd138('0x2e')]['arg_1']){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x2115e9,_0xd138('0x1af'));}this[_0xd138('0x2d')][_0xd138('0x63')](this,_0x2115e9,_0x406f48);var _0x46e9b7=this[_0xd138('0x2e')][_0xd138('0x4c')](_0xd138('0x1b0'),util['format'](_0xd138('0x1b1'),config['agi'][_0xd138('0x1b2')]||'127.0.0.1',_0x406f48,this['channel']['arg_1']));if(_0x46e9b7[_0xd138('0x99')]===-0x1){return _0x46e9b7;}return this['channel'][_0xd138('0x9f')](util['format']('Executed\x20command\x20%s\x20%s',_0xd138('0x1b0'),_0x406f48));};AGIVertices[_0xd138('0x13')][_0xd138('0x1b3')]=function(_0x28f212){logger[_0xd138('0x26')](util[_0xd138('0x22')]('Enter\x20in\x20SYSTEM\x20(%s)\x20block',_0x28f212['label']));var _0x3aa216=this[_0xd138('0x4b')]['sync'](this,_0x28f212[_0xd138('0xac')]);this[_0xd138('0x2d')][_0xd138('0x63')](this,_0x28f212,_0x28f212[_0xd138('0xac')]);if(this[_0xd138('0x79')](_0x28f212[_0xd138('0xcd')])){var _0x56fef7=this[_0xd138('0xf')]['sync'](this,_0x28f212[_0xd138('0xcd')]);if(_0x56fef7){this[_0xd138('0x2e')][_0xd138('0x93')](_0x56fef7,_0x3aa216);return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x1b4'),_0x28f212[_0xd138('0xac')],_0x56fef7));}}return this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')]('sh\x20command:\x20%s\x20result\x20no\x20stored',_0x28f212['command']));};AGIVertices['prototype']['google_cloud_tts']=function(_0x5f495b){logger[_0xd138('0x26')](util['format'](_0xd138('0x1b5'),_0x5f495b[_0xd138('0x30')]));_0x5f495b[_0xd138('0x51')]=_0x5f495b[_0xd138('0x51')][_0xd138('0xca')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd138('0x79')](_0x5f495b[_0xd138('0x4f')])){return this[_0xd138('0x2e')]['noop'](_0xd138('0x1b6'));}if(!this['isConfigured'](_0x5f495b[_0xd138('0x51')])){return this[_0xd138('0x2e')][_0xd138('0x9f')]('no\x20text\x20configured');}this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')]('Trying\x20Google\x20Cloud\x20TTS\x20%s',_0x5f495b[_0xd138('0x51')]));var _0x3f72b5=this[_0xd138('0x4e')][_0xd138('0x63')](this,_0x5f495b);if(_0x3f72b5){this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x1b7'),_0x3f72b5));var _0x1ac579=this[_0xd138('0x2e')][_0xd138('0x11c')](_0x3f72b5);try{fs['unlink'](_0x3f72b5+_0xd138('0xf7'));}catch(_0x1bbb21){logger[_0xd138('0x24')](_0x1bbb21);}return _0x1ac579;}return this[_0xd138('0x2e')][_0xd138('0x24')](_0x5f495b,_0xd138('0x1b8'));};AGIVertices[_0xd138('0x13')][_0xd138('0x1b9')]=function(_0x5d4689){logger['info'](util['format']('Enter\x20in\x20GOOGLETTS\x20(%s)\x20block',_0x5d4689[_0xd138('0x30')]));_0x5d4689[_0xd138('0x51')]=_0x5d4689['text'][_0xd138('0xca')](/(\r\n|\n|\r)/gm,'\x20');if(!this[_0xd138('0x79')](_0x5d4689[_0xd138('0x51')])){return this[_0xd138('0x2e')]['noop'](_0xd138('0x9d'));}this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')]('Trying\x20Google\x20TTS\x20%s',_0x5d4689['text']));var _0x15c255=this[_0xd138('0x1ba')]['sync'](this,_0x5d4689);if(_0x15c255){this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x1bb'),_0x15c255));var _0x28fc7d=this['channel'][_0xd138('0x11c')](_0x15c255);try{fs[_0xd138('0xf6')](_0x15c255+_0xd138('0xf7'));}catch(_0x7afedf){logger[_0xd138('0x24')](_0x7afedf);}return _0x28fc7d;}return this[_0xd138('0x2e')][_0xd138('0x24')](_0x5d4689,'Google\x20TTS\x20is\x20unreachable');};AGIVertices[_0xd138('0x13')][_0xd138('0x1bc')]=function(_0x2b6f44){logger['info'](util[_0xd138('0x22')](_0xd138('0x1bd'),_0x2b6f44[_0xd138('0x30')]));if(!this['isConfigured'](_0x2b6f44[_0xd138('0x152')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x2b6f44,_0xd138('0x159'));}logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x166'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x2b6f44[_0xd138('0x152')]));var _0x4157fe=this[_0xd138('0x47')][_0xd138('0x63')](this,_0x2b6f44['findBy']);if(_0x4157fe){logger['info'](util[_0xd138('0x22')]('AGENT\x20%s\x20FOUND\x20BY',this[_0xd138('0x2e')][_0xd138('0x33')],_0x2b6f44[_0xd138('0x152')]));this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x153'),this['channel'][_0xd138('0x33')],_0x2b6f44[_0xd138('0x152')]));return{'code':0xc8,'result':'success'};}else{logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x155'),this[_0xd138('0x2e')][_0xd138('0x33')],_0x2b6f44[_0xd138('0x152')]));this[_0xd138('0x2e')][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0x155'),this[_0xd138('0x2e')]['callerid'],_0x2b6f44[_0xd138('0x152')]));return{'code':0xc8,'result':_0xd138('0x156')};}};AGIVertices[_0xd138('0x13')]['voicemail']=function(_0x4c2581){logger[_0xd138('0x26')](util[_0xd138('0x22')](_0xd138('0x1be'),_0x4c2581['label']));var _0x55c6f8=this['channel'][_0xd138('0x4c')]('VOICEMAIL',[_0x4c2581[_0xd138('0x1bf')],_0x4c2581[_0xd138('0x6b')]]);if(_0x55c6f8[_0xd138('0x99')]===-0x1){return _0x55c6f8;}return this['channel'][_0xd138('0x9f')](util[_0xd138('0x22')](_0xd138('0xb8'),_0xd138('0x1c0'),_0x4c2581[_0xd138('0x1bf')]));};AGIVertices[_0xd138('0x13')][_0xd138('0x1c1')]=function(_0x4009f0){logger['info'](util['format'](_0xd138('0x1c2'),_0x4009f0[_0xd138('0x30')]));if(!this[_0xd138('0x79')](_0x4009f0[_0xd138('0xcd')])){return this[_0xd138('0x2e')][_0xd138('0x24')](_0x4009f0,_0xd138('0x1a3'));}var _0x52a095=this[_0xd138('0xf')]['sync'](this,_0x4009f0['variable_id']);if(!_0x52a095){return this[_0xd138('0x2e')]['error'](_0x4009f0,_0xd138('0xcf'));}var _0x1ed2c2=this[_0xd138('0x2e')][_0xd138('0xf')](_0x52a095);return{'code':0xc8,'result':_0x1ed2c2['extra']?_0x1ed2c2['extra']:'-'};};String[_0xd138('0x13')][_0xd138('0x95')]=function(_0x3a153a,_0x3312eb){return this['split'](_0x3a153a)['join'](_0x3312eb);};module[_0xd138('0x1c3')]=AGIVertices; \ No newline at end of file diff --git a/server/services/ami/acw/index.js b/server/services/ami/acw/index.js index b2afff2..f2a4f82 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 _0xd6c8=['isNil','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereeuniqueid','transfereruniqueid','[%s][BLINDTRANSFER:LINKEDID]','transfererlinkedid','autopause','all','[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]','savePause','Auto-Pause','lodash','moment','../ami','../../../config/logger','acw','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','syncHangupRequest','hangup','syncHangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','custom:agentConnectPreview','syncAgentConnectPreview','milliseconds','diff','seconds','prototype','interface','queue','mandatoryDisposition','name','mandatoryDispositionPause','QueuePause','getAgent','voicePause','info','attended','destlinkedid','then','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','acwTimeout','timer','lastPauseAt','format','uniqueid','[%s][UPDATE][ACWTIME:%s]','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[ACW][START]\x20%s','message','stopAcw','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','update','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','[ACW][TIMERS]','stringify','[ACW][STOP]\x20%s','[ACW][syncAgentConnect]\x20%s','[ACW][syncAgentConnectPreview]\x20%s','isUndefined','[%s][HANGUP:UNIQUEID]','startAcw','linkedid','[%s][HANGUP:LINKEDID]','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]'];(function(_0x56e4e7,_0x1db098){var _0x383618=function(_0xb088c6){while(--_0xb088c6){_0x56e4e7['push'](_0x56e4e7['shift']());}};_0x383618(++_0x1db098);}(_0xd6c8,0x15d));var _0x8d6c=function(_0xf04c6d,_0xe98786){_0xf04c6d=_0xf04c6d-0x0;var _0x4a804e=_0xd6c8[_0xf04c6d];return _0x4a804e;};'use strict';var _=require(_0x8d6c('0x0'));var moment=require(_0x8d6c('0x1'));var ami=require(_0x8d6c('0x2'));var logger=require(_0x8d6c('0x3'))(_0x8d6c('0x4'));var RpcUser=require('../rpc/user');var RpcVoiceAgentReport=require(_0x8d6c('0x5'));function Acw(_0x2ea0fa){this[_0x8d6c('0x6')]=_0x2ea0fa[_0x8d6c('0x6')];this[_0x8d6c('0x7')]=_0x2ea0fa['agents'];this[_0x8d6c('0x8')]=_0x2ea0fa[_0x8d6c('0x8')];this[_0x8d6c('0x9')]={};ami['on'](_0x8d6c('0xa'),this[_0x8d6c('0xb')][_0x8d6c('0xc')](this));ami['on'](_0x8d6c('0xd'),this[_0x8d6c('0xe')][_0x8d6c('0xc')](this));ami['on'](_0x8d6c('0xf'),this[_0x8d6c('0x10')]['bind'](this));ami['on'](_0x8d6c('0x11'),this[_0x8d6c('0x12')][_0x8d6c('0xc')](this));ami['on']('attendedtransfer',this[_0x8d6c('0x13')][_0x8d6c('0xc')](this));ami['on'](_0x8d6c('0x14'),this[_0x8d6c('0x15')]['bind'](this));ami['on'](_0x8d6c('0x16'),this[_0x8d6c('0x17')][_0x8d6c('0xc')](this));}function getDiff(_0x24cf46){var _0x2a02ac=moment()[_0x8d6c('0x18')](0x0);var _0x351b47=moment(_0x24cf46)['milliseconds'](0x0);return _0x2a02ac[_0x8d6c('0x19')](_0x351b47,_0x8d6c('0x1a'));}Acw[_0x8d6c('0x1b')]['startAcw']=function(_0x49436e){try{var _0x4049ca=this;var _0x3400ef=this[_0x8d6c('0x9')][_0x49436e][_0x8d6c('0x1c')];var _0x28c01e=this['channels'][_0x49436e][_0x8d6c('0x1d')];var _0xc5e719=this['voiceQueues'][_0x28c01e];var _0x4a0268=![];var _0x3c2ff8='ACW';if(_0xc5e719[_0x8d6c('0x1e')]){if(_0xc5e719['mandatoryDispositionPause'][_0x8d6c('0x1f')]){_0x4a0268=!![];_0x3c2ff8=_0xc5e719[_0x8d6c('0x20')][_0x8d6c('0x1f')];}}return ami['Action']({'action':_0x8d6c('0x21'),'interface':_0x3400ef,'paused':!![],'reason':_0x3c2ff8})['then'](function(){if(_0x4049ca['agents'][_0x3400ef]){return RpcUser[_0x8d6c('0x22')](_0x4049ca['agents'][_0x3400ef]['id'])['then'](function(_0x48fc25){if(_0x48fc25&&!_0x48fc25[_0x8d6c('0x23')]){logger[_0x8d6c('0x24')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x49436e,_0x3400ef,_0x28c01e);var _0x3710f6=_0x4049ca['channels'][_0x49436e][_0x8d6c('0x25')]&&_0x4049ca[_0x8d6c('0x9')][_0x49436e][_0x8d6c('0x26')]?_0x4049ca[_0x8d6c('0x9')][_0x49436e][_0x8d6c('0x26')]:_0x49436e;return RpcUser['savePause'](_0x4049ca['agents'][_0x3400ef],_0x3c2ff8,_0x3710f6)[_0x8d6c('0x27')](function(){if(!_0x4a0268){_0x4049ca[_0x8d6c('0x8')][_0x3400ef]={};logger[_0x8d6c('0x24')](_0x8d6c('0x28'),_0x49436e,_0x4049ca[_0x8d6c('0x6')][_0x28c01e][_0x8d6c('0x29')],_0x3400ef,_0x28c01e);_0x4049ca['timers'][_0x3400ef][_0x8d6c('0x2a')]=setTimeout(_0x4049ca['stopAcw'][_0x8d6c('0xc')](_0x4049ca,_0x3400ef),_0x4049ca[_0x8d6c('0x6')][_0x28c01e][_0x8d6c('0x29')]*0x3e8);_0x4049ca[_0x8d6c('0x8')][_0x3400ef][_0x8d6c('0x2b')]=moment()[_0x8d6c('0x2c')]('YYYY-MM-DD\x20HH:mm:ss');_0x4049ca['timers'][_0x3400ef][_0x8d6c('0x2d')]=_0x49436e;_0x4049ca[_0x8d6c('0x8')][_0x3400ef][_0x8d6c('0x1d')]=_0x28c01e;_0x4049ca['timers'][_0x3400ef]['updateAcw']=function(){var _0x23c153=getDiff(_0x4049ca[_0x8d6c('0x8')][_0x3400ef]['lastPauseAt']);clearTimeout(_0x4049ca[_0x8d6c('0x8')][_0x3400ef][_0x8d6c('0x2a')]);_0x4049ca[_0x8d6c('0x8')][_0x3400ef][_0x8d6c('0x2a')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x23c153},_0x4049ca['timers'][_0x3400ef][_0x8d6c('0x2d')],_0x3400ef)[_0x8d6c('0x27')](function(_0x1f1bc4){logger[_0x8d6c('0x24')](_0x8d6c('0x2e'),_0x49436e,_0x23c153,_0x1f1bc4);})[_0x8d6c('0x2f')](function(_0x230ba9){logger['error'](_0x8d6c('0x30'),_0x49436e,_0x230ba9);});delete _0x4049ca['timers'][_0x3400ef];};}});}else{logger[_0x8d6c('0x24')](_0x8d6c('0x31'),_0x49436e,_0x3400ef,_0x28c01e);}});}})['catch'](function(){logger[_0x8d6c('0x32')](_0x8d6c('0x28'),_0x49436e,_0x4049ca['voiceQueues'][_0x28c01e][_0x8d6c('0x29')],_0x3400ef,_0x28c01e);})[_0x8d6c('0x33')](function(){delete _0x4049ca[_0x8d6c('0x9')][_0x49436e];});}catch(_0x4cf36e){logger[_0x8d6c('0x32')](_0x8d6c('0x34'),_0x4cf36e[_0x8d6c('0x35')]);}};Acw[_0x8d6c('0x1b')][_0x8d6c('0x36')]=function(_0x1ba0b0){try{var _0x57670b=this;if(_0x57670b['timers'][_0x1ba0b0]){_0x57670b[_0x8d6c('0x8')][_0x1ba0b0][_0x8d6c('0x2a')]=![];var _0x418a5f=_0x57670b[_0x8d6c('0x8')][_0x1ba0b0][_0x8d6c('0x2d')];var _0x5f4a17=_0x57670b[_0x8d6c('0x8')][_0x1ba0b0][_0x8d6c('0x1d')];var _0x2c9df9=_0x57670b['voiceQueues'][_0x5f4a17][_0x8d6c('0x29')];logger[_0x8d6c('0x24')](_0x8d6c('0x37'),_0x418a5f,_0x1ba0b0);RpcUser[_0x8d6c('0x38')](this[_0x8d6c('0x7')][_0x1ba0b0]);RpcVoiceAgentReport[_0x8d6c('0x39')]({'acwtime':_0x2c9df9,'agentacw':!![]},_0x418a5f,_0x1ba0b0)[_0x8d6c('0x27')](function(_0x4ed9cf){logger[_0x8d6c('0x24')](_0x8d6c('0x2e'),_0x418a5f,_0x2c9df9,_0x4ed9cf);})[_0x8d6c('0x2f')](function(_0x5f3ea8){logger['error'](_0x8d6c('0x30'),_0x418a5f,_0x5f3ea8);});}else{logger[_0x8d6c('0x32')](_0x8d6c('0x3a'),_0x1ba0b0);if(_0x57670b[_0x8d6c('0x8')]){logger['info'](_0x8d6c('0x3b'),JSON[_0x8d6c('0x3c')](_0x57670b[_0x8d6c('0x8')]));}}}catch(_0x3e1a2d){logger[_0x8d6c('0x32')](_0x8d6c('0x3d'),_0x3e1a2d[_0x8d6c('0x35')]);}};Acw['prototype'][_0x8d6c('0xb')]=function(_0x178174){try{if(this[_0x8d6c('0x6')][_0x178174[_0x8d6c('0x1d')]]&&(this[_0x8d6c('0x6')][_0x178174['queue']][_0x8d6c('0x4')]||this[_0x8d6c('0x6')][_0x178174[_0x8d6c('0x1d')]]['mandatoryDisposition'])){if(this[_0x8d6c('0x7')][_0x178174[_0x8d6c('0x1c')]]){this[_0x8d6c('0x9')][_0x178174[_0x8d6c('0x2d')]]={'queue':_0x178174[_0x8d6c('0x1d')],'interface':_0x178174['interface'],'destlinkedid':_0x178174[_0x8d6c('0x26')]};}}}catch(_0x417f47){logger[_0x8d6c('0x32')](_0x8d6c('0x3e'),_0x417f47[_0x8d6c('0x35')]);}};Acw['prototype'][_0x8d6c('0x17')]=function(_0x98c2c5){try{if(this[_0x8d6c('0x6')][_0x98c2c5[_0x8d6c('0x1d')]]&&(this['voiceQueues'][_0x98c2c5[_0x8d6c('0x1d')]]['acw']||this['voiceQueues'][_0x98c2c5['queue']][_0x8d6c('0x1e')])){if(this[_0x8d6c('0x7')][_0x98c2c5[_0x8d6c('0x1c')]]){this['channels'][_0x98c2c5[_0x8d6c('0x2d')]]={'queue':_0x98c2c5[_0x8d6c('0x1d')],'interface':_0x98c2c5['interface']};}}}catch(_0x26956f){logger[_0x8d6c('0x32')](_0x8d6c('0x3f'),_0x26956f['message']);}};Acw[_0x8d6c('0x1b')][_0x8d6c('0xe')]=function(_0x3b52ed){try{if(this[_0x8d6c('0x9')][_0x3b52ed[_0x8d6c('0x2d')]]&&_[_0x8d6c('0x40')](this['channels'][_0x3b52ed[_0x8d6c('0x2d')]][_0x8d6c('0x25')])){logger[_0x8d6c('0x24')](_0x8d6c('0x41'),_0x3b52ed[_0x8d6c('0x2d')]);this[_0x8d6c('0x42')](_0x3b52ed[_0x8d6c('0x2d')]);}else if(this[_0x8d6c('0x9')][_0x3b52ed[_0x8d6c('0x43')]]&&_[_0x8d6c('0x40')](this[_0x8d6c('0x9')][_0x3b52ed[_0x8d6c('0x43')]][_0x8d6c('0x25')])){logger[_0x8d6c('0x24')](_0x8d6c('0x44'),_0x3b52ed[_0x8d6c('0x43')]);this[_0x8d6c('0x42')](_0x3b52ed[_0x8d6c('0x43')]);}}catch(_0x5c3012){logger[_0x8d6c('0x32')]('[ACW][syncHangupRequest]\x20%s',_0x5c3012[_0x8d6c('0x35')]);}};Acw[_0x8d6c('0x1b')][_0x8d6c('0x10')]=function(_0x2fd153){try{if(this[_0x8d6c('0x9')][_0x2fd153[_0x8d6c('0x2d')]]&&this[_0x8d6c('0x9')][_0x2fd153[_0x8d6c('0x2d')]][_0x8d6c('0x25')]){logger[_0x8d6c('0x24')](_0x8d6c('0x45'),_0x2fd153[_0x8d6c('0x2d')]);this[_0x8d6c('0x42')](_0x2fd153[_0x8d6c('0x2d')]);}else if(this['channels'][_0x2fd153[_0x8d6c('0x43')]]&&this['channels'][_0x2fd153[_0x8d6c('0x43')]][_0x8d6c('0x25')]){logger[_0x8d6c('0x24')](_0x8d6c('0x46'),_0x2fd153['linkedid']);this[_0x8d6c('0x42')](_0x2fd153[_0x8d6c('0x43')]);}}catch(_0x50a886){logger[_0x8d6c('0x32')]('[ACW][syncHangup]\x20%s',_0x50a886[_0x8d6c('0x35')]);}};Acw['prototype'][_0x8d6c('0x13')]=function(_0x49b42e){try{if(!_[_0x8d6c('0x47')](this[_0x8d6c('0x9')][_0x49b42e['transfereeuniqueid']])){this['startAcw'](_0x49b42e['transfereeuniqueid']);if(this[_0x8d6c('0x9')][_0x49b42e[_0x8d6c('0x48')]]){this[_0x8d6c('0x9')][_0x49b42e['secondtransfereruniqueid']][_0x8d6c('0x25')]=!![];this[_0x8d6c('0x9')][_0x49b42e[_0x8d6c('0x49')]]=this[_0x8d6c('0x9')][_0x49b42e[_0x8d6c('0x48')]];delete this['channels'][_0x49b42e[_0x8d6c('0x48')]];}}else if(!_[_0x8d6c('0x47')](this[_0x8d6c('0x9')][_0x49b42e['transfertargetuniqueid']])){this[_0x8d6c('0x42')](_0x49b42e[_0x8d6c('0x49')]);if(this[_0x8d6c('0x9')][_0x49b42e['origtransfereruniqueid']]){this['channels'][_0x49b42e[_0x8d6c('0x4a')]][_0x8d6c('0x25')]=!![];this[_0x8d6c('0x9')][_0x49b42e[_0x8d6c('0x4b')]]=this[_0x8d6c('0x9')][_0x49b42e['origtransfereruniqueid']];delete this[_0x8d6c('0x9')][_0x49b42e[_0x8d6c('0x4a')]];}}}catch(_0x389b5d){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x389b5d[_0x8d6c('0x35')]);}};Acw['prototype'][_0x8d6c('0x15')]=function(_0x16b265){try{if(this[_0x8d6c('0x9')][_0x16b265[_0x8d6c('0x4c')]]){logger[_0x8d6c('0x24')]('[%s][BLINDTRANSFER:UNIQUEID]',JSON[_0x8d6c('0x3c')](_0x16b265[_0x8d6c('0x4c')]));this[_0x8d6c('0x42')](_0x16b265[_0x8d6c('0x4c')]);}else if(this[_0x8d6c('0x9')][_0x16b265['transfererlinkedid']]){logger[_0x8d6c('0x24')](_0x8d6c('0x4d'),JSON['stringify'](_0x16b265[_0x8d6c('0x4e')]));this[_0x8d6c('0x42')](_0x16b265['transfererlinkedid']);}}catch(_0x5022fb){logger[_0x8d6c('0x32')]('[ACW][syncBlindTransfer]\x20%s',_0x5022fb['message']);}};Acw['prototype'][_0x8d6c('0x12')]=function(_0x3c23e8){try{if(this[_0x8d6c('0x6')][_0x3c23e8[_0x8d6c('0x1d')]]&&this[_0x8d6c('0x6')][_0x3c23e8['queue']][_0x8d6c('0x4f')]===_0x8d6c('0x50')){if(this[_0x8d6c('0x7')][_0x3c23e8[_0x8d6c('0x1c')]]){logger[_0x8d6c('0x24')](_0x8d6c('0x51'),_0x3c23e8[_0x8d6c('0x2d')],_0x3c23e8[_0x8d6c('0x1c')],_0x3c23e8[_0x8d6c('0x1d')]);return RpcUser[_0x8d6c('0x52')](this[_0x8d6c('0x7')][_0x3c23e8[_0x8d6c('0x1c')]],_0x8d6c('0x53'),_0x3c23e8[_0x8d6c('0x2d')]);}}}catch(_0x5c138b){logger[_0x8d6c('0x32')]('[ACW][syncAgentRingNoAnswer]\x20%s',_0x5c138b[_0x8d6c('0x35')]);}};module['exports']=Acw; \ No newline at end of file +var _0x18dd=['savePause','[%s][TIMER:%s][AGENT:%s][QUEUE:%s]','timer','stopAcw','acwTimeout','lastPauseAt','format','YYYY-MM-DD\x20HH:mm:ss','uniqueid','updateAcw','catch','[%s][UPDATE][ERRORS:%s]','[%s][INPAUSE][AGENT:%s][QUEUE:%s]','error','finally','[%s][TIMER][STOP][AGENT:%s]','saveUnpause','[%s][UPDATE][ACWTIME:%s]','[ACW][STOP]\x20Interface\x20%s\x20doesn\x27t\x20have\x20timer','mandatoryDisposition','[ACW][syncAgentConnect]\x20%s','message','[ACW][syncAgentConnectPreview]\x20%s','syncHangupRequest','isUndefined','linkedid','[%s][HANGUP:LINKEDID]','syncHangup','[%s][HANGUPATTENDEDTRANSFER:UNIQUEID]','[%s][HANGUPATTENDEDTRANSFER:LINKEDID]','[ACW][syncHangup]\x20%s','isNil','transfereeuniqueid','secondtransfereruniqueid','transfertargetuniqueid','origtransfereruniqueid','transfereruniqueid','[%s][BLINDTRANSFER:UNIQUEID]','transfererlinkedid','[%s][BLINDTRANSFER:LINKEDID]','stringify','[ACW][syncBlindTransfer]\x20%s','autopause','all','Auto-Pause','[ACW][syncAgentRingNoAnswer]\x20%s','exports','lodash','moment','../../../config/logger','acw','../rpc/user','../rpc/voiceAgentReport','voiceQueues','agents','timers','channels','agentconnect','syncAgentConnect','bind','hanguprequest','hangup','agentringnoanswer','syncAgentRingNoAnswer','syncAttendedTransfer','blindtransfer','syncBlindTransfer','syncAgentConnectPreview','milliseconds','seconds','prototype','startAcw','interface','queue','ACW','mandatoryDispositionPause','name','Action','QueuePause','then','getAgent','voicePause','info','attended','destlinkedid'];(function(_0x52a157,_0xa6de20){var _0x3d38ce=function(_0x1133bb){while(--_0x1133bb){_0x52a157['push'](_0x52a157['shift']());}};_0x3d38ce(++_0xa6de20);}(_0x18dd,0xd9));var _0xd18d=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0x18dd[_0x397e5f];return _0x5302b8;};'use strict';var _=require(_0xd18d('0x0'));var moment=require(_0xd18d('0x1'));var ami=require('../ami');var logger=require(_0xd18d('0x2'))(_0xd18d('0x3'));var RpcUser=require(_0xd18d('0x4'));var RpcVoiceAgentReport=require(_0xd18d('0x5'));function Acw(_0x5247b4){this[_0xd18d('0x6')]=_0x5247b4['voiceQueues'];this[_0xd18d('0x7')]=_0x5247b4['agents'];this[_0xd18d('0x8')]=_0x5247b4[_0xd18d('0x8')];this[_0xd18d('0x9')]={};ami['on'](_0xd18d('0xa'),this[_0xd18d('0xb')][_0xd18d('0xc')](this));ami['on'](_0xd18d('0xd'),this['syncHangupRequest']['bind'](this));ami['on'](_0xd18d('0xe'),this['syncHangup'][_0xd18d('0xc')](this));ami['on'](_0xd18d('0xf'),this[_0xd18d('0x10')]['bind'](this));ami['on']('attendedtransfer',this[_0xd18d('0x11')]['bind'](this));ami['on'](_0xd18d('0x12'),this[_0xd18d('0x13')][_0xd18d('0xc')](this));ami['on']('custom:agentConnectPreview',this[_0xd18d('0x14')][_0xd18d('0xc')](this));}function getDiff(_0xc00ecd){var _0x2afed6=moment()['milliseconds'](0x0);var _0x583d91=moment(_0xc00ecd)[_0xd18d('0x15')](0x0);return _0x2afed6['diff'](_0x583d91,_0xd18d('0x16'));}Acw[_0xd18d('0x17')][_0xd18d('0x18')]=function(_0x1b633e){try{var _0x3380fb=this;var _0x54a35f=this[_0xd18d('0x9')][_0x1b633e][_0xd18d('0x19')];var _0x58ef98=this[_0xd18d('0x9')][_0x1b633e][_0xd18d('0x1a')];var _0xc2f17e=this['voiceQueues'][_0x58ef98];var _0x1b7aef=![];var _0x29309d=_0xd18d('0x1b');if(_0xc2f17e['mandatoryDisposition']){if(_0xc2f17e[_0xd18d('0x1c')][_0xd18d('0x1d')]){_0x1b7aef=!![];_0x29309d=_0xc2f17e[_0xd18d('0x1c')][_0xd18d('0x1d')];}}return ami[_0xd18d('0x1e')]({'action':_0xd18d('0x1f'),'interface':_0x54a35f,'paused':!![],'reason':_0x29309d})[_0xd18d('0x20')](function(){if(_0x3380fb[_0xd18d('0x7')][_0x54a35f]){return RpcUser[_0xd18d('0x21')](_0x3380fb[_0xd18d('0x7')][_0x54a35f]['id'])['then'](function(_0x42f690){if(_0x42f690&&!_0x42f690[_0xd18d('0x22')]){logger[_0xd18d('0x23')]('[%s][START][AGENT:%s][QUEUE:%s]',_0x1b633e,_0x54a35f,_0x58ef98);var _0x5d9101=_0x3380fb[_0xd18d('0x9')][_0x1b633e][_0xd18d('0x24')]&&_0x3380fb['channels'][_0x1b633e]['destlinkedid']?_0x3380fb['channels'][_0x1b633e][_0xd18d('0x25')]:_0x1b633e;return RpcUser[_0xd18d('0x26')](_0x3380fb[_0xd18d('0x7')][_0x54a35f],_0x29309d,_0x5d9101)[_0xd18d('0x20')](function(){if(!_0x1b7aef){_0x3380fb['timers'][_0x54a35f]={};logger[_0xd18d('0x23')](_0xd18d('0x27'),_0x1b633e,_0x3380fb[_0xd18d('0x6')][_0x58ef98]['acwTimeout'],_0x54a35f,_0x58ef98);_0x3380fb[_0xd18d('0x8')][_0x54a35f][_0xd18d('0x28')]=setTimeout(_0x3380fb[_0xd18d('0x29')][_0xd18d('0xc')](_0x3380fb,_0x54a35f),_0x3380fb[_0xd18d('0x6')][_0x58ef98][_0xd18d('0x2a')]*0x3e8);_0x3380fb[_0xd18d('0x8')][_0x54a35f][_0xd18d('0x2b')]=moment()[_0xd18d('0x2c')](_0xd18d('0x2d'));_0x3380fb[_0xd18d('0x8')][_0x54a35f][_0xd18d('0x2e')]=_0x1b633e;_0x3380fb[_0xd18d('0x8')][_0x54a35f]['queue']=_0x58ef98;_0x3380fb['timers'][_0x54a35f][_0xd18d('0x2f')]=function(){var _0x961bca=getDiff(_0x3380fb['timers'][_0x54a35f][_0xd18d('0x2b')]);clearTimeout(_0x3380fb[_0xd18d('0x8')][_0x54a35f][_0xd18d('0x28')]);_0x3380fb['timers'][_0x54a35f][_0xd18d('0x28')]=![];RpcVoiceAgentReport['update']({'acwtime':_0x961bca},_0x3380fb[_0xd18d('0x8')][_0x54a35f][_0xd18d('0x2e')],_0x54a35f)['then'](function(_0x31b00c){logger[_0xd18d('0x23')]('[%s][UPDATE][ACWTIME:%s]',_0x1b633e,_0x961bca,_0x31b00c);})[_0xd18d('0x30')](function(_0x19af7d){logger['error'](_0xd18d('0x31'),_0x1b633e,_0x19af7d);});delete _0x3380fb['timers'][_0x54a35f];};}});}else{logger[_0xd18d('0x23')](_0xd18d('0x32'),_0x1b633e,_0x54a35f,_0x58ef98);}});}})[_0xd18d('0x30')](function(){logger[_0xd18d('0x33')](_0xd18d('0x27'),_0x1b633e,_0x3380fb[_0xd18d('0x6')][_0x58ef98][_0xd18d('0x2a')],_0x54a35f,_0x58ef98);})[_0xd18d('0x34')](function(){delete _0x3380fb[_0xd18d('0x9')][_0x1b633e];});}catch(_0x53d484){logger['error']('[ACW][START]\x20%s',_0x53d484['message']);}};Acw['prototype'][_0xd18d('0x29')]=function(_0x7e9dfd){try{var _0x4f6bd6=this;if(_0x4f6bd6[_0xd18d('0x8')][_0x7e9dfd]){_0x4f6bd6[_0xd18d('0x8')][_0x7e9dfd][_0xd18d('0x28')]=![];var _0xbf5349=_0x4f6bd6[_0xd18d('0x8')][_0x7e9dfd][_0xd18d('0x2e')];var _0x59019e=_0x4f6bd6[_0xd18d('0x8')][_0x7e9dfd][_0xd18d('0x1a')];var _0x2adcad=_0x4f6bd6[_0xd18d('0x6')][_0x59019e]['acwTimeout'];logger[_0xd18d('0x23')](_0xd18d('0x35'),_0xbf5349,_0x7e9dfd);RpcUser[_0xd18d('0x36')](this['agents'][_0x7e9dfd]);RpcVoiceAgentReport['update']({'acwtime':_0x2adcad,'agentacw':!![]},_0xbf5349,_0x7e9dfd)[_0xd18d('0x20')](function(_0x2c53a4){logger[_0xd18d('0x23')](_0xd18d('0x37'),_0xbf5349,_0x2adcad,_0x2c53a4);})[_0xd18d('0x30')](function(_0x2302a7){logger[_0xd18d('0x33')](_0xd18d('0x31'),_0xbf5349,_0x2302a7);});}else{logger['error'](_0xd18d('0x38'),_0x7e9dfd);if(_0x4f6bd6[_0xd18d('0x8')]){logger[_0xd18d('0x23')]('[ACW][TIMERS]',JSON['stringify'](_0x4f6bd6[_0xd18d('0x8')]));}}}catch(_0x16ab0e){logger[_0xd18d('0x33')]('[ACW][STOP]\x20%s',_0x16ab0e['message']);}};Acw[_0xd18d('0x17')]['syncAgentConnect']=function(_0x409203){try{if(this[_0xd18d('0x6')][_0x409203[_0xd18d('0x1a')]]&&(this[_0xd18d('0x6')][_0x409203[_0xd18d('0x1a')]][_0xd18d('0x3')]||this[_0xd18d('0x6')][_0x409203[_0xd18d('0x1a')]][_0xd18d('0x39')])){if(this['agents'][_0x409203[_0xd18d('0x19')]]){this[_0xd18d('0x9')][_0x409203[_0xd18d('0x2e')]]={'queue':_0x409203['queue'],'interface':_0x409203[_0xd18d('0x19')],'destlinkedid':_0x409203['destlinkedid']};}}}catch(_0x41ae52){logger[_0xd18d('0x33')](_0xd18d('0x3a'),_0x41ae52[_0xd18d('0x3b')]);}};Acw[_0xd18d('0x17')][_0xd18d('0x14')]=function(_0x5d9e5b){try{if(this[_0xd18d('0x6')][_0x5d9e5b[_0xd18d('0x1a')]]&&(this[_0xd18d('0x6')][_0x5d9e5b['queue']]['acw']||this['voiceQueues'][_0x5d9e5b[_0xd18d('0x1a')]]['mandatoryDisposition'])){if(this[_0xd18d('0x7')][_0x5d9e5b[_0xd18d('0x19')]]){this['channels'][_0x5d9e5b[_0xd18d('0x2e')]]={'queue':_0x5d9e5b[_0xd18d('0x1a')],'interface':_0x5d9e5b['interface']};}}}catch(_0x430c77){logger[_0xd18d('0x33')](_0xd18d('0x3c'),_0x430c77[_0xd18d('0x3b')]);}};Acw[_0xd18d('0x17')][_0xd18d('0x3d')]=function(_0x2d41f9){try{if(this[_0xd18d('0x9')][_0x2d41f9[_0xd18d('0x2e')]]&&_[_0xd18d('0x3e')](this[_0xd18d('0x9')][_0x2d41f9['uniqueid']]['attended'])){logger[_0xd18d('0x23')]('[%s][HANGUP:UNIQUEID]',_0x2d41f9[_0xd18d('0x2e')]);this[_0xd18d('0x18')](_0x2d41f9[_0xd18d('0x2e')]);}else if(this['channels'][_0x2d41f9[_0xd18d('0x3f')]]&&_[_0xd18d('0x3e')](this['channels'][_0x2d41f9[_0xd18d('0x3f')]][_0xd18d('0x24')])){logger[_0xd18d('0x23')](_0xd18d('0x40'),_0x2d41f9[_0xd18d('0x3f')]);this[_0xd18d('0x18')](_0x2d41f9['linkedid']);}}catch(_0x4d75ed){logger[_0xd18d('0x33')]('[ACW][syncHangupRequest]\x20%s',_0x4d75ed['message']);}};Acw[_0xd18d('0x17')][_0xd18d('0x41')]=function(_0x141e40){try{if(this[_0xd18d('0x9')][_0x141e40[_0xd18d('0x2e')]]&&this[_0xd18d('0x9')][_0x141e40['uniqueid']][_0xd18d('0x24')]){logger[_0xd18d('0x23')](_0xd18d('0x42'),_0x141e40[_0xd18d('0x2e')]);this[_0xd18d('0x18')](_0x141e40[_0xd18d('0x2e')]);}else if(this[_0xd18d('0x9')][_0x141e40[_0xd18d('0x3f')]]&&this['channels'][_0x141e40[_0xd18d('0x3f')]]['attended']){logger['info'](_0xd18d('0x43'),_0x141e40[_0xd18d('0x3f')]);this[_0xd18d('0x18')](_0x141e40[_0xd18d('0x3f')]);}}catch(_0x498d6d){logger[_0xd18d('0x33')](_0xd18d('0x44'),_0x498d6d[_0xd18d('0x3b')]);}};Acw['prototype']['syncAttendedTransfer']=function(_0x5990a6){try{if(!_[_0xd18d('0x45')](this[_0xd18d('0x9')][_0x5990a6[_0xd18d('0x46')]])){this['startAcw'](_0x5990a6['transfereeuniqueid']);if(this[_0xd18d('0x9')][_0x5990a6['secondtransfereruniqueid']]){this['channels'][_0x5990a6[_0xd18d('0x47')]][_0xd18d('0x24')]=!![];this['channels'][_0x5990a6[_0xd18d('0x48')]]=this[_0xd18d('0x9')][_0x5990a6['secondtransfereruniqueid']];delete this['channels'][_0x5990a6[_0xd18d('0x47')]];}}else if(!_['isNil'](this[_0xd18d('0x9')][_0x5990a6[_0xd18d('0x48')]])){this['startAcw'](_0x5990a6[_0xd18d('0x48')]);if(this[_0xd18d('0x9')][_0x5990a6[_0xd18d('0x49')]]){this[_0xd18d('0x9')][_0x5990a6[_0xd18d('0x49')]][_0xd18d('0x24')]=!![];this[_0xd18d('0x9')][_0x5990a6[_0xd18d('0x46')]]=this['channels'][_0x5990a6[_0xd18d('0x49')]];delete this[_0xd18d('0x9')][_0x5990a6[_0xd18d('0x49')]];}}}catch(_0x166367){logger['error']('[ACW][syncAttendedTransfer]\x20%s',_0x166367['message']);}};Acw['prototype'][_0xd18d('0x13')]=function(_0x3b3f35){try{if(this[_0xd18d('0x9')][_0x3b3f35[_0xd18d('0x4a')]]){logger['info'](_0xd18d('0x4b'),JSON['stringify'](_0x3b3f35[_0xd18d('0x4a')]));this[_0xd18d('0x18')](_0x3b3f35['transfereruniqueid']);}else if(this[_0xd18d('0x9')][_0x3b3f35[_0xd18d('0x4c')]]){logger[_0xd18d('0x23')](_0xd18d('0x4d'),JSON[_0xd18d('0x4e')](_0x3b3f35[_0xd18d('0x4c')]));this[_0xd18d('0x18')](_0x3b3f35[_0xd18d('0x4c')]);}}catch(_0x5c49a3){logger[_0xd18d('0x33')](_0xd18d('0x4f'),_0x5c49a3[_0xd18d('0x3b')]);}};Acw[_0xd18d('0x17')][_0xd18d('0x10')]=function(_0x4c2a29){try{if(this[_0xd18d('0x6')][_0x4c2a29[_0xd18d('0x1a')]]&&this['voiceQueues'][_0x4c2a29[_0xd18d('0x1a')]][_0xd18d('0x50')]===_0xd18d('0x51')){if(this['agents'][_0x4c2a29['interface']]){logger[_0xd18d('0x23')]('[%s][AUTOPAUSE][AGENT:%s][QUEUE:%]',_0x4c2a29[_0xd18d('0x2e')],_0x4c2a29[_0xd18d('0x19')],_0x4c2a29[_0xd18d('0x1a')]);return RpcUser[_0xd18d('0x26')](this[_0xd18d('0x7')][_0x4c2a29['interface']],_0xd18d('0x52'),_0x4c2a29[_0xd18d('0x2e')]);}}}catch(_0x2bf80a){logger[_0xd18d('0x33')](_0xd18d('0x53'),_0x2bf80a[_0xd18d('0x3b')]);}};module[_0xd18d('0x54')]=Acw; \ No newline at end of file diff --git a/server/services/ami/ami.js b/server/services/ami/ami.js index 927a823..e240b0a 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 _0xe62e=['fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','then','catch','[ami.js][fullybooted]','exports','asterisk-manager','bluebird','../../config/logger','../../config/environment','asterisk','port','username','password','keepConnected','Action','promisify','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','error','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','sippeerstatus','actionQueueSummary','queuesummary','coreshowchannels','info','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','once','close','shutdown','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s'];(function(_0x3a62de,_0x21a5ff){var _0x5a626f=function(_0x31c1df){while(--_0x31c1df){_0x3a62de['push'](_0x3a62de['shift']());}};_0x5a626f(++_0x21a5ff);}(_0xe62e,0xe4));var _0xee62=function(_0x498bdd,_0x470eeb){_0x498bdd=_0x498bdd-0x0;var _0x392cb7=_0xe62e[_0x498bdd];return _0x392cb7;};'use strict';var Manager=require(_0xee62('0x0'));var BPromise=require(_0xee62('0x1'));var util=require('util');var logger=require(_0xee62('0x2'))('ami');var config=require(_0xee62('0x3'));var ami=new Manager(config[_0xee62('0x4')][_0xee62('0x5')],config[_0xee62('0x4')]['ip'],config[_0xee62('0x4')][_0xee62('0x6')],config[_0xee62('0x4')][_0xee62('0x7')],!![]);ami[_0xee62('0x8')]();ami[_0xee62('0x9')]=BPromise[_0xee62('0xa')](ami['action']);function error(_0x44710c){logger['error'](util[_0xee62('0xb')](_0xee62('0xc'),config[_0xee62('0x4')]['username'],config[_0xee62('0x4')]['ip'],config['asterisk']['port'],util[_0xee62('0xd')](_0x44710c,![],null)));}function close(){logger[_0xee62('0xe')](util[_0xee62('0xb')](_0xee62('0xf'),config[_0xee62('0x4')][_0xee62('0x6')],config[_0xee62('0x4')]['ip'],config[_0xee62('0x4')][_0xee62('0x5')]));}ami[_0xee62('0x10')]=function(){return function(){return ami[_0xee62('0x9')]({'action':_0xee62('0x11')});};};ami[_0xee62('0x12')]=function(){return function(){return ami[_0xee62('0x9')]({'action':_0xee62('0x13')});};};ami[_0xee62('0x14')]=function(){return function(){return ami[_0xee62('0x9')]({'action':_0xee62('0x15')});};};ami[_0xee62('0x16')]=function(){return function(){return ami[_0xee62('0x9')]({'action':_0xee62('0x17')});};};ami['actionCoreShowChannels']=function(){return function(){return ami[_0xee62('0x9')]({'action':_0xee62('0x18')});};};function connect(){logger[_0xee62('0x19')](util[_0xee62('0xb')](_0xee62('0x1a'),config[_0xee62('0x4')]['username'],config[_0xee62('0x4')]['ip'],config[_0xee62('0x4')][_0xee62('0x5')]));ami[_0xee62('0x1b')](_0xee62('0xe'),error);ami[_0xee62('0x1b')](_0xee62('0x1c'),close);}ami['on']('connect',connect);ami['on'](_0xee62('0x1d'),function(_0x49fef1){logger[_0xee62('0x19')](util[_0xee62('0xb')](_0xee62('0x1e'),config[_0xee62('0x4')][_0xee62('0x6')],config[_0xee62('0x4')]['ip'],config['asterisk'][_0xee62('0x5')],util[_0xee62('0xd')](_0x49fef1,![],null)));});ami['on'](_0xee62('0x1f'),function(){logger['info'](util[_0xee62('0xb')](_0xee62('0x20'),config[_0xee62('0x4')][_0xee62('0x6')],config[_0xee62('0x4')]['ip'],config[_0xee62('0x4')]['port']));return Promise['resolve']()[_0xee62('0x21')](ami[_0xee62('0x10')]())[_0xee62('0x21')](ami[_0xee62('0x12')]())[_0xee62('0x21')](ami[_0xee62('0x14')]())['then'](ami['actionQueueSummary']())[_0xee62('0x21')](ami['actionCoreShowChannels']())[_0xee62('0x22')](function(_0xe77e49){logger[_0xee62('0xe')](_0xee62('0x23'),util['inspect'](_0xe77e49,{'showHidden':![],'depth':null}));});});ami[_0xee62('0x1b')](_0xee62('0xe'),error);ami['once'](_0xee62('0x1c'),close);module[_0xee62('0x24')]=ami; \ No newline at end of file +var _0x62f9=['catch','[ami.js][fullybooted]','once','exports','asterisk-manager','bluebird','util','ami','../../config/environment','port','asterisk','username','promisify','action','error','format','Manager\x20\x22%s\x22\x20error\x20to\x20%s:%s\x20with:\x0a%s','inspect','Manager\x20\x22%s\x22\x20closed\x20to\x20%s:%s','actionSipShowRegistry','Action','sipshowregistry','actionDeviceStateList','devicestatelist','actionSipPeerStatus','actionQueueSummary','actionCoreShowChannels','Manager\x20\x22%s\x22\x20logged\x20on\x20to\x20%s:%s','connect','shutdown','info','Shutdown\x20\x22%s\x22\x20to\x20%s:%s\x20with:\x0a%s','fullybooted','Fullybooted\x20\x22%s\x22\x20to\x20%s:%s','resolve','then'];(function(_0x14cf05,_0x26ce5c){var _0xf63e=function(_0x32fd5f){while(--_0x32fd5f){_0x14cf05['push'](_0x14cf05['shift']());}};_0xf63e(++_0x26ce5c);}(_0x62f9,0x148));var _0x962f=function(_0x1a89ca,_0x27394b){_0x1a89ca=_0x1a89ca-0x0;var _0x29cbb2=_0x62f9[_0x1a89ca];return _0x29cbb2;};'use strict';var Manager=require(_0x962f('0x0'));var BPromise=require(_0x962f('0x1'));var util=require(_0x962f('0x2'));var logger=require('../../config/logger')(_0x962f('0x3'));var config=require(_0x962f('0x4'));var ami=new Manager(config['asterisk'][_0x962f('0x5')],config[_0x962f('0x6')]['ip'],config[_0x962f('0x6')][_0x962f('0x7')],config[_0x962f('0x6')]['password'],!![]);ami['keepConnected']();ami['Action']=BPromise[_0x962f('0x8')](ami[_0x962f('0x9')]);function error(_0x940c04){logger[_0x962f('0xa')](util[_0x962f('0xb')](_0x962f('0xc'),config[_0x962f('0x6')]['username'],config[_0x962f('0x6')]['ip'],config[_0x962f('0x6')][_0x962f('0x5')],util[_0x962f('0xd')](_0x940c04,![],null)));}function close(){logger['error'](util[_0x962f('0xb')](_0x962f('0xe'),config[_0x962f('0x6')][_0x962f('0x7')],config['asterisk']['ip'],config['asterisk']['port']));}ami[_0x962f('0xf')]=function(){return function(){return ami[_0x962f('0x10')]({'action':_0x962f('0x11')});};};ami[_0x962f('0x12')]=function(){return function(){return ami[_0x962f('0x10')]({'action':_0x962f('0x13')});};};ami[_0x962f('0x14')]=function(){return function(){return ami['Action']({'action':'sippeerstatus'});};};ami[_0x962f('0x15')]=function(){return function(){return ami['Action']({'action':'queuesummary'});};};ami[_0x962f('0x16')]=function(){return function(){return ami[_0x962f('0x10')]({'action':'coreshowchannels'});};};function connect(){logger['info'](util[_0x962f('0xb')](_0x962f('0x17'),config[_0x962f('0x6')]['username'],config[_0x962f('0x6')]['ip'],config[_0x962f('0x6')][_0x962f('0x5')]));ami['once'](_0x962f('0xa'),error);ami['once']('close',close);}ami['on'](_0x962f('0x18'),connect);ami['on'](_0x962f('0x19'),function(_0x4b7615){logger[_0x962f('0x1a')](util['format'](_0x962f('0x1b'),config['asterisk'][_0x962f('0x7')],config[_0x962f('0x6')]['ip'],config[_0x962f('0x6')][_0x962f('0x5')],util['inspect'](_0x4b7615,![],null)));});ami['on'](_0x962f('0x1c'),function(){logger['info'](util['format'](_0x962f('0x1d'),config[_0x962f('0x6')][_0x962f('0x7')],config[_0x962f('0x6')]['ip'],config[_0x962f('0x6')][_0x962f('0x5')]));return Promise[_0x962f('0x1e')]()[_0x962f('0x1f')](ami[_0x962f('0xf')]())['then'](ami[_0x962f('0x12')]())[_0x962f('0x1f')](ami[_0x962f('0x14')]())[_0x962f('0x1f')](ami[_0x962f('0x15')]())[_0x962f('0x1f')](ami[_0x962f('0x16')]())[_0x962f('0x20')](function(_0x452e9){logger[_0x962f('0xa')](_0x962f('0x21'),util[_0x962f('0xd')](_0x452e9,{'showHidden':![],'depth':null}));});});ami[_0x962f('0x22')](_0x962f('0xa'),error);ami[_0x962f('0x22')]('close',close);module[_0x962f('0x23')]=ami; \ No newline at end of file diff --git a/server/services/ami/client.js b/server/services/ami/client.js index 14f5779..1f60862 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 _0xa9e0=['result','catch','exports','jayson/promise','bluebird','../../config/logger','http','request','debug','rpc','error','message'];(function(_0x5ca82d,_0x7d11a0){var _0x397661=function(_0x4ce955){while(--_0x4ce955){_0x5ca82d['push'](_0x5ca82d['shift']());}};_0x397661(++_0x7d11a0);}(_0xa9e0,0x123));var _0x0a9e=function(_0x40ac5e,_0x2de228){_0x40ac5e=_0x40ac5e-0x0;var _0x2839d6=_0xa9e0[_0x40ac5e];return _0x2839d6;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var logger=require(_0x0a9e('0x2'))('ami');var client=jayson['client'][_0x0a9e('0x3')]({'port':0x2329});client['Request']=function(_0x333808,_0x432180){return new BPromise(function(_0x2ab90b,_0x991246){return client[_0x0a9e('0x4')](_0x333808,_0x432180)['then'](function(_0x219af0){logger[_0x0a9e('0x5')](_0x0a9e('0x6'),'memberReport',_0x333808,_0x432180,_0x219af0);if(_0x219af0['error']){logger[_0x0a9e('0x7')]('rpc','memberReport',_0x333808,_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')],_0x432180);return _0x991246(_0x219af0[_0x0a9e('0x7')][_0x0a9e('0x8')]);}else{return _0x2ab90b(_0x219af0[_0x0a9e('0x9')]);}})[_0x0a9e('0xa')](function(_0x4a4c56){logger['error']('rpc','memberReport',_0x333808,_0x4a4c56,_0x432180);return _0x991246(_0x4a4c56);});});};module[_0x0a9e('0xb')]=client; \ No newline at end of file +var _0xd8b0=['message','result','catch','exports','jayson/promise','bluebird','http','Request','then','debug','memberReport','error','rpc'];(function(_0x3f9e98,_0x4320a6){var _0x248234=function(_0x110f27){while(--_0x110f27){_0x3f9e98['push'](_0x3f9e98['shift']());}};_0x248234(++_0x4320a6);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var jayson=require(_0x0d8b('0x0'));var BPromise=require(_0x0d8b('0x1'));var logger=require('../../config/logger')('ami');var client=jayson['client'][_0x0d8b('0x2')]({'port':0x2329});client[_0x0d8b('0x3')]=function(_0x43bca1,_0x364286){return new BPromise(function(_0x8196ed,_0x577834){return client['request'](_0x43bca1,_0x364286)[_0x0d8b('0x4')](function(_0x227c63){logger[_0x0d8b('0x5')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x364286,_0x227c63);if(_0x227c63[_0x0d8b('0x7')]){logger['error'](_0x0d8b('0x8'),_0x0d8b('0x6'),_0x43bca1,_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')],_0x364286);return _0x577834(_0x227c63[_0x0d8b('0x7')][_0x0d8b('0x9')]);}else{return _0x8196ed(_0x227c63[_0x0d8b('0xa')]);}})[_0x0d8b('0xb')](function(_0x48fa16){logger[_0x0d8b('0x7')]('rpc',_0x0d8b('0x6'),_0x43bca1,_0x48fa16,_0x364286);return _0x577834(_0x48fa16);});});};module[_0x0d8b('0xc')]=client; \ No newline at end of file diff --git a/server/services/ami/dialer/index.js b/server/services/ami/dialer/index.js index 943982c..71546b0 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 _0x2de0=['is\x20disactive','[ifTime][Action]','Error','stringify','isTrunkReachable','active','SIP/%s','status','reachable','checkIsTrunkReachable','Trunk','TrunkBackup','checkIfTime','ifTimeIvr','checkIfTimeIntervals','EMPTY_INTERVAL','ifTime','Failure','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','isArray','length','push','Action','command','iftime\x20%s,%s','interval','timezones','content','indexOf','catch','true','some','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','syncCampaigns','undefined','resolve','then','dialGlobalInterval','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','progressive','power','handlePower','Queue','intervalIftime','OVERTIME_GLOBAL_INTERVAL','silly','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','isGlobal','AMI\x20IfTime','queue','type','updateOriginated','uniqueid','answertime','YYYY-MM-DD\x20HH:mm:ss','ivr','outboundAnswerCallsDay','reason','agiafterat','dialQueueProject2','dialAgiAfterHangupAgent','createHistory','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','getSeconds','droptime','dialQueueTimeout','predictiveIntervalDroppedCallsTimeout','outboundDropCallsDayTimeout','statedesc','Drop','dropreason','TIMEOUT','countdropretry','countglobal','dialDropRetryFrequency','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','add','minutes','ContactId','ListId','VoiceQueueId','[rescheduleContact][Drop]','calleridnum','[syncAgentComplete][createHistory][10]','swapAdditionalPhones','outboundDropCallsDayCallersExit','Abandoned','CALLEREXIT','countabandonedretry','dialAbandonedRetryFrequency','callAdditionalPhoneAfterMin','dialAbandonedMaxRetry','CampaignId','calleridname','[syncAgentComplete][createHistory][11]','channel','actionid','strategy','rrmemory','roundrobin','isNil','locked','paused','stateinterface','merge','pick','idHopper','run','[Catch][Preview][syncQueueStatusComplete]','rescheduleContact','[unlock][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','Agent:\x20','contactAgent-idHopper:\x20','[booked][RR][finaly]','[booked][unlock]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[booked][unlock3]','getQueue','response','Success','callProgressDetecting','[callProgressDetecting]\x20','variable','amdstatus','exten','xcally-motion-dialer','HANGUP','outboundAnswerAgiCallsDay','AMD','buildObj','amd','saveInDb','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','dialAMDActive','value','MACHINE','Machine','countmachineretry','custom:amd','[syncAgentComplete][createHistory][0]','countbusyretry','countcongestionretry','dialGlobalMaxRetry','stateGlobal','reason19\x20machine....','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','[syncHangupInAMDIvr][createHistory]','[syncHangupInAMDIvr]','membername','countnoanswerretry','countnosuchnumberretry','countagentrejectretry','ivrAnswerCallsDay','[syncHangupIvr][createHistory]','[syncHangupIvr]','dialQueueProject','AnswerAGI','AGI','outboundUnknownCallsDay','Unknow','queuesSummary','running','isPreviewCampaign','statusMessage','getQueueCampaignStatusMessage','available','inUse','talking','ACTIVE','[syncQueueSummary]','queueSummaryCountersUpdated','updateReportFromOutboundQueue','throttle','filter','dialPreviewRecallmeReminder','online','handlePreviewRecallNotifications','map','Agent','user:%s','user:dialPreviewRecallReminder','checkPreviewRecallReminder','loopClearZombieChannels','clearZombieChannels','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','loggerHandler','UserId','[emptyContact][createHistory]','[emptyContact]','[syncQueueCallerAbandon]\x20[Drop]','handleIvr','actionOriginate','originate','voiceQueue\x20is\x20undefine','phone','contact\x20is\x20undefine','getCaller','NONE','\x22agi://%s/square,%s\x22','isOutboundQueue','\x22%s,%s%s,,,%s\x22','dialQueueOptions','XMD-AMDINITIALSILENCE','dialAMDInitialSilence','XMD-AMDGREETING','dialAMDGreeting','dialAMDAfterGreetingSilence','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','dialAMDMinWordLength','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','XMD-VOICEQUEUEID','Contact','tags','XMD-','toUpper','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','dialOriginateCallerIdNumber','dialOriginateCallerIdName','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','dialPrefix','trim','dialCutDigit','SIP/%s/%s%s','substring','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Abandoned]','dialAgentRejectMaxRetry','[rescheduleContact][AgentReject]','object','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','NoAnswer','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','custom:agentbusy','busy','[syncAgentComplete][createHistory][5]','reason\x205\x20busy','outboundCongestionCallsDay','Congestion','dialCongestionRetryFrequency','congestion','[syncAgentComplete][createHistory][8]','dialCongestionMaxRetry','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','[syncAgentComplete][createHistory][20]','reason\x2020\x20agentreject','dialAgentRejectRetryFrequency','[syncAgentComplete][createHistory][?]','Global','[moveContactManagedDialer][0]','contact\x20not\x20moved','dialPredictiveOptimizationPercentage','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','floor','predictiveIntervalHitRate','check\x20predictive\x20is\x20not\x20undefine','[startMethodPredictive][StartProgressive]','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','[startMethodPredictive][StartProgressive][Loop]','predictiveIntervalErlangCallsDroppedCalls','dialPredictiveOptimization','dropRate','[stopMethodPredictive][ReStartProgressive][ExceededDropDay]','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','avgHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','Predictive\x20for\x20every\x20interval','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(',')\x20are\x20more\x20than\x20threshold\x20(','agentBusyFactor','Unknown\x20Predictive','[getDataPredictive]','check\x20failure','getDataPredictiveOld','loggedIn','outboundQueuePauses','busyFactor','[CatchErlangB]','erlangCallToSecond','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','recallme','dialMethod','queuestatus','[unlockOriginate][syncQueueStatusComplete]','Queue:\x20','scheduledat','dialRecallMeTimeout','unlockContact','dialRecallInQueue','[rescheduleContact][dialRecallInQueue]','QUEUE_RECALL','RecallInQueue','[Originate][HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[Originate][HistoryRecallClose][historyCatch]','outboundBlacklistCallsDay','[Originate][historyBlacklist]','[Originate][MoveBlacklist]','inBlackList','limitCalls','temp','getContactDialerIvr','checkContactEmpty','NO_AVAILABLE_CONTACTS','[getContactCampaign2][Empty]','RUNNING','ivrTotalCallsDays','emptyContact','[actionOriginate]\x20','checkContactBlack','[actionOriginateIvr]\x20','[getContactCampaign2]','dialLimitQueue','pTalking','getContactDialer','[countReScheduled]\x20','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','countReScheduled','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','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','interval\x20=\x20','Amax\x20=\x20','erlangb','----\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]','Umin\x20=\x20','exports','uuid','ioredis','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','redis','defaults','localhost','socket.io-emitter','../rpc/cmHopper','../rpc/interval','./models/final','./models/agentComplete','./models/queueCallerAbandon','./models/hangup','env','XCALLY_IP_AGI','127.0.0.1','prototype','enqueue','tail','finally','sequence','preview','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','startPredictive','startProgressive','queueBooked','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','bind','agentcomplete','syncAgentComplete','custom:queuesummary','syncQueueSummary','syncQueueSummaryComplete','syncHangup','newexten','syncNewExten','varset','syncVarSet','syncQueueMember','queuestatuscomplete','syncQueueStatusComplete','loopCampaigns','getSettings','isUndefined','emit','outbound','debug','[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','info','Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsCallersExit','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','---------------------------','predictiveIntervalAvgTalktime','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','predictiveIntervalAvgHoldtime','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','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','erlangAbandonmentRate','Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','checkContactLowerLimitOriginate','contactsRescheduled','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','contacts','state','endtime','starttime','queueStatusComplete','[booked][unlockQueueStatus]','Interval','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:ivr:%s','campaign:save','originated','sendMessageOneNotActive','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','is\x20not\x20active','DISACTIVED'];(function(_0x5a6497,_0xb2da19){var _0x5a4b45=function(_0x40060c){while(--_0x40060c){_0x5a6497['push'](_0x5a6497['shift']());}};_0x5a4b45(++_0xb2da19);}(_0x2de0,0x1a2));var _0x02de=function(_0xd35c8d,_0x1b6b53){_0xd35c8d=_0xd35c8d-0x0;var _0x30511b=_0x2de0[_0xd35c8d];return _0x30511b;};'use strict';var util=require('util');var _=require('lodash');var uuid=require(_0x02de('0x0'));var moment=require('moment');var rr=require('rr');var Redis=require(_0x02de('0x1'));var utils=require(_0x02de('0x2'));var hopperUtils=require(_0x02de('0x3'));var ut=require(_0x02de('0x4'));var config=require(_0x02de('0x5'));var logger=require(_0x02de('0x6'))(_0x02de('0x7'));var loggerBooked=require(_0x02de('0x6'))(_0x02de('0x8'));var loggerPredictive=require(_0x02de('0x6'))(_0x02de('0x9'));var loggerPredictiveCalls=require(_0x02de('0x6'))(_0x02de('0xa'));var loggerSyncQueueSummary=require(_0x02de('0x6'))('syncQueueSummary');var ami=require('../ami');config[_0x02de('0xb')]=_[_0x02de('0xc')](config[_0x02de('0xb')],{'host':_0x02de('0xd'),'port':0x18eb});var io=require(_0x02de('0xe'))(new Redis(config[_0x02de('0xb')]));var cmHopper=require(_0x02de('0xf'));var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require('../rpc/setting');var Interval=require(_0x02de('0x10'));var Action=require('./models/action');var History=require('./models/history');var Final=require(_0x02de('0x11'));var AgentComplete=require(_0x02de('0x12'));var QueueCallerAbandon=require(_0x02de('0x13'));var Hangup=require(_0x02de('0x14'));var ipAgi=process[_0x02de('0x15')][_0x02de('0x16')]||_0x02de('0x17');var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x02de('0x18')][_0x02de('0x19')]=function(_0x30de5a){this['tail']=this['tail']?this[_0x02de('0x1a')][_0x02de('0x1b')](_0x30de5a):_0x30de5a();};function Dialer(_0x1ba505,_0x1e217c){this[_0x02de('0x1c')]=new Sequence();this[_0x02de('0x1d')]=_0x1e217c;this['voiceQueues']=_0x1ba505[_0x02de('0x1e')];this['campaigns']=_0x1ba505[_0x02de('0x1f')];this[_0x02de('0x20')]=_0x1ba505[_0x02de('0x20')];this['trunks']=_0x1ba505[_0x02de('0x21')];this['maxNumberOriginate']=config[_0x02de('0x22')]||0x2;this[_0x02de('0x23')]={};this[_0x02de('0x24')]={};this[_0x02de('0x25')]={};this[_0x02de('0x26')]={};this['optionPredictive']={};this[_0x02de('0x27')]={};this[_0x02de('0x28')]={};this['ivrOriginated']={};this[_0x02de('0x29')]={};this['queueBookedRR']={};this['queuesSummary']={};ami['on']('agentconnect',this[_0x02de('0x2a')]['bind'](this));ami['on'](_0x02de('0x2b'),this[_0x02de('0x2c')][_0x02de('0x2d')](this));ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on'](_0x02de('0x2e'),this[_0x02de('0x2f')][_0x02de('0x2d')](this));ami['on'](_0x02de('0x30'),this[_0x02de('0x31')]['bind'](this));ami['on']('custom:queuesummarycomplete',this[_0x02de('0x32')][_0x02de('0x2d')](this));ami['on']('hangup',this[_0x02de('0x33')][_0x02de('0x2d')](this));ami['on'](_0x02de('0x34'),this[_0x02de('0x35')]['bind'](this));ami['on'](_0x02de('0x36'),this[_0x02de('0x37')][_0x02de('0x2d')](this));ami['on']('queuemember',this[_0x02de('0x38')][_0x02de('0x2d')](this));ami['on'](_0x02de('0x39'),this[_0x02de('0x3a')]['bind'](this));this[_0x02de('0x3b')]();this['loopClearZombieChannels']();RpcSetting[_0x02de('0x3c')]()['then'](function(_0x406e11){previewRecallmeReminderInterval=_0x406e11['previewRecallmeReminderInterval'];});}function isNotNull(_0x3982fb){return _0x3982fb!==null&&!_[_0x02de('0x3d')](_0x3982fb);}function msgResponse(_0x3be065,_0x16e621,_0x4462ba){return{'action':_0x3be065,'response':_0x16e621,'message':_0x4462ba,'stack':_0x4462ba};}function emit(_0x547ca9,_0x197cc1,_0x16a318){io['to'](_0x547ca9)[_0x02de('0x3e')](_0x197cc1,_0x16a318);}function emitOutboundVoiceQueueSummary(_0x3b9501){if(_0x3b9501['type']===_0x02de('0x3f')){logger[_0x02de('0x40')](_0x02de('0x41'),util[_0x02de('0x42')](_0x3b9501,{'showHidden':![],'depth':null}));emit(util[_0x02de('0x43')](_0x02de('0x44'),_0x3b9501[_0x02de('0x45')]),_0x02de('0x46'),_0x3b9501);}}function checkGetDataPredictive(_0x5ab643){if(isNotNull(_0x5ab643)&&!_[_0x02de('0x47')](_0x5ab643)){loggerPredictive[_0x02de('0x48')]('-----\x20Stats\x20Predictive\x20---');loggerPredictive[_0x02de('0x48')](_0x02de('0x49'),_0x5ab643[_0x02de('0x4a')]);loggerPredictive[_0x02de('0x48')](_0x02de('0x4b'),_0x5ab643[_0x02de('0x4c')]);loggerPredictive[_0x02de('0x48')](_0x02de('0x4d'),_0x5ab643['predictiveIntervalDroppedCallsTimeout']);loggerPredictive[_0x02de('0x48')](_0x02de('0x4e'),_0x5ab643[_0x02de('0x4f')]);loggerPredictive[_0x02de('0x48')](_0x02de('0x50'),_0x5ab643['predictiveIntervalAvgHoldtime']);loggerPredictive[_0x02de('0x48')](_0x02de('0x51'),_0x5ab643['predictiveIntervalAvgTalktime']);loggerPredictive[_0x02de('0x48')](_0x02de('0x52'));if(_0x5ab643[_0x02de('0x4a')]>0x0){if(!_[_0x02de('0x3d')](_0x5ab643[_0x02de('0x53')])&&_0x5ab643[_0x02de('0x53')]>0x0){return!![];}loggerPredictive[_0x02de('0x48')](_0x02de('0x54'));if(!_[_0x02de('0x3d')](_0x5ab643[_0x02de('0x55')])&&_0x5ab643[_0x02de('0x55')]>0x0){return!![];}loggerPredictive['info']('Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive');}else{loggerPredictive[_0x02de('0x48')](_0x02de('0x56'));}}else{loggerPredictive['info'](_0x02de('0x57'));}return![];}function mergeDataErlangB(_0x3f0ed5){return function(_0x1c6190){loggerPredictive['info']('---------\x20ErlangB\x20---------');loggerPredictive[_0x02de('0x48')](_0x02de('0x58'),_0x1c6190[_0x02de('0x59')]);loggerPredictive[_0x02de('0x48')](_0x02de('0x5a'),_0x1c6190['erlangCallToSecond']);loggerPredictive[_0x02de('0x48')](_0x02de('0x5b'),_0x1c6190[_0x02de('0x5c')]);loggerPredictive[_0x02de('0x48')](_0x02de('0x5d'),_0x1c6190[_0x02de('0x5e')]);loggerPredictive[_0x02de('0x48')](_0x02de('0x5b'),_0x1c6190[_0x02de('0x5c')]);loggerPredictive[_0x02de('0x48')](_0x02de('0x52'));_['merge'](_0x3f0ed5,_0x1c6190);};}function ifInterval(_0x39fde2,_0x10bad4){if(_[_0x02de('0x3d')](_0x10bad4)){return![];}return utils['getSeconds'](undefined,_0x10bad4)<_0x39fde2*0x3c;}function clearPredictiveAttributes(_0x1c64c3){if(_0x1c64c3[_0x02de('0x28')]){_0x1c64c3[_0x02de('0x28')]=undefined;loggerPredictive[_0x02de('0x40')](_0x1c64c3['name'],'startProgressive\x20value\x20cleared');}if(_0x1c64c3[_0x02de('0x27')]){_0x1c64c3['startPredictive']=undefined;loggerPredictive[_0x02de('0x40')](_0x1c64c3[_0x02de('0x45')],_0x02de('0x5f'));}if(_0x1c64c3[_0x02de('0x60')]){clearInterval(_0x1c64c3[_0x02de('0x60')]);_0x1c64c3[_0x02de('0x60')]=undefined;loggerPredictive[_0x02de('0x40')](_0x1c64c3[_0x02de('0x45')],_0x02de('0x61'));}}function loggerCatchPredictive(_0x43500a,_0x43b632){return function(_0x30d7bd){loggerPredictive[_0x02de('0x62')](_0x43b632['name'],_0x43500a);loggerPredictive[_0x02de('0x62')](_0x30d7bd[_0x02de('0x63')]);clearPredictiveAttributes(_0x43b632);};}function loggerCatch(_0x454287){return function(_0x52a6ba){logger[_0x02de('0x62')](_0x454287,util[_0x02de('0x42')](_0x52a6ba,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x1ce780,_0x4b23d9,_0x387622){return function(_0x4a75a3){utils[_0x02de('0x64')](_0x4b23d9,_0x387622,0x0);logger['error'](_0x1ce780,util[_0x02de('0x42')](_0x4a75a3,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x5a6937){return function(_0x398517){if(isNotNull(_0x398517)&&isNotNull(_0x398517[0x0])){if(_0x398517[0x0][_0x02de('0x65')]>0x0){_0x5a6937[_0x02de('0x66')]=utils[_0x02de('0x67')]['CONTACTS_RESCHEDULED'];logger['info'](_0x02de('0x68')+_0x5a6937[_0x02de('0x45')],_0x398517[0x0][_0x02de('0x65')],_0x02de('0x69'));}else{_0x5a6937[_0x02de('0x66')]=utils[_0x02de('0x67')]['NO_AVAILABLE_CONTACTS'];logger[_0x02de('0x48')]('[getContactDialer2][Empty]'+_0x5a6937[_0x02de('0x45')]);}}};}function createObjHistory(_0x34b758,_0x5a08d9,_0x4a39f9,_0x30e6fb,_0x3e4c5a){_0x34b758[_0x02de('0x66')]=_0x4a39f9;var _0x49ede6=new Action(_0x34b758,_0x5a08d9);var _0x234c31=new History(_0x49ede6);_0x234c31[_0x02de('0x6a')]=_0x30e6fb;_0x234c31['statedesc']=_0x3e4c5a;_0x234c31[_0x02de('0x6b')]=_0x49ede6[_0x02de('0x6c')];return _0x234c31;}function unlockQueueStatus(_0x20a822,_0x1e7bda){setTimeout(function(){if(_[_0x02de('0x3d')](_0x20a822['queueStatusComplete'])){loggerBooked[_0x02de('0x62')]('[unlockQueueStatus][undefined]',_0x1e7bda);}_0x20a822[_0x02de('0x6d')]=!![];loggerBooked[_0x02de('0x48')](_0x02de('0x6e'),_0x1e7bda,JSON['stringify'](_['pick'](_0x20a822,[_0x02de('0x45'),_0x02de('0x6d')])));},0x1f3);}function checkInterval(_0x3c8089){return function(){if(!isNotNull(_0x3c8089[_0x02de('0x6f')])){_0x3c8089[_0x02de('0x66')]=utils[_0x02de('0x67')][_0x02de('0x70')];throw _0x3c8089['name']+_0x02de('0x71');}if(!isNotNull(_0x3c8089[_0x02de('0x6f')][_0x02de('0x72')])){_0x3c8089[_0x02de('0x66')]=utils['CAMPAIGN_STATUS'][_0x02de('0x70')];throw _0x3c8089['name']+_0x02de('0x71');}if(!isNotNull(_[_0x02de('0x47')](_0x3c8089[_0x02de('0x6f')][_0x02de('0x72')]))){_0x3c8089[_0x02de('0x66')]=utils[_0x02de('0x67')]['NULL_INTERVAL'];throw _0x3c8089[_0x02de('0x45')]+_0x02de('0x71');}};}function checkIsIVRCampaignActive(_0x58bdc0){return function(){if(!utils[_0x02de('0x73')](_0x58bdc0)){_0x58bdc0[_0x02de('0x66')]=utils[_0x02de('0x67')][_0x02de('0x74')];throw _0x58bdc0[_0x02de('0x45')]+_0x02de('0x75');}};}function emitCampaignSummary(_0x547df8){if(utils[_0x02de('0x76')](_0x547df8)){emit(util[_0x02de('0x43')](_0x02de('0x77'),_0x547df8[_0x02de('0x45')]),_0x02de('0x78'),_0x547df8);}}function loggerCatchQueueSummary(_0x45cb00,_0x7ecea8){return function(_0x16398a){clearPredictiveAttributes(_0x7ecea8);emitCampaignSummary(_0x7ecea8);loggerSyncQueueSummary[_0x02de('0x40')](_0x45cb00,util[_0x02de('0x42')](_0x16398a,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x28bd97){if(_0x28bd97['sendMessageOneNotActive']){if(_0x28bd97[_0x02de('0x79')]===0x0){_0x28bd97[_0x02de('0x7a')]=![];_0x28bd97[_0x02de('0x66')]=utils[_0x02de('0x67')]['INACTIVE'];loggerSyncQueueSummary['debug'](_0x02de('0x7b'),_0x28bd97[_0x02de('0x45')],_0x02de('0x7c'));}else{_0x28bd97[_0x02de('0x66')]=utils[_0x02de('0x67')][_0x02de('0x7d')];loggerSyncQueueSummary[_0x02de('0x40')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x28bd97[_0x02de('0x45')],_0x02de('0x7e'));}emitCampaignSummary(_0x28bd97);}}function myreject(_0x262d12){return function(_0x170781){return _0x262d12(msgResponse(_0x02de('0x7f'),_0x02de('0x80'),JSON[_0x02de('0x81')](_0x170781)));};}Dialer[_0x02de('0x18')][_0x02de('0x82')]=function(_0x5ae5af){return!_[_0x02de('0x3d')](_0x5ae5af)&&_0x5ae5af&&!_[_0x02de('0x3d')](_0x5ae5af[_0x02de('0x45')])&&!_[_0x02de('0x3d')](_0x5ae5af[_0x02de('0x83')])&&_0x5ae5af[_0x02de('0x83')]&&(this[_0x02de('0x21')][util[_0x02de('0x43')](_0x02de('0x84'),_0x5ae5af['name'])][_0x02de('0x85')]===_0x02de('0x86')||this[_0x02de('0x21')][util[_0x02de('0x43')]('SIP/%s',_0x5ae5af[_0x02de('0x45')])]['status']==='unmonitored');};Dialer[_0x02de('0x18')][_0x02de('0x87')]=function(_0x4ecd24){var _0x9849ff=this;return function(){if(!_0x9849ff[_0x02de('0x82')](_0x4ecd24[_0x02de('0x88')])){if(!_0x9849ff[_0x02de('0x82')](_0x4ecd24[_0x02de('0x89')])){_0x4ecd24[_0x02de('0x66')]=utils[_0x02de('0x67')]['TRUNK_NOT_REACHABLE'];throw _0x4ecd24['name']+'\x20trunk\x20is\x20not\x20reachable';}}};};Dialer[_0x02de('0x18')][_0x02de('0x8a')]=function(_0x29f692,_0x2973af,_0x28cfdb,_0x19ad32){var _0x193d93=this;return function(){var _0x54ff1b=!![];return _0x193d93[_0x02de('0x8b')](_0x29f692,_0x2973af,_0x28cfdb,_0x19ad32,_0x54ff1b);};};Dialer['prototype'][_0x02de('0x8c')]=function(_0x5b998f,_0x2be192,_0x24d32a,_0x5ada87){var _0x311da5=this;return function(){var _0x3a3aa8=![];return _0x311da5[_0x02de('0x8b')](_0x5b998f[_0x02de('0x72')],_0x2be192,_0x24d32a,_0x5ada87,_0x3a3aa8);};};Dialer['prototype'][_0x02de('0x8b')]=function(_0x5234,_0x7db152,_0x3beb4a,_0x4a354b,_0xb6f2a1){var _0x5453a3=[];return new Promise(function(_0x1481e9,_0x19fbbb){if(!isNotNull(_0x5234)){_0x4a354b[_0x02de('0x66')]=utils[_0x02de('0x67')][_0x02de('0x70')];return _0x19fbbb(msgResponse('ifTime','Failure',_0x3beb4a+'\x20Intervals\x20is\x20null\x20'));}if(_[_0x02de('0x47')](_0x5234)){_0x4a354b[_0x02de('0x66')]=utils['CAMPAIGN_STATUS'][_0x02de('0x8d')];return _0x19fbbb(msgResponse(_0x02de('0x8e'),_0x02de('0x8f'),_0x3beb4a+_0x02de('0x90')));}if(_0x7db152&&_[_0x02de('0x3d')](config['timezones'][_0x7db152])){_0x4a354b[_0x02de('0x66')]=utils[_0x02de('0x67')][_0x02de('0x91')];return _0x19fbbb(msgResponse(_0x02de('0x8e'),_0x02de('0x8f'),_0x3beb4a+_0x02de('0x92')+_0x7db152));}if(_[_0x02de('0x93')](_0x5234)){for(var _0x4578af=0x0;_0x4578af<_0x5234[_0x02de('0x94')];_0x4578af+=0x1){_0x5453a3[_0x02de('0x95')](ami[_0x02de('0x96')]({'action':_0x02de('0x97'),'command':util[_0x02de('0x43')](_0x02de('0x98'),_0x5234[_0x4578af][_0x02de('0x99')],!_[_0x02de('0x3d')](config[_0x02de('0x9a')][_0x7db152])?_0x7db152:'')})['then'](function(_0x4403b0){return _0x4403b0[_0x02de('0x9b')][_0x02de('0x9c')]('true')>=0x0;})[_0x02de('0x9d')](myreject(_0x19fbbb)));}}else{_0x5453a3[_0x02de('0x95')](ami[_0x02de('0x96')]({'action':'command','command':util[_0x02de('0x43')](_0x02de('0x98'),_0x5234,!_[_0x02de('0x3d')](config[_0x02de('0x9a')][_0x7db152])?_0x7db152:'')})['then'](function(_0x493a64){return _0x493a64[_0x02de('0x9b')]['indexOf'](_0x02de('0x9e'))>=0x0;})['catch'](myreject(_0x19fbbb)));}Promise['all'](_0x5453a3)['then'](function(_0x3832aa){var _0x222411=_[_0x02de('0x9f')](_0x3832aa);if(_0x222411){return _0x1481e9(_0x222411);}else{_0x4a354b['message']=_0xb6f2a1?utils['CAMPAIGN_STATUS']['OVERTIME_GLOBAL_INTERVAL']:utils[_0x02de('0x67')][_0x02de('0xa0')];return _0x19fbbb(msgResponse(_0x02de('0xa1'),_0x02de('0x8f'),_0x02de('0xa2')+_0xb6f2a1+'\x20'+_0x3beb4a+_0x02de('0xa3')+util['inspect'](_0x5234,{'showHidden':![],'depth':null})+_0x02de('0xa4')+_0x7db152));}})[_0x02de('0x9d')](function(_0x5e01a7){return _0x19fbbb(msgResponse(_0x02de('0x8e'),_0x02de('0x8f'),JSON[_0x02de('0x81')](_0x5e01a7)));});});};Dialer['prototype'][_0x02de('0x3b')]=function(){var _0x4aa0fe=this;return cmHopper['resetActiveCalls']({'active':![]},{'where':{'active':!![]}})['then'](function(){setInterval(function(){_0x4aa0fe[_0x02de('0xa5')]();},0x3e8);});};Dialer[_0x02de('0x18')][_0x02de('0xa5')]=function(){var _0x4250c6=this;var _0x5409de;for(var _0x303d21 in this['campaigns']){if(typeof this['campaigns'][_0x303d21]!==_0x02de('0xa6')){_0x5409de=this['campaigns'][_0x303d21];if(utils[_0x02de('0x76')](_0x5409de)&&utils[_0x02de('0x73')](_0x5409de)){_0x5409de[_0x02de('0x7a')]=!![];Promise[_0x02de('0xa7')]()[_0x02de('0xa8')](checkIsIVRCampaignActive(_0x5409de))['then'](checkInterval(_0x5409de))[_0x02de('0xa8')](_0x4250c6[_0x02de('0x87')](_0x5409de))[_0x02de('0xa8')](_0x4250c6[_0x02de('0x8a')](_0x5409de[_0x02de('0xa9')],_0x5409de[_0x02de('0xaa')],_0x5409de['name'],_0x5409de))[_0x02de('0xa8')](_0x4250c6[_0x02de('0x8c')](_0x5409de[_0x02de('0x6f')],_0x5409de[_0x02de('0xaa')],_0x5409de[_0x02de('0x45')],_0x5409de))[_0x02de('0xa8')](_0x4250c6[_0x02de('0xab')](_0x5409de))[_0x02de('0x9d')](loggerCatchQueueSummary(_0x02de('0xac'),_0x5409de));}else{notSendMessagesCampaign(_0x5409de);}}}};Dialer[_0x02de('0x18')][_0x02de('0xad')]=function(_0x4b3712){if(_0x4b3712['dialMethod']!==_0x02de('0x9')){clearPredictiveAttributes(_0x4b3712);}switch(_0x4b3712['dialMethod']){case _0x02de('0xae'):this['handlePower'](_0x4b3712,0x1);break;case _0x02de('0xaf'):this[_0x02de('0xb0')](_0x4b3712,_0x4b3712['dialPowerLevel']);break;case'predictive':this['predictive'](_0x4b3712);break;case'booked':this[_0x02de('0xb0')](_0x4b3712,0x1);break;default:logger[_0x02de('0x62')](_0x02de('0xb1'),_0x4b3712[_0x02de('0x45')],'method\x20not\x20recognized');}};Dialer[_0x02de('0x18')][_0x02de('0x8e')]=function(_0x11b37f,_0x50d071){var _0x28d0e8=_0x11b37f[_0x02de('0xaa')];var _0x3e1666=_0x50d071?_0x11b37f[_0x02de('0xa9')]:_0x11b37f[_0x02de('0x6f')][_0x02de('0x72')];logger['silly']('Dialer::ifTime()',_0x3e1666,_0x28d0e8,_0x11b37f['name'],util[_0x02de('0x43')]('Voice\x20Queue\x20%s\x20$s',_0x11b37f[_0x02de('0x45')],_0x11b37f['id']));var _0x26729c=null;return Interval[_0x02de('0xb2')](_0x3e1666,_0x28d0e8)[_0x02de('0xa8')](function(_0x2f6837){if(_0x2f6837===!![]){return _0x2f6837;}else{_0x11b37f[_0x02de('0x66')]=_0x50d071?utils[_0x02de('0x67')][_0x02de('0xb3')]:utils[_0x02de('0x67')][_0x02de('0xa0')];_0x26729c=msgResponse('[ifTime][promiseAll]',_0x02de('0x8f'),_0x02de('0xa2')+_0x50d071+'\x20'+_0x11b37f[_0x02de('0x45')]+_0x02de('0xa3')+util['inspect'](_0x3e1666,{'showHidden':![],'depth':null})+_0x02de('0xa4')+_0x28d0e8);}if(_0x26729c!==null){logger[_0x02de('0xb4')](_0x02de('0xb5'),_0x26729c);_0x26729c[_0x02de('0xb6')]=_0x50d071;throw _0x26729c;}})[_0x02de('0x9d')](function(_0x159015){logger[_0x02de('0x62')](_0x02de('0xb7'),_0x159015);throw msgResponse('[ifTime][Action]','Error',util[_0x02de('0x42')](_0x159015,{'showHidden':![],'depth':null}));});};Dialer['prototype']['syncAgentConnect']=function(_0x564511){if(this[_0x02de('0x1e')][_0x564511[_0x02de('0xb8')]]){if(this[_0x02de('0x26')][_0x564511['uniqueid']]&&this[_0x02de('0x26')][_0x564511['uniqueid']][_0x02de('0xb9')]!=='ivr'){this[_0x02de('0xba')](this[_0x02de('0x1e')][_0x564511['queue']]);this[_0x02de('0x26')][_0x564511[_0x02de('0xbb')]][_0x02de('0xbc')]=moment()[_0x02de('0x43')](_0x02de('0xbd'));}}};Dialer[_0x02de('0x18')][_0x02de('0x2f')]=function(_0x106719){var _0x3e9ed4=this[_0x02de('0x26')][_0x106719[_0x02de('0xbb')]];if(this[_0x02de('0x1e')][_0x106719['queue']]){if(_0x3e9ed4&&_0x3e9ed4[_0x02de('0xb9')]!==_0x02de('0xbe')){delete this['uniqueId'][_0x106719[_0x02de('0xbb')]];this['voiceQueues'][_0x106719[_0x02de('0xb8')]][_0x02de('0xbf')]+=0x1;var _0x8a57b5=new AgentComplete(_0x3e9ed4,_0x106719);if(_0x106719[_0x02de('0xc0')]==='agent'){_0x8a57b5[_0x02de('0xc1')]=this[_0x02de('0x1e')][_0x106719[_0x02de('0xb8')]][_0x02de('0xc2')]&&this[_0x02de('0x1e')][_0x106719['queue']][_0x02de('0xc3')]?moment()['format'](_0x02de('0xbd')):undefined;}hopperUtils[_0x02de('0xc4')](_0x8a57b5)[_0x02de('0x9d')](loggerCatch(_0x02de('0xc5')));hopperUtils[_0x02de('0xc6')](_0x8a57b5)[_0x02de('0x9d')](loggerCatch(_0x02de('0xc7')));}}};Dialer[_0x02de('0x18')][_0x02de('0x2c')]=function(_0x5ddc6f){var _0x4746e5=this[_0x02de('0x26')][_0x5ddc6f[_0x02de('0xbb')]];var _0x47946d=this;var _0x4dc3ed=![];var _0x56921b;var _0x589d02;if(this[_0x02de('0x1e')][_0x5ddc6f[_0x02de('0xb8')]]){if(_0x4746e5&&_0x4746e5[_0x02de('0xb9')]!=='ivr'){delete this[_0x02de('0x26')][_0x5ddc6f['uniqueid']];this['updateOriginated'](this[_0x02de('0x1e')][_0x5ddc6f['queue']]);_0x4746e5['droptime']=moment()[_0x02de('0x43')](_0x02de('0xbd'));var _0x2301ef=new QueueCallerAbandon(_0x4746e5,_0x5ddc6f);if(utils[_0x02de('0xc8')](_0x4746e5[_0x02de('0xc9')],_0x4746e5['responsetime'])>=_0x4746e5[_0x02de('0xca')]){this[_0x02de('0x1e')][_0x5ddc6f['queue']][_0x02de('0xcb')]+=0x1;this['voiceQueues'][_0x5ddc6f[_0x02de('0xb8')]][_0x02de('0xcc')]+=0x1;this[_0x02de('0x1e')][_0x5ddc6f[_0x02de('0xb8')]]['predictiveIntervalErlangCallsDroppedCalls']+=0x1;_0x2301ef[_0x02de('0x6a')]=0xa;_0x2301ef[_0x02de('0xcd')]=_0x02de('0xce');_0x2301ef[_0x02de('0xcf')]=_0x02de('0xd0');_0x2301ef[_0x02de('0xc1')]=this[_0x02de('0x1e')][_0x5ddc6f[_0x02de('0xb8')]][_0x02de('0xc2')]?moment()[_0x02de('0x43')](_0x02de('0xbd')):undefined;_0x2301ef[_0x02de('0xd1')]+=0x1;_0x2301ef[_0x02de('0xd2')]+=0x1;_0x56921b=this[_0x02de('0x1e')][_0x5ddc6f[_0x02de('0xb8')]][_0x02de('0xd3')];_0x589d02=this[_0x02de('0x1e')][_0x5ddc6f[_0x02de('0xb8')]]['callAdditionalPhoneAfterMin'];hopperUtils[_0x02de('0xd4')](_0x2301ef,_0x2301ef['state'],_0x4746e5[_0x02de('0xd5')])[_0x02de('0xa8')](function(_0x140949){_0x4dc3ed=_0x140949[_0x02de('0xd6')]==0x1;if(_0x2301ef[_0x02de('0xd1')]>=_0x47946d[_0x02de('0x1e')][_0x5ddc6f[_0x02de('0xb8')]]['dialDropMaxRetry']){_0x47946d[_0x02de('0xd7')](_0x2301ef,_0x140949[_0x02de('0xd6')]);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x2301ef[_0x02de('0xd1')],'scheduledat':moment()[_0x02de('0xd8')](_0x47946d['voiceQueues'][_0x5ddc6f[_0x02de('0xb8')]][_0x02de('0xd3')],_0x02de('0xd9'))['format'](_0x02de('0xbd')),'ContactId':_0x4746e5[_0x02de('0xda')],'ListId':_0x4746e5[_0x02de('0xdb')],'VoiceQueueId':_0x4746e5[_0x02de('0xdc')]||undefined,'CampaignId':_0x4746e5['CampaignId']||undefined})['catch'](loggerCatch(_0x02de('0xdd')));var _0x17f831=new History(_0x2301ef);_0x17f831[_0x02de('0x6a')]=0xa;_0x17f831[_0x02de('0xcd')]=_0x02de('0xce');_0x17f831[_0x02de('0x6c')]=moment()[_0x02de('0x43')](_0x02de('0xbd'));_0x17f831[_0x02de('0x6b')]=_0x17f831[_0x02de('0x6c')];_0x17f831['calleridname']=_0x2301ef['calleridname'];_0x17f831[_0x02de('0xde')]=_0x2301ef[_0x02de('0xde')];hopperUtils[_0x02de('0xc4')](_0x17f831)[_0x02de('0x9d')](loggerCatch(_0x02de('0xdf')));}})[_0x02de('0xa8')](function(){if(_0x4dc3ed)hopperUtils[_0x02de('0xe0')](_0x2301ef,_0x56921b,_0x589d02)['then'](function(){return 0x1;});});}else{this['voiceQueues'][_0x5ddc6f['queue']][_0x02de('0x4f')]+=0x1;this['voiceQueues'][_0x5ddc6f[_0x02de('0xb8')]][_0x02de('0xe1')]+=0x1;_0x2301ef[_0x02de('0x6a')]=0xb;_0x2301ef[_0x02de('0xcd')]=_0x02de('0xe2');_0x2301ef['dropreason']=_0x02de('0xe3');_0x2301ef[_0x02de('0xe4')]+=0x1;_0x2301ef[_0x02de('0xd2')]+=0x1;_0x56921b=this[_0x02de('0x1e')][_0x5ddc6f[_0x02de('0xb8')]][_0x02de('0xe5')];_0x589d02=this['voiceQueues'][_0x5ddc6f[_0x02de('0xb8')]][_0x02de('0xe6')];hopperUtils['verifyAdditionalPhones'](_0x2301ef,_0x2301ef[_0x02de('0x6a')],_0x4746e5[_0x02de('0xd5')])[_0x02de('0xa8')](function(_0x26a9f6){if(_0x2301ef[_0x02de('0xe4')]>=_0x47946d[_0x02de('0x1e')][_0x5ddc6f[_0x02de('0xb8')]][_0x02de('0xe7')]){_0x47946d[_0x02de('0xd7')](_0x2301ef,_0x26a9f6[_0x02de('0xd6')]);}else{hopperUtils['rescheduleContact']({'active':![],'countabandonedretry':_0x2301ef['countabandonedretry'],'scheduledat':moment()['add'](_0x47946d[_0x02de('0x1e')][_0x5ddc6f['queue']]['dialAbandonedRetryFrequency'],_0x02de('0xd9'))[_0x02de('0x43')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x4746e5['ContactId'],'ListId':_0x4746e5[_0x02de('0xdb')],'VoiceQueueId':_0x4746e5[_0x02de('0xdc')]||undefined,'CampaignId':_0x4746e5[_0x02de('0xe8')]||undefined})['catch'](loggerCatch('[rescheduleContact][Abandoned]'));var _0x53e19e=new History(_0x2301ef);_0x53e19e[_0x02de('0x6a')]=0xb;_0x53e19e['statedesc']=_0x02de('0xe2');_0x53e19e[_0x02de('0x6c')]=moment()['format'](_0x02de('0xbd'));_0x53e19e[_0x02de('0x6b')]=_0x53e19e[_0x02de('0x6c')];_0x53e19e['calleridname']=_0x2301ef[_0x02de('0xe9')];_0x53e19e[_0x02de('0xde')]=_0x2301ef[_0x02de('0xde')];hopperUtils[_0x02de('0xc4')](_0x53e19e)[_0x02de('0x9d')](loggerCatch(_0x02de('0xea')));}})[_0x02de('0xa8')](function(){if(_0x4dc3ed)hopperUtils[_0x02de('0xe0')](_0x2301ef,_0x56921b,_0x589d02)[_0x02de('0xa8')](function(){return 0x1;});});}}}};Dialer[_0x02de('0x18')][_0x02de('0x35')]=function(_0x1cd3b5){if(this['actions'][_0x1cd3b5[_0x02de('0xbb')]]){this[_0x02de('0x24')][_0x1cd3b5[_0x02de('0xbb')]]['channel']=_0x1cd3b5[_0x02de('0xeb')];}if(this[_0x02de('0x26')][_0x1cd3b5[_0x02de('0xbb')]]){this['uniqueId'][_0x1cd3b5['uniqueid']][_0x02de('0xeb')]=_0x1cd3b5['channel'];}};Dialer['prototype'][_0x02de('0x38')]=function(_0x3c6a57){if(!this['actions'][_0x3c6a57[_0x02de('0xec')]]){return;}var _0x3a1535=this['voiceQueues'][this[_0x02de('0x24')][_0x3c6a57[_0x02de('0xec')]][_0x02de('0xb8')]][_0x02de('0xed')]||_0x02de('0xee');if(_0x3a1535===_0x02de('0xef')){if(this[_0x02de('0x24')][_0x3c6a57[_0x02de('0xec')]]&&_[_0x02de('0xf0')](this['actions'][_0x3c6a57[_0x02de('0xec')]][_0x02de('0xf1')])&&_0x3c6a57['status']==='1'&&_0x3c6a57[_0x02de('0xf2')]==='0'){if(this['agents'][_0x3c6a57[_0x02de('0xf3')]]){if(!this[_0x02de('0x20')][_0x3c6a57['stateinterface']][_0x02de('0xf1')]){this[_0x02de('0x20')][_0x3c6a57['stateinterface']][_0x02de('0xf1')]=!![];this[_0x02de('0x24')][_0x3c6a57[_0x02de('0xec')]][_0x02de('0xf1')]=!![];this[_0x02de('0x24')][_0x3c6a57['actionid']][_0x02de('0xf3')]=_0x3c6a57['stateinterface'];}}}}else if(_0x3a1535==='rrmemory'){if(this[_0x02de('0x24')][_0x3c6a57[_0x02de('0xec')]]){if(this[_0x02de('0x20')][_0x3c6a57[_0x02de('0xf3')]]){this[_0x02de('0x24')][_0x3c6a57['actionid']][_0x02de('0xf3')]=_0x3c6a57[_0x02de('0xf3')];if(_['isNil'](this['queueBooked'][this['actions'][_0x3c6a57[_0x02de('0xec')]]['queue']])){this[_0x02de('0x29')][this[_0x02de('0x24')][_0x3c6a57[_0x02de('0xec')]][_0x02de('0xb8')]]=[];}this[_0x02de('0x29')][this[_0x02de('0x24')][_0x3c6a57[_0x02de('0xec')]][_0x02de('0xb8')]][_0x02de('0x95')](_[_0x02de('0xf4')](_[_0x02de('0xf5')](this[_0x02de('0x24')][_0x3c6a57[_0x02de('0xec')]],[_0x02de('0xf6'),'stateinterface']),{'status':_0x3c6a57[_0x02de('0x85')],'paused':_0x3c6a57[_0x02de('0xf2')]}));}}}};Dialer['prototype']['syncQueueStatusComplete']=function(_0x4e53c0){if(!this[_0x02de('0x24')][_0x4e53c0[_0x02de('0xec')]]){return;}var _0x4f65d6=this;var _0x9abd26=this[_0x02de('0x1e')][this['actions'][_0x4e53c0[_0x02de('0xec')]][_0x02de('0xb8')]];var _0x287c6c=_0x9abd26['strategy']||'rrmemory';if(_0x287c6c===_0x02de('0xef')){if(this[_0x02de('0x24')][_0x4e53c0['actionid']]&&this[_0x02de('0x24')][_0x4e53c0[_0x02de('0xec')]][_0x02de('0xf3')]){this[_0x02de('0x1d')][_0x02de('0xf7')](this[_0x02de('0x24')][_0x4e53c0[_0x02de('0xec')]][_0x02de('0xf6')],this[_0x02de('0x24')][_0x4e53c0[_0x02de('0xec')]][_0x02de('0xf3')])[_0x02de('0x9d')](function(_0x96c5f9){logger[_0x02de('0x62')](_0x02de('0xf8'),util[_0x02de('0x42')](_0x96c5f9,{'showHidden':![],'depth':null}));})['finally'](function(){_0x4f65d6['updateOriginated'](_0x4f65d6['voiceQueues'][_0x4f65d6[_0x02de('0x24')][_0x4e53c0[_0x02de('0xec')]][_0x02de('0xb8')]]);_0x4f65d6[_0x02de('0x20')][_0x4f65d6['actions'][_0x4e53c0[_0x02de('0xec')]][_0x02de('0xf3')]][_0x02de('0xf1')]=![];delete _0x4f65d6[_0x02de('0x24')][_0x4e53c0['actionid']];unlockQueueStatus(_0x9abd26);});}else{this[_0x02de('0xba')](this[_0x02de('0x1e')][this['actions'][_0x4e53c0[_0x02de('0xec')]][_0x02de('0xb8')]]);hopperUtils[_0x02de('0xf9')]({'active':![],'ContactId':this[_0x02de('0x24')][_0x4e53c0[_0x02de('0xec')]][_0x02de('0xda')],'ListId':this[_0x02de('0x24')][_0x4e53c0[_0x02de('0xec')]]['ListId'],'VoiceQueueId':this['actions'][_0x4e53c0[_0x02de('0xec')]][_0x02de('0xdc')]||undefined,'CampaignId':this[_0x02de('0x24')][_0x4e53c0['actionid']][_0x02de('0xe8')]||undefined})[_0x02de('0x9d')](loggerCatch(_0x02de('0xfa')));delete this[_0x02de('0x24')][_0x4e53c0[_0x02de('0xec')]];unlockQueueStatus(_0x9abd26);}}else if(_0x287c6c===_0x02de('0xee')){var _0xcccf53;if(this[_0x02de('0x24')][_0x4e53c0[_0x02de('0xec')]]&&!_[_0x02de('0x47')](this[_0x02de('0x29')][this['actions'][_0x4e53c0[_0x02de('0xec')]][_0x02de('0xb8')]])){if(this['queueBookedRR'][_0x4f65d6[_0x02de('0x24')][_0x4e53c0[_0x02de('0xec')]][_0x02de('0xb8')]]){this[_0x02de('0xfb')][_0x4f65d6['actions'][_0x4e53c0[_0x02de('0xec')]][_0x02de('0xb8')]]=this[_0x02de('0xfb')][this['actions'][_0x4e53c0[_0x02de('0xec')]][_0x02de('0xb8')]]?this[_0x02de('0xfb')][this[_0x02de('0x24')][_0x4e53c0[_0x02de('0xec')]][_0x02de('0xb8')]]:this['queueBooked'][this[_0x02de('0x24')][_0x4e53c0[_0x02de('0xec')]]['queue']]?this[_0x02de('0x29')][this[_0x02de('0x24')][_0x4e53c0[_0x02de('0xec')]][_0x02de('0xb8')]][_0x02de('0xfc')]||0x0:0x0;}this[_0x02de('0x29')][this[_0x02de('0x24')][_0x4e53c0['actionid']][_0x02de('0xb8')]][_0x02de('0xfc')]=this[_0x02de('0xfb')][this[_0x02de('0x24')][_0x4e53c0[_0x02de('0xec')]][_0x02de('0xb8')]];for(var _0x3e309a=0x0;_0x3e309a=_0x57af8c[_0x02de('0x11f')]){_0x55bcf9[_0x02de('0x120')](_0x256337,_0x15e127,_0xb578fd,_0x02de('0x121'));}else{if(_0x256337['countmachineretry']>=_0x57af8c[_0x02de('0x122')]){_0x55bcf9[_0x02de('0x123')](_0x256337,_0x15e127,_0xb578fd,_0x02de('0x124'));}else{hopperUtils[_0x02de('0xf9')]({'active':![],'countmachineretry':_0x256337[_0x02de('0x11a')],'scheduledat':moment()[_0x02de('0xd8')](_0x57af8c[_0x02de('0x125')],_0x02de('0xd9'))[_0x02de('0x43')](_0x02de('0xbd')),'ContactId':_0x256337[_0x02de('0xda')],'ListId':_0x256337['ListId'],'VoiceQueueId':_0x256337[_0x02de('0xdc')]||undefined,'CampaignId':_0x256337[_0x02de('0xe8')]||undefined})['catch'](loggerCatch(_0x02de('0x126')));_0x15e127({'reschedule':0x1});}}});}if(_0x567015['type']===_0x02de('0xbe')&&this['campaigns'][_0x567015['queue']][_0x02de('0x116')]&&_0x3cbcbe[_0x02de('0x117')]===_0x02de('0x10e')){delete this['uniqueId'][_0x3cbcbe[_0x02de('0xbb')]];this[_0x02de('0xba')](this[_0x02de('0x1f')][_0x567015['queue']]);_0x26f6e7=new Hangup(_0x567015,_0x3cbcbe);_0x26f6e7[_0x02de('0x6a')]=0x12;_0x26f6e7['statedesc']='HangupInAMD';_0x26f6e7['membername']=_0x02de('0x110');ami['emit'](_0x02de('0x11b'),ut[_0x02de('0x111')](_0x26f6e7,_0x02de('0x112')));this['saveInDb'](_0x26f6e7,_0x02de('0x127'),_0x02de('0x128'));}if(_0x567015[_0x02de('0xb9')]==='ivr'&&this['campaigns'][_0x567015['queue']]['dialAMDActive']&&_0x3cbcbe[_0x02de('0x117')]===_0x02de('0x118')){return new Promise(function(_0x7b507b,_0x4634c2){delete _0x55bcf9[_0x02de('0x26')][_0x3cbcbe[_0x02de('0xbb')]];_0x55bcf9[_0x02de('0xba')](_0x55bcf9[_0x02de('0x1f')][_0x567015[_0x02de('0xb8')]]);_0x55bcf9[_0x02de('0x1f')][_0x567015['queue']][_0x02de('0xbf')]+=0x1;_0x55bcf9[_0x02de('0x1f')][_0x567015[_0x02de('0xb8')]][_0x02de('0x10f')]+=0x1;var _0x12aab1=_0x55bcf9[_0x02de('0x1f')][_0x567015[_0x02de('0xb8')]];var _0x1c0a55=new Hangup(_0x567015,_0x3cbcbe);_0x1c0a55[_0x02de('0x6a')]=0x13;_0x1c0a55[_0x02de('0xcd')]='Machine';_0x1c0a55[_0x02de('0x129')]=_0x02de('0x110');_0x1c0a55['countmachineretry']+=0x1;_0x1c0a55[_0x02de('0xd2')]+=0x1;_0x1c0a55['amd']=!![];ami[_0x02de('0x3e')](_0x02de('0x11b'),ut[_0x02de('0x111')](_0x1c0a55,_0x02de('0x112')));hopperUtils[_0x02de('0xc4')](_0x1c0a55)['catch'](loggerCatch(_0x02de('0x11c')));if(_0x1c0a55[_0x02de('0x11d')]+_0x1c0a55['countcongestionretry']+_0x1c0a55[_0x02de('0x12a')]+_0x1c0a55[_0x02de('0x12b')]+_0x1c0a55[_0x02de('0xd1')]+_0x1c0a55[_0x02de('0xe4')]+_0x1c0a55[_0x02de('0x11a')]+_0x1c0a55[_0x02de('0x12c')]>=_0x12aab1[_0x02de('0x11f')]){_0x55bcf9[_0x02de('0x120')](_0x1c0a55,_0x7b507b,_0x4634c2,_0x02de('0x121'));}else{if(_0x1c0a55['countmachineretry']>=_0x12aab1[_0x02de('0x122')]){_0x55bcf9[_0x02de('0x123')](_0x1c0a55,_0x7b507b,_0x4634c2,_0x02de('0x124'));}else{hopperUtils[_0x02de('0xf9')]({'active':![],'countmachineretry':_0x1c0a55[_0x02de('0x11a')],'scheduledat':moment()[_0x02de('0xd8')](_0x12aab1[_0x02de('0x125')],_0x02de('0xd9'))[_0x02de('0x43')](_0x02de('0xbd')),'ContactId':_0x1c0a55['ContactId'],'ListId':_0x1c0a55[_0x02de('0xdb')],'VoiceQueueId':_0x1c0a55[_0x02de('0xdc')]||undefined,'CampaignId':_0x1c0a55[_0x02de('0xe8')]||undefined})[_0x02de('0x9d')](loggerCatch('[rescheduleContact][Machine]'));_0x7b507b({'reschedule':0x1});}}});}}};Dialer[_0x02de('0x18')][_0x02de('0x33')]=function(_0x59b210){var _0x2e9d2a=this[_0x02de('0x26')][_0x59b210[_0x02de('0xbb')]];var _0x330651;if(_0x2e9d2a&&_0x2e9d2a[_0x02de('0xb9')]===_0x02de('0xbe')){delete this[_0x02de('0x26')][_0x59b210[_0x02de('0xbb')]];this[_0x02de('0xba')](this['campaigns'][_0x2e9d2a[_0x02de('0xb8')]]);this['campaigns'][_0x2e9d2a[_0x02de('0xb8')]][_0x02de('0x12d')]+=0x1;_0x330651=new Hangup(_0x2e9d2a,_0x59b210);hopperUtils[_0x02de('0xc4')](_0x330651)[_0x02de('0x9d')](loggerCatch(_0x02de('0x12e')));hopperUtils['moveContactManagedDialer'](_0x330651)[_0x02de('0x9d')](loggerCatch(_0x02de('0x12f')));}if(_0x2e9d2a&&_0x2e9d2a[_0x02de('0xb9')]!=='ivr'&&isNotNull(this[_0x02de('0x1e')][_0x2e9d2a['queue']][_0x02de('0x130')])){delete this['uniqueId'][_0x59b210['uniqueid']];this[_0x02de('0xba')](this['voiceQueues'][_0x2e9d2a['queue']]);this[_0x02de('0x1e')][_0x2e9d2a[_0x02de('0xb8')]][_0x02de('0xbf')]+=0x1;this[_0x02de('0x1e')][_0x2e9d2a[_0x02de('0xb8')]][_0x02de('0x10f')]+=0x1;_0x330651=new Hangup(_0x2e9d2a,_0x59b210);_0x330651[_0x02de('0x6a')]=0x10;_0x330651[_0x02de('0xcd')]=_0x02de('0x131');_0x330651[_0x02de('0x129')]=_0x02de('0x132');hopperUtils[_0x02de('0xc4')](_0x330651)['catch'](loggerCatch(_0x02de('0x12e')));hopperUtils['moveContactManagedDialer'](_0x330651)[_0x02de('0x9d')](loggerCatch(_0x02de('0x12f')));}if(_0x2e9d2a&&_0x2e9d2a[_0x02de('0xb9')]!==_0x02de('0xbe')&&!isNotNull(this['voiceQueues'][_0x2e9d2a['queue']][_0x02de('0x130')])){delete this[_0x02de('0x26')][_0x59b210[_0x02de('0xbb')]];this['updateOriginated'](this[_0x02de('0x1e')][_0x2e9d2a['queue']]);this[_0x02de('0x1e')][_0x2e9d2a['queue']][_0x02de('0x133')]+=0x1;_0x330651=new Hangup(_0x2e9d2a,_0x59b210);_0x330651['state']=0xc;_0x330651[_0x02de('0xcd')]=_0x59b210['cause-txt'];_0x330651[_0x02de('0x129')]=_0x02de('0x134');hopperUtils[_0x02de('0xc4')](_0x330651)[_0x02de('0x9d')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x02de('0xc6')](_0x330651)['catch'](loggerCatch(_0x02de('0x12f')));}};Dialer[_0x02de('0x18')][_0x02de('0x31')]=function(_0x1e7b21){var _0x22e404=this;if(!_0x22e404[_0x02de('0x135')][_0x1e7b21[_0x02de('0x45')]]){_0x22e404[_0x02de('0x135')][_0x1e7b21[_0x02de('0x45')]]={'running':![]};}else if(_0x22e404['queuesSummary'][_0x1e7b21[_0x02de('0x45')]]['running']===!![]){return;}else if(_0x22e404[_0x02de('0x135')][_0x1e7b21['name']][_0x02de('0x136')]===![]){_0x22e404[_0x02de('0x135')][_0x1e7b21['name']][_0x02de('0x136')]=!![];}var _0x3fc358=_0x22e404[_0x02de('0x1e')][_0x1e7b21[_0x02de('0x45')]];var _0x54255f=_0x3fc358['message']!==utils[_0x02de('0x67')][_0x02de('0x74')];var _0x2dee7d=utils[_0x02de('0x137')](_0x3fc358);_0x3fc358[_0x02de('0x138')]=utils[_0x02de('0x139')](_0x3fc358,_0x22e404[_0x02de('0x21')]);Promise[_0x02de('0xa7')]()['then'](function(){if(_0x3fc358[_0x02de('0x138')]===utils[_0x02de('0x67')][_0x02de('0x74')]){if(_0x54255f){clearPredictiveAttributes(_0x3fc358);_0x1e7b21[_0x02de('0x27')]=undefined;_0x1e7b21['startProgressive']=undefined;}if(_0x3fc358[_0x02de('0x138')]===utils[_0x02de('0x67')]['INACTIVE']){_0x1e7b21[_0x02de('0x13a')]=0x0;_0x1e7b21[_0x02de('0xf2')]=0x0;_0x1e7b21[_0x02de('0x13b')]=0x0;_0x1e7b21[_0x02de('0x13c')]=0x0;_0x1e7b21['pTalking']=0x0;}}else if(_0x3fc358['statusMessage']===utils['CAMPAIGN_STATUS'][_0x02de('0x13d')]&&!_0x2dee7d){return _0x22e404[_0x02de('0x8e')](_0x3fc358,!![])[_0x02de('0xa8')](function(){return _0x22e404[_0x02de('0x8e')](_0x3fc358,![]);})[_0x02de('0xa8')](function(){return _0x22e404['checkDialMethod'](_0x3fc358);})[_0x02de('0x9d')](function(_0x233c18){loggerSyncQueueSummary[_0x02de('0x40')](_0x02de('0x13e'),util[_0x02de('0x42')](_0x233c18,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x3fc358);});}else{clearPredictiveAttributes(_0x3fc358);}})[_0x02de('0xa8')](function(){var _0x2d7d17=_0x1e7b21['compareToOutboundQueue'](_0x3fc358);if(_0x2d7d17||_0x3fc358[_0x02de('0x13f')]){_0x3fc358[_0x02de('0x13f')]=![];_0x1e7b21[_0x02de('0x140')](_0x3fc358);Object['assign'](_0x3fc358,_0x1e7b21);emitOutboundVoiceQueueSummary(_0x1e7b21);}_0x22e404[_0x02de('0x135')][_0x3fc358[_0x02de('0x45')]]['running']=![];})[_0x02de('0x9d')](function(_0x93e53c){logger['error'](_0x02de('0x13e'),util[_0x02de('0x42')](_0x93e53c,{'showHidden':![],'depth':null}));_0x22e404[_0x02de('0x135')][_0x3fc358[_0x02de('0x45')]]['running']=![];});};Dialer[_0x02de('0x18')][_0x02de('0x32')]=_[_0x02de('0x141')](function(){var _0x3c2237=_[_0x02de('0x142')](this[_0x02de('0x1e')],function(_0xcb9ab){return _0xcb9ab[_0x02de('0x143')];});var _0xb8dcab=_[_0x02de('0x142')](this[_0x02de('0x20')],function(_0x108cff){return _0x108cff[_0x02de('0x144')]&&_0x108cff[_0x02de('0x85')]===_0x02de('0x86');});if(_0x3c2237[_0x02de('0x94')]>0x0&&_0xb8dcab[_0x02de('0x94')]>0x0){return Promise[_0x02de('0xa7')]()[_0x02de('0xa8')](cmHopper[_0x02de('0x145')](_[_0x02de('0x146')](_0x3c2237,'id'),previewRecallmeReminderInterval,_[_0x02de('0x146')](_0xb8dcab,'id')))[_0x02de('0xa8')](function(_0xe24a2d){for(var _0xb7018c=0x0;_0xb7018c<_0xe24a2d[_0x02de('0x94')];_0xb7018c++){var _0x5ecbfd=_0xe24a2d[_0xb7018c][_0x02de('0x147')]['name'];if(_0x5ecbfd)io['to'](util[_0x02de('0x43')](_0x02de('0x148'),_0x5ecbfd))[_0x02de('0x3e')](_0x02de('0x149'),{'hopper':_0xe24a2d[_0xb7018c]});}})[_0x02de('0x9d')](function(_0x190d77){logger[_0x02de('0x62')](_0x02de('0x14a'),_0x190d77);});}},0x3c*0x3e8,{'leading':!![]});Dialer['prototype'][_0x02de('0x14b')]=function(){var _0x3154c6=this;setInterval(function(){_0x3154c6['clearZombieChannels'](_0x3154c6[_0x02de('0x26')],'[uniqueid]');_0x3154c6[_0x02de('0x14c')](_0x3154c6['actions'],'[actions]');},0x32c8);};Dialer[_0x02de('0x18')][_0x02de('0x14c')]=function(_0x280cb5,_0x4de621){var _0x215b18=this;for(var _0x1bb72f in _0x280cb5){if(typeof _0x280cb5[_0x1bb72f]!==_0x02de('0xa6')){this[_0x02de('0x1c')][_0x02de('0x19')](function(){if(!_['isNil'](_0x280cb5[_0x1bb72f])){return ami[_0x02de('0x96')]({'action':_0x02de('0x85'),'channel':_0x280cb5[_0x1bb72f][_0x02de('0xeb')]})['catch'](function(_0x2d7ff6){if(_0x2d7ff6['message']===_0x02de('0x14d')){setTimeout(function(){if(_0x280cb5[_0x1bb72f]&&_0x280cb5[_0x1bb72f][_0x02de('0xb9')]!==_0x02de('0xbe')){_0x215b18[_0x02de('0xba')](_0x215b18[_0x02de('0x1e')][_0x280cb5[_0x1bb72f][_0x02de('0xb8')]]);logger[_0x02de('0x62')](_0x02de('0x14e'),_0x4de621,_0x1bb72f,_0x280cb5[_0x1bb72f][_0x02de('0xb8')]);delete _0x280cb5[_0x1bb72f];}if(_0x280cb5[_0x1bb72f]&&_0x280cb5[_0x1bb72f]['type']===_0x02de('0xbe')){_0x215b18['updateOriginated'](_0x215b18[_0x02de('0x1f')][_0x280cb5[_0x1bb72f][_0x02de('0xb8')]]);logger[_0x02de('0x62')](_0x02de('0x14f'),_0x4de621,_0x1bb72f,_0x280cb5[_0x1bb72f][_0x02de('0xb8')]);delete _0x280cb5[_0x1bb72f];}},0x2328);}});}});}}};Dialer[_0x02de('0x18')][_0x02de('0x150')]=function(_0x8e54ef){return Promise[_0x02de('0xa7')]()[_0x02de('0xa8')](voiceQueueRt[_0x02de('0x150')](_0x8e54ef))['catch'](loggerCatch(_0x02de('0x151')));};Dialer[_0x02de('0x18')][_0x02de('0xba')]=function(_0x2e6eb1){if(!_[_0x02de('0x3d')](_0x2e6eb1)&&_0x2e6eb1!==null){if(typeof _0x2e6eb1[_0x02de('0x79')]!==_0x02de('0xa6')){if(_0x2e6eb1[_0x02de('0x79')]>0x0){_0x2e6eb1[_0x02de('0x79')]-=0x1;}else{logger[_0x02de('0x62')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x02de('0x62')](_0x02de('0x152'));}};Dialer['prototype'][_0x02de('0x153')]=function(_0x379a04,_0x5bd9f2){var _0x12ef5d=this;return function(_0x2d74b1){_0x12ef5d[_0x02de('0xba')](_0x5bd9f2);logger[_0x02de('0x62')](_0x379a04,util[_0x02de('0x42')](_0x2d74b1,{'showHidden':![],'depth':null}));};};Dialer[_0x02de('0x18')]['emptyContact']=function(_0x457652,_0x38e48a,_0x2b9cc3){var _0x502e5d={'state':0x19,'statedesc':'notFound'};this[_0x02de('0xba')](_0x38e48a);this['saveInDb'](_[_0x02de('0xf4')](_0x502e5d,_[_0x02de('0xf5')](_0x2b9cc3,['ContactId',_0x02de('0xdb'),_0x02de('0x154'),_0x02de('0xdc'),'CampaignId'])),_0x02de('0x155'),_0x02de('0x156'));logger[_0x02de('0x62')](_0x457652);};Dialer[_0x02de('0x18')]['saveInDb']=function(_0x4b2c63,_0x5e935e,_0x56b678){hopperUtils[_0x02de('0xc4')](_0x4b2c63)[_0x02de('0x9d')](loggerCatch(_0x5e935e));hopperUtils[_0x02de('0xc6')](_0x4b2c63)[_0x02de('0x9d')](loggerCatch(_0x56b678));};Dialer[_0x02de('0x18')][_0x02de('0xd7')]=function(_0x5146c5,_0x3234c0){hopperUtils[_0x02de('0xc4')](_0x5146c5)[_0x02de('0x9d')](loggerCatch(_0x02de('0xc5')));if(_0x3234c0==0x0){hopperUtils[_0x02de('0xc6')](_0x5146c5)[_0x02de('0x9d')](loggerCatch(_0x02de('0x157')));}};Dialer[_0x02de('0x18')][_0x02de('0x14a')]=function(_0x46f83d){return Promise[_0x02de('0xa7')]()[_0x02de('0xa8')](cmHopper['handlePreviewRecallNotifications'](_0x46f83d['id'],previewRecallmeReminderInterval))[_0x02de('0xa8')](function(_0x1b95b2){for(var _0x3bf750=0x0;_0x3bf750<_0x1b95b2[_0x02de('0x94')];_0x3bf750++){var _0x3bfeb6=_0x1b95b2[_0x3bf750][_0x02de('0x147')][_0x02de('0x45')];if(_0x3bfeb6)io['to'](util[_0x02de('0x43')](_0x02de('0x148'),_0x3bfeb6))['emit'](_0x02de('0x149'),{'hopper':_0x1b95b2[_0x3bf750]});}})[_0x02de('0x9d')](function(){});};Dialer[_0x02de('0x18')][_0x02de('0xab')]=function(_0x18a6bf){var _0x312955=this;return function(){_0x312955[_0x02de('0x158')](_0x18a6bf);};};Dialer[_0x02de('0x18')][_0x02de('0x159')]=function(_0x311a41,_0x44ff74){var _0x4a37f7=this;var _0xdccc61=uuid['v4']();this[_0x02de('0x24')][_0xdccc61]=new Action(_0x311a41,_0x44ff74,_0xdccc61);return new Promise(function(_0x1028b4,_0x869168){if(_[_0x02de('0x3d')](_0x311a41)&&typeof _0x311a41!=='object'){return _0x869168(msgResponse(_0x02de('0x15a'),'Failure',_0x02de('0x15b')));}if(_[_0x02de('0x3d')](_0x44ff74[_0x02de('0x15c')])||_0x44ff74[_0x02de('0x15c')]===null){return _0x869168(msgResponse(_0x02de('0x15a'),_0x02de('0x8f'),_0x02de('0x15d')));}var _0x377724={'XMD-CALLERID':_0x4a37f7[_0x02de('0x24')][_0xdccc61][_0x02de('0x15e')](),'XMD-AGI':_0x311a41[_0x02de('0x130')]?util[_0x02de('0x43')]('\x22agi://%s/square,%s\x22',ipAgi,_0x311a41[_0x02de('0x130')]):_0x02de('0x15f'),'XMD-AGIAFTER':_0x311a41['dialQueueProject2']?util['format'](_0x02de('0x160'),ipAgi,_0x311a41[_0x02de('0xc2')]):_0x02de('0x15f'),'XMD-QUEUE':utils[_0x02de('0x161')](_0x311a41)?util['format'](_0x02de('0x162'),_0x311a41[_0x02de('0x45')],_0x311a41[_0x02de('0x163')]||'',_0x311a41[_0x02de('0xc3')]?'c':'',_0x311a41[_0x02de('0xca')]||0x3):'NONE','XMD-CONTACTID':_0x44ff74[_0x02de('0xda')],'XMD-CDRTYPE':'dialer','CALLERID(all)':_0x4a37f7[_0x02de('0x24')][_0xdccc61][_0x02de('0x15e')](),'XMD-AMD':_0x311a41[_0x02de('0x116')]?'ACTIVE':_0x02de('0x15f'),'XMD-DESTINATION':_0x02de('0x10d')};if(_0x311a41[_0x02de('0x116')]){_0x377724[_0x02de('0x164')]=_0x311a41[_0x02de('0x165')]||0x9c4;_0x377724[_0x02de('0x166')]=_0x311a41[_0x02de('0x167')]||0x5dc;_0x377724['XMD-AMDAFTERGREETINGSILENCE']=_0x311a41[_0x02de('0x168')]||0x320;_0x377724[_0x02de('0x169')]=_0x311a41[_0x02de('0x16a')]||0x1388;_0x377724['XMD-AMDMINWORDLENGTH']=_0x311a41[_0x02de('0x16b')]||0x64;_0x377724[_0x02de('0x16c')]=_0x311a41[_0x02de('0x16d')]||0x32;_0x377724[_0x02de('0x16e')]=_0x311a41[_0x02de('0x16f')]||0x3;_0x377724[_0x02de('0x170')]=_0x311a41[_0x02de('0x171')]||0x100;_0x377724[_0x02de('0x172')]=_0x311a41['dialAMDMaximumWordLength']||0x1388;}if(utils['isOutboundQueue'](_0x311a41)){_0x377724[_0x02de('0x173')]=_0x44ff74[_0x02de('0xdc')];}else{_0x377724['XMD-CAMPAIGNID']=_0x44ff74[_0x02de('0xe8')];}for(var _0x19963b in _0x44ff74[_0x02de('0x174')]){if(typeof _0x44ff74['Contact'][_0x19963b]!==_0x02de('0xa6')){if(isNotNull(_0x44ff74[_0x02de('0x174')][_0x19963b])&&_0x19963b!=='id'&&_0x19963b!==_0x02de('0x175')&&_0x19963b!=='createdAt'&&_0x19963b!=='updatedAt'){_0x377724[util[_0x02de('0x43')]('%s%s',_0x02de('0x176'),_[_0x02de('0x177')](_0x19963b))]=_0x44ff74[_0x02de('0x174')][_0x19963b];}}}var _0x5952da=_0x4a37f7[_0x02de('0x82')](_0x311a41[_0x02de('0x88')])?utils[_0x02de('0x178')](_0x311a41[_0x02de('0x88')][_0x02de('0x179')],_0x311a41['dialOriginateCallerIdName'],_0x311a41[_0x02de('0x17a')]>0x0?utils['getCallerIdRandom'](_0x311a41[_0x02de('0x17b')],_0x311a41[_0x02de('0x17a')]):_0x311a41[_0x02de('0x17b')]):utils['getCallerId'](_['isNil'](_0x311a41[_0x02de('0x89')])?_0x311a41[_0x02de('0x88')][_0x02de('0x179')]:_0x311a41[_0x02de('0x89')]['callerid'],_0x311a41[_0x02de('0x17c')],_0x311a41['dialRandomLastDigitCallerIdNumber']>0x0?utils['getCallerIdRandom'](_0x311a41[_0x02de('0x17b')],_0x311a41['dialRandomLastDigitCallerIdNumber']):_0x311a41[_0x02de('0x17b')]);if(_0x5952da){_0x377724['XMD-ORIGINATECALLERIDNAME']=_0x4a37f7[_0x02de('0x24')][_0xdccc61]['originatecalleridname']=utils[_0x02de('0x17d')](_0x5952da);_0x377724[_0x02de('0x17e')]=_0x44ff74[_0x02de('0x15c')];}_0x311a41[_0x02de('0x17f')]=_0x377724;return ami[_0x02de('0x96')]({'actionid':_0xdccc61,'action':_0x02de('0x15a'),'channel':_0x4a37f7['isTrunkReachable'](_0x311a41['Trunk'])?util[_0x02de('0x43')]('SIP/%s/%s%s',_0x311a41[_0x02de('0x88')]['name'],isNotNull(_0x311a41['dialPrefix'])?_0x311a41[_0x02de('0x180')][_0x02de('0x181')]()||'':'',_0x311a41['dialCutDigit']>0x0?_0x44ff74[_0x02de('0x15c')]['substring'](_0x311a41[_0x02de('0x182')]):_0x44ff74[_0x02de('0x15c')]):util[_0x02de('0x43')](_0x02de('0x183'),_[_0x02de('0xf0')](_0x311a41['TrunkBackup'])?_0x311a41[_0x02de('0x88')]['name']:_0x311a41[_0x02de('0x89')][_0x02de('0x45')],isNotNull(_0x311a41[_0x02de('0x180')])?_0x311a41[_0x02de('0x180')][_0x02de('0x181')]()||'':'',_0x311a41[_0x02de('0x182')]>0x0?_0x44ff74['phone'][_0x02de('0x184')](_0x311a41[_0x02de('0x182')]):_0x44ff74[_0x02de('0x15c')]),'callerid':_0x5952da,'Exten':_0x02de('0x10d'),'Context':'from-sip','Priority':'1','variable':_0x377724,'timeout':(_0x311a41['dialOriginateTimeout']||0x1e)*0x3e8,'async':!![],'channelid':_0xdccc61})[_0x02de('0xa8')](function(_0x530aee){return _0x1028b4(_0x530aee);})[_0x02de('0x9d')](function(_0x514fb4){_0x311a41[_0x02de('0x185')]+=0x1;var _0x15ea65=new History(_0x4a37f7[_0x02de('0x24')][_0xdccc61]);logger[_0x02de('0x62')](util[_0x02de('0x43')](_0x02de('0x186'),JSON[_0x02de('0x81')](_0x514fb4)));_0x15ea65['state']=0xe;_0x15ea65['statedesc']=_0x02de('0x187');_0x15ea65['starttime']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x15ea65[_0x02de('0x6b')]=_0x15ea65[_0x02de('0x6c')];hopperUtils[_0x02de('0xc4')](_0x15ea65)['catch'](loggerCatch(_0x02de('0x188')));_0x4a37f7[_0x02de('0xc6')](_0x15ea65)[_0x02de('0x9d')](loggerCatch(_0x02de('0x188')))[_0x02de('0x1b')](function(){delete _0x4a37f7['actions'][_0xdccc61];return _0x869168(msgResponse(_0x02de('0x15a'),'Error',_0x02de('0x189')));});});});};Dialer[_0x02de('0x18')][_0x02de('0x18a')]=function(_0x3166a4,_0x38cb47,_0x510d4d){var _0xa7e9bb=new History(_0x38cb47);if(_0xa7e9bb['countbusyretry']+_0xa7e9bb['countcongestionretry']+_0xa7e9bb['countnoanswerretry']+_0xa7e9bb[_0x02de('0x12b')]+_0xa7e9bb[_0x02de('0xd1')]+_0xa7e9bb[_0x02de('0xe4')]+_0xa7e9bb[_0x02de('0x11a')]+_0xa7e9bb[_0x02de('0x12c')]>=_0x510d4d[_0x02de('0x11f')]-0x1){return!![];}switch(_0x3166a4){case 0x3:if(_0xa7e9bb[_0x02de('0x12a')]>=_0x510d4d[_0x02de('0x18b')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countnoanswerretry':_0xa7e9bb[_0x02de('0x12a')]+=0x1,'scheduledat':moment()[_0x02de('0xd8')](_0x510d4d[_0x02de('0x18c')],_0x02de('0xd9'))['format'](_0x02de('0xbd')),'ContactId':_0xa7e9bb['ContactId'],'ListId':_0xa7e9bb[_0x02de('0xdb')],'VoiceQueueId':_0xa7e9bb['VoiceQueueId']||undefined,'CampaignId':_0xa7e9bb[_0x02de('0xe8')]||undefined})[_0x02de('0x9d')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0xa7e9bb['countbusyretry']>=_0x510d4d[_0x02de('0x18d')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countbusyretry':_0xa7e9bb[_0x02de('0x11d')]+=0x1,'scheduledat':moment()['add'](_0x510d4d[_0x02de('0x18e')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0xa7e9bb[_0x02de('0xda')],'ListId':_0xa7e9bb[_0x02de('0xdb')],'VoiceQueueId':_0xa7e9bb['VoiceQueueId']||undefined,'CampaignId':_0xa7e9bb[_0x02de('0xe8')]||undefined})[_0x02de('0x9d')](loggerCatch(_0x02de('0x18f')));break;case 0x8:if(_0xa7e9bb[_0x02de('0x11e')]>=_0x510d4d['dialCongestionMaxRetry']-0x1){return!![];}hopperUtils[_0x02de('0xf9')]({'active':![],'countcongestionretry':_0xa7e9bb['countcongestionretry']+=0x1,'scheduledat':moment()[_0x02de('0xd8')](_0x510d4d['dialCongestionRetryFrequency'],'minutes')[_0x02de('0x43')](_0x02de('0xbd')),'ContactId':_0xa7e9bb[_0x02de('0xda')],'ListId':_0xa7e9bb[_0x02de('0xdb')],'VoiceQueueId':_0xa7e9bb[_0x02de('0xdc')]||undefined,'CampaignId':_0xa7e9bb[_0x02de('0xe8')]||undefined})[_0x02de('0x9d')](loggerCatch(_0x02de('0x190')));break;case 0x0:if(_0xa7e9bb[_0x02de('0x12b')]>=_0x510d4d[_0x02de('0x191')]-0x1){return!![];}else{hopperUtils['rescheduleContact']({'active':![],'countnosuchnumberretry':_0xa7e9bb[_0x02de('0x12b')]+=0x1,'scheduledat':moment()[_0x02de('0xd8')](_0x510d4d[_0x02de('0x192')],'minutes')[_0x02de('0x43')](_0x02de('0xbd')),'ContactId':_0xa7e9bb[_0x02de('0xda')],'ListId':_0xa7e9bb['ListId'],'VoiceQueueId':_0xa7e9bb[_0x02de('0xdc')]||undefined,'CampaignId':_0xa7e9bb['CampaignId']||undefined})[_0x02de('0x9d')](loggerCatch(_0x02de('0x193')));}break;case 0xa:if(_0xa7e9bb[_0x02de('0xd1')]>=_0x510d4d[_0x02de('0x194')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0xa7e9bb['countdropretry']+=0x1,'scheduledat':moment()['add'](_0x510d4d['dialDropRetryFrequency'],_0x02de('0xd9'))[_0x02de('0x43')](_0x02de('0xbd')),'ContactId':_0xa7e9bb[_0x02de('0xda')],'ListId':_0xa7e9bb[_0x02de('0xdb')],'VoiceQueueId':_0xa7e9bb['VoiceQueueId']||undefined,'CampaignId':_0xa7e9bb[_0x02de('0xe8')]||undefined})[_0x02de('0x9d')](loggerCatch(_0x02de('0xdd')));break;case 0xb:if(_0xa7e9bb['countabandonedretry']>=_0x510d4d[_0x02de('0xe7')]-0x1){return!![];}hopperUtils[_0x02de('0xf9')]({'active':![],'countabandonedretry':_0xa7e9bb[_0x02de('0xe4')]+=0x1,'scheduledat':moment()[_0x02de('0xd8')](_0x510d4d[_0x02de('0xe5')],'minutes')[_0x02de('0x43')](_0x02de('0xbd')),'ContactId':_0xa7e9bb[_0x02de('0xda')],'ListId':_0xa7e9bb[_0x02de('0xdb')],'VoiceQueueId':_0xa7e9bb[_0x02de('0xdc')]||undefined,'CampaignId':_0xa7e9bb[_0x02de('0xe8')]||undefined})[_0x02de('0x9d')](loggerCatch(_0x02de('0x195')));break;case 0x13:if(_0xa7e9bb[_0x02de('0x11a')]>=_0x510d4d[_0x02de('0x122')]-0x1){return!![];}hopperUtils[_0x02de('0xf9')]({'active':![],'countmachineretry':_0xa7e9bb['countmachineretry']+=0x1,'scheduledat':moment()[_0x02de('0xd8')](_0x510d4d[_0x02de('0x125')],'minutes')[_0x02de('0x43')](_0x02de('0xbd')),'ContactId':_0xa7e9bb[_0x02de('0xda')],'ListId':_0xa7e9bb[_0x02de('0xdb')],'VoiceQueueId':_0xa7e9bb['VoiceQueueId']||undefined,'CampaignId':_0xa7e9bb[_0x02de('0xe8')]||undefined})['catch'](loggerCatch('[rescheduleContact][Machine]'));break;case 0x14:if(_0xa7e9bb[_0x02de('0x12c')]>=_0x510d4d[_0x02de('0x196')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0xa7e9bb[_0x02de('0x12c')]+=0x1,'scheduledat':moment()[_0x02de('0xd8')](_0x510d4d['dialAgentRejectRetryFrequency'],_0x02de('0xd9'))['format'](_0x02de('0xbd')),'ContactId':_0xa7e9bb['ContactId'],'ListId':_0xa7e9bb['ListId'],'VoiceQueueId':_0xa7e9bb[_0x02de('0xdc')]||undefined,'CampaignId':_0xa7e9bb[_0x02de('0xe8')]||undefined})['catch'](loggerCatch(_0x02de('0x197')));break;default:return!![];}};Dialer['prototype'][_0x02de('0x108')]=function(_0x141240,_0x4690d7,_0x407317){var _0xc5c227=this;var _0x2ce15c=new History(_0x141240);var _0x1bc284=![];var _0x4dcdbf;var _0x2d156a;return new Promise(function(_0xe25289,_0x40abea){if(_['isUndefined'](_0x4690d7)&&typeof _0x4690d7!==_0x02de('0x198')){return _0x40abea(msgResponse(_0x02de('0x199'),_0x02de('0x8f'),_0x02de('0x19a')));}if(_[_0x02de('0x3d')](_0x407317)&&typeof _0x407317!==_0x02de('0x198')){return _0x40abea(msgResponse(_0x02de('0x199'),_0x02de('0x8f'),_0x02de('0x19b')));}hopperUtils[_0x02de('0xd4')](_0x2ce15c,_0x407317['reason'],_0x4690d7)[_0x02de('0xa8')](function(_0x538f27){if(_0x538f27[_0x02de('0xd6')]==0x1)_0x1bc284=!![];switch(_0x407317[_0x02de('0xc0')]){case'0':_0x4690d7[_0x02de('0x19c')]+=0x1;_0x2ce15c[_0x02de('0x6a')]=0x0;_0x2ce15c[_0x02de('0xcd')]=_0x02de('0x19d');_0x2ce15c[_0x02de('0x12b')]+=0x1;_0x2ce15c['countglobal']+=0x1;ami[_0x02de('0x3e')]('custom:agentnosuchnumber',ut[_0x02de('0x111')](_0x141240,_0x02de('0x19e')));_0x4dcdbf=_0x4690d7['dialNoSuchNumberRetryFrequency'];_0x2d156a=_0x4690d7[_0x02de('0xe6')];hopperUtils[_0x02de('0xc4')](_0x2ce15c)[_0x02de('0x9d')](loggerCatch(_0x02de('0x11c')));if(_0xc5c227[_0x02de('0x18a')](0x0,_0x141240,_0x4690d7)&&!_0x1bc284){if(_0x2ce15c[_0x02de('0x12b')]>=_0x4690d7[_0x02de('0x191')]){_0xc5c227[_0x02de('0x123')](_0x2ce15c,_0xe25289,_0x40abea,'reason\x200\x20no\x20such\x20number....');}else{_0xc5c227[_0x02de('0x120')](_0x2ce15c,_0xe25289,_0x40abea,_0x02de('0x19f'));}}break;case'3':_0x4690d7['outboundNoAnswerCallsDay']+=0x1;_0x2ce15c['state']=0x3;_0x2ce15c[_0x02de('0xcd')]=_0x02de('0x1a0');_0x2ce15c['countnoanswerretry']+=0x1;_0x2ce15c['countglobal']+=0x1;var _0x1fbe72=ut['buildNoAnswerEventPayload'](_0x141240,_0x4690d7);ami[_0x02de('0x3e')](_0x02de('0x1a1'),_0x1fbe72);_0x4dcdbf=_0x4690d7[_0x02de('0x18c')];_0x2d156a=_0x4690d7[_0x02de('0xe6')];hopperUtils[_0x02de('0xc4')](_0x2ce15c)[_0x02de('0x9d')](loggerCatch(_0x02de('0x1a2')));if(_0xc5c227[_0x02de('0x18a')](0x3,_0x141240,_0x4690d7)&&!_0x1bc284){if(_0x2ce15c[_0x02de('0x12a')]>=_0x4690d7[_0x02de('0x18b')]){_0xc5c227[_0x02de('0x123')](_0x2ce15c,_0xe25289,_0x40abea,_0x02de('0x1a3'));}else{_0xc5c227[_0x02de('0x120')](_0x2ce15c,_0xe25289,_0x40abea,_0x02de('0x1a3'));}}break;case'5':_0x4690d7[_0x02de('0x1a4')]+=0x1;_0x2ce15c[_0x02de('0x6a')]=0x5;_0x2ce15c[_0x02de('0xcd')]=_0x02de('0x1a5');_0x2ce15c[_0x02de('0x11d')]+=0x1;_0x2ce15c[_0x02de('0xd2')]+=0x1;ami[_0x02de('0x3e')](_0x02de('0x1a6'),ut[_0x02de('0x111')](_0x141240,_0x02de('0x1a7')));_0x4dcdbf=_0x4690d7[_0x02de('0x18e')];_0x2d156a=_0x4690d7['callAdditionalPhoneAfterMin'];hopperUtils[_0x02de('0xc4')](_0x2ce15c)[_0x02de('0x9d')](loggerCatch(_0x02de('0x1a8')));if(_0xc5c227[_0x02de('0x18a')](0x5,_0x141240,_0x4690d7)&&!_0x1bc284){if(_0x2ce15c['countbusyretry']>=_0x4690d7['dialBusyMaxRetry']){_0xc5c227[_0x02de('0x123')](_0x2ce15c,_0xe25289,_0x40abea,_0x02de('0x1a9'));}else{_0xc5c227[_0x02de('0x120')](_0x2ce15c,_0xe25289,_0x40abea,_0x02de('0x1a9'));}}break;case'8':_0x4690d7[_0x02de('0x1aa')]+=0x1;_0x2ce15c[_0x02de('0x6a')]=0x8;_0x2ce15c[_0x02de('0xcd')]=_0x02de('0x1ab');_0x2ce15c[_0x02de('0x11e')]+=0x1;_0x2ce15c[_0x02de('0xd2')]+=0x1;_0x4dcdbf=_0x4690d7[_0x02de('0x1ac')];_0x2d156a=_0x4690d7['callAdditionalPhoneAfterMin'];ami['emit']('custom:agentcongestion',ut[_0x02de('0x111')](_0x141240,_0x02de('0x1ad')));hopperUtils[_0x02de('0xc4')](_0x2ce15c)[_0x02de('0x9d')](loggerCatch(_0x02de('0x1ae')));if(_0xc5c227[_0x02de('0x18a')](0x8,_0x141240,_0x4690d7)&&!_0x1bc284){if(_0x2ce15c[_0x02de('0x11e')]>=_0x4690d7[_0x02de('0x1af')]){_0xc5c227[_0x02de('0x123')](_0x2ce15c,_0xe25289,_0x40abea,_0x02de('0x1b0'));}else{_0xc5c227[_0x02de('0x120')](_0x2ce15c,_0xe25289,_0x40abea,_0x02de('0x1b0'));}}break;case'11':_0x4690d7[_0x02de('0x1b1')]+=0x1;_0x2ce15c[_0x02de('0x6a')]=0xb;_0x2ce15c[_0x02de('0xcd')]=_0x02de('0xe2');_0x2ce15c[_0x02de('0xe4')]+=0x1;_0x2ce15c[_0x02de('0xd2')]+=0x1;_0x4dcdbf=_0x4690d7[_0x02de('0xe5')];_0x2d156a=_0x4690d7[_0x02de('0xe6')];hopperUtils[_0x02de('0xc4')](_0x2ce15c)['catch'](loggerCatch(_0x02de('0xea')));if(_0xc5c227[_0x02de('0x18a')](0xb,_0x141240,_0x4690d7)&&!_0x1bc284){if(_0x2ce15c[_0x02de('0xe4')]>=_0x4690d7[_0x02de('0xe7')]){_0xc5c227[_0x02de('0x123')](_0x2ce15c,_0xe25289,_0x40abea,_0x02de('0x1b2'));}else{_0xc5c227[_0x02de('0x120')](_0x2ce15c,_0xe25289,_0x40abea,_0x02de('0x1b2'));}}break;case'20':_0x4690d7[_0x02de('0x1b3')]+=0x1;_0x2ce15c['state']=0x14;_0x2ce15c['statedesc']=_0x02de('0x1b4');_0x2ce15c[_0x02de('0x12c')]+=0x1;_0x2ce15c['countglobal']+=0x1;_0x4dcdbf=_0x4690d7['dialAgentRejectRetryFrequency'];_0x2d156a=_0x4690d7[_0x02de('0xe6')];ami['emit'](_0x02de('0x1b5'),ut['buildObj'](_0x141240,'agentreject'));hopperUtils[_0x02de('0xc4')](_0x2ce15c)[_0x02de('0x9d')](loggerCatch(_0x02de('0x1b6')));if(_0xc5c227['checkRetriveMax'](0x14,_0x141240,_0x4690d7)&&!_0x1bc284){if(_0x2ce15c[_0x02de('0x12c')]>=_0x4690d7[_0x02de('0x196')]){_0xc5c227[_0x02de('0x123')](_0x2ce15c,_0xe25289,_0x40abea,_0x02de('0x1b7'));}else{_0xc5c227[_0x02de('0x120')](_0x2ce15c,_0xe25289,_0x40abea,'reason\x2020\x20agentreject');}}break;default:_0x4690d7[_0x02de('0x133')]+=0x1;_0x2ce15c[_0x02de('0x6a')]=0xc;_0x2ce15c['statedesc']=_0x407317[_0x02de('0xc0')];_0x4dcdbf=_0x4690d7[_0x02de('0x1b8')];_0x2d156a=_0x4690d7[_0x02de('0xe6')];hopperUtils[_0x02de('0xc4')](_0x2ce15c)[_0x02de('0x9d')](loggerCatch(_0x02de('0x1b9')));if(_0xc5c227[_0x02de('0x18a')](_0x407317[_0x02de('0xc0')],_0x141240,_0x4690d7)&&!_0x1bc284){if(_0x2ce15c[_0x02de('0x11d')]+_0x2ce15c[_0x02de('0x11e')]+_0x2ce15c[_0x02de('0x12a')]+_0x2ce15c[_0x02de('0x12b')]+_0x2ce15c[_0x02de('0xd1')]+_0x2ce15c[_0x02de('0xe4')]+_0x2ce15c[_0x02de('0x11a')]+_0x2ce15c[_0x02de('0x12c')]>=_0x4690d7[_0x02de('0x11f')]){_0xc5c227[_0x02de('0x120')](_0x2ce15c,_0xe25289,_0x40abea,_0x407317['reason']);}else{_0xc5c227[_0x02de('0x123')](_0x2ce15c,_0xe25289,_0x40abea,_0x407317[_0x02de('0xc0')]);}}}})[_0x02de('0xa8')](function(){if(_0x1bc284){hopperUtils['swapAdditionalPhones'](_0x2ce15c,_0x4dcdbf,_0x2d156a)[_0x02de('0xa8')](function(){return _0xe25289(0x1);});}});});};Dialer[_0x02de('0x18')][_0x02de('0x120')]=function(_0x5092d,_0x17c4e1,_0x2ee751,_0x3287c4){var _0x345668=new Final(_0x5092d);_0x345668[_0x02de('0x6a')]=0xf;_0x345668[_0x02de('0xcd')]=_0x02de('0x1ba');this[_0x02de('0x123')](_0x345668,_0x17c4e1,_0x2ee751,_0x3287c4);};Dialer[_0x02de('0x18')][_0x02de('0x123')]=function(_0x26f35f,_0x5035f3,_0x5601a6,_0x1e9e1b){hopperUtils['moveContactManagedDialer'](_0x26f35f)['then'](function(){return _0x5035f3(msgResponse(_0x02de('0x199'),_0x02de('0x107'),_0x1e9e1b));})[_0x02de('0x9d')](function(){return _0x5601a6(msgResponse(_0x02de('0x1bb'),_0x02de('0x8f'),_0x02de('0x1bc')));});};Dialer['prototype'][_0x02de('0x9')]=function(_0x424693){var _0x1960aa=_0x424693[_0x02de('0x1bd')]/0x64;var _0x519a7a=_0x424693[_0x02de('0xcc')]/(_0x424693[_0x02de('0xcc')]+_0x424693[_0x02de('0xbf')]);var _0x2ab8fd=Math['round'](_0x424693[_0x02de('0x1be')]*(_0x424693[_0x02de('0x1bf')]/0x64));var _0x298a30=Math['round'](_0x424693[_0x02de('0x1be')]*(_0x424693[_0x02de('0x1c0')]/0x64));var _0x93fc24=_0x424693['available']+_0x424693[_0x02de('0x13c')];var _0x5dcd24=Math[_0x02de('0x1c1')](_0x424693[_0x02de('0x59')]*_0x424693['erlangAbandonmentRate']*_0x424693[_0x02de('0x1c2')]*_0x424693['predictiveIntervalMultiplicativeFactor']);if(_[_0x02de('0x3d')](_0x424693['startProgressive'])){if(!_[_0x02de('0x3d')](_0x424693[_0x02de('0x27')])){_0x424693['startPredictive']=undefined;loggerPredictive[_0x02de('0x62')]('[startMethodPredictive][StartProgressive]',_0x02de('0x1c3'));}if(!_[_0x02de('0x3d')](_0x424693[_0x02de('0x60')])){loggerPredictive[_0x02de('0x62')](_0x02de('0x1c4'),_0x02de('0x1c5'));clearInterval(_0x424693[_0x02de('0x60')]);_0x424693[_0x02de('0x60')]=undefined;}_0x424693[_0x02de('0x28')]=moment()[_0x02de('0x43')]('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x02de('0x48')](_0x424693[_0x02de('0x45')],_0x02de('0x1c6'),_0x424693['startProgressive']);this[_0x02de('0xb0')](_0x424693,0x1);}else if(ifInterval(_0x424693['dialPredictiveInterval'],_0x424693[_0x02de('0x28')])){this['handlePower'](_0x424693,0x1);loggerPredictiveCalls[_0x02de('0x48')](_0x02de('0x1c7'),_0x424693[_0x02de('0x28')],_0x424693[_0x02de('0x45')]);_0x424693[_0x02de('0x59')]=0x0;_0x424693[_0x02de('0x1c8')]=0x0;}else if(_0x1960aa<_0x519a7a&&_0x424693[_0x02de('0x1c9')]===_0x02de('0x1ca')){clearPredictiveAttributes(_0x424693);loggerPredictive[_0x02de('0x48')](_0x02de('0x1cb'),_0x02de('0x1cc'),_0x519a7a,_0x02de('0x28'),_0x424693[_0x02de('0x45')]);}else if(_0x5dcd24<_0x424693['predictiveIntervalErlangCallsDroppedCalls']&&_0x424693['dialPredictiveOptimization']===_0x02de('0x1ca')){clearPredictiveAttributes(_0x424693);loggerPredictive[_0x02de('0x48')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x02de('0x1cd'),_0x5dcd24,_0x02de('0x1ce'),_0x424693[_0x02de('0x1c8')],'startProgressive',_0x424693[_0x02de('0x45')]);}else if(!ifInterval(_0x424693[_0x02de('0x1cf')],_0x424693[_0x02de('0x28')])&&_['isUndefined'](_0x424693[_0x02de('0x27')])&&!_['isUndefined'](_0x424693[_0x02de('0x28')])){_0x424693[_0x02de('0x27')]=moment()['format'](_0x02de('0xbd'));loggerPredictive[_0x02de('0x48')](_0x424693[_0x02de('0x45')],'started\x20in\x20predictive\x20at',_0x424693[_0x02de('0x27')]);hopperUtils[_0x02de('0x1d0')](_0x424693['dialPredictiveInterval'])[_0x02de('0xa8')](this[_0x02de('0x1d1')](_0x424693))['then'](mergeDataErlangB(_0x424693))['then'](this[_0x02de('0x1d2')](_0x424693))[_0x02de('0x9d')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x424693));}else if(!ifInterval(_0x424693[_0x02de('0x1cf')],_0x424693['startPredictive'])){_0x424693[_0x02de('0x1c8')]=0x0;_0x424693[_0x02de('0x27')]=moment()[_0x02de('0x43')](_0x02de('0xbd'));loggerPredictive[_0x02de('0x48')](_0x424693[_0x02de('0x45')],_0x02de('0x1d3'),_0x424693[_0x02de('0x27')]);clearInterval(_0x424693[_0x02de('0x60')]);_0x424693[_0x02de('0x60')]=undefined;hopperUtils['avgHandleTime'](_0x424693[_0x02de('0x1cf')])[_0x02de('0xa8')](this[_0x02de('0x1d1')](_0x424693))[_0x02de('0xa8')](mergeDataErlangB(_0x424693))[_0x02de('0xa8')](this['startMethodPredictive'](_0x424693))['catch'](loggerCatchPredictive(_0x02de('0x1d4'),_0x424693));}else if(_0x424693[_0x02de('0x1be')]&&_0x93fc24<_0x424693['predictiveIntervalAvailable']-_0x298a30){clearPredictiveAttributes(_0x424693);loggerPredictive['info'](_0x424693['name'],_0x02de('0x1d5'),_0x93fc24,_0x02de('0x1d6'),_0x424693['predictiveIntervalAvailable'],'-',_0x298a30,'=',_0x424693['predictiveIntervalAvailable']-_0x298a30,')');}else if(_0x424693[_0x02de('0x1be')]&&_0x93fc24>_0x424693['predictiveIntervalAvailable']+_0x2ab8fd){clearPredictiveAttributes(_0x424693);loggerPredictive[_0x02de('0x48')](_0x424693[_0x02de('0x45')],_0x02de('0x1d5'),_0x93fc24,_0x02de('0x1d7'),_0x424693[_0x02de('0x1be')],'+',_0x2ab8fd,'=',_0x424693[_0x02de('0x1be')]+_0x2ab8fd,')');}};Dialer[_0x02de('0x18')][_0x02de('0x1d1')]=function(_0x3d8d5c){var _0x10d061=this;return function(_0x1b1024){return new Promise(function(_0x3dccdc,_0x46aa76){_['merge'](_0x3d8d5c,_0x1b1024[0x0]);if(checkGetDataPredictive(_0x1b1024[0x0])){var _0x1622a0=_0x3d8d5c[_0x02de('0x1be')]=_0x3d8d5c[_0x02de('0x13c')]+_0x3d8d5c[_0x02de('0x13a')];var _0xcf4954=_0x3d8d5c[_0x02de('0x1cf')]*0x3c;var _0x18e2ef=_0x1b1024[0x0]['predictiveIntervalAvgTalktime']+_0x1b1024[0x0][_0x02de('0x55')];var _0x4ada5a=(_0x1b1024[0x0][_0x02de('0x4c')]+_0x1b1024[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1b1024[0x0][_0x02de('0x4f')])/_0x1b1024[0x0][_0x02de('0x4a')];_0x3d8d5c[_0x02de('0x1c2')]=_0x4ada5a>0x0?_0x4ada5a:0x1;switch(_0x3d8d5c[_0x02de('0x1c9')]){case'dropRate':var _0x5e587a=_0x3d8d5c['dialPredictiveOptimizationPercentage']/0x64;return _0x10d061['abandonmentRate'](_0x1622a0,_0xcf4954,_0x18e2ef,_0x4ada5a,_0x5e587a)[_0x02de('0xa8')](function(_0x578bab){return _0x3dccdc(_0x578bab);});case _0x02de('0x1d8'):var _0x6919ad=_0x3d8d5c['dialPredictiveOptimizationPercentage']/0x64;return _0x10d061['busyFactor'](_0x1622a0,_0xcf4954,_0x18e2ef,_0x4ada5a,_0x6919ad)[_0x02de('0xa8')](function(_0x3c3c11){return _0x3dccdc(_0x3c3c11);});default:return _0x46aa76(msgResponse('[getDataPredictive]',_0x02de('0x8f'),_0x02de('0x1d9')));}}else{return _0x46aa76(msgResponse(_0x02de('0x1da'),'Failure',_0x02de('0x1db')));}});};};Dialer[_0x02de('0x18')][_0x02de('0x1dc')]=function(_0x1d6985){var _0x68a026=this;return function(_0x1fe6e1){return new Promise(function(_0x336745,_0x23d555){_[_0x02de('0xf4')](_0x1d6985,_0x1fe6e1[0x0]);if(checkGetDataPredictive(_0x1fe6e1[0x0])){loggerPredictive[_0x02de('0x48')](JSON['stringify'](_0x1fe6e1[0x0]));if(_0x1d6985['dialPredictiveOptimization']==='dropRate'){return _0x68a026[_0x02de('0x150')](_0x1d6985['id'])[_0x02de('0xa8')](function(_0x5c7103){var _0x15f396=_0x1d6985[_0x02de('0x1dd')]-_0x5c7103[0x0][_0x02de('0x1de')];var _0x156853=_0x1d6985['dialPredictiveInterval']*0x3c;var _0x4dffbe=_0x1fe6e1[0x0][_0x02de('0x53')]+_0x1fe6e1[0x0]['predictiveIntervalAvgHoldtime'];var _0x5a6640=(_0x1fe6e1[0x0]['predictiveIntervalAnsweredCalls']+_0x1fe6e1[0x0][_0x02de('0xcb')]+_0x1fe6e1[0x0][_0x02de('0x4f')])/_0x1fe6e1[0x0]['predictiveIntervalTotalCalls'];var _0x2e8f16=_0x1d6985[_0x02de('0x1bd')]/0x64;_0x1d6985['predictiveIntervalPauses']=_0x5c7103[0x0][_0x02de('0x1de')]||0x0;_0x1d6985['predictiveIntervalHitRate']=_0x5a6640>0x0?_0x5a6640:0x1;return _0x68a026['abandonmentRate'](_0x15f396,_0x156853,_0x4dffbe,_0x5a6640,_0x2e8f16);})['then'](function(_0x35b632){return _0x336745(_0x35b632);})[_0x02de('0x9d')](function(_0x478733){return _0x23d555(msgResponse('[CatchErlangB]',_0x02de('0x8f'),JSON[_0x02de('0x81')](_0x478733)));});}if(_0x1d6985[_0x02de('0x1c9')]===_0x02de('0x1d8')){return _0x68a026['getVoiceQueueRtPauses'](_0x1d6985['id'])[_0x02de('0xa8')](function(_0x1d9457){var _0x13a0d8=_0x1d6985[_0x02de('0x1dd')]-_0x1d9457[0x0][_0x02de('0x1de')];var _0xfccd7a=_0x1d6985[_0x02de('0x1cf')]*0x3c;var _0x3162c6=_0x1fe6e1[0x0][_0x02de('0x53')]+_0x1fe6e1[0x0][_0x02de('0x55')];var _0x2a5085=(_0x1fe6e1[0x0][_0x02de('0x4c')]+_0x1fe6e1[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x1fe6e1[0x0][_0x02de('0x4f')])/_0x1fe6e1[0x0]['predictiveIntervalTotalCalls'];var _0x44060d=_0x1d6985[_0x02de('0x1bd')]/0x64;_0x1d6985['predictiveIntervalPauses']=_0x1d9457[0x0][_0x02de('0x1de')]||0x0;_0x1d6985['predictiveIntervalHitRate']=_0x2a5085>0x0?_0x2a5085:0x1;return _0x68a026[_0x02de('0x1df')](_0x13a0d8,_0xfccd7a,_0x3162c6,_0x2a5085,_0x44060d);})[_0x02de('0xa8')](function(_0x49df17){return _0x336745(_0x49df17);})[_0x02de('0x9d')](function(_0x30b1b2){return _0x23d555(msgResponse(_0x02de('0x1e0'),_0x02de('0x8f'),JSON[_0x02de('0x81')](_0x30b1b2)));});}}else{return _0x23d555(msgResponse(_0x02de('0x1da'),_0x02de('0x8f'),'check\x20failure'));}});};};Dialer[_0x02de('0x18')][_0x02de('0x1d2')]=function(_0x44ac6d){var _0x460bed=this;return function(){var _0x5aee6f=0x0;var _0xd94fe8=Math[_0x02de('0x1c1')](_0x44ac6d[_0x02de('0x1e1')]*0x3e8);if(_0xd94fe8>0x0){_0xd94fe8=_0xd94fe8<0x64?0x64:_0xd94fe8;loggerPredictive['info'](_0x44ac6d[_0x02de('0x45')],_0x02de('0x1e2'),_0xd94fe8,'milliseconds');_0x44ac6d[_0x02de('0x60')]=setInterval(function(){_0x460bed[_0x02de('0x60')](_0x44ac6d);loggerPredictiveCalls[_0x02de('0x48')]('[handlePredictive]',_0x5aee6f+=0x1);},_0xd94fe8);}else{loggerPredictive['info'](_0x44ac6d[_0x02de('0x45')],_0x02de('0x1e3'));}};};Dialer['prototype']['checkContactBlack']=function(_0x23e52b,_0x23f9e5){var _0x37d527=this;return function(_0x5eafc4){if(_[_0x02de('0x47')](_0x5eafc4)){if(_['isNil'](_0x23f9e5['UserId'])||!_0x23f9e5[_0x02de('0x1e4')]){if(_0x23e52b[_0x02de('0x1e5')]===_0x02de('0x8')){_0x23e52b['queueStatusComplete']=_[_0x02de('0x3d')](_0x23e52b[_0x02de('0x6d')])?!![]:_0x23e52b[_0x02de('0x6d')];var _0x5663d4=uuid['v4']();_0x37d527[_0x02de('0x24')][_0x5663d4]=new Action(_0x23e52b,_0x23f9e5,_0x5663d4);loggerBooked['info']('[booked][checkContactBlack]',_0x5663d4,'queueStatusComplete:\x20',JSON[_0x02de('0x81')](_0x23e52b[_0x02de('0x6d')]),'Queue:\x20',_0x23e52b[_0x02de('0x45')]);if(_0x23e52b[_0x02de('0x6d')]){_0x23e52b[_0x02de('0x6d')]=![];_0x37d527[_0x02de('0x29')][_0x37d527[_0x02de('0x24')][_0x5663d4][_0x02de('0xb8')]]=[];ami[_0x02de('0x96')]({'actionid':_0x5663d4,'action':_0x02de('0x1e6'),'queue':_0x23e52b[_0x02de('0x45')]})['catch'](function(){_0x37d527[_0x02de('0xba')](_0x23e52b);hopperUtils[_0x02de('0xf9')]({'active':![],'ContactId':_0x37d527[_0x02de('0x24')][_0x5663d4]['ContactId'],'ListId':_0x37d527[_0x02de('0x24')][_0x5663d4]['ListId'],'VoiceQueueId':_0x37d527[_0x02de('0x24')][_0x5663d4][_0x02de('0xdc')]||undefined,'CampaignId':_0x37d527['actions'][_0x5663d4][_0x02de('0xe8')]||undefined})[_0x02de('0x9d')](loggerCatch(_0x02de('0x1e7')));delete _0x37d527[_0x02de('0x24')][_0x5663d4];});}else{loggerBooked[_0x02de('0x48')]('[booked][checkContactBlack][else]',JSON['stringify'](_0x23e52b[_0x02de('0x6d')]),_0x02de('0x1e8'),_0x23e52b[_0x02de('0x45')]);_0x37d527[_0x02de('0xba')](_0x23e52b);hopperUtils['rescheduleContact']({'active':![],'ContactId':_0x37d527['actions'][_0x5663d4][_0x02de('0xda')],'ListId':_0x37d527[_0x02de('0x24')][_0x5663d4][_0x02de('0xdb')],'VoiceQueueId':_0x37d527[_0x02de('0x24')][_0x5663d4]['VoiceQueueId']||undefined,'CampaignId':_0x37d527[_0x02de('0x24')][_0x5663d4][_0x02de('0xe8')]||undefined})[_0x02de('0x9d')](loggerCatch(_0x02de('0x1e7')));delete _0x37d527[_0x02de('0x24')][_0x5663d4];}}else{return _0x37d527[_0x02de('0x159')](_0x23e52b,_0x23f9e5);}}else{if(utils[_0x02de('0xc8')](undefined,_0x23f9e5[_0x02de('0x1e9')])<_0x23e52b[_0x02de('0x1ea')]*0x3c){if(_0x23f9e5[_0x02de('0x147')]&&!_0x23f9e5[_0x02de('0x147')]['voicePause']){_0x37d527[_0x02de('0x1d')][_0x02de('0xf7')](_0x23f9e5['id'])['finally'](function(){_0x37d527[_0x02de('0xba')](_0x23e52b);});}else{hopperUtils[_0x02de('0x1eb')]({'active':![]},_0x23f9e5['id'],0x1)['finally'](function(){_0x37d527['updateOriginated'](_0x23e52b);});}}else{_0x23e52b['outboundReCallsDay']+=0x1;_0x37d527[_0x02de('0xba')](_0x23e52b);if(_0x23e52b[_0x02de('0x1ec')]){hopperUtils[_0x02de('0xf9')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x23f9e5[_0x02de('0xda')],'ListId':_0x23f9e5[_0x02de('0xdb')],'VoiceQueueId':_0x23f9e5[_0x02de('0xdc')]||undefined,'CampaignId':_0x23f9e5['CampaignId']||undefined})[_0x02de('0x9d')](loggerCatch(_0x02de('0x1ed')));hopperUtils[_0x02de('0xc4')](createObjHistory(_0x23e52b,_0x23f9e5,utils['CAMPAIGN_STATUS'][_0x02de('0x1ee')],0x17,_0x02de('0x1ef')))[_0x02de('0x9d')](loggerCatch(_0x02de('0x1f0')));}else{_0x37d527[_0x02de('0x113')](createObjHistory(_0x23e52b,_0x23f9e5,utils['CAMPAIGN_STATUS']['RECALL_TIMEOUT'],0x16,_0x02de('0x1f1')),_0x02de('0x1f2'),'[Originate][HistoryRecallClose]');}}}}else{_0x23e52b[_0x02de('0x1f3')]+=0x1;_0x37d527[_0x02de('0x113')](createObjHistory(_0x23e52b,_0x23f9e5,utils['CAMPAIGN_STATUS']['BLACKLIST'],0xd,'Blacklist'),_0x02de('0x1f4'),_0x02de('0x1f5'));throw _0x02de('0x1f6');}};};Dialer[_0x02de('0x18')][_0x02de('0x158')]=function(_0x39f650){var _0x1427bf=this;var _0x592b14=_0x39f650[_0x02de('0x1f7')]-_0x39f650[_0x02de('0x79')]-_0x39f650[_0x02de('0x1f8')];emitCampaignSummary(_0x39f650);if(_0x592b14>0x0){if(_0x592b14>this[_0x02de('0x22')]){_0x592b14=this[_0x02de('0x22')];}_0x39f650[_0x02de('0x1f8')]+=_0x592b14;hopperUtils[_0x02de('0x1f9')](_0x39f650,_0x592b14)[_0x02de('0xa8')](function(_0x4bbbfe){_0x39f650[_0x02de('0x1f8')]-=_0x592b14;_0x39f650['temp']=_0x39f650[_0x02de('0x1f8')]>0x0?_0x39f650['temp']:0x0;if(!utils[_0x02de('0x1fa')](_0x4bbbfe)){_0x39f650[_0x02de('0x66')]=utils['CAMPAIGN_STATUS'][_0x02de('0x1fb')];logger[_0x02de('0x48')](_0x02de('0x1fc')+_0x39f650['name']);}else{_0x39f650[_0x02de('0x79')]+=_0x4bbbfe[_0x02de('0x94')];_0x39f650[_0x02de('0x66')]=utils['CAMPAIGN_STATUS'][_0x02de('0x1fd')];for(var _0x32fffb=0x0;_0x32fffb<_0x4bbbfe['length'];_0x32fffb+=0x1){_0x39f650[_0x02de('0x1fe')]+=0x1;if(_[_0x02de('0xf0')](_0x4bbbfe[_0x32fffb])||_[_0x02de('0xf0')](_0x4bbbfe[_0x32fffb][_0x02de('0x174')])||_[_0x02de('0xf0')](_0x4bbbfe[_0x32fffb][_0x02de('0x15c')])){_0x1427bf[_0x02de('0x1ff')](_0x02de('0x200'),_0x39f650,_0x4bbbfe[_0x32fffb]);}else{hopperUtils['checkIsBlackListIvr'](_[_0x02de('0xf5')](_0x4bbbfe[_0x32fffb],[_0x02de('0xe8'),_0x02de('0x15c')]))[_0x02de('0xa8')](_0x1427bf[_0x02de('0x201')](_0x39f650,_0x4bbbfe[_0x32fffb]))['catch'](_0x1427bf[_0x02de('0x153')](_0x02de('0x202'),_0x39f650));}}}})[_0x02de('0x9d')](loggerGetContactDialer(_0x02de('0x203'),_0x39f650,_0x592b14));}};Dialer[_0x02de('0x18')][_0x02de('0xb0')]=function(_0x4ce4ce,_0x54e16e){var _0x5b286e=this;var _0x58976f=[];if(_0x54e16e<0x1||_0x4ce4ce['dialMethod']===_0x02de('0x8')){_0x54e16e=0x1;}var _0x392602=Math[_0x02de('0x1c1')](_0x4ce4ce[_0x02de('0x13a')]*_0x54e16e)-_0x4ce4ce[_0x02de('0x79')]-_0x4ce4ce[_0x02de('0x1f8')];if(_0x4ce4ce[_0x02de('0x204')]>0x0){var _0x5babde=_0x4ce4ce[_0x02de('0x204')]-_0x4ce4ce['originated']-_0x4ce4ce[_0x02de('0x13c')]-_0x4ce4ce[_0x02de('0x1f8')]-_0x4ce4ce[_0x02de('0x205')];if(_0x392602>_0x5babde){_0x392602=_0x5babde;}}if(_0x392602>0x0){if(_0x4ce4ce[_0x02de('0x1e5')]===_0x02de('0x8')){_0x392602=0x1;}if(_0x392602>this[_0x02de('0x22')]){_0x392602=this[_0x02de('0x22')];}_0x4ce4ce[_0x02de('0x1f8')]+=_0x392602;for(var _0x173ad4 in this[_0x02de('0x20')]){if(typeof this[_0x02de('0x20')][_0x173ad4]!==_0x02de('0xa6')){if(this[_0x02de('0x20')][_0x173ad4][_0x02de('0x6a')]==='not_inuse'&&this[_0x02de('0x20')][_0x173ad4][_0x02de('0x85')]===_0x02de('0x86')){_0x58976f[_0x02de('0x95')](this[_0x02de('0x20')][_0x173ad4]['id']);}}}hopperUtils[_0x02de('0x206')](_0x4ce4ce,_0x58976f,_0x392602)[_0x02de('0xa8')](function(_0x38efc5){_0x4ce4ce[_0x02de('0x1f8')]-=_0x392602;_0x4ce4ce[_0x02de('0x1f8')]=_0x4ce4ce['temp']>0x0?_0x4ce4ce[_0x02de('0x1f8')]:0x0;if(!utils[_0x02de('0x1fa')](_0x38efc5)){hopperUtils['countReScheduled'](_0x4ce4ce)[_0x02de('0xa8')](sendMessageReschedule(_0x4ce4ce))[_0x02de('0x9d')](loggerCatch(_0x02de('0x207')));}else{_0x4ce4ce[_0x02de('0x79')]+=_0x38efc5[_0x02de('0x94')];_0x4ce4ce['message']=_0x4ce4ce[_0x02de('0x1e5')]===_0x02de('0x8')?utils['CAMPAIGN_STATUS'][_0x02de('0x13d')]:utils[_0x02de('0x67')][_0x02de('0x1fd')];for(var _0x1d2393=0x0;_0x1d2393<_0x38efc5[_0x02de('0x94')];_0x1d2393+=0x1){if(_['isNil'](_0x38efc5[_0x1d2393])||_[_0x02de('0xf0')](_0x38efc5[_0x1d2393]['Contact'])||_[_0x02de('0xf0')](_0x38efc5[_0x1d2393][_0x02de('0x15c')])){_0x5b286e[_0x02de('0x1ff')]('[actionOriginate]\x20',_0x4ce4ce,_0x38efc5[_0x1d2393]);}else{hopperUtils['checkIsBlackList'](_[_0x02de('0xf5')](_0x38efc5[_0x1d2393],[_0x02de('0xdc'),_0x02de('0x15c')]))[_0x02de('0xa8')](_0x5b286e[_0x02de('0x201')](_0x4ce4ce,_0x38efc5[_0x1d2393]))[_0x02de('0x9d')](_0x5b286e['loggerHandler']('[actionOriginate]\x20',_0x4ce4ce));}}}})[_0x02de('0x9d')](loggerGetContactDialer(_0x02de('0x208'),_0x4ce4ce,_0x392602));}};Dialer[_0x02de('0x18')][_0x02de('0x60')]=function(_0x48a3c2){if(_0x48a3c2[_0x02de('0x204')]>0x0){var _0x3c2450=_0x48a3c2[_0x02de('0x204')]-_0x48a3c2[_0x02de('0x79')]-_0x48a3c2[_0x02de('0x13c')];if(_0x3c2450>0x0){this[_0x02de('0x209')](_0x48a3c2);}else{loggerPredictiveCalls['info'](_0x02de('0x20a'));}}else{this['tryOriginatePredictive'](_0x48a3c2);}};Dialer[_0x02de('0x18')][_0x02de('0x209')]=function(_0x456ffc){var _0x51aa79=this;var _0x1e1c6a=[];_0x456ffc[_0x02de('0x79')]+=0x1;for(var _0x142498 in this[_0x02de('0x20')]){if(typeof this['agents'][_0x142498]!=='undefined'){if(this[_0x02de('0x20')][_0x142498]['state']===_0x02de('0x20b')&&this[_0x02de('0x20')][_0x142498][_0x02de('0x85')]===_0x02de('0x86')){_0x1e1c6a[_0x02de('0x95')](this['agents'][_0x142498]['id']);}}}return this[_0x02de('0x206')](_0x456ffc['id'],_0x1e1c6a,0x1,_0x456ffc['dialOrderByScheduledAt'],_0x456ffc)[_0x02de('0xa8')](function(_0x3002c0){if(!utils[_0x02de('0x1fa')](_0x3002c0)){utils[_0x02de('0x64')](_0x456ffc,0x1,0x0);return hopperUtils[_0x02de('0x20c')](_0x456ffc)['then'](sendMessageReschedule(_0x456ffc))[_0x02de('0x9d')](loggerCatch('[countReScheduled]\x20'));}else{_0x456ffc['message']=utils[_0x02de('0x67')][_0x02de('0x1fd')];if(_[_0x02de('0xf0')](_0x3002c0[0x0])||_[_0x02de('0xf0')](_0x3002c0[0x0]['Contact'])||_['isNil'](_0x3002c0[0x0][_0x02de('0x15c')])){_0x51aa79[_0x02de('0x1ff')](_0x02de('0x200'),_0x456ffc,_0x3002c0[0x0]);}else{return hopperUtils['checkIsBlackList'](_['pick'](_0x3002c0[0x0],[_0x02de('0xdc'),_0x02de('0x15c')]))[_0x02de('0xa8')](_0x51aa79['checkContactBlack'](_0x456ffc,_0x3002c0[0x0]))[_0x02de('0x9d')](_0x51aa79['loggerHandler'](_0x02de('0x20d'),_0x456ffc));}}})[_0x02de('0x9d')](loggerGetContactDialer(_0x02de('0x20e'),_0x456ffc,0x1));};Dialer[_0x02de('0x18')]['abandonmentRate']=function(_0x72858f,_0x5ac4e4,_0x5168d1,_0x3359f6,_0x211073,_0x10d3c2){loggerPredictive['info']('--------\x20Drop\x20Rate\x20--------');loggerPredictive['info'](_0x02de('0x20f'),_0x72858f);loggerPredictive[_0x02de('0x48')](_0x02de('0x210'),_0x5ac4e4);loggerPredictive[_0x02de('0x48')](_0x02de('0x211'),_0x5168d1);loggerPredictive[_0x02de('0x48')](_0x02de('0x212'),_0x3359f6);loggerPredictive[_0x02de('0x48')](_0x02de('0x213'),_0x211073);loggerPredictive[_0x02de('0x48')](_0x02de('0x52'));return new Promise(function(_0x49c701,_0x53f831){if(_0x72858f<=0x0||isNaN(_0x72858f)){return _0x53f831(msgResponse(_0x02de('0x214'),'Error',_0x02de('0x215')+_0x72858f));}if(_0x5168d1<=0x0||isNaN(_0x5168d1)){return _0x53f831(msgResponse(_0x02de('0x214'),'Error',_0x02de('0x216')+_0x5168d1));}if(_0x3359f6<=0x0||isNaN(_0x3359f6)){return _0x53f831(msgResponse('[abandonmentRate]',_0x02de('0x80'),_0x02de('0x217')+_0x3359f6));}if(_0x5ac4e4<=0x0||isNaN(_0x5ac4e4)){return _0x53f831(msgResponse(_0x02de('0x214'),_0x02de('0x80'),_0x02de('0x218')+_0x5ac4e4));}if(_0x211073<=0x0||isNaN(_0x211073)){return _0x53f831(msgResponse(_0x02de('0x214'),_0x02de('0x80'),_0x02de('0x219')+_0x211073));}_0x10d3c2=_0x10d3c2||0x0;var _0x5aa0e0=0x1/_0x5168d1;var _0x61b29=0x0;var _0x522896=0x0;var _0x15498b=0x0;var _0x235fbc=0x0;for(var _0x1d37d4=0x0;_0x15498b<_0x211073;_0x1d37d4+=0x1){_0x522896=_0x1d37d4/_0x5ac4e4;_0x61b29=(_0x3359f6*_0x522896+_0x10d3c2)/_0x5aa0e0;_0x15498b=utils['erlangb'](_0x61b29,_0x72858f);_0x235fbc=_0x61b29/_0x72858f*(0x1-utils[_0x02de('0x21a')](_0x61b29,_0x72858f));}return _0x49c701({'erlangCalls':_0x1d37d4,'erlangCallToSecond':_0x5ac4e4/_0x1d37d4,'erlangAbandonmentRate':_0x15498b,'erlangBusyFactor':_0x235fbc});});};Dialer['prototype']['busyFactor']=function(_0x245de1,_0xe0c3b7,_0x38da9d,_0x192449,_0x5cecd9,_0x2d0012){loggerPredictive['info'](_0x02de('0x21b'));loggerPredictive[_0x02de('0x48')]('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',_0x245de1);loggerPredictive['info'](_0x02de('0x210'),_0xe0c3b7);loggerPredictive[_0x02de('0x48')](_0x02de('0x211'),_0x38da9d);loggerPredictive[_0x02de('0x48')](_0x02de('0x212'),_0x192449);loggerPredictive['info'](_0x02de('0x21c'),_0x5cecd9);loggerPredictive[_0x02de('0x48')]('---------------------------');return new Promise(function(_0x3ebb91,_0x267e09){if(_0x245de1<=0x0||isNaN(_0x245de1)){return _0x267e09(msgResponse(_0x02de('0x21d'),'Error',_0x02de('0x215')+_0x245de1));}if(_0x38da9d<=0x0||isNaN(_0x38da9d)){return _0x267e09(msgResponse(_0x02de('0x21d'),_0x02de('0x80'),'Ts\x20=\x20'+_0x38da9d));}if(_0x192449<=0x0||isNaN(_0x192449)){return _0x267e09(msgResponse(_0x02de('0x21d'),_0x02de('0x80'),'p\x20=\x20'+_0x192449));}if(_0xe0c3b7<=0x0||isNaN(_0xe0c3b7)){return _0x267e09(msgResponse('[busyFactor]',_0x02de('0x80'),_0x02de('0x218')+_0xe0c3b7));}if(_0x5cecd9<=0x0||isNaN(_0x5cecd9)){return _0x267e09(msgResponse(_0x02de('0x21d'),'Error',_0x02de('0x21e')+_0x5cecd9));}_0x2d0012=_0x2d0012||0x0;var _0x387f19=0x1/_0x38da9d;var _0x221c4e=0x0;var _0x157064=0x0;var _0x24aafc=0x0;var _0x12db4f=0x0;for(var _0x418340=0x0;_0x12db4f<_0x5cecd9;_0x418340+=0x1){_0x157064=_0x418340/_0xe0c3b7;_0x221c4e=(_0x192449*_0x157064+_0x2d0012)/_0x387f19;_0x24aafc=utils[_0x02de('0x21a')](_0x221c4e,_0x245de1);_0x12db4f=_0x221c4e/_0x245de1*(0x1-utils[_0x02de('0x21a')](_0x221c4e,_0x245de1));}return _0x3ebb91({'erlangCalls':_0x418340,'erlangCallToSecond':_0xe0c3b7/_0x418340,'erlangAbandonmentRate':_0x24aafc,'erlangBusyFactor':_0x12db4f});});};module[_0x02de('0x21f')]=Dialer; \ No newline at end of file +var _0x6647=['rrmemory','locked','stateinterface','isNil','queueBooked','preview','run','idHopper','[Catch][Preview][syncQueueStatusComplete]','queueBookedRR','_rr','unlockRR','[booked][RR]','Agent:\x20','stringify','paused','[booked][RR][finaly]','[booked][unlock]','[unlock][syncQueueStatusComplete]','[booked][unlock2]','[unlock2][syncQueueStatusComplete]','[unlock3][syncQueueStatusComplete]','syncOriginateResponse','getQueue','response','callProgressDetecting','[callProgressDetecting]\x20','xcally-motion-dialer','dialAMDActive','value','HANGUP','outboundAnswerAgiCallsDay','HangupInAMD','membername','AMD','custom:amd','buildObj','amd','[syncHangupInAMD][createHistory]','[syncHangupInAMD]','MACHINE','Machine','countmachineretry','[syncAgentComplete][createHistory][0]','countbusyretry','countagentrejectretry','dialMachineMaxRetry','createStateFinal','reason\x2019\x20machine....','dialMachineRetryFrequency','[rescheduleContact][Machine]','saveInDb','[syncHangupInAMDIvr][createHistory]','createHistory','countnosuchnumberretry','dialGlobalMaxRetry','stateGlobal','ivrAnswerCallsDay','[syncHangupIvr]','dialQueueProject','AnswerAGI','Unknow','queuesSummary','running','isPreviewCampaign','statusMessage','available','inUse','talking','ACTIVE','[syncQueueSummary]','compareToOutboundQueue','queueSummaryCountersUpdated','updateReportFromOutboundQueue','assign','throttle','filter','dialPreviewRecallmeReminder','reachable','map','user:dialPreviewRecallReminder','checkPreviewRecallReminder','clearZombieChannels','[uniqueid]','[actions]','No\x20such\x20channel','[Dialer][checkChannel]','[Dialer][checkChannel][ivr]','getVoiceQueueRtPauses','[getVoiceQueueRtPauses]\x20','[updateOriginated]\x20is\x20null\x20or\x20undefined','emptyContact','notFound','UserId','[emptyContact][createHistory]','handlePreviewRecallNotifications','user:%s','handleIvr','actionOriginate','object','originate','phone','\x22agi://%s/square,%s\x22','NONE','\x22%s,%s%s,,,%s\x22','dialQueueOptions','dialAMDInitialSilence','XMD-AMDGREETING','XMD-AMDAFTERGREETINGSILENCE','XMD-AMDTOTALANALYSISTIME','dialAMDTotalAnalysisTime','XMD-AMDBETWEENWORDSSILENCE','dialAMDBetweenWordsSilence','XMD-AMDMAXIMUMNUMBEROFWORDS','dialAMDMaximumNumberOfWords','XMD-AMDSILENCETHRESHOLD','dialAMDSilenceThreshold','XMD-AMDMAXIMUMWORDLENGTH','isOutboundQueue','XMD-VOICEQUEUEID','XMD-CAMPAIGNID','Contact','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','getCallerId','callerid','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','dialOriginateCallerIdName','XMD-ORIGINATECALLERIDNAME','originatecalleridname','extractCalleridName','XMD-ORIGINATECALLERIDNUM','variables','SIP/%s/%s%s','dialPrefix','trim','dialCutDigit','substring','from-sip','dialOriginateTimeout','outboundOriginateFailureCallsDay','[originateError]:\x20%s','OriginateError','[originate][error]','originate\x20action\x20Error','checkRetriveMax','countcongestionretry','countnoanswerretry','dialNoAnswerRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','[rescheduleContact]\x20[Busy]','dialCongestionMaxRetry','dialCongestionRetryFrequency','[rescheduleContact]\x20[Congestion]','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','[rescheduleContact][NoSuchNumber]','dialDropMaxRetry','[rescheduleContact][Drop]','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','[rescheduleContact][AgentReject]','[callProgressDetecting]','entity\x20is\x20undefine','evt\x20is\x20undefine','outboundNoSuchCallsDay','NoSuchNumber','nosuchnumber','reason\x200\x20no\x20such\x20number....','buildNoAnswerEventPayload','custom:agentnoanswer','[syncAgentComplete][createHistory][3]','dialNoAnswerMaxRetry','reason\x203\x20ringing\x20no\x20answer','outboundBusyCallsDay','Busy','busy','reason\x205\x20busy','outboundCongestionCallsDay','custom:agentcongestion','congestion','[syncAgentComplete][createHistory][8]','reason\x208\x20congestion','outboundAbandonedCallsDay','reason\x2011\x20abandoned','outboundRejectCallsDay','AgentReject','custom:agentreject','agentreject','reason\x2020\x20agentreject','outboundUnknownCallsDay','[syncAgentComplete][createHistory][?]','Global','Success','[moveContactManagedDialer][0]','dialPredictiveOptimizationPercentage','round','predictiveIntervalAvailable','predictiveIntervalMinThreshold','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','[startMethodPredictive][StartProgressive]','check\x20predictive\x20is\x20not\x20undefine','check\x20handlePredictive\x20is\x20not\x20undefine','collection\x20data\x20in\x20progressive\x20at','dialPredictiveOptimization','dropRate','Dropped\x20calls\x20day','Max\x20Drop\x20','Drop\x20in\x20this\x20interval','dialPredictiveInterval','avgHandleTime','getDataPredictive','startMethodPredictive','recalculate\x20predictive\x20at','switch\x20in\x20progressive\x20because\x20available\x20agents\x20(',')\x20are\x20less\x20than\x20threshold\x20(','abandonmentRate','agentBusyFactor','busyFactor','[getDataPredictive]','Unknown\x20Predictive','check\x20failure','loggedIn','outboundQueuePauses','[CatchErlangB]','predictiveIntervalPauses','one\x20call\x20every:','fail\x20to\x20scheduled\x20calls','checkContactBlack','recallme','Queue:\x20','queuestatus','[unlockOriginate][syncQueueStatusComplete]','[booked][checkContactBlack][else]','scheduledat','dialRecallMeTimeout','Agent','voicePause','unlockContact','outboundReCallsDay','dialRecallInQueue','RecallInQueue','RECALL_TIMEOUT','RecallFailedTimeout','[Originate][HistoryRecallClose]','outboundBlacklistCallsDay','BLACKLIST','Blacklist','[Originate][historyBlacklist]','inBlackList','limitCalls','temp','checkContactEmpty','RUNNING','[actionOriginate]\x20','checkIsBlackListIvr','[getContactCampaign2]','dialLimitQueue','pTalking','countReScheduled','checkIsBlackList','loggerHandler','[getContactDialer2]','tryOriginatePredictive','[handlePredictive][limitChannel]','not_inuse','dialOrderByScheduledAt','checkContactLowerLimitOriginate','[actionOriginatePredictive]\x20','[getContactDialerPredictive]','--------\x20Drop\x20Rate\x20--------','M:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Ts:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','P:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[abandonmentRate]','Ts\x20=\x20','p\x20=\x20','interval\x20=\x20','Amax\x20=\x20','erlangb','----\x20Agent\x20Busy\x20Factor\x20----','Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','Umin:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','[busyFactor]','Umin\x20=\x20','exports','util','uuid','moment','./utils','./utils/hopper','../preview/util/util','../../../config/environment/','../../../config/logger','dialer','booked','predictive','predictiveCalls','syncQueueSummary','redis','socket.io-emitter','../rpc/setting','./models/history','./models/final','./models/queueCallerAbandon','env','XCALLY_IP_AGI','prototype','enqueue','tail','finally','sequence','voiceQueues','campaigns','agents','trunks','maxNumberOriginate','channels','actions','contactsId','uniqueId','optionPredictive','startPredictive','ivrOriginated','syncAgentConnect','queuecallerabandon','syncQueueCallerAbandon','originateresponse','bind','agentcomplete','syncAgentComplete','custom:queuesummary','custom:queuesummarycomplete','syncQueueSummaryComplete','hangup','syncHangup','newexten','syncNewExten','varset','syncVarSet','queuemember','syncQueueMember','syncQueueStatusComplete','loopClearZombieChannels','previewRecallmeReminderInterval','isUndefined','emit','type','outbound','debug','inspect','format','voice:queue:%s','name','voice_queue:save','isEmpty','-----\x20Stats\x20Predictive\x20---','info','predictiveIntervalTotalCalls','Answered\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAnsweredCalls','Dropped\x20Timeout:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalDroppedCallsTimeout','Dropped\x20Exit:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','AVG\x20Hold\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','---------------------------','Avg\x20Talk\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Avg\x20Hold\x20Time\x20is\x20not\x20enough\x20for\x20predictive','Total\x20Calls\x20are\x20not\x20enough\x20for\x20predictive','History\x20information\x20are\x20empty','---------\x20ErlangB\x20---------','Scheduled\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangCalls','erlangCallToSecond','Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20','erlangBusyFactor','erlangAbandonmentRate','merge','getSeconds','startProgressive','startProgressive\x20value\x20cleared','startPredictive\x20value\x20cleared','handlePredictive','handlePredictive\x20interval\x20cleared','error','stack','contactsRescheduled','message','CAMPAIGN_STATUS','[getContactDialer2][ReScheduled]','NO_AVAILABLE_CONTACTS','[getContactDialer2][Empty]','state','statedesc','queueStatusComplete','[unlockQueueStatus][undefined]','[booked][unlockQueueStatus]','pick','NULL_INTERVAL','\x20INTERVAL_IS_NULL','Interval','Intervals','isIVRCampaignActive','INACTIVE','\x20NOT\x20Active','isIVRCampaign','campaign:save','sendMessageOneNotActive','originated','[syncQueueSummary]\x20Campaign\x20Ivr:\x20','DISACTIVED','is\x20disactive','Error','isTrunkReachable','status','SIP/%s','checkIsTrunkReachable','Trunk','TrunkBackup','TRUNK_NOT_REACHABLE','\x20trunk\x20is\x20not\x20reachable','checkIfTime','checkIfTimeIntervals','ifTimeIvr','Failure','EMPTY_INTERVAL','ifTime','\x20Intervals\x20is\x20empty\x20','UNKNOWN_TIMEZONE','\x20Timezone\x20unknow\x20','length','push','Action','command','iftime\x20%s,%s','interval','timezones','content','indexOf','true','catch','all','then','some','OVERTIME_GLOBAL_INTERVAL','OVERTIME_INTERVAL','[ifTime][promiseAll]','Global:\x20','\x20Interval\x20is\x20overtime:\x20','Timezone:\x20','loopCampaigns','resetActiveCalls','syncCampaigns','undefined','resolve','dialTimezone','launchHandleIvr','[syncCampaigns]','checkDialMethod','dialMethod','progressive','handlePower','power','method\x20not\x20recognized','silly','Dialer::ifTime()','intervalIftime','Dialer::ifTime()\x20errResponse\x20NOT\x20NULL:','[ifTime][Action]','queue','uniqueid','updateOriginated','answertime','YYYY-MM-DD\x20HH:mm:ss','ivr','outboundAnswerCallsDay','reason','agiafterat','dialAgiAfterHangupAgent','[syncAgentComplete][createHistory]','moveContactManagedDialer','[syncAgentComplete]','droptime','responsetime','outboundDropCallsDayTimeout','predictiveIntervalErlangCallsDroppedCalls','Drop','dropreason','TIMEOUT','dialQueueProject2','countdropretry','countglobal','dialDropRetryFrequency','callAdditionalPhoneAfterMin','verifyAdditionalPhones','voiceQueue','additional','queueCallerAbandonCreateState','minutes','CampaignId','starttime','endtime','calleridname','calleridnum','predictiveIntervalDroppedCallsCallersExit','outboundDropCallsDayCallersExit','CALLEREXIT','dialAbandonedRetryFrequency','countabandonedretry','dialAbandonedMaxRetry','rescheduleContact','add','ContactId','ListId','VoiceQueueId','[rescheduleContact][Abandoned]','Abandoned','[syncAgentComplete][createHistory][11]','swapAdditionalPhones','channel','actionid','strategy'];(function(_0x243b59,_0x3f9495){var _0x3e1676=function(_0x354052){while(--_0x354052){_0x243b59['push'](_0x243b59['shift']());}};_0x3e1676(++_0x3f9495);}(_0x6647,0x126));var _0x7664=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x6647[_0x321bb2];return _0x9c12ed;};'use strict';var util=require(_0x7664('0x0'));var _=require('lodash');var uuid=require(_0x7664('0x1'));var moment=require(_0x7664('0x2'));var rr=require('rr');var Redis=require('ioredis');var utils=require(_0x7664('0x3'));var hopperUtils=require(_0x7664('0x4'));var ut=require(_0x7664('0x5'));var config=require(_0x7664('0x6'));var logger=require(_0x7664('0x7'))(_0x7664('0x8'));var loggerBooked=require(_0x7664('0x7'))(_0x7664('0x9'));var loggerPredictive=require(_0x7664('0x7'))(_0x7664('0xa'));var loggerPredictiveCalls=require(_0x7664('0x7'))(_0x7664('0xb'));var loggerSyncQueueSummary=require('../../../config/logger')(_0x7664('0xc'));var ami=require('../ami');config[_0x7664('0xd')]=_['defaults'](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x7664('0xe'))(new Redis(config[_0x7664('0xd')]));var cmHopper=require('../rpc/cmHopper');var voiceQueueRt=require('../rpc/voiceQueueRt');var RpcSetting=require(_0x7664('0xf'));var Interval=require('../rpc/interval');var Action=require('./models/action');var History=require(_0x7664('0x10'));var Final=require(_0x7664('0x11'));var AgentComplete=require('./models/agentComplete');var QueueCallerAbandon=require(_0x7664('0x12'));var Hangup=require('./models/hangup');var ipAgi=process[_0x7664('0x13')][_0x7664('0x14')]||'127.0.0.1';var previewRecallmeReminderInterval=0x1;var Sequence=function(){};Sequence[_0x7664('0x15')][_0x7664('0x16')]=function(_0x4dcef9){this[_0x7664('0x17')]=this[_0x7664('0x17')]?this[_0x7664('0x17')][_0x7664('0x18')](_0x4dcef9):_0x4dcef9();};function Dialer(_0x4c985b,_0xeaa5da){this[_0x7664('0x19')]=new Sequence();this['preview']=_0xeaa5da;this[_0x7664('0x1a')]=_0x4c985b[_0x7664('0x1a')];this[_0x7664('0x1b')]=_0x4c985b[_0x7664('0x1b')];this['agents']=_0x4c985b[_0x7664('0x1c')];this[_0x7664('0x1d')]=_0x4c985b['trunks'];this[_0x7664('0x1e')]=config[_0x7664('0x1e')]||0x2;this[_0x7664('0x1f')]={};this[_0x7664('0x20')]={};this[_0x7664('0x21')]={};this[_0x7664('0x22')]={};this[_0x7664('0x23')]={};this[_0x7664('0x24')]={};this['startProgressive']={};this[_0x7664('0x25')]={};this['queueBooked']={};this['queueBookedRR']={};this['queuesSummary']={};ami['on']('agentconnect',this[_0x7664('0x26')]['bind'](this));ami['on'](_0x7664('0x27'),this[_0x7664('0x28')]['bind'](this));ami['on'](_0x7664('0x29'),this['syncOriginateResponse'][_0x7664('0x2a')](this));ami['on'](_0x7664('0x2b'),this[_0x7664('0x2c')]['bind'](this));ami['on'](_0x7664('0x2d'),this[_0x7664('0xc')][_0x7664('0x2a')](this));ami['on'](_0x7664('0x2e'),this[_0x7664('0x2f')][_0x7664('0x2a')](this));ami['on'](_0x7664('0x30'),this[_0x7664('0x31')]['bind'](this));ami['on'](_0x7664('0x32'),this[_0x7664('0x33')][_0x7664('0x2a')](this));ami['on'](_0x7664('0x34'),this[_0x7664('0x35')]['bind'](this));ami['on'](_0x7664('0x36'),this[_0x7664('0x37')][_0x7664('0x2a')](this));ami['on']('queuestatuscomplete',this[_0x7664('0x38')][_0x7664('0x2a')](this));this['loopCampaigns']();this[_0x7664('0x39')]();RpcSetting['getSettings']()['then'](function(_0x21a4db){previewRecallmeReminderInterval=_0x21a4db[_0x7664('0x3a')];});}function isNotNull(_0x345328){return _0x345328!==null&&!_[_0x7664('0x3b')](_0x345328);}function msgResponse(_0x5a5cce,_0x128808,_0x8ffd2f){return{'action':_0x5a5cce,'response':_0x128808,'message':_0x8ffd2f,'stack':_0x8ffd2f};}function emit(_0x35b7a1,_0x19181c,_0x152515){io['to'](_0x35b7a1)[_0x7664('0x3c')](_0x19181c,_0x152515);}function emitOutboundVoiceQueueSummary(_0x564f7c){if(_0x564f7c[_0x7664('0x3d')]===_0x7664('0x3e')){logger[_0x7664('0x3f')]('[voiceQueueReport][queuesummary]\x20sending\x20voice_queue:save\x20event:',util[_0x7664('0x40')](_0x564f7c,{'showHidden':![],'depth':null}));emit(util[_0x7664('0x41')](_0x7664('0x42'),_0x564f7c[_0x7664('0x43')]),_0x7664('0x44'),_0x564f7c);}}function checkGetDataPredictive(_0x500807){if(isNotNull(_0x500807)&&!_[_0x7664('0x45')](_0x500807)){loggerPredictive['info'](_0x7664('0x46'));loggerPredictive[_0x7664('0x47')]('Total\x20Calls:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x500807[_0x7664('0x48')]);loggerPredictive['info'](_0x7664('0x49'),_0x500807[_0x7664('0x4a')]);loggerPredictive[_0x7664('0x47')](_0x7664('0x4b'),_0x500807[_0x7664('0x4c')]);loggerPredictive[_0x7664('0x47')](_0x7664('0x4d'),_0x500807['predictiveIntervalDroppedCallsCallersExit']);loggerPredictive['info'](_0x7664('0x4e'),_0x500807[_0x7664('0x4f')]);loggerPredictive[_0x7664('0x47')]('AVG\x20Talk\x20Time:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x500807[_0x7664('0x50')]);loggerPredictive[_0x7664('0x47')](_0x7664('0x51'));if(_0x500807['predictiveIntervalTotalCalls']>0x0){if(!_[_0x7664('0x3b')](_0x500807['predictiveIntervalAvgTalktime'])&&_0x500807[_0x7664('0x50')]>0x0){return!![];}loggerPredictive[_0x7664('0x47')](_0x7664('0x52'));if(!_[_0x7664('0x3b')](_0x500807[_0x7664('0x4f')])&&_0x500807[_0x7664('0x4f')]>0x0){return!![];}loggerPredictive[_0x7664('0x47')](_0x7664('0x53'));}else{loggerPredictive[_0x7664('0x47')](_0x7664('0x54'));}}else{loggerPredictive[_0x7664('0x47')](_0x7664('0x55'));}return![];}function mergeDataErlangB(_0x71ab4f){return function(_0x1e6eb9){loggerPredictive[_0x7664('0x47')](_0x7664('0x56'));loggerPredictive['info'](_0x7664('0x57'),_0x1e6eb9[_0x7664('0x58')]);loggerPredictive[_0x7664('0x47')]('One\x20call\x20every:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e6eb9[_0x7664('0x59')]);loggerPredictive[_0x7664('0x47')](_0x7664('0x5a'),_0x1e6eb9['erlangAbandonmentRate']);loggerPredictive[_0x7664('0x47')]('Agent\x20Busy\x20Factor:\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e6eb9[_0x7664('0x5b')]);loggerPredictive['info']('Drop\x20Rate:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x1e6eb9[_0x7664('0x5c')]);loggerPredictive[_0x7664('0x47')]('---------------------------');_[_0x7664('0x5d')](_0x71ab4f,_0x1e6eb9);};}function ifInterval(_0x19675e,_0x2374f2){if(_['isUndefined'](_0x2374f2)){return![];}return utils[_0x7664('0x5e')](undefined,_0x2374f2)<_0x19675e*0x3c;}function clearPredictiveAttributes(_0x39d18f){if(_0x39d18f['startProgressive']){_0x39d18f[_0x7664('0x5f')]=undefined;loggerPredictive[_0x7664('0x3f')](_0x39d18f[_0x7664('0x43')],_0x7664('0x60'));}if(_0x39d18f[_0x7664('0x24')]){_0x39d18f[_0x7664('0x24')]=undefined;loggerPredictive[_0x7664('0x3f')](_0x39d18f['name'],_0x7664('0x61'));}if(_0x39d18f[_0x7664('0x62')]){clearInterval(_0x39d18f['handlePredictive']);_0x39d18f[_0x7664('0x62')]=undefined;loggerPredictive[_0x7664('0x3f')](_0x39d18f['name'],_0x7664('0x63'));}}function loggerCatchPredictive(_0x49fa7a,_0x2b8044){return function(_0x4920c1){loggerPredictive[_0x7664('0x64')](_0x2b8044[_0x7664('0x43')],_0x49fa7a);loggerPredictive[_0x7664('0x64')](_0x4920c1[_0x7664('0x65')]);clearPredictiveAttributes(_0x2b8044);};}function loggerCatch(_0x3beb8b){return function(_0x3f9581){logger['error'](_0x3beb8b,util['inspect'](_0x3f9581,{'showHidden':![],'depth':null}));};}function loggerGetContactDialer(_0x1ecec1,_0x94532a,_0x1ed931){return function(_0x4af044){utils['checkContactLowerLimitOriginate'](_0x94532a,_0x1ed931,0x0);logger[_0x7664('0x64')](_0x1ecec1,util[_0x7664('0x40')](_0x4af044,{'showHidden':![],'depth':null}));};}function sendMessageReschedule(_0x2d88f4){return function(_0x264f6e){if(isNotNull(_0x264f6e)&&isNotNull(_0x264f6e[0x0])){if(_0x264f6e[0x0][_0x7664('0x66')]>0x0){_0x2d88f4[_0x7664('0x67')]=utils[_0x7664('0x68')]['CONTACTS_RESCHEDULED'];logger[_0x7664('0x47')](_0x7664('0x69')+_0x2d88f4[_0x7664('0x43')],_0x264f6e[0x0][_0x7664('0x66')],'contacts');}else{_0x2d88f4[_0x7664('0x67')]=utils[_0x7664('0x68')][_0x7664('0x6a')];logger['info'](_0x7664('0x6b')+_0x2d88f4[_0x7664('0x43')]);}}};}function createObjHistory(_0x37f83c,_0x3d7983,_0x11e575,_0xf9aee6,_0x181616){_0x37f83c[_0x7664('0x67')]=_0x11e575;var _0x1943f3=new Action(_0x37f83c,_0x3d7983);var _0x23f8c1=new History(_0x1943f3);_0x23f8c1[_0x7664('0x6c')]=_0xf9aee6;_0x23f8c1[_0x7664('0x6d')]=_0x181616;_0x23f8c1['endtime']=_0x1943f3['starttime'];return _0x23f8c1;}function unlockQueueStatus(_0x151fa5,_0x3abe63){setTimeout(function(){if(_['isUndefined'](_0x151fa5[_0x7664('0x6e')])){loggerBooked[_0x7664('0x64')](_0x7664('0x6f'),_0x3abe63);}_0x151fa5[_0x7664('0x6e')]=!![];loggerBooked['info'](_0x7664('0x70'),_0x3abe63,JSON['stringify'](_[_0x7664('0x71')](_0x151fa5,[_0x7664('0x43'),'queueStatusComplete'])));},0x1f3);}function checkInterval(_0x1aec7a){return function(){if(!isNotNull(_0x1aec7a['Interval'])){_0x1aec7a['message']=utils[_0x7664('0x68')][_0x7664('0x72')];throw _0x1aec7a[_0x7664('0x43')]+_0x7664('0x73');}if(!isNotNull(_0x1aec7a[_0x7664('0x74')][_0x7664('0x75')])){_0x1aec7a[_0x7664('0x67')]=utils[_0x7664('0x68')][_0x7664('0x72')];throw _0x1aec7a['name']+'\x20INTERVAL_IS_NULL';}if(!isNotNull(_[_0x7664('0x45')](_0x1aec7a['Interval']['Intervals']))){_0x1aec7a[_0x7664('0x67')]=utils[_0x7664('0x68')][_0x7664('0x72')];throw _0x1aec7a[_0x7664('0x43')]+'\x20INTERVAL_IS_NULL';}};}function checkIsIVRCampaignActive(_0xb9a724){return function(){if(!utils[_0x7664('0x76')](_0xb9a724)){_0xb9a724[_0x7664('0x67')]=utils[_0x7664('0x68')][_0x7664('0x77')];throw _0xb9a724[_0x7664('0x43')]+_0x7664('0x78');}};}function emitCampaignSummary(_0x4d726b){if(utils[_0x7664('0x79')](_0x4d726b)){emit(util[_0x7664('0x41')]('campaign:ivr:%s',_0x4d726b['name']),_0x7664('0x7a'),_0x4d726b);}}function loggerCatchQueueSummary(_0x35d8b9,_0x5be393){return function(_0x231239){clearPredictiveAttributes(_0x5be393);emitCampaignSummary(_0x5be393);loggerSyncQueueSummary['debug'](_0x35d8b9,util['inspect'](_0x231239,{'showHidden':![],'depth':null}));};}function notSendMessagesCampaign(_0x1f92d9){if(_0x1f92d9[_0x7664('0x7b')]){if(_0x1f92d9[_0x7664('0x7c')]===0x0){_0x1f92d9['sendMessageOneNotActive']=![];_0x1f92d9['message']=utils[_0x7664('0x68')][_0x7664('0x77')];loggerSyncQueueSummary['debug'](_0x7664('0x7d'),_0x1f92d9[_0x7664('0x43')],'is\x20not\x20active');}else{_0x1f92d9[_0x7664('0x67')]=utils[_0x7664('0x68')][_0x7664('0x7e')];loggerSyncQueueSummary[_0x7664('0x3f')]('[syncQueueSummary]\x20Campaign\x20Ivr:\x20',_0x1f92d9['name'],_0x7664('0x7f'));}emitCampaignSummary(_0x1f92d9);}}function myreject(_0x3b9f82){return function(_0x317b3a){return _0x3b9f82(msgResponse('[ifTime][Action]',_0x7664('0x80'),JSON['stringify'](_0x317b3a)));};}Dialer[_0x7664('0x15')][_0x7664('0x81')]=function(_0x43c707){return!_[_0x7664('0x3b')](_0x43c707)&&_0x43c707&&!_['isUndefined'](_0x43c707[_0x7664('0x43')])&&!_['isUndefined'](_0x43c707['active'])&&_0x43c707['active']&&(this[_0x7664('0x1d')][util[_0x7664('0x41')]('SIP/%s',_0x43c707[_0x7664('0x43')])][_0x7664('0x82')]==='reachable'||this['trunks'][util[_0x7664('0x41')](_0x7664('0x83'),_0x43c707[_0x7664('0x43')])][_0x7664('0x82')]==='unmonitored');};Dialer[_0x7664('0x15')][_0x7664('0x84')]=function(_0x4c3d20){var _0x2ffbae=this;return function(){if(!_0x2ffbae[_0x7664('0x81')](_0x4c3d20[_0x7664('0x85')])){if(!_0x2ffbae[_0x7664('0x81')](_0x4c3d20[_0x7664('0x86')])){_0x4c3d20['message']=utils[_0x7664('0x68')][_0x7664('0x87')];throw _0x4c3d20['name']+_0x7664('0x88');}}};};Dialer['prototype'][_0x7664('0x89')]=function(_0x28c5b1,_0x472805,_0x1314a1,_0x376b2e){var _0x42ceed=this;return function(){var _0x125d9e=!![];return _0x42ceed['ifTimeIvr'](_0x28c5b1,_0x472805,_0x1314a1,_0x376b2e,_0x125d9e);};};Dialer[_0x7664('0x15')][_0x7664('0x8a')]=function(_0xf71a94,_0x503a48,_0x36d319,_0x322493){var _0x5be52a=this;return function(){var _0x4c6019=![];return _0x5be52a[_0x7664('0x8b')](_0xf71a94[_0x7664('0x75')],_0x503a48,_0x36d319,_0x322493,_0x4c6019);};};Dialer[_0x7664('0x15')][_0x7664('0x8b')]=function(_0x305973,_0x20b0dd,_0x403887,_0x25cc1c,_0x4ffa3a){var _0x4f7dfb=[];return new Promise(function(_0xc2a245,_0x4d3f1b){if(!isNotNull(_0x305973)){_0x25cc1c[_0x7664('0x67')]=utils[_0x7664('0x68')][_0x7664('0x72')];return _0x4d3f1b(msgResponse('ifTime',_0x7664('0x8c'),_0x403887+'\x20Intervals\x20is\x20null\x20'));}if(_['isEmpty'](_0x305973)){_0x25cc1c[_0x7664('0x67')]=utils[_0x7664('0x68')][_0x7664('0x8d')];return _0x4d3f1b(msgResponse(_0x7664('0x8e'),_0x7664('0x8c'),_0x403887+_0x7664('0x8f')));}if(_0x20b0dd&&_['isUndefined'](config['timezones'][_0x20b0dd])){_0x25cc1c[_0x7664('0x67')]=utils[_0x7664('0x68')][_0x7664('0x90')];return _0x4d3f1b(msgResponse(_0x7664('0x8e'),'Failure',_0x403887+_0x7664('0x91')+_0x20b0dd));}if(_['isArray'](_0x305973)){for(var _0x33e279=0x0;_0x33e279<_0x305973[_0x7664('0x92')];_0x33e279+=0x1){_0x4f7dfb[_0x7664('0x93')](ami[_0x7664('0x94')]({'action':_0x7664('0x95'),'command':util[_0x7664('0x41')](_0x7664('0x96'),_0x305973[_0x33e279][_0x7664('0x97')],!_[_0x7664('0x3b')](config[_0x7664('0x98')][_0x20b0dd])?_0x20b0dd:'')})['then'](function(_0x5d4593){return _0x5d4593[_0x7664('0x99')][_0x7664('0x9a')](_0x7664('0x9b'))>=0x0;})[_0x7664('0x9c')](myreject(_0x4d3f1b)));}}else{_0x4f7dfb[_0x7664('0x93')](ami[_0x7664('0x94')]({'action':_0x7664('0x95'),'command':util['format'](_0x7664('0x96'),_0x305973,!_['isUndefined'](config['timezones'][_0x20b0dd])?_0x20b0dd:'')})['then'](function(_0x3b8dd5){return _0x3b8dd5[_0x7664('0x99')][_0x7664('0x9a')](_0x7664('0x9b'))>=0x0;})[_0x7664('0x9c')](myreject(_0x4d3f1b)));}Promise[_0x7664('0x9d')](_0x4f7dfb)[_0x7664('0x9e')](function(_0x4cf49f){var _0x3b0164=_[_0x7664('0x9f')](_0x4cf49f);if(_0x3b0164){return _0xc2a245(_0x3b0164);}else{_0x25cc1c[_0x7664('0x67')]=_0x4ffa3a?utils[_0x7664('0x68')][_0x7664('0xa0')]:utils[_0x7664('0x68')][_0x7664('0xa1')];return _0x4d3f1b(msgResponse(_0x7664('0xa2'),_0x7664('0x8c'),_0x7664('0xa3')+_0x4ffa3a+'\x20'+_0x403887+_0x7664('0xa4')+util[_0x7664('0x40')](_0x305973,{'showHidden':![],'depth':null})+_0x7664('0xa5')+_0x20b0dd));}})[_0x7664('0x9c')](function(_0x528c0e){return _0x4d3f1b(msgResponse('ifTime',_0x7664('0x8c'),JSON['stringify'](_0x528c0e)));});});};Dialer['prototype'][_0x7664('0xa6')]=function(){var _0x59ed84=this;return cmHopper[_0x7664('0xa7')]({'active':![]},{'where':{'active':!![]}})[_0x7664('0x9e')](function(){setInterval(function(){_0x59ed84[_0x7664('0xa8')]();},0x3e8);});};Dialer[_0x7664('0x15')][_0x7664('0xa8')]=function(){var _0x44e12e=this;var _0x1015ec;for(var _0x226c26 in this[_0x7664('0x1b')]){if(typeof this['campaigns'][_0x226c26]!==_0x7664('0xa9')){_0x1015ec=this[_0x7664('0x1b')][_0x226c26];if(utils[_0x7664('0x79')](_0x1015ec)&&utils[_0x7664('0x76')](_0x1015ec)){_0x1015ec[_0x7664('0x7b')]=!![];Promise[_0x7664('0xaa')]()[_0x7664('0x9e')](checkIsIVRCampaignActive(_0x1015ec))[_0x7664('0x9e')](checkInterval(_0x1015ec))[_0x7664('0x9e')](_0x44e12e[_0x7664('0x84')](_0x1015ec))['then'](_0x44e12e[_0x7664('0x89')](_0x1015ec['dialGlobalInterval'],_0x1015ec[_0x7664('0xab')],_0x1015ec[_0x7664('0x43')],_0x1015ec))['then'](_0x44e12e[_0x7664('0x8a')](_0x1015ec[_0x7664('0x74')],_0x1015ec[_0x7664('0xab')],_0x1015ec[_0x7664('0x43')],_0x1015ec))['then'](_0x44e12e[_0x7664('0xac')](_0x1015ec))[_0x7664('0x9c')](loggerCatchQueueSummary(_0x7664('0xad'),_0x1015ec));}else{notSendMessagesCampaign(_0x1015ec);}}}};Dialer[_0x7664('0x15')][_0x7664('0xae')]=function(_0x2f5059){if(_0x2f5059[_0x7664('0xaf')]!==_0x7664('0xa')){clearPredictiveAttributes(_0x2f5059);}switch(_0x2f5059[_0x7664('0xaf')]){case _0x7664('0xb0'):this[_0x7664('0xb1')](_0x2f5059,0x1);break;case _0x7664('0xb2'):this[_0x7664('0xb1')](_0x2f5059,_0x2f5059['dialPowerLevel']);break;case _0x7664('0xa'):this[_0x7664('0xa')](_0x2f5059);break;case _0x7664('0x9'):this[_0x7664('0xb1')](_0x2f5059,0x1);break;default:logger[_0x7664('0x64')]('Queue',_0x2f5059[_0x7664('0x43')],_0x7664('0xb3'));}};Dialer['prototype'][_0x7664('0x8e')]=function(_0x4db250,_0x467a99){var _0x440a54=_0x4db250['dialTimezone'];var _0x2816ed=_0x467a99?_0x4db250['dialGlobalInterval']:_0x4db250[_0x7664('0x74')][_0x7664('0x75')];logger[_0x7664('0xb4')](_0x7664('0xb5'),_0x2816ed,_0x440a54,_0x4db250[_0x7664('0x43')],util['format']('Voice\x20Queue\x20%s\x20$s',_0x4db250[_0x7664('0x43')],_0x4db250['id']));var _0x2866b2=null;return Interval[_0x7664('0xb6')](_0x2816ed,_0x440a54)[_0x7664('0x9e')](function(_0x4d8859){if(_0x4d8859===!![]){return _0x4d8859;}else{_0x4db250[_0x7664('0x67')]=_0x467a99?utils[_0x7664('0x68')][_0x7664('0xa0')]:utils[_0x7664('0x68')][_0x7664('0xa1')];_0x2866b2=msgResponse(_0x7664('0xa2'),_0x7664('0x8c'),'Global:\x20'+_0x467a99+'\x20'+_0x4db250['name']+_0x7664('0xa4')+util[_0x7664('0x40')](_0x2816ed,{'showHidden':![],'depth':null})+'Timezone:\x20'+_0x440a54);}if(_0x2866b2!==null){logger[_0x7664('0xb4')](_0x7664('0xb7'),_0x2866b2);_0x2866b2['isGlobal']=_0x467a99;throw _0x2866b2;}})['catch'](function(_0x58654a){logger[_0x7664('0x64')]('AMI\x20IfTime',_0x58654a);throw msgResponse(_0x7664('0xb8'),'Error',util[_0x7664('0x40')](_0x58654a,{'showHidden':![],'depth':null}));});};Dialer[_0x7664('0x15')]['syncAgentConnect']=function(_0x4fb957){if(this[_0x7664('0x1a')][_0x4fb957[_0x7664('0xb9')]]){if(this[_0x7664('0x22')][_0x4fb957[_0x7664('0xba')]]&&this[_0x7664('0x22')][_0x4fb957[_0x7664('0xba')]]['type']!=='ivr'){this[_0x7664('0xbb')](this[_0x7664('0x1a')][_0x4fb957[_0x7664('0xb9')]]);this['uniqueId'][_0x4fb957['uniqueid']][_0x7664('0xbc')]=moment()[_0x7664('0x41')](_0x7664('0xbd'));}}};Dialer[_0x7664('0x15')][_0x7664('0x2c')]=function(_0x37a650){var _0x56f9dd=this[_0x7664('0x22')][_0x37a650['uniqueid']];if(this[_0x7664('0x1a')][_0x37a650[_0x7664('0xb9')]]){if(_0x56f9dd&&_0x56f9dd[_0x7664('0x3d')]!==_0x7664('0xbe')){delete this[_0x7664('0x22')][_0x37a650['uniqueid']];this['voiceQueues'][_0x37a650[_0x7664('0xb9')]][_0x7664('0xbf')]+=0x1;var _0xe8c186=new AgentComplete(_0x56f9dd,_0x37a650);if(_0x37a650[_0x7664('0xc0')]==='agent'){_0xe8c186[_0x7664('0xc1')]=this[_0x7664('0x1a')][_0x37a650['queue']]['dialQueueProject2']&&this['voiceQueues'][_0x37a650[_0x7664('0xb9')]][_0x7664('0xc2')]?moment()['format'](_0x7664('0xbd')):undefined;}hopperUtils['createHistory'](_0xe8c186)['catch'](loggerCatch(_0x7664('0xc3')));hopperUtils[_0x7664('0xc4')](_0xe8c186)[_0x7664('0x9c')](loggerCatch(_0x7664('0xc5')));}}};Dialer[_0x7664('0x15')][_0x7664('0x28')]=function(_0x4d0018){var _0x35cbab=this['uniqueId'][_0x4d0018[_0x7664('0xba')]];var _0x3a8eaf=this;var _0x308a75=![];var _0x3be05b;var _0x8a9568;if(this[_0x7664('0x1a')][_0x4d0018['queue']]){if(_0x35cbab&&_0x35cbab[_0x7664('0x3d')]!==_0x7664('0xbe')){delete this[_0x7664('0x22')][_0x4d0018[_0x7664('0xba')]];this[_0x7664('0xbb')](this[_0x7664('0x1a')][_0x4d0018['queue']]);_0x35cbab[_0x7664('0xc6')]=moment()[_0x7664('0x41')]('YYYY-MM-DD\x20HH:mm:ss');var _0x94d7f0=new QueueCallerAbandon(_0x35cbab,_0x4d0018);if(utils['getSeconds'](_0x35cbab['droptime'],_0x35cbab[_0x7664('0xc7')])>=_0x35cbab['dialQueueTimeout']){this['voiceQueues'][_0x4d0018[_0x7664('0xb9')]][_0x7664('0x4c')]+=0x1;this['voiceQueues'][_0x4d0018[_0x7664('0xb9')]][_0x7664('0xc8')]+=0x1;this[_0x7664('0x1a')][_0x4d0018[_0x7664('0xb9')]][_0x7664('0xc9')]+=0x1;_0x94d7f0[_0x7664('0x6c')]=0xa;_0x94d7f0[_0x7664('0x6d')]=_0x7664('0xca');_0x94d7f0[_0x7664('0xcb')]=_0x7664('0xcc');_0x94d7f0[_0x7664('0xc1')]=this[_0x7664('0x1a')][_0x4d0018[_0x7664('0xb9')]][_0x7664('0xcd')]?moment()[_0x7664('0x41')]('YYYY-MM-DD\x20HH:mm:ss'):undefined;_0x94d7f0[_0x7664('0xce')]+=0x1;_0x94d7f0[_0x7664('0xcf')]+=0x1;_0x3be05b=this[_0x7664('0x1a')][_0x4d0018['queue']][_0x7664('0xd0')];_0x8a9568=this[_0x7664('0x1a')][_0x4d0018[_0x7664('0xb9')]][_0x7664('0xd1')];hopperUtils[_0x7664('0xd2')](_0x94d7f0,_0x94d7f0['state'],_0x35cbab[_0x7664('0xd3')])[_0x7664('0x9e')](function(_0x3bdad6){_0x308a75=_0x3bdad6[_0x7664('0xd4')]==0x1;if(_0x94d7f0['countdropretry']>=_0x3a8eaf[_0x7664('0x1a')][_0x4d0018['queue']]['dialDropMaxRetry']){_0x3a8eaf[_0x7664('0xd5')](_0x94d7f0,_0x3bdad6['additional']);}else{hopperUtils['rescheduleContact']({'active':![],'countdropretry':_0x94d7f0[_0x7664('0xce')],'scheduledat':moment()['add'](_0x3a8eaf[_0x7664('0x1a')][_0x4d0018[_0x7664('0xb9')]]['dialDropRetryFrequency'],_0x7664('0xd6'))[_0x7664('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x35cbab['ContactId'],'ListId':_0x35cbab['ListId'],'VoiceQueueId':_0x35cbab['VoiceQueueId']||undefined,'CampaignId':_0x35cbab[_0x7664('0xd7')]||undefined})['catch'](loggerCatch('[rescheduleContact][Drop]'));var _0x1823de=new History(_0x94d7f0);_0x1823de[_0x7664('0x6c')]=0xa;_0x1823de[_0x7664('0x6d')]=_0x7664('0xca');_0x1823de[_0x7664('0xd8')]=moment()[_0x7664('0x41')]('YYYY-MM-DD\x20HH:mm:ss');_0x1823de[_0x7664('0xd9')]=_0x1823de[_0x7664('0xd8')];_0x1823de[_0x7664('0xda')]=_0x94d7f0[_0x7664('0xda')];_0x1823de[_0x7664('0xdb')]=_0x94d7f0[_0x7664('0xdb')];hopperUtils['createHistory'](_0x1823de)['catch'](loggerCatch('[syncAgentComplete][createHistory][10]'));}})[_0x7664('0x9e')](function(){if(_0x308a75)hopperUtils['swapAdditionalPhones'](_0x94d7f0,_0x3be05b,_0x8a9568)[_0x7664('0x9e')](function(){return 0x1;});});}else{this[_0x7664('0x1a')][_0x4d0018[_0x7664('0xb9')]][_0x7664('0xdc')]+=0x1;this[_0x7664('0x1a')][_0x4d0018['queue']][_0x7664('0xdd')]+=0x1;_0x94d7f0[_0x7664('0x6c')]=0xb;_0x94d7f0[_0x7664('0x6d')]='Abandoned';_0x94d7f0[_0x7664('0xcb')]=_0x7664('0xde');_0x94d7f0['countabandonedretry']+=0x1;_0x94d7f0['countglobal']+=0x1;_0x3be05b=this[_0x7664('0x1a')][_0x4d0018[_0x7664('0xb9')]][_0x7664('0xdf')];_0x8a9568=this[_0x7664('0x1a')][_0x4d0018[_0x7664('0xb9')]][_0x7664('0xd1')];hopperUtils[_0x7664('0xd2')](_0x94d7f0,_0x94d7f0[_0x7664('0x6c')],_0x35cbab[_0x7664('0xd3')])['then'](function(_0x1f5d09){if(_0x94d7f0[_0x7664('0xe0')]>=_0x3a8eaf[_0x7664('0x1a')][_0x4d0018['queue']][_0x7664('0xe1')]){_0x3a8eaf[_0x7664('0xd5')](_0x94d7f0,_0x1f5d09[_0x7664('0xd4')]);}else{hopperUtils[_0x7664('0xe2')]({'active':![],'countabandonedretry':_0x94d7f0[_0x7664('0xe0')],'scheduledat':moment()[_0x7664('0xe3')](_0x3a8eaf[_0x7664('0x1a')][_0x4d0018[_0x7664('0xb9')]][_0x7664('0xdf')],'minutes')[_0x7664('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x35cbab[_0x7664('0xe4')],'ListId':_0x35cbab[_0x7664('0xe5')],'VoiceQueueId':_0x35cbab[_0x7664('0xe6')]||undefined,'CampaignId':_0x35cbab[_0x7664('0xd7')]||undefined})[_0x7664('0x9c')](loggerCatch(_0x7664('0xe7')));var _0x4161af=new History(_0x94d7f0);_0x4161af['state']=0xb;_0x4161af['statedesc']=_0x7664('0xe8');_0x4161af[_0x7664('0xd8')]=moment()['format'](_0x7664('0xbd'));_0x4161af[_0x7664('0xd9')]=_0x4161af[_0x7664('0xd8')];_0x4161af[_0x7664('0xda')]=_0x94d7f0[_0x7664('0xda')];_0x4161af['calleridnum']=_0x94d7f0[_0x7664('0xdb')];hopperUtils['createHistory'](_0x4161af)[_0x7664('0x9c')](loggerCatch(_0x7664('0xe9')));}})[_0x7664('0x9e')](function(){if(_0x308a75)hopperUtils[_0x7664('0xea')](_0x94d7f0,_0x3be05b,_0x8a9568)[_0x7664('0x9e')](function(){return 0x1;});});}}}};Dialer[_0x7664('0x15')][_0x7664('0x33')]=function(_0x2068c3){if(this[_0x7664('0x20')][_0x2068c3['uniqueid']]){this[_0x7664('0x20')][_0x2068c3[_0x7664('0xba')]][_0x7664('0xeb')]=_0x2068c3[_0x7664('0xeb')];}if(this[_0x7664('0x22')][_0x2068c3['uniqueid']]){this[_0x7664('0x22')][_0x2068c3[_0x7664('0xba')]][_0x7664('0xeb')]=_0x2068c3[_0x7664('0xeb')];}};Dialer[_0x7664('0x15')][_0x7664('0x37')]=function(_0x247861){if(!this[_0x7664('0x20')][_0x247861[_0x7664('0xec')]]){return;}var _0x1db0aa=this['voiceQueues'][this[_0x7664('0x20')][_0x247861[_0x7664('0xec')]][_0x7664('0xb9')]][_0x7664('0xed')]||_0x7664('0xee');if(_0x1db0aa==='roundrobin'){if(this[_0x7664('0x20')][_0x247861[_0x7664('0xec')]]&&_['isNil'](this[_0x7664('0x20')][_0x247861[_0x7664('0xec')]][_0x7664('0xef')])&&_0x247861['status']==='1'&&_0x247861['paused']==='0'){if(this['agents'][_0x247861[_0x7664('0xf0')]]){if(!this['agents'][_0x247861['stateinterface']][_0x7664('0xef')]){this[_0x7664('0x1c')][_0x247861[_0x7664('0xf0')]][_0x7664('0xef')]=!![];this['actions'][_0x247861[_0x7664('0xec')]][_0x7664('0xef')]=!![];this[_0x7664('0x20')][_0x247861[_0x7664('0xec')]][_0x7664('0xf0')]=_0x247861[_0x7664('0xf0')];}}}}else if(_0x1db0aa===_0x7664('0xee')){if(this[_0x7664('0x20')][_0x247861[_0x7664('0xec')]]){if(this['agents'][_0x247861[_0x7664('0xf0')]]){this[_0x7664('0x20')][_0x247861['actionid']]['stateinterface']=_0x247861['stateinterface'];if(_[_0x7664('0xf1')](this[_0x7664('0xf2')][this[_0x7664('0x20')][_0x247861[_0x7664('0xec')]][_0x7664('0xb9')]])){this[_0x7664('0xf2')][this[_0x7664('0x20')][_0x247861['actionid']][_0x7664('0xb9')]]=[];}this[_0x7664('0xf2')][this[_0x7664('0x20')][_0x247861[_0x7664('0xec')]][_0x7664('0xb9')]][_0x7664('0x93')](_[_0x7664('0x5d')](_[_0x7664('0x71')](this[_0x7664('0x20')][_0x247861[_0x7664('0xec')]],['idHopper',_0x7664('0xf0')]),{'status':_0x247861[_0x7664('0x82')],'paused':_0x247861['paused']}));}}}};Dialer[_0x7664('0x15')]['syncQueueStatusComplete']=function(_0x2e0ad6){if(!this[_0x7664('0x20')][_0x2e0ad6[_0x7664('0xec')]]){return;}var _0x559ca0=this;var _0x1719a5=this[_0x7664('0x1a')][this['actions'][_0x2e0ad6[_0x7664('0xec')]][_0x7664('0xb9')]];var _0x56b419=_0x1719a5[_0x7664('0xed')]||_0x7664('0xee');if(_0x56b419==='roundrobin'){if(this[_0x7664('0x20')][_0x2e0ad6[_0x7664('0xec')]]&&this[_0x7664('0x20')][_0x2e0ad6[_0x7664('0xec')]]['stateinterface']){this[_0x7664('0xf3')][_0x7664('0xf4')](this[_0x7664('0x20')][_0x2e0ad6[_0x7664('0xec')]][_0x7664('0xf5')],this[_0x7664('0x20')][_0x2e0ad6[_0x7664('0xec')]][_0x7664('0xf0')])[_0x7664('0x9c')](function(_0x5ce3c5){logger[_0x7664('0x64')](_0x7664('0xf6'),util[_0x7664('0x40')](_0x5ce3c5,{'showHidden':![],'depth':null}));})[_0x7664('0x18')](function(){_0x559ca0[_0x7664('0xbb')](_0x559ca0[_0x7664('0x1a')][_0x559ca0[_0x7664('0x20')][_0x2e0ad6['actionid']][_0x7664('0xb9')]]);_0x559ca0['agents'][_0x559ca0[_0x7664('0x20')][_0x2e0ad6['actionid']][_0x7664('0xf0')]][_0x7664('0xef')]=![];delete _0x559ca0[_0x7664('0x20')][_0x2e0ad6[_0x7664('0xec')]];unlockQueueStatus(_0x1719a5);});}else{this[_0x7664('0xbb')](this[_0x7664('0x1a')][this['actions'][_0x2e0ad6[_0x7664('0xec')]]['queue']]);hopperUtils[_0x7664('0xe2')]({'active':![],'ContactId':this['actions'][_0x2e0ad6[_0x7664('0xec')]][_0x7664('0xe4')],'ListId':this[_0x7664('0x20')][_0x2e0ad6[_0x7664('0xec')]][_0x7664('0xe5')],'VoiceQueueId':this[_0x7664('0x20')][_0x2e0ad6[_0x7664('0xec')]][_0x7664('0xe6')]||undefined,'CampaignId':this[_0x7664('0x20')][_0x2e0ad6[_0x7664('0xec')]]['CampaignId']||undefined})[_0x7664('0x9c')](loggerCatch('[unlock][syncQueueStatusComplete]'));delete this[_0x7664('0x20')][_0x2e0ad6[_0x7664('0xec')]];unlockQueueStatus(_0x1719a5);}}else if(_0x56b419===_0x7664('0xee')){var _0x1c69ca;if(this[_0x7664('0x20')][_0x2e0ad6['actionid']]&&!_[_0x7664('0x45')](this[_0x7664('0xf2')][this['actions'][_0x2e0ad6[_0x7664('0xec')]][_0x7664('0xb9')]])){if(this['queueBookedRR'][_0x559ca0['actions'][_0x2e0ad6[_0x7664('0xec')]][_0x7664('0xb9')]]){this[_0x7664('0xf7')][_0x559ca0[_0x7664('0x20')][_0x2e0ad6[_0x7664('0xec')]][_0x7664('0xb9')]]=this['queueBookedRR'][this['actions'][_0x2e0ad6[_0x7664('0xec')]][_0x7664('0xb9')]]?this[_0x7664('0xf7')][this[_0x7664('0x20')][_0x2e0ad6['actionid']]['queue']]:this[_0x7664('0xf2')][this[_0x7664('0x20')][_0x2e0ad6[_0x7664('0xec')]]['queue']]?this[_0x7664('0xf2')][this[_0x7664('0x20')][_0x2e0ad6[_0x7664('0xec')]][_0x7664('0xb9')]][_0x7664('0xf8')]||0x0:0x0;}this['queueBooked'][this[_0x7664('0x20')][_0x2e0ad6[_0x7664('0xec')]][_0x7664('0xb9')]]['_rr']=this[_0x7664('0xf7')][this['actions'][_0x2e0ad6[_0x7664('0xec')]]['queue']];for(var _0x242b97=0x0;_0x242b97=_0x146113['dialGlobalMaxRetry']){_0x19b70d['stateGlobal'](_0xec1669,_0x5c5747,_0x544b31,'reason19\x20machine....');}else{if(_0xec1669[_0x7664('0x118')]>=_0x146113[_0x7664('0x11c')]){_0x19b70d[_0x7664('0x11d')](_0xec1669,_0x5c5747,_0x544b31,_0x7664('0x11e'));}else{hopperUtils[_0x7664('0xe2')]({'active':![],'countmachineretry':_0xec1669['countmachineretry'],'scheduledat':moment()['add'](_0x146113[_0x7664('0x11f')],_0x7664('0xd6'))[_0x7664('0x41')](_0x7664('0xbd')),'ContactId':_0xec1669[_0x7664('0xe4')],'ListId':_0xec1669['ListId'],'VoiceQueueId':_0xec1669[_0x7664('0xe6')]||undefined,'CampaignId':_0xec1669[_0x7664('0xd7')]||undefined})[_0x7664('0x9c')](loggerCatch(_0x7664('0x120')));_0x5c5747({'reschedule':0x1});}}});}if(_0x42888a[_0x7664('0x3d')]===_0x7664('0xbe')&&this[_0x7664('0x1b')][_0x42888a[_0x7664('0xb9')]][_0x7664('0x10a')]&&_0x3fe0c3[_0x7664('0x10b')]===_0x7664('0x10c')){delete this[_0x7664('0x22')][_0x3fe0c3[_0x7664('0xba')]];this[_0x7664('0xbb')](this[_0x7664('0x1b')][_0x42888a[_0x7664('0xb9')]]);_0x370b9d=new Hangup(_0x42888a,_0x3fe0c3);_0x370b9d[_0x7664('0x6c')]=0x12;_0x370b9d[_0x7664('0x6d')]=_0x7664('0x10e');_0x370b9d[_0x7664('0x10f')]=_0x7664('0x110');ami['emit'](_0x7664('0x111'),ut[_0x7664('0x112')](_0x370b9d,_0x7664('0x113')));this[_0x7664('0x121')](_0x370b9d,_0x7664('0x122'),'[syncHangupInAMDIvr]');}if(_0x42888a[_0x7664('0x3d')]===_0x7664('0xbe')&&this['campaigns'][_0x42888a[_0x7664('0xb9')]][_0x7664('0x10a')]&&_0x3fe0c3['value']===_0x7664('0x116')){return new Promise(function(_0x549621,_0x314d33){delete _0x19b70d[_0x7664('0x22')][_0x3fe0c3[_0x7664('0xba')]];_0x19b70d[_0x7664('0xbb')](_0x19b70d[_0x7664('0x1b')][_0x42888a[_0x7664('0xb9')]]);_0x19b70d[_0x7664('0x1b')][_0x42888a[_0x7664('0xb9')]][_0x7664('0xbf')]+=0x1;_0x19b70d[_0x7664('0x1b')][_0x42888a['queue']][_0x7664('0x10d')]+=0x1;var _0x3f6405=_0x19b70d['campaigns'][_0x42888a['queue']];var _0x93827e=new Hangup(_0x42888a,_0x3fe0c3);_0x93827e['state']=0x13;_0x93827e['statedesc']=_0x7664('0x117');_0x93827e['membername']='AMD';_0x93827e[_0x7664('0x118')]+=0x1;_0x93827e[_0x7664('0xcf')]+=0x1;_0x93827e[_0x7664('0x113')]=!![];ami['emit']('custom:amd',ut[_0x7664('0x112')](_0x93827e,_0x7664('0x113')));hopperUtils[_0x7664('0x123')](_0x93827e)[_0x7664('0x9c')](loggerCatch(_0x7664('0x119')));if(_0x93827e[_0x7664('0x11a')]+_0x93827e['countcongestionretry']+_0x93827e['countnoanswerretry']+_0x93827e[_0x7664('0x124')]+_0x93827e[_0x7664('0xce')]+_0x93827e[_0x7664('0xe0')]+_0x93827e['countmachineretry']+_0x93827e[_0x7664('0x11b')]>=_0x3f6405[_0x7664('0x125')]){_0x19b70d[_0x7664('0x126')](_0x93827e,_0x549621,_0x314d33,'reason19\x20machine....');}else{if(_0x93827e[_0x7664('0x118')]>=_0x3f6405[_0x7664('0x11c')]){_0x19b70d[_0x7664('0x11d')](_0x93827e,_0x549621,_0x314d33,_0x7664('0x11e'));}else{hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x93827e[_0x7664('0x118')],'scheduledat':moment()[_0x7664('0xe3')](_0x3f6405['dialMachineRetryFrequency'],'minutes')[_0x7664('0x41')](_0x7664('0xbd')),'ContactId':_0x93827e[_0x7664('0xe4')],'ListId':_0x93827e[_0x7664('0xe5')],'VoiceQueueId':_0x93827e[_0x7664('0xe6')]||undefined,'CampaignId':_0x93827e[_0x7664('0xd7')]||undefined})['catch'](loggerCatch(_0x7664('0x120')));_0x549621({'reschedule':0x1});}}});}}};Dialer[_0x7664('0x15')][_0x7664('0x31')]=function(_0x4d6ca2){var _0x47eb98=this[_0x7664('0x22')][_0x4d6ca2['uniqueid']];var _0x3b49d9;if(_0x47eb98&&_0x47eb98[_0x7664('0x3d')]===_0x7664('0xbe')){delete this[_0x7664('0x22')][_0x4d6ca2[_0x7664('0xba')]];this[_0x7664('0xbb')](this['campaigns'][_0x47eb98[_0x7664('0xb9')]]);this[_0x7664('0x1b')][_0x47eb98[_0x7664('0xb9')]][_0x7664('0x127')]+=0x1;_0x3b49d9=new Hangup(_0x47eb98,_0x4d6ca2);hopperUtils[_0x7664('0x123')](_0x3b49d9)[_0x7664('0x9c')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x7664('0xc4')](_0x3b49d9)[_0x7664('0x9c')](loggerCatch(_0x7664('0x128')));}if(_0x47eb98&&_0x47eb98['type']!==_0x7664('0xbe')&&isNotNull(this['voiceQueues'][_0x47eb98['queue']][_0x7664('0x129')])){delete this['uniqueId'][_0x4d6ca2['uniqueid']];this[_0x7664('0xbb')](this['voiceQueues'][_0x47eb98[_0x7664('0xb9')]]);this[_0x7664('0x1a')][_0x47eb98[_0x7664('0xb9')]][_0x7664('0xbf')]+=0x1;this['voiceQueues'][_0x47eb98[_0x7664('0xb9')]][_0x7664('0x10d')]+=0x1;_0x3b49d9=new Hangup(_0x47eb98,_0x4d6ca2);_0x3b49d9[_0x7664('0x6c')]=0x10;_0x3b49d9[_0x7664('0x6d')]=_0x7664('0x12a');_0x3b49d9[_0x7664('0x10f')]='AGI';hopperUtils[_0x7664('0x123')](_0x3b49d9)[_0x7664('0x9c')](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x7664('0xc4')](_0x3b49d9)[_0x7664('0x9c')](loggerCatch(_0x7664('0x128')));}if(_0x47eb98&&_0x47eb98[_0x7664('0x3d')]!==_0x7664('0xbe')&&!isNotNull(this['voiceQueues'][_0x47eb98[_0x7664('0xb9')]][_0x7664('0x129')])){delete this['uniqueId'][_0x4d6ca2[_0x7664('0xba')]];this[_0x7664('0xbb')](this[_0x7664('0x1a')][_0x47eb98[_0x7664('0xb9')]]);this[_0x7664('0x1a')][_0x47eb98[_0x7664('0xb9')]]['outboundUnknownCallsDay']+=0x1;_0x3b49d9=new Hangup(_0x47eb98,_0x4d6ca2);_0x3b49d9[_0x7664('0x6c')]=0xc;_0x3b49d9['statedesc']=_0x4d6ca2['cause-txt'];_0x3b49d9[_0x7664('0x10f')]=_0x7664('0x12b');hopperUtils[_0x7664('0x123')](_0x3b49d9)['catch'](loggerCatch('[syncHangupIvr][createHistory]'));hopperUtils[_0x7664('0xc4')](_0x3b49d9)['catch'](loggerCatch(_0x7664('0x128')));}};Dialer['prototype'][_0x7664('0xc')]=function(_0x411dee){var _0x5a5218=this;if(!_0x5a5218[_0x7664('0x12c')][_0x411dee[_0x7664('0x43')]]){_0x5a5218[_0x7664('0x12c')][_0x411dee[_0x7664('0x43')]]={'running':![]};}else if(_0x5a5218[_0x7664('0x12c')][_0x411dee[_0x7664('0x43')]][_0x7664('0x12d')]===!![]){return;}else if(_0x5a5218[_0x7664('0x12c')][_0x411dee[_0x7664('0x43')]]['running']===![]){_0x5a5218['queuesSummary'][_0x411dee[_0x7664('0x43')]][_0x7664('0x12d')]=!![];}var _0x421ab2=_0x5a5218['voiceQueues'][_0x411dee['name']];var _0x878fb1=_0x421ab2[_0x7664('0x67')]!==utils[_0x7664('0x68')][_0x7664('0x77')];var _0x3369af=utils[_0x7664('0x12e')](_0x421ab2);_0x421ab2[_0x7664('0x12f')]=utils['getQueueCampaignStatusMessage'](_0x421ab2,_0x5a5218[_0x7664('0x1d')]);Promise[_0x7664('0xaa')]()['then'](function(){if(_0x421ab2[_0x7664('0x12f')]===utils[_0x7664('0x68')][_0x7664('0x77')]){if(_0x878fb1){clearPredictiveAttributes(_0x421ab2);_0x411dee[_0x7664('0x24')]=undefined;_0x411dee[_0x7664('0x5f')]=undefined;}if(_0x421ab2['statusMessage']===utils[_0x7664('0x68')]['INACTIVE']){_0x411dee[_0x7664('0x130')]=0x0;_0x411dee['paused']=0x0;_0x411dee[_0x7664('0x131')]=0x0;_0x411dee[_0x7664('0x132')]=0x0;_0x411dee['pTalking']=0x0;}}else if(_0x421ab2['statusMessage']===utils['CAMPAIGN_STATUS'][_0x7664('0x133')]&&!_0x3369af){return _0x5a5218[_0x7664('0x8e')](_0x421ab2,!![])[_0x7664('0x9e')](function(){return _0x5a5218[_0x7664('0x8e')](_0x421ab2,![]);})[_0x7664('0x9e')](function(){return _0x5a5218[_0x7664('0xae')](_0x421ab2);})[_0x7664('0x9c')](function(_0x1a5a28){loggerSyncQueueSummary[_0x7664('0x3f')](_0x7664('0x134'),util[_0x7664('0x40')](_0x1a5a28,{'showHidden':![],'depth':null}));clearPredictiveAttributes(_0x421ab2);});}else{clearPredictiveAttributes(_0x421ab2);}})[_0x7664('0x9e')](function(){var _0x19c763=_0x411dee[_0x7664('0x135')](_0x421ab2);if(_0x19c763||_0x421ab2[_0x7664('0x136')]){_0x421ab2[_0x7664('0x136')]=![];_0x411dee[_0x7664('0x137')](_0x421ab2);Object[_0x7664('0x138')](_0x421ab2,_0x411dee);emitOutboundVoiceQueueSummary(_0x411dee);}_0x5a5218['queuesSummary'][_0x421ab2[_0x7664('0x43')]][_0x7664('0x12d')]=![];})[_0x7664('0x9c')](function(_0x35145e){logger[_0x7664('0x64')](_0x7664('0x134'),util[_0x7664('0x40')](_0x35145e,{'showHidden':![],'depth':null}));_0x5a5218[_0x7664('0x12c')][_0x421ab2['name']][_0x7664('0x12d')]=![];});};Dialer['prototype'][_0x7664('0x2f')]=_[_0x7664('0x139')](function(){var _0x3ef777=_[_0x7664('0x13a')](this[_0x7664('0x1a')],function(_0xf710ff){return _0xf710ff[_0x7664('0x13b')];});var _0x2779af=_[_0x7664('0x13a')](this[_0x7664('0x1c')],function(_0x4c539b){return _0x4c539b['online']&&_0x4c539b[_0x7664('0x82')]===_0x7664('0x13c');});if(_0x3ef777[_0x7664('0x92')]>0x0&&_0x2779af[_0x7664('0x92')]>0x0){return Promise['resolve']()[_0x7664('0x9e')](cmHopper['handlePreviewRecallNotifications'](_['map'](_0x3ef777,'id'),previewRecallmeReminderInterval,_[_0x7664('0x13d')](_0x2779af,'id')))['then'](function(_0x388e05){for(var _0x46c57b=0x0;_0x46c57b<_0x388e05[_0x7664('0x92')];_0x46c57b++){var _0x389269=_0x388e05[_0x46c57b]['Agent'][_0x7664('0x43')];if(_0x389269)io['to'](util[_0x7664('0x41')]('user:%s',_0x389269))[_0x7664('0x3c')](_0x7664('0x13e'),{'hopper':_0x388e05[_0x46c57b]});}})[_0x7664('0x9c')](function(_0x2981dc){logger[_0x7664('0x64')](_0x7664('0x13f'),_0x2981dc);});}},0x3c*0x3e8,{'leading':!![]});Dialer[_0x7664('0x15')]['loopClearZombieChannels']=function(){var _0x201693=this;setInterval(function(){_0x201693[_0x7664('0x140')](_0x201693[_0x7664('0x22')],_0x7664('0x141'));_0x201693[_0x7664('0x140')](_0x201693[_0x7664('0x20')],_0x7664('0x142'));},0x32c8);};Dialer[_0x7664('0x15')][_0x7664('0x140')]=function(_0x5860ff,_0xd1c018){var _0x1d25aa=this;for(var _0x3099c4 in _0x5860ff){if(typeof _0x5860ff[_0x3099c4]!==_0x7664('0xa9')){this[_0x7664('0x19')][_0x7664('0x16')](function(){if(!_[_0x7664('0xf1')](_0x5860ff[_0x3099c4])){return ami[_0x7664('0x94')]({'action':_0x7664('0x82'),'channel':_0x5860ff[_0x3099c4][_0x7664('0xeb')]})[_0x7664('0x9c')](function(_0x17d967){if(_0x17d967[_0x7664('0x67')]===_0x7664('0x143')){setTimeout(function(){if(_0x5860ff[_0x3099c4]&&_0x5860ff[_0x3099c4][_0x7664('0x3d')]!==_0x7664('0xbe')){_0x1d25aa[_0x7664('0xbb')](_0x1d25aa[_0x7664('0x1a')][_0x5860ff[_0x3099c4][_0x7664('0xb9')]]);logger[_0x7664('0x64')](_0x7664('0x144'),_0xd1c018,_0x3099c4,_0x5860ff[_0x3099c4][_0x7664('0xb9')]);delete _0x5860ff[_0x3099c4];}if(_0x5860ff[_0x3099c4]&&_0x5860ff[_0x3099c4][_0x7664('0x3d')]==='ivr'){_0x1d25aa['updateOriginated'](_0x1d25aa[_0x7664('0x1b')][_0x5860ff[_0x3099c4]['queue']]);logger[_0x7664('0x64')](_0x7664('0x145'),_0xd1c018,_0x3099c4,_0x5860ff[_0x3099c4][_0x7664('0xb9')]);delete _0x5860ff[_0x3099c4];}},0x2328);}});}});}}};Dialer['prototype'][_0x7664('0x146')]=function(_0x56d5e1){return Promise[_0x7664('0xaa')]()[_0x7664('0x9e')](voiceQueueRt[_0x7664('0x146')](_0x56d5e1))[_0x7664('0x9c')](loggerCatch(_0x7664('0x147')));};Dialer[_0x7664('0x15')][_0x7664('0xbb')]=function(_0xc2e016){if(!_[_0x7664('0x3b')](_0xc2e016)&&_0xc2e016!==null){if(typeof _0xc2e016[_0x7664('0x7c')]!==_0x7664('0xa9')){if(_0xc2e016[_0x7664('0x7c')]>0x0){_0xc2e016[_0x7664('0x7c')]-=0x1;}else{logger[_0x7664('0x64')]('[updateOriginated]\x20object\x20originated\x20is\x20negative');}}}else{logger[_0x7664('0x64')](_0x7664('0x148'));}};Dialer[_0x7664('0x15')]['loggerHandler']=function(_0x52d5c5,_0x2e94a0){var _0x133f57=this;return function(_0x34060d){_0x133f57[_0x7664('0xbb')](_0x2e94a0);logger['error'](_0x52d5c5,util['inspect'](_0x34060d,{'showHidden':![],'depth':null}));};};Dialer[_0x7664('0x15')][_0x7664('0x149')]=function(_0x1f58e9,_0x37ab1b,_0x4726c6){var _0x13e806={'state':0x19,'statedesc':_0x7664('0x14a')};this[_0x7664('0xbb')](_0x37ab1b);this[_0x7664('0x121')](_[_0x7664('0x5d')](_0x13e806,_[_0x7664('0x71')](_0x4726c6,['ContactId',_0x7664('0xe5'),_0x7664('0x14b'),_0x7664('0xe6'),_0x7664('0xd7')])),_0x7664('0x14c'),'[emptyContact]');logger['error'](_0x1f58e9);};Dialer[_0x7664('0x15')][_0x7664('0x121')]=function(_0x40ea00,_0x13ecbb,_0x2ab982){hopperUtils[_0x7664('0x123')](_0x40ea00)[_0x7664('0x9c')](loggerCatch(_0x13ecbb));hopperUtils[_0x7664('0xc4')](_0x40ea00)[_0x7664('0x9c')](loggerCatch(_0x2ab982));};Dialer[_0x7664('0x15')][_0x7664('0xd5')]=function(_0x56db42,_0x1d470a){hopperUtils[_0x7664('0x123')](_0x56db42)[_0x7664('0x9c')](loggerCatch('[syncAgentComplete][createHistory]'));if(_0x1d470a==0x0){hopperUtils['moveContactManagedDialer'](_0x56db42)[_0x7664('0x9c')](loggerCatch('[syncQueueCallerAbandon]\x20[Drop]'));}};Dialer[_0x7664('0x15')]['checkPreviewRecallReminder']=function(_0x429d06){return Promise[_0x7664('0xaa')]()[_0x7664('0x9e')](cmHopper[_0x7664('0x14d')](_0x429d06['id'],previewRecallmeReminderInterval))['then'](function(_0x42df97){for(var _0x4175b3=0x0;_0x4175b3<_0x42df97['length'];_0x4175b3++){var _0x5c884d=_0x42df97[_0x4175b3]['Agent'][_0x7664('0x43')];if(_0x5c884d)io['to'](util['format'](_0x7664('0x14e'),_0x5c884d))[_0x7664('0x3c')](_0x7664('0x13e'),{'hopper':_0x42df97[_0x4175b3]});}})[_0x7664('0x9c')](function(){});};Dialer[_0x7664('0x15')][_0x7664('0xac')]=function(_0x356626){var _0x47b5f2=this;return function(){_0x47b5f2[_0x7664('0x14f')](_0x356626);};};Dialer[_0x7664('0x15')][_0x7664('0x150')]=function(_0x2cf034,_0x4cce01){var _0x2f3284=this;var _0x46b45e=uuid['v4']();this[_0x7664('0x20')][_0x46b45e]=new Action(_0x2cf034,_0x4cce01,_0x46b45e);return new Promise(function(_0x1a8e84,_0x57e383){if(_[_0x7664('0x3b')](_0x2cf034)&&typeof _0x2cf034!==_0x7664('0x151')){return _0x57e383(msgResponse(_0x7664('0x152'),_0x7664('0x8c'),'voiceQueue\x20is\x20undefine'));}if(_['isUndefined'](_0x4cce01[_0x7664('0x153')])||_0x4cce01['phone']===null){return _0x57e383(msgResponse(_0x7664('0x152'),_0x7664('0x8c'),'contact\x20is\x20undefine'));}var _0x37c279={'XMD-CALLERID':_0x2f3284[_0x7664('0x20')][_0x46b45e]['getCaller'](),'XMD-AGI':_0x2cf034['dialQueueProject']?util[_0x7664('0x41')](_0x7664('0x154'),ipAgi,_0x2cf034['dialQueueProject']):'NONE','XMD-AGIAFTER':_0x2cf034[_0x7664('0xcd')]?util[_0x7664('0x41')](_0x7664('0x154'),ipAgi,_0x2cf034['dialQueueProject2']):_0x7664('0x155'),'XMD-QUEUE':utils['isOutboundQueue'](_0x2cf034)?util[_0x7664('0x41')](_0x7664('0x156'),_0x2cf034[_0x7664('0x43')],_0x2cf034[_0x7664('0x157')]||'',_0x2cf034['dialAgiAfterHangupAgent']?'c':'',_0x2cf034['dialQueueTimeout']||0x3):_0x7664('0x155'),'XMD-CONTACTID':_0x4cce01[_0x7664('0xe4')],'XMD-CDRTYPE':_0x7664('0x8'),'CALLERID(all)':_0x2f3284[_0x7664('0x20')][_0x46b45e]['getCaller'](),'XMD-AMD':_0x2cf034[_0x7664('0x10a')]?_0x7664('0x133'):_0x7664('0x155'),'XMD-DESTINATION':_0x7664('0x109')};if(_0x2cf034[_0x7664('0x10a')]){_0x37c279['XMD-AMDINITIALSILENCE']=_0x2cf034[_0x7664('0x158')]||0x9c4;_0x37c279[_0x7664('0x159')]=_0x2cf034['dialAMDGreeting']||0x5dc;_0x37c279[_0x7664('0x15a')]=_0x2cf034['dialAMDAfterGreetingSilence']||0x320;_0x37c279[_0x7664('0x15b')]=_0x2cf034[_0x7664('0x15c')]||0x1388;_0x37c279['XMD-AMDMINWORDLENGTH']=_0x2cf034['dialAMDMinWordLength']||0x64;_0x37c279[_0x7664('0x15d')]=_0x2cf034[_0x7664('0x15e')]||0x32;_0x37c279[_0x7664('0x15f')]=_0x2cf034[_0x7664('0x160')]||0x3;_0x37c279[_0x7664('0x161')]=_0x2cf034[_0x7664('0x162')]||0x100;_0x37c279[_0x7664('0x163')]=_0x2cf034['dialAMDMaximumWordLength']||0x1388;}if(utils[_0x7664('0x164')](_0x2cf034)){_0x37c279[_0x7664('0x165')]=_0x4cce01[_0x7664('0xe6')];}else{_0x37c279[_0x7664('0x166')]=_0x4cce01[_0x7664('0xd7')];}for(var _0x19a749 in _0x4cce01[_0x7664('0x167')]){if(typeof _0x4cce01['Contact'][_0x19a749]!==_0x7664('0xa9')){if(isNotNull(_0x4cce01[_0x7664('0x167')][_0x19a749])&&_0x19a749!=='id'&&_0x19a749!==_0x7664('0x168')&&_0x19a749!==_0x7664('0x169')&&_0x19a749!==_0x7664('0x16a')){_0x37c279[util[_0x7664('0x41')](_0x7664('0x16b'),_0x7664('0x16c'),_[_0x7664('0x16d')](_0x19a749))]=_0x4cce01[_0x7664('0x167')][_0x19a749];}}}var _0x2759a6=_0x2f3284['isTrunkReachable'](_0x2cf034[_0x7664('0x85')])?utils[_0x7664('0x16e')](_0x2cf034[_0x7664('0x85')][_0x7664('0x16f')],_0x2cf034['dialOriginateCallerIdName'],_0x2cf034[_0x7664('0x170')]>0x0?utils[_0x7664('0x171')](_0x2cf034[_0x7664('0x172')],_0x2cf034[_0x7664('0x170')]):_0x2cf034[_0x7664('0x172')]):utils['getCallerId'](_[_0x7664('0xf1')](_0x2cf034[_0x7664('0x86')])?_0x2cf034[_0x7664('0x85')][_0x7664('0x16f')]:_0x2cf034[_0x7664('0x86')]['callerid'],_0x2cf034[_0x7664('0x173')],_0x2cf034[_0x7664('0x170')]>0x0?utils['getCallerIdRandom'](_0x2cf034['dialOriginateCallerIdNumber'],_0x2cf034[_0x7664('0x170')]):_0x2cf034['dialOriginateCallerIdNumber']);if(_0x2759a6){_0x37c279[_0x7664('0x174')]=_0x2f3284[_0x7664('0x20')][_0x46b45e][_0x7664('0x175')]=utils[_0x7664('0x176')](_0x2759a6);_0x37c279[_0x7664('0x177')]=_0x4cce01['phone'];}_0x2cf034[_0x7664('0x178')]=_0x37c279;return ami[_0x7664('0x94')]({'actionid':_0x46b45e,'action':_0x7664('0x152'),'channel':_0x2f3284['isTrunkReachable'](_0x2cf034['Trunk'])?util['format'](_0x7664('0x179'),_0x2cf034[_0x7664('0x85')][_0x7664('0x43')],isNotNull(_0x2cf034[_0x7664('0x17a')])?_0x2cf034[_0x7664('0x17a')][_0x7664('0x17b')]()||'':'',_0x2cf034[_0x7664('0x17c')]>0x0?_0x4cce01[_0x7664('0x153')][_0x7664('0x17d')](_0x2cf034[_0x7664('0x17c')]):_0x4cce01['phone']):util[_0x7664('0x41')](_0x7664('0x179'),_[_0x7664('0xf1')](_0x2cf034[_0x7664('0x86')])?_0x2cf034[_0x7664('0x85')]['name']:_0x2cf034[_0x7664('0x86')][_0x7664('0x43')],isNotNull(_0x2cf034[_0x7664('0x17a')])?_0x2cf034[_0x7664('0x17a')]['trim']()||'':'',_0x2cf034[_0x7664('0x17c')]>0x0?_0x4cce01[_0x7664('0x153')][_0x7664('0x17d')](_0x2cf034[_0x7664('0x17c')]):_0x4cce01['phone']),'callerid':_0x2759a6,'Exten':'xcally-motion-dialer','Context':_0x7664('0x17e'),'Priority':'1','variable':_0x37c279,'timeout':(_0x2cf034[_0x7664('0x17f')]||0x1e)*0x3e8,'async':!![],'channelid':_0x46b45e})[_0x7664('0x9e')](function(_0x3b2023){return _0x1a8e84(_0x3b2023);})[_0x7664('0x9c')](function(_0x4dde65){_0x2cf034[_0x7664('0x180')]+=0x1;var _0x11ee31=new History(_0x2f3284[_0x7664('0x20')][_0x46b45e]);logger[_0x7664('0x64')](util[_0x7664('0x41')](_0x7664('0x181'),JSON[_0x7664('0xfc')](_0x4dde65)));_0x11ee31['state']=0xe;_0x11ee31['statedesc']=_0x7664('0x182');_0x11ee31[_0x7664('0xd8')]=moment()[_0x7664('0x41')](_0x7664('0xbd'));_0x11ee31[_0x7664('0xd9')]=_0x11ee31[_0x7664('0xd8')];hopperUtils[_0x7664('0x123')](_0x11ee31)[_0x7664('0x9c')](loggerCatch('[originate][error]'));_0x2f3284['moveContactManagedDialer'](_0x11ee31)[_0x7664('0x9c')](loggerCatch(_0x7664('0x183')))[_0x7664('0x18')](function(){delete _0x2f3284[_0x7664('0x20')][_0x46b45e];return _0x57e383(msgResponse(_0x7664('0x152'),_0x7664('0x80'),_0x7664('0x184')));});});});};Dialer[_0x7664('0x15')][_0x7664('0x185')]=function(_0x552625,_0x16ffca,_0x3cde0c){var _0x3e0c37=new History(_0x16ffca);if(_0x3e0c37[_0x7664('0x11a')]+_0x3e0c37[_0x7664('0x186')]+_0x3e0c37[_0x7664('0x187')]+_0x3e0c37[_0x7664('0x124')]+_0x3e0c37[_0x7664('0xce')]+_0x3e0c37[_0x7664('0xe0')]+_0x3e0c37[_0x7664('0x118')]+_0x3e0c37[_0x7664('0x11b')]>=_0x3cde0c[_0x7664('0x125')]-0x1){return!![];}switch(_0x552625){case 0x3:if(_0x3e0c37['countnoanswerretry']>=_0x3cde0c['dialNoAnswerMaxRetry']-0x1){return!![];}hopperUtils[_0x7664('0xe2')]({'active':![],'countnoanswerretry':_0x3e0c37['countnoanswerretry']+=0x1,'scheduledat':moment()[_0x7664('0xe3')](_0x3cde0c[_0x7664('0x188')],_0x7664('0xd6'))[_0x7664('0x41')](_0x7664('0xbd')),'ContactId':_0x3e0c37[_0x7664('0xe4')],'ListId':_0x3e0c37[_0x7664('0xe5')],'VoiceQueueId':_0x3e0c37[_0x7664('0xe6')]||undefined,'CampaignId':_0x3e0c37[_0x7664('0xd7')]||undefined})[_0x7664('0x9c')](loggerCatch('[rescheduleContact][NoAnswer]'));break;case 0x5:if(_0x3e0c37[_0x7664('0x11a')]>=_0x3cde0c[_0x7664('0x189')]-0x1){return!![];}hopperUtils[_0x7664('0xe2')]({'active':![],'countbusyretry':_0x3e0c37[_0x7664('0x11a')]+=0x1,'scheduledat':moment()[_0x7664('0xe3')](_0x3cde0c[_0x7664('0x18a')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3e0c37[_0x7664('0xe4')],'ListId':_0x3e0c37[_0x7664('0xe5')],'VoiceQueueId':_0x3e0c37[_0x7664('0xe6')]||undefined,'CampaignId':_0x3e0c37[_0x7664('0xd7')]||undefined})[_0x7664('0x9c')](loggerCatch(_0x7664('0x18b')));break;case 0x8:if(_0x3e0c37[_0x7664('0x186')]>=_0x3cde0c[_0x7664('0x18c')]-0x1){return!![];}hopperUtils[_0x7664('0xe2')]({'active':![],'countcongestionretry':_0x3e0c37[_0x7664('0x186')]+=0x1,'scheduledat':moment()[_0x7664('0xe3')](_0x3cde0c[_0x7664('0x18d')],'minutes')['format']('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3e0c37[_0x7664('0xe4')],'ListId':_0x3e0c37['ListId'],'VoiceQueueId':_0x3e0c37[_0x7664('0xe6')]||undefined,'CampaignId':_0x3e0c37['CampaignId']||undefined})[_0x7664('0x9c')](loggerCatch(_0x7664('0x18e')));break;case 0x0:if(_0x3e0c37[_0x7664('0x124')]>=_0x3cde0c[_0x7664('0x18f')]-0x1){return!![];}else{hopperUtils[_0x7664('0xe2')]({'active':![],'countnosuchnumberretry':_0x3e0c37[_0x7664('0x124')]+=0x1,'scheduledat':moment()[_0x7664('0xe3')](_0x3cde0c[_0x7664('0x190')],_0x7664('0xd6'))[_0x7664('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3e0c37[_0x7664('0xe4')],'ListId':_0x3e0c37[_0x7664('0xe5')],'VoiceQueueId':_0x3e0c37['VoiceQueueId']||undefined,'CampaignId':_0x3e0c37[_0x7664('0xd7')]||undefined})[_0x7664('0x9c')](loggerCatch(_0x7664('0x191')));}break;case 0xa:if(_0x3e0c37[_0x7664('0xce')]>=_0x3cde0c[_0x7664('0x192')]-0x1){return!![];}hopperUtils[_0x7664('0xe2')]({'active':![],'countdropretry':_0x3e0c37['countdropretry']+=0x1,'scheduledat':moment()[_0x7664('0xe3')](_0x3cde0c[_0x7664('0xd0')],_0x7664('0xd6'))[_0x7664('0x41')](_0x7664('0xbd')),'ContactId':_0x3e0c37[_0x7664('0xe4')],'ListId':_0x3e0c37[_0x7664('0xe5')],'VoiceQueueId':_0x3e0c37['VoiceQueueId']||undefined,'CampaignId':_0x3e0c37[_0x7664('0xd7')]||undefined})['catch'](loggerCatch(_0x7664('0x193')));break;case 0xb:if(_0x3e0c37[_0x7664('0xe0')]>=_0x3cde0c[_0x7664('0xe1')]-0x1){return!![];}hopperUtils[_0x7664('0xe2')]({'active':![],'countabandonedretry':_0x3e0c37[_0x7664('0xe0')]+=0x1,'scheduledat':moment()['add'](_0x3cde0c[_0x7664('0xdf')],_0x7664('0xd6'))[_0x7664('0x41')](_0x7664('0xbd')),'ContactId':_0x3e0c37['ContactId'],'ListId':_0x3e0c37[_0x7664('0xe5')],'VoiceQueueId':_0x3e0c37[_0x7664('0xe6')]||undefined,'CampaignId':_0x3e0c37['CampaignId']||undefined})[_0x7664('0x9c')](loggerCatch(_0x7664('0xe7')));break;case 0x13:if(_0x3e0c37[_0x7664('0x118')]>=_0x3cde0c['dialMachineMaxRetry']-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countmachineretry':_0x3e0c37[_0x7664('0x118')]+=0x1,'scheduledat':moment()['add'](_0x3cde0c[_0x7664('0x11f')],_0x7664('0xd6'))[_0x7664('0x41')]('YYYY-MM-DD\x20HH:mm:ss'),'ContactId':_0x3e0c37[_0x7664('0xe4')],'ListId':_0x3e0c37[_0x7664('0xe5')],'VoiceQueueId':_0x3e0c37[_0x7664('0xe6')]||undefined,'CampaignId':_0x3e0c37['CampaignId']||undefined})[_0x7664('0x9c')](loggerCatch(_0x7664('0x120')));break;case 0x14:if(_0x3e0c37['countagentrejectretry']>=_0x3cde0c[_0x7664('0x194')]-0x1){return!![];}hopperUtils['rescheduleContact']({'active':![],'countagentrejectretry':_0x3e0c37[_0x7664('0x11b')]+=0x1,'scheduledat':moment()[_0x7664('0xe3')](_0x3cde0c[_0x7664('0x195')],_0x7664('0xd6'))[_0x7664('0x41')](_0x7664('0xbd')),'ContactId':_0x3e0c37[_0x7664('0xe4')],'ListId':_0x3e0c37[_0x7664('0xe5')],'VoiceQueueId':_0x3e0c37['VoiceQueueId']||undefined,'CampaignId':_0x3e0c37[_0x7664('0xd7')]||undefined})['catch'](loggerCatch(_0x7664('0x196')));break;default:return!![];}};Dialer[_0x7664('0x15')][_0x7664('0x107')]=function(_0x4d8a32,_0x533363,_0xa17ef){var _0x1974ac=this;var _0x1360a9=new History(_0x4d8a32);var _0x37be1f=![];var _0x5da485;var _0x25b767;return new Promise(function(_0xd49fe3,_0x3c1dc4){if(_[_0x7664('0x3b')](_0x533363)&&typeof _0x533363!==_0x7664('0x151')){return _0x3c1dc4(msgResponse(_0x7664('0x197'),'Failure',_0x7664('0x198')));}if(_[_0x7664('0x3b')](_0xa17ef)&&typeof _0xa17ef!=='object'){return _0x3c1dc4(msgResponse(_0x7664('0x197'),'Failure',_0x7664('0x199')));}hopperUtils['verifyAdditionalPhones'](_0x1360a9,_0xa17ef[_0x7664('0xc0')],_0x533363)['then'](function(_0x425aeb){if(_0x425aeb[_0x7664('0xd4')]==0x1)_0x37be1f=!![];switch(_0xa17ef[_0x7664('0xc0')]){case'0':_0x533363[_0x7664('0x19a')]+=0x1;_0x1360a9[_0x7664('0x6c')]=0x0;_0x1360a9[_0x7664('0x6d')]=_0x7664('0x19b');_0x1360a9['countnosuchnumberretry']+=0x1;_0x1360a9['countglobal']+=0x1;ami['emit']('custom:agentnosuchnumber',ut[_0x7664('0x112')](_0x4d8a32,_0x7664('0x19c')));_0x5da485=_0x533363[_0x7664('0x190')];_0x25b767=_0x533363['callAdditionalPhoneAfterMin'];hopperUtils[_0x7664('0x123')](_0x1360a9)[_0x7664('0x9c')](loggerCatch('[syncAgentComplete][createHistory][0]'));if(_0x1974ac[_0x7664('0x185')](0x0,_0x4d8a32,_0x533363)&&!_0x37be1f){if(_0x1360a9[_0x7664('0x124')]>=_0x533363[_0x7664('0x18f')]){_0x1974ac[_0x7664('0x11d')](_0x1360a9,_0xd49fe3,_0x3c1dc4,_0x7664('0x19d'));}else{_0x1974ac[_0x7664('0x126')](_0x1360a9,_0xd49fe3,_0x3c1dc4,'reason\x200\x20no\x20such\x20number....');}}break;case'3':_0x533363['outboundNoAnswerCallsDay']+=0x1;_0x1360a9[_0x7664('0x6c')]=0x3;_0x1360a9[_0x7664('0x6d')]='NoAnswer';_0x1360a9[_0x7664('0x187')]+=0x1;_0x1360a9[_0x7664('0xcf')]+=0x1;var _0x25f9bc=ut[_0x7664('0x19e')](_0x4d8a32,_0x533363);ami[_0x7664('0x3c')](_0x7664('0x19f'),_0x25f9bc);_0x5da485=_0x533363[_0x7664('0x188')];_0x25b767=_0x533363['callAdditionalPhoneAfterMin'];hopperUtils['createHistory'](_0x1360a9)['catch'](loggerCatch(_0x7664('0x1a0')));if(_0x1974ac[_0x7664('0x185')](0x3,_0x4d8a32,_0x533363)&&!_0x37be1f){if(_0x1360a9[_0x7664('0x187')]>=_0x533363[_0x7664('0x1a1')]){_0x1974ac[_0x7664('0x11d')](_0x1360a9,_0xd49fe3,_0x3c1dc4,_0x7664('0x1a2'));}else{_0x1974ac[_0x7664('0x126')](_0x1360a9,_0xd49fe3,_0x3c1dc4,_0x7664('0x1a2'));}}break;case'5':_0x533363[_0x7664('0x1a3')]+=0x1;_0x1360a9['state']=0x5;_0x1360a9[_0x7664('0x6d')]=_0x7664('0x1a4');_0x1360a9['countbusyretry']+=0x1;_0x1360a9['countglobal']+=0x1;ami[_0x7664('0x3c')]('custom:agentbusy',ut['buildObj'](_0x4d8a32,_0x7664('0x1a5')));_0x5da485=_0x533363[_0x7664('0x18a')];_0x25b767=_0x533363[_0x7664('0xd1')];hopperUtils[_0x7664('0x123')](_0x1360a9)[_0x7664('0x9c')](loggerCatch('[syncAgentComplete][createHistory][5]'));if(_0x1974ac[_0x7664('0x185')](0x5,_0x4d8a32,_0x533363)&&!_0x37be1f){if(_0x1360a9['countbusyretry']>=_0x533363[_0x7664('0x189')]){_0x1974ac[_0x7664('0x11d')](_0x1360a9,_0xd49fe3,_0x3c1dc4,'reason\x205\x20busy');}else{_0x1974ac[_0x7664('0x126')](_0x1360a9,_0xd49fe3,_0x3c1dc4,_0x7664('0x1a6'));}}break;case'8':_0x533363[_0x7664('0x1a7')]+=0x1;_0x1360a9[_0x7664('0x6c')]=0x8;_0x1360a9['statedesc']='Congestion';_0x1360a9[_0x7664('0x186')]+=0x1;_0x1360a9[_0x7664('0xcf')]+=0x1;_0x5da485=_0x533363[_0x7664('0x18d')];_0x25b767=_0x533363[_0x7664('0xd1')];ami['emit'](_0x7664('0x1a8'),ut[_0x7664('0x112')](_0x4d8a32,_0x7664('0x1a9')));hopperUtils[_0x7664('0x123')](_0x1360a9)['catch'](loggerCatch(_0x7664('0x1aa')));if(_0x1974ac[_0x7664('0x185')](0x8,_0x4d8a32,_0x533363)&&!_0x37be1f){if(_0x1360a9[_0x7664('0x186')]>=_0x533363[_0x7664('0x18c')]){_0x1974ac[_0x7664('0x11d')](_0x1360a9,_0xd49fe3,_0x3c1dc4,_0x7664('0x1ab'));}else{_0x1974ac['stateGlobal'](_0x1360a9,_0xd49fe3,_0x3c1dc4,'reason\x208\x20congestion');}}break;case'11':_0x533363[_0x7664('0x1ac')]+=0x1;_0x1360a9[_0x7664('0x6c')]=0xb;_0x1360a9[_0x7664('0x6d')]='Abandoned';_0x1360a9[_0x7664('0xe0')]+=0x1;_0x1360a9[_0x7664('0xcf')]+=0x1;_0x5da485=_0x533363[_0x7664('0xdf')];_0x25b767=_0x533363[_0x7664('0xd1')];hopperUtils['createHistory'](_0x1360a9)['catch'](loggerCatch('[syncAgentComplete][createHistory][11]'));if(_0x1974ac['checkRetriveMax'](0xb,_0x4d8a32,_0x533363)&&!_0x37be1f){if(_0x1360a9[_0x7664('0xe0')]>=_0x533363[_0x7664('0xe1')]){_0x1974ac[_0x7664('0x11d')](_0x1360a9,_0xd49fe3,_0x3c1dc4,_0x7664('0x1ad'));}else{_0x1974ac['stateGlobal'](_0x1360a9,_0xd49fe3,_0x3c1dc4,'reason\x2011\x20abandoned');}}break;case'20':_0x533363[_0x7664('0x1ae')]+=0x1;_0x1360a9[_0x7664('0x6c')]=0x14;_0x1360a9[_0x7664('0x6d')]=_0x7664('0x1af');_0x1360a9[_0x7664('0x11b')]+=0x1;_0x1360a9[_0x7664('0xcf')]+=0x1;_0x5da485=_0x533363[_0x7664('0x195')];_0x25b767=_0x533363[_0x7664('0xd1')];ami[_0x7664('0x3c')](_0x7664('0x1b0'),ut[_0x7664('0x112')](_0x4d8a32,_0x7664('0x1b1')));hopperUtils[_0x7664('0x123')](_0x1360a9)[_0x7664('0x9c')](loggerCatch('[syncAgentComplete][createHistory][20]'));if(_0x1974ac['checkRetriveMax'](0x14,_0x4d8a32,_0x533363)&&!_0x37be1f){if(_0x1360a9[_0x7664('0x11b')]>=_0x533363[_0x7664('0x194')]){_0x1974ac[_0x7664('0x11d')](_0x1360a9,_0xd49fe3,_0x3c1dc4,'reason\x2020\x20agentreject');}else{_0x1974ac[_0x7664('0x126')](_0x1360a9,_0xd49fe3,_0x3c1dc4,_0x7664('0x1b2'));}}break;default:_0x533363[_0x7664('0x1b3')]+=0x1;_0x1360a9[_0x7664('0x6c')]=0xc;_0x1360a9[_0x7664('0x6d')]=_0xa17ef[_0x7664('0xc0')];_0x5da485=_0x533363[_0x7664('0x195')];_0x25b767=_0x533363[_0x7664('0xd1')];hopperUtils[_0x7664('0x123')](_0x1360a9)[_0x7664('0x9c')](loggerCatch(_0x7664('0x1b4')));if(_0x1974ac[_0x7664('0x185')](_0xa17ef[_0x7664('0xc0')],_0x4d8a32,_0x533363)&&!_0x37be1f){if(_0x1360a9['countbusyretry']+_0x1360a9[_0x7664('0x186')]+_0x1360a9[_0x7664('0x187')]+_0x1360a9[_0x7664('0x124')]+_0x1360a9['countdropretry']+_0x1360a9[_0x7664('0xe0')]+_0x1360a9[_0x7664('0x118')]+_0x1360a9['countagentrejectretry']>=_0x533363['dialGlobalMaxRetry']){_0x1974ac[_0x7664('0x126')](_0x1360a9,_0xd49fe3,_0x3c1dc4,_0xa17ef[_0x7664('0xc0')]);}else{_0x1974ac[_0x7664('0x11d')](_0x1360a9,_0xd49fe3,_0x3c1dc4,_0xa17ef[_0x7664('0xc0')]);}}}})[_0x7664('0x9e')](function(){if(_0x37be1f){hopperUtils[_0x7664('0xea')](_0x1360a9,_0x5da485,_0x25b767)[_0x7664('0x9e')](function(){return _0xd49fe3(0x1);});}});});};Dialer[_0x7664('0x15')][_0x7664('0x126')]=function(_0x5c23b5,_0x1e3179,_0x45f7ce,_0xfca72e){var _0x3b3490=new Final(_0x5c23b5);_0x3b3490[_0x7664('0x6c')]=0xf;_0x3b3490[_0x7664('0x6d')]=_0x7664('0x1b5');this[_0x7664('0x11d')](_0x3b3490,_0x1e3179,_0x45f7ce,_0xfca72e);};Dialer[_0x7664('0x15')]['createStateFinal']=function(_0x490458,_0x56a80d,_0x41bc7c,_0x22f1c1){hopperUtils['moveContactManagedDialer'](_0x490458)['then'](function(){return _0x56a80d(msgResponse(_0x7664('0x197'),_0x7664('0x1b6'),_0x22f1c1));})[_0x7664('0x9c')](function(){return _0x41bc7c(msgResponse(_0x7664('0x1b7'),_0x7664('0x8c'),'contact\x20not\x20moved'));});};Dialer[_0x7664('0x15')][_0x7664('0xa')]=function(_0x54acb1){var _0xf93181=_0x54acb1[_0x7664('0x1b8')]/0x64;var _0x286a4b=_0x54acb1[_0x7664('0xc8')]/(_0x54acb1['outboundDropCallsDayTimeout']+_0x54acb1[_0x7664('0xbf')]);var _0x4af0da=Math[_0x7664('0x1b9')](_0x54acb1[_0x7664('0x1ba')]*(_0x54acb1['predictiveIntervalMaxThreshold']/0x64));var _0x2e2349=Math[_0x7664('0x1b9')](_0x54acb1[_0x7664('0x1ba')]*(_0x54acb1[_0x7664('0x1bb')]/0x64));var _0x500f1c=_0x54acb1[_0x7664('0x130')]+_0x54acb1['talking'];var _0x45e5f9=Math['floor'](_0x54acb1[_0x7664('0x58')]*_0x54acb1['erlangAbandonmentRate']*_0x54acb1[_0x7664('0x1bc')]*_0x54acb1[_0x7664('0x1bd')]);if(_[_0x7664('0x3b')](_0x54acb1[_0x7664('0x5f')])){if(!_['isUndefined'](_0x54acb1[_0x7664('0x24')])){_0x54acb1[_0x7664('0x24')]=undefined;loggerPredictive[_0x7664('0x64')](_0x7664('0x1be'),_0x7664('0x1bf'));}if(!_[_0x7664('0x3b')](_0x54acb1['handlePredictive'])){loggerPredictive[_0x7664('0x64')]('[startMethodPredictive][StartProgressive]',_0x7664('0x1c0'));clearInterval(_0x54acb1['handlePredictive']);_0x54acb1[_0x7664('0x62')]=undefined;}_0x54acb1[_0x7664('0x5f')]=moment()['format'](_0x7664('0xbd'));loggerPredictive[_0x7664('0x47')](_0x54acb1['name'],_0x7664('0x1c1'),_0x54acb1[_0x7664('0x5f')]);this[_0x7664('0xb1')](_0x54acb1,0x1);}else if(ifInterval(_0x54acb1['dialPredictiveInterval'],_0x54acb1[_0x7664('0x5f')])){this[_0x7664('0xb1')](_0x54acb1,0x1);loggerPredictiveCalls[_0x7664('0x47')]('[startMethodPredictive][StartProgressive][Loop]',_0x54acb1[_0x7664('0x5f')],_0x54acb1[_0x7664('0x43')]);_0x54acb1[_0x7664('0x58')]=0x0;_0x54acb1[_0x7664('0xc9')]=0x0;}else if(_0xf93181<_0x286a4b&&_0x54acb1[_0x7664('0x1c2')]===_0x7664('0x1c3')){clearPredictiveAttributes(_0x54acb1);loggerPredictive[_0x7664('0x47')]('[stopMethodPredictive][ReStartProgressive][ExceededDropDay]',_0x7664('0x1c4'),_0x286a4b,'startProgressive',_0x54acb1['name']);}else if(_0x45e5f9<_0x54acb1['predictiveIntervalErlangCallsDroppedCalls']&&_0x54acb1['dialPredictiveOptimization']===_0x7664('0x1c3')){clearPredictiveAttributes(_0x54acb1);loggerPredictive[_0x7664('0x47')]('[stopMethodPredictive][ReStartProgressive][ExceededDropInterval]',_0x7664('0x1c5'),_0x45e5f9,_0x7664('0x1c6'),_0x54acb1[_0x7664('0xc9')],_0x7664('0x5f'),_0x54acb1[_0x7664('0x43')]);}else if(!ifInterval(_0x54acb1[_0x7664('0x1c7')],_0x54acb1[_0x7664('0x5f')])&&_[_0x7664('0x3b')](_0x54acb1[_0x7664('0x24')])&&!_[_0x7664('0x3b')](_0x54acb1[_0x7664('0x5f')])){_0x54acb1[_0x7664('0x24')]=moment()['format'](_0x7664('0xbd'));loggerPredictive[_0x7664('0x47')](_0x54acb1[_0x7664('0x43')],'started\x20in\x20predictive\x20at',_0x54acb1[_0x7664('0x24')]);hopperUtils[_0x7664('0x1c8')](_0x54acb1[_0x7664('0x1c7')])['then'](this[_0x7664('0x1c9')](_0x54acb1))[_0x7664('0x9e')](mergeDataErlangB(_0x54acb1))['then'](this[_0x7664('0x1ca')](_0x54acb1))[_0x7664('0x9c')](loggerCatchPredictive('Predictive\x20after\x20first\x20interval',_0x54acb1));}else if(!ifInterval(_0x54acb1[_0x7664('0x1c7')],_0x54acb1[_0x7664('0x24')])){_0x54acb1[_0x7664('0xc9')]=0x0;_0x54acb1['startPredictive']=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');loggerPredictive[_0x7664('0x47')](_0x54acb1[_0x7664('0x43')],_0x7664('0x1cb'),_0x54acb1['startPredictive']);clearInterval(_0x54acb1[_0x7664('0x62')]);_0x54acb1[_0x7664('0x62')]=undefined;hopperUtils[_0x7664('0x1c8')](_0x54acb1[_0x7664('0x1c7')])[_0x7664('0x9e')](this[_0x7664('0x1c9')](_0x54acb1))[_0x7664('0x9e')](mergeDataErlangB(_0x54acb1))[_0x7664('0x9e')](this[_0x7664('0x1ca')](_0x54acb1))['catch'](loggerCatchPredictive('Predictive\x20for\x20every\x20interval',_0x54acb1));}else if(_0x54acb1[_0x7664('0x1ba')]&&_0x500f1c<_0x54acb1[_0x7664('0x1ba')]-_0x2e2349){clearPredictiveAttributes(_0x54acb1);loggerPredictive[_0x7664('0x47')](_0x54acb1[_0x7664('0x43')],_0x7664('0x1cc'),_0x500f1c,_0x7664('0x1cd'),_0x54acb1[_0x7664('0x1ba')],'-',_0x2e2349,'=',_0x54acb1[_0x7664('0x1ba')]-_0x2e2349,')');}else if(_0x54acb1['predictiveIntervalAvailable']&&_0x500f1c>_0x54acb1['predictiveIntervalAvailable']+_0x4af0da){clearPredictiveAttributes(_0x54acb1);loggerPredictive[_0x7664('0x47')](_0x54acb1[_0x7664('0x43')],_0x7664('0x1cc'),_0x500f1c,')\x20are\x20more\x20than\x20threshold\x20(',_0x54acb1[_0x7664('0x1ba')],'+',_0x4af0da,'=',_0x54acb1[_0x7664('0x1ba')]+_0x4af0da,')');}};Dialer['prototype'][_0x7664('0x1c9')]=function(_0x3cfc68){var _0x39dfef=this;return function(_0xe825ce){return new Promise(function(_0x51b1cf,_0x4a58de){_[_0x7664('0x5d')](_0x3cfc68,_0xe825ce[0x0]);if(checkGetDataPredictive(_0xe825ce[0x0])){var _0x39cd16=_0x3cfc68[_0x7664('0x1ba')]=_0x3cfc68[_0x7664('0x132')]+_0x3cfc68[_0x7664('0x130')];var _0x1cbee3=_0x3cfc68[_0x7664('0x1c7')]*0x3c;var _0x305234=_0xe825ce[0x0][_0x7664('0x50')]+_0xe825ce[0x0]['predictiveIntervalAvgHoldtime'];var _0x2ca100=(_0xe825ce[0x0][_0x7664('0x4a')]+_0xe825ce[0x0][_0x7664('0x4c')]+_0xe825ce[0x0]['predictiveIntervalDroppedCallsCallersExit'])/_0xe825ce[0x0][_0x7664('0x48')];_0x3cfc68[_0x7664('0x1bc')]=_0x2ca100>0x0?_0x2ca100:0x1;switch(_0x3cfc68['dialPredictiveOptimization']){case _0x7664('0x1c3'):var _0x34104b=_0x3cfc68[_0x7664('0x1b8')]/0x64;return _0x39dfef[_0x7664('0x1ce')](_0x39cd16,_0x1cbee3,_0x305234,_0x2ca100,_0x34104b)[_0x7664('0x9e')](function(_0x5d1d22){return _0x51b1cf(_0x5d1d22);});case _0x7664('0x1cf'):var _0x325d78=_0x3cfc68[_0x7664('0x1b8')]/0x64;return _0x39dfef[_0x7664('0x1d0')](_0x39cd16,_0x1cbee3,_0x305234,_0x2ca100,_0x325d78)[_0x7664('0x9e')](function(_0x204cd4){return _0x51b1cf(_0x204cd4);});default:return _0x4a58de(msgResponse(_0x7664('0x1d1'),_0x7664('0x8c'),_0x7664('0x1d2')));}}else{return _0x4a58de(msgResponse(_0x7664('0x1d1'),_0x7664('0x8c'),_0x7664('0x1d3')));}});};};Dialer[_0x7664('0x15')]['getDataPredictiveOld']=function(_0x15bbb0){var _0x55aaa5=this;return function(_0x33c63f){return new Promise(function(_0x920798,_0x995007){_[_0x7664('0x5d')](_0x15bbb0,_0x33c63f[0x0]);if(checkGetDataPredictive(_0x33c63f[0x0])){loggerPredictive[_0x7664('0x47')](JSON[_0x7664('0xfc')](_0x33c63f[0x0]));if(_0x15bbb0['dialPredictiveOptimization']===_0x7664('0x1c3')){return _0x55aaa5[_0x7664('0x146')](_0x15bbb0['id'])[_0x7664('0x9e')](function(_0x1f4e7c){var _0x42c39d=_0x15bbb0[_0x7664('0x1d4')]-_0x1f4e7c[0x0][_0x7664('0x1d5')];var _0x2cde6b=_0x15bbb0[_0x7664('0x1c7')]*0x3c;var _0x378351=_0x33c63f[0x0][_0x7664('0x50')]+_0x33c63f[0x0][_0x7664('0x4f')];var _0x5bf082=(_0x33c63f[0x0]['predictiveIntervalAnsweredCalls']+_0x33c63f[0x0]['predictiveIntervalDroppedCallsTimeout']+_0x33c63f[0x0][_0x7664('0xdc')])/_0x33c63f[0x0][_0x7664('0x48')];var _0x34fe08=_0x15bbb0[_0x7664('0x1b8')]/0x64;_0x15bbb0['predictiveIntervalPauses']=_0x1f4e7c[0x0][_0x7664('0x1d5')]||0x0;_0x15bbb0[_0x7664('0x1bc')]=_0x5bf082>0x0?_0x5bf082:0x1;return _0x55aaa5['abandonmentRate'](_0x42c39d,_0x2cde6b,_0x378351,_0x5bf082,_0x34fe08);})[_0x7664('0x9e')](function(_0x28ce90){return _0x920798(_0x28ce90);})[_0x7664('0x9c')](function(_0x141ae5){return _0x995007(msgResponse(_0x7664('0x1d6'),_0x7664('0x8c'),JSON[_0x7664('0xfc')](_0x141ae5)));});}if(_0x15bbb0[_0x7664('0x1c2')]===_0x7664('0x1cf')){return _0x55aaa5['getVoiceQueueRtPauses'](_0x15bbb0['id'])[_0x7664('0x9e')](function(_0x12f3e2){var _0x28616d=_0x15bbb0[_0x7664('0x1d4')]-_0x12f3e2[0x0][_0x7664('0x1d5')];var _0x42050d=_0x15bbb0['dialPredictiveInterval']*0x3c;var _0x1f5a5f=_0x33c63f[0x0][_0x7664('0x50')]+_0x33c63f[0x0][_0x7664('0x4f')];var _0x3b1ded=(_0x33c63f[0x0][_0x7664('0x4a')]+_0x33c63f[0x0][_0x7664('0x4c')]+_0x33c63f[0x0][_0x7664('0xdc')])/_0x33c63f[0x0]['predictiveIntervalTotalCalls'];var _0x67e342=_0x15bbb0[_0x7664('0x1b8')]/0x64;_0x15bbb0[_0x7664('0x1d7')]=_0x12f3e2[0x0][_0x7664('0x1d5')]||0x0;_0x15bbb0[_0x7664('0x1bc')]=_0x3b1ded>0x0?_0x3b1ded:0x1;return _0x55aaa5[_0x7664('0x1d0')](_0x28616d,_0x42050d,_0x1f5a5f,_0x3b1ded,_0x67e342);})[_0x7664('0x9e')](function(_0x2f0934){return _0x920798(_0x2f0934);})[_0x7664('0x9c')](function(_0x16fa51){return _0x995007(msgResponse(_0x7664('0x1d6'),_0x7664('0x8c'),JSON[_0x7664('0xfc')](_0x16fa51)));});}}else{return _0x995007(msgResponse(_0x7664('0x1d1'),_0x7664('0x8c'),'check\x20failure'));}});};};Dialer[_0x7664('0x15')][_0x7664('0x1ca')]=function(_0x4955cc){var _0x2edc8a=this;return function(){var _0x4f433d=0x0;var _0x3d0a4c=Math['floor'](_0x4955cc[_0x7664('0x59')]*0x3e8);if(_0x3d0a4c>0x0){_0x3d0a4c=_0x3d0a4c<0x64?0x64:_0x3d0a4c;loggerPredictive['info'](_0x4955cc[_0x7664('0x43')],_0x7664('0x1d8'),_0x3d0a4c,'milliseconds');_0x4955cc['handlePredictive']=setInterval(function(){_0x2edc8a[_0x7664('0x62')](_0x4955cc);loggerPredictiveCalls[_0x7664('0x47')]('[handlePredictive]',_0x4f433d+=0x1);},_0x3d0a4c);}else{loggerPredictive[_0x7664('0x47')](_0x4955cc['name'],_0x7664('0x1d9'));}};};Dialer['prototype'][_0x7664('0x1da')]=function(_0x3d39ff,_0x5e82b){var _0x2073af=this;return function(_0x51b88a){if(_['isEmpty'](_0x51b88a)){if(_['isNil'](_0x5e82b[_0x7664('0x14b')])||!_0x5e82b[_0x7664('0x1db')]){if(_0x3d39ff['dialMethod']===_0x7664('0x9')){_0x3d39ff[_0x7664('0x6e')]=_['isUndefined'](_0x3d39ff[_0x7664('0x6e')])?!![]:_0x3d39ff[_0x7664('0x6e')];var _0x4827bc=uuid['v4']();_0x2073af['actions'][_0x4827bc]=new Action(_0x3d39ff,_0x5e82b,_0x4827bc);loggerBooked[_0x7664('0x47')]('[booked][checkContactBlack]',_0x4827bc,'queueStatusComplete:\x20',JSON[_0x7664('0xfc')](_0x3d39ff[_0x7664('0x6e')]),_0x7664('0x1dc'),_0x3d39ff['name']);if(_0x3d39ff[_0x7664('0x6e')]){_0x3d39ff[_0x7664('0x6e')]=![];_0x2073af['queueBooked'][_0x2073af['actions'][_0x4827bc][_0x7664('0xb9')]]=[];ami['Action']({'actionid':_0x4827bc,'action':_0x7664('0x1dd'),'queue':_0x3d39ff[_0x7664('0x43')]})[_0x7664('0x9c')](function(){_0x2073af['updateOriginated'](_0x3d39ff);hopperUtils[_0x7664('0xe2')]({'active':![],'ContactId':_0x2073af['actions'][_0x4827bc][_0x7664('0xe4')],'ListId':_0x2073af['actions'][_0x4827bc][_0x7664('0xe5')],'VoiceQueueId':_0x2073af[_0x7664('0x20')][_0x4827bc][_0x7664('0xe6')]||undefined,'CampaignId':_0x2073af[_0x7664('0x20')][_0x4827bc][_0x7664('0xd7')]||undefined})[_0x7664('0x9c')](loggerCatch(_0x7664('0x1de')));delete _0x2073af['actions'][_0x4827bc];});}else{loggerBooked[_0x7664('0x47')](_0x7664('0x1df'),JSON[_0x7664('0xfc')](_0x3d39ff[_0x7664('0x6e')]),_0x7664('0x1dc'),_0x3d39ff[_0x7664('0x43')]);_0x2073af[_0x7664('0xbb')](_0x3d39ff);hopperUtils[_0x7664('0xe2')]({'active':![],'ContactId':_0x2073af[_0x7664('0x20')][_0x4827bc][_0x7664('0xe4')],'ListId':_0x2073af[_0x7664('0x20')][_0x4827bc][_0x7664('0xe5')],'VoiceQueueId':_0x2073af[_0x7664('0x20')][_0x4827bc][_0x7664('0xe6')]||undefined,'CampaignId':_0x2073af[_0x7664('0x20')][_0x4827bc][_0x7664('0xd7')]||undefined})['catch'](loggerCatch('[unlockOriginate][syncQueueStatusComplete]'));delete _0x2073af[_0x7664('0x20')][_0x4827bc];}}else{return _0x2073af['actionOriginate'](_0x3d39ff,_0x5e82b);}}else{if(utils[_0x7664('0x5e')](undefined,_0x5e82b[_0x7664('0x1e0')])<_0x3d39ff[_0x7664('0x1e1')]*0x3c){if(_0x5e82b[_0x7664('0x1e2')]&&!_0x5e82b['Agent'][_0x7664('0x1e3')]){_0x2073af[_0x7664('0xf3')][_0x7664('0xf4')](_0x5e82b['id'])[_0x7664('0x18')](function(){_0x2073af['updateOriginated'](_0x3d39ff);});}else{hopperUtils[_0x7664('0x1e4')]({'active':![]},_0x5e82b['id'],0x1)[_0x7664('0x18')](function(){_0x2073af['updateOriginated'](_0x3d39ff);});}}else{_0x3d39ff[_0x7664('0x1e5')]+=0x1;_0x2073af[_0x7664('0xbb')](_0x3d39ff);if(_0x3d39ff[_0x7664('0x1e6')]){hopperUtils[_0x7664('0xe2')]({'active':![],'recallme':![],'UserId':null,'ContactId':_0x5e82b['ContactId'],'ListId':_0x5e82b['ListId'],'VoiceQueueId':_0x5e82b[_0x7664('0xe6')]||undefined,'CampaignId':_0x5e82b[_0x7664('0xd7')]||undefined})[_0x7664('0x9c')](loggerCatch('[rescheduleContact][dialRecallInQueue]'));hopperUtils[_0x7664('0x123')](createObjHistory(_0x3d39ff,_0x5e82b,utils[_0x7664('0x68')]['QUEUE_RECALL'],0x17,_0x7664('0x1e7')))[_0x7664('0x9c')](loggerCatch('[Originate][HistoryDialRecallInQueue][historyCatch]'));}else{_0x2073af[_0x7664('0x121')](createObjHistory(_0x3d39ff,_0x5e82b,utils[_0x7664('0x68')][_0x7664('0x1e8')],0x16,_0x7664('0x1e9')),'[Originate][HistoryRecallClose][historyCatch]',_0x7664('0x1ea'));}}}}else{_0x3d39ff[_0x7664('0x1eb')]+=0x1;_0x2073af[_0x7664('0x121')](createObjHistory(_0x3d39ff,_0x5e82b,utils['CAMPAIGN_STATUS'][_0x7664('0x1ec')],0xd,_0x7664('0x1ed')),_0x7664('0x1ee'),'[Originate][MoveBlacklist]');throw _0x7664('0x1ef');}};};Dialer['prototype'][_0x7664('0x14f')]=function(_0x1868cb){var _0x474ce4=this;var _0x550675=_0x1868cb[_0x7664('0x1f0')]-_0x1868cb[_0x7664('0x7c')]-_0x1868cb[_0x7664('0x1f1')];emitCampaignSummary(_0x1868cb);if(_0x550675>0x0){if(_0x550675>this[_0x7664('0x1e')]){_0x550675=this['maxNumberOriginate'];}_0x1868cb['temp']+=_0x550675;hopperUtils['getContactDialerIvr'](_0x1868cb,_0x550675)[_0x7664('0x9e')](function(_0xf3ef74){_0x1868cb[_0x7664('0x1f1')]-=_0x550675;_0x1868cb[_0x7664('0x1f1')]=_0x1868cb['temp']>0x0?_0x1868cb['temp']:0x0;if(!utils[_0x7664('0x1f2')](_0xf3ef74)){_0x1868cb[_0x7664('0x67')]=utils[_0x7664('0x68')]['NO_AVAILABLE_CONTACTS'];logger['info']('[getContactCampaign2][Empty]'+_0x1868cb['name']);}else{_0x1868cb[_0x7664('0x7c')]+=_0xf3ef74['length'];_0x1868cb[_0x7664('0x67')]=utils[_0x7664('0x68')][_0x7664('0x1f3')];for(var _0x5e5cad=0x0;_0x5e5cad<_0xf3ef74[_0x7664('0x92')];_0x5e5cad+=0x1){_0x1868cb['ivrTotalCallsDays']+=0x1;if(_[_0x7664('0xf1')](_0xf3ef74[_0x5e5cad])||_[_0x7664('0xf1')](_0xf3ef74[_0x5e5cad]['Contact'])||_[_0x7664('0xf1')](_0xf3ef74[_0x5e5cad][_0x7664('0x153')])){_0x474ce4['emptyContact'](_0x7664('0x1f4'),_0x1868cb,_0xf3ef74[_0x5e5cad]);}else{hopperUtils[_0x7664('0x1f5')](_[_0x7664('0x71')](_0xf3ef74[_0x5e5cad],['CampaignId',_0x7664('0x153')]))[_0x7664('0x9e')](_0x474ce4[_0x7664('0x1da')](_0x1868cb,_0xf3ef74[_0x5e5cad]))[_0x7664('0x9c')](_0x474ce4['loggerHandler']('[actionOriginateIvr]\x20',_0x1868cb));}}}})[_0x7664('0x9c')](loggerGetContactDialer(_0x7664('0x1f6'),_0x1868cb,_0x550675));}};Dialer[_0x7664('0x15')][_0x7664('0xb1')]=function(_0x5b1bad,_0x2180ac){var _0x3f1665=this;var _0x4866a4=[];if(_0x2180ac<0x1||_0x5b1bad[_0x7664('0xaf')]===_0x7664('0x9')){_0x2180ac=0x1;}var _0x338ff9=Math['floor'](_0x5b1bad[_0x7664('0x130')]*_0x2180ac)-_0x5b1bad[_0x7664('0x7c')]-_0x5b1bad['temp'];if(_0x5b1bad[_0x7664('0x1f7')]>0x0){var _0x54e4c2=_0x5b1bad[_0x7664('0x1f7')]-_0x5b1bad[_0x7664('0x7c')]-_0x5b1bad[_0x7664('0x132')]-_0x5b1bad['temp']-_0x5b1bad[_0x7664('0x1f8')];if(_0x338ff9>_0x54e4c2){_0x338ff9=_0x54e4c2;}}if(_0x338ff9>0x0){if(_0x5b1bad['dialMethod']===_0x7664('0x9')){_0x338ff9=0x1;}if(_0x338ff9>this[_0x7664('0x1e')]){_0x338ff9=this['maxNumberOriginate'];}_0x5b1bad[_0x7664('0x1f1')]+=_0x338ff9;for(var _0x7565b6 in this[_0x7664('0x1c')]){if(typeof this[_0x7664('0x1c')][_0x7565b6]!==_0x7664('0xa9')){if(this[_0x7664('0x1c')][_0x7565b6][_0x7664('0x6c')]==='not_inuse'&&this[_0x7664('0x1c')][_0x7565b6][_0x7664('0x82')]===_0x7664('0x13c')){_0x4866a4['push'](this['agents'][_0x7565b6]['id']);}}}hopperUtils['getContactDialer'](_0x5b1bad,_0x4866a4,_0x338ff9)['then'](function(_0x36eee0){_0x5b1bad['temp']-=_0x338ff9;_0x5b1bad[_0x7664('0x1f1')]=_0x5b1bad[_0x7664('0x1f1')]>0x0?_0x5b1bad[_0x7664('0x1f1')]:0x0;if(!utils[_0x7664('0x1f2')](_0x36eee0)){hopperUtils[_0x7664('0x1f9')](_0x5b1bad)[_0x7664('0x9e')](sendMessageReschedule(_0x5b1bad))[_0x7664('0x9c')](loggerCatch('[countReScheduled]\x20'));}else{_0x5b1bad['originated']+=_0x36eee0[_0x7664('0x92')];_0x5b1bad[_0x7664('0x67')]=_0x5b1bad[_0x7664('0xaf')]===_0x7664('0x9')?utils['CAMPAIGN_STATUS'][_0x7664('0x133')]:utils[_0x7664('0x68')][_0x7664('0x1f3')];for(var _0x4973d5=0x0;_0x4973d5<_0x36eee0['length'];_0x4973d5+=0x1){if(_[_0x7664('0xf1')](_0x36eee0[_0x4973d5])||_[_0x7664('0xf1')](_0x36eee0[_0x4973d5]['Contact'])||_['isNil'](_0x36eee0[_0x4973d5][_0x7664('0x153')])){_0x3f1665[_0x7664('0x149')]('[actionOriginate]\x20',_0x5b1bad,_0x36eee0[_0x4973d5]);}else{hopperUtils[_0x7664('0x1fa')](_[_0x7664('0x71')](_0x36eee0[_0x4973d5],['VoiceQueueId',_0x7664('0x153')]))[_0x7664('0x9e')](_0x3f1665['checkContactBlack'](_0x5b1bad,_0x36eee0[_0x4973d5]))[_0x7664('0x9c')](_0x3f1665[_0x7664('0x1fb')](_0x7664('0x1f4'),_0x5b1bad));}}}})[_0x7664('0x9c')](loggerGetContactDialer(_0x7664('0x1fc'),_0x5b1bad,_0x338ff9));}};Dialer[_0x7664('0x15')][_0x7664('0x62')]=function(_0x435aad){if(_0x435aad['dialLimitQueue']>0x0){var _0x281d55=_0x435aad['dialLimitQueue']-_0x435aad['originated']-_0x435aad[_0x7664('0x132')];if(_0x281d55>0x0){this[_0x7664('0x1fd')](_0x435aad);}else{loggerPredictiveCalls[_0x7664('0x47')](_0x7664('0x1fe'));}}else{this[_0x7664('0x1fd')](_0x435aad);}};Dialer[_0x7664('0x15')]['tryOriginatePredictive']=function(_0x4ca2a){var _0x1d3a8e=this;var _0x25f8cb=[];_0x4ca2a[_0x7664('0x7c')]+=0x1;for(var _0x26288f in this[_0x7664('0x1c')]){if(typeof this[_0x7664('0x1c')][_0x26288f]!==_0x7664('0xa9')){if(this['agents'][_0x26288f]['state']===_0x7664('0x1ff')&&this[_0x7664('0x1c')][_0x26288f][_0x7664('0x82')]===_0x7664('0x13c')){_0x25f8cb['push'](this[_0x7664('0x1c')][_0x26288f]['id']);}}}return this['getContactDialer'](_0x4ca2a['id'],_0x25f8cb,0x1,_0x4ca2a[_0x7664('0x200')],_0x4ca2a)['then'](function(_0x163c91){if(!utils[_0x7664('0x1f2')](_0x163c91)){utils[_0x7664('0x201')](_0x4ca2a,0x1,0x0);return hopperUtils['countReScheduled'](_0x4ca2a)[_0x7664('0x9e')](sendMessageReschedule(_0x4ca2a))[_0x7664('0x9c')](loggerCatch('[countReScheduled]\x20'));}else{_0x4ca2a[_0x7664('0x67')]=utils[_0x7664('0x68')][_0x7664('0x1f3')];if(_[_0x7664('0xf1')](_0x163c91[0x0])||_[_0x7664('0xf1')](_0x163c91[0x0][_0x7664('0x167')])||_[_0x7664('0xf1')](_0x163c91[0x0][_0x7664('0x153')])){_0x1d3a8e[_0x7664('0x149')](_0x7664('0x1f4'),_0x4ca2a,_0x163c91[0x0]);}else{return hopperUtils[_0x7664('0x1fa')](_[_0x7664('0x71')](_0x163c91[0x0],[_0x7664('0xe6'),'phone']))[_0x7664('0x9e')](_0x1d3a8e['checkContactBlack'](_0x4ca2a,_0x163c91[0x0]))[_0x7664('0x9c')](_0x1d3a8e[_0x7664('0x1fb')](_0x7664('0x202'),_0x4ca2a));}}})[_0x7664('0x9c')](loggerGetContactDialer(_0x7664('0x203'),_0x4ca2a,0x1));};Dialer[_0x7664('0x15')][_0x7664('0x1ce')]=function(_0x474958,_0x50270e,_0x5adc2c,_0x1af27b,_0x19b6d2,_0x2e2964){loggerPredictive[_0x7664('0x47')](_0x7664('0x204'));loggerPredictive[_0x7664('0x47')](_0x7664('0x205'),_0x474958);loggerPredictive[_0x7664('0x47')]('Interval:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x50270e);loggerPredictive[_0x7664('0x47')](_0x7664('0x206'),_0x5adc2c);loggerPredictive[_0x7664('0x47')](_0x7664('0x207'),_0x1af27b);loggerPredictive[_0x7664('0x47')]('Amax:\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20\x20',_0x19b6d2);loggerPredictive[_0x7664('0x47')](_0x7664('0x51'));return new Promise(function(_0x399786,_0x3c058f){if(_0x474958<=0x0||isNaN(_0x474958)){return _0x3c058f(msgResponse('[abandonmentRate]','Error','m\x20=\x20'+_0x474958));}if(_0x5adc2c<=0x0||isNaN(_0x5adc2c)){return _0x3c058f(msgResponse(_0x7664('0x208'),_0x7664('0x80'),_0x7664('0x209')+_0x5adc2c));}if(_0x1af27b<=0x0||isNaN(_0x1af27b)){return _0x3c058f(msgResponse(_0x7664('0x208'),_0x7664('0x80'),_0x7664('0x20a')+_0x1af27b));}if(_0x50270e<=0x0||isNaN(_0x50270e)){return _0x3c058f(msgResponse(_0x7664('0x208'),'Error',_0x7664('0x20b')+_0x50270e));}if(_0x19b6d2<=0x0||isNaN(_0x19b6d2)){return _0x3c058f(msgResponse('[abandonmentRate]',_0x7664('0x80'),_0x7664('0x20c')+_0x19b6d2));}_0x2e2964=_0x2e2964||0x0;var _0x2aa15d=0x1/_0x5adc2c;var _0x1fa518=0x0;var _0x42a1e8=0x0;var _0x24da12=0x0;var _0x182680=0x0;for(var _0x1a0182=0x0;_0x24da12<_0x19b6d2;_0x1a0182+=0x1){_0x42a1e8=_0x1a0182/_0x50270e;_0x1fa518=(_0x1af27b*_0x42a1e8+_0x2e2964)/_0x2aa15d;_0x24da12=utils['erlangb'](_0x1fa518,_0x474958);_0x182680=_0x1fa518/_0x474958*(0x1-utils[_0x7664('0x20d')](_0x1fa518,_0x474958));}return _0x399786({'erlangCalls':_0x1a0182,'erlangCallToSecond':_0x50270e/_0x1a0182,'erlangAbandonmentRate':_0x24da12,'erlangBusyFactor':_0x182680});});};Dialer['prototype'][_0x7664('0x1d0')]=function(_0x13ceec,_0x346a29,_0x5e9073,_0x219d71,_0x155edd,_0x57c017){loggerPredictive[_0x7664('0x47')](_0x7664('0x20e'));loggerPredictive[_0x7664('0x47')](_0x7664('0x205'),_0x13ceec);loggerPredictive[_0x7664('0x47')](_0x7664('0x20f'),_0x346a29);loggerPredictive['info'](_0x7664('0x206'),_0x5e9073);loggerPredictive[_0x7664('0x47')](_0x7664('0x207'),_0x219d71);loggerPredictive['info'](_0x7664('0x210'),_0x155edd);loggerPredictive[_0x7664('0x47')](_0x7664('0x51'));return new Promise(function(_0x4b439f,_0x4c9221){if(_0x13ceec<=0x0||isNaN(_0x13ceec)){return _0x4c9221(msgResponse(_0x7664('0x211'),_0x7664('0x80'),'m\x20=\x20'+_0x13ceec));}if(_0x5e9073<=0x0||isNaN(_0x5e9073)){return _0x4c9221(msgResponse(_0x7664('0x211'),'Error',_0x7664('0x209')+_0x5e9073));}if(_0x219d71<=0x0||isNaN(_0x219d71)){return _0x4c9221(msgResponse(_0x7664('0x211'),'Error',_0x7664('0x20a')+_0x219d71));}if(_0x346a29<=0x0||isNaN(_0x346a29)){return _0x4c9221(msgResponse('[busyFactor]',_0x7664('0x80'),'interval\x20=\x20'+_0x346a29));}if(_0x155edd<=0x0||isNaN(_0x155edd)){return _0x4c9221(msgResponse('[busyFactor]',_0x7664('0x80'),_0x7664('0x212')+_0x155edd));}_0x57c017=_0x57c017||0x0;var _0x5714d4=0x1/_0x5e9073;var _0x2c1079=0x0;var _0x4c4979=0x0;var _0xe19ec=0x0;var _0x28b5b8=0x0;for(var _0x2f90d9=0x0;_0x28b5b8<_0x155edd;_0x2f90d9+=0x1){_0x4c4979=_0x2f90d9/_0x346a29;_0x2c1079=(_0x219d71*_0x4c4979+_0x57c017)/_0x5714d4;_0xe19ec=utils[_0x7664('0x20d')](_0x2c1079,_0x13ceec);_0x28b5b8=_0x2c1079/_0x13ceec*(0x1-utils[_0x7664('0x20d')](_0x2c1079,_0x13ceec));}return _0x4b439f({'erlangCalls':_0x2f90d9,'erlangCallToSecond':_0x346a29/_0x2f90d9,'erlangAbandonmentRate':_0xe19ec,'erlangBusyFactor':_0x28b5b8});});};module[_0x7664('0x213')]=Dialer; \ No newline at end of file diff --git a/server/services/ami/dialer/models/action.js b/server/services/ami/dialer/models/action.js index 449fee6..4b88226 100644 --- a/server/services/ami/dialer/models/action.js +++ b/server/services/ami/dialer/models/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x2cb1=['recallme','originatecalleridnum','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','substring','getQueue','exports','util','isNil','string','voiceQueue','uniqueid','name','Contact','phone','number','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','firstName','format','YYYY-MM-DD\x20HH:mm:ss','callback','callbackuniqueid'];(function(_0x2a9d3b,_0x492bb6){var _0x11883c=function(_0x2373ff){while(--_0x2373ff){_0x2a9d3b['push'](_0x2a9d3b['shift']());}};_0x11883c(++_0x492bb6);}(_0x2cb1,0x136));var _0x12cb=function(_0x1ff80f,_0xfc057f){_0x1ff80f=_0x1ff80f-0x0;var _0x464b25=_0x2cb1[_0x1ff80f];return _0x464b25;};'use strict';var util=require(_0x12cb('0x0'));var _=require('lodash');var moment=require('moment');function checkNameSurname(_0x10e895,_0x35b755,_0x323d58){var _0x2495d6='';if(!_[_0x12cb('0x1')](_0x35b755)&&_0x12cb('0x2')===typeof _0x35b755){_0x2495d6+=_0x35b755;}if(!_['isNil'](_0x323d58)&&'string'===typeof _0x323d58){_0x2495d6+='\x20'+_0x323d58;}if(_0x2495d6!==''){return _0x2495d6;}return _0x10e895;}function Action(_0x5161e4,_0x3797d3,_0x2fcce5){this[_0x12cb('0x3')]=_0x5161e4;this[_0x12cb('0x4')]=_0x2fcce5||undefined;this[_0x12cb('0x5')]=checkNameSurname(_0x3797d3[_0x12cb('0x6')][_0x12cb('0x7')],_0x3797d3[_0x12cb('0x6')]['firstName'],_0x3797d3[_0x12cb('0x6')]['lastName']);this[_0x12cb('0x8')]=_0x3797d3[_0x12cb('0x7')];this[_0x12cb('0x9')]=_0x5161e4[_0x12cb('0x5')];this[_0x12cb('0xa')]=_0x3797d3[_0x12cb('0xa')]||![];this[_0x12cb('0xb')]=_0x5161e4['type'];this[_0x12cb('0xc')]=_0x5161e4[_0x12cb('0xc')]||0x3;this[_0x12cb('0xd')]=_0x3797d3[_0x12cb('0xd')];this[_0x12cb('0xe')]=_0x3797d3['countbusyretry'];this[_0x12cb('0xf')]=_0x3797d3[_0x12cb('0xf')];this[_0x12cb('0x10')]=_0x3797d3[_0x12cb('0x10')];this['countnosuchnumberretry']=_0x3797d3[_0x12cb('0x11')];this[_0x12cb('0x12')]=_0x3797d3['countdropretry'];this[_0x12cb('0x13')]=_0x3797d3[_0x12cb('0x13')];this[_0x12cb('0x14')]=_0x3797d3[_0x12cb('0x14')];this[_0x12cb('0x15')]=_0x3797d3[_0x12cb('0x15')];this[_0x12cb('0x16')]=_0x3797d3['ContactId'];this[_0x12cb('0x17')]=_0x3797d3['ListId'];this['UserId']=_0x3797d3[_0x12cb('0x18')];this[_0x12cb('0x19')]=_0x3797d3['VoiceQueueId'];this['CampaignId']=_0x3797d3[_0x12cb('0x1a')];this[_0x12cb('0x1b')]=_0x3797d3['id'];this[_0x12cb('0x1c')]=_0x3797d3[_0x12cb('0x6')][_0x12cb('0x1d')]||'';this['starttime']=moment()[_0x12cb('0x1e')](_0x12cb('0x1f'));this[_0x12cb('0x20')]=_0x3797d3['callback'];this[_0x12cb('0x21')]=_0x3797d3['callbackuniqueid'];this['callbackat']=_0x3797d3['callbackat'];this[_0x12cb('0x22')]=_0x3797d3[_0x12cb('0x22')];this[_0x12cb('0x23')]='';this['originatecalleridname']='';}Action[_0x12cb('0x24')][_0x12cb('0x25')]=function(){return util[_0x12cb('0x1e')](_0x12cb('0x26'),this[_0x12cb('0x5')],this[_0x12cb('0x3')][_0x12cb('0x27')]>0x0?this[_0x12cb('0x8')][_0x12cb('0x28')](this[_0x12cb('0x3')]['dialCutDigit']):this[_0x12cb('0x8')]);};Action['prototype'][_0x12cb('0x29')]=function(){return this[_0x12cb('0x9')];};module[_0x12cb('0x2a')]=Action; \ No newline at end of file +var _0x80c6=['ContactId','ListId','UserId','VoiceQueueId','CampaignId','idHopper','ContactFirstName','starttime','format','YYYY-MM-DD\x20HH:mm:ss','callbackuniqueid','callbackat','recallme','originatecalleridnum','originatecalleridname','prototype','getCaller','\x22%s\x22\x20<%s>','dialCutDigit','number','substring','getQueue','exports','util','moment','isNil','string','voiceQueue','uniqueid','name','Contact','phone','firstName','queue','active','type','dialQueueTimeout','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry'];(function(_0x19645f,_0x400b95){var _0x3ae56e=function(_0x289871){while(--_0x289871){_0x19645f['push'](_0x19645f['shift']());}};_0x3ae56e(++_0x400b95);}(_0x80c6,0x1ac));var _0x680c=function(_0x27e32f,_0x27abb6){_0x27e32f=_0x27e32f-0x0;var _0x5e3120=_0x80c6[_0x27e32f];return _0x5e3120;};'use strict';var util=require(_0x680c('0x0'));var _=require('lodash');var moment=require(_0x680c('0x1'));function checkNameSurname(_0xfc4251,_0x577a35,_0x26b6ad){var _0x1248e8='';if(!_[_0x680c('0x2')](_0x577a35)&&_0x680c('0x3')===typeof _0x577a35){_0x1248e8+=_0x577a35;}if(!_[_0x680c('0x2')](_0x26b6ad)&&_0x680c('0x3')===typeof _0x26b6ad){_0x1248e8+='\x20'+_0x26b6ad;}if(_0x1248e8!==''){return _0x1248e8;}return _0xfc4251;}function Action(_0x32ef54,_0x377be8,_0xc5f226){this[_0x680c('0x4')]=_0x32ef54;this[_0x680c('0x5')]=_0xc5f226||undefined;this[_0x680c('0x6')]=checkNameSurname(_0x377be8[_0x680c('0x7')][_0x680c('0x8')],_0x377be8[_0x680c('0x7')][_0x680c('0x9')],_0x377be8[_0x680c('0x7')]['lastName']);this['number']=_0x377be8[_0x680c('0x8')];this[_0x680c('0xa')]=_0x32ef54[_0x680c('0x6')];this[_0x680c('0xb')]=_0x377be8[_0x680c('0xb')]||![];this[_0x680c('0xc')]=_0x32ef54['type'];this['dialQueueTimeout']=_0x32ef54[_0x680c('0xd')]||0x3;this[_0x680c('0xe')]=_0x377be8[_0x680c('0xe')];this[_0x680c('0xf')]=_0x377be8['countbusyretry'];this[_0x680c('0x10')]=_0x377be8[_0x680c('0x10')];this[_0x680c('0x11')]=_0x377be8[_0x680c('0x11')];this[_0x680c('0x12')]=_0x377be8[_0x680c('0x12')];this[_0x680c('0x13')]=_0x377be8[_0x680c('0x13')];this[_0x680c('0x14')]=_0x377be8[_0x680c('0x14')];this[_0x680c('0x15')]=_0x377be8[_0x680c('0x15')];this['countagentrejectretry']=_0x377be8['countagentrejectretry'];this[_0x680c('0x16')]=_0x377be8[_0x680c('0x16')];this['ListId']=_0x377be8[_0x680c('0x17')];this[_0x680c('0x18')]=_0x377be8[_0x680c('0x18')];this['VoiceQueueId']=_0x377be8[_0x680c('0x19')];this[_0x680c('0x1a')]=_0x377be8[_0x680c('0x1a')];this[_0x680c('0x1b')]=_0x377be8['id'];this[_0x680c('0x1c')]=_0x377be8[_0x680c('0x7')][_0x680c('0x9')]||'';this[_0x680c('0x1d')]=moment()[_0x680c('0x1e')](_0x680c('0x1f'));this['callback']=_0x377be8['callback'];this[_0x680c('0x20')]=_0x377be8[_0x680c('0x20')];this[_0x680c('0x21')]=_0x377be8[_0x680c('0x21')];this[_0x680c('0x22')]=_0x377be8[_0x680c('0x22')];this[_0x680c('0x23')]='';this[_0x680c('0x24')]='';}Action[_0x680c('0x25')][_0x680c('0x26')]=function(){return util[_0x680c('0x1e')](_0x680c('0x27'),this[_0x680c('0x6')],this['voiceQueue'][_0x680c('0x28')]>0x0?this[_0x680c('0x29')][_0x680c('0x2a')](this['voiceQueue'][_0x680c('0x28')]):this['number']);};Action['prototype'][_0x680c('0x2b')]=function(){return this[_0x680c('0xa')];};module[_0x680c('0x2c')]=Action; \ No newline at end of file diff --git a/server/services/ami/dialer/models/agentComplete.js b/server/services/ami/dialer/models/agentComplete.js index 596f24a..da06c6b 100644 --- a/server/services/ami/dialer/models/agentComplete.js +++ b/server/services/ami/dialer/models/agentComplete.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x068a=['CampaignId','originatecalleridnum','originatecalleridname','agiafterat','exports','../utils','state','Answer','scheduledat','type','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countabandonedretry','countmachineretry','countagentrejectretry','countdropretry','uniqueid','calleridname','calleridnum','number','starttime','responsetime','format','ringtime','getSeconds','holdtime','answertime','talktime','endtime','reason','callback','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId'];(function(_0x4c060b,_0x4c5e75){var _0x5b9790=function(_0x32e525){while(--_0x32e525){_0x4c060b['push'](_0x4c060b['shift']());}};_0x5b9790(++_0x4c5e75);}(_0x068a,0x17f));var _0xa068=function(_0x2a153f,_0x50b499){_0x2a153f=_0x2a153f-0x0;var _0x6b9c5e=_0x068a[_0x2a153f];return _0x6b9c5e;};'use strict';var moment=require('moment');var utils=require(_0xa068('0x0'));function AgentComplete(_0x1b33e9,_0x30e399){this[_0xa068('0x1')]=0x4;this['statedesc']=_0xa068('0x2');this['scheduledat']=_0x1b33e9[_0xa068('0x3')];this['type']=_0x1b33e9[_0xa068('0x4')];this['campaigntype']=_0x1b33e9['type']===_0xa068('0x5')?_0xa068('0x6'):_0x1b33e9['type'];this[_0xa068('0x7')]=_0x1b33e9[_0xa068('0x7')];this[_0xa068('0x8')]=_0x1b33e9[_0xa068('0x8')];this[_0xa068('0x9')]=_0x1b33e9['countnoanswerretry'];this[_0xa068('0xa')]=_0x1b33e9['countbusyretry']+_0x1b33e9[_0xa068('0x8')]+_0x1b33e9['countnoanswerretry']+_0x1b33e9[_0xa068('0xb')]+_0x1b33e9['countdropretry']+_0x1b33e9[_0xa068('0xc')]+_0x1b33e9[_0xa068('0xd')]+_0x1b33e9[_0xa068('0xe')];this[_0xa068('0xb')]=_0x1b33e9['countnosuchnumberretry'];this[_0xa068('0xf')]=_0x1b33e9['countdropretry'];this[_0xa068('0xc')]=_0x1b33e9[_0xa068('0xc')];this['countmachineretry']=_0x1b33e9[_0xa068('0xd')];this['countagentrejectretry']=_0x1b33e9[_0xa068('0xe')];this['uniqueid']=_0x30e399[_0xa068('0x10')];this[_0xa068('0x11')]=_0x1b33e9['name'];this[_0xa068('0x12')]=_0x1b33e9[_0xa068('0x13')];this[_0xa068('0x14')]=_0x1b33e9['starttime'];this[_0xa068('0x15')]=_0x1b33e9[_0xa068('0x15')];this['answertime']=_0x1b33e9['answertime'];this['endtime']=moment()[_0xa068('0x16')]('YYYY-MM-DD\x20HH:mm:ss');this[_0xa068('0x17')]=utils[_0xa068('0x18')](_0x1b33e9[_0xa068('0x15')],_0x1b33e9[_0xa068('0x14')]);this[_0xa068('0x19')]=utils['getSeconds'](_0x1b33e9[_0xa068('0x1a')],_0x1b33e9[_0xa068('0x15')]);this[_0xa068('0x1b')]=utils[_0xa068('0x18')](this[_0xa068('0x1c')],_0x1b33e9[_0xa068('0x1a')]);this[_0xa068('0x6')]=_0x30e399[_0xa068('0x6')];this['membername']=_0x30e399['membername'];this[_0xa068('0x1d')]=_0x30e399[_0xa068('0x1d')];this[_0xa068('0x1e')]=_0x1b33e9[_0xa068('0x1e')];this['callbackuniqueid']=_0x1b33e9['callbackuniqueid'];this[_0xa068('0x1f')]=_0x1b33e9['callbackat'];this[_0xa068('0x20')]=_0x1b33e9[_0xa068('0x20')];this[_0xa068('0x21')]=_0x1b33e9['ContactId'];this[_0xa068('0x22')]=_0x1b33e9[_0xa068('0x22')];this[_0xa068('0x23')]=_0x1b33e9['UserId'];this[_0xa068('0x24')]=_0x1b33e9[_0xa068('0x24')];this[_0xa068('0x25')]=_0x1b33e9[_0xa068('0x25')];this[_0xa068('0x26')]=_0x1b33e9['originatecalleridnum']||'';this[_0xa068('0x27')]=_0x1b33e9['originatecalleridname']||'';this['agiafterat']=_0x1b33e9[_0xa068('0x28')];}module[_0xa068('0x29')]=AgentComplete; \ No newline at end of file +var _0x7bd8=['UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','moment','state','Answer','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','name','starttime','responsetime','answertime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','holdtime','queue','membername','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId'];(function(_0x126558,_0x143c9a){var _0x1f6d14=function(_0x2b0eea){while(--_0x2b0eea){_0x126558['push'](_0x126558['shift']());}};_0x1f6d14(++_0x143c9a);}(_0x7bd8,0x125));var _0x87bd=function(_0x1dbb3d,_0x1967d4){_0x1dbb3d=_0x1dbb3d-0x0;var _0x475732=_0x7bd8[_0x1dbb3d];return _0x475732;};'use strict';var moment=require(_0x87bd('0x0'));var utils=require('../utils');function AgentComplete(_0x5ae92e,_0x3d850f){this[_0x87bd('0x1')]=0x4;this['statedesc']=_0x87bd('0x2');this[_0x87bd('0x3')]=_0x5ae92e[_0x87bd('0x3')];this[_0x87bd('0x4')]=_0x5ae92e[_0x87bd('0x4')];this[_0x87bd('0x5')]=_0x5ae92e[_0x87bd('0x4')]===_0x87bd('0x6')?'queue':_0x5ae92e[_0x87bd('0x4')];this[_0x87bd('0x7')]=_0x5ae92e['countbusyretry'];this['countcongestionretry']=_0x5ae92e[_0x87bd('0x8')];this[_0x87bd('0x9')]=_0x5ae92e['countnoanswerretry'];this[_0x87bd('0xa')]=_0x5ae92e[_0x87bd('0x7')]+_0x5ae92e['countcongestionretry']+_0x5ae92e[_0x87bd('0x9')]+_0x5ae92e[_0x87bd('0xb')]+_0x5ae92e[_0x87bd('0xc')]+_0x5ae92e['countabandonedretry']+_0x5ae92e['countmachineretry']+_0x5ae92e['countagentrejectretry'];this[_0x87bd('0xb')]=_0x5ae92e[_0x87bd('0xb')];this['countdropretry']=_0x5ae92e[_0x87bd('0xc')];this[_0x87bd('0xd')]=_0x5ae92e[_0x87bd('0xd')];this['countmachineretry']=_0x5ae92e[_0x87bd('0xe')];this['countagentrejectretry']=_0x5ae92e[_0x87bd('0xf')];this['uniqueid']=_0x3d850f['uniqueid'];this[_0x87bd('0x10')]=_0x5ae92e[_0x87bd('0x11')];this['calleridnum']=_0x5ae92e['number'];this[_0x87bd('0x12')]=_0x5ae92e[_0x87bd('0x12')];this[_0x87bd('0x13')]=_0x5ae92e[_0x87bd('0x13')];this[_0x87bd('0x14')]=_0x5ae92e[_0x87bd('0x14')];this[_0x87bd('0x15')]=moment()['format'](_0x87bd('0x16'));this[_0x87bd('0x17')]=utils[_0x87bd('0x18')](_0x5ae92e[_0x87bd('0x13')],_0x5ae92e[_0x87bd('0x12')]);this[_0x87bd('0x19')]=utils[_0x87bd('0x18')](_0x5ae92e[_0x87bd('0x14')],_0x5ae92e['responsetime']);this['talktime']=utils['getSeconds'](this[_0x87bd('0x15')],_0x5ae92e[_0x87bd('0x14')]);this[_0x87bd('0x1a')]=_0x3d850f[_0x87bd('0x1a')];this[_0x87bd('0x1b')]=_0x3d850f[_0x87bd('0x1b')];this[_0x87bd('0x1c')]=_0x3d850f[_0x87bd('0x1c')];this[_0x87bd('0x1d')]=_0x5ae92e[_0x87bd('0x1d')];this[_0x87bd('0x1e')]=_0x5ae92e['callbackuniqueid'];this[_0x87bd('0x1f')]=_0x5ae92e['callbackat'];this[_0x87bd('0x20')]=_0x5ae92e[_0x87bd('0x20')];this[_0x87bd('0x21')]=_0x5ae92e[_0x87bd('0x21')];this[_0x87bd('0x22')]=_0x5ae92e[_0x87bd('0x22')];this[_0x87bd('0x23')]=_0x5ae92e[_0x87bd('0x23')];this[_0x87bd('0x24')]=_0x5ae92e[_0x87bd('0x24')];this[_0x87bd('0x25')]=_0x5ae92e[_0x87bd('0x25')];this[_0x87bd('0x26')]=_0x5ae92e[_0x87bd('0x26')]||'';this['originatecalleridname']=_0x5ae92e[_0x87bd('0x27')]||'';this[_0x87bd('0x28')]=_0x5ae92e[_0x87bd('0x28')];}module['exports']=AgentComplete; \ No newline at end of file diff --git a/server/services/ami/dialer/models/final.js b/server/services/ami/dialer/models/final.js index 1111dd1..0d7ebd4 100644 --- a/server/services/ami/dialer/models/final.js +++ b/server/services/ami/dialer/models/final.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd68c=['countnosuchnumberretry','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','calleridname','calleridnum','starttime','responsetime','endtime','ringtime','holdtime','talktime','callback','callbackuniqueid','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal'];(function(_0x5f2868,_0x266c8f){var _0x23f2fb=function(_0x1ecc1c){while(--_0x1ecc1c){_0x5f2868['push'](_0x5f2868['shift']());}};_0x23f2fb(++_0x266c8f);}(_0xd68c,0x18f));var _0xcd68=function(_0x4400bf,_0x3dae8a){_0x4400bf=_0x4400bf-0x0;var _0x5aa062=_0xd68c[_0x4400bf];return _0x5aa062;};'use strict';function Final(_0x1b28c4){this['uniqueid']=_0x1b28c4[_0xcd68('0x0')];this['scheduledat']=_0x1b28c4[_0xcd68('0x1')];this[_0xcd68('0x2')]=_0x1b28c4['type'];this[_0xcd68('0x3')]=_0x1b28c4[_0xcd68('0x2')]==='outbound'?_0xcd68('0x4'):_0x1b28c4[_0xcd68('0x2')];this[_0xcd68('0x5')]=_0x1b28c4[_0xcd68('0x5')];this[_0xcd68('0x6')]=_0x1b28c4['countcongestionretry'];this[_0xcd68('0x7')]=_0x1b28c4['countnoanswerretry'];this[_0xcd68('0x8')]=_0x1b28c4[_0xcd68('0x5')]+_0x1b28c4['countcongestionretry']+_0x1b28c4[_0xcd68('0x7')]+_0x1b28c4[_0xcd68('0x9')]+_0x1b28c4[_0xcd68('0xa')]+_0x1b28c4[_0xcd68('0xb')]+_0x1b28c4[_0xcd68('0xc')]+_0x1b28c4[_0xcd68('0xd')];this[_0xcd68('0x9')]=_0x1b28c4[_0xcd68('0x9')];this[_0xcd68('0xa')]=_0x1b28c4[_0xcd68('0xa')];this[_0xcd68('0xb')]=_0x1b28c4[_0xcd68('0xb')];this[_0xcd68('0xc')]=_0x1b28c4[_0xcd68('0xc')];this[_0xcd68('0xd')]=_0x1b28c4[_0xcd68('0xd')];this[_0xcd68('0x4')]=_0x1b28c4[_0xcd68('0x4')];this[_0xcd68('0xe')]=_0x1b28c4[_0xcd68('0xe')];this['calleridnum']=_0x1b28c4[_0xcd68('0xf')];this[_0xcd68('0x10')]=_0x1b28c4[_0xcd68('0x10')];this['responsetime']=_0x1b28c4[_0xcd68('0x11')];this[_0xcd68('0x12')]=_0x1b28c4[_0xcd68('0x11')];this[_0xcd68('0x13')]=_0x1b28c4[_0xcd68('0x13')]||0x0;this[_0xcd68('0x14')]=_0x1b28c4[_0xcd68('0x14')]||0x0;this['talktime']=_0x1b28c4[_0xcd68('0x15')]||0x0;this[_0xcd68('0x16')]=_0x1b28c4[_0xcd68('0x16')];this[_0xcd68('0x17')]=_0x1b28c4[_0xcd68('0x17')];this['callbackat']=_0x1b28c4['callbackat'];this[_0xcd68('0x18')]=_0x1b28c4[_0xcd68('0x18')];this[_0xcd68('0x19')]=_0x1b28c4[_0xcd68('0x19')];this['ListId']=_0x1b28c4[_0xcd68('0x1a')];this['UserId']=_0x1b28c4[_0xcd68('0x1b')];this[_0xcd68('0x1c')]=_0x1b28c4[_0xcd68('0x1c')];this[_0xcd68('0x1d')]=_0x1b28c4[_0xcd68('0x1d')];this['originatecalleridnum']=_0x1b28c4['originatecalleridnum']||'';this[_0xcd68('0x1e')]=_0x1b28c4[_0xcd68('0x1e')]||'';this[_0xcd68('0x1f')]=_0x1b28c4['state'];this[_0xcd68('0x20')]=_0x1b28c4[_0xcd68('0x20')];}module[_0xcd68('0x21')]=Final; \ No newline at end of file +var _0xed8a=['originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','calleridnum','starttime','responsetime','ringtime','holdtime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId'];(function(_0x2a7cdf,_0x59193b){var _0x159b28=function(_0x3e5fbd){while(--_0x3e5fbd){_0x2a7cdf['push'](_0x2a7cdf['shift']());}};_0x159b28(++_0x59193b);}(_0xed8a,0x6e));var _0xaed8=function(_0x36d913,_0x42958a){_0x36d913=_0x36d913-0x0;var _0x1e184e=_0xed8a[_0x36d913];return _0x1e184e;};'use strict';function Final(_0x469678){this[_0xaed8('0x0')]=_0x469678[_0xaed8('0x0')];this[_0xaed8('0x1')]=_0x469678['scheduledat'];this[_0xaed8('0x2')]=_0x469678[_0xaed8('0x2')];this[_0xaed8('0x3')]=_0x469678['type']===_0xaed8('0x4')?_0xaed8('0x5'):_0x469678[_0xaed8('0x2')];this[_0xaed8('0x6')]=_0x469678['countbusyretry'];this[_0xaed8('0x7')]=_0x469678[_0xaed8('0x7')];this[_0xaed8('0x8')]=_0x469678[_0xaed8('0x8')];this[_0xaed8('0x9')]=_0x469678['countbusyretry']+_0x469678['countcongestionretry']+_0x469678[_0xaed8('0x8')]+_0x469678[_0xaed8('0xa')]+_0x469678[_0xaed8('0xb')]+_0x469678['countabandonedretry']+_0x469678['countmachineretry']+_0x469678[_0xaed8('0xc')];this['countnosuchnumberretry']=_0x469678[_0xaed8('0xa')];this[_0xaed8('0xb')]=_0x469678['countdropretry'];this[_0xaed8('0xd')]=_0x469678[_0xaed8('0xd')];this[_0xaed8('0xe')]=_0x469678[_0xaed8('0xe')];this[_0xaed8('0xc')]=_0x469678[_0xaed8('0xc')];this[_0xaed8('0x5')]=_0x469678[_0xaed8('0x5')];this[_0xaed8('0xf')]=_0x469678[_0xaed8('0xf')];this[_0xaed8('0x10')]=_0x469678[_0xaed8('0x10')];this[_0xaed8('0x11')]=_0x469678[_0xaed8('0x11')];this[_0xaed8('0x12')]=_0x469678[_0xaed8('0x12')];this['endtime']=_0x469678[_0xaed8('0x12')];this[_0xaed8('0x13')]=_0x469678[_0xaed8('0x13')]||0x0;this[_0xaed8('0x14')]=_0x469678[_0xaed8('0x14')]||0x0;this['talktime']=_0x469678['talktime']||0x0;this[_0xaed8('0x15')]=_0x469678[_0xaed8('0x15')];this['callbackuniqueid']=_0x469678[_0xaed8('0x16')];this['callbackat']=_0x469678[_0xaed8('0x17')];this['recallme']=_0x469678[_0xaed8('0x18')];this[_0xaed8('0x19')]=_0x469678[_0xaed8('0x19')];this[_0xaed8('0x1a')]=_0x469678[_0xaed8('0x1a')];this[_0xaed8('0x1b')]=_0x469678[_0xaed8('0x1b')];this[_0xaed8('0x1c')]=_0x469678[_0xaed8('0x1c')];this[_0xaed8('0x1d')]=_0x469678[_0xaed8('0x1d')];this[_0xaed8('0x1e')]=_0x469678[_0xaed8('0x1e')]||'';this[_0xaed8('0x1f')]=_0x469678[_0xaed8('0x1f')]||'';this[_0xaed8('0x20')]=_0x469678[_0xaed8('0x20')];this[_0xaed8('0x21')]=_0x469678[_0xaed8('0x21')];}module[_0xaed8('0x22')]=Final; \ No newline at end of file diff --git a/server/services/ami/dialer/models/hangup.js b/server/services/ami/dialer/models/hangup.js index 31ad1e4..c1b82d7 100644 --- a/server/services/ami/dialer/models/hangup.js +++ b/server/services/ami/dialer/models/hangup.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xcb0c=['responsetime','endtime','format','YYYY-MM-DD\x20HH:mm:ss','getSeconds','queue','membername','IVR','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','moment','../utils','state','scheduledat','type','campaigntype','countbusyretry','countnoanswerretry','countglobal','countcongestionretry','countdropretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countabandonedretry','uniqueid','calleridnum','number','starttime'];(function(_0x593f77,_0x34404c){var _0xc17c14=function(_0x300053){while(--_0x300053){_0x593f77['push'](_0x593f77['shift']());}};_0xc17c14(++_0x34404c);}(_0xcb0c,0xcb));var _0xccb0=function(_0x20d54d,_0x1adc8e){_0x20d54d=_0x20d54d-0x0;var _0x516e8b=_0xcb0c[_0x20d54d];return _0x516e8b;};'use strict';var moment=require(_0xccb0('0x0'));var utils=require(_0xccb0('0x1'));function Hangup(_0x474440,_0x537725){this[_0xccb0('0x2')]=0x4;this['statedesc']='Answer';this[_0xccb0('0x3')]=_0x474440[_0xccb0('0x3')];this['type']=_0x474440[_0xccb0('0x4')];this[_0xccb0('0x5')]=_0x474440[_0xccb0('0x4')]==='outbound'?'queue':_0x474440[_0xccb0('0x4')];this['amd']=_0x474440['amd']||![];this[_0xccb0('0x6')]=_0x474440[_0xccb0('0x6')];this['countcongestionretry']=_0x474440['countcongestionretry'];this[_0xccb0('0x7')]=_0x474440[_0xccb0('0x7')];this[_0xccb0('0x8')]=_0x474440[_0xccb0('0x6')]+_0x474440[_0xccb0('0x9')]+_0x474440[_0xccb0('0x7')]+_0x474440['countnosuchnumberretry']+_0x474440[_0xccb0('0xa')]+_0x474440['countabandonedretry']+_0x474440[_0xccb0('0xb')]+_0x474440[_0xccb0('0xc')];this['countnosuchnumberretry']=_0x474440[_0xccb0('0xd')];this[_0xccb0('0xa')]=_0x474440[_0xccb0('0xa')];this[_0xccb0('0xe')]=_0x474440['countabandonedretry'];this[_0xccb0('0xb')]=_0x474440[_0xccb0('0xb')];this['countagentrejectretry']=_0x474440[_0xccb0('0xc')];this[_0xccb0('0xf')]=_0x537725[_0xccb0('0xf')];this['calleridname']=_0x474440['name'];this[_0xccb0('0x10')]=_0x474440[_0xccb0('0x11')];this['starttime']=_0x474440[_0xccb0('0x12')];this[_0xccb0('0x13')]=_0x474440['responsetime'];this[_0xccb0('0x14')]=moment()[_0xccb0('0x15')](_0xccb0('0x16'));this['ringtime']=utils['getSeconds'](_0x474440[_0xccb0('0x13')],_0x474440[_0xccb0('0x12')]);this['holdtime']=0x0;this['talktime']=utils[_0xccb0('0x17')](this[_0xccb0('0x14')],_0x474440[_0xccb0('0x13')]);this[_0xccb0('0x18')]=_0x474440[_0xccb0('0x18')];this[_0xccb0('0x19')]=_0xccb0('0x1a');this[_0xccb0('0x1b')]=_0x537725['cause-txt'];this[_0xccb0('0x1c')]=_0x474440['callback'];this[_0xccb0('0x1d')]=_0x474440[_0xccb0('0x1d')];this[_0xccb0('0x1e')]=_0x474440[_0xccb0('0x1e')];this[_0xccb0('0x1f')]=_0x474440[_0xccb0('0x1f')];this['ContactId']=_0x474440[_0xccb0('0x20')];this[_0xccb0('0x21')]=_0x474440[_0xccb0('0x21')];this[_0xccb0('0x22')]=_0x474440['UserId'];this[_0xccb0('0x23')]=_0x474440[_0xccb0('0x23')];this[_0xccb0('0x24')]=_0x474440['CampaignId'];}module['exports']=Hangup; \ No newline at end of file +var _0x4f67=['queue','IVR','reason','cause-txt','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','CampaignId','exports','state','statedesc','Answer','scheduledat','type','campaigntype','outbound','amd','countbusyretry','countcongestionretry','countnoanswerretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countabandonedretry','uniqueid','calleridname','name','starttime','responsetime','endtime','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','talktime'];(function(_0x520cbd,_0x318b9e){var _0x24f968=function(_0x54e290){while(--_0x54e290){_0x520cbd['push'](_0x520cbd['shift']());}};_0x24f968(++_0x318b9e);}(_0x4f67,0x82));var _0x74f6=function(_0x5c814d,_0x4d81c7){_0x5c814d=_0x5c814d-0x0;var _0x89b71=_0x4f67[_0x5c814d];return _0x89b71;};'use strict';var moment=require('moment');var utils=require('../utils');function Hangup(_0x531a70,_0x526f5){this[_0x74f6('0x0')]=0x4;this[_0x74f6('0x1')]=_0x74f6('0x2');this[_0x74f6('0x3')]=_0x531a70[_0x74f6('0x3')];this[_0x74f6('0x4')]=_0x531a70[_0x74f6('0x4')];this[_0x74f6('0x5')]=_0x531a70['type']===_0x74f6('0x6')?'queue':_0x531a70['type'];this['amd']=_0x531a70[_0x74f6('0x7')]||![];this['countbusyretry']=_0x531a70[_0x74f6('0x8')];this[_0x74f6('0x9')]=_0x531a70[_0x74f6('0x9')];this['countnoanswerretry']=_0x531a70[_0x74f6('0xa')];this['countglobal']=_0x531a70[_0x74f6('0x8')]+_0x531a70[_0x74f6('0x9')]+_0x531a70[_0x74f6('0xa')]+_0x531a70['countnosuchnumberretry']+_0x531a70['countdropretry']+_0x531a70['countabandonedretry']+_0x531a70[_0x74f6('0xb')]+_0x531a70[_0x74f6('0xc')];this[_0x74f6('0xd')]=_0x531a70[_0x74f6('0xd')];this[_0x74f6('0xe')]=_0x531a70[_0x74f6('0xe')];this['countabandonedretry']=_0x531a70[_0x74f6('0xf')];this[_0x74f6('0xb')]=_0x531a70[_0x74f6('0xb')];this[_0x74f6('0xc')]=_0x531a70[_0x74f6('0xc')];this[_0x74f6('0x10')]=_0x526f5[_0x74f6('0x10')];this[_0x74f6('0x11')]=_0x531a70[_0x74f6('0x12')];this['calleridnum']=_0x531a70['number'];this[_0x74f6('0x13')]=_0x531a70['starttime'];this[_0x74f6('0x14')]=_0x531a70[_0x74f6('0x14')];this[_0x74f6('0x15')]=moment()['format'](_0x74f6('0x16'));this[_0x74f6('0x17')]=utils[_0x74f6('0x18')](_0x531a70['responsetime'],_0x531a70[_0x74f6('0x13')]);this['holdtime']=0x0;this[_0x74f6('0x19')]=utils['getSeconds'](this['endtime'],_0x531a70[_0x74f6('0x14')]);this[_0x74f6('0x1a')]=_0x531a70[_0x74f6('0x1a')];this['membername']=_0x74f6('0x1b');this[_0x74f6('0x1c')]=_0x526f5[_0x74f6('0x1d')];this[_0x74f6('0x1e')]=_0x531a70[_0x74f6('0x1e')];this[_0x74f6('0x1f')]=_0x531a70[_0x74f6('0x1f')];this['callbackat']=_0x531a70[_0x74f6('0x20')];this[_0x74f6('0x21')]=_0x531a70[_0x74f6('0x21')];this[_0x74f6('0x22')]=_0x531a70[_0x74f6('0x22')];this['ListId']=_0x531a70[_0x74f6('0x23')];this['UserId']=_0x531a70['UserId'];this[_0x74f6('0x24')]=_0x531a70['VoiceQueueId'];this[_0x74f6('0x25')]=_0x531a70[_0x74f6('0x25')];}module[_0x74f6('0x26')]=Hangup; \ No newline at end of file diff --git a/server/services/ami/dialer/models/history.js b/server/services/ami/dialer/models/history.js index 0f83fe9..d9617dc 100644 --- a/server/services/ami/dialer/models/history.js +++ b/server/services/ami/dialer/models/history.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x3494=['recallme','ContactId','ListId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','exports','uniqueid','scheduledat','type','campaigntype','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countdropretry','countmachineretry','queue','calleridname','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat'];(function(_0x17de8e,_0x41ad4c){var _0x39aba5=function(_0x255320){while(--_0x255320){_0x17de8e['push'](_0x17de8e['shift']());}};_0x39aba5(++_0x41ad4c);}(_0x3494,0x13a));var _0x4349=function(_0x37c889,_0x16e2b6){_0x37c889=_0x37c889-0x0;var _0x28ec5e=_0x3494[_0x37c889];return _0x28ec5e;};'use strict';var utils=require('../utils');function History(_0x4a87c5){this[_0x4349('0x0')]=_0x4a87c5[_0x4349('0x0')];this[_0x4349('0x1')]=_0x4a87c5[_0x4349('0x1')]||undefined;this['type']=_0x4a87c5[_0x4349('0x2')];this[_0x4349('0x3')]=_0x4a87c5[_0x4349('0x2')]===_0x4349('0x4')?'queue':_0x4a87c5[_0x4349('0x2')];this[_0x4349('0x5')]=_0x4a87c5[_0x4349('0x5')];this[_0x4349('0x6')]=_0x4a87c5['countcongestionretry'];this[_0x4349('0x7')]=_0x4a87c5[_0x4349('0x7')];this['countglobal']=_0x4a87c5[_0x4349('0x5')]+_0x4a87c5[_0x4349('0x6')]+_0x4a87c5[_0x4349('0x7')]+_0x4a87c5['countnosuchnumberretry']+_0x4a87c5['countdropretry']+_0x4a87c5[_0x4349('0x8')]+_0x4a87c5['countmachineretry']+_0x4a87c5[_0x4349('0x9')];this[_0x4349('0xa')]=_0x4a87c5['countnosuchnumberretry'];this[_0x4349('0xb')]=_0x4a87c5[_0x4349('0xb')];this[_0x4349('0x8')]=_0x4a87c5[_0x4349('0x8')];this['countmachineretry']=_0x4a87c5[_0x4349('0xc')];this[_0x4349('0x9')]=_0x4a87c5[_0x4349('0x9')];this[_0x4349('0xd')]=_0x4a87c5[_0x4349('0xd')];this[_0x4349('0xe')]=_0x4a87c5[_0x4349('0xf')];this[_0x4349('0x10')]=_0x4a87c5[_0x4349('0x11')];this[_0x4349('0x12')]=_0x4a87c5[_0x4349('0x12')];this[_0x4349('0x13')]=_0x4a87c5[_0x4349('0x13')];this[_0x4349('0x14')]=_0x4a87c5[_0x4349('0x13')];this[_0x4349('0x15')]=utils[_0x4349('0x16')](_0x4a87c5[_0x4349('0x13')],_0x4a87c5['starttime']);this[_0x4349('0x17')]=0x0;this[_0x4349('0x18')]=0x0;this['callback']=_0x4a87c5[_0x4349('0x19')];this[_0x4349('0x1a')]=_0x4a87c5[_0x4349('0x1a')];this['callbackat']=_0x4a87c5[_0x4349('0x1b')];this[_0x4349('0x1c')]=_0x4a87c5[_0x4349('0x1c')];this[_0x4349('0x1d')]=_0x4a87c5[_0x4349('0x1d')];this['ListId']=_0x4a87c5[_0x4349('0x1e')];this['UserId']=_0x4a87c5['UserId'];this[_0x4349('0x1f')]=_0x4a87c5[_0x4349('0x1f')];this['CampaignId']=_0x4a87c5[_0x4349('0x20')];this[_0x4349('0x21')]=_0x4a87c5[_0x4349('0x21')]||'';this['originatecalleridname']=_0x4a87c5[_0x4349('0x22')]||'';this['state']=_0x4a87c5[_0x4349('0x23')];this[_0x4349('0x24')]=_0x4a87c5['statedesc'];}module[_0x4349('0x25')]=History; \ No newline at end of file +var _0xa3e4=['countagentrejectretry','countdropretry','countabandonedretry','name','calleridnum','number','starttime','responsetime','endtime','ringtime','getSeconds','holdtime','talktime','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','CampaignId','originatecalleridnum','originatecalleridname','state','statedesc','uniqueid','scheduledat','type','campaigntype','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countmachineretry'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa3e4,0x85));var _0x4a3e=function(_0x2a4fe2,_0x3ec53a){_0x2a4fe2=_0x2a4fe2-0x0;var _0x225c4a=_0xa3e4[_0x2a4fe2];return _0x225c4a;};'use strict';var utils=require('../utils');function History(_0x54cbd9){this['uniqueid']=_0x54cbd9[_0x4a3e('0x0')];this['scheduledat']=_0x54cbd9[_0x4a3e('0x1')]||undefined;this[_0x4a3e('0x2')]=_0x54cbd9[_0x4a3e('0x2')];this[_0x4a3e('0x3')]=_0x54cbd9['type']==='outbound'?_0x4a3e('0x4'):_0x54cbd9['type'];this[_0x4a3e('0x5')]=_0x54cbd9[_0x4a3e('0x5')];this[_0x4a3e('0x6')]=_0x54cbd9[_0x4a3e('0x6')];this[_0x4a3e('0x7')]=_0x54cbd9[_0x4a3e('0x7')];this[_0x4a3e('0x8')]=_0x54cbd9[_0x4a3e('0x5')]+_0x54cbd9[_0x4a3e('0x6')]+_0x54cbd9[_0x4a3e('0x7')]+_0x54cbd9[_0x4a3e('0x9')]+_0x54cbd9['countdropretry']+_0x54cbd9['countabandonedretry']+_0x54cbd9[_0x4a3e('0xa')]+_0x54cbd9[_0x4a3e('0xb')];this[_0x4a3e('0x9')]=_0x54cbd9[_0x4a3e('0x9')];this[_0x4a3e('0xc')]=_0x54cbd9[_0x4a3e('0xc')];this[_0x4a3e('0xd')]=_0x54cbd9['countabandonedretry'];this[_0x4a3e('0xa')]=_0x54cbd9[_0x4a3e('0xa')];this[_0x4a3e('0xb')]=_0x54cbd9[_0x4a3e('0xb')];this['queue']=_0x54cbd9[_0x4a3e('0x4')];this['calleridname']=_0x54cbd9[_0x4a3e('0xe')];this[_0x4a3e('0xf')]=_0x54cbd9[_0x4a3e('0x10')];this[_0x4a3e('0x11')]=_0x54cbd9[_0x4a3e('0x11')];this[_0x4a3e('0x12')]=_0x54cbd9[_0x4a3e('0x12')];this[_0x4a3e('0x13')]=_0x54cbd9[_0x4a3e('0x12')];this[_0x4a3e('0x14')]=utils[_0x4a3e('0x15')](_0x54cbd9[_0x4a3e('0x12')],_0x54cbd9['starttime']);this[_0x4a3e('0x16')]=0x0;this[_0x4a3e('0x17')]=0x0;this['callback']=_0x54cbd9[_0x4a3e('0x18')];this[_0x4a3e('0x19')]=_0x54cbd9[_0x4a3e('0x19')];this['callbackat']=_0x54cbd9[_0x4a3e('0x1a')];this[_0x4a3e('0x1b')]=_0x54cbd9[_0x4a3e('0x1b')];this['ContactId']=_0x54cbd9[_0x4a3e('0x1c')];this[_0x4a3e('0x1d')]=_0x54cbd9['ListId'];this[_0x4a3e('0x1e')]=_0x54cbd9[_0x4a3e('0x1e')];this['VoiceQueueId']=_0x54cbd9['VoiceQueueId'];this[_0x4a3e('0x1f')]=_0x54cbd9[_0x4a3e('0x1f')];this[_0x4a3e('0x20')]=_0x54cbd9[_0x4a3e('0x20')]||'';this[_0x4a3e('0x21')]=_0x54cbd9[_0x4a3e('0x21')]||'';this[_0x4a3e('0x22')]=_0x54cbd9[_0x4a3e('0x22')];this[_0x4a3e('0x23')]=_0x54cbd9[_0x4a3e('0x23')];}module['exports']=History; \ No newline at end of file diff --git a/server/services/ami/dialer/models/queueCallerAbandon.js b/server/services/ami/dialer/models/queueCallerAbandon.js index 9ea949d..711bab9 100644 --- a/server/services/ami/dialer/models/queueCallerAbandon.js +++ b/server/services/ami/dialer/models/queueCallerAbandon.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x47cb=['type','outbound','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countagentrejectretry','countnosuchnumberretry','countmachineretry','calleridname','calleridnum','number','starttime','responsetime','droptime','dropreason','endtime','ringtime','getSeconds','holdtime','talktime','queue','membername','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','campaigntype'];(function(_0x5b8d6f,_0x3a951c){var _0x19cb46=function(_0x21765d){while(--_0x21765d){_0x5b8d6f['push'](_0x5b8d6f['shift']());}};_0x19cb46(++_0x3a951c);}(_0x47cb,0x1bf));var _0xb47c=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x47cb[_0x14add3];return _0x4a174f;};'use strict';var utils=require(_0xb47c('0x0'));function QueueCallerAbandon(_0x4ed2cc,_0x3e4e35){this['scheduledat']=_0x4ed2cc[_0xb47c('0x1')];this['type']=_0x4ed2cc['type'];this[_0xb47c('0x2')]=_0x4ed2cc[_0xb47c('0x3')]===_0xb47c('0x4')?'queue':_0x4ed2cc[_0xb47c('0x3')];this[_0xb47c('0x5')]=_0x4ed2cc['countbusyretry'];this[_0xb47c('0x6')]=_0x4ed2cc['countcongestionretry'];this[_0xb47c('0x7')]=_0x4ed2cc['countnoanswerretry'];this[_0xb47c('0x8')]=_0x4ed2cc[_0xb47c('0x5')]+_0x4ed2cc[_0xb47c('0x6')]+_0x4ed2cc['countnoanswerretry']+_0x4ed2cc['countnosuchnumberretry']+_0x4ed2cc[_0xb47c('0x9')]+_0x4ed2cc[_0xb47c('0xa')]+_0x4ed2cc['countmachineretry']+_0x4ed2cc[_0xb47c('0xb')];this[_0xb47c('0xc')]=_0x4ed2cc[_0xb47c('0xc')];this[_0xb47c('0x9')]=_0x4ed2cc[_0xb47c('0x9')];this[_0xb47c('0xa')]=_0x4ed2cc[_0xb47c('0xa')];this['countmachineretry']=_0x4ed2cc[_0xb47c('0xd')];this[_0xb47c('0xb')]=_0x4ed2cc['countagentrejectretry'];this['uniqueid']=_0x3e4e35['uniqueid'];this[_0xb47c('0xe')]=_0x4ed2cc['name'];this[_0xb47c('0xf')]=_0x4ed2cc[_0xb47c('0x10')];this['starttime']=_0x4ed2cc[_0xb47c('0x11')];this[_0xb47c('0x12')]=_0x4ed2cc[_0xb47c('0x12')];this[_0xb47c('0x13')]=_0x4ed2cc[_0xb47c('0x13')];this[_0xb47c('0x14')]=_0x4ed2cc[_0xb47c('0x14')];this[_0xb47c('0x15')]=this[_0xb47c('0x13')];this[_0xb47c('0x16')]=utils[_0xb47c('0x17')](_0x4ed2cc[_0xb47c('0x12')],_0x4ed2cc['starttime']);this[_0xb47c('0x18')]=utils['getSeconds'](this['droptime'],_0x4ed2cc[_0xb47c('0x12')]);this[_0xb47c('0x19')]=0x0;this[_0xb47c('0x1a')]=_0x3e4e35[_0xb47c('0x1a')];this[_0xb47c('0x1b')]=_0x3e4e35[_0xb47c('0x1c')];this[_0xb47c('0x1d')]=_0x3e4e35['reason'];this[_0xb47c('0x1e')]=_0x4ed2cc[_0xb47c('0x1e')];this[_0xb47c('0x1f')]=_0x4ed2cc[_0xb47c('0x1f')];this[_0xb47c('0x20')]=_0x4ed2cc[_0xb47c('0x20')];this['recallme']=_0x4ed2cc[_0xb47c('0x21')];this[_0xb47c('0x22')]=_0x4ed2cc[_0xb47c('0x22')];this[_0xb47c('0x23')]=_0x4ed2cc[_0xb47c('0x23')];this[_0xb47c('0x24')]=_0x4ed2cc['UserId'];this[_0xb47c('0x25')]=_0x4ed2cc[_0xb47c('0x25')];this[_0xb47c('0x26')]=_0x4ed2cc[_0xb47c('0x26')];this[_0xb47c('0x27')]=_0x4ed2cc['originatecalleridnum']||'';this[_0xb47c('0x28')]=_0x4ed2cc[_0xb47c('0x28')]||'';this[_0xb47c('0x29')]=_0x4ed2cc[_0xb47c('0x29')];this[_0xb47c('0x2a')]=_0x4ed2cc[_0xb47c('0x2a')];this[_0xb47c('0x2b')]=_0x4ed2cc[_0xb47c('0x2b')];}module[_0xb47c('0x2c')]=QueueCallerAbandon; \ No newline at end of file +var _0x326d=['calleridnum','number','starttime','droptime','dropreason','endtime','ringtime','responsetime','holdtime','getSeconds','talktime','connectedlinename','reason','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','UserId','VoiceQueueId','CampaignId','originatecalleridnum','originatecalleridname','agiafterat','state','statedesc','exports','../utils','scheduledat','type','campaigntype','outbound','queue','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countnosuchnumberretry','countdropretry','countagentrejectretry','countabandonedretry','countmachineretry','calleridname','name'];(function(_0x472f25,_0xe8b449){var _0x571434=function(_0x2a74ca){while(--_0x2a74ca){_0x472f25['push'](_0x472f25['shift']());}};_0x571434(++_0xe8b449);}(_0x326d,0x157));var _0xd326=function(_0x5ef3db,_0x5a0e78){_0x5ef3db=_0x5ef3db-0x0;var _0x2d2ad5=_0x326d[_0x5ef3db];return _0x2d2ad5;};'use strict';var utils=require(_0xd326('0x0'));function QueueCallerAbandon(_0x4d811c,_0x1aa4f1){this[_0xd326('0x1')]=_0x4d811c[_0xd326('0x1')];this[_0xd326('0x2')]=_0x4d811c[_0xd326('0x2')];this[_0xd326('0x3')]=_0x4d811c[_0xd326('0x2')]===_0xd326('0x4')?_0xd326('0x5'):_0x4d811c[_0xd326('0x2')];this['countbusyretry']=_0x4d811c[_0xd326('0x6')];this['countcongestionretry']=_0x4d811c[_0xd326('0x7')];this[_0xd326('0x8')]=_0x4d811c[_0xd326('0x8')];this[_0xd326('0x9')]=_0x4d811c['countbusyretry']+_0x4d811c['countcongestionretry']+_0x4d811c['countnoanswerretry']+_0x4d811c[_0xd326('0xa')]+_0x4d811c[_0xd326('0xb')]+_0x4d811c['countabandonedretry']+_0x4d811c['countmachineretry']+_0x4d811c[_0xd326('0xc')];this[_0xd326('0xa')]=_0x4d811c['countnosuchnumberretry'];this[_0xd326('0xb')]=_0x4d811c[_0xd326('0xb')];this[_0xd326('0xd')]=_0x4d811c[_0xd326('0xd')];this[_0xd326('0xe')]=_0x4d811c[_0xd326('0xe')];this[_0xd326('0xc')]=_0x4d811c[_0xd326('0xc')];this['uniqueid']=_0x1aa4f1['uniqueid'];this[_0xd326('0xf')]=_0x4d811c[_0xd326('0x10')];this[_0xd326('0x11')]=_0x4d811c[_0xd326('0x12')];this['starttime']=_0x4d811c[_0xd326('0x13')];this['responsetime']=_0x4d811c['responsetime'];this[_0xd326('0x14')]=_0x4d811c['droptime'];this[_0xd326('0x15')]=_0x4d811c[_0xd326('0x15')];this[_0xd326('0x16')]=this[_0xd326('0x14')];this[_0xd326('0x17')]=utils['getSeconds'](_0x4d811c[_0xd326('0x18')],_0x4d811c[_0xd326('0x13')]);this[_0xd326('0x19')]=utils[_0xd326('0x1a')](this[_0xd326('0x14')],_0x4d811c[_0xd326('0x18')]);this[_0xd326('0x1b')]=0x0;this[_0xd326('0x5')]=_0x1aa4f1[_0xd326('0x5')];this['membername']=_0x1aa4f1[_0xd326('0x1c')];this[_0xd326('0x1d')]=_0x1aa4f1[_0xd326('0x1d')];this['callback']=_0x4d811c[_0xd326('0x1e')];this['callbackuniqueid']=_0x4d811c[_0xd326('0x1f')];this[_0xd326('0x20')]=_0x4d811c['callbackat'];this[_0xd326('0x21')]=_0x4d811c[_0xd326('0x21')];this[_0xd326('0x22')]=_0x4d811c[_0xd326('0x22')];this[_0xd326('0x23')]=_0x4d811c[_0xd326('0x23')];this[_0xd326('0x24')]=_0x4d811c[_0xd326('0x24')];this[_0xd326('0x25')]=_0x4d811c[_0xd326('0x25')];this[_0xd326('0x26')]=_0x4d811c[_0xd326('0x26')];this[_0xd326('0x27')]=_0x4d811c[_0xd326('0x27')]||'';this[_0xd326('0x28')]=_0x4d811c['originatecalleridname']||'';this[_0xd326('0x29')]=_0x4d811c['agiafterat'];this[_0xd326('0x2a')]=_0x4d811c[_0xd326('0x2a')];this[_0xd326('0x2b')]=_0x4d811c[_0xd326('0x2b')];}module[_0xd326('0x2c')]=QueueCallerAbandon; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/hopper.js b/server/services/ami/dialer/utils/hopper.js index 61104fd..ddea1ac 100644 --- a/server/services/ami/dialer/utils/hopper.js +++ b/server/services/ami/dialer/utils/hopper.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xd8b0=['moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackListIvr]','checkIsBlackListIvr','verifyAdditionalPhones','[verifyAdditionalPhone]','swapAdditionalPhones','[swapAdditionalPhone]','avgHandleTime','[avgHandleTime]','[createHistory]','createHistory','util','../../../../config/logger','../../rpc/cmHopperBlack','../../rpc/cmHopperHistory','inspect','getContactDialer','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialerIvr','[getContactDialerIvr]','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]'];(function(_0x384d00,_0x26fd69){var _0x4601c1=function(_0x5d8eaa){while(--_0x5d8eaa){_0x384d00['push'](_0x384d00['shift']());}};_0x4601c1(++_0x26fd69);}(_0xd8b0,0xad));var _0x0d8b=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0xd8b0[_0x122ef9];return _0x42fba0;};'use strict';var util=require(_0x0d8b('0x0'));var logger=require(_0x0d8b('0x1'))('dialer');var cmHopper=require('../../rpc/cmHopper');var cmHopperAdditionalPhone=require('../../rpc/cmHopperAdditionalPhone');var cmHopperBlack=require(_0x0d8b('0x2'));var cmHopperHistory=require(_0x0d8b('0x3'));function inspectError(_0x43bca1){return util[_0x0d8b('0x4')](_0x43bca1,{'showHidden':![],'depth':null});}function getContactDialer(_0x8196ed,_0x577834,_0x5e15e6){return cmHopper[_0x0d8b('0x5')](_0x8196ed['id'],_0x577834,_0x5e15e6,_0x8196ed[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x4a4470){_0x8196ed[_0x0d8b('0x8')]-=_0x5e15e6;if(_0x8196ed[_0x0d8b('0x8')]<0x0){_0x8196ed['temp']=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xa'),inspectError(_0x4a4470));});}exports[_0x0d8b('0x5')]=getContactDialer;function getContactDialerIvr(_0x1f4800,_0x28ff7f){return cmHopper[_0x0d8b('0xb')](_0x1f4800['id'],_0x28ff7f,_0x1f4800[_0x0d8b('0x6')])[_0x0d8b('0x7')](function(_0x48fa16){_0x1f4800[_0x0d8b('0x8')]-=_0x28ff7f;if(_0x1f4800['temp']<0x0){_0x1f4800[_0x0d8b('0x8')]=0x0;}logger[_0x0d8b('0x9')](_0x0d8b('0xc'),inspectError(_0x48fa16));});}exports[_0x0d8b('0xb')]=getContactDialerIvr;function countReScheduled(_0x35a07b){return cmHopper[_0x0d8b('0xd')](_0x35a07b)[_0x0d8b('0x7')](function(_0x31a8cc){logger[_0x0d8b('0x9')](_0x0d8b('0xe'),inspectError(_0x31a8cc));});}exports[_0x0d8b('0xd')]=countReScheduled;function rescheduleContact(_0xe65334){return cmHopper[_0x0d8b('0xf')](_0xe65334)[_0x0d8b('0x7')](function(_0x4f6f21){logger[_0x0d8b('0x9')](_0x0d8b('0x10'),inspectError(_0x4f6f21));});}exports[_0x0d8b('0xf')]=rescheduleContact;function unlockContact(_0xe2e167,_0x2cb03c,_0x5cd485){return cmHopper[_0x0d8b('0x11')](_0xe2e167,_0x2cb03c,_0x5cd485)[_0x0d8b('0x7')](function(_0x2fd0fc){logger[_0x0d8b('0x9')](_0x0d8b('0x12'),inspectError(_0x2fd0fc));});}exports[_0x0d8b('0x11')]=unlockContact;function moveContactManagedDialer(_0x264b39){return cmHopper[_0x0d8b('0x13')](_0x264b39)['catch'](function(_0x27512e){logger[_0x0d8b('0x9')](_0x0d8b('0x14'),inspectError(_0x27512e));});}exports[_0x0d8b('0x13')]=moveContactManagedDialer;function checkIsBlackList(_0x24e8ed){return cmHopperBlack[_0x0d8b('0x15')](_0x24e8ed)[_0x0d8b('0x7')](function(_0x352c17){logger['error']('[checkIsBlackList]',inspectError(_0x352c17));});}exports[_0x0d8b('0x15')]=checkIsBlackList;function checkIsBlackListIvr(_0x54a9a7){return cmHopperBlack['checkIsBlackListIvr'](_0x54a9a7)['catch'](function(_0x238728){logger[_0x0d8b('0x9')](_0x0d8b('0x16'),inspectError(_0x238728));});}exports[_0x0d8b('0x17')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x221071,_0x2c64e2,_0x30980c){return cmHopperAdditionalPhone[_0x0d8b('0x18')](_0x221071,_0x2c64e2,_0x30980c)[_0x0d8b('0x7')](function(_0x5e5bc3){logger[_0x0d8b('0x9')](_0x0d8b('0x19'),inspectError(_0x5e5bc3));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xe1ef20,_0x4a0ae4,_0x3dd149){return cmHopperAdditionalPhone[_0x0d8b('0x1a')](_0xe1ef20,_0x4a0ae4,_0x3dd149)[_0x0d8b('0x7')](function(_0x4fe6f9){logger['error'](_0x0d8b('0x1b'),inspectError(_0x4fe6f9));});}exports[_0x0d8b('0x1a')]=swapAdditionalPhones;function avgHandleTime(_0x4c05ee){return cmHopperHistory[_0x0d8b('0x1c')](_0x4c05ee)['catch'](function(_0x1b2b59){logger['error'](_0x0d8b('0x1d'),inspectError(_0x1b2b59));});}exports['avgHandleTime']=avgHandleTime;function createHistory(_0x2ab00d){return cmHopperHistory['createHistory'](_0x2ab00d)[_0x0d8b('0x7')](function(_0x544735){logger[_0x0d8b('0x9')](_0x0d8b('0x1e'),inspectError(_0x544735));});}exports[_0x0d8b('0x1f')]=createHistory; \ No newline at end of file +var _0xb10b=['[createHistory]','util','dialer','../../rpc/cmHopper','../../rpc/cmHopperAdditionalPhone','../../rpc/cmHopperHistory','inspect','dialOrderByScheduledAt','catch','temp','error','[getContactDialer]','getContactDialer','[getContactDialerIvr]','getContactDialerIvr','countReScheduled','[countReScheduled]','rescheduleContact','[rescheduleContact]','unlockContact','[unlockContact]','moveContactManagedDialer','[moveContactManagedDialer]','checkIsBlackList','[checkIsBlackList]','checkIsBlackListIvr','[checkIsBlackListIvr]','verifyAdditionalPhones','[swapAdditionalPhone]','swapAdditionalPhones','avgHandleTime','[avgHandleTime]','createHistory'];(function(_0x4820ca,_0x4da03a){var _0x1da0a3=function(_0x2d8501){while(--_0x2d8501){_0x4820ca['push'](_0x4820ca['shift']());}};_0x1da0a3(++_0x4da03a);}(_0xb10b,0x12a));var _0xbb10=function(_0x18f784,_0x2a538f){_0x18f784=_0x18f784-0x0;var _0x4cd072=_0xb10b[_0x18f784];return _0x4cd072;};'use strict';var util=require(_0xbb10('0x0'));var logger=require('../../../../config/logger')(_0xbb10('0x1'));var cmHopper=require(_0xbb10('0x2'));var cmHopperAdditionalPhone=require(_0xbb10('0x3'));var cmHopperBlack=require('../../rpc/cmHopperBlack');var cmHopperHistory=require(_0xbb10('0x4'));function inspectError(_0x9bbed){return util[_0xbb10('0x5')](_0x9bbed,{'showHidden':![],'depth':null});}function getContactDialer(_0x22320e,_0x49baf4,_0x312b72){return cmHopper['getContactDialer'](_0x22320e['id'],_0x49baf4,_0x312b72,_0x22320e[_0xbb10('0x6')])[_0xbb10('0x7')](function(_0x513741){_0x22320e[_0xbb10('0x8')]-=_0x312b72;if(_0x22320e[_0xbb10('0x8')]<0x0){_0x22320e[_0xbb10('0x8')]=0x0;}logger[_0xbb10('0x9')](_0xbb10('0xa'),inspectError(_0x513741));});}exports[_0xbb10('0xb')]=getContactDialer;function getContactDialerIvr(_0x229887,_0xa3adc8){return cmHopper['getContactDialerIvr'](_0x229887['id'],_0xa3adc8,_0x229887['dialOrderByScheduledAt'])[_0xbb10('0x7')](function(_0x118a74){_0x229887[_0xbb10('0x8')]-=_0xa3adc8;if(_0x229887['temp']<0x0){_0x229887[_0xbb10('0x8')]=0x0;}logger['error'](_0xbb10('0xc'),inspectError(_0x118a74));});}exports[_0xbb10('0xd')]=getContactDialerIvr;function countReScheduled(_0x285009){return cmHopper[_0xbb10('0xe')](_0x285009)[_0xbb10('0x7')](function(_0x147230){logger['error'](_0xbb10('0xf'),inspectError(_0x147230));});}exports[_0xbb10('0xe')]=countReScheduled;function rescheduleContact(_0x45b9d6){return cmHopper[_0xbb10('0x10')](_0x45b9d6)[_0xbb10('0x7')](function(_0x2f2ebf){logger[_0xbb10('0x9')](_0xbb10('0x11'),inspectError(_0x2f2ebf));});}exports[_0xbb10('0x10')]=rescheduleContact;function unlockContact(_0x2b184e,_0x4a2bfc,_0x2eca0f){return cmHopper[_0xbb10('0x12')](_0x2b184e,_0x4a2bfc,_0x2eca0f)[_0xbb10('0x7')](function(_0x42db98){logger[_0xbb10('0x9')](_0xbb10('0x13'),inspectError(_0x42db98));});}exports[_0xbb10('0x12')]=unlockContact;function moveContactManagedDialer(_0x30efc6){return cmHopper[_0xbb10('0x14')](_0x30efc6)[_0xbb10('0x7')](function(_0x48b6e9){logger[_0xbb10('0x9')](_0xbb10('0x15'),inspectError(_0x48b6e9));});}exports[_0xbb10('0x14')]=moveContactManagedDialer;function checkIsBlackList(_0x109908){return cmHopperBlack[_0xbb10('0x16')](_0x109908)[_0xbb10('0x7')](function(_0x4deb49){logger[_0xbb10('0x9')](_0xbb10('0x17'),inspectError(_0x4deb49));});}exports['checkIsBlackList']=checkIsBlackList;function checkIsBlackListIvr(_0x4c4b0d){return cmHopperBlack[_0xbb10('0x18')](_0x4c4b0d)[_0xbb10('0x7')](function(_0x2e911d){logger[_0xbb10('0x9')](_0xbb10('0x19'),inspectError(_0x2e911d));});}exports[_0xbb10('0x18')]=checkIsBlackListIvr;function verifyAdditionalPhones(_0x407cb4,_0x436104,_0x7f2377){return cmHopperAdditionalPhone[_0xbb10('0x1a')](_0x407cb4,_0x436104,_0x7f2377)[_0xbb10('0x7')](function(_0x26ad93){logger['error']('[verifyAdditionalPhone]',inspectError(_0x26ad93));});}exports['verifyAdditionalPhones']=verifyAdditionalPhones;function swapAdditionalPhones(_0xc93a04,_0x3c5ae7,_0x2c89b9){return cmHopperAdditionalPhone['swapAdditionalPhones'](_0xc93a04,_0x3c5ae7,_0x2c89b9)[_0xbb10('0x7')](function(_0x24d586){logger[_0xbb10('0x9')](_0xbb10('0x1b'),inspectError(_0x24d586));});}exports[_0xbb10('0x1c')]=swapAdditionalPhones;function avgHandleTime(_0x20d946){return cmHopperHistory[_0xbb10('0x1d')](_0x20d946)['catch'](function(_0x3796c7){logger[_0xbb10('0x9')](_0xbb10('0x1e'),inspectError(_0x3796c7));});}exports[_0xbb10('0x1d')]=avgHandleTime;function createHistory(_0x1d30aa){return cmHopperHistory[_0xbb10('0x1f')](_0x1d30aa)['catch'](function(_0x221624){logger['error'](_0xbb10('0x20'),inspectError(_0x221624));});}exports['createHistory']=createHistory; \ No newline at end of file diff --git a/server/services/ami/dialer/utils/index.js b/server/services/ami/dialer/utils/index.js index 2b1ddbb..fd4f97e 100644 --- a/server/services/ami/dialer/utils/index.js +++ b/server/services/ami/dialer/utils/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x512d=['toString','error','decrementOriginate','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','lodash','moment','util','../../../../config/logger','dialer','../../../../config/environment/shared','ACTIVE','BLACKLIST','RESCHEDULED_CONTACTS','INTERVAL_IS_EMPTY','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','GLOBAL_INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','RUNNING','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','CAMPAIGN_STATUS','dialMethod','type','ivr','isIVRCampaign','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','diff','getSeconds','message','available','loggedIn','loggedInDb','paused','talking','pTalking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty','Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','SIP/','status','TrunkBackup','includes','INACTIVE','DISACTIVED','NO_AGENTS_LOGGED','UNREACHABLE_TRUNK','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','isUndefined','string','format','\x22%s\x22\x20<%s>','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random'];(function(_0x5a4945,_0x151743){var _0x249feb=function(_0x1bd0f8){while(--_0x1bd0f8){_0x5a4945['push'](_0x5a4945['shift']());}};_0x249feb(++_0x151743);}(_0x512d,0x196));var _0xd512=function(_0x421c12,_0x3935a0){_0x421c12=_0x421c12-0x0;var _0xdf971c=_0x512d[_0x421c12];return _0xdf971c;};'use strict';var _=require(_0xd512('0x0'));var moment=require(_0xd512('0x1'));var util=require(_0xd512('0x2'));var logger=require(_0xd512('0x3'))(_0xd512('0x4'));var timezones=require(_0xd512('0x5'))['timezones'];var CAMPAIGN_STATUS={'ACTIVE':_0xd512('0x6'),'BLACKLIST':_0xd512('0x7'),'CONTACTS_RESCHEDULED':_0xd512('0x8'),'DEACTIVATED':'DEACTIVATED','DISACTIVED':'IS_DISACTIVED','EMPTY_INTERVAL':_0xd512('0x9'),'INACTIVE':_0xd512('0xa'),'NO_AGENTS_LOGGED':_0xd512('0xb'),'NO_AVAILABLE_CONTACTS':_0xd512('0xc'),'NULL_INTERVAL':'INTERVAL_IS_NULL','OVERTIME_INTERVAL':'INTERVAL_IS_OVERTIME','OVERTIME_GLOBAL_INTERVAL':_0xd512('0xd'),'QUEUE_RECALL':_0xd512('0xe'),'RECALL_TIMEOUT':_0xd512('0xf'),'RUNNING':_0xd512('0x10'),'UNKNOWN_TIMEZONE':_0xd512('0x11'),'UNREACHABLE_TRUNK':_0xd512('0x12')};exports[_0xd512('0x13')]=CAMPAIGN_STATUS;function isPreviewCampaign(_0x46d0eb){return _0x46d0eb[_0xd512('0x14')]==='preview';}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0xbee6fd){return _0xbee6fd[_0xd512('0x15')]===_0xd512('0x16');}exports[_0xd512('0x17')]=isIVRCampaign;function isOutboundQueue(_0x59646a){return _0x59646a[_0xd512('0x15')]==='outbound';}exports[_0xd512('0x18')]=isOutboundQueue;function isQueueCampaignActive(_0x513f61){return _0x513f61[_0xd512('0x19')];}exports[_0xd512('0x1a')]=isQueueCampaignActive;function isIVRCampaignActive(_0x4ee923){return _0x4ee923[_0xd512('0x1b')];}exports[_0xd512('0x1c')]=isIVRCampaignActive;function getSeconds(_0x2dd066,_0x5a4129){var _0x1c3855=moment(_0x2dd066)[_0xd512('0x1d')](0x0);var _0x340203=moment(_0x5a4129)['milliseconds'](0x0);return _0x1c3855[_0xd512('0x1e')](_0x340203,'seconds');}exports[_0xd512('0x1f')]=getSeconds;function hasQueueCampaignDataChanged(_0x3cb82e,_0x2fea62){var _0x38848c=![];var _0x1a7834=_0x3cb82e[_0xd512('0x14')]!==_0x2fea62[_0xd512('0x14')]||_0x3cb82e['dialActive']!==_0x2fea62[_0xd512('0x19')]||_0x3cb82e[_0xd512('0x20')]!==_0x2fea62[_0xd512('0x20')];var _0x143beb=_0x3cb82e[_0xd512('0x21')]!==_0x2fea62[_0xd512('0x21')]||_0x3cb82e[_0xd512('0x22')]!==_0x2fea62['loggedIn']||_0x3cb82e[_0xd512('0x23')]!==_0x2fea62['loggedInDb']||_0x3cb82e[_0xd512('0x24')]!==_0x2fea62[_0xd512('0x24')]||_0x3cb82e[_0xd512('0x25')]!==_0x2fea62[_0xd512('0x25')]||_0x3cb82e[_0xd512('0x26')]!==_0x2fea62[_0xd512('0x26')]||_0x3cb82e[_0xd512('0x27')]!==_0x2fea62[_0xd512('0x27')]||_0x3cb82e[_0xd512('0x28')]!==_0x2fea62[_0xd512('0x28')]||_0x3cb82e[_0xd512('0x29')]!==_0x2fea62[_0xd512('0x29')];if(_0x3cb82e[_0xd512('0x2a')]&&_0x2fea62[_0xd512('0x2a')]){_0x38848c=_0x3cb82e[_0xd512('0x2a')][_0xd512('0x2b')]!==_0x2fea62[_0xd512('0x2a')]['name']||_0x3cb82e[_0xd512('0x2a')][_0xd512('0x1b')]!==_0x2fea62[_0xd512('0x2a')]['active'];}return _0x1a7834||_0x143beb||_0x38848c;}exports[_0xd512('0x2c')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x22d2c8){var _0x4d34cc=null;var _0x5c3d0f=_0x22d2c8[_0xd512('0x2d')];if(_[_0xd512('0x2e')](_0x22d2c8[_0xd512('0x2f')])||_['isNil'](_0x22d2c8['Interval'])||_[_0xd512('0x2e')](_0x22d2c8[_0xd512('0x30')]['Intervals'])){_0x4d34cc=CAMPAIGN_STATUS[_0xd512('0x31')];}else if(_[_0xd512('0x32')](_0x22d2c8[_0xd512('0x2f')])||_[_0xd512('0x32')](_0x22d2c8[_0xd512('0x30')][_0xd512('0x33')])){_0x4d34cc=CAMPAIGN_STATUS[_0xd512('0x34')];}else if(_0x5c3d0f&&!timezones[_0x5c3d0f]){_0x4d34cc=CAMPAIGN_STATUS[_0xd512('0x35')];}return _0x4d34cc;}function checkAnyValidTrunk(_0x1313d2,_0x7800de){var _0x2c8bb8=null;var _0x566d9b=_0xd512('0x36');var _0x2fd532=['reachable','unmonitored'];var _0x2362db=!![];if(_0x1313d2['Trunk']&&_0x1313d2['Trunk'][_0xd512('0x1b')]){_0x566d9b+=_0x1313d2[_0xd512('0x2a')]['name'];_0x2c8bb8=_0x7800de[_0x566d9b];_0x2362db=_0x2fd532['includes'](_0x2c8bb8[_0xd512('0x37')]);}else if(_0x1313d2[_0xd512('0x38')]&&_0x1313d2[_0xd512('0x38')][_0xd512('0x1b')]){_0x566d9b+=_0x1313d2[_0xd512('0x38')][_0xd512('0x2b')];_0x2c8bb8=_0x7800de[_0x566d9b];_0x2362db=_0x2fd532[_0xd512('0x39')](_0x2c8bb8['status']);}return _0x2362db;}function getQueueCampaignStatusMessage(_0xa19e4a,_0x573f0a){var _0x2c4b72=CAMPAIGN_STATUS[_0xd512('0x6')];var _0x3f7b1f=isPreviewCampaign(_0xa19e4a);if(!isQueueCampaignActive(_0xa19e4a)){if(_0x3f7b1f){_0x2c4b72=CAMPAIGN_STATUS[_0xd512('0x3a')];}else{if(_0xa19e4a[_0xd512('0x29')]===0x0&&_0xa19e4a[_0xd512('0x25')]===0x0&&_0xa19e4a[_0xd512('0x27')]===0x0&&(_0xa19e4a[_0xd512('0x26')]||0x0)===0x0){_0x2c4b72=CAMPAIGN_STATUS[_0xd512('0x3a')];}else{_0x2c4b72=CAMPAIGN_STATUS[_0xd512('0x3b')];}}}else if(_0xa19e4a['loggedIn']===0x0){_0x2c4b72=CAMPAIGN_STATUS[_0xd512('0x3c')];}else if(!checkAnyValidTrunk(_0xa19e4a,_0x573f0a)){_0x2c4b72=CAMPAIGN_STATUS[_0xd512('0x3d')];}else if(!isPreviewCampaign(_0xa19e4a)){var _0x5a7a2f=checkAnyValidQueueCampaignInterval(_0xa19e4a);if(_0x5a7a2f){_0x2c4b72=_0x5a7a2f;}}return _0x2c4b72;}exports[_0xd512('0x3e')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x2e342c){var _0x2e674f=CAMPAIGN_STATUS['DISACTIVED'];if(_0x2e342c[_0xd512('0x29')]===0x0&&_0x2e342c[_0xd512('0x25')]===0x0&&_0x2e342c['waiting']===0x0&&(_0x2e342c[_0xd512('0x26')]||0x0)===0x0){_0x2e674f=CAMPAIGN_STATUS[_0xd512('0x3a')];}return _0x2e674f;}exports[_0xd512('0x3f')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x2ba320){var _0x5c096c=_0x2ba320['match'](/"(.*?)"/);return _0x5c096c?_0x5c096c[0x1]:_0x2ba320;}exports['extractCalleridName']=extractCalleridName;function getCallerId(_0x53d8bd,_0x53c0f9,_0x1c3fd8){if(!_[_0xd512('0x40')](_0x1c3fd8)&&typeof _0x1c3fd8===_0xd512('0x41')&&!_[_0xd512('0x32')](_0x1c3fd8)){if(!_[_0xd512('0x40')](_0x53c0f9)&&typeof _0x53c0f9===_0xd512('0x41')&&!_[_0xd512('0x32')](_0x53c0f9)){return util[_0xd512('0x42')](_0xd512('0x43'),_0x53c0f9,_0x1c3fd8);}return util[_0xd512('0x42')]('\x22%s\x22\x20<%s>',_0x1c3fd8,_0x1c3fd8);}if(!_[_0xd512('0x40')](_0x53d8bd)&&typeof _0x53d8bd==='string'&&!_['isEmpty'](_0x53d8bd)){return _0x53d8bd;}return _0xd512('0x44');}exports[_0xd512('0x45')]=getCallerId;function getCallerIdRandom(_0x959ea5,_0x63789d){var _0x4e1cc7;var _0x37aa2a;var _0x3d4def;if(_0x63789d<=0x0){_0x63789d=0x1;}_0x4e1cc7=new RegExp(_0xd512('0x46')+_0x63789d+'}$');_0x37aa2a=Math[_0xd512('0x47')](0xa,_0x63789d-0x1);_0x3d4def=Math[_0xd512('0x47')](0xa,_0x63789d)-0x1;return util[_0xd512('0x42')]('%s',_[_0xd512('0x48')](_0x959ea5,_0x4e1cc7,_[_0xd512('0x49')](_0x37aa2a,_0x3d4def)[_0xd512('0x4a')]()));}exports['getCallerIdRandom']=getCallerIdRandom;function decrementOriginate(_0x36952b){if(_0x36952b[_0xd512('0x29')]&&_0x36952b[_0xd512('0x29')]>0x0){_0x36952b['originated']-=0x1;}else{logger[_0xd512('0x4b')]('[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative');}}exports[_0xd512('0x4c')]=decrementOriginate;function checkContactEmpty(_0x529454){return _0x529454&&_0x529454['length']>0x0;}exports[_0xd512('0x4d')]=checkContactEmpty;function erlangb(_0x145fb6,_0x42db0f){if(_0x42db0f===0x0){return 0x0;}var _0xa45383=0x1;for(var _0x38b9a8=0x1;_0x38b9a8<=_0x42db0f;_0x38b9a8+=0x1){_0xa45383=0x1+_0xa45383*_0x38b9a8/_0x145fb6;}return 0x1/_0xa45383;}exports[_0xd512('0x4e')]=erlangb;function checkContactLowerLimitOriginate(_0x384245,_0x33c686,_0x62bdb0){if(_0x33c686>_0x62bdb0){for(var _0x160734=0x0;_0x160734<_0x33c686-_0x62bdb0;_0x160734+=0x1){decrementOriginate(_0x384245);}}}exports[_0xd512('0x4f')]=checkContactLowerLimitOriginate; \ No newline at end of file +var _0x682b=['Intervals','EMPTY_INTERVAL','UNKNOWN_TIMEZONE','reachable','unmonitored','status','TrunkBackup','includes','INACTIVE','pTalking','DISACTIVED','loggedIn','getQueueCampaignStatusMessage','getQueueCampaignActiveStatusMessage','match','extractCalleridName','isUndefined','string','format','\x22\x22\x20<>','getCallerId','\x5cw{0,','pow','replace','random','toString','getCallerIdRandom','[decrementOriginate]\x20queue\x20originate\x20value\x20is\x20negative','decrementOriginate','length','checkContactEmpty','erlangb','checkContactLowerLimitOriginate','moment','../../../../config/logger','timezones','ACTIVE','BLACKLIST','DEACTIVATED','IS_DISACTIVED','NOT_ACTIVE','AGENTS_NOT_LOGGED','AVAILABLE_CONTACTS_FINISHED','INTERVAL_IS_NULL','INTERVAL_IS_OVERTIME','RECALLINQUEUE','RECALLFAILEDTIMEOUT','TIMEZONE_UNKNOW','TRUNK_IS_NOT_REACHABLE','dialMethod','preview','type','outbound','isOutboundQueue','dialActive','isQueueCampaignActive','active','isIVRCampaignActive','milliseconds','seconds','getSeconds','message','available','loggedInDb','paused','talking','waiting','inUse','originated','Trunk','name','hasQueueCampaignDataChanged','dialTimezone','isNil','dialGlobalInterval','Interval','NULL_INTERVAL','isEmpty'];(function(_0x1ff0ec,_0x499d6f){var _0x24bfee=function(_0x1cf338){while(--_0x1cf338){_0x1ff0ec['push'](_0x1ff0ec['shift']());}};_0x24bfee(++_0x499d6f);}(_0x682b,0x6f));var _0xb682=function(_0x411017,_0x4a8117){_0x411017=_0x411017-0x0;var _0x2adeea=_0x682b[_0x411017];return _0x2adeea;};'use strict';var _=require('lodash');var moment=require(_0xb682('0x0'));var util=require('util');var logger=require(_0xb682('0x1'))('dialer');var timezones=require('../../../../config/environment/shared')[_0xb682('0x2')];var CAMPAIGN_STATUS={'ACTIVE':_0xb682('0x3'),'BLACKLIST':_0xb682('0x4'),'CONTACTS_RESCHEDULED':'RESCHEDULED_CONTACTS','DEACTIVATED':_0xb682('0x5'),'DISACTIVED':_0xb682('0x6'),'EMPTY_INTERVAL':'INTERVAL_IS_EMPTY','INACTIVE':_0xb682('0x7'),'NO_AGENTS_LOGGED':_0xb682('0x8'),'NO_AVAILABLE_CONTACTS':_0xb682('0x9'),'NULL_INTERVAL':_0xb682('0xa'),'OVERTIME_INTERVAL':_0xb682('0xb'),'OVERTIME_GLOBAL_INTERVAL':'GLOBAL_INTERVAL_IS_OVERTIME','QUEUE_RECALL':_0xb682('0xc'),'RECALL_TIMEOUT':_0xb682('0xd'),'RUNNING':'RUNNING','UNKNOWN_TIMEZONE':_0xb682('0xe'),'UNREACHABLE_TRUNK':_0xb682('0xf')};exports['CAMPAIGN_STATUS']=CAMPAIGN_STATUS;function isPreviewCampaign(_0x99a5db){return _0x99a5db[_0xb682('0x10')]===_0xb682('0x11');}exports['isPreviewCampaign']=isPreviewCampaign;function isIVRCampaign(_0xe11a6b){return _0xe11a6b[_0xb682('0x12')]==='ivr';}exports['isIVRCampaign']=isIVRCampaign;function isOutboundQueue(_0x10c743){return _0x10c743['type']===_0xb682('0x13');}exports[_0xb682('0x14')]=isOutboundQueue;function isQueueCampaignActive(_0x2a28d8){return _0x2a28d8[_0xb682('0x15')];}exports[_0xb682('0x16')]=isQueueCampaignActive;function isIVRCampaignActive(_0x54bff8){return _0x54bff8[_0xb682('0x17')];}exports[_0xb682('0x18')]=isIVRCampaignActive;function getSeconds(_0x1905a4,_0x58db27){var _0xb4964c=moment(_0x1905a4)['milliseconds'](0x0);var _0x53f11d=moment(_0x58db27)[_0xb682('0x19')](0x0);return _0xb4964c['diff'](_0x53f11d,_0xb682('0x1a'));}exports[_0xb682('0x1b')]=getSeconds;function hasQueueCampaignDataChanged(_0x329551,_0x1c70b8){var _0x426bfe=![];var _0x588a21=_0x329551['dialMethod']!==_0x1c70b8['dialMethod']||_0x329551[_0xb682('0x15')]!==_0x1c70b8[_0xb682('0x15')]||_0x329551[_0xb682('0x1c')]!==_0x1c70b8[_0xb682('0x1c')];var _0x396edc=_0x329551['available']!==_0x1c70b8[_0xb682('0x1d')]||_0x329551['loggedIn']!==_0x1c70b8['loggedIn']||_0x329551[_0xb682('0x1e')]!==_0x1c70b8[_0xb682('0x1e')]||_0x329551[_0xb682('0x1f')]!==_0x1c70b8[_0xb682('0x1f')]||_0x329551[_0xb682('0x20')]!==_0x1c70b8['talking']||_0x329551['pTalking']!==_0x1c70b8['pTalking']||_0x329551[_0xb682('0x21')]!==_0x1c70b8[_0xb682('0x21')]||_0x329551[_0xb682('0x22')]!==_0x1c70b8[_0xb682('0x22')]||_0x329551['originated']!==_0x1c70b8[_0xb682('0x23')];if(_0x329551[_0xb682('0x24')]&&_0x1c70b8[_0xb682('0x24')]){_0x426bfe=_0x329551[_0xb682('0x24')][_0xb682('0x25')]!==_0x1c70b8['Trunk']['name']||_0x329551[_0xb682('0x24')][_0xb682('0x17')]!==_0x1c70b8[_0xb682('0x24')][_0xb682('0x17')];}return _0x588a21||_0x396edc||_0x426bfe;}exports[_0xb682('0x26')]=hasQueueCampaignDataChanged;function checkAnyValidQueueCampaignInterval(_0x58fd28){var _0x35a94d=null;var _0x4fd35f=_0x58fd28[_0xb682('0x27')];if(_[_0xb682('0x28')](_0x58fd28[_0xb682('0x29')])||_[_0xb682('0x28')](_0x58fd28[_0xb682('0x2a')])||_[_0xb682('0x28')](_0x58fd28[_0xb682('0x2a')]['Intervals'])){_0x35a94d=CAMPAIGN_STATUS[_0xb682('0x2b')];}else if(_['isEmpty'](_0x58fd28[_0xb682('0x29')])||_[_0xb682('0x2c')](_0x58fd28[_0xb682('0x2a')][_0xb682('0x2d')])){_0x35a94d=CAMPAIGN_STATUS[_0xb682('0x2e')];}else if(_0x4fd35f&&!timezones[_0x4fd35f]){_0x35a94d=CAMPAIGN_STATUS[_0xb682('0x2f')];}return _0x35a94d;}function checkAnyValidTrunk(_0x488b0d,_0x4b4db5){var _0x532e5d=null;var _0x7f7b8d='SIP/';var _0x49514b=[_0xb682('0x30'),_0xb682('0x31')];var _0x2d76a3=!![];if(_0x488b0d[_0xb682('0x24')]&&_0x488b0d[_0xb682('0x24')]['active']){_0x7f7b8d+=_0x488b0d[_0xb682('0x24')]['name'];_0x532e5d=_0x4b4db5[_0x7f7b8d];_0x2d76a3=_0x49514b['includes'](_0x532e5d[_0xb682('0x32')]);}else if(_0x488b0d[_0xb682('0x33')]&&_0x488b0d[_0xb682('0x33')][_0xb682('0x17')]){_0x7f7b8d+=_0x488b0d[_0xb682('0x33')][_0xb682('0x25')];_0x532e5d=_0x4b4db5[_0x7f7b8d];_0x2d76a3=_0x49514b[_0xb682('0x34')](_0x532e5d[_0xb682('0x32')]);}return _0x2d76a3;}function getQueueCampaignStatusMessage(_0xc69731,_0x2be835){var _0x1f625f=CAMPAIGN_STATUS[_0xb682('0x3')];var _0x57ae02=isPreviewCampaign(_0xc69731);if(!isQueueCampaignActive(_0xc69731)){if(_0x57ae02){_0x1f625f=CAMPAIGN_STATUS[_0xb682('0x35')];}else{if(_0xc69731[_0xb682('0x23')]===0x0&&_0xc69731[_0xb682('0x20')]===0x0&&_0xc69731[_0xb682('0x21')]===0x0&&(_0xc69731[_0xb682('0x36')]||0x0)===0x0){_0x1f625f=CAMPAIGN_STATUS[_0xb682('0x35')];}else{_0x1f625f=CAMPAIGN_STATUS[_0xb682('0x37')];}}}else if(_0xc69731[_0xb682('0x38')]===0x0){_0x1f625f=CAMPAIGN_STATUS['NO_AGENTS_LOGGED'];}else if(!checkAnyValidTrunk(_0xc69731,_0x2be835)){_0x1f625f=CAMPAIGN_STATUS['UNREACHABLE_TRUNK'];}else if(!isPreviewCampaign(_0xc69731)){var _0x8288bd=checkAnyValidQueueCampaignInterval(_0xc69731);if(_0x8288bd){_0x1f625f=_0x8288bd;}}return _0x1f625f;}exports[_0xb682('0x39')]=getQueueCampaignStatusMessage;function getQueueCampaignActiveStatusMessage(_0x3f66cc){var _0x521251=CAMPAIGN_STATUS['DISACTIVED'];if(_0x3f66cc[_0xb682('0x23')]===0x0&&_0x3f66cc['talking']===0x0&&_0x3f66cc['waiting']===0x0&&(_0x3f66cc['pTalking']||0x0)===0x0){_0x521251=CAMPAIGN_STATUS[_0xb682('0x35')];}return _0x521251;}exports[_0xb682('0x3a')]=getQueueCampaignActiveStatusMessage;function extractCalleridName(_0x4a9da3){var _0x4daf2d=_0x4a9da3[_0xb682('0x3b')](/"(.*?)"/);return _0x4daf2d?_0x4daf2d[0x1]:_0x4a9da3;}exports[_0xb682('0x3c')]=extractCalleridName;function getCallerId(_0x7eb9ef,_0x2dc40e,_0x218570){if(!_[_0xb682('0x3d')](_0x218570)&&typeof _0x218570==='string'&&!_[_0xb682('0x2c')](_0x218570)){if(!_['isUndefined'](_0x2dc40e)&&typeof _0x2dc40e===_0xb682('0x3e')&&!_[_0xb682('0x2c')](_0x2dc40e)){return util['format']('\x22%s\x22\x20<%s>',_0x2dc40e,_0x218570);}return util[_0xb682('0x3f')]('\x22%s\x22\x20<%s>',_0x218570,_0x218570);}if(!_['isUndefined'](_0x7eb9ef)&&typeof _0x7eb9ef===_0xb682('0x3e')&&!_['isEmpty'](_0x7eb9ef)){return _0x7eb9ef;}return _0xb682('0x40');}exports[_0xb682('0x41')]=getCallerId;function getCallerIdRandom(_0x49f2d9,_0x2fabad){var _0x1e4cdf;var _0x2ec21e;var _0x36a1bc;if(_0x2fabad<=0x0){_0x2fabad=0x1;}_0x1e4cdf=new RegExp(_0xb682('0x42')+_0x2fabad+'}$');_0x2ec21e=Math[_0xb682('0x43')](0xa,_0x2fabad-0x1);_0x36a1bc=Math[_0xb682('0x43')](0xa,_0x2fabad)-0x1;return util[_0xb682('0x3f')]('%s',_[_0xb682('0x44')](_0x49f2d9,_0x1e4cdf,_[_0xb682('0x45')](_0x2ec21e,_0x36a1bc)[_0xb682('0x46')]()));}exports[_0xb682('0x47')]=getCallerIdRandom;function decrementOriginate(_0xd27387){if(_0xd27387[_0xb682('0x23')]&&_0xd27387[_0xb682('0x23')]>0x0){_0xd27387[_0xb682('0x23')]-=0x1;}else{logger['error'](_0xb682('0x48'));}}exports[_0xb682('0x49')]=decrementOriginate;function checkContactEmpty(_0x47e122){return _0x47e122&&_0x47e122[_0xb682('0x4a')]>0x0;}exports[_0xb682('0x4b')]=checkContactEmpty;function erlangb(_0x59ca55,_0x455e17){if(_0x455e17===0x0){return 0x0;}var _0x1040b0=0x1;for(var _0x475141=0x1;_0x475141<=_0x455e17;_0x475141+=0x1){_0x1040b0=0x1+_0x1040b0*_0x475141/_0x59ca55;}return 0x1/_0x1040b0;}exports[_0xb682('0x4c')]=erlangb;function checkContactLowerLimitOriginate(_0x3576d3,_0x4af582,_0x4442ef){if(_0x4af582>_0x4442ef){for(var _0x5413c5=0x0;_0x5413c5<_0x4af582-_0x4442ef;_0x5413c5+=0x1){decrementOriginate(_0x3576d3);}}}exports[_0xb682('0x4d')]=checkContactLowerLimitOriginate; \ No newline at end of file diff --git a/server/services/ami/fax/action.js b/server/services/ami/fax/action.js index d030402..633f5d7 100644 --- a/server/services/ami/fax/action.js +++ b/server/services/ami/fax/action.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x32bf6f,_0x51a0dc){var _0x4b5648=function(_0x2ffa89){while(--_0x2ffa89){_0x32bf6f['push'](_0x32bf6f['shift']());}};_0x4b5648(++_0x51a0dc);}(_0xa9e0,0x123));var _0x0a9e=function(_0x3a6efd,_0x2a5102){_0x3a6efd=_0x3a6efd-0x0;var _0x487b9a=_0xa9e0[_0x3a6efd];return _0x487b9a;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file +var _0xa9e0=['fax','localstationid','path','AttachmentId','exports','util','lodash','moment','channel','format','%s/%s/%s','tech','Trunk'];(function(_0x5518e4,_0x4ca30a){var _0x1f52f7=function(_0x2936d0){while(--_0x2936d0){_0x5518e4['push'](_0x5518e4['shift']());}};_0x1f52f7(++_0x4ca30a);}(_0xa9e0,0x123));var _0x0a9e=function(_0xf0bcac,_0x531755){_0xf0bcac=_0xf0bcac-0x0;var _0x4e4c65=_0xa9e0[_0xf0bcac];return _0x4e4c65;};'use strict';var util=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var moment=require(_0x0a9e('0x2'));function Action(_0x5dd881,_0x550fbc,_0x18d5c9){this['uniqueid']=_0x5dd881||undefined;this[_0x0a9e('0x3')]=util[_0x0a9e('0x4')](_0x0a9e('0x5'),_0x550fbc[_0x0a9e('0x6')],_0x550fbc[_0x0a9e('0x7')]['name'],_0x18d5c9[_0x0a9e('0x8')]);this[_0x0a9e('0x9')]=_0x550fbc[_0x0a9e('0x9')];this['headerinfo']=_0x550fbc['headerinfo'];this[_0x0a9e('0xa')]=_0x18d5c9['path'];this['AttachmentId']=_0x18d5c9[_0x0a9e('0xb')];}module[_0x0a9e('0xc')]=Action; \ No newline at end of file diff --git a/server/services/ami/fax/index.js b/server/services/ami/fax/index.js index 24df664..5d3c2ba 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 _0x10a9=['localstationid','filename','remotestationid','pagestransferred','resolution','transferrate','calleridnum','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','then','notify','catch','error','\x20notify\x20','\x20receiveFax\x20','stringify','merge','pick','response','reason','AttachmentId','update','logger','[Fax][Message][Error][NoUpdate1]','[Fax][Message][Error][NoUpdate2]','updateStatus','actions','[Fax][Message][NoUpdate1]','[Fax][Message][NoUpdate2]','\x20hangup\x20sendFile\x20','faxpages','SUCCESS','faxstatusstring','SENDING\x20FAILED','send','execOriginate','FaxAccountId','Fax\x20received','[Fax][execOriginate][failure]','Fax\x20failed','checkTrunk','Trunk','format','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','variablesAction','Action','addVariables','ext','isTrunkReachable','isNil','active','SIP/%s','reachable','unmonitored','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','\x20Trunk\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','[Fax][checkTrunk][Empty\x20Fax]','Is\x20Valid','exports','util','lodash','bluebird','uuid','moment','path','tiff2pdf','./util/gs','fax','../ami','./channel','./action','../rpc/faxAccount','../rpc/attachment','channels','trunks','newchannel','syncNewchannel','varset','syncVarSet','bind','newstate','syncNewState','newexten','faxstatus','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','originateresponse','syncOriginateResponse','prototype','context','faxAccounts','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','variable','value','channelstate','channelstatedesc','syncNewExten','operation','status'];(function(_0x5c351c,_0x2046d8){var _0x26f3b3=function(_0x47ac18){while(--_0x47ac18){_0x5c351c['push'](_0x5c351c['shift']());}};_0x26f3b3(++_0x2046d8);}(_0x10a9,0xb7));var _0x910a=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x10a9[_0x432682];return _0x463d05;};'use strict';var util=require(_0x910a('0x0'));var _=require(_0x910a('0x1'));var BPromise=require(_0x910a('0x2'));var uuid=require(_0x910a('0x3'));var moment=require(_0x910a('0x4'));var path=require(_0x910a('0x5'));var tiff2pdf=require(_0x910a('0x6'));var gs=require(_0x910a('0x7'));var logger=require('../../../config/logger')(_0x910a('0x8'));var ami=require(_0x910a('0x9'));var rpcDb=require('./rpcDb');var Channel=require(_0x910a('0xa'));var ut=require('./util/util');var Action=require(_0x910a('0xb'));var faxAccount=require(_0x910a('0xc'));var attachment=require(_0x910a('0xd'));var faxMessage=require('../rpc/faxMessage');function Fax(_0xa08d68){this[_0x910a('0xe')]={};this['faxAccounts']=_0xa08d68['faxAccounts'];this['trunks']=_0xa08d68[_0x910a('0xf')];this['actions']={};ami['on'](_0x910a('0x10'),this[_0x910a('0x11')]['bind'](this));ami['on'](_0x910a('0x12'),this[_0x910a('0x13')][_0x910a('0x14')](this));ami['on'](_0x910a('0x15'),this[_0x910a('0x16')][_0x910a('0x14')](this));ami['on'](_0x910a('0x17'),this['syncNewExten'][_0x910a('0x14')](this));ami['on'](_0x910a('0x18'),this[_0x910a('0x19')][_0x910a('0x14')](this));ami['on'](_0x910a('0x1a'),this[_0x910a('0x1b')]['bind'](this));ami['on'](_0x910a('0x1c'),this[_0x910a('0x1d')][_0x910a('0x14')](this));ami['on'](_0x910a('0x1e'),this[_0x910a('0x1f')][_0x910a('0x14')](this));}Fax[_0x910a('0x20')]['syncNewchannel']=function(_0x2b047b){if(_0x2b047b[_0x910a('0x21')]==='from-voip-provider'){for(var _0xad6c1f in this[_0x910a('0x22')]){if(this[_0x910a('0x22')][_0x910a('0x23')](_0xad6c1f)){if(_0x2b047b[_0x910a('0x24')]===this[_0x910a('0x22')][_0xad6c1f]['localstationid']){this[_0x910a('0xe')][_0x2b047b[_0x910a('0x25')]]={};this['channels'][_0x2b047b[_0x910a('0x25')]][_0x910a('0x26')]=_0x2b047b[_0x910a('0x26')];this['channels'][_0x2b047b[_0x910a('0x25')]]['id']=this['faxAccounts'][_0xad6c1f]['id'];this[_0x910a('0xe')][_0x2b047b[_0x910a('0x25')]][_0x910a('0x27')]=this[_0x910a('0x22')][_0xad6c1f][_0x910a('0x27')];logger[_0x910a('0x28')](_0x2b047b[_0x910a('0x25')],_0x910a('0x29'));}}}}if(this['actions'][_0x2b047b[_0x910a('0x25')]]){this[_0x910a('0xe')][_0x2b047b[_0x910a('0x25')]]={};this[_0x910a('0xe')][_0x2b047b[_0x910a('0x25')]][_0x910a('0x26')]=_0x2b047b['channel'];logger[_0x910a('0x28')](_0x2b047b['uniqueid'],'\x20syncNewchannel\x20');}};Fax[_0x910a('0x20')][_0x910a('0x13')]=function(_0x2c72ad){if(this[_0x910a('0xe')][_0x2c72ad[_0x910a('0x25')]]){for(var _0x13ab64 in _0x2c72ad['variable']){if(_0x2c72ad[_0x910a('0x2a')][_0x910a('0x23')](_0x13ab64)){this['channels'][_0x2c72ad[_0x910a('0x25')]][_0x13ab64]=_0x2c72ad[_0x910a('0x2b')];}}}};Fax[_0x910a('0x20')][_0x910a('0x16')]=function(_0x1f3352){if(this[_0x910a('0xe')][_0x1f3352['uniqueid']]){this['channels'][_0x1f3352[_0x910a('0x25')]][_0x910a('0x2c')]=_0x1f3352[_0x910a('0x2c')];this['channels'][_0x1f3352[_0x910a('0x25')]][_0x910a('0x2d')]=_0x1f3352[_0x910a('0x2d')];}};Fax[_0x910a('0x20')][_0x910a('0x2e')]=function(_0x3b0c68){if(this['channels'][_0x3b0c68[_0x910a('0x25')]]){for(var _0x1ce875 in _0x3b0c68['variable']){if(_0x3b0c68[_0x910a('0x2a')]['hasOwnProperty'](_0x1ce875)){this[_0x910a('0xe')][_0x3b0c68[_0x910a('0x25')]][_0x1ce875]=_0x3b0c68[_0x910a('0x2b')];}}}};Fax[_0x910a('0x20')][_0x910a('0x19')]=function(_0x56ca8c){if(this[_0x910a('0xe')][_0x56ca8c[_0x910a('0x25')]]){this['channels'][_0x56ca8c[_0x910a('0x25')]][_0x910a('0x2f')]=_0x56ca8c[_0x910a('0x2f')];this[_0x910a('0xe')][_0x56ca8c[_0x910a('0x25')]][_0x910a('0x30')]=_0x56ca8c[_0x910a('0x30')];this[_0x910a('0xe')][_0x56ca8c[_0x910a('0x25')]][_0x910a('0x31')]=_0x56ca8c['localstationid'];this[_0x910a('0xe')][_0x56ca8c['uniqueid']][_0x910a('0x32')]=_0x56ca8c['filename'];logger['info'](_0x56ca8c[_0x910a('0x25')],'\x20syncFaxStatus\x20');}};Fax[_0x910a('0x20')][_0x910a('0x1b')]=function(_0x4fee02){var _0x3e10b5=this;if(this['channels'][_0x4fee02[_0x910a('0x25')]]){var _0x11831c=this[_0x910a('0xe')][_0x4fee02[_0x910a('0x25')]]['id'];this[_0x910a('0xe')][_0x4fee02[_0x910a('0x25')]][_0x910a('0x33')]=_0x4fee02[_0x910a('0x33')];this[_0x910a('0xe')][_0x4fee02[_0x910a('0x25')]]['pagestransferred']=_0x4fee02[_0x910a('0x34')];this[_0x910a('0xe')][_0x4fee02[_0x910a('0x25')]][_0x910a('0x31')]=_0x4fee02[_0x910a('0x31')];this['channels'][_0x4fee02[_0x910a('0x25')]][_0x910a('0x35')]=_0x4fee02[_0x910a('0x35')];this[_0x910a('0xe')][_0x4fee02[_0x910a('0x25')]]['transferrate']=_0x4fee02[_0x910a('0x36')];this['channels'][_0x4fee02[_0x910a('0x25')]][_0x910a('0x32')]=_0x4fee02[_0x910a('0x32')];this[_0x910a('0xe')][_0x4fee02[_0x910a('0x25')]][_0x910a('0x37')]=_0x4fee02[_0x910a('0x37')];if(this['channels'][_0x4fee02['uniqueid']]['pagestransferred']>0x0){tiff2pdf(_0x4fee02[_0x910a('0x32')],'/var/opt/motion2/server/files/attachments/',function(_0x53dc0e){logger[_0x910a('0x28')](_0x4fee02['uniqueid'],_0x910a('0x38'),_0x53dc0e[_0x910a('0x39')]);attachment[_0x910a('0x3a')]({'name':path[_0x910a('0x3b')](_0x4fee02[_0x910a('0x32')])[_0x910a('0x27')],'basename':path[_0x910a('0x3b')](_0x4fee02[_0x910a('0x32')])['name']+_0x910a('0x3c'),'type':'application/pdf'})[_0x910a('0x3d')](function(_0x15bfb8){faxAccount[_0x910a('0x3e')](_0x11831c,{'from':_0x4fee02[_0x910a('0x37')],'mapKey':_0x910a('0x8'),'body':path[_0x910a('0x3b')](_0x4fee02[_0x910a('0x32')])[_0x910a('0x27')]+_0x910a('0x3c'),'AttachmentId':_0x15bfb8['id']})[_0x910a('0x3f')](function(_0x951992){logger[_0x910a('0x40')](_0x4fee02['uniqueid'],_0x910a('0x41'),JSON['stringify'](_0x951992));});})[_0x910a('0x3f')](function(_0x441d55){logger['error'](_0x4fee02[_0x910a('0x25')],_0x910a('0x42'),JSON[_0x910a('0x43')](_0x441d55));});});}logger[_0x910a('0x28')](_0x4fee02[_0x910a('0x25')],'\x20receiveFax\x20');}};Fax[_0x910a('0x20')][_0x910a('0x1f')]=function(_0x3e0e5f){if(this['actions'][_0x3e0e5f[_0x910a('0x25')]]){_[_0x910a('0x44')](this[_0x910a('0xe')][_0x3e0e5f[_0x910a('0x25')]],_[_0x910a('0x45')](_0x3e0e5f,[_0x910a('0x46'),_0x910a('0x47')]));}};function updateStatus(_0x160181){if(_0x160181[_0x910a('0x48')]){faxMessage[_0x910a('0x49')](_0x160181[_0x910a('0x48')],{'failMessage':'SENDING\x20FAILED\x20'})[_0x910a('0x3d')](function(_0x33d1ae){ut[_0x910a('0x4a')]('[Fax][Message][Error][Updated]',_0x33d1ae);})[_0x910a('0x3f')](function(_0x14dfb7){ut[_0x910a('0x4a')](_0x910a('0x4b'),_0x14dfb7);});}else{ut[_0x910a('0x4a')](_0x910a('0x4c'));}}Fax[_0x910a('0x20')][_0x910a('0x4d')]=function(_0x11cdfc,_0x181d45,_0x2a0a3f){var _0x5a0afe=this;var _0x488f8a={};if(_0x181d45){_0x488f8a={'read':_0x181d45};}else{_0x488f8a={'failMessage':_0x2a0a3f};}if(this[_0x910a('0x4e')][_0x11cdfc]['AttachmentId']){faxMessage[_0x910a('0x49')](this[_0x910a('0x4e')][_0x11cdfc][_0x910a('0x48')],_0x488f8a)['then'](function(_0x132243){ut[_0x910a('0x4a')]('[Fax][Message][Updated]',_0x132243);})[_0x910a('0x3f')](function(_0x5a915d){ut[_0x910a('0x4a')](_0x910a('0x4f'),_0x5a915d);})['finally'](function(){delete _0x5a0afe[_0x910a('0xe')][_0x11cdfc];delete _0x5a0afe[_0x910a('0x4e')][_0x11cdfc];});}else{ut['logger'](_0x910a('0x50'));delete this[_0x910a('0xe')][_0x11cdfc];delete this[_0x910a('0x4e')][_0x11cdfc];}};Fax[_0x910a('0x20')][_0x910a('0x1d')]=function(_0x1b5d28){var _0x5475bb=this;if(this[_0x910a('0xe')][_0x1b5d28['uniqueid']]){if(this['actions'][_0x1b5d28[_0x910a('0x25')]]){this[_0x910a('0xe')][_0x1b5d28[_0x910a('0x25')]]['id']=this[_0x910a('0x4e')][_0x1b5d28[_0x910a('0x25')]]['id'];this[_0x910a('0xe')][_0x1b5d28[_0x910a('0x25')]][_0x910a('0x27')]=this[_0x910a('0x4e')][_0x1b5d28[_0x910a('0x25')]][_0x910a('0x27')];}logger[_0x910a('0x28')](_0x1b5d28[_0x910a('0x25')],this[_0x910a('0x4e')][_0x1b5d28['uniqueid']]?_0x910a('0x51'):'\x20hangup\x20faxRiceive\x20',JSON[_0x910a('0x43')](this[_0x910a('0xe')][_0x1b5d28[_0x910a('0x25')]]));if(this[_0x910a('0x4e')][_0x1b5d28[_0x910a('0x25')]]){if(this[_0x910a('0xe')][_0x1b5d28['uniqueid']][_0x910a('0x52')]>0x0&&this[_0x910a('0xe')][_0x1b5d28[_0x910a('0x25')]]['faxstatus']===_0x910a('0x53')){this[_0x910a('0x4d')](_0x1b5d28[_0x910a('0x25')],!![]);}else{this[_0x910a('0x4d')](_0x1b5d28[_0x910a('0x25')],![],this[_0x910a('0xe')][_0x1b5d28[_0x910a('0x25')]][_0x910a('0x54')]?'SENDING\x20FAILED:\x20'+this['channels'][_0x1b5d28[_0x910a('0x25')]][_0x910a('0x54')]:_0x910a('0x55'));}}}};Fax['prototype'][_0x910a('0x56')]=function(_0x3ce590){var _0x5753a0=this;return new BPromise(function(_0x40eaaa,_0x202cdc){_0x5753a0[_0x910a('0x57')](_0x3ce590,_0x5753a0[_0x910a('0x22')][_0x3ce590[_0x910a('0x58')]])[_0x910a('0x3d')](function(_0x4d1854){ut[_0x910a('0x4a')]('[Fax][execOriginate][success]',_0x4d1854);_0x40eaaa(ut['message'](_0x910a('0x59')));})[_0x910a('0x3f')](function(_0x2f57b9){ut[_0x910a('0x4a')](_0x910a('0x5a'),_0x2f57b9);updateStatus(_0x3ce590);_0x202cdc(ut[_0x910a('0x39')](_0x910a('0x5b')));});});};Fax[_0x910a('0x20')]['checkAfterSend']=function(_0x2a1649){var _0x25a500=this;return new BPromise(function(_0x5d457c,_0x2dd37b){var _0x1b9c76=_0x25a500[_0x910a('0x5c')](_0x25a500[_0x910a('0x22')][_0x2a1649[_0x910a('0x58')]][_0x910a('0x5d')],_0x2a1649);if(_0x1b9c76['isValid']){_0x5d457c(ut[_0x910a('0x39')]('Trunk\x20Reachable'));}else{_0x2dd37b(ut[_0x910a('0x39')](_0x1b9c76['message']));}});};function originate(_0x1479ba,_0x5edd2a,_0x1d2326){return new BPromise(function(_0x6b4bf,_0x3e9085){if(_0x1d2326){var _0x406c42=util[_0x910a('0x5e')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path[_0x910a('0x3b')](_0x1479ba[_0x910a('0x5')])[_0x910a('0x27')],_0x1479ba[_0x910a('0x5')]);gs[_0x910a('0x5f')](_0x406c42)[_0x910a('0x3d')](function(){_0x1479ba['path']=util[_0x910a('0x5e')](_0x910a('0x60'),path[_0x910a('0x3b')](_0x1479ba['path'])[_0x910a('0x61')],path[_0x910a('0x3b')](_0x1479ba[_0x910a('0x5')])[_0x910a('0x27')]);_0x5edd2a[_0x910a('0x62')]=_0x1479ba[_0x910a('0x5')];ut[_0x910a('0x4a')](_0x910a('0x63'),'');ami['Action'](ut[_0x910a('0x64')](_0x1479ba,_0x5edd2a))[_0x910a('0x3d')](function(_0xda94c3){_0x6b4bf(_0xda94c3);})[_0x910a('0x3f')](function(_0x5a90e8){_0x3e9085(_0x5a90e8);});})[_0x910a('0x3f')](function(_0x3600ed){_0x3e9085(_0x3600ed);});}else{ami[_0x910a('0x65')](ut['variablesAction'](_0x1479ba,_0x5edd2a))['then'](function(_0x5dad34){_0x6b4bf(_0x5dad34);})[_0x910a('0x3f')](function(_0x2deef5){_0x3e9085(_0x2deef5);});}});}Fax[_0x910a('0x20')]['execOriginate']=function(_0x24a213,_0xa3d93c){var _0x5713e4=this;return new BPromise(function(_0x13b55d,_0x330c9a){var _0x8c6049=uuid['v4']();var _0x73461d=ut[_0x910a('0x66')](_0x24a213,_0xa3d93c);_0x5713e4[_0x910a('0x4e')][_0x8c6049]=new Action(_0x8c6049,_0xa3d93c,_0x24a213);var _0x31bd05=_0x5713e4['actions'][_0x8c6049];if(path[_0x910a('0x3b')](_0x24a213['path'])[_0x910a('0x67')]===_0x910a('0x3c')){originate(_0x31bd05,_0x73461d,!![])[_0x910a('0x3d')](function(_0x3364d6){_0x13b55d(_0x3364d6);})[_0x910a('0x3f')](function(_0x518f2){_0x330c9a(_0x518f2);});}else{originate(_0x31bd05,_0x73461d,![])[_0x910a('0x3d')](function(_0x2f1311){_0x13b55d(_0x2f1311);})[_0x910a('0x3f')](function(_0x166cd0){_0x330c9a(_0x166cd0);});}});};Fax[_0x910a('0x20')][_0x910a('0x68')]=function(_0x1abaa4){return!_[_0x910a('0x69')](_0x1abaa4)&&!_[_0x910a('0x69')](_0x1abaa4['name'])&&!_[_0x910a('0x69')](_0x1abaa4['active'])&&_0x1abaa4[_0x910a('0x6a')]&&!_[_0x910a('0x69')](this[_0x910a('0xf')][util['format']('SIP/%s',_0x1abaa4[_0x910a('0x27')])])&&!_[_0x910a('0x69')](this[_0x910a('0xf')][util[_0x910a('0x5e')](_0x910a('0x6b'),_0x1abaa4[_0x910a('0x27')])][_0x910a('0x30')])&&(this[_0x910a('0xf')][util[_0x910a('0x5e')]('SIP/%s',_0x1abaa4['name'])][_0x910a('0x30')]===_0x910a('0x6c')||this['trunks'][util[_0x910a('0x5e')](_0x910a('0x6b'),_0x1abaa4['name'])][_0x910a('0x30')]===_0x910a('0x6d'));};Fax['prototype'][_0x910a('0x5c')]=function(_0x85b5e5,_0x2958d8){if(!this[_0x910a('0x68')](_0x85b5e5)){ut['logger'](_0x910a('0x6e'),_[_0x910a('0x69')](_0x85b5e5)?'':_0x85b5e5['name']+_0x910a('0x6f'));return{'isValid':![],'message':_0x910a('0x70')};}if(_[_0x910a('0x69')](_0x2958d8[_0x910a('0x8')])){ut[_0x910a('0x4a')](_0x910a('0x71'),JSON[_0x910a('0x43')](_0x2958d8));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x910a('0x69')](_0x2958d8[_0x910a('0x5')])){ut[_0x910a('0x4a')]('[Fax][checkTrunk][Empty\x20path]',JSON[_0x910a('0x43')](_0x2958d8));return{'isValid':![],'message':'Empty\x20path'};}return{'isValid':!![],'message':_0x910a('0x72')};};module[_0x910a('0x73')]=Fax; \ No newline at end of file +var _0xa643=['syncOriginateResponse','actions','merge','response','reason','AttachmentId','update','logger','[Fax][Message][Error][Updated]','[Fax][Message][Updated]','[Fax][Message][NoUpdate1]','finally','[Fax][Message][NoUpdate2]','\x20hangup\x20faxRiceive\x20','faxpages','faxstatus','SUCCESS','updateStatus','faxstatusstring','SENDING\x20FAILED','FaxAccountId','[Fax][execOriginate][success]','Fax\x20received','Fax\x20failed','checkAfterSend','checkTrunk','Trunk','isValid','Trunk\x20Reachable','format','execute','%s/%s.tif','dir','XMF-PATH','Convert\x20pdf\x20to\x20tif','Action','variablesAction','execOriginate','addVariables','ext','isNil','active','SIP/%s','reachable','isTrunkReachable','[Fax][checkTrunk][Trunk\x20not\x20working\x20correctly]','[Fax][checkTrunk][Empty\x20Fax]','[Fax][checkTrunk][Empty\x20path]','Empty\x20path','Is\x20Valid','exports','lodash','bluebird','uuid','path','tiff2pdf','./util/gs','../../../config/logger','fax','../ami','./channel','./util/util','./action','../rpc/faxAccount','../rpc/attachment','../rpc/faxMessage','channels','faxAccounts','trunks','newchannel','bind','newstate','syncNewState','newexten','syncFaxStatus','receivefax','syncReceiveFax','hangup','syncHangup','prototype','syncNewchannel','context','hasOwnProperty','exten','uniqueid','channel','name','info','\x20syncNewchannel\x20','syncVarSet','variable','channelstate','syncNewExten','value','operation','status','filename','\x20syncFaxStatus\x20','remotestationid','pagestransferred','localstationid','resolution','transferrate','calleridnum','/var/opt/motion2/server/files/attachments/','\x20result\x20conversion\x20file\x20','message','create','parse','.pdf','application/pdf','then','notify','catch','error','\x20notify\x20','stringify','\x20receiveFax\x20'];(function(_0x30ad31,_0x25fe43){var _0x3d53e3=function(_0x2f1830){while(--_0x2f1830){_0x30ad31['push'](_0x30ad31['shift']());}};_0x3d53e3(++_0x25fe43);}(_0xa643,0xa9));var _0x3a64=function(_0x4c38ca,_0x204560){_0x4c38ca=_0x4c38ca-0x0;var _0x2ab767=_0xa643[_0x4c38ca];return _0x2ab767;};'use strict';var util=require('util');var _=require(_0x3a64('0x0'));var BPromise=require(_0x3a64('0x1'));var uuid=require(_0x3a64('0x2'));var moment=require('moment');var path=require(_0x3a64('0x3'));var tiff2pdf=require(_0x3a64('0x4'));var gs=require(_0x3a64('0x5'));var logger=require(_0x3a64('0x6'))(_0x3a64('0x7'));var ami=require(_0x3a64('0x8'));var rpcDb=require('./rpcDb');var Channel=require(_0x3a64('0x9'));var ut=require(_0x3a64('0xa'));var Action=require(_0x3a64('0xb'));var faxAccount=require(_0x3a64('0xc'));var attachment=require(_0x3a64('0xd'));var faxMessage=require(_0x3a64('0xe'));function Fax(_0x165b9f){this[_0x3a64('0xf')]={};this[_0x3a64('0x10')]=_0x165b9f[_0x3a64('0x10')];this[_0x3a64('0x11')]=_0x165b9f[_0x3a64('0x11')];this['actions']={};ami['on'](_0x3a64('0x12'),this['syncNewchannel']['bind'](this));ami['on']('varset',this['syncVarSet'][_0x3a64('0x13')](this));ami['on'](_0x3a64('0x14'),this[_0x3a64('0x15')]['bind'](this));ami['on'](_0x3a64('0x16'),this['syncNewExten'][_0x3a64('0x13')](this));ami['on']('faxstatus',this[_0x3a64('0x17')]['bind'](this));ami['on'](_0x3a64('0x18'),this[_0x3a64('0x19')][_0x3a64('0x13')](this));ami['on'](_0x3a64('0x1a'),this[_0x3a64('0x1b')][_0x3a64('0x13')](this));ami['on']('originateresponse',this['syncOriginateResponse'][_0x3a64('0x13')](this));}Fax[_0x3a64('0x1c')][_0x3a64('0x1d')]=function(_0x20fd19){if(_0x20fd19[_0x3a64('0x1e')]==='from-voip-provider'){for(var _0xc995bc in this[_0x3a64('0x10')]){if(this['faxAccounts'][_0x3a64('0x1f')](_0xc995bc)){if(_0x20fd19[_0x3a64('0x20')]===this['faxAccounts'][_0xc995bc]['localstationid']){this[_0x3a64('0xf')][_0x20fd19[_0x3a64('0x21')]]={};this['channels'][_0x20fd19[_0x3a64('0x21')]][_0x3a64('0x22')]=_0x20fd19[_0x3a64('0x22')];this[_0x3a64('0xf')][_0x20fd19[_0x3a64('0x21')]]['id']=this[_0x3a64('0x10')][_0xc995bc]['id'];this[_0x3a64('0xf')][_0x20fd19[_0x3a64('0x21')]][_0x3a64('0x23')]=this[_0x3a64('0x10')][_0xc995bc][_0x3a64('0x23')];logger[_0x3a64('0x24')](_0x20fd19['uniqueid'],_0x3a64('0x25'));}}}}if(this['actions'][_0x20fd19[_0x3a64('0x21')]]){this['channels'][_0x20fd19[_0x3a64('0x21')]]={};this[_0x3a64('0xf')][_0x20fd19[_0x3a64('0x21')]][_0x3a64('0x22')]=_0x20fd19[_0x3a64('0x22')];logger[_0x3a64('0x24')](_0x20fd19[_0x3a64('0x21')],'\x20syncNewchannel\x20');}};Fax[_0x3a64('0x1c')][_0x3a64('0x26')]=function(_0x4c033c){if(this[_0x3a64('0xf')][_0x4c033c[_0x3a64('0x21')]]){for(var _0x209011 in _0x4c033c[_0x3a64('0x27')]){if(_0x4c033c[_0x3a64('0x27')][_0x3a64('0x1f')](_0x209011)){this['channels'][_0x4c033c[_0x3a64('0x21')]][_0x209011]=_0x4c033c['value'];}}}};Fax[_0x3a64('0x1c')][_0x3a64('0x15')]=function(_0x2c7090){if(this[_0x3a64('0xf')][_0x2c7090[_0x3a64('0x21')]]){this[_0x3a64('0xf')][_0x2c7090[_0x3a64('0x21')]][_0x3a64('0x28')]=_0x2c7090['channelstate'];this[_0x3a64('0xf')][_0x2c7090[_0x3a64('0x21')]]['channelstatedesc']=_0x2c7090['channelstatedesc'];}};Fax[_0x3a64('0x1c')][_0x3a64('0x29')]=function(_0x18da4f){if(this[_0x3a64('0xf')][_0x18da4f[_0x3a64('0x21')]]){for(var _0x4df850 in _0x18da4f[_0x3a64('0x27')]){if(_0x18da4f['variable']['hasOwnProperty'](_0x4df850)){this[_0x3a64('0xf')][_0x18da4f['uniqueid']][_0x4df850]=_0x18da4f[_0x3a64('0x2a')];}}}};Fax[_0x3a64('0x1c')][_0x3a64('0x17')]=function(_0x14aaf8){if(this[_0x3a64('0xf')][_0x14aaf8[_0x3a64('0x21')]]){this['channels'][_0x14aaf8[_0x3a64('0x21')]][_0x3a64('0x2b')]=_0x14aaf8['operation'];this[_0x3a64('0xf')][_0x14aaf8[_0x3a64('0x21')]][_0x3a64('0x2c')]=_0x14aaf8['status'];this['channels'][_0x14aaf8[_0x3a64('0x21')]]['localstationid']=_0x14aaf8['localstationid'];this[_0x3a64('0xf')][_0x14aaf8[_0x3a64('0x21')]]['filename']=_0x14aaf8[_0x3a64('0x2d')];logger[_0x3a64('0x24')](_0x14aaf8[_0x3a64('0x21')],_0x3a64('0x2e'));}};Fax[_0x3a64('0x1c')][_0x3a64('0x19')]=function(_0x3c9233){var _0x4fda1b=this;if(this[_0x3a64('0xf')][_0x3c9233[_0x3a64('0x21')]]){var _0xfe9c16=this[_0x3a64('0xf')][_0x3c9233[_0x3a64('0x21')]]['id'];this[_0x3a64('0xf')][_0x3c9233[_0x3a64('0x21')]][_0x3a64('0x2f')]=_0x3c9233[_0x3a64('0x2f')];this[_0x3a64('0xf')][_0x3c9233[_0x3a64('0x21')]][_0x3a64('0x30')]=_0x3c9233['pagestransferred'];this[_0x3a64('0xf')][_0x3c9233[_0x3a64('0x21')]][_0x3a64('0x31')]=_0x3c9233[_0x3a64('0x31')];this['channels'][_0x3c9233[_0x3a64('0x21')]]['resolution']=_0x3c9233[_0x3a64('0x32')];this[_0x3a64('0xf')][_0x3c9233[_0x3a64('0x21')]][_0x3a64('0x33')]=_0x3c9233['transferrate'];this[_0x3a64('0xf')][_0x3c9233[_0x3a64('0x21')]][_0x3a64('0x2d')]=_0x3c9233[_0x3a64('0x2d')];this[_0x3a64('0xf')][_0x3c9233[_0x3a64('0x21')]][_0x3a64('0x34')]=_0x3c9233['calleridnum'];if(this[_0x3a64('0xf')][_0x3c9233[_0x3a64('0x21')]]['pagestransferred']>0x0){tiff2pdf(_0x3c9233['filename'],_0x3a64('0x35'),function(_0x337171){logger[_0x3a64('0x24')](_0x3c9233[_0x3a64('0x21')],_0x3a64('0x36'),_0x337171[_0x3a64('0x37')]);attachment[_0x3a64('0x38')]({'name':path[_0x3a64('0x39')](_0x3c9233[_0x3a64('0x2d')])['name'],'basename':path[_0x3a64('0x39')](_0x3c9233[_0x3a64('0x2d')])[_0x3a64('0x23')]+_0x3a64('0x3a'),'type':_0x3a64('0x3b')})[_0x3a64('0x3c')](function(_0x40eec0){faxAccount[_0x3a64('0x3d')](_0xfe9c16,{'from':_0x3c9233['calleridnum'],'mapKey':_0x3a64('0x7'),'body':path['parse'](_0x3c9233['filename'])[_0x3a64('0x23')]+_0x3a64('0x3a'),'AttachmentId':_0x40eec0['id']})[_0x3a64('0x3e')](function(_0x410fc3){logger[_0x3a64('0x3f')](_0x3c9233[_0x3a64('0x21')],_0x3a64('0x40'),JSON[_0x3a64('0x41')](_0x410fc3));});})[_0x3a64('0x3e')](function(_0x5c3ca8){logger[_0x3a64('0x3f')](_0x3c9233[_0x3a64('0x21')],_0x3a64('0x42'),JSON[_0x3a64('0x41')](_0x5c3ca8));});});}logger[_0x3a64('0x24')](_0x3c9233[_0x3a64('0x21')],_0x3a64('0x42'));}};Fax[_0x3a64('0x1c')][_0x3a64('0x43')]=function(_0x1e32ea){if(this[_0x3a64('0x44')][_0x1e32ea[_0x3a64('0x21')]]){_[_0x3a64('0x45')](this[_0x3a64('0xf')][_0x1e32ea['uniqueid']],_['pick'](_0x1e32ea,[_0x3a64('0x46'),_0x3a64('0x47')]));}};function updateStatus(_0x2f2a84){if(_0x2f2a84[_0x3a64('0x48')]){faxMessage[_0x3a64('0x49')](_0x2f2a84['AttachmentId'],{'failMessage':'SENDING\x20FAILED\x20'})[_0x3a64('0x3c')](function(_0x4b3196){ut[_0x3a64('0x4a')](_0x3a64('0x4b'),_0x4b3196);})[_0x3a64('0x3e')](function(_0xe7e508){ut[_0x3a64('0x4a')]('[Fax][Message][Error][NoUpdate1]',_0xe7e508);});}else{ut[_0x3a64('0x4a')]('[Fax][Message][Error][NoUpdate2]');}}Fax[_0x3a64('0x1c')]['updateStatus']=function(_0x59bf82,_0x36bcb0,_0x2aec18){var _0x432ce3=this;var _0x3470b0={};if(_0x36bcb0){_0x3470b0={'read':_0x36bcb0};}else{_0x3470b0={'failMessage':_0x2aec18};}if(this[_0x3a64('0x44')][_0x59bf82]['AttachmentId']){faxMessage[_0x3a64('0x49')](this[_0x3a64('0x44')][_0x59bf82][_0x3a64('0x48')],_0x3470b0)[_0x3a64('0x3c')](function(_0x2afc2d){ut['logger'](_0x3a64('0x4c'),_0x2afc2d);})['catch'](function(_0x5d22f7){ut[_0x3a64('0x4a')](_0x3a64('0x4d'),_0x5d22f7);})[_0x3a64('0x4e')](function(){delete _0x432ce3['channels'][_0x59bf82];delete _0x432ce3['actions'][_0x59bf82];});}else{ut[_0x3a64('0x4a')](_0x3a64('0x4f'));delete this[_0x3a64('0xf')][_0x59bf82];delete this[_0x3a64('0x44')][_0x59bf82];}};Fax['prototype'][_0x3a64('0x1b')]=function(_0x2dc538){var _0x1f9a50=this;if(this[_0x3a64('0xf')][_0x2dc538[_0x3a64('0x21')]]){if(this[_0x3a64('0x44')][_0x2dc538[_0x3a64('0x21')]]){this[_0x3a64('0xf')][_0x2dc538[_0x3a64('0x21')]]['id']=this[_0x3a64('0x44')][_0x2dc538[_0x3a64('0x21')]]['id'];this[_0x3a64('0xf')][_0x2dc538[_0x3a64('0x21')]][_0x3a64('0x23')]=this[_0x3a64('0x44')][_0x2dc538[_0x3a64('0x21')]]['name'];}logger[_0x3a64('0x24')](_0x2dc538[_0x3a64('0x21')],this[_0x3a64('0x44')][_0x2dc538[_0x3a64('0x21')]]?'\x20hangup\x20sendFile\x20':_0x3a64('0x50'),JSON[_0x3a64('0x41')](this[_0x3a64('0xf')][_0x2dc538['uniqueid']]));if(this[_0x3a64('0x44')][_0x2dc538[_0x3a64('0x21')]]){if(this['channels'][_0x2dc538['uniqueid']][_0x3a64('0x51')]>0x0&&this['channels'][_0x2dc538[_0x3a64('0x21')]][_0x3a64('0x52')]===_0x3a64('0x53')){this[_0x3a64('0x54')](_0x2dc538[_0x3a64('0x21')],!![]);}else{this[_0x3a64('0x54')](_0x2dc538[_0x3a64('0x21')],![],this[_0x3a64('0xf')][_0x2dc538[_0x3a64('0x21')]][_0x3a64('0x55')]?'SENDING\x20FAILED:\x20'+this[_0x3a64('0xf')][_0x2dc538[_0x3a64('0x21')]]['faxstatusstring']:_0x3a64('0x56'));}}}};Fax[_0x3a64('0x1c')]['send']=function(_0x500598){var _0x49a1bc=this;return new BPromise(function(_0x492045,_0x4558ec){_0x49a1bc['execOriginate'](_0x500598,_0x49a1bc[_0x3a64('0x10')][_0x500598[_0x3a64('0x57')]])[_0x3a64('0x3c')](function(_0x1d31c0){ut[_0x3a64('0x4a')](_0x3a64('0x58'),_0x1d31c0);_0x492045(ut['message'](_0x3a64('0x59')));})[_0x3a64('0x3e')](function(_0x248bfd){ut[_0x3a64('0x4a')]('[Fax][execOriginate][failure]',_0x248bfd);updateStatus(_0x500598);_0x4558ec(ut[_0x3a64('0x37')](_0x3a64('0x5a')));});});};Fax['prototype'][_0x3a64('0x5b')]=function(_0x35af80){var _0x5804f5=this;return new BPromise(function(_0x3cbda9,_0x2d7ff4){var _0x332420=_0x5804f5[_0x3a64('0x5c')](_0x5804f5[_0x3a64('0x10')][_0x35af80[_0x3a64('0x57')]][_0x3a64('0x5d')],_0x35af80);if(_0x332420[_0x3a64('0x5e')]){_0x3cbda9(ut['message'](_0x3a64('0x5f')));}else{_0x2d7ff4(ut[_0x3a64('0x37')](_0x332420[_0x3a64('0x37')]));}});};function originate(_0x332f6c,_0x1692e2,_0x2a23fc){return new BPromise(function(_0x3a3674,_0x3260c9){if(_0x2a23fc){var _0xa5ba61=util[_0x3a64('0x60')]('gs\x20-q\x20-dNOPAUSE\x20-dBATCH\x20-sDEVICE=tiffg4\x20-sPAPERSIZE=letter\x20-sOutputFile=/var/opt/motion2/server/files/attachments/%s.tif\x20\x20%s\x20-c\x20quit',path['parse'](_0x332f6c[_0x3a64('0x3')])[_0x3a64('0x23')],_0x332f6c[_0x3a64('0x3')]);gs[_0x3a64('0x61')](_0xa5ba61)['then'](function(){_0x332f6c[_0x3a64('0x3')]=util[_0x3a64('0x60')](_0x3a64('0x62'),path['parse'](_0x332f6c[_0x3a64('0x3')])[_0x3a64('0x63')],path[_0x3a64('0x39')](_0x332f6c['path'])[_0x3a64('0x23')]);_0x1692e2[_0x3a64('0x64')]=_0x332f6c[_0x3a64('0x3')];ut['logger'](_0x3a64('0x65'),'');ami[_0x3a64('0x66')](ut[_0x3a64('0x67')](_0x332f6c,_0x1692e2))['then'](function(_0x367e82){_0x3a3674(_0x367e82);})[_0x3a64('0x3e')](function(_0x1c67a9){_0x3260c9(_0x1c67a9);});})[_0x3a64('0x3e')](function(_0x1916b5){_0x3260c9(_0x1916b5);});}else{ami[_0x3a64('0x66')](ut['variablesAction'](_0x332f6c,_0x1692e2))[_0x3a64('0x3c')](function(_0x5bfa20){_0x3a3674(_0x5bfa20);})[_0x3a64('0x3e')](function(_0x3079bf){_0x3260c9(_0x3079bf);});}});}Fax[_0x3a64('0x1c')][_0x3a64('0x68')]=function(_0x1271c8,_0x48a806){var _0x2fd5cc=this;return new BPromise(function(_0x79c3ba,_0x4cbf30){var _0x9f51d2=uuid['v4']();var _0x4c6392=ut[_0x3a64('0x69')](_0x1271c8,_0x48a806);_0x2fd5cc[_0x3a64('0x44')][_0x9f51d2]=new Action(_0x9f51d2,_0x48a806,_0x1271c8);var _0x472b3b=_0x2fd5cc[_0x3a64('0x44')][_0x9f51d2];if(path[_0x3a64('0x39')](_0x1271c8['path'])[_0x3a64('0x6a')]===_0x3a64('0x3a')){originate(_0x472b3b,_0x4c6392,!![])['then'](function(_0x2b8667){_0x79c3ba(_0x2b8667);})[_0x3a64('0x3e')](function(_0x3a0ba5){_0x4cbf30(_0x3a0ba5);});}else{originate(_0x472b3b,_0x4c6392,![])[_0x3a64('0x3c')](function(_0x542da8){_0x79c3ba(_0x542da8);})[_0x3a64('0x3e')](function(_0x53887d){_0x4cbf30(_0x53887d);});}});};Fax[_0x3a64('0x1c')]['isTrunkReachable']=function(_0x1e7c12){return!_[_0x3a64('0x6b')](_0x1e7c12)&&!_[_0x3a64('0x6b')](_0x1e7c12[_0x3a64('0x23')])&&!_['isNil'](_0x1e7c12['active'])&&_0x1e7c12[_0x3a64('0x6c')]&&!_[_0x3a64('0x6b')](this[_0x3a64('0x11')][util[_0x3a64('0x60')]('SIP/%s',_0x1e7c12[_0x3a64('0x23')])])&&!_[_0x3a64('0x6b')](this[_0x3a64('0x11')][util['format'](_0x3a64('0x6d'),_0x1e7c12['name'])]['status'])&&(this[_0x3a64('0x11')][util[_0x3a64('0x60')](_0x3a64('0x6d'),_0x1e7c12[_0x3a64('0x23')])]['status']===_0x3a64('0x6e')||this[_0x3a64('0x11')][util['format']('SIP/%s',_0x1e7c12[_0x3a64('0x23')])][_0x3a64('0x2c')]==='unmonitored');};Fax[_0x3a64('0x1c')][_0x3a64('0x5c')]=function(_0x4724ad,_0x5153cb){if(!this[_0x3a64('0x6f')](_0x4724ad)){ut[_0x3a64('0x4a')](_0x3a64('0x70'),_[_0x3a64('0x6b')](_0x4724ad)?'':_0x4724ad[_0x3a64('0x23')]+'\x20Trunk\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}if(_[_0x3a64('0x6b')](_0x5153cb[_0x3a64('0x7')])){ut[_0x3a64('0x4a')](_0x3a64('0x71'),JSON[_0x3a64('0x41')](_0x5153cb));return{'isValid':![],'message':'Empty\x20Fax'};}if(_[_0x3a64('0x6b')](_0x5153cb[_0x3a64('0x3')])){ut[_0x3a64('0x4a')](_0x3a64('0x72'),JSON[_0x3a64('0x41')](_0x5153cb));return{'isValid':![],'message':_0x3a64('0x73')};}return{'isValid':!![],'message':_0x3a64('0x74')};};module[_0x3a64('0x75')]=Fax; \ No newline at end of file diff --git a/server/services/ami/fax/rpcDb.js b/server/services/ami/fax/rpcDb.js index 0ad659c..e610478 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 _0x25bb=['error','inspect','notify','resolve','then','[Notify]\x20','util','../../../config/logger','../rpc/faxAccount'];(function(_0x639f5,_0x453959){var _0x5a5101=function(_0x35cea0){while(--_0x35cea0){_0x639f5['push'](_0x639f5['shift']());}};_0x5a5101(++_0x453959);}(_0x25bb,0xd5));var _0xb25b=function(_0x451ada,_0x1e08d9){_0x451ada=_0x451ada-0x0;var _0x156892=_0x25bb[_0x451ada];return _0x156892;};'use strict';var util=require(_0xb25b('0x0'));var BPromise=require('bluebird');var logger=require(_0xb25b('0x1'))('preview');var _=require('lodash');var faxAccount=require(_0xb25b('0x2'));function loggerCatch(_0x322e37){return function(_0x2f48e7){logger[_0xb25b('0x3')](_0x322e37,util[_0xb25b('0x4')](_0x2f48e7,{'showHidden':![],'depth':null}));};}exports[_0xb25b('0x5')]=function(_0x37f4e3,_0x5c8d85){return BPromise[_0xb25b('0x6')]()[_0xb25b('0x7')](faxAccount[_0xb25b('0x5')](_0x37f4e3,_0x5c8d85))['catch'](loggerCatch(_0xb25b('0x8')));}; \ No newline at end of file +var _0xc1f4=['error','inspect','notify','resolve','then','util','bluebird','preview','lodash','../rpc/faxAccount'];(function(_0x4e808c,_0x3ebb84){var _0x1db4c6=function(_0x211bbf){while(--_0x211bbf){_0x4e808c['push'](_0x4e808c['shift']());}};_0x1db4c6(++_0x3ebb84);}(_0xc1f4,0xc3));var _0x4c1f=function(_0x3ad62c,_0x465700){_0x3ad62c=_0x3ad62c-0x0;var _0x18e4f3=_0xc1f4[_0x3ad62c];return _0x18e4f3;};'use strict';var util=require(_0x4c1f('0x0'));var BPromise=require(_0x4c1f('0x1'));var logger=require('../../../config/logger')(_0x4c1f('0x2'));var _=require(_0x4c1f('0x3'));var faxAccount=require(_0x4c1f('0x4'));function loggerCatch(_0x31b811){return function(_0x321480){logger[_0x4c1f('0x5')](_0x31b811,util[_0x4c1f('0x6')](_0x321480,{'showHidden':![],'depth':null}));};}exports[_0x4c1f('0x7')]=function(_0x4f1478,_0x4666fc){return BPromise[_0x4c1f('0x8')]()[_0x4c1f('0x9')](faxAccount[_0x4c1f('0x7')](_0x4f1478,_0x4666fc))['catch'](loggerCatch('[Notify]\x20'));}; \ No newline at end of file diff --git a/server/services/ami/fax/util/gs.js b/server/services/ami/fax/util/gs.js index 822d449..3a56fb5 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 _0x8aea=['child_process','exec','execute','info','Exec\x20gs','\x20Error\x20:','inspect','util','fax','bluebird'];(function(_0x3f9d5c,_0x49f9eb){var _0x4b36b8=function(_0x1c9e94){while(--_0x1c9e94){_0x3f9d5c['push'](_0x3f9d5c['shift']());}};_0x4b36b8(++_0x49f9eb);}(_0x8aea,0xbb));var _0xa8ae=function(_0x1facfa,_0x1acf7d){_0x1facfa=_0x1facfa-0x0;var _0x9ec701=_0x8aea[_0x1facfa];return _0x9ec701;};'use strict';var util=require(_0xa8ae('0x0'));var logger=require('../../../../config/logger')(_0xa8ae('0x1'));var BPromise=require(_0xa8ae('0x2'));var exec=require(_0xa8ae('0x3'))[_0xa8ae('0x4')];exports[_0xa8ae('0x5')]=function(_0x3b066e){return new BPromise(function(_0x23b456,_0x239b73){exec(_0x3b066e,function(_0x5e1644,_0x58b998,_0x4dc869){logger[_0xa8ae('0x6')](_0xa8ae('0x7'),_0x58b998);if(_0x5e1644){logger[_0xa8ae('0x6')](_0xa8ae('0x7'),_0xa8ae('0x8'),util[_0xa8ae('0x9')](_0x5e1644,{'showHidden':![],'depth':null}),_0x58b998,_0x4dc869);_0x239b73(_0x5e1644);}_0x23b456(_0x58b998);});});}; \ No newline at end of file +var _0xc93e=['child_process','exec','execute','Exec\x20gs','info','\x20Error\x20:','inspect','../../../../config/logger','fax'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0xc93e,0x8e));var _0xec93=function(_0xac151d,_0x4ea1d2){_0xac151d=_0xac151d-0x0;var _0x111dba=_0xc93e[_0xac151d];return _0x111dba;};'use strict';var util=require('util');var logger=require(_0xec93('0x0'))(_0xec93('0x1'));var BPromise=require('bluebird');var exec=require(_0xec93('0x2'))[_0xec93('0x3')];exports[_0xec93('0x4')]=function(_0x38d421){return new BPromise(function(_0x3c10fa,_0x74ebfb){exec(_0x38d421,function(_0x392c76,_0x4cf939,_0x485b7e){logger['info'](_0xec93('0x5'),_0x4cf939);if(_0x392c76){logger[_0xec93('0x6')](_0xec93('0x5'),_0xec93('0x7'),util[_0xec93('0x8')](_0x392c76,{'showHidden':![],'depth':null}),_0x4cf939,_0x485b7e);_0x74ebfb(_0x392c76);}_0x3c10fa(_0x4cf939);});});}; \ 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 7ac2185..069e9fa 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 _0xf36d=['modem','gateway','faxdetect','t38timeout','path','variablesAction','originate','xcally-motion-fax','from-sip','localstationid','uniqueid','lodash','moment','fax','logger','info','inspect','addVariables','headerinfo','maxrate','format','\x22%s\x22'];(function(_0xaa7460,_0x33e950){var _0x298718=function(_0x1d357c){while(--_0x1d357c){_0xaa7460['push'](_0xaa7460['shift']());}};_0x298718(++_0x33e950);}(_0xf36d,0x1d9));var _0xdf36=function(_0x5783f4,_0x4a9e0a){_0x5783f4=_0x5783f4-0x0;var _0x28e380=_0xf36d[_0x5783f4];return _0x28e380;};'use strict';var util=require('util');var _=require(_0xdf36('0x0'));var moment=require(_0xdf36('0x1'));var logger=require('../../../../config/logger')(_0xdf36('0x2'));exports['message']=function(_0x5a248f){return{'message':_0x5a248f};};exports[_0xdf36('0x3')]=function(_0x585a79,_0x722b43){logger[_0xdf36('0x4')](_0x585a79,util[_0xdf36('0x5')](_0x722b43,{'showHidden':![],'depth':null}));};exports[_0xdf36('0x6')]=function(_0x1c7fcc,_0x104337){var _0x30e63b={'XMF-ECM':_0x104337['ecm'],'XMF-HEADERINFO':_0x104337[_0xdf36('0x7')],'XMF-MINRATE':_0x104337['minrate'],'XMF-MAXRATE':_0x104337[_0xdf36('0x8')],'XMF-MODEM':util[_0xdf36('0x9')](_0xdf36('0xa'),_0x104337[_0xdf36('0xb')]),'XMF-GATEWAY':_0x104337[_0xdf36('0xc')],'XMF-FAXDETECT':_0x104337[_0xdf36('0xd')],'XMF-T38TIMEOUT':_0x104337[_0xdf36('0xe')],'XMF-LOCALSTATIONID':_0x104337['localstationid'],'XMF-PATH':_0x1c7fcc[_0xdf36('0xf')]};return _0x30e63b;};exports[_0xdf36('0x10')]=function(_0x4eead9,_0x3c2221){return{'actionid':_0x4eead9['uniqueid'],'action':_0xdf36('0x11'),'channel':_0x4eead9['channel'],'Exten':_0xdf36('0x12'),'Context':_0xdf36('0x13'),'Priority':'1','callerid':util['format']('\x22%s\x22\x20<%s>',_0x4eead9['headerinfo']?_0x4eead9[_0xdf36('0x7')]:'',_0x4eead9[_0xdf36('0x14')]),'variable':_0x3c2221,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x4eead9[_0xdf36('0x15')]};}; \ No newline at end of file +var _0x6edb=['info','inspect','headerinfo','minrate','maxrate','\x22%s\x22','modem','gateway','faxdetect','t38timeout','localstationid','path','variablesAction','uniqueid','channel','from-sip','format','util','lodash','moment','../../../../config/logger','fax','message','logger'];(function(_0x598672,_0x118df0){var _0x1d90a6=function(_0x4dabce){while(--_0x4dabce){_0x598672['push'](_0x598672['shift']());}};_0x1d90a6(++_0x118df0);}(_0x6edb,0x89));var _0xb6ed=function(_0x5f175c,_0x36de13){_0x5f175c=_0x5f175c-0x0;var _0x3dde95=_0x6edb[_0x5f175c];return _0x3dde95;};'use strict';var util=require(_0xb6ed('0x0'));var _=require(_0xb6ed('0x1'));var moment=require(_0xb6ed('0x2'));var logger=require(_0xb6ed('0x3'))(_0xb6ed('0x4'));exports[_0xb6ed('0x5')]=function(_0x33fdd6){return{'message':_0x33fdd6};};exports[_0xb6ed('0x6')]=function(_0x59f135,_0xc3a8b9){logger[_0xb6ed('0x7')](_0x59f135,util[_0xb6ed('0x8')](_0xc3a8b9,{'showHidden':![],'depth':null}));};exports['addVariables']=function(_0x436bc6,_0x26d190){var _0x5af86b={'XMF-ECM':_0x26d190['ecm'],'XMF-HEADERINFO':_0x26d190[_0xb6ed('0x9')],'XMF-MINRATE':_0x26d190[_0xb6ed('0xa')],'XMF-MAXRATE':_0x26d190[_0xb6ed('0xb')],'XMF-MODEM':util['format'](_0xb6ed('0xc'),_0x26d190[_0xb6ed('0xd')]),'XMF-GATEWAY':_0x26d190[_0xb6ed('0xe')],'XMF-FAXDETECT':_0x26d190[_0xb6ed('0xf')],'XMF-T38TIMEOUT':_0x26d190[_0xb6ed('0x10')],'XMF-LOCALSTATIONID':_0x26d190[_0xb6ed('0x11')],'XMF-PATH':_0x436bc6[_0xb6ed('0x12')]};return _0x5af86b;};exports[_0xb6ed('0x13')]=function(_0x9d2ade,_0x3efea5){return{'actionid':_0x9d2ade[_0xb6ed('0x14')],'action':'originate','channel':_0x9d2ade[_0xb6ed('0x15')],'Exten':'xcally-motion-fax','Context':_0xb6ed('0x16'),'Priority':'1','callerid':util[_0xb6ed('0x17')]('\x22%s\x22\x20<%s>',_0x9d2ade[_0xb6ed('0x9')]?_0x9d2ade[_0xb6ed('0x9')]:'',_0x9d2ade['localstationid']),'variable':_0x3efea5,'timeout':0x1e*0x3e8,'async':!![],'channelid':_0x9d2ade[_0xb6ed('0x14')]};}; \ No newline at end of file diff --git a/server/services/ami/index.js b/server/services/ami/index.js index 022c19c..78bc158 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 _0x0da4=['initDeskAccounts','getZohoAccounts','initZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getServicenowAccounts','getDynamics365Accounts','getCampaigns','initVoiceExtensions','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','initVoiceQueueHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','./realtime','./report','./acw','./trigger','./dialer','./preview','./fax','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/template','./rpc/cmHopperHistory','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/freshdesk','./rpc/integrations/vtiger','./rpc/integrations/dynamics365','../../config/logger','resolve','then','getAgents','getTelephones','initTelephones','getTrunks','initTrunks','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','initSalesforceAccounts','getSugarcrmAccounts','getFreshdeskAccounts','initFreshdeskAccounts','getDeskAccounts'];(function(_0xf4add4,_0x5b9cc1){var _0x1c42fb=function(_0x2674c1){while(--_0x2674c1){_0xf4add4['push'](_0xf4add4['shift']());}};_0x1c42fb(++_0x5b9cc1);}(_0x0da4,0x93));var _0x40da=function(_0x474444,_0x1a5b68){_0x474444=_0x474444-0x0;var _0x25c500=_0x0da4[_0x474444];return _0x25c500;};'use strict';var util=require('util');var moment=require('moment');var server=require('./server');var Realtime=require(_0x40da('0x0'));var Report=require(_0x40da('0x1'));var Acw=require(_0x40da('0x2'));var Trigger=require(_0x40da('0x3'));var Dialer=require(_0x40da('0x4'));var Preview=require(_0x40da('0x5'));var Fax=require(_0x40da('0x6'));var user=require(_0x40da('0x7'));var voiceQueue=require(_0x40da('0x8'));var voiceQueueReport=require(_0x40da('0x9'));var voiceCallReport=require(_0x40da('0xa'));var trunk=require(_0x40da('0xb'));var trigger=require('./rpc/trigger');var template=require(_0x40da('0xc'));var cmHopperHistory=require(_0x40da('0xd'));var campaign=require('./rpc/campaign');var voiceExtension=require(_0x40da('0xe'));var faxAccount=require(_0x40da('0xf'));var zendesk=require(_0x40da('0x10'));var salesforce=require('./rpc/integrations/salesforce');var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require(_0x40da('0x11'));var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x40da('0x12'));var freshsales=require('./rpc/integrations/freshsales');var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x40da('0x13'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require(_0x40da('0x14'))('ami');var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get']('hour')===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()['get']('hour')===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x40da('0x15')]()[_0x40da('0x16')](user[_0x40da('0x17')]())[_0x40da('0x16')](realtime['initAgents']())[_0x40da('0x16')](user[_0x40da('0x18')]())['then'](realtime[_0x40da('0x19')]())[_0x40da('0x16')](trunk[_0x40da('0x1a')]())[_0x40da('0x16')](realtime[_0x40da('0x1b')]())['then'](voiceQueue['getVoiceQueues']())[_0x40da('0x16')](realtime['initVoiceQueues']())[_0x40da('0x16')](trigger[_0x40da('0x1c')]())['then'](realtime[_0x40da('0x1d')]())['then'](template[_0x40da('0x1e')]())[_0x40da('0x16')](realtime[_0x40da('0x1f')]())[_0x40da('0x16')](zendesk[_0x40da('0x20')]())[_0x40da('0x16')](realtime[_0x40da('0x21')]())[_0x40da('0x16')](salesforce['getSalesforceAccounts']())['then'](realtime[_0x40da('0x22')]())['then'](sugarcrm[_0x40da('0x23')]())[_0x40da('0x16')](realtime['initSugarcrmAccounts']())['then'](freshdesk[_0x40da('0x24')]())[_0x40da('0x16')](realtime[_0x40da('0x25')]())[_0x40da('0x16')](desk[_0x40da('0x26')]())[_0x40da('0x16')](realtime[_0x40da('0x27')]())[_0x40da('0x16')](zoho[_0x40da('0x28')]())[_0x40da('0x16')](realtime[_0x40da('0x29')]())[_0x40da('0x16')](vtiger['getVtigerAccounts']())['then'](realtime[_0x40da('0x2a')]())[_0x40da('0x16')](freshsales[_0x40da('0x2b')]())[_0x40da('0x16')](realtime['initFreshsalesAccounts']())[_0x40da('0x16')](servicenow[_0x40da('0x2c')]())[_0x40da('0x16')](realtime['initServicenowAccounts']())['then'](dynamics365[_0x40da('0x2d')]())[_0x40da('0x16')](realtime['initDynamics365Accounts']())[_0x40da('0x16')](campaign[_0x40da('0x2e')]())[_0x40da('0x16')](realtime['initCampaigns']())[_0x40da('0x16')](voiceExtension['getVoiceExtensions']())['then'](realtime[_0x40da('0x2f')]())[_0x40da('0x16')](faxAccount['getFaxAccounts']())[_0x40da('0x16')](realtime[_0x40da('0x30')]())[_0x40da('0x16')](function(){return realtime;});}function initParams(){return Promise['resolve']()[_0x40da('0x16')](voiceQueueReport[_0x40da('0x31')]())['then'](realtime[_0x40da('0x32')]())[_0x40da('0x16')](cmHopperHistory['getVoiceQueueHopperHistory']())[_0x40da('0x16')](realtime[_0x40da('0x33')]())[_0x40da('0x16')](cmHopperHistory['getCampaignHopperHistory']())[_0x40da('0x16')](realtime[_0x40da('0x34')]())[_0x40da('0x16')](voiceCallReport[_0x40da('0x35')]())['then'](realtime[_0x40da('0x36')]())[_0x40da('0x37')](function(_0x52f6b4){logger[_0x40da('0x38')](_0x40da('0x39'),util[_0x40da('0x3a')](_0x52f6b4,{'showHidden':![],'depth':null}));});}function main(){return server[_0x40da('0x3b')](realtime,preview,fax)[_0x40da('0x16')](function(){return initRealtime();})['then'](function(){return initParams();})[_0x40da('0x16')](function(){report[_0x40da('0x3c')]();setInterval(initRealtime,0x1388);})[_0x40da('0x37')](function(_0x97f092){logger[_0x40da('0x38')](_0x40da('0x3d'),util['inspect'](_0x97f092,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file +var _0xe991=['getTelephones','initTelephones','getTrunks','initTrunks','getVoiceQueues','initVoiceQueues','getTriggers','initTriggers','getTemplates','initTemplates','getZendeskAccounts','initZendeskAccounts','getSalesforceAccounts','initSalesforceAccounts','initFreshdeskAccounts','getDeskAccounts','initDeskAccounts','getZohoAccounts','initVtigerAccounts','getFreshsalesAccounts','getDynamics365Accounts','initDynamics365Accounts','getCampaigns','getVoiceExtensions','initVoiceExtensions','getFaxAccounts','initFaxAccounts','getVoiceQueueReports','initVoiceQueueReports','getVoiceQueueHopperHistory','initVoiceQueueHopperHistory','getCampaignHopperHistory','initCampaignHopperHistory','getVoiceCallReports','initVoiceCallReports','catch','error','[index.js][initParams]','inspect','listen','sync','[index.js][main]','util','moment','./realtime','./report','./acw','./trigger','./dialer','./preview','./rpc/user','./rpc/voiceQueue','./rpc/voiceQueueReport','./rpc/voiceCallReport','./rpc/trunk','./rpc/voiceExtension','./rpc/faxAccount','./rpc/integrations/zendesk','./rpc/integrations/salesforce','./rpc/integrations/vtiger','./rpc/integrations/freshsales','./rpc/integrations/dynamics365','ami','hour','get','resolve','getAgents','then','initAgents'];(function(_0x725b8e,_0xc22b48){var _0x43ac45=function(_0x46bb4a){while(--_0x46bb4a){_0x725b8e['push'](_0x725b8e['shift']());}};_0x43ac45(++_0xc22b48);}(_0xe991,0x6f));var _0x1e99=function(_0x1777a9,_0x122005){_0x1777a9=_0x1777a9-0x0;var _0x4307d4=_0xe991[_0x1777a9];return _0x4307d4;};'use strict';var util=require(_0x1e99('0x0'));var moment=require(_0x1e99('0x1'));var server=require('./server');var Realtime=require(_0x1e99('0x2'));var Report=require(_0x1e99('0x3'));var Acw=require(_0x1e99('0x4'));var Trigger=require(_0x1e99('0x5'));var Dialer=require(_0x1e99('0x6'));var Preview=require(_0x1e99('0x7'));var Fax=require('./fax');var user=require(_0x1e99('0x8'));var voiceQueue=require(_0x1e99('0x9'));var voiceQueueReport=require(_0x1e99('0xa'));var voiceCallReport=require(_0x1e99('0xb'));var trunk=require(_0x1e99('0xc'));var trigger=require('./rpc/trigger');var template=require('./rpc/template');var cmHopperHistory=require('./rpc/cmHopperHistory');var campaign=require('./rpc/campaign');var voiceExtension=require(_0x1e99('0xd'));var faxAccount=require(_0x1e99('0xe'));var zendesk=require(_0x1e99('0xf'));var salesforce=require(_0x1e99('0x10'));var sugarcrm=require('./rpc/integrations/sugarcrm');var freshdesk=require('./rpc/integrations/freshdesk');var desk=require('./rpc/integrations/desk');var zoho=require('./rpc/integrations/zoho');var vtiger=require(_0x1e99('0x11'));var freshsales=require(_0x1e99('0x12'));var servicenow=require('./rpc/integrations/servicenow');var dynamics365=require(_0x1e99('0x13'));var realtime=new Realtime();var report=new Report(realtime);var acw=new Acw(realtime);var channelTrigger=new Trigger(realtime);var preview=new Preview(realtime);var dialer=new Dialer(realtime,preview);var fax=new Fax(realtime);var logger=require('../../config/logger')(_0x1e99('0x14'));var isTrue=!![];var initP=!![];function ifMidnight(){if(moment()['get'](_0x1e99('0x15'))===0x0&&initP){initP=![];isTrue=!![];initParams();}if(moment()[_0x1e99('0x16')](_0x1e99('0x15'))===0x1&&isTrue){isTrue=![];initP=!![];}}function initRealtime(){ifMidnight();return Promise[_0x1e99('0x17')]()['then'](user[_0x1e99('0x18')]())[_0x1e99('0x19')](realtime[_0x1e99('0x1a')]())[_0x1e99('0x19')](user[_0x1e99('0x1b')]())['then'](realtime[_0x1e99('0x1c')]())[_0x1e99('0x19')](trunk[_0x1e99('0x1d')]())[_0x1e99('0x19')](realtime[_0x1e99('0x1e')]())[_0x1e99('0x19')](voiceQueue[_0x1e99('0x1f')]())[_0x1e99('0x19')](realtime[_0x1e99('0x20')]())[_0x1e99('0x19')](trigger[_0x1e99('0x21')]())[_0x1e99('0x19')](realtime[_0x1e99('0x22')]())[_0x1e99('0x19')](template[_0x1e99('0x23')]())[_0x1e99('0x19')](realtime[_0x1e99('0x24')]())[_0x1e99('0x19')](zendesk[_0x1e99('0x25')]())[_0x1e99('0x19')](realtime[_0x1e99('0x26')]())[_0x1e99('0x19')](salesforce[_0x1e99('0x27')]())[_0x1e99('0x19')](realtime[_0x1e99('0x28')]())[_0x1e99('0x19')](sugarcrm['getSugarcrmAccounts']())['then'](realtime['initSugarcrmAccounts']())['then'](freshdesk['getFreshdeskAccounts']())[_0x1e99('0x19')](realtime[_0x1e99('0x29')]())['then'](desk[_0x1e99('0x2a')]())[_0x1e99('0x19')](realtime[_0x1e99('0x2b')]())[_0x1e99('0x19')](zoho[_0x1e99('0x2c')]())[_0x1e99('0x19')](realtime['initZohoAccounts']())[_0x1e99('0x19')](vtiger['getVtigerAccounts']())['then'](realtime[_0x1e99('0x2d')]())[_0x1e99('0x19')](freshsales[_0x1e99('0x2e')]())[_0x1e99('0x19')](realtime['initFreshsalesAccounts']())[_0x1e99('0x19')](servicenow['getServicenowAccounts']())['then'](realtime['initServicenowAccounts']())[_0x1e99('0x19')](dynamics365[_0x1e99('0x2f')]())[_0x1e99('0x19')](realtime[_0x1e99('0x30')]())['then'](campaign[_0x1e99('0x31')]())[_0x1e99('0x19')](realtime['initCampaigns']())[_0x1e99('0x19')](voiceExtension[_0x1e99('0x32')]())['then'](realtime[_0x1e99('0x33')]())[_0x1e99('0x19')](faxAccount[_0x1e99('0x34')]())[_0x1e99('0x19')](realtime[_0x1e99('0x35')]())[_0x1e99('0x19')](function(){return realtime;});}function initParams(){return Promise[_0x1e99('0x17')]()['then'](voiceQueueReport[_0x1e99('0x36')]())['then'](realtime[_0x1e99('0x37')]())['then'](cmHopperHistory[_0x1e99('0x38')]())[_0x1e99('0x19')](realtime[_0x1e99('0x39')]())['then'](cmHopperHistory[_0x1e99('0x3a')]())[_0x1e99('0x19')](realtime[_0x1e99('0x3b')]())[_0x1e99('0x19')](voiceCallReport[_0x1e99('0x3c')]())[_0x1e99('0x19')](realtime[_0x1e99('0x3d')]())[_0x1e99('0x3e')](function(_0x10af5e){logger[_0x1e99('0x3f')](_0x1e99('0x40'),util[_0x1e99('0x41')](_0x10af5e,{'showHidden':![],'depth':null}));});}function main(){return server[_0x1e99('0x42')](realtime,preview,fax)[_0x1e99('0x19')](function(){return initRealtime();})[_0x1e99('0x19')](function(){return initParams();})[_0x1e99('0x19')](function(){report[_0x1e99('0x43')]();setInterval(initRealtime,0x1388);})['catch'](function(_0x4aa2e8){logger['error'](_0x1e99('0x44'),util[_0x1e99('0x41')](_0x4aa2e8,{'showHidden':![],'depth':null}));});}main(); \ No newline at end of file diff --git a/server/services/ami/model/agent.js b/server/services/ami/model/agent.js index 6ae15e4..d392fc8 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 _0xbac2=['emit','user:presence','exports','lodash','util','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','online','voiceStatus','voiceStatusTime','voiceStatusCallerIdNumber','voiceStatusQueue','local','prototype','updateStatusRealtime','idle','inuse','talking','format','address','interface','onhold','stringify','user:%s','user:save'];(function(_0x53915d,_0x1daa70){var _0x11e040=function(_0x40e514){while(--_0x40e514){_0x53915d['push'](_0x53915d['shift']());}};_0x11e040(++_0x1daa70);}(_0xbac2,0xc6));var _0x2bac=function(_0x1b2422,_0x1e98d4){_0x1b2422=_0x1b2422-0x0;var _0x376573=_0xbac2[_0x1b2422];return _0x376573;};'use strict';var _=require(_0x2bac('0x0'));var util=require(_0x2bac('0x1'));var moment=require(_0x2bac('0x2'));var md5=require(_0x2bac('0x3'));var Redis=require(_0x2bac('0x4'));var config=require(_0x2bac('0x5'));config[_0x2bac('0x6')]=_[_0x2bac('0x7')](config['redis'],{'host':_0x2bac('0x8'),'port':0x18eb});var io=require(_0x2bac('0x9'))(new Redis(config['redis']));function Agent(_0x943fc9){this['id']=_0x943fc9['id']||0x0;this[_0x2bac('0xa')]=_0x943fc9[_0x2bac('0xa')]||'';this[_0x2bac('0xb')]=_0x943fc9[_0x2bac('0xb')]||'';this[_0x2bac('0xc')]=_0x943fc9[_0x2bac('0xc')]||'';this[_0x2bac('0xd')]=_0x943fc9[_0x2bac('0xd')]||'';this[_0x2bac('0xe')]=_0x2bac('0xf');this[_0x2bac('0x10')]=0x0;this[_0x2bac('0x11')]='unknown';this['address']='';this['phone']='';this['mobile']='';this['interface']='';this[_0x2bac('0x12')]=_0x943fc9[_0x2bac('0x12')]||![];this[_0x2bac('0x13')]=_0x2bac('0xf');this[_0x2bac('0x14')]=0x0;this[_0x2bac('0x15')]='';this[_0x2bac('0x16')]='';this['onhold']=![];this[_0x2bac('0x17')]=![];this['md5']='';}Agent[_0x2bac('0x18')][_0x2bac('0x19')]=function(_0x17f166){var _0x1546e9;if(_0x17f166&&_0x17f166[_0x2bac('0xe')]){_0x1546e9=_0x17f166[_0x2bac('0xe')]['toLowerCase']();switch(_0x1546e9){case'not_inuse':_0x1546e9=_0x2bac('0x1a');break;case _0x2bac('0x1b'):_0x1546e9=_0x2bac('0x1c');break;}}if(_0x1546e9&&this[_0x2bac('0x13')]!==_0x1546e9||_0x17f166['statePause']){this[_0x2bac('0x14')]=_['toNumber'](moment()[_0x2bac('0x1d')]('x'));}if(_0x1546e9){this[_0x2bac('0x13')]=_0x1546e9;}var _0x58a4e9={'id':this['id'],'name':this[_0x2bac('0xa')],'email':this[_0x2bac('0xb')],'accountcode':this[_0x2bac('0xc')],'fullname':this['fullname'],'state':this[_0x2bac('0xe')],'stateTime':this['stateTime'],'status':this[_0x2bac('0x11')],'address':this[_0x2bac('0x1e')],'online':this[_0x2bac('0x12')],'voiceStatus':this[_0x2bac('0x13')],'voiceStatusTime':this['voiceStatusTime'],'voiceStatusCallerIdNumber':this['voiceStatusCallerIdNumber'],'voiceStatusQueue':this[_0x2bac('0x16')],'interface':this[_0x2bac('0x1f')],'onhold':this[_0x2bac('0x20')]};var _0xaba033=md5(JSON[_0x2bac('0x21')](_0x58a4e9));if(this['md5']!==_0xaba033){this['md5']=_0xaba033;io['to'](util[_0x2bac('0x1d')](_0x2bac('0x22'),_0x58a4e9[_0x2bac('0xa')]))['emit'](_0x2bac('0x23'),_0x58a4e9);io[_0x2bac('0x24')](_0x2bac('0x25'),_0x58a4e9);}};module[_0x2bac('0x26')]=Agent; \ No newline at end of file +var _0x3095=['voiceStatusTime','voiceStatusCallerIdNumber','onhold','prototype','updateStatusRealtime','toLowerCase','idle','inuse','toNumber','format','voiceStatusQueue','user:save','emit','user:presence','exports','moment','md5','../../../config/environment','redis','defaults','socket.io-emitter','name','email','accountcode','fullname','state','unknown','stateTime','status','address','phone','interface','online','voiceStatus'];(function(_0x595306,_0x11ff36){var _0x2d9aa3=function(_0x3b4836){while(--_0x3b4836){_0x595306['push'](_0x595306['shift']());}};_0x2d9aa3(++_0x11ff36);}(_0x3095,0x1eb));var _0x5309=function(_0x2c619f,_0x1a9503){_0x2c619f=_0x2c619f-0x0;var _0xb8c66a=_0x3095[_0x2c619f];return _0xb8c66a;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x5309('0x0'));var md5=require(_0x5309('0x1'));var Redis=require('ioredis');var config=require(_0x5309('0x2'));config[_0x5309('0x3')]=_[_0x5309('0x4')](config[_0x5309('0x3')],{'host':'localhost','port':0x18eb});var io=require(_0x5309('0x5'))(new Redis(config[_0x5309('0x3')]));function Agent(_0x517273){this['id']=_0x517273['id']||0x0;this[_0x5309('0x6')]=_0x517273['name']||'';this[_0x5309('0x7')]=_0x517273[_0x5309('0x7')]||'';this[_0x5309('0x8')]=_0x517273[_0x5309('0x8')]||'';this[_0x5309('0x9')]=_0x517273[_0x5309('0x9')]||'';this[_0x5309('0xa')]=_0x5309('0xb');this[_0x5309('0xc')]=0x0;this[_0x5309('0xd')]=_0x5309('0xb');this[_0x5309('0xe')]='';this[_0x5309('0xf')]='';this['mobile']='';this[_0x5309('0x10')]='';this[_0x5309('0x11')]=_0x517273[_0x5309('0x11')]||![];this[_0x5309('0x12')]='unknown';this[_0x5309('0x13')]=0x0;this[_0x5309('0x14')]='';this['voiceStatusQueue']='';this[_0x5309('0x15')]=![];this['local']=![];this[_0x5309('0x1')]='';}Agent[_0x5309('0x16')][_0x5309('0x17')]=function(_0xc14a5d){var _0x4d91b1;if(_0xc14a5d&&_0xc14a5d[_0x5309('0xa')]){_0x4d91b1=_0xc14a5d[_0x5309('0xa')][_0x5309('0x18')]();switch(_0x4d91b1){case'not_inuse':_0x4d91b1=_0x5309('0x19');break;case _0x5309('0x1a'):_0x4d91b1='talking';break;}}if(_0x4d91b1&&this['voiceStatus']!==_0x4d91b1||_0xc14a5d['statePause']){this[_0x5309('0x13')]=_[_0x5309('0x1b')](moment()[_0x5309('0x1c')]('x'));}if(_0x4d91b1){this['voiceStatus']=_0x4d91b1;}var _0x4d7d69={'id':this['id'],'name':this[_0x5309('0x6')],'email':this[_0x5309('0x7')],'accountcode':this[_0x5309('0x8')],'fullname':this[_0x5309('0x9')],'state':this[_0x5309('0xa')],'stateTime':this[_0x5309('0xc')],'status':this[_0x5309('0xd')],'address':this[_0x5309('0xe')],'online':this[_0x5309('0x11')],'voiceStatus':this['voiceStatus'],'voiceStatusTime':this[_0x5309('0x13')],'voiceStatusCallerIdNumber':this[_0x5309('0x14')],'voiceStatusQueue':this[_0x5309('0x1d')],'interface':this[_0x5309('0x10')],'onhold':this[_0x5309('0x15')]};var _0x533a06=md5(JSON['stringify'](_0x4d7d69));if(this[_0x5309('0x1')]!==_0x533a06){this[_0x5309('0x1')]=_0x533a06;io['to'](util[_0x5309('0x1c')]('user:%s',_0x4d7d69['name']))['emit'](_0x5309('0x1e'),_0x4d7d69);io[_0x5309('0x1f')](_0x5309('0x20'),_0x4d7d69);}};module[_0x5309('0x21')]=Agent; \ No newline at end of file diff --git a/server/services/ami/model/campaign.js b/server/services/ami/model/campaign.js index 6cb6139..c0eace1 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 _0x54fd=['message','sendMessageOneNotActive','active','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','name','type','campaign','ivrAnswerCallsDay','ivrTotalCallsDays'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x54fd,0x19b));var _0xd54f=function(_0x3a9907,_0x4c4f62){_0x3a9907=_0x3a9907-0x0;var _0x4007fe=_0x54fd[_0x3a9907];return _0x4007fe;};'use strict';function Campaign(_0x2cde2a){this['id']=_0x2cde2a['id']||0x0;this[_0xd54f('0x0')]=_0x2cde2a[_0xd54f('0x0')]||'';this[_0xd54f('0x1')]=_0x2cde2a['type']||_0xd54f('0x2');this['originated']=0x0;this['temp']=0x0;this[_0xd54f('0x3')]=0x0;this[_0xd54f('0x4')]=0x0;this[_0xd54f('0x5')]='';this[_0xd54f('0x6')]=!![];this[_0xd54f('0x7')]=_0x2cde2a[_0xd54f('0x7')];this[_0xd54f('0x8')]=_0x2cde2a['limitCalls'];this[_0xd54f('0x9')]=_0x2cde2a[_0xd54f('0x9')]||null;this[_0xd54f('0xa')]=_0x2cde2a[_0xd54f('0xa')]?_0x2cde2a['dialGlobalInterval']:null;this['dialOriginateCallerIdName']=_0x2cde2a[_0xd54f('0xb')];this['dialOriginateCallerIdNumber']=_0x2cde2a[_0xd54f('0xc')];this[_0xd54f('0xd')]=_0x2cde2a['dialOriginateTimeout']||0x1e;this[_0xd54f('0xe')]=_0x2cde2a['dialCongestionMaxRetry'];this[_0xd54f('0xf')]=_0x2cde2a[_0xd54f('0xf')];this['dialBusyMaxRetry']=_0x2cde2a[_0xd54f('0x10')];this['dialBusyRetryFrequency']=_0x2cde2a[_0xd54f('0x11')];this[_0xd54f('0x12')]=_0x2cde2a['dialNoAnswerMaxRetry'];this[_0xd54f('0x13')]=_0x2cde2a[_0xd54f('0x13')];this[_0xd54f('0x14')]=_0x2cde2a['dialGlobalMaxRetry'];this[_0xd54f('0x15')]=_0x2cde2a[_0xd54f('0x15')]||0x3;this[_0xd54f('0x16')]=_0x2cde2a[_0xd54f('0x16')]||0x96;this[_0xd54f('0x17')]=_0x2cde2a[_0xd54f('0x17')]||0x3;this[_0xd54f('0x18')]=_0x2cde2a[_0xd54f('0x18')]||0x96;this[_0xd54f('0x19')]=_0x2cde2a[_0xd54f('0x19')]||0x3;this[_0xd54f('0x1a')]=_0x2cde2a[_0xd54f('0x1a')]||0x96;this[_0xd54f('0x1b')]=_0x2cde2a['dialMachineMaxRetry']||0x3;this[_0xd54f('0x1c')]=_0x2cde2a['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x2cde2a[_0xd54f('0x1d')]||0x3;this[_0xd54f('0x1e')]=_0x2cde2a[_0xd54f('0x1e')]||0x96;this[_0xd54f('0x1f')]=_0x2cde2a[_0xd54f('0x1f')]||_0xd54f('0x20');this[_0xd54f('0x21')]=_0x2cde2a[_0xd54f('0x21')]||undefined;this[_0xd54f('0x22')]=_0x2cde2a[_0xd54f('0x22')]||undefined;this[_0xd54f('0x23')]=_0x2cde2a['dialCutDigit']||undefined;this[_0xd54f('0x24')]=_0x2cde2a[_0xd54f('0x24')]?_0x2cde2a[_0xd54f('0x24')]:undefined;this[_0xd54f('0x25')]=_0x2cde2a[_0xd54f('0x25')]?_0x2cde2a[_0xd54f('0x25')]:undefined;this['Interval']=_0x2cde2a[_0xd54f('0x26')]?_0x2cde2a[_0xd54f('0x26')]:undefined;this['SquareProject']=_0x2cde2a[_0xd54f('0x27')]?_0x2cde2a['SquareProject']:undefined;this[_0xd54f('0x28')]=_0x2cde2a[_0xd54f('0x27')]?_0x2cde2a['SquareProject'][_0xd54f('0x0')]:undefined;this['dialAMDActive']=_0x2cde2a[_0xd54f('0x29')]||![];this[_0xd54f('0x2a')]=_0x2cde2a['dialAMDInitialSilence'];this[_0xd54f('0x2b')]=_0x2cde2a[_0xd54f('0x2b')];this[_0xd54f('0x2c')]=_0x2cde2a[_0xd54f('0x2c')];this['dialAMDTotalAnalysisTime']=_0x2cde2a[_0xd54f('0x2d')];this[_0xd54f('0x2e')]=_0x2cde2a[_0xd54f('0x2e')];this[_0xd54f('0x2f')]=_0x2cde2a[_0xd54f('0x2f')];this['dialAMDMaximumNumberOfWords']=_0x2cde2a[_0xd54f('0x30')];this[_0xd54f('0x31')]=_0x2cde2a[_0xd54f('0x31')];this['dialAMDMaximumWordLength']=_0x2cde2a[_0xd54f('0x32')];}module[_0xd54f('0x33')]=Campaign; \ No newline at end of file +var _0x7cb8=['dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','exports','type','ivrAnswerCallsDay','ivrTotalCallsDays','message','sendMessageOneNotActive','limitCalls','dialTimezone','dialGlobalInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','dialOrderByScheduledAt','DESC','dialPrefix','dialRandomLastDigitCallerIdNumber','dialCutDigit','TrunkBackup','Trunk','Interval','SquareProject','dialQueueProject','name','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting'];(function(_0x250c7a,_0x4386c3){var _0x272703=function(_0x40000d){while(--_0x40000d){_0x250c7a['push'](_0x250c7a['shift']());}};_0x272703(++_0x4386c3);}(_0x7cb8,0x198));var _0x87cb=function(_0x50da1f,_0x115d84){_0x50da1f=_0x50da1f-0x0;var _0x1109e1=_0x7cb8[_0x50da1f];return _0x1109e1;};'use strict';function Campaign(_0x370bf7){this['id']=_0x370bf7['id']||0x0;this['name']=_0x370bf7['name']||'';this[_0x87cb('0x0')]=_0x370bf7[_0x87cb('0x0')]||'campaign';this['originated']=0x0;this['temp']=0x0;this[_0x87cb('0x1')]=0x0;this[_0x87cb('0x2')]=0x0;this[_0x87cb('0x3')]='';this[_0x87cb('0x4')]=!![];this['active']=_0x370bf7['active'];this['limitCalls']=_0x370bf7[_0x87cb('0x5')];this[_0x87cb('0x6')]=_0x370bf7[_0x87cb('0x6')]||null;this['dialGlobalInterval']=_0x370bf7[_0x87cb('0x7')]?_0x370bf7[_0x87cb('0x7')]:null;this[_0x87cb('0x8')]=_0x370bf7[_0x87cb('0x8')];this[_0x87cb('0x9')]=_0x370bf7[_0x87cb('0x9')];this[_0x87cb('0xa')]=_0x370bf7['dialOriginateTimeout']||0x1e;this['dialCongestionMaxRetry']=_0x370bf7[_0x87cb('0xb')];this[_0x87cb('0xc')]=_0x370bf7[_0x87cb('0xc')];this['dialBusyMaxRetry']=_0x370bf7[_0x87cb('0xd')];this[_0x87cb('0xe')]=_0x370bf7[_0x87cb('0xe')];this[_0x87cb('0xf')]=_0x370bf7[_0x87cb('0xf')];this['dialNoAnswerRetryFrequency']=_0x370bf7[_0x87cb('0x10')];this[_0x87cb('0x11')]=_0x370bf7[_0x87cb('0x11')];this[_0x87cb('0x12')]=_0x370bf7[_0x87cb('0x12')]||0x3;this[_0x87cb('0x13')]=_0x370bf7['dialNoSuchNumberRetryFrequency']||0x96;this[_0x87cb('0x14')]=_0x370bf7[_0x87cb('0x14')]||0x3;this[_0x87cb('0x15')]=_0x370bf7[_0x87cb('0x15')]||0x96;this[_0x87cb('0x16')]=_0x370bf7[_0x87cb('0x16')]||0x3;this['dialAbandonedRetryFrequency']=_0x370bf7[_0x87cb('0x17')]||0x96;this[_0x87cb('0x18')]=_0x370bf7[_0x87cb('0x18')]||0x3;this[_0x87cb('0x19')]=_0x370bf7[_0x87cb('0x19')]||0x96;this[_0x87cb('0x1a')]=_0x370bf7['dialAgentRejectMaxRetry']||0x3;this[_0x87cb('0x1b')]=_0x370bf7['dialAgentRejectRetryFrequency']||0x96;this['dialOrderByScheduledAt']=_0x370bf7[_0x87cb('0x1c')]||_0x87cb('0x1d');this[_0x87cb('0x1e')]=_0x370bf7['dialPrefix']||undefined;this[_0x87cb('0x1f')]=_0x370bf7['dialRandomLastDigitCallerIdNumber']||undefined;this[_0x87cb('0x20')]=_0x370bf7[_0x87cb('0x20')]||undefined;this[_0x87cb('0x21')]=_0x370bf7[_0x87cb('0x21')]?_0x370bf7[_0x87cb('0x21')]:undefined;this[_0x87cb('0x22')]=_0x370bf7[_0x87cb('0x22')]?_0x370bf7['Trunk']:undefined;this[_0x87cb('0x23')]=_0x370bf7[_0x87cb('0x23')]?_0x370bf7['Interval']:undefined;this['SquareProject']=_0x370bf7['SquareProject']?_0x370bf7[_0x87cb('0x24')]:undefined;this[_0x87cb('0x25')]=_0x370bf7[_0x87cb('0x24')]?_0x370bf7[_0x87cb('0x24')][_0x87cb('0x26')]:undefined;this[_0x87cb('0x27')]=_0x370bf7['dialAMDActive']||![];this['dialAMDInitialSilence']=_0x370bf7[_0x87cb('0x28')];this[_0x87cb('0x29')]=_0x370bf7[_0x87cb('0x29')];this[_0x87cb('0x2a')]=_0x370bf7['dialAMDAfterGreetingSilence'];this[_0x87cb('0x2b')]=_0x370bf7[_0x87cb('0x2b')];this[_0x87cb('0x2c')]=_0x370bf7[_0x87cb('0x2c')];this[_0x87cb('0x2d')]=_0x370bf7[_0x87cb('0x2d')];this[_0x87cb('0x2e')]=_0x370bf7[_0x87cb('0x2e')];this[_0x87cb('0x2f')]=_0x370bf7[_0x87cb('0x2f')];this[_0x87cb('0x30')]=_0x370bf7['dialAMDMaximumWordLength'];}module[_0x87cb('0x31')]=Campaign; \ No newline at end of file diff --git a/server/services/ami/model/channel.js b/server/services/ami/model/channel.js index bb76a4f..6b525aa 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 _0x943d=['exten','answered','answertime','endtime','abandoned','lastapplication','lastdata','duration','holdtime','type','tag','disposition','monitor','monitorFilename','transfercalleridnum','transferType','mohtime','channel','destinationchannel','calleridnum','calleridname','connectedlinenum','connectedlinename','accountcode','context','uniqueid','linkedid'];(function(_0x1d721f,_0x6a6db5){var _0x457bd=function(_0x16b038){while(--_0x16b038){_0x1d721f['push'](_0x1d721f['shift']());}};_0x457bd(++_0x6a6db5);}(_0x943d,0x155));var _0xd943=function(_0x265003,_0xf0f023){_0x265003=_0x265003-0x0;var _0x33c743=_0x943d[_0x265003];return _0x33c743;};'use strict';function Channel(){this['starttime']=null;this[_0xd943('0x0')]='';this[_0xd943('0x1')]='';this[_0xd943('0x2')]=0x0;this[_0xd943('0x3')]='';this[_0xd943('0x4')]=undefined;this[_0xd943('0x5')]=undefined;this[_0xd943('0x6')]=0x0;this[_0xd943('0x7')]='';this[_0xd943('0x8')]=0x0;this[_0xd943('0x9')]=0x0;this[_0xd943('0xa')]=0x0;this[_0xd943('0xb')]=![];this[_0xd943('0xc')]=null;this[_0xd943('0xd')]=null;this['unmanaged']=![];this[_0xd943('0xe')]=![];this[_0xd943('0xf')]='';this[_0xd943('0x10')]='';this[_0xd943('0x11')]=0x0;this['billableseconds']=0x0;this[_0xd943('0x12')]=0x0;this[_0xd943('0x13')]=null;this[_0xd943('0x14')]=null;this[_0xd943('0x15')]=null;this[_0xd943('0x16')]=![];this[_0xd943('0x17')]=null;this['queue']=null;this['monitors']=[];this[_0xd943('0x18')]=undefined;this['transferconnectedlinenum']=undefined;this[_0xd943('0x19')]=undefined;this[_0xd943('0x1a')]=0x0;}module['exports']=Channel; \ No newline at end of file +var _0x1fbb=['transferconnectedlinenum','mohtime','exports','starttime','channel','destinationchannel','calleridnum','connectedlinenum','connectedlinename','accountcode','context','uniqueid','exten','endtime','lastapplication','lastdata','duration','billableseconds','holdtime','type','tag','disposition','monitorFilename','monitors','transfercalleridnum'];(function(_0x49d1ee,_0x54221d){var _0x52d4ec=function(_0x1651d1){while(--_0x1651d1){_0x49d1ee['push'](_0x49d1ee['shift']());}};_0x52d4ec(++_0x54221d);}(_0x1fbb,0x99));var _0xb1fb=function(_0x97f8e2,_0x5e03e7){_0x97f8e2=_0x97f8e2-0x0;var _0xf5fac5=_0x1fbb[_0x97f8e2];return _0xf5fac5;};'use strict';function Channel(){this[_0xb1fb('0x0')]=null;this[_0xb1fb('0x1')]='';this[_0xb1fb('0x2')]='';this[_0xb1fb('0x3')]=0x0;this['calleridname']='';this[_0xb1fb('0x4')]=undefined;this[_0xb1fb('0x5')]=undefined;this[_0xb1fb('0x6')]=0x0;this[_0xb1fb('0x7')]='';this[_0xb1fb('0x8')]=0x0;this['linkedid']=0x0;this[_0xb1fb('0x9')]=0x0;this['answered']=![];this['answertime']=null;this[_0xb1fb('0xa')]=null;this['unmanaged']=![];this['abandoned']=![];this[_0xb1fb('0xb')]='';this[_0xb1fb('0xc')]='';this[_0xb1fb('0xd')]=0x0;this[_0xb1fb('0xe')]=0x0;this[_0xb1fb('0xf')]=0x0;this[_0xb1fb('0x10')]=null;this[_0xb1fb('0x11')]=null;this[_0xb1fb('0x12')]=null;this['monitor']=![];this[_0xb1fb('0x13')]=null;this['queue']=null;this[_0xb1fb('0x14')]=[];this[_0xb1fb('0x15')]=undefined;this[_0xb1fb('0x16')]=undefined;this['transferType']=undefined;this[_0xb1fb('0x17')]=0x0;}module[_0xb1fb('0x18')]=Channel; \ No newline at end of file diff --git a/server/services/ami/model/deskAccount.js b/server/services/ami/model/deskAccount.js index e7e0851..d6c4124 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 _0xb663=['exports','name','authType','password','consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations'];(function(_0x34a9b3,_0x1b9878){var _0xbcc6a9=function(_0x39575d){while(--_0x39575d){_0x34a9b3['push'](_0x34a9b3['shift']());}};_0xbcc6a9(++_0x1b9878);}(_0xb663,0x18d));var _0x3b66=function(_0x4e8c47,_0x94ee2d){_0x4e8c47=_0x4e8c47-0x0;var _0x6c119=_0xb663[_0x4e8c47];return _0x6c119;};'use strict';function DeskAccount(_0x177038){this['id']=_0x177038['id']||0x0;this[_0x3b66('0x0')]=_0x177038[_0x3b66('0x0')]||'';this['username']=_0x177038['username']||'';this['remoteUri']=_0x177038['remoteUri']||'';this[_0x3b66('0x1')]=_0x177038[_0x3b66('0x1')]||'';this[_0x3b66('0x2')]=_0x177038[_0x3b66('0x2')]||'';this[_0x3b66('0x3')]=_0x177038[_0x3b66('0x3')]||'';this['consumerSecret']=_0x177038[_0x3b66('0x4')]||'';this[_0x3b66('0x5')]=_0x177038[_0x3b66('0x5')]||'';this[_0x3b66('0x6')]=_0x177038[_0x3b66('0x6')]||'';this[_0x3b66('0x7')]=_0x177038[_0x3b66('0x7')]||'';this[_0x3b66('0x8')]=_0x177038['serverUrl']||'';this[_0x3b66('0x9')]=_0x177038[_0x3b66('0x9')]||{};}module[_0x3b66('0xa')]=DeskAccount; \ No newline at end of file +var _0xb68a=['consumerKey','consumerSecret','token','tokenSecret','type','serverUrl','Configurations','exports','name','remoteUri','authType','password'];(function(_0x4c8c76,_0x216859){var _0x206ac9=function(_0x4c0d2){while(--_0x4c0d2){_0x4c8c76['push'](_0x4c8c76['shift']());}};_0x206ac9(++_0x216859);}(_0xb68a,0x11c));var _0xab68=function(_0x4a7906,_0x3ef77d){_0x4a7906=_0x4a7906-0x0;var _0x558373=_0xb68a[_0x4a7906];return _0x558373;};'use strict';function DeskAccount(_0x496b63){this['id']=_0x496b63['id']||0x0;this[_0xab68('0x0')]=_0x496b63[_0xab68('0x0')]||'';this['username']=_0x496b63['username']||'';this[_0xab68('0x1')]=_0x496b63[_0xab68('0x1')]||'';this[_0xab68('0x2')]=_0x496b63['authType']||'';this[_0xab68('0x3')]=_0x496b63[_0xab68('0x3')]||'';this[_0xab68('0x4')]=_0x496b63[_0xab68('0x4')]||'';this[_0xab68('0x5')]=_0x496b63['consumerSecret']||'';this[_0xab68('0x6')]=_0x496b63[_0xab68('0x6')]||'';this[_0xab68('0x7')]=_0x496b63[_0xab68('0x7')]||'';this[_0xab68('0x8')]=_0x496b63[_0xab68('0x8')]||'';this['serverUrl']=_0x496b63[_0xab68('0x9')]||'';this[_0xab68('0xa')]=_0x496b63[_0xab68('0xa')]||{};}module[_0xab68('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 3e16e2b..e5bbb88 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 _0xe9e1=['clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','exports','name','username','password','remoteUri','tenantId'];(function(_0x483181,_0x1496ec){var _0x4f274f=function(_0x5d47a5){while(--_0x5d47a5){_0x483181['push'](_0x483181['shift']());}};_0x4f274f(++_0x1496ec);}(_0xe9e1,0x16f));var _0x1e9e=function(_0x137e67,_0x250ea7){_0x137e67=_0x137e67-0x0;var _0x2fb122=_0xe9e1[_0x137e67];return _0x2fb122;};'use strict';function Dynamics365Account(_0x511ddd){this['id']=_0x511ddd['id']||0x0;this[_0x1e9e('0x0')]=_0x511ddd[_0x1e9e('0x0')]||'';this[_0x1e9e('0x1')]=_0x511ddd[_0x1e9e('0x1')]||'';this['password']=_0x511ddd[_0x1e9e('0x2')]||'';this[_0x1e9e('0x3')]=_0x511ddd[_0x1e9e('0x3')]||'';this[_0x1e9e('0x4')]=_0x511ddd[_0x1e9e('0x4')]||'';this[_0x1e9e('0x5')]=_0x511ddd[_0x1e9e('0x5')]||'';this[_0x1e9e('0x6')]=_0x511ddd[_0x1e9e('0x6')]||{};this[_0x1e9e('0x7')]=_0x511ddd[_0x1e9e('0x7')]||'';this[_0x1e9e('0x8')]=_0x511ddd['modernAuthentication']||![];this[_0x1e9e('0x9')]=_0x511ddd[_0x1e9e('0x9')]||{};this[_0x1e9e('0xa')]=_0x511ddd[_0x1e9e('0xa')]||{};}module[_0x1e9e('0xb')]=Dynamics365Account; \ No newline at end of file +var _0xa2bc=['tenantId','clientId','clientSecret','serverUrl','modernAuthentication','Configurations','CloudProvider','name','remoteUri'];(function(_0x9e4f7,_0x10c9f2){var _0x4c4361=function(_0x349080){while(--_0x349080){_0x9e4f7['push'](_0x9e4f7['shift']());}};_0x4c4361(++_0x10c9f2);}(_0xa2bc,0x1c0));var _0xca2b=function(_0x5e4e63,_0x3d799e){_0x5e4e63=_0x5e4e63-0x0;var _0x355c71=_0xa2bc[_0x5e4e63];return _0x355c71;};'use strict';function Dynamics365Account(_0x3ac615){this['id']=_0x3ac615['id']||0x0;this[_0xca2b('0x0')]=_0x3ac615['name']||'';this['username']=_0x3ac615['username']||'';this['password']=_0x3ac615['password']||'';this[_0xca2b('0x1')]=_0x3ac615[_0xca2b('0x1')]||'';this[_0xca2b('0x2')]=_0x3ac615[_0xca2b('0x2')]||'';this[_0xca2b('0x3')]=_0x3ac615[_0xca2b('0x3')]||'';this[_0xca2b('0x4')]=_0x3ac615['clientSecret']||{};this['serverUrl']=_0x3ac615[_0xca2b('0x5')]||'';this[_0xca2b('0x6')]=_0x3ac615[_0xca2b('0x6')]||![];this[_0xca2b('0x7')]=_0x3ac615[_0xca2b('0x7')]||{};this[_0xca2b('0x8')]=_0x3ac615['CloudProvider']||{};}module['exports']=Dynamics365Account; \ No newline at end of file diff --git a/server/services/ami/model/faxAccount.js b/server/services/ami/model/faxAccount.js index 32dfc13..fe82b72 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 _0x2faf=['tech','Trunk','ListId','key','exports','name','description','ecm','headerinfo','localstationid','minrate','maxrate','modem','v17,v27,v29','gateway','faxdetect','t38timeout'];(function(_0x1dae44,_0x5c7cad){var _0x3af66c=function(_0x38ac0d){while(--_0x38ac0d){_0x1dae44['push'](_0x1dae44['shift']());}};_0x3af66c(++_0x5c7cad);}(_0x2faf,0x16a));var _0xf2fa=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x2faf[_0x20a584];return _0x4b41a8;};'use strict';function FaxAccount(_0x2f7ee1){this['id']=_0x2f7ee1['id']||0x0;this[_0xf2fa('0x0')]=_0x2f7ee1[_0xf2fa('0x0')]||'';this['description']=_0x2f7ee1[_0xf2fa('0x1')];this[_0xf2fa('0x2')]=_0x2f7ee1[_0xf2fa('0x2')];this[_0xf2fa('0x3')]=_0x2f7ee1[_0xf2fa('0x3')];this[_0xf2fa('0x4')]=_0x2f7ee1['localstationid'];this['minrate']=_0x2f7ee1[_0xf2fa('0x5')]||0x960;this[_0xf2fa('0x6')]=_0x2f7ee1[_0xf2fa('0x6')]||0x3840;this[_0xf2fa('0x7')]=_0x2f7ee1[_0xf2fa('0x7')]||_0xf2fa('0x8');this[_0xf2fa('0x9')]=_0x2f7ee1[_0xf2fa('0x9')]||'no';this[_0xf2fa('0xa')]=_0x2f7ee1[_0xf2fa('0xa')]||'no';this['t38timeout']=_0x2f7ee1[_0xf2fa('0xb')]||0x1388;this[_0xf2fa('0xc')]=_0x2f7ee1[_0xf2fa('0xc')]||'SIP';this['Trunk']=_0x2f7ee1[_0xf2fa('0xd')]?_0x2f7ee1[_0xf2fa('0xd')]:undefined;this['ListId']=_0x2f7ee1[_0xf2fa('0xe')];this['key']=_0x2f7ee1[_0xf2fa('0xf')];}module[_0xf2fa('0x10')]=FaxAccount; \ No newline at end of file +var _0xa0ae=['headerinfo','localstationid','minrate','maxrate','v17,v27,v29','gateway','faxdetect','tech','SIP','Trunk','ListId','key','exports','name','description','ecm'];(function(_0x249663,_0x515102){var _0xa1ef6d=function(_0x555078){while(--_0x555078){_0x249663['push'](_0x249663['shift']());}};_0xa1ef6d(++_0x515102);}(_0xa0ae,0x15d));var _0xea0a=function(_0x18c8b5,_0x2a15d3){_0x18c8b5=_0x18c8b5-0x0;var _0x358984=_0xa0ae[_0x18c8b5];return _0x358984;};'use strict';function FaxAccount(_0x1afc74){this['id']=_0x1afc74['id']||0x0;this[_0xea0a('0x0')]=_0x1afc74[_0xea0a('0x0')]||'';this[_0xea0a('0x1')]=_0x1afc74[_0xea0a('0x1')];this[_0xea0a('0x2')]=_0x1afc74[_0xea0a('0x2')];this[_0xea0a('0x3')]=_0x1afc74[_0xea0a('0x3')];this[_0xea0a('0x4')]=_0x1afc74[_0xea0a('0x4')];this[_0xea0a('0x5')]=_0x1afc74[_0xea0a('0x5')]||0x960;this[_0xea0a('0x6')]=_0x1afc74[_0xea0a('0x6')]||0x3840;this['modem']=_0x1afc74['modem']||_0xea0a('0x7');this['gateway']=_0x1afc74[_0xea0a('0x8')]||'no';this['faxdetect']=_0x1afc74[_0xea0a('0x9')]||'no';this['t38timeout']=_0x1afc74['t38timeout']||0x1388;this[_0xea0a('0xa')]=_0x1afc74['tech']||_0xea0a('0xb');this[_0xea0a('0xc')]=_0x1afc74[_0xea0a('0xc')]?_0x1afc74[_0xea0a('0xc')]:undefined;this[_0xea0a('0xd')]=_0x1afc74[_0xea0a('0xd')];this['key']=_0x1afc74[_0xea0a('0xe')];}module[_0xea0a('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 a4c557e..c900301 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 _0xe510=['token','remoteUri','serverUrl','Configurations','exports','username','apiKey'];(function(_0x3540c0,_0x30c610){var _0x12b667=function(_0x1dac18){while(--_0x1dac18){_0x3540c0['push'](_0x3540c0['shift']());}};_0x12b667(++_0x30c610);}(_0xe510,0x17f));var _0x0e51=function(_0x25e7cb,_0x3579b7){_0x25e7cb=_0x25e7cb-0x0;var _0x375d92=_0xe510[_0x25e7cb];return _0x375d92;};'use strict';function FreshdeskAccount(_0x7305cf){this['id']=_0x7305cf['id']||0x0;this['name']=_0x7305cf['name']||'';this[_0x0e51('0x0')]=_0x7305cf[_0x0e51('0x0')]||'';this[_0x0e51('0x1')]=_0x7305cf[_0x0e51('0x2')]||'';this[_0x0e51('0x3')]=_0x7305cf[_0x0e51('0x3')]||'';this[_0x0e51('0x4')]=_0x7305cf[_0x0e51('0x4')]||'';this[_0x0e51('0x5')]=_0x7305cf['Configurations']||{};}module[_0x0e51('0x6')]=FreshdeskAccount; \ No newline at end of file +var _0x7455=['Configurations','exports','name','username','apiKey','token','remoteUri','serverUrl'];(function(_0x465028,_0x4570ac){var _0xb783d4=function(_0x5458c5){while(--_0x5458c5){_0x465028['push'](_0x465028['shift']());}};_0xb783d4(++_0x4570ac);}(_0x7455,0x182));var _0x5745=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x7455[_0x14add3];return _0x4a174f;};'use strict';function FreshdeskAccount(_0x8419d8){this['id']=_0x8419d8['id']||0x0;this['name']=_0x8419d8[_0x5745('0x0')]||'';this[_0x5745('0x1')]=_0x8419d8[_0x5745('0x1')]||'';this[_0x5745('0x2')]=_0x8419d8[_0x5745('0x3')]||'';this[_0x5745('0x4')]=_0x8419d8[_0x5745('0x4')]||'';this[_0x5745('0x5')]=_0x8419d8[_0x5745('0x5')]||'';this[_0x5745('0x6')]=_0x8419d8[_0x5745('0x6')]||{};}module[_0x5745('0x7')]=FreshdeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/freshsalesAccount.js b/server/services/ami/model/freshsalesAccount.js index 1cb1a67..c47966c 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 _0x3595=['username','apiKey','token','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x9d2abf,_0x14b007){var _0x194409=function(_0x341271){while(--_0x341271){_0x9d2abf['push'](_0x9d2abf['shift']());}};_0x194409(++_0x14b007);}(_0x3595,0x147));var _0x5359=function(_0x4c8829,_0x6e1757){_0x4c8829=_0x4c8829-0x0;var _0x44cfe2=_0x3595[_0x4c8829];return _0x44cfe2;};'use strict';function FreshsalesAccount(_0x503d1a){this['id']=_0x503d1a['id']||0x0;this[_0x5359('0x0')]=_0x503d1a[_0x5359('0x0')]||'';this['username']=_0x503d1a[_0x5359('0x1')]||'';this[_0x5359('0x2')]=_0x503d1a[_0x5359('0x3')]||'';this[_0x5359('0x4')]=_0x503d1a[_0x5359('0x4')]||'';this[_0x5359('0x5')]=_0x503d1a['serverUrl']||'';this['Configurations']=_0x503d1a[_0x5359('0x6')]||{};}module[_0x5359('0x7')]=FreshsalesAccount; \ No newline at end of file +var _0x4f5d=['serverUrl','Configurations','exports','name','username','apiKey','remoteUri'];(function(_0xce4f07,_0x4b656d){var _0x1c22a9=function(_0x433f6c){while(--_0x433f6c){_0xce4f07['push'](_0xce4f07['shift']());}};_0x1c22a9(++_0x4b656d);}(_0x4f5d,0x1d1));var _0xd4f5=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x4f5d[_0x50a0c2];return _0x5ebadd;};'use strict';function FreshsalesAccount(_0x30ec55){this['id']=_0x30ec55['id']||0x0;this[_0xd4f5('0x0')]=_0x30ec55[_0xd4f5('0x0')]||'';this[_0xd4f5('0x1')]=_0x30ec55[_0xd4f5('0x1')]||'';this[_0xd4f5('0x2')]=_0x30ec55['token']||'';this[_0xd4f5('0x3')]=_0x30ec55[_0xd4f5('0x3')]||'';this[_0xd4f5('0x4')]=_0x30ec55[_0xd4f5('0x4')]||'';this[_0xd4f5('0x5')]=_0x30ec55[_0xd4f5('0x5')]||{};}module[_0xd4f5('0x6')]=FreshsalesAccount; \ No newline at end of file diff --git a/server/services/ami/model/queueReport.js b/server/services/ami/model/queueReport.js index a048a7b..4e07226 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 _0xbdb8=['queuecallerexit','queuecallerexitAt','originalposition','channel','connectedlinenum','connectedlinename','accountcode','context','exten','priority','holdtime','assigned','motionChannel','routealias','mohtime','variables','exports','type','inbound','calleridnum','calleridname','queue','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x392b36,_0x538958){var _0x53963c=function(_0xcb2474){while(--_0xcb2474){_0x392b36['push'](_0x392b36['shift']());}};_0x53963c(++_0x538958);}(_0xbdb8,0x18a));var _0x8bdb=function(_0x50fda9,_0x5ee44b){_0x50fda9=_0x50fda9-0x0;var _0x36b92b=_0xbdb8[_0x50fda9];return _0x36b92b;};'use strict';function QueueReport(){this[_0x8bdb('0x0')]=_0x8bdb('0x1');this['uniqueid']='';this[_0x8bdb('0x2')]='';this[_0x8bdb('0x3')]='';this[_0x8bdb('0x4')]='';this[_0x8bdb('0x5')]=null;this[_0x8bdb('0x6')]=null;this[_0x8bdb('0x7')]=0x1;this[_0x8bdb('0x8')]=0x1;this['queuecallerabandon']=![];this[_0x8bdb('0x9')]=null;this[_0x8bdb('0xa')]=![];this[_0x8bdb('0xb')]=null;this[_0x8bdb('0xc')]=![];this[_0x8bdb('0xd')]=null;this[_0x8bdb('0xe')]=0x1;this[_0x8bdb('0xf')]='';this[_0x8bdb('0x10')]='';this[_0x8bdb('0x11')]='';this[_0x8bdb('0x12')]='';this[_0x8bdb('0x13')]='';this[_0x8bdb('0x14')]='';this[_0x8bdb('0x15')]='';this[_0x8bdb('0x16')]=0x0;this[_0x8bdb('0x17')]=![];this['lastAssignedTo']='';this[_0x8bdb('0x18')]='voice';this[_0x8bdb('0x19')]=null;this[_0x8bdb('0x1a')]=0x0;this[_0x8bdb('0x1b')]={};}module[_0x8bdb('0x1c')]=QueueReport; \ No newline at end of file +var _0xe5ac=['assigned','lastAssignedTo','motionChannel','voice','mohtime','exports','inbound','uniqueid','calleridnum','calleridname','queuecallerjoinAt','queuecallerleaveAt','position','count','queuecallerabandonAt','queuecallercomplete','queuecallercompleteAt','queuecallerexitAt','originalposition','connectedlinenum','connectedlinename','accountcode','context','priority','holdtime'];(function(_0xb33e4d,_0x37712d){var _0x2d4675=function(_0x1c17ed){while(--_0x1c17ed){_0xb33e4d['push'](_0xb33e4d['shift']());}};_0x2d4675(++_0x37712d);}(_0xe5ac,0x132));var _0xce5a=function(_0x338b87,_0x352f2d){_0x338b87=_0x338b87-0x0;var _0x2e8d3d=_0xe5ac[_0x338b87];return _0x2e8d3d;};'use strict';function QueueReport(){this['type']=_0xce5a('0x0');this[_0xce5a('0x1')]='';this[_0xce5a('0x2')]='';this[_0xce5a('0x3')]='';this['queue']='';this[_0xce5a('0x4')]=null;this[_0xce5a('0x5')]=null;this[_0xce5a('0x6')]=0x1;this[_0xce5a('0x7')]=0x1;this['queuecallerabandon']=![];this[_0xce5a('0x8')]=null;this[_0xce5a('0x9')]=![];this[_0xce5a('0xa')]=null;this['queuecallerexit']=![];this[_0xce5a('0xb')]=null;this[_0xce5a('0xc')]=0x1;this['channel']='';this[_0xce5a('0xd')]='';this[_0xce5a('0xe')]='';this[_0xce5a('0xf')]='';this[_0xce5a('0x10')]='';this['exten']='';this[_0xce5a('0x11')]='';this[_0xce5a('0x12')]=0x0;this[_0xce5a('0x13')]=![];this[_0xce5a('0x14')]='';this[_0xce5a('0x15')]=_0xce5a('0x16');this['routealias']=null;this[_0xce5a('0x17')]=0x0;this['variables']={};}module[_0xce5a('0x18')]=QueueReport; \ No newline at end of file diff --git a/server/services/ami/model/salesforceAccount.js b/server/services/ami/model/salesforceAccount.js index 96eb3a8..72164f6 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 _0xbd6d=['password','clientId','securityToken','type','integrationTab','serverUrl','Configurations','name','username','remoteUri'];(function(_0x80a702,_0x2488fd){var _0x17cfc8=function(_0x240747){while(--_0x240747){_0x80a702['push'](_0x80a702['shift']());}};_0x17cfc8(++_0x2488fd);}(_0xbd6d,0xc5));var _0xdbd6=function(_0x2b9bae,_0x3b771f){_0x2b9bae=_0x2b9bae-0x0;var _0x104ea6=_0xbd6d[_0x2b9bae];return _0x104ea6;};'use strict';function SalesforceAccount(_0x39b381){this['id']=_0x39b381['id']||0x0;this[_0xdbd6('0x0')]=_0x39b381[_0xdbd6('0x0')]||'';this[_0xdbd6('0x1')]=_0x39b381[_0xdbd6('0x1')]||'';this['remoteUri']=_0x39b381[_0xdbd6('0x2')]||'';this[_0xdbd6('0x3')]=_0x39b381[_0xdbd6('0x3')]||'';this[_0xdbd6('0x4')]=_0x39b381[_0xdbd6('0x4')]||'';this['clientSecret']=_0x39b381['clientSecret']||'';this[_0xdbd6('0x5')]=_0x39b381[_0xdbd6('0x5')]||'';this[_0xdbd6('0x6')]=_0x39b381[_0xdbd6('0x6')]||_0xdbd6('0x7');this[_0xdbd6('0x8')]=_0x39b381[_0xdbd6('0x8')]||'';this[_0xdbd6('0x9')]=_0x39b381['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file +var _0xc493=['username','remoteUri','password','clientId','clientSecret','securityToken','type','integrationTab','serverUrl','Configurations','name'];(function(_0x1153d9,_0x5d9bcb){var _0x5a53ae=function(_0x370f0d){while(--_0x370f0d){_0x1153d9['push'](_0x1153d9['shift']());}};_0x5a53ae(++_0x5d9bcb);}(_0xc493,0xba));var _0x3c49=function(_0x258175,_0x55aac3){_0x258175=_0x258175-0x0;var _0x2a02fd=_0xc493[_0x258175];return _0x2a02fd;};'use strict';function SalesforceAccount(_0x5256b1){this['id']=_0x5256b1['id']||0x0;this[_0x3c49('0x0')]=_0x5256b1['name']||'';this[_0x3c49('0x1')]=_0x5256b1[_0x3c49('0x1')]||'';this[_0x3c49('0x2')]=_0x5256b1[_0x3c49('0x2')]||'';this[_0x3c49('0x3')]=_0x5256b1[_0x3c49('0x3')]||'';this[_0x3c49('0x4')]=_0x5256b1[_0x3c49('0x4')]||'';this[_0x3c49('0x5')]=_0x5256b1[_0x3c49('0x5')]||'';this[_0x3c49('0x6')]=_0x5256b1[_0x3c49('0x6')]||'';this['type']=_0x5256b1[_0x3c49('0x7')]||_0x3c49('0x8');this[_0x3c49('0x9')]=_0x5256b1['serverUrl']||'';this[_0x3c49('0xa')]=_0x5256b1['Configurations']||{};}module['exports']=SalesforceAccount; \ No newline at end of file diff --git a/server/services/ami/model/servicenowAccount.js b/server/services/ami/model/servicenowAccount.js index b335bb5..74a192f 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 _0xcf1c=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x369151,_0x179f72){var _0x4292d5=function(_0x330422){while(--_0x330422){_0x369151['push'](_0x369151['shift']());}};_0x4292d5(++_0x179f72);}(_0xcf1c,0x1a3));var _0xccf1=function(_0x4489b6,_0x47c466){_0x4489b6=_0x4489b6-0x0;var _0x13a4bb=_0xcf1c[_0x4489b6];return _0x13a4bb;};'use strict';function ServicenowAccount(_0x4d8743){this['id']=_0x4d8743['id']||0x0;this['name']=_0x4d8743[_0xccf1('0x0')]||'';this[_0xccf1('0x1')]=_0x4d8743[_0xccf1('0x1')]||'';this[_0xccf1('0x2')]=_0x4d8743[_0xccf1('0x2')]||'';this[_0xccf1('0x3')]=_0x4d8743[_0xccf1('0x3')]||'';this[_0xccf1('0x4')]=_0x4d8743[_0xccf1('0x4')]||'';this[_0xccf1('0x5')]=_0x4d8743[_0xccf1('0x5')]||{};}module[_0xccf1('0x6')]=ServicenowAccount; \ No newline at end of file +var _0x3692=['exports','name','username','password','remoteUri','Configurations'];(function(_0x57643b,_0x1706fe){var _0x53a35b=function(_0x2625e8){while(--_0x2625e8){_0x57643b['push'](_0x57643b['shift']());}};_0x53a35b(++_0x1706fe);}(_0x3692,0x145));var _0x2369=function(_0x400635,_0x49a764){_0x400635=_0x400635-0x0;var _0x5b0c61=_0x3692[_0x400635];return _0x5b0c61;};'use strict';function ServicenowAccount(_0x3fdad2){this['id']=_0x3fdad2['id']||0x0;this['name']=_0x3fdad2[_0x2369('0x0')]||'';this[_0x2369('0x1')]=_0x3fdad2['username']||'';this['password']=_0x3fdad2[_0x2369('0x2')]||'';this[_0x2369('0x3')]=_0x3fdad2[_0x2369('0x3')]||'';this['serverUrl']=_0x3fdad2['serverUrl']||'';this[_0x2369('0x4')]=_0x3fdad2[_0x2369('0x4')]||{};}module[_0x2369('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 7107aa1..c8f819e 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 _0x6a26=['username','password','remoteUri','serverUrl','Configurations','exports','name'];(function(_0x61e729,_0x370dcf){var _0x5335d4=function(_0x1bd8c4){while(--_0x1bd8c4){_0x61e729['push'](_0x61e729['shift']());}};_0x5335d4(++_0x370dcf);}(_0x6a26,0x14f));var _0x66a2=function(_0x16dec3,_0x1162ab){_0x16dec3=_0x16dec3-0x0;var _0x51dcab=_0x6a26[_0x16dec3];return _0x51dcab;};'use strict';function SugarcrmAccount(_0x37c539){this['id']=_0x37c539['id']||0x0;this[_0x66a2('0x0')]=_0x37c539[_0x66a2('0x0')]||'';this['username']=_0x37c539[_0x66a2('0x1')]||'';this[_0x66a2('0x2')]=_0x37c539['password']||'';this[_0x66a2('0x3')]=_0x37c539['remoteUri']||'';this[_0x66a2('0x4')]=_0x37c539[_0x66a2('0x4')]||'';this['Configurations']=_0x37c539[_0x66a2('0x5')]||{};}module[_0x66a2('0x6')]=SugarcrmAccount; \ No newline at end of file +var _0xd54a=['serverUrl','Configurations','exports','name','username','password','remoteUri'];(function(_0x11fb34,_0x4ef521){var _0x442f90=function(_0x571ee8){while(--_0x571ee8){_0x11fb34['push'](_0x11fb34['shift']());}};_0x442f90(++_0x4ef521);}(_0xd54a,0x1df));var _0xad54=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0xd54a[_0x3ab51d];return _0x29a04e;};'use strict';function SugarcrmAccount(_0x2f3149){this['id']=_0x2f3149['id']||0x0;this['name']=_0x2f3149[_0xad54('0x0')]||'';this[_0xad54('0x1')]=_0x2f3149['username']||'';this[_0xad54('0x2')]=_0x2f3149[_0xad54('0x2')]||'';this[_0xad54('0x3')]=_0x2f3149['remoteUri']||'';this[_0xad54('0x4')]=_0x2f3149[_0xad54('0x4')]||'';this[_0xad54('0x5')]=_0x2f3149[_0xad54('0x5')]||{};}module[_0xad54('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 b09a248..e691017 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 _0x0507=['status','exports','name','accountcode','state','unknown'];(function(_0x4bf264,_0x3be730){var _0x3c855f=function(_0xabf944){while(--_0xabf944){_0x4bf264['push'](_0x4bf264['shift']());}};_0x3c855f(++_0x3be730);}(_0x0507,0x15e));var _0x7050=function(_0x274815,_0xfe7a07){_0x274815=_0x274815-0x0;var _0x240363=_0x0507[_0x274815];return _0x240363;};'use strict';function Telephone(_0x3aa2f6){this['id']=_0x3aa2f6['id']||0x0;this[_0x7050('0x0')]=_0x3aa2f6[_0x7050('0x0')]||'';this[_0x7050('0x1')]=_0x3aa2f6['accountcode']||'';this[_0x7050('0x2')]=_0x7050('0x3');this['stateTime']=0x0;this[_0x7050('0x4')]=_0x7050('0x3');this['address']='';}module[_0x7050('0x5')]=Telephone; \ No newline at end of file +var _0xf330=['stateTime','exports','name','accountcode','unknown'];(function(_0x1f164a,_0x3643b8){var _0x128a4d=function(_0x51c7b9){while(--_0x51c7b9){_0x1f164a['push'](_0x1f164a['shift']());}};_0x128a4d(++_0x3643b8);}(_0xf330,0x147));var _0x0f33=function(_0x5b32ff,_0x2b4521){_0x5b32ff=_0x5b32ff-0x0;var _0x2d3b67=_0xf330[_0x5b32ff];return _0x2d3b67;};'use strict';function Telephone(_0x357dc9){this['id']=_0x357dc9['id']||0x0;this['name']=_0x357dc9[_0x0f33('0x0')]||'';this[_0x0f33('0x1')]=_0x357dc9[_0x0f33('0x1')]||'';this['state']=_0x0f33('0x2');this[_0x0f33('0x3')]=0x0;this['status']=_0x0f33('0x2');this['address']='';}module[_0x0f33('0x4')]=Telephone; \ No newline at end of file diff --git a/server/services/ami/model/template.js b/server/services/ami/model/template.js index a72fd27..1ec09f4 100644 --- a/server/services/ami/model/template.js +++ b/server/services/ami/model/template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['exports','name'];(function(_0x188806,_0x4c01a6){var _0x2e83e5=function(_0x322ee8){while(--_0x322ee8){_0x188806['push'](_0x188806['shift']());}};_0x2e83e5(++_0x4c01a6);}(_0xa9e0,0x123));var _0x0a9e=function(_0x47b58b,_0x41a189){_0x47b58b=_0x47b58b-0x0;var _0x46bebe=_0xa9e0[_0x47b58b];return _0x46bebe;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file +var _0xa9e0=['exports','name'];(function(_0x452f8d,_0x50ab1d){var _0x202287=function(_0x32334e){while(--_0x32334e){_0x452f8d['push'](_0x452f8d['shift']());}};_0x202287(++_0x50ab1d);}(_0xa9e0,0x123));var _0x0a9e=function(_0xbe200f,_0x4b50eb){_0xbe200f=_0xbe200f-0x0;var _0x192597=_0xa9e0[_0xbe200f];return _0x192597;};'use strict';function template(_0x1f0015){this['id']=_0x1f0015['id']||0x0;this[_0x0a9e('0x0')]=_0x1f0015[_0x0a9e('0x0')]||'';this['html']=_0x1f0015['html']||'';}module[_0x0a9e('0x1')]=template; \ No newline at end of file diff --git a/server/services/ami/model/trigger.js b/server/services/ami/model/trigger.js index 2091a2d..296cff3 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 _0x4fc2=['name','channel','voice','status','AllConditions','AnyConditions','Actions'];(function(_0x298227,_0x4aca91){var _0x259b72=function(_0x4619c7){while(--_0x4619c7){_0x298227['push'](_0x298227['shift']());}};_0x259b72(++_0x4aca91);}(_0x4fc2,0x111));var _0x24fc=function(_0x599c76,_0x3a5b7e){_0x599c76=_0x599c76-0x0;var _0x5e6a38=_0x4fc2[_0x599c76];return _0x5e6a38;};'use strict';function Trigger(_0x5ea3ab){this['id']=_0x5ea3ab['id']||0x0;this[_0x24fc('0x0')]=_0x5ea3ab[_0x24fc('0x0')]||'';this[_0x24fc('0x1')]=_0x5ea3ab['channel']||_0x24fc('0x2');this[_0x24fc('0x3')]=_0x5ea3ab[_0x24fc('0x3')]||![];this['AllConditions']=_0x5ea3ab[_0x24fc('0x4')]||[];this[_0x24fc('0x5')]=_0x5ea3ab['AnyConditions']||[];this[_0x24fc('0x6')]=_0x5ea3ab[_0x24fc('0x6')]||[];}module['exports']=Trigger; \ No newline at end of file +var _0xb7e7=['Actions','exports','name','channel','status','AllConditions','AnyConditions'];(function(_0x480b14,_0x397259){var _0x271f62=function(_0x3a47a1){while(--_0x3a47a1){_0x480b14['push'](_0x480b14['shift']());}};_0x271f62(++_0x397259);}(_0xb7e7,0x121));var _0x7b7e=function(_0x298ed3,_0x4ab5e1){_0x298ed3=_0x298ed3-0x0;var _0x5aad28=_0xb7e7[_0x298ed3];return _0x5aad28;};'use strict';function Trigger(_0x2e5e07){this['id']=_0x2e5e07['id']||0x0;this['name']=_0x2e5e07[_0x7b7e('0x0')]||'';this['channel']=_0x2e5e07[_0x7b7e('0x1')]||'voice';this[_0x7b7e('0x2')]=_0x2e5e07['status']||![];this[_0x7b7e('0x3')]=_0x2e5e07[_0x7b7e('0x3')]||[];this[_0x7b7e('0x4')]=_0x2e5e07['AnyConditions']||[];this['Actions']=_0x2e5e07[_0x7b7e('0x5')]||[];}module[_0x7b7e('0x6')]=Trigger; \ No newline at end of file diff --git a/server/services/ami/model/trunk.js b/server/services/ami/model/trunk.js index 23ca6e2..a63df49 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 _0xc531=['address','defaultuser','exports','name','state','stateTime','status','unknown','registry','split','host','domain','domainport'];(function(_0x1385dc,_0x2c7fd7){var _0x2f6469=function(_0x47ed8a){while(--_0x47ed8a){_0x1385dc['push'](_0x1385dc['shift']());}};_0x2f6469(++_0x2c7fd7);}(_0xc531,0xac));var _0x1c53=function(_0x3bd4c0,_0x26b3d8){_0x3bd4c0=_0x3bd4c0-0x0;var _0x2f3485=_0xc531[_0x3bd4c0];return _0x2f3485;};'use strict';function Trunk(_0x1b9c1b){this['id']=_0x1b9c1b['id']||0x0;this['active']=_0x1b9c1b['active']||![];this[_0x1c53('0x0')]=_0x1b9c1b[_0x1c53('0x0')]||'';this[_0x1c53('0x1')]='unknown';this[_0x1c53('0x2')]=0x0;this[_0x1c53('0x3')]=_0x1c53('0x4');this['registry']=_0x1b9c1b[_0x1c53('0x5')]&&_0x1b9c1b[_0x1c53('0x5')]['indexOf'](':')?_0x1b9c1b[_0x1c53('0x5')][_0x1c53('0x6')](':')[0x0]:'';this[_0x1c53('0x7')]='';this['port']='';this[_0x1c53('0x8')]='';this[_0x1c53('0x9')]='';this['refresh']='';this['stateRegistry']='unknown';this['registrationtime']='';this[_0x1c53('0xa')]='';this[_0x1c53('0xb')]=_0x1b9c1b[_0x1c53('0xb')]||'';}module[_0x1c53('0xc')]=Trunk; \ No newline at end of file +var _0x7fba=['state','stateTime','status','unknown','registry','indexOf','host','port','domain','domainport','refresh','stateRegistry','address','defaultuser','active','name'];(function(_0x31172e,_0xa59e5){var _0x414ada=function(_0x37ede4){while(--_0x37ede4){_0x31172e['push'](_0x31172e['shift']());}};_0x414ada(++_0xa59e5);}(_0x7fba,0xbe));var _0xa7fb=function(_0x40662e,_0x27f841){_0x40662e=_0x40662e-0x0;var _0x1a0710=_0x7fba[_0x40662e];return _0x1a0710;};'use strict';function Trunk(_0x55e205){this['id']=_0x55e205['id']||0x0;this[_0xa7fb('0x0')]=_0x55e205['active']||![];this[_0xa7fb('0x1')]=_0x55e205[_0xa7fb('0x1')]||'';this[_0xa7fb('0x2')]='unknown';this[_0xa7fb('0x3')]=0x0;this[_0xa7fb('0x4')]=_0xa7fb('0x5');this[_0xa7fb('0x6')]=_0x55e205[_0xa7fb('0x6')]&&_0x55e205[_0xa7fb('0x6')][_0xa7fb('0x7')](':')?_0x55e205[_0xa7fb('0x6')]['split'](':')[0x0]:'';this[_0xa7fb('0x8')]='';this[_0xa7fb('0x9')]='';this[_0xa7fb('0xa')]='';this[_0xa7fb('0xb')]='';this[_0xa7fb('0xc')]='';this[_0xa7fb('0xd')]=_0xa7fb('0x5');this['registrationtime']='';this[_0xa7fb('0xe')]='';this[_0xa7fb('0xf')]=_0x55e205[_0xa7fb('0xf')]||'';}module['exports']=Trunk; \ No newline at end of file diff --git a/server/services/ami/model/voiceExtension.js b/server/services/ami/model/voiceExtension.js index 7dfc75e..cd779d0 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 _0x4f14=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x1e7b16,_0x4607a1){var _0x37fadc=function(_0x1fc9ce){while(--_0x1fc9ce){_0x1e7b16['push'](_0x1e7b16['shift']());}};_0x37fadc(++_0x4607a1);}(_0x4f14,0x1e1));var _0x44f1=function(_0x19c09d,_0x5c2b4a){_0x19c09d=_0x19c09d-0x0;var _0x4f05ea=_0x4f14[_0x19c09d];return _0x4f05ea;};'use strict';function voiceExtension(_0x2a318f){this['id']=_0x2a318f['id']||0x0;this[_0x44f1('0x0')]=_0x2a318f[_0x44f1('0x0')]||'';this['recordingFormat']=_0x2a318f[_0x44f1('0x1')]||_0x44f1('0x2');this[_0x44f1('0x3')]=_0x2a318f[_0x44f1('0x3')]||![];}module[_0x44f1('0x4')]=voiceExtension; \ No newline at end of file +var _0x69bb=['exports','exten','recordingFormat','none','mandatoryDisposition'];(function(_0x21339c,_0x24ce4d){var _0x865d81=function(_0x4fd29f){while(--_0x4fd29f){_0x21339c['push'](_0x21339c['shift']());}};_0x865d81(++_0x24ce4d);}(_0x69bb,0x141));var _0xb69b=function(_0x9e673c,_0x6d58ba){_0x9e673c=_0x9e673c-0x0;var _0x502f7c=_0x69bb[_0x9e673c];return _0x502f7c;};'use strict';function voiceExtension(_0x52fe58){this['id']=_0x52fe58['id']||0x0;this[_0xb69b('0x0')]=_0x52fe58[_0xb69b('0x0')]||'';this[_0xb69b('0x1')]=_0x52fe58[_0xb69b('0x1')]||_0xb69b('0x2');this[_0xb69b('0x3')]=_0x52fe58[_0xb69b('0x3')]||![];}module[_0xb69b('0x4')]=voiceExtension; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueue.js b/server/services/ami/model/voiceQueue.js index dbe149d..d08a104 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 _0x20bd=['outboundAbandonedDay','startProgressive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvailable','predictiveIntervalMaxThreshold','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCalls','predictiveIntervalHitRate','erlangCalls','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav49','gsm','fewestcalls','leastrecent','random','ringall','rrmemory','wrandom','name','monitor_format','type','inbound','waiting','sumDuration','sumHoldTime','unmanaged','abandoned','available','invalid','loggedIn','notInUse','onHold','ringing','ringInUse','talking','unknown','acw','acwTimeout','autopause','sendMessageOneNotActive','message','statusMessage','originated','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','timeout','outboundAnswerCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundDropCallsDayTimeout','outboundReCallsDay'];(function(_0x194483,_0x438dce){var _0x39bf73=function(_0x7d522a){while(--_0x7d522a){_0x194483['push'](_0x194483['shift']());}};_0x39bf73(++_0x438dce);}(_0x20bd,0x110));var _0xd20b=function(_0x47e362,_0x32774e){_0x47e362=_0x47e362-0x0;var _0x343311=_0x20bd[_0x47e362];return _0x343311;};'use strict';var monitorFormat={'wav':'wav','wav49':_0xd20b('0x0'),'gsm':_0xd20b('0x1')};var strategy={'fewestcalls':_0xd20b('0x2'),'leastrecent':_0xd20b('0x3'),'linear':'linear','random':_0xd20b('0x4'),'ringall':_0xd20b('0x5'),'rr':'roundrobin','rrmemory':_0xd20b('0x6'),'rrordered':'rrordered','wrandom':_0xd20b('0x7')};function VoiceQueue(_0x459488){this['id']=_0x459488['id']||0x0;this[_0xd20b('0x8')]=_0x459488[_0xd20b('0x8')]||'';this[_0xd20b('0x9')]=_0x459488[_0xd20b('0x9')]||'';this[_0xd20b('0xa')]=_0x459488['type']||_0xd20b('0xb');this[_0xd20b('0xc')]=0x0;this['total']=0x0;this['answered']=0x0;this[_0xd20b('0xd')]=0x0;this[_0xd20b('0xe')]=0x0;this['sumBillable']=0x0;this[_0xd20b('0xf')]=0x0;this[_0xd20b('0x10')]=0x0;this[_0xd20b('0x11')]=0x0;this['busy']=0x0;this['inUse']=0x0;this[_0xd20b('0x12')]=0x0;this[_0xd20b('0x13')]=0x0;this[_0xd20b('0x14')]=0x0;this[_0xd20b('0x15')]=0x0;this['paused']=0x0;this[_0xd20b('0x16')]=0x0;this[_0xd20b('0x17')]=0x0;this[_0xd20b('0x18')]=0x0;this['unavailable']=0x0;this[_0xd20b('0x19')]=0x0;this[_0xd20b('0x1a')]=_0x459488[_0xd20b('0x1a')]||![];this[_0xd20b('0x1b')]=_0x459488[_0xd20b('0x1b')]||0xa;this[_0xd20b('0x1c')]=_0x459488[_0xd20b('0x1c')]||'no';this[_0xd20b('0x1d')]=!![];this[_0xd20b('0x1e')]='';this[_0xd20b('0x1f')]='';this[_0xd20b('0x20')]=0x0;this[_0xd20b('0x21')]=0x0;this[_0xd20b('0x22')]=_0x459488[_0xd20b('0x22')]||null;this[_0xd20b('0x23')]=_0x459488[_0xd20b('0x23')]?_0x459488[_0xd20b('0x23')]:null;this[_0xd20b('0x24')]=_0x459488[_0xd20b('0x24')];this['dialMethod']=_0x459488[_0xd20b('0x25')]||'progressive';this[_0xd20b('0x26')]=_0x459488['dialLimitChannel']||0x0;this['dialLimitQueue']=_0x459488[_0xd20b('0x27')]||0x0;this[_0xd20b('0x28')]=_0x459488['dialPowerLevel']||0x1;this[_0xd20b('0x29')]=_0x459488['dialPredictiveOptimization']||_0xd20b('0x2a');this['dialPredictiveOptimizationPercentage']=_0x459488['dialPredictiveOptimizationPercentage']||0.03;this['dialPredictiveInterval']=_0x459488['dialPredictiveInterval']||0x258;this[_0xd20b('0x2b')]=_0x459488[_0xd20b('0x2b')]||'anonymous';this[_0xd20b('0x2c')]=_0x459488[_0xd20b('0x2c')]||_0xd20b('0x2d');this[_0xd20b('0x2e')]=_0x459488[_0xd20b('0x2e')]||0x1e;this['dialQueueOptions']=_0x459488['dialQueueOptions']||_0xd20b('0x2f');this[_0xd20b('0x30')]=_0x459488[_0xd20b('0x30')]||0x3;this[_0xd20b('0x31')]=_0x459488[_0xd20b('0x31')]||undefined;this[_0xd20b('0x32')]=_0x459488[_0xd20b('0x32')]||0x3;this[_0xd20b('0x33')]=_0x459488[_0xd20b('0x33')]||0x96;this[_0xd20b('0x34')]=_0x459488[_0xd20b('0x34')]||0x3;this['dialBusyRetryFrequency']=_0x459488[_0xd20b('0x35')]||0x96;this['dialNoAnswerMaxRetry']=_0x459488[_0xd20b('0x36')]||0x3;this[_0xd20b('0x37')]=_0x459488[_0xd20b('0x37')]||0x96;this[_0xd20b('0x38')]=_0x459488[_0xd20b('0x38')]||0x3;this['dialNoSuchNumberRetryFrequency']=_0x459488['dialNoSuchNumberRetryFrequency']||0x96;this[_0xd20b('0x39')]=_0x459488[_0xd20b('0x39')]||0x3;this[_0xd20b('0x3a')]=_0x459488[_0xd20b('0x3a')]||0x96;this[_0xd20b('0x3b')]=_0x459488[_0xd20b('0x3b')]||0x3;this[_0xd20b('0x3c')]=_0x459488[_0xd20b('0x3c')]||0x96;this[_0xd20b('0x3d')]=_0x459488[_0xd20b('0x3d')]||0x3;this['dialMachineRetryFrequency']=_0x459488['dialMachineRetryFrequency']||0x96;this['dialAgentRejectMaxRetry']=_0x459488[_0xd20b('0x3e')]||0x3;this[_0xd20b('0x3f')]=_0x459488[_0xd20b('0x3f')]||0x96;this[_0xd20b('0x40')]=_0x459488[_0xd20b('0x40')]||0x3;this['dialGlobalMaxRetry']=_0x459488[_0xd20b('0x41')]||0x4;this['Trunk']=_0x459488[_0xd20b('0x42')]?_0x459488[_0xd20b('0x42')]:undefined;this[_0xd20b('0x43')]=_0x459488[_0xd20b('0x43')]?_0x459488[_0xd20b('0x43')]:undefined;this[_0xd20b('0x44')]=_0x459488[_0xd20b('0x44')]||undefined;this[_0xd20b('0x45')]=_0x459488[_0xd20b('0x45')]?_0x459488[_0xd20b('0x45')]:undefined;this['dialOrderByScheduledAt']=_0x459488[_0xd20b('0x46')]||_0xd20b('0x47');this[_0xd20b('0x48')]=_0x459488[_0xd20b('0x48')]||undefined;this[_0xd20b('0x49')]=_0x459488[_0xd20b('0x49')]||undefined;this[_0xd20b('0x4a')]=strategy[_0x459488[_0xd20b('0x4a')]];this[_0xd20b('0x4b')]=!![];this[_0xd20b('0x4c')]=_0x459488['dialAMDActive']||![];this[_0xd20b('0x4d')]=_0x459488[_0xd20b('0x4d')];this[_0xd20b('0x4e')]=_0x459488[_0xd20b('0x4e')];this[_0xd20b('0x4f')]=_0x459488[_0xd20b('0x4f')];this[_0xd20b('0x50')]=_0x459488[_0xd20b('0x50')];this[_0xd20b('0x51')]=_0x459488['dialAMDMinWordLength'];this[_0xd20b('0x52')]=_0x459488[_0xd20b('0x52')];this[_0xd20b('0x53')]=_0x459488[_0xd20b('0x53')];this[_0xd20b('0x54')]=_0x459488[_0xd20b('0x54')];this[_0xd20b('0x55')]=_0x459488['dialAMDMaximumWordLength'];this[_0xd20b('0x56')]=0x0;this['pTalking']=0x0;this[_0xd20b('0x57')]=_0x459488[_0xd20b('0x57')];this[_0xd20b('0x58')]=0x0;this['outboundAnswerAgiCallsDay']=0x0;this[_0xd20b('0x59')]=0x0;this[_0xd20b('0x5a')]=0x0;this['outboundCongestionCallsDay']=0x0;this[_0xd20b('0x5b')]=0x0;this[_0xd20b('0x5c')]=0x0;this[_0xd20b('0x5d')]=0x0;this[_0xd20b('0x5e')]=0x0;this['outboundDropCallsDayCallersExit']=0x0;this[_0xd20b('0x5f')]=0x0;this['outboundDropCallsDayACS']=0x0;this[_0xd20b('0x60')]=0x0;this[_0xd20b('0x61')]=0x0;this[_0xd20b('0x62')]=undefined;this['startPredictive']=undefined;this[_0xd20b('0x63')]=undefined;this[_0xd20b('0x64')]=1.05;this[_0xd20b('0x65')]=0x0;this[_0xd20b('0x66')]=0x0;this[_0xd20b('0x67')]=0x0;this[_0xd20b('0x68')]=0x0;this[_0xd20b('0x69')]=0x0;this['predictiveIntervalAvgTalktime']=0x0;this['predictiveIntervalPauses']=0x0;this[_0xd20b('0x6a')]=0x0;this[_0xd20b('0x6b')]=_0x459488[_0xd20b('0x6c')]||0x14;this[_0xd20b('0x6d')]=_0x459488[_0xd20b('0x6c')]||0xa;this[_0xd20b('0x6e')]=0x0;this['predictiveIntervalErlangCallsDroppedCalls']=0x0;this[_0xd20b('0x6f')]=0x1;this[_0xd20b('0x70')]=0x0;this['erlangCallToSecond']=0x0;this['erlangAbandonmentRate']=0x0;this[_0xd20b('0x71')]=0x0;this[_0xd20b('0x72')]=_0x459488[_0xd20b('0x72')]||0x1e;this[_0xd20b('0x73')]=_0x459488[_0xd20b('0x73')]||![];this[_0xd20b('0x74')]=!!_0x459488[_0xd20b('0x74')]||![];this[_0xd20b('0x75')]=!!_0x459488[_0xd20b('0x75')]||![];this['dialQueueProject2']=_0x459488['dialQueueProject2']||undefined;this[_0xd20b('0x76')]=_0x459488[_0xd20b('0x76')]||![];this[_0xd20b('0x77')]=_0x459488[_0xd20b('0x77')]||![];this['monitor_format']=monitorFormat[_0x459488[_0xd20b('0x9')]]?monitorFormat[_0x459488[_0xd20b('0x9')]]:undefined;this[_0xd20b('0x78')]=_0x459488[_0xd20b('0x78')]||![];this[_0xd20b('0x79')]=_0x459488['mandatoryDispositionPause']?_0x459488[_0xd20b('0x79')]:undefined;this[_0xd20b('0x7a')]=![];}module['exports']=VoiceQueue; \ No newline at end of file +var _0xfde2=['outboundOriginateFailureCallsDay','outboundDropCallsDayCallersExit','outboundReCallsDay','outboundAbandonedDay','startProgressive','startPredictive','handlePredictive','predictiveIntervalMultiplicativeFactor','predictiveIntervalTotalCalls','predictiveIntervalAnsweredCalls','predictiveIntervalDroppedCallsTimeout','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalPauses','predictiveIntervalAvailable','dialPredictiveIntervalMaxThreshold','predictiveIntervalMinThreshold','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','erlangCalls','erlangCallToSecond','erlangBusyFactor','dialRecallMeTimeout','dialRecallInQueue','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','dialQueueProject2','dialAgiAfterHangupClient','dialAgiAfterHangupAgent','mandatoryDisposition','mandatoryDispositionPause','queueSummaryCountersUpdated','wav','wav49','gsm','fewestcalls','leastrecent','linear','random','ringall','rrordered','name','monitor_format','type','inbound','waiting','total','sumDuration','sumHoldTime','sumBillable','unmanaged','available','inUse','invalid','notInUse','paused','ringing','ringInUse','unavailable','unknown','acw','acwTimeout','sendMessageOneNotActive','statusMessage','temp','dialTimezone','dialGlobalInterval','dialActive','dialMethod','progressive','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dropRate','dialPredictiveOptimizationPercentage','dialOriginateCallerIdName','dialOriginateCallerIdNumber','anonymous','dialOriginateTimeout','dialQueueOptions','tTxX','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','Trunk','TrunkBackup','dialPrefix','Interval','dialOrderByScheduledAt','DESC','dialRandomLastDigitCallerIdNumber','dialCutDigit','strategy','queueStatusComplete','dialAMDActive','dialAMDInitialSilence','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','dialAMDMaximumWordLength','outboundRejectCallsDay','pTalking','timeout','outboundAnswerCallsDay','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay'];(function(_0x2b10c6,_0x185590){var _0x3789d2=function(_0x272987){while(--_0x272987){_0x2b10c6['push'](_0x2b10c6['shift']());}};_0x3789d2(++_0x185590);}(_0xfde2,0x122));var _0x2fde=function(_0xdc5d93,_0x594c9c){_0xdc5d93=_0xdc5d93-0x0;var _0x8455e7=_0xfde2[_0xdc5d93];return _0x8455e7;};'use strict';var monitorFormat={'wav':_0x2fde('0x0'),'wav49':_0x2fde('0x1'),'gsm':_0x2fde('0x2')};var strategy={'fewestcalls':_0x2fde('0x3'),'leastrecent':_0x2fde('0x4'),'linear':_0x2fde('0x5'),'random':_0x2fde('0x6'),'ringall':_0x2fde('0x7'),'rr':'roundrobin','rrmemory':'rrmemory','rrordered':_0x2fde('0x8'),'wrandom':'wrandom'};function VoiceQueue(_0x4a420b){this['id']=_0x4a420b['id']||0x0;this[_0x2fde('0x9')]=_0x4a420b[_0x2fde('0x9')]||'';this[_0x2fde('0xa')]=_0x4a420b[_0x2fde('0xa')]||'';this[_0x2fde('0xb')]=_0x4a420b[_0x2fde('0xb')]||_0x2fde('0xc');this[_0x2fde('0xd')]=0x0;this[_0x2fde('0xe')]=0x0;this['answered']=0x0;this[_0x2fde('0xf')]=0x0;this[_0x2fde('0x10')]=0x0;this[_0x2fde('0x11')]=0x0;this[_0x2fde('0x12')]=0x0;this['abandoned']=0x0;this[_0x2fde('0x13')]=0x0;this['busy']=0x0;this[_0x2fde('0x14')]=0x0;this[_0x2fde('0x15')]=0x0;this['loggedIn']=0x0;this[_0x2fde('0x16')]=0x0;this['onHold']=0x0;this[_0x2fde('0x17')]=0x0;this[_0x2fde('0x18')]=0x0;this[_0x2fde('0x19')]=0x0;this['talking']=0x0;this[_0x2fde('0x1a')]=0x0;this[_0x2fde('0x1b')]=0x0;this[_0x2fde('0x1c')]=_0x4a420b[_0x2fde('0x1c')]||![];this[_0x2fde('0x1d')]=_0x4a420b[_0x2fde('0x1d')]||0xa;this['autopause']=_0x4a420b['autopause']||'no';this[_0x2fde('0x1e')]=!![];this['message']='';this[_0x2fde('0x1f')]='';this['originated']=0x0;this[_0x2fde('0x20')]=0x0;this[_0x2fde('0x21')]=_0x4a420b[_0x2fde('0x21')]||null;this[_0x2fde('0x22')]=_0x4a420b[_0x2fde('0x22')]?_0x4a420b[_0x2fde('0x22')]:null;this[_0x2fde('0x23')]=_0x4a420b[_0x2fde('0x23')];this[_0x2fde('0x24')]=_0x4a420b[_0x2fde('0x24')]||_0x2fde('0x25');this[_0x2fde('0x26')]=_0x4a420b['dialLimitChannel']||0x0;this[_0x2fde('0x27')]=_0x4a420b['dialLimitQueue']||0x0;this[_0x2fde('0x28')]=_0x4a420b['dialPowerLevel']||0x1;this[_0x2fde('0x29')]=_0x4a420b[_0x2fde('0x29')]||_0x2fde('0x2a');this[_0x2fde('0x2b')]=_0x4a420b[_0x2fde('0x2b')]||0.03;this['dialPredictiveInterval']=_0x4a420b['dialPredictiveInterval']||0x258;this[_0x2fde('0x2c')]=_0x4a420b[_0x2fde('0x2c')]||'anonymous';this[_0x2fde('0x2d')]=_0x4a420b[_0x2fde('0x2d')]||_0x2fde('0x2e');this['dialOriginateTimeout']=_0x4a420b[_0x2fde('0x2f')]||0x1e;this['dialQueueOptions']=_0x4a420b[_0x2fde('0x30')]||_0x2fde('0x31');this[_0x2fde('0x32')]=_0x4a420b[_0x2fde('0x32')]||0x3;this['dialQueueProject']=_0x4a420b[_0x2fde('0x33')]||undefined;this[_0x2fde('0x34')]=_0x4a420b['dialCongestionMaxRetry']||0x3;this[_0x2fde('0x35')]=_0x4a420b[_0x2fde('0x35')]||0x96;this[_0x2fde('0x36')]=_0x4a420b['dialBusyMaxRetry']||0x3;this[_0x2fde('0x37')]=_0x4a420b[_0x2fde('0x37')]||0x96;this[_0x2fde('0x38')]=_0x4a420b['dialNoAnswerMaxRetry']||0x3;this[_0x2fde('0x39')]=_0x4a420b[_0x2fde('0x39')]||0x96;this[_0x2fde('0x3a')]=_0x4a420b[_0x2fde('0x3a')]||0x3;this[_0x2fde('0x3b')]=_0x4a420b[_0x2fde('0x3b')]||0x96;this[_0x2fde('0x3c')]=_0x4a420b[_0x2fde('0x3c')]||0x3;this[_0x2fde('0x3d')]=_0x4a420b[_0x2fde('0x3d')]||0x96;this[_0x2fde('0x3e')]=_0x4a420b[_0x2fde('0x3e')]||0x3;this[_0x2fde('0x3f')]=_0x4a420b[_0x2fde('0x3f')]||0x96;this[_0x2fde('0x40')]=_0x4a420b[_0x2fde('0x40')]||0x3;this[_0x2fde('0x41')]=_0x4a420b[_0x2fde('0x41')]||0x96;this['dialAgentRejectMaxRetry']=_0x4a420b[_0x2fde('0x42')]||0x3;this[_0x2fde('0x43')]=_0x4a420b[_0x2fde('0x43')]||0x96;this['callAdditionalPhoneAfterMin']=_0x4a420b[_0x2fde('0x44')]||0x3;this[_0x2fde('0x45')]=_0x4a420b['dialGlobalMaxRetry']||0x4;this[_0x2fde('0x46')]=_0x4a420b[_0x2fde('0x46')]?_0x4a420b[_0x2fde('0x46')]:undefined;this['TrunkBackup']=_0x4a420b['TrunkBackup']?_0x4a420b[_0x2fde('0x47')]:undefined;this[_0x2fde('0x48')]=_0x4a420b[_0x2fde('0x48')]||undefined;this[_0x2fde('0x49')]=_0x4a420b['Interval']?_0x4a420b[_0x2fde('0x49')]:undefined;this[_0x2fde('0x4a')]=_0x4a420b['dialOrderByScheduledAt']||_0x2fde('0x4b');this[_0x2fde('0x4c')]=_0x4a420b[_0x2fde('0x4c')]||undefined;this[_0x2fde('0x4d')]=_0x4a420b[_0x2fde('0x4d')]||undefined;this['strategy']=strategy[_0x4a420b[_0x2fde('0x4e')]];this[_0x2fde('0x4f')]=!![];this[_0x2fde('0x50')]=_0x4a420b['dialAMDActive']||![];this[_0x2fde('0x51')]=_0x4a420b[_0x2fde('0x51')];this['dialAMDGreeting']=_0x4a420b['dialAMDGreeting'];this['dialAMDAfterGreetingSilence']=_0x4a420b[_0x2fde('0x52')];this[_0x2fde('0x53')]=_0x4a420b[_0x2fde('0x53')];this[_0x2fde('0x54')]=_0x4a420b['dialAMDMinWordLength'];this[_0x2fde('0x55')]=_0x4a420b[_0x2fde('0x55')];this[_0x2fde('0x56')]=_0x4a420b[_0x2fde('0x56')];this[_0x2fde('0x57')]=_0x4a420b['dialAMDSilenceThreshold'];this[_0x2fde('0x58')]=_0x4a420b[_0x2fde('0x58')];this[_0x2fde('0x59')]=0x0;this[_0x2fde('0x5a')]=0x0;this[_0x2fde('0x5b')]=_0x4a420b[_0x2fde('0x5b')];this[_0x2fde('0x5c')]=0x0;this[_0x2fde('0x5d')]=0x0;this[_0x2fde('0x5e')]=0x0;this['outboundBusyCallsDay']=0x0;this['outboundCongestionCallsDay']=0x0;this[_0x2fde('0x5f')]=0x0;this[_0x2fde('0x60')]=0x0;this['outboundBlacklistCallsDay']=0x0;this[_0x2fde('0x61')]=0x0;this[_0x2fde('0x62')]=0x0;this['outboundDropCallsDayTimeout']=0x0;this['outboundDropCallsDayACS']=0x0;this[_0x2fde('0x63')]=0x0;this[_0x2fde('0x64')]=0x0;this[_0x2fde('0x65')]=undefined;this[_0x2fde('0x66')]=undefined;this[_0x2fde('0x67')]=undefined;this[_0x2fde('0x68')]=1.05;this[_0x2fde('0x69')]=0x0;this[_0x2fde('0x6a')]=0x0;this['predictiveIntervalDroppedCallsCallersExit']=0x0;this[_0x2fde('0x6b')]=0x0;this[_0x2fde('0x6c')]=0x0;this[_0x2fde('0x6d')]=0x0;this[_0x2fde('0x6e')]=0x0;this[_0x2fde('0x6f')]=0x0;this['predictiveIntervalMaxThreshold']=_0x4a420b[_0x2fde('0x70')]||0x14;this[_0x2fde('0x71')]=_0x4a420b[_0x2fde('0x70')]||0xa;this['predictiveIntervalErlangCalls']=0x0;this[_0x2fde('0x72')]=0x0;this[_0x2fde('0x73')]=0x1;this[_0x2fde('0x74')]=0x0;this[_0x2fde('0x75')]=0x0;this['erlangAbandonmentRate']=0x0;this[_0x2fde('0x76')]=0x0;this[_0x2fde('0x77')]=_0x4a420b[_0x2fde('0x77')]||0x1e;this['dialRecallInQueue']=_0x4a420b[_0x2fde('0x78')]||![];this[_0x2fde('0x79')]=!!_0x4a420b[_0x2fde('0x79')]||![];this[_0x2fde('0x7a')]=!!_0x4a420b[_0x2fde('0x7a')]||![];this[_0x2fde('0x7b')]=_0x4a420b[_0x2fde('0x7b')]||undefined;this[_0x2fde('0x7c')]=_0x4a420b[_0x2fde('0x7c')]||![];this['dialAgiAfterHangupAgent']=_0x4a420b[_0x2fde('0x7d')]||![];this['monitor_format']=monitorFormat[_0x4a420b[_0x2fde('0xa')]]?monitorFormat[_0x4a420b['monitor_format']]:undefined;this['mandatoryDisposition']=_0x4a420b[_0x2fde('0x7e')]||![];this[_0x2fde('0x7f')]=_0x4a420b[_0x2fde('0x7f')]?_0x4a420b[_0x2fde('0x7f')]:undefined;this[_0x2fde('0x80')]=![];}module['exports']=VoiceQueue; \ No newline at end of file diff --git a/server/services/ami/model/voiceQueueSummary.js b/server/services/ami/model/voiceQueueSummary.js index 2bdb180..7756436 100644 --- a/server/services/ami/model/voiceQueueSummary.js +++ b/server/services/ami/model/voiceQueueSummary.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x4677=['loggedIn','originated','outboundAbandonedCallsDay','outboundAnswerCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundReCallsDay','outboundRejectCallsDay','talking','sumBillable','sumDuration','name','strategy','abandoned','busy','invalid','onHold','notInUse','ringInUse','sumHoldTime','total','type','unavailable','unknown','unmanaged','outbound','pTalking','dialActive','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundBusyCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundNoSuchCallsDay','outboundOriginateFailureCallsDay','outboundUnknownCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','erlangBusyFactor','startPredictive','startProgressive','message','statusMessage','Trunk','active','prototype','createReport','loggedin','callers','length','SIP/','incall','status','dialMethod','keys','dialer','exten','xcally-motion-preview','compareToInboundQueue','updateReportFromOutboundQueue','outboundBlacklistCallsDay','preview','available','loggedInDb','paused','ringing','waiting','answered','inUse'];(function(_0x592e25,_0x4aec9c){var _0x4e8d3b=function(_0x1cc34a){while(--_0x1cc34a){_0x592e25['push'](_0x592e25['shift']());}};_0x4e8d3b(++_0x4aec9c);}(_0x4677,0x155));var _0x7467=function(_0x3ea1a5,_0x4e8b1a){_0x3ea1a5=_0x3ea1a5-0x0;var _0xbe9f5c=_0x4677[_0x3ea1a5];return _0xbe9f5c;};'use strict';var INBOUND_COUNTERS=[_0x7467('0x0'),'loggedIn',_0x7467('0x1'),_0x7467('0x2'),_0x7467('0x3'),'talking',_0x7467('0x4')];var OUTBOUND_COUNTERS=[_0x7467('0x0'),_0x7467('0x5'),_0x7467('0x6'),_0x7467('0x7'),_0x7467('0x1'),_0x7467('0x8'),_0x7467('0x9'),_0x7467('0xa'),'outboundBlacklistCallsDay','outboundBusyCallsDay',_0x7467('0xb'),_0x7467('0xc'),'outboundNoSuchCallsDay',_0x7467('0xd'),_0x7467('0xe'),'outboundUnknownCallsDay',_0x7467('0x2'),'pTalking',_0x7467('0xf'),_0x7467('0x10'),_0x7467('0x11'),'total',_0x7467('0x4')];function VoiceQueueSummary(_0x13112a){this['id']=_0x13112a['id'];this[_0x7467('0x12')]=_0x13112a[_0x7467('0x12')];this['strategy']=_0x13112a[_0x7467('0x13')];this['abandoned']=_0x13112a[_0x7467('0x14')]||0x0;this[_0x7467('0x5')]=_0x13112a[_0x7467('0x5')]||0x0;this[_0x7467('0x0')]=_0x13112a['available']||0x0;this[_0x7467('0x15')]=_0x13112a[_0x7467('0x15')]||0x0;this[_0x7467('0x6')]=_0x13112a['inUse']||0x0;this[_0x7467('0x16')]=_0x13112a[_0x7467('0x16')]||0x0;this[_0x7467('0x7')]=_0x13112a['loggedIn']||0x0;this[_0x7467('0x1')]=_0x13112a[_0x7467('0x1')]||0x0;this[_0x7467('0x17')]=_0x13112a['onHold']||0x0;this[_0x7467('0x18')]=_0x13112a['notInUse']||0x0;this[_0x7467('0x2')]=_0x13112a[_0x7467('0x2')]||0x0;this[_0x7467('0x3')]=_0x13112a[_0x7467('0x3')]||0x0;this[_0x7467('0x19')]=_0x13112a[_0x7467('0x19')];this[_0x7467('0x10')]=_0x13112a[_0x7467('0x10')];this[_0x7467('0x11')]=_0x13112a[_0x7467('0x11')];this[_0x7467('0x1a')]=_0x13112a[_0x7467('0x1a')]||0x0;this[_0x7467('0xf')]=_0x13112a[_0x7467('0xf')]||0x0;this['total']=_0x13112a[_0x7467('0x1b')]||0x0;this[_0x7467('0x1c')]=_0x13112a[_0x7467('0x1c')];this[_0x7467('0x1d')]=_0x13112a[_0x7467('0x1d')]||0x0;this['unknown']=_0x13112a[_0x7467('0x1e')]||0x0;this['unmanaged']=_0x13112a[_0x7467('0x1f')]||0x0;this[_0x7467('0x4')]=_0x13112a[_0x7467('0x4')]||0x0;if(_0x13112a[_0x7467('0x1c')]===_0x7467('0x20')){this[_0x7467('0x21')]=_0x13112a['pTalking']||0x0;this[_0x7467('0x22')]=_0x13112a[_0x7467('0x22')];this['dialMethod']=_0x13112a['dialMethod'];this[_0x7467('0x23')]=_0x13112a[_0x7467('0x23')];this[_0x7467('0x24')]=_0x13112a[_0x7467('0x24')];this['dialOriginateTimeout']=_0x13112a[_0x7467('0x25')];this[_0x7467('0x26')]=_0x13112a['dialPrefix'];this[_0x7467('0x27')]=_0x13112a[_0x7467('0x27')];this[_0x7467('0x28')]=_0x13112a[_0x7467('0x28')];this[_0x7467('0xa')]=_0x13112a['outboundAnswerCallsDay'];this['outboundBlacklistCallsDay']=_0x13112a['outboundBlacklistCallsDay'];this[_0x7467('0x29')]=_0x13112a[_0x7467('0x29')];this['outboundCongestionCallsDay']=_0x13112a[_0x7467('0xb')];this[_0x7467('0x2a')]=_0x13112a[_0x7467('0x2a')];this[_0x7467('0x2b')]=_0x13112a[_0x7467('0x2b')];this[_0x7467('0x2c')]=_0x13112a['outboundDropCallsDayTimeout'];this[_0x7467('0xc')]=_0x13112a[_0x7467('0xc')];this[_0x7467('0x2d')]=_0x13112a['outboundNoSuchCallsDay'];this[_0x7467('0x2e')]=_0x13112a[_0x7467('0x2e')];this[_0x7467('0xd')]=_0x13112a[_0x7467('0xd')];this[_0x7467('0xe')]=_0x13112a[_0x7467('0xe')];this[_0x7467('0x2f')]=_0x13112a[_0x7467('0x2f')];this['predictiveIntervalAnsweredCalls']=_0x13112a[_0x7467('0x30')];this[_0x7467('0x31')]=_0x13112a[_0x7467('0x31')];this[_0x7467('0x32')]=_0x13112a[_0x7467('0x32')];this[_0x7467('0x33')]=_0x13112a[_0x7467('0x33')];this[_0x7467('0x34')]=_0x13112a[_0x7467('0x34')];this[_0x7467('0x35')]=_0x13112a[_0x7467('0x35')];this[_0x7467('0x36')]=_0x13112a[_0x7467('0x36')];this[_0x7467('0x37')]=_0x13112a[_0x7467('0x37')];this[_0x7467('0x38')]=_0x13112a[_0x7467('0x38')];this[_0x7467('0x39')]=_0x13112a[_0x7467('0x39')];this['predictiveIntervalAvailable']=_0x13112a[_0x7467('0x3a')];this['predictiveIntervalTotalCalls']=_0x13112a[_0x7467('0x3b')];this['originated']=_0x13112a[_0x7467('0x8')];this[_0x7467('0x3c')]=_0x13112a['erlangCalls'];this['erlangCallToSecond']=_0x13112a[_0x7467('0x3d')];this[_0x7467('0x3e')]=_0x13112a[_0x7467('0x3e')];this[_0x7467('0x3f')]=_0x13112a[_0x7467('0x3f')];this['startPredictive']=_0x13112a[_0x7467('0x40')];this[_0x7467('0x41')]=_0x13112a[_0x7467('0x41')];this[_0x7467('0x42')]=_0x13112a[_0x7467('0x42')];this[_0x7467('0x43')]=_0x13112a[_0x7467('0x43')];}if(_0x13112a[_0x7467('0x44')]){this[_0x7467('0x44')]={'id':_0x13112a[_0x7467('0x44')]['id'],'name':_0x13112a[_0x7467('0x44')]['name'],'active':_0x13112a[_0x7467('0x44')][_0x7467('0x45')],'callerid':_0x13112a[_0x7467('0x44')]['callerid']};}}VoiceQueueSummary[_0x7467('0x46')][_0x7467('0x47')]=function(_0x23a26d,_0x35694f,_0x5ace0d,_0x12ec7f){this['loggedInDb']=0x0;this['talking']=0x0;this[_0x7467('0x2')]=0x0;this[_0x7467('0x1e')]=0x0;this['notInUse']=0x0;this[_0x7467('0x6')]=0x0;this['busy']=0x0;this['invalid']=0x0;this[_0x7467('0x1d')]=0x0;this[_0x7467('0x3')]=0x0;this['ringInUse']=0x0;this[_0x7467('0x17')]=0x0;if(_0x5ace0d){if(_0x5ace0d[_0x7467('0x0')]){this[_0x7467('0x0')]=Number(_0x5ace0d[_0x7467('0x0')]);}if(_0x5ace0d['loggedin']){this[_0x7467('0x7')]=Number(_0x5ace0d[_0x7467('0x48')]);}if(_0x5ace0d[_0x7467('0x49')]){this[_0x7467('0x4')]=Number(_0x5ace0d['callers']);}}for(var _0x18b2a0=0x0;_0x18b2a0<_0x23a26d[_0x7467('0x4a')];_0x18b2a0++){var _0xa08a0a=_0x35694f[_0x7467('0x4b')+_0x23a26d[_0x18b2a0]['name']];if(_0xa08a0a&&_0xa08a0a['online']){this[_0x7467('0x1')]+=0x1;}if(_0x23a26d[_0x18b2a0][_0x7467('0x4c')]==='1'){this[_0x7467('0xf')]+=0x1;}if(_0x23a26d[_0x18b2a0][_0x7467('0x2')]==='1'&&!['2','7','8']['includes'](_0x23a26d[_0x18b2a0][_0x7467('0x4d')])){this[_0x7467('0x2')]+=0x1;}switch(_0x23a26d[_0x18b2a0][_0x7467('0x4d')]){case'0':this[_0x7467('0x1e')]+=0x1;break;case'1':this[_0x7467('0x18')]+=0x1;break;case'2':this['inUse']+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0x7467('0x16')]+=0x1;break;case'5':this[_0x7467('0x1d')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this[_0x7467('0x19')]+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x7467('0x4e')]==='booked'){var _0x3a9c15=Object[_0x7467('0x4f')](_0x12ec7f);for(var _0x2ea1fd=0x0;_0x2ea1fd<_0x3a9c15[_0x7467('0x4a')];_0x2ea1fd++){var _0xd2e9ac=_0x3a9c15[_0x2ea1fd];var _0x2be4c6=_0x12ec7f[_0xd2e9ac];if(_0x2be4c6['queue']===this['name']&&_0x2be4c6[_0x7467('0x1c')]===_0x7467('0x50')&&_0x2be4c6[_0x7467('0x51')]===_0x7467('0x52')){this['talking']+=0x1;}}if(this[_0x7467('0xf')]>this[_0x7467('0x6')]){this[_0x7467('0xf')]=this[_0x7467('0x6')];}this[_0x7467('0x21')]=0x0;}return this;};VoiceQueueSummary['prototype'][_0x7467('0x53')]=function(_0x5bc665){var _0x5aab46=![];if(_0x5bc665){_0x5aab46=INBOUND_COUNTERS['some'](function(_0x53f412){return this[_0x53f412]!==_0x5bc665[_0x53f412];},this);}return _0x5aab46;};VoiceQueueSummary[_0x7467('0x46')]['compareToOutboundQueue']=function(_0x396dc3){var _0x149574=![];var _0x364137=![];var _0x10f2c3=![];if(_0x396dc3){_0x149574=this[_0x7467('0x4e')]!==_0x396dc3[_0x7467('0x4e')]||this['dialActive']!==_0x396dc3[_0x7467('0x22')]||this[_0x7467('0x42')]!==_0x396dc3[_0x7467('0x42')]||this[_0x7467('0x43')]!==_0x396dc3[_0x7467('0x43')];_0x364137=OUTBOUND_COUNTERS['some'](function(_0x575a3e){return this[_0x575a3e]!==_0x396dc3[_0x575a3e];},this);if(this['Trunk']&&_0x396dc3[_0x7467('0x44')]){_0x10f2c3=this[_0x7467('0x44')]['name']!==_0x396dc3[_0x7467('0x44')]['name']||this[_0x7467('0x44')][_0x7467('0x45')]!==_0x396dc3[_0x7467('0x44')][_0x7467('0x45')];}}return _0x149574||_0x364137||_0x10f2c3;};VoiceQueueSummary['prototype'][_0x7467('0x54')]=function(_0x44c56a){this['answered']=_0x44c56a[_0x7467('0x5')];this[_0x7467('0x42')]=_0x44c56a['message'];this[_0x7467('0x43')]=_0x44c56a['statusMessage'];this[_0x7467('0x8')]=_0x44c56a[_0x7467('0x8')];this[_0x7467('0x9')]=_0x44c56a[_0x7467('0x9')];this[_0x7467('0xa')]=_0x44c56a[_0x7467('0xa')];this[_0x7467('0x55')]=_0x44c56a[_0x7467('0x55')];this[_0x7467('0x29')]=_0x44c56a[_0x7467('0x29')];this[_0x7467('0xb')]=_0x44c56a[_0x7467('0xb')];this[_0x7467('0xc')]=_0x44c56a[_0x7467('0xc')];this['outboundNoSuchCallsDay']=_0x44c56a[_0x7467('0x2d')];this[_0x7467('0xd')]=_0x44c56a['outboundReCallsDay'];this[_0x7467('0xe')]=_0x44c56a[_0x7467('0xe')];this[_0x7467('0x2f')]=_0x44c56a[_0x7467('0x2f')];this[_0x7467('0x10')]=_0x44c56a['sumBillable'];this[_0x7467('0x11')]=_0x44c56a['sumDuration'];this[_0x7467('0x1b')]=_0x44c56a[_0x7467('0x1b')];if(this[_0x7467('0x4e')]===_0x7467('0x56')){this[_0x7467('0x21')]=_0x44c56a[_0x7467('0x21')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file +var _0x6347=['ringing','talking','waiting','answered','loggedInDb','outboundAnswerCallsDay','outboundBlacklistCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoAnswerCallsDay','outboundNoSuchCallsDay','outboundRejectCallsDay','sumBillable','sumDuration','total','name','strategy','abandoned','busy','inUse','invalid','onHold','notInUse','ringInUse','sumHoldTime','type','unavailable','unknown','unmanaged','pTalking','dialActive','dialMethod','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialPrefix','temp','outboundAnswerAgiCallsDay','outboundDropCallsDayACS','outboundDropCallsDayCallersExit','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundReCallsDay','predictiveIntervalAnsweredCalls','predictiveIntervalAvgHoldtime','predictiveIntervalAvgTalktime','predictiveIntervalDroppedCallsCallersExit','predictiveIntervalDroppedCallsTimeout','predictiveIntervalErlangCalls','predictiveIntervalErlangCallsDroppedCalls','predictiveIntervalHitRate','predictiveIntervalMultiplicativeFactor','predictiveIntervalPauses','predictiveIntervalAvailable','predictiveIntervalTotalCalls','originated','erlangCalls','erlangCallToSecond','erlangAbandonmentRate','startPredictive','startProgressive','message','statusMessage','Trunk','active','callerid','prototype','createReport','loggedin','callers','length','SIP/','online','incall','includes','status','booked','keys','queue','dialer','exten','xcally-motion-preview','compareToInboundQueue','some','compareToOutboundQueue','updateReportFromOutboundQueue','outboundAbandonedCallsDay','outboundUnknownCallsDay','preview','available','loggedIn','paused'];(function(_0x79c7c,_0x5a34c8){var _0x1a5395=function(_0x479de3){while(--_0x479de3){_0x79c7c['push'](_0x79c7c['shift']());}};_0x1a5395(++_0x5a34c8);}(_0x6347,0x1c9));var _0x7634=function(_0x1fe9ed,_0x174896){_0x1fe9ed=_0x1fe9ed-0x0;var _0x530dcc=_0x6347[_0x1fe9ed];return _0x530dcc;};'use strict';var INBOUND_COUNTERS=[_0x7634('0x0'),_0x7634('0x1'),'loggedInDb',_0x7634('0x2'),_0x7634('0x3'),_0x7634('0x4'),_0x7634('0x5')];var OUTBOUND_COUNTERS=['available',_0x7634('0x6'),'inUse',_0x7634('0x1'),_0x7634('0x7'),'originated','outboundAbandonedCallsDay',_0x7634('0x8'),_0x7634('0x9'),_0x7634('0xa'),_0x7634('0xb'),_0x7634('0xc'),_0x7634('0xd'),'outboundReCallsDay',_0x7634('0xe'),'outboundUnknownCallsDay','paused','pTalking',_0x7634('0x4'),_0x7634('0xf'),_0x7634('0x10'),_0x7634('0x11'),_0x7634('0x5')];function VoiceQueueSummary(_0x52a93f){this['id']=_0x52a93f['id'];this['name']=_0x52a93f[_0x7634('0x12')];this[_0x7634('0x13')]=_0x52a93f[_0x7634('0x13')];this[_0x7634('0x14')]=_0x52a93f[_0x7634('0x14')]||0x0;this[_0x7634('0x6')]=_0x52a93f[_0x7634('0x6')]||0x0;this[_0x7634('0x0')]=_0x52a93f['available']||0x0;this[_0x7634('0x15')]=_0x52a93f[_0x7634('0x15')]||0x0;this[_0x7634('0x16')]=_0x52a93f[_0x7634('0x16')]||0x0;this['invalid']=_0x52a93f[_0x7634('0x17')]||0x0;this['loggedIn']=_0x52a93f[_0x7634('0x1')]||0x0;this[_0x7634('0x7')]=_0x52a93f[_0x7634('0x7')]||0x0;this[_0x7634('0x18')]=_0x52a93f[_0x7634('0x18')]||0x0;this[_0x7634('0x19')]=_0x52a93f['notInUse']||0x0;this[_0x7634('0x2')]=_0x52a93f[_0x7634('0x2')]||0x0;this['ringing']=_0x52a93f[_0x7634('0x3')]||0x0;this[_0x7634('0x1a')]=_0x52a93f['ringInUse'];this[_0x7634('0xf')]=_0x52a93f['sumBillable'];this[_0x7634('0x10')]=_0x52a93f['sumDuration'];this[_0x7634('0x1b')]=_0x52a93f[_0x7634('0x1b')]||0x0;this[_0x7634('0x4')]=_0x52a93f[_0x7634('0x4')]||0x0;this['total']=_0x52a93f[_0x7634('0x11')]||0x0;this[_0x7634('0x1c')]=_0x52a93f[_0x7634('0x1c')];this[_0x7634('0x1d')]=_0x52a93f[_0x7634('0x1d')]||0x0;this['unknown']=_0x52a93f[_0x7634('0x1e')]||0x0;this[_0x7634('0x1f')]=_0x52a93f[_0x7634('0x1f')]||0x0;this[_0x7634('0x5')]=_0x52a93f['waiting']||0x0;if(_0x52a93f['type']==='outbound'){this[_0x7634('0x20')]=_0x52a93f['pTalking']||0x0;this[_0x7634('0x21')]=_0x52a93f['dialActive'];this['dialMethod']=_0x52a93f[_0x7634('0x22')];this['dialOriginateCallerIdName']=_0x52a93f[_0x7634('0x23')];this[_0x7634('0x24')]=_0x52a93f['dialOriginateCallerIdNumber'];this[_0x7634('0x25')]=_0x52a93f[_0x7634('0x25')];this[_0x7634('0x26')]=_0x52a93f[_0x7634('0x26')];this[_0x7634('0x27')]=_0x52a93f['temp'];this[_0x7634('0x28')]=_0x52a93f[_0x7634('0x28')];this['outboundAnswerCallsDay']=_0x52a93f[_0x7634('0x8')];this[_0x7634('0x9')]=_0x52a93f[_0x7634('0x9')];this[_0x7634('0xa')]=_0x52a93f['outboundBusyCallsDay'];this[_0x7634('0xb')]=_0x52a93f[_0x7634('0xb')];this[_0x7634('0x29')]=_0x52a93f['outboundDropCallsDayACS'];this['outboundDropCallsDayCallersExit']=_0x52a93f[_0x7634('0x2a')];this[_0x7634('0x2b')]=_0x52a93f[_0x7634('0x2b')];this[_0x7634('0xc')]=_0x52a93f[_0x7634('0xc')];this[_0x7634('0xd')]=_0x52a93f['outboundNoSuchCallsDay'];this[_0x7634('0x2c')]=_0x52a93f[_0x7634('0x2c')];this['outboundReCallsDay']=_0x52a93f[_0x7634('0x2d')];this['outboundRejectCallsDay']=_0x52a93f[_0x7634('0xe')];this['outboundUnknownCallsDay']=_0x52a93f['outboundUnknownCallsDay'];this[_0x7634('0x2e')]=_0x52a93f[_0x7634('0x2e')];this[_0x7634('0x2f')]=_0x52a93f['predictiveIntervalAvgHoldtime'];this['predictiveIntervalAvgTalktime']=_0x52a93f[_0x7634('0x30')];this[_0x7634('0x31')]=_0x52a93f[_0x7634('0x31')];this[_0x7634('0x32')]=_0x52a93f['predictiveIntervalDroppedCallsTimeout'];this[_0x7634('0x33')]=_0x52a93f[_0x7634('0x33')];this[_0x7634('0x34')]=_0x52a93f[_0x7634('0x34')];this[_0x7634('0x35')]=_0x52a93f[_0x7634('0x35')];this[_0x7634('0x36')]=_0x52a93f[_0x7634('0x36')];this[_0x7634('0x37')]=_0x52a93f[_0x7634('0x37')];this[_0x7634('0x38')]=_0x52a93f['predictiveIntervalAvailable'];this[_0x7634('0x39')]=_0x52a93f[_0x7634('0x39')];this['originated']=_0x52a93f[_0x7634('0x3a')];this['erlangCalls']=_0x52a93f[_0x7634('0x3b')];this[_0x7634('0x3c')]=_0x52a93f[_0x7634('0x3c')];this[_0x7634('0x3d')]=_0x52a93f[_0x7634('0x3d')];this['erlangBusyFactor']=_0x52a93f['erlangBusyFactor'];this[_0x7634('0x3e')]=_0x52a93f[_0x7634('0x3e')];this[_0x7634('0x3f')]=_0x52a93f[_0x7634('0x3f')];this[_0x7634('0x40')]=_0x52a93f[_0x7634('0x40')];this[_0x7634('0x41')]=_0x52a93f[_0x7634('0x41')];}if(_0x52a93f['Trunk']){this[_0x7634('0x42')]={'id':_0x52a93f[_0x7634('0x42')]['id'],'name':_0x52a93f[_0x7634('0x42')]['name'],'active':_0x52a93f[_0x7634('0x42')][_0x7634('0x43')],'callerid':_0x52a93f[_0x7634('0x42')][_0x7634('0x44')]};}}VoiceQueueSummary[_0x7634('0x45')][_0x7634('0x46')]=function(_0x25152f,_0x39a51b,_0x5952c7,_0x1dfbf5){this['loggedInDb']=0x0;this[_0x7634('0x4')]=0x0;this[_0x7634('0x2')]=0x0;this['unknown']=0x0;this['notInUse']=0x0;this[_0x7634('0x16')]=0x0;this['busy']=0x0;this[_0x7634('0x17')]=0x0;this[_0x7634('0x1d')]=0x0;this[_0x7634('0x3')]=0x0;this['ringInUse']=0x0;this['onHold']=0x0;if(_0x5952c7){if(_0x5952c7[_0x7634('0x0')]){this[_0x7634('0x0')]=Number(_0x5952c7[_0x7634('0x0')]);}if(_0x5952c7[_0x7634('0x47')]){this[_0x7634('0x1')]=Number(_0x5952c7['loggedin']);}if(_0x5952c7[_0x7634('0x48')]){this[_0x7634('0x5')]=Number(_0x5952c7['callers']);}}for(var _0x5a54cd=0x0;_0x5a54cd<_0x25152f[_0x7634('0x49')];_0x5a54cd++){var _0x2ea54f=_0x39a51b[_0x7634('0x4a')+_0x25152f[_0x5a54cd][_0x7634('0x12')]];if(_0x2ea54f&&_0x2ea54f[_0x7634('0x4b')]){this[_0x7634('0x7')]+=0x1;}if(_0x25152f[_0x5a54cd][_0x7634('0x4c')]==='1'){this[_0x7634('0x4')]+=0x1;}if(_0x25152f[_0x5a54cd][_0x7634('0x2')]==='1'&&!['2','7','8'][_0x7634('0x4d')](_0x25152f[_0x5a54cd]['status'])){this[_0x7634('0x2')]+=0x1;}switch(_0x25152f[_0x5a54cd][_0x7634('0x4e')]){case'0':this['unknown']+=0x1;break;case'1':this[_0x7634('0x19')]+=0x1;break;case'2':this[_0x7634('0x16')]+=0x1;break;case'3':this['busy']+=0x1;break;case'4':this[_0x7634('0x17')]+=0x1;break;case'5':this[_0x7634('0x1d')]+=0x1;break;case'6':this['ringing']+=0x1;break;case'7':this['ringInUse']+=0x1;break;case'8':this['onHold']+=0x1;break;}}if(this[_0x7634('0x22')]===_0x7634('0x4f')){var _0x2f9747=Object[_0x7634('0x50')](_0x1dfbf5);for(var _0x438082=0x0;_0x438082<_0x2f9747['length'];_0x438082++){var _0x801406=_0x2f9747[_0x438082];var _0x9a1c6f=_0x1dfbf5[_0x801406];if(_0x9a1c6f[_0x7634('0x51')]===this[_0x7634('0x12')]&&_0x9a1c6f['type']===_0x7634('0x52')&&_0x9a1c6f[_0x7634('0x53')]===_0x7634('0x54')){this['talking']+=0x1;}}if(this[_0x7634('0x4')]>this['inUse']){this[_0x7634('0x4')]=this[_0x7634('0x16')];}this['pTalking']=0x0;}return this;};VoiceQueueSummary['prototype'][_0x7634('0x55')]=function(_0x9e1711){var _0x414593=![];if(_0x9e1711){_0x414593=INBOUND_COUNTERS[_0x7634('0x56')](function(_0x4d667d){return this[_0x4d667d]!==_0x9e1711[_0x4d667d];},this);}return _0x414593;};VoiceQueueSummary['prototype'][_0x7634('0x57')]=function(_0x144ae5){var _0x38ef7f=![];var _0x491823=![];var _0x53a95c=![];if(_0x144ae5){_0x38ef7f=this[_0x7634('0x22')]!==_0x144ae5[_0x7634('0x22')]||this[_0x7634('0x21')]!==_0x144ae5['dialActive']||this[_0x7634('0x40')]!==_0x144ae5['message']||this[_0x7634('0x41')]!==_0x144ae5[_0x7634('0x41')];_0x491823=OUTBOUND_COUNTERS[_0x7634('0x56')](function(_0x5d716e){return this[_0x5d716e]!==_0x144ae5[_0x5d716e];},this);if(this[_0x7634('0x42')]&&_0x144ae5[_0x7634('0x42')]){_0x53a95c=this['Trunk']['name']!==_0x144ae5[_0x7634('0x42')][_0x7634('0x12')]||this[_0x7634('0x42')][_0x7634('0x43')]!==_0x144ae5[_0x7634('0x42')]['active'];}}return _0x38ef7f||_0x491823||_0x53a95c;};VoiceQueueSummary['prototype'][_0x7634('0x58')]=function(_0x3496ad){this[_0x7634('0x6')]=_0x3496ad[_0x7634('0x6')];this[_0x7634('0x40')]=_0x3496ad[_0x7634('0x40')];this[_0x7634('0x41')]=_0x3496ad[_0x7634('0x41')];this[_0x7634('0x3a')]=_0x3496ad[_0x7634('0x3a')];this[_0x7634('0x59')]=_0x3496ad[_0x7634('0x59')];this[_0x7634('0x8')]=_0x3496ad[_0x7634('0x8')];this[_0x7634('0x9')]=_0x3496ad['outboundBlacklistCallsDay'];this[_0x7634('0xa')]=_0x3496ad['outboundBusyCallsDay'];this[_0x7634('0xb')]=_0x3496ad[_0x7634('0xb')];this[_0x7634('0xc')]=_0x3496ad[_0x7634('0xc')];this[_0x7634('0xd')]=_0x3496ad[_0x7634('0xd')];this[_0x7634('0x2d')]=_0x3496ad['outboundReCallsDay'];this[_0x7634('0xe')]=_0x3496ad[_0x7634('0xe')];this[_0x7634('0x5a')]=_0x3496ad[_0x7634('0x5a')];this[_0x7634('0xf')]=_0x3496ad[_0x7634('0xf')];this[_0x7634('0x10')]=_0x3496ad[_0x7634('0x10')];this[_0x7634('0x11')]=_0x3496ad['total'];if(this[_0x7634('0x22')]===_0x7634('0x5b')){this[_0x7634('0x20')]=_0x3496ad[_0x7634('0x20')];}};module['exports']=VoiceQueueSummary; \ No newline at end of file diff --git a/server/services/ami/model/vtigerAccount.js b/server/services/ami/model/vtigerAccount.js index f175365..5a006b5 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 _0x119c=['exports','name','username','accessKey','remoteUri','serverUrl','Configurations'];(function(_0x227d75,_0x16becc){var _0x419daf=function(_0x213cae){while(--_0x213cae){_0x227d75['push'](_0x227d75['shift']());}};_0x419daf(++_0x16becc);}(_0x119c,0x7f));var _0xc119=function(_0x57a2a6,_0x3d21b2){_0x57a2a6=_0x57a2a6-0x0;var _0x74724a=_0x119c[_0x57a2a6];return _0x74724a;};'use strict';function VtigerAccount(_0x551993){this['id']=_0x551993['id']||0x0;this[_0xc119('0x0')]=_0x551993[_0xc119('0x0')]||'';this['username']=_0x551993[_0xc119('0x1')]||'';this['accessKey']=_0x551993[_0xc119('0x2')]||'';this['remoteUri']=_0x551993[_0xc119('0x3')]||'';this['serverUrl']=_0x551993[_0xc119('0x4')]||'';this['Configurations']=_0x551993[_0xc119('0x5')]||{};}module[_0xc119('0x6')]=VtigerAccount; \ No newline at end of file +var _0x6712=['remoteUri','serverUrl','Configurations','exports','username','accessKey'];(function(_0x1f3c56,_0x598757){var _0x569524=function(_0x345301){while(--_0x345301){_0x1f3c56['push'](_0x1f3c56['shift']());}};_0x569524(++_0x598757);}(_0x6712,0x178));var _0x2671=function(_0x50a0c2,_0x4befab){_0x50a0c2=_0x50a0c2-0x0;var _0x5ebadd=_0x6712[_0x50a0c2];return _0x5ebadd;};'use strict';function VtigerAccount(_0x58ac9a){this['id']=_0x58ac9a['id']||0x0;this['name']=_0x58ac9a['name']||'';this['username']=_0x58ac9a[_0x2671('0x0')]||'';this[_0x2671('0x1')]=_0x58ac9a[_0x2671('0x1')]||'';this[_0x2671('0x2')]=_0x58ac9a[_0x2671('0x2')]||'';this[_0x2671('0x3')]=_0x58ac9a['serverUrl']||'';this[_0x2671('0x4')]=_0x58ac9a[_0x2671('0x4')]||{};}module[_0x2671('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 49ed36e..cac66b7 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 _0xa448=['authType','integrationTab','serverUrl','exports','name','username','password','token','remoteUri'];(function(_0x45c78e,_0x89aa5d){var _0x4fd81c=function(_0x3b7a75){while(--_0x3b7a75){_0x45c78e['push'](_0x45c78e['shift']());}};_0x4fd81c(++_0x89aa5d);}(_0xa448,0x67));var _0x8a44=function(_0x1e8488,_0x1a01ce){_0x1e8488=_0x1e8488-0x0;var _0x2e3867=_0xa448[_0x1e8488];return _0x2e3867;};'use strict';function ZendeskAccount(_0x47fe58){this['id']=_0x47fe58['id']||0x0;this[_0x8a44('0x0')]=_0x47fe58[_0x8a44('0x0')]||'';this[_0x8a44('0x1')]=_0x47fe58[_0x8a44('0x1')]||'';this[_0x8a44('0x2')]=_0x47fe58[_0x8a44('0x2')]||'';this[_0x8a44('0x3')]=_0x47fe58[_0x8a44('0x3')]||'';this[_0x8a44('0x4')]=_0x47fe58['remoteUri']||'';this[_0x8a44('0x5')]=_0x47fe58['authType']||'';this['type']=_0x47fe58['type']||_0x8a44('0x6');this[_0x8a44('0x7')]=_0x47fe58['serverUrl']||'';this['Configurations']=_0x47fe58['Configurations']||{};}module[_0x8a44('0x8')]=ZendeskAccount; \ No newline at end of file +var _0x94ef=['type','integrationTab','serverUrl','Configurations','exports','name','password','token','remoteUri'];(function(_0x307b58,_0x5ad2ac){var _0x322e12=function(_0x3f3653){while(--_0x3f3653){_0x307b58['push'](_0x307b58['shift']());}};_0x322e12(++_0x5ad2ac);}(_0x94ef,0x10a));var _0xf94e=function(_0x45d274,_0x7a4c0b){_0x45d274=_0x45d274-0x0;var _0x565145=_0x94ef[_0x45d274];return _0x565145;};'use strict';function ZendeskAccount(_0x43e77b){this['id']=_0x43e77b['id']||0x0;this['name']=_0x43e77b[_0xf94e('0x0')]||'';this['username']=_0x43e77b['username']||'';this[_0xf94e('0x1')]=_0x43e77b[_0xf94e('0x1')]||'';this[_0xf94e('0x2')]=_0x43e77b['token']||'';this[_0xf94e('0x3')]=_0x43e77b[_0xf94e('0x3')]||'';this['authType']=_0x43e77b['authType']||'';this['type']=_0x43e77b[_0xf94e('0x4')]||_0xf94e('0x5');this[_0xf94e('0x6')]=_0x43e77b[_0xf94e('0x6')]||'';this[_0xf94e('0x7')]=_0x43e77b[_0xf94e('0x7')]||{};}module[_0xf94e('0x8')]=ZendeskAccount; \ No newline at end of file diff --git a/server/services/ami/model/zohoAccount.js b/server/services/ami/model/zohoAccount.js index ffab8c3..369f2e4 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 _0xf3f0=['clientSecret','serverUrl','code','refreshToken','Configurations','name','description','host','zone','clientId'];(function(_0x286b9c,_0xeb0910){var _0x406cfd=function(_0x196155){while(--_0x196155){_0x286b9c['push'](_0x286b9c['shift']());}};_0x406cfd(++_0xeb0910);}(_0xf3f0,0x159));var _0x0f3f=function(_0x2e4fd4,_0x407776){_0x2e4fd4=_0x2e4fd4-0x0;var _0x20d3cb=_0xf3f0[_0x2e4fd4];return _0x20d3cb;};'use strict';function ZohoAccount(_0x3b3cfd){this['id']=_0x3b3cfd['id']||0x0;this[_0x0f3f('0x0')]=_0x3b3cfd[_0x0f3f('0x0')]||'';this[_0x0f3f('0x1')]=_0x3b3cfd[_0x0f3f('0x1')]||'';this['host']=_0x3b3cfd[_0x0f3f('0x2')]||'';this[_0x0f3f('0x3')]=_0x3b3cfd['zone']||'';this[_0x0f3f('0x4')]=_0x3b3cfd['clientId']||'';this[_0x0f3f('0x5')]=_0x3b3cfd[_0x0f3f('0x5')]||'';this[_0x0f3f('0x6')]=_0x3b3cfd[_0x0f3f('0x6')]||'';this[_0x0f3f('0x7')]=_0x3b3cfd[_0x0f3f('0x7')]||'';this[_0x0f3f('0x8')]=_0x3b3cfd[_0x0f3f('0x8')]||'';this[_0x0f3f('0x9')]=_0x3b3cfd[_0x0f3f('0x9')]||{};}module['exports']=ZohoAccount; \ No newline at end of file +var _0x843b=['refreshToken','Configurations','exports','name','description','host','clientId','clientSecret','serverUrl','code'];(function(_0x2560fe,_0x38de00){var _0x434e9b=function(_0x181b36){while(--_0x181b36){_0x2560fe['push'](_0x2560fe['shift']());}};_0x434e9b(++_0x38de00);}(_0x843b,0x14d));var _0xb843=function(_0x4db5ed,_0x7364c5){_0x4db5ed=_0x4db5ed-0x0;var _0x3da665=_0x843b[_0x4db5ed];return _0x3da665;};'use strict';function ZohoAccount(_0x2327d8){this['id']=_0x2327d8['id']||0x0;this[_0xb843('0x0')]=_0x2327d8[_0xb843('0x0')]||'';this[_0xb843('0x1')]=_0x2327d8[_0xb843('0x1')]||'';this[_0xb843('0x2')]=_0x2327d8[_0xb843('0x2')]||'';this['zone']=_0x2327d8['zone']||'';this[_0xb843('0x3')]=_0x2327d8[_0xb843('0x3')]||'';this['clientSecret']=_0x2327d8[_0xb843('0x4')]||'';this[_0xb843('0x5')]=_0x2327d8[_0xb843('0x5')]||'';this[_0xb843('0x6')]=_0x2327d8['code']||'';this[_0xb843('0x7')]=_0x2327d8[_0xb843('0x7')]||'';this[_0xb843('0x8')]=_0x2327d8['Configurations']||{};}module[_0xb843('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 eeeffcf..05d5f48 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 _0xdb28=['name','type','dialAnswer','membername','Agent','channelAgent','format','SIP/%s','phone','Contact','firstName','lastName','active','calleridnum','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','ListId','UserId','VoiceQueueId','originatecalleridnum','originatecalleridname','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','isNil','string','uniqueid','idContact','queue'];(function(_0x38aa95,_0x3dd9a7){var _0x4b45eb=function(_0x4e7a41){while(--_0x4e7a41){_0x38aa95['push'](_0x38aa95['shift']());}};_0x4b45eb(++_0x3dd9a7);}(_0xdb28,0x106));var _0x8db2=function(_0x9eee7f,_0x78ff71){_0x9eee7f=_0x9eee7f-0x0;var _0x47bb1f=_0xdb28[_0x9eee7f];return _0x47bb1f;};'use strict';var util=require(_0x8db2('0x0'));var _=require(_0x8db2('0x1'));var moment=require(_0x8db2('0x2'));function checkNameSurname(_0xf66e59,_0x585da1,_0x1f4c45){var _0x11c26d='';if(!_[_0x8db2('0x3')](_0x585da1)&&_0x8db2('0x4')===typeof _0x585da1){_0x11c26d+=_0x585da1;}if(!_[_0x8db2('0x3')](_0x1f4c45)&&'string'===typeof _0x1f4c45){_0x11c26d+='\x20'+_0x1f4c45;}if(_0x11c26d!==''){return _0x11c26d;}return _0xf66e59;}function Action(_0x21a03e,_0x1d2dd3,_0x5f42ee,_0x494b40,_0x477f50){this[_0x8db2('0x5')]=_0x5f42ee||undefined;this[_0x8db2('0x6')]=_0x21a03e['id'];this[_0x8db2('0x7')]=_0x1d2dd3[_0x8db2('0x8')];this[_0x8db2('0x9')]=_0x1d2dd3[_0x8db2('0x9')];this['campaigntype']=_0x8db2('0x7');this[_0x8db2('0xa')]=![];this[_0x8db2('0xb')]=_['isNil'](_0x21a03e[_0x8db2('0xc')])?undefined:_0x21a03e[_0x8db2('0xc')]['name'];this[_0x8db2('0xd')]=this[_0x8db2('0xb')]?util[_0x8db2('0xe')](_0x8db2('0xf'),this[_0x8db2('0xb')]):_0x494b40||undefined;this['calleridname']=checkNameSurname(_0x21a03e['Contact'][_0x8db2('0x10')],_0x21a03e[_0x8db2('0x11')][_0x8db2('0x12')],_0x21a03e[_0x8db2('0x11')][_0x8db2('0x13')]);this[_0x8db2('0x14')]=_0x21a03e[_0x8db2('0x14')]||![];this[_0x8db2('0x15')]=_0x21a03e[_0x8db2('0x10')];this[_0x8db2('0x16')]=_0x21a03e['scheduledat'];this[_0x8db2('0x17')]=_0x21a03e[_0x8db2('0x17')]||0x0;this['countcongestionretry']=_0x21a03e[_0x8db2('0x18')]||0x0;this[_0x8db2('0x19')]=_0x21a03e[_0x8db2('0x19')]||0x0;this[_0x8db2('0x1a')]=(_0x21a03e[_0x8db2('0x17')]||0x0)+(_0x21a03e[_0x8db2('0x18')]||0x0)+(_0x21a03e['countnoanswerretry']||0x0)+(_0x21a03e['countnosuchnumberretry']||0x0)+(_0x21a03e[_0x8db2('0x1b')]||0x0)+(_0x21a03e[_0x8db2('0x1c')]||0x0)+(_0x21a03e[_0x8db2('0x1d')]||0x0)+(_0x21a03e[_0x8db2('0x1e')]||0x0);this['countnosuchnumberretry']=_0x21a03e[_0x8db2('0x1f')]||0x0;this[_0x8db2('0x1b')]=_0x21a03e[_0x8db2('0x1b')]||0x0;this[_0x8db2('0x1c')]=_0x21a03e[_0x8db2('0x1c')]||0x0;this['countmachineretry']=_0x21a03e[_0x8db2('0x1d')]||0x0;this[_0x8db2('0x1e')]=_0x21a03e[_0x8db2('0x1e')]||0x0;this[_0x8db2('0x20')]=_0x21a03e[_0x8db2('0x20')];this[_0x8db2('0x21')]=_0x21a03e[_0x8db2('0x21')];this['callbackat']=_0x21a03e[_0x8db2('0x22')];this['recallme']=_0x21a03e['recallme'];this['ContactId']=_0x21a03e['ContactId'];this[_0x8db2('0x23')]=_0x21a03e[_0x8db2('0x23')];this[_0x8db2('0x24')]=_[_0x8db2('0x3')](_0x21a03e[_0x8db2('0xc')])?_0x21a03e[_0x8db2('0x24')]:_0x21a03e['Agent']['id'];this[_0x8db2('0x25')]=_0x21a03e[_0x8db2('0x25')];this[_0x8db2('0x26')]='';this[_0x8db2('0x27')]='';}Action['prototype'][_0x8db2('0x28')]=function(){return util[_0x8db2('0xe')](_0x8db2('0x29'),this[_0x8db2('0x2a')],this[_0x8db2('0x2b')]);};module[_0x8db2('0x2c')]=Action; \ No newline at end of file +var _0xbbbc=['idContact','queue','name','type','campaigntype','membername','Agent','channelAgent','format','Contact','phone','lastName','active','scheduledat','countbusyretry','countcongestionretry','countnoanswerretry','countglobal','countdropretry','countabandonedretry','countmachineretry','countagentrejectretry','countnosuchnumberretry','callback','callbackuniqueid','callbackat','recallme','ContactId','ListId','VoiceQueueId','prototype','getCaller','\x22%s\x22\x20<%s>','calleridname','number','exports','util','lodash','moment','string','isNil','uniqueid'];(function(_0x2e78e9,_0x42957c){var _0x35aad4=function(_0x360fa1){while(--_0x360fa1){_0x2e78e9['push'](_0x2e78e9['shift']());}};_0x35aad4(++_0x42957c);}(_0xbbbc,0xf6));var _0xcbbb=function(_0x28cc56,_0xce9f42){_0x28cc56=_0x28cc56-0x0;var _0x1800c0=_0xbbbc[_0x28cc56];return _0x1800c0;};'use strict';var util=require(_0xcbbb('0x0'));var _=require(_0xcbbb('0x1'));var moment=require(_0xcbbb('0x2'));function checkNameSurname(_0x4538f9,_0x3ec75b,_0x3e91a2){var _0x464b75='';if(!_['isNil'](_0x3ec75b)&&_0xcbbb('0x3')===typeof _0x3ec75b){_0x464b75+=_0x3ec75b;}if(!_[_0xcbbb('0x4')](_0x3e91a2)&&_0xcbbb('0x3')===typeof _0x3e91a2){_0x464b75+='\x20'+_0x3e91a2;}if(_0x464b75!==''){return _0x464b75;}return _0x4538f9;}function Action(_0x3ccbf6,_0x43ff05,_0x4978a9,_0x388197,_0x1796b4){this[_0xcbbb('0x5')]=_0x4978a9||undefined;this[_0xcbbb('0x6')]=_0x3ccbf6['id'];this[_0xcbbb('0x7')]=_0x43ff05[_0xcbbb('0x8')];this[_0xcbbb('0x9')]=_0x43ff05['type'];this[_0xcbbb('0xa')]='queue';this['dialAnswer']=![];this[_0xcbbb('0xb')]=_['isNil'](_0x3ccbf6[_0xcbbb('0xc')])?undefined:_0x3ccbf6['Agent'][_0xcbbb('0x8')];this[_0xcbbb('0xd')]=this['membername']?util[_0xcbbb('0xe')]('SIP/%s',this[_0xcbbb('0xb')]):_0x388197||undefined;this['calleridname']=checkNameSurname(_0x3ccbf6[_0xcbbb('0xf')][_0xcbbb('0x10')],_0x3ccbf6[_0xcbbb('0xf')]['firstName'],_0x3ccbf6[_0xcbbb('0xf')][_0xcbbb('0x11')]);this[_0xcbbb('0x12')]=_0x3ccbf6[_0xcbbb('0x12')]||![];this['calleridnum']=_0x3ccbf6['phone'];this[_0xcbbb('0x13')]=_0x3ccbf6[_0xcbbb('0x13')];this[_0xcbbb('0x14')]=_0x3ccbf6[_0xcbbb('0x14')]||0x0;this['countcongestionretry']=_0x3ccbf6[_0xcbbb('0x15')]||0x0;this['countnoanswerretry']=_0x3ccbf6[_0xcbbb('0x16')]||0x0;this[_0xcbbb('0x17')]=(_0x3ccbf6[_0xcbbb('0x14')]||0x0)+(_0x3ccbf6['countcongestionretry']||0x0)+(_0x3ccbf6['countnoanswerretry']||0x0)+(_0x3ccbf6['countnosuchnumberretry']||0x0)+(_0x3ccbf6[_0xcbbb('0x18')]||0x0)+(_0x3ccbf6[_0xcbbb('0x19')]||0x0)+(_0x3ccbf6[_0xcbbb('0x1a')]||0x0)+(_0x3ccbf6[_0xcbbb('0x1b')]||0x0);this[_0xcbbb('0x1c')]=_0x3ccbf6[_0xcbbb('0x1c')]||0x0;this[_0xcbbb('0x18')]=_0x3ccbf6[_0xcbbb('0x18')]||0x0;this[_0xcbbb('0x19')]=_0x3ccbf6[_0xcbbb('0x19')]||0x0;this['countmachineretry']=_0x3ccbf6[_0xcbbb('0x1a')]||0x0;this[_0xcbbb('0x1b')]=_0x3ccbf6[_0xcbbb('0x1b')]||0x0;this[_0xcbbb('0x1d')]=_0x3ccbf6[_0xcbbb('0x1d')];this[_0xcbbb('0x1e')]=_0x3ccbf6[_0xcbbb('0x1e')];this[_0xcbbb('0x1f')]=_0x3ccbf6[_0xcbbb('0x1f')];this['recallme']=_0x3ccbf6[_0xcbbb('0x20')];this[_0xcbbb('0x21')]=_0x3ccbf6['ContactId'];this[_0xcbbb('0x22')]=_0x3ccbf6['ListId'];this['UserId']=_[_0xcbbb('0x4')](_0x3ccbf6[_0xcbbb('0xc')])?_0x3ccbf6['UserId']:_0x3ccbf6['Agent']['id'];this['VoiceQueueId']=_0x3ccbf6[_0xcbbb('0x23')];this['originatecalleridnum']='';this['originatecalleridname']='';}Action[_0xcbbb('0x24')][_0xcbbb('0x25')]=function(){return util[_0xcbbb('0xe')](_0xcbbb('0x26'),this[_0xcbbb('0x27')],this[_0xcbbb('0x28')]);};module[_0xcbbb('0x29')]=Action; \ No newline at end of file diff --git a/server/services/ami/preview/index.js b/server/services/ami/preview/index.js index a3d34e2..b22d52e 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 _0x70e0=['[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][getContactPreview]','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','Is\x20Valid','SIP/%s/%s%s','dialPrefix','dialCutDigit','substring','trim','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','extractCalleridName','extractCalleridNumber','merge','toLowerVariables','variablesAction','[originated][increment]','OriginateError','[originateFailure][logOriginateFailure]','channel','actionid','logLookAgent','clone','isFailure','response','custom:agentringnoanswer','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','channelstate','callProgressDetectingAgent','transfer','[syncHangup][talking][transfer]','destlinkedid','destuniqueid','addVariable','variables','filterKey','keys','variable','value','error','[syncVarSet][Preview]','inspect','transfertargetlinkedid','transfererlinkedid','util','lodash','uuid','../../../config/environment','../../../config/logger','preview','../ami','../rpc/cmHopperAdditionalPhone','redis','defaults','localhost','socket.io-emitter','prototype','tail','finally','sequence','campaignsPreview','voiceQueues','trunks','actions','clockClearZombieChannels','hangup','syncHangup','syncHangupRequest','bind','dialend','syncDialEnd','syncNewExten','varset','syncVarSet','syncAttendedTransfer','blindtransfer','syncBlindTransfer','emit','info','stringify','format','voice:queue:%s','name','voice_queue_channel:remove','voice_queue_presence:remove','originated','pTalking','sendMessageOneNotActive','paused','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20','\x20is\x20not\x20active','CAMPAIGN_STATUS','DEACTIVATED','\x20is\x20deactivated','loopCampaigns','syncCampaigns','hasOwnProperty','dialMethod','booked','type','setMessage','dialPreviewAutoRecallMe','clearZombieChannel','enqueue','[clearZombieChannels][talking]','Queue','queue','pick','UserId','VoiceQueueId','ListId','status','catch','message','No\x20such\x20channel','updateOriginated','dialAnswer','decrementTalkink','[clearZombieChannel]','loggerError','[Dialer][checkChannel][pTalking][Preview]','clearZombieChannels','[action]','recallMe','agentReadyId','agents','isNil','length','getDiff','scheduledat','Agent','voicePause','run','then','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','[getContactRecallMe]','IsNotLoggedIn','loggedIn','dialActive','isTrunkReachable','Trunk','TrunkBackup','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countnosuchnumberretry','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','buildObj','nosuchnumber','[callProgressDetectingCustomer][logNoSuch]','verifyAdditionalPhones','dialNoSuchNumberRetryFrequency','cloneAction','Global','createCustomerFinal','[callProgressDetectingCustomer][logNoSuchGlobal]','dialNoSuchNumberMaxRetry','scheduledAt','unlockAgent','actioncountonusuch','idContact','incrementPreviewCounters','swapAdditionalPhones','ANSWER','responsetime','answertime','[syncHangup][talking][increment]','uniqueid','\x20Queue','pTalking:\x20','custom:agentconnect','connect','custom:agentConnectPreview','buildAcw','custom:agentcomplete','complete','outboundAnswerCallsDay','answered','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','talktime','sumBillable','[syncHangup][talking][decrement]','linkedid','BUSY','outboundBusyCallsDay','countbusyretry','Busy','dialBusyRetryFrequency','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','additional','dialGlobalMaxRetry','dialBusyMaxRetry','rescheduleContact','activeContact','NOANSWER','outboundNoAnswerCallsDay','countnoanswerretry','dialNoAnswerRetryFrequency','callAdditionalPhoneAfterMin','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswer]','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','[callProgressDetectingCustomer][logCongestionGlobal]','dialCongestionMaxRetry','[callProgressDetectingCustomer][logCongestion]','CANCEL','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','ABANDONED','outboundAbandonedCallsDay','Abandoned','[callProgressDetectingCustomer][logAbandoned]','outboundUnknownCallsDay','cause-txt','dialstatus','custom:amd','amd','[callProgressDetectingCustomer][hangupInAMD]','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknown]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','originated:\x20','queueSummaryCountersUpdated','isUndefined','object','logAgent','[callProgressDetectingAgent][logNoSuch]','NoAnswer','createAgentHistory','[callProgressDetectingAgent][logNoAnswer]','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','[callProgressDetectingAgent][logAnswerAGI]','reason','[callProgressDetectingAgent]','[originated][decrement][callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','[incrementPreviewCounters]\x20','Contact','lookAgent','isEmpty','execCall','\x20IdHopper:\x20','custom:agentcalled','Calling','[Preview][execCall][failure]','outboundBlacklistCallsDay','logBlacklist','createHistory','Contact\x20in\x20black\x20List','active','SIP/%s','reachable','unmonitored','unlockContact','getContactPreview','recallme','phone','checkInBlack'];(function(_0x2b3410,_0x57fc4b){var _0x532eed=function(_0x2be997){while(--_0x2be997){_0x2b3410['push'](_0x2b3410['shift']());}};_0x532eed(++_0x57fc4b);}(_0x70e0,0x17b));var _0x070e=function(_0x409e51,_0x44370a){_0x409e51=_0x409e51-0x0;var _0x424f44=_0x70e0[_0x409e51];return _0x424f44;};'use strict';var util=require(_0x070e('0x0'));var _=require(_0x070e('0x1'));var uuid=require(_0x070e('0x2'));var moment=require('moment');var Redis=require('ioredis');var config=require(_0x070e('0x3'));var logger=require(_0x070e('0x4'))(_0x070e('0x5'));var loggerAction=require(_0x070e('0x4'))('actionPreview');var ami=require(_0x070e('0x6'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require(_0x070e('0x7'));var Action=require('./action');var ut=require('./util/util');var utils=require('../dialer/utils');config[_0x070e('0x8')]=_[_0x070e('0x9')](config[_0x070e('0x8')],{'host':_0x070e('0xa'),'port':0x18eb});var io=require(_0x070e('0xb'))(new Redis(config[_0x070e('0x8')]));var Sequence=function(){};Sequence[_0x070e('0xc')]['enqueue']=function(_0x49b2fb){this[_0x070e('0xd')]=this[_0x070e('0xd')]?this[_0x070e('0xd')][_0x070e('0xe')](_0x49b2fb):_0x49b2fb();};function Preview(_0xa927a2){this[_0x070e('0xf')]=new Sequence();this[_0x070e('0x10')]=_0xa927a2[_0x070e('0x11')];this[_0x070e('0x12')]=_0xa927a2[_0x070e('0x12')];this[_0x070e('0x13')]={};this['agents']=_0xa927a2['agents'];this[_0x070e('0x14')]=0x0;ami['on']('originateresponse',this['syncOriginateResponse']['bind'](this));ami['on'](_0x070e('0x15'),this[_0x070e('0x16')]['bind'](this));ami['on']('hanguprequest',this[_0x070e('0x17')][_0x070e('0x18')](this));ami['on'](_0x070e('0x19'),this[_0x070e('0x1a')]['bind'](this));ami['on']('newexten',this[_0x070e('0x1b')][_0x070e('0x18')](this));ami['on'](_0x070e('0x1c'),this[_0x070e('0x1d')][_0x070e('0x18')](this));ami['on']('attendedtransfer',this[_0x070e('0x1e')][_0x070e('0x18')](this));ami['on'](_0x070e('0x1f'),this[_0x070e('0x20')][_0x070e('0x18')](this));this['loopCampaigns'](this['campaignsPreview']);}function emit(_0x4e958f,_0x9907cf,_0x3004f0){io['to'](_0x4e958f)[_0x070e('0x21')](_0x9907cf,_0x3004f0);}function emitVoiceQueueChannelRemove(_0x4be0d7){logger[_0x070e('0x22')]('[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event',JSON[_0x070e('0x23')](_0x4be0d7));emit(util[_0x070e('0x24')](_0x070e('0x25'),_0x4be0d7[_0x070e('0x26')]),_0x070e('0x27'),_0x4be0d7);io[_0x070e('0x21')](_0x070e('0x28'),_0x4be0d7);}function notSendMessagesQueue(_0x164cdf){if(_0x164cdf['sendMessageOneNotActive']){if(_0x164cdf[_0x070e('0x29')]===0x0&&_0x164cdf[_0x070e('0x2a')]===0x0){_0x164cdf[_0x070e('0x2b')]=![];_0x164cdf['available']=0x0;_0x164cdf[_0x070e('0x2c')]=0x0;_0x164cdf['message']=utils['CAMPAIGN_STATUS'][_0x070e('0x2d')];ut[_0x070e('0x2e')](_0x070e('0x2f'),_0x164cdf[_0x070e('0x26')]+_0x070e('0x30'));}else{_0x164cdf['message']=utils[_0x070e('0x31')][_0x070e('0x32')];ut[_0x070e('0x2e')](_0x070e('0x2f'),_0x164cdf[_0x070e('0x26')]+_0x070e('0x33'));}}}Preview[_0x070e('0xc')][_0x070e('0x34')]=function(){var _0x5e8326=this;setInterval(function(){_0x5e8326[_0x070e('0x35')]();},0x7cf);};Preview[_0x070e('0xc')][_0x070e('0x35')]=function(){var _0x56fc12=this['campaignsPreview'];this[_0x070e('0x14')]+=0x1;for(var _0x46065c in _0x56fc12){if(_0x56fc12[_0x070e('0x36')](_0x46065c)&&(_0x56fc12[_0x46065c]['dialMethod']===_0x070e('0x5')||_0x56fc12[_0x46065c][_0x070e('0x37')]===_0x070e('0x38'))&&_0x56fc12[_0x46065c][_0x070e('0x39')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this['clockClearZombieChannels']=0x0;this['clearZombieChannels']();}}if(_0x56fc12[_0x070e('0x36')](_0x46065c)&&_0x56fc12[_0x46065c]['dialMethod']===_0x070e('0x5')&&_0x56fc12[_0x46065c][_0x070e('0x39')]==='outbound'){if(_0x56fc12[_0x46065c]['dialActive']){this[_0x070e('0x3a')](_0x56fc12[_0x46065c]);if(_0x56fc12[_0x46065c][_0x070e('0x3b')])this['recallMe'](_0x56fc12[_0x46065c]);}else{notSendMessagesQueue(_0x56fc12[_0x46065c]);}}}};Preview['prototype'][_0x070e('0x3c')]=function(_0x27dd1f){var _0x444d02=this;this[_0x070e('0xf')][_0x070e('0x3d')](function(){if(!_['isNil'](_0x444d02['actions'][_0x27dd1f])){loggerAction[_0x070e('0x22')](_0x070e('0x3e'),_0x27dd1f,_0x070e('0x3f'),_0x444d02[_0x070e('0x13')][_0x27dd1f][_0x070e('0x40')],'originated:\x20',JSON[_0x070e('0x23')](_0x444d02[_0x070e('0x10')][_0x444d02['actions'][_0x27dd1f][_0x070e('0x40')]][_0x070e('0x29')]),'pTalking:\x20',JSON['stringify'](_0x444d02['campaignsPreview'][_0x444d02[_0x070e('0x13')][_0x27dd1f][_0x070e('0x40')]][_0x070e('0x2a')]),JSON[_0x070e('0x23')](_0x444d02[_0x070e('0x13')][_0x27dd1f]['dialAnswer']),JSON[_0x070e('0x23')](_[_0x070e('0x41')](_0x444d02[_0x070e('0x13')][_0x27dd1f],['contactId',_0x070e('0x42'),_0x070e('0x43'),_0x070e('0x44')])));return ami['Action']({'action':_0x070e('0x45'),'channel':_0x444d02[_0x070e('0x13')][_0x27dd1f]['channel']})[_0x070e('0x46')](function(_0x5d689b){if(_0x5d689b[_0x070e('0x47')]===_0x070e('0x48')){setTimeout(function(){if(_0x444d02[_0x070e('0x13')][_0x27dd1f]){ut[_0x070e('0x49')](_0x444d02[_0x070e('0x10')][_0x444d02['actions'][_0x27dd1f][_0x070e('0x40')]],'[clearZombieChannel]');if(_0x444d02['actions'][_0x27dd1f][_0x070e('0x4a')]===!![]){ut[_0x070e('0x4b')](_0x444d02[_0x070e('0x10')][_0x444d02['actions'][_0x27dd1f][_0x070e('0x40')]],_0x070e('0x4c'));ut[_0x070e('0x4d')](_0x070e('0x4e')+_0x27dd1f,_0x444d02['actions'][_0x27dd1f][_0x070e('0x40')]);}ut['loggerError']('[Dialer][checkChannel][Preview]'+_0x27dd1f,_0x444d02['actions'][_0x27dd1f][_0x070e('0x40')]);delete _0x444d02[_0x070e('0x13')][_0x27dd1f];}},0x2328);}});}});};Preview[_0x070e('0xc')][_0x070e('0x4f')]=function(){var _0x34f23e=this;loggerAction['info'](_0x070e('0x50'),_['size'](this[_0x070e('0x13')]));for(var _0x42245d in this[_0x070e('0x13')]){if(_0x34f23e['actions']['hasOwnProperty'](_0x42245d)){_0x34f23e[_0x070e('0x3c')](_0x42245d);}}};Preview['prototype'][_0x070e('0x51')]=function(_0x3fdb75){var _0x139820=this;rpcDb['getContactRecallMe'](_0x3fdb75['id'],ut[_0x070e('0x52')](this[_0x070e('0x53')]))['then'](function(_0x589b97){if(!_[_0x070e('0x54')](_0x589b97)){for(var _0x945901=0x0;_0x945901<_0x589b97[_0x070e('0x55')];_0x945901+=0x1){if(ut[_0x070e('0x56')](_0x589b97[_0x945901][_0x070e('0x57')])<_0x3fdb75['dialRecallMeTimeout']*0x3c){if(_0x589b97[_0x945901][_0x070e('0x58')]&&!_0x589b97[_0x945901][_0x070e('0x58')][_0x070e('0x59')]){_0x139820[_0x070e('0x5a')](_0x589b97[_0x945901]['id'])[_0x070e('0x5b')](ut[_0x070e('0x5c')](_0x070e('0x5d')))[_0x070e('0x46')](ut[_0x070e('0x5c')](_0x070e('0x5d')));}else{rpcDb[_0x070e('0x5e')](_0x589b97[_0x945901]['id']);}}else{var _0x3be553=new Action(_0x589b97[_0x945901],_0x3fdb75);_0x3be553[_0x070e('0x5f')]=moment()[_0x070e('0x24')](_0x070e('0x60'));_0x3fdb75['outboundReCallsDay']+=0x1;ut[_0x070e('0x61')](_0x3be553,0x17,_0x070e('0x62'));if(_0x3fdb75[_0x070e('0x63')]){rpcDb[_0x070e('0x64')](ut[_0x070e('0x65')](_0x589b97[_0x945901]));rpcDb[_0x070e('0x66')](_0x3be553,_0x070e('0x67'));}else{ut[_0x070e('0x61')](_0x3be553,0x16,_0x070e('0x68'));rpcDb['createCustomerHistory'](_0x3be553,_0x070e('0x69'));rpcDb['createCustomerFinal'](_0x3be553,_0x070e('0x69'));}}}}})[_0x070e('0x46')](ut['logger2'](_0x070e('0x6a')));};Preview[_0x070e('0xc')][_0x070e('0x3a')]=function(_0xa74805){_0xa74805[_0x070e('0x2b')]=!![];if(ut[_0x070e('0x6b')](_0xa74805[_0x070e('0x6c')])){_0xa74805['message']=utils[_0x070e('0x31')]['NO_AGENTS_LOGGED'];}else if(!ut['isActive'](_0xa74805[_0x070e('0x6d')])){_0xa74805[_0x070e('0x47')]=utils[_0x070e('0x31')][_0x070e('0x2d')];}else if(!this[_0x070e('0x6e')](_0xa74805[_0x070e('0x6f')])){if(!this[_0x070e('0x6e')](_0xa74805[_0x070e('0x70')])){_0xa74805['message']=utils[_0x070e('0x31')]['UNREACHABLE_TRUNK'];}else{_0xa74805['message']=utils[_0x070e('0x31')][_0x070e('0x71')];}}else{_0xa74805['message']=utils[_0x070e('0x31')][_0x070e('0x71')];}};Preview[_0x070e('0xc')][_0x070e('0x72')]=function(_0x1aacfc,_0x382ce3,_0x1b36cd){var _0x4ef647=this;var _0x5874cd=this['actions'][_0x382ce3];var _0x3087e5=this[_0x070e('0x10')][_0x5874cd[_0x070e('0x40')]];var _0x2f8fcb;var _0x5ac0b5=![];var _0x25f34c=0x2;var _0x5d3c3a=0x3;if(_0x3087e5){switch(_0x1b36cd){case'1':_0x3087e5[_0x070e('0x73')]+=0x1;_0x5874cd[_0x070e('0x74')]+=0x1;_0x5874cd[_0x070e('0x75')]=ut[_0x070e('0x76')](_0x5874cd);ut[_0x070e('0x61')](_0x5874cd,0x0,_0x070e('0x77'));ami['emit'](_0x070e('0x78'),ut[_0x070e('0x79')](_0x5874cd,_0x070e('0x7a')));rpcDb['createCustomerHistory'](_0x5874cd,_0x070e('0x7b'));_0x4ef647[_0x070e('0x7c')](_0x5874cd,'0',_0x3087e5)['then'](function(_0x1f1df5){_0x5ac0b5=_0x1f1df5['additional']==0x1;_0x25f34c=_0x3087e5[_0x070e('0x7d')];_0x5d3c3a=_0x3087e5['callAdditionalPhoneAfterMin'];if(!_0x5ac0b5){if(ut['totalGlobal'](_0x5874cd)>=_0x3087e5['dialGlobalMaxRetry']){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0xf,_0x070e('0x7f'));rpcDb[_0x070e('0x80')](_0x2f8fcb,_0x070e('0x81'));}else{if(_0x5874cd[_0x070e('0x74')]>=_0x3087e5[_0x070e('0x82')]){rpcDb['createCustomerFinal'](_0x5874cd,_0x070e('0x81'));}else{rpcDb['rescheduleContact'](ut[_0x070e('0x83')](_0x5874cd,'countnosuchnumberretry',_0x3087e5[_0x070e('0x7d')]),_0x5874cd[_0x070e('0x84')],_0x5874cd['activeContact']);}}delete this[_0x070e('0x13')][_0x1aacfc['linkedid']];}else{_0x5874cd[_0x070e('0x74')]++;logger[_0x070e('0x22')](_0x070e('0x85'),_0x5874cd[_0x070e('0x74')]);logger[_0x070e('0x22')]('id',_0x5874cd[_0x070e('0x86')]);_0x4ef647[_0x070e('0x87')]({'id':_0x5874cd[_0x070e('0x86')],'field':{'countnosuchnumberretry':_0x5874cd[_0x070e('0x74')]}})[_0x070e('0x5b')](function(){_0x4ef647[_0x070e('0x88')](_0x5874cd,_0x25f34c,_0x5d3c3a)[_0x070e('0x5b')](function(){});});}});break;case _0x070e('0x89'):var _0x20bcf3=moment()['format'](_0x070e('0x60'));_0x5874cd[_0x070e('0x8a')]=_0x20bcf3;_0x5874cd[_0x070e('0x8b')]=_0x20bcf3;_0x5874cd[_0x070e('0x4a')]=!![];_0x3087e5['pTalking']+=0x1;logger[_0x070e('0x22')](_0x070e('0x8c'),_0x5874cd[_0x070e('0x8d')],_0x070e('0x8e'),_0x3087e5[_0x070e('0x26')],_0x070e('0x8f'),_0x3087e5['pTalking']);ami[_0x070e('0x21')](_0x070e('0x90'),ut[_0x070e('0x79')](_0x5874cd,_0x070e('0x91'),this['campaignsPreview'][_0x5874cd[_0x070e('0x40')]]));if(_0x3087e5['acw']){ami[_0x070e('0x21')](_0x070e('0x92'),ut[_0x070e('0x93')](_0x5874cd));}break;case'16':ami[_0x070e('0x21')](_0x070e('0x94'),ut['buildObj'](_0x5874cd,_0x070e('0x95'),this[_0x070e('0x10')][_0x5874cd[_0x070e('0x40')]]));emitVoiceQueueChannelRemove(ut[_0x070e('0x79')](_0x5874cd,'complete'));_0x3087e5[_0x070e('0x96')]+=0x1;_0x3087e5['total']+=0x1;_0x3087e5[_0x070e('0x97')]+=0x1;ut[_0x070e('0x4b')](_0x3087e5,_0x070e('0x98'));_0x5874cd['countglobal']=ut[_0x070e('0x76')](_0x5874cd);ut['logCustomer'](_0x5874cd,0x4,_0x070e('0x99'));rpcDb['createCustomerHistory'](_0x5874cd,_0x070e('0x9a'));rpcDb[_0x070e('0x80')](_0x5874cd,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0x070e('0x9b')](_0x5874cd);_0x3087e5['sumDuration']+=_0x5874cd[_0x070e('0x9c')];_0x3087e5[_0x070e('0x9d')]+=_0x5874cd['talktime'];logger['info'](_0x070e('0x9e'),_0x5874cd[_0x070e('0x8d')],_0x070e('0x8e'),_0x3087e5[_0x070e('0x26')],_0x070e('0x8f'),_0x3087e5[_0x070e('0x2a')]);delete this[_0x070e('0x13')][_0x1aacfc[_0x070e('0x9f')]];break;case _0x070e('0xa0'):_0x3087e5[_0x070e('0xa1')]+=0x1;_0x5874cd[_0x070e('0xa2')]+=0x1;_0x5874cd[_0x070e('0x75')]=ut[_0x070e('0x76')](_0x5874cd);ut['logCustomer'](_0x5874cd,0x5,_0x070e('0xa3'));_0x25f34c=_0x3087e5[_0x070e('0xa4')];_0x5d3c3a=_0x3087e5['callAdditionalPhoneAfterMin'];ami['emit'](_0x070e('0xa5'),ut[_0x070e('0x79')](_0x5874cd,_0x070e('0xa6')));rpcDb[_0x070e('0x66')](_0x5874cd,_0x070e('0xa7'));_0x4ef647[_0x070e('0x7c')](_0x5874cd,'5',_0x3087e5)[_0x070e('0x5b')](function(_0x110813){_0x5ac0b5=_0x110813[_0x070e('0xa8')]==0x1;if(!_0x5ac0b5){if(ut[_0x070e('0x76')](_0x5874cd)>=_0x3087e5[_0x070e('0xa9')]){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0xf,_0x070e('0x7f'));rpcDb['createCustomerFinal'](_0x2f8fcb,'[callProgressDetectingCustomer][logBusyGlobal]');}else{if(_0x5874cd['countbusyretry']>=_0x3087e5[_0x070e('0xaa')]){rpcDb[_0x070e('0x80')](_0x5874cd,_0x070e('0xa7'));}else{rpcDb[_0x070e('0xab')](ut['scheduledAt'](_0x5874cd,_0x070e('0xa2'),_0x3087e5[_0x070e('0xa4')]),_0x5874cd[_0x070e('0x84')],_0x5874cd[_0x070e('0xac')]);}}}else{_0x5874cd[_0x070e('0xa2')]++;_0x4ef647[_0x070e('0x87')]({'id':_0x5874cd['idContact'],'field':{'countbusyretry':_0x5874cd[_0x070e('0xa2')]}})['then'](function(){_0x4ef647[_0x070e('0x88')](_0x5874cd,_0x25f34c,_0x5d3c3a)[_0x070e('0x5b')](function(){});});}});break;case _0x070e('0xad'):_0x3087e5[_0x070e('0xae')]+=0x1;_0x5874cd[_0x070e('0xaf')]+=0x1;_0x5874cd['countglobal']=ut[_0x070e('0x76')](_0x5874cd);ut[_0x070e('0x61')](_0x5874cd,0x3,'NoAnswer');_0x25f34c=_0x3087e5[_0x070e('0xb0')];_0x5d3c3a=_0x3087e5[_0x070e('0xb1')];var _0x553ea1=ut[_0x070e('0xb2')](_0x5874cd,_0x3087e5);ami[_0x070e('0x21')](_0x070e('0xb3'),_0x553ea1);rpcDb['createCustomerHistory'](_0x5874cd,_0x070e('0xb4'));_0x4ef647[_0x070e('0x7c')](_0x5874cd,'3',_0x3087e5)[_0x070e('0x5b')](function(_0x1ad0bf){_0x5ac0b5=_0x1ad0bf[_0x070e('0xa8')]==0x1;if(!_0x5ac0b5){if(ut[_0x070e('0x76')](_0x5874cd)>=_0x3087e5[_0x070e('0xa9')]){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0xf,_0x070e('0x7f'));rpcDb[_0x070e('0x80')](_0x2f8fcb,_0x070e('0xb5'));}else{if(_0x5874cd[_0x070e('0xaf')]>=_0x3087e5[_0x070e('0xb6')]){rpcDb['createCustomerFinal'](_0x5874cd,_0x070e('0xb4'));}else{rpcDb[_0x070e('0xab')](ut[_0x070e('0x83')](_0x5874cd,_0x070e('0xaf'),_0x3087e5[_0x070e('0xb0')]),_0x5874cd[_0x070e('0x84')],_0x5874cd['activeContact']);}}}else{_0x5874cd['countnoanswerretry']++;_0x4ef647['incrementPreviewCounters']({'id':_0x5874cd[_0x070e('0x86')],'field':{'countnoanswerretry':_0x5874cd[_0x070e('0xaf')]}})[_0x070e('0x5b')](function(){_0x4ef647[_0x070e('0x88')](_0x5874cd,_0x25f34c,_0x5d3c3a)['then'](function(){});});}});break;case _0x070e('0xb7'):_0x3087e5[_0x070e('0xb8')]+=0x1;_0x5874cd[_0x070e('0xb9')]+=0x1;_0x5874cd['countglobal']=ut[_0x070e('0x76')](_0x5874cd);ut['logCustomer'](_0x5874cd,0x8,_0x070e('0xba'));_0x25f34c=_0x3087e5[_0x070e('0xbb')];_0x5d3c3a=_0x3087e5['callAdditionalPhoneAfterMin'];ami['emit'](_0x070e('0xbc'),ut[_0x070e('0x79')](_0x5874cd,'congestion'));rpcDb[_0x070e('0x66')](_0x5874cd,'[callProgressDetectingCustomer][logCongestion]');_0x4ef647['verifyAdditionalPhones'](_0x5874cd,'8',_0x3087e5)['then'](function(_0x15480c){_0x5ac0b5=_0x15480c[_0x070e('0xa8')]==0x1;if(!_0x5ac0b5){if(ut[_0x070e('0x76')](_0x5874cd)>=_0x3087e5[_0x070e('0xa9')]){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0xf,_0x070e('0x7f'));rpcDb[_0x070e('0x80')](_0x2f8fcb,_0x070e('0xbd'));}else{if(_0x5874cd[_0x070e('0xb9')]>=_0x3087e5[_0x070e('0xbe')]){rpcDb[_0x070e('0x80')](_0x5874cd,_0x070e('0xbf'));}else{rpcDb[_0x070e('0xab')](ut[_0x070e('0x83')](_0x5874cd,_0x070e('0xb9'),_0x3087e5[_0x070e('0xa4')]),_0x5874cd[_0x070e('0x84')],_0x5874cd[_0x070e('0xac')]);}}}else{_0x5874cd[_0x070e('0xb9')]++;_0x4ef647[_0x070e('0x87')]({'id':_0x5874cd[_0x070e('0x86')],'field':{'countcongestionretry':_0x5874cd[_0x070e('0xb9')]}})['then'](function(){_0x4ef647[_0x070e('0x88')](_0x5874cd,_0x25f34c,_0x5d3c3a)[_0x070e('0x5b')](function(){});});}});break;case _0x070e('0xc0'):_0x3087e5[_0x070e('0xc1')]+=0x1;_0x5874cd['countagentrejectretry']+=0x1;_0x5874cd[_0x070e('0x75')]=ut[_0x070e('0x76')](_0x5874cd);ut[_0x070e('0x61')](_0x5874cd,0x14,_0x070e('0xc2'));_0x25f34c=_0x3087e5[_0x070e('0xc3')];_0x5d3c3a=_0x3087e5[_0x070e('0xb1')];ami['emit']('custom:agentreject',ut['buildObj'](_0x5874cd,_0x070e('0xc4')));rpcDb['createCustomerHistory'](_0x5874cd,_0x070e('0xc5'));_0x4ef647[_0x070e('0x7c')](_0x5874cd,'20',_0x3087e5)['then'](function(_0x912f24){_0x5ac0b5=_0x912f24[_0x070e('0xa8')]==0x1;if(!_0x5ac0b5){if(ut['totalGlobal'](_0x5874cd)>=_0x3087e5['dialGlobalMaxRetry']){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0x14,_0x070e('0xc2'));rpcDb[_0x070e('0x80')](_0x2f8fcb,_0x070e('0xc6'));}else{if(_0x5874cd[_0x070e('0xc7')]>=_0x3087e5['dialAgentRejectMaxRetry']){rpcDb[_0x070e('0x80')](_0x5874cd,'[callProgressDetectingCustomer][logAgentReject]');}else{rpcDb[_0x070e('0xab')](ut[_0x070e('0x83')](_0x5874cd,'countagentrejectretry',_0x3087e5[_0x070e('0xc3')]),_0x5874cd[_0x070e('0x84')],_0x5874cd[_0x070e('0xac')]);}}}else{_0x5874cd[_0x070e('0xaf')]++;_0x4ef647[_0x070e('0x87')]({'id':_0x5874cd[_0x070e('0x86')],'field':{'countnoanswerretry':_0x5874cd['countnoanswerretry']}})[_0x070e('0x5b')](function(){_0x4ef647[_0x070e('0x88')](_0x5874cd,_0x25f34c,_0x5d3c3a)[_0x070e('0x5b')](function(){});});}});break;case _0x070e('0xc8'):_0x3087e5[_0x070e('0xc9')]+=0x1;_0x5874cd['countabandonedretry']+=0x1;_0x5874cd[_0x070e('0x75')]=ut[_0x070e('0x76')](_0x5874cd);ut[_0x070e('0x61')](_0x5874cd,0xb,_0x070e('0xca'));rpcDb[_0x070e('0x66')](_0x5874cd,_0x070e('0xcb'));_0x4ef647[_0x070e('0x7c')](_0x5874cd,'11',_0x3087e5)[_0x070e('0x5b')](function(_0x1fb1e6){_0x5ac0b5=_0x1fb1e6[_0x070e('0xa8')]==0x1;if(!_0x5ac0b5){if(ut[_0x070e('0x76')](_0x5874cd)>=_0x3087e5[_0x070e('0xa9')]){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0xf,_0x070e('0x7f'));rpcDb[_0x070e('0x80')](_0x2f8fcb,_0x070e('0xcb'));}else{if(_0x5874cd['countabandonedetry']>=_0x3087e5['dialAbandonedMaxRety']){rpcDb[_0x070e('0x80')](_0x5874cd,_0x070e('0xcb'));}else{rpcDb['rescheduleContact'](ut['scheduledAt'](_0x5874cd,'countabandonedretry',_0x3087e5['dialAbandonedRetryFrequency']),_0x5874cd[_0x070e('0x84')],_0x5874cd[_0x070e('0xac')]);}}}else{_0x5874cd[_0x070e('0xaf')]++;_0x4ef647[_0x070e('0x87')]({'id':_0x5874cd[_0x070e('0x86')],'field':{'countnoanswerretry':_0x5874cd[_0x070e('0xaf')]}})[_0x070e('0x5b')](function(){_0x4ef647[_0x070e('0x88')](_0x5874cd,_0x25f34c,_0x5d3c3a)[_0x070e('0x5b')](function(){});});}});break;case'18':_0x3087e5[_0x070e('0xcc')]+=0x1;_0x5874cd['countmachineretry']+=0x1;_0x5874cd[_0x070e('0x75')]=ut[_0x070e('0x76')](_0x5874cd);ut['logCustomer'](_0x5874cd,0x12,_0x1aacfc[_0x070e('0xcd')]||_0x1aacfc[_0x070e('0xce')]);ami[_0x070e('0x21')](_0x070e('0xcf'),ut['buildObj'](_0x5874cd,_0x070e('0xd0')));rpcDb[_0x070e('0x66')](_0x5874cd,_0x070e('0xd1'));_0x4ef647[_0x070e('0x7c')](_0x5874cd,'18',_0x3087e5)['then'](function(_0x4096ae){_0x5ac0b5=_0x4096ae[_0x070e('0xa8')]==0x1;if(!_0x5ac0b5){if(ut[_0x070e('0x76')](_0x5874cd)>=_0x3087e5[_0x070e('0xa9')]){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0x12,_0x070e('0x7f'));rpcDb[_0x070e('0x80')](_0x2f8fcb,_0x070e('0xd1'));}else{rpcDb[_0x070e('0x80')](_0x5874cd,_0x070e('0xd1'));}}else{_0x5874cd[_0x070e('0xaf')]++;_0x4ef647['incrementPreviewCounters']({'id':_0x5874cd[_0x070e('0x86')],'field':{'countnoanswerretry':_0x5874cd[_0x070e('0xaf')]}})['then'](function(){_0x4ef647['swapAdditionalPhones'](_0x5874cd,_0x25f34c,_0x5d3c3a)[_0x070e('0x5b')](function(){});});}});delete this['actions'][_0x1aacfc[_0x070e('0x9f')]];break;case'19':_0x3087e5[_0x070e('0xcc')]+=0x1;_0x5874cd[_0x070e('0x75')]=ut[_0x070e('0x76')](_0x5874cd);ut[_0x070e('0x61')](_0x5874cd,0x13,_0x1aacfc[_0x070e('0xcd')]||_0x1aacfc[_0x070e('0xce')]);ami['emit'](_0x070e('0xcf'),ut[_0x070e('0x79')](_0x5874cd,_0x070e('0xd0')));rpcDb[_0x070e('0x66')](_0x5874cd,'[callProgressDetectingCustomer][machine]');_0x4ef647['verifyAdditionalPhones'](_0x5874cd,'18',_0x3087e5)[_0x070e('0x5b')](function(_0x205305){_0x5ac0b5=_0x205305[_0x070e('0xa8')]==0x1;if(!_0x5ac0b5){if(ut['totalGlobal'](_0x5874cd)>=_0x3087e5[_0x070e('0xa9')]){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0xf,'Global');rpcDb[_0x070e('0x80')](_0x2f8fcb,_0x070e('0xd2'));}else{rpcDb[_0x070e('0x80')](_0x5874cd,_0x070e('0xd2'));}}else{_0x5874cd[_0x070e('0xaf')]++;_0x4ef647[_0x070e('0x87')]({'id':_0x5874cd['idContact'],'field':{'countnoanswerretry':_0x5874cd['countnoanswerretry']}})[_0x070e('0x5b')](function(){_0x4ef647['swapAdditionalPhones'](_0x5874cd,_0x25f34c,_0x5d3c3a)[_0x070e('0x5b')](function(){});});}});delete this[_0x070e('0x13')][_0x1aacfc['linkedid']];break;default:if(_0x5874cd[_0x070e('0x4a')]){ut['decrementTalkink'](_0x3087e5,_0x070e('0xd3'));ut[_0x070e('0x4d')](_0x070e('0xd4')+_0x3087e5[_0x070e('0x26')],_0x1aacfc);}_0x3087e5[_0x070e('0xcc')]+=0x1;_0x5874cd[_0x070e('0x75')]=ut['totalGlobal'](_0x5874cd);ut[_0x070e('0x61')](_0x5874cd,0xc,_0x1aacfc[_0x070e('0xcd')]||_0x1aacfc['dialstatus']);_0x25f34c=_0x3087e5['dialAgentRejectRetryFrequency'];_0x5d3c3a=_0x3087e5[_0x070e('0xb1')];rpcDb[_0x070e('0x66')](_0x5874cd,_0x070e('0xd5'));_0x4ef647[_0x070e('0x7c')](_0x5874cd,'20',_0x3087e5)[_0x070e('0x5b')](function(_0x3e2c30){_0x5ac0b5=_0x3e2c30[_0x070e('0xa8')]==0x1;if(!_0x5ac0b5){if(ut[_0x070e('0x76')](_0x5874cd)>=_0x3087e5['dialGlobalMaxRetry']){_0x2f8fcb=ut[_0x070e('0x7e')](_0x5874cd,0xf,_0x070e('0x7f'));rpcDb[_0x070e('0x80')](_0x2f8fcb,_0x070e('0xd6'));}else{rpcDb[_0x070e('0x80')](_0x5874cd,_0x070e('0xd6'));}delete this[_0x070e('0x13')][_0x1aacfc[_0x070e('0x9f')]];}else{_0x4ef647['swapAdditionalPhones'](_0x5874cd,_0x25f34c,_0x5d3c3a)[_0x070e('0x5b')](function(){});}});}if(!(_0x5874cd[_0x070e('0x4a')]&&_0x1b36cd==='16')){ut[_0x070e('0x49')](_0x3087e5,_0x070e('0xd7'));logger[_0x070e('0x22')](_0x070e('0xd8'),_0x5874cd[_0x070e('0x8d')],_0x070e('0x8e'),_0x3087e5[_0x070e('0x26')],_0x070e('0xd9'),_0x3087e5['originated']);}if(_0x1b36cd!=='ANSWER'){delete this[_0x070e('0x13')][_0x1aacfc[_0x070e('0x9f')]];delete this[_0x070e('0x13')][_0x1aacfc['destlinkedid']];}_0x3087e5[_0x070e('0xda')]=!![];}};Preview[_0x070e('0xc')]['callProgressDetectingAgent']=function(_0x26901c,_0x2b6909,_0x2f34b9){if(_[_0x070e('0xdb')](_0x2b6909)&&_0x070e('0xdc')!==typeof _0x2b6909){return;}if(_[_0x070e('0xdb')](_0x2f34b9)&&'object'!==typeof _0x2f34b9){return;}switch(_0x2f34b9['reason']){case'0':ut[_0x070e('0xdd')](_0x26901c,0x0,_0x070e('0x77'));rpcDb['createAgentHistory'](_0x26901c,_0x070e('0xde'));break;case'3':ut[_0x070e('0xdd')](_0x26901c,0x3,_0x070e('0xdf'));rpcDb[_0x070e('0xe0')](_0x26901c,_0x070e('0xe1'));break;case'5':ut[_0x070e('0xdd')](_0x26901c,0x5,'Busy');rpcDb[_0x070e('0xe0')](_0x26901c,_0x070e('0xe2'));break;case'8':ut['logAgent'](_0x26901c,0x8,_0x070e('0xba'));rpcDb[_0x070e('0xe0')](_0x26901c,_0x070e('0xe3'));break;case'22':ut[_0x070e('0xdd')](_0x26901c,0x16,'AnswerAGI');rpcDb['createAgentHistory'](_0x26901c,_0x070e('0xe4'));break;default:ut[_0x070e('0xdd')](_0x26901c,0xc,_0x2f34b9[_0x070e('0xe5')]);rpcDb[_0x070e('0xe0')](_0x26901c,_0x070e('0xe3'));}ut[_0x070e('0x49')](_0x2b6909,_0x070e('0xe6'));logger[_0x070e('0x22')](_0x070e('0xe7'),_0x26901c[_0x070e('0x8d')],'\x20Queue',_0x2b6909[_0x070e('0x26')],_0x070e('0xd9'),_0x2b6909[_0x070e('0x29')]);delete this[_0x070e('0x13')][_0x26901c['uniqueid']];};Preview[_0x070e('0xc')][_0x070e('0x7c')]=function(_0x510bce,_0x4b559b,_0x27c346){return cmHopperAdditionalPhone[_0x070e('0x7c')](_0x510bce,_0x4b559b,_0x27c346)[_0x070e('0x46')](logger['info'](_0x070e('0xe8')));};Preview[_0x070e('0xc')][_0x070e('0x88')]=function(_0x2e21cf,_0x34b5ae,_0x5605da){return cmHopperAdditionalPhone[_0x070e('0x88')](_0x2e21cf,_0x34b5ae,_0x5605da)[_0x070e('0x46')](logger['info'](_0x070e('0xe9')));};Preview['prototype']['incrementPreviewCounters']=function(_0x48b0aa){return Promise[_0x070e('0xea')]()[_0x070e('0x5b')](cmHopperAdditionalPhone[_0x070e('0x87')](_0x48b0aa))[_0x070e('0x46')](logger['info'](_0x070e('0xeb')));};Preview[_0x070e('0xc')]['checkInBlack']=function(_0x3c6a6e,_0xa9694a,_0x24448e,_0x41afe5,_0x4ea0a6){var _0x445182=this;return new Promise(function(_0x50fbb4,_0x40ff1b){if(_['isNil'](_0xa9694a)||_[_0x070e('0x54')](_0xa9694a[_0x070e('0xec')])||_[_0x070e('0x54')](_0xa9694a['phone'])||_[_0x070e('0x54')](_0xa9694a[_0x070e('0x43')])){_0x40ff1b(ut[_0x070e('0x47')]('Contact\x20is\x20undefined',_0x41afe5,_0x4ea0a6));return;}var _0xbaed32=uuid['v4']();var _0x3a5086=_0x445182['campaignsPreview'][_0xa9694a[_0x070e('0x3f')][_0x070e('0x26')]];var _0x478e5b=_0x24448e?_0x445182['agents'][_0x24448e]['id']:undefined;_0x445182['actions'][_0xbaed32]=new Action(_0xa9694a,_0x3a5086,_0xbaed32,_0x24448e,_0x478e5b);var _0x5e1fee=_0x445182[_0x070e('0x13')][_0xbaed32];_0x5e1fee[_0x070e('0x84')]=_0x41afe5;_0x5e1fee[_0x070e('0xac')]=_0x4ea0a6;_0x5e1fee[_0x070e('0xed')]=_0x24448e;if(_[_0x070e('0xee')](_0x3c6a6e)){_0x445182[_0x070e('0xef')](_0x5e1fee,_0x3a5086,_0xa9694a,_0x24448e)[_0x070e('0x5b')](function(_0x472fc9){logger['info']('[Preview][execCall][success]','Queue:\x20'+_0x5e1fee['queue']+_0x070e('0xf0')+_0x5e1fee[_0x070e('0x86')],JSON[_0x070e('0x23')](_0x472fc9));ami[_0x070e('0x21')](_0x070e('0xf1'),ut['buildObj'](_0x5e1fee,'called',_0x445182[_0x070e('0x10')][_0x5e1fee[_0x070e('0x40')]]));_0x50fbb4(ut['message'](_0x070e('0xf2')));})[_0x070e('0x46')](function(_0x239385){ut[_0x070e('0x2e')](_0x070e('0xf3'),_0x239385);_0x40ff1b(ut[_0x070e('0x47')]('Call\x20failed',_0x41afe5,_0x4ea0a6));});}else{_0x3a5086[_0x070e('0xf4')]+=0x1;ut[_0x070e('0xf5')](_0x5e1fee);rpcDb[_0x070e('0xf6')](_0x5e1fee,'[Blacklist][error]');delete _0x445182[_0x070e('0x13')][_0xbaed32];_0x40ff1b(ut[_0x070e('0x47')](_0x070e('0xf7'),_0x41afe5,_0x4ea0a6));}});};Preview[_0x070e('0xc')]['isTrunkReachable']=function(_0x4175b9){return!_[_0x070e('0x54')](_0x4175b9)&&!_['isNil'](_0x4175b9[_0x070e('0x26')])&&!_[_0x070e('0x54')](_0x4175b9['active'])&&_0x4175b9[_0x070e('0xf8')]&&!_['isNil'](this[_0x070e('0x12')][util['format'](_0x070e('0xf9'),_0x4175b9['name'])])&&!_['isNil'](this[_0x070e('0x12')][util['format']('SIP/%s',_0x4175b9[_0x070e('0x26')])][_0x070e('0x45')])&&(this[_0x070e('0x12')][util[_0x070e('0x24')](_0x070e('0xf9'),_0x4175b9['name'])][_0x070e('0x45')]===_0x070e('0xfa')||this[_0x070e('0x12')][util[_0x070e('0x24')](_0x070e('0xf9'),_0x4175b9[_0x070e('0x26')])]['status']===_0x070e('0xfb'));};Preview[_0x070e('0xc')][_0x070e('0x5a')]=function(_0x44c780,_0x5817a0){return this['execRun'](_0x44c780,_0x5817a0)[_0x070e('0x5b')](function(_0x324641){return _[_0x070e('0x41')](_0x324641,[_0x070e('0x47')]);})[_0x070e('0x46')](function(_0x150ff2){if(_0x150ff2['unlock']){rpcDb[_0x070e('0xfc')](_0x44c780);}if(_0x150ff2[_0x070e('0xf8')]){rpcDb[_0x070e('0x5e')](_0x44c780);}throw _[_0x070e('0x41')](_0x150ff2,[_0x070e('0x47')]);});};Preview[_0x070e('0xc')]['execRun']=function(_0x4aabc3,_0x9b1fb1){var _0x43e514=this;var _0x193c72,_0x150bfb;return rpcDb[_0x070e('0xfd')](_0x4aabc3)[_0x070e('0x5b')](function(_0x257569){if(!_['isNil'](_0x257569[0x0])){_0x150bfb=_0x257569[0x0][_0x070e('0xfe')]?![]:!![];_0x193c72=_0x257569[0x0]['recallme']?!![]:![];_0x193c72=_0x9b1fb1?!![]:_0x193c72;}var _0xfe12a6=_0x43e514['validateContact'](_0x257569);if(_0xfe12a6['isValid']){rpcDb['checkIsBlackList'](_[_0x070e('0x41')](_0x257569[0x0],[_0x070e('0x43'),_0x070e('0xff')]))[_0x070e('0x5b')](function(_0xec8bee){_0x43e514[_0x070e('0x100')](_0xec8bee,_0x257569[0x0],_0x9b1fb1,_0x150bfb,_0x193c72)[_0x070e('0x5b')](function(_0x37285d){return _0x37285d;})[_0x070e('0x46')](function(_0x538bd4){throw _0x538bd4;});})[_0x070e('0x46')](function(_0x170efa){ut[_0x070e('0x2e')](_0x070e('0x101'),_0x170efa);throw ut[_0x070e('0x47')](_0x070e('0x102'),_0x150bfb,_0x193c72);});}else{throw ut[_0x070e('0x47')](_0xfe12a6[_0x070e('0x47')],_0x150bfb,_0x193c72);}})[_0x070e('0x46')](function(_0x4ad025){ut['logger'](_0x070e('0x103'),_0x4ad025);throw ut[_0x070e('0x47')]('Call\x20unsuccessful',![],!![]);});};Preview[_0x070e('0xc')]['validateContact']=function(_0x48d26c){if(_[_0x070e('0x54')](_0x48d26c)||_[_0x070e('0xee')](_0x48d26c)||!_['isNil'](_0x48d26c[0x0][_0x070e('0x58')])&&_[_0x070e('0x54')](_0x48d26c[0x0][_0x070e('0x58')]['name'])){ut['logger'](_0x070e('0x104'),_0x48d26c);return{'isValid':![],'message':_0x070e('0x105')};}var _0x21d392=this['campaignsPreview'][_0x48d26c[0x0][_0x070e('0x3f')][_0x070e('0x26')]];_0x21d392['message']=utils[_0x070e('0x31')][_0x070e('0x71')];if(_[_0x070e('0x54')](_0x21d392)){ut[_0x070e('0x2e')](_0x070e('0x106'),_0x21d392);return{'isValid':![],'message':_0x070e('0x107')};}if(!this[_0x070e('0x6e')](_0x21d392[_0x070e('0x6f')])){ut[_0x070e('0x2e')](_0x070e('0x108'),_0x070e('0x109')+_0x21d392[_0x070e('0x26')]+_0x070e('0x10a'));if(!this[_0x070e('0x6e')](_0x21d392[_0x070e('0x70')])){ut[_0x070e('0x2e')](_0x070e('0x108'),_0x21d392['name']+'\x20Trunk\x20Backup\x20is\x20not\x20active');return{'isValid':![],'message':'Trunk\x20not\x20working\x20correctly'};}}if(!ut['isActive'](_0x21d392[_0x070e('0x6d')])){ut[_0x070e('0x2e')](_0x070e('0x10b'),_0x21d392['name']+_0x070e('0x10c'));return{'isValid':![],'message':_0x070e('0x109')+_0x21d392[_0x070e('0x26')]+'\x20Not\x20Active'};}return{'isValid':!![],'message':_0x070e('0x10d')};};Preview[_0x070e('0xc')][_0x070e('0xef')]=function(_0x3ef1b3,_0x526afc,_0x7f803a,_0x3967bd){var _0x4717de=this;return new Promise(function(_0x4fde12,_0xcd40c1){var _0x417350=_0x3ef1b3[_0x070e('0x8d')];var _0x220cc9=_0x4717de[_0x070e('0x6e')](_0x526afc[_0x070e('0x6f')])?util[_0x070e('0x24')](_0x070e('0x10e'),_0x526afc[_0x070e('0x6f')]['name'],_['isNil'](_0x526afc[_0x070e('0x10f')])?'':_0x526afc['dialPrefix']['trim']()||'',_0x526afc[_0x070e('0x110')]>0x0?_0x7f803a[_0x070e('0xff')][_0x070e('0x111')](_0x526afc[_0x070e('0x110')]):_0x7f803a[_0x070e('0xff')]):util[_0x070e('0x24')]('SIP/%s/%s%s',_[_0x070e('0x54')](_0x526afc[_0x070e('0x70')])?_0x526afc[_0x070e('0x6f')][_0x070e('0x26')]:_0x526afc['TrunkBackup'][_0x070e('0x26')],_['isNil'](_0x526afc[_0x070e('0x10f')])?'':_0x526afc[_0x070e('0x10f')][_0x070e('0x112')]()||'',_0x526afc[_0x070e('0x110')]>0x0?_0x7f803a[_0x070e('0xff')][_0x070e('0x111')](_0x526afc[_0x070e('0x110')]):_0x7f803a[_0x070e('0xff')]);var _0x2b4e74=_0x4717de['isTrunkReachable'](_0x526afc[_0x070e('0x6f')])?ut[_0x070e('0x113')](_0x526afc[_0x070e('0x6f')][_0x070e('0x114')],_0x526afc[_0x070e('0x115')],_0x526afc[_0x070e('0x116')]>0x0?ut[_0x070e('0x117')](_0x526afc[_0x070e('0x118')],_0x526afc['dialRandomLastDigitCallerIdNumber']):_0x526afc[_0x070e('0x118')]):ut[_0x070e('0x113')](_['isNil'](_0x526afc['TrunkBackup'])?_0x526afc[_0x070e('0x6f')][_0x070e('0x114')]:_0x526afc[_0x070e('0x70')][_0x070e('0x114')],_0x526afc[_0x070e('0x115')],_0x526afc[_0x070e('0x116')]>0x0?ut['getCallerIdRandom'](_0x526afc['dialOriginateCallerIdNumber'],_0x526afc[_0x070e('0x116')]):_0x526afc[_0x070e('0x118')]);if(_0x2b4e74){_0x3ef1b3['originatecalleridname']=ut[_0x070e('0x119')](_0x2b4e74);_0x3ef1b3['originatecalleridnum']=ut[_0x070e('0x11a')](_0x2b4e74);}var _0xa2c957=ut['addVariables'](_0x526afc,_0x7f803a,_0x220cc9,_0x2b4e74,_0x417350,_0x3ef1b3);_[_0x070e('0x11b')](_0x3ef1b3,ut[_0x070e('0x11c')](_0xa2c957));_0x3ef1b3['starttime']=moment()['format'](_0x070e('0x60'));_0x526afc['variables']=_0xa2c957;var _0x1ebec9=ut[_0x070e('0x11d')](_0x3ef1b3,_0x526afc,_0xa2c957,_0x3ef1b3[_0x070e('0xac')],_0x3967bd);return ami['Action'](_0x1ebec9)[_0x070e('0x5b')](function(_0x17adf3){_0x526afc['originated']+=0x1;logger[_0x070e('0x22')](_0x070e('0x11e'),_0x417350,_0x070e('0x8e'),_0x526afc[_0x070e('0x26')],_0x070e('0xd9'),_0x526afc[_0x070e('0x29')]);_0x4fde12(_0x17adf3);})[_0x070e('0x46')](function(_0x358e1b){ut[_0x070e('0xdd')](_0x3ef1b3,0xe,_0x070e('0x11f'));rpcDb['createAgentHistory'](_0x3ef1b3,_0x070e('0x120'));_0xcd40c1(_0x358e1b);});});};Preview[_0x070e('0xc')][_0x070e('0x1b')]=function(_0x52d89d){if(this['actions'][_0x52d89d[_0x070e('0x9f')]]){this[_0x070e('0x13')][_0x52d89d[_0x070e('0x9f')]][_0x070e('0x121')]=_0x52d89d['channel'];}};Preview[_0x070e('0xc')]['syncOriginateResponse']=function(_0x5044e8){var _0x1a1851=this;var _0x52ca6c=this[_0x070e('0x13')][_0x5044e8[_0x070e('0x122')]];if(_0x52ca6c){if(_0x52ca6c[_0x070e('0xed')]&&this[_0x070e('0x53')][_0x52ca6c['lookAgent']]){ut[_0x070e('0x123')](_0x52ca6c,this['agents'][_0x52ca6c[_0x070e('0xed')]][_0x070e('0x26')],this[_0x070e('0x53')][_0x52ca6c[_0x070e('0xed')]]['id']);}var _0x475774=_[_0x070e('0x124')](_0x52ca6c);_0x475774[_0x070e('0x8a')]=moment()[_0x070e('0x24')](_0x070e('0x60'));var _0xf8cfd=_0x1a1851[_0x070e('0x10')][_0x52ca6c[_0x070e('0x40')]];if(ut[_0x070e('0x125')](_0x5044e8[_0x070e('0x126')])){if(_0x52ca6c[_0x070e('0x84')]){rpcDb[_0x070e('0xfc')](_0x52ca6c['idContact']);}if(_0x52ca6c['activeContact']){rpcDb[_0x070e('0x5e')](_0x52ca6c[_0x070e('0x86')]);}ami['emit'](_0x070e('0x127'),ut[_0x070e('0x79')](_0x52ca6c,'rejected',this[_0x070e('0x10')][_0x52ca6c[_0x070e('0x40')]]));this['callProgressDetectingAgent'](_0x475774,_0xf8cfd,_0x5044e8);}else{_0x52ca6c[_0x070e('0x5f')]=moment()[_0x070e('0x24')](_0x070e('0x60'));ut[_0x070e('0xdd')](_0x475774,0x4,_0x070e('0x99'));rpcDb[_0x070e('0xe0')](_0x475774,'[callProgressDetectingAgent][logAnswer]');}}};Preview[_0x070e('0xc')][_0x070e('0x16')]=function(_0x275767){var _0x4f33d8=this[_0x070e('0x13')][_0x275767[_0x070e('0x9f')]];var _0xe50bad;if(_0x4f33d8){_0xe50bad=this[_0x070e('0x10')][_0x4f33d8['queue']];logger['info'](_0x070e('0x128'),_0x275767[_0x070e('0x9f')],_0x070e('0x8e'),_0xe50bad[_0x070e('0x26')],_0x070e('0x8f'),_0xe50bad[_0x070e('0x2a')]);}if(this[_0x070e('0x13')][_0x275767['linkedid']]&&_0x275767[_0x070e('0x9f')]!==_0x275767[_0x070e('0x8d')]){if(_0x275767[_0x070e('0x129')]==='16'&&this[_0x070e('0x13')][_0x275767[_0x070e('0x9f')]][_0x070e('0x4a')]){this[_0x070e('0x72')](_0x275767,_0x275767[_0x070e('0x9f')],_0x275767[_0x070e('0x129')]);}else if(this[_0x070e('0x13')][_0x275767[_0x070e('0x9f')]][_0x070e('0x4a')]){logger[_0x070e('0x22')](_0x070e('0x12a'),_0x275767[_0x070e('0x9f')],_0x275767['cause'],_0x070e('0x8e'),_0xe50bad[_0x070e('0x26')],_0x070e('0x8f'),_0xe50bad[_0x070e('0x2a')]);this[_0x070e('0x72')](_0x275767,_0x275767[_0x070e('0x9f')],_0x275767[_0x070e('0x129')]);}}else if(_0x4f33d8&&_['isNil'](_0x4f33d8[_0x070e('0x12b')])&&_0xe50bad[_0x070e('0x12c')]&&_0x275767[_0x070e('0x9f')]===_0x275767[_0x070e('0x8d')]&&_[_0x070e('0x54')](_0x275767[_0x070e('0xe5')])&&_0x275767[_0x070e('0x129')]==='16'&&_0x275767[_0x070e('0x12d')]==='6'&&_[_0x070e('0xdb')](_0x4f33d8['transfer'])){if(_0x4f33d8[_0x070e('0x84')]){rpcDb[_0x070e('0xfc')](_0x4f33d8[_0x070e('0x86')]);}if(_0x4f33d8[_0x070e('0xac')]){rpcDb[_0x070e('0x5e')](_0x4f33d8[_0x070e('0x86')]);}_0x275767[_0x070e('0xe5')]='22';this[_0x070e('0x12e')](_0x4f33d8,_0xe50bad,_0x275767);}else if(_0x4f33d8&&_0x4f33d8[_0x070e('0x12f')]){if(_0x275767[_0x070e('0x129')]==='16'&&this[_0x070e('0x13')][_0x275767[_0x070e('0x9f')]][_0x070e('0x4a')]){logger[_0x070e('0x22')](_0x070e('0x130'),_0x275767[_0x070e('0x9f')],_0x275767[_0x070e('0x129')],_0x070e('0x8e'),_0xe50bad[_0x070e('0x26')],_0x070e('0x8f'),_0xe50bad[_0x070e('0x2a')]);this[_0x070e('0x72')](_0x275767,_0x275767['linkedid'],_0x275767[_0x070e('0x129')]);}else if(this[_0x070e('0x13')][_0x275767[_0x070e('0x9f')]][_0x070e('0x4a')]){logger['info'](_0x070e('0x12a'),_0x275767['linkedid'],_0x275767[_0x070e('0x129')],'\x20Queue',_0xe50bad['name'],_0x070e('0x8f'),_0xe50bad[_0x070e('0x2a')]);this[_0x070e('0x72')](_0x275767,_0x275767['linkedid'],_0x275767[_0x070e('0x129')]);}}};Preview['prototype'][_0x070e('0x1a')]=function(_0x1e0e55){if(this['actions'][_0x1e0e55[_0x070e('0x131')]]&&_0x1e0e55['destlinkedid']!==_0x1e0e55[_0x070e('0x132')]){this[_0x070e('0x72')](_0x1e0e55,_0x1e0e55[_0x070e('0x131')],_0x1e0e55['dialstatus']);}};Preview['prototype'][_0x070e('0x17')]=function(_0x4bed29){if(this[_0x070e('0x13')][_0x4bed29[_0x070e('0x9f')]]&&_0x4bed29[_0x070e('0x9f')]!==_0x4bed29[_0x070e('0x8d')]&&!this[_0x070e('0x13')][_0x4bed29[_0x070e('0x9f')]]['dialAnswer']){if(_0x4bed29['cause']==='1'){this[_0x070e('0x72')](_0x4bed29,_0x4bed29['linkedid'],_0x4bed29['cause']);}}};Preview[_0x070e('0xc')][_0x070e('0x133')]=function(_0x3c8b7d,_0x5ddf05,_0x241d86){if(this[_0x070e('0x13')][_0x3c8b7d]){if(_[_0x070e('0x54')](this['actions'][_0x3c8b7d]['variables'])){this[_0x070e('0x13')][_0x3c8b7d][_0x070e('0x134')]={};}this[_0x070e('0x13')][_0x3c8b7d]['variables'][_0x5ddf05]=_0x241d86;}};Preview[_0x070e('0xc')]['syncVarSet']=function(_0x2e9263){try{if(!_['isNil'](_0x2e9263)){if(ut[_0x070e('0x135')](_[_0x070e('0x136')](_0x2e9263['variable'])[0x0])){this[_0x070e('0x133')](_0x2e9263[_0x070e('0x8d')],_[_0x070e('0x136')](_0x2e9263[_0x070e('0x137')])[0x0],_0x2e9263[_0x070e('0x138')]);}}}catch(_0xd6529a){logger[_0x070e('0x139')](_0x070e('0x13a'),util[_0x070e('0x13b')](_0xd6529a,{'showHidden':![],'depth':null}));}};Preview[_0x070e('0xc')][_0x070e('0x1e')]=function(_0x10b168){if(_0x10b168){if(this[_0x070e('0x13')][_0x10b168['transfertargetlinkedid']]){this[_0x070e('0x13')][_0x10b168[_0x070e('0x13c')]][_0x070e('0x12f')]=!![];}}};Preview['prototype']['syncBlindTransfer']=function(_0x38afa3){if(_0x38afa3){if(this[_0x070e('0x13')][_0x38afa3['transfererlinkedid']]){this[_0x070e('0x13')][_0x38afa3[_0x070e('0x13d')]][_0x070e('0x12f')]=!![];}}};module['exports']=Preview; \ No newline at end of file +var _0x54ef=['DEACTIVATED','\x20is\x20deactivated','syncCampaigns','campaignsPreview','hasOwnProperty','dialMethod','booked','type','clearZombieChannels','outbound','recallMe','clearZombieChannel','[clearZombieChannels][talking]','queue','originated:\x20','pTalking:\x20','dialAnswer','pick','contactId','UserId','VoiceQueueId','ListId','Action','status','channel','catch','No\x20such\x20channel','updateOriginated','loggerError','[Dialer][checkChannel][pTalking][Preview]','[Dialer][checkChannel][Preview]','[action]','size','getContactRecallMe','agentReadyId','then','length','getDiff','scheduledat','Agent','run','logger2','[RecallMe]','disableContact','starttime','YYYY-MM-DD\x20HH:mm:ss','outboundReCallsDay','logCustomer','RecallInQueue','dialRecallInQueue','rescheduleContactInQueue','createBody','createCustomerHistory','[HistoryDialRecallInQueue][historyCatch]','RecallFailedTimeout','[HistoryRecallClose]','createCustomerFinal','[getContactRecallMe]','setMessage','IsNotLoggedIn','loggedIn','NO_AGENTS_LOGGED','dialActive','isTrunkReachable','Trunk','UNREACHABLE_TRUNK','ACTIVE','callProgressDetectingCustomer','outboundNoSuchCallsDay','countglobal','totalGlobal','NoSuchNumber','custom:agentnosuchnumber','[callProgressDetectingCustomer][logNoSuch]','dialNoSuchNumberRetryFrequency','callAdditionalPhoneAfterMin','dialGlobalMaxRetry','cloneAction','Global','[callProgressDetectingCustomer][logNoSuchGlobal]','countnosuchnumberretry','dialNoSuchNumberMaxRetry','rescheduleContact','scheduledAt','unlockAgent','activeContact','linkedid','actioncountonusuch','idContact','swapAdditionalPhones','ANSWER','responsetime','[syncHangup][talking][increment]','\x20Queue','custom:agentconnect','buildObj','custom:agentConnectPreview','custom:agentcomplete','complete','total','answered','decrementTalkink','[16]','Answer','[callProgressDetectingCustomer][logAnswer]','crateCustomerReportQueue','sumDuration','talktime','[syncHangup][talking][decrement]','uniqueid','BUSY','countbusyretry','custom:agentbusy','busy','[callProgressDetectingCustomer][logBusy]','verifyAdditionalPhones','[callProgressDetectingCustomer][logBusyGlobal]','dialBusyMaxRetry','incrementPreviewCounters','NOANSWER','countnoanswerretry','NoAnswer','dialNoAnswerRetryFrequency','buildNoAnswerEventPayload','custom:agentnoanswer','[callProgressDetectingCustomer][logNoAnswerGlobal]','dialNoAnswerMaxRetry','CONGESTION','outboundCongestionCallsDay','countcongestionretry','Congestion','dialCongestionRetryFrequency','custom:agentcongestion','congestion','[callProgressDetectingCustomer][logCongestion]','additional','[callProgressDetectingCustomer][logCongestionGlobal]','dialBusyRetryFrequency','outboundRejectCallsDay','AgentReject','dialAgentRejectRetryFrequency','custom:agentreject','agentreject','[syncHangupRequest][logAgentReject]','[callProgressDetectingCustomer][logAgentReject]','countagentrejectretry','dialAgentRejectMaxRetry','ABANDONED','outboundAbandonedCallsDay','countabandonedretry','Abandoned','[callProgressDetectingCustomer][logAbandoned]','countabandonedetry','dialAbandonedMaxRety','outboundUnknownCallsDay','cause-txt','amd','[callProgressDetectingCustomer][hangupInAMD]','dialstatus','custom:amd','[callProgressDetectingCustomer][machine]','[default]','[Dialer][decrementTalkink][no\x20Hangup][Preview]','[callProgressDetectingCustomer][logUnknownGlobal]','[callProgressDetectingCustomer]','[originated][decrement][callProgressDetectingCustomer]','destlinkedid','queueSummaryCountersUpdated','callProgressDetectingAgent','object','isUndefined','reason','logAgent','createAgentHistory','[callProgressDetectingAgent][logNoSuch]','[callProgressDetectingAgent][logNoAnswer]','Busy','[callProgressDetectingAgent][logBusy]','[callProgressDetectingAgent][logCongestion]','AnswerAGI','[callProgressDetectingAgent][logAnswerAGI]','[callProgressDetectingAgent]','[verifyAdditionalPhone]\x20','[swapAdditionalPhone]\x20','resolve','isNil','Contact\x20is\x20undefined','lookAgent','isEmpty','execCall','[Preview][execCall][success]','Queue:\x20','\x20IdHopper:\x20','called','Calling','Call\x20failed','outboundBlacklistCallsDay','createHistory','[Blacklist][error]','Contact\x20in\x20black\x20List','active','trunks','SIP/%s','reachable','unmonitored','execRun','unlock','unlockContact','getContactPreview','recallme','validateContact','isValid','checkIsBlackList','phone','checkInBlack','[Preview][checkIsBlackList]','Call\x20unsuccessful','[Preview][validateContact][Empty\x20Contact]','Empty\x20Contact','Queue','[Preview][validateContact][Empty\x20Campaign]','Empty\x20Campaign','[Preview][validateContact][Trunk\x20not\x20working\x20correctly]','campaign\x20Name:\x20','\x20Trunk\x20is\x20not\x20active','TrunkBackup','\x20Trunk\x20Backup\x20is\x20not\x20active','Trunk\x20not\x20working\x20correctly','isActive','[Preview][validateContact][Campaign\x20Active]','\x20Not\x20Active','SIP/%s/%s%s','dialPrefix','trim','substring','dialCutDigit','getCallerId','callerid','dialOriginateCallerIdName','dialRandomLastDigitCallerIdNumber','getCallerIdRandom','dialOriginateCallerIdNumber','originatecalleridname','extractCalleridName','extractCalleridNumber','addVariables','merge','variablesAction','[originateFailure][logOriginateFailure]','logLookAgent','clone','response','custom:agentringnoanswer','rejected','[callProgressDetectingAgent][logAnswer]','[syncHangup][talking]','cause','[syncHangup][talking][cause]','statedesc','dialQueueProject','[syncHangup][talking][transfer]','syncDialEnd','destuniqueid','addVariable','variables','filterKey','keys','variable','error','transfertargetlinkedid','transfer','syncBlindTransfer','transfererlinkedid','exports','util','lodash','uuid','ioredis','../../../config/environment','../../../config/logger','preview','actionPreview','../ami','./action','./util/util','../dialer/utils','defaults','localhost','socket.io-emitter','prototype','enqueue','tail','finally','sequence','voiceQueues','actions','agents','clockClearZombieChannels','syncOriginateResponse','bind','hangup','syncHangup','hanguprequest','syncHangupRequest','newexten','syncNewExten','varset','syncVarSet','attendedtransfer','syncAttendedTransfer','blindtransfer','loopCampaigns','emit','info','[DEBUG]\x20Emit\x20voice_queue_channel:remove\x20event','stringify','format','voice:queue:%s','name','sendMessageOneNotActive','originated','pTalking','available','paused','message','CAMPAIGN_STATUS','INACTIVE','logger','[CampaignPreview]\x20Campaign\x20Queue:\x20'];(function(_0x7ee0c5,_0x58a773){var _0x557583=function(_0x19433e){while(--_0x19433e){_0x7ee0c5['push'](_0x7ee0c5['shift']());}};_0x557583(++_0x58a773);}(_0x54ef,0x112));var _0xf54e=function(_0x5f03f0,_0x4d4dca){_0x5f03f0=_0x5f03f0-0x0;var _0x11a08d=_0x54ef[_0x5f03f0];return _0x11a08d;};'use strict';var util=require(_0xf54e('0x0'));var _=require(_0xf54e('0x1'));var uuid=require(_0xf54e('0x2'));var moment=require('moment');var Redis=require(_0xf54e('0x3'));var config=require(_0xf54e('0x4'));var logger=require(_0xf54e('0x5'))(_0xf54e('0x6'));var loggerAction=require(_0xf54e('0x5'))(_0xf54e('0x7'));var ami=require(_0xf54e('0x8'));var rpcDb=require('./rpcDb');var cmHopperAdditionalPhone=require('../rpc/cmHopperAdditionalPhone');var Action=require(_0xf54e('0x9'));var ut=require(_0xf54e('0xa'));var utils=require(_0xf54e('0xb'));config['redis']=_[_0xf54e('0xc')](config['redis'],{'host':_0xf54e('0xd'),'port':0x18eb});var io=require(_0xf54e('0xe'))(new Redis(config['redis']));var Sequence=function(){};Sequence[_0xf54e('0xf')][_0xf54e('0x10')]=function(_0x6b9e61){this[_0xf54e('0x11')]=this['tail']?this[_0xf54e('0x11')][_0xf54e('0x12')](_0x6b9e61):_0x6b9e61();};function Preview(_0x143d66){this[_0xf54e('0x13')]=new Sequence();this['campaignsPreview']=_0x143d66[_0xf54e('0x14')];this['trunks']=_0x143d66['trunks'];this[_0xf54e('0x15')]={};this[_0xf54e('0x16')]=_0x143d66[_0xf54e('0x16')];this[_0xf54e('0x17')]=0x0;ami['on']('originateresponse',this[_0xf54e('0x18')][_0xf54e('0x19')](this));ami['on'](_0xf54e('0x1a'),this[_0xf54e('0x1b')]['bind'](this));ami['on'](_0xf54e('0x1c'),this[_0xf54e('0x1d')][_0xf54e('0x19')](this));ami['on']('dialend',this['syncDialEnd'][_0xf54e('0x19')](this));ami['on'](_0xf54e('0x1e'),this[_0xf54e('0x1f')][_0xf54e('0x19')](this));ami['on'](_0xf54e('0x20'),this[_0xf54e('0x21')][_0xf54e('0x19')](this));ami['on'](_0xf54e('0x22'),this[_0xf54e('0x23')][_0xf54e('0x19')](this));ami['on'](_0xf54e('0x24'),this['syncBlindTransfer']['bind'](this));this[_0xf54e('0x25')](this['campaignsPreview']);}function emit(_0x3e1556,_0x1bfe99,_0x106362){io['to'](_0x3e1556)[_0xf54e('0x26')](_0x1bfe99,_0x106362);}function emitVoiceQueueChannelRemove(_0xf64f12){logger[_0xf54e('0x27')](_0xf54e('0x28'),JSON[_0xf54e('0x29')](_0xf64f12));emit(util[_0xf54e('0x2a')](_0xf54e('0x2b'),_0xf64f12[_0xf54e('0x2c')]),'voice_queue_channel:remove',_0xf64f12);io[_0xf54e('0x26')]('voice_queue_presence:remove',_0xf64f12);}function notSendMessagesQueue(_0x264a8f){if(_0x264a8f[_0xf54e('0x2d')]){if(_0x264a8f[_0xf54e('0x2e')]===0x0&&_0x264a8f[_0xf54e('0x2f')]===0x0){_0x264a8f[_0xf54e('0x2d')]=![];_0x264a8f[_0xf54e('0x30')]=0x0;_0x264a8f[_0xf54e('0x31')]=0x0;_0x264a8f[_0xf54e('0x32')]=utils[_0xf54e('0x33')][_0xf54e('0x34')];ut[_0xf54e('0x35')](_0xf54e('0x36'),_0x264a8f[_0xf54e('0x2c')]+'\x20is\x20not\x20active');}else{_0x264a8f[_0xf54e('0x32')]=utils['CAMPAIGN_STATUS'][_0xf54e('0x37')];ut['logger'](_0xf54e('0x36'),_0x264a8f[_0xf54e('0x2c')]+_0xf54e('0x38'));}}}Preview[_0xf54e('0xf')][_0xf54e('0x25')]=function(){var _0x3993e4=this;setInterval(function(){_0x3993e4[_0xf54e('0x39')]();},0x7cf);};Preview['prototype']['syncCampaigns']=function(){var _0x2f96b1=this[_0xf54e('0x3a')];this[_0xf54e('0x17')]+=0x1;for(var _0x16d00f in _0x2f96b1){if(_0x2f96b1[_0xf54e('0x3b')](_0x16d00f)&&(_0x2f96b1[_0x16d00f][_0xf54e('0x3c')]===_0xf54e('0x6')||_0x2f96b1[_0x16d00f][_0xf54e('0x3c')]===_0xf54e('0x3d'))&&_0x2f96b1[_0x16d00f][_0xf54e('0x3e')]==='outbound'){if(this['clockClearZombieChannels']>0x7){this[_0xf54e('0x17')]=0x0;this[_0xf54e('0x3f')]();}}if(_0x2f96b1['hasOwnProperty'](_0x16d00f)&&_0x2f96b1[_0x16d00f][_0xf54e('0x3c')]===_0xf54e('0x6')&&_0x2f96b1[_0x16d00f][_0xf54e('0x3e')]===_0xf54e('0x40')){if(_0x2f96b1[_0x16d00f]['dialActive']){this['setMessage'](_0x2f96b1[_0x16d00f]);if(_0x2f96b1[_0x16d00f]['dialPreviewAutoRecallMe'])this[_0xf54e('0x41')](_0x2f96b1[_0x16d00f]);}else{notSendMessagesQueue(_0x2f96b1[_0x16d00f]);}}}};Preview[_0xf54e('0xf')][_0xf54e('0x42')]=function(_0x399e68){var _0x29dc39=this;this[_0xf54e('0x13')]['enqueue'](function(){if(!_['isNil'](_0x29dc39['actions'][_0x399e68])){loggerAction[_0xf54e('0x27')](_0xf54e('0x43'),_0x399e68,'Queue',_0x29dc39['actions'][_0x399e68][_0xf54e('0x44')],_0xf54e('0x45'),JSON[_0xf54e('0x29')](_0x29dc39['campaignsPreview'][_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x44')]]['originated']),_0xf54e('0x46'),JSON[_0xf54e('0x29')](_0x29dc39[_0xf54e('0x3a')][_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x44')]][_0xf54e('0x2f')]),JSON['stringify'](_0x29dc39['actions'][_0x399e68][_0xf54e('0x47')]),JSON[_0xf54e('0x29')](_[_0xf54e('0x48')](_0x29dc39['actions'][_0x399e68],[_0xf54e('0x49'),_0xf54e('0x4a'),_0xf54e('0x4b'),_0xf54e('0x4c')])));return ami[_0xf54e('0x4d')]({'action':_0xf54e('0x4e'),'channel':_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x4f')]})[_0xf54e('0x50')](function(_0x2087b3){if(_0x2087b3[_0xf54e('0x32')]===_0xf54e('0x51')){setTimeout(function(){if(_0x29dc39[_0xf54e('0x15')][_0x399e68]){ut[_0xf54e('0x52')](_0x29dc39[_0xf54e('0x3a')][_0x29dc39['actions'][_0x399e68]['queue']],'[clearZombieChannel]');if(_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x47')]===!![]){ut['decrementTalkink'](_0x29dc39[_0xf54e('0x3a')][_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x44')]],'[clearZombieChannel]');ut[_0xf54e('0x53')](_0xf54e('0x54')+_0x399e68,_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x44')]);}ut[_0xf54e('0x53')](_0xf54e('0x55')+_0x399e68,_0x29dc39[_0xf54e('0x15')][_0x399e68][_0xf54e('0x44')]);delete _0x29dc39[_0xf54e('0x15')][_0x399e68];}},0x2328);}});}});};Preview['prototype'][_0xf54e('0x3f')]=function(){var _0x3447fd=this;loggerAction[_0xf54e('0x27')](_0xf54e('0x56'),_[_0xf54e('0x57')](this[_0xf54e('0x15')]));for(var _0x52c47d in this[_0xf54e('0x15')]){if(_0x3447fd['actions'][_0xf54e('0x3b')](_0x52c47d)){_0x3447fd['clearZombieChannel'](_0x52c47d);}}};Preview[_0xf54e('0xf')][_0xf54e('0x41')]=function(_0x2e08b4){var _0x57371d=this;rpcDb[_0xf54e('0x58')](_0x2e08b4['id'],ut[_0xf54e('0x59')](this[_0xf54e('0x16')]))[_0xf54e('0x5a')](function(_0x3a5a87){if(!_['isNil'](_0x3a5a87)){for(var _0x427799=0x0;_0x427799<_0x3a5a87[_0xf54e('0x5b')];_0x427799+=0x1){if(ut[_0xf54e('0x5c')](_0x3a5a87[_0x427799][_0xf54e('0x5d')])<_0x2e08b4['dialRecallMeTimeout']*0x3c){if(_0x3a5a87[_0x427799][_0xf54e('0x5e')]&&!_0x3a5a87[_0x427799][_0xf54e('0x5e')]['voicePause']){_0x57371d[_0xf54e('0x5f')](_0x3a5a87[_0x427799]['id'])[_0xf54e('0x5a')](ut[_0xf54e('0x60')](_0xf54e('0x61')))['catch'](ut[_0xf54e('0x60')](_0xf54e('0x61')));}else{rpcDb[_0xf54e('0x62')](_0x3a5a87[_0x427799]['id']);}}else{var _0xb4654f=new Action(_0x3a5a87[_0x427799],_0x2e08b4);_0xb4654f[_0xf54e('0x63')]=moment()[_0xf54e('0x2a')](_0xf54e('0x64'));_0x2e08b4[_0xf54e('0x65')]+=0x1;ut[_0xf54e('0x66')](_0xb4654f,0x17,_0xf54e('0x67'));if(_0x2e08b4[_0xf54e('0x68')]){rpcDb[_0xf54e('0x69')](ut[_0xf54e('0x6a')](_0x3a5a87[_0x427799]));rpcDb[_0xf54e('0x6b')](_0xb4654f,_0xf54e('0x6c'));}else{ut[_0xf54e('0x66')](_0xb4654f,0x16,_0xf54e('0x6d'));rpcDb[_0xf54e('0x6b')](_0xb4654f,_0xf54e('0x6e'));rpcDb[_0xf54e('0x6f')](_0xb4654f,'[HistoryRecallClose]');}}}}})['catch'](ut[_0xf54e('0x60')](_0xf54e('0x70')));};Preview[_0xf54e('0xf')][_0xf54e('0x71')]=function(_0xba297c){_0xba297c[_0xf54e('0x2d')]=!![];if(ut[_0xf54e('0x72')](_0xba297c[_0xf54e('0x73')])){_0xba297c[_0xf54e('0x32')]=utils[_0xf54e('0x33')][_0xf54e('0x74')];}else if(!ut['isActive'](_0xba297c[_0xf54e('0x75')])){_0xba297c[_0xf54e('0x32')]=utils[_0xf54e('0x33')][_0xf54e('0x34')];}else if(!this[_0xf54e('0x76')](_0xba297c[_0xf54e('0x77')])){if(!this[_0xf54e('0x76')](_0xba297c['TrunkBackup'])){_0xba297c[_0xf54e('0x32')]=utils[_0xf54e('0x33')][_0xf54e('0x78')];}else{_0xba297c['message']=utils[_0xf54e('0x33')]['ACTIVE'];}}else{_0xba297c[_0xf54e('0x32')]=utils[_0xf54e('0x33')][_0xf54e('0x79')];}};Preview['prototype'][_0xf54e('0x7a')]=function(_0x30d10d,_0x2096e5,_0x4e5059){var _0x3744a4=this;var _0x2ec72a=this[_0xf54e('0x15')][_0x2096e5];var _0x55d57f=this['campaignsPreview'][_0x2ec72a[_0xf54e('0x44')]];var _0x9ab4c4;var _0x4f17dd=![];var _0x29743e=0x2;var _0x49fd97=0x3;if(_0x55d57f){switch(_0x4e5059){case'1':_0x55d57f[_0xf54e('0x7b')]+=0x1;_0x2ec72a['countnosuchnumberretry']+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x0,_0xf54e('0x7e'));ami[_0xf54e('0x26')](_0xf54e('0x7f'),ut['buildObj'](_0x2ec72a,'nosuchnumber'));rpcDb[_0xf54e('0x6b')](_0x2ec72a,_0xf54e('0x80'));_0x3744a4['verifyAdditionalPhones'](_0x2ec72a,'0',_0x55d57f)['then'](function(_0x2a5e54){_0x4f17dd=_0x2a5e54['additional']==0x1;_0x29743e=_0x55d57f[_0xf54e('0x81')];_0x49fd97=_0x55d57f[_0xf54e('0x82')];if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f[_0xf54e('0x83')]){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0x86'));}else{if(_0x2ec72a[_0xf54e('0x87')]>=_0x55d57f[_0xf54e('0x88')]){rpcDb[_0xf54e('0x6f')](_0x2ec72a,_0xf54e('0x86'));}else{rpcDb[_0xf54e('0x89')](ut[_0xf54e('0x8a')](_0x2ec72a,'countnosuchnumberretry',_0x55d57f[_0xf54e('0x81')]),_0x2ec72a[_0xf54e('0x8b')],_0x2ec72a[_0xf54e('0x8c')]);}}delete this[_0xf54e('0x15')][_0x30d10d[_0xf54e('0x8d')]];}else{_0x2ec72a['countnosuchnumberretry']++;logger[_0xf54e('0x27')](_0xf54e('0x8e'),_0x2ec72a['countnosuchnumberretry']);logger['info']('id',_0x2ec72a[_0xf54e('0x8f')]);_0x3744a4['incrementPreviewCounters']({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countnosuchnumberretry':_0x2ec72a[_0xf54e('0x87')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)['then'](function(){});});}});break;case _0xf54e('0x91'):var _0x5cdb8c=moment()[_0xf54e('0x2a')](_0xf54e('0x64'));_0x2ec72a[_0xf54e('0x92')]=_0x5cdb8c;_0x2ec72a['answertime']=_0x5cdb8c;_0x2ec72a[_0xf54e('0x47')]=!![];_0x55d57f['pTalking']+=0x1;logger[_0xf54e('0x27')](_0xf54e('0x93'),_0x2ec72a['uniqueid'],_0xf54e('0x94'),_0x55d57f['name'],_0xf54e('0x46'),_0x55d57f[_0xf54e('0x2f')]);ami[_0xf54e('0x26')](_0xf54e('0x95'),ut[_0xf54e('0x96')](_0x2ec72a,'connect',this[_0xf54e('0x3a')][_0x2ec72a[_0xf54e('0x44')]]));if(_0x55d57f['acw']){ami[_0xf54e('0x26')](_0xf54e('0x97'),ut['buildAcw'](_0x2ec72a));}break;case'16':ami[_0xf54e('0x26')](_0xf54e('0x98'),ut[_0xf54e('0x96')](_0x2ec72a,'complete',this[_0xf54e('0x3a')][_0x2ec72a['queue']]));emitVoiceQueueChannelRemove(ut[_0xf54e('0x96')](_0x2ec72a,_0xf54e('0x99')));_0x55d57f['outboundAnswerCallsDay']+=0x1;_0x55d57f[_0xf54e('0x9a')]+=0x1;_0x55d57f[_0xf54e('0x9b')]+=0x1;ut[_0xf54e('0x9c')](_0x55d57f,_0xf54e('0x9d'));_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x4,_0xf54e('0x9e'));rpcDb[_0xf54e('0x6b')](_0x2ec72a,_0xf54e('0x9f'));rpcDb[_0xf54e('0x6f')](_0x2ec72a,'[callProgressDetectingCustomer][logAnswerGlobal]');rpcDb[_0xf54e('0xa0')](_0x2ec72a);_0x55d57f[_0xf54e('0xa1')]+=_0x2ec72a[_0xf54e('0xa2')];_0x55d57f['sumBillable']+=_0x2ec72a[_0xf54e('0xa2')];logger[_0xf54e('0x27')](_0xf54e('0xa3'),_0x2ec72a[_0xf54e('0xa4')],_0xf54e('0x94'),_0x55d57f[_0xf54e('0x2c')],_0xf54e('0x46'),_0x55d57f['pTalking']);delete this[_0xf54e('0x15')][_0x30d10d[_0xf54e('0x8d')]];break;case _0xf54e('0xa5'):_0x55d57f['outboundBusyCallsDay']+=0x1;_0x2ec72a[_0xf54e('0xa6')]+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x5,'Busy');_0x29743e=_0x55d57f['dialBusyRetryFrequency'];_0x49fd97=_0x55d57f[_0xf54e('0x82')];ami[_0xf54e('0x26')](_0xf54e('0xa7'),ut[_0xf54e('0x96')](_0x2ec72a,_0xf54e('0xa8')));rpcDb[_0xf54e('0x6b')](_0x2ec72a,_0xf54e('0xa9'));_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'5',_0x55d57f)[_0xf54e('0x5a')](function(_0x205b47){_0x4f17dd=_0x205b47['additional']==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f[_0xf54e('0x83')]){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb['createCustomerFinal'](_0x9ab4c4,_0xf54e('0xab'));}else{if(_0x2ec72a[_0xf54e('0xa6')]>=_0x55d57f[_0xf54e('0xac')]){rpcDb[_0xf54e('0x6f')](_0x2ec72a,'[callProgressDetectingCustomer][logBusy]');}else{rpcDb[_0xf54e('0x89')](ut[_0xf54e('0x8a')](_0x2ec72a,_0xf54e('0xa6'),_0x55d57f['dialBusyRetryFrequency']),_0x2ec72a['unlockAgent'],_0x2ec72a[_0xf54e('0x8c')]);}}}else{_0x2ec72a[_0xf54e('0xa6')]++;_0x3744a4[_0xf54e('0xad')]({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countbusyretry':_0x2ec72a[_0xf54e('0xa6')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});break;case _0xf54e('0xae'):_0x55d57f['outboundNoAnswerCallsDay']+=0x1;_0x2ec72a[_0xf54e('0xaf')]+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x3,_0xf54e('0xb0'));_0x29743e=_0x55d57f[_0xf54e('0xb1')];_0x49fd97=_0x55d57f[_0xf54e('0x82')];var _0x9a8f4f=ut[_0xf54e('0xb2')](_0x2ec72a,_0x55d57f);ami[_0xf54e('0x26')](_0xf54e('0xb3'),_0x9a8f4f);rpcDb[_0xf54e('0x6b')](_0x2ec72a,'[callProgressDetectingCustomer][logNoAnswer]');_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'3',_0x55d57f)[_0xf54e('0x5a')](function(_0x59acbc){_0x4f17dd=_0x59acbc['additional']==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f[_0xf54e('0x83')]){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0xb4'));}else{if(_0x2ec72a[_0xf54e('0xaf')]>=_0x55d57f[_0xf54e('0xb5')]){rpcDb[_0xf54e('0x6f')](_0x2ec72a,'[callProgressDetectingCustomer][logNoAnswer]');}else{rpcDb[_0xf54e('0x89')](ut[_0xf54e('0x8a')](_0x2ec72a,_0xf54e('0xaf'),_0x55d57f['dialNoAnswerRetryFrequency']),_0x2ec72a[_0xf54e('0x8b')],_0x2ec72a['activeContact']);}}}else{_0x2ec72a[_0xf54e('0xaf')]++;_0x3744a4['incrementPreviewCounters']({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countnoanswerretry':_0x2ec72a[_0xf54e('0xaf')]}})['then'](function(){_0x3744a4['swapAdditionalPhones'](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});break;case _0xf54e('0xb6'):_0x55d57f[_0xf54e('0xb7')]+=0x1;_0x2ec72a[_0xf54e('0xb8')]+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut['totalGlobal'](_0x2ec72a);ut['logCustomer'](_0x2ec72a,0x8,_0xf54e('0xb9'));_0x29743e=_0x55d57f[_0xf54e('0xba')];_0x49fd97=_0x55d57f[_0xf54e('0x82')];ami[_0xf54e('0x26')](_0xf54e('0xbb'),ut[_0xf54e('0x96')](_0x2ec72a,_0xf54e('0xbc')));rpcDb[_0xf54e('0x6b')](_0x2ec72a,_0xf54e('0xbd'));_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'8',_0x55d57f)['then'](function(_0x31e699){_0x4f17dd=_0x31e699[_0xf54e('0xbe')]==0x1;if(!_0x4f17dd){if(ut['totalGlobal'](_0x2ec72a)>=_0x55d57f['dialGlobalMaxRetry']){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0xbf'));}else{if(_0x2ec72a[_0xf54e('0xb8')]>=_0x55d57f['dialCongestionMaxRetry']){rpcDb[_0xf54e('0x6f')](_0x2ec72a,_0xf54e('0xbd'));}else{rpcDb[_0xf54e('0x89')](ut[_0xf54e('0x8a')](_0x2ec72a,'countcongestionretry',_0x55d57f[_0xf54e('0xc0')]),_0x2ec72a[_0xf54e('0x8b')],_0x2ec72a[_0xf54e('0x8c')]);}}}else{_0x2ec72a[_0xf54e('0xb8')]++;_0x3744a4['incrementPreviewCounters']({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countcongestionretry':_0x2ec72a[_0xf54e('0xb8')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});break;case'CANCEL':_0x55d57f[_0xf54e('0xc1')]+=0x1;_0x2ec72a['countagentrejectretry']+=0x1;_0x2ec72a['countglobal']=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x14,_0xf54e('0xc2'));_0x29743e=_0x55d57f[_0xf54e('0xc3')];_0x49fd97=_0x55d57f[_0xf54e('0x82')];ami[_0xf54e('0x26')](_0xf54e('0xc4'),ut[_0xf54e('0x96')](_0x2ec72a,_0xf54e('0xc5')));rpcDb['createCustomerHistory'](_0x2ec72a,_0xf54e('0xc6'));_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'20',_0x55d57f)[_0xf54e('0x5a')](function(_0x971a3e){_0x4f17dd=_0x971a3e[_0xf54e('0xbe')]==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f['dialGlobalMaxRetry']){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0x14,_0xf54e('0xc2'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0xc7'));}else{if(_0x2ec72a[_0xf54e('0xc8')]>=_0x55d57f[_0xf54e('0xc9')]){rpcDb['createCustomerFinal'](_0x2ec72a,_0xf54e('0xc7'));}else{rpcDb[_0xf54e('0x89')](ut[_0xf54e('0x8a')](_0x2ec72a,_0xf54e('0xc8'),_0x55d57f['dialAgentRejectRetryFrequency']),_0x2ec72a['unlockAgent'],_0x2ec72a[_0xf54e('0x8c')]);}}}else{_0x2ec72a[_0xf54e('0xaf')]++;_0x3744a4[_0xf54e('0xad')]({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countnoanswerretry':_0x2ec72a[_0xf54e('0xaf')]}})[_0xf54e('0x5a')](function(){_0x3744a4['swapAdditionalPhones'](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});break;case _0xf54e('0xca'):_0x55d57f[_0xf54e('0xcb')]+=0x1;_0x2ec72a[_0xf54e('0xcc')]+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut['logCustomer'](_0x2ec72a,0xb,_0xf54e('0xcd'));rpcDb['createCustomerHistory'](_0x2ec72a,_0xf54e('0xce'));_0x3744a4['verifyAdditionalPhones'](_0x2ec72a,'11',_0x55d57f)[_0xf54e('0x5a')](function(_0x27c584){_0x4f17dd=_0x27c584[_0xf54e('0xbe')]==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f[_0xf54e('0x83')]){_0x9ab4c4=ut['cloneAction'](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,'[callProgressDetectingCustomer][logAbandoned]');}else{if(_0x2ec72a[_0xf54e('0xcf')]>=_0x55d57f[_0xf54e('0xd0')]){rpcDb[_0xf54e('0x6f')](_0x2ec72a,_0xf54e('0xce'));}else{rpcDb['rescheduleContact'](ut[_0xf54e('0x8a')](_0x2ec72a,_0xf54e('0xcc'),_0x55d57f['dialAbandonedRetryFrequency']),_0x2ec72a[_0xf54e('0x8b')],_0x2ec72a['activeContact']);}}}else{_0x2ec72a['countnoanswerretry']++;_0x3744a4[_0xf54e('0xad')]({'id':_0x2ec72a['idContact'],'field':{'countnoanswerretry':_0x2ec72a[_0xf54e('0xaf')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});break;case'18':_0x55d57f[_0xf54e('0xd1')]+=0x1;_0x2ec72a['countmachineretry']+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0x12,_0x30d10d[_0xf54e('0xd2')]||_0x30d10d['dialstatus']);ami[_0xf54e('0x26')]('custom:amd',ut[_0xf54e('0x96')](_0x2ec72a,_0xf54e('0xd3')));rpcDb['createCustomerHistory'](_0x2ec72a,_0xf54e('0xd4'));_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'18',_0x55d57f)[_0xf54e('0x5a')](function(_0x23a151){_0x4f17dd=_0x23a151['additional']==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f[_0xf54e('0x83')]){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0x12,'Global');rpcDb['createCustomerFinal'](_0x9ab4c4,_0xf54e('0xd4'));}else{rpcDb['createCustomerFinal'](_0x2ec72a,'[callProgressDetectingCustomer][hangupInAMD]');}}else{_0x2ec72a['countnoanswerretry']++;_0x3744a4[_0xf54e('0xad')]({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countnoanswerretry':_0x2ec72a[_0xf54e('0xaf')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});delete this[_0xf54e('0x15')][_0x30d10d[_0xf54e('0x8d')]];break;case'19':_0x55d57f[_0xf54e('0xd1')]+=0x1;_0x2ec72a['countglobal']=ut[_0xf54e('0x7d')](_0x2ec72a);ut['logCustomer'](_0x2ec72a,0x13,_0x30d10d[_0xf54e('0xd2')]||_0x30d10d[_0xf54e('0xd5')]);ami['emit'](_0xf54e('0xd6'),ut['buildObj'](_0x2ec72a,_0xf54e('0xd3')));rpcDb[_0xf54e('0x6b')](_0x2ec72a,_0xf54e('0xd7'));_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'18',_0x55d57f)[_0xf54e('0x5a')](function(_0x3c499e){_0x4f17dd=_0x3c499e['additional']==0x1;if(!_0x4f17dd){if(ut['totalGlobal'](_0x2ec72a)>=_0x55d57f['dialGlobalMaxRetry']){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,'Global');rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0xd7'));}else{rpcDb[_0xf54e('0x6f')](_0x2ec72a,_0xf54e('0xd7'));}}else{_0x2ec72a[_0xf54e('0xaf')]++;_0x3744a4['incrementPreviewCounters']({'id':_0x2ec72a[_0xf54e('0x8f')],'field':{'countnoanswerretry':_0x2ec72a[_0xf54e('0xaf')]}})[_0xf54e('0x5a')](function(){_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});});}});delete this[_0xf54e('0x15')][_0x30d10d['linkedid']];break;default:if(_0x2ec72a[_0xf54e('0x47')]){ut[_0xf54e('0x9c')](_0x55d57f,_0xf54e('0xd8'));ut[_0xf54e('0x53')](_0xf54e('0xd9')+_0x55d57f['name'],_0x30d10d);}_0x55d57f[_0xf54e('0xd1')]+=0x1;_0x2ec72a[_0xf54e('0x7c')]=ut[_0xf54e('0x7d')](_0x2ec72a);ut[_0xf54e('0x66')](_0x2ec72a,0xc,_0x30d10d[_0xf54e('0xd2')]||_0x30d10d[_0xf54e('0xd5')]);_0x29743e=_0x55d57f[_0xf54e('0xc3')];_0x49fd97=_0x55d57f[_0xf54e('0x82')];rpcDb[_0xf54e('0x6b')](_0x2ec72a,'[callProgressDetectingCustomer][logUnknown]');_0x3744a4[_0xf54e('0xaa')](_0x2ec72a,'20',_0x55d57f)[_0xf54e('0x5a')](function(_0x47d309){_0x4f17dd=_0x47d309['additional']==0x1;if(!_0x4f17dd){if(ut[_0xf54e('0x7d')](_0x2ec72a)>=_0x55d57f['dialGlobalMaxRetry']){_0x9ab4c4=ut[_0xf54e('0x84')](_0x2ec72a,0xf,_0xf54e('0x85'));rpcDb[_0xf54e('0x6f')](_0x9ab4c4,_0xf54e('0xda'));}else{rpcDb['createCustomerFinal'](_0x2ec72a,_0xf54e('0xda'));}delete this[_0xf54e('0x15')][_0x30d10d['linkedid']];}else{_0x3744a4[_0xf54e('0x90')](_0x2ec72a,_0x29743e,_0x49fd97)[_0xf54e('0x5a')](function(){});}});}if(!(_0x2ec72a[_0xf54e('0x47')]&&_0x4e5059==='16')){ut[_0xf54e('0x52')](_0x55d57f,_0xf54e('0xdb'));logger[_0xf54e('0x27')](_0xf54e('0xdc'),_0x2ec72a[_0xf54e('0xa4')],_0xf54e('0x94'),_0x55d57f[_0xf54e('0x2c')],_0xf54e('0x45'),_0x55d57f['originated']);}if(_0x4e5059!=='ANSWER'){delete this[_0xf54e('0x15')][_0x30d10d[_0xf54e('0x8d')]];delete this[_0xf54e('0x15')][_0x30d10d[_0xf54e('0xdd')]];}_0x55d57f[_0xf54e('0xde')]=!![];}};Preview['prototype'][_0xf54e('0xdf')]=function(_0x24b324,_0x3a9def,_0x213dc5){if(_['isUndefined'](_0x3a9def)&&_0xf54e('0xe0')!==typeof _0x3a9def){return;}if(_[_0xf54e('0xe1')](_0x213dc5)&&_0xf54e('0xe0')!==typeof _0x213dc5){return;}switch(_0x213dc5[_0xf54e('0xe2')]){case'0':ut[_0xf54e('0xe3')](_0x24b324,0x0,_0xf54e('0x7e'));rpcDb[_0xf54e('0xe4')](_0x24b324,_0xf54e('0xe5'));break;case'3':ut[_0xf54e('0xe3')](_0x24b324,0x3,_0xf54e('0xb0'));rpcDb[_0xf54e('0xe4')](_0x24b324,_0xf54e('0xe6'));break;case'5':ut[_0xf54e('0xe3')](_0x24b324,0x5,_0xf54e('0xe7'));rpcDb['createAgentHistory'](_0x24b324,_0xf54e('0xe8'));break;case'8':ut['logAgent'](_0x24b324,0x8,'Congestion');rpcDb[_0xf54e('0xe4')](_0x24b324,_0xf54e('0xe9'));break;case'22':ut[_0xf54e('0xe3')](_0x24b324,0x16,_0xf54e('0xea'));rpcDb[_0xf54e('0xe4')](_0x24b324,_0xf54e('0xeb'));break;default:ut[_0xf54e('0xe3')](_0x24b324,0xc,_0x213dc5[_0xf54e('0xe2')]);rpcDb[_0xf54e('0xe4')](_0x24b324,_0xf54e('0xe9'));}ut[_0xf54e('0x52')](_0x3a9def,_0xf54e('0xec'));logger[_0xf54e('0x27')]('[originated][decrement][callProgressDetectingAgent]',_0x24b324[_0xf54e('0xa4')],_0xf54e('0x94'),_0x3a9def[_0xf54e('0x2c')],_0xf54e('0x45'),_0x3a9def[_0xf54e('0x2e')]);delete this['actions'][_0x24b324['uniqueid']];};Preview[_0xf54e('0xf')][_0xf54e('0xaa')]=function(_0x4b6f61,_0x5f0853,_0x3250d0){return cmHopperAdditionalPhone['verifyAdditionalPhones'](_0x4b6f61,_0x5f0853,_0x3250d0)[_0xf54e('0x50')](logger[_0xf54e('0x27')](_0xf54e('0xed')));};Preview[_0xf54e('0xf')][_0xf54e('0x90')]=function(_0x1f9d18,_0x50bff9,_0x39fc7d){return cmHopperAdditionalPhone[_0xf54e('0x90')](_0x1f9d18,_0x50bff9,_0x39fc7d)['catch'](logger[_0xf54e('0x27')](_0xf54e('0xee')));};Preview['prototype'][_0xf54e('0xad')]=function(_0x44b7bd){return Promise[_0xf54e('0xef')]()['then'](cmHopperAdditionalPhone['incrementPreviewCounters'](_0x44b7bd))[_0xf54e('0x50')](logger[_0xf54e('0x27')]('[incrementPreviewCounters]\x20'));};Preview['prototype']['checkInBlack']=function(_0x39027b,_0x32b55f,_0x11fb0c,_0x5072aa,_0x187b1c){var _0x459172=this;return new Promise(function(_0x28d019,_0x3da354){if(_[_0xf54e('0xf0')](_0x32b55f)||_['isNil'](_0x32b55f['Contact'])||_['isNil'](_0x32b55f['phone'])||_['isNil'](_0x32b55f[_0xf54e('0x4b')])){_0x3da354(ut['message'](_0xf54e('0xf1'),_0x5072aa,_0x187b1c));return;}var _0x3e0b67=uuid['v4']();var _0x484691=_0x459172[_0xf54e('0x3a')][_0x32b55f['Queue'][_0xf54e('0x2c')]];var _0x400dc6=_0x11fb0c?_0x459172[_0xf54e('0x16')][_0x11fb0c]['id']:undefined;_0x459172[_0xf54e('0x15')][_0x3e0b67]=new Action(_0x32b55f,_0x484691,_0x3e0b67,_0x11fb0c,_0x400dc6);var _0x3c0755=_0x459172[_0xf54e('0x15')][_0x3e0b67];_0x3c0755[_0xf54e('0x8b')]=_0x5072aa;_0x3c0755['activeContact']=_0x187b1c;_0x3c0755[_0xf54e('0xf2')]=_0x11fb0c;if(_[_0xf54e('0xf3')](_0x39027b)){_0x459172[_0xf54e('0xf4')](_0x3c0755,_0x484691,_0x32b55f,_0x11fb0c)[_0xf54e('0x5a')](function(_0x3733f5){logger['info'](_0xf54e('0xf5'),_0xf54e('0xf6')+_0x3c0755[_0xf54e('0x44')]+_0xf54e('0xf7')+_0x3c0755[_0xf54e('0x8f')],JSON[_0xf54e('0x29')](_0x3733f5));ami['emit']('custom:agentcalled',ut['buildObj'](_0x3c0755,_0xf54e('0xf8'),_0x459172[_0xf54e('0x3a')][_0x3c0755[_0xf54e('0x44')]]));_0x28d019(ut[_0xf54e('0x32')](_0xf54e('0xf9')));})['catch'](function(_0x31b2d6){ut[_0xf54e('0x35')]('[Preview][execCall][failure]',_0x31b2d6);_0x3da354(ut[_0xf54e('0x32')](_0xf54e('0xfa'),_0x5072aa,_0x187b1c));});}else{_0x484691[_0xf54e('0xfb')]+=0x1;ut['logBlacklist'](_0x3c0755);rpcDb[_0xf54e('0xfc')](_0x3c0755,_0xf54e('0xfd'));delete _0x459172[_0xf54e('0x15')][_0x3e0b67];_0x3da354(ut[_0xf54e('0x32')](_0xf54e('0xfe'),_0x5072aa,_0x187b1c));}});};Preview[_0xf54e('0xf')][_0xf54e('0x76')]=function(_0x370e59){return!_['isNil'](_0x370e59)&&!_[_0xf54e('0xf0')](_0x370e59['name'])&&!_[_0xf54e('0xf0')](_0x370e59[_0xf54e('0xff')])&&_0x370e59[_0xf54e('0xff')]&&!_[_0xf54e('0xf0')](this[_0xf54e('0x100')][util[_0xf54e('0x2a')](_0xf54e('0x101'),_0x370e59['name'])])&&!_['isNil'](this['trunks'][util[_0xf54e('0x2a')]('SIP/%s',_0x370e59[_0xf54e('0x2c')])]['status'])&&(this[_0xf54e('0x100')][util[_0xf54e('0x2a')]('SIP/%s',_0x370e59[_0xf54e('0x2c')])][_0xf54e('0x4e')]===_0xf54e('0x102')||this[_0xf54e('0x100')][util[_0xf54e('0x2a')](_0xf54e('0x101'),_0x370e59[_0xf54e('0x2c')])][_0xf54e('0x4e')]===_0xf54e('0x103'));};Preview[_0xf54e('0xf')][_0xf54e('0x5f')]=function(_0x5bc7ed,_0x26e18f){return this[_0xf54e('0x104')](_0x5bc7ed,_0x26e18f)[_0xf54e('0x5a')](function(_0x52226a){return _[_0xf54e('0x48')](_0x52226a,['message']);})[_0xf54e('0x50')](function(_0xc0d72a){if(_0xc0d72a[_0xf54e('0x105')]){rpcDb[_0xf54e('0x106')](_0x5bc7ed);}if(_0xc0d72a[_0xf54e('0xff')]){rpcDb[_0xf54e('0x62')](_0x5bc7ed);}throw _[_0xf54e('0x48')](_0xc0d72a,[_0xf54e('0x32')]);});};Preview[_0xf54e('0xf')][_0xf54e('0x104')]=function(_0x215277,_0x4a2222){var _0x50c424=this;var _0x47e3ae,_0x2bee3e;return rpcDb[_0xf54e('0x107')](_0x215277)[_0xf54e('0x5a')](function(_0x4c249a){if(!_[_0xf54e('0xf0')](_0x4c249a[0x0])){_0x2bee3e=_0x4c249a[0x0][_0xf54e('0x108')]?![]:!![];_0x47e3ae=_0x4c249a[0x0]['recallme']?!![]:![];_0x47e3ae=_0x4a2222?!![]:_0x47e3ae;}var _0x405254=_0x50c424[_0xf54e('0x109')](_0x4c249a);if(_0x405254[_0xf54e('0x10a')]){rpcDb[_0xf54e('0x10b')](_[_0xf54e('0x48')](_0x4c249a[0x0],[_0xf54e('0x4b'),_0xf54e('0x10c')]))['then'](function(_0x5369cd){_0x50c424[_0xf54e('0x10d')](_0x5369cd,_0x4c249a[0x0],_0x4a2222,_0x2bee3e,_0x47e3ae)[_0xf54e('0x5a')](function(_0x2ac04e){return _0x2ac04e;})[_0xf54e('0x50')](function(_0x53ae5c){throw _0x53ae5c;});})[_0xf54e('0x50')](function(_0x37c370){ut['logger'](_0xf54e('0x10e'),_0x37c370);throw ut['message'](_0xf54e('0x10f'),_0x2bee3e,_0x47e3ae);});}else{throw ut[_0xf54e('0x32')](_0x405254[_0xf54e('0x32')],_0x2bee3e,_0x47e3ae);}})[_0xf54e('0x50')](function(_0x4fb1ab){ut[_0xf54e('0x35')]('[Preview][getContactPreview]',_0x4fb1ab);throw ut[_0xf54e('0x32')](_0xf54e('0x10f'),![],!![]);});};Preview[_0xf54e('0xf')][_0xf54e('0x109')]=function(_0x5221d0){if(_['isNil'](_0x5221d0)||_[_0xf54e('0xf3')](_0x5221d0)||!_[_0xf54e('0xf0')](_0x5221d0[0x0][_0xf54e('0x5e')])&&_['isNil'](_0x5221d0[0x0][_0xf54e('0x5e')][_0xf54e('0x2c')])){ut['logger'](_0xf54e('0x110'),_0x5221d0);return{'isValid':![],'message':_0xf54e('0x111')};}var _0x3ea69c=this[_0xf54e('0x3a')][_0x5221d0[0x0][_0xf54e('0x112')][_0xf54e('0x2c')]];_0x3ea69c['message']=utils[_0xf54e('0x33')][_0xf54e('0x79')];if(_[_0xf54e('0xf0')](_0x3ea69c)){ut[_0xf54e('0x35')](_0xf54e('0x113'),_0x3ea69c);return{'isValid':![],'message':_0xf54e('0x114')};}if(!this[_0xf54e('0x76')](_0x3ea69c[_0xf54e('0x77')])){ut[_0xf54e('0x35')](_0xf54e('0x115'),_0xf54e('0x116')+_0x3ea69c[_0xf54e('0x2c')]+_0xf54e('0x117'));if(!this[_0xf54e('0x76')](_0x3ea69c[_0xf54e('0x118')])){ut[_0xf54e('0x35')](_0xf54e('0x115'),_0x3ea69c['name']+_0xf54e('0x119'));return{'isValid':![],'message':_0xf54e('0x11a')};}}if(!ut[_0xf54e('0x11b')](_0x3ea69c['dialActive'])){ut[_0xf54e('0x35')](_0xf54e('0x11c'),_0x3ea69c[_0xf54e('0x2c')]+_0xf54e('0x11d'));return{'isValid':![],'message':_0xf54e('0x116')+_0x3ea69c['name']+_0xf54e('0x11d')};}return{'isValid':!![],'message':'Is\x20Valid'};};Preview[_0xf54e('0xf')][_0xf54e('0xf4')]=function(_0x505c0f,_0xcdc5ec,_0x171516,_0x2df876){var _0x4026ea=this;return new Promise(function(_0x1a0fc0,_0x459bbb){var _0x3770f3=_0x505c0f[_0xf54e('0xa4')];var _0x1ad56e=_0x4026ea['isTrunkReachable'](_0xcdc5ec[_0xf54e('0x77')])?util['format'](_0xf54e('0x11e'),_0xcdc5ec[_0xf54e('0x77')]['name'],_[_0xf54e('0xf0')](_0xcdc5ec['dialPrefix'])?'':_0xcdc5ec[_0xf54e('0x11f')][_0xf54e('0x120')]()||'',_0xcdc5ec['dialCutDigit']>0x0?_0x171516[_0xf54e('0x10c')][_0xf54e('0x121')](_0xcdc5ec['dialCutDigit']):_0x171516['phone']):util['format'](_0xf54e('0x11e'),_[_0xf54e('0xf0')](_0xcdc5ec[_0xf54e('0x118')])?_0xcdc5ec[_0xf54e('0x77')][_0xf54e('0x2c')]:_0xcdc5ec[_0xf54e('0x118')][_0xf54e('0x2c')],_[_0xf54e('0xf0')](_0xcdc5ec['dialPrefix'])?'':_0xcdc5ec['dialPrefix'][_0xf54e('0x120')]()||'',_0xcdc5ec[_0xf54e('0x122')]>0x0?_0x171516[_0xf54e('0x10c')][_0xf54e('0x121')](_0xcdc5ec[_0xf54e('0x122')]):_0x171516['phone']);var _0x3aa45f=_0x4026ea['isTrunkReachable'](_0xcdc5ec['Trunk'])?ut[_0xf54e('0x123')](_0xcdc5ec[_0xf54e('0x77')][_0xf54e('0x124')],_0xcdc5ec[_0xf54e('0x125')],_0xcdc5ec[_0xf54e('0x126')]>0x0?ut[_0xf54e('0x127')](_0xcdc5ec[_0xf54e('0x128')],_0xcdc5ec['dialRandomLastDigitCallerIdNumber']):_0xcdc5ec[_0xf54e('0x128')]):ut[_0xf54e('0x123')](_[_0xf54e('0xf0')](_0xcdc5ec[_0xf54e('0x118')])?_0xcdc5ec[_0xf54e('0x77')]['callerid']:_0xcdc5ec[_0xf54e('0x118')][_0xf54e('0x124')],_0xcdc5ec[_0xf54e('0x125')],_0xcdc5ec[_0xf54e('0x126')]>0x0?ut[_0xf54e('0x127')](_0xcdc5ec['dialOriginateCallerIdNumber'],_0xcdc5ec['dialRandomLastDigitCallerIdNumber']):_0xcdc5ec[_0xf54e('0x128')]);if(_0x3aa45f){_0x505c0f[_0xf54e('0x129')]=ut[_0xf54e('0x12a')](_0x3aa45f);_0x505c0f['originatecalleridnum']=ut[_0xf54e('0x12b')](_0x3aa45f);}var _0x2c2833=ut[_0xf54e('0x12c')](_0xcdc5ec,_0x171516,_0x1ad56e,_0x3aa45f,_0x3770f3,_0x505c0f);_[_0xf54e('0x12d')](_0x505c0f,ut['toLowerVariables'](_0x2c2833));_0x505c0f[_0xf54e('0x63')]=moment()[_0xf54e('0x2a')](_0xf54e('0x64'));_0xcdc5ec['variables']=_0x2c2833;var _0x34db40=ut[_0xf54e('0x12e')](_0x505c0f,_0xcdc5ec,_0x2c2833,_0x505c0f[_0xf54e('0x8c')],_0x2df876);return ami[_0xf54e('0x4d')](_0x34db40)[_0xf54e('0x5a')](function(_0x123f93){_0xcdc5ec[_0xf54e('0x2e')]+=0x1;logger[_0xf54e('0x27')]('[originated][increment]',_0x3770f3,_0xf54e('0x94'),_0xcdc5ec[_0xf54e('0x2c')],_0xf54e('0x45'),_0xcdc5ec[_0xf54e('0x2e')]);_0x1a0fc0(_0x123f93);})['catch'](function(_0x47b07a){ut['logAgent'](_0x505c0f,0xe,'OriginateError');rpcDb[_0xf54e('0xe4')](_0x505c0f,_0xf54e('0x12f'));_0x459bbb(_0x47b07a);});});};Preview[_0xf54e('0xf')]['syncNewExten']=function(_0x5a84b8){if(this[_0xf54e('0x15')][_0x5a84b8['linkedid']]){this[_0xf54e('0x15')][_0x5a84b8['linkedid']][_0xf54e('0x4f')]=_0x5a84b8[_0xf54e('0x4f')];}};Preview[_0xf54e('0xf')]['syncOriginateResponse']=function(_0x14ead8){var _0x260b7a=this;var _0x1487be=this[_0xf54e('0x15')][_0x14ead8['actionid']];if(_0x1487be){if(_0x1487be[_0xf54e('0xf2')]&&this[_0xf54e('0x16')][_0x1487be[_0xf54e('0xf2')]]){ut[_0xf54e('0x130')](_0x1487be,this[_0xf54e('0x16')][_0x1487be[_0xf54e('0xf2')]]['name'],this[_0xf54e('0x16')][_0x1487be['lookAgent']]['id']);}var _0x4d406a=_[_0xf54e('0x131')](_0x1487be);_0x4d406a['responsetime']=moment()[_0xf54e('0x2a')](_0xf54e('0x64'));var _0x56411c=_0x260b7a['campaignsPreview'][_0x1487be[_0xf54e('0x44')]];if(ut['isFailure'](_0x14ead8[_0xf54e('0x132')])){if(_0x1487be[_0xf54e('0x8b')]){rpcDb['unlockContact'](_0x1487be[_0xf54e('0x8f')]);}if(_0x1487be['activeContact']){rpcDb[_0xf54e('0x62')](_0x1487be[_0xf54e('0x8f')]);}ami['emit'](_0xf54e('0x133'),ut[_0xf54e('0x96')](_0x1487be,_0xf54e('0x134'),this[_0xf54e('0x3a')][_0x1487be[_0xf54e('0x44')]]));this[_0xf54e('0xdf')](_0x4d406a,_0x56411c,_0x14ead8);}else{_0x1487be[_0xf54e('0x63')]=moment()[_0xf54e('0x2a')](_0xf54e('0x64'));ut['logAgent'](_0x4d406a,0x4,'Answer');rpcDb[_0xf54e('0xe4')](_0x4d406a,_0xf54e('0x135'));}}};Preview[_0xf54e('0xf')][_0xf54e('0x1b')]=function(_0x53d6cb){var _0x143b50=this[_0xf54e('0x15')][_0x53d6cb['linkedid']];var _0x3b25f4;if(_0x143b50){_0x3b25f4=this[_0xf54e('0x3a')][_0x143b50[_0xf54e('0x44')]];logger[_0xf54e('0x27')](_0xf54e('0x136'),_0x53d6cb[_0xf54e('0x8d')],_0xf54e('0x94'),_0x3b25f4[_0xf54e('0x2c')],_0xf54e('0x46'),_0x3b25f4[_0xf54e('0x2f')]);}if(this[_0xf54e('0x15')][_0x53d6cb['linkedid']]&&_0x53d6cb['linkedid']!==_0x53d6cb[_0xf54e('0xa4')]){if(_0x53d6cb[_0xf54e('0x137')]==='16'&&this[_0xf54e('0x15')][_0x53d6cb[_0xf54e('0x8d')]][_0xf54e('0x47')]){this[_0xf54e('0x7a')](_0x53d6cb,_0x53d6cb['linkedid'],_0x53d6cb[_0xf54e('0x137')]);}else if(this[_0xf54e('0x15')][_0x53d6cb['linkedid']][_0xf54e('0x47')]){logger[_0xf54e('0x27')](_0xf54e('0x138'),_0x53d6cb[_0xf54e('0x8d')],_0x53d6cb['cause'],'\x20Queue',_0x3b25f4[_0xf54e('0x2c')],_0xf54e('0x46'),_0x3b25f4[_0xf54e('0x2f')]);this[_0xf54e('0x7a')](_0x53d6cb,_0x53d6cb['linkedid'],_0x53d6cb['cause']);}}else if(_0x143b50&&_[_0xf54e('0xf0')](_0x143b50[_0xf54e('0x139')])&&_0x3b25f4[_0xf54e('0x13a')]&&_0x53d6cb['linkedid']===_0x53d6cb[_0xf54e('0xa4')]&&_[_0xf54e('0xf0')](_0x53d6cb[_0xf54e('0xe2')])&&_0x53d6cb[_0xf54e('0x137')]==='16'&&_0x53d6cb['channelstate']==='6'&&_[_0xf54e('0xe1')](_0x143b50['transfer'])){if(_0x143b50[_0xf54e('0x8b')]){rpcDb[_0xf54e('0x106')](_0x143b50[_0xf54e('0x8f')]);}if(_0x143b50[_0xf54e('0x8c')]){rpcDb['disableContact'](_0x143b50[_0xf54e('0x8f')]);}_0x53d6cb[_0xf54e('0xe2')]='22';this[_0xf54e('0xdf')](_0x143b50,_0x3b25f4,_0x53d6cb);}else if(_0x143b50&&_0x143b50['transfer']){if(_0x53d6cb[_0xf54e('0x137')]==='16'&&this[_0xf54e('0x15')][_0x53d6cb[_0xf54e('0x8d')]]['dialAnswer']){logger[_0xf54e('0x27')](_0xf54e('0x13b'),_0x53d6cb[_0xf54e('0x8d')],_0x53d6cb[_0xf54e('0x137')],_0xf54e('0x94'),_0x3b25f4[_0xf54e('0x2c')],_0xf54e('0x46'),_0x3b25f4[_0xf54e('0x2f')]);this[_0xf54e('0x7a')](_0x53d6cb,_0x53d6cb[_0xf54e('0x8d')],_0x53d6cb[_0xf54e('0x137')]);}else if(this[_0xf54e('0x15')][_0x53d6cb[_0xf54e('0x8d')]][_0xf54e('0x47')]){logger[_0xf54e('0x27')](_0xf54e('0x138'),_0x53d6cb[_0xf54e('0x8d')],_0x53d6cb[_0xf54e('0x137')],'\x20Queue',_0x3b25f4[_0xf54e('0x2c')],_0xf54e('0x46'),_0x3b25f4[_0xf54e('0x2f')]);this[_0xf54e('0x7a')](_0x53d6cb,_0x53d6cb[_0xf54e('0x8d')],_0x53d6cb[_0xf54e('0x137')]);}}};Preview[_0xf54e('0xf')][_0xf54e('0x13c')]=function(_0x429793){if(this[_0xf54e('0x15')][_0x429793[_0xf54e('0xdd')]]&&_0x429793[_0xf54e('0xdd')]!==_0x429793[_0xf54e('0x13d')]){this[_0xf54e('0x7a')](_0x429793,_0x429793[_0xf54e('0xdd')],_0x429793[_0xf54e('0xd5')]);}};Preview['prototype'][_0xf54e('0x1d')]=function(_0x28a3f8){if(this[_0xf54e('0x15')][_0x28a3f8[_0xf54e('0x8d')]]&&_0x28a3f8['linkedid']!==_0x28a3f8[_0xf54e('0xa4')]&&!this[_0xf54e('0x15')][_0x28a3f8['linkedid']][_0xf54e('0x47')]){if(_0x28a3f8[_0xf54e('0x137')]==='1'){this[_0xf54e('0x7a')](_0x28a3f8,_0x28a3f8[_0xf54e('0x8d')],_0x28a3f8[_0xf54e('0x137')]);}}};Preview[_0xf54e('0xf')][_0xf54e('0x13e')]=function(_0x22f8ad,_0x269670,_0x17801c){if(this['actions'][_0x22f8ad]){if(_[_0xf54e('0xf0')](this[_0xf54e('0x15')][_0x22f8ad][_0xf54e('0x13f')])){this[_0xf54e('0x15')][_0x22f8ad][_0xf54e('0x13f')]={};}this[_0xf54e('0x15')][_0x22f8ad][_0xf54e('0x13f')][_0x269670]=_0x17801c;}};Preview['prototype'][_0xf54e('0x21')]=function(_0x397e6c){try{if(!_[_0xf54e('0xf0')](_0x397e6c)){if(ut[_0xf54e('0x140')](_[_0xf54e('0x141')](_0x397e6c[_0xf54e('0x142')])[0x0])){this[_0xf54e('0x13e')](_0x397e6c[_0xf54e('0xa4')],_[_0xf54e('0x141')](_0x397e6c[_0xf54e('0x142')])[0x0],_0x397e6c['value']);}}}catch(_0xb1e536){logger[_0xf54e('0x143')]('[syncVarSet][Preview]',util['inspect'](_0xb1e536,{'showHidden':![],'depth':null}));}};Preview[_0xf54e('0xf')][_0xf54e('0x23')]=function(_0x232195){if(_0x232195){if(this[_0xf54e('0x15')][_0x232195[_0xf54e('0x144')]]){this[_0xf54e('0x15')][_0x232195[_0xf54e('0x144')]][_0xf54e('0x145')]=!![];}}};Preview[_0xf54e('0xf')][_0xf54e('0x146')]=function(_0x56b18a){if(_0x56b18a){if(this[_0xf54e('0x15')][_0x56b18a[_0xf54e('0x147')]]){this['actions'][_0x56b18a['transfererlinkedid']][_0xf54e('0x145')]=!![];}}};module[_0xf54e('0x148')]=Preview; \ No newline at end of file diff --git a/server/services/ami/preview/rpcDb.js b/server/services/ami/preview/rpcDb.js index 9e76f57..d45b66a 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 _0x05b8=['[rescheduleContact]\x20','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','queuecallerjoinAt','answertime','queuecallerleaveAt','endtime','connectedlinename','membername','context','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','COMPLETED','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','rescheduleContactInQueue','[rescheduleContactInQueue]\x20','util','bluebird','../../../config/logger','preview','../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/cmHopperBlack','../rpc/voiceQueueReport','error','inspect','catch','[createHistory]\x20','resolve','then','createHistory','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','getContactPreview','createAgentHistory','createCustomerFinal','rescheduleContact','UserId'];(function(_0x51228d,_0x2c2fde){var _0x280cdc=function(_0x23ddda){while(--_0x23ddda){_0x51228d['push'](_0x51228d['shift']());}};_0x280cdc(++_0x2c2fde);}(_0x05b8,0xc1));var _0x805b=function(_0xbf4084,_0x54d1ca){_0xbf4084=_0xbf4084-0x0;var _0x104211=_0x05b8[_0xbf4084];return _0x104211;};'use strict';var util=require(_0x805b('0x0'));var BPromise=require(_0x805b('0x1'));var logger=require(_0x805b('0x2'))(_0x805b('0x3'));var cmHopper=require(_0x805b('0x4'));var cmHopperHistory=require(_0x805b('0x5'));var cmHopperBlack=require(_0x805b('0x6'));var agentReportPreview=require('../rpc/agentReportPreview');var voiceQueueReport=require(_0x805b('0x7'));function loggerCatch(_0x577141){return function(_0x387f82){logger[_0x805b('0x8')](_0x577141,util[_0x805b('0x9')](_0x387f82,{'showHidden':![],'depth':null}));};}function create(_0x52cfd2){return cmHopperHistory['createHistory'](_0x52cfd2)[_0x805b('0xa')](loggerCatch(_0x805b('0xb')));}function createAgent(_0x3f6c60){return BPromise[_0x805b('0xc')]()[_0x805b('0xd')](agentReportPreview[_0x805b('0xe')](_0x3f6c60))[_0x805b('0xa')](loggerCatch(_0x805b('0xb')));}function moveContact(_0x46f43f){return cmHopper[_0x805b('0xf')](_0x46f43f,!![])['catch'](loggerCatch(_0x805b('0x10')));}exports[_0x805b('0x11')]=function(_0x2a85ec){return cmHopperBlack[_0x805b('0x11')](_0x2a85ec)['catch'](loggerCatch('[checkIsBlackList]\x20'));};exports[_0x805b('0x12')]=function(_0x11abc2){return BPromise['resolve']()[_0x805b('0xd')](cmHopper['getContactPreview'](_0x11abc2))[_0x805b('0xa')](loggerCatch('[getContactPreview]\x20'));};exports[_0x805b('0xe')]=function(_0x518dc8,_0x9292b5){create(_0x518dc8)['catch'](loggerCatch(_0x9292b5));moveContact(_0x518dc8)[_0x805b('0xa')](loggerCatch(_0x9292b5));};exports[_0x805b('0x13')]=function(_0x25e337,_0x1954b0){createAgent(_0x25e337)['catch'](loggerCatch(_0x1954b0));};exports['createCustomerHistory']=function(_0x275780,_0x543e51){create(_0x275780)[_0x805b('0xa')](loggerCatch(_0x543e51));};exports[_0x805b('0x14')]=function(_0x5418a6,_0x2e9d9f){moveContact(_0x5418a6)['catch'](loggerCatch(_0x2e9d9f));};exports[_0x805b('0x15')]=function(_0x2c873d,_0x27406b,_0x3207dd){if(_0x27406b){_0x2c873d[_0x805b('0x16')]=null;}if(_0x3207dd){_0x2c873d['active']=![];}return cmHopper[_0x805b('0x15')](_0x2c873d)['catch'](loggerCatch(_0x805b('0x17')));};exports['countReScheduled']=function(_0x3e54db){return cmHopper[_0x805b('0x18')](_0x3e54db)[_0x805b('0xa')](loggerCatch(_0x805b('0x19')));};exports[_0x805b('0x1a')]=function(_0x163792){return cmHopper[_0x805b('0x1a')]({'UserId':null},_0x163792,0x1)[_0x805b('0xa')](loggerCatch(_0x805b('0x1b')));};exports['disableContact']=function(_0x5c0ef6){return cmHopper[_0x805b('0x1a')]({'active':![]},_0x5c0ef6,0x1)[_0x805b('0xa')](loggerCatch(_0x805b('0x1c')));};exports[_0x805b('0x1d')]=function(_0x2fcc86){var _0x4b042f={};_0x4b042f['type']=_0x2fcc86[_0x805b('0x1e')];_0x4b042f[_0x805b('0x1f')]=_0x2fcc86['uniqueid'];_0x4b042f[_0x805b('0x20')]=_0x2fcc86[_0x805b('0x20')];_0x4b042f[_0x805b('0x21')]=_0x2fcc86[_0x805b('0x21')];_0x4b042f[_0x805b('0x22')]=_0x2fcc86['queue'];_0x4b042f[_0x805b('0x23')]=_0x2fcc86[_0x805b('0x24')];_0x4b042f[_0x805b('0x25')]=_0x2fcc86[_0x805b('0x24')];_0x4b042f['queuecallercomplete']=0x1;_0x4b042f['queuecallercompleteAt']=_0x2fcc86[_0x805b('0x26')];_0x4b042f[_0x805b('0x27')]=_0x2fcc86[_0x805b('0x28')];_0x4b042f[_0x805b('0x29')]='from-sip';_0x4b042f[_0x805b('0x2a')]=_0x805b('0x2b');_0x4b042f[_0x805b('0x2c')]=0x0;_0x4b042f[_0x805b('0x2d')]=0x1;_0x4b042f[_0x805b('0x2e')]=_0x2fcc86[_0x805b('0x28')];_0x4b042f['queuecallerexitreason']=_0x805b('0x2f');return BPromise[_0x805b('0xc')]()['then'](voiceQueueReport[_0x805b('0x30')](_0x4b042f))[_0x805b('0xa')](loggerCatch(_0x805b('0x31')));};exports['getContactRecallMe']=function(_0x54be4a,_0x3c081d){return BPromise[_0x805b('0xc')]()[_0x805b('0xd')](cmHopper[_0x805b('0x32')](_0x54be4a,_0x3c081d))[_0x805b('0xa')](loggerCatch(_0x805b('0x33')));};exports[_0x805b('0x34')]=function(_0x29316c){return cmHopper['rescheduleContact'](_0x29316c,!![],!![])[_0x805b('0xa')](loggerCatch(_0x805b('0x35')));}; \ No newline at end of file +var _0x62b5=['../rpc/cmHopper','../rpc/cmHopperHistory','../rpc/agentReportPreview','../rpc/voiceQueueReport','error','inspect','createHistory','catch','[createHistory]\x20','then','moveContactManagedDialer','[moveContactManagedDialer]\x20','checkIsBlackList','[checkIsBlackList]\x20','getContactPreview','resolve','[getContactPreview]\x20','createAgentHistory','createCustomerHistory','createCustomerFinal','rescheduleContact','UserId','active','countReScheduled','[countReScheduled]\x20','unlockContact','[unlockContact]\x20','disableContact','[activeContact]\x20','crateCustomerReportQueue','type','uniqueid','calleridnum','calleridname','queue','answertime','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt','connectedlinename','membername','from-sip','exten','xcally-motion-preview','holdtime','assigned','lastAssignedTo','queuecallerexitreason','create','[voiceQueueReport]\x20','getContactRecallMe','[GetContactRecallMe]\x20','[rescheduleContactInQueue]\x20','util','bluebird','preview'];(function(_0x1627ae,_0x2aaa24){var _0x34b38f=function(_0x5c4332){while(--_0x5c4332){_0x1627ae['push'](_0x1627ae['shift']());}};_0x34b38f(++_0x2aaa24);}(_0x62b5,0x14d));var _0x562b=function(_0x61190c,_0x2b8c99){_0x61190c=_0x61190c-0x0;var _0x18985f=_0x62b5[_0x61190c];return _0x18985f;};'use strict';var util=require(_0x562b('0x0'));var BPromise=require(_0x562b('0x1'));var logger=require('../../../config/logger')(_0x562b('0x2'));var cmHopper=require(_0x562b('0x3'));var cmHopperHistory=require(_0x562b('0x4'));var cmHopperBlack=require('../rpc/cmHopperBlack');var agentReportPreview=require(_0x562b('0x5'));var voiceQueueReport=require(_0x562b('0x6'));function loggerCatch(_0x3c739b){return function(_0x2c6dfb){logger[_0x562b('0x7')](_0x3c739b,util[_0x562b('0x8')](_0x2c6dfb,{'showHidden':![],'depth':null}));};}function create(_0xd6d55a){return cmHopperHistory[_0x562b('0x9')](_0xd6d55a)[_0x562b('0xa')](loggerCatch(_0x562b('0xb')));}function createAgent(_0x554c36){return BPromise['resolve']()[_0x562b('0xc')](agentReportPreview['createHistory'](_0x554c36))['catch'](loggerCatch(_0x562b('0xb')));}function moveContact(_0x25afe7){return cmHopper[_0x562b('0xd')](_0x25afe7,!![])[_0x562b('0xa')](loggerCatch(_0x562b('0xe')));}exports['checkIsBlackList']=function(_0x1c630c){return cmHopperBlack[_0x562b('0xf')](_0x1c630c)[_0x562b('0xa')](loggerCatch(_0x562b('0x10')));};exports[_0x562b('0x11')]=function(_0x18fe34){return BPromise[_0x562b('0x12')]()[_0x562b('0xc')](cmHopper['getContactPreview'](_0x18fe34))[_0x562b('0xa')](loggerCatch(_0x562b('0x13')));};exports[_0x562b('0x9')]=function(_0x5a0dee,_0xb95270){create(_0x5a0dee)[_0x562b('0xa')](loggerCatch(_0xb95270));moveContact(_0x5a0dee)[_0x562b('0xa')](loggerCatch(_0xb95270));};exports[_0x562b('0x14')]=function(_0x1a4427,_0x20cc01){createAgent(_0x1a4427)[_0x562b('0xa')](loggerCatch(_0x20cc01));};exports[_0x562b('0x15')]=function(_0x5f3b3e,_0x14989){create(_0x5f3b3e)[_0x562b('0xa')](loggerCatch(_0x14989));};exports[_0x562b('0x16')]=function(_0x15bf6e,_0x2ef7df){moveContact(_0x15bf6e)['catch'](loggerCatch(_0x2ef7df));};exports[_0x562b('0x17')]=function(_0x27ef2d,_0x50fa33,_0x28411c){if(_0x50fa33){_0x27ef2d[_0x562b('0x18')]=null;}if(_0x28411c){_0x27ef2d[_0x562b('0x19')]=![];}return cmHopper[_0x562b('0x17')](_0x27ef2d)[_0x562b('0xa')](loggerCatch('[rescheduleContact]\x20'));};exports[_0x562b('0x1a')]=function(_0x4ec0cc){return cmHopper['countReScheduled'](_0x4ec0cc)[_0x562b('0xa')](loggerCatch(_0x562b('0x1b')));};exports[_0x562b('0x1c')]=function(_0x5cca21){return cmHopper[_0x562b('0x1c')]({'UserId':null},_0x5cca21,0x1)['catch'](loggerCatch(_0x562b('0x1d')));};exports[_0x562b('0x1e')]=function(_0x5288b8){return cmHopper[_0x562b('0x1c')]({'active':![]},_0x5288b8,0x1)[_0x562b('0xa')](loggerCatch(_0x562b('0x1f')));};exports[_0x562b('0x20')]=function(_0x15a3f7){var _0xe4dbd2={};_0xe4dbd2[_0x562b('0x21')]=_0x15a3f7[_0x562b('0x21')];_0xe4dbd2['uniqueid']=_0x15a3f7[_0x562b('0x22')];_0xe4dbd2[_0x562b('0x23')]=_0x15a3f7[_0x562b('0x23')];_0xe4dbd2[_0x562b('0x24')]=_0x15a3f7[_0x562b('0x24')];_0xe4dbd2[_0x562b('0x25')]=_0x15a3f7[_0x562b('0x25')];_0xe4dbd2['queuecallerjoinAt']=_0x15a3f7[_0x562b('0x26')];_0xe4dbd2[_0x562b('0x27')]=_0x15a3f7[_0x562b('0x26')];_0xe4dbd2[_0x562b('0x28')]=0x1;_0xe4dbd2[_0x562b('0x29')]=_0x15a3f7['endtime'];_0xe4dbd2[_0x562b('0x2a')]=_0x15a3f7[_0x562b('0x2b')];_0xe4dbd2['context']=_0x562b('0x2c');_0xe4dbd2[_0x562b('0x2d')]=_0x562b('0x2e');_0xe4dbd2[_0x562b('0x2f')]=0x0;_0xe4dbd2[_0x562b('0x30')]=0x1;_0xe4dbd2[_0x562b('0x31')]=_0x15a3f7[_0x562b('0x2b')];_0xe4dbd2[_0x562b('0x32')]='COMPLETED';return BPromise[_0x562b('0x12')]()[_0x562b('0xc')](voiceQueueReport[_0x562b('0x33')](_0xe4dbd2))[_0x562b('0xa')](loggerCatch(_0x562b('0x34')));};exports['getContactRecallMe']=function(_0x4c4b22,_0x365f7f){return BPromise[_0x562b('0x12')]()[_0x562b('0xc')](cmHopper[_0x562b('0x35')](_0x4c4b22,_0x365f7f))[_0x562b('0xa')](loggerCatch(_0x562b('0x36')));};exports['rescheduleContactInQueue']=function(_0x3bf35e){return cmHopper[_0x562b('0x17')](_0x3bf35e,!![],!![])['catch'](loggerCatch(_0x562b('0x37')));}; \ 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 a21a2b3..5238aa8 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 _0x66c7=['not_inuse','status','reachable','getDiff','diff','createBody','CampaignId','idContact','type','campaigntype','dialAnswer','countglobal','callback','callbackuniqueid','sipcallid','xmd-voicequeueid','xmd-queue','xmd-phone','xmd-dialurl','xmd-dialtimeout','xmd-dialid','xmd-cdrtype','xmd-callerid','xmd-agiafter','xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosloss','bridgepeer','bridgepvtcallid','getCallerIdRandom','\x5cw{0,','pow','replace','extractCalleridName','match','extractCalleridNumber','noanswer','variables','keys','forEach','toLowerCase','util','lodash','moment','env','XCALLY_IP_AGI','127.0.0.1','../../dialer/utils','loggerCatch','error','inspect','logger','info','loggerError','logger2','message','string','isEmpty','isUndefined','\x22%s\x22\x20<%s>','\x22\x22\x20<>','isActive','addVariables','Queue','format','calleridname','calleridnum','dialer','VoiceQueueId','dialOriginateTimeout','\x22rtTxX%s%s\x22','dialQueueProject2','monitor_format','U(xcally-mixmonitor-context)','dialQueueProject','NONE','originatecalleridnum','originatecalleridname','xcally-motion-preview','Call-Type:\x20PREVIEW','_XCALLY_MIXMONITOR_FORMAT','Contact','isNil','tags','createdAt','updatedAt','%s%s','XMD-','toUpper','hasOwnProperty','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','[updateOriginated]\x20is\x20null\x20or\x20undefined','YYYY-MM-DD\x20HH:mm:ss','state','statedesc','responsetime','logAgent','ringtime','starttime','membername','UserId','logCustomer','endtime','getSeconds','answertime','isFailure','variablesAction','uniqueid','originate','from-sip','totalGlobal','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','Global','active','add','minutes','ContactId','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','name','interface','channelAgent','motionChannel','voice','mandatoryDisposition','buildObj','buildAcw','queue'];(function(_0x2bd8a6,_0x5b9211){var _0x1e037a=function(_0x486e4b){while(--_0x486e4b){_0x2bd8a6['push'](_0x2bd8a6['shift']());}};_0x1e037a(++_0x5b9211);}(_0x66c7,0xbc));var _0x766c=function(_0x6076e5,_0x358457){_0x6076e5=_0x6076e5-0x0;var _0x4123a4=_0x66c7[_0x6076e5];return _0x4123a4;};'use strict';var util=require(_0x766c('0x0'));var _=require(_0x766c('0x1'));var moment=require(_0x766c('0x2'));var logger=require('../../../../config/logger')('preview');var ipAgi=process[_0x766c('0x3')][_0x766c('0x4')]||_0x766c('0x5');var utils=require(_0x766c('0x6'));exports[_0x766c('0x7')]=function(_0xbeb018){return function(_0x1b511d){logger[_0x766c('0x8')](_0xbeb018,util[_0x766c('0x9')](_0x1b511d,{'showHidden':![],'depth':null}));};};exports[_0x766c('0xa')]=function(_0x5c1cbd,_0x38dcc4){logger[_0x766c('0xb')](_0x5c1cbd,util[_0x766c('0x9')](_0x38dcc4,{'showHidden':![],'depth':null}));};exports[_0x766c('0xc')]=function(_0x1a99e7,_0x12d2f8){logger[_0x766c('0x8')](_0x1a99e7,util[_0x766c('0x9')](_0x12d2f8,{'showHidden':![],'depth':null}));};exports[_0x766c('0xd')]=function(_0x5f1b96){return function(_0x35c27a){logger[_0x766c('0xb')](_0x5f1b96,util[_0x766c('0x9')](_0x35c27a,{'showHidden':![],'depth':null}));};};exports[_0x766c('0xe')]=function(_0x11c03e,_0x12fadb,_0x228a67){return{'message':_0x11c03e,'unlock':_0x12fadb,'active':_0x228a67};};exports['getCallerId']=function(_0x4036be,_0x58ebc5,_0x346951){if(!_['isUndefined'](_0x346951)&&_0x766c('0xf')===typeof _0x346951&&!_[_0x766c('0x10')](_0x346951)){if(!_[_0x766c('0x11')](_0x58ebc5)&&_0x766c('0xf')===typeof _0x58ebc5&&!_[_0x766c('0x10')](_0x58ebc5)){return util['format'](_0x766c('0x12'),_0x58ebc5,_0x346951);}return util['format'](_0x766c('0x12'),_0x346951,_0x346951);}if(!_[_0x766c('0x11')](_0x4036be)&&_0x766c('0xf')===typeof _0x4036be&&!_[_0x766c('0x10')](_0x4036be)){return _0x4036be;}return _0x766c('0x13');};exports[_0x766c('0x14')]=function(_0x445752){if(_['isNil'](_0x445752)){return![];}return _0x445752;};exports[_0x766c('0x15')]=function(_0x2a34e8,_0x1bc771,_0xaf7fc2,_0x479ca7,_0x5a035a,_0xcc62e4){var _0x1f515e={'XMD-QUEUE':_0x1bc771[_0x766c('0x16')]?_0x1bc771[_0x766c('0x16')]['name']:'','XMD-CALLERID':_0x479ca7,'XMD-CALLERID-PREVIEW':_0xcc62e4?util[_0x766c('0x17')]('\x22%s\x22\x20<%s>',_0xcc62e4[_0x766c('0x18')],_0xcc62e4[_0x766c('0x19')]):_0x479ca7,'XMD-DIALID':_0x5a035a,'XMD-CONTACTID':_0x1bc771['ContactId'],'XMD-CDRTYPE':_0x766c('0x1a'),'CALLERID(all)':_0x479ca7,'XMD-VOICEQUEUEID':_0x1bc771[_0x766c('0x1b')],'XMD-DIALCHANNEL':_0xaf7fc2,'XMD-DIALTIMEOUT':_0x2a34e8[_0x766c('0x1c')]||0x1e,'XMD-DIALOPTIONS':util[_0x766c('0x17')](_0x766c('0x1d'),_0x2a34e8[_0x766c('0x1e')]?'g':'',_['isEmpty'](_0x2a34e8[_0x766c('0x1f')])?'':_0x766c('0x20')),'XMD-DIALURL':_0x2a34e8['dialPreviewUrl']||'','XMD-AGI':_0x2a34e8[_0x766c('0x21')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2a34e8[_0x766c('0x21')]):_0x766c('0x22'),'XMD-AGIAFTER':_0x2a34e8[_0x766c('0x1e')]?util['format']('\x22agi://%s/square,%s\x22',ipAgi,_0x2a34e8[_0x766c('0x1e')]):_0x766c('0x22'),'XMD-ORIGINATECALLERIDNUM':_0xcc62e4?_0xcc62e4[_0x766c('0x23')]:'','XMD-ORIGINATECALLERIDNAME':_0xcc62e4?_0xcc62e4[_0x766c('0x24')]:'','XMD-DESTINATION':_0x766c('0x25'),'SIPADDHEADER':_0x766c('0x26')};if(!_[_0x766c('0x10')](_0x2a34e8[_0x766c('0x1f')])){_0x1f515e[util[_0x766c('0x17')]('%s',_0x766c('0x27'))]=_0x2a34e8['monitor_format'];_0x1f515e[util[_0x766c('0x17')]('%s','_XCALLY_MIXMONITOR_UNIQUEID')]=_0x5a035a;}if(_0x1bc771&&_0x1bc771[_0x766c('0x28')]){for(var _0xaba241 in _0x1bc771[_0x766c('0x28')]){if(_0x1bc771[_0x766c('0x28')]['hasOwnProperty'](_0xaba241)){if(!_[_0x766c('0x29')](_0x1bc771['Contact'][_0xaba241])&&_0xaba241!=='id'&&_0xaba241!==_0x766c('0x2a')&&_0xaba241!==_0x766c('0x2b')&&_0xaba241!==_0x766c('0x2c')){_0x1f515e[util['format'](_0x766c('0x2d'),_0x766c('0x2e'),_[_0x766c('0x2f')](_0xaba241))]=_0x1bc771[_0x766c('0x28')][_0xaba241];}}}}return _0x1f515e;};exports['toLowerVariables']=function(_0x48fc8a){var _0x33e6a1={};for(var _0x46fe48 in _0x48fc8a){if(_0x48fc8a[_0x766c('0x30')](_0x46fe48)){_0x33e6a1[util[_0x766c('0x17')]('%s',_['toLower'](_0x46fe48))]=_0x48fc8a[_0x46fe48];}}return{'variables':_0x33e6a1};};exports[_0x766c('0x31')]=function(_0x526973,_0x2d1606){if(!_[_0x766c('0x29')](_0x526973)){if(_0x526973[_0x766c('0x30')]('originated')){if(_0x526973[_0x766c('0x32')]>0x0){_0x526973[_0x766c('0x32')]-=0x1;}else{logger[_0x766c('0x8')](_0x766c('0x33'),_0x2d1606);}}}else{logger['error'](_0x766c('0x34'),_0x2d1606);}};exports['logBlacklist']=function(_0x254ff1){var _0x3dcf06=moment()[_0x766c('0x17')](_0x766c('0x35'));_0x254ff1[_0x766c('0x36')]=0xd;_0x254ff1[_0x766c('0x37')]='Blacklist';_0x254ff1['starttime']=_0x3dcf06;_0x254ff1[_0x766c('0x38')]=_0x3dcf06;_0x254ff1['endtime']=_0x3dcf06;};exports[_0x766c('0x39')]=function(_0x4e041a,_0x4248b8,_0xb781dd){var _0x5b710e=moment()[_0x766c('0x17')](_0x766c('0x35'));_0x4e041a[_0x766c('0x36')]=_0x4248b8;_0x4e041a[_0x766c('0x37')]=_0xb781dd;_0x4e041a[_0x766c('0x38')]=_0x5b710e;_0x4e041a[_0x766c('0x3a')]=utils['getSeconds'](_0x4e041a[_0x766c('0x38')],_0x4e041a[_0x766c('0x3b')]);};exports['logLookAgent']=function(_0x640ffc,_0x1e15d2,_0x3d7669){_0x640ffc[_0x766c('0x3c')]=_0x1e15d2;_0x640ffc[_0x766c('0x3d')]=_0x3d7669;};exports[_0x766c('0x3e')]=function(_0x326460,_0x1abeb6,_0x295c24){var _0x2f4eeb=moment()[_0x766c('0x17')]('YYYY-MM-DD\x20HH:mm:ss');_0x326460[_0x766c('0x36')]=_0x1abeb6;_0x326460[_0x766c('0x37')]=_0x295c24;_0x326460[_0x766c('0x38')]=_0x326460[_0x766c('0x38')]?_0x326460[_0x766c('0x38')]:_0x2f4eeb;_0x326460[_0x766c('0x3f')]=_0x326460[_0x766c('0x3f')]?_0x326460[_0x766c('0x3f')]:_0x2f4eeb;_0x326460['ringtime']=utils[_0x766c('0x40')](_0x326460[_0x766c('0x38')]||0x0,_0x326460[_0x766c('0x3b')]||0x0);_0x326460['talktime']=_0x326460[_0x766c('0x41')]?utils[_0x766c('0x40')](_0x326460[_0x766c('0x3f')],_0x326460[_0x766c('0x41')]):0x0;};exports[_0x766c('0x42')]=function(_0x377869){return _0x377869==='Failure';};exports[_0x766c('0x43')]=function(_0x3b3639,_0x19c0da,_0x164598,_0x12ffec,_0x1bed07){var _0x448d71=_0x12ffec?'RECALL':_0x3b3639[_0x766c('0x18')];_0x448d71=_0x1bed07?'BOOKED':_0x448d71;return{'actionid':_0x3b3639[_0x766c('0x44')],'action':_0x766c('0x45'),'channel':_0x3b3639['channelAgent'],'callerid':util[_0x766c('0x17')]('\x22%s\x22\x20<%s>',_0x448d71,_0x3b3639[_0x766c('0x19')]),'Exten':'xcally-motion-preview','Context':_0x766c('0x46'),'Priority':'1','variable':_0x164598,'timeout':(_0x19c0da['timeout']||0x1e)*0x3e8,'async':!![],'channelid':_0x3b3639['uniqueid']};};exports[_0x766c('0x47')]=function(_0x5a6ebf){return _0x5a6ebf['countbusyretry']+_0x5a6ebf[_0x766c('0x48')]+_0x5a6ebf[_0x766c('0x49')]+_0x5a6ebf[_0x766c('0x4a')]+_0x5a6ebf['countnosuchnumberretry'];};exports[_0x766c('0x4b')]=function(_0x3ae127){var _0x315149=_['clone'](_0x3ae127);_0x315149[_0x766c('0x36')]=0xf;_0x315149['statedesc']=_0x766c('0x4c');return _0x315149;};exports['scheduledAt']=function(_0x314c73,_0x152a27,_0x3e12d7){var _0x98c41f={};_0x98c41f[_0x152a27]=_0x314c73[_0x152a27];_0x98c41f[_0x766c('0x4d')]=![];_0x98c41f['scheduledat']=moment()[_0x766c('0x4e')](_0x3e12d7,_0x766c('0x4f'))['format'](_0x766c('0x35'));_0x98c41f['ContactId']=_0x314c73[_0x766c('0x50')];_0x98c41f[_0x766c('0x51')]=_0x314c73[_0x766c('0x51')];_0x98c41f[_0x766c('0x1b')]=_0x314c73[_0x766c('0x1b')]||undefined;return _0x98c41f;};exports[_0x766c('0x52')]=function(_0x3f181b,_0x152a7d){if(!_['isNil'](_0x3f181b)){if(_0x3f181b[_0x766c('0x53')]>0x0){_0x3f181b[_0x766c('0x53')]-=0x1;}else{logger[_0x766c('0x8')](_0x152a7d,'[decrementTalkink]\x20object\x20talking\x20is\x20negative');}}else{logger['error'](_0x152a7d,_0x766c('0x54'));}};exports[_0x766c('0x55')]=function(_0x231f8b){if(_0x231f8b<=0x0){return!![];}return![];};function buildObj(_0xe7cf18,_0x52681d,_0x59405d){_0xe7cf18[_0x766c('0x56')]=_0x52681d;_0xe7cf18[_0x766c('0x57')]=_0xe7cf18['queue'];_0xe7cf18[_0x766c('0x58')]=_0xe7cf18[_0x766c('0x59')];_0xe7cf18[_0x766c('0x5a')]=_0x766c('0x5b');if(_0x59405d){_0xe7cf18[_0x766c('0x5c')]=_0x59405d[_0x766c('0x5c')];}return _0xe7cf18;}exports[_0x766c('0x5d')]=buildObj;exports[_0x766c('0x5e')]=function(_0x25224d){var _0x49a91d={};_0x49a91d[_0x766c('0x5f')]=_0x25224d[_0x766c('0x5f')];_0x49a91d[_0x766c('0x58')]=_0x25224d[_0x766c('0x59')];_0x49a91d[_0x766c('0x44')]=_0x25224d[_0x766c('0x44')];return _0x49a91d;};exports['agentReadyId']=function(_0x50cb63){var _0x2c42f9=[];for(var _0x121058 in _0x50cb63){if(_0x50cb63[_0x766c('0x30')](_0x121058)){if(!_[_0x766c('0x29')](_0x50cb63[_0x121058])&&_0x50cb63[_0x121058][_0x766c('0x36')]===_0x766c('0x60')&&_0x50cb63[_0x121058][_0x766c('0x61')]===_0x766c('0x62')){_0x2c42f9['push'](_0x50cb63[_0x121058]['id']);}}}return _0x2c42f9;};exports[_0x766c('0x63')]=function(_0x247594){var _0x22bc9a=moment()['milliseconds'](0x0);var _0x1a1679=moment(_0x247594)['milliseconds'](0x0);return _0x22bc9a[_0x766c('0x64')](_0x1a1679,'seconds');};exports[_0x766c('0x65')]=function(_0x3e5653){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x3e5653[_0x766c('0x50')],'ListId':_0x3e5653[_0x766c('0x51')],'VoiceQueueId':_0x3e5653[_0x766c('0x1b')]||undefined,'CampaignId':_0x3e5653[_0x766c('0x66')]||undefined};};exports['filterKey']=function(_0x334342){if(_0x334342===_0x766c('0x44')||_0x334342===_0x766c('0x67')||_0x334342==='queue'||_0x334342===_0x766c('0x68')||_0x334342===_0x766c('0x69')||_0x334342===_0x766c('0x6a')||_0x334342===_0x766c('0x3c')||_0x334342===_0x766c('0x59')||_0x334342===_0x766c('0x18')||_0x334342===_0x766c('0x4d')||_0x334342===_0x766c('0x19')||_0x334342==='scheduledat'||_0x334342==='countbusyretry'||_0x334342==='countcongestionretry'||_0x334342==='countnoanswerretry'||_0x334342===_0x766c('0x6b')||_0x334342===_0x766c('0x6c')||_0x334342===_0x766c('0x6d')||_0x334342==='callbackat'||_0x334342==='recallme'||_0x334342===_0x766c('0x50')||_0x334342===_0x766c('0x51')||_0x334342==='UserId'||_0x334342==='VoiceQueueId'||_0x334342===_0x766c('0x6e')||_0x334342===_0x766c('0x6f')||_0x334342===_0x766c('0x70')||_0x334342===_0x766c('0x71')||_0x334342==='xmd-listid'||_0x334342===_0x766c('0x72')||_0x334342===_0x766c('0x73')||_0x334342==='xmd-dialoptions'||_0x334342===_0x766c('0x74')||_0x334342==='xmd-dialchannel'||_0x334342==='xmd-contactid'||_0x334342===_0x766c('0x75')||_0x334342===_0x766c('0x76')||_0x334342===_0x766c('0x77')||_0x334342===_0x766c('0x78')||_0x334342===_0x766c('0x79')||_0x334342===_0x766c('0x7a')||_0x334342===_0x766c('0x7b')||_0x334342===_0x766c('0x7c')||_0x334342==='rtpaudioqosloss'||_0x334342===_0x766c('0x7d')||_0x334342===_0x766c('0x7e')||_0x334342==='rtpaudioqosrttbridged'||_0x334342==='rtpaudioqos'||_0x334342==='rtpaudioqosbridged'||_0x334342===_0x766c('0x7b')||_0x334342===_0x766c('0x7c')||_0x334342===_0x766c('0x7f')||_0x334342==='rtpaudioqoslossbridged'||_0x334342===_0x766c('0x7e')||_0x334342==='rtpaudioqosrttbridged'||_0x334342===_0x766c('0x80')||_0x334342===_0x766c('0x81')||_0x334342===_0x766c('0x36')||_0x334342===_0x766c('0x37')){return![];}return!![];};exports[_0x766c('0x82')]=function(_0x353ff8,_0x4f6a0c){var _0x44639a,_0xa8f701,_0x39240d;if(_0x4f6a0c<=0x0){_0x4f6a0c=0x1;}_0x44639a=new RegExp(_0x766c('0x83')+_0x4f6a0c+'}$');_0xa8f701=Math[_0x766c('0x84')](0xa,_0x4f6a0c-0x1);_0x39240d=Math[_0x766c('0x84')](0xa,_0x4f6a0c)-0x1;return util['format']('%s',_[_0x766c('0x85')](_0x353ff8,_0x44639a,_['random'](_0xa8f701,_0x39240d)));};exports[_0x766c('0x86')]=function(_0xb880de){var _0x53417d=_0xb880de[_0x766c('0x87')](/"(.*?)"/);return _0x53417d?_0x53417d[0x1]:_0xb880de;};exports[_0x766c('0x88')]=function(_0x3883b1){var _0x23c70d=_0x3883b1[_0x766c('0x87')](/<(.*?)>/);return _0x23c70d?_0x23c70d[0x1]:_0x3883b1;};function buildNoAnswerEventPayload(_0x5e0fa0,_0x323968){var _0x5a2209=buildObj(_0x5e0fa0,_0x766c('0x89'));if(!_['isEmpty'](_0x323968[_0x766c('0x8a')])){Object[_0x766c('0x8b')](_0x323968['variables'])[_0x766c('0x8c')](function(_0x503c4c){_0x5a2209[_0x503c4c[_0x766c('0x8d')]()]=_0x323968['variables'][_0x503c4c];});}return _0x5a2209;}exports['buildNoAnswerEventPayload']=buildNoAnswerEventPayload; \ No newline at end of file +var _0x6a09=['xmd-agi','rtpaudioqos','rtpaudioqosbridged','rtpaudioqosjitter','rtpaudioqosjitterbridged','rtpaudioqoslossbridged','rtpaudioqosrtt','rtpaudioqosrttbridged','bridgepeer','bridgepvtcallid','\x5cw{0,','pow','extractCalleridName','match','noanswer','keys','variables','forEach','toLowerCase','buildNoAnswerEventPayload','util','lodash','moment','../../../../config/logger','env','../../dialer/utils','loggerCatch','error','logger','info','inspect','logger2','message','getCallerId','isUndefined','string','format','\x22\x22\x20<>','isActive','isNil','addVariables','Queue','name','\x22%s\x22\x20<%s>','calleridname','calleridnum','ContactId','dialer','VoiceQueueId','isEmpty','monitor_format','U(xcally-mixmonitor-context)','\x22agi://%s/square,%s\x22','dialQueueProject','dialQueueProject2','NONE','originatecalleridnum','originatecalleridname','_XCALLY_MIXMONITOR_UNIQUEID','Contact','hasOwnProperty','tags','createdAt','%s%s','toUpper','toLowerVariables','toLower','updateOriginated','originated','[updateOriginated]\x20object\x20originated\x20is\x20negative','logBlacklist','state','statedesc','Blacklist','starttime','logAgent','YYYY-MM-DD\x20HH:mm:ss','ringtime','getSeconds','responsetime','membername','logCustomer','endtime','answertime','isFailure','variablesAction','RECALL','BOOKED','originate','channelAgent','xcally-motion-preview','timeout','uniqueid','totalGlobal','countbusyretry','countcongestionretry','countnoanswerretry','countagentrejectretry','cloneAction','Global','scheduledAt','active','scheduledat','ListId','decrementTalkink','pTalking','[decrementTalkink]\x20object\x20talking\x20is\x20negative','[decrementTalkink]\x20is\x20null\x20or\x20undefined','IsNotLoggedIn','lastevent','queue','interface','motionChannel','mandatoryDisposition','buildObj','buildAcw','agentReadyId','not_inuse','push','getDiff','milliseconds','diff','seconds','createBody','CampaignId','filterKey','idContact','campaigntype','callback','callbackuniqueid','callbackat','UserId','sipcallid','xmd-voicequeueid','xmd-phone','xmd-listid','xmd-dialurl','xmd-dialtimeout','xmd-dialoptions','xmd-dialid','xmd-dialchannel','xmd-contactid','xmd-cdrtype','xmd-callerid','xmd-agiafter'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x6a09,0xa5));var _0x96a0=function(_0x7577b9,_0x4fe21c){_0x7577b9=_0x7577b9-0x0;var _0x2660c8=_0x6a09[_0x7577b9];return _0x2660c8;};'use strict';var util=require(_0x96a0('0x0'));var _=require(_0x96a0('0x1'));var moment=require(_0x96a0('0x2'));var logger=require(_0x96a0('0x3'))('preview');var ipAgi=process[_0x96a0('0x4')]['XCALLY_IP_AGI']||'127.0.0.1';var utils=require(_0x96a0('0x5'));exports[_0x96a0('0x6')]=function(_0x2f76ea){return function(_0x94cf8a){logger[_0x96a0('0x7')](_0x2f76ea,util['inspect'](_0x94cf8a,{'showHidden':![],'depth':null}));};};exports[_0x96a0('0x8')]=function(_0x14e983,_0x444156){logger[_0x96a0('0x9')](_0x14e983,util[_0x96a0('0xa')](_0x444156,{'showHidden':![],'depth':null}));};exports['loggerError']=function(_0x3c5c91,_0x397db9){logger[_0x96a0('0x7')](_0x3c5c91,util[_0x96a0('0xa')](_0x397db9,{'showHidden':![],'depth':null}));};exports[_0x96a0('0xb')]=function(_0x390e0d){return function(_0x26cb03){logger[_0x96a0('0x9')](_0x390e0d,util[_0x96a0('0xa')](_0x26cb03,{'showHidden':![],'depth':null}));};};exports[_0x96a0('0xc')]=function(_0x565414,_0x18d246,_0x1a37b6){return{'message':_0x565414,'unlock':_0x18d246,'active':_0x1a37b6};};exports[_0x96a0('0xd')]=function(_0x161385,_0x2446bc,_0xa33154){if(!_[_0x96a0('0xe')](_0xa33154)&&_0x96a0('0xf')===typeof _0xa33154&&!_['isEmpty'](_0xa33154)){if(!_['isUndefined'](_0x2446bc)&&_0x96a0('0xf')===typeof _0x2446bc&&!_['isEmpty'](_0x2446bc)){return util[_0x96a0('0x10')]('\x22%s\x22\x20<%s>',_0x2446bc,_0xa33154);}return util[_0x96a0('0x10')]('\x22%s\x22\x20<%s>',_0xa33154,_0xa33154);}if(!_[_0x96a0('0xe')](_0x161385)&&_0x96a0('0xf')===typeof _0x161385&&!_['isEmpty'](_0x161385)){return _0x161385;}return _0x96a0('0x11');};exports[_0x96a0('0x12')]=function(_0x12afeb){if(_[_0x96a0('0x13')](_0x12afeb)){return![];}return _0x12afeb;};exports[_0x96a0('0x14')]=function(_0x147d29,_0x3a805e,_0x5914bd,_0x1e3d04,_0x30bb01,_0x266cb4){var _0x12ea75={'XMD-QUEUE':_0x3a805e[_0x96a0('0x15')]?_0x3a805e[_0x96a0('0x15')][_0x96a0('0x16')]:'','XMD-CALLERID':_0x1e3d04,'XMD-CALLERID-PREVIEW':_0x266cb4?util[_0x96a0('0x10')](_0x96a0('0x17'),_0x266cb4[_0x96a0('0x18')],_0x266cb4[_0x96a0('0x19')]):_0x1e3d04,'XMD-DIALID':_0x30bb01,'XMD-CONTACTID':_0x3a805e[_0x96a0('0x1a')],'XMD-CDRTYPE':_0x96a0('0x1b'),'CALLERID(all)':_0x1e3d04,'XMD-VOICEQUEUEID':_0x3a805e[_0x96a0('0x1c')],'XMD-DIALCHANNEL':_0x5914bd,'XMD-DIALTIMEOUT':_0x147d29['dialOriginateTimeout']||0x1e,'XMD-DIALOPTIONS':util[_0x96a0('0x10')]('\x22rtTxX%s%s\x22',_0x147d29['dialQueueProject2']?'g':'',_[_0x96a0('0x1d')](_0x147d29[_0x96a0('0x1e')])?'':_0x96a0('0x1f')),'XMD-DIALURL':_0x147d29['dialPreviewUrl']||'','XMD-AGI':_0x147d29['dialQueueProject']?util[_0x96a0('0x10')](_0x96a0('0x20'),ipAgi,_0x147d29[_0x96a0('0x21')]):'NONE','XMD-AGIAFTER':_0x147d29[_0x96a0('0x22')]?util['format'](_0x96a0('0x20'),ipAgi,_0x147d29[_0x96a0('0x22')]):_0x96a0('0x23'),'XMD-ORIGINATECALLERIDNUM':_0x266cb4?_0x266cb4[_0x96a0('0x24')]:'','XMD-ORIGINATECALLERIDNAME':_0x266cb4?_0x266cb4[_0x96a0('0x25')]:'','XMD-DESTINATION':'xcally-motion-preview','SIPADDHEADER':'Call-Type:\x20PREVIEW'};if(!_[_0x96a0('0x1d')](_0x147d29['monitor_format'])){_0x12ea75[util['format']('%s','_XCALLY_MIXMONITOR_FORMAT')]=_0x147d29[_0x96a0('0x1e')];_0x12ea75[util[_0x96a0('0x10')]('%s',_0x96a0('0x26'))]=_0x30bb01;}if(_0x3a805e&&_0x3a805e[_0x96a0('0x27')]){for(var _0x512231 in _0x3a805e[_0x96a0('0x27')]){if(_0x3a805e[_0x96a0('0x27')][_0x96a0('0x28')](_0x512231)){if(!_[_0x96a0('0x13')](_0x3a805e[_0x96a0('0x27')][_0x512231])&&_0x512231!=='id'&&_0x512231!==_0x96a0('0x29')&&_0x512231!==_0x96a0('0x2a')&&_0x512231!=='updatedAt'){_0x12ea75[util[_0x96a0('0x10')](_0x96a0('0x2b'),'XMD-',_[_0x96a0('0x2c')](_0x512231))]=_0x3a805e[_0x96a0('0x27')][_0x512231];}}}}return _0x12ea75;};exports[_0x96a0('0x2d')]=function(_0x447e1c){var _0x280f48={};for(var _0x36107d in _0x447e1c){if(_0x447e1c['hasOwnProperty'](_0x36107d)){_0x280f48[util[_0x96a0('0x10')]('%s',_[_0x96a0('0x2e')](_0x36107d))]=_0x447e1c[_0x36107d];}}return{'variables':_0x280f48};};exports[_0x96a0('0x2f')]=function(_0x34f176,_0x25a09f){if(!_[_0x96a0('0x13')](_0x34f176)){if(_0x34f176[_0x96a0('0x28')](_0x96a0('0x30'))){if(_0x34f176[_0x96a0('0x30')]>0x0){_0x34f176[_0x96a0('0x30')]-=0x1;}else{logger['error'](_0x96a0('0x31'),_0x25a09f);}}}else{logger[_0x96a0('0x7')]('[updateOriginated]\x20is\x20null\x20or\x20undefined',_0x25a09f);}};exports[_0x96a0('0x32')]=function(_0x13c874){var _0x5864a5=moment()[_0x96a0('0x10')]('YYYY-MM-DD\x20HH:mm:ss');_0x13c874[_0x96a0('0x33')]=0xd;_0x13c874[_0x96a0('0x34')]=_0x96a0('0x35');_0x13c874[_0x96a0('0x36')]=_0x5864a5;_0x13c874['responsetime']=_0x5864a5;_0x13c874['endtime']=_0x5864a5;};exports[_0x96a0('0x37')]=function(_0x515c17,_0x177db8,_0x3a70e8){var _0x52a296=moment()[_0x96a0('0x10')](_0x96a0('0x38'));_0x515c17[_0x96a0('0x33')]=_0x177db8;_0x515c17[_0x96a0('0x34')]=_0x3a70e8;_0x515c17['responsetime']=_0x52a296;_0x515c17[_0x96a0('0x39')]=utils[_0x96a0('0x3a')](_0x515c17[_0x96a0('0x3b')],_0x515c17['starttime']);};exports['logLookAgent']=function(_0x1ebf70,_0x1b202f,_0x37fb6f){_0x1ebf70[_0x96a0('0x3c')]=_0x1b202f;_0x1ebf70['UserId']=_0x37fb6f;};exports[_0x96a0('0x3d')]=function(_0x483501,_0x5a4df1,_0x5931c3){var _0x2dc2d0=moment()[_0x96a0('0x10')](_0x96a0('0x38'));_0x483501[_0x96a0('0x33')]=_0x5a4df1;_0x483501[_0x96a0('0x34')]=_0x5931c3;_0x483501[_0x96a0('0x3b')]=_0x483501[_0x96a0('0x3b')]?_0x483501[_0x96a0('0x3b')]:_0x2dc2d0;_0x483501[_0x96a0('0x3e')]=_0x483501[_0x96a0('0x3e')]?_0x483501[_0x96a0('0x3e')]:_0x2dc2d0;_0x483501['ringtime']=utils['getSeconds'](_0x483501[_0x96a0('0x3b')]||0x0,_0x483501[_0x96a0('0x36')]||0x0);_0x483501['talktime']=_0x483501[_0x96a0('0x3f')]?utils[_0x96a0('0x3a')](_0x483501['endtime'],_0x483501[_0x96a0('0x3f')]):0x0;};exports[_0x96a0('0x40')]=function(_0x4452cd){return _0x4452cd==='Failure';};exports[_0x96a0('0x41')]=function(_0x109483,_0x378aa1,_0xaf8c20,_0x3089d2,_0x32260d){var _0x502e3e=_0x3089d2?_0x96a0('0x42'):_0x109483[_0x96a0('0x18')];_0x502e3e=_0x32260d?_0x96a0('0x43'):_0x502e3e;return{'actionid':_0x109483['uniqueid'],'action':_0x96a0('0x44'),'channel':_0x109483[_0x96a0('0x45')],'callerid':util[_0x96a0('0x10')]('\x22%s\x22\x20<%s>',_0x502e3e,_0x109483[_0x96a0('0x19')]),'Exten':_0x96a0('0x46'),'Context':'from-sip','Priority':'1','variable':_0xaf8c20,'timeout':(_0x378aa1[_0x96a0('0x47')]||0x1e)*0x3e8,'async':!![],'channelid':_0x109483[_0x96a0('0x48')]};};exports[_0x96a0('0x49')]=function(_0x41d100){return _0x41d100[_0x96a0('0x4a')]+_0x41d100[_0x96a0('0x4b')]+_0x41d100[_0x96a0('0x4c')]+_0x41d100[_0x96a0('0x4d')]+_0x41d100['countnosuchnumberretry'];};exports[_0x96a0('0x4e')]=function(_0x5cb116){var _0x4c3c14=_['clone'](_0x5cb116);_0x4c3c14[_0x96a0('0x33')]=0xf;_0x4c3c14[_0x96a0('0x34')]=_0x96a0('0x4f');return _0x4c3c14;};exports[_0x96a0('0x50')]=function(_0x790f8,_0x2a7cd4,_0x589dd2){var _0x349b09={};_0x349b09[_0x2a7cd4]=_0x790f8[_0x2a7cd4];_0x349b09[_0x96a0('0x51')]=![];_0x349b09[_0x96a0('0x52')]=moment()['add'](_0x589dd2,'minutes')[_0x96a0('0x10')](_0x96a0('0x38'));_0x349b09[_0x96a0('0x1a')]=_0x790f8[_0x96a0('0x1a')];_0x349b09['ListId']=_0x790f8[_0x96a0('0x53')];_0x349b09[_0x96a0('0x1c')]=_0x790f8[_0x96a0('0x1c')]||undefined;return _0x349b09;};exports[_0x96a0('0x54')]=function(_0x543cf0,_0xa7b3e3){if(!_['isNil'](_0x543cf0)){if(_0x543cf0[_0x96a0('0x55')]>0x0){_0x543cf0[_0x96a0('0x55')]-=0x1;}else{logger[_0x96a0('0x7')](_0xa7b3e3,_0x96a0('0x56'));}}else{logger[_0x96a0('0x7')](_0xa7b3e3,_0x96a0('0x57'));}};exports[_0x96a0('0x58')]=function(_0x4cc576){if(_0x4cc576<=0x0){return!![];}return![];};function buildObj(_0x979edd,_0xc1aee8,_0x53d91a){_0x979edd[_0x96a0('0x59')]=_0xc1aee8;_0x979edd[_0x96a0('0x16')]=_0x979edd[_0x96a0('0x5a')];_0x979edd[_0x96a0('0x5b')]=_0x979edd['channelAgent'];_0x979edd[_0x96a0('0x5c')]='voice';if(_0x53d91a){_0x979edd[_0x96a0('0x5d')]=_0x53d91a[_0x96a0('0x5d')];}return _0x979edd;}exports[_0x96a0('0x5e')]=buildObj;exports[_0x96a0('0x5f')]=function(_0x67ffad){var _0x376936={};_0x376936[_0x96a0('0x5a')]=_0x67ffad[_0x96a0('0x5a')];_0x376936[_0x96a0('0x5b')]=_0x67ffad[_0x96a0('0x45')];_0x376936['uniqueid']=_0x67ffad[_0x96a0('0x48')];return _0x376936;};exports[_0x96a0('0x60')]=function(_0x25ff38){var _0x42f111=[];for(var _0x39249e in _0x25ff38){if(_0x25ff38[_0x96a0('0x28')](_0x39249e)){if(!_[_0x96a0('0x13')](_0x25ff38[_0x39249e])&&_0x25ff38[_0x39249e]['state']===_0x96a0('0x61')&&_0x25ff38[_0x39249e]['status']==='reachable'){_0x42f111[_0x96a0('0x62')](_0x25ff38[_0x39249e]['id']);}}}return _0x42f111;};exports[_0x96a0('0x63')]=function(_0x359536){var _0x1656bf=moment()[_0x96a0('0x64')](0x0);var _0xf87485=moment(_0x359536)['milliseconds'](0x0);return _0x1656bf[_0x96a0('0x65')](_0xf87485,_0x96a0('0x66'));};exports[_0x96a0('0x67')]=function(_0x29c5bf){return{'active':![],'recallme':![],'UserId':null,'ContactId':_0x29c5bf[_0x96a0('0x1a')],'ListId':_0x29c5bf['ListId'],'VoiceQueueId':_0x29c5bf['VoiceQueueId']||undefined,'CampaignId':_0x29c5bf[_0x96a0('0x68')]||undefined};};exports[_0x96a0('0x69')]=function(_0x5b3cf2){if(_0x5b3cf2===_0x96a0('0x48')||_0x5b3cf2===_0x96a0('0x6a')||_0x5b3cf2===_0x96a0('0x5a')||_0x5b3cf2==='type'||_0x5b3cf2===_0x96a0('0x6b')||_0x5b3cf2==='dialAnswer'||_0x5b3cf2===_0x96a0('0x3c')||_0x5b3cf2===_0x96a0('0x45')||_0x5b3cf2==='calleridname'||_0x5b3cf2===_0x96a0('0x51')||_0x5b3cf2==='calleridnum'||_0x5b3cf2===_0x96a0('0x52')||_0x5b3cf2===_0x96a0('0x4a')||_0x5b3cf2==='countcongestionretry'||_0x5b3cf2==='countnoanswerretry'||_0x5b3cf2==='countglobal'||_0x5b3cf2===_0x96a0('0x6c')||_0x5b3cf2===_0x96a0('0x6d')||_0x5b3cf2===_0x96a0('0x6e')||_0x5b3cf2==='recallme'||_0x5b3cf2===_0x96a0('0x1a')||_0x5b3cf2===_0x96a0('0x53')||_0x5b3cf2===_0x96a0('0x6f')||_0x5b3cf2===_0x96a0('0x1c')||_0x5b3cf2===_0x96a0('0x70')||_0x5b3cf2===_0x96a0('0x71')||_0x5b3cf2==='xmd-queue'||_0x5b3cf2===_0x96a0('0x72')||_0x5b3cf2===_0x96a0('0x73')||_0x5b3cf2===_0x96a0('0x74')||_0x5b3cf2===_0x96a0('0x75')||_0x5b3cf2===_0x96a0('0x76')||_0x5b3cf2===_0x96a0('0x77')||_0x5b3cf2===_0x96a0('0x78')||_0x5b3cf2===_0x96a0('0x79')||_0x5b3cf2===_0x96a0('0x7a')||_0x5b3cf2===_0x96a0('0x7b')||_0x5b3cf2===_0x96a0('0x7c')||_0x5b3cf2===_0x96a0('0x7d')||_0x5b3cf2===_0x96a0('0x7e')||_0x5b3cf2===_0x96a0('0x7f')||_0x5b3cf2===_0x96a0('0x80')||_0x5b3cf2===_0x96a0('0x81')||_0x5b3cf2==='rtpaudioqosloss'||_0x5b3cf2===_0x96a0('0x82')||_0x5b3cf2===_0x96a0('0x83')||_0x5b3cf2===_0x96a0('0x84')||_0x5b3cf2===_0x96a0('0x7e')||_0x5b3cf2==='rtpaudioqosbridged'||_0x5b3cf2===_0x96a0('0x80')||_0x5b3cf2===_0x96a0('0x81')||_0x5b3cf2==='rtpaudioqosloss'||_0x5b3cf2===_0x96a0('0x82')||_0x5b3cf2==='rtpaudioqosrtt'||_0x5b3cf2==='rtpaudioqosrttbridged'||_0x5b3cf2===_0x96a0('0x85')||_0x5b3cf2===_0x96a0('0x86')||_0x5b3cf2===_0x96a0('0x33')||_0x5b3cf2===_0x96a0('0x34')){return![];}return!![];};exports['getCallerIdRandom']=function(_0x948d45,_0x5d0507){var _0x368169,_0x557b6f,_0x559d9a;if(_0x5d0507<=0x0){_0x5d0507=0x1;}_0x368169=new RegExp(_0x96a0('0x87')+_0x5d0507+'}$');_0x557b6f=Math[_0x96a0('0x88')](0xa,_0x5d0507-0x1);_0x559d9a=Math[_0x96a0('0x88')](0xa,_0x5d0507)-0x1;return util[_0x96a0('0x10')]('%s',_['replace'](_0x948d45,_0x368169,_['random'](_0x557b6f,_0x559d9a)));};exports[_0x96a0('0x89')]=function(_0x4292dd){var _0x1e8701=_0x4292dd['match'](/"(.*?)"/);return _0x1e8701?_0x1e8701[0x1]:_0x4292dd;};exports['extractCalleridNumber']=function(_0x5aeef3){var _0x48c317=_0x5aeef3[_0x96a0('0x8a')](/<(.*?)>/);return _0x48c317?_0x48c317[0x1]:_0x5aeef3;};function buildNoAnswerEventPayload(_0x36ac9f,_0x2b43da){var _0x6b4b78=buildObj(_0x36ac9f,_0x96a0('0x8b'));if(!_[_0x96a0('0x1d')](_0x2b43da['variables'])){Object[_0x96a0('0x8c')](_0x2b43da[_0x96a0('0x8d')])[_0x96a0('0x8e')](function(_0x119038){_0x6b4b78[_0x119038[_0x96a0('0x8f')]()]=_0x2b43da[_0x96a0('0x8d')][_0x119038];});}return _0x6b4b78;}exports[_0x96a0('0x90')]=buildNoAnswerEventPayload; \ No newline at end of file diff --git a/server/services/ami/properties.js b/server/services/ami/properties.js index 83a13db..2fcb894 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 _0xbe6e=['voicequeuechannelhangup','voicequeuechannelredirect','string','number','boolean','queueremove','queuepause','reload','voicequeuechannel','voicechannel'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xbe6e,0x138));var _0xebe6=function(_0x3444d5,_0x296135){_0x3444d5=_0x3444d5-0x0;var _0x2a7c74=_0xbe6e[_0x3444d5];return _0x2a7c74;};'use strict';exports['queueadd']={'queue':{'type':'string','required':!![]},'interface':{'type':_0xebe6('0x0'),'required':!![]},'membername':{'type':_0xebe6('0x0'),'required':!![]},'penalty':{'type':_0xebe6('0x1'),'required':![]},'paused':{'type':_0xebe6('0x2'),'required':![]}};exports[_0xebe6('0x3')]={'queue':{'type':_0xebe6('0x0'),'required':!![]},'interface':{'type':'string','required':!![]}};exports[_0xebe6('0x4')]={'interface':{'type':_0xebe6('0x0'),'required':!![]},'paused':{'type':_0xebe6('0x2')},'reason':{'type':_0xebe6('0x0'),'required':![]}};exports[_0xebe6('0x5')]={'module':{'type':_0xebe6('0x0'),'required':![]}};exports[_0xebe6('0x6')]={'uniqueid':{'type':_0xebe6('0x0'),'required':!![]}};exports[_0xebe6('0x7')]={'uniqueid':{'type':_0xebe6('0x0'),'required':!![]},'filename':{'type':_0xebe6('0x0')},'format':{'type':_0xebe6('0x0')},'mixmonitorid':{'type':'string'}};exports[_0xebe6('0x8')]={'uniqueid':{'type':'string','required':!![]}};exports[_0xebe6('0x9')]={'uniqueid':{'type':_0xebe6('0x0'),'required':!![]},'exten':{'type':_0xebe6('0x0'),'required':!![]},'context':{'type':_0xebe6('0x0')}}; \ No newline at end of file +var _0xf9c6=['queueremove','queuepause','reload','voicequeuechannel','voicechannel','voicequeuechannelhangup','voicequeuechannelredirect','queueadd','string','number','boolean'];(function(_0x2de136,_0x30893d){var _0x3d9022=function(_0x46aa8b){while(--_0x46aa8b){_0x2de136['push'](_0x2de136['shift']());}};_0x3d9022(++_0x30893d);}(_0xf9c6,0x15c));var _0x6f9c=function(_0xfa5185,_0x4f3a29){_0xfa5185=_0xfa5185-0x0;var _0x2a02be=_0xf9c6[_0xfa5185];return _0x2a02be;};'use strict';exports[_0x6f9c('0x0')]={'queue':{'type':_0x6f9c('0x1'),'required':!![]},'interface':{'type':_0x6f9c('0x1'),'required':!![]},'membername':{'type':_0x6f9c('0x1'),'required':!![]},'penalty':{'type':_0x6f9c('0x2'),'required':![]},'paused':{'type':_0x6f9c('0x3'),'required':![]}};exports[_0x6f9c('0x4')]={'queue':{'type':'string','required':!![]},'interface':{'type':_0x6f9c('0x1'),'required':!![]}};exports[_0x6f9c('0x5')]={'interface':{'type':'string','required':!![]},'paused':{'type':_0x6f9c('0x3')},'reason':{'type':_0x6f9c('0x1'),'required':![]}};exports[_0x6f9c('0x6')]={'module':{'type':_0x6f9c('0x1'),'required':![]}};exports[_0x6f9c('0x7')]={'uniqueid':{'type':_0x6f9c('0x1'),'required':!![]}};exports[_0x6f9c('0x8')]={'uniqueid':{'type':_0x6f9c('0x1'),'required':!![]},'filename':{'type':'string'},'format':{'type':_0x6f9c('0x1')},'mixmonitorid':{'type':_0x6f9c('0x1')}};exports[_0x6f9c('0x9')]={'uniqueid':{'type':'string','required':!![]}};exports[_0x6f9c('0xa')]={'uniqueid':{'type':_0x6f9c('0x1'),'required':!![]},'exten':{'type':_0x6f9c('0x1'),'required':!![]},'context':{'type':_0x6f9c('0x1')}}; \ No newline at end of file diff --git a/server/services/ami/realtime/index.js b/server/services/ami/realtime/index.js index 4b86fd4..cba1c23 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 _0x5f66=['diff','seconds','disposition','ANSWERED','outbound','duration','billableseconds','initCampaigns','campaigns','dialQueueProject','SquareProject','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','initVoiceQueues','exports','moment','../model/agent','../model/telephone','../model/trunk','../model/voiceQueue','../model/trigger','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','telephones','trunks','voiceQueues','triggers','templates','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','sugarcrmAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','faxAccounts','mapKeys','hasOwnProperty','isNil','format','interface','total','answered','sumHoldTime','sumBillable','isEmpty','ivrAnswerCallsDay','unmanaged','abandoned','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundNoSuchCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundAnswerCallsDay','queueStatusComplete','prototype','mergeFromDatabase','initAgents','agents','length','name','isUndefined','initTelephones','SIP/%s','initTriggers','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','initVtigerAccounts','initServicenowAccounts','freshsalesAccounts','initVoiceQueueHopperHistory','initVoiceQueueReports','groupBy','queuecallerexit','queuecallerabandon','queuecallerleaveAt','queuecallerjoinAt','sumDuration','queuecallercompleteAt','queuecallerexitAt'];(function(_0x3d0131,_0xdde07f){var _0x248dee=function(_0x2b31d9){while(--_0x2b31d9){_0x3d0131['push'](_0x3d0131['shift']());}};_0x248dee(++_0xdde07f);}(_0x5f66,0x1a0));var _0x65f6=function(_0x122096,_0x60c295){_0x122096=_0x122096-0x0;var _0x3d1966=_0x5f66[_0x122096];return _0x3d1966;};'use strict';var _=require('lodash');var moment=require(_0x65f6('0x0'));var util=require('util');var Agent=require(_0x65f6('0x1'));var Telephone=require(_0x65f6('0x2'));var Trunk=require(_0x65f6('0x3'));var VoiceQueue=require(_0x65f6('0x4'));var Trigger=require(_0x65f6('0x5'));var Template=require('../model/template');var Campaign=require(_0x65f6('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x65f6('0x7'));var SalesforceAccount=require(_0x65f6('0x8'));var FreshdeskAccount=require('../model/freshdeskAccount');var SugarcrmAccount=require('../model/sugarcrmAccount');var ZohoAccount=require(_0x65f6('0x9'));var DeskAccount=require(_0x65f6('0xa'));var VtigerAccount=require(_0x65f6('0xb'));var ServicenowAccount=require(_0x65f6('0xc'));var Dynamics365Account=require(_0x65f6('0xd'));var FreshsalesAccount=require(_0x65f6('0xe'));var FaxAccount=require('../model/faxAccount');function Realtime(){this['agents']={};this[_0x65f6('0xf')]={};this[_0x65f6('0x10')]={};this[_0x65f6('0x11')]={};this[_0x65f6('0x12')]={};this['campaigns']={};this[_0x65f6('0x13')]={};this['outbound']={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x65f6('0x14')]={};this['queueChannels']={};this[_0x65f6('0x15')]={};this['timers']={};this[_0x65f6('0x16')]={};this[_0x65f6('0x17')]={};this[_0x65f6('0x18')]={};this[_0x65f6('0x19')]={};this[_0x65f6('0x1a')]={};this[_0x65f6('0x1b')]={};this[_0x65f6('0x1c')]={};this[_0x65f6('0x1d')]={};this[_0x65f6('0x1e')]={};this[_0x65f6('0x1f')]={};this['freshsalesAccounts']={};this[_0x65f6('0x20')]={};}function freeIsNotKey(_0x49a913,_0x5dd324,_0x1693e6){var _0x5c69f8=_[_0x65f6('0x21')](_0x49a913,function(_0x1c955c){return _0x1c955c[_0x1693e6];});for(var _0x1b1cbb in _0x5dd324){if(_0x5dd324[_0x65f6('0x22')](_0x1b1cbb)){if(!_0x5c69f8[_0x1b1cbb]){delete _0x5dd324[_0x1b1cbb];}}}}function freeIsNotKeySip(_0xc8660c,_0x18380e){var _0x495dd6=_['mapKeys'](_0xc8660c,function(_0x2d538c){return util['format']('SIP/%s',_0x2d538c['name']);});for(var _0x365159 in _0x18380e){if(_0x18380e[_0x65f6('0x22')](_0x365159)){if(!_0x495dd6[_0x365159]){delete _0x18380e[_0x365159];}}}}function freeIsNotKeyAgent(_0x5114a4,_0x39e19f){var _0x270893=_[_0x65f6('0x21')](_0x5114a4,function(_0x3876ed){var _0x219ab2=_[_0x65f6('0x23')](_0x3876ed['interface'])?util[_0x65f6('0x24')]('SIP/%s',_0x3876ed['name']):_0x3876ed[_0x65f6('0x25')];return _0x219ab2;});for(var _0xd173f4 in _0x39e19f){if(_0x39e19f['hasOwnProperty'](_0xd173f4)){if(!_0x270893[_0xd173f4]){delete _0x39e19f[_0xd173f4];}}}}function clearVoiceCallReports(_0x1eeaaa){_0x1eeaaa[_0x65f6('0x26')]=0x0;_0x1eeaaa[_0x65f6('0x27')]=0x0;_0x1eeaaa[_0x65f6('0x28')]=0x0;_0x1eeaaa['sumDuration']=0x0;_0x1eeaaa[_0x65f6('0x29')]=0x0;}function clearCampaigns(_0x59ea32){if(!_[_0x65f6('0x2a')](_0x59ea32)){for(var _0x5963e0 in _0x59ea32){if(_0x59ea32['hasOwnProperty'](_0x5963e0)){_0x59ea32[_0x5963e0]['ivrTotalCallsDays']=0x0;_0x59ea32[_0x5963e0][_0x65f6('0x2b')]=0x0;}}}}function clearVoiceQueues(_0x16cde8){if(!_['isEmpty'](_0x16cde8)){for(var _0x296cd9 in _0x16cde8){if(_0x16cde8[_0x65f6('0x22')](_0x296cd9)){_0x16cde8[_0x296cd9]['total']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x27')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2c')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2d')]=0x0;_0x16cde8[_0x296cd9]['sumHoldTime']=0x0;_0x16cde8[_0x296cd9]['sumDuration']=0x0;_0x16cde8[_0x296cd9]['sumBillable']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2e')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x2f')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x30')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x31')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x32')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x33')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x34')]=0x0;_0x16cde8[_0x296cd9]['outboundDropCallsDayCallersExit']=0x0;_0x16cde8[_0x296cd9]['outboundBlacklistCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x35')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x36')]=0x0;_0x16cde8[_0x296cd9]['outboundReCallsDay']=0x0;_0x16cde8[_0x296cd9]['outboundAnswerAgiCallsDay']=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x37')]=0x0;_0x16cde8[_0x296cd9][_0x65f6('0x38')]=!![];}}}}Realtime[_0x65f6('0x39')][_0x65f6('0x3a')]=function(_0x1217fd,_0x2d32be){for(var _0x5792a0 in _0x2d32be){if(_0x1217fd[_0x65f6('0x22')](_0x5792a0)){_0x1217fd[_0x5792a0]=_0x2d32be[_0x5792a0];}}};Realtime[_0x65f6('0x39')][_0x65f6('0x3b')]=function(){var _0x4bc037=this;return function(_0x217f35){if(_0x217f35){freeIsNotKeyAgent(_0x217f35,_0x4bc037[_0x65f6('0x3c')]);for(var _0xbaed3c=0x0,_0x45510a={};_0xbaed3c<_0x217f35[_0x65f6('0x3d')];_0xbaed3c+=0x1){_0x45510a=_0x217f35[_0xbaed3c];var _0x2f054c=_['isNil'](_0x45510a[_0x65f6('0x25')])?util[_0x65f6('0x24')]('SIP/%s',_0x45510a[_0x65f6('0x3e')]):_0x45510a['interface'];if(_[_0x65f6('0x3f')](_0x4bc037['agents'][_0x2f054c])){_0x4bc037[_0x65f6('0x3c')][_0x2f054c]=new Agent(_0x45510a);}else{_0x4bc037[_0x65f6('0x3a')](_0x4bc037['agents'][_0x2f054c],_0x45510a);}}}return _0x4bc037[_0x65f6('0x3c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x40')]=function(){var _0x515648=this;return function(_0x582c7e){if(_0x582c7e){freeIsNotKeySip(_0x582c7e,_0x515648[_0x65f6('0xf')]);for(var _0x4c0df4=0x0,_0x26de30={};_0x4c0df4<_0x582c7e['length'];_0x4c0df4+=0x1){_0x26de30=_0x582c7e[_0x4c0df4];if(_[_0x65f6('0x3f')](_0x515648[_0x65f6('0xf')][util['format'](_0x65f6('0x41'),_0x26de30['name'])])){_0x515648['telephones'][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])]=new Telephone(_0x26de30);}else{_0x515648[_0x65f6('0x3a')](_0x515648[_0x65f6('0xf')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x26de30[_0x65f6('0x3e')])],_0x26de30);}}}return _0x515648['telephones'];};};Realtime[_0x65f6('0x39')]['initTrunks']=function(){var _0x12a589=this;return function(_0xa4394a){if(_0xa4394a){freeIsNotKeySip(_0xa4394a,_0x12a589[_0x65f6('0x10')]);for(var _0x2ea7f7=0x0,_0x5ef5c2={};_0x2ea7f7<_0xa4394a[_0x65f6('0x3d')];_0x2ea7f7+=0x1){_0x5ef5c2=_0xa4394a[_0x2ea7f7];if(_[_0x65f6('0x3f')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])])){_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2['name'])]=new Trunk(_0x5ef5c2);}else{_0x12a589[_0x65f6('0x3a')](_0x12a589[_0x65f6('0x10')][util[_0x65f6('0x24')](_0x65f6('0x41'),_0x5ef5c2[_0x65f6('0x3e')])],_0x5ef5c2);}}}return _0x12a589[_0x65f6('0x10')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x42')]=function(){var _0x461393=this;return function(_0x2abbed){if(_0x2abbed){freeIsNotKey(_0x2abbed,_0x461393[_0x65f6('0x12')],'id');for(var _0x2c008a=0x0,_0x6c4d94={};_0x2c008a<_0x2abbed[_0x65f6('0x3d')];_0x2c008a+=0x1){_0x6c4d94=_0x2abbed[_0x2c008a];if(_[_0x65f6('0x3f')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']])){_0x461393['triggers'][_0x6c4d94['id']]=new Trigger(_0x6c4d94);}else{_0x461393[_0x65f6('0x3a')](_0x461393[_0x65f6('0x12')][_0x6c4d94['id']],_0x6c4d94);}}}return _0x461393[_0x65f6('0x12')];};};Realtime[_0x65f6('0x39')]['initTemplates']=function(){var _0x1bf5bf=this;return function(_0x2d0dac){if(_0x2d0dac){freeIsNotKey(_0x2d0dac,_0x1bf5bf[_0x65f6('0x13')],'id');for(var _0x5e69b4=0x0,_0x2dbab3={};_0x5e69b4<_0x2d0dac[_0x65f6('0x3d')];_0x5e69b4+=0x1){_0x2dbab3=_0x2d0dac[_0x5e69b4];if(_[_0x65f6('0x3f')](_0x1bf5bf[_0x65f6('0x13')][_0x2dbab3['id']])){_0x1bf5bf['templates'][_0x2dbab3['id']]=new Template(_0x2dbab3);}else{_0x1bf5bf[_0x65f6('0x3a')](_0x1bf5bf['templates'][_0x2dbab3['id']],_0x2dbab3);}}}return _0x1bf5bf[_0x65f6('0x13')];};};Realtime[_0x65f6('0x39')]['initZendeskAccounts']=function(){var _0xf754ee=this;return function(_0x5085db){if(_0x5085db){freeIsNotKey(_0x5085db,_0xf754ee[_0x65f6('0x17')],'id');for(var _0x4d9b76=0x0,_0x2d1706={};_0x4d9b76<_0x5085db[_0x65f6('0x3d')];_0x4d9b76+=0x1){_0x2d1706=_0x5085db[_0x4d9b76];if(_[_0x65f6('0x3f')](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']])){_0xf754ee['zendeskAccounts'][_0x2d1706['id']]=new ZendeskAccount(_0x2d1706);}else{_0xf754ee['mergeFromDatabase'](_0xf754ee[_0x65f6('0x17')][_0x2d1706['id']],_0x2d1706);}}}return _0xf754ee[_0x65f6('0x17')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x43')]=function(){var _0x3b907c=this;return function(_0x2d6ab9){if(_0x2d6ab9){freeIsNotKey(_0x2d6ab9,_0x3b907c[_0x65f6('0x18')],'id');for(var _0x41690c=0x0,_0x414f49={};_0x41690c<_0x2d6ab9['length'];_0x41690c+=0x1){_0x414f49=_0x2d6ab9[_0x41690c];if(_[_0x65f6('0x3f')](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']])){_0x3b907c[_0x65f6('0x18')][_0x414f49['id']]=new SalesforceAccount(_0x414f49);}else{_0x3b907c['mergeFromDatabase'](_0x3b907c[_0x65f6('0x18')][_0x414f49['id']],_0x414f49);}}}return _0x3b907c[_0x65f6('0x18')];};};Realtime['prototype'][_0x65f6('0x44')]=function(){var _0x253d52=this;return function(_0x57eb04){if(_0x57eb04){freeIsNotKey(_0x57eb04,_0x253d52[_0x65f6('0x1a')],'id');for(var _0x4f96c4=0x0,_0x247be3={};_0x4f96c4<_0x57eb04[_0x65f6('0x3d')];_0x4f96c4+=0x1){_0x247be3=_0x57eb04[_0x4f96c4];if(_[_0x65f6('0x3f')](_0x253d52['freshdeskAccounts'][_0x247be3['id']])){_0x253d52[_0x65f6('0x1a')][_0x247be3['id']]=new FreshdeskAccount(_0x247be3);}else{_0x253d52[_0x65f6('0x3a')](_0x253d52['freshdeskAccounts'][_0x247be3['id']],_0x247be3);}}}return _0x253d52[_0x65f6('0x1a')];};};Realtime[_0x65f6('0x39')]['initZohoAccounts']=function(){var _0x34d6a9=this;return function(_0x344c0e){if(_0x344c0e){freeIsNotKey(_0x344c0e,_0x34d6a9[_0x65f6('0x1b')],'id');for(var _0x25d504=0x0,_0x234fa7={};_0x25d504<_0x344c0e[_0x65f6('0x3d')];_0x25d504+=0x1){_0x234fa7=_0x344c0e[_0x25d504];if(_[_0x65f6('0x3f')](_0x34d6a9[_0x65f6('0x1b')][_0x234fa7['id']])){_0x34d6a9['zohoAccounts'][_0x234fa7['id']]=new ZohoAccount(_0x234fa7);}else{_0x34d6a9['mergeFromDatabase'](_0x34d6a9['zohoAccounts'][_0x234fa7['id']],_0x234fa7);}}}return _0x34d6a9[_0x65f6('0x1b')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x45')]=function(){var _0x20c322=this;return function(_0x545445){if(_0x545445){freeIsNotKey(_0x545445,_0x20c322[_0x65f6('0x1c')],'id');for(var _0x2032b9=0x0,_0x9ff849={};_0x2032b9<_0x545445['length'];_0x2032b9+=0x1){_0x9ff849=_0x545445[_0x2032b9];if(_[_0x65f6('0x3f')](_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']])){_0x20c322[_0x65f6('0x1c')][_0x9ff849['id']]=new DeskAccount(_0x9ff849);}else{_0x20c322['mergeFromDatabase'](_0x20c322['deskAccounts'][_0x9ff849['id']],_0x9ff849);}}}return _0x20c322[_0x65f6('0x1c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x46')]=function(){var _0x39364f=this;return function(_0x2a76b3){if(_0x2a76b3){freeIsNotKey(_0x2a76b3,_0x39364f[_0x65f6('0x19')],'id');for(var _0x35d77f=0x0,_0x138334={};_0x35d77f<_0x2a76b3[_0x65f6('0x3d')];_0x35d77f+=0x1){_0x138334=_0x2a76b3[_0x35d77f];if(_[_0x65f6('0x3f')](_0x39364f[_0x65f6('0x19')][_0x138334['id']])){_0x39364f[_0x65f6('0x19')][_0x138334['id']]=new SugarcrmAccount(_0x138334);}else{_0x39364f[_0x65f6('0x3a')](_0x39364f[_0x65f6('0x19')][_0x138334['id']],_0x138334);}}}return _0x39364f['sugarcrmAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x47')]=function(){var _0x42a805=this;return function(_0x4b4efe){if(_0x4b4efe){freeIsNotKey(_0x4b4efe,_0x42a805[_0x65f6('0x1d')],'id');for(var _0x16dec0=0x0,_0x4638c9={};_0x16dec0<_0x4b4efe[_0x65f6('0x3d')];_0x16dec0+=0x1){_0x4638c9=_0x4b4efe[_0x16dec0];if(_['isUndefined'](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']])){_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']]=new VtigerAccount(_0x4638c9);}else{_0x42a805[_0x65f6('0x3a')](_0x42a805[_0x65f6('0x1d')][_0x4638c9['id']],_0x4638c9);}}}return _0x42a805['vtigerAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x48')]=function(){var _0x5c55e4=this;return function(_0x28682b){if(_0x28682b){freeIsNotKey(_0x28682b,_0x5c55e4[_0x65f6('0x1e')],'id');for(var _0x36c316=0x0,_0x51549d={};_0x36c316<_0x28682b[_0x65f6('0x3d')];_0x36c316+=0x1){_0x51549d=_0x28682b[_0x36c316];if(_[_0x65f6('0x3f')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']])){_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']]=new ServicenowAccount(_0x51549d);}else{_0x5c55e4[_0x65f6('0x3a')](_0x5c55e4[_0x65f6('0x1e')][_0x51549d['id']],_0x51549d);}}}return _0x5c55e4['servicenowAccounts'];};};Realtime['prototype']['initDynamics365Accounts']=function(){var _0x336a7d=this;return function(_0x367d95){if(_0x367d95){freeIsNotKey(_0x367d95,_0x336a7d[_0x65f6('0x1f')],'id');for(var _0x471bec=0x0,_0xab6f0={};_0x471bec<_0x367d95[_0x65f6('0x3d')];_0x471bec+=0x1){_0xab6f0=_0x367d95[_0x471bec];if(_['isUndefined'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']])){_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']]=new Dynamics365Account(_0xab6f0);}else{_0x336a7d['mergeFromDatabase'](_0x336a7d[_0x65f6('0x1f')][_0xab6f0['id']],_0xab6f0);}}}return _0x336a7d[_0x65f6('0x1f')];};};Realtime[_0x65f6('0x39')]['initFreshsalesAccounts']=function(){var _0x23c441=this;return function(_0x448c9a){if(_0x448c9a){freeIsNotKey(_0x448c9a,_0x23c441['freshsalesAccounts'],'id');for(var _0x271d76=0x0,_0x3edc6b={};_0x271d76<_0x448c9a[_0x65f6('0x3d')];_0x271d76+=0x1){_0x3edc6b=_0x448c9a[_0x271d76];if(_[_0x65f6('0x3f')](_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']])){_0x23c441[_0x65f6('0x49')][_0x3edc6b['id']]=new FreshsalesAccount(_0x3edc6b);}else{_0x23c441[_0x65f6('0x3a')](_0x23c441['freshsalesAccounts'][_0x3edc6b['id']],_0x3edc6b);}}}return _0x23c441['freshsalesAccounts'];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4a')]=function(){var _0x4a9524=this;return function(_0x417ba5){for(var _0x5f3df9=0x0;_0x5f3df9<_0x417ba5[_0x65f6('0x3d')];_0x5f3df9+=0x1){_['merge'](_0x4a9524[_0x65f6('0x11')][_0x417ba5[_0x5f3df9][_0x65f6('0x3e')]],_0x417ba5[_0x5f3df9]);}return _0x4a9524[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x4b')]=function(){var _0x264e6c=this;return function(_0x1aaf75){clearVoiceQueues(_0x264e6c[_0x65f6('0x11')]);if(_0x1aaf75){_0x1aaf75=_[_0x65f6('0x4c')](_0x1aaf75,'uniqueid');for(var _0x480190 in _0x1aaf75){if(_0x1aaf75[_0x65f6('0x22')](_0x480190)){for(var _0x13ee4b=0x0;_0x13ee4b<_0x1aaf75[_0x480190][_0x65f6('0x3d')];_0x13ee4b+=0x1){var _0x51497f=_0x1aaf75[_0x480190][_0x13ee4b]['queue'];if(_0x264e6c[_0x65f6('0x11')][_0x51497f]){if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4d')]){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x2c')]+=0x1;}if(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4e')]){_0x264e6c[_0x65f6('0x11')][_0x51497f]['abandoned']+=0x1;}_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x4f')])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;if(_0x13ee4b===_0x1aaf75[_0x480190][_0x65f6('0x3d')]-0x1){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x52')]||_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerabandonAt']||_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x53')])[_0x65f6('0x54')](moment(_0x1aaf75[_0x480190][_0x13ee4b][_0x65f6('0x50')]),'seconds')||0x0;_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x26')]+=0x1;if(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercomplete']){_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x27')]+=0x1;_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x29')]+=moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallercompleteAt'])['diff'](moment(_0x1aaf75[_0x480190][_0x13ee4b]['queuecallerleaveAt']),_0x65f6('0x55'))||0x0;}}else{_0x264e6c[_0x65f6('0x11')][_0x51497f][_0x65f6('0x51')]+=_0x264e6c['voiceQueues'][_0x51497f][_0x65f6('0x28')]||0x0;}}}}}}return _0x264e6c[_0x65f6('0x11')];};};Realtime[_0x65f6('0x39')]['initVoiceCallReports']=function(){var _0x40d0f7=this;return function(_0x15809e){clearVoiceCallReports(_0x40d0f7['outbound']);if(_0x15809e){for(var _0x758e80=0x0;_0x758e80<_0x15809e[_0x65f6('0x3d')];_0x758e80+=0x1){_0x40d0f7['outbound'][_0x65f6('0x26')]+=0x1;_0x40d0f7['outbound'][_0x65f6('0x51')]+=_0x15809e[_0x758e80]['duration'];if(_0x15809e[_0x758e80][_0x65f6('0x56')]===_0x65f6('0x57')){_0x40d0f7['outbound'][_0x65f6('0x27')]+=0x1;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x28')]+=_0x15809e[_0x758e80][_0x65f6('0x59')]-_0x15809e[_0x758e80][_0x65f6('0x5a')]||0x0;_0x40d0f7[_0x65f6('0x58')][_0x65f6('0x29')]+=_0x15809e[_0x758e80][_0x65f6('0x5a')];}}}return _0x40d0f7[_0x65f6('0x58')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x5b')]=function(){var _0x574d84=this;return function(_0x10a661){if(_0x10a661){freeIsNotKey(_0x10a661,_0x574d84[_0x65f6('0x5c')],_0x65f6('0x3e'));for(var _0x219e42=0x0,_0x5694f9={};_0x219e42<_0x10a661[_0x65f6('0x3d')];_0x219e42+=0x1){_0x5694f9=_0x10a661[_0x219e42];if(_[_0x65f6('0x3f')](_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]])){_0x574d84['campaigns'][_0x5694f9[_0x65f6('0x3e')]]=new Campaign(_0x5694f9);}else{_0x574d84['mergeFromDatabase'](_0x574d84[_0x65f6('0x5c')][_0x5694f9[_0x65f6('0x3e')]],_0x5694f9);_0x574d84['campaigns'][_0x5694f9['name']][_0x65f6('0x5d')]=_0x5694f9[_0x65f6('0x5e')]?_0x5694f9['SquareProject'][_0x65f6('0x3e')]:undefined;}}}return _0x574d84[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')]['initVoiceExtensions']=function(){var _0x1348ec=this;return function(_0x246510){if(_0x246510){freeIsNotKey(_0x246510,_0x1348ec['voiceExtensions'],'id');for(var _0x36b8de=0x0,_0x504b39={};_0x36b8de<_0x246510[_0x65f6('0x3d')];_0x36b8de+=0x1){_0x504b39=_0x246510[_0x36b8de];if(_['isUndefined'](_0x1348ec['voiceExtensions'][_0x504b39['id']])){_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']]=new VoiceExtension(_0x504b39);}else{_0x1348ec[_0x65f6('0x3a')](_0x1348ec[_0x65f6('0x5f')][_0x504b39['id']],_0x504b39);}}}return _0x1348ec[_0x65f6('0x5f')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x60')]=function(){var _0x1ac46f=this;return function(_0x1f4e2c){clearCampaigns(_0x1ac46f['campaigns']);for(var _0x494904=0x0;_0x494904<_0x1f4e2c[_0x65f6('0x3d')];_0x494904+=0x1){_['merge'](_0x1ac46f[_0x65f6('0x5c')][_0x1f4e2c[_0x494904][_0x65f6('0x3e')]],_0x1f4e2c[_0x494904]);}return _0x1ac46f[_0x65f6('0x5c')];};};Realtime[_0x65f6('0x39')][_0x65f6('0x61')]=function(){var _0x56bd9d=this;return function(_0x398cac){if(_0x398cac){freeIsNotKey(_0x398cac,_0x56bd9d[_0x65f6('0x20')],'id');for(var _0x14c908=0x0,_0x576ecd={};_0x14c908<_0x398cac[_0x65f6('0x3d')];_0x14c908+=0x1){_0x576ecd=_0x398cac[_0x14c908];if(_[_0x65f6('0x3f')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']])){_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']]=new FaxAccount(_0x576ecd);}else{_0x56bd9d[_0x65f6('0x3a')](_0x56bd9d[_0x65f6('0x20')][_0x576ecd['id']],_0x576ecd);}}}return _0x56bd9d['faxAccounts'];};};Realtime['prototype'][_0x65f6('0x62')]=function(){var _0x10d744=this;return function(_0x10c916){if(_0x10c916){freeIsNotKey(_0x10c916,_0x10d744[_0x65f6('0x11')],'name');for(var _0x4bda86=0x0,_0x336076={};_0x4bda86<_0x10c916[_0x65f6('0x3d')];_0x4bda86+=0x1){_0x336076=_0x10c916[_0x4bda86];if(_[_0x65f6('0x3f')](_0x10d744[_0x65f6('0x11')][_0x336076[_0x65f6('0x3e')]])){_0x10d744[_0x65f6('0x11')][_0x336076['name']]=new VoiceQueue(_0x336076);}else{_0x10d744['mergeFromDatabase'](_0x10d744['voiceQueues'][_0x336076[_0x65f6('0x3e')]],_0x336076);}}}return _0x10d744[_0x65f6('0x11')];};};module[_0x65f6('0x63')]=Realtime; \ No newline at end of file +var _0xadb5=['ivrTotalCallsDays','ivrAnswerCallsDay','unmanaged','sumBillable','outboundAnswerAgiCallsDay','outboundNoAnswerCallsDay','outboundBusyCallsDay','outboundCongestionCallsDay','outboundUnknownCallsDay','outboundDropCallsDayTimeout','outboundDropCallsDayCallersExit','outboundBlacklistCallsDay','outboundOriginateFailureCallsDay','outboundRejectCallsDay','outboundReCallsDay','outboundAnswerCallsDay','queueStatusComplete','mergeFromDatabase','prototype','initAgents','initTelephones','length','isUndefined','triggers','initTemplates','initZendeskAccounts','initSalesforceAccounts','initFreshdeskAccounts','initDeskAccounts','initSugarcrmAccounts','sugarcrmAccounts','initVtigerAccounts','vtigerAccounts','initServicenowAccounts','dynamics365Accounts','initFreshsalesAccounts','initVoiceQueueHopperHistory','merge','initVoiceQueueReports','voiceQueues','groupBy','uniqueid','queue','queuecallerexit','queuecallerabandon','abandoned','queuecallerleaveAt','diff','seconds','queuecallerabandonAt','queuecallerexitAt','queuecallerjoinAt','queuecallercomplete','queuecallercompleteAt','duration','ANSWERED','billableseconds','initCampaigns','dialQueueProject','initVoiceExtensions','voiceExtensions','initCampaignHopperHistory','initFaxAccounts','moment','../model/agent','../model/telephone','../model/trunk','../model/trigger','../model/template','../model/campaign','../model/zendeskAccount','../model/salesforceAccount','../model/freshdeskAccount','../model/sugarcrmAccount','../model/zohoAccount','../model/deskAccount','../model/vtigerAccount','../model/servicenowAccount','../model/dynamics365Account','../model/freshsalesAccount','../model/faxAccount','agents','telephones','trunks','campaigns','templates','outbound','channels','outboundChannels','settings','zendeskAccounts','salesforceAccounts','freshdeskAccounts','zohoAccounts','deskAccounts','servicenowAccounts','freshsalesAccounts','faxAccounts','mapKeys','name','hasOwnProperty','isNil','interface','format','SIP/%s','total','answered','sumHoldTime','sumDuration','isEmpty'];(function(_0x10fe90,_0x50ca9c){var _0x4b684e=function(_0x1b1c34){while(--_0x1b1c34){_0x10fe90['push'](_0x10fe90['shift']());}};_0x4b684e(++_0x50ca9c);}(_0xadb5,0xad));var _0x5adb=function(_0x611609,_0x2fac15){_0x611609=_0x611609-0x0;var _0x44b4bc=_0xadb5[_0x611609];return _0x44b4bc;};'use strict';var _=require('lodash');var moment=require(_0x5adb('0x0'));var util=require('util');var Agent=require(_0x5adb('0x1'));var Telephone=require(_0x5adb('0x2'));var Trunk=require(_0x5adb('0x3'));var VoiceQueue=require('../model/voiceQueue');var Trigger=require(_0x5adb('0x4'));var Template=require(_0x5adb('0x5'));var Campaign=require(_0x5adb('0x6'));var VoiceExtension=require('../model/voiceExtension');var ZendeskAccount=require(_0x5adb('0x7'));var SalesforceAccount=require(_0x5adb('0x8'));var FreshdeskAccount=require(_0x5adb('0x9'));var SugarcrmAccount=require(_0x5adb('0xa'));var ZohoAccount=require(_0x5adb('0xb'));var DeskAccount=require(_0x5adb('0xc'));var VtigerAccount=require(_0x5adb('0xd'));var ServicenowAccount=require(_0x5adb('0xe'));var Dynamics365Account=require(_0x5adb('0xf'));var FreshsalesAccount=require(_0x5adb('0x10'));var FaxAccount=require(_0x5adb('0x11'));function Realtime(){this[_0x5adb('0x12')]={};this[_0x5adb('0x13')]={};this[_0x5adb('0x14')]={};this['voiceQueues']={};this['triggers']={};this[_0x5adb('0x15')]={};this[_0x5adb('0x16')]={};this[_0x5adb('0x17')]={'total':0x0,'answered':0x0,'sumHoldTime':0x0,'sumDuration':0x0,'sumBillable':0x0};this['voiceExtensions']={};this[_0x5adb('0x18')]={};this['queueChannels']={};this[_0x5adb('0x19')]={};this['timers']={};this[_0x5adb('0x1a')]={};this[_0x5adb('0x1b')]={};this[_0x5adb('0x1c')]={};this['sugarcrmAccounts']={};this[_0x5adb('0x1d')]={};this[_0x5adb('0x1e')]={};this[_0x5adb('0x1f')]={};this['vtigerAccounts']={};this[_0x5adb('0x20')]={};this['dynamics365Accounts']={};this[_0x5adb('0x21')]={};this[_0x5adb('0x22')]={};}function freeIsNotKey(_0x30614e,_0x304784,_0x1c0f97){var _0x39d24d=_[_0x5adb('0x23')](_0x30614e,function(_0x42f4c6){return _0x42f4c6[_0x1c0f97];});for(var _0xb953a6 in _0x304784){if(_0x304784['hasOwnProperty'](_0xb953a6)){if(!_0x39d24d[_0xb953a6]){delete _0x304784[_0xb953a6];}}}}function freeIsNotKeySip(_0x3fff62,_0x5de028){var _0x1d9e86=_['mapKeys'](_0x3fff62,function(_0x3ef465){return util['format']('SIP/%s',_0x3ef465[_0x5adb('0x24')]);});for(var _0x1bed20 in _0x5de028){if(_0x5de028[_0x5adb('0x25')](_0x1bed20)){if(!_0x1d9e86[_0x1bed20]){delete _0x5de028[_0x1bed20];}}}}function freeIsNotKeyAgent(_0x1fd4a7,_0x99bc6c){var _0x5af69d=_[_0x5adb('0x23')](_0x1fd4a7,function(_0x5c296e){var _0x4e9f16=_[_0x5adb('0x26')](_0x5c296e[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x5c296e[_0x5adb('0x24')]):_0x5c296e[_0x5adb('0x27')];return _0x4e9f16;});for(var _0xfd9bb9 in _0x99bc6c){if(_0x99bc6c['hasOwnProperty'](_0xfd9bb9)){if(!_0x5af69d[_0xfd9bb9]){delete _0x99bc6c[_0xfd9bb9];}}}}function clearVoiceCallReports(_0x4b1957){_0x4b1957[_0x5adb('0x2a')]=0x0;_0x4b1957[_0x5adb('0x2b')]=0x0;_0x4b1957[_0x5adb('0x2c')]=0x0;_0x4b1957[_0x5adb('0x2d')]=0x0;_0x4b1957['sumBillable']=0x0;}function clearCampaigns(_0x2fee18){if(!_[_0x5adb('0x2e')](_0x2fee18)){for(var _0x5aed76 in _0x2fee18){if(_0x2fee18[_0x5adb('0x25')](_0x5aed76)){_0x2fee18[_0x5aed76][_0x5adb('0x2f')]=0x0;_0x2fee18[_0x5aed76][_0x5adb('0x30')]=0x0;}}}}function clearVoiceQueues(_0x55b40a){if(!_[_0x5adb('0x2e')](_0x55b40a)){for(var _0xbe21b1 in _0x55b40a){if(_0x55b40a[_0x5adb('0x25')](_0xbe21b1)){_0x55b40a[_0xbe21b1][_0x5adb('0x2a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x2b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x31')]=0x0;_0x55b40a[_0xbe21b1]['abandoned']=0x0;_0x55b40a[_0xbe21b1]['sumHoldTime']=0x0;_0x55b40a[_0xbe21b1]['sumDuration']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x32')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x34')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x35')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x36')]=0x0;_0x55b40a[_0xbe21b1]['outboundNoSuchCallsDay']=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x37')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x38')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x39')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3a')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3b')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3c')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3d')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x33')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3e')]=0x0;_0x55b40a[_0xbe21b1][_0x5adb('0x3f')]=!![];}}}}Realtime['prototype'][_0x5adb('0x40')]=function(_0x4c8b2e,_0x12424d){for(var _0x20cde6 in _0x12424d){if(_0x4c8b2e['hasOwnProperty'](_0x20cde6)){_0x4c8b2e[_0x20cde6]=_0x12424d[_0x20cde6];}}};Realtime[_0x5adb('0x41')][_0x5adb('0x42')]=function(){var _0x461a39=this;return function(_0x4a3661){if(_0x4a3661){freeIsNotKeyAgent(_0x4a3661,_0x461a39[_0x5adb('0x12')]);for(var _0x14cf00=0x0,_0x4b5887={};_0x14cf00<_0x4a3661['length'];_0x14cf00+=0x1){_0x4b5887=_0x4a3661[_0x14cf00];var _0x1ed9ea=_['isNil'](_0x4b5887[_0x5adb('0x27')])?util[_0x5adb('0x28')](_0x5adb('0x29'),_0x4b5887[_0x5adb('0x24')]):_0x4b5887[_0x5adb('0x27')];if(_['isUndefined'](_0x461a39[_0x5adb('0x12')][_0x1ed9ea])){_0x461a39[_0x5adb('0x12')][_0x1ed9ea]=new Agent(_0x4b5887);}else{_0x461a39[_0x5adb('0x40')](_0x461a39['agents'][_0x1ed9ea],_0x4b5887);}}}return _0x461a39['agents'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x43')]=function(){var _0x586820=this;return function(_0x2355bc){if(_0x2355bc){freeIsNotKeySip(_0x2355bc,_0x586820['telephones']);for(var _0x199d3b=0x0,_0x58cc5d={};_0x199d3b<_0x2355bc[_0x5adb('0x44')];_0x199d3b+=0x1){_0x58cc5d=_0x2355bc[_0x199d3b];if(_['isUndefined'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')]('SIP/%s',_0x58cc5d[_0x5adb('0x24')])])){_0x586820['telephones'][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])]=new Telephone(_0x58cc5d);}else{_0x586820['mergeFromDatabase'](_0x586820[_0x5adb('0x13')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x58cc5d[_0x5adb('0x24')])],_0x58cc5d);}}}return _0x586820[_0x5adb('0x13')];};};Realtime['prototype']['initTrunks']=function(){var _0x4f491a=this;return function(_0x599999){if(_0x599999){freeIsNotKeySip(_0x599999,_0x4f491a[_0x5adb('0x14')]);for(var _0x2fbe14=0x0,_0x3a104a={};_0x2fbe14<_0x599999[_0x5adb('0x44')];_0x2fbe14+=0x1){_0x3a104a=_0x599999[_0x2fbe14];if(_[_0x5adb('0x45')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])])){_0x4f491a['trunks'][util[_0x5adb('0x28')]('SIP/%s',_0x3a104a[_0x5adb('0x24')])]=new Trunk(_0x3a104a);}else{_0x4f491a[_0x5adb('0x40')](_0x4f491a[_0x5adb('0x14')][util[_0x5adb('0x28')](_0x5adb('0x29'),_0x3a104a['name'])],_0x3a104a);}}}return _0x4f491a[_0x5adb('0x14')];};};Realtime[_0x5adb('0x41')]['initTriggers']=function(){var _0x4160ad=this;return function(_0x1a256c){if(_0x1a256c){freeIsNotKey(_0x1a256c,_0x4160ad['triggers'],'id');for(var _0x120497=0x0,_0x407a4c={};_0x120497<_0x1a256c[_0x5adb('0x44')];_0x120497+=0x1){_0x407a4c=_0x1a256c[_0x120497];if(_[_0x5adb('0x45')](_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']])){_0x4160ad[_0x5adb('0x46')][_0x407a4c['id']]=new Trigger(_0x407a4c);}else{_0x4160ad[_0x5adb('0x40')](_0x4160ad['triggers'][_0x407a4c['id']],_0x407a4c);}}}return _0x4160ad['triggers'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x47')]=function(){var _0x1cd0a3=this;return function(_0xb79d85){if(_0xb79d85){freeIsNotKey(_0xb79d85,_0x1cd0a3['templates'],'id');for(var _0x507e48=0x0,_0xaa32e4={};_0x507e48<_0xb79d85[_0x5adb('0x44')];_0x507e48+=0x1){_0xaa32e4=_0xb79d85[_0x507e48];if(_[_0x5adb('0x45')](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']])){_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']]=new Template(_0xaa32e4);}else{_0x1cd0a3['mergeFromDatabase'](_0x1cd0a3[_0x5adb('0x16')][_0xaa32e4['id']],_0xaa32e4);}}}return _0x1cd0a3[_0x5adb('0x16')];};};Realtime['prototype'][_0x5adb('0x48')]=function(){var _0x251f45=this;return function(_0x1cdb03){if(_0x1cdb03){freeIsNotKey(_0x1cdb03,_0x251f45[_0x5adb('0x1b')],'id');for(var _0x186bd2=0x0,_0x3a5409={};_0x186bd2<_0x1cdb03[_0x5adb('0x44')];_0x186bd2+=0x1){_0x3a5409=_0x1cdb03[_0x186bd2];if(_[_0x5adb('0x45')](_0x251f45['zendeskAccounts'][_0x3a5409['id']])){_0x251f45[_0x5adb('0x1b')][_0x3a5409['id']]=new ZendeskAccount(_0x3a5409);}else{_0x251f45['mergeFromDatabase'](_0x251f45['zendeskAccounts'][_0x3a5409['id']],_0x3a5409);}}}return _0x251f45['zendeskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x49')]=function(){var _0x207a81=this;return function(_0x4ba0b5){if(_0x4ba0b5){freeIsNotKey(_0x4ba0b5,_0x207a81[_0x5adb('0x1c')],'id');for(var _0x5cbab5=0x0,_0x177a81={};_0x5cbab5<_0x4ba0b5[_0x5adb('0x44')];_0x5cbab5+=0x1){_0x177a81=_0x4ba0b5[_0x5cbab5];if(_[_0x5adb('0x45')](_0x207a81['salesforceAccounts'][_0x177a81['id']])){_0x207a81[_0x5adb('0x1c')][_0x177a81['id']]=new SalesforceAccount(_0x177a81);}else{_0x207a81['mergeFromDatabase'](_0x207a81[_0x5adb('0x1c')][_0x177a81['id']],_0x177a81);}}}return _0x207a81[_0x5adb('0x1c')];};};Realtime['prototype'][_0x5adb('0x4a')]=function(){var _0x1ab97b=this;return function(_0x3594e3){if(_0x3594e3){freeIsNotKey(_0x3594e3,_0x1ab97b[_0x5adb('0x1d')],'id');for(var _0x372734=0x0,_0x4cb36c={};_0x372734<_0x3594e3[_0x5adb('0x44')];_0x372734+=0x1){_0x4cb36c=_0x3594e3[_0x372734];if(_[_0x5adb('0x45')](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']])){_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']]=new FreshdeskAccount(_0x4cb36c);}else{_0x1ab97b['mergeFromDatabase'](_0x1ab97b[_0x5adb('0x1d')][_0x4cb36c['id']],_0x4cb36c);}}}return _0x1ab97b[_0x5adb('0x1d')];};};Realtime[_0x5adb('0x41')]['initZohoAccounts']=function(){var _0x2b34a8=this;return function(_0xd0e5b7){if(_0xd0e5b7){freeIsNotKey(_0xd0e5b7,_0x2b34a8[_0x5adb('0x1e')],'id');for(var _0xfd3471=0x0,_0x4f2da9={};_0xfd3471<_0xd0e5b7[_0x5adb('0x44')];_0xfd3471+=0x1){_0x4f2da9=_0xd0e5b7[_0xfd3471];if(_[_0x5adb('0x45')](_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']])){_0x2b34a8[_0x5adb('0x1e')][_0x4f2da9['id']]=new ZohoAccount(_0x4f2da9);}else{_0x2b34a8[_0x5adb('0x40')](_0x2b34a8['zohoAccounts'][_0x4f2da9['id']],_0x4f2da9);}}}return _0x2b34a8[_0x5adb('0x1e')];};};Realtime['prototype'][_0x5adb('0x4b')]=function(){var _0x4f7227=this;return function(_0x31ae72){if(_0x31ae72){freeIsNotKey(_0x31ae72,_0x4f7227[_0x5adb('0x1f')],'id');for(var _0x1a9358=0x0,_0x42f6d9={};_0x1a9358<_0x31ae72['length'];_0x1a9358+=0x1){_0x42f6d9=_0x31ae72[_0x1a9358];if(_[_0x5adb('0x45')](_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']])){_0x4f7227[_0x5adb('0x1f')][_0x42f6d9['id']]=new DeskAccount(_0x42f6d9);}else{_0x4f7227['mergeFromDatabase'](_0x4f7227['deskAccounts'][_0x42f6d9['id']],_0x42f6d9);}}}return _0x4f7227['deskAccounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x4c')]=function(){var _0xa5ecc0=this;return function(_0x12a146){if(_0x12a146){freeIsNotKey(_0x12a146,_0xa5ecc0[_0x5adb('0x4d')],'id');for(var _0xb06bee=0x0,_0x204b9b={};_0xb06bee<_0x12a146[_0x5adb('0x44')];_0xb06bee+=0x1){_0x204b9b=_0x12a146[_0xb06bee];if(_[_0x5adb('0x45')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']])){_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']]=new SugarcrmAccount(_0x204b9b);}else{_0xa5ecc0[_0x5adb('0x40')](_0xa5ecc0[_0x5adb('0x4d')][_0x204b9b['id']],_0x204b9b);}}}return _0xa5ecc0['sugarcrmAccounts'];};};Realtime['prototype'][_0x5adb('0x4e')]=function(){var _0x27a8e4=this;return function(_0x43cde9){if(_0x43cde9){freeIsNotKey(_0x43cde9,_0x27a8e4[_0x5adb('0x4f')],'id');for(var _0x5d7a9f=0x0,_0xfba0d5={};_0x5d7a9f<_0x43cde9[_0x5adb('0x44')];_0x5d7a9f+=0x1){_0xfba0d5=_0x43cde9[_0x5d7a9f];if(_['isUndefined'](_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']])){_0x27a8e4[_0x5adb('0x4f')][_0xfba0d5['id']]=new VtigerAccount(_0xfba0d5);}else{_0x27a8e4[_0x5adb('0x40')](_0x27a8e4['vtigerAccounts'][_0xfba0d5['id']],_0xfba0d5);}}}return _0x27a8e4[_0x5adb('0x4f')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x50')]=function(){var _0x30c92c=this;return function(_0x330290){if(_0x330290){freeIsNotKey(_0x330290,_0x30c92c[_0x5adb('0x20')],'id');for(var _0x513f26=0x0,_0x836b91={};_0x513f26<_0x330290[_0x5adb('0x44')];_0x513f26+=0x1){_0x836b91=_0x330290[_0x513f26];if(_[_0x5adb('0x45')](_0x30c92c['servicenowAccounts'][_0x836b91['id']])){_0x30c92c[_0x5adb('0x20')][_0x836b91['id']]=new ServicenowAccount(_0x836b91);}else{_0x30c92c[_0x5adb('0x40')](_0x30c92c[_0x5adb('0x20')][_0x836b91['id']],_0x836b91);}}}return _0x30c92c['servicenowAccounts'];};};Realtime[_0x5adb('0x41')]['initDynamics365Accounts']=function(){var _0xa8ff64=this;return function(_0x1e7e3a){if(_0x1e7e3a){freeIsNotKey(_0x1e7e3a,_0xa8ff64[_0x5adb('0x51')],'id');for(var _0x57f0a4=0x0,_0x192b1f={};_0x57f0a4<_0x1e7e3a[_0x5adb('0x44')];_0x57f0a4+=0x1){_0x192b1f=_0x1e7e3a[_0x57f0a4];if(_['isUndefined'](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']])){_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']]=new Dynamics365Account(_0x192b1f);}else{_0xa8ff64[_0x5adb('0x40')](_0xa8ff64[_0x5adb('0x51')][_0x192b1f['id']],_0x192b1f);}}}return _0xa8ff64['dynamics365Accounts'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x52')]=function(){var _0x307f07=this;return function(_0x16716e){if(_0x16716e){freeIsNotKey(_0x16716e,_0x307f07['freshsalesAccounts'],'id');for(var _0x53a4bc=0x0,_0x304512={};_0x53a4bc<_0x16716e['length'];_0x53a4bc+=0x1){_0x304512=_0x16716e[_0x53a4bc];if(_['isUndefined'](_0x307f07['freshsalesAccounts'][_0x304512['id']])){_0x307f07[_0x5adb('0x21')][_0x304512['id']]=new FreshsalesAccount(_0x304512);}else{_0x307f07[_0x5adb('0x40')](_0x307f07['freshsalesAccounts'][_0x304512['id']],_0x304512);}}}return _0x307f07[_0x5adb('0x21')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x53')]=function(){var _0xf6ef8a=this;return function(_0x358a23){for(var _0x126e38=0x0;_0x126e38<_0x358a23[_0x5adb('0x44')];_0x126e38+=0x1){_[_0x5adb('0x54')](_0xf6ef8a['voiceQueues'][_0x358a23[_0x126e38]['name']],_0x358a23[_0x126e38]);}return _0xf6ef8a['voiceQueues'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x55')]=function(){var _0x3a0d1b=this;return function(_0x2a55a3){clearVoiceQueues(_0x3a0d1b[_0x5adb('0x56')]);if(_0x2a55a3){_0x2a55a3=_[_0x5adb('0x57')](_0x2a55a3,_0x5adb('0x58'));for(var _0x25f761 in _0x2a55a3){if(_0x2a55a3['hasOwnProperty'](_0x25f761)){for(var _0x5e55c2=0x0;_0x5e55c2<_0x2a55a3[_0x25f761][_0x5adb('0x44')];_0x5e55c2+=0x1){var _0x56df90=_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x59')];if(_0x3a0d1b[_0x5adb('0x56')][_0x56df90]){if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5a')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x31')]+=0x1;}if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5b')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x5c')]+=0x1;}_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallerjoinAt']),_0x5adb('0x5f'))||0x0;if(_0x5e55c2===_0x2a55a3[_0x25f761][_0x5adb('0x44')]-0x1){_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=moment(_0x2a55a3[_0x25f761][_0x5e55c2]['queuecallercompleteAt']||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x60')]||_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x61')])['diff'](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x62')]),_0x5adb('0x5f'))||0x0;_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2a')]+=0x1;if(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x63')]){_0x3a0d1b[_0x5adb('0x56')][_0x56df90][_0x5adb('0x2b')]+=0x1;_0x3a0d1b[_0x5adb('0x56')][_0x56df90]['sumBillable']+=moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x64')])[_0x5adb('0x5e')](moment(_0x2a55a3[_0x25f761][_0x5e55c2][_0x5adb('0x5d')]),'seconds')||0x0;}}else{_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2d')]+=_0x3a0d1b['voiceQueues'][_0x56df90][_0x5adb('0x2c')]||0x0;}}}}}}return _0x3a0d1b[_0x5adb('0x56')];};};Realtime[_0x5adb('0x41')]['initVoiceCallReports']=function(){var _0x3a9735=this;return function(_0x288e4f){clearVoiceCallReports(_0x3a9735[_0x5adb('0x17')]);if(_0x288e4f){for(var _0x3ecc56=0x0;_0x3ecc56<_0x288e4f[_0x5adb('0x44')];_0x3ecc56+=0x1){_0x3a9735['outbound'][_0x5adb('0x2a')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2d')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')];if(_0x288e4f[_0x3ecc56]['disposition']===_0x5adb('0x66')){_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2b')]+=0x1;_0x3a9735[_0x5adb('0x17')][_0x5adb('0x2c')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x65')]-_0x288e4f[_0x3ecc56][_0x5adb('0x67')]||0x0;_0x3a9735['outbound'][_0x5adb('0x32')]+=_0x288e4f[_0x3ecc56][_0x5adb('0x67')];}}}return _0x3a9735['outbound'];};};Realtime[_0x5adb('0x41')][_0x5adb('0x68')]=function(){var _0x4fc0d5=this;return function(_0x462fa0){if(_0x462fa0){freeIsNotKey(_0x462fa0,_0x4fc0d5['campaigns'],_0x5adb('0x24'));for(var _0x268df2=0x0,_0x4a2ebc={};_0x268df2<_0x462fa0[_0x5adb('0x44')];_0x268df2+=0x1){_0x4a2ebc=_0x462fa0[_0x268df2];if(_['isUndefined'](_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]])){_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]]=new Campaign(_0x4a2ebc);}else{_0x4fc0d5[_0x5adb('0x40')](_0x4fc0d5['campaigns'][_0x4a2ebc[_0x5adb('0x24')]],_0x4a2ebc);_0x4fc0d5[_0x5adb('0x15')][_0x4a2ebc[_0x5adb('0x24')]][_0x5adb('0x69')]=_0x4a2ebc['SquareProject']?_0x4a2ebc['SquareProject'][_0x5adb('0x24')]:undefined;}}}return _0x4fc0d5[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6a')]=function(){var _0x277668=this;return function(_0xc74e86){if(_0xc74e86){freeIsNotKey(_0xc74e86,_0x277668[_0x5adb('0x6b')],'id');for(var _0x514833=0x0,_0xda26cc={};_0x514833<_0xc74e86[_0x5adb('0x44')];_0x514833+=0x1){_0xda26cc=_0xc74e86[_0x514833];if(_[_0x5adb('0x45')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']])){_0x277668['voiceExtensions'][_0xda26cc['id']]=new VoiceExtension(_0xda26cc);}else{_0x277668[_0x5adb('0x40')](_0x277668[_0x5adb('0x6b')][_0xda26cc['id']],_0xda26cc);}}}return _0x277668[_0x5adb('0x6b')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6c')]=function(){var _0x188cbd=this;return function(_0x315ac6){clearCampaigns(_0x188cbd[_0x5adb('0x15')]);for(var _0x1f753e=0x0;_0x1f753e<_0x315ac6['length'];_0x1f753e+=0x1){_[_0x5adb('0x54')](_0x188cbd[_0x5adb('0x15')][_0x315ac6[_0x1f753e]['name']],_0x315ac6[_0x1f753e]);}return _0x188cbd[_0x5adb('0x15')];};};Realtime[_0x5adb('0x41')][_0x5adb('0x6d')]=function(){var _0x3bb3fc=this;return function(_0x200221){if(_0x200221){freeIsNotKey(_0x200221,_0x3bb3fc[_0x5adb('0x22')],'id');for(var _0x450516=0x0,_0x350bb1={};_0x450516<_0x200221['length'];_0x450516+=0x1){_0x350bb1=_0x200221[_0x450516];if(_[_0x5adb('0x45')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']])){_0x3bb3fc['faxAccounts'][_0x350bb1['id']]=new FaxAccount(_0x350bb1);}else{_0x3bb3fc[_0x5adb('0x40')](_0x3bb3fc[_0x5adb('0x22')][_0x350bb1['id']],_0x350bb1);}}}return _0x3bb3fc[_0x5adb('0x22')];};};Realtime['prototype']['initVoiceQueues']=function(){var _0x2d7a9f=this;return function(_0x328851){if(_0x328851){freeIsNotKey(_0x328851,_0x2d7a9f[_0x5adb('0x56')],'name');for(var _0x14b36f=0x0,_0x321c3a={};_0x14b36f<_0x328851[_0x5adb('0x44')];_0x14b36f+=0x1){_0x321c3a=_0x328851[_0x14b36f];if(_[_0x5adb('0x45')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]])){_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]]=new VoiceQueue(_0x321c3a);}else{_0x2d7a9f[_0x5adb('0x40')](_0x2d7a9f[_0x5adb('0x56')][_0x321c3a[_0x5adb('0x24')]],_0x321c3a);}}}return _0x2d7a9f[_0x5adb('0x56')];};};module['exports']=Realtime; \ No newline at end of file diff --git a/server/services/ami/realtime/utils.js b/server/services/ami/realtime/utils.js index 88ad126..03c62d7 100644 --- a/server/services/ami/realtime/utils.js +++ b/server/services/ami/realtime/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x83c0=['assign'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x83c0,0x69));var _0x083c=function(_0x2d5cf7,_0x49c672){_0x2d5cf7=_0x2d5cf7-0x0;var _0x265db0=_0x83c0[_0x2d5cf7];return _0x265db0;};'use strict';function mergeDBDataToRealtime(_0x280972,_0x1b79b0){var _0x3855ca=Object[_0x083c('0x0')]({},_0x280972);for(var _0x53175b in _0x1b79b0){if(_0x3855ca['hasOwnProperty'](_0x53175b)){_0x3855ca[_0x53175b]=_0x1b79b0[_0x53175b];}}return _0x3855ca;}exports['mergeDBDataToRealtime']=mergeDBDataToRealtime; \ No newline at end of file +var _0x18e2=['mergeDBDataToRealtime'];(function(_0x195ba9,_0x5c2a82){var _0x7bd41a=function(_0x3f5763){while(--_0x3f5763){_0x195ba9['push'](_0x195ba9['shift']());}};_0x7bd41a(++_0x5c2a82);}(_0x18e2,0x133));var _0x218e=function(_0x42cb7a,_0xd56d3d){_0x42cb7a=_0x42cb7a-0x0;var _0x2f6717=_0x18e2[_0x42cb7a];return _0x2f6717;};'use strict';function mergeDBDataToRealtime(_0x25814f,_0xa4c27e){var _0x45635e=Object['assign']({},_0x25814f);for(var _0x28b3aa in _0xa4c27e){if(_0x45635e['hasOwnProperty'](_0x28b3aa)){_0x45635e[_0x28b3aa]=_0xa4c27e[_0x28b3aa];}}return _0x45635e;}exports[_0x218e('0x0')]=mergeDBDataToRealtime; \ No newline at end of file diff --git a/server/services/ami/report/index.js b/server/services/ami/report/index.js index f12f728..080c205 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 _0x3819=['internal','destination','exten','type','dialer','lastapplication','lastdata','queue','from-voip-provider','context','from-sip','xcally-motion-preview','calleridnum','originatecalleridnum','destinationchannel','callerid','calleridpreview','connectedlinenum','\x22%s\x22\x20<%s>','calleridname','transfers','linkedid','transfereelinkedid','uniqueid','UserId','membername','monitor','monitors','monitorFilename','createdAt','connectedlinename','xcally-motion-dialer','isArray','startsWith','substring','indexOf','mobile','lastIndexOf','transfererlinkedid','exports','lodash','moment','util','../../../config/environment','../ami','../rpc/voiceCallReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceQueueReport','./voiceCallReport','./voiceAgentReport','./voiceDialReport','agents','telephones','realtime','xdr','custom:voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','voiceDialReport','blindtransfer','blindTransfer','attendedtransfer','attendedTransfer','prototype','find','name','accountcode','interface','format','SIP/%s','voiceQueueReport','length','findAgent','assigned','lastAssignedTo','isNil','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','channel','split','outbound'];(function(_0x535a23,_0x455cdc){var _0x15b96e=function(_0x212110){while(--_0x212110){_0x535a23['push'](_0x535a23['shift']());}};_0x15b96e(++_0x455cdc);}(_0x3819,0x1a0));var _0x9381=function(_0xbd2b33,_0x3f7978){_0xbd2b33=_0xbd2b33-0x0;var _0x2f245f=_0x3819[_0xbd2b33];return _0x2f245f;};'use strict';var _=require(_0x9381('0x0'));var moment=require(_0x9381('0x1'));var util=require(_0x9381('0x2'));var config=require(_0x9381('0x3'));var ami=require(_0x9381('0x4'));var RpcVoiceAgentReport=require('../rpc/voiceAgentReport');var RpcVoiceCallReport=require(_0x9381('0x5'));var RpcVoiceDialReport=require(_0x9381('0x6'));var RpcMemberReport=require(_0x9381('0x7'));var RpcVoiceQueueReport=require(_0x9381('0x8'));var RpcVoiceRecording=require(_0x9381('0x9'));var RpcVoiceTransferReport=require(_0x9381('0xa'));var VoiceQueueReport=require(_0x9381('0xb'));var VoiceCallReport=require(_0x9381('0xc'));var VoiceAgentReport=require(_0x9381('0xd'));var VoiceDialReport=require(_0x9381('0xe'));var UserReport=require('./userReport');function Report(_0x4f45d3){this['realtime']=_0x4f45d3;this[_0x9381('0xf')]=_0x4f45d3[_0x9381('0xf')];this[_0x9381('0x10')]=_0x4f45d3[_0x9381('0x10')];}Report['prototype']['sync']=function(_0x570bce){var _0x3a77a1=new VoiceQueueReport(this[_0x9381('0x11')]);var _0x3bab52=new VoiceAgentReport(this[_0x9381('0x11')]);var _0x4afcee=new VoiceDialReport(this[_0x9381('0x11')]);var _0x1edee4=new VoiceCallReport(this[_0x9381('0x11')]);var _0x133b78=new UserReport(this['realtime']);if(config[_0x9381('0x12')]&&config[_0x9381('0x12')]['disabled']){ami['on'](_0x9381('0x13'),this['voiceQueueReport'][_0x9381('0x14')](this));ami['on'](_0x9381('0x15'),this[_0x9381('0x16')][_0x9381('0x14')](this));ami['on'](_0x9381('0x17'),this['voiceAgentReport'][_0x9381('0x14')](this));ami['on']('custom:voiceDialReport',this[_0x9381('0x18')]['bind'](this));ami['on'](_0x9381('0x19'),this[_0x9381('0x1a')][_0x9381('0x14')](this));ami['on'](_0x9381('0x1b'),this[_0x9381('0x1c')]['bind'](this));}};Report[_0x9381('0x1d')]['findAgent']=function(_0x321695){var _0x399cf4;_0x399cf4=_[_0x9381('0x1e')](this[_0x9381('0xf')],function(_0x52ef31){return _0x52ef31['accountcode']==_0x321695||_0x52ef31[_0x9381('0x1f')]==_0x321695;});if(_['isNil'](_0x399cf4)){var _0x237e32=_[_0x9381('0x1e')](this['telephones'],function(_0x28a431){return _0x28a431[_0x9381('0x20')]==_0x321695||_0x28a431[_0x9381('0x1f')]==_0x321695;});if(_0x237e32){_0x399cf4=_[_0x9381('0x1e')](this[_0x9381('0xf')],function(_0x239d64){return _0x239d64[_0x9381('0x21')]==util[_0x9381('0x22')](_0x9381('0x23'),_0x237e32[_0x9381('0x1f')]);});}}return _0x399cf4;};Report[_0x9381('0x1d')][_0x9381('0x24')]=function(_0x71a59a){for(var _0x143c0c=0x0;_0x143c0c<_0x71a59a[_0x9381('0x25')];_0x143c0c+=0x1){var _0x14292a=this[_0x9381('0x26')](_0x71a59a[_0x143c0c]['connectedlinenum']);if(_0x14292a){_0x71a59a[_0x143c0c][_0x9381('0x20')]=_0x14292a[_0x9381('0x20')];_0x71a59a[_0x143c0c][_0x9381('0x27')]=!![];_0x71a59a[_0x143c0c][_0x9381('0x28')]=_0x14292a[_0x9381('0x1f')];_0x71a59a[_0x143c0c][_0x9381('0x21')]=_[_0x9381('0x29')](_0x14292a[_0x9381('0x21')])?util[_0x9381('0x22')](_0x9381('0x23'),_0x14292a[_0x9381('0x1f')]):_0x14292a['interface'];if(_0x71a59a[_0x143c0c][_0x9381('0x2a')]){_0x71a59a[_0x143c0c][_0x9381('0x2b')]=moment()['format'](_0x9381('0x2c'));}if(_0x71a59a[_0x143c0c][_0x9381('0x2d')]){_0x71a59a[_0x143c0c][_0x9381('0x2e')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport['voiceQueueReport'](_0x71a59a[_0x143c0c]);}RpcVoiceQueueReport[_0x9381('0x2f')](_0x71a59a[_0x143c0c]);}};function extractCalleridNumber(_0x296cc2){var _0x57a2b1=_0x296cc2[_0x9381('0x30')](/<(.*?)>/);return _0x57a2b1?_0x57a2b1[0x1]:_0x296cc2;}Report[_0x9381('0x1d')][_0x9381('0x31')]=function(_0x34ebb5){for(var _0x42172c=0x0;_0x42172c','transfers','linkedid','transfereelinkedid','uniqueid','blindTransfer','membername','monitor','monitorFilename','monitors','filename','createdAt','xcally-motion-preview','calleridname','connectedlinename','xcally-motion-dialer','isArray','forEach','startsWith','indexOf','mobile','phone','lastIndexOf','transfererlinkedid','attendedTransfer','lodash','moment','util','../../../config/environment','../rpc/voiceAgentReport','../rpc/voiceDialReport','../rpc/memberReport','../rpc/voiceQueueReport','../rpc/voiceRecording','../rpc/voiceTransferReport','./voiceAgentReport','./voiceDialReport','./userReport','realtime','agents','telephones','prototype','xdr','disabled','voiceQueueReport','bind','custom:voiceCallReport','voiceCallReport','custom:voiceAgentReport','custom:voiceDialReport','voiceDialReport','blindtransfer','findAgent','find','accountcode','isNil','name','interface','format','SIP/%s','length','connectedlinenum','assigned','lastAssignedTo','queuecallercomplete','queuecallercompleteAt','YYYY-MM-DD\x20HH:mm:ss','queuecallerexit','queuecallerexitAt','create','match','getAgentByInternal','keys','getCallType','channel','split','outbound','destination','exten'];(function(_0x370659,_0x311378){var _0x2a692c=function(_0x38ac5e){while(--_0x38ac5e){_0x370659['push'](_0x370659['shift']());}};_0x2a692c(++_0x311378);}(_0x403a,0x84));var _0xa403=function(_0x1a014b,_0x48acae){_0x1a014b=_0x1a014b-0x0;var _0x462258=_0x403a[_0x1a014b];return _0x462258;};'use strict';var _=require(_0xa403('0x0'));var moment=require(_0xa403('0x1'));var util=require(_0xa403('0x2'));var config=require(_0xa403('0x3'));var ami=require('../ami');var RpcVoiceAgentReport=require(_0xa403('0x4'));var RpcVoiceCallReport=require('../rpc/voiceCallReport');var RpcVoiceDialReport=require(_0xa403('0x5'));var RpcMemberReport=require(_0xa403('0x6'));var RpcVoiceQueueReport=require(_0xa403('0x7'));var RpcVoiceRecording=require(_0xa403('0x8'));var RpcVoiceTransferReport=require(_0xa403('0x9'));var VoiceQueueReport=require('./voiceQueueReport');var VoiceCallReport=require('./voiceCallReport');var VoiceAgentReport=require(_0xa403('0xa'));var VoiceDialReport=require(_0xa403('0xb'));var UserReport=require(_0xa403('0xc'));function Report(_0x5546e7){this[_0xa403('0xd')]=_0x5546e7;this[_0xa403('0xe')]=_0x5546e7[_0xa403('0xe')];this[_0xa403('0xf')]=_0x5546e7[_0xa403('0xf')];}Report[_0xa403('0x10')]['sync']=function(_0x42f4d9){var _0x4eb81e=new VoiceQueueReport(this[_0xa403('0xd')]);var _0x5e5bc6=new VoiceAgentReport(this[_0xa403('0xd')]);var _0x2806dc=new VoiceDialReport(this[_0xa403('0xd')]);var _0x400443=new VoiceCallReport(this[_0xa403('0xd')]);var _0x4a5d7e=new UserReport(this[_0xa403('0xd')]);if(config[_0xa403('0x11')]&&config[_0xa403('0x11')][_0xa403('0x12')]){ami['on']('custom:voiceQueueReport',this[_0xa403('0x13')][_0xa403('0x14')](this));ami['on'](_0xa403('0x15'),this[_0xa403('0x16')][_0xa403('0x14')](this));ami['on'](_0xa403('0x17'),this['voiceAgentReport'][_0xa403('0x14')](this));ami['on'](_0xa403('0x18'),this[_0xa403('0x19')][_0xa403('0x14')](this));ami['on'](_0xa403('0x1a'),this['blindTransfer'][_0xa403('0x14')](this));ami['on']('attendedtransfer',this['attendedTransfer'][_0xa403('0x14')](this));}};Report[_0xa403('0x10')][_0xa403('0x1b')]=function(_0x130f51){var _0xa6a578;_0xa6a578=_[_0xa403('0x1c')](this[_0xa403('0xe')],function(_0x1f04e1){return _0x1f04e1[_0xa403('0x1d')]==_0x130f51||_0x1f04e1['name']==_0x130f51;});if(_[_0xa403('0x1e')](_0xa6a578)){var _0x21e080=_[_0xa403('0x1c')](this[_0xa403('0xf')],function(_0x1cbac3){return _0x1cbac3[_0xa403('0x1d')]==_0x130f51||_0x1cbac3[_0xa403('0x1f')]==_0x130f51;});if(_0x21e080){_0xa6a578=_['find'](this[_0xa403('0xe')],function(_0x55e3bc){return _0x55e3bc[_0xa403('0x20')]==util[_0xa403('0x21')](_0xa403('0x22'),_0x21e080[_0xa403('0x1f')]);});}}return _0xa6a578;};Report[_0xa403('0x10')]['voiceQueueReport']=function(_0x170146){for(var _0x499af5=0x0;_0x499af5<_0x170146[_0xa403('0x23')];_0x499af5+=0x1){var _0x58932f=this['findAgent'](_0x170146[_0x499af5][_0xa403('0x24')]);if(_0x58932f){_0x170146[_0x499af5][_0xa403('0x1d')]=_0x58932f[_0xa403('0x1d')];_0x170146[_0x499af5][_0xa403('0x25')]=!![];_0x170146[_0x499af5][_0xa403('0x26')]=_0x58932f[_0xa403('0x1f')];_0x170146[_0x499af5][_0xa403('0x20')]=_[_0xa403('0x1e')](_0x58932f[_0xa403('0x20')])?util[_0xa403('0x21')]('SIP/%s',_0x58932f['name']):_0x58932f[_0xa403('0x20')];if(_0x170146[_0x499af5][_0xa403('0x27')]){_0x170146[_0x499af5][_0xa403('0x28')]=moment()[_0xa403('0x21')](_0xa403('0x29'));}if(_0x170146[_0x499af5][_0xa403('0x2a')]){_0x170146[_0x499af5][_0xa403('0x2b')]=moment()[_0xa403('0x21')]('YYYY-MM-DD\x20HH:mm:ss');}RpcMemberReport[_0xa403('0x13')](_0x170146[_0x499af5]);}RpcVoiceQueueReport[_0xa403('0x2c')](_0x170146[_0x499af5]);}};function extractCalleridNumber(_0x7a6521){var _0x51bcc1=_0x7a6521[_0xa403('0x2d')](/<(.*?)>/);return _0x51bcc1?_0x51bcc1[0x1]:_0x7a6521;}Report[_0xa403('0x10')][_0xa403('0x2e')]=function(_0x1ad7d2){for(var _0x47de0d=0x0;_0x47de0d0x0?!![]:![];if(!_0x1e6994){return this[_0x5fa2('0x6f')](this['summary'][_0x5fa2('0x70')]);}};VoiceQueueReport['prototype'][_0x5fa2('0x71')]=function(_0x5bf610){var _0x2fb8f4=this[_0x5fa2('0x17')]['id'];if(this['summary'][_0x5fa2('0x66')][_0x2fb8f4]&&this[_0x5fa2('0x17')][_0x5fa2('0x66')][_0x2fb8f4][_0x5bf610[_0x5fa2('0x67')]]){this['summary'][_0x5fa2('0x66')][_0x2fb8f4][_0x5bf610[_0x5fa2('0x67')]][_0x5fa2('0x13')][_0x5fa2('0x72')](_0x5bf610);}};VoiceQueueReport[_0x5fa2('0xc')][_0x5fa2('0x73')]=function(_0x1cd2aa){var _0x398d61=this;try{if(this[_0x5fa2('0x5f')](_0x1cd2aa)&&this[_0x5fa2('0x5f')](_0x1cd2aa[_0x5fa2('0x56')])){logger['debug'](_0x5fa2('0x74'),util['inspect'](_0x1cd2aa,{'showHidden':![],'depth':null}));var _0x18e89c=this[_0x5fa2('0x15')][_0x1cd2aa[_0x5fa2('0x56')]];if(_0x18e89c){logger[_0x5fa2('0x4b')](_0x5fa2('0x75'),_0x18e89c[_0x5fa2('0x5d')]);this[_0x5fa2('0x17')]['queues'][_0x18e89c[_0x5fa2('0x5d')]]={'summaryEvent':_0x1cd2aa};this[_0x5fa2('0x17')][_0x5fa2('0x6e')]+=0x1;return ami[_0x5fa2('0x3c')]({'action':_0x5fa2('0x66'),'queue':_0x18e89c[_0x5fa2('0x5d')]})[_0x5fa2('0x65')](function(_0x49b1ce){if(!_0x398d61[_0x5fa2('0x17')][_0x5fa2('0x66')][_0x1cd2aa[_0x5fa2('0x67')]]){_0x398d61[_0x5fa2('0x17')][_0x5fa2('0x66')][_0x1cd2aa[_0x5fa2('0x67')]]={};}_0x398d61['summary'][_0x5fa2('0x66')][_0x1cd2aa[_0x5fa2('0x67')]][_0x49b1ce[_0x5fa2('0x67')]]={'queue':_0x18e89c[_0x5fa2('0x5d')],'agents':[]};})['catch'](function(_0x1a449b){throw _0x1a449b;});}}}catch(_0x196d8a){logger[_0x5fa2('0x41')](_0x5fa2('0x68'),util[_0x5fa2('0x43')](_0x196d8a,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5fa2('0xc')][_0x5fa2('0x6f')]=function(_0x496544){if(this[_0x5fa2('0x17')][_0x5fa2('0x6e')]>0x0){this[_0x5fa2('0x17')][_0x5fa2('0x70')]=_0x496544;return;}logger['debug'](_0x5fa2('0x76'),util[_0x5fa2('0x43')](_0x496544,{'showHidden':![],'depth':null}));this['summary']=initializeSummary();ami[_0x5fa2('0x4e')]('custom:queuesummarycomplete',{});};VoiceQueueReport[_0x5fa2('0xc')]['syncQueueCallerJoin']=function(_0x55617e){try{if(this[_0x5fa2('0x5f')](_0x55617e)){logger[_0x5fa2('0x4b')](_0x5fa2('0x77'),_0x55617e['uniqueid'],util[_0x5fa2('0x43')](_0x55617e,{'showHidden':![],'depth':null}));if(_[_0x5fa2('0x60')](this['queueReports'][_0x55617e[_0x5fa2('0x4d')]])){this['queueReports'][_0x55617e[_0x5fa2('0x4d')]]=[];}if(_[_0x5fa2('0x60')](this[_0x5fa2('0x3b')][_0x55617e['uniqueid']])){this[_0x5fa2('0x3b')][_0x55617e[_0x5fa2('0x4d')]]={};}var _0x315265=new QueueReport();_0x315265[_0x5fa2('0x56')]=_0x55617e['queue'];_0x315265[_0x5fa2('0x5a')]=this[_0x5fa2('0x15')][_0x315265['queue']]&&this[_0x5fa2('0x15')][_0x315265['queue']][_0x5fa2('0x5a')]?this[_0x5fa2('0x15')][_0x315265[_0x5fa2('0x56')]][_0x5fa2('0x5a')]||_0x5fa2('0x5b'):_0x5fa2('0x5b');_0x315265[_0x5fa2('0x78')]=moment()['format'](_0x5fa2('0x79'));_0x315265[_0x5fa2('0x7a')]=_0x55617e[_0x5fa2('0x7a')];_0x315265[_0x5fa2('0x7b')]=_0x55617e[_0x5fa2('0x7b')];_0x315265[_0x5fa2('0x4d')]=_0x55617e[_0x5fa2('0x4d')];_0x315265['routealias']=this[_0x5fa2('0x3b')][_0x55617e[_0x5fa2('0x4d')]][_0x5fa2('0x7c')];logger['info'](_0x5fa2('0x7d'),_0x315265[_0x5fa2('0x56')],_0x315265['type']);Object[_0x5fa2('0x7e')](_0x315265,_['pick'](_0x55617e,_['keys'](_0x315265)));this[_0x5fa2('0x11')][_0x55617e[_0x5fa2('0x4d')]][_0x5fa2('0x72')](_0x315265);this[_0x5fa2('0x3b')][_0x55617e[_0x5fa2('0x4d')]]=_0x315265;this[_0x5fa2('0x4a')](_0x315265,_0x5fa2('0x1d'));}}catch(_0x27bbf5){logger[_0x5fa2('0x41')](_0x5fa2('0x77'),_0x55617e[_0x5fa2('0x4d')],util[_0x5fa2('0x43')](_0x27bbf5,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5fa2('0xc')][_0x5fa2('0x20')]=function(_0x5d528d){try{if(this[_0x5fa2('0x5f')](_0x5d528d)){logger[_0x5fa2('0x4b')](_0x5fa2('0x7f'),_0x5d528d[_0x5fa2('0x4d')],util[_0x5fa2('0x43')](_0x5d528d,{'showHidden':![],'depth':null}));if(this[_0x5fa2('0x11')][_0x5d528d[_0x5fa2('0x4d')]]){var _0xb34630=_[_0x5fa2('0x80')](this[_0x5fa2('0x11')][_0x5d528d[_0x5fa2('0x4d')]]);_0xb34630['queuecallercomplete']=![];_0xb34630[_0x5fa2('0x81')]=null;_0xb34630['holdtime']=_0x5d528d[_0x5fa2('0x82')];_0xb34630[_0x5fa2('0x83')]=_0x5d528d[_0x5fa2('0x83')];_0xb34630[_0x5fa2('0x1f')]=!![];_0xb34630[_0x5fa2('0x84')]=moment()[_0x5fa2('0x4f')](_0x5fa2('0x79'));_0xb34630[_0x5fa2('0x54')]=_0x5fa2('0x85');_0xb34630['lastAssignedTo']=null;logger['info'](_0x5fa2('0x86'),_0xb34630[_0x5fa2('0x56')],_0xb34630['type']);this['channels'][_0x5d528d['uniqueid']]=_0xb34630;this[_0x5fa2('0x48')](_0xb34630,_0x5fa2('0x1f'));}}}catch(_0x287a34){logger['error'](_0x5fa2('0x7f'),_0x5d528d[_0x5fa2('0x4d')],util[_0x5fa2('0x43')](_0x287a34,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x5fa2('0x21')]=function(_0x43ed82){try{if(this[_0x5fa2('0x5f')](_0x43ed82)){logger[_0x5fa2('0x4b')](_0x5fa2('0x87'),_0x43ed82['uniqueid'],util[_0x5fa2('0x43')](_0x43ed82,{'showHidden':![],'depth':null}));if(this[_0x5fa2('0x11')][_0x43ed82['uniqueid']]){var _0x28981d=_['last'](this[_0x5fa2('0x11')][_0x43ed82['uniqueid']]);_0x28981d[_0x5fa2('0x88')]=moment()[_0x5fa2('0x4f')](_0x5fa2('0x79'));_0x28981d['connectedlinenum']=_0x43ed82['connectedlinenum'];_0x28981d['connectedlinename']=_0x43ed82[_0x5fa2('0x89')];logger[_0x5fa2('0x8a')](_0x5fa2('0x8b'),_0x28981d[_0x5fa2('0x56')],_0x28981d[_0x5fa2('0x5a')],_0x43ed82[_0x5fa2('0x8c')],_0x43ed82[_0x5fa2('0x89')]);this['channels'][_0x43ed82[_0x5fa2('0x4d')]]=_0x28981d;this[_0x5fa2('0x4a')](_0x28981d,_0x5fa2('0x8d'));}}}catch(_0x16a062){logger[_0x5fa2('0x41')](_0x5fa2('0x87'),_0x43ed82[_0x5fa2('0x4d')],util['inspect'](_0x16a062,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5fa2('0xc')][_0x5fa2('0x25')]=function(_0x42257e){try{if(this[_0x5fa2('0x5f')](_0x42257e)){logger[_0x5fa2('0x4b')](_0x5fa2('0x8e'),_0x42257e[_0x5fa2('0x4d')],util[_0x5fa2('0x43')](_0x42257e,{'showHidden':![],'depth':null}));if(this[_0x5fa2('0x11')][_0x42257e[_0x5fa2('0x4d')]]){var _0x3580ae=_[_0x5fa2('0x80')](this['queueReports'][_0x42257e[_0x5fa2('0x4d')]]);_0x3580ae[_0x5fa2('0x39')]=!![];_0x3580ae[_0x5fa2('0x54')]=_0x5fa2('0x8f');logger[_0x5fa2('0x8a')](_0x5fa2('0x90'),_0x3580ae[_0x5fa2('0x56')],_0x3580ae[_0x5fa2('0x5a')]);}}}catch(_0x194f61){logger[_0x5fa2('0x41')]('[%s][voiceQueueReport][agentconnect]',_0x42257e[_0x5fa2('0x4d')],util[_0x5fa2('0x43')](_0x194f61,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5fa2('0xc')][_0x5fa2('0x23')]=function(_0x5ad536){try{if(this['isNotNull'](_0x5ad536)){logger['debug'](_0x5fa2('0x91'),_0x5ad536['uniqueid'],util[_0x5fa2('0x43')](_0x5ad536,{'showHidden':![],'depth':null}));if(this[_0x5fa2('0x11')][_0x5ad536[_0x5fa2('0x4d')]]){var _0x520bf3=_[_0x5fa2('0x80')](this[_0x5fa2('0x11')][_0x5ad536[_0x5fa2('0x4d')]]);_0x520bf3[_0x5fa2('0x1f')]=![];_0x520bf3[_0x5fa2('0x84')]=null;_0x520bf3[_0x5fa2('0x92')]=!![];_0x520bf3[_0x5fa2('0x93')]=_0x5ad536[_0x5fa2('0x94')];_0x520bf3[_0x5fa2('0x82')]=_0x5ad536[_0x5fa2('0x82')];_0x520bf3['queuecallercomplete']=!![];_0x520bf3[_0x5fa2('0x38')]=![];_0x520bf3[_0x5fa2('0x95')]=null;if(!_0x520bf3['transfer']){if(_0x5ad536[_0x5fa2('0x96')]=='transfer'){_0x520bf3['queuecallerexitreason']=_0x5fa2('0x97');logger[_0x5fa2('0x8a')](_0x5fa2('0x98'),_0x520bf3[_0x5fa2('0x56')],_0x520bf3[_0x5fa2('0x5a')]);}else{if(_['startsWith'](_0x5ad536['channel']['toLowerCase'](),_0x5fa2('0x99'))){if(this[_0x5fa2('0x11')][_0x5ad536['linkedid']]){var _0x4fada2=_[_0x5fa2('0x80')](this[_0x5fa2('0x11')][_0x5ad536[_0x5fa2('0x9a')]]);_0x4fada2[_0x5fa2('0x39')]=![];_0x4fada2[_0x5fa2('0x38')]=!![];_0x4fada2[_0x5fa2('0x95')]=moment(_0x520bf3['queuecallerjoinAt'])[_0x5fa2('0x9b')](_0x5ad536[_0x5fa2('0x82')],_0x5fa2('0x9c'))[_0x5fa2('0x4f')](_0x5fa2('0x79'));_0x4fada2[_0x5fa2('0x54')]='FORWARDTRANSFER';_0x4fada2[_0x5fa2('0x9d')]=!![];_0x4fada2['transfertype']=_0x5fa2('0x9e');_0x4fada2['transferexten']=_0x5ad536[_0x5fa2('0x9f')];_0x4fada2[_0x5fa2('0xa0')]=_0x5ad536[_0x5fa2('0x4d')];logger[_0x5fa2('0x8a')](_0x5fa2('0xa1'),_0x4fada2[_0x5fa2('0x56')],_0x4fada2[_0x5fa2('0x5a')]);var _0x8c3d76=this[_0x5fa2('0x11')][_0x5ad536[_0x5fa2('0x9a')]];this['queueReports'][_0x5ad536[_0x5fa2('0x9a')]]=this[_0x5fa2('0x11')][_0x5ad536[_0x5fa2('0x4d')]];this['queueReports'][_0x5ad536[_0x5fa2('0x4d')]]=_0x8c3d76;}}else{_0x520bf3['queuecallerexitreason']='COMPLETEDBY'+_0x5ad536['reason'][_0x5fa2('0xa2')]();logger[_0x5fa2('0x8a')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:%s',_0x520bf3[_0x5fa2('0x56')],_0x520bf3[_0x5fa2('0x5a')],_0x520bf3['queuecallerexitreason']);}}}this[_0x5fa2('0x3b')][_0x5ad536[_0x5fa2('0x4d')]]=_0x520bf3;}}}catch(_0x454681){logger['error']('[%s][voiceQueueReport][agentcomplete]',_0x5ad536['uniqueid'],util[_0x5fa2('0x43')](_0x454681,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5fa2('0xc')]['syncVarSet']=function(_0x683885){try{if(this[_0x5fa2('0x5f')](_0x683885)){logger[_0x5fa2('0x4b')]('[%s][voiceQueueReport][varset]',_0x683885['uniqueid'],util['inspect'](_0x683885,{'showHidden':![],'depth':null}));this['addVariable'](_0x683885[_0x5fa2('0x4d')],_[_0x5fa2('0xa3')](_0x683885[_0x5fa2('0xa4')])[0x0],_0x683885[_0x5fa2('0xa5')]);if(this[_0x5fa2('0x11')][_0x683885[_0x5fa2('0x4d')]]){var _0x1377a1=_[_0x5fa2('0x80')](this[_0x5fa2('0x11')][_0x683885[_0x5fa2('0x4d')]]);if(_0x1377a1){if(this[_0x5fa2('0x5f')](_0x683885[_0x5fa2('0xa4')])&&this[_0x5fa2('0x5f')](_0x683885['variable'][_0x5fa2('0x66')])){switch(_0x683885[_0x5fa2('0xa5')]){case _0x5fa2('0xa6'):_0x1377a1[_0x5fa2('0x38')]=![];_0x1377a1[_0x5fa2('0x95')]=null;break;case'TIMEOUT':_0x1377a1[_0x5fa2('0xa7')]=_0x5fa2('0xa8');_0x1377a1[_0x5fa2('0x38')]=!![];_0x1377a1[_0x5fa2('0x95')]=moment()[_0x5fa2('0x4f')](_0x5fa2('0x79'));_0x1377a1[_0x5fa2('0x88')]=moment()[_0x5fa2('0x4f')](_0x5fa2('0x79'));logger[_0x5fa2('0x4b')](_0x5fa2('0xa9'),_0x683885[_0x5fa2('0x4d')],util[_0x5fa2('0x43')](_0x1377a1,{'showHidden':![],'depth':null}));ami['emit'](_0x5fa2('0xaa'),_0x1377a1);break;default:_0x1377a1[_0x5fa2('0x38')]=!![];_0x1377a1[_0x5fa2('0x95')]=moment()[_0x5fa2('0x4f')](_0x5fa2('0x79'));_0x1377a1[_0x5fa2('0x88')]=moment()['format'](_0x5fa2('0x79'));}_0x1377a1[_0x5fa2('0x1f')]=![];_0x1377a1[_0x5fa2('0x84')]=null;_0x1377a1['queuecallerexitreason']=_0x683885[_0x5fa2('0xa5')];this[_0x5fa2('0x3b')][_0x683885[_0x5fa2('0x4d')]]=_0x1377a1;this['emitVoiceQueueChannelRemove'](_0x1377a1,_0x5fa2('0x26'));}else if(this[_0x5fa2('0x5f')](_0x683885['variable'])&&this['isNotNull'](_0x683885[_0x5fa2('0xa4')][_0x5fa2('0xab')])){if(!_0x1377a1['queuecallerabandon']){_0x1377a1[_0x5fa2('0x38')]=!![];_0x1377a1[_0x5fa2('0x95')]=moment()[_0x5fa2('0x4f')](_0x5fa2('0x79'));_0x1377a1[_0x5fa2('0x54')]=_0x5fa2('0xac');_0x1377a1[_0x5fa2('0x88')]=moment()[_0x5fa2('0x4f')](_0x5fa2('0x79'));this[_0x5fa2('0x3b')][_0x683885['uniqueid']]=_0x1377a1;}}logger['info'](_0x5fa2('0xad'),_0x683885[_0x5fa2('0x4d')],_0x1377a1[_0x5fa2('0x56')],_0x1377a1[_0x5fa2('0x5a')],_[_0x5fa2('0xa3')](_0x683885[_0x5fa2('0xa4')])[0x0],_0x683885['value']);_0x1377a1[_0x5fa2('0x44')]=this['variables'][_0x683885[_0x5fa2('0x4d')]];}}}}catch(_0x2dcf2d){logger[_0x5fa2('0x41')]('[%s][voiceQueueReport][varset]',_0x683885['uniqueid'],util[_0x5fa2('0x43')](_0x2dcf2d,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x5fa2('0xc')][_0x5fa2('0xae')]=function(_0x46b403,_0x2e66e5,_0x47bb29){var _0xe6f7ed=[_0x5fa2('0xaf'),_0x5fa2('0xb0'),'rtpaudioqosjitter',_0x5fa2('0xb1'),_0x5fa2('0xb2'),_0x5fa2('0xb3'),'rtpaudioqosrtt',_0x5fa2('0xb4'),_0x5fa2('0xb5'),'sipuri',_0x5fa2('0xb6'),_0x5fa2('0xb7'),_0x5fa2('0xb8'),_0x5fa2('0xb9'),_0x5fa2('0xba'),_0x5fa2('0xbb'),'membername',_0x5fa2('0xbc'),_0x5fa2('0xbd')];if(!_[_0x5fa2('0xbe')](_0x2e66e5)&&!_['includes'](_0xe6f7ed,_0x2e66e5)){if(_[_0x5fa2('0x60')](this['variables'][_0x46b403])){this[_0x5fa2('0x44')][_0x46b403]={};}this[_0x5fa2('0x44')][_0x46b403][_0x2e66e5]=_0x47bb29;}};VoiceQueueReport[_0x5fa2('0xc')][_0x5fa2('0xbf')]=function(_0x4c100b,_0x41cf1e,_0x278375){var _0x27c195={};for(var _0x215ade=0x0;_0x215ade0x0?!![]:![];if(!_0x6d79d7){return this[_0x829c('0x18')](this['summary'][_0x829c('0x67')]);}};VoiceQueueReport[_0x829c('0xb')][_0x829c('0x68')]=function(_0x2a33c4){var _0x5a02e6=this[_0x829c('0x14')]['id'];if(this['summary'][_0x829c('0x5b')][_0x5a02e6]&&this[_0x829c('0x14')][_0x829c('0x5b')][_0x5a02e6][_0x2a33c4[_0x829c('0x5a')]]){this['summary'][_0x829c('0x5b')][_0x5a02e6][_0x2a33c4[_0x829c('0x5a')]]['agents']['push'](_0x2a33c4);}};VoiceQueueReport[_0x829c('0xb')][_0x829c('0x15')]=function(_0x5dc41f){var _0x5c26ed=this;try{if(this[_0x829c('0x54')](_0x5dc41f)&&this[_0x829c('0x54')](_0x5dc41f['queue'])){logger['debug']('[voiceQueueReport][queuesummary]\x20event:',util['inspect'](_0x5dc41f,{'showHidden':![],'depth':null}));var _0x3892cf=this[_0x829c('0x41')][_0x5dc41f[_0x829c('0x64')]];if(_0x3892cf){logger[_0x829c('0x45')]('[voiceQueueReport][queuesummary]\x20name:%s',_0x3892cf[_0x829c('0x53')]);this[_0x829c('0x14')][_0x829c('0x56')][_0x3892cf['name']]={'summaryEvent':_0x5dc41f};this[_0x829c('0x14')][_0x829c('0x66')]+=0x1;return ami[_0x829c('0x38')]({'action':_0x829c('0x5b'),'queue':_0x3892cf['name']})[_0x829c('0x59')](function(_0x317217){if(!_0x5c26ed[_0x829c('0x14')][_0x829c('0x5b')][_0x5dc41f['actionid']]){_0x5c26ed['summary'][_0x829c('0x5b')][_0x5dc41f[_0x829c('0x5a')]]={};}_0x5c26ed[_0x829c('0x14')]['queuestatus'][_0x5dc41f[_0x829c('0x5a')]][_0x317217[_0x829c('0x5a')]]={'queue':_0x3892cf[_0x829c('0x53')],'agents':[]};})[_0x829c('0x3b')](function(_0x3a536c){throw _0x3a536c;});}}}catch(_0x137056){logger['error'](_0x829c('0x5c'),util['inspect'](_0x137056,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x829c('0xb')]['syncQueueSummaryComplete']=function(_0x5ec5e5){if(this[_0x829c('0x14')][_0x829c('0x66')]>0x0){this['summary'][_0x829c('0x67')]=_0x5ec5e5;return;}logger[_0x829c('0x45')](_0x829c('0x69'),util['inspect'](_0x5ec5e5,{'showHidden':![],'depth':null}));this[_0x829c('0x14')]=initializeSummary();ami[_0x829c('0x43')](_0x829c('0x6a'),{});};VoiceQueueReport[_0x829c('0xb')][_0x829c('0x6b')]=function(_0x97e2f){try{if(this[_0x829c('0x54')](_0x97e2f)){logger[_0x829c('0x45')](_0x829c('0x6c'),_0x97e2f[_0x829c('0x4a')],util[_0x829c('0x3d')](_0x97e2f,{'showHidden':![],'depth':null}));if(_['isUndefined'](this[_0x829c('0xe')][_0x97e2f[_0x829c('0x4a')]])){this['queueReports'][_0x97e2f['uniqueid']]=[];}if(_['isUndefined'](this['channels'][_0x97e2f[_0x829c('0x4a')]])){this[_0x829c('0x11')][_0x97e2f[_0x829c('0x4a')]]={};}var _0x16c1bf=new QueueReport();_0x16c1bf[_0x829c('0x64')]=_0x97e2f[_0x829c('0x64')];_0x16c1bf[_0x829c('0x50')]=this[_0x829c('0x41')][_0x16c1bf[_0x829c('0x64')]]&&this[_0x829c('0x41')][_0x16c1bf[_0x829c('0x64')]][_0x829c('0x50')]?this[_0x829c('0x41')][_0x16c1bf[_0x829c('0x64')]][_0x829c('0x50')]||'inbound':_0x829c('0x51');_0x16c1bf[_0x829c('0x6d')]=moment()[_0x829c('0x4d')](_0x829c('0x6e'));_0x16c1bf[_0x829c('0x6f')]=_0x97e2f['position'];_0x16c1bf[_0x829c('0x70')]=_0x97e2f[_0x829c('0x70')];_0x16c1bf[_0x829c('0x4a')]=_0x97e2f['uniqueid'];_0x16c1bf[_0x829c('0x71')]=this['channels'][_0x97e2f[_0x829c('0x4a')]]['routealias'];logger['info']('[voiceQueueReport][queuecallerjoin]\x20name:%s\x20type:%s',_0x16c1bf['queue'],_0x16c1bf[_0x829c('0x50')]);Object[_0x829c('0x62')](_0x16c1bf,_[_0x829c('0x72')](_0x97e2f,_[_0x829c('0x73')](_0x16c1bf)));this[_0x829c('0xe')][_0x97e2f['uniqueid']][_0x829c('0x74')](_0x16c1bf);this['channels'][_0x97e2f['uniqueid']]=_0x16c1bf;this[_0x829c('0x44')](_0x16c1bf,_0x829c('0x1b'));}}catch(_0x1285df){logger[_0x829c('0x3e')](_0x829c('0x6c'),_0x97e2f[_0x829c('0x4a')],util['inspect'](_0x1285df,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x829c('0xb')][_0x829c('0x1c')]=function(_0x4cc326){try{if(this['isNotNull'](_0x4cc326)){logger[_0x829c('0x45')]('[%s][voiceQueueReport][queuecallerabandon]',_0x4cc326[_0x829c('0x4a')],util[_0x829c('0x3d')](_0x4cc326,{'showHidden':![],'depth':null}));if(this['queueReports'][_0x4cc326[_0x829c('0x4a')]]){var _0x5ae9ea=_[_0x829c('0x75')](this['queueReports'][_0x4cc326[_0x829c('0x4a')]]);_0x5ae9ea[_0x829c('0x36')]=![];_0x5ae9ea[_0x829c('0x76')]=null;_0x5ae9ea[_0x829c('0x77')]=_0x4cc326[_0x829c('0x77')];_0x5ae9ea[_0x829c('0x78')]=_0x4cc326[_0x829c('0x78')];_0x5ae9ea[_0x829c('0x35')]=!![];_0x5ae9ea[_0x829c('0x79')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');_0x5ae9ea['queuecallerexitreason']=_0x829c('0x7a');_0x5ae9ea['lastAssignedTo']=null;logger[_0x829c('0x7b')](_0x829c('0x7c'),_0x5ae9ea[_0x829c('0x64')],_0x5ae9ea['type']);this[_0x829c('0x11')][_0x4cc326['uniqueid']]=_0x5ae9ea;this[_0x829c('0x7d')](_0x5ae9ea,'queuecallerabandon');}}}catch(_0x2efd9c){logger['error'](_0x829c('0x7e'),_0x4cc326['uniqueid'],util['inspect'](_0x2efd9c,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x829c('0x7f')]=function(_0x47c1d1){try{if(this[_0x829c('0x54')](_0x47c1d1)){logger[_0x829c('0x45')]('[%s][voiceQueueReport][queuecallerleave]',_0x47c1d1[_0x829c('0x4a')],util[_0x829c('0x3d')](_0x47c1d1,{'showHidden':![],'depth':null}));if(this[_0x829c('0xe')][_0x47c1d1[_0x829c('0x4a')]]){var _0x46e125=_[_0x829c('0x75')](this['queueReports'][_0x47c1d1[_0x829c('0x4a')]]);_0x46e125[_0x829c('0x80')]=moment()[_0x829c('0x4d')](_0x829c('0x6e'));_0x46e125['connectedlinenum']=_0x47c1d1[_0x829c('0x81')];_0x46e125[_0x829c('0x82')]=_0x47c1d1['connectedlinename'];logger[_0x829c('0x7b')](_0x829c('0x83'),_0x46e125[_0x829c('0x64')],_0x46e125[_0x829c('0x50')],_0x47c1d1['connectedlinenum'],_0x47c1d1[_0x829c('0x82')]);this[_0x829c('0x11')][_0x47c1d1['uniqueid']]=_0x46e125;this[_0x829c('0x44')](_0x46e125,_0x829c('0x1d'));}}}catch(_0x5ca301){logger[_0x829c('0x3e')](_0x829c('0x84'),_0x47c1d1['uniqueid'],util[_0x829c('0x3d')](_0x5ca301,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x829c('0x21')]=function(_0x284ab0){try{if(this[_0x829c('0x54')](_0x284ab0)){logger[_0x829c('0x45')](_0x829c('0x85'),_0x284ab0[_0x829c('0x4a')],util[_0x829c('0x3d')](_0x284ab0,{'showHidden':![],'depth':null}));if(this[_0x829c('0xe')][_0x284ab0[_0x829c('0x4a')]]){var _0x4b984b=_[_0x829c('0x75')](this['queueReports'][_0x284ab0[_0x829c('0x4a')]]);_0x4b984b['queuecallercomplete']=!![];_0x4b984b[_0x829c('0x4b')]=_0x829c('0x86');logger[_0x829c('0x7b')](_0x829c('0x87'),_0x4b984b[_0x829c('0x64')],_0x4b984b[_0x829c('0x50')]);}}}catch(_0x34a5fa){logger[_0x829c('0x3e')](_0x829c('0x85'),_0x284ab0[_0x829c('0x4a')],util[_0x829c('0x3d')](_0x34a5fa,{'showHidden':![],'depth':null}));}};VoiceQueueReport['prototype'][_0x829c('0x1f')]=function(_0x142701){try{if(this[_0x829c('0x54')](_0x142701)){logger['debug'](_0x829c('0x88'),_0x142701[_0x829c('0x4a')],util['inspect'](_0x142701,{'showHidden':![],'depth':null}));if(this[_0x829c('0xe')][_0x142701[_0x829c('0x4a')]]){var _0x5e9005=_[_0x829c('0x75')](this[_0x829c('0xe')][_0x142701[_0x829c('0x4a')]]);_0x5e9005[_0x829c('0x35')]=![];_0x5e9005[_0x829c('0x79')]=null;_0x5e9005['assigned']=!![];_0x5e9005[_0x829c('0x89')]=_0x142701[_0x829c('0x8a')];_0x5e9005[_0x829c('0x77')]=_0x142701[_0x829c('0x77')];_0x5e9005[_0x829c('0x36')]=!![];_0x5e9005[_0x829c('0x8b')]=![];_0x5e9005[_0x829c('0x8c')]=null;if(!_0x5e9005['transfer']){if(_0x142701[_0x829c('0x8d')]==_0x829c('0x8e')){_0x5e9005['queuecallerexitreason']=_0x829c('0x8f');logger[_0x829c('0x7b')]('[voiceQueueReport][agentcomplete]\x20name:%s\x20type:%s\x20queuecallerexitreason:COMPLETED',_0x5e9005[_0x829c('0x64')],_0x5e9005[_0x829c('0x50')]);}else{if(_[_0x829c('0x90')](_0x142701[_0x829c('0x3a')]['toLowerCase'](),'local/')){if(this['queueReports'][_0x142701[_0x829c('0x91')]]){var _0x2319d7=_[_0x829c('0x75')](this['queueReports'][_0x142701[_0x829c('0x91')]]);_0x2319d7[_0x829c('0x36')]=![];_0x2319d7['queuecallerexit']=!![];_0x2319d7[_0x829c('0x8c')]=moment(_0x5e9005[_0x829c('0x6d')])[_0x829c('0x92')](_0x142701[_0x829c('0x77')],_0x829c('0x93'))['format'](_0x829c('0x6e'));_0x2319d7['queuecallerexitreason']=_0x829c('0x94');_0x2319d7['transfer']=!![];_0x2319d7[_0x829c('0x95')]=_0x829c('0x96');_0x2319d7[_0x829c('0x97')]=_0x142701['destexten'];_0x2319d7[_0x829c('0x98')]=_0x142701['uniqueid'];logger[_0x829c('0x7b')](_0x829c('0x99'),_0x2319d7['queue'],_0x2319d7[_0x829c('0x50')]);var _0x522fa7=this[_0x829c('0xe')][_0x142701[_0x829c('0x91')]];this[_0x829c('0xe')][_0x142701['linkedid']]=this[_0x829c('0xe')][_0x142701[_0x829c('0x4a')]];this[_0x829c('0xe')][_0x142701[_0x829c('0x4a')]]=_0x522fa7;}}else{_0x5e9005[_0x829c('0x4b')]=_0x829c('0x9a')+_0x142701[_0x829c('0x8d')][_0x829c('0x9b')]();logger[_0x829c('0x7b')](_0x829c('0x9c'),_0x5e9005[_0x829c('0x64')],_0x5e9005['type'],_0x5e9005[_0x829c('0x4b')]);}}}this[_0x829c('0x11')][_0x142701['uniqueid']]=_0x5e9005;}}}catch(_0x3cd71e){logger[_0x829c('0x3e')]('[%s][voiceQueueReport][agentcomplete]',_0x142701['uniqueid'],util[_0x829c('0x3d')](_0x3cd71e,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x829c('0xb')][_0x829c('0x23')]=function(_0xe2c7a5){try{if(this[_0x829c('0x54')](_0xe2c7a5)){logger['debug']('[%s][voiceQueueReport][varset]',_0xe2c7a5[_0x829c('0x4a')],util[_0x829c('0x3d')](_0xe2c7a5,{'showHidden':![],'depth':null}));this[_0x829c('0x9d')](_0xe2c7a5[_0x829c('0x4a')],_['keys'](_0xe2c7a5['variable'])[0x0],_0xe2c7a5[_0x829c('0x9e')]);if(this['queueReports'][_0xe2c7a5[_0x829c('0x4a')]]){var _0x3eca7d=_[_0x829c('0x75')](this[_0x829c('0xe')][_0xe2c7a5['uniqueid']]);if(_0x3eca7d){if(this[_0x829c('0x54')](_0xe2c7a5[_0x829c('0x9f')])&&this[_0x829c('0x54')](_0xe2c7a5[_0x829c('0x9f')][_0x829c('0x5b')])){switch(_0xe2c7a5[_0x829c('0x9e')]){case _0x829c('0xa0'):_0x3eca7d[_0x829c('0x8b')]=![];_0x3eca7d[_0x829c('0x8c')]=null;break;case _0x829c('0xa1'):_0x3eca7d[_0x829c('0xa2')]=_0x829c('0xa3');_0x3eca7d[_0x829c('0x8b')]=!![];_0x3eca7d[_0x829c('0x8c')]=moment()[_0x829c('0x4d')](_0x829c('0x6e'));_0x3eca7d[_0x829c('0x80')]=moment()['format']('YYYY-MM-DD\x20HH:mm:ss');logger[_0x829c('0x45')]('[%s][voiceQueueReport][varset]\x20sending\x20timeout\x20event:',_0xe2c7a5[_0x829c('0x4a')],util[_0x829c('0x3d')](_0x3eca7d,{'showHidden':![],'depth':null}));ami[_0x829c('0x43')](_0x829c('0xa4'),_0x3eca7d);break;default:_0x3eca7d[_0x829c('0x8b')]=!![];_0x3eca7d[_0x829c('0x8c')]=moment()['format'](_0x829c('0x6e'));_0x3eca7d[_0x829c('0x80')]=moment()[_0x829c('0x4d')](_0x829c('0x6e'));}_0x3eca7d[_0x829c('0x35')]=![];_0x3eca7d[_0x829c('0x79')]=null;_0x3eca7d[_0x829c('0x4b')]=_0xe2c7a5[_0x829c('0x9e')];this[_0x829c('0x11')][_0xe2c7a5[_0x829c('0x4a')]]=_0x3eca7d;this[_0x829c('0x7d')](_0x3eca7d,_0x829c('0x22'));}else if(this[_0x829c('0x54')](_0xe2c7a5[_0x829c('0x9f')])&&this['isNotNull'](_0xe2c7a5[_0x829c('0x9f')][_0x829c('0xa5')])){if(!_0x3eca7d[_0x829c('0x35')]){_0x3eca7d['queuecallerexit']=!![];_0x3eca7d[_0x829c('0x8c')]=moment()[_0x829c('0x4d')](_0x829c('0x6e'));_0x3eca7d['queuecallerexitreason']=_0x829c('0xa6');_0x3eca7d['queuecallerleaveAt']=moment()[_0x829c('0x4d')](_0x829c('0x6e'));this[_0x829c('0x11')][_0xe2c7a5[_0x829c('0x4a')]]=_0x3eca7d;}}logger[_0x829c('0x7b')](_0x829c('0xa7'),_0xe2c7a5[_0x829c('0x4a')],_0x3eca7d[_0x829c('0x64')],_0x3eca7d[_0x829c('0x50')],_[_0x829c('0x73')](_0xe2c7a5[_0x829c('0x9f')])[0x0],_0xe2c7a5[_0x829c('0x9e')]);_0x3eca7d[_0x829c('0x3f')]=this[_0x829c('0x3f')][_0xe2c7a5[_0x829c('0x4a')]];}}}}catch(_0x16a0e4){logger[_0x829c('0x3e')](_0x829c('0xa8'),_0xe2c7a5['uniqueid'],util['inspect'](_0x16a0e4,{'showHidden':![],'depth':null}));}};VoiceQueueReport[_0x829c('0xb')][_0x829c('0x9d')]=function(_0x11d0c1,_0x4ebd64,_0x7fc4ea){var _0x413f1f=[_0x829c('0xa9'),_0x829c('0xaa'),_0x829c('0xab'),_0x829c('0xac'),'rtpaudioqosloss',_0x829c('0xad'),_0x829c('0xae'),_0x829c('0xaf'),_0x829c('0xb0'),_0x829c('0xb1'),_0x829c('0xb2'),'bridgepvtcallid',_0x829c('0xb3'),_0x829c('0xb4'),_0x829c('0xb5'),_0x829c('0xb6'),_0x829c('0x8a'),_0x829c('0xb7'),_0x829c('0xb8')];if(!_[_0x829c('0xb9')](_0x4ebd64)&&!_[_0x829c('0xba')](_0x413f1f,_0x4ebd64)){if(_['isUndefined'](this['variables'][_0x11d0c1])){this['variables'][_0x11d0c1]={};}this['variables'][_0x11d0c1][_0x4ebd64]=_0x7fc4ea;}};VoiceQueueReport[_0x829c('0xb')][_0x829c('0xbb')]=function(_0x319bd7,_0x5a5133,_0x413d92){var _0x1e68a7={};for(var _0x49bd0a=0x0;_0x49bd0a=0x0?moment(_0x506091[_0x89e3('0x19')])['diff'](_0x506091[_0x89e3('0x18')],_0x89e3('0x10')):null,'data1':_0x89e3('0x1a'),'data2':_0x506091[_0x89e3('0x14')],'data3':_0x506091['exten'],'data4':_0x506091[_0x89e3('0x1b')]||null,'role':_0x89e3('0x13'),'internal':_0x506091[_0x89e3('0x14')]?_[_0x89e3('0x1c')](_0x506091['accountcode']):undefined,'uniqueid':_0x506091[_0x89e3('0x15')]},'log':'CreateMemberReport'});}; \ No newline at end of file +var _0x495f=['SIP/%s','queuecallerleaveAt','diff','seconds','inbound','calleridnum','exten','queue','agent','accountcode','uniqueid','voiceDialReport','membername','TALKING','starttime','outbound','dialstring','toNumber','moment','util','../client','voiceQueueReport','queuecallercompleteAt','queuecallerexitAt','Request','CreateMemberReport','voice','lastAssignedTo','interface'];(function(_0x1f5e4a,_0x16111e){var _0x380da7=function(_0x49dbbb){while(--_0x49dbbb){_0x1f5e4a['push'](_0x1f5e4a['shift']());}};_0x380da7(++_0x16111e);}(_0x495f,0x86));var _0xf495=function(_0x4fde08,_0x463a36){_0x4fde08=_0x4fde08-0x0;var _0x12e725=_0x495f[_0x4fde08];return _0x12e725;};'use strict';var moment=require(_0xf495('0x0'));var _=require('lodash');var util=require(_0xf495('0x1'));var client=require(_0xf495('0x2'));exports[_0xf495('0x3')]=function(_0x28cca0){var _0x5276d7=_0x28cca0[_0xf495('0x4')]||_0x28cca0[_0xf495('0x5')];return client[_0xf495('0x6')](_0xf495('0x7'),{'body':{'channel':_0xf495('0x8'),'membername':_0x28cca0[_0xf495('0x9')],'interface':_['isNil'](_0x28cca0[_0xf495('0xa')])?util['format'](_0xf495('0xb'),_0x28cca0['lastAssignedTo']):_0x28cca0[_0xf495('0xa')],'type':'TALKING','enterAt':_0x28cca0[_0xf495('0xc')],'exitAt':_0x5276d7,'duration':moment(_0x5276d7)[_0xf495('0xd')](_0x28cca0[_0xf495('0xc')],_0xf495('0xe')),'data1':_0xf495('0xf'),'data2':_0x28cca0[_0xf495('0x10')],'data3':_0x28cca0[_0xf495('0x11')],'data4':null,'data5':_0x28cca0[_0xf495('0x12')],'role':_0xf495('0x13'),'internal':_0x28cca0[_0xf495('0x14')]?_['toNumber'](_0x28cca0['accountcode']):undefined,'uniqueid':_0x28cca0[_0xf495('0x15')]},'log':_0xf495('0x7')});};exports[_0xf495('0x16')]=function(_0x4e91ab){return client[_0xf495('0x6')](_0xf495('0x7'),{'body':{'channel':_0xf495('0x8'),'membername':_0x4e91ab[_0xf495('0x17')],'interface':_0x4e91ab['interface'],'type':_0xf495('0x18'),'enterAt':_0x4e91ab[_0xf495('0x19')],'exitAt':_0x4e91ab['endtime'],'duration':moment(_0x4e91ab['endtime'])[_0xf495('0xd')](_0x4e91ab[_0xf495('0x19')],_0xf495('0xe'))>=0x0?moment(_0x4e91ab['endtime'])[_0xf495('0xd')](_0x4e91ab[_0xf495('0x19')],_0xf495('0xe')):null,'data1':_0xf495('0x1a'),'data2':_0x4e91ab[_0xf495('0x14')],'data3':_0x4e91ab['exten'],'data4':_0x4e91ab[_0xf495('0x1b')]||null,'role':'agent','internal':_0x4e91ab[_0xf495('0x14')]?_[_0xf495('0x1c')](_0x4e91ab['accountcode']):undefined,'uniqueid':_0x4e91ab['uniqueid']},'log':_0xf495('0x7')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/setting.js b/server/services/ami/rpc/setting.js index 956f4ac..c2656d5 100644 --- a/server/services/ami/rpc/setting.js +++ b/server/services/ami/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xbfa6=['../client','getSettings','previewRecallmeReminderInterval','GetSettings'];(function(_0x29d346,_0x2a7e6d){var _0x54bb35=function(_0x42ae1d){while(--_0x42ae1d){_0x29d346['push'](_0x29d346['shift']());}};_0x54bb35(++_0x2a7e6d);}(_0xbfa6,0x1d0));var _0x6bfa=function(_0x17dcd1,_0x3b7ccb){_0x17dcd1=_0x17dcd1-0x0;var _0x12af77=_0xbfa6[_0x17dcd1];return _0x12af77;};'use strict';var client=require(_0x6bfa('0x0'));exports[_0x6bfa('0x1')]=function(){return client['Request']('ShowSetting',{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x6bfa('0x2')]},'log':_0x6bfa('0x3')});}; \ No newline at end of file +var _0xd786=['previewRecallmeReminderInterval','GetSettings','../client','getSettings','Request','ShowSetting'];(function(_0x3ccaa5,_0x1c5fc9){var _0x21b381=function(_0x4fb081){while(--_0x4fb081){_0x3ccaa5['push'](_0x3ccaa5['shift']());}};_0x21b381(++_0x1c5fc9);}(_0xd786,0x1dc));var _0x6d78=function(_0x2f5ac5,_0x1ee939){_0x2f5ac5=_0x2f5ac5-0x0;var _0x37c9a8=_0xd786[_0x2f5ac5];return _0x37c9a8;};'use strict';var client=require(_0x6d78('0x0'));exports[_0x6d78('0x1')]=function(){return client[_0x6d78('0x2')](_0x6d78('0x3'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['stopRecordingOnTransfer',_0x6d78('0x4')]},'log':_0x6d78('0x5')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/template.js b/server/services/ami/rpc/template.js index f82172e..0c86fdf 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 _0x7f0d=['name','html','GetTemplate'];(function(_0x16f8da,_0x251b0d){var _0x35f922=function(_0x14693e){while(--_0x14693e){_0x16f8da['push'](_0x16f8da['shift']());}};_0x35f922(++_0x251b0d);}(_0x7f0d,0x89));var _0xd7f0=function(_0x1d897,_0x52c292){_0x1d897=_0x1d897-0x0;var _0xddf004=_0x7f0d[_0x1d897];return _0xddf004;};'use strict';var client=require('../client');exports['getTemplates']=function(_0x548c1f){return function(_0x4949c1){return client['Request'](_0xd7f0('0x0'),{'options':{'raw':!![],'attributes':['id',_0xd7f0('0x1'),_0xd7f0('0x2')]},'log':_0xd7f0('0x0')});};}; \ No newline at end of file +var _0x4fc2=['GetTemplate','name','html','../client','getTemplates'];(function(_0x1dfebf,_0x1d6791){var _0x5ec3fe=function(_0x874cfc){while(--_0x874cfc){_0x1dfebf['push'](_0x1dfebf['shift']());}};_0x5ec3fe(++_0x1d6791);}(_0x4fc2,0x111));var _0x24fc=function(_0x1af3df,_0x7a5dc2){_0x1af3df=_0x1af3df-0x0;var _0x50eba3=_0x4fc2[_0x1af3df];return _0x50eba3;};'use strict';var client=require(_0x24fc('0x0'));exports[_0x24fc('0x1')]=function(_0x1a4e51){return function(_0x4390a0){return client['Request'](_0x24fc('0x2'),{'options':{'raw':!![],'attributes':['id',_0x24fc('0x3'),_0x24fc('0x4')]},'log':'GetTemplate'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trigger.js b/server/services/ami/rpc/trigger.js index b39da1c..c786c05 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 _0xee8a=['data6','../client','GetTrigger','name','channel','status','Condition','AllConditions','field','operator','value','Action','Actions','action','data1','data4','data5'];(function(_0x49b2c8,_0x201939){var _0x51a964=function(_0x3d1e4f){while(--_0x3d1e4f){_0x49b2c8['push'](_0x49b2c8['shift']());}};_0x51a964(++_0x201939);}(_0xee8a,0x100));var _0xaee8=function(_0x288f5e,_0x205edd){_0x288f5e=_0x288f5e-0x0;var _0x476cc9=_0xee8a[_0x288f5e];return _0x476cc9;};'use strict';var client=require(_0xaee8('0x0'));exports['getTriggers']=function(_0x1cc9a3){return function(_0x55aeb6){return client['Request'](_0xaee8('0x1'),{'options':{'raw':![],'attributes':['id',_0xaee8('0x2'),_0xaee8('0x3'),_0xaee8('0x4')],'include':[{'model':_0xaee8('0x5'),'as':_0xaee8('0x6'),'attributes':['id',_0xaee8('0x7'),_0xaee8('0x8'),_0xaee8('0x9')]},{'model':_0xaee8('0x5'),'as':'AnyConditions','attributes':['id',_0xaee8('0x7'),_0xaee8('0x8'),'value']},{'model':_0xaee8('0xa'),'as':_0xaee8('0xb'),'attributes':['id',_0xaee8('0xc'),_0xaee8('0xd'),'data2','data3',_0xaee8('0xe'),_0xaee8('0xf'),_0xaee8('0x10'),'data7']}]},'log':_0xaee8('0x1')});};}; \ No newline at end of file +var _0x0c38=['data2','data3','data5','data7','../client','getTriggers','GetTrigger','status','Condition','AllConditions','field','operator','value','AnyConditions','Action','Actions','action','data1'];(function(_0x2dafbe,_0x5d04de){var _0x58a45a=function(_0x50ac96){while(--_0x50ac96){_0x2dafbe['push'](_0x2dafbe['shift']());}};_0x58a45a(++_0x5d04de);}(_0x0c38,0xa6));var _0x80c3=function(_0x73aa2c,_0x1f8853){_0x73aa2c=_0x73aa2c-0x0;var _0x1f6176=_0x0c38[_0x73aa2c];return _0x1f6176;};'use strict';var client=require(_0x80c3('0x0'));exports[_0x80c3('0x1')]=function(_0x4c8c65){return function(_0x2a4e71){return client['Request'](_0x80c3('0x2'),{'options':{'raw':![],'attributes':['id','name','channel',_0x80c3('0x3')],'include':[{'model':_0x80c3('0x4'),'as':_0x80c3('0x5'),'attributes':['id',_0x80c3('0x6'),_0x80c3('0x7'),_0x80c3('0x8')]},{'model':_0x80c3('0x4'),'as':_0x80c3('0x9'),'attributes':['id',_0x80c3('0x6'),_0x80c3('0x7'),_0x80c3('0x8')]},{'model':_0x80c3('0xa'),'as':_0x80c3('0xb'),'attributes':['id',_0x80c3('0xc'),_0x80c3('0xd'),_0x80c3('0xe'),_0x80c3('0xf'),'data4',_0x80c3('0x10'),'data6',_0x80c3('0x11')]}]},'log':_0x80c3('0x2')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/trunk.js b/server/services/ami/rpc/trunk.js index b72623c..5b3a74d 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 _0xbbdc=['getTrunks','defaultuser','../client'];(function(_0x4f0a3a,_0x14f8d9){var _0x430cca=function(_0x48ae46){while(--_0x48ae46){_0x4f0a3a['push'](_0x4f0a3a['shift']());}};_0x430cca(++_0x14f8d9);}(_0xbbdc,0x1eb));var _0xcbbd=function(_0x25a0b9,_0x86e28f){_0x25a0b9=_0x25a0b9-0x0;var _0x30b9ab=_0xbbdc[_0x25a0b9];return _0x30b9ab;};'use strict';var client=require(_0xcbbd('0x0'));exports[_0xcbbd('0x1')]=function(_0x4f496d){return function(_0x4c4d13){return client['Request']('GetTrunk',{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id','name','registry',_0xcbbd('0x2')]},'log':'GetTrunk'});};}; \ No newline at end of file +var _0x167e=['registry','../client','getTrunks','Request','GetTrunk','name'];(function(_0x4147ff,_0x154530){var _0x1e71e6=function(_0x21f992){while(--_0x21f992){_0x4147ff['push'](_0x4147ff['shift']());}};_0x1e71e6(++_0x154530);}(_0x167e,0xa3));var _0xe167=function(_0x5e61b4,_0x2b5288){_0x5e61b4=_0x5e61b4-0x0;var _0x44fb23=_0x167e[_0x5e61b4];return _0x44fb23;};'use strict';var client=require(_0xe167('0x0'));exports[_0xe167('0x1')]=function(_0x2a44c5){return function(_0x38b912){return client[_0xe167('0x2')](_0xe167('0x3'),{'options':{'raw':!![],'where':{'active':0x1},'attributes':['id',_0xe167('0x4'),_0xe167('0x5'),'defaultuser']},'log':_0xe167('0x3')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/user.js b/server/services/ami/rpc/user.js index b39dbd8..d200bba 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 _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5ddb1c,_0x5ea4df){_0x5ddb1c=_0x5ddb1c-0x0;var _0x354adc=_0xa9e0[_0x5ddb1c];return _0x354adc;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file +var _0xa9e0=['agent','lastPauseAt','interface','../client','getAgents','Request','name','accountcode','fullname','online','lastLoginAt','pauseType','voicePause','phone','mobile','getTelephones','telephone','internal','savePause','PauseUser','saveUnpause','UnpauseUser','getAgent','ShowUser'];(function(_0x46e363,_0x45d7e2){var _0x3fb059=function(_0x5e6274){while(--_0x5e6274){_0x46e363['push'](_0x46e363['shift']());}};_0x3fb059(++_0x45d7e2);}(_0xa9e0,0x123));var _0x0a9e=function(_0x37bd26,_0x5ad346){_0x37bd26=_0x37bd26-0x0;var _0xe83dc4=_0xa9e0[_0x37bd26];return _0xe83dc4;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'lastPauseAt',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'interface']},'log':'getAgents'});};};exports[_0x0a9e('0xc')]=function(){return function(){return client['Request']('GetUser',{'options':{'raw':!![],'where':{'role':_0x0a9e('0xd')},'attributes':['id',_0x0a9e('0x3'),_0x0a9e('0x4'),_0x0a9e('0xe')]},'log':_0x0a9e('0xc')});};};exports[_0x0a9e('0xf')]=function(_0x4a4c56,_0x50dfb2,_0x527cdd){return client['Request'](_0x0a9e('0x10'),{'body':{'type':_0x50dfb2,'uniqueid':_0x527cdd},'options':{'where':{'id':_0x4a4c56['id']}},'log':_0x0a9e('0xf')});};exports[_0x0a9e('0x11')]=function(_0x26d672){return client[_0x0a9e('0x2')](_0x0a9e('0x12'),{'body':{},'options':{'where':{'id':_0x26d672['id']}},'log':'savePause'});};exports[_0x0a9e('0x13')]=function(_0x239b12){return client[_0x0a9e('0x2')](_0x0a9e('0x14'),{'options':{'raw':![],'where':{'role':_0x0a9e('0x15'),'id':_0x239b12},'attributes':['id',_0x0a9e('0x3'),'email',_0x0a9e('0x4'),'fullname',_0x0a9e('0x6'),'lastLoginAt',_0x0a9e('0x8'),_0x0a9e('0x16'),'voicePause',_0x0a9e('0x17')]},'log':'getAgent'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceAgentReport.js b/server/services/ami/rpc/voiceAgentReport.js index 4cefa45..6ab53c7 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 _0x16f9=['../client','create','CreateVoiceAgentReport','Request','UpdateVoiceAgentReport'];(function(_0x51da35,_0x2a7cd2){var _0x14c227=function(_0x4f0b40){while(--_0x4f0b40){_0x51da35['push'](_0x51da35['shift']());}};_0x14c227(++_0x2a7cd2);}(_0x16f9,0x8c));var _0x916f=function(_0x38558e,_0x8aa4a6){_0x38558e=_0x38558e-0x0;var _0x332063=_0x16f9[_0x38558e];return _0x332063;};'use strict';var client=require(_0x916f('0x0'));exports[_0x916f('0x1')]=function(_0x572d91){return client['Request'](_0x916f('0x2'),{'body':_0x572d91,'log':'CreateVoiceAgentReport'});};exports['update']=function(_0x5da753,_0xc8c4c6,_0x1a21f0){return client[_0x916f('0x3')](_0x916f('0x4'),{'body':_0x5da753,'options':{'where':{'uniqueid':_0xc8c4c6,'interface':_0x1a21f0,'agentcomplete':!![]}},'log':_0x916f('0x4')});}; \ No newline at end of file +var _0x367f=['../client','Request','CreateVoiceAgentReport','UpdateVoiceAgentReport'];(function(_0x211664,_0x3ccacc){var _0x14524d=function(_0x4175fb){while(--_0x4175fb){_0x211664['push'](_0x211664['shift']());}};_0x14524d(++_0x3ccacc);}(_0x367f,0x17c));var _0xf367=function(_0x6f7b4a,_0x41569b){_0x6f7b4a=_0x6f7b4a-0x0;var _0x3fc92b=_0x367f[_0x6f7b4a];return _0x3fc92b;};'use strict';var client=require(_0xf367('0x0'));exports['create']=function(_0x352ae4){return client[_0xf367('0x1')](_0xf367('0x2'),{'body':_0x352ae4,'log':_0xf367('0x2')});};exports['update']=function(_0x92ee19,_0x260451,_0x5b38d8){return client['Request'](_0xf367('0x3'),{'body':_0x92ee19,'options':{'where':{'uniqueid':_0x260451,'interface':_0x5b38d8,'agentcomplete':!![]}},'log':'UpdateVoiceAgentReport'});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceCallReport.js b/server/services/ami/rpc/voiceCallReport.js index 2ed18cf..8a24bd4 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 _0x77a4=['endOf','day','disposition','duration','billableseconds','moment','lodash','../client','create','CreateVoiceCallReport','merge','calleridnum','DOCUMENTATION','getVoiceCallReports','Request','startOf','format','YYYY-MM-DD\x20HH:mm:ss'];(function(_0x3794a0,_0x1a9cfc){var _0x5bdaba=function(_0x14a764){while(--_0x14a764){_0x3794a0['push'](_0x3794a0['shift']());}};_0x5bdaba(++_0x1a9cfc);}(_0x77a4,0x83));var _0x477a=function(_0x4bc4c8,_0x3139d3){_0x4bc4c8=_0x4bc4c8-0x0;var _0x3bb121=_0x77a4[_0x4bc4c8];return _0x3bb121;};'use strict';var moment=require(_0x477a('0x0'));var util=require('util');var _=require(_0x477a('0x1'));var client=require(_0x477a('0x2'));exports[_0x477a('0x3')]=function(_0x292091){return client['Request'](_0x477a('0x4'),{'body':_[_0x477a('0x5')](_0x292091,{'source':_0x292091[_0x477a('0x6')],'destinationcontext':_0x292091['context'],'callerid':_0x292091['callerid'],'amaflags':_0x477a('0x7')}),'log':'CreateVoiceCallReport'});};exports[_0x477a('0x8')]=function(){return function(){return client[_0x477a('0x9')]('GetVoiceCallReport',{'options':{'where':{'type':['outbound'],'createdAt':{'$between':[moment()[_0x477a('0xa')]('day')[_0x477a('0xb')](_0x477a('0xc')),moment()[_0x477a('0xd')](_0x477a('0xe'))[_0x477a('0xb')](_0x477a('0xc'))]}},'attributes':['type',_0x477a('0xf'),_0x477a('0x10'),_0x477a('0x11')]},'log':'GetVoiceCallReports'});};}; \ No newline at end of file +var _0xef9d=['type','duration','billableseconds','GetVoiceCallReports','util','../client','create','Request','merge','calleridnum','callerid','DOCUMENTATION','CreateVoiceCallReport','getVoiceCallReports','GetVoiceCallReport','outbound','startOf','day','format','endOf','YYYY-MM-DD\x20HH:mm:ss'];(function(_0xfae23b,_0x2be4ba){var _0x200640=function(_0x4ae258){while(--_0x4ae258){_0xfae23b['push'](_0xfae23b['shift']());}};_0x200640(++_0x2be4ba);}(_0xef9d,0x6d));var _0xdef9=function(_0x32a58a,_0x11cf5e){_0x32a58a=_0x32a58a-0x0;var _0x100df6=_0xef9d[_0x32a58a];return _0x100df6;};'use strict';var moment=require('moment');var util=require(_0xdef9('0x0'));var _=require('lodash');var client=require(_0xdef9('0x1'));exports[_0xdef9('0x2')]=function(_0x532085){return client[_0xdef9('0x3')]('CreateVoiceCallReport',{'body':_[_0xdef9('0x4')](_0x532085,{'source':_0x532085[_0xdef9('0x5')],'destinationcontext':_0x532085['context'],'callerid':_0x532085[_0xdef9('0x6')],'amaflags':_0xdef9('0x7')}),'log':_0xdef9('0x8')});};exports[_0xdef9('0x9')]=function(){return function(){return client[_0xdef9('0x3')](_0xdef9('0xa'),{'options':{'where':{'type':[_0xdef9('0xb')],'createdAt':{'$between':[moment()[_0xdef9('0xc')](_0xdef9('0xd'))[_0xdef9('0xe')]('YYYY-MM-DD\x20HH:mm:ss'),moment()[_0xdef9('0xf')](_0xdef9('0xd'))['format'](_0xdef9('0x10'))]}},'attributes':[_0xdef9('0x11'),'disposition',_0xdef9('0x12'),_0xdef9('0x13')]},'log':_0xdef9('0x14')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceDialReport.js b/server/services/ami/rpc/voiceDialReport.js index 1bdcc8d..b9cf3bc 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 _0xa560=['create','CreateVoiceDialReport','../client'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0xa560,0x152));var _0x0a56=function(_0x21a9d9,_0x4d5ac8){_0x21a9d9=_0x21a9d9-0x0;var _0x46adce=_0xa560[_0x21a9d9];return _0x46adce;};'use strict';var client=require(_0x0a56('0x0'));exports[_0x0a56('0x1')]=function(_0x57a237){return client['Request'](_0x0a56('0x2'),{'body':_0x57a237,'log':_0x0a56('0x2')});}; \ No newline at end of file +var _0x2d6a=['CreateVoiceDialReport','../client','create','Request'];(function(_0x1e8591,_0x5520d8){var _0x2b91dc=function(_0x4d8e40){while(--_0x4d8e40){_0x1e8591['push'](_0x1e8591['shift']());}};_0x2b91dc(++_0x5520d8);}(_0x2d6a,0x1a9));var _0xa2d6=function(_0x112bcc,_0x1b2631){_0x112bcc=_0x112bcc-0x0;var _0x54a0f0=_0x2d6a[_0x112bcc];return _0x54a0f0;};'use strict';var client=require(_0xa2d6('0x0'));exports[_0xa2d6('0x1')]=function(_0x3e39a0){return client[_0xa2d6('0x2')](_0xa2d6('0x3'),{'body':_0x3e39a0,'log':_0xa2d6('0x3')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceExtension.js b/server/services/ami/rpc/voiceExtension.js index d9886de..2d6b863 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 _0x1491=['Request','GetVoiceExtension','recordingFormat','../client','getVoiceExtensions'];(function(_0xe6e78c,_0x582369){var _0x2a09c8=function(_0x470ccc){while(--_0x470ccc){_0xe6e78c['push'](_0xe6e78c['shift']());}};_0x2a09c8(++_0x582369);}(_0x1491,0x1b1));var _0x1149=function(_0x31483d,_0x1d0201){_0x31483d=_0x31483d-0x0;var _0x1ed9d5=_0x1491[_0x31483d];return _0x1ed9d5;};'use strict';var client=require(_0x1149('0x0'));exports[_0x1149('0x1')]=function(){return function(){return client[_0x1149('0x2')](_0x1149('0x3'),{'options':{'raw':!![],'attributes':['id','exten',_0x1149('0x4')],'where':{'VoiceExtensionId':null}},'log':_0x1149('0x1')});};}; \ No newline at end of file +var _0x136c=['recordingFormat','../client','getVoiceExtensions','GetVoiceExtension','exten'];(function(_0x45ad6d,_0x1d06cb){var _0x538183=function(_0x54e514){while(--_0x54e514){_0x45ad6d['push'](_0x45ad6d['shift']());}};_0x538183(++_0x1d06cb);}(_0x136c,0x1d2));var _0xc136=function(_0x66454d,_0x4ddf22){_0x66454d=_0x66454d-0x0;var _0x4eb726=_0x136c[_0x66454d];return _0x4eb726;};'use strict';var client=require(_0xc136('0x0'));exports[_0xc136('0x1')]=function(){return function(){return client['Request'](_0xc136('0x2'),{'options':{'raw':!![],'attributes':['id',_0xc136('0x3'),_0xc136('0x4')],'where':{'VoiceExtensionId':null}},'log':_0xc136('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueue.js b/server/services/ami/rpc/voiceQueue.js index 423078e..7b351eb 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 _0x6fcb=['dialRecallMeTimeout','dialRecallInQueue','dialOrderByScheduledAt','dialAgiAfterHangupAgent','dialAgiAfterHangupClient','strategy','dialNoSuchNumberMaxRetry','dialNoSuchNumberRetryFrequency','dialDropMaxRetry','dialDropRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMaxThreshold','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','name','callerid','active','mandatoryDispositionPause','TrunkBackup','Interval','Intervals','interval','../client','getVoiceQueues','Request','GetVoiceQueue','acw','acwTimeout','autopause','monitor_format','type','dialMethod','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueOptions','dialQueueTimeout','dialQueueProject','dialCongestionRetryFrequency','dialBusyMaxRetry','dialBusyRetryFrequency','dialGlobalInterval','dialCheckDuplicateType','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout'];(function(_0x4f8b2b,_0x1dc8dd){var _0x2f230a=function(_0x232685){while(--_0x232685){_0x4f8b2b['push'](_0x4f8b2b['shift']());}};_0x2f230a(++_0x1dc8dd);}(_0x6fcb,0x1db));var _0xb6fc=function(_0x292943,_0x2211dd){_0x292943=_0x292943-0x0;var _0x573350=_0x6fcb[_0x292943];return _0x573350;};'use strict';var client=require(_0xb6fc('0x0'));exports[_0xb6fc('0x1')]=function(){return function(){return client[_0xb6fc('0x2')](_0xb6fc('0x3'),{'options':{'raw':![],'attributes':['id','name',_0xb6fc('0x4'),_0xb6fc('0x5'),_0xb6fc('0x6'),_0xb6fc('0x7'),_0xb6fc('0x8'),'dialActive',_0xb6fc('0x9'),'dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage',_0xb6fc('0xa'),_0xb6fc('0xb'),_0xb6fc('0xc'),_0xb6fc('0xd'),_0xb6fc('0xe'),_0xb6fc('0xf'),_0xb6fc('0x10'),'dialCongestionMaxRetry',_0xb6fc('0x11'),_0xb6fc('0x12'),_0xb6fc('0x13'),'dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone',_0xb6fc('0x14'),'dialPrefix',_0xb6fc('0x15'),'dialAMDActive','dialAMDInitialSilence',_0xb6fc('0x16'),_0xb6fc('0x17'),_0xb6fc('0x18'),'dialAMDMinWordLength',_0xb6fc('0x19'),_0xb6fc('0x1a'),_0xb6fc('0x1b'),'dialAMDMaximumWordLength',_0xb6fc('0x1c'),_0xb6fc('0x1d'),_0xb6fc('0x1e'),_0xb6fc('0x1f'),_0xb6fc('0x20'),_0xb6fc('0x21'),'dialQueueProject2',_0xb6fc('0x7'),_0xb6fc('0x22'),'dialRandomLastDigitCallerIdNumber','dialCutDigit',_0xb6fc('0x23'),_0xb6fc('0x24'),_0xb6fc('0x25'),_0xb6fc('0x26'),'dialAbandonedMaxRetry','dialAbandonedRetryFrequency',_0xb6fc('0x27'),_0xb6fc('0x28'),'dialAgentRejectMaxRetry',_0xb6fc('0x29'),_0xb6fc('0x2a'),_0xb6fc('0x2b'),_0xb6fc('0x2c'),_0xb6fc('0x2d'),_0xb6fc('0x2e')],'include':[{'model':_0xb6fc('0x2f'),'as':_0xb6fc('0x2f'),'attributes':['id',_0xb6fc('0x30'),_0xb6fc('0x31'),_0xb6fc('0x32')]},{'model':'Pause','as':_0xb6fc('0x33'),'attributes':['id',_0xb6fc('0x30')]},{'model':_0xb6fc('0x2f'),'as':_0xb6fc('0x34'),'attributes':['id',_0xb6fc('0x30'),'callerid','active']},{'model':'Interval','as':_0xb6fc('0x35'),'attributes':['id',_0xb6fc('0x30')],'include':[{'model':_0xb6fc('0x35'),'as':_0xb6fc('0x36'),'attributes':['id',_0xb6fc('0x30'),_0xb6fc('0x37')]}]}]},'log':'getVoiceQueues'});};}; \ No newline at end of file +var _0xe0ba=['dialCheckDuplicateType','dialAMDActive','dialAMDInitialSilence','dialAMDGreeting','dialAMDAfterGreetingSilence','dialAMDTotalAnalysisTime','dialAMDMinWordLength','dialAMDBetweenWordsSilence','dialAMDMaximumNumberOfWords','dialAMDSilenceThreshold','timeout','dialRecallMeTimeout','dialOrderByScheduledAt','dialAgiAfterHangupClient','dialQueueProject2','dialRandomLastDigitCallerIdNumber','dialNoSuchNumberMaxRetry','dialDropMaxRetry','dialDropRetryFrequency','dialAbandonedMaxRetry','dialAbandonedRetryFrequency','dialMachineMaxRetry','dialMachineRetryFrequency','dialAgentRejectMaxRetry','dialAgentRejectRetryFrequency','mandatoryDisposition','dialPredictiveIntervalMinThreshold','dialPreviewAutoRecallMe','dialPreviewRecallmeReminder','Trunk','active','Pause','mandatoryDispositionPause','TrunkBackup','callerid','Interval','Intervals','interval','getVoiceQueues','Request','GetVoiceQueue','name','acwTimeout','autopause','monitor_format','type','dialActive','dialMethod','dialLimitChannel','dialLimitQueue','dialPowerLevel','dialPredictiveOptimization','dialPredictiveOptimizationPercentage','dialPredictiveInterval','dialOriginateCallerIdName','dialOriginateCallerIdNumber','dialOriginateTimeout','dialQueueTimeout','dialQueueProject','dialCongestionMaxRetry','dialCongestionRetryFrequency','dialBusyMaxRetry','dialNoAnswerMaxRetry','dialNoAnswerRetryFrequency','dialGlobalMaxRetry','dialTimezone','dialGlobalInterval','dialPrefix'];(function(_0x4fb8fe,_0x579f65){var _0x5efd57=function(_0x5b0fbc){while(--_0x5b0fbc){_0x4fb8fe['push'](_0x4fb8fe['shift']());}};_0x5efd57(++_0x579f65);}(_0xe0ba,0x6a));var _0xae0b=function(_0x68ee8b,_0x3cc6c5){_0x68ee8b=_0x68ee8b-0x0;var _0x5148f7=_0xe0ba[_0x68ee8b];return _0x5148f7;};'use strict';var client=require('../client');exports[_0xae0b('0x0')]=function(){return function(){return client[_0xae0b('0x1')](_0xae0b('0x2'),{'options':{'raw':![],'attributes':['id',_0xae0b('0x3'),'acw',_0xae0b('0x4'),_0xae0b('0x5'),_0xae0b('0x6'),_0xae0b('0x7'),_0xae0b('0x8'),_0xae0b('0x9'),_0xae0b('0xa'),_0xae0b('0xb'),_0xae0b('0xc'),_0xae0b('0xd'),_0xae0b('0xe'),_0xae0b('0xf'),_0xae0b('0x10'),_0xae0b('0x11'),_0xae0b('0x12'),'dialQueueOptions',_0xae0b('0x13'),_0xae0b('0x14'),_0xae0b('0x15'),_0xae0b('0x16'),_0xae0b('0x17'),'dialBusyRetryFrequency',_0xae0b('0x18'),_0xae0b('0x19'),_0xae0b('0x1a'),_0xae0b('0x1b'),_0xae0b('0x1c'),_0xae0b('0x1d'),_0xae0b('0x1e'),_0xae0b('0x1f'),_0xae0b('0x20'),_0xae0b('0x21'),_0xae0b('0x22'),_0xae0b('0x23'),_0xae0b('0x24'),_0xae0b('0x25'),_0xae0b('0x26'),_0xae0b('0x27'),'dialAMDMaximumWordLength',_0xae0b('0x28'),_0xae0b('0x29'),'dialRecallInQueue',_0xae0b('0x2a'),'dialAgiAfterHangupAgent',_0xae0b('0x2b'),_0xae0b('0x2c'),'monitor_format','strategy',_0xae0b('0x2d'),'dialCutDigit',_0xae0b('0x2e'),'dialNoSuchNumberRetryFrequency',_0xae0b('0x2f'),_0xae0b('0x30'),_0xae0b('0x31'),_0xae0b('0x32'),_0xae0b('0x33'),_0xae0b('0x34'),_0xae0b('0x35'),_0xae0b('0x36'),_0xae0b('0x37'),'dialPredictiveIntervalMaxThreshold',_0xae0b('0x38'),_0xae0b('0x39'),_0xae0b('0x3a')],'include':[{'model':_0xae0b('0x3b'),'as':_0xae0b('0x3b'),'attributes':['id',_0xae0b('0x3'),'callerid',_0xae0b('0x3c')]},{'model':_0xae0b('0x3d'),'as':_0xae0b('0x3e'),'attributes':['id',_0xae0b('0x3')]},{'model':_0xae0b('0x3b'),'as':_0xae0b('0x3f'),'attributes':['id',_0xae0b('0x3'),_0xae0b('0x40'),'active']},{'model':_0xae0b('0x41'),'as':'Interval','attributes':['id',_0xae0b('0x3')],'include':[{'model':_0xae0b('0x41'),'as':_0xae0b('0x42'),'attributes':['id','name',_0xae0b('0x43')]}]}]},'log':_0xae0b('0x0')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueReport.js b/server/services/ami/rpc/voiceQueueReport.js index 6f303c7..0eea412 100644 --- a/server/services/ami/rpc/voiceQueueReport.js +++ b/server/services/ami/rpc/voiceQueueReport.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x25bd67,_0x9829ca){var _0x2385ad=function(_0x214009){while(--_0x214009){_0x25bd67['push'](_0x25bd67['shift']());}};_0x2385ad(++_0x9829ca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x32d457,_0x1a39c9){_0x32d457=_0x32d457-0x0;var _0x338386=_0xa9e0[_0x32d457];return _0x338386;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file +var _0xa9e0=['queuecallerexit','queuecallerexitAt','moment','lodash','../client','Request','CreateVoiceQueueReport','getVoiceQueueReports','GetVoiceQueueReport','startOf','format','YYYY-MM-DD\x20HH:mm:ss','endOf','queuecallerjoinAt','queuecallerleaveAt','queuecallercomplete','queuecallercompleteAt'];(function(_0x27ace6,_0x4c7c14){var _0x27fc22=function(_0x27982f){while(--_0x27982f){_0x27ace6['push'](_0x27ace6['shift']());}};_0x27fc22(++_0x4c7c14);}(_0xa9e0,0x123));var _0x0a9e=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0xa9e0[_0x54d4fe];return _0x1ab5bb;};'use strict';var moment=require(_0x0a9e('0x0'));var _=require(_0x0a9e('0x1'));var client=require(_0x0a9e('0x2'));exports['create']=function(_0x550fbc){return client[_0x0a9e('0x3')]('CreateVoiceQueueReport',{'body':_0x550fbc,'log':_0x0a9e('0x4')});};exports[_0x0a9e('0x5')]=function(){return function(){return client[_0x0a9e('0x3')](_0x0a9e('0x6'),{'options':{'where':{'createdAt':{'$between':[moment()[_0x0a9e('0x7')]('day')[_0x0a9e('0x8')](_0x0a9e('0x9')),moment()[_0x0a9e('0xa')]('day')['format'](_0x0a9e('0x9'))]}},'attributes':['uniqueid','queue',_0x0a9e('0xb'),_0x0a9e('0xc'),_0x0a9e('0xd'),_0x0a9e('0xe'),_0x0a9e('0xf'),_0x0a9e('0x10'),'queuecallerabandon','queuecallerabandonAt']},'log':'GetVoiceQueueReports'});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceQueueRt.js b/server/services/ami/rpc/voiceQueueRt.js index 9881400..efa496b 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 _0xf86d=['getVoiceQueueRtPauses','GetVoiceQueueRtPauses','../client'];(function(_0xe6036b,_0x57ced5){var _0x9dd9e=function(_0x413feb){while(--_0x413feb){_0xe6036b['push'](_0xe6036b['shift']());}};_0x9dd9e(++_0x57ced5);}(_0xf86d,0x185));var _0xdf86=function(_0x22dac7,_0x45d32a){_0x22dac7=_0x22dac7-0x0;var _0x3e6cfa=_0xf86d[_0x22dac7];return _0x3e6cfa;};'use strict';var client=require(_0xdf86('0x0'));exports[_0xdf86('0x1')]=function(_0xe7e868){return function(){return client['Request'](_0xdf86('0x2'),{'options':{'where':{'VoiceQueueId':_0xe7e868,'paused':!![]},'raw':!![]},'log':_0xdf86('0x1')});};}; \ No newline at end of file +var _0x7c2e=['Request','getVoiceQueueRtPauses'];(function(_0x59619e,_0x34c445){var _0x3c0add=function(_0x4260c8){while(--_0x4260c8){_0x59619e['push'](_0x59619e['shift']());}};_0x3c0add(++_0x34c445);}(_0x7c2e,0x12e));var _0xe7c2=function(_0x57a22a,_0x275cae){_0x57a22a=_0x57a22a-0x0;var _0x552440=_0x7c2e[_0x57a22a];return _0x552440;};'use strict';var client=require('../client');exports['getVoiceQueueRtPauses']=function(_0x133e52){return function(){return client[_0xe7c2('0x0')]('GetVoiceQueueRtPauses',{'options':{'where':{'VoiceQueueId':_0x133e52,'paused':!![]},'raw':!![]},'log':_0xe7c2('0x1')});};}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceRecording.js b/server/services/ami/rpc/voiceRecording.js index 8cc6940..0ff5ef1 100644 --- a/server/services/ami/rpc/voiceRecording.js +++ b/server/services/ami/rpc/voiceRecording.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x9957=['CreateVoiceRecording','merge','monitorFilename','lodash','../client','create'];(function(_0x1bb764,_0x3abf00){var _0x38a97e=function(_0x3335e4){while(--_0x3335e4){_0x1bb764['push'](_0x1bb764['shift']());}};_0x38a97e(++_0x3abf00);}(_0x9957,0x93));var _0x7995=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x9957[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x7995('0x0'));var client=require(_0x7995('0x1'));exports[_0x7995('0x2')]=function(_0x10a05d){return client['Request'](_0x7995('0x3'),{'body':_[_0x7995('0x4')](_0x10a05d,{'value':_0x10a05d[_0x7995('0x5')]}),'log':_0x7995('0x3')});}; \ No newline at end of file +var _0x7a54=['create','Request','CreateVoiceRecording','monitorFilename','lodash','../client'];(function(_0x465fdb,_0x1e1af5){var _0x45b730=function(_0x32dee1){while(--_0x32dee1){_0x465fdb['push'](_0x465fdb['shift']());}};_0x45b730(++_0x1e1af5);}(_0x7a54,0x106));var _0x47a5=function(_0x295a74,_0x24f141){_0x295a74=_0x295a74-0x0;var _0x1a257c=_0x7a54[_0x295a74];return _0x1a257c;};'use strict';var _=require(_0x47a5('0x0'));var client=require(_0x47a5('0x1'));exports[_0x47a5('0x2')]=function(_0x58157c){return client[_0x47a5('0x3')](_0x47a5('0x4'),{'body':_['merge'](_0x58157c,{'value':_0x58157c[_0x47a5('0x5')]}),'log':_0x47a5('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/rpc/voiceTransferReport.js b/server/services/ami/rpc/voiceTransferReport.js index 13c7846..0e54d3f 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 _0xd091=['transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','transfertargetlinkedid','origtransferercontext','origtransfererexten','attended','../client','transfers','blindTransfer','transfererchannel','transfererconnectedlinenum','transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridnum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','CreateVoiceTransferReport','result','origtransfererchannel','origtransferercalleridname','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridname'];(function(_0x42448d,_0x5816f5){var _0x47ba4a=function(_0x3b5735){while(--_0x3b5735){_0x42448d['push'](_0x42448d['shift']());}};_0x47ba4a(++_0x5816f5);}(_0xd091,0xa1));var _0x1d09=function(_0x3d6084,_0x4b738b){_0x3d6084=_0x3d6084-0x0;var _0x342378=_0xd091[_0x3d6084];return _0x342378;};'use strict';var client=require(_0x1d09('0x0'));exports[_0x1d09('0x1')]={};exports[_0x1d09('0x2')]=function(_0x4a6de2){return client['Request']('CreateVoiceTransferReport',{'body':{'result':_0x4a6de2['result'],'transfererchannel':_0x4a6de2[_0x1d09('0x3')],'transferercalleridnum':_0x4a6de2['transferercalleridnum'],'transferercalleridname':_0x4a6de2['transferercalleridname'],'transfererconnectedlinenum':_0x4a6de2[_0x1d09('0x4')],'transfererconnectedlinename':_0x4a6de2[_0x1d09('0x5')],'transfereraccountcode':_0x4a6de2[_0x1d09('0x6')],'transferercontext':_0x4a6de2[_0x1d09('0x7')],'transfererexten':_0x4a6de2['transfererexten'],'transfererlinkedid':_0x4a6de2[_0x1d09('0x8')],'transfereechannel':_0x4a6de2[_0x1d09('0x9')],'transfereecalleridnum':_0x4a6de2[_0x1d09('0xa')],'transfereecalleridname':_0x4a6de2['transfereecalleridname'],'transfereeconnectedlinenum':_0x4a6de2['transfereeconnectedlinenum'],'transfereeconnectedlinename':_0x4a6de2[_0x1d09('0xb')],'transfereeaccountcode':_0x4a6de2[_0x1d09('0xc')],'transfereecontext':_0x4a6de2[_0x1d09('0xd')],'transfereeexten':_0x4a6de2[_0x1d09('0xe')],'transfereelinkedid':_0x4a6de2[_0x1d09('0xf')],'isexternal':_0x4a6de2[_0x1d09('0x10')],'context':_0x4a6de2[_0x1d09('0x11')],'extension':_0x4a6de2['extension'],'type':_0x1d09('0x12')},'log':'CreateVoiceTransferReport'});};exports[_0x1d09('0x13')]=function(_0x5d03e2){return client['Request'](_0x1d09('0x14'),{'body':{'result':_0x5d03e2[_0x1d09('0x15')],'transfererchannel':_0x5d03e2[_0x1d09('0x16')],'transferercalleridnum':_0x5d03e2['origtransferercalleridnum'],'transferercalleridname':_0x5d03e2[_0x1d09('0x17')],'transfererconnectedlinenum':_0x5d03e2[_0x1d09('0x18')],'transfererconnectedlinename':_0x5d03e2[_0x1d09('0x19')],'transfereraccountcode':_0x5d03e2['origtransfereraccountcode'],'transferercontext':_0x5d03e2['secondtransferercontext'],'transfererexten':_0x5d03e2['secondtransfererexten'],'transfererlinkedid':_0x5d03e2[_0x1d09('0x1a')],'transfereechannel':_0x5d03e2[_0x1d09('0x1b')],'transfereecalleridnum':_0x5d03e2['transfertargetcalleridnum'],'transfereecalleridname':_0x5d03e2[_0x1d09('0x1c')],'transfereeconnectedlinenum':_0x5d03e2[_0x1d09('0x1d')],'transfereeconnectedlinename':_0x5d03e2[_0x1d09('0x1e')],'transfereeaccountcode':_0x5d03e2[_0x1d09('0x1f')],'transfereecontext':_0x5d03e2[_0x1d09('0x20')],'transfereeexten':_0x5d03e2[_0x1d09('0x21')],'transfereelinkedid':_0x5d03e2[_0x1d09('0x22')],'isexternal':_0x5d03e2[_0x1d09('0x10')],'context':_0x5d03e2[_0x1d09('0x23')],'extension':_0x5d03e2[_0x1d09('0x24')],'type':_0x1d09('0x25')},'log':_0x1d09('0x14')});}; \ No newline at end of file +var _0xc9be=['transfererconnectedlinename','transfereraccountcode','transferercontext','transfererlinkedid','transfereechannel','transfereecalleridname','transfereeconnectedlinenum','transfereeconnectedlinename','transfereeaccountcode','transfereecontext','transfereeexten','transfereelinkedid','isexternal','context','blind','attendedTransfer','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','transfertargetchannel','transfertargetcalleridnum','transfertargetcalleridname','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetexten','transfertargetlinkedid','origtransferercontext','attended','../client','transfers','blindTransfer','Request','CreateVoiceTransferReport','result','transfererchannel','transferercalleridnum','transferercalleridname','transfererconnectedlinenum'];(function(_0x473134,_0x1a6476){var _0xc1224e=function(_0xdaf9e1){while(--_0xdaf9e1){_0x473134['push'](_0x473134['shift']());}};_0xc1224e(++_0x1a6476);}(_0xc9be,0x9e));var _0xec9b=function(_0x5e9a12,_0x2ac6e7){_0x5e9a12=_0x5e9a12-0x0;var _0x17fc63=_0xc9be[_0x5e9a12];return _0x17fc63;};'use strict';var client=require(_0xec9b('0x0'));exports[_0xec9b('0x1')]={};exports[_0xec9b('0x2')]=function(_0x37959d){return client[_0xec9b('0x3')](_0xec9b('0x4'),{'body':{'result':_0x37959d[_0xec9b('0x5')],'transfererchannel':_0x37959d[_0xec9b('0x6')],'transferercalleridnum':_0x37959d[_0xec9b('0x7')],'transferercalleridname':_0x37959d[_0xec9b('0x8')],'transfererconnectedlinenum':_0x37959d[_0xec9b('0x9')],'transfererconnectedlinename':_0x37959d[_0xec9b('0xa')],'transfereraccountcode':_0x37959d[_0xec9b('0xb')],'transferercontext':_0x37959d[_0xec9b('0xc')],'transfererexten':_0x37959d['transfererexten'],'transfererlinkedid':_0x37959d[_0xec9b('0xd')],'transfereechannel':_0x37959d[_0xec9b('0xe')],'transfereecalleridnum':_0x37959d['transfereecalleridnum'],'transfereecalleridname':_0x37959d[_0xec9b('0xf')],'transfereeconnectedlinenum':_0x37959d[_0xec9b('0x10')],'transfereeconnectedlinename':_0x37959d[_0xec9b('0x11')],'transfereeaccountcode':_0x37959d[_0xec9b('0x12')],'transfereecontext':_0x37959d[_0xec9b('0x13')],'transfereeexten':_0x37959d[_0xec9b('0x14')],'transfereelinkedid':_0x37959d[_0xec9b('0x15')],'isexternal':_0x37959d[_0xec9b('0x16')],'context':_0x37959d[_0xec9b('0x17')],'extension':_0x37959d['extension'],'type':_0xec9b('0x18')},'log':_0xec9b('0x4')});};exports[_0xec9b('0x19')]=function(_0x41f308){return client[_0xec9b('0x3')](_0xec9b('0x4'),{'body':{'result':_0x41f308[_0xec9b('0x5')],'transfererchannel':_0x41f308[_0xec9b('0x1a')],'transferercalleridnum':_0x41f308['origtransferercalleridnum'],'transferercalleridname':_0x41f308['origtransferercalleridname'],'transfererconnectedlinenum':_0x41f308[_0xec9b('0x1b')],'transfererconnectedlinename':_0x41f308[_0xec9b('0x1c')],'transfereraccountcode':_0x41f308[_0xec9b('0x1d')],'transferercontext':_0x41f308[_0xec9b('0x1e')],'transfererexten':_0x41f308[_0xec9b('0x1f')],'transfererlinkedid':_0x41f308[_0xec9b('0x20')],'transfereechannel':_0x41f308[_0xec9b('0x21')],'transfereecalleridnum':_0x41f308[_0xec9b('0x22')],'transfereecalleridname':_0x41f308[_0xec9b('0x23')],'transfereeconnectedlinenum':_0x41f308['transfertargetconnectedlinenum'],'transfereeconnectedlinename':_0x41f308[_0xec9b('0x24')],'transfereeaccountcode':_0x41f308[_0xec9b('0x25')],'transfereecontext':_0x41f308['transfertargetcontext'],'transfereeexten':_0x41f308[_0xec9b('0x26')],'transfereelinkedid':_0x41f308[_0xec9b('0x27')],'isexternal':_0x41f308[_0xec9b('0x16')],'context':_0x41f308[_0xec9b('0x28')],'extension':_0x41f308['origtransfererexten'],'type':_0xec9b('0x29')},'log':_0xec9b('0x4')});}; \ No newline at end of file diff --git a/server/services/ami/server/index.js b/server/services/ami/server/index.js index d3044f3..bd48974 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 _0x5162=['pick','keys','reload','module','action','Action','then','catch','message','Command','content','voiceQueues','hasOwnProperty','push','find','omit','undefined','values','channels','length','voicechannel','map','uniqueid','channel','%s.%s','filename','MixMonitor','ai(mixmonitorid)','monitors','/var/spool/asterisk/monitor/','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','mixmonitorid','status','rec','MixMonitor\x20Success','Channel\x20doesn\x27t\x20exist','validate','resolve','StopMixMonitor','destinationchannel','stop','wav','StopMixMonitor\x20Success','type','inbound','outbound','Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound','filter','count','rows','voicequeuechannel','queueChannels','Hangup','voicequeuechannelredirect','Redirect','exten','context','telephones','trunks','outboundChannels','campaigns','run','Event\x20name\x20mandatory','emit','event','faxAccounts','send','http','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','../../../config/environment','../properties','../ami','../model/voiceQueueSummary','listen','format','%s/%s','SIP','timers','agents','updateStatusRealtime','pause','QueuePause','isConnected','error','asterisk','username','ami\x20disconnected','join'];(function(_0x3947c9,_0x4d6c97){var _0x2e7871=function(_0x1236cc){while(--_0x1236cc){_0x3947c9['push'](_0x3947c9['shift']());}};_0x2e7871(++_0x4d6c97);}(_0x5162,0x103));var _0x2516=function(_0x232cf2,_0x4ffb79){_0x232cf2=_0x232cf2-0x0;var _0x463cec=_0x5162[_0x232cf2];return _0x463cec;};'use strict';var _=require(_0x2516('0x0'));var util=require('util');var jayson=require('jayson/promise');var schema=require('validate');var moment=require('moment');var config=require(_0x2516('0x1'));var properties=require(_0x2516('0x2'));var ami=require(_0x2516('0x3'));var VoiceQueueSummary=require(_0x2516('0x4'));exports[_0x2516('0x5')]=function(_0x25dce6,_0x3a7984,_0x5b71b5){return new Promise(function(_0x48f411,_0x5beeb3){var _0x20a4a4={'QueuePause':function(_0xba4b36){return new Promise(function(_0xa1557){var _0x3a8834=util[_0x2516('0x6')](_0x2516('0x7'),_0x2516('0x8'),_0xba4b36['name']);if(_0x25dce6[_0x2516('0x9')]&&_0x25dce6[_0x2516('0x9')][_0x3a8834]&&_0x25dce6[_0x2516('0x9')][_0x3a8834]['timer']){_0x25dce6['timers'][_0x3a8834]['updateAcw']();}if(_0x25dce6['agents'][_0x3a8834]){_0x25dce6[_0x2516('0xa')][_0x3a8834][_0x2516('0xb')]({'statePause':_0xba4b36[_0x2516('0xc')]?!![]:![]});}_0xa1557({'code':0xc8,'message':_0x2516('0xd')});});},'Reload':function(_0x56c69c){var _0x33496b=this;return new Promise(function(_0x458aca,_0x171da2){if(ami[_0x2516('0xe')]()==![]){return _0x171da2(_0x33496b[_0x2516('0xf')](0x1f4,[config[_0x2516('0x10')]['ip'],config[_0x2516('0x10')][_0x2516('0x11')],_0x2516('0x12')][_0x2516('0x13')]('\x20')));}_0x56c69c=_[_0x2516('0x14')](_0x56c69c,_[_0x2516('0x15')](properties[_0x2516('0x16')][_0x2516('0x17')]));_0x56c69c[_0x2516('0x18')]='Reload';return ami[_0x2516('0x19')](_0x56c69c)[_0x2516('0x1a')](function(_0x1a1005){_0x458aca({'code':0xc8,'message':_0x1a1005['message']});})[_0x2516('0x1b')](function(_0x5e96c7){_0x171da2(_0x33496b['error'](0x1f5,_0x5e96c7[_0x2516('0x1c')]));});});},'Command':function(_0x3583cf){var _0x151168=this;return new Promise(function(_0x618aed,_0x198b93){if(ami[_0x2516('0xe')]()==![]){return _0x198b93(_0x151168[_0x2516('0xf')](0x1f4,[config[_0x2516('0x10')]['ip'],config[_0x2516('0x10')][_0x2516('0x11')],_0x2516('0x12')][_0x2516('0x13')]('\x20')));}_0x3583cf=_[_0x2516('0x14')](_0x3583cf,'command');_0x3583cf['action']=_0x2516('0x1d');return ami[_0x2516('0x19')](_0x3583cf)[_0x2516('0x1a')](function(_0x2d5b1b){_0x618aed({'code':0xc8,'message':_0x2d5b1b[_0x2516('0x1e')]});})[_0x2516('0x1b')](function(_0x3d906d){_0x198b93(_0x151168[_0x2516('0xf')](0x1f5,_0x3d906d['message']));});});},'VoiceQueues':function(){return new Promise(function(_0xa4538d){var _0x39c63f=[];for(var _0x774b60 in _0x25dce6[_0x2516('0x1f')]){if(_0x25dce6['voiceQueues'][_0x2516('0x20')](_0x774b60)){var _0x30eeb9=_0x25dce6[_0x2516('0x1f')][_0x774b60];var _0x3d728a=new VoiceQueueSummary(_0x30eeb9);_0x39c63f[_0x2516('0x21')](_0x3d728a);}}_0xa4538d({'count':_0x39c63f['length'],'rows':_0x39c63f});});},'UpdateVoiceQueue':function(_0x3c5c3c){return new Promise(function(_0x1750e7,_0x935035){var _0x2cb847=_[_0x2516('0x22')](_0x25dce6[_0x2516('0x1f')],{'id':parseInt(_0x3c5c3c['id'])});var _0x556f01=_[_0x2516('0x23')](_0x3c5c3c,['id']);if(_0x2cb847){for(var _0x20dc9f in _0x556f01){if(typeof _0x556f01[_0x20dc9f]!=='undefined'&&typeof _0x2cb847[_0x20dc9f]!==_0x2516('0x24')){_0x2cb847[_0x20dc9f]=_0x556f01[_0x20dc9f];}}_0x1750e7(_0x2cb847);}else{_0x935035();}});},'VoiceChannels':function(){return new Promise(function(_0x1de031){var _0x4527f1=_[_0x2516('0x25')](_0x25dce6[_0x2516('0x26')]);_0x1de031({'count':_0x4527f1[_0x2516('0x27')],'rows':_0x4527f1});});},'VoiceChannelMixMonitor':function(_0x2e92f2){var _0x3c1daf=this;return new Promise(function(_0x10f9ec,_0x12d790){if(ami[_0x2516('0xe')]()==![]){return _0x12d790(_0x3c1daf[_0x2516('0xf')](0x1f4,[config[_0x2516('0x10')]['ip'],config[_0x2516('0x10')][_0x2516('0x11')],'ami\x20disconnected'][_0x2516('0x13')]('\x20')));}var _0x54147b=schema(properties[_0x2516('0x28')])['validate'](_0x2e92f2);if(_0x54147b[_0x2516('0x27')]>0x0){return _0x12d790(_0x3c1daf['error'](0x1f4,_[_0x2516('0x29')](_0x54147b,_0x2516('0x1c'))[_0x2516('0x13')](',\x20')));}var _0x261cff=_[_0x2516('0x22')](_0x25dce6[_0x2516('0x26')],{'uniqueid':_0x2e92f2[_0x2516('0x2a')]});if(_0x261cff&&_0x261cff[_0x2516('0x2b')]){var _0x1ad634=util['format'](_0x2516('0x2c'),_0x2e92f2[_0x2516('0x2d')]||_0x2e92f2[_0x2516('0x2a')],_0x2e92f2[_0x2516('0x6')]||'wav');return ami['Action']({'action':_0x2516('0x2e'),'channel':_0x261cff[_0x2516('0x2b')],'file':_0x1ad634,'options':_0x2516('0x2f')})[_0x2516('0x1a')](function(_0x45c12e){var _0x164f07=_[_0x2516('0x22')](_0x261cff[_0x2516('0x30')],{'filename':_0x2516('0x31')+_0x1ad634[_0x2516('0x32')]()});if(_['isNil'](_0x164f07)){_0x261cff['monitors'][_0x2516('0x21')]({'filename':_0x2516('0x31')+_0x1ad634['toLowerCase'](),'createdAt':moment()['format'](_0x2516('0x33')),'mixmonitorid':_0x45c12e[_0x2516('0x34')],'status':'rec'});}else{_0x164f07[_0x2516('0x34')]=_0x45c12e['mixmonitorid'];_0x164f07[_0x2516('0x35')]=_0x2516('0x36');}_0x10f9ec({'code':0xc8,'message':[_0x2e92f2['uniqueid'],_0x2516('0x37'),_0x45c12e[_0x2516('0x34')]][_0x2516('0x13')]('\x20'),'mixmonitorid':_0x45c12e[_0x2516('0x34')]});})[_0x2516('0x1b')](function(_0x25c33a){_0x12d790(_0x3c1daf[_0x2516('0xf')](0x1f5,[_0x2e92f2[_0x2516('0x2a')],_0x25c33a[_0x2516('0x1c')][_0x2516('0x32')]()][_0x2516('0x13')]('\x20')));});}else{return _0x12d790(_0x3c1daf[_0x2516('0xf')](0x1f5,_0x2516('0x38')));}});},'VoiceChannelStopMixMonitor':function(_0x4c832b){var _0x1b72cd=this;return new Promise(function(_0x1bc0e,_0x5debf2){if(ami[_0x2516('0xe')]()==![]){return _0x5debf2(_0x1b72cd[_0x2516('0xf')](0x1f4,[config[_0x2516('0x10')]['ip'],config[_0x2516('0x10')][_0x2516('0x11')],'ami\x20disconnected'][_0x2516('0x13')]('\x20')));}var _0xe5bc76=schema(properties[_0x2516('0x28')])[_0x2516('0x39')](_0x4c832b);if(_0xe5bc76[_0x2516('0x27')]>0x0){return _0x5debf2(_0x1b72cd[_0x2516('0xf')](0x1f4,_['map'](_0xe5bc76,_0x2516('0x1c'))[_0x2516('0x13')](',\x20')));}var _0xe64acc=_[_0x2516('0x22')](_0x25dce6[_0x2516('0x26')],{'uniqueid':_0x4c832b[_0x2516('0x2a')]});if(_0xe64acc){return Promise[_0x2516('0x3a')]()['then'](function(){if(_0xe64acc[_0x2516('0x2b')]){return ami['Action']({'action':_0x2516('0x3b'),'channel':_0xe64acc['channel'],'mixmonitorid':_0x4c832b[_0x2516('0x34')]})[_0x2516('0x1b')](function(){});}})[_0x2516('0x1a')](function(){if(_0xe64acc['destinationchannel']){return ami['Action']({'action':_0x2516('0x3b'),'channel':_0xe64acc[_0x2516('0x3c')],'mixmonitorid':_0x4c832b['mixmonitorid']})['catch'](function(){});}})[_0x2516('0x1a')](function(){var _0x147e05=_[_0x2516('0x22')](_0xe64acc['monitors'],{'mixmonitorid':_0x4c832b[_0x2516('0x34')]});if(_0x147e05){_0x147e05['status']=_0x2516('0x3d');}})[_0x2516('0x1a')](function(){var _0x318128=util[_0x2516('0x6')]('%s.%s',_0x4c832b[_0x2516('0x2d')]||_0x4c832b[_0x2516('0x2a')],_0x4c832b[_0x2516('0x6')]||_0x2516('0x3e'));var _0x43874c=_['find'](_0xe64acc[_0x2516('0x30')],{'filename':_0x2516('0x31')+_0x318128[_0x2516('0x32')]()});if(_0x43874c){_0x43874c[_0x2516('0x35')]='stop';}})[_0x2516('0x1a')](function(){_0x1bc0e({'code':0xc8,'message':[_0x4c832b[_0x2516('0x2a')],_0x2516('0x3f')][_0x2516('0x13')]('\x20')});})[_0x2516('0x1b')](function(_0x4f805d){_0x5debf2(_0x1b72cd[_0x2516('0xf')](0x1f5,[_0x4c832b[_0x2516('0x2a')],_0x4f805d[_0x2516('0x1c')][_0x2516('0x32')]()][_0x2516('0x13')]('\x20')));});}else{return _0x5debf2(_0x1b72cd[_0x2516('0xf')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x4f3eba){var _0x54e8df=this;return new Promise(function(_0x323590){var _0x4f7eb4=_['values'](_0x25dce6['queueChannels']);var _0x5e7cb={'count':_0x4f7eb4[_0x2516('0x27')],'rows':_0x4f7eb4};if(_0x4f3eba&&_0x4f3eba[_0x2516('0x40')]){if(![_0x2516('0x41'),_0x2516('0x42')]['includes'](_0x4f3eba[_0x2516('0x40')])){return _0x5beeb3(_0x54e8df[_0x2516('0xf')](0x190,_0x2516('0x43')));}var _0x4f75cd=_[_0x2516('0x44')](_0x4f7eb4,function(_0x350206){return _0x350206['type']===_0x4f3eba[_0x2516('0x40')];});_0x5e7cb[_0x2516('0x45')]=_0x4f75cd[_0x2516('0x27')];_0x5e7cb[_0x2516('0x46')]=_0x4f75cd;}_0x323590(_0x5e7cb);});},'VoiceQueuesChannel':function(_0x185298){var _0x5d92cb=this;return new Promise(function(_0x47edff,_0x2a877a){var _0x526b15=schema(properties[_0x2516('0x47')])['validate'](_0x185298);if(_0x526b15[_0x2516('0x27')]>0x0){return _0x2a877a(_0x5d92cb[_0x2516('0xf')](0x1f4,_[_0x2516('0x29')](_0x526b15,_0x2516('0x1c'))[_0x2516('0x13')](',\x20')));}var _0x4751fd=_[_0x2516('0x22')](_0x25dce6[_0x2516('0x48')],{'uniqueid':_0x185298[_0x2516('0x2a')]});if(_0x4751fd){_0x47edff(_0x4751fd);}else{return _0x2a877a(_0x5d92cb[_0x2516('0xf')](0x1f5,_0x2516('0x38')));}});},'VoiceQueuesChannelHangup':function(_0x4f095a){var _0x1b2493=this;return new Promise(function(_0x6c7d5f,_0x3adc8c){if(ami['isConnected']()==![]){return _0x3adc8c(_0x1b2493[_0x2516('0xf')](0x1f4,[config['asterisk']['ip'],config[_0x2516('0x10')][_0x2516('0x11')],_0x2516('0x12')]['join']('\x20')));}var _0x566224=schema(properties['voicequeuechannelhangup'])[_0x2516('0x39')](_0x4f095a);if(_0x566224[_0x2516('0x27')]>0x0){return _0x3adc8c(_0x1b2493[_0x2516('0xf')](0x1f4,_[_0x2516('0x29')](_0x566224,'message')[_0x2516('0x13')](',\x20')));}var _0x20a267=_[_0x2516('0x22')](_0x25dce6['queueChannels'],{'uniqueid':_0x4f095a[_0x2516('0x2a')]});if(_0x20a267&&_0x20a267[_0x2516('0x2b')]){return ami[_0x2516('0x19')]({'action':_0x2516('0x49'),'channel':_0x20a267[_0x2516('0x2b')]})[_0x2516('0x1a')](function(_0x26b897){_0x6c7d5f({'code':0xc8,'message':[_0x4f095a[_0x2516('0x2a')],_0x26b897[_0x2516('0x1c')][_0x2516('0x32')]()][_0x2516('0x13')]('\x20')});})[_0x2516('0x1b')](function(_0xa10d29){_0x3adc8c(_0x1b2493['error'](0x1f5,[_0x4f095a[_0x2516('0x2a')],_0xa10d29[_0x2516('0x1c')][_0x2516('0x32')]()][_0x2516('0x13')]('\x20')));});}else{return _0x3adc8c(_0x1b2493[_0x2516('0xf')](0x1f5,_0x2516('0x38')));}});},'VoiceQueuesChannelRedirect':function(_0x314c28){var _0x496001=this;return new Promise(function(_0x3ce0d6,_0xab7abf){if(ami[_0x2516('0xe')]()==![]){return _0xab7abf(_0x496001[_0x2516('0xf')](0x1f4,[config[_0x2516('0x10')]['ip'],config[_0x2516('0x10')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x331d78=schema(properties[_0x2516('0x4a')])[_0x2516('0x39')](_0x314c28);if(_0x331d78[_0x2516('0x27')]>0x0){return _0xab7abf(_0x496001['error'](0x1f4,_['map'](_0x331d78,_0x2516('0x1c'))['join'](',\x20')));}var _0x1c0540=_[_0x2516('0x22')](_0x25dce6['queueChannels'],{'uniqueid':_0x314c28[_0x2516('0x2a')]});if(_0x1c0540&&_0x1c0540[_0x2516('0x2b')]){return ami[_0x2516('0x19')]({'action':_0x2516('0x4b'),'channel':_0x1c0540[_0x2516('0x2b')],'exten':_0x314c28[_0x2516('0x4c')],'context':_0x314c28[_0x2516('0x4d')]||_0x1c0540[_0x2516('0x4d')],'priority':0x1})[_0x2516('0x1a')](function(_0x4c86a3){_0x3ce0d6({'code':0xc8,'message':[_0x314c28['uniqueid'],_0x4c86a3[_0x2516('0x1c')][_0x2516('0x32')]()][_0x2516('0x13')]('\x20')});})['catch'](function(_0x23610d){_0xab7abf(_0x496001['error'](0x1f5,[_0x314c28[_0x2516('0x2a')],_0x23610d[_0x2516('0x1c')][_0x2516('0x32')]()][_0x2516('0x13')]('\x20')));});}else{return _0xab7abf(_0x496001[_0x2516('0xf')](0x1f5,_0x2516('0x38')));}});},'Agents':function(_0x3d0d99){return new Promise(function(_0x3379f8){var _0x6029a3=_[_0x2516('0x25')](_0x25dce6['agents']);if(_0x3d0d99&&_0x3d0d99['id']){var _0x4eac04=_[_0x2516('0x22')](_0x6029a3,function(_0x598f4a){return _0x598f4a['id']===_0x3d0d99['id'];});_0x3379f8(_0x4eac04);}else{_0x3379f8({'count':_0x6029a3['length'],'rows':_0x6029a3});}});},'Telephones':function(){return new Promise(function(_0x12e768){var _0x3960b3=_[_0x2516('0x25')](_0x25dce6[_0x2516('0x4e')]);_0x12e768({'count':_0x3960b3[_0x2516('0x27')],'rows':_0x3960b3});});},'Trunks':function(){return new Promise(function(_0x371c06){var _0x1808fa=_[_0x2516('0x25')](_0x25dce6[_0x2516('0x4f')]);_0x371c06({'count':_0x1808fa['length'],'rows':_0x1808fa});});},'OutboundChannels':function(){return new Promise(function(_0xe966c8){var _0x2e1029=_[_0x2516('0x25')](_0x25dce6[_0x2516('0x50')]);_0xe966c8({'count':_0x2e1029['length'],'rows':_0x2e1029});});},'Outbound':function(){return new Promise(function(_0x9df753){_0x9df753(_0x25dce6[_0x2516('0x42')]);});},'Campaigns':function(){return new Promise(function(_0x737c82){var _0x2cb00e=_[_0x2516('0x25')](_0x25dce6[_0x2516('0x51')]);_0x737c82({'count':_0x2cb00e['length'],'rows':_0x2cb00e});});},'VoiceQueuesPreview':function(_0x373bbc){var _0x4f5123=this;return new Promise(function(_0x509c68,_0x377083){_0x3a7984[_0x2516('0x52')](_0x373bbc['id'])[_0x2516('0x1a')](function(_0x49a992){_0x509c68({'code':0xc8,'message':_0x49a992[_0x2516('0x1c')]});})[_0x2516('0x1b')](function(_0x121818){_0x377083(_0x4f5123[_0x2516('0xf')](0x1f4,_0x121818['message']));});});},'EventManager':function(_0xbb8074){var _0x186083=this;return new Promise(function(_0x371cdc,_0x1d1983){if(!_0xbb8074['event']){return _0x1d1983(_0x186083[_0x2516('0xf')](0x1f4,_0x2516('0x53')));}ami[_0x2516('0x54')]('custom:'+_0xbb8074[_0x2516('0x55')],_0xbb8074['message']);_0x371cdc({'code':0xc8,'message':_0xbb8074});});},'FaxAccounts':function(){return new Promise(function(_0x293e40){var _0x437a04=_[_0x2516('0x25')](_0x25dce6[_0x2516('0x56')]);_0x293e40({'count':_0x437a04[_0x2516('0x27')],'rows':_0x437a04});});},'SendFax':function(_0x502cbf){var _0x5f0806=this;return new Promise(function(_0x4d671b,_0x3d8389){_0x5b71b5[_0x2516('0x57')](_0x502cbf)['then'](function(_0x2a54ee){_0x4d671b({'code':0xc8,'message':_0x2a54ee[_0x2516('0x1c')]});})[_0x2516('0x1b')](function(_0x44a023){_0x3d8389(_0x5f0806[_0x2516('0xf')](0x1f4,_0x44a023[_0x2516('0x1c')]));});});},'CheckAfterSend':function(_0x493c5c){var _0x84db05=this;return new Promise(function(_0x13d4fb,_0x20270a){_0x5b71b5['checkAfterSend'](_0x493c5c)['then'](function(_0x52e6be){_0x13d4fb({'code':0xc8,'message':_0x52e6be[_0x2516('0x1c')]});})[_0x2516('0x1b')](function(_0x14d4db){_0x20270a(_0x84db05[_0x2516('0xf')](0x1f4,_0x14d4db['message']));});});}};var _0x4a2158=jayson['server'](_0x20a4a4)[_0x2516('0x58')]();_0x4a2158['on'](_0x2516('0xf'),function(_0x379aa8){return _0x5beeb3(_0x379aa8);});_0x4a2158[_0x2516('0x5')](0x232a,_0x2516('0x59'),function(){console[_0x2516('0x5a')](_0x2516('0x5b'),0x232a);return _0x48f411(_0x2516('0x5c')+0x232a);});});}; \ No newline at end of file +var _0x950a=['../ami','../model/voiceQueueSummary','format','%s/%s','SIP','name','timer','updateAcw','agents','pause','isConnected','error','asterisk','username','ami\x20disconnected','join','keys','reload','module','Reload','Action','then','message','catch','pick','action','Command','content','voiceQueues','hasOwnProperty','push','length','find','omit','undefined','values','channels','voicechannel','map','uniqueid','channel','wav','MixMonitor','ai(mixmonitorid)','monitors','toLowerCase','YYYY-MM-DD\x20HH:mm:ss','rec','mixmonitorid','status','MixMonitor\x20Success','StopMixMonitor','destinationchannel','stop','%s.%s','filename','/var/spool/asterisk/monitor/','StopMixMonitor\x20Success','queueChannels','inbound','outbound','includes','type','count','rows','voicequeuechannel','voicequeuechannelhangup','Hangup','Channel\x20doesn\x27t\x20exist','voicequeuechannelredirect','exten','context','telephones','trunks','outboundChannels','run','event','Event\x20name\x20mandatory','custom:','faxAccounts','send','checkAfterSend','listen','127.0.0.1','log','AMI\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','jayson/promise','validate','../../../config/environment','../properties'];(function(_0x42bfc9,_0x92ccf5){var _0x645e2b=function(_0x5d7d7d){while(--_0x5d7d7d){_0x42bfc9['push'](_0x42bfc9['shift']());}};_0x645e2b(++_0x92ccf5);}(_0x950a,0x111));var _0xa950=function(_0x3e32a8,_0x255953){_0x3e32a8=_0x3e32a8-0x0;var _0x2997b0=_0x950a[_0x3e32a8];return _0x2997b0;};'use strict';var _=require(_0xa950('0x0'));var util=require(_0xa950('0x1'));var jayson=require(_0xa950('0x2'));var schema=require(_0xa950('0x3'));var moment=require('moment');var config=require(_0xa950('0x4'));var properties=require(_0xa950('0x5'));var ami=require(_0xa950('0x6'));var VoiceQueueSummary=require(_0xa950('0x7'));exports['listen']=function(_0x1cd8ec,_0x46f86d,_0x512c0e){return new Promise(function(_0x14b4ac,_0x3645b6){var _0x5ba2da={'QueuePause':function(_0x5675f8){return new Promise(function(_0x26e05c){var _0x12ef5a=util[_0xa950('0x8')](_0xa950('0x9'),_0xa950('0xa'),_0x5675f8[_0xa950('0xb')]);if(_0x1cd8ec['timers']&&_0x1cd8ec['timers'][_0x12ef5a]&&_0x1cd8ec['timers'][_0x12ef5a][_0xa950('0xc')]){_0x1cd8ec['timers'][_0x12ef5a][_0xa950('0xd')]();}if(_0x1cd8ec[_0xa950('0xe')][_0x12ef5a]){_0x1cd8ec[_0xa950('0xe')][_0x12ef5a]['updateStatusRealtime']({'statePause':_0x5675f8[_0xa950('0xf')]?!![]:![]});}_0x26e05c({'code':0xc8,'message':'QueuePause'});});},'Reload':function(_0x10e64a){var _0x439097=this;return new Promise(function(_0x3cdf5d,_0x4c217c){if(ami[_0xa950('0x10')]()==![]){return _0x4c217c(_0x439097[_0xa950('0x11')](0x1f4,[config[_0xa950('0x12')]['ip'],config['asterisk'][_0xa950('0x13')],_0xa950('0x14')][_0xa950('0x15')]('\x20')));}_0x10e64a=_['pick'](_0x10e64a,_[_0xa950('0x16')](properties[_0xa950('0x17')][_0xa950('0x18')]));_0x10e64a['action']=_0xa950('0x19');return ami[_0xa950('0x1a')](_0x10e64a)[_0xa950('0x1b')](function(_0x1021da){_0x3cdf5d({'code':0xc8,'message':_0x1021da[_0xa950('0x1c')]});})[_0xa950('0x1d')](function(_0x2b0e44){_0x4c217c(_0x439097[_0xa950('0x11')](0x1f5,_0x2b0e44[_0xa950('0x1c')]));});});},'Command':function(_0x18266c){var _0x28fedf=this;return new Promise(function(_0x38fa5d,_0xc690ae){if(ami['isConnected']()==![]){return _0xc690ae(_0x28fedf[_0xa950('0x11')](0x1f4,[config[_0xa950('0x12')]['ip'],config['asterisk'][_0xa950('0x13')],_0xa950('0x14')]['join']('\x20')));}_0x18266c=_[_0xa950('0x1e')](_0x18266c,'command');_0x18266c[_0xa950('0x1f')]=_0xa950('0x20');return ami[_0xa950('0x1a')](_0x18266c)[_0xa950('0x1b')](function(_0x5617cd){_0x38fa5d({'code':0xc8,'message':_0x5617cd[_0xa950('0x21')]});})[_0xa950('0x1d')](function(_0x31c135){_0xc690ae(_0x28fedf[_0xa950('0x11')](0x1f5,_0x31c135[_0xa950('0x1c')]));});});},'VoiceQueues':function(){return new Promise(function(_0x22e2c1){var _0x300448=[];for(var _0x23cb20 in _0x1cd8ec[_0xa950('0x22')]){if(_0x1cd8ec[_0xa950('0x22')][_0xa950('0x23')](_0x23cb20)){var _0x26f366=_0x1cd8ec[_0xa950('0x22')][_0x23cb20];var _0x5d82d8=new VoiceQueueSummary(_0x26f366);_0x300448[_0xa950('0x24')](_0x5d82d8);}}_0x22e2c1({'count':_0x300448[_0xa950('0x25')],'rows':_0x300448});});},'UpdateVoiceQueue':function(_0x3f37f8){return new Promise(function(_0x1aa96a,_0x31c168){var _0x186f35=_[_0xa950('0x26')](_0x1cd8ec['voiceQueues'],{'id':parseInt(_0x3f37f8['id'])});var _0x19ad7a=_[_0xa950('0x27')](_0x3f37f8,['id']);if(_0x186f35){for(var _0x5e4c94 in _0x19ad7a){if(typeof _0x19ad7a[_0x5e4c94]!==_0xa950('0x28')&&typeof _0x186f35[_0x5e4c94]!==_0xa950('0x28')){_0x186f35[_0x5e4c94]=_0x19ad7a[_0x5e4c94];}}_0x1aa96a(_0x186f35);}else{_0x31c168();}});},'VoiceChannels':function(){return new Promise(function(_0x3e5915){var _0x1875eb=_[_0xa950('0x29')](_0x1cd8ec[_0xa950('0x2a')]);_0x3e5915({'count':_0x1875eb[_0xa950('0x25')],'rows':_0x1875eb});});},'VoiceChannelMixMonitor':function(_0x2d0c59){var _0x203703=this;return new Promise(function(_0x3c6ea8,_0x4de9f0){if(ami[_0xa950('0x10')]()==![]){return _0x4de9f0(_0x203703['error'](0x1f4,[config['asterisk']['ip'],config[_0xa950('0x12')]['username'],_0xa950('0x14')][_0xa950('0x15')]('\x20')));}var _0x3ba469=schema(properties[_0xa950('0x2b')])['validate'](_0x2d0c59);if(_0x3ba469[_0xa950('0x25')]>0x0){return _0x4de9f0(_0x203703['error'](0x1f4,_[_0xa950('0x2c')](_0x3ba469,_0xa950('0x1c'))['join'](',\x20')));}var _0x4c3e3c=_[_0xa950('0x26')](_0x1cd8ec[_0xa950('0x2a')],{'uniqueid':_0x2d0c59[_0xa950('0x2d')]});if(_0x4c3e3c&&_0x4c3e3c[_0xa950('0x2e')]){var _0x3410cf=util[_0xa950('0x8')]('%s.%s',_0x2d0c59['filename']||_0x2d0c59[_0xa950('0x2d')],_0x2d0c59['format']||_0xa950('0x2f'));return ami[_0xa950('0x1a')]({'action':_0xa950('0x30'),'channel':_0x4c3e3c[_0xa950('0x2e')],'file':_0x3410cf,'options':_0xa950('0x31')})[_0xa950('0x1b')](function(_0xd7f55d){var _0x3cc798=_[_0xa950('0x26')](_0x4c3e3c[_0xa950('0x32')],{'filename':'/var/spool/asterisk/monitor/'+_0x3410cf[_0xa950('0x33')]()});if(_['isNil'](_0x3cc798)){_0x4c3e3c[_0xa950('0x32')][_0xa950('0x24')]({'filename':'/var/spool/asterisk/monitor/'+_0x3410cf['toLowerCase'](),'createdAt':moment()[_0xa950('0x8')](_0xa950('0x34')),'mixmonitorid':_0xd7f55d['mixmonitorid'],'status':_0xa950('0x35')});}else{_0x3cc798[_0xa950('0x36')]=_0xd7f55d['mixmonitorid'];_0x3cc798[_0xa950('0x37')]=_0xa950('0x35');}_0x3c6ea8({'code':0xc8,'message':[_0x2d0c59[_0xa950('0x2d')],_0xa950('0x38'),_0xd7f55d[_0xa950('0x36')]][_0xa950('0x15')]('\x20'),'mixmonitorid':_0xd7f55d[_0xa950('0x36')]});})[_0xa950('0x1d')](function(_0x5c385e){_0x4de9f0(_0x203703[_0xa950('0x11')](0x1f5,[_0x2d0c59[_0xa950('0x2d')],_0x5c385e['message'][_0xa950('0x33')]()][_0xa950('0x15')]('\x20')));});}else{return _0x4de9f0(_0x203703[_0xa950('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceChannelStopMixMonitor':function(_0x25c9f3){var _0x2de8a1=this;return new Promise(function(_0x8bdd37,_0x59fd48){if(ami['isConnected']()==![]){return _0x59fd48(_0x2de8a1[_0xa950('0x11')](0x1f4,[config[_0xa950('0x12')]['ip'],config[_0xa950('0x12')]['username'],'ami\x20disconnected']['join']('\x20')));}var _0x41619f=schema(properties[_0xa950('0x2b')])[_0xa950('0x3')](_0x25c9f3);if(_0x41619f[_0xa950('0x25')]>0x0){return _0x59fd48(_0x2de8a1[_0xa950('0x11')](0x1f4,_['map'](_0x41619f,_0xa950('0x1c'))[_0xa950('0x15')](',\x20')));}var _0x531e6a=_['find'](_0x1cd8ec[_0xa950('0x2a')],{'uniqueid':_0x25c9f3[_0xa950('0x2d')]});if(_0x531e6a){return Promise['resolve']()['then'](function(){if(_0x531e6a['channel']){return ami['Action']({'action':_0xa950('0x39'),'channel':_0x531e6a[_0xa950('0x2e')],'mixmonitorid':_0x25c9f3['mixmonitorid']})['catch'](function(){});}})[_0xa950('0x1b')](function(){if(_0x531e6a['destinationchannel']){return ami[_0xa950('0x1a')]({'action':_0xa950('0x39'),'channel':_0x531e6a[_0xa950('0x3a')],'mixmonitorid':_0x25c9f3[_0xa950('0x36')]})[_0xa950('0x1d')](function(){});}})[_0xa950('0x1b')](function(){var _0x41b44d=_[_0xa950('0x26')](_0x531e6a['monitors'],{'mixmonitorid':_0x25c9f3[_0xa950('0x36')]});if(_0x41b44d){_0x41b44d['status']=_0xa950('0x3b');}})[_0xa950('0x1b')](function(){var _0x22675d=util[_0xa950('0x8')](_0xa950('0x3c'),_0x25c9f3[_0xa950('0x3d')]||_0x25c9f3[_0xa950('0x2d')],_0x25c9f3[_0xa950('0x8')]||_0xa950('0x2f'));var _0x4f777a=_[_0xa950('0x26')](_0x531e6a[_0xa950('0x32')],{'filename':_0xa950('0x3e')+_0x22675d[_0xa950('0x33')]()});if(_0x4f777a){_0x4f777a[_0xa950('0x37')]='stop';}})[_0xa950('0x1b')](function(){_0x8bdd37({'code':0xc8,'message':[_0x25c9f3[_0xa950('0x2d')],_0xa950('0x3f')][_0xa950('0x15')]('\x20')});})[_0xa950('0x1d')](function(_0xdca6e2){_0x59fd48(_0x2de8a1[_0xa950('0x11')](0x1f5,[_0x25c9f3['uniqueid'],_0xdca6e2[_0xa950('0x1c')][_0xa950('0x33')]()][_0xa950('0x15')]('\x20')));});}else{return _0x59fd48(_0x2de8a1['error'](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannels':function(_0x262a64){var _0x26216c=this;return new Promise(function(_0x38c370){var _0x16572e=_[_0xa950('0x29')](_0x1cd8ec[_0xa950('0x40')]);var _0x1af0a3={'count':_0x16572e[_0xa950('0x25')],'rows':_0x16572e};if(_0x262a64&&_0x262a64['type']){if(![_0xa950('0x41'),_0xa950('0x42')][_0xa950('0x43')](_0x262a64[_0xa950('0x44')])){return _0x3645b6(_0x26216c[_0xa950('0x11')](0x190,'Invalid\x20type\x20parameter.\x20Allowed\x20values:\x20inbound,\x20outbound'));}var _0x200183=_['filter'](_0x16572e,function(_0x1fe2f3){return _0x1fe2f3[_0xa950('0x44')]===_0x262a64[_0xa950('0x44')];});_0x1af0a3[_0xa950('0x45')]=_0x200183[_0xa950('0x25')];_0x1af0a3[_0xa950('0x46')]=_0x200183;}_0x38c370(_0x1af0a3);});},'VoiceQueuesChannel':function(_0x4b64b8){var _0x5b5368=this;return new Promise(function(_0x4af042,_0x41e086){var _0x18dcd2=schema(properties[_0xa950('0x47')])[_0xa950('0x3')](_0x4b64b8);if(_0x18dcd2[_0xa950('0x25')]>0x0){return _0x41e086(_0x5b5368[_0xa950('0x11')](0x1f4,_[_0xa950('0x2c')](_0x18dcd2,_0xa950('0x1c'))['join'](',\x20')));}var _0x3631bd=_['find'](_0x1cd8ec[_0xa950('0x40')],{'uniqueid':_0x4b64b8['uniqueid']});if(_0x3631bd){_0x4af042(_0x3631bd);}else{return _0x41e086(_0x5b5368[_0xa950('0x11')](0x1f5,'Channel\x20doesn\x27t\x20exist'));}});},'VoiceQueuesChannelHangup':function(_0x292de6){var _0x53e809=this;return new Promise(function(_0x1b71a5,_0x3e536e){if(ami[_0xa950('0x10')]()==![]){return _0x3e536e(_0x53e809[_0xa950('0x11')](0x1f4,[config[_0xa950('0x12')]['ip'],config['asterisk'][_0xa950('0x13')],_0xa950('0x14')][_0xa950('0x15')]('\x20')));}var _0x42282f=schema(properties[_0xa950('0x48')])['validate'](_0x292de6);if(_0x42282f[_0xa950('0x25')]>0x0){return _0x3e536e(_0x53e809[_0xa950('0x11')](0x1f4,_[_0xa950('0x2c')](_0x42282f,_0xa950('0x1c'))[_0xa950('0x15')](',\x20')));}var _0x590af1=_[_0xa950('0x26')](_0x1cd8ec['queueChannels'],{'uniqueid':_0x292de6['uniqueid']});if(_0x590af1&&_0x590af1[_0xa950('0x2e')]){return ami[_0xa950('0x1a')]({'action':_0xa950('0x49'),'channel':_0x590af1[_0xa950('0x2e')]})['then'](function(_0x520fc7){_0x1b71a5({'code':0xc8,'message':[_0x292de6[_0xa950('0x2d')],_0x520fc7[_0xa950('0x1c')][_0xa950('0x33')]()]['join']('\x20')});})[_0xa950('0x1d')](function(_0x47697b){_0x3e536e(_0x53e809[_0xa950('0x11')](0x1f5,[_0x292de6[_0xa950('0x2d')],_0x47697b[_0xa950('0x1c')][_0xa950('0x33')]()][_0xa950('0x15')]('\x20')));});}else{return _0x3e536e(_0x53e809[_0xa950('0x11')](0x1f5,_0xa950('0x4a')));}});},'VoiceQueuesChannelRedirect':function(_0x484818){var _0xf7d2d7=this;return new Promise(function(_0x57a070,_0x1f00eb){if(ami[_0xa950('0x10')]()==![]){return _0x1f00eb(_0xf7d2d7[_0xa950('0x11')](0x1f4,[config[_0xa950('0x12')]['ip'],config[_0xa950('0x12')][_0xa950('0x13')],_0xa950('0x14')][_0xa950('0x15')]('\x20')));}var _0x47384c=schema(properties[_0xa950('0x4b')])[_0xa950('0x3')](_0x484818);if(_0x47384c[_0xa950('0x25')]>0x0){return _0x1f00eb(_0xf7d2d7[_0xa950('0x11')](0x1f4,_['map'](_0x47384c,'message')[_0xa950('0x15')](',\x20')));}var _0x3ac5d8=_[_0xa950('0x26')](_0x1cd8ec[_0xa950('0x40')],{'uniqueid':_0x484818[_0xa950('0x2d')]});if(_0x3ac5d8&&_0x3ac5d8[_0xa950('0x2e')]){return ami[_0xa950('0x1a')]({'action':'Redirect','channel':_0x3ac5d8[_0xa950('0x2e')],'exten':_0x484818[_0xa950('0x4c')],'context':_0x484818[_0xa950('0x4d')]||_0x3ac5d8[_0xa950('0x4d')],'priority':0x1})[_0xa950('0x1b')](function(_0x2cf13f){_0x57a070({'code':0xc8,'message':[_0x484818[_0xa950('0x2d')],_0x2cf13f[_0xa950('0x1c')]['toLowerCase']()][_0xa950('0x15')]('\x20')});})[_0xa950('0x1d')](function(_0x155def){_0x1f00eb(_0xf7d2d7[_0xa950('0x11')](0x1f5,[_0x484818[_0xa950('0x2d')],_0x155def['message'][_0xa950('0x33')]()][_0xa950('0x15')]('\x20')));});}else{return _0x1f00eb(_0xf7d2d7[_0xa950('0x11')](0x1f5,_0xa950('0x4a')));}});},'Agents':function(_0x123bf6){return new Promise(function(_0x579378){var _0x145a6a=_[_0xa950('0x29')](_0x1cd8ec[_0xa950('0xe')]);if(_0x123bf6&&_0x123bf6['id']){var _0x487a12=_[_0xa950('0x26')](_0x145a6a,function(_0x3683bc){return _0x3683bc['id']===_0x123bf6['id'];});_0x579378(_0x487a12);}else{_0x579378({'count':_0x145a6a[_0xa950('0x25')],'rows':_0x145a6a});}});},'Telephones':function(){return new Promise(function(_0x22a960){var _0x55209c=_[_0xa950('0x29')](_0x1cd8ec[_0xa950('0x4e')]);_0x22a960({'count':_0x55209c['length'],'rows':_0x55209c});});},'Trunks':function(){return new Promise(function(_0xda1471){var _0x268ba4=_[_0xa950('0x29')](_0x1cd8ec[_0xa950('0x4f')]);_0xda1471({'count':_0x268ba4[_0xa950('0x25')],'rows':_0x268ba4});});},'OutboundChannels':function(){return new Promise(function(_0x1215bb){var _0x17b60c=_[_0xa950('0x29')](_0x1cd8ec[_0xa950('0x50')]);_0x1215bb({'count':_0x17b60c[_0xa950('0x25')],'rows':_0x17b60c});});},'Outbound':function(){return new Promise(function(_0x20b6ff){_0x20b6ff(_0x1cd8ec[_0xa950('0x42')]);});},'Campaigns':function(){return new Promise(function(_0x6e8019){var _0x59ef65=_['values'](_0x1cd8ec['campaigns']);_0x6e8019({'count':_0x59ef65['length'],'rows':_0x59ef65});});},'VoiceQueuesPreview':function(_0xd6b04f){var _0x22066c=this;return new Promise(function(_0x470823,_0x55b7bb){_0x46f86d[_0xa950('0x51')](_0xd6b04f['id'])[_0xa950('0x1b')](function(_0x72cfd7){_0x470823({'code':0xc8,'message':_0x72cfd7[_0xa950('0x1c')]});})[_0xa950('0x1d')](function(_0x2b8c7){_0x55b7bb(_0x22066c[_0xa950('0x11')](0x1f4,_0x2b8c7['message']));});});},'EventManager':function(_0x2cd52d){var _0x1a703b=this;return new Promise(function(_0x17d0af,_0x18d150){if(!_0x2cd52d[_0xa950('0x52')]){return _0x18d150(_0x1a703b[_0xa950('0x11')](0x1f4,_0xa950('0x53')));}ami['emit'](_0xa950('0x54')+_0x2cd52d[_0xa950('0x52')],_0x2cd52d['message']);_0x17d0af({'code':0xc8,'message':_0x2cd52d});});},'FaxAccounts':function(){return new Promise(function(_0x3c1ac8){var _0x15f4c3=_[_0xa950('0x29')](_0x1cd8ec[_0xa950('0x55')]);_0x3c1ac8({'count':_0x15f4c3[_0xa950('0x25')],'rows':_0x15f4c3});});},'SendFax':function(_0x2cdfe8){var _0x188996=this;return new Promise(function(_0x55729c,_0x729af9){_0x512c0e[_0xa950('0x56')](_0x2cdfe8)[_0xa950('0x1b')](function(_0x3ff63f){_0x55729c({'code':0xc8,'message':_0x3ff63f[_0xa950('0x1c')]});})[_0xa950('0x1d')](function(_0x5ec64d){_0x729af9(_0x188996[_0xa950('0x11')](0x1f4,_0x5ec64d[_0xa950('0x1c')]));});});},'CheckAfterSend':function(_0x5b5b02){var _0x4caa09=this;return new Promise(function(_0x54b082,_0x5dccf2){_0x512c0e[_0xa950('0x57')](_0x5b5b02)[_0xa950('0x1b')](function(_0x4925f5){_0x54b082({'code':0xc8,'message':_0x4925f5[_0xa950('0x1c')]});})[_0xa950('0x1d')](function(_0x5e5ea0){_0x5dccf2(_0x4caa09[_0xa950('0x11')](0x1f4,_0x5e5ea0[_0xa950('0x1c')]));});});}};var _0x1b1484=jayson['server'](_0x5ba2da)['http']();_0x1b1484['on'](_0xa950('0x11'),function(_0x19d3b6){return _0x3645b6(_0x19d3b6);});_0x1b1484[_0xa950('0x58')](0x232a,_0xa950('0x59'),function(){console[_0xa950('0x5a')](_0xa950('0x5b'),0x232a);return _0x14b4ac(_0xa950('0x5c')+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 b6d84a3..365fd7b 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 _0x381e=['lodash','bluebird','ioredis','util','../../../../config/environment','../../../../config/logger','trigger','../../rpc/cmContact','redis','defaults','socket.io-emitter','info','[CM][%s][%s]','emit','exec','data1','data2','isNil','data5','xmd-contactid','ListId','data3','phone','$or','map','routeId','calleridnum','destcalleridnum','firstName','lastName','mobile','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found','data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','Unknown','destcalleridname','createContact','[CM][%s][%s]\x20Contact\x20created:%s','[CM][%s][%s]\x20Autocreate\x20disabled','push','format','name','action'];(function(_0x3c22b3,_0x509f39){var _0x6969f7=function(_0x27beef){while(--_0x27beef){_0x3c22b3['push'](_0x3c22b3['shift']());}};_0x6969f7(++_0x509f39);}(_0x381e,0x18f));var _0xe381=function(_0x257677,_0x19bd75){_0x257677=_0x257677-0x0;var _0x23964c=_0x381e[_0x257677];return _0x23964c;};'use strict';var _=require(_0xe381('0x0'));var BPromise=require(_0xe381('0x1'));var Redis=require(_0xe381('0x2'));var util=require(_0xe381('0x3'));var config=require(_0xe381('0x4'));var logger=require(_0xe381('0x5'))(_0xe381('0x6'));var cmContactRpc=require(_0xe381('0x7'));config[_0xe381('0x8')]=_[_0xe381('0x9')](config[_0xe381('0x8')],{'host':'localhost','port':0x18eb});var io=require(_0xe381('0xa'))(new Redis(config[_0xe381('0x8')]));function emit(_0x25995c,_0x225e1b,_0xfd2fc3,_0x5d03d0,_0x5108df){logger[_0xe381('0xb')](_0xe381('0xc'),_0x25995c,_0x225e1b['id'],_0xfd2fc3,_0x5d03d0,JSON['stringify'](_0x5108df));io['to'](_0xfd2fc3)[_0xe381('0xd')](_0x5d03d0,_0x5108df);}exports[_0xe381('0xe')]=function(_0x155546,_0x4df107,_0xcb3f0c,_0x3d0575){var _0x56ad01,_0xce7858;var _0x156964={};var _0x2a9994;var _0x4077d4=Number(_0xcb3f0c[_0xe381('0xf')]);var _0x2ea1e1=_0xcb3f0c['data2']?Boolean(Number(_0xcb3f0c[_0xe381('0x10')])):![];var _0x1924e3;var _0x49febc=![];if(!_[_0xe381('0x11')](_0xcb3f0c['data5'])){if(_0xcb3f0c[_0xe381('0x12')]=='1')_0x49febc=!![];}if(!_0x49febc){if(_0x3d0575['xmd-contactid']){_0x156964['id']=_0x3d0575[_0xe381('0x13')];}}if(!_0x156964['id']){_0x156964[_0xe381('0x14')]=_0x4077d4;_0x1924e3=_0xcb3f0c[_0xe381('0x15')]&&_0xcb3f0c[_0xe381('0x15')]!=='0'?_0xcb3f0c[_0xe381('0x15')]['split'](','):[_0xe381('0x16')];_0x156964[_0xe381('0x17')]=_[_0xe381('0x18')](_0x1924e3,function(_0x4041b6){var _0x2d3179={};_0x2d3179[_0x4041b6]=_0x3d0575[_0xe381('0x19')]?_0x3d0575['destcalleridnum']:_0x3d0575[_0xe381('0x1a')];return _0x2d3179;});_0x2a9994=_0x3d0575['routeId']?_0x3d0575[_0xe381('0x1b')]:_0x3d0575[_0xe381('0x1a')];}var _0x3b30e1=['id',_0xe381('0x1c'),_0xe381('0x1d'),'phone',_0xe381('0x1e'),'fax',_0xe381('0x14'),_0xe381('0x1f'),_0xe381('0x20'),_0xe381('0x21')];var _0x14039b=_[_0xe381('0x22')](_0x3b30e1,_0x1924e3);BPromise[_0xe381('0x23')]()[_0xe381('0x24')](cmContactRpc[_0xe381('0x25')]({'attributes':_0x14039b,'where':_0x156964,'phone':_0x2a9994}))[_0xe381('0x24')](function(_0x1ddec4){_0xce7858=_0x1ddec4;if(!_['isEmpty'](_0xce7858)){if(_0xce7858[_0xe381('0x26')]===0x1){_0x56ad01=_0xce7858[0x0];logger[_0xe381('0xb')](_0xe381('0x27'),_0x3d0575[_0xe381('0x28')],_0x4df107['id'],_0x56ad01['id']);}else{logger[_0xe381('0xb')](_0xe381('0x29'),_0x3d0575[_0xe381('0x28')],_0x4df107['id'],_['map'](_0xce7858,'id')[_0xe381('0x2a')](','));}return;}else{logger['info'](_0xe381('0x2b'),_0x3d0575[_0xe381('0x28')],_0x4df107['id']);var _0xec53ed={'ListId':_0x4077d4};var _0x13eff9=_0xcb3f0c['data4']&&_0xcb3f0c[_0xe381('0x2c')]!=='0'?_0xcb3f0c[_0xe381('0x2c')]:_0xe381('0x16');if(_0x2ea1e1){logger['info'](_0xe381('0x2d'),_0x3d0575['uniqueid'],_0x4df107['id']);_0xec53ed[_0x13eff9]=_[_0xe381('0x11')](_0x3d0575['routeId'])?_0x3d0575[_0xe381('0x1a')]:_0x3d0575[_0xe381('0x1b')];if(_[_0xe381('0x11')](_0x3d0575[_0xe381('0x19')])){_0xec53ed[_0xe381('0x1c')]=_0x3d0575[_0xe381('0x2e')]&&_0x3d0575[_0xe381('0x2e')]!==_0xe381('0x2f')?_0x3d0575[_0xe381('0x2e')]:_0xe381('0x30');}else{_0xec53ed[_0xe381('0x1c')]=_0x3d0575[_0xe381('0x31')]&&_0x3d0575[_0xe381('0x31')]!==_0xe381('0x2f')?_0x3d0575[_0xe381('0x31')]:_0xe381('0x30');}return BPromise[_0xe381('0x23')]()[_0xe381('0x24')](cmContactRpc[_0xe381('0x32')](_0xec53ed))[_0xe381('0x24')](function(_0x53d461){_0x56ad01=_0x53d461;_0xce7858['push'](_0x53d461);if(_0x56ad01){logger['info'](_0xe381('0x33'),_0x3d0575[_0xe381('0x28')],_0x4df107['id'],_0x56ad01['id']);}return;});}else{logger[_0xe381('0xb')](_0xe381('0x34'),_0x3d0575[_0xe381('0x28')],_0x4df107['id']);_0xec53ed[_0x13eff9]=_[_0xe381('0x11')](_0x3d0575[_0xe381('0x19')])?_0x3d0575[_0xe381('0x1a')]:_0x3d0575[_0xe381('0x1b')];if(_[_0xe381('0x11')](_0x3d0575['routeId'])){_0xec53ed[_0xe381('0x1c')]=_0x3d0575[_0xe381('0x2e')]&&_0x3d0575[_0xe381('0x2e')]!==_0xe381('0x2f')?_0x3d0575['calleridname']:_0xe381('0x30');}else{_0xec53ed[_0xe381('0x1c')]=_0x3d0575[_0xe381('0x31')]&&_0x3d0575[_0xe381('0x31')]!==_0xe381('0x2f')?_0x3d0575[_0xe381('0x31')]:_0xe381('0x30');}_0x56ad01=_0xec53ed;_0xce7858[_0xe381('0x35')](_0xec53ed);return;}}})[_0xe381('0x24')](function(){if(_0x155546){emit(_0x3d0575[_0xe381('0x28')],_0x4df107,util[_0xe381('0x36')]('user:%s',_0x155546[_0xe381('0x37')]),util[_0xe381('0x36')]('trigger:%s',_0xcb3f0c[_0xe381('0x38')]['toLowerCase']()),{'evt':_['merge'](_0x3d0575,{'autoCreate':_0x2ea1e1}),'contact':_0x56ad01===undefined?{}:_0x56ad01,'contacts':_0xce7858[_0xe381('0x26')]===0x0?undefined:_0xce7858});}});}; \ No newline at end of file +var _0xf188=['data4','[CM][%s][%s]\x20Autocreate\x20enabled','calleridname','','destcalleridname','push','[CM][%s][%s]\x20Contact\x20created:%s','Unknown','format','action','merge','lodash','bluebird','../../../../config/environment','trigger','../../rpc/cmContact','defaults','redis','localhost','socket.io-emitter','info','[CM][%s][%s]','stringify','exec','data2','isNil','data5','xmd-contactid','ListId','data3','split','phone','$or','map','routeId','calleridnum','destcalleridnum','firstName','lastName','mobile','fax','createdAt','scheduledAt','updatedAt','union','resolve','then','getContacts','length','[CM][%s][%s]\x20Contact\x20found:%s','uniqueid','[CM][%s][%s]\x20Multiple\x20contacts\x20found:[%s]','join','[CM][%s][%s]\x20Contact\x20not\x20found'];(function(_0x57b54c,_0x54ce0d){var _0x59cc19=function(_0xa33bc6){while(--_0xa33bc6){_0x57b54c['push'](_0x57b54c['shift']());}};_0x59cc19(++_0x54ce0d);}(_0xf188,0x1f1));var _0x8f18=function(_0x40c810,_0x5464a1){_0x40c810=_0x40c810-0x0;var _0x129c4f=_0xf188[_0x40c810];return _0x129c4f;};'use strict';var _=require(_0x8f18('0x0'));var BPromise=require(_0x8f18('0x1'));var Redis=require('ioredis');var util=require('util');var config=require(_0x8f18('0x2'));var logger=require('../../../../config/logger')(_0x8f18('0x3'));var cmContactRpc=require(_0x8f18('0x4'));config['redis']=_[_0x8f18('0x5')](config[_0x8f18('0x6')],{'host':_0x8f18('0x7'),'port':0x18eb});var io=require(_0x8f18('0x8'))(new Redis(config[_0x8f18('0x6')]));function emit(_0x15f458,_0x48f6b3,_0x373d08,_0x55fea1,_0x3cc28a){logger[_0x8f18('0x9')](_0x8f18('0xa'),_0x15f458,_0x48f6b3['id'],_0x373d08,_0x55fea1,JSON[_0x8f18('0xb')](_0x3cc28a));io['to'](_0x373d08)['emit'](_0x55fea1,_0x3cc28a);}exports[_0x8f18('0xc')]=function(_0x1a1e10,_0x419cd7,_0x26a975,_0x2e3fb1){var _0x36971d,_0x3d78dc;var _0x4dfeb9={};var _0x301996;var _0x560df1=Number(_0x26a975['data1']);var _0x2d8a5a=_0x26a975[_0x8f18('0xd')]?Boolean(Number(_0x26a975[_0x8f18('0xd')])):![];var _0x5160e0;var _0x2376a9=![];if(!_[_0x8f18('0xe')](_0x26a975[_0x8f18('0xf')])){if(_0x26a975['data5']=='1')_0x2376a9=!![];}if(!_0x2376a9){if(_0x2e3fb1[_0x8f18('0x10')]){_0x4dfeb9['id']=_0x2e3fb1[_0x8f18('0x10')];}}if(!_0x4dfeb9['id']){_0x4dfeb9[_0x8f18('0x11')]=_0x560df1;_0x5160e0=_0x26a975[_0x8f18('0x12')]&&_0x26a975[_0x8f18('0x12')]!=='0'?_0x26a975[_0x8f18('0x12')][_0x8f18('0x13')](','):[_0x8f18('0x14')];_0x4dfeb9[_0x8f18('0x15')]=_[_0x8f18('0x16')](_0x5160e0,function(_0x47bb8b){var _0x48524e={};_0x48524e[_0x47bb8b]=_0x2e3fb1[_0x8f18('0x17')]?_0x2e3fb1['destcalleridnum']:_0x2e3fb1[_0x8f18('0x18')];return _0x48524e;});_0x301996=_0x2e3fb1[_0x8f18('0x17')]?_0x2e3fb1[_0x8f18('0x19')]:_0x2e3fb1['calleridnum'];}var _0xe3d6a=['id',_0x8f18('0x1a'),_0x8f18('0x1b'),_0x8f18('0x14'),_0x8f18('0x1c'),_0x8f18('0x1d'),_0x8f18('0x11'),_0x8f18('0x1e'),_0x8f18('0x1f'),_0x8f18('0x20')];var _0x1f8c18=_[_0x8f18('0x21')](_0xe3d6a,_0x5160e0);BPromise[_0x8f18('0x22')]()[_0x8f18('0x23')](cmContactRpc[_0x8f18('0x24')]({'attributes':_0x1f8c18,'where':_0x4dfeb9,'phone':_0x301996}))[_0x8f18('0x23')](function(_0x3b47df){_0x3d78dc=_0x3b47df;if(!_['isEmpty'](_0x3d78dc)){if(_0x3d78dc[_0x8f18('0x25')]===0x1){_0x36971d=_0x3d78dc[0x0];logger[_0x8f18('0x9')](_0x8f18('0x26'),_0x2e3fb1[_0x8f18('0x27')],_0x419cd7['id'],_0x36971d['id']);}else{logger['info'](_0x8f18('0x28'),_0x2e3fb1[_0x8f18('0x27')],_0x419cd7['id'],_['map'](_0x3d78dc,'id')[_0x8f18('0x29')](','));}return;}else{logger['info'](_0x8f18('0x2a'),_0x2e3fb1[_0x8f18('0x27')],_0x419cd7['id']);var _0x4eed7b={'ListId':_0x560df1};var _0x498897=_0x26a975['data4']&&_0x26a975[_0x8f18('0x2b')]!=='0'?_0x26a975[_0x8f18('0x2b')]:'phone';if(_0x2d8a5a){logger[_0x8f18('0x9')](_0x8f18('0x2c'),_0x2e3fb1[_0x8f18('0x27')],_0x419cd7['id']);_0x4eed7b[_0x498897]=_['isNil'](_0x2e3fb1['routeId'])?_0x2e3fb1[_0x8f18('0x18')]:_0x2e3fb1[_0x8f18('0x19')];if(_[_0x8f18('0xe')](_0x2e3fb1[_0x8f18('0x17')])){_0x4eed7b['firstName']=_0x2e3fb1[_0x8f18('0x2d')]&&_0x2e3fb1[_0x8f18('0x2d')]!==_0x8f18('0x2e')?_0x2e3fb1[_0x8f18('0x2d')]:'Unknown';}else{_0x4eed7b[_0x8f18('0x1a')]=_0x2e3fb1[_0x8f18('0x2f')]&&_0x2e3fb1['destcalleridname']!==_0x8f18('0x2e')?_0x2e3fb1[_0x8f18('0x2f')]:'Unknown';}return BPromise[_0x8f18('0x22')]()['then'](cmContactRpc['createContact'](_0x4eed7b))['then'](function(_0x321ead){_0x36971d=_0x321ead;_0x3d78dc[_0x8f18('0x30')](_0x321ead);if(_0x36971d){logger[_0x8f18('0x9')](_0x8f18('0x31'),_0x2e3fb1[_0x8f18('0x27')],_0x419cd7['id'],_0x36971d['id']);}return;});}else{logger[_0x8f18('0x9')]('[CM][%s][%s]\x20Autocreate\x20disabled',_0x2e3fb1['uniqueid'],_0x419cd7['id']);_0x4eed7b[_0x498897]=_[_0x8f18('0xe')](_0x2e3fb1[_0x8f18('0x17')])?_0x2e3fb1[_0x8f18('0x18')]:_0x2e3fb1[_0x8f18('0x19')];if(_[_0x8f18('0xe')](_0x2e3fb1[_0x8f18('0x17')])){_0x4eed7b[_0x8f18('0x1a')]=_0x2e3fb1['calleridname']&&_0x2e3fb1[_0x8f18('0x2d')]!==_0x8f18('0x2e')?_0x2e3fb1[_0x8f18('0x2d')]:_0x8f18('0x32');}else{_0x4eed7b['firstName']=_0x2e3fb1['destcalleridname']&&_0x2e3fb1[_0x8f18('0x2f')]!==_0x8f18('0x2e')?_0x2e3fb1[_0x8f18('0x2f')]:_0x8f18('0x32');}_0x36971d=_0x4eed7b;_0x3d78dc['push'](_0x4eed7b);return;}}})['then'](function(){if(_0x1a1e10){emit(_0x2e3fb1[_0x8f18('0x27')],_0x419cd7,util[_0x8f18('0x33')]('user:%s',_0x1a1e10['name']),util['format']('trigger:%s',_0x26a975[_0x8f18('0x34')]['toLowerCase']()),{'evt':_[_0x8f18('0x35')](_0x2e3fb1,{'autoCreate':_0x2d8a5a}),'contact':_0x36971d===undefined?{}:_0x36971d,'contacts':_0x3d78dc[_0x8f18('0x25')]===0x0?undefined:_0x3d78dc});}});}; \ No newline at end of file diff --git a/server/services/ami/trigger/index.js b/server/services/ami/trigger/index.js index f6b8a52..f6a8e95 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 _0x0e4b=['sugarcrmAccounts','freshsalesAccounts','syncCustomEvent','bind','custom:agentringnoanswer','custom:agentnosuchnumber','custom:agentnoanswer','custom:agentcongestion','custom:agentreject','custom:amd','custom:queuecallerabandon','custom:timeout','syncAgentDial','custom:dialend','custom:newinteraction','custom:incomingmessage','custom:outgoingmessage','custom:acceptmessage','custom:rejectmessage','custom:offlineMessage','emit','info','stringify','prototype','motionChannel','debug','inspect','checkTriggers','interface','status','checkTrigger','merge','Actions','length','action','toLowerCase','contactmanager','motionbar','browser','data1','TemplateId','data2','render','html','template\x20not\x20found','uri','buildUri','isNil','data3','data4','location','uriLocation','windowWidth','data5','800','data6','winApplication','user:%s','name','trigger:%s:%s','jscripty','format','trigger:%s','integration','exec','queue','script','query','replace','channel','every','AllConditions','checkConditions','AnyConditions','some','checkTrigger:\x20trigger','evt','field','account','ChatWebsiteId','operator','value','upperFirst','AccountId','interaction','message','event','agent','membername','lastevent','routeId','mailSubstatus','null','substatus','created','equals','exports','util','lodash','url','ioredis','../../../config/environment','../../../config/logger','../ami','redis','defaults','localhost','popup','winapp','triggers','agents','voiceQueues','templates','voiceExtensions','zendeskAccounts','freshdeskAccounts','salesforceAccounts','zohoAccounts','deskAccounts','vtigerAccounts','servicenowAccounts','dynamics365Accounts','accounts'];(function(_0x250730,_0x38ddb2){var _0x17cb39=function(_0x253c28){while(--_0x253c28){_0x250730['push'](_0x250730['shift']());}};_0x17cb39(++_0x38ddb2);}(_0x0e4b,0xdc));var _0xb0e4=function(_0x484a04,_0x78d6f8){_0x484a04=_0x484a04-0x0;var _0x32aaa9=_0x0e4b[_0x484a04];return _0x32aaa9;};'use strict';var util=require(_0xb0e4('0x0'));var _=require(_0xb0e4('0x1'));var url=require(_0xb0e4('0x2'));var Mustache=require('mustache');var Redis=require(_0xb0e4('0x3'));var urlforward=require('./urlforward');var integration=require('./integration');var cmContact=require('./cmContact');var script=require('./script');var config=require(_0xb0e4('0x4'));var logger=require(_0xb0e4('0x5'))('trigger');var ami=require(_0xb0e4('0x6'));config[_0xb0e4('0x7')]=_[_0xb0e4('0x8')](config[_0xb0e4('0x7')],{'host':_0xb0e4('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));var operators={'equals':function(_0x101860,_0x9d4a99){return _0x101860==_0x9d4a99;},'not_equals':function(_0x1d6452,_0x23555b){return _0x1d6452!=_0x23555b;}};var barAndWebActions=[_0xb0e4('0xa'),_0xb0e4('0x2'),_0xb0e4('0xb')];function Trigger(_0x232133){this[_0xb0e4('0xc')]=_0x232133[_0xb0e4('0xc')];this[_0xb0e4('0xd')]=_0x232133[_0xb0e4('0xd')];this[_0xb0e4('0xe')]=_0x232133[_0xb0e4('0xe')];this[_0xb0e4('0xf')]=_0x232133['templates'];this[_0xb0e4('0x10')]=_0x232133[_0xb0e4('0x10')];this['zendeskAccounts']=_0x232133[_0xb0e4('0x11')];this[_0xb0e4('0x12')]=_0x232133[_0xb0e4('0x12')];this[_0xb0e4('0x13')]=_0x232133[_0xb0e4('0x13')];this['sugarcrmAccounts']=_0x232133['sugarcrmAccounts'];this[_0xb0e4('0x14')]=_0x232133[_0xb0e4('0x14')];this['deskAccounts']=_0x232133[_0xb0e4('0x15')];this[_0xb0e4('0x16')]=_0x232133[_0xb0e4('0x16')];this[_0xb0e4('0x17')]=_0x232133[_0xb0e4('0x17')];this[_0xb0e4('0x18')]=_0x232133['dynamics365Accounts'];this['freshsalesAccounts']=_0x232133['freshsalesAccounts'];this[_0xb0e4('0x19')]={'zendesk':this[_0xb0e4('0x11')],'salesforce':this[_0xb0e4('0x13')],'freshdesk':this[_0xb0e4('0x12')],'sugarcrm':this[_0xb0e4('0x1a')],'zoho':this[_0xb0e4('0x14')],'desk':this['deskAccounts'],'vtiger':this[_0xb0e4('0x16')],'dynamics365':this[_0xb0e4('0x18')],'freshsales':this[_0xb0e4('0x1b')],'servicenow':this[_0xb0e4('0x17')]};ami['on']('custom:agentcalled',this[_0xb0e4('0x1c')][_0xb0e4('0x1d')](this));ami['on']('custom:agentconnect',this[_0xb0e4('0x1c')][_0xb0e4('0x1d')](this));ami['on'](_0xb0e4('0x1e'),this['syncCustomEvent'][_0xb0e4('0x1d')](this));ami['on']('custom:agentcomplete',this['syncCustomEvent'][_0xb0e4('0x1d')](this));ami['on'](_0xb0e4('0x1f'),this[_0xb0e4('0x1c')][_0xb0e4('0x1d')](this));ami['on'](_0xb0e4('0x20'),this[_0xb0e4('0x1c')][_0xb0e4('0x1d')](this));ami['on']('custom:agentbusy',this[_0xb0e4('0x1c')]['bind'](this));ami['on'](_0xb0e4('0x21'),this[_0xb0e4('0x1c')][_0xb0e4('0x1d')](this));ami['on'](_0xb0e4('0x22'),this['syncCustomEvent'][_0xb0e4('0x1d')](this));ami['on'](_0xb0e4('0x23'),this[_0xb0e4('0x1c')][_0xb0e4('0x1d')](this));ami['on'](_0xb0e4('0x24'),this[_0xb0e4('0x1c')][_0xb0e4('0x1d')](this));ami['on'](_0xb0e4('0x25'),this['syncCustomEvent'][_0xb0e4('0x1d')](this));ami['on']('custom:dialbegin',this[_0xb0e4('0x26')][_0xb0e4('0x1d')](this));ami['on']('custom:dialconnect',this[_0xb0e4('0x26')][_0xb0e4('0x1d')](this));ami['on'](_0xb0e4('0x27'),this[_0xb0e4('0x26')][_0xb0e4('0x1d')](this));ami['on'](_0xb0e4('0x28'),this['syncCustomEvent'][_0xb0e4('0x1d')](this));ami['on']('custom:closedinteraction',this['syncCustomEvent'][_0xb0e4('0x1d')](this));ami['on']('custom:substatus',this[_0xb0e4('0x1c')]['bind'](this));ami['on'](_0xb0e4('0x29'),this['syncCustomEvent'][_0xb0e4('0x1d')](this));ami['on'](_0xb0e4('0x2a'),this[_0xb0e4('0x1c')]['bind'](this));ami['on'](_0xb0e4('0x2b'),this['syncCustomEvent'][_0xb0e4('0x1d')](this));ami['on'](_0xb0e4('0x2c'),this[_0xb0e4('0x1c')][_0xb0e4('0x1d')](this));ami['on'](_0xb0e4('0x2d'),this['syncCustomEvent'][_0xb0e4('0x1d')](this));}Trigger['prototype'][_0xb0e4('0x2e')]=function(_0x434630,_0x3a7e82,_0x5451f2){logger[_0xb0e4('0x2f')](_0x434630,_0x3a7e82,JSON[_0xb0e4('0x30')](_0x5451f2));io['to'](_0x434630)[_0xb0e4('0x2e')](_0x3a7e82,_0x5451f2);};Trigger[_0xb0e4('0x31')]['syncCustomEvent']=function(_0x4b6f58){var _0x4af7f6=_['clone'](_0x4b6f58);if(typeof _0x4af7f6[_0xb0e4('0x32')]==='undefined'){_0x4af7f6[_0xb0e4('0x32')]='voice';}logger[_0xb0e4('0x33')]('syncCustomEvent',util[_0xb0e4('0x34')](_0x4af7f6,{'showHidden':!![],'depth':null}));this[_0xb0e4('0x35')](_0x4af7f6);};Trigger[_0xb0e4('0x31')][_0xb0e4('0x26')]=function(_0x52c40f){if(this[_0xb0e4('0xd')][_0x52c40f[_0xb0e4('0x36')]]){this['syncCustomEvent'](_0x52c40f);}};Trigger[_0xb0e4('0x31')]['checkTriggers']=function(_0x455b7e){var _0x15d92c;for(var _0x4ab8fa in this[_0xb0e4('0xc')]){if(this['triggers']['hasOwnProperty'](_0x4ab8fa)){if(this['triggers'][_0x4ab8fa][_0xb0e4('0x37')]){_0x15d92c=this[_0xb0e4('0x38')](this['triggers'][_0x4ab8fa],_0x455b7e);if(_0x15d92c){_[_0xb0e4('0x39')](_0x455b7e,_0x455b7e['variables']);for(var _0x3a26ec=0x0,_0x10dbdc,_0x2a5c01,_0x3b8cb7;_0x3a26ec0x0){_0x55ad0f=_[_0xf326('0x25')](_0x581531,_0x1617d2);}return _0x55ad0f;}function getCustomFields(_0x1ae23a,_0x2fa28e){var _0x5dbe63=[];var _0xc115d9={'custom_fields':{}};if(_0x1ae23a[_0xf326('0x26')]>0x0){_['forEach'](_0x1ae23a,function(_0x225776){if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776[_0xf326('0x2a')])&&_0x225776[_0xf326('0x2b')]&&!_0x225776[_0xf326('0x2c')]){_0xc115d9[_0x225776[_0xf326('0x2b')][_0xf326('0x2d')]()]=_0x225776[_0xf326('0x2e')]['toString']();}else if(_[_0xf326('0x27')]([_0xf326('0x28'),_0xf326('0x29')],_0x225776['type'])&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x225776['content'][_0xf326('0x31')]();}else if(_0x225776[_0xf326('0x2a')]===_0xf326('0x32')&&_0x225776[_0xf326('0x33')]&&_0x225776[_0xf326('0x2f')]&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776[_0xf326('0x33')]]&&(_0xc115d9[_0xf326('0x30')][_0x225776['idField']]=_0x2fa28e[_0x225776[_0xf326('0x33')]][_0xf326('0x31')]());}else if(_0x225776['type']===_0xf326('0x34')&&_0x225776['Variable']&&_0x225776[_0xf326('0x35')]['name']&&_0x225776['idField']&&_0x225776[_0xf326('0x2c')]){_0x2fa28e[_0x225776['Variable'][_0xf326('0x36')]['toLowerCase']()]&&(_0xc115d9[_0xf326('0x30')][_0x225776[_0xf326('0x2f')]]=_0x2fa28e[_0x225776[_0xf326('0x35')]['name'][_0xf326('0x2d')]()][_0xf326('0x31')]());}});}if(_0xc115d9['priority']){_0xc115d9[_0xf326('0x37')]=Number(_0xc115d9[_0xf326('0x37')]);}return _0xc115d9;}function getTicket(_0x40fa7a,_0xaf65e0,_0x51076c,_0x2c4416,_0xb1ef35){logger[_0xf326('0xb')](_0xf326('0x38'));var _0x1d88ed=_['merge']({'subject':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3a')],_0xb1ef35,'\x20'),'type':'phone','status':'new','labels':[_0xf326('0x3b'),'Motion','CTI'][_0xf326('0x3c')](getTags(_0x2c4416['Tags'],_0xf326('0x36'))),'description':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a'),'_links':{'assigned_user':{'href':util[_0xf326('0x13')]('/api/v2/users/%d',_0xaf65e0['id']),'class':_0xf326('0x3e')}},'message':{'direction':'in','body':intUtil[_0xf326('0x39')](_0x2c4416[_0xf326('0x3d')],_0xb1ef35,'\x0a')}},getCustomFields(_0x2c4416[_0xf326('0x3f')],_0xb1ef35));return request({'uri':util[_0xf326('0x13')](_0xf326('0x40'),_0x40fa7a[_0xf326('0x16')],_0x51076c['id']),'method':_0xf326('0x23'),'body':_0x1d88ed});}exports[_0xf326('0x41')]=function(_0x1227d3,_0x361776,_0x2bab13,_0x50d63f,_0x1b6126,_0x1637dc){var _0x2ed1a7,_0x270288;_0x1637dc[_0xf326('0x16')]=intUtil[_0xf326('0x42')](_0x1637dc['remoteUri']);_0x1637dc[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x1637dc['serverUrl']);if(_0x1b6126&&_0x1b6126[_0xf326('0x44')]){logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x46'));_0x361776[_0xf326('0x47')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1637dc[_0xf326('0x43')],_0x361776[_0xf326('0x48')],md5(_0x361776['uniqueid']));}else{_0x361776['recordingURL']='';}headers[_0xf326('0x49')]=getAuth(_0x1637dc);return getUser(_0x1637dc,_0x50d63f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x5b3705){_0x2ed1a7=_0x5b3705;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2ed1a7['id']);return getEndUser(_0x1637dc,_0x361776[_0xf326('0x4c')],_0x361776[_0xf326('0x4d')]);})[_0xf326('0xe')](function(_0x2d9bba){_0x270288=_0x2d9bba;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x270288['id']);return getTicket(_0x1637dc,_0x2ed1a7,_0x270288,_0x2bab13,_0x361776);})[_0xf326('0xe')](function(_0x27ced1){if(_0x27ced1){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x27ced1['id']);switch(_0x1637dc[_0xf326('0x2a')]){case'integrationTab':logger[_0xf326('0xb')](_0xf326('0x45'),_0xf326('0x51'));emit(util[_0xf326('0x13')]('user:%s',_0x50d63f[_0xf326('0x36')]),_0xf326('0x52'),{'recordId':_0x27ced1['id']});break;case _0xf326('0x53'):logger[_0xf326('0xb')]('[QUEUE]',_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x50d63f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util['format']('https://xcally.desk.com/web/agent/case/%d',_0x27ced1['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x45'),_0xf326('0x58'));}}})['catch'](function(_0x102fba){console[_0xf326('0x57')](_0x102fba);logger[_0xf326('0x57')]('[QUEUE]',JSON['stringify'](_0x102fba));});};exports[_0xf326('0x59')]=function(_0x5b4832,_0x1cf58f,_0x554277,_0x458e5f,_0x7ee57,_0x28c959,_0x25e091){var _0x212594,_0x35d3c8;_0x28c959[_0xf326('0x16')]=intUtil['stripTrailingSlash'](_0x28c959[_0xf326('0x16')]);_0x28c959[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28c959['serverUrl']);if(_0x25e091&&_0x25e091[_0xf326('0x5a')]&&_0x25e091[_0xf326('0x5a')]!==_0xf326('0x5b')){logger[_0xf326('0xb')](_0xf326('0x5c'),'Recording\x20is\x20enabled!');_0x1cf58f[_0xf326('0x47')]=util[_0xf326('0x13')](_0xf326('0x5d'),_0x28c959[_0xf326('0x43')],_0x1cf58f['uniqueid'],md5(_0x1cf58f[_0xf326('0x48')]));}headers[_0xf326('0x49')]=getAuth(_0x28c959);return getUser(_0x28c959,_0x458e5f[_0xf326('0x4a')])[_0xf326('0xe')](function(_0x4d3b9e){_0x212594=_0x4d3b9e;logger['info'](_0xf326('0x4b'),_0x212594['id']);return getEndUser(_0x28c959,_0x1cf58f[_0xf326('0x5e')],_0x1cf58f['destcalleridnum']);})[_0xf326('0xe')](function(_0x29de71){_0x35d3c8=_0x29de71;logger[_0xf326('0xb')](_0xf326('0x4e'),_0x35d3c8['id']);return getTicket(_0x28c959,_0x212594,_0x35d3c8,_0x554277,_0x1cf58f);})['then'](function(_0xb1c18c){if(_0xb1c18c){logger['info']('Ticket\x20created!');logger[_0xf326('0xb')]('The\x20Ticket\x20ID\x20is:',_0xb1c18c['id']);switch(_0x28c959[_0xf326('0x2a')]){case _0xf326('0x5f'):logger[_0xf326('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),'trigger:desk:display',{'recordId':_0xb1c18c['id']});break;case _0xf326('0x53'):logger['info'](_0xf326('0x45'),_0xf326('0x54'));emit(util[_0xf326('0x13')](_0xf326('0x55'),_0x458e5f[_0xf326('0x36')]),_0xf326('0x56'),{'uri':util[_0xf326('0x13')](_0xf326('0x60'),_0x28c959[_0xf326('0x16')],_0xb1c18c['id'])});break;default:logger[_0xf326('0x57')](_0xf326('0x5c'),_0xf326('0x58'));}}})[_0xf326('0x61')](function(_0x4ca1b8){logger[_0xf326('0x57')]('[OUTBOUND]',JSON[_0xf326('0x62')](_0x4ca1b8));});};exports[_0xf326('0x63')]=function(_0x5e858d,_0x2b770c,_0x5283da,_0x3255b2,_0xd55246,_0x28f3cb){var _0x2d45c9,_0x31b6dd;_0x28f3cb['remoteUri']=intUtil['stripTrailingSlash'](_0x28f3cb[_0xf326('0x16')]);_0x28f3cb[_0xf326('0x43')]=intUtil[_0xf326('0x42')](_0x28f3cb[_0xf326('0x43')]);if(_0xd55246&&_0xd55246[_0xf326('0x44')]){logger['info']('['+_0x2b770c[_0xf326('0x64')][_0xf326('0x65')]()+']','Recording\x20is\x20enabled!');_0x2b770c['recordingURL']=util['format'](_0xf326('0x5d'),_0x28f3cb[_0xf326('0x43')],_0x2b770c[_0xf326('0x48')],md5(_0x2b770c[_0xf326('0x48')]));}else{_0x2b770c[_0xf326('0x47')]='';}headers[_0xf326('0x49')]=getAuth(_0x28f3cb);return getUser(_0x28f3cb)[_0xf326('0xe')](function(_0x4b9013){_0x2d45c9=_0x4b9013;logger[_0xf326('0xb')](_0xf326('0x4b'),_0x2d45c9['id']);return getEndUser(_0x28f3cb,_0x2b770c[_0xf326('0x4c')],_0x2b770c[_0xf326('0x4d')]);})['then'](function(_0x3717fe){_0x31b6dd=_0x3717fe;logger['info']('The\x20Enduser\x20ID\x20is:',_0x31b6dd['id']);return getTicket(_0x28f3cb,_0x2d45c9,_0x31b6dd,_0x5283da,_0x2b770c);})[_0xf326('0xe')](function(_0x540fa0){if(_0x540fa0){logger[_0xf326('0xb')](_0xf326('0x4f'));logger[_0xf326('0xb')](_0xf326('0x50'),_0x540fa0['id']);}})[_0xf326('0x61')](function(_0x541491){logger['error']('['+_0x2b770c['lastevent'][_0xf326('0x65')]()+']',JSON[_0xf326('0x62')](_0x541491));});}; \ No newline at end of file +var _0x3e74=['customField','content','idField','custom_fields','variable','variableName','name','Variable','toLowerCase','priority','Creating\x20new\x20ticket...','getString','phone','new','xCALLY','Motion','CTI','concat','Descriptions','/api/v2/users/%d','user','Fields','%s/customers/%d/cases','stripTrailingSlash','serverUrl','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','newTab','[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','https://xcally.desk.com/web/agent/case/%d','error','Desk\x20account\x20type\x20not\x20recognized','catch','outbound','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridnum','The\x20Enduser\x20ID\x20is:','trigger:desk:display','trigger:browser:url','%s/agent/tickets/%s','stringify','unmanaged','monitor_format','lastevent','toUpperCase','calleridnum','lodash','md5','util','ioredis','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Getting\x20agent\x20with\x20email','%s/users','then','find','_embedded','entries','Agent\x20found!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','remoteUri','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','format','debug','[HTTP]','GET','authType','basic','%s:%s','username','password','token','Basic\x20%s','toString','base64','Searching\x20enduser\x20with\x20phone','total_entries','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','POST','length','forEach','includes','string','picklist','type','nameField'];(function(_0x1c9757,_0x12cc75){var _0x504117=function(_0xbad19d){while(--_0xbad19d){_0x1c9757['push'](_0x1c9757['shift']());}};_0x504117(++_0x12cc75);}(_0x3e74,0x175));var _0x43e7=function(_0x594841,_0xb75e0c){_0x594841=_0x594841-0x0;var _0x2e50cb=_0x3e74[_0x594841];return _0x2e50cb;};'use strict';var _=require(_0x43e7('0x0'));var rp=require('request-promise');var md5=require(_0x43e7('0x1'));var util=require(_0x43e7('0x2'));var Redis=require(_0x43e7('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0x43e7('0x4'))('desk');config[_0x43e7('0x5')]=_[_0x43e7('0x6')](config[_0x43e7('0x5')],{'host':_0x43e7('0x7'),'port':0x18eb});var io=require(_0x43e7('0x8'))(new Redis(config['redis']));function emit(_0x45a0d1,_0x3491d6,_0x2ede2d){io['to'](_0x45a0d1)[_0x43e7('0x9')](_0x3491d6,_0x2ede2d);}var headers={'Content-Type':_0x43e7('0xa'),'Accept':'application/json'};function getUser(_0x212c6c,_0x554d44){if(intUtil['validateEmail'](_0x554d44)===!![]){logger[_0x43e7('0xb')](_0x43e7('0xc'),_0x554d44);return request({'uri':util['format'](_0x43e7('0xd'),_0x212c6c['remoteUri'])})[_0x43e7('0xe')](function(_0x37302c){if(_0x37302c['total_entries']){return _[_0x43e7('0xf')](_0x37302c[_0x43e7('0x10')][_0x43e7('0x11')],{'email':_0x554d44});}})[_0x43e7('0xe')](function(_0x4e008c){if(_0x4e008c){logger['info'](_0x43e7('0x12'));return _0x4e008c;}else{logger[_0x43e7('0xb')](_0x43e7('0x13'));return request({'uri':util['format']('%s/users/me',_0x212c6c[_0x43e7('0x14')])});}});}else{logger[_0x43e7('0xb')](_0x43e7('0x15'));return request({'uri':util[_0x43e7('0x16')]('%s/users/me',_0x212c6c['remoteUri'])});}}function request(_0xdf16c){logger[_0x43e7('0x17')](_0x43e7('0x18'),JSON['stringify'](_0xdf16c));return rp(_['defaults'](_0xdf16c,{'method':_0x43e7('0x19'),'headers':headers,'json':!![]}));}function getAuth(_0x1ca758){var _0x9037d3;if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1b')){_0x9037d3=util[_0x43e7('0x16')](_0x43e7('0x1c'),_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1e')]);}else if(_0x1ca758[_0x43e7('0x1a')]===_0x43e7('0x1f')){_0x9037d3=util[_0x43e7('0x16')]('%s/token:%s',_0x1ca758[_0x43e7('0x1d')],_0x1ca758[_0x43e7('0x1f')]);}return util['format'](_0x43e7('0x20'),new Buffer(_0x9037d3)[_0x43e7('0x21')](_0x43e7('0x22')));}function getEndUser(_0x28aacc,_0x4077fb,_0x2f4cb4){logger['info'](_0x43e7('0x23'),_0x2f4cb4);return request({'uri':util['format']('%s/customers/search',_0x28aacc[_0x43e7('0x14')]),'qs':{'phone':_0x2f4cb4}})[_0x43e7('0xe')](function(_0x4b2b9f){if(_0x4b2b9f[_0x43e7('0x24')]){logger['info'](_0x43e7('0x25'));return _0x4b2b9f['_embedded'][_0x43e7('0x11')][0x0];}else{logger[_0x43e7('0xb')](_0x43e7('0x26'));return request({'uri':util[_0x43e7('0x16')]('%s/customers',_0x28aacc['remoteUri']),'method':_0x43e7('0x27'),'body':{'first_name':_0x4077fb,'title':_0x4077fb,'phone_numbers':[{'type':'work','value':_0x2f4cb4}]}});}});}function getTags(_0x2dd5f,_0x40dc8f){var _0x3565cf=[];if(_0x2dd5f&&_0x2dd5f[_0x43e7('0x28')]>0x0){_0x3565cf=_['map'](_0x2dd5f,_0x40dc8f);}return _0x3565cf;}function getCustomFields(_0x33a1a5,_0x4690a6){var _0x45b675=[];var _0x50f9f5={'custom_fields':{}};if(_0x33a1a5[_0x43e7('0x28')]>0x0){_[_0x43e7('0x29')](_0x33a1a5,function(_0x2b85a5){if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5[_0x43e7('0x2d')])&&_0x2b85a5[_0x43e7('0x2e')]&&!_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x2b85a5[_0x43e7('0x2e')]['toLowerCase']()]=_0x2b85a5[_0x43e7('0x30')][_0x43e7('0x21')]();}else if(_[_0x43e7('0x2a')]([_0x43e7('0x2b'),_0x43e7('0x2c')],_0x2b85a5['type'])&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x2b85a5['content']['toString']();}else if(_0x2b85a5['type']===_0x43e7('0x33')&&_0x2b85a5[_0x43e7('0x34')]&&_0x2b85a5[_0x43e7('0x31')]&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x34')]]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5['idField']]=_0x4690a6[_0x2b85a5['variableName']]['toString']());}else if(_0x2b85a5['type']==='customVariable'&&_0x2b85a5['Variable']&&_0x2b85a5['Variable'][_0x43e7('0x35')]&&_0x2b85a5['idField']&&_0x2b85a5[_0x43e7('0x2f')]){_0x4690a6[_0x2b85a5[_0x43e7('0x36')][_0x43e7('0x35')][_0x43e7('0x37')]()]&&(_0x50f9f5[_0x43e7('0x32')][_0x2b85a5[_0x43e7('0x31')]]=_0x4690a6[_0x2b85a5[_0x43e7('0x36')]['name']['toLowerCase']()]['toString']());}});}if(_0x50f9f5[_0x43e7('0x38')]){_0x50f9f5[_0x43e7('0x38')]=Number(_0x50f9f5[_0x43e7('0x38')]);}return _0x50f9f5;}function getTicket(_0x16cdba,_0x1b1440,_0x1ed538,_0x1d4589,_0x2ffd43){logger['info'](_0x43e7('0x39'));var _0x2b0ffe=_['merge']({'subject':intUtil[_0x43e7('0x3a')](_0x1d4589['Subjects'],_0x2ffd43,'\x20'),'type':_0x43e7('0x3b'),'status':_0x43e7('0x3c'),'labels':[_0x43e7('0x3d'),_0x43e7('0x3e'),_0x43e7('0x3f')][_0x43e7('0x40')](getTags(_0x1d4589['Tags'],'name')),'description':intUtil[_0x43e7('0x3a')](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a'),'_links':{'assigned_user':{'href':util[_0x43e7('0x16')](_0x43e7('0x42'),_0x1b1440['id']),'class':_0x43e7('0x43')}},'message':{'direction':'in','body':intUtil['getString'](_0x1d4589[_0x43e7('0x41')],_0x2ffd43,'\x0a')}},getCustomFields(_0x1d4589[_0x43e7('0x44')],_0x2ffd43));return request({'uri':util['format'](_0x43e7('0x45'),_0x16cdba['remoteUri'],_0x1ed538['id']),'method':_0x43e7('0x27'),'body':_0x2b0ffe});}exports['queue']=function(_0x3d81ae,_0x3b4235,_0x3a5807,_0x1c2c6b,_0x49b866,_0x47d6a1){var _0x103393,_0x40c509;_0x47d6a1[_0x43e7('0x14')]=intUtil[_0x43e7('0x46')](_0x47d6a1['remoteUri']);_0x47d6a1['serverUrl']=intUtil['stripTrailingSlash'](_0x47d6a1[_0x43e7('0x47')]);if(_0x49b866&&_0x49b866['monitor_format']){logger[_0x43e7('0xb')]('[QUEUE]','Recording\x20is\x20enabled!');_0x3b4235[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x47d6a1[_0x43e7('0x47')],_0x3b4235[_0x43e7('0x4a')],md5(_0x3b4235[_0x43e7('0x4a')]));}else{_0x3b4235['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x47d6a1);return getUser(_0x47d6a1,_0x1c2c6b[_0x43e7('0x4c')])[_0x43e7('0xe')](function(_0x1fd277){_0x103393=_0x1fd277;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x103393['id']);return getEndUser(_0x47d6a1,_0x3b4235['calleridname'],_0x3b4235['calleridnum']);})[_0x43e7('0xe')](function(_0x36a09e){_0x40c509=_0x36a09e;logger[_0x43e7('0xb')]('The\x20Enduser\x20ID\x20is:',_0x40c509['id']);return getTicket(_0x47d6a1,_0x103393,_0x40c509,_0x3a5807,_0x3b4235);})['then'](function(_0x56489b){if(_0x56489b){logger[_0x43e7('0xb')](_0x43e7('0x4e'));logger['info'](_0x43e7('0x4f'),_0x56489b['id']);switch(_0x47d6a1[_0x43e7('0x2d')]){case _0x43e7('0x50'):logger['info']('[QUEUE]','Displaying\x20ticket\x20to\x20agent...');emit(util['format'](_0x43e7('0x51'),_0x1c2c6b[_0x43e7('0x35')]),'trigger:desk:display',{'recordId':_0x56489b['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')](_0x43e7('0x53'),_0x43e7('0x54'));emit(util['format'](_0x43e7('0x51'),_0x1c2c6b['name']),'trigger:browser:url',{'uri':util[_0x43e7('0x16')](_0x43e7('0x55'),_0x56489b['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x53'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x1cd87c){console[_0x43e7('0x56')](_0x1cd87c);logger[_0x43e7('0x56')](_0x43e7('0x53'),JSON['stringify'](_0x1cd87c));});};exports[_0x43e7('0x59')]=function(_0x46c910,_0x499c03,_0x39e3ca,_0x4e6f6d,_0x35b799,_0x520857,_0x34e2ec){var _0x1f561f,_0xfe13fa;_0x520857['remoteUri']=intUtil['stripTrailingSlash'](_0x520857[_0x43e7('0x14')]);_0x520857[_0x43e7('0x47')]=intUtil[_0x43e7('0x46')](_0x520857[_0x43e7('0x47')]);if(_0x34e2ec&&_0x34e2ec[_0x43e7('0x5a')]&&_0x34e2ec[_0x43e7('0x5a')]!==_0x43e7('0x5b')){logger[_0x43e7('0xb')](_0x43e7('0x5c'),_0x43e7('0x5d'));_0x499c03[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x520857[_0x43e7('0x47')],_0x499c03['uniqueid'],md5(_0x499c03[_0x43e7('0x4a')]));}headers[_0x43e7('0x4b')]=getAuth(_0x520857);return getUser(_0x520857,_0x4e6f6d[_0x43e7('0x4c')])['then'](function(_0x5d63c6){_0x1f561f=_0x5d63c6;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0x1f561f['id']);return getEndUser(_0x520857,_0x499c03['destcalleridname'],_0x499c03[_0x43e7('0x5e')]);})['then'](function(_0x49a6ce){_0xfe13fa=_0x49a6ce;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xfe13fa['id']);return getTicket(_0x520857,_0x1f561f,_0xfe13fa,_0x39e3ca,_0x499c03);})[_0x43e7('0xe')](function(_0x40155c){if(_0x40155c){logger[_0x43e7('0xb')]('Ticket\x20created!');logger[_0x43e7('0xb')](_0x43e7('0x4f'),_0x40155c['id']);switch(_0x520857['type']){case _0x43e7('0x50'):logger[_0x43e7('0xb')](_0x43e7('0x53'),'Displaying\x20ticket\x20to\x20agent...');emit(util['format']('user:%s',_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x60'),{'recordId':_0x40155c['id']});break;case _0x43e7('0x52'):logger[_0x43e7('0xb')]('[QUEUE]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x43e7('0x16')](_0x43e7('0x51'),_0x4e6f6d[_0x43e7('0x35')]),_0x43e7('0x61'),{'uri':util['format'](_0x43e7('0x62'),_0x520857[_0x43e7('0x14')],_0x40155c['id'])});break;default:logger[_0x43e7('0x56')](_0x43e7('0x5c'),_0x43e7('0x57'));}}})[_0x43e7('0x58')](function(_0x4665db){logger[_0x43e7('0x56')](_0x43e7('0x5c'),JSON[_0x43e7('0x63')](_0x4665db));});};exports[_0x43e7('0x64')]=function(_0x57fdfe,_0x5f3824,_0x2b0711,_0x58a3a8,_0x501616,_0x50edb2){var _0xb3e981,_0xe666b0;_0x50edb2['remoteUri']=intUtil[_0x43e7('0x46')](_0x50edb2[_0x43e7('0x14')]);_0x50edb2[_0x43e7('0x47')]=intUtil['stripTrailingSlash'](_0x50edb2[_0x43e7('0x47')]);if(_0x501616&&_0x501616[_0x43e7('0x65')]){logger[_0x43e7('0xb')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',_0x43e7('0x5d'));_0x5f3824[_0x43e7('0x48')]=util['format'](_0x43e7('0x49'),_0x50edb2[_0x43e7('0x47')],_0x5f3824[_0x43e7('0x4a')],md5(_0x5f3824['uniqueid']));}else{_0x5f3824['recordingURL']='';}headers[_0x43e7('0x4b')]=getAuth(_0x50edb2);return getUser(_0x50edb2)['then'](function(_0x5cb26e){_0xb3e981=_0x5cb26e;logger[_0x43e7('0xb')](_0x43e7('0x4d'),_0xb3e981['id']);return getEndUser(_0x50edb2,_0x5f3824['calleridname'],_0x5f3824[_0x43e7('0x68')]);})[_0x43e7('0xe')](function(_0x1e2fed){_0xe666b0=_0x1e2fed;logger[_0x43e7('0xb')](_0x43e7('0x5f'),_0xe666b0['id']);return getTicket(_0x50edb2,_0xb3e981,_0xe666b0,_0x2b0711,_0x5f3824);})[_0x43e7('0xe')](function(_0x398a78){if(_0x398a78){logger['info'](_0x43e7('0x4e'));logger[_0x43e7('0xb')]('The\x20Ticket\x20ID\x20is:',_0x398a78['id']);}})[_0x43e7('0x58')](function(_0x5c2c5f){logger[_0x43e7('0x56')]('['+_0x5f3824[_0x43e7('0x66')][_0x43e7('0x67')]()+']',JSON[_0x43e7('0x63')](_0x5c2c5f));});}; \ 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 98bd662..be281a6 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 _0xfcc5=['isdisabled','info',']\x20Agent\x20found\x20','systemuserid','username','internalemailaddress','userId','toLowerCase','outbound','destcalleridnum','calleridnum','POST','body','headers','odata-entityid','substring','lastIndexOf','enduserId','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing',']\x20Enduser\x20created!','forEach','includes','picklist','type','nameField','customField','idField','indexOf','content','ticketType','incident','getString','Descriptions','/systemusers(','Fields','callDirection','queue','/contacts(','phonecalls','assign','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','stripTrailingSlash','serverUrl','unmanaged','%s/api/data/v9.0/','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s','ticketId',']\x20Call\x20direction:\x20%s','openNewTab',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','request-promise','util','./util','ioredis','dynamics365','redis','defaults','socket.io-emitter','modernAuthentication','remoteUri','data7','tenantId','CloudProvider','data2','resolve','data5','password','clientSecret','access_token','catch','error','toUpperCase',']\x20Wrong\x20credentials!','message','then','GET','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','isNil','validateEmail','email','userEmail','length'];(function(_0x5337cd,_0x544b4b){var _0x3ce044=function(_0x30d55f){while(--_0x30d55f){_0x5337cd['push'](_0x5337cd['shift']());}};_0x3ce044(++_0x544b4b);}(_0xfcc5,0xb7));var _0x5fcc=function(_0x2621e1,_0x1297df){_0x2621e1=_0x2621e1-0x0;var _0x4b294b=_0xfcc5[_0x2621e1];return _0x4b294b;};'use strict';var _=require('lodash');var rp=require(_0x5fcc('0x0'));var util=require(_0x5fcc('0x1'));var intUtil=require(_0x5fcc('0x2'));var md5=require('md5');var Redis=require(_0x5fcc('0x3'));var logger=require('../../../../config/logger')(_0x5fcc('0x4'));var config=require('../../../../config/environment');config[_0x5fcc('0x5')]=_[_0x5fcc('0x6')](config[_0x5fcc('0x5')],{'host':'localhost','port':0x18eb});var io=require(_0x5fcc('0x7'))(new Redis(config[_0x5fcc('0x5')]));function getAuthToken(_0x526f7c,_0xd982fe,_0x44b3ed){if(_0x526f7c[_0x5fcc('0x8')]){_0x526f7c[_0x5fcc('0x9')]=_0x526f7c['CloudProvider'][_0x5fcc('0xa')];_0x526f7c[_0x5fcc('0xb')]=_0x526f7c[_0x5fcc('0xc')][_0x5fcc('0xd')];return Promise[_0x5fcc('0xe')](_0x526f7c[_0x5fcc('0xc')][_0x5fcc('0xf')]);}var _0x1c8991={'method':'POST','uri':_0xd982fe,'form':{'client_id':_0x526f7c['clientId'],'resource':_0x526f7c[_0x5fcc('0x9')],'username':_0x526f7c['username'],'password':_0x526f7c[_0x5fcc('0x10')],'grant_type':_0x5fcc('0x10'),'client_secret':_0x526f7c[_0x5fcc('0x11')]},'json':!![]};return rp(_0x1c8991)['then'](function(_0x266f19){return _0x266f19[_0x5fcc('0x12')];})[_0x5fcc('0x13')](function(_0x2dfdfe){logger[_0x5fcc('0x14')]('['+[_0x44b3ed[_0x5fcc('0x15')]()]+_0x5fcc('0x16'));return _0x2dfdfe[_0x5fcc('0x17')];});}function getUser(_0x89d915,_0x3dabb4,_0x14bf33,_0x47f0d5,_0x4ba0d4,_0x4668a1){return new Promise(function(_0x2006d7,_0x116e75){return getAuthToken(_0x3dabb4,_0x47f0d5,_0x4668a1)[_0x5fcc('0x18')](function(_0x1e90dc){var _0x47af1e={'method':_0x5fcc('0x19'),'uri':_0x4ba0d4+_0x5fcc('0x1a'),'headers':{'Authorization':_0x5fcc('0x1b')+_0x1e90dc,'OData-Version':_0x5fcc('0x1c')},'json':!![]};return rp(_0x47af1e);})[_0x5fcc('0x18')](function(_0x46f827){var _0x2a69a6=_0x46f827[_0x5fcc('0x1d')];var _0x4b04f6=![];var _0xddaefc=null;if(!_[_0x5fcc('0x1e')](_0x14bf33)){if(intUtil[_0x5fcc('0x1f')](_0x14bf33[_0x5fcc('0x20')])){_0x89d915[_0x5fcc('0x21')]=_0x14bf33[_0x5fcc('0x20')];for(_0xddaefc=0x0;_0xddaefc<_0x2a69a6[_0x5fcc('0x22')];_0xddaefc++){if(_0x2a69a6[_0xddaefc]['internalemailaddress']===_0x14bf33['email']&&!_0x2a69a6[_0xddaefc][_0x5fcc('0x23')]){_0x4b04f6=!![];logger[_0x5fcc('0x24')]('['+[_0x4668a1[_0x5fcc('0x15')]()]+_0x5fcc('0x25')+_0x2a69a6[_0xddaefc][_0x5fcc('0x26')]+'!');_0x89d915['userId']=_0x2a69a6[_0xddaefc][_0x5fcc('0x26')];}}}}if(!_0x4b04f6){logger[_0x5fcc('0x24')]('['+[_0x4668a1[_0x5fcc('0x15')]()]+']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');_0x89d915[_0x5fcc('0x21')]=_0x3dabb4[_0x5fcc('0x27')];for(_0xddaefc=0x0;_0xddaefc<_0x2a69a6[_0x5fcc('0x22')];_0xddaefc++){if(_0x2a69a6[_0xddaefc][_0x5fcc('0x28')]===_0x3dabb4[_0x5fcc('0x27')]){_0x89d915[_0x5fcc('0x29')]=_0x2a69a6[_0xddaefc][_0x5fcc('0x26')];}}}_0x2006d7(_0x89d915);})[_0x5fcc('0x13')](function(_0x495a50){_0x116e75(_0x495a50[_0x5fcc('0x17')]);});});}function createEndUser(_0x3e38d5,_0x317848,_0x4d7bf6,_0x2a96be,_0x11d825,_0x5a52fc,_0x1d98fe){return new Promise(function(_0x2761f3,_0x22e1bb){return getAuthToken(_0x317848,_0x4d7bf6,_0x5a52fc)['then'](function(_0x3686e9){var _0x31f29b=_0x5a52fc[_0x5fcc('0x2a')]()===_0x5fcc('0x2b')?_0x11d825[_0x5fcc('0x2c')]:_0x11d825[_0x5fcc('0x2d')];var _0x4826ff={'method':_0x5fcc('0x2e'),'uri':_0x2a96be+'contacts','body':{'fullname':_0x31f29b,'firstname':_0x31f29b,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0x3e38d5[_0x5fcc('0x29')]+')'},'headers':{'Authorization':_0x5fcc('0x1b')+_0x3686e9,'OData-Version':_0x5fcc('0x1c')},'json':!![],'resolveWithFullResponse':!![]};_0x4826ff[_0x5fcc('0x2f')][_0x1d98fe]=_0x31f29b;return rp(_0x4826ff);})[_0x5fcc('0x18')](function(_0x3e13d2){var _0x588757=_0x3e13d2[_0x5fcc('0x30')][_0x5fcc('0x31')];var _0xa0b011=_0x588757[_0x5fcc('0x32')](_0x588757[_0x5fcc('0x33')]('(')+0x1,_0x588757[_0x5fcc('0x33')](')'));_0x3e38d5[_0x5fcc('0x34')]=_0xa0b011;_0x2761f3(_0x3e38d5);})['catch'](function(_0x391d14){_0x22e1bb(_0x391d14[_0x5fcc('0x17')]);});});}function getEndUser(_0x28503d,_0xfb4e3e,_0x55e9ef,_0x427d06,_0x42b1ca,_0x14b2e9,_0x117c9e,_0x3fdf87){var _0x3d6465=_0x14b2e9['toLowerCase']()===_0x5fcc('0x2b')?_0x42b1ca['destcalleridnum']:_0x42b1ca[_0x5fcc('0x2d')];return getAuthToken(_0xfb4e3e,_0x55e9ef,_0x14b2e9)[_0x5fcc('0x18')](function(_0x580157){_0x3fdf87=_0x3fdf87?_0x3fdf87:'telephone1';var _0x546c6f={'method':_0x5fcc('0x19'),'uri':_0x427d06+_0x5fcc('0x35')+_0x3fdf87+_0x5fcc('0x36')+_0x3fdf87+_0x5fcc('0x37')+_0x3d6465[_0x5fcc('0x38')]('+','%2b')+'\x27','headers':{'Authorization':_0x5fcc('0x1b')+_0x580157,'If-None-Match':null,'OData-Version':_0x5fcc('0x1c')},'json':!![]};return rp(_0x546c6f);})['then'](function(_0x5460e3){var _0x14fdba=![];if(!_0x5460e3)return _0x14fdba;var _0x209c97=_0x5460e3['value'];for(var _0x10e3aa=0x0;_0x10e3aa<_0x209c97['length'];_0x10e3aa++){if(_0x209c97[_0x10e3aa][_0x3fdf87]===_0x3d6465){_0x14fdba=!![];_0x28503d[_0x5fcc('0x34')]=_0x209c97[_0x10e3aa]['contactid'];}}return _0x14fdba;})['then'](function(_0x5c1339){if(_0x5c1339)return _0x28503d;if(_0x117c9e===_0x5fcc('0x39')){logger[_0x5fcc('0x24')]('['+[_0x14b2e9['toUpperCase']()]+_0x5fcc('0x3a'));return _0x28503d;}return createEndUser(_0x28503d,_0xfb4e3e,_0x55e9ef,_0x427d06,_0x42b1ca,_0x14b2e9,_0x3fdf87)['then'](function(_0x25f0f8){logger[_0x5fcc('0x24')]('['+[_0x14b2e9[_0x5fcc('0x15')]()]+_0x5fcc('0x3b'),_0x25f0f8[_0x5fcc('0x34')]);return _0x25f0f8;});});}function getCustomFields(_0x16eb5a,_0x44c7cc,_0x40f2bc){var _0x321c59={};if(_0x16eb5a[_0x5fcc('0x22')]>0x0){_[_0x5fcc('0x3c')](_0x16eb5a,function(_0x3a1b9f){if(_[_0x5fcc('0x3d')](['string',_0x5fcc('0x3e')],_0x3a1b9f[_0x5fcc('0x3f')])&&_0x3a1b9f[_0x5fcc('0x40')]&&!_0x3a1b9f[_0x5fcc('0x41')]){var _0x27328b=_0x3a1b9f[_0x5fcc('0x42')]['toLowerCase']();var _0x4a9ae2=_0x27328b[_0x5fcc('0x32')](0x0,_0x27328b[_0x5fcc('0x43')]('_'));var _0x5b7e3f=_0x27328b[_0x5fcc('0x32')](_0x27328b[_0x5fcc('0x43')]('_')+0x1);if(_0x4a9ae2===_0x40f2bc){_0x321c59[_0x5b7e3f]=_0x3a1b9f[_0x5fcc('0x44')];}}});}return _0x321c59;}function getTicket(_0x4bc579,_0x36eec5,_0x266cfb,_0x4e11d,_0x5a6609,_0x480e69,_0x2608f8){return new Promise(function(_0xc5b0dd,_0x1c5ba9){var _0x4e0d9c;return getAuthToken(_0x36eec5,_0x266cfb,_0x2608f8)[_0x5fcc('0x18')](function(_0x56ed22){if(_0x480e69[_0x5fcc('0x45')]===_0x5fcc('0x46')){_0x4e0d9c={'method':_0x5fcc('0x2e'),'uri':_0x4e11d+'incidents','body':Object['assign']({},{'title':intUtil[_0x5fcc('0x47')](_0x480e69['Subjects'],_0x5a6609,'\x20'),'description':intUtil['getString'](_0x480e69[_0x5fcc('0x48')],_0x5a6609,'\x0a'),'customerid_contact@odata.bind':_0x4bc579['enduserId']?'/contacts('+_0x4bc579[_0x5fcc('0x34')]+')':undefined,'ownerid@odata.bind':_0x5fcc('0x49')+_0x4bc579[_0x5fcc('0x29')]+')','caseorigincode':'1'},getCustomFields(_0x480e69[_0x5fcc('0x4a')],_0x5a6609,_0x480e69[_0x5fcc('0x45')])),'headers':{'Authorization':'Bearer\x20'+_0x56ed22,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};}if(_0x480e69[_0x5fcc('0x45')]==='phonecall'){var _0x18d81d=_0x4bc579['enduserId']?[{'partyid_systemuser@odata.bind':_0x5fcc('0x49')+_0x4bc579[_0x5fcc('0x29')]+')','participationtypemask':_0x4bc579[_0x5fcc('0x4b')]===_0x5fcc('0x4c')?0x2:0x1},{'partyid_contact@odata.bind':_0x5fcc('0x4d')+_0x4bc579['enduserId']+')','participationtypemask':_0x4bc579[_0x5fcc('0x4b')]===_0x5fcc('0x4c')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':_0x5fcc('0x49')+_0x4bc579[_0x5fcc('0x29')]+')','participationtypemask':_0x4bc579[_0x5fcc('0x4b')]===_0x5fcc('0x4c')?0x2:0x1}];_0x4e0d9c={'method':_0x5fcc('0x2e'),'uri':_0x4e11d+_0x5fcc('0x4e'),'body':Object[_0x5fcc('0x4f')]({},{'subject':intUtil[_0x5fcc('0x47')](_0x480e69['Subjects'],_0x5a6609,'\x20'),'phonenumber':String(_0x5a6609[_0x5fcc('0x2d')]),'description':intUtil[_0x5fcc('0x47')](_0x480e69[_0x5fcc('0x48')],_0x5a6609,'\x0a'),'regardingobjectid_contact@odata.bind':_0x4bc579[_0x5fcc('0x34')]?_0x5fcc('0x4d')+_0x4bc579[_0x5fcc('0x34')]+')':undefined,'ownerid@odata.bind':_0x5fcc('0x49')+_0x4bc579['userId']+')','directioncode':_0x4bc579['callDirection']===_0x5fcc('0x4c')?![]:!![],'phonecall_activity_parties':_0x18d81d},getCustomFields(_0x480e69[_0x5fcc('0x4a')],_0x5a6609,_0x480e69['ticketType'])),'headers':{'Authorization':_0x5fcc('0x1b')+_0x56ed22,'OData-Version':_0x5fcc('0x1c')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x4e0d9c);})[_0x5fcc('0x18')](function(_0x4c6184){var _0x5a19c9=_0x4c6184[_0x5fcc('0x30')][_0x5fcc('0x31')];var _0xd3a55f=_0x5a19c9[_0x5fcc('0x32')](_0x5a19c9[_0x5fcc('0x33')]('(')+0x1,_0x5a19c9[_0x5fcc('0x33')](')'));_0x4bc579['ticketId']=_0xd3a55f;_0xc5b0dd(_0x4bc579);})['catch'](function(_0x3c871a){_0x1c5ba9(_0x3c871a[_0x5fcc('0x17')]);});});}function emit(_0x2c2e87,_0x51716a,_0x3fa3b9,_0x24aefb){var _0x175a8e={'uri':util[_0x5fcc('0x50')](_0x5fcc('0x51'),_0x2c2e87,_0x3fa3b9,_0x24aefb)};io['to'](util[_0x5fcc('0x50')](_0x5fcc('0x52'),_0x51716a))[_0x5fcc('0x53')](_0x5fcc('0x54'),_0x175a8e);}exports['cs']=function(_0x337ee1,_0x551aaa,_0x23d29e,_0x13b792,_0x23e6cb,_0x252693,_0x2e86a8,_0x25913b){var _0x3ff77c={};_0x252693['remoteUri']=_0x252693[_0x5fcc('0x8')]?intUtil[_0x5fcc('0x55')](_0x252693['CloudProvider']['data7']):intUtil['stripTrailingSlash'](_0x252693['remoteUri']);_0x252693[_0x5fcc('0x56')]=intUtil[_0x5fcc('0x55')](_0x252693[_0x5fcc('0x56')]);_0x3ff77c[_0x5fcc('0x4b')]=_0x25913b===_0x5fcc('0x4c')||_0x25913b===_0x5fcc('0x57')?_0x5fcc('0x4c'):_0x5fcc('0x2b');var _0xe93211=_0x252693[_0x5fcc('0x8')]?util[_0x5fcc('0x50')](_0x5fcc('0x58'),_0x252693[_0x5fcc('0xc')][_0x5fcc('0xa')]):util[_0x5fcc('0x50')](_0x5fcc('0x58'),_0x252693[_0x5fcc('0x9')]);var _0x202ba0=util[_0x5fcc('0x50')]('https://login.microsoftonline.com/%s/oauth2/token',_0x252693[_0x5fcc('0xb')]);var _0x204dfc=util[_0x5fcc('0x50')](_0x5fcc('0x59'),_0x252693['serverUrl'],_0x551aaa[_0x5fcc('0x5a')],md5(_0x551aaa[_0x5fcc('0x5a')]));if(_0x23e6cb&&_0x23e6cb[_0x5fcc('0x5b')]){logger[_0x5fcc('0x24')]('[QUEUE]',_0x5fcc('0x5c'));_0x551aaa['recordingURL']=_0x204dfc;}else if(_0x2e86a8&&_0x2e86a8['recordingFormat']&&_0x2e86a8[_0x5fcc('0x5d')]!==_0x5fcc('0x5e')){logger[_0x5fcc('0x24')](_0x5fcc('0x5f'),_0x5fcc('0x5c'));_0x551aaa[_0x5fcc('0x60')]=_0x204dfc;}else{_0x551aaa['recordingURL']='';}return getUser(_0x3ff77c,_0x252693,_0x13b792,_0x202ba0,_0xe93211,_0x25913b)[_0x5fcc('0x18')](function(_0x8e976d){logger[_0x5fcc('0x24')]('['+_0x25913b[_0x5fcc('0x15')]()+_0x5fcc('0x61'),_0x8e976d[_0x5fcc('0x29')]);logger['info']('['+_0x25913b[_0x5fcc('0x15')]()+_0x5fcc('0x62'),_0x8e976d[_0x5fcc('0x21')]);return getEndUser(_0x8e976d,_0x252693,_0x202ba0,_0xe93211,_0x551aaa,_0x25913b,_0x23d29e[_0x5fcc('0x63')],_0x23d29e[_0x5fcc('0x64')]);})[_0x5fcc('0x18')](function(_0xd0be44){logger['info']('['+_0x25913b[_0x5fcc('0x15')]()+_0x5fcc('0x65'),_0xd0be44[_0x5fcc('0x34')]);logger[_0x5fcc('0x24')]('['+_0x25913b[_0x5fcc('0x15')]()+_0x5fcc('0x66'),_0x551aaa[_0x5fcc('0x2d')]);return getTicket(_0xd0be44,_0x252693,_0x202ba0,_0xe93211,_0x551aaa,_0x23d29e,_0x25913b);})[_0x5fcc('0x18')](function(_0x447580){logger[_0x5fcc('0x24')](util[_0x5fcc('0x50')]('['+_0x25913b[_0x5fcc('0x15')]()+_0x5fcc('0x67'),_0x23d29e['ticketType'],_0x447580[_0x5fcc('0x68')]));logger[_0x5fcc('0x24')](util[_0x5fcc('0x50')]('['+_0x25913b[_0x5fcc('0x15')]()+_0x5fcc('0x69'),_0x25913b));if(_0x25913b!==_0x5fcc('0x57')&&_0x23d29e[_0x5fcc('0x6a')]){logger[_0x5fcc('0x24')]('['+_0x25913b[_0x5fcc('0x15')]()+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x252693[_0x5fcc('0x9')],_0x13b792['name'],_0x23d29e[_0x5fcc('0x45')],_0x447580[_0x5fcc('0x68')]);}})[_0x5fcc('0x13')](function(_0x4ad015){logger[_0x5fcc('0x14')]('['+_0x25913b[_0x5fcc('0x15')]()+_0x5fcc('0x6b'),_0x4ad015[_0x5fcc('0x17')]);console[_0x5fcc('0x14')](_0x5fcc('0x6c'),_0x4ad015);});}; \ No newline at end of file +var _0x4529=['redis','socket.io-emitter','remoteUri','CloudProvider','tenantId','resolve','POST','username','password','clientSecret','then','access_token','catch','error','message','systemusers?$select=internalemailaddress,isdisabled,systemuserid','Bearer\x20','4.0','value','email','userEmail','length','internalemailaddress','toUpperCase',']\x20Agent\x20found\x20','userId','systemuserid','info',']\x20Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','toLowerCase','outbound','destcalleridnum','calleridnum','contacts','body','headers','odata-entityid','substring','lastIndexOf','enduserId','GET','contacts?$select=','&$filter=','\x20eq\x20\x27','replace','contactid','nothing',']\x20Enduser\x20NOT\x20Created\x20-\x20ModuleCreate\x20=\x20Nothing','includes','string','picklist','nameField','customField','idField','indexOf','incidents','getString','Subjects','Descriptions','/contacts(','Fields','ticketType','phonecall','callDirection','queue','phonecalls','assign','format','%s/main.aspx?pagetype=entityrecord&etn=%s&id=%s','user:%s','emit','trigger:browser:url','modernAuthentication','stripTrailingSlash','data7','serverUrl','unmanaged','%s/api/data/v9.0/','https://login.microsoftonline.com/%s/oauth2/token','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL',']\x20The\x20User\x20ID\x20is:',']\x20The\x20User\x20email\x20is:','moduleCreate','additionalSearchContact',']\x20The\x20Enduser\x20ID\x20is:',']\x20The\x20Enduser\x20phone\x20is:',']\x20The\x20%s\x20ID\x20is:\x20%s',']\x20Call\x20direction:\x20%s','Displaying\x20call\x20in\x20a\x20new\x20tab...','name','ticketId',']\x20Error\x20running\x20Dynamics365\x20integration','Error\x20running\x20Dynamics365\x20integration','lodash','request-promise','./util','md5','../../../../config/logger','../../../../config/environment'];(function(_0x56d04c,_0x3762c4){var _0x278a10=function(_0x420def){while(--_0x420def){_0x56d04c['push'](_0x56d04c['shift']());}};_0x278a10(++_0x3762c4);}(_0x4529,0xd0));var _0x9452=function(_0x15f014,_0x574054){_0x15f014=_0x15f014-0x0;var _0x309c11=_0x4529[_0x15f014];return _0x309c11;};'use strict';var _=require(_0x9452('0x0'));var rp=require(_0x9452('0x1'));var util=require('util');var intUtil=require(_0x9452('0x2'));var md5=require(_0x9452('0x3'));var Redis=require('ioredis');var logger=require(_0x9452('0x4'))('dynamics365');var config=require(_0x9452('0x5'));config[_0x9452('0x6')]=_['defaults'](config[_0x9452('0x6')],{'host':'localhost','port':0x18eb});var io=require(_0x9452('0x7'))(new Redis(config['redis']));function getAuthToken(_0x3162d2,_0x16a5ea,_0x247492){if(_0x3162d2['modernAuthentication']){_0x3162d2[_0x9452('0x8')]=_0x3162d2[_0x9452('0x9')]['data7'];_0x3162d2[_0x9452('0xa')]=_0x3162d2['CloudProvider']['data2'];return Promise[_0x9452('0xb')](_0x3162d2['CloudProvider']['data5']);}var _0x366377={'method':_0x9452('0xc'),'uri':_0x16a5ea,'form':{'client_id':_0x3162d2['clientId'],'resource':_0x3162d2[_0x9452('0x8')],'username':_0x3162d2[_0x9452('0xd')],'password':_0x3162d2[_0x9452('0xe')],'grant_type':'password','client_secret':_0x3162d2[_0x9452('0xf')]},'json':!![]};return rp(_0x366377)[_0x9452('0x10')](function(_0xbbd844){return _0xbbd844[_0x9452('0x11')];})[_0x9452('0x12')](function(_0x24af38){logger[_0x9452('0x13')]('['+[_0x247492['toUpperCase']()]+']\x20Wrong\x20credentials!');return _0x24af38[_0x9452('0x14')];});}function getUser(_0x55dd22,_0x200955,_0xbc4edd,_0x9e0e2f,_0x184b58,_0x21866e){return new Promise(function(_0x215955,_0x321ea5){return getAuthToken(_0x200955,_0x9e0e2f,_0x21866e)[_0x9452('0x10')](function(_0x4b33b5){var _0x464696={'method':'GET','uri':_0x184b58+_0x9452('0x15'),'headers':{'Authorization':_0x9452('0x16')+_0x4b33b5,'OData-Version':_0x9452('0x17')},'json':!![]};return rp(_0x464696);})[_0x9452('0x10')](function(_0x764dd6){var _0x369c21=_0x764dd6[_0x9452('0x18')];var _0x1cb3a8=![];var _0x169007=null;if(!_['isNil'](_0xbc4edd)){if(intUtil['validateEmail'](_0xbc4edd[_0x9452('0x19')])){_0x55dd22[_0x9452('0x1a')]=_0xbc4edd['email'];for(_0x169007=0x0;_0x169007<_0x369c21[_0x9452('0x1b')];_0x169007++){if(_0x369c21[_0x169007][_0x9452('0x1c')]===_0xbc4edd['email']&&!_0x369c21[_0x169007]['isdisabled']){_0x1cb3a8=!![];logger['info']('['+[_0x21866e[_0x9452('0x1d')]()]+_0x9452('0x1e')+_0x369c21[_0x169007]['systemuserid']+'!');_0x55dd22[_0x9452('0x1f')]=_0x369c21[_0x169007][_0x9452('0x20')];}}}}if(!_0x1cb3a8){logger[_0x9452('0x21')]('['+[_0x21866e[_0x9452('0x1d')]()]+_0x9452('0x22'));_0x55dd22[_0x9452('0x1a')]=_0x200955[_0x9452('0xd')];for(_0x169007=0x0;_0x169007<_0x369c21['length'];_0x169007++){if(_0x369c21[_0x169007][_0x9452('0x1c')]===_0x200955[_0x9452('0xd')]){_0x55dd22[_0x9452('0x1f')]=_0x369c21[_0x169007][_0x9452('0x20')];}}}_0x215955(_0x55dd22);})[_0x9452('0x12')](function(_0x4a4b8d){_0x321ea5(_0x4a4b8d[_0x9452('0x14')]);});});}function createEndUser(_0xd877a8,_0x5f4092,_0x24cf76,_0x265571,_0x13a902,_0x29d7ca,_0x4e1be2){return new Promise(function(_0x663cde,_0x27767d){return getAuthToken(_0x5f4092,_0x24cf76,_0x29d7ca)[_0x9452('0x10')](function(_0x445de0){var _0x4e3a94=_0x29d7ca[_0x9452('0x23')]()===_0x9452('0x24')?_0x13a902[_0x9452('0x25')]:_0x13a902[_0x9452('0x26')];var _0x570f24={'method':_0x9452('0xc'),'uri':_0x265571+_0x9452('0x27'),'body':{'fullname':_0x4e3a94,'firstname':_0x4e3a94,'lastname':'_','mobilephone':null,'address1_telephone1':null,'ownerid@odata.bind':'/systemusers('+_0xd877a8[_0x9452('0x1f')]+')'},'headers':{'Authorization':_0x9452('0x16')+_0x445de0,'OData-Version':'4.0'},'json':!![],'resolveWithFullResponse':!![]};_0x570f24[_0x9452('0x28')][_0x4e1be2]=_0x4e3a94;return rp(_0x570f24);})[_0x9452('0x10')](function(_0x2047f1){var _0x4e8cc5=_0x2047f1[_0x9452('0x29')][_0x9452('0x2a')];var _0x20e1be=_0x4e8cc5[_0x9452('0x2b')](_0x4e8cc5['lastIndexOf']('(')+0x1,_0x4e8cc5[_0x9452('0x2c')](')'));_0xd877a8[_0x9452('0x2d')]=_0x20e1be;_0x663cde(_0xd877a8);})[_0x9452('0x12')](function(_0x5bb089){_0x27767d(_0x5bb089['message']);});});}function getEndUser(_0x276f77,_0x2af768,_0x4e77cf,_0x17abaf,_0x20d380,_0x5c91e1,_0x54b7b6,_0xadf9b5){var _0x52da81=_0x5c91e1[_0x9452('0x23')]()===_0x9452('0x24')?_0x20d380[_0x9452('0x25')]:_0x20d380[_0x9452('0x26')];return getAuthToken(_0x2af768,_0x4e77cf,_0x5c91e1)[_0x9452('0x10')](function(_0xfcbe89){_0xadf9b5=_0xadf9b5?_0xadf9b5:'telephone1';var _0x1eb821={'method':_0x9452('0x2e'),'uri':_0x17abaf+_0x9452('0x2f')+_0xadf9b5+_0x9452('0x30')+_0xadf9b5+_0x9452('0x31')+_0x52da81[_0x9452('0x32')]('+','%2b')+'\x27','headers':{'Authorization':_0x9452('0x16')+_0xfcbe89,'If-None-Match':null,'OData-Version':_0x9452('0x17')},'json':!![]};return rp(_0x1eb821);})[_0x9452('0x10')](function(_0x55a097){var _0x5ba906=![];if(!_0x55a097)return _0x5ba906;var _0x2063fa=_0x55a097[_0x9452('0x18')];for(var _0x1ae8cf=0x0;_0x1ae8cf<_0x2063fa[_0x9452('0x1b')];_0x1ae8cf++){if(_0x2063fa[_0x1ae8cf][_0xadf9b5]===_0x52da81){_0x5ba906=!![];_0x276f77[_0x9452('0x2d')]=_0x2063fa[_0x1ae8cf][_0x9452('0x33')];}}return _0x5ba906;})[_0x9452('0x10')](function(_0x2ff4a6){if(_0x2ff4a6)return _0x276f77;if(_0x54b7b6===_0x9452('0x34')){logger['info']('['+[_0x5c91e1[_0x9452('0x1d')]()]+_0x9452('0x35'));return _0x276f77;}return createEndUser(_0x276f77,_0x2af768,_0x4e77cf,_0x17abaf,_0x20d380,_0x5c91e1,_0xadf9b5)[_0x9452('0x10')](function(_0x218b20){logger[_0x9452('0x21')]('['+[_0x5c91e1['toUpperCase']()]+']\x20Enduser\x20created!',_0x218b20[_0x9452('0x2d')]);return _0x218b20;});});}function getCustomFields(_0x1eddc2,_0x2ecf40,_0x3dbb03){var _0x2cc713={};if(_0x1eddc2[_0x9452('0x1b')]>0x0){_['forEach'](_0x1eddc2,function(_0x3ef7ef){if(_[_0x9452('0x36')]([_0x9452('0x37'),_0x9452('0x38')],_0x3ef7ef['type'])&&_0x3ef7ef[_0x9452('0x39')]&&!_0x3ef7ef[_0x9452('0x3a')]){var _0x3d95e7=_0x3ef7ef[_0x9452('0x3b')][_0x9452('0x23')]();var _0x38f6b7=_0x3d95e7[_0x9452('0x2b')](0x0,_0x3d95e7[_0x9452('0x3c')]('_'));var _0x225b63=_0x3d95e7[_0x9452('0x2b')](_0x3d95e7[_0x9452('0x3c')]('_')+0x1);if(_0x38f6b7===_0x3dbb03){_0x2cc713[_0x225b63]=_0x3ef7ef['content'];}}});}return _0x2cc713;}function getTicket(_0x103123,_0x320a51,_0x1d4ac2,_0x2336b7,_0x4d13ab,_0x50ea3f,_0x1a2c33){return new Promise(function(_0x85fff1,_0x32810c){var _0x279969;return getAuthToken(_0x320a51,_0x1d4ac2,_0x1a2c33)[_0x9452('0x10')](function(_0x5531a0){if(_0x50ea3f['ticketType']==='incident'){_0x279969={'method':_0x9452('0xc'),'uri':_0x2336b7+_0x9452('0x3d'),'body':Object['assign']({},{'title':intUtil[_0x9452('0x3e')](_0x50ea3f[_0x9452('0x3f')],_0x4d13ab,'\x20'),'description':intUtil[_0x9452('0x3e')](_0x50ea3f[_0x9452('0x40')],_0x4d13ab,'\x0a'),'customerid_contact@odata.bind':_0x103123[_0x9452('0x2d')]?_0x9452('0x41')+_0x103123[_0x9452('0x2d')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x103123[_0x9452('0x1f')]+')','caseorigincode':'1'},getCustomFields(_0x50ea3f[_0x9452('0x42')],_0x4d13ab,_0x50ea3f[_0x9452('0x43')])),'headers':{'Authorization':'Bearer\x20'+_0x5531a0,'OData-Version':_0x9452('0x17')},'json':!![],'resolveWithFullResponse':!![]};}if(_0x50ea3f['ticketType']===_0x9452('0x44')){var _0x5dd81f=_0x103123[_0x9452('0x2d')]?[{'partyid_systemuser@odata.bind':'/systemusers('+_0x103123[_0x9452('0x1f')]+')','participationtypemask':_0x103123[_0x9452('0x45')]==='queue'?0x2:0x1},{'partyid_contact@odata.bind':_0x9452('0x41')+_0x103123[_0x9452('0x2d')]+')','participationtypemask':_0x103123[_0x9452('0x45')]===_0x9452('0x46')?0x1:0x2}]:[{'partyid_systemuser@odata.bind':'/systemusers('+_0x103123[_0x9452('0x1f')]+')','participationtypemask':_0x103123[_0x9452('0x45')]===_0x9452('0x46')?0x2:0x1}];_0x279969={'method':'POST','uri':_0x2336b7+_0x9452('0x47'),'body':Object[_0x9452('0x48')]({},{'subject':intUtil[_0x9452('0x3e')](_0x50ea3f[_0x9452('0x3f')],_0x4d13ab,'\x20'),'phonenumber':String(_0x4d13ab[_0x9452('0x26')]),'description':intUtil[_0x9452('0x3e')](_0x50ea3f['Descriptions'],_0x4d13ab,'\x0a'),'regardingobjectid_contact@odata.bind':_0x103123[_0x9452('0x2d')]?_0x9452('0x41')+_0x103123[_0x9452('0x2d')]+')':undefined,'ownerid@odata.bind':'/systemusers('+_0x103123[_0x9452('0x1f')]+')','directioncode':_0x103123[_0x9452('0x45')]===_0x9452('0x46')?![]:!![],'phonecall_activity_parties':_0x5dd81f},getCustomFields(_0x50ea3f[_0x9452('0x42')],_0x4d13ab,_0x50ea3f['ticketType'])),'headers':{'Authorization':'Bearer\x20'+_0x5531a0,'OData-Version':_0x9452('0x17')},'json':!![],'resolveWithFullResponse':!![]};}return rp(_0x279969);})[_0x9452('0x10')](function(_0x163043){var _0x545e3c=_0x163043[_0x9452('0x29')]['odata-entityid'];var _0x40624b=_0x545e3c[_0x9452('0x2b')](_0x545e3c[_0x9452('0x2c')]('(')+0x1,_0x545e3c['lastIndexOf'](')'));_0x103123['ticketId']=_0x40624b;_0x85fff1(_0x103123);})['catch'](function(_0x41e568){_0x32810c(_0x41e568[_0x9452('0x14')]);});});}function emit(_0xaf08fe,_0x2beec0,_0x18f7ff,_0x166a83){var _0x5ddb48={'uri':util[_0x9452('0x49')](_0x9452('0x4a'),_0xaf08fe,_0x18f7ff,_0x166a83)};io['to'](util[_0x9452('0x49')](_0x9452('0x4b'),_0x2beec0))[_0x9452('0x4c')](_0x9452('0x4d'),_0x5ddb48);}exports['cs']=function(_0x306838,_0x31f8d3,_0x7dc50a,_0x32061f,_0x3c0059,_0x2755e9,_0x4e68f0,_0x5ee9a7){var _0x4bf255={};_0x2755e9[_0x9452('0x8')]=_0x2755e9[_0x9452('0x4e')]?intUtil[_0x9452('0x4f')](_0x2755e9[_0x9452('0x9')][_0x9452('0x50')]):intUtil['stripTrailingSlash'](_0x2755e9[_0x9452('0x8')]);_0x2755e9[_0x9452('0x51')]=intUtil[_0x9452('0x4f')](_0x2755e9[_0x9452('0x51')]);_0x4bf255[_0x9452('0x45')]=_0x5ee9a7===_0x9452('0x46')||_0x5ee9a7===_0x9452('0x52')?_0x9452('0x46'):_0x9452('0x24');var _0x6412b3=_0x2755e9[_0x9452('0x4e')]?util[_0x9452('0x49')](_0x9452('0x53'),_0x2755e9['CloudProvider'][_0x9452('0x50')]):util['format'](_0x9452('0x53'),_0x2755e9[_0x9452('0x8')]);var _0x4bfc95=util[_0x9452('0x49')](_0x9452('0x54'),_0x2755e9['tenantId']);var _0x50216b=util[_0x9452('0x49')](_0x9452('0x55'),_0x2755e9['serverUrl'],_0x31f8d3['uniqueid'],md5(_0x31f8d3[_0x9452('0x56')]));if(_0x3c0059&&_0x3c0059[_0x9452('0x57')]){logger[_0x9452('0x21')](_0x9452('0x58'),_0x9452('0x59'));_0x31f8d3['recordingURL']=_0x50216b;}else if(_0x4e68f0&&_0x4e68f0[_0x9452('0x5a')]&&_0x4e68f0[_0x9452('0x5a')]!==_0x9452('0x5b')){logger['info'](_0x9452('0x5c'),_0x9452('0x59'));_0x31f8d3[_0x9452('0x5d')]=_0x50216b;}else{_0x31f8d3[_0x9452('0x5d')]='';}return getUser(_0x4bf255,_0x2755e9,_0x32061f,_0x4bfc95,_0x6412b3,_0x5ee9a7)[_0x9452('0x10')](function(_0x58b200){logger[_0x9452('0x21')]('['+_0x5ee9a7[_0x9452('0x1d')]()+_0x9452('0x5e'),_0x58b200[_0x9452('0x1f')]);logger['info']('['+_0x5ee9a7['toUpperCase']()+_0x9452('0x5f'),_0x58b200['userEmail']);return getEndUser(_0x58b200,_0x2755e9,_0x4bfc95,_0x6412b3,_0x31f8d3,_0x5ee9a7,_0x7dc50a[_0x9452('0x60')],_0x7dc50a[_0x9452('0x61')]);})[_0x9452('0x10')](function(_0x13973b){logger[_0x9452('0x21')]('['+_0x5ee9a7[_0x9452('0x1d')]()+_0x9452('0x62'),_0x13973b[_0x9452('0x2d')]);logger[_0x9452('0x21')]('['+_0x5ee9a7[_0x9452('0x1d')]()+_0x9452('0x63'),_0x31f8d3['calleridnum']);return getTicket(_0x13973b,_0x2755e9,_0x4bfc95,_0x6412b3,_0x31f8d3,_0x7dc50a,_0x5ee9a7);})[_0x9452('0x10')](function(_0x1129f3){logger['info'](util[_0x9452('0x49')]('['+_0x5ee9a7[_0x9452('0x1d')]()+_0x9452('0x64'),_0x7dc50a['ticketType'],_0x1129f3['ticketId']));logger['info'](util[_0x9452('0x49')]('['+_0x5ee9a7[_0x9452('0x1d')]()+_0x9452('0x65'),_0x5ee9a7));if(_0x5ee9a7!=='unmanaged'&&_0x7dc50a['openNewTab']){logger['info']('['+_0x5ee9a7[_0x9452('0x1d')]()+']',_0x9452('0x66'));emit(_0x2755e9[_0x9452('0x8')],_0x32061f[_0x9452('0x67')],_0x7dc50a[_0x9452('0x43')],_0x1129f3[_0x9452('0x68')]);}})['catch'](function(_0x4e144f){logger[_0x9452('0x13')]('['+_0x5ee9a7[_0x9452('0x1d')]()+_0x9452('0x69'),_0x4e144f[_0x9452('0x14')]);console[_0x9452('0x13')](_0x9452('0x6a'),_0x4e144f);});}; \ 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 bd37b44..b174a2c 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 _0x103c=['find','contact','email','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Admin\x20account\x20selected.','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','%s/api/v2/contacts','Enduser\x20created.','Basic\x20%s','apiKey','toString','base64','[HTTP]','stringify','GET','map','includes','string','picklist','customField','content','type','push','idField','variableName','customVariable','Variable','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','The\x20User\x20ID\x20is:','The\x20Enduser\x20ID\x20is:','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','%s/helpdesk/tickets/%d','catch','outbound','recordingFormat','none','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','error','unmanaged','lastevent','toUpperCase','lodash','request-promise','md5','ioredis','../../../../config/logger','freshdesk','redis','defaults','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','format','Caller\x20-\x20%s','calleridname','calleridnum','getString','Subjects','Descriptions','
','Tags','name','custom_fields','keyBy','value','%s/api/v2/tickets','remoteUri','POST','%s/api/v2/agents','then','length'];(function(_0x1809c5,_0x46cabc){var _0x5254a4=function(_0xd1d319){while(--_0xd1d319){_0x1809c5['push'](_0x1809c5['shift']());}};_0x5254a4(++_0x46cabc);}(_0x103c,0xf0));var _0xc103=function(_0x176e40,_0x338904){_0x176e40=_0x176e40-0x0;var _0x4b2d13=_0x103c[_0x176e40];return _0x4b2d13;};'use strict';var _=require(_0xc103('0x0'));var rp=require(_0xc103('0x1'));var md5=require(_0xc103('0x2'));var util=require('util');var Redis=require(_0xc103('0x3'));var intUtil=require('./util');var config=require('../../../../config/environment');var logger=require(_0xc103('0x4'))(_0xc103('0x5'));config[_0xc103('0x6')]=_[_0xc103('0x7')](config[_0xc103('0x6')],{'host':_0xc103('0x8'),'port':0x18eb});var io=require(_0xc103('0x9'))(new Redis(config[_0xc103('0x6')]));var headers={'Content-Type':_0xc103('0xa'),'Accept':_0xc103('0xa')};function emit(_0xfefef8,_0x15cfac,_0x5342ae){io['to'](_0xfefef8)[_0xc103('0xb')](_0x15cfac,_0x5342ae);}function getTicket(_0x247c26,_0x3696bf,_0x4cee67,_0x3224c3,_0x263084){logger[_0xc103('0xc')](_0xc103('0xd'));var _0x50003e=_['merge']({'responder_id':_0x3696bf['id'],'requester_id':_0x4cee67['id'],'name':util[_0xc103('0xe')](_0xc103('0xf'),_0x263084[_0xc103('0x10')]),'phone':_0x263084[_0xc103('0x11')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil[_0xc103('0x12')](_0x3224c3[_0xc103('0x13')],_0x263084,'\x20'),'description':intUtil[_0xc103('0x12')](_0x3224c3[_0xc103('0x14')],_0x263084,_0xc103('0x15')),'tags':getTags(_0x3224c3[_0xc103('0x16')],_0xc103('0x17'))},getCustomFields(_0x3224c3['Fields'],_0x263084));_0x50003e[_0xc103('0x18')]=_['mapValues'](_[_0xc103('0x19')](_0x50003e[_0xc103('0x18')],'id'),_0xc103('0x1a'));return request({'uri':util['format'](_0xc103('0x1b'),_0x247c26[_0xc103('0x1c')]),'method':_0xc103('0x1d'),'body':_0x50003e})['then'](function(_0x4e17eb){logger[_0xc103('0xc')]('Ticket\x20created!');return _0x4e17eb;});}function getUser(_0x26ebd4,_0x30e9ed){if(intUtil['validateEmail'](_0x30e9ed)){return request({'uri':util['format'](_0xc103('0x1e'),_0x26ebd4[_0xc103('0x1c')]),'qs':{'email':_0x30e9ed}})[_0xc103('0x1f')](function(_0x3d4129){if(_0x3d4129[_0xc103('0x20')]){logger['info']('Agent\x20found!');return _[_0xc103('0x21')](_0x3d4129,function(_0x2689a9){return _0x2689a9[_0xc103('0x22')][_0xc103('0x23')]===_0x30e9ed;});}else{logger['info'](_0xc103('0x24'));return request({'uri':util[_0xc103('0xe')](_0xc103('0x25'),_0x26ebd4[_0xc103('0x1c')])})[_0xc103('0x1f')](function(_0x389798){logger[_0xc103('0xc')](_0xc103('0x26'));return _0x389798;});}});}else{logger[_0xc103('0xc')](_0xc103('0x27'));return request({'uri':util[_0xc103('0xe')]('%s/api/v2/agents/me',_0x26ebd4['remoteUri'])})['then'](function(_0x23aa75){logger['info'](_0xc103('0x26'));return _0x23aa75;});}}function getEndUser(_0x2c6959,_0x26493d,_0x25966b){logger[_0xc103('0xc')]('Searching\x20enduser\x20with\x20phone',_0x25966b);return request({'uri':util[_0xc103('0xe')]('%s/api/v2/contacts',_0x2c6959[_0xc103('0x1c')]),'qs':{'phone':_0x25966b}})[_0xc103('0x1f')](function(_0x36e220){if(_0x36e220['length']){logger[_0xc103('0xc')](_0xc103('0x28'));return _['find'](_0x36e220,{'phone':_0x25966b});}else{logger[_0xc103('0xc')](_0xc103('0x29'));return request({'uri':util['format'](_0xc103('0x2a'),_0x2c6959[_0xc103('0x1c')]),'method':_0xc103('0x1d'),'body':{'name':_0x26493d,'phone':_0x25966b}})['then'](function(_0x33bace){logger[_0xc103('0xc')](_0xc103('0x2b'));return _0x33bace;});}});}function getAuth(_0x33ec3a){return util[_0xc103('0xe')](_0xc103('0x2c'),new Buffer(_0x33ec3a[_0xc103('0x2d')]+':X')[_0xc103('0x2e')](_0xc103('0x2f')));}function request(_0x4153ec){logger['debug'](_0xc103('0x30'),JSON[_0xc103('0x31')](_0x4153ec));return rp(_['defaults'](_0x4153ec,{'method':_0xc103('0x32'),'headers':headers,'json':!![]}));}function getTags(_0x25ef1f,_0x479c07){var _0x58d1a3=[];if(_0x25ef1f&&_0x25ef1f[_0xc103('0x20')]>0x0){_0x58d1a3=_[_0xc103('0x33')](_0x25ef1f,_0x479c07);}return _0x58d1a3;}function getCustomFields(_0x1f43d0,_0x43d97c){var _0x979230=[];var _0x32898c={'custom_fields':[]};if(_0x1f43d0[_0xc103('0x20')]>0x0){_['forEach'](_0x1f43d0,function(_0x439cd4){if(_[_0xc103('0x34')]([_0xc103('0x35'),_0xc103('0x36')],_0x439cd4['type'])&&_0x439cd4['nameField']&&!_0x439cd4[_0xc103('0x37')]){_0x32898c[_0x439cd4['nameField']['toLowerCase']()]=_0x439cd4[_0xc103('0x38')][_0xc103('0x2e')]();}else if(_[_0xc103('0x34')]([_0xc103('0x35'),_0xc103('0x36')],_0x439cd4[_0xc103('0x39')])&&_0x439cd4['idField']&&_0x439cd4[_0xc103('0x37')]){_0x32898c['custom_fields'][_0xc103('0x3a')]({'id':_0x439cd4[_0xc103('0x3b')],'value':_0x439cd4[_0xc103('0x38')]['toString']()});}else if(_0x439cd4[_0xc103('0x39')]==='variable'&&_0x439cd4[_0xc103('0x3c')]&&_0x439cd4[_0xc103('0x3b')]&&_0x439cd4[_0xc103('0x37')]){_0x43d97c[_0x439cd4['variableName']]&&_0x32898c[_0xc103('0x18')][_0xc103('0x3a')]({'id':_0x439cd4[_0xc103('0x3b')],'value':_0x43d97c[_0x439cd4[_0xc103('0x3c')]]['toString']()});}else if(_0x439cd4[_0xc103('0x39')]===_0xc103('0x3d')&&_0x439cd4[_0xc103('0x3e')]&&_0x439cd4[_0xc103('0x3e')][_0xc103('0x17')]&&_0x439cd4[_0xc103('0x3b')]&&_0x439cd4[_0xc103('0x37')]){_0x43d97c[_0x439cd4[_0xc103('0x3e')][_0xc103('0x17')]['toLowerCase']()]&&_0x32898c[_0xc103('0x18')]['push']({'id':_0x439cd4[_0xc103('0x3b')],'value':_0x43d97c[_0x439cd4[_0xc103('0x3e')][_0xc103('0x17')]['toLowerCase']()][_0xc103('0x2e')]()});}});}return _0x32898c;}exports['queue']=function(_0x20f16f,_0x5556a4,_0x15f9a7,_0x5e1f6f,_0x18016b,_0x4e345c){var _0x40e1de,_0x13d496;_0x4e345c[_0xc103('0x1c')]=intUtil['stripTrailingSlash'](_0x4e345c[_0xc103('0x1c')]);_0x4e345c['serverUrl']=intUtil[_0xc103('0x3f')](_0x4e345c[_0xc103('0x40')]);if(_0x18016b&&_0x18016b[_0xc103('0x41')]){logger[_0xc103('0xc')](_0xc103('0x42'),_0xc103('0x43'));_0x5556a4[_0xc103('0x44')]=util[_0xc103('0xe')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4e345c[_0xc103('0x40')],_0x5556a4[_0xc103('0x45')],md5(_0x5556a4[_0xc103('0x45')]));}else{_0x5556a4[_0xc103('0x44')]='';}headers[_0xc103('0x46')]=getAuth(_0x4e345c);return getUser(_0x4e345c,_0x5e1f6f[_0xc103('0x23')])[_0xc103('0x1f')](function(_0x1d622c){_0x40e1de=_0x1d622c;logger[_0xc103('0xc')](_0xc103('0x47'),_0x40e1de['id']);return getEndUser(_0x4e345c,_0x5556a4[_0xc103('0x10')],_0x5556a4[_0xc103('0x11')]);})[_0xc103('0x1f')](function(_0xbbcf72){_0x13d496=_0xbbcf72;logger[_0xc103('0xc')](_0xc103('0x48'),_0x13d496['id']);return getTicket(_0x4e345c,_0x40e1de,_0x13d496,_0x15f9a7,_0x5556a4);})['then'](function(_0x45f51e){if(_0x45f51e&&_0x45f51e['id']){logger[_0xc103('0xc')](_0xc103('0x49'));logger[_0xc103('0xc')](_0xc103('0x4a'),_0x45f51e['id']);logger['info'](_0xc103('0x42'),_0xc103('0x4b'));emit(util['format'](_0xc103('0x4c'),_0x5e1f6f[_0xc103('0x17')]),_0xc103('0x4d'),{'uri':util[_0xc103('0xe')](_0xc103('0x4e'),_0x4e345c[_0xc103('0x1c')],_0x45f51e['id'])});}})[_0xc103('0x4f')](function(_0xe87fc1){logger['error'](_0xc103('0x42'),JSON['stringify'](_0xe87fc1));});};exports[_0xc103('0x50')]=function(_0x4c97f1,_0x58a026,_0x123f14,_0x4e0211,_0x3f8cf2,_0x2e1ac7,_0xa7be86){var _0x38d6ef,_0x5a7cdc;_0x2e1ac7[_0xc103('0x1c')]=intUtil[_0xc103('0x3f')](_0x2e1ac7['remoteUri']);_0x2e1ac7['serverUrl']=intUtil[_0xc103('0x3f')](_0x2e1ac7[_0xc103('0x40')]);if(_0xa7be86&&_0xa7be86['recordingFormat']&&_0xa7be86[_0xc103('0x51')]!==_0xc103('0x52')){logger['info'](_0xc103('0x53'),_0xc103('0x43'));_0x58a026[_0xc103('0x44')]=util[_0xc103('0xe')](_0xc103('0x54'),_0x2e1ac7[_0xc103('0x40')],_0x58a026[_0xc103('0x45')],md5(_0x58a026[_0xc103('0x45')]));}headers['Authorization']=getAuth(_0x2e1ac7);return getUser(_0x2e1ac7,_0x4e0211[_0xc103('0x23')])[_0xc103('0x1f')](function(_0x4d23ca){_0x38d6ef=_0x4d23ca;logger[_0xc103('0xc')](_0xc103('0x47'),_0x38d6ef['id']);return getEndUser(_0x2e1ac7,_0x58a026[_0xc103('0x55')],_0x58a026[_0xc103('0x56')]);})['then'](function(_0xb90045){_0x5a7cdc=_0xb90045;logger[_0xc103('0xc')](_0xc103('0x48'),_0x5a7cdc['id']);return getTicket(_0x2e1ac7,_0x38d6ef,_0x5a7cdc,_0x123f14,_0x58a026);})[_0xc103('0x1f')](function(_0x23b772){if(_0x23b772&&_0x23b772['id']){logger[_0xc103('0xc')](_0xc103('0x49'));logger[_0xc103('0xc')](_0xc103('0x4a'),_0x23b772['id']);logger['info']('[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0xc103('0xe')](_0xc103('0x4c'),_0x4e0211[_0xc103('0x17')]),_0xc103('0x4d'),{'uri':util[_0xc103('0xe')](_0xc103('0x4e'),_0x2e1ac7[_0xc103('0x1c')],_0x23b772['id'])});}})[_0xc103('0x4f')](function(_0x2394ce){logger[_0xc103('0x57')](_0xc103('0x53'),JSON[_0xc103('0x31')](_0x2394ce));});};exports[_0xc103('0x58')]=function(_0x354d03,_0x590672,_0xddf51c,_0x2ff2c1,_0x489b26,_0x3e3960){var _0xb684f1,_0x211cfb;_0x3e3960[_0xc103('0x1c')]=intUtil['stripTrailingSlash'](_0x3e3960[_0xc103('0x1c')]);_0x3e3960['serverUrl']=intUtil['stripTrailingSlash'](_0x3e3960['serverUrl']);if(_0x489b26&&_0x489b26[_0xc103('0x41')]){logger[_0xc103('0xc')]('['+_0x590672[_0xc103('0x59')][_0xc103('0x5a')]()+']',_0xc103('0x43'));_0x590672[_0xc103('0x44')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x3e3960[_0xc103('0x40')],_0x590672[_0xc103('0x45')],md5(_0x590672[_0xc103('0x45')]));}else{_0x590672[_0xc103('0x44')]='';}headers['Authorization']=getAuth(_0x3e3960);return getUser(_0x3e3960,'')[_0xc103('0x1f')](function(_0xd5ae99){_0xb684f1=_0xd5ae99;logger['info'](_0xc103('0x47'),_0xb684f1['id']);return getEndUser(_0x3e3960,_0x590672[_0xc103('0x10')],_0x590672[_0xc103('0x11')]);})[_0xc103('0x1f')](function(_0x315ec9){_0x211cfb=_0x315ec9;logger[_0xc103('0xc')](_0xc103('0x48'),_0x211cfb['id']);return getTicket(_0x3e3960,_0xb684f1,_0x211cfb,_0xddf51c,_0x590672);})['then'](function(_0x1e4c65){if(_0x1e4c65){logger[_0xc103('0xc')](_0xc103('0x49'));logger[_0xc103('0xc')](_0xc103('0x4a'),_0x1e4c65['id']);}})[_0xc103('0x4f')](function(_0x34504c){logger[_0xc103('0x57')]('['+_0x590672[_0xc103('0x59')][_0xc103('0x5a')]()+']',JSON[_0xc103('0x31')](_0x34504c));});}; \ No newline at end of file +var _0xe366=['serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','Authorization','email','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','catch','error','stringify','outbound','recordingFormat','[OUTBOUND]','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','user:%s','lastevent','toUpperCase','lodash','request-promise','ioredis','./util','../../../../config/environment','freshdesk','redis','localhost','socket.io-emitter','application/json','emit','info','Creating\x20new\x20ticket...','merge','calleridname','calleridnum','getString','Descriptions','name','Fields','custom_fields','mapValues','value','remoteUri','POST','then','Ticket\x20created!','validateEmail','format','%s/api/v2/agents','length','Agent\x20found!','find','contact','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/api/v2/agents/me','Invalid\x20email\x20format,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','%s/api/v2/contacts','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Enduser\x20created.','Basic\x20%s','toString','base64','debug','defaults','map','includes','string','picklist','customField','nameField','toLowerCase','content','type','idField','variable','variableName','push','customVariable','Variable','queue','stripTrailingSlash'];(function(_0x4ca6ab,_0x29bc6c){var _0x516678=function(_0x108d0e){while(--_0x108d0e){_0x4ca6ab['push'](_0x4ca6ab['shift']());}};_0x516678(++_0x29bc6c);}(_0xe366,0x120));var _0x6e36=function(_0x134c2e,_0x3573c4){_0x134c2e=_0x134c2e-0x0;var _0x2825db=_0xe366[_0x134c2e];return _0x2825db;};'use strict';var _=require(_0x6e36('0x0'));var rp=require(_0x6e36('0x1'));var md5=require('md5');var util=require('util');var Redis=require(_0x6e36('0x2'));var intUtil=require(_0x6e36('0x3'));var config=require(_0x6e36('0x4'));var logger=require('../../../../config/logger')(_0x6e36('0x5'));config[_0x6e36('0x6')]=_['defaults'](config['redis'],{'host':_0x6e36('0x7'),'port':0x18eb});var io=require(_0x6e36('0x8'))(new Redis(config[_0x6e36('0x6')]));var headers={'Content-Type':_0x6e36('0x9'),'Accept':_0x6e36('0x9')};function emit(_0xecb6b8,_0x5a2dca,_0x699a72){io['to'](_0xecb6b8)[_0x6e36('0xa')](_0x5a2dca,_0x699a72);}function getTicket(_0x39864b,_0x4a44bf,_0x2ea9c2,_0x520ef6,_0x584dff){logger[_0x6e36('0xb')](_0x6e36('0xc'));var _0x14cd03=_[_0x6e36('0xd')]({'responder_id':_0x4a44bf['id'],'requester_id':_0x2ea9c2['id'],'name':util['format']('Caller\x20-\x20%s',_0x584dff[_0x6e36('0xe')]),'phone':_0x584dff[_0x6e36('0xf')],'source':0x3,'priority':0x1,'status':0x2,'subject':intUtil['getString'](_0x520ef6['Subjects'],_0x584dff,'\x20'),'description':intUtil[_0x6e36('0x10')](_0x520ef6[_0x6e36('0x11')],_0x584dff,'
'),'tags':getTags(_0x520ef6['Tags'],_0x6e36('0x12'))},getCustomFields(_0x520ef6[_0x6e36('0x13')],_0x584dff));_0x14cd03[_0x6e36('0x14')]=_[_0x6e36('0x15')](_['keyBy'](_0x14cd03[_0x6e36('0x14')],'id'),_0x6e36('0x16'));return request({'uri':util['format']('%s/api/v2/tickets',_0x39864b[_0x6e36('0x17')]),'method':_0x6e36('0x18'),'body':_0x14cd03})[_0x6e36('0x19')](function(_0x819202){logger['info'](_0x6e36('0x1a'));return _0x819202;});}function getUser(_0x1076ae,_0x40e013){if(intUtil[_0x6e36('0x1b')](_0x40e013)){return request({'uri':util[_0x6e36('0x1c')](_0x6e36('0x1d'),_0x1076ae[_0x6e36('0x17')]),'qs':{'email':_0x40e013}})[_0x6e36('0x19')](function(_0x2bab64){if(_0x2bab64[_0x6e36('0x1e')]){logger[_0x6e36('0xb')](_0x6e36('0x1f'));return _[_0x6e36('0x20')](_0x2bab64,function(_0x58cb29){return _0x58cb29[_0x6e36('0x21')]['email']===_0x40e013;});}else{logger[_0x6e36('0xb')](_0x6e36('0x22'));return request({'uri':util[_0x6e36('0x1c')](_0x6e36('0x23'),_0x1076ae[_0x6e36('0x17')])})[_0x6e36('0x19')](function(_0x5f00a2){logger['info']('Admin\x20account\x20selected.');return _0x5f00a2;});}});}else{logger[_0x6e36('0xb')](_0x6e36('0x24'));return request({'uri':util['format'](_0x6e36('0x23'),_0x1076ae[_0x6e36('0x17')])})['then'](function(_0xb9f502){logger['info'](_0x6e36('0x25'));return _0xb9f502;});}}function getEndUser(_0x299403,_0x53fab2,_0x4d220f){logger[_0x6e36('0xb')]('Searching\x20enduser\x20with\x20phone',_0x4d220f);return request({'uri':util[_0x6e36('0x1c')](_0x6e36('0x26'),_0x299403['remoteUri']),'qs':{'phone':_0x4d220f}})[_0x6e36('0x19')](function(_0x94cd79){if(_0x94cd79[_0x6e36('0x1e')]){logger[_0x6e36('0xb')](_0x6e36('0x27'));return _['find'](_0x94cd79,{'phone':_0x4d220f});}else{logger[_0x6e36('0xb')](_0x6e36('0x28'));return request({'uri':util['format'](_0x6e36('0x26'),_0x299403[_0x6e36('0x17')]),'method':'POST','body':{'name':_0x53fab2,'phone':_0x4d220f}})[_0x6e36('0x19')](function(_0x4fc8c6){logger['info'](_0x6e36('0x29'));return _0x4fc8c6;});}});}function getAuth(_0x5837a0){return util['format'](_0x6e36('0x2a'),new Buffer(_0x5837a0['apiKey']+':X')[_0x6e36('0x2b')](_0x6e36('0x2c')));}function request(_0xc00d85){logger[_0x6e36('0x2d')]('[HTTP]',JSON['stringify'](_0xc00d85));return rp(_[_0x6e36('0x2e')](_0xc00d85,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x2af94a,_0x357cdf){var _0x1b1741=[];if(_0x2af94a&&_0x2af94a[_0x6e36('0x1e')]>0x0){_0x1b1741=_[_0x6e36('0x2f')](_0x2af94a,_0x357cdf);}return _0x1b1741;}function getCustomFields(_0x4b96c3,_0x1e5c4d){var _0x4e9f10=[];var _0xc5b3ac={'custom_fields':[]};if(_0x4b96c3['length']>0x0){_['forEach'](_0x4b96c3,function(_0x2065e7){if(_[_0x6e36('0x30')]([_0x6e36('0x31'),_0x6e36('0x32')],_0x2065e7['type'])&&_0x2065e7['nameField']&&!_0x2065e7[_0x6e36('0x33')]){_0xc5b3ac[_0x2065e7[_0x6e36('0x34')][_0x6e36('0x35')]()]=_0x2065e7[_0x6e36('0x36')]['toString']();}else if(_['includes']([_0x6e36('0x31'),'picklist'],_0x2065e7[_0x6e36('0x37')])&&_0x2065e7[_0x6e36('0x38')]&&_0x2065e7[_0x6e36('0x33')]){_0xc5b3ac[_0x6e36('0x14')]['push']({'id':_0x2065e7[_0x6e36('0x38')],'value':_0x2065e7[_0x6e36('0x36')][_0x6e36('0x2b')]()});}else if(_0x2065e7[_0x6e36('0x37')]===_0x6e36('0x39')&&_0x2065e7[_0x6e36('0x3a')]&&_0x2065e7[_0x6e36('0x38')]&&_0x2065e7[_0x6e36('0x33')]){_0x1e5c4d[_0x2065e7[_0x6e36('0x3a')]]&&_0xc5b3ac[_0x6e36('0x14')][_0x6e36('0x3b')]({'id':_0x2065e7['idField'],'value':_0x1e5c4d[_0x2065e7[_0x6e36('0x3a')]][_0x6e36('0x2b')]()});}else if(_0x2065e7[_0x6e36('0x37')]===_0x6e36('0x3c')&&_0x2065e7[_0x6e36('0x3d')]&&_0x2065e7[_0x6e36('0x3d')][_0x6e36('0x12')]&&_0x2065e7[_0x6e36('0x38')]&&_0x2065e7[_0x6e36('0x33')]){_0x1e5c4d[_0x2065e7[_0x6e36('0x3d')][_0x6e36('0x12')][_0x6e36('0x35')]()]&&_0xc5b3ac[_0x6e36('0x14')]['push']({'id':_0x2065e7['idField'],'value':_0x1e5c4d[_0x2065e7[_0x6e36('0x3d')][_0x6e36('0x12')][_0x6e36('0x35')]()][_0x6e36('0x2b')]()});}});}return _0xc5b3ac;}exports[_0x6e36('0x3e')]=function(_0x3b7c9b,_0x955a8,_0x460403,_0x166ae4,_0x279fb0,_0x46bc11){var _0x170825,_0x1ea677;_0x46bc11[_0x6e36('0x17')]=intUtil[_0x6e36('0x3f')](_0x46bc11[_0x6e36('0x17')]);_0x46bc11[_0x6e36('0x40')]=intUtil['stripTrailingSlash'](_0x46bc11[_0x6e36('0x40')]);if(_0x279fb0&&_0x279fb0[_0x6e36('0x41')]){logger[_0x6e36('0xb')](_0x6e36('0x42'),_0x6e36('0x43'));_0x955a8[_0x6e36('0x44')]=util[_0x6e36('0x1c')](_0x6e36('0x45'),_0x46bc11[_0x6e36('0x40')],_0x955a8[_0x6e36('0x46')],md5(_0x955a8[_0x6e36('0x46')]));}else{_0x955a8[_0x6e36('0x44')]='';}headers[_0x6e36('0x47')]=getAuth(_0x46bc11);return getUser(_0x46bc11,_0x166ae4[_0x6e36('0x48')])[_0x6e36('0x19')](function(_0x22d5a4){_0x170825=_0x22d5a4;logger[_0x6e36('0xb')]('The\x20User\x20ID\x20is:',_0x170825['id']);return getEndUser(_0x46bc11,_0x955a8[_0x6e36('0xe')],_0x955a8['calleridnum']);})[_0x6e36('0x19')](function(_0x377bc8){_0x1ea677=_0x377bc8;logger[_0x6e36('0xb')](_0x6e36('0x49'),_0x1ea677['id']);return getTicket(_0x46bc11,_0x170825,_0x1ea677,_0x460403,_0x955a8);})['then'](function(_0x2ee23a){if(_0x2ee23a&&_0x2ee23a['id']){logger[_0x6e36('0xb')](_0x6e36('0x1a'));logger[_0x6e36('0xb')]('The\x20Ticket\x20ID\x20is:',_0x2ee23a['id']);logger[_0x6e36('0xb')](_0x6e36('0x42'),_0x6e36('0x4a'));emit(util['format']('user:%s',_0x166ae4[_0x6e36('0x12')]),_0x6e36('0x4b'),{'uri':util[_0x6e36('0x1c')]('%s/helpdesk/tickets/%d',_0x46bc11[_0x6e36('0x17')],_0x2ee23a['id'])});}})[_0x6e36('0x4c')](function(_0xa10790){logger[_0x6e36('0x4d')](_0x6e36('0x42'),JSON[_0x6e36('0x4e')](_0xa10790));});};exports[_0x6e36('0x4f')]=function(_0x449d4a,_0x5e6082,_0x2827de,_0x2255a3,_0x491611,_0x1d0a3d,_0x9faea6){var _0x494a51,_0x522bbb;_0x1d0a3d[_0x6e36('0x17')]=intUtil['stripTrailingSlash'](_0x1d0a3d['remoteUri']);_0x1d0a3d[_0x6e36('0x40')]=intUtil[_0x6e36('0x3f')](_0x1d0a3d[_0x6e36('0x40')]);if(_0x9faea6&&_0x9faea6[_0x6e36('0x50')]&&_0x9faea6['recordingFormat']!=='none'){logger[_0x6e36('0xb')](_0x6e36('0x51'),_0x6e36('0x43'));_0x5e6082[_0x6e36('0x44')]=util[_0x6e36('0x1c')](_0x6e36('0x45'),_0x1d0a3d[_0x6e36('0x40')],_0x5e6082['uniqueid'],md5(_0x5e6082[_0x6e36('0x46')]));}headers[_0x6e36('0x47')]=getAuth(_0x1d0a3d);return getUser(_0x1d0a3d,_0x2255a3[_0x6e36('0x48')])[_0x6e36('0x19')](function(_0x16f37a){_0x494a51=_0x16f37a;logger['info'](_0x6e36('0x52'),_0x494a51['id']);return getEndUser(_0x1d0a3d,_0x5e6082[_0x6e36('0x53')],_0x5e6082[_0x6e36('0x54')]);})[_0x6e36('0x19')](function(_0x1ce1ad){_0x522bbb=_0x1ce1ad;logger[_0x6e36('0xb')](_0x6e36('0x49'),_0x522bbb['id']);return getTicket(_0x1d0a3d,_0x494a51,_0x522bbb,_0x2827de,_0x5e6082);})['then'](function(_0x52c087){if(_0x52c087&&_0x52c087['id']){logger[_0x6e36('0xb')](_0x6e36('0x1a'));logger[_0x6e36('0xb')]('The\x20Ticket\x20ID\x20is:',_0x52c087['id']);logger[_0x6e36('0xb')](_0x6e36('0x51'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x6e36('0x55'),_0x2255a3['name']),_0x6e36('0x4b'),{'uri':util['format']('%s/helpdesk/tickets/%d',_0x1d0a3d['remoteUri'],_0x52c087['id'])});}})[_0x6e36('0x4c')](function(_0xe546a8){logger[_0x6e36('0x4d')](_0x6e36('0x51'),JSON[_0x6e36('0x4e')](_0xe546a8));});};exports['unmanaged']=function(_0x5ab87f,_0x332f42,_0x8c3426,_0x16e6cf,_0x21a987,_0x2217e9){var _0x1bb44d,_0x5ef608;_0x2217e9[_0x6e36('0x17')]=intUtil['stripTrailingSlash'](_0x2217e9[_0x6e36('0x17')]);_0x2217e9['serverUrl']=intUtil[_0x6e36('0x3f')](_0x2217e9[_0x6e36('0x40')]);if(_0x21a987&&_0x21a987[_0x6e36('0x41')]){logger['info']('['+_0x332f42[_0x6e36('0x56')][_0x6e36('0x57')]()+']','Recording\x20is\x20enabled!');_0x332f42[_0x6e36('0x44')]=util[_0x6e36('0x1c')](_0x6e36('0x45'),_0x2217e9[_0x6e36('0x40')],_0x332f42[_0x6e36('0x46')],md5(_0x332f42[_0x6e36('0x46')]));}else{_0x332f42[_0x6e36('0x44')]='';}headers[_0x6e36('0x47')]=getAuth(_0x2217e9);return getUser(_0x2217e9,'')[_0x6e36('0x19')](function(_0x459fe2){_0x1bb44d=_0x459fe2;logger[_0x6e36('0xb')](_0x6e36('0x52'),_0x1bb44d['id']);return getEndUser(_0x2217e9,_0x332f42[_0x6e36('0xe')],_0x332f42[_0x6e36('0xf')]);})['then'](function(_0x191715){_0x5ef608=_0x191715;logger[_0x6e36('0xb')](_0x6e36('0x49'),_0x5ef608['id']);return getTicket(_0x2217e9,_0x1bb44d,_0x5ef608,_0x8c3426,_0x332f42);})['then'](function(_0x50dc07){if(_0x50dc07){logger[_0x6e36('0xb')](_0x6e36('0x1a'));logger[_0x6e36('0xb')]('The\x20Ticket\x20ID\x20is:',_0x50dc07['id']);}})[_0x6e36('0x4c')](function(_0x5dc4fb){logger['error']('['+_0x332f42['lastevent']['toUpperCase']()+']',JSON[_0x6e36('0x4e')](_0x5dc4fb));});}; \ 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 3e62d6c..be89ebc 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 _0x0c28=['getString','Subjects','Descriptions','Contact','add','YYYY-MM-DDTHH:mm:ss','ticketId','task','/contacts/','emit','Token\x20token=','apiKey','remoteUri','serverUrl','username','toLowerCase','outbound','destcalleridnum','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...',']\x20Error\x20running\x20Freshsales\x20integration','inspect','lodash','request-promise','util','moment','bluebird','ioredis','./util','../../../../config/environment','../../../../config/logger','freshsales','redis','defaults','localhost','socket.io-emitter','GET','info','Getting\x20admin\x20information','then','users','email','adminEmail','adminId','Admin\x20found:','Requested\x20Resource\x20not\x20Found','error','message','/api/selector/owners','headers','Getting\x20user\x20list','agentEmail','Getting\x20user\x20with\x20email','length','userId','User\x20found:','Admin\x20selected','userEmail','catch','toUpperCase','&f=','find','format','contactNumber','Contact\x20found\x20mobile_number:','endUserId','Contact\x20found\x20work_number:','Contact\x20created:','POST','/api/contacts','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task'];(function(_0x2d1cf4,_0x2ea9ee){var _0x554a7c=function(_0x55cc39){while(--_0x55cc39){_0x2d1cf4['push'](_0x2d1cf4['shift']());}};_0x554a7c(++_0x2ea9ee);}(_0x0c28,0xc0));var _0x80c2=function(_0x200d53,_0x621288){_0x200d53=_0x200d53-0x0;var _0x37c2a6=_0x0c28[_0x200d53];return _0x37c2a6;};'use strict';var _=require(_0x80c2('0x0'));var rp=require(_0x80c2('0x1'));var md5=require('md5');var util=require(_0x80c2('0x2'));var moment=require(_0x80c2('0x3'));var Promise=require(_0x80c2('0x4'));var Redis=require(_0x80c2('0x5'));var intUtil=require(_0x80c2('0x6'));var config=require(_0x80c2('0x7'));var logger=require(_0x80c2('0x8'))(_0x80c2('0x9'));config[_0x80c2('0xa')]=_[_0x80c2('0xb')](config[_0x80c2('0xa')],{'host':_0x80c2('0xc'),'port':0x18eb});var io=require(_0x80c2('0xd'))(new Redis(config['redis']));function getAdminId(_0x22f21a,_0x29ff11,_0x3b9d3c,_0x2af11f){return new Promise(function(_0x33120b,_0x4d010a){var _0xaddf87=![];var _0x5db294={'method':_0x80c2('0xe'),'uri':_0x2af11f+'/api/selector/owners','json':!![]};_0x5db294['headers']=_0x3b9d3c;logger[_0x80c2('0xf')](_0x80c2('0x10'));return rp(_0x5db294)[_0x80c2('0x11')](function(_0x249431){if(_0x249431){var _0x52837e=_0x249431[_0x80c2('0x12')];var _0xe2dc2f=null;for(_0xe2dc2f=0x0;_0xe2dc2f<_0x52837e['length'];_0xe2dc2f++){if(_0x52837e[_0xe2dc2f][_0x80c2('0x13')]===_0x22f21a[_0x80c2('0x14')]){_0x22f21a[_0x80c2('0x15')]=_0x52837e[_0xe2dc2f]['id'];_0xaddf87=!![];}}if(_0xaddf87){logger['info'](_0x80c2('0x16'),_0x22f21a['adminId']);_0x33120b(_0x22f21a);}else{_0x4d010a({'statusCode':0x194,'message':_0x80c2('0x17')});}}else{_0x4d010a({'statusCode':0x194,'message':_0x80c2('0x17')});}})['catch'](function(_0x12265b){logger[_0x80c2('0x18')]('['+[_0x29ff11['toUpperCase']()]+']',_0x12265b[_0x80c2('0x19')]);_0x4d010a(_0x12265b);});});}function getUser(_0x13a850,_0x5ae79d,_0x499c09){return function(_0x433a01){return new Promise(function(_0x229476,_0x44b101){var _0x16c81c={'method':_0x80c2('0xe'),'uri':_0x499c09+_0x80c2('0x1a'),'json':!![]};_0x16c81c[_0x80c2('0x1b')]=_0x5ae79d;logger[_0x80c2('0xf')](_0x80c2('0x1c'));return rp(_0x16c81c)['then'](function(_0x28041c){if(_0x28041c){var _0x3fb834=_0x28041c[_0x80c2('0x12')];var _0x41257c=![];var _0x165167=null;if(_0x433a01[_0x80c2('0x1d')]!==null){logger['info'](_0x80c2('0x1e'),_0x433a01[_0x80c2('0x1d')]);_0x433a01['userEmail']=_0x433a01[_0x80c2('0x1d')];for(_0x165167=0x0;_0x165167<_0x3fb834[_0x80c2('0x1f')];_0x165167++){if(_0x3fb834[_0x165167][_0x80c2('0x13')]===_0x433a01[_0x80c2('0x1d')]){_0x41257c=!![];_0x433a01[_0x80c2('0x20')]=_0x3fb834[_0x165167]['id'];logger['info'](_0x80c2('0x21'),_0x433a01['userId']);}}}if(!_0x41257c){logger[_0x80c2('0xf')](_0x80c2('0x22'));_0x433a01[_0x80c2('0x23')]=_0x433a01['adminEmail'];_0x433a01[_0x80c2('0x20')]=_0x433a01[_0x80c2('0x15')];_0x41257c=!![];}if(_0x41257c){_0x229476(_0x433a01);}else{_0x44b101({'statusCode':0x194,'message':_0x80c2('0x17')});}}else{_0x44b101({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}})[_0x80c2('0x24')](function(_0x5589c4){logger['error']('['+[_0x13a850[_0x80c2('0x25')]()]+']',_0x5589c4['message']);_0x44b101(_0x5589c4);});});};}function searchContact(_0x501671,_0x2a9a89,_0x20b18,_0x56aeb8){return new Promise(function(_0x258037,_0x4f8cce){var _0x4acb18={'method':'GET','headers':_0x2a9a89,'uri':_0x501671+'/api/lookup?q='+_0x56aeb8+_0x80c2('0x26')+_0x20b18+'&entities=contact','json':!![]};rp(_0x4acb18)[_0x80c2('0x11')](function(_0x1f3f8c){var _0x563043=_[_0x80c2('0x27')](_0x1f3f8c['contacts']['contacts'],[_0x20b18,_0x56aeb8]);_0x258037(_0x563043);})[_0x80c2('0x24')](function(_0x39ae46){_0x4f8cce(_0x39ae46);});});}function getEndUser(_0x540166,_0x3e1584,_0xd95072){return function(_0x29d689){return new Promise(function(_0x1e33b3,_0x4bd3b0){logger[_0x80c2('0xf')](util[_0x80c2('0x28')]('Searching\x20contact\x20with\x20phone\x20%s',_0x29d689[_0x80c2('0x29')]));searchContact(_0xd95072,_0x3e1584,'mobile_number',_0x29d689[_0x80c2('0x29')])[_0x80c2('0x11')](function(_0x21ac34){if(_0x21ac34){_0x29d689['endUserId']=_0x21ac34['id'];logger[_0x80c2('0xf')](_0x80c2('0x2a'),_0x29d689[_0x80c2('0x2b')]);return _0x1e33b3(_0x29d689);}searchContact(_0xd95072,_0x3e1584,'work_number',_0x29d689['contactNumber'])[_0x80c2('0x11')](function(_0x1bfeb9){if(_0x1bfeb9){_0x29d689[_0x80c2('0x2b')]=_0x1bfeb9['id'];logger[_0x80c2('0xf')](_0x80c2('0x2c'),_0x29d689[_0x80c2('0x2b')]);return _0x1e33b3(_0x29d689);}createEndUser(_0x29d689,_0x540166,_0x3e1584,_0xd95072)[_0x80c2('0x11')](function(_0x97d7b){logger['info'](_0x80c2('0x2d'),_0x97d7b[_0x80c2('0x2b')]);return _0x1e33b3(_0x97d7b);});});})[_0x80c2('0x24')](function(_0x3e360c){_0x4bd3b0(_0x3e360c);});});};}function createEndUser(_0x45e9b8,_0x33e0e8,_0x4fd356,_0x49b28b){return new Promise(function(_0x5d6c95,_0x46f980){var _0x3cba80=moment();var _0x5d812c={'method':_0x80c2('0x2e'),'uri':_0x49b28b+_0x80c2('0x2f'),'body':{'contact':{'last_name':_0x45e9b8[_0x80c2('0x29')],'work_number':_0x45e9b8['contactNumber'],'mobile_number':_0x45e9b8[_0x80c2('0x29')],'owner_id':_0x45e9b8[_0x80c2('0x20')],'created_at':_0x3cba80['format']('YYYY-MM-DDTHH:mm:ss')}},'json':!![]};_0x5d812c[_0x80c2('0x1b')]=_0x4fd356;logger[_0x80c2('0xf')](_0x80c2('0x30'));return rp(_0x5d812c)[_0x80c2('0x11')](function(_0x279006){_0x45e9b8[_0x80c2('0x2b')]=_0x279006[_0x80c2('0x31')]['id'];_0x5d6c95(_0x45e9b8);})[_0x80c2('0x24')](function(_0x272e22){logger['error']('['+[_0x33e0e8[_0x80c2('0x25')]()]+']',_0x272e22['message']);_0x46f980(_0x272e22[_0x80c2('0x19')]);});});}function getTicket(_0x55c560,_0x595edb,_0x242585,_0x209e09,_0x1de019){return function(_0x414cea){logger[_0x80c2('0xf')](_0x80c2('0x32'));return new Promise(function(_0x12e4c1,_0x228ee8){var _0x558277=moment();var _0x2f4143={'method':'POST','uri':_0x242585+'/api/tasks','body':{'title':intUtil[_0x80c2('0x33')](_0x209e09[_0x80c2('0x34')],_0x1de019,'\x20'),'description':intUtil[_0x80c2('0x33')](_0x209e09[_0x80c2('0x35')],_0x1de019,'\x0a'),'owner_id':_0x414cea[_0x80c2('0x20')],'creater_id':_0x414cea[_0x80c2('0x15')],'targetable_id':_0x414cea['endUserId'],'targetable_type':_0x80c2('0x36'),'created_at':_0x558277[_0x80c2('0x28')]('YYYY-MM-DDTHH:mm:ss'),'due_date':_0x558277[_0x80c2('0x37')](0x1e,'m')[_0x80c2('0x28')](_0x80c2('0x38'))},'json':!![]};_0x2f4143[_0x80c2('0x1b')]=_0x595edb;return rp(_0x2f4143)['then'](function(_0x22174e){_0x414cea[_0x80c2('0x39')]=_0x22174e[_0x80c2('0x3a')]['id'];logger[_0x80c2('0xf')]('Task\x20created:',_0x414cea[_0x80c2('0x39')]);_0x12e4c1(_0x414cea);})[_0x80c2('0x24')](function(_0x5480cd){logger[_0x80c2('0x18')]('['+[_0x55c560[_0x80c2('0x25')]()]+']',_0x5480cd[_0x80c2('0x19')]);_0x228ee8(_0x5480cd['message']);});});};}function emit(_0x510496,_0x4c8f60,_0x1e956e){var _0x763acb={'uri':_0x510496+_0x80c2('0x3b')+_0x1e956e};io['to'](util[_0x80c2('0x28')]('user:%s',_0x4c8f60))[_0x80c2('0x3c')]('trigger:browser:url',_0x763acb);}exports['cs']=function(_0x54181f,_0x16b608,_0x35dea3,_0x279fc5,_0x2bde8f,_0x3fc803,_0x2d1d2c,_0x339d17){var _0x34bfab={};var _0x24a47d={'Authorization':_0x80c2('0x3d')+_0x3fc803[_0x80c2('0x3e')]};_0x3fc803[_0x80c2('0x3f')]=intUtil['stripTrailingSlash'](_0x3fc803['remoteUri']);_0x3fc803[_0x80c2('0x40')]=intUtil['stripTrailingSlash'](_0x3fc803[_0x80c2('0x40')]);var _0x16bdc0=_0x3fc803[_0x80c2('0x3f')];_0x34bfab[_0x80c2('0x14')]=_0x3fc803[_0x80c2('0x41')];_0x34bfab[_0x80c2('0x29')]=_0x339d17[_0x80c2('0x42')]()===_0x80c2('0x43')?_0x16b608[_0x80c2('0x44')]:_0x16b608['calleridnum'];_0x34bfab['callDirection']=_0x339d17===_0x80c2('0x45')||_0x339d17==='unmanaged'?_0x80c2('0x45'):_0x80c2('0x43');if(_0x279fc5){_0x34bfab[_0x80c2('0x1d')]=_0x279fc5[_0x80c2('0x13')];}var _0x3e18eb=util[_0x80c2('0x28')](_0x80c2('0x46'),_0x3fc803[_0x80c2('0x40')],_0x16b608[_0x80c2('0x47')],md5(_0x16b608[_0x80c2('0x47')]));if(_0x2bde8f&&_0x2bde8f['monitor_format']){logger[_0x80c2('0xf')](_0x80c2('0x48'),_0x80c2('0x49'));_0x16b608['recordingURL']=_0x3e18eb;}else if(_0x2d1d2c&&_0x2d1d2c[_0x80c2('0x4a')]&&_0x2d1d2c[_0x80c2('0x4a')]!=='none'){logger['info']('[OUTBOUND]',_0x80c2('0x49'));_0x16b608[_0x80c2('0x4b')]=_0x3e18eb;}else{_0x16b608['recordingURL']='';}return getAdminId(_0x34bfab,_0x339d17,_0x24a47d,_0x16bdc0)['then'](getUser(_0x339d17,_0x24a47d,_0x16bdc0))[_0x80c2('0x11')](getEndUser(_0x339d17,_0x24a47d,_0x16bdc0))[_0x80c2('0x11')](getTicket(_0x339d17,_0x24a47d,_0x16bdc0,_0x35dea3,_0x16b608))[_0x80c2('0x11')](function(_0x51b8ce){logger[_0x80c2('0xf')](util[_0x80c2('0x28')](_0x80c2('0x4c'),_0x51b8ce['ticketId']));if(_0x339d17!==_0x80c2('0x4d')){logger[_0x80c2('0xf')]('['+[_0x339d17[_0x80c2('0x25')]()]+']',_0x80c2('0x4e'));emit(_0x16bdc0,_0x279fc5['name'],_0x51b8ce[_0x80c2('0x2b')]);}})[_0x80c2('0x24')](function(_0x3c1cf7){logger['error']('['+[_0x339d17[_0x80c2('0x25')]()]+_0x80c2('0x4f'),util[_0x80c2('0x50')](_0x3c1cf7,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x340a=['./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','GET','headers','info','users','email','adminEmail','adminId','Requested\x20Resource\x20not\x20Found','catch','error','toUpperCase','message','Getting\x20user\x20list','then','Getting\x20user\x20with\x20email','agentEmail','userEmail','length','userId','User\x20found:','Admin\x20selected','&entities=contact','find','contacts','format','Searching\x20contact\x20with\x20phone\x20%s','contactNumber','mobile_number','endUserId','Contact\x20found\x20mobile_number:','Contact\x20found\x20work_number:','Contact\x20created:','POST','YYYY-MM-DDTHH:mm:ss','Contact\x20not\x20found,\x20creating\x20a\x20new\x20contact','contact','Creating\x20new\x20task','/api/tasks','getString','Subjects','Descriptions','ticketId','user:%s','emit','Token\x20token=','apiKey','remoteUri','stripTrailingSlash','serverUrl','username','toLowerCase','outbound','destcalleridnum','calleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','The\x20ticket\x20ID\x20is:\x20%s','unmanaged','Displaying\x20task\x20in\x20a\x20new\x20tab...','name',']\x20Error\x20running\x20Freshsales\x20integration','request-promise','util','moment','bluebird','ioredis'];(function(_0x35430f,_0x191eff){var _0x5be670=function(_0x50c1af){while(--_0x50c1af){_0x35430f['push'](_0x35430f['shift']());}};_0x5be670(++_0x191eff);}(_0x340a,0x1db));var _0xa340=function(_0x227cdb,_0x1b4c1a){_0x227cdb=_0x227cdb-0x0;var _0x1e583=_0x340a[_0x227cdb];return _0x1e583;};'use strict';var _=require('lodash');var rp=require(_0xa340('0x0'));var md5=require('md5');var util=require(_0xa340('0x1'));var moment=require(_0xa340('0x2'));var Promise=require(_0xa340('0x3'));var Redis=require(_0xa340('0x4'));var intUtil=require(_0xa340('0x5'));var config=require(_0xa340('0x6'));var logger=require(_0xa340('0x7'))('freshsales');config[_0xa340('0x8')]=_[_0xa340('0x9')](config[_0xa340('0x8')],{'host':_0xa340('0xa'),'port':0x18eb});var io=require(_0xa340('0xb'))(new Redis(config[_0xa340('0x8')]));function getAdminId(_0x115946,_0xd7f981,_0x1efc5d,_0x537ab2){return new Promise(function(_0x4f2120,_0x1628a9){var _0xfda00c=![];var _0x490a9e={'method':_0xa340('0xc'),'uri':_0x537ab2+'/api/selector/owners','json':!![]};_0x490a9e[_0xa340('0xd')]=_0x1efc5d;logger[_0xa340('0xe')]('Getting\x20admin\x20information');return rp(_0x490a9e)['then'](function(_0x25797c){if(_0x25797c){var _0x4bd68c=_0x25797c[_0xa340('0xf')];var _0x5ca70b=null;for(_0x5ca70b=0x0;_0x5ca70b<_0x4bd68c['length'];_0x5ca70b++){if(_0x4bd68c[_0x5ca70b][_0xa340('0x10')]===_0x115946[_0xa340('0x11')]){_0x115946[_0xa340('0x12')]=_0x4bd68c[_0x5ca70b]['id'];_0xfda00c=!![];}}if(_0xfda00c){logger[_0xa340('0xe')]('Admin\x20found:',_0x115946[_0xa340('0x12')]);_0x4f2120(_0x115946);}else{_0x1628a9({'statusCode':0x194,'message':_0xa340('0x13')});}}else{_0x1628a9({'statusCode':0x194,'message':_0xa340('0x13')});}})[_0xa340('0x14')](function(_0x71fa46){logger[_0xa340('0x15')]('['+[_0xd7f981[_0xa340('0x16')]()]+']',_0x71fa46[_0xa340('0x17')]);_0x1628a9(_0x71fa46);});});}function getUser(_0x2fe67a,_0x157202,_0x406440){return function(_0x2f2fed){return new Promise(function(_0x316b26,_0x3b52e8){var _0x2472b8={'method':'GET','uri':_0x406440+'/api/selector/owners','json':!![]};_0x2472b8[_0xa340('0xd')]=_0x157202;logger['info'](_0xa340('0x18'));return rp(_0x2472b8)[_0xa340('0x19')](function(_0x5b2036){if(_0x5b2036){var _0x4ebd58=_0x5b2036[_0xa340('0xf')];var _0x9dc2a6=![];var _0x1d7955=null;if(_0x2f2fed['agentEmail']!==null){logger[_0xa340('0xe')](_0xa340('0x1a'),_0x2f2fed[_0xa340('0x1b')]);_0x2f2fed[_0xa340('0x1c')]=_0x2f2fed[_0xa340('0x1b')];for(_0x1d7955=0x0;_0x1d7955<_0x4ebd58[_0xa340('0x1d')];_0x1d7955++){if(_0x4ebd58[_0x1d7955][_0xa340('0x10')]===_0x2f2fed[_0xa340('0x1b')]){_0x9dc2a6=!![];_0x2f2fed[_0xa340('0x1e')]=_0x4ebd58[_0x1d7955]['id'];logger[_0xa340('0xe')](_0xa340('0x1f'),_0x2f2fed[_0xa340('0x1e')]);}}}if(!_0x9dc2a6){logger[_0xa340('0xe')](_0xa340('0x20'));_0x2f2fed[_0xa340('0x1c')]=_0x2f2fed[_0xa340('0x11')];_0x2f2fed[_0xa340('0x1e')]=_0x2f2fed[_0xa340('0x12')];_0x9dc2a6=!![];}if(_0x9dc2a6){_0x316b26(_0x2f2fed);}else{_0x3b52e8({'statusCode':0x194,'message':'Requested\x20Resource\x20not\x20Found'});}}else{_0x3b52e8({'statusCode':0x194,'message':_0xa340('0x13')});}})[_0xa340('0x14')](function(_0x549dcb){logger[_0xa340('0x15')]('['+[_0x2fe67a['toUpperCase']()]+']',_0x549dcb[_0xa340('0x17')]);_0x3b52e8(_0x549dcb);});});};}function searchContact(_0x55b9a8,_0x35d231,_0x157eb8,_0x3df657){return new Promise(function(_0x19f88f,_0x15d85a){var _0x9add05={'method':_0xa340('0xc'),'headers':_0x35d231,'uri':_0x55b9a8+'/api/lookup?q='+_0x3df657+'&f='+_0x157eb8+_0xa340('0x21'),'json':!![]};rp(_0x9add05)[_0xa340('0x19')](function(_0x920c77){var _0x45b99d=_[_0xa340('0x22')](_0x920c77[_0xa340('0x23')][_0xa340('0x23')],[_0x157eb8,_0x3df657]);_0x19f88f(_0x45b99d);})['catch'](function(_0x33bd3d){_0x15d85a(_0x33bd3d);});});}function getEndUser(_0x4523d3,_0x525483,_0x4882c1){return function(_0x8ba1dc){return new Promise(function(_0x3d8484,_0x2479b7){logger[_0xa340('0xe')](util[_0xa340('0x24')](_0xa340('0x25'),_0x8ba1dc[_0xa340('0x26')]));searchContact(_0x4882c1,_0x525483,_0xa340('0x27'),_0x8ba1dc[_0xa340('0x26')])[_0xa340('0x19')](function(_0x459112){if(_0x459112){_0x8ba1dc[_0xa340('0x28')]=_0x459112['id'];logger['info'](_0xa340('0x29'),_0x8ba1dc[_0xa340('0x28')]);return _0x3d8484(_0x8ba1dc);}searchContact(_0x4882c1,_0x525483,'work_number',_0x8ba1dc['contactNumber'])[_0xa340('0x19')](function(_0x3b5989){if(_0x3b5989){_0x8ba1dc[_0xa340('0x28')]=_0x3b5989['id'];logger[_0xa340('0xe')](_0xa340('0x2a'),_0x8ba1dc['endUserId']);return _0x3d8484(_0x8ba1dc);}createEndUser(_0x8ba1dc,_0x4523d3,_0x525483,_0x4882c1)['then'](function(_0x3f016c){logger[_0xa340('0xe')](_0xa340('0x2b'),_0x3f016c[_0xa340('0x28')]);return _0x3d8484(_0x3f016c);});});})[_0xa340('0x14')](function(_0x13265a){_0x2479b7(_0x13265a);});});};}function createEndUser(_0xf646cf,_0x5f5127,_0x467a73,_0x178d00){return new Promise(function(_0x390b8a,_0x3f76c8){var _0x5631bb=moment();var _0xc4db2f={'method':_0xa340('0x2c'),'uri':_0x178d00+'/api/contacts','body':{'contact':{'last_name':_0xf646cf[_0xa340('0x26')],'work_number':_0xf646cf[_0xa340('0x26')],'mobile_number':_0xf646cf['contactNumber'],'owner_id':_0xf646cf['userId'],'created_at':_0x5631bb[_0xa340('0x24')](_0xa340('0x2d'))}},'json':!![]};_0xc4db2f[_0xa340('0xd')]=_0x467a73;logger[_0xa340('0xe')](_0xa340('0x2e'));return rp(_0xc4db2f)[_0xa340('0x19')](function(_0x1aeffc){_0xf646cf[_0xa340('0x28')]=_0x1aeffc[_0xa340('0x2f')]['id'];_0x390b8a(_0xf646cf);})[_0xa340('0x14')](function(_0x175f09){logger[_0xa340('0x15')]('['+[_0x5f5127[_0xa340('0x16')]()]+']',_0x175f09['message']);_0x3f76c8(_0x175f09[_0xa340('0x17')]);});});}function getTicket(_0x14b294,_0x42801e,_0x35da60,_0x304c51,_0x403827){return function(_0x5721ad){logger[_0xa340('0xe')](_0xa340('0x30'));return new Promise(function(_0x3f41bf,_0x3a423d){var _0x6796d3=moment();var _0x5494f0={'method':'POST','uri':_0x35da60+_0xa340('0x31'),'body':{'title':intUtil[_0xa340('0x32')](_0x304c51[_0xa340('0x33')],_0x403827,'\x20'),'description':intUtil['getString'](_0x304c51[_0xa340('0x34')],_0x403827,'\x0a'),'owner_id':_0x5721ad[_0xa340('0x1e')],'creater_id':_0x5721ad[_0xa340('0x12')],'targetable_id':_0x5721ad['endUserId'],'targetable_type':'Contact','created_at':_0x6796d3[_0xa340('0x24')](_0xa340('0x2d')),'due_date':_0x6796d3['add'](0x1e,'m')['format'](_0xa340('0x2d'))},'json':!![]};_0x5494f0[_0xa340('0xd')]=_0x42801e;return rp(_0x5494f0)[_0xa340('0x19')](function(_0x300000){_0x5721ad[_0xa340('0x35')]=_0x300000['task']['id'];logger[_0xa340('0xe')]('Task\x20created:',_0x5721ad['ticketId']);_0x3f41bf(_0x5721ad);})[_0xa340('0x14')](function(_0x480a6f){logger[_0xa340('0x15')]('['+[_0x14b294[_0xa340('0x16')]()]+']',_0x480a6f[_0xa340('0x17')]);_0x3a423d(_0x480a6f[_0xa340('0x17')]);});});};}function emit(_0xd9b580,_0x317cd0,_0x4d190e){var _0x46ed9c={'uri':_0xd9b580+'/contacts/'+_0x4d190e};io['to'](util[_0xa340('0x24')](_0xa340('0x36'),_0x317cd0))[_0xa340('0x37')]('trigger:browser:url',_0x46ed9c);}exports['cs']=function(_0x1db422,_0x14f595,_0x2930f7,_0x315c77,_0x229d9e,_0x21894b,_0x390087,_0x325236){var _0x594d2b={};var _0x56ee6b={'Authorization':_0xa340('0x38')+_0x21894b[_0xa340('0x39')]};_0x21894b[_0xa340('0x3a')]=intUtil[_0xa340('0x3b')](_0x21894b[_0xa340('0x3a')]);_0x21894b[_0xa340('0x3c')]=intUtil[_0xa340('0x3b')](_0x21894b[_0xa340('0x3c')]);var _0x35c6ca=_0x21894b[_0xa340('0x3a')];_0x594d2b['adminEmail']=_0x21894b[_0xa340('0x3d')];_0x594d2b[_0xa340('0x26')]=_0x325236[_0xa340('0x3e')]()===_0xa340('0x3f')?_0x14f595[_0xa340('0x40')]:_0x14f595[_0xa340('0x41')];_0x594d2b[_0xa340('0x42')]=_0x325236===_0xa340('0x43')||_0x325236==='unmanaged'?_0xa340('0x43'):_0xa340('0x3f');if(_0x315c77){_0x594d2b[_0xa340('0x1b')]=_0x315c77[_0xa340('0x10')];}var _0x167a9e=util[_0xa340('0x24')](_0xa340('0x44'),_0x21894b[_0xa340('0x3c')],_0x14f595[_0xa340('0x45')],md5(_0x14f595['uniqueid']));if(_0x229d9e&&_0x229d9e[_0xa340('0x46')]){logger[_0xa340('0xe')]('[QUEUE]',_0xa340('0x47'));_0x14f595['recordingURL']=_0x167a9e;}else if(_0x390087&&_0x390087[_0xa340('0x48')]&&_0x390087[_0xa340('0x48')]!==_0xa340('0x49')){logger[_0xa340('0xe')](_0xa340('0x4a'),'Recording\x20is\x20enabled!');_0x14f595['recordingURL']=_0x167a9e;}else{_0x14f595['recordingURL']='';}return getAdminId(_0x594d2b,_0x325236,_0x56ee6b,_0x35c6ca)['then'](getUser(_0x325236,_0x56ee6b,_0x35c6ca))[_0xa340('0x19')](getEndUser(_0x325236,_0x56ee6b,_0x35c6ca))['then'](getTicket(_0x325236,_0x56ee6b,_0x35c6ca,_0x2930f7,_0x14f595))[_0xa340('0x19')](function(_0x2873df){logger['info'](util[_0xa340('0x24')](_0xa340('0x4b'),_0x2873df[_0xa340('0x35')]));if(_0x325236!==_0xa340('0x4c')){logger['info']('['+[_0x325236[_0xa340('0x16')]()]+']',_0xa340('0x4d'));emit(_0x35c6ca,_0x315c77[_0xa340('0x4e')],_0x2873df[_0xa340('0x28')]);}})[_0xa340('0x14')](function(_0x381763){logger[_0xa340('0x15')]('['+[_0x325236[_0xa340('0x16')]()]+_0xa340('0x4f'),util['inspect'](_0x381763,{'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 cc49f1a..8652e0e 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 _0x6797=['./vtiger','./dynamics365','./freshsales','salesforce','freshdesk','zoho','desk','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','unmanaged','zendesk','vtiger','unknown\x20integration','../../../../config/logger','[EXEC]','format','%s\x20configuration\x20#%s\x20not\x20found','error','lodash','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk'];(function(_0x42a643,_0x1be806){var _0xcdbbd5=function(_0x448a43){while(--_0x448a43){_0x42a643['push'](_0x42a643['shift']());}};_0xcdbbd5(++_0x1be806);}(_0x6797,0x94));var _0x7679=function(_0x59c345,_0x278e1e){_0x59c345=_0x59c345-0x0;var _0xa5c38a=_0x6797[_0x59c345];return _0xa5c38a;};'use strict';var _=require(_0x7679('0x0'));var util=require(_0x7679('0x1'));var zendesk=require(_0x7679('0x2'));var salesforce=require(_0x7679('0x3'));var sugarcrm=require(_0x7679('0x4'));var freshdesk=require(_0x7679('0x5'));var zoho=require(_0x7679('0x6'));var desk=require(_0x7679('0x7'));var vtiger=require(_0x7679('0x8'));var servicenow=require('./servicenow');var dynamics365=require(_0x7679('0x9'));var freshsales=require(_0x7679('0xa'));var integrations=['zendesk',_0x7679('0xb'),'sugarcrm',_0x7679('0xc'),_0x7679('0xd'),_0x7679('0xe'),'vtiger',_0x7679('0xf'),_0x7679('0x10'),_0x7679('0x11')];exports[_0x7679('0x12')]=function(_0x228bbe,_0x24e5b7,_0x1f4207,_0x5a7433,_0x45ecfe,_0x22e45e){if(_0x1f4207){if(_[_0x7679('0x13')](integrations,_0x228bbe[_0x7679('0x14')][_0x7679('0x15')]())){try{var _0x3ff7ff=null;var _0x25c020='';var _0x474e3a=_0x1f4207[_0x228bbe['data1'][_0x7679('0x15')]()];if(_0x474e3a){var _0x593d69=_0x474e3a[_0x228bbe[_0x7679('0x16')]];if(_0x593d69){var _0x2e504b=_['find'](_0x593d69[_0x7679('0x17')],{'id':parseInt(_0x228bbe[_0x7679('0x18')],0xa)});if(_0x2e504b){if(_0x5a7433){if(_0x45ecfe&&_0x24e5b7['queue']){_0x25c020=_0x7679('0x19');}else if(_0x24e5b7[_0x7679('0x1a')]){_0x25c020=_0x7679('0x1b');}else{console[_0x7679('0x1c')](_0x7679('0x1d'),_0x24e5b7);}}else{_0x25c020=_0x7679('0x1e');}switch(_0x228bbe[_0x7679('0x14')][_0x7679('0x15')]()){case _0x7679('0x1f'):zendesk[_0x25c020](_0x228bbe,_0x24e5b7,_0x2e504b,_0x5a7433,_0x45ecfe,_0x593d69,_0x22e45e);break;case _0x7679('0xb'):salesforce[_0x25c020](_0x228bbe,_0x24e5b7,_0x2e504b,_0x5a7433,_0x45ecfe,_0x593d69,_0x22e45e);break;case'sugarcrm':sugarcrm[_0x25c020](_0x228bbe,_0x24e5b7,_0x2e504b,_0x5a7433,_0x45ecfe,_0x593d69,_0x22e45e);break;case _0x7679('0xc'):freshdesk[_0x25c020](_0x228bbe,_0x24e5b7,_0x2e504b,_0x5a7433,_0x45ecfe,_0x593d69,_0x22e45e);break;case _0x7679('0xd'):zoho[_0x25c020](_0x228bbe,_0x24e5b7,_0x2e504b,_0x5a7433,_0x45ecfe,_0x593d69,_0x22e45e);break;case'desk':desk[_0x25c020](_0x228bbe,_0x24e5b7,_0x2e504b,_0x5a7433,_0x45ecfe,_0x593d69,_0x22e45e);break;case _0x7679('0x20'):vtiger[_0x25c020](_0x228bbe,_0x24e5b7,_0x2e504b,_0x5a7433,_0x45ecfe,_0x593d69,_0x22e45e);break;case _0x7679('0x10'):freshsales['cs'](_0x228bbe,_0x24e5b7,_0x2e504b,_0x5a7433,_0x45ecfe,_0x593d69,_0x22e45e,_0x25c020);break;case _0x7679('0x11'):servicenow['cs'](_0x228bbe,_0x24e5b7,_0x2e504b,_0x5a7433,_0x45ecfe,_0x593d69,_0x22e45e,_0x25c020);break;case _0x7679('0xf'):dynamics365['cs'](_0x228bbe,_0x24e5b7,_0x2e504b,_0x5a7433,_0x45ecfe,_0x593d69,_0x22e45e,_0x25c020);break;default:console[_0x7679('0x1c')](_0x7679('0x21'));}}else{_0x3ff7ff=require(_0x7679('0x22'))(_0x228bbe['data1'][_0x7679('0x15')]());_0x3ff7ff['error'](_0x7679('0x23'),util[_0x7679('0x24')](_0x7679('0x25'),_0x228bbe[_0x7679('0x14')][_0x7679('0x15')](),_0x228bbe[_0x7679('0x18')]));}}else{_0x3ff7ff=require(_0x7679('0x22'))(_0x228bbe[_0x7679('0x14')][_0x7679('0x15')]());_0x3ff7ff[_0x7679('0x26')]('[EXEC]',util[_0x7679('0x24')]('%s\x20account\x20#%s\x20not\x20found',_0x228bbe['data1']['toLowerCase'](),_0x228bbe['data2']));}}else{}}catch(_0x121ac2){console[_0x7679('0x26')](_0x121ac2);}}}}; \ No newline at end of file +var _0xf0f5=['find','Configurations','data3','queue','routeId','outbound','log','EVENT\x20UNKNOWN','salesforce','zoho','desk','../../../../config/logger','error','%s\x20configuration\x20#%s\x20not\x20found','[EXEC]','format','%s\x20account\x20#%s\x20not\x20found','util','./zendesk','./salesforce','./sugarcrm','./freshdesk','./zoho','./desk','./vtiger','./dynamics365','./freshsales','zendesk','sugarcrm','freshdesk','vtiger','dynamics365','freshsales','servicenow','exec','includes','data1','toLowerCase','data2'];(function(_0x3b7b8a,_0x52c3b0){var _0x441206=function(_0x5d34d3){while(--_0x5d34d3){_0x3b7b8a['push'](_0x3b7b8a['shift']());}};_0x441206(++_0x52c3b0);}(_0xf0f5,0xad));var _0x5f0f=function(_0x65f140,_0x45cbc7){_0x65f140=_0x65f140-0x0;var _0x18fbda=_0xf0f5[_0x65f140];return _0x18fbda;};'use strict';var _=require('lodash');var util=require(_0x5f0f('0x0'));var zendesk=require(_0x5f0f('0x1'));var salesforce=require(_0x5f0f('0x2'));var sugarcrm=require(_0x5f0f('0x3'));var freshdesk=require(_0x5f0f('0x4'));var zoho=require(_0x5f0f('0x5'));var desk=require(_0x5f0f('0x6'));var vtiger=require(_0x5f0f('0x7'));var servicenow=require('./servicenow');var dynamics365=require(_0x5f0f('0x8'));var freshsales=require(_0x5f0f('0x9'));var integrations=[_0x5f0f('0xa'),'salesforce',_0x5f0f('0xb'),_0x5f0f('0xc'),'zoho','desk',_0x5f0f('0xd'),_0x5f0f('0xe'),_0x5f0f('0xf'),_0x5f0f('0x10')];exports[_0x5f0f('0x11')]=function(_0x381965,_0xcfc94d,_0xeb7156,_0x46db28,_0x4b65cd,_0x63df19){if(_0xeb7156){if(_[_0x5f0f('0x12')](integrations,_0x381965[_0x5f0f('0x13')][_0x5f0f('0x14')]())){try{var _0x4fb866=null;var _0x488cfc='';var _0xf79813=_0xeb7156[_0x381965[_0x5f0f('0x13')][_0x5f0f('0x14')]()];if(_0xf79813){var _0x1d8632=_0xf79813[_0x381965[_0x5f0f('0x15')]];if(_0x1d8632){var _0x274ce4=_[_0x5f0f('0x16')](_0x1d8632[_0x5f0f('0x17')],{'id':parseInt(_0x381965[_0x5f0f('0x18')],0xa)});if(_0x274ce4){if(_0x46db28){if(_0x4b65cd&&_0xcfc94d['queue']){_0x488cfc=_0x5f0f('0x19');}else if(_0xcfc94d[_0x5f0f('0x1a')]){_0x488cfc=_0x5f0f('0x1b');}else{console[_0x5f0f('0x1c')](_0x5f0f('0x1d'),_0xcfc94d);}}else{_0x488cfc='unmanaged';}switch(_0x381965[_0x5f0f('0x13')][_0x5f0f('0x14')]()){case _0x5f0f('0xa'):zendesk[_0x488cfc](_0x381965,_0xcfc94d,_0x274ce4,_0x46db28,_0x4b65cd,_0x1d8632,_0x63df19);break;case _0x5f0f('0x1e'):salesforce[_0x488cfc](_0x381965,_0xcfc94d,_0x274ce4,_0x46db28,_0x4b65cd,_0x1d8632,_0x63df19);break;case'sugarcrm':sugarcrm[_0x488cfc](_0x381965,_0xcfc94d,_0x274ce4,_0x46db28,_0x4b65cd,_0x1d8632,_0x63df19);break;case'freshdesk':freshdesk[_0x488cfc](_0x381965,_0xcfc94d,_0x274ce4,_0x46db28,_0x4b65cd,_0x1d8632,_0x63df19);break;case _0x5f0f('0x1f'):zoho[_0x488cfc](_0x381965,_0xcfc94d,_0x274ce4,_0x46db28,_0x4b65cd,_0x1d8632,_0x63df19);break;case _0x5f0f('0x20'):desk[_0x488cfc](_0x381965,_0xcfc94d,_0x274ce4,_0x46db28,_0x4b65cd,_0x1d8632,_0x63df19);break;case _0x5f0f('0xd'):vtiger[_0x488cfc](_0x381965,_0xcfc94d,_0x274ce4,_0x46db28,_0x4b65cd,_0x1d8632,_0x63df19);break;case _0x5f0f('0xf'):freshsales['cs'](_0x381965,_0xcfc94d,_0x274ce4,_0x46db28,_0x4b65cd,_0x1d8632,_0x63df19,_0x488cfc);break;case _0x5f0f('0x10'):servicenow['cs'](_0x381965,_0xcfc94d,_0x274ce4,_0x46db28,_0x4b65cd,_0x1d8632,_0x63df19,_0x488cfc);break;case _0x5f0f('0xe'):dynamics365['cs'](_0x381965,_0xcfc94d,_0x274ce4,_0x46db28,_0x4b65cd,_0x1d8632,_0x63df19,_0x488cfc);break;default:console['log']('unknown\x20integration');}}else{_0x4fb866=require(_0x5f0f('0x21'))(_0x381965[_0x5f0f('0x13')][_0x5f0f('0x14')]());_0x4fb866[_0x5f0f('0x22')]('[EXEC]',util['format'](_0x5f0f('0x23'),_0x381965[_0x5f0f('0x13')][_0x5f0f('0x14')](),_0x381965[_0x5f0f('0x18')]));}}else{_0x4fb866=require(_0x5f0f('0x21'))(_0x381965[_0x5f0f('0x13')][_0x5f0f('0x14')]());_0x4fb866['error'](_0x5f0f('0x24'),util[_0x5f0f('0x25')](_0x5f0f('0x26'),_0x381965[_0x5f0f('0x13')][_0x5f0f('0x14')](),_0x381965[_0x5f0f('0x15')]));}}else{}}catch(_0x1183c5){console[_0x5f0f('0x22')](_0x1183c5);}}}}; \ 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 2722d3f..acec1c3 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 _0xd540=['cloneDeep','additionalSearchContact','$or','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','Contact','first','attributes','type','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','Enduser\x20with\x20phone\x20%s\x20not\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','LastName','','format','Caller\x20-\x20%s','forEach','includes','string','idField','content','variable','variableName','customVariable','Variable','name','toLowerCase','securityToken','Connection','https://login.salesforce.com','clientId','clientSecret','login','username','Connection\x20established.','serverUrl','remoteUri','stripTrailingSlash','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','email','calleridname','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','integrationTab','user:%s','newTab','trigger:browser:url','%s/%s/e','instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','recordingFormat','[OUTBOUND]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','destcalleridname','destcalleridnum','[OUTBOUND]\x20Ticket\x20%s\x20created.','[OUTBOUND]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.','unmanaged','lastevent','toUpperCase',']\x20Ticket\x20%s\x20created.',']\x20Integration\x20account\x20type\x20%s.','lodash','bluebird','jsforce','util','./util','../../../../config/environment','../../../../config/logger','salesforce','redis','defaults','localhost','socket.io-emitter','assign','getString','Descriptions','Task','ActivityDate','utc','IsReminderSet','IsRecurrence','endUserType','contact','lead','WhoId','account','WhatId','ticketType','Case','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','isNil','find','execute','then','length','Agent\x20%s\x20found.','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','resolve','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch'];(function(_0x19cbde,_0x379fd5){var _0x104633=function(_0x501a22){while(--_0x501a22){_0x19cbde['push'](_0x19cbde['shift']());}};_0x104633(++_0x379fd5);}(_0xd540,0xc8));var _0x0d54=function(_0xcaecd3,_0x2d0193){_0xcaecd3=_0xcaecd3-0x0;var _0x5da8a1=_0xd540[_0xcaecd3];return _0x5da8a1;};'use strict';var _=require(_0x0d54('0x0'));var rp=require('request-promise');var moment=require('moment');var BPromise=require(_0x0d54('0x1'));var md5=require('md5');var jsforce=require(_0x0d54('0x2'));var util=require(_0x0d54('0x3'));var Redis=require('ioredis');var intUtil=require(_0x0d54('0x4'));var config=require(_0x0d54('0x5'));var logger=require(_0x0d54('0x6'))(_0x0d54('0x7'));config[_0x0d54('0x8')]=_[_0x0d54('0x9')](config[_0x0d54('0x8')],{'host':_0x0d54('0xa'),'port':0x18eb});var io=require(_0x0d54('0xb'))(new Redis(config[_0x0d54('0x8')]));function emit(_0x40788e,_0x1772fb,_0x38171d){io['to'](_0x40788e)['emit'](_0x1772fb,_0x38171d);}function getTicket(_0x1fa9cd,_0x57e5b6,_0x8f2802,_0x86adb5,_0x2a6844,_0x1f2c0e,_0x3ba93b,_0x1f8ac9){var _0x47da03=Object[_0x0d54('0xc')]({},{'OwnerId':_0x57e5b6['id'],'Subject':intUtil[_0x0d54('0xd')](_0x86adb5['Subjects'],_0x2a6844,'\x20'),'Description':intUtil['getString'](_0x86adb5[_0x0d54('0xe')],_0x2a6844,'\x0a')},getCustomFields(_0x1f2c0e,_0x2a6844));if(_0x8f2802){if(_0x86adb5['ticketType']===_0x0d54('0xf')){_0x47da03[_0x0d54('0x10')]=moment[_0x0d54('0x11')]();_0x47da03[_0x0d54('0x12')]=![];_0x47da03[_0x0d54('0x13')]=![];if(_0x8f2802[_0x0d54('0x14')]===_0x0d54('0x15')||_0x8f2802[_0x0d54('0x14')]===_0x0d54('0x16')){_0x47da03[_0x0d54('0x17')]=_0x8f2802['id'];}else if(_0x8f2802['endUserType']===_0x0d54('0x18')){_0x47da03[_0x0d54('0x19')]=_0x8f2802['id'];}}else if(_0x86adb5[_0x0d54('0x1a')]===_0x0d54('0x1b')){if(_0x8f2802[_0x0d54('0x14')]===_0x0d54('0x15')){_0x47da03['ContactId']=_0x8f2802['id'];}else if(_0x8f2802[_0x0d54('0x14')]===_0x0d54('0x18')){_0x47da03[_0x0d54('0x1c')]=_0x8f2802['id'];}else if(_0x8f2802['endUserType']===_0x0d54('0x16')&&_0x86adb5[_0x0d54('0x1d')]){_0x47da03[_0x86adb5[_0x0d54('0x1d')]]=_0x8f2802['id'];}else{logger[_0x0d54('0x1e')](_0x0d54('0x1f'));}}}return _0x3ba93b[_0x0d54('0x20')](_0x86adb5[_0x0d54('0x1a')])[_0x0d54('0x21')](_0x47da03);}function getUser(_0x3e6fea,_0x5edd6c,_0x2bc6cd){if(!_[_0x0d54('0x22')](_0x5edd6c)&&intUtil['validateEmail'](_0x5edd6c)){var _0x2a823c={'Email':_0x5edd6c};var _0x4ae91a={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x2bc6cd[_0x0d54('0x20')]('User')[_0x0d54('0x23')](_0x2a823c,_0x4ae91a)[_0x0d54('0x24')]()[_0x0d54('0x25')](function(_0x5e76c4){if(_0x5e76c4[_0x0d54('0x26')]){var _0x483ccc=_['find'](_0x5e76c4,function(_0x31f9ad){return _0x31f9ad['Email']===_0x5edd6c;});if(_0x483ccc){logger[_0x0d54('0x1e')](_0x0d54('0x27'),_0x5edd6c);return BPromise['resolve']({'id':_0x483ccc['Id'],'name':_0x483ccc[_0x0d54('0x28')]});}}else{logger[_0x0d54('0x1e')](_0x0d54('0x29'),_0x5edd6c);return _0x2bc6cd[_0x0d54('0x2a')]()['then'](function(_0x5c1b45){return BPromise['resolve']({'id':_0x5c1b45[_0x0d54('0x2b')],'name':_0x5c1b45[_0x0d54('0x2c')]});});}});}else{logger['info'](_0x0d54('0x29'),_0x5edd6c);return _0x2bc6cd[_0x0d54('0x2a')]()['then'](function(_0x1ed834){return BPromise[_0x0d54('0x2d')]({'id':_0x1ed834[_0x0d54('0x2b')],'name':_0x1ed834[_0x0d54('0x2c')]});});}}function getEndUser(_0x451ac2,_0x38c91a,_0x22e007,_0xb13321,_0x5d5c4a){var _0x3b16db={'$or':{'Phone':_0xb13321}};var _0xda3d9b={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0x0d54('0x2d')]()['then'](function(){logger[_0x0d54('0x1e')](_0x0d54('0x2e'),_0xb13321,_0x38c91a[_0x0d54('0x2f')]);switch(_0x38c91a[_0x0d54('0x2f')]){case'contact_lead':var _0x408b70=_[_0x0d54('0x30')](_0x3b16db);if(_0x38c91a[_0x0d54('0x31')]){var _0x503e44={};_0x503e44[_0x38c91a['additionalSearchContact']]=_0xb13321;_['merge'](_0x408b70[_0x0d54('0x32')],_0x503e44);}return _0x5d5c4a[_0x0d54('0x20')]('Contact')[_0x0d54('0x23')](_0x408b70,_0xda3d9b)[_0x0d54('0x24')]()['then'](function(_0x20d0a7){if(_0x20d0a7&&_0x20d0a7[_0x0d54('0x26')]){return _0x20d0a7;}else{var _0x16e485=_[_0x0d54('0x30')](_0x3b16db);if(_0x38c91a[_0x0d54('0x33')]){var _0x2181d1={};_0x2181d1[_0x38c91a['additionalSearchLead']]=_0xb13321;_[_0x0d54('0x34')](_0x16e485[_0x0d54('0x32')],_0x2181d1);}return _0x5d5c4a[_0x0d54('0x20')](_0x0d54('0x35'))[_0x0d54('0x23')](_0x16e485,_0xda3d9b);}});case'account_contact_lead':var _0x401a4b=_[_0x0d54('0x30')](_0x3b16db);if(_0x38c91a[_0x0d54('0x36')]){var _0x503e44={};_0x503e44[_0x38c91a[_0x0d54('0x36')]]=_0xb13321;_[_0x0d54('0x34')](_0x401a4b[_0x0d54('0x32')],_0x503e44);}return _0x5d5c4a[_0x0d54('0x20')](_0x0d54('0x37'))[_0x0d54('0x23')](_0x401a4b,_0xda3d9b)[_0x0d54('0x24')]()[_0x0d54('0x25')](function(_0x4e2dc4){if(_0x4e2dc4&&_0x4e2dc4[_0x0d54('0x26')]){return _0x4e2dc4;}else{var _0x2b15b5=_[_0x0d54('0x30')](_0x3b16db);if(_0x38c91a[_0x0d54('0x31')]){var _0x12bcbd={};_0x12bcbd[_0x38c91a[_0x0d54('0x31')]]=_0xb13321;_[_0x0d54('0x34')](_0x2b15b5[_0x0d54('0x32')],_0x12bcbd);}return _0x5d5c4a[_0x0d54('0x20')](_0x0d54('0x38'))[_0x0d54('0x23')](_0x2b15b5,_0xda3d9b)[_0x0d54('0x25')](function(_0x54466a){if(_0x54466a&&_0x54466a[_0x0d54('0x26')]){return _0x54466a;}else{var _0x3fedcc=_[_0x0d54('0x30')](_0x3b16db);if(_0x38c91a[_0x0d54('0x33')]){var _0x10f44a={};_0x10f44a[_0x38c91a[_0x0d54('0x33')]]=_0xb13321;_[_0x0d54('0x34')](_0x3fedcc[_0x0d54('0x32')],_0x10f44a);}return _0x5d5c4a[_0x0d54('0x20')](_0x0d54('0x35'))[_0x0d54('0x23')](_0x3fedcc,_0xda3d9b);}});}});case _0x0d54('0x15'):var _0x408b70=_[_0x0d54('0x30')](_0x3b16db);if(_0x38c91a[_0x0d54('0x31')]){var _0x503e44={};_0x503e44[_0x38c91a[_0x0d54('0x31')]]=_0xb13321;_[_0x0d54('0x34')](_0x408b70[_0x0d54('0x32')],_0x503e44);}return _0x5d5c4a['sobject'](_0x0d54('0x38'))[_0x0d54('0x23')](_0x408b70,_0xda3d9b)[_0x0d54('0x24')]();case _0x0d54('0x16'):var _0x4c167a=_[_0x0d54('0x30')](_0x3b16db);if(_0x38c91a[_0x0d54('0x33')]){var _0x503e44={};_0x503e44[_0x38c91a[_0x0d54('0x33')]]=_0xb13321;_[_0x0d54('0x34')](_0x4c167a[_0x0d54('0x32')],_0x503e44);}return _0x5d5c4a[_0x0d54('0x20')](_0x0d54('0x35'))['find'](_0x4c167a,_0xda3d9b);case _0x0d54('0x18'):var _0x401a4b=_[_0x0d54('0x30')](_0x3b16db);if(_0x38c91a[_0x0d54('0x36')]){var _0x503e44={};_0x503e44[_0x38c91a[_0x0d54('0x36')]]=_0xb13321;_[_0x0d54('0x34')](_0x401a4b[_0x0d54('0x32')],_0x503e44);}return _0x5d5c4a['sobject'](_0x0d54('0x37'))[_0x0d54('0x23')](_0x401a4b,_0xda3d9b);default:return null;}})[_0x0d54('0x25')](function(_0x385e79){if(_0x385e79&&_0x385e79[_0x0d54('0x26')]){var _0x4bbef6=_[_0x0d54('0x39')](_0x385e79);if(_0x4bbef6){return BPromise[_0x0d54('0x2d')]({'id':_0x4bbef6['Id'],'name':_0x4bbef6[_0x0d54('0x28')],'phone':_0x4bbef6['Phone'],'endUserType':_0x4bbef6[_0x0d54('0x3a')][_0x0d54('0x3b')]['toLowerCase']()});}}})[_0x0d54('0x25')](function(_0x251133){if(_0x251133){logger['info'](_0x0d54('0x3c'),_0x251133['endUserType'],_0xb13321);return BPromise[_0x0d54('0x2d')](_0x251133);}else{logger[_0x0d54('0x1e')](_0x0d54('0x3d'),_0xb13321);var _0x55abc4={'Phone':_0xb13321};if(_0x38c91a[_0x0d54('0x3e')]){if(_0x38c91a['moduleCreate']==='contact'){logger[_0x0d54('0x1e')](_0x0d54('0x3f'),_0xb13321,_0x38c91a['moduleCreate']);_0x55abc4[_0x0d54('0x40')]=_0x22e007!==_0x0d54('0x41')?_0x22e007:util[_0x0d54('0x42')]('Caller\x20-\x20%s',_0xb13321);}else if(_0x38c91a[_0x0d54('0x3e')]===_0x0d54('0x16')){logger[_0x0d54('0x1e')](_0x0d54('0x3f'),_0xb13321,_0x38c91a[_0x0d54('0x3e')]);_0x55abc4[_0x0d54('0x40')]=_0x22e007!==''?_0x22e007:util[_0x0d54('0x42')](_0x0d54('0x43'),_0xb13321);_0x55abc4['Company']='No\x20Company';}else if(_0x38c91a[_0x0d54('0x3e')]===_0x0d54('0x18')){logger['info'](_0x0d54('0x3f'),_0xb13321,_0x38c91a[_0x0d54('0x3e')]);_0x55abc4[_0x0d54('0x28')]=_0x22e007!==''?_0x22e007:util[_0x0d54('0x42')](_0x0d54('0x43'),_0xb13321);}else{return null;}}return _0x5d5c4a[_0x0d54('0x20')](_['upperFirst'](_0x38c91a['moduleCreate']))[_0x0d54('0x21')](_0x55abc4)[_0x0d54('0x25')](function(_0x34ee6d){return BPromise[_0x0d54('0x2d')]({'id':_0x34ee6d['id'],'endUserType':_0x38c91a[_0x0d54('0x3e')]});});}});}function getCustomFields(_0x3ae327,_0x2d3ef){var _0x36635b={};if(_0x3ae327[_0x0d54('0x26')]>0x0){_[_0x0d54('0x44')](_0x3ae327,function(_0x4e776f){if(_[_0x0d54('0x45')]([_0x0d54('0x46'),'picklist'],_0x4e776f[_0x0d54('0x3b')])&&_0x4e776f[_0x0d54('0x47')]){_0x36635b[_0x4e776f['idField']]=_0x4e776f[_0x0d54('0x48')]['toString']();}else if(_0x4e776f['type']===_0x0d54('0x49')&&_0x4e776f[_0x0d54('0x4a')]&&_0x4e776f[_0x0d54('0x47')]){_0x2d3ef[_0x4e776f['variableName']]&&(_0x36635b[_0x4e776f[_0x0d54('0x47')]]=_0x2d3ef[_0x4e776f[_0x0d54('0x4a')]]['toString']());}else if(_0x4e776f[_0x0d54('0x3b')]===_0x0d54('0x4b')&&_0x4e776f[_0x0d54('0x4c')]&&_0x4e776f[_0x0d54('0x4c')][_0x0d54('0x4d')]&&_0x4e776f[_0x0d54('0x47')]){_0x2d3ef[_0x4e776f[_0x0d54('0x4c')][_0x0d54('0x4d')][_0x0d54('0x4e')]()]&&(_0x36635b[_0x4e776f[_0x0d54('0x47')]]=_0x2d3ef[_0x4e776f[_0x0d54('0x4c')]['name']['toLowerCase']()]['toString']());}});}return _0x36635b;}function getConnection(_0x3587db){var _0x406c51=_0x3587db['password']['concat'](_0x3587db[_0x0d54('0x4f')]);var _0x425b49=new jsforce[(_0x0d54('0x50'))]({'oauth2':{'loginUrl':_0x3587db['remoteUri']||_0x0d54('0x51'),'clientId':_0x3587db[_0x0d54('0x52')],'clientSecret':_0x3587db[_0x0d54('0x53')]}});return _0x425b49[_0x0d54('0x54')](_0x3587db[_0x0d54('0x55')],_0x406c51)[_0x0d54('0x25')](function(){logger['info'](_0x0d54('0x56'));return _0x425b49;});}exports['queue']=function(_0x4bf588,_0x1ce858,_0x28696f,_0x271375,_0x56ad7a,_0x5b4b9a){var _0x138114,_0x5f3877,_0x1691fd,_0x19f574;_0x5b4b9a[_0x0d54('0x57')]=intUtil['stripTrailingSlash'](_0x5b4b9a[_0x0d54('0x57')]);_0x5b4b9a[_0x0d54('0x58')]=intUtil[_0x0d54('0x59')](_0x5b4b9a[_0x0d54('0x58')]);if(_0x56ad7a&&_0x56ad7a[_0x0d54('0x5a')]){logger['info'](_0x0d54('0x5b'),_0x0d54('0x5c'));_0x1ce858[_0x0d54('0x5d')]=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5b4b9a[_0x0d54('0x57')],_0x1ce858[_0x0d54('0x5e')],md5(_0x1ce858[_0x0d54('0x5e')]));}else{_0x1ce858['recordingURL']='';}return getConnection(_0x5b4b9a)[_0x0d54('0x25')](function(_0x57679c){_0x19f574=_0x57679c;return getUser(_0x5b4b9a,_0x271375[_0x0d54('0x5f')],_0x19f574);})[_0x0d54('0x25')](function(_0x4ce588){_0x138114=_0x4ce588;return getEndUser(_0x5b4b9a,_0x28696f,_0x1ce858[_0x0d54('0x60')],_0x1ce858[_0x0d54('0x61')],_0x19f574);})['then'](function(_0x197e23){_0x5f3877=_0x197e23;return getTicket(_0x5b4b9a,_0x138114,_0x5f3877,_0x28696f,_0x1ce858,_0x28696f[_0x0d54('0x62')],_0x19f574,_0x0d54('0x63'));})[_0x0d54('0x25')](function(_0x5ee871){_0x1691fd=_0x5ee871;logger[_0x0d54('0x1e')](_0x0d54('0x64'),_0x1691fd['id']);logger[_0x0d54('0x1e')](_0x0d54('0x65'),_0x1691fd['id'],_0x271375[_0x0d54('0x4d')],_0x5b4b9a[_0x0d54('0x3b')]);switch(_0x5b4b9a[_0x0d54('0x3b')]){case _0x0d54('0x66'):emit(util[_0x0d54('0x42')](_0x0d54('0x67'),_0x271375['name']),'trigger:salesforce:display',{'recordId':_0x1691fd['id']});break;case _0x0d54('0x68'):emit(util['format'](_0x0d54('0x67'),_0x271375[_0x0d54('0x4d')]),_0x0d54('0x69'),{'uri':util[_0x0d54('0x42')](_0x0d54('0x6a'),_0x19f574[_0x0d54('0x6b')],_0x1691fd['id'])});break;default:logger[_0x0d54('0x6c')](_0x0d54('0x6d'));}})[_0x0d54('0x6e')](function(_0x276469){logger[_0x0d54('0x6c')](_0x0d54('0x5b'),_0x276469);});};exports[_0x0d54('0x6f')]=function(_0x395669,_0x62539b,_0x3e6cf8,_0x319935,_0x3bdd3b,_0x20e599,_0x4d1505){var _0x2d1922,_0x2b2d78,_0x1c8bd1,_0x25ecfd;_0x20e599[_0x0d54('0x57')]=intUtil[_0x0d54('0x59')](_0x20e599['serverUrl']);_0x20e599['remoteUri']=intUtil['stripTrailingSlash'](_0x20e599[_0x0d54('0x58')]);if(_0x4d1505&&_0x4d1505[_0x0d54('0x70')]&&_0x4d1505[_0x0d54('0x70')]!=='none'){logger[_0x0d54('0x1e')](_0x0d54('0x71'),_0x0d54('0x5c'));_0x62539b['recordingURL']=util[_0x0d54('0x42')](_0x0d54('0x72'),_0x20e599['serverUrl'],_0x62539b['uniqueid'],md5(_0x62539b[_0x0d54('0x5e')]));}return getConnection(_0x20e599)['then'](function(_0x2e337){_0x25ecfd=_0x2e337;return getUser(_0x20e599,_0x319935[_0x0d54('0x5f')],_0x25ecfd);})[_0x0d54('0x25')](function(_0x53405b){_0x2d1922=_0x53405b;return getEndUser(_0x20e599,_0x3e6cf8,_0x62539b[_0x0d54('0x73')],_0x62539b[_0x0d54('0x74')],_0x25ecfd);})[_0x0d54('0x25')](function(_0x44c1f4){_0x2b2d78=_0x44c1f4;return getTicket(_0x20e599,_0x2d1922,_0x2b2d78,_0x3e6cf8,_0x62539b,_0x3e6cf8['Fields'],_0x25ecfd,_0x0d54('0x6f'));})[_0x0d54('0x25')](function(_0xaf8974){_0x1c8bd1=_0xaf8974;logger[_0x0d54('0x1e')](_0x0d54('0x75'),_0x1c8bd1['id']);logger[_0x0d54('0x1e')](_0x0d54('0x76'),_0x1c8bd1['id'],_0x319935[_0x0d54('0x4d')],_0x20e599[_0x0d54('0x3b')]);switch(_0x20e599[_0x0d54('0x3b')]){case _0x0d54('0x66'):emit(util[_0x0d54('0x42')](_0x0d54('0x67'),_0x319935[_0x0d54('0x4d')]),'trigger:salesforce:display',{'recordId':_0x1c8bd1['id']});break;case'newTab':emit(util[_0x0d54('0x42')]('user:%s',_0x319935[_0x0d54('0x4d')]),_0x0d54('0x69'),{'uri':util[_0x0d54('0x42')](_0x0d54('0x6a'),_0x25ecfd['instanceUrl'],_0x1c8bd1['id'])});break;default:logger[_0x0d54('0x6c')](_0x0d54('0x71'),'Salesforce\x20account\x20type\x20not\x20recognized');}})['catch'](function(_0x39bc9c){logger[_0x0d54('0x6c')](_0x0d54('0x71'),_0x39bc9c);});};exports[_0x0d54('0x77')]=function(_0x113fc6,_0x5c4df1,_0x133a31,_0xc3d8d5,_0x5f31ef,_0x3a1d4a){var _0x2023af,_0x611f75,_0x5a2e45,_0x2f87a8;_0x3a1d4a[_0x0d54('0x57')]=intUtil['stripTrailingSlash'](_0x3a1d4a[_0x0d54('0x57')]);_0x3a1d4a[_0x0d54('0x58')]=intUtil[_0x0d54('0x59')](_0x3a1d4a[_0x0d54('0x58')]);if(_0x5f31ef&&_0x5f31ef[_0x0d54('0x5a')]){logger[_0x0d54('0x1e')]('['+_0x5c4df1[_0x0d54('0x78')]['toUpperCase']()+']',_0x0d54('0x5c'));_0x5c4df1[_0x0d54('0x5d')]=util[_0x0d54('0x42')](_0x0d54('0x72'),_0x3a1d4a['serverUrl'],_0x5c4df1[_0x0d54('0x5e')],md5(_0x5c4df1[_0x0d54('0x5e')]));}else{_0x5c4df1[_0x0d54('0x5d')]='';}return getConnection(_0x3a1d4a)[_0x0d54('0x25')](function(_0x549301){_0x2f87a8=_0x549301;if(!_[_0x0d54('0x22')](_0xc3d8d5)){return getUser(_0x3a1d4a,_0xc3d8d5[_0x0d54('0x4d')],_0x2f87a8);}else{return getUser(_0x3a1d4a,null,_0x2f87a8);}})[_0x0d54('0x25')](function(_0x2db067){_0x2023af=_0x2db067;return getEndUser(_0x3a1d4a,_0x133a31,_0x5c4df1['calleridname'],_0x5c4df1[_0x0d54('0x61')],_0x2f87a8);})[_0x0d54('0x25')](function(_0x2ac548){_0x611f75=_0x2ac548;return getTicket(_0x3a1d4a,_0x2023af,_0x611f75,_0x133a31,_0x5c4df1,_0x133a31[_0x0d54('0x62')],_0x2f87a8);})[_0x0d54('0x25')](function(_0x12ed53){_0x5a2e45=_0x12ed53;logger['info']('['+_0x5c4df1[_0x0d54('0x78')][_0x0d54('0x79')]()+_0x0d54('0x7a'),_0x5a2e45['id']);logger[_0x0d54('0x1e')]('['+_0x5c4df1[_0x0d54('0x78')][_0x0d54('0x79')]()+_0x0d54('0x7b'),_0x3a1d4a[_0x0d54('0x3b')]);})[_0x0d54('0x6e')](function(_0x4c0667){logger['error']('['+_0x5c4df1[_0x0d54('0x78')][_0x0d54('0x79')]()+']',_0x4c0667);});}; \ No newline at end of file +var _0xd00f=['instanceUrl','error','[QUEUE]\x20Salesforce\x20account\x20type\x20not\x20recognized.','catch','outbound','remoteUri','recordingFormat','none','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','toUpperCase','isNil','calleridname','lastevent',']\x20Integration\x20account\x20type\x20%s.','lodash','request-promise','moment','bluebird','md5','jsforce','util','ioredis','../../../../config/environment','../../../../config/logger','salesforce','redis','localhost','socket.io-emitter','assign','getString','Descriptions','ticketType','Task','ActivityDate','utc','contact','endUserType','lead','WhoId','account','WhatId','Case','ContactId','AccountId','leadId','info','Association\x20between\x20Case\x20and\x20Lead\x20skipped','sobject','create','find','execute','then','Email','Agent\x20%s\x20found.','resolve','Name','Agent\x20%s\x20not\x20found.\x20Switch\x20to\x20the\x20admin\x20account.','identity','user_id','display_name','Searching\x20enduser\x20with\x20phone\x20%s.\x20Serching\x20method\x20used\x20%s.','moduleSearch','contact_lead','cloneDeep','additionalSearchContact','$or','Contact','length','additionalSearchLead','merge','Lead','additionalSearchAccount','Account','first','attributes','toLowerCase','Enduser\x20(%s)\x20with\x20phone\x20%s\x20found','moduleCreate','Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.','','Caller\x20-\x20%s','LastName','Company','upperFirst','forEach','includes','string','picklist','type','idField','content','variableName','toString','customVariable','Variable','name','password','concat','clientSecret','login','username','Connection\x20established.','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','calleridnum','Fields','queue','[QUEUE]\x20Ticket\x20%s\x20created','integrationTab','user:%s','trigger:salesforce:display','newTab','trigger:browser:url','%s/%s/e'];(function(_0x4154a6,_0x2c0b8e){var _0x3b2786=function(_0x2f5936){while(--_0x2f5936){_0x4154a6['push'](_0x4154a6['shift']());}};_0x3b2786(++_0x2c0b8e);}(_0xd00f,0x194));var _0xfd00=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0xd00f[_0x14add3];return _0x4a174f;};'use strict';var _=require(_0xfd00('0x0'));var rp=require(_0xfd00('0x1'));var moment=require(_0xfd00('0x2'));var BPromise=require(_0xfd00('0x3'));var md5=require(_0xfd00('0x4'));var jsforce=require(_0xfd00('0x5'));var util=require(_0xfd00('0x6'));var Redis=require(_0xfd00('0x7'));var intUtil=require('./util');var config=require(_0xfd00('0x8'));var logger=require(_0xfd00('0x9'))(_0xfd00('0xa'));config[_0xfd00('0xb')]=_['defaults'](config[_0xfd00('0xb')],{'host':_0xfd00('0xc'),'port':0x18eb});var io=require(_0xfd00('0xd'))(new Redis(config[_0xfd00('0xb')]));function emit(_0xb83698,_0x714698,_0x130fef){io['to'](_0xb83698)['emit'](_0x714698,_0x130fef);}function getTicket(_0x19ae0e,_0x275dbd,_0x16f699,_0x3c35ef,_0x26452d,_0x2f6ea1,_0x56bf0f,_0x197d45){var _0x20d782=Object[_0xfd00('0xe')]({},{'OwnerId':_0x275dbd['id'],'Subject':intUtil[_0xfd00('0xf')](_0x3c35ef['Subjects'],_0x26452d,'\x20'),'Description':intUtil[_0xfd00('0xf')](_0x3c35ef[_0xfd00('0x10')],_0x26452d,'\x0a')},getCustomFields(_0x2f6ea1,_0x26452d));if(_0x16f699){if(_0x3c35ef[_0xfd00('0x11')]===_0xfd00('0x12')){_0x20d782[_0xfd00('0x13')]=moment[_0xfd00('0x14')]();_0x20d782['IsReminderSet']=![];_0x20d782['IsRecurrence']=![];if(_0x16f699['endUserType']===_0xfd00('0x15')||_0x16f699[_0xfd00('0x16')]===_0xfd00('0x17')){_0x20d782[_0xfd00('0x18')]=_0x16f699['id'];}else if(_0x16f699[_0xfd00('0x16')]===_0xfd00('0x19')){_0x20d782[_0xfd00('0x1a')]=_0x16f699['id'];}}else if(_0x3c35ef[_0xfd00('0x11')]===_0xfd00('0x1b')){if(_0x16f699[_0xfd00('0x16')]===_0xfd00('0x15')){_0x20d782[_0xfd00('0x1c')]=_0x16f699['id'];}else if(_0x16f699['endUserType']===_0xfd00('0x19')){_0x20d782[_0xfd00('0x1d')]=_0x16f699['id'];}else if(_0x16f699[_0xfd00('0x16')]===_0xfd00('0x17')&&_0x3c35ef[_0xfd00('0x1e')]){_0x20d782[_0x3c35ef[_0xfd00('0x1e')]]=_0x16f699['id'];}else{logger[_0xfd00('0x1f')](_0xfd00('0x20'));}}}return _0x56bf0f[_0xfd00('0x21')](_0x3c35ef['ticketType'])[_0xfd00('0x22')](_0x20d782);}function getUser(_0x51ca76,_0x200c32,_0x7b2d08){if(!_['isNil'](_0x200c32)&&intUtil['validateEmail'](_0x200c32)){var _0x2994c7={'Email':_0x200c32};var _0x10860d={'Id':!![],'Username':!![],'Name':!![],'Email':!![]};return _0x7b2d08[_0xfd00('0x21')]('User')[_0xfd00('0x23')](_0x2994c7,_0x10860d)[_0xfd00('0x24')]()[_0xfd00('0x25')](function(_0x5d6134){if(_0x5d6134['length']){var _0x2722c6=_[_0xfd00('0x23')](_0x5d6134,function(_0x328759){return _0x328759[_0xfd00('0x26')]===_0x200c32;});if(_0x2722c6){logger[_0xfd00('0x1f')](_0xfd00('0x27'),_0x200c32);return BPromise[_0xfd00('0x28')]({'id':_0x2722c6['Id'],'name':_0x2722c6[_0xfd00('0x29')]});}}else{logger[_0xfd00('0x1f')](_0xfd00('0x2a'),_0x200c32);return _0x7b2d08[_0xfd00('0x2b')]()[_0xfd00('0x25')](function(_0x497a9a){return BPromise[_0xfd00('0x28')]({'id':_0x497a9a[_0xfd00('0x2c')],'name':_0x497a9a[_0xfd00('0x2d')]});});}});}else{logger['info'](_0xfd00('0x2a'),_0x200c32);return _0x7b2d08[_0xfd00('0x2b')]()['then'](function(_0x1681a2){return BPromise[_0xfd00('0x28')]({'id':_0x1681a2[_0xfd00('0x2c')],'name':_0x1681a2[_0xfd00('0x2d')]});});}}function getEndUser(_0x190d6b,_0x272c76,_0x15dd3b,_0x6078a3,_0x37c0a7){var _0x31b83e={'$or':{'Phone':_0x6078a3}};var _0x47f772={'Id':!![],'Name':!![],'Phone':!![]};return BPromise[_0xfd00('0x28')]()[_0xfd00('0x25')](function(){logger[_0xfd00('0x1f')](_0xfd00('0x2e'),_0x6078a3,_0x272c76[_0xfd00('0x2f')]);switch(_0x272c76[_0xfd00('0x2f')]){case _0xfd00('0x30'):var _0x5f078c=_[_0xfd00('0x31')](_0x31b83e);if(_0x272c76[_0xfd00('0x32')]){var _0x5f0ef8={};_0x5f0ef8[_0x272c76[_0xfd00('0x32')]]=_0x6078a3;_['merge'](_0x5f078c[_0xfd00('0x33')],_0x5f0ef8);}return _0x37c0a7['sobject'](_0xfd00('0x34'))[_0xfd00('0x23')](_0x5f078c,_0x47f772)[_0xfd00('0x24')]()['then'](function(_0xd6ab7f){if(_0xd6ab7f&&_0xd6ab7f[_0xfd00('0x35')]){return _0xd6ab7f;}else{var _0x333303=_[_0xfd00('0x31')](_0x31b83e);if(_0x272c76[_0xfd00('0x36')]){var _0x114f60={};_0x114f60[_0x272c76[_0xfd00('0x36')]]=_0x6078a3;_[_0xfd00('0x37')](_0x333303[_0xfd00('0x33')],_0x114f60);}return _0x37c0a7[_0xfd00('0x21')](_0xfd00('0x38'))['find'](_0x333303,_0x47f772);}});case'account_contact_lead':var _0x587adc=_[_0xfd00('0x31')](_0x31b83e);if(_0x272c76[_0xfd00('0x39')]){var _0x5f0ef8={};_0x5f0ef8[_0x272c76['additionalSearchAccount']]=_0x6078a3;_[_0xfd00('0x37')](_0x587adc['$or'],_0x5f0ef8);}return _0x37c0a7[_0xfd00('0x21')](_0xfd00('0x3a'))[_0xfd00('0x23')](_0x587adc,_0x47f772)[_0xfd00('0x24')]()[_0xfd00('0x25')](function(_0x243e98){if(_0x243e98&&_0x243e98[_0xfd00('0x35')]){return _0x243e98;}else{var _0x579ab3=_['cloneDeep'](_0x31b83e);if(_0x272c76['additionalSearchContact']){var _0x1fc679={};_0x1fc679[_0x272c76['additionalSearchContact']]=_0x6078a3;_['merge'](_0x579ab3[_0xfd00('0x33')],_0x1fc679);}return _0x37c0a7[_0xfd00('0x21')](_0xfd00('0x34'))[_0xfd00('0x23')](_0x579ab3,_0x47f772)[_0xfd00('0x25')](function(_0x6fd4ac){if(_0x6fd4ac&&_0x6fd4ac[_0xfd00('0x35')]){return _0x6fd4ac;}else{var _0x680903=_['cloneDeep'](_0x31b83e);if(_0x272c76[_0xfd00('0x36')]){var _0x31754e={};_0x31754e[_0x272c76[_0xfd00('0x36')]]=_0x6078a3;_[_0xfd00('0x37')](_0x680903[_0xfd00('0x33')],_0x31754e);}return _0x37c0a7[_0xfd00('0x21')]('Lead')[_0xfd00('0x23')](_0x680903,_0x47f772);}});}});case _0xfd00('0x15'):var _0x5f078c=_[_0xfd00('0x31')](_0x31b83e);if(_0x272c76[_0xfd00('0x32')]){var _0x5f0ef8={};_0x5f0ef8[_0x272c76[_0xfd00('0x32')]]=_0x6078a3;_[_0xfd00('0x37')](_0x5f078c['$or'],_0x5f0ef8);}return _0x37c0a7[_0xfd00('0x21')]('Contact')['find'](_0x5f078c,_0x47f772)[_0xfd00('0x24')]();case _0xfd00('0x17'):var _0x427880=_[_0xfd00('0x31')](_0x31b83e);if(_0x272c76[_0xfd00('0x36')]){var _0x5f0ef8={};_0x5f0ef8[_0x272c76[_0xfd00('0x36')]]=_0x6078a3;_['merge'](_0x427880[_0xfd00('0x33')],_0x5f0ef8);}return _0x37c0a7[_0xfd00('0x21')]('Lead')['find'](_0x427880,_0x47f772);case _0xfd00('0x19'):var _0x587adc=_['cloneDeep'](_0x31b83e);if(_0x272c76[_0xfd00('0x39')]){var _0x5f0ef8={};_0x5f0ef8[_0x272c76[_0xfd00('0x39')]]=_0x6078a3;_[_0xfd00('0x37')](_0x587adc[_0xfd00('0x33')],_0x5f0ef8);}return _0x37c0a7[_0xfd00('0x21')](_0xfd00('0x3a'))['find'](_0x587adc,_0x47f772);default:return null;}})[_0xfd00('0x25')](function(_0x127fd9){if(_0x127fd9&&_0x127fd9[_0xfd00('0x35')]){var _0x36e51f=_[_0xfd00('0x3b')](_0x127fd9);if(_0x36e51f){return BPromise['resolve']({'id':_0x36e51f['Id'],'name':_0x36e51f[_0xfd00('0x29')],'phone':_0x36e51f['Phone'],'endUserType':_0x36e51f[_0xfd00('0x3c')]['type'][_0xfd00('0x3d')]()});}}})[_0xfd00('0x25')](function(_0x3d92c5){if(_0x3d92c5){logger[_0xfd00('0x1f')](_0xfd00('0x3e'),_0x3d92c5[_0xfd00('0x16')],_0x6078a3);return BPromise[_0xfd00('0x28')](_0x3d92c5);}else{logger[_0xfd00('0x1f')]('Enduser\x20with\x20phone\x20%s\x20not\x20found',_0x6078a3);var _0x524409={'Phone':_0x6078a3};if(_0x272c76['moduleCreate']){if(_0x272c76[_0xfd00('0x3f')]===_0xfd00('0x15')){logger[_0xfd00('0x1f')](_0xfd00('0x40'),_0x6078a3,_0x272c76[_0xfd00('0x3f')]);_0x524409['LastName']=_0x15dd3b!==_0xfd00('0x41')?_0x15dd3b:util['format'](_0xfd00('0x42'),_0x6078a3);}else if(_0x272c76[_0xfd00('0x3f')]==='lead'){logger[_0xfd00('0x1f')]('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x6078a3,_0x272c76[_0xfd00('0x3f')]);_0x524409[_0xfd00('0x43')]=_0x15dd3b!==_0xfd00('0x41')?_0x15dd3b:util['format'](_0xfd00('0x42'),_0x6078a3);_0x524409[_0xfd00('0x44')]='No\x20Company';}else if(_0x272c76['moduleCreate']===_0xfd00('0x19')){logger['info']('Enduser\x20with\x20phone\x20%s.\x20Creating\x20method\x20used\x20%s.',_0x6078a3,_0x272c76[_0xfd00('0x3f')]);_0x524409[_0xfd00('0x29')]=_0x15dd3b!==_0xfd00('0x41')?_0x15dd3b:util['format'](_0xfd00('0x42'),_0x6078a3);}else{return null;}}return _0x37c0a7[_0xfd00('0x21')](_[_0xfd00('0x45')](_0x272c76[_0xfd00('0x3f')]))[_0xfd00('0x22')](_0x524409)[_0xfd00('0x25')](function(_0xaa29d7){return BPromise[_0xfd00('0x28')]({'id':_0xaa29d7['id'],'endUserType':_0x272c76['moduleCreate']});});}});}function getCustomFields(_0x1b7b00,_0x5efc2d){var _0x510a40={};if(_0x1b7b00[_0xfd00('0x35')]>0x0){_[_0xfd00('0x46')](_0x1b7b00,function(_0x18d959){if(_[_0xfd00('0x47')]([_0xfd00('0x48'),_0xfd00('0x49')],_0x18d959[_0xfd00('0x4a')])&&_0x18d959[_0xfd00('0x4b')]){_0x510a40[_0x18d959['idField']]=_0x18d959[_0xfd00('0x4c')]['toString']();}else if(_0x18d959['type']==='variable'&&_0x18d959[_0xfd00('0x4d')]&&_0x18d959[_0xfd00('0x4b')]){_0x5efc2d[_0x18d959[_0xfd00('0x4d')]]&&(_0x510a40[_0x18d959[_0xfd00('0x4b')]]=_0x5efc2d[_0x18d959[_0xfd00('0x4d')]][_0xfd00('0x4e')]());}else if(_0x18d959[_0xfd00('0x4a')]===_0xfd00('0x4f')&&_0x18d959[_0xfd00('0x50')]&&_0x18d959[_0xfd00('0x50')][_0xfd00('0x51')]&&_0x18d959[_0xfd00('0x4b')]){_0x5efc2d[_0x18d959[_0xfd00('0x50')][_0xfd00('0x51')]['toLowerCase']()]&&(_0x510a40[_0x18d959[_0xfd00('0x4b')]]=_0x5efc2d[_0x18d959[_0xfd00('0x50')][_0xfd00('0x51')]['toLowerCase']()][_0xfd00('0x4e')]());}});}return _0x510a40;}function getConnection(_0x4a9fa5){var _0x397b4f=_0x4a9fa5[_0xfd00('0x52')][_0xfd00('0x53')](_0x4a9fa5['securityToken']);var _0x37799a=new jsforce['Connection']({'oauth2':{'loginUrl':_0x4a9fa5['remoteUri']||'https://login.salesforce.com','clientId':_0x4a9fa5['clientId'],'clientSecret':_0x4a9fa5[_0xfd00('0x54')]}});return _0x37799a[_0xfd00('0x55')](_0x4a9fa5[_0xfd00('0x56')],_0x397b4f)[_0xfd00('0x25')](function(){logger[_0xfd00('0x1f')](_0xfd00('0x57'));return _0x37799a;});}exports['queue']=function(_0x47c0fa,_0x25203a,_0x39738c,_0x3b282c,_0x417158,_0x89371c){var _0x423161,_0x4fc665,_0x5950bc,_0x2b7b3a;_0x89371c['serverUrl']=intUtil[_0xfd00('0x58')](_0x89371c[_0xfd00('0x59')]);_0x89371c['remoteUri']=intUtil[_0xfd00('0x58')](_0x89371c['remoteUri']);if(_0x417158&&_0x417158[_0xfd00('0x5a')]){logger[_0xfd00('0x1f')](_0xfd00('0x5b'),_0xfd00('0x5c'));_0x25203a[_0xfd00('0x5d')]=util[_0xfd00('0x5e')](_0xfd00('0x5f'),_0x89371c[_0xfd00('0x59')],_0x25203a[_0xfd00('0x60')],md5(_0x25203a[_0xfd00('0x60')]));}else{_0x25203a[_0xfd00('0x5d')]='';}return getConnection(_0x89371c)['then'](function(_0x4df179){_0x2b7b3a=_0x4df179;return getUser(_0x89371c,_0x3b282c[_0xfd00('0x61')],_0x2b7b3a);})['then'](function(_0x20e04c){_0x423161=_0x20e04c;return getEndUser(_0x89371c,_0x39738c,_0x25203a['calleridname'],_0x25203a[_0xfd00('0x62')],_0x2b7b3a);})[_0xfd00('0x25')](function(_0xf07442){_0x4fc665=_0xf07442;return getTicket(_0x89371c,_0x423161,_0x4fc665,_0x39738c,_0x25203a,_0x39738c[_0xfd00('0x63')],_0x2b7b3a,_0xfd00('0x64'));})[_0xfd00('0x25')](function(_0x42fb5e){_0x5950bc=_0x42fb5e;logger[_0xfd00('0x1f')](_0xfd00('0x65'),_0x5950bc['id']);logger[_0xfd00('0x1f')]('[QUEUE]\x20Displaying\x20ticket\x20%s\x20to\x20agent\x20%s.\x20Integration\x20account\x20type\x20%s.',_0x5950bc['id'],_0x3b282c[_0xfd00('0x51')],_0x89371c[_0xfd00('0x4a')]);switch(_0x89371c['type']){case _0xfd00('0x66'):emit(util['format'](_0xfd00('0x67'),_0x3b282c[_0xfd00('0x51')]),_0xfd00('0x68'),{'recordId':_0x5950bc['id']});break;case _0xfd00('0x69'):emit(util[_0xfd00('0x5e')](_0xfd00('0x67'),_0x3b282c['name']),_0xfd00('0x6a'),{'uri':util[_0xfd00('0x5e')](_0xfd00('0x6b'),_0x2b7b3a[_0xfd00('0x6c')],_0x5950bc['id'])});break;default:logger[_0xfd00('0x6d')](_0xfd00('0x6e'));}})[_0xfd00('0x6f')](function(_0x4baa7b){logger[_0xfd00('0x6d')](_0xfd00('0x5b'),_0x4baa7b);});};exports[_0xfd00('0x70')]=function(_0x1cec8c,_0x4d53ed,_0xb85e54,_0x37ea69,_0x2e707a,_0x436f64,_0x2844b4){var _0xbc7d94,_0x1d7699,_0x1a5645,_0x3c8d15;_0x436f64[_0xfd00('0x59')]=intUtil[_0xfd00('0x58')](_0x436f64['serverUrl']);_0x436f64['remoteUri']=intUtil[_0xfd00('0x58')](_0x436f64[_0xfd00('0x71')]);if(_0x2844b4&&_0x2844b4[_0xfd00('0x72')]&&_0x2844b4['recordingFormat']!==_0xfd00('0x73')){logger['info']('[OUTBOUND]',_0xfd00('0x5c'));_0x4d53ed[_0xfd00('0x5d')]=util['format'](_0xfd00('0x5f'),_0x436f64[_0xfd00('0x59')],_0x4d53ed[_0xfd00('0x60')],md5(_0x4d53ed[_0xfd00('0x60')]));}return getConnection(_0x436f64)[_0xfd00('0x25')](function(_0x2a4be2){_0x3c8d15=_0x2a4be2;return getUser(_0x436f64,_0x37ea69[_0xfd00('0x61')],_0x3c8d15);})[_0xfd00('0x25')](function(_0x4f8a41){_0xbc7d94=_0x4f8a41;return getEndUser(_0x436f64,_0xb85e54,_0x4d53ed[_0xfd00('0x74')],_0x4d53ed[_0xfd00('0x75')],_0x3c8d15);})[_0xfd00('0x25')](function(_0x46ff20){_0x1d7699=_0x46ff20;return getTicket(_0x436f64,_0xbc7d94,_0x1d7699,_0xb85e54,_0x4d53ed,_0xb85e54[_0xfd00('0x63')],_0x3c8d15,_0xfd00('0x70'));})[_0xfd00('0x25')](function(_0x31cf17){_0x1a5645=_0x31cf17;logger[_0xfd00('0x1f')](_0xfd00('0x76'),_0x1a5645['id']);logger['info'](_0xfd00('0x77'),_0x1a5645['id'],_0x37ea69[_0xfd00('0x51')],_0x436f64['type']);switch(_0x436f64[_0xfd00('0x4a')]){case _0xfd00('0x66'):emit(util[_0xfd00('0x5e')]('user:%s',_0x37ea69[_0xfd00('0x51')]),'trigger:salesforce:display',{'recordId':_0x1a5645['id']});break;case _0xfd00('0x69'):emit(util[_0xfd00('0x5e')](_0xfd00('0x67'),_0x37ea69[_0xfd00('0x51')]),_0xfd00('0x6a'),{'uri':util[_0xfd00('0x5e')]('%s/%s/e',_0x3c8d15[_0xfd00('0x6c')],_0x1a5645['id'])});break;default:logger[_0xfd00('0x6d')](_0xfd00('0x78'),_0xfd00('0x79'));}})[_0xfd00('0x6f')](function(_0x2550ce){logger['error']('[OUTBOUND]',_0x2550ce);});};exports[_0xfd00('0x7a')]=function(_0x5f452b,_0x5a7409,_0x166bb0,_0x462761,_0x592f7e,_0x550e52){var _0x4622ec,_0x15159c,_0x2551f1,_0xe798a4;_0x550e52['serverUrl']=intUtil[_0xfd00('0x58')](_0x550e52['serverUrl']);_0x550e52[_0xfd00('0x71')]=intUtil[_0xfd00('0x58')](_0x550e52[_0xfd00('0x71')]);if(_0x592f7e&&_0x592f7e[_0xfd00('0x5a')]){logger[_0xfd00('0x1f')]('['+_0x5a7409['lastevent'][_0xfd00('0x7b')]()+']',_0xfd00('0x5c'));_0x5a7409[_0xfd00('0x5d')]=util['format'](_0xfd00('0x5f'),_0x550e52[_0xfd00('0x59')],_0x5a7409[_0xfd00('0x60')],md5(_0x5a7409[_0xfd00('0x60')]));}else{_0x5a7409[_0xfd00('0x5d')]='';}return getConnection(_0x550e52)[_0xfd00('0x25')](function(_0x45bc4b){_0xe798a4=_0x45bc4b;if(!_[_0xfd00('0x7c')](_0x462761)){return getUser(_0x550e52,_0x462761[_0xfd00('0x51')],_0xe798a4);}else{return getUser(_0x550e52,null,_0xe798a4);}})[_0xfd00('0x25')](function(_0x2cb8fe){_0x4622ec=_0x2cb8fe;return getEndUser(_0x550e52,_0x166bb0,_0x5a7409[_0xfd00('0x7d')],_0x5a7409[_0xfd00('0x62')],_0xe798a4);})['then'](function(_0x59976a){_0x15159c=_0x59976a;return getTicket(_0x550e52,_0x4622ec,_0x15159c,_0x166bb0,_0x5a7409,_0x166bb0['Fields'],_0xe798a4);})['then'](function(_0x302d3b){_0x2551f1=_0x302d3b;logger[_0xfd00('0x1f')]('['+_0x5a7409[_0xfd00('0x7e')]['toUpperCase']()+']\x20Ticket\x20%s\x20created.',_0x2551f1['id']);logger[_0xfd00('0x1f')]('['+_0x5a7409[_0xfd00('0x7e')][_0xfd00('0x7b')]()+_0xfd00('0x7f'),_0x550e52[_0xfd00('0x4a')]);})[_0xfd00('0x6f')](function(_0x371b2d){logger['error']('['+_0x5a7409[_0xfd00('0x7e')][_0xfd00('0x7b')]()+']',_0x371b2d);});}; \ 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 9fb5c11..e055c74 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 _0x9e51=['catch','error','message','validateEmail','userEmail','GET','sys_user?sysparm_query=email%3D','],\x20getUser\x20entity','result','length','active','true','userId','adminEmail','],\x20getUser\x20crm','toUpperCase',']\x20using\x20admin\x20profile','sys_user?','endUserNumber','System','],\x20EndUser\x20schema','endUserId','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','includes','string','type','nameField','toString','picklist','idField','customField','toLowerCase','variable','variableName','customVariable','Variable','name','outbound','POST','incident','assign','getString','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','label','?sysparm_query=name%3D','Incident','ticketId','Incident\x20-\x20','ticketNumber','forEach','push','all','map','%26sysparm_record_target%3Dincident','%26sysparm_record_list%3Dactive%253Dtrue','/nav_to.do?uri=incident.do?sys_id%3D','format','user:%s','emit','trigger:browser:url','username','sysparm_limit=1','sysparm_display_value=true','stripTrailingSlash','serverUrl','%s/api/now/table/','remoteUri','email','destcalleridnum','callDirection','queue','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','none','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','lodash','bluebird','request-promise','util','md5','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','sys_user?sysparm_query=user_name%3Dadmin','then','adminId','sys_id','info','],\x20getAdminUser\x20crm'];(function(_0x54b52c,_0x309561){var _0x30ec22=function(_0x1296be){while(--_0x1296be){_0x54b52c['push'](_0x54b52c['shift']());}};_0x30ec22(++_0x309561);}(_0x9e51,0x129));var _0x19e5=function(_0x4b2863,_0x494899){_0x4b2863=_0x4b2863-0x0;var _0x567d67=_0x9e51[_0x4b2863];return _0x567d67;};'use strict';var _=require(_0x19e5('0x0'));var Promise=require(_0x19e5('0x1'));var rp=require(_0x19e5('0x2'));var util=require(_0x19e5('0x3'));var md5=require(_0x19e5('0x4'));var Redis=require('ioredis');var intUtil=require(_0x19e5('0x5'));var config=require(_0x19e5('0x6'));var logger=require(_0x19e5('0x7'))(_0x19e5('0x8'));config[_0x19e5('0x9')]=_[_0x19e5('0xa')](config[_0x19e5('0x9')],{'host':'localhost','port':0x18eb});var io=require(_0x19e5('0xb'))(new Redis(config['redis']));function getAdminUser(_0x7baf7,_0x556977,_0x41fb2b,_0x88d870,_0xc9df,_0x200349){return new Promise(function(_0x46eddc,_0x3808a3){var _0x2c638c={'method':'GET','uri':_0x88d870+_0x19e5('0xc')+'&'+_0xc9df+'&'+_0x200349,'auth':_0x556977,'json':!![]};return rp(_0x2c638c)[_0x19e5('0xd')](function(_0x334e75){if(_0x334e75['result']['length']>0x0){_0x41fb2b[_0x19e5('0xe')]=_0x334e75['result'][0x0][_0x19e5('0xf')];}logger[_0x19e5('0x10')]('['+[_0x7baf7['toUpperCase']()]+_0x19e5('0x11'),_0x41fb2b);_0x46eddc(_0x41fb2b);})[_0x19e5('0x12')](function(_0x38d9d4){logger[_0x19e5('0x13')]('['+[_0x7baf7['toUpperCase']()]+']',_0x38d9d4[_0x19e5('0x14')]);_0x3808a3(_0x38d9d4[_0x19e5('0x14')]);});});}function getUser(_0x3f5a36,_0x24cb95,_0x400cc1,_0x1e0fc9,_0x42897c){return function(_0x47e5da){logger[_0x19e5('0x10')]('['+[_0x3f5a36['toUpperCase']()]+'],\x20getUser\x20input\x20crm',_0x47e5da);return new Promise(function(_0x5546b5,_0x141439){if(intUtil[_0x19e5('0x15')](_0x47e5da[_0x19e5('0x16')])){var _0x26f3ad={'method':_0x19e5('0x17'),'uri':_0x400cc1+_0x19e5('0x18')+_0x47e5da[_0x19e5('0x16')]+'&'+_0x1e0fc9+'&'+_0x42897c,'auth':_0x24cb95,'json':!![]};logger[_0x19e5('0x10')]('['+[_0x3f5a36['toUpperCase']()]+'],\x20getUser\x20rp\x20obj',_0x26f3ad);return rp(_0x26f3ad)['then'](function(_0xc0bf38){logger[_0x19e5('0x10')]('['+[_0x3f5a36['toUpperCase']()]+_0x19e5('0x19'),_0xc0bf38);if(_0xc0bf38[_0x19e5('0x1a')][_0x19e5('0x1b')]>0x0&&String(_0xc0bf38['result'][0x0][_0x19e5('0x1c')])===_0x19e5('0x1d')){_0x47e5da[_0x19e5('0x1e')]=_0xc0bf38['result'][0x0]['sys_id'];}else{_0x47e5da[_0x19e5('0x1e')]=_0x47e5da['adminId'];_0x47e5da[_0x19e5('0x16')]=_0x47e5da[_0x19e5('0x1f')];}logger[_0x19e5('0x10')]('['+[_0x3f5a36['toUpperCase']()]+_0x19e5('0x20'),_0x47e5da);_0x5546b5(_0x47e5da);})[_0x19e5('0x12')](function(_0x4b5e56){logger['error']('['+[_0x3f5a36[_0x19e5('0x21')]()]+']',_0x4b5e56[_0x19e5('0x14')]);_0x141439(_0x4b5e56[_0x19e5('0x14')]);});}else{logger[_0x19e5('0x10')]('['+[_0x3f5a36['toUpperCase']()]+_0x19e5('0x22'));_0x47e5da['userId']=_0x47e5da[_0x19e5('0xe')];_0x47e5da[_0x19e5('0x16')]=_0x47e5da['adminEmail'];_0x5546b5(_0x47e5da);}});};}function createEndUser(_0x961f08,_0x4be655,_0x4bec56,_0x2d639a,_0x5c81ae){logger['info']('['+[_0x961f08[_0x19e5('0x21')]()]+'],\x20createEndUser\x20input\x20crm',_0x4bec56);return new Promise(function(_0x32fa36,_0x20fe56){var _0x551438={'method':'POST','uri':_0x2d639a+_0x19e5('0x23')+_0x5c81ae,'body':{'user_name':_0x4bec56[_0x19e5('0x24')],'roles':'user','first_name':_0x4bec56[_0x19e5('0x24')],'active':_0x19e5('0x1d'),'date_format':_0x19e5('0x25'),'phone':_0x4bec56[_0x19e5('0x24')]},'auth':_0x4be655,'json':!![]};return rp(_0x551438)[_0x19e5('0xd')](function(_0xa247f){logger[_0x19e5('0x10')]('['+[_0x961f08[_0x19e5('0x21')]()]+_0x19e5('0x26'),_0xa247f[_0x19e5('0x1a')]);_0x4bec56[_0x19e5('0x27')]=_0xa247f[_0x19e5('0x1a')][_0x19e5('0xf')];_0x32fa36(_0x4bec56);})[_0x19e5('0x12')](function(_0x3e2660){logger[_0x19e5('0x13')]('['+[_0x961f08[_0x19e5('0x21')]()]+']',_0x3e2660[_0x19e5('0x14')]);_0x20fe56(_0x3e2660[_0x19e5('0x14')]);});});}function getEndUser(_0x1f93b9,_0x3561ca,_0x23a87c,_0x467346,_0x558e30){return function(_0x252e63){logger[_0x19e5('0x10')]('['+[_0x1f93b9['toUpperCase']()]+'],\x20getEndUser\x20input\x20crm',_0x252e63);return new Promise(function(_0x145c0f,_0x369dd1){var _0x18658e={'method':'GET','uri':_0x23a87c+_0x19e5('0x28')+_0x252e63['endUserNumber']+'&'+_0x467346+'&'+_0x558e30,'auth':_0x3561ca,'json':!![]};return rp(_0x18658e)[_0x19e5('0xd')](function(_0x2db672){if(_0x2db672[_0x19e5('0x1a')][_0x19e5('0x1b')]>0x0){_0x252e63[_0x19e5('0x27')]=_0x2db672[_0x19e5('0x1a')][0x0]['sys_id'];logger[_0x19e5('0x10')]('['+[_0x1f93b9['toUpperCase']()]+_0x19e5('0x29'),_0x252e63);_0x145c0f(_0x252e63);}else{return createEndUser(_0x1f93b9,_0x3561ca,_0x252e63,_0x23a87c,_0x467346)[_0x19e5('0xd')](function(_0x1dc9d9){logger[_0x19e5('0x10')]('['+[_0x1f93b9[_0x19e5('0x21')]()]+_0x19e5('0x2a'),_0x1dc9d9);_0x145c0f(_0x1dc9d9);});}})[_0x19e5('0x12')](function(_0xe5ff0){logger[_0x19e5('0x13')]('['+[_0x1f93b9['toUpperCase']()]+']',_0xe5ff0['message']);_0x369dd1(_0xe5ff0[_0x19e5('0x14')]);});});};}function getCustomFields(_0x38123c,_0x448d16){var _0x4306c2={};if(_0x38123c['length']>0x0){_['forEach'](_0x38123c,function(_0x3a771e){if(_[_0x19e5('0x2b')]([_0x19e5('0x2c'),'picklist'],_0x3a771e[_0x19e5('0x2d')])&&_0x3a771e['nameField']&&!_0x3a771e['customField']){_0x4306c2[_0x3a771e[_0x19e5('0x2e')]['toLowerCase']()]=_0x3a771e['content'][_0x19e5('0x2f')]();}else if(_['includes']([_0x19e5('0x2c'),_0x19e5('0x30')],_0x3a771e['type'])&&_0x3a771e[_0x19e5('0x31')]&&_0x3a771e[_0x19e5('0x32')]){_0x4306c2[_0x3a771e[_0x19e5('0x31')][_0x19e5('0x33')]()]=_0x3a771e['content']['toString']();}else if(_0x3a771e['type']===_0x19e5('0x34')&&_0x3a771e['variableName']&&_0x3a771e[_0x19e5('0x31')]&&_0x3a771e['customField']){_0x4306c2[_0x3a771e[_0x19e5('0x31')][_0x19e5('0x33')]()]=_0x448d16[_0x3a771e[_0x19e5('0x35')]][_0x19e5('0x2f')]();}else if(_0x3a771e[_0x19e5('0x2d')]===_0x19e5('0x36')&&_0x3a771e[_0x19e5('0x37')]&&_0x3a771e[_0x19e5('0x37')][_0x19e5('0x38')]&&_0x3a771e[_0x19e5('0x31')]&&_0x3a771e[_0x19e5('0x32')]){_0x4306c2[_0x3a771e[_0x19e5('0x31')][_0x19e5('0x33')]()]=_0x448d16[_0x3a771e[_0x19e5('0x37')][_0x19e5('0x38')][_0x19e5('0x33')]()][_0x19e5('0x2f')]();}});}return _0x4306c2;}function getTicket(_0x286469,_0x242b7b,_0xd94c24,_0x14eed2,_0x35671c,_0x1e9aba){return function(_0xa3dd37){logger[_0x19e5('0x10')]('['+[_0x286469[_0x19e5('0x21')]()]+']\x20getTicket\x20input\x20crm',_0xa3dd37);return new Promise(function(_0x720946,_0x34d184){var _0x3c7810=_0x286469[_0x19e5('0x33')]()===_0x19e5('0x39')?_0xa3dd37['userId']:_0xa3dd37[_0x19e5('0x27')];var _0x42c543={'method':_0x19e5('0x3a'),'uri':_0xd94c24+_0x19e5('0x3b')+'?'+_0x1e9aba,'body':Object[_0x19e5('0x3c')]({},{'active':_0x19e5('0x1d'),'caller_id':_0x3c7810,'assigned_to':_0xa3dd37['userId'],'short_description':intUtil[_0x19e5('0x3d')](_0x14eed2['Subjects'],_0x35671c,'\x20'),'description':intUtil[_0x19e5('0x3d')](_0x14eed2[_0x19e5('0x3e')],_0x35671c,'\x0a')},getCustomFields(_0x14eed2[_0x19e5('0x3f')],_0x35671c)),'auth':_0x242b7b,'json':!![]};return rp(_0x42c543)[_0x19e5('0xd')](function(_0x3bcd07){logger[_0x19e5('0x10')]('['+[_0x286469[_0x19e5('0x21')]()]+_0x19e5('0x40'),_0x3bcd07[_0x19e5('0x1a')]);_0xa3dd37['ticketId']=_0x3bcd07[_0x19e5('0x1a')][_0x19e5('0xf')];_0xa3dd37['ticketNumber']=_0x3bcd07[_0x19e5('0x1a')]['number'];logger[_0x19e5('0x10')]('['+[_0x286469[_0x19e5('0x21')]()]+']\x20getTicket\x20crm',_0xa3dd37);_0x720946(_0xa3dd37);})['catch'](function(_0x185315){logger['error']('['+[_0x286469[_0x19e5('0x21')]()]+']',_0x185315[_0x19e5('0x14')]);_0x34d184(_0x185315['message']);});});};}function createRemoteTag(_0x248c26,_0x5aad38,_0xe6c587,_0x2a446b){return new Promise(function(_0x455b12,_0x119098){var _0xf89278={'method':'POST','uri':_0xe6c587+'label'+'?'+_0x2a446b,'body':{'short_description':_0x248c26,'global':!![],'active':!![],'name':_0x248c26},'auth':_0x5aad38,'json':!![]};return rp(_0xf89278)[_0x19e5('0xd')](function(_0x5223ef){var _0x27c0e0=_0x5223ef[_0x19e5('0x1a')]['sys_id'];_0x455b12(_0x27c0e0);});});}function getRemoteTag(_0x16f30e,_0x1d126b,_0x402e2a,_0x17c118,_0x2990ea){return new Promise(function(_0x4f467e,_0x2b4de9){var _0x256fd2={'method':_0x19e5('0x17'),'uri':_0x402e2a+_0x19e5('0x41')+_0x19e5('0x42')+_0x16f30e+'&'+_0x17c118,'auth':_0x1d126b,'json':!![]};return rp(_0x256fd2)[_0x19e5('0xd')](function(_0x3f2a87){if(_0x3f2a87[_0x19e5('0x1a')]['length']>0x0){var _0x2c7793=_0x3f2a87[_0x19e5('0x1a')][0x0][_0x19e5('0xf')];_0x4f467e(_0x2c7793);}else{return createRemoteTag(_0x16f30e,_0x1d126b,_0x402e2a,_0x17c118)[_0x19e5('0xd')](function(_0xfa9c28){_0x4f467e(_0xfa9c28);});}});});}function assignTagToIncident(_0x1554fc,_0x5ab62d,_0x2334e9,_0x4ba439,_0x4d0782){return new Promise(function(_0x397710,_0x352596){var _0x391b8c={'method':'POST','uri':_0x2334e9+'label_entry'+'?'+_0x4d0782,'body':{'label':_0x1554fc,'table':'incident','id_type':_0x19e5('0x43'),'table_key':_0x4ba439[_0x19e5('0x44')],'title':_0x19e5('0x45')+_0x4ba439[_0x19e5('0x46')],'id_display':_0x4ba439[_0x19e5('0x46')]},'auth':_0x5ab62d,'json':!![]};return rp(_0x391b8c)[_0x19e5('0xd')](function(_0x4c0755){_0x397710();})[_0x19e5('0x12')](function(){_0x397710();});});}function manageTags(_0x4552b2,_0x66f54d,_0x4c38cb,_0x10bc6d,_0x3e9b8c,_0x185faf,_0x4fd64e){return new Promise(function(_0x3734f1,_0x2aea4a){var _0x26143b=[];_0x66f54d[_0x19e5('0x47')](function(_0x394c0b){_0x26143b[_0x19e5('0x48')](getRemoteTag(_0x394c0b,_0x4c38cb,_0x10bc6d,_0x185faf,_0x4fd64e));});return Promise[_0x19e5('0x49')](_0x26143b)[_0x19e5('0xd')](function(_0x358627){if(_0x358627[_0x19e5('0x1b')]){logger[_0x19e5('0x10')]('['+[_0x4552b2[_0x19e5('0x21')]()]+']\x20arrayPromises:\x20IDs\x20in\x20table\x20label',_0x358627);var _0x4f6d6c=[];_0x358627['forEach'](function(_0x3c17a6){_0x4f6d6c[_0x19e5('0x48')](assignTagToIncident(_0x3c17a6,_0x4c38cb,_0x10bc6d,_0x3e9b8c,_0x185faf));});return Promise[_0x19e5('0x49')](_0x4f6d6c)['then'](function(){_0x3734f1();})[_0x19e5('0x12')](function(){_0x3734f1();});}else{_0x3734f1();}});});}function getTags(_0xff9a29,_0x4e5b64,_0x195fc5,_0x1a6a04,_0x4983e9,_0x4ac78e){return function(_0x451c25){return new Promise(function(_0x1b1d88,_0x397df7){var _0x502e6e=[];var _0x443b96=_0x1a6a04['Tags'];if(_0x443b96&&_0x443b96[_0x19e5('0x1b')]>0x0){_0x502e6e=_[_0x19e5('0x4a')](_0x443b96,_0x19e5('0x38'));}if(_0x502e6e[_0x19e5('0x1b')]>0x0){return manageTags(_0xff9a29,_0x502e6e,_0x4e5b64,_0x195fc5,_0x451c25,_0x4983e9,_0x4ac78e)[_0x19e5('0xd')](function(){_0x1b1d88(_0x451c25);});}else{_0x1b1d88(_0x451c25);}});};}function emit(_0x5e6b6b,_0x36435f,_0x2d8e86){var _0x598b36=_0x19e5('0x4b')+'%26sysparm_record_row%3D1%26sysparm_record_rows%3D39'+_0x19e5('0x4c')+'%255EORDERBYDESCnumber';var _0x26c3e3={'uri':_0x5e6b6b+_0x19e5('0x4d')+_0x2d8e86+_0x598b36};io['to'](util[_0x19e5('0x4e')](_0x19e5('0x4f'),_0x36435f))[_0x19e5('0x50')](_0x19e5('0x51'),_0x26c3e3);}exports['cs']=function(_0x391b46,_0x518ec9,_0x817742,_0x47c9c8,_0x35cfe8,_0x449ba0,_0x455860,_0x47dad3){var _0x7cee8e={};var _0x42376e={'user':_0x449ba0[_0x19e5('0x52')],'pass':_0x449ba0['password']};var _0x15b6ad=_0x19e5('0x53');var _0x33c7cb=_0x19e5('0x54');_0x449ba0['remoteUri']=intUtil[_0x19e5('0x55')](_0x449ba0['remoteUri']);_0x449ba0['serverUrl']=intUtil[_0x19e5('0x55')](_0x449ba0[_0x19e5('0x56')]);var _0x404cd5=util['format'](_0x19e5('0x57'),_0x449ba0[_0x19e5('0x58')]);_0x7cee8e[_0x19e5('0x16')]=!_['isNil'](_0x47c9c8)?_0x47c9c8['email']:null;_0x7cee8e[_0x19e5('0x1f')]=_0x449ba0[_0x19e5('0x59')];_0x7cee8e[_0x19e5('0x24')]=_0x47dad3[_0x19e5('0x33')]()===_0x19e5('0x39')?_0x518ec9[_0x19e5('0x5a')]:_0x518ec9['calleridnum'];_0x7cee8e[_0x19e5('0x5b')]=_0x47dad3===_0x19e5('0x5c')||_0x47dad3==='unmanaged'?_0x19e5('0x5c'):'outbound';var _0x21b060=util[_0x19e5('0x4e')](_0x19e5('0x5d'),_0x449ba0[_0x19e5('0x56')],_0x518ec9[_0x19e5('0x5e')],md5(_0x518ec9[_0x19e5('0x5e')]));if(_0x35cfe8&&_0x35cfe8[_0x19e5('0x5f')]){logger[_0x19e5('0x10')](_0x19e5('0x60'),_0x19e5('0x61'));_0x518ec9['recordingURL']=_0x21b060;}else if(_0x455860&&_0x455860[_0x19e5('0x62')]&&_0x455860[_0x19e5('0x62')]!==_0x19e5('0x63')){logger[_0x19e5('0x10')](_0x19e5('0x64'),_0x19e5('0x61'));_0x518ec9[_0x19e5('0x65')]=_0x21b060;}else{_0x518ec9[_0x19e5('0x65')]='';}return getAdminUser(_0x47dad3,_0x42376e,_0x7cee8e,_0x404cd5,_0x33c7cb,_0x15b6ad)[_0x19e5('0xd')](getUser(_0x47dad3,_0x42376e,_0x404cd5,_0x33c7cb,_0x15b6ad))['then'](getEndUser(_0x47dad3,_0x42376e,_0x404cd5,_0x33c7cb,_0x15b6ad))[_0x19e5('0xd')](getTicket(_0x47dad3,_0x42376e,_0x404cd5,_0x817742,_0x518ec9,_0x33c7cb))['then'](function(_0x252f88){logger[_0x19e5('0x10')](util[_0x19e5('0x4e')](_0x19e5('0x66'),_0x252f88['ticketId']));logger['info'](util[_0x19e5('0x4e')]('call\x20direction:\x20%s',_0x47dad3));if(_0x47dad3!==_0x19e5('0x67')){logger[_0x19e5('0x10')]('['+[_0x47dad3['toUpperCase']()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x449ba0[_0x19e5('0x58')],_0x47c9c8[_0x19e5('0x38')],_0x252f88[_0x19e5('0x44')]);}})[_0x19e5('0x12')](function(_0x301d43){logger[_0x19e5('0x13')]('['+[_0x47dad3['toUpperCase']()]+_0x19e5('0x68'),util['inspect'](_0x301d43,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0x6da5=['Incident','Incident\x20-\x20','push','all',']\x20arrayPromises:\x20IDs\x20in\x20table\x20label','%26sysparm_record_target%3Dincident','%26sysparm_record_row%3D1%26sysparm_record_rows%3D39','%26sysparm_record_list%3Dactive%253Dtrue','%255EORDERBYDESCnumber','user:%s','username','password','sysparm_limit=1','sysparm_display_value=true','remoteUri','stripTrailingSlash','serverUrl','%s/api/now/table/','isNil','email','destcalleridnum','calleridnum','callDirection','queue','format','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingFormat','[OUTBOUND]','recordingURL','The\x20ticket\x20ID\x20is:\x20%s','call\x20direction:\x20%s','unmanaged',']\x20Error\x20running\x20ServiceNow\x20integration','inspect','bluebird','request-promise','util','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','servicenow','redis','defaults','socket.io-emitter','GET','sys_user?sysparm_query=user_name%3Dadmin','then','result','length','adminId','sys_id','info','toUpperCase','],\x20getAdminUser\x20crm','catch','error','message','userEmail','],\x20getUser\x20entity','active','true','userId','adminEmail','],\x20getUser\x20crm',']\x20using\x20admin\x20profile','],\x20createEndUser\x20input\x20crm','POST','endUserNumber','user','endUserId','],\x20getEndUser\x20input\x20crm','sys_user?sysparm_query=phone%3D','],\x20getEndUser\x20crm','],\x20createEndUser\x20crm','forEach','includes','string','picklist','nameField','customField','toLowerCase','content','toString','type','idField','variable','variableName','customVariable','name',']\x20getTicket\x20input\x20crm','outbound','assign','getString','Subjects','Descriptions','Fields',']\x20POST\x20incident\x20entity\x20schema','ticketId','ticketNumber','number',']\x20getTicket\x20crm','label','?sysparm_query=name%3D','label_entry','incident'];(function(_0x2cd9e8,_0x3520ed){var _0x2f712f=function(_0x769f94){while(--_0x769f94){_0x2cd9e8['push'](_0x2cd9e8['shift']());}};_0x2f712f(++_0x3520ed);}(_0x6da5,0x104));var _0x56da=function(_0x344079,_0x24ccc3){_0x344079=_0x344079-0x0;var _0x1a303c=_0x6da5[_0x344079];return _0x1a303c;};'use strict';var _=require('lodash');var Promise=require(_0x56da('0x0'));var rp=require(_0x56da('0x1'));var util=require(_0x56da('0x2'));var md5=require(_0x56da('0x3'));var Redis=require(_0x56da('0x4'));var intUtil=require(_0x56da('0x5'));var config=require(_0x56da('0x6'));var logger=require(_0x56da('0x7'))(_0x56da('0x8'));config[_0x56da('0x9')]=_[_0x56da('0xa')](config['redis'],{'host':'localhost','port':0x18eb});var io=require(_0x56da('0xb'))(new Redis(config[_0x56da('0x9')]));function getAdminUser(_0x11c38e,_0x540db1,_0xcbcc8c,_0x21f793,_0x4411bb,_0x22bb8e){return new Promise(function(_0x25a05e,_0x23c889){var _0x50f428={'method':_0x56da('0xc'),'uri':_0x21f793+_0x56da('0xd')+'&'+_0x4411bb+'&'+_0x22bb8e,'auth':_0x540db1,'json':!![]};return rp(_0x50f428)[_0x56da('0xe')](function(_0x5699d6){if(_0x5699d6[_0x56da('0xf')][_0x56da('0x10')]>0x0){_0xcbcc8c[_0x56da('0x11')]=_0x5699d6[_0x56da('0xf')][0x0][_0x56da('0x12')];}logger[_0x56da('0x13')]('['+[_0x11c38e[_0x56da('0x14')]()]+_0x56da('0x15'),_0xcbcc8c);_0x25a05e(_0xcbcc8c);})[_0x56da('0x16')](function(_0x3f3df0){logger[_0x56da('0x17')]('['+[_0x11c38e[_0x56da('0x14')]()]+']',_0x3f3df0[_0x56da('0x18')]);_0x23c889(_0x3f3df0['message']);});});}function getUser(_0x29cc9f,_0x46e3a4,_0x366167,_0x504cf9,_0x1acf7c){return function(_0x4dcd3b){logger['info']('['+[_0x29cc9f[_0x56da('0x14')]()]+'],\x20getUser\x20input\x20crm',_0x4dcd3b);return new Promise(function(_0x212204,_0x329eeb){if(intUtil['validateEmail'](_0x4dcd3b['userEmail'])){var _0x339d70={'method':'GET','uri':_0x366167+'sys_user?sysparm_query=email%3D'+_0x4dcd3b[_0x56da('0x19')]+'&'+_0x504cf9+'&'+_0x1acf7c,'auth':_0x46e3a4,'json':!![]};logger[_0x56da('0x13')]('['+[_0x29cc9f[_0x56da('0x14')]()]+'],\x20getUser\x20rp\x20obj',_0x339d70);return rp(_0x339d70)[_0x56da('0xe')](function(_0x1c5f78){logger[_0x56da('0x13')]('['+[_0x29cc9f[_0x56da('0x14')]()]+_0x56da('0x1a'),_0x1c5f78);if(_0x1c5f78[_0x56da('0xf')][_0x56da('0x10')]>0x0&&String(_0x1c5f78['result'][0x0][_0x56da('0x1b')])===_0x56da('0x1c')){_0x4dcd3b['userId']=_0x1c5f78[_0x56da('0xf')][0x0][_0x56da('0x12')];}else{_0x4dcd3b[_0x56da('0x1d')]=_0x4dcd3b[_0x56da('0x11')];_0x4dcd3b[_0x56da('0x19')]=_0x4dcd3b[_0x56da('0x1e')];}logger[_0x56da('0x13')]('['+[_0x29cc9f[_0x56da('0x14')]()]+_0x56da('0x1f'),_0x4dcd3b);_0x212204(_0x4dcd3b);})[_0x56da('0x16')](function(_0x21b66e){logger[_0x56da('0x17')]('['+[_0x29cc9f[_0x56da('0x14')]()]+']',_0x21b66e['message']);_0x329eeb(_0x21b66e[_0x56da('0x18')]);});}else{logger['info']('['+[_0x29cc9f['toUpperCase']()]+_0x56da('0x20'));_0x4dcd3b[_0x56da('0x1d')]=_0x4dcd3b[_0x56da('0x11')];_0x4dcd3b[_0x56da('0x19')]=_0x4dcd3b['adminEmail'];_0x212204(_0x4dcd3b);}});};}function createEndUser(_0x57763b,_0x2d1f1e,_0xc75551,_0x25162e,_0x2a11a2){logger[_0x56da('0x13')]('['+[_0x57763b[_0x56da('0x14')]()]+_0x56da('0x21'),_0xc75551);return new Promise(function(_0x4320e2,_0x19ef8f){var _0x186dd4={'method':_0x56da('0x22'),'uri':_0x25162e+'sys_user?'+_0x2a11a2,'body':{'user_name':_0xc75551[_0x56da('0x23')],'roles':_0x56da('0x24'),'first_name':_0xc75551[_0x56da('0x23')],'active':_0x56da('0x1c'),'date_format':'System','phone':_0xc75551['endUserNumber']},'auth':_0x2d1f1e,'json':!![]};return rp(_0x186dd4)[_0x56da('0xe')](function(_0x45e3f6){logger[_0x56da('0x13')]('['+[_0x57763b[_0x56da('0x14')]()]+'],\x20EndUser\x20schema',_0x45e3f6[_0x56da('0xf')]);_0xc75551[_0x56da('0x25')]=_0x45e3f6[_0x56da('0xf')][_0x56da('0x12')];_0x4320e2(_0xc75551);})['catch'](function(_0x1629ed){logger['error']('['+[_0x57763b[_0x56da('0x14')]()]+']',_0x1629ed[_0x56da('0x18')]);_0x19ef8f(_0x1629ed[_0x56da('0x18')]);});});}function getEndUser(_0x149a94,_0xd9becf,_0x43bb0d,_0x311b67,_0x189dc3){return function(_0x386f4e){logger[_0x56da('0x13')]('['+[_0x149a94[_0x56da('0x14')]()]+_0x56da('0x26'),_0x386f4e);return new Promise(function(_0x398e6c,_0x5b583a){var _0x2dcb8e={'method':_0x56da('0xc'),'uri':_0x43bb0d+_0x56da('0x27')+_0x386f4e['endUserNumber']+'&'+_0x311b67+'&'+_0x189dc3,'auth':_0xd9becf,'json':!![]};return rp(_0x2dcb8e)[_0x56da('0xe')](function(_0x240d40){if(_0x240d40[_0x56da('0xf')][_0x56da('0x10')]>0x0){_0x386f4e[_0x56da('0x25')]=_0x240d40[_0x56da('0xf')][0x0]['sys_id'];logger[_0x56da('0x13')]('['+[_0x149a94[_0x56da('0x14')]()]+_0x56da('0x28'),_0x386f4e);_0x398e6c(_0x386f4e);}else{return createEndUser(_0x149a94,_0xd9becf,_0x386f4e,_0x43bb0d,_0x311b67)[_0x56da('0xe')](function(_0x98f7ae){logger[_0x56da('0x13')]('['+[_0x149a94[_0x56da('0x14')]()]+_0x56da('0x29'),_0x98f7ae);_0x398e6c(_0x98f7ae);});}})[_0x56da('0x16')](function(_0x4fe155){logger[_0x56da('0x17')]('['+[_0x149a94[_0x56da('0x14')]()]+']',_0x4fe155[_0x56da('0x18')]);_0x5b583a(_0x4fe155[_0x56da('0x18')]);});});};}function getCustomFields(_0x294ff2,_0x4d2c11){var _0x23332a={};if(_0x294ff2[_0x56da('0x10')]>0x0){_[_0x56da('0x2a')](_0x294ff2,function(_0x4b8c2d){if(_[_0x56da('0x2b')]([_0x56da('0x2c'),_0x56da('0x2d')],_0x4b8c2d['type'])&&_0x4b8c2d[_0x56da('0x2e')]&&!_0x4b8c2d[_0x56da('0x2f')]){_0x23332a[_0x4b8c2d[_0x56da('0x2e')][_0x56da('0x30')]()]=_0x4b8c2d[_0x56da('0x31')][_0x56da('0x32')]();}else if(_[_0x56da('0x2b')]([_0x56da('0x2c'),_0x56da('0x2d')],_0x4b8c2d[_0x56da('0x33')])&&_0x4b8c2d['idField']&&_0x4b8c2d[_0x56da('0x2f')]){_0x23332a[_0x4b8c2d[_0x56da('0x34')][_0x56da('0x30')]()]=_0x4b8c2d[_0x56da('0x31')][_0x56da('0x32')]();}else if(_0x4b8c2d['type']===_0x56da('0x35')&&_0x4b8c2d[_0x56da('0x36')]&&_0x4b8c2d[_0x56da('0x34')]&&_0x4b8c2d[_0x56da('0x2f')]){_0x23332a[_0x4b8c2d['idField']['toLowerCase']()]=_0x4d2c11[_0x4b8c2d['variableName']][_0x56da('0x32')]();}else if(_0x4b8c2d[_0x56da('0x33')]===_0x56da('0x37')&&_0x4b8c2d['Variable']&&_0x4b8c2d['Variable']['name']&&_0x4b8c2d[_0x56da('0x34')]&&_0x4b8c2d['customField']){_0x23332a[_0x4b8c2d['idField']['toLowerCase']()]=_0x4d2c11[_0x4b8c2d['Variable'][_0x56da('0x38')][_0x56da('0x30')]()]['toString']();}});}return _0x23332a;}function getTicket(_0x5733e1,_0x2d61a1,_0x1b98df,_0x27e8cb,_0x34db2b,_0x13daf2){return function(_0x2f2316){logger[_0x56da('0x13')]('['+[_0x5733e1['toUpperCase']()]+_0x56da('0x39'),_0x2f2316);return new Promise(function(_0x198b45,_0x11cacd){var _0x5ab9e5=_0x5733e1[_0x56da('0x30')]()===_0x56da('0x3a')?_0x2f2316[_0x56da('0x1d')]:_0x2f2316[_0x56da('0x25')];var _0x533aa1={'method':_0x56da('0x22'),'uri':_0x1b98df+'incident'+'?'+_0x13daf2,'body':Object[_0x56da('0x3b')]({},{'active':_0x56da('0x1c'),'caller_id':_0x5ab9e5,'assigned_to':_0x2f2316['userId'],'short_description':intUtil[_0x56da('0x3c')](_0x27e8cb[_0x56da('0x3d')],_0x34db2b,'\x20'),'description':intUtil[_0x56da('0x3c')](_0x27e8cb[_0x56da('0x3e')],_0x34db2b,'\x0a')},getCustomFields(_0x27e8cb[_0x56da('0x3f')],_0x34db2b)),'auth':_0x2d61a1,'json':!![]};return rp(_0x533aa1)[_0x56da('0xe')](function(_0x3ba4df){logger['info']('['+[_0x5733e1[_0x56da('0x14')]()]+_0x56da('0x40'),_0x3ba4df[_0x56da('0xf')]);_0x2f2316[_0x56da('0x41')]=_0x3ba4df[_0x56da('0xf')]['sys_id'];_0x2f2316[_0x56da('0x42')]=_0x3ba4df[_0x56da('0xf')][_0x56da('0x43')];logger[_0x56da('0x13')]('['+[_0x5733e1[_0x56da('0x14')]()]+_0x56da('0x44'),_0x2f2316);_0x198b45(_0x2f2316);})[_0x56da('0x16')](function(_0x41a6f9){logger[_0x56da('0x17')]('['+[_0x5733e1[_0x56da('0x14')]()]+']',_0x41a6f9['message']);_0x11cacd(_0x41a6f9[_0x56da('0x18')]);});});};}function createRemoteTag(_0x4b6a10,_0x2a83b2,_0x316f8f,_0x4f2258){return new Promise(function(_0x47eb30,_0x1c0d7f){var _0x47ea9d={'method':_0x56da('0x22'),'uri':_0x316f8f+'label'+'?'+_0x4f2258,'body':{'short_description':_0x4b6a10,'global':!![],'active':!![],'name':_0x4b6a10},'auth':_0x2a83b2,'json':!![]};return rp(_0x47ea9d)[_0x56da('0xe')](function(_0x424620){var _0x3de894=_0x424620['result'][_0x56da('0x12')];_0x47eb30(_0x3de894);});});}function getRemoteTag(_0x2c8bd9,_0x1f8413,_0x435c94,_0x587c41,_0x8cb3bd){return new Promise(function(_0x4ef577,_0x1cc9be){var _0x462650={'method':'GET','uri':_0x435c94+_0x56da('0x45')+_0x56da('0x46')+_0x2c8bd9+'&'+_0x587c41,'auth':_0x1f8413,'json':!![]};return rp(_0x462650)[_0x56da('0xe')](function(_0x299535){if(_0x299535[_0x56da('0xf')][_0x56da('0x10')]>0x0){var _0x55112c=_0x299535[_0x56da('0xf')][0x0][_0x56da('0x12')];_0x4ef577(_0x55112c);}else{return createRemoteTag(_0x2c8bd9,_0x1f8413,_0x435c94,_0x587c41)['then'](function(_0x5706ee){_0x4ef577(_0x5706ee);});}});});}function assignTagToIncident(_0x5a0a11,_0x8facbb,_0x3da080,_0x399446,_0x1f6491){return new Promise(function(_0x430bd5,_0x522c48){var _0x580ab0={'method':_0x56da('0x22'),'uri':_0x3da080+_0x56da('0x47')+'?'+_0x1f6491,'body':{'label':_0x5a0a11,'table':_0x56da('0x48'),'id_type':_0x56da('0x49'),'table_key':_0x399446['ticketId'],'title':_0x56da('0x4a')+_0x399446['ticketNumber'],'id_display':_0x399446['ticketNumber']},'auth':_0x8facbb,'json':!![]};return rp(_0x580ab0)[_0x56da('0xe')](function(_0x8b0e56){_0x430bd5();})[_0x56da('0x16')](function(){_0x430bd5();});});}function manageTags(_0x50ef91,_0x3c928e,_0x15b4be,_0x281542,_0x2d51cb,_0x4314d4,_0x296937){return new Promise(function(_0x208081,_0x15bac0){var _0x288124=[];_0x3c928e[_0x56da('0x2a')](function(_0x2089ad){_0x288124[_0x56da('0x4b')](getRemoteTag(_0x2089ad,_0x15b4be,_0x281542,_0x4314d4,_0x296937));});return Promise[_0x56da('0x4c')](_0x288124)[_0x56da('0xe')](function(_0xa13547){if(_0xa13547[_0x56da('0x10')]){logger['info']('['+[_0x50ef91[_0x56da('0x14')]()]+_0x56da('0x4d'),_0xa13547);var _0xcfec52=[];_0xa13547[_0x56da('0x2a')](function(_0x329cbc){_0xcfec52[_0x56da('0x4b')](assignTagToIncident(_0x329cbc,_0x15b4be,_0x281542,_0x2d51cb,_0x4314d4));});return Promise[_0x56da('0x4c')](_0xcfec52)[_0x56da('0xe')](function(){_0x208081();})[_0x56da('0x16')](function(){_0x208081();});}else{_0x208081();}});});}function getTags(_0x193d93,_0x1318d8,_0x170c6a,_0x1a9efa,_0x13c007,_0x24a2e5){return function(_0x5a7123){return new Promise(function(_0x15ed3a,_0x5a84d2){var _0x3e2a1=[];var _0xbe7097=_0x1a9efa['Tags'];if(_0xbe7097&&_0xbe7097[_0x56da('0x10')]>0x0){_0x3e2a1=_['map'](_0xbe7097,_0x56da('0x38'));}if(_0x3e2a1[_0x56da('0x10')]>0x0){return manageTags(_0x193d93,_0x3e2a1,_0x1318d8,_0x170c6a,_0x5a7123,_0x13c007,_0x24a2e5)[_0x56da('0xe')](function(){_0x15ed3a(_0x5a7123);});}else{_0x15ed3a(_0x5a7123);}});};}function emit(_0x5d030c,_0x10c3ba,_0x2ef2c6){var _0x2eb916=_0x56da('0x4e')+_0x56da('0x4f')+_0x56da('0x50')+_0x56da('0x51');var _0x19b71a={'uri':_0x5d030c+'/nav_to.do?uri=incident.do?sys_id%3D'+_0x2ef2c6+_0x2eb916};io['to'](util['format'](_0x56da('0x52'),_0x10c3ba))['emit']('trigger:browser:url',_0x19b71a);}exports['cs']=function(_0x2a51f0,_0x2c8597,_0x1f6b05,_0x2ec546,_0x260d2f,_0x380f73,_0xafe4a0,_0x134ace){var _0x20cf7f={};var _0x1a16cc={'user':_0x380f73[_0x56da('0x53')],'pass':_0x380f73[_0x56da('0x54')]};var _0x268274=_0x56da('0x55');var _0x1be675=_0x56da('0x56');_0x380f73[_0x56da('0x57')]=intUtil[_0x56da('0x58')](_0x380f73[_0x56da('0x57')]);_0x380f73[_0x56da('0x59')]=intUtil[_0x56da('0x58')](_0x380f73[_0x56da('0x59')]);var _0x2e22d5=util['format'](_0x56da('0x5a'),_0x380f73[_0x56da('0x57')]);_0x20cf7f[_0x56da('0x19')]=!_[_0x56da('0x5b')](_0x2ec546)?_0x2ec546[_0x56da('0x5c')]:null;_0x20cf7f[_0x56da('0x1e')]=_0x380f73['email'];_0x20cf7f[_0x56da('0x23')]=_0x134ace[_0x56da('0x30')]()==='outbound'?_0x2c8597[_0x56da('0x5d')]:_0x2c8597[_0x56da('0x5e')];_0x20cf7f[_0x56da('0x5f')]=_0x134ace===_0x56da('0x60')||_0x134ace==='unmanaged'?_0x56da('0x60'):_0x56da('0x3a');var _0x3d07aa=util[_0x56da('0x61')](_0x56da('0x62'),_0x380f73['serverUrl'],_0x2c8597[_0x56da('0x63')],md5(_0x2c8597['uniqueid']));if(_0x260d2f&&_0x260d2f[_0x56da('0x64')]){logger[_0x56da('0x13')](_0x56da('0x65'),_0x56da('0x66'));_0x2c8597['recordingURL']=_0x3d07aa;}else if(_0xafe4a0&&_0xafe4a0['recordingFormat']&&_0xafe4a0[_0x56da('0x67')]!=='none'){logger[_0x56da('0x13')](_0x56da('0x68'),_0x56da('0x66'));_0x2c8597[_0x56da('0x69')]=_0x3d07aa;}else{_0x2c8597[_0x56da('0x69')]='';}return getAdminUser(_0x134ace,_0x1a16cc,_0x20cf7f,_0x2e22d5,_0x1be675,_0x268274)['then'](getUser(_0x134ace,_0x1a16cc,_0x2e22d5,_0x1be675,_0x268274))['then'](getEndUser(_0x134ace,_0x1a16cc,_0x2e22d5,_0x1be675,_0x268274))['then'](getTicket(_0x134ace,_0x1a16cc,_0x2e22d5,_0x1f6b05,_0x2c8597,_0x1be675))[_0x56da('0xe')](function(_0x345750){logger[_0x56da('0x13')](util[_0x56da('0x61')](_0x56da('0x6a'),_0x345750[_0x56da('0x41')]));logger[_0x56da('0x13')](util['format'](_0x56da('0x6b'),_0x134ace));if(_0x134ace!==_0x56da('0x6c')){logger['info']('['+[_0x134ace[_0x56da('0x14')]()]+']','Displaying\x20call\x20in\x20a\x20new\x20tab...');emit(_0x380f73[_0x56da('0x57')],_0x2ec546[_0x56da('0x38')],_0x345750[_0x56da('0x41')]);}})[_0x56da('0x16')](function(_0x55ddc1){logger[_0x56da('0x17')]('['+[_0x134ace[_0x56da('0x14')]()]+_0x56da('0x6d'),util[_0x56da('0x6e')](_0x55ddc1,{'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 0f0777f..8e4dd46 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 _0xe963=['push','idField','Calls','format','apiKey','toString','base64','get_server_info','JSON','stringify','Getting\x20agent\x20with\x20name','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!','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','resolve','Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','contacts.phone_home\x20=\x20\x22%s\x22','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','debug','[HTTP]','merge','type','string','nameField','customField','toLowerCase','custom_fields','content','variable','customVariable','Variable','login','username','password','PLAIN','xCALLY\x20Motion\x20integration','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','%s/service/v4_1/rest.php','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Inbound','Ticket\x20created!','users','contacts','charAt','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','user:%s','catch','error','outbound','uri','recordingFormat','none','destcalleridname','destcalleridnum','Fields','Outbound','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','[OUTBOUND]','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','unmanaged','lastevent','toUpperCase','isNil','The\x20Ticket\x20ID\x20is:','lodash','request-promise','md5','util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','POST','emit','info','Creating\x20new\x20ticket...','getString','Subjects','assigned_user_id','created_by','description','Descriptions','slice','replace','duration_minutes','parent_type','Contacts','name','direction','length','forEach','variableName'];(function(_0x3649a6,_0x2004a5){var _0x55f5e5=function(_0xedd7e5){while(--_0xedd7e5){_0x3649a6['push'](_0x3649a6['shift']());}};_0x55f5e5(++_0x2004a5);}(_0xe963,0x151));var _0x3e96=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xe963[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x3e96('0x0'));var rp=require(_0x3e96('0x1'));var BPromise=require('bluebird');var md5=require(_0x3e96('0x2'));var util=require(_0x3e96('0x3'));var Redis=require('ioredis');var intUtil=require('./util');var config=require(_0x3e96('0x4'));var logger=require(_0x3e96('0x5'))('sugarcrm');config[_0x3e96('0x6')]=_[_0x3e96('0x7')](config[_0x3e96('0x6')],{'host':_0x3e96('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x3e96('0x6')]));var def={'method':_0x3e96('0x9'),'json':!![]};function emit(_0xf1f29d,_0x42a76b,_0x3f3013){io['to'](_0xf1f29d)[_0x3e96('0xa')](_0x42a76b,_0x3f3013);}function getTicket(_0xef1c2b,_0x4c91b2,_0x878a3a,_0x1db077,_0x17868a,_0x528dc9,_0x2e5680,_0x2196e5){logger[_0x3e96('0xb')](_0x3e96('0xc'));var _0x47d077=new Date();var _0x432208=[{'name':'name','value':intUtil[_0x3e96('0xd')](_0x1db077[_0x3e96('0xe')],_0x17868a,'\x20')},{'name':_0x3e96('0xf'),'value':_0x4c91b2['id']},{'name':_0x3e96('0x10'),'value':_0x4c91b2['id']},{'name':_0x3e96('0x11'),'value':intUtil['getString'](_0x1db077[_0x3e96('0x12')],_0x17868a,'\x0a')},{'name':'date_start','value':_0x47d077['toISOString']()[_0x3e96('0x13')](0x0,0x13)[_0x3e96('0x14')]('T','\x20')},{'name':'duration_hours','value':'0'},{'name':_0x3e96('0x15'),'value':'15'},{'name':'parent_id','value':_0x878a3a['id']},{'name':_0x3e96('0x16'),'value':_0x3e96('0x17')},{'name':'parent_name','value':_0x878a3a[_0x3e96('0x18')]},{'name':_0x3e96('0x19'),'value':_0x2196e5}];if(_0x528dc9[_0x3e96('0x1a')]){_[_0x3e96('0x1b')](_0x528dc9,function(_0x3bc42e){if(_0x17868a[_0x3bc42e[_0x3e96('0x1c')]]){_0x432208[_0x3e96('0x1d')]({'name':_0x3bc42e[_0x3e96('0x1e')],'value':_0x17868a[_0x3bc42e[_0x3e96('0x1c')]]});}});}return request({'form':{'method':'set_entry','input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'session':_0x2e5680['id'],'module_name':_0x3e96('0x1f'),'name_value_list':_0x432208})}});}function getAuth(_0x2b10f8){return util[_0x3e96('0x20')]('Basic\x20%s',new Buffer(_0x2b10f8[_0x3e96('0x21')]+':X')[_0x3e96('0x22')](_0x3e96('0x23')));}function getServerInfo(_0x3698f9){return request({'form':{'method':_0x3e96('0x24'),'input_type':'JSON','response_type':_0x3e96('0x25'),'rest_data':JSON[_0x3e96('0x26')]({'session':_0x3698f9['id']})}});}function getUser(_0x32e0c6,_0x5b393e,_0x91225b){if(!_['isNil'](_0x5b393e)){logger[_0x3e96('0xb')](_0x3e96('0x27'),_0x5b393e);return request({'form':{'method':_0x3e96('0x28'),'input_type':_0x3e96('0x25'),'response_type':_0x3e96('0x25'),'rest_data':JSON['stringify']({'session':_0x91225b['id'],'module_name':_0x3e96('0x29'),'query':util[_0x3e96('0x20')](_0x3e96('0x2a'),_0x5b393e),'order_by':'','offset':'0','select_fields':['id','name',_0x3e96('0x2b')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x3e96('0x2c')](function(_0x449441){if(_0x449441[_0x3e96('0x2d')][_0x3e96('0x1a')]){var _0x5489b5=_[_0x3e96('0x2e')](_0x449441[_0x3e96('0x2d')],function(_0x3d3ca0){return _0x3d3ca0[_0x3e96('0x2f')][_0x3e96('0x2b')][_0x3e96('0x30')]===_0x5b393e;});if(_0x5489b5){logger[_0x3e96('0xb')](_0x3e96('0x31'));return BPromise['resolve']({'id':_0x5489b5[_0x3e96('0x2f')]['id'][_0x3e96('0x30')],'name':_0x5489b5[_0x3e96('0x2f')][_0x3e96('0x18')][_0x3e96('0x30')]});}}logger[_0x3e96('0xb')](_0x3e96('0x32'));return BPromise[_0x3e96('0x33')]({'id':_0x91225b[_0x3e96('0x2f')]['user_id'][_0x3e96('0x30')],'name':_0x91225b[_0x3e96('0x2f')][_0x3e96('0x2b')][_0x3e96('0x30')]});});}else{logger[_0x3e96('0xb')](_0x3e96('0x34'));return BPromise['resolve']({'id':_0x91225b[_0x3e96('0x2f')][_0x3e96('0x35')][_0x3e96('0x30')],'name':_0x91225b[_0x3e96('0x2f')][_0x3e96('0x2b')][_0x3e96('0x30')]});}}function getEndUser(_0xbad9e5,_0x1d4f20,_0x376cc1,_0x2dbe3a){logger[_0x3e96('0xb')](_0x3e96('0x36'),_0x376cc1);return request({'form':{'method':_0x3e96('0x28'),'input_type':'JSON','response_type':_0x3e96('0x25'),'rest_data':JSON[_0x3e96('0x26')]({'session':_0x2dbe3a['id'],'module_name':_0x3e96('0x17'),'query':util[_0x3e96('0x20')](_0x3e96('0x37'),_0x376cc1),'order_by':'','offset':'0','select_fields':['id',_0x3e96('0x18'),'phone_home'],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x52853a){if(_0x52853a['entry_list'][_0x3e96('0x1a')]){var _0x4564ea=_[_0x3e96('0x2e')](_0x52853a['entry_list'],function(_0x20645b){return _0x20645b[_0x3e96('0x2f')][_0x3e96('0x38')][_0x3e96('0x30')]===_0x376cc1;});if(_0x4564ea){logger[_0x3e96('0xb')](_0x3e96('0x39'));return BPromise[_0x3e96('0x33')]({'id':_0x4564ea[_0x3e96('0x2f')]['id'][_0x3e96('0x30')],'name':_0x4564ea[_0x3e96('0x2f')][_0x3e96('0x18')][_0x3e96('0x30')],'phone':_0x4564ea['name_value_list'][_0x3e96('0x38')][_0x3e96('0x30')]});}}else{logger[_0x3e96('0xb')](_0x3e96('0x3a'));return request({'form':{'method':'set_entry','input_type':_0x3e96('0x25'),'response_type':_0x3e96('0x25'),'rest_data':JSON[_0x3e96('0x26')]({'session':_0x2dbe3a['id'],'module_name':_0x3e96('0x17'),'name_value_list':[{'name':_0x3e96('0x3b'),'value':_0x1d4f20!==_0x3e96('0x3c')?_0x1d4f20:util[_0x3e96('0x20')]('Caller\x20-\x20%s',_0x376cc1)},{'name':'phone_home','value':_0x376cc1}]})}})[_0x3e96('0x2c')](function(_0x9a7315){logger['info']('Enduser\x20created.');return BPromise[_0x3e96('0x33')]({'id':_0x9a7315['id'],'name':_0x9a7315['entry_list']['first_name'][_0x3e96('0x30')],'phone':_0x9a7315[_0x3e96('0x2d')][_0x3e96('0x38')]['value']});});}});}function request(_0x1dbc98){logger[_0x3e96('0x3d')](_0x3e96('0x3e'),JSON[_0x3e96('0x26')](_0x1dbc98));return rp(_[_0x3e96('0x3f')](def,_0x1dbc98));}function getTags(_0x4803be,_0x1a2af3){var _0x4e9524=[];if(_0x4803be&&_0x4803be['length']>0x0){_0x4e9524=_['map'](_0x4803be,_0x1a2af3);}return _0x4e9524;}function getCustomFields(_0x353309,_0x24e1d8){var _0x5e80f3=[];var _0x366e8d={'custom_fields':[]};if(_0x353309['length']>0x0){_[_0x3e96('0x1b')](_0x353309,function(_0x2dc255){if(_0x2dc255[_0x3e96('0x40')]===_0x3e96('0x41')&&_0x2dc255[_0x3e96('0x42')]&&!_0x2dc255[_0x3e96('0x43')]){_0x366e8d[_0x2dc255[_0x3e96('0x42')][_0x3e96('0x44')]()]=_0x2dc255['content']['toString']();}else if(_0x2dc255[_0x3e96('0x40')]===_0x3e96('0x41')&&_0x2dc255[_0x3e96('0x1e')]&&_0x2dc255[_0x3e96('0x43')]){_0x366e8d[_0x3e96('0x45')][_0x3e96('0x1d')]({'id':_0x2dc255[_0x3e96('0x1e')],'value':_0x2dc255[_0x3e96('0x46')]['toString']()});}else if(_0x2dc255[_0x3e96('0x40')]===_0x3e96('0x47')&&_0x2dc255[_0x3e96('0x1c')]&&_0x2dc255['idField']&&_0x2dc255[_0x3e96('0x43')]){_0x24e1d8[_0x2dc255[_0x3e96('0x1c')]]&&_0x366e8d[_0x3e96('0x45')]['push']({'id':_0x2dc255[_0x3e96('0x1e')],'value':_0x24e1d8[_0x2dc255['variableName']]['toString']()});}else if(_0x2dc255[_0x3e96('0x40')]===_0x3e96('0x48')&&_0x2dc255[_0x3e96('0x49')]&&_0x2dc255['Variable'][_0x3e96('0x18')]&&_0x2dc255[_0x3e96('0x1e')]&&_0x2dc255['customField']){_0x24e1d8[_0x2dc255['Variable'][_0x3e96('0x18')][_0x3e96('0x44')]()]&&_0x366e8d[_0x3e96('0x45')][_0x3e96('0x1d')]({'id':_0x2dc255['idField'],'value':_0x24e1d8[_0x2dc255['Variable'][_0x3e96('0x18')][_0x3e96('0x44')]()][_0x3e96('0x22')]()});}});}return _0x366e8d;}function getConnection(_0x330143){return request({'method':_0x3e96('0x9'),'form':{'method':_0x3e96('0x4a'),'input_type':'JSON','response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x330143[_0x3e96('0x4b')],'password':_0x330143[_0x3e96('0x4c')],'encryption':_0x3e96('0x4d')},'application':_0x3e96('0x4e')})}})[_0x3e96('0x2c')](function(_0x257d1b){var _0x140705=_0x257d1b;if(_0x140705['id']){def['sessionID']=_0x140705['id'];return BPromise['resolve'](_0x140705);}else{throw new Error(util[_0x3e96('0x20')](_0x3e96('0x4f'),_0x330143['id']));}});}function setRelationship(_0x346fbf,_0x3ef0b5,_0x26aa1b,_0x136eff){return request({'form':{'method':_0x3e96('0x50'),'input_type':'JSON','response_type':_0x3e96('0x25'),'rest_data':JSON['stringify']({'session':_0x346fbf['id'],'module_name':'Calls','module_id':_0x26aa1b['id'],'link_field_name':_0x136eff,'related_ids':[_0x3ef0b5['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x1bb508,_0x11b745,_0x5da954,_0x55f6bf,_0x4e93ba,_0x257caa){var _0x5d7dd4,_0x31946a,_0x10c02c,_0x56134d;_0x257caa[_0x3e96('0x51')]=intUtil[_0x3e96('0x52')](_0x257caa[_0x3e96('0x51')]);_0x257caa['serverUrl']=intUtil[_0x3e96('0x52')](_0x257caa['serverUrl']);def['uri']=util[_0x3e96('0x20')](_0x3e96('0x53'),_0x257caa[_0x3e96('0x51')]);if(_0x4e93ba&&_0x4e93ba[_0x3e96('0x54')]){logger['info'](_0x3e96('0x55'),_0x3e96('0x56'));_0x11b745[_0x3e96('0x57')]=util[_0x3e96('0x20')](_0x3e96('0x58'),_0x257caa[_0x3e96('0x59')],_0x11b745['uniqueid'],md5(_0x11b745[_0x3e96('0x5a')]));}else{_0x11b745[_0x3e96('0x57')]='';}return getConnection(_0x257caa)['then'](function(_0x287430){_0x56134d=_0x287430;return getUser(_0x257caa,_0x55f6bf[_0x3e96('0x18')],_0x56134d);})['then'](function(_0x264922){_0x5d7dd4=_0x264922;logger[_0x3e96('0xb')](_0x3e96('0x5b'),_0x5d7dd4['id']);return getEndUser(_0x257caa,_0x11b745[_0x3e96('0x5c')],_0x11b745[_0x3e96('0x5d')],_0x56134d);})['then'](function(_0x2b7ae2){_0x31946a=_0x2b7ae2;logger[_0x3e96('0xb')](_0x3e96('0x5e'),_0x31946a['id']);return getTicket(_0x257caa,_0x5d7dd4,_0x31946a,_0x5da954,_0x11b745,_0x5da954['Fields'],_0x56134d,_0x3e96('0x5f'));})[_0x3e96('0x2c')](function(_0x4b6abc){_0x10c02c=_0x4b6abc;logger[_0x3e96('0xb')](_0x3e96('0x60'));logger[_0x3e96('0xb')]('The\x20Ticket\x20ID\x20is:',_0x10c02c['id']);return setRelationship(_0x56134d,_0x5d7dd4,_0x10c02c,_0x3e96('0x61'));})[_0x3e96('0x2c')](function(){return setRelationship(_0x56134d,_0x31946a,_0x10c02c,_0x3e96('0x62'));})[_0x3e96('0x2c')](function(){return getServerInfo(_0x56134d);})[_0x3e96('0x2c')](function(_0x5067a8){var _0x3271a5=parseInt(_0x5067a8['version'][_0x3e96('0x63')](0x0));var _0x17b15a=util[_0x3e96('0x20')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x257caa[_0x3e96('0x51')],_0x10c02c['id']);if(_0x3271a5>0x6){_0x17b15a=util[_0x3e96('0x20')](_0x3e96('0x64'),_0x257caa[_0x3e96('0x51')],_0x10c02c['id']);}logger[_0x3e96('0xb')](_0x3e96('0x55'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x3e96('0x20')](_0x3e96('0x65'),_0x55f6bf[_0x3e96('0x18')]),'trigger:browser:url',{'uri':_0x17b15a});})[_0x3e96('0x66')](function(_0x34c82d){logger[_0x3e96('0x67')](_0x3e96('0x55'),JSON[_0x3e96('0x26')](_0x34c82d));});};exports[_0x3e96('0x68')]=function(_0x4d271c,_0x47c242,_0x43a70f,_0x6b953b,_0x2389b0,_0x7e5ec2,_0x398f20){var _0x11a2b1,_0x27b9cf,_0x42e29b,_0x3ce7e6;_0x7e5ec2['remoteUri']=intUtil[_0x3e96('0x52')](_0x7e5ec2[_0x3e96('0x51')]);_0x7e5ec2[_0x3e96('0x59')]=intUtil[_0x3e96('0x52')](_0x7e5ec2[_0x3e96('0x59')]);def[_0x3e96('0x69')]=util[_0x3e96('0x20')](_0x3e96('0x53'),_0x7e5ec2['remoteUri']);if(_0x398f20&&_0x398f20[_0x3e96('0x6a')]&&_0x398f20[_0x3e96('0x6a')]!==_0x3e96('0x6b')){logger['info']('[OUTBOUND]',_0x3e96('0x56'));_0x47c242['recordingURL']=util[_0x3e96('0x20')](_0x3e96('0x58'),_0x7e5ec2[_0x3e96('0x59')],_0x47c242[_0x3e96('0x5a')],md5(_0x47c242[_0x3e96('0x5a')]));}return getConnection(_0x7e5ec2)[_0x3e96('0x2c')](function(_0xae2644){_0x3ce7e6=_0xae2644;return getUser(_0x7e5ec2,_0x6b953b[_0x3e96('0x18')],_0x3ce7e6);})[_0x3e96('0x2c')](function(_0x46757d){_0x11a2b1=_0x46757d;logger[_0x3e96('0xb')](_0x3e96('0x5b'),_0x11a2b1['id']);return getEndUser(_0x7e5ec2,_0x47c242[_0x3e96('0x6c')],_0x47c242[_0x3e96('0x6d')],_0x3ce7e6);})[_0x3e96('0x2c')](function(_0x5cac1d){_0x27b9cf=_0x5cac1d;logger[_0x3e96('0xb')]('The\x20Enduser\x20ID\x20is:',_0x27b9cf['id']);return getTicket(_0x7e5ec2,_0x11a2b1,_0x27b9cf,_0x43a70f,_0x47c242,_0x43a70f[_0x3e96('0x6e')],_0x3ce7e6,_0x3e96('0x6f'));})['then'](function(_0x1b0483){_0x42e29b=_0x1b0483;logger[_0x3e96('0xb')](_0x3e96('0x60'));logger[_0x3e96('0xb')]('The\x20Ticket\x20ID\x20is:',_0x42e29b['id']);return setRelationship(_0x3ce7e6,_0x11a2b1,_0x42e29b,_0x3e96('0x61'));})[_0x3e96('0x2c')](function(){return setRelationship(_0x3ce7e6,_0x27b9cf,_0x42e29b,_0x3e96('0x62'));})[_0x3e96('0x2c')](function(){return getServerInfo(_0x3ce7e6);})[_0x3e96('0x2c')](function(_0x13617a){var _0x3891a9=parseInt(_0x13617a[_0x3e96('0x70')][_0x3e96('0x63')](0x0));var _0xc8ee50=util[_0x3e96('0x20')](_0x3e96('0x71'),_0x7e5ec2[_0x3e96('0x51')],_0x42e29b['id']);if(_0x3891a9>0x6){_0xc8ee50=util[_0x3e96('0x20')]('%s/#bwc/index.php?module=Calls&action=EditView&record=%s',_0x7e5ec2['remoteUri'],_0x42e29b['id']);}logger[_0x3e96('0xb')](_0x3e96('0x72'),_0x3e96('0x73'));emit(util[_0x3e96('0x20')](_0x3e96('0x65'),_0x6b953b[_0x3e96('0x18')]),_0x3e96('0x74'),{'uri':_0xc8ee50});})['catch'](function(_0x56608f){logger[_0x3e96('0x67')](_0x3e96('0x72'),JSON[_0x3e96('0x26')](_0x56608f));});};exports[_0x3e96('0x75')]=function(_0x5f2f5f,_0x5b296f,_0x38a9b0,_0x554709,_0x4f5db8,_0x4a2dbe){var _0x37a3d7,_0x487d8d,_0x25d255,_0x27c855;_0x4a2dbe['remoteUri']=intUtil[_0x3e96('0x52')](_0x4a2dbe[_0x3e96('0x51')]);_0x4a2dbe[_0x3e96('0x59')]=intUtil[_0x3e96('0x52')](_0x4a2dbe[_0x3e96('0x59')]);def[_0x3e96('0x69')]=util[_0x3e96('0x20')](_0x3e96('0x53'),_0x4a2dbe['remoteUri']);if(_0x4f5db8&&_0x4f5db8[_0x3e96('0x54')]){logger['info']('['+_0x5b296f[_0x3e96('0x76')][_0x3e96('0x77')]()+']',_0x3e96('0x56'));_0x5b296f['recordingURL']=util[_0x3e96('0x20')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2dbe['serverUrl'],_0x5b296f[_0x3e96('0x5a')],md5(_0x5b296f[_0x3e96('0x5a')]));}else{_0x5b296f[_0x3e96('0x57')]='';}return getConnection(_0x4a2dbe)[_0x3e96('0x2c')](function(_0x3fc012){_0x27c855=_0x3fc012;if(!_[_0x3e96('0x78')](_0x554709)){return getUser(_0x4a2dbe,_0x554709[_0x3e96('0x18')],_0x27c855);}else{return getUser(_0x4a2dbe,null,_0x27c855);}})['then'](function(_0x2c8682){_0x37a3d7=_0x2c8682;logger['info'](_0x3e96('0x5b'),_0x37a3d7['id']);return getEndUser(_0x4a2dbe,_0x5b296f[_0x3e96('0x5c')],_0x5b296f[_0x3e96('0x5d')],_0x27c855);})[_0x3e96('0x2c')](function(_0x3fdf33){_0x487d8d=_0x3fdf33;logger['info'](_0x3e96('0x5e'),_0x487d8d['id']);return getTicket(_0x4a2dbe,_0x37a3d7,_0x487d8d,_0x38a9b0,_0x5b296f,_0x38a9b0[_0x3e96('0x6e')],_0x27c855,_0x3e96('0x5f'));})[_0x3e96('0x2c')](function(_0x3afb71){_0x25d255=_0x3afb71;logger[_0x3e96('0xb')]('Ticket\x20created!');logger[_0x3e96('0xb')](_0x3e96('0x79'),_0x25d255['id']);return setRelationship(_0x27c855,_0x37a3d7,_0x25d255,'users');})[_0x3e96('0x2c')](function(){return setRelationship(_0x27c855,_0x487d8d,_0x25d255,_0x3e96('0x62'));})[_0x3e96('0x2c')](function(){return getServerInfo(_0x27c855);})[_0x3e96('0x66')](function(_0x1848a0){logger['error']('['+_0x5b296f[_0x3e96('0x76')][_0x3e96('0x77')]()+']',JSON[_0x3e96('0x26')](_0x1848a0));});}; \ No newline at end of file +var _0x9471=['destcalleridnum','The\x20Enduser\x20ID\x20is:','users','contacts','charAt','[OUTBOUND]','trigger:browser:url','error','unmanaged','lastevent','toUpperCase','Inbound','lodash','request-promise','bluebird','md5','util','ioredis','./util','../../../../config/environment','../../../../config/logger','sugarcrm','redis','defaults','localhost','socket.io-emitter','POST','info','Creating\x20new\x20ticket...','name','getString','Subjects','assigned_user_id','created_by','description','date_start','toISOString','slice','duration_hours','duration_minutes','Contacts','parent_name','direction','length','forEach','variableName','push','idField','set_entry','JSON','stringify','Calls','format','Basic\x20%s','toString','base64','get_server_info','isNil','Getting\x20agent\x20with\x20name','Employees','INSTR\x20(\x20users.user_name,\x20\x22%s\x22)\x20>\x200','user_name','then','find','entry_list','value','Agent\x20found!','resolve','name_value_list','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','user_id','Searching\x20enduser\x20with\x20phone','get_entry_list','phone_home','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','first_name','','Caller\x20-\x20%s','Enduser\x20created.','debug','[HTTP]','type','nameField','customField','toLowerCase','content','string','custom_fields','variable','customVariable','Variable','login','password','PLAIN','xCALLY\x20Motion\x20integration','sessionID','Account\x20%d\x20is\x20not\x20valid','set_relationship','remoteUri','stripTrailingSlash','serverUrl','uri','%s/service/v4_1/rest.php','[QUEUE]','Recording\x20is\x20enabled!','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','recordingURL','The\x20User\x20ID\x20is:','calleridname','calleridnum','Fields','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','version','%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s','%s/#bwc/index.php?module=Calls&action=EditView&record=%s','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','catch','outbound','recordingFormat','none','destcalleridname'];(function(_0x282442,_0x135555){var _0xf97807=function(_0x345ce3){while(--_0x345ce3){_0x282442['push'](_0x282442['shift']());}};_0xf97807(++_0x135555);}(_0x9471,0x183));var _0x1947=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x9471[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1947('0x0'));var rp=require(_0x1947('0x1'));var BPromise=require(_0x1947('0x2'));var md5=require(_0x1947('0x3'));var util=require(_0x1947('0x4'));var Redis=require(_0x1947('0x5'));var intUtil=require(_0x1947('0x6'));var config=require(_0x1947('0x7'));var logger=require(_0x1947('0x8'))(_0x1947('0x9'));config[_0x1947('0xa')]=_[_0x1947('0xb')](config['redis'],{'host':_0x1947('0xc'),'port':0x18eb});var io=require(_0x1947('0xd'))(new Redis(config[_0x1947('0xa')]));var def={'method':_0x1947('0xe'),'json':!![]};function emit(_0x59ea21,_0x1011c4,_0x48623f){io['to'](_0x59ea21)['emit'](_0x1011c4,_0x48623f);}function getTicket(_0x28aefc,_0x5718af,_0x5605d7,_0x5bcdf1,_0x447b20,_0x32a922,_0x2574ea,_0x177a37){logger[_0x1947('0xf')](_0x1947('0x10'));var _0x4f4705=new Date();var _0x5ebb18=[{'name':_0x1947('0x11'),'value':intUtil[_0x1947('0x12')](_0x5bcdf1[_0x1947('0x13')],_0x447b20,'\x20')},{'name':_0x1947('0x14'),'value':_0x5718af['id']},{'name':_0x1947('0x15'),'value':_0x5718af['id']},{'name':_0x1947('0x16'),'value':intUtil[_0x1947('0x12')](_0x5bcdf1['Descriptions'],_0x447b20,'\x0a')},{'name':_0x1947('0x17'),'value':_0x4f4705[_0x1947('0x18')]()[_0x1947('0x19')](0x0,0x13)['replace']('T','\x20')},{'name':_0x1947('0x1a'),'value':'0'},{'name':_0x1947('0x1b'),'value':'15'},{'name':'parent_id','value':_0x5605d7['id']},{'name':'parent_type','value':_0x1947('0x1c')},{'name':_0x1947('0x1d'),'value':_0x5605d7[_0x1947('0x11')]},{'name':_0x1947('0x1e'),'value':_0x177a37}];if(_0x32a922[_0x1947('0x1f')]){_[_0x1947('0x20')](_0x32a922,function(_0x4f63bd){if(_0x447b20[_0x4f63bd[_0x1947('0x21')]]){_0x5ebb18[_0x1947('0x22')]({'name':_0x4f63bd[_0x1947('0x23')],'value':_0x447b20[_0x4f63bd[_0x1947('0x21')]]});}});}return request({'form':{'method':_0x1947('0x24'),'input_type':_0x1947('0x25'),'response_type':_0x1947('0x25'),'rest_data':JSON[_0x1947('0x26')]({'session':_0x2574ea['id'],'module_name':_0x1947('0x27'),'name_value_list':_0x5ebb18})}});}function getAuth(_0x1eb6f7){return util[_0x1947('0x28')](_0x1947('0x29'),new Buffer(_0x1eb6f7['apiKey']+':X')[_0x1947('0x2a')](_0x1947('0x2b')));}function getServerInfo(_0x1091e2){return request({'form':{'method':_0x1947('0x2c'),'input_type':_0x1947('0x25'),'response_type':_0x1947('0x25'),'rest_data':JSON[_0x1947('0x26')]({'session':_0x1091e2['id']})}});}function getUser(_0xde4d42,_0x58e507,_0x141512){if(!_[_0x1947('0x2d')](_0x58e507)){logger[_0x1947('0xf')](_0x1947('0x2e'),_0x58e507);return request({'form':{'method':'get_entry_list','input_type':'JSON','response_type':_0x1947('0x25'),'rest_data':JSON[_0x1947('0x26')]({'session':_0x141512['id'],'module_name':_0x1947('0x2f'),'query':util['format'](_0x1947('0x30'),_0x58e507),'order_by':'','offset':'0','select_fields':['id',_0x1947('0x11'),_0x1947('0x31')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})[_0x1947('0x32')](function(_0x134d66){if(_0x134d66['entry_list'][_0x1947('0x1f')]){var _0x38c623=_[_0x1947('0x33')](_0x134d66[_0x1947('0x34')],function(_0x41774d){return _0x41774d['name_value_list'][_0x1947('0x31')][_0x1947('0x35')]===_0x58e507;});if(_0x38c623){logger[_0x1947('0xf')](_0x1947('0x36'));return BPromise[_0x1947('0x37')]({'id':_0x38c623[_0x1947('0x38')]['id'][_0x1947('0x35')],'name':_0x38c623['name_value_list'][_0x1947('0x11')][_0x1947('0x35')]});}}logger['info'](_0x1947('0x39'));return BPromise['resolve']({'id':_0x141512['name_value_list'][_0x1947('0x3a')][_0x1947('0x35')],'name':_0x141512[_0x1947('0x38')][_0x1947('0x31')][_0x1947('0x35')]});});}else{logger['info']('Agent\x20not\x20available,\x20using\x20the\x20admin\x20account!');return BPromise[_0x1947('0x37')]({'id':_0x141512[_0x1947('0x38')][_0x1947('0x3a')][_0x1947('0x35')],'name':_0x141512[_0x1947('0x38')][_0x1947('0x31')][_0x1947('0x35')]});}}function getEndUser(_0xe4494,_0xc1999d,_0x2580a9,_0x4be3b0){logger[_0x1947('0xf')](_0x1947('0x3b'),_0x2580a9);return request({'form':{'method':_0x1947('0x3c'),'input_type':_0x1947('0x25'),'response_type':'JSON','rest_data':JSON[_0x1947('0x26')]({'session':_0x4be3b0['id'],'module_name':'Contacts','query':util['format']('contacts.phone_home\x20=\x20\x22%s\x22',_0x2580a9),'order_by':'','offset':'0','select_fields':['id',_0x1947('0x11'),_0x1947('0x3d')],'link_name_to_fields_array':[],'max_results':-0x1,'deleted':'0'})}})['then'](function(_0x13fdc0){if(_0x13fdc0[_0x1947('0x34')][_0x1947('0x1f')]){var _0x4e75f6=_[_0x1947('0x33')](_0x13fdc0[_0x1947('0x34')],function(_0x461dd4){return _0x461dd4[_0x1947('0x38')][_0x1947('0x3d')]['value']===_0x2580a9;});if(_0x4e75f6){logger[_0x1947('0xf')](_0x1947('0x3e'));return BPromise[_0x1947('0x37')]({'id':_0x4e75f6[_0x1947('0x38')]['id'][_0x1947('0x35')],'name':_0x4e75f6[_0x1947('0x38')][_0x1947('0x11')]['value'],'phone':_0x4e75f6[_0x1947('0x38')]['phone_home'][_0x1947('0x35')]});}}else{logger[_0x1947('0xf')](_0x1947('0x3f'));return request({'form':{'method':_0x1947('0x24'),'input_type':_0x1947('0x25'),'response_type':_0x1947('0x25'),'rest_data':JSON[_0x1947('0x26')]({'session':_0x4be3b0['id'],'module_name':'Contacts','name_value_list':[{'name':_0x1947('0x40'),'value':_0xc1999d!==_0x1947('0x41')?_0xc1999d:util[_0x1947('0x28')](_0x1947('0x42'),_0x2580a9)},{'name':_0x1947('0x3d'),'value':_0x2580a9}]})}})[_0x1947('0x32')](function(_0x33e2c1){logger['info'](_0x1947('0x43'));return BPromise[_0x1947('0x37')]({'id':_0x33e2c1['id'],'name':_0x33e2c1[_0x1947('0x34')][_0x1947('0x40')][_0x1947('0x35')],'phone':_0x33e2c1['entry_list']['phone_home'][_0x1947('0x35')]});});}});}function request(_0x3bac77){logger[_0x1947('0x44')](_0x1947('0x45'),JSON[_0x1947('0x26')](_0x3bac77));return rp(_['merge'](def,_0x3bac77));}function getTags(_0x367148,_0x3a3913){var _0x3012ca=[];if(_0x367148&&_0x367148[_0x1947('0x1f')]>0x0){_0x3012ca=_['map'](_0x367148,_0x3a3913);}return _0x3012ca;}function getCustomFields(_0x1e4270,_0x296e17){var _0x138f11=[];var _0x3c5805={'custom_fields':[]};if(_0x1e4270[_0x1947('0x1f')]>0x0){_[_0x1947('0x20')](_0x1e4270,function(_0xab286b){if(_0xab286b[_0x1947('0x46')]==='string'&&_0xab286b[_0x1947('0x47')]&&!_0xab286b[_0x1947('0x48')]){_0x3c5805[_0xab286b[_0x1947('0x47')][_0x1947('0x49')]()]=_0xab286b[_0x1947('0x4a')][_0x1947('0x2a')]();}else if(_0xab286b[_0x1947('0x46')]===_0x1947('0x4b')&&_0xab286b[_0x1947('0x23')]&&_0xab286b[_0x1947('0x48')]){_0x3c5805[_0x1947('0x4c')][_0x1947('0x22')]({'id':_0xab286b[_0x1947('0x23')],'value':_0xab286b[_0x1947('0x4a')]['toString']()});}else if(_0xab286b[_0x1947('0x46')]===_0x1947('0x4d')&&_0xab286b[_0x1947('0x21')]&&_0xab286b['idField']&&_0xab286b[_0x1947('0x48')]){_0x296e17[_0xab286b['variableName']]&&_0x3c5805[_0x1947('0x4c')][_0x1947('0x22')]({'id':_0xab286b[_0x1947('0x23')],'value':_0x296e17[_0xab286b[_0x1947('0x21')]][_0x1947('0x2a')]()});}else if(_0xab286b[_0x1947('0x46')]===_0x1947('0x4e')&&_0xab286b[_0x1947('0x4f')]&&_0xab286b[_0x1947('0x4f')][_0x1947('0x11')]&&_0xab286b[_0x1947('0x23')]&&_0xab286b[_0x1947('0x48')]){_0x296e17[_0xab286b[_0x1947('0x4f')]['name'][_0x1947('0x49')]()]&&_0x3c5805[_0x1947('0x4c')]['push']({'id':_0xab286b[_0x1947('0x23')],'value':_0x296e17[_0xab286b[_0x1947('0x4f')][_0x1947('0x11')][_0x1947('0x49')]()][_0x1947('0x2a')]()});}});}return _0x3c5805;}function getConnection(_0x4d7025){return request({'method':_0x1947('0xe'),'form':{'method':_0x1947('0x50'),'input_type':_0x1947('0x25'),'response_type':'JSON','rest_data':JSON['stringify']({'user_auth':{'user_name':_0x4d7025['username'],'password':_0x4d7025[_0x1947('0x51')],'encryption':_0x1947('0x52')},'application':_0x1947('0x53')})}})['then'](function(_0x236dac){var _0x5f59e4=_0x236dac;if(_0x5f59e4['id']){def[_0x1947('0x54')]=_0x5f59e4['id'];return BPromise[_0x1947('0x37')](_0x5f59e4);}else{throw new Error(util[_0x1947('0x28')](_0x1947('0x55'),_0x4d7025['id']));}});}function setRelationship(_0x387b32,_0x24e598,_0x5772ef,_0x5914ca){return request({'form':{'method':_0x1947('0x56'),'input_type':_0x1947('0x25'),'response_type':_0x1947('0x25'),'rest_data':JSON[_0x1947('0x26')]({'session':_0x387b32['id'],'module_name':'Calls','module_id':_0x5772ef['id'],'link_field_name':_0x5914ca,'related_ids':[_0x24e598['id']],'name_value_list':[],'delete':0x0})}});}exports['queue']=function(_0x16d56a,_0x5a4e91,_0x4dbe19,_0x5044b2,_0x4bea92,_0x583dfe){var _0x40f3fd,_0x4202fb,_0x4c97de,_0x5f0d9a;_0x583dfe[_0x1947('0x57')]=intUtil[_0x1947('0x58')](_0x583dfe['remoteUri']);_0x583dfe[_0x1947('0x59')]=intUtil[_0x1947('0x58')](_0x583dfe[_0x1947('0x59')]);def[_0x1947('0x5a')]=util['format'](_0x1947('0x5b'),_0x583dfe[_0x1947('0x57')]);if(_0x4bea92&&_0x4bea92['monitor_format']){logger[_0x1947('0xf')](_0x1947('0x5c'),_0x1947('0x5d'));_0x5a4e91['recordingURL']=util[_0x1947('0x28')](_0x1947('0x5e'),_0x583dfe[_0x1947('0x59')],_0x5a4e91[_0x1947('0x5f')],md5(_0x5a4e91[_0x1947('0x5f')]));}else{_0x5a4e91[_0x1947('0x60')]='';}return getConnection(_0x583dfe)[_0x1947('0x32')](function(_0xee14fa){_0x5f0d9a=_0xee14fa;return getUser(_0x583dfe,_0x5044b2[_0x1947('0x11')],_0x5f0d9a);})[_0x1947('0x32')](function(_0x42f1bf){_0x40f3fd=_0x42f1bf;logger[_0x1947('0xf')](_0x1947('0x61'),_0x40f3fd['id']);return getEndUser(_0x583dfe,_0x5a4e91[_0x1947('0x62')],_0x5a4e91[_0x1947('0x63')],_0x5f0d9a);})[_0x1947('0x32')](function(_0x8b32d4){_0x4202fb=_0x8b32d4;logger[_0x1947('0xf')]('The\x20Enduser\x20ID\x20is:',_0x4202fb['id']);return getTicket(_0x583dfe,_0x40f3fd,_0x4202fb,_0x4dbe19,_0x5a4e91,_0x4dbe19[_0x1947('0x64')],_0x5f0d9a,'Inbound');})[_0x1947('0x32')](function(_0x5d7058){_0x4c97de=_0x5d7058;logger['info'](_0x1947('0x65'));logger[_0x1947('0xf')](_0x1947('0x66'),_0x4c97de['id']);return setRelationship(_0x5f0d9a,_0x40f3fd,_0x4c97de,'users');})[_0x1947('0x32')](function(){return setRelationship(_0x5f0d9a,_0x4202fb,_0x4c97de,'contacts');})[_0x1947('0x32')](function(){return getServerInfo(_0x5f0d9a);})[_0x1947('0x32')](function(_0x2d3ada){var _0x553d81=parseInt(_0x2d3ada[_0x1947('0x67')]['charAt'](0x0));var _0x3d201a=util[_0x1947('0x28')](_0x1947('0x68'),_0x583dfe['remoteUri'],_0x4c97de['id']);if(_0x553d81>0x6){_0x3d201a=util[_0x1947('0x28')](_0x1947('0x69'),_0x583dfe['remoteUri'],_0x4c97de['id']);}logger[_0x1947('0xf')](_0x1947('0x5c'),_0x1947('0x6a'));emit(util[_0x1947('0x28')](_0x1947('0x6b'),_0x5044b2[_0x1947('0x11')]),'trigger:browser:url',{'uri':_0x3d201a});})[_0x1947('0x6c')](function(_0x56a91f){logger['error'](_0x1947('0x5c'),JSON['stringify'](_0x56a91f));});};exports[_0x1947('0x6d')]=function(_0x6df713,_0x1152e6,_0x12bd60,_0x58a3df,_0xdfa1e5,_0x191886,_0x5da986){var _0x275644,_0x4aee8a,_0x295d31,_0x205645;_0x191886[_0x1947('0x57')]=intUtil['stripTrailingSlash'](_0x191886[_0x1947('0x57')]);_0x191886[_0x1947('0x59')]=intUtil[_0x1947('0x58')](_0x191886['serverUrl']);def[_0x1947('0x5a')]=util['format'](_0x1947('0x5b'),_0x191886[_0x1947('0x57')]);if(_0x5da986&&_0x5da986[_0x1947('0x6e')]&&_0x5da986[_0x1947('0x6e')]!==_0x1947('0x6f')){logger['info']('[OUTBOUND]','Recording\x20is\x20enabled!');_0x1152e6['recordingURL']=util[_0x1947('0x28')](_0x1947('0x5e'),_0x191886[_0x1947('0x59')],_0x1152e6[_0x1947('0x5f')],md5(_0x1152e6['uniqueid']));}return getConnection(_0x191886)[_0x1947('0x32')](function(_0x4a00fe){_0x205645=_0x4a00fe;return getUser(_0x191886,_0x58a3df[_0x1947('0x11')],_0x205645);})[_0x1947('0x32')](function(_0x4beade){_0x275644=_0x4beade;logger['info'](_0x1947('0x61'),_0x275644['id']);return getEndUser(_0x191886,_0x1152e6[_0x1947('0x70')],_0x1152e6[_0x1947('0x71')],_0x205645);})['then'](function(_0x39d4f1){_0x4aee8a=_0x39d4f1;logger[_0x1947('0xf')](_0x1947('0x72'),_0x4aee8a['id']);return getTicket(_0x191886,_0x275644,_0x4aee8a,_0x12bd60,_0x1152e6,_0x12bd60[_0x1947('0x64')],_0x205645,'Outbound');})['then'](function(_0x1dd49e){_0x295d31=_0x1dd49e;logger[_0x1947('0xf')](_0x1947('0x65'));logger[_0x1947('0xf')](_0x1947('0x66'),_0x295d31['id']);return setRelationship(_0x205645,_0x275644,_0x295d31,_0x1947('0x73'));})[_0x1947('0x32')](function(){return setRelationship(_0x205645,_0x4aee8a,_0x295d31,_0x1947('0x74'));})[_0x1947('0x32')](function(){return getServerInfo(_0x205645);})[_0x1947('0x32')](function(_0x37198a){var _0x1dd5c4=parseInt(_0x37198a[_0x1947('0x67')][_0x1947('0x75')](0x0));var _0x1b1261=util[_0x1947('0x28')]('%s/index.php?action=ajaxui#ajaxUILoc=index.php%3Fmodule%3DCalls%26action%3DEditView%26record%3D%s',_0x191886['remoteUri'],_0x295d31['id']);if(_0x1dd5c4>0x6){_0x1b1261=util[_0x1947('0x28')](_0x1947('0x69'),_0x191886[_0x1947('0x57')],_0x295d31['id']);}logger['info'](_0x1947('0x76'),_0x1947('0x6a'));emit(util[_0x1947('0x28')](_0x1947('0x6b'),_0x58a3df[_0x1947('0x11')]),_0x1947('0x77'),{'uri':_0x1b1261});})[_0x1947('0x6c')](function(_0x765e59){logger[_0x1947('0x78')]('[OUTBOUND]',JSON[_0x1947('0x26')](_0x765e59));});};exports[_0x1947('0x79')]=function(_0x54f6b5,_0x5a03fe,_0x305952,_0x5076ef,_0x15491f,_0x525bce){var _0x2e275a,_0x3d0847,_0x4f0922,_0x3ae638;_0x525bce[_0x1947('0x57')]=intUtil['stripTrailingSlash'](_0x525bce['remoteUri']);_0x525bce[_0x1947('0x59')]=intUtil['stripTrailingSlash'](_0x525bce[_0x1947('0x59')]);def['uri']=util['format'](_0x1947('0x5b'),_0x525bce[_0x1947('0x57')]);if(_0x15491f&&_0x15491f['monitor_format']){logger[_0x1947('0xf')]('['+_0x5a03fe[_0x1947('0x7a')][_0x1947('0x7b')]()+']','Recording\x20is\x20enabled!');_0x5a03fe[_0x1947('0x60')]=util[_0x1947('0x28')](_0x1947('0x5e'),_0x525bce[_0x1947('0x59')],_0x5a03fe[_0x1947('0x5f')],md5(_0x5a03fe['uniqueid']));}else{_0x5a03fe[_0x1947('0x60')]='';}return getConnection(_0x525bce)[_0x1947('0x32')](function(_0x478fa0){_0x3ae638=_0x478fa0;if(!_[_0x1947('0x2d')](_0x5076ef)){return getUser(_0x525bce,_0x5076ef[_0x1947('0x11')],_0x3ae638);}else{return getUser(_0x525bce,null,_0x3ae638);}})['then'](function(_0x55b7a1){_0x2e275a=_0x55b7a1;logger['info']('The\x20User\x20ID\x20is:',_0x2e275a['id']);return getEndUser(_0x525bce,_0x5a03fe['calleridname'],_0x5a03fe[_0x1947('0x63')],_0x3ae638);})[_0x1947('0x32')](function(_0x40d973){_0x3d0847=_0x40d973;logger['info'](_0x1947('0x72'),_0x3d0847['id']);return getTicket(_0x525bce,_0x2e275a,_0x3d0847,_0x305952,_0x5a03fe,_0x305952[_0x1947('0x64')],_0x3ae638,_0x1947('0x7c'));})['then'](function(_0xafa031){_0x4f0922=_0xafa031;logger[_0x1947('0xf')](_0x1947('0x65'));logger[_0x1947('0xf')](_0x1947('0x66'),_0x4f0922['id']);return setRelationship(_0x3ae638,_0x2e275a,_0x4f0922,_0x1947('0x73'));})[_0x1947('0x32')](function(){return setRelationship(_0x3ae638,_0x3d0847,_0x4f0922,'contacts');})[_0x1947('0x32')](function(){return getServerInfo(_0x3ae638);})[_0x1947('0x6c')](function(_0x4f24cc){logger[_0x1947('0x78')]('['+_0x5a03fe[_0x1947('0x7a')][_0x1947('0x7b')]()+']',JSON['stringify'](_0x4f24cc));});}; \ 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 1c14c89..c1206f2 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 _0x8527=['Variable','name','toLowerCase','keyValue','keyType','key','%s:\x20%s','keyContent','format','join','stripTrailingSlash','slice','substring','isNil','test','lodash','length','sortBy','type','string','content','variable','variableName','push','toString','customVariable'];(function(_0x6dbd7e,_0x541122){var _0x2cb261=function(_0x58f1ee){while(--_0x58f1ee){_0x6dbd7e['push'](_0x6dbd7e['shift']());}};_0x2cb261(++_0x541122);}(_0x8527,0x147));var _0x7852=function(_0x18b5e8,_0x51e875){_0x18b5e8=_0x18b5e8-0x0;var _0x25baed=_0x8527[_0x18b5e8];return _0x25baed;};'use strict';var _=require(_0x7852('0x0'));var util=require('util');exports['getString']=function(_0x5b04a8,_0x3f7bdc,_0x140d61){var _0x2b0078=[];if(_0x5b04a8[_0x7852('0x1')]>0x0){var _0x5f4fac=_[_0x7852('0x2')](_0x5b04a8,['id']);for(var _0x20ebd2=0x0;_0x20ebd2<_0x5f4fac[_0x7852('0x1')];_0x20ebd2++){var _0x595d50=_0x5f4fac[_0x20ebd2];if(_0x595d50[_0x7852('0x3')]===_0x7852('0x4')){_0x2b0078['push'](_0x595d50[_0x7852('0x5')]);}else if(_0x595d50['type']===_0x7852('0x6')&&_0x595d50[_0x7852('0x7')]){_0x3f7bdc[_0x595d50[_0x7852('0x7')]]&&_0x2b0078[_0x7852('0x8')](_0x3f7bdc[_0x595d50[_0x7852('0x7')]][_0x7852('0x9')]());}else if(_0x595d50[_0x7852('0x3')]===_0x7852('0xa')&&_0x595d50[_0x7852('0xb')]&&_0x595d50[_0x7852('0xb')][_0x7852('0xc')]){_0x3f7bdc[_0x595d50[_0x7852('0xb')]['name'][_0x7852('0xd')]()]&&_0x2b0078[_0x7852('0x8')](_0x3f7bdc[_0x595d50[_0x7852('0xb')][_0x7852('0xc')][_0x7852('0xd')]()][_0x7852('0x9')]());}else if(_0x595d50[_0x7852('0x3')]===_0x7852('0xe')){if(_0x595d50[_0x7852('0xf')]==='string'&&_0x595d50[_0x7852('0x10')]){_0x2b0078[_0x7852('0x8')](util['format'](_0x7852('0x11'),_0x595d50['key'],_0x595d50[_0x7852('0x12')]));}else if(_0x595d50[_0x7852('0xf')]===_0x7852('0x6')&&_0x595d50['variableName']&&_0x595d50[_0x7852('0x10')]){_0x3f7bdc[_0x595d50['variableName']]&&_0x2b0078[_0x7852('0x8')](util[_0x7852('0x13')](_0x7852('0x11'),_0x595d50['key'],_0x3f7bdc[_0x595d50['variableName']]));}else if(_0x595d50[_0x7852('0xf')]==='customVariable'&&_0x595d50[_0x7852('0xb')]&&_0x595d50['Variable']['name']&&_0x595d50[_0x7852('0x10')]){_0x3f7bdc[_0x595d50[_0x7852('0xb')][_0x7852('0xc')][_0x7852('0xd')]()]&&_0x2b0078[_0x7852('0x8')](util['format']('%s:\x20%s',_0x595d50[_0x7852('0x10')],_0x3f7bdc[_0x595d50[_0x7852('0xb')][_0x7852('0xc')][_0x7852('0xd')]()]));}}}}return _0x2b0078[_0x7852('0x14')](_0x140d61);};exports[_0x7852('0x15')]=function(_0x5c3a1c){var _0x35e29a=_0x5c3a1c[_0x7852('0x16')](-0x1);if(_0x35e29a==='/'){_0x5c3a1c=_0x5c3a1c[_0x7852('0x17')](0x0,_0x5c3a1c['lastIndexOf'](_0x35e29a));}return _0x5c3a1c;};exports['validateEmail']=function(_0x31a912){if(!_[_0x7852('0x18')](_0x31a912)&&_0x31a912!==''){var _0xb0f1ba=/^(([^<>()\[\]\\.,;:\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 _0xb0f1ba[_0x7852('0x19')](String(_0x31a912)[_0x7852('0xd')]());}else{return![];}}; \ No newline at end of file +var _0xb0b2=['push','content','variable','variableName','toString','customVariable','Variable','name','toLowerCase','keyValue','key','%s:\x20%s','keyContent','keyType','format','stripTrailingSlash','slice','substring','lastIndexOf','validateEmail','isNil','test','lodash','util','getString','length','sortBy','type','string'];(function(_0x388255,_0x5eb62f){var _0x37bab5=function(_0x101269){while(--_0x101269){_0x388255['push'](_0x388255['shift']());}};_0x37bab5(++_0x5eb62f);}(_0xb0b2,0x1e6));var _0x2b0b=function(_0x60afd8,_0x26ece5){_0x60afd8=_0x60afd8-0x0;var _0x1ce894=_0xb0b2[_0x60afd8];return _0x1ce894;};'use strict';var _=require(_0x2b0b('0x0'));var util=require(_0x2b0b('0x1'));exports[_0x2b0b('0x2')]=function(_0x453529,_0x3321d1,_0x4d1747){var _0x46d63f=[];if(_0x453529[_0x2b0b('0x3')]>0x0){var _0x360e9c=_[_0x2b0b('0x4')](_0x453529,['id']);for(var _0x12e9b1=0x0;_0x12e9b1<_0x360e9c[_0x2b0b('0x3')];_0x12e9b1++){var _0x1a7c6e=_0x360e9c[_0x12e9b1];if(_0x1a7c6e[_0x2b0b('0x5')]===_0x2b0b('0x6')){_0x46d63f[_0x2b0b('0x7')](_0x1a7c6e[_0x2b0b('0x8')]);}else if(_0x1a7c6e['type']===_0x2b0b('0x9')&&_0x1a7c6e['variableName']){_0x3321d1[_0x1a7c6e[_0x2b0b('0xa')]]&&_0x46d63f[_0x2b0b('0x7')](_0x3321d1[_0x1a7c6e[_0x2b0b('0xa')]][_0x2b0b('0xb')]());}else if(_0x1a7c6e[_0x2b0b('0x5')]===_0x2b0b('0xc')&&_0x1a7c6e[_0x2b0b('0xd')]&&_0x1a7c6e[_0x2b0b('0xd')][_0x2b0b('0xe')]){_0x3321d1[_0x1a7c6e[_0x2b0b('0xd')][_0x2b0b('0xe')][_0x2b0b('0xf')]()]&&_0x46d63f[_0x2b0b('0x7')](_0x3321d1[_0x1a7c6e[_0x2b0b('0xd')][_0x2b0b('0xe')]['toLowerCase']()]['toString']());}else if(_0x1a7c6e[_0x2b0b('0x5')]===_0x2b0b('0x10')){if(_0x1a7c6e['keyType']===_0x2b0b('0x6')&&_0x1a7c6e[_0x2b0b('0x11')]){_0x46d63f[_0x2b0b('0x7')](util['format'](_0x2b0b('0x12'),_0x1a7c6e[_0x2b0b('0x11')],_0x1a7c6e[_0x2b0b('0x13')]));}else if(_0x1a7c6e[_0x2b0b('0x14')]===_0x2b0b('0x9')&&_0x1a7c6e[_0x2b0b('0xa')]&&_0x1a7c6e[_0x2b0b('0x11')]){_0x3321d1[_0x1a7c6e[_0x2b0b('0xa')]]&&_0x46d63f[_0x2b0b('0x7')](util[_0x2b0b('0x15')](_0x2b0b('0x12'),_0x1a7c6e[_0x2b0b('0x11')],_0x3321d1[_0x1a7c6e[_0x2b0b('0xa')]]));}else if(_0x1a7c6e[_0x2b0b('0x14')]===_0x2b0b('0xc')&&_0x1a7c6e[_0x2b0b('0xd')]&&_0x1a7c6e[_0x2b0b('0xd')][_0x2b0b('0xe')]&&_0x1a7c6e['key']){_0x3321d1[_0x1a7c6e['Variable'][_0x2b0b('0xe')][_0x2b0b('0xf')]()]&&_0x46d63f[_0x2b0b('0x7')](util[_0x2b0b('0x15')](_0x2b0b('0x12'),_0x1a7c6e[_0x2b0b('0x11')],_0x3321d1[_0x1a7c6e[_0x2b0b('0xd')][_0x2b0b('0xe')]['toLowerCase']()]));}}}}return _0x46d63f['join'](_0x4d1747);};exports[_0x2b0b('0x16')]=function(_0x5ab615){var _0x5d6c71=_0x5ab615[_0x2b0b('0x17')](-0x1);if(_0x5d6c71==='/'){_0x5ab615=_0x5ab615[_0x2b0b('0x18')](0x0,_0x5ab615[_0x2b0b('0x19')](_0x5d6c71));}return _0x5ab615;};exports[_0x2b0b('0x1a')]=function(_0x335d34){if(!_[_0x2b0b('0x1b')](_0x335d34)&&_0x335d34!==''){var _0x5a0e64=/^(([^<>()\[\]\\.,;:\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 _0x5a0e64[_0x2b0b('0x1c')](String(_0x335d34)['toLowerCase']());}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 b21a91c..c4ecbd9 100644 --- a/server/services/ami/trigger/integration/vtiger.js +++ b/server/services/ami/trigger/integration/vtiger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['variable','variableName','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','Normal','Open','Subjects','POST','format','%s/webservice.php','create','username','sessionName','HelpDesk','stringify','then','result','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','error','[vTiger],\x20%s,\x20%s,\x20%s','createTicket','validateEmail','Getting\x20agent\x20with\x20email','GET','query','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','resolve','email1','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','admin','statusCode','getUser','Searching\x20end\x20user\x20with\x20phone','remoteUri','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','getchallenge','login','token','Account\x20%d\x20is\x20not\x20valid','[HTTP]','queue','stripTrailingSlash','[QUEUE]','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','The\x20User\x20ID\x20is:','calleridnum','Ticket\x20created!','The\x20Ticket\x20ID\x20is:','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','The\x20Enduser\x20ID\x20is:','Fields','split','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridname','lastevent','lodash','request-promise','bluebird','ioredis','../../../../config/environment','../../../../config/logger','vTiger','redis','defaults','localhost','socket.io-emitter','length','forEach','includes','idField','content','toString','type'];(function(_0x3bf83f,_0x181cac){var _0x22c4a9=function(_0xb3ff0d){while(--_0xb3ff0d){_0x3bf83f['push'](_0x3bf83f['shift']());}};_0x22c4a9(++_0x181cac);}(_0xa9e0,0x123));var _0x0a9e=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0xa9e0[_0x5c351c];return _0x26f3b3;};'use strict';var _=require(_0x0a9e('0x0'));var rp=require(_0x0a9e('0x1'));var BPromise=require(_0x0a9e('0x2'));var md5=require('md5');var util=require('util');var Redis=require(_0x0a9e('0x3'));var intUtil=require('./util');var config=require(_0x0a9e('0x4'));var logger=require(_0x0a9e('0x5'))(_0x0a9e('0x6'));config[_0x0a9e('0x7')]=_[_0x0a9e('0x8')](config['redis'],{'host':_0x0a9e('0x9'),'port':0x18eb});var io=require(_0x0a9e('0xa'))(new Redis(config[_0x0a9e('0x7')]));function emit(_0x5f41ea,_0x503809,_0xe42b77){io['to'](_0x5f41ea)['emit'](_0x503809,_0xe42b77);}function getCustomFields(_0x52cace,_0x39753a){var _0xf81284={};if(_0x52cace[_0x0a9e('0xb')]>0x0){_[_0x0a9e('0xc')](_0x52cace,function(_0xfeb75b){if(_[_0x0a9e('0xd')](['string','picklist'],_0xfeb75b['type'])&&_0xfeb75b['idField']){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0xfeb75b[_0x0a9e('0xf')][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x12')&&_0xfeb75b[_0x0a9e('0x13')]&&_0xfeb75b['idField']&&_0x39753a[_0xfeb75b[_0x0a9e('0x13')]]){_0xf81284[_0xfeb75b[_0x0a9e('0xe')]]=_0x39753a[_0xfeb75b[_0x0a9e('0x13')]][_0x0a9e('0x10')]();}else if(_0xfeb75b[_0x0a9e('0x11')]===_0x0a9e('0x14')&&_0xfeb75b['Variable']&&_0xfeb75b[_0x0a9e('0x15')]['name']&&_0xfeb75b[_0x0a9e('0xe')]&&_0x39753a[_0xfeb75b['Variable'][_0x0a9e('0x16')][_0x0a9e('0x17')]()]){_0xf81284[_0xfeb75b['idField']]=_0x39753a[_0xfeb75b[_0x0a9e('0x15')]['name'][_0x0a9e('0x17')]()][_0x0a9e('0x10')]();}});}return _0xf81284;}function createTicket(_0x106033,_0x205fd6,_0x31b1ca,_0x2eb11f,_0x530eb7,_0x20559e,_0x1314ae){logger[_0x0a9e('0x18')](_0x0a9e('0x19'));var _0x105080=_['merge']({'parent_id':'','assigned_user_id':_0x205fd6['id'],'ticketpriorities':_0x0a9e('0x1a'),'ticketstatus':_0x0a9e('0x1b'),'ticket_title':intUtil['getString'](_0x2eb11f[_0x0a9e('0x1c')],_0x530eb7,'\x20'),'description':intUtil['getString'](_0x2eb11f['Descriptions'],_0x530eb7,'\x0a'),'contact_id':_0x31b1ca['id']},getCustomFields(_0x20559e,_0x530eb7));var _0x3a02e1={'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x106033['remoteUri']),'form':{'operation':_0x0a9e('0x20'),'username':_0x106033[_0x0a9e('0x21')],'sessionName':_0x1314ae[_0x0a9e('0x22')],'elementType':_0x0a9e('0x23'),'element':JSON[_0x0a9e('0x24')](_0x105080)},'json':!![]};return request(_0x3a02e1)[_0x0a9e('0x25')](function(_0x16b1ca){if(_0x16b1ca['success']){return BPromise['resolve']({'id':_0x16b1ca[_0x0a9e('0x26')]['id']});}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x27'),JSON[_0x0a9e('0x24')](_0x16b1ca['error'])));}})[_0x0a9e('0x28')](function(_0x479bc4){var _0x45a1e7=_0x479bc4['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x2b'),_0x45a1e7,JSON[_0x0a9e('0x24')](_0x479bc4));});}function getUser(_0x140511,_0x1538a4,_0x11c3b6){if(intUtil[_0x0a9e('0x2c')](_0x1538a4)){logger['info'](_0x0a9e('0x2d'),_0x1538a4);return request({'method':_0x0a9e('0x2e'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x140511['remoteUri']),'qs':{'operation':_0x0a9e('0x2f'),'username':_0x140511[_0x0a9e('0x21')],'sessionName':_0x11c3b6[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x30'),_0x1538a4)},'json':!![]})[_0x0a9e('0x25')](function(_0x296f41){if(_0x296f41[_0x0a9e('0x31')]&&_0x296f41[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')]('Agent\x20found!');return BPromise[_0x0a9e('0x32')]({'id':_0x296f41[_0x0a9e('0x26')][0x0]['id'],'email':_0x296f41[_0x0a9e('0x26')][0x0][_0x0a9e('0x33')],'name':_0x296f41[_0x0a9e('0x26')][0x0]['first_name']+'\x20'+_0x296f41[_0x0a9e('0x26')][_0x0a9e('0x34')]});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511[_0x0a9e('0x21')],'name':_0x0a9e('0x37')});}})['catch'](function(_0x44295a){var _0x5e7238=_0x44295a[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),_0x0a9e('0x39'),_0x5e7238,JSON['stringify'](_0x44295a));});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x35'));return BPromise[_0x0a9e('0x32')]({'id':_0x11c3b6[_0x0a9e('0x36')],'email':_0x140511['username'],'name':'admin'})[_0x0a9e('0x28')](function(_0x5640eb){var _0x24936a=_0x5640eb[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getUser',_0x24936a,JSON[_0x0a9e('0x24')](_0x5640eb));});}}function getEndUser(_0x3bfce8,_0x3cae,_0x533942,_0x1dbf74){logger[_0x0a9e('0x18')](_0x0a9e('0x3a'),_0x533942);return request({'method':'GET','uri':util['format'](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'qs':{'operation':'query','username':_0x3bfce8[_0x0a9e('0x21')],'sessionName':_0x1dbf74[_0x0a9e('0x22')],'query':util[_0x0a9e('0x1e')](_0x0a9e('0x3c'),_0x533942,_0x533942,_0x533942,_0x533942,_0x533942)},'json':!![]})['then'](function(_0x5a594b){if(_0x5a594b[_0x0a9e('0x31')]&&_0x5a594b[_0x0a9e('0x26')]['length']){logger[_0x0a9e('0x18')](_0x0a9e('0x3d'));return BPromise[_0x0a9e('0x32')]({'id':_0x5a594b['result'][0x0]['id'],'name':_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3e')]+'\x20'+_0x5a594b[_0x0a9e('0x26')][0x0][_0x0a9e('0x3f')],'phone':_0x533942});}else{logger[_0x0a9e('0x18')](_0x0a9e('0x40'));return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0x3bfce8[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x20'),'sessionName':_0x1dbf74[_0x0a9e('0x22')],'elementType':_0x0a9e('0x41'),'element':JSON[_0x0a9e('0x24')]({'lastname':_0x3cae,'phone':_0x533942,'assigned_user_id':'\x20'})},'json':!![]})[_0x0a9e('0x25')](function(_0x4d04c8){logger['info'](_0x0a9e('0x42'));return BPromise[_0x0a9e('0x32')]({'id':_0x4d04c8[_0x0a9e('0x26')]['id'],'name':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x3f')],'phone':_0x4d04c8[_0x0a9e('0x26')][_0x0a9e('0x43')]});})[_0x0a9e('0x28')](function(_0x432fcc){var _0x25c6e6=_0x432fcc[_0x0a9e('0x38')]||0x1f4;logger[_0x0a9e('0x29')]('[vTiger],\x20%s,\x20%s,\x20%s',_0x0a9e('0x44'),_0x25c6e6,JSON[_0x0a9e('0x24')](_0x432fcc));});}});}function getConnection(_0xdd268f){var _0xfbd5ad=_0xdd268f[_0x0a9e('0x21')];var _0xbe9d19=_0xdd268f[_0x0a9e('0x45')];return request({'method':_0x0a9e('0x2e'),'uri':util['format'](_0x0a9e('0x1f'),_0xdd268f['remoteUri']),'qs':{'operation':_0x0a9e('0x46'),'username':_0xfbd5ad},'json':!![]})[_0x0a9e('0x25')](function(_0x8d6dd1){if(_0x8d6dd1['success']){return request({'method':_0x0a9e('0x1d'),'uri':util[_0x0a9e('0x1e')](_0x0a9e('0x1f'),_0xdd268f[_0x0a9e('0x3b')]),'form':{'operation':_0x0a9e('0x47'),'username':_0xfbd5ad,'accessKey':md5(_0x8d6dd1[_0x0a9e('0x26')][_0x0a9e('0x48')]+_0xbe9d19)},'json':!![]});}})['then'](function(_0x13f44d){if(_0x13f44d[_0x0a9e('0x31')]){return BPromise[_0x0a9e('0x32')](_0x13f44d[_0x0a9e('0x26')]);}else{throw new Error(util[_0x0a9e('0x1e')](_0x0a9e('0x49'),_0xdd268f['id']));}})[_0x0a9e('0x28')](function(_0x19383e){var _0x34febd=_0x19383e['statusCode']||0x1f4;logger[_0x0a9e('0x29')](_0x0a9e('0x2a'),'getConnection',_0x34febd,JSON['stringify'](_0x19383e));});}function request(_0x5ddf84){logger[_0x0a9e('0x18')](_0x0a9e('0x4a'),JSON[_0x0a9e('0x24')](_0x5ddf84));return rp(_0x5ddf84);}exports[_0x0a9e('0x4b')]=function(_0x61bb17,_0x30decb,_0x2e5165,_0x375c18,_0x5d38ae,_0x4b1b9f){var _0x53975a,_0x39d77d,_0x204173,_0x14d602;_0x4b1b9f['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x4b1b9f[_0x0a9e('0x3b')]);if(_0x5d38ae&&_0x5d38ae['monitor_format']){logger['info'](_0x0a9e('0x4d'),'Recording\x20is\x20enabled!');_0x30decb[_0x0a9e('0x4e')]=util['format'](_0x0a9e('0x4f'),_0x4b1b9f[_0x0a9e('0x50')],_0x30decb[_0x0a9e('0x51')],md5(_0x30decb['uniqueid']));}else{_0x30decb[_0x0a9e('0x4e')]='';}return getConnection(_0x4b1b9f)[_0x0a9e('0x25')](function(_0x508b47){_0x14d602=_0x508b47;return getUser(_0x4b1b9f,_0x375c18['email'],_0x14d602);})[_0x0a9e('0x25')](function(_0x3aedd0){_0x53975a=_0x3aedd0;logger['info'](_0x0a9e('0x52'),_0x53975a['id']);return getEndUser(_0x4b1b9f,_0x30decb['calleridname'],_0x30decb[_0x0a9e('0x53')],_0x14d602);})['then'](function(_0xe22ccc){_0x39d77d=_0xe22ccc;logger['info']('The\x20Enduser\x20ID\x20is:',_0x39d77d['id']);return createTicket(_0x4b1b9f,_0x53975a,_0x39d77d,_0x2e5165,_0x30decb,_0x2e5165['Fields'],_0x14d602);})[_0x0a9e('0x25')](function(_0x47de4c){_0x204173=_0x47de4c;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x204173['id']);var _0x232830=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x4b1b9f[_0x0a9e('0x3b')],_['split'](_0x204173['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x4d'),_0x0a9e('0x57'));emit(util[_0x0a9e('0x1e')](_0x0a9e('0x58'),_0x375c18[_0x0a9e('0x16')]),'trigger:browser:url',{'uri':_0x232830});})[_0x0a9e('0x28')](function(_0x26bc80){logger['error'](_0x0a9e('0x4d'),JSON['stringify'](_0x26bc80));});};exports[_0x0a9e('0x59')]=function(_0x5ba1f9,_0x4b3c1a,_0x5674ee,_0x273cb5,_0x49d231,_0x2244d6,_0x1fc70e){var _0x261adb,_0x7be420,_0x1cca9f,_0x26d7db;_0x2244d6['remoteUri']=intUtil[_0x0a9e('0x4c')](_0x2244d6['remoteUri']);_0x2244d6[_0x0a9e('0x50')]=intUtil[_0x0a9e('0x4c')](_0x2244d6[_0x0a9e('0x50')]);if(_0x1fc70e&&_0x1fc70e['recordingFormat']&&_0x1fc70e[_0x0a9e('0x5a')]!==_0x0a9e('0x5b')){logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),'Recording\x20is\x20enabled!');_0x4b3c1a[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2244d6[_0x0a9e('0x50')],_0x4b3c1a[_0x0a9e('0x51')],md5(_0x4b3c1a[_0x0a9e('0x51')]));}return getConnection(_0x2244d6)[_0x0a9e('0x25')](function(_0x401837){_0x26d7db=_0x401837;return getUser(_0x2244d6,_0x273cb5['email'],_0x26d7db);})[_0x0a9e('0x25')](function(_0x2937e0){_0x261adb=_0x2937e0;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x261adb['id']);return getEndUser(_0x2244d6,_0x4b3c1a[_0x0a9e('0x5d')],_0x4b3c1a['destcalleridnum'],_0x26d7db);})['then'](function(_0x242745){_0x7be420=_0x242745;logger[_0x0a9e('0x18')](_0x0a9e('0x5e'),_0x7be420['id']);return createTicket(_0x2244d6,_0x261adb,_0x7be420,_0x5674ee,_0x4b3c1a,_0x5674ee[_0x0a9e('0x5f')],_0x26d7db);})[_0x0a9e('0x25')](function(_0xc8c264){_0x1cca9f=_0xc8c264;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1cca9f['id']);var _0x2e89b7=util[_0x0a9e('0x1e')](_0x0a9e('0x56'),_0x2244d6[_0x0a9e('0x3b')],_[_0x0a9e('0x60')](_0x1cca9f['id'],'x')[0x1]);logger[_0x0a9e('0x18')](_0x0a9e('0x5c'),_0x0a9e('0x57'));emit(util['format'](_0x0a9e('0x58'),_0x273cb5[_0x0a9e('0x16')]),_0x0a9e('0x61'),{'uri':_0x2e89b7});})['catch'](function(_0x1148a1){logger[_0x0a9e('0x29')]('[OUTBOUND]',JSON[_0x0a9e('0x24')](_0x1148a1));});};exports[_0x0a9e('0x62')]=function(_0x3ef315,_0x427946,_0x13b5c0,_0x4a43a8,_0x50cdce,_0x4a2438){var _0x40fb85,_0x18bf5d,_0x1104ad,_0x23a7d3;_0x4a2438[_0x0a9e('0x3b')]=intUtil[_0x0a9e('0x4c')](_0x4a2438[_0x0a9e('0x3b')]);_0x4a2438[_0x0a9e('0x50')]=intUtil['stripTrailingSlash'](_0x4a2438[_0x0a9e('0x50')]);if(_0x50cdce&&_0x50cdce[_0x0a9e('0x63')]){logger[_0x0a9e('0x18')]('['+_0x427946['lastevent'][_0x0a9e('0x64')]()+']','Recording\x20is\x20enabled!');_0x427946[_0x0a9e('0x4e')]=util[_0x0a9e('0x1e')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x4a2438[_0x0a9e('0x50')],_0x427946[_0x0a9e('0x51')],md5(_0x427946[_0x0a9e('0x51')]));}else{_0x427946[_0x0a9e('0x4e')]='';}return getConnection(_0x4a2438)['then'](function(_0x1d442c){_0x23a7d3=_0x1d442c;return getUser(_0x4a2438,'',_0x23a7d3);})[_0x0a9e('0x25')](function(_0x371533){_0x40fb85=_0x371533;logger[_0x0a9e('0x18')]('The\x20User\x20ID\x20is:',_0x40fb85['id']);return getEndUser(_0x4a2438,_0x427946[_0x0a9e('0x65')],_0x427946[_0x0a9e('0x53')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0x361b21){_0x18bf5d=_0x361b21;logger['info'](_0x0a9e('0x5e'),_0x18bf5d['id']);return createTicket(_0x4a2438,_0x40fb85,_0x18bf5d,_0x13b5c0,_0x427946,_0x13b5c0[_0x0a9e('0x5f')],_0x23a7d3);})[_0x0a9e('0x25')](function(_0xf410e5){_0x1104ad=_0xf410e5;logger[_0x0a9e('0x18')](_0x0a9e('0x54'));logger[_0x0a9e('0x18')](_0x0a9e('0x55'),_0x1104ad['id']);})[_0x0a9e('0x28')](function(_0x336dc3){logger[_0x0a9e('0x29')]('['+_0x427946[_0x0a9e('0x66')][_0x0a9e('0x64')]()+']',JSON[_0x0a9e('0x24')](_0x336dc3));});}; \ No newline at end of file +var _0x9c44=['stringify','validateEmail','Getting\x20agent\x20with\x20email','GET','%s/webservice.php','SELECT\x20first_name,\x20last_name,\x20email1\x20FROM\x20Users\x20WHERE\x20email1=\x27%s\x27;','success','length','Agent\x20found!','email1','first_name','last_name','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','userId','getUser','admin','Searching\x20end\x20user\x20with\x20phone','SELECT\x20id,\x20firstname,\x20lastname,\x20email,\x20phone,\x20mobile,\x20homephone,\x20otherphone,\x20assistantphone\x20FROM\x20Contacts\x20WHERE\x20phone\x20=\x20\x27%s\x27\x20OR\x20mobile\x20=\x27%s\x27\x20OR\x20homephone\x20=\x27%s\x27\x20OR\x20otherphone\x20=\x27%s\x27\x20OR\x20assistantphone\x20=\x27%s\x27;','Enduser\x20found!','firstname','lastname','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Contacts','Enduser\x20created.','phone','getEndUser','accessKey','login','Account\x20%d\x20is\x20not\x20valid','getConnection','[HTTP]','queue','stripTrailingSlash','[QUEUE]','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','serverUrl','uniqueid','recordingURL','email','The\x20User\x20ID\x20is:','calleridname','The\x20Enduser\x20ID\x20is:','Fields','The\x20Ticket\x20ID\x20is:','split','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','recordingFormat','none','[OUTBOUND]','Recording\x20is\x20enabled!','destcalleridname','destcalleridnum','Ticket\x20created!','%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT','trigger:browser:url','unmanaged','monitor_format','toUpperCase','calleridnum','lastevent','bluebird','md5','util','ioredis','./util','../../../../config/environment','redis','localhost','socket.io-emitter','emit','forEach','string','picklist','idField','content','type','variable','variableName','toString','customVariable','Variable','name','toLowerCase','info','Creating\x20new\x20ticket...','merge','Normal','Open','getString','Subjects','POST','remoteUri','create','username','sessionName','then','resolve','result','format','Ticket\x20could\x20not\x20be\x20created\x20due\x20to:\x20%s','catch','statusCode','error','[vTiger],\x20%s,\x20%s,\x20%s'];(function(_0x5accfc,_0x1aaebc){var _0x298c2f=function(_0x363594){while(--_0x363594){_0x5accfc['push'](_0x5accfc['shift']());}};_0x298c2f(++_0x1aaebc);}(_0x9c44,0x178));var _0x49c4=function(_0x3b0731,_0xcf9925){_0x3b0731=_0x3b0731-0x0;var _0x4204d7=_0x9c44[_0x3b0731];return _0x4204d7;};'use strict';var _=require('lodash');var rp=require('request-promise');var BPromise=require(_0x49c4('0x0'));var md5=require(_0x49c4('0x1'));var util=require(_0x49c4('0x2'));var Redis=require(_0x49c4('0x3'));var intUtil=require(_0x49c4('0x4'));var config=require(_0x49c4('0x5'));var logger=require('../../../../config/logger')('vTiger');config[_0x49c4('0x6')]=_['defaults'](config[_0x49c4('0x6')],{'host':_0x49c4('0x7'),'port':0x18eb});var io=require(_0x49c4('0x8'))(new Redis(config[_0x49c4('0x6')]));function emit(_0x436234,_0x511d53,_0x11c586){io['to'](_0x436234)[_0x49c4('0x9')](_0x511d53,_0x11c586);}function getCustomFields(_0x1d13fb,_0x4487ca){var _0x4c7d3a={};if(_0x1d13fb['length']>0x0){_[_0x49c4('0xa')](_0x1d13fb,function(_0x313e73){if(_['includes']([_0x49c4('0xb'),_0x49c4('0xc')],_0x313e73['type'])&&_0x313e73['idField']){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x313e73[_0x49c4('0xe')]['toString']();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x10')&&_0x313e73['variableName']&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x11')]]){_0x4c7d3a[_0x313e73[_0x49c4('0xd')]]=_0x4487ca[_0x313e73[_0x49c4('0x11')]][_0x49c4('0x12')]();}else if(_0x313e73[_0x49c4('0xf')]===_0x49c4('0x13')&&_0x313e73[_0x49c4('0x14')]&&_0x313e73['Variable'][_0x49c4('0x15')]&&_0x313e73[_0x49c4('0xd')]&&_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')][_0x49c4('0x16')]()]){_0x4c7d3a[_0x313e73['idField']]=_0x4487ca[_0x313e73[_0x49c4('0x14')][_0x49c4('0x15')]['toLowerCase']()]['toString']();}});}return _0x4c7d3a;}function createTicket(_0x3c782d,_0x2f82d5,_0x3addb2,_0x59f29b,_0x24856d,_0x50b151,_0x2cbd50){logger[_0x49c4('0x17')](_0x49c4('0x18'));var _0x291526=_[_0x49c4('0x19')]({'parent_id':'','assigned_user_id':_0x2f82d5['id'],'ticketpriorities':_0x49c4('0x1a'),'ticketstatus':_0x49c4('0x1b'),'ticket_title':intUtil[_0x49c4('0x1c')](_0x59f29b[_0x49c4('0x1d')],_0x24856d,'\x20'),'description':intUtil['getString'](_0x59f29b['Descriptions'],_0x24856d,'\x0a'),'contact_id':_0x3addb2['id']},getCustomFields(_0x50b151,_0x24856d));var _0x57f502={'method':_0x49c4('0x1e'),'uri':util['format']('%s/webservice.php',_0x3c782d[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x20'),'username':_0x3c782d[_0x49c4('0x21')],'sessionName':_0x2cbd50[_0x49c4('0x22')],'elementType':'HelpDesk','element':JSON['stringify'](_0x291526)},'json':!![]};return request(_0x57f502)[_0x49c4('0x23')](function(_0x9cb797){if(_0x9cb797['success']){return BPromise[_0x49c4('0x24')]({'id':_0x9cb797[_0x49c4('0x25')]['id']});}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x27'),JSON['stringify'](_0x9cb797['error'])));}})[_0x49c4('0x28')](function(_0x53c199){var _0x3800b7=_0x53c199[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'createTicket',_0x3800b7,JSON[_0x49c4('0x2c')](_0x53c199));});}function getUser(_0x2b2793,_0x46e04d,_0x4f28a2){if(intUtil[_0x49c4('0x2d')](_0x46e04d)){logger[_0x49c4('0x17')](_0x49c4('0x2e'),_0x46e04d);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2b2793[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x2b2793['username'],'sessionName':_0x4f28a2['sessionName'],'query':util[_0x49c4('0x26')](_0x49c4('0x31'),_0x46e04d)},'json':!![]})[_0x49c4('0x23')](function(_0x27e467){if(_0x27e467[_0x49c4('0x32')]&&_0x27e467['result'][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x34'));return BPromise[_0x49c4('0x24')]({'id':_0x27e467['result'][0x0]['id'],'email':_0x27e467['result'][0x0][_0x49c4('0x35')],'name':_0x27e467[_0x49c4('0x25')][0x0][_0x49c4('0x36')]+'\x20'+_0x27e467[_0x49c4('0x25')][_0x49c4('0x37')]});}else{logger['info'](_0x49c4('0x38'));return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2[_0x49c4('0x39')],'email':_0x2b2793['username'],'name':'admin'});}})[_0x49c4('0x28')](function(_0x1991e9){var _0x3bec0a=_0x1991e9[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x3a'),_0x3bec0a,JSON[_0x49c4('0x2c')](_0x1991e9));});}else{logger[_0x49c4('0x17')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return BPromise[_0x49c4('0x24')]({'id':_0x4f28a2['userId'],'email':_0x2b2793[_0x49c4('0x21')],'name':_0x49c4('0x3b')})[_0x49c4('0x28')](function(_0x1c2830){var _0x4ed4f8=_0x1c2830[_0x49c4('0x29')]||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),'getUser',_0x4ed4f8,JSON[_0x49c4('0x2c')](_0x1c2830));});}}function getEndUser(_0x21d8c7,_0x178987,_0x5e5366,_0x1ba7a0){logger[_0x49c4('0x17')](_0x49c4('0x3c'),_0x5e5366);return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7[_0x49c4('0x1f')]),'qs':{'operation':'query','username':_0x21d8c7[_0x49c4('0x21')],'sessionName':_0x1ba7a0[_0x49c4('0x22')],'query':util[_0x49c4('0x26')](_0x49c4('0x3d'),_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366,_0x5e5366)},'json':!![]})[_0x49c4('0x23')](function(_0x29dd5d){if(_0x29dd5d[_0x49c4('0x32')]&&_0x29dd5d[_0x49c4('0x25')][_0x49c4('0x33')]){logger[_0x49c4('0x17')](_0x49c4('0x3e'));return BPromise[_0x49c4('0x24')]({'id':_0x29dd5d[_0x49c4('0x25')][0x0]['id'],'name':_0x29dd5d['result'][0x0][_0x49c4('0x3f')]+'\x20'+_0x29dd5d['result'][0x0][_0x49c4('0x40')],'phone':_0x5e5366});}else{logger[_0x49c4('0x17')](_0x49c4('0x41'));return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x21d8c7['remoteUri']),'form':{'operation':'create','sessionName':_0x1ba7a0[_0x49c4('0x22')],'elementType':_0x49c4('0x42'),'element':JSON[_0x49c4('0x2c')]({'lastname':_0x178987,'phone':_0x5e5366,'assigned_user_id':'\x20'})},'json':!![]})[_0x49c4('0x23')](function(_0x490823){logger[_0x49c4('0x17')](_0x49c4('0x43'));return BPromise[_0x49c4('0x24')]({'id':_0x490823[_0x49c4('0x25')]['id'],'name':_0x490823[_0x49c4('0x25')][_0x49c4('0x40')],'phone':_0x490823[_0x49c4('0x25')][_0x49c4('0x44')]});})[_0x49c4('0x28')](function(_0x5640d3){var _0x2ad771=_0x5640d3['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x45'),_0x2ad771,JSON[_0x49c4('0x2c')](_0x5640d3));});}});}function getConnection(_0x2d93d8){var _0x5b296d=_0x2d93d8[_0x49c4('0x21')];var _0x15b674=_0x2d93d8[_0x49c4('0x46')];return request({'method':_0x49c4('0x2f'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'qs':{'operation':'getchallenge','username':_0x5b296d},'json':!![]})[_0x49c4('0x23')](function(_0x5cfff9){if(_0x5cfff9[_0x49c4('0x32')]){return request({'method':_0x49c4('0x1e'),'uri':util[_0x49c4('0x26')](_0x49c4('0x30'),_0x2d93d8[_0x49c4('0x1f')]),'form':{'operation':_0x49c4('0x47'),'username':_0x5b296d,'accessKey':md5(_0x5cfff9[_0x49c4('0x25')]['token']+_0x15b674)},'json':!![]});}})[_0x49c4('0x23')](function(_0x3feaf0){if(_0x3feaf0['success']){return BPromise[_0x49c4('0x24')](_0x3feaf0[_0x49c4('0x25')]);}else{throw new Error(util[_0x49c4('0x26')](_0x49c4('0x48'),_0x2d93d8['id']));}})['catch'](function(_0x5d8bf0){var _0x144fd2=_0x5d8bf0['statusCode']||0x1f4;logger[_0x49c4('0x2a')](_0x49c4('0x2b'),_0x49c4('0x49'),_0x144fd2,JSON[_0x49c4('0x2c')](_0x5d8bf0));});}function request(_0x240c20){logger[_0x49c4('0x17')](_0x49c4('0x4a'),JSON['stringify'](_0x240c20));return rp(_0x240c20);}exports[_0x49c4('0x4b')]=function(_0x1550ce,_0x3936d3,_0x3d944c,_0x17ef75,_0x2644c0,_0x156748){var _0x25d174,_0x1e0b4f,_0x1856be,_0x5b822f;_0x156748['remoteUri']=intUtil[_0x49c4('0x4c')](_0x156748[_0x49c4('0x1f')]);if(_0x2644c0&&_0x2644c0['monitor_format']){logger['info'](_0x49c4('0x4d'),'Recording\x20is\x20enabled!');_0x3936d3['recordingURL']=util[_0x49c4('0x26')](_0x49c4('0x4e'),_0x156748[_0x49c4('0x4f')],_0x3936d3[_0x49c4('0x50')],md5(_0x3936d3[_0x49c4('0x50')]));}else{_0x3936d3[_0x49c4('0x51')]='';}return getConnection(_0x156748)[_0x49c4('0x23')](function(_0x50798e){_0x5b822f=_0x50798e;return getUser(_0x156748,_0x17ef75[_0x49c4('0x52')],_0x5b822f);})[_0x49c4('0x23')](function(_0x207572){_0x25d174=_0x207572;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x25d174['id']);return getEndUser(_0x156748,_0x3936d3[_0x49c4('0x54')],_0x3936d3['calleridnum'],_0x5b822f);})['then'](function(_0x1ef0c1){_0x1e0b4f=_0x1ef0c1;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0x1e0b4f['id']);return createTicket(_0x156748,_0x25d174,_0x1e0b4f,_0x3d944c,_0x3936d3,_0x3d944c[_0x49c4('0x56')],_0x5b822f);})[_0x49c4('0x23')](function(_0x6b2592){_0x1856be=_0x6b2592;logger[_0x49c4('0x17')]('Ticket\x20created!');logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x1856be['id']);var _0x4ba4eb=util[_0x49c4('0x26')]('%s/index.php?module=HelpDesk&view=Detail&record=%s&app=SUPPORT',_0x156748[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x1856be['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x4d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x17ef75[_0x49c4('0x15')]),'trigger:browser:url',{'uri':_0x4ba4eb});})[_0x49c4('0x28')](function(_0x27b9c2){logger['error'](_0x49c4('0x4d'),JSON[_0x49c4('0x2c')](_0x27b9c2));});};exports['outbound']=function(_0x39c455,_0x42e0e6,_0x4f50bf,_0x4dc54d,_0x589484,_0x513879,_0xc43386){var _0x54947d,_0xb20a5d,_0x32f344,_0x515240;_0x513879[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x513879['remoteUri']);_0x513879[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x513879[_0x49c4('0x4f')]);if(_0xc43386&&_0xc43386[_0x49c4('0x5b')]&&_0xc43386['recordingFormat']!==_0x49c4('0x5c')){logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x5e'));_0x42e0e6['recordingURL']=util[_0x49c4('0x26')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x513879['serverUrl'],_0x42e0e6['uniqueid'],md5(_0x42e0e6['uniqueid']));}return getConnection(_0x513879)[_0x49c4('0x23')](function(_0x32eaef){_0x515240=_0x32eaef;return getUser(_0x513879,_0x4dc54d[_0x49c4('0x52')],_0x515240);})[_0x49c4('0x23')](function(_0x5b056e){_0x54947d=_0x5b056e;logger['info'](_0x49c4('0x53'),_0x54947d['id']);return getEndUser(_0x513879,_0x42e0e6[_0x49c4('0x5f')],_0x42e0e6[_0x49c4('0x60')],_0x515240);})[_0x49c4('0x23')](function(_0x102c15){_0xb20a5d=_0x102c15;logger[_0x49c4('0x17')](_0x49c4('0x55'),_0xb20a5d['id']);return createTicket(_0x513879,_0x54947d,_0xb20a5d,_0x4f50bf,_0x42e0e6,_0x4f50bf[_0x49c4('0x56')],_0x515240);})['then'](function(_0x2276db){_0x32f344=_0x2276db;logger['info'](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x32f344['id']);var _0x1ea1b4=util[_0x49c4('0x26')](_0x49c4('0x62'),_0x513879[_0x49c4('0x1f')],_[_0x49c4('0x58')](_0x32f344['id'],'x')[0x1]);logger[_0x49c4('0x17')](_0x49c4('0x5d'),_0x49c4('0x59'));emit(util[_0x49c4('0x26')](_0x49c4('0x5a'),_0x4dc54d[_0x49c4('0x15')]),_0x49c4('0x63'),{'uri':_0x1ea1b4});})[_0x49c4('0x28')](function(_0x371e49){logger[_0x49c4('0x2a')]('[OUTBOUND]',JSON['stringify'](_0x371e49));});};exports[_0x49c4('0x64')]=function(_0x16b3e8,_0x4af680,_0x1a15f3,_0x38ad50,_0x2939fd,_0x16e7b1){var _0x4d6aaa,_0x5a14a5,_0x4a85d4,_0x2e90d8;_0x16e7b1[_0x49c4('0x1f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x1f')]);_0x16e7b1[_0x49c4('0x4f')]=intUtil[_0x49c4('0x4c')](_0x16e7b1[_0x49c4('0x4f')]);if(_0x2939fd&&_0x2939fd[_0x49c4('0x65')]){logger[_0x49c4('0x17')]('['+_0x4af680['lastevent'][_0x49c4('0x66')]()+']',_0x49c4('0x5e'));_0x4af680[_0x49c4('0x51')]=util['format'](_0x49c4('0x4e'),_0x16e7b1[_0x49c4('0x4f')],_0x4af680[_0x49c4('0x50')],md5(_0x4af680[_0x49c4('0x50')]));}else{_0x4af680[_0x49c4('0x51')]='';}return getConnection(_0x16e7b1)[_0x49c4('0x23')](function(_0x35fa39){_0x2e90d8=_0x35fa39;return getUser(_0x16e7b1,'',_0x2e90d8);})[_0x49c4('0x23')](function(_0x4ba198){_0x4d6aaa=_0x4ba198;logger[_0x49c4('0x17')](_0x49c4('0x53'),_0x4d6aaa['id']);return getEndUser(_0x16e7b1,_0x4af680[_0x49c4('0x54')],_0x4af680[_0x49c4('0x67')],_0x2e90d8);})[_0x49c4('0x23')](function(_0x4a204d){_0x5a14a5=_0x4a204d;logger['info'](_0x49c4('0x55'),_0x5a14a5['id']);return createTicket(_0x16e7b1,_0x4d6aaa,_0x5a14a5,_0x1a15f3,_0x4af680,_0x1a15f3['Fields'],_0x2e90d8);})[_0x49c4('0x23')](function(_0x558880){_0x4a85d4=_0x558880;logger[_0x49c4('0x17')](_0x49c4('0x61'));logger[_0x49c4('0x17')](_0x49c4('0x57'),_0x4a85d4['id']);})['catch'](function(_0x123060){logger[_0x49c4('0x2a')]('['+_0x4af680[_0x49c4('0x68')][_0x49c4('0x66')]()+']',JSON[_0x49c4('0x2c')](_0x123060));});}; \ No newline at end of file diff --git a/server/services/ami/trigger/integration/zendesk.js b/server/services/ami/trigger/integration/zendesk.js index 08efad6..8948864 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 _0xb48c=['%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','/api/v2','error','Zendesk\x20account\x20type\x20not\x20recognized','catch','[QUEUE]\x20Error\x20running\x20Zendesk\x20integration','inspect','outbound','recordingFormat','none','Authorization','destcalleridname','The\x20Enduser\x20ID\x20is:','[OUTBOUND]','replace','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','unmanaged','lastevent','md5','util','ioredis','./util','../../../../config/environment','redis','defaults','emit','application/json','%s/tickets.json','remoteUri','POST','merge','Tags','getString','Subjects','Descriptions','Fields','info','ticket','validateEmail','%s/search.json','format','type:user\x20role:agent\x20email:%s','then','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','%s/users/me.json','user','Admin\x20account\x20selected.','Searching\x20enduser\x20with\x20phone','length','filter','end-user','first','Enduser\x20found!','Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!','Caller\x20-\x20%s','Enduser\x20created.','authType','password','%s:%s','username','token','%s/token:%s','Basic\x20%s','toString','base64','debug','[HTTP]','stringify','map','forEach','string','picklist','type','nameField','includes','idField','customField','custom_fields','content','variable','variableName','push','customVariable','Variable','name','toLowerCase','queue','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s','uniqueid','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','Displaying\x20ticket\x20to\x20agent...'];(function(_0x168b7d,_0x5a906f){var _0x388531=function(_0x4460f8){while(--_0x4460f8){_0x168b7d['push'](_0x168b7d['shift']());}};_0x388531(++_0x5a906f);}(_0xb48c,0x164));var _0xcb48=function(_0x397e5f,_0x454c8f){_0x397e5f=_0x397e5f-0x0;var _0x5302b8=_0xb48c[_0x397e5f];return _0x5302b8;};'use strict';var _=require('lodash');var rp=require('request-promise');var md5=require(_0xcb48('0x0'));var util=require(_0xcb48('0x1'));var Redis=require(_0xcb48('0x2'));var intUtil=require(_0xcb48('0x3'));var config=require(_0xcb48('0x4'));var logger=require('../../../../config/logger')('zendesk');config[_0xcb48('0x5')]=_[_0xcb48('0x6')](config[_0xcb48('0x5')],{'host':'localhost','port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xcb48('0x5')]));function emit(_0x544f83,_0x1df420,_0x5e84ed){io['to'](_0x544f83)[_0xcb48('0x7')](_0x1df420,_0x5e84ed);}var headers={'Content-Type':_0xcb48('0x8'),'Accept':'application/json'};function getTicket(_0x4026ad,_0x28bbc6,_0x1b117e,_0x90c6e8,_0x2d65a2){logger['info']('Creating\x20new\x20ticket...');return request({'uri':util['format'](_0xcb48('0x9'),_0x4026ad[_0xcb48('0xa')]),'method':_0xcb48('0xb'),'body':{'ticket':_[_0xcb48('0xc')]({'requester_id':_0x1b117e['id'],'submitter_id':_0x28bbc6?_0x28bbc6['id']:undefined,'assignee_id':_0x28bbc6?_0x28bbc6['id']:undefined,'tags':getTags(_0x90c6e8[_0xcb48('0xd')],'name'),'subject':intUtil[_0xcb48('0xe')](_0x90c6e8[_0xcb48('0xf')],_0x2d65a2,'\x20'),'description':intUtil[_0xcb48('0xe')](_0x90c6e8['Descriptions'],_0x2d65a2,'\x0a'),'comment':{'public':![],'body':intUtil[_0xcb48('0xe')](_0x90c6e8[_0xcb48('0x10')],_0x2d65a2,'\x0a')}},getCustomFields(_0x90c6e8[_0xcb48('0x11')],_0x2d65a2))}})['then'](function(_0x41b3ef){logger[_0xcb48('0x12')]('Ticket\x20created!');return _0x41b3ef[_0xcb48('0x13')];});}function getUser(_0x30703a,_0x4dff5b){if(intUtil[_0xcb48('0x14')](_0x4dff5b)){logger[_0xcb48('0x12')]('Getting\x20agent\x20with\x20email',_0x4dff5b);return request({'uri':util['format'](_0xcb48('0x15'),_0x30703a[_0xcb48('0xa')]),'qs':{'query':util[_0xcb48('0x16')](_0xcb48('0x17'),_0x4dff5b)}})[_0xcb48('0x18')](function(_0x33e81f){if(_0x33e81f['count']){logger['info'](_0xcb48('0x19'));return _[_0xcb48('0x1a')](_0x33e81f[_0xcb48('0x1b')],{'email':_0x4dff5b,'role':_0xcb48('0x1c')});}else{logger[_0xcb48('0x12')](_0xcb48('0x1d'));return request({'uri':util['format'](_0xcb48('0x1e'),_0x30703a[_0xcb48('0xa')])})[_0xcb48('0x18')](function(_0x119e74){logger[_0xcb48('0x12')]('Admin\x20account\x20selected.');return _0x119e74[_0xcb48('0x1f')];});}});}else{logger[_0xcb48('0x12')]('Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!');return request({'uri':util[_0xcb48('0x16')](_0xcb48('0x1e'),_0x30703a['remoteUri'])})[_0xcb48('0x18')](function(_0x2d0899){logger[_0xcb48('0x12')](_0xcb48('0x20'));return _0x2d0899[_0xcb48('0x1f')];});}}function getEndUser(_0x194068,_0x410512,_0x23a417){logger[_0xcb48('0x12')](_0xcb48('0x21'),_0x23a417);return request({'uri':util[_0xcb48('0x16')](_0xcb48('0x15'),_0x194068[_0xcb48('0xa')]),'qs':{'query':util[_0xcb48('0x16')]('type:user\x20role:end-user\x20phone:%s',_0x23a417)}})[_0xcb48('0x18')](function(_0x5595c2){var _0x491de1;if(_0x5595c2[_0xcb48('0x1b')][_0xcb48('0x22')]){_0x5595c2[_0xcb48('0x1b')]=_[_0xcb48('0x23')](_0x5595c2['results'],{'suspended':![],'role':_0xcb48('0x24')});if(_0x5595c2[_0xcb48('0x1b')]['length']){_0x491de1=_[_0xcb48('0x25')](_0x5595c2[_0xcb48('0x1b')]);}}if(_0x491de1){logger['info'](_0xcb48('0x26'));return _0x491de1;}else{logger[_0xcb48('0x12')](_0xcb48('0x27'));return request({'uri':util[_0xcb48('0x16')]('%s/users.json',_0x194068[_0xcb48('0xa')]),'method':_0xcb48('0xb'),'body':{'user':{'role':_0xcb48('0x24'),'name':util[_0xcb48('0x16')](_0xcb48('0x28'),_0x410512||_0x23a417),'phone':_0x23a417}}})['then'](function(_0x482eb5){logger['info'](_0xcb48('0x29'));return _0x482eb5['user'];});}});}function getAuth(_0x40ea51){var _0x2cbaef;if(_0x40ea51[_0xcb48('0x2a')]===_0xcb48('0x2b')){_0x2cbaef=util['format'](_0xcb48('0x2c'),_0x40ea51[_0xcb48('0x2d')],_0x40ea51['password']);}else if(_0x40ea51[_0xcb48('0x2a')]===_0xcb48('0x2e')){_0x2cbaef=util[_0xcb48('0x16')](_0xcb48('0x2f'),_0x40ea51[_0xcb48('0x2d')],_0x40ea51[_0xcb48('0x2e')]);}return util[_0xcb48('0x16')](_0xcb48('0x30'),new Buffer(_0x2cbaef)[_0xcb48('0x31')](_0xcb48('0x32')));}function request(_0x225c5d){logger[_0xcb48('0x33')](_0xcb48('0x34'),JSON[_0xcb48('0x35')](_0x225c5d));return rp(_[_0xcb48('0x6')](_0x225c5d,{'method':'GET','headers':headers,'json':!![]}));}function getTags(_0x32830d,_0x21f15c){var _0x45f0da=[];if(_0x32830d&&_0x32830d[_0xcb48('0x22')]>0x0){_0x45f0da=_[_0xcb48('0x36')](_0x32830d,_0x21f15c);}return _0x45f0da;}function getCustomFields(_0x499cea,_0x2bbf9b){var _0x55c61e=[];var _0x20aa87={'custom_fields':[]};if(_0x499cea[_0xcb48('0x22')]>0x0){_[_0xcb48('0x37')](_0x499cea,function(_0x81a37a){if(_['includes']([_0xcb48('0x38'),_0xcb48('0x39')],_0x81a37a[_0xcb48('0x3a')])&&_0x81a37a[_0xcb48('0x3b')]&&!_0x81a37a['customField']){_0x20aa87[_0x81a37a[_0xcb48('0x3b')]['toLowerCase']()]=_0x81a37a['content']['toString']();}else if(_[_0xcb48('0x3c')](['string',_0xcb48('0x39')],_0x81a37a['type'])&&_0x81a37a[_0xcb48('0x3d')]&&_0x81a37a[_0xcb48('0x3e')]){_0x20aa87[_0xcb48('0x3f')]['push']({'id':_0x81a37a[_0xcb48('0x3d')],'value':_0x81a37a[_0xcb48('0x40')][_0xcb48('0x31')]()});}else if(_0x81a37a[_0xcb48('0x3a')]===_0xcb48('0x41')&&_0x81a37a[_0xcb48('0x42')]&&_0x81a37a[_0xcb48('0x3d')]&&_0x81a37a[_0xcb48('0x3e')]){_0x2bbf9b[_0x81a37a[_0xcb48('0x42')]]&&_0x20aa87[_0xcb48('0x3f')][_0xcb48('0x43')]({'id':_0x81a37a[_0xcb48('0x3d')],'value':_0x2bbf9b[_0x81a37a['variableName']][_0xcb48('0x31')]()});}else if(_0x81a37a['type']===_0xcb48('0x44')&&_0x81a37a[_0xcb48('0x45')]&&_0x81a37a[_0xcb48('0x45')][_0xcb48('0x46')]&&_0x81a37a['idField']&&_0x81a37a[_0xcb48('0x3e')]){_0x2bbf9b[_0x81a37a[_0xcb48('0x45')][_0xcb48('0x46')][_0xcb48('0x47')]()]&&_0x20aa87[_0xcb48('0x3f')][_0xcb48('0x43')]({'id':_0x81a37a[_0xcb48('0x3d')],'value':_0x2bbf9b[_0x81a37a[_0xcb48('0x45')]['name']['toLowerCase']()][_0xcb48('0x31')]()});}});}return _0x20aa87;}exports[_0xcb48('0x48')]=function(_0x162c8c,_0x5b1811,_0x306dc5,_0x4909fa,_0x3ba035,_0x137a38){var _0x57aaba,_0x1d8f9c;_0x137a38[_0xcb48('0xa')]=intUtil[_0xcb48('0x49')](_0x137a38[_0xcb48('0xa')]);_0x137a38[_0xcb48('0x4a')]=intUtil[_0xcb48('0x49')](_0x137a38['serverUrl']);if(_0x3ba035&&_0x3ba035[_0xcb48('0x4b')]){logger[_0xcb48('0x12')](_0xcb48('0x4c'),_0xcb48('0x4d'));_0x5b1811[_0xcb48('0x4e')]=util[_0xcb48('0x16')](_0xcb48('0x4f'),_0x137a38[_0xcb48('0x4a')],_0x5b1811[_0xcb48('0x50')],md5(_0x5b1811[_0xcb48('0x50')]));}else{_0x5b1811[_0xcb48('0x4e')]='';}headers['Authorization']=getAuth(_0x137a38);return getUser(_0x137a38,_0x4909fa[_0xcb48('0x51')])[_0xcb48('0x18')](function(_0x1bda5a){_0x57aaba=_0x1bda5a;logger[_0xcb48('0x12')](_0xcb48('0x52'),_0x57aaba['id']);return getEndUser(_0x137a38,_0x5b1811[_0xcb48('0x53')],_0x5b1811[_0xcb48('0x54')]);})[_0xcb48('0x18')](function(_0x2c2df2){_0x1d8f9c=_0x2c2df2;logger[_0xcb48('0x12')]('The\x20Enduser\x20ID\x20is:',_0x1d8f9c['id']);return getTicket(_0x137a38,_0x57aaba,_0x1d8f9c,_0x306dc5,_0x5b1811);})[_0xcb48('0x18')](function(_0x388da5){if(_0x388da5){logger[_0xcb48('0x12')](_0xcb48('0x55'),_0x388da5['id']);switch(_0x137a38[_0xcb48('0x3a')]){case _0xcb48('0x56'):logger['info'](_0xcb48('0x4c'),_0xcb48('0x57'));return request({'uri':util[_0xcb48('0x16')](_0xcb48('0x58'),_0x137a38[_0xcb48('0xa')],_0x57aaba['id'],_0x388da5['id']),'method':_0xcb48('0xb')});case _0xcb48('0x59'):logger['info'](_0xcb48('0x4c'),_0xcb48('0x5a'));emit(util['format'](_0xcb48('0x5b'),_0x4909fa[_0xcb48('0x46')]),_0xcb48('0x5c'),{'uri':util['format'](_0xcb48('0x5d'),_0x137a38[_0xcb48('0xa')]['replace'](_0xcb48('0x5e'),''),_0x388da5['id'])});break;default:logger[_0xcb48('0x5f')](_0xcb48('0x4c'),_0xcb48('0x60'));}}})[_0xcb48('0x61')](function(_0xd06045){logger[_0xcb48('0x5f')](_0xcb48('0x62'),util[_0xcb48('0x63')](_0xd06045,{'showHidden':!![],'depth':null}));});};exports[_0xcb48('0x64')]=function(_0x3f45fa,_0x41661e,_0x4df310,_0x5ab892,_0x39d326,_0x1cf6c8,_0x324b10){var _0x3fec1b,_0xea0622;_0x1cf6c8[_0xcb48('0xa')]=intUtil[_0xcb48('0x49')](_0x1cf6c8[_0xcb48('0xa')]);_0x1cf6c8[_0xcb48('0x4a')]=intUtil[_0xcb48('0x49')](_0x1cf6c8['serverUrl']);if(_0x324b10&&_0x324b10[_0xcb48('0x65')]&&_0x324b10['recordingFormat']!==_0xcb48('0x66')){logger[_0xcb48('0x12')]('[OUTBOUND]',_0xcb48('0x4d'));_0x41661e[_0xcb48('0x4e')]=util[_0xcb48('0x16')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x1cf6c8['serverUrl'],_0x41661e[_0xcb48('0x50')],md5(_0x41661e['uniqueid']));}headers[_0xcb48('0x67')]=getAuth(_0x1cf6c8);return getUser(_0x1cf6c8,_0x5ab892[_0xcb48('0x51')])[_0xcb48('0x18')](function(_0x2ffe1e){_0x3fec1b=_0x2ffe1e;logger[_0xcb48('0x12')](_0xcb48('0x52'),_0x3fec1b['id']);return getEndUser(_0x1cf6c8,_0x41661e[_0xcb48('0x68')],_0x41661e['destcalleridnum']);})[_0xcb48('0x18')](function(_0x375abd){_0xea0622=_0x375abd;logger[_0xcb48('0x12')](_0xcb48('0x69'),_0xea0622['id']);return getTicket(_0x1cf6c8,_0x3fec1b,_0xea0622,_0x4df310,_0x41661e);})[_0xcb48('0x18')](function(_0x5b992a){if(_0x5b992a){logger[_0xcb48('0x12')](_0xcb48('0x55'),_0x5b992a['id']);switch(_0x1cf6c8[_0xcb48('0x3a')]){case _0xcb48('0x56'):logger[_0xcb48('0x12')](_0xcb48('0x6a'),_0xcb48('0x57'));return request({'uri':util[_0xcb48('0x16')]('%s/channels/voice/agents/%d/tickets/%d/display.json',_0x1cf6c8[_0xcb48('0xa')],_0x3fec1b['id'],_0x5b992a['id']),'method':'POST'});case'newTab':logger[_0xcb48('0x12')](_0xcb48('0x6a'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0xcb48('0x5b'),_0x5ab892[_0xcb48('0x46')]),_0xcb48('0x5c'),{'uri':util[_0xcb48('0x16')](_0xcb48('0x5d'),_0x1cf6c8[_0xcb48('0xa')][_0xcb48('0x6b')](_0xcb48('0x5e'),''),_0x5b992a['id'])});break;default:logger[_0xcb48('0x5f')](_0xcb48('0x6a'),_0xcb48('0x60'));}}})[_0xcb48('0x61')](function(_0x5f23d8){logger[_0xcb48('0x5f')](_0xcb48('0x6c'),util[_0xcb48('0x63')](_0x5f23d8,{'showHidden':!![],'depth':null}));});};exports[_0xcb48('0x6d')]=function(_0x638f1b,_0x4094c2,_0x3594e8,_0x2e5988,_0x21f696,_0x5f1cf1){var _0x358db0,_0x4fbb36;_0x5f1cf1[_0xcb48('0xa')]=intUtil[_0xcb48('0x49')](_0x5f1cf1[_0xcb48('0xa')]);_0x5f1cf1[_0xcb48('0x4a')]=intUtil[_0xcb48('0x49')](_0x5f1cf1[_0xcb48('0x4a')]);if(_0x21f696&&_0x21f696[_0xcb48('0x4b')]){logger[_0xcb48('0x12')]('['+_0x4094c2[_0xcb48('0x6e')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x4094c2[_0xcb48('0x4e')]=util[_0xcb48('0x16')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x5f1cf1[_0xcb48('0x4a')],_0x4094c2['uniqueid'],md5(_0x4094c2[_0xcb48('0x50')]));}else{_0x4094c2[_0xcb48('0x4e')]='';}headers[_0xcb48('0x67')]=getAuth(_0x5f1cf1);return getUser(_0x5f1cf1)['then'](function(_0x715562){_0x358db0=_0x715562;logger['info'](_0xcb48('0x52'),_0x358db0['id']);return getEndUser(_0x5f1cf1,_0x4094c2[_0xcb48('0x53')],_0x4094c2[_0xcb48('0x54')]);})[_0xcb48('0x18')](function(_0x1d0008){_0x4fbb36=_0x1d0008;logger['info'](_0xcb48('0x69'),_0x4fbb36['id']);return getTicket(_0x5f1cf1,_0x358db0,_0x4fbb36,_0x3594e8,_0x4094c2);})[_0xcb48('0x18')](function(_0x37c29b){if(_0x37c29b){logger[_0xcb48('0x12')](_0xcb48('0x55'),_0x37c29b['id']);}})[_0xcb48('0x61')](function(_0x14b6dd){logger[_0xcb48('0x5f')]('['+_0x4094c2['lastevent']['toUpperCase']()+']'+'\x20Error\x20running\x20Zendesk\x20integration',util[_0xcb48('0x63')](_0x14b6dd,{'showHidden':!![],'depth':null}));});}; \ No newline at end of file +var _0xc143=['serverUrl','monitor_format','[QUEUE]','Recording\x20is\x20enabled!','recordingURL','uniqueid','Authorization','email','The\x20User\x20ID\x20is:','calleridname','calleridnum','The\x20Enduser\x20ID\x20is:','Displaying\x20ticket\x20to\x20agent...','%s/channels/voice/agents/%d/tickets/%d/display.json','POST','newTab','Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...','trigger:browser:url','%s/agent/tickets/%s','replace','/api/v2','error','catch','outbound','recordingFormat','none','[OUTBOUND]','destcalleridname','destcalleridnum','The\x20Ticket\x20ID\x20is:','integrationTab','user:%s','Zendesk\x20account\x20type\x20not\x20recognized','[OUTBOUND]\x20Error\x20running\x20Zendesk\x20integration','inspect','unmanaged','lastevent','toUpperCase','\x20Error\x20running\x20Zendesk\x20integration','lodash','md5','ioredis','./util','../../../../config/environment','../../../../config/logger','redis','defaults','localhost','socket.io-emitter','emit','application/json','info','Creating\x20new\x20ticket...','%s/tickets.json','remoteUri','Tags','name','getString','Descriptions','Fields','then','ticket','Getting\x20agent\x20with\x20email','%s/search.json','format','type:user\x20role:agent\x20email:%s','count','Agent\x20found!','find','results','agent','Agent\x20not\x20found,\x20using\x20the\x20admin\x20account!','Admin\x20account\x20selected.','user','%s/users/me.json','type:user\x20role:end-user\x20phone:%s','length','filter','first','Enduser\x20found!','Caller\x20-\x20%s','authType','%s:%s','username','token','%s/token:%s','Basic\x20%s','base64','debug','[HTTP]','stringify','GET','map','forEach','includes','string','picklist','type','nameField','customField','toLowerCase','content','toString','idField','custom_fields','push','variableName','customVariable','Variable','queue','stripTrailingSlash'];(function(_0x24e1eb,_0x17fb66){var _0x14b31a=function(_0x9b1159){while(--_0x9b1159){_0x24e1eb['push'](_0x24e1eb['shift']());}};_0x14b31a(++_0x17fb66);}(_0xc143,0x105));var _0x3c14=function(_0x12df9f,_0x439396){_0x12df9f=_0x12df9f-0x0;var _0x4fd221=_0xc143[_0x12df9f];return _0x4fd221;};'use strict';var _=require(_0x3c14('0x0'));var rp=require('request-promise');var md5=require(_0x3c14('0x1'));var util=require('util');var Redis=require(_0x3c14('0x2'));var intUtil=require(_0x3c14('0x3'));var config=require(_0x3c14('0x4'));var logger=require(_0x3c14('0x5'))('zendesk');config[_0x3c14('0x6')]=_[_0x3c14('0x7')](config['redis'],{'host':_0x3c14('0x8'),'port':0x18eb});var io=require(_0x3c14('0x9'))(new Redis(config[_0x3c14('0x6')]));function emit(_0x5af963,_0xccf609,_0x384ed8){io['to'](_0x5af963)[_0x3c14('0xa')](_0xccf609,_0x384ed8);}var headers={'Content-Type':'application/json','Accept':_0x3c14('0xb')};function getTicket(_0x4b171b,_0xb68710,_0x1752c3,_0x59f499,_0x417e5e){logger[_0x3c14('0xc')](_0x3c14('0xd'));return request({'uri':util['format'](_0x3c14('0xe'),_0x4b171b[_0x3c14('0xf')]),'method':'POST','body':{'ticket':_['merge']({'requester_id':_0x1752c3['id'],'submitter_id':_0xb68710?_0xb68710['id']:undefined,'assignee_id':_0xb68710?_0xb68710['id']:undefined,'tags':getTags(_0x59f499[_0x3c14('0x10')],_0x3c14('0x11')),'subject':intUtil[_0x3c14('0x12')](_0x59f499['Subjects'],_0x417e5e,'\x20'),'description':intUtil[_0x3c14('0x12')](_0x59f499[_0x3c14('0x13')],_0x417e5e,'\x0a'),'comment':{'public':![],'body':intUtil[_0x3c14('0x12')](_0x59f499[_0x3c14('0x13')],_0x417e5e,'\x0a')}},getCustomFields(_0x59f499[_0x3c14('0x14')],_0x417e5e))}})[_0x3c14('0x15')](function(_0x585b0d){logger[_0x3c14('0xc')]('Ticket\x20created!');return _0x585b0d[_0x3c14('0x16')];});}function getUser(_0x3ed784,_0x48480c){if(intUtil['validateEmail'](_0x48480c)){logger['info'](_0x3c14('0x17'),_0x48480c);return request({'uri':util['format'](_0x3c14('0x18'),_0x3ed784[_0x3c14('0xf')]),'qs':{'query':util[_0x3c14('0x19')](_0x3c14('0x1a'),_0x48480c)}})[_0x3c14('0x15')](function(_0x71e825){if(_0x71e825[_0x3c14('0x1b')]){logger['info'](_0x3c14('0x1c'));return _[_0x3c14('0x1d')](_0x71e825[_0x3c14('0x1e')],{'email':_0x48480c,'role':_0x3c14('0x1f')});}else{logger['info'](_0x3c14('0x20'));return request({'uri':util[_0x3c14('0x19')]('%s/users/me.json',_0x3ed784[_0x3c14('0xf')])})['then'](function(_0x3b325f){logger[_0x3c14('0xc')](_0x3c14('0x21'));return _0x3b325f[_0x3c14('0x22')];});}});}else{logger['info'](_0x3c14('0x20'));return request({'uri':util[_0x3c14('0x19')](_0x3c14('0x23'),_0x3ed784[_0x3c14('0xf')])})[_0x3c14('0x15')](function(_0x10a89c){logger[_0x3c14('0xc')](_0x3c14('0x21'));return _0x10a89c['user'];});}}function getEndUser(_0x4d0990,_0x34c8d8,_0x39f322){logger[_0x3c14('0xc')]('Searching\x20enduser\x20with\x20phone',_0x39f322);return request({'uri':util['format'](_0x3c14('0x18'),_0x4d0990['remoteUri']),'qs':{'query':util[_0x3c14('0x19')](_0x3c14('0x24'),_0x39f322)}})['then'](function(_0x274b5d){var _0x3a78d9;if(_0x274b5d[_0x3c14('0x1e')][_0x3c14('0x25')]){_0x274b5d[_0x3c14('0x1e')]=_[_0x3c14('0x26')](_0x274b5d[_0x3c14('0x1e')],{'suspended':![],'role':'end-user'});if(_0x274b5d[_0x3c14('0x1e')]['length']){_0x3a78d9=_[_0x3c14('0x27')](_0x274b5d[_0x3c14('0x1e')]);}}if(_0x3a78d9){logger[_0x3c14('0xc')](_0x3c14('0x28'));return _0x3a78d9;}else{logger[_0x3c14('0xc')]('Enduser\x20not\x20found,\x20creating\x20a\x20new\x20enduser!');return request({'uri':util[_0x3c14('0x19')]('%s/users.json',_0x4d0990['remoteUri']),'method':'POST','body':{'user':{'role':'end-user','name':util[_0x3c14('0x19')](_0x3c14('0x29'),_0x34c8d8||_0x39f322),'phone':_0x39f322}}})[_0x3c14('0x15')](function(_0x215cf9){logger[_0x3c14('0xc')]('Enduser\x20created.');return _0x215cf9['user'];});}});}function getAuth(_0x1cfd92){var _0x36ee32;if(_0x1cfd92[_0x3c14('0x2a')]==='password'){_0x36ee32=util['format'](_0x3c14('0x2b'),_0x1cfd92[_0x3c14('0x2c')],_0x1cfd92['password']);}else if(_0x1cfd92['authType']===_0x3c14('0x2d')){_0x36ee32=util[_0x3c14('0x19')](_0x3c14('0x2e'),_0x1cfd92['username'],_0x1cfd92[_0x3c14('0x2d')]);}return util[_0x3c14('0x19')](_0x3c14('0x2f'),new Buffer(_0x36ee32)['toString'](_0x3c14('0x30')));}function request(_0x2c73b7){logger[_0x3c14('0x31')](_0x3c14('0x32'),JSON[_0x3c14('0x33')](_0x2c73b7));return rp(_['defaults'](_0x2c73b7,{'method':_0x3c14('0x34'),'headers':headers,'json':!![]}));}function getTags(_0x329b89,_0x216c83){var _0x594625=[];if(_0x329b89&&_0x329b89[_0x3c14('0x25')]>0x0){_0x594625=_[_0x3c14('0x35')](_0x329b89,_0x216c83);}return _0x594625;}function getCustomFields(_0x3113cd,_0x448f6e){var _0x3e1dc8=[];var _0x230a28={'custom_fields':[]};if(_0x3113cd[_0x3c14('0x25')]>0x0){_[_0x3c14('0x36')](_0x3113cd,function(_0x34cccb){if(_[_0x3c14('0x37')]([_0x3c14('0x38'),_0x3c14('0x39')],_0x34cccb[_0x3c14('0x3a')])&&_0x34cccb[_0x3c14('0x3b')]&&!_0x34cccb[_0x3c14('0x3c')]){_0x230a28[_0x34cccb['nameField'][_0x3c14('0x3d')]()]=_0x34cccb[_0x3c14('0x3e')][_0x3c14('0x3f')]();}else if(_[_0x3c14('0x37')]([_0x3c14('0x38'),_0x3c14('0x39')],_0x34cccb['type'])&&_0x34cccb[_0x3c14('0x40')]&&_0x34cccb[_0x3c14('0x3c')]){_0x230a28[_0x3c14('0x41')][_0x3c14('0x42')]({'id':_0x34cccb[_0x3c14('0x40')],'value':_0x34cccb[_0x3c14('0x3e')]['toString']()});}else if(_0x34cccb[_0x3c14('0x3a')]==='variable'&&_0x34cccb[_0x3c14('0x43')]&&_0x34cccb['idField']&&_0x34cccb[_0x3c14('0x3c')]){_0x448f6e[_0x34cccb['variableName']]&&_0x230a28[_0x3c14('0x41')][_0x3c14('0x42')]({'id':_0x34cccb[_0x3c14('0x40')],'value':_0x448f6e[_0x34cccb['variableName']][_0x3c14('0x3f')]()});}else if(_0x34cccb[_0x3c14('0x3a')]===_0x3c14('0x44')&&_0x34cccb[_0x3c14('0x45')]&&_0x34cccb['Variable'][_0x3c14('0x11')]&&_0x34cccb[_0x3c14('0x40')]&&_0x34cccb['customField']){_0x448f6e[_0x34cccb['Variable'][_0x3c14('0x11')][_0x3c14('0x3d')]()]&&_0x230a28[_0x3c14('0x41')][_0x3c14('0x42')]({'id':_0x34cccb[_0x3c14('0x40')],'value':_0x448f6e[_0x34cccb[_0x3c14('0x45')][_0x3c14('0x11')][_0x3c14('0x3d')]()][_0x3c14('0x3f')]()});}});}return _0x230a28;}exports[_0x3c14('0x46')]=function(_0x49e07f,_0xc5b9dc,_0x48be4e,_0x10af0f,_0x2f778c,_0x2c2188){var _0x234644,_0x16f0b5;_0x2c2188['remoteUri']=intUtil[_0x3c14('0x47')](_0x2c2188[_0x3c14('0xf')]);_0x2c2188[_0x3c14('0x48')]=intUtil[_0x3c14('0x47')](_0x2c2188[_0x3c14('0x48')]);if(_0x2f778c&&_0x2f778c[_0x3c14('0x49')]){logger['info'](_0x3c14('0x4a'),_0x3c14('0x4b'));_0xc5b9dc[_0x3c14('0x4c')]=util[_0x3c14('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x2c2188['serverUrl'],_0xc5b9dc['uniqueid'],md5(_0xc5b9dc[_0x3c14('0x4d')]));}else{_0xc5b9dc['recordingURL']='';}headers[_0x3c14('0x4e')]=getAuth(_0x2c2188);return getUser(_0x2c2188,_0x10af0f[_0x3c14('0x4f')])[_0x3c14('0x15')](function(_0x4be028){_0x234644=_0x4be028;logger[_0x3c14('0xc')](_0x3c14('0x50'),_0x234644['id']);return getEndUser(_0x2c2188,_0xc5b9dc[_0x3c14('0x51')],_0xc5b9dc[_0x3c14('0x52')]);})['then'](function(_0x1590cd){_0x16f0b5=_0x1590cd;logger[_0x3c14('0xc')](_0x3c14('0x53'),_0x16f0b5['id']);return getTicket(_0x2c2188,_0x234644,_0x16f0b5,_0x48be4e,_0xc5b9dc);})[_0x3c14('0x15')](function(_0x9fa2be){if(_0x9fa2be){logger['info']('The\x20Ticket\x20ID\x20is:',_0x9fa2be['id']);switch(_0x2c2188[_0x3c14('0x3a')]){case'integrationTab':logger[_0x3c14('0xc')](_0x3c14('0x4a'),_0x3c14('0x54'));return request({'uri':util['format'](_0x3c14('0x55'),_0x2c2188[_0x3c14('0xf')],_0x234644['id'],_0x9fa2be['id']),'method':_0x3c14('0x56')});case _0x3c14('0x57'):logger[_0x3c14('0xc')](_0x3c14('0x4a'),_0x3c14('0x58'));emit(util[_0x3c14('0x19')]('user:%s',_0x10af0f[_0x3c14('0x11')]),_0x3c14('0x59'),{'uri':util[_0x3c14('0x19')](_0x3c14('0x5a'),_0x2c2188[_0x3c14('0xf')][_0x3c14('0x5b')](_0x3c14('0x5c'),''),_0x9fa2be['id'])});break;default:logger[_0x3c14('0x5d')](_0x3c14('0x4a'),'Zendesk\x20account\x20type\x20not\x20recognized');}}})[_0x3c14('0x5e')](function(_0x59bff9){logger['error']('[QUEUE]\x20Error\x20running\x20Zendesk\x20integration',util['inspect'](_0x59bff9,{'showHidden':!![],'depth':null}));});};exports[_0x3c14('0x5f')]=function(_0x4b6e0d,_0x2fc59c,_0x39cc3d,_0x12d5bd,_0x3be6d5,_0x35169c,_0x5771a9){var _0x428860,_0x4b0915;_0x35169c[_0x3c14('0xf')]=intUtil['stripTrailingSlash'](_0x35169c[_0x3c14('0xf')]);_0x35169c['serverUrl']=intUtil[_0x3c14('0x47')](_0x35169c[_0x3c14('0x48')]);if(_0x5771a9&&_0x5771a9['recordingFormat']&&_0x5771a9[_0x3c14('0x60')]!==_0x3c14('0x61')){logger[_0x3c14('0xc')](_0x3c14('0x62'),_0x3c14('0x4b'));_0x2fc59c['recordingURL']=util['format']('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x35169c[_0x3c14('0x48')],_0x2fc59c[_0x3c14('0x4d')],md5(_0x2fc59c[_0x3c14('0x4d')]));}headers[_0x3c14('0x4e')]=getAuth(_0x35169c);return getUser(_0x35169c,_0x12d5bd[_0x3c14('0x4f')])[_0x3c14('0x15')](function(_0x1fc423){_0x428860=_0x1fc423;logger[_0x3c14('0xc')](_0x3c14('0x50'),_0x428860['id']);return getEndUser(_0x35169c,_0x2fc59c[_0x3c14('0x63')],_0x2fc59c[_0x3c14('0x64')]);})[_0x3c14('0x15')](function(_0x1dcf8f){_0x4b0915=_0x1dcf8f;logger[_0x3c14('0xc')](_0x3c14('0x53'),_0x4b0915['id']);return getTicket(_0x35169c,_0x428860,_0x4b0915,_0x39cc3d,_0x2fc59c);})[_0x3c14('0x15')](function(_0x26dc88){if(_0x26dc88){logger[_0x3c14('0xc')](_0x3c14('0x65'),_0x26dc88['id']);switch(_0x35169c[_0x3c14('0x3a')]){case _0x3c14('0x66'):logger[_0x3c14('0xc')](_0x3c14('0x62'),_0x3c14('0x54'));return request({'uri':util[_0x3c14('0x19')](_0x3c14('0x55'),_0x35169c[_0x3c14('0xf')],_0x428860['id'],_0x26dc88['id']),'method':_0x3c14('0x56')});case _0x3c14('0x57'):logger[_0x3c14('0xc')](_0x3c14('0x62'),'Displaying\x20ticket\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util['format'](_0x3c14('0x67'),_0x12d5bd[_0x3c14('0x11')]),_0x3c14('0x59'),{'uri':util[_0x3c14('0x19')]('%s/agent/tickets/%s',_0x35169c['remoteUri']['replace']('/api/v2',''),_0x26dc88['id'])});break;default:logger[_0x3c14('0x5d')](_0x3c14('0x62'),_0x3c14('0x68'));}}})[_0x3c14('0x5e')](function(_0x108b84){logger[_0x3c14('0x5d')](_0x3c14('0x69'),util[_0x3c14('0x6a')](_0x108b84,{'showHidden':!![],'depth':null}));});};exports[_0x3c14('0x6b')]=function(_0x1d3c8,_0x501908,_0x3eda23,_0x552bf5,_0x269626,_0x529fc1){var _0xbc0e6e,_0xe58964;_0x529fc1['remoteUri']=intUtil[_0x3c14('0x47')](_0x529fc1['remoteUri']);_0x529fc1[_0x3c14('0x48')]=intUtil[_0x3c14('0x47')](_0x529fc1['serverUrl']);if(_0x269626&&_0x269626[_0x3c14('0x49')]){logger[_0x3c14('0xc')]('['+_0x501908[_0x3c14('0x6c')][_0x3c14('0x6d')]()+']',_0x3c14('0x4b'));_0x501908['recordingURL']=util[_0x3c14('0x19')]('%s/api/voice/recordings/%s/downloads?type=uniqueid&token=%s',_0x529fc1[_0x3c14('0x48')],_0x501908[_0x3c14('0x4d')],md5(_0x501908['uniqueid']));}else{_0x501908[_0x3c14('0x4c')]='';}headers[_0x3c14('0x4e')]=getAuth(_0x529fc1);return getUser(_0x529fc1)[_0x3c14('0x15')](function(_0x56173b){_0xbc0e6e=_0x56173b;logger['info'](_0x3c14('0x50'),_0xbc0e6e['id']);return getEndUser(_0x529fc1,_0x501908[_0x3c14('0x51')],_0x501908['calleridnum']);})[_0x3c14('0x15')](function(_0x1be1a7){_0xe58964=_0x1be1a7;logger[_0x3c14('0xc')]('The\x20Enduser\x20ID\x20is:',_0xe58964['id']);return getTicket(_0x529fc1,_0xbc0e6e,_0xe58964,_0x3eda23,_0x501908);})['then'](function(_0x2c5332){if(_0x2c5332){logger[_0x3c14('0xc')](_0x3c14('0x65'),_0x2c5332['id']);}})[_0x3c14('0x5e')](function(_0x53851b){logger[_0x3c14('0x5d')]('['+_0x501908[_0x3c14('0x6c')][_0x3c14('0x6d')]()+']'+_0x3c14('0x6e'),util[_0x3c14('0x6a')](_0x53851b,{'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 d70f42f..6439000 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 _0x3b59=['lodash','request-promise','md5','util','./util','moment','bluebird','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','stringify','length','includes','picklist','type','idField','content','variable','variableName','toString','Variable','name','toLowerCase','indexOf','split','isNil','access_token','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','POST','/oauth/v2/token','refreshToken','clientId','clientSecret','refresh_token','then','add','seconds','catch','error','stack','info','Search\x20user','GET','format','https://www.zohoapis.%s/crm/v2/users','ActiveUsers','Zoho-oauthtoken\x20','users','isArrayLikeObject','email','Agent\x20found!','Using\x20the\x20admin\x20account!','findIndex','profile','user','Administrator','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','data','enduserType','https://www.zohoapis.','/crm/v2/','startCase','moduleCreate','role','first_name','last_name','code','SUCCESS','details','Error:\x20','log','CREATE\x20ERROR','moduleSearch','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','contact','lead','Leads','nothing','Creating\x20new\x20call...','administrator','Subjects','Description','Descriptions','Full_Name','Last_Name','What_Id','First_Name','talktime','Call_Duration','utc','mm:ss','answertime','endtime','YYYY-MM-DDTHH:mm:ss','starttime','Call_Result','Called','complete','connect','Answered','rejected','Rejected','Abandoned','timeout','Timeout','Call_Start_Time','outbound','Call_Type','merge','/crm/v2/Calls','err','queue','host','stripTrailingSlash','serverUrl','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','zoho.eu','com','The\x20User\x20ID\x20is:','calleridname','calleridnum','Inbound','The\x20Call\x20ID\x20is:','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','recordingFormat','none','[OUTBOUND]','/downloads?type=uniqueid&token=','destcalleridname','destcalleridnum','Outbound','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','unmanaged','lastevent'];(function(_0x469a5b,_0x26f1fa){var _0x2a2667=function(_0x3cdfc4){while(--_0x3cdfc4){_0x469a5b['push'](_0x469a5b['shift']());}};_0x2a2667(++_0x26f1fa);}(_0x3b59,0x9c));var _0x93b5=function(_0x387ec1,_0xa73770){_0x387ec1=_0x387ec1-0x0;var _0x4ca6fe=_0x3b59[_0x387ec1];return _0x4ca6fe;};'use strict';var _=require(_0x93b5('0x0'));var rp=require(_0x93b5('0x1'));var md5=require(_0x93b5('0x2'));var util=require(_0x93b5('0x3'));var intUtil=require(_0x93b5('0x4'));var moment=require(_0x93b5('0x5'));var Redis=require('ioredis');var BPromise=require(_0x93b5('0x6'));var config=require('../../../../config/environment');var logger=require(_0x93b5('0x7'))(_0x93b5('0x8'));config[_0x93b5('0x9')]=_[_0x93b5('0xa')](config['redis'],{'host':_0x93b5('0xb'),'port':0x18eb});var io=require(_0x93b5('0xc'))(new Redis(config[_0x93b5('0x9')]));function emit(_0x484849,_0x8e475e,_0x31c39a){io['to'](_0x484849)[_0x93b5('0xd')](_0x8e475e,_0x31c39a);}function request(_0x176049){logger[_0x93b5('0xe')]('[HTTP]',JSON[_0x93b5('0xf')](_0x176049));return rp(_0x176049);}function getCustomFields(_0x13ebc9,_0x7787e5){var _0x3b864b={};if(_0x13ebc9[_0x93b5('0x10')]>0x0){_['forEach'](_0x13ebc9,function(_0x134c99){if(_[_0x93b5('0x11')](['string',_0x93b5('0x12')],_0x134c99[_0x93b5('0x13')])&&_0x134c99[_0x93b5('0x14')]){_0x3b864b[_0x134c99[_0x93b5('0x14')]]=_0x134c99[_0x93b5('0x15')]['toString']();}else if(_0x134c99[_0x93b5('0x13')]===_0x93b5('0x16')&&_0x134c99['variableName']&&_0x134c99[_0x93b5('0x14')]&&_0x7787e5[_0x134c99[_0x93b5('0x17')]]){_0x3b864b[_0x134c99[_0x93b5('0x14')]]=_0x7787e5[_0x134c99['variableName']][_0x93b5('0x18')]();}else if(_0x134c99['type']==='customVariable'&&_0x134c99[_0x93b5('0x19')]&&_0x134c99['Variable'][_0x93b5('0x1a')]&&_0x134c99[_0x93b5('0x14')]&&_0x7787e5[_0x134c99[_0x93b5('0x19')]['name']['toLowerCase']()]){_0x3b864b[_0x134c99['idField']]=_0x7787e5[_0x134c99[_0x93b5('0x19')][_0x93b5('0x1a')][_0x93b5('0x1b')]()][_0x93b5('0x18')]();}});}return _0x3b864b;}function getName(_0x1c4019){if(_0x1c4019[_0x93b5('0x1c')]('\x20')>0x0){var _0x2dd622=_0x1c4019[_0x93b5('0x1d')](/ (.+)/);if(_0x2dd622[0x1]){return _0x2dd622;}}return[_0x1c4019,_0x1c4019];}var accountsTokens={};function getAccessToken(_0x352cbe){return new Promise(function(_0x3ba1bc,_0x5c1172){if(!_['isNil'](accountsTokens[_0x352cbe['id']])&&!_[_0x93b5('0x1e')](accountsTokens[_0x352cbe['id']][_0x93b5('0x1f')])){if(moment()['isBefore'](accountsTokens[_0x352cbe['id']][_0x93b5('0x20')])){_0x3ba1bc(accountsTokens[_0x352cbe['id']][_0x93b5('0x1f')]);}}var _0x2e9e75;switch(_0x352cbe[_0x93b5('0x21')]){case'US':_0x2e9e75=_0x93b5('0x22');break;case'AU':_0x2e9e75=_0x93b5('0x23');break;case'EU':_0x2e9e75=_0x93b5('0x24');break;case'IN':_0x2e9e75=_0x93b5('0x25');break;case'CN':_0x2e9e75=_0x93b5('0x26');break;default:_0x2e9e75=_0x93b5('0x24');break;}var _0xf7b6fc={'method':_0x93b5('0x27'),'uri':_0x2e9e75+_0x93b5('0x28'),'qs':{'refresh_token':_0x352cbe[_0x93b5('0x29')],'client_id':_0x352cbe[_0x93b5('0x2a')],'client_secret':_0x352cbe[_0x93b5('0x2b')],'grant_type':_0x93b5('0x2c')},'json':!![]};return rp(_0xf7b6fc)[_0x93b5('0x2d')](function(_0x4977df){accountsTokens[_0x352cbe['id']]={'access_token':_0x4977df[_0x93b5('0x1f')],'expires_in':moment()[_0x93b5('0x2e')](_0x4977df[_0x93b5('0x20')],_0x93b5('0x2f'))};_0x3ba1bc(_0x4977df[_0x93b5('0x1f')]);})[_0x93b5('0x30')](function(_0x2dad64){logger[_0x93b5('0x31')]('Failing\x20creating\x20the\x20access_token',_0x2dad64[_0x93b5('0x32')]);_0x5c1172(_0x2dad64);});});}function getUser(_0x239f96,_0x54bc50,_0xf7fc9c,_0x4e4212){logger[_0x93b5('0x33')](_0x93b5('0x34'));return request({'method':_0x93b5('0x35'),'uri':util[_0x93b5('0x36')](_0x93b5('0x37'),_0x54bc50),'qs':{'type':_0x93b5('0x38')},'headers':{'Authorization':_0x93b5('0x39')+_0x239f96},'json':!![]})[_0x93b5('0x2d')](function(_0x8504b8){if(_0x8504b8[_0x93b5('0x3a')]){var _0x5a5fa7=-0x1;if(_[_0x93b5('0x3b')](_0x8504b8['users'])){if(!_['isNil'](_0x4e4212)){_0x5a5fa7=_['findIndex'](_0x8504b8['users'],function(_0x361a8f){return _0x361a8f[_0x93b5('0x3c')]===_0x4e4212;});}if(_0x5a5fa7>=0x0){logger[_0x93b5('0x33')](_0x93b5('0x3d'));}else{logger[_0x93b5('0x33')](_0x93b5('0x3e'));_0x5a5fa7=_[_0x93b5('0x3f')](_0x8504b8[_0x93b5('0x3a')],function(_0x9314ef){return _0x9314ef[_0x93b5('0x40')][_0x93b5('0x1a')]==='Administrator';});}return _0x8504b8['users'][_0x5a5fa7];}else{if(_0x8504b8[_0x93b5('0x41')][_0x93b5('0x40')][_0x93b5('0x1a')]===_0x93b5('0x42')){logger[_0x93b5('0x33')](_0x93b5('0x3e'));user=_0x8504b8['user'];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x8504b8));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON[_0x93b5('0xf')](_0x8504b8));}}}else{logger[_0x93b5('0x31')](_0x93b5('0x43'),JSON[_0x93b5('0xf')](_0x8504b8));throw new Error(_0x93b5('0x44')+JSON[_0x93b5('0xf')](_0x8504b8));}})[_0x93b5('0x30')](function(_0x1e0d77){console[_0x93b5('0x31')](_0x1e0d77);});}function getZohoUser(_0x2f52ea,_0x5400b9){return new BPromise(function(_0x585798,_0x48320d){request(_0x2f52ea)[_0x93b5('0x2d')](function(_0x394400){var _0x1a6d5b=null;if(_0x394400){_0x1a6d5b=_0x394400[_0x93b5('0x45')][0x0];_0x1a6d5b[_0x93b5('0x46')]=_0x5400b9;}_0x585798(_0x1a6d5b);})[_0x93b5('0x30')](function(_0x5ef62a){_0x48320d(_0x5ef62a);});});}function createEndUser(_0x27800e,_0x192dab,_0x392005,_0x5d5134,_0x1cf514,_0x426403){var _0x392005=getName(_0x392005);return request({'method':'POST','uri':_0x93b5('0x47')+_0x192dab+_0x93b5('0x48')+_[_0x93b5('0x49')](_0x426403[_0x93b5('0x4a')])+'s','body':{'data':[{'Last_Name':_0x392005[0x1],'First_Name':_0x392005[0x0],'Phone':_0x5d5134,'Owner':{'name':!_['isNil'](_0x1cf514[_0x93b5('0x4b')][_0x93b5('0x1a')])?_0x1cf514[_0x93b5('0x4b')][_0x93b5('0x1a')]:!_[_0x93b5('0x1e')](_0x1cf514[_0x93b5('0x4c')])?_0x1cf514[_0x93b5('0x4c')]+'\x20'+_0x1cf514[_0x93b5('0x4d')]:_0x1cf514['last_name'],'id':_0x1cf514['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x27800e},'json':!![]})[_0x93b5('0x2d')](function(_0x290e26){if(_0x290e26&&_0x290e26[_0x93b5('0x45')][0x0][_0x93b5('0x4e')]===_0x93b5('0x4f')){var _0x91e907=_0x290e26[_0x93b5('0x45')][0x0][_0x93b5('0x50')];_0x91e907[_0x93b5('0x46')]=_[_0x93b5('0x49')](_0x426403['moduleCreate'])+'s';return _0x91e907;}logger[_0x93b5('0x31')]('The\x20failing\x20result\x20is',JSON[_0x93b5('0xf')](data));throw new Error(_0x93b5('0x51')+JSON[_0x93b5('0xf')](data));})['catch'](function(_0x36b5c0){console[_0x93b5('0x52')](_0x93b5('0x53'),_0x36b5c0);});}function getEndUser(_0x47024f,_0x9e3b46,_0x15bd34,_0x359483,_0x4fdc11,_0x28adc6,_0x1bca7c){var _0x3fd00d={'method':_0x93b5('0x35'),'uri':'','headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x47024f},'json':!![]};switch(_0x1bca7c[_0x93b5('0x54')]){case'contact_lead':_0x3fd00d['uri']='https://www.zohoapis.'+_0x9e3b46+_0x93b5('0x55')+_0x4fdc11+'))';return getZohoUser(_0x3fd00d,_0x93b5('0x56'))[_0x93b5('0x2d')](function(_0x19717d){if(_0x19717d)return _0x19717d;_0x3fd00d[_0x93b5('0x57')]=_0x93b5('0x47')+_0x9e3b46+_0x93b5('0x58')+_0x4fdc11+'))';return getZohoUser(_0x3fd00d,'Leads')[_0x93b5('0x2d')](function(_0x152187){if(_0x152187)return _0x152187;if(_0x1bca7c[_0x93b5('0x4a')]!='nothing'){return createEndUser(_0x47024f,_0x9e3b46,_0x359483,_0x4fdc11,_0x28adc6,_0x1bca7c);}else{return{};}});});break;case _0x93b5('0x59'):_0x3fd00d[_0x93b5('0x57')]=_0x93b5('0x47')+_0x9e3b46+'/crm/v2/Contacts/search?criteria=((Phone:equals:'+_0x4fdc11+'))';return getZohoUser(_0x3fd00d,'Contacts')['then'](function(_0x2911fd){if(_0x2911fd)return _0x2911fd;if(_0x1bca7c['moduleCreate']!='nothing'){return createEndUser(_0x47024f,_0x9e3b46,_0x359483,_0x4fdc11,_0x28adc6,_0x1bca7c);}else{return{};}});break;case _0x93b5('0x5a'):_0x3fd00d['uri']=_0x93b5('0x47')+_0x9e3b46+'/crm/v2/Leads/search?criteria=((Phone:equals:'+_0x4fdc11+'))';return getZohoUser(_0x3fd00d,_0x93b5('0x5b'))['then'](function(_0x5b90cf){if(_0x5b90cf)return _0x5b90cf;if(_0x1bca7c[_0x93b5('0x4a')]!=_0x93b5('0x5c')){return createEndUser(_0x47024f,_0x9e3b46,_0x359483,_0x4fdc11,_0x28adc6,_0x1bca7c);}else{return{};}});break;}}function getCall(_0x3938af,_0x1a51d1,_0x27c467,_0x53b4c1,_0x4b6792,_0x49c5fd,_0x21c070,_0xe7b552){logger[_0x93b5('0x33')](_0x93b5('0x5d'));var _0x50415c={};_0x50415c['Owner']={'name':!_[_0x93b5('0x1e')](_0x53b4c1['role'][_0x93b5('0x1a')])&&!_[_0x93b5('0x1e')](_0x53b4c1[_0x93b5('0x40')]['name'])&&_0x53b4c1[_0x93b5('0x40')]['name']===_0x93b5('0x5e')?_0x53b4c1[_0x93b5('0x4b')][_0x93b5('0x1a')]:!_[_0x93b5('0x1e')](_0x53b4c1[_0x93b5('0x4c')])?_0x53b4c1['first_name']+'\x20'+_0x53b4c1['last_name']:_0x53b4c1[_0x93b5('0x4d')],'id':_0x53b4c1['id']};_0x50415c['Subject']=intUtil['getString'](_0x49c5fd[_0x93b5('0x5f')],_0x21c070,'\x20');_0x50415c[_0x93b5('0x60')]=intUtil['getString'](_0x49c5fd[_0x93b5('0x61')],_0x21c070,'\x0a');if(_0x4b6792['enduserType']===_0x93b5('0x56')){_0x50415c['Who_Id']={'name':!_[_0x93b5('0x1e')](_0x4b6792['Full_Name'])?_0x4b6792[_0x93b5('0x62')]:!_[_0x93b5('0x1e')](_0x4b6792['First_Name'])?_0x4b6792['First_Name']+'\x20'+_0x4b6792[_0x93b5('0x63')]:_0x4b6792[_0x93b5('0x63')],'id':_0x4b6792['id']};}if(_0x4b6792[_0x93b5('0x46')]==='Leads'){_0x50415c[_0x93b5('0x64')]={'name':!_[_0x93b5('0x1e')](_0x4b6792[_0x93b5('0x62')])?_0x4b6792[_0x93b5('0x62')]:!_[_0x93b5('0x1e')](_0x4b6792[_0x93b5('0x65')])?_0x4b6792['First_Name']+'\x20'+_0x4b6792[_0x93b5('0x63')]:_0x4b6792[_0x93b5('0x63')],'id':_0x4b6792['id']};_0x50415c['$se_module']=_[_0x93b5('0x49')](_0x4b6792[_0x93b5('0x46')]);}if(_0x21c070[_0x93b5('0x66')]){_0x50415c[_0x93b5('0x67')]=moment[_0x93b5('0x68')](parseInt(_0x21c070[_0x93b5('0x66')])*0x3e8)[_0x93b5('0x36')](_0x93b5('0x69'));}else if(_0x21c070[_0x93b5('0x6a')]&&_0x21c070[_0x93b5('0x6b')]){_0x50415c[_0x93b5('0x67')]=moment[_0x93b5('0x68')](moment(_0x21c070['endtime'],_0x93b5('0x6c'))['diff'](moment(_0x21c070[_0x93b5('0x6d')],_0x93b5('0x6c'))))[_0x93b5('0x36')](_0x93b5('0x69'));}switch(_0x21c070['lastevent']){case'called':_0x50415c[_0x93b5('0x6e')]=_0x93b5('0x6f');break;case _0x93b5('0x70'):case _0x93b5('0x71'):_0x50415c[_0x93b5('0x6e')]=_0x93b5('0x72');break;case _0x93b5('0x73'):_0x50415c['Call_Result']=_0x93b5('0x74');break;case'abandoned':_0x50415c[_0x93b5('0x6e')]=_0x93b5('0x75');break;case _0x93b5('0x76'):_0x50415c['Call_Result']=_0x93b5('0x77');default:}_0x50415c[_0x93b5('0x78')]=(_0xe7b552===_0x93b5('0x79')?moment(_0x21c070[_0x93b5('0x6d')])['format'](_0x93b5('0x6c')):moment(_0x21c070['agentcalledAt'])[_0x93b5('0x36')]('YYYY-MM-DDTHH:mm:ss'))||moment()[_0x93b5('0x36')](_0x93b5('0x6c'));_0x50415c[_0x93b5('0x7a')]=_0xe7b552||'Inbound';_0x50415c=_[_0x93b5('0x7b')](_0x50415c,getCustomFields(_0x49c5fd['Fields'],_0x21c070));return request({'method':'POST','uri':_0x93b5('0x47')+_0x1a51d1+_0x93b5('0x7c'),'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x3938af},'body':{'data':[_0x50415c]},'json':!![]})[_0x93b5('0x2d')](function(_0x4a3aea){if(_0x4a3aea&&_0x4a3aea[_0x93b5('0x45')][0x0]['code']===_0x93b5('0x4f')){logger[_0x93b5('0x33')]('Call\x20created!');return{'id':_0x4a3aea[_0x93b5('0x45')][0x0][_0x93b5('0x50')]['id']};}})[_0x93b5('0x30')](function(_0x3afa27){logger[_0x93b5('0x33')](_0x93b5('0x7d'),_0x3afa27[_0x93b5('0x32')]);console['log'](_0x93b5('0x7d'),_0x3afa27);});}exports[_0x93b5('0x7e')]=function(_0x2dea19,_0x4c5b26,_0x2ef917,_0x46fb41,_0x27c96e,_0x52be2f){var _0x54cd59,_0x415f74,_0x16c86e;_0x52be2f[_0x93b5('0x7f')]=intUtil[_0x93b5('0x80')](_0x52be2f['host']);_0x52be2f[_0x93b5('0x81')]=intUtil['stripTrailingSlash'](_0x52be2f[_0x93b5('0x81')]);if(_0x27c96e&&_0x27c96e[_0x93b5('0x82')]){logger['info'](_0x93b5('0x83'),'Recording\x20is\x20enabled!');_0x4c5b26[_0x93b5('0x84')]=_0x52be2f['serverUrl']+_0x93b5('0x85')+_0x4c5b26[_0x93b5('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x4c5b26[_0x93b5('0x86')]);}else{_0x4c5b26['recordingURL']='';}var _0x2ad617=_0x52be2f[_0x93b5('0x7f')]===_0x93b5('0x87')?'eu':_0x93b5('0x88');return getAccessToken(_0x52be2f)[_0x93b5('0x2d')](function(_0x4cb341){_0x16c86e=_0x4cb341;return getUser(_0x16c86e,_0x2ad617,_0x52be2f,_0x46fb41['email']);})[_0x93b5('0x2d')](function(_0x208044){_0x54cd59=_0x208044;logger[_0x93b5('0x33')](_0x93b5('0x89'),_0x54cd59['id']);return getEndUser(_0x16c86e,_0x2ad617,_0x52be2f,_0x4c5b26[_0x93b5('0x8a')],_0x4c5b26[_0x93b5('0x8b')],_0x54cd59,_0x2ef917);})[_0x93b5('0x2d')](function(_0x44a567){_0x415f74=_0x44a567;return getCall(_0x16c86e,_0x2ad617,_0x52be2f,_0x54cd59,_0x415f74,_0x2ef917,_0x4c5b26,_0x93b5('0x8c'));})[_0x93b5('0x2d')](function(_0x50ce80){if(_0x50ce80){logger['info'](_0x93b5('0x8d'),_0x50ce80['id']);logger[_0x93b5('0x33')](_0x93b5('0x83'),'Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...');emit(util[_0x93b5('0x36')](_0x93b5('0x8e'),_0x46fb41[_0x93b5('0x1a')]),_0x93b5('0x8f'),{'uri':_0x93b5('0x90')+_0x52be2f[_0x93b5('0x7f')]+_0x93b5('0x91')+_0x50ce80['id']});}})[_0x93b5('0x30')](function(_0x2cd0fd){logger[_0x93b5('0x31')]('[QUEUE]',JSON[_0x93b5('0xf')](_0x2cd0fd));});};exports[_0x93b5('0x79')]=function(_0x208cef,_0x484bf3,_0x137e26,_0x36db71,_0x418297,_0x32beff,_0xbf9626){var _0x325281,_0x522103,_0x4bde1f;_0x32beff[_0x93b5('0x7f')]=intUtil[_0x93b5('0x80')](_0x32beff[_0x93b5('0x7f')]);_0x32beff[_0x93b5('0x81')]=intUtil[_0x93b5('0x80')](_0x32beff[_0x93b5('0x81')]);if(_0xbf9626&&_0xbf9626[_0x93b5('0x92')]&&_0xbf9626[_0x93b5('0x92')]!==_0x93b5('0x93')){logger[_0x93b5('0x33')](_0x93b5('0x94'),'Recording\x20is\x20enabled!');_0x484bf3[_0x93b5('0x84')]=_0x32beff[_0x93b5('0x81')]+_0x93b5('0x85')+_0x484bf3[_0x93b5('0x86')]+_0x93b5('0x95')+md5(_0x484bf3['uniqueid']);}var _0x541977=_0x32beff[_0x93b5('0x7f')]===_0x93b5('0x87')?'eu':_0x93b5('0x88');return getAccessToken(_0x32beff)['then'](function(_0x373c6a){_0x4bde1f=_0x373c6a;return getUser(_0x4bde1f,_0x541977,_0x32beff,_0x36db71[_0x93b5('0x3c')]);})[_0x93b5('0x2d')](function(_0x12f07d){_0x325281=_0x12f07d;logger[_0x93b5('0x33')](_0x93b5('0x89'),_0x325281['id']);return getEndUser(_0x4bde1f,_0x541977,_0x32beff,_0x484bf3[_0x93b5('0x96')],_0x484bf3[_0x93b5('0x97')],_0x325281,_0x137e26);})[_0x93b5('0x2d')](function(_0x3f3cb8){_0x522103=_0x3f3cb8;return getCall(_0x4bde1f,_0x541977,_0x32beff,_0x325281,_0x522103,_0x137e26,_0x484bf3,_0x93b5('0x98'));})[_0x93b5('0x2d')](function(_0x1dc286){if(_0x1dc286){logger[_0x93b5('0x33')](_0x93b5('0x8d'),_0x1dc286['id']);logger['info'](_0x93b5('0x94'),_0x93b5('0x99'));emit(util[_0x93b5('0x36')](_0x93b5('0x8e'),_0x36db71[_0x93b5('0x1a')]),_0x93b5('0x8f'),{'uri':_0x93b5('0x90')+_0x32beff['host']+'/crm/EntityInfo.do?module=Calls&id='+_0x1dc286['id']});}})[_0x93b5('0x30')](function(_0x46a1aa){logger['error']('[OUTBOUND]',JSON[_0x93b5('0xf')](_0x46a1aa));});};exports[_0x93b5('0x9a')]=function(_0x3a86e0,_0x2199b7,_0x321eca,_0x5ad132,_0x355b1a,_0x114e7d){var _0x55ea7c,_0x49635b,_0x5ceecb;_0x114e7d['host']=intUtil[_0x93b5('0x80')](_0x114e7d[_0x93b5('0x7f')]);_0x114e7d['serverUrl']=intUtil['stripTrailingSlash'](_0x114e7d[_0x93b5('0x81')]);if(_0x355b1a&&_0x355b1a[_0x93b5('0x82')]){logger[_0x93b5('0x33')]('['+_0x2199b7[_0x93b5('0x9b')]['toUpperCase']()+']','Recording\x20is\x20enabled!');_0x2199b7[_0x93b5('0x84')]=_0x114e7d[_0x93b5('0x81')]+'/api/voice/recordings/'+_0x2199b7['uniqueid']+_0x93b5('0x95')+md5(_0x2199b7[_0x93b5('0x86')]);}else{_0x2199b7['recordingURL']='';}var _0x180a60=_0x114e7d['host']===_0x93b5('0x87')?'eu':_0x93b5('0x88');return getAccessToken(_0x114e7d)[_0x93b5('0x2d')](function(_0x1091a6){_0x5ceecb=_0x1091a6;return getUser(_0x5ceecb,_0x180a60,_0x114e7d);})[_0x93b5('0x2d')](function(_0xd5f46f){_0x55ea7c=_0xd5f46f;logger[_0x93b5('0x33')]('The\x20User\x20ID\x20is:',_0x55ea7c['id']);return getEndUser(_0x5ceecb,_0x180a60,_0x114e7d,_0x2199b7['calleridname'],_0x2199b7['calleridnum'],_0x55ea7c,_0x321eca);})[_0x93b5('0x2d')](function(_0x3d1659){_0x49635b=_0x3d1659;return getCall(_0x5ceecb,_0x180a60,_0x114e7d,_0x55ea7c,_0x49635b,_0x321eca,_0x2199b7,_0x93b5('0x8c'));})[_0x93b5('0x2d')](function(_0x10fa31){if(_0x10fa31){logger['info'](_0x93b5('0x8d'),_0x10fa31['id']);}})[_0x93b5('0x30')](function(_0x304a07){logger[_0x93b5('0x31')]('['+_0x2199b7[_0x93b5('0x9b')]['toUpperCase']()+']',JSON['stringify'](_0x304a07));});}; \ No newline at end of file +var _0x02ba=['Last_Name','What_Id','$se_module','talktime','Call_Duration','utc','mm:ss','endtime','diff','YYYY-MM-DDTHH:mm:ss','lastevent','called','Call_Result','Called','complete','connect','rejected','Rejected','abandoned','Abandoned','Timeout','Call_Start_Time','outbound','agentcalledAt','Call_Type','Inbound','Fields','/crm/v2/Calls','err','queue','host','serverUrl','stripTrailingSlash','monitor_format','[QUEUE]','recordingURL','/api/voice/recordings/','uniqueid','/downloads?type=uniqueid&token=','zoho.eu','com','calleridname','calleridnum','Displaying\x20call\x20to\x20agent\x20in\x20a\x20new\x20tab...','user:%s','trigger:browser:url','https://crm.','/crm/EntityInfo.do?module=Calls&id=','none','[OUTBOUND]','Recording\x20is\x20enabled!','The\x20User\x20ID\x20is:','destcalleridname','destcalleridnum','Outbound','The\x20Call\x20ID\x20is:','unmanaged','toUpperCase','lodash','md5','util','./util','moment','ioredis','bluebird','../../../../config/environment','../../../../config/logger','zoho','redis','defaults','localhost','socket.io-emitter','emit','debug','[HTTP]','stringify','length','includes','string','type','idField','content','variable','variableName','Variable','name','toLowerCase','toString','isNil','access_token','isBefore','expires_in','zone','https://accounts.zoho.com','https://accounts.zoho.com.au','https://accounts.zoho.eu','https://accounts.zoho.in','https://accounts.zoho.com.cn','/oauth/v2/token','refreshToken','clientSecret','refresh_token','then','seconds','catch','error','Failing\x20creating\x20the\x20access_token','info','Search\x20user','format','https://www.zohoapis.%s/crm/v2/users','Zoho-oauthtoken\x20','isArrayLikeObject','users','findIndex','Agent\x20found!','Using\x20the\x20admin\x20account!','profile','Administrator','user','The\x20failing\x20result\x20is','Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20','enduserType','POST','https://www.zohoapis.','/crm/v2/','startCase','role','first_name','last_name','data','code','SUCCESS','details','moduleCreate','Error:\x20','log','GET','/crm/v2/Contacts/search?criteria=((Phone:equals:','Contacts','uri','/crm/v2/Leads/search?criteria=((Phone:equals:','nothing','contact','lead','Leads','Creating\x20new\x20call...','Owner','administrator','getString','Description','Descriptions','Who_Id','Full_Name','First_Name'];(function(_0x5eea79,_0x33c5f1){var _0x5be026=function(_0x10c858){while(--_0x10c858){_0x5eea79['push'](_0x5eea79['shift']());}};_0x5be026(++_0x33c5f1);}(_0x02ba,0xd5));var _0xa02b=function(_0x5be273,_0x537ed2){_0x5be273=_0x5be273-0x0;var _0x4c1c4f=_0x02ba[_0x5be273];return _0x4c1c4f;};'use strict';var _=require(_0xa02b('0x0'));var rp=require('request-promise');var md5=require(_0xa02b('0x1'));var util=require(_0xa02b('0x2'));var intUtil=require(_0xa02b('0x3'));var moment=require(_0xa02b('0x4'));var Redis=require(_0xa02b('0x5'));var BPromise=require(_0xa02b('0x6'));var config=require(_0xa02b('0x7'));var logger=require(_0xa02b('0x8'))(_0xa02b('0x9'));config[_0xa02b('0xa')]=_[_0xa02b('0xb')](config['redis'],{'host':_0xa02b('0xc'),'port':0x18eb});var io=require(_0xa02b('0xd'))(new Redis(config[_0xa02b('0xa')]));function emit(_0x576737,_0x22190c,_0x27ac4d){io['to'](_0x576737)[_0xa02b('0xe')](_0x22190c,_0x27ac4d);}function request(_0xc6e1bd){logger[_0xa02b('0xf')](_0xa02b('0x10'),JSON[_0xa02b('0x11')](_0xc6e1bd));return rp(_0xc6e1bd);}function getCustomFields(_0x4da5be,_0x13e1a0){var _0xb26f51={};if(_0x4da5be[_0xa02b('0x12')]>0x0){_['forEach'](_0x4da5be,function(_0x25c4da){if(_[_0xa02b('0x13')]([_0xa02b('0x14'),'picklist'],_0x25c4da[_0xa02b('0x15')])&&_0x25c4da[_0xa02b('0x16')]){_0xb26f51[_0x25c4da[_0xa02b('0x16')]]=_0x25c4da[_0xa02b('0x17')]['toString']();}else if(_0x25c4da[_0xa02b('0x15')]===_0xa02b('0x18')&&_0x25c4da[_0xa02b('0x19')]&&_0x25c4da['idField']&&_0x13e1a0[_0x25c4da[_0xa02b('0x19')]]){_0xb26f51[_0x25c4da[_0xa02b('0x16')]]=_0x13e1a0[_0x25c4da[_0xa02b('0x19')]]['toString']();}else if(_0x25c4da[_0xa02b('0x15')]==='customVariable'&&_0x25c4da[_0xa02b('0x1a')]&&_0x25c4da[_0xa02b('0x1a')][_0xa02b('0x1b')]&&_0x25c4da[_0xa02b('0x16')]&&_0x13e1a0[_0x25c4da[_0xa02b('0x1a')][_0xa02b('0x1b')][_0xa02b('0x1c')]()]){_0xb26f51[_0x25c4da[_0xa02b('0x16')]]=_0x13e1a0[_0x25c4da[_0xa02b('0x1a')][_0xa02b('0x1b')][_0xa02b('0x1c')]()][_0xa02b('0x1d')]();}});}return _0xb26f51;}function getName(_0x2ba470){if(_0x2ba470['indexOf']('\x20')>0x0){var _0x438aa6=_0x2ba470['split'](/ (.+)/);if(_0x438aa6[0x1]){return _0x438aa6;}}return[_0x2ba470,_0x2ba470];}var accountsTokens={};function getAccessToken(_0x36fedb){return new Promise(function(_0x2b6b49,_0x2752be){if(!_[_0xa02b('0x1e')](accountsTokens[_0x36fedb['id']])&&!_[_0xa02b('0x1e')](accountsTokens[_0x36fedb['id']][_0xa02b('0x1f')])){if(moment()[_0xa02b('0x20')](accountsTokens[_0x36fedb['id']][_0xa02b('0x21')])){_0x2b6b49(accountsTokens[_0x36fedb['id']][_0xa02b('0x1f')]);}}var _0xe33993;switch(_0x36fedb[_0xa02b('0x22')]){case'US':_0xe33993=_0xa02b('0x23');break;case'AU':_0xe33993=_0xa02b('0x24');break;case'EU':_0xe33993=_0xa02b('0x25');break;case'IN':_0xe33993=_0xa02b('0x26');break;case'CN':_0xe33993=_0xa02b('0x27');break;default:_0xe33993=_0xa02b('0x25');break;}var _0x292942={'method':'POST','uri':_0xe33993+_0xa02b('0x28'),'qs':{'refresh_token':_0x36fedb[_0xa02b('0x29')],'client_id':_0x36fedb['clientId'],'client_secret':_0x36fedb[_0xa02b('0x2a')],'grant_type':_0xa02b('0x2b')},'json':!![]};return rp(_0x292942)[_0xa02b('0x2c')](function(_0x11783d){accountsTokens[_0x36fedb['id']]={'access_token':_0x11783d['access_token'],'expires_in':moment()['add'](_0x11783d[_0xa02b('0x21')],_0xa02b('0x2d'))};_0x2b6b49(_0x11783d[_0xa02b('0x1f')]);})[_0xa02b('0x2e')](function(_0x86074f){logger[_0xa02b('0x2f')](_0xa02b('0x30'),_0x86074f['stack']);_0x2752be(_0x86074f);});});}function getUser(_0x4b090e,_0x31d91e,_0x27152c,_0x39e7e2){logger[_0xa02b('0x31')](_0xa02b('0x32'));return request({'method':'GET','uri':util[_0xa02b('0x33')](_0xa02b('0x34'),_0x31d91e),'qs':{'type':'ActiveUsers'},'headers':{'Authorization':_0xa02b('0x35')+_0x4b090e},'json':!![]})[_0xa02b('0x2c')](function(_0x45971f){if(_0x45971f['users']){var _0x574b71=-0x1;if(_[_0xa02b('0x36')](_0x45971f[_0xa02b('0x37')])){if(!_[_0xa02b('0x1e')](_0x39e7e2)){_0x574b71=_[_0xa02b('0x38')](_0x45971f['users'],function(_0x4cacfe){return _0x4cacfe['email']===_0x39e7e2;});}if(_0x574b71>=0x0){logger[_0xa02b('0x31')](_0xa02b('0x39'));}else{logger[_0xa02b('0x31')](_0xa02b('0x3a'));_0x574b71=_[_0xa02b('0x38')](_0x45971f[_0xa02b('0x37')],function(_0x56bea4){return _0x56bea4[_0xa02b('0x3b')][_0xa02b('0x1b')]===_0xa02b('0x3c');});}return _0x45971f['users'][_0x574b71];}else{if(_0x45971f[_0xa02b('0x3d')][_0xa02b('0x3b')][_0xa02b('0x1b')]===_0xa02b('0x3c')){logger[_0xa02b('0x31')](_0xa02b('0x3a'));user=_0x45971f['user'];return user;}else{logger['error']('The\x20failing\x20result\x20is',JSON['stringify'](_0x45971f));throw new Error('Unable\x20to\x20retrieve\x20zoho\x20account\x20users:\x20'+JSON['stringify'](_0x45971f));}}}else{logger[_0xa02b('0x2f')](_0xa02b('0x3e'),JSON['stringify'](_0x45971f));throw new Error(_0xa02b('0x3f')+JSON[_0xa02b('0x11')](_0x45971f));}})[_0xa02b('0x2e')](function(_0x92ba62){console[_0xa02b('0x2f')](_0x92ba62);});}function getZohoUser(_0x5d4ec,_0x5b060e){return new BPromise(function(_0x33776d,_0x58a403){request(_0x5d4ec)['then'](function(_0x29faf8){var _0x380109=null;if(_0x29faf8){_0x380109=_0x29faf8['data'][0x0];_0x380109[_0xa02b('0x40')]=_0x5b060e;}_0x33776d(_0x380109);})[_0xa02b('0x2e')](function(_0x1180c9){_0x58a403(_0x1180c9);});});}function createEndUser(_0x4dacc9,_0x6dc986,_0x2e2726,_0x3e24d2,_0x44cc9c,_0x5088d9){var _0x2e2726=getName(_0x2e2726);return request({'method':_0xa02b('0x41'),'uri':_0xa02b('0x42')+_0x6dc986+_0xa02b('0x43')+_[_0xa02b('0x44')](_0x5088d9['moduleCreate'])+'s','body':{'data':[{'Last_Name':_0x2e2726[0x1],'First_Name':_0x2e2726[0x0],'Phone':_0x3e24d2,'Owner':{'name':!_['isNil'](_0x44cc9c[_0xa02b('0x45')][_0xa02b('0x1b')])?_0x44cc9c['role'][_0xa02b('0x1b')]:!_[_0xa02b('0x1e')](_0x44cc9c[_0xa02b('0x46')])?_0x44cc9c[_0xa02b('0x46')]+'\x20'+_0x44cc9c[_0xa02b('0x47')]:_0x44cc9c[_0xa02b('0x47')],'id':_0x44cc9c['id']}}]},'headers':{'Authorization':'Zoho-oauthtoken\x20'+_0x4dacc9},'json':!![]})[_0xa02b('0x2c')](function(_0x1f35b7){if(_0x1f35b7&&_0x1f35b7[_0xa02b('0x48')][0x0][_0xa02b('0x49')]===_0xa02b('0x4a')){var _0x3d6745=_0x1f35b7['data'][0x0][_0xa02b('0x4b')];_0x3d6745[_0xa02b('0x40')]=_['startCase'](_0x5088d9[_0xa02b('0x4c')])+'s';return _0x3d6745;}logger[_0xa02b('0x2f')](_0xa02b('0x3e'),JSON[_0xa02b('0x11')](data));throw new Error(_0xa02b('0x4d')+JSON[_0xa02b('0x11')](data));})[_0xa02b('0x2e')](function(_0x327954){console[_0xa02b('0x4e')]('CREATE\x20ERROR',_0x327954);});}function getEndUser(_0x5cb7d7,_0x194de4,_0x3008cd,_0x460a30,_0x3b70ac,_0x50e816,_0x1ded5b){var _0x23a372={'method':_0xa02b('0x4f'),'uri':'','headers':{'Authorization':_0xa02b('0x35')+_0x5cb7d7},'json':!![]};switch(_0x1ded5b['moduleSearch']){case'contact_lead':_0x23a372['uri']='https://www.zohoapis.'+_0x194de4+_0xa02b('0x50')+_0x3b70ac+'))';return getZohoUser(_0x23a372,_0xa02b('0x51'))[_0xa02b('0x2c')](function(_0x1721c3){if(_0x1721c3)return _0x1721c3;_0x23a372[_0xa02b('0x52')]=_0xa02b('0x42')+_0x194de4+_0xa02b('0x53')+_0x3b70ac+'))';return getZohoUser(_0x23a372,'Leads')['then'](function(_0xaebddb){if(_0xaebddb)return _0xaebddb;if(_0x1ded5b[_0xa02b('0x4c')]!=_0xa02b('0x54')){return createEndUser(_0x5cb7d7,_0x194de4,_0x460a30,_0x3b70ac,_0x50e816,_0x1ded5b);}else{return{};}});});break;case _0xa02b('0x55'):_0x23a372['uri']='https://www.zohoapis.'+_0x194de4+_0xa02b('0x50')+_0x3b70ac+'))';return getZohoUser(_0x23a372,_0xa02b('0x51'))['then'](function(_0x23588){if(_0x23588)return _0x23588;if(_0x1ded5b[_0xa02b('0x4c')]!=_0xa02b('0x54')){return createEndUser(_0x5cb7d7,_0x194de4,_0x460a30,_0x3b70ac,_0x50e816,_0x1ded5b);}else{return{};}});break;case _0xa02b('0x56'):_0x23a372[_0xa02b('0x52')]=_0xa02b('0x42')+_0x194de4+_0xa02b('0x53')+_0x3b70ac+'))';return getZohoUser(_0x23a372,_0xa02b('0x57'))['then'](function(_0x3ee893){if(_0x3ee893)return _0x3ee893;if(_0x1ded5b[_0xa02b('0x4c')]!=_0xa02b('0x54')){return createEndUser(_0x5cb7d7,_0x194de4,_0x460a30,_0x3b70ac,_0x50e816,_0x1ded5b);}else{return{};}});break;}}function getCall(_0x2f61f0,_0x1c84b9,_0x2cb03b,_0xc1aed1,_0x4548f6,_0x37f874,_0x5b9339,_0x1f09fc){logger[_0xa02b('0x31')](_0xa02b('0x58'));var _0x281610={};_0x281610[_0xa02b('0x59')]={'name':!_[_0xa02b('0x1e')](_0xc1aed1[_0xa02b('0x45')][_0xa02b('0x1b')])&&!_[_0xa02b('0x1e')](_0xc1aed1[_0xa02b('0x3b')][_0xa02b('0x1b')])&&_0xc1aed1[_0xa02b('0x3b')][_0xa02b('0x1b')]===_0xa02b('0x5a')?_0xc1aed1[_0xa02b('0x45')][_0xa02b('0x1b')]:!_[_0xa02b('0x1e')](_0xc1aed1[_0xa02b('0x46')])?_0xc1aed1[_0xa02b('0x46')]+'\x20'+_0xc1aed1['last_name']:_0xc1aed1[_0xa02b('0x47')],'id':_0xc1aed1['id']};_0x281610['Subject']=intUtil[_0xa02b('0x5b')](_0x37f874['Subjects'],_0x5b9339,'\x20');_0x281610[_0xa02b('0x5c')]=intUtil[_0xa02b('0x5b')](_0x37f874[_0xa02b('0x5d')],_0x5b9339,'\x0a');if(_0x4548f6[_0xa02b('0x40')]===_0xa02b('0x51')){_0x281610[_0xa02b('0x5e')]={'name':!_[_0xa02b('0x1e')](_0x4548f6[_0xa02b('0x5f')])?_0x4548f6['Full_Name']:!_['isNil'](_0x4548f6[_0xa02b('0x60')])?_0x4548f6[_0xa02b('0x60')]+'\x20'+_0x4548f6[_0xa02b('0x61')]:_0x4548f6['Last_Name'],'id':_0x4548f6['id']};}if(_0x4548f6[_0xa02b('0x40')]===_0xa02b('0x57')){_0x281610[_0xa02b('0x62')]={'name':!_[_0xa02b('0x1e')](_0x4548f6[_0xa02b('0x5f')])?_0x4548f6['Full_Name']:!_[_0xa02b('0x1e')](_0x4548f6[_0xa02b('0x60')])?_0x4548f6[_0xa02b('0x60')]+'\x20'+_0x4548f6[_0xa02b('0x61')]:_0x4548f6[_0xa02b('0x61')],'id':_0x4548f6['id']};_0x281610[_0xa02b('0x63')]=_[_0xa02b('0x44')](_0x4548f6[_0xa02b('0x40')]);}if(_0x5b9339[_0xa02b('0x64')]){_0x281610[_0xa02b('0x65')]=moment[_0xa02b('0x66')](parseInt(_0x5b9339['talktime'])*0x3e8)[_0xa02b('0x33')](_0xa02b('0x67'));}else if(_0x5b9339['answertime']&&_0x5b9339[_0xa02b('0x68')]){_0x281610[_0xa02b('0x65')]=moment['utc'](moment(_0x5b9339[_0xa02b('0x68')],'YYYY-MM-DDTHH:mm:ss')[_0xa02b('0x69')](moment(_0x5b9339['starttime'],_0xa02b('0x6a'))))[_0xa02b('0x33')](_0xa02b('0x67'));}switch(_0x5b9339[_0xa02b('0x6b')]){case _0xa02b('0x6c'):_0x281610[_0xa02b('0x6d')]=_0xa02b('0x6e');break;case _0xa02b('0x6f'):case _0xa02b('0x70'):_0x281610[_0xa02b('0x6d')]='Answered';break;case _0xa02b('0x71'):_0x281610[_0xa02b('0x6d')]=_0xa02b('0x72');break;case _0xa02b('0x73'):_0x281610[_0xa02b('0x6d')]=_0xa02b('0x74');break;case'timeout':_0x281610[_0xa02b('0x6d')]=_0xa02b('0x75');default:}_0x281610[_0xa02b('0x76')]=(_0x1f09fc===_0xa02b('0x77')?moment(_0x5b9339['starttime'])['format'](_0xa02b('0x6a')):moment(_0x5b9339[_0xa02b('0x78')])[_0xa02b('0x33')](_0xa02b('0x6a')))||moment()['format'](_0xa02b('0x6a'));_0x281610[_0xa02b('0x79')]=_0x1f09fc||_0xa02b('0x7a');_0x281610=_['merge'](_0x281610,getCustomFields(_0x37f874[_0xa02b('0x7b')],_0x5b9339));return request({'method':_0xa02b('0x41'),'uri':_0xa02b('0x42')+_0x1c84b9+_0xa02b('0x7c'),'headers':{'Authorization':_0xa02b('0x35')+_0x2f61f0},'body':{'data':[_0x281610]},'json':!![]})[_0xa02b('0x2c')](function(_0x329318){if(_0x329318&&_0x329318['data'][0x0][_0xa02b('0x49')]===_0xa02b('0x4a')){logger['info']('Call\x20created!');return{'id':_0x329318[_0xa02b('0x48')][0x0][_0xa02b('0x4b')]['id']};}})[_0xa02b('0x2e')](function(_0x34fcb8){logger[_0xa02b('0x31')](_0xa02b('0x7d'),_0x34fcb8['stack']);console['log'](_0xa02b('0x7d'),_0x34fcb8);});}exports[_0xa02b('0x7e')]=function(_0x551045,_0x547733,_0x580310,_0x3d37bc,_0x25b331,_0x2619e7){var _0x2e5f50,_0x3a10af,_0x13cc43;_0x2619e7[_0xa02b('0x7f')]=intUtil['stripTrailingSlash'](_0x2619e7[_0xa02b('0x7f')]);_0x2619e7[_0xa02b('0x80')]=intUtil[_0xa02b('0x81')](_0x2619e7[_0xa02b('0x80')]);if(_0x25b331&&_0x25b331[_0xa02b('0x82')]){logger['info'](_0xa02b('0x83'),'Recording\x20is\x20enabled!');_0x547733[_0xa02b('0x84')]=_0x2619e7[_0xa02b('0x80')]+_0xa02b('0x85')+_0x547733[_0xa02b('0x86')]+_0xa02b('0x87')+md5(_0x547733[_0xa02b('0x86')]);}else{_0x547733[_0xa02b('0x84')]='';}var _0x25470d=_0x2619e7[_0xa02b('0x7f')]===_0xa02b('0x88')?'eu':_0xa02b('0x89');return getAccessToken(_0x2619e7)[_0xa02b('0x2c')](function(_0x233ebe){_0x13cc43=_0x233ebe;return getUser(_0x13cc43,_0x25470d,_0x2619e7,_0x3d37bc['email']);})[_0xa02b('0x2c')](function(_0x92593){_0x2e5f50=_0x92593;logger[_0xa02b('0x31')]('The\x20User\x20ID\x20is:',_0x2e5f50['id']);return getEndUser(_0x13cc43,_0x25470d,_0x2619e7,_0x547733[_0xa02b('0x8a')],_0x547733[_0xa02b('0x8b')],_0x2e5f50,_0x580310);})[_0xa02b('0x2c')](function(_0x3e6df1){_0x3a10af=_0x3e6df1;return getCall(_0x13cc43,_0x25470d,_0x2619e7,_0x2e5f50,_0x3a10af,_0x580310,_0x547733,'Inbound');})[_0xa02b('0x2c')](function(_0x2310ee){if(_0x2310ee){logger['info']('The\x20Call\x20ID\x20is:',_0x2310ee['id']);logger[_0xa02b('0x31')]('[QUEUE]',_0xa02b('0x8c'));emit(util[_0xa02b('0x33')](_0xa02b('0x8d'),_0x3d37bc['name']),_0xa02b('0x8e'),{'uri':_0xa02b('0x8f')+_0x2619e7[_0xa02b('0x7f')]+_0xa02b('0x90')+_0x2310ee['id']});}})[_0xa02b('0x2e')](function(_0x2b38d1){logger[_0xa02b('0x2f')](_0xa02b('0x83'),JSON[_0xa02b('0x11')](_0x2b38d1));});};exports[_0xa02b('0x77')]=function(_0x2cdbcf,_0x376bfa,_0x333dab,_0xf33bb2,_0x48b6b8,_0x33e0d8,_0x200cda){var _0x5a5208,_0x16dbf4,_0xd2b964;_0x33e0d8[_0xa02b('0x7f')]=intUtil[_0xa02b('0x81')](_0x33e0d8[_0xa02b('0x7f')]);_0x33e0d8['serverUrl']=intUtil[_0xa02b('0x81')](_0x33e0d8[_0xa02b('0x80')]);if(_0x200cda&&_0x200cda['recordingFormat']&&_0x200cda['recordingFormat']!==_0xa02b('0x91')){logger[_0xa02b('0x31')](_0xa02b('0x92'),_0xa02b('0x93'));_0x376bfa['recordingURL']=_0x33e0d8[_0xa02b('0x80')]+_0xa02b('0x85')+_0x376bfa[_0xa02b('0x86')]+_0xa02b('0x87')+md5(_0x376bfa[_0xa02b('0x86')]);}var _0x5dad36=_0x33e0d8[_0xa02b('0x7f')]===_0xa02b('0x88')?'eu':'com';return getAccessToken(_0x33e0d8)[_0xa02b('0x2c')](function(_0x2acc1d){_0xd2b964=_0x2acc1d;return getUser(_0xd2b964,_0x5dad36,_0x33e0d8,_0xf33bb2['email']);})[_0xa02b('0x2c')](function(_0x29ee1f){_0x5a5208=_0x29ee1f;logger['info'](_0xa02b('0x94'),_0x5a5208['id']);return getEndUser(_0xd2b964,_0x5dad36,_0x33e0d8,_0x376bfa[_0xa02b('0x95')],_0x376bfa[_0xa02b('0x96')],_0x5a5208,_0x333dab);})['then'](function(_0x50e881){_0x16dbf4=_0x50e881;return getCall(_0xd2b964,_0x5dad36,_0x33e0d8,_0x5a5208,_0x16dbf4,_0x333dab,_0x376bfa,_0xa02b('0x97'));})[_0xa02b('0x2c')](function(_0x38f345){if(_0x38f345){logger[_0xa02b('0x31')](_0xa02b('0x98'),_0x38f345['id']);logger[_0xa02b('0x31')]('[OUTBOUND]',_0xa02b('0x8c'));emit(util['format'](_0xa02b('0x8d'),_0xf33bb2[_0xa02b('0x1b')]),'trigger:browser:url',{'uri':_0xa02b('0x8f')+_0x33e0d8[_0xa02b('0x7f')]+'/crm/EntityInfo.do?module=Calls&id='+_0x38f345['id']});}})[_0xa02b('0x2e')](function(_0x21d53f){logger[_0xa02b('0x2f')](_0xa02b('0x92'),JSON[_0xa02b('0x11')](_0x21d53f));});};exports[_0xa02b('0x99')]=function(_0x5c8bda,_0x1d036c,_0xbd89c3,_0x569681,_0x9d4ce3,_0x488531){var _0x34dd0b,_0x1a4e24,_0x8ef38b;_0x488531[_0xa02b('0x7f')]=intUtil['stripTrailingSlash'](_0x488531[_0xa02b('0x7f')]);_0x488531[_0xa02b('0x80')]=intUtil[_0xa02b('0x81')](_0x488531[_0xa02b('0x80')]);if(_0x9d4ce3&&_0x9d4ce3[_0xa02b('0x82')]){logger[_0xa02b('0x31')]('['+_0x1d036c[_0xa02b('0x6b')][_0xa02b('0x9a')]()+']',_0xa02b('0x93'));_0x1d036c['recordingURL']=_0x488531[_0xa02b('0x80')]+_0xa02b('0x85')+_0x1d036c[_0xa02b('0x86')]+'/downloads?type=uniqueid&token='+md5(_0x1d036c[_0xa02b('0x86')]);}else{_0x1d036c[_0xa02b('0x84')]='';}var _0x57b23e=_0x488531[_0xa02b('0x7f')]===_0xa02b('0x88')?'eu':_0xa02b('0x89');return getAccessToken(_0x488531)[_0xa02b('0x2c')](function(_0x947032){_0x8ef38b=_0x947032;return getUser(_0x8ef38b,_0x57b23e,_0x488531);})[_0xa02b('0x2c')](function(_0x276f5f){_0x34dd0b=_0x276f5f;logger[_0xa02b('0x31')]('The\x20User\x20ID\x20is:',_0x34dd0b['id']);return getEndUser(_0x8ef38b,_0x57b23e,_0x488531,_0x1d036c[_0xa02b('0x8a')],_0x1d036c[_0xa02b('0x8b')],_0x34dd0b,_0xbd89c3);})[_0xa02b('0x2c')](function(_0x27e02a){_0x1a4e24=_0x27e02a;return getCall(_0x8ef38b,_0x57b23e,_0x488531,_0x34dd0b,_0x1a4e24,_0xbd89c3,_0x1d036c,_0xa02b('0x7a'));})[_0xa02b('0x2c')](function(_0xf35e27){if(_0xf35e27){logger[_0xa02b('0x31')](_0xa02b('0x98'),_0xf35e27['id']);}})[_0xa02b('0x2e')](function(_0x4bfae9){logger['error']('['+_0x1d036c[_0xa02b('0x6b')]['toUpperCase']()+']',JSON[_0xa02b('0x11')](_0x4bfae9));});}; \ 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 b104969..ffa5593 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 _0x11cb=['mustache','../../../../config/logger','exec','data2','Script','render','data3','error','%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s','info','format','util','shelljs'];(function(_0x103270,_0x13ceac){var _0xa433b0=function(_0x1fee92){while(--_0x1fee92){_0x103270['push'](_0x103270['shift']());}};_0xa433b0(++_0x13ceac);}(_0x11cb,0x1d2));var _0xb11c=function(_0x2e16c1,_0x26ab1c){_0x2e16c1=_0x2e16c1-0x0;var _0x4456d7=_0x11cb[_0x2e16c1];return _0x4456d7;};'use strict';var util=require(_0xb11c('0x0'));var sh=require(_0xb11c('0x1'));var Mustache=require(_0xb11c('0x2'));var logger=require(_0xb11c('0x3'))('trigger');exports[_0xb11c('0x4')]=function(_0x3e878c,_0x553a6b){var _0x450b29=_0x3e878c[_0xb11c('0x5')]?_0x3e878c['data2']:_0xb11c('0x6');var _0x2b0951=_0x3e878c['data3']?Mustache[_0xb11c('0x7')](_0x3e878c[_0xb11c('0x8')],_0x553a6b):_0x553a6b;sh[_0xb11c('0x4')](_0x2b0951,function(_0x2f5a62,_0x3cb191,_0xad6996){if(_0x2f5a62!==0x0){logger[_0xb11c('0x9')](util['format'](_0xb11c('0xa'),_0x450b29,_0x2b0951,_0x2f5a62,_0xad6996));}else{logger[_0xb11c('0xb')](util[_0xb11c('0xc')]('%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s',_0x450b29,_0x2b0951,_0x3cb191));}});}; \ No newline at end of file +var _0x7341=['shelljs','../../../../config/logger','trigger','exec','data2','Script','data3','error','info','%s\x20\x27%s\x27\x20succeeded\x20with\x20output:\x20%s','util'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x7341,0xe6));var _0x1734=function(_0x1125cd,_0xc952bf){_0x1125cd=_0x1125cd-0x0;var _0x496b98=_0x7341[_0x1125cd];return _0x496b98;};'use strict';var util=require(_0x1734('0x0'));var sh=require(_0x1734('0x1'));var Mustache=require('mustache');var logger=require(_0x1734('0x2'))(_0x1734('0x3'));exports[_0x1734('0x4')]=function(_0x120f29,_0x1010cd){var _0x4480aa=_0x120f29['data2']?_0x120f29[_0x1734('0x5')]:_0x1734('0x6');var _0x47bdab=_0x120f29['data3']?Mustache['render'](_0x120f29[_0x1734('0x7')],_0x1010cd):_0x1010cd;sh[_0x1734('0x4')](_0x47bdab,function(_0x2f4b69,_0x52f1d9,_0x3106bb){if(_0x2f4b69!==0x0){logger[_0x1734('0x8')](util['format']('%s\x20\x27%s\x27\x20failed\x20with\x20code\x20%d\x20and\x20error:\x20%s',_0x4480aa,_0x47bdab,_0x2f4b69,_0x3106bb));}else{logger[_0x1734('0x9')](util['format'](_0x1734('0xa'),_0x4480aa,_0x47bdab,_0x52f1d9));}});}; \ 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 c4b9319..0f224db 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 _0x919e=['object','%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s','catch','%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s','statusCode','name','lodash','mustache','../../../../config/logger','trigger','data1','toUpperCase','render','data5','headers','data6','error','GET','PUT','data7','parse','body','stack','info','format','%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s','data2','stringify','then',',\x20request\x20body:\x20'];(function(_0x265ee5,_0x2b8b13){var _0x5dcef4=function(_0x4a2528){while(--_0x4a2528){_0x265ee5['push'](_0x265ee5['shift']());}};_0x5dcef4(++_0x2b8b13);}(_0x919e,0x9c));var _0xe919=function(_0x14add3,_0x13ce8d){_0x14add3=_0x14add3-0x0;var _0x4a174f=_0x919e[_0x14add3];return _0x4a174f;};'use strict';var rp=require('request-promise');var util=require('util');var _=require(_0xe919('0x0'));var Mustache=require(_0xe919('0x1'));var logger=require(_0xe919('0x2'))(_0xe919('0x3'));exports['exec']=function(_0x178428,_0x13421a){var _0x379ebf,_0x572555;var _0x44ce77={'method':_0x178428[_0xe919('0x4')][_0xe919('0x5')](),'uri':Mustache[_0xe919('0x6')](_0x178428['data2'],_0x13421a),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x178428[_0xe919('0x7')])==='number'&&parseInt(_0x178428[_0xe919('0x7')])>=0x1&&parseInt(_0x178428[_0xe919('0x7')])<=0xa?parseInt(_0x178428['data5'])*0x3e8:0x5*0x3e8};try{_0x44ce77[_0xe919('0x8')]=_0x178428[_0xe919('0x9')]?JSON['parse'](Mustache[_0xe919('0x6')](_0x178428[_0xe919('0x9')],_0x13421a)):{};}catch(_0x3f2045){logger[_0xe919('0xa')](_0x3f2045['stack']);}switch(_0x178428[_0xe919('0x4')][_0xe919('0x5')]()){case _0xe919('0xb'):case'DELETE':_0x379ebf=null;_0x44ce77['qs']=_0x13421a;break;case'POST':case _0xe919('0xc'):if(_0x178428[_0xe919('0xd')]){try{_0x379ebf=JSON[_0xe919('0xe')](Mustache[_0xe919('0x6')](_0x178428[_0xe919('0xd')],_0x13421a));_0x44ce77[_0xe919('0xf')]=_0x379ebf;}catch(_0x5acafc){logger[_0xe919('0xa')](_0x5acafc[_0xe919('0x10')]);logger['error']('body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format');}}else{_0x379ebf=_0x13421a;_0x44ce77['body']=_0x379ebf;}break;}logger[_0xe919('0x11')](util[_0xe919('0x12')](_0xe919('0x13'),_0x178428[_0xe919('0x4')],_0x178428[_0xe919('0x14')],JSON[_0xe919('0x15')](_0x44ce77)));rp(_0x44ce77)[_0xe919('0x16')](function(_0x341d53){_0x379ebf=!_['isNil'](_0x379ebf)?_0xe919('0x17')+_0x379ebf:'';_0x572555=typeof _0x341d53[_0xe919('0xf')]===_0xe919('0x18')?JSON[_0xe919('0x15')](_0x341d53[_0xe919('0xf')]):_0x341d53['body'];logger[_0xe919('0x11')](util[_0xe919('0x12')](_0xe919('0x19'),_0x178428['data1'],_0x178428[_0xe919('0x14')],_0x341d53['statusCode'],_0x572555));})[_0xe919('0x1a')](function(_0x32e663){logger[_0xe919('0xa')](util[_0xe919('0x12')](_0xe919('0x1b'),_0x178428[_0xe919('0x4')],_0x178428['data2'],_0x32e663[_0xe919('0x1c')],_0x32e663[_0xe919('0x1d')],_0x32e663['message']));});}; \ No newline at end of file +var _0x996a=['number','headers','data6','parse','error','GET','DELETE','POST','PUT','data7','body\x20has\x20been\x20passed\x20to\x20URLforward\x20in\x20a\x20wrong\x20format','body','info','data2','stringify','then','isNil',',\x20request\x20body:\x20','object','format','statusCode','catch','name','message','request-promise','lodash','mustache','trigger','data1','toUpperCase','render','data5'];(function(_0x1b575d,_0x446069){var _0x27ed22=function(_0x26863e){while(--_0x26863e){_0x1b575d['push'](_0x1b575d['shift']());}};_0x27ed22(++_0x446069);}(_0x996a,0xd8));var _0xa996=function(_0x38979b,_0x520083){_0x38979b=_0x38979b-0x0;var _0x52fdad=_0x996a[_0x38979b];return _0x52fdad;};'use strict';var rp=require(_0xa996('0x0'));var util=require('util');var _=require(_0xa996('0x1'));var Mustache=require(_0xa996('0x2'));var logger=require('../../../../config/logger')(_0xa996('0x3'));exports['exec']=function(_0x42d8d5,_0x41c9a0){var _0x1b9a30,_0x12e897;var _0x4b97c3={'method':_0x42d8d5[_0xa996('0x4')][_0xa996('0x5')](),'uri':Mustache[_0xa996('0x6')](_0x42d8d5['data2'],_0x41c9a0),'json':!![],'resolveWithFullResponse':!![],'timeout':typeof parseInt(_0x42d8d5[_0xa996('0x7')])===_0xa996('0x8')&&parseInt(_0x42d8d5[_0xa996('0x7')])>=0x1&&parseInt(_0x42d8d5[_0xa996('0x7')])<=0xa?parseInt(_0x42d8d5[_0xa996('0x7')])*0x3e8:0x5*0x3e8};try{_0x4b97c3[_0xa996('0x9')]=_0x42d8d5[_0xa996('0xa')]?JSON[_0xa996('0xb')](Mustache[_0xa996('0x6')](_0x42d8d5['data6'],_0x41c9a0)):{};}catch(_0x14b942){logger[_0xa996('0xc')](_0x14b942['stack']);}switch(_0x42d8d5[_0xa996('0x4')][_0xa996('0x5')]()){case _0xa996('0xd'):case _0xa996('0xe'):_0x1b9a30=null;_0x4b97c3['qs']=_0x41c9a0;break;case _0xa996('0xf'):case _0xa996('0x10'):if(_0x42d8d5[_0xa996('0x11')]){try{_0x1b9a30=JSON[_0xa996('0xb')](Mustache[_0xa996('0x6')](_0x42d8d5[_0xa996('0x11')],_0x41c9a0));_0x4b97c3['body']=_0x1b9a30;}catch(_0x5b8a18){logger[_0xa996('0xc')](_0x5b8a18['stack']);logger['error'](_0xa996('0x12'));}}else{_0x1b9a30=_0x41c9a0;_0x4b97c3[_0xa996('0x13')]=_0x1b9a30;}break;}logger[_0xa996('0x14')](util['format']('%s\x20%s\x20sending\x20request\x20with\x20following\x20options:\x20%s',_0x42d8d5[_0xa996('0x4')],_0x42d8d5[_0xa996('0x15')],JSON[_0xa996('0x16')](_0x4b97c3)));rp(_0x4b97c3)[_0xa996('0x17')](function(_0x1b0070){_0x1b9a30=!_[_0xa996('0x18')](_0x1b9a30)?_0xa996('0x19')+_0x1b9a30:'';_0x12e897=typeof _0x1b0070[_0xa996('0x13')]===_0xa996('0x1a')?JSON['stringify'](_0x1b0070['body']):_0x1b0070[_0xa996('0x13')];logger[_0xa996('0x14')](util[_0xa996('0x1b')]('%s\x20%s\x20succeeded\x20with\x20status:\x20%d\x20and\x20response:\x20%s',_0x42d8d5[_0xa996('0x4')],_0x42d8d5[_0xa996('0x15')],_0x1b0070[_0xa996('0x1c')],_0x12e897));})[_0xa996('0x1d')](function(_0x25b908){logger['error'](util[_0xa996('0x1b')]('%s\x20%s\x20failed\x20with\x20status:\x20%d\x20and\x20error:\x20%s\x20%s',_0x42d8d5[_0xa996('0x4')],_0x42d8d5[_0xa996('0x15')],_0x25b908[_0xa996('0x1c')],_0x25b908[_0xa996('0x1e')],_0x25b908[_0xa996('0x1f')]));});}; \ No newline at end of file diff --git a/server/services/email/client.js b/server/services/email/client.js index b1e03e7..fac4ff3 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 _0xbf54=['error','message','result','catch','exports','jayson/promise','bluebird','../../config/logger','routing','client','http','Request','then','rpc'];(function(_0x2303d6,_0x596c2b){var _0x126d54=function(_0xfeb17d){while(--_0xfeb17d){_0x2303d6['push'](_0x2303d6['shift']());}};_0x126d54(++_0x596c2b);}(_0xbf54,0xf3));var _0x4bf5=function(_0x5bd426,_0x4878e5){_0x5bd426=_0x5bd426-0x0;var _0x23a7eb=_0xbf54[_0x5bd426];return _0x23a7eb;};'use strict';var jayson=require(_0x4bf5('0x0'));var BPromise=require(_0x4bf5('0x1'));var logger=require(_0x4bf5('0x2'))(_0x4bf5('0x3'));var client=jayson[_0x4bf5('0x4')][_0x4bf5('0x5')]({'port':0x2329});client[_0x4bf5('0x6')]=function(_0x18df2e,_0x973b06){return new BPromise(function(_0x8093e6,_0x2dfab0){return client['request'](_0x18df2e,_0x973b06)[_0x4bf5('0x7')](function(_0x2b2324){logger['debug'](_0x4bf5('0x8'),_0x4bf5('0x3'),_0x18df2e,_0x973b06,_0x2b2324);if(_0x2b2324[_0x4bf5('0x9')]){logger[_0x4bf5('0x9')](_0x4bf5('0x8'),'routing',_0x18df2e,_0x2b2324['error'][_0x4bf5('0xa')],_0x973b06);return _0x2dfab0(_0x2b2324[_0x4bf5('0x9')][_0x4bf5('0xa')]);}else{return _0x8093e6(_0x2b2324[_0x4bf5('0xb')]);}})[_0x4bf5('0xc')](function(_0x4b2489){logger[_0x4bf5('0x9')]('rpc','routing',_0x18df2e,_0x4b2489,_0x973b06);return _0x2dfab0(_0x4b2489);});});};module[_0x4bf5('0xd')]=client; \ No newline at end of file +var _0xc91a=['client','http','Request','request','then','rpc','error','message','result','exports','jayson/promise','bluebird','routing'];(function(_0x2bce14,_0x94543b){var _0x578203=function(_0x522ef3){while(--_0x522ef3){_0x2bce14['push'](_0x2bce14['shift']());}};_0x578203(++_0x94543b);}(_0xc91a,0x1b7));var _0xac91=function(_0x3e779e,_0x1dff24){_0x3e779e=_0x3e779e-0x0;var _0x212683=_0xc91a[_0x3e779e];return _0x212683;};'use strict';var jayson=require(_0xac91('0x0'));var BPromise=require(_0xac91('0x1'));var logger=require('../../config/logger')(_0xac91('0x2'));var client=jayson[_0xac91('0x3')][_0xac91('0x4')]({'port':0x2329});client[_0xac91('0x5')]=function(_0x2776a8,_0x3f644b){return new BPromise(function(_0x69a6ef,_0x4ee490){return client[_0xac91('0x6')](_0x2776a8,_0x3f644b)[_0xac91('0x7')](function(_0x34abaa){logger['debug'](_0xac91('0x8'),_0xac91('0x2'),_0x2776a8,_0x3f644b,_0x34abaa);if(_0x34abaa[_0xac91('0x9')]){logger[_0xac91('0x9')](_0xac91('0x8'),_0xac91('0x2'),_0x2776a8,_0x34abaa[_0xac91('0x9')][_0xac91('0xa')],_0x3f644b);return _0x4ee490(_0x34abaa['error'][_0xac91('0xa')]);}else{return _0x69a6ef(_0x34abaa[_0xac91('0xb')]);}})['catch'](function(_0x19fb47){logger[_0xac91('0x9')](_0xac91('0x8'),'routing',_0x2776a8,_0x19fb47,_0x3f644b);return _0x4ee490(_0x19fb47);});});};module[_0xac91('0xc')]=client; \ No newline at end of file diff --git a/server/services/email/index.js b/server/services/email/index.js index 2fa436a..784e5d3 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 _0xa95c=['getSettings','catch','error','./server','./realtime','./lib/email','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh','listen'];(function(_0x2e641b,_0x1b03ae){var _0x3f15a9=function(_0x2ba7db){while(--_0x2ba7db){_0x2e641b['push'](_0x2e641b['shift']());}};_0x3f15a9(++_0x1b03ae);}(_0xa95c,0x73));var _0xca95=function(_0x1af2a5,_0x39026d){_0x1af2a5=_0x1af2a5-0x0;var _0x127269=_0xa95c[_0x1af2a5];return _0x127269;};'use strict';var server=require(_0xca95('0x0'));var Realtime=require(_0xca95('0x1'));var EmailChannel=require(_0xca95('0x2'));var mailAccount=require('./rpc/mailAccount');var setting=require('./rpc/setting');var logger=require(_0xca95('0x3'))(_0xca95('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xca95('0x5')]()[_0xca95('0x6')](mailAccount[_0xca95('0x7')]())[_0xca95('0x6')](realtime[_0xca95('0x8')]())['then'](function(){email[_0xca95('0x9')](realtime['mailAccounts']);return realtime;});}function main(){return server[_0xca95('0xa')](realtime,email)[_0xca95('0x6')](function(){return initRealtime();})[_0xca95('0x6')](function(){return setting[_0xca95('0xb')]();})[_0xca95('0x6')](function(_0x2df22d){return setInterval(initRealtime,_0x2df22d['loginMailFrequency']*0x3e8);})[_0xca95('0xc')](function(_0x33c107){logger[_0xca95('0xd')]('Email\x20service\x20initialization',_0x33c107);});}main(); \ No newline at end of file +var _0x599f=['mailAccounts','getSettings','loginMailFrequency','catch','Email\x20service\x20initialization','./server','./lib/email','./rpc/mailAccount','../../config/logger','email','resolve','then','getMailAccounts','initMailAccounts','refresh'];(function(_0x1d03a4,_0x170c84){var _0x59c81a=function(_0x4eb042){while(--_0x4eb042){_0x1d03a4['push'](_0x1d03a4['shift']());}};_0x59c81a(++_0x170c84);}(_0x599f,0x104));var _0xf599=function(_0x1a71c4,_0x440bcf){_0x1a71c4=_0x1a71c4-0x0;var _0x5a3605=_0x599f[_0x1a71c4];return _0x5a3605;};'use strict';var server=require(_0xf599('0x0'));var Realtime=require('./realtime');var EmailChannel=require(_0xf599('0x1'));var mailAccount=require(_0xf599('0x2'));var setting=require('./rpc/setting');var logger=require(_0xf599('0x3'))(_0xf599('0x4'));var realtime=new Realtime();var email=new EmailChannel(realtime);function initRealtime(){return Promise[_0xf599('0x5')]()[_0xf599('0x6')](mailAccount[_0xf599('0x7')]())['then'](realtime[_0xf599('0x8')]())[_0xf599('0x6')](function(){email[_0xf599('0x9')](realtime[_0xf599('0xa')]);return realtime;});}function main(){return server['listen'](realtime,email)['then'](function(){return initRealtime();})['then'](function(){return setting[_0xf599('0xb')]();})[_0xf599('0x6')](function(_0x8122){return setInterval(initRealtime,_0x8122[_0xf599('0xc')]*0x3e8);})[_0xf599('0xd')](function(_0x3140cd){logger['error'](_0xf599('0xe'),_0x3140cd);});}main(); \ No newline at end of file diff --git a/server/services/email/lib/email.js b/server/services/email/lib/email.js index 50ce2fe..0fb7f60 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 _0x962a=['md5','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','smtp','emit','name','key','Imap','status','messageStatus','total','isNil','stringify','prototype','refresh','hasOwnProperty','active','service','custom','provider','imapAccounts','box','handleImapBox','bind','handleImapEmail','end','handleImapEnd','error','disabled','connected','messages','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','lastName','from','then','Mail\x20accepted\x20from\x20routing','Mail\x20not\x20accepted\x20from\x20routing\x20%s','lastSync','handleImapError','sendMail','send','verifySmtp','Smtp','verified','verify','exports','lodash','moment','bluebird'];(function(_0x38a122,_0x3bfa3d){var _0x211f55=function(_0x3bcd94){while(--_0x3bcd94){_0x38a122['push'](_0x38a122['shift']());}};_0x211f55(++_0x3bfa3d);}(_0x962a,0xe5));var _0xa962=function(_0x5c2d9b,_0x3b0fb4){_0x5c2d9b=_0x5c2d9b-0x0;var _0x4dc12b=_0x962a[_0x5c2d9b];return _0x4dc12b;};'use strict';var _=require(_0xa962('0x0'));var moment=require(_0xa962('0x1'));var BPromise=require(_0xa962('0x2'));var md5=require(_0xa962('0x3'));var Redis=require('ioredis');var config=require(_0xa962('0x4'));var logger=require(_0xa962('0x5'))(_0xa962('0x6'));config[_0xa962('0x7')]=_[_0xa962('0x8')](config[_0xa962('0x7')],{'host':_0xa962('0x9'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0xa962('0x7')]));var EmailImap=require('./imap');var EmailSmtp=require(_0xa962('0xa'));var mailAccount=require(_0xa962('0xb'));var md5Accounts={};function EmailChannel(_0x368e0e){logger[_0xa962('0xc')](_0xa962('0xd'));this[_0xa962('0xe')]=_0x368e0e[_0xa962('0xe')];this['imapAccounts']={};this[_0xa962('0xf')]=new EmailSmtp();}EmailChannel['prototype'][_0xa962('0x10')]=function(_0x37a824){var _0x2af16d=this[_0xa962('0xe')][_0x37a824];var _0x3ad32f={'id':_0x2af16d['id'],'name':_0x2af16d[_0xa962('0x11')],'key':_0x2af16d[_0xa962('0x12')],'active':_0x2af16d['active'],'Imap':{'status':_0x2af16d[_0xa962('0x13')][_0xa962('0x14')],'messageStatus':_0x2af16d[_0xa962('0x13')][_0xa962('0x15')],'total':_0x2af16d['Imap'][_0xa962('0x16')]}};if(_[_0xa962('0x17')](md5Accounts[_0x37a824])){md5Accounts[_0x37a824]={};}var _0x4940cf=md5(JSON[_0xa962('0x18')](_0x3ad32f));if(md5Accounts[_0x37a824][_0xa962('0x3')]!==_0x4940cf){md5Accounts[_0x37a824]['md5']=_0x4940cf;io[_0xa962('0x10')]('mailAccount:update',_0x3ad32f);}};EmailChannel[_0xa962('0x19')][_0xa962('0x1a')]=function(_0x218b60){for(var _0x5cedbe in _0x218b60){if(_0x218b60[_0xa962('0x1b')](_0x5cedbe)){if(_0x218b60[_0x5cedbe][_0xa962('0x13')]&&_0x218b60[_0x5cedbe][_0xa962('0x1c')]){var _0x1bc581=_0x218b60[_0x5cedbe][_0xa962('0x13')];if(!_0x1bc581[_0xa962('0x1d')]&&_0x218b60[_0x5cedbe]['provider']!==_0xa962('0x1e'))_0x1bc581[_0xa962('0x1d')]=_0x218b60[_0x5cedbe][_0xa962('0x1f')];if(!this['imapAccounts']['hasOwnProperty'](_0x1bc581['id'])){this[_0xa962('0x20')][_0x1bc581['id']]=new EmailImap(_0x1bc581,_0x218b60[_0x5cedbe][_0xa962('0x6')]);this['imapAccounts'][_0x1bc581['id']]['on'](_0xa962('0x21'),this[_0xa962('0x22')][_0xa962('0x23')](this,_0x5cedbe));this['imapAccounts'][_0x1bc581['id']]['on'](_0xa962('0x6'),this[_0xa962('0x24')][_0xa962('0x23')](this,_0x5cedbe));this[_0xa962('0x20')][_0x1bc581['id']]['on'](_0xa962('0x25'),this[_0xa962('0x26')][_0xa962('0x23')](this,_0x5cedbe));this[_0xa962('0x20')][_0x1bc581['id']]['on'](_0xa962('0x27'),this['handleImapError'][_0xa962('0x23')](this,_0x5cedbe));}}else{if(_[_0xa962('0x17')](this[_0xa962('0xe')][_0x5cedbe][_0xa962('0x13')])){this[_0xa962('0xe')][_0x5cedbe]['Imap']={};}this[_0xa962('0xe')][_0x5cedbe]['Imap']['status']=_0xa962('0x28');this[_0xa962('0xe')][_0x5cedbe][_0xa962('0x13')][_0xa962('0x15')]='';this[_0xa962('0x10')](_0x5cedbe);}}}};EmailChannel[_0xa962('0x19')]['handleImapBox']=function(_0x3f197d,_0x1f3be5){if(this[_0xa962('0xe')][_0x3f197d]){this['mailAccounts'][_0x3f197d][_0xa962('0x13')][_0xa962('0x14')]=_0xa962('0x29');this[_0xa962('0xe')][_0x3f197d]['Imap']['messageStatus']=_0x1f3be5['name'];if(_0x1f3be5[_0xa962('0x2a')]){this[_0xa962('0xe')][_0x3f197d]['Imap'][_0xa962('0x16')]=_0x1f3be5[_0xa962('0x2a')][_0xa962('0x16')];}return this['emit'](_0x3f197d);}};EmailChannel[_0xa962('0x19')][_0xa962('0x24')]=function(_0x379c28,_0x5c380d){logger['info'](_0xa962('0x2b'),_0x5c380d['firstName'],_0x5c380d[_0xa962('0x2c')],_0x5c380d[_0xa962('0x2d')],_0x379c28);if(this[_0xa962('0xe')][_0x379c28]){return mailAccount['notify'](_0x379c28,_0x5c380d)[_0xa962('0x2e')](function(_0x5a5119){if(_0x5a5119){logger['info'](_0xa962('0x2f'));}})['catch'](function(_0x37657e){logger[_0xa962('0x27')](_0xa962('0x30'),JSON['stringify'](_0x37657e));});}};EmailChannel[_0xa962('0x19')][_0xa962('0x26')]=function(_0x1049f9){if(this[_0xa962('0xe')][_0x1049f9]&&this[_0xa962('0xe')][_0x1049f9][_0xa962('0x13')]){if(this[_0xa962('0x20')][this[_0xa962('0xe')][_0x1049f9][_0xa962('0x13')]['id']]){delete this[_0xa962('0x20')][this[_0xa962('0xe')][_0x1049f9][_0xa962('0x13')]['id']];}this[_0xa962('0xe')][_0x1049f9]['Imap'][_0xa962('0x31')]=moment();this[_0xa962('0x10')](_0x1049f9);}};EmailChannel[_0xa962('0x19')][_0xa962('0x32')]=function(_0x256961,_0x93ef7d){if(this[_0xa962('0xe')][_0x256961]){this[_0xa962('0xe')][_0x256961]['Imap'][_0xa962('0x14')]=_0xa962('0x27');this['mailAccounts'][_0x256961][_0xa962('0x13')]['messageStatus']=_0x93ef7d;return this[_0xa962('0x10')](_0x256961);}};EmailChannel[_0xa962('0x19')][_0xa962('0x33')]=function(_0x5079d5,_0x237d15){return this[_0xa962('0xf')][_0xa962('0x34')](_0x5079d5,_0x237d15);};EmailChannel[_0xa962('0x19')][_0xa962('0x35')]=function(_0x443c21){var _0x132f1e=this;if(this[_0xa962('0xe')][_0x443c21['id']]){if(_[_0xa962('0x17')](this[_0xa962('0xe')][_0x443c21['id']][_0xa962('0x36')])){this['mailAccounts'][_0x443c21['id']]['Smtp']={};}this[_0xa962('0xe')][_0x443c21['id']][_0xa962('0x36')][_0xa962('0x31')]=moment();return new BPromise(function(_0x2ebed7,_0x6bc146){return _0x132f1e[_0xa962('0xf')]['verify'](_0x443c21)['then'](function(_0x3cdc8d){_0x132f1e[_0xa962('0xe')][_0x443c21['id']]['Smtp']['status']=_0xa962('0x37');_0x132f1e[_0xa962('0xe')][_0x443c21['id']][_0xa962('0x36')][_0xa962('0x15')]='';_0x132f1e[_0xa962('0x10')](_0x443c21['id']);_0x2ebed7(_0x3cdc8d);})['catch'](function(_0x160910){_0x132f1e[_0xa962('0xe')][_0x443c21['id']][_0xa962('0x36')]['status']='error';_0x132f1e[_0xa962('0xe')][_0x443c21['id']][_0xa962('0x36')][_0xa962('0x15')]=_0x160910;_0x132f1e[_0xa962('0x10')](_0x443c21['id']);_0x6bc146(_0x160910);});});}return this['smtp'][_0xa962('0x38')](_0x443c21);};module[_0xa962('0x39')]=EmailChannel; \ No newline at end of file +var _0xe864=['service','provider','custom','box','handleImapBox','end','handleImapEnd','bind','error','handleImapError','disabled','connected','messages','total','handleImapEmail','New\x20email\x20from\x20%s\x20%s\x20%s\x20to\x20%s','firstName','lastName','notify','then','Mail\x20accepted\x20from\x20routing','catch','lastSync','sendMail','send','Smtp','verify','verified','moment','bluebird','md5','ioredis','../../../config/environment','../../../config/logger','email','redis','defaults','localhost','socket.io-emitter','./imap','./smtp','../rpc/mailAccount','info','start\x20email\x20channel','mailAccounts','imapAccounts','smtp','emit','name','key','active','Imap','status','messageStatus','isNil','stringify','mailAccount:update','prototype','refresh','hasOwnProperty'];(function(_0x43b714,_0x2f176b){var _0x58661a=function(_0x19f8ec){while(--_0x19f8ec){_0x43b714['push'](_0x43b714['shift']());}};_0x58661a(++_0x2f176b);}(_0xe864,0x148));var _0x4e86=function(_0x1b4aa2,_0x2d8d89){_0x1b4aa2=_0x1b4aa2-0x0;var _0x94df70=_0xe864[_0x1b4aa2];return _0x94df70;};'use strict';var _=require('lodash');var moment=require(_0x4e86('0x0'));var BPromise=require(_0x4e86('0x1'));var md5=require(_0x4e86('0x2'));var Redis=require(_0x4e86('0x3'));var config=require(_0x4e86('0x4'));var logger=require(_0x4e86('0x5'))(_0x4e86('0x6'));config[_0x4e86('0x7')]=_[_0x4e86('0x8')](config[_0x4e86('0x7')],{'host':_0x4e86('0x9'),'port':0x18eb});var io=require(_0x4e86('0xa'))(new Redis(config[_0x4e86('0x7')]));var EmailImap=require(_0x4e86('0xb'));var EmailSmtp=require(_0x4e86('0xc'));var mailAccount=require(_0x4e86('0xd'));var md5Accounts={};function EmailChannel(_0x42970e){logger[_0x4e86('0xe')](_0x4e86('0xf'));this[_0x4e86('0x10')]=_0x42970e[_0x4e86('0x10')];this[_0x4e86('0x11')]={};this[_0x4e86('0x12')]=new EmailSmtp();}EmailChannel['prototype'][_0x4e86('0x13')]=function(_0x553b2a){var _0x268fc8=this[_0x4e86('0x10')][_0x553b2a];var _0x1233ca={'id':_0x268fc8['id'],'name':_0x268fc8[_0x4e86('0x14')],'key':_0x268fc8[_0x4e86('0x15')],'active':_0x268fc8[_0x4e86('0x16')],'Imap':{'status':_0x268fc8[_0x4e86('0x17')][_0x4e86('0x18')],'messageStatus':_0x268fc8[_0x4e86('0x17')][_0x4e86('0x19')],'total':_0x268fc8[_0x4e86('0x17')]['total']}};if(_[_0x4e86('0x1a')](md5Accounts[_0x553b2a])){md5Accounts[_0x553b2a]={};}var _0x27580b=md5(JSON[_0x4e86('0x1b')](_0x1233ca));if(md5Accounts[_0x553b2a]['md5']!==_0x27580b){md5Accounts[_0x553b2a]['md5']=_0x27580b;io[_0x4e86('0x13')](_0x4e86('0x1c'),_0x1233ca);}};EmailChannel[_0x4e86('0x1d')][_0x4e86('0x1e')]=function(_0x3fc37d){for(var _0x15d949 in _0x3fc37d){if(_0x3fc37d[_0x4e86('0x1f')](_0x15d949)){if(_0x3fc37d[_0x15d949][_0x4e86('0x17')]&&_0x3fc37d[_0x15d949][_0x4e86('0x16')]){var _0x168b4a=_0x3fc37d[_0x15d949][_0x4e86('0x17')];if(!_0x168b4a[_0x4e86('0x20')]&&_0x3fc37d[_0x15d949][_0x4e86('0x21')]!==_0x4e86('0x22'))_0x168b4a[_0x4e86('0x20')]=_0x3fc37d[_0x15d949][_0x4e86('0x21')];if(!this['imapAccounts']['hasOwnProperty'](_0x168b4a['id'])){this[_0x4e86('0x11')][_0x168b4a['id']]=new EmailImap(_0x168b4a,_0x3fc37d[_0x15d949][_0x4e86('0x6')]);this['imapAccounts'][_0x168b4a['id']]['on'](_0x4e86('0x23'),this[_0x4e86('0x24')]['bind'](this,_0x15d949));this[_0x4e86('0x11')][_0x168b4a['id']]['on'](_0x4e86('0x6'),this['handleImapEmail']['bind'](this,_0x15d949));this['imapAccounts'][_0x168b4a['id']]['on'](_0x4e86('0x25'),this[_0x4e86('0x26')][_0x4e86('0x27')](this,_0x15d949));this[_0x4e86('0x11')][_0x168b4a['id']]['on'](_0x4e86('0x28'),this[_0x4e86('0x29')][_0x4e86('0x27')](this,_0x15d949));}}else{if(_[_0x4e86('0x1a')](this[_0x4e86('0x10')][_0x15d949][_0x4e86('0x17')])){this['mailAccounts'][_0x15d949]['Imap']={};}this[_0x4e86('0x10')][_0x15d949]['Imap']['status']=_0x4e86('0x2a');this[_0x4e86('0x10')][_0x15d949][_0x4e86('0x17')][_0x4e86('0x19')]='';this[_0x4e86('0x13')](_0x15d949);}}}};EmailChannel[_0x4e86('0x1d')][_0x4e86('0x24')]=function(_0x593377,_0x463581){if(this[_0x4e86('0x10')][_0x593377]){this['mailAccounts'][_0x593377][_0x4e86('0x17')][_0x4e86('0x18')]=_0x4e86('0x2b');this[_0x4e86('0x10')][_0x593377]['Imap'][_0x4e86('0x19')]=_0x463581[_0x4e86('0x14')];if(_0x463581[_0x4e86('0x2c')]){this[_0x4e86('0x10')][_0x593377][_0x4e86('0x17')][_0x4e86('0x2d')]=_0x463581[_0x4e86('0x2c')]['total'];}return this[_0x4e86('0x13')](_0x593377);}};EmailChannel[_0x4e86('0x1d')][_0x4e86('0x2e')]=function(_0x3b32d6,_0x5d2424){logger['info'](_0x4e86('0x2f'),_0x5d2424[_0x4e86('0x30')],_0x5d2424[_0x4e86('0x31')],_0x5d2424['from'],_0x3b32d6);if(this[_0x4e86('0x10')][_0x3b32d6]){return mailAccount[_0x4e86('0x32')](_0x3b32d6,_0x5d2424)[_0x4e86('0x33')](function(_0x3d1303){if(_0x3d1303){logger[_0x4e86('0xe')](_0x4e86('0x34'));}})[_0x4e86('0x35')](function(_0xb50f82){logger[_0x4e86('0x28')]('Mail\x20not\x20accepted\x20from\x20routing\x20%s',JSON[_0x4e86('0x1b')](_0xb50f82));});}};EmailChannel[_0x4e86('0x1d')][_0x4e86('0x26')]=function(_0x5507b8){if(this['mailAccounts'][_0x5507b8]&&this[_0x4e86('0x10')][_0x5507b8]['Imap']){if(this[_0x4e86('0x11')][this['mailAccounts'][_0x5507b8]['Imap']['id']]){delete this[_0x4e86('0x11')][this[_0x4e86('0x10')][_0x5507b8][_0x4e86('0x17')]['id']];}this[_0x4e86('0x10')][_0x5507b8][_0x4e86('0x17')][_0x4e86('0x36')]=moment();this['emit'](_0x5507b8);}};EmailChannel[_0x4e86('0x1d')]['handleImapError']=function(_0x5087c5,_0x51a6ea){if(this[_0x4e86('0x10')][_0x5087c5]){this[_0x4e86('0x10')][_0x5087c5][_0x4e86('0x17')][_0x4e86('0x18')]='error';this[_0x4e86('0x10')][_0x5087c5][_0x4e86('0x17')][_0x4e86('0x19')]=_0x51a6ea;return this[_0x4e86('0x13')](_0x5087c5);}};EmailChannel[_0x4e86('0x1d')][_0x4e86('0x37')]=function(_0x4aa66e,_0x15d185){return this['smtp'][_0x4e86('0x38')](_0x4aa66e,_0x15d185);};EmailChannel[_0x4e86('0x1d')]['verifySmtp']=function(_0x5f441e){var _0x1a14af=this;if(this[_0x4e86('0x10')][_0x5f441e['id']]){if(_[_0x4e86('0x1a')](this[_0x4e86('0x10')][_0x5f441e['id']][_0x4e86('0x39')])){this[_0x4e86('0x10')][_0x5f441e['id']][_0x4e86('0x39')]={};}this[_0x4e86('0x10')][_0x5f441e['id']]['Smtp'][_0x4e86('0x36')]=moment();return new BPromise(function(_0x200db7,_0x2cfc19){return _0x1a14af[_0x4e86('0x12')][_0x4e86('0x3a')](_0x5f441e)[_0x4e86('0x33')](function(_0x5ba93a){_0x1a14af[_0x4e86('0x10')][_0x5f441e['id']][_0x4e86('0x39')]['status']=_0x4e86('0x3b');_0x1a14af[_0x4e86('0x10')][_0x5f441e['id']][_0x4e86('0x39')][_0x4e86('0x19')]='';_0x1a14af[_0x4e86('0x13')](_0x5f441e['id']);_0x200db7(_0x5ba93a);})[_0x4e86('0x35')](function(_0x73b77f){_0x1a14af[_0x4e86('0x10')][_0x5f441e['id']][_0x4e86('0x39')][_0x4e86('0x18')]=_0x4e86('0x28');_0x1a14af[_0x4e86('0x10')][_0x5f441e['id']][_0x4e86('0x39')]['messageStatus']=_0x73b77f;_0x1a14af[_0x4e86('0x13')](_0x5f441e['id']);_0x2cfc19(_0x73b77f);});});}return this[_0x4e86('0x12')]['verify'](_0x5f441e);};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 baa68a1..8df9a5b 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 _0xfa5e=['attributes','handleMessageAttributes','handleMessageEnd','emit','textCode','hasOwnProperty','upperFirst','exports','lodash','imap','simpleParser','iconv','Iconv','events','EventEmitter','./utils','../../../config/logger','mailbox','account','handleReady','bind','once','end','handleEnd','error','prototype','getAccount','connTimeout','authTimeout','service','user','generateXOAuth2Token','CloudProvider','data5','password','email','anonymous@xcally.com','host','port','tls','required','openBox','handleOpenBox','handleError','readUnseen','UNSEEN','handleReadUnseen','length','fetch','message','handleFetchMessage','handleFetchEnd','closeBox','handleCloseBox','body','handleMessageBody'];(function(_0x5185d0,_0x12466d){var _0x40ec75=function(_0x5e464d){while(--_0x5e464d){_0x5185d0['push'](_0x5185d0['shift']());}};_0x40ec75(++_0x12466d);}(_0xfa5e,0x78));var _0xefa5=function(_0x1d74de,_0x41ffd4){_0x1d74de=_0x1d74de-0x0;var _0x54808b=_0xfa5e[_0x1d74de];return _0x54808b;};'use strict';var _=require(_0xefa5('0x0'));var util=require('util');var Imap=require(_0xefa5('0x1'));var simpleParser=require('mailparser')[_0xefa5('0x2')];var Iconv=require(_0xefa5('0x3'))[_0xefa5('0x4')];var EventEmitter=require(_0xefa5('0x5'))[_0xefa5('0x6')];var utils=require(_0xefa5('0x7'));var logger=require(_0xefa5('0x8'))('email');function EmailImap(_0x2fbce2,_0x483108){this[_0xefa5('0x9')]=_0x2fbce2[_0xefa5('0x9')];this[_0xefa5('0xa')]=this['getAccount'](_0x2fbce2,_0x483108);this[_0xefa5('0x1')]=new Imap(this[_0xefa5('0xa')]);this[_0xefa5('0x1')]['once']('ready',this[_0xefa5('0xb')][_0xefa5('0xc')](this));this[_0xefa5('0x1')][_0xefa5('0xd')](_0xefa5('0xe'),this[_0xefa5('0xf')]['bind'](this));this[_0xefa5('0x1')]['on'](_0xefa5('0x10'),this['handleError'][_0xefa5('0xc')](this));this['imap']['connect']();}util['inherits'](EmailImap,EventEmitter);EmailImap[_0xefa5('0x11')][_0xefa5('0x12')]=function(_0x2fd4e6,_0x47959b){var _0xb406a7={'connTimeout':_0x2fd4e6[_0xefa5('0x13')]?_0x2fd4e6['connTimeout']*0x3e8:0x2710,'authTimeout':_0x2fd4e6['authTimeout']?_0x2fd4e6[_0xefa5('0x14')]*0x3e8:0x1388};if(_0x2fd4e6[_0xefa5('0x15')]){_0xb406a7['user']=_0x2fd4e6[_0xefa5('0x16')];if(_0x2fd4e6['modernAuthentication']){_0xb406a7['xoauth2']=utils[_0xefa5('0x17')](_0x2fd4e6[_0xefa5('0x18')][_0xefa5('0x19')],_0x2fd4e6[_0xefa5('0x16')]);}else{_0xb406a7[_0xefa5('0x1a')]=_0x2fd4e6['password'];}}else{if(_0x2fd4e6['authentication']){_0xb406a7[_0xefa5('0x16')]=_0x2fd4e6[_0xefa5('0x16')];_0xb406a7[_0xefa5('0x1a')]=_0x2fd4e6['password'];}}_0xb406a7[_0xefa5('0x1b')]=_0x47959b||_0x2fd4e6[_0xefa5('0x16')]||_0xefa5('0x1c');_0xb406a7['host']=_0x2fd4e6[_0xefa5('0x1d')];_0xb406a7[_0xefa5('0x1e')]=_0x2fd4e6['port']||0x3e1;if(_0x2fd4e6[_0xefa5('0x1f')]){_0xb406a7[_0xefa5('0x1f')]=!![];}else{_0xb406a7['tls']=![];_0xb406a7['autotls']=_0xefa5('0x20');}return _0xb406a7;};EmailImap[_0xefa5('0x11')]['handleReady']=function(){this[_0xefa5('0x1')][_0xefa5('0x21')](this[_0xefa5('0x9')],![],this[_0xefa5('0x22')][_0xefa5('0xc')](this));};EmailImap['prototype'][_0xefa5('0x22')]=function(_0x20298e,_0x4514de){if(_0x20298e){this[_0xefa5('0x23')](_0x20298e,!![]);}else{this['emit']('box',_0x4514de);this[_0xefa5('0x24')]();}};EmailImap[_0xefa5('0x11')]['handleCloseBox']=function(_0x178726){if(_0x178726){this[_0xefa5('0x23')](_0x178726,!![]);}else{this[_0xefa5('0x1')]['end']();}};EmailImap[_0xefa5('0x11')][_0xefa5('0x24')]=function(){this['imap']['search']([_0xefa5('0x25')],this[_0xefa5('0x26')][_0xefa5('0xc')](this));};EmailImap[_0xefa5('0x11')][_0xefa5('0x26')]=function(_0x218283,_0x4f4e1c){if(_0x218283){this[_0xefa5('0x23')](_0x218283,!![]);}else{if(_0x4f4e1c[_0xefa5('0x27')]){try{var _0x7aa8c9=this[_0xefa5('0x1')][_0xefa5('0x28')](_0x4f4e1c,{'bodies':'','markSeen':!![]});_0x7aa8c9['on'](_0xefa5('0x29'),this[_0xefa5('0x2a')][_0xefa5('0xc')](this));_0x7aa8c9[_0xefa5('0xd')](_0xefa5('0x10'),this['handleFetchError']['bind'](this));_0x7aa8c9[_0xefa5('0xd')](_0xefa5('0xe'),this[_0xefa5('0x2b')][_0xefa5('0xc')](this));}catch(_0x50e654){logger[_0xefa5('0x10')](_0x50e654);}}else{this['imap'][_0xefa5('0x2c')](!![],this[_0xefa5('0x2d')][_0xefa5('0xc')](this));}}};EmailImap[_0xefa5('0x11')][_0xefa5('0x2a')]=function(_0x48e03d){_0x48e03d['on'](_0xefa5('0x2e'),this[_0xefa5('0x2f')][_0xefa5('0xc')](this));_0x48e03d[_0xefa5('0xd')](_0xefa5('0x30'),this[_0xefa5('0x31')][_0xefa5('0xc')](this));_0x48e03d[_0xefa5('0xd')](_0xefa5('0xe'),this['handleMessageEnd'][_0xefa5('0xc')](this));};EmailImap['prototype'][_0xefa5('0x2f')]=function(_0x23dad7){simpleParser(_0x23dad7,{'Iconv':Iconv},this['handleSimpleParser'][_0xefa5('0xc')](this));};EmailImap['prototype'][_0xefa5('0x31')]=function(){};EmailImap[_0xefa5('0x11')][_0xefa5('0x32')]=function(){};EmailImap[_0xefa5('0x11')]['handleSimpleParser']=function(_0x4d7366,_0x4ba0eb){if(_0x4d7366){logger['error'](_0x4d7366);}else{var _0x1ecb36=this;utils['parser'](this[_0xefa5('0xa')],_0x4ba0eb,function(_0x178cde){_0x1ecb36[_0xefa5('0x33')](_0xefa5('0x1b'),_0x178cde);});}};EmailImap[_0xefa5('0x11')][_0xefa5('0x2b')]=function(){this[_0xefa5('0x1')][_0xefa5('0x2c')](!![],this[_0xefa5('0x2d')][_0xefa5('0xc')](this));};EmailImap['prototype']['handleFetchError']=function(_0x44efaa){this[_0xefa5('0x23')](_0x44efaa);this[_0xefa5('0x1')]['closeBox'](!![],this['handleCloseBox']['bind'](this));};EmailImap[_0xefa5('0x11')][_0xefa5('0xf')]=function(){this[_0xefa5('0x33')](_0xefa5('0xe'));};EmailImap['prototype']['handleError']=function(_0x44f7a7,_0x5b28a4){logger['error'](_0xefa5('0x23'),this[_0xefa5('0xa')][_0xefa5('0x1b')],JSON['stringify'](_0x44f7a7));var _0x10e044='';if(_0x44f7a7){if(_0x44f7a7[_0xefa5('0x34')]){_0x10e044=_0x44f7a7[_0xefa5('0x34')];}else{for(var _0x59ca9e in _0x44f7a7){if(_0x44f7a7[_0xefa5('0x35')](_0x59ca9e)){_0x10e044+=_[_0xefa5('0x36')](_0x59ca9e)+':\x20'+_0x44f7a7[_0x59ca9e]+'\x0a';}}}}if(_0x5b28a4){this[_0xefa5('0x1')]['end']();}else{this[_0xefa5('0x33')](_0xefa5('0x10'),_0x10e044);this[_0xefa5('0x33')](_0xefa5('0xe'));}};module[_0xefa5('0x37')]=EmailImap; \ No newline at end of file +var _0xe248=['handleError','connect','inherits','prototype','connTimeout','authTimeout','service','user','modernAuthentication','xoauth2','CloudProvider','data5','password','authentication','email','host','port','tls','required','openBox','handleOpenBox','emit','readUnseen','handleCloseBox','search','UNSEEN','handleReadUnseen','length','message','handleFetchMessage','once','handleFetchError','body','handleMessageBody','attributes','handleMessageAttributes','handleMessageEnd','handleSimpleParser','account','handleFetchEnd','closeBox','stringify','textCode','exports','lodash','util','imap','simpleParser','iconv','Iconv','events','EventEmitter','../../../config/logger','mailbox','getAccount','ready','handleReady','end','handleEnd','bind','error'];(function(_0x1af63a,_0x215b9d){var _0x6fe0d4=function(_0x410897){while(--_0x410897){_0x1af63a['push'](_0x1af63a['shift']());}};_0x6fe0d4(++_0x215b9d);}(_0xe248,0xa6));var _0x8e24=function(_0x48fd17,_0x2aebec){_0x48fd17=_0x48fd17-0x0;var _0x30f065=_0xe248[_0x48fd17];return _0x30f065;};'use strict';var _=require(_0x8e24('0x0'));var util=require(_0x8e24('0x1'));var Imap=require(_0x8e24('0x2'));var simpleParser=require('mailparser')[_0x8e24('0x3')];var Iconv=require(_0x8e24('0x4'))[_0x8e24('0x5')];var EventEmitter=require(_0x8e24('0x6'))[_0x8e24('0x7')];var utils=require('./utils');var logger=require(_0x8e24('0x8'))('email');function EmailImap(_0x3cc663,_0x3a691c){this[_0x8e24('0x9')]=_0x3cc663[_0x8e24('0x9')];this['account']=this[_0x8e24('0xa')](_0x3cc663,_0x3a691c);this[_0x8e24('0x2')]=new Imap(this['account']);this[_0x8e24('0x2')]['once'](_0x8e24('0xb'),this[_0x8e24('0xc')]['bind'](this));this[_0x8e24('0x2')]['once'](_0x8e24('0xd'),this[_0x8e24('0xe')][_0x8e24('0xf')](this));this[_0x8e24('0x2')]['on'](_0x8e24('0x10'),this[_0x8e24('0x11')][_0x8e24('0xf')](this));this[_0x8e24('0x2')][_0x8e24('0x12')]();}util[_0x8e24('0x13')](EmailImap,EventEmitter);EmailImap[_0x8e24('0x14')][_0x8e24('0xa')]=function(_0x5071cf,_0x8b22e3){var _0x362e80={'connTimeout':_0x5071cf[_0x8e24('0x15')]?_0x5071cf[_0x8e24('0x15')]*0x3e8:0x2710,'authTimeout':_0x5071cf[_0x8e24('0x16')]?_0x5071cf[_0x8e24('0x16')]*0x3e8:0x1388};if(_0x5071cf[_0x8e24('0x17')]){_0x362e80[_0x8e24('0x18')]=_0x5071cf['user'];if(_0x5071cf[_0x8e24('0x19')]){_0x362e80[_0x8e24('0x1a')]=utils['generateXOAuth2Token'](_0x5071cf[_0x8e24('0x1b')][_0x8e24('0x1c')],_0x5071cf['user']);}else{_0x362e80[_0x8e24('0x1d')]=_0x5071cf[_0x8e24('0x1d')];}}else{if(_0x5071cf[_0x8e24('0x1e')]){_0x362e80['user']=_0x5071cf[_0x8e24('0x18')];_0x362e80[_0x8e24('0x1d')]=_0x5071cf[_0x8e24('0x1d')];}}_0x362e80[_0x8e24('0x1f')]=_0x8b22e3||_0x5071cf[_0x8e24('0x18')]||'anonymous@xcally.com';_0x362e80[_0x8e24('0x20')]=_0x5071cf[_0x8e24('0x20')];_0x362e80[_0x8e24('0x21')]=_0x5071cf[_0x8e24('0x21')]||0x3e1;if(_0x5071cf[_0x8e24('0x22')]){_0x362e80['tls']=!![];}else{_0x362e80[_0x8e24('0x22')]=![];_0x362e80['autotls']=_0x8e24('0x23');}return _0x362e80;};EmailImap[_0x8e24('0x14')][_0x8e24('0xc')]=function(){this[_0x8e24('0x2')][_0x8e24('0x24')](this[_0x8e24('0x9')],![],this['handleOpenBox'][_0x8e24('0xf')](this));};EmailImap[_0x8e24('0x14')][_0x8e24('0x25')]=function(_0x68f2ea,_0x17e8f5){if(_0x68f2ea){this[_0x8e24('0x11')](_0x68f2ea,!![]);}else{this[_0x8e24('0x26')]('box',_0x17e8f5);this[_0x8e24('0x27')]();}};EmailImap['prototype'][_0x8e24('0x28')]=function(_0x227fd0){if(_0x227fd0){this[_0x8e24('0x11')](_0x227fd0,!![]);}else{this[_0x8e24('0x2')][_0x8e24('0xd')]();}};EmailImap[_0x8e24('0x14')][_0x8e24('0x27')]=function(){this['imap'][_0x8e24('0x29')]([_0x8e24('0x2a')],this[_0x8e24('0x2b')][_0x8e24('0xf')](this));};EmailImap[_0x8e24('0x14')][_0x8e24('0x2b')]=function(_0x25f92c,_0x3c37eb){if(_0x25f92c){this[_0x8e24('0x11')](_0x25f92c,!![]);}else{if(_0x3c37eb[_0x8e24('0x2c')]){try{var _0x45c0e1=this['imap']['fetch'](_0x3c37eb,{'bodies':'','markSeen':!![]});_0x45c0e1['on'](_0x8e24('0x2d'),this[_0x8e24('0x2e')][_0x8e24('0xf')](this));_0x45c0e1[_0x8e24('0x2f')](_0x8e24('0x10'),this[_0x8e24('0x30')][_0x8e24('0xf')](this));_0x45c0e1[_0x8e24('0x2f')](_0x8e24('0xd'),this['handleFetchEnd'][_0x8e24('0xf')](this));}catch(_0x5da5c0){logger[_0x8e24('0x10')](_0x5da5c0);}}else{this[_0x8e24('0x2')]['closeBox'](!![],this[_0x8e24('0x28')][_0x8e24('0xf')](this));}}};EmailImap[_0x8e24('0x14')][_0x8e24('0x2e')]=function(_0x4d005d){_0x4d005d['on'](_0x8e24('0x31'),this[_0x8e24('0x32')]['bind'](this));_0x4d005d[_0x8e24('0x2f')](_0x8e24('0x33'),this[_0x8e24('0x34')][_0x8e24('0xf')](this));_0x4d005d[_0x8e24('0x2f')](_0x8e24('0xd'),this[_0x8e24('0x35')][_0x8e24('0xf')](this));};EmailImap[_0x8e24('0x14')][_0x8e24('0x32')]=function(_0x37b8be){simpleParser(_0x37b8be,{'Iconv':Iconv},this[_0x8e24('0x36')][_0x8e24('0xf')](this));};EmailImap[_0x8e24('0x14')]['handleMessageAttributes']=function(){};EmailImap['prototype'][_0x8e24('0x35')]=function(){};EmailImap[_0x8e24('0x14')][_0x8e24('0x36')]=function(_0x4ae9c7,_0x54f119){if(_0x4ae9c7){logger[_0x8e24('0x10')](_0x4ae9c7);}else{var _0x31b2bd=this;utils['parser'](this[_0x8e24('0x37')],_0x54f119,function(_0x5408d0){_0x31b2bd[_0x8e24('0x26')]('email',_0x5408d0);});}};EmailImap['prototype'][_0x8e24('0x38')]=function(){this['imap'][_0x8e24('0x39')](!![],this['handleCloseBox'][_0x8e24('0xf')](this));};EmailImap[_0x8e24('0x14')][_0x8e24('0x30')]=function(_0x121463){this[_0x8e24('0x11')](_0x121463);this[_0x8e24('0x2')][_0x8e24('0x39')](!![],this[_0x8e24('0x28')][_0x8e24('0xf')](this));};EmailImap[_0x8e24('0x14')][_0x8e24('0xe')]=function(){this['emit'](_0x8e24('0xd'));};EmailImap['prototype'][_0x8e24('0x11')]=function(_0x468b34,_0x292c1e){logger[_0x8e24('0x10')](_0x8e24('0x11'),this[_0x8e24('0x37')][_0x8e24('0x1f')],JSON[_0x8e24('0x3a')](_0x468b34));var _0x37d9fe='';if(_0x468b34){if(_0x468b34[_0x8e24('0x3b')]){_0x37d9fe=_0x468b34['textCode'];}else{for(var _0x2da41b in _0x468b34){if(_0x468b34['hasOwnProperty'](_0x2da41b)){_0x37d9fe+=_['upperFirst'](_0x2da41b)+':\x20'+_0x468b34[_0x2da41b]+'\x0a';}}}}if(_0x292c1e){this[_0x8e24('0x2')]['end']();}else{this[_0x8e24('0x26')](_0x8e24('0x10'),_0x37d9fe);this[_0x8e24('0x26')](_0x8e24('0xd'));}};module[_0x8e24('0x3c')]=EmailImap; \ No newline at end of file diff --git a/server/services/email/lib/smtp.js b/server/services/email/lib/smtp.js index 705ac57..caef6ab 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 _0x0caf=['toString','Not\x20verifired','exports','nodemailer','nodemailer-plugin-inline-base64','prototype','send','createTransport','use','compile','sendMail','verify'];(function(_0xba0192,_0x36af3a){var _0x17c536=function(_0x443d3a){while(--_0x443d3a){_0xba0192['push'](_0xba0192['shift']());}};_0x17c536(++_0x36af3a);}(_0x0caf,0x1a7));var _0xf0ca=function(_0x264221,_0xfc86ae){_0x264221=_0x264221-0x0;var _0x522aa5=_0x0caf[_0x264221];return _0x522aa5;};'use strict';var nodemailer=require(_0xf0ca('0x0'));var inlineBase64=require(_0xf0ca('0x1'));function EmailSmtp(){}EmailSmtp[_0xf0ca('0x2')][_0xf0ca('0x3')]=function(_0x2916d7,_0x28abac){return new Promise(function(_0x12011f,_0x1ad847){var _0xe81adf=nodemailer[_0xf0ca('0x4')](_0x2916d7);_0xe81adf[_0xf0ca('0x5')](_0xf0ca('0x6'),inlineBase64());_0xe81adf[_0xf0ca('0x7')](_0x28abac,function(_0x588768,_0x311bfb){if(_0x588768){_0x1ad847(_0x588768['toString']());}else{_0x12011f(_0x311bfb);}});});};EmailSmtp[_0xf0ca('0x2')][_0xf0ca('0x8')]=function(_0x4e895a){return new Promise(function(_0x390132,_0x1439a2){var _0x2226e5=nodemailer[_0xf0ca('0x4')](_0x4e895a);_0x2226e5[_0xf0ca('0x8')](function(_0x41c2a6,_0x2639d5){if(_0x41c2a6){_0x1439a2(_0x41c2a6[_0xf0ca('0x9')]());}else{if(_0x2639d5){_0x390132(_0x2639d5);}else{_0x1439a2(_0xf0ca('0xa'));}}});});};module[_0xf0ca('0xb')]=EmailSmtp; \ No newline at end of file +var _0x7983=['compile','sendMail','toString','verify','Not\x20verifired','exports','nodemailer','prototype','createTransport'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0x7983,0x69));var _0x3798=function(_0x1035c1,_0x2d8583){_0x1035c1=_0x1035c1-0x0;var _0x308d67=_0x7983[_0x1035c1];return _0x308d67;};'use strict';var nodemailer=require(_0x3798('0x0'));var inlineBase64=require('nodemailer-plugin-inline-base64');function EmailSmtp(){}EmailSmtp[_0x3798('0x1')]['send']=function(_0x2b3a45,_0x22f0c5){return new Promise(function(_0x396694,_0x42f824){var _0x5841fd=nodemailer[_0x3798('0x2')](_0x2b3a45);_0x5841fd['use'](_0x3798('0x3'),inlineBase64());_0x5841fd[_0x3798('0x4')](_0x22f0c5,function(_0x841ddd,_0x1226ea){if(_0x841ddd){_0x42f824(_0x841ddd[_0x3798('0x5')]());}else{_0x396694(_0x1226ea);}});});};EmailSmtp[_0x3798('0x1')][_0x3798('0x6')]=function(_0x20758f){return new Promise(function(_0x133686,_0xf9e614){var _0xecb4ac=nodemailer['createTransport'](_0x20758f);_0xecb4ac['verify'](function(_0x2b0a8f,_0x1390ee){if(_0x2b0a8f){_0xf9e614(_0x2b0a8f[_0x3798('0x5')]());}else{if(_0x1390ee){_0x133686(_0x1390ee);}else{_0xf9e614(_0x3798('0x7'));}}});});};module[_0x3798('0x8')]=EmailSmtp; \ No newline at end of file diff --git a/server/services/email/lib/utils.js b/server/services/email/lib/utils.js index 9653b80..b5addce 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 _0x3ee3=['Empty\x20message

','Attachments','Title','generateXOAuth2Token','user=','auth=Bearer\x20','utf-8','base64','lodash','moment','randomstring','path','util','node-tnef','../../../config/logger','email','head','value','address','anonymous','generate','@xcally.com','name','substring','indexOf','split','length','join','Anonymous','isEmpty','html','test'];(function(_0x2637ac,_0x377857){var _0x4a5758=function(_0x5d5043){while(--_0x5d5043){_0x2637ac['push'](_0x2637ac['shift']());}};_0x4a5758(++_0x377857);}(_0x3ee3,0x1d9));var _0x33ee=function(_0x3ab9ee,_0x4a74b8){_0x3ab9ee=_0x3ab9ee-0x0;var _0x82ee88=_0x3ee3[_0x3ab9ee];return _0x82ee88;};'use strict';var _=require(_0x33ee('0x0'));var moment=require(_0x33ee('0x1'));var random=require(_0x33ee('0x2'));var fs=require('fs');var path=require(_0x33ee('0x3'));var util=require(_0x33ee('0x4'));var tnef=require(_0x33ee('0x5'));var logger=require(_0x33ee('0x6'))(_0x33ee('0x7'));var config=require('../../../config/environment');function getAddress(_0x4a8622){var _0x2921ab=_[_0x33ee('0x8')](_0x4a8622[_0x33ee('0x9')]);return _0x2921ab&&_0x2921ab[_0x33ee('0xa')]?_0x2921ab[_0x33ee('0xa')]:_0x33ee('0xb')+random[_0x33ee('0xc')](0x6)+_0x33ee('0xd');}function getFirstName(_0x568cae){var _0x213659=_['head'](_0x568cae[_0x33ee('0x9')]);if(_0x213659&&_0x213659['name']){if(_0x213659['name']==_0x213659['address']){return _0x213659[_0x33ee('0xe')][_0x33ee('0xf')](0x0,_0x213659['name'][_0x33ee('0x10')]('@'));}var _0x246989=_0x213659[_0x33ee('0xe')][_0x33ee('0x11')](/\s+/);return _0x246989[_0x33ee('0x12')]>0x1?_0x246989['slice'](0x0,-0x1)[_0x33ee('0x13')]('\x20'):_0x213659[_0x33ee('0xe')];}return _0x33ee('0x14');}function getLastName(_0x4d0cec){var _0x43fb57=_[_0x33ee('0x8')](_0x4d0cec[_0x33ee('0x9')]);if(_0x43fb57&&_0x43fb57[_0x33ee('0xe')]){var _0x757a0=_0x43fb57[_0x33ee('0xe')]['split'](/\s+/);return _0x757a0[_0x33ee('0x12')]>0x1?_0x757a0['pop']():'';}return'';}function getMails(_0x19f993,_0x4e72e9){var _0x2b79d1='';for(var _0x1ef46e=0x0;_0x1ef46e<_0x4e72e9['value'][_0x33ee('0x12')];_0x1ef46e+=0x1){if(_0x4e72e9[_0x33ee('0x9')][_0x1ef46e]['address']!==_0x19f993){if(!_[_0x33ee('0x15')](_0x2b79d1)){_0x2b79d1+=',';}_0x2b79d1+=_0x4e72e9[_0x33ee('0x9')][_0x1ef46e][_0x33ee('0xe')]||_0x4e72e9[_0x33ee('0x9')][_0x1ef46e]['address']||'';_0x2b79d1+='\x20<';_0x2b79d1+=_0x4e72e9[_0x33ee('0x9')][_0x1ef46e][_0x33ee('0xa')]?_0x4e72e9['value'][_0x1ef46e][_0x33ee('0xa')]:_0x33ee('0xb')+random['generate'](0x6)+_0x33ee('0xd');_0x2b79d1+='>';}}return _0x2b79d1;}function parseEmail(_0x13c451,_0xe1ada6,_0x367464){if(_0xe1ada6[_0x33ee('0x16')]){var _0x557496=/)<[^<]*)*<\/script>/gi;while(_0x557496[_0x33ee('0x17')](_0xe1ada6[_0x33ee('0x16')])){_0xe1ada6['html']=_0xe1ada6[_0x33ee('0x16')]['replace'](_0x557496,'');}if(_0xe1ada6[_0x33ee('0x16')]['includes'](_0x33ee('0x18'))){var _0xdc0db1=[];_0xe1ada6[_0x33ee('0x19')][_0x33ee('0x1a')](_0x327b81=>{_0xdc0db1[_0x33ee('0x1b')](_0x327b81[_0x33ee('0x1c')]);});var _0x31fd90=/]+>/g;var _0x53371e=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0xa43b9c=_0xe1ada6[_0x33ee('0x16')][_0x33ee('0x1d')](_0x53371e,_0x33ee('0x1e'));var _0x4008f7=_0xa43b9c[_0x33ee('0x1d')](_0x31fd90,_0x33ee('0x1f'));for(let _0x54ee59=0x0;_0x54ee59<_0xdc0db1[_0x33ee('0x12')];_0x54ee59++){var _0x44e965=_0x4008f7[_0x33ee('0x1d')](_0x33ee('0x1f'),'\x20[Attachment:\x20'+_0xdc0db1[_0x54ee59]+'\x20]');_0x4008f7=_0x44e965;}_0xe1ada6[_0x33ee('0x16')]=_0x4008f7;}_0x367464['body']=_0xe1ada6[_0x33ee('0x16')];}else{_0x367464[_0x33ee('0x20')]=_0xe1ada6[_0x33ee('0x21')];}if(_0x367464[_0x33ee('0x20')]){_0x367464[_0x33ee('0x20')]=_0x367464[_0x33ee('0x20')][_0x33ee('0x1d')](/0x0){var _0x228069=[_0x33ee('0x32'),_0x33ee('0x33'),_0x33ee('0x34')];for(var _0x5571f6=0x0;_0x5571f6<_0xe1ada6[_0x33ee('0x31')][_0x33ee('0x12')];_0x5571f6++){var _0x2258b0=_[_0x33ee('0x10')](_0x228069,_0xe1ada6[_0x33ee('0x31')][_0x5571f6][_0x33ee('0x35')]);if(_0x2258b0>=0x0){_0x367464[_0x33ee('0x36')]=!![];}}}return _0x367464;}exports['parser']=function(_0x5e4ec6,_0x4a526f,_0x1903ca){var _0x22585a={'from':getAddress(_0x4a526f[_0x33ee('0x37')]),'firstName':getFirstName(_0x4a526f[_0x33ee('0x37')]),'lastName':getLastName(_0x4a526f['from']),'mapKey':_0x33ee('0x7'),'message':{'from':getMails(_0x5e4ec6[_0x33ee('0x7')],_0x4a526f[_0x33ee('0x37')]),'to':_0x5e4ec6[_0x33ee('0x7')],'cc':'','subject':_0x4a526f['subject']||'','messageId':_0x4a526f[_0x33ee('0x38')],'inReplyTo':_0x4a526f[_0x33ee('0x39')],'sentAt':moment(_0x4a526f['date'])[_0x33ee('0x2b')](_0x33ee('0x3a')),'attach':![],'attachments':[]}};if(!_0x4a526f[_0x33ee('0x16')]&&!_0x4a526f[_0x33ee('0x21')]){var _0x1359e7=_['filter'](_0x4a526f[_0x33ee('0x19')],{'contentType':_0x33ee('0x3b')});if(_0x1359e7[_0x33ee('0x12')]){logger['info'](util['format'](_0x33ee('0x3c'),_0x4a526f[_0x33ee('0x38')]));tnef[_0x33ee('0x3d')](_[_0x33ee('0x3e')](_0x1359e7)[_0x33ee('0x2f')],function(_0x1b3f39,_0x328538){if(_0x328538){_0x4a526f[_0x33ee('0x16')]=_0x328538['BodyHTML']||_0x33ee('0x3f');if(_0x328538[_0x33ee('0x40')]){for(var _0x29388a=0x0;_0x29388a<_0x328538[_0x33ee('0x40')][_0x33ee('0x12')];_0x29388a++){var _0x188f4e=_0x328538[_0x33ee('0x40')][_0x29388a];_0x22585a[_0x33ee('0x23')][_0x33ee('0x19')][_0x33ee('0x1b')]({'filename':_0x188f4e[_0x33ee('0x41')],'content':Buffer['from'](_0x188f4e['Data'])});}}}_0x1903ca(parseEmail(_0x5e4ec6,_0x4a526f,_0x22585a));});}else{_0x4a526f[_0x33ee('0x16')]=_0x33ee('0x3f');_0x1903ca(parseEmail(_0x5e4ec6,_0x4a526f,_0x22585a));}}else{_0x1903ca(parseEmail(_0x5e4ec6,_0x4a526f,_0x22585a));}};exports[_0x33ee('0x42')]=function(_0x1bb4ce,_0x3dad22){var _0x4dbcd3=[_0x33ee('0x43')+(_0x3dad22||''),_0x33ee('0x44')+_0x1bb4ce,'',''];return Buffer['from'](_0x4dbcd3[_0x33ee('0x13')](''),_0x33ee('0x45'))['toString'](_0x33ee('0x46'));}; \ No newline at end of file +var _0x5f8b=['moment','randomstring','node-tnef','../../../config/logger','email','../../../config/environment','head','value','address','anonymous','generate','name','substring','indexOf','split','length','pop','isEmpty','html','test','replace','includes','','body','textAsHtml','Empty\x20message

','Attachments','Data','generateXOAuth2Token','auth=Bearer\x20','utf-8','toString','lodash'];(function(_0x130828,_0x5b07a0){var _0x31d18c=function(_0x4b9235){while(--_0x4b9235){_0x130828['push'](_0x130828['shift']());}};_0x31d18c(++_0x5b07a0);}(_0x5f8b,0x1e9));var _0xb5f8=function(_0x46e363,_0x45d7e2){_0x46e363=_0x46e363-0x0;var _0x3fb059=_0x5f8b[_0x46e363];return _0x3fb059;};'use strict';var _=require(_0xb5f8('0x0'));var moment=require(_0xb5f8('0x1'));var random=require(_0xb5f8('0x2'));var fs=require('fs');var path=require('path');var util=require('util');var tnef=require(_0xb5f8('0x3'));var logger=require(_0xb5f8('0x4'))(_0xb5f8('0x5'));var config=require(_0xb5f8('0x6'));function getAddress(_0x1d5793){var _0x96cffb=_[_0xb5f8('0x7')](_0x1d5793[_0xb5f8('0x8')]);return _0x96cffb&&_0x96cffb[_0xb5f8('0x9')]?_0x96cffb[_0xb5f8('0x9')]:_0xb5f8('0xa')+random[_0xb5f8('0xb')](0x6)+'@xcally.com';}function getFirstName(_0x4fda40){var _0x805ee1=_[_0xb5f8('0x7')](_0x4fda40[_0xb5f8('0x8')]);if(_0x805ee1&&_0x805ee1[_0xb5f8('0xc')]){if(_0x805ee1[_0xb5f8('0xc')]==_0x805ee1[_0xb5f8('0x9')]){return _0x805ee1[_0xb5f8('0xc')][_0xb5f8('0xd')](0x0,_0x805ee1['name'][_0xb5f8('0xe')]('@'));}var _0xb4adfc=_0x805ee1[_0xb5f8('0xc')][_0xb5f8('0xf')](/\s+/);return _0xb4adfc[_0xb5f8('0x10')]>0x1?_0xb4adfc['slice'](0x0,-0x1)['join']('\x20'):_0x805ee1[_0xb5f8('0xc')];}return'Anonymous';}function getLastName(_0x5837d7){var _0x4dc9ba=_[_0xb5f8('0x7')](_0x5837d7['value']);if(_0x4dc9ba&&_0x4dc9ba[_0xb5f8('0xc')]){var _0x445629=_0x4dc9ba[_0xb5f8('0xc')]['split'](/\s+/);return _0x445629[_0xb5f8('0x10')]>0x1?_0x445629[_0xb5f8('0x11')]():'';}return'';}function getMails(_0x54b60d,_0x485676){var _0x469850='';for(var _0x2bccf6=0x0;_0x2bccf6<_0x485676['value'][_0xb5f8('0x10')];_0x2bccf6+=0x1){if(_0x485676[_0xb5f8('0x8')][_0x2bccf6][_0xb5f8('0x9')]!==_0x54b60d){if(!_[_0xb5f8('0x12')](_0x469850)){_0x469850+=',';}_0x469850+=_0x485676[_0xb5f8('0x8')][_0x2bccf6][_0xb5f8('0xc')]||_0x485676['value'][_0x2bccf6][_0xb5f8('0x9')]||'';_0x469850+='\x20<';_0x469850+=_0x485676[_0xb5f8('0x8')][_0x2bccf6][_0xb5f8('0x9')]?_0x485676[_0xb5f8('0x8')][_0x2bccf6][_0xb5f8('0x9')]:'anonymous'+random['generate'](0x6)+'@xcally.com';_0x469850+='>';}}return _0x469850;}function parseEmail(_0xf3b32a,_0x4bc08d,_0x5e7bf9){if(_0x4bc08d[_0xb5f8('0x13')]){var _0x54f708=/)<[^<]*)*<\/script>/gi;while(_0x54f708[_0xb5f8('0x14')](_0x4bc08d[_0xb5f8('0x13')])){_0x4bc08d[_0xb5f8('0x13')]=_0x4bc08d['html'][_0xb5f8('0x15')](_0x54f708,'');}if(_0x4bc08d[_0xb5f8('0x13')][_0xb5f8('0x16')](_0xb5f8('0x17'))){var _0x39677e=[];_0x4bc08d[_0xb5f8('0x18')]['forEach'](_0x4d06f2=>{_0x39677e[_0xb5f8('0x19')](_0x4d06f2[_0xb5f8('0x1a')]);});var _0x2e106f=/]+>/g;var _0x92efb=/src="data:image\/([a-zA-Z]*);base64,([^"]*)"/g;var _0x4ec257=_0x4bc08d[_0xb5f8('0x13')][_0xb5f8('0x15')](_0x92efb,'_SRC');var _0x34c674=_0x4ec257[_0xb5f8('0x15')](_0x2e106f,'_IMG');for(let _0x15669a=0x0;_0x15669a<_0x39677e[_0xb5f8('0x10')];_0x15669a++){var _0x5b8cec=_0x34c674[_0xb5f8('0x15')](_0xb5f8('0x1b'),'\x20[Attachment:\x20'+_0x39677e[_0x15669a]+_0xb5f8('0x1c'));_0x34c674=_0x5b8cec;}_0x4bc08d[_0xb5f8('0x13')]=_0x34c674;}_0x5e7bf9[_0xb5f8('0x1d')]=_0x4bc08d['html'];}else{_0x5e7bf9[_0xb5f8('0x1d')]=_0x4bc08d[_0xb5f8('0x1e')];}if(_0x5e7bf9['body']){_0x5e7bf9['body']=_0x5e7bf9['body'][_0xb5f8('0x15')](/0x0){var _0x2e922a=[_0xb5f8('0x2f'),_0xb5f8('0x30'),_0xb5f8('0x31')];for(var _0x346223=0x0;_0x346223<_0x4bc08d[_0xb5f8('0x2e')]['length'];_0x346223++){var _0xae8ee8=_['indexOf'](_0x2e922a,_0x4bc08d[_0xb5f8('0x2e')][_0x346223]['line']);if(_0xae8ee8>=0x0){_0x5e7bf9[_0xb5f8('0x32')]=!![];}}}return _0x5e7bf9;}exports['parser']=function(_0x44df87,_0x3e3b72,_0x22f582){var _0x3df3fc={'from':getAddress(_0x3e3b72['from']),'firstName':getFirstName(_0x3e3b72[_0xb5f8('0x33')]),'lastName':getLastName(_0x3e3b72['from']),'mapKey':_0xb5f8('0x5'),'message':{'from':getMails(_0x44df87[_0xb5f8('0x5')],_0x3e3b72['from']),'to':_0x44df87[_0xb5f8('0x5')],'cc':'','subject':_0x3e3b72[_0xb5f8('0x34')]||'','messageId':_0x3e3b72[_0xb5f8('0x35')],'inReplyTo':_0x3e3b72['inReplyTo'],'sentAt':moment(_0x3e3b72[_0xb5f8('0x36')])[_0xb5f8('0x27')](_0xb5f8('0x37')),'attach':![],'attachments':[]}};if(!_0x3e3b72[_0xb5f8('0x13')]&&!_0x3e3b72['textAsHtml']){var _0x374f71=_[_0xb5f8('0x38')](_0x3e3b72[_0xb5f8('0x18')],{'contentType':_0xb5f8('0x39')});if(_0x374f71[_0xb5f8('0x10')]){logger[_0xb5f8('0x3a')](util['format'](_0xb5f8('0x3b'),_0x3e3b72['messageId']));tnef[_0xb5f8('0x3c')](_[_0xb5f8('0x3d')](_0x374f71)[_0xb5f8('0x2c')],function(_0x46fbff,_0x22b9ab){if(_0x22b9ab){_0x3e3b72[_0xb5f8('0x13')]=_0x22b9ab[_0xb5f8('0x3e')]||_0xb5f8('0x3f');if(_0x22b9ab[_0xb5f8('0x40')]){for(var _0x4aa5f7=0x0;_0x4aa5f7<_0x22b9ab[_0xb5f8('0x40')][_0xb5f8('0x10')];_0x4aa5f7++){var _0x5bd194=_0x22b9ab[_0xb5f8('0x40')][_0x4aa5f7];_0x3df3fc[_0xb5f8('0x20')][_0xb5f8('0x18')][_0xb5f8('0x19')]({'filename':_0x5bd194['Title'],'content':Buffer[_0xb5f8('0x33')](_0x5bd194[_0xb5f8('0x41')])});}}}_0x22f582(parseEmail(_0x44df87,_0x3e3b72,_0x3df3fc));});}else{_0x3e3b72[_0xb5f8('0x13')]=_0xb5f8('0x3f');_0x22f582(parseEmail(_0x44df87,_0x3e3b72,_0x3df3fc));}}else{_0x22f582(parseEmail(_0x44df87,_0x3e3b72,_0x3df3fc));}};exports[_0xb5f8('0x42')]=function(_0x50bdbf,_0x296ef0){var _0x5014d9=['user='+(_0x296ef0||''),_0xb5f8('0x43')+_0x50bdbf,'',''];return Buffer['from'](_0x5014d9[_0xb5f8('0x29')](''),_0xb5f8('0x44'))[_0xb5f8('0x45')]('base64');}; \ No newline at end of file diff --git a/server/services/email/model/mailAccount.js b/server/services/email/model/mailAccount.js index 203e8aa..a468cd2 100644 --- a/server/services/email/model/mailAccount.js +++ b/server/services/email/model/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x93a8=['Smtp','name','Service','key','SERV','active','Imap'];(function(_0x1dd83b,_0xb402d){var _0x2bc75f=function(_0x547b4d){while(--_0x547b4d){_0x1dd83b['push'](_0x1dd83b['shift']());}};_0x2bc75f(++_0xb402d);}(_0x93a8,0x6a));var _0x893a=function(_0x21181a,_0x2641d1){_0x21181a=_0x21181a-0x0;var _0x380d95=_0x93a8[_0x21181a];return _0x380d95;};'use strict';var _=require('lodash');function MailAccount(_0x29933b){this['id']=_0x29933b['id']||0x0;this[_0x893a('0x0')]=_0x29933b['name']||_0x893a('0x1');this[_0x893a('0x2')]=_0x29933b[_0x893a('0x2')]||_0x893a('0x3');this[_0x893a('0x4')]=_0x29933b[_0x893a('0x4')]||![];this['Imap']=_0x29933b[_0x893a('0x5')]||[];this[_0x893a('0x6')]=_0x29933b[_0x893a('0x6')]||[];}module['exports']=MailAccount; \ No newline at end of file +var _0x64e4=['lodash','name','Service','key','SERV','active','Imap','exports'];(function(_0x33c79f,_0x227fc8){var _0x2481db=function(_0x49cd28){while(--_0x49cd28){_0x33c79f['push'](_0x33c79f['shift']());}};_0x2481db(++_0x227fc8);}(_0x64e4,0x108));var _0x464e=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x64e4[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x464e('0x0'));function MailAccount(_0x63046c){this['id']=_0x63046c['id']||0x0;this[_0x464e('0x1')]=_0x63046c['name']||_0x464e('0x2');this[_0x464e('0x3')]=_0x63046c[_0x464e('0x3')]||_0x464e('0x4');this['active']=_0x63046c[_0x464e('0x5')]||![];this[_0x464e('0x6')]=_0x63046c[_0x464e('0x6')]||[];this['Smtp']=_0x63046c['Smtp']||[];}module[_0x464e('0x7')]=MailAccount; \ No newline at end of file diff --git a/server/services/email/realtime/index.js b/server/services/email/realtime/index.js index 02e0928..588ba53 100644 --- a/server/services/email/realtime/index.js +++ b/server/services/email/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x303d=['prototype','initMailAccounts','length','isUndefined','merge','exports','../model/mailAccount','mailAccounts','hasOwnProperty'];(function(_0x2ddcef,_0x580d38){var _0x4de05c=function(_0x5ee8dc){while(--_0x5ee8dc){_0x2ddcef['push'](_0x2ddcef['shift']());}};_0x4de05c(++_0x580d38);}(_0x303d,0xe7));var _0xd303=function(_0x5c33d4,_0x3621db){_0x5c33d4=_0x5c33d4-0x0;var _0x76150=_0x303d[_0x5c33d4];return _0x76150;};'use strict';var _=require('lodash');var MailAccount=require(_0xd303('0x0'));var Realtime=function(){this[_0xd303('0x1')]={};};function freeIsNotKey(_0x56fb64,_0x151ef2,_0x586a13){var _0x5983fe=_['mapKeys'](_0x56fb64,function(_0x39d699,_0x599a10){return _0x39d699[_0x586a13];});for(var _0x50d7ec in _0x151ef2){if(_0x151ef2['hasOwnProperty'](_0x50d7ec)){if(!_0x5983fe[_0x50d7ec]){delete _0x151ef2[_0x50d7ec];}}}}Realtime['prototype']['mergeFromDatabase']=function(_0x4030fa,_0x33ba6a){for(var _0x40d40d in _0x33ba6a){if(_0x4030fa[_0xd303('0x2')](_0x40d40d)){_0x4030fa[_0x40d40d]=_0x33ba6a[_0x40d40d];}}};Realtime[_0xd303('0x3')][_0xd303('0x4')]=function(){var _0x43cd3e=this;return function(_0x26b58c){if(_0x26b58c){freeIsNotKey(_0x26b58c,_0x43cd3e[_0xd303('0x1')],'id');for(var _0x825632=0x0,_0x52fa1d={},_0x539e36={};_0x825632<_0x26b58c[_0xd303('0x5')];_0x825632+=0x1){_0x52fa1d=_0x26b58c[_0x825632];if(_[_0xd303('0x6')](_0x43cd3e[_0xd303('0x1')][_0x52fa1d['id']])){_0x43cd3e[_0xd303('0x1')][_0x52fa1d['id']]=new MailAccount(_0x52fa1d);}else{_[_0xd303('0x7')](_0x43cd3e[_0xd303('0x1')][_0x52fa1d['id']],_0x52fa1d);}}}return _0x43cd3e['mailAccounts'];};};module[_0xd303('0x8')]=Realtime; \ No newline at end of file +var _0x0c80=['hasOwnProperty','prototype','initMailAccounts','length','isUndefined','exports','lodash','../model/mailAccount','mailAccounts'];(function(_0x397e5f,_0x454c8f){var _0x5302b8=function(_0x1a29ef){while(--_0x1a29ef){_0x397e5f['push'](_0x397e5f['shift']());}};_0x5302b8(++_0x454c8f);}(_0x0c80,0x192));var _0x00c8=function(_0x5c2e3e,_0x26ecd3){_0x5c2e3e=_0x5c2e3e-0x0;var _0x53f64a=_0x0c80[_0x5c2e3e];return _0x53f64a;};'use strict';var _=require(_0x00c8('0x0'));var MailAccount=require(_0x00c8('0x1'));var Realtime=function(){this[_0x00c8('0x2')]={};};function freeIsNotKey(_0x1979eb,_0x304d98,_0x599273){var _0x2da273=_['mapKeys'](_0x1979eb,function(_0x51ec00,_0x30d7a4){return _0x51ec00[_0x599273];});for(var _0x6f7744 in _0x304d98){if(_0x304d98[_0x00c8('0x3')](_0x6f7744)){if(!_0x2da273[_0x6f7744]){delete _0x304d98[_0x6f7744];}}}}Realtime[_0x00c8('0x4')]['mergeFromDatabase']=function(_0x22f3ce,_0x1eef6d){for(var _0xb81b16 in _0x1eef6d){if(_0x22f3ce[_0x00c8('0x3')](_0xb81b16)){_0x22f3ce[_0xb81b16]=_0x1eef6d[_0xb81b16];}}};Realtime[_0x00c8('0x4')][_0x00c8('0x5')]=function(){var _0x1c6792=this;return function(_0x84bf53){if(_0x84bf53){freeIsNotKey(_0x84bf53,_0x1c6792['mailAccounts'],'id');for(var _0x5d5aa1=0x0,_0x45e6e6={},_0x484c01={};_0x5d5aa1<_0x84bf53[_0x00c8('0x6')];_0x5d5aa1+=0x1){_0x45e6e6=_0x84bf53[_0x5d5aa1];if(_[_0x00c8('0x7')](_0x1c6792[_0x00c8('0x2')][_0x45e6e6['id']])){_0x1c6792['mailAccounts'][_0x45e6e6['id']]=new MailAccount(_0x45e6e6);}else{_['merge'](_0x1c6792['mailAccounts'][_0x45e6e6['id']],_0x45e6e6);}}}return _0x1c6792[_0x00c8('0x2')];};};module[_0x00c8('0x8')]=Realtime; \ No newline at end of file diff --git a/server/services/email/rpc/mailAccount.js b/server/services/email/rpc/mailAccount.js index 1893890..60444bb 100644 --- a/server/services/email/rpc/mailAccount.js +++ b/server/services/email/rpc/mailAccount.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5e9c=['service','data5','MailServerOut','type','notify','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','provider','email','active','TemplateId','Imap','CloudProvider','name'];(function(_0xd1d19a,_0x1933f0){var _0x52a79d=function(_0x5199e2){while(--_0x5199e2){_0xd1d19a['push'](_0xd1d19a['shift']());}};_0x52a79d(++_0x1933f0);}(_0x5e9c,0x17c));var _0xc5e9=function(_0x586541,_0x29ed35){_0x586541=_0x586541-0x0;var _0x521dd3=_0x5e9c[_0x586541];return _0x521dd3;};'use strict';var client=require(_0xc5e9('0x0'));exports[_0xc5e9('0x1')]=function(){return function(){return client[_0xc5e9('0x2')](_0xc5e9('0x3'),{'options':{'attributes':['id','name',_0xc5e9('0x4'),'service',_0xc5e9('0x5'),_0xc5e9('0x6'),'key','ListId',_0xc5e9('0x7')],'raw':![],'include':[{'model':'MailServerIn','as':_0xc5e9('0x8'),'include':[{'model':_0xc5e9('0x9'),'attributes':['id',_0xc5e9('0xa'),_0xc5e9('0xb'),'type',_0xc5e9('0xc')],'as':_0xc5e9('0x9')}]},{'model':_0xc5e9('0xd'),'as':'Smtp','include':[{'model':_0xc5e9('0x9'),'attributes':['id',_0xc5e9('0xa'),_0xc5e9('0xb'),_0xc5e9('0xe'),_0xc5e9('0xc')],'as':'CloudProvider'}]}]},'log':'getMailAccount'});};};exports[_0xc5e9('0xf')]=function(_0x10f00e,_0x47cbf1){return client['Request'](_0xc5e9('0x10'),{'account':{'id':_0x10f00e},'body':_0x47cbf1,'log':_0xc5e9('0x10')});}; \ No newline at end of file +var _0xffb1=['CloudProvider','type','MailServerOut','Smtp','data5','getMailAccount','NotifyMailAccount','../client','getMailAccounts','Request','GetMailAccount','name','provider','service','email','active','key','TemplateId','MailServerIn','Imap'];(function(_0x4ccf7f,_0x161ffd){var _0x1953f0=function(_0xfd2ca6){while(--_0xfd2ca6){_0x4ccf7f['push'](_0x4ccf7f['shift']());}};_0x1953f0(++_0x161ffd);}(_0xffb1,0x93));var _0x1ffb=function(_0x39bc44,_0x1d4373){_0x39bc44=_0x39bc44-0x0;var _0x2916d8=_0xffb1[_0x39bc44];return _0x2916d8;};'use strict';var client=require(_0x1ffb('0x0'));exports[_0x1ffb('0x1')]=function(){return function(){return client[_0x1ffb('0x2')](_0x1ffb('0x3'),{'options':{'attributes':['id',_0x1ffb('0x4'),_0x1ffb('0x5'),_0x1ffb('0x6'),_0x1ffb('0x7'),_0x1ffb('0x8'),_0x1ffb('0x9'),'ListId',_0x1ffb('0xa')],'raw':![],'include':[{'model':_0x1ffb('0xb'),'as':_0x1ffb('0xc'),'include':[{'model':_0x1ffb('0xd'),'attributes':['id',_0x1ffb('0x4'),'service',_0x1ffb('0xe'),'data5'],'as':'CloudProvider'}]},{'model':_0x1ffb('0xf'),'as':_0x1ffb('0x10'),'include':[{'model':_0x1ffb('0xd'),'attributes':['id','name','service',_0x1ffb('0xe'),_0x1ffb('0x11')],'as':'CloudProvider'}]}]},'log':_0x1ffb('0x12')});};};exports['notify']=function(_0x16f439,_0x218c3f){return client[_0x1ffb('0x2')](_0x1ffb('0x13'),{'account':{'id':_0x16f439},'body':_0x218c3f,'log':_0x1ffb('0x13')});}; \ No newline at end of file diff --git a/server/services/email/rpc/setting.js b/server/services/email/rpc/setting.js index db9c6f4..8dfb321 100644 --- a/server/services/email/rpc/setting.js +++ b/server/services/email/rpc/setting.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8456=['../client','ShowSetting','loginMailFrequency','GetSettings'];(function(_0x4e3f2f,_0x530b38){var _0x1c9d7a=function(_0x2c08f5){while(--_0x2c08f5){_0x4e3f2f['push'](_0x4e3f2f['shift']());}};_0x1c9d7a(++_0x530b38);}(_0x8456,0x12c));var _0x6845=function(_0x546492,_0x5ad15c){_0x546492=_0x546492-0x0;var _0xdfb683=_0x8456[_0x546492];return _0xdfb683;};'use strict';var client=require(_0x6845('0x0'));exports['getSettings']=function(){return client['Request'](_0x6845('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':[_0x6845('0x2')]},'log':_0x6845('0x3')});}; \ No newline at end of file +var _0xdda2=['ShowSetting','GetSettings','Request'];(function(_0x420b24,_0x382adc){var _0x4da552=function(_0x4e1623){while(--_0x4e1623){_0x420b24['push'](_0x420b24['shift']());}};_0x4da552(++_0x382adc);}(_0xdda2,0x71));var _0x2dda=function(_0x5b280c,_0x59d250){_0x5b280c=_0x5b280c-0x0;var _0x1ef525=_0xdda2[_0x5b280c];return _0x1ef525;};'use strict';var client=require('../client');exports['getSettings']=function(){return client[_0x2dda('0x0')](_0x2dda('0x1'),{'options':{'raw':!![],'where':{'id':0x1},'attributes':['loginMailFrequency']},'log':_0x2dda('0x2')});}; \ No newline at end of file diff --git a/server/services/email/server/index.js b/server/services/email/server/index.js index ce01d3a..c828a0d 100644 --- a/server/services/email/server/index.js +++ b/server/services/email/server/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x122ef9,_0x451d2a){var _0x42fba0=function(_0x17c9d3){while(--_0x17c9d3){_0x122ef9['push'](_0x122ef9['shift']());}};_0x42fba0(++_0x451d2a);}(_0xa9e0,0x123));var _0x0a9e=function(_0x4cf98e,_0xba4b79){_0x4cf98e=_0x4cf98e-0x0;var _0x1623ac=_0xa9e0[_0x4cf98e];return _0x1623ac;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file +var _0xa9e0=['catch','values','mailAccounts','length','Imap','password','Smtp','pass','server','http','stringify','127.0.0.1','log','Email\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','jayson/promise','bluebird','lodash','listen','sendMail','then','error','Verified'];(function(_0x4a9fb1,_0x273043){var _0x348672=function(_0x142b69){while(--_0x142b69){_0x4a9fb1['push'](_0x4a9fb1['shift']());}};_0x348672(++_0x273043);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var jayson=require(_0x0a9e('0x0'));var BPromise=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var logger=require('../../../config/logger')('email');exports[_0x0a9e('0x3')]=function(_0x4ce2f1,_0x333808){return new BPromise(function(_0x432180,_0x2ab90b){var _0x991246={'SendMail':function(_0x981158){var _0x57b080=this;return new Promise(function(_0x219af0,_0x441e3a){_0x333808[_0x0a9e('0x4')](_0x981158['account'],_0x981158['message'])[_0x0a9e('0x5')](function(_0x56465b){_0x219af0({'code':0xc8,'message':_0x56465b});})['catch'](function(_0x39753a){_0x441e3a(_0x57b080[_0x0a9e('0x6')](0x1f4,_0x39753a));});});},'VerifySmtp':function(_0x307b3e){var _0x3ab53f=this;return new Promise(function(_0xfeb75b,_0xbd1168){_0x333808['verifySmtp'](_0x307b3e['account'])['then'](function(_0x4cfe67){_0xfeb75b({'code':0xc8,'message':_0x0a9e('0x7')});})[_0x0a9e('0x8')](function(_0xd5b662){_0xbd1168(_0x3ab53f[_0x0a9e('0x6')](0x1f4,_0xd5b662));});});},'MailAccounts':function(_0x32d742){return new Promise(function(_0x69aeb7,_0x5db4b0){var _0x4283ce=_[_0x0a9e('0x9')](_0x4ce2f1[_0x0a9e('0xa')]);for(var _0x281129=0x0;_0x281129<_0x4283ce[_0x0a9e('0xb')];_0x281129+=0x1){if(_0x4283ce[_0x281129][_0x0a9e('0xc')]&&_0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')]){delete _0x4283ce[_0x281129]['Imap'][_0x0a9e('0xd')];}if(_0x4283ce[_0x281129]['Smtp']&&_0x4283ce[_0x281129][_0x0a9e('0xe')][_0x0a9e('0xf')]){delete _0x4283ce[_0x281129]['Smtp'][_0x0a9e('0xf')];}}_0x69aeb7({'count':_0x4283ce['length'],'rows':_0x4283ce});});}};var _0x459eb1=jayson[_0x0a9e('0x10')](_0x991246)[_0x0a9e('0x11')]();_0x459eb1['on'](_0x0a9e('0x6'),function(_0x31b1ca){logger[_0x0a9e('0x6')](JSON[_0x0a9e('0x12')](_0x31b1ca));return _0x2ab90b(_0x31b1ca);});_0x459eb1[_0x0a9e('0x3')](0x232b,_0x0a9e('0x13'),function(){console[_0x0a9e('0x14')](_0x0a9e('0x15'),0x232b);return _0x432180(_0x0a9e('0x16')+0x232b);});});}; \ No newline at end of file diff --git a/server/services/express/index.js b/server/services/express/index.js index 5f7c120..5a58046 100644 --- a/server/services/express/index.js +++ b/server/services/express/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5280=['listen','port','socket.io','websocket','redis','localhost','adapter','socket.io-redis','../../config/triggers','default','once','listening','log','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','ioredis','../../config/environment','createServer'];(function(_0x244b6a,_0x57c79c){var _0x29f866=function(_0x448ff8){while(--_0x448ff8){_0x244b6a['push'](_0x244b6a['shift']());}};_0x29f866(++_0x57c79c);}(_0x5280,0x1c7));var _0x0528=function(_0x41ecfc,_0x54f670){_0x41ecfc=_0x41ecfc-0x0;var _0x4cdc47=_0x5280[_0x41ecfc];return _0x4cdc47;};'use strict';var _=require(_0x0528('0x0'));var http=require(_0x0528('0x1'));var express=require('express');var sticky=require('sticky-session');var Redis=require(_0x0528('0x2'));var config=require(_0x0528('0x3'));var app=express();var server=http[_0x0528('0x4')](app);server['timeout']=0xdbba0;if(sticky[_0x0528('0x5')](server,config[_0x0528('0x6')])){var socketio=require(_0x0528('0x7'))(server,{'transports':[_0x0528('0x8'),'polling']});config[_0x0528('0x9')]=_['defaults'](config[_0x0528('0x9')],{'host':_0x0528('0xa'),'port':0x18eb});socketio[_0x0528('0xb')](require(_0x0528('0xc'))({'pubClient':new Redis(config['redis']),'subClient':new Redis(config[_0x0528('0x9')])}));require(_0x0528('0xd'))['default']();require('../../config/socketio')['default'](socketio);require('../../config/express')[_0x0528('0xe')](app);require('../../routes')[_0x0528('0xe')](app);}else{server[_0x0528('0xf')](_0x0528('0x10'),function(){console[_0x0528('0x11')](_0x0528('0x12'),config[_0x0528('0x6')]);});}exports=module[_0x0528('0x13')]=app; \ No newline at end of file +var _0xb744=['defaults','localhost','adapter','../../config/triggers','default','../../config/express','../../routes','once','listening','Express\x20server\x20listening\x20on\x20port\x20%d!','exports','lodash','http','express','sticky-session','ioredis','../../config/environment','createServer','timeout','listen','port','polling','redis'];(function(_0x14add3,_0x13ce8d){var _0x4a174f=function(_0x2b3ed7){while(--_0x2b3ed7){_0x14add3['push'](_0x14add3['shift']());}};_0x4a174f(++_0x13ce8d);}(_0xb744,0x95));var _0x4b74=function(_0x39b17c,_0x23d4e0){_0x39b17c=_0x39b17c-0x0;var _0x323a3a=_0xb744[_0x39b17c];return _0x323a3a;};'use strict';var _=require(_0x4b74('0x0'));var http=require(_0x4b74('0x1'));var express=require(_0x4b74('0x2'));var sticky=require(_0x4b74('0x3'));var Redis=require(_0x4b74('0x4'));var config=require(_0x4b74('0x5'));var app=express();var server=http[_0x4b74('0x6')](app);server[_0x4b74('0x7')]=0xdbba0;if(sticky[_0x4b74('0x8')](server,config[_0x4b74('0x9')])){var socketio=require('socket.io')(server,{'transports':['websocket',_0x4b74('0xa')]});config[_0x4b74('0xb')]=_[_0x4b74('0xc')](config['redis'],{'host':_0x4b74('0xd'),'port':0x18eb});socketio[_0x4b74('0xe')](require('socket.io-redis')({'pubClient':new Redis(config[_0x4b74('0xb')]),'subClient':new Redis(config['redis'])}));require(_0x4b74('0xf'))[_0x4b74('0x10')]();require('../../config/socketio')[_0x4b74('0x10')](socketio);require(_0x4b74('0x11'))[_0x4b74('0x10')](app);require(_0x4b74('0x12'))['default'](app);}else{server[_0x4b74('0x13')](_0x4b74('0x14'),function(){console['log'](_0x4b74('0x15'),config['port']);});}exports=module[_0x4b74('0x16')]=app; \ No newline at end of file diff --git a/server/services/routing/client.js b/server/services/routing/client.js index d1dbc68..26116db 100644 --- a/server/services/routing/client.js +++ b/server/services/routing/client.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x5440=['exports','jayson/promise','../../config/logger','routing','then','debug','error','rpc','message','result','catch'];(function(_0x1a6462,_0x1087e2){var _0x11565e=function(_0x1a62f4){while(--_0x1a62f4){_0x1a6462['push'](_0x1a6462['shift']());}};_0x11565e(++_0x1087e2);}(_0x5440,0x109));var _0x0544=function(_0x1b32f8,_0x49a419){_0x1b32f8=_0x1b32f8-0x0;var _0x5f5137=_0x5440[_0x1b32f8];return _0x5f5137;};'use strict';var jayson=require(_0x0544('0x0'));var BPromise=require('bluebird');var logger=require(_0x0544('0x1'))(_0x0544('0x2'));var client=jayson['client']['http']({'port':0x2329});client['Request']=function(_0x57062b,_0x1472ed){return new BPromise(function(_0x1e44f6,_0x30ce7b){return client['request'](_0x57062b,_0x1472ed)[_0x0544('0x3')](function(_0x6a0840){logger[_0x0544('0x4')]('rpc',_0x0544('0x2'),_0x57062b,_0x1472ed,_0x6a0840);if(_0x6a0840[_0x0544('0x5')]){logger[_0x0544('0x5')](_0x0544('0x6'),_0x0544('0x2'),_0x57062b,_0x6a0840[_0x0544('0x5')][_0x0544('0x7')],_0x1472ed);return _0x30ce7b(_0x6a0840[_0x0544('0x5')][_0x0544('0x7')]);}else{return _0x1e44f6(_0x6a0840[_0x0544('0x8')]);}})[_0x0544('0x9')](function(_0x2f64ae){logger['error'](_0x0544('0x6'),'routing',_0x57062b,_0x2f64ae,_0x1472ed);return _0x30ce7b(_0x2f64ae);});});};module[_0x0544('0xa')]=client; \ No newline at end of file +var _0x2777=['error','message','exports','jayson/promise','bluebird','routing','client','http','request','debug','rpc'];(function(_0x5f4e11,_0x331015){var _0x306a38=function(_0x24e18f){while(--_0x24e18f){_0x5f4e11['push'](_0x5f4e11['shift']());}};_0x306a38(++_0x331015);}(_0x2777,0x18f));var _0x7277=function(_0x4e018b,_0x4be682){_0x4e018b=_0x4e018b-0x0;var _0x87ec9d=_0x2777[_0x4e018b];return _0x87ec9d;};'use strict';var jayson=require(_0x7277('0x0'));var BPromise=require(_0x7277('0x1'));var logger=require('../../config/logger')(_0x7277('0x2'));var client=jayson[_0x7277('0x3')][_0x7277('0x4')]({'port':0x2329});client['Request']=function(_0x49d8ac,_0xec425f){return new BPromise(function(_0x4dd8da,_0x490243){return client[_0x7277('0x5')](_0x49d8ac,_0xec425f)['then'](function(_0x2d355a){logger[_0x7277('0x6')](_0x7277('0x7'),_0x7277('0x2'),_0x49d8ac,_0xec425f,_0x2d355a);if(_0x2d355a[_0x7277('0x8')]){logger[_0x7277('0x8')]('rpc',_0x7277('0x2'),_0x49d8ac,_0x2d355a['error']['message'],_0xec425f);return _0x490243(_0x2d355a[_0x7277('0x8')][_0x7277('0x9')]);}else{return _0x4dd8da(_0x2d355a['result']);}})['catch'](function(_0x13bb72){logger['error'](_0x7277('0x7'),_0x7277('0x2'),_0x49d8ac,_0x13bb72,_0xec425f);return _0x490243(_0x13bb72);});});};module[_0x7277('0xa')]=client; \ No newline at end of file diff --git a/server/services/routing/index.js b/server/services/routing/index.js index 094a992..972e5b2 100644 --- a/server/services/routing/index.js +++ b/server/services/routing/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x72f6=['./rpc/faxQueue','resolve','initAgents','then','initIntervals','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initChatQueues','getSmsQueues','getMailQueues','getFaxQueues','initFaxQueues','getWhatsappQueues','listen','catch','log','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/smsQueue'];(function(_0x1d60b3,_0x65a805){var _0x2c5d8c=function(_0x4a252f){while(--_0x4a252f){_0x1d60b3['push'](_0x1d60b3['shift']());}};_0x2c5d8c(++_0x65a805);}(_0x72f6,0x125));var _0x672f=function(_0x153e29,_0x14b328){_0x153e29=_0x153e29-0x0;var _0x1efb66=_0x72f6[_0x153e29];return _0x1efb66;};'use strict';var BPromise=require('bluebird');var server=require(_0x672f('0x0'));var Realtime=require(_0x672f('0x1'));var user=require(_0x672f('0x2'));var interval=require(_0x672f('0x3'));var openchannelQueue=require(_0x672f('0x4'));var chatQueue=require('./rpc/chatQueue');var smsQueue=require(_0x672f('0x5'));var mailQueue=require('./rpc/mailQueue');var faxQueue=require(_0x672f('0x6'));var whatsappQueue=require('./rpc/whatsappQueue');var realtime=new Realtime();function initRealtime(){return BPromise[_0x672f('0x7')]()['then'](user['getAgents']())['then'](realtime[_0x672f('0x8')]())[_0x672f('0x9')](interval['getIntervals']())[_0x672f('0x9')](realtime[_0x672f('0xa')]())[_0x672f('0x9')](openchannelQueue[_0x672f('0xb')]())[_0x672f('0x9')](realtime[_0x672f('0xc')]())['then'](chatQueue[_0x672f('0xd')]())[_0x672f('0x9')](realtime[_0x672f('0xe')]())['then'](smsQueue[_0x672f('0xf')]())['then'](realtime['initSmsQueues']())[_0x672f('0x9')](mailQueue[_0x672f('0x10')]())[_0x672f('0x9')](realtime['initMailQueues']())[_0x672f('0x9')](faxQueue[_0x672f('0x11')]())[_0x672f('0x9')](realtime[_0x672f('0x12')]())[_0x672f('0x9')](whatsappQueue[_0x672f('0x13')]())[_0x672f('0x9')](realtime['initWhatsappQueues']())['then'](function(){return realtime;});}function main(){return server[_0x672f('0x14')](realtime)[_0x672f('0x9')](function(_0x2971f5){return initRealtime();})[_0x672f('0x9')](function(_0x142ef6){return setInterval(initRealtime,0x1388);})[_0x672f('0x15')](function(_0x355517){console[_0x672f('0x16')](_0x355517);});}main(); \ No newline at end of file +var _0x8cb6=['initAgents','getOpenchannelQueues','initOpenchannelQueues','getChatQueues','initSmsQueues','getMailQueues','initMailQueues','getFaxQueues','initFaxQueues','initWhatsappQueues','catch','bluebird','./server','./realtime','./rpc/user','./rpc/interval','./rpc/openchannelQueue','./rpc/chatQueue','./rpc/smsQueue','./rpc/mailQueue','./rpc/faxQueue','./rpc/whatsappQueue','resolve','then','getAgents'];(function(_0x51dfdb,_0x1ed48d){var _0x16b83f=function(_0x4f7d0f){while(--_0x4f7d0f){_0x51dfdb['push'](_0x51dfdb['shift']());}};_0x16b83f(++_0x1ed48d);}(_0x8cb6,0x11e));var _0x68cb=function(_0x12ad1b,_0x106d01){_0x12ad1b=_0x12ad1b-0x0;var _0x22efbb=_0x8cb6[_0x12ad1b];return _0x22efbb;};'use strict';var BPromise=require(_0x68cb('0x0'));var server=require(_0x68cb('0x1'));var Realtime=require(_0x68cb('0x2'));var user=require(_0x68cb('0x3'));var interval=require(_0x68cb('0x4'));var openchannelQueue=require(_0x68cb('0x5'));var chatQueue=require(_0x68cb('0x6'));var smsQueue=require(_0x68cb('0x7'));var mailQueue=require(_0x68cb('0x8'));var faxQueue=require(_0x68cb('0x9'));var whatsappQueue=require(_0x68cb('0xa'));var realtime=new Realtime();function initRealtime(){return BPromise[_0x68cb('0xb')]()[_0x68cb('0xc')](user[_0x68cb('0xd')]())['then'](realtime[_0x68cb('0xe')]())[_0x68cb('0xc')](interval['getIntervals']())[_0x68cb('0xc')](realtime['initIntervals']())[_0x68cb('0xc')](openchannelQueue[_0x68cb('0xf')]())[_0x68cb('0xc')](realtime[_0x68cb('0x10')]())[_0x68cb('0xc')](chatQueue[_0x68cb('0x11')]())['then'](realtime['initChatQueues']())[_0x68cb('0xc')](smsQueue['getSmsQueues']())[_0x68cb('0xc')](realtime[_0x68cb('0x12')]())['then'](mailQueue[_0x68cb('0x13')]())[_0x68cb('0xc')](realtime[_0x68cb('0x14')]())['then'](faxQueue[_0x68cb('0x15')]())['then'](realtime[_0x68cb('0x16')]())[_0x68cb('0xc')](whatsappQueue['getWhatsappQueues']())[_0x68cb('0xc')](realtime[_0x68cb('0x17')]())[_0x68cb('0xc')](function(){return realtime;});}function main(){return server['listen'](realtime)[_0x68cb('0xc')](function(_0xb11fba){return initRealtime();})[_0x68cb('0xc')](function(_0x5f5449){return setInterval(initRealtime,0x1388);})[_0x68cb('0x18')](function(_0x3b9ca8){console['log'](_0x3b9ca8);});}main(); \ No newline at end of file diff --git a/server/services/routing/lib/rule-engine.js b/server/services/routing/lib/rule-engine.js index b9ecf1c..aa55b45 100644 --- a/server/services/routing/lib/rule-engine.js +++ b/server/services/routing/lib/rule-engine.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x326f=['orderBy','asc','result','clone','consequence','nextTick','push','isEqual','condition','call','matchPath','noop','matches','filter','turn','length','prioritize','findRules','priority','toJSON','map','toString','fromJSON','isString','lodash','EventEmitter','init','isNil','register','ignoreFactChanges','inherits','prototype','rules','activeRules','concat','isObject','sync'];(function(_0x5f3f88,_0x562baf){var _0xd08119=function(_0x42dbf7){while(--_0x42dbf7){_0x5f3f88['push'](_0x5f3f88['shift']());}};_0xd08119(++_0x562baf);}(_0x326f,0xd1));var _0xf326=function(_0xc24bb5,_0x535253){_0xc24bb5=_0xc24bb5-0x0;var _0x5f0ca2=_0x326f[_0xc24bb5];return _0x5f0ca2;};'use strict';var _=require(_0xf326('0x0'));var util=require('util');var EventEmitter=require('events')[_0xf326('0x1')];function RuleEngine(_0x330ddb,_0x22aabf){this[_0xf326('0x2')]();if(!_[_0xf326('0x3')](_0x330ddb)){this[_0xf326('0x4')](_0x330ddb);}if(_0x22aabf){this[_0xf326('0x5')]=_0x22aabf[_0xf326('0x5')];}return this;}util[_0xf326('0x6')](RuleEngine,EventEmitter);RuleEngine[_0xf326('0x7')]['init']=function(_0x3c254d){this[_0xf326('0x8')]=[];this[_0xf326('0x9')]=[];};RuleEngine[_0xf326('0x7')]['register']=function(_0x4c206c){if(Array['isArray'](_0x4c206c)){this[_0xf326('0x8')]=this[_0xf326('0x8')][_0xf326('0xa')](_0x4c206c);}else if(_0x4c206c!==null&&_[_0xf326('0xb')](_0x4c206c)){this[_0xf326('0x8')]['push'](_0x4c206c);}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0xc')]=function(){this['activeRules']=this[_0xf326('0x8')]['filter'](function(_0x3162f9){if(_[_0xf326('0x3')](_0x3162f9['on'])){_0x3162f9['on']=!![];}if(_0x3162f9['on']===!![]){return _0x3162f9;}});this['activeRules']=_[_0xf326('0xd')](this[_0xf326('0x9')],['p'],[_0xf326('0xe')]);};RuleEngine[_0xf326('0x7')]['execute']=function(_0x45c1b6,_0x5204ee){var _0x54bd1a=![];_0x45c1b6[_0xf326('0xf')]=!![];var _0x11f6d2=_[_0xf326('0x10')](_0x45c1b6);var _0xa63d1a=_[_0xf326('0x10')](_0x45c1b6);var _0x287a2a=this[_0xf326('0x9')];var _0x2cf2ca=[];var _0x5a682a=this[_0xf326('0x5')];(function FnRuleLoop(_0x453100){var _0x18bee3={'rules':function(){return _0x287a2a;},'rule':function(){return _0x287a2a[_0x453100];},'when':function(_0x31ffb9){if(_0x31ffb9){var _0xcef2b5=_0x287a2a[_0x453100][_0xf326('0x11')];_0xcef2b5['ruleRef']=_0x287a2a[_0x453100]['id']||_0x287a2a[_0x453100]['name']||'index_'+_0x453100;process[_0xf326('0x12')](function(){_0x2cf2ca[_0xf326('0x13')](_0xcef2b5['ruleRef']);_0xcef2b5['call'](_0x11f6d2,_0x18bee3);});}else{process[_0xf326('0x12')](function(){_0x18bee3['next']();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x54bd1a=!![];return FnRuleLoop(0x0);},'next':function(_0x5b6d3c){if(!_0x5a682a&&!_[_0xf326('0x14')](_0xa63d1a,_0x11f6d2)){_0xa63d1a=_[_0xf326('0x10')](_0x11f6d2);process['nextTick'](function(){_0x18bee3['restart']();});}else{process[_0xf326('0x12')](function(){if(_[_0xf326('0x3')](_0x5b6d3c)){return FnRuleLoop(_0x453100+0x1);}else{return FnRuleLoop(_0x5b6d3c);}});}}};if(_0x453100<_0x287a2a['length']&&_0x54bd1a===![]){var _0x337ed5=_0x287a2a[_0x453100][_0xf326('0x15')];_0x337ed5[_0xf326('0x16')](_0x11f6d2,_0x18bee3);}else{process[_0xf326('0x12')](function(){_0x11f6d2[_0xf326('0x17')]=_0x2cf2ca;return _0x5204ee?_0x5204ee(_0x11f6d2):_[_0xf326('0x18')]();});}}(0x0));};RuleEngine['prototype']['findRules']=function(_0x4f31f6){if(_[_0xf326('0x3')](_0x4f31f6)){return this[_0xf326('0x8')];}else{var _0x2cd45a=_[_0xf326('0x19')](_0x4f31f6);return _[_0xf326('0x1a')](this[_0xf326('0x8')],_0x2cd45a);}};RuleEngine['prototype'][_0xf326('0x1b')]=function(_0xa3c0b,_0x212d5d){var _0x581531=_0xa3c0b==='on'||_0xa3c0b==='ON'?!![]:![];var _0x1617d2=this['findRules'](_0x212d5d);for(var _0x4a9abf=0x0,_0x6a8e89=_0x1617d2[_0xf326('0x1c')];_0x4a9abf<_0x6a8e89;_0x4a9abf+=0x1){_0x1617d2[_0x4a9abf]['on']=_0x581531;}this[_0xf326('0xc')]();};RuleEngine['prototype'][_0xf326('0x1d')]=function(_0x292500,_0x55790d){_0x292500=parseInt(_0x292500,0xa);var _0x225776=this[_0xf326('0x1e')](_0x55790d);for(var _0xd77aba=0x0,_0x18d110=_0x225776[_0xf326('0x1c')];_0xd77aba<_0x18d110;_0xd77aba+=0x1){_0x225776[_0xd77aba][_0xf326('0x1f')]=_0x292500;}this[_0xf326('0xc')]();};RuleEngine[_0xf326('0x7')][_0xf326('0x20')]=function(){var _0x349a03=this['rules'];if(_0x349a03 instanceof Array){_0x349a03=_0x349a03[_0xf326('0x21')](function(_0x424104){_0x424104[_0xf326('0x15')]=_0x424104['condition'][_0xf326('0x22')]();_0x424104[_0xf326('0x11')]=_0x424104[_0xf326('0x11')]['toString']();return _0x424104;});}else if(!_['isNil'](_0x349a03)){_0x349a03[_0xf326('0x15')]=_0x349a03[_0xf326('0x15')][_0xf326('0x22')]();_0x349a03[_0xf326('0x11')]=_0x349a03[_0xf326('0x11')][_0xf326('0x22')]();}return _0x349a03;};RuleEngine[_0xf326('0x7')][_0xf326('0x23')]=function(_0x580374){this[_0xf326('0x2')]();if(_[_0xf326('0x24')](_0x580374)){_0x580374=JSON['parse'](_0x580374);}if(_0x580374 instanceof Array){_0x580374=_0x580374[_0xf326('0x21')](function(_0x4e5d7c){_0x4e5d7c[_0xf326('0x15')]=eval('('+_0x4e5d7c['condition']+')');_0x4e5d7c['consequence']=eval('('+_0x4e5d7c[_0xf326('0x11')]+')');return _0x4e5d7c;});}else if(_0x580374!==null&&typeof _0x580374=='object'){_0x580374[_0xf326('0x15')]=eval('('+_0x580374['condition']+')');_0x580374[_0xf326('0x11')]=eval('('+_0x580374[_0xf326('0x11')]+')');}this[_0xf326('0x4')](_0x580374);};module['exports']=RuleEngine; \ No newline at end of file +var _0xc4aa=['ruleRef','name','nextTick','push','call','next','isEqual','restart','isNil','length','condition','matchPath','noop','findRules','matches','turn','prioritize','priority','toJSON','toString','fromJSON','isString','parse','register','exports','lodash','util','events','EventEmitter','ignoreFactChanges','inherits','prototype','init','rules','activeRules','isArray','concat','isObject','sync','filter','orderBy','asc','execute','result','clone','consequence'];(function(_0x5e9cd0,_0x487767){var _0x9bf8b1=function(_0x3ad497){while(--_0x3ad497){_0x5e9cd0['push'](_0x5e9cd0['shift']());}};_0x9bf8b1(++_0x487767);}(_0xc4aa,0x1b7));var _0xac4a=function(_0x45d55e,_0x2fede3){_0x45d55e=_0x45d55e-0x0;var _0x29812a=_0xc4aa[_0x45d55e];return _0x29812a;};'use strict';var _=require(_0xac4a('0x0'));var util=require(_0xac4a('0x1'));var EventEmitter=require(_0xac4a('0x2'))[_0xac4a('0x3')];function RuleEngine(_0x275161,_0x22469d){this['init']();if(!_['isNil'](_0x275161)){this['register'](_0x275161);}if(_0x22469d){this[_0xac4a('0x4')]=_0x22469d[_0xac4a('0x4')];}return this;}util[_0xac4a('0x5')](RuleEngine,EventEmitter);RuleEngine[_0xac4a('0x6')][_0xac4a('0x7')]=function(_0x15cd34){this[_0xac4a('0x8')]=[];this[_0xac4a('0x9')]=[];};RuleEngine['prototype']['register']=function(_0x1aba6d){if(Array[_0xac4a('0xa')](_0x1aba6d)){this[_0xac4a('0x8')]=this['rules'][_0xac4a('0xb')](_0x1aba6d);}else if(_0x1aba6d!==null&&_[_0xac4a('0xc')](_0x1aba6d)){this[_0xac4a('0x8')]['push'](_0x1aba6d);}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0xd')]=function(){this['activeRules']=this[_0xac4a('0x8')][_0xac4a('0xe')](function(_0x24291d){if(_['isNil'](_0x24291d['on'])){_0x24291d['on']=!![];}if(_0x24291d['on']===!![]){return _0x24291d;}});this[_0xac4a('0x9')]=_[_0xac4a('0xf')](this[_0xac4a('0x9')],['p'],[_0xac4a('0x10')]);};RuleEngine[_0xac4a('0x6')][_0xac4a('0x11')]=function(_0x34bc01,_0x33c287){var _0x190418=![];_0x34bc01[_0xac4a('0x12')]=!![];var _0x11e101=_[_0xac4a('0x13')](_0x34bc01);var _0x4a2119=_[_0xac4a('0x13')](_0x34bc01);var _0x34d797=this[_0xac4a('0x9')];var _0x144553=[];var _0x3e88e3=this[_0xac4a('0x4')];(function FnRuleLoop(_0x28e304){var _0x44ec59={'rules':function(){return _0x34d797;},'rule':function(){return _0x34d797[_0x28e304];},'when':function(_0x546c5d){if(_0x546c5d){var _0x5ac21e=_0x34d797[_0x28e304][_0xac4a('0x14')];_0x5ac21e[_0xac4a('0x15')]=_0x34d797[_0x28e304]['id']||_0x34d797[_0x28e304][_0xac4a('0x16')]||'index_'+_0x28e304;process[_0xac4a('0x17')](function(){_0x144553[_0xac4a('0x18')](_0x5ac21e[_0xac4a('0x15')]);_0x5ac21e[_0xac4a('0x19')](_0x11e101,_0x44ec59);});}else{process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1a')]();});}},'restart':function(){return FnRuleLoop(0x0);},'stop':function(){_0x190418=!![];return FnRuleLoop(0x0);},'next':function(_0xe38996){if(!_0x3e88e3&&!_[_0xac4a('0x1b')](_0x4a2119,_0x11e101)){_0x4a2119=_['clone'](_0x11e101);process[_0xac4a('0x17')](function(){_0x44ec59[_0xac4a('0x1c')]();});}else{process['nextTick'](function(){if(_[_0xac4a('0x1d')](_0xe38996)){return FnRuleLoop(_0x28e304+0x1);}else{return FnRuleLoop(_0xe38996);}});}}};if(_0x28e304<_0x34d797[_0xac4a('0x1e')]&&_0x190418===![]){var _0x3eacd3=_0x34d797[_0x28e304][_0xac4a('0x1f')];_0x3eacd3['call'](_0x11e101,_0x44ec59);}else{process[_0xac4a('0x17')](function(){_0x11e101[_0xac4a('0x20')]=_0x144553;return _0x33c287?_0x33c287(_0x11e101):_[_0xac4a('0x21')]();});}}(0x0));};RuleEngine[_0xac4a('0x6')][_0xac4a('0x22')]=function(_0x2b0dc2){if(_[_0xac4a('0x1d')](_0x2b0dc2)){return this[_0xac4a('0x8')];}else{var _0x3e2c69=_[_0xac4a('0x23')](_0x2b0dc2);return _[_0xac4a('0xe')](this[_0xac4a('0x8')],_0x3e2c69);}};RuleEngine[_0xac4a('0x6')][_0xac4a('0x24')]=function(_0x1c13dc,_0x20202c){var _0x4e17ce=_0x1c13dc==='on'||_0x1c13dc==='ON'?!![]:![];var _0x23b061=this[_0xac4a('0x22')](_0x20202c);for(var _0x42a33c=0x0,_0x2772fe=_0x23b061[_0xac4a('0x1e')];_0x42a33c<_0x2772fe;_0x42a33c+=0x1){_0x23b061[_0x42a33c]['on']=_0x4e17ce;}this['sync']();};RuleEngine['prototype'][_0xac4a('0x25')]=function(_0x7a948b,_0x1f12d5){_0x7a948b=parseInt(_0x7a948b,0xa);var _0x546b65=this['findRules'](_0x1f12d5);for(var _0x355755=0x0,_0x2896bc=_0x546b65[_0xac4a('0x1e')];_0x355755<_0x2896bc;_0x355755+=0x1){_0x546b65[_0x355755][_0xac4a('0x26')]=_0x7a948b;}this[_0xac4a('0xd')]();};RuleEngine['prototype'][_0xac4a('0x27')]=function(){var _0x482afc=this[_0xac4a('0x8')];if(_0x482afc instanceof Array){_0x482afc=_0x482afc['map'](function(_0x17e6de){_0x17e6de[_0xac4a('0x1f')]=_0x17e6de[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x17e6de[_0xac4a('0x14')]=_0x17e6de[_0xac4a('0x14')][_0xac4a('0x28')]();return _0x17e6de;});}else if(!_[_0xac4a('0x1d')](_0x482afc)){_0x482afc[_0xac4a('0x1f')]=_0x482afc[_0xac4a('0x1f')][_0xac4a('0x28')]();_0x482afc[_0xac4a('0x14')]=_0x482afc[_0xac4a('0x14')][_0xac4a('0x28')]();}return _0x482afc;};RuleEngine['prototype'][_0xac4a('0x29')]=function(_0x1c41fb){this['init']();if(_[_0xac4a('0x2a')](_0x1c41fb)){_0x1c41fb=JSON[_0xac4a('0x2b')](_0x1c41fb);}if(_0x1c41fb instanceof Array){_0x1c41fb=_0x1c41fb['map'](function(_0x58804b){_0x58804b[_0xac4a('0x1f')]=eval('('+_0x58804b[_0xac4a('0x1f')]+')');_0x58804b[_0xac4a('0x14')]=eval('('+_0x58804b[_0xac4a('0x14')]+')');return _0x58804b;});}else if(_0x1c41fb!==null&&typeof _0x1c41fb=='object'){_0x1c41fb[_0xac4a('0x1f')]=eval('('+_0x1c41fb[_0xac4a('0x1f')]+')');_0x1c41fb['consequence']=eval('('+_0x1c41fb[_0xac4a('0x14')]+')');}this[_0xac4a('0x2c')](_0x1c41fb);};module[_0xac4a('0x2d')]=RuleEngine; \ No newline at end of file diff --git a/server/services/routing/mailRpc/index.js b/server/services/routing/mailRpc/index.js index be3bd84..801da57 100644 --- a/server/services/routing/mailRpc/index.js +++ b/server/services/routing/mailRpc/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xacc9=['result','sendMailMessage','SendMail','bluebird','jayson/promise','http','request','error'];(function(_0x3fda68,_0x47e67e){var _0x2a2ff4=function(_0x155525){while(--_0x155525){_0x3fda68['push'](_0x3fda68['shift']());}};_0x2a2ff4(++_0x47e67e);}(_0xacc9,0x163));var _0x9acc=function(_0x3844ae,_0x2de1f7){_0x3844ae=_0x3844ae-0x0;var _0x4b6d1e=_0xacc9[_0x3844ae];return _0x4b6d1e;};'use strict';var BPromise=require(_0x9acc('0x0'));var jayson=require(_0x9acc('0x1'));var client=jayson['client'][_0x9acc('0x2')]({'port':0x232b});function request(_0x47c5d1,_0x54a3b7){return new BPromise(function(_0x2eff3d,_0x2c0789){return client[_0x9acc('0x3')](_0x47c5d1,_0x54a3b7)['then'](function(_0x475cbf){if(_0x475cbf[_0x9acc('0x4')]){return _0x2c0789(_0x475cbf[_0x9acc('0x4')]['message']);}else{return _0x2eff3d(_0x475cbf[_0x9acc('0x5')]);}})['catch'](function(_0x435e1d){return _0x2c0789(_0x435e1d);});});}exports[_0x9acc('0x6')]=function(_0x2c2f79,_0x3ebf6b){return request(_0x9acc('0x7'),{'account':_0x2c2f79,'message':_0x3ebf6b});}; \ No newline at end of file +var _0x28a0=['http','then','error','message','result','catch','sendMailMessage','SendMail','bluebird','jayson/promise','client'];(function(_0x53940d,_0x190d7f){var _0x31d7de=function(_0xb60d90){while(--_0xb60d90){_0x53940d['push'](_0x53940d['shift']());}};_0x31d7de(++_0x190d7f);}(_0x28a0,0x105));var _0x028a=function(_0x2b4411,_0x2625ed){_0x2b4411=_0x2b4411-0x0;var _0x8e41ef=_0x28a0[_0x2b4411];return _0x8e41ef;};'use strict';var BPromise=require(_0x028a('0x0'));var jayson=require(_0x028a('0x1'));var client=jayson[_0x028a('0x2')][_0x028a('0x3')]({'port':0x232b});function request(_0x266088,_0x4c2443){return new BPromise(function(_0x57bcb6,_0x2f6367){return client['request'](_0x266088,_0x4c2443)[_0x028a('0x4')](function(_0x14c904){if(_0x14c904[_0x028a('0x5')]){return _0x2f6367(_0x14c904[_0x028a('0x5')][_0x028a('0x6')]);}else{return _0x57bcb6(_0x14c904[_0x028a('0x7')]);}})[_0x028a('0x8')](function(_0x107337){return _0x2f6367(_0x107337);});});}exports[_0x028a('0x9')]=function(_0x2627c7,_0x4da686){return request(_0x028a('0xa'),{'account':_0x2627c7,'message':_0x4da686});}; \ No newline at end of file diff --git a/server/services/routing/model/agent.js b/server/services/routing/model/agent.js index ccf0d70..d0d23ef 100644 --- a/server/services/routing/model/agent.js +++ b/server/services/routing/model/agent.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x56fc=['busy','busyQueue','chatWaitingInteractions','faxWaitingInteractions','mailWaitingInteractions','smsWaitingInteractions','whatsappWaitingInteractions','updateRealtime','prototype','getChannelStatus','CurrentCapacity','Capacity','working','idle','chat','openchannel','fax','sms','length','Status','StatusTime','toNumber','format','smsPause','faxStatus','smsStatusTime','smsCapacity','whatsappStatus','openchannelStatusTime','openchannelWaitingInteractions','stringify','emit','exports','moment','md5','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','online','voicePause','chatPause','mailPause','faxPause','openchannelPause','chatStatus','unknown','chatStatusTime','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsCurrentCapacity','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelCapacity'];(function(_0x35cf6b,_0x13de33){var _0xf92309=function(_0x3dbea7){while(--_0x3dbea7){_0x35cf6b['push'](_0x35cf6b['shift']());}};_0xf92309(++_0x13de33);}(_0x56fc,0xe7));var _0xc56f=function(_0x5c351c,_0x2046d8){_0x5c351c=_0x5c351c-0x0;var _0x26f3b3=_0x56fc[_0x5c351c];return _0x26f3b3;};'use strict';var _=require('lodash');var moment=require(_0xc56f('0x0'));var md5=require(_0xc56f('0x1'));var Redis=require(_0xc56f('0x2'));var config=require(_0xc56f('0x3'));config[_0xc56f('0x4')]=_[_0xc56f('0x5')](config[_0xc56f('0x4')],{'host':_0xc56f('0x6'),'port':0x18eb});var io=require(_0xc56f('0x7'))(new Redis(config[_0xc56f('0x4')]));function Agent(_0x52f897){this['id']=_0x52f897['id']||0x0;this[_0xc56f('0x8')]=_0x52f897[_0xc56f('0x8')]||'';this[_0xc56f('0x9')]=_0x52f897['online']||!![];this[_0xc56f('0xa')]=_0x52f897[_0xc56f('0xa')]||![];this[_0xc56f('0xb')]=_0x52f897[_0xc56f('0xb')]||![];this['mailPause']=_0x52f897[_0xc56f('0xc')]||![];this[_0xc56f('0xd')]=_0x52f897['faxPause']||![];this['smsPause']=_0x52f897['smsPause']||![];this[_0xc56f('0xe')]=_0x52f897['openchannelPause']||![];this[_0xc56f('0xf')]=_0xc56f('0x10');this[_0xc56f('0x11')]=0x0;this[_0xc56f('0x12')]=_0x52f897[_0xc56f('0x12')]||0x0;this[_0xc56f('0x13')]=0x0;this[_0xc56f('0x14')]='unknown';this[_0xc56f('0x15')]=0x0;this[_0xc56f('0x16')]=_0x52f897['mailCapacity']||0x0;this['mailCurrentCapacity']=0x0;this['faxStatus']='unknown';this[_0xc56f('0x17')]=0x0;this[_0xc56f('0x18')]=_0x52f897[_0xc56f('0x18')]||0x0;this[_0xc56f('0x19')]=0x0;this[_0xc56f('0x1a')]='unknown';this['smsStatusTime']=0x0;this['smsCapacity']=_0x52f897['smsCapacity']||0x0;this[_0xc56f('0x1b')]=0x0;this['whatsappStatus']=_0xc56f('0x10');this[_0xc56f('0x1c')]=0x0;this[_0xc56f('0x1d')]=_0x52f897[_0xc56f('0x1d')]||0x0;this[_0xc56f('0x1e')]=0x0;this[_0xc56f('0x1f')]='unknown';this['openchannelStatusTime']=0x0;this[_0xc56f('0x20')]=_0x52f897['openchannelCapacity']||0x0;this['openchannelCurrentCapacity']=0x0;this[_0xc56f('0x21')]=![];this[_0xc56f('0x22')]=undefined;this[_0xc56f('0x1')]='';this[_0xc56f('0x23')]={};this[_0xc56f('0x24')]={};this[_0xc56f('0x25')]={};this['openchannelWaitingInteractions']={};this[_0xc56f('0x26')]={};this[_0xc56f('0x27')]={};this[_0xc56f('0x28')]();}Agent[_0xc56f('0x29')][_0xc56f('0x2a')]=function(_0x5be21c){if(this[_0x5be21c+_0xc56f('0x2b')]>0x0){if(this[_0x5be21c+_0xc56f('0x2c')]>0x0&&this[_0x5be21c+_0xc56f('0x2b')]>=this[_0x5be21c+_0xc56f('0x2c')]){return'maxcapacity';}else{return _0xc56f('0x2d');}}else{return _0xc56f('0x2e');}};Agent[_0xc56f('0x29')]['updateRealtime']=function(){var _0x381fd3=['mail',_0xc56f('0x2f'),_0xc56f('0x30'),_0xc56f('0x31'),_0xc56f('0x32'),'whatsapp'];for(var _0x230f00=0x0;_0x230f00<_0x381fd3[_0xc56f('0x33')];_0x230f00+=0x1){var _0x3bed5c=this[_0xc56f('0x2a')](_0x381fd3[_0x230f00]);if(this[_0x381fd3[_0x230f00]+_0xc56f('0x34')]!==_0x3bed5c){this[_0x381fd3[_0x230f00]+_0xc56f('0x35')]=_[_0xc56f('0x36')](moment()[_0xc56f('0x37')]('x'));}this[_0x381fd3[_0x230f00]+_0xc56f('0x34')]=_0x3bed5c;}var _0x35c44e={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0xc56f('0xa')],'chatPause':this['chatPause'],'mailPause':this[_0xc56f('0xc')],'smsPause':this[_0xc56f('0x38')],'faxPause':this[_0xc56f('0xd')],'openchannelPause':this['openchannelPause'],'chatStatus':this[_0xc56f('0xf')],'chatStatusTime':this[_0xc56f('0x11')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this[_0xc56f('0x13')],'mailStatus':this[_0xc56f('0x14')],'mailStatusTime':this[_0xc56f('0x15')],'mailCapacity':this[_0xc56f('0x16')],'mailCurrentCapacity':this['mailCurrentCapacity'],'faxStatus':this[_0xc56f('0x39')],'faxStatusTime':this[_0xc56f('0x17')],'faxCapacity':this[_0xc56f('0x18')],'faxCurrentCapacity':this[_0xc56f('0x19')],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0xc56f('0x3a')],'smsCapacity':this[_0xc56f('0x3b')],'smsCurrentCapacity':this[_0xc56f('0x1b')],'whatsappStatus':this[_0xc56f('0x3c')],'whatsappStatusTime':this[_0xc56f('0x1c')],'whatsappCapacity':this[_0xc56f('0x1d')],'whatsappCurrentCapacity':this[_0xc56f('0x1e')],'openchannelStatus':this[_0xc56f('0x1f')],'openchannelStatusTime':this[_0xc56f('0x3d')],'openchannelCapacity':this[_0xc56f('0x20')],'openchannelCurrentCapacity':this['openchannelCurrentCapacity'],'busy':this['busy'],'busyQueue':this[_0xc56f('0x22')],'chatWaitingInteractions':this[_0xc56f('0x23')],'faxWaitingInteractions':this[_0xc56f('0x24')],'mailWaitingInteractions':this['mailWaitingInteractions'],'openchannelWaitingInteractions':this[_0xc56f('0x3e')],'smsWaitingInteractions':this[_0xc56f('0x26')],'whatsappWaitingInteractions':this[_0xc56f('0x27')]};var _0x28c5c8=md5(JSON[_0xc56f('0x3f')](_0x35c44e));if(this['md5']!==_0x28c5c8){this['md5']=_0x28c5c8;io[_0xc56f('0x40')]('user:save',_0x35c44e);}};module[_0xc56f('0x41')]=Agent; \ No newline at end of file +var _0x13b9=['length','Status','StatusTime','toNumber','format','chatStatusTime','faxStatus','faxWaitingInteractions','mailWaitingInteractions','whatsappWaitingInteractions','stringify','emit','user:save','exports','lodash','md5','../../../config/environment','localhost','socket.io-emitter','redis','name','voicePause','chatPause','mailPause','faxPause','smsPause','openchannelPause','chatStatus','unknown','chatCapacity','chatCurrentCapacity','mailStatus','mailStatusTime','mailCapacity','mailCurrentCapacity','faxStatusTime','faxCapacity','faxCurrentCapacity','smsStatus','smsStatusTime','smsCapacity','smsCurrentCapacity','whatsappStatus','whatsappStatusTime','whatsappCapacity','whatsappCurrentCapacity','openchannelStatus','openchannelStatusTime','openchannelCapacity','openchannelCurrentCapacity','busy','busyQueue','chatWaitingInteractions','openchannelWaitingInteractions','smsWaitingInteractions','prototype','getChannelStatus','CurrentCapacity','Capacity','maxcapacity','working','idle','chat','openchannel','fax','sms','whatsapp'];(function(_0xa3fadc,_0xd1e16){var _0x23ecb8=function(_0x2c71f7){while(--_0x2c71f7){_0xa3fadc['push'](_0xa3fadc['shift']());}};_0x23ecb8(++_0xd1e16);}(_0x13b9,0x11a));var _0x913b=function(_0xcd67e7,_0x2a7839){_0xcd67e7=_0xcd67e7-0x0;var _0x3f24c5=_0x13b9[_0xcd67e7];return _0x3f24c5;};'use strict';var _=require(_0x913b('0x0'));var moment=require('moment');var md5=require(_0x913b('0x1'));var Redis=require('ioredis');var config=require(_0x913b('0x2'));config['redis']=_['defaults'](config['redis'],{'host':_0x913b('0x3'),'port':0x18eb});var io=require(_0x913b('0x4'))(new Redis(config[_0x913b('0x5')]));function Agent(_0x53d142){this['id']=_0x53d142['id']||0x0;this[_0x913b('0x6')]=_0x53d142[_0x913b('0x6')]||'';this['online']=_0x53d142['online']||!![];this[_0x913b('0x7')]=_0x53d142[_0x913b('0x7')]||![];this[_0x913b('0x8')]=_0x53d142['chatPause']||![];this[_0x913b('0x9')]=_0x53d142[_0x913b('0x9')]||![];this['faxPause']=_0x53d142[_0x913b('0xa')]||![];this[_0x913b('0xb')]=_0x53d142[_0x913b('0xb')]||![];this[_0x913b('0xc')]=_0x53d142[_0x913b('0xc')]||![];this[_0x913b('0xd')]=_0x913b('0xe');this['chatStatusTime']=0x0;this['chatCapacity']=_0x53d142[_0x913b('0xf')]||0x0;this[_0x913b('0x10')]=0x0;this[_0x913b('0x11')]=_0x913b('0xe');this[_0x913b('0x12')]=0x0;this[_0x913b('0x13')]=_0x53d142[_0x913b('0x13')]||0x0;this[_0x913b('0x14')]=0x0;this['faxStatus']=_0x913b('0xe');this[_0x913b('0x15')]=0x0;this[_0x913b('0x16')]=_0x53d142['faxCapacity']||0x0;this[_0x913b('0x17')]=0x0;this[_0x913b('0x18')]=_0x913b('0xe');this[_0x913b('0x19')]=0x0;this[_0x913b('0x1a')]=_0x53d142['smsCapacity']||0x0;this[_0x913b('0x1b')]=0x0;this[_0x913b('0x1c')]=_0x913b('0xe');this[_0x913b('0x1d')]=0x0;this[_0x913b('0x1e')]=_0x53d142[_0x913b('0x1e')]||0x0;this[_0x913b('0x1f')]=0x0;this[_0x913b('0x20')]=_0x913b('0xe');this[_0x913b('0x21')]=0x0;this[_0x913b('0x22')]=_0x53d142['openchannelCapacity']||0x0;this[_0x913b('0x23')]=0x0;this[_0x913b('0x24')]=![];this[_0x913b('0x25')]=undefined;this[_0x913b('0x1')]='';this[_0x913b('0x26')]={};this['faxWaitingInteractions']={};this['mailWaitingInteractions']={};this[_0x913b('0x27')]={};this[_0x913b('0x28')]={};this['whatsappWaitingInteractions']={};this['updateRealtime']();}Agent[_0x913b('0x29')][_0x913b('0x2a')]=function(_0x3f66c5){if(this[_0x3f66c5+'CurrentCapacity']>0x0){if(this[_0x3f66c5+'Capacity']>0x0&&this[_0x3f66c5+_0x913b('0x2b')]>=this[_0x3f66c5+_0x913b('0x2c')]){return _0x913b('0x2d');}else{return _0x913b('0x2e');}}else{return _0x913b('0x2f');}};Agent[_0x913b('0x29')]['updateRealtime']=function(){var _0x26e6a3=['mail',_0x913b('0x30'),_0x913b('0x31'),_0x913b('0x32'),_0x913b('0x33'),_0x913b('0x34')];for(var _0x4e16b9=0x0;_0x4e16b9<_0x26e6a3[_0x913b('0x35')];_0x4e16b9+=0x1){var _0x1d757b=this[_0x913b('0x2a')](_0x26e6a3[_0x4e16b9]);if(this[_0x26e6a3[_0x4e16b9]+_0x913b('0x36')]!==_0x1d757b){this[_0x26e6a3[_0x4e16b9]+_0x913b('0x37')]=_[_0x913b('0x38')](moment()[_0x913b('0x39')]('x'));}this[_0x26e6a3[_0x4e16b9]+_0x913b('0x36')]=_0x1d757b;}var _0x361a08={'id':this['id'],'name':this['name'],'online':this['online'],'voicePause':this[_0x913b('0x7')],'chatPause':this[_0x913b('0x8')],'mailPause':this[_0x913b('0x9')],'smsPause':this[_0x913b('0xb')],'faxPause':this[_0x913b('0xa')],'openchannelPause':this[_0x913b('0xc')],'chatStatus':this[_0x913b('0xd')],'chatStatusTime':this[_0x913b('0x3a')],'chatCapacity':this['chatCapacity'],'chatCurrentCapacity':this['chatCurrentCapacity'],'mailStatus':this[_0x913b('0x11')],'mailStatusTime':this[_0x913b('0x12')],'mailCapacity':this['mailCapacity'],'mailCurrentCapacity':this[_0x913b('0x14')],'faxStatus':this[_0x913b('0x3b')],'faxStatusTime':this[_0x913b('0x15')],'faxCapacity':this[_0x913b('0x16')],'faxCurrentCapacity':this['faxCurrentCapacity'],'smsStatus':this['smsStatus'],'smsStatusTime':this[_0x913b('0x19')],'smsCapacity':this[_0x913b('0x1a')],'smsCurrentCapacity':this['smsCurrentCapacity'],'whatsappStatus':this[_0x913b('0x1c')],'whatsappStatusTime':this[_0x913b('0x1d')],'whatsappCapacity':this['whatsappCapacity'],'whatsappCurrentCapacity':this['whatsappCurrentCapacity'],'openchannelStatus':this[_0x913b('0x20')],'openchannelStatusTime':this[_0x913b('0x21')],'openchannelCapacity':this['openchannelCapacity'],'openchannelCurrentCapacity':this[_0x913b('0x23')],'busy':this[_0x913b('0x24')],'busyQueue':this[_0x913b('0x25')],'chatWaitingInteractions':this[_0x913b('0x26')],'faxWaitingInteractions':this[_0x913b('0x3c')],'mailWaitingInteractions':this[_0x913b('0x3d')],'openchannelWaitingInteractions':this['openchannelWaitingInteractions'],'smsWaitingInteractions':this[_0x913b('0x28')],'whatsappWaitingInteractions':this[_0x913b('0x3e')]};var _0x5949d8=md5(JSON[_0x913b('0x3f')](_0x361a08));if(this[_0x913b('0x1')]!==_0x5949d8){this['md5']=_0x5949d8;io[_0x913b('0x40')](_0x913b('0x41'),_0x361a08);}};module[_0x913b('0x42')]=Agent; \ No newline at end of file diff --git a/server/services/routing/model/chatQueue.js b/server/services/routing/model/chatQueue.js index fcbcf8d..dd18f84 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 _0xd94b=['strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','_rr','map','loggedIn','paused','online','chatPause','available','stringify','md5','chat:queue:%s','exports','lodash','ioredis','defaults','redis','localhost','socket.io-emitter','name','timeout'];(function(_0x17c483,_0xc69535){var _0x112bdb=function(_0x19adb9){while(--_0x19adb9){_0x17c483['push'](_0x17c483['shift']());}};_0x112bdb(++_0xc69535);}(_0xd94b,0x157));var _0xbd94=function(_0x4440f3,_0x3d1418){_0x4440f3=_0x4440f3-0x0;var _0x426de2=_0xd94b[_0x4440f3];return _0x426de2;};'use strict';var _=require(_0xbd94('0x0'));var md5=require('md5');var util=require('util');var Redis=require(_0xbd94('0x1'));var config=require('../../../config/environment');config['redis']=_[_0xbd94('0x2')](config[_0xbd94('0x3')],{'host':_0xbd94('0x4'),'port':0x18eb});var io=require(_0xbd94('0x5'))(new Redis(config['redis']));function ChatQueue(_0x19f17f){this['id']=_0x19f17f['id']||0x0;this['name']=_0x19f17f[_0xbd94('0x6')]||'';this[_0xbd94('0x7')]=_0x19f17f[_0xbd94('0x7')]||0xa;this[_0xbd94('0x8')]=_0x19f17f['strategy']||_0xbd94('0x9');this[_0xbd94('0xa')]=_0x19f17f[_0xbd94('0xa')];this[_0xbd94('0xb')]={};this[_0xbd94('0xc')]=0x0;this['md5']='';this[_0xbd94('0xd')]();this[_0xbd94('0xe')]();}ChatQueue[_0xbd94('0xf')][_0xbd94('0xd')]=function(){var _0x290948=this['mapAgentsId'][_0xbd94('0x10')];this[_0xbd94('0xb')]=_[_0xbd94('0x11')](this[_0xbd94('0xa')],'id');this[_0xbd94('0xb')]['_rr']=_0x290948;};ChatQueue[_0xbd94('0xf')][_0xbd94('0xe')]=function(){this[_0xbd94('0x12')]=0x0;this[_0xbd94('0x13')]=0x0;for(var _0x55c51b=0x0;_0x55c51b=0x0?this['available']:0x0;var _0xf0dd67={'id':this['id'],'available':this[_0xbd94('0x16')],'loggedIn':this[_0xbd94('0x12')],'name':this[_0xbd94('0x6')],'paused':this['paused'],'waiting':this['waiting']};var _0x2b76e1=md5(JSON[_0xbd94('0x17')](_0xf0dd67));if(this[_0xbd94('0x18')]!==_0x2b76e1){this[_0xbd94('0x18')]=_0x2b76e1;io['to'](util['format'](_0xbd94('0x19'),_0xf0dd67[_0xbd94('0x6')]))['emit']('chat_queue:save',_0xf0dd67);}};module[_0xbd94('0x1a')]=ChatQueue; \ No newline at end of file +var _0x3d92=['chat:queue:%s','emit','chat_queue:save','exports','lodash','md5','util','ioredis','redis','localhost','name','timeout','strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','_rr','map','prototype','loggedIn','paused','length','chatPause','available','format'];(function(_0x2cd313,_0x34a888){var _0x546297=function(_0x12ffe9){while(--_0x12ffe9){_0x2cd313['push'](_0x2cd313['shift']());}};_0x546297(++_0x34a888);}(_0x3d92,0xc1));var _0x23d9=function(_0x567fff,_0xd8acd8){_0x567fff=_0x567fff-0x0;var _0x465a37=_0x3d92[_0x567fff];return _0x465a37;};'use strict';var _=require(_0x23d9('0x0'));var md5=require(_0x23d9('0x1'));var util=require(_0x23d9('0x2'));var Redis=require(_0x23d9('0x3'));var config=require('../../../config/environment');config[_0x23d9('0x4')]=_['defaults'](config[_0x23d9('0x4')],{'host':_0x23d9('0x5'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x23d9('0x4')]));function ChatQueue(_0x7b72ab){this['id']=_0x7b72ab['id']||0x0;this[_0x23d9('0x6')]=_0x7b72ab[_0x23d9('0x6')]||'';this[_0x23d9('0x7')]=_0x7b72ab['timeout']||0xa;this[_0x23d9('0x8')]=_0x7b72ab['strategy']||'beepall';this['Agents']=_0x7b72ab[_0x23d9('0x9')];this[_0x23d9('0xa')]={};this[_0x23d9('0xb')]=0x0;this['md5']='';this[_0x23d9('0xc')]();this[_0x23d9('0xd')]();}ChatQueue['prototype']['updateRouting']=function(){var _0x1b1598=this[_0x23d9('0xa')][_0x23d9('0xe')];this[_0x23d9('0xa')]=_[_0x23d9('0xf')](this['Agents'],'id');this[_0x23d9('0xa')]['_rr']=_0x1b1598;};ChatQueue[_0x23d9('0x10')][_0x23d9('0xd')]=function(){this[_0x23d9('0x11')]=0x0;this[_0x23d9('0x12')]=0x0;for(var _0x1f491d=0x0;_0x1f491d=0x0?this[_0x23d9('0x15')]:0x0;var _0x3a0102={'id':this['id'],'available':this['available'],'loggedIn':this[_0x23d9('0x11')],'name':this[_0x23d9('0x6')],'paused':this['paused'],'waiting':this[_0x23d9('0xb')]};var _0x92853f=md5(JSON['stringify'](_0x3a0102));if(this[_0x23d9('0x1')]!==_0x92853f){this['md5']=_0x92853f;io['to'](util[_0x23d9('0x16')](_0x23d9('0x17'),_0x3a0102[_0x23d9('0x6')]))[_0x23d9('0x18')](_0x23d9('0x19'),_0x3a0102);}};module[_0x23d9('0x1a')]=ChatQueue; \ No newline at end of file diff --git a/server/services/routing/model/faxQueue.js b/server/services/routing/model/faxQueue.js index 46c2b10..6eb68c4 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 _0x098d=['ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','waiting','md5','updateRouting','updateRealtime','_rr','mapAgentsId','loggedIn','faxPause','paused','available','stringify','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','util'];(function(_0x381589,_0x27a707){var _0x2a075d=function(_0x4ea19d){while(--_0x4ea19d){_0x381589['push'](_0x381589['shift']());}};_0x2a075d(++_0x27a707);}(_0x098d,0x72));var _0xd098=function(_0x565ed7,_0x398228){_0x565ed7=_0x565ed7-0x0;var _0x183ad7=_0x098d[_0x565ed7];return _0x183ad7;};'use strict';var _=require(_0xd098('0x0'));var md5=require('md5');var util=require(_0xd098('0x1'));var Redis=require(_0xd098('0x2'));var config=require(_0xd098('0x3'));config[_0xd098('0x4')]=_[_0xd098('0x5')](config[_0xd098('0x4')],{'host':_0xd098('0x6'),'port':0x18eb});var io=require(_0xd098('0x7'))(new Redis(config[_0xd098('0x4')]));function FaxQueue(_0x5ce22c){this['id']=_0x5ce22c['id']||0x0;this[_0xd098('0x8')]=_0x5ce22c[_0xd098('0x8')]||'';this['timeout']=_0x5ce22c[_0xd098('0x9')]||0xa;this[_0xd098('0xa')]=_0x5ce22c['strategy']||_0xd098('0xb');this[_0xd098('0xc')]=_0x5ce22c['Agents'];this['mapAgentsId']={};this[_0xd098('0xd')]=0x0;this[_0xd098('0xe')]='';this[_0xd098('0xf')]();this[_0xd098('0x10')]();}FaxQueue['prototype'][_0xd098('0xf')]=function(){var _0x3f8ffd=this['mapAgentsId'][_0xd098('0x11')];this['mapAgentsId']=_['map'](this[_0xd098('0xc')],'id');this[_0xd098('0x12')][_0xd098('0x11')]=_0x3f8ffd;};FaxQueue['prototype'][_0xd098('0x10')]=function(){this[_0xd098('0x13')]=0x0;this['paused']=0x0;for(var _0x1f018f=0x0;_0x1f018f=0x0?this[_0xd098('0x16')]:0x0;var _0x3df1b9={'id':this['id'],'available':this[_0xd098('0x16')],'loggedIn':this[_0xd098('0x13')],'name':this[_0xd098('0x8')],'paused':this[_0xd098('0x15')],'waiting':this[_0xd098('0xd')]};var _0x10cddd=md5(JSON[_0xd098('0x17')](_0x3df1b9));if(this['md5']!==_0x10cddd){this[_0xd098('0xe')]=_0x10cddd;io['to'](util[_0xd098('0x18')](_0xd098('0x19'),_0x3df1b9[_0xd098('0x8')]))[_0xd098('0x1a')](_0xd098('0x1b'),_0x3df1b9);}};module[_0xd098('0x1c')]=FaxQueue; \ No newline at end of file +var _0x4795=['loggedIn','faxPause','available','paused','waiting','format','fax:queue:%s','emit','fax_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','updateRouting','updateRealtime','prototype','mapAgentsId','_rr'];(function(_0x36e3bd,_0x201c77){var _0xdc68e=function(_0x3691c2){while(--_0x3691c2){_0x36e3bd['push'](_0x36e3bd['shift']());}};_0xdc68e(++_0x201c77);}(_0x4795,0xb2));var _0x5479=function(_0x5da8ab,_0x45418e){_0x5da8ab=_0x5da8ab-0x0;var _0x5cb4a5=_0x4795[_0x5da8ab];return _0x5cb4a5;};'use strict';var _=require(_0x5479('0x0'));var md5=require(_0x5479('0x1'));var util=require(_0x5479('0x2'));var Redis=require(_0x5479('0x3'));var config=require(_0x5479('0x4'));config['redis']=_['defaults'](config[_0x5479('0x5')],{'host':_0x5479('0x6'),'port':0x18eb});var io=require(_0x5479('0x7'))(new Redis(config[_0x5479('0x5')]));function FaxQueue(_0x1180e6){this['id']=_0x1180e6['id']||0x0;this[_0x5479('0x8')]=_0x1180e6['name']||'';this[_0x5479('0x9')]=_0x1180e6['timeout']||0xa;this[_0x5479('0xa')]=_0x1180e6['strategy']||_0x5479('0xb');this[_0x5479('0xc')]=_0x1180e6[_0x5479('0xc')];this['mapAgentsId']={};this['waiting']=0x0;this[_0x5479('0x1')]='';this[_0x5479('0xd')]();this[_0x5479('0xe')]();}FaxQueue[_0x5479('0xf')][_0x5479('0xd')]=function(){var _0xe10d42=this[_0x5479('0x10')][_0x5479('0x11')];this[_0x5479('0x10')]=_['map'](this['Agents'],'id');this[_0x5479('0x10')]['_rr']=_0xe10d42;};FaxQueue[_0x5479('0xf')][_0x5479('0xe')]=function(){this[_0x5479('0x12')]=0x0;this['paused']=0x0;for(var _0x5837db=0x0;_0x5837db=0x0?this['available']:0x0;var _0x4c148b={'id':this['id'],'available':this[_0x5479('0x14')],'loggedIn':this[_0x5479('0x12')],'name':this[_0x5479('0x8')],'paused':this[_0x5479('0x15')],'waiting':this[_0x5479('0x16')]};var _0x3068ad=md5(JSON['stringify'](_0x4c148b));if(this[_0x5479('0x1')]!==_0x3068ad){this[_0x5479('0x1')]=_0x3068ad;io['to'](util[_0x5479('0x17')](_0x5479('0x18'),_0x4c148b[_0x5479('0x8')]))[_0x5479('0x19')](_0x5479('0x1a'),_0x4c148b);}};module[_0x5479('0x1b')]=FaxQueue; \ No newline at end of file diff --git a/server/services/routing/model/interval.js b/server/services/routing/model/interval.js index 0fd6d26..287594c 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 _0x0967=['exports','name','Intervals'];(function(_0xf30651,_0x964c8){var _0x5382a0=function(_0x29d618){while(--_0x29d618){_0xf30651['push'](_0xf30651['shift']());}};_0x5382a0(++_0x964c8);}(_0x0967,0x10f));var _0x7096=function(_0x3c5579,_0x4c0f0e){_0x3c5579=_0x3c5579-0x0;var _0x355464=_0x0967[_0x3c5579];return _0x355464;};'use strict';function Interval(_0x17dd4b){this['id']=_0x17dd4b['id']||0x0;this[_0x7096('0x0')]=_0x17dd4b['name']||'';this[_0x7096('0x1')]=_0x17dd4b[_0x7096('0x1')]||{};}module[_0x7096('0x2')]=Interval; \ No newline at end of file +var _0xa570=['name','Intervals','exports'];(function(_0x29d6e6,_0x264220){var _0xc75ff0=function(_0x214f6b){while(--_0x214f6b){_0x29d6e6['push'](_0x29d6e6['shift']());}};_0xc75ff0(++_0x264220);}(_0xa570,0x8d));var _0x0a57=function(_0xdd3240,_0x24b3ae){_0xdd3240=_0xdd3240-0x0;var _0x3af090=_0xa570[_0xdd3240];return _0x3af090;};'use strict';function Interval(_0x52fa73){this['id']=_0x52fa73['id']||0x0;this[_0x0a57('0x0')]=_0x52fa73[_0x0a57('0x0')]||'';this[_0x0a57('0x1')]=_0x52fa73['Intervals']||{};}module[_0x0a57('0x2')]=Interval; \ No newline at end of file diff --git a/server/services/routing/model/mailQueue.js b/server/services/routing/model/mailQueue.js index 25e6618..18cbd43 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 _0x559b=['length','online','loggedIn','mailPause','available','format','emit','mail_queue:save','md5','util','../../../config/environment','redis','defaults','localhost','socket.io-emitter','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','paused'];(function(_0x46bbb4,_0x1f29c8){var _0x5ebc36=function(_0x4cb9fc){while(--_0x4cb9fc){_0x46bbb4['push'](_0x46bbb4['shift']());}};_0x5ebc36(++_0x1f29c8);}(_0x559b,0x14c));var _0xb559=function(_0x19c216,_0x4f6d89){_0x19c216=_0x19c216-0x0;var _0x204b58=_0x559b[_0x19c216];return _0x204b58;};'use strict';var _=require('lodash');var md5=require(_0xb559('0x0'));var util=require(_0xb559('0x1'));var Redis=require('ioredis');var config=require(_0xb559('0x2'));config[_0xb559('0x3')]=_[_0xb559('0x4')](config[_0xb559('0x3')],{'host':_0xb559('0x5'),'port':0x18eb});var io=require(_0xb559('0x6'))(new Redis(config[_0xb559('0x3')]));function MailQueue(_0xcac8af){this['id']=_0xcac8af['id']||0x0;this['name']=_0xcac8af['name']||'';this[_0xb559('0x7')]=_0xcac8af[_0xb559('0x7')]||0xa;this[_0xb559('0x8')]=_0xcac8af['strategy']||_0xb559('0x9');this[_0xb559('0xa')]=_0xcac8af[_0xb559('0xa')];this[_0xb559('0xb')]={};this[_0xb559('0xc')]=0x0;this[_0xb559('0x0')]='';this[_0xb559('0xd')]();this[_0xb559('0xe')]();}MailQueue[_0xb559('0xf')][_0xb559('0xd')]=function(){var _0x4b35ff=this[_0xb559('0xb')]['_rr'];this[_0xb559('0xb')]=_[_0xb559('0x10')](this[_0xb559('0xa')],'id');this[_0xb559('0xb')][_0xb559('0x11')]=_0x4b35ff;};MailQueue[_0xb559('0xf')][_0xb559('0xe')]=function(){this['loggedIn']=0x0;this[_0xb559('0x12')]=0x0;for(var _0x599410=0x0;_0x599410=0x0?this[_0xb559('0x17')]:0x0;var _0x39ea8b={'id':this['id'],'available':this[_0xb559('0x17')],'loggedIn':this[_0xb559('0x15')],'name':this['name'],'paused':this[_0xb559('0x12')],'waiting':this[_0xb559('0xc')]};var _0x1000f4=md5(JSON['stringify'](_0x39ea8b));if(this[_0xb559('0x0')]!==_0x1000f4){this[_0xb559('0x0')]=_0x1000f4;io['to'](util[_0xb559('0x18')]('mail:queue:%s',_0x39ea8b['name']))[_0xb559('0x19')](_0xb559('0x1a'),_0x39ea8b);}};module['exports']=MailQueue; \ No newline at end of file +var _0xa9a8=['redis','localhost','name','Agents','mapAgentsId','waiting','updateRealtime','updateRouting','_rr','map','loggedIn','paused','length','mailPause','available','stringify','format','mail:queue:%s','emit','exports','md5','util','../../../config/environment'];(function(_0x5e1b42,_0x54c61f){var _0x5d2934=function(_0x48e8c3){while(--_0x48e8c3){_0x5e1b42['push'](_0x5e1b42['shift']());}};_0x5d2934(++_0x54c61f);}(_0xa9a8,0x87));var _0x8a9a=function(_0xfcd6fe,_0x161340){_0xfcd6fe=_0xfcd6fe-0x0;var _0x38f4fc=_0xa9a8[_0xfcd6fe];return _0x38f4fc;};'use strict';var _=require('lodash');var md5=require(_0x8a9a('0x0'));var util=require(_0x8a9a('0x1'));var Redis=require('ioredis');var config=require(_0x8a9a('0x2'));config[_0x8a9a('0x3')]=_['defaults'](config['redis'],{'host':_0x8a9a('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x8a9a('0x3')]));function MailQueue(_0x3b6622){this['id']=_0x3b6622['id']||0x0;this[_0x8a9a('0x5')]=_0x3b6622['name']||'';this['timeout']=_0x3b6622['timeout']||0xa;this['strategy']=_0x3b6622['strategy']||'beepall';this[_0x8a9a('0x6')]=_0x3b6622[_0x8a9a('0x6')];this[_0x8a9a('0x7')]={};this[_0x8a9a('0x8')]=0x0;this[_0x8a9a('0x0')]='';this['updateRouting']();this[_0x8a9a('0x9')]();}MailQueue['prototype'][_0x8a9a('0xa')]=function(){var _0x5a5966=this[_0x8a9a('0x7')][_0x8a9a('0xb')];this[_0x8a9a('0x7')]=_[_0x8a9a('0xc')](this[_0x8a9a('0x6')],'id');this[_0x8a9a('0x7')][_0x8a9a('0xb')]=_0x5a5966;};MailQueue['prototype'][_0x8a9a('0x9')]=function(){this[_0x8a9a('0xd')]=0x0;this[_0x8a9a('0xe')]=0x0;for(var _0x3e59cb=0x0;_0x3e59cb=0x0?this['available']:0x0;var _0x2b2761={'id':this['id'],'available':this[_0x8a9a('0x11')],'loggedIn':this[_0x8a9a('0xd')],'name':this[_0x8a9a('0x5')],'paused':this[_0x8a9a('0xe')],'waiting':this[_0x8a9a('0x8')]};var _0xee6b7c=md5(JSON[_0x8a9a('0x12')](_0x2b2761));if(this[_0x8a9a('0x0')]!==_0xee6b7c){this[_0x8a9a('0x0')]=_0xee6b7c;io['to'](util[_0x8a9a('0x13')](_0x8a9a('0x14'),_0x2b2761[_0x8a9a('0x5')]))[_0x8a9a('0x15')]('mail_queue:save',_0x2b2761);}};module[_0x8a9a('0x16')]=MailQueue; \ No newline at end of file diff --git a/server/services/routing/model/openchannelQueue.js b/server/services/routing/model/openchannelQueue.js index 542c06b..8a4cbf1 100644 --- a/server/services/routing/model/openchannelQueue.js +++ b/server/services/routing/model/openchannelQueue.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x203b12,_0x428209){var _0x306913=function(_0x577a6f){while(--_0x577a6f){_0x203b12['push'](_0x203b12['shift']());}};_0x306913(++_0x428209);}(_0x814b,0x1a2));var _0xb814=function(_0x3e9ef3,_0x21a7e4){_0x3e9ef3=_0x3e9ef3-0x0;var _0x333748=_0x814b[_0x3e9ef3];return _0x333748;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file +var _0x814b=['prototype','map','_rr','loggedIn','paused','length','online','openchannelPause','available','format','openchannel_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','updateRouting','updateRealtime'];(function(_0x202405,_0x583913){var _0x14bfee=function(_0x31e8d6){while(--_0x31e8d6){_0x202405['push'](_0x202405['shift']());}};_0x14bfee(++_0x583913);}(_0x814b,0x1a2));var _0xb814=function(_0x55cdc5,_0x2b2297){_0x55cdc5=_0x55cdc5-0x0;var _0x29acd5=_0x814b[_0x55cdc5];return _0x29acd5;};'use strict';var _=require(_0xb814('0x0'));var md5=require(_0xb814('0x1'));var util=require(_0xb814('0x2'));var Redis=require(_0xb814('0x3'));var config=require(_0xb814('0x4'));config[_0xb814('0x5')]=_['defaults'](config[_0xb814('0x5')],{'host':_0xb814('0x6'),'port':0x18eb});var io=require(_0xb814('0x7'))(new Redis(config[_0xb814('0x5')]));function OpenchannelQueue(_0x44931c){this['id']=_0x44931c['id']||0x0;this[_0xb814('0x8')]=_0x44931c['name']||'';this[_0xb814('0x9')]=_0x44931c[_0xb814('0x9')]||0xa;this['strategy']=_0x44931c[_0xb814('0xa')]||_0xb814('0xb');this[_0xb814('0xc')]=_0x44931c[_0xb814('0xc')];this[_0xb814('0xd')]={};this[_0xb814('0xe')]=0x0;this[_0xb814('0x1')]='';this[_0xb814('0xf')]();this[_0xb814('0x10')]();}OpenchannelQueue[_0xb814('0x11')][_0xb814('0xf')]=function(){var _0x4b5f14=this[_0xb814('0xd')]['_rr'];this[_0xb814('0xd')]=_[_0xb814('0x12')](this[_0xb814('0xc')],'id');this[_0xb814('0xd')][_0xb814('0x13')]=_0x4b5f14;};OpenchannelQueue[_0xb814('0x11')][_0xb814('0x10')]=function(){this[_0xb814('0x14')]=0x0;this[_0xb814('0x15')]=0x0;for(var _0x2ab627=0x0;_0x2ab627=0x0?this['available']:0x0;var _0x270598={'id':this['id'],'available':this[_0xb814('0x19')],'loggedIn':this['loggedIn'],'name':this['name'],'paused':this['paused'],'waiting':this[_0xb814('0xe')]};var _0x4d5276=md5(JSON['stringify'](_0x270598));if(this[_0xb814('0x1')]!==_0x4d5276){this[_0xb814('0x1')]=_0x4d5276;io['to'](util[_0xb814('0x1a')]('openchannel:queue:%s',_0x270598[_0xb814('0x8')]))['emit'](_0xb814('0x1b'),_0x270598);}};module[_0xb814('0x1c')]=OpenchannelQueue; \ No newline at end of file diff --git a/server/services/routing/model/smsQueue.js b/server/services/routing/model/smsQueue.js index c8bb451..9d9576c 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 _0xfa2b=['strategy','Agents','mapAgentsId','waiting','updateRouting','updateRealtime','prototype','map','_rr','loggedIn','paused','length','online','smsPause','available','stringify','format','sms:queue:%s','emit','lodash','md5','util','ioredis','../../../config/environment','redis','defaults','localhost','socket.io-emitter','name','timeout'];(function(_0x2c4b06,_0x2e9683){var _0x341c4d=function(_0x379cef){while(--_0x379cef){_0x2c4b06['push'](_0x2c4b06['shift']());}};_0x341c4d(++_0x2e9683);}(_0xfa2b,0x1b7));var _0xbfa2=function(_0x10278a,_0x233827){_0x10278a=_0x10278a-0x0;var _0x5143e6=_0xfa2b[_0x10278a];return _0x5143e6;};'use strict';var _=require(_0xbfa2('0x0'));var md5=require(_0xbfa2('0x1'));var util=require(_0xbfa2('0x2'));var Redis=require(_0xbfa2('0x3'));var config=require(_0xbfa2('0x4'));config[_0xbfa2('0x5')]=_[_0xbfa2('0x6')](config[_0xbfa2('0x5')],{'host':_0xbfa2('0x7'),'port':0x18eb});var io=require(_0xbfa2('0x8'))(new Redis(config[_0xbfa2('0x5')]));function SmsQueue(_0x2e8f3b){this['id']=_0x2e8f3b['id']||0x0;this[_0xbfa2('0x9')]=_0x2e8f3b[_0xbfa2('0x9')]||'';this[_0xbfa2('0xa')]=_0x2e8f3b[_0xbfa2('0xa')]||0xa;this['strategy']=_0x2e8f3b[_0xbfa2('0xb')]||'beepall';this[_0xbfa2('0xc')]=_0x2e8f3b[_0xbfa2('0xc')];this[_0xbfa2('0xd')]={};this[_0xbfa2('0xe')]=0x0;this[_0xbfa2('0x1')]='';this[_0xbfa2('0xf')]();this[_0xbfa2('0x10')]();}SmsQueue[_0xbfa2('0x11')][_0xbfa2('0xf')]=function(){var _0x4e0f1e=this['mapAgentsId']['_rr'];this[_0xbfa2('0xd')]=_[_0xbfa2('0x12')](this[_0xbfa2('0xc')],'id');this[_0xbfa2('0xd')][_0xbfa2('0x13')]=_0x4e0f1e;};SmsQueue[_0xbfa2('0x11')]['updateRealtime']=function(){this[_0xbfa2('0x14')]=0x0;this[_0xbfa2('0x15')]=0x0;for(var _0x458653=0x0;_0x458653=0x0?this[_0xbfa2('0x19')]:0x0;var _0x28fe6f={'id':this['id'],'available':this[_0xbfa2('0x19')],'loggedIn':this[_0xbfa2('0x14')],'name':this[_0xbfa2('0x9')],'paused':this[_0xbfa2('0x15')],'waiting':this['waiting']};var _0xb805f7=md5(JSON[_0xbfa2('0x1a')](_0x28fe6f));if(this[_0xbfa2('0x1')]!==_0xb805f7){this['md5']=_0xb805f7;io['to'](util[_0xbfa2('0x1b')](_0xbfa2('0x1c'),_0x28fe6f['name']))[_0xbfa2('0x1d')]('sms_queue:save',_0x28fe6f);}};module['exports']=SmsQueue; \ No newline at end of file +var _0x0e85=['waiting','updateRouting','updateRealtime','prototype','mapAgentsId','map','loggedIn','paused','length','smsPause','available','stringify','format','sms:queue:%s','emit','exports','lodash','md5','ioredis','../../../config/environment','localhost','redis','name','timeout','strategy','beepall','Agents'];(function(_0x1438f5,_0x2fcc9b){var _0x5449a5=function(_0x2a1d24){while(--_0x2a1d24){_0x1438f5['push'](_0x1438f5['shift']());}};_0x5449a5(++_0x2fcc9b);}(_0x0e85,0x7c));var _0x50e8=function(_0x1a7846,_0x59723e){_0x1a7846=_0x1a7846-0x0;var _0x48049=_0x0e85[_0x1a7846];return _0x48049;};'use strict';var _=require(_0x50e8('0x0'));var md5=require(_0x50e8('0x1'));var util=require('util');var Redis=require(_0x50e8('0x2'));var config=require(_0x50e8('0x3'));config['redis']=_['defaults'](config['redis'],{'host':_0x50e8('0x4'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x50e8('0x5')]));function SmsQueue(_0x2401b2){this['id']=_0x2401b2['id']||0x0;this[_0x50e8('0x6')]=_0x2401b2[_0x50e8('0x6')]||'';this['timeout']=_0x2401b2[_0x50e8('0x7')]||0xa;this[_0x50e8('0x8')]=_0x2401b2[_0x50e8('0x8')]||_0x50e8('0x9');this[_0x50e8('0xa')]=_0x2401b2[_0x50e8('0xa')];this['mapAgentsId']={};this[_0x50e8('0xb')]=0x0;this[_0x50e8('0x1')]='';this[_0x50e8('0xc')]();this[_0x50e8('0xd')]();}SmsQueue[_0x50e8('0xe')][_0x50e8('0xc')]=function(){var _0x45dc6f=this[_0x50e8('0xf')]['_rr'];this['mapAgentsId']=_[_0x50e8('0x10')](this[_0x50e8('0xa')],'id');this['mapAgentsId']['_rr']=_0x45dc6f;};SmsQueue[_0x50e8('0xe')][_0x50e8('0xd')]=function(){this[_0x50e8('0x11')]=0x0;this[_0x50e8('0x12')]=0x0;for(var _0x54efd3=0x0;_0x54efd3=0x0?this[_0x50e8('0x15')]:0x0;var _0xc97063={'id':this['id'],'available':this[_0x50e8('0x15')],'loggedIn':this[_0x50e8('0x11')],'name':this[_0x50e8('0x6')],'paused':this[_0x50e8('0x12')],'waiting':this[_0x50e8('0xb')]};var _0x53e0a1=md5(JSON[_0x50e8('0x16')](_0xc97063));if(this['md5']!==_0x53e0a1){this[_0x50e8('0x1')]=_0x53e0a1;io['to'](util[_0x50e8('0x17')](_0x50e8('0x18'),_0xc97063[_0x50e8('0x6')]))[_0x50e8('0x19')]('sms_queue:save',_0xc97063);}};module[_0x50e8('0x1a')]=SmsQueue; \ No newline at end of file diff --git a/server/services/routing/model/whatsappQueue.js b/server/services/routing/model/whatsappQueue.js index 7a30bcf..d9ec16d 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 _0x21c2=['available','stringify','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','ioredis','redis','defaults','socket.io-emitter','name','timeout','strategy','beepall','Agents','mapAgentsId','waiting','md5','prototype','updateRouting','map','_rr','updateRealtime','loggedIn','length','paused'];(function(_0x57da7c,_0x2b3e88){var _0x96871d=function(_0x51bc38){while(--_0x51bc38){_0x57da7c['push'](_0x57da7c['shift']());}};_0x96871d(++_0x2b3e88);}(_0x21c2,0x130));var _0x221c=function(_0x2733e8,_0x10dbd9){_0x2733e8=_0x2733e8-0x0;var _0x1e58ce=_0x21c2[_0x2733e8];return _0x1e58ce;};'use strict';var _=require('lodash');var md5=require('md5');var util=require('util');var Redis=require(_0x221c('0x0'));var config=require('../../../config/environment');config[_0x221c('0x1')]=_[_0x221c('0x2')](config[_0x221c('0x1')],{'host':'localhost','port':0x18eb});var io=require(_0x221c('0x3'))(new Redis(config[_0x221c('0x1')]));function WhatsappQueue(_0x5a0949){this['id']=_0x5a0949['id']||0x0;this[_0x221c('0x4')]=_0x5a0949['name']||'';this['timeout']=_0x5a0949[_0x221c('0x5')]||0xa;this['strategy']=_0x5a0949[_0x221c('0x6')]||_0x221c('0x7');this[_0x221c('0x8')]=_0x5a0949[_0x221c('0x8')];this[_0x221c('0x9')]={};this[_0x221c('0xa')]=0x0;this[_0x221c('0xb')]='';this['updateRouting']();this['updateRealtime']();}WhatsappQueue[_0x221c('0xc')][_0x221c('0xd')]=function(){var _0x44257e=this['mapAgentsId']['_rr'];this[_0x221c('0x9')]=_[_0x221c('0xe')](this[_0x221c('0x8')],'id');this[_0x221c('0x9')][_0x221c('0xf')]=_0x44257e;};WhatsappQueue['prototype'][_0x221c('0x10')]=function(){this[_0x221c('0x11')]=0x0;this['paused']=0x0;for(var _0x19d3bb=0x0;_0x19d3bb=0x0?this[_0x221c('0x14')]:0x0;var _0x2489e3={'id':this['id'],'available':this[_0x221c('0x14')],'loggedIn':this[_0x221c('0x11')],'name':this['name'],'paused':this[_0x221c('0x13')],'waiting':this[_0x221c('0xa')]};var _0x666b68=md5(JSON[_0x221c('0x15')](_0x2489e3));if(this[_0x221c('0xb')]!==_0x666b68){this[_0x221c('0xb')]=_0x666b68;io['to'](util[_0x221c('0x16')](_0x221c('0x17'),_0x2489e3[_0x221c('0x4')]))[_0x221c('0x18')](_0x221c('0x19'),_0x2489e3);}};module[_0x221c('0x1a')]=WhatsappQueue; \ No newline at end of file +var _0x2821=['beepall','Agents','mapAgentsId','waiting','updateRealtime','prototype','updateRouting','_rr','map','loggedIn','paused','length','online','whatsappPause','available','format','whatsapp:queue:%s','emit','whatsapp_queue:save','exports','lodash','md5','util','ioredis','../../../config/environment','redis','localhost','name','timeout','strategy'];(function(_0x14f418,_0xe8c131){var _0x5e5cdb=function(_0x539847){while(--_0x539847){_0x14f418['push'](_0x14f418['shift']());}};_0x5e5cdb(++_0xe8c131);}(_0x2821,0xc8));var _0x1282=function(_0x2499dc,_0x33f166){_0x2499dc=_0x2499dc-0x0;var _0x699246=_0x2821[_0x2499dc];return _0x699246;};'use strict';var _=require(_0x1282('0x0'));var md5=require(_0x1282('0x1'));var util=require(_0x1282('0x2'));var Redis=require(_0x1282('0x3'));var config=require(_0x1282('0x4'));config[_0x1282('0x5')]=_['defaults'](config[_0x1282('0x5')],{'host':_0x1282('0x6'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config['redis']));function WhatsappQueue(_0x5f2a3c){this['id']=_0x5f2a3c['id']||0x0;this[_0x1282('0x7')]=_0x5f2a3c[_0x1282('0x7')]||'';this[_0x1282('0x8')]=_0x5f2a3c[_0x1282('0x8')]||0xa;this[_0x1282('0x9')]=_0x5f2a3c[_0x1282('0x9')]||_0x1282('0xa');this[_0x1282('0xb')]=_0x5f2a3c['Agents'];this[_0x1282('0xc')]={};this[_0x1282('0xd')]=0x0;this[_0x1282('0x1')]='';this['updateRouting']();this[_0x1282('0xe')]();}WhatsappQueue[_0x1282('0xf')][_0x1282('0x10')]=function(){var _0x3a135f=this['mapAgentsId'][_0x1282('0x11')];this[_0x1282('0xc')]=_[_0x1282('0x12')](this[_0x1282('0xb')],'id');this[_0x1282('0xc')][_0x1282('0x11')]=_0x3a135f;};WhatsappQueue['prototype']['updateRealtime']=function(){this[_0x1282('0x13')]=0x0;this[_0x1282('0x14')]=0x0;for(var _0x34197a=0x0;_0x34197a=0x0?this['available']:0x0;var _0x52e132={'id':this['id'],'available':this['available'],'loggedIn':this[_0x1282('0x13')],'name':this[_0x1282('0x7')],'paused':this[_0x1282('0x14')],'waiting':this[_0x1282('0xd')]};var _0x56d8a6=md5(JSON['stringify'](_0x52e132));if(this[_0x1282('0x1')]!==_0x56d8a6){this[_0x1282('0x1')]=_0x56d8a6;io['to'](util[_0x1282('0x19')](_0x1282('0x1a'),_0x52e132[_0x1282('0x7')]))[_0x1282('0x1b')](_0x1282('0x1c'),_0x52e132);}};module[_0x1282('0x1d')]=WhatsappQueue; \ No newline at end of file diff --git a/server/services/routing/realtime/index.js b/server/services/routing/realtime/index.js index 403786f..1f3b6a0 100644 --- a/server/services/routing/realtime/index.js +++ b/server/services/routing/realtime/index.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0xa9e0,0x123));var _0x0a9e=function(_0x92c450,_0x41f1e3){_0x92c450=_0x92c450-0x0;var _0x2a9599=_0xa9e0[_0x92c450];return _0x2a9599;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file +var _0xa9e0=['isUndefined','initIntervals','updateRealtime','updateRouting','initSmsQueues','smsQueues','initMailQueues','mailQueues','initWhatsappQueues','whatsappQueues','exports','bluebird','util','lodash','../model/interval','../model/chatQueue','../model/smsQueue','../model/mailQueue','../model/faxQueue','../model/whatsappQueue','intervals','openchannelQueues','chatQueues','faxQueues','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','hasOwnProperty','prototype','mergeFromDatabase','initAgents','agents','length'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xa9e0,0x123));var _0x0a9e=function(_0x9aada2,_0xd2d349){_0x9aada2=_0x9aada2-0x0;var _0x196dff=_0xa9e0[_0x9aada2];return _0x196dff;};'use strict';var BPromise=require(_0x0a9e('0x0'));var util=require(_0x0a9e('0x1'));var _=require(_0x0a9e('0x2'));var moment=require('moment');var Agent=require('../model/agent');var Interval=require(_0x0a9e('0x3'));var OpenchannelQueue=require('../model/openchannelQueue');var ChatQueue=require(_0x0a9e('0x4'));var SmsQueue=require(_0x0a9e('0x5'));var MailQueue=require(_0x0a9e('0x6'));var FaxQueue=require(_0x0a9e('0x7'));var WhatsappQueue=require(_0x0a9e('0x8'));var Realtime=function(){this['agents']={};this[_0x0a9e('0x9')]={};this[_0x0a9e('0xa')]={};this[_0x0a9e('0xb')]={};this['smsQueues']={};this['mailQueues']={};this[_0x0a9e('0xc')]={};this['whatsappQueues']={};this['chatQueuesWaitingInteractions']={};this[_0x0a9e('0xd')]={};this[_0x0a9e('0xe')]={};this[_0x0a9e('0xf')]={};this[_0x0a9e('0x10')]={};this[_0x0a9e('0x11')]={};};function freeIsNotKey(_0xbd1168,_0x4a4c56,_0x50dfb2){var _0x527cdd=_['mapKeys'](_0xbd1168,function(_0x273d4d,_0x36471c){return _0x273d4d[_0x50dfb2];});for(var _0xd5b662 in _0x4a4c56){if(_0x4a4c56[_0x0a9e('0x12')](_0xd5b662)){if(!_0x527cdd[_0xd5b662]){delete _0x4a4c56[_0xd5b662];}}}}Realtime[_0x0a9e('0x13')][_0x0a9e('0x14')]=function(_0x5db4b0,_0x4283ce){for(var _0x239b12 in _0x4283ce){if(_0x5db4b0[_0x0a9e('0x12')](_0x239b12)){_0x5db4b0[_0x239b12]=_0x4283ce[_0x239b12];}}};Realtime[_0x0a9e('0x13')][_0x0a9e('0x15')]=function(){var _0x4d5611=this;return function(_0x52a03d){if(_0x52a03d){freeIsNotKey(_0x52a03d,_0x4d5611[_0x0a9e('0x16')],'id');for(var _0x5d0880=0x0,_0x1985b6={},_0x519dfd={};_0x5d0880<_0x52a03d[_0x0a9e('0x17')];_0x5d0880+=0x1){_0x1985b6=_0x52a03d[_0x5d0880];if(_[_0x0a9e('0x18')](_0x4d5611['agents'][_0x1985b6['id']])){_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']]=new Agent(_0x1985b6);}else{_0x4d5611['mergeFromDatabase'](_0x4d5611[_0x0a9e('0x16')][_0x1985b6['id']],_0x1985b6);}}}return _0x4d5611[_0x0a9e('0x16')];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x19')]=function(){var _0x31b1ca=this;return function(_0x2eb11f){if(_0x2eb11f){freeIsNotKey(_0x2eb11f,_0x31b1ca[_0x0a9e('0x9')],'id');for(var _0x20559e=0x0,_0x1314ae={},_0x112016={};_0x20559e<_0x2eb11f[_0x0a9e('0x17')];_0x20559e+=0x1){_0x1314ae=_0x2eb11f[_0x20559e];if(_[_0x0a9e('0x18')](_0x31b1ca['intervals'][_0x1314ae['id']])){_0x31b1ca[_0x0a9e('0x9')][_0x1314ae['id']]=new Interval(_0x1314ae);}else{_0x31b1ca[_0x0a9e('0x14')](_0x31b1ca['intervals'][_0x1314ae['id']],_0x1314ae);}}}return _0x31b1ca[_0x0a9e('0x9')];};};Realtime['prototype']['initOpenchannelQueues']=function(){var _0x3a02e1=this;return function(_0x432e56){if(_0x432e56){freeIsNotKey(_0x432e56,_0x3a02e1[_0x0a9e('0xa')],'id');for(var _0x30bae6=0x0,_0x4abc77={},_0xfb6e48={};_0x30bae6<_0x432e56[_0x0a9e('0x17')];_0x30bae6+=0x1){_0x4abc77=_0x432e56[_0x30bae6];if(_[_0x0a9e('0x18')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']])){_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']]=new OpenchannelQueue(_0x4abc77);}else{_0x3a02e1[_0x0a9e('0x14')](_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']],_0x4abc77);}_0x3a02e1['openchannelQueues'][_0x4abc77['id']]['updateRouting']();_0x3a02e1[_0x0a9e('0xa')][_0x4abc77['id']][_0x0a9e('0x1a')]();}}return _0x3a02e1[_0x0a9e('0xa')];};};Realtime[_0x0a9e('0x13')]['initChatQueues']=function(){var _0x384319=this;return function(_0x479bc4){if(_0x479bc4){freeIsNotKey(_0x479bc4,_0x384319[_0x0a9e('0xb')],'id');for(var _0x5bfb33=0x0,_0x1dc186={},_0x34dc65={};_0x5bfb33<_0x479bc4[_0x0a9e('0x17')];_0x5bfb33+=0x1){_0x1dc186=_0x479bc4[_0x5bfb33];if(_[_0x0a9e('0x18')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']])){_0x384319[_0x0a9e('0xb')][_0x1dc186['id']]=new ChatQueue(_0x1dc186);}else{_0x384319[_0x0a9e('0x14')](_0x384319[_0x0a9e('0xb')][_0x1dc186['id']],_0x1dc186);}_0x384319['chatQueues'][_0x1dc186['id']][_0x0a9e('0x1b')]();_0x384319[_0x0a9e('0xb')][_0x1dc186['id']][_0x0a9e('0x1a')]();}}return _0x384319[_0x0a9e('0xb')];};};Realtime['prototype'][_0x0a9e('0x1c')]=function(){var _0x40e7a3=this;return function(_0x1843b2){if(_0x1843b2){freeIsNotKey(_0x1843b2,_0x40e7a3[_0x0a9e('0x1d')],'id');for(var _0x58b06f=0x0,_0x563b45={},_0x296f41={};_0x58b06f<_0x1843b2[_0x0a9e('0x17')];_0x58b06f+=0x1){_0x563b45=_0x1843b2[_0x58b06f];if(_[_0x0a9e('0x18')](_0x40e7a3['smsQueues'][_0x563b45['id']])){_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']]=new SmsQueue(_0x563b45);}else{_0x40e7a3['mergeFromDatabase'](_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']],_0x563b45);}_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1b')]();_0x40e7a3[_0x0a9e('0x1d')][_0x563b45['id']][_0x0a9e('0x1a')]();}}return _0x40e7a3['smsQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x1e')]=function(){var _0x40cb85=this;return function(_0x2da5c0){if(_0x2da5c0){freeIsNotKey(_0x2da5c0,_0x40cb85[_0x0a9e('0x1f')],'id');for(var _0x409319=0x0,_0x332d35={},_0x39e565={};_0x409319<_0x2da5c0['length'];_0x409319+=0x1){_0x332d35=_0x2da5c0[_0x409319];if(_[_0x0a9e('0x18')](_0x40cb85['mailQueues'][_0x332d35['id']])){_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]=new MailQueue(_0x332d35);}else{_0x40cb85[_0x0a9e('0x14')](_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']],_0x332d35);}_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']]['updateRouting']();_0x40cb85[_0x0a9e('0x1f')][_0x332d35['id']][_0x0a9e('0x1a')]();}}return _0x40cb85[_0x0a9e('0x1f')];};};Realtime[_0x0a9e('0x13')]['initFaxQueues']=function(){var _0x54135e=this;return function(_0x1e8694){if(_0x1e8694){freeIsNotKey(_0x1e8694,_0x54135e['faxQueues'],'id');for(var _0x24936a=0x0,_0x3d9717={},_0x381c37={};_0x24936a<_0x1e8694[_0x0a9e('0x17')];_0x24936a+=0x1){_0x3d9717=_0x1e8694[_0x24936a];if(_['isUndefined'](_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']])){_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]=new FaxQueue(_0x3d9717);}else{_0x54135e[_0x0a9e('0x14')](_0x54135e['faxQueues'][_0x3d9717['id']],_0x3d9717);}_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']][_0x0a9e('0x1b')]();_0x54135e[_0x0a9e('0xc')][_0x3d9717['id']]['updateRealtime']();}}return _0x54135e['faxQueues'];};};Realtime[_0x0a9e('0x13')][_0x0a9e('0x20')]=function(){var _0x5adda1=this;return function(_0x2b814e){if(_0x2b814e){freeIsNotKey(_0x2b814e,_0x5adda1[_0x0a9e('0x21')],'id');for(var _0x2e1b3a=0x0,_0x148f55={},_0x4b38d9={};_0x2e1b3a<_0x2b814e['length'];_0x2e1b3a+=0x1){_0x148f55=_0x2b814e[_0x2e1b3a];if(_[_0x0a9e('0x18')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']])){_0x5adda1['whatsappQueues'][_0x148f55['id']]=new WhatsappQueue(_0x148f55);}else{_0x5adda1[_0x0a9e('0x14')](_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']],_0x148f55);}_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']]['updateRouting']();_0x5adda1[_0x0a9e('0x21')][_0x148f55['id']][_0x0a9e('0x1a')]();}}return _0x5adda1[_0x0a9e('0x21')];};};module[_0x0a9e('0x22')]=Realtime; \ No newline at end of file diff --git a/server/services/routing/rpc/chatInteraction.js b/server/services/routing/rpc/chatInteraction.js index e0a3c6a..7de0233 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 _0xd246=['UpdateChatInteraction','updateChatInteraction','addTags','AddTagsToChatInteraction','../client','update','Request'];(function(_0x3e7771,_0x1162dd){var _0x52f473=function(_0x358eac){while(--_0x358eac){_0x3e7771['push'](_0x3e7771['shift']());}};_0x52f473(++_0x1162dd);}(_0xd246,0x154));var _0x6d24=function(_0x38d3bd,_0x49f837){_0x38d3bd=_0x38d3bd-0x0;var _0x19022c=_0xd246[_0x38d3bd];return _0x19022c;};'use strict';var client=require(_0x6d24('0x0'));exports[_0x6d24('0x1')]=function(_0x42c6e8,_0x57c581){return client[_0x6d24('0x2')](_0x6d24('0x3'),{'body':_0x57c581,'options':{'where':{'id':_0x42c6e8}},'log':_0x6d24('0x4')});};exports[_0x6d24('0x5')]=function(_0x226611,_0x36fc91){return client[_0x6d24('0x2')](_0x6d24('0x6'),{'body':_0x36fc91,'options':{'where':{'id':_0x226611}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file +var _0x987c=['Request','AddTagsToChatInteraction','addTagsToChatInteraction','../client','update','UpdateChatInteraction','updateChatInteraction','addTags'];(function(_0x10fd94,_0x2773a2){var _0x491d09=function(_0x12276c){while(--_0x12276c){_0x10fd94['push'](_0x10fd94['shift']());}};_0x491d09(++_0x2773a2);}(_0x987c,0x8b));var _0xc987=function(_0x24e317,_0x379554){_0x24e317=_0x24e317-0x0;var _0x12d707=_0x987c[_0x24e317];return _0x12d707;};'use strict';var client=require(_0xc987('0x0'));exports[_0xc987('0x1')]=function(_0x30a5fb,_0xc55f3c){return client['Request'](_0xc987('0x2'),{'body':_0xc55f3c,'options':{'where':{'id':_0x30a5fb}},'log':_0xc987('0x3')});};exports[_0xc987('0x4')]=function(_0x1fa9e9,_0x12ead1){return client[_0xc987('0x5')](_0xc987('0x6'),{'body':_0x12ead1,'options':{'where':{'id':_0x1fa9e9}},'log':_0xc987('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatMessage.js b/server/services/routing/rpc/chatMessage.js index 1b630c5..f2ec861 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 _0x55eb=['createChatMessage','../client','Request','CreateChatMessage'];(function(_0x19aee6,_0x51be71){var _0x17bbc5=function(_0x103f6f){while(--_0x103f6f){_0x19aee6['push'](_0x19aee6['shift']());}};_0x17bbc5(++_0x51be71);}(_0x55eb,0x179));var _0xb55e=function(_0x387fac,_0x4c8581){_0x387fac=_0x387fac-0x0;var _0x2814a1=_0x55eb[_0x387fac];return _0x2814a1;};'use strict';var client=require(_0xb55e('0x0'));exports['create']=function(_0x33f1fd){return client[_0xb55e('0x1')](_0xb55e('0x2'),{'body':_0x33f1fd,'log':_0xb55e('0x3')});}; \ No newline at end of file +var _0x502d=['Request','../client','create'];(function(_0x110c3d,_0x12ee06){var _0x226d67=function(_0x1fb6e1){while(--_0x1fb6e1){_0x110c3d['push'](_0x110c3d['shift']());}};_0x226d67(++_0x12ee06);}(_0x502d,0x1c6));var _0xd502=function(_0x4fb1b8,_0x32d98d){_0x4fb1b8=_0x4fb1b8-0x0;var _0x146c71=_0x502d[_0x4fb1b8];return _0x146c71;};'use strict';var client=require(_0xd502('0x0'));exports[_0xd502('0x1')]=function(_0xa257c){return client[_0xd502('0x2')]('CreateChatMessage',{'body':_0xa257c,'log':'createChatMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueue.js b/server/services/routing/rpc/chatQueue.js index 8162419..46c66a7 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 _0x097c=['name','timeout','strategy','User','chatPause','../client','getChatQueues','Request'];(function(_0x17b448,_0x108083){var _0x76d80c=function(_0x132a15){while(--_0x132a15){_0x17b448['push'](_0x17b448['shift']());}};_0x76d80c(++_0x108083);}(_0x097c,0x1d5));var _0xc097=function(_0xb232f2,_0x26b1f7){_0xb232f2=_0xb232f2-0x0;var _0xb52e52=_0x097c[_0xb232f2];return _0xb52e52;};'use strict';var client=require(_0xc097('0x0'));exports[_0xc097('0x1')]=function(){return function(){return client[_0xc097('0x2')]('GetChatQueue',{'options':{'raw':![],'attributes':['id',_0xc097('0x3'),_0xc097('0x4'),_0xc097('0x5')],'include':[{'model':_0xc097('0x6'),'as':'Agents','attributes':['id',_0xc097('0x3'),'online',_0xc097('0x7')]}]},'log':_0xc097('0x1')});};}; \ No newline at end of file +var _0x90b5=['getChatQueues','../client','Request','GetChatQueue','name','timeout','Agents','chatPause'];(function(_0xe9a5c6,_0x14182b){var _0xcd77c5=function(_0x5db021){while(--_0x5db021){_0xe9a5c6['push'](_0xe9a5c6['shift']());}};_0xcd77c5(++_0x14182b);}(_0x90b5,0x139));var _0x590b=function(_0xc2ccce,_0x396c5f){_0xc2ccce=_0xc2ccce-0x0;var _0x400662=_0x90b5[_0xc2ccce];return _0x400662;};'use strict';var client=require(_0x590b('0x0'));exports['getChatQueues']=function(){return function(){return client[_0x590b('0x1')](_0x590b('0x2'),{'options':{'raw':![],'attributes':['id',_0x590b('0x3'),_0x590b('0x4'),'strategy'],'include':[{'model':'User','as':_0x590b('0x5'),'attributes':['id',_0x590b('0x3'),'online',_0x590b('0x6')]}]},'log':_0x590b('0x7')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/chatQueueReport.js b/server/services/routing/rpc/chatQueueReport.js index a80efdc..ca21af9 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 _0x5d31=['CreateChatQueueReport','UpdateChatQueueReport','DESC','../client','create'];(function(_0xe87238,_0xb062c3){var _0x531750=function(_0x597a17){while(--_0x597a17){_0xe87238['push'](_0xe87238['shift']());}};_0x531750(++_0xb062c3);}(_0x5d31,0xb7));var _0x15d3=function(_0x4a2b3c,_0xc69f59){_0x4a2b3c=_0x4a2b3c-0x0;var _0x4b081b=_0x5d31[_0x4a2b3c];return _0x4b081b;};'use strict';var client=require(_0x15d3('0x0'));exports[_0x15d3('0x1')]=function(_0x255280){return client['Request'](_0x15d3('0x2'),{'body':_0x255280,'log':_0x15d3('0x2')});};exports['update']=function(_0x19b9b6,_0x526c77){return client['Request'](_0x15d3('0x3'),{'body':_0x526c77,'options':{'where':{'uniqueid':_0x19b9b6},'order':[['id',_0x15d3('0x4')]],'limit':0x1},'log':_0x15d3('0x3')});}; \ No newline at end of file +var _0x80c7=['update','UpdateChatQueueReport','DESC','../client','create','Request'];(function(_0x5ba096,_0x13ce9c){var _0x528823=function(_0x48cde4){while(--_0x48cde4){_0x5ba096['push'](_0x5ba096['shift']());}};_0x528823(++_0x13ce9c);}(_0x80c7,0x8d));var _0x780c=function(_0x2b3ede,_0x92c1c7){_0x2b3ede=_0x2b3ede-0x0;var _0x5845db=_0x80c7[_0x2b3ede];return _0x5845db;};'use strict';var client=require(_0x780c('0x0'));exports[_0x780c('0x1')]=function(_0x2c48bf){return client[_0x780c('0x2')]('CreateChatQueueReport',{'body':_0x2c48bf,'log':'CreateChatQueueReport'});};exports[_0x780c('0x3')]=function(_0x5af044,_0x3a8676){return client[_0x780c('0x2')](_0x780c('0x4'),{'body':_0x3a8676,'options':{'where':{'uniqueid':_0x5af044},'order':[['id',_0x780c('0x5')]],'limit':0x1},'log':_0x780c('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxInteraction.js b/server/services/routing/rpc/faxInteraction.js index 60a65c1..1e50b26 100644 --- a/server/services/routing/rpc/faxInteraction.js +++ b/server/services/routing/rpc/faxInteraction.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7a54=['Request','UpdateFaxInteraction','addTags','AddTagsToFaxInteraction','../client','update'];(function(_0x1d4449,_0x495153){var _0x4dcde3=function(_0x36d549){while(--_0x36d549){_0x1d4449['push'](_0x1d4449['shift']());}};_0x4dcde3(++_0x495153);}(_0x7a54,0x106));var _0x47a5=function(_0x35faf2,_0x422c9c){_0x35faf2=_0x35faf2-0x0;var _0x139bc4=_0x7a54[_0x35faf2];return _0x139bc4;};'use strict';var client=require(_0x47a5('0x0'));exports[_0x47a5('0x1')]=function(_0x44b31e,_0x58157c){return client[_0x47a5('0x2')](_0x47a5('0x3'),{'body':_0x58157c,'options':{'where':{'id':_0x44b31e}},'log':'updateFaxInteraction'});};exports[_0x47a5('0x4')]=function(_0x11bf85,_0x2a1a7e){return client[_0x47a5('0x2')](_0x47a5('0x5'),{'body':_0x2a1a7e,'options':{'where':{'id':_0x11bf85}},'log':'addTagsToFaxInteraction'});}; \ No newline at end of file +var _0x9957=['Request','AddTagsToFaxInteraction','addTagsToFaxInteraction','../client','update','UpdateFaxInteraction','updateFaxInteraction','addTags'];(function(_0x47645f,_0x629091){var _0x40a4ed=function(_0x10e2f3){while(--_0x10e2f3){_0x47645f['push'](_0x47645f['shift']());}};_0x40a4ed(++_0x629091);}(_0x9957,0x93));var _0x7995=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0x9957[_0x2dafbe];return _0x58a45a;};'use strict';var client=require(_0x7995('0x0'));exports[_0x7995('0x1')]=function(_0x2722a3,_0x10a05d){return client['Request'](_0x7995('0x2'),{'body':_0x10a05d,'options':{'where':{'id':_0x2722a3}},'log':_0x7995('0x3')});};exports[_0x7995('0x4')]=function(_0x462a03,_0x576d89){return client[_0x7995('0x5')](_0x7995('0x6'),{'body':_0x576d89,'options':{'where':{'id':_0x462a03}},'log':_0x7995('0x7')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxMessage.js b/server/services/routing/rpc/faxMessage.js index 2c87d46..dfdaea0 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 _0x5dfc=['Request','createFaxMessage','../client','create'];(function(_0x55f8b4,_0x43f30d){var _0x2475f9=function(_0xdd6f4a){while(--_0xdd6f4a){_0x55f8b4['push'](_0x55f8b4['shift']());}};_0x2475f9(++_0x43f30d);}(_0x5dfc,0x96));var _0xc5df=function(_0x28b0a1,_0x99bd0a){_0x28b0a1=_0x28b0a1-0x0;var _0x21470c=_0x5dfc[_0x28b0a1];return _0x21470c;};'use strict';var client=require(_0xc5df('0x0'));exports[_0xc5df('0x1')]=function(_0x26c7f6){return client[_0xc5df('0x2')]('CreateFaxMessage',{'body':_0x26c7f6,'log':_0xc5df('0x3')});}; \ No newline at end of file +var _0x712d=['CreateFaxMessage','../client','create','Request'];(function(_0x219959,_0x169349){var _0x75c7a7=function(_0x2b7f59){while(--_0x2b7f59){_0x219959['push'](_0x219959['shift']());}};_0x75c7a7(++_0x169349);}(_0x712d,0xf1));var _0xd712=function(_0x2030f5,_0x556ba8){_0x2030f5=_0x2030f5-0x0;var _0x3c7de3=_0x712d[_0x2030f5];return _0x3c7de3;};'use strict';var client=require(_0xd712('0x0'));exports[_0xd712('0x1')]=function(_0x30a7fd){return client[_0xd712('0x2')](_0xd712('0x3'),{'body':_0x30a7fd,'log':'createFaxMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueue.js b/server/services/routing/rpc/faxQueue.js index b6b8823..a91b581 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 _0xc8f1=['Agents','online','faxPause','getFaxQueues','Request','name','timeout','strategy','User'];(function(_0x39818b,_0x50f436){var _0x414568=function(_0x3953b0){while(--_0x3953b0){_0x39818b['push'](_0x39818b['shift']());}};_0x414568(++_0x50f436);}(_0xc8f1,0x67));var _0x1c8f=function(_0x16b606,_0x42fbc8){_0x16b606=_0x16b606-0x0;var _0x4f21c8=_0xc8f1[_0x16b606];return _0x4f21c8;};'use strict';var client=require('../client');exports['getFaxQueues']=function(){return function(){return client[_0x1c8f('0x0')]('GetFaxQueue',{'options':{'raw':![],'attributes':['id',_0x1c8f('0x1'),_0x1c8f('0x2'),_0x1c8f('0x3')],'include':[{'model':_0x1c8f('0x4'),'as':_0x1c8f('0x5'),'attributes':['id',_0x1c8f('0x1'),_0x1c8f('0x6'),_0x1c8f('0x7')]}]},'log':_0x1c8f('0x8')});};}; \ No newline at end of file +var _0x0195=['GetFaxQueue','timeout','strategy','Agents','name','online','faxPause','../client','getFaxQueues','Request'];(function(_0x26898a,_0x2a3329){var _0x44f18a=function(_0x124e63){while(--_0x124e63){_0x26898a['push'](_0x26898a['shift']());}};_0x44f18a(++_0x2a3329);}(_0x0195,0xf7));var _0x5019=function(_0x4aeeca,_0x4d35f9){_0x4aeeca=_0x4aeeca-0x0;var _0x3a58f=_0x0195[_0x4aeeca];return _0x3a58f;};'use strict';var client=require(_0x5019('0x0'));exports[_0x5019('0x1')]=function(){return function(){return client[_0x5019('0x2')](_0x5019('0x3'),{'options':{'raw':![],'attributes':['id','name',_0x5019('0x4'),_0x5019('0x5')],'include':[{'model':'User','as':_0x5019('0x6'),'attributes':['id',_0x5019('0x7'),_0x5019('0x8'),_0x5019('0x9')]}]},'log':'getFaxQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/faxQueueReport.js b/server/services/routing/rpc/faxQueueReport.js index 84f4d69..09f4786 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 _0xf26b=['DESC','UpdateFaxQueueReport','create','CreateFaxQueueReport','Request'];(function(_0x341d7a,_0x189e7b){var _0x290d54=function(_0x114a0f){while(--_0x114a0f){_0x341d7a['push'](_0x341d7a['shift']());}};_0x290d54(++_0x189e7b);}(_0xf26b,0x66));var _0xbf26=function(_0x1d29ec,_0x3e7fed){_0x1d29ec=_0x1d29ec-0x0;var _0x2a2bf7=_0xf26b[_0x1d29ec];return _0x2a2bf7;};'use strict';var client=require('../client');exports[_0xbf26('0x0')]=function(_0xc9a3b5){return client['Request']('CreateFaxQueueReport',{'body':_0xc9a3b5,'log':_0xbf26('0x1')});};exports['update']=function(_0x1cc18f,_0x2b9922){return client[_0xbf26('0x2')]('UpdateFaxQueueReport',{'body':_0x2b9922,'options':{'where':{'uniqueid':_0x1cc18f},'order':[['id',_0xbf26('0x3')]],'limit':0x1},'log':_0xbf26('0x4')});}; \ No newline at end of file +var _0x5c29=['update','Request','UpdateFaxQueueReport','DESC','../client','CreateFaxQueueReport'];(function(_0x1702b8,_0x28c7da){var _0x50028a=function(_0x4135b1){while(--_0x4135b1){_0x1702b8['push'](_0x1702b8['shift']());}};_0x50028a(++_0x28c7da);}(_0x5c29,0x1ba));var _0x95c2=function(_0x1649e0,_0x32d287){_0x1649e0=_0x1649e0-0x0;var _0x41a57c=_0x5c29[_0x1649e0];return _0x41a57c;};'use strict';var client=require(_0x95c2('0x0'));exports['create']=function(_0x2058f1){return client['Request']('CreateFaxQueueReport',{'body':_0x2058f1,'log':_0x95c2('0x1')});};exports[_0x95c2('0x2')]=function(_0x5ba9f1,_0x3ebd17){return client[_0x95c2('0x3')](_0x95c2('0x4'),{'body':_0x3ebd17,'options':{'where':{'uniqueid':_0x5ba9f1},'order':[['id',_0x95c2('0x5')]],'limit':0x1},'log':_0x95c2('0x4')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/interval.js b/server/services/routing/rpc/interval.js index 602c210..1867ec1 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 _0x6282=['interval','getIntervals','../client','Request','GetInterval','name','Interval','Intervals'];(function(_0x59ee6f,_0x450239){var _0x4c0979=function(_0x565e92){while(--_0x565e92){_0x59ee6f['push'](_0x59ee6f['shift']());}};_0x4c0979(++_0x450239);}(_0x6282,0x162));var _0x2628=function(_0x556345,_0xafb99d){_0x556345=_0x556345-0x0;var _0x266231=_0x6282[_0x556345];return _0x266231;};'use strict';var client=require(_0x2628('0x0'));exports['getIntervals']=function(){return function(){return client[_0x2628('0x1')](_0x2628('0x2'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0x2628('0x3')],'include':[{'model':_0x2628('0x4'),'as':_0x2628('0x5'),'attributes':['id',_0x2628('0x3'),_0x2628('0x6')]}]},'log':_0x2628('0x7')});};}; \ No newline at end of file +var _0xa02f=['Interval','interval','../client','getIntervals','Request','GetInterval','name'];(function(_0x22663b,_0xc8c6e3){var _0x310d0a=function(_0x151e66){while(--_0x151e66){_0x22663b['push'](_0x22663b['shift']());}};_0x310d0a(++_0xc8c6e3);}(_0xa02f,0x79));var _0xfa02=function(_0x2affd7,_0x217a0d){_0x2affd7=_0x2affd7-0x0;var _0x342075=_0xa02f[_0x2affd7];return _0x342075;};'use strict';var client=require(_0xfa02('0x0'));exports[_0xfa02('0x1')]=function(){return function(){return client[_0xfa02('0x2')](_0xfa02('0x3'),{'options':{'raw':![],'where':{'IntervalId':null},'attributes':['id',_0xfa02('0x4')],'include':[{'model':_0xfa02('0x5'),'as':'Intervals','attributes':['id','name',_0xfa02('0x6')]}]},'log':_0xfa02('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailInteraction.js b/server/services/routing/rpc/mailInteraction.js index ede46de..a66b05b 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 _0x5c3c=['AddTagsToMailInteraction','addTagsToChatInteraction','../client','update','UpdateMailInteraction','updateMailInteraction','addTags','Request'];(function(_0x2afea8,_0x197607){var _0x479ce1=function(_0x4a4a3e){while(--_0x4a4a3e){_0x2afea8['push'](_0x2afea8['shift']());}};_0x479ce1(++_0x197607);}(_0x5c3c,0x132));var _0xc5c3=function(_0x47a349,_0x4699d9){_0x47a349=_0x47a349-0x0;var _0x18ab75=_0x5c3c[_0x47a349];return _0x18ab75;};'use strict';var client=require(_0xc5c3('0x0'));exports[_0xc5c3('0x1')]=function(_0x11705d,_0x32103c){return client['Request'](_0xc5c3('0x2'),{'body':_0x32103c,'options':{'where':{'id':_0x11705d}},'log':_0xc5c3('0x3')});};exports[_0xc5c3('0x4')]=function(_0x2a3649,_0x2535e0){return client[_0xc5c3('0x5')](_0xc5c3('0x6'),{'body':_0x2535e0,'options':{'where':{'id':_0x2a3649}},'log':_0xc5c3('0x7')});}; \ No newline at end of file +var _0x2542=['AddTagsToMailInteraction','../client','update','UpdateMailInteraction','addTags','Request'];(function(_0x1f1aa5,_0x1cd29b){var _0x2cf619=function(_0x795c53){while(--_0x795c53){_0x1f1aa5['push'](_0x1f1aa5['shift']());}};_0x2cf619(++_0x1cd29b);}(_0x2542,0x169));var _0x2254=function(_0x5337a8,_0x3da6c7){_0x5337a8=_0x5337a8-0x0;var _0x1a6136=_0x2542[_0x5337a8];return _0x1a6136;};'use strict';var client=require(_0x2254('0x0'));exports[_0x2254('0x1')]=function(_0x2f3bcd,_0x20dfee){return client['Request'](_0x2254('0x2'),{'body':_0x20dfee,'options':{'where':{'id':_0x2f3bcd}},'log':'updateMailInteraction'});};exports[_0x2254('0x3')]=function(_0x3b3dcb,_0x27f5c9){return client[_0x2254('0x4')](_0x2254('0x5'),{'body':_0x27f5c9,'options':{'where':{'id':_0x3b3dcb}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailMessage.js b/server/services/routing/rpc/mailMessage.js index 140a3f8..b3161f5 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 _0x5bf7=['../client','create','Request','CreateMailMessage'];(function(_0x34423a,_0x5eeca1){var _0xd82e74=function(_0x2cc409){while(--_0x2cc409){_0x34423a['push'](_0x34423a['shift']());}};_0xd82e74(++_0x5eeca1);}(_0x5bf7,0x174));var _0x75bf=function(_0x52c571,_0x380558){_0x52c571=_0x52c571-0x0;var _0x1743d7=_0x5bf7[_0x52c571];return _0x1743d7;};'use strict';var client=require(_0x75bf('0x0'));exports[_0x75bf('0x1')]=function(_0x25c7e6){return client[_0x75bf('0x2')](_0x75bf('0x3'),{'body':_0x25c7e6,'log':'createMailMessage'});}; \ No newline at end of file +var _0x9390=['CreateMailMessage','../client','create','Request'];(function(_0x1f81ea,_0x142319){var _0x4c655a=function(_0x32ff02){while(--_0x32ff02){_0x1f81ea['push'](_0x1f81ea['shift']());}};_0x4c655a(++_0x142319);}(_0x9390,0x1bd));var _0x0939=function(_0x53a384,_0x176a11){_0x53a384=_0x53a384-0x0;var _0x28be24=_0x9390[_0x53a384];return _0x28be24;};'use strict';var client=require(_0x0939('0x0'));exports[_0x0939('0x1')]=function(_0x81fe2e){return client[_0x0939('0x2')](_0x0939('0x3'),{'body':_0x81fe2e,'log':'createMailMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueue.js b/server/services/routing/rpc/mailQueue.js index a1f6f54..e485773 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 _0xb69c=['name','online','mailPause','../client','getMailQueues','GetMailQueue','timeout','strategy','User','Agents'];(function(_0x1d2195,_0x4b8096){var _0x4962cd=function(_0x301f5a){while(--_0x301f5a){_0x1d2195['push'](_0x1d2195['shift']());}};_0x4962cd(++_0x4b8096);}(_0xb69c,0x1d9));var _0xcb69=function(_0x5cf30e,_0x4b32eb){_0x5cf30e=_0x5cf30e-0x0;var _0x29d12e=_0xb69c[_0x5cf30e];return _0x29d12e;};'use strict';var client=require(_0xcb69('0x0'));exports[_0xcb69('0x1')]=function(){return function(){return client['Request'](_0xcb69('0x2'),{'options':{'raw':![],'attributes':['id','name',_0xcb69('0x3'),_0xcb69('0x4')],'include':[{'model':_0xcb69('0x5'),'as':_0xcb69('0x6'),'attributes':['id',_0xcb69('0x7'),_0xcb69('0x8'),_0xcb69('0x9')]}]},'log':_0xcb69('0x1')});};}; \ No newline at end of file +var _0xc298=['mailPause','../client','getMailQueues','Request','GetMailQueue','name','timeout','strategy','User','Agents'];(function(_0x40397e,_0x7554ba){var _0x30152d=function(_0x112731){while(--_0x112731){_0x40397e['push'](_0x40397e['shift']());}};_0x30152d(++_0x7554ba);}(_0xc298,0x1c3));var _0x8c29=function(_0x38e621,_0x22ceb4){_0x38e621=_0x38e621-0x0;var _0x15cdef=_0xc298[_0x38e621];return _0x15cdef;};'use strict';var client=require(_0x8c29('0x0'));exports[_0x8c29('0x1')]=function(){return function(){return client[_0x8c29('0x2')](_0x8c29('0x3'),{'options':{'raw':![],'attributes':['id',_0x8c29('0x4'),_0x8c29('0x5'),_0x8c29('0x6')],'include':[{'model':_0x8c29('0x7'),'as':_0x8c29('0x8'),'attributes':['id',_0x8c29('0x4'),'online',_0x8c29('0x9')]}]},'log':_0x8c29('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/mailQueueReport.js b/server/services/routing/rpc/mailQueueReport.js index 820b1f5..54fc0a1 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 _0x3aa2=['UpdateMailQueueReport','DESC','../client','Request','CreateMailQueueReport','update'];(function(_0x160c73,_0x2ee678){var _0xd9302=function(_0x169454){while(--_0x169454){_0x160c73['push'](_0x160c73['shift']());}};_0xd9302(++_0x2ee678);}(_0x3aa2,0xd4));var _0x23aa=function(_0x836465,_0x5442ae){_0x836465=_0x836465-0x0;var _0x2150ea=_0x3aa2[_0x836465];return _0x2150ea;};'use strict';var client=require(_0x23aa('0x0'));exports['create']=function(_0x2e2182){return client[_0x23aa('0x1')](_0x23aa('0x2'),{'body':_0x2e2182,'log':'CreateMailQueueReport'});};exports[_0x23aa('0x3')]=function(_0x89c0fe,_0x498321){return client[_0x23aa('0x1')](_0x23aa('0x4'),{'body':_0x498321,'options':{'where':{'uniqueid':_0x89c0fe},'order':[['id',_0x23aa('0x5')]],'limit':0x1},'log':_0x23aa('0x4')});}; \ No newline at end of file +var _0x1cda=['create','CreateMailQueueReport','update','UpdateMailQueueReport','DESC'];(function(_0x532cab,_0x118d41){var _0x530c8f=function(_0x4e5f66){while(--_0x4e5f66){_0x532cab['push'](_0x532cab['shift']());}};_0x530c8f(++_0x118d41);}(_0x1cda,0x177));var _0xa1cd=function(_0x221906,_0x2c03e9){_0x221906=_0x221906-0x0;var _0x3221f1=_0x1cda[_0x221906];return _0x3221f1;};'use strict';var client=require('../client');exports[_0xa1cd('0x0')]=function(_0x311281){return client['Request'](_0xa1cd('0x1'),{'body':_0x311281,'log':_0xa1cd('0x1')});};exports[_0xa1cd('0x2')]=function(_0x43c713,_0x59ee8c){return client['Request'](_0xa1cd('0x3'),{'body':_0x59ee8c,'options':{'where':{'uniqueid':_0x43c713},'order':[['id',_0xa1cd('0x4')]],'limit':0x1},'log':_0xa1cd('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelInteraction.js b/server/services/routing/rpc/openchannelInteraction.js index a117bed..5baf869 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 _0xa85d=['AddTagsToOpenchannelInteraction','addTagsToChatInteraction','../client','update','UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','Request'];(function(_0x358806,_0x322b66){var _0x19fdcb=function(_0xe01b8d){while(--_0xe01b8d){_0x358806['push'](_0x358806['shift']());}};_0x19fdcb(++_0x322b66);}(_0xa85d,0x16a));var _0xda85=function(_0x3c6741,_0x24c6f0){_0x3c6741=_0x3c6741-0x0;var _0x5d3310=_0xa85d[_0x3c6741];return _0x5d3310;};'use strict';var client=require(_0xda85('0x0'));exports[_0xda85('0x1')]=function(_0xcd3ea4,_0x593778){return client['Request'](_0xda85('0x2'),{'body':_0x593778,'options':{'where':{'id':_0xcd3ea4}},'log':_0xda85('0x3')});};exports[_0xda85('0x4')]=function(_0x14da72,_0x31c19d){return client[_0xda85('0x5')](_0xda85('0x6'),{'body':_0x31c19d,'options':{'where':{'id':_0x14da72}},'log':_0xda85('0x7')});}; \ No newline at end of file +var _0xdc68=['UpdateOpenchannelInteraction','updateOpenchannelInteraction','addTags','AddTagsToOpenchannelInteraction','Request'];(function(_0xa8915a,_0x507c3c){var _0x4a1e98=function(_0x390646){while(--_0x390646){_0xa8915a['push'](_0xa8915a['shift']());}};_0x4a1e98(++_0x507c3c);}(_0xdc68,0xd1));var _0x8dc6=function(_0xbd1dd1,_0x4dd9fe){_0xbd1dd1=_0xbd1dd1-0x0;var _0x3824ba=_0xdc68[_0xbd1dd1];return _0x3824ba;};'use strict';var client=require('../client');exports['update']=function(_0x17905f,_0x2295a6){return client[_0x8dc6('0x0')](_0x8dc6('0x1'),{'body':_0x2295a6,'options':{'where':{'id':_0x17905f}},'log':_0x8dc6('0x2')});};exports[_0x8dc6('0x3')]=function(_0x478f64,_0x215d51){return client[_0x8dc6('0x0')](_0x8dc6('0x4'),{'body':_0x215d51,'options':{'where':{'id':_0x478f64}},'log':'addTagsToChatInteraction'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelMessage.js b/server/services/routing/rpc/openchannelMessage.js index 0866e7a..6976ca9 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 _0x03f7=['Request','CreateOpenchannelMessage','createOpenchannelMessage','../client','create'];(function(_0x31254f,_0x48eddc){var _0x579a57=function(_0xf0ac31){while(--_0xf0ac31){_0x31254f['push'](_0x31254f['shift']());}};_0x579a57(++_0x48eddc);}(_0x03f7,0x161));var _0x703f=function(_0x530165,_0x3cca7e){_0x530165=_0x530165-0x0;var _0x282285=_0x03f7[_0x530165];return _0x282285;};'use strict';var client=require(_0x703f('0x0'));exports[_0x703f('0x1')]=function(_0x222895){return client[_0x703f('0x2')](_0x703f('0x3'),{'body':_0x222895,'log':_0x703f('0x4')});}; \ No newline at end of file +var _0xb7d4=['createOpenchannelMessage','create'];(function(_0x5837a4,_0x15c0f7){var _0x1feb62=function(_0x17d586){while(--_0x17d586){_0x5837a4['push'](_0x5837a4['shift']());}};_0x1feb62(++_0x15c0f7);}(_0xb7d4,0x15d));var _0x4b7d=function(_0x47aa64,_0xfb8a07){_0x47aa64=_0x47aa64-0x0;var _0x549c7a=_0xb7d4[_0x47aa64];return _0x549c7a;};'use strict';var client=require('../client');exports[_0x4b7d('0x0')]=function(_0x5b738c){return client['Request']('CreateOpenchannelMessage',{'body':_0x5b738c,'log':_0x4b7d('0x1')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueue.js b/server/services/routing/rpc/openchannelQueue.js index be84cda..86e743e 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 _0x8bc6=['name','timeout','strategy','User','Agents','online','openchannelPause','GetOpenchannelQueue'];(function(_0x30e5c6,_0x7ab5d){var _0x14483a=function(_0x1e9564){while(--_0x1e9564){_0x30e5c6['push'](_0x30e5c6['shift']());}};_0x14483a(++_0x7ab5d);}(_0x8bc6,0x137));var _0x68bc=function(_0x5e6eac,_0x7d6b04){_0x5e6eac=_0x5e6eac-0x0;var _0x27afd9=_0x8bc6[_0x5e6eac];return _0x27afd9;};'use strict';var client=require('../client');exports['getOpenchannelQueues']=function(){return function(){return client['Request'](_0x68bc('0x0'),{'options':{'raw':![],'attributes':['id',_0x68bc('0x1'),_0x68bc('0x2'),_0x68bc('0x3')],'include':[{'model':_0x68bc('0x4'),'as':_0x68bc('0x5'),'attributes':['id',_0x68bc('0x1'),_0x68bc('0x6'),_0x68bc('0x7')]}]},'log':'getOpenchannelQueues'});};}; \ No newline at end of file +var _0x165b=['strategy','User','Agents','../client','getOpenchannelQueues','name','timeout'];(function(_0x5f0d09,_0xd39be6){var _0x21de3a=function(_0x229d55){while(--_0x229d55){_0x5f0d09['push'](_0x5f0d09['shift']());}};_0x21de3a(++_0xd39be6);}(_0x165b,0x1ed));var _0xb165=function(_0x3ea118,_0x133443){_0x3ea118=_0x3ea118-0x0;var _0x8c9434=_0x165b[_0x3ea118];return _0x8c9434;};'use strict';var client=require(_0xb165('0x0'));exports[_0xb165('0x1')]=function(){return function(){return client['Request']('GetOpenchannelQueue',{'options':{'raw':![],'attributes':['id',_0xb165('0x2'),_0xb165('0x3'),_0xb165('0x4')],'include':[{'model':_0xb165('0x5'),'as':_0xb165('0x6'),'attributes':['id',_0xb165('0x2'),'online','openchannelPause']}]},'log':_0xb165('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/openchannelQueueReport.js b/server/services/routing/rpc/openchannelQueueReport.js index 5b7d612..6a05808 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 _0x8bd6=['../client','Request','CreateOpenchannelQueueReport','update','UpdateOpenchannelQueueReport','DESC'];(function(_0x2641f9,_0x26715f){var _0x585741=function(_0x2d1462){while(--_0x2d1462){_0x2641f9['push'](_0x2641f9['shift']());}};_0x585741(++_0x26715f);}(_0x8bd6,0x1e0));var _0x68bd=function(_0x348b9c,_0x81df39){_0x348b9c=_0x348b9c-0x0;var _0x13ed5b=_0x8bd6[_0x348b9c];return _0x13ed5b;};'use strict';var client=require(_0x68bd('0x0'));exports['create']=function(_0x30dee0){return client[_0x68bd('0x1')](_0x68bd('0x2'),{'body':_0x30dee0,'log':_0x68bd('0x2')});};exports[_0x68bd('0x3')]=function(_0x3e9eec,_0x386818){return client[_0x68bd('0x1')](_0x68bd('0x4'),{'body':_0x386818,'options':{'where':{'uniqueid':_0x3e9eec},'order':[['id',_0x68bd('0x5')]],'limit':0x1},'log':_0x68bd('0x4')});}; \ No newline at end of file +var _0x3946=['create','Request','CreateOpenchannelQueueReport','UpdateOpenchannelQueueReport'];(function(_0x32107a,_0x16d5e3){var _0x4fdb14=function(_0x24e51f){while(--_0x24e51f){_0x32107a['push'](_0x32107a['shift']());}};_0x4fdb14(++_0x16d5e3);}(_0x3946,0x1d0));var _0x6394=function(_0x5b1c9c,_0x47981a){_0x5b1c9c=_0x5b1c9c-0x0;var _0x977fd3=_0x3946[_0x5b1c9c];return _0x977fd3;};'use strict';var client=require('../client');exports[_0x6394('0x0')]=function(_0x450139){return client[_0x6394('0x1')](_0x6394('0x2'),{'body':_0x450139,'log':_0x6394('0x2')});};exports['update']=function(_0x18ead0,_0x2dbc9b){return client[_0x6394('0x1')](_0x6394('0x3'),{'body':_0x2dbc9b,'options':{'where':{'uniqueid':_0x18ead0},'order':[['id','DESC']],'limit':0x1},'log':_0x6394('0x3')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsInteraction.js b/server/services/routing/rpc/smsInteraction.js index de104f5..01f367f 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 _0xe700=['updateSmsInteraction','addTagsToSmsInteraction','../client','update','Request'];(function(_0x3a0c4f,_0x5dd1a3){var _0x247049=function(_0x144695){while(--_0x144695){_0x3a0c4f['push'](_0x3a0c4f['shift']());}};_0x247049(++_0x5dd1a3);}(_0xe700,0x16a));var _0x0e70=function(_0x66cac0,_0x3c9a38){_0x66cac0=_0x66cac0-0x0;var _0x8a0e4e=_0xe700[_0x66cac0];return _0x8a0e4e;};'use strict';var client=require(_0x0e70('0x0'));exports[_0x0e70('0x1')]=function(_0x245ff7,_0x1c63f0){return client[_0x0e70('0x2')]('UpdateSmsInteraction',{'body':_0x1c63f0,'options':{'where':{'id':_0x245ff7}},'log':_0x0e70('0x3')});};exports['addTags']=function(_0x20335e,_0x2cc22e){return client['Request']('AddTagsToSmsInteraction',{'body':_0x2cc22e,'options':{'where':{'id':_0x20335e}},'log':_0x0e70('0x4')});}; \ No newline at end of file +var _0xbe48=['addTagsToSmsInteraction','../client','update','Request','addTags','AddTagsToSmsInteraction'];(function(_0x34311c,_0x52a317){var _0x4b8b35=function(_0x16888a){while(--_0x16888a){_0x34311c['push'](_0x34311c['shift']());}};_0x4b8b35(++_0x52a317);}(_0xbe48,0x121));var _0x8be4=function(_0x4f208b,_0x7cca1b){_0x4f208b=_0x4f208b-0x0;var _0x579e5e=_0xbe48[_0x4f208b];return _0x579e5e;};'use strict';var client=require(_0x8be4('0x0'));exports[_0x8be4('0x1')]=function(_0x342d11,_0x2c6733){return client[_0x8be4('0x2')]('UpdateSmsInteraction',{'body':_0x2c6733,'options':{'where':{'id':_0x342d11}},'log':'updateSmsInteraction'});};exports[_0x8be4('0x3')]=function(_0x95e50e,_0x53fdb0){return client[_0x8be4('0x2')](_0x8be4('0x4'),{'body':_0x53fdb0,'options':{'where':{'id':_0x95e50e}},'log':_0x8be4('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsMessage.js b/server/services/routing/rpc/smsMessage.js index 0425b8c..fa0dd24 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 _0x9503=['CreateSmsMessage','Request'];(function(_0x2e0d05,_0x20cf24){var _0x46c076=function(_0x90ca12){while(--_0x90ca12){_0x2e0d05['push'](_0x2e0d05['shift']());}};_0x46c076(++_0x20cf24);}(_0x9503,0xbb));var _0x3950=function(_0x214873,_0x347ab0){_0x214873=_0x214873-0x0;var _0x26b7d4=_0x9503[_0x214873];return _0x26b7d4;};'use strict';var client=require('../client');exports['create']=function(_0x1921f3){return client[_0x3950('0x0')](_0x3950('0x1'),{'body':_0x1921f3,'log':'createSmsMessage'});}; \ No newline at end of file +var _0xa3c9=['Request','createSmsMessage','../client'];(function(_0x23c40a,_0x59fac8){var _0x2963d1=function(_0x1089ab){while(--_0x1089ab){_0x23c40a['push'](_0x23c40a['shift']());}};_0x2963d1(++_0x59fac8);}(_0xa3c9,0x13d));var _0x9a3c=function(_0x401676,_0x3f1436){_0x401676=_0x401676-0x0;var _0x4f13fe=_0xa3c9[_0x401676];return _0x4f13fe;};'use strict';var client=require(_0x9a3c('0x0'));exports['create']=function(_0x16ee16){return client[_0x9a3c('0x1')]('CreateSmsMessage',{'body':_0x16ee16,'log':_0x9a3c('0x2')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueue.js b/server/services/routing/rpc/smsQueue.js index 2bec80f..0234aa7 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 _0xe706=['Agents','online','smsPause','../client','getSmsQueues','Request','name','timeout','strategy','User'];(function(_0x4a6662,_0x2ad0db){var _0x5f5691=function(_0x460d97){while(--_0x460d97){_0x4a6662['push'](_0x4a6662['shift']());}};_0x5f5691(++_0x2ad0db);}(_0xe706,0xa3));var _0x6e70=function(_0x268e0c,_0x1ef7d1){_0x268e0c=_0x268e0c-0x0;var _0x97a5fb=_0xe706[_0x268e0c];return _0x97a5fb;};'use strict';var client=require(_0x6e70('0x0'));exports[_0x6e70('0x1')]=function(){return function(){return client[_0x6e70('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id',_0x6e70('0x3'),_0x6e70('0x4'),_0x6e70('0x5')],'include':[{'model':_0x6e70('0x6'),'as':_0x6e70('0x7'),'attributes':['id',_0x6e70('0x3'),_0x6e70('0x8'),_0x6e70('0x9')]}]},'log':_0x6e70('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','online','smsPause','../client','getSmsQueues','Request','timeout','User','Agents'];(function(_0x177943,_0x426cca){var _0x16aacc=function(_0x2553c2){while(--_0x2553c2){_0x177943['push'](_0x177943['shift']());}};_0x16aacc(++_0x426cca);}(_0xa9e0,0x123));var _0x0a9e=function(_0x173d7e,_0x3242fd){_0x173d7e=_0x173d7e-0x0;var _0x2220d6=_0xa9e0[_0x173d7e];return _0x2220d6;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetSmsQueue',{'options':{'raw':![],'attributes':['id','name',_0x0a9e('0x3'),'strategy'],'include':[{'model':_0x0a9e('0x4'),'as':_0x0a9e('0x5'),'attributes':['id',_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8')]}]},'log':'getSmsQueues'});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/smsQueueReport.js b/server/services/routing/rpc/smsQueueReport.js index 9bfdea9..51a31d0 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 _0xedd9=['create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x2d0d9f,_0x22c0d8){var _0x30243d=function(_0x29a92b){while(--_0x29a92b){_0x2d0d9f['push'](_0x2d0d9f['shift']());}};_0x30243d(++_0x22c0d8);}(_0xedd9,0xfc));var _0x9edd=function(_0x112363,_0x34a2bc){_0x112363=_0x112363-0x0;var _0x5dcedd=_0xedd9[_0x112363];return _0x5dcedd;};'use strict';var client=require('../client');exports[_0x9edd('0x0')]=function(_0x2d7989){return client[_0x9edd('0x1')](_0x9edd('0x2'),{'body':_0x2d7989,'log':_0x9edd('0x2')});};exports[_0x9edd('0x3')]=function(_0x3e6d3a,_0x36b53f){return client['Request'](_0x9edd('0x4'),{'body':_0x36b53f,'options':{'where':{'uniqueid':_0x3e6d3a},'order':[['id',_0x9edd('0x5')]],'limit':0x1},'log':_0x9edd('0x4')});}; \ No newline at end of file +var _0x008c=['../client','create','Request','CreateSmsQueueReport','update','UpdateSmsQueueReport','DESC'];(function(_0x320cb3,_0x49c0cf){var _0x899c86=function(_0x9fc8f){while(--_0x9fc8f){_0x320cb3['push'](_0x320cb3['shift']());}};_0x899c86(++_0x49c0cf);}(_0x008c,0x188));var _0xc008=function(_0x32bb6b,_0x1a5fbe){_0x32bb6b=_0x32bb6b-0x0;var _0x58dcb4=_0x008c[_0x32bb6b];return _0x58dcb4;};'use strict';var client=require(_0xc008('0x0'));exports[_0xc008('0x1')]=function(_0x15aadc){return client[_0xc008('0x2')](_0xc008('0x3'),{'body':_0x15aadc,'log':'CreateSmsQueueReport'});};exports[_0xc008('0x4')]=function(_0x47063f,_0x10b33c){return client[_0xc008('0x2')](_0xc008('0x5'),{'body':_0x10b33c,'options':{'where':{'uniqueid':_0x47063f},'order':[['id',_0xc008('0x6')]],'limit':0x1},'log':_0xc008('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/user.js b/server/services/routing/rpc/user.js index 4c881b8..79014d8 100644 --- a/server/services/routing/rpc/user.js +++ b/server/services/routing/rpc/user.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0xd36ebc,_0x135565){var _0x4d0035=function(_0x2d40e7){while(--_0x2d40e7){_0xd36ebc['push'](_0xd36ebc['shift']());}};_0x4d0035(++_0x135565);}(_0xa9e0,0x123));var _0x0a9e=function(_0x521929,_0x479be5){_0x521929=_0x521929-0x0;var _0x632436=_0xa9e0[_0x521929];return _0x632436;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file +var _0xa9e0=['name','pauseType','lastPauseAt','voicePause','chatPause','mailPause','smsPause','whatsappPause','openchannelPause','faxCapacity','openchannelCapacity','../client','getAgents','Request'];(function(_0x15006b,_0x41370b){var _0xacb408=function(_0x20a93f){while(--_0x20a93f){_0x15006b['push'](_0x15006b['shift']());}};_0xacb408(++_0x41370b);}(_0xa9e0,0x123));var _0x0a9e=function(_0x1da04e,_0x31024b){_0x1da04e=_0x1da04e-0x0;var _0xdd8c41=_0xa9e0[_0x1da04e];return _0xdd8c41;};'use strict';var client=require(_0x0a9e('0x0'));exports[_0x0a9e('0x1')]=function(){return function(){return client[_0x0a9e('0x2')]('GetUser',{'options':{'raw':!![],'where':{'role':'agent'},'attributes':['id',_0x0a9e('0x3'),'online',_0x0a9e('0x4'),_0x0a9e('0x5'),_0x0a9e('0x6'),_0x0a9e('0x7'),_0x0a9e('0x8'),'faxPause',_0x0a9e('0x9'),_0x0a9e('0xa'),_0x0a9e('0xb'),'chatCapacity','mailCapacity',_0x0a9e('0xc'),'smsCapacity','whatsappCapacity',_0x0a9e('0xd')]},'log':_0x0a9e('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappInteraction.js b/server/services/routing/rpc/whatsappInteraction.js index d19bb9d..9db6a29 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 _0xdbb1=['../client','Request','addTags'];(function(_0x57524e,_0x236f11){var _0x4a0867=function(_0x472b27){while(--_0x472b27){_0x57524e['push'](_0x57524e['shift']());}};_0x4a0867(++_0x236f11);}(_0xdbb1,0x105));var _0x1dbb=function(_0x3511d3,_0x4107ae){_0x3511d3=_0x3511d3-0x0;var _0x5d6321=_0xdbb1[_0x3511d3];return _0x5d6321;};'use strict';var client=require(_0x1dbb('0x0'));exports['update']=function(_0x53f27d,_0x4b55f7){return client[_0x1dbb('0x1')]('UpdateWhatsappInteraction',{'body':_0x4b55f7,'options':{'where':{'id':_0x53f27d}},'log':'updateWhatsappInteraction'});};exports[_0x1dbb('0x2')]=function(_0x483e15,_0xa1e321){return client[_0x1dbb('0x1')]('AddTagsToWhatsappInteraction',{'body':_0xa1e321,'options':{'where':{'id':_0x483e15}},'log':'addTagsToWhatsappInteraction'});}; \ No newline at end of file +var _0x39e6=['AddTagsToWhatsappInteraction','addTagsToWhatsappInteraction','../client','UpdateWhatsappInteraction','updateWhatsappInteraction','Request'];(function(_0x2c5b45,_0xd3de9c){var _0x28e03f=function(_0x414344){while(--_0x414344){_0x2c5b45['push'](_0x2c5b45['shift']());}};_0x28e03f(++_0xd3de9c);}(_0x39e6,0x9e));var _0x639e=function(_0x4536ec,_0x4089fd){_0x4536ec=_0x4536ec-0x0;var _0x4015e5=_0x39e6[_0x4536ec];return _0x4015e5;};'use strict';var client=require(_0x639e('0x0'));exports['update']=function(_0x2b265a,_0x5719fc){return client['Request'](_0x639e('0x1'),{'body':_0x5719fc,'options':{'where':{'id':_0x2b265a}},'log':_0x639e('0x2')});};exports['addTags']=function(_0x467229,_0x207d6a){return client[_0x639e('0x3')](_0x639e('0x4'),{'body':_0x207d6a,'options':{'where':{'id':_0x467229}},'log':_0x639e('0x5')});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappMessage.js b/server/services/routing/rpc/whatsappMessage.js index 227b878..e8af8ee 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 _0x29f2=['create','CreateWhatsappMessage','createWhatsappMessage'];(function(_0x22b7a8,_0x114b71){var _0x4390b8=function(_0x4bd28b){while(--_0x4bd28b){_0x22b7a8['push'](_0x22b7a8['shift']());}};_0x4390b8(++_0x114b71);}(_0x29f2,0x153));var _0x229f=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x29f2[_0x3dd15e];return _0x231fd0;};'use strict';var client=require('../client');exports[_0x229f('0x0')]=function(_0x21ef0b){return client['Request'](_0x229f('0x1'),{'body':_0x21ef0b,'log':_0x229f('0x2')});}; \ No newline at end of file +var _0xeefe=['create','Request','CreateWhatsappMessage'];(function(_0x420d8d,_0x78b67f){var _0x4865d7=function(_0x2965df){while(--_0x2965df){_0x420d8d['push'](_0x420d8d['shift']());}};_0x4865d7(++_0x78b67f);}(_0xeefe,0x1b0));var _0xeeef=function(_0x3bb742,_0x166e23){_0x3bb742=_0x3bb742-0x0;var _0x54c01a=_0xeefe[_0x3bb742];return _0x54c01a;};'use strict';var client=require('../client');exports[_0xeeef('0x0')]=function(_0x19f90a){return client[_0xeeef('0x1')](_0xeeef('0x2'),{'body':_0x19f90a,'log':'createWhatsappMessage'});}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueue.js b/server/services/routing/rpc/whatsappQueue.js index 738bcd4..c31f7fa 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 _0x7b08=['getWhatsappQueues','name','timeout','User','Agents','whatsappPause','../client'];(function(_0x537152,_0x3349ea){var _0x264820=function(_0x4a1e77){while(--_0x4a1e77){_0x537152['push'](_0x537152['shift']());}};_0x264820(++_0x3349ea);}(_0x7b08,0x1bf));var _0x87b0=function(_0x523b0a,_0x204b5f){_0x523b0a=_0x523b0a-0x0;var _0x555c37=_0x7b08[_0x523b0a];return _0x555c37;};'use strict';var client=require(_0x87b0('0x0'));exports[_0x87b0('0x1')]=function(){return function(){return client['Request']('GetWhatsappQueue',{'options':{'raw':![],'attributes':['id',_0x87b0('0x2'),_0x87b0('0x3'),'strategy'],'include':[{'model':_0x87b0('0x4'),'as':_0x87b0('0x5'),'attributes':['id',_0x87b0('0x2'),'online',_0x87b0('0x6')]}]},'log':_0x87b0('0x1')});};}; \ No newline at end of file +var _0x6c45=['getWhatsappQueues','Request','GetWhatsappQueue','name','timeout','strategy','User','Agents','whatsappPause','../client'];(function(_0x2debde,_0x21e897){var _0x582d33=function(_0x8dd2b7){while(--_0x8dd2b7){_0x2debde['push'](_0x2debde['shift']());}};_0x582d33(++_0x21e897);}(_0x6c45,0x135));var _0x56c4=function(_0xd6e6bb,_0x286f80){_0xd6e6bb=_0xd6e6bb-0x0;var _0x1b3e90=_0x6c45[_0xd6e6bb];return _0x1b3e90;};'use strict';var client=require(_0x56c4('0x0'));exports[_0x56c4('0x1')]=function(){return function(){return client[_0x56c4('0x2')](_0x56c4('0x3'),{'options':{'raw':![],'attributes':['id',_0x56c4('0x4'),_0x56c4('0x5'),_0x56c4('0x6')],'include':[{'model':_0x56c4('0x7'),'as':_0x56c4('0x8'),'attributes':['id','name','online',_0x56c4('0x9')]}]},'log':_0x56c4('0x1')});};}; \ No newline at end of file diff --git a/server/services/routing/rpc/whatsappQueueReport.js b/server/services/routing/rpc/whatsappQueueReport.js index cf12fff..37e31fb 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 _0xe4b2=['../client','Request','CreateWhatsappQueueReport','update','DESC','UpdateWhatsappQueueReport'];(function(_0x3124f8,_0x1a8b23){var _0x5bab5f=function(_0x18b09b){while(--_0x18b09b){_0x3124f8['push'](_0x3124f8['shift']());}};_0x5bab5f(++_0x1a8b23);}(_0xe4b2,0x16e));var _0x2e4b=function(_0x3b88bb,_0x49b9df){_0x3b88bb=_0x3b88bb-0x0;var _0x4eb24e=_0xe4b2[_0x3b88bb];return _0x4eb24e;};'use strict';var client=require(_0x2e4b('0x0'));exports['create']=function(_0x111de9){return client[_0x2e4b('0x1')](_0x2e4b('0x2'),{'body':_0x111de9,'log':_0x2e4b('0x2')});};exports[_0x2e4b('0x3')]=function(_0x33829b,_0x3d6f6c){return client[_0x2e4b('0x1')]('UpdateWhatsappQueueReport',{'body':_0x3d6f6c,'options':{'where':{'uniqueid':_0x33829b},'order':[['id',_0x2e4b('0x4')]],'limit':0x1},'log':_0x2e4b('0x5')});}; \ No newline at end of file +var _0x7412=['DESC','UpdateWhatsappQueueReport','create','Request','CreateWhatsappQueueReport','update'];(function(_0x19c9ca,_0x29b98b){var _0x2c9520=function(_0x39f0ed){while(--_0x39f0ed){_0x19c9ca['push'](_0x19c9ca['shift']());}};_0x2c9520(++_0x29b98b);}(_0x7412,0x74));var _0x2741=function(_0x2be8c2,_0x14a4b5){_0x2be8c2=_0x2be8c2-0x0;var _0x97f531=_0x7412[_0x2be8c2];return _0x97f531;};'use strict';var client=require('../client');exports[_0x2741('0x0')]=function(_0x2ab0bc){return client[_0x2741('0x1')](_0x2741('0x2'),{'body':_0x2ab0bc,'log':_0x2741('0x2')});};exports[_0x2741('0x3')]=function(_0x458cd4,_0x4899ff){return client[_0x2741('0x1')]('UpdateWhatsappQueueReport',{'body':_0x4899ff,'options':{'where':{'uniqueid':_0x458cd4},'order':[['id',_0x2741('0x4')]],'limit':0x1},'log':_0x2741('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 45aea43..37e18ca 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 _0xeae4=['atimeout','channel','rules','end','[%s][AGENT]\x20ROUTING\x20STOPPED','complete','[%s][AGENT]\x20ROUTING\x20END','close','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','log','[%s][QUEUE]\x20%s','stack','validate','lodash','util','seq-queue','../../../../config/logger','./strategy','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','timeout\x20is\x20a\x20number','info','format','[%s][AGENT][NAME:%s][STATUS:%s]','name','toLowerCase','consequence','length','error','[%s][AGENT]\x20%s','map','join','stop','find','agents','timeout','createQueue'];(function(_0x279f6d,_0x122316){var _0x5874a5=function(_0x4823ae){while(--_0x4823ae){_0x279f6d['push'](_0x279f6d['shift']());}};_0x5874a5(++_0x122316);}(_0xeae4,0x1c6));var _0x4eae=function(_0x3d2b1,_0x18c2f6){_0x3d2b1=_0x3d2b1-0x0;var _0x407d7f=_0xeae4[_0x3d2b1];return _0x407d7f;};'use strict';var schema=require(_0x4eae('0x0'));var _=require(_0x4eae('0x1'));var util=require(_0x4eae('0x2'));var seqqueue=require(_0x4eae('0x3'));var logger=require(_0x4eae('0x4'))('routing');var strategy=require(_0x4eae('0x5'));var queue=schema({'name':{'type':_0x4eae('0x6'),'required':!![],'message':_0x4eae('0x7')},'timeout':{'type':_0x4eae('0x8'),'message':_0x4eae('0x9')}});function writeLog(_0x3d3560,_0x30b9e8,_0xd28a8f){return logger[_0x4eae('0xa')](util[_0x4eae('0xb')](_0x4eae('0xc'),_0x3d3560,_0x30b9e8[_0x4eae('0xd')],_0xd28a8f));}function handleFindAgent(_0x7e6684){return function(_0x437c2c){return _0x437c2c[_0x4eae('0xd')][_0x4eae('0xe')]()===_0x7e6684[_0x4eae('0xe')]();};}exports[_0x4eae('0xf')]=function(_0x25bf92,_0x428ebb,_0x41ce69,_0x12b670){return function(_0x337a19){try{var _0x4bce4d={'name':_0x428ebb[0x0],'timeout':_0x428ebb[0x1]};var _0x382de0=queue[_0x4eae('0x0')](_0x4bce4d,{'typecast':!![]});if(_0x382de0[_0x4eae('0x10')]){logger[_0x4eae('0x11')](_0x4eae('0x12'),_0x25bf92,_[_0x4eae('0x13')](_0x382de0,'message')[_0x4eae('0x14')](',\x20'));_0x337a19[_0x4eae('0x15')]();}else{var _0x36ed1d=_[_0x4eae('0x16')](_0x41ce69[_0x4eae('0x17')],handleFindAgent(_0x4bce4d[_0x4eae('0xd')]));if(_0x36ed1d){var _0x895720=(_0x4bce4d[_0x4eae('0x18')]||0xa)*0x3e8;var _0x39c50e,_0x462021;var _0x5389db=seqqueue[_0x4eae('0x19')](_0x895720);_0x5389db['id']=_0x25bf92;_0x5389db[_0x4eae('0x1a')]=_0x895720;_0x5389db['channel']=_0x12b670[_0x4eae('0x1b')];writeLog(_0x25bf92,_0x36ed1d,util[_0x4eae('0xb')]('START:%s',_0x895720));_0x41ce69[_0x4eae('0x1c')][_0x25bf92]['on'](_0x4eae('0x1d'),function(){logger[_0x4eae('0xa')](_0x4eae('0x1e'),_0x25bf92);clearTimeout(_0x462021);_0x462021=undefined;_0x5389db['close']();if(_0x41ce69['rules'][_0x25bf92]){delete _0x41ce69['rules'][_0x25bf92];}_0x337a19[_0x4eae('0x15')]();});_0x41ce69[_0x4eae('0x1c')][_0x25bf92]['on'](_0x4eae('0x1f'),function(){if(_0x41ce69['rules'][_0x25bf92]){delete _0x41ce69[_0x4eae('0x1c')][_0x25bf92];}});_0x462021=setTimeout(function(){logger['info'](_0x4eae('0x20'),_0x25bf92);clearTimeout(_0x462021);_0x5389db[_0x4eae('0x21')]();_0x337a19[_0x4eae('0x22')]();},_0x895720);strategy[_0x4eae('0x23')](_0x5389db,_0x36ed1d,_0x41ce69,_0x12b670);}else{logger['error'](_0x4eae('0x24'),_0x25bf92,_0x4bce4d[_0x4eae('0xd')]);_0x337a19[_0x4eae('0x15')]();}}}catch(_0x4d8c85){console[_0x4eae('0x25')](_0x4d8c85);logger[_0x4eae('0x11')](_0x4eae('0x26'),_0x25bf92,_0x4d8c85[_0x4eae('0x27')]);_0x337a19['stop']();}};}; \ No newline at end of file +var _0xaa3d=['rules','end','info','[%s][AGENT]\x20ROUTING\x20STOPPED','close','stop','complete','next','agent','[%s][AGENT]\x20agent\x20not\x20found\x20%s','[%s][QUEUE]\x20%s','validate','lodash','util','seq-queue','../../../../config/logger','routing','./strategy','string','timeout\x20is\x20a\x20number','format','name','toLowerCase','consequence','error','[%s][AGENT]\x20%s','message','join','find','createQueue','atimeout','channel','START:%s'];(function(_0x393188,_0x4028d7){var _0x357357=function(_0x333e19){while(--_0x333e19){_0x393188['push'](_0x393188['shift']());}};_0x357357(++_0x4028d7);}(_0xaa3d,0xf2));var _0xdaa3=function(_0x3ac78d,_0x515000){_0x3ac78d=_0x3ac78d-0x0;var _0x5c28af=_0xaa3d[_0x3ac78d];return _0x5c28af;};'use strict';var schema=require(_0xdaa3('0x0'));var _=require(_0xdaa3('0x1'));var util=require(_0xdaa3('0x2'));var seqqueue=require(_0xdaa3('0x3'));var logger=require(_0xdaa3('0x4'))(_0xdaa3('0x5'));var strategy=require(_0xdaa3('0x6'));var queue=schema({'name':{'type':_0xdaa3('0x7'),'required':!![],'message':'name\x20is\x20a\x20string\x20and\x20it\x20is\x20required'},'timeout':{'type':'number','message':_0xdaa3('0x8')}});function writeLog(_0x5a4a24,_0x13f7f8,_0x5b5583){return logger['info'](util[_0xdaa3('0x9')]('[%s][AGENT][NAME:%s][STATUS:%s]',_0x5a4a24,_0x13f7f8[_0xdaa3('0xa')],_0x5b5583));}function handleFindAgent(_0x30a1fc){return function(_0x14532a){return _0x14532a[_0xdaa3('0xa')][_0xdaa3('0xb')]()===_0x30a1fc[_0xdaa3('0xb')]();};}exports[_0xdaa3('0xc')]=function(_0xfa25c5,_0x15d59e,_0x275a79,_0x375fae){return function(_0x27e928){try{var _0x3c89e7={'name':_0x15d59e[0x0],'timeout':_0x15d59e[0x1]};var _0x10f22b=queue[_0xdaa3('0x0')](_0x3c89e7,{'typecast':!![]});if(_0x10f22b['length']){logger[_0xdaa3('0xd')](_0xdaa3('0xe'),_0xfa25c5,_['map'](_0x10f22b,_0xdaa3('0xf'))[_0xdaa3('0x10')](',\x20'));_0x27e928['stop']();}else{var _0x3922c7=_[_0xdaa3('0x11')](_0x275a79['agents'],handleFindAgent(_0x3c89e7[_0xdaa3('0xa')]));if(_0x3922c7){var _0x51e1ba=(_0x3c89e7['timeout']||0xa)*0x3e8;var _0x11aa40,_0x58337d;var _0x5cc7bc=seqqueue[_0xdaa3('0x12')](_0x51e1ba);_0x5cc7bc['id']=_0xfa25c5;_0x5cc7bc[_0xdaa3('0x13')]=_0x51e1ba;_0x5cc7bc[_0xdaa3('0x14')]=_0x375fae[_0xdaa3('0x14')];writeLog(_0xfa25c5,_0x3922c7,util[_0xdaa3('0x9')](_0xdaa3('0x15'),_0x51e1ba));_0x275a79[_0xdaa3('0x16')][_0xfa25c5]['on'](_0xdaa3('0x17'),function(){logger[_0xdaa3('0x18')](_0xdaa3('0x19'),_0xfa25c5);clearTimeout(_0x58337d);_0x58337d=undefined;_0x5cc7bc[_0xdaa3('0x1a')]();if(_0x275a79['rules'][_0xfa25c5]){delete _0x275a79[_0xdaa3('0x16')][_0xfa25c5];}_0x27e928[_0xdaa3('0x1b')]();});_0x275a79['rules'][_0xfa25c5]['on'](_0xdaa3('0x1c'),function(){if(_0x275a79['rules'][_0xfa25c5]){delete _0x275a79[_0xdaa3('0x16')][_0xfa25c5];}});_0x58337d=setTimeout(function(){logger['info']('[%s][AGENT]\x20ROUTING\x20END',_0xfa25c5);clearTimeout(_0x58337d);_0x5cc7bc[_0xdaa3('0x1a')]();_0x27e928[_0xdaa3('0x1d')]();},_0x51e1ba);strategy[_0xdaa3('0x1e')](_0x5cc7bc,_0x3922c7,_0x275a79,_0x375fae);}else{logger[_0xdaa3('0xd')](_0xdaa3('0x1f'),_0xfa25c5,_0x3c89e7[_0xdaa3('0xa')]);_0x27e928['stop']();}}}catch(_0x520bc2){console['log'](_0x520bc2);logger['error'](_0xdaa3('0x20'),_0xfa25c5,_0x520bc2['stack']);_0x27e928[_0xdaa3('0x1b')]();}};}; \ 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 dc12a14..c3c9c0e 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 _0x3912=['../../rpc/whatsappMessage','consequence','isNil','info','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','out','channel','sms','whatsapp','ChatWebsiteId','upperFirst','AccountId','interaction','created','body','getMustacheRender','create','then','catch','stringify','finally','[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!','stop','LexRuntime','toString','message','amazonlex','providerName','providerResponse','Message','error','lodash','aws-sdk','./utils','../../../../config/logger','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage'];(function(_0x29e2af,_0x15e2b1){var _0x1ea06a=function(_0x34d736){while(--_0x34d736){_0x29e2af['push'](_0x29e2af['shift']());}};_0x1ea06a(++_0x15e2b1);}(_0x3912,0xc1));var _0x2391=function(_0xd7f8d8,_0x5448e9){_0xd7f8d8=_0xd7f8d8-0x0;var _0x5d5459=_0x3912[_0xd7f8d8];return _0x5d5459;};'use strict';var _=require(_0x2391('0x0'));var moment=require('moment');var AWS=require(_0x2391('0x1'));var utils=require(_0x2391('0x2'));var logger=require(_0x2391('0x3'))('routing');var rpc={'chatMessage':require('../../rpc/chatMessage'),'openchannelMessage':require(_0x2391('0x4')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0x2391('0x5')),'faxMessage':require(_0x2391('0x6')),'whatsappMessage':require(_0x2391('0x7'))};exports[_0x2391('0x8')]=function(_0x512284,_0x569570){return function(_0x5465cc){try{if(!_[_0x2391('0x9')](this['interaction']['UserId'])){logger[_0x2391('0xa')](_0x2391('0xb'),_0x512284,_0x2391('0xc'));return _0x5465cc[_0x2391('0xd')]();}var _0x2f2f43={'ContactId':this['contact']['id'],'sentAt':moment()['format']('YYYY-MM-DD\x20HH:mm:ss'),'direction':_0x2391('0xe')};if(this[_0x2391('0xf')]===_0x2391('0x10')||this[_0x2391('0xf')]===_0x2391('0x11')){_0x2f2f43['phone']=this['interaction']['phone'];}var _0x418771=this['channel'];if(_0x418771==='chat'){_0x2f2f43[_0x2391('0x12')]=this['account']['id'];}else{_0x2f2f43[_[_0x2391('0x13')](_0x418771)+_0x2391('0x14')]=this['account']['id'];}_0x2f2f43[_[_0x2391('0x13')](_0x418771)+'InteractionId']=this[_0x2391('0x15')]['id'];if(this[_0x2391('0x15')][_0x2391('0x16')]){var _0x83496b=_0x569570[0x4];if(!_['isEmpty'](_0x83496b)){_0x2f2f43[_0x2391('0x17')]=utils[_0x2391('0x18')](_0x83496b,this);return rpc[_0x418771+'Message'][_0x2391('0x19')](_0x2f2f43)[_0x2391('0x1a')](function(_0x4e0aca){logger[_0x2391('0xa')](_0x2391('0xb'),_0x512284,_0x2f2f43[_0x2391('0x17')]);})[_0x2391('0x1b')](function(_0x25eba8){logger['error'](_0x2391('0xb'),_0x512284,JSON[_0x2391('0x1c')](_0x25eba8));})[_0x2391('0x1d')](function(){logger[_0x2391('0xa')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!',_0x512284);_0x5465cc['stop']();});}else{logger[_0x2391('0xa')](_0x2391('0x1e'),_0x512284);_0x5465cc[_0x2391('0x1f')]();}}else{var _0x4195e9=this;var _0x16e9f3=new AWS[(_0x2391('0x20'))]({'accessKeyId':_0x569570[0x0],'secretAccessKey':_0x569570[0x1],'region':_0x569570[0x2]});var _0x40fb76={'botAlias':'$LATEST','botName':_0x569570[0x3],'inputText':this['message'][_0x2391('0x17')],'userId':this[_0x2391('0xf')]+':'+this[_0x2391('0x15')]['id'][_0x2391('0x21')]()};_0x16e9f3['postText'](_0x40fb76,function(_0x5e361a,_0x524d94){if(_0x5e361a){logger['error']('[%s][AMAZONLEX]\x20%s',_0x512284,_0x5e361a['message']);_0x5465cc[_0x2391('0xd')]();}else if(_0x524d94&&_0x524d94[_0x2391('0x22')]){_0x4195e9['body'][_0x2391('0x23')]=_0x524d94;_0x2f2f43[_0x2391('0x17')]=_0x524d94['message'];_0x2f2f43[_0x2391('0x24')]=_0x2391('0x23');_0x2f2f43[_0x2391('0x25')]=JSON[_0x2391('0x1c')](_0x524d94);return rpc[_0x418771+_0x2391('0x26')]['create'](_0x2f2f43)['then'](function(_0x23f622){logger[_0x2391('0xa')](_0x2391('0xb'),_0x512284,_0x2f2f43[_0x2391('0x17')]);if(_0x524d94['dialogState']=='Failed'){_0x5465cc[_0x2391('0xd')]();}else{_0x5465cc['stop']();}})[_0x2391('0x1b')](function(_0x46542e){logger[_0x2391('0x27')](_0x2391('0xb'),_0x512284,JSON[_0x2391('0x1c')](_0x46542e));_0x5465cc[_0x2391('0xd')]();});}else{_0x5465cc['next']();}});}}catch(_0x50611b){logger['error'](_0x2391('0xb'),_0x512284,JSON['stringify'](_0x50611b));_0x5465cc[_0x2391('0x1f')]();}};}; \ No newline at end of file +var _0x99df=['interaction','UserId','[%s][AMAZONLEX]\x20%s','Agent\x20is\x20managing\x20the\x20interaction.\x20Go\x20to\x20next\x20application.','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','sms','phone','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','created','getMustacheRender','Message','create','then','body','error','stringify','finally','info','[%s][AMAZONLEX]\x20Welcome\x20Message\x20has\x20been\x20sent!','$LATEST','toString','postText','message','amazonlex','providerName','providerResponse','dialogState','Failed','catch','stop','moment','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','isNil'];(function(_0x2bbdb3,_0x4f1628){var _0x22c134=function(_0x15d230){while(--_0x15d230){_0x2bbdb3['push'](_0x2bbdb3['shift']());}};_0x22c134(++_0x4f1628);}(_0x99df,0x85));var _0xf99d=function(_0x36c5b0,_0x5001da){_0x36c5b0=_0x36c5b0-0x0;var _0xf19333=_0x99df[_0x36c5b0];return _0xf19333;};'use strict';var _=require('lodash');var moment=require(_0xf99d('0x0'));var AWS=require('aws-sdk');var utils=require('./utils');var logger=require(_0xf99d('0x1'))('routing');var rpc={'chatMessage':require(_0xf99d('0x2')),'openchannelMessage':require(_0xf99d('0x3')),'mailMessage':require(_0xf99d('0x4')),'smsMessage':require(_0xf99d('0x5')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xf99d('0x6'))};exports['consequence']=function(_0x223565,_0x94810c){return function(_0x4742b2){try{if(!_[_0xf99d('0x7')](this[_0xf99d('0x8')][_0xf99d('0x9')])){logger['info'](_0xf99d('0xa'),_0x223565,_0xf99d('0xb'));return _0x4742b2[_0xf99d('0xc')]();}var _0x92c8ea={'ContactId':this[_0xf99d('0xd')]['id'],'sentAt':moment()[_0xf99d('0xe')](_0xf99d('0xf')),'direction':_0xf99d('0x10')};if(this[_0xf99d('0x11')]===_0xf99d('0x12')||this[_0xf99d('0x11')]==='whatsapp'){_0x92c8ea[_0xf99d('0x13')]=this[_0xf99d('0x8')][_0xf99d('0x13')];}var _0x8d65b2=this[_0xf99d('0x11')];if(_0x8d65b2==='chat'){_0x92c8ea[_0xf99d('0x14')]=this[_0xf99d('0x15')]['id'];}else{_0x92c8ea[_[_0xf99d('0x16')](_0x8d65b2)+_0xf99d('0x17')]=this[_0xf99d('0x15')]['id'];}_0x92c8ea[_[_0xf99d('0x16')](_0x8d65b2)+_0xf99d('0x18')]=this[_0xf99d('0x8')]['id'];if(this[_0xf99d('0x8')][_0xf99d('0x19')]){var _0x105edb=_0x94810c[0x4];if(!_['isEmpty'](_0x105edb)){_0x92c8ea['body']=utils[_0xf99d('0x1a')](_0x105edb,this);return rpc[_0x8d65b2+_0xf99d('0x1b')][_0xf99d('0x1c')](_0x92c8ea)[_0xf99d('0x1d')](function(_0x5a2588){logger['info']('[%s][AMAZONLEX]\x20%s',_0x223565,_0x92c8ea[_0xf99d('0x1e')]);})['catch'](function(_0x1e94b){logger[_0xf99d('0x1f')](_0xf99d('0xa'),_0x223565,JSON[_0xf99d('0x20')](_0x1e94b));})[_0xf99d('0x21')](function(){logger[_0xf99d('0x22')](_0xf99d('0x23'),_0x223565);_0x4742b2['stop']();});}else{logger[_0xf99d('0x22')]('[%s][AMAZONLEX]\x20Welcome\x20Message\x20is\x20empty.\x20It\x20will\x20wait\x20for\x20a\x20message\x20from\x20customer!',_0x223565);_0x4742b2['stop']();}}else{var _0x46822d=this;var _0x225e15=new AWS['LexRuntime']({'accessKeyId':_0x94810c[0x0],'secretAccessKey':_0x94810c[0x1],'region':_0x94810c[0x2]});var _0x461a5b={'botAlias':_0xf99d('0x24'),'botName':_0x94810c[0x3],'inputText':this['message'][_0xf99d('0x1e')],'userId':this[_0xf99d('0x11')]+':'+this['interaction']['id'][_0xf99d('0x25')]()};_0x225e15[_0xf99d('0x26')](_0x461a5b,function(_0x175b27,_0x4a7c37){if(_0x175b27){logger['error']('[%s][AMAZONLEX]\x20%s',_0x223565,_0x175b27[_0xf99d('0x27')]);_0x4742b2[_0xf99d('0xc')]();}else if(_0x4a7c37&&_0x4a7c37[_0xf99d('0x27')]){_0x46822d[_0xf99d('0x1e')][_0xf99d('0x28')]=_0x4a7c37;_0x92c8ea['body']=_0x4a7c37['message'];_0x92c8ea[_0xf99d('0x29')]=_0xf99d('0x28');_0x92c8ea[_0xf99d('0x2a')]=JSON['stringify'](_0x4a7c37);return rpc[_0x8d65b2+'Message']['create'](_0x92c8ea)[_0xf99d('0x1d')](function(_0xec5c27){logger[_0xf99d('0x22')](_0xf99d('0xa'),_0x223565,_0x92c8ea[_0xf99d('0x1e')]);if(_0x4a7c37[_0xf99d('0x2b')]==_0xf99d('0x2c')){_0x4742b2[_0xf99d('0xc')]();}else{_0x4742b2['stop']();}})[_0xf99d('0x2d')](function(_0x4e1e6e){logger[_0xf99d('0x1f')](_0xf99d('0xa'),_0x223565,JSON[_0xf99d('0x20')](_0x4e1e6e));_0x4742b2[_0xf99d('0xc')]();});}else{_0x4742b2[_0xf99d('0xc')]();}});}}catch(_0x858941){logger[_0xf99d('0x1f')]('[%s][AMAZONLEX]\x20%s',_0x223565,JSON[_0xf99d('0x20')](_0x858941));_0x4742b2[_0xf99d('0x2e')]();}};}; \ 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 f7f69b2..5b89f3a 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 _0x8d2c=['subject','startsWith','Re:','Re:\x20','chat','ChatWebsiteId','account','AccountId','upperFirst','Message','inReplyTo','messageId','html','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','stringify','catch','error','[RPC][%s][AUTOREPLY]\x20%s','finally','resolve','create','Interaction','update','stop','lodash','moment','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/whatsappMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../mailRpc','consequence','mail','body','isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','isNil','interaction','created','Autoreply\x20already\x20sent','autoreplyExecuted','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','next','contact','format','YYYY-MM-DD\x20HH:mm:ss','out','channel','getMustacheRender','message','from','phone','read'];(function(_0x1de17a,_0x184677){var _0x3e5fba=function(_0x424882){while(--_0x424882){_0x1de17a['push'](_0x1de17a['shift']());}};_0x3e5fba(++_0x184677);}(_0x8d2c,0x1e5));var _0xc8d2=function(_0x11576e,_0x100aba){_0x11576e=_0x11576e-0x0;var _0x3e4b0f=_0x8d2c[_0x11576e];return _0x3e4b0f;};'use strict';var _=require(_0xc8d2('0x0'));var moment=require(_0xc8d2('0x1'));var utils=require('./utils');var logger=require(_0xc8d2('0x2'))(_0xc8d2('0x3'));var rpc={'chatMessage':require(_0xc8d2('0x4')),'openchannelMessage':require(_0xc8d2('0x5')),'mailMessage':require(_0xc8d2('0x6')),'smsMessage':require(_0xc8d2('0x7')),'faxMessage':require('../../rpc/faxMessage'),'whatsappMessage':require(_0xc8d2('0x8')),'chatInteraction':require(_0xc8d2('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0xc8d2('0xa')),'smsInteraction':require(_0xc8d2('0xb')),'faxInteraction':require(_0xc8d2('0xc')),'whatsappInteraction':require(_0xc8d2('0xd'))};var mailRpc=require(_0xc8d2('0xe'));exports[_0xc8d2('0xf')]=function(_0x33d1b5,_0x303c58,_0x6a9f9f,_0x4cb948){return function(_0x28b921){try{var _0x2982e4=this['channel'];if(_0x2982e4===_0xc8d2('0x10')&&_0x4cb948[_0xc8d2('0x11')][_0xc8d2('0x12')]){logger[_0xc8d2('0x13')](_0xc8d2('0x14'),_0x33d1b5,_0xc8d2('0x15'));return _0x28b921['next']();}if(_0x303c58[0x0]==='1'&&(_[_0xc8d2('0x16')](this[_0xc8d2('0x17')][_0xc8d2('0x18')])||!this[_0xc8d2('0x17')][_0xc8d2('0x18')])){logger['info'](_0xc8d2('0x14'),_0x33d1b5,_0xc8d2('0x19'));return _0x28b921['next']();}if(_0x303c58[0x0]==='2'&&this[_0xc8d2('0x17')][_0xc8d2('0x1a')]){logger[_0xc8d2('0x13')](_0xc8d2('0x1b'),_0x33d1b5,_0xc8d2('0x1c'));return _0x28b921[_0xc8d2('0x1d')]();}var _0x5583ec={'ContactId':this[_0xc8d2('0x1e')]['id'],'sentAt':moment()[_0xc8d2('0x1f')](_0xc8d2('0x20')),'direction':_0xc8d2('0x21')};if(this[_0xc8d2('0x22')]===_0xc8d2('0x10')){_0x5583ec[_0xc8d2('0x11')]=utils[_0xc8d2('0x23')](_0x303c58[0x2],this);}else{_0x5583ec[_0xc8d2('0x11')]=utils['getMustacheRender'](_0x303c58[0x1],this);}if(this[_0xc8d2('0x24')]){_0x5583ec['to']=this[_0xc8d2('0x24')][_0xc8d2('0x25')]||'';if(this[_0xc8d2('0x22')]===_0xc8d2('0x10')&&_0x303c58[0x1]==='1'){_0x5583ec['cc']=this[_0xc8d2('0x24')]['cc']||'';}_0x5583ec[_0xc8d2('0x25')]=this['message']['to']||'';_0x5583ec[_0xc8d2('0x26')]=this[_0xc8d2('0x24')][_0xc8d2('0x26')]||'';_0x5583ec[_0xc8d2('0x27')]=!![];if(this['message'][_0xc8d2('0x28')]){_0x5583ec[_0xc8d2('0x28')]='';_0x5583ec['subject']+=_[_0xc8d2('0x29')](this[_0xc8d2('0x24')][_0xc8d2('0x28')],_0xc8d2('0x2a'))?'':_0xc8d2('0x2b');_0x5583ec[_0xc8d2('0x28')]+=this['message']['subject'];}}if(this['channel']===_0xc8d2('0x2c')){_0x5583ec[_0xc8d2('0x2d')]=this[_0xc8d2('0x2e')]['id'];}else{_0x5583ec[_['upperFirst'](this[_0xc8d2('0x22')])+_0xc8d2('0x2f')]=this[_0xc8d2('0x2e')]['id'];}_0x5583ec[_[_0xc8d2('0x30')](this[_0xc8d2('0x22')])+'InteractionId']=this['interaction']['id'];var _0x4f4f9e=this[_0xc8d2('0x17')];if(rpc[this['channel']+_0xc8d2('0x31')]){if(this[_0xc8d2('0x22')]===_0xc8d2('0x10')){_0x5583ec[_0xc8d2('0x32')]=this[_0xc8d2('0x24')][_0xc8d2('0x33')];_0x5583ec[_0xc8d2('0x34')]=''+_[_0xc8d2('0x35')](_0x5583ec[_0xc8d2('0x11')],_0xc8d2('0x36'),_0xc8d2('0x37'))+_0xc8d2('0x38');_0x5583ec[_0xc8d2('0x39')]={'Auto-Submitted':_0xc8d2('0x3a'),'X-Auto-Response-Suppress':_0xc8d2('0x3b'),'Precedence':_0xc8d2('0x3c')};return mailRpc[_0xc8d2('0x3d')](this[_0xc8d2('0x2e')][_0xc8d2('0x3e')],_0x5583ec)[_0xc8d2('0x3f')](function(_0x51dd00){logger[_0xc8d2('0x13')](_0xc8d2('0x40'),_0x33d1b5);_0x5583ec[_0xc8d2('0x33')]=_0x51dd00[_0xc8d2('0x24')][_0xc8d2('0x33')];return rpc[_0x2982e4+_0xc8d2('0x31')]['create'](_0x5583ec);})[_0xc8d2('0x3f')](function(_0x42997f){logger[_0xc8d2('0x13')](_0xc8d2('0x14'),_0x33d1b5,JSON[_0xc8d2('0x41')](_0x42997f));})[_0xc8d2('0x42')](function(_0x2a1ecc){logger[_0xc8d2('0x43')](_0xc8d2('0x44'),_0x33d1b5,JSON['stringify'](_0x2a1ecc));})[_0xc8d2('0x45')](function(){Promise[_0xc8d2('0x46')]()[_0xc8d2('0x3f')](function(){if(_0x303c58[0x0]!=='2'||_0x4f4f9e[_0xc8d2('0x1a')])return;return rpc[_0x2982e4+'Interaction']['update'](_0x4f4f9e['id'],{'autoreplyExecuted':!![]})[_0xc8d2('0x3f')](function(_0x319fac){logger[_0xc8d2('0x13')](_0xc8d2('0x1b'),_0x33d1b5,JSON[_0xc8d2('0x41')](_0x319fac));})[_0xc8d2('0x42')](function(_0x2c3299){logger[_0xc8d2('0x43')]('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x33d1b5,JSON[_0xc8d2('0x41')](_0x2c3299));});})['then'](function(){_0x28b921[_0xc8d2('0x1d')]();});});}else{return rpc[this[_0xc8d2('0x22')]+'Message'][_0xc8d2('0x47')](_0x5583ec)['then'](function(){logger[_0xc8d2('0x13')](_0xc8d2('0x14'),_0x33d1b5,_0x5583ec[_0xc8d2('0x11')]);})[_0xc8d2('0x42')](function(_0x3b25cc){logger['error'](_0xc8d2('0x14'),_0x33d1b5,JSON[_0xc8d2('0x41')](_0x3b25cc));})[_0xc8d2('0x45')](function(){Promise[_0xc8d2('0x46')]()[_0xc8d2('0x3f')](function(){if(_0x303c58[0x0]!=='2'||_0x4f4f9e[_0xc8d2('0x1a')])return;return rpc[_0x2982e4+_0xc8d2('0x48')][_0xc8d2('0x49')](_0x4f4f9e['id'],{'autoreplyExecuted':!![]})['then'](function(_0x4b3499){logger[_0xc8d2('0x13')](_0xc8d2('0x1b'),_0x33d1b5,JSON[_0xc8d2('0x41')](_0x4b3499));})['catch'](function(_0x56a461){logger['error']('[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s',_0x33d1b5,JSON[_0xc8d2('0x41')](_0x56a461));});})[_0xc8d2('0x3f')](function(){_0x28b921[_0xc8d2('0x1d')]();});});}}}catch(_0xde02a2){logger[_0xc8d2('0x43')](_0xc8d2('0x14'),_0x33d1b5,JSON[_0xc8d2('0x41')](_0xde02a2));_0x28b921[_0xc8d2('0x4a')]();}};}; \ No newline at end of file +var _0x6c41=['isAutoreply','info','[%s][AUTOREPLY]\x20%s','Autoreply\x20not\x20executed\x20(message\x20is\x20autoreply)','next','isNil','interaction','created','Autoreply\x20already\x20sent','[%s][AUTOREPLY][autoreplyExecuted]\x20%s','One\x20Time\x20already\x20sent','contact','YYYY-MM-DD\x20HH:mm:ss','out','getMustacheRender','message','from','phone','read','subject','startsWith','Re:','Re:\x20','account','upperFirst','AccountId','InteractionId','Message','inReplyTo','messageId','html','','replace','','headers','auto-replied','All','auto_reply','sendMailMessage','smtpOptions','then','[%s][AUTOREPLY]\x20SMTP\x20SENT','create','stringify','[RPC][%s][AUTOREPLY]\x20%s','resolve','update','[RPC][%s][AUTOREPLY][autoreplyExecuted]\x20%s','error','finally','autoreplyExecuted','catch','stop','lodash','moment','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/mailMessage','../../rpc/smsMessage','../../rpc/faxMessage','../../rpc/chatInteraction','../../rpc/mailInteraction','../../rpc/smsInteraction','consequence','channel','mail','body'];(function(_0x4d38fd,_0x23402a){var _0x4d5b9b=function(_0x191149){while(--_0x191149){_0x4d38fd['push'](_0x4d38fd['shift']());}};_0x4d5b9b(++_0x23402a);}(_0x6c41,0x14e));var _0x16c4=function(_0x3ab51d,_0x2fa01d){_0x3ab51d=_0x3ab51d-0x0;var _0x29a04e=_0x6c41[_0x3ab51d];return _0x29a04e;};'use strict';var _=require(_0x16c4('0x0'));var moment=require(_0x16c4('0x1'));var utils=require(_0x16c4('0x2'));var logger=require(_0x16c4('0x3'))(_0x16c4('0x4'));var rpc={'chatMessage':require(_0x16c4('0x5')),'openchannelMessage':require('../../rpc/openchannelMessage'),'mailMessage':require(_0x16c4('0x6')),'smsMessage':require(_0x16c4('0x7')),'faxMessage':require(_0x16c4('0x8')),'whatsappMessage':require('../../rpc/whatsappMessage'),'chatInteraction':require(_0x16c4('0x9')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'mailInteraction':require(_0x16c4('0xa')),'smsInteraction':require(_0x16c4('0xb')),'faxInteraction':require('../../rpc/faxInteraction'),'whatsappInteraction':require('../../rpc/whatsappInteraction')};var mailRpc=require('../../mailRpc');exports[_0x16c4('0xc')]=function(_0x15eb2b,_0xa63ecb,_0x3c56c9,_0x502f38){return function(_0xb51cd0){try{var _0x2dbe74=this[_0x16c4('0xd')];if(_0x2dbe74===_0x16c4('0xe')&&_0x502f38[_0x16c4('0xf')][_0x16c4('0x10')]){logger[_0x16c4('0x11')](_0x16c4('0x12'),_0x15eb2b,_0x16c4('0x13'));return _0xb51cd0[_0x16c4('0x14')]();}if(_0xa63ecb[0x0]==='1'&&(_[_0x16c4('0x15')](this[_0x16c4('0x16')]['created'])||!this[_0x16c4('0x16')][_0x16c4('0x17')])){logger[_0x16c4('0x11')]('[%s][AUTOREPLY]\x20%s',_0x15eb2b,_0x16c4('0x18'));return _0xb51cd0['next']();}if(_0xa63ecb[0x0]==='2'&&this[_0x16c4('0x16')]['autoreplyExecuted']){logger['info'](_0x16c4('0x19'),_0x15eb2b,_0x16c4('0x1a'));return _0xb51cd0[_0x16c4('0x14')]();}var _0x247ce4={'ContactId':this[_0x16c4('0x1b')]['id'],'sentAt':moment()['format'](_0x16c4('0x1c')),'direction':_0x16c4('0x1d')};if(this[_0x16c4('0xd')]==='mail'){_0x247ce4['body']=utils['getMustacheRender'](_0xa63ecb[0x2],this);}else{_0x247ce4['body']=utils[_0x16c4('0x1e')](_0xa63ecb[0x1],this);}if(this[_0x16c4('0x1f')]){_0x247ce4['to']=this[_0x16c4('0x1f')][_0x16c4('0x20')]||'';if(this['channel']===_0x16c4('0xe')&&_0xa63ecb[0x1]==='1'){_0x247ce4['cc']=this[_0x16c4('0x1f')]['cc']||'';}_0x247ce4['from']=this['message']['to']||'';_0x247ce4[_0x16c4('0x21')]=this[_0x16c4('0x1f')]['phone']||'';_0x247ce4[_0x16c4('0x22')]=!![];if(this[_0x16c4('0x1f')][_0x16c4('0x23')]){_0x247ce4[_0x16c4('0x23')]='';_0x247ce4[_0x16c4('0x23')]+=_[_0x16c4('0x24')](this[_0x16c4('0x1f')][_0x16c4('0x23')],_0x16c4('0x25'))?'':_0x16c4('0x26');_0x247ce4['subject']+=this[_0x16c4('0x1f')][_0x16c4('0x23')];}}if(this[_0x16c4('0xd')]==='chat'){_0x247ce4['ChatWebsiteId']=this[_0x16c4('0x27')]['id'];}else{_0x247ce4[_[_0x16c4('0x28')](this[_0x16c4('0xd')])+_0x16c4('0x29')]=this['account']['id'];}_0x247ce4[_[_0x16c4('0x28')](this[_0x16c4('0xd')])+_0x16c4('0x2a')]=this[_0x16c4('0x16')]['id'];var _0xdb5487=this['interaction'];if(rpc[this[_0x16c4('0xd')]+_0x16c4('0x2b')]){if(this[_0x16c4('0xd')]===_0x16c4('0xe')){_0x247ce4[_0x16c4('0x2c')]=this[_0x16c4('0x1f')][_0x16c4('0x2d')];_0x247ce4[_0x16c4('0x2e')]=_0x16c4('0x2f')+_[_0x16c4('0x30')](_0x247ce4['body'],_0x16c4('0x31'),']+(>|$)/g,''),'priorityTrue':_0x4418e9[0x1],'priorityFalse':_0x4418e9[0x2]};var _0x4503cb=gotoif['validate'](_0x39bf93,{'typecast':!![]});if(_0x4503cb[_0x5132('0xc')]){logger[_0x5132('0xd')](_0x5132('0xe'),_0x5ca2a2,_[_0x5132('0xf')](_0x4503cb,_0x5132('0x10'))[_0x5132('0x11')](',\x20'));_0xe5ffdc[_0x5132('0x12')]();}else{try{var _0x34f61d=eval('('+_0x39bf93[_0x5132('0x13')]+')');var _0x936dd5=_0x34f61d?_0x39bf93['priorityTrue']:_0x39bf93['priorityFalse'];logger[_0x5132('0x14')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x5ca2a2,_0x39bf93[_0x5132('0x13')],_0x34f61d,_0x936dd5||_0x5132('0x15'));if(_0x936dd5){var _0x354253=_[_0x5132('0x16')](_0xe5ffdc[_0x5132('0x17')](),{'p':_0x936dd5});if(_0x354253>=0x0){logger[_0x5132('0x14')]('[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s',_0x5ca2a2,_0x936dd5||_0x5132('0x15'),_0x354253);_0xe5ffdc[_0x5132('0x15')](_0x354253);}else{logger['info']('[%s][GOTOIF]\x20priority\x20%s\x20not\x20found',_0x5ca2a2,_0x936dd5||_0x5132('0x15'));_0xe5ffdc[_0x5132('0x12')]();}}else{_0xe5ffdc[_0x5132('0x15')]();}}catch(_0x13f5ae){logger[_0x5132('0xd')](_0x5132('0x18'),_0x5ca2a2,_0x13f5ae[_0x5132('0x10')]);_0xe5ffdc[_0x5132('0x12')]();}}}catch(_0x7423be){logger[_0x5132('0xd')](_0x5132('0xe'),_0x5ca2a2,JSON[_0x5132('0x19')](_0x7423be));_0xe5ffdc[_0x5132('0x12')]();}};}; \ No newline at end of file +var _0xff75=['fromString','replace','length','error','[%s][GOTOIF]\x20%s','message','stop','condition','priorityTrue','priorityFalse','info','next','findIndex','[%s][GOTOIF]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOIF]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash','html-to-text','../../../../config/logger','condition\x20is\x20a\x20string\x20and\x20it\x20is\x20required','number','priority\x20true\x20is\x20a\x20number','priority\x20false\x20is\x20a\x20number','consequence'];(function(_0x438043,_0x53e086){var _0x481f3e=function(_0x515976){while(--_0x515976){_0x438043['push'](_0x438043['shift']());}};_0x481f3e(++_0x53e086);}(_0xff75,0xbf));var _0x5ff7=function(_0x89475,_0x170903){_0x89475=_0x89475-0x0;var _0x388fdf=_0xff75[_0x89475];return _0x388fdf;};'use strict';var schema=require(_0x5ff7('0x0'));var _=require(_0x5ff7('0x1'));var htmlToText=require(_0x5ff7('0x2'));var utils=require('./utils');var logger=require(_0x5ff7('0x3'))('routing');var gotoif=schema({'condition':{'type':'string','required':!![],'message':_0x5ff7('0x4')},'priorityTrue':{'type':_0x5ff7('0x5'),'message':_0x5ff7('0x6')},'priorityFalse':{'type':'number','message':_0x5ff7('0x7')}});exports[_0x5ff7('0x8')]=function(_0x3dd1a7,_0xdf082a){return function(_0x36818e){try{var _0x5caa30={'condition':htmlToText[_0x5ff7('0x9')](utils['getMustacheRender'](_0xdf082a[0x0],this),{'wordwrap':![]})[_0x5ff7('0xa')](/<\/?[^>]+(>|$)/g,''),'priorityTrue':_0xdf082a[0x1],'priorityFalse':_0xdf082a[0x2]};var _0x5726c8=gotoif[_0x5ff7('0x0')](_0x5caa30,{'typecast':!![]});if(_0x5726c8[_0x5ff7('0xb')]){logger[_0x5ff7('0xc')](_0x5ff7('0xd'),_0x3dd1a7,_['map'](_0x5726c8,_0x5ff7('0xe'))['join'](',\x20'));_0x36818e[_0x5ff7('0xf')]();}else{try{var _0x12b84c=eval('('+_0x5caa30[_0x5ff7('0x10')]+')');var _0x5ea81a=_0x12b84c?_0x5caa30[_0x5ff7('0x11')]:_0x5caa30[_0x5ff7('0x12')];logger[_0x5ff7('0x13')]('[%s][GOTOIF]\x20condition\x20%s\x20is\x20%s\x20try\x20goto\x20priority\x20%s',_0x3dd1a7,_0x5caa30['condition'],_0x12b84c,_0x5ea81a||_0x5ff7('0x14'));if(_0x5ea81a){var _0x334076=_[_0x5ff7('0x15')](_0x36818e['rules'](),{'p':_0x5ea81a});if(_0x334076>=0x0){logger[_0x5ff7('0x13')](_0x5ff7('0x16'),_0x3dd1a7,_0x5ea81a||'next',_0x334076);_0x36818e[_0x5ff7('0x14')](_0x334076);}else{logger[_0x5ff7('0x13')](_0x5ff7('0x17'),_0x3dd1a7,_0x5ea81a||'next');_0x36818e['stop']();}}else{_0x36818e[_0x5ff7('0x14')]();}}catch(_0x3b5267){logger[_0x5ff7('0xc')]('[%s][GOTOIF]\x20eval\x20error:\x20%s',_0x3dd1a7,_0x3b5267[_0x5ff7('0xe')]);_0x36818e[_0x5ff7('0xf')]();}}}catch(_0x41ad37){logger[_0x5ff7('0xc')](_0x5ff7('0xd'),_0x3dd1a7,JSON[_0x5ff7('0x18')](_0x41ad37));_0x36818e[_0x5ff7('0xf')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/gotop.js b/server/services/routing/server/applications/gotop.js index 924ba98..f75d8c1 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 _0x5a49=['routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join','stop','info','[%s][GOTOP]\x20priority\x20%s','priority','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','next','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','stringify','validate','lodash'];(function(_0x5a8f9e,_0x345fab){var _0xb316e=function(_0x2392e9){while(--_0x2392e9){_0x5a8f9e['push'](_0x5a8f9e['shift']());}};_0xb316e(++_0x345fab);}(_0x5a49,0xbc));var _0x95a4=function(_0x4fbf0b,_0x33ce00){_0x4fbf0b=_0x4fbf0b-0x0;var _0x1c160f=_0x5a49[_0x4fbf0b];return _0x1c160f;};'use strict';var schema=require(_0x95a4('0x0'));var _=require(_0x95a4('0x1'));var logger=require('../../../../config/logger')(_0x95a4('0x2'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0x95a4('0x3')}});exports[_0x95a4('0x4')]=function(_0x5bfedb,_0x4e0839){return function(_0x569f68){try{var _0x254a0f={'priority':_0x4e0839[0x0]};var _0x5a0159=gotop[_0x95a4('0x0')](_0x254a0f,{'typecast':!![]});if(_0x5a0159[_0x95a4('0x5')]){logger[_0x95a4('0x6')](_0x95a4('0x7'),_0x5bfedb,_[_0x95a4('0x8')](_0x5a0159,_0x95a4('0x9'))[_0x95a4('0xa')](',\x20'));_0x569f68[_0x95a4('0xb')]();}else{logger[_0x95a4('0xc')](_0x95a4('0xd'),_0x5bfedb,_0x254a0f[_0x95a4('0xe')]);if(_0x254a0f[_0x95a4('0xe')]){var _0x4e8a9c=_['findIndex'](_0x569f68['rules'](),{'p':_0x254a0f[_0x95a4('0xe')]});if(_0x4e8a9c>=0x0){logger[_0x95a4('0xc')](_0x95a4('0xf'),_0x5bfedb,_0x254a0f[_0x95a4('0xe')]||'next',_0x4e8a9c);_0x569f68[_0x95a4('0x10')](_0x4e8a9c);}else{logger['info'](_0x95a4('0x11'),_0x5bfedb,_0x254a0f[_0x95a4('0xe')]||'next');_0x569f68[_0x95a4('0xb')]();}}else{_0x569f68[_0x95a4('0x10')]();}}}catch(_0x181cba){logger[_0x95a4('0x6')]('[%s][GOTOP]\x20%s',_0x5bfedb,JSON[_0x95a4('0x12')](_0x181cba));_0x569f68[_0x95a4('0xb')]();}};}; \ No newline at end of file +var _0x9d7d=['stop','info','[%s][GOTOP]\x20priority\x20%s','priority','findIndex','rules','[%s][GOTOP]\x20priority\x20%s\x20found\x20at\x20index:\x20%s','[%s][GOTOP]\x20priority\x20%s\x20not\x20found','next','validate','lodash','../../../../config/logger','routing','priority\x20is\x20a\x20number\x20and\x20it\x20is\x20required','consequence','length','error','[%s][GOTOP]\x20%s','map','message','join'];(function(_0x1facfa,_0x1acf7d){var _0x9ec701=function(_0x115e37){while(--_0x115e37){_0x1facfa['push'](_0x1facfa['shift']());}};_0x9ec701(++_0x1acf7d);}(_0x9d7d,0x1d7));var _0xd9d7=function(_0x450bf9,_0x1895de){_0x450bf9=_0x450bf9-0x0;var _0x268350=_0x9d7d[_0x450bf9];return _0x268350;};'use strict';var schema=require(_0xd9d7('0x0'));var _=require(_0xd9d7('0x1'));var logger=require(_0xd9d7('0x2'))(_0xd9d7('0x3'));var gotop=schema({'priority':{'type':'number','required':!![],'message':_0xd9d7('0x4')}});exports[_0xd9d7('0x5')]=function(_0x5d2904,_0x11d2bf){return function(_0x201a12){try{var _0x335835={'priority':_0x11d2bf[0x0]};var _0x3b287c=gotop[_0xd9d7('0x0')](_0x335835,{'typecast':!![]});if(_0x3b287c[_0xd9d7('0x6')]){logger[_0xd9d7('0x7')](_0xd9d7('0x8'),_0x5d2904,_[_0xd9d7('0x9')](_0x3b287c,_0xd9d7('0xa'))[_0xd9d7('0xb')](',\x20'));_0x201a12[_0xd9d7('0xc')]();}else{logger[_0xd9d7('0xd')](_0xd9d7('0xe'),_0x5d2904,_0x335835[_0xd9d7('0xf')]);if(_0x335835[_0xd9d7('0xf')]){var _0x442ccc=_[_0xd9d7('0x10')](_0x201a12[_0xd9d7('0x11')](),{'p':_0x335835[_0xd9d7('0xf')]});if(_0x442ccc>=0x0){logger[_0xd9d7('0xd')](_0xd9d7('0x12'),_0x5d2904,_0x335835[_0xd9d7('0xf')]||'next',_0x442ccc);_0x201a12['next'](_0x442ccc);}else{logger[_0xd9d7('0xd')](_0xd9d7('0x13'),_0x5d2904,_0x335835[_0xd9d7('0xf')]||'next');_0x201a12[_0xd9d7('0xc')]();}}else{_0x201a12[_0xd9d7('0x14')]();}}}catch(_0x5b7f0e){logger[_0xd9d7('0x7')](_0xd9d7('0x8'),_0x5d2904,JSON['stringify'](_0x5b7f0e));_0x201a12[_0xd9d7('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 ef4f9a1..de10394 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 _0xac7a=['next','catch','error','[%s][MESSAGE]\x20%s','stringify','stop','lodash','./utils','../../../../config/logger','routing','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/mailMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','channel','chat','ChatWebsiteId','account','upperFirst','AccountId','InteractionId','interaction','Message','create','then','body'];(function(_0x5dfc2a,_0x1a953f){var _0x3f1a71=function(_0x15916){while(--_0x15916){_0x5dfc2a['push'](_0x5dfc2a['shift']());}};_0x3f1a71(++_0x1a953f);}(_0xac7a,0x128));var _0xaac7=function(_0x585748,_0x4a86fb){_0x585748=_0x585748-0x0;var _0x35816e=_0xac7a[_0x585748];return _0x35816e;};'use strict';var _=require(_0xaac7('0x0'));var utils=require(_0xaac7('0x1'));var logger=require(_0xaac7('0x2'))(_0xaac7('0x3'));var rpc={'chatMessage':require(_0xaac7('0x4')),'openchannelMessage':require(_0xaac7('0x5')),'mailMessage':require(_0xaac7('0x6')),'smsMessage':require('../../rpc/smsMessage'),'faxMessage':require(_0xaac7('0x7')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xaac7('0x8')]=function(_0x1bcbe0,_0x4264b2){return function(_0x3be7be){try{var _0x2239bc={'body':utils[_0xaac7('0x9')](_0x4264b2[0x0],this),'ContactId':this[_0xaac7('0xa')]['id']};if(this[_0xaac7('0xb')]===_0xaac7('0xc')){_0x2239bc[_0xaac7('0xd')]=this[_0xaac7('0xe')]['id'];}else{_0x2239bc[_[_0xaac7('0xf')](this[_0xaac7('0xb')])+_0xaac7('0x10')]=this[_0xaac7('0xe')]['id'];}_0x2239bc[_[_0xaac7('0xf')](this[_0xaac7('0xb')])+_0xaac7('0x11')]=this[_0xaac7('0x12')]['id'];if(rpc[this[_0xaac7('0xb')]+_0xaac7('0x13')]){return rpc[this['channel']+_0xaac7('0x13')][_0xaac7('0x14')](_0x2239bc)[_0xaac7('0x15')](function(_0xe50e0){logger['info']('[%s][MESSAGE]\x20%s',_0x1bcbe0,_0x2239bc[_0xaac7('0x16')]);_0x3be7be[_0xaac7('0x17')]();})[_0xaac7('0x18')](function(_0x1f6e62){logger[_0xaac7('0x19')](_0xaac7('0x1a'),_0x1bcbe0,JSON[_0xaac7('0x1b')](_0x1f6e62));_0x3be7be[_0xaac7('0x1c')]();});}}catch(_0x5d4833){logger[_0xaac7('0x19')]('[%s][MESSAGE]\x20%s',_0x1bcbe0,JSON[_0xaac7('0x1b')](_0x5d4833));_0x3be7be['stop']();}};}; \ No newline at end of file +var _0x266b=['interaction','Message','create','then','[%s][MESSAGE]\x20%s','body','next','catch','error','stringify','stop','lodash','../../../../config/logger','../../rpc/chatMessage','../../rpc/openchannelMessage','../../rpc/smsMessage','../../rpc/faxMessage','consequence','getMustacheRender','contact','chat','account','channel','upperFirst','InteractionId'];(function(_0x54cc52,_0xac741c){var _0x45e435=function(_0x5b32d3){while(--_0x5b32d3){_0x54cc52['push'](_0x54cc52['shift']());}};_0x45e435(++_0xac741c);}(_0x266b,0x1cd));var _0xb266=function(_0x4263c7,_0x127749){_0x4263c7=_0x4263c7-0x0;var _0x46b768=_0x266b[_0x4263c7];return _0x46b768;};'use strict';var _=require(_0xb266('0x0'));var utils=require('./utils');var logger=require(_0xb266('0x1'))('routing');var rpc={'chatMessage':require(_0xb266('0x2')),'openchannelMessage':require(_0xb266('0x3')),'mailMessage':require('../../rpc/mailMessage'),'smsMessage':require(_0xb266('0x4')),'faxMessage':require(_0xb266('0x5')),'whatsappMessage':require('../../rpc/whatsappMessage')};exports[_0xb266('0x6')]=function(_0xcd4870,_0x2135e5){return function(_0x2d9e76){try{var _0x32dfd0={'body':utils[_0xb266('0x7')](_0x2135e5[0x0],this),'ContactId':this[_0xb266('0x8')]['id']};if(this['channel']===_0xb266('0x9')){_0x32dfd0['ChatWebsiteId']=this[_0xb266('0xa')]['id'];}else{_0x32dfd0[_['upperFirst'](this[_0xb266('0xb')])+'AccountId']=this['account']['id'];}_0x32dfd0[_[_0xb266('0xc')](this[_0xb266('0xb')])+_0xb266('0xd')]=this[_0xb266('0xe')]['id'];if(rpc[this['channel']+_0xb266('0xf')]){return rpc[this[_0xb266('0xb')]+'Message'][_0xb266('0x10')](_0x32dfd0)[_0xb266('0x11')](function(_0x220021){logger['info'](_0xb266('0x12'),_0xcd4870,_0x32dfd0[_0xb266('0x13')]);_0x2d9e76[_0xb266('0x14')]();})[_0xb266('0x15')](function(_0x336315){logger[_0xb266('0x16')](_0xb266('0x12'),_0xcd4870,JSON[_0xb266('0x17')](_0x336315));_0x2d9e76[_0xb266('0x18')]();});}}catch(_0x2e1b39){logger[_0xb266('0x16')](_0xb266('0x12'),_0xcd4870,JSON[_0xb266('0x17')](_0x2e1b39));_0x2d9e76[_0xb266('0x18')]();}};}; \ 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 19163e5..511e834 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 _0x23c7=['error','./utils','../../../../config/logger','routing','info','[%s][NOOP]\x20%s','getMustacheRender'];(function(_0x33a21a,_0x22d1a8){var _0x4c628e=function(_0x59edab){while(--_0x59edab){_0x33a21a['push'](_0x33a21a['shift']());}};_0x4c628e(++_0x22d1a8);}(_0x23c7,0x86));var _0x723c=function(_0x55944c,_0x157f0e){_0x55944c=_0x55944c-0x0;var _0x10edd7=_0x23c7[_0x55944c];return _0x10edd7;};'use strict';var utils=require(_0x723c('0x0'));var logger=require(_0x723c('0x1'))(_0x723c('0x2'));exports['consequence']=function(_0x977397,_0xcc8b7){return function(_0x4fa801){try{logger[_0x723c('0x3')](_0x723c('0x4'),_0x977397,utils[_0x723c('0x5')](_0xcc8b7[0x0],this));_0x4fa801['next']();}catch(_0x390fe0){logger[_0x723c('0x6')](_0x723c('0x4'),_0x977397,JSON['stringify'](_0x390fe0));_0x4fa801['stop']();}};}; \ No newline at end of file +var _0x7b76=['../../../../config/logger','routing','consequence','info','getMustacheRender','next','error','[%s][NOOP]\x20%s','stringify','stop','./utils'];(function(_0x18c2a3,_0x2bb43d){var _0x32cc65=function(_0xa45dca){while(--_0xa45dca){_0x18c2a3['push'](_0x18c2a3['shift']());}};_0x32cc65(++_0x2bb43d);}(_0x7b76,0x1ac));var _0x67b7=function(_0x314148,_0x50e34b){_0x314148=_0x314148-0x0;var _0x5703c4=_0x7b76[_0x314148];return _0x5703c4;};'use strict';var utils=require(_0x67b7('0x0'));var logger=require(_0x67b7('0x1'))(_0x67b7('0x2'));exports[_0x67b7('0x3')]=function(_0x3ecbf0,_0x3112a6){return function(_0x6f4870){try{logger[_0x67b7('0x4')]('[%s][NOOP]\x20%s',_0x3ecbf0,utils[_0x67b7('0x5')](_0x3112a6[0x0],this));_0x6f4870[_0x67b7('0x6')]();}catch(_0x330472){logger[_0x67b7('0x7')](_0x67b7('0x8'),_0x3ecbf0,JSON[_0x67b7('0x9')](_0x330472));_0x6f4870[_0x67b7('0xa')]();}};}; \ 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 2d47b69..b5813ca 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 _0xbf3a=['capitalize','InteractionId','format','%sQueuesWaitingInteractions','pick','%s:queue:%s','%s_queue_waiting_interaction:%s','save','remove','../../rpc/openchannelQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','message','chat','AccountId','WebsiteId','info','[%s][START:QUEUE][NAME:%s]','name','QueueReport','create','error','create\x20queue\x20report','[%s][STOP:QUEUE][NAME:%s]','update','catch','update\x20queue\x20report','timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','[%s][QUEUE]\x20%s','join','stop','find','Queues','createQueue','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','beepall','log','lodash','util','seq-queue','moment','ioredis','../../../../config/environment','../../../../config/logger','routing','./strategy','redis','defaults','localhost','socket.io-emitter','from','joinAt','emit','clone','queue_id','queue','account','push'];(function(_0x5bd89a,_0x12aefb){var _0x2ceb2b=function(_0xda0832){while(--_0xda0832){_0x5bd89a['push'](_0x5bd89a['shift']());}};_0x2ceb2b(++_0x12aefb);}(_0xbf3a,0xe4));var _0xabf3=function(_0x303c30,_0x16edcb){_0x303c30=_0x303c30-0x0;var _0x43161b=_0xbf3a[_0x303c30];return _0x43161b;};'use strict';var schema=require('validate');var _=require(_0xabf3('0x0'));var util=require(_0xabf3('0x1'));var seqqueue=require(_0xabf3('0x2'));var moment=require(_0xabf3('0x3'));var Redis=require(_0xabf3('0x4'));var config=require(_0xabf3('0x5'));var logger=require(_0xabf3('0x6'))(_0xabf3('0x7'));var strategy=require(_0xabf3('0x8'));config[_0xabf3('0x9')]=_[_0xabf3('0xa')](config[_0xabf3('0x9')],{'host':_0xabf3('0xb'),'port':0x18eb});var io=require(_0xabf3('0xc'))(new Redis(config[_0xabf3('0x9')]));var attributes=['id','queue_id','account','queue',_0xabf3('0xd'),_0xabf3('0xe')];function emit(_0x42b44d,_0x5d00bb,_0x2e70a0){io['to'](_0x42b44d)[_0xabf3('0xf')](_0x5d00bb,_0x2e70a0);}function emitChannelQueueInteraction(_0xe2f972,_0x4b87cc,_0x9faf27,_0x57eb18,_0x527c8c,_0x236666,_0x248f5f,_0x2e842c){var _0x3904a1=_[_0xabf3('0x10')](_0x9faf27);_0x3904a1[_0xabf3('0x11')]=_0x2e842c;_0x3904a1[_0xabf3('0x12')]=_0x4b87cc;_0x3904a1[_0xabf3('0x13')]=_0x57eb18;_0x3904a1['id']=_0x527c8c;if(_0x236666){attributes[_0xabf3('0x14')](_[_0xabf3('0x15')](_0xe2f972)+_0xabf3('0x16'));_0x248f5f[util[_0xabf3('0x17')](_0xabf3('0x18'),_0xe2f972)][_0x527c8c]=_[_0xabf3('0x19')](_0x3904a1,attributes);}else{delete _0x248f5f[util[_0xabf3('0x17')]('%sQueuesWaitingInteractions',_0xe2f972)][_0x527c8c];}emit(util[_0xabf3('0x17')](_0xabf3('0x1a'),_0xe2f972,_0x4b87cc),util['format'](_0xabf3('0x1b'),_0xe2f972,_0x236666?_0xabf3('0x1c'):_0xabf3('0x1d')),_[_0xabf3('0x19')](_0x3904a1,attributes));}var rpc={'openchannelQueueReport':require(_0xabf3('0x1e')),'mailQueueReport':require('../../rpc/mailQueueReport'),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0xabf3('0x1f')),'faxQueueReport':require(_0xabf3('0x20')),'whatsappQueueReport':require('../../rpc/whatsappQueueReport')};var queue=schema({'name':{'type':_0xabf3('0x21'),'required':!![],'message':_0xabf3('0x22')},'timeout':{'type':'number','message':_0xabf3('0x23')}});function startRouting(_0x53d609,_0x59e4fa,_0x31ffa0,_0x1c8c91){if(_0x53d609&&_0x59e4fa&&_0x31ffa0){_0x59e4fa[_0xabf3('0x24')]+=0x1;var _0x2e144a={'uniqueid':_0x53d609,'from':_0x31ffa0['body']?_0x31ffa0[_0xabf3('0x25')][_0xabf3('0xd')]:'','joinAt':moment()[_0xabf3('0x17')](_0xabf3('0x26')),'ContactId':_0x31ffa0[_0xabf3('0x27')]?_0x31ffa0[_0xabf3('0x27')]['id']:null,'ListId':_0x31ffa0[_0xabf3('0x28')]?_0x31ffa0[_0xabf3('0x28')]['id']:null};_0x2e144a[_[_0xabf3('0x29')](_0x31ffa0[_0xabf3('0x2a')])+_0xabf3('0x2b')]=_0x59e4fa['id']||null;_0x2e144a[_[_0xabf3('0x29')](_0x31ffa0[_0xabf3('0x2a')])+_0xabf3('0x16')]=_0x31ffa0[_0xabf3('0x2c')]?_0x31ffa0[_0xabf3('0x2c')]['id']:null;_0x2e144a[_[_0xabf3('0x29')](_0x31ffa0[_0xabf3('0x2a')])+'MessageId']=_0x31ffa0[_0xabf3('0x2d')]?_0x31ffa0[_0xabf3('0x2d')]['id']:null;_0x2e144a[_[_0xabf3('0x29')](_0x31ffa0[_0xabf3('0x2a')])+(_0x31ffa0[_0xabf3('0x2a')]!==_0xabf3('0x2e')?_0xabf3('0x2f'):_0xabf3('0x30'))]=_0x31ffa0[_0xabf3('0x13')]?_0x31ffa0[_0xabf3('0x13')]['id']:null;logger[_0xabf3('0x31')](util[_0xabf3('0x17')](_0xabf3('0x32'),_0x53d609,_0x59e4fa['name']));emitChannelQueueInteraction(_0x31ffa0[_0xabf3('0x2a')],_0x59e4fa['name'],_0x2e144a,_0x31ffa0[_0xabf3('0x13')][_0xabf3('0x33')],_0x31ffa0['message']['id'],!![],_0x1c8c91,_0x59e4fa['id']);if(rpc[_0x31ffa0[_0xabf3('0x2a')]+_0xabf3('0x34')]){return rpc[_0x31ffa0[_0xabf3('0x2a')]+_0xabf3('0x34')][_0xabf3('0x35')](_0x2e144a)['catch'](function(_0x1a6f0a){logger[_0xabf3('0x36')](_0xabf3('0x37'));});}}}function stopRouting(_0x1886e2,_0x2b4963,_0xe4b61c,_0x5ce1f8){if(_0x1886e2&&_0x2b4963){_0x2b4963[_0xabf3('0x24')]-=0x1;var _0x25891c={'leaveAt':moment()['format'](_0xabf3('0x26')),'acceptAt':moment()[_0xabf3('0x17')](_0xabf3('0x26')),'reason':'accepted'};logger['info'](util[_0xabf3('0x17')](_0xabf3('0x38'),_0x1886e2,_0x2b4963[_0xabf3('0x33')]));emitChannelQueueInteraction(_0xe4b61c['channel'],_0x2b4963[_0xabf3('0x33')],_0xe4b61c[_0xabf3('0x25')],_0xe4b61c[_0xabf3('0x13')][_0xabf3('0x33')],_0xe4b61c[_0xabf3('0x2d')]['id'],![],_0x5ce1f8,_0x2b4963['id']);if(rpc[_0xe4b61c[_0xabf3('0x2a')]+_0xabf3('0x34')]){return rpc[_0xe4b61c[_0xabf3('0x2a')]+_0xabf3('0x34')][_0xabf3('0x39')](_0x1886e2,_0x25891c)[_0xabf3('0x3a')](function(_0x53fce7){logger['error'](_0xabf3('0x3b'));});}}}function endRouting(_0x3a36e3,_0x42166e,_0xe6ea0a,_0x54b2f8){if(_0x3a36e3&&_0x42166e){_0x42166e[_0xabf3('0x24')]-=0x1;var _0xe882e={'leaveAt':moment()['format'](_0xabf3('0x26')),'exitAt':moment()[_0xabf3('0x17')](_0xabf3('0x26')),'reason':_0xabf3('0x3c')};logger[_0xabf3('0x31')](util[_0xabf3('0x17')](_0xabf3('0x3d'),_0x3a36e3,_0x42166e[_0xabf3('0x33')]));emitChannelQueueInteraction(_0xe6ea0a[_0xabf3('0x2a')],_0x42166e[_0xabf3('0x33')],_0xe6ea0a[_0xabf3('0x25')],_0xe6ea0a[_0xabf3('0x13')][_0xabf3('0x33')],_0xe6ea0a['message']['id'],![],_0x54b2f8);if(rpc[_0xe6ea0a['channel']+_0xabf3('0x34')]){return rpc[_0xe6ea0a[_0xabf3('0x2a')]+_0xabf3('0x34')]['update'](_0x3a36e3,_0xe882e)[_0xabf3('0x3a')](function(_0x38ca0f){logger[_0xabf3('0x36')](_0xabf3('0x3b'));});}}}function handleFindQueue(_0x1515e3){return function(_0x514cd7){return _0x514cd7['name'][_0xabf3('0x3e')]()===_0x1515e3[_0xabf3('0x3e')]();};}exports[_0xabf3('0x3f')]=function(_0x28b9ee,_0x40db58,_0xef8652,_0x4923c5){return function(_0x467492){try{var _0x1d2394={'name':_0x40db58[0x0],'timeout':_0x40db58[0x1]};var _0x17a817=queue[_0xabf3('0x40')](_0x1d2394,{'typecast':!![]});if(_0x17a817[_0xabf3('0x41')]){logger[_0xabf3('0x36')](_0xabf3('0x42'),_0x28b9ee,_['map'](_0x17a817,_0xabf3('0x2d'))[_0xabf3('0x43')](',\x20'));_0x467492[_0xabf3('0x44')]();}else{var _0x3d9255=_[_0xabf3('0x45')](_0xef8652[_0x4923c5[_0xabf3('0x2a')]+_0xabf3('0x46')],handleFindQueue(_0x1d2394[_0xabf3('0x33')]));if(_0x3d9255){startRouting(_0x28b9ee,_0x3d9255,_0x4923c5,_0xef8652);var _0x5869b3=(_0x3d9255[_0xabf3('0x3c')]||0xa)*0x3e8;var _0x63a1b5=(_0x1d2394['timeout']||0x14)*0x3e8;var _0x3933e0;if(_0x5869b3>_0x63a1b5){_0x63a1b5=_0x5869b3;}var _0x150095=seqqueue[_0xabf3('0x47')](_0x5869b3);_0x150095['id']=_0x28b9ee;_0x150095['atimeout']=_0x5869b3;_0x150095['qtimeout']=_0x63a1b5;_0x150095[_0xabf3('0x2a')]=_0x4923c5['channel'];_0xef8652[_0xabf3('0x48')][_0x28b9ee]['on'](_0xabf3('0x49'),function(){logger[_0xabf3('0x31')](_0xabf3('0x4a'),_0x28b9ee);stopRouting(_0x28b9ee,_0x3d9255,_0x4923c5,_0xef8652);clearTimeout(_0x3933e0);_0x3933e0=undefined;_0x150095[_0xabf3('0x4b')](!![]);if(_0xef8652[_0xabf3('0x48')][_0x28b9ee]){delete _0xef8652[_0xabf3('0x48')][_0x28b9ee];}_0x467492[_0xabf3('0x44')]();});_0xef8652[_0xabf3('0x48')][_0x28b9ee]['on'](_0xabf3('0x4c'),function(){if(_0xef8652[_0xabf3('0x48')][_0x28b9ee]){delete _0xef8652['rules'][_0x28b9ee];}});_0x3933e0=setTimeout(function(){logger[_0xabf3('0x31')](_0xabf3('0x4d'),_0x28b9ee);endRouting(_0x28b9ee,_0x3d9255,_0x4923c5,_0xef8652);clearTimeout(_0x3933e0);_0x150095['close'](!![]);_0x467492[_0xabf3('0x4e')]();},_0x63a1b5);switch(_0x3d9255[_0xabf3('0x4f')]){case _0xabf3('0x50'):strategy[_0xabf3('0x50')](_0x150095,_0x3d9255,_0xef8652,_0x4923c5);break;default:strategy[_0xabf3('0x51')](_0x150095,_0x3d9255,_0xef8652,_0x4923c5);}}else{logger[_0xabf3('0x36')]('[%s][QUEUE]\x20queue\x20not\x20found\x20%s',_0x28b9ee,_0x1d2394[_0xabf3('0x33')]);_0x467492[_0xabf3('0x44')]();}}}catch(_0x2c3017){console[_0xabf3('0x52')](_0x2c3017);logger[_0xabf3('0x36')](_0xabf3('0x42'),_0x28b9ee,_0x2c3017['stack']);_0x467492[_0xabf3('0x44')]();}};}; \ No newline at end of file +var _0x6e94=['timeout','[%s][END:QUEUE][NAME:%s]','toLowerCase','consequence','validate','length','join','stop','find','Queues','createQueue','rules','end','[%s][QUEUE]\x20ROUTING\x20STOPPED','close','complete','[%s][QUEUE]\x20APPLICATION\x20END','next','strategy','rrmemory','[%s][QUEUE]\x20queue\x20not\x20found\x20%s','log','stack','util','moment','ioredis','../../../../config/environment','../../../../config/logger','./strategy','redis','defaults','localhost','queue','from','emit','clone','account','push','InteractionId','%sQueuesWaitingInteractions','pick','format','%s:queue:%s','save','remove','../../rpc/mailQueueReport','../../rpc/smsQueueReport','../../rpc/faxQueueReport','../../rpc/whatsappQueueReport','string','name\x20is\x20a\x20string\x20and\x20it\x20is\x20required','timeout\x20is\x20a\x20number','waiting','body','YYYY-MM-DD\x20HH:mm:ss','contact','list','upperFirst','channel','QueueId','interaction','MessageId','message','chat','WebsiteId','info','name','QueueReport','catch','error','create\x20queue\x20report','update','update\x20queue\x20report'];(function(_0x3cf045,_0x53fd86){var _0x2a79c7=function(_0x1a0aa4){while(--_0x1a0aa4){_0x3cf045['push'](_0x3cf045['shift']());}};_0x2a79c7(++_0x53fd86);}(_0x6e94,0x1cd));var _0x46e9=function(_0x4ffa9d,_0x56c145){_0x4ffa9d=_0x4ffa9d-0x0;var _0x377fd3=_0x6e94[_0x4ffa9d];return _0x377fd3;};'use strict';var schema=require('validate');var _=require('lodash');var util=require(_0x46e9('0x0'));var seqqueue=require('seq-queue');var moment=require(_0x46e9('0x1'));var Redis=require(_0x46e9('0x2'));var config=require(_0x46e9('0x3'));var logger=require(_0x46e9('0x4'))('routing');var strategy=require(_0x46e9('0x5'));config[_0x46e9('0x6')]=_[_0x46e9('0x7')](config['redis'],{'host':_0x46e9('0x8'),'port':0x18eb});var io=require('socket.io-emitter')(new Redis(config[_0x46e9('0x6')]));var attributes=['id','queue_id','account',_0x46e9('0x9'),_0x46e9('0xa'),'joinAt'];function emit(_0x4db4ff,_0x14a9b9,_0x7965b8){io['to'](_0x4db4ff)[_0x46e9('0xb')](_0x14a9b9,_0x7965b8);}function emitChannelQueueInteraction(_0x245758,_0x5220f7,_0x580897,_0x5af7ed,_0x526de4,_0x3bc1b1,_0x5c06bf,_0x18b933){var _0x2c1aa5=_[_0x46e9('0xc')](_0x580897);_0x2c1aa5['queue_id']=_0x18b933;_0x2c1aa5[_0x46e9('0x9')]=_0x5220f7;_0x2c1aa5[_0x46e9('0xd')]=_0x5af7ed;_0x2c1aa5['id']=_0x526de4;if(_0x3bc1b1){attributes[_0x46e9('0xe')](_['capitalize'](_0x245758)+_0x46e9('0xf'));_0x5c06bf[util['format'](_0x46e9('0x10'),_0x245758)][_0x526de4]=_[_0x46e9('0x11')](_0x2c1aa5,attributes);}else{delete _0x5c06bf[util[_0x46e9('0x12')](_0x46e9('0x10'),_0x245758)][_0x526de4];}emit(util[_0x46e9('0x12')](_0x46e9('0x13'),_0x245758,_0x5220f7),util[_0x46e9('0x12')]('%s_queue_waiting_interaction:%s',_0x245758,_0x3bc1b1?_0x46e9('0x14'):_0x46e9('0x15')),_[_0x46e9('0x11')](_0x2c1aa5,attributes));}var rpc={'openchannelQueueReport':require('../../rpc/openchannelQueueReport'),'mailQueueReport':require(_0x46e9('0x16')),'chatQueueReport':require('../../rpc/chatQueueReport'),'smsQueueReport':require(_0x46e9('0x17')),'faxQueueReport':require(_0x46e9('0x18')),'whatsappQueueReport':require(_0x46e9('0x19'))};var queue=schema({'name':{'type':_0x46e9('0x1a'),'required':!![],'message':_0x46e9('0x1b')},'timeout':{'type':'number','message':_0x46e9('0x1c')}});function startRouting(_0x12624a,_0x43e053,_0x536a0d,_0x49f45a){if(_0x12624a&&_0x43e053&&_0x536a0d){_0x43e053[_0x46e9('0x1d')]+=0x1;var _0x292417={'uniqueid':_0x12624a,'from':_0x536a0d[_0x46e9('0x1e')]?_0x536a0d[_0x46e9('0x1e')][_0x46e9('0xa')]:'','joinAt':moment()['format'](_0x46e9('0x1f')),'ContactId':_0x536a0d[_0x46e9('0x20')]?_0x536a0d['contact']['id']:null,'ListId':_0x536a0d[_0x46e9('0x21')]?_0x536a0d[_0x46e9('0x21')]['id']:null};_0x292417[_[_0x46e9('0x22')](_0x536a0d[_0x46e9('0x23')])+_0x46e9('0x24')]=_0x43e053['id']||null;_0x292417[_[_0x46e9('0x22')](_0x536a0d[_0x46e9('0x23')])+_0x46e9('0xf')]=_0x536a0d[_0x46e9('0x25')]?_0x536a0d[_0x46e9('0x25')]['id']:null;_0x292417[_[_0x46e9('0x22')](_0x536a0d[_0x46e9('0x23')])+_0x46e9('0x26')]=_0x536a0d[_0x46e9('0x27')]?_0x536a0d[_0x46e9('0x27')]['id']:null;_0x292417[_[_0x46e9('0x22')](_0x536a0d[_0x46e9('0x23')])+(_0x536a0d[_0x46e9('0x23')]!==_0x46e9('0x28')?'AccountId':_0x46e9('0x29'))]=_0x536a0d['account']?_0x536a0d[_0x46e9('0xd')]['id']:null;logger[_0x46e9('0x2a')](util['format']('[%s][START:QUEUE][NAME:%s]',_0x12624a,_0x43e053[_0x46e9('0x2b')]));emitChannelQueueInteraction(_0x536a0d[_0x46e9('0x23')],_0x43e053[_0x46e9('0x2b')],_0x292417,_0x536a0d[_0x46e9('0xd')][_0x46e9('0x2b')],_0x536a0d[_0x46e9('0x27')]['id'],!![],_0x49f45a,_0x43e053['id']);if(rpc[_0x536a0d[_0x46e9('0x23')]+_0x46e9('0x2c')]){return rpc[_0x536a0d[_0x46e9('0x23')]+_0x46e9('0x2c')]['create'](_0x292417)[_0x46e9('0x2d')](function(_0x6a6d49){logger[_0x46e9('0x2e')](_0x46e9('0x2f'));});}}}function stopRouting(_0x1a43f0,_0x3d2a2e,_0x16fd8a,_0x3b3229){if(_0x1a43f0&&_0x3d2a2e){_0x3d2a2e[_0x46e9('0x1d')]-=0x1;var _0x3202ee={'leaveAt':moment()[_0x46e9('0x12')](_0x46e9('0x1f')),'acceptAt':moment()[_0x46e9('0x12')]('YYYY-MM-DD\x20HH:mm:ss'),'reason':'accepted'};logger[_0x46e9('0x2a')](util[_0x46e9('0x12')]('[%s][STOP:QUEUE][NAME:%s]',_0x1a43f0,_0x3d2a2e[_0x46e9('0x2b')]));emitChannelQueueInteraction(_0x16fd8a[_0x46e9('0x23')],_0x3d2a2e['name'],_0x16fd8a[_0x46e9('0x1e')],_0x16fd8a[_0x46e9('0xd')]['name'],_0x16fd8a[_0x46e9('0x27')]['id'],![],_0x3b3229,_0x3d2a2e['id']);if(rpc[_0x16fd8a[_0x46e9('0x23')]+_0x46e9('0x2c')]){return rpc[_0x16fd8a[_0x46e9('0x23')]+_0x46e9('0x2c')][_0x46e9('0x30')](_0x1a43f0,_0x3202ee)[_0x46e9('0x2d')](function(_0x2c3e5a){logger[_0x46e9('0x2e')](_0x46e9('0x31'));});}}}function endRouting(_0x4f0d86,_0x4de44c,_0x45de4f,_0x4e0a01){if(_0x4f0d86&&_0x4de44c){_0x4de44c[_0x46e9('0x1d')]-=0x1;var _0x29aceb={'leaveAt':moment()[_0x46e9('0x12')](_0x46e9('0x1f')),'exitAt':moment()[_0x46e9('0x12')](_0x46e9('0x1f')),'reason':_0x46e9('0x32')};logger[_0x46e9('0x2a')](util[_0x46e9('0x12')](_0x46e9('0x33'),_0x4f0d86,_0x4de44c[_0x46e9('0x2b')]));emitChannelQueueInteraction(_0x45de4f[_0x46e9('0x23')],_0x4de44c[_0x46e9('0x2b')],_0x45de4f[_0x46e9('0x1e')],_0x45de4f[_0x46e9('0xd')][_0x46e9('0x2b')],_0x45de4f[_0x46e9('0x27')]['id'],![],_0x4e0a01);if(rpc[_0x45de4f['channel']+_0x46e9('0x2c')]){return rpc[_0x45de4f['channel']+'QueueReport'][_0x46e9('0x30')](_0x4f0d86,_0x29aceb)['catch'](function(_0x27257f){logger['error'](_0x46e9('0x31'));});}}}function handleFindQueue(_0x7d60b){return function(_0x137893){return _0x137893[_0x46e9('0x2b')]['toLowerCase']()===_0x7d60b[_0x46e9('0x34')]();};}exports[_0x46e9('0x35')]=function(_0x2d3dc5,_0xbd3d7,_0x3d2193,_0x46ff71){return function(_0x4d52af){try{var _0x229948={'name':_0xbd3d7[0x0],'timeout':_0xbd3d7[0x1]};var _0x53afc4=queue[_0x46e9('0x36')](_0x229948,{'typecast':!![]});if(_0x53afc4[_0x46e9('0x37')]){logger[_0x46e9('0x2e')]('[%s][QUEUE]\x20%s',_0x2d3dc5,_['map'](_0x53afc4,_0x46e9('0x27'))[_0x46e9('0x38')](',\x20'));_0x4d52af[_0x46e9('0x39')]();}else{var _0x266f95=_[_0x46e9('0x3a')](_0x3d2193[_0x46ff71[_0x46e9('0x23')]+_0x46e9('0x3b')],handleFindQueue(_0x229948[_0x46e9('0x2b')]));if(_0x266f95){startRouting(_0x2d3dc5,_0x266f95,_0x46ff71,_0x3d2193);var _0x2cf81a=(_0x266f95['timeout']||0xa)*0x3e8;var _0x5c1e27=(_0x229948[_0x46e9('0x32')]||0x14)*0x3e8;var _0x19077f;if(_0x2cf81a>_0x5c1e27){_0x5c1e27=_0x2cf81a;}var _0x5d8eb7=seqqueue[_0x46e9('0x3c')](_0x2cf81a);_0x5d8eb7['id']=_0x2d3dc5;_0x5d8eb7['atimeout']=_0x2cf81a;_0x5d8eb7['qtimeout']=_0x5c1e27;_0x5d8eb7[_0x46e9('0x23')]=_0x46ff71['channel'];_0x3d2193[_0x46e9('0x3d')][_0x2d3dc5]['on'](_0x46e9('0x3e'),function(){logger[_0x46e9('0x2a')](_0x46e9('0x3f'),_0x2d3dc5);stopRouting(_0x2d3dc5,_0x266f95,_0x46ff71,_0x3d2193);clearTimeout(_0x19077f);_0x19077f=undefined;_0x5d8eb7[_0x46e9('0x40')](!![]);if(_0x3d2193[_0x46e9('0x3d')][_0x2d3dc5]){delete _0x3d2193[_0x46e9('0x3d')][_0x2d3dc5];}_0x4d52af[_0x46e9('0x39')]();});_0x3d2193[_0x46e9('0x3d')][_0x2d3dc5]['on'](_0x46e9('0x41'),function(){if(_0x3d2193[_0x46e9('0x3d')][_0x2d3dc5]){delete _0x3d2193[_0x46e9('0x3d')][_0x2d3dc5];}});_0x19077f=setTimeout(function(){logger[_0x46e9('0x2a')](_0x46e9('0x42'),_0x2d3dc5);endRouting(_0x2d3dc5,_0x266f95,_0x46ff71,_0x3d2193);clearTimeout(_0x19077f);_0x5d8eb7[_0x46e9('0x40')](!![]);_0x4d52af[_0x46e9('0x43')]();},_0x5c1e27);switch(_0x266f95[_0x46e9('0x44')]){case _0x46e9('0x45'):strategy['rrmemory'](_0x5d8eb7,_0x266f95,_0x3d2193,_0x46ff71);break;default:strategy['beepall'](_0x5d8eb7,_0x266f95,_0x3d2193,_0x46ff71);}}else{logger[_0x46e9('0x2e')](_0x46e9('0x46'),_0x2d3dc5,_0x229948['name']);_0x4d52af[_0x46e9('0x39')]();}}}catch(_0x19683d){console[_0x46e9('0x47')](_0x19683d);logger[_0x46e9('0x2e')]('[%s][QUEUE]\x20%s',_0x2d3dc5,_0x19683d[_0x46e9('0x48')]);_0x4d52af[_0x46e9('0x39')]();}};}; \ 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 e483c10..b6dea2e 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 _0x84ab=['realtime','channel','busy','busyQueue','saveWaitingNotification','showNotification','writeLog','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20timeout\x20with\x20%s','hideNotification','removeWaitingNotification','TIMEOUT','exports','lodash','uuid','./util','../../../../../config/logger','routing','notificationId','squeue','agent','push','bind','handleTimeout','prototype','handleRun','handleDrained','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','forcedOwnership','isAgentAvailable'];(function(_0x4565bf,_0x5ad9d6){var _0x5610ba=function(_0x170988){while(--_0x170988){_0x4565bf['push'](_0x4565bf['shift']());}};_0x5610ba(++_0x5ad9d6);}(_0x84ab,0x12f));var _0xb84a=function(_0x2a6809,_0x44edde){_0x2a6809=_0x2a6809-0x0;var _0x11c371=_0x84ab[_0x2a6809];return _0x11c371;};'use strict';var _=require(_0xb84a('0x0'));var uuid=require(_0xb84a('0x1'));var util=require(_0xb84a('0x2'));var logger=require(_0xb84a('0x3'))(_0xb84a('0x4'));var Agent=function(_0x512f13,_0xc83587,_0x18a4a5,_0x47b8e3){this[_0xb84a('0x5')]=uuid['v4']();this[_0xb84a('0x6')]=_0x512f13;this[_0xb84a('0x7')]=_0xc83587;this['realtime']=_0x18a4a5;this['routing']=_0x47b8e3;this['squeue'][_0xb84a('0x8')](this['handleRun'][_0xb84a('0x9')](this),this[_0xb84a('0xa')]['bind'](this));this[_0xb84a('0x6')]['on']('timeout',this[_0xb84a('0xa')][_0xb84a('0x9')](this));this[_0xb84a('0x6')]['on']('drained',this['handleDrained']['bind'](this));};Agent[_0xb84a('0xb')][_0xb84a('0x8')]=function(){this[_0xb84a('0x6')][_0xb84a('0x8')](this[_0xb84a('0xc')]['bind'](this),this[_0xb84a('0xa')][_0xb84a('0x9')](this));};Agent[_0xb84a('0xb')][_0xb84a('0xd')]=function(){this[_0xb84a('0xa')](!![]);};Agent[_0xb84a('0xb')][_0xb84a('0xc')]=function(){logger[_0xb84a('0xe')](_0xb84a('0xf'),this[_0xb84a('0x6')]['id'],this[_0xb84a('0x7')]['id']);if(_[_0xb84a('0x10')](this['realtime'][_0xb84a('0x11')][this[_0xb84a('0x7')]['id']])){logger[_0xb84a('0xe')](_0xb84a('0x12'),this[_0xb84a('0x6')]['id'],this[_0xb84a('0x7')]['id']);setTimeout(this[_0xb84a('0x8')][_0xb84a('0x9')](this),0x3e8);}else{if(this[_0xb84a('0x4')][_0xb84a('0x13')]||util[_0xb84a('0x14')](this[_0xb84a('0x6')]['id'],this[_0xb84a('0x15')][_0xb84a('0x11')][this['agent']['id']],this[_0xb84a('0x6')][_0xb84a('0x16')],![])){this['realtime'][_0xb84a('0x11')][this[_0xb84a('0x7')]['id']][_0xb84a('0x17')]=!![];this[_0xb84a('0x15')]['agents'][this['agent']['id']][_0xb84a('0x18')]=undefined;util[_0xb84a('0x19')](this[_0xb84a('0x15')],this[_0xb84a('0x4')],this[_0xb84a('0x7')],this[_0xb84a('0x6')][_0xb84a('0x16')]);util[_0xb84a('0x1a')](this[_0xb84a('0x5')],this[_0xb84a('0x6')]['id'],this[_0xb84a('0x15')][_0xb84a('0x11')][this[_0xb84a('0x7')]['id']],null,this[_0xb84a('0x4')]);util[_0xb84a('0x1b')](this[_0xb84a('0x6')]['id'],this[_0xb84a('0x15')][_0xb84a('0x11')][this[_0xb84a('0x7')]['id']],_0xb84a('0x1c')+(this[_0xb84a('0x4')][_0xb84a('0x13')]?_0xb84a('0x1d'):''));}else{logger[_0xb84a('0xe')](_0xb84a('0x1e'),this[_0xb84a('0x6')]['id'],this['agent']['id']);setTimeout(this['push'][_0xb84a('0x9')](this),0x3e8);}}};Agent[_0xb84a('0xb')]['handleTimeout']=function(_0x1f690a){if(_[_0xb84a('0x10')](this['realtime']['agents'][this[_0xb84a('0x7')]['id']])){return logger[_0xb84a('0xe')]('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xb84a('0x6')]['id'],this[_0xb84a('0x7')]['id']);}else{logger[_0xb84a('0xe')](_0xb84a('0x1f'),this[_0xb84a('0x6')]['id'],this[_0xb84a('0x7')]['id']);util[_0xb84a('0x20')](this[_0xb84a('0x5')],this['squeue']['id'],this[_0xb84a('0x15')]['agents'][this['agent']['id']],null,this[_0xb84a('0x4')]);this[_0xb84a('0x15')]['agents'][this['agent']['id']][_0xb84a('0x17')]=![];this[_0xb84a('0x15')][_0xb84a('0x11')][this[_0xb84a('0x7')]['id']][_0xb84a('0x18')]=undefined;util[_0xb84a('0x21')](this[_0xb84a('0x15')],this[_0xb84a('0x4')],this['agent'],this[_0xb84a('0x6')][_0xb84a('0x16')]);util[_0xb84a('0x1b')](this[_0xb84a('0x6')]['id'],this[_0xb84a('0x15')][_0xb84a('0x11')][this[_0xb84a('0x7')]['id']],_0x1f690a?'STOP':_0xb84a('0x22'));}if(!_0x1f690a){setTimeout(this['push'][_0xb84a('0x9')](this),0x3e8);}};function agent(_0xb93cca,_0x2f7e6c,_0x4d04fb,_0x4af084){return new Agent(_0xb93cca,_0x2f7e6c,_0x4d04fb,_0x4af084);}module[_0xb84a('0x23')]=agent; \ No newline at end of file +var _0xd67b=['handleRun','bind','handleTimeout','timeout','handleDrained','prototype','debug','[%s][AGENT]\x20try\x20with\x20%s','isNil','agents','forcedOwnership','isAgentAvailable','channel','busy','saveWaitingNotification','showNotification','RINGING',':FORCED','[%s][AGENT]\x20agent\x20%s\x20is\x20not\x20available','[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s','[%s][AGENT]\x20timeout\x20with\x20%s','busyQueue','removeWaitingNotification','writeLog','STOP','TIMEOUT','exports','uuid','../../../../../config/logger','routing','notificationId','agent','realtime','squeue','push'];(function(_0x57b8bf,_0x10c126){var _0x5bfcca=function(_0x4f5658){while(--_0x4f5658){_0x57b8bf['push'](_0x57b8bf['shift']());}};_0x5bfcca(++_0x10c126);}(_0xd67b,0x133));var _0xbd67=function(_0xce47f6,_0x58e13c){_0xce47f6=_0xce47f6-0x0;var _0xdad98d=_0xd67b[_0xce47f6];return _0xdad98d;};'use strict';var _=require('lodash');var uuid=require(_0xbd67('0x0'));var util=require('./util');var logger=require(_0xbd67('0x1'))(_0xbd67('0x2'));var Agent=function(_0x317e33,_0x5e967b,_0x40e384,_0x50da5a){this[_0xbd67('0x3')]=uuid['v4']();this['squeue']=_0x317e33;this[_0xbd67('0x4')]=_0x5e967b;this[_0xbd67('0x5')]=_0x40e384;this[_0xbd67('0x2')]=_0x50da5a;this[_0xbd67('0x6')][_0xbd67('0x7')](this[_0xbd67('0x8')][_0xbd67('0x9')](this),this[_0xbd67('0xa')][_0xbd67('0x9')](this));this[_0xbd67('0x6')]['on'](_0xbd67('0xb'),this[_0xbd67('0xa')][_0xbd67('0x9')](this));this['squeue']['on']('drained',this[_0xbd67('0xc')]['bind'](this));};Agent[_0xbd67('0xd')][_0xbd67('0x7')]=function(){this[_0xbd67('0x6')][_0xbd67('0x7')](this[_0xbd67('0x8')][_0xbd67('0x9')](this),this[_0xbd67('0xa')][_0xbd67('0x9')](this));};Agent[_0xbd67('0xd')][_0xbd67('0xc')]=function(){this['handleTimeout'](!![]);};Agent[_0xbd67('0xd')][_0xbd67('0x8')]=function(){logger[_0xbd67('0xe')](_0xbd67('0xf'),this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);if(_[_0xbd67('0x10')](this[_0xbd67('0x5')][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']])){logger['debug']('[%s][AGENT]\x20agent\x20skipped,\x20unknown\x20id\x20%s',this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);setTimeout(this[_0xbd67('0x7')]['bind'](this),0x3e8);}else{if(this[_0xbd67('0x2')][_0xbd67('0x12')]||util[_0xbd67('0x13')](this['squeue']['id'],this[_0xbd67('0x5')]['agents'][this[_0xbd67('0x4')]['id']],this[_0xbd67('0x6')][_0xbd67('0x14')],![])){this['realtime'][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']][_0xbd67('0x15')]=!![];this[_0xbd67('0x5')][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']]['busyQueue']=undefined;util[_0xbd67('0x16')](this[_0xbd67('0x5')],this[_0xbd67('0x2')],this[_0xbd67('0x4')],this[_0xbd67('0x6')][_0xbd67('0x14')]);util[_0xbd67('0x17')](this[_0xbd67('0x3')],this[_0xbd67('0x6')]['id'],this[_0xbd67('0x5')][_0xbd67('0x11')][this['agent']['id']],null,this[_0xbd67('0x2')]);util['writeLog'](this[_0xbd67('0x6')]['id'],this[_0xbd67('0x5')][_0xbd67('0x11')][this['agent']['id']],_0xbd67('0x18')+(this[_0xbd67('0x2')]['forcedOwnership']?_0xbd67('0x19'):''));}else{logger[_0xbd67('0xe')](_0xbd67('0x1a'),this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);setTimeout(this['push']['bind'](this),0x3e8);}}};Agent[_0xbd67('0xd')][_0xbd67('0xa')]=function(_0x4675ac){if(_[_0xbd67('0x10')](this[_0xbd67('0x5')][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']])){return logger[_0xbd67('0xe')](_0xbd67('0x1b'),this[_0xbd67('0x6')]['id'],this['agent']['id']);}else{logger['debug'](_0xbd67('0x1c'),this[_0xbd67('0x6')]['id'],this[_0xbd67('0x4')]['id']);util['hideNotification'](this[_0xbd67('0x3')],this[_0xbd67('0x6')]['id'],this[_0xbd67('0x5')][_0xbd67('0x11')][this['agent']['id']],null,this['routing']);this['realtime'][_0xbd67('0x11')][this[_0xbd67('0x4')]['id']][_0xbd67('0x15')]=![];this['realtime']['agents'][this[_0xbd67('0x4')]['id']][_0xbd67('0x1d')]=undefined;util[_0xbd67('0x1e')](this[_0xbd67('0x5')],this[_0xbd67('0x2')],this[_0xbd67('0x4')],this['squeue'][_0xbd67('0x14')]);util[_0xbd67('0x1f')](this[_0xbd67('0x6')]['id'],this['realtime'][_0xbd67('0x11')][this['agent']['id']],_0x4675ac?_0xbd67('0x20'):_0xbd67('0x21'));}if(!_0x4675ac){setTimeout(this['push'][_0xbd67('0x9')](this),0x3e8);}};function agent(_0x126514,_0x20eb75,_0x31f689,_0x1b2777){return new Agent(_0x126514,_0x20eb75,_0x31f689,_0x1b2777);}module[_0xbd67('0x22')]=agent; \ No newline at end of file diff --git a/server/services/routing/server/applications/strategy/beepall.js b/server/services/routing/server/applications/strategy/beepall.js index c85c527..9ff81b9 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 _0x0b9f=['timeout','drained','prototype','push','handleDrained','isNil','Agents','length','agents','debug','isAgentAvailable','channel','writeLog','busyQueue','name','showNotification','notificationId','[%s][QUEUE]\x20EMPTY','[%s][QUEUE]\x20agent\x20skipped,\x20unknown\x20id\x20%s','hideNotification','STOP','TIMEOUT','removeWaitingNotification','exports','lodash','uuid','./util','../../../../../config/logger','squeue','queue','realtime','routing','handleRun','handleTimeout','bind'];(function(_0x2499b4,_0x50738d){var _0x159617=function(_0x196de3){while(--_0x196de3){_0x2499b4['push'](_0x2499b4['shift']());}};_0x159617(++_0x50738d);}(_0x0b9f,0x1bc));var _0xf0b9=function(_0x8abbd0,_0x3ee1d5){_0x8abbd0=_0x8abbd0-0x0;var _0x1f1727=_0x0b9f[_0x8abbd0];return _0x1f1727;};'use strict';var _=require(_0xf0b9('0x0'));var uuid=require(_0xf0b9('0x1'));var util=require(_0xf0b9('0x2'));var logger=require(_0xf0b9('0x3'))('routing');var Beepall=function(_0x578ded,_0x8b2de7,_0x56534b,_0x121dd4){this['notificationId']=uuid['v4']();this[_0xf0b9('0x4')]=_0x578ded;this[_0xf0b9('0x5')]=_0x8b2de7;this[_0xf0b9('0x6')]=_0x56534b;this[_0xf0b9('0x7')]=_0x121dd4;this[_0xf0b9('0x4')]['push'](this[_0xf0b9('0x8')]['bind'](this),this[_0xf0b9('0x9')][_0xf0b9('0xa')](this));this[_0xf0b9('0x4')]['on'](_0xf0b9('0xb'),this[_0xf0b9('0x9')]['bind'](this));this['squeue']['on'](_0xf0b9('0xc'),this['handleDrained'][_0xf0b9('0xa')](this));};Beepall[_0xf0b9('0xd')]['push']=function(){this['squeue'][_0xf0b9('0xe')](this[_0xf0b9('0x8')]['bind'](this),this[_0xf0b9('0x9')]['bind'](this));};Beepall[_0xf0b9('0xd')][_0xf0b9('0xf')]=function(){this[_0xf0b9('0x9')](!![]);};Beepall[_0xf0b9('0xd')][_0xf0b9('0x8')]=function(){var _0x5baf73=!![];if(!_[_0xf0b9('0x10')](this[_0xf0b9('0x5')])&&!_['isNil'](this[_0xf0b9('0x5')]['Agents'])&&this[_0xf0b9('0x5')][_0xf0b9('0x11')][_0xf0b9('0x12')]>0x0){for(var _0x20d976=0x0,_0x3ccf7f;_0x20d9760x0){for(var _0x3a17f9=0x0,_0x21cb60;_0x3a17f90x0&&_0x3c5a30[_0x23f5cd+_0xa4a8('0x24')]>=_0x3c5a30[_0x23f5cd+_0xa4a8('0x23')]){writeLog(_0x1990b7,_0x3c5a30,_0x23f5cd[_0xa4a8('0x25')]()+_0xa4a8('0x26'));return![];}}return!![];};exports['showNotification']=function(_0x1e3e8,_0xb21fd0,_0x13d08d,_0x4c2238,_0x1625b6){return sendNotification(!![],_0x1e3e8,_0xb21fd0,_0x13d08d,_0x4c2238,_0x1625b6);};exports[_0xa4a8('0x27')]=function(_0x2c9c05,_0x24bd29,_0x1c984d,_0x363159,_0x3527e0){return sendNotification(![],_0x2c9c05,_0x24bd29,_0x1c984d,_0x363159,_0x3527e0);};exports['checkWaitingNotifications']=function(_0x4793b4,_0x3683ec,_0x8fe654){var _0x45c0ac=_0x3683ec[_0xa4a8('0x28')][_0xa4a8('0x29')];if(!_0x45c0ac&&_0x8fe654){_0x45c0ac=_0x8fe654['id'];}var _0x3e55d0=_[_0xa4a8('0x2a')](_0x4793b4[_0x3683ec['channel']+_0xa4a8('0x2b')],function(_0x50a186){var _0x10b397=_['capitalize'](_0x3683ec['channel'])+_0xa4a8('0x2c');return _0x50a186[_0x10b397]===_0x3683ec[_0xa4a8('0x28')]['id'];});if(!_0x3e55d0&&_0x45c0ac){_0x3e55d0=_['some'](_0x4793b4[_0xa4a8('0x2d')][_0x45c0ac][_0x3683ec[_0xa4a8('0x2e')]+_0xa4a8('0x2f')],function(_0x3efc49){return _0x3efc49['id']===_0x3683ec[_0xa4a8('0x28')]['id'];});}return _0x3e55d0;};exports[_0xa4a8('0x30')]=function(_0x1f1d87,_0x231d11,_0x2142ed,_0x28c37d){_0x1f1d87[_0xa4a8('0x2d')][_0x2142ed['id']][_0x28c37d+_0xa4a8('0x2f')][_0x231d11[_0xa4a8('0x17')]['id']]={'id':_0x231d11[_0xa4a8('0x28')]['id']};};exports[_0xa4a8('0x31')]=function(_0x5931db,_0x10efab,_0x4a94c0,_0x2338f7){delete _0x5931db[_0xa4a8('0x2d')][_0x4a94c0['id']][_0x2338f7+'WaitingInteractions'][_0x10efab[_0xa4a8('0x17')]['id']];};exports[_0xa4a8('0x32')]=writeLog; \ No newline at end of file +var _0xd2c2=['format','message','user:%s','emit','notification:%s','save','debug','[%s][QUEUE][AGENT:%s][STATUS:%s]','busy','BUSY','online','OFFLINE','Pause','PAUSE','hasOwnProperty','Capacity','CurrentCapacity','toUpperCase','showNotification','hideNotification','checkWaitingNotifications','interaction','UserId','some','channel','QueuesWaitingInteractions','InteractionId','agents','WaitingInteractions','saveWaitingNotification','removeWaitingNotification','writeLog','lodash','ioredis','../../../../../config/environment','../../../../../config/logger','redis','defaults','localhost','socket.io-emitter','user:save','split','\x20interaction','name','account','notificationSound','notificationShake','body','queue','msg','getMustacheRender','notificationTemplate','error'];(function(_0x4496c2,_0x4450f3){var _0x4e46d2=function(_0x47ed29){while(--_0x47ed29){_0x4496c2['push'](_0x4496c2['shift']());}};_0x4e46d2(++_0x4450f3);}(_0xd2c2,0x129));var _0x2d2c=function(_0x182d73,_0x4c38b3){_0x182d73=_0x182d73-0x0;var _0x500002=_0xd2c2[_0x182d73];return _0x500002;};'use strict';var _=require(_0x2d2c('0x0'));var util=require('util');var utils=require('../utils');var Redis=require(_0x2d2c('0x1'));var config=require(_0x2d2c('0x2'));var logger=require(_0x2d2c('0x3'))('routing');config[_0x2d2c('0x4')]=_[_0x2d2c('0x5')](config['redis'],{'host':_0x2d2c('0x6'),'port':0x18eb});var io=require(_0x2d2c('0x7'))(new Redis(config[_0x2d2c('0x4')]));function sendNotification(_0x30bb56,_0x256d79,_0x28a0f7,_0x34dab9,_0x5a4b81,_0x366bc1){io['to'](util['format']('user:%s',_0x34dab9['name']))['emit'](_0x2d2c('0x8'),_0x34dab9);var _0x3bf3c7=_0x366bc1||{};var _0x35d94e=_0x28a0f7[_0x2d2c('0x9')]('.');var _0x53d189={'uniqueid':_0x256d79,'channel':_0x35d94e[0x0],'id':_0x35d94e[0x1],'title':_0x35d94e[0x0]+_0x2d2c('0xa'),'interactionId':_0x35d94e[0x2],'queue':_0x5a4b81?_0x5a4b81[_0x2d2c('0xb')]:null,'sound':_0x3bf3c7[_0x2d2c('0xc')][_0x2d2c('0xd')],'shake':_0x3bf3c7[_0x2d2c('0xc')][_0x2d2c('0xe')]};try{if(!_0x3bf3c7[_0x2d2c('0xf')]){_0x3bf3c7[_0x2d2c('0xf')]={};}if(_0x5a4b81){_0x3bf3c7['body'][_0x2d2c('0x10')]=_0x5a4b81;}else if(_0x3bf3c7[_0x2d2c('0xf')][_0x2d2c('0x10')]){delete _0x3bf3c7['body'][_0x2d2c('0x10')];}_0x53d189[_0x2d2c('0x11')]=utils[_0x2d2c('0x12')](_0x3bf3c7[_0x2d2c('0xc')][_0x2d2c('0x13')],_0x3bf3c7);}catch(_0x12f2d4){_0x53d189[_0x2d2c('0x11')]='I\x20can\x27t\x20render\x20your\x20template';logger[_0x2d2c('0x14')](util[_0x2d2c('0x15')]('[%s][QUEUE]\x20%s',_0x256d79,_0x12f2d4[_0x2d2c('0x16')]));}io['to'](util[_0x2d2c('0x15')](_0x2d2c('0x17'),_0x34dab9[_0x2d2c('0xb')]))[_0x2d2c('0x18')](util[_0x2d2c('0x15')](_0x2d2c('0x19'),_0x30bb56?_0x2d2c('0x1a'):'remove'),_0x53d189);}function writeLog(_0x30656d,_0x360f0e,_0x107b4a){return logger[_0x2d2c('0x1b')](util['format'](_0x2d2c('0x1c'),_0x30656d,_0x360f0e[_0x2d2c('0xb')],_0x107b4a));}exports['isAgentAvailable']=function(_0x3ccb4d,_0x22f5f,_0x4e6517,_0x4f7523){if(_0x22f5f[_0x2d2c('0x1d')]){writeLog(_0x3ccb4d,_0x22f5f,_0x2d2c('0x1e'));return![];}if(!_0x22f5f[_0x2d2c('0x1f')]){writeLog(_0x3ccb4d,_0x22f5f,_0x2d2c('0x20'));return![];}if(_0x22f5f[_0x4e6517+_0x2d2c('0x21')]){writeLog(_0x3ccb4d,_0x22f5f,_0x2d2c('0x22'));return![];}if(_0x4f7523&&_0x22f5f[_0x2d2c('0x23')](_0x4e6517+_0x2d2c('0x24'))&&_0x22f5f['hasOwnProperty'](_0x4e6517+_0x2d2c('0x25'))){if(_0x22f5f[_0x4e6517+_0x2d2c('0x24')]>0x0&&_0x22f5f[_0x4e6517+_0x2d2c('0x25')]>=_0x22f5f[_0x4e6517+_0x2d2c('0x24')]){writeLog(_0x3ccb4d,_0x22f5f,_0x4e6517[_0x2d2c('0x26')]()+'\x20MAXCAPACITY');return![];}}return!![];};exports[_0x2d2c('0x27')]=function(_0x37d15e,_0x1eddab,_0x510fa1,_0x5a5df0,_0x3c7113){return sendNotification(!![],_0x37d15e,_0x1eddab,_0x510fa1,_0x5a5df0,_0x3c7113);};exports[_0x2d2c('0x28')]=function(_0x4989e3,_0x549293,_0x4a92b6,_0xd13d6a,_0x47f0e9){return sendNotification(![],_0x4989e3,_0x549293,_0x4a92b6,_0xd13d6a,_0x47f0e9);};exports[_0x2d2c('0x29')]=function(_0x46bee4,_0x53ac56,_0x2e70fa){var _0x270e31=_0x53ac56[_0x2d2c('0x2a')][_0x2d2c('0x2b')];if(!_0x270e31&&_0x2e70fa){_0x270e31=_0x2e70fa['id'];}var _0x3aab30=_[_0x2d2c('0x2c')](_0x46bee4[_0x53ac56[_0x2d2c('0x2d')]+_0x2d2c('0x2e')],function(_0x2f20ad){var _0x2d428e=_['capitalize'](_0x53ac56[_0x2d2c('0x2d')])+_0x2d2c('0x2f');return _0x2f20ad[_0x2d428e]===_0x53ac56['interaction']['id'];});if(!_0x3aab30&&_0x270e31){_0x3aab30=_[_0x2d2c('0x2c')](_0x46bee4[_0x2d2c('0x30')][_0x270e31][_0x53ac56[_0x2d2c('0x2d')]+_0x2d2c('0x31')],function(_0x49f42b){return _0x49f42b['id']===_0x53ac56[_0x2d2c('0x2a')]['id'];});}return _0x3aab30;};exports[_0x2d2c('0x32')]=function(_0x4dbf2c,_0xfe84f6,_0x6c7fb4,_0x288e43){_0x4dbf2c[_0x2d2c('0x30')][_0x6c7fb4['id']][_0x288e43+'WaitingInteractions'][_0xfe84f6[_0x2d2c('0x16')]['id']]={'id':_0xfe84f6[_0x2d2c('0x2a')]['id']};};exports[_0x2d2c('0x33')]=function(_0x302055,_0x544466,_0x436dde,_0x39314d){delete _0x302055[_0x2d2c('0x30')][_0x436dde['id']][_0x39314d+_0x2d2c('0x31')][_0x544466['message']['id']];};exports[_0x2d2c('0x34')]=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 4dddb96..5cdf162 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 _0xe781=['[%s][SYSTEM]\x20result\x20code:\x20%s','isEmpty','[%s][SYSTEM]\x20no\x20variable','body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','next','[%s][SYSTEM]\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','../../../../config/logger','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','error','map','message','join','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','getMustacheRender','info','[%s][SYSTEM]\x20commnad:\x20%s','exec','trim'];(function(_0xda4e6a,_0x4cc04b){var _0x2ad650=function(_0x36fa95){while(--_0x36fa95){_0xda4e6a['push'](_0xda4e6a['shift']());}};_0x2ad650(++_0x4cc04b);}(_0xe781,0x141));var _0x1e78=function(_0x1374ee,_0x3d8967){_0x1374ee=_0x1374ee-0x0;var _0x1d724b=_0xe781[_0x1374ee];return _0x1d724b;};'use strict';var schema=require(_0x1e78('0x0'));var sh=require(_0x1e78('0x1'));var _=require(_0x1e78('0x2'));var utils=require(_0x1e78('0x3'));var logger=require(_0x1e78('0x4'))('routing');var system=schema({'command':{'type':_0x1e78('0x5'),'required':!![],'message':_0x1e78('0x6')}});exports['consequence']=function(_0x3f8ce9,_0x2961a0){return function(_0x4bf3e6){try{var _0x11754a={'command':_0x2961a0[0x0]};var _0x4010cf=system[_0x1e78('0x0')](_0x11754a,{'typecast':!![]});if(_0x4010cf['length']){logger[_0x1e78('0x7')]('[%s][SYSTEM]\x20%s',_0x3f8ce9,_[_0x1e78('0x8')](_0x4010cf,_0x1e78('0x9'))[_0x1e78('0xa')](',\x20'));logger['info'](_0x1e78('0xb'),_0x3f8ce9);_0x4bf3e6['next']();}else{var _0x9a60b1=this;var _0x3503d3=utils[_0x1e78('0xc')](_0x2961a0[0x0],this);logger[_0x1e78('0xd')](_0x1e78('0xe'),_0x3f8ce9,_0x3503d3);sh[_0x1e78('0xf')](_[_0x1e78('0x10')](_0x3503d3),function(_0x275bbe,_0x2eae59){logger[_0x1e78('0xd')](_0x1e78('0x11'),_0x3f8ce9,_0x275bbe);if(_0x275bbe==0x0){var _0x41d6bd=_0x2eae59['replace'](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x2961a0[0x1])||_[_0x1e78('0x12')](_0x2961a0[0x1])){logger[_0x1e78('0xd')](_0x1e78('0x13'),_0x3f8ce9);_0x9a60b1[_0x1e78('0x14')][_0x2961a0[0x1]]=_0x41d6bd;}else{logger[_0x1e78('0xd')](_0x1e78('0x15'),_0x3f8ce9,_0x2961a0[0x1],_0x41d6bd);_0x9a60b1[_0x1e78('0x14')][_0x2961a0[0x1]]=_0x41d6bd;}}_0x4bf3e6[_0x1e78('0x16')]();});}}catch(_0x524016){logger[_0x1e78('0x7')](_0x1e78('0x17'),_0x3f8ce9,_[_0x1e78('0x18')](_0x524016)?JSON[_0x1e78('0x19')](_0x524016):_0x524016);logger[_0x1e78('0xd')](_0x1e78('0xb'),_0x3f8ce9);_0x4bf3e6[_0x1e78('0x16')]();}};}; \ No newline at end of file +var _0x6700=['body','[%s][SYSTEM]\x20set\x20variable\x20%s:\x20%s','isObject','stringify','validate','shelljs','lodash','./utils','routing','string','command\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','error','[%s][SYSTEM]\x20%s','map','join','info','[%s][SYSTEM]\x20no\x20command\x20executed,\x20force\x20next','next','[%s][SYSTEM]\x20commnad:\x20%s','trim','[%s][SYSTEM]\x20result\x20code:\x20%s','replace','isEmpty'];(function(_0x122d7d,_0x231daa){var _0xf9b0af=function(_0x3791c0){while(--_0x3791c0){_0x122d7d['push'](_0x122d7d['shift']());}};_0xf9b0af(++_0x231daa);}(_0x6700,0xb3));var _0x0670=function(_0x461aa8,_0x29f70e){_0x461aa8=_0x461aa8-0x0;var _0x2d92c2=_0x6700[_0x461aa8];return _0x2d92c2;};'use strict';var schema=require(_0x0670('0x0'));var sh=require(_0x0670('0x1'));var _=require(_0x0670('0x2'));var utils=require(_0x0670('0x3'));var logger=require('../../../../config/logger')(_0x0670('0x4'));var system=schema({'command':{'type':_0x0670('0x5'),'required':!![],'message':_0x0670('0x6')}});exports[_0x0670('0x7')]=function(_0x7436b1,_0x1760bc){return function(_0x4f4152){try{var _0x3173cb={'command':_0x1760bc[0x0]};var _0x3a17b7=system[_0x0670('0x0')](_0x3173cb,{'typecast':!![]});if(_0x3a17b7[_0x0670('0x8')]){logger[_0x0670('0x9')](_0x0670('0xa'),_0x7436b1,_[_0x0670('0xb')](_0x3a17b7,'message')[_0x0670('0xc')](',\x20'));logger[_0x0670('0xd')](_0x0670('0xe'),_0x7436b1);_0x4f4152[_0x0670('0xf')]();}else{var _0x1f643f=this;var _0x5b698d=utils['getMustacheRender'](_0x1760bc[0x0],this);logger['info'](_0x0670('0x10'),_0x7436b1,_0x5b698d);sh['exec'](_[_0x0670('0x11')](_0x5b698d),function(_0x30781f,_0x2a85bd){logger[_0x0670('0xd')](_0x0670('0x12'),_0x7436b1,_0x30781f);if(_0x30781f==0x0){var _0x42b322=_0x2a85bd[_0x0670('0x13')](/(\r\n|\n|\r)/gm,'');if(_['isNil'](_0x1760bc[0x1])||_[_0x0670('0x14')](_0x1760bc[0x1])){logger[_0x0670('0xd')]('[%s][SYSTEM]\x20no\x20variable',_0x7436b1);_0x1f643f[_0x0670('0x15')][_0x1760bc[0x1]]=_0x42b322;}else{logger[_0x0670('0xd')](_0x0670('0x16'),_0x7436b1,_0x1760bc[0x1],_0x42b322);_0x1f643f[_0x0670('0x15')][_0x1760bc[0x1]]=_0x42b322;}}_0x4f4152[_0x0670('0xf')]();});}}catch(_0x31f70b){logger[_0x0670('0x9')](_0x0670('0xa'),_0x7436b1,_[_0x0670('0x17')](_0x31f70b)?JSON[_0x0670('0x18')](_0x31f70b):_0x31f70b);logger[_0x0670('0xd')](_0x0670('0xe'),_0x7436b1);_0x4f4152['next']();}};}; \ 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 cfa7c5d..10221b8 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 _0xa315=['../../rpc/openchannelInteraction','../../rpc/smsInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','routing','number','TagId\x20is\x20a\x20string\x20and\x20it\x20is\x20required','consequence','length','map','message','join','info','[%s][TAG]\x20no\x20tags\x20saved,\x20force\x20next','channel','Interaction','interaction','then','catch','error','stringify','finally','next','[%s][TAG]\x20%s','isObject','validate','lodash','../../rpc/chatInteraction'];(function(_0x20412f,_0x32b502){var _0x16d840=function(_0x538f15){while(--_0x538f15){_0x20412f['push'](_0x20412f['shift']());}};_0x16d840(++_0x32b502);}(_0xa315,0x71));var _0x5a31=function(_0x16eb11,_0x1a2251){_0x16eb11=_0x16eb11-0x0;var _0x3ae7ef=_0xa315[_0x16eb11];return _0x3ae7ef;};'use strict';var schema=require(_0x5a31('0x0'));var _=require(_0x5a31('0x1'));var rpc={'chatInteraction':require(_0x5a31('0x2')),'openchannelInteraction':require(_0x5a31('0x3')),'smsInteraction':require(_0x5a31('0x4')),'mailInteraction':require('../../rpc/mailInteraction'),'faxInteraction':require(_0x5a31('0x5')),'whatsappInteraction':require(_0x5a31('0x6'))};var logger=require(_0x5a31('0x7'))(_0x5a31('0x8'));var tag=schema({'tag':{'type':_0x5a31('0x9'),'required':!![],'message':_0x5a31('0xa')}});exports[_0x5a31('0xb')]=function(_0xbc60ee,_0x4bed10,_0x3b67d8,_0x1468c4){return function(_0x321e40){try{var _0x4903d4={'tag':_0x4bed10[0x0]};var _0x358122=tag[_0x5a31('0x0')](_0x4903d4,{'typecast':!![]});if(_0x358122[_0x5a31('0xc')]){logger['error']('[%s][TAG]\x20%s',_0xbc60ee,_[_0x5a31('0xd')](_0x358122,_0x5a31('0xe'))[_0x5a31('0xf')](',\x20'));logger[_0x5a31('0x10')](_0x5a31('0x11'),_0xbc60ee);_0x321e40['next']();}else{var _0x5efcee={'ids':[_0x4bed10[0x0]]};if(rpc[_0x1468c4[_0x5a31('0x12')]+'Interaction']){rpc[_0x1468c4[_0x5a31('0x12')]+_0x5a31('0x13')]['addTags'](_0x1468c4[_0x5a31('0x14')]['id'],_0x5efcee)[_0x5a31('0x15')](function(_0x425a80){logger['info']('[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s',_0xbc60ee,_0x4bed10[0x1],_0x1468c4['channel'],_0x1468c4[_0x5a31('0x14')]['id']);})[_0x5a31('0x16')](function(_0x4c6b30){logger[_0x5a31('0x17')]('[%s][TAG]\x20%s',_0xbc60ee,JSON[_0x5a31('0x18')](_0x4c6b30));logger[_0x5a31('0x10')](_0x5a31('0x11'),_0xbc60ee);})[_0x5a31('0x19')](function(){_0x321e40[_0x5a31('0x1a')]();});}}}catch(_0x324a0e){logger[_0x5a31('0x17')](_0x5a31('0x1b'),_0xbc60ee,_[_0x5a31('0x1c')](_0x324a0e)?JSON[_0x5a31('0x18')](_0x324a0e):_0x324a0e);logger[_0x5a31('0x10')](_0x5a31('0x11'),_0xbc60ee);_0x321e40['next']();}};}; \ No newline at end of file +var _0x00b0=['finally','isObject','validate','lodash','../../rpc/chatInteraction','../../rpc/smsInteraction','../../rpc/mailInteraction','../../rpc/faxInteraction','../../rpc/whatsappInteraction','../../../../config/logger','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','Interaction','channel','addTags','interaction','then','[%s][TAG]\x20tag\x20\x22%s\x22\x20added\x20to\x20%s\x20interaction\x20%s','catch','[%s][TAG]\x20%s','stringify'];(function(_0xafe7,_0x14bc7b){var _0x392838=function(_0x52c117){while(--_0x52c117){_0xafe7['push'](_0xafe7['shift']());}};_0x392838(++_0x14bc7b);}(_0x00b0,0x1b4));var _0x000b=function(_0x1c265a,_0x9f4dc7){_0x1c265a=_0x1c265a-0x0;var _0x2991f3=_0x00b0[_0x1c265a];return _0x2991f3;};'use strict';var schema=require(_0x000b('0x0'));var _=require(_0x000b('0x1'));var rpc={'chatInteraction':require(_0x000b('0x2')),'openchannelInteraction':require('../../rpc/openchannelInteraction'),'smsInteraction':require(_0x000b('0x3')),'mailInteraction':require(_0x000b('0x4')),'faxInteraction':require(_0x000b('0x5')),'whatsappInteraction':require(_0x000b('0x6'))};var logger=require(_0x000b('0x7'))(_0x000b('0x8'));var tag=schema({'tag':{'type':_0x000b('0x9'),'required':!![],'message':_0x000b('0xa')}});exports[_0x000b('0xb')]=function(_0x34d72d,_0x3ec6af,_0x1f8138,_0x31413b){return function(_0x22d6b0){try{var _0x53e572={'tag':_0x3ec6af[0x0]};var _0x2aa9df=tag['validate'](_0x53e572,{'typecast':!![]});if(_0x2aa9df[_0x000b('0xc')]){logger[_0x000b('0xd')]('[%s][TAG]\x20%s',_0x34d72d,_[_0x000b('0xe')](_0x2aa9df,_0x000b('0xf'))[_0x000b('0x10')](',\x20'));logger[_0x000b('0x11')](_0x000b('0x12'),_0x34d72d);_0x22d6b0[_0x000b('0x13')]();}else{var _0x378234={'ids':[_0x3ec6af[0x0]]};if(rpc[_0x31413b['channel']+_0x000b('0x14')]){rpc[_0x31413b[_0x000b('0x15')]+_0x000b('0x14')][_0x000b('0x16')](_0x31413b[_0x000b('0x17')]['id'],_0x378234)[_0x000b('0x18')](function(_0xff1654){logger[_0x000b('0x11')](_0x000b('0x19'),_0x34d72d,_0x3ec6af[0x1],_0x31413b['channel'],_0x31413b[_0x000b('0x17')]['id']);})[_0x000b('0x1a')](function(_0x1725f3){logger[_0x000b('0xd')](_0x000b('0x1b'),_0x34d72d,JSON[_0x000b('0x1c')](_0x1725f3));logger[_0x000b('0x11')](_0x000b('0x12'),_0x34d72d);})[_0x000b('0x1d')](function(){_0x22d6b0[_0x000b('0x13')]();});}}}catch(_0x4d3d73){logger[_0x000b('0xd')](_0x000b('0x1b'),_0x34d72d,_[_0x000b('0x1e')](_0x4d3d73)?JSON[_0x000b('0x1c')](_0x4d3d73):_0x4d3d73);logger[_0x000b('0x11')](_0x000b('0x12'),_0x34d72d);_0x22d6b0[_0x000b('0x13')]();}};}; \ No newline at end of file diff --git a/server/services/routing/server/applications/tvox.js b/server/services/routing/server/applications/tvox.js index 3ccbc41..e16d4b8 100644 --- a/server/services/routing/server/applications/tvox.js +++ b/server/services/routing/server/applications/tvox.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x7399=['isObject','[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next','next','../../../../config/logger','routing','consequence','replace','\x20-\x20','includes','push','urlOnAnswer','?params=','title','method','login','params','stringify','POST','application/json-rpc','then','parse','result','Unable\x20to\x20login\x20with\x20TVox\x20application','channelId=','&sessionId=','&data=','info','[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s','error','[%s][TVOX]\x20%s'];(function(_0x3aae39,_0x5702ed){var _0x5c267d=function(_0x77083d){while(--_0x77083d){_0x3aae39['push'](_0x3aae39['shift']());}};_0x5c267d(++_0x5702ed);}(_0x7399,0x1e3));var _0x9739=function(_0x50f008,_0x5abe67){_0x50f008=_0x50f008-0x0;var _0x5d5483=_0x7399[_0x50f008];return _0x5d5483;};'use strict';var rp=require('request-promise');var logger=require(_0x9739('0x0'))(_0x9739('0x1'));var _=require('lodash');var arr=[];exports[_0x9739('0x2')]=function(_0x5680fb,_0x26b86d){return function(_0x50465a){var _0x124ab3=_0x26b86d[0xa];var _0xf4bbe5=_0x26b86d[0xb];var _0xb3fedc=_0x26b86d[0xc];var _0x2694ef=_0x26b86d[0xd];var _0x4ab662=_0x26b86d[0xe];var _0x7faba7=_0x26b86d[0xf][_0x9739('0x3')](/\n/g,_0x9739('0x4'));var _0x58afe9=_0x26b86d[0x10][_0x9739('0x3')](/\n/g,'\x20');if(!arr[_0x9739('0x5')](_0xf4bbe5)){arr[_0x9739('0x6')](_0xf4bbe5);var _0x1a32ac=_0x26b86d[0x3];var _0x302c4b=_0x26b86d[0x4];var _0x17ac7b=_0x26b86d[0x1];var _0x301d1f=_0x26b86d[0x0];var _0x5503ca={};_0x5503ca[_0x9739('0x7')]=_0x26b86d[0x8]+'?params='+_0xb3fedc+'|'+_0x124ab3+'|'+_0x2694ef+'|'+_0xf4bbe5+'|'+_0x4ab662;_0x5503ca['urlOnRing']=_0x26b86d[0x7]+_0x9739('0x8')+_0xb3fedc+'|'+_0x124ab3+'|'+_0x2694ef+'|'+_0xf4bbe5+'|'+_0x4ab662+'|'+_0x7faba7+'|'+_0x58afe9;_0x5503ca[_0x9739('0x9')]=_0x26b86d[0x9];var _0x46b8e0={};_0x46b8e0['jsonrpc']='2.0';_0x46b8e0[_0x9739('0xa')]=_0x9739('0xb');var _0x4f1278=[];_0x4f1278[_0x9739('0x6')](_0x26b86d[0x2]);_0x4f1278['push'](_0x26b86d[0x5]);_0x4f1278[_0x9739('0x6')](_0x26b86d[0x6]);_0x46b8e0[_0x9739('0xc')]=_0x4f1278;_0x46b8e0['id']=0x1;var _0x50cd85=JSON[_0x9739('0xd')](_0x46b8e0);var _0x108328={'encoding':'utf8','method':_0x9739('0xe'),'timeout':0x2710,'url':_0x1a32ac,'headers':{'Content-Type':_0x9739('0xf')},'body':_0x50cd85};return rp(_0x108328)[_0x9739('0x10')](function(_0x4555fe){const _0x4ec715=JSON[_0x9739('0x11')](_0x4555fe);if(!_0x4ec715[_0x9739('0x12')]['logged']){throw new Error(_0x9739('0x13'));}var _0x421157=_0xf4bbe5;var _0x1947ec=_0x9739('0x14')+_0x17ac7b+'&serviceId='+_0x301d1f+_0x9739('0x15')+_0x421157+_0x9739('0x16')+JSON[_0x9739('0xd')](_0x5503ca);var _0x5e4a0c=_0x302c4b+'?'+_0x1947ec;return rp(_0x5e4a0c);})[_0x9739('0x10')](function(_0xd8e991){logger[_0x9739('0x17')](_0x9739('0x18'),_0x5680fb,_0xd8e991);_0x50465a['stop']();})['catch'](function(_0x226153){logger[_0x9739('0x19')](_0x9739('0x1a'),_0x5680fb,_[_0x9739('0x1b')](_0x226153)?JSON['stringify'](_0x226153):_0x226153);_0x50465a['stop']();});}else{logger[_0x9739('0x17')](_0x9739('0x1c'),_0x5680fb);_0x50465a[_0x9739('0x1d')]();}};}; \ No newline at end of file +var _0xe86d=['isObject','next','request-promise','../../../../config/logger','lodash','consequence','replace','push','urlOnRing','?params=','title','jsonrpc','2.0','method','login','params','stringify','then','result','logged','&serviceId=','&sessionId=','&data=','info','stop','catch','error'];(function(_0x167cc1,_0x56ef5a){var _0x10bc4b=function(_0xd6a255){while(--_0xd6a255){_0x167cc1['push'](_0x167cc1['shift']());}};_0x10bc4b(++_0x56ef5a);}(_0xe86d,0xda));var _0xde86=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0xe86d[_0x321bb2];return _0x9c12ed;};'use strict';var rp=require(_0xde86('0x0'));var logger=require(_0xde86('0x1'))('routing');var _=require(_0xde86('0x2'));var arr=[];exports[_0xde86('0x3')]=function(_0x47ed84,_0x548971){return function(_0x210ac6){var _0x24f990=_0x548971[0xa];var _0x1652ba=_0x548971[0xb];var _0x46309f=_0x548971[0xc];var _0x3aa115=_0x548971[0xd];var _0x51e6a1=_0x548971[0xe];var _0x15f0c0=_0x548971[0xf][_0xde86('0x4')](/\n/g,'\x20-\x20');var _0x581d68=_0x548971[0x10]['replace'](/\n/g,'\x20');if(!arr['includes'](_0x1652ba)){arr[_0xde86('0x5')](_0x1652ba);var _0xe247fd=_0x548971[0x3];var _0x34bee0=_0x548971[0x4];var _0x12bf05=_0x548971[0x1];var _0x80e079=_0x548971[0x0];var _0x532c1e={};_0x532c1e['urlOnAnswer']=_0x548971[0x8]+'?params='+_0x46309f+'|'+_0x24f990+'|'+_0x3aa115+'|'+_0x1652ba+'|'+_0x51e6a1;_0x532c1e[_0xde86('0x6')]=_0x548971[0x7]+_0xde86('0x7')+_0x46309f+'|'+_0x24f990+'|'+_0x3aa115+'|'+_0x1652ba+'|'+_0x51e6a1+'|'+_0x15f0c0+'|'+_0x581d68;_0x532c1e[_0xde86('0x8')]=_0x548971[0x9];var _0x4f09d1={};_0x4f09d1[_0xde86('0x9')]=_0xde86('0xa');_0x4f09d1[_0xde86('0xb')]=_0xde86('0xc');var _0xbb556f=[];_0xbb556f[_0xde86('0x5')](_0x548971[0x2]);_0xbb556f[_0xde86('0x5')](_0x548971[0x5]);_0xbb556f[_0xde86('0x5')](_0x548971[0x6]);_0x4f09d1[_0xde86('0xd')]=_0xbb556f;_0x4f09d1['id']=0x1;var _0x237430=JSON[_0xde86('0xe')](_0x4f09d1);var _0x1e85c3={'encoding':'utf8','method':'POST','timeout':0x2710,'url':_0xe247fd,'headers':{'Content-Type':'application/json-rpc'},'body':_0x237430};return rp(_0x1e85c3)[_0xde86('0xf')](function(_0x19b4f0){const _0x5e1b89=JSON['parse'](_0x19b4f0);if(!_0x5e1b89[_0xde86('0x10')][_0xde86('0x11')]){throw new Error('Unable\x20to\x20login\x20with\x20TVox\x20application');}var _0x3309c7=_0x1652ba;var _0x5bd502='channelId='+_0x12bf05+_0xde86('0x12')+_0x80e079+_0xde86('0x13')+_0x3309c7+_0xde86('0x14')+JSON[_0xde86('0xe')](_0x532c1e);var _0x16cec7=_0x34bee0+'?'+_0x5bd502;return rp(_0x16cec7);})[_0xde86('0xf')](function(_0x375e0d){logger[_0xde86('0x15')]('[%s][TVOX]\x20Request\x20sent\x20to\x20TVox:\x20%s',_0x47ed84,_0x375e0d);_0x210ac6[_0xde86('0x16')]();})[_0xde86('0x17')](function(_0x1cdddd){logger[_0xde86('0x18')]('[%s][TVOX]\x20%s',_0x47ed84,_[_0xde86('0x19')](_0x1cdddd)?JSON[_0xde86('0xe')](_0x1cdddd):_0x1cdddd);_0x210ac6[_0xde86('0x16')]();});}else{logger[_0xde86('0x15')]('[%s][TVOX]\x20Application\x20already\x20executed\x20for\x20the\x20current\x20session,\x20force\x20next',_0x47ed84);_0x210ac6[_0xde86('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 a01abab..a6149df 100644 --- a/server/services/routing/server/applications/utils.js +++ b/server/services/routing/server/applications/utils.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xe706=['exports','render','merge','body','contact','message','account','interaction','list','mustache','lodash'];(function(_0x10fc4b,_0x103682){var _0x10a5c9=function(_0x549e50){while(--_0x549e50){_0x10fc4b['push'](_0x10fc4b['shift']());}};_0x10a5c9(++_0x103682);}(_0xe706,0xa3));var _0x6e70=function(_0x59bd64,_0x237f2b){_0x59bd64=_0x59bd64-0x0;var _0x378c0e=_0xe706[_0x59bd64];return _0x378c0e;};'use strict';var Mustache=require(_0x6e70('0x0'));var _=require(_0x6e70('0x1'));module[_0x6e70('0x2')]={'getMustacheRender':function(_0x5e8446,_0x2cae77){return Mustache[_0x6e70('0x3')](_0x5e8446,_[_0x6e70('0x4')](_0x2cae77[_0x6e70('0x5')],{'contact':_0x2cae77[_0x6e70('0x6')],'message':_0x2cae77[_0x6e70('0x7')],'account':_0x2cae77[_0x6e70('0x8')],'interaction':_0x2cae77[_0x6e70('0x9')],'list':_0x2cae77[_0x6e70('0xa')]}))||'';}}; \ No newline at end of file +var _0xd8b0=['merge','body','contact','message','list','mustache','lodash','render'];(function(_0x4d883b,_0x17b38d){var _0x4d372c=function(_0x2a9e6d){while(--_0x2a9e6d){_0x4d883b['push'](_0x4d883b['shift']());}};_0x4d372c(++_0x17b38d);}(_0xd8b0,0xad));var _0x0d8b=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0xd8b0[_0x20a584];return _0x4b41a8;};'use strict';var Mustache=require(_0x0d8b('0x0'));var _=require(_0x0d8b('0x1'));module['exports']={'getMustacheRender':function(_0x585166,_0x4b72b0){return Mustache[_0x0d8b('0x2')](_0x585166,_[_0x0d8b('0x3')](_0x4b72b0[_0x0d8b('0x4')],{'contact':_0x4b72b0[_0x0d8b('0x5')],'message':_0x4b72b0[_0x0d8b('0x6')],'account':_0x4b72b0['account'],'interaction':_0x4b72b0['interaction'],'list':_0x4b72b0[_0x0d8b('0x7')]}))||'';}}; \ No newline at end of file diff --git a/server/services/routing/server/index.js b/server/services/routing/server/index.js index 6d1de53..e473dae 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 _0x843e=['end','QueueReport','update','UserId','error\x20update\x20queue\x20report','message\x20is\x20empty','busy','capacity','hasOwnProperty','updateRealtime','agent\x20not\x20found','values','find','available','loggedIn','name','paused','waiting','mailQueues','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','stringify','127.0.0.1','log','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/utils','routing','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/smsQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','format','%s.%s.%s','isNil','IntervalId','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','applications','length','existsSync','join','app','toLowerCase','autoreply','split','mail','push','slice','dialogflow','dialogflowv2','appdata','amazonlex','TagId','tvox','getMustacheRender','account','ChatWebsiteId','ContactId','body','%s:%s:%s','./interval','condition','intervals','./applications/','consequence','info','Push\x20new\x20rule','error','Please\x20create\x20a\x20new\x20file\x20under','.js','execute','Applications\x20executed','matchPath','rules','emit','complete','Skipped\x20routing\x20for\x20%s','No\x20applications\x20to\x20execute','stack','routing\x20is\x20empty','agent','agents','busyQueue'];(function(_0x2ff5c3,_0x463245){var _0x48d820=function(_0x100928){while(--_0x100928){_0x2ff5c3['push'](_0x2ff5c3['shift']());}};_0x48d820(++_0x463245);}(_0x843e,0x8f));var _0xe843=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x843e[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0xe843('0x0'));var util=require(_0xe843('0x1'));var path=require(_0xe843('0x2'));var fs=require('fs');var jayson=require(_0xe843('0x3'));var BPromise=require(_0xe843('0x4'));var utils=require(_0xe843('0x5'));var sUtils=require('./applications/strategy/util');var logger=require('../../../config/logger')(_0xe843('0x6'));var rpc={'openchannelQueueReport':require(_0xe843('0x7')),'mailQueueReport':require(_0xe843('0x8')),'chatQueueReport':require(_0xe843('0x9')),'smsQueueReport':require(_0xe843('0xa')),'faxQueueReport':require(_0xe843('0xb')),'whatsappQueueReport':require(_0xe843('0xc'))};var RuleEngine=require('../lib/rule-engine');function getId(_0x3d0d26,_0x56041f,_0x3dac29){return util[_0xe843('0xd')](_0xe843('0xe'),_0x3d0d26,_0x56041f||0x0,_0x3dac29||0x0);}function getIntervals(_0x55a2df,_0x1e4b19){var _0x17c9b5=[];if(!_[_0xe843('0xf')](_0x1e4b19[_0xe843('0x10')])&&!_[_0xe843('0xf')](_0x55a2df[_0x1e4b19[_0xe843('0x10')]])&&!_[_0xe843('0xf')](_0x55a2df[_0x1e4b19[_0xe843('0x10')]][_0xe843('0x11')])){_0x17c9b5=_[_0xe843('0x12')](_0x55a2df[_0x1e4b19[_0xe843('0x10')]][_0xe843('0x11')],_0xe843('0x13'));}else if(!_[_0xe843('0xf')](_0x1e4b19[_0xe843('0x13')])){_0x17c9b5=[_0x1e4b19[_0xe843('0x13')]];}return _0x17c9b5;}exports[_0xe843('0x14')]=function(_0x1e670c){_0x1e670c['rules']={};return new BPromise(function(_0x14f145,_0x49c6f9){var _0x3c793b={'Start':function(_0x2a11c4){var _0x3a780b=this;return new Promise(function(_0x2a936e,_0xc136ca){if(_0x2a11c4){try{var _0x58e193=[];var _0x20daae=getId(_0x2a11c4[_0xe843('0x15')],_0x2a11c4[_0xe843('0x16')]?_0x2a11c4[_0xe843('0x16')]['id']:0x0,_0x2a11c4[_0xe843('0x17')]?_0x2a11c4[_0xe843('0x17')]['id']:0x0);var _0x558287=sUtils[_0xe843('0x18')](_0x1e670c,_0x2a11c4);if(!_0x558287&&_0x2a11c4[_0xe843('0x19')]&&_['isArray'](_0x2a11c4['applications'])&&_0x2a11c4[_0xe843('0x19')]['length']){for(var _0x1a7f7d=0x0;_0x1a7f7d<_0x2a11c4['applications'][_0xe843('0x1a')];_0x1a7f7d+=0x1){var _0x526573=_0x2a11c4[_0xe843('0x19')][_0x1a7f7d];if(fs[_0xe843('0x1b')](path[_0xe843('0x1c')](__dirname,'applications',_0x526573[_0xe843('0x1d')]+'.js'))){var _0x3d9ec3=[];switch(_0x526573[_0xe843('0x1d')][_0xe843('0x1e')]()){case _0xe843('0x1f'):var _0x22b78b=_0x526573['appdata'][_0xe843('0x20')](',');if(_0x2a11c4['channel']===_0xe843('0x21')){_0x3d9ec3[_0xe843('0x22')](_0x22b78b[0x0]);_0x3d9ec3[_0xe843('0x22')](_0x22b78b[0x1]);_0x3d9ec3['push'](_0x22b78b[_0xe843('0x23')](0x2,_0x22b78b[_0xe843('0x1a')])[_0xe843('0x1c')](','));}else{_0x3d9ec3[_0xe843('0x22')](_0x22b78b[0x0]);_0x3d9ec3[_0xe843('0x22')](_0x22b78b['slice'](0x1,_0x22b78b[_0xe843('0x1a')])[_0xe843('0x1c')](','));}break;case _0xe843('0x24'):var _0x5ea4d4=_0x526573['appdata'][_0xe843('0x20')](',');_0x3d9ec3[_0xe843('0x22')](_0x5ea4d4[0x0]);_0x3d9ec3[_0xe843('0x22')](_0x5ea4d4[0x1]);_0x3d9ec3['push'](_0x5ea4d4[_0xe843('0x23')](0x2,_0x5ea4d4[_0xe843('0x1a')])[_0xe843('0x1c')](','));break;case _0xe843('0x25'):var _0x17f051=_0x526573[_0xe843('0x26')][_0xe843('0x20')](',');_0x3d9ec3[_0xe843('0x22')](_0x17f051[0x0]);_0x3d9ec3['push'](_0x17f051[0x1]);_0x3d9ec3['push'](_0x17f051[0x2]);_0x3d9ec3['push'](_0x17f051[0x3]);_0x3d9ec3[_0xe843('0x22')](_0x17f051[_0xe843('0x23')](0x4,_0x17f051['length'])[_0xe843('0x1c')](','));break;case _0xe843('0x27'):var _0x4273df=_0x526573['appdata']['split'](',');_0x3d9ec3['push'](_0x4273df[0x0]);_0x3d9ec3['push'](_0x4273df[0x1]);_0x3d9ec3['push'](_0x4273df[0x2]);_0x3d9ec3[_0xe843('0x22')](_0x4273df[0x3]);_0x3d9ec3[_0xe843('0x22')](_0x4273df[_0xe843('0x23')](0x4,_0x4273df[_0xe843('0x1a')])['join'](','));break;case'message':_0x3d9ec3[_0xe843('0x22')](_0x526573[_0xe843('0x26')]);break;case'tag':_0x3d9ec3['push'](_0x526573[_0xe843('0x28')]);_0x3d9ec3[_0xe843('0x22')](_0x526573[_0xe843('0x26')]);break;case _0xe843('0x29'):var _0x5695ff=utils[_0xe843('0x2a')](_0x2a11c4[_0xe843('0x2b')]['notificationTemplate'],_0x2a11c4);var _0x5f3723=_0x526573['appdata'][_0xe843('0x20')](',');_0x3d9ec3[_0xe843('0x22')](_0x5f3723[0x0]);_0x3d9ec3['push'](_0x5f3723[0x1]);_0x3d9ec3['push'](_0x5f3723[0x2]);_0x3d9ec3[_0xe843('0x22')](_0x5f3723[0x3]);_0x3d9ec3[_0xe843('0x22')](_0x5f3723[0x4]);_0x3d9ec3[_0xe843('0x22')](_0x5f3723[0x5]);_0x3d9ec3[_0xe843('0x22')](_0x5f3723[0x6]);_0x3d9ec3[_0xe843('0x22')](_0x5f3723[0x7]);_0x3d9ec3[_0xe843('0x22')](_0x5f3723[0x8]);_0x3d9ec3[_0xe843('0x22')](_0x5f3723[0x9]);_0x3d9ec3[_0xe843('0x22')](_0x5f3723[0xa]);_0x3d9ec3[_0xe843('0x22')](_0x2a11c4['interaction']['id']);_0x3d9ec3['push'](_0x2a11c4[_0xe843('0x16')]['id']);_0x3d9ec3[_0xe843('0x22')](_0x526573[_0xe843('0x2c')]);_0x3d9ec3[_0xe843('0x22')](_0x2a11c4['interaction'][_0xe843('0x2d')]);_0x3d9ec3[_0xe843('0x22')](_0x2a11c4[_0xe843('0x2e')][_0xe843('0x2e')]);_0x3d9ec3[_0xe843('0x22')](_0x5695ff);break;default:_0x3d9ec3=_[_0xe843('0xf')](_0x526573['appdata'])?[]:_0x526573[_0xe843('0x26')][_0xe843('0x20')](',');}var _0x3914a1={'id':util['format'](_0xe843('0x2f'),_0x20daae,_0x526573['id'],_0x526573['app']),'condition':require(_0xe843('0x30'))[_0xe843('0x31')](_0x20daae,getIntervals(_0x1e670c[_0xe843('0x32')],_0x526573),_0x1e670c),'consequence':require(_0xe843('0x33')+_0x526573[_0xe843('0x1d')])[_0xe843('0x34')](_0x20daae,_0x3d9ec3,_0x1e670c,_0x2a11c4),'p':_0x526573['priority']||0x0};logger[_0xe843('0x35')](_0xe843('0x36'),_0x3914a1['id'],'on\x20interval',getIntervals(_0x1e670c['intervals'],_0x526573)['join']('\x20|\x20'));_0x58e193['push'](_0x3914a1);}else{logger[_0xe843('0x37')](_0xe843('0x38'),path[_0xe843('0x1c')](__dirname,_0xe843('0x19'),_0x526573[_0xe843('0x1d')]+_0xe843('0x39')));}}_0x1e670c['rules'][_0x20daae]=new RuleEngine(_0x58e193);_0x1e670c['rules'][_0x20daae][_0xe843('0x3a')](_0x2a11c4,function(_0x484381){logger[_0xe843('0x35')](_0xe843('0x3b'),JSON['stringify'](_0x484381[_0xe843('0x3c')]));if(_0x1e670c[_0xe843('0x3d')][_0x20daae]){_0x1e670c[_0xe843('0x3d')][_0x20daae][_0xe843('0x3e')](_0xe843('0x3f'));}});return _0x2a936e({'code':0xc8,'message':_0x2a11c4});}else{if(_0x558287){logger[_0xe843('0x35')](util[_0xe843('0xd')](_0xe843('0x40'),_0x20daae));}else{logger['info'](_0xe843('0x41'));}return _0x2a936e({'code':0xc8,'message':_0x2a11c4});}}catch(_0x5d9b55){logger[_0xe843('0x37')](_0x5d9b55[_0xe843('0x42')]);return _0xc136ca(_0x3a780b[_0xe843('0x37')](0x1f4,_0x5d9b55));}}return _0xc136ca(_0xe843('0x43'));});},'AcceptMessage':function(_0x1fc283){var _0x577757=this;return new Promise(function(_0x453cee,_0x1619b7){if(_0x1fc283['agent']&&_0x1fc283[_0xe843('0x44')]['id']){if(_0x1e670c[_0xe843('0x45')][_0x1fc283['agent']['id']]){_0x1e670c['agents'][_0x1fc283[_0xe843('0x44')]['id']]['busy']=![];_0x1e670c['agents'][_0x1fc283[_0xe843('0x44')]['id']][_0xe843('0x46')]=undefined;}}if(_0x1fc283[_0xe843('0x16')]&&_0x1fc283[_0xe843('0x16')]['id']){try{var _0xe76309=getId(_0x1fc283[_0xe843('0x15')],_0x1fc283[_0xe843('0x16')]?_0x1fc283['message']['id']:0x0,_0x1fc283[_0xe843('0x17')]?_0x1fc283[_0xe843('0x17')]['id']:0x0);if(_0x1e670c[_0xe843('0x3d')][_0xe76309]){_0x1e670c[_0xe843('0x3d')][_0xe76309][_0xe843('0x3e')](_0xe843('0x47'));if(rpc[_0x1fc283[_0xe843('0x15')]+_0xe843('0x48')]){rpc[_0x1fc283['channel']+'QueueReport'][_0xe843('0x49')](_0xe76309,{'UserId':_0x1fc283['message'][_0xe843('0x4a')]})['catch'](function(){logger[_0xe843('0x37')](_0xe843('0x4b'));});}}return _0x453cee({'code':0xc8,'message':_0x1fc283});}catch(_0x7ec0f1){logger['error'](_0x7ec0f1['stack']);return _0x1619b7(_0x577757[_0xe843('0x37')](0x1f4,_0x7ec0f1));}}logger[_0xe843('0x37')](_0xe843('0x4c'));return _0x1619b7(_0x577757[_0xe843('0x37')](0x1f4,'message\x20is\x20empty'));});},'RejectMessage':function(_0x484971){var _0xb00e64=this;return new Promise(function(_0x2a9b4c,_0x1de17b){if(_0x484971[_0xe843('0x44')]&&_0x484971['agent']['id']){try{if(_0x1e670c[_0xe843('0x45')][_0x484971[_0xe843('0x44')]['id']]){_0x1e670c[_0xe843('0x45')][_0x484971[_0xe843('0x44')]['id']][_0xe843('0x4d')]=![];_0x1e670c[_0xe843('0x45')][_0x484971[_0xe843('0x44')]['id']][_0xe843('0x46')]=undefined;}return _0x2a9b4c({'code':0xc8,'message':_0x484971});}catch(_0x3828b0){logger[_0xe843('0x37')](_0x3828b0[_0xe843('0x42')]);return _0x1de17b(_0xb00e64[_0xe843('0x37')](0x1f4,_0x3828b0));}}logger[_0xe843('0x37')](_0xe843('0x4c'));return _0x1de17b(_0xb00e64[_0xe843('0x37')](0x1f4,_0xe843('0x4c')));});},'AbandonInteraction':function(_0xe6601){var _0x68fc2d=this;return new Promise(function(_0x3f1326,_0x42c02b){if(_0xe6601[_0xe843('0x15')]&&_0xe6601['interaction']&&_0xe6601[_0xe843('0x17')]['id']){try{var _0x4c8622=getId(_0xe6601[_0xe843('0x15')],_0xe6601[_0xe843('0x16')]?_0xe6601[_0xe843('0x16')]['id']:0x0,_0xe6601[_0xe843('0x17')]?_0xe6601['interaction']['id']:0x0);if(_0x1e670c[_0xe843('0x3d')][_0x4c8622]){_0x1e670c[_0xe843('0x3d')][_0x4c8622][_0xe843('0x3e')](_0xe843('0x47'));}return _0x3f1326({'code':0xc8,'message':_0xe6601});}catch(_0x3a3301){logger[_0xe843('0x37')](_0x3a3301[_0xe843('0x42')]);return _0x42c02b(_0x68fc2d[_0xe843('0x37')](0x1f4,_0x3a3301));}}logger['error'](_0xe843('0x4c'));return _0x42c02b(_0x68fc2d[_0xe843('0x37')](0x1f4,_0xe843('0x4c')));});},'AgentCapacity':function(_0x373fd7){var _0x4613f3=this;return new Promise(function(_0x1b7304,_0x252eac){if(_0x1e670c[_0xe843('0x45')]['hasOwnProperty'](_0x373fd7['id'])){for(var _0xc035ca in _0x373fd7['capacity']){if(_0x373fd7[_0xe843('0x4e')][_0xe843('0x4f')](_0xc035ca)){if(_0x1e670c['agents'][_0x373fd7['id']][_0xe843('0x4f')](_0xc035ca+'CurrentCapacity')){_0x1e670c[_0xe843('0x45')][_0x373fd7['id']][_0xc035ca+'CurrentCapacity']=parseInt(_0x373fd7[_0xe843('0x4e')][_0xc035ca],0xa);}}}_0x1e670c[_0xe843('0x45')][_0x373fd7['id']][_0xe843('0x50')]();return _0x1b7304({'code':0xc8,'message':_0x1e670c[_0xe843('0x45')][_0x373fd7['id']]});}else{return _0x252eac(_0x4613f3[_0xe843('0x37')](0x1f4,_0xe843('0x51')));}});},'Agents':function(_0x7c9f7d){return new Promise(function(_0x38bab6){var _0x41cfa0=_[_0xe843('0x52')](_0x1e670c['agents']);if(_0x7c9f7d&&_0x7c9f7d['id']){var _0x375762=_[_0xe843('0x53')](_0x41cfa0,function(_0x4e1532){return _0x4e1532['id']===_0x7c9f7d['id'];});_0x38bab6(_0x375762);}else{_0x38bab6({'count':_0x41cfa0[_0xe843('0x1a')],'rows':_0x41cfa0});}});},'ChatQueues':function(){return new Promise(function(_0x17dfc4){var _0xf3bcfc=[];for(var _0x23d551 in _0x1e670c['chatQueues']){if(_0x1e670c['chatQueues']['hasOwnProperty'](_0x23d551)){var _0x6bb7dd=_0x1e670c['chatQueues'][_0x23d551];var _0x229c92={'id':_0x6bb7dd['id'],'available':_0x6bb7dd[_0xe843('0x54')],'loggedIn':_0x6bb7dd[_0xe843('0x55')],'name':_0x6bb7dd[_0xe843('0x56')],'paused':_0x6bb7dd[_0xe843('0x57')],'waiting':_0x6bb7dd[_0xe843('0x58')]};_0xf3bcfc[_0xe843('0x22')](_0x229c92);}}_0x17dfc4({'count':_0xf3bcfc['length'],'rows':_0xf3bcfc});});},'MailQueues':function(){return new Promise(function(_0x5e0162){var _0x12ee7e=[];for(var _0x5bf2a0 in _0x1e670c['mailQueues']){if(_0x1e670c[_0xe843('0x59')][_0xe843('0x4f')](_0x5bf2a0)){var _0x1e9804=_0x1e670c[_0xe843('0x59')][_0x5bf2a0];var _0x5d36a3={'id':_0x1e9804['id'],'available':_0x1e9804[_0xe843('0x54')],'loggedIn':_0x1e9804[_0xe843('0x55')],'name':_0x1e9804[_0xe843('0x56')],'paused':_0x1e9804[_0xe843('0x57')],'waiting':_0x1e9804[_0xe843('0x58')]};_0x12ee7e['push'](_0x5d36a3);}}_0x5e0162({'count':_0x12ee7e['length'],'rows':_0x12ee7e});});},'OpenchannelQueues':function(){return new Promise(function(_0x2584df){var _0x1ed376=[];for(var _0x5494aa in _0x1e670c[_0xe843('0x5a')]){if(_0x1e670c[_0xe843('0x5a')][_0xe843('0x4f')](_0x5494aa)){var _0x431d76=_0x1e670c[_0xe843('0x5a')][_0x5494aa];var _0x6bbb={'id':_0x431d76['id'],'available':_0x431d76['available'],'loggedIn':_0x431d76[_0xe843('0x55')],'name':_0x431d76[_0xe843('0x56')],'paused':_0x431d76[_0xe843('0x57')],'waiting':_0x431d76[_0xe843('0x58')]};_0x1ed376[_0xe843('0x22')](_0x6bbb);}}_0x2584df({'count':_0x1ed376['length'],'rows':_0x1ed376});});},'SmsQueues':function(){return new Promise(function(_0x390ea6){var _0x30f1c5=[];for(var _0x29c534 in _0x1e670c[_0xe843('0x5b')]){if(_0x1e670c[_0xe843('0x5b')][_0xe843('0x4f')](_0x29c534)){var _0x5b2789=_0x1e670c['smsQueues'][_0x29c534];var _0x275e8f={'id':_0x5b2789['id'],'available':_0x5b2789[_0xe843('0x54')],'loggedIn':_0x5b2789['loggedIn'],'name':_0x5b2789[_0xe843('0x56')],'paused':_0x5b2789['paused'],'waiting':_0x5b2789[_0xe843('0x58')]};_0x30f1c5[_0xe843('0x22')](_0x275e8f);}}_0x390ea6({'count':_0x30f1c5[_0xe843('0x1a')],'rows':_0x30f1c5});});},'FaxQueues':function(){return new Promise(function(_0xdca278){var _0x25053e=[];for(var _0x164da1 in _0x1e670c['faxQueues']){if(_0x1e670c[_0xe843('0x5c')]['hasOwnProperty'](_0x164da1)){var _0x508a86=_0x1e670c['faxQueues'][_0x164da1];var _0x8f1e29={'id':_0x508a86['id'],'available':_0x508a86[_0xe843('0x54')],'loggedIn':_0x508a86[_0xe843('0x55')],'name':_0x508a86[_0xe843('0x56')],'paused':_0x508a86['paused'],'waiting':_0x508a86[_0xe843('0x58')]};_0x25053e[_0xe843('0x22')](_0x8f1e29);}}_0xdca278({'count':_0x25053e[_0xe843('0x1a')],'rows':_0x25053e});});},'WhatsappQueues':function(){return new Promise(function(_0x1d6c92){var _0x183de4=[];for(var _0x251a1e in _0x1e670c[_0xe843('0x5d')]){if(_0x1e670c['whatsappQueues'][_0xe843('0x4f')](_0x251a1e)){var _0x36dca9=_0x1e670c[_0xe843('0x5d')][_0x251a1e];var _0x435ae2={'id':_0x36dca9['id'],'available':_0x36dca9['available'],'loggedIn':_0x36dca9[_0xe843('0x55')],'name':_0x36dca9[_0xe843('0x56')],'paused':_0x36dca9[_0xe843('0x57')],'waiting':_0x36dca9['waiting']};_0x183de4[_0xe843('0x22')](_0x435ae2);}}_0x1d6c92({'count':_0x183de4[_0xe843('0x1a')],'rows':_0x183de4});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x3272cc){var _0x226507=_[_0xe843('0x52')](_0x1e670c[_0xe843('0x5e')]);_0x3272cc({'count':_0x226507[_0xe843('0x1a')],'rows':_0x226507});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5b34b0){var _0x2e58df=_[_0xe843('0x52')](_0x1e670c[_0xe843('0x5f')]);_0x5b34b0({'count':_0x2e58df[_0xe843('0x1a')],'rows':_0x2e58df});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x383d6a){var _0xd74d8a=_['values'](_0x1e670c[_0xe843('0x60')]);_0x383d6a({'count':_0xd74d8a[_0xe843('0x1a')],'rows':_0xd74d8a});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x2b042f){var _0x331af4=_[_0xe843('0x52')](_0x1e670c[_0xe843('0x61')]);_0x2b042f({'count':_0x331af4['length'],'rows':_0x331af4});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x456b8f){var _0x14996f=_[_0xe843('0x52')](_0x1e670c[_0xe843('0x62')]);_0x456b8f({'count':_0x14996f[_0xe843('0x1a')],'rows':_0x14996f});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x4f117d){var _0x3e35c3=_['values'](_0x1e670c[_0xe843('0x63')]);_0x4f117d({'count':_0x3e35c3[_0xe843('0x1a')],'rows':_0x3e35c3});});}};var _0x2ddf77=jayson[_0xe843('0x64')](_0x3c793b)[_0xe843('0x65')]();_0x2ddf77['on']('error',function(_0x1ca2ee){logger[_0xe843('0x37')](JSON[_0xe843('0x66')](_0x1ca2ee));return _0x49c6f9(_0x1ca2ee);});_0x2ddf77[_0xe843('0x14')](0x232c,_0xe843('0x67'),function(){console[_0xe843('0x68')](_0xe843('0x69'),0x232c);return _0x14f145(_0xe843('0x6a')+0x232c);});});}; \ No newline at end of file +var _0x4ebe=['%s:%s:%s','./interval','intervals','./applications/','priority','info','Push\x20new\x20rule','on\x20interval','\x20|\x20','.js','rules','execute','Applications\x20executed','stringify','emit','complete','No\x20applications\x20to\x20execute','agent','agents','busy','busyQueue','end','QueueReport','update','UserId','error','error\x20update\x20queue\x20report','stack','message\x20is\x20empty','hasOwnProperty','capacity','CurrentCapacity','agent\x20not\x20found','values','find','chatQueues','available','loggedIn','paused','waiting','mailQueues','name','openchannelQueues','smsQueues','faxQueues','whatsappQueues','chatQueuesWaitingInteractions','mailQueuesWaitingInteractions','openchannelQueuesWaitingInteractions','smsQueuesWaitingInteractions','faxQueuesWaitingInteractions','whatsappQueuesWaitingInteractions','server','http','127.0.0.1','Routing\x20RPC\x20server\x20listening\x20on\x20127.0.0.1:%d!','RPC\x20listening\x20on\x20port:','lodash','util','path','jayson/promise','bluebird','./applications/strategy/util','../../../config/logger','../rpc/openchannelQueueReport','../rpc/mailQueueReport','../rpc/chatQueueReport','../rpc/faxQueueReport','../rpc/whatsappQueueReport','../lib/rule-engine','format','IntervalId','isNil','Intervals','map','interval','listen','channel','message','interaction','checkWaitingNotifications','applications','isArray','length','join','app','toLowerCase','autoreply','appdata','split','push','slice','dialogflow','dialogflowv2','amazonlex','tag','tvox','getMustacheRender','account','notificationTemplate','ChatWebsiteId','body'];(function(_0x55c8cc,_0x1a559b){var _0x2e20cc=function(_0x31fee7){while(--_0x31fee7){_0x55c8cc['push'](_0x55c8cc['shift']());}};_0x2e20cc(++_0x1a559b);}(_0x4ebe,0x1d1));var _0xe4eb=function(_0x397c00,_0x2edc07){_0x397c00=_0x397c00-0x0;var _0x1b7a12=_0x4ebe[_0x397c00];return _0x1b7a12;};'use strict';var _=require(_0xe4eb('0x0'));var util=require(_0xe4eb('0x1'));var path=require(_0xe4eb('0x2'));var fs=require('fs');var jayson=require(_0xe4eb('0x3'));var BPromise=require(_0xe4eb('0x4'));var utils=require('./applications/utils');var sUtils=require(_0xe4eb('0x5'));var logger=require(_0xe4eb('0x6'))('routing');var rpc={'openchannelQueueReport':require(_0xe4eb('0x7')),'mailQueueReport':require(_0xe4eb('0x8')),'chatQueueReport':require(_0xe4eb('0x9')),'smsQueueReport':require('../rpc/smsQueueReport'),'faxQueueReport':require(_0xe4eb('0xa')),'whatsappQueueReport':require(_0xe4eb('0xb'))};var RuleEngine=require(_0xe4eb('0xc'));function getId(_0x2646d8,_0xbc9bd2,_0x4ba6dd){return util[_0xe4eb('0xd')]('%s.%s.%s',_0x2646d8,_0xbc9bd2||0x0,_0x4ba6dd||0x0);}function getIntervals(_0x60208e,_0x665117){var _0x4e5b4f=[];if(!_['isNil'](_0x665117[_0xe4eb('0xe')])&&!_[_0xe4eb('0xf')](_0x60208e[_0x665117[_0xe4eb('0xe')]])&&!_[_0xe4eb('0xf')](_0x60208e[_0x665117[_0xe4eb('0xe')]][_0xe4eb('0x10')])){_0x4e5b4f=_[_0xe4eb('0x11')](_0x60208e[_0x665117[_0xe4eb('0xe')]][_0xe4eb('0x10')],'interval');}else if(!_[_0xe4eb('0xf')](_0x665117[_0xe4eb('0x12')])){_0x4e5b4f=[_0x665117[_0xe4eb('0x12')]];}return _0x4e5b4f;}exports[_0xe4eb('0x13')]=function(_0x9ffeaf){_0x9ffeaf['rules']={};return new BPromise(function(_0x5de791,_0x3282bd){var _0x2ecc38={'Start':function(_0x4750db){var _0x564fae=this;return new Promise(function(_0x225cf0,_0x878cb1){if(_0x4750db){try{var _0x47e427=[];var _0x514018=getId(_0x4750db[_0xe4eb('0x14')],_0x4750db[_0xe4eb('0x15')]?_0x4750db[_0xe4eb('0x15')]['id']:0x0,_0x4750db[_0xe4eb('0x16')]?_0x4750db[_0xe4eb('0x16')]['id']:0x0);var _0x569b35=sUtils[_0xe4eb('0x17')](_0x9ffeaf,_0x4750db);if(!_0x569b35&&_0x4750db[_0xe4eb('0x18')]&&_[_0xe4eb('0x19')](_0x4750db[_0xe4eb('0x18')])&&_0x4750db['applications'][_0xe4eb('0x1a')]){for(var _0x33c008=0x0;_0x33c008<_0x4750db['applications']['length'];_0x33c008+=0x1){var _0x53145b=_0x4750db[_0xe4eb('0x18')][_0x33c008];if(fs['existsSync'](path[_0xe4eb('0x1b')](__dirname,_0xe4eb('0x18'),_0x53145b[_0xe4eb('0x1c')]+'.js'))){var _0x42b784=[];switch(_0x53145b[_0xe4eb('0x1c')][_0xe4eb('0x1d')]()){case _0xe4eb('0x1e'):var _0xedbafb=_0x53145b[_0xe4eb('0x1f')][_0xe4eb('0x20')](',');if(_0x4750db['channel']==='mail'){_0x42b784[_0xe4eb('0x21')](_0xedbafb[0x0]);_0x42b784[_0xe4eb('0x21')](_0xedbafb[0x1]);_0x42b784[_0xe4eb('0x21')](_0xedbafb['slice'](0x2,_0xedbafb[_0xe4eb('0x1a')])['join'](','));}else{_0x42b784[_0xe4eb('0x21')](_0xedbafb[0x0]);_0x42b784[_0xe4eb('0x21')](_0xedbafb[_0xe4eb('0x22')](0x1,_0xedbafb[_0xe4eb('0x1a')])[_0xe4eb('0x1b')](','));}break;case _0xe4eb('0x23'):var _0x59da83=_0x53145b[_0xe4eb('0x1f')][_0xe4eb('0x20')](',');_0x42b784[_0xe4eb('0x21')](_0x59da83[0x0]);_0x42b784[_0xe4eb('0x21')](_0x59da83[0x1]);_0x42b784[_0xe4eb('0x21')](_0x59da83[_0xe4eb('0x22')](0x2,_0x59da83['length'])[_0xe4eb('0x1b')](','));break;case _0xe4eb('0x24'):var _0x3ccd41=_0x53145b[_0xe4eb('0x1f')][_0xe4eb('0x20')](',');_0x42b784[_0xe4eb('0x21')](_0x3ccd41[0x0]);_0x42b784[_0xe4eb('0x21')](_0x3ccd41[0x1]);_0x42b784['push'](_0x3ccd41[0x2]);_0x42b784[_0xe4eb('0x21')](_0x3ccd41[0x3]);_0x42b784[_0xe4eb('0x21')](_0x3ccd41['slice'](0x4,_0x3ccd41[_0xe4eb('0x1a')])[_0xe4eb('0x1b')](','));break;case _0xe4eb('0x25'):var _0x2adf48=_0x53145b[_0xe4eb('0x1f')][_0xe4eb('0x20')](',');_0x42b784[_0xe4eb('0x21')](_0x2adf48[0x0]);_0x42b784[_0xe4eb('0x21')](_0x2adf48[0x1]);_0x42b784[_0xe4eb('0x21')](_0x2adf48[0x2]);_0x42b784['push'](_0x2adf48[0x3]);_0x42b784[_0xe4eb('0x21')](_0x2adf48['slice'](0x4,_0x2adf48['length'])[_0xe4eb('0x1b')](','));break;case'message':_0x42b784[_0xe4eb('0x21')](_0x53145b['appdata']);break;case _0xe4eb('0x26'):_0x42b784['push'](_0x53145b['TagId']);_0x42b784['push'](_0x53145b['appdata']);break;case _0xe4eb('0x27'):var _0x53a6e6=utils[_0xe4eb('0x28')](_0x4750db[_0xe4eb('0x29')][_0xe4eb('0x2a')],_0x4750db);var _0x542060=_0x53145b[_0xe4eb('0x1f')][_0xe4eb('0x20')](',');_0x42b784[_0xe4eb('0x21')](_0x542060[0x0]);_0x42b784[_0xe4eb('0x21')](_0x542060[0x1]);_0x42b784['push'](_0x542060[0x2]);_0x42b784[_0xe4eb('0x21')](_0x542060[0x3]);_0x42b784['push'](_0x542060[0x4]);_0x42b784[_0xe4eb('0x21')](_0x542060[0x5]);_0x42b784[_0xe4eb('0x21')](_0x542060[0x6]);_0x42b784[_0xe4eb('0x21')](_0x542060[0x7]);_0x42b784[_0xe4eb('0x21')](_0x542060[0x8]);_0x42b784[_0xe4eb('0x21')](_0x542060[0x9]);_0x42b784[_0xe4eb('0x21')](_0x542060[0xa]);_0x42b784[_0xe4eb('0x21')](_0x4750db['interaction']['id']);_0x42b784[_0xe4eb('0x21')](_0x4750db[_0xe4eb('0x15')]['id']);_0x42b784['push'](_0x53145b[_0xe4eb('0x2b')]);_0x42b784[_0xe4eb('0x21')](_0x4750db[_0xe4eb('0x16')]['ContactId']);_0x42b784['push'](_0x4750db[_0xe4eb('0x2c')][_0xe4eb('0x2c')]);_0x42b784['push'](_0x53a6e6);break;default:_0x42b784=_[_0xe4eb('0xf')](_0x53145b['appdata'])?[]:_0x53145b[_0xe4eb('0x1f')][_0xe4eb('0x20')](',');}var _0x2f9b13={'id':util[_0xe4eb('0xd')](_0xe4eb('0x2d'),_0x514018,_0x53145b['id'],_0x53145b[_0xe4eb('0x1c')]),'condition':require(_0xe4eb('0x2e'))['condition'](_0x514018,getIntervals(_0x9ffeaf[_0xe4eb('0x2f')],_0x53145b),_0x9ffeaf),'consequence':require(_0xe4eb('0x30')+_0x53145b[_0xe4eb('0x1c')])['consequence'](_0x514018,_0x42b784,_0x9ffeaf,_0x4750db),'p':_0x53145b[_0xe4eb('0x31')]||0x0};logger[_0xe4eb('0x32')](_0xe4eb('0x33'),_0x2f9b13['id'],_0xe4eb('0x34'),getIntervals(_0x9ffeaf[_0xe4eb('0x2f')],_0x53145b)['join'](_0xe4eb('0x35')));_0x47e427[_0xe4eb('0x21')](_0x2f9b13);}else{logger['error']('Please\x20create\x20a\x20new\x20file\x20under',path[_0xe4eb('0x1b')](__dirname,'applications',_0x53145b['app']+_0xe4eb('0x36')));}}_0x9ffeaf[_0xe4eb('0x37')][_0x514018]=new RuleEngine(_0x47e427);_0x9ffeaf[_0xe4eb('0x37')][_0x514018][_0xe4eb('0x38')](_0x4750db,function(_0x1b444c){logger[_0xe4eb('0x32')](_0xe4eb('0x39'),JSON[_0xe4eb('0x3a')](_0x1b444c['matchPath']));if(_0x9ffeaf[_0xe4eb('0x37')][_0x514018]){_0x9ffeaf[_0xe4eb('0x37')][_0x514018][_0xe4eb('0x3b')](_0xe4eb('0x3c'));}});return _0x225cf0({'code':0xc8,'message':_0x4750db});}else{if(_0x569b35){logger[_0xe4eb('0x32')](util[_0xe4eb('0xd')]('Skipped\x20routing\x20for\x20%s',_0x514018));}else{logger[_0xe4eb('0x32')](_0xe4eb('0x3d'));}return _0x225cf0({'code':0xc8,'message':_0x4750db});}}catch(_0x56e69c){logger['error'](_0x56e69c['stack']);return _0x878cb1(_0x564fae['error'](0x1f4,_0x56e69c));}}return _0x878cb1('routing\x20is\x20empty');});},'AcceptMessage':function(_0x3a02a9){var _0x26e18d=this;return new Promise(function(_0x1e5500,_0x30984c){if(_0x3a02a9['agent']&&_0x3a02a9[_0xe4eb('0x3e')]['id']){if(_0x9ffeaf[_0xe4eb('0x3f')][_0x3a02a9[_0xe4eb('0x3e')]['id']]){_0x9ffeaf['agents'][_0x3a02a9[_0xe4eb('0x3e')]['id']][_0xe4eb('0x40')]=![];_0x9ffeaf['agents'][_0x3a02a9['agent']['id']][_0xe4eb('0x41')]=undefined;}}if(_0x3a02a9[_0xe4eb('0x15')]&&_0x3a02a9[_0xe4eb('0x15')]['id']){try{var _0x393599=getId(_0x3a02a9[_0xe4eb('0x14')],_0x3a02a9['message']?_0x3a02a9[_0xe4eb('0x15')]['id']:0x0,_0x3a02a9[_0xe4eb('0x16')]?_0x3a02a9[_0xe4eb('0x16')]['id']:0x0);if(_0x9ffeaf['rules'][_0x393599]){_0x9ffeaf[_0xe4eb('0x37')][_0x393599][_0xe4eb('0x3b')](_0xe4eb('0x42'));if(rpc[_0x3a02a9[_0xe4eb('0x14')]+'QueueReport']){rpc[_0x3a02a9[_0xe4eb('0x14')]+_0xe4eb('0x43')][_0xe4eb('0x44')](_0x393599,{'UserId':_0x3a02a9[_0xe4eb('0x15')][_0xe4eb('0x45')]})['catch'](function(){logger[_0xe4eb('0x46')](_0xe4eb('0x47'));});}}return _0x1e5500({'code':0xc8,'message':_0x3a02a9});}catch(_0x53143e){logger[_0xe4eb('0x46')](_0x53143e[_0xe4eb('0x48')]);return _0x30984c(_0x26e18d[_0xe4eb('0x46')](0x1f4,_0x53143e));}}logger[_0xe4eb('0x46')](_0xe4eb('0x49'));return _0x30984c(_0x26e18d[_0xe4eb('0x46')](0x1f4,_0xe4eb('0x49')));});},'RejectMessage':function(_0x49d381){var _0x3408f8=this;return new Promise(function(_0x13c3b3,_0xd49e4b){if(_0x49d381['agent']&&_0x49d381[_0xe4eb('0x3e')]['id']){try{if(_0x9ffeaf[_0xe4eb('0x3f')][_0x49d381['agent']['id']]){_0x9ffeaf[_0xe4eb('0x3f')][_0x49d381[_0xe4eb('0x3e')]['id']]['busy']=![];_0x9ffeaf[_0xe4eb('0x3f')][_0x49d381[_0xe4eb('0x3e')]['id']][_0xe4eb('0x41')]=undefined;}return _0x13c3b3({'code':0xc8,'message':_0x49d381});}catch(_0x41b8ec){logger[_0xe4eb('0x46')](_0x41b8ec[_0xe4eb('0x48')]);return _0xd49e4b(_0x3408f8[_0xe4eb('0x46')](0x1f4,_0x41b8ec));}}logger[_0xe4eb('0x46')]('message\x20is\x20empty');return _0xd49e4b(_0x3408f8[_0xe4eb('0x46')](0x1f4,_0xe4eb('0x49')));});},'AbandonInteraction':function(_0x34bf28){var _0x2b31b3=this;return new Promise(function(_0x3cf371,_0x54eea4){if(_0x34bf28['channel']&&_0x34bf28[_0xe4eb('0x16')]&&_0x34bf28['interaction']['id']){try{var _0x38bed2=getId(_0x34bf28['channel'],_0x34bf28[_0xe4eb('0x15')]?_0x34bf28['message']['id']:0x0,_0x34bf28[_0xe4eb('0x16')]?_0x34bf28['interaction']['id']:0x0);if(_0x9ffeaf['rules'][_0x38bed2]){_0x9ffeaf[_0xe4eb('0x37')][_0x38bed2]['emit']('end');}return _0x3cf371({'code':0xc8,'message':_0x34bf28});}catch(_0x4823c4){logger[_0xe4eb('0x46')](_0x4823c4[_0xe4eb('0x48')]);return _0x54eea4(_0x2b31b3[_0xe4eb('0x46')](0x1f4,_0x4823c4));}}logger[_0xe4eb('0x46')](_0xe4eb('0x49'));return _0x54eea4(_0x2b31b3[_0xe4eb('0x46')](0x1f4,'message\x20is\x20empty'));});},'AgentCapacity':function(_0x56d5b7){var _0x5ed254=this;return new Promise(function(_0x3889a7,_0x20482b){if(_0x9ffeaf[_0xe4eb('0x3f')][_0xe4eb('0x4a')](_0x56d5b7['id'])){for(var _0x5bb0f6 in _0x56d5b7[_0xe4eb('0x4b')]){if(_0x56d5b7['capacity'][_0xe4eb('0x4a')](_0x5bb0f6)){if(_0x9ffeaf[_0xe4eb('0x3f')][_0x56d5b7['id']][_0xe4eb('0x4a')](_0x5bb0f6+_0xe4eb('0x4c'))){_0x9ffeaf[_0xe4eb('0x3f')][_0x56d5b7['id']][_0x5bb0f6+_0xe4eb('0x4c')]=parseInt(_0x56d5b7[_0xe4eb('0x4b')][_0x5bb0f6],0xa);}}}_0x9ffeaf[_0xe4eb('0x3f')][_0x56d5b7['id']]['updateRealtime']();return _0x3889a7({'code':0xc8,'message':_0x9ffeaf[_0xe4eb('0x3f')][_0x56d5b7['id']]});}else{return _0x20482b(_0x5ed254[_0xe4eb('0x46')](0x1f4,_0xe4eb('0x4d')));}});},'Agents':function(_0x3eb0b9){return new Promise(function(_0x5ea55c){var _0x30da84=_[_0xe4eb('0x4e')](_0x9ffeaf[_0xe4eb('0x3f')]);if(_0x3eb0b9&&_0x3eb0b9['id']){var _0x45165b=_[_0xe4eb('0x4f')](_0x30da84,function(_0x4f00fb){return _0x4f00fb['id']===_0x3eb0b9['id'];});_0x5ea55c(_0x45165b);}else{_0x5ea55c({'count':_0x30da84[_0xe4eb('0x1a')],'rows':_0x30da84});}});},'ChatQueues':function(){return new Promise(function(_0x111203){var _0x36ac56=[];for(var _0x2751f4 in _0x9ffeaf[_0xe4eb('0x50')]){if(_0x9ffeaf[_0xe4eb('0x50')][_0xe4eb('0x4a')](_0x2751f4)){var _0x1564d0=_0x9ffeaf[_0xe4eb('0x50')][_0x2751f4];var _0x1a5f0a={'id':_0x1564d0['id'],'available':_0x1564d0[_0xe4eb('0x51')],'loggedIn':_0x1564d0[_0xe4eb('0x52')],'name':_0x1564d0['name'],'paused':_0x1564d0[_0xe4eb('0x53')],'waiting':_0x1564d0[_0xe4eb('0x54')]};_0x36ac56['push'](_0x1a5f0a);}}_0x111203({'count':_0x36ac56[_0xe4eb('0x1a')],'rows':_0x36ac56});});},'MailQueues':function(){return new Promise(function(_0x3cf4fb){var _0x1127e5=[];for(var _0x18859c in _0x9ffeaf[_0xe4eb('0x55')]){if(_0x9ffeaf[_0xe4eb('0x55')][_0xe4eb('0x4a')](_0x18859c)){var _0x129dd2=_0x9ffeaf[_0xe4eb('0x55')][_0x18859c];var _0xb956c3={'id':_0x129dd2['id'],'available':_0x129dd2[_0xe4eb('0x51')],'loggedIn':_0x129dd2[_0xe4eb('0x52')],'name':_0x129dd2[_0xe4eb('0x56')],'paused':_0x129dd2[_0xe4eb('0x53')],'waiting':_0x129dd2[_0xe4eb('0x54')]};_0x1127e5['push'](_0xb956c3);}}_0x3cf4fb({'count':_0x1127e5[_0xe4eb('0x1a')],'rows':_0x1127e5});});},'OpenchannelQueues':function(){return new Promise(function(_0x151608){var _0x45b786=[];for(var _0x1441a5 in _0x9ffeaf[_0xe4eb('0x57')]){if(_0x9ffeaf[_0xe4eb('0x57')][_0xe4eb('0x4a')](_0x1441a5)){var _0x429aaa=_0x9ffeaf[_0xe4eb('0x57')][_0x1441a5];var _0x3c4b7b={'id':_0x429aaa['id'],'available':_0x429aaa[_0xe4eb('0x51')],'loggedIn':_0x429aaa['loggedIn'],'name':_0x429aaa[_0xe4eb('0x56')],'paused':_0x429aaa[_0xe4eb('0x53')],'waiting':_0x429aaa[_0xe4eb('0x54')]};_0x45b786[_0xe4eb('0x21')](_0x3c4b7b);}}_0x151608({'count':_0x45b786['length'],'rows':_0x45b786});});},'SmsQueues':function(){return new Promise(function(_0x3462f3){var _0x2ecf91=[];for(var _0x9f040c in _0x9ffeaf[_0xe4eb('0x58')]){if(_0x9ffeaf[_0xe4eb('0x58')][_0xe4eb('0x4a')](_0x9f040c)){var _0x1b8360=_0x9ffeaf[_0xe4eb('0x58')][_0x9f040c];var _0x3d9f7e={'id':_0x1b8360['id'],'available':_0x1b8360[_0xe4eb('0x51')],'loggedIn':_0x1b8360[_0xe4eb('0x52')],'name':_0x1b8360[_0xe4eb('0x56')],'paused':_0x1b8360[_0xe4eb('0x53')],'waiting':_0x1b8360[_0xe4eb('0x54')]};_0x2ecf91[_0xe4eb('0x21')](_0x3d9f7e);}}_0x3462f3({'count':_0x2ecf91[_0xe4eb('0x1a')],'rows':_0x2ecf91});});},'FaxQueues':function(){return new Promise(function(_0x3687b3){var _0x481835=[];for(var _0x5a220b in _0x9ffeaf[_0xe4eb('0x59')]){if(_0x9ffeaf[_0xe4eb('0x59')][_0xe4eb('0x4a')](_0x5a220b)){var _0x3944ce=_0x9ffeaf[_0xe4eb('0x59')][_0x5a220b];var _0x5a14bb={'id':_0x3944ce['id'],'available':_0x3944ce[_0xe4eb('0x51')],'loggedIn':_0x3944ce[_0xe4eb('0x52')],'name':_0x3944ce[_0xe4eb('0x56')],'paused':_0x3944ce[_0xe4eb('0x53')],'waiting':_0x3944ce['waiting']};_0x481835[_0xe4eb('0x21')](_0x5a14bb);}}_0x3687b3({'count':_0x481835[_0xe4eb('0x1a')],'rows':_0x481835});});},'WhatsappQueues':function(){return new Promise(function(_0x73ff87){var _0x50b074=[];for(var _0x6e08d7 in _0x9ffeaf[_0xe4eb('0x5a')]){if(_0x9ffeaf[_0xe4eb('0x5a')][_0xe4eb('0x4a')](_0x6e08d7)){var _0x27b8aa=_0x9ffeaf[_0xe4eb('0x5a')][_0x6e08d7];var _0x238b8a={'id':_0x27b8aa['id'],'available':_0x27b8aa[_0xe4eb('0x51')],'loggedIn':_0x27b8aa[_0xe4eb('0x52')],'name':_0x27b8aa[_0xe4eb('0x56')],'paused':_0x27b8aa['paused'],'waiting':_0x27b8aa[_0xe4eb('0x54')]};_0x50b074[_0xe4eb('0x21')](_0x238b8a);}}_0x73ff87({'count':_0x50b074[_0xe4eb('0x1a')],'rows':_0x50b074});});},'ChatQueuesWaitingInteractions':function(){return new Promise(function(_0x265deb){var _0x5deb5e=_[_0xe4eb('0x4e')](_0x9ffeaf[_0xe4eb('0x5b')]);_0x265deb({'count':_0x5deb5e['length'],'rows':_0x5deb5e});});},'MailQueuesWaitingInteractions':function(){return new Promise(function(_0x5afab0){var _0x26c9b3=_['values'](_0x9ffeaf[_0xe4eb('0x5c')]);_0x5afab0({'count':_0x26c9b3[_0xe4eb('0x1a')],'rows':_0x26c9b3});});},'OpenchannelQueuesWaitingInteractions':function(){return new Promise(function(_0x505e13){var _0x31336f=_[_0xe4eb('0x4e')](_0x9ffeaf[_0xe4eb('0x5d')]);_0x505e13({'count':_0x31336f[_0xe4eb('0x1a')],'rows':_0x31336f});});},'SmsQueuesWaitingInteractions':function(){return new Promise(function(_0x38eacb){var _0x4b00a7=_[_0xe4eb('0x4e')](_0x9ffeaf[_0xe4eb('0x5e')]);_0x38eacb({'count':_0x4b00a7['length'],'rows':_0x4b00a7});});},'FaxQueuesWaitingInteractions':function(){return new Promise(function(_0x90b14e){var _0x4f1575=_[_0xe4eb('0x4e')](_0x9ffeaf[_0xe4eb('0x5f')]);_0x90b14e({'count':_0x4f1575['length'],'rows':_0x4f1575});});},'WhatsappQueuesWaitingInteractions':function(){return new Promise(function(_0x5c00ea){var _0x596ffd=_[_0xe4eb('0x4e')](_0x9ffeaf[_0xe4eb('0x60')]);_0x5c00ea({'count':_0x596ffd[_0xe4eb('0x1a')],'rows':_0x596ffd});});}};var _0x6fee4c=jayson[_0xe4eb('0x61')](_0x2ecc38)[_0xe4eb('0x62')]();_0x6fee4c['on'](_0xe4eb('0x46'),function(_0x3a36fd){logger[_0xe4eb('0x46')](JSON[_0xe4eb('0x3a')](_0x3a36fd));return _0x3282bd(_0x3a36fd);});_0x6fee4c[_0xe4eb('0x13')](0x232c,_0xe4eb('0x63'),function(){console['log'](_0xe4eb('0x64'),0x232c);return _0x5de791(_0xe4eb('0x65')+0x232c);});});}; \ No newline at end of file diff --git a/server/services/routing/server/interval.js b/server/services/routing/server/interval.js index cf64ca9..fb7c0a7 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 _0x94cb=['lodash','../../../config/logger','routing','client','request','then','error','message','result','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','stop','push','Command','format','indexOf','true','catch','all','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','log','join','stack','bluebird','jayson/promise'];(function(_0x34c939,_0x54199a){var _0x40d143=function(_0x11d5bf){while(--_0x11d5bf){_0x34c939['push'](_0x34c939['shift']());}};_0x40d143(++_0x54199a);}(_0x94cb,0xd6));var _0xb94c=function(_0x1b9025,_0x57ca6c){_0x1b9025=_0x1b9025-0x0;var _0x125c02=_0x94cb[_0x1b9025];return _0x125c02;};'use strict';var util=require('util');var BPromise=require(_0xb94c('0x0'));var jayson=require(_0xb94c('0x1'));var _=require(_0xb94c('0x2'));var logger=require(_0xb94c('0x3'))(_0xb94c('0x4'));var client=jayson[_0xb94c('0x5')]['http']({'port':0x232a});function request(_0x49338f,_0x3db709){return new BPromise(function(_0x5ba9fb,_0x1c62e2){return client[_0xb94c('0x6')](_0x49338f,_0x3db709)[_0xb94c('0x7')](function(_0x39787b){if(_0x39787b[_0xb94c('0x8')]){return _0x1c62e2(_0x39787b['error'][_0xb94c('0x9')]);}else{return _0x5ba9fb(_0x39787b[_0xb94c('0xa')]);}})['catch'](function(_0x472dfd){return _0x1c62e2(_0x472dfd);});});}exports['condition']=function(_0x586437,_0x4f3eee,_0x4c2f66){return function(_0x53791c){if(_0x4c2f66['rules']&&!_0x4c2f66[_0xb94c('0xb')][_0x586437]){logger[_0xb94c('0xc')](_0xb94c('0xd'),_0x586437);return _0x53791c[_0xb94c('0xe')]();}var _0x39c607=[];for(var _0x510fcf=0x0;_0x510fcf<_0x4f3eee['length'];_0x510fcf+=0x1){_0x39c607[_0xb94c('0xf')](request(_0xb94c('0x10'),{'command':util[_0xb94c('0x11')]('iftime\x20%s',_0x4f3eee[_0x510fcf])})[_0xb94c('0x7')](function(_0x218bea){return _0x218bea&&_0x218bea[_0xb94c('0x9')]&&_0x218bea[_0xb94c('0x9')][_0xb94c('0x12')](_0xb94c('0x13'))>=0x0?!![]:![];})[_0xb94c('0x14')](function(_0x1cd0b7){logger['error']('[%s][INTERVAL]\x20%s',_0x586437,_0x4f3eee[_0x510fcf]);}));}BPromise[_0xb94c('0x15')](_0x39c607)['then'](function(_0x5c0dcc){var _0x381906=_['some'](_0x5c0dcc);logger['info'](_0xb94c('0x16'),_0x586437,_0x4f3eee['join'](_0xb94c('0x17')),_0x381906);_0x53791c['when'](_0x381906);})[_0xb94c('0x14')](function(_0x22e1b5){console[_0xb94c('0x18')](_0x22e1b5);logger['error'](_0xb94c('0x16'),_0x586437,_0x4f3eee[_0xb94c('0x19')]('\x20|\x20'),_0x22e1b5[_0xb94c('0x1a')]);_0x53791c[_0xb94c('0xe')]();});};}; \ No newline at end of file +var _0x7a23=['iftime\x20%s','indexOf','[%s][INTERVAL]\x20%s','all','some','[%s][INTERVAL]\x20%s\x20%s','\x20|\x20','when','log','join','stack','stop','util','lodash','../../../config/logger','routing','client','http','request','then','error','message','result','catch','condition','rules','info','[%s][INTERVAL]\x20ROUTING\x20STOPPED','length','format'];(function(_0x203d88,_0x3f15d9){var _0x17df84=function(_0x265916){while(--_0x265916){_0x203d88['push'](_0x203d88['shift']());}};_0x17df84(++_0x3f15d9);}(_0x7a23,0x66));var _0x37a2=function(_0x3649f1,_0x23ad89){_0x3649f1=_0x3649f1-0x0;var _0x19bd4c=_0x7a23[_0x3649f1];return _0x19bd4c;};'use strict';var util=require(_0x37a2('0x0'));var BPromise=require('bluebird');var jayson=require('jayson/promise');var _=require(_0x37a2('0x1'));var logger=require(_0x37a2('0x2'))(_0x37a2('0x3'));var client=jayson[_0x37a2('0x4')][_0x37a2('0x5')]({'port':0x232a});function request(_0x464942,_0x2d4a47){return new BPromise(function(_0x4d9816,_0x4ee02d){return client[_0x37a2('0x6')](_0x464942,_0x2d4a47)[_0x37a2('0x7')](function(_0x40c2c8){if(_0x40c2c8[_0x37a2('0x8')]){return _0x4ee02d(_0x40c2c8[_0x37a2('0x8')][_0x37a2('0x9')]);}else{return _0x4d9816(_0x40c2c8[_0x37a2('0xa')]);}})[_0x37a2('0xb')](function(_0x141c18){return _0x4ee02d(_0x141c18);});});}exports[_0x37a2('0xc')]=function(_0x57cd34,_0x2687f2,_0x331ac7){return function(_0x4930e1){if(_0x331ac7[_0x37a2('0xd')]&&!_0x331ac7[_0x37a2('0xd')][_0x57cd34]){logger[_0x37a2('0xe')](_0x37a2('0xf'),_0x57cd34);return _0x4930e1['stop']();}var _0x26df93=[];for(var _0x4e0900=0x0;_0x4e0900<_0x2687f2[_0x37a2('0x10')];_0x4e0900+=0x1){_0x26df93['push'](request('Command',{'command':util[_0x37a2('0x11')](_0x37a2('0x12'),_0x2687f2[_0x4e0900])})[_0x37a2('0x7')](function(_0x465612){return _0x465612&&_0x465612[_0x37a2('0x9')]&&_0x465612['message'][_0x37a2('0x13')]('true')>=0x0?!![]:![];})['catch'](function(_0x4ffa28){logger['error'](_0x37a2('0x14'),_0x57cd34,_0x2687f2[_0x4e0900]);}));}BPromise[_0x37a2('0x15')](_0x26df93)['then'](function(_0x2300a2){var _0x4d1282=_[_0x37a2('0x16')](_0x2300a2);logger[_0x37a2('0xe')](_0x37a2('0x17'),_0x57cd34,_0x2687f2['join'](_0x37a2('0x18')),_0x4d1282);_0x4930e1[_0x37a2('0x19')](_0x4d1282);})['catch'](function(_0x2a9934){console[_0x37a2('0x1a')](_0x2a9934);logger[_0x37a2('0x8')](_0x37a2('0x17'),_0x57cd34,_0x2687f2[_0x37a2('0x1b')](_0x37a2('0x18')),_0x2a9934[_0x37a2('0x1c')]);_0x4930e1[_0x37a2('0x1d')]();});};}; \ No newline at end of file diff --git a/server/services/xdr/agents.controller.js b/server/services/xdr/agents.controller.js index c03bf79..d1287d2 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 _0x4fc2=['lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','interface','calleridnum','lastevent','getVoiceQueueByName','then','type','agentacw','agentcomplete','acw','acwtime','acwTimeout','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','connectedlinenum','connectedlinename','[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called','uniqueid','membername','error','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','holdtime','ringtime','talktime','push','queuecallerabandon','includes','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','reason','abandoned','[%s][agents][queuecallerabandon]','agentconnect','[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','answeredelsewheremembername','[%s][agents][agentconnect]','[%s][agents][agentcomplete]','agentconnectAt','complete','blindtransfer','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfereruniqueid','transfertype','blind','transferexten','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','[%s][agents][attendedtransfer]\x20agent:%s','ATTENDED','origtransfererexten','transferuniqueid','transfereeuniqueid','agententerreason','clone','calleridname','secondtransfererexten','transfertargetuniqueid','hangup','[%s][agents][hangup]','rejected','[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s','indexOf','splice','agentcompleteAt','agent','diffTime','transfer'];(function(_0xad63a4,_0x1d06ee){var _0x427575=function(_0x358190){while(--_0x358190){_0xad63a4['push'](_0xad63a4['shift']());}};_0x427575(++_0x1d06ee);}(_0x4fc2,0x111));var _0x24fc=function(_0x404a11,_0x268dc0){_0x404a11=_0x404a11-0x0;var _0x435823=_0x4fc2[_0x404a11];return _0x435823;};'use strict';var _=require(_0x24fc('0x0'));var util=require(_0x24fc('0x1'));var utils=require(_0x24fc('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x4390a0,_0x5aaa74){utils[_0x24fc('0x3')](util[_0x24fc('0x4')](_0x24fc('0x5'),_0x4390a0['uniqueid'],_0x4390a0[_0x24fc('0x6')],_0x4390a0[_0x24fc('0x7')],_0x4390a0['membername'],_0x4390a0[_0x24fc('0x8')],_0x4390a0[_0x24fc('0x9')],_0x4390a0['connectedlinenum'],_0x4390a0[_0x24fc('0xa')]));if(_0x4390a0[_0x24fc('0x7')]){utils[_0x24fc('0xb')](_0x4390a0[_0x24fc('0x7')])[_0x24fc('0xc')](function(_0x47349b){if(_0x47349b){_0x4390a0['type']=_0x47349b[_0x24fc('0xd')];_0x4390a0[_0x24fc('0xe')]=_0x4390a0[_0x24fc('0xf')]?_0x47349b[_0x24fc('0x10')]:![];_0x4390a0[_0x24fc('0x11')]=_0x4390a0[_0x24fc('0xe')]?_0x47349b[_0x24fc('0x12')]:0x0;}utils[_0x24fc('0x13')]('CreateVoiceAgentReport',_0x4390a0);});}else{utils[_0x24fc('0x13')](_0x24fc('0x14'),_0x4390a0);}if(_0x5aaa74){delete transfers[_0x4390a0['uniqueid']];}else{delete agents[_0x4390a0[_0x24fc('0x15')]];}}exports[_0x24fc('0x16')]=function(_0x3f6d8b){try{utils[_0x24fc('0x17')](util[_0x24fc('0x4')](_0x24fc('0x18'),_0x3f6d8b['uniqueid']),_0x3f6d8b);agents[_0x3f6d8b[_0x24fc('0x15')]]=_0x3f6d8b;agents[_0x3f6d8b[_0x24fc('0x15')]][_0x24fc('0x19')]=utils[_0x24fc('0x1a')]();agents[_0x3f6d8b['destuniqueid']][_0x24fc('0xa')]='called';agents[_0x3f6d8b[_0x24fc('0x15')]][_0x24fc('0x1b')]=null;agents[_0x3f6d8b[_0x24fc('0x15')]][_0x24fc('0x1c')]=null;utils[_0x24fc('0x3')](util['format'](_0x24fc('0x1d'),_0x3f6d8b[_0x24fc('0x1e')],agents[_0x3f6d8b[_0x24fc('0x15')]][_0x24fc('0x1f')],_0x3f6d8b['destuniqueid']));}catch(_0x5eabee){utils[_0x24fc('0x20')](util[_0x24fc('0x4')]('[%s][agents][agentcalled]',_0x3f6d8b[_0x24fc('0x1e')]),_0x5eabee);}};exports[_0x24fc('0x21')]=function(_0xbf1d6b){try{if(!_[_0x24fc('0x22')](agents[_0xbf1d6b['destuniqueid']])){utils[_0x24fc('0x17')](util['format'](_0x24fc('0x23'),_0xbf1d6b['uniqueid']),_0xbf1d6b);utils[_0x24fc('0x3')](util[_0x24fc('0x4')](_0x24fc('0x24'),_0xbf1d6b['uniqueid'],agents[_0xbf1d6b[_0x24fc('0x15')]]['membername'],_0xbf1d6b[_0x24fc('0x15')]));agents[_0xbf1d6b[_0x24fc('0x15')]][_0x24fc('0x21')]=!![];agents[_0xbf1d6b[_0x24fc('0x15')]][_0x24fc('0x25')]=utils[_0x24fc('0x1a')]();agents[_0xbf1d6b[_0x24fc('0x15')]][_0x24fc('0xa')]=_0x24fc('0x26');agents[_0xbf1d6b[_0x24fc('0x15')]]['reason']=_0x24fc('0x26');agents[_0xbf1d6b[_0x24fc('0x15')]][_0x24fc('0x27')]=_0xbf1d6b['ringtime']?parseInt(_0xbf1d6b[_0x24fc('0x28')])/0x3e8:0x0;agents[_0xbf1d6b[_0x24fc('0x15')]][_0x24fc('0x29')]=0x0;unanswered[_0x24fc('0x2a')](_0xbf1d6b[_0x24fc('0x15')]);}}catch(_0x443796){utils['error'](util[_0x24fc('0x4')](_0x24fc('0x23'),_0xbf1d6b[_0x24fc('0x1e')]),_0x443796);}};exports[_0x24fc('0x2b')]=function(_0x9f7bbc){try{_['forIn'](agents,function(_0x55c27f,_0x4e6f73){if(_0x55c27f[_0x24fc('0x1e')]==_0x9f7bbc['uniqueid']&&!_[_0x24fc('0x2c')](unanswered,_0x55c27f[_0x24fc('0x15')])){utils[_0x24fc('0x17')](util[_0x24fc('0x4')]('[%s][agents][queuecallerabandon]',_0x9f7bbc[_0x24fc('0x1e')]),_0x9f7bbc);utils[_0x24fc('0x3')](util['format'](_0x24fc('0x2d'),_0x9f7bbc[_0x24fc('0x1e')],_0x55c27f['membername'],_0x55c27f['destuniqueid']));_0x55c27f[_0x24fc('0x21')]=!![];_0x55c27f['agentringnoanswerAt']=utils[_0x24fc('0x1a')]();_0x55c27f[_0x24fc('0xa')]='abandoned';_0x55c27f[_0x24fc('0x2e')]=_0x24fc('0x2f');_0x55c27f[_0x24fc('0x27')]=_0x9f7bbc[_0x24fc('0x27')];_0x55c27f[_0x24fc('0x29')]=0x0;writeDB(_0x55c27f);}});}catch(_0x1e205d){utils[_0x24fc('0x20')](util[_0x24fc('0x4')](_0x24fc('0x30'),_0x9f7bbc['uniqueid']),_0x1e205d);}};exports[_0x24fc('0x31')]=function(_0x4224f4){try{if(agents[_0x4224f4[_0x24fc('0x15')]]){utils[_0x24fc('0x17')](util[_0x24fc('0x4')]('[%s][agents][agentconnect]',_0x4224f4['uniqueid']),_0x4224f4);utils[_0x24fc('0x3')](util['format'](_0x24fc('0x32'),_0x4224f4[_0x24fc('0x1e')],agents[_0x4224f4[_0x24fc('0x15')]][_0x24fc('0x1f')],_0x4224f4['destuniqueid']));agents[_0x4224f4[_0x24fc('0x15')]]['agentconnectAt']=utils[_0x24fc('0x1a')]();agents[_0x4224f4[_0x24fc('0x15')]][_0x24fc('0x1b')]=_0x4224f4[_0x24fc('0x1b')];agents[_0x4224f4[_0x24fc('0x15')]]['connectedlinename']=_0x4224f4[_0x24fc('0x1c')];agents[_0x4224f4[_0x24fc('0x15')]][_0x24fc('0x27')]=_0x4224f4[_0x24fc('0x28')];agents[_0x4224f4['destuniqueid']][_0x24fc('0xa')]=_0x24fc('0x33');_['forIn'](agents,function(_0xf40435,_0x52df2e){if(_0xf40435[_0x24fc('0x15')]!=_0x4224f4[_0x24fc('0x15')]&&_0xf40435[_0x24fc('0x1e')]==_0x4224f4[_0x24fc('0x1e')]){_0xf40435[_0x24fc('0x29')]=0x0;_0xf40435[_0x24fc('0x27')]=_0x4224f4[_0x24fc('0x28')];_0xf40435[_0x24fc('0x21')]=!![];_0xf40435['agentringnoanswerAt']=utils[_0x24fc('0x1a')]();_0xf40435[_0x24fc('0xa')]=_0x24fc('0x34');_0xf40435['reason']=_0x24fc('0x34');_0xf40435[_0x24fc('0x35')]=_0x4224f4['destuniqueid'];_0xf40435[_0x24fc('0x36')]=_0x4224f4[_0x24fc('0x1f')];writeDB(_0xf40435);}});}}catch(_0x2c598c){utils['error'](util[_0x24fc('0x4')](_0x24fc('0x37'),_0x4224f4['uniqueid']),_0x2c598c);}};exports[_0x24fc('0xf')]=function(_0x169982){try{if(!_[_0x24fc('0x22')](agents[_0x169982[_0x24fc('0x15')]])){utils['debug'](util[_0x24fc('0x4')](_0x24fc('0x38'),_0x169982[_0x24fc('0x1e')]),_0x169982);utils[_0x24fc('0x3')](util[_0x24fc('0x4')]('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x169982[_0x24fc('0x1e')],agents[_0x169982[_0x24fc('0x15')]][_0x24fc('0x1f')],_0x169982[_0x24fc('0x15')]));agents[_0x169982['destuniqueid']][_0x24fc('0xf')]=!![];agents[_0x169982[_0x24fc('0x15')]]['agentcompleteAt']=utils['now']();agents[_0x169982[_0x24fc('0x15')]]['talktime']=utils['diffTime'](agents[_0x169982[_0x24fc('0x15')]]['agentcompleteAt'],agents[_0x169982[_0x24fc('0x15')]][_0x24fc('0x39')]);agents[_0x169982[_0x24fc('0x15')]]['reason']=_0x169982[_0x24fc('0x2e')];agents[_0x169982[_0x24fc('0x15')]][_0x24fc('0xa')]=_0x24fc('0x3a');writeDB(agents[_0x169982[_0x24fc('0x15')]]);}}catch(_0x6c6754){utils[_0x24fc('0x20')](util[_0x24fc('0x4')]('[%s][agents][agentcomplete]',_0x169982['uniqueid']),_0x6c6754);}};exports[_0x24fc('0x3b')]=function(_0x2f1a99){try{if(!_[_0x24fc('0x22')](agents[_0x2f1a99['transfereruniqueid']])){utils['debug'](util[_0x24fc('0x4')](_0x24fc('0x3c'),_0x2f1a99[_0x24fc('0x1e')]),_0x2f1a99);utils[_0x24fc('0x3')](util[_0x24fc('0x4')](_0x24fc('0x3d'),_0x2f1a99[_0x24fc('0x1e')],agents[_0x2f1a99[_0x24fc('0x3e')]][_0x24fc('0x1f')],agents[_0x2f1a99[_0x24fc('0x3e')]][_0x24fc('0x1e')]));agents[_0x2f1a99[_0x24fc('0x3e')]]['transfer']=!![];agents[_0x2f1a99[_0x24fc('0x3e')]][_0x24fc('0x3f')]=_0x24fc('0x40');agents[_0x2f1a99[_0x24fc('0x3e')]][_0x24fc('0x41')]=_0x2f1a99['extension'];agents[_0x2f1a99[_0x24fc('0x3e')]]['transferuniqueid']=agents[_0x2f1a99[_0x24fc('0x3e')]][_0x24fc('0x1e')];}}catch(_0x446c14){utils[_0x24fc('0x20')](util[_0x24fc('0x4')](_0x24fc('0x3c'),_0x2f1a99['uniqueid']),_0x446c14);}};exports[_0x24fc('0x42')]=function(_0xc2ba88){try{utils[_0x24fc('0x17')](util[_0x24fc('0x4')](_0x24fc('0x43'),_0xc2ba88[_0x24fc('0x44')]),_0xc2ba88);if(_0xc2ba88['origtransfereruniqueid']==_0xc2ba88[_0x24fc('0x45')]){if(!_[_0x24fc('0x22')](agents[_0xc2ba88[_0x24fc('0x46')]])){utils[_0x24fc('0x3')](util[_0x24fc('0x4')](_0x24fc('0x47'),_0xc2ba88[_0x24fc('0x44')],agents[_0xc2ba88['secondtransfereruniqueid']][_0x24fc('0x1f')]));agents[_0xc2ba88[_0x24fc('0x46')]]['transfer']=!![];agents[_0xc2ba88[_0x24fc('0x46')]][_0x24fc('0x3f')]=_0x24fc('0x48');agents[_0xc2ba88[_0x24fc('0x46')]][_0x24fc('0x41')]=_0xc2ba88[_0x24fc('0x49')];agents[_0xc2ba88['secondtransfereruniqueid']][_0x24fc('0x4a')]=_0xc2ba88['origtransfereruniqueid'];}if(_0xc2ba88[_0x24fc('0x4b')]&&agents[_0xc2ba88[_0x24fc('0x4b')]]){agents[_0xc2ba88['transfereeuniqueid']][_0x24fc('0x4c')]=0x1;transfers[_0xc2ba88['transfereeuniqueid']]=_[_0x24fc('0x4d')](agents[_0xc2ba88['transfereeuniqueid']]);transfers[_0xc2ba88[_0x24fc('0x4b')]][_0x24fc('0x9')]=agents[_0xc2ba88['secondtransfereruniqueid']][_0x24fc('0x9')];transfers[_0xc2ba88['transfereeuniqueid']][_0x24fc('0x4e')]=agents[_0xc2ba88[_0x24fc('0x46')]]['calleridname'];transfers[_0xc2ba88[_0x24fc('0x4b')]][_0x24fc('0x19')]=utils[_0x24fc('0x1a')]();transfers[_0xc2ba88[_0x24fc('0x4b')]][_0x24fc('0x39')]=utils['now']();transfers[_0xc2ba88[_0x24fc('0x4b')]][_0x24fc('0x27')]=0x0;transfers[_0xc2ba88[_0x24fc('0x4b')]][_0x24fc('0x4c')]=0x2;}}else if(_0xc2ba88[_0x24fc('0x46')]==_0xc2ba88['secondtransfererlinkedid']){if(!_['isNil'](agents[_0xc2ba88[_0x24fc('0x44')]])){utils[_0x24fc('0x3')](util['format']('[%s][agents][attendedtransfer]\x20agent:%s',_0xc2ba88[_0x24fc('0x44')],agents[_0xc2ba88[_0x24fc('0x44')]][_0x24fc('0x1f')]));agents[_0xc2ba88[_0x24fc('0x44')]]['transfer']=!![];agents[_0xc2ba88[_0x24fc('0x44')]][_0x24fc('0x3f')]=_0x24fc('0x48');agents[_0xc2ba88[_0x24fc('0x44')]][_0x24fc('0x41')]=_0xc2ba88[_0x24fc('0x4f')];agents[_0xc2ba88[_0x24fc('0x44')]][_0x24fc('0x4a')]=_0xc2ba88[_0x24fc('0x46')];}if(_0xc2ba88[_0x24fc('0x50')]&&agents[_0xc2ba88[_0x24fc('0x50')]]){agents[_0xc2ba88[_0x24fc('0x50')]][_0x24fc('0x4c')]=0x1;transfers[_0xc2ba88[_0x24fc('0x50')]]=_[_0x24fc('0x4d')](agents[_0xc2ba88['transfertargetuniqueid']]);transfers[_0xc2ba88[_0x24fc('0x50')]][_0x24fc('0x9')]=agents[_0xc2ba88[_0x24fc('0x44')]][_0x24fc('0x9')];transfers[_0xc2ba88[_0x24fc('0x50')]][_0x24fc('0x4e')]=agents[_0xc2ba88[_0x24fc('0x44')]][_0x24fc('0x4e')];transfers[_0xc2ba88['transfertargetuniqueid']][_0x24fc('0x19')]=utils[_0x24fc('0x1a')]();transfers[_0xc2ba88[_0x24fc('0x50')]][_0x24fc('0x39')]=utils['now']();transfers[_0xc2ba88[_0x24fc('0x50')]][_0x24fc('0x27')]=0x0;transfers[_0xc2ba88['transfertargetuniqueid']]['agententerreason']=0x2;}}}catch(_0x4f97b7){utils[_0x24fc('0x20')](util[_0x24fc('0x4')](_0x24fc('0x43'),_0xc2ba88[_0x24fc('0x44')]),_0x4f97b7);}};exports[_0x24fc('0x51')]=function(_0x1d0f06){try{utils['debug'](util[_0x24fc('0x4')](_0x24fc('0x52'),_0x1d0f06['uniqueid']),_0x1d0f06);if(agents[_0x1d0f06['uniqueid']]&&agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x2e')]===_0x24fc('0x26')){if(_0x1d0f06['cause']==='21'){agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x2e')]=_0x24fc('0x53');agents[_0x1d0f06['uniqueid']]['lastevent']='rejected';}utils['info'](util['format'](_0x24fc('0x54'),_0x1d0f06[_0x24fc('0x1e')],agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x1f')],agents[_0x1d0f06['uniqueid']][_0x24fc('0x2e')],agents[_0x1d0f06['uniqueid']][_0x24fc('0xa')]));writeDB(agents[_0x1d0f06['uniqueid']]);var _0x368e0a=unanswered[_0x24fc('0x55')](_0x1d0f06[_0x24fc('0x1e')]);if(_0x368e0a>-0x1){unanswered[_0x24fc('0x56')](_0x368e0a,0x1);}}if(transfers[_0x1d0f06[_0x24fc('0x1e')]]){transfers[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0xf')]=!![];transfers[_0x1d0f06['uniqueid']][_0x24fc('0x57')]=utils[_0x24fc('0x1a')]();transfers[_0x1d0f06[_0x24fc('0x1e')]]['talktime']=utils['diffTime'](transfers[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x57')],transfers[_0x1d0f06['uniqueid']][_0x24fc('0x39')]);transfers[_0x1d0f06[_0x24fc('0x1e')]]['reason']=_0x24fc('0x58');transfers[_0x1d0f06[_0x24fc('0x1e')]]['lastevent']=_0x24fc('0x3a');utils[_0x24fc('0x3')](util[_0x24fc('0x4')](_0x24fc('0x54'),_0x1d0f06[_0x24fc('0x1e')],transfers[_0x1d0f06[_0x24fc('0x1e')]]['membername'],transfers[_0x1d0f06['uniqueid']][_0x24fc('0x2e')],transfers[_0x1d0f06['uniqueid']][_0x24fc('0xa')]));writeDB(transfers[_0x1d0f06['uniqueid']],!![]);}if(agents[_0x1d0f06['uniqueid']]&&agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x39')]){agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0xf')]=!![];agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x57')]=utils[_0x24fc('0x1a')]();agents[_0x1d0f06[_0x24fc('0x1e')]]['talktime']=utils[_0x24fc('0x59')](agents[_0x1d0f06[_0x24fc('0x1e')]]['agentcompleteAt'],agents[_0x1d0f06['uniqueid']][_0x24fc('0x39')]);agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x2e')]=agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x5a')]?'transfer':_0x24fc('0x58');agents[_0x1d0f06[_0x24fc('0x1e')]]['lastevent']=_0x24fc('0x3a');utils[_0x24fc('0x3')](util[_0x24fc('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x1d0f06[_0x24fc('0x1e')],agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x1f')],agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0x2e')],agents[_0x1d0f06[_0x24fc('0x1e')]][_0x24fc('0xa')]));writeDB(agents[_0x1d0f06[_0x24fc('0x1e')]]);}}catch(_0x188edb){utils['error'](util[_0x24fc('0x4')](_0x24fc('0x52'),_0x1d0f06[_0x24fc('0x1e')]),_0x188edb);}}; \ No newline at end of file +var _0x4ded=['agentcompleteAt','agentconnectAt','complete','blindtransfer','transfereruniqueid','[%s][agents][blindtransfer]','[%s][agents][blindtransfer]\x20agent:%s\x20transferuniqueid:%s','transfer','blind','transferuniqueid','attendedtransfer','[%s][agents][attendedtransfer]','origtransfereruniqueid','origtransfererlinkedid','secondtransfereruniqueid','transfertype','ATTENDED','transferexten','origtransfererexten','transfereeuniqueid','agententerreason','clone','calleridname','[%s][agents][attendedtransfer]\x20agent:%s','secondtransfererexten','transfertargetuniqueid','hangup','cause','rejected','indexOf','splice','agent','lodash','util','./utils','info','format','[%s][agents][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','uniqueid','channel','queue','membername','calleridnum','connectedlinenum','lastevent','getVoiceQueueByName','agentcomplete','acw','request','CreateVoiceAgentReport','destuniqueid','agentcalled','debug','[%s][agents][agentcalled]','agentcalledAt','now','called','connectedlinename','agentringnoanswer','isNil','[%s][agents][agentringnoanswer]','[%s][agents][agentringnoanswer]\x20agent:%s\x20destuniqueid:%s\x20lastevent:timeout','agentringnoanswerAt','timeout','reason','ringtime','talktime','error','queuecallerabandon','forIn','includes','[%s][agents][queuecallerabandon]','[%s][agents][queuecallerabandon]\x20agent:%s\x20destuniqueid:%s\x20lastevent:abandoned','abandoned','holdtime','agentconnect','[%s][agents][agentconnect]','connect','answered_elsewhere','answeredelsewheredestinationuniqueid','[%s][agents][agentcomplete]','diffTime'];(function(_0x48c2b3,_0x41576f){var _0x42c7a1=function(_0x35e5a4){while(--_0x35e5a4){_0x48c2b3['push'](_0x48c2b3['shift']());}};_0x42c7a1(++_0x41576f);}(_0x4ded,0x116));var _0xd4de=function(_0x421a8d,_0x2529ac){_0x421a8d=_0x421a8d-0x0;var _0x309571=_0x4ded[_0x421a8d];return _0x309571;};'use strict';var _=require(_0xd4de('0x0'));var util=require(_0xd4de('0x1'));var utils=require(_0xd4de('0x2'));var agents={};var transfers={};var unanswered=[];function writeDB(_0x1fa334,_0x2349f5){utils[_0xd4de('0x3')](util[_0xd4de('0x4')](_0xd4de('0x5'),_0x1fa334[_0xd4de('0x6')],_0x1fa334[_0xd4de('0x7')],_0x1fa334[_0xd4de('0x8')],_0x1fa334[_0xd4de('0x9')],_0x1fa334['interface'],_0x1fa334[_0xd4de('0xa')],_0x1fa334[_0xd4de('0xb')],_0x1fa334[_0xd4de('0xc')]));if(_0x1fa334[_0xd4de('0x8')]){utils[_0xd4de('0xd')](_0x1fa334[_0xd4de('0x8')])['then'](function(_0xb7e8cf){if(_0xb7e8cf){_0x1fa334['type']=_0xb7e8cf['type'];_0x1fa334['agentacw']=_0x1fa334[_0xd4de('0xe')]?_0xb7e8cf[_0xd4de('0xf')]:![];_0x1fa334['acwtime']=_0x1fa334['agentacw']?_0xb7e8cf['acwTimeout']:0x0;}utils[_0xd4de('0x10')]('CreateVoiceAgentReport',_0x1fa334);});}else{utils[_0xd4de('0x10')](_0xd4de('0x11'),_0x1fa334);}if(_0x2349f5){delete transfers[_0x1fa334[_0xd4de('0x6')]];}else{delete agents[_0x1fa334[_0xd4de('0x12')]];}}exports[_0xd4de('0x13')]=function(_0x3af6e0){try{utils[_0xd4de('0x14')](util[_0xd4de('0x4')](_0xd4de('0x15'),_0x3af6e0[_0xd4de('0x6')]),_0x3af6e0);agents[_0x3af6e0[_0xd4de('0x12')]]=_0x3af6e0;agents[_0x3af6e0[_0xd4de('0x12')]][_0xd4de('0x16')]=utils[_0xd4de('0x17')]();agents[_0x3af6e0[_0xd4de('0x12')]][_0xd4de('0xc')]=_0xd4de('0x18');agents[_0x3af6e0['destuniqueid']]['connectedlinenum']=null;agents[_0x3af6e0[_0xd4de('0x12')]][_0xd4de('0x19')]=null;utils[_0xd4de('0x3')](util[_0xd4de('0x4')]('[%s][agents][agentcalled]\x20agent:%s\x20destuniqueid:%s\x20lastevent:called',_0x3af6e0['uniqueid'],agents[_0x3af6e0[_0xd4de('0x12')]]['membername'],_0x3af6e0[_0xd4de('0x12')]));}catch(_0x29c028){utils['error'](util[_0xd4de('0x4')]('[%s][agents][agentcalled]',_0x3af6e0[_0xd4de('0x6')]),_0x29c028);}};exports[_0xd4de('0x1a')]=function(_0x2bad14){try{if(!_[_0xd4de('0x1b')](agents[_0x2bad14['destuniqueid']])){utils[_0xd4de('0x14')](util[_0xd4de('0x4')](_0xd4de('0x1c'),_0x2bad14[_0xd4de('0x6')]),_0x2bad14);utils[_0xd4de('0x3')](util[_0xd4de('0x4')](_0xd4de('0x1d'),_0x2bad14[_0xd4de('0x6')],agents[_0x2bad14[_0xd4de('0x12')]][_0xd4de('0x9')],_0x2bad14['destuniqueid']));agents[_0x2bad14[_0xd4de('0x12')]][_0xd4de('0x1a')]=!![];agents[_0x2bad14[_0xd4de('0x12')]][_0xd4de('0x1e')]=utils[_0xd4de('0x17')]();agents[_0x2bad14[_0xd4de('0x12')]][_0xd4de('0xc')]=_0xd4de('0x1f');agents[_0x2bad14[_0xd4de('0x12')]][_0xd4de('0x20')]=_0xd4de('0x1f');agents[_0x2bad14[_0xd4de('0x12')]]['holdtime']=_0x2bad14[_0xd4de('0x21')]?parseInt(_0x2bad14[_0xd4de('0x21')])/0x3e8:0x0;agents[_0x2bad14['destuniqueid']][_0xd4de('0x22')]=0x0;unanswered['push'](_0x2bad14[_0xd4de('0x12')]);}}catch(_0x32e407){utils[_0xd4de('0x23')](util['format'](_0xd4de('0x1c'),_0x2bad14[_0xd4de('0x6')]),_0x32e407);}};exports[_0xd4de('0x24')]=function(_0x50cb73){try{_[_0xd4de('0x25')](agents,function(_0x1804c7,_0x55f9f9){if(_0x1804c7['uniqueid']==_0x50cb73['uniqueid']&&!_[_0xd4de('0x26')](unanswered,_0x1804c7['destuniqueid'])){utils[_0xd4de('0x14')](util[_0xd4de('0x4')](_0xd4de('0x27'),_0x50cb73[_0xd4de('0x6')]),_0x50cb73);utils['info'](util[_0xd4de('0x4')](_0xd4de('0x28'),_0x50cb73['uniqueid'],_0x1804c7[_0xd4de('0x9')],_0x1804c7[_0xd4de('0x12')]));_0x1804c7['agentringnoanswer']=!![];_0x1804c7['agentringnoanswerAt']=utils[_0xd4de('0x17')]();_0x1804c7[_0xd4de('0xc')]=_0xd4de('0x29');_0x1804c7[_0xd4de('0x20')]='abandoned';_0x1804c7[_0xd4de('0x2a')]=_0x50cb73[_0xd4de('0x2a')];_0x1804c7['talktime']=0x0;writeDB(_0x1804c7);}});}catch(_0x329d49){utils[_0xd4de('0x23')](util[_0xd4de('0x4')](_0xd4de('0x27'),_0x50cb73[_0xd4de('0x6')]),_0x329d49);}};exports[_0xd4de('0x2b')]=function(_0x53441c){try{if(agents[_0x53441c['destuniqueid']]){utils[_0xd4de('0x14')](util[_0xd4de('0x4')](_0xd4de('0x2c'),_0x53441c['uniqueid']),_0x53441c);utils[_0xd4de('0x3')](util[_0xd4de('0x4')]('[%s][agents][agentconnect]\x20agent:%s\x20destuniqueid:%s\x20lastevent:connect',_0x53441c[_0xd4de('0x6')],agents[_0x53441c[_0xd4de('0x12')]][_0xd4de('0x9')],_0x53441c[_0xd4de('0x12')]));agents[_0x53441c['destuniqueid']]['agentconnectAt']=utils[_0xd4de('0x17')]();agents[_0x53441c['destuniqueid']][_0xd4de('0xb')]=_0x53441c['connectedlinenum'];agents[_0x53441c[_0xd4de('0x12')]][_0xd4de('0x19')]=_0x53441c[_0xd4de('0x19')];agents[_0x53441c[_0xd4de('0x12')]]['holdtime']=_0x53441c[_0xd4de('0x21')];agents[_0x53441c['destuniqueid']][_0xd4de('0xc')]=_0xd4de('0x2d');_[_0xd4de('0x25')](agents,function(_0x4517a6,_0x349c5f){if(_0x4517a6[_0xd4de('0x12')]!=_0x53441c[_0xd4de('0x12')]&&_0x4517a6['uniqueid']==_0x53441c[_0xd4de('0x6')]){_0x4517a6[_0xd4de('0x22')]=0x0;_0x4517a6[_0xd4de('0x2a')]=_0x53441c[_0xd4de('0x21')];_0x4517a6[_0xd4de('0x1a')]=!![];_0x4517a6['agentringnoanswerAt']=utils[_0xd4de('0x17')]();_0x4517a6[_0xd4de('0xc')]=_0xd4de('0x2e');_0x4517a6['reason']=_0xd4de('0x2e');_0x4517a6[_0xd4de('0x2f')]=_0x53441c[_0xd4de('0x12')];_0x4517a6['answeredelsewheremembername']=_0x53441c[_0xd4de('0x9')];writeDB(_0x4517a6);}});}}catch(_0x10a42c){utils[_0xd4de('0x23')](util[_0xd4de('0x4')](_0xd4de('0x2c'),_0x53441c[_0xd4de('0x6')]),_0x10a42c);}};exports[_0xd4de('0xe')]=function(_0x5ecbbd){try{if(!_[_0xd4de('0x1b')](agents[_0x5ecbbd[_0xd4de('0x12')]])){utils[_0xd4de('0x14')](util['format'](_0xd4de('0x30'),_0x5ecbbd[_0xd4de('0x6')]),_0x5ecbbd);utils[_0xd4de('0x3')](util['format']('[%s][agents][agentcomplete]\x20agent:%s\x20destuniqueid:%s\x20lastevent:complete',_0x5ecbbd[_0xd4de('0x6')],agents[_0x5ecbbd[_0xd4de('0x12')]]['membername'],_0x5ecbbd[_0xd4de('0x12')]));agents[_0x5ecbbd[_0xd4de('0x12')]][_0xd4de('0xe')]=!![];agents[_0x5ecbbd[_0xd4de('0x12')]]['agentcompleteAt']=utils[_0xd4de('0x17')]();agents[_0x5ecbbd[_0xd4de('0x12')]][_0xd4de('0x22')]=utils[_0xd4de('0x31')](agents[_0x5ecbbd[_0xd4de('0x12')]][_0xd4de('0x32')],agents[_0x5ecbbd['destuniqueid']][_0xd4de('0x33')]);agents[_0x5ecbbd[_0xd4de('0x12')]][_0xd4de('0x20')]=_0x5ecbbd[_0xd4de('0x20')];agents[_0x5ecbbd[_0xd4de('0x12')]][_0xd4de('0xc')]=_0xd4de('0x34');writeDB(agents[_0x5ecbbd[_0xd4de('0x12')]]);}}catch(_0xaf442c){utils[_0xd4de('0x23')](util['format'](_0xd4de('0x30'),_0x5ecbbd[_0xd4de('0x6')]),_0xaf442c);}};exports[_0xd4de('0x35')]=function(_0x518bfe){try{if(!_[_0xd4de('0x1b')](agents[_0x518bfe[_0xd4de('0x36')]])){utils[_0xd4de('0x14')](util[_0xd4de('0x4')](_0xd4de('0x37'),_0x518bfe[_0xd4de('0x6')]),_0x518bfe);utils[_0xd4de('0x3')](util[_0xd4de('0x4')](_0xd4de('0x38'),_0x518bfe[_0xd4de('0x6')],agents[_0x518bfe['transfereruniqueid']][_0xd4de('0x9')],agents[_0x518bfe[_0xd4de('0x36')]][_0xd4de('0x6')]));agents[_0x518bfe[_0xd4de('0x36')]][_0xd4de('0x39')]=!![];agents[_0x518bfe['transfereruniqueid']]['transfertype']=_0xd4de('0x3a');agents[_0x518bfe[_0xd4de('0x36')]]['transferexten']=_0x518bfe['extension'];agents[_0x518bfe[_0xd4de('0x36')]][_0xd4de('0x3b')]=agents[_0x518bfe[_0xd4de('0x36')]][_0xd4de('0x6')];}}catch(_0x34d772){utils[_0xd4de('0x23')](util[_0xd4de('0x4')](_0xd4de('0x37'),_0x518bfe[_0xd4de('0x6')]),_0x34d772);}};exports[_0xd4de('0x3c')]=function(_0x3be8c2){try{utils[_0xd4de('0x14')](util['format'](_0xd4de('0x3d'),_0x3be8c2[_0xd4de('0x3e')]),_0x3be8c2);if(_0x3be8c2[_0xd4de('0x3e')]==_0x3be8c2[_0xd4de('0x3f')]){if(!_[_0xd4de('0x1b')](agents[_0x3be8c2[_0xd4de('0x40')]])){utils['info'](util[_0xd4de('0x4')]('[%s][agents][attendedtransfer]\x20agent:%s',_0x3be8c2['origtransfereruniqueid'],agents[_0x3be8c2[_0xd4de('0x40')]][_0xd4de('0x9')]));agents[_0x3be8c2[_0xd4de('0x40')]][_0xd4de('0x39')]=!![];agents[_0x3be8c2['secondtransfereruniqueid']][_0xd4de('0x41')]=_0xd4de('0x42');agents[_0x3be8c2[_0xd4de('0x40')]][_0xd4de('0x43')]=_0x3be8c2[_0xd4de('0x44')];agents[_0x3be8c2['secondtransfereruniqueid']]['transferuniqueid']=_0x3be8c2['origtransfereruniqueid'];}if(_0x3be8c2[_0xd4de('0x45')]&&agents[_0x3be8c2[_0xd4de('0x45')]]){agents[_0x3be8c2[_0xd4de('0x45')]][_0xd4de('0x46')]=0x1;transfers[_0x3be8c2['transfereeuniqueid']]=_[_0xd4de('0x47')](agents[_0x3be8c2[_0xd4de('0x45')]]);transfers[_0x3be8c2[_0xd4de('0x45')]][_0xd4de('0xa')]=agents[_0x3be8c2['secondtransfereruniqueid']][_0xd4de('0xa')];transfers[_0x3be8c2[_0xd4de('0x45')]][_0xd4de('0x48')]=agents[_0x3be8c2[_0xd4de('0x40')]]['calleridname'];transfers[_0x3be8c2['transfereeuniqueid']]['agentcalledAt']=utils[_0xd4de('0x17')]();transfers[_0x3be8c2[_0xd4de('0x45')]][_0xd4de('0x33')]=utils['now']();transfers[_0x3be8c2[_0xd4de('0x45')]][_0xd4de('0x2a')]=0x0;transfers[_0x3be8c2[_0xd4de('0x45')]]['agententerreason']=0x2;}}else if(_0x3be8c2[_0xd4de('0x40')]==_0x3be8c2['secondtransfererlinkedid']){if(!_[_0xd4de('0x1b')](agents[_0x3be8c2[_0xd4de('0x3e')]])){utils[_0xd4de('0x3')](util[_0xd4de('0x4')](_0xd4de('0x49'),_0x3be8c2[_0xd4de('0x3e')],agents[_0x3be8c2[_0xd4de('0x3e')]][_0xd4de('0x9')]));agents[_0x3be8c2['origtransfereruniqueid']][_0xd4de('0x39')]=!![];agents[_0x3be8c2['origtransfereruniqueid']][_0xd4de('0x41')]=_0xd4de('0x42');agents[_0x3be8c2['origtransfereruniqueid']][_0xd4de('0x43')]=_0x3be8c2[_0xd4de('0x4a')];agents[_0x3be8c2[_0xd4de('0x3e')]][_0xd4de('0x3b')]=_0x3be8c2[_0xd4de('0x40')];}if(_0x3be8c2[_0xd4de('0x4b')]&&agents[_0x3be8c2[_0xd4de('0x4b')]]){agents[_0x3be8c2[_0xd4de('0x4b')]][_0xd4de('0x46')]=0x1;transfers[_0x3be8c2[_0xd4de('0x4b')]]=_[_0xd4de('0x47')](agents[_0x3be8c2[_0xd4de('0x4b')]]);transfers[_0x3be8c2[_0xd4de('0x4b')]]['calleridnum']=agents[_0x3be8c2[_0xd4de('0x3e')]][_0xd4de('0xa')];transfers[_0x3be8c2[_0xd4de('0x4b')]][_0xd4de('0x48')]=agents[_0x3be8c2[_0xd4de('0x3e')]][_0xd4de('0x48')];transfers[_0x3be8c2[_0xd4de('0x4b')]][_0xd4de('0x16')]=utils['now']();transfers[_0x3be8c2[_0xd4de('0x4b')]]['agentconnectAt']=utils['now']();transfers[_0x3be8c2['transfertargetuniqueid']][_0xd4de('0x2a')]=0x0;transfers[_0x3be8c2[_0xd4de('0x4b')]]['agententerreason']=0x2;}}}catch(_0x4a06b2){utils['error'](util['format'](_0xd4de('0x3d'),_0x3be8c2['origtransfereruniqueid']),_0x4a06b2);}};exports[_0xd4de('0x4c')]=function(_0x5ddba5){try{utils[_0xd4de('0x14')](util[_0xd4de('0x4')]('[%s][agents][hangup]',_0x5ddba5['uniqueid']),_0x5ddba5);if(agents[_0x5ddba5['uniqueid']]&&agents[_0x5ddba5['uniqueid']][_0xd4de('0x20')]===_0xd4de('0x1f')){if(_0x5ddba5[_0xd4de('0x4d')]==='21'){agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x20')]=_0xd4de('0x4e');agents[_0x5ddba5['uniqueid']]['lastevent']='rejected';}utils[_0xd4de('0x3')](util[_0xd4de('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5ddba5[_0xd4de('0x6')],agents[_0x5ddba5['uniqueid']][_0xd4de('0x9')],agents[_0x5ddba5['uniqueid']][_0xd4de('0x20')],agents[_0x5ddba5[_0xd4de('0x6')]]['lastevent']));writeDB(agents[_0x5ddba5[_0xd4de('0x6')]]);var _0x5a4882=unanswered[_0xd4de('0x4f')](_0x5ddba5[_0xd4de('0x6')]);if(_0x5a4882>-0x1){unanswered[_0xd4de('0x50')](_0x5a4882,0x1);}}if(transfers[_0x5ddba5[_0xd4de('0x6')]]){transfers[_0x5ddba5['uniqueid']][_0xd4de('0xe')]=!![];transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x32')]=utils[_0xd4de('0x17')]();transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x22')]=utils[_0xd4de('0x31')](transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x32')],transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x33')]);transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x20')]='agent';transfers[_0x5ddba5[_0xd4de('0x6')]]['lastevent']='complete';utils[_0xd4de('0x3')](util[_0xd4de('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5ddba5[_0xd4de('0x6')],transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x9')],transfers[_0x5ddba5[_0xd4de('0x6')]]['reason'],transfers[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0xc')]));writeDB(transfers[_0x5ddba5[_0xd4de('0x6')]],!![]);}if(agents[_0x5ddba5[_0xd4de('0x6')]]&&agents[_0x5ddba5[_0xd4de('0x6')]]['agentconnectAt']){agents[_0x5ddba5['uniqueid']]['agentcomplete']=!![];agents[_0x5ddba5['uniqueid']][_0xd4de('0x32')]=utils['now']();agents[_0x5ddba5[_0xd4de('0x6')]]['talktime']=utils[_0xd4de('0x31')](agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x32')],agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x33')]);agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x20')]=agents[_0x5ddba5[_0xd4de('0x6')]]['transfer']?_0xd4de('0x39'):_0xd4de('0x51');agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0xc')]='complete';utils[_0xd4de('0x3')](util[_0xd4de('0x4')]('[%s][agents][hangup]\x20agent:%s\x20reason:%s\x20lastevent:%s',_0x5ddba5[_0xd4de('0x6')],agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x9')],agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0x20')],agents[_0x5ddba5[_0xd4de('0x6')]][_0xd4de('0xc')]));writeDB(agents[_0x5ddba5[_0xd4de('0x6')]]);}}catch(_0x27fd09){utils[_0xd4de('0x23')](util[_0xd4de('0x4')]('[%s][agents][hangup]',_0x5ddba5[_0xd4de('0x6')]),_0x27fd09);}}; \ No newline at end of file diff --git a/server/services/xdr/calls.controller.js b/server/services/xdr/calls.controller.js index 23d7c46..cb86aba 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 _0xb5dd=['gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds','uniqueid','transfereeuniqueid','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','interface','calleridnum','connectedlinenum','lastevent','accountcode','getUserByInternal','UserId','request','CreateVoiceCallReport','recording','newchannel','debug','format','[%s][calls][newchannel]','info','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','isNil','channelstate','[%s][calls][newstate]\x20context:%s\x20channel:%s','systemanswertime','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','destinationchannel','answertime','disposition','toNumber','[%s][calls][newstate]','hangup','[%s][calls][hangup]','callerid','calleridname','[%s][calls][hangup]\x20callerid:%s\x20reason:%s','cause-txt','diffTime','endtime','starttime','billableseconds','error','attendedtransfer','localtwolinkedid','origtransfereruniqueid','transfereechannel','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','userfield','origtransfererchannel','[%s][calls][attendedtransfer]','musiconholdstart','[%s][calls][musiconholdstart]','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstartAt','musiconholdstop','[%s][calls][musiconholdstop]','mohtime','[%s][calls][varset]','xmd-originatecalleridnum','value','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','\x22\x20<','variable','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','lastdata','queue','xmd-contactid','[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','substring','lastIndexOf','includes','execif'];(function(_0x5d6456,_0x58ecc7){var _0x4d66c1=function(_0x4335e3){while(--_0x4335e3){_0x5d6456['push'](_0x5d6456['shift']());}};_0x4d66c1(++_0x58ecc7);}(_0xb5dd,0xd9));var _0xdb5d=function(_0x167cc1,_0x56ef5a){_0x167cc1=_0x167cc1-0x0;var _0x10bc4b=_0xb5dd[_0x167cc1];return _0x10bc4b;};'use strict';var _=require(_0xdb5d('0x0'));var util=require(_0xdb5d('0x1'));var utils=require(_0xdb5d('0x2'));var transfers=require(_0xdb5d('0x3'));var dispositions=[_0xdb5d('0x4'),'FAILED',_0xdb5d('0x5'),_0xdb5d('0x4'),_0xdb5d('0x4'),'NO\x20ANSWER',_0xdb5d('0x6'),_0xdb5d('0x7'),_0xdb5d('0x5'),_0xdb5d('0x5'),_0xdb5d('0x5')];var channels={};function writeDB(_0x89fa9e){var _0x344631;if(transfers[_0xdb5d('0x8')][_0x89fa9e[_0xdb5d('0x9')]]){_0x344631=_0x89fa9e[_0xdb5d('0x9')];_0x89fa9e['uniqueid']=transfers[_0xdb5d('0x8')][_0x89fa9e[_0xdb5d('0x9')]][_0xdb5d('0xa')];}utils['info'](util['format'](_0xdb5d('0xb'),_0x89fa9e[_0xdb5d('0x9')],_0x89fa9e[_0xdb5d('0xc')],_0x89fa9e['queue'],_0x89fa9e['membername'],_0x89fa9e[_0xdb5d('0xd')],_0x89fa9e[_0xdb5d('0xe')],_0x89fa9e[_0xdb5d('0xf')],_0x89fa9e[_0xdb5d('0x10')]));if(_0x89fa9e[_0xdb5d('0x11')]){utils[_0xdb5d('0x12')](_0x89fa9e[_0xdb5d('0x11')])['then'](function(_0x80d463){if(_0x80d463){_0x89fa9e[_0xdb5d('0x13')]=_0x80d463['id'];}utils[_0xdb5d('0x14')]('CreateVoiceCallReport',_0x89fa9e);});}else{utils[_0xdb5d('0x14')](_0xdb5d('0x15'),_0x89fa9e);}if(channels[_0x89fa9e[_0xdb5d('0x9')]]){delete channels[_0x89fa9e['uniqueid']];}else if(_0x344631&&channels[_0x344631]){if(!transfers['blinds'][_0x344631][_0xdb5d('0x16')])delete transfers['blinds'][_0x344631];delete channels[_0x344631];}}exports[_0xdb5d('0x17')]=function(_0x3769aa){try{utils[_0xdb5d('0x18')](util[_0xdb5d('0x19')](_0xdb5d('0x1a'),_0x3769aa[_0xdb5d('0x9')]),_0x3769aa);if(_0x3769aa[_0xdb5d('0x9')]==_0x3769aa['linkedid']&&_0x3769aa[_0xdb5d('0xc')]!='OutgoingSpoolFailed'){utils[_0xdb5d('0x1b')](util[_0xdb5d('0x19')](_0xdb5d('0x1c'),_0x3769aa[_0xdb5d('0x9')],_0x3769aa[_0xdb5d('0x1d')],_0x3769aa['exten']));channels[_0x3769aa[_0xdb5d('0x9')]]={'uniqueid':_0x3769aa[_0xdb5d('0x9')],'accountcode':_0x3769aa['accountcode'],'source':_0x3769aa['calleridnum'],'destination':_0x3769aa[_0xdb5d('0x1e')],'destinationcontext':_0x3769aa[_0xdb5d('0x1d')],'channel':_0x3769aa['channel'],'starttime':utils[_0xdb5d('0x1f')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0xdb5d('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x3894fa){utils['error'](util[_0xdb5d('0x19')]('[%s][calls][newchannel]',_0x3769aa[_0xdb5d('0x9')]),_0x3894fa);}};exports['newstate']=function(_0x485f61){try{utils[_0xdb5d('0x18')](util['format']('[%s][calls][newstate]',_0x485f61[_0xdb5d('0x9')]),_0x485f61);if(!_[_0xdb5d('0x20')](channels[_0x485f61[_0xdb5d('0x9')]])&&_0x485f61[_0xdb5d('0x21')]==0x6){utils[_0xdb5d('0x1b')](util['format'](_0xdb5d('0x22'),_0x485f61[_0xdb5d('0x9')],_0x485f61[_0xdb5d('0x1d')],_0x485f61[_0xdb5d('0xc')]));if(_[_0xdb5d('0x20')](channels[_0x485f61[_0xdb5d('0x9')]][_0xdb5d('0x23')])){channels[_0x485f61['uniqueid']][_0xdb5d('0x23')]=utils[_0xdb5d('0x1f')]();}}else if(!_[_0xdb5d('0x20')](channels[_0x485f61['linkedid']])&&_0x485f61['channelstate']==0x6&&_0x485f61[_0xdb5d('0x1d')]!='transfer'){utils[_0xdb5d('0x1b')](util[_0xdb5d('0x19')](_0xdb5d('0x24'),_0x485f61[_0xdb5d('0x9')],_0x485f61[_0xdb5d('0x25')],_0x485f61['context'],_0x485f61['channel']));channels[_0x485f61[_0xdb5d('0x25')]][_0xdb5d('0x11')]=_0x485f61[_0xdb5d('0x11')];channels[_0x485f61[_0xdb5d('0x25')]][_0xdb5d('0x26')]=_0x485f61['channel'];if(_[_0xdb5d('0x20')](channels[_0x485f61[_0xdb5d('0x25')]][_0xdb5d('0x27')])){channels[_0x485f61[_0xdb5d('0x25')]][_0xdb5d('0x27')]=utils[_0xdb5d('0x1f')]();}channels[_0x485f61[_0xdb5d('0x25')]][_0xdb5d('0x28')]=dispositions[_[_0xdb5d('0x29')](_0x485f61['channelstate'])]||_0xdb5d('0x6');}}catch(_0x3a9cc5){utils['error'](util[_0xdb5d('0x19')](_0xdb5d('0x2a'),_0x485f61[_0xdb5d('0x9')]),_0x3a9cc5);}};exports[_0xdb5d('0x2b')]=function(_0x48dcc1){try{if(!_[_0xdb5d('0x20')](channels[_0x48dcc1[_0xdb5d('0x9')]])){utils['debug'](util[_0xdb5d('0x19')](_0xdb5d('0x2c'),_0x48dcc1[_0xdb5d('0x9')]),_0x48dcc1);if(_[_0xdb5d('0x20')](channels[_0x48dcc1['uniqueid']]['callerid'])){channels[_0x48dcc1[_0xdb5d('0x9')]][_0xdb5d('0x2d')]=_0x48dcc1[_0xdb5d('0x2e')]+'\x20<'+_0x48dcc1[_0xdb5d('0xe')]+'>';}utils[_0xdb5d('0x1b')](util[_0xdb5d('0x19')](_0xdb5d('0x2f'),_0x48dcc1[_0xdb5d('0x9')],channels[_0x48dcc1[_0xdb5d('0x9')]][_0xdb5d('0x2d')],_0x48dcc1[_0xdb5d('0x30')]));channels[_0x48dcc1['uniqueid']]['endtime']=utils[_0xdb5d('0x1f')]();channels[_0x48dcc1[_0xdb5d('0x9')]]['duration']=utils[_0xdb5d('0x31')](channels[_0x48dcc1[_0xdb5d('0x9')]][_0xdb5d('0x32')],channels[_0x48dcc1['uniqueid']][_0xdb5d('0x33')]);channels[_0x48dcc1['uniqueid']][_0xdb5d('0x34')]=channels[_0x48dcc1[_0xdb5d('0x9')]]['answertime']?utils['diffTime'](channels[_0x48dcc1[_0xdb5d('0x9')]]['endtime'],channels[_0x48dcc1[_0xdb5d('0x9')]][_0xdb5d('0x27')]):0x0;writeDB(channels[_0x48dcc1[_0xdb5d('0x9')]]);}}catch(_0x125cdb){utils[_0xdb5d('0x35')](util[_0xdb5d('0x19')]('[%s][calls][hangup]',_0x48dcc1['uniqueid']),_0x125cdb);}};exports[_0xdb5d('0x36')]=function(_0x2a8f96){try{if(!_['isNil'](channels[_0x2a8f96[_0xdb5d('0x37')]])){utils[_0xdb5d('0x18')](util['format']('[%s][calls][attendedtransfer]',_0x2a8f96[_0xdb5d('0x38')]),_0x2a8f96);if(channels[_0x2a8f96[_0xdb5d('0x37')]]['channel']==_0x2a8f96[_0xdb5d('0x39')]){utils['info'](util[_0xdb5d('0x19')](_0xdb5d('0x3a'),_0x2a8f96[_0xdb5d('0x38')],_0x2a8f96[_0xdb5d('0x37')],_0x2a8f96['secondtransfererchannel']));channels[_0x2a8f96[_0xdb5d('0x37')]][_0xdb5d('0x26')]=_0x2a8f96['secondtransfererchannel'];channels[_0x2a8f96[_0xdb5d('0x37')]][_0xdb5d('0x3b')]='_attended';}else if(channels[_0x2a8f96[_0xdb5d('0x37')]]['channel']=_0x2a8f96['transfertargetchannel']){utils[_0xdb5d('0x1b')](util['format'](_0xdb5d('0x3a'),_0x2a8f96['origtransfereruniqueid'],_0x2a8f96[_0xdb5d('0x37')],_0x2a8f96[_0xdb5d('0x3c')]));channels[_0x2a8f96[_0xdb5d('0x37')]][_0xdb5d('0x26')]=_0x2a8f96[_0xdb5d('0x3c')];channels[_0x2a8f96[_0xdb5d('0x37')]]['userfield']='_attended';}}}catch(_0x1cf36c){utils[_0xdb5d('0x35')](util['format'](_0xdb5d('0x3d'),_0x2a8f96[_0xdb5d('0x38')]),_0x1cf36c);}};exports[_0xdb5d('0x3e')]=function(_0x3db21e){try{if(!_['isNil'](channels[_0x3db21e[_0xdb5d('0x9')]])){utils[_0xdb5d('0x18')](util[_0xdb5d('0x19')](_0xdb5d('0x3f'),_0x3db21e[_0xdb5d('0x9')]),_0x3db21e);channels[_0x3db21e['uniqueid']]['musiconholdstartAt']=utils[_0xdb5d('0x1f')]();utils[_0xdb5d('0x1b')](util[_0xdb5d('0x19')](_0xdb5d('0x40'),_0x3db21e[_0xdb5d('0x9')],channels[_0x3db21e[_0xdb5d('0x9')]][_0xdb5d('0x41')]));}}catch(_0x4eee57){utils[_0xdb5d('0x35')](util[_0xdb5d('0x19')](_0xdb5d('0x3f'),_0x3db21e[_0xdb5d('0x9')]),_0x4eee57);}};exports[_0xdb5d('0x42')]=function(_0x5e62e2){try{if(!_['isNil'](channels[_0x5e62e2['uniqueid']])){utils['debug'](util[_0xdb5d('0x19')](_0xdb5d('0x43'),_0x5e62e2[_0xdb5d('0x9')]),_0x5e62e2);if(!_['isNil'](channels[_0x5e62e2[_0xdb5d('0x9')]][_0xdb5d('0x41')])){channels[_0x5e62e2[_0xdb5d('0x9')]][_0xdb5d('0x44')]+=utils[_0xdb5d('0x31')](utils[_0xdb5d('0x1f')](),channels[_0x5e62e2[_0xdb5d('0x9')]]['musiconholdstartAt']);utils[_0xdb5d('0x1b')](util[_0xdb5d('0x19')]('[%s][calls][musiconholdstop]\x20mohtime:%s',_0x5e62e2[_0xdb5d('0x9')],channels[_0x5e62e2[_0xdb5d('0x9')]]['mohtime']));delete channels[_0x5e62e2[_0xdb5d('0x9')]][_0xdb5d('0x41')];}}}catch(_0x2435c4){utils[_0xdb5d('0x35')](util['format'](_0xdb5d('0x43'),_0x5e62e2[_0xdb5d('0x9')]),_0x2435c4);}};exports['varset']=function(_0x39d93c){try{if(!_['isNil'](channels[_0x39d93c['uniqueid']])){utils[_0xdb5d('0x18')](util[_0xdb5d('0x19')](_0xdb5d('0x45'),_0x39d93c['uniqueid']),_0x39d93c);if(!_[_0xdb5d('0x20')](_0x39d93c['variable'][_0xdb5d('0x46')])){utils[_0xdb5d('0x1b')](util['format']('[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s',_0x39d93c['uniqueid'],_0x39d93c[_0xdb5d('0x47')]));channels[_0x39d93c['uniqueid']]['source']=_0x39d93c[_0xdb5d('0x47')];}if(!_['isNil'](_0x39d93c['variable']['xmd-phone'])){utils['info'](util[_0xdb5d('0x19')](_0xdb5d('0x48'),_0x39d93c[_0xdb5d('0x9')],_0x39d93c[_0xdb5d('0x47')]));channels[_0x39d93c[_0xdb5d('0x9')]][_0xdb5d('0x49')]=_0x39d93c[_0xdb5d('0x47')];channels[_0x39d93c[_0xdb5d('0x9')]]['callerid']='\x22'+_0x39d93c[_0xdb5d('0x47')]+_0xdb5d('0x4a')+_0x39d93c[_0xdb5d('0x47')]+'>';}if(!_[_0xdb5d('0x20')](_0x39d93c[_0xdb5d('0x4b')][_0xdb5d('0x4c')])||!_[_0xdb5d('0x20')](_0x39d93c['variable'][_0xdb5d('0x4d')])){utils[_0xdb5d('0x1b')](util['format'](_0xdb5d('0x4e'),_0x39d93c[_0xdb5d('0x9')],!_[_0xdb5d('0x20')](_0x39d93c[_0xdb5d('0x4b')][_0xdb5d('0x4c')])?'xmd-callerid-preview':_0xdb5d('0x4d'),_0x39d93c[_0xdb5d('0x47')]));channels[_0x39d93c[_0xdb5d('0x9')]][_0xdb5d('0x2d')]=_0x39d93c['value'];}if(!_['isNil'](_0x39d93c[_0xdb5d('0x4b')][_0xdb5d('0x4f')])||!_[_0xdb5d('0x20')](_0x39d93c[_0xdb5d('0x4b')][_0xdb5d('0x50')])){utils[_0xdb5d('0x1b')](util[_0xdb5d('0x19')](_0xdb5d('0x4e'),_0x39d93c['uniqueid'],!_['isNil'](_0x39d93c[_0xdb5d('0x4b')]['xmd-queue'])?_0xdb5d('0x4f'):_0xdb5d('0x50'),_0x39d93c[_0xdb5d('0x47')]));channels[_0x39d93c[_0xdb5d('0x9')]][_0xdb5d('0x51')]=_0xdb5d('0x52');channels[_0x39d93c[_0xdb5d('0x9')]][_0xdb5d('0x53')]=_0x39d93c[_0xdb5d('0x47')];channels[_0x39d93c[_0xdb5d('0x9')]][_0xdb5d('0x54')]=!![];}if(!_[_0xdb5d('0x20')](_0x39d93c['variable'][_0xdb5d('0x55')])){utils[_0xdb5d('0x1b')](util[_0xdb5d('0x19')](_0xdb5d('0x56'),_0x39d93c['uniqueid'],_0x39d93c[_0xdb5d('0x47')]));channels[_0x39d93c[_0xdb5d('0x9')]][_0xdb5d('0x57')]=_0x39d93c[_0xdb5d('0x47')];}if(!_[_0xdb5d('0x20')](_0x39d93c[_0xdb5d('0x4b')]['xmd-cdrtype'])){utils['info'](util[_0xdb5d('0x19')](_0xdb5d('0x58'),_0x39d93c[_0xdb5d('0x9')],_0x39d93c[_0xdb5d('0x47')]));channels[_0x39d93c['uniqueid']][_0xdb5d('0x59')]=_0x39d93c[_0xdb5d('0x47')];}if(!_[_0xdb5d('0x20')](_0x39d93c[_0xdb5d('0x4b')][_0xdb5d('0x5a')])){utils['info'](util[_0xdb5d('0x19')]('[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s',_0x39d93c['uniqueid'],_0x39d93c[_0xdb5d('0x47')]));channels[_0x39d93c[_0xdb5d('0x9')]][_0xdb5d('0x5b')]=_0x39d93c[_0xdb5d('0x47')];}if(!_[_0xdb5d('0x20')](_0x39d93c[_0xdb5d('0x4b')][_0xdb5d('0x5c')])){utils['info'](util[_0xdb5d('0x19')](_0xdb5d('0x5d'),_0x39d93c[_0xdb5d('0x9')],_0x39d93c[_0xdb5d('0x47')]));channels[_0x39d93c['uniqueid']]['sipcallid']=_0x39d93c['value'];}}}catch(_0x1e70fe){utils['error'](util['format'](_0xdb5d('0x45'),_0x39d93c[_0xdb5d('0x9')]),_0x1e70fe);}};exports[_0xdb5d('0x5e')]=function(_0x495704){try{if(!_[_0xdb5d('0x20')](channels[_0x495704[_0xdb5d('0x9')]])){utils[_0xdb5d('0x18')](util[_0xdb5d('0x19')](_0xdb5d('0x5f'),_0x495704['uniqueid']),_0x495704);utils[_0xdb5d('0x1b')](util['format'](_0xdb5d('0x60'),_0x495704['uniqueid'],_0x495704[_0xdb5d('0x61')],_0x495704[_0xdb5d('0x62')]));if(_0x495704['application'][_0xdb5d('0x63')]()==_0xdb5d('0x64')&&_[_0xdb5d('0x65')](_0x495704[_0xdb5d('0x62')]['toLowerCase'](),_0xdb5d('0x66'))){var _0x5b3002=_0x495704['appdata']['split']('=');var _0x33c5fc=_0x5b3002[0x0][_0xdb5d('0x67')](_0x5b3002[0x0][_0xdb5d('0x68')]('(')+0x1,_0x5b3002[0x0][_0xdb5d('0x68')](')'));var _0x432bcb=_0x5b3002[0x1];channels[_0x495704[_0xdb5d('0x9')]][_0x33c5fc]=_0x432bcb;}if(!_[_0xdb5d('0x69')]([_0xdb5d('0x2b'),'noop',_0xdb5d('0x6a'),_0xdb5d('0x64'),_0xdb5d('0x6b')],_0x495704[_0xdb5d('0x61')]['toLowerCase']())){channels[_0x495704[_0xdb5d('0x9')]][_0xdb5d('0x51')]=_0x495704[_0xdb5d('0x61')];channels[_0x495704[_0xdb5d('0x9')]][_0xdb5d('0x53')]=_0x495704['appdata'];}}}catch(_0x4862ce){utils[_0xdb5d('0x35')](util[_0xdb5d('0x19')]('[%s][calls][newexten]',_0x495704[_0xdb5d('0x9')]),_0x4862ce);}}; \ No newline at end of file +var _0xb2b4=['uniqueid','transfereeuniqueid','info','format','[%s][calls][writeDB]\x20channel:%s\x20queue:%s\x20agent:%s\x20interface:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20lastevent:%s','channel','queue','membername','interface','connectedlinenum','lastevent','accountcode','UserId','request','CreateVoiceCallReport','recording','newchannel','[%s][calls][newchannel]','linkedid','OutgoingSpoolFailed','[%s][calls][newchannel]\x20context:%s\x20exten:%s','context','exten','now','error','newstate','[%s][calls][newstate]','channelstate','isNil','systemanswertime','transfer','[%s][calls][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','answertime','disposition','toNumber','hangup','[%s][calls][hangup]','callerid','calleridname','calleridnum','cause-txt','endtime','duration','diffTime','attendedtransfer','localtwolinkedid','debug','[%s][calls][attendedtransfer]','origtransfereruniqueid','[%s][calls][attendedtransfer]\x20localtwolinkedid:%s\x20destinationchannel:%s','secondtransfererchannel','userfield','_attended','origtransfererchannel','musiconholdstart','[%s][calls][musiconholdstart]','musiconholdstartAt','[%s][calls][musiconholdstart]\x20musiconholdstartAt:%s','musiconholdstop','[%s][calls][musiconholdstop]','[%s][calls][musiconholdstop]\x20mohtime:%s','mohtime','[%s][calls][varset]','variable','xmd-originatecalleridnum','[%s][calls][varset]\x20variable:xmd-originatecalleridnum\x20value:%s','value','xmd-phone','[%s][calls][varset]\x20variable:xmd-phone\x20value:%s','destination','xmd-callerid-preview','xmd-callerid','[%s][calls][varset]\x20variable:%s\x20value:%s','xmd-queue','xmcs-queue','lastapplication','Queue','xmd-contactid','ContactId','[%s][calls][varset]\x20variable:xmd-cdrtype\x20value:%s','type','outboundrouteid','[%s][calls][varset]\x20variable:outboundrouteid\x20value:%s','routeid','sipcallid','[%s][calls][varset]\x20variable:sipcallid\x20value:%s','newexten','[%s][calls][newexten]','[%s][calls][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','set','startsWith','cdr','split','lastIndexOf','includes','noop','execif','gotoif','lodash','util','./utils','./transfers.controller','NO\x20ANSWER','FAILED','ANSWERED','BUSY','blinds'];(function(_0x1a04ad,_0x484c57){var _0x146e42=function(_0x3e80b7){while(--_0x3e80b7){_0x1a04ad['push'](_0x1a04ad['shift']());}};_0x146e42(++_0x484c57);}(_0xb2b4,0x141));var _0x4b2b=function(_0x40a77f,_0x1d5f8d){_0x40a77f=_0x40a77f-0x0;var _0x415aa1=_0xb2b4[_0x40a77f];return _0x415aa1;};'use strict';var _=require(_0x4b2b('0x0'));var util=require(_0x4b2b('0x1'));var utils=require(_0x4b2b('0x2'));var transfers=require(_0x4b2b('0x3'));var dispositions=[_0x4b2b('0x4'),'FAILED',_0x4b2b('0x5'),_0x4b2b('0x4'),_0x4b2b('0x4'),_0x4b2b('0x4'),_0x4b2b('0x6'),_0x4b2b('0x7'),_0x4b2b('0x5'),_0x4b2b('0x5'),_0x4b2b('0x5')];var channels={};function writeDB(_0x232106){var _0x4f2596;if(transfers[_0x4b2b('0x8')][_0x232106[_0x4b2b('0x9')]]){_0x4f2596=_0x232106[_0x4b2b('0x9')];_0x232106['uniqueid']=transfers[_0x4b2b('0x8')][_0x232106[_0x4b2b('0x9')]][_0x4b2b('0xa')];}utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')](_0x4b2b('0xd'),_0x232106['uniqueid'],_0x232106[_0x4b2b('0xe')],_0x232106[_0x4b2b('0xf')],_0x232106[_0x4b2b('0x10')],_0x232106[_0x4b2b('0x11')],_0x232106['calleridnum'],_0x232106[_0x4b2b('0x12')],_0x232106[_0x4b2b('0x13')]));if(_0x232106[_0x4b2b('0x14')]){utils['getUserByInternal'](_0x232106[_0x4b2b('0x14')])['then'](function(_0x904f80){if(_0x904f80){_0x232106[_0x4b2b('0x15')]=_0x904f80['id'];}utils[_0x4b2b('0x16')](_0x4b2b('0x17'),_0x232106);});}else{utils[_0x4b2b('0x16')](_0x4b2b('0x17'),_0x232106);}if(channels[_0x232106['uniqueid']]){delete channels[_0x232106[_0x4b2b('0x9')]];}else if(_0x4f2596&&channels[_0x4f2596]){if(!transfers[_0x4b2b('0x8')][_0x4f2596][_0x4b2b('0x18')])delete transfers[_0x4b2b('0x8')][_0x4f2596];delete channels[_0x4f2596];}}exports[_0x4b2b('0x19')]=function(_0x18611d){try{utils['debug'](util[_0x4b2b('0xc')](_0x4b2b('0x1a'),_0x18611d[_0x4b2b('0x9')]),_0x18611d);if(_0x18611d[_0x4b2b('0x9')]==_0x18611d[_0x4b2b('0x1b')]&&_0x18611d[_0x4b2b('0xe')]!=_0x4b2b('0x1c')){utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')](_0x4b2b('0x1d'),_0x18611d['uniqueid'],_0x18611d[_0x4b2b('0x1e')],_0x18611d['exten']));channels[_0x18611d[_0x4b2b('0x9')]]={'uniqueid':_0x18611d[_0x4b2b('0x9')],'accountcode':_0x18611d[_0x4b2b('0x14')],'source':_0x18611d['calleridnum'],'destination':_0x18611d[_0x4b2b('0x1f')],'destinationcontext':_0x18611d['context'],'channel':_0x18611d[_0x4b2b('0xe')],'starttime':utils[_0x4b2b('0x20')](),'answertime':null,'systemanswertime':null,'mohtime':0x0,'disposition':_0x4b2b('0x4'),'amaflags':'DOCUMENTATION'};}}catch(_0x24f538){utils[_0x4b2b('0x21')](util[_0x4b2b('0xc')](_0x4b2b('0x1a'),_0x18611d[_0x4b2b('0x9')]),_0x24f538);}};exports[_0x4b2b('0x22')]=function(_0x30bba8){try{utils['debug'](util[_0x4b2b('0xc')](_0x4b2b('0x23'),_0x30bba8[_0x4b2b('0x9')]),_0x30bba8);if(!_['isNil'](channels[_0x30bba8[_0x4b2b('0x9')]])&&_0x30bba8[_0x4b2b('0x24')]==0x6){utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')]('[%s][calls][newstate]\x20context:%s\x20channel:%s',_0x30bba8[_0x4b2b('0x9')],_0x30bba8['context'],_0x30bba8['channel']));if(_[_0x4b2b('0x25')](channels[_0x30bba8[_0x4b2b('0x9')]]['systemanswertime'])){channels[_0x30bba8[_0x4b2b('0x9')]][_0x4b2b('0x26')]=utils[_0x4b2b('0x20')]();}}else if(!_[_0x4b2b('0x25')](channels[_0x30bba8[_0x4b2b('0x1b')]])&&_0x30bba8['channelstate']==0x6&&_0x30bba8[_0x4b2b('0x1e')]!=_0x4b2b('0x27')){utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')](_0x4b2b('0x28'),_0x30bba8[_0x4b2b('0x9')],_0x30bba8['linkedid'],_0x30bba8[_0x4b2b('0x1e')],_0x30bba8[_0x4b2b('0xe')]));channels[_0x30bba8[_0x4b2b('0x1b')]][_0x4b2b('0x14')]=_0x30bba8[_0x4b2b('0x14')];channels[_0x30bba8[_0x4b2b('0x1b')]]['destinationchannel']=_0x30bba8[_0x4b2b('0xe')];if(_[_0x4b2b('0x25')](channels[_0x30bba8[_0x4b2b('0x1b')]][_0x4b2b('0x29')])){channels[_0x30bba8[_0x4b2b('0x1b')]][_0x4b2b('0x29')]=utils[_0x4b2b('0x20')]();}channels[_0x30bba8['linkedid']][_0x4b2b('0x2a')]=dispositions[_[_0x4b2b('0x2b')](_0x30bba8[_0x4b2b('0x24')])]||_0x4b2b('0x6');}}catch(_0x419ce5){utils['error'](util[_0x4b2b('0xc')](_0x4b2b('0x23'),_0x30bba8[_0x4b2b('0x9')]),_0x419ce5);}};exports[_0x4b2b('0x2c')]=function(_0x3d18ff){try{if(!_[_0x4b2b('0x25')](channels[_0x3d18ff['uniqueid']])){utils['debug'](util[_0x4b2b('0xc')](_0x4b2b('0x2d'),_0x3d18ff['uniqueid']),_0x3d18ff);if(_[_0x4b2b('0x25')](channels[_0x3d18ff['uniqueid']][_0x4b2b('0x2e')])){channels[_0x3d18ff[_0x4b2b('0x9')]]['callerid']=_0x3d18ff[_0x4b2b('0x2f')]+'\x20<'+_0x3d18ff[_0x4b2b('0x30')]+'>';}utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')]('[%s][calls][hangup]\x20callerid:%s\x20reason:%s',_0x3d18ff['uniqueid'],channels[_0x3d18ff[_0x4b2b('0x9')]][_0x4b2b('0x2e')],_0x3d18ff[_0x4b2b('0x31')]));channels[_0x3d18ff['uniqueid']][_0x4b2b('0x32')]=utils[_0x4b2b('0x20')]();channels[_0x3d18ff[_0x4b2b('0x9')]][_0x4b2b('0x33')]=utils['diffTime'](channels[_0x3d18ff[_0x4b2b('0x9')]][_0x4b2b('0x32')],channels[_0x3d18ff[_0x4b2b('0x9')]]['starttime']);channels[_0x3d18ff['uniqueid']]['billableseconds']=channels[_0x3d18ff[_0x4b2b('0x9')]][_0x4b2b('0x29')]?utils[_0x4b2b('0x34')](channels[_0x3d18ff['uniqueid']][_0x4b2b('0x32')],channels[_0x3d18ff['uniqueid']][_0x4b2b('0x29')]):0x0;writeDB(channels[_0x3d18ff[_0x4b2b('0x9')]]);}}catch(_0x59ade0){utils['error'](util['format'](_0x4b2b('0x2d'),_0x3d18ff[_0x4b2b('0x9')]),_0x59ade0);}};exports[_0x4b2b('0x35')]=function(_0x475b65){try{if(!_[_0x4b2b('0x25')](channels[_0x475b65[_0x4b2b('0x36')]])){utils[_0x4b2b('0x37')](util['format'](_0x4b2b('0x38'),_0x475b65[_0x4b2b('0x39')]),_0x475b65);if(channels[_0x475b65[_0x4b2b('0x36')]][_0x4b2b('0xe')]==_0x475b65['transfereechannel']){utils[_0x4b2b('0xb')](util['format'](_0x4b2b('0x3a'),_0x475b65[_0x4b2b('0x39')],_0x475b65['localtwolinkedid'],_0x475b65[_0x4b2b('0x3b')]));channels[_0x475b65[_0x4b2b('0x36')]]['destinationchannel']=_0x475b65[_0x4b2b('0x3b')];channels[_0x475b65[_0x4b2b('0x36')]][_0x4b2b('0x3c')]=_0x4b2b('0x3d');}else if(channels[_0x475b65[_0x4b2b('0x36')]][_0x4b2b('0xe')]=_0x475b65['transfertargetchannel']){utils[_0x4b2b('0xb')](util['format'](_0x4b2b('0x3a'),_0x475b65['origtransfereruniqueid'],_0x475b65[_0x4b2b('0x36')],_0x475b65[_0x4b2b('0x3e')]));channels[_0x475b65[_0x4b2b('0x36')]]['destinationchannel']=_0x475b65[_0x4b2b('0x3e')];channels[_0x475b65['localtwolinkedid']][_0x4b2b('0x3c')]=_0x4b2b('0x3d');}}}catch(_0x3d8540){utils['error'](util[_0x4b2b('0xc')](_0x4b2b('0x38'),_0x475b65['origtransfereruniqueid']),_0x3d8540);}};exports[_0x4b2b('0x3f')]=function(_0x19cf3a){try{if(!_[_0x4b2b('0x25')](channels[_0x19cf3a[_0x4b2b('0x9')]])){utils[_0x4b2b('0x37')](util['format'](_0x4b2b('0x40'),_0x19cf3a[_0x4b2b('0x9')]),_0x19cf3a);channels[_0x19cf3a[_0x4b2b('0x9')]][_0x4b2b('0x41')]=utils[_0x4b2b('0x20')]();utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')](_0x4b2b('0x42'),_0x19cf3a[_0x4b2b('0x9')],channels[_0x19cf3a['uniqueid']][_0x4b2b('0x41')]));}}catch(_0x5bbf33){utils[_0x4b2b('0x21')](util[_0x4b2b('0xc')](_0x4b2b('0x40'),_0x19cf3a['uniqueid']),_0x5bbf33);}};exports[_0x4b2b('0x43')]=function(_0xde77e){try{if(!_['isNil'](channels[_0xde77e['uniqueid']])){utils[_0x4b2b('0x37')](util[_0x4b2b('0xc')](_0x4b2b('0x44'),_0xde77e['uniqueid']),_0xde77e);if(!_[_0x4b2b('0x25')](channels[_0xde77e[_0x4b2b('0x9')]][_0x4b2b('0x41')])){channels[_0xde77e[_0x4b2b('0x9')]]['mohtime']+=utils[_0x4b2b('0x34')](utils['now'](),channels[_0xde77e[_0x4b2b('0x9')]][_0x4b2b('0x41')]);utils['info'](util[_0x4b2b('0xc')](_0x4b2b('0x45'),_0xde77e[_0x4b2b('0x9')],channels[_0xde77e[_0x4b2b('0x9')]][_0x4b2b('0x46')]));delete channels[_0xde77e[_0x4b2b('0x9')]][_0x4b2b('0x41')];}}}catch(_0x12a653){utils[_0x4b2b('0x21')](util['format'](_0x4b2b('0x44'),_0xde77e['uniqueid']),_0x12a653);}};exports['varset']=function(_0x361346){try{if(!_[_0x4b2b('0x25')](channels[_0x361346[_0x4b2b('0x9')]])){utils[_0x4b2b('0x37')](util['format'](_0x4b2b('0x47'),_0x361346[_0x4b2b('0x9')]),_0x361346);if(!_['isNil'](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x49')])){utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')](_0x4b2b('0x4a'),_0x361346['uniqueid'],_0x361346[_0x4b2b('0x4b')]));channels[_0x361346[_0x4b2b('0x9')]]['source']=_0x361346[_0x4b2b('0x4b')];}if(!_[_0x4b2b('0x25')](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x4c')])){utils['info'](util[_0x4b2b('0xc')](_0x4b2b('0x4d'),_0x361346['uniqueid'],_0x361346[_0x4b2b('0x4b')]));channels[_0x361346[_0x4b2b('0x9')]][_0x4b2b('0x4e')]=_0x361346[_0x4b2b('0x4b')];channels[_0x361346['uniqueid']][_0x4b2b('0x2e')]='\x22'+_0x361346[_0x4b2b('0x4b')]+'\x22\x20<'+_0x361346[_0x4b2b('0x4b')]+'>';}if(!_[_0x4b2b('0x25')](_0x361346['variable'][_0x4b2b('0x4f')])||!_[_0x4b2b('0x25')](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x50')])){utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')](_0x4b2b('0x51'),_0x361346[_0x4b2b('0x9')],!_['isNil'](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x4f')])?_0x4b2b('0x4f'):_0x4b2b('0x50'),_0x361346[_0x4b2b('0x4b')]));channels[_0x361346[_0x4b2b('0x9')]][_0x4b2b('0x2e')]=_0x361346['value'];}if(!_[_0x4b2b('0x25')](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x52')])||!_[_0x4b2b('0x25')](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x53')])){utils['info'](util[_0x4b2b('0xc')]('[%s][calls][varset]\x20variable:%s\x20value:%s',_0x361346['uniqueid'],!_['isNil'](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x52')])?_0x4b2b('0x52'):_0x4b2b('0x53'),_0x361346['value']));channels[_0x361346[_0x4b2b('0x9')]][_0x4b2b('0x54')]=_0x4b2b('0x55');channels[_0x361346[_0x4b2b('0x9')]]['lastdata']=_0x361346[_0x4b2b('0x4b')];channels[_0x361346[_0x4b2b('0x9')]][_0x4b2b('0xf')]=!![];}if(!_[_0x4b2b('0x25')](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x56')])){utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')]('[%s][calls][varset]\x20variable:xmd-contactid\x20value:%s',_0x361346[_0x4b2b('0x9')],_0x361346['value']));channels[_0x361346['uniqueid']][_0x4b2b('0x57')]=_0x361346[_0x4b2b('0x4b')];}if(!_[_0x4b2b('0x25')](_0x361346[_0x4b2b('0x48')]['xmd-cdrtype'])){utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')](_0x4b2b('0x58'),_0x361346[_0x4b2b('0x9')],_0x361346['value']));channels[_0x361346[_0x4b2b('0x9')]][_0x4b2b('0x59')]=_0x361346[_0x4b2b('0x4b')];}if(!_[_0x4b2b('0x25')](_0x361346['variable'][_0x4b2b('0x5a')])){utils['info'](util[_0x4b2b('0xc')](_0x4b2b('0x5b'),_0x361346[_0x4b2b('0x9')],_0x361346['value']));channels[_0x361346[_0x4b2b('0x9')]][_0x4b2b('0x5c')]=_0x361346[_0x4b2b('0x4b')];}if(!_[_0x4b2b('0x25')](_0x361346[_0x4b2b('0x48')][_0x4b2b('0x5d')])){utils[_0x4b2b('0xb')](util[_0x4b2b('0xc')](_0x4b2b('0x5e'),_0x361346['uniqueid'],_0x361346[_0x4b2b('0x4b')]));channels[_0x361346[_0x4b2b('0x9')]][_0x4b2b('0x5d')]=_0x361346[_0x4b2b('0x4b')];}}}catch(_0x3f6fd3){utils[_0x4b2b('0x21')](util[_0x4b2b('0xc')](_0x4b2b('0x47'),_0x361346[_0x4b2b('0x9')]),_0x3f6fd3);}};exports[_0x4b2b('0x5f')]=function(_0x2e3ae3){try{if(!_['isNil'](channels[_0x2e3ae3[_0x4b2b('0x9')]])){utils[_0x4b2b('0x37')](util[_0x4b2b('0xc')](_0x4b2b('0x60'),_0x2e3ae3[_0x4b2b('0x9')]),_0x2e3ae3);utils['info'](util[_0x4b2b('0xc')](_0x4b2b('0x61'),_0x2e3ae3[_0x4b2b('0x9')],_0x2e3ae3[_0x4b2b('0x62')],_0x2e3ae3[_0x4b2b('0x63')]));if(_0x2e3ae3['application'][_0x4b2b('0x64')]()==_0x4b2b('0x65')&&_[_0x4b2b('0x66')](_0x2e3ae3[_0x4b2b('0x63')][_0x4b2b('0x64')](),_0x4b2b('0x67'))){var _0x36ec99=_0x2e3ae3[_0x4b2b('0x63')][_0x4b2b('0x68')]('=');var _0x2c5f41=_0x36ec99[0x0]['substring'](_0x36ec99[0x0]['lastIndexOf']('(')+0x1,_0x36ec99[0x0][_0x4b2b('0x69')](')'));var _0x5d4a94=_0x36ec99[0x1];channels[_0x2e3ae3[_0x4b2b('0x9')]][_0x2c5f41]=_0x5d4a94;}if(!_[_0x4b2b('0x6a')](['hangup',_0x4b2b('0x6b'),_0x4b2b('0x6c'),_0x4b2b('0x65'),_0x4b2b('0x6d')],_0x2e3ae3[_0x4b2b('0x62')][_0x4b2b('0x64')]())){channels[_0x2e3ae3[_0x4b2b('0x9')]][_0x4b2b('0x54')]=_0x2e3ae3[_0x4b2b('0x62')];channels[_0x2e3ae3[_0x4b2b('0x9')]]['lastdata']=_0x2e3ae3[_0x4b2b('0x63')];}}}catch(_0x19538e){utils['error'](util[_0x4b2b('0xc')]('[%s][calls][newexten]',_0x2e3ae3[_0x4b2b('0x9')]),_0x19538e);}}; \ No newline at end of file diff --git a/server/services/xdr/core.controller.js b/server/services/xdr/core.controller.js index 768b7b5..ec8efd1 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 _0xdada=['info','shutdown','[core]\x20shutdown','fullybooted','[core]\x20fullybooted','[core]\x20error','close','managerevent','./utils','connect'];(function(_0x1223d8,_0x48a9bd){var _0x47921a=function(_0x49e43f){while(--_0x49e43f){_0x1223d8['push'](_0x1223d8['shift']());}};_0x47921a(++_0x48a9bd);}(_0xdada,0x1a2));var _0xadad=function(_0x7aaba4,_0x228ac4){_0x7aaba4=_0x7aaba4-0x0;var _0xb08175=_0xdada[_0x7aaba4];return _0xb08175;};'use strict';var utils=require(_0xadad('0x0'));exports[_0xadad('0x1')]=function(){utils[_0xadad('0x2')]('[core]\x20connected');};exports[_0xadad('0x3')]=function(){utils[_0xadad('0x2')](_0xadad('0x4'));};exports[_0xadad('0x5')]=function(){utils['info'](_0xadad('0x6'));};exports['error']=function(_0x1f5562){utils['error'](_0xadad('0x7'),_0x1f5562);};exports[_0xadad('0x8')]=function(){utils[_0xadad('0x2')]('[core]\x20close');};exports[_0xadad('0x9')]=function(_0x5a8435){}; \ No newline at end of file +var _0xee51=['[core]\x20close','./utils','info','[core]\x20connected','fullybooted','[core]\x20fullybooted','error','[core]\x20error','close'];(function(_0x5659e0,_0x2f8d77){var _0x882ed2=function(_0xd7d09){while(--_0xd7d09){_0x5659e0['push'](_0x5659e0['shift']());}};_0x882ed2(++_0x2f8d77);}(_0xee51,0x17b));var _0x1ee5=function(_0xd4ffa9,_0x219194){_0xd4ffa9=_0xd4ffa9-0x0;var _0x195582=_0xee51[_0xd4ffa9];return _0x195582;};'use strict';var utils=require(_0x1ee5('0x0'));exports['connect']=function(){utils[_0x1ee5('0x1')](_0x1ee5('0x2'));};exports['shutdown']=function(){utils[_0x1ee5('0x1')]('[core]\x20shutdown');};exports[_0x1ee5('0x3')]=function(){utils['info'](_0x1ee5('0x4'));};exports[_0x1ee5('0x5')]=function(_0x31c41d){utils[_0x1ee5('0x5')](_0x1ee5('0x6'),_0x31c41d);};exports[_0x1ee5('0x7')]=function(){utils['info'](_0x1ee5('0x8'));};exports['managerevent']=function(_0x377940){}; \ No newline at end of file diff --git a/server/services/xdr/dials.controller.js b/server/services/xdr/dials.controller.js index 30c0856..25b7671 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 _0xad67=['debug','[%s][dials][newexten]','application','toLowerCase','startsWith','cdr(routeid)','appdata','split','error','varset','[%s][dials][varset]','isNil','outboundrouteid','value','dialbegin','[%s][dials][dialbegin]','assign','starttime','lastevent','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','[%s][dials][dialend]','ANSWER','answertime','now','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]\x20dialstatus:%s','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridnum','calleridname','complete','diffTime','endtime','billableseconds','util','./utils','info','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','connectedlinenum','dialstatus'];(function(_0x565d5f,_0x2bf262){var _0x3a3b58=function(_0x3c783f){while(--_0x3c783f){_0x565d5f['push'](_0x565d5f['shift']());}};_0x3a3b58(++_0x2bf262);}(_0xad67,0x1e5));var _0x7ad6=function(_0x4dac30,_0x3b1e61){_0x4dac30=_0x4dac30-0x0;var _0x4ae741=_0xad67[_0x4dac30];return _0x4ae741;};'use strict';var _=require('lodash');var util=require(_0x7ad6('0x0'));var utils=require(_0x7ad6('0x1'));var dials={};function writeDB(_0x1261aa){utils[_0x7ad6('0x2')](util[_0x7ad6('0x3')](_0x7ad6('0x4'),_0x1261aa[_0x7ad6('0x5')],_0x1261aa[_0x7ad6('0x6')],_0x1261aa[_0x7ad6('0x7')],_0x1261aa['calleridnum'],_0x1261aa[_0x7ad6('0x8')],_0x1261aa[_0x7ad6('0x9')]));utils['request']('CreateVoiceDialReport',_0x1261aa);delete dials[_0x1261aa[_0x7ad6('0x5')]];}exports['newexten']=function(_0x3459d4){try{utils[_0x7ad6('0xa')](util[_0x7ad6('0x3')](_0x7ad6('0xb'),_0x3459d4[_0x7ad6('0x5')]),_0x3459d4);utils[_0x7ad6('0x2')](util[_0x7ad6('0x3')]('[%s][dials][newexten]\x20application:%s\x20appdata:%s',_0x3459d4[_0x7ad6('0x5')],_0x3459d4['application'],_0x3459d4['appdata']));if(_0x3459d4[_0x7ad6('0xc')][_0x7ad6('0xd')]()=='set'&&_[_0x7ad6('0xe')](_0x3459d4['appdata'][_0x7ad6('0xd')](),_0x7ad6('0xf'))){var _0x18819c=_0x3459d4[_0x7ad6('0x10')][_0x7ad6('0x11')]('=');dials[_0x3459d4['uniqueid']]={'routeId':_0x18819c[0x1]};}}catch(_0x18d3b8){utils[_0x7ad6('0x12')](util[_0x7ad6('0x3')](_0x7ad6('0xb'),_0x3459d4[_0x7ad6('0x5')]),_0x18d3b8);}};exports[_0x7ad6('0x13')]=function(_0x5ea3c8){try{utils[_0x7ad6('0xa')](util[_0x7ad6('0x3')](_0x7ad6('0x14'),_0x5ea3c8['uniqueid']),_0x5ea3c8);if(!_[_0x7ad6('0x15')](_0x5ea3c8['variable'][_0x7ad6('0x16')])){utils[_0x7ad6('0x2')](util[_0x7ad6('0x3')]('[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s',_0x5ea3c8[_0x7ad6('0x5')],_0x5ea3c8[_0x7ad6('0x17')]));dials[_0x5ea3c8[_0x7ad6('0x5')]]={'routeId':_0x5ea3c8[_0x7ad6('0x17')]};}}catch(_0x1a870d){utils[_0x7ad6('0x12')](util[_0x7ad6('0x3')](_0x7ad6('0x14'),_0x5ea3c8[_0x7ad6('0x5')]),_0x1a870d);}};exports[_0x7ad6('0x18')]=function(_0x23063a){try{if(!_[_0x7ad6('0x15')](dials[_0x23063a[_0x7ad6('0x5')]])){utils[_0x7ad6('0xa')](util[_0x7ad6('0x3')](_0x7ad6('0x19'),_0x23063a['uniqueid']),_0x23063a);dials[_0x23063a[_0x7ad6('0x5')]]=_[_0x7ad6('0x1a')](dials[_0x23063a['uniqueid']],_0x23063a);dials[_0x23063a['uniqueid']][_0x7ad6('0x1b')]=utils['now']();dials[_0x23063a[_0x7ad6('0x5')]][_0x7ad6('0x1c')]='called';utils[_0x7ad6('0x2')](util['format'](_0x7ad6('0x1d'),_0x23063a[_0x7ad6('0x5')],dials[_0x23063a[_0x7ad6('0x5')]][_0x7ad6('0x1b')]));}}catch(_0x2a34bb){utils['error'](util['format'](_0x7ad6('0x19'),_0x23063a[_0x7ad6('0x5')]),_0x2a34bb);}};exports['dialend']=function(_0x3028a8){try{if(!_['isNil'](dials[_0x3028a8[_0x7ad6('0x5')]])){utils['debug'](util[_0x7ad6('0x3')](_0x7ad6('0x1e'),_0x3028a8[_0x7ad6('0x5')]),_0x3028a8);dials[_0x3028a8[_0x7ad6('0x5')]]['dialstatus']=_0x3028a8['dialstatus'];if(_0x3028a8[_0x7ad6('0x9')]==_0x7ad6('0x1f')){dials[_0x3028a8[_0x7ad6('0x5')]]=_['assign'](dials[_0x3028a8[_0x7ad6('0x5')]],_0x3028a8);dials[_0x3028a8[_0x7ad6('0x5')]][_0x7ad6('0x20')]=utils[_0x7ad6('0x21')]();dials[_0x3028a8['uniqueid']][_0x7ad6('0x1c')]=_0x7ad6('0x22');utils[_0x7ad6('0x2')](util[_0x7ad6('0x3')](_0x7ad6('0x23'),_0x3028a8[_0x7ad6('0x5')],_0x3028a8['dialstatus'],dials[_0x3028a8[_0x7ad6('0x5')]][_0x7ad6('0x20')]));}else{utils[_0x7ad6('0x2')](util[_0x7ad6('0x3')](_0x7ad6('0x24'),_0x3028a8[_0x7ad6('0x5')],_0x3028a8[_0x7ad6('0x9')]));}}}catch(_0x47763d){utils[_0x7ad6('0x12')](util[_0x7ad6('0x3')](_0x7ad6('0x1e'),_0x3028a8[_0x7ad6('0x5')]),_0x47763d);}};exports['hangup']=function(_0x4d48e7){try{if(!_[_0x7ad6('0x15')](dials[_0x4d48e7[_0x7ad6('0x5')]])){utils[_0x7ad6('0xa')](util[_0x7ad6('0x3')](_0x7ad6('0x25'),_0x4d48e7[_0x7ad6('0x5')]),_0x4d48e7);utils[_0x7ad6('0x2')](util['format'](_0x7ad6('0x26'),_0x4d48e7['uniqueid'],_0x4d48e7[_0x7ad6('0x27')],_0x4d48e7[_0x7ad6('0x28')],_0x4d48e7['cause-txt']));dials[_0x4d48e7[_0x7ad6('0x5')]]=_[_0x7ad6('0x1a')](dials[_0x4d48e7[_0x7ad6('0x5')]],{'endtime':utils[_0x7ad6('0x21')](),'lastevent':_0x7ad6('0x29')});dials[_0x4d48e7[_0x7ad6('0x5')]]['duration']=utils[_0x7ad6('0x2a')](dials[_0x4d48e7[_0x7ad6('0x5')]][_0x7ad6('0x2b')],dials[_0x4d48e7[_0x7ad6('0x5')]][_0x7ad6('0x1b')]);dials[_0x4d48e7[_0x7ad6('0x5')]]['holdtime']=utils[_0x7ad6('0x2a')](dials[_0x4d48e7[_0x7ad6('0x5')]][_0x7ad6('0x20')]||dials[_0x4d48e7[_0x7ad6('0x5')]][_0x7ad6('0x2b')],dials[_0x4d48e7['uniqueid']][_0x7ad6('0x1b')]);dials[_0x4d48e7[_0x7ad6('0x5')]][_0x7ad6('0x2c')]=dials[_0x4d48e7[_0x7ad6('0x5')]][_0x7ad6('0x20')]?utils[_0x7ad6('0x2a')](dials[_0x4d48e7['uniqueid']][_0x7ad6('0x2b')],dials[_0x4d48e7[_0x7ad6('0x5')]][_0x7ad6('0x20')]):0x0;writeDB(dials[_0x4d48e7[_0x7ad6('0x5')]]);}}catch(_0x5e0ed4){utils[_0x7ad6('0x12')](util[_0x7ad6('0x3')](_0x7ad6('0x25'),_0x4d48e7['uniqueid']),_0x5e0ed4);}}; \ No newline at end of file +var _0x8826=['ANSWER','connect','[%s][dials][dialend]\x20dialstatus:%s\x20answertime:%s\x20lastevent:connect','[%s][dials][dialend]','hangup','[%s][dials][hangup]','[%s][dials][hangup]\x20calleridnum:%s\x20calleridname:%s\x20lastevent:complete\x20reason:%s','calleridname','complete','diffTime','holdtime','answertime','endtime','billableseconds','lodash','./utils','format','[%s][dials][writeDB]\x20channel:%s\x20dialstring:%s\x20calleridnum:%s\x20connectedlinenum:%s\x20dialstatus:%s','uniqueid','channel','dialstring','calleridnum','connectedlinenum','dialstatus','request','newexten','debug','info','[%s][dials][newexten]\x20application:%s\x20appdata:%s','application','appdata','toLowerCase','startsWith','split','[%s][dials][newexten]','varset','[%s][dials][varset]','isNil','variable','outboundrouteid','[%s][dials][varset]\x20variable:outboundrouteid\x20value:%s','dialbegin','[%s][dials][dialbegin]','assign','starttime','now','lastevent','called','[%s][dials][hangup]\x20starttime:%s\x20lastevent:called','error','dialend'];(function(_0x22cc16,_0x1f4fa2){var _0x399b70=function(_0x34d464){while(--_0x34d464){_0x22cc16['push'](_0x22cc16['shift']());}};_0x399b70(++_0x1f4fa2);}(_0x8826,0x74));var _0x6882=function(_0x2890d0,_0x5541cd){_0x2890d0=_0x2890d0-0x0;var _0x2a4079=_0x8826[_0x2890d0];return _0x2a4079;};'use strict';var _=require(_0x6882('0x0'));var util=require('util');var utils=require(_0x6882('0x1'));var dials={};function writeDB(_0x30a20e){utils['info'](util[_0x6882('0x2')](_0x6882('0x3'),_0x30a20e[_0x6882('0x4')],_0x30a20e[_0x6882('0x5')],_0x30a20e[_0x6882('0x6')],_0x30a20e[_0x6882('0x7')],_0x30a20e[_0x6882('0x8')],_0x30a20e[_0x6882('0x9')]));utils[_0x6882('0xa')]('CreateVoiceDialReport',_0x30a20e);delete dials[_0x30a20e[_0x6882('0x4')]];}exports[_0x6882('0xb')]=function(_0x3b6a6f){try{utils[_0x6882('0xc')](util[_0x6882('0x2')]('[%s][dials][newexten]',_0x3b6a6f[_0x6882('0x4')]),_0x3b6a6f);utils[_0x6882('0xd')](util[_0x6882('0x2')](_0x6882('0xe'),_0x3b6a6f['uniqueid'],_0x3b6a6f[_0x6882('0xf')],_0x3b6a6f[_0x6882('0x10')]));if(_0x3b6a6f[_0x6882('0xf')][_0x6882('0x11')]()=='set'&&_[_0x6882('0x12')](_0x3b6a6f[_0x6882('0x10')][_0x6882('0x11')](),'cdr(routeid)')){var _0x12a29f=_0x3b6a6f[_0x6882('0x10')][_0x6882('0x13')]('=');dials[_0x3b6a6f['uniqueid']]={'routeId':_0x12a29f[0x1]};}}catch(_0x2619be){utils['error'](util[_0x6882('0x2')](_0x6882('0x14'),_0x3b6a6f[_0x6882('0x4')]),_0x2619be);}};exports[_0x6882('0x15')]=function(_0x222adb){try{utils['debug'](util[_0x6882('0x2')](_0x6882('0x16'),_0x222adb[_0x6882('0x4')]),_0x222adb);if(!_[_0x6882('0x17')](_0x222adb[_0x6882('0x18')][_0x6882('0x19')])){utils[_0x6882('0xd')](util[_0x6882('0x2')](_0x6882('0x1a'),_0x222adb[_0x6882('0x4')],_0x222adb['value']));dials[_0x222adb[_0x6882('0x4')]]={'routeId':_0x222adb['value']};}}catch(_0xfac24f){utils['error'](util[_0x6882('0x2')](_0x6882('0x16'),_0x222adb['uniqueid']),_0xfac24f);}};exports[_0x6882('0x1b')]=function(_0x319115){try{if(!_['isNil'](dials[_0x319115['uniqueid']])){utils[_0x6882('0xc')](util[_0x6882('0x2')](_0x6882('0x1c'),_0x319115['uniqueid']),_0x319115);dials[_0x319115[_0x6882('0x4')]]=_[_0x6882('0x1d')](dials[_0x319115['uniqueid']],_0x319115);dials[_0x319115[_0x6882('0x4')]][_0x6882('0x1e')]=utils[_0x6882('0x1f')]();dials[_0x319115['uniqueid']][_0x6882('0x20')]=_0x6882('0x21');utils[_0x6882('0xd')](util['format'](_0x6882('0x22'),_0x319115[_0x6882('0x4')],dials[_0x319115['uniqueid']][_0x6882('0x1e')]));}}catch(_0x12ce3c){utils[_0x6882('0x23')](util[_0x6882('0x2')](_0x6882('0x1c'),_0x319115[_0x6882('0x4')]),_0x12ce3c);}};exports[_0x6882('0x24')]=function(_0x3938a1){try{if(!_[_0x6882('0x17')](dials[_0x3938a1[_0x6882('0x4')]])){utils['debug'](util[_0x6882('0x2')]('[%s][dials][dialend]',_0x3938a1[_0x6882('0x4')]),_0x3938a1);dials[_0x3938a1[_0x6882('0x4')]][_0x6882('0x9')]=_0x3938a1[_0x6882('0x9')];if(_0x3938a1['dialstatus']==_0x6882('0x25')){dials[_0x3938a1[_0x6882('0x4')]]=_['assign'](dials[_0x3938a1[_0x6882('0x4')]],_0x3938a1);dials[_0x3938a1[_0x6882('0x4')]]['answertime']=utils[_0x6882('0x1f')]();dials[_0x3938a1[_0x6882('0x4')]][_0x6882('0x20')]=_0x6882('0x26');utils[_0x6882('0xd')](util[_0x6882('0x2')](_0x6882('0x27'),_0x3938a1[_0x6882('0x4')],_0x3938a1[_0x6882('0x9')],dials[_0x3938a1[_0x6882('0x4')]]['answertime']));}else{utils[_0x6882('0xd')](util[_0x6882('0x2')]('[%s][dials][dialend]\x20dialstatus:%s',_0x3938a1[_0x6882('0x4')],_0x3938a1['dialstatus']));}}}catch(_0x349966){utils['error'](util[_0x6882('0x2')](_0x6882('0x28'),_0x3938a1[_0x6882('0x4')]),_0x349966);}};exports[_0x6882('0x29')]=function(_0xbec943){try{if(!_['isNil'](dials[_0xbec943['uniqueid']])){utils[_0x6882('0xc')](util[_0x6882('0x2')](_0x6882('0x2a'),_0xbec943[_0x6882('0x4')]),_0xbec943);utils['info'](util[_0x6882('0x2')](_0x6882('0x2b'),_0xbec943[_0x6882('0x4')],_0xbec943['calleridnum'],_0xbec943[_0x6882('0x2c')],_0xbec943['cause-txt']));dials[_0xbec943[_0x6882('0x4')]]=_[_0x6882('0x1d')](dials[_0xbec943['uniqueid']],{'endtime':utils['now'](),'lastevent':_0x6882('0x2d')});dials[_0xbec943[_0x6882('0x4')]]['duration']=utils[_0x6882('0x2e')](dials[_0xbec943[_0x6882('0x4')]]['endtime'],dials[_0xbec943[_0x6882('0x4')]]['starttime']);dials[_0xbec943[_0x6882('0x4')]][_0x6882('0x2f')]=utils[_0x6882('0x2e')](dials[_0xbec943[_0x6882('0x4')]][_0x6882('0x30')]||dials[_0xbec943[_0x6882('0x4')]][_0x6882('0x31')],dials[_0xbec943['uniqueid']][_0x6882('0x1e')]);dials[_0xbec943[_0x6882('0x4')]][_0x6882('0x32')]=dials[_0xbec943[_0x6882('0x4')]]['answertime']?utils[_0x6882('0x2e')](dials[_0xbec943[_0x6882('0x4')]][_0x6882('0x31')],dials[_0xbec943['uniqueid']][_0x6882('0x30')]):0x0;writeDB(dials[_0xbec943['uniqueid']]);}}catch(_0x13020b){utils[_0x6882('0x23')](util[_0x6882('0x2')](_0x6882('0x2a'),_0xbec943[_0x6882('0x4')]),_0x13020b);}}; \ No newline at end of file diff --git a/server/services/xdr/index.js b/server/services/xdr/index.js index ed30fcf..05e84a8 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 _0x48b7=['fullybooted','error','close','managerevent','devicestatechange','debug','format','[%s][index][devicestatechange]','device','[%s][index][agentcalled]','agentringnoanswer','[%s][index][agentringnoanswer]','uniqueid','agentconnect','[%s][index][agentconnect]','[%s][index][agentcomplete]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','musiconholdstart','[%s][index][musiconholdstart]','musiconholdstop','[%s][index][musiconholdstop]','[%s][index][newstate]','newstate','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','[%s][index][blindtransfer]','blindtransfer','attendedtransfer','[%s][index][attendedtransfer]','origtransfereruniqueid','varset','[%s][index][varset]','[%s][index][newexten]','newexten','newchannel','[%s][index][newchannel]','dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','util','xdr','disabled','production','port','asterisk','username','password','info','./agents.controller','./dials.controller','./transfers.controller','./core.controller','connect','shutdown'];(function(_0x20a584,_0xe384a5){var _0x4b41a8=function(_0x2127c6){while(--_0x2127c6){_0x20a584['push'](_0x20a584['shift']());}};_0x4b41a8(++_0xe384a5);}(_0x48b7,0xb1));var _0x748b=function(_0x2bda2b,_0xc5bb5d){_0x2bda2b=_0x2bda2b-0x0;var _0x50dbb2=_0x48b7[_0x2bda2b];return _0x50dbb2;};var AsteriskManager=require(_0x748b('0x0'));var config=require(_0x748b('0x1'));var utils=require(_0x748b('0x2'));var util=require(_0x748b('0x3'));var isXDREnabled=config['xdr']&&config[_0x748b('0x4')]['disabled']?!config[_0x748b('0x4')][_0x748b('0x5')]:!![];var isProduction=config['env']===_0x748b('0x6')||![];var isLocalAsterisk=config[_0x748b('0x4')]&&config[_0x748b('0x4')]['local']===!![]||![];var ami=new AsteriskManager(config['asterisk'][_0x748b('0x7')],config['asterisk']['ip'],config[_0x748b('0x8')][_0x748b('0x9')],config[_0x748b('0x8')][_0x748b('0xa')],!![]);ami['keepConnected']();if(!isXDREnabled){utils[_0x748b('0xb')]('XDR\x20DISABLED');}else if(!isProduction&&!isLocalAsterisk){utils[_0x748b('0xb')]('Asterisk\x20disabled\x20on\x20localhost');}else{var agents=require(_0x748b('0xc'));var calls=require('./calls.controller');var queues=require('./queues.controller');var recordings=require('./recordings.controller');var members=require('./members.controller');var dials=require(_0x748b('0xd'));var transfers=require(_0x748b('0xe'));var core=require(_0x748b('0xf'));ami['on']('connect',core[_0x748b('0x10')]);ami['on'](_0x748b('0x11'),core['shutdown']);ami['on']('fullybooted',core[_0x748b('0x12')]);ami['on']('error',core[_0x748b('0x13')]);ami['on'](_0x748b('0x14'),core[_0x748b('0x14')]);ami['on'](_0x748b('0x15'),core[_0x748b('0x15')]);ami['on'](_0x748b('0x16'),function(_0x8cdbf2){try{utils[_0x748b('0x17')](util[_0x748b('0x18')](_0x748b('0x19'),_0x8cdbf2[_0x748b('0x1a')]),_0x8cdbf2);members[_0x748b('0x16')](_0x8cdbf2);}catch(_0x389a2a){utils['error'](util[_0x748b('0x18')](_0x748b('0x19'),_0x8cdbf2[_0x748b('0x1a')]),_0x389a2a);}});ami['on']('agentcalled',function(_0x648128){try{utils[_0x748b('0x17')](util[_0x748b('0x18')](_0x748b('0x1b'),_0x648128['uniqueid']),_0x648128);agents['agentcalled'](_0x648128);}catch(_0x2cff9e){utils[_0x748b('0x13')](util[_0x748b('0x18')](_0x748b('0x1b'),_0x648128['uniqueid']),_0x2cff9e);}});ami['on'](_0x748b('0x1c'),function(_0x10cd24){try{utils[_0x748b('0x17')](util[_0x748b('0x18')](_0x748b('0x1d'),_0x10cd24[_0x748b('0x1e')]),_0x10cd24);agents['agentringnoanswer'](_0x10cd24);}catch(_0x1b54e7){utils[_0x748b('0x13')](util[_0x748b('0x18')](_0x748b('0x1d'),_0x10cd24[_0x748b('0x1e')]),_0x1b54e7);}});ami['on'](_0x748b('0x1f'),function(_0x2262ef){try{utils[_0x748b('0x17')](util[_0x748b('0x18')]('[%s][index][agentconnect]',_0x2262ef[_0x748b('0x1e')]),_0x2262ef);agents[_0x748b('0x1f')](_0x2262ef);queues[_0x748b('0x1f')](_0x2262ef);}catch(_0x4be33c){utils[_0x748b('0x13')](util[_0x748b('0x18')](_0x748b('0x20'),_0x2262ef[_0x748b('0x1e')]),_0x4be33c);}});ami['on']('agentcomplete',function(_0x2bb3f6){try{utils[_0x748b('0x17')](util[_0x748b('0x18')](_0x748b('0x21'),_0x2bb3f6[_0x748b('0x1e')]),_0x2bb3f6);agents[_0x748b('0x22')](_0x2bb3f6);queues[_0x748b('0x22')](_0x2bb3f6);members[_0x748b('0x22')](_0x2bb3f6);}catch(_0x5b07d0){utils['error'](util[_0x748b('0x18')](_0x748b('0x21'),_0x2bb3f6['uniqueid']),_0x5b07d0);}});ami['on'](_0x748b('0x23'),function(_0x4c22cc){try{utils[_0x748b('0x17')](util[_0x748b('0x18')](_0x748b('0x24'),_0x4c22cc['uniqueid']),_0x4c22cc);agents[_0x748b('0x23')](_0x4c22cc);queues[_0x748b('0x23')](_0x4c22cc);}catch(_0x21d972){utils[_0x748b('0x13')](util[_0x748b('0x18')](_0x748b('0x24'),_0x4c22cc['uniqueid']),_0x21d972);}});ami['on'](_0x748b('0x25'),function(_0x48fb6b){try{utils[_0x748b('0x17')](util['format']('[%s][index][queuecallerjoin]',_0x48fb6b[_0x748b('0x1e')]),_0x48fb6b);queues[_0x748b('0x25')](_0x48fb6b);recordings[_0x748b('0x25')](_0x48fb6b);}catch(_0x312d25){utils[_0x748b('0x13')](util['format'](_0x748b('0x26'),_0x48fb6b[_0x748b('0x1e')]),_0x312d25);}});ami['on'](_0x748b('0x27'),function(_0x20c3bb){try{utils[_0x748b('0x17')](util[_0x748b('0x18')](_0x748b('0x28'),_0x20c3bb[_0x748b('0x1e')]),_0x20c3bb);queues[_0x748b('0x27')](_0x20c3bb);}catch(_0xfb92ad){utils[_0x748b('0x13')](util[_0x748b('0x18')](_0x748b('0x28'),_0x20c3bb[_0x748b('0x1e')]),_0xfb92ad);}});ami['on'](_0x748b('0x29'),function(_0x2031be){try{utils['debug'](util[_0x748b('0x18')](_0x748b('0x2a'),_0x2031be['uniqueid']),_0x2031be);queues[_0x748b('0x29')](_0x2031be);calls[_0x748b('0x29')](_0x2031be);}catch(_0x5cbf28){utils['error'](util[_0x748b('0x18')](_0x748b('0x2a'),_0x2031be['uniqueid']),_0x5cbf28);}});ami['on'](_0x748b('0x2b'),function(_0x1e4502){try{utils[_0x748b('0x17')](util[_0x748b('0x18')]('[%s][index][musiconholdstop]',_0x1e4502['uniqueid']),_0x1e4502);queues[_0x748b('0x2b')](_0x1e4502);calls[_0x748b('0x2b')](_0x1e4502);}catch(_0x301625){utils['error'](util['format'](_0x748b('0x2c'),_0x1e4502['uniqueid']),_0x301625);}});ami['on']('newstate',function(_0x35497d){try{utils[_0x748b('0x17')](util['format'](_0x748b('0x2d'),_0x35497d[_0x748b('0x1e')]),_0x35497d);calls[_0x748b('0x2e')](_0x35497d);recordings[_0x748b('0x2e')](_0x35497d);}catch(_0x25e682){utils[_0x748b('0x13')](util[_0x748b('0x18')]('[%s][index][newstate]',_0x35497d[_0x748b('0x1e')]),_0x25e682);}});ami['on']('hangup',function(_0x49fa0e){try{utils[_0x748b('0x17')](util['format'](_0x748b('0x2f'),_0x49fa0e['uniqueid']),_0x49fa0e);calls[_0x748b('0x30')](_0x49fa0e);recordings['hangup'](_0x49fa0e);dials[_0x748b('0x30')](_0x49fa0e);agents[_0x748b('0x30')](_0x49fa0e);queues[_0x748b('0x30')](_0x49fa0e);}catch(_0x309f9e){utils[_0x748b('0x13')](util[_0x748b('0x18')]('[%s][index][hangup]',_0x49fa0e['uniqueid']),_0x309f9e);}});ami['on']('cdr',function(_0x4d5cdc){try{utils[_0x748b('0x17')](util[_0x748b('0x18')]('[%s][index][cdr]',_0x4d5cdc['uniqueid']),_0x4d5cdc);members[_0x748b('0x31')](_0x4d5cdc);}catch(_0x20ec06){utils['error'](util[_0x748b('0x18')](_0x748b('0x32'),_0x4d5cdc[_0x748b('0x1e')]),_0x20ec06);}});ami['on']('blindtransfer',function(_0x1ab0d3){try{utils['debug'](util['format'](_0x748b('0x33'),_0x1ab0d3[_0x748b('0x1e')]),_0x1ab0d3);queues['blindtransfer'](_0x1ab0d3);agents[_0x748b('0x34')](_0x1ab0d3);transfers[_0x748b('0x34')](_0x1ab0d3);recordings[_0x748b('0x34')](_0x1ab0d3);}catch(_0x4623a4){utils[_0x748b('0x13')](util[_0x748b('0x18')](_0x748b('0x33'),_0x1ab0d3[_0x748b('0x1e')]),_0x4623a4);}});ami['on'](_0x748b('0x35'),function(_0x29ceda){try{utils[_0x748b('0x17')](util[_0x748b('0x18')](_0x748b('0x36'),_0x29ceda[_0x748b('0x37')]),_0x29ceda);queues[_0x748b('0x35')](_0x29ceda);transfers[_0x748b('0x35')](_0x29ceda);agents[_0x748b('0x35')](_0x29ceda);calls[_0x748b('0x35')](_0x29ceda);}catch(_0x1722c4){utils[_0x748b('0x13')](util[_0x748b('0x18')](_0x748b('0x36'),_0x29ceda[_0x748b('0x37')]),_0x1722c4);}});ami['on'](_0x748b('0x38'),function(_0x56f0cc){try{utils[_0x748b('0x17')](util['format']('[%s][index][varset]',_0x56f0cc[_0x748b('0x1e')]),_0x56f0cc);queues[_0x748b('0x38')](_0x56f0cc);recordings[_0x748b('0x38')](_0x56f0cc);calls[_0x748b('0x38')](_0x56f0cc);dials['varset'](_0x56f0cc);}catch(_0x4abe0f){utils[_0x748b('0x13')](util[_0x748b('0x18')](_0x748b('0x39'),_0x56f0cc[_0x748b('0x1e')]),_0x4abe0f);}});ami['on']('newexten',function(_0x5b40c9){try{utils[_0x748b('0x17')](util[_0x748b('0x18')](_0x748b('0x3a'),_0x5b40c9[_0x748b('0x1e')]),_0x5b40c9);calls[_0x748b('0x3b')](_0x5b40c9);recordings[_0x748b('0x3b')](_0x5b40c9);dials[_0x748b('0x3b')](_0x5b40c9);}catch(_0x37fb3c){utils[_0x748b('0x13')](util[_0x748b('0x18')](_0x748b('0x3a'),_0x5b40c9[_0x748b('0x1e')]),_0x37fb3c);}});ami['on'](_0x748b('0x3c'),function(_0x4bd59f){try{utils[_0x748b('0x17')](util['format'](_0x748b('0x3d'),_0x4bd59f[_0x748b('0x1e')]),_0x4bd59f);calls[_0x748b('0x3c')](_0x4bd59f);recordings[_0x748b('0x3c')](_0x4bd59f);}catch(_0x13a120){utils[_0x748b('0x13')](util[_0x748b('0x18')](_0x748b('0x3d'),_0x4bd59f[_0x748b('0x1e')]),_0x13a120);}});ami['on'](_0x748b('0x3e'),function(_0x3ec931){try{utils[_0x748b('0x17')](util[_0x748b('0x18')]('[%s][index][dialbegin]',_0x3ec931[_0x748b('0x1e')]),_0x3ec931);dials[_0x748b('0x3e')](_0x3ec931);}catch(_0x219f5a){utils[_0x748b('0x13')](util[_0x748b('0x18')]('[%s]dialbegin',_0x3ec931[_0x748b('0x1e')]),_0x219f5a);}});ami['on'](_0x748b('0x3f'),function(_0x1ee13e){try{utils[_0x748b('0x17')](util[_0x748b('0x18')](_0x748b('0x40'),_0x1ee13e['uniqueid']),_0x1ee13e);dials[_0x748b('0x3f')](_0x1ee13e);}catch(_0x2a0ea5){utils[_0x748b('0x13')](util[_0x748b('0x18')](_0x748b('0x40'),_0x1ee13e['uniqueid']),_0x2a0ea5);}});} \ No newline at end of file +var _0x643f=['varset','[%s][index][varset]','newexten','[%s][index][newexten]','newchannel','[%s][index][newchannel]','[%s][index][dialbegin]','dialbegin','dialend','[%s][index][dialend]','asterisk-manager','../../config/environment','./utils','xdr','disabled','env','production','local','asterisk','username','password','keepConnected','info','XDR\x20DISABLED','Asterisk\x20disabled\x20on\x20localhost','./calls.controller','./recordings.controller','./members.controller','./dials.controller','./transfers.controller','./core.controller','shutdown','fullybooted','error','close','managerevent','devicestatechange','debug','device','[%s][index][devicestatechange]','format','[%s][index][agentcalled]','uniqueid','[%s][index][agentringnoanswer]','agentconnect','[%s][index][agentconnect]','agentcomplete','queuecallerabandon','[%s][index][queuecallerabandon]','queuecallerjoin','[%s][index][queuecallerjoin]','queuecallerleave','[%s][index][queuecallerleave]','[%s][index][musiconholdstart]','musiconholdstart','musiconholdstop','[%s][index][musiconholdstop]','newstate','[%s][index][newstate]','[%s][index][hangup]','hangup','cdr','[%s][index][cdr]','blindtransfer','[%s][index][blindtransfer]','attendedtransfer','origtransfereruniqueid','[%s][index][attendedtransfer]'];(function(_0x34843e,_0x4c4224){var _0x598f7f=function(_0x12a44c){while(--_0x12a44c){_0x34843e['push'](_0x34843e['shift']());}};_0x598f7f(++_0x4c4224);}(_0x643f,0x11a));var _0xf643=function(_0x33c02a,_0x45a1e4){_0x33c02a=_0x33c02a-0x0;var _0xce3d6e=_0x643f[_0x33c02a];return _0xce3d6e;};var AsteriskManager=require(_0xf643('0x0'));var config=require(_0xf643('0x1'));var utils=require(_0xf643('0x2'));var util=require('util');var isXDREnabled=config[_0xf643('0x3')]&&config[_0xf643('0x3')][_0xf643('0x4')]?!config[_0xf643('0x3')]['disabled']:!![];var isProduction=config[_0xf643('0x5')]===_0xf643('0x6')||![];var isLocalAsterisk=config[_0xf643('0x3')]&&config[_0xf643('0x3')][_0xf643('0x7')]===!![]||![];var ami=new AsteriskManager(config[_0xf643('0x8')]['port'],config['asterisk']['ip'],config['asterisk'][_0xf643('0x9')],config['asterisk'][_0xf643('0xa')],!![]);ami[_0xf643('0xb')]();if(!isXDREnabled){utils[_0xf643('0xc')](_0xf643('0xd'));}else if(!isProduction&&!isLocalAsterisk){utils[_0xf643('0xc')](_0xf643('0xe'));}else{var agents=require('./agents.controller');var calls=require(_0xf643('0xf'));var queues=require('./queues.controller');var recordings=require(_0xf643('0x10'));var members=require(_0xf643('0x11'));var dials=require(_0xf643('0x12'));var transfers=require(_0xf643('0x13'));var core=require(_0xf643('0x14'));ami['on']('connect',core['connect']);ami['on'](_0xf643('0x15'),core[_0xf643('0x15')]);ami['on'](_0xf643('0x16'),core[_0xf643('0x16')]);ami['on'](_0xf643('0x17'),core[_0xf643('0x17')]);ami['on'](_0xf643('0x18'),core[_0xf643('0x18')]);ami['on']('managerevent',core[_0xf643('0x19')]);ami['on'](_0xf643('0x1a'),function(_0xbbafd8){try{utils[_0xf643('0x1b')](util['format']('[%s][index][devicestatechange]',_0xbbafd8[_0xf643('0x1c')]),_0xbbafd8);members[_0xf643('0x1a')](_0xbbafd8);}catch(_0x558711){utils['error'](util['format'](_0xf643('0x1d'),_0xbbafd8['device']),_0x558711);}});ami['on']('agentcalled',function(_0x1fdfc1){try{utils[_0xf643('0x1b')](util[_0xf643('0x1e')](_0xf643('0x1f'),_0x1fdfc1[_0xf643('0x20')]),_0x1fdfc1);agents['agentcalled'](_0x1fdfc1);}catch(_0x2b8ab1){utils[_0xf643('0x17')](util[_0xf643('0x1e')](_0xf643('0x1f'),_0x1fdfc1['uniqueid']),_0x2b8ab1);}});ami['on']('agentringnoanswer',function(_0x325fd2){try{utils[_0xf643('0x1b')](util[_0xf643('0x1e')](_0xf643('0x21'),_0x325fd2['uniqueid']),_0x325fd2);agents['agentringnoanswer'](_0x325fd2);}catch(_0x9e4535){utils['error'](util[_0xf643('0x1e')](_0xf643('0x21'),_0x325fd2[_0xf643('0x20')]),_0x9e4535);}});ami['on'](_0xf643('0x22'),function(_0x400d8a){try{utils[_0xf643('0x1b')](util[_0xf643('0x1e')](_0xf643('0x23'),_0x400d8a[_0xf643('0x20')]),_0x400d8a);agents['agentconnect'](_0x400d8a);queues[_0xf643('0x22')](_0x400d8a);}catch(_0xd366ea){utils[_0xf643('0x17')](util[_0xf643('0x1e')](_0xf643('0x23'),_0x400d8a[_0xf643('0x20')]),_0xd366ea);}});ami['on'](_0xf643('0x24'),function(_0x3a1be3){try{utils[_0xf643('0x1b')](util[_0xf643('0x1e')]('[%s][index][agentcomplete]',_0x3a1be3[_0xf643('0x20')]),_0x3a1be3);agents[_0xf643('0x24')](_0x3a1be3);queues['agentcomplete'](_0x3a1be3);members[_0xf643('0x24')](_0x3a1be3);}catch(_0x115290){utils[_0xf643('0x17')](util['format']('[%s][index][agentcomplete]',_0x3a1be3[_0xf643('0x20')]),_0x115290);}});ami['on'](_0xf643('0x25'),function(_0xf2134f){try{utils[_0xf643('0x1b')](util[_0xf643('0x1e')]('[%s][index][queuecallerabandon]',_0xf2134f[_0xf643('0x20')]),_0xf2134f);agents['queuecallerabandon'](_0xf2134f);queues[_0xf643('0x25')](_0xf2134f);}catch(_0x103cd3){utils['error'](util['format'](_0xf643('0x26'),_0xf2134f[_0xf643('0x20')]),_0x103cd3);}});ami['on'](_0xf643('0x27'),function(_0x1c82ca){try{utils['debug'](util[_0xf643('0x1e')](_0xf643('0x28'),_0x1c82ca[_0xf643('0x20')]),_0x1c82ca);queues[_0xf643('0x27')](_0x1c82ca);recordings[_0xf643('0x27')](_0x1c82ca);}catch(_0x4921f0){utils[_0xf643('0x17')](util[_0xf643('0x1e')](_0xf643('0x28'),_0x1c82ca[_0xf643('0x20')]),_0x4921f0);}});ami['on'](_0xf643('0x29'),function(_0x4a02e1){try{utils[_0xf643('0x1b')](util[_0xf643('0x1e')]('[%s][index][queuecallerleave]',_0x4a02e1['uniqueid']),_0x4a02e1);queues[_0xf643('0x29')](_0x4a02e1);}catch(_0xa4faa1){utils['error'](util[_0xf643('0x1e')](_0xf643('0x2a'),_0x4a02e1[_0xf643('0x20')]),_0xa4faa1);}});ami['on']('musiconholdstart',function(_0x13d08f){try{utils['debug'](util['format'](_0xf643('0x2b'),_0x13d08f[_0xf643('0x20')]),_0x13d08f);queues[_0xf643('0x2c')](_0x13d08f);calls[_0xf643('0x2c')](_0x13d08f);}catch(_0x3a16c9){utils[_0xf643('0x17')](util[_0xf643('0x1e')](_0xf643('0x2b'),_0x13d08f['uniqueid']),_0x3a16c9);}});ami['on'](_0xf643('0x2d'),function(_0x2a9599){try{utils[_0xf643('0x1b')](util[_0xf643('0x1e')](_0xf643('0x2e'),_0x2a9599['uniqueid']),_0x2a9599);queues[_0xf643('0x2d')](_0x2a9599);calls[_0xf643('0x2d')](_0x2a9599);}catch(_0x4738a9){utils[_0xf643('0x17')](util[_0xf643('0x1e')]('[%s][index][musiconholdstop]',_0x2a9599['uniqueid']),_0x4738a9);}});ami['on'](_0xf643('0x2f'),function(_0xae850d){try{utils[_0xf643('0x1b')](util['format'](_0xf643('0x30'),_0xae850d['uniqueid']),_0xae850d);calls[_0xf643('0x2f')](_0xae850d);recordings[_0xf643('0x2f')](_0xae850d);}catch(_0x499f3a){utils['error'](util['format'](_0xf643('0x30'),_0xae850d[_0xf643('0x20')]),_0x499f3a);}});ami['on']('hangup',function(_0x2f15d3){try{utils[_0xf643('0x1b')](util['format'](_0xf643('0x31'),_0x2f15d3['uniqueid']),_0x2f15d3);calls[_0xf643('0x32')](_0x2f15d3);recordings[_0xf643('0x32')](_0x2f15d3);dials[_0xf643('0x32')](_0x2f15d3);agents[_0xf643('0x32')](_0x2f15d3);queues[_0xf643('0x32')](_0x2f15d3);}catch(_0x4f5cdb){utils['error'](util[_0xf643('0x1e')](_0xf643('0x31'),_0x2f15d3[_0xf643('0x20')]),_0x4f5cdb);}});ami['on'](_0xf643('0x33'),function(_0x1cd136){try{utils[_0xf643('0x1b')](util[_0xf643('0x1e')](_0xf643('0x34'),_0x1cd136[_0xf643('0x20')]),_0x1cd136);members['cdr'](_0x1cd136);}catch(_0x1443c6){utils[_0xf643('0x17')](util['format'](_0xf643('0x34'),_0x1cd136[_0xf643('0x20')]),_0x1443c6);}});ami['on'](_0xf643('0x35'),function(_0x3b66a9){try{utils['debug'](util['format']('[%s][index][blindtransfer]',_0x3b66a9[_0xf643('0x20')]),_0x3b66a9);queues[_0xf643('0x35')](_0x3b66a9);agents[_0xf643('0x35')](_0x3b66a9);transfers[_0xf643('0x35')](_0x3b66a9);recordings[_0xf643('0x35')](_0x3b66a9);}catch(_0x4fd551){utils[_0xf643('0x17')](util[_0xf643('0x1e')](_0xf643('0x36'),_0x3b66a9['uniqueid']),_0x4fd551);}});ami['on'](_0xf643('0x37'),function(_0x3e305a){try{utils[_0xf643('0x1b')](util[_0xf643('0x1e')]('[%s][index][attendedtransfer]',_0x3e305a[_0xf643('0x38')]),_0x3e305a);queues[_0xf643('0x37')](_0x3e305a);transfers[_0xf643('0x37')](_0x3e305a);agents[_0xf643('0x37')](_0x3e305a);calls[_0xf643('0x37')](_0x3e305a);}catch(_0x53eed7){utils['error'](util[_0xf643('0x1e')](_0xf643('0x39'),_0x3e305a[_0xf643('0x38')]),_0x53eed7);}});ami['on'](_0xf643('0x3a'),function(_0x1c627b){try{utils[_0xf643('0x1b')](util[_0xf643('0x1e')](_0xf643('0x3b'),_0x1c627b['uniqueid']),_0x1c627b);queues[_0xf643('0x3a')](_0x1c627b);recordings[_0xf643('0x3a')](_0x1c627b);calls['varset'](_0x1c627b);dials[_0xf643('0x3a')](_0x1c627b);}catch(_0x461972){utils[_0xf643('0x17')](util[_0xf643('0x1e')](_0xf643('0x3b'),_0x1c627b[_0xf643('0x20')]),_0x461972);}});ami['on'](_0xf643('0x3c'),function(_0x1b81ee){try{utils['debug'](util[_0xf643('0x1e')]('[%s][index][newexten]',_0x1b81ee[_0xf643('0x20')]),_0x1b81ee);calls['newexten'](_0x1b81ee);recordings[_0xf643('0x3c')](_0x1b81ee);dials['newexten'](_0x1b81ee);}catch(_0x2ee5d0){utils[_0xf643('0x17')](util['format'](_0xf643('0x3d'),_0x1b81ee['uniqueid']),_0x2ee5d0);}});ami['on'](_0xf643('0x3e'),function(_0x3c3ade){try{utils['debug'](util[_0xf643('0x1e')]('[%s][index][newchannel]',_0x3c3ade[_0xf643('0x20')]),_0x3c3ade);calls[_0xf643('0x3e')](_0x3c3ade);recordings[_0xf643('0x3e')](_0x3c3ade);}catch(_0x5c149d){utils[_0xf643('0x17')](util[_0xf643('0x1e')](_0xf643('0x3f'),_0x3c3ade['uniqueid']),_0x5c149d);}});ami['on']('dialbegin',function(_0x4efbb0){try{utils[_0xf643('0x1b')](util[_0xf643('0x1e')](_0xf643('0x40'),_0x4efbb0[_0xf643('0x20')]),_0x4efbb0);dials[_0xf643('0x41')](_0x4efbb0);}catch(_0x236f9d){utils['error'](util['format']('[%s]dialbegin',_0x4efbb0[_0xf643('0x20')]),_0x236f9d);}});ami['on'](_0xf643('0x42'),function(_0x35dff3){try{utils[_0xf643('0x1b')](util['format'](_0xf643('0x43'),_0x35dff3[_0xf643('0x20')]),_0x35dff3);dials[_0xf643('0x42')](_0x35dff3);}catch(_0x1ab410){utils[_0xf643('0x17')](util[_0xf643('0x1e')](_0xf643('0x43'),_0x35dff3[_0xf643('0x20')]),_0x1ab410);}});} \ No newline at end of file diff --git a/server/services/xdr/members.controller.js b/server/services/xdr/members.controller.js index 15eee62..35f8070 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 _0x5ce1=['debug','[%s][members][devicestatechange]','device','info','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','voice','now','agent','isNil','exitAt','duration','enterAt','error','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','queue','assign','[%s][members][agentcomplete]','cdr','[%s][members][cdr]','data3','destination','data1','destinationchannel','source','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','lodash','util','./utils','Local/_attended@transfer','Queue:','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2','membername','type','then','internal','request','getUserByName','split','name','catch','some','startsWith','devicestatechange'];(function(_0x1063e5,_0x4d0ed2){var _0x55809d=function(_0x1badc9){while(--_0x1badc9){_0x1063e5['push'](_0x1063e5['shift']());}};_0x55809d(++_0x4d0ed2);}(_0x5ce1,0x1e7));var _0x15ce=function(_0x415084,_0x4ff2b0){_0x415084=_0x415084-0x0;var _0x53e9e0=_0x5ce1[_0x415084];return _0x53e9e0;};'use strict';var _=require(_0x15ce('0x0'));var util=require(_0x15ce('0x1'));var utils=require(_0x15ce('0x2'));var members={};var exclude=[_0x15ce('0x3'),_0x15ce('0x4')];function writeDB(_0x26bbee){utils['info'](util[_0x15ce('0x5')](_0x15ce('0x6'),_0x26bbee[_0x15ce('0x7')],_0x26bbee[_0x15ce('0x8')],_0x26bbee[_0x15ce('0x9')],_0x26bbee[_0x15ce('0xa')],_0x26bbee[_0x15ce('0xb')],_0x26bbee[_0x15ce('0xc')]));if(_0x26bbee[_0x15ce('0x8')]){utils['getUserByInterface'](_0x26bbee[_0x15ce('0x8')])[_0x15ce('0xd')](function(_0x49d81d){if(_0x49d81d){_0x26bbee[_0x15ce('0xb')]=_0x49d81d['name'];_0x26bbee['internal']=_0x49d81d[_0x15ce('0xe')];utils[_0x15ce('0xf')]('CreateMemberReport',_0x26bbee);}else{utils[_0x15ce('0x10')](_0x26bbee[_0x15ce('0x8')][_0x15ce('0x11')]('/')[0x1])[_0x15ce('0xd')](function(_0x1f42f6){if(_0x1f42f6){_0x26bbee['membername']=_0x1f42f6[_0x15ce('0x12')];_0x26bbee[_0x15ce('0xe')]=_0x1f42f6[_0x15ce('0xe')];utils[_0x15ce('0xf')]('CreateMemberReport',_0x26bbee);}});}})[_0x15ce('0x13')](function(_0x4b8273){utils['error'](util[_0x15ce('0x5')]('[%s][members][writeDB]',_0x26bbee['uniqueid']),_0x4b8273);});}delete members[_0x26bbee[_0x15ce('0x8')]];}function startsWith(_0x274968,_0x4cfcbf){return _[_0x15ce('0x14')](_0x274968,function(_0x4dd91c){return _[_0x15ce('0x15')](_0x4cfcbf,_0x4dd91c);});}exports[_0x15ce('0x16')]=function(_0x2a2bd2){try{utils[_0x15ce('0x17')](util[_0x15ce('0x5')](_0x15ce('0x18'),members[_0x2a2bd2[_0x15ce('0x19')]]?members[_0x2a2bd2['device']][_0x15ce('0x7')]:_0x2a2bd2['device']),_0x2a2bd2);utils[_0x15ce('0x1a')](util[_0x15ce('0x5')](_0x15ce('0x1b'),members[_0x2a2bd2['device']]?members[_0x2a2bd2['device']]['uniqueid']:_0x2a2bd2[_0x15ce('0x19')],_0x2a2bd2[_0x15ce('0x1c')],_0x2a2bd2[_0x15ce('0x19')]));switch(_0x2a2bd2[_0x15ce('0x1c')]){case _0x15ce('0x1d'):case _0x15ce('0x1e'):if(!startsWith(exclude,_0x2a2bd2[_0x15ce('0x19')])){members[_0x2a2bd2[_0x15ce('0x19')]]={'channel':_0x15ce('0x1f'),'interface':_0x2a2bd2[_0x15ce('0x19')],'type':'TALKING','enterAt':utils[_0x15ce('0x20')](),'role':_0x15ce('0x21')};}break;case'NOT_INUSE':if(!_[_0x15ce('0x22')](members[_0x2a2bd2[_0x15ce('0x19')]])){members[_0x2a2bd2[_0x15ce('0x19')]][_0x15ce('0x23')]=utils['now']();members[_0x2a2bd2[_0x15ce('0x19')]][_0x15ce('0x24')]=utils['diffTime'](members[_0x2a2bd2['device']][_0x15ce('0x23')],members[_0x2a2bd2[_0x15ce('0x19')]][_0x15ce('0x25')]);if(members[_0x2a2bd2[_0x15ce('0x19')]][_0x15ce('0x7')]){writeDB(members[_0x2a2bd2[_0x15ce('0x19')]]);}}break;default:break;}}catch(_0x163c63){utils[_0x15ce('0x26')](util[_0x15ce('0x5')](_0x15ce('0x18'),members[_0x2a2bd2['device']]?members[_0x2a2bd2[_0x15ce('0x19')]]['uniqueid']:_0x2a2bd2[_0x15ce('0x19')]),_0x163c63);}};exports['agentcomplete']=function(_0x1077d4){try{if(!_[_0x15ce('0x22')](members[_0x1077d4[_0x15ce('0x8')]])){utils[_0x15ce('0x17')](util[_0x15ce('0x5')]('[%s][members][agentcomplete]',_0x1077d4[_0x15ce('0x7')]),_0x1077d4);utils[_0x15ce('0x1a')](util[_0x15ce('0x5')](_0x15ce('0x27'),_0x1077d4[_0x15ce('0x7')],_0x1077d4[_0x15ce('0x8')],_0x1077d4[_0x15ce('0x28')]));members[_0x1077d4[_0x15ce('0x8')]]=_[_0x15ce('0x29')](members[_0x1077d4['interface']],{'data4':_0x1077d4['queue'],'uniqueid':_0x1077d4[_0x15ce('0x7')]});}}catch(_0x1b3708){utils[_0x15ce('0x26')](util[_0x15ce('0x5')](_0x15ce('0x2a'),_0x1077d4[_0x15ce('0x7')]),_0x1b3708);}};exports[_0x15ce('0x2b')]=function(_0x31f68e){try{utils['debug'](util[_0x15ce('0x5')](_0x15ce('0x2c'),_0x31f68e[_0x15ce('0x7')]),_0x31f68e);if(_0x31f68e[_0x15ce('0x9')]){var _0x42bf07=_0x31f68e['channel'][_0x15ce('0x11')]('-')[0x0];if(!_['isNil'](members[_0x42bf07])){members[_0x42bf07]=_[_0x15ce('0x29')](members[_0x42bf07],{'data1':members[_0x42bf07]['data1']||_0x31f68e[_0x15ce('0xc')],'data2':members[_0x42bf07][_0x15ce('0xa')]||_0x31f68e['source'],'data3':members[_0x42bf07][_0x15ce('0x2d')]||_0x31f68e[_0x15ce('0x2e')],'uniqueid':members[_0x42bf07][_0x15ce('0x7')]||_0x31f68e[_0x15ce('0x7')]});utils['info'](util[_0x15ce('0x5')]('[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s',_0x31f68e['uniqueid'],members[_0x42bf07][_0x15ce('0x2f')],members[_0x42bf07]['data2'],members[_0x42bf07][_0x15ce('0x2d')]));if(members[_0x42bf07][_0x15ce('0x23')]){writeDB(members[_0x42bf07]);}}}if(_0x31f68e[_0x15ce('0x30')]){var _0x37509d=_0x31f68e[_0x15ce('0x30')][_0x15ce('0x11')]('-')[0x0];if(!_[_0x15ce('0x22')](members[_0x37509d])){members[_0x37509d]=_[_0x15ce('0x29')](members[_0x37509d],{'data1':members[_0x37509d][_0x15ce('0x2f')]||_0x31f68e['type'],'data2':members[_0x37509d][_0x15ce('0xa')]||_0x31f68e[_0x15ce('0x31')],'data3':members[_0x37509d][_0x15ce('0x2d')]||_0x31f68e[_0x15ce('0x2e')],'uniqueid':members[_0x37509d]['uniqueid']||_0x31f68e[_0x15ce('0x7')]});utils[_0x15ce('0x1a')](util['format'](_0x15ce('0x32'),_0x31f68e[_0x15ce('0x7')],members[_0x37509d][_0x15ce('0x2f')],members[_0x37509d][_0x15ce('0xa')],members[_0x37509d][_0x15ce('0x2d')]));if(members[_0x37509d][_0x15ce('0x23')]){writeDB(members[_0x37509d]);}}}}catch(_0x9cdca1){utils[_0x15ce('0x26')](util[_0x15ce('0x5')](_0x15ce('0x2c'),_0x31f68e[_0x15ce('0x7')]),_0x9cdca1);}}; \ No newline at end of file +var _0x7326=['membername','getUserByInterface','then','name','internal','request','CreateMemberReport','getUserByName','catch','error','[%s][members][writeDB]','some','startsWith','devicestatechange','[%s][members][devicestatechange]','device','[%s][members][devicestatechange]\x20state:%s\x20interface:%s','state','INUSE','BUSY','TALKING','now','exitAt','duration','diffTime','enterAt','agentcomplete','isNil','debug','[%s][members][agentcomplete]','[%s][members][agentcomplete]\x20interface:%s\x20queue:%s','assign','queue','cdr','[%s][members][cdr]','type','source','data3','destination','[%s][members][cdr]\x20type:%s\x20source:%s\x20destination:%s','data1','destinationchannel','split','./utils','Queue:','info','format','[%s][members][writeDB]\x20interface:%s\x20channel:%s\x20data2:%s\x20agent:%s\x20type:%s','uniqueid','interface','channel','data2'];(function(_0x5a6c1f,_0x129a13){var _0xceb9ba=function(_0x2c5c79){while(--_0x2c5c79){_0x5a6c1f['push'](_0x5a6c1f['shift']());}};_0xceb9ba(++_0x129a13);}(_0x7326,0xc7));var _0x6732=function(_0x4baae2,_0x487ab6){_0x4baae2=_0x4baae2-0x0;var _0x1a2285=_0x7326[_0x4baae2];return _0x1a2285;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0x6732('0x0'));var members={};var exclude=['Local/_attended@transfer',_0x6732('0x1')];function writeDB(_0x3d3f59){utils[_0x6732('0x2')](util[_0x6732('0x3')](_0x6732('0x4'),_0x3d3f59[_0x6732('0x5')],_0x3d3f59[_0x6732('0x6')],_0x3d3f59[_0x6732('0x7')],_0x3d3f59[_0x6732('0x8')],_0x3d3f59[_0x6732('0x9')],_0x3d3f59['type']));if(_0x3d3f59[_0x6732('0x6')]){utils[_0x6732('0xa')](_0x3d3f59['interface'])[_0x6732('0xb')](function(_0x1d84de){if(_0x1d84de){_0x3d3f59['membername']=_0x1d84de[_0x6732('0xc')];_0x3d3f59[_0x6732('0xd')]=_0x1d84de[_0x6732('0xd')];utils[_0x6732('0xe')](_0x6732('0xf'),_0x3d3f59);}else{utils[_0x6732('0x10')](_0x3d3f59[_0x6732('0x6')]['split']('/')[0x1])[_0x6732('0xb')](function(_0x5497f7){if(_0x5497f7){_0x3d3f59[_0x6732('0x9')]=_0x5497f7[_0x6732('0xc')];_0x3d3f59[_0x6732('0xd')]=_0x5497f7['internal'];utils[_0x6732('0xe')](_0x6732('0xf'),_0x3d3f59);}});}})[_0x6732('0x11')](function(_0x317e7b){utils[_0x6732('0x12')](util[_0x6732('0x3')](_0x6732('0x13'),_0x3d3f59[_0x6732('0x5')]),_0x317e7b);});}delete members[_0x3d3f59[_0x6732('0x6')]];}function startsWith(_0x13d777,_0x58c5af){return _[_0x6732('0x14')](_0x13d777,function(_0x49269f){return _[_0x6732('0x15')](_0x58c5af,_0x49269f);});}exports[_0x6732('0x16')]=function(_0x477b33){try{utils['debug'](util[_0x6732('0x3')](_0x6732('0x17'),members[_0x477b33[_0x6732('0x18')]]?members[_0x477b33['device']][_0x6732('0x5')]:_0x477b33[_0x6732('0x18')]),_0x477b33);utils['info'](util[_0x6732('0x3')](_0x6732('0x19'),members[_0x477b33[_0x6732('0x18')]]?members[_0x477b33[_0x6732('0x18')]][_0x6732('0x5')]:_0x477b33[_0x6732('0x18')],_0x477b33[_0x6732('0x1a')],_0x477b33[_0x6732('0x18')]));switch(_0x477b33[_0x6732('0x1a')]){case _0x6732('0x1b'):case _0x6732('0x1c'):if(!startsWith(exclude,_0x477b33[_0x6732('0x18')])){members[_0x477b33[_0x6732('0x18')]]={'channel':'voice','interface':_0x477b33['device'],'type':_0x6732('0x1d'),'enterAt':utils[_0x6732('0x1e')](),'role':'agent'};}break;case'NOT_INUSE':if(!_['isNil'](members[_0x477b33[_0x6732('0x18')]])){members[_0x477b33[_0x6732('0x18')]][_0x6732('0x1f')]=utils[_0x6732('0x1e')]();members[_0x477b33['device']][_0x6732('0x20')]=utils[_0x6732('0x21')](members[_0x477b33['device']][_0x6732('0x1f')],members[_0x477b33[_0x6732('0x18')]][_0x6732('0x22')]);if(members[_0x477b33[_0x6732('0x18')]]['uniqueid']){writeDB(members[_0x477b33['device']]);}}break;default:break;}}catch(_0x34acad){utils[_0x6732('0x12')](util[_0x6732('0x3')]('[%s][members][devicestatechange]',members[_0x477b33[_0x6732('0x18')]]?members[_0x477b33[_0x6732('0x18')]][_0x6732('0x5')]:_0x477b33[_0x6732('0x18')]),_0x34acad);}};exports[_0x6732('0x23')]=function(_0x451b08){try{if(!_[_0x6732('0x24')](members[_0x451b08[_0x6732('0x6')]])){utils[_0x6732('0x25')](util[_0x6732('0x3')](_0x6732('0x26'),_0x451b08[_0x6732('0x5')]),_0x451b08);utils[_0x6732('0x2')](util[_0x6732('0x3')](_0x6732('0x27'),_0x451b08[_0x6732('0x5')],_0x451b08['interface'],_0x451b08['queue']));members[_0x451b08[_0x6732('0x6')]]=_[_0x6732('0x28')](members[_0x451b08[_0x6732('0x6')]],{'data4':_0x451b08[_0x6732('0x29')],'uniqueid':_0x451b08[_0x6732('0x5')]});}}catch(_0x43d70c){utils['error'](util[_0x6732('0x3')]('[%s][members][agentcomplete]',_0x451b08[_0x6732('0x5')]),_0x43d70c);}};exports[_0x6732('0x2a')]=function(_0x4a4a9a){try{utils[_0x6732('0x25')](util['format'](_0x6732('0x2b'),_0x4a4a9a['uniqueid']),_0x4a4a9a);if(_0x4a4a9a[_0x6732('0x7')]){var _0x4ae4fd=_0x4a4a9a[_0x6732('0x7')]['split']('-')[0x0];if(!_[_0x6732('0x24')](members[_0x4ae4fd])){members[_0x4ae4fd]=_[_0x6732('0x28')](members[_0x4ae4fd],{'data1':members[_0x4ae4fd]['data1']||_0x4a4a9a[_0x6732('0x2c')],'data2':members[_0x4ae4fd][_0x6732('0x8')]||_0x4a4a9a[_0x6732('0x2d')],'data3':members[_0x4ae4fd][_0x6732('0x2e')]||_0x4a4a9a[_0x6732('0x2f')],'uniqueid':members[_0x4ae4fd][_0x6732('0x5')]||_0x4a4a9a[_0x6732('0x5')]});utils['info'](util[_0x6732('0x3')](_0x6732('0x30'),_0x4a4a9a[_0x6732('0x5')],members[_0x4ae4fd][_0x6732('0x31')],members[_0x4ae4fd][_0x6732('0x8')],members[_0x4ae4fd][_0x6732('0x2e')]));if(members[_0x4ae4fd][_0x6732('0x1f')]){writeDB(members[_0x4ae4fd]);}}}if(_0x4a4a9a[_0x6732('0x32')]){var _0x4ca87a=_0x4a4a9a[_0x6732('0x32')][_0x6732('0x33')]('-')[0x0];if(!_[_0x6732('0x24')](members[_0x4ca87a])){members[_0x4ca87a]=_[_0x6732('0x28')](members[_0x4ca87a],{'data1':members[_0x4ca87a][_0x6732('0x31')]||_0x4a4a9a[_0x6732('0x2c')],'data2':members[_0x4ca87a][_0x6732('0x8')]||_0x4a4a9a['source'],'data3':members[_0x4ca87a]['data3']||_0x4a4a9a[_0x6732('0x2f')],'uniqueid':members[_0x4ca87a][_0x6732('0x5')]||_0x4a4a9a[_0x6732('0x5')]});utils['info'](util[_0x6732('0x3')](_0x6732('0x30'),_0x4a4a9a[_0x6732('0x5')],members[_0x4ca87a][_0x6732('0x31')],members[_0x4ca87a]['data2'],members[_0x4ca87a]['data3']));if(members[_0x4ca87a][_0x6732('0x1f')]){writeDB(members[_0x4ca87a]);}}}}catch(_0xfe7f59){utils[_0x6732('0x12')](util[_0x6732('0x3')]('[%s][members][cdr]',_0x4a4a9a[_0x6732('0x5')]),_0xfe7f59);}}; \ No newline at end of file diff --git a/server/services/xdr/queues.controller.js b/server/services/xdr/queues.controller.js index 2725bf1..1eb534c 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 _0x01ec=['position','assign','now','error','isNil','[%s][queues][hangup]','queuecallerleaveAt','queuecallerexit','queuecallercomplete','queuecallercompleteAt','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s','queuecallerenterreason','varset','variable','queuestatus','value','toUpperCase','CONTINUE','queuecallerabandon','queuecallerabandonAt','queuecallerexitAt','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][varset]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','holdtime','diffTime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','destaccountcode','assigned','membername','agentcomplete','[%s][queues][agentcomplete]','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','[%s][queues][blindtransfer]','transfereeuniqueid','transfertype','BLIND','transferexten','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','extension','attendedtransfer','origtransfereruniqueid','origtransfererlinkedid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','transferuniqueid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','secondtransfereruniqueid','secondtransfererexten','ATTENDEDTRANSFER','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','./utils','info','format','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','channel','lastAssignedTo','calleridnum','accountcode','queuecallerexitreason','queue','getVoiceQueueByName','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','debug','[%s][queues][queuecallerjoin]','uniqueid','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s'];(function(_0x5ff027,_0x451702){var _0x2ca147=function(_0x54f4c0){while(--_0x54f4c0){_0x5ff027['push'](_0x5ff027['shift']());}};_0x2ca147(++_0x451702);}(_0x01ec,0x12a));var _0xc01e=function(_0x22c8f6,_0x1df7e0){_0x22c8f6=_0x22c8f6-0x0;var _0xbabe4e=_0x01ec[_0x22c8f6];return _0xbabe4e;};'use strict';var _=require('lodash');var util=require('util');var utils=require(_0xc01e('0x0'));var queues={};function writeDB(_0x2c68b8){utils[_0xc01e('0x1')](util[_0xc01e('0x2')](_0xc01e('0x3'),_0x2c68b8['uniqueid'],_0x2c68b8[_0xc01e('0x4')],_0x2c68b8['queue'],_0x2c68b8[_0xc01e('0x5')],_0x2c68b8[_0xc01e('0x6')],_0x2c68b8[_0xc01e('0x7')],_0x2c68b8[_0xc01e('0x8')]));if(_0x2c68b8[_0xc01e('0x9')]){utils[_0xc01e('0xa')](_0x2c68b8['queue'])['then'](function(_0x1da97b){if(_0x1da97b){_0x2c68b8[_0xc01e('0xb')]=_0x1da97b['type'];}utils[_0xc01e('0xc')](_0xc01e('0xd'),_0x2c68b8);});}else{utils[_0xc01e('0xc')](_0xc01e('0xd'),_0x2c68b8);}if(_0x2c68b8[_0xc01e('0xe')]){delete queues[_0x2c68b8['transfereduniqueid']];}else{delete queues[_0x2c68b8['uniqueid']];}}exports[_0xc01e('0xf')]=function(_0x1056ce){try{utils[_0xc01e('0x10')](util[_0xc01e('0x2')](_0xc01e('0x11'),_0x1056ce[_0xc01e('0x12')]),_0x1056ce);utils[_0xc01e('0x1')](util[_0xc01e('0x2')](_0xc01e('0x13'),_0x1056ce[_0xc01e('0x12')],_0x1056ce[_0xc01e('0x9')],_0x1056ce[_0xc01e('0x14')]));queues[_0x1056ce['uniqueid']]=_[_0xc01e('0x15')](_0x1056ce,{'originalposition':_0x1056ce[_0xc01e('0x14')],'queuecallerjoinAt':utils[_0xc01e('0x16')](),'mohtime':0x0});}catch(_0x30728a){utils[_0xc01e('0x17')](util[_0xc01e('0x2')](_0xc01e('0x11'),_0x1056ce[_0xc01e('0x12')]),_0x30728a);}};exports['hangup']=function(_0x4c4f09){try{if(!_[_0xc01e('0x18')](queues[_0x4c4f09['uniqueid']])){utils[_0xc01e('0x10')](util['format'](_0xc01e('0x19'),_0x4c4f09['uniqueid']),_0x4c4f09);if(queues[_0x4c4f09['uniqueid']][_0xc01e('0x1a')]){if(!queues[_0x4c4f09[_0xc01e('0x12')]]['queuecallerabandon']&&!queues[_0x4c4f09[_0xc01e('0x12')]][_0xc01e('0x1b')]){queues[_0x4c4f09['uniqueid']][_0xc01e('0x1c')]=!![];queues[_0x4c4f09['uniqueid']][_0xc01e('0x1d')]=utils[_0xc01e('0x16')]();queues[_0x4c4f09['uniqueid']][_0xc01e('0x8')]=_0xc01e('0x1e');}utils[_0xc01e('0x1')](util[_0xc01e('0x2')](_0xc01e('0x1f'),_0x4c4f09[_0xc01e('0x12')],queues[_0x4c4f09[_0xc01e('0x12')]][_0xc01e('0x20')],queues[_0x4c4f09[_0xc01e('0x12')]]['queuecallerexitreason']));writeDB(queues[_0x4c4f09[_0xc01e('0x12')]]);}else if(queues[_0x4c4f09[_0xc01e('0x12')]][_0xc01e('0xe')]){utils[_0xc01e('0x1')](util[_0xc01e('0x2')](_0xc01e('0x21'),_0x4c4f09[_0xc01e('0x12')],queues[_0x4c4f09['uniqueid']]['name'],queues[_0x4c4f09['uniqueid']][_0xc01e('0xe')]));queues[queues[_0x4c4f09[_0xc01e('0x12')]]['transfereduniqueid']]=queues[_0x4c4f09[_0xc01e('0x12')]];queues[queues[_0x4c4f09[_0xc01e('0x12')]][_0xc01e('0xe')]][_0xc01e('0x22')]=0x2;delete queues[_0x4c4f09[_0xc01e('0x12')]];}}}catch(_0x30522a){utils[_0xc01e('0x17')](util['format'](_0xc01e('0x19'),_0x4c4f09[_0xc01e('0x12')]),_0x30522a);}};exports[_0xc01e('0x23')]=function(_0x44c115){try{utils[_0xc01e('0x10')](util[_0xc01e('0x2')]('[%s][queues][varset]',_0x44c115[_0xc01e('0x12')]),_0x44c115);if(!_[_0xc01e('0x18')](_0x44c115[_0xc01e('0x24')][_0xc01e('0x25')])&&_0x44c115[_0xc01e('0x26')][_0xc01e('0x27')]()!==_0xc01e('0x28')){if(!_[_0xc01e('0x18')](queues[_0x44c115[_0xc01e('0x12')]])){queues[_0x44c115['uniqueid']][_0xc01e('0x29')]=![];queues[_0x44c115[_0xc01e('0x12')]][_0xc01e('0x2a')]=null;queues[_0x44c115['uniqueid']][_0xc01e('0x1b')]=!![];queues[_0x44c115[_0xc01e('0x12')]][_0xc01e('0x2b')]=utils['now']();queues[_0x44c115['uniqueid']][_0xc01e('0x8')]=_0x44c115[_0xc01e('0x26')][_0xc01e('0x27')]();utils['info'](util[_0xc01e('0x2')](_0xc01e('0x2c'),_0x44c115['uniqueid'],queues[_0x44c115[_0xc01e('0x12')]]['name'],_0x44c115[_0xc01e('0x26')],queues[_0x44c115[_0xc01e('0x12')]][_0xc01e('0x8')]));writeDB(queues[_0x44c115[_0xc01e('0x12')]]);}}else if(!_[_0xc01e('0x18')](_0x44c115[_0xc01e('0x24')]['queueposition'])){if(!_['isNil'](queues[_0x44c115['uniqueid']])&&!queues[_0x44c115[_0xc01e('0x12')]]['queuecallerabandon']){queues[_0x44c115[_0xc01e('0x12')]][_0xc01e('0x29')]=![];queues[_0x44c115[_0xc01e('0x12')]][_0xc01e('0x2a')]=null;queues[_0x44c115['uniqueid']][_0xc01e('0x1b')]=!![];queues[_0x44c115[_0xc01e('0x12')]]['queuecallerexitAt']=utils[_0xc01e('0x16')]();queues[_0x44c115[_0xc01e('0x12')]][_0xc01e('0x8')]=_0xc01e('0x2d');utils[_0xc01e('0x1')](util[_0xc01e('0x2')](_0xc01e('0x2e'),_0x44c115['uniqueid'],queues[_0x44c115[_0xc01e('0x12')]][_0xc01e('0x20')],_0x44c115[_0xc01e('0x26')],queues[_0x44c115[_0xc01e('0x12')]][_0xc01e('0x8')]));}}}catch(_0x3780ed){utils['error'](util[_0xc01e('0x2')](_0xc01e('0x2f'),_0x44c115['uniqueid']),_0x3780ed);}};exports[_0xc01e('0x29')]=function(_0x3be4c3){try{if(!_[_0xc01e('0x18')](queues[_0x3be4c3['uniqueid']])){utils[_0xc01e('0x10')](util[_0xc01e('0x2')]('[%s][queues][queuecallerabandon]',_0x3be4c3[_0xc01e('0x12')]),_0x3be4c3);queues[_0x3be4c3[_0xc01e('0x12')]][_0xc01e('0x1b')]=![];queues[_0x3be4c3[_0xc01e('0x12')]]['queuecallerexitAt']=null;queues[_0x3be4c3['uniqueid']][_0xc01e('0x29')]=!![];queues[_0x3be4c3['uniqueid']]['queuecallerabandonAt']=utils['now']();queues[_0x3be4c3['uniqueid']][_0xc01e('0x8')]=_0xc01e('0x30');utils[_0xc01e('0x1')](util['format'](_0xc01e('0x31'),_0x3be4c3[_0xc01e('0x12')],queues[_0x3be4c3[_0xc01e('0x12')]][_0xc01e('0x20')],queues[_0x3be4c3[_0xc01e('0x12')]]['queuecallerexitreason']));}}catch(_0x5e527a){utils['error'](util['format']('[%s][queues][queuecallerabandon]',_0x3be4c3[_0xc01e('0x12')]),_0x5e527a);}};exports[_0xc01e('0x32')]=function(_0x3bb465){try{if(!_['isNil'](queues[_0x3bb465[_0xc01e('0x12')]])){utils[_0xc01e('0x10')](util[_0xc01e('0x2')](_0xc01e('0x33'),_0x3bb465['uniqueid']),_0x3bb465);utils[_0xc01e('0x1')](util['format'](_0xc01e('0x34'),_0x3bb465[_0xc01e('0x12')],queues[_0x3bb465[_0xc01e('0x12')]][_0xc01e('0x20')],_0x3bb465[_0xc01e('0x35')],_0x3bb465[_0xc01e('0x36')]));queues[_0x3bb465['uniqueid']][_0xc01e('0x32')]=!![];queues[_0x3bb465['uniqueid']][_0xc01e('0x1a')]=utils[_0xc01e('0x16')]();queues[_0x3bb465['uniqueid']][_0xc01e('0x37')]=utils[_0xc01e('0x38')](queues[_0x3bb465['uniqueid']][_0xc01e('0x1a')],queues[_0x3bb465['uniqueid']]['queuecallerjoinAt']);queues[_0x3bb465[_0xc01e('0x12')]][_0xc01e('0x14')]=_0x3bb465[_0xc01e('0x14')];queues[_0x3bb465[_0xc01e('0x12')]][_0xc01e('0x39')]=_0x3bb465['count'];queues[_0x3bb465[_0xc01e('0x12')]]['connectedlinenum']=_0x3bb465[_0xc01e('0x35')];queues[_0x3bb465[_0xc01e('0x12')]]['connectedlinename']=_0x3bb465[_0xc01e('0x36')];}}catch(_0x516049){utils[_0xc01e('0x17')](util['format']('[%s][queues][queuecallerleave]',_0x3bb465['uniqueid']),_0x516049);}};exports[_0xc01e('0x3a')]=function(_0x434492){try{if(!_['isNil'](queues[_0x434492['uniqueid']])){utils[_0xc01e('0x10')](util['format'](_0xc01e('0x3b'),_0x434492[_0xc01e('0x12')]),_0x434492);utils[_0xc01e('0x1')](util['format'](_0xc01e('0x3c'),_0x434492[_0xc01e('0x12')],queues[_0x434492['uniqueid']]['name'],_0x434492['membername'],_0x434492[_0xc01e('0x3d')]));queues[_0x434492[_0xc01e('0x12')]][_0xc01e('0x29')]=![];queues[_0x434492[_0xc01e('0x12')]]['queuecallerabandon']=![];queues[_0x434492[_0xc01e('0x12')]]['queuecallerabandonAt']=null;queues[_0x434492[_0xc01e('0x12')]][_0xc01e('0x1b')]=![];queues[_0x434492['uniqueid']][_0xc01e('0x8')]=null;queues[_0x434492['uniqueid']]['queuecallerexitAt']=null;queues[_0x434492[_0xc01e('0x12')]][_0xc01e('0x3e')]=!![];queues[_0x434492[_0xc01e('0x12')]][_0xc01e('0x7')]=_0x434492['destaccountcode'];queues[_0x434492[_0xc01e('0x12')]][_0xc01e('0x5')]=_0x434492[_0xc01e('0x3f')];}}catch(_0x4862a5){utils[_0xc01e('0x17')](util[_0xc01e('0x2')]('[%s][queues][agentconnect]',_0x434492[_0xc01e('0x12')]),_0x4862a5);}};exports[_0xc01e('0x40')]=function(_0x4ceddb){try{if(!_[_0xc01e('0x18')](queues[_0x4ceddb[_0xc01e('0x12')]])){if(queues[_0x4ceddb['uniqueid']][_0xc01e('0x1a')]){utils[_0xc01e('0x10')](util[_0xc01e('0x2')](_0xc01e('0x41'),_0x4ceddb[_0xc01e('0x12')]),_0x4ceddb);queues[_0x4ceddb['uniqueid']][_0xc01e('0x29')]=![];queues[_0x4ceddb[_0xc01e('0x12')]][_0xc01e('0x29')]=![];queues[_0x4ceddb[_0xc01e('0x12')]][_0xc01e('0x2a')]=null;queues[_0x4ceddb[_0xc01e('0x12')]][_0xc01e('0x1b')]=![];queues[_0x4ceddb[_0xc01e('0x12')]][_0xc01e('0x2b')]=null;queues[_0x4ceddb[_0xc01e('0x12')]][_0xc01e('0x3e')]=!![];queues[_0x4ceddb[_0xc01e('0x12')]][_0xc01e('0x5')]=_0x4ceddb[_0xc01e('0x3f')];queues[_0x4ceddb[_0xc01e('0x12')]][_0xc01e('0x1c')]=!![];queues[_0x4ceddb[_0xc01e('0x12')]][_0xc01e('0x1d')]=utils[_0xc01e('0x16')]();if(_0x4ceddb[_0xc01e('0x42')]==_0xc01e('0x43')){if(!queues[_0x4ceddb['uniqueid']][_0xc01e('0x43')]){queues[_0x4ceddb['uniqueid']]['queuecallerexitreason']='TRANSFER';}}else{queues[_0x4ceddb[_0xc01e('0x12')]]['queuecallerexitreason']=_0xc01e('0x44')+_0x4ceddb[_0xc01e('0x42')][_0xc01e('0x27')]();}utils[_0xc01e('0x1')](util['format'](_0xc01e('0x45'),_0x4ceddb[_0xc01e('0x12')],queues[_0x4ceddb[_0xc01e('0x12')]][_0xc01e('0x20')],_0x4ceddb['membername'],queues[_0x4ceddb[_0xc01e('0x12')]][_0xc01e('0x8')]));writeDB(queues[_0x4ceddb['uniqueid']]);}}}catch(_0x41d4d5){utils[_0xc01e('0x17')](util[_0xc01e('0x2')](_0xc01e('0x41'),_0x4ceddb['uniqueid']),_0x41d4d5);}};exports[_0xc01e('0x46')]=function(_0x1ee5ad){try{if(!_['isNil'](queues[_0x1ee5ad['transfereeuniqueid']])){utils[_0xc01e('0x10')](util[_0xc01e('0x2')](_0xc01e('0x47'),_0x1ee5ad[_0xc01e('0x12')]),_0x1ee5ad);queues[_0x1ee5ad[_0xc01e('0x48')]][_0xc01e('0x43')]=!![];queues[_0x1ee5ad[_0xc01e('0x48')]][_0xc01e('0x49')]=_0xc01e('0x4a');queues[_0x1ee5ad[_0xc01e('0x48')]][_0xc01e('0x4b')]=_0x1ee5ad['extension'];queues[_0x1ee5ad['transfereeuniqueid']]['transferuniqueid']=_0x1ee5ad['transfereeuniqueid'];queues[_0x1ee5ad[_0xc01e('0x48')]]['queuecallerexitreason']=_0xc01e('0x4c');utils['info'](util['format'](_0xc01e('0x4d'),_0x1ee5ad[_0xc01e('0x12')],queues[_0x1ee5ad[_0xc01e('0x48')]][_0xc01e('0x20')],_0x1ee5ad[_0xc01e('0x48')],_0x1ee5ad[_0xc01e('0x4e')]));}}catch(_0x958fef){utils['error'](util[_0xc01e('0x2')]('[%s][queues][blindtransfer]',_0x1ee5ad[_0xc01e('0x12')]),_0x958fef);}};exports[_0xc01e('0x4f')]=function(_0x5df897){try{utils[_0xc01e('0x10')](util[_0xc01e('0x2')]('[%s][queues][attendedtransfer]',_0x5df897[_0xc01e('0x50')]),_0x5df897);if(_0x5df897['origtransfereruniqueid']==_0x5df897[_0xc01e('0x51')]){if(!_['isNil'](queues[_0x5df897[_0xc01e('0x52')]])){utils[_0xc01e('0x1')](util[_0xc01e('0x2')](_0xc01e('0x53'),_0x5df897[_0xc01e('0x50')],queues[_0x5df897[_0xc01e('0x52')]][_0xc01e('0x20')],_0x5df897[_0xc01e('0x54')]));queues[_0x5df897[_0xc01e('0x52')]][_0xc01e('0x43')]=!![];queues[_0x5df897[_0xc01e('0x52')]][_0xc01e('0x49')]=_0xc01e('0x55');queues[_0x5df897[_0xc01e('0x52')]]['transferexten']=_0x5df897['origtransfererexten'];queues[_0x5df897[_0xc01e('0x52')]][_0xc01e('0x56')]=_0x5df897[_0xc01e('0x50')];queues[_0x5df897[_0xc01e('0x52')]][_0xc01e('0x8')]='ATTENDEDTRANSFER';}if(!_['isNil'](queues[_0x5df897[_0xc01e('0x51')]])){if(_0x5df897['transfereelinkedid']&&queues[_0x5df897[_0xc01e('0x57')]]){queues[_0x5df897[_0xc01e('0x57')]][_0xc01e('0x22')]=0x1;queues[_0x5df897[_0xc01e('0x48')]]=_[_0xc01e('0x58')](queues[_0x5df897['transfereelinkedid']]);queues[_0x5df897['transfereeuniqueid']][_0xc01e('0xe')]=_0x5df897[_0xc01e('0x59')];queues[_0x5df897[_0xc01e('0x48')]][_0xc01e('0x22')]=0x2;queues[_0x5df897[_0xc01e('0x48')]][_0xc01e('0x6')]=queues[_0x5df897['secondtransfererlinkedid']][_0xc01e('0x6')];queues[_0x5df897[_0xc01e('0x48')]][_0xc01e('0x5a')]=queues[_0x5df897[_0xc01e('0x52')]]['calleridname'];queues[_0x5df897[_0xc01e('0x48')]][_0xc01e('0x5b')]=utils['now']();queues[_0x5df897[_0xc01e('0x48')]]['queuecallerleaveAt']=utils['now']();queues[_0x5df897['transfereeuniqueid']][_0xc01e('0x37')]=0x0;queues[_0x5df897[_0xc01e('0x48')]][_0xc01e('0x5c')]=0x0;utils[_0xc01e('0x1')](util[_0xc01e('0x2')]('[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s',_0x5df897[_0xc01e('0x50')],queues[_0x5df897[_0xc01e('0x48')]][_0xc01e('0x20')],queues[_0x5df897['transfereeuniqueid']][_0xc01e('0x6')],queues[_0x5df897[_0xc01e('0x48')]]['calleridname']));}else{utils[_0xc01e('0x1')](util[_0xc01e('0x2')](_0xc01e('0x5d'),_0x5df897[_0xc01e('0x50')],queues[_0x5df897[_0xc01e('0x51')]][_0xc01e('0x20')],_0x5df897[_0xc01e('0x52')]));queues[_0x5df897[_0xc01e('0x51')]][_0xc01e('0xe')]=_0x5df897[_0xc01e('0x52')];}}}else if(_0x5df897['secondtransfereruniqueid']==_0x5df897[_0xc01e('0x52')]){if(!_['isNil'](queues[_0x5df897[_0xc01e('0x51')]])){utils['info'](util[_0xc01e('0x2')](_0xc01e('0x5e'),_0x5df897['origtransfereruniqueid'],queues[_0x5df897[_0xc01e('0x51')]][_0xc01e('0x20')],_0x5df897[_0xc01e('0x5f')],_0x5df897[_0xc01e('0x60')]));queues[_0x5df897[_0xc01e('0x51')]][_0xc01e('0x43')]=!![];queues[_0x5df897[_0xc01e('0x51')]]['transfertype']=_0xc01e('0x55');queues[_0x5df897[_0xc01e('0x51')]][_0xc01e('0x4b')]=_0x5df897[_0xc01e('0x60')];queues[_0x5df897[_0xc01e('0x51')]][_0xc01e('0x56')]=_0x5df897[_0xc01e('0x5f')];queues[_0x5df897[_0xc01e('0x51')]][_0xc01e('0x8')]=_0xc01e('0x61');}if(!_[_0xc01e('0x18')](queues[_0x5df897[_0xc01e('0x52')]])){if(_0x5df897['transfertargetlinkedid']&&queues[_0x5df897[_0xc01e('0x62')]]){queues[_0x5df897[_0xc01e('0x62')]][_0xc01e('0x22')]=0x1;queues[_0x5df897[_0xc01e('0x59')]]=_[_0xc01e('0x58')](queues[_0x5df897[_0xc01e('0x62')]]);queues[_0x5df897['transfertargetuniqueid']][_0xc01e('0xe')]=_0x5df897[_0xc01e('0x59')];queues[_0x5df897['transfertargetuniqueid']]['queuecallerenterreason']=0x2;queues[_0x5df897[_0xc01e('0x59')]][_0xc01e('0x6')]=queues[_0x5df897[_0xc01e('0x51')]][_0xc01e('0x6')];queues[_0x5df897[_0xc01e('0x59')]]['calleridname']=queues[_0x5df897['origtransfererlinkedid']][_0xc01e('0x5a')];queues[_0x5df897[_0xc01e('0x59')]][_0xc01e('0x5b')]=utils[_0xc01e('0x16')]();queues[_0x5df897[_0xc01e('0x59')]]['queuecallerleaveAt']=utils['now']();queues[_0x5df897[_0xc01e('0x59')]][_0xc01e('0x37')]=0x0;queues[_0x5df897[_0xc01e('0x59')]]['mohtime']=0x0;utils[_0xc01e('0x1')](util[_0xc01e('0x2')](_0xc01e('0x63'),_0x5df897[_0xc01e('0x50')],queues[_0x5df897[_0xc01e('0x59')]][_0xc01e('0x20')],queues[_0x5df897['transfertargetuniqueid']][_0xc01e('0xe')],queues[_0x5df897[_0xc01e('0x59')]][_0xc01e('0x6')],queues[_0x5df897[_0xc01e('0x59')]][_0xc01e('0x5a')]));}else{utils['info'](util['format'](_0xc01e('0x5d'),_0x5df897[_0xc01e('0x50')],queues[_0x5df897[_0xc01e('0x52')]]['name'],_0x5df897[_0xc01e('0x51')]));queues[_0x5df897[_0xc01e('0x52')]][_0xc01e('0xe')]=_0x5df897[_0xc01e('0x51')];}}}}catch(_0x627b2c){utils[_0xc01e('0x17')](util[_0xc01e('0x2')]('[%s][queues][attendedtransfer]',_0x5df897[_0xc01e('0x50')]),_0x627b2c);}};exports[_0xc01e('0x64')]=function(_0x37cc86){try{if(!_[_0xc01e('0x18')](queues[_0x37cc86['uniqueid']])){utils[_0xc01e('0x10')](util[_0xc01e('0x2')]('[%s][queues][musiconholdstart]',_0x37cc86[_0xc01e('0x12')]),_0x37cc86);queues[_0x37cc86[_0xc01e('0x12')]][_0xc01e('0x65')]=utils[_0xc01e('0x16')]();utils[_0xc01e('0x1')](util[_0xc01e('0x2')](_0xc01e('0x66'),_0x37cc86[_0xc01e('0x12')],queues[_0x37cc86[_0xc01e('0x12')]][_0xc01e('0x20')],queues[_0x37cc86[_0xc01e('0x12')]]['musiconholdstartAt']));}}catch(_0x46db59){utils[_0xc01e('0x17')](util[_0xc01e('0x2')]('[%s][queues][musiconholdstart]',_0x37cc86[_0xc01e('0x12')]),_0x46db59);}};exports[_0xc01e('0x67')]=function(_0x5a0d97){try{if(!_[_0xc01e('0x18')](queues[_0x5a0d97[_0xc01e('0x12')]])){if(!_[_0xc01e('0x18')](queues[_0x5a0d97['uniqueid']]['musiconholdstartAt'])){utils[_0xc01e('0x10')](util[_0xc01e('0x2')](_0xc01e('0x68'),_0x5a0d97[_0xc01e('0x12')]),_0x5a0d97);queues[_0x5a0d97[_0xc01e('0x12')]][_0xc01e('0x5c')]+=utils[_0xc01e('0x38')](utils['now'](),queues[_0x5a0d97['uniqueid']]['musiconholdstartAt']);utils['info'](util[_0xc01e('0x2')](_0xc01e('0x69'),_0x5a0d97[_0xc01e('0x12')],queues[_0x5a0d97[_0xc01e('0x12')]][_0xc01e('0x20')],queues[_0x5a0d97[_0xc01e('0x12')]][_0xc01e('0x5c')]));delete queues[_0x5a0d97[_0xc01e('0x12')]][_0xc01e('0x65')];}}}catch(_0x430d1b){utils['error'](util[_0xc01e('0x2')](_0xc01e('0x68'),_0x5a0d97['uniqueid']),_0x430d1b);}}; \ No newline at end of file +var _0x8a42=['queue','lastAssignedTo','calleridnum','queuecallerexitreason','getVoiceQueueByName','then','type','request','CreateVoiceQueueReport','transfereduniqueid','queuecallerjoin','[%s][queues][queuecallerjoin]','format','[%s][queues][queuecallerjoin]\x20name:%s\x20position:%s','position','now','error','isNil','debug','[%s][queues][hangup]','queuecallerabandon','queuecallerexit','queuecallercomplete','COMPLETEDBYAGENT','[%s][queues][hangup]\x20name:%s\x20queuecallerexitreason:%s','name','queuecallerenterreason','varset','[%s][queues][varset]','variable','queuestatus','value','CONTINUE','queuecallerabandonAt','toUpperCase','[%s][queues][varset]\x20name:%s\x20variable:queuestatus\x20value:%s\x20queuecallerexitreason:%s','queueposition','EXITWITHKEY','[%s][queues][varset]\x20name:%s\x20variable:queueposition\x20value:%s\x20queuecallerexitreason:%s','[%s][queues][queuecallerabandon]','ABANDONED','[%s][queues][queuecallerabandon]\x20name:%s\x20queuecallerexitreason:%s','queuecallerleave','[%s][queues][queuecallerleave]','[%s][queues][queuecallerleave]\x20name:%s\x20connectedlinenum:%s\x20connectedlinename:%s','connectedlinenum','connectedlinename','queuecallerleaveAt','diffTime','count','agentconnect','[%s][queues][agentconnect]','[%s][queues][agentconnect]\x20name:%s\x20agent:%s\x20accountcode:%s','membername','queuecallerexitAt','assigned','destaccountcode','[%s][queues][agentcomplete]','queuecallercompleteAt','reason','transfer','COMPLETEDBY','[%s][queues][agentcomplete]\x20name:%s\x20agent:%s\x20queuecallerexitreason:%s','blindtransfer','transfereeuniqueid','[%s][queues][blindtransfer]','transfertype','BLIND','transferexten','extension','transferuniqueid','BLINDTRANSFER','[%s][queues][blindtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:BLINDTRANSFER','attendedtransfer','origtransfereruniqueid','secondtransfererlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER','origtransfererexten','ATTENDED','ATTENDEDTRANSFER','origtransfererlinkedid','transfereelinkedid','clone','transfertargetuniqueid','calleridname','queuecallerjoinAt','mohtime','[%s][queues][attendedtransfer]\x20name:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s','secondtransfereruniqueid','secondtransfererexten','transfertargetlinkedid','[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s\x20calleridnum:%s\x20calleridname:%s','[%s][queues][attendedtransfer]','musiconholdstart','musiconholdstartAt','[%s][queues][musiconholdstop]\x20name:%s\x20musiconholdstartAt:%s','[%s][queues][musiconholdstart]','musiconholdstop','[%s][queues][musiconholdstop]','[%s][queues][musiconholdstop]\x20name:%s\x20mohtime:%s','lodash','util','./utils','info','[%s][queues][writeDB]\x20channel:%s\x20queue:%s\x20lastAssignedTo:%s\x20calleridnum:%s\x20accountcode:%s\x20queuecallerexitreason:%s','uniqueid','channel'];(function(_0x5287cb,_0x2638e4){var _0xbcc8a1=function(_0x3c7bf0){while(--_0x3c7bf0){_0x5287cb['push'](_0x5287cb['shift']());}};_0xbcc8a1(++_0x2638e4);}(_0x8a42,0x1a9));var _0x28a4=function(_0x5c8be0,_0x1c9c30){_0x5c8be0=_0x5c8be0-0x0;var _0x531128=_0x8a42[_0x5c8be0];return _0x531128;};'use strict';var _=require(_0x28a4('0x0'));var util=require(_0x28a4('0x1'));var utils=require(_0x28a4('0x2'));var queues={};function writeDB(_0x2d689b){utils[_0x28a4('0x3')](util['format'](_0x28a4('0x4'),_0x2d689b[_0x28a4('0x5')],_0x2d689b[_0x28a4('0x6')],_0x2d689b[_0x28a4('0x7')],_0x2d689b[_0x28a4('0x8')],_0x2d689b[_0x28a4('0x9')],_0x2d689b['accountcode'],_0x2d689b[_0x28a4('0xa')]));if(_0x2d689b[_0x28a4('0x7')]){utils[_0x28a4('0xb')](_0x2d689b[_0x28a4('0x7')])[_0x28a4('0xc')](function(_0x3896c1){if(_0x3896c1){_0x2d689b[_0x28a4('0xd')]=_0x3896c1[_0x28a4('0xd')];}utils[_0x28a4('0xe')](_0x28a4('0xf'),_0x2d689b);});}else{utils['request'](_0x28a4('0xf'),_0x2d689b);}if(_0x2d689b[_0x28a4('0x10')]){delete queues[_0x2d689b[_0x28a4('0x10')]];}else{delete queues[_0x2d689b['uniqueid']];}}exports[_0x28a4('0x11')]=function(_0x40e8cb){try{utils['debug'](util['format'](_0x28a4('0x12'),_0x40e8cb[_0x28a4('0x5')]),_0x40e8cb);utils['info'](util[_0x28a4('0x13')](_0x28a4('0x14'),_0x40e8cb[_0x28a4('0x5')],_0x40e8cb[_0x28a4('0x7')],_0x40e8cb[_0x28a4('0x15')]));queues[_0x40e8cb[_0x28a4('0x5')]]=_['assign'](_0x40e8cb,{'originalposition':_0x40e8cb[_0x28a4('0x15')],'queuecallerjoinAt':utils[_0x28a4('0x16')](),'mohtime':0x0});}catch(_0x253b84){utils[_0x28a4('0x17')](util[_0x28a4('0x13')]('[%s][queues][queuecallerjoin]',_0x40e8cb[_0x28a4('0x5')]),_0x253b84);}};exports['hangup']=function(_0x3f2d75){try{if(!_[_0x28a4('0x18')](queues[_0x3f2d75[_0x28a4('0x5')]])){utils[_0x28a4('0x19')](util['format'](_0x28a4('0x1a'),_0x3f2d75[_0x28a4('0x5')]),_0x3f2d75);if(queues[_0x3f2d75[_0x28a4('0x5')]]['queuecallerleaveAt']){if(!queues[_0x3f2d75[_0x28a4('0x5')]][_0x28a4('0x1b')]&&!queues[_0x3f2d75['uniqueid']][_0x28a4('0x1c')]){queues[_0x3f2d75['uniqueid']][_0x28a4('0x1d')]=!![];queues[_0x3f2d75[_0x28a4('0x5')]]['queuecallercompleteAt']=utils[_0x28a4('0x16')]();queues[_0x3f2d75['uniqueid']][_0x28a4('0xa')]=_0x28a4('0x1e');}utils['info'](util[_0x28a4('0x13')](_0x28a4('0x1f'),_0x3f2d75['uniqueid'],queues[_0x3f2d75[_0x28a4('0x5')]][_0x28a4('0x20')],queues[_0x3f2d75[_0x28a4('0x5')]][_0x28a4('0xa')]));writeDB(queues[_0x3f2d75[_0x28a4('0x5')]]);}else if(queues[_0x3f2d75[_0x28a4('0x5')]][_0x28a4('0x10')]){utils[_0x28a4('0x3')](util['format']('[%s][queues][hangup]\x20name:%s\x20transfereduniqueid:%s',_0x3f2d75[_0x28a4('0x5')],queues[_0x3f2d75[_0x28a4('0x5')]][_0x28a4('0x20')],queues[_0x3f2d75[_0x28a4('0x5')]]['transfereduniqueid']));queues[queues[_0x3f2d75['uniqueid']]['transfereduniqueid']]=queues[_0x3f2d75[_0x28a4('0x5')]];queues[queues[_0x3f2d75[_0x28a4('0x5')]][_0x28a4('0x10')]][_0x28a4('0x21')]=0x2;delete queues[_0x3f2d75[_0x28a4('0x5')]];}}}catch(_0x2b09a6){utils[_0x28a4('0x17')](util[_0x28a4('0x13')](_0x28a4('0x1a'),_0x3f2d75[_0x28a4('0x5')]),_0x2b09a6);}};exports[_0x28a4('0x22')]=function(_0xf333c4){try{utils[_0x28a4('0x19')](util['format'](_0x28a4('0x23'),_0xf333c4[_0x28a4('0x5')]),_0xf333c4);if(!_[_0x28a4('0x18')](_0xf333c4[_0x28a4('0x24')][_0x28a4('0x25')])&&_0xf333c4[_0x28a4('0x26')]['toUpperCase']()!==_0x28a4('0x27')){if(!_[_0x28a4('0x18')](queues[_0xf333c4[_0x28a4('0x5')]])){queues[_0xf333c4[_0x28a4('0x5')]]['queuecallerabandon']=![];queues[_0xf333c4[_0x28a4('0x5')]][_0x28a4('0x28')]=null;queues[_0xf333c4[_0x28a4('0x5')]]['queuecallerexit']=!![];queues[_0xf333c4[_0x28a4('0x5')]]['queuecallerexitAt']=utils[_0x28a4('0x16')]();queues[_0xf333c4['uniqueid']]['queuecallerexitreason']=_0xf333c4[_0x28a4('0x26')][_0x28a4('0x29')]();utils['info'](util['format'](_0x28a4('0x2a'),_0xf333c4[_0x28a4('0x5')],queues[_0xf333c4['uniqueid']][_0x28a4('0x20')],_0xf333c4['value'],queues[_0xf333c4['uniqueid']][_0x28a4('0xa')]));writeDB(queues[_0xf333c4[_0x28a4('0x5')]]);}}else if(!_[_0x28a4('0x18')](_0xf333c4['variable'][_0x28a4('0x2b')])){if(!_['isNil'](queues[_0xf333c4[_0x28a4('0x5')]])&&!queues[_0xf333c4[_0x28a4('0x5')]]['queuecallerabandon']){queues[_0xf333c4[_0x28a4('0x5')]][_0x28a4('0x1b')]=![];queues[_0xf333c4[_0x28a4('0x5')]][_0x28a4('0x28')]=null;queues[_0xf333c4[_0x28a4('0x5')]]['queuecallerexit']=!![];queues[_0xf333c4[_0x28a4('0x5')]]['queuecallerexitAt']=utils['now']();queues[_0xf333c4['uniqueid']][_0x28a4('0xa')]=_0x28a4('0x2c');utils[_0x28a4('0x3')](util[_0x28a4('0x13')](_0x28a4('0x2d'),_0xf333c4[_0x28a4('0x5')],queues[_0xf333c4[_0x28a4('0x5')]][_0x28a4('0x20')],_0xf333c4[_0x28a4('0x26')],queues[_0xf333c4['uniqueid']]['queuecallerexitreason']));}}}catch(_0x4e4790){utils['error'](util[_0x28a4('0x13')]('[%s][queues][varset]',_0xf333c4[_0x28a4('0x5')]),_0x4e4790);}};exports[_0x28a4('0x1b')]=function(_0x2f06da){try{if(!_[_0x28a4('0x18')](queues[_0x2f06da[_0x28a4('0x5')]])){utils[_0x28a4('0x19')](util[_0x28a4('0x13')](_0x28a4('0x2e'),_0x2f06da[_0x28a4('0x5')]),_0x2f06da);queues[_0x2f06da['uniqueid']][_0x28a4('0x1c')]=![];queues[_0x2f06da['uniqueid']]['queuecallerexitAt']=null;queues[_0x2f06da['uniqueid']][_0x28a4('0x1b')]=!![];queues[_0x2f06da[_0x28a4('0x5')]][_0x28a4('0x28')]=utils[_0x28a4('0x16')]();queues[_0x2f06da[_0x28a4('0x5')]][_0x28a4('0xa')]=_0x28a4('0x2f');utils['info'](util[_0x28a4('0x13')](_0x28a4('0x30'),_0x2f06da[_0x28a4('0x5')],queues[_0x2f06da[_0x28a4('0x5')]]['name'],queues[_0x2f06da[_0x28a4('0x5')]][_0x28a4('0xa')]));}}catch(_0x8c6f0e){utils[_0x28a4('0x17')](util[_0x28a4('0x13')](_0x28a4('0x2e'),_0x2f06da['uniqueid']),_0x8c6f0e);}};exports[_0x28a4('0x31')]=function(_0x30bd3f){try{if(!_[_0x28a4('0x18')](queues[_0x30bd3f['uniqueid']])){utils[_0x28a4('0x19')](util[_0x28a4('0x13')](_0x28a4('0x32'),_0x30bd3f[_0x28a4('0x5')]),_0x30bd3f);utils[_0x28a4('0x3')](util['format'](_0x28a4('0x33'),_0x30bd3f[_0x28a4('0x5')],queues[_0x30bd3f[_0x28a4('0x5')]][_0x28a4('0x20')],_0x30bd3f[_0x28a4('0x34')],_0x30bd3f[_0x28a4('0x35')]));queues[_0x30bd3f['uniqueid']]['queuecallerleave']=!![];queues[_0x30bd3f[_0x28a4('0x5')]][_0x28a4('0x36')]=utils[_0x28a4('0x16')]();queues[_0x30bd3f[_0x28a4('0x5')]]['holdtime']=utils[_0x28a4('0x37')](queues[_0x30bd3f[_0x28a4('0x5')]][_0x28a4('0x36')],queues[_0x30bd3f[_0x28a4('0x5')]]['queuecallerjoinAt']);queues[_0x30bd3f[_0x28a4('0x5')]][_0x28a4('0x15')]=_0x30bd3f[_0x28a4('0x15')];queues[_0x30bd3f[_0x28a4('0x5')]]['count']=_0x30bd3f[_0x28a4('0x38')];queues[_0x30bd3f[_0x28a4('0x5')]]['connectedlinenum']=_0x30bd3f[_0x28a4('0x34')];queues[_0x30bd3f['uniqueid']][_0x28a4('0x35')]=_0x30bd3f[_0x28a4('0x35')];}}catch(_0x399dda){utils[_0x28a4('0x17')](util[_0x28a4('0x13')]('[%s][queues][queuecallerleave]',_0x30bd3f['uniqueid']),_0x399dda);}};exports[_0x28a4('0x39')]=function(_0x5509b6){try{if(!_['isNil'](queues[_0x5509b6[_0x28a4('0x5')]])){utils['debug'](util[_0x28a4('0x13')](_0x28a4('0x3a'),_0x5509b6[_0x28a4('0x5')]),_0x5509b6);utils[_0x28a4('0x3')](util[_0x28a4('0x13')](_0x28a4('0x3b'),_0x5509b6[_0x28a4('0x5')],queues[_0x5509b6[_0x28a4('0x5')]]['name'],_0x5509b6[_0x28a4('0x3c')],_0x5509b6['destaccountcode']));queues[_0x5509b6[_0x28a4('0x5')]][_0x28a4('0x1b')]=![];queues[_0x5509b6[_0x28a4('0x5')]][_0x28a4('0x1b')]=![];queues[_0x5509b6[_0x28a4('0x5')]][_0x28a4('0x28')]=null;queues[_0x5509b6['uniqueid']][_0x28a4('0x1c')]=![];queues[_0x5509b6[_0x28a4('0x5')]]['queuecallerexitreason']=null;queues[_0x5509b6[_0x28a4('0x5')]][_0x28a4('0x3d')]=null;queues[_0x5509b6['uniqueid']][_0x28a4('0x3e')]=!![];queues[_0x5509b6['uniqueid']]['accountcode']=_0x5509b6[_0x28a4('0x3f')];queues[_0x5509b6[_0x28a4('0x5')]][_0x28a4('0x8')]=_0x5509b6['membername'];}}catch(_0xac4fb7){utils['error'](util[_0x28a4('0x13')](_0x28a4('0x3a'),_0x5509b6['uniqueid']),_0xac4fb7);}};exports['agentcomplete']=function(_0x32cae3){try{if(!_[_0x28a4('0x18')](queues[_0x32cae3[_0x28a4('0x5')]])){if(queues[_0x32cae3['uniqueid']][_0x28a4('0x36')]){utils[_0x28a4('0x19')](util['format'](_0x28a4('0x40'),_0x32cae3[_0x28a4('0x5')]),_0x32cae3);queues[_0x32cae3['uniqueid']][_0x28a4('0x1b')]=![];queues[_0x32cae3['uniqueid']]['queuecallerabandon']=![];queues[_0x32cae3[_0x28a4('0x5')]][_0x28a4('0x28')]=null;queues[_0x32cae3[_0x28a4('0x5')]][_0x28a4('0x1c')]=![];queues[_0x32cae3['uniqueid']]['queuecallerexitAt']=null;queues[_0x32cae3[_0x28a4('0x5')]][_0x28a4('0x3e')]=!![];queues[_0x32cae3['uniqueid']][_0x28a4('0x8')]=_0x32cae3[_0x28a4('0x3c')];queues[_0x32cae3[_0x28a4('0x5')]][_0x28a4('0x1d')]=!![];queues[_0x32cae3[_0x28a4('0x5')]][_0x28a4('0x41')]=utils[_0x28a4('0x16')]();if(_0x32cae3[_0x28a4('0x42')]==_0x28a4('0x43')){if(!queues[_0x32cae3[_0x28a4('0x5')]][_0x28a4('0x43')]){queues[_0x32cae3[_0x28a4('0x5')]][_0x28a4('0xa')]='TRANSFER';}}else{queues[_0x32cae3['uniqueid']]['queuecallerexitreason']=_0x28a4('0x44')+_0x32cae3[_0x28a4('0x42')]['toUpperCase']();}utils[_0x28a4('0x3')](util[_0x28a4('0x13')](_0x28a4('0x45'),_0x32cae3[_0x28a4('0x5')],queues[_0x32cae3[_0x28a4('0x5')]][_0x28a4('0x20')],_0x32cae3['membername'],queues[_0x32cae3[_0x28a4('0x5')]]['queuecallerexitreason']));writeDB(queues[_0x32cae3['uniqueid']]);}}}catch(_0x418f36){utils[_0x28a4('0x17')](util[_0x28a4('0x13')](_0x28a4('0x40'),_0x32cae3[_0x28a4('0x5')]),_0x418f36);}};exports[_0x28a4('0x46')]=function(_0x683bb7){try{if(!_[_0x28a4('0x18')](queues[_0x683bb7[_0x28a4('0x47')]])){utils[_0x28a4('0x19')](util[_0x28a4('0x13')](_0x28a4('0x48'),_0x683bb7[_0x28a4('0x5')]),_0x683bb7);queues[_0x683bb7[_0x28a4('0x47')]][_0x28a4('0x43')]=!![];queues[_0x683bb7[_0x28a4('0x47')]][_0x28a4('0x49')]=_0x28a4('0x4a');queues[_0x683bb7[_0x28a4('0x47')]][_0x28a4('0x4b')]=_0x683bb7[_0x28a4('0x4c')];queues[_0x683bb7['transfereeuniqueid']][_0x28a4('0x4d')]=_0x683bb7[_0x28a4('0x47')];queues[_0x683bb7['transfereeuniqueid']][_0x28a4('0xa')]=_0x28a4('0x4e');utils[_0x28a4('0x3')](util[_0x28a4('0x13')](_0x28a4('0x4f'),_0x683bb7[_0x28a4('0x5')],queues[_0x683bb7[_0x28a4('0x47')]]['name'],_0x683bb7[_0x28a4('0x47')],_0x683bb7[_0x28a4('0x4c')]));}}catch(_0x5e2249){utils[_0x28a4('0x17')](util[_0x28a4('0x13')]('[%s][queues][blindtransfer]',_0x683bb7[_0x28a4('0x5')]),_0x5e2249);}};exports[_0x28a4('0x50')]=function(_0x134097){try{utils[_0x28a4('0x19')](util['format']('[%s][queues][attendedtransfer]',_0x134097[_0x28a4('0x51')]),_0x134097);if(_0x134097['origtransfereruniqueid']==_0x134097['origtransfererlinkedid']){if(!_[_0x28a4('0x18')](queues[_0x134097[_0x28a4('0x52')]])){utils[_0x28a4('0x3')](util[_0x28a4('0x13')](_0x28a4('0x53'),_0x134097['origtransfereruniqueid'],queues[_0x134097[_0x28a4('0x52')]][_0x28a4('0x20')],_0x134097[_0x28a4('0x54')]));queues[_0x134097[_0x28a4('0x52')]][_0x28a4('0x43')]=!![];queues[_0x134097[_0x28a4('0x52')]][_0x28a4('0x49')]=_0x28a4('0x55');queues[_0x134097[_0x28a4('0x52')]]['transferexten']=_0x134097[_0x28a4('0x54')];queues[_0x134097[_0x28a4('0x52')]][_0x28a4('0x4d')]=_0x134097[_0x28a4('0x51')];queues[_0x134097[_0x28a4('0x52')]][_0x28a4('0xa')]=_0x28a4('0x56');}if(!_[_0x28a4('0x18')](queues[_0x134097[_0x28a4('0x57')]])){if(_0x134097[_0x28a4('0x58')]&&queues[_0x134097['transfereelinkedid']]){queues[_0x134097['transfereelinkedid']]['queuecallerenterreason']=0x1;queues[_0x134097[_0x28a4('0x47')]]=_[_0x28a4('0x59')](queues[_0x134097[_0x28a4('0x58')]]);queues[_0x134097[_0x28a4('0x47')]][_0x28a4('0x10')]=_0x134097[_0x28a4('0x5a')];queues[_0x134097[_0x28a4('0x47')]][_0x28a4('0x21')]=0x2;queues[_0x134097['transfereeuniqueid']][_0x28a4('0x9')]=queues[_0x134097['secondtransfererlinkedid']][_0x28a4('0x9')];queues[_0x134097['transfereeuniqueid']][_0x28a4('0x5b')]=queues[_0x134097[_0x28a4('0x52')]][_0x28a4('0x5b')];queues[_0x134097['transfereeuniqueid']][_0x28a4('0x5c')]=utils[_0x28a4('0x16')]();queues[_0x134097['transfereeuniqueid']][_0x28a4('0x36')]=utils['now']();queues[_0x134097[_0x28a4('0x47')]]['holdtime']=0x0;queues[_0x134097[_0x28a4('0x47')]][_0x28a4('0x5d')]=0x0;utils[_0x28a4('0x3')](util[_0x28a4('0x13')](_0x28a4('0x5e'),_0x134097[_0x28a4('0x51')],queues[_0x134097[_0x28a4('0x47')]][_0x28a4('0x20')],queues[_0x134097[_0x28a4('0x47')]]['calleridnum'],queues[_0x134097[_0x28a4('0x47')]][_0x28a4('0x5b')]));}else{utils[_0x28a4('0x3')](util[_0x28a4('0x13')](_0x28a4('0x5f'),_0x134097['origtransfereruniqueid'],queues[_0x134097[_0x28a4('0x57')]][_0x28a4('0x20')],_0x134097[_0x28a4('0x52')]));queues[_0x134097[_0x28a4('0x57')]][_0x28a4('0x10')]=_0x134097[_0x28a4('0x52')];}}}else if(_0x134097['secondtransfereruniqueid']==_0x134097[_0x28a4('0x52')]){if(!_[_0x28a4('0x18')](queues[_0x134097[_0x28a4('0x57')]])){utils[_0x28a4('0x3')](util[_0x28a4('0x13')]('[%s][queues][attendedtransfer]\x20name:%s\x20transferuniqueid:%s\x20transferexten:%s\x20queuecallerexitreason:ATTENDEDTRANSFER',_0x134097['origtransfereruniqueid'],queues[_0x134097['origtransfererlinkedid']][_0x28a4('0x20')],_0x134097[_0x28a4('0x60')],_0x134097[_0x28a4('0x61')]));queues[_0x134097[_0x28a4('0x57')]]['transfer']=!![];queues[_0x134097[_0x28a4('0x57')]][_0x28a4('0x49')]=_0x28a4('0x55');queues[_0x134097[_0x28a4('0x57')]][_0x28a4('0x4b')]=_0x134097[_0x28a4('0x61')];queues[_0x134097[_0x28a4('0x57')]]['transferuniqueid']=_0x134097[_0x28a4('0x60')];queues[_0x134097[_0x28a4('0x57')]][_0x28a4('0xa')]=_0x28a4('0x56');}if(!_[_0x28a4('0x18')](queues[_0x134097[_0x28a4('0x52')]])){if(_0x134097[_0x28a4('0x62')]&&queues[_0x134097[_0x28a4('0x62')]]){queues[_0x134097[_0x28a4('0x62')]]['queuecallerenterreason']=0x1;queues[_0x134097[_0x28a4('0x5a')]]=_['clone'](queues[_0x134097[_0x28a4('0x62')]]);queues[_0x134097[_0x28a4('0x5a')]][_0x28a4('0x10')]=_0x134097['transfertargetuniqueid'];queues[_0x134097[_0x28a4('0x5a')]]['queuecallerenterreason']=0x2;queues[_0x134097[_0x28a4('0x5a')]][_0x28a4('0x9')]=queues[_0x134097[_0x28a4('0x57')]][_0x28a4('0x9')];queues[_0x134097[_0x28a4('0x5a')]][_0x28a4('0x5b')]=queues[_0x134097['origtransfererlinkedid']]['calleridname'];queues[_0x134097[_0x28a4('0x5a')]]['queuecallerjoinAt']=utils[_0x28a4('0x16')]();queues[_0x134097[_0x28a4('0x5a')]][_0x28a4('0x36')]=utils[_0x28a4('0x16')]();queues[_0x134097[_0x28a4('0x5a')]]['holdtime']=0x0;queues[_0x134097[_0x28a4('0x5a')]][_0x28a4('0x5d')]=0x0;utils['info'](util[_0x28a4('0x13')](_0x28a4('0x63'),_0x134097[_0x28a4('0x51')],queues[_0x134097[_0x28a4('0x5a')]][_0x28a4('0x20')],queues[_0x134097['transfertargetuniqueid']][_0x28a4('0x10')],queues[_0x134097[_0x28a4('0x5a')]]['calleridnum'],queues[_0x134097['transfertargetuniqueid']]['calleridname']));}else{utils[_0x28a4('0x3')](util['format']('[%s][queues][attendedtransfer]\x20name:%s\x20transfereduniqueid:%s',_0x134097['origtransfereruniqueid'],queues[_0x134097[_0x28a4('0x52')]][_0x28a4('0x20')],_0x134097[_0x28a4('0x57')]));queues[_0x134097[_0x28a4('0x52')]][_0x28a4('0x10')]=_0x134097['origtransfererlinkedid'];}}}}catch(_0x20ad0e){utils[_0x28a4('0x17')](util['format'](_0x28a4('0x64'),_0x134097[_0x28a4('0x51')]),_0x20ad0e);}};exports[_0x28a4('0x65')]=function(_0x324fac){try{if(!_[_0x28a4('0x18')](queues[_0x324fac[_0x28a4('0x5')]])){utils[_0x28a4('0x19')](util[_0x28a4('0x13')]('[%s][queues][musiconholdstart]',_0x324fac[_0x28a4('0x5')]),_0x324fac);queues[_0x324fac[_0x28a4('0x5')]][_0x28a4('0x66')]=utils['now']();utils[_0x28a4('0x3')](util[_0x28a4('0x13')](_0x28a4('0x67'),_0x324fac[_0x28a4('0x5')],queues[_0x324fac[_0x28a4('0x5')]]['name'],queues[_0x324fac['uniqueid']][_0x28a4('0x66')]));}}catch(_0x2e2030){utils[_0x28a4('0x17')](util[_0x28a4('0x13')](_0x28a4('0x68'),_0x324fac[_0x28a4('0x5')]),_0x2e2030);}};exports[_0x28a4('0x69')]=function(_0x48d53a){try{if(!_[_0x28a4('0x18')](queues[_0x48d53a[_0x28a4('0x5')]])){if(!_[_0x28a4('0x18')](queues[_0x48d53a[_0x28a4('0x5')]][_0x28a4('0x66')])){utils[_0x28a4('0x19')](util['format'](_0x28a4('0x6a'),_0x48d53a[_0x28a4('0x5')]),_0x48d53a);queues[_0x48d53a[_0x28a4('0x5')]][_0x28a4('0x5d')]+=utils['diffTime'](utils[_0x28a4('0x16')](),queues[_0x48d53a[_0x28a4('0x5')]]['musiconholdstartAt']);utils['info'](util['format'](_0x28a4('0x6b'),_0x48d53a[_0x28a4('0x5')],queues[_0x48d53a[_0x28a4('0x5')]][_0x28a4('0x20')],queues[_0x48d53a['uniqueid']][_0x28a4('0x5d')]));delete queues[_0x48d53a[_0x28a4('0x5')]]['musiconholdstartAt'];}}}catch(_0x3605e2){utils[_0x28a4('0x17')](util[_0x28a4('0x13')](_0x28a4('0x6a'),_0x48d53a[_0x28a4('0x5')]),_0x3605e2);}}; \ No newline at end of file diff --git a/server/services/xdr/recordings.controller.js b/server/services/xdr/recordings.controller.js index d870864..5672df8 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 _0xc1e3=['recording','lodash','util','./utils','./transfers.controller','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','getUserByInternal','accountcode','then','membername','name','request','CreateVoiceRecording','newchannel','debug','[%s][recordings][newchannel]','linkedid','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','context','exten','channel','error','newstate','[%s][recordings][newstate]','isNil','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','varset','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','.wav49','replace','.WAV','find','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','calleridname','cause-txt','calleridnum','connectedlinenum','connectedlinename','type','outbound','forEach','newexten','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','appdata','set','toLowerCase','cdr','split','substring','lastIndexOf','queuecallerjoin','[%s][recordings][queuecallerjoin]\x20queue:%s','queue','[%s][recordings][queuecallerjoin]','blindtransfer','[%s][recordings][blindtransfer]','transfereecalleridname','transfereruniqueid'];(function(_0x2f54b6,_0x3cc6cb){var _0x169f21=function(_0x4dac27){while(--_0x4dac27){_0x2f54b6['push'](_0x2f54b6['shift']());}};_0x169f21(++_0x3cc6cb);}(_0xc1e3,0x1b1));var _0x3c1e=function(_0x30d202,_0x2809ad){_0x30d202=_0x30d202-0x0;var _0x52d5e1=_0xc1e3[_0x30d202];return _0x52d5e1;};'use strict';var _=require(_0x3c1e('0x0'));var util=require(_0x3c1e('0x1'));var utils=require(_0x3c1e('0x2'));var transfers=require(_0x3c1e('0x3'));var recordings={};function writeDB(_0x166a69){var _0x1f14ea;utils[_0x3c1e('0x4')](util[_0x3c1e('0x5')](_0x3c1e('0x6'),_0x166a69[_0x3c1e('0x7')]));if(transfers[_0x3c1e('0x8')][_0x166a69[_0x3c1e('0x7')]]){_0x1f14ea=_0x166a69[_0x3c1e('0x7')];_0x166a69['uniqueid']=transfers[_0x3c1e('0x8')][_0x166a69[_0x3c1e('0x7')]][_0x3c1e('0x9')];}if(_0x166a69['accountcode']){utils[_0x3c1e('0xa')](_0x166a69[_0x3c1e('0xb')])[_0x3c1e('0xc')](function(_0x3e5fc8){if(_0x3e5fc8){_0x166a69[_0x3c1e('0xd')]=_0x3e5fc8[_0x3c1e('0xe')];_0x166a69['UserId']=_0x3e5fc8['id'];}utils[_0x3c1e('0xf')](_0x3c1e('0x10'),_0x166a69);});}else{utils['request']('CreateVoiceRecording',_0x166a69);}if(_0x1f14ea)delete transfers[_0x3c1e('0x8')][_0x1f14ea];}exports[_0x3c1e('0x11')]=function(_0x2a4c00){try{utils[_0x3c1e('0x12')](util['format'](_0x3c1e('0x13'),_0x2a4c00[_0x3c1e('0x7')]),_0x2a4c00);if(_0x2a4c00[_0x3c1e('0x7')]==_0x2a4c00[_0x3c1e('0x14')]){utils[_0x3c1e('0x4')](util['format'](_0x3c1e('0x15'),_0x2a4c00[_0x3c1e('0x7')],_0x2a4c00[_0x3c1e('0x16')],_0x2a4c00[_0x3c1e('0x17')]));recordings[_0x2a4c00[_0x3c1e('0x7')]]={'uniqueid':_0x2a4c00[_0x3c1e('0x7')],'accountcode':_0x2a4c00[_0x3c1e('0xb')],'exten':_0x2a4c00[_0x3c1e('0x17')],'context':_0x2a4c00[_0x3c1e('0x16')],'channel':_0x2a4c00[_0x3c1e('0x18')],'monitors':[]};}}catch(_0x4988d3){utils[_0x3c1e('0x19')](util['format']('[%s][recordings][newchannel]',_0x2a4c00['uniqueid']),_0x4988d3);}};exports[_0x3c1e('0x1a')]=function(_0x111278){try{utils[_0x3c1e('0x12')](util[_0x3c1e('0x5')](_0x3c1e('0x1b'),_0x111278[_0x3c1e('0x7')]),_0x111278);if(!_[_0x3c1e('0x1c')](recordings[_0x111278['uniqueid']])&&_0x111278[_0x3c1e('0x1d')]==0x6){utils[_0x3c1e('0x4')](util['format'](_0x3c1e('0x1e'),_0x111278[_0x3c1e('0x7')],_0x111278['context'],_0x111278[_0x3c1e('0x18')]));}else if(!_[_0x3c1e('0x1c')](recordings[_0x111278[_0x3c1e('0x14')]])&&_0x111278['channelstate']==0x6&&_0x111278[_0x3c1e('0x16')]!='transfer'){utils[_0x3c1e('0x4')](util[_0x3c1e('0x5')]('[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s',_0x111278[_0x3c1e('0x7')],_0x111278[_0x3c1e('0x14')],_0x111278['context'],_0x111278['channel']));recordings[_0x111278[_0x3c1e('0x14')]][_0x3c1e('0xb')]=_0x111278['accountcode'];}}catch(_0x365db9){utils[_0x3c1e('0x19')](util[_0x3c1e('0x5')]('[%s][recordings][newstate]',_0x111278[_0x3c1e('0x7')]),_0x365db9);}};exports[_0x3c1e('0x1f')]=function(_0x1a5142){try{if(!_[_0x3c1e('0x1c')](_0x1a5142[_0x3c1e('0x20')])&&!_['isNil'](_0x1a5142[_0x3c1e('0x20')]['mixmonitor_filename'])){utils[_0x3c1e('0x12')](util[_0x3c1e('0x5')](_0x3c1e('0x21'),_0x1a5142['uniqueid']),_0x1a5142);utils['info'](util[_0x3c1e('0x5')](_0x3c1e('0x22'),_0x1a5142[_0x3c1e('0x7')],_0x1a5142[_0x3c1e('0x20')],_0x1a5142[_0x3c1e('0x23')]));if(_['endsWith'](_0x1a5142[_0x3c1e('0x23')],_0x3c1e('0x24'))){_0x1a5142['value']=_0x1a5142[_0x3c1e('0x23')][_0x3c1e('0x25')](_0x3c1e('0x24'),_0x3c1e('0x26'));}if(recordings[_0x1a5142[_0x3c1e('0x14')]]){var _0x18e13e=_[_0x3c1e('0x27')](recordings[_0x1a5142[_0x3c1e('0x14')]][_0x3c1e('0x28')],{'value':_0x1a5142[_0x3c1e('0x23')]});if(_[_0x3c1e('0x1c')](_0x18e13e)){recordings[_0x1a5142['linkedid']]['monitors'][_0x3c1e('0x29')]({'value':_0x1a5142['value']});}}}}catch(_0x225426){utils[_0x3c1e('0x19')](util[_0x3c1e('0x5')](_0x3c1e('0x21'),_0x1a5142[_0x3c1e('0x7')]),_0x225426);}};exports[_0x3c1e('0x2a')]=function(_0x4c2af5){try{if(!_[_0x3c1e('0x1c')](recordings[_0x4c2af5['uniqueid']])){utils['debug'](util[_0x3c1e('0x5')](_0x3c1e('0x2b'),_0x4c2af5[_0x3c1e('0x7')]),_0x4c2af5);utils[_0x3c1e('0x4')](util[_0x3c1e('0x5')](_0x3c1e('0x2c'),_0x4c2af5[_0x3c1e('0x7')],_0x4c2af5['calleridnum'],_0x4c2af5[_0x3c1e('0x2d')],_0x4c2af5[_0x3c1e('0x2e')]));recordings[_0x4c2af5[_0x3c1e('0x7')]][_0x3c1e('0x2f')]=_0x4c2af5[_0x3c1e('0x2f')];recordings[_0x4c2af5[_0x3c1e('0x7')]][_0x3c1e('0x2d')]=_0x4c2af5[_0x3c1e('0x2d')];recordings[_0x4c2af5[_0x3c1e('0x7')]][_0x3c1e('0x30')]=_0x4c2af5[_0x3c1e('0x30')];recordings[_0x4c2af5[_0x3c1e('0x7')]][_0x3c1e('0x31')]=_0x4c2af5[_0x3c1e('0x31')];if(recordings[_0x4c2af5[_0x3c1e('0x7')]][_0x3c1e('0x32')]==_0x3c1e('0x33')&&recordings[_0x4c2af5[_0x3c1e('0x7')]][_0x3c1e('0xb')]){recordings[_0x4c2af5[_0x3c1e('0x7')]][_0x3c1e('0x30')]=recordings[_0x4c2af5[_0x3c1e('0x7')]]['accountcode'];recordings[_0x4c2af5[_0x3c1e('0x7')]][_0x3c1e('0x31')]='';}recordings[_0x4c2af5['uniqueid']]['monitors'][_0x3c1e('0x34')](function(_0x21b938){var _0x431963=_['clone'](recordings[_0x4c2af5[_0x3c1e('0x7')]]);_0x431963[_0x3c1e('0x23')]=_0x21b938[_0x3c1e('0x23')];writeDB(_0x431963);});delete recordings[_0x4c2af5[_0x3c1e('0x7')]];}}catch(_0x412d41){utils[_0x3c1e('0x19')](util[_0x3c1e('0x5')](_0x3c1e('0x2b'),_0x4c2af5[_0x3c1e('0x7')]),_0x412d41);}};exports[_0x3c1e('0x35')]=function(_0x28c0dc){try{if(!_['isNil'](recordings[_0x28c0dc[_0x3c1e('0x7')]])){utils[_0x3c1e('0x12')](util[_0x3c1e('0x5')](_0x3c1e('0x36'),_0x28c0dc[_0x3c1e('0x7')]),_0x28c0dc);utils['info'](util['format'](_0x3c1e('0x37'),_0x28c0dc[_0x3c1e('0x7')],_0x28c0dc['application'],_0x28c0dc[_0x3c1e('0x38')]));if(_0x28c0dc['application']['toLowerCase']()==_0x3c1e('0x39')&&_['startsWith'](_0x28c0dc['appdata'][_0x3c1e('0x3a')](),_0x3c1e('0x3b'))){var _0x5c9b01=_0x28c0dc[_0x3c1e('0x38')][_0x3c1e('0x3c')]('=');var _0x296874=_0x5c9b01[0x0][_0x3c1e('0x3d')](_0x5c9b01[0x0][_0x3c1e('0x3e')]('(')+0x1,_0x5c9b01[0x0][_0x3c1e('0x3e')](')'));var _0x392fe2=_0x5c9b01[0x1];recordings[_0x28c0dc[_0x3c1e('0x7')]][_0x296874]=_0x392fe2;}}}catch(_0x52f8d8){utils['error'](util[_0x3c1e('0x5')](_0x3c1e('0x36'),_0x28c0dc['uniqueid']),_0x52f8d8);}};exports[_0x3c1e('0x3f')]=function(_0x270ee1){try{if(!_[_0x3c1e('0x1c')](recordings[_0x270ee1[_0x3c1e('0x7')]])){utils[_0x3c1e('0x12')](util[_0x3c1e('0x5')]('[%s][recordings][queuecallerjoin]',_0x270ee1[_0x3c1e('0x7')]),_0x270ee1);utils[_0x3c1e('0x4')](util[_0x3c1e('0x5')](_0x3c1e('0x40'),_0x270ee1[_0x3c1e('0x7')],_0x270ee1[_0x3c1e('0x41')]));recordings[_0x270ee1[_0x3c1e('0x7')]]['queue']=_0x270ee1[_0x3c1e('0x41')];}}catch(_0x3e3930){utils[_0x3c1e('0x19')](util[_0x3c1e('0x5')](_0x3c1e('0x42'),_0x270ee1[_0x3c1e('0x7')]),_0x3e3930);}};exports[_0x3c1e('0x43')]=function(_0xeabf6f){try{utils['debug'](util['format'](_0x3c1e('0x44'),_0xeabf6f[_0x3c1e('0x7')]),_0xeabf6f);utils[_0x3c1e('0x4')](util[_0x3c1e('0x5')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0xeabf6f[_0x3c1e('0x7')],_0xeabf6f['transferercalleridnum'],_0xeabf6f['transferercalleridname'],_0xeabf6f['transfereecalleridnum'],_0xeabf6f[_0x3c1e('0x45')]));if(recordings[_0xeabf6f[_0x3c1e('0x46')]]&&transfers[_0x3c1e('0x8')][_0xeabf6f['transfereruniqueid']]){transfers[_0x3c1e('0x8')][_0xeabf6f[_0x3c1e('0x46')]][_0x3c1e('0x47')]=!![];}}catch(_0xfeb3e2){utils[_0x3c1e('0x19')](util[_0x3c1e('0x5')]('[%s][recordings][blindtransfer]',_0xeabf6f[_0x3c1e('0x7')]),_0xfeb3e2);}}; \ No newline at end of file +var _0xe5f3=['split','substring','lastIndexOf','[%s][recordings][queuecallerjoin]','queue','blindtransfer','transferercalleridnum','transferercalleridname','transfereecalleridnum','transfereecalleridname','transfereruniqueid','recording','[%s][recordings][blindtransfer]','util','./utils','info','format','[%s][recordings][writeDB]','uniqueid','blinds','transfereeuniqueid','accountcode','then','membername','name','request','CreateVoiceRecording','debug','[%s][recordings][newchannel]','[%s][recordings][newchannel]\x20context:%s\x20exten:%s','exten','context','channel','error','newstate','channelstate','[%s][recordings][newstate]\x20context:%s\x20channel:%s','[%s][recordings][newstate]\x20linkedid:%s\x20context:%s\x20channel:%s','linkedid','[%s][recordings][newstate]','isNil','variable','[%s][recordings][varset]','[%s][recordings][varset]\x20variable:%s\x20value:%s','value','endsWith','.wav49','replace','.WAV','monitors','push','hangup','[%s][recordings][hangup]','[%s][recordings][hangup]\x20calleridnum:%s\x20calleridname:%s\x20reason:%s','cause-txt','calleridnum','calleridname','connectedlinenum','connectedlinename','type','outbound','forEach','clone','[%s][recordings][newexten]','[%s][recordings][newexten]\x20application:%s\x20appdata:%s','application','appdata','set','toLowerCase','cdr'];(function(_0x5ff594,_0x5ebf44){var _0x364e2b=function(_0x26fe57){while(--_0x26fe57){_0x5ff594['push'](_0x5ff594['shift']());}};_0x364e2b(++_0x5ebf44);}(_0xe5f3,0x99));var _0x3e5f=function(_0x22b95b,_0x2c695e){_0x22b95b=_0x22b95b-0x0;var _0x32728b=_0xe5f3[_0x22b95b];return _0x32728b;};'use strict';var _=require('lodash');var util=require(_0x3e5f('0x0'));var utils=require(_0x3e5f('0x1'));var transfers=require('./transfers.controller');var recordings={};function writeDB(_0x437fa3){var _0x5b9fda;utils[_0x3e5f('0x2')](util[_0x3e5f('0x3')](_0x3e5f('0x4'),_0x437fa3[_0x3e5f('0x5')]));if(transfers[_0x3e5f('0x6')][_0x437fa3[_0x3e5f('0x5')]]){_0x5b9fda=_0x437fa3['uniqueid'];_0x437fa3[_0x3e5f('0x5')]=transfers[_0x3e5f('0x6')][_0x437fa3['uniqueid']][_0x3e5f('0x7')];}if(_0x437fa3[_0x3e5f('0x8')]){utils['getUserByInternal'](_0x437fa3[_0x3e5f('0x8')])[_0x3e5f('0x9')](function(_0x2f0d4a){if(_0x2f0d4a){_0x437fa3[_0x3e5f('0xa')]=_0x2f0d4a[_0x3e5f('0xb')];_0x437fa3['UserId']=_0x2f0d4a['id'];}utils[_0x3e5f('0xc')](_0x3e5f('0xd'),_0x437fa3);});}else{utils[_0x3e5f('0xc')](_0x3e5f('0xd'),_0x437fa3);}if(_0x5b9fda)delete transfers['blinds'][_0x5b9fda];}exports['newchannel']=function(_0x3721e9){try{utils[_0x3e5f('0xe')](util[_0x3e5f('0x3')](_0x3e5f('0xf'),_0x3721e9[_0x3e5f('0x5')]),_0x3721e9);if(_0x3721e9[_0x3e5f('0x5')]==_0x3721e9['linkedid']){utils['info'](util[_0x3e5f('0x3')](_0x3e5f('0x10'),_0x3721e9[_0x3e5f('0x5')],_0x3721e9['context'],_0x3721e9['exten']));recordings[_0x3721e9[_0x3e5f('0x5')]]={'uniqueid':_0x3721e9[_0x3e5f('0x5')],'accountcode':_0x3721e9[_0x3e5f('0x8')],'exten':_0x3721e9[_0x3e5f('0x11')],'context':_0x3721e9[_0x3e5f('0x12')],'channel':_0x3721e9[_0x3e5f('0x13')],'monitors':[]};}}catch(_0x34719f){utils[_0x3e5f('0x14')](util[_0x3e5f('0x3')]('[%s][recordings][newchannel]',_0x3721e9[_0x3e5f('0x5')]),_0x34719f);}};exports[_0x3e5f('0x15')]=function(_0x157cad){try{utils[_0x3e5f('0xe')](util[_0x3e5f('0x3')]('[%s][recordings][newstate]',_0x157cad[_0x3e5f('0x5')]),_0x157cad);if(!_['isNil'](recordings[_0x157cad[_0x3e5f('0x5')]])&&_0x157cad[_0x3e5f('0x16')]==0x6){utils[_0x3e5f('0x2')](util[_0x3e5f('0x3')](_0x3e5f('0x17'),_0x157cad[_0x3e5f('0x5')],_0x157cad[_0x3e5f('0x12')],_0x157cad['channel']));}else if(!_['isNil'](recordings[_0x157cad['linkedid']])&&_0x157cad[_0x3e5f('0x16')]==0x6&&_0x157cad[_0x3e5f('0x12')]!='transfer'){utils[_0x3e5f('0x2')](util['format'](_0x3e5f('0x18'),_0x157cad[_0x3e5f('0x5')],_0x157cad[_0x3e5f('0x19')],_0x157cad[_0x3e5f('0x12')],_0x157cad['channel']));recordings[_0x157cad[_0x3e5f('0x19')]][_0x3e5f('0x8')]=_0x157cad[_0x3e5f('0x8')];}}catch(_0x488a07){utils[_0x3e5f('0x14')](util[_0x3e5f('0x3')](_0x3e5f('0x1a'),_0x157cad[_0x3e5f('0x5')]),_0x488a07);}};exports['varset']=function(_0x4c93ea){try{if(!_[_0x3e5f('0x1b')](_0x4c93ea[_0x3e5f('0x1c')])&&!_[_0x3e5f('0x1b')](_0x4c93ea[_0x3e5f('0x1c')]['mixmonitor_filename'])){utils[_0x3e5f('0xe')](util[_0x3e5f('0x3')](_0x3e5f('0x1d'),_0x4c93ea['uniqueid']),_0x4c93ea);utils['info'](util['format'](_0x3e5f('0x1e'),_0x4c93ea[_0x3e5f('0x5')],_0x4c93ea[_0x3e5f('0x1c')],_0x4c93ea[_0x3e5f('0x1f')]));if(_[_0x3e5f('0x20')](_0x4c93ea[_0x3e5f('0x1f')],_0x3e5f('0x21'))){_0x4c93ea['value']=_0x4c93ea['value'][_0x3e5f('0x22')](_0x3e5f('0x21'),_0x3e5f('0x23'));}if(recordings[_0x4c93ea[_0x3e5f('0x19')]]){var _0x5bd816=_['find'](recordings[_0x4c93ea[_0x3e5f('0x19')]][_0x3e5f('0x24')],{'value':_0x4c93ea['value']});if(_[_0x3e5f('0x1b')](_0x5bd816)){recordings[_0x4c93ea[_0x3e5f('0x19')]][_0x3e5f('0x24')][_0x3e5f('0x25')]({'value':_0x4c93ea[_0x3e5f('0x1f')]});}}}}catch(_0x49aab){utils['error'](util[_0x3e5f('0x3')](_0x3e5f('0x1d'),_0x4c93ea[_0x3e5f('0x5')]),_0x49aab);}};exports[_0x3e5f('0x26')]=function(_0x2826fa){try{if(!_[_0x3e5f('0x1b')](recordings[_0x2826fa[_0x3e5f('0x5')]])){utils['debug'](util['format'](_0x3e5f('0x27'),_0x2826fa[_0x3e5f('0x5')]),_0x2826fa);utils[_0x3e5f('0x2')](util[_0x3e5f('0x3')](_0x3e5f('0x28'),_0x2826fa[_0x3e5f('0x5')],_0x2826fa['calleridnum'],_0x2826fa['calleridname'],_0x2826fa[_0x3e5f('0x29')]));recordings[_0x2826fa[_0x3e5f('0x5')]][_0x3e5f('0x2a')]=_0x2826fa[_0x3e5f('0x2a')];recordings[_0x2826fa[_0x3e5f('0x5')]][_0x3e5f('0x2b')]=_0x2826fa['calleridname'];recordings[_0x2826fa[_0x3e5f('0x5')]]['connectedlinenum']=_0x2826fa[_0x3e5f('0x2c')];recordings[_0x2826fa[_0x3e5f('0x5')]][_0x3e5f('0x2d')]=_0x2826fa[_0x3e5f('0x2d')];if(recordings[_0x2826fa[_0x3e5f('0x5')]][_0x3e5f('0x2e')]==_0x3e5f('0x2f')&&recordings[_0x2826fa[_0x3e5f('0x5')]][_0x3e5f('0x8')]){recordings[_0x2826fa[_0x3e5f('0x5')]]['connectedlinenum']=recordings[_0x2826fa[_0x3e5f('0x5')]][_0x3e5f('0x8')];recordings[_0x2826fa[_0x3e5f('0x5')]][_0x3e5f('0x2d')]='';}recordings[_0x2826fa[_0x3e5f('0x5')]][_0x3e5f('0x24')][_0x3e5f('0x30')](function(_0xcbb807){var _0x24a938=_[_0x3e5f('0x31')](recordings[_0x2826fa[_0x3e5f('0x5')]]);_0x24a938[_0x3e5f('0x1f')]=_0xcbb807[_0x3e5f('0x1f')];writeDB(_0x24a938);});delete recordings[_0x2826fa[_0x3e5f('0x5')]];}}catch(_0x4fb8a1){utils[_0x3e5f('0x14')](util[_0x3e5f('0x3')](_0x3e5f('0x27'),_0x2826fa['uniqueid']),_0x4fb8a1);}};exports['newexten']=function(_0x1951c1){try{if(!_['isNil'](recordings[_0x1951c1[_0x3e5f('0x5')]])){utils[_0x3e5f('0xe')](util[_0x3e5f('0x3')](_0x3e5f('0x32'),_0x1951c1[_0x3e5f('0x5')]),_0x1951c1);utils[_0x3e5f('0x2')](util[_0x3e5f('0x3')](_0x3e5f('0x33'),_0x1951c1[_0x3e5f('0x5')],_0x1951c1[_0x3e5f('0x34')],_0x1951c1[_0x3e5f('0x35')]));if(_0x1951c1[_0x3e5f('0x34')]['toLowerCase']()==_0x3e5f('0x36')&&_['startsWith'](_0x1951c1[_0x3e5f('0x35')][_0x3e5f('0x37')](),_0x3e5f('0x38'))){var _0xb82945=_0x1951c1['appdata'][_0x3e5f('0x39')]('=');var _0x16e0a8=_0xb82945[0x0][_0x3e5f('0x3a')](_0xb82945[0x0][_0x3e5f('0x3b')]('(')+0x1,_0xb82945[0x0][_0x3e5f('0x3b')](')'));var _0x2d5a09=_0xb82945[0x1];recordings[_0x1951c1['uniqueid']][_0x16e0a8]=_0x2d5a09;}}}catch(_0x2b8f26){utils[_0x3e5f('0x14')](util[_0x3e5f('0x3')](_0x3e5f('0x32'),_0x1951c1[_0x3e5f('0x5')]),_0x2b8f26);}};exports['queuecallerjoin']=function(_0x589ee9){try{if(!_[_0x3e5f('0x1b')](recordings[_0x589ee9[_0x3e5f('0x5')]])){utils['debug'](util[_0x3e5f('0x3')](_0x3e5f('0x3c'),_0x589ee9[_0x3e5f('0x5')]),_0x589ee9);utils[_0x3e5f('0x2')](util[_0x3e5f('0x3')]('[%s][recordings][queuecallerjoin]\x20queue:%s',_0x589ee9[_0x3e5f('0x5')],_0x589ee9[_0x3e5f('0x3d')]));recordings[_0x589ee9[_0x3e5f('0x5')]][_0x3e5f('0x3d')]=_0x589ee9['queue'];}}catch(_0x2a0e5f){utils[_0x3e5f('0x14')](util[_0x3e5f('0x3')](_0x3e5f('0x3c'),_0x589ee9['uniqueid']),_0x2a0e5f);}};exports[_0x3e5f('0x3e')]=function(_0x3b0e4e){try{utils['debug'](util[_0x3e5f('0x3')]('[%s][recordings][blindtransfer]',_0x3b0e4e[_0x3e5f('0x5')]),_0x3b0e4e);utils[_0x3e5f('0x2')](util[_0x3e5f('0x3')]('[%s][recordings][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x3b0e4e[_0x3e5f('0x5')],_0x3b0e4e[_0x3e5f('0x3f')],_0x3b0e4e[_0x3e5f('0x40')],_0x3b0e4e[_0x3e5f('0x41')],_0x3b0e4e[_0x3e5f('0x42')]));if(recordings[_0x3b0e4e[_0x3e5f('0x43')]]&&transfers['blinds'][_0x3b0e4e[_0x3e5f('0x43')]]){transfers[_0x3e5f('0x6')][_0x3b0e4e['transfereruniqueid']][_0x3e5f('0x44')]=!![];}}catch(_0x5e97c8){utils[_0x3e5f('0x14')](util[_0x3e5f('0x3')](_0x3e5f('0x45'),_0x3b0e4e['uniqueid']),_0x5e97c8);}}; \ No newline at end of file diff --git a/server/services/xdr/transfers.controller.js b/server/services/xdr/transfers.controller.js index bcc0039..25890f6 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 _0xac08=['transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetconnectedlinename','transfertargetaccountcode','transfertargetcontext','transfertargetexten','origtransfereruniqueid','lodash','./utils','format','[%s][transfers][writeDB]\x20type:%s','attended','uniqueid','request','CreateVoiceTransferReport','blinds','blindtransfer','debug','[%s][transfers][blindtransfer]','transferercalleridname','transfereecalleridnum','type','transfereruniqueid','error','[%s][transfers][attendedtransfer]','info','origtransferercalleridnum','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransfererlinkedid','origtransferercontext','origtransfererexten'];(function(_0x32bebd,_0x17ca38){var _0xcb84d2=function(_0x3bead2){while(--_0x3bead2){_0x32bebd['push'](_0x32bebd['shift']());}};_0xcb84d2(++_0x17ca38);}(_0xac08,0xf8));var _0x8ac0=function(_0x1ff9c0,_0x3f6505){_0x1ff9c0=_0x1ff9c0-0x0;var _0x3c08d3=_0xac08[_0x1ff9c0];return _0x3c08d3;};'use strict';var _=require(_0x8ac0('0x0'));var util=require('util');var utils=require(_0x8ac0('0x1'));function writeDB(_0x54acca){utils['info'](util[_0x8ac0('0x2')](_0x8ac0('0x3'),_0x54acca['type']===_0x8ac0('0x4')?_0x54acca['origtransfereruniqueid']:_0x54acca[_0x8ac0('0x5')],_0x54acca['type']));utils[_0x8ac0('0x6')](_0x8ac0('0x7'),_0x54acca);}exports[_0x8ac0('0x8')]={};exports[_0x8ac0('0x9')]=function(_0x5b78a5){try{utils[_0x8ac0('0xa')](util['format'](_0x8ac0('0xb'),_0x5b78a5[_0x8ac0('0x5')]),_0x5b78a5);utils['info'](util[_0x8ac0('0x2')]('[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x5b78a5[_0x8ac0('0x5')],_0x5b78a5['transferercalleridnum'],_0x5b78a5[_0x8ac0('0xc')],_0x5b78a5[_0x8ac0('0xd')],_0x5b78a5['transfereecalleridname']));_0x5b78a5[_0x8ac0('0xe')]='blind';exports[_0x8ac0('0x8')][_0x5b78a5[_0x8ac0('0xf')]]=_0x5b78a5;writeDB(_0x5b78a5);}catch(_0x16c84f){utils[_0x8ac0('0x10')](util['format'](_0x8ac0('0xb'),_0x5b78a5['uniqueid']),_0x16c84f);}};exports['attendedtransfer']=function(_0x4f04e7){try{utils[_0x8ac0('0xa')](util[_0x8ac0('0x2')](_0x8ac0('0x11'),_0x4f04e7['origtransfereruniqueid']),_0x4f04e7);utils[_0x8ac0('0x12')](util[_0x8ac0('0x2')]('[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s',_0x4f04e7['origtransfereruniqueid'],_0x4f04e7[_0x8ac0('0x13')],_0x4f04e7['origtransferercalleridname'],_0x4f04e7[_0x8ac0('0x14')],_0x4f04e7[_0x8ac0('0x15')]));_0x4f04e7=_[_0x8ac0('0x16')](_0x4f04e7,{'transfererchannel':_0x4f04e7[_0x8ac0('0x17')],'transferercalleridnum':_0x4f04e7[_0x8ac0('0x13')],'transferercalleridname':_0x4f04e7['origtransferercalleridname'],'transfererconnectedlinenum':_0x4f04e7[_0x8ac0('0x18')],'transfererconnectedlinename':_0x4f04e7[_0x8ac0('0x19')],'transfereraccountcode':_0x4f04e7[_0x8ac0('0x1a')],'transferercontext':_0x4f04e7[_0x8ac0('0x1b')],'transfererexten':_0x4f04e7[_0x8ac0('0x1c')],'transfererlinkedid':_0x4f04e7[_0x8ac0('0x1d')],'context':_0x4f04e7[_0x8ac0('0x1e')],'extension':_0x4f04e7[_0x8ac0('0x1f')],'type':'attended'});if(_['isNil'](_0x4f04e7[_0x8ac0('0x20')])){_0x4f04e7=_['assign'](_0x4f04e7,{'transfereechannel':_0x4f04e7[_0x8ac0('0x21')],'transfereecalleridnum':_0x4f04e7[_0x8ac0('0x14')],'transfereecalleridname':_0x4f04e7['transfertargetcalleridname'],'transfereeconnectedlinenum':_0x4f04e7[_0x8ac0('0x22')],'transfereeconnectedlinename':_0x4f04e7[_0x8ac0('0x23')],'transfereeaccountcode':_0x4f04e7[_0x8ac0('0x24')],'transfereecontext':_0x4f04e7[_0x8ac0('0x25')],'transfereeexten':_0x4f04e7[_0x8ac0('0x26')],'transfereelinkedid':_0x4f04e7['transfertargetlinkedid']});}writeDB(_0x4f04e7);}catch(_0x4b252b){utils[_0x8ac0('0x10')](util[_0x8ac0('0x2')](_0x8ac0('0x11'),_0x4f04e7[_0x8ac0('0x27')]),_0x4b252b);}}; \ No newline at end of file +var _0xbf61=['request','CreateVoiceTransferReport','blinds','debug','[%s][transfers][blindtransfer]','[%s][transfers][blindtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','transferercalleridnum','transfereecalleridnum','transfereecalleridname','blind','error','[%s][transfers][attendedtransfer]','info','[%s][transfers][attendedtransfer]\x20transferercalleridnum:%s\x20transferercalleridname:%s\x20transfereecalleridnum:%s\x20transfereecalleridname:%s','origtransferercalleridnum','origtransferercalleridname','transfertargetcalleridnum','transfertargetcalleridname','assign','origtransfererchannel','secondtransfererconnectedlinenum','secondtransfererconnectedlinename','origtransfereraccountcode','secondtransferercontext','secondtransfererexten','origtransferercontext','origtransfererexten','isNil','transfereechannel','transfertargetchannel','transfertargetconnectedlinenum','transfertargetcontext','transfertargetexten','lodash','util','./utils','format','type','attended','origtransfereruniqueid','uniqueid'];(function(_0x255d5b,_0x4f6f35){var _0x3e141a=function(_0x249ee2){while(--_0x249ee2){_0x255d5b['push'](_0x255d5b['shift']());}};_0x3e141a(++_0x4f6f35);}(_0xbf61,0x1e4));var _0x1bf6=function(_0x3e4de9,_0x56f87e){_0x3e4de9=_0x3e4de9-0x0;var _0x365295=_0xbf61[_0x3e4de9];return _0x365295;};'use strict';var _=require(_0x1bf6('0x0'));var util=require(_0x1bf6('0x1'));var utils=require(_0x1bf6('0x2'));function writeDB(_0x121fad){utils['info'](util[_0x1bf6('0x3')]('[%s][transfers][writeDB]\x20type:%s',_0x121fad[_0x1bf6('0x4')]===_0x1bf6('0x5')?_0x121fad[_0x1bf6('0x6')]:_0x121fad[_0x1bf6('0x7')],_0x121fad[_0x1bf6('0x4')]));utils[_0x1bf6('0x8')](_0x1bf6('0x9'),_0x121fad);}exports[_0x1bf6('0xa')]={};exports['blindtransfer']=function(_0x6af4d7){try{utils[_0x1bf6('0xb')](util[_0x1bf6('0x3')](_0x1bf6('0xc'),_0x6af4d7['uniqueid']),_0x6af4d7);utils['info'](util[_0x1bf6('0x3')](_0x1bf6('0xd'),_0x6af4d7[_0x1bf6('0x7')],_0x6af4d7[_0x1bf6('0xe')],_0x6af4d7['transferercalleridname'],_0x6af4d7[_0x1bf6('0xf')],_0x6af4d7[_0x1bf6('0x10')]));_0x6af4d7[_0x1bf6('0x4')]=_0x1bf6('0x11');exports[_0x1bf6('0xa')][_0x6af4d7['transfereruniqueid']]=_0x6af4d7;writeDB(_0x6af4d7);}catch(_0x261788){utils[_0x1bf6('0x12')](util[_0x1bf6('0x3')](_0x1bf6('0xc'),_0x6af4d7[_0x1bf6('0x7')]),_0x261788);}};exports['attendedtransfer']=function(_0x5c81d8){try{utils[_0x1bf6('0xb')](util[_0x1bf6('0x3')](_0x1bf6('0x13'),_0x5c81d8[_0x1bf6('0x6')]),_0x5c81d8);utils[_0x1bf6('0x14')](util[_0x1bf6('0x3')](_0x1bf6('0x15'),_0x5c81d8['origtransfereruniqueid'],_0x5c81d8[_0x1bf6('0x16')],_0x5c81d8[_0x1bf6('0x17')],_0x5c81d8[_0x1bf6('0x18')],_0x5c81d8[_0x1bf6('0x19')]));_0x5c81d8=_[_0x1bf6('0x1a')](_0x5c81d8,{'transfererchannel':_0x5c81d8[_0x1bf6('0x1b')],'transferercalleridnum':_0x5c81d8['origtransferercalleridnum'],'transferercalleridname':_0x5c81d8[_0x1bf6('0x17')],'transfererconnectedlinenum':_0x5c81d8[_0x1bf6('0x1c')],'transfererconnectedlinename':_0x5c81d8[_0x1bf6('0x1d')],'transfereraccountcode':_0x5c81d8[_0x1bf6('0x1e')],'transferercontext':_0x5c81d8[_0x1bf6('0x1f')],'transfererexten':_0x5c81d8[_0x1bf6('0x20')],'transfererlinkedid':_0x5c81d8['origtransfererlinkedid'],'context':_0x5c81d8[_0x1bf6('0x21')],'extension':_0x5c81d8[_0x1bf6('0x22')],'type':_0x1bf6('0x5')});if(_[_0x1bf6('0x23')](_0x5c81d8[_0x1bf6('0x24')])){_0x5c81d8=_[_0x1bf6('0x1a')](_0x5c81d8,{'transfereechannel':_0x5c81d8[_0x1bf6('0x25')],'transfereecalleridnum':_0x5c81d8[_0x1bf6('0x18')],'transfereecalleridname':_0x5c81d8[_0x1bf6('0x19')],'transfereeconnectedlinenum':_0x5c81d8[_0x1bf6('0x26')],'transfereeconnectedlinename':_0x5c81d8['transfertargetconnectedlinename'],'transfereeaccountcode':_0x5c81d8['transfertargetaccountcode'],'transfereecontext':_0x5c81d8[_0x1bf6('0x27')],'transfereeexten':_0x5c81d8[_0x1bf6('0x28')],'transfereelinkedid':_0x5c81d8['transfertargetlinkedid']});}writeDB(_0x5c81d8);}catch(_0x15eb86){utils[_0x1bf6('0x12')](util[_0x1bf6('0x3')]('[%s][transfers][attendedtransfer]',_0x5c81d8['origtransfereruniqueid']),_0x15eb86);}}; \ No newline at end of file diff --git a/server/services/xdr/utils.js b/server/services/xdr/utils.js index 76c4ed4..73c0bd9 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 _0xfc9e=['acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','[utils][getVoiceQueueByName]','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','subtract','now','isAfter','isBefore','jayson/promise','moment','util','client','http','../../config/logger','inspect','debug','error','[utils][request]\x20name:%s','catch','request','GetUser','name','interface','then','[utils][getUser]\x20where:%s','stringify','result','length','[utils][getUserByInternal]\x20internal:%s\x20%s','notfound','[utils][getUserByInternal]','info','[utils][getUserByInterface]\x20interface:%s\x20%s','[utils][getUserByInterface]','getUserByName','[utils][getUserByName]\x20name:%s\x20%s','found','[utils][getUserByName]','getVoiceQueueByName','acw'];(function(_0x321b0f,_0x244586){var _0x58368d=function(_0x127f17){while(--_0x127f17){_0x321b0f['push'](_0x321b0f['shift']());}};_0x58368d(++_0x244586);}(_0xfc9e,0x94));var _0xefc9=function(_0x5f42f1,_0x956be5){_0x5f42f1=_0x5f42f1-0x0;var _0x5534ee=_0xfc9e[_0x5f42f1];return _0x5534ee;};'use strict';var BPromise=require('bluebird');var jayson=require(_0xefc9('0x0'));var moment=require(_0xefc9('0x1'));var util=require(_0xefc9('0x2'));var client=jayson[_0xefc9('0x3')][_0xefc9('0x4')]({'port':0x2329});var logger=require(_0xefc9('0x5'))('xdr');exports['info']=function(_0x4fc0c3,_0x2974e0){logger['info'](_0x4fc0c3,_0x2974e0?util[_0xefc9('0x6')](_0x2974e0,{'showHidden':![],'depth':null}):'');};exports[_0xefc9('0x7')]=function(_0x49ec46,_0x5a60bb){logger[_0xefc9('0x7')](_0x49ec46,_0x5a60bb?util[_0xefc9('0x6')](_0x5a60bb,{'showHidden':![],'depth':null}):'');};exports[_0xefc9('0x8')]=function(_0x13a012,_0x33ed22){logger[_0xefc9('0x8')](_0x13a012,_0x33ed22?util['inspect'](_0x33ed22,{'showHidden':![],'depth':null}):'');};exports['request']=function(_0xb924a7,_0x491939){return client['request'](_0xb924a7,{'body':_0x491939})['then'](function(_0x514343){logger['debug'](_0xefc9('0x9'),_0xb924a7,_0x514343?util[_0xefc9('0x6')](_0x514343,{'showHidden':![],'depth':null}):'');})[_0xefc9('0xa')](function(_0x5d6da2){logger[_0xefc9('0x8')](_0xefc9('0x9'),_0xb924a7,_0x5d6da2?util[_0xefc9('0x6')](_0x5d6da2,{'showHidden':![],'depth':null}):'');});};function getUser(_0x4942b2){return client[_0xefc9('0xb')](_0xefc9('0xc'),{'options':{'raw':!![],'attributes':['id','internal',_0xefc9('0xd'),_0xefc9('0xe')],'where':_0x4942b2,'limit':0x1}})[_0xefc9('0xf')](function(_0x25455d){logger[_0xefc9('0x7')](_0xefc9('0x10'),JSON[_0xefc9('0x11')](_0x4942b2),_0x25455d?util[_0xefc9('0x6')](_0x25455d,{'showHidden':![],'depth':null}):'');return _0x25455d[_0xefc9('0x12')][_0xefc9('0x13')]?_0x25455d[_0xefc9('0x12')][0x0]:null;});}exports['getUserByInternal']=function(_0x463c63){return new BPromise(function(_0x1e28f8,_0x5dc119){if(_0x463c63){return getUser({'internal':_0x463c63})[_0xefc9('0xf')](function(_0x507e87){logger['info'](_0xefc9('0x14'),_0x463c63,_0x507e87?'found':_0xefc9('0x15'));return _0x1e28f8(_0x507e87);})['catch'](function(_0x16981d){logger[_0xefc9('0x8')](_0xefc9('0x16'),_0x16981d?util[_0xefc9('0x6')](_0x16981d,{'showHidden':![],'depth':null}):'');return _0x1e28f8(null);});}return _0x1e28f8(null);});};exports['getUserByInterface']=function(_0x2343dc){return new BPromise(function(_0x24b8df,_0xedb308){if(_0x2343dc){return getUser({'interface':_0x2343dc})[_0xefc9('0xf')](function(_0x54f118){logger[_0xefc9('0x17')](_0xefc9('0x18'),_0x2343dc,_0x54f118?'found':'notfound');return _0x24b8df(_0x54f118);})[_0xefc9('0xa')](function(_0x4f4065){logger[_0xefc9('0x8')](_0xefc9('0x19'),_0x4f4065?util[_0xefc9('0x6')](_0x4f4065,{'showHidden':![],'depth':null}):'');return _0x24b8df(null);});}return _0x24b8df(null);});};exports[_0xefc9('0x1a')]=function(_0x12d4f7){return new BPromise(function(_0x301a69,_0x48a250){if(_0x12d4f7){return getUser({'name':_0x12d4f7})[_0xefc9('0xf')](function(_0x48b422){logger['info'](_0xefc9('0x1b'),_0x12d4f7,_0x48b422?_0xefc9('0x1c'):_0xefc9('0x15'));return _0x301a69(_0x48b422);})[_0xefc9('0xa')](function(_0x7bc556){logger['error'](_0xefc9('0x1d'),_0x7bc556?util[_0xefc9('0x6')](_0x7bc556,{'showHidden':![],'depth':null}):'');return _0x301a69(null);});}return _0x301a69(null);});};exports[_0xefc9('0x1e')]=function(_0x597249){return new BPromise(function(_0x515420,_0x531791){if(_0x597249){return client[_0xefc9('0xb')]('GetVoiceQueue',{'options':{'raw':!![],'attributes':['id',_0xefc9('0xd'),'type',_0xefc9('0x1f'),_0xefc9('0x20')],'where':{'name':_0x597249},'limit':0x1}})[_0xefc9('0xf')](function(_0x34bbf6){logger[_0xefc9('0x7')]('[utils][getVoiceQueueByName]\x20name:%s',_0x597249,_0x34bbf6?util['inspect'](_0x34bbf6,{'showHidden':![],'depth':null}):'');logger[_0xefc9('0x17')](_0xefc9('0x21'),_0x597249,_0x34bbf6?_0xefc9('0x1c'):_0xefc9('0x15'));return _0x515420(_0x34bbf6[_0xefc9('0x12')]['length']?_0x34bbf6[_0xefc9('0x12')][0x0]:null);})[_0xefc9('0xa')](function(_0x4a9a19){logger[_0xefc9('0x8')](_0xefc9('0x22'),_0x4a9a19?util['inspect'](_0x4a9a19,{'showHidden':![],'depth':null}):'');return _0x515420(null);});}return _0x515420(null);});};exports[_0xefc9('0x23')]=function(_0x1484e1,_0x1cf88e){return moment(_0x1484e1)[_0xefc9('0x24')](_0x1cf88e,_0xefc9('0x25'))[_0xefc9('0x26')](_0xefc9('0x27'));};exports[_0xefc9('0x28')]=function(_0x775096,_0x2ae15c){return moment(_0x775096)[_0xefc9('0x29')](_0x2ae15c,'seconds')[_0xefc9('0x26')]('YYYY-MM-DD\x20HH:mm:ss');};exports['diffTime']=function(_0x221f18,_0x1652e4){return moment(_0x221f18)['diff'](moment(_0x1652e4),'seconds');};exports['sumTime']=function(_0x697eca,_0xf4302e){return parseInt(_0x697eca,0xa)+parseInt(_0xf4302e,0xa);};exports[_0xefc9('0x2a')]=function(){return moment()['format'](_0xefc9('0x27'));};exports[_0xefc9('0x2b')]=function(_0x2673e3,_0x166b5c){if(_0x166b5c){return moment(_0x2673e3)[_0xefc9('0x2b')](_0x166b5c);}return!![];};exports[_0xefc9('0x2c')]=function(_0xe74d15,_0x4d5328){if(_0x4d5328){return moment(_0xe74d15)[_0xefc9('0x2c')](_0x4d5328);}else if(_0xe74d15){return!![];}return![];}; \ No newline at end of file +var _0x66a4=['[utils][getUserByInterface]','[utils][getUserByName]','getVoiceQueueByName','GetVoiceQueue','type','acw','acwTimeout','[utils][getVoiceQueueByName]\x20name:%s\x20%s','addTime','add','seconds','format','YYYY-MM-DD\x20HH:mm:ss','subtractTime','now','isAfter','isBefore','bluebird','jayson/promise','moment','util','client','http','../../config/logger','info','inspect','debug','error','request','[utils][request]\x20name:%s','catch','internal','name','interface','[utils][getUser]\x20where:%s','stringify','length','result','getUserByInternal','then','[utils][getUserByInternal]\x20internal:%s\x20%s','found','[utils][getUserByInternal]','getUserByInterface','[utils][getUserByInterface]\x20interface:%s\x20%s','notfound'];(function(_0xc8db6b,_0x320abd){var _0x12cb81=function(_0x417540){while(--_0x417540){_0xc8db6b['push'](_0xc8db6b['shift']());}};_0x12cb81(++_0x320abd);}(_0x66a4,0x1af));var _0x466a=function(_0x321bb2,_0x202794){_0x321bb2=_0x321bb2-0x0;var _0x9c12ed=_0x66a4[_0x321bb2];return _0x9c12ed;};'use strict';var BPromise=require(_0x466a('0x0'));var jayson=require(_0x466a('0x1'));var moment=require(_0x466a('0x2'));var util=require(_0x466a('0x3'));var client=jayson[_0x466a('0x4')][_0x466a('0x5')]({'port':0x2329});var logger=require(_0x466a('0x6'))('xdr');exports[_0x466a('0x7')]=function(_0x33a902,_0x358d21){logger[_0x466a('0x7')](_0x33a902,_0x358d21?util[_0x466a('0x8')](_0x358d21,{'showHidden':![],'depth':null}):'');};exports[_0x466a('0x9')]=function(_0x3018e4,_0x58d4b2){logger[_0x466a('0x9')](_0x3018e4,_0x58d4b2?util[_0x466a('0x8')](_0x58d4b2,{'showHidden':![],'depth':null}):'');};exports[_0x466a('0xa')]=function(_0x36e418,_0xe3675f){logger[_0x466a('0xa')](_0x36e418,_0xe3675f?util[_0x466a('0x8')](_0xe3675f,{'showHidden':![],'depth':null}):'');};exports[_0x466a('0xb')]=function(_0x8c74d4,_0xfcdc13){return client['request'](_0x8c74d4,{'body':_0xfcdc13})['then'](function(_0x1908b3){logger[_0x466a('0x9')](_0x466a('0xc'),_0x8c74d4,_0x1908b3?util[_0x466a('0x8')](_0x1908b3,{'showHidden':![],'depth':null}):'');})[_0x466a('0xd')](function(_0x186d57){logger[_0x466a('0xa')](_0x466a('0xc'),_0x8c74d4,_0x186d57?util[_0x466a('0x8')](_0x186d57,{'showHidden':![],'depth':null}):'');});};function getUser(_0x5c9d85){return client[_0x466a('0xb')]('GetUser',{'options':{'raw':!![],'attributes':['id',_0x466a('0xe'),_0x466a('0xf'),_0x466a('0x10')],'where':_0x5c9d85,'limit':0x1}})['then'](function(_0x301512){logger[_0x466a('0x9')](_0x466a('0x11'),JSON[_0x466a('0x12')](_0x5c9d85),_0x301512?util['inspect'](_0x301512,{'showHidden':![],'depth':null}):'');return _0x301512['result'][_0x466a('0x13')]?_0x301512[_0x466a('0x14')][0x0]:null;});}exports[_0x466a('0x15')]=function(_0x3a279c){return new BPromise(function(_0xf6cef0,_0x225d4a){if(_0x3a279c){return getUser({'internal':_0x3a279c})[_0x466a('0x16')](function(_0x2fec89){logger[_0x466a('0x7')](_0x466a('0x17'),_0x3a279c,_0x2fec89?_0x466a('0x18'):'notfound');return _0xf6cef0(_0x2fec89);})[_0x466a('0xd')](function(_0x3efba0){logger[_0x466a('0xa')](_0x466a('0x19'),_0x3efba0?util[_0x466a('0x8')](_0x3efba0,{'showHidden':![],'depth':null}):'');return _0xf6cef0(null);});}return _0xf6cef0(null);});};exports[_0x466a('0x1a')]=function(_0x561b6c){return new BPromise(function(_0x75a2ad,_0xda52c){if(_0x561b6c){return getUser({'interface':_0x561b6c})[_0x466a('0x16')](function(_0x13e2d1){logger['info'](_0x466a('0x1b'),_0x561b6c,_0x13e2d1?_0x466a('0x18'):_0x466a('0x1c'));return _0x75a2ad(_0x13e2d1);})[_0x466a('0xd')](function(_0x226892){logger[_0x466a('0xa')](_0x466a('0x1d'),_0x226892?util[_0x466a('0x8')](_0x226892,{'showHidden':![],'depth':null}):'');return _0x75a2ad(null);});}return _0x75a2ad(null);});};exports['getUserByName']=function(_0x38d628){return new BPromise(function(_0x5e15e5,_0x1c0a2b){if(_0x38d628){return getUser({'name':_0x38d628})[_0x466a('0x16')](function(_0x34857e){logger[_0x466a('0x7')]('[utils][getUserByName]\x20name:%s\x20%s',_0x38d628,_0x34857e?_0x466a('0x18'):_0x466a('0x1c'));return _0x5e15e5(_0x34857e);})['catch'](function(_0x2da97e){logger[_0x466a('0xa')](_0x466a('0x1e'),_0x2da97e?util[_0x466a('0x8')](_0x2da97e,{'showHidden':![],'depth':null}):'');return _0x5e15e5(null);});}return _0x5e15e5(null);});};exports[_0x466a('0x1f')]=function(_0x414119){return new BPromise(function(_0xe0e6ac,_0x43b15c){if(_0x414119){return client['request'](_0x466a('0x20'),{'options':{'raw':!![],'attributes':['id','name',_0x466a('0x21'),_0x466a('0x22'),_0x466a('0x23')],'where':{'name':_0x414119},'limit':0x1}})['then'](function(_0xaa3ce8){logger[_0x466a('0x9')]('[utils][getVoiceQueueByName]\x20name:%s',_0x414119,_0xaa3ce8?util[_0x466a('0x8')](_0xaa3ce8,{'showHidden':![],'depth':null}):'');logger[_0x466a('0x7')](_0x466a('0x24'),_0x414119,_0xaa3ce8?_0x466a('0x18'):_0x466a('0x1c'));return _0xe0e6ac(_0xaa3ce8[_0x466a('0x14')]['length']?_0xaa3ce8[_0x466a('0x14')][0x0]:null);})[_0x466a('0xd')](function(_0x318185){logger['error']('[utils][getVoiceQueueByName]',_0x318185?util[_0x466a('0x8')](_0x318185,{'showHidden':![],'depth':null}):'');return _0xe0e6ac(null);});}return _0xe0e6ac(null);});};exports[_0x466a('0x25')]=function(_0x12a6a1,_0xb56278){return moment(_0x12a6a1)[_0x466a('0x26')](_0xb56278,_0x466a('0x27'))[_0x466a('0x28')](_0x466a('0x29'));};exports[_0x466a('0x2a')]=function(_0x288daa,_0x2fb07c){return moment(_0x288daa)['subtract'](_0x2fb07c,_0x466a('0x27'))[_0x466a('0x28')](_0x466a('0x29'));};exports['diffTime']=function(_0x3a4d1f,_0x527653){return moment(_0x3a4d1f)['diff'](moment(_0x527653),_0x466a('0x27'));};exports['sumTime']=function(_0x5708de,_0x440322){return parseInt(_0x5708de,0xa)+parseInt(_0x440322,0xa);};exports[_0x466a('0x2b')]=function(){return moment()[_0x466a('0x28')]('YYYY-MM-DD\x20HH:mm:ss');};exports[_0x466a('0x2c')]=function(_0x4580fa,_0x35cec8){if(_0x35cec8){return moment(_0x4580fa)[_0x466a('0x2c')](_0x35cec8);}return!![];};exports['isBefore']=function(_0x42a034,_0x501036){if(_0x501036){return moment(_0x42a034)[_0x466a('0x2d')](_0x501036);}else if(_0x42a034){return!![];}return![];}; \ No newline at end of file diff --git a/server/utils/client-side-logger.js b/server/utils/client-side-logger.js index 45561fd..531b2c3 100644 --- a/server/utils/client-side-logger.js +++ b/server/utils/client-side-logger.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xaa81=['util','./loggers','fileLogger','./safe-template','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','name','ensureDir','catch','then','user','no-user','data','timestamp','error','api','auth','set','client-side-logger','use','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','method','headers','x-forwarded-for','connection','remoteAddress','url','statusCode','responseTime','role','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','other','agent_name','test','setupLoggers','fs-extra','lodash','express-winston'];(function(_0x21920e,_0x2441dc){var _0x1932e3=function(_0xb4456){while(--_0xb4456){_0x21920e['push'](_0x21920e['shift']());}};_0x1932e3(++_0x2441dc);}(_0xaa81,0x195));var _0x1aa8=function(_0x1ce44b,_0x589111){_0x1ce44b=_0x1ce44b-0x0;var _0x53d9e6=_0xaa81[_0x1ce44b];return _0x53d9e6;};var fs=require(_0x1aa8('0x0'));var _=require(_0x1aa8('0x1'));var ewinston=require(_0x1aa8('0x2'));var path=require('path');var util=require(_0x1aa8('0x3'));var fileLogger=require(_0x1aa8('0x4'))[_0x1aa8('0x5')];var safeTemplate=require(_0x1aa8('0x6'))['safeTemplate'];var maskSensitiveData=require(_0x1aa8('0x7'))[_0x1aa8('0x8')];function ClientSideLogger(){function _0x997c20(_0xe9dec7){var _0x549b92=path[_0x1aa8('0x9')](_0x1aa8('0xa'),_0x1aa8('0xb'),_0x1aa8('0xc'));var _0x272967=path[_0x1aa8('0x9')](_0x1aa8('0xd'),_0xe9dec7['role']+'-'+_0xe9dec7[_0x1aa8('0xe')]);return fs[_0x1aa8('0xf')](path[_0x1aa8('0x9')](_0x549b92,_0x272967))['then'](function(){var _0x62b759=fileLogger(_0x1aa8('0xd'),path['join'](_0x549b92,_0x272967));return _0x62b759;})[_0x1aa8('0x10')](function(_0x27be03){throw _0x27be03;});}this[_0x1aa8('0xb')]=function(_0x3dbacb,_0x4211d8,_0x42c782,_0x5bb4bd){return _0x997c20(_0x3dbacb['user'])[_0x1aa8('0x11')](function(_0x5ef251){var _0x131957=_0x5ef251[_0x4211d8];return _0x131957;})[_0x1aa8('0x11')](function(_0x3cfc54){var _0x3bf5cf=_0x3dbacb[_0x1aa8('0x12')]?_0x3dbacb[_0x1aa8('0x12')]['id']:_0x1aa8('0x13');var _0x5dc1f1=_0x5bb4bd[_0x1aa8('0x14')];var _0x444e97=_0x5bb4bd[_0x1aa8('0x15')];var _0x458426=new Date(Number(_0x444e97));return _0x3cfc54(_0x3bf5cf,_0x458426,_0x42c782,_0x5dc1f1);})[_0x1aa8('0x10')](function(_0x4aecf4){fileLogger('client')[_0x1aa8('0x16')](_0x4aecf4);});};}function setupLoggers(_0x352b0c){return new Promise(function(_0x263ffb){var _0x5c0ca0=new ClientSideLogger();var _0x257427=fileLogger(_0x1aa8('0x17'));var _0x25989b=fileLogger(_0x1aa8('0x18'));_0x352b0c[_0x1aa8('0x19')](_0x1aa8('0x1a'),_0x5c0ca0);_0x352b0c[_0x1aa8('0x1b')](ewinston[_0x1aa8('0x1c')]({'winstonInstance':_0x257427,'meta':![],'statusLevels':!![],'msg':function(_0x1066e7,_0xdb16ca){var _0xd80640=_0x1aa8('0x1d');if(!_[_0x1aa8('0x1e')](_0x1066e7[_0x1aa8('0x1f')])){_0xd80640+=_0x1aa8('0x20');var _0xb9fc69=_0x1066e7[_0x1aa8('0x1f')];maskSensitiveData(_0xb9fc69);}return safeTemplate(util[_0x1aa8('0x21')](_0xd80640,_0x1066e7[_0x1aa8('0x22')],_0x1066e7['headers']['x-forwarded-for']?_0x1066e7[_0x1aa8('0x23')][_0x1aa8('0x24')]:_0x1066e7[_0x1aa8('0x25')][_0x1aa8('0x26')]||_0x1066e7['ip'],_0x1066e7[_0x1aa8('0x27')],_0xdb16ca[_0x1aa8('0x28')],_0xdb16ca[_0x1aa8('0x29')],_0x1066e7['user']?_0x1066e7[_0x1aa8('0x12')]['id']:null,_0x1066e7[_0x1aa8('0x12')]?_0x1066e7[_0x1aa8('0x12')][_0x1aa8('0xe')]:null,_0x1066e7[_0x1aa8('0x12')]?_0x1066e7[_0x1aa8('0x12')][_0x1aa8('0x2a')]:null,_0xb9fc69?util['inspect'](_0xb9fc69,![],null):''));}}));_0x352b0c[_0x1aa8('0x1b')](ewinston[_0x1aa8('0x1c')]({'winstonInstance':_0x25989b,'meta':![],'statusLevels':!![],'msg':function(_0x18a653,_0x48de7b){var _0xb013a0=_0x1aa8('0x2b');if(_0x18a653[_0x1aa8('0x1f')]&&_0x18a653[_0x1aa8('0x1f')][_0x1aa8('0x2c')]&&_0x18a653[_0x1aa8('0x1f')][_0x1aa8('0x2d')]){_0xb013a0=_0x1aa8('0x2e');}return util[_0x1aa8('0x21')](_0xb013a0,_0x18a653[_0x1aa8('0x22')],_0x18a653[_0x1aa8('0x23')][_0x1aa8('0x24')]?_0x18a653[_0x1aa8('0x23')][_0x1aa8('0x24')]:_0x18a653[_0x1aa8('0x25')][_0x1aa8('0x26')]||_0x18a653['ip'],_0x18a653[_0x1aa8('0x27')],_0x48de7b[_0x1aa8('0x28')],_0x48de7b[_0x1aa8('0x29')],_0x18a653[_0x1aa8('0x12')]?_0x18a653['user']['id']:null,_0x18a653['user']?_0x18a653[_0x1aa8('0x12')]['name']:null,_0x18a653[_0x1aa8('0x12')]?_0x18a653[_0x1aa8('0x12')][_0x1aa8('0x2a')]:null,_0x18a653[_0x1aa8('0x1f')]&&_0x18a653['body'][_0x1aa8('0x2c')]?_0x18a653[_0x1aa8('0x1f')][_0x1aa8('0x2c')]:_0x1aa8('0x2f'),_0x18a653[_0x1aa8('0x1f')]&&_0x18a653[_0x1aa8('0x1f')][_0x1aa8('0x2d')]?_0x18a653['body'][_0x1aa8('0x2d')]:'',_0x18a653[_0x1aa8('0x1f')]&&_0x18a653[_0x1aa8('0x1f')]['agent_name']?_0x18a653[_0x1aa8('0x1f')][_0x1aa8('0x30')]:'');},'ignoreRoute':function(_0x224fcd){var _0x4f4f23=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x4f4f23[_0x1aa8('0x31')](_0x224fcd['url']);}}));return _0x263ffb();});}exports[_0x1aa8('0x32')]=setupLoggers; \ No newline at end of file +var _0x4cca=['fs-extra','lodash','express-winston','util','./loggers','fileLogger','./safe-template','safeTemplate','./mask-sensitive-data','maskSensitiveData','join','/var','log','xcally','client','role','name','ensureDir','then','catch','user','no-user','data','timestamp','error','api','auth','set','use','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s','isEmpty','body','\x20body=%s','format','headers','x-forwarded-for','connection','remoteAddress','url','responseTime','inspect','logger','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s','device','agent_id','%s\x20%s\x20%s\x20%s\x20%sms\x20id=%s\x20name=%s\x20role=%s\x20device=%s\x20(id=%s\x20name=%s)','method','statusCode','other','agent_name','test','setupLoggers'];(function(_0x46e83e,_0x5a32dc){var _0x182667=function(_0x55fb66){while(--_0x55fb66){_0x46e83e['push'](_0x46e83e['shift']());}};_0x182667(++_0x5a32dc);}(_0x4cca,0x104));var _0xa4cc=function(_0x20a584,_0xe384a5){_0x20a584=_0x20a584-0x0;var _0x4b41a8=_0x4cca[_0x20a584];return _0x4b41a8;};var fs=require(_0xa4cc('0x0'));var _=require(_0xa4cc('0x1'));var ewinston=require(_0xa4cc('0x2'));var path=require('path');var util=require(_0xa4cc('0x3'));var fileLogger=require(_0xa4cc('0x4'))[_0xa4cc('0x5')];var safeTemplate=require(_0xa4cc('0x6'))[_0xa4cc('0x7')];var maskSensitiveData=require(_0xa4cc('0x8'))[_0xa4cc('0x9')];function ClientSideLogger(){function _0x455827(_0x1b8d8e){var _0x29f873=path[_0xa4cc('0xa')](_0xa4cc('0xb'),_0xa4cc('0xc'),_0xa4cc('0xd'));var _0x33dfe6=path[_0xa4cc('0xa')](_0xa4cc('0xe'),_0x1b8d8e[_0xa4cc('0xf')]+'-'+_0x1b8d8e[_0xa4cc('0x10')]);return fs[_0xa4cc('0x11')](path[_0xa4cc('0xa')](_0x29f873,_0x33dfe6))[_0xa4cc('0x12')](function(){var _0x34250a=fileLogger(_0xa4cc('0xe'),path[_0xa4cc('0xa')](_0x29f873,_0x33dfe6));return _0x34250a;})[_0xa4cc('0x13')](function(_0x5035a7){throw _0x5035a7;});}this['log']=function(_0x3dc285,_0x405e30,_0x160181,_0x36d5f0){return _0x455827(_0x3dc285[_0xa4cc('0x14')])['then'](function(_0x54b936){var _0x2a065c=_0x54b936[_0x405e30];return _0x2a065c;})[_0xa4cc('0x12')](function(_0x4c8c39){var _0x1c8cda=_0x3dc285['user']?_0x3dc285['user']['id']:_0xa4cc('0x15');var _0x5e8930=_0x36d5f0[_0xa4cc('0x16')];var _0x119be2=_0x36d5f0[_0xa4cc('0x17')];var _0x2e8a2b=new Date(Number(_0x119be2));return _0x4c8c39(_0x1c8cda,_0x2e8a2b,_0x160181,_0x5e8930);})['catch'](function(_0x1d161d){fileLogger(_0xa4cc('0xe'))[_0xa4cc('0x18')](_0x1d161d);});};}function setupLoggers(_0x2b21ce){return new Promise(function(_0x365865){var _0x5df991=new ClientSideLogger();var _0x3a7781=fileLogger(_0xa4cc('0x19'));var _0x531591=fileLogger(_0xa4cc('0x1a'));_0x2b21ce[_0xa4cc('0x1b')]('client-side-logger',_0x5df991);_0x2b21ce[_0xa4cc('0x1c')](ewinston['logger']({'winstonInstance':_0x3a7781,'meta':![],'statusLevels':!![],'msg':function(_0xd50185,_0x206d7a){var _0xc4c9d9=_0xa4cc('0x1d');if(!_[_0xa4cc('0x1e')](_0xd50185[_0xa4cc('0x1f')])){_0xc4c9d9+=_0xa4cc('0x20');var _0x4a8684=_0xd50185['body'];maskSensitiveData(_0x4a8684);}return safeTemplate(util[_0xa4cc('0x21')](_0xc4c9d9,_0xd50185['method'],_0xd50185[_0xa4cc('0x22')][_0xa4cc('0x23')]?_0xd50185[_0xa4cc('0x22')][_0xa4cc('0x23')]:_0xd50185[_0xa4cc('0x24')][_0xa4cc('0x25')]||_0xd50185['ip'],_0xd50185[_0xa4cc('0x26')],_0x206d7a['statusCode'],_0x206d7a[_0xa4cc('0x27')],_0xd50185[_0xa4cc('0x14')]?_0xd50185['user']['id']:null,_0xd50185[_0xa4cc('0x14')]?_0xd50185[_0xa4cc('0x14')]['name']:null,_0xd50185[_0xa4cc('0x14')]?_0xd50185[_0xa4cc('0x14')][_0xa4cc('0xf')]:null,_0x4a8684?util[_0xa4cc('0x28')](_0x4a8684,![],null):''));}}));_0x2b21ce[_0xa4cc('0x1c')](ewinston[_0xa4cc('0x29')]({'winstonInstance':_0x531591,'meta':![],'statusLevels':!![],'msg':function(_0x34298a,_0x4324fb){var _0x41c995=_0xa4cc('0x2a');if(_0x34298a['body']&&_0x34298a[_0xa4cc('0x1f')][_0xa4cc('0x2b')]&&_0x34298a[_0xa4cc('0x1f')][_0xa4cc('0x2c')]){_0x41c995=_0xa4cc('0x2d');}return util[_0xa4cc('0x21')](_0x41c995,_0x34298a[_0xa4cc('0x2e')],_0x34298a[_0xa4cc('0x22')]['x-forwarded-for']?_0x34298a[_0xa4cc('0x22')][_0xa4cc('0x23')]:_0x34298a[_0xa4cc('0x24')][_0xa4cc('0x25')]||_0x34298a['ip'],_0x34298a[_0xa4cc('0x26')],_0x4324fb[_0xa4cc('0x2f')],_0x4324fb['responseTime'],_0x34298a[_0xa4cc('0x14')]?_0x34298a[_0xa4cc('0x14')]['id']:null,_0x34298a[_0xa4cc('0x14')]?_0x34298a[_0xa4cc('0x14')][_0xa4cc('0x10')]:null,_0x34298a[_0xa4cc('0x14')]?_0x34298a['user'][_0xa4cc('0xf')]:null,_0x34298a[_0xa4cc('0x1f')]&&_0x34298a[_0xa4cc('0x1f')][_0xa4cc('0x2b')]?_0x34298a[_0xa4cc('0x1f')][_0xa4cc('0x2b')]:_0xa4cc('0x30'),_0x34298a[_0xa4cc('0x1f')]&&_0x34298a['body'][_0xa4cc('0x2c')]?_0x34298a[_0xa4cc('0x1f')][_0xa4cc('0x2c')]:'',_0x34298a[_0xa4cc('0x1f')]&&_0x34298a[_0xa4cc('0x1f')][_0xa4cc('0x31')]?_0x34298a[_0xa4cc('0x1f')][_0xa4cc('0x31')]:'');},'ignoreRoute':function(_0x47656f){var _0x3d277e=/\/api\/users\/[0-9]+\/(login|logout)/gi;return!_0x3d277e[_0xa4cc('0x32')](_0x47656f['url']);}}));return _0x365865();});}exports[_0xa4cc('0x33')]=setupLoggers; \ No newline at end of file diff --git a/server/utils/iftime.js b/server/utils/iftime.js index 59b0a73..d848ab7 100644 --- a/server/utils/iftime.js +++ b/server/utils/iftime.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x0869=['split','padStart','length','lodash','moment-timezone','map','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','isValid','locale','weekdaysShort','indexOf','slice','concat','circularDoWInterval','monthsShort','toLowerCase','exports','circularMonthInterval','clone','hours','isBefore','startOf','endOf','day','isBetween','timeCompare','ddd','includes','dowCompare','min','max','domCompare','format','MMM','monthCompare','guess','test'];(function(_0x586a5b,_0x13d925){var _0x1b4e04=function(_0x3d30ca){while(--_0x3d30ca){_0x586a5b['push'](_0x586a5b['shift']());}};_0x1b4e04(++_0x13d925);}(_0x0869,0x11b));var _0x9086=function(_0x5a0ff1,_0x2a26a9){_0x5a0ff1=_0x5a0ff1-0x0;var _0x5ddf7d=_0x0869[_0x5a0ff1];return _0x5ddf7d;};var _=require(_0x9086('0x0'));var moment=require(_0x9086('0x1'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx][_0x9086('0x2')](function(_0x1300e1){return _0x1300e1[_0x9086('0x3')];})[_0x9086('0x4')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x9086('0x5');var EINVALID_DATE=_0x9086('0x6');function throwIfDateNotValid(_0x48314e){if(!_0x48314e[_0x9086('0x7')]()){throw new Error(EINVALID_DATE);}}function extractTime(_0x114566){var _0x302a65=_0x114566['split'](':')[_0x9086('0x2')](function(_0x592f29){return parseInt(_0x592f29,0xa);});var _0x561040=_0x302a65[0x0];var _0x60a1ae=_0x302a65[0x1];if(_0x561040<0x0||_0x561040>0x17||_0x60a1ae<0x0||_0x60a1ae>0x3b){throw new Error(EINVALID_DATE);}return[_0x561040,_0x60a1ae];}function circularDoWInterval(_0x17a3f3,_0x52be0e){if(_0x17a3f3===_0x52be0e){return[_0x17a3f3];}else{var _0x46b0d9=moment[_0x9086('0x8')]();moment['locale']('en');var _0x4cef7a=moment[_0x9086('0x9')]()['map'](function(_0xb141c4){return _0xb141c4['toLowerCase']();});moment[_0x9086('0x8')](_0x46b0d9);var _0x27ff64=_0x4cef7a[_0x9086('0xa')](_0x17a3f3);var _0x25b866=_0x4cef7a[_0x9086('0xa')](_0x52be0e);if(_0x25b866>_0x27ff64){return _0x4cef7a[_0x9086('0xb')](_0x27ff64,_0x25b866+0x1);}else{var _0xb99d35=_0x4cef7a[_0x9086('0xb')](0x0,_0x25b866+0x1);var _0x27b86f=_0x4cef7a[_0x9086('0xb')](_0x27ff64);return _0x27b86f[_0x9086('0xc')](_0xb99d35);}}}module['exports'][_0x9086('0xd')]=circularDoWInterval;function circularMonthInterval(_0x105ac4,_0x214125){if(_0x105ac4===_0x214125){return[_0x105ac4];}else{var _0x159a3b=moment[_0x9086('0x8')]();moment['locale']('en');var _0x410c9b=moment[_0x9086('0xe')]()['map'](function(_0x17c083){return _0x17c083[_0x9086('0xf')]();});moment[_0x9086('0x8')](_0x159a3b);var _0x57b844=_0x410c9b['indexOf'](_0x105ac4);var _0x644313=_0x410c9b[_0x9086('0xa')](_0x214125);if(_0x644313>_0x57b844){return _0x410c9b[_0x9086('0xb')](_0x57b844,_0x644313+0x1);}else{var _0x4d929d=_0x410c9b[_0x9086('0xb')](0x0,_0x644313+0x1);var _0x1b3f1d=_0x410c9b[_0x9086('0xb')](_0x57b844);return _0x1b3f1d['concat'](_0x4d929d);}}}module[_0x9086('0x10')][_0x9086('0x11')]=circularMonthInterval;function parseDom(_0x28f175){var _0x2fffee=parseInt(_0x28f175,0xa);if(_0x2fffee<0x1||_0x2fffee>0x1f){throw new Error(EINVALID_DATE);}return _0x2fffee;}function timeCompare(_0x1ec2e1,_0x7bbb7f,_0x376ec0){var _0x4af934=_0x1ec2e1[_0x9086('0x12')]();var _0x227ce6=extractTime(_0x7bbb7f);var _0x4e2634=_0x227ce6[0x0];var _0x457829=_0x227ce6[0x1];var _0x200c25=_0x1ec2e1[_0x9086('0x12')]()['hours'](_0x4e2634)['minutes'](_0x457829);throwIfDateNotValid(_0x200c25);var _0x44aacb=extractTime(_0x376ec0);var _0x1764c0=_0x44aacb[0x0];var _0x367b0f=_0x44aacb[0x1];var _0x2aa5f4=_0x1ec2e1[_0x9086('0x12')]()[_0x9086('0x13')](_0x1764c0)['minutes'](_0x367b0f);throwIfDateNotValid(_0x2aa5f4);if(_0x2aa5f4[_0x9086('0x14')](_0x200c25)){var _0x27d910=_0x4af934['clone']()[_0x9086('0x15')]('day');var _0x36e4b7=_0x4af934['clone']()[_0x9086('0x16')](_0x9086('0x17'));return _0x4af934['isBetween'](_0x200c25,_0x36e4b7,undefined,'[]')||_0x4af934['isBetween'](_0x27d910,_0x2aa5f4,undefined,'[]');}else{return _0x4af934[_0x9086('0x18')](_0x200c25,_0x2aa5f4,undefined,'[]');}}module[_0x9086('0x10')][_0x9086('0x19')]=timeCompare;function dowCompare(_0x5933b7,_0x2cc01d,_0x52cfb5){var _0x4c579f=_0x5933b7[_0x9086('0x8')]('en')['format'](_0x9086('0x1a'))[_0x9086('0xf')]();return circularDoWInterval(_0x2cc01d,_0x52cfb5)[_0x9086('0x1b')](_0x4c579f);}module[_0x9086('0x10')][_0x9086('0x1c')]=dowCompare;function domCompare(_0x57df08,_0x5a586e,_0x347fd1){var _0x1b7498=_0x57df08['date']();if(_0x5a586e===_0x347fd1){return _0x1b7498===_0x5a586e;}else{var _0x3b8f97=_0x57df08['daysInMonth']();var _0x176641=_0x5a586e<_0x347fd1;let _0x10bb18=![];var _0x18d38b=0x0;var _0x174628=0x0;if(_0x176641){_0x18d38b=Math['max'](0x1,_0x5a586e);_0x174628=Math[_0x9086('0x1d')](_0x347fd1,_0x3b8f97);_0x10bb18=_0x1b7498>=_0x18d38b&&_0x1b7498<=_0x174628;}else{_0x18d38b=Math[_0x9086('0x1d')](_0x5a586e,_0x3b8f97);_0x174628=Math[_0x9086('0x1e')](0x1,_0x347fd1);_0x10bb18=_0x1b7498>=_0x18d38b||_0x1b7498<=_0x174628;}return _0x10bb18;}}module[_0x9086('0x10')][_0x9086('0x1f')]=domCompare;function monthCompare(_0xe57a2c,_0x458bc4,_0x314a04){var _0x137ff7=_0xe57a2c[_0x9086('0x8')]('en')[_0x9086('0x20')](_0x9086('0x21'))[_0x9086('0xf')]();return circularMonthInterval(_0x458bc4,_0x314a04)[_0x9086('0x1b')](_0x137ff7);}module['exports'][_0x9086('0x22')]=monthCompare;function iftime(_0x571880,_0x3861b6=moment['tz'][_0x9086('0x23')](),_0xed1a70=moment()){if(!validateRx[_0x9086('0x24')](_0x571880)){throw new Error(EINVALID_STRING);}else{var _0x3d36d4=(moment['isMoment'](_0xed1a70)?_0xed1a70[_0x9086('0x12')]():moment(_0xed1a70))['tz'](_0x3861b6)['locale']('en');throwIfDateNotValid(_0x3d36d4);var _0x5d78f8=_0x571880[_0x9086('0x25')](',');var _0x39fbe6=_0x5d78f8[0x0];var _0xef92f1=_0x5d78f8[0x1];var _0xe75d41=_0x5d78f8[0x2];var _0x5dc3ba=_0x5d78f8[0x3];let _0xd8a4fc=!![];if(_0x39fbe6!=='*'){var _0x392313=_0x39fbe6['split']('-');var _0x24e3cd=_[_0x9086('0x26')](_0x392313[0x0],0x5,'0');var _0x5ec21b=_0x392313[_0x9086('0x27')]===0x2?_[_0x9086('0x26')](_0x392313[0x1],0x5,'0'):_0x24e3cd;_0xd8a4fc=timeCompare(_0x3d36d4,_0x24e3cd,_0x5ec21b);}let _0x1b8859=!![];if(_0xef92f1!=='*'){var _0xde56c=_0xef92f1['split']('-');var _0x2273af=_0xde56c[0x0];var _0x36f64f=_0xde56c[_0x9086('0x27')]===0x2?_0xde56c[0x1]:_0x2273af;_0x1b8859=dowCompare(_0x3d36d4,_0x2273af,_0x36f64f);}let _0x50ad74=!![];if(_0xe75d41!=='*'){var _0x1c5510=_0xe75d41[_0x9086('0x25')]('-');var _0x3749ad=parseDom(_0x1c5510[0x0]);var _0x5d140f=_0x1c5510[_0x9086('0x27')]===0x2?parseDom(_0x1c5510[0x1]):_0x3749ad;_0x50ad74=domCompare(_0x3d36d4,_0x3749ad,_0x5d140f);}let _0x4df9b5=!![];if(_0x5dc3ba!=='*'){var _0x34b99f=_0x5dc3ba[_0x9086('0x25')]('-');var _0x3aeb19=_0x34b99f[0x0];var _0x4de6d6=_0x34b99f['length']===0x2?_0x34b99f[0x1]:_0x34b99f[0x0];_0x4df9b5=monthCompare(_0x3d36d4,_0x3aeb19,_0x4de6d6);}return _0xd8a4fc&&_0x1b8859&&_0x50ad74&&_0x4df9b5;}}module[_0x9086('0x10')]['iftime']=iftime; \ No newline at end of file +var _0xb0c3=['min','domCompare','format','MMM','monthCompare','guess','test','isMoment','split','length','padStart','iftime','moment-timezone','source','join','Interval\x20string\x20not\x20valid','Date\x20not\x20valid','locale','map','toLowerCase','indexOf','slice','concat','circularDoWInterval','monthsShort','exports','circularMonthInterval','clone','hours','minutes','isBefore','startOf','day','endOf','isBetween','timeCompare','includes','daysInMonth','max'];(function(_0x18bfc9,_0x32af5b){var _0x29b553=function(_0x500469){while(--_0x500469){_0x18bfc9['push'](_0x18bfc9['shift']());}};_0x29b553(++_0x32af5b);}(_0xb0c3,0x1b9));var _0x3b0c=function(_0x3cf070,_0x4c430e){_0x3cf070=_0x3cf070-0x0;var _0x3d835c=_0xb0c3[_0x3cf070];return _0x3d835c;};var _=require('lodash');var moment=require(_0x3b0c('0x0'));var timeRx=/(\*|(\d{1,2}:\d{1,2})(-(\d{1,2}:\d{1,2}))?)/;var dowRx=/(\*|((sun|mon|tue|wed|thu|fri|sat)(-(sun|mon|tue|wed|thu|fri|sat))?))/;var domRx=/(\*|(\d{1,2})(-(\d{1,2}))?)/;var moyRx=/(\*|(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec)(-(jan|feb|mar|apr|may|jun|jul|aug|sep|oct|nov|dec))?)/;var globalRx=[timeRx,dowRx,domRx,moyRx]['map'](function(_0x217b83){return _0x217b83[_0x3b0c('0x1')];})[_0x3b0c('0x2')](',');var validateRx=new RegExp('^'+globalRx+'$');var EINVALID_STRING=_0x3b0c('0x3');var EINVALID_DATE=_0x3b0c('0x4');function throwIfDateNotValid(_0x264f13){if(!_0x264f13['isValid']()){throw new Error(EINVALID_DATE);}}function extractTime(_0x39a4ad){var _0x4c9fe3=_0x39a4ad['split'](':')['map'](function(_0x143630){return parseInt(_0x143630,0xa);});var _0x1705ec=_0x4c9fe3[0x0];var _0x4c644a=_0x4c9fe3[0x1];if(_0x1705ec<0x0||_0x1705ec>0x17||_0x4c644a<0x0||_0x4c644a>0x3b){throw new Error(EINVALID_DATE);}return[_0x1705ec,_0x4c644a];}function circularDoWInterval(_0x271547,_0x40cb56){if(_0x271547===_0x40cb56){return[_0x271547];}else{var _0x505d01=moment['locale']();moment[_0x3b0c('0x5')]('en');var _0x164557=moment['weekdaysShort']()[_0x3b0c('0x6')](function(_0x2dd5d5){return _0x2dd5d5[_0x3b0c('0x7')]();});moment['locale'](_0x505d01);var _0x5cc3ec=_0x164557[_0x3b0c('0x8')](_0x271547);var _0x48e86a=_0x164557[_0x3b0c('0x8')](_0x40cb56);if(_0x48e86a>_0x5cc3ec){return _0x164557[_0x3b0c('0x9')](_0x5cc3ec,_0x48e86a+0x1);}else{var _0x36cfe0=_0x164557[_0x3b0c('0x9')](0x0,_0x48e86a+0x1);var _0x2cd335=_0x164557[_0x3b0c('0x9')](_0x5cc3ec);return _0x2cd335[_0x3b0c('0xa')](_0x36cfe0);}}}module['exports'][_0x3b0c('0xb')]=circularDoWInterval;function circularMonthInterval(_0x30f824,_0x34a743){if(_0x30f824===_0x34a743){return[_0x30f824];}else{var _0xd2c3ab=moment['locale']();moment[_0x3b0c('0x5')]('en');var _0x576830=moment[_0x3b0c('0xc')]()[_0x3b0c('0x6')](function(_0x4351d5){return _0x4351d5[_0x3b0c('0x7')]();});moment[_0x3b0c('0x5')](_0xd2c3ab);var _0x543099=_0x576830[_0x3b0c('0x8')](_0x30f824);var _0x43ebe3=_0x576830[_0x3b0c('0x8')](_0x34a743);if(_0x43ebe3>_0x543099){return _0x576830[_0x3b0c('0x9')](_0x543099,_0x43ebe3+0x1);}else{var _0x433b2d=_0x576830[_0x3b0c('0x9')](0x0,_0x43ebe3+0x1);var _0x5761d9=_0x576830[_0x3b0c('0x9')](_0x543099);return _0x5761d9[_0x3b0c('0xa')](_0x433b2d);}}}module[_0x3b0c('0xd')][_0x3b0c('0xe')]=circularMonthInterval;function parseDom(_0x3a78ff){var _0x3b2099=parseInt(_0x3a78ff,0xa);if(_0x3b2099<0x1||_0x3b2099>0x1f){throw new Error(EINVALID_DATE);}return _0x3b2099;}function timeCompare(_0x3c6226,_0x485a3d,_0x1e583b){var _0x4a3e06=_0x3c6226[_0x3b0c('0xf')]();var _0x4063ae=extractTime(_0x485a3d);var _0x4a304c=_0x4063ae[0x0];var _0x244745=_0x4063ae[0x1];var _0x2d27bd=_0x3c6226[_0x3b0c('0xf')]()[_0x3b0c('0x10')](_0x4a304c)[_0x3b0c('0x11')](_0x244745);throwIfDateNotValid(_0x2d27bd);var _0x232190=extractTime(_0x1e583b);var _0x5bd2cc=_0x232190[0x0];var _0x226fa4=_0x232190[0x1];var _0x3f4c04=_0x3c6226[_0x3b0c('0xf')]()[_0x3b0c('0x10')](_0x5bd2cc)[_0x3b0c('0x11')](_0x226fa4);throwIfDateNotValid(_0x3f4c04);if(_0x3f4c04[_0x3b0c('0x12')](_0x2d27bd)){var _0x555ee1=_0x4a3e06[_0x3b0c('0xf')]()[_0x3b0c('0x13')](_0x3b0c('0x14'));var _0x412b27=_0x4a3e06[_0x3b0c('0xf')]()[_0x3b0c('0x15')](_0x3b0c('0x14'));return _0x4a3e06[_0x3b0c('0x16')](_0x2d27bd,_0x412b27,undefined,'[]')||_0x4a3e06[_0x3b0c('0x16')](_0x555ee1,_0x3f4c04,undefined,'[]');}else{return _0x4a3e06[_0x3b0c('0x16')](_0x2d27bd,_0x3f4c04,undefined,'[]');}}module[_0x3b0c('0xd')][_0x3b0c('0x17')]=timeCompare;function dowCompare(_0x5d58e5,_0x2dd7a7,_0x58240c){var _0x18959=_0x5d58e5[_0x3b0c('0x5')]('en')['format']('ddd')[_0x3b0c('0x7')]();return circularDoWInterval(_0x2dd7a7,_0x58240c)[_0x3b0c('0x18')](_0x18959);}module[_0x3b0c('0xd')]['dowCompare']=dowCompare;function domCompare(_0x56c516,_0x41a650,_0x38dafd){var _0x5dd44a=_0x56c516['date']();if(_0x41a650===_0x38dafd){return _0x5dd44a===_0x41a650;}else{var _0xd92ecb=_0x56c516[_0x3b0c('0x19')]();var _0x3d13f7=_0x41a650<_0x38dafd;let _0x465487=![];var _0x5265ef=0x0;var _0xecc7c3=0x0;if(_0x3d13f7){_0x5265ef=Math[_0x3b0c('0x1a')](0x1,_0x41a650);_0xecc7c3=Math['min'](_0x38dafd,_0xd92ecb);_0x465487=_0x5dd44a>=_0x5265ef&&_0x5dd44a<=_0xecc7c3;}else{_0x5265ef=Math[_0x3b0c('0x1b')](_0x41a650,_0xd92ecb);_0xecc7c3=Math[_0x3b0c('0x1a')](0x1,_0x38dafd);_0x465487=_0x5dd44a>=_0x5265ef||_0x5dd44a<=_0xecc7c3;}return _0x465487;}}module[_0x3b0c('0xd')][_0x3b0c('0x1c')]=domCompare;function monthCompare(_0x3b7580,_0x2c8c62,_0x3ecb88){var _0x3d5d60=_0x3b7580[_0x3b0c('0x5')]('en')[_0x3b0c('0x1d')](_0x3b0c('0x1e'))[_0x3b0c('0x7')]();return circularMonthInterval(_0x2c8c62,_0x3ecb88)[_0x3b0c('0x18')](_0x3d5d60);}module[_0x3b0c('0xd')][_0x3b0c('0x1f')]=monthCompare;function iftime(_0x200f66,_0x132409=moment['tz'][_0x3b0c('0x20')](),_0x146a96=moment()){if(!validateRx[_0x3b0c('0x21')](_0x200f66)){throw new Error(EINVALID_STRING);}else{var _0x29a7c3=(moment[_0x3b0c('0x22')](_0x146a96)?_0x146a96[_0x3b0c('0xf')]():moment(_0x146a96))['tz'](_0x132409)[_0x3b0c('0x5')]('en');throwIfDateNotValid(_0x29a7c3);var _0x3ea44d=_0x200f66['split'](',');var _0x2c8169=_0x3ea44d[0x0];var _0x43c1a4=_0x3ea44d[0x1];var _0x1e6e07=_0x3ea44d[0x2];var _0x2e6748=_0x3ea44d[0x3];let _0x2c470d=!![];if(_0x2c8169!=='*'){var _0x1bbdb6=_0x2c8169[_0x3b0c('0x23')]('-');var _0x3e5363=_['padStart'](_0x1bbdb6[0x0],0x5,'0');var _0x53fdf5=_0x1bbdb6[_0x3b0c('0x24')]===0x2?_[_0x3b0c('0x25')](_0x1bbdb6[0x1],0x5,'0'):_0x3e5363;_0x2c470d=timeCompare(_0x29a7c3,_0x3e5363,_0x53fdf5);}let _0x5716f1=!![];if(_0x43c1a4!=='*'){var _0x31a7a7=_0x43c1a4[_0x3b0c('0x23')]('-');var _0x1ecbf2=_0x31a7a7[0x0];var _0x28981a=_0x31a7a7['length']===0x2?_0x31a7a7[0x1]:_0x1ecbf2;_0x5716f1=dowCompare(_0x29a7c3,_0x1ecbf2,_0x28981a);}let _0x5e9004=!![];if(_0x1e6e07!=='*'){var _0x386db7=_0x1e6e07[_0x3b0c('0x23')]('-');var _0x31fb15=parseDom(_0x386db7[0x0]);var _0x95a718=_0x386db7[_0x3b0c('0x24')]===0x2?parseDom(_0x386db7[0x1]):_0x31fb15;_0x5e9004=domCompare(_0x29a7c3,_0x31fb15,_0x95a718);}let _0x5003c6=!![];if(_0x2e6748!=='*'){var _0x24e92f=_0x2e6748['split']('-');var _0x3e849b=_0x24e92f[0x0];var _0x3cc18f=_0x24e92f['length']===0x2?_0x24e92f[0x1]:_0x24e92f[0x0];_0x5003c6=monthCompare(_0x29a7c3,_0x3e849b,_0x3cc18f);}return _0x2c470d&&_0x5716f1&&_0x5e9004&&_0x5003c6;}}module[_0x3b0c('0xd')][_0x3b0c('0x26')]=iftime; \ No newline at end of file diff --git a/server/utils/loggers.js b/server/utils/loggers.js index 5c6d444..406175d 100644 --- a/server/utils/loggers.js +++ b/server/utils/loggers.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x11a8=['%s-%s','error','File','consoleLogger','fileLogger','path','util','moment','winston','debugLevel','redBG\x20white','red','white','bold\x20white','bold\x20green','gray','bold\x20blue','bold\x20cyan','addColors','/var/log/xcally','join','format','%s-%s.log','message','replace','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','{{{','meta','keys','stringify','[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s','transports','Console','warn','Logger'];(function(_0x580576,_0x2f107d){var _0x3f55a0=function(_0x2e180b){while(--_0x2e180b){_0x580576['push'](_0x580576['shift']());}};_0x3f55a0(++_0x2f107d);}(_0x11a8,0xef));var _0x811a=function(_0x15bf0e,_0x1d2062){_0x15bf0e=_0x15bf0e-0x0;var _0x1f7592=_0x11a8[_0x15bf0e];return _0x1f7592;};'use strict';var path=require(_0x811a('0x0'));var util=require(_0x811a('0x1'));var moment=require(_0x811a('0x2'));var winston=require(_0x811a('0x3'));var config=require('../config/environment');var debugLevel=config[_0x811a('0x4')]?config[_0x811a('0x4')]['toLowerCase']():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0x811a('0x5'),'error':_0x811a('0x6'),'warn':'bold\x20yellow','info':_0x811a('0x7'),'print':_0x811a('0x8'),'success':_0x811a('0x9'),'http':_0x811a('0xa'),'verbose':'bold\x20magenta','debug':_0x811a('0xb'),'silly':_0x811a('0xc')};winston[_0x811a('0xd')](XC_LOG_COLORS);function getLogFileName(_0x10510a,_0x33dac3,_0x1d115e){var _0x4f9651=_0x10510a||_0x811a('0xe');return path[_0x811a('0xf')](_0x4f9651,util[_0x811a('0x10')](_0x811a('0x11'),_0x33dac3,_0x1d115e));}function formatter(_0x3bfed9,_0x5bcf7f){_0x5bcf7f[_0x811a('0x12')]=_0x5bcf7f[_0x811a('0x12')][_0x811a('0x13')](/@@{/g,'{{{')[_0x811a('0x13')](/}@@/g,_0x811a('0x14'))['replace'](/@{/g,'{{')[_0x811a('0x13')](/}@/g,'}}');return util[_0x811a('0x10')](_0x811a('0x15'),moment()[_0x811a('0x10')](_0x811a('0x16')),_0x5bcf7f[_0x811a('0x17')][_0x811a('0x18')](),_0x3bfed9,_0x5bcf7f['message']);}function fileFormat(_0x2239df,_0x672f27){_0x672f27[_0x811a('0x12')]=_0x672f27[_0x811a('0x12')][_0x811a('0x13')](/@@{/g,_0x811a('0x19'))[_0x811a('0x13')](/}@@/g,_0x811a('0x14'))[_0x811a('0x13')](/@{/g,'{{')[_0x811a('0x13')](/}@/g,'}}');var _0xc3d16b=_0x672f27[_0x811a('0x1a')]&&Object[_0x811a('0x1b')](_0x672f27[_0x811a('0x1a')])['length']?'\x0a\x09'+JSON[_0x811a('0x1c')](_0x672f27['meta']):'';return util['format'](_0x811a('0x1d'),moment()[_0x811a('0x10')](_0x811a('0x16')),_0x672f27[_0x811a('0x17')][_0x811a('0x18')](),_0x2239df,_0x672f27[_0x811a('0x12')],_0xc3d16b);}function consoleLogger(){var _0x40f29d=new winston['Logger']({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x811a('0x1e'))][(_0x811a('0x1f'))]({'level':_0x811a('0x20'),'json':![],'formatter':function(_0x33c6b2){return formatter('',_0x33c6b2);}})]});return _0x40f29d;}function fileLogger(_0xa0c9ed,_0x30b72c){var _0x4ec72b=new winston[(_0x811a('0x21'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0x811a('0x1e'))]['File']({'name':util[_0x811a('0x10')](_0x811a('0x22'),_0xa0c9ed,'error'),'filename':getLogFileName(_0x30b72c,_0xa0c9ed,_0x811a('0x23')),'level':_0x811a('0x23'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x1434ed){return fileFormat(_0xa0c9ed,_0x1434ed);}}),new winston[(_0x811a('0x1e'))][(_0x811a('0x24'))]({'name':util[_0x811a('0x10')](_0x811a('0x22'),_0xa0c9ed,debugLevel),'filename':getLogFileName(_0x30b72c,_0xa0c9ed,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x4955d0){return fileFormat(_0xa0c9ed,_0x4955d0);}}),new winston['transports'][(_0x811a('0x1f'))]({'level':_0x811a('0x20'),'json':![],'formatter':function(_0x47431f){return fileFormat(_0xa0c9ed,_0x47431f);}})]});return _0x4ec72b;}exports[_0x811a('0x25')]=consoleLogger;exports[_0x811a('0x26')]=fileLogger; \ No newline at end of file +var _0x5abe=['bold\x20white','bold\x20green','gray','bold\x20magenta','join','format','%s-%s.log','message','replace','{{{','}}}','[%s]\x20[%s]\x20%s\x20-\x20%s','YYYY-MM-DD\x20HH:mm:ss','level','toUpperCase','meta','stringify','Logger','transports','Console','warn','File','%s-%s','error','fileLogger','path','util','moment','../config/environment','debugLevel','toLowerCase','redBG\x20white','red','white'];(function(_0x4014e5,_0x125e6a){var _0x4ee8b7=function(_0x2475da){while(--_0x2475da){_0x4014e5['push'](_0x4014e5['shift']());}};_0x4ee8b7(++_0x125e6a);}(_0x5abe,0xe5));var _0xe5ab=function(_0x46cd04,_0x32f2da){_0x46cd04=_0x46cd04-0x0;var _0x108808=_0x5abe[_0x46cd04];return _0x108808;};'use strict';var path=require(_0xe5ab('0x0'));var util=require(_0xe5ab('0x1'));var moment=require(_0xe5ab('0x2'));var winston=require('winston');var config=require(_0xe5ab('0x3'));var debugLevel=config[_0xe5ab('0x4')]?config['debugLevel'][_0xe5ab('0x5')]():'info';var XC_LOG_LEVELS={'fatal':0x0,'error':0x0,'warn':0x1,'info':0x2,'print':0x2,'success':0x2,'http':0x3,'verbose':0x4,'debug':0x5,'silly':0x6};var XC_LOG_COLORS={'fatal':_0xe5ab('0x6'),'error':_0xe5ab('0x7'),'warn':'bold\x20yellow','info':_0xe5ab('0x8'),'print':_0xe5ab('0x9'),'success':_0xe5ab('0xa'),'http':_0xe5ab('0xb'),'verbose':_0xe5ab('0xc'),'debug':'bold\x20blue','silly':'bold\x20cyan'};winston['addColors'](XC_LOG_COLORS);function getLogFileName(_0x4cba67,_0x9c3652,_0x3414d4){var _0x1e911c=_0x4cba67||'/var/log/xcally';return path[_0xe5ab('0xd')](_0x1e911c,util[_0xe5ab('0xe')](_0xe5ab('0xf'),_0x9c3652,_0x3414d4));}function formatter(_0x2526f6,_0x4fc565){_0x4fc565['message']=_0x4fc565[_0xe5ab('0x10')][_0xe5ab('0x11')](/@@{/g,_0xe5ab('0x12'))[_0xe5ab('0x11')](/}@@/g,_0xe5ab('0x13'))[_0xe5ab('0x11')](/@{/g,'{{')[_0xe5ab('0x11')](/}@/g,'}}');return util['format'](_0xe5ab('0x14'),moment()[_0xe5ab('0xe')](_0xe5ab('0x15')),_0x4fc565[_0xe5ab('0x16')][_0xe5ab('0x17')](),_0x2526f6,_0x4fc565[_0xe5ab('0x10')]);}function fileFormat(_0x2649ca,_0x418871){_0x418871['message']=_0x418871[_0xe5ab('0x10')][_0xe5ab('0x11')](/@@{/g,'{{{')[_0xe5ab('0x11')](/}@@/g,_0xe5ab('0x13'))[_0xe5ab('0x11')](/@{/g,'{{')['replace'](/}@/g,'}}');var _0x5632f6=_0x418871[_0xe5ab('0x18')]&&Object['keys'](_0x418871['meta'])['length']?'\x0a\x09'+JSON[_0xe5ab('0x19')](_0x418871[_0xe5ab('0x18')]):'';return util[_0xe5ab('0xe')]('[%s]\x20[%s]\x20%s\x20-\x20%s\x20%s',moment()[_0xe5ab('0xe')](_0xe5ab('0x15')),_0x418871['level']['toUpperCase'](),_0x2649ca,_0x418871[_0xe5ab('0x10')],_0x5632f6);}function consoleLogger(){var _0x48bb67=new winston[(_0xe5ab('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xe5ab('0x1b'))][(_0xe5ab('0x1c'))]({'level':_0xe5ab('0x1d'),'json':![],'formatter':function(_0x9ca632){return formatter('',_0x9ca632);}})]});return _0x48bb67;}function fileLogger(_0x24cc58,_0x1e0af4){var _0x48defe=new winston[(_0xe5ab('0x1a'))]({'levels':XC_LOG_LEVELS,'transports':[new winston[(_0xe5ab('0x1b'))][(_0xe5ab('0x1e'))]({'name':util[_0xe5ab('0xe')](_0xe5ab('0x1f'),_0x24cc58,'error'),'filename':getLogFileName(_0x1e0af4,_0x24cc58,_0xe5ab('0x20')),'level':_0xe5ab('0x20'),'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0x5d40dc){return fileFormat(_0x24cc58,_0x5d40dc);}}),new winston['transports']['File']({'name':util[_0xe5ab('0xe')](_0xe5ab('0x1f'),_0x24cc58,debugLevel),'filename':getLogFileName(_0x1e0af4,_0x24cc58,debugLevel),'level':debugLevel,'json':![],'maxsize':0xa00000,'maxFiles':0xa,'tailable':!![],'formatter':function(_0xd27df3){return fileFormat(_0x24cc58,_0xd27df3);}}),new winston[(_0xe5ab('0x1b'))][(_0xe5ab('0x1c'))]({'level':'warn','json':![],'formatter':function(_0x50cc9d){return fileFormat(_0x24cc58,_0x50cc9d);}})]});return _0x48defe;}exports['consoleLogger']=consoleLogger;exports[_0xe5ab('0x21')]=fileLogger; \ No newline at end of file diff --git a/server/utils/mask-sensitive-data.js b/server/utils/mask-sensitive-data.js index 81357b2..2e1f6c8 100644 --- a/server/utils/mask-sensitive-data.js +++ b/server/utils/mask-sensitive-data.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x66fa=['calleridnum','vidaooApiKey','privateKey','secretaccesskey','key','user','localstationid','oldPassword','isPlainObject','length','isString','replace','includes','exports','maskSensitiveData','lodash','username','newPassword','apiKey','firstName','lastName','street','phone','mobile','clientId','clientSecret','securityToken','code','accessKey','token','accessToken','authToken','calleridname'];(function(_0x549f54,_0x56ef2d){var _0xf9c194=function(_0x3fc239){while(--_0x3fc239){_0x549f54['push'](_0x549f54['shift']());}};_0xf9c194(++_0x56ef2d);}(_0x66fa,0x117));var _0xa66f=function(_0x603db0,_0x9a8425){_0x603db0=_0x603db0-0x0;var _0x51d5ec=_0x66fa[_0x603db0];return _0x51d5ec;};var _=require(_0xa66f('0x0'));var sensitiveFields=[_0xa66f('0x1'),'password',_0xa66f('0x2'),_0xa66f('0x3'),_0xa66f('0x4'),_0xa66f('0x5'),_0xa66f('0x6'),_0xa66f('0x7'),_0xa66f('0x8'),'fax','email',_0xa66f('0x9'),_0xa66f('0xa'),_0xa66f('0xb'),_0xa66f('0xc'),_0xa66f('0xd'),'tenantId',_0xa66f('0xe'),'channelSecret',_0xa66f('0xf'),'accessTokenSecret',_0xa66f('0x10'),'consumerKey','consumerSecret','membername',_0xa66f('0x11'),_0xa66f('0x12'),'exten',_0xa66f('0x13'),'clientEmail',_0xa66f('0x14'),'accesskeyid',_0xa66f('0x15'),_0xa66f('0x16'),_0xa66f('0x17'),'pass','accountSid',_0xa66f('0x18'),'dsn','secret','registry',_0xa66f('0x19')];function maskSensitiveData(_0x452c37){const _0x267129=/(?!^)[\s\S](?!$)/g;if(_[_0xa66f('0x1a')](_0x452c37)){for(const _0xd348f9 in _0x452c37){if(_['isArray'](_0x452c37[_0xd348f9])){for(let _0x5510dc=0x0;_0x5510dc<_0x452c37[_0xd348f9][_0xa66f('0x1b')];_0x5510dc++){maskSensitiveData(_0x452c37[_0xd348f9][_0x5510dc]);}}else if(_[_0xa66f('0x1a')](_0x452c37[_0xd348f9])){maskSensitiveData(_0x452c37[_0xd348f9]);}else if(_[_0xa66f('0x1c')](_0x452c37[_0xd348f9])){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](/{{{/g,'@@{')[_0xa66f('0x1d')](/}}}/g,'}@@')['replace'](/{{/g,'@{')[_0xa66f('0x1d')](/}}/g,'}@');if(_[_0xa66f('0x1e')](sensitiveFields,_0xd348f9)){_0x452c37[_0xd348f9]=_0x452c37[_0xd348f9][_0xa66f('0x1d')](_0x267129,'*');}}}}}module[_0xa66f('0x1f')][_0xa66f('0x20')]=maskSensitiveData; \ No newline at end of file +var _0xda2d=['@@{','replace','}@@','includes','exports','maskSensitiveData','username','password','newPassword','apiKey','firstName','mobile','fax','email','clientId','clientSecret','securityToken','code','accessKey','tenantId','token','accessToken','accessTokenSecret','consumerKey','consumerSecret','membername','calleridname','calleridnum','exten','vidaooApiKey','clientEmail','key','user','pass','accountSid','localstationid','dsn','secret','oldPassword','isPlainObject','isArray','isString'];(function(_0x508578,_0x11e296){var _0x12875a=function(_0x19f31f){while(--_0x19f31f){_0x508578['push'](_0x508578['shift']());}};_0x12875a(++_0x11e296);}(_0xda2d,0x102));var _0xdda2=function(_0x1abbc1,_0x35cbf2){_0x1abbc1=_0x1abbc1-0x0;var _0x52cc25=_0xda2d[_0x1abbc1];return _0x52cc25;};var _=require('lodash');var sensitiveFields=[_0xdda2('0x0'),_0xdda2('0x1'),_0xdda2('0x2'),_0xdda2('0x3'),_0xdda2('0x4'),'lastName','street','phone',_0xdda2('0x5'),_0xdda2('0x6'),_0xdda2('0x7'),_0xdda2('0x8'),_0xdda2('0x9'),_0xdda2('0xa'),_0xdda2('0xb'),_0xdda2('0xc'),_0xdda2('0xd'),_0xdda2('0xe'),'channelSecret',_0xdda2('0xf'),_0xdda2('0x10'),'authToken',_0xdda2('0x11'),_0xdda2('0x12'),_0xdda2('0x13'),_0xdda2('0x14'),_0xdda2('0x15'),_0xdda2('0x16'),_0xdda2('0x17'),_0xdda2('0x18'),'privateKey','accesskeyid','secretaccesskey',_0xdda2('0x19'),_0xdda2('0x1a'),_0xdda2('0x1b'),_0xdda2('0x1c'),_0xdda2('0x1d'),_0xdda2('0x1e'),_0xdda2('0x1f'),'registry',_0xdda2('0x20')];function maskSensitiveData(_0x4b0220){const _0xbef148=/(?!^)[\s\S](?!$)/g;if(_[_0xdda2('0x21')](_0x4b0220)){for(const _0x3553d5 in _0x4b0220){if(_[_0xdda2('0x22')](_0x4b0220[_0x3553d5])){for(let _0x1922b1=0x0;_0x1922b1<_0x4b0220[_0x3553d5]['length'];_0x1922b1++){maskSensitiveData(_0x4b0220[_0x3553d5][_0x1922b1]);}}else if(_['isPlainObject'](_0x4b0220[_0x3553d5])){maskSensitiveData(_0x4b0220[_0x3553d5]);}else if(_[_0xdda2('0x23')](_0x4b0220[_0x3553d5])){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5]['replace'](/{{{/g,_0xdda2('0x24'))[_0xdda2('0x25')](/}}}/g,_0xdda2('0x26'))[_0xdda2('0x25')](/{{/g,'@{')[_0xdda2('0x25')](/}}/g,'}@');if(_[_0xdda2('0x27')](sensitiveFields,_0x3553d5)){_0x4b0220[_0x3553d5]=_0x4b0220[_0x3553d5][_0xdda2('0x25')](_0xbef148,'*');}}}}}module[_0xdda2('0x28')][_0xdda2('0x29')]=maskSensitiveData; \ No newline at end of file diff --git a/server/utils/safe-template.js b/server/utils/safe-template.js index 8365db1..6b25335 100644 --- a/server/utils/safe-template.js +++ b/server/utils/safe-template.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0x8952=['exports','safeTemplate','{\x20{\x20','\x20}\x20}','replace','isArray','map','isPlainObject','keys','reduce'];(function(_0x3d2d6f,_0x368872){var _0x5c0022=function(_0x408819){while(--_0x408819){_0x3d2d6f['push'](_0x3d2d6f['shift']());}};_0x5c0022(++_0x368872);}(_0x8952,0x17e));var _0x2895=function(_0x2d62de,_0x1d4df5){_0x2d62de=_0x2d62de-0x0;var _0xa69d77=_0x8952[_0x2d62de];return _0xa69d77;};var _=require('lodash');var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2a7389){return _0x2a7389==='{{'?_0x2895('0x0'):_0x2895('0x1');}function safeTemplate(_0x2d485c){var _0x2454c5=_0x2d485c;if(typeof _0x2d485c==='string'){_0x2454c5=_0x2d485c[_0x2895('0x2')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x2895('0x3')](_0x2d485c)){_0x2454c5=_0x2d485c[_0x2895('0x4')](function(_0x5b28c6){return safeTemplate(_0x5b28c6);});}else if(_[_0x2895('0x5')](_0x2d485c)){_0x2454c5=Object[_0x2895('0x6')](_0x2d485c)[_0x2895('0x7')](function(_0x4ea619,_0x526c32){_0x4ea619[_0x526c32]=safeTemplate(_0x2d485c[_0x526c32]);return _0x4ea619;},{});}return _0x2454c5;}module[_0x2895('0x8')][_0x2895('0x9')]=safeTemplate; \ No newline at end of file +var _0x3266=['\x20}\x20}','string','replace','isArray','keys','reduce','exports','lodash','{\x20{\x20'];(function(_0x7f7bc,_0x376b20){var _0x535a71=function(_0x3a99e8){while(--_0x3a99e8){_0x7f7bc['push'](_0x7f7bc['shift']());}};_0x535a71(++_0x376b20);}(_0x3266,0x6a));var _0x6326=function(_0x5a9c0c,_0x4ec485){_0x5a9c0c=_0x5a9c0c-0x0;var _0x53c77d=_0x3266[_0x5a9c0c];return _0x53c77d;};var _=require(_0x6326('0x0'));var mustacheLikeBracketsRx=/(\{|\}){2}/gm;function bracketsReplacer(_0x2b328d){return _0x2b328d==='{{'?_0x6326('0x1'):_0x6326('0x2');}function safeTemplate(_0x545df7){var _0x6b67c0=_0x545df7;if(typeof _0x545df7===_0x6326('0x3')){_0x6b67c0=_0x545df7[_0x6326('0x4')](mustacheLikeBracketsRx,bracketsReplacer);}else if(Array[_0x6326('0x5')](_0x545df7)){_0x6b67c0=_0x545df7['map'](function(_0x30b22e){return safeTemplate(_0x30b22e);});}else if(_['isPlainObject'](_0x545df7)){_0x6b67c0=Object[_0x6326('0x6')](_0x545df7)[_0x6326('0x7')](function(_0x14208e,_0x5402e5){_0x14208e[_0x5402e5]=safeTemplate(_0x545df7[_0x5402e5]);return _0x14208e;},{});}return _0x6b67c0;}module[_0x6326('0x8')]['safeTemplate']=safeTemplate; \ No newline at end of file diff --git a/server/utils/update-app-config.js b/server/utils/update-app-config.js index 894d7a0..0e9ffa1 100644 --- a/server/utils/update-app-config.js +++ b/server/utils/update-app-config.js @@ -15,4 +15,4 @@ // * treaties. The SOFTWARE PRODUCT is licensed, not sold. * // * * // ************************************************************************* -var _0xc070=['then','updated','info','Updating\x20app.json','exports','fs-extra','path','../config/environment','server/app.json','resolve','legacy-libs','isArray','apps','findIndex','name','motion2','env','string','NODE_PATH','pathExists','readJSON'];(function(_0x449248,_0x39545b){var _0x4e03ac=function(_0x1265d8){while(--_0x1265d8){_0x449248['push'](_0x449248['shift']());}};_0x4e03ac(++_0x39545b);}(_0xc070,0x194));var _0x0c07=function(_0x48c2b7,_0x352f2c){_0x48c2b7=_0x48c2b7-0x0;var _0x1f82d4=_0xc070[_0x48c2b7];return _0x1f82d4;};var fs=require(_0x0c07('0x0'));var path=require(_0x0c07('0x1'));var config=require(_0x0c07('0x2'));var root=config['root'];var APP_JSON_PATH=path['resolve'](root,_0x0c07('0x3'));var NODEPATH=path[_0x0c07('0x4')](root,_0x0c07('0x5'));function setLegacyLibsNodeEnvPath(_0x2559d8){let _0x21c752=![];if(Array[_0x0c07('0x6')](_0x2559d8[_0x0c07('0x7')])){var _0x3ed485=_0x2559d8[_0x0c07('0x7')][_0x0c07('0x8')](function(_0x20e288){return _0x20e288[_0x0c07('0x9')]===_0x0c07('0xa');});if(_0x3ed485>-0x1){var _0x1309c7=_0x2559d8[_0x0c07('0x7')][_0x3ed485];if(typeof _0x1309c7[_0x0c07('0xb')]['NODE_PATH']!==_0x0c07('0xc')){_0x1309c7[_0x0c07('0xb')][_0x0c07('0xd')]=NODEPATH;_0x21c752=!![];}}return{'appConfig':_0x2559d8,'updated':_0x21c752};}}function updateAppConfig(_0xe51f48){return fs[_0x0c07('0xe')](APP_JSON_PATH)['then'](function(_0x5e6c47){if(_0x5e6c47){return fs[_0x0c07('0xf')](APP_JSON_PATH)[_0x0c07('0x10')](function(_0x4bee77){var _0x4bf65e=setLegacyLibsNodeEnvPath(_0x4bee77);if(_0x4bf65e[_0x0c07('0x11')]){_0xe51f48[_0x0c07('0x12')](_0x0c07('0x13'));return fs['writeJSON'](APP_JSON_PATH,_0x4bee77,{'spaces':0x2});}else{return Promise['resolve']();}});}else{return Promise[_0x0c07('0x4')]();}});}module[_0x0c07('0x14')]=updateAppConfig; \ No newline at end of file +var _0x5f74=['updated','info','Updating\x20app.json','writeJSON','exports','fs-extra','path','root','server/app.json','resolve','legacy-libs','isArray','apps','findIndex','name','motion2','string','NODE_PATH','pathExists','then'];(function(_0x364e9f,_0x365f48){var _0x3ea57b=function(_0x28cec4){while(--_0x28cec4){_0x364e9f['push'](_0x364e9f['shift']());}};_0x3ea57b(++_0x365f48);}(_0x5f74,0x109));var _0x45f7=function(_0x47b319,_0x48b84e){_0x47b319=_0x47b319-0x0;var _0x526f4b=_0x5f74[_0x47b319];return _0x526f4b;};var fs=require(_0x45f7('0x0'));var path=require(_0x45f7('0x1'));var config=require('../config/environment');var root=config[_0x45f7('0x2')];var APP_JSON_PATH=path['resolve'](root,_0x45f7('0x3'));var NODEPATH=path[_0x45f7('0x4')](root,_0x45f7('0x5'));function setLegacyLibsNodeEnvPath(_0x44696f){let _0x16b67d=![];if(Array[_0x45f7('0x6')](_0x44696f[_0x45f7('0x7')])){var _0x9e70df=_0x44696f['apps'][_0x45f7('0x8')](function(_0x29f436){return _0x29f436[_0x45f7('0x9')]===_0x45f7('0xa');});if(_0x9e70df>-0x1){var _0x306e59=_0x44696f['apps'][_0x9e70df];if(typeof _0x306e59['env']['NODE_PATH']!==_0x45f7('0xb')){_0x306e59['env'][_0x45f7('0xc')]=NODEPATH;_0x16b67d=!![];}}return{'appConfig':_0x44696f,'updated':_0x16b67d};}}function updateAppConfig(_0x26a8ae){return fs[_0x45f7('0xd')](APP_JSON_PATH)[_0x45f7('0xe')](function(_0x3ca4ca){if(_0x3ca4ca){return fs['readJSON'](APP_JSON_PATH)[_0x45f7('0xe')](function(_0x45ee8a){var _0x4bc4d4=setLegacyLibsNodeEnvPath(_0x45ee8a);if(_0x4bc4d4[_0x45f7('0xf')]){_0x26a8ae[_0x45f7('0x10')](_0x45f7('0x11'));return fs[_0x45f7('0x12')](APP_JSON_PATH,_0x45ee8a,{'spaces':0x2});}else{return Promise[_0x45f7('0x4')]();}});}else{return Promise[_0x45f7('0x4')]();}});}module[_0x45f7('0x13')]=updateAppConfig; \ No newline at end of file